[
  {
    "path": ".gitignore",
    "content": "/target\n/local\ntarget/\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n/org.dashbuilder\n\n# Live editing asciidoc leaves .html files behind in the source dir\nuberfire-docs/src/main/asciidoc/*.html\n**/dependency-reduced-pom.xml\n\n**/node_modules\n**/package-lock.json\n**/dist\n"
  },
  {
    "path": "LICENSE",
    "content": "\n                                 Apache License\n                           Version 2.0, January 2004\n                        http://www.apache.org/licenses/\n\n   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n   1. Definitions.\n\n      \"License\" shall mean the terms and conditions for use, reproduction,\n      and distribution as defined by Sections 1 through 9 of this document.\n\n      \"Licensor\" shall mean the copyright owner or entity authorized by\n      the copyright owner that is granting the License.\n\n      \"Legal Entity\" shall mean the union of the acting entity and all\n      other entities that control, are controlled by, or are under common\n      control with that entity. For the purposes of this definition,\n      \"control\" means (i) the power, direct or indirect, to cause the\n      direction or management of such entity, whether by contract or\n      otherwise, or (ii) ownership of fifty percent (50%) or more of the\n      outstanding shares, or (iii) beneficial ownership of such entity.\n\n      \"You\" (or \"Your\") shall mean an individual or Legal Entity\n      exercising permissions granted by this License.\n\n      \"Source\" form shall mean the preferred form for making modifications,\n      including but not limited to software source code, documentation\n      source, and configuration files.\n\n      \"Object\" form shall mean any form resulting from mechanical\n      transformation or translation of a Source form, including but\n      not limited to compiled object code, generated documentation,\n      and conversions to other media types.\n\n      \"Work\" shall mean the work of authorship, whether in Source or\n      Object form, made available under the License, as indicated by a\n      copyright notice that is included in or attached to the work\n      (an example is provided in the Appendix below).\n\n      \"Derivative Works\" shall mean any work, whether in Source or Object\n      form, that is based on (or derived from) the Work and for which the\n      editorial revisions, annotations, elaborations, or other modifications\n      represent, as a whole, an original work of authorship. For the purposes\n      of this License, Derivative Works shall not include works that remain\n      separable from, or merely link (or bind by name) to the interfaces of,\n      the Work and Derivative Works thereof.\n\n      \"Contribution\" shall mean any work of authorship, including\n      the original version of the Work and any modifications or additions\n      to that Work or Derivative Works thereof, that is intentionally\n      submitted to Licensor for inclusion in the Work by the copyright owner\n      or by an individual or Legal Entity authorized to submit on behalf of\n      the copyright owner. For the purposes of this definition, \"submitted\"\n      means any form of electronic, verbal, or written communication sent\n      to the Licensor or its representatives, including but not limited to\n      communication on electronic mailing lists, source code control systems,\n      and issue tracking systems that are managed by, or on behalf of, the\n      Licensor for the purpose of discussing and improving the Work, but\n      excluding communication that is conspicuously marked or otherwise\n      designated in writing by the copyright owner as \"Not a Contribution.\"\n\n      \"Contributor\" shall mean Licensor and any individual or Legal Entity\n      on behalf of whom a Contribution has been received by Licensor and\n      subsequently incorporated within the Work.\n\n   2. Grant of Copyright License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      copyright license to reproduce, prepare Derivative Works of,\n      publicly display, publicly perform, sublicense, and distribute the\n      Work and such Derivative Works in Source or Object form.\n\n   3. Grant of Patent License. Subject to the terms and conditions of\n      this License, each Contributor hereby grants to You a perpetual,\n      worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n      (except as stated in this section) patent license to make, have made,\n      use, offer to sell, sell, import, and otherwise transfer the Work,\n      where such license applies only to those patent claims licensable\n      by such Contributor that are necessarily infringed by their\n      Contribution(s) alone or by combination of their Contribution(s)\n      with the Work to which such Contribution(s) was submitted. If You\n      institute patent litigation against any entity (including a\n      cross-claim or counterclaim in a lawsuit) alleging that the Work\n      or a Contribution incorporated within the Work constitutes direct\n      or contributory patent infringement, then any patent licenses\n      granted to You under this License for that Work shall terminate\n      as of the date such litigation is filed.\n\n   4. Redistribution. You may reproduce and distribute copies of the\n      Work or Derivative Works thereof in any medium, with or without\n      modifications, and in Source or Object form, provided that You\n      meet the following conditions:\n\n      (a) You must give any other recipients of the Work or\n          Derivative Works a copy of this License; and\n\n      (b) You must cause any modified files to carry prominent notices\n          stating that You changed the files; and\n\n      (c) You must retain, in the Source form of any Derivative Works\n          that You distribute, all copyright, patent, trademark, and\n          attribution notices from the Source form of the Work,\n          excluding those notices that do not pertain to any part of\n          the Derivative Works; and\n\n      (d) If the Work includes a \"NOTICE\" text file as part of its\n          distribution, then any Derivative Works that You distribute must\n          include a readable copy of the attribution notices contained\n          within such NOTICE file, excluding those notices that do not\n          pertain to any part of the Derivative Works, in at least one\n          of the following places: within a NOTICE text file distributed\n          as part of the Derivative Works; within the Source form or\n          documentation, if provided along with the Derivative Works; or,\n          within a display generated by the Derivative Works, if and\n          wherever such third-party notices normally appear. The contents\n          of the NOTICE file are for informational purposes only and\n          do not modify the License. You may add Your own attribution\n          notices within Derivative Works that You distribute, alongside\n          or as an addendum to the NOTICE text from the Work, provided\n          that such additional attribution notices cannot be construed\n          as modifying the License.\n\n      You may add Your own copyright statement to Your modifications and\n      may provide additional or different license terms and conditions\n      for use, reproduction, or distribution of Your modifications, or\n      for any such Derivative Works as a whole, provided Your use,\n      reproduction, and distribution of the Work otherwise complies with\n      the conditions stated in this License.\n\n   5. Submission of Contributions. Unless You explicitly state otherwise,\n      any Contribution intentionally submitted for inclusion in the Work\n      by You to the Licensor shall be under the terms and conditions of\n      this License, without any additional terms or conditions.\n      Notwithstanding the above, nothing herein shall supersede or modify\n      the terms of any separate license agreement you may have executed\n      with Licensor regarding such Contributions.\n\n   6. Trademarks. This License does not grant permission to use the trade\n      names, trademarks, service marks, or product names of the Licensor,\n      except as required for reasonable and customary use in describing the\n      origin of the Work and reproducing the content of the NOTICE file.\n\n   7. Disclaimer of Warranty. Unless required by applicable law or\n      agreed to in writing, Licensor provides the Work (and each\n      Contributor provides its Contributions) on an \"AS IS\" BASIS,\n      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n      implied, including, without limitation, any warranties or conditions\n      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n      PARTICULAR PURPOSE. You are solely responsible for determining the\n      appropriateness of using or redistributing the Work and assume any\n      risks associated with Your exercise of permissions under this License.\n\n   8. Limitation of Liability. In no event and under no legal theory,\n      whether in tort (including negligence), contract, or otherwise,\n      unless required by applicable law (such as deliberate and grossly\n      negligent acts) or agreed to in writing, shall any Contributor be\n      liable to You for damages, including any direct, indirect, special,\n      incidental, or consequential damages of any character arising as a\n      result of this License or out of the use or inability to use the\n      Work (including but not limited to damages for loss of goodwill,\n      work stoppage, computer failure or malfunction, or any and all\n      other commercial damages or losses), even if such Contributor\n      has been advised of the possibility of such damages.\n\n   9. Accepting Warranty or Additional Liability. While redistributing\n      the Work or Derivative Works thereof, You may choose to offer,\n      and charge a fee for, acceptance of support, warranty, indemnity,\n      or other liability obligations and/or rights consistent with this\n      License. However, in accepting such obligations, You may act only\n      on Your own behalf and on Your sole responsibility, not on behalf\n      of any other Contributor, and only if You agree to indemnify,\n      defend, and hold each Contributor harmless for any liability\n      incurred by, or claims asserted against, such Contributor by reason\n      of your accepting any such warranty or additional liability.\n\n   END OF TERMS AND CONDITIONS\n\n   APPENDIX: How to apply the Apache License to your work.\n\n      To apply the Apache License to your work, attach the following\n      boilerplate notice, with the fields enclosed by brackets \"[]\"\n      replaced with your own identifying information. (Don't include\n      the brackets!)  The text should be enclosed in the appropriate\n      comment syntax for the file format. We also recommend that a\n      file or class name and description of purpose be included on the\n      same \"printed page\" as the copyright notice for easier\n      identification within third-party archives.\n\n   Copyright [yyyy] [name of copyright owner]\n\n   Licensed under the Apache License, Version 2.0 (the \"License\");\n   you may not use this file except in compliance with the License.\n   You may obtain a copy of the License at\n\n       http://www.apache.org/licenses/LICENSE-2.0\n\n   Unless required by applicable law or agreed to in writing, software\n   distributed under the License is distributed on an \"AS IS\" BASIS,\n   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n   See the License for the specific language governing permissions and\n   limitations under the License.\n"
  },
  {
    "path": "README.md",
    "content": "[![Uberfire](http://uberfireframework.org/upload/images/uberfire-logo.png)](http://uberfireframework.org/)\n\n[![Build Status](http://ci.kiegroup.org/buildStatus/icon?job=uberfire)](http://ci.kiegroup.org/job/uberfire)\n\nUberfire is a web framework for a superior experience in building extensible workbenches and console type applications.\nIt provides an Eclipse like workbench experience for the web, helping you to make maintainable, customizable workbench-style apps in no time flat.\n\nOur ultimate goal in Uberfire is to provide a strong ecosystem around it, based on a rich set of pluggable components and a strong infrastructure, allowing different type of users easily build Rich Web Apps on top of it.\n\nUberfire is the technology behind of Drools and jBPM web tooling, and is based on challenges and lessons learned during the workbench development of these projects.\n\n## Learning about Uberfire\n\nFor those who prefer hands-on learning, checkout the [Uberfire Tutorial](http://www.uberfireframework.org/docs/tutorial/tutorial.html) to create a working Uberfire application, or learn how to start your own project with our [Getting Started Guide](http://www.uberfireframework.org/docs/gettingStarted/gettingStarted.html).\n\nAnd for those who prefer the top-down approach, you can find a detailed descriptions of how to use Uberfire in our [documentation](http://www.uberfireframework.org/docs/index.html).\n\n## Uberfire Community Support\n\nVisit our IRC channel (#appformer on freenode) to hang out and share solutions with the Uberfire community.\n\n## Contributing to Uberfire\n\nReport bugs or request features through our [issue tracker](https://issues.jboss.org/projects/UF).\n\nContribute code through pull requests to this repository. See our [contributing guidelines](https://github.com/droolsjbpm/droolsjbpm-build-bootstrap/blob/main/README.md) for more details.\n\n## Building and contributing to our documentation\n\nIn order to build and contribute to our documentation, follow this steps\n\n- Fork the repository https://github.com/kiegroup/appformer then clone the fork locally\n- Get gitbook editor from https://github.com/GitbookIO/editor-legacy\n- Get gitbook builder from https://github.com/GitbookIO/gitbook (you may need to install npm first)\n- Edit the docs in your forked repository ../appformer/uberfire-docs in gitbook editor\n- When you've finished editing, build the docs by running uberfire-docs/buildHtml.sh and uberfire-docs/buildPdf.sh\n- View the built docs in uberfire-docs/docs/_book/index.html and uberfire-docs/uberfire-docs.pdf\n- Submit a pull request to get your changes accepted\n\n## License\n\nUberfire Framework is released under Apache 2 License.\n\nCheck [LICENSE](LICENSE-ASL-2.0.txt) file for more information.\n"
  },
  {
    "path": "appformer-client-api/README.md",
    "content": "Appformer Client API\n====================\n\nIntroduction\n------------\nThis module contains basic Appformer client APIs such as:\n- State Control API: API used on _command-based_ editors to keep track of the state of the editor. It provides an injectable `Registry` to keep track of the commands executed on the editor.\n"
  },
  {
    "path": "appformer-client-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-parent</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>appformer-client-api</artifactId>\n  <name>AppFormer Client API</name>\n\n  <description>AppFormer Client API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/context/Channel.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.context;\n\nimport java.util.stream.Stream;\n\npublic enum Channel {\n\n    DEFAULT(\"DEFAULT\"),\n    ONLINE(\"ONLINE\"),\n    VSCODE(\"VSCODE\"),\n    GITHUB(\"GITHUB\"),\n    DESKTOP(\"DESKTOP\"),\n    EMBEDDED(\"EMBEDDED\");\n\n    private final String name;\n\n    Channel(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public static Channel withName(String name) {\n        return Stream.of(Channel.values())\n                .filter(channel -> channel.getName().equalsIgnoreCase(name))\n                .findFirst().orElseThrow(() -> new IllegalArgumentException(\"Name not recognized: \" + name));\n    }\n\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/context/DefaultEditorContextProviderImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.context;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DefaultEditorContextProviderImpl implements EditorContextProvider {\n\n    @Override\n    public Channel getChannel() {\n        return Channel.DEFAULT;\n    }\n\n    @Override\n    public Optional<OperatingSystem> getOperatingSystem() {\n        return Optional.empty();\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/context/EditorContextProvider.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.context;\n\nimport java.util.Optional;\n\n/**\n * Provide access to EditorContext properties\n */\npublic interface EditorContextProvider {\n\n    /**\n     * Access the channel where the editor is running (e.g. ONLINE, GITHUB or VSCODE).\n     * @return The channel where the editor is running or DEFAULT if no channel is available.\n     */\n    Channel getChannel();\n\n    /**\n     * Access the operating system where the editor is running (e.g. MACOS, WINDOWS or LINUX).\n     * @return The operating system where the editor is running or Optional.empty() if no information is available.\n     */\n    Optional<OperatingSystem> getOperatingSystem();\n\n    /**\n     * Checks if the editor is in read only mode.\n     * @return If the editor is in read only mode or if is not.\n     */\n    boolean isReadOnly();\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/context/OperatingSystem.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.context;\n\nimport java.util.stream.Stream;\n\npublic enum OperatingSystem {\n\n    DEFAULT(\"DEFAULT\"),\n    MACOS(\"MACOS\"),\n    LINUX(\"LINUX\"),\n    WINDOWS(\"WINDOWS\");\n\n    private final String name;\n\n    OperatingSystem(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public static OperatingSystem withName(final String name) {\n        return Stream.of(OperatingSystem.values())\n                     .filter(os -> os.getName().equalsIgnoreCase(name))\n                     .findFirst().orElseThrow(() -> new IllegalArgumentException(\"Name not recognized: \" + name));\n    }\n\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/keyboardShortcuts/KeyboardShortcutsApiOpts.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.keyboardShortcuts;\n\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType\npublic class KeyboardShortcutsApiOpts {\n\n    public static final KeyboardShortcutsApiOpts DEFAULT = new KeyboardShortcutsApiOpts(Repeat.NO_REPEAT);\n\n    private final Repeat repeat;\n\n    public KeyboardShortcutsApiOpts(final Repeat repeat) {\n        this.repeat = repeat;\n    }\n\n    @JsProperty\n    public boolean getRepeat() {\n        return Repeat.REPEAT.equals(repeat);\n    }\n\n    /**\n     * Repetition mode for Keyboard Shortcuts.\n     * <p>\n     * REPEAT - When pressing and holding a key, the same action will be fired multiple times.\n     * NO_REPEAT - When pressing and holding a key, the action will be only fired once.\n     */\n    public enum Repeat {\n        REPEAT,\n        NO_REPEAT\n    }\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/stateControl/registry/DefaultRegistry.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.stateControl.registry;\n\npublic interface DefaultRegistry<C> extends Registry<C> {\n\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/stateControl/registry/Registry.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.stateControl.registry;\n\nimport java.util.List;\n\n/**\n * Represents a basic items registry.\n *\n * @param <C> anything that can be registered.\n */\npublic interface Registry<C> {\n\n    /**\n     * Registers an item into the registry\n     *\n     * @param item An item to register\n     */\n    void register(final C item);\n\n    /**\n     * Peeks the last added item. Doesn't remove it.\n     *\n     * @return The last added item\n     */\n    C peek();\n\n    /**\n     * Pops the last added item and removes it.\n     *\n     * @return The last added item\n     */\n    C pop();\n\n    /**\n     * Sets the max number of items that can be stored on the registry.\n     *\n     * @param size A positive integer\n     */\n    void setMaxSize(final int size);\n\n    /**\n     * Clears the registry\n     */\n    void clear();\n\n    /**\n     * Determines if the registry is empty or not\n     *\n     * @return true if empty, false if not.\n     */\n    boolean isEmpty();\n\n    /**\n     * Returns a {@link List} containing all the items in the registry\n     *\n     * @return A {@link List} of containing the registered items\n     */\n    List<C> getHistory();\n\n    /**\n     * Sets a {@link RegistryChangeListener} to be called when the registry changes.\n     *\n     * @param registryChangeListener A {@link RegistryChangeListener}\n     */\n    void setRegistryChangeListener(RegistryChangeListener registryChangeListener);\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/stateControl/registry/RegistryChangeListener.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.stateControl.registry;\n\n/**\n * This functional interface represents the code that will be executed every time there's a change on a {@link Registry}\n */\n@FunctionalInterface\npublic interface RegistryChangeListener {\n\n    /**\n     * Method that will be executed when a change on the registry happens\n     */\n    void notifyRegistryChange();\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/java/org/appformer/client/stateControl/registry/impl/DefaultRegistryImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.stateControl.registry.impl;\n\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Deque;\nimport java.util.List;\n\nimport org.appformer.client.stateControl.registry.DefaultRegistry;\nimport org.appformer.client.stateControl.registry.Registry;\nimport org.appformer.client.stateControl.registry.RegistryChangeListener;\n\n/**\n * The default generic implementation for the {@link Registry} type.\n * It's implemented for achieving an in-memory and lightweight registry approach, don't do an overuse of it.\n * Note: The Stack class behavior when using the iterator is not the expected one, so used\n * ArrayDeque instead of an Stack to provide right iteration order.\n */\npublic class DefaultRegistryImpl<C> implements DefaultRegistry<C> {\n\n    private final Deque<C> items = new ArrayDeque<>();\n    private int maxStackSize = 200;\n    private RegistryChangeListener registryChangeListener;\n\n    @Override\n    public void setMaxSize(final int size) {\n        if (size < 0) {\n            throw new IllegalArgumentException(\"The registry size should be a positive number\");\n        }\n        this.maxStackSize = size;\n    }\n\n    @Override\n    public void register(final C item) {\n        addIntoStack(item);\n        notifyRegistryChange();\n    }\n\n    @Override\n    public void clear() {\n        items.clear();\n        notifyRegistryChange();\n    }\n\n    @Override\n    public List<C> getHistory() {\n        return new ArrayList<>(items);\n    }\n\n    @Override\n    public void setRegistryChangeListener(final RegistryChangeListener registryChangeListener) {\n        this.registryChangeListener = registryChangeListener;\n    }\n\n    @Override\n    public C peek() {\n        return items.peek();\n    }\n\n    @Override\n    public C pop() {\n        C item = items.pop();\n        notifyRegistryChange();\n        return item;\n    }\n\n    @Override\n    public boolean isEmpty() {\n        return items.isEmpty();\n    }\n\n    private void notifyRegistryChange() {\n        if (registryChangeListener != null) {\n            registryChangeListener.notifyRegistryChange();\n        }\n    }\n\n    private void addIntoStack(final C item) {\n        if (null != item) {\n            if ((items.size() + 1) > maxStackSize) {\n                items.removeLast();\n            }\n            items.push(item);\n        }\n    }\n}\n"
  },
  {
    "path": "appformer-client-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details."
  },
  {
    "path": "appformer-client-api/src/main/resources/org/appformer/AppformerClientAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "appformer-client-api/src/test/java/org/appformer/client/stateControl/registry/impl/DefaultRegistryImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.appformer.client.stateControl.registry.impl;\n\nimport org.appformer.client.stateControl.registry.RegistryChangeListener;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultRegistryImplTest {\n\n    private static final Command COMMAND1 = new Command(1);\n    private static final Command COMMAND2 = new Command(2);\n    private static final Command COMMAND3 = new Command(3);\n    private static final Command COMMAND4 = new Command(4);\n\n    @Mock\n    private RegistryChangeListener changeListener;\n\n    private DefaultRegistryImpl<Command> registry;\n\n    @Before\n    public void init() {\n        registry = new DefaultRegistryImpl<>();\n\n        registry.setRegistryChangeListener(changeListener);\n    }\n\n    @Test\n    public void basicTest() {\n        registry.register(COMMAND1);\n        registry.register(COMMAND2);\n        registry.register(COMMAND3);\n        registry.register(COMMAND4);\n\n        verify(changeListener, times(4)).notifyRegistryChange();\n\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(4)\n                .containsExactly(COMMAND4, COMMAND3, COMMAND2, COMMAND1);\n\n        Assertions.assertThat(registry.peek())\n                .isSameAs(COMMAND4);\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(4)\n                .containsExactly(COMMAND4, COMMAND3, COMMAND2, COMMAND1);\n\n        Assertions.assertThat(registry.pop())\n                .isSameAs(COMMAND4);\n\n        verify(changeListener, times(5)).notifyRegistryChange();\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(3)\n                .containsExactly(COMMAND3, COMMAND2, COMMAND1);\n\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.pop())\n                .isSameAs(COMMAND3);\n\n        verify(changeListener, times(6)).notifyRegistryChange();\n\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(2)\n                .containsExactly(COMMAND2, COMMAND1);\n\n        registry.clear();\n        verify(changeListener, times(7)).notifyRegistryChange();\n\n        assertTrue(registry.isEmpty());\n        Assertions.assertThat(registry.getHistory())\n                .isEmpty();\n    }\n\n    @Test\n    public void testAddReachingMax() {\n        registry.setMaxSize(2);\n\n        registry.register(COMMAND1);\n        registry.register(COMMAND2);\n\n        verify(changeListener, times(2)).notifyRegistryChange();\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(2)\n                .containsExactly(COMMAND2, COMMAND1);\n\n        registry.register(COMMAND3);\n\n        verify(changeListener, times(3)).notifyRegistryChange();\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(2)\n                .containsExactly(COMMAND3, COMMAND2);\n\n        registry.register(COMMAND4);\n\n        verify(changeListener, times(4)).notifyRegistryChange();\n        assertFalse(registry.isEmpty());\n\n        Assertions.assertThat(registry.getHistory())\n                .hasSize(2)\n                .containsExactly(COMMAND4, COMMAND3);\n    }\n\n    @Test\n    public void testSettingWrongMax() {\n        Assertions.assertThatThrownBy(() -> registry.setMaxSize(-1))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"The registry size should be a positive number\");\n    }\n\n    public static class Command {\n\n        private Integer id;\n\n        public Command(Integer id) {\n            this.id = id;\n        }\n\n        public Integer getId() {\n            return id;\n        }\n    }\n}\n"
  },
  {
    "path": "appformer-js/.gitignore",
    "content": "node_modules/\ndist/\ncoverage/\ntarget/"
  },
  {
    "path": "appformer-js/README.md",
    "content": "Core\n==\n\nThis package provides the public AppFormer.js API alongside with its Marshalling capabilities.\n\nUsage\n--\n\nImagine you have a ReactComponent\n\n```typescript jsx\nimport * as React from \"react\";\n\nclass MyReactComponent extends React.Component<{ exposing: (self: MyReactComponent) => void }, {}> {\n  public fetchDataAndUpdate() {\n    //fetches some data and updates state\n  }\n\n  public render() {\n    return <div>...</div>;\n  }\n}\n```\n\nTurning it into an `AppFormer.Screen` or `AppFormer.Perspective` is simple:\n\n```typescript jsx\nimport * as React from \"react\";\nimport * as AppFormer from \"appformer-js\";\n\nexport class MyScreen extends AppFormer.Screen {\n  private screen: MyReactComponent;\n\n  constructor() {\n    super(\"my-screen\");\n    this.af_isReact = true;\n    this.af_componentTitle = \"MyScreen title\";\n  }\n\n  af_onOpen(): void {\n    this.screen.fetchDataAndUpdate();\n  }\n\n  af_componentRoot(children?: any): AppFormer.Element {\n    return <MyReactComponent exposing={self => (this.screen = self)} />;\n  }\n}\n\nAppFormer.registerScreen(new MyScreen());\n```\n\n```typescript jsx\nimport * as React from \"react\";\nimport * as AppFormer from \"appformer-js\";\n\nexport class MyPerspective extends AppFormer.Perspective {\n  private perspective: MyReactComponent;\n\n  constructor() {\n    super(\"my-screen\");\n    this.af_isReact = true;\n  }\n\n  af_onOpen(): void {\n    this.perspective.fetchDataAndUpdate();\n  }\n\n  af_componentRoot(children?: any): AppFormer.Element {\n    return <MyReactComponent exposing={self => (this.perspective = self)} />;\n  }\n}\n\nAppFormer.registerPerspective(new MyPerspective());\n```\n\nNote how AppFormer's lifecycle integrates with React's."
  },
  {
    "path": "appformer-js/jest.config.js",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\n        \"default\",\n                [\n                  \"jest-junit\",\n                   {\n                   /*\n                    * Removes spaces from test titles and makes first\n                    * letter of each word capitalized.\n                    *\n                    * unit test -> UnitTest\n                    *\n                    * See junit.xml report for resulting look.\n                    */\n                    titleTemplate: (vars) => {\n                            var str = vars.title.toLowerCase();\n                            str = str.split(' ');\n                            for (var i = 0; i < str.length; i++) {\n                                str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);\n                            }\n                            var result = str.join('');\n                            return result.replace(',');\n                        }\n\n                    }\n                ]\n  ],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  }\n};\n"
  },
  {
    "path": "appformer-js/package.json",
    "content": "{\n  \"name\": \"appformer-js\",\n  \"version\": \"0.0.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/appformer.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"repository\": {\n    \"type\": \"git\",\n    \"url\": \"https://github.com/kiegroup/appformer-js.git\"\n  },\n  \"dependencies\": {\n    \"@types/react\": \"16.14.5\",\n    \"@types/react-dom\": \"16.9.12\",\n    \"bignumber.js\": \"7.2.1\",\n    \"react\": \"16.14.0\",\n    \"react-dom\": \"16.14.0\"\n  },\n  \"scripts\": {\n    \"lint\": \"tslint -c tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest\",\n    \"init\": \"yarn install --force\",\n    \"build\": \"yarn run lint && yarn test && webpack --mode production\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"env\",\n      \"react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\",\n    \"suiteName\": \"org.appformer.js.tests\",\n    \"suiteNameTemplate\": \"{filename}\",\n    \"classNameTemplate\": \"org.appformer.js.tests.{filename}.{classname}\"\n  },\n  \"devDependencies\": {\n    \"@types/jest\": \"23.3.1\",\n    \"babel-core\": \"6.26.3\",\n    \"babel-jest\": \"23.0.0\",\n    \"babel-loader\": \"7.1.5\",\n    \"babel-preset-env\": \"1.7.0\",\n    \"babel-preset-react\": \"6.24.1\",\n    \"circular-dependency-plugin\": \"5.0.2\",\n    \"clean-webpack-plugin\": \"0.1.19\",\n    \"jest\": \"23.5.0\",\n    \"jest-junit\": \"6.3.0\",\n    \"prettier\": \"1.14.2\",\n    \"ts-jest\": \"23.1.3\",\n    \"ts-loader\": \"4.4.2\",\n    \"tslint\": \"5.11.0\",\n    \"tslint-config-prettier\": \"1.15.0\",\n    \"tslint-react\": \"3.6.0\",\n    \"typescript\": \"2.9.2\",\n    \"watch\": \"1.0.2\",\n    \"webpack\": \"4.15.1\",\n    \"webpack-cli\": \"3.0.8\",\n    \"write-file-atomic\": \"2.4.1\"\n  },\n  \"resolutions\": {\n    \"write-file-atomic\": \"2.4.1\"\n  }\n}\n"
  },
  {
    "path": "appformer-js/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.uberfire</groupId>\n        <artifactId>uberfire-parent</artifactId>\n        <version>7.75.0-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <packaging>jar</packaging>\n    <artifactId>appformer-js</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <name>AppFormer.js :: Core</name>\n    <description>AppFormer.js Core</description>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>com.github.eirslett</groupId>\n                <artifactId>frontend-maven-plugin</artifactId>\n                <configuration>\n                    <installDirectory>${project.build.directory}</installDirectory>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>install yarn</id>\n                        <goals>\n                            <goal>install-node-and-yarn</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>install node and npm</id>\n                        <phase>initialize</phase>\n                        <goals>\n                            <goal>install-node-and-npm</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>lock-treatment-tool execution</id>\n                        <phase>initialize</phase>\n                        <goals>\n                        <goal>npm</goal>\n                        </goals>\n                        <configuration>\n                        <arguments>exec @kie/lock-treatment-tool@${version.lock-treatment-tool} --</arguments>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>yarn run init</id>\n                        <goals>\n                            <goal>yarn</goal>\n                        </goals>\n                        <configuration>\n                            <arguments>run init</arguments>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>yarn run build</id>\n                        <goals>\n                            <goal>yarn</goal>\n                        </goals>\n                        <configuration>\n                            <arguments>run build</arguments>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <artifactId>maven-resources-plugin</artifactId>\n                <version>3.1.0</version>\n                <executions>\n                    <execution>\n                        <id>copy-resources</id>\n                        <phase>prepare-package</phase>\n                        <goals>\n                            <goal>copy-resources</goal>\n                        </goals>\n                        <configuration>\n                            <outputDirectory>\n                                ${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/\n                            </outputDirectory>\n                            <resources>\n                                <resource>\n                                    <directory>dist/</directory>\n                                    <filtering>false</filtering>\n                                </resource>\n                                <resource>\n                                    <directory>.</directory>\n                                    <includes>package.json</includes>\n                                </resource>\n                            </resources>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "appformer-js/prettier.config.js",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n    printWidth: 120\n};\n"
  },
  {
    "path": "appformer-js/src/appformer/AppFormer.tsx",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { Element } from \"../core\";\nimport { Screen } from \"./Screen\";\nimport { Perspective } from \"./Perspective\";\nimport { Portable } from \"../marshalling\";\n\n/**\n * AppFormer.js public API.\n *\n */\nexport class AppFormer {\n  /**\n   * Starts an AppFormer instance.\n   * @param container\n   * The DOM element on which AppFormer will start into\n   * @param callback\n   * Function to be executed after AppFormer init is complete\n   */\n  public init(container: HTMLElement, callback: () => void): AppFormer {\n    return this;\n  }\n\n  /**\n   * Registers a Screen component.\n   * @param screen\n   */\n  // tslint:disable-next-line\n  public registerScreen(screen: Screen): void {}\n\n  /**\n   * Registers a Perspective component\n   * @param perspective\n   */\n  // tslint:disable-next-line\n  public registerPerspective(perspective: Perspective): void {}\n\n  /**\n   * Renders the component with the corresponding id.\n   * @param af_componentId\n   * The component id\n   * @param args\n   * Arbitrary arguments to be used by the component\n   */\n  // tslint:disable-next-line\n  public goTo(af_componentId: string, args?: Map<string, any>): void {}\n\n  /**\n   * Translates a bundle key\n   * @param tkey\n   * The bundle key\n   * @param args\n   * The arguments to this bundle\n   */\n  // tslint:disable-next-line\n  public translate(tkey: string, args: string[]): string {\n    throw new Error(\"Not implemented\");\n  }\n\n  /**\n   * Renders a component.\n   * @param element\n   * The component to be rendered\n   * @param container\n   * The DOM element on which the component will be rendered.\n   * @param callback\n   * Function to be executed after the component is done rendering.\n   */\n  // tslint:disable-next-line\n  public render(element: Element, container: HTMLElement, callback: () => void): void {}\n\n  /**\n   * Fires an event using Errai bus.\n   * @param obj\n   * The event object.\n   */\n  // tslint:disable-next-line\n  public fireEvent<T>(obj: Portable<T>): void {}\n\n  /**\n   * Executes an RPC call to an Errai Remote.\n   * @param path\n   * The Errai bus RPC path\n   * @param args\n   * The arguments to this RPC\n   */\n  public rpc(path: string, args: Array<Portable<any>>): Promise<string> {\n    throw new Error(\"Not implemented\");\n  }\n\n  /**\n   * Unrenders a component\n   * @param af_componentId\n   * The component id.\n   */\n  // tslint:disable-next-line\n  public close(af_componentId: string): void {}\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/CompassLayoutPerspective.tsx",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { Perspective } from \"./Perspective\";\nimport { Menu, Toolbar } from \"./Components\";\nimport { Panel, PanelType } from \"./Panel\";\nimport { DisplayInfo } from \"./DisplayInfo\";\nimport { Part } from \"./Part\";\nimport { Element } from \"../core\";\n\n/**\n * Special type of Perspective. It allows its UI to be defined by parts and panels.\n */\nexport class CompassLayoutPerspective extends Perspective {\n  private _af_menus?: Menu[] = undefined;\n  private _af_toolbar?: Toolbar = undefined;\n\n  private _af_defaultPanelType: PanelType = PanelType.MULTI_LIST;\n  private _af_displayInfo: DisplayInfo = new DisplayInfo();\n\n  private _af_parts: Part[] = [];\n  private _af_panels: Panel[] = [];\n\n  protected constructor(componentId: string) {\n    super(componentId);\n    this.af_isTemplated = false;\n  }\n\n  public af_componentRoot(children?: any): Element {\n    // TODO: translate compass layout to a templated component\n    return <div />;\n  }\n\n  get af_menus(): Menu[] | undefined {\n    return this._af_menus;\n  }\n\n  set af_menus(value: Menu[] | undefined) {\n    this._af_menus = value;\n  }\n\n  get af_toolbar(): Toolbar | undefined {\n    return this._af_toolbar;\n  }\n\n  set af_toolbar(value: Toolbar | undefined) {\n    this._af_toolbar = value;\n  }\n\n  get af_defaultPanelType(): PanelType {\n    return this._af_defaultPanelType;\n  }\n\n  set af_defaultPanelType(value: PanelType) {\n    this._af_defaultPanelType = value;\n  }\n\n  get af_displayInfo(): DisplayInfo {\n    return this._af_displayInfo;\n  }\n\n  set af_displayInfo(value: DisplayInfo) {\n    this._af_displayInfo = value;\n  }\n\n  get af_parts(): Part[] {\n    return this._af_parts;\n  }\n\n  set af_parts(value: Part[]) {\n    this._af_parts = value;\n  }\n\n  get af_panels(): Panel[] {\n    return this._af_panels;\n  }\n\n  set af_panels(value: Panel[]) {\n    this._af_panels = value;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Component.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Component as CoreComponent } from \"../core\";\nimport { Element } from \"../core\";\n\n/**\n * Base AppFormer.js component. It contains the default life-cycle methods that are common to all components.\n *\n */\nexport abstract class Component extends CoreComponent {\n  public readonly af_componentId: string;\n  public af_subscriptions: Map<string, ((event: any) => void)> = new Map();\n\n  protected constructor(args: { type: string; af_componentId: string }) {\n    super({ type: args.type, core_componentId: args.af_componentId });\n    this.af_componentId = args.af_componentId;\n  }\n\n  public af_onStartup(): void {\n    //\n  }\n\n  public af_onOpen(): void {\n    //\n  }\n\n  public af_onFocus(): void {\n    //\n  }\n\n  public af_onLostFocus(): void {\n    //\n  }\n\n  public af_onMayClose(): boolean {\n    return true;\n  }\n\n  public af_onClose(): void {\n    //\n  }\n\n  public af_onShutdown(): void {\n    //\n  }\n\n  public core_componentRoot(children?: any): Element {\n    return this.af_componentRoot(children);\n  }\n\n  public abstract af_componentRoot(children?: any): Element;\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/ComponentTypes.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum ComponentTypes {\n  SCREEN = \"screen\",\n  PERSPECTIVE = \"perspective\",\n  APPFORMER = \"appformer\",\n  EDITOR = \"editor\"\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Components.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const DefaultComponentContainerId = \"af-js-default-screen-container\";\n\nexport class Menu {\n  // TODO\n}\n\nexport class Toolbar {\n  // TODO\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/DisplayInfo.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class DisplayInfo {\n  private _contextId?: string = undefined;\n  private _contextDisplayMode: ContextDisplayMode = ContextDisplayMode.SHOW;\n\n  get contextId(): string | undefined {\n    return this._contextId;\n  }\n\n  set contextId(value: string | undefined) {\n    this._contextId = value;\n  }\n\n  get contextDisplayMode(): ContextDisplayMode {\n    return this._contextDisplayMode;\n  }\n\n  set contextDisplayMode(value: ContextDisplayMode) {\n    this._contextDisplayMode = value;\n  }\n}\n\nexport enum ContextDisplayMode {\n  SHOW = \"SHOW\",\n  HIDE = \"HIDE\"\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Panel.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Part } from \"./Part\";\nimport { DisplayInfo } from \"./DisplayInfo\";\n\nexport enum PanelType {\n  MULTI_LIST = \"org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter\",\n  STATIC = \"org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter\"\n}\n\nexport enum CompassPosition {\n  NONE = \"NONE\",\n  NORTH = \"NORTH\",\n  SOUTH = \"SOUTH\",\n  EAST = \"EAST\",\n  WEST = \"WEST\",\n  SELF = \"SELF\",\n  ROOT = \"ROOT\",\n  CENTER = \"CENTER\"\n}\n\n/**\n * Panel of a CompassLayoutPerspective\n */\nexport class Panel {\n  private _position: CompassPosition;\n  private _width: number = -1;\n  private _minWidth: number = -1;\n  private _height: number = -1;\n  private _minHeight: number = -1;\n\n  private _children: Panel[] = [];\n  private _parts: Part[] = [];\n\n  private _panelType: PanelType = PanelType.MULTI_LIST;\n  private _displayInfo: DisplayInfo = new DisplayInfo();\n\n  constructor(position: CompassPosition) {\n    this._position = position;\n  }\n\n  get position(): CompassPosition {\n    return this._position;\n  }\n\n  set position(value: CompassPosition) {\n    this._position = value;\n  }\n\n  get width(): number {\n    return this._width;\n  }\n\n  set width(value: number) {\n    this._width = value;\n  }\n\n  get minWidth(): number {\n    return this._minWidth;\n  }\n\n  set minWidth(value: number) {\n    this._minWidth = value;\n  }\n\n  get height(): number {\n    return this._height;\n  }\n\n  set height(value: number) {\n    this._height = value;\n  }\n\n  get minHeight(): number {\n    return this._minHeight;\n  }\n\n  set minHeight(value: number) {\n    this._minHeight = value;\n  }\n\n  get children(): Panel[] {\n    return this._children;\n  }\n\n  set children(value: Panel[]) {\n    this._children = value;\n  }\n\n  get parts(): Part[] {\n    return this._parts;\n  }\n\n  set parts(value: Part[]) {\n    this._parts = value;\n  }\n\n  get panelType(): PanelType {\n    return this._panelType;\n  }\n\n  set panelType(value: PanelType) {\n    this._panelType = value;\n  }\n\n  get displayInfo(): DisplayInfo {\n    return this._displayInfo;\n  }\n\n  set displayInfo(value: DisplayInfo) {\n    this._displayInfo = value;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Part.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DisplayInfo } from \"./DisplayInfo\";\n\n/**\n * Part of a CompassLayoutPerspective\n */\nexport class Part {\n  private _placeName: string;\n  private _displayInfo: DisplayInfo = new DisplayInfo();\n  private _parameters: {} = {};\n\n  constructor(placeName: string) {\n    this._placeName = placeName;\n  }\n\n  get placeName(): string {\n    return this._placeName;\n  }\n\n  set placeName(value: string) {\n    this._placeName = value;\n  }\n\n  get displayInfo(): DisplayInfo {\n    return this._displayInfo;\n  }\n\n  set displayInfo(value: DisplayInfo) {\n    this._displayInfo = value;\n  }\n\n  get parameters(): {} {\n    return this._parameters;\n  }\n\n  set parameters(value: {}) {\n    this._parameters = value;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Perspective.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Component } from \"./Component\";\n\n/**\n * Perspective component API. Implement this class to create a Perspective.\n */\nexport abstract class Perspective extends Component {\n  public af_name: string;\n  public af_perspectiveScreens: string[] = [];\n  public af_isDefault: boolean = false;\n  public af_isTransient: boolean = true;\n  public af_isTemplated: boolean = true;\n\n  protected constructor(componentId: string) {\n    super({ type: \"perspective\", af_componentId: componentId });\n  }\n\n  public af_onStartup(): void {\n    //\n  }\n\n  public af_onOpen(): void {\n    //\n  }\n\n  public af_onClose(): void {\n    //\n  }\n\n  public af_onShutdown(): void {\n    //\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/Screen.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Component } from \"./Component\";\n\n/**\n * Screen component API. Implement this class to create a Screen.\n */\nexport abstract class Screen extends Component {\n  public af_componentTitle?: string = undefined;\n  public af_subscriptions: Map<string, ((event: any) => void)> = new Map();\n\n  protected constructor(componentId: string) {\n    super({ type: \"screen\", af_componentId: componentId });\n  }\n\n  public af_onStartup(): void {\n    //\n  }\n\n  public af_onOpen(): void {\n    //\n  }\n\n  public af_onFocus(): void {\n    //\n  }\n\n  public af_onLostFocus(): void {\n    //\n  }\n\n  public af_onMayClose(): boolean {\n    return true;\n  }\n\n  public af_onClose(): void {\n    //\n  }\n\n  public af_onShutdown(): void {\n    //\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/appformer/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { AppFormer } from \"./AppFormer\";\nimport { Element } from \"../core\";\nimport { findChildContainers } from \"../util\";\nimport { Component } from \"./Component\";\nimport { Perspective } from \"./Perspective\";\nimport { Screen } from \"./Screen\";\nimport {marshall, Portable} from \"../marshalling\";\n\nexport * from \"./AppFormer\";\nexport * from \"./Components\";\nexport * from \"./Screen\";\nexport * from \"./ComponentTypes\";\nexport * from \"./Perspective\";\nexport * from \"./CompassLayoutPerspective\";\nexport * from \"./DisplayInfo\";\nexport * from \"./Panel\";\nexport * from \"./Part\";\n\nlet singleton: AppFormer | undefined;\n\nexport function initSingleton() {\n  const $wnd = window as any;\n\n  if ($wnd.AppFormerMode !== \"instance\") {\n    singleton =\n      $wnd.appformerGwtBridge ||\n      new AppFormer().init((document.body.children[0] as HTMLElement) || document.createElement(\"div\"), () => {\n        // creating div element is used in test environment, when test runner do not have a page body to access\n        console.info(\"AppFormer _standalone_ instance initialized.\");\n      });\n\n    $wnd.AppFormerInstance = singleton;\n  }\n}\n\n//\n//Singleton API\n\nexport function register(component: Component) {\n  if (component.type === \"screen\") {\n    singleton!.registerScreen(component as Screen);\n  } else if (component.type === \"perspective\") {\n    singleton!.registerPerspective(component as Perspective);\n  }\n}\n\nexport function goTo(af_componentId: string) {\n  singleton!.goTo(af_componentId);\n}\n\nexport function close(af_componentId: string) {\n  singleton!.close(af_componentId);\n}\n\nexport function translate(key: string, args: string[]) {\n  return singleton!.translate(key, args);\n}\n\nexport function render(element: Element, container: HTMLElement, callback = (): void => undefined) {\n  singleton!.render(element, container, callback);\n}\n\nexport function fireEvent<T>(obj: Portable<T>) {\n  singleton!.fireEvent(marshall(obj) as any);\n}\n\nexport function rpc(path: string, args: Array<Portable<any>>) {\n  return singleton!.rpc(path, args);\n}\n\n(window as any)._AppFormerUtils = {\n  findChildContainers\n};\n"
  },
  {
    "path": "appformer-js/src/core/Component.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\n\n/**\n * Core component. Provides basic low-level lifecycle methods for AppFormer components.\n */\nexport abstract class Component {\n  public readonly core_componentId: string;\n  public readonly type: string;\n  public readonly _container: HTMLElement;\n  public readonly _components: string[] = [];\n\n  public af_isReact: boolean = false;\n  public af_hasContext: boolean = false;\n\n  protected constructor(args: { type: string; core_componentId: string }) {\n    this.core_componentId = args.core_componentId;\n    this.type = args.type;\n  }\n\n  public abstract core_componentRoot(children?: any): Element;\n\n  public core_onReady() {\n    console.info(`core: ${this.core_componentId} is ready.`);\n  }\n\n  public core_onVanished() {\n    console.info(`core: ${this.core_componentId} was removed.`);\n  }\n}\n\nexport type Element = React.ReactPortal | React.ReactElement<any> | HTMLElement | string;\n"
  },
  {
    "path": "appformer-js/src/core/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport { Component, Element } from \"./Component\";\n"
  },
  {
    "path": "appformer-js/src/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { initSingleton } from \"./appformer\";\n\nexport * from \"./appformer\";\nexport * from \"./marshalling\";\nexport * from \"./core\";\nexport * from \"./java-wrappers\";\nexport * from \"./util\";\n\n// Exposes this module as a global variable\n(window as any).AppFormer = this;\ninitSingleton();\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/BigNumberWrapper.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BigNumber } from \"bignumber.js\";\nimport { JavaWrapper } from \"./JavaWrapper\";\n\nexport abstract class BigNumberWrapper extends JavaWrapper<BigNumber> {\n  private _value: BigNumber;\n\n  public constructor(value: string) {\n    super();\n    const valueAsNumber = this.from(value);\n\n    this.set(valueAsNumber);\n  }\n\n  public get(): BigNumber {\n    return this._value;\n  }\n\n  public set(value: BigNumber | ((current: BigNumber) => BigNumber)): void {\n    if (this.instanceOfBigNumber(value)) {\n      this._value = this.applyNumericRange(value);\n    } else {\n      this._value = this.applyNumericRange(value(this.get()));\n    }\n  }\n\n  protected abstract from(asString: string): BigNumber;\n\n  protected abstract isInRange(n: BigNumber): boolean;\n\n  private applyNumericRange(value: BigNumber) {\n    if (!this.isInRange(value)) {\n      return new BigNumber(NaN);\n    }\n    return value;\n  }\n\n  private instanceOfBigNumber(value: any): value is BigNumber {\n    return BigNumber.isBigNumber(value);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/FloatBasedJavaNumber.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumberWrapper } from \"./NumberWrapper\";\n\nexport abstract class FloatBasedJavaNumber extends NumberWrapper {\n  protected from(asString: string): number {\n    return Number.parseFloat(asString);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/IntegerBasedJavaNumber.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumberWrapper } from \"./NumberWrapper\";\n\nexport abstract class IntegerBasedJavaNumber extends NumberWrapper {\n  protected from(asString: string): number {\n    return Number.parseInt(asString, 10);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaArrayList.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaCollection } from \"./JavaCollection\";\nimport { instanceOfArray } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaArrayList<T> extends JavaCollection<T[]> {\n  private readonly _fqcn = JavaType.ARRAY_LIST;\n\n  private _value: T[];\n\n  constructor(value: T[]) {\n    super();\n    this.set(value);\n  }\n\n  public get(): T[] {\n    return this._value;\n  }\n\n  public set(val: ((current: T[]) => T[]) | T[]): void {\n    if (instanceOfArray(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaBigDecimal.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BigNumber } from \"bignumber.js\";\nimport { BigNumberWrapper } from \"./BigNumberWrapper\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaBigDecimal extends BigNumberWrapper implements JavaNumber {\n  private readonly _fqcn = JavaType.BIG_DECIMAL;\n\n  public from(asString: string): BigNumber {\n    return new BigNumber(asString, 10);\n  }\n\n  public isInRange(n: BigNumber): boolean {\n    return true; // arbitrary precision\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaBigInteger.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BigNumber } from \"bignumber.js\";\nimport { BigNumberWrapper } from \"./BigNumberWrapper\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaBigInteger extends BigNumberWrapper implements JavaNumber {\n  private readonly _fqcn = JavaType.BIG_INTEGER;\n\n  public from(asString: string): BigNumber {\n    const bigNumber = new BigNumber(asString, 10);\n    if (bigNumber.isInteger()) {\n      return bigNumber;\n    }\n\n    // truncates decimal part (like TS's Number type)\n    return bigNumber.integerValue(BigNumber.ROUND_DOWN);\n  }\n\n  protected isInRange(n: BigNumber): boolean {\n    return true; // arbitrary precision\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaBoolean.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { instanceOfBoolean } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaBoolean extends JavaWrapper<boolean> {\n  private readonly _fqcn = JavaType.BOOLEAN;\n\n  private _value: boolean;\n\n  constructor(value: boolean) {\n    super();\n    this.set(value);\n  }\n\n  public get(): boolean {\n    return this._value;\n  }\n\n  public set(val: ((current: boolean) => boolean) | boolean): void {\n    if (instanceOfBoolean(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaByte.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IntegerBasedJavaNumber } from \"./IntegerBasedJavaNumber\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaByte extends IntegerBasedJavaNumber implements JavaNumber {\n  public static readonly MIN_VALUE = -128;\n  public static readonly MAX_VALUE = 127;\n\n  private readonly _fqcn = JavaType.BYTE;\n\n  protected isInRange(n: number): boolean {\n    return n >= JavaByte.MIN_VALUE && n <= JavaByte.MAX_VALUE;\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaCollection.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\n\nexport abstract class JavaCollection<T extends Iterable<any> | null> extends JavaWrapper<T> {\n  // this is here for type purposes only\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaDate.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { instanceOfDate } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaDate extends JavaWrapper<Date> {\n  private readonly _fqcn = JavaType.DATE;\n\n  private _value: Date;\n\n  constructor(date: Date) {\n    super();\n    this.set(date);\n  }\n\n  public get(): Date {\n    return this._value;\n  }\n\n  public set(val: ((current: Date) => Date) | Date): void {\n    if (instanceOfDate(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaDouble.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FloatBasedJavaNumber } from \"./FloatBasedJavaNumber\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaDouble extends FloatBasedJavaNumber implements JavaNumber {\n  private readonly _fqcn = JavaType.DOUBLE;\n\n  protected isInRange(n: number): boolean {\n    // JS' numbers are 64 bits long like Java's Double\n    return n >= -1 * Number.MAX_VALUE && n <= Number.MAX_VALUE;\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaEnum.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Portable } from \"../marshalling\";\n\nexport abstract class JavaEnum<T extends JavaEnum<T>> implements Portable<T> {\n  public readonly name: string;\n\n  protected constructor(name: string) {\n    this.name = name;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaFloat.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FloatBasedJavaNumber } from \"./FloatBasedJavaNumber\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaFloat extends FloatBasedJavaNumber implements JavaNumber {\n  public static readonly MIN_VALUE = -3.40282347e38;\n  public static readonly MAX_VALUE = 3.40282347e38;\n\n  private readonly _fqcn = JavaType.FLOAT;\n\n  protected isInRange(n: number): boolean {\n    return n >= JavaFloat.MIN_VALUE && n <= JavaFloat.MAX_VALUE;\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaHashMap.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { instanceOfMap } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaHashMap<T, U> extends JavaWrapper<Map<T, U>> {\n  private readonly _fqcn = JavaType.HASH_MAP;\n\n  private _value: Map<T, U>;\n\n  constructor(value: Map<T, U>) {\n    super();\n    this.set(value);\n  }\n\n  public get(): Map<T, U> {\n    return this._value;\n  }\n\n  public set(val: ((current: Map<T, U>) => Map<T, U>) | Map<T, U>): void {\n    if (instanceOfMap(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaHashSet.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaCollection } from \"./JavaCollection\";\nimport { instanceOfSet } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaHashSet<T> extends JavaCollection<Set<T>> {\n  private readonly _fqcn = JavaType.HASH_SET;\n\n  private _value: Set<T>;\n\n  constructor(value: Set<T>) {\n    super();\n    this.set(value);\n  }\n\n  public get(): Set<T> {\n    return this._value;\n  }\n\n  public set(val: ((current: Set<T>) => Set<T>) | Set<T>): void {\n    if (instanceOfSet(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaInteger.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IntegerBasedJavaNumber } from \"./IntegerBasedJavaNumber\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaInteger extends IntegerBasedJavaNumber implements JavaNumber {\n  public static readonly MIN_VALUE = -21474836488;\n  public static readonly MAX_VALUE = 2147483647;\n\n  private readonly _fqcn = JavaType.INTEGER;\n\n  protected isInRange(n: number): boolean {\n    return n >= JavaInteger.MIN_VALUE && n <= JavaInteger.MAX_VALUE;\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaLinkedList.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class JavaLinkedList<T> {}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaLong.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BigNumber } from \"bignumber.js\";\nimport { BigNumberWrapper } from \"./BigNumberWrapper\";\nimport { JavaByte } from \"./JavaByte\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaLong extends BigNumberWrapper implements JavaNumber {\n  public static readonly MIN_VALUE = new BigNumber(\"-9223372036854775808\", 10);\n  public static readonly MAX_VALUE = new BigNumber(\"9223372036854775807\", 10);\n\n  private readonly _fqcn = JavaType.LONG;\n\n  public from(asString: string): BigNumber {\n    // simulate Java's Long number range\n    const BN = BigNumber.clone({ RANGE: 18, DECIMAL_PLACES: 0 });\n\n    // forces integer value (the decimal places configuration are only applied when performing a division)\n    // Also, truncates the decimal part the same way of Number type\n    return new BN(asString).integerValue(BigNumber.ROUND_DOWN);\n  }\n\n  protected isInRange(n: BigNumber): boolean {\n    return n.isGreaterThanOrEqualTo(JavaLong.MIN_VALUE) && n.isLessThanOrEqualTo(JavaLong.MAX_VALUE);\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaNumber.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaShort } from \"./JavaShort\";\nimport { JavaByte } from \"./JavaByte\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { BigNumber } from \"bignumber.js\";\nimport { JavaLong } from \"./JavaLong\";\n\nexport interface JavaNumber {\n  doubleValue(): JavaDouble;\n  intValue(): JavaInteger;\n  shortValue(): JavaShort;\n  byteValue(): JavaByte;\n  floatValue(): JavaFloat;\n  longValue(): JavaLong;\n}\n\nexport function asDouble(n: number | BigNumber) {\n  return new JavaDouble(n.toString(10));\n}\n\nexport function asInteger(n: number | BigNumber) {\n  return new JavaInteger(n.toString(10));\n}\n\nexport function asShort(n: number | BigNumber) {\n  return new JavaShort(n.toString(10));\n}\n\nexport function asByte(n: number | BigNumber) {\n  return new JavaByte(n.toString(10));\n}\n\nexport function asFloat(n: number | BigNumber) {\n  return new JavaFloat(n.toString(10));\n}\n\nexport function asLong(n: number | BigNumber) {\n  return new JavaLong(n.toString(10));\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaOptional.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaOptional<T> extends JavaWrapper<T | undefined> {\n  private readonly _fqcn = JavaType.OPTIONAL;\n\n  private _value: T | undefined;\n\n  constructor(value?: T) {\n    super();\n    this.set(value);\n  }\n\n  public get(): T {\n    if (this._value === null || this._value === undefined) {\n      throw new Error(\"No value present\");\n    }\n\n    return this._value!;\n  }\n\n  public isPresent(): boolean {\n    return this._value !== undefined;\n  }\n\n  public set(val: ((current: T | undefined) => T | undefined) | T | undefined): void {\n    if (typeof val === \"function\") {\n      this._value = val(this.get());\n    } else {\n      this._value = val;\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaShort.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { IntegerBasedJavaNumber } from \"./IntegerBasedJavaNumber\";\nimport { asByte, asDouble, asFloat, asInteger, asLong, asShort, JavaNumber } from \"./JavaNumber\";\nimport { JavaByte } from \"./JavaByte\";\nimport { JavaDouble } from \"./JavaDouble\";\nimport { JavaFloat } from \"./JavaFloat\";\nimport { JavaInteger } from \"./JavaInteger\";\nimport { JavaLong } from \"./JavaLong\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaShort extends IntegerBasedJavaNumber implements JavaNumber {\n  public static readonly MIN_VALUE = -32768;\n  public static readonly MAX_VALUE = 32767;\n\n  private readonly _fqcn = JavaType.SHORT;\n\n  protected isInRange(n: number): boolean {\n    return n >= JavaShort.MIN_VALUE && n <= JavaShort.MAX_VALUE;\n  }\n\n  public byteValue(): JavaByte {\n    return asByte(super.get());\n  }\n\n  public doubleValue(): JavaDouble {\n    return asDouble(super.get());\n  }\n\n  public floatValue(): JavaFloat {\n    return asFloat(super.get());\n  }\n\n  public intValue(): JavaInteger {\n    return asInteger(super.get());\n  }\n\n  public shortValue(): JavaShort {\n    return asShort(super.get());\n  }\n\n  public longValue(): JavaLong {\n    return asLong(super.get());\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaString.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { instanceOfString } from \"../util/TypeUtils\";\nimport { JavaType } from \"./JavaType\";\n\nexport class JavaString extends JavaWrapper<string> {\n  private readonly _fqcn = JavaType.STRING;\n\n  private _value: string;\n\n  constructor(value: string) {\n    super();\n    this.set(value);\n  }\n\n  public get(): string {\n    return this._value;\n  }\n\n  public set(val: ((current: string) => string) | string): void {\n    if (instanceOfString(val)) {\n      this._value = val;\n    } else {\n      this._value = val(this.get());\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaTreeMap.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class JavaTreeMap<K, V> {}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaTreeSet.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class JavaTreeSet<T> {}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaType.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum JavaType {\n  BYTE = \"java.lang.Byte\",\n  DOUBLE = \"java.lang.Double\",\n  FLOAT = \"java.lang.Float\",\n  INTEGER = \"java.lang.Integer\",\n  LONG = \"java.lang.Long\",\n  SHORT = \"java.lang.Short\",\n  BOOLEAN = \"java.lang.Boolean\",\n  STRING = \"java.lang.String\",\n  DATE = \"java.util.Date\",\n  BIG_DECIMAL = \"java.math.BigDecimal\",\n  BIG_INTEGER = \"java.math.BigInteger\",\n  ARRAY_LIST = \"java.util.ArrayList\",\n  UNMODIFIABLE_COLLECTION = \"java.util.Collections$UnmodifiableCollection\",\n  UNMODIFIABLE_SET = \"java.util.Collections$UnmodifiableSet\",\n  UNMODIFIABLE_MAP = \"java.util.Collections$UnmodifiableMap\",\n  HASH_SET = \"java.util.HashSet\",\n  HASH_MAP = \"java.util.HashMap\",\n  OPTIONAL = \"java.util.Optional\",\n  ENUM = \"java.lang.Enum\"\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaWrapper.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Portable } from \"../marshalling/Portable\";\n\nexport abstract class JavaWrapper<T> implements Portable<JavaWrapper<T>> {\n  private static readonly javaWrapperInstanceIdentifier = \"fbeef485-6129-4c23-a047-166c6d2fb7a9\";\n\n  public abstract get(): T;\n\n  public abstract set(val: T | ((current: T) => T)): void;\n\n  private instanceIdentifier(): string {\n    return JavaWrapper.javaWrapperInstanceIdentifier;\n  }\n\n  public static extendsJavaWrapper<T>(obj: any): obj is JavaWrapper<T> {\n    if (!obj.instanceIdentifier) {\n      return false;\n    }\n\n    // this is just a trick to allow the application to identify in runtime if an object extends JavaWrapper.\n    return obj.instanceIdentifier() === JavaWrapper.javaWrapperInstanceIdentifier;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/JavaWrapperUtils.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\nimport { JavaType } from \"./JavaType\";\nimport { isArray, isBoolean, isDate, isMap, isSet, isString } from \"../util/TypeUtils\";\nimport { JavaArrayList } from \"./JavaArrayList\";\nimport { JavaHashSet } from \"./JavaHashSet\";\nimport { JavaHashMap } from \"./JavaHashMap\";\nimport { JavaBoolean } from \"./JavaBoolean\";\nimport { JavaString } from \"./JavaString\";\nimport { JavaDate } from \"./JavaDate\";\nimport { JavaEnum } from \"./JavaEnum\";\n\nexport class JavaWrapperUtils {\n  private static wrappingFuncForType: Map<(obj: any) => boolean, (obj: any) => JavaWrapper<any>> = new Map([\n    [isArray, (obj: any) => new JavaArrayList(obj) as JavaWrapper<any>],\n    [isSet, (obj: any) => new JavaHashSet(obj) as JavaWrapper<any>],\n    [isMap, (obj: any) => new JavaHashMap(obj) as JavaWrapper<any>],\n    [isBoolean, (obj: any) => new JavaBoolean(obj) as JavaWrapper<any>],\n    [isString, (obj: any) => new JavaString(obj) as JavaWrapper<any>],\n    [isDate, (obj: any) => new JavaDate(obj) as JavaWrapper<any>]\n  ]);\n\n  public static needsWrapping(obj: any): boolean {\n    return this.getWrappingFunction(obj) !== undefined;\n  }\n\n  public static wrapIfNeeded<U>(obj: U): JavaWrapper<U> | U {\n    const func = this.getWrappingFunction(obj);\n    if (!func) {\n      return obj;\n    }\n\n    return func(obj);\n  }\n\n  public static isJavaType(fqcn: string): boolean {\n    for (const type in JavaType) {\n      if (JavaType[type] === fqcn) {\n        return true;\n      }\n    }\n    return false;\n  }\n\n  public static isEnum(obj: any): boolean {\n    return obj instanceof JavaEnum;\n  }\n\n  private static getWrappingFunction(obj: any): ((obj: any) => JavaWrapper<any>) | undefined {\n    //tslint:disable-next-line\n    let result: ((obj: any) => JavaWrapper<any>) | undefined = undefined;\n\n    this.wrappingFuncForType.forEach((wrapFunction, typeFilterFunction) => {\n      if (result) {\n        return;\n      }\n\n      if (typeFilterFunction(obj)) {\n        result = wrapFunction;\n      }\n    });\n\n    return result;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/NumberWrapper.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"./JavaWrapper\";\n\nexport abstract class NumberWrapper extends JavaWrapper<number> {\n  private _value: number;\n\n  public constructor(value: string) {\n    super();\n    const valueAsNumber = this.from(value);\n\n    this.set(valueAsNumber);\n  }\n\n  public get(): number {\n    return this._value;\n  }\n\n  public set(value: number | ((current: number) => number)): void {\n    if (typeof value === \"number\") {\n      this._value = this.applyNumericRange(value);\n    } else {\n      this._value = this.applyNumericRange(value(this.get()));\n    }\n  }\n\n  protected abstract from(asString: string): number;\n\n  protected abstract isInRange(n: number): boolean;\n\n  private applyNumericRange(n: number): number {\n    if (!this.isInRange(n)) {\n      return Number.NaN;\n    }\n    return n;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaArrayList.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaArrayList } from \"../JavaArrayList\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  test(\"with populated array, returns the same array\", () => {\n    const input = [\"foo\", \"bar\", \"foo2\"];\n\n    const output = new JavaArrayList(input).get();\n\n    expect(output).toEqual([\"foo\", \"bar\", \"foo2\"]);\n  });\n\n  test(\"with empty array, returns the same array\", () => {\n    const input = [] as any[];\n\n    const output = new JavaArrayList(input).get();\n\n    expect(output).toEqual([]);\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const input = new JavaArrayList([\"foo\", \"bar\"]);\n    expect(input.get()).toStrictEqual([\"foo\", \"bar\"]);\n\n    input.set([\"foo\"]);\n    expect(input.get()).toStrictEqual([\"foo\"]);\n  });\n\n  test(\"with value from function, should set\", () => {\n    const input = new JavaArrayList([\"foo\", \"bar\"]);\n    expect(input.get()).toStrictEqual([\"foo\", \"bar\"]);\n\n    input.set(curr => {\n      const newArr = new Array(...curr);\n      newArr.push(\"newfoo\");\n      return newArr;\n    });\n\n    expect(input.get()).toStrictEqual([\"foo\", \"bar\", \"newfoo\"]);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaArrayList([\"1\", \"2\"]) as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.ARRAY_LIST);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaBigDecimal.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaBigDecimal } from \"../JavaBigDecimal\";\nimport { BigNumber } from \"bignumber.js\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive float, should return same value as BigNumber\", () => {\n      const input = \"12.92\";\n\n      const output = new JavaBigDecimal(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12.92\"));\n    });\n\n    test(\"negative float, should return same value as BigNumber\", () => {\n      const input = \"-12.92\";\n\n      const output = new JavaBigDecimal(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12.92\"));\n    });\n\n    test(\"positive integer, should return same value as BigNumber\", () => {\n      const input = \"12\";\n\n      const output = new JavaBigDecimal(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"negative integer, should return same value as BigNumber\", () => {\n      const input = \"-12\";\n\n      const output = new JavaBigDecimal(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaBigDecimal(input).get();\n\n    expect(output).toEqual(new BigNumber(NaN));\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = new BigNumber(-Number.MAX_VALUE);\n\n        const output = new JavaBigDecimal(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(-Number.MAX_VALUE));\n      });\n\n      test(\"less than, should return same value as BigNumber\", () => {\n        const input = new BigNumber(-Number.MAX_VALUE).minus(1, 10);\n\n        const output = new JavaBigDecimal(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(-Number.MAX_VALUE).minus(1, 10));\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = new BigNumber(Number.MAX_VALUE);\n\n        const output = new JavaBigDecimal(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(Number.MAX_VALUE));\n      });\n\n      test(\"greater than, should return same value as BigNumber\", () => {\n        const input = new BigNumber(Number.MAX_VALUE).plus(1, 10);\n\n        const output = new JavaBigDecimal(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(Number.MAX_VALUE).plus(1, 10));\n      });\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaBigDecimal(\"1.2\");\n    expect(input.get()).toEqual(new BigNumber(\"1.2\"));\n\n    input.set(new BigNumber(\"2.2\"));\n\n    expect(input.get()).toEqual(new BigNumber(\"2.2\"));\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaBigDecimal(\"1.2\");\n    expect(input.get()).toEqual(new BigNumber(\"1.2\"));\n\n    input.set(new BigNumber(NaN));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaBigDecimal(\"1.2\");\n    expect(input.get()).toEqual(new BigNumber(\"1.2\"));\n\n    input.set(cur => new BigNumber(\"2.2\").plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(\"3.4\"));\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaBigDecimal(\"1.2\");\n    expect(input.get()).toEqual(new BigNumber(\"1.2\"));\n\n    input.set(cur => new BigNumber(NaN).plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1.2\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1.2);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1.1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1.1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigDecimal(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaBigDecimal(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.BIG_DECIMAL);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaBigInteger.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BigNumber } from \"bignumber.js\";\nimport { JavaBigInteger } from \"../JavaBigInteger\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive integer, should return same value as BigNumber\", () => {\n      const input = \"12\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"negative integer, should return same value as BigNumber\", () => {\n      const input = \"-12\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaBigInteger(input).get();\n\n    expect(output).toEqual(new BigNumber(NaN));\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = new BigNumber(-Number.MAX_VALUE);\n\n        const output = new JavaBigInteger(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(-Number.MAX_VALUE));\n      });\n\n      test(\"less than, should return same value as BigNumber\", () => {\n        const input = new BigNumber(-Number.MAX_VALUE).minus(1, 10);\n\n        const output = new JavaBigInteger(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(-Number.MAX_VALUE).minus(1, 10));\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = new BigNumber(Number.MAX_VALUE);\n\n        const output = new JavaBigInteger(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(Number.MAX_VALUE));\n      });\n\n      test(\"greater than, should return same value as BigNumber\", () => {\n        const input = new BigNumber(Number.MAX_VALUE).plus(1, 10);\n\n        const output = new JavaBigInteger(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(Number.MAX_VALUE).plus(1, 10));\n      });\n    });\n  });\n\n  describe(\"with float string\", () => {\n    test(\"positive with decimal closest to 0, should return truncated value as BigNumber\", () => {\n      const input = \"12.1\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"positive with decimal exactly between 0 and 1, should return truncated value as BigNumber\", () => {\n      const input = \"12.5\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"positive with decimal closest to 1, should return truncated value as BigNumber\", () => {\n      const input = \"12.9\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"negative with decimal closest to 0, should return truncated value as BigNumber\", () => {\n      const input = \"-12.1\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n\n    test(\"negative with decimal exactly between 0 and 1, should return truncated value as BigNumber\", () => {\n      const input = \"-12.5\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n\n    test(\"negative with decimal closest to 1, should return truncated value as BigNumber\", () => {\n      const input = \"-12.9\";\n\n      const output = new JavaBigInteger(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaBigInteger(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(new BigNumber(\"2\"));\n\n    expect(input.get()).toEqual(new BigNumber(\"2\"));\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaBigInteger(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(new BigNumber(NaN));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaBigInteger(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(cur => new BigNumber(\"2\").plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(\"3\"));\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaBigInteger(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(cur => new BigNumber(NaN).plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaBigInteger(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.BIG_INTEGER);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaBoolean.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaBoolean } from \"../JavaBoolean\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"true, should return boolean true\", () => {\n      const input = true;\n\n      const output = new JavaBoolean(input).get();\n\n      expect(output).toBeTruthy();\n    });\n\n    test(\"false, should return boolean false\", () => {\n      const input = false;\n\n      const output = new JavaBoolean(input).get();\n\n      expect(output).toBeFalsy();\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const input = new JavaBoolean(false);\n    expect(input.get()).toBeFalsy();\n\n    input.set(true);\n\n    expect(input.get()).toBeTruthy();\n  });\n\n  test(\"with value from function, should set\", () => {\n    const input = new JavaBoolean(false);\n    expect(input.get()).toBeFalsy();\n\n    input.set(cur => !cur);\n\n    expect(input.get()).toBeTruthy();\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaBoolean(true) as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.BOOLEAN);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaByte.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaByte } from \"../JavaByte\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive integer, should return same value as number\", () => {\n      const input = \"12\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative integer, should return same value as number\", () => {\n      const input = \"-12\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaByte(input).get();\n\n    expect(output).toBeNaN();\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaByte.MIN_VALUE}`;\n\n        const output = new JavaByte(input).get();\n\n        expect(output).toEqual(JavaByte.MIN_VALUE);\n      });\n\n      test(\"less than, should return NaN\", () => {\n        const input = `${JavaByte.MIN_VALUE - 1}`;\n\n        const output = new JavaByte(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaByte.MAX_VALUE}`;\n\n        const output = new JavaByte(input).get();\n\n        expect(output).toEqual(JavaByte.MAX_VALUE);\n      });\n\n      test(\"greater than, should return NaN\", () => {\n        const input = `${JavaByte.MAX_VALUE + 1}`;\n\n        const output = new JavaByte(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n  });\n\n  describe(\"with float string\", () => {\n    test(\"positive with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"12.1\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"12.5\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"12.9\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"-12.1\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"-12.5\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"-12.9\";\n\n      const output = new JavaByte(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaByte(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(2);\n\n    expect(input.get()).toEqual(2);\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaByte(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(JavaByte.MAX_VALUE + 1);\n\n    expect(input.get()).toEqual(NaN);\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaByte(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => 2 + cur);\n\n    expect(input.get()).toEqual(3);\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaByte(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => JavaByte.MAX_VALUE + cur);\n\n    expect(input.get()).toEqual(NaN);\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaByte(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.BYTE);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaDate.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaDate } from \"../JavaDate\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  test(\"with date, should return same value as Date\", () => {\n    const input = new Date();\n\n    const output = new JavaDate(input).get();\n\n    expect(output).toEqual(input);\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const firstDate = new Date();\n\n    const input = new JavaDate(firstDate);\n    expect(input.get()).toEqual(firstDate);\n\n    const secondDate = new Date();\n    input.set(secondDate);\n\n    expect(input.get()).toEqual(secondDate);\n  });\n\n  test(\"with value from function, should set\", () => {\n    const firstDate = new Date();\n\n    const input = new JavaDate(firstDate);\n    expect(input.get()).toEqual(firstDate);\n\n    input.set(cur => {\n      const newDate = new Date(cur.getUTCMilliseconds());\n      newDate.setHours(cur.getHours() + 1);\n      return newDate;\n    });\n\n    const expectedDate = new Date(firstDate.getUTCMilliseconds());\n    expectedDate.setHours(firstDate.getHours() + 1);\n    expect(input.get()).toEqual(expectedDate);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaDate(new Date()) as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.DATE);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaDouble.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaDouble } from \"../JavaDouble\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive float, should return same value as number\", () => {\n      const input = \"12.24\";\n\n      const output = new JavaDouble(input).get();\n\n      expect(output).toEqual(12.24);\n    });\n\n    test(\"negative float, should return same value as number\", () => {\n      const input = \"-12.24\";\n\n      const output = new JavaDouble(input).get();\n\n      expect(output).toEqual(-12.24);\n    });\n\n    test(\"positive integer, should return same value as number\", () => {\n      const input = \"12\";\n\n      const output = new JavaDouble(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative integer, should return same value as number\", () => {\n      const input = \"-12\";\n\n      const output = new JavaDouble(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n\n  test(\"with invalid input string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaDouble(input).get();\n\n    expect(output).toBeNaN();\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as Number\", () => {\n        const input = `${-Number.MAX_VALUE}`;\n\n        const output = new JavaDouble(input).get();\n\n        expect(output).toEqual(-Number.MAX_VALUE);\n      });\n\n      test(\"less than, should return same value as Number\", () => {\n        const input = `${-Number.MAX_VALUE - 1}`;\n\n        const output = new JavaDouble(input).get();\n\n        expect(output).toEqual(-Number.MAX_VALUE - 1);\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as Number\", () => {\n        const input = `${Number.MAX_VALUE}`;\n\n        const output = new JavaDouble(input).get();\n\n        expect(output).toEqual(Number.MAX_VALUE);\n      });\n\n      test(\"greater than, should return same value as Number\", () => {\n        const input = `${Number.MAX_VALUE + 1}`;\n\n        const output = new JavaDouble(input).get();\n\n        expect(output).toEqual(Number.MAX_VALUE + 1);\n      });\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaDouble(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(2);\n\n    expect(input.get()).toEqual(2);\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaDouble(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(Number.MAX_VALUE * 2);\n\n    expect(input.get()).toEqual(NaN);\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaDouble(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => 2 + cur);\n\n    expect(input.get()).toEqual(3);\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaDouble(\"2\");\n    expect(input.get()).toEqual(2);\n\n    input.set(cur => Number.MAX_VALUE * cur);\n\n    expect(input.get()).toEqual(NaN);\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1.1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1.1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1.1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1.1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaDouble(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaDouble(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.DOUBLE);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaFloat.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaFloat } from \"../JavaFloat\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive float, should return same value as BigNumber\", () => {\n      const input = \"12.92\";\n\n      const output = new JavaFloat(input).get();\n\n      expect(output).toEqual(12.92);\n    });\n\n    test(\"negative float, should return same value as BigNumber\", () => {\n      const input = \"-12.92\";\n\n      const output = new JavaFloat(input).get();\n\n      expect(output).toEqual(-12.92);\n    });\n\n    test(\"positive integer, should return same value as BigNumber\", () => {\n      const input = \"12\";\n\n      const output = new JavaFloat(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative integer, should return same value as BigNumber\", () => {\n      const input = \"-12\";\n\n      const output = new JavaFloat(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaFloat(input).get();\n\n    expect(output).toBeNaN();\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = `${JavaFloat.MIN_VALUE}`;\n\n        const output = new JavaFloat(input).get();\n\n        expect(output).toEqual(JavaFloat.MIN_VALUE);\n      });\n\n      test(\"less than, should return NaN\", () => {\n        const input = `${JavaFloat.MIN_VALUE - 1e23}`; // smaller value inside float's precision\n\n        const output = new JavaFloat(input).get();\n\n        expect(output).toBeNaN();\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as BigNumber\", () => {\n        const input = `${JavaFloat.MAX_VALUE}`;\n\n        const output = new JavaFloat(input).get();\n\n        expect(output).toEqual(JavaFloat.MAX_VALUE);\n      });\n\n      test(\"greater than, should return same value as BigNumber\", () => {\n        const input = `${JavaFloat.MAX_VALUE + 1e23}`; // smaller value inside float's precision\n\n        const output = new JavaFloat(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaFloat(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(2);\n\n    expect(input.get()).toEqual(2);\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaFloat(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(JavaFloat.MAX_VALUE * 2);\n\n    expect(input.get()).toEqual(NaN);\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaFloat(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => 2 + cur);\n\n    expect(input.get()).toEqual(3);\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaFloat(\"2\");\n    expect(input.get()).toEqual(2);\n\n    input.set(cur => JavaFloat.MAX_VALUE * cur);\n\n    expect(input.get()).toEqual(NaN);\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1.1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1.1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1.1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1.1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaFloat(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaFloat(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.FLOAT);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaHashMap.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaHashMap } from \"../JavaHashMap\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  test(\"with populated map, returns the same map\", () => {\n    const input = new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]);\n\n    const output = new JavaHashMap(input).get();\n\n    expect(output).toEqual(new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]));\n  });\n\n  test(\"with empty map, returns the same map\", () => {\n    const input = new Map();\n\n    const output = new JavaHashMap(input).get();\n\n    expect(output).toEqual(new Map());\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const input = new JavaHashMap(new Map([[\"k1\", \"v1\"]]));\n    expect(input.get()).toEqual(new Map([[\"k1\", \"v1\"]]));\n\n    input.set(new Map([[\"k2\", \"v2\"]]));\n\n    expect(input.get()).toEqual(new Map([[\"k2\", \"v2\"]]));\n  });\n\n  test(\"with value from function, should set\", () => {\n    const input = new JavaHashMap(new Map([[\"k1\", \"v1\"]]));\n    expect(input.get()).toEqual(new Map([[\"k1\", \"v1\"]]));\n\n    input.set(cur => {\n      const newMap = new Map(cur);\n      newMap.set(\"k2\", \"v2\");\n      return newMap;\n    });\n\n    expect(input.get()).toEqual(new Map([[\"k1\", \"v1\"], [\"k2\", \"v2\"]]));\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaHashMap(new Map([[\"foo1\", \"bar1\"]])) as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.HASH_MAP);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaHashSet.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaHashSet } from \"../JavaHashSet\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  test(\"with populated set, returns the same set\", () => {\n    const input = new Set([\"foo\", \"bar\", \"foo2\"]);\n\n    const output = new JavaHashSet(input).get();\n\n    expect(output).toEqual(new Set([\"foo\", \"bar\", \"foo2\"]));\n  });\n\n  test(\"with empty set, returns the same set\", () => {\n    const input = new Set();\n\n    const output = new JavaHashSet(input).get();\n\n    expect(output).toEqual(new Set());\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const input = new JavaHashSet(new Set([\"k1\", \"v1\"]));\n    expect(input.get()).toEqual(new Set([\"k1\", \"v1\"]));\n\n    input.set(new Set([\"k2\", \"v2\"]));\n\n    expect(input.get()).toEqual(new Set([\"k2\", \"v2\"]));\n  });\n\n  test(\"with value from function, should set\", () => {\n    const input = new JavaHashSet(new Set([\"k1\", \"v1\"]));\n    expect(input.get()).toEqual(new Set([\"k1\", \"v1\"]));\n\n    input.set(cur => {\n      const newSet = new Set(cur);\n      newSet.add(\"k2\");\n      return newSet;\n    });\n\n    expect(input.get()).toEqual(new Set([\"k1\", \"v1\", \"k2\"]));\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaHashSet(new Set([\"1\", \"2\"])) as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.HASH_SET);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaInteger.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaInteger } from \"../JavaInteger\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive integer, should return same value as number\", () => {\n      const input = \"12\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative integer, should return same value as number\", () => {\n      const input = \"-12\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaInteger(input).get();\n\n    expect(output).toBeNaN();\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaInteger.MIN_VALUE}`;\n\n        const output = new JavaInteger(input).get();\n\n        expect(output).toEqual(JavaInteger.MIN_VALUE);\n      });\n\n      test(\"less than, should return NaN\", () => {\n        const input = `${JavaInteger.MIN_VALUE - 1}`;\n\n        const output = new JavaInteger(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaInteger.MAX_VALUE}`;\n\n        const output = new JavaInteger(input).get();\n\n        expect(output).toEqual(JavaInteger.MAX_VALUE);\n      });\n\n      test(\"greater than, should return NaN\", () => {\n        const input = `${JavaInteger.MAX_VALUE + 1}`;\n\n        const output = new JavaInteger(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n  });\n\n  describe(\"with float string\", () => {\n    test(\"positive with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"12.1\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"12.5\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"12.9\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"-12.1\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"-12.5\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"-12.9\";\n\n      const output = new JavaInteger(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaInteger(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(2);\n\n    expect(input.get()).toEqual(2);\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaInteger(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(JavaInteger.MAX_VALUE + 1);\n\n    expect(input.get()).toEqual(NaN);\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaInteger(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => 2 + cur);\n\n    expect(input.get()).toEqual(3);\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaInteger(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => JavaInteger.MAX_VALUE + cur);\n\n    expect(input.get()).toEqual(NaN);\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaInteger(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.INTEGER);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaLong.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaLong } from \"../JavaLong\";\nimport { BigNumber } from \"bignumber.js\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive integer, should return same value as number\", () => {\n      const input = \"12\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"negative integer, should return same value as number\", () => {\n      const input = \"-12\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaLong(input).get();\n\n    expect(output).toEqual(new BigNumber(NaN));\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaLong.MIN_VALUE}`;\n\n        const output = new JavaLong(input).get();\n\n        expect(output).toEqual(new BigNumber(`${JavaLong.MIN_VALUE}`));\n      });\n\n      test(\"less than, should return NaN\", () => {\n        const input = new BigNumber(`${JavaLong.MIN_VALUE}`).minus(1, 10);\n\n        const output = new JavaLong(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(NaN));\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaLong.MAX_VALUE}`;\n\n        const output = new JavaLong(input).get();\n\n        expect(output).toEqual(new BigNumber(`${JavaLong.MAX_VALUE}`));\n      });\n\n      test(\"greater than, should return NaN\", () => {\n        const input = new BigNumber(`${JavaLong.MAX_VALUE}`).plus(1, 10);\n\n        const output = new JavaLong(input.toString(10)).get();\n\n        expect(output).toEqual(new BigNumber(NaN));\n      });\n    });\n  });\n\n  describe(\"with float string\", () => {\n    test(\"positive with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"12.1\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"positive with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"12.5\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"positive with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"12.9\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"12\"));\n    });\n\n    test(\"negative with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"-12.1\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n\n    test(\"negative with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"-12.5\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n\n    test(\"negative with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"-12.9\";\n\n      const output = new JavaLong(input).get();\n\n      expect(output).toEqual(new BigNumber(\"-12\"));\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaLong(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(new BigNumber(\"2\"));\n\n    expect(input.get()).toEqual(new BigNumber(\"2\"));\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaLong(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(new BigNumber(`${JavaLong.MAX_VALUE}`).plus(1, 10));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaLong(\"1\");\n    expect(input.get()).toEqual(new BigNumber(\"1\"));\n\n    input.set(cur => new BigNumber(\"2\").plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(\"3\"));\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaLong(`${JavaLong.MAX_VALUE}`);\n    expect(input.get()).toEqual(new BigNumber(`${JavaLong.MAX_VALUE}`));\n\n    input.set(cur => new BigNumber(`${JavaLong.MAX_VALUE}`).plus(cur));\n\n    expect(input.get()).toEqual(new BigNumber(NaN));\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaLong(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.LONG);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaOptional.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaOptional } from \"../JavaOptional\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"defined element, should return same element\", () => {\n      const input = \"foo\";\n\n      const output = new JavaOptional<string>(input).get();\n\n      expect(output).toBe(\"foo\");\n    });\n\n    test(\"undefined element, should throw error\", () => {\n      const input = undefined;\n\n      const optional = new JavaOptional<string>(input);\n\n      expect(() => optional.get()).toThrowError();\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with defined direct value, should set\", () => {\n    const input = new JavaOptional(\"foo\");\n    expect(input.get()).toEqual(\"foo\");\n\n    input.set(\"bar\");\n\n    expect(input.get()).toEqual(\"bar\");\n  });\n\n  test(\"with undefined direct value, should set\", () => {\n    const input = new JavaOptional(\"foo\");\n    expect(input.get()).toEqual(\"foo\");\n\n    input.set(undefined);\n\n    expect(() => input.get()).toThrowError();\n  });\n\n  test(\"with defined value from function, should set\", () => {\n    const input = new JavaOptional(\"foo\");\n    expect(input.get()).toEqual(\"foo\");\n\n    input.set(cur => cur + \"bar\");\n\n    expect(input.get()).toEqual(\"foobar\");\n  });\n\n  test(\"with undefined value from function, should set\", () => {\n    const input = new JavaOptional(\"foo\");\n    expect(input.get()).toEqual(\"foo\");\n\n    input.set(_ => undefined);\n\n    expect(() => input.get()).toThrowError();\n  });\n});\n\ndescribe(\"ifPresent\", () => {\n  test(\"with defined element, should return true\", () => {\n    const input = new JavaOptional<string>(\"str\");\n\n    const output = input.isPresent();\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with undefined element, should return true\", () => {\n    const input = new JavaOptional<string>(undefined);\n\n    const output = input.isPresent();\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaOptional<string>(\"foo\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.OPTIONAL);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaShort.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaShort } from \"../JavaShort\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"positive integer, should return same value as number\", () => {\n      const input = \"12\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative integer, should return same value as number\", () => {\n      const input = \"-12\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n\n  test(\"with invalid textual string, should return NaN\", () => {\n    const input = \"abc\";\n\n    const output = new JavaShort(input).get();\n\n    expect(output).toBeNaN();\n  });\n\n  describe(\"with input in the numeric bounds\", () => {\n    describe(\"minimum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaShort.MIN_VALUE}`;\n\n        const output = new JavaShort(input).get();\n\n        expect(output).toEqual(JavaShort.MIN_VALUE);\n      });\n\n      test(\"less than, should return NaN\", () => {\n        const input = `${JavaShort.MIN_VALUE - 1}`;\n\n        const output = new JavaShort(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n\n    describe(\"maximum bound\", () => {\n      test(\"equals, should return same value as number\", () => {\n        const input = `${JavaShort.MAX_VALUE}`;\n\n        const output = new JavaShort(input).get();\n\n        expect(output).toEqual(JavaShort.MAX_VALUE);\n      });\n\n      test(\"greater than, should return NaN\", () => {\n        const input = `${JavaShort.MAX_VALUE + 1}`;\n\n        const output = new JavaShort(input).get();\n\n        expect(output).toEqual(NaN);\n      });\n    });\n  });\n\n  describe(\"with float string\", () => {\n    test(\"positive with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"12.1\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"12.5\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"positive with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"12.9\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(12);\n    });\n\n    test(\"negative with decimal closest to 0, should return truncated value as Number\", () => {\n      const input = \"-12.1\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal exactly between 0 and 1, should return truncated value as Number\", () => {\n      const input = \"-12.5\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(-12);\n    });\n\n    test(\"negative with decimal closest to 1, should return truncated value as Number\", () => {\n      const input = \"-12.9\";\n\n      const output = new JavaShort(input).get();\n\n      expect(output).toEqual(-12);\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with valid direct value, should set\", () => {\n    const input = new JavaShort(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(2);\n\n    expect(input.get()).toEqual(2);\n  });\n\n  test(\"with invalid direct value, should set NaN\", () => {\n    const input = new JavaShort(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(JavaShort.MAX_VALUE + 1);\n\n    expect(input.get()).toEqual(NaN);\n  });\n\n  test(\"with valid value from function, should set\", () => {\n    const input = new JavaShort(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => 2 + cur);\n\n    expect(input.get()).toEqual(3);\n  });\n\n  test(\"with invalid value from function, should set NaN\", () => {\n    const input = new JavaShort(\"1\");\n    expect(input.get()).toEqual(1);\n\n    input.set(cur => JavaShort.MAX_VALUE + cur);\n\n    expect(input.get()).toEqual(NaN);\n  });\n});\n\ndescribe(\"doubleValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.doubleValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"intValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.intValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"shortValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.shortValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"byteValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.byteValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"floatValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.floatValue();\n\n    expect(output.get()).toBe(1);\n  });\n});\n\ndescribe(\"longValue\", () => {\n  test(\"should convert successfully\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = input.longValue();\n\n    expect(output.get().toNumber()).toBe(1);\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaShort(\"1\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.SHORT);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaString.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaString } from \"../JavaString\";\nimport { JavaType } from \"../JavaType\";\n\ndescribe(\"get\", () => {\n  describe(\"with valid input\", () => {\n    test(\"non-empty string, should return same string\", () => {\n      const input = \"foo\";\n\n      const output = new JavaString(input).get();\n\n      expect(output).toBe(\"foo\");\n    });\n\n    test(\"empty string, should return same string\", () => {\n      const input = \"\";\n\n      const output = new JavaString(input).get();\n\n      expect(output).toBe(\"\");\n    });\n  });\n});\n\ndescribe(\"set\", () => {\n  test(\"with direct value, should set\", () => {\n    const input = new JavaString(\"foo\");\n    expect(input.get()).toBe(\"foo\");\n\n    input.set(\"bar\");\n\n    expect(input.get()).toBe(\"bar\");\n  });\n\n  test(\"with value from function, should set\", () => {\n    const input = new JavaString(\"foo\");\n    expect(input.get()).toBe(\"foo\");\n\n    input.set(cur => cur + \"bar\");\n\n    expect(input.get()).toBe(\"foobar\");\n  });\n});\n\ndescribe(\"_fqcn\", () => {\n  test(\"must be the same than in Java\", () => {\n    const fqcn = (new JavaString(\"foo\") as any)._fqcn;\n\n    expect(fqcn).toBe(JavaType.STRING);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaWrapper.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapper } from \"../JavaWrapper\";\n\ndescribe(\"extendsJavaWrapper\", () => {\n  test(\"with class extending java wrapper, should return true\", () => {\n    const input = new MyNumberType(1);\n\n    const output = JavaWrapper.extendsJavaWrapper(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with class not extending java wrapper, should return false\", () => {\n    const input = {\n      foo: \"bar\"\n    };\n\n    const output = JavaWrapper.extendsJavaWrapper(input);\n\n    expect(output).toBeFalsy();\n  });\n\n  class MyNumberType extends JavaWrapper<number> {\n    private _value: number;\n\n    constructor(value: number) {\n      super();\n      this._value = value;\n    }\n\n    public get(): number {\n      return this._value;\n    }\n\n    public set(val: ((current: number) => number) | number): void {\n      // not used\n    }\n  }\n});\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/__tests__/JavaWrapperUtils.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapperUtils } from \"../JavaWrapperUtils\";\nimport { JavaArrayList } from \"../JavaArrayList\";\nimport { JavaHashSet } from \"../JavaHashSet\";\nimport { JavaHashMap } from \"../JavaHashMap\";\nimport { JavaBoolean } from \"../JavaBoolean\";\nimport { JavaString } from \"../JavaString\";\nimport { JavaDate } from \"../JavaDate\";\nimport { JavaType } from \"../JavaType\";\nimport { JavaEnum } from \"../JavaEnum\";\n\ndescribe(\"needsWrapping\", () => {\n  test(\"with array object, should return true\", () => {\n    const input = [\"foo1\", \"foo2\", \"foo3\"];\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with set object, should return true\", () => {\n    const input = new Set([\"foo1\", \"foo2\", \"foo3\"]);\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with map object, should return true\", () => {\n    const input = new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]);\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with boolean object, should return true\", () => {\n    const input = false;\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with string object, should return true\", () => {\n    const input = \"foo\";\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with date object, should return true\", () => {\n    const input = new Date();\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeTruthy();\n  });\n\n  test(\"with custom object, should return false\", () => {\n    const input = {\n      foo: \"bar1\",\n      foo2: \"bar2\"\n    };\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeFalsy();\n  });\n\n  test(\"with enum type, should return false\", () => {\n    const input = FooEnum.FOO;\n    expect(JavaWrapperUtils.needsWrapping(input)).toBeFalsy();\n  });\n});\n\ndescribe(\"wrapIfNeeded\", () => {\n  test(\"with array object, should return a JavaArray instance\", () => {\n    const input = [\"foo1\", \"foo2\", \"foo3\"];\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(new JavaArrayList([\"foo1\", \"foo2\", \"foo3\"]));\n  });\n\n  test(\"with set object, should return a JavaHashSet instance\", () => {\n    const input = new Set([\"foo1\", \"foo2\", \"foo3\"]);\n    const output = new JavaHashSet(new Set([\"foo1\", \"foo2\", \"foo3\"]));\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(output);\n  });\n\n  test(\"with map object, should return a JavaHashMap instance\", () => {\n    const input = new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]);\n    const output = new JavaHashMap(new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]));\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(output);\n  });\n\n  test(\"with boolean object, should return a JavaBoolean instance\", () => {\n    const input = false;\n    const output = new JavaBoolean(false);\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(output);\n  });\n\n  test(\"with string object, should return a JavaString instance\", () => {\n    const input = \"foo\";\n    const output = new JavaString(\"foo\");\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(output);\n  });\n\n  test(\"with date object, should return a JavaDate instance\", () => {\n    const input = new Date();\n    const output = new JavaDate(input);\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toEqual(output);\n  });\n\n  test(\"with custom object, should return same object\", () => {\n    const input = {\n      foo: \"bar1\",\n      foo2: \"bar2\"\n    };\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toStrictEqual(input);\n  });\n\n  test(\"with enum value, should return same value\", () => {\n    const input = FooEnum.BAR;\n    expect(JavaWrapperUtils.wrapIfNeeded(input)).toStrictEqual(input);\n  });\n});\n\ndescribe(\"isJavaType\", () => {\n  test(\"with Java Byte's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.BYTE)).toBeTruthy();\n  });\n\n  test(\"with Java Double's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.DOUBLE)).toBeTruthy();\n  });\n\n  test(\"with Java Float's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.FLOAT)).toBeTruthy();\n  });\n\n  test(\"with Java Integer's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.INTEGER)).toBeTruthy();\n  });\n\n  test(\"with Java Long's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.LONG)).toBeTruthy();\n  });\n\n  test(\"with Java Short's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.SHORT)).toBeTruthy();\n  });\n\n  test(\"with Java Boolean's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.BOOLEAN)).toBeTruthy();\n  });\n\n  test(\"with Java String's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.STRING)).toBeTruthy();\n  });\n\n  test(\"with Java BigDecimal's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.BIG_DECIMAL)).toBeTruthy();\n  });\n\n  test(\"with Java BigInteger's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.BIG_INTEGER)).toBeTruthy();\n  });\n\n  test(\"with Java ArrayList's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.ARRAY_LIST)).toBeTruthy();\n  });\n\n  test(\"with Java HashSet's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.HASH_SET)).toBeTruthy();\n  });\n\n  test(\"with Java HashMap's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.HASH_MAP)).toBeTruthy();\n  });\n\n  test(\"with Java Date's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.DATE)).toBeTruthy();\n  });\n\n  test(\"with non Java type fqcn, should return false\", () => {\n    expect(JavaWrapperUtils.isJavaType(\"foo\")).toBeFalsy();\n  });\n\n  test(\"with Java Optional's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.OPTIONAL)).toBeTruthy();\n  });\n\n  test(\"with Java Enum's fqcn, should return true\", () => {\n    expect(JavaWrapperUtils.isJavaType(JavaType.ENUM)).toBeTruthy();\n  });\n});\n\ndescribe(\"isEnum\", () => {\n  test(\"with Enum input, should return true\", () => {\n    const input = FooEnum.BAR;\n    expect(JavaWrapperUtils.isEnum(input)).toBeTruthy();\n  });\n\n  test(\"with non enum input, should return false\", () => {\n    const input = {\n      foo: \"bar\"\n    };\n    expect(JavaWrapperUtils.isEnum(input)).toBeFalsy();\n  });\n});\n\nclass FooEnum extends JavaEnum<FooEnum> {\n  public static readonly FOO: FooEnum = new FooEnum(\"FOO\");\n  public static readonly BAR: FooEnum = new FooEnum(\"BAR\");\n\n  protected readonly _fqcn: string = FooEnum.__fqcn();\n\n  public static __fqcn(): string {\n    return \"com.app.my.AddressType\";\n  }\n\n  public static values() {\n    return [FooEnum.FOO, FooEnum.BAR];\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/java-wrappers/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./JavaArrayList\";\nexport * from \"./JavaHashMap\";\nexport * from \"./JavaHashSet\";\nexport * from \"./JavaByte\";\nexport * from \"./JavaDouble\";\nexport * from \"./JavaFloat\";\nexport * from \"./JavaInteger\";\nexport * from \"./JavaNumber\";\nexport * from \"./JavaLong\";\nexport * from \"./JavaShort\";\nexport * from \"./JavaBigInteger\";\nexport * from \"./JavaBigDecimal\";\nexport * from \"./JavaBoolean\";\nexport * from \"./JavaString\";\nexport * from \"./JavaDate\";\nexport * from \"./JavaOptional\";\nexport * from \"./JavaTreeMap\";\nexport * from \"./JavaTreeSet\";\nexport * from \"./JavaLinkedList\";\nexport * from \"./JavaEnum\";\n"
  },
  {
    "path": "appformer-js/src/marshalling/Marshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"./MarshallingContext\";\nimport { Portable } from \"./Portable\";\nimport { UnmarshallingContext } from \"./UnmarshallingContext\";\n\n// marshall(T) => U\n// unmarshall(V) => X\n\nexport interface Marshaller<T extends Portable<T>, U, V, X> {\n  marshall(input: T, ctx: MarshallingContext): U | null;\n  unmarshall(input: V | undefined, ctx: UnmarshallingContext): X | undefined;\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/MarshallerProvider.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaWrapperUtils } from \"../java-wrappers/JavaWrapperUtils\";\nimport { JavaType } from \"../java-wrappers/JavaType\";\nimport { Marshaller } from \"./Marshaller\";\nimport { JavaHashMapMarshaller } from \"./marshallers/JavaHashMapMarshaller\";\nimport { JavaShortMarshaller } from \"./marshallers/JavaShortMarshaller\";\nimport { JavaDoubleMarshaller } from \"./marshallers/JavaDoubleMarshaller\";\nimport { DefaultMarshaller } from \"./marshallers/DefaultMarshaller\";\nimport { JavaStringMarshaller } from \"./marshallers/JavaStringMarshaller\";\nimport { JavaIntegerMarshaller } from \"./marshallers/JavaIntegerMarshaller\";\nimport { JavaBigIntegerMarshaller } from \"./marshallers/JavaBigIntegerMarshaller\";\nimport { JavaFloatMarshaller } from \"./marshallers/JavaFloatMarshaller\";\nimport { JavaBooleanMarshaller } from \"./marshallers/JavaBooleanMarshaller\";\nimport { JavaLongMarshaller } from \"./marshallers/JavaLongMarshaller\";\nimport { JavaBigDecimalMarshaller } from \"./marshallers/JavaBigDecimalMarshaller\";\nimport { JavaByteMarshaller } from \"./marshallers/JavaByteMarshaller\";\nimport { JavaDateMarshaller } from \"./marshallers/JavaDateMarshaller\";\nimport { JavaOptionalMarshaller } from \"./marshallers/JavaOptionalMarshaller\";\nimport { JavaArrayListMarshaller, JavaHashSetMarshaller } from \"./marshallers/JavaCollectionMarshaller\";\nimport { Portable } from \"./Portable\";\nimport { JavaEnumMarshaller } from \"./marshallers/JavaEnumMarshaller\";\n\nexport class MarshallerProvider {\n  private static initialized: boolean = false;\n\n  private static marshallersByJavaType: Map<string, Marshaller<any, any, any, any>>;\n  private static defaultMarshaller: Marshaller<any, any, any, any>;\n\n  public static initialize() {\n    if (this.initialized) {\n      return;\n    }\n\n    this.defaultMarshaller = new DefaultMarshaller();\n\n    this.marshallersByJavaType = new Map();\n    this.marshallersByJavaType.set(JavaType.BYTE, new JavaByteMarshaller());\n    this.marshallersByJavaType.set(JavaType.DOUBLE, new JavaDoubleMarshaller());\n    this.marshallersByJavaType.set(JavaType.FLOAT, new JavaFloatMarshaller());\n    this.marshallersByJavaType.set(JavaType.INTEGER, new JavaIntegerMarshaller());\n    this.marshallersByJavaType.set(JavaType.LONG, new JavaLongMarshaller());\n    this.marshallersByJavaType.set(JavaType.SHORT, new JavaShortMarshaller());\n    this.marshallersByJavaType.set(JavaType.BOOLEAN, new JavaBooleanMarshaller());\n    this.marshallersByJavaType.set(JavaType.STRING, new JavaStringMarshaller());\n    this.marshallersByJavaType.set(JavaType.DATE, new JavaDateMarshaller());\n\n    this.marshallersByJavaType.set(JavaType.BIG_DECIMAL, new JavaBigDecimalMarshaller());\n    this.marshallersByJavaType.set(JavaType.BIG_INTEGER, new JavaBigIntegerMarshaller());\n\n    this.marshallersByJavaType.set(JavaType.ARRAY_LIST, new JavaArrayListMarshaller());\n    this.marshallersByJavaType.set(JavaType.UNMODIFIABLE_COLLECTION, new JavaHashSetMarshaller());\n    this.marshallersByJavaType.set(JavaType.UNMODIFIABLE_SET, new JavaHashSetMarshaller());\n    this.marshallersByJavaType.set(JavaType.HASH_SET, new JavaHashSetMarshaller());\n    this.marshallersByJavaType.set(JavaType.HASH_MAP, new JavaHashMapMarshaller());\n    this.marshallersByJavaType.set(JavaType.UNMODIFIABLE_MAP, new JavaHashMapMarshaller());\n\n    this.marshallersByJavaType.set(JavaType.OPTIONAL, new JavaOptionalMarshaller());\n    this.marshallersByJavaType.set(JavaType.ENUM, new JavaEnumMarshaller());\n\n    this.initialized = true;\n  }\n\n  public static getForObject(obj: Portable<any>): Marshaller<any, any, any, any> {\n    this.assertInitialization();\n\n    if (obj === null || obj === undefined) {\n      return this.defaultMarshaller;\n    }\n\n    const fqcn = (obj as any)._fqcn;\n    if (!fqcn) {\n      return this.defaultMarshaller;\n    }\n\n    return this.getForFqcn(fqcn);\n  }\n\n  public static getForFqcn(fqcn: string): Marshaller<any, any, any, any> {\n    this.assertInitialization();\n\n    if (!fqcn) {\n      return this.defaultMarshaller;\n    }\n\n    if (!JavaWrapperUtils.isJavaType(fqcn)) {\n      // portable objects defines an fqcn but we don't have specific marshallers for it.\n      return this.defaultMarshaller;\n    }\n\n    const marshaller = MarshallerProvider.marshallersByJavaType.get(fqcn);\n    if (!marshaller) {\n      throw new Error(`Missing marshaller implementation for type ${fqcn}`);\n    }\n\n    return marshaller;\n  }\n\n  public static getForEnum(): Marshaller<any, any, any, any> {\n    return this.getForFqcn(JavaType.ENUM);\n  }\n\n  private static assertInitialization() {\n    if (!this.initialized) {\n      throw new Error(\"Initialize MarshallerProvider before using.\");\n    }\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/Marshalling.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Portable } from \"./Portable\";\nimport { MarshallerProvider } from \"./MarshallerProvider\";\nimport { MarshallingContext } from \"./MarshallingContext\";\nimport { UnmarshallingContext } from \"./UnmarshallingContext\";\nimport { ErraiObjectConstants } from \"./model/ErraiObjectConstants\";\n\n/**\n * Serializes a Portable<T> object into an Errai json.\n * @param obj\n */\n\nexport function marshall<T>(obj: Portable<T>): string | null {\n  if (obj === null || obj === undefined) {\n    return null;\n  }\n\n  const marshaller = MarshallerProvider.getForObject(obj);\n  return JSON.stringify(marshaller.marshall(obj, new MarshallingContext()));\n}\n\n/**\n * Deserializes an Errai json creating a Portable<T> object.\n *\n * @param json\n * The Errai json.\n * @param oracle\n * A map containing fqcns as keys and a function returning an empty Portable<T> associated with that fqcn.\n */\nexport function unmarshall<T>(json: string, oracle: Map<string, () => Portable<any>>): Portable<T> | null | void {\n  if (json === null || json === undefined) {\n    return undefined;\n  }\n\n  const jsonObj = JSON.parse(json);\n  const fqcn = jsonObj[ErraiObjectConstants.ENCODED_TYPE];\n\n  const marshaller = MarshallerProvider.getForFqcn(fqcn);\n  return marshaller.unmarshall(jsonObj, new UnmarshallingContext(oracle));\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/MarshallingContext.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObject } from \"./model/ErraiObject\";\nimport { ErraiObjectConstants } from \"./model/ErraiObjectConstants\";\nimport { Portable } from \"./Portable\";\nimport { JavaWrapper } from \"../java-wrappers/JavaWrapper\";\n\nexport class MarshallingContext {\n  private objContext: Map<Portable<any>, ErraiObject>;\n  private objectId: number;\n\n  constructor() {\n    this.objContext = new Map();\n    this.objectId = 0;\n  }\n\n  public incrementAndGetObjectId() {\n    return ++this.objectId;\n  }\n\n  public cacheObject(key: Portable<any>, obj: ErraiObject) {\n    this.objContext.set(this.unwrap(key), {\n      [ErraiObjectConstants.ENCODED_TYPE]: obj[ErraiObjectConstants.ENCODED_TYPE],\n      [ErraiObjectConstants.OBJECT_ID]: obj[ErraiObjectConstants.OBJECT_ID]\n    });\n  }\n\n  public getCached(key: Portable<any>): ErraiObject | undefined {\n    return this.objContext.get(this.unwrap(key))!;\n  }\n\n  private unwrap(key: Portable<any>) {\n    if (JavaWrapper.extendsJavaWrapper(key)) {\n      // When handling wrapped values, we use the raw typescript value as cache key.\n      // This is needed because in the marshalling flow we wrap the values automatically\n      // if they represent a Java type, creating a new wrapper object every time. If we use the wrapper\n      // object directly, the value will never be found in cache, because it'll always be a different pointer\n      return key.get();\n    }\n\n    return key;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/Portable.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// tslint:disable-next-line\nexport interface Portable<T extends Portable<T>> {}\n"
  },
  {
    "path": "appformer-js/src/marshalling/UnmarshallingContext.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Portable } from \"./Portable\";\nimport { ErraiObject } from \"./model/ErraiObject\";\nimport { ErraiObjectConstants } from \"./model/ErraiObjectConstants\";\n\nexport class UnmarshallingContext {\n  private readonly _oracle: Map<string, () => Portable<any>>;\n  private readonly _objectsCache: Map<string, Portable<any>>;\n\n  constructor(oracle: Map<string, () => Portable<any>>) {\n    this._oracle = oracle;\n    this._objectsCache = new Map();\n  }\n\n  public cacheObject(input: ErraiObject, obj: Portable<any>) {\n    const objectId = input[ErraiObjectConstants.OBJECT_ID];\n    if (objectId) {\n      this._objectsCache.set(objectId, obj);\n    }\n  }\n\n  public getCached(input: ErraiObject): Portable<any> | undefined {\n    const objectId = input[ErraiObjectConstants.OBJECT_ID];\n    if (!objectId) {\n      return undefined;\n    }\n\n    return this._objectsCache.get(objectId);\n  }\n\n  public getFactory(fqcn: string): (() => Portable<any>) | undefined {\n    return this._oracle.get(fqcn);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/__tests__/MarshallerProvider.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../java-wrappers\";\nimport { MarshallerProvider } from \"../MarshallerProvider\";\nimport { JavaBigIntegerMarshaller } from \"../marshallers/JavaBigIntegerMarshaller\";\nimport { JavaHashMapMarshaller } from \"../marshallers/JavaHashMapMarshaller\";\nimport { JavaByteMarshaller } from \"../marshallers/JavaByteMarshaller\";\nimport { JavaBigDecimalMarshaller } from \"../marshallers/JavaBigDecimalMarshaller\";\nimport { JavaStringMarshaller } from \"../marshallers/JavaStringMarshaller\";\nimport { JavaBooleanMarshaller } from \"../marshallers/JavaBooleanMarshaller\";\nimport { JavaShortMarshaller } from \"../marshallers/JavaShortMarshaller\";\nimport { JavaLongMarshaller } from \"../marshallers/JavaLongMarshaller\";\nimport { JavaIntegerMarshaller } from \"../marshallers/JavaIntegerMarshaller\";\nimport { JavaFloatMarshaller } from \"../marshallers/JavaFloatMarshaller\";\nimport { JavaDoubleMarshaller } from \"../marshallers/JavaDoubleMarshaller\";\nimport { DefaultMarshaller } from \"../marshallers/DefaultMarshaller\";\nimport { JavaWrapperUtils } from \"../../java-wrappers/JavaWrapperUtils\";\nimport { JavaType } from \"../../java-wrappers/JavaType\";\nimport * as JavaCollectionMarshaller from \"../marshallers/JavaCollectionMarshaller\";\nimport { JavaDateMarshaller } from \"../marshallers/JavaDateMarshaller\";\nimport { JavaOptionalMarshaller } from \"../marshallers/JavaOptionalMarshaller\";\n\ndescribe(\"getForObject\", () => {\n  test(\"without initialize, should return Error\", () => {\n    const input = new JavaString(\"foo\");\n    expect(() => MarshallerProvider.getForObject(input)).toThrowError();\n  });\n\n  describe(\"properly initialized\", () => {\n    beforeEach(() => {\n      MarshallerProvider.initialize();\n    });\n\n    afterEach(() => {\n      // force reinitialization\n      (MarshallerProvider as any).initialized = false;\n    });\n\n    test(\"with JavaByte instance, should return JavaByteMarshaller instance\", () => {\n      const input = new JavaByte(\"1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaByteMarshaller());\n    });\n\n    test(\"with JavaDouble instance, should return JavaDoubleMarshaller instance\", () => {\n      const input = new JavaDouble(\"1.1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaDoubleMarshaller());\n    });\n\n    test(\"with JavaFloat instance, should return JavaFloatMarshaller instance\", () => {\n      const input = new JavaFloat(\"1.1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaFloatMarshaller());\n    });\n\n    test(\"with JavaInteger instance, should return JavaIntegerMarshaller instance\", () => {\n      const input = new JavaInteger(\"1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaIntegerMarshaller());\n    });\n\n    test(\"with JavaLong instance, should return JavaLongMarshaller instance\", () => {\n      const input = new JavaLong(\"1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaLongMarshaller());\n    });\n\n    test(\"with JavaShort instance, should return JavaShortMarshaller instance\", () => {\n      const input = new JavaShort(\"1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaShortMarshaller());\n    });\n\n    test(\"with JavaBoolean instance, should return JavaBooleanMarshaller instance\", () => {\n      const input = new JavaBoolean(false);\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaBooleanMarshaller());\n    });\n\n    test(\"with JavaString instance, should return JavaStringMarshaller instance\", () => {\n      const input = new JavaString(\"foo\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaStringMarshaller());\n    });\n\n    test(\"with JavaDate instance, should return JavaDateMarshaller instance\", () => {\n      const input = new JavaDate(new Date());\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaDateMarshaller());\n    });\n\n    test(\"with JavaBigDecimal instance, should return JavaBigDecimalMarshaller instance\", () => {\n      const input = new JavaBigDecimal(\"1.1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaBigDecimalMarshaller());\n    });\n\n    test(\"with JavaBigInteger instance, should return JavaBigIntegerMarshaller instance\", () => {\n      const input = new JavaBigInteger(\"1\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaBigIntegerMarshaller());\n    });\n\n    test(\"with JavaArrayList instance, should return JavaArrayListMarshaller instance\", () => {\n      const input = new JavaArrayList([1, 2, 3]);\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaCollectionMarshaller.JavaArrayListMarshaller());\n    });\n\n    test(\"with JavaHashSet instance, should return JavaHashSetMarshaller instance\", () => {\n      const input = new JavaHashSet(new Set([1, 2, 3]));\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaCollectionMarshaller.JavaHashSetMarshaller());\n    });\n\n    test(\"with JavaHashMap instance, should return JavaHashMapMarshaller instance\", () => {\n      const input = new JavaHashMap(new Map([[\"foo\", \"bar\"]]));\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaHashMapMarshaller());\n    });\n\n    test(\"with JavaOptional instance, should return JavaOptionalMarshaller instance\", () => {\n      const input = new JavaOptional<string>(\"str\");\n      expect(MarshallerProvider.getForObject(input)).toEqual(new JavaOptionalMarshaller());\n    });\n\n    test(\"with input without fqcn, should return default marshaller\", () => {\n      const input = {\n        foo: \"bar\",\n        bar: \"foo\"\n      };\n\n      expect(MarshallerProvider.getForObject(input)).toEqual(new DefaultMarshaller());\n    });\n\n    test(\"with input with a custom fqcn, should return default marshaller\", () => {\n      const fqcn = \"com.myapp.custom.pojo\";\n      const input = {\n        _fqcn: fqcn,\n        foo: \"bar\",\n        bar: \"foo\"\n      };\n\n      // it is a custom pojo (i.e. no pre-defined marshaller)\n      expect(JavaWrapperUtils.isJavaType(fqcn)).toBeFalsy();\n\n      expect(MarshallerProvider.getForObject(input)).toEqual(new DefaultMarshaller());\n    });\n\n    test(\"with a Java type without marshaller, should throw error\", () => {\n      // the only scenario it throws errors is when a Java-wrapped type has no marshaller associated.\n\n      // little trick to mess with internal state\n      const marshallers = (MarshallerProvider as any).marshallersByJavaType;\n      marshallers.delete(JavaType.STRING);\n\n      const input = new JavaString(\"foo\");\n\n      expect(() => MarshallerProvider.getForObject(input)).toThrowError();\n    });\n  });\n});\n\ndescribe(\"getForFqcn\", () => {\n  test(\"without initialize, should return Error\", () => {\n    expect(() => MarshallerProvider.getForFqcn(\"anything\")).toThrowError();\n  });\n\n  describe(\"properly initialized\", () => {\n    beforeEach(() => {\n      MarshallerProvider.initialize();\n    });\n\n    afterEach(() => {\n      // force reinitialization\n      (MarshallerProvider as any).initialized = false;\n    });\n\n    test(\"with Java's Byte fqcn, should return JavaByteMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.BYTE)).toEqual(new JavaByteMarshaller());\n    });\n\n    test(\"with Java's Double fqcn, should return JavaDoubleMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.DOUBLE)).toEqual(new JavaDoubleMarshaller());\n    });\n\n    test(\"with Java's Float fqcn, should return JavaFloatMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.FLOAT)).toEqual(new JavaFloatMarshaller());\n    });\n\n    test(\"with Java's Integer fqcn, should return JavaIntegerMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.INTEGER)).toEqual(new JavaIntegerMarshaller());\n    });\n\n    test(\"with Java's Long fqcn, should return JavaLongMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.LONG)).toEqual(new JavaLongMarshaller());\n    });\n\n    test(\"with Java's Short fqcn, should return JavaShortMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.SHORT)).toEqual(new JavaShortMarshaller());\n    });\n\n    test(\"with Java's Boolean fqcn, should return JavaBooleanMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.BOOLEAN)).toEqual(new JavaBooleanMarshaller());\n    });\n\n    test(\"with Java's String fqcn, should return JavaStringMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.STRING)).toEqual(new JavaStringMarshaller());\n    });\n\n    test(\"with Java's Date fqcn, should return JavaDateMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.DATE)).toEqual(new JavaDateMarshaller());\n    });\n\n    test(\"with Java's BigDecimal fqcn, should return JavaBigDecimalMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.BIG_DECIMAL)).toEqual(new JavaBigDecimalMarshaller());\n    });\n\n    test(\"with Java's BigInteger fqcn, should return JavaBigIntegerMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.BIG_INTEGER)).toEqual(new JavaBigIntegerMarshaller());\n    });\n\n    test(\"with Java's ArrayList fqcn, should return JavaArrayListMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.ARRAY_LIST)).toEqual(\n        new JavaCollectionMarshaller.JavaArrayListMarshaller()\n      );\n    });\n\n    test(\"with Java's HashSet fqcn, should return JavaHashSetMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.HASH_SET)).toEqual(\n        new JavaCollectionMarshaller.JavaHashSetMarshaller()\n      );\n    });\n\n    test(\"with Java's HashMap fqcn, should return JavaHashMapMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.HASH_MAP)).toEqual(new JavaHashMapMarshaller());\n    });\n\n    test(\"with Java's Optional fqcn, should return JavaOptionalMarshaller instance\", () => {\n      expect(MarshallerProvider.getForFqcn(JavaType.OPTIONAL)).toEqual(new JavaOptionalMarshaller());\n    });\n\n    test(\"with null fqcn, should return default marshaller\", () => {\n      const fqcn = null as any;\n\n      expect(MarshallerProvider.getForFqcn(fqcn)).toEqual(new DefaultMarshaller());\n    });\n\n    test(\"with undefined fqcn, should return default marshaller\", () => {\n      const fqcn = undefined as any;\n\n      expect(MarshallerProvider.getForFqcn(fqcn)).toEqual(new DefaultMarshaller());\n    });\n\n    test(\"with empty string, should return default marshaller\", () => {\n      const fqcn = \"\";\n\n      expect(MarshallerProvider.getForFqcn(fqcn)).toEqual(new DefaultMarshaller());\n    });\n\n    test(\"with custom fqcn, should return default marshaller\", () => {\n      const fqcn = \"com.myapp.custom.pojo\";\n\n      // it is a custom pojo (i.e. no pre-defined marshaller)\n      expect(JavaWrapperUtils.isJavaType(fqcn)).toBeFalsy();\n\n      expect(MarshallerProvider.getForFqcn(fqcn)).toEqual(new DefaultMarshaller());\n    });\n  });\n});\n\ndescribe(\"consistency validations\", () => {\n  beforeEach(() => {\n    (MarshallerProvider as any).initialized = false; // force reinitialization\n    MarshallerProvider.initialize();\n  });\n\n  test(\"all Java types should have a marshaller associated\", () => {\n    // this test is important to avoid developers to forget to add marshallers to new JavaTypes\n\n    const marshallers = (MarshallerProvider as any).marshallersByJavaType;\n    Object.keys(JavaType)\n      .map((k: keyof typeof JavaType) => JavaType[k])\n      .forEach(javaType => expect(marshallers.get(javaType)).toBeDefined());\n  });\n});\n\ndescribe(\"getForEnum\", () => {\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  afterEach(() => {\n    // force reinitialization\n    (MarshallerProvider as any).initialized = false;\n  });\n\n  test(\"should return exactly the same enum marshaller object\", () => {\n    const enumMarshaller = (MarshallerProvider as any).marshallersByJavaType.get(JavaType.ENUM);\n    expect(MarshallerProvider.getForEnum()).toStrictEqual(enumMarshaller);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/__tests__/Marshalling.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallerProvider } from \"../MarshallerProvider\";\nimport * as Marshalling from \"../Marshalling\";\nimport { unmarshall } from \"../Marshalling\";\nimport { JavaInteger } from \"../../java-wrappers\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../java-wrappers/JavaType\";\n\nconst originalGetForObject = MarshallerProvider.getForObject;\nconst originalGetForFqcn = MarshallerProvider.getForFqcn;\n\nafterEach(() => {\n  // reset static function, otherwise other tests will be invoking the function set by this test\n  MarshallerProvider.getForFqcn = originalGetForFqcn;\n  MarshallerProvider.getForObject = originalGetForObject;\n});\n\ndescribe(\"marshall\", () => {\n  test(\"with regular input, should return an errai object json-string version of it\", () => {\n    const input = new JavaInteger(\"1\");\n    const inputErraiObject = new NumValBasedErraiObject(JavaType.INTEGER, 1).asErraiObject();\n\n    const expectedJson = JSON.stringify(inputErraiObject);\n\n    // skip actual marshaller implementation\n    const mockedMarshaller = { marshall: jest.fn(() => inputErraiObject), unmarshall: jest.fn() };\n    MarshallerProvider.getForObject = jest.fn(() => mockedMarshaller);\n\n    // ==\n    // ====== test\n    const output = Marshalling.marshall(input);\n\n    // == assertion\n    expect(expectedJson).toEqual(output);\n  });\n\n  test(\"with null input, should return null\", () => {\n    const input = null as any;\n\n    const output = Marshalling.marshall(input);\n\n    expect(output).toBeNull();\n  });\n\n  test(\"with undefined input, should serialize marshaller output\", () => {\n    const input = undefined as any;\n\n    const output = Marshalling.marshall(input);\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with null input, should return undefined\", () => {\n    const input = null;\n\n    const output = unmarshall(input as any, new Map());\n\n    expect(output).toBeUndefined();\n  });\n\n  test(\"with undefined input, should return undefined\", () => {\n    const input = undefined;\n\n    const output = unmarshall(input as any, new Map());\n\n    expect(output).toBeUndefined();\n  });\n\n  test(\"with invalid json, should throw error\", () => {\n    const input = \"{ broken json }\";\n\n    expect(() => unmarshall(input, new Map())).toThrowError();\n  });\n\n  test(\"with regular input, should return marshallers' specific content\", () => {\n    const inputJson = new NumValBasedErraiObject(JavaType.INTEGER, 1).asErraiObject();\n\n    const expectedOutput = new JavaInteger(\"1\");\n\n    // skip actual marshaller implementation\n    const mockedMarshaller = { unmarshall: jest.fn(() => expectedOutput), marshall: jest.fn() };\n    MarshallerProvider.getForFqcn = jest.fn(() => mockedMarshaller);\n\n    // ==\n    // ====== test\n    const output = Marshalling.unmarshall(JSON.stringify(inputJson), new Map());\n\n    // == assertion\n    expect(expectedOutput).toEqual(output);\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/__tests__/MarshallingContext.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { ErraiObjectConstants } from \"../model/ErraiObjectConstants\";\nimport { JavaWrapper } from \"../../java-wrappers/JavaWrapper\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\n\ndescribe(\"incrementAndGetObjectId\", () => {\n  test(\"with sequential calls, should return different ids\", () => {\n    const context = new MarshallingContext();\n\n    const firstObjectId = context.incrementAndGetObjectId();\n    const secondObjectId = context.incrementAndGetObjectId();\n\n    expect(firstObjectId).not.toEqual(secondObjectId);\n  });\n});\n\ndescribe(\"cacheObject\", () => {\n  let context: MarshallingContext;\n\n  beforeEach(() => {\n    context = new MarshallingContext();\n  });\n\n  test(\"with regular object, should record the correct ErraiObject instance\", () => {\n    const inputPortable = { _fqcn: \"com.myapp.my.portable\", foo: \"bar\", bar: \"foo\" };\n\n    const inputErraiObject = new NumValBasedErraiObject(\"com.foo.bar\", \"123\", \"1\").asErraiObject();\n\n    context.cacheObject(inputPortable, inputErraiObject);\n\n    // the only cached fields are the encodedType and objectId\n    expect((context as any).objContext.get(inputPortable)).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    });\n  });\n\n  test(\"with object overwritten, should return the last version\", () => {\n    const inputPortable = { _fqcn: \"com.myapp.my.portable\", foo: \"bar\", bar: \"foo\" };\n\n    const inputErraiObject = new NumValBasedErraiObject(\"com.foo.bar\", \"123\", \"1\").asErraiObject();\n\n    context.cacheObject(inputPortable, inputErraiObject);\n\n    // override object\n    context.cacheObject(inputPortable, {\n      ...inputErraiObject,\n      [ErraiObjectConstants.OBJECT_ID]: \"2\"\n    });\n\n    expect((context as any).objContext.get(inputPortable)).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"2\"\n    });\n  });\n\n  test(\"with java wrapper object, should use the inner value as cache key\", () => {\n    const innerValue = 1;\n    const wrappedValue = new MyNumberWrappedType(innerValue);\n\n    const inputErraiObject = new NumValBasedErraiObject(\"com.foo.bar\", \"123\", \"1\").asErraiObject();\n\n    context.cacheObject(wrappedValue, inputErraiObject);\n\n    // use the inner value object as cache key\n    expect((context as any).objContext.get(innerValue)).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    });\n\n    // do not use the wrapped object as cache key\n    expect((context as any).objContext.get(wrappedValue)).toBeUndefined();\n  });\n});\n\ndescribe(\"getCached\", () => {\n  let context: MarshallingContext;\n\n  beforeEach(() => {\n    context = new MarshallingContext();\n  });\n\n  test(\"with non-existent key, should return undefined\", () => {\n    const input = { _fqcn: \"com.myapp.my.portable\", foo: \"bar\", bar: \"foo\" };\n    expect(context.getCached(input)).toBeUndefined();\n  });\n\n  test(\"with existent key, should same object recorded previously\", () => {\n    const inputPortable = { _fqcn: \"com.myapp.my.portable\", foo: \"bar\", bar: \"foo\" };\n    const inputErraiObject = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    } as ErraiObject;\n\n    (context as any).objContext.set(inputPortable, inputErraiObject);\n\n    expect(context.getCached(inputPortable)).toStrictEqual(inputErraiObject);\n  });\n\n  test(\"with java wrapper object, should use the inner value as cache key\", () => {\n    const innerValue = 1;\n    const wrappedValue = new MyNumberWrappedType(innerValue);\n\n    const inputErraiObject = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    } as ErraiObject;\n\n    (context as any).objContext.set(innerValue, inputErraiObject);\n\n    // use the inner value object as cache key\n    expect(context.getCached(innerValue)).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    });\n\n    expect(context.getCached(wrappedValue)).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.foo.bar\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\"\n    });\n  });\n});\n\nclass MyNumberWrappedType extends JavaWrapper<number> {\n  private readonly _fqcn = \"com.type.wrapped.number.my\";\n\n  private readonly _value: number;\n\n  constructor(value: number) {\n    super();\n    this._value = value;\n  }\n\n  public get(): number {\n    return this._value;\n  }\n\n  public set(val: ((current: number) => number) | number): void {\n    // not used\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/__tests__/UnmarshallingContext.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { Portable } from \"../Portable\";\nimport { ErraiObjectConstants } from \"../model/ErraiObjectConstants\";\n\ndescribe(\"cacheObject\", () => {\n  test(\"with regular input, should cache it using the object's id as key\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    const erraiObj = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\",\n      foo: \"bar\"\n    };\n\n    const portable = new MyPortable({ foo: \"bar\" });\n\n    context.cacheObject(erraiObj, portable);\n\n    const cache = (context as any)._objectsCache;\n    const cachedValue = cache.get(\"1\");\n\n    expect(cachedValue).toStrictEqual(portable);\n    expect(cache.size).toBe(1);\n  });\n\n  test(\"with repeated calls, should cache the last version\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    const erraiObj = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\",\n      foo: \"bar\"\n    };\n\n    const portable = new MyPortable({ foo: \"bar\" });\n    const portableV2 = new MyPortable({ foo: \"bar2\" });\n\n    context.cacheObject(erraiObj, portable);\n    context.cacheObject(erraiObj, portableV2);\n\n    const cache = (context as any)._objectsCache;\n    const cachedValue = cache.get(\"1\");\n\n    expect(cachedValue).toStrictEqual(portableV2);\n    expect(cache.size).toBe(1);\n  });\n\n  test(\"with input without object id, should not cache it\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    const erraiObj = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"\",\n      foo: \"bar\"\n    };\n\n    const portable = new MyPortable({ foo: \"bar\" });\n\n    context.cacheObject(erraiObj, portable);\n\n    const cache = (context as any)._objectsCache;\n    const cachedValue = cache.get(\"1\");\n\n    expect(cachedValue).toBeUndefined();\n    expect(cache.size).toBe(0);\n  });\n});\n\ndescribe(\"getCached\", () => {\n  test(\"with cached input, should return it\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    const erraiObj = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\",\n      foo: \"bar\"\n    };\n\n    const portable = new MyPortable({ foo: \"bar\" });\n    context.cacheObject(erraiObj, portable);\n\n    const cachedValue = context.getCached(erraiObj);\n\n    expect(cachedValue).toStrictEqual(portable);\n  });\n\n  test(\"with input without object id, should return undefined\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    const spy = jest.spyOn((context as any)._objectsCache, \"get\");\n\n    const erraiObj = {\n      // no object id\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"\",\n      foo: \"bar\"\n    };\n\n    context.getCached(erraiObj);\n\n    expect(spy).not.toHaveBeenCalled();\n  });\n\n  test(\"with non existent input, should return undefined\", () => {\n    const context = new UnmarshallingContext(new Map());\n\n    // add some dummy entry to the cache\n    const erraiObj = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"bla\",\n      [ErraiObjectConstants.OBJECT_ID]: \"1\",\n      foo: \"bar\"\n    };\n\n    const cachedValue = context.getCached(erraiObj);\n\n    expect(cachedValue).toBeUndefined();\n    expect((context as any)._objectsCache.size).toEqual(0);\n  });\n});\n\ndescribe(\"getFactory\", () => {\n  test(\"with existent factory for fqcn, should return it\", () => {\n    const oracle = new Map([[\"com.app.my\", () => new MyPortable({} as any)]]);\n\n    const context = new UnmarshallingContext(oracle);\n\n    const factory = context.getFactory(\"com.app.my\");\n\n    expect(factory).toBeDefined();\n    expect(factory!()).toEqual(new MyPortable({} as any));\n  });\n\n  test(\"with non-existent factory for fqcn, should return it\", () => {\n    const oracle = new Map([[\"com.app.my2\", () => new MyPortable({} as any)]]);\n\n    const context = new UnmarshallingContext(oracle);\n\n    const factory = context.getFactory(\"com.app.my\");\n\n    expect(factory).toBeUndefined();\n  });\n});\n\nclass MyPortable implements Portable<MyPortable> {\n  private readonly _fqcn = \"com.app.my\";\n\n  public readonly foo: string;\n\n  constructor(self: { foo: string }) {\n    Object.assign(this, self);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallerProvider } from \"./MarshallerProvider\";\n\nexport * from \"./Marshalling\";\nexport * from \"./Portable\";\n\n// Load marshallers to be used in RPC flow\nMarshallerProvider.initialize();\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/DefaultMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallerProvider } from \"../MarshallerProvider\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { JavaWrapperUtils } from \"../../java-wrappers/JavaWrapperUtils\";\nimport { ErraiObjectConstants } from \"../model/ErraiObjectConstants\";\nimport { Portable } from \"../Portable\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { JavaWrapper } from \"../../java-wrappers/JavaWrapper\";\n\nexport class DefaultMarshaller<T extends Portable<T>> extends NullableMarshaller<\n  T,\n  ErraiObject,\n  ErraiObject,\n  Portable<any>\n> {\n  public notNullMarshall(input: T, ctx: MarshallingContext): ErraiObject {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return cachedObject;\n    }\n\n    const rootFqcn = (input as any)._fqcn;\n    if (!rootFqcn) {\n      // the input may be of primitive type, if it is a Java-wrappable type,\n      // we need to wrap it before marshalling\n      if (JavaWrapperUtils.needsWrapping(input)) {\n        return DefaultMarshaller.marshallWrappableType(input, ctx);\n      } else {\n        throw new Error(`Don't know how to marshall ${input}. Portable types must contain a '_fqcn' property!`);\n      }\n    }\n\n    // Input has fqcn, so, it represents a Java type. We need to check if it\n    // is a primitive Java type or not, because this marshaller handles only\n    // custom types (i.e. Portable).\n    if (JavaWrapperUtils.isJavaType(rootFqcn)) {\n      const marshaller = MarshallerProvider.getForObject(input);\n      const marshalledObject = marshaller.marshall(input, ctx);\n\n      ctx.cacheObject(input, marshalledObject);\n      return marshalledObject;\n    }\n\n    if (JavaWrapperUtils.isEnum(input)) {\n      return MarshallerProvider.getForEnum().marshall(input, ctx);\n    }\n\n    const _this = this.marshallCustomObject(input, ctx, rootFqcn);\n\n    ctx.cacheObject(input, _this);\n    return _this;\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): Portable<any> {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return cachedObject;\n    }\n\n    const rootFqcn = input[ErraiObjectConstants.ENCODED_TYPE];\n    if (!rootFqcn) {\n      return DefaultMarshaller.unmarshallUnqualifiedValue(input, ctx);\n    }\n\n    const targetFactory = ctx.getFactory(rootFqcn);\n    if (!targetFactory) {\n      // this input is not a custom object, otherwise, we would be able to find a factory function.\n      // try to unmarshall it as a java type (that we know how to build)\n      return DefaultMarshaller.unmarshallJavaType(rootFqcn, input, ctx);\n    }\n\n    if (this.isEnumObject(input as any)) {\n      return MarshallerProvider.getForEnum().unmarshall(input, ctx);\n    }\n\n    const targetObj = this.unmarshallCustomObject(targetFactory, input, ctx);\n\n    ctx.cacheObject(input, targetObj);\n\n    return targetObj;\n  }\n\n  private marshallCustomObject(input: any, ctx: MarshallingContext, fqcn: string) {\n    const _this = { ...input };\n\n    Object.keys(_this).forEach(k => {\n      if (typeof _this[k] === \"function\") {\n        delete _this[k];\n      } else if (_this[k] === undefined || _this[k] === null) {\n        _this[k] = null;\n      } else if (_this[k]._fqcn) {\n        const marshaller = MarshallerProvider.getForObject(_this[k]);\n        _this[k] = marshaller.marshall(_this[k], ctx);\n      } else {\n        _this[k] = this.marshall(_this[k], ctx);\n      }\n    });\n\n    _this[ErraiObjectConstants.ENCODED_TYPE] = fqcn;\n    _this[ErraiObjectConstants.OBJECT_ID] = `${ctx.incrementAndGetObjectId()}`;\n    delete _this._fqcn;\n    return _this;\n  }\n\n  private unmarshallCustomObject(targetFactory: () => any, input: ErraiObject, ctx: UnmarshallingContext) {\n    // instantiate an empty target object in order to be able to discover the\n    // types of unqualified values present in the JSON\n    const targetObj = targetFactory();\n\n    // clone the input, removing non useful fields\n    const _this = { ...(input as any) };\n    delete _this[ErraiObjectConstants.ENCODED_TYPE];\n    delete _this[ErraiObjectConstants.OBJECT_ID];\n\n    Object.keys(_this).forEach(k => {\n      if (_this[k] === null || _this[k] === undefined) {\n        targetObj[k] = undefined;\n      } else if (_this[k][ErraiObjectConstants.ENCODED_TYPE]) {\n        const fqcn = _this[k][ErraiObjectConstants.ENCODED_TYPE];\n        targetObj[k] = MarshallerProvider.getForFqcn(fqcn).unmarshall(_this[k], ctx);\n      } else {\n        // no fqcn, try to infer it asking the field's type to the target object\n        const inferredFqcn = DefaultMarshaller.qualifyValue(k, _this[k], targetObj);\n        if (!inferredFqcn) {\n          throw new Error(`Don't know how to unmarshall field ${k} of ${input}`);\n        }\n        targetObj[k] = MarshallerProvider.getForFqcn(inferredFqcn).unmarshall(_this[k], ctx);\n      }\n    });\n\n    return targetObj;\n  }\n\n  private isEnumObject(input: ErraiObject): boolean {\n    return input[ErraiObjectConstants.ENUM_STRING_VALUE] !== undefined;\n  }\n\n  private static marshallWrappableType(input: any, ctx: MarshallingContext): any {\n    // convert native JS types to a default Java type implementation\n    const wrappedType = JavaWrapperUtils.wrapIfNeeded(input);\n\n    return MarshallerProvider.getForObject(wrappedType).marshall(wrappedType, ctx);\n  }\n\n  private static unmarshallJavaType(fqcn: string, input: ErraiObject, ctx: UnmarshallingContext) {\n    if (!JavaWrapperUtils.isJavaType(fqcn)) {\n      throw new Error(`No factory provided for ${fqcn}. Cannot unmarshall.`);\n    }\n\n    return MarshallerProvider.getForFqcn(fqcn).unmarshall(input, ctx);\n  }\n\n  private static unmarshallUnqualifiedValue(input: ErraiObject, ctx: UnmarshallingContext) {\n    if (!JavaWrapperUtils.needsWrapping(input)) {\n      // field is not wrappable, so, there's no way to know what is the target object\n      throw new Error(\"Don't know how to unmarshall types without encoded type\");\n    }\n\n    // qualify the input (i.e. discover its fqcn)\n    const wrappedType = JavaWrapperUtils.wrapIfNeeded(input);\n\n    return MarshallerProvider.getForObject(wrappedType).unmarshall((wrappedType as JavaWrapper<any>).get(), ctx);\n  }\n\n  private static qualifyValue(fieldName: string, fieldValue: any, targetObj: any): string | undefined {\n    if (JavaWrapperUtils.needsWrapping(fieldValue)) {\n      return (JavaWrapperUtils.wrapIfNeeded(fieldValue) as any)._fqcn;\n    }\n\n    if (targetObj[fieldName] === null || targetObj[fieldName] === undefined) {\n      return undefined;\n    }\n\n    return (targetObj[fieldName] as any)._fqcn;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaBigDecimalMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaBigDecimal } from \"../../java-wrappers/JavaBigDecimal\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\nimport { isString } from \"../../util/TypeUtils\";\n\nexport class JavaBigDecimalMarshaller extends NullableMarshaller<\n  JavaBigDecimal,\n  ErraiObject,\n  ErraiObject,\n  JavaBigDecimal\n> {\n  public notNullMarshall(input: JavaBigDecimal, ctx: MarshallingContext): ErraiObject {\n    const fqcn = (input as any)._fqcn;\n    const value = input.get().toString(10);\n    const objectId = ctx.incrementAndGetObjectId().toString(10);\n    return new ValueBasedErraiObject(fqcn, value, objectId).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): JavaBigDecimal {\n    const valueFromJson = ValueBasedErraiObject.from(input).value as string;\n\n    if (!JavaBigDecimalMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid BigDecimal value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaBigDecimal(valueFromJson);\n  }\n\n  private static isValid(valueFromJson: string): boolean {\n    if (!valueFromJson) {\n      return false;\n    }\n\n    if (!isString(valueFromJson)) {\n      return false;\n    }\n\n    return NumberUtils.isFloatString(valueFromJson);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaBigIntegerMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaBigInteger } from \"../../java-wrappers/JavaBigInteger\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\nimport { isString } from \"../../util/TypeUtils\";\n\nexport class JavaBigIntegerMarshaller extends NullableMarshaller<\n  JavaBigInteger,\n  ErraiObject,\n  ErraiObject,\n  JavaBigInteger\n> {\n  public notNullMarshall(input: JavaBigInteger, ctx: MarshallingContext): ErraiObject {\n    const fqcn = (input as any)._fqcn;\n    const value = input.get().toString(10);\n    const objectId = ctx.incrementAndGetObjectId().toString(10);\n    return new ValueBasedErraiObject(fqcn, value, objectId).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): JavaBigInteger {\n    const valueFromJson = ValueBasedErraiObject.from(input).value as string;\n\n    if (!JavaBigIntegerMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid BigInteger value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaBigInteger(valueFromJson);\n  }\n\n  private static isValid(valueFromJson: string): boolean {\n    if (!isString(valueFromJson)) {\n      return false;\n    }\n\n    if (!valueFromJson) {\n      return false;\n    }\n\n    return NumberUtils.isIntegerString(valueFromJson);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaBooleanMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaBoolean } from \"../../java-wrappers/JavaBoolean\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { instanceOfBoolean } from \"../../util/TypeUtils\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\n\nexport class JavaBooleanMarshaller extends NullableMarshaller<JavaBoolean, boolean, ErraiObject | boolean, boolean> {\n  public notNullMarshall(input: JavaBoolean, ctx: MarshallingContext): boolean {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | boolean, ctx: UnmarshallingContext): boolean {\n    if (instanceOfBoolean(input)) {\n      return input;\n    }\n\n    const valueFromJson = NumValBasedErraiObject.from(input).numVal;\n\n    if (!JavaBooleanMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid boolean value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return valueFromJson as boolean;\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    return instanceOfBoolean(valueFromJson);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaByteMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaByte } from \"../../java-wrappers/JavaByte\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { instanceOfNumber } from \"../../util/TypeUtils\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\n\nexport class JavaByteMarshaller extends NullableMarshaller<JavaByte, number, ErraiObject | number, JavaByte> {\n  public notNullMarshall(input: JavaByte, ctx: MarshallingContext): number {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | number, ctx: UnmarshallingContext): JavaByte {\n    const valueFromJson = instanceOfNumber(input) ? input : NumValBasedErraiObject.from(input).numVal;\n    if (!JavaByteMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid byte value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaByte(`${valueFromJson}`);\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    if (!instanceOfNumber(valueFromJson)) {\n      return false;\n    }\n\n    return NumberUtils.isIntegerString(`${valueFromJson}`);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaCollectionMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaCollection } from \"../../java-wrappers/JavaCollection\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { Portable } from \"../Portable\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { GenericsTypeMarshallingUtils } from \"./util/GenericsTypeMarshallingUtils\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { isArray } from \"../../util/TypeUtils\";\nimport { JavaArrayList, JavaHashSet } from \"../../java-wrappers\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { MarshallerProvider } from \"../MarshallerProvider\";\n\nabstract class JavaCollectionMarshaller<T extends Iterable<Portable<any> | null>> extends NullableMarshaller<\n  JavaCollection<T>,\n  ErraiObject,\n  ErraiObject,\n  T\n> {\n  public notNullMarshall(input: JavaCollection<T>, ctx: MarshallingContext): ErraiObject {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return cachedObject;\n    }\n\n    const elements = input.get();\n\n    const serializedValues = [];\n    for (const element of Array.from(elements)) {\n      serializedValues.push(GenericsTypeMarshallingUtils.marshallGenericsTypeElement(element, ctx));\n    }\n\n    const fqcn = (input as any)._fqcn;\n    const value = serializedValues;\n    const objectId = ctx.incrementAndGetObjectId().toString(10);\n    const resultObject = new ValueBasedErraiObject(fqcn, value, objectId).asErraiObject();\n\n    ctx.cacheObject(input, resultObject);\n\n    return resultObject;\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): T {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return (cachedObject as JavaCollection<T>).get();\n    }\n\n    const collection = ValueBasedErraiObject.from(input).value;\n    if (!JavaCollectionMarshaller.isValid(collection)) {\n      throw new Error(`Invalid collection value ${collection}. Can't unmarshall json ${input}`);\n    }\n\n    const unmarshalledValues = [];\n    for (const element of Array.from(collection)) {\n      unmarshalledValues.push(MarshallerProvider.getForObject(element).unmarshall(element, ctx));\n    }\n\n    const javaCollection = this.fromArray(unmarshalledValues);\n    ctx.cacheObject(input, javaCollection);\n\n    return javaCollection.get();\n  }\n\n  protected abstract fromArray(values: Array<Portable<any>>): JavaCollection<T>;\n\n  private static isValid(input: any): boolean {\n    if (input === null || input === undefined) {\n      return false;\n    }\n\n    // inside the json, all collections are represented as an array\n    return isArray(input);\n  }\n}\n\nexport class JavaArrayListMarshaller extends JavaCollectionMarshaller<Array<Portable<any> | null>> {\n  protected fromArray(values: Array<Portable<any>>): JavaArrayList<Portable<any>> {\n    return new JavaArrayList(values);\n  }\n}\n\nexport class JavaHashSetMarshaller extends JavaCollectionMarshaller<Set<Portable<any> | null>> {\n  protected fromArray(values: Array<Portable<any>>): JavaHashSet<Portable<any>> {\n    return new JavaHashSet(new Set(values));\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaDateMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaDate } from \"../../java-wrappers/JavaDate\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { isString } from \"../../util/TypeUtils\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\n\nexport class JavaDateMarshaller extends NullableMarshaller<JavaDate, ErraiObject, ErraiObject, Date> {\n  public notNullMarshall(input: JavaDate, ctx: MarshallingContext): ErraiObject {\n    return new ValueBasedErraiObject((input as any)._fqcn, `${input.get().getTime()}`).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): Date {\n    const valueFromJson = ValueBasedErraiObject.from(input).value;\n    if (!JavaDateMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid date value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    const asNumber = Number.parseInt(valueFromJson, 10);\n    return new Date(asNumber);\n  }\n\n  private static isValid(input: any) {\n    if (!input) {\n      return false;\n    }\n\n    if (!isString(input)) {\n      return false;\n    }\n\n    return NumberUtils.isNonNegativeIntegerString(input);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaDoubleMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaDouble } from \"../../java-wrappers/JavaDouble\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { instanceOfNumber } from \"../../util/TypeUtils\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\n\nexport class JavaDoubleMarshaller extends NullableMarshaller<JavaDouble, number, ErraiObject | number, JavaDouble> {\n  public notNullMarshall(input: JavaDouble, ctx: MarshallingContext): number {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | number, ctx: UnmarshallingContext): JavaDouble {\n    if (instanceOfNumber(input)) {\n      return new JavaDouble(`${input}`);\n    }\n\n    const valueFromJson = NumValBasedErraiObject.from(input).numVal;\n    if (!JavaDoubleMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid double value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaDouble(`${valueFromJson}`);\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    return instanceOfNumber(valueFromJson);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaEnumMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaEnum } from \"../../java-wrappers\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { EnumStringValueBasedErraiObject } from \"../model/EnumStringValueBasedErraiObject\";\n\nexport class JavaEnumMarshaller<T extends JavaEnum<T>> extends NullableMarshaller<\n  JavaEnum<T>,\n  ErraiObject,\n  ErraiObject,\n  JavaEnum<T>\n> {\n  public notNullMarshall(input: JavaEnum<T>, ctx: MarshallingContext): ErraiObject {\n    return new EnumStringValueBasedErraiObject((input as any)._fqcn, input.name).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): JavaEnum<T> {\n    const valueObject = EnumStringValueBasedErraiObject.from(input);\n    const factory = ctx.getFactory(valueObject.encodedType);\n\n    // the factory method for enums receives the enum name and returns the appropriate enum value\n    return (factory as any)(valueObject.enumValueName);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaFloatMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaFloat } from \"../../java-wrappers/JavaFloat\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { instanceOfNumber } from \"../../util/TypeUtils\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\n\nexport class JavaFloatMarshaller extends NullableMarshaller<JavaFloat, number, ErraiObject | number, JavaFloat> {\n  public notNullMarshall(input: JavaFloat, ctx: MarshallingContext): number {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | number, ctx: UnmarshallingContext): JavaFloat {\n    if (instanceOfNumber(input)) {\n      return new JavaFloat(`${input}`);\n    }\n\n    const valueFromJson = NumValBasedErraiObject.from(input).numVal;\n    if (!JavaFloatMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid float value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaFloat(`${valueFromJson}`);\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    return instanceOfNumber(valueFromJson);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaHashMapMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { ErraiObjectConstants } from \"../model/ErraiObjectConstants\";\nimport { GenericsTypeMarshallingUtils } from \"./util/GenericsTypeMarshallingUtils\";\nimport { JavaHashMap } from \"../../java-wrappers/JavaHashMap\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { isString } from \"../../util/TypeUtils\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { MarshallerProvider } from \"../MarshallerProvider\";\n\nexport class JavaHashMapMarshaller<T, U> extends NullableMarshaller<\n  JavaHashMap<T | undefined, U | undefined>,\n  ErraiObject,\n  ErraiObject,\n  Map<T | undefined, U | undefined>\n> {\n  public notNullMarshall(input: JavaHashMap<T, U>, ctx: MarshallingContext): ErraiObject {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return cachedObject;\n    }\n\n    const marshalledEntriesMap = this.marshallEntries(input.get().entries(), ctx);\n\n    const fqcn = (input as any)._fqcn;\n    const value = marshalledEntriesMap;\n    const objectId = ctx.incrementAndGetObjectId().toString(10);\n    const result = new ValueBasedErraiObject(fqcn, value, objectId).asErraiObject();\n\n    ctx.cacheObject(input, result);\n\n    return result;\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): Map<T | undefined, U | undefined> {\n    const cachedObject = ctx.getCached(input);\n    if (cachedObject) {\n      return (cachedObject as JavaHashMap<T | undefined, U | undefined>).get();\n    }\n\n    const mapObj = ValueBasedErraiObject.from(input).value;\n    if (!mapObj) {\n      throw new Error(`Invalid Map value ${mapObj}. Can't unmarshall json ${input}`);\n    }\n\n    const map = this.unmarshallEntries(mapObj, ctx);\n\n    ctx.cacheObject(input, map);\n\n    return map.get();\n  }\n\n  private marshallEntries(entries: IterableIterator<[T, U]>, ctx: MarshallingContext) {\n    return Array.from(entries)\n      .map(([key, value]) => this.marshallEntry(key, value, ctx))\n      .reduce((acc, cur) => ({ ...acc, ...cur }), {});\n  }\n\n  private marshallEntry(key: T, value: U, ctx: MarshallingContext) {\n    const marshalledKey = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(key, ctx);\n    const marshalledValue = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(value, ctx);\n\n    if (marshalledKey === null) {\n      return { [ErraiObjectConstants.NULL]: marshalledValue };\n    }\n\n    if (!isString(marshalledKey)) {\n      // need to prefix the key in order to tell errai-marshalling that the key is not a native string\n      return { [ErraiObjectConstants.JSON + JSON.stringify(marshalledKey)]: marshalledValue };\n    }\n\n    return { [`${marshalledKey}`]: marshalledValue };\n  }\n\n  private unmarshallEntries(map: any, ctx: UnmarshallingContext): JavaHashMap<T | undefined, U | undefined> {\n    const unmarshalledMap = new Map<T | undefined, U | undefined>();\n\n    Object.keys(map).forEach(key => {\n      const unmarshalledKey = this.unmarshallKey(key, ctx);\n\n      const unmarshalledValue = MarshallerProvider.getForObject(map[key]).unmarshall(map[key], ctx);\n\n      unmarshalledMap.set(unmarshalledKey, unmarshalledValue);\n    });\n\n    return new JavaHashMap(unmarshalledMap);\n  }\n\n  private unmarshallKey(key: string, ctx: UnmarshallingContext): T | undefined {\n    if (!key) {\n      throw new Error(`Invalid Map's key ${key}. Can't unmarshall json!`);\n    }\n\n    if (key === ErraiObjectConstants.NULL) {\n      return undefined;\n    }\n\n    if (key.startsWith(ErraiObjectConstants.JSON)) {\n      // this prefix indicates that the key is not a native string, it is a json object serialized to string\n      const keyJson = JSON.parse(key.replace(ErraiObjectConstants.JSON, \"\"));\n      return MarshallerProvider.getForObject(keyJson).unmarshall(keyJson, ctx);\n    }\n\n    // the map key has type string\n    return key as any;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaIntegerMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { JavaInteger } from \"../../java-wrappers/JavaInteger\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { instanceOfNumber } from \"../../util/TypeUtils\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\n\nexport class JavaIntegerMarshaller extends NullableMarshaller<JavaInteger, number, ErraiObject | number, JavaInteger> {\n  public notNullMarshall(input: JavaInteger, ctx: MarshallingContext): number {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | number, ctx: UnmarshallingContext): JavaInteger {\n    const valueFromJson = instanceOfNumber(input) ? input : NumValBasedErraiObject.from(input).numVal;\n    if (!JavaIntegerMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid integer value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaInteger(`${valueFromJson}`);\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    if (!instanceOfNumber(valueFromJson)) {\n      return false;\n    }\n\n    return NumberUtils.isIntegerString(`${valueFromJson}`);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaLongMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaLong } from \"../../java-wrappers/JavaLong\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\n\nexport class JavaLongMarshaller extends NullableMarshaller<JavaLong, ErraiObject, ErraiObject, JavaLong> {\n  public notNullMarshall(input: JavaLong, ctx: MarshallingContext): ErraiObject {\n    const asString = `${input.get().toString(10)}`;\n    return new NumValBasedErraiObject((input as any)._fqcn, asString).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): JavaLong {\n    const valueFromJson = NumValBasedErraiObject.from(input).numVal as string;\n\n    if (!JavaLongMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid long value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaLong(valueFromJson);\n  }\n\n  private static isValid(jsonValue: string) {\n    if (jsonValue === null || jsonValue === undefined) {\n      return false;\n    }\n\n    return NumberUtils.isIntegerString(jsonValue);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaOptionalMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { JavaOptional } from \"../../java-wrappers/JavaOptional\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { GenericsTypeMarshallingUtils } from \"./util/GenericsTypeMarshallingUtils\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../model/ValueBasedErraiObject\";\nimport { MarshallerProvider } from \"../MarshallerProvider\";\n\nexport class JavaOptionalMarshaller<T> extends NullableMarshaller<\n  JavaOptional<T | undefined>,\n  ErraiObject,\n  ErraiObject,\n  JavaOptional<T | undefined>\n> {\n  public notNullMarshall(input: JavaOptional<T | undefined>, ctx: MarshallingContext): ErraiObject {\n    const innerValue = this.retrieveOptionalInnerValue(input, ctx);\n    return new ValueBasedErraiObject((input as any)._fqcn, innerValue).asErraiObject();\n  }\n\n  public notNullUnmarshall(input: ErraiObject, ctx: UnmarshallingContext): JavaOptional<T | undefined> {\n    const value = ValueBasedErraiObject.from(input).value;\n    if (value === null || value === undefined) {\n      return new JavaOptional(undefined);\n    }\n\n    const unmarshalledValue = MarshallerProvider.getForObject(value).unmarshall(value, ctx);\n\n    return new JavaOptional(unmarshalledValue);\n  }\n\n  private retrieveOptionalInnerValue(input: JavaOptional<T | undefined>, ctx: MarshallingContext) {\n    if (!input.isPresent()) {\n      return null;\n    }\n\n    return GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input.get(), ctx);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaShortMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaShort } from \"../../java-wrappers/JavaShort\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { instanceOfNumber } from \"../../util/TypeUtils\";\nimport { ErraiObject } from \"../model/ErraiObject\";\nimport { NumValBasedErraiObject } from \"../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../util/NumberUtils\";\n\nexport class JavaShortMarshaller extends NullableMarshaller<JavaShort, number, ErraiObject | number, JavaShort> {\n  public notNullMarshall(input: JavaShort, ctx: MarshallingContext): number {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: ErraiObject | number, ctx: UnmarshallingContext): JavaShort {\n    const valueFromJson = instanceOfNumber(input) ? input : NumValBasedErraiObject.from(input).numVal;\n    if (!JavaShortMarshaller.isValid(valueFromJson)) {\n      throw new Error(`Invalid short value ${valueFromJson}. Can't unmarshall json ${input}`);\n    }\n\n    return new JavaShort(`${valueFromJson}`);\n  }\n\n  private static isValid(valueFromJson: any): boolean {\n    if (valueFromJson === null || valueFromJson === undefined) {\n      return false;\n    }\n\n    if (!instanceOfNumber(valueFromJson)) {\n      return false;\n    }\n\n    return NumberUtils.isIntegerString(`${valueFromJson}`);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/JavaStringMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaString } from \"../../java-wrappers/JavaString\";\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { NullableMarshaller } from \"./NullableMarshaller\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\nimport { instanceOfString } from \"../../util/TypeUtils\";\n\nexport class JavaStringMarshaller extends NullableMarshaller<JavaString, string, string | JavaString, string> {\n  public notNullMarshall(input: JavaString, ctx: MarshallingContext): string {\n    return input.get();\n  }\n\n  public notNullUnmarshall(input: string | JavaString, ctx: UnmarshallingContext): string {\n    if (instanceOfString(input)) {\n      return input;\n    }\n\n    return input.get();\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/NullableMarshaller.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../MarshallingContext\";\nimport { Marshaller } from \"../Marshaller\";\nimport { Portable } from \"../Portable\";\nimport { UnmarshallingContext } from \"../UnmarshallingContext\";\n\nexport abstract class NullableMarshaller<T extends Portable<T>, U, V, X> implements Marshaller<T, U, V, X> {\n  public marshall(input: T, ctx: MarshallingContext): U | null {\n    if (input === null || input === undefined) {\n      return null;\n    }\n\n    return this.notNullMarshall(input, ctx);\n  }\n\n  public unmarshall(input: V | undefined, ctx: UnmarshallingContext): X | undefined {\n    if (input === null || input === undefined) {\n      return undefined;\n    }\n\n    return this.notNullUnmarshall(input, ctx);\n  }\n\n  public abstract notNullMarshall(input: T, ctx: MarshallingContext): U;\n\n  public abstract notNullUnmarshall(input: V, ctx: UnmarshallingContext): X;\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/DefaultMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaEnum,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../../java-wrappers\";\nimport { DefaultMarshaller } from \"../DefaultMarshaller\";\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { MarshallerProvider } from \"../../MarshallerProvider\";\nimport { Portable } from \"../../Portable\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { EnumStringValueBasedErraiObject } from \"../../model/EnumStringValueBasedErraiObject\";\n\nbeforeEach(() => {\n  MarshallerProvider.initialize();\n});\n\ndescribe(\"marshall\", () => {\n  const objectId = ErraiObjectConstants.OBJECT_ID;\n  const encodedType = ErraiObjectConstants.ENCODED_TYPE;\n  const value = ErraiObjectConstants.VALUE;\n  const enumStringValue = ErraiObjectConstants.ENUM_STRING_VALUE;\n\n  describe(\"pojo marshalling\", () => {\n    test(\"custom pojo, should return serialize it normally\", () => {\n      const input = new User({\n        name: \"my name\",\n        sendSpam: false,\n        age: new JavaInteger(\"10\"),\n        address: new Address({\n          line1: \"address line 1\",\n          type: AddressType.WORK\n        }),\n        bestFriend: new User({\n          name: \"my name 2\",\n          sendSpam: true,\n          address: new Address({\n            line1: \"address 2 line 1\"\n          })\n        })\n      });\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: \"com.app.my.Pojo\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        name: \"my name\",\n        age: 10,\n        sendSpam: false,\n        address: {\n          [encodedType]: \"com.app.my.Address\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          line1: \"address line 1\",\n          type: new EnumStringValueBasedErraiObject(\"com.app.my.AddressType\", AddressType.WORK.name).asErraiObject()\n        },\n        bestFriend: {\n          [encodedType]: \"com.app.my.Pojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          name: \"my name 2\",\n          sendSpam: true,\n          age: null,\n          address: {\n            [encodedType]: \"com.app.my.Address\",\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n            line1: \"address 2 line 1\",\n            type: null\n          },\n          bestFriend: null\n        }\n      });\n    });\n\n    test(\"custom pojo with function, should serialize it normally and ignore the function\", () => {\n      const input = {\n        _fqcn: \"com.app.my.Pojo\",\n        foo: \"bar\",\n        doSomething: () => {\n          return \"hey!\";\n        }\n      };\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: \"com.app.my.Pojo\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        foo: \"bar\"\n      });\n    });\n\n    test(\"custom pojo without fqcn, should throw error\", () => {\n      const input = {\n        foo: \"bar\"\n      };\n\n      const context = new MarshallingContext();\n      const marshaller = new DefaultMarshaller();\n\n      expect(() => marshaller.marshall(input, context)).toThrowError();\n    });\n\n    test(\"custom pojo with a pojo without fqcn as property, should throw error\", () => {\n      const input = {\n        _fqcn: \"com.app.my.Pojo\",\n        name: \"my name\",\n        childPojo: {\n          foo: \"bar\"\n        }\n      };\n\n      const context = new MarshallingContext();\n      const marshaller = new DefaultMarshaller();\n\n      expect(() => marshaller.marshall(input, context)).toThrowError();\n    });\n\n    test(\"custom pojo with java types, should serialize it normally\", () => {\n      const date = new Date();\n\n      const input = new JavaTypesPojo({\n        bigDecimal: new JavaBigDecimal(\"1.1\"),\n        bigInteger: new JavaBigInteger(\"2\"),\n        boolean: false,\n        byte: new JavaByte(\"3\"),\n        double: new JavaDouble(\"1.2\"),\n        float: new JavaFloat(\"1.3\"),\n        integer: new JavaInteger(\"4\"),\n        long: new JavaLong(\"5\"),\n        short: new JavaShort(\"6\"),\n        string: \"str\",\n        date: new Date(date),\n        optional: new JavaOptional<string>(\"optstr\")\n      });\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: \"com.app.my.Pojo\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        bigDecimal: {\n          [encodedType]: JavaType.BIG_DECIMAL,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: \"1.1\"\n        },\n        bigInteger: {\n          [encodedType]: JavaType.BIG_INTEGER,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: \"2\"\n        },\n        boolean: false,\n        byte: 3,\n        double: 1.2,\n        float: 1.3,\n        integer: 4,\n        long: new NumValBasedErraiObject(JavaType.LONG, \"5\").asErraiObject(),\n        short: 6,\n        string: \"str\",\n        date: new ValueBasedErraiObject(JavaType.DATE, `${date.getTime()}`).asErraiObject(),\n        optional: new ValueBasedErraiObject(JavaType.OPTIONAL, \"optstr\").asErraiObject()\n      });\n    });\n\n    test(\"custom pojo with collection type, should serialize it normally\", () => {\n      const input = {\n        _fqcn: \"com.app.my.Pojo\",\n        list: [\"1\", \"2\", \"3\"],\n        set: new Set([\"3\", \"2\", \"1\"]),\n        map: new Map([[\"k1\", \"v1\"], [\"k2\", \"v2\"]])\n      };\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: \"com.app.my.Pojo\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        list: {\n          [encodedType]: JavaType.ARRAY_LIST,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: [\"1\", \"2\", \"3\"]\n        },\n        set: {\n          [encodedType]: JavaType.HASH_SET,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: [\"3\", \"2\", \"1\"]\n        },\n        map: {\n          [encodedType]: JavaType.HASH_MAP,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: {\n            k1: \"v1\",\n            k2: \"v2\"\n          }\n        }\n      });\n    });\n\n    test(\"custom pojo with enum type, should serialize it normally\", () => {\n      const input = {\n        _fqcn: \"com.app.my.Pojo\",\n        str: \"foo\",\n        enum: AddressType.HOME\n      };\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: \"com.app.my.Pojo\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        str: \"foo\",\n        enum: new EnumStringValueBasedErraiObject(\"com.app.my.AddressType\", AddressType.HOME.name).asErraiObject()\n      });\n    });\n  });\n\n  describe(\"object caching\", () => {\n    test(\"custom pojo with repeated pojo objects, should cache the object and don't repeat data\", () => {\n      // === scenario\n\n      // repeatedNode appears two times in the hierarchy, all other nodes are unique\n      const repeatedNode = new Node({ data: \"repeatedNode\" });\n      const input = new Node({\n        data: \"root\",\n        right: new Node({ data: \"rightNode\", left: repeatedNode, right: new Node({ data: \"rightLeaf\" }) }),\n        left: repeatedNode\n      });\n\n      // === test\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      // === assertion\n      // expects all nodes to contain their data and a unique objectId, except for the deepest left node.\n      // the deepest left node should contain only its encodedType and objectId, which needs to be the same as the root's left node\n\n      const rootObjId = output![objectId];\n      expect(output![encodedType]).toEqual(\"com.app.my.Node\");\n      expect((output as any).data).toEqual(\"root\");\n\n      const firstLeftLeaf = (output as any).left;\n      const firstLeftLeafObjId = firstLeftLeaf[objectId];\n      expect(firstLeftLeaf.data).toEqual(\"repeatedNode\");\n\n      const rightNodeOut = (output as any).right;\n      const rightNodeObjId = rightNodeOut[objectId];\n      expect(rightNodeOut.data).toEqual(\"rightNode\");\n\n      const repeatedLeftLeaf = (rightNodeOut as any).left;\n      const repeatedLeftLeafObjId = repeatedLeftLeaf[objectId];\n      expect(repeatedLeftLeaf.data).toBeUndefined();\n\n      const rightLeafOut = (rightNodeOut as any).right;\n      const rightLeafObjId = rightLeafOut[objectId];\n      expect(rightLeafOut.data).toEqual(\"rightLeaf\");\n\n      expect(firstLeftLeafObjId).toEqual(repeatedLeftLeafObjId); // reuse same id\n\n      const allObjIds = [rootObjId, firstLeftLeafObjId, rightNodeObjId, repeatedLeftLeafObjId, rightLeafObjId];\n      expect(allObjIds.forEach(id => expect(id).toMatch(NumberUtils.nonNegativeIntegerRegex)));\n\n      // all ids unique (excluding the reused one)\n      const uniqueObjIds = new Set(allObjIds);\n      expect(uniqueObjIds).toStrictEqual(new Set([rootObjId, firstLeftLeafObjId, rightNodeObjId, rightLeafObjId]));\n    });\n\n    test(\"custom pojo with repeated JavaBigDecimal objects, should not cache it and not reuse data\", () => {\n      const repeatedValue = new JavaBigDecimal(\"1.1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaBigDecimal(\"1.2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      // === test\n      const context = new MarshallingContext();\n      const output = new DefaultMarshaller().marshall(input, context);\n\n      // === assertions\n\n      const rootObjId = output![objectId];\n      const rootDataObjId = (output as any).data[objectId];\n      expect((output as any).data[value]).toEqual(\"1.1\");\n\n      const leftObjId = (output as any).left[objectId];\n      const leftDataObjId = (output as any).left.data[objectId];\n      expect((output as any).left.data[value]).toEqual(\"1.2\");\n\n      const rightObjId = (output as any).right[objectId];\n      const rightDataObjId = (output as any).right.data[objectId];\n      expect((output as any).right.data[value]).toEqual(\"1.1\");\n\n      const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n      allObjectIds.forEach(id => expect(id).toBeDefined());\n\n      // create new object ids even for same obj references\n      expect(new Set(allObjectIds)).toStrictEqual(new Set(allObjectIds));\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaBigInteger objects, should not cache it\", () => {\n      const repeatedValue = new JavaBigInteger(\"1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaBigInteger(\"2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      // === test\n      const context = new MarshallingContext();\n      const output = new DefaultMarshaller().marshall(input, context);\n\n      // === assertions\n\n      const rootObjId = output![objectId];\n      const rootDataObjId = (output as any).data[objectId];\n      expect((output as any).data[value]).toEqual(\"1\");\n\n      const leftObjId = (output as any).left[objectId];\n      const leftDataObjId = (output as any).left.data[objectId];\n      expect((output as any).left.data[value]).toEqual(\"2\");\n\n      const rightObjId = (output as any).right[objectId];\n      const rightDataObjId = (output as any).right.data[objectId];\n      expect((output as any).right.data[value]).toEqual(\"1\");\n\n      const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n      allObjectIds.forEach(id => expect(id).toBeDefined());\n\n      // create new object ids even for same obj references\n      expect(new Set(allObjectIds)).toStrictEqual(new Set(allObjectIds));\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaBoolean objects, should not cache it\", () => {\n      const repeatedValue = new JavaBoolean(false);\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaBoolean(true) }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Boolean types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaByte objects, should not cache it\", () => {\n      const repeatedValue = new JavaByte(\"1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaByte(\"2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Byte types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated array objects, should cache the object and don't repeat data\", () => {\n      const repeatedValue = [\"a\", \"b\", \"c\"];\n\n      const arrayInput = new Node({\n        data: repeatedValue,\n        left: new Node({ data: [\"d\", \"e\"] }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const javaArrayListInput = new Node({\n        data: new JavaArrayList(repeatedValue),\n        left: new Node({ data: new JavaArrayList([\"d\", \"e\"]) }),\n        right: new Node({ data: new JavaArrayList(repeatedValue) })\n      });\n\n      [arrayInput, javaArrayListInput].forEach(input => {\n        const context = new MarshallingContext();\n        const output = new DefaultMarshaller().marshall(input, context);\n\n        // === assertions\n\n        const rootObjId = output![objectId];\n        const rootDataObjId = (output as any).data[objectId];\n        expect((output as any).data).toStrictEqual({\n          [encodedType]: JavaType.ARRAY_LIST,\n          [objectId]: expect.anything(),\n          [value]: [\"a\", \"b\", \"c\"]\n        });\n\n        const leftObjId = (output as any).left[objectId];\n        const leftDataObjId = (output as any).left.data[objectId];\n        expect((output as any).left.data).toStrictEqual({\n          [encodedType]: JavaType.ARRAY_LIST,\n          [objectId]: expect.anything(),\n          [value]: [\"d\", \"e\"]\n        });\n\n        const rightObjId = (output as any).right[objectId];\n        const rightDataObjId = (output as any).right.data[objectId];\n        expect((output as any).right.data).toStrictEqual({\n          [encodedType]: JavaType.ARRAY_LIST,\n          [objectId]: expect.anything()\n          // missing value since it is cached\n        });\n\n        const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n        allObjectIds.forEach(id => expect(id).toBeDefined());\n\n        // all ids are unique except for the right data id, that was reused\n        expect(new Set(allObjectIds)).toStrictEqual(\n          new Set([rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId])\n        );\n\n        // do not cache repeated object\n        const cached = context.getCached(repeatedValue);\n        expect(ValueBasedErraiObject.from(cached!)).toStrictEqual(\n          new ValueBasedErraiObject(JavaType.ARRAY_LIST, undefined, rootDataObjId)\n        );\n      });\n    });\n\n    test(\"custom pojo with repeated set objects, should cache the object and don't repeat data\", () => {\n      const repeatedValue = new Set([\"a\", \"b\", \"c\"]);\n\n      const setInput = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new Set([\"d\", \"e\"]) }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const javaHashSetInput = new Node({\n        data: new JavaHashSet(repeatedValue),\n        left: new Node({ data: new JavaHashSet(new Set([\"d\", \"e\"])) }),\n        right: new Node({ data: new JavaHashSet(repeatedValue) })\n      });\n\n      [setInput, javaHashSetInput].forEach(input => {\n        const context = new MarshallingContext();\n        const output = new DefaultMarshaller().marshall(input, context);\n\n        // === assertions\n\n        const rootObjId = output![objectId];\n        const rootDataObjId = (output as any).data[objectId];\n        expect((output as any).data).toStrictEqual({\n          [encodedType]: JavaType.HASH_SET,\n          [objectId]: expect.anything(),\n          [value]: [\"a\", \"b\", \"c\"]\n        });\n\n        const leftObjId = (output as any).left[objectId];\n        const leftDataObjId = (output as any).left.data[objectId];\n        expect((output as any).left.data).toStrictEqual({\n          [encodedType]: JavaType.HASH_SET,\n          [objectId]: expect.anything(),\n          [value]: [\"d\", \"e\"]\n        });\n\n        const rightObjId = (output as any).right[objectId];\n        const rightDataObjId = (output as any).right.data[objectId];\n        expect((output as any).right.data).toStrictEqual({\n          [encodedType]: JavaType.HASH_SET,\n          [objectId]: expect.anything()\n          // missing value since it is cached\n        });\n\n        const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n        allObjectIds.forEach(id => expect(id).toBeDefined());\n\n        // all ids are unique except for the right data id, that was reused\n        expect(new Set(allObjectIds)).toStrictEqual(\n          new Set([rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId])\n        );\n\n        // do not cache repeated object\n        const cached = context.getCached(repeatedValue);\n        expect(ValueBasedErraiObject.from(cached!)).toStrictEqual(\n          new ValueBasedErraiObject(JavaType.HASH_SET, undefined, rootDataObjId)\n        );\n      });\n    });\n\n    test(\"custom pojo with repeated map objects, should cache the object and don't repeat data\", () => {\n      const repeatedMap = new Map([[\"k1\", \"v1\"]]);\n\n      const mapInput = new Node({\n        data: repeatedMap,\n        left: new Node({ data: new Map([[\"k2\", \"v2\"]]) }),\n        right: new Node({ data: repeatedMap })\n      });\n\n      const javaHashMapInput = new Node({\n        data: new JavaHashMap(repeatedMap),\n        left: new Node({ data: new JavaHashMap(new Map([[\"k2\", \"v2\"]])) }),\n        right: new Node({ data: new JavaHashMap(repeatedMap) })\n      });\n\n      [mapInput, javaHashMapInput].forEach(input => {\n        const context = new MarshallingContext();\n        const output = new DefaultMarshaller().marshall(input, context);\n\n        // === assertions\n\n        const rootObjId = output![objectId];\n        const rootDataObjId = (output as any).data[objectId];\n        expect((output as any).data).toStrictEqual({\n          [encodedType]: JavaType.HASH_MAP,\n          [objectId]: expect.anything(),\n          [value]: {\n            k1: \"v1\"\n          }\n        });\n\n        const leftObjId = (output as any).left[objectId];\n        const leftDataObjId = (output as any).left.data[objectId];\n        expect((output as any).left.data).toStrictEqual({\n          [encodedType]: JavaType.HASH_MAP,\n          [objectId]: expect.anything(),\n          [value]: {\n            k2: \"v2\"\n          }\n        });\n\n        const rightObjId = (output as any).right[objectId];\n        const rightDataObjId = (output as any).right.data[objectId];\n        expect((output as any).right.data).toStrictEqual({\n          [encodedType]: JavaType.HASH_MAP,\n          [objectId]: expect.anything()\n          // missing value since it is cached\n        });\n\n        const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n        allObjectIds.forEach(id => expect(id).toBeDefined());\n\n        // all ids are unique except for the right data id, that was reused\n        expect(new Set(allObjectIds)).toStrictEqual(\n          new Set([rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId])\n        );\n\n        // do not cache repeated object's data\n        const cached = context.getCached(repeatedMap);\n        expect(ValueBasedErraiObject.from(cached!)).toStrictEqual(\n          new ValueBasedErraiObject(JavaType.HASH_MAP, undefined, rootDataObjId)\n        );\n      });\n    });\n\n    test(\"custom pojo with repeated JavaDouble objects, should not cache it\", () => {\n      const repeatedValue = new JavaDouble(\"1.1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaDouble(\"1.2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Double types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaFloat objects, should not cache it\", () => {\n      const repeatedValue = new JavaFloat(\"1.1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaFloat(\"1.2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Float types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaInteger objects, should not cache it\", () => {\n      const repeatedValue = new JavaInteger(\"1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaInteger(\"2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Integer types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaLong objects, should not cache it\", () => {\n      const repeatedValue = new JavaLong(\"1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaLong(\"2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      // === test\n      const context = new MarshallingContext();\n      const output = new DefaultMarshaller().marshall(input, context);\n\n      // === assertions\n\n      const rootObjId = output![objectId];\n      const rootData = NumValBasedErraiObject.from((output as any).data);\n      expect(rootData.numVal).toEqual(\"1\");\n\n      const leftObj = NumValBasedErraiObject.from((output as any).left);\n      const leftData = NumValBasedErraiObject.from((output as any).left.data);\n      expect(leftData.numVal).toEqual(\"2\");\n\n      const rightObj = NumValBasedErraiObject.from((output as any).right);\n      const rightData = NumValBasedErraiObject.from((output as any).right.data);\n      expect(rightData.numVal).toEqual(\"1\");\n\n      const allObjectIds = [rootObjId, rootData.objId, leftObj.objId, leftData.objId, rightObj.objId, rightData.objId];\n\n      allObjectIds.forEach(id => expect(id).toBeDefined());\n\n      // create new object ids even for same obj references\n      expect(new Set(allObjectIds)).toStrictEqual(new Set(allObjectIds));\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaShort objects, should not cache it\", () => {\n      const repeatedValue = new JavaShort(\"1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaShort(\"2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because Short types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaString objects, should not cache it\", () => {\n      const repeatedValue = new JavaString(\"str1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaString(\"str2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      const context = new MarshallingContext();\n      new DefaultMarshaller().marshall(input, context);\n\n      // in this test we're not interested in the output structure, because String types are not wrapped into an\n      // ErraiObject, so, it doesn't even have an objectId assigned.\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaOptional objects, should not cache it\", () => {\n      const repeatedValue = new JavaOptional<string>(\"str1\");\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: new JavaOptional<string>(\"str2\") }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      // === test\n      const context = new MarshallingContext();\n      const output = new DefaultMarshaller().marshall(input, context);\n\n      // === assertions\n\n      const rootObjId = output![objectId];\n      const rootDataObjId = (output as any).data[objectId];\n      expect((output as any).data[value]).toStrictEqual(\"str1\");\n\n      const leftObjId = (output as any).left[objectId];\n      const leftDataObjId = (output as any).left.data[objectId];\n      expect((output as any).left.data[value]).toEqual(\"str2\");\n\n      const rightObjId = (output as any).right[objectId];\n      const rightDataObjId = (output as any).right.data[objectId];\n      expect((output as any).right.data[value]).toEqual(\"str1\");\n\n      const allObjectIds = [rootObjId, rootDataObjId, leftObjId, leftDataObjId, rightObjId, rightDataObjId];\n\n      allObjectIds.forEach(id => expect(id).toBeDefined());\n\n      // optional objects always use the same object id (its value doesn't matter)\n      expect(new Set(allObjectIds)).toStrictEqual(new Set([rootObjId, rootDataObjId, leftObjId, rightObjId]));\n      expect(rootDataObjId).toEqual(leftDataObjId);\n      expect(rootDataObjId).toEqual(rightDataObjId);\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n\n    test(\"custom pojo with repeated JavaEnum objects, should not cache it\", () => {\n      const repeatedValue = AddressType.WORK;\n\n      const input = new Node({\n        data: repeatedValue,\n        left: new Node({ data: AddressType.HOME }),\n        right: new Node({ data: repeatedValue })\n      });\n\n      // === test\n      const context = new MarshallingContext();\n      const output = new DefaultMarshaller().marshall(input, context);\n\n      // === assertions\n\n      const rootObjId = output![objectId];\n      const rootDataObjId = (output as any).data[objectId];\n      expect((output as any).data[enumStringValue]).toStrictEqual(AddressType.WORK.name);\n\n      const leftObjId = (output as any).left[objectId];\n      const leftDataObjId = (output as any).left.data[objectId];\n      expect((output as any).left.data[enumStringValue]).toEqual(AddressType.HOME.name);\n\n      const rightObjId = (output as any).right[objectId];\n      const rightDataObjId = (output as any).right.data[objectId];\n      expect((output as any).right.data[enumStringValue]).toEqual(AddressType.WORK.name);\n\n      // every Node object has an unique id\n      expect(new Set([rootObjId, leftObjId, rightObjId])).toStrictEqual(new Set([rootObjId, leftObjId, rightObjId]));\n\n      // every enum field doesn't have an object id defined\n      [rootDataObjId, rightDataObjId, leftDataObjId].forEach(id => expect(id).toBeUndefined());\n\n      // do not cache repeated object\n      expect(context.getCached(repeatedValue)).toBeUndefined();\n    });\n  });\n\n  describe(\"non-pojo root types\", () => {\n    test(\"root null object, should serialize to null\", () => {\n      const input = null as any;\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toBeNull();\n    });\n\n    test(\"root undefined object, should serialize to null\", () => {\n      const input = undefined as any;\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toBeNull();\n    });\n\n    test(\"root JavaBigDecimal object, should serialize it normally\", () => {\n      const input = new JavaBigDecimal(\"1.2\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: JavaType.BIG_DECIMAL,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: \"1.2\"\n      });\n    });\n\n    test(\"root JavaBigInteger object, should serialize it normally\", () => {\n      const input = new JavaBigInteger(\"1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual({\n        [encodedType]: JavaType.BIG_INTEGER,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: \"1\"\n      });\n    });\n\n    test(\"root JavaByte object, should serialize it to byte raw value\", () => {\n      const input = new JavaByte(\"1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toEqual(1);\n    });\n\n    test(\"root JavaDouble object, should serialize it to double raw value\", () => {\n      const input = new JavaDouble(\"1.1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toEqual(1.1);\n    });\n\n    test(\"root JavaFloat object, should serialize it to float raw value\", () => {\n      const input = new JavaFloat(\"1.1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toEqual(1.1);\n    });\n\n    test(\"root JavaInteger object, should serialize it to integer raw value\", () => {\n      const input = new JavaInteger(\"1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toEqual(1);\n    });\n\n    test(\"root JavaLong object, should serialize it normally\", () => {\n      const input = new JavaLong(\"1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.LONG, \"1\").asErraiObject());\n    });\n\n    test(\"root JavaShort object, should serialize it normally to short raw value\", () => {\n      const input = new JavaShort(\"1\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toEqual(1);\n    });\n\n    test(\"root JavaOptional object, should serialize it normally\", () => {\n      const input = new JavaOptional<string>(\"str\");\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual(new ValueBasedErraiObject(JavaType.OPTIONAL, \"str\").asErraiObject());\n    });\n\n    test(\"root JavaEnum object, should serialize it normally\", () => {\n      const input = AddressType.WORK;\n\n      const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n      expect(output).toStrictEqual(\n        new EnumStringValueBasedErraiObject(AddressType.__fqcn(), AddressType.WORK.name).asErraiObject()\n      );\n    });\n\n    test(\"root string object, should serialize it to string raw value\", () => {\n      const stringInput = \"str\";\n      const javaStringInput = new JavaString(\"str\");\n\n      [stringInput, javaStringInput].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toEqual(\"str\");\n      });\n    });\n\n    test(\"root date object, should serialize it normally\", () => {\n      const date = new Date();\n      const javaDate = new JavaDate(date);\n\n      [date, javaDate].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toStrictEqual(new ValueBasedErraiObject(JavaType.DATE, `${date.getTime()}`).asErraiObject());\n      });\n    });\n\n    test(\"root boolean object, should serialize it to boolean raw value\", () => {\n      const booleanInput = false;\n      const javaBooleanInput = new JavaBoolean(false);\n\n      [booleanInput, javaBooleanInput].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toEqual(false);\n      });\n    });\n\n    test(\"root number object, should throw error\", () => {\n      const input = 125.1;\n\n      const marshaller = new DefaultMarshaller();\n      const ctx = new MarshallingContext();\n\n      expect(() => marshaller.marshall(input, ctx)).toThrowError();\n    });\n\n    test(\"root array object, should serialize it normally\", () => {\n      const arrayInput = [\"1\", \"2\", \"3\"];\n      const javaArrayListInput = new JavaArrayList([\"1\", \"2\", \"3\"]);\n\n      [arrayInput, javaArrayListInput].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toStrictEqual({\n          [encodedType]: JavaType.ARRAY_LIST,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: [\"1\", \"2\", \"3\"]\n        });\n      });\n    });\n\n    test(\"root set object, should serialize it normally\", () => {\n      const setInput = new Set([\"1\", \"2\", \"3\"]);\n      const javaHashSetInput = new JavaHashSet(new Set([\"1\", \"2\", \"3\"]));\n\n      [setInput, javaHashSetInput].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toStrictEqual({\n          [encodedType]: JavaType.HASH_SET,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: [\"1\", \"2\", \"3\"]\n        });\n      });\n    });\n\n    test(\"root map object, should serialize it normally\", () => {\n      const mapInput = new Map([[\"k1\", \"v1\"], [\"k2\", \"v2\"]]);\n      const javaHashMapInput = new JavaHashMap(new Map([[\"k1\", \"v1\"], [\"k2\", \"v2\"]]));\n\n      [mapInput, javaHashMapInput].forEach(input => {\n        const output = new DefaultMarshaller().marshall(input, new MarshallingContext());\n\n        expect(output).toStrictEqual({\n          [encodedType]: JavaType.HASH_MAP,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: {\n            k1: \"v1\",\n            k2: \"v2\"\n          }\n        });\n      });\n    });\n  });\n\n  class Node implements Portable<Node> {\n    private readonly _fqcn = \"com.app.my.Node\";\n\n    public readonly data?: any = undefined;\n    public readonly left?: Node = undefined;\n    public readonly right?: Node = undefined;\n\n    constructor(self: { data?: any; left?: Node; right?: Node }) {\n      Object.assign(this, self);\n    }\n  }\n});\n\ndescribe(\"unmarshall\", () => {\n  describe(\"non-pojo root types\", () => {\n    test(\"root null object, should unmarshall to undefined\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = null as any;\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext()) as any;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toBeUndefined();\n    });\n\n    test(\"root undefined object, should unmarshall to null\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = undefined as any;\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext()) as any;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toBeUndefined();\n    });\n\n    test(\"root JavaBigDecimal object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = new JavaBigDecimal(\"1.1\");\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaBigDecimal(\"1.1\"));\n    });\n\n    test(\"root JavaBigInteger object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = new JavaBigInteger(\"1\");\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaBigInteger(\"1\"));\n    });\n\n    test(\"root JavaByte object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaByte(\"1\"));\n    });\n\n    test(\"root JavaDouble object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1.1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.DOUBLE, input).asErraiObject();\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaDouble(\"1.1\"));\n    });\n\n    test(\"root JavaFloat object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1.1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.FLOAT, input).asErraiObject();\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaFloat(\"1.1\"));\n    });\n\n    test(\"root JavaInteger object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaInteger(\"1\"));\n    });\n\n    test(\"root JavaLong object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = new JavaLong(\"1\");\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaLong(\"1\"));\n    });\n\n    test(\"root JavaShort object, should unmarshall it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaShort(\"1\"));\n    });\n\n    test(\"root JavaOptional object, should serialize it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = new JavaOptional(\"1\");\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional(\"1\"));\n    });\n\n    test(\"root JavaEnum object, should serialize it normally\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = AddressType.WORK;\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const factory = new Map([\n        [\n          \"com.app.my.AddressType\",\n          ((name: string) => {\n            switch (name) {\n              case \"HOME\":\n                return AddressType.HOME;\n              case \"WORK\":\n                return AddressType.WORK;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ]);\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(factory));\n\n      expect(output).toStrictEqual(AddressType.WORK);\n    });\n\n    test(\"root string object, should unmarshall it to native string\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const stringInput = \"foo\";\n      const javaStringInput = new JavaString(\"foo\");\n\n      [stringInput, javaStringInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual(\"foo\");\n      });\n    });\n\n    test(\"root date object, should unmarshall it to native date\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const baseDate = new Date();\n\n      const dateInput = new Date(baseDate);\n      const javaDateInput = new JavaDate(new Date(baseDate));\n\n      [dateInput, javaDateInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual(baseDate);\n      });\n    });\n\n    test(\"root boolean object, should unmarshall it to native boolean\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const booleanInput = false;\n      const javaBooleanInput = new JavaBoolean(false);\n\n      [booleanInput, javaBooleanInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual(false);\n      });\n    });\n\n    test(\"root array object, should unmarshall it to native array\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const arrayInput = [\"foo\"];\n      const javaArrayInput = new JavaArrayList([\"foo\"]);\n\n      [arrayInput, javaArrayInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual([\"foo\"]);\n      });\n    });\n\n    test(\"root set object, should unmarshall it to native set\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const setInput = new Set([\"foo\"]);\n      const javaSetInput = new JavaHashSet(new Set([\"foo\"]));\n\n      [setInput, javaSetInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual(new Set([\"foo\"]));\n      });\n    });\n\n    test(\"root map object, should unmarshall it native map\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const mapInput = new Map([[\"foo\", \"bar\"]]);\n      const javaMapInput = new JavaHashMap(new Map([[\"foo\", \"bar\"]]));\n\n      [mapInput, javaMapInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n        expect(output).toEqual(new Map([[\"foo\", \"bar\"]]));\n      });\n    });\n\n    test(\"root integer number object, should throw error\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1;\n\n      expect(() => marshaller.unmarshall(input as any, new UnmarshallingContext(new Map()))).toThrowError();\n    });\n\n    test(\"root float number object, should throw error\", () => {\n      const marshaller = new DefaultMarshaller();\n\n      const input = 1.1;\n\n      expect(() => marshaller.unmarshall(input as any, new UnmarshallingContext(new Map()))).toThrowError();\n    });\n  });\n\n  describe(\"pojo root types\", () => {\n    test(\"with custom pojo, should unmarshall correctly\", () => {\n      const oracle = new Map([\n        [\"com.app.my.Pojo\", () => new User({ age: new JavaInteger(\"0\") }) as any],\n        [\"com.app.my.Address\", () => new Address({} as any) as any],\n        [\n          \"com.app.my.AddressType\",\n          ((name: string) => {\n            switch (name) {\n              case \"HOME\":\n                return AddressType.HOME;\n              case \"WORK\":\n                return AddressType.WORK;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ]);\n\n      const marshaller = new DefaultMarshaller();\n\n      const input = new User({\n        name: \"my name\",\n        sendSpam: false,\n        age: new JavaInteger(\"10\"),\n        address: new Address({\n          line1: \"address line 1\",\n          type: AddressType.HOME\n        }),\n        bestFriend: new User({\n          name: \"my name 2\",\n          sendSpam: true,\n          address: new Address({\n            line1: \"address 2 line 1\"\n          })\n        })\n      });\n\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle));\n\n      expect(output).toEqual(input);\n    });\n\n    test(\"with custom pojo with function, should unmarshall to a correct object containing the function\", () => {\n      const oracle = new Map([[\"com.app.my.PojoWithFunction\", () => new PojoWithFunction({})]]);\n      const marshaller = new DefaultMarshaller();\n\n      const input = new PojoWithFunction({ foo: \"bar\" });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle)) as PojoWithFunction;\n\n      expect(output).toEqual(input);\n\n      // generates a full functional object of the correct type\n      expect(output.whatToSay()).toEqual(\"Hello, bar!\");\n    });\n\n    test(\"with custom pojo with java types, should unmarshall normally\", () => {\n      const marshaller = new DefaultMarshaller();\n      const oracle = new Map([\n        [\n          \"com.app.my.Pojo\",\n          () =>\n            new JavaTypesPojo({\n              bigDecimal: new JavaBigDecimal(\"0\"),\n              bigInteger: new JavaBigInteger(\"0\"),\n              byte: new JavaByte(\"0\"),\n              double: new JavaDouble(\"0\"),\n              float: new JavaFloat(\"0\"),\n              integer: new JavaInteger(\"0\"),\n              short: new JavaShort(\"0\")\n            })\n        ]\n      ]);\n\n      const input = new JavaTypesPojo({\n        bigDecimal: new JavaBigDecimal(\"1.1\"),\n        bigInteger: new JavaBigInteger(\"2\"),\n        boolean: false,\n        byte: new JavaByte(\"3\"),\n        double: new JavaDouble(\"1.2\"),\n        float: new JavaFloat(\"1.3\"),\n        integer: new JavaInteger(\"4\"),\n        long: new JavaLong(\"5\"),\n        short: new JavaShort(\"6\"),\n        string: \"str\",\n        date: new Date(),\n        optional: new JavaOptional<string>(\"optstr\")\n      });\n\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle));\n\n      expect(output).toEqual(input);\n    });\n\n    test(\"with custom pojo with java collection types, should unmarshall normally\", () => {\n      const marshaller = new DefaultMarshaller();\n      const oracle = new Map([[\"com.app.my.JavaCollectionTypesPojo\", () => new JavaCollectionTypesPojo({})]]);\n\n      const input = new JavaCollectionTypesPojo({\n        list: [\"1\", \"2\"],\n        set: new Set<string>([\"3\", \"2\"]),\n        map: new Map([[\"k1\", \"v1\"], [\"k2\", \"v2\"]])\n      });\n\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle));\n\n      expect(output).toEqual(input);\n    });\n\n    test(\"with custom pojo without fqcn, should throw error\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.Pojo\", () => new User({ age: new JavaInteger(\"0\") })]])\n      );\n\n      const input = new User({});\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      // remove its fqcn\n      delete marshalledInput[ErraiObjectConstants.ENCODED_TYPE];\n\n      expect(() => marshaller.unmarshall(marshalledInput, unmarshallContext)).toThrowError();\n    });\n\n    test(\"with custom pojo without factory, should throw error\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(new Map());\n\n      const input = new User({});\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      expect(() => marshaller.unmarshall(marshalledInput, unmarshallContext)).toThrowError();\n    });\n\n    test(\"with custom pojo with property without fqcn, should throw error\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\"com.app.my.Pojo\", () => new User({ age: new JavaInteger(\"0\") }) as any],\n          [\"com.app.my.Address\", () => new Address({} as any) as any]\n        ])\n      );\n\n      const input = new User({ name: \"foo\", address: new Address({ line1: \"bla\" }) });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      // remove its fqcn\n      delete (marshalledInput as any).address[ErraiObjectConstants.ENCODED_TYPE];\n\n      expect(() => marshaller.unmarshall(marshalledInput, unmarshallContext)).toThrowError();\n    });\n\n    class PojoWithFunction implements Portable<PojoWithFunction> {\n      private readonly _fqcn = \"com.app.my.PojoWithFunction\";\n\n      public readonly foo?: string = undefined;\n\n      constructor(self: { foo?: string }) {\n        Object.assign(this, self);\n      }\n\n      public whatToSay() {\n        return `Hello, ${this.foo}!`;\n      }\n    }\n\n    class JavaCollectionTypesPojo implements Portable<JavaCollectionTypesPojo> {\n      private readonly _fqcn = \"com.app.my.JavaCollectionTypesPojo\";\n\n      public readonly list?: string[] = undefined;\n      public readonly set?: Set<string> = undefined;\n      public readonly map?: Map<string, string> = undefined;\n\n      constructor(self: { list?: string[]; set?: Set<string>; map?: Map<string, string> }) {\n        Object.assign(this, self);\n      }\n    }\n  });\n\n  describe(\"object caching\", () => {\n    test(\"custom pojo with repeated pojo objects, should cache the object and reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\"com.app.my.Address\", () => new Address({}) as any],\n          [\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]\n        ])\n      );\n\n      const repeatedObject = new Address({ line1: \"bla address\" });\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<Address>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaBigDecimal objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new JavaBigDecimal(\"1.1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaBigDecimal>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaBigInteger objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new JavaBigInteger(\"1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaBigInteger>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaByte objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\n            \"com.app.my.RepeatedFieldsPojo\",\n            () => new RepeatedFieldsPojo({ field1: new JavaByte(\"0\"), field2: new JavaByte(\"0\") }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = new JavaByte(\"1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaByte>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaDouble objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\n            \"com.app.my.RepeatedFieldsPojo\",\n            () => new RepeatedFieldsPojo({ field1: new JavaDouble(\"0\"), field2: new JavaDouble(\"0\") }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = new JavaDouble(\"1.1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaDouble>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaFloat objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\n            \"com.app.my.RepeatedFieldsPojo\",\n            () => new RepeatedFieldsPojo({ field1: new JavaFloat(\"0\"), field2: new JavaFloat(\"0\") }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = new JavaFloat(\"1.1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaFloat>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaInteger objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\n            \"com.app.my.RepeatedFieldsPojo\",\n            () => new RepeatedFieldsPojo({ field1: new JavaInteger(\"0\"), field2: new JavaInteger(\"0\") }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = new JavaInteger(\"1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaInteger>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaLong objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new JavaLong(\"1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaLong>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaShort objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\n            \"com.app.my.RepeatedFieldsPojo\",\n            () => new RepeatedFieldsPojo({ field1: new JavaShort(\"0\"), field2: new JavaShort(\"0\") }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = new JavaShort(\"1\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<JavaShort>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaOptional objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new JavaOptional(\"foo\");\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<\n        JavaOptional<string>\n      >;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).not.toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated JavaEnum objects, should not cache it and don't reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([\n          [\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any],\n          [\n            \"com.app.my.AddressType\",\n            ((name: string) => {\n              switch (name) {\n                case \"HOME\":\n                  return AddressType.HOME;\n                case \"WORK\":\n                  return AddressType.WORK;\n                default:\n                  throw new Error(`Unknown value ${name} for enum AddressType!`);\n              }\n            }) as any\n          ]\n        ])\n      );\n\n      const repeatedObject = AddressType.HOME;\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<AddressType>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated array objects, should cache the object and reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedInlineArray = [\"foo\", \"bar\"];\n      const inlineArrayInput = new RepeatedFieldsPojo({ field1: repeatedInlineArray, field2: repeatedInlineArray });\n\n      const repeatedNewArray = new Array(\"foo\", \"bar\");\n      const newArrayInput = new RepeatedFieldsPojo({ field1: repeatedNewArray, field2: repeatedNewArray });\n\n      [inlineArrayInput, newArrayInput].forEach(input => {\n        const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n        const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<string[]>;\n\n        expect(output).toEqual(input);\n        expect(output.field1!).toBe(output.field2!);\n      });\n    });\n\n    test(\"custom pojo with repeated set objects, should cache the object and reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new Set([\"foo\", \"bar\"]);\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<Set<string>>;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).toBe(output.field2!);\n    });\n\n    test(\"custom pojo with repeated map objects, should cache the object and reuse data\", () => {\n      const marshaller = new DefaultMarshaller();\n      const unmarshallContext = new UnmarshallingContext(\n        new Map([[\"com.app.my.RepeatedFieldsPojo\", () => new RepeatedFieldsPojo({}) as any]])\n      );\n\n      const repeatedObject = new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]);\n      const input = new RepeatedFieldsPojo({ field1: repeatedObject, field2: repeatedObject });\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n      const output = marshaller.unmarshall(marshalledInput, unmarshallContext) as RepeatedFieldsPojo<\n        Map<string, string>\n      >;\n\n      expect(output).toEqual(input);\n      expect(output.field1!).toBe(output.field2!);\n    });\n\n    class RepeatedFieldsPojo<T> implements Portable<RepeatedFieldsPojo<T>> {\n      private readonly _fqcn = \"com.app.my.RepeatedFieldsPojo\";\n\n      public field1?: T = undefined;\n      public field2?: T = undefined;\n\n      constructor(self: { field1?: T; field2?: T }) {\n        Object.assign(this, self);\n      }\n    }\n  });\n});\n\nclass User implements Portable<User> {\n  private readonly _fqcn = \"com.app.my.Pojo\";\n\n  public readonly name?: string = undefined;\n  public readonly sendSpam?: boolean = undefined;\n  public readonly age?: JavaInteger = undefined;\n  public readonly address?: Address = undefined;\n  public readonly bestFriend?: User = undefined;\n\n  constructor(self: { name?: string; sendSpam?: boolean; age?: JavaInteger; address?: Address; bestFriend?: User }) {\n    Object.assign(this, self);\n  }\n}\n\nclass Address implements Portable<Address> {\n  private readonly _fqcn = \"com.app.my.Address\";\n\n  public line1?: string = undefined;\n  public type?: AddressType = undefined;\n  constructor(self: { line1?: string; type?: AddressType }) {\n    Object.assign(this, self);\n  }\n}\n\nclass AddressType extends JavaEnum<AddressType> {\n  public static readonly HOME: AddressType = new AddressType(\"HOME\");\n  public static readonly WORK: AddressType = new AddressType(\"WORK\");\n\n  protected readonly _fqcn: string = AddressType.__fqcn();\n\n  public static __fqcn(): string {\n    return \"com.app.my.AddressType\";\n  }\n\n  public static values() {\n    return [AddressType.HOME, AddressType.WORK];\n  }\n}\n\nclass JavaTypesPojo implements Portable<JavaTypesPojo> {\n  private readonly _fqcn = \"com.app.my.Pojo\";\n\n  public readonly bigDecimal?: JavaBigDecimal = undefined;\n  public readonly bigInteger?: JavaBigInteger = undefined;\n  public readonly boolean?: boolean = undefined;\n  public readonly byte?: JavaByte = undefined;\n  public readonly double?: JavaDouble = undefined;\n  public readonly float?: JavaFloat = undefined;\n  public readonly integer?: JavaInteger = undefined;\n  public readonly long?: JavaLong = undefined;\n  public readonly short?: JavaShort = undefined;\n  public readonly string?: string = undefined;\n  public readonly date?: Date = undefined;\n  public readonly optional?: JavaOptional<string> = undefined;\n\n  constructor(self: {\n    bigDecimal?: JavaBigDecimal;\n    bigInteger?: JavaBigInteger;\n    boolean?: boolean;\n    byte?: JavaByte;\n    double?: JavaDouble;\n    float?: JavaFloat;\n    integer?: JavaInteger;\n    long?: JavaLong;\n    short?: JavaShort;\n    string?: string;\n    date?: Date;\n    optional?: JavaOptional<string>;\n  }) {\n    Object.assign(this, self);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaBigDecimalMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaBigDecimal } from \"../../../java-wrappers\";\nimport { JavaBigDecimalMarshaller } from \"../JavaBigDecimalMarshaller\";\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular big decimal, should serialize it normally\", () => {\n    const input = new JavaBigDecimal(\"12.12\");\n\n    const output = new JavaBigDecimalMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: JavaType.BIG_DECIMAL,\n      [ErraiObjectConstants.OBJECT_ID]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [ErraiObjectConstants.VALUE]: \"12.12\"\n    });\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaBigDecimalMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaBigDecimalMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with regular input, should return a JavaBigDecimal instance\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = new JavaBigDecimal(\"125.2\");\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output.get().toString(10)).toEqual(input.get().toString(10));\n  });\n\n  test(\"with non string value, should throw error\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_DECIMAL, false, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with non numeric string value, should throw error\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_DECIMAL, \"abc\", \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should return a JavaBigDecimal instance containing NaN\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_DECIMAL, null, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should return a JavaBigDecimal instance containing NaN\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_DECIMAL, undefined, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with empty string value, should return a JavaBigDecimal instance containing NaN\", () => {\n    const marshaller = new JavaBigDecimalMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_DECIMAL, \"\", \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaBigIntegerMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { JavaBigInteger } from \"../../../java-wrappers\";\nimport { JavaBigIntegerMarshaller } from \"../JavaBigIntegerMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular big integer, should serialize it normally\", () => {\n    const input = new JavaBigInteger(\"12\");\n\n    const output = new JavaBigIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: JavaType.BIG_INTEGER,\n      [ErraiObjectConstants.OBJECT_ID]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [ErraiObjectConstants.VALUE]: \"12\"\n    });\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaBigIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaBigIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with regular input, should return a JavaBigInteger instance\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = new JavaBigInteger(\"125\");\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output.get().toString(10)).toEqual(input.get().toString(10));\n  });\n\n  test(\"with non string value, should return a JavaBigInteger instance containing NaN\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_INTEGER, false, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with non numeric string value, should throw error\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_INTEGER, \"abc\", \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should return a JavaBigInteger instance containing NaN\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_INTEGER, null, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should return a JavaBigInteger instance containing NaN\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_INTEGER, undefined, \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with empty string value, should return a JavaBigInteger instance containing NaN\", () => {\n    const marshaller = new JavaBigIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.BIG_INTEGER, \"\", \"1\").asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaBooleanMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaBoolean } from \"../../../java-wrappers\";\nimport { JavaBooleanMarshaller } from \"../JavaBooleanMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular boolean, should return the same value\", () => {\n    const input = new JavaBoolean(false);\n\n    const output = new JavaBooleanMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(false);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaBooleanMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaBooleanMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with boolean input, should return a boolean instance\", () => {\n    const marshaller = new JavaBooleanMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = true;\n    const output = marshaller.notNullUnmarshall(input, context);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with ErraiObject regular input, should return a boolean instance\", () => {\n    const marshaller = new JavaBooleanMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = false;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.BOOLEAN, input).asErraiObject();\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output).toBeFalsy();\n  });\n\n  test(\"with non boolean value, should throw error\", () => {\n    const marshaller = new JavaBooleanMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"abc\" as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.BOOLEAN, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaBooleanMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = null as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.BOOLEAN, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaBooleanMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = undefined as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.BOOLEAN, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaByteMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaByte } from \"../../../java-wrappers\";\nimport { JavaByteMarshaller } from \"../JavaByteMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular byte, should return same value\", () => {\n    const input = new JavaByte(\"2\");\n\n    const output = new JavaByteMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(2);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaByteMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaByteMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  describe(\"number input\", () => {\n    test(\"with byte, should return a JavaByte instance\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const output = marshaller.notNullUnmarshall(input, context);\n\n      expect(output).toEqual(new JavaByte(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n  });\n\n  describe(\"ErraiObject input\", () => {\n    test(\"with byte, should return a JavaByte instance\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n      expect(output).toEqual(new JavaByte(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaByteMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.BYTE, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaCollectionSubTypesMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JavaArrayListMarshaller, JavaHashSetMarshaller } from \"../JavaCollectionMarshaller\";\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../../java-wrappers\";\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { MarshallerProvider } from \"../../MarshallerProvider\";\nimport { JavaBigIntegerMarshaller } from \"../JavaBigIntegerMarshaller\";\nimport { Portable } from \"../../Portable\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  const encodedType = ErraiObjectConstants.ENCODED_TYPE;\n  const objectId = ErraiObjectConstants.OBJECT_ID;\n  const value = ErraiObjectConstants.VALUE;\n\n  let context: MarshallingContext;\n\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n    context = new MarshallingContext();\n  });\n\n  test(\"with empty collection, should serialize normally\", () => {\n    const arrayListScenario = () => {\n      const input = new JavaArrayList([]);\n      return { fqcn: JavaType.ARRAY_LIST, output: new JavaArrayListMarshaller().marshall(input, context) };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set([]));\n      return { fqcn: JavaType.HASH_SET, output: new JavaHashSetMarshaller().marshall(input, context) };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: []\n      });\n    });\n  });\n\n  test(\"with JavaNumber collection, should wrap every element into an errai object\", () => {\n    const numberArray = [new JavaInteger(\"1\"), new JavaInteger(\"2\"), new JavaInteger(\"3\")];\n\n    const arrayListScenario = () => {\n      const input = new JavaArrayList(numberArray);\n      return { fqcn: JavaType.ARRAY_LIST, output: new JavaArrayListMarshaller().marshall(input, context) };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set(numberArray));\n      return { fqcn: JavaType.HASH_SET, output: new JavaHashSetMarshaller().marshall(input, context) };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: [\n          new NumValBasedErraiObject(JavaType.INTEGER, 1).asErraiObject(),\n          new NumValBasedErraiObject(JavaType.INTEGER, 2).asErraiObject(),\n          new NumValBasedErraiObject(JavaType.INTEGER, 3).asErraiObject()\n        ]\n      });\n    });\n  });\n\n  test(\"with JavaBoolean collection, should wrap every element into an errai object\", () => {\n    const booleanArray = [new JavaBoolean(true), new JavaBoolean(false)];\n\n    const arrayListScenario = () => {\n      const input = new JavaArrayList(booleanArray);\n      return { fqcn: JavaType.ARRAY_LIST, output: new JavaArrayListMarshaller().marshall(input, context) };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set(booleanArray));\n      return { fqcn: JavaType.HASH_SET, output: new JavaHashSetMarshaller().marshall(input, context) };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: [\n          new NumValBasedErraiObject(JavaType.BOOLEAN, true).asErraiObject(),\n          new NumValBasedErraiObject(JavaType.BOOLEAN, false).asErraiObject()\n        ]\n      });\n    });\n  });\n\n  test(\"with JavaBigNumber collection, should serialize every element normally\", () => {\n    const bigIntegerMarshaller = new JavaBigIntegerMarshaller();\n\n    const bigNumberArray = [new JavaBigInteger(\"1\"), new JavaBigInteger(\"2\"), new JavaBigInteger(\"3\")];\n\n    const arrayListScenario = () => {\n      const input = new JavaArrayList(bigNumberArray);\n      return { fqcn: JavaType.ARRAY_LIST, output: new JavaArrayListMarshaller().marshall(input, context) };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set(bigNumberArray));\n      return { fqcn: JavaType.HASH_SET, output: new JavaHashSetMarshaller().marshall(input, context) };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: [\n          {\n            ...(bigIntegerMarshaller.marshall(new JavaBigInteger(\"1\"), context) as any),\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex)\n          },\n          {\n            ...(bigIntegerMarshaller.marshall(new JavaBigInteger(\"2\"), context) as any),\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex)\n          },\n          {\n            ...(bigIntegerMarshaller.marshall(new JavaBigInteger(\"3\"), context) as any),\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex)\n          }\n        ]\n      });\n    });\n  });\n\n  test(\"with custom object collection, should serialize every element normally\", () => {\n    const portableArray = [\n      new MyPortable({ foo: \"foo1\", bar: \"bar1\" }),\n      new MyPortable({ foo: \"foo2\", bar: \"bar2\" }),\n      new MyPortable({ foo: \"foo3\", bar: \"bar3\" })\n    ];\n\n    const arrayListScenario = () => {\n      const input = new JavaArrayList(portableArray);\n      return {\n        fqcn: JavaType.ARRAY_LIST,\n        output: new JavaArrayListMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set(portableArray));\n      return {\n        fqcn: JavaType.HASH_SET,\n        output: new JavaHashSetMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: [\n          {\n            [encodedType]: \"com.portable.my\",\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n            foo: \"foo1\",\n            bar: \"bar1\"\n          },\n          {\n            [encodedType]: \"com.portable.my\",\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n            foo: \"foo2\",\n            bar: \"bar2\"\n          },\n          {\n            [encodedType]: \"com.portable.my\",\n            [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n            foo: \"foo3\",\n            bar: \"bar3\"\n          }\n        ]\n      });\n    });\n  });\n\n  test(\"with collection containing null elements, should serialize every element normally\", () => {\n    const arrayListScenario = () => {\n      const input = new JavaArrayList([null]);\n      return {\n        fqcn: JavaType.ARRAY_LIST,\n        output: new JavaArrayListMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set([null]));\n      return {\n        fqcn: JavaType.HASH_SET,\n        output: new JavaHashSetMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      expect(output).toStrictEqual({\n        [encodedType]: fqcn,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: [null]\n      });\n    });\n  });\n\n  test(\"with custom pojo array containing repeated elements, should cache inner objects and don't repeat data\", () => {\n    const repeatedValue = new Node({ data: \"foo1\", left: undefined, right: undefined });\n\n    const portableArray = [repeatedValue, new Node({ data: \"foo2\", left: undefined, right: repeatedValue })];\n\n    const arrayListScenario = () => {\n      const input = new JavaArrayList(portableArray);\n      return {\n        fqcn: JavaType.ARRAY_LIST,\n        output: new JavaArrayListMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    const hashSetScenario = () => {\n      const input = new JavaHashSet(new Set(portableArray));\n      return {\n        fqcn: JavaType.HASH_SET,\n        output: new JavaHashSetMarshaller().marshall(input, new MarshallingContext())\n      };\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const { fqcn, output } = outputFunc();\n\n      const rootObjId = output![objectId];\n      expect(output![encodedType]).toEqual(fqcn);\n      expect(rootObjId).toMatch(NumberUtils.nonNegativeIntegerRegex);\n\n      const rootObjValue = output![value] as any[];\n\n      const foo2Objects = rootObjValue.filter(obj => obj.data === \"foo2\");\n      expect(foo2Objects.length).toEqual(1);\n      const uniqueObjId = foo2Objects[0][objectId];\n      expect(uniqueObjId).toMatch(NumberUtils.nonNegativeIntegerRegex);\n\n      const repeatedObjects = rootObjValue.filter(obj => obj.data !== \"foo2\");\n      expect(repeatedObjects.length).toEqual(1);\n      const repeatedObjId = repeatedObjects[0][objectId];\n      expect(repeatedObjId).toMatch(NumberUtils.nonNegativeIntegerRegex);\n\n      expect(rootObjValue).toEqual([\n        { [encodedType]: \"com.app.my.Node\", [objectId]: repeatedObjId, data: \"foo1\", left: null, right: null },\n        {\n          [encodedType]: \"com.app.my.Node\",\n          [objectId]: uniqueObjId,\n          data: \"foo2\",\n          right: { [encodedType]: \"com.app.my.Node\", [objectId]: repeatedObjId },\n          left: null\n        }\n      ]);\n    });\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const arrayListScenario = () => {\n      return new JavaArrayListMarshaller().marshall(input, new MarshallingContext());\n    };\n\n    const hashSetScenario = () => {\n      return new JavaHashSetMarshaller().marshall(input, new MarshallingContext());\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const output = outputFunc();\n      expect(output).toBeNull();\n    });\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const arrayListScenario = () => {\n      return new JavaArrayListMarshaller().marshall(input, new MarshallingContext());\n    };\n\n    const hashSetScenario = () => {\n      return new JavaHashSetMarshaller().marshall(input, new MarshallingContext());\n    };\n\n    [arrayListScenario, hashSetScenario].forEach(outputFunc => {\n      const output = outputFunc();\n      expect(output).toBeNull();\n    });\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  test(\"with empty collection, should unmarshall to empty collection\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: []\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with Array collection, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([[\"foo\"]]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [[\"foo\"]]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([[\"foo\"]])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([[\"foo\"]])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaArrayList collection, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaArrayList([\"foo\"])]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [[\"foo\"]]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaArrayList([\"foo\"])])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([[\"foo\"]])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with Set input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new Set([\"foo\"])]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Set([\"foo\"])]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new Set([\"foo\"])])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Set([\"foo\"])])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with HashSet input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaHashSet(new Set([\"foo\"]))]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Set([\"foo\"])]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaHashSet(new Set([\"foo\"]))])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Set([\"foo\"])])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with Map input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new Map([[\"foo\", \"bar\"]])]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Map([[\"foo\", \"bar\"]])]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new Map([[\"foo\", \"bar\"]])])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Map([[\"foo\", \"bar\"]])])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaHashMap input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaHashMap(new Map([[\"foo\", \"bar\"]]))]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Map([[\"foo\", \"bar\"]])]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaHashMap(new Map([[\"foo\", \"bar\"]]))])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Map([[\"foo\", \"bar\"]])])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with Date input, should unmarshall correctly\", () => {\n    const baseDate = new Date();\n\n    const arrayInput = {\n      input: new JavaArrayList([new Date(baseDate)]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Date(baseDate)]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new Date(baseDate)])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Date(baseDate)])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaDate input, should unmarshall correctly\", () => {\n    const baseDate = new Date();\n\n    const arrayInput = {\n      input: new JavaArrayList([new JavaDate(new Date(baseDate))]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new Date(baseDate)]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaDate(new Date(baseDate))])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new Date(baseDate)])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with Boolean input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([false]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [false]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([false])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([false])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaBoolean input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaBoolean(false)]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [false]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaBoolean(false)])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([false])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with String input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([\"foo\"]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [\"foo\"]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([\"foo\"])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([\"foo\"])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaString input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaString(\"foo\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [\"foo\"]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaString(\"foo\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([\"foo\"])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaOptional input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaOptional(\"foo\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaOptional(\"foo\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaOptional(\"foo\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaOptional(\"foo\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaBigDecimal input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaBigDecimal(\"1.1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaBigDecimal(\"1.1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaBigDecimal(\"1.1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaBigDecimal(\"1.1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaBigInteger should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaBigInteger(\"1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaBigInteger(\"1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaBigInteger(\"1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaBigInteger(\"1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaLong input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaLong(\"1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaLong(\"1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaLong(\"1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaLong(\"1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaByte input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaByte(\"1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaByte(\"1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaByte(\"1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaByte(\"1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaDouble input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaDouble(\"1.1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaDouble(\"1.1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaDouble(\"1.1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaDouble(\"1.1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaFloat input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaFloat(\"1.1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaFloat(\"1.1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaFloat(\"1.1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaFloat(\"1.1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaInteger input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaInteger(\"1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaInteger(\"1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaInteger(\"1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaInteger(\"1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with JavaShort input, should unmarshall correctly\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([new JavaShort(\"1\")]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new JavaShort(\"1\")]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new JavaShort(\"1\")])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new JavaShort(\"1\")])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with custom object optional, should unmarshall correctly\", () => {\n    const oracle = new Map([[\"com.portable.my\", () => new MyPortable({} as any)]]);\n\n    const arrayInput = {\n      input: new JavaArrayList([new MyPortable({ foo: \"bar\", bar: \"foo\" })]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [new MyPortable({ foo: \"bar\", bar: \"foo\" })]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([new MyPortable({ foo: \"bar\", bar: \"foo\" })])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([new MyPortable({ foo: \"bar\", bar: \"foo\" })])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(oracle));\n\n      expect(output).toEqual(scenario.expected);\n    });\n  });\n\n  test(\"with root null object, should unmarshall to undefined\", () => {\n    [new JavaArrayListMarshaller(), new JavaHashSetMarshaller()].forEach(marshaller => {\n      const output = marshaller.unmarshall(null as any, new UnmarshallingContext(new Map()));\n\n      expect(output).toBeUndefined();\n    });\n  });\n\n  test(\"with root undefined object, should unmarshall to undefined\", () => {\n    [new JavaArrayListMarshaller(), new JavaHashSetMarshaller()].forEach(marshaller => {\n      const output = marshaller.unmarshall(undefined as any, new UnmarshallingContext(new Map()));\n\n      expect(output).toBeUndefined();\n    });\n  });\n\n  test(\"with undefined value inside ErraiObject, should throw error\", () => {\n    const arrayInput = {\n      input: new ValueBasedErraiObject(JavaType.ARRAY_LIST, undefined).asErraiObject(),\n      marshaller: new JavaArrayListMarshaller()\n    };\n\n    const setInput = {\n      input: new ValueBasedErraiObject(JavaType.HASH_SET, undefined).asErraiObject(),\n      marshaller: new JavaHashSetMarshaller()\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      expect(() => scenario.marshaller.unmarshall(scenario.input, new UnmarshallingContext(new Map()))).toThrowError();\n    });\n  });\n\n  test(\"with null value inside ErraiObject, should throw error\", () => {\n    const arrayInput = {\n      input: new ValueBasedErraiObject(JavaType.ARRAY_LIST, null).asErraiObject(),\n      marshaller: new JavaArrayListMarshaller()\n    };\n\n    const setInput = {\n      input: new ValueBasedErraiObject(JavaType.HASH_SET, null).asErraiObject(),\n      marshaller: new JavaHashSetMarshaller()\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      expect(() => scenario.marshaller.unmarshall(scenario.input, new UnmarshallingContext(new Map()))).toThrowError();\n    });\n  });\n\n  test(\"with non array value inside ErraiObject, should throw error\", () => {\n    const arrayInput = {\n      input: new ValueBasedErraiObject(JavaType.ARRAY_LIST, false).asErraiObject(),\n      marshaller: new JavaArrayListMarshaller()\n    };\n\n    const setInput = {\n      input: new ValueBasedErraiObject(JavaType.HASH_SET, false).asErraiObject(),\n      marshaller: new JavaHashSetMarshaller()\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      expect(() => scenario.marshaller.unmarshall(scenario.input, new UnmarshallingContext(new Map()))).toThrowError();\n    });\n  });\n\n  test(\"with custom pojo containing repeated elements, should reuse cached objects and don't recreate data\", () => {\n    const oracle = new Map([[\"com.app.my.Node\", () => new Node({} as any)]]);\n\n    const repeatedValue = new Node({ data: \"foo1\" });\n    const portableArray = [repeatedValue, new Node({ data: \"foo2\", right: repeatedValue })];\n\n    const arrayInput = {\n      input: new JavaArrayList(portableArray),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: portableArray\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set(portableArray)),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set(portableArray)\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const output = scenario.marshaller.unmarshall(input, new UnmarshallingContext(oracle));\n\n      // compares value equality\n      expect(output).toEqual(scenario.expected);\n\n      // check if the repeated object was reused from cache\n      const asArray = Array.from(scenario.expected);\n\n      const repeatedNode = asArray[0];\n      const uniqueNode = asArray[1];\n\n      expect(repeatedNode).toBe(uniqueNode.right!);\n    });\n  });\n\n  test(\"with repeated collection unmarshalling, should reuse cached collection and don't recreate it\", () => {\n    const arrayInput = {\n      input: new JavaArrayList([\"list\"]),\n      marshaller: new JavaArrayListMarshaller(),\n      expected: [\"list\"]\n    };\n\n    const setInput = {\n      input: new JavaHashSet(new Set([\"set\"])),\n      marshaller: new JavaHashSetMarshaller(),\n      expected: new Set([\"set\"])\n    };\n\n    [arrayInput, setInput].forEach(scenario => {\n      const input = (scenario.marshaller as any).marshall(scenario.input as any, new MarshallingContext());\n\n      const context = new UnmarshallingContext(new Map());\n\n      const output = scenario.marshaller.unmarshall(input, context);\n      const repeatedOutput = scenario.marshaller.unmarshall(input, context);\n\n      expect(output).toEqual(scenario.expected);\n      expect(output).toBe(repeatedOutput!);\n    });\n  });\n});\n\nclass MyPortable implements Portable<MyPortable> {\n  private readonly _fqcn = \"com.portable.my\";\n\n  public readonly foo: string;\n  public readonly bar: string;\n\n  constructor(self: { foo: string; bar: string }) {\n    Object.assign(this, self);\n  }\n}\n\nclass Node implements Portable<Node> {\n  private readonly _fqcn = \"com.app.my.Node\";\n\n  public readonly data: any;\n  public readonly left?: Node;\n  public readonly right?: Node;\n\n  constructor(self: { data: any; left?: Node; right?: Node }) {\n    Object.assign(this, self);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaDateMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaDate } from \"../../../java-wrappers\";\nimport { JavaDateMarshaller } from \"../JavaDateMarshaller\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular date, should should serialize it normally\", () => {\n    const date = new Date();\n\n    const input = new JavaDate(date);\n\n    const output = new JavaDateMarshaller().marshall(input, new MarshallingContext());\n    expect(output).toStrictEqual(new ValueBasedErraiObject(JavaType.DATE, `${date.getTime()}`).asErraiObject());\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaDateMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaDateMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with ErraiObject regular input, should return the same Date instance\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = new Date();\n    const expectedDate = new Date(input.getTime());\n\n    const marshalledInput = marshaller.notNullMarshall(new JavaDate(input), new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output).toEqual(expectedDate);\n  });\n\n  test(\"with non numeric string value, should throw error\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"abc\" as any;\n    const marshalledInput = new ValueBasedErraiObject(JavaType.DATE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with non string value, should throw error\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = true as any;\n    const marshalledInput = new ValueBasedErraiObject(JavaType.DATE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with negative timestamp string value, should throw error\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"-1\";\n    const marshalledInput = new ValueBasedErraiObject(JavaType.DATE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = null as any;\n    const marshalledInput = new ValueBasedErraiObject(JavaType.DATE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaDateMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = undefined as any;\n    const marshalledInput = new ValueBasedErraiObject(JavaType.DATE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaDoubleMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaDouble } from \"../../../java-wrappers\";\nimport { JavaDoubleMarshaller } from \"../JavaDoubleMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular double, should return the same value\", () => {\n    const input = new JavaDouble(\"2.1\");\n\n    const output = new JavaDoubleMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(2.1);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaDoubleMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaDoubleMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with number input, should return a JavaDouble instance\", () => {\n    const marshaller = new JavaDoubleMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = 1.1;\n    const output = marshaller.notNullUnmarshall(input, context);\n\n    expect(output).toEqual(new JavaDouble(\"1.1\"));\n  });\n\n  test(\"with ErraiObject regular input, should return a JavaDouble instance\", () => {\n    const marshaller = new JavaDoubleMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = 1.1;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.DOUBLE, input).asErraiObject();\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output).toEqual(new JavaDouble(\"1.1\"));\n  });\n\n  test(\"with non double value, should throw error\", () => {\n    const marshaller = new JavaDoubleMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"abc\" as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.DOUBLE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaDoubleMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = null as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.DOUBLE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaDoubleMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = undefined as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.DOUBLE, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaEnumMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaEnum } from \"../../../java-wrappers\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaEnumMarshaller } from \"../JavaEnumMarshaller\";\nimport { EnumStringValueBasedErraiObject } from \"../../model/EnumStringValueBasedErraiObject\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular enum, should return the same value\", () => {\n    const input = FooEnum.BAR;\n\n    const output = new JavaEnumMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(\n      new EnumStringValueBasedErraiObject(FooEnum.__fqcn(), FooEnum.BAR.name).asErraiObject()\n    );\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaEnumMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaEnumMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with enum input, should return an enum instance\", () => {\n    const marshaller = new JavaEnumMarshaller();\n    const context = new UnmarshallingContext(\n      new Map([\n        [\n          `${FooEnum.__fqcn()}`,\n          ((name: string) => {\n            switch (name) {\n              case \"FOO\":\n                return FooEnum.FOO;\n              case \"BAR\":\n                return FooEnum.BAR;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ])\n    );\n\n    const input = new EnumStringValueBasedErraiObject(FooEnum.__fqcn(), FooEnum.FOO.name).asErraiObject();\n    const output = marshaller.notNullUnmarshall(input, context);\n\n    expect(output).toStrictEqual(FooEnum.FOO);\n  });\n\n  test(\"with invalid enum value, should throw error\", () => {\n    const marshaller = new JavaEnumMarshaller();\n    const context = new UnmarshallingContext(\n      new Map([\n        [\n          `${FooEnum.__fqcn()}`,\n          ((name: string) => {\n            switch (name) {\n              case \"FOO\":\n                return FooEnum.FOO;\n              case \"BAR\":\n                return FooEnum.BAR;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ])\n    );\n\n    const input = \"abc\" as any;\n    const marshalledInput = new EnumStringValueBasedErraiObject(FooEnum.__fqcn(), input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaEnumMarshaller();\n    const context = new UnmarshallingContext(\n      new Map([\n        [\n          `${FooEnum.__fqcn()}`,\n          ((name: string) => {\n            switch (name) {\n              case \"FOO\":\n                return FooEnum.FOO;\n              case \"BAR\":\n                return FooEnum.BAR;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ])\n    );\n\n    const input = null as any;\n    const marshalledInput = new EnumStringValueBasedErraiObject(FooEnum.__fqcn(), input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaEnumMarshaller();\n    const context = new UnmarshallingContext(\n      new Map([\n        [\n          `${FooEnum.__fqcn()}`,\n          ((name: string) => {\n            switch (name) {\n              case \"FOO\":\n                return FooEnum.FOO;\n              case \"BAR\":\n                return FooEnum.BAR;\n              default:\n                throw new Error(`Unknown value ${name} for enum AddressType!`);\n            }\n          }) as any\n        ]\n      ])\n    );\n\n    const input = undefined as any;\n    const marshalledInput = new EnumStringValueBasedErraiObject(FooEnum.__fqcn(), input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n\nclass FooEnum extends JavaEnum<FooEnum> {\n  public static readonly FOO: FooEnum = new FooEnum(\"FOO\");\n  public static readonly BAR: FooEnum = new FooEnum(\"BAR\");\n\n  protected readonly _fqcn: string = FooEnum.__fqcn();\n\n  public static __fqcn(): string {\n    return \"com.app.my.AddressType\";\n  }\n\n  public static values() {\n    return [FooEnum.FOO, FooEnum.BAR];\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaFloatMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaFloat } from \"../../../java-wrappers\";\nimport { JavaFloatMarshaller } from \"../JavaFloatMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular float, should return the same value\", () => {\n    const input = new JavaFloat(\"2.1\");\n\n    const output = new JavaFloatMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(2.1);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaFloatMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaFloatMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with number input, should return a JavaFloat instance\", () => {\n    const marshaller = new JavaFloatMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = 1.1;\n    const output = marshaller.notNullUnmarshall(input, context);\n\n    expect(output).toEqual(new JavaFloat(\"1.1\"));\n  });\n\n  test(\"with ErraiObject regular input, should return a JavaFloat instance\", () => {\n    const marshaller = new JavaFloatMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = 1.1;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.FLOAT, input).asErraiObject();\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output).toEqual(new JavaFloat(\"1.1\"));\n  });\n\n  test(\"with non float value, should throw error\", () => {\n    const marshaller = new JavaFloatMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"abc\" as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.FLOAT, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaFloatMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = null as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.FLOAT, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaFloatMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = undefined as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.FLOAT, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaHashMapMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallerProvider } from \"../../MarshallerProvider\";\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../../java-wrappers\";\nimport { JavaHashMapMarshaller } from \"../JavaHashMapMarshaller\";\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { Portable } from \"../../../marshalling/Portable\";\nimport { DefaultMarshaller } from \"../DefaultMarshaller\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  const encodedType = ErraiObjectConstants.ENCODED_TYPE;\n  const objectId = ErraiObjectConstants.OBJECT_ID;\n  const value = ErraiObjectConstants.VALUE;\n  const json = ErraiObjectConstants.JSON;\n\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  test(\"with empty map, should serialize normally\", () => {\n    const input = new JavaHashMap(new Map());\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {}\n    });\n  });\n\n  test(\"with string key and value, should serialize normally\", () => {\n    const input = new JavaHashMap(new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]));\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        foo1: \"bar1\",\n        foo2: \"bar2\"\n      }\n    });\n  });\n\n  test(\"with JavaNumber key and value, should wrap key and value into an errai object\", () => {\n    const input = new JavaHashMap(\n      new Map([[new JavaInteger(\"11\"), new JavaInteger(\"12\")], [new JavaInteger(\"21\"), new JavaInteger(\"22\")]])\n    );\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n\n    const expectedKey1 = `${json + JSON.stringify(new NumValBasedErraiObject(JavaType.INTEGER, 11).asErraiObject())}`;\n\n    const expectedKey2 = `${json + JSON.stringify(new NumValBasedErraiObject(JavaType.INTEGER, 21).asErraiObject())}`;\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [expectedKey1]: new NumValBasedErraiObject(JavaType.INTEGER, 12).asErraiObject(),\n        [expectedKey2]: new NumValBasedErraiObject(JavaType.INTEGER, 22).asErraiObject()\n      }\n    });\n  });\n\n  test(\"with JavaBoolean key and value, should wrap key and value into an errai object\", () => {\n    const input = new JavaHashMap(\n      new Map([[new JavaBoolean(true), new JavaBoolean(false)], [new JavaBoolean(false), new JavaBoolean(true)]])\n    );\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n\n    const expectedKey1 = `${json + JSON.stringify(new NumValBasedErraiObject(JavaType.BOOLEAN, true).asErraiObject())}`;\n\n    const expectedKey2 = `${json +\n      JSON.stringify(new NumValBasedErraiObject(JavaType.BOOLEAN, false).asErraiObject())}`;\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [expectedKey1]: new NumValBasedErraiObject(JavaType.BOOLEAN, false).asErraiObject(),\n        [expectedKey2]: new NumValBasedErraiObject(JavaType.BOOLEAN, true).asErraiObject()\n      }\n    });\n  });\n\n  test(\"with JavaBigNumber key and value, should wrap key and value into an errai object\", () => {\n    const input = new JavaHashMap(\n      new Map([\n        [new JavaBigInteger(\"11\"), new JavaBigInteger(\"12\")],\n        [new JavaBigInteger(\"21\"), new JavaBigInteger(\"22\")]\n      ])\n    );\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext())!;\n\n    // need to assert the keys individually because since it's a string, can't use the regex matcher in the object id :/\n\n    const mapKeys = Object.keys(output[value]);\n    expect(mapKeys.length).toBe(2);\n\n    const key1Str = mapKeys[0];\n    const key2Str = mapKeys[1];\n\n    mapKeys.forEach(k => {\n      // complex objects as map key uses a prefix to indicate that a json must be parsed in the map key\n      expect(k.startsWith(json)).toBeTruthy();\n    });\n\n    const key1Obj = JSON.parse(key1Str.replace(json, \"\"));\n    const key2Obj = JSON.parse(key2Str.replace(json, \"\"));\n\n    expect(key1Obj).toStrictEqual({\n      [encodedType]: JavaType.BIG_INTEGER,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: \"11\"\n    });\n\n    expect(key2Obj).toStrictEqual({\n      [encodedType]: JavaType.BIG_INTEGER,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: \"21\"\n    });\n\n    // assert map values\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [key1Str]: {\n          [encodedType]: JavaType.BIG_INTEGER,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: \"12\"\n        },\n        [key2Str]: {\n          [encodedType]: JavaType.BIG_INTEGER,\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          [value]: \"22\"\n        }\n      }\n    });\n  });\n\n  test(\"with custom object key and value, should wrap key and value into an errai object\", () => {\n    const input = new JavaHashMap(\n      new Map([\n        [new DummyPojo({ foo: \"bar11\" }), new DummyPojo({ foo: \"bar12\" })],\n        [new DummyPojo({ foo: \"bar21\" }), new DummyPojo({ foo: \"bar22\" })]\n      ])\n    );\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext())!;\n\n    // need to assert the keys individually because since it's a string, can't use the regex matcher in the object id :/\n\n    const mapKeys = Object.keys(output[value]);\n    expect(mapKeys.length).toBe(2);\n\n    const key1Str = mapKeys[0];\n    const key2Str = mapKeys[1];\n\n    mapKeys.forEach(k => {\n      // complex objects as map key uses a prefix to indicate that a json must be parsed in the map key\n      expect(k.startsWith(json)).toBeTruthy();\n    });\n\n    const key1Obj = JSON.parse(key1Str.replace(json, \"\"));\n    const key2Obj = JSON.parse(key2Str.replace(json, \"\"));\n\n    expect(key1Obj).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      foo: \"bar11\"\n    });\n\n    expect(key2Obj).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      foo: \"bar21\"\n    });\n\n    // assert map values\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [key1Str]: {\n          [encodedType]: \"com.app.my.DummyPojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          foo: \"bar12\"\n        },\n        [key2Str]: {\n          [encodedType]: \"com.app.my.DummyPojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          foo: \"bar22\"\n        }\n      }\n    });\n  });\n\n  test(\"with undefined key and value, should set key as null reference and value as null\", () => {\n    const input = new JavaHashMap(new Map([[undefined, undefined]]));\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [ErraiObjectConstants.NULL]: null\n      }\n    });\n  });\n\n  test(\"with custom pojo containing cached key, should reuse it and don't repeat data\", () => {\n    const repeatedPojo = new DummyPojo({ foo: \"repeatedKey\" });\n\n    const input = new ComplexPojo({\n      dummy: repeatedPojo,\n      map: new Map([[repeatedPojo, \"value1\"], [new DummyPojo({ foo: \"uniqueKey\" }), \"value2\"]])\n    });\n\n    const context = new MarshallingContext();\n    const output = new DefaultMarshaller().marshall(input, context)!;\n\n    // ===== assertions\n\n    // 1) Assert map content\n\n    const mapOutput = (output as any).map;\n    const mapKeys = Object.keys(mapOutput[value]);\n    expect(mapKeys.length).toBe(2);\n\n    const key1Str = mapKeys[0];\n    const key2Str = mapKeys[1];\n\n    mapKeys.forEach(k => {\n      // complex objects as map key uses a prefix to indicate that a json must be parsed in the map key\n      expect(k.startsWith(json)).toBeTruthy();\n    });\n\n    const key1Obj = JSON.parse(key1Str.replace(json, \"\"));\n    const key2Obj = JSON.parse(key2Str.replace(json, \"\"));\n\n    // assert keys contents\n\n    const key1ObjectId = key1Obj[objectId]; // this is the cached object's id\n    expect(key1ObjectId).toMatch(NumberUtils.nonNegativeIntegerRegex);\n    expect(key1Obj).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: key1ObjectId // without object's content\n    });\n\n    expect(key2Obj).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      foo: \"uniqueKey\"\n    });\n\n    // assert map values contents\n\n    expect(mapOutput).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        [key1Str]: \"value1\",\n        [key2Str]: \"value2\"\n      }\n    });\n\n    // 2) Assert full object content\n\n    expect(output).toStrictEqual({\n      [encodedType]: \"com.app.my.ComplexPojo\",\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      dummy: {\n        [encodedType]: \"com.app.my.DummyPojo\",\n        [objectId]: key1ObjectId, // same object id than the one used as map key\n        foo: \"repeatedKey\"\n      },\n      map: mapOutput // already asserted\n    });\n\n    // do not cache repeated object's data\n    expect(context.getCached(repeatedPojo)).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: key1ObjectId\n    });\n  });\n\n  test(\"with map containing repeated value, should reuse it and don't repeat data\", () => {\n    const repeatedValue = new DummyPojo({ foo: \"repeatedValue\" });\n    const uniqueValue = new DummyPojo({ foo: \"uniqueValue\" });\n\n    const input = new JavaHashMap(new Map([[\"key1\", repeatedValue], [\"key2\", repeatedValue], [\"key3\", uniqueValue]]));\n\n    const context = new MarshallingContext();\n    const output = new JavaHashMapMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.HASH_MAP,\n      [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n      [value]: {\n        key1: {\n          [encodedType]: \"com.app.my.DummyPojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          foo: \"repeatedValue\"\n        },\n        key2: {\n          [encodedType]: \"com.app.my.DummyPojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex)\n          // missing data\n        },\n        key3: {\n          [encodedType]: \"com.app.my.DummyPojo\",\n          [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n          foo: \"uniqueValue\"\n        }\n      }\n    });\n\n    // same object id\n    const repeatedObjIdFirstAppearance = (output as any)[value].key1[objectId];\n    const repeatedObjIdSecondAppearance = (output as any)[value].key2[objectId];\n    expect(repeatedObjIdFirstAppearance).toEqual(repeatedObjIdSecondAppearance);\n\n    // do not cache repeated object's data\n    expect(context.getCached(repeatedValue)).toStrictEqual({\n      [encodedType]: \"com.app.my.DummyPojo\",\n      [objectId]: repeatedObjIdFirstAppearance\n    });\n  });\n\n  test(\"with root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n    expect(output).toBeNull();\n  });\n\n  test(\"with root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaHashMapMarshaller().marshall(input, new MarshallingContext());\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  test(\"with empty map, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap<string, string>(new Map<string, string>());\n\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map());\n  });\n\n  test(\"with string key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const stringInput = new JavaHashMap(new Map([[\"foo1\", \"bar1\"]]));\n    const javaStringInput = new JavaHashMap(new Map([[new JavaString(\"foo1\"), new JavaString(\"bar1\")]]));\n\n    [stringInput, javaStringInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[\"foo1\", \"bar1\"]]));\n    });\n  });\n\n  test(\"with Array key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const arrayInput = new JavaHashMap(new Map([[[\"foo1\"], [\"bar1\"]]]));\n    const arrayListInput = new JavaHashMap(new Map([[new JavaArrayList([\"foo1\"]), new JavaArrayList([\"bar1\"])]]));\n\n    [arrayInput, arrayListInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[[\"foo1\"], [\"bar1\"]]]));\n    });\n  });\n\n  test(\"with Set key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const setInput = new JavaHashMap(new Map([[new Set([\"foo1\"]), new Set([\"bar1\"])]]));\n    const hashSetInput = new JavaHashMap(\n      new Map([[new JavaHashSet(new Set([\"foo1\"])), new JavaHashSet(new Set([\"bar1\"]))]])\n    );\n\n    [setInput, hashSetInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[new Set([\"foo1\"]), new Set([\"bar1\"])]]));\n    });\n  });\n\n  test(\"with Map key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const mapInput = new JavaHashMap(new Map([[new Map([[\"kfoo1\", \"kbar1\"]]), new Map([[\"vfoo1\", \"vbar1\"]])]]));\n    const hashMapInput = new JavaHashMap(\n      new Map([[new JavaHashMap(new Map([[\"kfoo1\", \"kbar1\"]])), new JavaHashMap(new Map([[\"vfoo1\", \"vbar1\"]]))]])\n    );\n\n    [mapInput, hashMapInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[new Map([[\"kfoo1\", \"kbar1\"]]), new Map([[\"vfoo1\", \"vbar1\"]])]]));\n    });\n  });\n\n  test(\"with Date key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const baseDateKey = new Date();\n    const baseDateValue = new Date();\n\n    const dateInput = new JavaHashMap(new Map([[baseDateKey, baseDateValue]]));\n    const javaDateInput = new JavaHashMap(new Map([[new JavaDate(baseDateKey), new JavaDate(baseDateValue)]]));\n\n    [dateInput, javaDateInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[baseDateKey, baseDateValue]]));\n    });\n  });\n\n  test(\"with Boolean key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const booleanInput = new JavaHashMap(new Map([[false, true]]));\n    const javaBooleanInput = new JavaHashMap(new Map([[new JavaBoolean(false), new JavaBoolean(true)]]));\n\n    [booleanInput, javaBooleanInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[false, true]]));\n    });\n  });\n\n  test(\"with String key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const stringInput = new JavaHashMap(new Map([[\"foo\", \"bar\"]]));\n    const javaStringInput = new JavaHashMap(new Map([[new JavaString(\"foo\"), new JavaString(\"bar\")]]));\n\n    [stringInput, javaStringInput].forEach(input => {\n      const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n      const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new Map([[\"foo\", \"bar\"]]));\n    });\n  });\n\n  test(\"with JavaOptional key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaOptional(\"foo\"), new JavaOptional(\"bar\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaOptional(\"foo\"), new JavaOptional(\"bar\")]]));\n  });\n\n  test(\"with JavaBigDecimal key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaBigDecimal(\"1.1\"), new JavaBigDecimal(\"1.1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaBigDecimal(\"1.1\"), new JavaBigDecimal(\"1.1\")]]));\n  });\n\n  test(\"with JavaBigInteger key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaBigInteger(\"1\"), new JavaBigInteger(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaBigInteger(\"1\"), new JavaBigInteger(\"1\")]]));\n  });\n\n  test(\"with JavaLong key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaLong(\"1\"), new JavaLong(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaLong(\"1\"), new JavaLong(\"1\")]]));\n  });\n\n  test(\"with JavaByte key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaByte(\"1\"), new JavaByte(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaByte(\"1\"), new JavaByte(\"1\")]]));\n  });\n\n  test(\"with JavaDouble key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaDouble(\"1.1\"), new JavaDouble(\"1.1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaDouble(\"1.1\"), new JavaDouble(\"1.1\")]]));\n  });\n\n  test(\"with JavaFloat key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaFloat(\"1.1\"), new JavaFloat(\"1.1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaFloat(\"1.1\"), new JavaFloat(\"1.1\")]]));\n  });\n\n  test(\"with JavaInteger key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaInteger(\"1\"), new JavaInteger(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaInteger(\"1\"), new JavaInteger(\"1\")]]));\n  });\n\n  test(\"with JavaShort key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaShort(\"1\"), new JavaShort(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaShort(\"1\"), new JavaShort(\"1\")]]));\n  });\n\n  test(\"with JavaShort key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[new JavaShort(\"1\"), new JavaShort(\"1\")]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[new JavaShort(\"1\"), new JavaShort(\"1\")]]));\n  });\n\n  test(\"with custom object key and value, should unmarshall correctly\", () => {\n    const oracle = new Map([[\"com.app.my.DummyPojo\", () => new DummyPojo({} as any)]]);\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(\n      new Map([\n        [new DummyPojo({ foo: \"bar11\" }), new DummyPojo({ foo: \"bar12\" })],\n        [new DummyPojo({ foo: \"bar21\" }), new DummyPojo({ foo: \"bar22\" })]\n      ])\n    );\n\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(oracle));\n\n    expect(output).toEqual(\n      new Map([\n        [new DummyPojo({ foo: \"bar11\" }), new DummyPojo({ foo: \"bar12\" })],\n        [new DummyPojo({ foo: \"bar21\" }), new DummyPojo({ foo: \"bar22\" })]\n      ])\n    );\n  });\n\n  test(\"with undefined key and value, should unmarshall correctly\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n\n    const input = new JavaHashMap(new Map([[undefined, undefined]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new Map([[undefined, undefined]]));\n  });\n\n  test(\"with custom pojo containing cached key, should reuse cached objects and don't recreate data\", () => {\n    const marshaller = new DefaultMarshaller();\n    const oracle: Map<string, () => Portable<any>> = new Map([\n      [\"com.app.my.DummyPojo\", () => new DummyPojo({} as any) as any],\n      [\"com.app.my.ComplexPojo\", () => new ComplexPojo({} as any) as any]\n    ]);\n\n    const repeatedPojo = new DummyPojo({ foo: \"repeatedKey\" });\n\n    const input = new ComplexPojo({\n      dummy: repeatedPojo,\n      map: new Map([[repeatedPojo, \"value1\"], [new DummyPojo({ foo: \"uniqueKey\" }), \"value2\"]])\n    });\n\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n    const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle))! as ComplexPojo;\n\n    // ===== assertions\n\n    // successfully unmarshalled\n    expect(output).toEqual(input);\n\n    // same object for the cached one\n    const repeatedPojoFromKey = output.map.keys().next().value;\n    expect(output.dummy).toBe(repeatedPojoFromKey);\n  });\n\n  test(\"with map containing repeated value, should reuse cached objects and don't recreate data\", () => {\n    const marshaller = new JavaHashMapMarshaller();\n    const oracle: Map<string, () => Portable<any>> = new Map([\n      [\"com.app.my.DummyPojo\", () => new DummyPojo({} as any)]\n    ]);\n\n    const repeatedPojo = new DummyPojo({ foo: \"repeatedKey\" });\n    const input = new JavaHashMap(new Map([[\"k1\", repeatedPojo], [\"k2\", repeatedPojo]]));\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext())!;\n\n    const output = marshaller.unmarshall(marshalledInput, new UnmarshallingContext(oracle))!;\n\n    // ===== assertions\n\n    // successfully unmarshalled\n    expect(output).toEqual(new Map([[\"k1\", repeatedPojo], [\"k2\", repeatedPojo]]));\n\n    // same objects for the values\n    expect(output.get(\"k1\")!).toBe(output.get(\"k2\")!);\n  });\n\n  test(\"with null inside ErraiObject's value, should throw error\", () => {\n    const context = new UnmarshallingContext(new Map());\n    const marshaller = new JavaHashMapMarshaller();\n\n    const marshalledInput = new ValueBasedErraiObject(JavaType.HASH_MAP, null as any).asErraiObject();\n\n    expect(() => marshaller.unmarshall(marshalledInput!, context)).toThrowError();\n  });\n});\n\nclass DummyPojo implements Portable<DummyPojo> {\n  private readonly _fqcn = \"com.app.my.DummyPojo\";\n\n  public readonly foo: string;\n\n  constructor(self: { foo: string }) {\n    Object.assign(this, self);\n  }\n}\n\nclass ComplexPojo implements Portable<ComplexPojo> {\n  private readonly _fqcn = \"com.app.my.ComplexPojo\";\n\n  public dummy: DummyPojo;\n  public map: Map<DummyPojo, string>;\n\n  constructor(self: { dummy: DummyPojo; map: Map<DummyPojo, string> }) {\n    Object.assign(this, self);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaIntegerMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaInteger } from \"../../../java-wrappers\";\nimport { JavaIntegerMarshaller } from \"../JavaIntegerMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular integer, should return the same value\", () => {\n    const input = new JavaInteger(\"2\");\n\n    const output = new JavaIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(2);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaIntegerMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  describe(\"number input\", () => {\n    test(\"with integer, should return a JavaInteger instance\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const output = marshaller.notNullUnmarshall(input, context);\n\n      expect(output).toEqual(new JavaInteger(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n  });\n\n  describe(\"ErraiObject input\", () => {\n    test(\"with integer, should return a JavaInteger instance\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n      expect(output).toEqual(new JavaInteger(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaIntegerMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaLongMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaLong } from \"../../../java-wrappers\";\nimport { JavaLongMarshaller } from \"../JavaLongMarshaller\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\nimport { JavaIntegerMarshaller } from \"../JavaIntegerMarshaller\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular long, should should serialize it normally\", () => {\n    const input = new JavaLong(\"2\");\n\n    const output = new JavaLongMarshaller().marshall(input, new MarshallingContext());\n\n    const expected = new NumValBasedErraiObject(JavaType.LONG, \"2\").asErraiObject();\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaLongMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaLongMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with regular input, should return a JavaLong instance\", () => {\n    const marshaller = new JavaLongMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = new JavaLong(\"125\");\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n    expect(output.get()).toEqual(input.get());\n  });\n\n  test(\"with float string value, should throw error\", () => {\n    const marshaller = new JavaIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"1.2\";\n    const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with non numeric string value, should throw error\", () => {\n    const marshaller = new JavaIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = \"abc\" as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with null value, should throw error\", () => {\n    const marshaller = new JavaIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = null as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n\n  test(\"with undefined value, should throw error\", () => {\n    const marshaller = new JavaIntegerMarshaller();\n    const context = new UnmarshallingContext(new Map());\n\n    const input = undefined as any;\n    const marshalledInput = new NumValBasedErraiObject(JavaType.INTEGER, input).asErraiObject();\n\n    expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaOptionalMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../../java-wrappers\";\nimport { ErraiObjectConstants } from \"../../model/ErraiObjectConstants\";\nimport { MarshallerProvider } from \"../../MarshallerProvider\";\nimport { Portable } from \"../../Portable\";\nimport { JavaOptionalMarshaller } from \"../JavaOptionalMarshaller\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { ValueBasedErraiObject } from \"../../model/ValueBasedErraiObject\";\nimport { NumberUtils } from \"../../../util/NumberUtils\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  const encodedType = ErraiObjectConstants.ENCODED_TYPE;\n  const objectId = ErraiObjectConstants.OBJECT_ID;\n  const value = ErraiObjectConstants.VALUE;\n\n  let context: MarshallingContext;\n\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n    context = new MarshallingContext();\n  });\n\n  test(\"with empty optional, should serialize normally\", () => {\n    const input = new JavaOptional<string>(undefined);\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual(new ValueBasedErraiObject(JavaType.OPTIONAL, null).asErraiObject());\n  });\n\n  test(\"with JavaNumber optional, should wrap element into an errai object\", () => {\n    const input = new JavaOptional<JavaInteger>(new JavaInteger(\"1\"));\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual(\n      new ValueBasedErraiObject(\n        JavaType.OPTIONAL,\n        new NumValBasedErraiObject(JavaType.INTEGER, 1).asErraiObject()\n      ).asErraiObject()\n    );\n  });\n\n  test(\"with JavaBoolean optional, should wrap element into an errai object\", () => {\n    const input = new JavaOptional<JavaBoolean>(new JavaBoolean(false));\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual(\n      new ValueBasedErraiObject(\n        JavaType.OPTIONAL,\n        new NumValBasedErraiObject(JavaType.BOOLEAN, false).asErraiObject()\n      ).asErraiObject()\n    );\n  });\n\n  test(\"with JavaBigNumber optional, should serialize element normally\", () => {\n    const input = new JavaOptional<JavaBigInteger>(new JavaBigInteger(\"1\"));\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.OPTIONAL,\n      [objectId]: \"-1\",\n      [value]: {\n        [encodedType]: JavaType.BIG_INTEGER,\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        [value]: \"1\"\n      }\n    });\n  });\n\n  test(\"with custom object optional, should serialize element normally\", () => {\n    const input = new JavaOptional<MyPortable>(new MyPortable({ foo: \"foo1\", bar: \"bar1\" }));\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toStrictEqual({\n      [encodedType]: JavaType.OPTIONAL,\n      [objectId]: \"-1\",\n      [value]: {\n        [encodedType]: \"com.portable.my\",\n        [objectId]: expect.stringMatching(NumberUtils.nonNegativeIntegerRegex),\n        foo: \"foo1\",\n        bar: \"bar1\"\n      }\n    });\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaOptionalMarshaller().marshall(input, context);\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  test(\"with empty optional, should return an empty optional\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<string>(undefined);\n    const marshalledInput = marshaller.marshall(input, new MarshallingContext());\n\n    const output = marshaller.unmarshall(marshalledInput!, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(input);\n  });\n\n  test(\"with Array input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const arrayInput = new JavaOptional<string[]>([\"str1\", \"str2\"]);\n    const arrayListInput = new JavaOptional<JavaArrayList<string>>(new JavaArrayList([\"str1\", \"str2\"]));\n\n    [arrayInput, arrayListInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional([\"str1\", \"str2\"]));\n    });\n  });\n\n  test(\"with Set input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const setInput = new JavaOptional<Set<string>>(new Set([\"str1\", \"str2\"]));\n    const hashSetInput = new JavaOptional<JavaHashSet<string>>(new JavaHashSet(new Set([\"str1\", \"str2\"])));\n\n    [setInput, hashSetInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional(new Set([\"str1\", \"str2\"])));\n    });\n  });\n\n  test(\"with Map input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const mapInput = new JavaOptional<Map<string, string>>(new Map([[\"str1\", \"str2\"]]));\n    const hashMapInput = new JavaOptional<JavaHashMap<string, string>>(new JavaHashMap(new Map([[\"str1\", \"str2\"]])));\n\n    [mapInput, hashMapInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional(new Map([[\"str1\", \"str2\"]])));\n    });\n  });\n\n  test(\"with Date input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const baseDate = new Date();\n\n    const dateInput = new JavaOptional<Date>(new Date(baseDate));\n    const javaDateInput = new JavaOptional<JavaDate>(new JavaDate(baseDate));\n\n    [dateInput, javaDateInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional<Date>(new Date(baseDate)));\n    });\n  });\n\n  test(\"with Boolean input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const booleanInput = new JavaOptional<boolean>(false);\n    const javaBooleanInput = new JavaOptional<JavaBoolean>(new JavaBoolean(false));\n\n    [booleanInput, javaBooleanInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional<boolean>(false));\n    });\n  });\n\n  test(\"with String input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const stringInput = new JavaOptional<string>(\"foo\");\n    const javaStringInput = new JavaOptional<JavaString>(new JavaString(\"foo\"));\n\n    [stringInput, javaStringInput].forEach(input => {\n      const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n      expect(output).toEqual(new JavaOptional<string>(\"foo\"));\n    });\n  });\n\n  test(\"with JavaOptional input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional(new JavaOptional<string>(\"foo\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional(new JavaOptional<string>(\"foo\")));\n  });\n\n  test(\"with JavaBigDecimal input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaBigDecimal>(new JavaBigDecimal(\"1.1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaBigDecimal>(new JavaBigDecimal(\"1.1\")));\n  });\n\n  test(\"with JavaBigInteger should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaBigInteger>(new JavaBigInteger(\"1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaBigInteger>(new JavaBigInteger(\"1\")));\n  });\n\n  test(\"with JavaLong input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaLong>(new JavaLong(\"1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaLong>(new JavaLong(\"1\")));\n  });\n\n  test(\"with JavaByte input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaByte>(new JavaByte(\"1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaByte>(new JavaByte(\"1\")));\n  });\n\n  test(\"with JavaDouble input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaDouble>(new JavaDouble(\"1.1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaDouble>(new JavaDouble(\"1.1\")));\n  });\n\n  test(\"with JavaFloat input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaFloat>(new JavaFloat(\"1.1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaFloat>(new JavaFloat(\"1.1\")));\n  });\n\n  test(\"with JavaInteger input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaInteger>(new JavaInteger(\"1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaInteger>(new JavaInteger(\"1\")));\n  });\n\n  test(\"with JavaShort input, should unmarshall correctly\", () => {\n    const marshaller = new JavaOptionalMarshaller();\n\n    const input = new JavaOptional<JavaShort>(new JavaShort(\"1\"));\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(new JavaOptional<JavaShort>(new JavaShort(\"1\")));\n  });\n\n  test(\"with custom object optional, should unmarshall correctly\", () => {\n    const oracle = new Map([[\"com.portable.my\", () => new MyPortable({} as any)]]);\n    const marshaller = new JavaOptionalMarshaller();\n\n    const pojoInput = new MyPortable({ foo: \"foo1\", bar: \"bar1\" });\n    const optionalInput = new JavaOptional<MyPortable>(pojoInput);\n\n    const marshalledInput = marshaller.notNullMarshall(optionalInput, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(oracle));\n\n    expect(output).toEqual(new JavaOptional<MyPortable>(pojoInput));\n  });\n\n  test(\"with root null object, should unmarshall to null\", () => {\n    const input = null as any;\n\n    const output = new JavaOptionalMarshaller().unmarshall(input, new UnmarshallingContext(new Map()));\n\n    expect(output).toBeUndefined();\n  });\n\n  test(\"with root undefined object, should unmarshall to undefined\", () => {\n    const input = undefined as any;\n\n    const output = new JavaOptionalMarshaller().unmarshall(input, new UnmarshallingContext(new Map()));\n\n    expect(output).toBeUndefined();\n  });\n});\n\nclass MyPortable implements Portable<MyPortable> {\n  private readonly _fqcn = \"com.portable.my\";\n\n  public readonly foo: string;\n  public readonly bar: string;\n\n  constructor(self: { foo: string; bar: string }) {\n    Object.assign(this, self);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaShortMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaShort } from \"../../../java-wrappers\";\nimport { JavaShortMarshaller } from \"../JavaShortMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../java-wrappers/JavaType\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular short, should return the same value\", () => {\n    const input = new JavaShort(\"2\");\n\n    const output = new JavaShortMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(2);\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaShortMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaShortMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  describe(\"number input\", () => {\n    test(\"with short, should return a JavaShort instance\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const output = marshaller.notNullUnmarshall(input, context);\n\n      expect(output).toEqual(new JavaShort(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n\n      expect(() => marshaller.notNullUnmarshall(input, context)).toThrowError();\n    });\n  });\n\n  describe(\"ErraiObject input\", () => {\n    test(\"with short, should return a JavaShort instance\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      const output = marshaller.notNullUnmarshall(marshalledInput, context);\n\n      expect(output).toEqual(new JavaShort(\"1\"));\n    });\n\n    test(\"with float, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = 1.2;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with string, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = \"abc\" as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with null, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = null as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n\n    test(\"with undefined, should throw error\", () => {\n      const marshaller = new JavaShortMarshaller();\n      const context = new UnmarshallingContext(new Map());\n\n      const input = undefined as any;\n      const marshalledInput = new NumValBasedErraiObject(JavaType.SHORT, input).asErraiObject();\n\n      expect(() => marshaller.notNullUnmarshall(marshalledInput, context)).toThrowError();\n    });\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/__tests__/JavaStringMarshaller.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { JavaString } from \"../../../java-wrappers\";\nimport { JavaStringMarshaller } from \"../JavaStringMarshaller\";\nimport { UnmarshallingContext } from \"../../UnmarshallingContext\";\n\ndescribe(\"marshall\", () => {\n  test(\"with regular string, should return the same value\", () => {\n    const input = new JavaString(\"str\");\n\n    const output = new JavaStringMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(\"str\");\n  });\n\n  test(\"root null object, should serialize to null\", () => {\n    const input = null as any;\n\n    const output = new JavaStringMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n\n  test(\"root undefined object, should serialize to null\", () => {\n    const input = undefined as any;\n\n    const output = new JavaStringMarshaller().marshall(input, new MarshallingContext());\n\n    expect(output).toBeNull();\n  });\n});\n\ndescribe(\"unmarshall\", () => {\n  test(\"with string value, should return same string\", () => {\n    const marshaller = new JavaStringMarshaller();\n\n    const input = new JavaString(\"foo\");\n\n    const marshalledInput = marshaller.notNullMarshall(input, new MarshallingContext());\n\n    const output = marshaller.notNullUnmarshall(marshalledInput, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(\"foo\");\n  });\n\n  test(\"with JavaString value, should return inner string\", () => {\n    const marshaller = new JavaStringMarshaller();\n\n    const input = new JavaString(\"foo\");\n\n    const output = marshaller.notNullUnmarshall(input, new UnmarshallingContext(new Map()));\n\n    expect(output).toEqual(\"foo\");\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/util/GenericsTypeMarshallingUtils.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumberWrapper } from \"../../../java-wrappers/NumberWrapper\";\nimport { JavaBoolean } from \"../../../java-wrappers\";\nimport { Portable } from \"../../../marshalling/Portable\";\nimport { ErraiObject } from \"../../model/ErraiObject\";\nimport { MarshallingContext } from \"../../MarshallingContext\";\nimport { MarshallerProvider } from \"../../MarshallerProvider\";\nimport { JavaWrapperUtils } from \"../../../java-wrappers/JavaWrapperUtils\";\nimport { NumValBasedErraiObject } from \"../../model/NumValBasedErraiObject\";\n\nexport class GenericsTypeMarshallingUtils {\n  private static shouldWrapAsGenericsType(value: Portable<any>) {\n    return value instanceof NumberWrapper || value instanceof JavaBoolean;\n  }\n\n  private static wrapGenericsTypeElement(value: Portable<any>, marshalledValue: any): ErraiObject {\n    // This is mandatory in order to comply with errai-marshalling protocol.\n    // When marshalling numeric or boolean values, we use its raw value, without any ErraiObject envelope.\n    // But, when the value is a generic type, we always wrap it inside an ErraiObject\n    return new NumValBasedErraiObject((value as any)._fqcn, marshalledValue).asErraiObject();\n  }\n\n  public static marshallGenericsTypeElement(value: any, ctx: MarshallingContext): ErraiObject {\n    // apply automatic native types -> java types conversion\n    const enhancedInput = JavaWrapperUtils.wrapIfNeeded(value);\n\n    const marshaller = MarshallerProvider.getForObject(enhancedInput);\n    const marshalledValue = marshaller.marshall(enhancedInput, ctx);\n\n    if (this.shouldWrapAsGenericsType(enhancedInput)) {\n      return this.wrapGenericsTypeElement(enhancedInput, marshalledValue)!;\n    }\n\n    return marshalledValue;\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/marshallers/util/__tests__/GenericsTypeMarshallingUtils.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  JavaArrayList,\n  JavaBigDecimal,\n  JavaBigInteger,\n  JavaBoolean,\n  JavaByte,\n  JavaDate,\n  JavaDouble,\n  JavaFloat,\n  JavaHashMap,\n  JavaHashSet,\n  JavaInteger,\n  JavaLong,\n  JavaOptional,\n  JavaShort,\n  JavaString\n} from \"../../../../java-wrappers\";\nimport { GenericsTypeMarshallingUtils } from \"../GenericsTypeMarshallingUtils\";\nimport { MarshallingContext } from \"../../../MarshallingContext\";\nimport { JavaArrayListMarshaller, JavaHashSetMarshaller } from \"../../JavaCollectionMarshaller\";\nimport { ErraiObjectConstants } from \"../../../model/ErraiObjectConstants\";\nimport { MarshallerProvider } from \"../../../MarshallerProvider\";\nimport { JavaBigDecimalMarshaller } from \"../../JavaBigDecimalMarshaller\";\nimport { JavaBigIntegerMarshaller } from \"../../JavaBigIntegerMarshaller\";\nimport { JavaHashMapMarshaller } from \"../../JavaHashMapMarshaller\";\nimport { JavaLongMarshaller } from \"../../JavaLongMarshaller\";\nimport { JavaStringMarshaller } from \"../../JavaStringMarshaller\";\nimport { JavaDateMarshaller } from \"../../JavaDateMarshaller\";\nimport { DefaultMarshaller } from \"../../DefaultMarshaller\";\nimport { Portable } from \"../../../Portable\";\nimport { JavaOptionalMarshaller } from \"../../JavaOptionalMarshaller\";\nimport { NumValBasedErraiObject } from \"../../../model/NumValBasedErraiObject\";\nimport { JavaType } from \"../../../../java-wrappers/JavaType\";\n\ndescribe(\"marshallGenericsTypeElement\", () => {\n  const objectId = ErraiObjectConstants.OBJECT_ID;\n\n  beforeEach(() => {\n    MarshallerProvider.initialize();\n  });\n\n  test(\"with array input, should marshall with regular marshalling\", () => {\n    const baseArray = [\"str1\", \"str2\"];\n\n    const arrayInput = {\n      input: baseArray,\n      inputAsJavaArrayList: new JavaArrayList(baseArray)\n    };\n\n    const javaArrayListInput = {\n      input: new JavaArrayList(baseArray),\n      inputAsJavaArrayList: new JavaArrayList(baseArray)\n    };\n\n    [arrayInput, javaArrayListInput].forEach(({ input, inputAsJavaArrayList }) => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n      const expected = new JavaArrayListMarshaller().marshall(inputAsJavaArrayList, new MarshallingContext())!;\n\n      // don't care about the ids\n      delete output[objectId];\n      delete expected[objectId];\n\n      expect(output).toStrictEqual(expected);\n    });\n  });\n\n  test(\"with Set input, should marshall with regular marshalling\", () => {\n    const baseSet = new Set([\"str1\", \"str2\"]);\n\n    const setInput = {\n      input: baseSet,\n      inputAsJavaHashSet: new JavaHashSet(baseSet)\n    };\n\n    const javaHashSetInput = {\n      input: new JavaHashSet(baseSet),\n      inputAsJavaHashSet: new JavaHashSet(baseSet)\n    };\n\n    [setInput, javaHashSetInput].forEach(({ input, inputAsJavaHashSet }) => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n      const expected = new JavaHashSetMarshaller().marshall(inputAsJavaHashSet, new MarshallingContext())!;\n\n      // don't care about the ids\n      delete output[objectId];\n      delete expected[objectId];\n\n      expect(output).toStrictEqual(expected);\n    });\n  });\n\n  test(\"with JavaBigDecimal input, should marshall with regular marshalling\", () => {\n    const input = new JavaBigDecimal(\"1.1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    const expected = new JavaBigDecimalMarshaller().marshall(input, new MarshallingContext())!;\n\n    // don't care about the ids\n    delete output[objectId];\n    delete expected[objectId];\n\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"with JavaBigInteger input, should marshall with regular marshalling\", () => {\n    const input = new JavaBigInteger(\"1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    const expected = new JavaBigIntegerMarshaller().marshall(input, new MarshallingContext())!;\n\n    // don't care about the ids\n    delete output[objectId];\n    delete expected[objectId];\n\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"with map input, should marshall with regular marshalling\", () => {\n    const baseMap = new Map([[\"foo1\", \"bar1\"], [\"foo2\", \"bar2\"]]);\n\n    const mapInput = { input: baseMap, inputAsJavaHashMap: new JavaHashMap(baseMap) };\n\n    const javaHashMapInput = {\n      input: new JavaHashMap(baseMap),\n      inputAsJavaHashMap: new JavaHashMap(baseMap)\n    };\n\n    [mapInput, javaHashMapInput].forEach(({ input, inputAsJavaHashMap }) => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n      const expected = new JavaHashMapMarshaller().marshall(inputAsJavaHashMap, new MarshallingContext())!;\n\n      // don't care about the ids\n      delete output[objectId];\n      delete expected[objectId];\n\n      expect(output).toStrictEqual(expected);\n    });\n  });\n\n  test(\"with JavaLong input, should marshall with regular marshalling\", () => {\n    const input = new JavaLong(\"1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    const expected = new JavaLongMarshaller().marshall(input, new MarshallingContext())!;\n\n    // don't care about the ids\n    delete output[objectId];\n    delete expected[objectId];\n\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"with string input, should marshall with regular marshalling\", () => {\n    const stringInput = {\n      input: \"str\",\n      inputAsJavaString: new JavaString(\"str\")\n    };\n\n    const javaStringInput = {\n      input: new JavaString(\"str\"),\n      inputAsJavaString: new JavaString(\"str\")\n    };\n\n    [stringInput, javaStringInput].forEach(({ input, inputAsJavaString }) => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n      const expected = new JavaStringMarshaller().marshall(inputAsJavaString, new MarshallingContext())!;\n\n      expect(output).toStrictEqual(expected);\n    });\n  });\n\n  test(\"with date input, should marshall with regular marshalling\", () => {\n    const baseDate = new Date();\n\n    const dateInput = {\n      input: baseDate,\n      inputAsJavaDate: new JavaDate(baseDate)\n    };\n\n    const javaDateInput = {\n      input: new JavaDate(baseDate),\n      inputAsJavaDate: new JavaDate(baseDate)\n    };\n\n    [dateInput, javaDateInput].forEach(({ input, inputAsJavaDate }) => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n      const expected = new JavaDateMarshaller().marshall(inputAsJavaDate, new MarshallingContext())!;\n\n      // don't care about the ids\n      delete output[objectId];\n      delete expected[objectId];\n\n      expect(output).toStrictEqual(expected);\n    });\n  });\n\n  test(\"with JavaOptional input, should marshall with regular marshalling\", () => {\n    const input = new JavaOptional<string>(\"str\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    const expected = new JavaOptionalMarshaller().marshall(input, new MarshallingContext())!;\n\n    // don't care about the ids\n    delete output[objectId];\n    delete expected[objectId];\n\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"with custom portable input, should marshall with regular marshalling\", () => {\n    const input = new Pojo(\"bar\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    const expected = new DefaultMarshaller().marshall(input, new MarshallingContext())!;\n\n    // don't care about the ids\n    delete output[objectId];\n    delete expected[objectId];\n\n    expect(output).toStrictEqual(expected);\n  });\n\n  test(\"with boolean input, should return input wrapped as an ErraiObject\", () => {\n    const booleanInput = false;\n    const javaBooleanInput = new JavaBoolean(false);\n\n    [booleanInput, javaBooleanInput].forEach(input => {\n      const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n\n      expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.BOOLEAN, false).asErraiObject());\n    });\n  });\n\n  test(\"with JavaByte input, should return input wrapped as an ErraiObject\", () => {\n    const input = new JavaByte(\"1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n    expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.BYTE, 1).asErraiObject());\n  });\n\n  test(\"with JavaDouble input, should return input wrapped as an ErraiObject\", () => {\n    const input = new JavaDouble(\"1.1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.DOUBLE, 1.1).asErraiObject());\n  });\n\n  test(\"with JavaFloat input, should return input wrapped as an ErraiObject\", () => {\n    const input = new JavaFloat(\"1.1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.FLOAT, 1.1).asErraiObject());\n  });\n\n  test(\"with JavaInteger input, should return input wrapped as an ErraiObject\", () => {\n    const input = new JavaInteger(\"1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.INTEGER, 1).asErraiObject());\n  });\n\n  test(\"with JavaShort input, should return input wrapped as an ErraiObject\", () => {\n    const input = new JavaShort(\"1\");\n\n    const output = GenericsTypeMarshallingUtils.marshallGenericsTypeElement(input, new MarshallingContext());\n\n    expect(output).toStrictEqual(new NumValBasedErraiObject(JavaType.SHORT, 1).asErraiObject());\n  });\n\n  class Pojo implements Portable<Pojo> {\n    private readonly _fqcn = \"com.app.my.Pojo\";\n\n    public foo: string;\n\n    constructor(foo: string) {\n      this.foo = foo;\n    }\n  }\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/EnumStringValueBasedErraiObject.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObject } from \"./ErraiObject\";\nimport { ErraiObjectConstants } from \"./ErraiObjectConstants\";\n\nexport class EnumStringValueBasedErraiObject {\n  public readonly encodedType: string;\n  public readonly enumValueName: string;\n\n  constructor(encodedType: string, enumValueName: string) {\n    this.encodedType = encodedType;\n    this.enumValueName = enumValueName;\n  }\n\n  public asErraiObject(): ErraiObject {\n    return {\n      [ErraiObjectConstants.ENCODED_TYPE]: this.encodedType,\n      [ErraiObjectConstants.ENUM_STRING_VALUE]: this.enumValueName\n    };\n  }\n\n  public static from(obj: ErraiObject): EnumStringValueBasedErraiObject {\n    return new EnumStringValueBasedErraiObject(\n      obj[ErraiObjectConstants.ENCODED_TYPE],\n      obj[ErraiObjectConstants.ENUM_STRING_VALUE]!\n    );\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/ErraiObject.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObjectConstants } from \"./ErraiObjectConstants\";\n\nexport interface ErraiObject {\n  [ErraiObjectConstants.ENCODED_TYPE]: string;\n  [ErraiObjectConstants.OBJECT_ID]?: string;\n  [ErraiObjectConstants.NUM_VAL]?: string | number | boolean;\n  [ErraiObjectConstants.VALUE]?: any;\n  [ErraiObjectConstants.ENUM_STRING_VALUE]?: string;\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/ErraiObjectConstants.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum ErraiObjectConstants {\n  ENCODED_TYPE = \"^EncodedType\",\n  OBJECT_ID = \"^ObjectID\",\n  NUM_VAL = \"^NumVal\",\n  VALUE = \"^Value\",\n  JSON = \"^${$JSON$}$::\",\n  NULL = \"^NullVal\",\n  ENUM_STRING_VALUE = \"^EnumStringValue\"\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/NumValBasedErraiObject.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObject } from \"./ErraiObject\";\nimport { ErraiObjectConstants } from \"./ErraiObjectConstants\";\n\nexport class NumValBasedErraiObject {\n  public readonly encodedType: string;\n  public readonly objId: string;\n  public readonly numVal: number | boolean | string;\n\n  constructor(encodedType: string, numVal: number | boolean | string, objectId: string = \"-1\") {\n    this.encodedType = encodedType;\n    this.numVal = numVal;\n    this.objId = objectId;\n  }\n\n  public asErraiObject(): ErraiObject {\n    return {\n      [ErraiObjectConstants.ENCODED_TYPE]: this.encodedType,\n      [ErraiObjectConstants.OBJECT_ID]: this.objId,\n      [ErraiObjectConstants.NUM_VAL]: this.numVal\n    };\n  }\n\n  public static from(obj: ErraiObject): NumValBasedErraiObject {\n    return new NumValBasedErraiObject(\n      obj[ErraiObjectConstants.ENCODED_TYPE],\n      obj[ErraiObjectConstants.NUM_VAL]!,\n      obj[ErraiObjectConstants.OBJECT_ID]\n    );\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/ValueBasedErraiObject.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObject } from \"./ErraiObject\";\nimport { ErraiObjectConstants } from \"./ErraiObjectConstants\";\n\nexport class ValueBasedErraiObject {\n  public readonly encodedType: string;\n  public readonly objId: string;\n  public readonly value: any;\n\n  constructor(encodedType: string, value: any, objectId: string = \"-1\") {\n    this.encodedType = encodedType;\n    this.value = value;\n    this.objId = objectId;\n  }\n\n  public asErraiObject(): ErraiObject {\n    return {\n      [ErraiObjectConstants.ENCODED_TYPE]: this.encodedType,\n      [ErraiObjectConstants.OBJECT_ID]: this.objId,\n      [ErraiObjectConstants.VALUE]: this.value\n    };\n  }\n\n  public static from(obj: ErraiObject): ValueBasedErraiObject {\n    return new ValueBasedErraiObject(\n      obj[ErraiObjectConstants.ENCODED_TYPE],\n      obj[ErraiObjectConstants.VALUE],\n      obj[ErraiObjectConstants.OBJECT_ID]\n    );\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/__tests__/EnumStringValueBasedErraiObject.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ErraiObjectConstants } from \"../ErraiObjectConstants\";\nimport { EnumStringValueBasedErraiObject } from \"../EnumStringValueBasedErraiObject\";\n\ndescribe(\"asErraiObject\", () => {\n  test(\"with correct inputs, should return correct a well formed Errai Object\", () => {\n    const input = new EnumStringValueBasedErraiObject(\"com.app.my\", \"foo\");\n\n    expect(input.asErraiObject()).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.ENUM_STRING_VALUE]: \"foo\"\n    });\n  });\n});\n\ndescribe(\"from\", () => {\n  test(\"with well formed errai object instance, should retrieve its data correctly\", () => {\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.ENUM_STRING_VALUE]: \"foo\"\n    };\n\n    const output = EnumStringValueBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.enumValueName).toEqual(\"foo\");\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/__tests__/NumValBasedErraiObject.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumValBasedErraiObject } from \"../NumValBasedErraiObject\";\nimport { ErraiObjectConstants } from \"../ErraiObjectConstants\";\nimport { isBoolean, isNumber, isString } from \"../../../util/TypeUtils\";\n\ndescribe(\"asErraiObject\", () => {\n  describe(\"with objectId filled\", () => {\n    test(\"with numeric numVal, should return correct a well formed Errai Object\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", 120, \"12\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"12\",\n        [ErraiObjectConstants.NUM_VAL]: 120\n      });\n    });\n\n    test(\"with boolean numVal, should return correct a well formed Errai Object\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", false, \"13\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"13\",\n        [ErraiObjectConstants.NUM_VAL]: false\n      });\n    });\n\n    test(\"with string numVal, should return correct a well formed Errai Object\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", \"str\", \"14\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"14\",\n        [ErraiObjectConstants.NUM_VAL]: \"str\"\n      });\n    });\n  });\n\n  describe(\"with objectId not filled\", () => {\n    test(\"with numeric numVal, should return correct a well formed Errai Object applying objId's default\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", 120);\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"-1\",\n        [ErraiObjectConstants.NUM_VAL]: 120\n      });\n    });\n\n    test(\"with boolean numVal, should return correct a well formed Errai Object applying objId's default\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", false);\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"-1\",\n        [ErraiObjectConstants.NUM_VAL]: false\n      });\n    });\n\n    test(\"with string numVal, should return correct a well formed Errai Object applying objId's default\", () => {\n      const input = new NumValBasedErraiObject(\"com.app.my\", \"str\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"-1\",\n        [ErraiObjectConstants.NUM_VAL]: \"str\"\n      });\n    });\n  });\n});\n\ndescribe(\"from\", () => {\n  test(\"with numeric NumVal based errai object instance, should retrieve its data correctly\", () => {\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"125\",\n      [ErraiObjectConstants.NUM_VAL]: 1\n    };\n\n    const output = NumValBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.objId).toEqual(\"125\");\n\n    expect(isNumber(output.numVal)).toBeTruthy();\n    expect(output.numVal).toBe(1);\n  });\n\n  test(\"with boolean NumVal based errai object instance, should retrieve its data correctly\", () => {\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"125\",\n      [ErraiObjectConstants.NUM_VAL]: false\n    };\n\n    const output = NumValBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.objId).toEqual(\"125\");\n\n    expect(isBoolean(output.numVal)).toBeTruthy();\n    expect(output.numVal).toBe(false);\n  });\n\n  test(\"with string NumVal based errai object instance, should retrieve its data correctly\", () => {\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"125\",\n      [ErraiObjectConstants.NUM_VAL]: \"str\"\n    };\n\n    const output = NumValBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.objId).toEqual(\"125\");\n\n    expect(isString(output.numVal)).toBeTruthy();\n    expect(output.numVal).toBe(\"str\");\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/marshalling/model/__tests__/ValueBasedErraiObject.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumValBasedErraiObject } from \"../NumValBasedErraiObject\";\nimport { ErraiObjectConstants } from \"../ErraiObjectConstants\";\nimport { ValueBasedErraiObject } from \"../ValueBasedErraiObject\";\n\ndescribe(\"asErraiObject\", () => {\n  describe(\"with objectId filled\", () => {\n    test(\"with string value, should return correct a well formed Errai Object\", () => {\n      const input = new ValueBasedErraiObject(\"com.app.my\", \"bla\", \"12\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"12\",\n        [ErraiObjectConstants.VALUE]: \"bla\"\n      });\n    });\n\n    test(\"with ErraiObject value, should return correct a well formed Errai Object\", () => {\n      const innerVal = new NumValBasedErraiObject(\"com.app.my\", false, \"2\").asErraiObject();\n\n      const input = new ValueBasedErraiObject(\"my.fqcn\", innerVal, \"13\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"my.fqcn\",\n        [ErraiObjectConstants.OBJECT_ID]: \"13\",\n        [ErraiObjectConstants.VALUE]: {\n          [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n          [ErraiObjectConstants.OBJECT_ID]: \"2\",\n          [ErraiObjectConstants.NUM_VAL]: false\n        }\n      });\n    });\n  });\n\n  describe(\"with objectId not filled\", () => {\n    test(\"with string value, should return correct a well formed Errai Object applying objId's default\", () => {\n      const input = new ValueBasedErraiObject(\"com.app.my\", \"bla\");\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n        [ErraiObjectConstants.OBJECT_ID]: \"-1\",\n        [ErraiObjectConstants.VALUE]: \"bla\"\n      });\n    });\n\n    test(\"with ErraiObject value, should return correct a well formed Errai Object applying objId's default\", () => {\n      const innerVal = new NumValBasedErraiObject(\"com.app.my\", false, \"2\").asErraiObject();\n\n      const input = new ValueBasedErraiObject(\"my.fqcn\", innerVal);\n\n      expect(input.asErraiObject()).toStrictEqual({\n        [ErraiObjectConstants.ENCODED_TYPE]: \"my.fqcn\",\n        [ErraiObjectConstants.OBJECT_ID]: \"-1\",\n        [ErraiObjectConstants.VALUE]: {\n          [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n          [ErraiObjectConstants.OBJECT_ID]: \"2\",\n          [ErraiObjectConstants.NUM_VAL]: false\n        }\n      });\n    });\n  });\n});\n\ndescribe(\"from\", () => {\n  test(\"with string Value based errai object instance, should retrieve its data correctly\", () => {\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"125\",\n      [ErraiObjectConstants.VALUE]: \"str\"\n    };\n\n    const output = ValueBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.objId).toEqual(\"125\");\n    expect(output.value).toBe(\"str\");\n  });\n\n  test(\"with ErraiObject Value based errai object instance, should retrieve its data correctly\", () => {\n    const innerVal = new NumValBasedErraiObject(\"com.app.my\", false, \"2\").asErraiObject();\n\n    const input = {\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"125\",\n      [ErraiObjectConstants.VALUE]: innerVal\n    };\n\n    const output = ValueBasedErraiObject.from(input);\n\n    expect(output.encodedType).toEqual(\"com.app.my\");\n    expect(output.objId).toEqual(\"125\");\n    expect(output.value).toStrictEqual({\n      [ErraiObjectConstants.ENCODED_TYPE]: \"com.app.my\",\n      [ErraiObjectConstants.OBJECT_ID]: \"2\",\n      [ErraiObjectConstants.NUM_VAL]: false\n    });\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/util/DomUtils.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport const AfComponentAttr = \"af-js-component\";\n\nexport function findChildContainers(container: HTMLElement): HTMLElement[] {\n  const searchResult = searchChildren({\n    root: container,\n    stopWhen: (elem: any) => Boolean(getAfComponentAttr(elem)),\n    accept: (elem: any) => Boolean(getAfComponentAttr(elem))\n  });\n\n  return searchResult.accepted;\n}\n\nconst flatten = <T extends any>(arr: T[][]) => ([] as T[]).concat(...arr);\n\nfunction searchParents(args: {\n  accept: (elem: HTMLElement) => boolean;\n  stop: (elem: HTMLElement) => boolean;\n  element: HTMLElement;\n}) {\n  let parent = args.element.parentElement;\n  while (parent) {\n    if (args.stop(parent)) {\n      return args.accept(parent);\n    }\n    parent = parent.parentElement;\n  }\n  return false;\n}\n\nfunction searchChildren(args: {\n  root: HTMLElement;\n  stopWhen: (elem: HTMLElement) => boolean;\n  accept: (elem: HTMLElement) => boolean;\n}) {\n  const { root, stopWhen, accept } = args;\n  let node: any;\n\n  const stack = [root];\n  stack.push(root);\n\n  const accepted = new Set();\n  const visited = new Set();\n\n  while (stack.length > 0) {\n    node = stack.pop()!;\n    if (node !== root && node instanceof HTMLElement && stopWhen(node)) {\n      if (accept(node)) {\n        accepted.add(node);\n      }\n      visited.add(node);\n    } else if (node.children && node.children.length) {\n      for (const child of node.children) {\n        stack.push(child);\n      }\n    }\n  }\n\n  return {\n    visited: Array.from(visited),\n    accepted: Array.from(accepted)\n  };\n}\n\nfunction getAfComponentAttr(container: HTMLElement) {\n  return container.getAttribute(AfComponentAttr);\n}\n"
  },
  {
    "path": "appformer-js/src/util/NumberUtils.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport class NumberUtils {\n  public static readonly nonNegativeIntegerRegex = new RegExp(/^\\d*$/);\n  public static readonly integerNumberRegex = new RegExp(/^(-)?\\d*$/);\n  public static readonly floatNumberRegex = new RegExp(/^(-)?(\\d*)(\\.)?(\\d*)$/);\n\n  public static isNonNegativeIntegerString(str: string): boolean {\n    return this.nonNegativeIntegerRegex.test(str);\n  }\n\n  public static isIntegerString(str: string): boolean {\n    return this.integerNumberRegex.test(str);\n  }\n\n  public static isFloatString(str: string): boolean {\n    return this.floatNumberRegex.test(str);\n  }\n}\n"
  },
  {
    "path": "appformer-js/src/util/TypeUtils.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport function isString(obj: any): boolean {\n  return typeof obj === \"string\" || obj instanceof String;\n}\n\nexport function instanceOfString(obj: any): obj is string {\n  return isString(obj);\n}\n\nexport function isArray<T>(obj: any): boolean {\n  return obj instanceof Array;\n}\n\nexport function instanceOfArray<T>(obj: any): obj is T[] {\n  return isArray(obj);\n}\n\nexport function isSet<T>(obj: any): boolean {\n  return obj instanceof Set;\n}\n\nexport function instanceOfSet<T>(obj: any): obj is Set<T> {\n  return isSet(obj);\n}\n\nexport function isMap<T, U>(obj: any): boolean {\n  return obj instanceof Map;\n}\n\nexport function instanceOfMap<T, U>(obj: any): obj is Map<T, U> {\n  return isMap(obj);\n}\n\nexport function isBoolean(obj: any): boolean {\n  return typeof obj === \"boolean\" || obj instanceof Boolean;\n}\n\nexport function instanceOfBoolean(obj: any): obj is boolean {\n  return isBoolean(obj);\n}\n\nexport function isDate(obj: any): boolean {\n  return obj instanceof Date;\n}\n\nexport function instanceOfDate(obj: any): obj is Date {\n  return isDate(obj);\n}\n\nexport function isNumber(obj: any): boolean {\n  return typeof obj === \"number\";\n}\n\nexport function instanceOfNumber(obj: any): obj is number {\n  return isNumber(obj);\n}\n"
  },
  {
    "path": "appformer-js/src/util/__tests__/NumberUtils.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { NumberUtils } from \"../NumberUtils\";\n\ndescribe(\"isNonNegativeIntegerString\", () => {\n  test(\"with non negative integer string, should return true\", () => {\n    const input = \"1\";\n\n    const output = NumberUtils.isNonNegativeIntegerString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with negative integer string, should return false\", () => {\n    const input = \"-1\";\n\n    const output = NumberUtils.isNonNegativeIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n\n  test(\"with non negative float string, should return false\", () => {\n    const input = \"1.1\";\n\n    const output = NumberUtils.isNonNegativeIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n\n  test(\"with non numeric string, should return false\", () => {\n    const input = \"abc\";\n\n    const output = NumberUtils.isNonNegativeIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isIntegerString\", () => {\n  test(\"with non negative integer string, should return true\", () => {\n    const input = \"1\";\n\n    const output = NumberUtils.isIntegerString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with negative integer string, should return true\", () => {\n    const input = \"-1\";\n\n    const output = NumberUtils.isIntegerString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non negative float string, should return false\", () => {\n    const input = \"1.1\";\n\n    const output = NumberUtils.isIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n\n  test(\"with negative float string, should return false\", () => {\n    const input = \"-1.1\";\n\n    const output = NumberUtils.isIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n\n  test(\"with non numeric string, should return false\", () => {\n    const input = \"abc\";\n\n    const output = NumberUtils.isIntegerString(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isFloatString\", () => {\n  test(\"with non negative integer string, should return true\", () => {\n    const input = \"1\";\n\n    const output = NumberUtils.isFloatString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with negative integer string, should return true\", () => {\n    const input = \"-1\";\n\n    const output = NumberUtils.isFloatString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non negative float string, should return true\", () => {\n    const input = \"1.1\";\n\n    const output = NumberUtils.isFloatString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with negative float string, should return true\", () => {\n    const input = \"-1.1\";\n\n    const output = NumberUtils.isFloatString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non numeric string, should return false\", () => {\n    const input = \"abc\";\n\n    const output = NumberUtils.isFloatString(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/util/__tests__/TypeUtils.test.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n  instanceOfArray,\n  instanceOfBoolean,\n  instanceOfDate,\n  instanceOfMap,\n  instanceOfNumber,\n  instanceOfSet,\n  instanceOfString,\n  isArray,\n  isBoolean,\n  isDate,\n  isMap,\n  isNumber,\n  isSet,\n  isString\n} from \"../TypeUtils\";\n\ndescribe(\"isString\", () => {\n  test(\"with direct assigned string, should return true\", () => {\n    const input = \"str\";\n\n    const output = isString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with string created via constructor, should return true\", () => {\n    const input = String(\"str\");\n\n    const output = isString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-string input, should return false\", () => {\n    const input = 1;\n\n    const output = isString(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfString\", () => {\n  test(\"with direct assigned string, should return true\", () => {\n    const input = \"str\";\n\n    const output = instanceOfString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with string created via constructor, should return true\", () => {\n    const input = String(\"str\");\n\n    const output = instanceOfString(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-string input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfString(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isArray\", () => {\n  test(\"with direct assigned array, should return true\", () => {\n    const input = [1, 2, 3];\n\n    const output = isArray(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with array created via constructor, should return true\", () => {\n    const input = new Array(1, 2, 3);\n\n    const output = isArray(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-array input, should return false\", () => {\n    const input = 1;\n\n    const output = isArray(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfArray\", () => {\n  test(\"with direct assigned array, should return true\", () => {\n    const input = [1, 2, 3];\n\n    const output = instanceOfArray(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with array created via constructor, should return true\", () => {\n    const input = new Array(1, 2, 3);\n\n    const output = instanceOfArray(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-array input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfArray(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isSet\", () => {\n  test(\"with set created via constructor, should return true\", () => {\n    const input = new Set([1, 2, 3]);\n\n    const output = isSet(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-set input, should return false\", () => {\n    const input = 1;\n\n    const output = isSet(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfSet\", () => {\n  test(\"with set created via constructor, should return true\", () => {\n    const input = new Set([1, 2, 3]);\n\n    const output = instanceOfSet(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-set input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfSet(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isMap\", () => {\n  test(\"with map created via constructor, should return true\", () => {\n    const input = new Map([[1, 2]]);\n\n    const output = isMap(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-set input, should return false\", () => {\n    const input = 1;\n\n    const output = isMap(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfMap\", () => {\n  test(\"with map created via constructor, should return true\", () => {\n    const input = new Map([[1, 2]]);\n\n    const output = instanceOfMap(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-set input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfMap(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isBoolean\", () => {\n  test(\"with direct assigned boolean, should return true\", () => {\n    const input = false;\n\n    const output = isBoolean(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with boolean created via constructor, should return true\", () => {\n    const input = Boolean(false);\n\n    const output = isBoolean(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-boolean input, should return false\", () => {\n    const input = 1;\n\n    const output = isBoolean(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfBoolean\", () => {\n  test(\"with direct assigned boolean, should return true\", () => {\n    const input = false;\n\n    const output = instanceOfBoolean(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with boolean created via constructor, should return true\", () => {\n    const input = Boolean(false);\n\n    const output = instanceOfBoolean(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-boolean input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfBoolean(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isDate\", () => {\n  test(\"with date created via constructor, should return true\", () => {\n    const input = new Date();\n\n    const output = isDate(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-date input, should return false\", () => {\n    const input = 1;\n\n    const output = isDate(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfDate\", () => {\n  test(\"with date created via constructor, should return true\", () => {\n    const input = new Date();\n\n    const output = instanceOfDate(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-date input, should return false\", () => {\n    const input = 1;\n\n    const output = instanceOfDate(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"isNumber\", () => {\n  test(\"with direct assigned number, should return true\", () => {\n    const input = 1;\n\n    const output = isNumber(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with number created via constructor, should return true\", () => {\n    const input = Number(1);\n\n    const output = isNumber(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-number input, should return false\", () => {\n    const input = true;\n\n    const output = isNumber(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n\ndescribe(\"instanceOfNumber\", () => {\n  test(\"with direct assigned number, should return true\", () => {\n    const input = 1;\n\n    const output = instanceOfNumber(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with number created via constructor, should return true\", () => {\n    const input = Number(1);\n\n    const output = instanceOfNumber(input);\n\n    expect(output).toBeTruthy();\n  });\n\n  test(\"with non-number input, should return false\", () => {\n    const input = true;\n\n    const output = instanceOfNumber(input);\n\n    expect(output).toBeFalsy();\n  });\n});\n"
  },
  {
    "path": "appformer-js/src/util/index.ts",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./DomUtils\";\n"
  },
  {
    "path": "appformer-js/tsconfig.json",
    "content": "{\n  \"exclude\": [\n    \"./node_modules\"\n  ],\n  \"include\": [\n    \"./src\"\n  ],\n  \"compilerOptions\": {\n    \"outDir\": \"./\",\n    \"lib\": [\n      \"es6\",\n      \"dom\"\n    ],\n    \"target\": \"es5\",\n    \"declaration\": true,\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"strictNullChecks\": true,\n    \"experimentalDecorators\": true,\n    \"jsx\": \"react\"\n  }\n}\n"
  },
  {
    "path": "appformer-js/tsconfig.webpack.json",
    "content": "{\n  \"exclude\": [\"./node_modules\", \"./src/**/__tests__\"],\n  \"extends\": \"./tsconfig.json\"\n}\n"
  },
  {
    "path": "appformer-js/tslint.json",
    "content": "{\n  \"defaultSeverity\": \"error\",\n  \"extends\": [\n    \"tslint:recommended\",\n    \"tslint-react\",\n    \"tslint-config-prettier\"\n  ],\n  \"jsRules\": {},\n  \"rules\": {\n    \"jsx-no-multiline-js\": false,\n    \"ordered-imports\": false,\n    \"object-literal-sort-keys\": false,\n    \"no-console\": false,\n    \"interface-name\": [\n      true,\n      \"never-prefix\"\n    ],\n    \"max-classes-per-file\": false,\n    \"jsx-no-lambda\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"constructor\",\n          \"instance-method\",\n          \"static-method\"\n        ]\n      }\n    ],\n    \"variable-name\": [\n      true,\n      \"ban-keywords\",\n      \"check-format\",\n      \"allow-snake-case\",\n      \"allow-pascal-case\",\n      \"allow-leading-underscore\"\n    ],\n    \"comment-format\": false\n  },\n  \"rulesDirectory\": []\n}\n"
  },
  {
    "path": "appformer-js/webpack.config.js",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CleanWebpackPlugin = require(\"clean-webpack-plugin\");\nconst CircularDependencyPlugin = require(\"circular-dependency-plugin\");\n\nmodule.exports = {\n  mode: \"development\",\n  entry: {\n    \"appformer-js\": \"./src/index.ts\"\n  },\n  output: {\n    path: path.resolve(__dirname, \"./dist\"),\n    filename: \"appformer.js\",\n    library: \"AppFormer\",\n    libraryTarget: \"umd\",\n    umdNamedDefine: true\n  },\n  externals: {\n    react: {\n      root: \"React\", //indicates global variable\n      commonjs: \"react\",\n      commonjs2: \"react\",\n      amd: \"react\"\n    },\n    \"react-dom\": {\n      root: \"ReactDOM\", //indicates global variable\n      commonjs: \"react-dom\",\n      commonjs2: \"react-dom\",\n      amd: \"react-dom\"\n    }\n  },\n  plugins: [\n    new CleanWebpackPlugin([\"dist\"]),\n    new CircularDependencyPlugin({\n      exclude: /node_modules/, // exclude detection of files based on a RegExp\n      failOnError: false, // add errors to webpack instead of warnings\n      cwd: process.cwd() // set the current working directory for displaying module paths\n    })\n  ],\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        loader: \"ts-loader\",\n        options: {\n          configFile: path.resolve(\"./tsconfig.webpack.json\")\n        }\n      },\n      {\n        test: /\\.jsx?$/,\n        exclude: /node_modules/,\n        use: [\"babel-loader\"]\n      }\n    ]\n  },\n  resolve: {\n    extensions: [\".tsx\", \".ts\", \".js\", \".jsx\"],\n    modules: [path.resolve(\"../../node_modules\"), path.resolve(\"./node_modules\"), path.resolve(\"./src\")]\n  }\n};\n"
  },
  {
    "path": "appformer-js-bridge/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n  <artifactId>appformer-js-bridge</artifactId>\n\n  <packaging>jar</packaging>\n  <name>AppFormer JS Bridge</name>\n\n  <description>AppFormer JS Bridge</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-core</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>base</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-api-mockito2</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-module-junit4</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack-appformer-js</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.uberfire</groupId>\n                  <artifactId>appformer-js</artifactId>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/appformer-js</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <includes>**/appformer.js</includes>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-react</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.npm</groupId>\n                  <artifactId>react</artifactId>\n                  <version>${version.org.webjars.npm.react}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/react</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-react-dom</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.npm</groupId>\n                  <artifactId>react-dom</artifactId>\n                  <version>${version.org.webjars.npm.react-dom}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/react-dom</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n        </executions>\n\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>copy-appformer-js</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/jsbridge/public</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/appformer-js/META-INF/resources/webjars/appformer-js/${project.version}</directory>\n                  <includes>\n                    <include>appformer.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-react</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/jsbridge/public</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/react/META-INF/resources/webjars/react/${version.org.webjars.npm.react}/umd</directory>\n                  <includes>\n                    <include>react.production.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-react-dom</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/jsbridge/public</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/react-dom/META-INF/resources/webjars/react-dom/${version.org.webjars.npm.react-dom}/umd</directory>\n                  <includes>\n                    <include>react-dom.production.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/AppFormerJsBridge.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client;\n\nimport java.lang.annotation.Annotation;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Callback;\nimport com.google.gwt.core.client.ScriptInjector;\nimport elemental2.dom.DomGlobal;\nimport elemental2.promise.IThenable;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.bus.client.ErraiBus;\nimport org.jboss.errai.bus.client.api.base.MessageBuilder;\nimport org.jboss.errai.enterprise.client.cdi.api.CDI;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.marshalling.client.Marshalling;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.jsbridge.client.loading.AppFormerJsActivityLoader;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static java.util.Arrays.stream;\n\n@Dependent\npublic class AppFormerJsBridge {\n\n    private final Workbench workbench;\n    private final AppFormerJsActivityLoader appFormerJsLoader;\n    private final Promises promises;\n\n    @Inject\n    public AppFormerJsBridge(final Workbench workbench,\n                             final AppFormerJsActivityLoader appFormerJsLoader,\n                             final Promises promises) {\n\n        this.workbench = workbench;\n        this.appFormerJsLoader = appFormerJsLoader;\n        this.promises = promises;\n    }\n\n    public void init(final String gwtModuleName) {\n\n        workbench.addStartupBlocker(AppFormerJsBridge.class);\n\n        exposeBridgeAsNativeJs();\n\n        loadAppFormerJsAndReactScripts(gwtModuleName).then(i -> {\n            try {\n                appFormerJsLoader.init(gwtModuleName);\n            } finally {\n                workbench.removeStartupBlocker(AppFormerJsBridge.class);\n            }\n\n            return promises.resolve();\n        }).catch_(e -> {\n            workbench.removeStartupBlocker(AppFormerJsBridge.class);\n            return promises.resolve();\n        });\n    }\n\n    public void exposeBridgeAsNativeJs() {\n        exposeBridge();\n    }\n\n    public Promise<Void> loadAppFormerJsAndReactScripts(final String gwtModuleName) {\n        return promises.create((res, rej) -> {\n\n            final Consumer<Exception> onError = ex -> {\n                workbench.removeStartupBlocker(AppFormerJsBridge.class);\n                rej.onInvoke(null);\n            };\n\n            final CallbackProducer<Void> callback = new CallbackProducer<>(onError);\n            ScriptInjector.fromUrl(gwtModuleName + \"/react.production.min.js\")\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .setCallback(callback.withSuccess((v) -> ScriptInjector.fromUrl(gwtModuleName + \"/react-dom.production.min.js\")\n                            .setWindow(ScriptInjector.TOP_WINDOW)\n                            .setCallback(callback.withSuccess((v1) -> ScriptInjector.fromUrl(gwtModuleName + \"/appformer.js\")\n                                    .setWindow(ScriptInjector.TOP_WINDOW)\n                                    .setCallback(callback.withSuccess((v2) -> ScriptInjector.fromUrl(gwtModuleName + \"/AppFormerComponentsRegistry.js\")\n                                            .setWindow(ScriptInjector.TOP_WINDOW)\n                                            .setCallback(callback.withSuccess((v3) -> {\n                                                res.onInvoke((IThenable<Void>) null);\n                                            }))\n                                            .inject()))\n                                    .inject()))\n                            .inject()))\n                    .inject();\n        });\n    }\n\n    private native void exposeBridge() /*-{\n        $wnd.appformerGwtBridge = {\n            registerScreen: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::registerScreen(Ljava/lang/Object;),\n            registerPerspective: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::registerPerspective(Ljava/lang/Object;),\n            goTo: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::goTo(Ljava/lang/String;),\n            goToPath: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::goToPath(Ljava/lang/String;),\n            rpc: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::rpc(Ljava/lang/String;[Ljava/lang/Object;),\n            translate: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::translate(Ljava/lang/String;[Ljava/lang/Object;),\n            fireEvent: this.@org.uberfire.jsbridge.client.AppFormerJsBridge::fireEvent(Ljava/lang/String;),\n            render: function (component, container, callback) {\n                if (component instanceof HTMLElement) {\n                    container.innerHTML = \"\";\n                    container.appendChild(component);\n                    callback();\n                } else if (typeof component === \"string\") {\n                    container.innerHTML = component;\n                    callback();\n                } else {\n                    $wnd.ReactDOM.render(component, container, callback);\n                }\n            }\n        };\n    }-*/;\n\n    public void fireEvent(final String eventJson) {\n        CDI.fireEvent(Marshalling.fromJSON(eventJson));\n    }\n\n    public void goTo(final String place) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n        placeManager.goTo(new DefaultPlaceRequest(place));\n    }\n\n    public void goToPath(final String uri) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n        final PathFactory.PathImpl path = new PathFactory.PathImpl(uri.split(\"//\")[uri.split(\"//\").length - 1], uri); //TODO: Un-expose PathImpl constructor?\n        placeManager.goTo(path);\n    }\n\n    public String translate(final String key, final Object[] args) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final TranslationService translationService = beanManager.lookupBean(TranslationService.class).getInstance();\n        return translationService.format(key, args);\n    }\n\n    public void registerPerspective(final Object jsObject) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final AppFormerJsActivityLoader jsLoader = beanManager.lookupBean(AppFormerJsActivityLoader.class).getInstance();\n        jsLoader.onComponentLoaded(jsObject);\n    }\n\n    public void registerScreen(final Object jsObject) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final AppFormerJsActivityLoader jsLoader = beanManager.lookupBean(AppFormerJsActivityLoader.class).getInstance();\n        jsLoader.onComponentLoaded(jsObject);\n    }\n\n    public Promise<Object> rpc(final String path, final Object[] params) {\n\n        //TODO: Marshall/unmarshall is happening twice?\n\n        final String[] parts = path.split(\"\\\\|\");\n        final String serviceFqcn = parts[0];\n        final String method = parts[1];\n        final Annotation[] qualifiers = {}; //TODO: Support qualifiers?\n\n        final Function<Object, Object> jsonToGwt = object -> {\n            try {\n                return Marshalling.fromJSON((String) object);\n            } catch (final Exception e) {\n                DomGlobal.console.info(\"Error converting JS obj to GWT obj\", e);\n                throw e;\n            }\n        };\n\n        final Function<Object, Object> gwtToJson = value -> value != null\n                ? Marshalling.toJSON(value)\n                : null;\n\n        final Object[] gwtParams = stream(params).map(jsonToGwt).toArray();\n\n        return new Promise<>((res, rej) -> MessageBuilder.createCall()\n                .call(serviceFqcn)\n                .endpoint(method, qualifiers, gwtParams)\n                .respondTo(Object.class, value -> res.onInvoke(gwtToJson.apply(value)))\n                .errorsHandledBy((e, a) -> {\n                    rej.onInvoke(e);\n                    return true;\n                })\n                .sendNowWith(ErraiBus.get()));\n    }\n\n    private static class CallbackProducer<T> {\n\n        private final Consumer<Exception> onFailure;\n\n        CallbackProducer(final Consumer<Exception> onFailure) {\n            this.onFailure = onFailure;\n        }\n\n        Callback<T, Exception> withSuccess(final Consumer<T> onSuccess) {\n            return new Callback<T, Exception>() {\n                @Override\n                public void onFailure(Exception e) {\n                    onFailure.accept(e);\n                }\n\n                @Override\n                public void onSuccess(T t) {\n                    onSuccess.accept(t);\n                }\n            };\n        }\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/JsPlaceRequest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.json.client.JSONObject;\nimport com.google.gwt.json.client.JSONString;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\npublic class JsPlaceRequest extends JavaScriptObject {\n\n    protected JsPlaceRequest() {\n    }\n\n    public static JsPlaceRequest fromPlaceRequest(PlaceRequest pr) {\n        JsPlaceRequest jspr = newInstance();\n        jspr.setIdentifier(pr.getIdentifier());\n        JSONObject rawParams = new JSONObject();\n        for (String name : pr.getParameterNames()) {\n            rawParams.put(name,\n                          new JSONString(pr.getParameters().get(name)));\n        }\n        jspr.setParams(rawParams.getJavaScriptObject());\n        return jspr;\n    }\n\n    public static native JsPlaceRequest newInstance() /*-{\n        return {identifier: '', params: {}};\n    }-*/;\n\n    public final native String getIdentifier() /*-{\n        return this.identifier;\n    }-*/;\n\n    public final native void setIdentifier(final String newIdentifier) /*-{\n        this.identifier = newIdentifier;\n    }-*/;\n\n    public final native JavaScriptObject getParams() /*-{\n        return this.params;\n    }-*/;\n\n    public final native void setParams(final JavaScriptObject newParams) /*-{\n        this.params = newParams;\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/cdi/EditorActivityBeanDefinition.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.cdi;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.jsbridge.client.editor.JsWorkbenchEditorActivity;\n\nimport static java.util.Arrays.asList;\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\npublic class EditorActivityBeanDefinition<T, B extends T> implements SyncBeanDef<JsWorkbenchEditorActivity> {\n\n    private final Supplier<JsWorkbenchEditorActivity> factory;\n    private final Set<Class<?>> assignableTypes = new HashSet<>();\n\n    public EditorActivityBeanDefinition(final Supplier<JsWorkbenchEditorActivity> factory) {\n        this.factory = factory;\n        assignableTypes.add(JsWorkbenchEditorActivity.class);\n        assignableTypes.add(WorkbenchEditorActivity.class);\n        assignableTypes.add(Activity.class);\n    }\n\n    @Override\n    public Class<JsWorkbenchEditorActivity> getType() {\n        return JsWorkbenchEditorActivity.class;\n    }\n\n    @Override\n    public Class<?> getBeanClass() {\n        return JsWorkbenchEditorActivity.class;\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope() {\n        return Dependent.class;\n    }\n\n    @Override\n    public JsWorkbenchEditorActivity getInstance() {\n        return factory.get();\n    }\n\n    @Override\n    public JsWorkbenchEditorActivity newInstance() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public Set<Annotation> getQualifiers() {\n        return new HashSet<>(asList(DEFAULT_QUALIFIERS));\n    }\n\n    @Override\n    public boolean matches(final Set<Annotation> annotations) {\n        return QualifierUtil.matches(annotations, getQualifiers());\n    }\n\n    @Override\n    public String getName() {\n        return \"JsWorkbenchEditorActivityBean\";\n    }\n\n    @Override\n    public boolean isActivated() {\n        return true;\n    }\n\n    @Override\n    public boolean isAssignableTo(final Class<?> type) {\n        return assignableTypes.contains(type);\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/cdi/SingletonBeanDefinition.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.cdi;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.inject.Singleton;\n\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\n\npublic class SingletonBeanDefinition<T, B extends T> implements SyncBeanDef<T> {\n\n    private final B instance;\n    private final Class<T> type;\n    private final Set<Annotation> qualifiers;\n    private final String name;\n    private final boolean activated;\n    private final Set<Class<?>> assignableTypes = new HashSet<>();\n\n    public SingletonBeanDefinition(final B instance,\n                                   final Class<T> type,\n                                   final Set<Annotation> qualifiers,\n                                   final String name,\n                                   final boolean activated,\n                                   final Class<?>... otherAssignableTypes) {\n        this.instance = instance;\n        this.type = type;\n        this.qualifiers = qualifiers;\n        this.name = name;\n        this.activated = activated;\n        assignableTypes.add(type);\n        assignableTypes.addAll(Arrays.asList(otherAssignableTypes));\n    }\n\n    @Override\n    public Class<T> getType() {\n        return type;\n    }\n\n    @Override\n    public Class<?> getBeanClass() {\n        return instance.getClass();\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope() {\n        return Singleton.class;\n    }\n\n    @Override\n    public T getInstance() {\n        return instance;\n    }\n\n    @Override\n    public T newInstance() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public Set<Annotation> getQualifiers() {\n        return qualifiers == null ? Collections.emptySet() : qualifiers;\n    }\n\n    @Override\n    public boolean matches(final Set<Annotation> annotations) {\n        return QualifierUtil.matches(annotations, getQualifiers());\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public boolean isActivated() {\n        return activated;\n    }\n\n    @Override\n    public boolean isAssignableTo(final Class<?> type) {\n        return assignableTypes.contains(type);\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/editor/JsNativeEditor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.editor;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLElement;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.mvp.PlaceRequest;\n\npublic class JsNativeEditor {\n\n    private final Object self;\n    private final String componentId;\n    private final HTMLElement container;\n\n    public JsNativeEditor(final String componentId, final Object self) {\n        this.componentId = componentId;\n        this.self = self;\n        this.container = (HTMLElement) DomGlobal.document.createElement(\"div\");\n    }\n\n    public String getComponentId() {\n        return componentId;\n    }\n\n    public native boolean af_isDirty() /*-{\n        return this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_isDirty\"]();\n    }-*/;\n\n    public native int af_priority() /*-{\n        return this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_priority\"];\n    }-*/;\n\n    public native String af_componentTitle() /*-{\n        return this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_componentTitle\"];\n    }-*/;\n\n    public native String[] af_resourceTypes() /*-{\n        return this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_resourceTypes\"];\n    }-*/;\n\n    public void af_onEditorStartup(final ObservablePath path, final PlaceRequest place) {\n        this.native_af_onEditorStartup(path, place);\n    }\n\n    public native void native_af_onEditorStartup(final Object path, final Object place) /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onEditorStartup\"](path, place);\n    }-*/;\n\n    public void af_onOpen() {\n        this.mount();\n        native_af_onOpen();\n    }\n\n    public native void native_af_onOpen() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onOpen\"]();\n    }-*/;\n\n    public native void af_onSave() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onSave\"]();\n    }-*/;\n\n    public native void af_onFocus() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onFocus\"]();\n    }-*/;\n\n    public native void af_onLostFocus() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onLostFocus\"]();\n    }-*/;\n\n    public native boolean af_onMayClose() /*-{\n        return this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onMayClose\"]();\n    }-*/;\n\n    public void af_onClose() {\n        this.unmount();\n        native_af_onClose();\n    }\n\n    public native void native_af_onClose() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onClose\"]();\n    }-*/;\n\n    public native void af_onShutdown() /*-{\n        this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_onShutdown\"]();\n    }-*/;\n\n    public native void mount() /*-{\n        $wnd.AppFormer.render(\n                this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_componentRoot\"](),\n                this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::container);\n    }-*/;\n\n    public native void unmount() /*-{\n        if (this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::self[\"af_isReact\"]) {\n            $wnd.ReactDOM.unmountComponentAtNode(this.@org.uberfire.jsbridge.client.editor.JsNativeEditor::container);\n        }\n    }-*/;\n\n    public HTMLElement getElement() {\n        return container;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/editor/JsWorkbenchEditorActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.editor;\n\nimport java.util.function.Consumer;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.jsbridge.client.loading.AppFormerJsActivityLoader;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@AppFormerJsActivityLoader.Shadowed\npublic class JsWorkbenchEditorActivity extends AbstractWorkbenchEditorActivity implements WorkbenchEditorActivity {\n\n    private JsNativeEditor editor;\n\n    @Inject\n    public JsWorkbenchEditorActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    public JsWorkbenchEditorActivity withEditor(final JsNativeEditor editor) {\n        this.editor = editor;\n        return this;\n    }\n\n    // Lifecycle\n\n    @Override\n    public void onStartup(final ObservablePath path, final PlaceRequest place) {\n        super.onStartup(path, place);\n        editor.af_onEditorStartup(path, place);\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        editor.af_onOpen();\n    }\n\n    @Override\n    public void onSave() {\n        super.onSave();\n        editor.af_onSave();\n    }\n\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        editor.af_onFocus();\n    }\n\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        editor.af_onLostFocus();\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return super.onMayClose() && editor.af_onMayClose();\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        editor.af_onClose();\n    }\n\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        editor.af_onShutdown();\n    }\n\n    // Properties\n\n    @Override\n    public boolean isDirty() {\n        return super.isDirty() || editor.af_isDirty();\n    }\n\n    @Override\n    public String getTitle() {\n        return editor.af_componentTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget(editor.getElement());\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> consumer) {\n        consumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null; //TODO: Implement?\n    }\n\n    @Override\n    public String getIdentifier() {\n        return editor.getComponentId();\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/ActivityLazyLoaded.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.Objects;\n\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class ActivityLazyLoaded implements UberFireEvent {\n\n    private final String identifier;\n    private final Activity activity;\n\n    public ActivityLazyLoaded(final String identifier,\n                              final Activity activity) {\n        \n        this.identifier = identifier;\n        this.activity = activity;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    public Activity getActivity() {\n        return activity;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ActivityLazyLoaded that = (ActivityLazyLoaded) o;\n        return Objects.equals(identifier, that.identifier) &&\n                Objects.equals(activity, that.activity);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(identifier, activity);\n    }\n\n    @Override\n    public String toString() {\n        return \"ActivityLazyLoaded{\" +\n                \"identifier='\" + identifier + '\\'' +\n                \", activity=\" + activity +\n                '}';\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/AppFormerComponentsRegistry.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.json.client.JSONObject;\n\nimport static com.google.common.base.Preconditions.checkNotNull;\nimport static java.util.Optional.ofNullable;\nimport static java.util.function.Function.identity;\nimport static java.util.stream.Collectors.toMap;\n\n@ApplicationScoped\npublic class AppFormerComponentsRegistry {\n\n    public native String[] keys() /*-{\n        if (typeof $wnd.AppFormerComponentsRegistry === \"undefined\") {\n            return [];\n        }\n        return Object.keys($wnd.AppFormerComponentsRegistry);\n    }-*/;\n\n    public native JavaScriptObject get(final String key) /*-{\n        if (typeof $wnd.AppFormerComponentsRegistry[key] === \"undefined\") {\n            return null;\n        }\n        return $wnd.AppFormerComponentsRegistry[key];\n    }-*/;\n\n    public static class Entry {\n\n        private final String componentId;\n\n        private final JavaScriptObject self;\n\n        public Entry(final String componentId,\n                     final JavaScriptObject self) {\n\n            checkNotNull(componentId);\n            checkNotNull(self);\n\n            this.componentId = componentId;\n            this.self = self;\n        }\n\n        JavaScriptObject getSelf() {\n            return self;\n        }\n\n        public String getComponentId() {\n            return this.componentId;\n        }\n\n        public Entry.Type getType() {\n            return Entry.Type.valueOf(((String) get(\"type\")).toUpperCase());\n        }\n\n        public String getSource() {\n            return (String) get(\"source\");\n        }\n\n        public Map<String, String> getParams() {\n\n            final JavaScriptObject jsParams = (JavaScriptObject) get(\"params\");\n            if (jsParams == null) {\n                return new HashMap<>();\n            }\n\n            final JSONObject json = new JSONObject(jsParams);\n\n            return json.keySet().stream()\n                    .filter(k -> json.get(k) != null)\n                    .collect(toMap(identity(), k -> json.get(k).toString()));\n        }\n\n        private native Object get(final String key) /*-{\n            return this.@org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry::self[key];\n        }-*/;\n\n        public boolean matches(final String uri) {\n            final String matches = getParams().get(\"matches\");\n            final String regex = matches.substring(1, matches.length() - 1); //FIXME: Temporary workaround to remove extra quotes\n            return uri.matches(regex);\n        }\n\n        public enum Type {\n            PERSPECTIVE,\n            SCREEN,\n            EDITOR,\n        }\n\n        public static class PerspectiveParams {\n\n            private final Map<String, String> params;\n\n            public PerspectiveParams(final Map<String, String> params) {\n                this.params = params;\n            }\n\n            public Optional<Boolean> isDefault() {\n                return ofNullable(this.params.get(\"is_default\")).map(Boolean::valueOf);\n            }\n        }\n\n        public static class EditorParams {\n\n            private final Map<String, String> params;\n\n            public EditorParams(final Map<String, String> params) {\n                this.params = params;\n            }\n\n            public Optional<String> matches() {\n                return ofNullable(this.params.get(\"matches\"));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/AppFormerJsActivityLoader.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Qualifier;\n\nimport com.google.gwt.core.client.Callback;\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.ScriptInjector;\nimport elemental2.dom.DomGlobal;\nimport elemental2.promise.Promise;\nimport elemental2.promise.Promise.PromiseExecutorCallbackFn.RejectCallbackFn;\nimport elemental2.promise.Promise.PromiseExecutorCallbackFn.ResolveCallbackFn;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.PlaceManagerImpl;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyActivity;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.jsbridge.client.cdi.EditorActivityBeanDefinition;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\nimport org.uberfire.jsbridge.client.editor.JsNativeEditor;\nimport org.uberfire.jsbridge.client.editor.JsWorkbenchEditorActivity;\nimport org.uberfire.jsbridge.client.screen.JsNativeScreen;\nimport org.uberfire.jsbridge.client.screen.JsWorkbenchScreenActivity;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW;\nimport static java.util.Arrays.stream;\nimport static java.util.Optional.ofNullable;\nimport static java.util.function.Function.identity;\nimport static java.util.stream.Collectors.toList;\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@EntryPoint\npublic class AppFormerJsActivityLoader implements PlaceManagerImpl.AppFormerActivityLoader {\n\n    private final Promises promises;\n    private final ActivityManager activityManager;\n    private final ActivityBeansCache activityBeansCache;\n    private final PlaceManager placeManager;\n    private final LazyLoadingScreen lazyLoadingScreen;\n    private final Event<ActivityLazyLoaded> activityLazyLoadedEvent;\n    private final Instance<JsWorkbenchEditorActivity> jsWorkbenchEditorActivityInstance;\n    private final AppFormerComponentsRegistry appFormerComponentsRegistry;\n\n    private final Map<String, String> components = new HashMap<>();\n    private final Set<String> loadedScripts = new HashSet<>();\n    final Map<String, AppFormerComponentsRegistry.Entry> editors = new HashMap<>();\n\n    private String gwtModuleName;\n\n    @Inject\n    public AppFormerJsActivityLoader(final Promises promises,\n                                     final ActivityManager activityManager,\n                                     final ActivityBeansCache activityBeansCache,\n                                     final PlaceManager placeManager,\n                                     final LazyLoadingScreen lazyLoadingScreen,\n                                     final Event<ActivityLazyLoaded> activityLazyLoadedEvent,\n                                     final @Shadowed Instance<JsWorkbenchEditorActivity> jsWorkbenchEditorActivityInstance,\n                                     final AppFormerComponentsRegistry appFormerComponentsRegistry) {\n\n        this.promises = promises;\n        this.activityManager = activityManager;\n        this.activityBeansCache = activityBeansCache;\n        this.placeManager = placeManager;\n        this.lazyLoadingScreen = lazyLoadingScreen;\n        this.activityLazyLoadedEvent = activityLazyLoadedEvent;\n        this.jsWorkbenchEditorActivityInstance = jsWorkbenchEditorActivityInstance;\n        this.appFormerComponentsRegistry = appFormerComponentsRegistry;\n    }\n\n    public void init(final String gwtModuleName) {\n        this.gwtModuleName = gwtModuleName;\n\n        stream(appFormerComponentsRegistry.keys())\n                .map(this::newRegistryEntry)\n                .forEach(this::registerComponent);\n    }\n\n    AppFormerComponentsRegistry.Entry newRegistryEntry(final String componentId) {\n        return new AppFormerComponentsRegistry.Entry(componentId, appFormerComponentsRegistry.get(componentId));\n    }\n\n    public void onComponentLoaded(final Object jsObject) {\n\n        final String componentId = extractComponentId(jsObject);\n\n        if (editors.containsKey(componentId)) {\n            registerEditor(jsObject, componentId);\n            return;\n        }\n\n        if (!components.containsKey(componentId)) {\n            throw new IllegalArgumentException(\"Cannot find component \" + componentId);\n        }\n\n        final Activity activity = updateRealContent((JavaScriptObject) jsObject, componentId);\n\n        activityLazyLoadedEvent.fire(new ActivityLazyLoaded(componentId, activity));\n    }\n\n    Activity updateRealContent(final JavaScriptObject jsObject,\n                               final String componentId) {\n\n        //FIXME: Get activity bean from BeanManager to prevent onStartup to be invoked.\n        final Activity activity = activityManager.getActivity(new DefaultPlaceRequest(componentId));\n\n        final JsWorkbenchLazyActivity lazyActivity = (JsWorkbenchLazyActivity) activity;\n        lazyActivity.updateRealContent(jsObject);\n        return activity;\n    }\n\n    public native String extractComponentId(final Object object)  /*-{\n        return object['af_componentId'];\n    }-*/;\n\n    Promise<Void> loadScriptFor(final String componentId) {\n\n        final Optional<String> scriptFilename = getScriptFileName(componentId);\n\n        //Script not found\n        if (!scriptFilename.isPresent()) {\n            throw new RuntimeException(\"No script found for \" + componentId);\n        }\n\n        //Already loaded\n        if (loadedScripts.contains(scriptFilename.get())) {\n            return promises.resolve();\n        }\n\n        loadedScripts.add(scriptFilename.get());\n\n        return loadScript(gwtModuleName + \"/\" + scriptFilename.get()).catch_(e -> {\n            DomGlobal.console.info(\"Error loading script for \" + componentId);\n            loadedScripts.remove(scriptFilename.get());\n            return promises.reject(e);\n        });\n    }\n\n    Optional<String> getScriptFileName(final String componentId) {\n\n        final Optional<String> editorScriptUrl = ofNullable(editors.get(componentId))\n                .map(AppFormerComponentsRegistry.Entry::getSource);\n\n        return editorScriptUrl.isPresent()\n                ? editorScriptUrl\n                : ofNullable(components.get(componentId));\n    }\n\n    Promise<Void> loadScript(final String scriptUrl) {\n        return promises.create((res, rej) -> ScriptInjector.fromUrl(scriptUrl)\n                .setWindow(TOP_WINDOW)\n                .setCallback(getScriptInjectionCallback(res, rej))\n                .inject());\n    }\n\n    private Callback<Void, Exception> getScriptInjectionCallback(final ResolveCallbackFn<Void> res,\n                                                                 final RejectCallbackFn rej) {\n        return new Callback<Void, Exception>() {\n            @Override\n            public void onFailure(final Exception e1) {\n                rej.onInvoke(e1);\n            }\n\n            @Override\n            public void onSuccess(final Void v) {\n                res.onInvoke(v);\n            }\n        };\n    }\n\n    void registerComponent(final AppFormerComponentsRegistry.Entry registryEntry) {\n        switch (registryEntry.getType()) {\n            case PERSPECTIVE:\n                registerPerspective(registryEntry);\n                components.put(registryEntry.getComponentId(), registryEntry.getSource());\n                break;\n            case SCREEN:\n                registerScreen(registryEntry);\n                components.put(registryEntry.getComponentId(), registryEntry.getSource());\n                break;\n            case EDITOR:\n                registerEditor(registryEntry);\n                break;\n        }\n    }\n\n    public boolean triggerLoadOfMatchingEditors(final Path path,\n                                                final Runnable successCallback) {\n\n        if (path == null || path.toURI() == null) {\n            return false;\n        }\n\n        final List<Promise<Void>> loadingMatchingEditors = loadMatchingEditors(path.toURI());\n\n        if (loadingMatchingEditors.size() <= 0) {\n            return false;\n        }\n\n        finishLoadingMatchingEditors(loadingMatchingEditors, successCallback);\n        return true;\n    }\n\n    List<Promise<Void>> loadMatchingEditors(final String uri) {\n        return editors.values().stream()\n                .filter(e -> e.matches(uri))\n                .filter(e -> !loadedScripts.contains(e.getSource()))\n                .map(e -> this.loadScriptFor(e.getComponentId()))\n                .collect(toList());\n    }\n\n    protected void finishLoadingMatchingEditors(final List<Promise<Void>> loadingMatchingEditors,\n                                                final Runnable successCallback) {\n\n        this.promises.resolve().then(i -> promises.all(loadingMatchingEditors, identity()).then(s -> {\n            successCallback.run();\n            return this.promises.resolve();\n        })).catch_(e -> {\n            //If something goes wrong, it's a no-op.\n            return this.promises.resolve();\n        });\n    }\n\n    void registerEditor(final AppFormerComponentsRegistry.Entry registryEntry) {\n        this.editors.put(registryEntry.getComponentId(), registryEntry);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    void registerScreen(final AppFormerComponentsRegistry.Entry registryEntry) {\n\n        final JsNativeScreen newScreen = new JsNativeScreen(registryEntry.getComponentId(), this::loadScriptFor, lazyLoadingScreen);\n        final JsWorkbenchScreenActivity activity = new JsWorkbenchScreenActivity(newScreen, placeManager);\n\n        //FIXME: Check if this bean is being registered correctly. Startup/Shutdown is begin called as if they were Open/Close.\n        final SingletonBeanDefinition activityBean = new SingletonBeanDefinition<>(\n                activity,\n                JsWorkbenchScreenActivity.class,\n                new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                activity.getIdentifier(),\n                true,\n                WorkbenchScreenActivity.class,\n                JsWorkbenchLazyActivity.class,\n                Activity.class);\n\n        activityBeansCache.addNewScreenActivity(activityBean);\n\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        beanManager.registerBean(activityBean);\n        beanManager.registerBeanTypeAlias(activityBean, WorkbenchScreenActivity.class);\n        beanManager.registerBeanTypeAlias(activityBean, JsWorkbenchLazyActivity.class);\n        beanManager.registerBeanTypeAlias(activityBean, Activity.class);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    void registerPerspective(final AppFormerComponentsRegistry.Entry registryEntry) {\n\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final ActivityBeansCache activityBeansCache = beanManager.lookupBean(ActivityBeansCache.class).getInstance();\n\n        final PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n        final ActivityManager activityManager = beanManager.lookupBean(ActivityManager.class).getInstance();\n\n        final JsWorkbenchLazyPerspectiveActivity activity = new JsWorkbenchLazyPerspectiveActivity(registryEntry,\n                                                                                                   placeManager,\n                                                                                                   activityManager,\n                                                                                                   this::loadScriptFor);\n\n        final SingletonBeanDefinition<JsWorkbenchLazyPerspectiveActivity, JsWorkbenchLazyPerspectiveActivity> activityBean = new SingletonBeanDefinition<>(\n                activity,\n                JsWorkbenchLazyPerspectiveActivity.class,\n                new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                activity.getIdentifier(),\n                true,\n                PerspectiveActivity.class,\n                JsWorkbenchLazyActivity.class,\n                Activity.class);\n\n        beanManager.registerBean(activityBean);\n        beanManager.registerBeanTypeAlias(activityBean, PerspectiveActivity.class);\n        beanManager.registerBeanTypeAlias(activityBean, JsWorkbenchLazyActivity.class);\n        beanManager.registerBeanTypeAlias(activityBean, Activity.class);\n\n        activityBeansCache.addNewPerspectiveActivity(beanManager.lookupBeans(((PerspectiveActivity) activity).getIdentifier()).iterator().next());\n    }\n\n    @Qualifier\n    public @interface Shadowed {\n\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    void registerEditor(final Object jsObject,\n                        final String componentId) {\n\n        final JsNativeEditor editor = new JsNativeEditor(componentId, jsObject);\n\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final EditorActivityBeanDefinition activityBean = new EditorActivityBeanDefinition<>(\n                () -> jsWorkbenchEditorActivityInstance.get().withEditor(new JsNativeEditor(componentId, jsObject))\n        );\n\n        beanManager.registerBean(activityBean);\n        beanManager.registerBeanTypeAlias(activityBean, WorkbenchEditorActivity.class);\n        beanManager.registerBeanTypeAlias(activityBean, Activity.class);\n\n        activityBeansCache.addNewEditorActivity(activityBean,\n                                                editor.af_priority(),\n                                                Arrays.asList(editor.af_resourceTypes()));\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/JsWorkbenchLazyPerspectiveActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyPerspective;\nimport org.uberfire.client.workbench.panels.impl.ImmutableWorkbenchPanelPresenter;\nimport org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.PerspectiveParams;\nimport org.uberfire.jsbridge.client.perspective.JsWorkbenchPerspectiveActivity;\nimport org.uberfire.jsbridge.client.perspective.JsWorkbenchTemplatedPerspectiveActivity;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.ForcedPlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class JsWorkbenchLazyPerspectiveActivity extends AbstractWorkbenchPerspectiveActivity implements JsWorkbenchLazyPerspective {\n\n    private final ActivityManager activityManager;\n\n    private final String backedPerspectiveId;\n    private final boolean configuredIsDefault;\n    PerspectiveActivity backedPerspective;\n\n    private boolean loaded;\n    private final Consumer<String> lazyLoadingParentScript;\n\n    public JsWorkbenchLazyPerspectiveActivity(final AppFormerComponentsRegistry.Entry registryEntry,\n                                              final PlaceManager placeManager,\n                                              final ActivityManager activityManager,\n                                              final Consumer<String> lazyLoadingParentScript) {\n\n        super(placeManager);\n        this.activityManager = activityManager;\n\n        this.backedPerspectiveId = registryEntry.getComponentId();\n        this.lazyLoadingParentScript = lazyLoadingParentScript;\n\n        this.configuredIsDefault = new PerspectiveParams(registryEntry.getParams()).isDefault().orElse(super.isDefault());\n\n        this.loaded = false;\n    }\n\n    @Override\n    public void updateRealContent(final JavaScriptObject backedPerspectiveJsObject) {\n\n        this.loaded = true;\n\n        backedPerspective = getBackedPerspective(backedPerspectiveJsObject);\n\n        if (activityManager.isStarted(this)) {\n            // current activity is started, need to move the backed perspective to started state\n            getBackedPerspective().onStartup(place);\n        }\n\n        if (open) {\n            // lazy perspective is opened, need to move the backed perspective to open state and refresh the page\n            getBackedPerspective().onOpen();\n            placeManager.goTo(new ForcedPlaceRequest(backedPerspectiveId));\n        }\n    }\n\n    PerspectiveActivity getBackedPerspective(final JavaScriptObject backedPerspectiveJsObject) {\n        final JsNativePerspective jsPerspective = new JsNativePerspective(backedPerspectiveJsObject);\n        if (isPerspectiveTemplated(jsPerspective)) {\n            return new JsWorkbenchTemplatedPerspectiveActivity(getIdentifier(),\n                                                               isDefault(),\n                                                               jsPerspective,\n                                                               placeManager);\n        } else {\n            return new JsWorkbenchPerspectiveActivity(jsPerspective,\n                                                      placeManager,\n                                                      isDefault());\n        }\n    }\n\n    public boolean isPerspectiveTemplated(final JsNativePerspective jsPerspective) {\n        return jsPerspective.isTemplated();\n    }\n\n    @Override\n    public PerspectiveActivity get() {\n        if (isPerspectiveLoaded()) {\n            return getBackedPerspective();\n        }\n        return this;\n    }\n\n    // Lifecycle\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n\n        this.place = place;\n\n        if (isPerspectiveLoaded()) {\n            getBackedPerspective().onStartup(place);\n            return;\n        }\n        super.onStartup(place);\n    }\n\n    @Override\n    public void onOpen() {\n\n        if (isPerspectiveLoaded()) {\n            getBackedPerspective().onOpen();\n        } else {\n            super.onOpen();\n            onLoaded(); // trigger backed perspective loading\n        }\n\n        placeManager.executeOnOpenCallbacks(place);\n    }\n\n    @Override\n    public void onClose() {\n\n        if (isPerspectiveLoaded()) {\n            getBackedPerspective().onClose();\n        } else {\n            super.onClose();\n        }\n\n        placeManager.executeOnCloseCallbacks(place);\n    }\n\n    @Override\n    public void onShutdown() {\n\n        if (isPerspectiveLoaded()) {\n            getBackedPerspective().onShutdown();\n            return;\n        }\n        super.onShutdown();\n    }\n\n    void onLoaded() {\n        lazyLoadingParentScript.accept(backedPerspectiveId);\n    }\n\n    // Properties\n\n    PerspectiveActivity getBackedPerspective() {\n        return backedPerspective;\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return backedPerspectiveId;\n    }\n\n    @Override\n    public boolean isDefault() {\n        // we ignore the isDefault() property of the backed perspective.\n        return configuredIsDefault;\n    }\n\n    @Override\n    public boolean isTransient() {\n\n        if (isPerspectiveLoaded()) {\n            return getBackedPerspective().isTransient();\n        }\n\n        // lazy perspectives are always transient.\n        // We don't want to propagate the changes made while the real perspective was loading.\n        return true;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> consumer) {\n        if (isPerspectiveLoaded()) {\n            getBackedPerspective().getMenus(consumer);\n        } else {\n            super.getMenus(consumer);\n        }\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        if (isPerspectiveLoaded()) {\n            return getBackedPerspective().getToolBar();\n        }\n        return super.getToolBar();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n\n        if (isPerspectiveLoaded()) {\n            return getBackedPerspective().getDefaultPerspectiveLayout();\n        }\n\n        return buildEmptyDefinition();\n    }\n\n    boolean isPerspectiveLoaded() {\n        return loaded;\n    }\n\n    private PerspectiveDefinition buildEmptyDefinition() {\n        final PerspectiveDefinition def = new PerspectiveDefinitionImpl(ImmutableWorkbenchPanelPresenter.class.getName());\n        def.setName(getIdentifier()); // perspective not loaded yet, we don't know its name\n        def.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(LazyLoadingScreen.IDENTIFIER)));\n        return def;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/LazyLoadingScreen.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Templated(\"lazy-loading.html\")\n@WorkbenchScreen(identifier = LazyLoadingScreen.IDENTIFIER)\npublic class LazyLoadingScreen implements IsElement {\n\n    public static final String IDENTIFIER = \"LazyLoadingScreen\";\n\n    private Label title;\n\n    @PostConstruct\n    public void init() {\n        this.title = new Label(getTitle());\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Lazy Loading Screen\";\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitleDecoration() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public org.jboss.errai.common.client.api.elemental2.IsElement getView() {\n        return this;\n    }\n\n    @WorkbenchMenu\n    public Menus getMenu() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/loading/lazy-loading.html",
    "content": "<div style=\"position: relative; z-index: 20001; top: 40%; width: 300px; padding:5px;\" class=\"container-fluid\">\n    <div class=\"row\">\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <div class=\"spinner spinner-lg\"></div>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <h3>Please wait</h3>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <span>Component is loading...</span>\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/JsWorkbenchPanelConverter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective;\n\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativeContextDisplay;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePanel;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\n\npublic class JsWorkbenchPanelConverter {\n\n    private final JsNativePanel nativePanel;\n\n    public JsWorkbenchPanelConverter(final JsNativePanel nativePanel) {\n        this.nativePanel = nativePanel;\n    }\n\n    public PanelDefinition toPanelDefinition() {\n\n        final PanelDefinition newPanel = new PanelDefinitionImpl(nativePanel.panelType());\n        newPanel.setPosition(nativePanel.position());\n\n        final JsNativeContextDisplay contextDisplay = nativePanel.contextDisplay();\n\n        newPanel.setContextDisplayMode(contextDisplay.mode());\n        if (contextDisplay.contextId() != null) {\n            newPanel.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(contextDisplay.contextId())));\n        }\n\n        if (nativePanel.width() > 0) {\n            newPanel.setWidth(nativePanel.width());\n        }\n\n        if (nativePanel.minWidth() > 0) {\n            newPanel.setMinWidth(nativePanel.minWidth());\n        }\n\n        if (nativePanel.height() > 0) {\n            newPanel.setHeight(nativePanel.height());\n        }\n\n        if (nativePanel.minHeight() > 0) {\n            newPanel.setHeight(nativePanel.minHeight());\n        }\n\n        nativePanel.view().parts().stream()\n                .map(part -> new JsWorkbenchPartConverter(part).toPartDefinition())\n                .forEach(newPanel::addPart);\n\n        nativePanel.view().panels().stream()\n                .map(panel -> new JsWorkbenchPanelConverter(panel).toPanelDefinition())\n                .forEach(panel -> newPanel.insertChild(panel.getPosition(), panel));\n\n        return newPanel;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/JsWorkbenchPartConverter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective;\n\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativeContextDisplay;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePart;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\npublic class JsWorkbenchPartConverter {\n\n    private final JsNativePart nativePart;\n\n    public JsWorkbenchPartConverter(final JsNativePart nativePart) {\n        this.nativePart = nativePart;\n    }\n\n    public PartDefinition toPartDefinition() {\n\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(nativePart.placeName(), nativePart.parameters());\n        final PartDefinition partDefinition = new PartDefinitionImpl(placeRequest);\n\n        final JsNativeContextDisplay contextDisplay = nativePart.contextDisplay();\n        partDefinition.setContextDisplayMode(contextDisplay.mode());\n        if (contextDisplay.contextId() != null) {\n            partDefinition.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(contextDisplay.contextId())));\n        }\n\n        return partDefinition;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/JsWorkbenchPerspectiveActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective;\n\nimport java.util.function.Consumer;\n\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativeContextDisplay;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class JsWorkbenchPerspectiveActivity extends AbstractWorkbenchPerspectiveActivity {\n\n    private JsNativePerspective realPerspective;\n    private final boolean isDefault;\n\n    public JsWorkbenchPerspectiveActivity(final JsNativePerspective realPerspective,\n                                          final PlaceManager placeManager,\n                                          final boolean isDefault) {\n        super(placeManager);\n        this.realPerspective = realPerspective;\n        this.isDefault = isDefault;\n    }\n\n    // TODO: CDI Event subscriptions?\n\n    /**\n     * This method is called when this perspective is instantiated\n     * @param place\n     */\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup(place);\n\n        this.place = place;\n        this.realPerspective.onStartup();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n\n        this.realPerspective.onOpen();\n        placeManager.executeOnOpenCallbacks(place);\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n\n        this.realPerspective.onClose();\n        placeManager.executeOnCloseCallbacks(place);\n    }\n\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n\n        this.realPerspective.onShutdown();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return realPerspective.componentId();\n    }\n\n    @Override\n    public boolean isDefault() {\n        return this.isDefault;\n    }\n\n    @Override\n    public boolean isTransient() {\n        return realPerspective.isTransient();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> consumer) {\n        consumer.accept(realPerspective.menus());\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return realPerspective.toolbar();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n\n        final PerspectiveDefinition def = new PerspectiveDefinitionImpl(realPerspective.defaultPanelType());\n        def.setName(realPerspective.name());\n\n        final JsNativeContextDisplay contextDisplay = this.realPerspective.contextDisplay();\n        def.setContextDisplayMode(contextDisplay.mode());\n        if (contextDisplay.contextId() != null) {\n            def.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(contextDisplay.contextId())));\n        }\n\n        final PanelDefinition rootPanel = def.getRoot();\n\n        realPerspective.view().parts().stream()\n                .map(part -> new JsWorkbenchPartConverter(part).toPartDefinition())\n                .forEach(rootPanel::addPart);\n\n        realPerspective.view().panels().stream()\n                .map(panel -> new JsWorkbenchPanelConverter(panel).toPanelDefinition())\n                .forEach(panel -> rootPanel.insertChild(panel.getPosition(), panel));\n\n        return def;\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/JsWorkbenchTemplatedPerspectiveActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport elemental2.dom.Attr;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.Node;\nimport jsinterop.base.Js;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\nimport static java.util.stream.Collectors.toMap;\nimport static org.uberfire.workbench.model.PanelDefinition.PARENT_CHOOSES_TYPE;\n\npublic class JsWorkbenchTemplatedPerspectiveActivity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n    private static final String UF_PERSPECTIVE_CONTAINER = \"uf-perspective-container\";\n    private static final String STARTUP_PARAM_ATTR = \"data-startup-\";\n\n    private final String componentId;\n    private final boolean isDefault;\n\n    private final HTMLElement container;\n\n    private final JsNativePerspective realPerspective;\n    private Map<String, HTMLElement> componentContainersById;\n\n    public JsWorkbenchTemplatedPerspectiveActivity(final String componentId,\n                                                   final boolean isDefault,\n                                                   final JsNativePerspective realPerspective,\n                                                   final PlaceManager placeManager) {\n        super(placeManager);\n\n        this.componentId = componentId;\n        this.isDefault = isDefault;\n\n        this.realPerspective = realPerspective;\n\n        this.container = (HTMLElement) DomGlobal.document.createElement(\"div\");\n        this.container.classList.add(UF_PERSPECTIVE_CONTAINER);\n        this.componentContainersById = new HashMap<>();\n    }\n\n    // Lifecycle\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n        super.onStartup(place);\n        realPerspective.onStartup();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n\n        // update local references to the DOM elements\n        realPerspective.renderNative(container);\n        componentContainersById = loadTemplateComponents(container);\n\n        realPerspective.onOpen();\n        placeManager.executeOnOpenCallbacks(place);\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPerspective.onClose(container);\n        placeManager.executeOnCloseCallbacks(place);\n    }\n\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        this.realPerspective.onShutdown();\n    }\n\n    // Properties\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return componentId;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return isDefault;\n    }\n\n    @Override\n    public boolean isTransient() {\n        return realPerspective.isTransient();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> consumer) {\n        consumer.accept(realPerspective.menus());\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return realPerspective.toolbar();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition perspectiveDefinition = new PerspectiveDefinitionImpl(TemplatedWorkbenchPanelPresenter.class.getName());\n        perspectiveDefinition.setName(realPerspective.name());\n\n        componentContainersById.forEach((key, value) -> {\n\n            final Map<String, String> placeParams = retrieveStartUpParams(value);\n            final PanelDefinition panelDefinition = new PanelDefinitionImpl(PARENT_CHOOSES_TYPE);\n\n            panelDefinition.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(key, placeParams)));\n            perspectiveDefinition.getRoot().appendChild(new NamedPosition(key), panelDefinition);\n        });\n\n        return perspectiveDefinition;\n    }\n\n    // Templated interface methods\n\n    @Override\n    public org.jboss.errai.common.client.dom.HTMLElement resolvePosition(final NamedPosition namedPosition) {\n        final String fieldName = namedPosition.getName();\n        final HTMLElement element = componentContainersById.get(fieldName);\n        return element == null ? null : Js.cast(element);\n    }\n\n    @Override\n    public org.jboss.errai.common.client.dom.HTMLElement getRootElement() {\n        return Js.cast(container);\n    }\n\n    private Map<String, HTMLElement> loadTemplateComponents(final HTMLElement container) {\n\n        final Map<String, HTMLElement> templateComponents = realPerspective.getContainerComponents(container)\n                .stream()\n                .collect(toMap(e -> e.getAttribute(\"af-js-component\"), e -> e));\n\n        templateComponents.values().forEach(component -> this.recursivelyMarkComponentContainers(container, component));\n\n        return templateComponents;\n    }\n\n    private void recursivelyMarkComponentContainers(final Node root, final Node leaf) {\n\n        // Run through every node between the root container and the component node marking it as an uf-perspective-component.\n        // This is needed to make the TemplatedPresenter display the correct elements in the screen when it opens.\n\n        if (!(leaf instanceof HTMLElement)) {\n            return;\n        }\n\n        if (leaf == root) {\n            return;\n        }\n\n        final HTMLElement htmlElement = (HTMLElement) leaf;\n        if (!htmlElement.classList.contains(UF_PERSPECTIVE_COMPONENT)) {\n            htmlElement.classList.add(UF_PERSPECTIVE_COMPONENT);\n        }\n\n        recursivelyMarkComponentContainers(root, leaf.parentNode);\n    }\n\n    private Map<String, String> retrieveStartUpParams(final HTMLElement component) {\n\n        final Map<String, String> params = new HashMap<>();\n\n        for (int i = 0; i < component.attributes.length; i++) {\n\n            final Attr attr = component.attributes.getAt(i);\n            if (!attr.name.startsWith(STARTUP_PARAM_ATTR)) {\n                continue;\n            }\n\n            final String key = attr.name.replaceFirst(STARTUP_PARAM_ATTR, \"\");\n            if (key.length() > 0) {\n                params.put(key, attr.value);\n            }\n        }\n\n        return params;\n    }\n}"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/jsnative/JsNativeContextDisplay.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective.jsnative;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.workbench.model.ContextDisplayMode;\n\npublic class JsNativeContextDisplay {\n\n    private final JavaScriptObject self;\n    private final String displayInfoFieldName;\n\n    public JsNativeContextDisplay(final JavaScriptObject self,\n                                  final String displayInfoFieldName) {\n        this.self = self;\n        this.displayInfoFieldName = displayInfoFieldName;\n    }\n\n    public ContextDisplayMode mode() {\n        return ContextDisplayMode.valueOf(contextDisplayModeString(displayInfoFieldName));\n    }\n\n    public String contextId() {\n        return contextId(displayInfoFieldName);\n    }\n\n    private native String contextId(final String displayInfoField)   /*-{\n        var contextDisplay = this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativeContextDisplay::self[displayInfoField];\n        return contextDisplay && contextDisplay[\"contextId\"];\n    }-*/;\n\n    private native String contextDisplayModeString(final String displayInfoField)   /*-{\n        var contextDisplay = this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativeContextDisplay::self[displayInfoField];\n        return contextDisplay && contextDisplay[\"contextDisplayMode\"];\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/jsnative/JsNativePanel.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective.jsnative;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\n\npublic class JsNativePanel {\n\n    private final JavaScriptObject self;\n    private final JsNativeContextDisplay contextDisplay;\n    private final JsNativeView view;\n\n    public JsNativePanel(final JavaScriptObject self) {\n        this.self = self;\n        this.contextDisplay = new JsNativeContextDisplay(self, \"displayInfo\");\n        this.view = new JsNativeView(self, \"parts\", \"children\");\n    }\n\n    public String panelType() {\n        return (String) get(\"panelType\");\n    }\n\n    public Position position() {\n        return CompassPosition.valueOf((String) get(\"position\"));\n    }\n\n    public int width() {\n        return ((Number) get(\"width\")).intValue();\n    }\n\n    public int minWidth() {\n        return ((Number) get(\"minWidth\")).intValue();\n    }\n\n    public int height() {\n        return ((Number) get(\"height\")).intValue();\n    }\n\n    public int minHeight() {\n        return ((Number) get(\"minHeight\")).intValue();\n    }\n\n    public JsNativeView view() {\n        return this.view;\n    }\n\n    public JsNativeContextDisplay contextDisplay() {\n        return contextDisplay;\n    }\n\n    private native Object get(final String fieldToInvoke)   /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePanel::self[fieldToInvoke];\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/jsnative/JsNativePart.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective.jsnative;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.json.client.JSONObject;\nimport org.uberfire.commons.data.Pair;\n\nimport static java.util.stream.Collectors.toMap;\n\npublic class JsNativePart {\n\n    private final JavaScriptObject self;\n    private final JsNativeContextDisplay contextDisplay;\n\n    public JsNativePart(final JavaScriptObject self) {\n        this.self = self;\n        this.contextDisplay = new JsNativeContextDisplay(self, \"displayInfo\");\n    }\n\n    public String placeName() {\n        return (String) get(\"placeName\");\n    }\n\n    public Map<String, String> parameters() {\n\n        final JavaScriptObject jsParameters = (JavaScriptObject) get(\"parameters\");\n        if (jsParameters == null) {\n            return new HashMap<>();\n        }\n\n        final JSONObject parametersJson = new JSONObject(jsParameters);\n        return parametersJson.keySet().stream()\n                .map(key -> new Pair<>(key, parametersJson.get(key).isString().stringValue()))\n                .collect(toMap(Pair::getK1, Pair::getK2));\n    }\n\n    public JsNativeContextDisplay contextDisplay() {\n        return contextDisplay;\n    }\n\n    private native Object get(final String fieldToInvoke)   /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePart::self[fieldToInvoke];\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/jsnative/JsNativePerspective.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective.jsnative;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class JsNativePerspective {\n\n    private final JavaScriptObject self;\n    private final JsNativeContextDisplay contextDisplay;\n    private final JsNativeView view;\n\n    public JsNativePerspective(final JavaScriptObject self) {\n        this.self = self;\n        this.contextDisplay = new JsNativeContextDisplay(self, \"af_displayInfo\");\n        this.view = new JsNativeView(self, \"af_parts\", \"af_panels\");\n    }\n\n    public String componentId() {\n        return (String) get(\"af_componentId\");\n    }\n\n    public String name() {\n        return (String) get(\"af_name\");\n    }\n\n    public boolean isDefault() {\n        return (boolean) get(\"af_isDefault\");\n    }\n\n    public boolean isTransient() {\n        return (boolean) get(\"af_isTransient\");\n    }\n\n    public boolean isTemplated() {\n        return (boolean) get(\"af_isTemplated\");\n    }\n\n    public Menus menus() {\n        return (Menus) get(\"af_menus\");\n    }\n\n    public ToolBar toolbar() {\n        return (ToolBar) get(\"af_toolbar\");\n    }\n\n    public String defaultPanelType() {\n        return (String) get(\"af_defaultPanelType\");\n    }\n\n    public JsNativeView view() {\n        return this.view;\n    }\n\n    public JsNativeContextDisplay contextDisplay() {\n        return this.contextDisplay;\n    }\n\n    public void onStartup() {\n        run(\"af_onStartup\");\n    }\n\n    public void onOpen() {\n        run(\"af_onOpen\");\n    }\n\n    public Set<HTMLElement> getContainerComponents(final HTMLElement container) {\n        final JsArray<JavaScriptObject> jsComponents = nativeGetAfComponents(container);\n\n        final Set<HTMLElement> components = new HashSet<>();\n        for (int i = 0; i < jsComponents.length(); i++) {\n            components.add(Js.cast(jsComponents.get(i)));\n        }\n\n        return components;\n    }\n\n    public void onClose() {\n        run(\"af_onClose\");\n    }\n\n    public void onClose(final HTMLElement container) {\n        onClose();\n        unmount(container);\n    }\n\n    public void onShutdown() {\n        run(\"af_onShutdown\");\n    }\n\n    private native void unmount(final HTMLElement container) /*-{\n        if (this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective::self.af_isReact) {\n            $wnd.ReactDOM.unmountComponentAtNode(container);\n        }\n    }-*/;\n\n    private native JsArray<JavaScriptObject> nativeGetAfComponents(final HTMLElement container) /*-{\n        return $wnd._AppFormerUtils.findChildContainers(container);\n    }-*/;\n\n    public native void renderNative(final HTMLElement container) /*-{\n        $wnd.AppFormer.render(\n                this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective::self.af_componentRoot(),\n                container);\n    }-*/;\n\n    private native Object get(final String fieldToInvoke)   /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective::self[fieldToInvoke];\n    }-*/;\n\n    private native Object run(final String method)   /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective::self[method]();\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/perspective/jsnative/JsNativeView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.perspective.jsnative;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\n\npublic class JsNativeView {\n\n    private final JavaScriptObject self;\n    private final String partsFieldName;\n    private final String panelsFieldName;\n\n    public JsNativeView(final JavaScriptObject self, final String partsFieldName, final String panelsFieldName) {\n        this.self = self;\n        this.partsFieldName = partsFieldName;\n        this.panelsFieldName = panelsFieldName;\n    }\n\n    public List<JsNativePart> parts() {\n\n        final List<JsNativePart> parts = new ArrayList<>();\n\n        final JsArray<JavaScriptObject> jsParts = nativeParts(partsFieldName);\n        for (int i = 0; i < jsParts.length(); i++) {\n            parts.add(new JsNativePart(jsParts.get(i)));\n        }\n\n        return parts;\n    }\n\n    public List<JsNativePanel> panels() {\n\n        final List<JsNativePanel> panels = new ArrayList<>();\n\n        final JsArray<JavaScriptObject> jsPanels = nativePanels(panelsFieldName);\n        for (int i = 0; i < jsPanels.length(); i++) {\n            panels.add(new JsNativePanel(jsPanels.get(i)));\n        }\n\n        return panels;\n    }\n\n    private native JsArray<JavaScriptObject> nativeParts(final String partsField) /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativeView::self[partsField];\n    }-*/;\n\n    private native JsArray<JavaScriptObject> nativePanels(final String panelsField) /*-{\n        return this.@org.uberfire.jsbridge.client.perspective.jsnative.JsNativeView::self[panelsField];\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/screen/InvocationPostponer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.screen;\n\nimport java.util.Stack;\n\nclass InvocationPostponer {\n\n    private final Stack<Runnable> invocations;\n\n    InvocationPostponer() {\n        invocations = new Stack<>();\n    }\n\n    void postpone(final Runnable invocation) {\n        invocations.push(invocation);\n    }\n\n    void executeAll() {\n        while (!invocations.isEmpty()) {\n            invocations.pop().run();\n        }\n    }\n\n    void clear() {\n        this.invocations.clear();\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/screen/JsNativeScreen.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.screen;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.uberfire.jsbridge.client.JsPlaceRequest;\nimport org.uberfire.jsbridge.client.loading.LazyLoadingScreen;\n\npublic class JsNativeScreen {\n\n    private JavaScriptObject self;\n    private final String componentId;\n    private final HTMLElement container;\n\n    private final Consumer<String> lazyLoadParentScript;\n    private boolean loaded;\n\n    private final Elemental2DomUtil elemental2DomUtil;\n\n    public JsNativeScreen(final String componentId,\n                          final Consumer<String> lazyLoadParentScript,\n                          final LazyLoadingScreen lazyScreen) {\n\n        this.loaded = false;\n        this.componentId = componentId;\n\n        this.elemental2DomUtil = new Elemental2DomUtil();\n        this.container = createContainerForLoadingScreen(lazyScreen.getElement());\n\n        this.lazyLoadParentScript = lazyLoadParentScript;\n    }\n\n    public void updateRealContent(final JavaScriptObject jsObject) {\n        loaded = true;\n        self = jsObject;\n\n        // reset container content's, removing the loading content\n        elemental2DomUtil.removeAllElementChildren(container);\n    }\n\n    public HTMLElement getElement() {\n        //This is just a placeholder. This empty div will passed to the JS component so it knows where to render at.\n        return container;\n    }\n\n    public void render() {\n        if (screenLoaded()) {\n            renderNative();\n        } else {\n            lazyLoadParentScript.accept(componentId);\n        }\n    }\n\n    public boolean screenLoaded() {\n        return loaded;\n    }\n\n    private HTMLElement createContainerForLoadingScreen(final HTMLElement loadingWidget) {\n\n        final HTMLElement container = (HTMLElement) DomGlobal.document.createElement(\"div\");\n        container.classList.add(\"js-screen-container\");\n\n        // while loading, this screen will render the loadingWidget's content\n        container.appendChild(loadingWidget);\n\n        return container;\n    }\n\n    // Properties\n\n    public String componentTitle() {\n        final String title = (String) get(\"af_componentTitle\");\n        return title != null ? title : getComponentId();\n    }\n\n    public String componentContextId() {\n        return (String) get(\"af_componentContextId\");\n    }\n\n    public elemental2.core.JsMap<String, Object> subscriptions() {\n        return Js.cast(get(\"af_subscriptions\"));\n    }\n\n    public String getComponentId() {\n        return componentId;\n    }\n\n    // Lifecycle\n\n    public void onStartup(final JsPlaceRequest placeRequest) {\n        run(\"af_onStartup\", placeRequest);\n    }\n\n    public void onOpen() {\n        run(\"af_onOpen\");\n    }\n\n    public void onClose() {\n        run(\"af_onClose\");\n        unmount();\n    }\n\n    public boolean onMayClose() {\n        return !defines(\"af_onMayClose\") || (boolean) run(\"af_onMayClose\");\n    }\n\n    public void onShutdown() {\n        run(\"af_onShutdown\");\n    }\n\n    public void onFocus() {\n        run(\"af_onFocus\");\n    }\n\n    public void onLostFocus() {\n        run(\"af_onLostFocus\");\n    }\n\n    private Object get(final String property) {\n        if (!screenLoaded()) {\n            return null;\n        }\n        return getNative(property);\n    }\n\n    private Object run(final String functionName) {\n        if (!screenLoaded()) {\n            return null;\n        }\n        return runNative(functionName);\n    }\n\n    private Object run(final String functionName, final Object arg1) {\n        if (!screenLoaded()) {\n            return null;\n        }\n        return runNative(functionName, arg1);\n    }\n\n    public boolean defines(final String property) {\n        if (!screenLoaded()) {\n            return false;\n        }\n        return definesNative(property);\n    }\n\n    private native Object getNative(final String property)  /*-{\n        return this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[property];\n    }-*/;\n\n    private native Object runNative(final String functionName) /*-{\n        return this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[functionName] && this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[functionName]();\n    }-*/;\n\n    private native Object runNative(final String functionName, final Object arg1) /*-{\n        return this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[functionName] && this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[functionName](arg1);\n    }-*/;\n\n    private native boolean definesNative(final String property) /*-{\n        return this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self[property] !== undefined;\n    }-*/;\n\n    public native void renderNative() /*-{\n        $wnd.AppFormer.render(\n                this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self.af_componentRoot(),\n                this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::container);\n    }-*/;\n\n    private native void unmount() /*-{\n        if (this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::self.af_isReact) {\n            $wnd.ReactDOM.unmountComponentAtNode(this.@org.uberfire.jsbridge.client.screen.JsNativeScreen::container);\n        }\n    }-*/;\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/java/org/uberfire/jsbridge/client/screen/JsWorkbenchScreenActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.screen;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.bus.client.ErraiBus;\nimport org.jboss.errai.bus.client.api.Subscription;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.enterprise.client.cdi.AbstractCDIEventCallback;\nimport org.jboss.errai.enterprise.client.cdi.api.CDI;\nimport org.jboss.errai.marshalling.client.Marshalling;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyActivity;\nimport org.uberfire.jsbridge.client.JsPlaceRequest;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class JsWorkbenchScreenActivity extends AbstractWorkbenchScreenActivity implements JsWorkbenchLazyActivity {\n\n    private InvocationPostponer invocationsPostponer;\n\n    private PlaceRequest place;\n    private JsNativeScreen screen;\n    List<Subscription> subscriptions;\n\n    public JsWorkbenchScreenActivity(final JsNativeScreen screen,\n                                     final PlaceManager placeManager) {\n\n        super(placeManager);\n        this.screen = screen;\n        this.subscriptions = new ArrayList<>();\n        this.invocationsPostponer = new InvocationPostponer();\n    }\n\n    @Override\n    public void updateRealContent(final JavaScriptObject jsObject) {\n        this.screen.updateRealContent(jsObject);\n        this.invocationsPostponer.executeAll();\n    }\n\n    // Lifecycle\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n\n        this.place = place;\n\n        if (!isScreenLoaded()) {\n            invocationsPostponer.postpone(() -> this.onStartup(place));\n            return;\n        }\n\n        this.registerSubscriptions();\n        screen.onStartup(JsPlaceRequest.fromPlaceRequest(place));\n    }\n\n    public boolean isScreenLoaded() {\n        return screen.screenLoaded();\n    }\n\n    @Override\n    public void onOpen() {\n\n        // render no matter if the script was loaded or not, even if the call results in a blank screen being rendered.\n        screen.render();\n\n        if (!isScreenLoaded()) {\n            invocationsPostponer.postpone(this::onOpen);\n            return;\n        }\n\n        screen.onOpen();\n        placeManager.executeOnOpenCallbacks(place);\n    }\n\n    @Override\n    public void onClose() {\n\n        if (isScreenLoaded()) {\n            screen.onClose();\n        }\n\n        placeManager.executeOnCloseCallbacks(place);\n    }\n\n    @Override\n    public boolean onMayClose() {\n\n        if (isScreenLoaded()) {\n            return screen.onMayClose();\n        }\n\n        return true;\n    }\n\n    @Override\n    public void onShutdown() {\n\n        this.invocationsPostponer.clear();\n\n        if (isScreenLoaded()) {\n            this.unsubscribeFromAllEvents();\n            screen.onShutdown();\n        }\n    }\n\n    @Override\n    public void onFocus() {\n        if (isScreenLoaded()) {\n            screen.onFocus();\n        }\n    }\n\n    @Override\n    public void onLostFocus() {\n        if (isScreenLoaded()) {\n            screen.onLostFocus();\n        }\n    }\n\n    // Properties\n\n    @Override\n    public String getTitle() {\n        return screen.componentTitle();\n    }\n\n    @Override\n    public Position getDefaultPosition() {\n        return CompassPosition.ROOT;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return screen.getComponentId();\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> consumer) {\n        consumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget(screen.getElement());\n    }\n\n    @Override\n    public String contextId() {\n        return screen.componentContextId();\n    }\n\n    @Override\n    public int preferredHeight() {\n        return -1;\n    }\n\n    @Override\n    public int preferredWidth() {\n        return -1;\n    }\n\n    // CDI Events Subscriptions\n\n    void registerSubscriptions() {\n        screen.subscriptions().forEach(this::registerSubscription);\n    }\n\n    //TODO: Parent classes of \"eventFqcn\" should be subscribed to as well?\n    //FIXME: Marshall/unmarshall is happening twice\n    Void registerSubscription(final Object callback, final String eventFqcn, final Object obj) {\n        subscriptions.add(getSubscription(callback, eventFqcn));\n        subscribeOnErraiBus(eventFqcn);\n        return null;\n    }\n\n    void subscribeOnErraiBus(final String eventFqcn) {\n        ErraiBus.get().subscribe(\"cdi.event:\" + eventFqcn, CDI.ROUTING_CALLBACK);\n    }\n\n    Subscription getSubscription(final Object callback, final String eventFqcn) {\n        return CDI.subscribe(eventFqcn, new AbstractCDIEventCallback<Object>() {\n            public void fireEvent(final Object event) {\n                callWithParsedJsonObject(callback, Marshalling.toJSON(event));\n            }\n        });\n    }\n\n    public native void callWithParsedJsonObject(final Object func, final String jsonArg) /*-{\n        func(JSON.parse(jsonArg));\n    }-*/;\n\n    private void unsubscribeFromAllEvents() {\n        this.subscriptions.forEach(Subscription::remove);\n        this.subscriptions = new ArrayList<>();\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/main/resources/org/uberfire/jsbridge/AppFormerJsBridge.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~        http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n</module>\n"
  },
  {
    "path": "appformer-js-bridge/src/test/java/org/uberfire/jsbridge/client/loading/AppFormerJsActivityLoaderTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport javax.enterprise.inject.Instance;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.promise.Promise;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyActivity;\nimport org.uberfire.jsbridge.client.screen.JsWorkbenchScreenActivity;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.promise.SyncPromises;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.singletonList;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertSame;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.internal.verification.VerificationModeFactory.times;\nimport static org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.Type.EDITOR;\nimport static org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.Type.SCREEN;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AppFormerJsActivityLoaderTest {\n\n    private AppFormerJsActivityLoader appFormerJsActivityLoader;\n\n    @Mock\n    private AppFormerComponentsRegistry appFormerComponentsRegistry;\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private EventSourceMock<ActivityLazyLoaded> activityLazyLoadedEvent;\n\n    private SyncPromises promises = new SyncPromises();\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void before() {\n        appFormerJsActivityLoader = spy(new AppFormerJsActivityLoader(\n                promises,\n                activityManager,\n                mock(ActivityBeansCache.class),\n                mock(PlaceManager.class),\n                mock(LazyLoadingScreen.class),\n                activityLazyLoadedEvent,\n                mock(Instance.class),\n                appFormerComponentsRegistry));\n    }\n\n    @Test\n    public void registerComponentPerspective() {\n        doNothing().when(appFormerJsActivityLoader).registerPerspective(any());\n        AppFormerComponentsRegistry.Entry entry = getEntry(\"a-perspective\", AppFormerComponentsRegistry.Entry.Type.PERSPECTIVE, \"bar.js\");\n        appFormerJsActivityLoader.registerComponent(entry);\n        verify(appFormerJsActivityLoader).registerPerspective(entry);\n    }\n\n    @Test\n    public void registerComponentScreen() {\n        doNothing().when(appFormerJsActivityLoader).registerScreen(any());\n        AppFormerComponentsRegistry.Entry entry = getEntry(\"a-screen\", SCREEN, \"bar.js\");\n        appFormerJsActivityLoader.registerComponent(entry);\n        verify(appFormerJsActivityLoader).registerScreen(entry);\n    }\n\n    @Test\n    public void registerComponentEditor() {\n        doNothing().when(appFormerJsActivityLoader).registerEditor(any());\n        AppFormerComponentsRegistry.Entry entry = getEntry(\"an-editor\", EDITOR, \"bar.js\");\n        appFormerJsActivityLoader.registerComponent(entry);\n        verify(appFormerJsActivityLoader).registerEditor(entry);\n    }\n\n    private AppFormerComponentsRegistry.Entry getEntry(final String componentId,\n                                                       final AppFormerComponentsRegistry.Entry.Type type,\n                                                       final String scriptFileName) {\n\n        final AppFormerComponentsRegistry.Entry entry = spy(new AppFormerComponentsRegistry.Entry(componentId, mock(JavaScriptObject.class)));\n        doReturn(type).when(entry).getType();\n        doReturn(scriptFileName).when(entry).getSource();\n        return entry;\n    }\n\n    @Test\n    public void init() {\n        doReturn(new String[]{\"foo\", \"bar\"}).when(appFormerComponentsRegistry).keys();\n        doReturn(mock(JavaScriptObject.class)).when(appFormerComponentsRegistry).get(anyString());\n        doNothing().when(appFormerJsActivityLoader).registerComponent(any());\n\n        appFormerJsActivityLoader.init(\"my-module\");\n\n        verify(appFormerJsActivityLoader, times(2)).registerComponent(any());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void onComponentLoaded_unregistered() {\n        final JavaScriptObject jsObject = mock(JavaScriptObject.class);\n        doReturn(\"my-component-id\").when(appFormerJsActivityLoader).extractComponentId(jsObject);\n\n        appFormerJsActivityLoader.onComponentLoaded(jsObject);\n    }\n\n    @Test\n    public void onComponentLoaded_registeredEditor() {\n        final AppFormerComponentsRegistry.Entry entry = getEntry(\"my-component-id\", EDITOR, \"foo.js\");\n\n        doReturn(\"my-component-id\").when(appFormerJsActivityLoader).extractComponentId(any());\n        doNothing().when(appFormerJsActivityLoader).registerEditor(any(), eq(\"my-component-id\"));\n\n        appFormerJsActivityLoader.registerEditor(entry);\n        appFormerJsActivityLoader.onComponentLoaded(entry.getSelf());\n\n        verify(appFormerJsActivityLoader).registerEditor(entry.getSelf(), entry.getComponentId());\n    }\n\n    @Test\n    public void onComponentLoaded_registeredComponent() {\n        final AppFormerComponentsRegistry.Entry entry = getEntry(\"my-component-id\", SCREEN, \"foo.js\");\n\n        doReturn(\"my-component-id\").when(appFormerJsActivityLoader).extractComponentId(any());\n        doNothing().when(appFormerJsActivityLoader).registerScreen(entry);\n        doReturn(mock(Activity.class)).when(appFormerJsActivityLoader).updateRealContent(any(), eq(\"my-component-id\"));\n\n        appFormerJsActivityLoader.registerComponent(entry);\n        appFormerJsActivityLoader.onComponentLoaded(entry.getSelf());\n\n        verify(appFormerJsActivityLoader).updateRealContent(entry.getSelf(), entry.getComponentId());\n        verify(activityLazyLoadedEvent).fire(any());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void loadScriptFor_noScript() {\n        doReturn(Optional.empty()).when(appFormerJsActivityLoader.getScriptFileName(\"my-component-id\"));\n        appFormerJsActivityLoader.loadScriptFor(\"my-component-id\");\n    }\n\n    @Test\n    public void loadScriptFor_unloaded() {\n        init();\n        doReturn(Optional.of(\"a-script-path.js\")).when(appFormerJsActivityLoader).getScriptFileName(\"my-component-id\");\n        doReturn(promises.<Void>resolve()).when(appFormerJsActivityLoader).loadScript(\"my-module/a-script-path.js\");\n\n        appFormerJsActivityLoader.loadScriptFor(\"my-component-id\").catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void loadScriptFor_loaded() {\n        loadScriptFor_unloaded();\n        verify(appFormerJsActivityLoader).loadScript(any()); //Invoked once on first load\n\n        appFormerJsActivityLoader.loadScriptFor(\"my-component-id\").catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        });\n\n        verify(appFormerJsActivityLoader).loadScript(any()); //Still only invoked once\n    }\n\n    @Test\n    public void updateRealContent() {\n        final JavaScriptObject jsObject = mock(JavaScriptObject.class);\n        final JsWorkbenchScreenActivity activity = mock(JsWorkbenchScreenActivity.class);\n        doReturn(activity).when(activityManager).getActivity(any());\n\n        final Activity foo = appFormerJsActivityLoader.updateRealContent(jsObject, \"foo\");\n\n        assertEquals(foo, activity);\n        verify((JsWorkbenchLazyActivity) foo).updateRealContent(jsObject);\n    }\n\n    @Test\n    public void getScriptFileName_unexistent() {\n        assertEquals(Optional.empty(), appFormerJsActivityLoader.getScriptFileName(\"my-component\"));\n    }\n\n    @Test\n    public void getScriptFileName_editor() {\n        appFormerJsActivityLoader.registerEditor(getEntry(\"my-component\", EDITOR, \"foo.js\"));\n\n        final Optional<String> scriptFileName = appFormerJsActivityLoader.getScriptFileName(\"my-component\");\n\n        assertTrue(scriptFileName.isPresent());\n        assertEquals(\"foo.js\", scriptFileName.get());\n    }\n\n    @Test\n    public void getScriptFileName_component() {\n        doNothing().when(appFormerJsActivityLoader).registerScreen(any());\n        appFormerJsActivityLoader.registerComponent(getEntry(\"my-component\", SCREEN, \"foo.js\"));\n\n        final Optional<String> scriptFileName = appFormerJsActivityLoader.getScriptFileName(\"my-component\");\n\n        assertTrue(scriptFileName.isPresent());\n        assertEquals(\"foo.js\", scriptFileName.get());\n    }\n\n    @Test\n    public void triggerLoadOfMatchingEditors_nullPath() {\n        assertFalse(appFormerJsActivityLoader.triggerLoadOfMatchingEditors(null, null));\n    }\n\n    @Test\n    public void triggerLoadOfMatchingEditors_nullPathURI() {\n        assertFalse(appFormerJsActivityLoader.triggerLoadOfMatchingEditors(new PathFactory.PathImpl(\"foo.txt\", null), null));\n    }\n\n    @Test\n    public void triggerLoadOfMatchingEditors_noMatchingEditors() {\n        doReturn(new ArrayList<>()).when(appFormerJsActivityLoader).loadMatchingEditors(\"default://foo.txt\");\n        assertFalse(appFormerJsActivityLoader.triggerLoadOfMatchingEditors(new PathFactory.PathImpl(\"foo.txt\", \"default://foo.txt\"), null));\n    }\n\n    @Test\n    public void triggerLoadOfMatchingEditors_moreThanZeroMatchingEditors() {\n        final List<Promise<Void>> loadingEditors = singletonList(promises.resolve());\n        doReturn(loadingEditors).when(appFormerJsActivityLoader).loadMatchingEditors(\"default://foo.txt\");\n        doNothing().when(appFormerJsActivityLoader).finishLoadingMatchingEditors(any(), any());\n\n        assertTrue(appFormerJsActivityLoader.triggerLoadOfMatchingEditors(new PathFactory.PathImpl(\"foo.txt\", \"default://foo.txt\"), null));\n\n        verify(appFormerJsActivityLoader).finishLoadingMatchingEditors(loadingEditors, null);\n    }\n\n    @Test\n    public void finishLoadingMatchingEditors_success() {\n        final List<Promise<Void>> ps = asList(promises.resolve(), promises.resolve());\n        final AtomicBoolean pass = new AtomicBoolean(false);\n        appFormerJsActivityLoader.finishLoadingMatchingEditors(ps, () -> pass.set(true));\n        assertTrue(pass.get());\n    }\n\n    @Test\n    public void finishLoadingMatchingEditors_failure() {\n        final List<Promise<Void>> ps = asList(promises.resolve(), promises.reject(null));\n        appFormerJsActivityLoader.finishLoadingMatchingEditors(ps, Assert::fail);\n    }\n\n    @Test\n    public void loadMatchingEditors_matches() {\n        AppFormerComponentsRegistry.Entry entry1 = getEntry(\"my-editor\", EDITOR, \"foo.js\");\n        doReturn(true).when(entry1).matches(\"my-asset.txt\");\n        appFormerJsActivityLoader.registerEditor(entry1);\n\n        AppFormerComponentsRegistry.Entry entry2 = getEntry(\"my-other-editor\", EDITOR, \"foo.js\");\n        doReturn(true).when(entry2).matches(\"my-asset.txt\");\n        appFormerJsActivityLoader.registerEditor(entry2);\n\n        final Promise<Object> p1 = promises.resolve();\n        doReturn(p1).when(appFormerJsActivityLoader).loadScriptFor(\"my-editor\");\n\n        final Promise<Object> p2 = promises.resolve();\n        doReturn(p2).when(appFormerJsActivityLoader).loadScriptFor(\"my-other-editor\");\n\n        final List<Promise<Void>> promises = appFormerJsActivityLoader.loadMatchingEditors(\"my-asset.txt\");\n\n        assertEquals(2, promises.size());\n        assertSame(p1, promises.get(0));\n        assertSame(p2, promises.get(1));\n    }\n\n    @Test\n    public void loadMatchingEditors_doesntMatch() {\n        AppFormerComponentsRegistry.Entry entry1 = getEntry(\"my-editor\", EDITOR, \"foo.js\");\n        doReturn(false).when(entry1).matches(\"my-asset.txt\");\n        appFormerJsActivityLoader.registerEditor(entry1);\n\n        AppFormerComponentsRegistry.Entry entry2 = getEntry(\"my-other-editor\", EDITOR, \"foo.js\");\n        doReturn(true).when(entry2).matches(\"my-asset.txt\");\n        appFormerJsActivityLoader.registerEditor(entry2);\n\n        final Promise<Object> p2 = promises.resolve();\n        doReturn(p2).when(appFormerJsActivityLoader).loadScriptFor(\"my-other-editor\");\n\n        final List<Promise<Void>> promises = appFormerJsActivityLoader.loadMatchingEditors(\"my-asset.txt\");\n\n        assertEquals(1, promises.size());\n        assertSame(p2, promises.get(0));\n    }\n}"
  },
  {
    "path": "appformer-js-bridge/src/test/java/org/uberfire/jsbridge/client/loading/AppFormerJsLifecycleIT.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Modifier;\nimport java.util.HashMap;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.dom.DOMTokenList;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport org.jboss.errai.enterprise.client.cdi.api.CDI;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.marshalling.client.Marshalling;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.powermock.api.mockito.PowerMockito;\nimport org.powermock.core.classloader.annotations.PrepareForTest;\nimport org.powermock.modules.junit4.PowerMockRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyActivity;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.jsbridge.client.AppFormerJsBridge;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\nimport org.uberfire.jsbridge.client.screen.JsWorkbenchScreenActivity;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.promise.SyncPromises;\n\nimport static java.util.Collections.singletonList;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.internal.verification.VerificationModeFactory.times;\nimport static org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.Type.EDITOR;\nimport static org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.Type.PERSPECTIVE;\nimport static org.uberfire.jsbridge.client.loading.AppFormerComponentsRegistry.Entry.Type.SCREEN;\n\n@RunWith(PowerMockRunner.class)\n@PrepareForTest({IOC.class, CDI.class, Marshalling.class})\npublic class AppFormerJsLifecycleIT {\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private ActivityBeansCache activityBeansCache;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private LazyLoadingScreen lazyLoadingScreen;\n\n    @Mock\n    private EventSourceMock<ActivityLazyLoaded> eventSourceMock;\n\n    @Mock\n    private Workbench workbench;\n\n    private SyncPromises promises = new SyncPromises();\n\n    private AppFormerComponentsRegistry registry = spy(new AppFormerComponentsRegistry());\n\n    private AppFormerJsActivityLoader appFormerJsActivityLoader;\n\n    private AppFormerJsBridge appFormerJsBridge;\n\n    @Before\n    public void before() {\n        appFormerJsActivityLoader = spy(new AppFormerJsActivityLoader(\n                promises,\n                activityManager,\n                activityBeansCache,\n                placeManager,\n                lazyLoadingScreen,\n                eventSourceMock,\n                null,\n                registry));\n\n        appFormerJsBridge = spy(new AppFormerJsBridge(workbench, appFormerJsActivityLoader, promises));\n    }\n\n    @Test\n    public void testGoTo() {\n        doNothing().when(placeManager).goTo((PlaceRequest) any());\n        final SyncBeanManager beanManager = ensureSetupBeanManager();\n        ensureBeanManagerHas(beanManager, PlaceManager.class, placeManager);\n\n        appFormerJsBridge.goTo(\"SomePlace\");\n\n        verify(placeManager).goTo((PlaceRequest) any());\n    }\n\n    @Test\n    public void testGoToPath() {\n        doNothing().when(placeManager).goTo((Path) any());\n        final SyncBeanManager beanManager = ensureSetupBeanManager();\n        ensureBeanManagerHas(beanManager, PlaceManager.class, placeManager);\n\n        appFormerJsBridge.goToPath(\"SomeUri\");\n\n        verify(placeManager).goTo((Path) any());\n    }\n\n    @Test\n    public void testFireEvent() {\n        PowerMockito.mockStatic(CDI.class);\n        PowerMockito.doNothing().when(CDI.class);\n        CDI.fireEvent(any());\n\n        PowerMockito.mockStatic(Marshalling.class);\n        PowerMockito.when(Marshalling.fromJSON((String) any())).thenReturn(\"MarshalledEvent\");\n\n        appFormerJsBridge.fireEvent(\"{\\\"foo\\\": \\\"bar\\\"}\");\n\n        PowerMockito.verifyStatic(Marshalling.class);\n        Marshalling.fromJSON(\"{\\\"foo\\\": \\\"bar\\\"}\");\n        PowerMockito.verifyStatic(CDI.class);\n        CDI.fireEvent(\"MarshalledEvent\");\n    }\n\n    @Test\n    public void testTranslate() {\n        doReturn(\"translated!\").when(translationService).format(\"key\");\n        final SyncBeanManager beanManager = ensureSetupBeanManager();\n        ensureBeanManagerHas(beanManager, TranslationService.class, translationService);\n\n        final String translated = appFormerJsBridge.translate(\"key\", new String[]{});\n\n        assertEquals(\"translated!\", translated);\n        verify(translationService).format(\"key\");\n    }\n\n    @Test\n    public void testInitWithErrorWhileLoadingScripts() {\n        ensureBridgeWillBeExposed();\n        ensureScriptWontLoadForModule(\"ModuleWithError\");\n\n        appFormerJsBridge.init(\"ModuleWithError\");\n\n        verify(workbench).addStartupBlocker(AppFormerJsBridge.class);\n        verify(appFormerJsActivityLoader, never()).init(anyString());\n        verify(workbench).removeStartupBlocker(AppFormerJsBridge.class);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testScreenLifecycle() {\n        final ArgumentCaptor<SingletonBeanDefinition> captor = ArgumentCaptor.forClass(SingletonBeanDefinition.class);\n\n        //Init\n        ensureComponentIsInAppFormerComponentsRegistry(\"foo-screen\", SCREEN);\n        ensureDomGlobalCanCreateDivs();\n        ensureScriptsWillLoadForModule(\"ScreenTestModule\");\n        ensureBridgeWillBeExposed();\n        final SyncBeanManager beanManager = ensureSetupBeanManager();\n\n        appFormerJsBridge.init(\"ScreenTestModule\");\n\n        verify(workbench).addStartupBlocker(AppFormerJsBridge.class);\n        verify(appFormerJsActivityLoader).init(\"ScreenTestModule\");\n        verify(appFormerJsActivityLoader).registerScreen(any());\n        verify(activityBeansCache).addNewScreenActivity(any());\n        verify(beanManager).registerBean(captor.capture());\n        verify(beanManager).registerBeanTypeAlias(any(), eq(WorkbenchScreenActivity.class));\n        verify(beanManager).registerBeanTypeAlias(any(), eq(JsWorkbenchLazyActivity.class));\n        verify(beanManager).registerBeanTypeAlias(any(), eq(Activity.class));\n        verify(workbench).removeStartupBlocker(AppFormerJsBridge.class);\n\n        //Register Screen\n        final JsWorkbenchScreenActivity activity = (JsWorkbenchScreenActivity) spy(captor.getValue().getInstance());\n        final JavaScriptObject screenJsObject = ensureActivityRepresentsRegisteredComponent(activity, \"foo-screen\");\n        ensureBeanManagerHas(beanManager, AppFormerJsActivityLoader.class, appFormerJsActivityLoader);\n\n        appFormerJsBridge.registerScreen(screenJsObject);\n\n        verify(appFormerJsActivityLoader).onComponentLoaded(screenJsObject);\n        verify(activity).updateRealContent(screenJsObject);\n        assertTrue(activity.isScreenLoaded());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testPerspectiveLifecycle() {\n        final ArgumentCaptor<SingletonBeanDefinition> captor = ArgumentCaptor.forClass(SingletonBeanDefinition.class);\n\n        //Init\n        ensureComponentIsInAppFormerComponentsRegistry(\"foo-perspective\", PERSPECTIVE);\n        ensureDomGlobalCanCreateDivs();\n        ensureScriptsWillLoadForModule(\"PerspectiveTestModule\");\n        ensureBridgeWillBeExposed();\n        final SyncBeanManager beanManager = ensureSetupBeanManager();\n        ensureBeanManagerHas(beanManager, ActivityBeansCache.class, activityBeansCache);\n        ensureBeanManagerHas(beanManager, PlaceManager.class, placeManager);\n        ensureBeanManagerHas(beanManager, ActivityManager.class, activityManager);\n        ensureBeanManagerHasBeansForName(beanManager, \"foo-perspective\");\n\n        appFormerJsBridge.init(\"PerspectiveTestModule\");\n\n        verify(workbench).addStartupBlocker(AppFormerJsBridge.class);\n        verify(appFormerJsActivityLoader).init(\"PerspectiveTestModule\");\n        verify(appFormerJsActivityLoader).registerPerspective(any());\n        verify(beanManager).registerBean(captor.capture());\n        verify(beanManager).registerBeanTypeAlias(any(), eq(PerspectiveActivity.class));\n        verify(beanManager).registerBeanTypeAlias(any(), eq(JsWorkbenchLazyActivity.class));\n        verify(beanManager).registerBeanTypeAlias(any(), eq(Activity.class));\n        verify(activityBeansCache).addNewPerspectiveActivity(any());\n        verify(workbench).removeStartupBlocker(AppFormerJsBridge.class);\n\n        //Register Perspective\n        final JsWorkbenchLazyPerspectiveActivity activity = (JsWorkbenchLazyPerspectiveActivity) spy(captor.getValue().getInstance());\n        final JavaScriptObject screenJsObject = ensureActivityRepresentsRegisteredComponent(activity, \"foo-perspective\");\n        ensureBeanManagerHas(beanManager, AppFormerJsActivityLoader.class, appFormerJsActivityLoader);\n        ensurePerspectiveIsNotTemplated(activity);\n\n        appFormerJsBridge.registerPerspective(screenJsObject);\n\n        verify(appFormerJsActivityLoader).onComponentLoaded(screenJsObject);\n        verify(activity).updateRealContent(screenJsObject);\n        assertTrue(activity.isPerspectiveLoaded());\n    }\n\n    @Test\n    public void registerEditor() {\n\n        //Init\n        ensureComponentIsInAppFormerComponentsRegistry(\"foo-editor\", EDITOR);\n        ensureDomGlobalCanCreateDivs();\n        ensureScriptsWillLoadForModule(\"EditorTestModule\");\n        ensureBridgeWillBeExposed();\n\n        appFormerJsBridge.init(\"EditorTestModule\");\n\n        verify(workbench).addStartupBlocker(AppFormerJsBridge.class);\n        verify(appFormerJsActivityLoader).init(\"EditorTestModule\");\n        verify(appFormerJsActivityLoader).registerEditor(any());\n        assertTrue(appFormerJsActivityLoader.editors.containsKey(\"foo-editor\"));\n        verify(workbench).removeStartupBlocker(AppFormerJsBridge.class);\n\n        //Registering Editor is still not supported, see https://issues.jboss.org/browse/AF-1882\n    }\n\n    private void ensurePerspectiveIsNotTemplated(JsWorkbenchLazyPerspectiveActivity activity) {\n        doReturn(false).when(activity).isPerspectiveTemplated(any());\n    }\n\n    private void ensureBeanManagerHasBeansForName(final SyncBeanManager beanManager, final String name) {\n        doReturn(singletonList(mock(SyncBeanDef.class))).when(beanManager).lookupBeans(name);\n    }\n\n    private void ensureBridgeWillBeExposed() {\n        doNothing().when(appFormerJsBridge).exposeBridgeAsNativeJs();\n    }\n\n    private void ensureScriptsWillLoadForModule(final String module) {\n        doReturn(promises.resolve()).when(appFormerJsBridge).loadAppFormerJsAndReactScripts(module);\n    }\n\n    private void ensureScriptWontLoadForModule(final String module) {\n        doReturn(promises.reject(null)).when(appFormerJsBridge).loadAppFormerJsAndReactScripts(module);\n    }\n\n    private JavaScriptObject ensureActivityRepresentsRegisteredComponent(final Activity activity, final String id) {\n        final JavaScriptObject screenJsObject = mock(JavaScriptObject.class);\n        doReturn(id).when(appFormerJsActivityLoader).extractComponentId(screenJsObject);\n        doReturn(activity).when(activityManager).getActivity(any());\n        return screenJsObject;\n    }\n\n    private void ensureBeanManagerHas(final SyncBeanManager beanManager, final Class<?> clazz, final Object bean) {\n        final SyncBeanDef syncBeanDef = mock(SyncBeanDef.class);\n        doReturn(bean).when(syncBeanDef).getInstance();\n        doReturn(syncBeanDef).when(beanManager).lookupBean(clazz);\n    }\n\n    private void ensureDomGlobalCanCreateDivs() {\n        doReturn(nativeScreenContainerDiv()).when(mockDomGlobalDocument()).createElement(any());\n    }\n\n    private SyncBeanManager ensureSetupBeanManager() {\n        PowerMockito.mockStatic(IOC.class);\n        SyncBeanManager beanManager = mock(SyncBeanManager.class);\n        PowerMockito.when(IOC.getBeanManager()).thenReturn(beanManager);\n        doNothing().when(beanManager).registerBean(any());\n        doNothing().when(beanManager).registerBeanTypeAlias(any(), any());\n        return beanManager;\n    }\n\n    private void ensureComponentIsInAppFormerComponentsRegistry(final String id, final AppFormerComponentsRegistry.Entry.Type type) {\n        doReturn(new String[]{id}).when(registry).keys();\n        final AppFormerComponentsRegistry.Entry entry = spy(new AppFormerComponentsRegistry.Entry(id, mock(JavaScriptObject.class)));\n        doReturn(type).when(entry).getType();\n        doReturn(\"\").when(entry).getSource();\n        doReturn(new HashMap<>()).when(entry).getParams();\n        doReturn(entry).when(appFormerJsActivityLoader).newRegistryEntry(eq(id));\n    }\n\n    private HTMLDivElement nativeScreenContainerDiv() {\n        final HTMLDivElement div = mock(HTMLDivElement.class);\n        div.classList = mock(DOMTokenList.class);\n        return div;\n    }\n\n    private HTMLDocument mockDomGlobalDocument() {\n        try {\n            final Field document = DomGlobal.class.getDeclaredField(\"document\");\n            document.setAccessible(true);\n\n            final Field modifiersField = Field.class.getDeclaredField(\"modifiers\");\n            modifiersField.setAccessible(true);\n            modifiersField.setInt(document, document.getModifiers() & ~Modifier.FINAL);\n\n            final HTMLDocument mock = mock(HTMLDocument.class);\n            document.set(null, mock);\n            return mock;\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/test/java/org/uberfire/jsbridge/client/loading/JsWorkbenchLazyPerspectiveActivityTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.loading;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.jsbridge.client.perspective.JsWorkbenchPerspectiveActivity;\nimport org.uberfire.jsbridge.client.perspective.jsnative.JsNativePerspective;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class JsWorkbenchLazyPerspectiveActivityTest {\n\n    private JsWorkbenchLazyPerspectiveActivity jsWorkbenchLazyPerspectiveActivity;\n\n    private PlaceManager placeManager;\n    private AppFormerComponentsRegistry.Entry entry;\n    private ActivityManager activityManager;\n    private Consumer<String> lazyLoadingParentScript;\n\n    @Before\n    public void before() {\n        placeManager = mock(PlaceManager.class);\n        entry = mock(AppFormerComponentsRegistry.Entry.class);\n        activityManager = mock(ActivityManager.class);\n        lazyLoadingParentScript = s -> {\n        };\n\n        jsWorkbenchLazyPerspectiveActivity = spy(new JsWorkbenchLazyPerspectiveActivity(\n                entry,\n                placeManager,\n                activityManager,\n                lazyLoadingParentScript));\n    }\n\n    @Test\n    public void getNotLoaded() {\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(mock(JsWorkbenchPerspectiveActivity.class));\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(false);\n        assertEquals(jsWorkbenchLazyPerspectiveActivity, jsWorkbenchLazyPerspectiveActivity.get());\n    }\n\n    @Test\n    public void getLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(true);\n        assertEquals(backedPerspective, jsWorkbenchLazyPerspectiveActivity.get());\n    }\n\n    @Test\n    public void onStartupLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(true);\n\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        jsWorkbenchLazyPerspectiveActivity.onStartup(placeRequest);\n\n        verify(backedPerspective).onStartup(placeRequest);\n    }\n\n    @Test\n    public void onStartupNotLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(false);\n\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        jsWorkbenchLazyPerspectiveActivity.onStartup(placeRequest);\n\n        verify(backedPerspective, never()).onStartup(placeRequest);\n    }\n\n    @Test\n    public void onOpenLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(true);\n\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n\n        verify(backedPerspective).onOpen();\n        verify(placeManager).executeOnOpenCallbacks(any());\n        verify(jsWorkbenchLazyPerspectiveActivity, never()).onLoaded();\n    }\n\n    @Test\n    public void onOpenNotLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(false);\n\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n\n        verify(backedPerspective, never()).onOpen();\n        verify(placeManager, times(2)).executeOnOpenCallbacks(any());\n        verify(jsWorkbenchLazyPerspectiveActivity).onLoaded();\n    }\n\n    @Test\n    public void onCloseLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(true);\n\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onClose();\n\n        verify(backedPerspective).onClose();\n        verify(placeManager).executeOnCloseCallbacks(any());\n    }\n\n    @Test\n    public void onCloseNotLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(false);\n\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n        jsWorkbenchLazyPerspectiveActivity.onClose();\n\n        verify(backedPerspective, never()).onClose();\n        verify(placeManager, times(2)).executeOnCloseCallbacks(any());\n    }\n\n    @Test\n    public void onShutdownLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(true);\n\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n        jsWorkbenchLazyPerspectiveActivity.onShutdown();\n\n        verify(backedPerspective).onShutdown();\n    }\n\n    @Test\n    public void onShutdownNotLoaded() {\n        JsWorkbenchPerspectiveActivity backedPerspective = mock(JsWorkbenchPerspectiveActivity.class);\n        when(jsWorkbenchLazyPerspectiveActivity.getBackedPerspective()).thenReturn(backedPerspective);\n        when(jsWorkbenchLazyPerspectiveActivity.isPerspectiveLoaded()).thenReturn(false);\n\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n        jsWorkbenchLazyPerspectiveActivity.onClose();\n        jsWorkbenchLazyPerspectiveActivity.onShutdown();\n\n        verify(backedPerspective, never()).onShutdown();\n    }\n\n    @Test\n    public void updateRealContent() {\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        doReturn(perspectiveActivity).when(jsWorkbenchLazyPerspectiveActivity).getBackedPerspective(any());\n        doReturn(true).when(activityManager).isStarted(any());\n\n        jsWorkbenchLazyPerspectiveActivity.updateRealContent(mock(JavaScriptObject.class));\n\n        assertEquals(perspectiveActivity, jsWorkbenchLazyPerspectiveActivity.backedPerspective);\n        verify(perspectiveActivity).onStartup(any());\n        verify(perspectiveActivity).onOpen();\n        verify(placeManager).goTo((PlaceRequest) any());\n    }\n\n    @Test\n    public void updateRealContent_notStarted() {\n        jsWorkbenchLazyPerspectiveActivity.onStartup(mock(PlaceRequest.class));\n        jsWorkbenchLazyPerspectiveActivity.onOpen();\n\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        doReturn(perspectiveActivity).when(jsWorkbenchLazyPerspectiveActivity).getBackedPerspective(any());\n        doReturn(false).when(activityManager).isStarted(any());\n\n        jsWorkbenchLazyPerspectiveActivity.updateRealContent(mock(JavaScriptObject.class));\n\n        assertEquals(perspectiveActivity, jsWorkbenchLazyPerspectiveActivity.backedPerspective);\n        verify(perspectiveActivity, never()).onStartup(any());\n        verify(perspectiveActivity).onOpen();\n        verify(placeManager).goTo((PlaceRequest) any());\n    }\n\n    @Test\n    public void updateRealContent_notOpen() {\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        doReturn(perspectiveActivity).when(jsWorkbenchLazyPerspectiveActivity).getBackedPerspective(any());\n        doReturn(false).when(activityManager).isStarted(any());\n\n        jsWorkbenchLazyPerspectiveActivity.updateRealContent(mock(JavaScriptObject.class));\n\n        assertEquals(perspectiveActivity, jsWorkbenchLazyPerspectiveActivity.backedPerspective);\n        verify(perspectiveActivity, never()).onStartup(any());\n        verify(perspectiveActivity, never()).onOpen();\n        verify(placeManager, never()).goTo((PlaceRequest) any());\n    }\n}\n"
  },
  {
    "path": "appformer-js-bridge/src/test/java/org/uberfire/jsbridge/client/screen/JsWorkbenchScreenActivityTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.jsbridge.client.screen;\n\nimport org.jboss.errai.bus.client.api.Subscription;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JsWorkbenchScreenActivityTest {\n\n    private JsWorkbenchScreenActivity jsWorkbenchScreenActivity;\n\n    @Mock\n    private JsNativeScreen jsNativeScreen;\n\n    @Before\n    public void before() {\n        jsWorkbenchScreenActivity = spy(new JsWorkbenchScreenActivity(jsNativeScreen,\n                                                                      mock(PlaceManager.class)));\n    }\n\n    @Test\n    public void registerSubscription() {\n        final Object callback = mock(Object.class);\n        final String eventFqcn = \"foo\";\n\n        doReturn(mock(Subscription.class)).when(jsWorkbenchScreenActivity).getSubscription(callback, eventFqcn);\n        doNothing().when(jsWorkbenchScreenActivity).subscribeOnErraiBus(eventFqcn);\n\n        final Void nullReturn = jsWorkbenchScreenActivity.registerSubscription(callback, eventFqcn, null);\n        assertNull(nullReturn);\n        assertEquals(1, jsWorkbenchScreenActivity.subscriptions.size());\n        verify(jsWorkbenchScreenActivity).subscribeOnErraiBus(eventFqcn);\n    }\n}"
  },
  {
    "path": "appformer-js-monaco/.gitignore",
    "content": "node_modules/\ndist/\ncoverage/\ntarget/"
  },
  {
    "path": "appformer-js-monaco/package.json",
    "content": "{\n  \"name\": \"appformer-js-monaco\",\n  \"version\": \"0.0.0\",\n  \"description\": \"Single-file build of monaco-editor.\",\n  \"main\": \"dist/monaco.min.js\",\n  \"files\": [\"dist\"],\n  \"scripts\": {\n    \"init\": \"yarn install --force\",\n    \"clean\": \"rimraf dist\",\n    \"build\": \"yarn clean && webpack\"\n  },\n  \"devDependencies\": {\n    \"@kiegroup/monaco-editor\": \"1.0.0\",\n    \"babel-loader\": \"7.1.4\",\n    \"webpack\": \"4.25.1\",\n    \"webpack-cli\": \"3.1.2\",\n    \"copy-webpack-plugin\": \"5.1.0\"\n  },\n  \"dependencies\": {},\n  \"keywords\": [\"monaco\"]\n}\n"
  },
  {
    "path": "appformer-js-monaco/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n\n    <parent>\n        <groupId>org.uberfire</groupId>\n        <artifactId>uberfire-parent</artifactId>\n        <version>7.75.0-SNAPSHOT</version>\n        <relativePath>../pom.xml</relativePath>\n    </parent>\n\n    <packaging>jar</packaging>\n    <artifactId>appformer-js-monaco</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <name>AppFormer.js :: Monaco Editor</name>\n    <description>AppFormer.js Monaco Editor</description>\n\n    <dependencies>\n        <dependency>\n            <groupId>org.uberfire</groupId>\n            <artifactId>appformer-js</artifactId>\n            <scope>provided</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>com.github.eirslett</groupId>\n                <artifactId>frontend-maven-plugin</artifactId>\n                <configuration>\n                    <installDirectory>${project.build.directory}</installDirectory>\n                </configuration>\n                <executions>\n                    <execution>\n                        <id>install yarn</id>\n                        <goals>\n                            <goal>install-node-and-yarn</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>install node and npm</id>\n                        <phase>initialize</phase>\n                        <goals>\n                            <goal>install-node-and-npm</goal>\n                        </goals>\n                    </execution>\n                    <execution>\n                        <id>lock-treatment-tool execution</id>\n                        <phase>initialize</phase>\n                        <goals>\n                        <goal>npm</goal>\n                        </goals>\n                        <configuration>\n                        <arguments>exec @kie/lock-treatment-tool@${version.lock-treatment-tool} --</arguments>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>yarn run init</id>\n                        <goals>\n                            <goal>yarn</goal>\n                        </goals>\n                        <configuration>\n                            <arguments>run init</arguments>\n                        </configuration>\n                    </execution>\n                    <execution>\n                        <id>yarn run build</id>\n                        <goals>\n                            <goal>yarn</goal>\n                        </goals>\n                        <configuration>\n                            <arguments>run build</arguments>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n            <plugin>\n                <artifactId>maven-resources-plugin</artifactId>\n                <version>3.1.0</version>\n                <executions>\n                    <execution>\n                        <id>copy-resources</id>\n                        <phase>prepare-package</phase>\n                        <goals>\n                            <goal>copy-resources</goal>\n                        </goals>\n                        <configuration>\n                            <outputDirectory>\n                                ${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}/\n                            </outputDirectory>\n                            <resources>\n                                <resource>\n                                    <directory>dist/</directory>\n                                    <filtering>false</filtering>\n                                </resource>\n                                <resource>\n                                    <directory>.</directory>\n                                    <includes>package.json</includes>\n                                </resource>\n                            </resources>\n                        </configuration>\n                    </execution>\n                </executions>\n            </plugin>\n        </plugins>\n    </build>\n</project>\n"
  },
  {
    "path": "appformer-js-monaco/prettier.config.js",
    "content": "module.exports = {\n    printWidth: 120\n};\n"
  },
  {
    "path": "appformer-js-monaco/src/index.ts",
    "content": ""
  },
  {
    "path": "appformer-js-monaco/tsconfig.json",
    "content": "{\n  \"exclude\": [\n    \"./node_modules\"\n  ],\n  \"include\": [\n    \"./src\"\n  ],\n  \"compilerOptions\": {\n    \"outDir\": \"./\",\n    \"lib\": [\n      \"es6\",\n      \"dom\"\n    ],\n    \"target\": \"es5\",\n    \"declaration\": true,\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"strictNullChecks\": true,\n    \"experimentalDecorators\": true,\n    \"jsx\": \"react\"\n  }\n}\n"
  },
  {
    "path": "appformer-js-monaco/tsconfig.webpack.json",
    "content": "{\n  \"exclude\": [\"./node_modules\", \"./src/**/__tests__\"],\n  \"extends\": \"./tsconfig.json\"\n}\n"
  },
  {
    "path": "appformer-js-monaco/tslint.json",
    "content": "{\n  \"defaultSeverity\": \"error\",\n  \"extends\": [\n    \"tslint:recommended\",\n    \"tslint-react\",\n    \"tslint-config-prettier\"\n  ],\n  \"jsRules\": {},\n  \"rules\": {\n    \"jsx-no-multiline-js\": false,\n    \"ordered-imports\": false,\n    \"object-literal-sort-keys\": false,\n    \"no-console\": false,\n    \"interface-name\": [\n      true,\n      \"never-prefix\"\n    ],\n    \"max-classes-per-file\": false,\n    \"jsx-no-lambda\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"constructor\",\n          \"instance-method\",\n          \"static-method\"\n        ]\n      }\n    ],\n    \"variable-name\": [\n      true,\n      \"ban-keywords\",\n      \"check-format\",\n      \"allow-snake-case\",\n      \"allow-pascal-case\",\n      \"allow-leading-underscore\"\n    ],\n    \"comment-format\": false\n  },\n  \"rulesDirectory\": []\n}\n"
  },
  {
    "path": "appformer-js-monaco/webpack.config.js",
    "content": "const CopyPlugin = require(\"copy-webpack-plugin\");\n\nmodule.exports = {\n    mode: 'production',\n    entry: {\n        index: \"./src/index.ts\"\n    },\n    plugins: [\n        new CopyPlugin([\n            { from: \"node_modules/@kiegroup/monaco-editor/dist/standalone/monaco.min.js\", to: \"./monaco-editor\" }\n        ])\n    ]\n}"
  },
  {
    "path": "dashbuilder/README.md",
    "content": "Dashbuilder\n===========\n\nDashbuilder is a general purpose dashboard and reporting web app which allows for:\n\n* Visual configuration and personalization of dashboards\n* Support for different types of visualizations using several charting libraries\n* Full featured editor for the definition of chart visualizations\n* Definition of interactive report tables\n* Data extraction from external systems, through different protocols\n* Support for both analytics and real-time dashboards\n\nLicensed under the Apache License, Version 2.0\n\nFor further information, please visit the project web site <a href=\"http://dashbuilder.org\" target=\"_blank\">dashbuilder.org</a>\n\nUpcoming features\n=================\n\n* New renderers based on D3 JS, Lienzo GWT & Chart JS\n* Hierarchical (nested group) displayer types: Tree & Pie\n* Support for multiple dynamic data series\n* Rich mobility support\n* Alerts and SLA configuration\n* RESTful API\n\nArchitecture\n=================\n\n* Not tied to any chart rendering technology. Pluggable renderers.\n* No tied to any data storage.\n* Ability to read data from: CSV files, Databases or Java generators.\n* Decoupled client & server layers. Ability to build pure lightweight client dashboards.\n* Ability to push & handle data sets on client for better performance.\n* Based on <a href=\"http://www.uberfireframework.org\" target=\"_blank\">Uberfire</a>, a framework for building rich workbench styled apps on the web.\n\nChange log\n==========\n\n0.6.0.Final\n\n* New perspective for the authoring of new application pages and configuring the navigation menus.\n (Content Management Perspective => [https://issues.jboss.org/browse/DASHBUILDE-166](https://issues.jboss.org/browse/DASHBUILDE-166))\n\n0.4.0.Final\n\n* User interface upgraded to Bootstrap3/PatternFly\n\n* MonetDB support added to the SQL provider.\n  (the provider has been tested under the MonetDB 11.21.5 release)\n\n* MariaDB support added to the SQL provider.\n  (the provider has been tested under the MariaDB 10.1.10 release)\n\n* New data set filtering functions \"IN\" and \"NOT IN\" \n\n* Data Set Core API available as an embeddable java library\n  (further details [here](https://github.com/dgutierr/datasets-sample-project)) \n\n0.3.0.Final\n\n* New provider for the definition of data sets stored into SQL databases.\n  The following is the list of tested and supported DBs:\n\n  - MySQL 5.5\n  - Postgres 9.2\n  - H2 1.3.168+\n  - Oracle 12c and 11gR2\n  - IBM DB2 9.7 and 10.5\n  - Sybase ASE 15.7\n\n* New provider for the retrieval of data stored into Elastic Search nodes.\n  The provider has been tested under Elastic Search 1.7.1 release.\n\n* New data set editor UI module:\n    - Creation of SQL, Bean, CSV and Elastic Search data set definitions\n    - Data set retrieval testing and preview\n    - Filter, sort and export the data previews\n\n* New displayer for showing single value metrics.\n\n* Added new displayer subtypes: bar (stacked), pie (3d, donut), line (smooth)\n\n* Support for real-time dashboards. Displayer refresh settings.\n\n* Displayer editor data set lookup enhancements:\n    - Filter editor for retrieving only a data subset.\n    - Time frame function for the retrieval of time series data in real-time.\n    - Different strategies for grouping time series data.\n    - Ability to add/remove the columns/series to display.\n\n0.2.0.Final\n\n* Data set definition files: Support for CSV & Bean generated data sets\n* Displayer Editor widget for the creation of displayer definitions\n* Perspective editor integration which allows the creation of dashboards by drag&drop\n\n0.1.1.Final\n\n* Notify clients about data set registration/removal events\n* Assign an HTML identifier to every Displayer instance (useful for testing purposes)\n\n0.1.0.Final\n\nMain goal of this very first release is to make it possible the creation of\ncomposite dashboards using an straightforward API. Feature set:\n\n* Shared API for defining and registering data sets\n* Shared operation engine for executing filter, group & sort operations over a data set\n* Client API & widgets for defining Displayer instances\n* Uberfire wrapper screen for the Displayer widget\n* Showcase App. providing a built-in displayer gallery plus some dashboard samples\n* Default renderer based on the Google Visualization library\n* Additional table renderer based on the Uberfire PagedTable widget\n* JBoss AS 7 distribution provided\n\nBuild & run\n===========\n\nPrerequisites\n-------------\n* Git client\n* Maven 3.2.5+\n* Java 1.6+\n\nFirst steps\n-----------\n\nClone the project\n\n    git clone git@github.com:dashbuilder/dashbuilder.git\n\nNow you can build & run the project in development or production mode.\n\nDevelopment mode\n----------------\n\nDevelopment mode allows a user to develop with the framework by compiling classes and client assets on runtime, which decreases the development time. There are more implications such as browser compatibilities, language support, etc. It's useful for developing and testing the application.\n\nDashbuilder is currently built using GWT 2.7, so you are forced to use [SuperDevMode](http://www.gwtproject.org/articles/superdevmode.html) to run the application.\n\nSuper development mode is the new way to work in GWT since version <code>2.5</code> (Native support & the default mode in GWT <code>2.7</code>).\nIt works in most new browsers and it's based on [Source Map](https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?hl=en_US&pli=1&pli=1) spec. It's faster and more efficient than the old hosted mode. There are lots of benefits and other important reasons to use it, you can find more information [here](http://www.gwtproject.org/articles/superdevmode.html).\n\nDashbuilder supports and it's configured by default to use SuperDevMode.\n\nUsing it means running two servers, one for the web application and one for the Code Server that compiles classes for SDM when the compile button is pushed on the web page or in the bookmark.\n\nTo build the application:\n\n    cd dashbuilder\n    mvn clean install -DskipTests\n\nTo run it:\n\n    cd dashbuilder-webapp\n    mvn gwt:run\n\nLogin:\n\n    admin / admin\n\n\n(If you are an IntelliJ fan, we also provide a setup for running the application under this fantastic IDE. Details [here](https://groups.google.com/forum/#!topic/dashbuilder-development/tRa6AAMb8fM))\n\nProduction mode\n---------------\n\nProduction mode is used to build & package the application for a production environment. The application is compiled and the javascript assets are build using all permutations (browser support), all languages, etc.\n\nIn order to build the production mode:\n\n    cd dashbuilder\n    mvn clean install -DskipTests -Dfull\n\nOnce build is finished, you'll find the WAR distribution for Wildfly in <code>dashbuilder/dashbuilder-distros/target/</code>.\n\nJust deploy the WAR file into your application server!\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-dataset-cdi</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Dataset Core CDI support</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-collections</groupId>\n      <artifactId>commons-collections</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-csv</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-sql</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-prometheus</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-kafka</artifactId>\n    </dependency>    \n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <!-- Unit testing -->\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-core</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-spi</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.arquillian.junit</groupId>\n      <artifactId>arquillian-junit-container</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.arquillian.container</groupId>\n      <artifactId>arquillian-weld-se-embedded-1.1</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.shrinkwrap.resolver</groupId>\n      <artifactId>shrinkwrap-resolver-depchain</artifactId>\n      <type>pom</type>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.inject</groupId>\n          <artifactId>javax.inject</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>javax.enterprise</groupId>\n          <artifactId>cdi-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/Bootstrap.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.BeanDataSetProviderCDI;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryCDI;\nimport org.dashbuilder.dataprovider.StaticDataSetProviderCDI;\nimport org.dashbuilder.dataset.DataSetDefDeployerCDI;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.DataSetManagerCDI;\nimport org.dashbuilder.scheduler.SchedulerCDI;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\n/**\n * Class in charge of bootstrapping the core subsystems using CDI.\n *\n * <p>It boots right before any regular {@link Startup} beans in order to ensure that any reference to a dataset\n * subsystem has been properly initialized.</p>\n */\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class Bootstrap {\n\n    protected static Logger log = LoggerFactory.getLogger(Bootstrap.class);\n\n    @Inject\n    protected SchedulerCDI scheduler;\n\n    @Inject\n    protected StaticDataSetProviderCDI staticDataSetProvider;\n\n    @Inject\n    protected BeanDataSetProviderCDI beanDataSetProvider;\n\n    @Inject\n    protected DataSetProviderRegistryCDI providerRegistry;\n\n    @Inject\n    protected DataSetDefRegistryCDI dataSetDefRegistry;\n\n    @Inject\n    protected DataSetDefDeployerCDI dataSetDefDeployer;\n\n    @Inject\n    protected DataSetManagerCDI dataSetManager;\n\n    @PostConstruct\n    public void init() {\n        // IMPORTANT: DO NOT alter the initialization order in order to not breaking the component inter dependencies\n        DataSetCore dataSetCore = DataSetCore.get();\n        dataSetCore.setDataSetProviderRegistry(providerRegistry);\n        dataSetCore.setDataSetDefRegistry(dataSetDefRegistry);\n        dataSetCore.setScheduler(scheduler);\n        dataSetCore.setStaticDataSetProvider(staticDataSetProvider);\n        dataSetCore.setBeanDataSetProvider(beanDataSetProvider);\n        dataSetCore.setDataSetDefDeployer(dataSetDefDeployer);\n        dataSetCore.setDataSetManager(dataSetManager);\n        log.info(\"Core subsystems initialized\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/config/Config.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.config;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.enterprise.util.Nonbinding;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER})\npublic @interface Config {\n\n    @Nonbinding String value() default \"\";\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/config/ConfigReader.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.config;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.lang.reflect.Type;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.spi.Annotated;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.inject.Inject;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Producer class for primitive fields annotated with @Config\n */\n@ApplicationScoped\npublic class ConfigReader {\n\n    private static Logger log = LoggerFactory.getLogger(ConfigReader.class);\n    private volatile Properties globalProperties;\n    private volatile Map<String, Properties> beanPropertyMap;\n    public static final String beansConfigFile =\"META-INF/beans.config\";\n\n    @PostConstruct\n    public void init() {\n        try {\n            globalProperties = new Properties();\n            beanPropertyMap = new HashMap<String, Properties>();\n            InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(beansConfigFile);\n            if (is != null) globalProperties.load(is);\n        } catch (IOException ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    public @Produces @Config String readConfig(InjectionPoint p) {\n\n        // Read from specific bean\n        String beanKey = p.getMember().getDeclaringClass().getName();\n        Properties beanProperties = beanPropertyMap.get(beanKey);\n        if (beanProperties == null) {\n            beanPropertyMap.put(beanKey, beanProperties = new Properties());\n            try {\n                InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(\"META-INF/\" + beanKey + \".config\");\n                if (is != null)  beanProperties.load(is);\n            } catch (IOException ex) {\n                throw new RuntimeException(ex);\n            }\n        }\n\n        // Read from the bean config\n        String configKey = p.getMember().getName();\n        String configValue = beanProperties.getProperty(configKey);\n        if (configValue != null) return configValue;\n\n        // Read from global - by the fully qualified class name and field name\n        for (Type type : p.getBean().getTypes()) {\n            configKey = ((Class)type).getName() + \".\" + p.getMember().getName();\n            configValue = globalProperties.getProperty(configKey);\n            if (configValue != null) return configValue;\n\n            // Try class name from System.properties\n            configValue = System.getProperty(configKey);\n            if (configValue != null) {\n                log.info(String.format(\"System property: %s=%s\", configKey, configValue));\n                return configValue;\n            }\n            // Try class simple name from System.properties\n            configKey = ((Class)type).getSimpleName() + \".\" + p.getMember().getName();\n            configValue = System.getProperty(configKey);\n            if (configValue != null) {\n                log.info(String.format(\"System property: %s=%s\", configKey, configValue));\n                return configValue;\n            }\n        }\n\n        // Read from global - only by the field name\n        configKey = p.getMember().getName();\n        configValue = globalProperties.getProperty(configKey);\n        if (configValue != null) return configValue;\n\n        // Return the default value if any.\n        Annotated annotated = p.getAnnotated();\n        Config config = annotated.getAnnotation(Config.class);\n        if (config != null) return config.value();\n        return null;\n    }\n\n    public @Produces @Config byte readPrimitiveByte(InjectionPoint p) {\n        String val= readConfig(p);\n        return Byte.parseByte(val);\n    }\n\n    public @Produces @Config short readPrimitiveShort(InjectionPoint p) {\n        String val= readConfig(p);\n        return Short.parseShort(val);\n    }\n\n    public @Produces @Config int readPrimitiveInt(InjectionPoint p) {\n        String val= readConfig(p);\n        return Integer.parseInt(val);\n    }\n\n    public @Produces @Config long readPrimitiveLong(InjectionPoint p) {\n        String val= readConfig(p);\n        return Long.parseLong(val);\n    }\n\n    public @Produces @Config boolean readPrimitiveBoolean(InjectionPoint p) {\n        String val= readConfig(p);\n        return Boolean.parseBoolean(val);\n    }\n\n    public @Produces @Config float readPrimitiveFloat(InjectionPoint p) {\n        String val= readConfig(p);\n        return Float.parseFloat(val);\n    }\n\n    public @Produces @Config double readPrimitiveDouble(InjectionPoint p) {\n        String val= readConfig(p);\n        return Double.parseDouble(val);\n    }\n\n    public @Produces @Config  String[] readStringArray(InjectionPoint p) {\n        String val = readConfig(p);\n        String[] result = StringUtils.split(val, \",\");\n        for (int i = 0; i < result.length; i++) {\n            result[i] = result[i].trim();\n        }\n        return result;\n    }\n\n    public @Produces @Config java.util.List<String> readStringList(InjectionPoint p) {\n        String val = readConfig(p);\n        String[] array = StringUtils.split(val, \",\");\n        List<String> list = new ArrayList<String>();\n        for (int i = 0; i < array.length; i++) {\n            list.add(array[i].trim());\n        }\n        return list;\n    }\n\n    public @Produces @Config Map<String,String> readStringMap(InjectionPoint p) {\n        String val = readConfig(p);\n        Map<String,String> results = new HashMap<String, String>();\n        String[] rows = StringUtils.split(val, \",\");\n        for (int i = 0; i < rows.length; i++) {\n            String row = rows[i].trim();\n            final String[] rowSplit = row.split(\"=\");\n            if (rowSplit.length != 2) throw new IllegalArgumentException(\"Illegal map entry '\" + row + \"'\");\n            results.put(rowSplit[0].trim(), rowSplit[1].trim());\n        }\n        return results;\n    }\n\n    public @Produces @Config Properties readProperties(InjectionPoint p) {\n        String val = readConfig(p);\n        Properties results = new Properties();\n        String[] rows = StringUtils.split(val, \",\");\n        for (int i = 0; i < rows.length; i++) {\n            String row = rows[i].trim();\n            final String[] rowSplit = row.split(\"=\");\n            if (rowSplit.length != 2) throw new IllegalArgumentException(\"Illegal property entry '\" + row + \"'\");\n            results.put(rowSplit[0].trim(), rowSplit[1].trim());\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/BeanDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataSetGenerator;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\n\n@ApplicationScoped\npublic class BeanDataSetProviderCDI extends BeanDataSetProvider {\n\n    protected BeanManager beanManager;\n    protected Map<String,DataSetGenerator> generatorMap = new HashMap<>();\n\n    public BeanDataSetProviderCDI() {\n        super();\n    }\n\n    @Inject\n    public BeanDataSetProviderCDI(StaticDataSetProviderCDI staticDataSetProvider,\n                                  BeanManager beanManager) {\n\n        super(staticDataSetProvider);\n        this.beanManager = beanManager;\n    }\n\n    @PostConstruct\n    protected void init() {\n        Set<Bean<?>> beans = beanManager.getBeans(DataSetGenerator.class);\n        for (Bean<?> bean : beans) {\n            CreationalContext<?> ctx = beanManager.createCreationalContext(bean);\n            DataSetGenerator generator = (DataSetGenerator) beanManager.getReference(bean, DataSetGenerator.class, ctx);\n            generatorMap.put(bean.getBeanClass().getName(), generator);\n        }\n    }\n\n    public DataSetGenerator lookupGenerator(DataSetDef def) {\n        BeanDataSetDef beanDef = (BeanDataSetDef) def;\n        String beanName = beanDef.getGeneratorClass();\n        DataSetGenerator generator = generatorMap.get(beanName);\n\n        if (generator != null ) {\n            return generator;\n        } else {\n            throw new IllegalArgumentException(\"Data set generator class not found: \" + beanName);\n        }\n    }\n\n    // Listen to changes on the data set definition registry\n\n    protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.BEAN.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.BEAN.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getOldDataSetDef();\n        if (DataSetProviderType.BEAN.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/CSVDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.csv.CSVDataSetProvider;\nimport org.dashbuilder.dataprovider.csv.CSVFileStorage;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\n\n@ApplicationScoped\npublic class CSVDataSetProviderCDI extends CSVDataSetProvider {\n\n    public CSVDataSetProviderCDI() {\n    }\n\n    @Inject\n    public CSVDataSetProviderCDI(StaticDataSetProviderCDI staticDataSetProvider,\n                                 CSVFileStorage csvStorage) {\n\n        super(staticDataSetProvider,\n                csvStorage);\n    }\n\n    // Listen to changes on the data set definition registry\n\n    protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.CSV.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent  event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.CSV.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getOldDataSetDef();\n        if (DataSetProviderType.CSV.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/DataSetProviderRegistryCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport java.util.Iterator;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\n\n@ApplicationScoped\npublic class DataSetProviderRegistryCDI extends DataSetProviderRegistryImpl {\n\n    @Inject\n    private StaticDataSetProviderCDI staticDataSetProviderCDI;\n\n    @Inject\n    private BeanDataSetProviderCDI beanDataSetProviderCDI;\n\n    @Inject\n    private CSVDataSetProviderCDI csvDataSetProviderCDI;\n\n    @Inject\n    private SQLDataSetProviderCDI sqlDataSetProviderCDI;\n\n    @Inject\n    private PrometheusDataSetProviderCDI prometheusDataSetProviderCDI;\n    \n    @Inject\n    private KafkaDataSetProviderCDI kafkaDataSetProviderCDI;\n\n    @Inject\n    private Instance<DataSetProvider> providerSet;\n\n    protected DataSetDefJSONMarshaller dataSetDefJSONMarshaller = new DataSetDefJSONMarshaller(this);\n\n    @PostConstruct\n    public void init() {\n        DataSetCore.get().setDataSetDefJSONMarshaller(dataSetDefJSONMarshaller);\n\n        // Register all the providers available in classpath\n        Iterator<DataSetProvider> it = providerSet.iterator();\n        while (it.hasNext()) {\n            DataSetProvider provider = it.next();\n            super.registerDataProvider(provider);\n        }\n\n        // Register the core providers\n        super.registerDataProvider(staticDataSetProviderCDI);\n        super.registerDataProvider(beanDataSetProviderCDI);\n        super.registerDataProvider(csvDataSetProviderCDI);\n        super.registerDataProvider(sqlDataSetProviderCDI);\n        super.registerDataProvider(prometheusDataSetProviderCDI);\n        super.registerDataProvider(kafkaDataSetProviderCDI);\n    }\n\n    public StaticDataSetProviderCDI getStaticDataSetProviderCDI() {\n        return staticDataSetProviderCDI;\n    }\n\n    public BeanDataSetProviderCDI getBeanDataSetProviderCDI() {\n        return beanDataSetProviderCDI;\n    }\n\n    public CSVDataSetProviderCDI getCsvDataSetProviderCDI() {\n        return csvDataSetProviderCDI;\n    }\n\n    public SQLDataSetProviderCDI getSqlDataSetProviderCDI() {\n        return sqlDataSetProviderCDI;\n    }\n\n    public PrometheusDataSetProviderCDI getPrometheusDataSetProviderCDI() {\n        return prometheusDataSetProviderCDI;\n    }\n    \n    public KafkaDataSetProviderCDI getKafkaDataSetProviderCDI() {\n        return kafkaDataSetProviderCDI;\n    }\n\n    public DataSetDefJSONMarshaller getDataSetDefJSONMarshaller() {\n        return dataSetDefJSONMarshaller;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/KafkaDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.kafka.KafkaDataSetProvider;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\n\n@ApplicationScoped\npublic class KafkaDataSetProviderCDI extends KafkaDataSetProvider {\n\n    public KafkaDataSetProviderCDI() {\n        // empty\n    }\n\n    @Inject\n    public KafkaDataSetProviderCDI(StaticDataSetProviderCDI staticDataSetProvider) {\n        super(staticDataSetProvider);\n    }\n\n    protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.KAFKA.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.KAFKA.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getOldDataSetDef();\n        if (DataSetProviderType.KAFKA.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/PrometheusDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.prometheus.PrometheusDataSetProvider;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\n\n@ApplicationScoped\npublic class PrometheusDataSetProviderCDI extends PrometheusDataSetProvider {\n\n    public PrometheusDataSetProviderCDI() {\n        // empty\n    }\n\n    @Inject\n    public PrometheusDataSetProviderCDI(StaticDataSetProviderCDI staticDataSetProvider) {\n        super(staticDataSetProvider);\n    }\n\n    protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.PROMETHEUS.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.PROMETHEUS.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n    protected void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getOldDataSetDef();\n        if (DataSetProviderType.PROMETHEUS.equals(def.getProvider())) {\n            staticDataSetProvider.removeDataSet(def.getUUID());\n        }\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/SQLDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataprovider.sql.SQLDataSetProvider;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\n\n@ApplicationScoped\npublic class SQLDataSetProviderCDI extends SQLDataSetProvider {\n\n    public SQLDataSetProviderCDI() {\n    }\n\n    @Inject\n    public SQLDataSetProviderCDI(StaticDataSetProviderCDI staticDataSetProvider,\n                                 SQLDataSourceLocatorCDI sqlDataSourceLocator) {\n\n        super(staticDataSetProvider,\n                DataSetCore.get().getIntervalBuilderLocator(),\n                DataSetCore.get().getIntervalBuilderDynamicDate(),\n                DataSetCore.get().getSharedDataSetOpEngine());\n\n        super.setDataSourceLocator(sqlDataSourceLocator);\n    }\n\n    // Listen to changes on the data set definition registry\n\n    protected void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.SQL.equals(def.getProvider())) {\n            String uuid = def.getUUID();\n            staticDataSetProvider.removeDataSet(uuid);\n        }\n    }\n\n    protected void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (DataSetProviderType.SQL.equals(def.getProvider())) {\n            String uuid = def.getUUID();\n            _metadataMap.remove(uuid);\n            staticDataSetProvider.removeDataSet(uuid);\n        }\n    }\n\n    protected void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getOldDataSetDef();\n        if (DataSetProviderType.SQL.equals(def.getProvider())) {\n            String uuid = def.getUUID();\n            _metadataMap.remove(uuid);\n            staticDataSetProvider.removeDataSet(uuid);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/SQLDataSourceLocatorCDI.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.naming.InitialContext;\nimport javax.sql.DataSource;\n\nimport org.dashbuilder.dataprovider.sql.JDBCUtils;\nimport org.dashbuilder.dataprovider.sql.SQLDataSourceLocator;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\n\n@ApplicationScoped\npublic class SQLDataSourceLocatorCDI implements SQLDataSourceLocator {\n\n    @Override\n    public DataSource lookup(SQLDataSetDef def) throws Exception {\n        InitialContext ctx = new InitialContext();\n        return (DataSource) ctx.lookup(def.getDataSource());\n    }\n\n    @Override\n    public List<SQLDataSourceDef> list() {\n        return JDBCUtils.listDatasourceDefs();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataprovider/StaticDataSetProviderCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataprovider;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.DataSetCore;\n\n@ApplicationScoped\npublic class StaticDataSetProviderCDI extends StaticDataSetProvider {\n\n    public StaticDataSetProviderCDI() {\n        super(DataSetCore.get().getSharedDataSetOpEngine());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataset/DataSetDefDeployerCDI.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.config.Config;\n\n@ApplicationScoped\npublic class DataSetDefDeployerCDI extends DataSetDefDeployer {\n\n    @Inject @Config(\"\")\n    String directory;\n\n    @Inject @Config(\"3000\")\n    int scanIntervalInMillis;\n\n    @Inject\n    DataSetDefRegistryCDI dataSetDefRegistry;\n\n    @PostConstruct\n    public void init() {\n        super.setJsonMarshaller(DataSetCore.get().getDataSetDefJSONMarshaller());\n        super.setDataSetDefRegistry(dataSetDefRegistry);\n        super.setScanIntervalInMillis(scanIntervalInMillis);\n\n        if (!StringUtils.isBlank(directory)) {\n            deploy(directory);\n        }\n    }\n\n    @PreDestroy\n    public synchronized void stop() {\n        super.stop();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataset/DataSetDefRegistryCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport java.io.File;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.lang3.StringUtils;\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.config.Config;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryCDI;\nimport org.dashbuilder.dataprovider.csv.CSVFileStorage;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.dashbuilder.scheduler.SchedulerCDI;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\n/**\n * Data set definition registry implementation which stores data sets under GIT\n * <p>It's provided as an extension to the default in-memory based registry and it's\n * also the default CDI implementation available.</p>\n */\n@ApplicationScoped\npublic class DataSetDefRegistryCDI extends DataSetDefRegistryImpl implements CSVFileStorage {\n\n    public static final String DATASET_EXT = \".dset\";\n    public static final String CSV_EXT = \".csv\";\n\n    protected int maxCsvLength;\n    protected IOService ioService;\n    protected ExceptionManager exceptionManager;\n    protected UUIDGenerator uuidGenerator;\n    protected Event<DataSetDefModifiedEvent> dataSetDefModifiedEvent;\n    protected Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent;\n    protected Event<DataSetDefRemovedEvent> dataSetDefRemovedEvent;\n    protected Event<DataSetStaleEvent> dataSetStaleEvent;\n\n    protected FileSystem fileSystem;\n    protected Path root;\n\n    public DataSetDefRegistryCDI() {\n        super();\n    }\n\n    @Inject\n    public DataSetDefRegistryCDI(@Config(\"10485760\" /* 10 Mb */) int maxCsvLength,\n                                 @Named(\"ioStrategy\") IOService ioService,\n                                 @Named(\"datasetsFS\") FileSystem fileSystem,\n                                 DataSetProviderRegistryCDI dataSetProviderRegistry,\n                                 SchedulerCDI scheduler,\n                                 ExceptionManager exceptionManager,\n                                 Event<DataSetDefModifiedEvent> dataSetDefModifiedEvent,\n                                 Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent,\n                                 Event<DataSetDefRemovedEvent> dataSetDefRemovedEvent,\n                                 Event<DataSetStaleEvent> dataSetStaleEvent) {\n\n        super(dataSetProviderRegistry,\n              scheduler);\n        this.uuidGenerator = DataSetCore.get().getUuidGenerator();\n        this.maxCsvLength = maxCsvLength;\n        this.ioService = ioService;\n        this.fileSystem = fileSystem;\n        this.exceptionManager = exceptionManager;\n        this.dataSetDefModifiedEvent = dataSetDefModifiedEvent;\n        this.dataSetDefRegisteredEvent = dataSetDefRegisteredEvent;\n        this.dataSetDefRemovedEvent = dataSetDefRemovedEvent;\n        this.dataSetStaleEvent = dataSetStaleEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        initFileSystem();\n        deleteTempFiles();\n        registerDataSetDefs();\n    }\n\n    public DataSetDefJSONMarshaller getDataSetDefJsonMarshaller() {\n        return DataSetCore.get().getDataSetDefJSONMarshaller();\n    }\n\n    @Override\n    protected void onDataSetDefStale(DataSetDef def) {\n        dataSetStaleEvent.fire(new DataSetStaleEvent(def));\n    }\n\n    @Override\n    protected void onDataSetDefModified(DataSetDef olDef,\n                                        DataSetDef newDef) {\n        dataSetDefModifiedEvent.fire(new DataSetDefModifiedEvent(olDef,\n                                                                 newDef));\n    }\n\n    @Override\n    protected void onDataSetDefRegistered(DataSetDef newDef) {\n        dataSetDefRegisteredEvent.fire(new DataSetDefRegisteredEvent(newDef));\n    }\n\n    @Override\n    protected void onDataSetDefRemoved(DataSetDef oldDef) {\n        dataSetDefRemovedEvent.fire(new DataSetDefRemovedEvent(oldDef));\n    }\n\n    protected void initFileSystem() {\n        root = fileSystem.getRootDirectories().iterator().next();\n    }\n\n    protected void registerDataSetDefs() {\n        for (DataSetDef def : listDataSetDefs()) {\n            super.dataSetDefMap.put(def.getUUID(),\n                                    new DataSetDefEntry(def));\n        }\n    }\n\n    public org.uberfire.backend.vfs.Path resolveVfsPath(DataSetDef def) {\n        return convert(resolveNioPath(def));\n    }\n\n    protected Path resolveNioPath(DataSetDef def) {\n        return getDataSetsPath().resolve(def.getUUID() + DATASET_EXT);\n    }\n\n    @Override\n    public void registerDataSetDef(DataSetDef def,\n                                   String subjectId,\n                                   String message) {\n\n        if (def.getUUID() == null) {\n            final String uuid = uuidGenerator.newUuid();\n            def.setUUID(uuid);\n        }\n\n        if (subjectId == null || message == null) {\n            ioService.startBatch(fileSystem);\n        } else {\n            ioService.startBatch(fileSystem,\n                                 new CommentedOption(subjectId,\n                                                     message));\n        }\n\n        try {\n            String defJson = getDataSetDefJsonMarshaller().toJsonString(def);\n            Path defPath = resolveNioPath(def);\n            ioService.write(defPath,\n                            defJson);\n\n            // CSV specific\n            if (def instanceof CSVDataSetDef) {\n                saveCSVFile((CSVDataSetDef) def);\n            }\n            super.registerDataSetDef(def,\n                                     subjectId,\n                                     message);\n        } catch (Exception e) {\n            throw exceptionManager.handleException(\n                    new Exception(\"Can't register the data set definition\\n\" + def,\n                                  e));\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public DataSetDef removeDataSetDef(String uuid,\n                                       String subjectId,\n                                       String message) {\n        DataSetDef def = getDataSetDef(uuid);\n        if (def == null) {\n            return null;\n        }\n        return removeDataSetDef(def,\n                                subjectId,\n                                message);\n    }\n\n    public void removeDataSetDef(org.uberfire.backend.vfs.Path path,\n                                 String subjectId,\n                                 String comment) {\n        DataSetDef def = loadDataSetDef(path);\n        if (def != null) {\n            removeDataSetDef(def,\n                             subjectId,\n                             comment);\n        }\n    }\n\n    public DataSetDef removeDataSetDef(DataSetDef def,\n                                       String subjectId,\n                                       String message) {\n        Path defPath = resolveNioPath(def);\n\n        if (ioService.exists(defPath)) {\n            if (subjectId == null || message == null) {\n                ioService.startBatch(fileSystem);\n            } else {\n                ioService.startBatch(fileSystem,\n                                     new CommentedOption(subjectId,\n                                                         message));\n            }\n            try {\n                ioService.deleteIfExists(defPath,\n                                         StandardDeleteOption.NON_EMPTY_DIRECTORIES);\n\n                // CSV specific\n                if (def instanceof CSVDataSetDef) {\n                    deleteCSVFile((CSVDataSetDef) def);\n                }\n            } finally {\n                ioService.endBatch();\n            }\n        }\n        return super.removeDataSetDef(def.getUUID(),\n                                      subjectId,\n                                      message);\n    }\n\n    public Collection<DataSetDef> listDataSetDefs() {\n        final Collection<DataSetDef> result = new ArrayList<>();\n\n        if (ioService.exists(root)) {\n            walkFileTree(checkNotNull(\"root\",\n                                      root),\n                         new SimpleFileVisitor<Path>() {\n                             @Override\n                             public FileVisitResult visitFile(final Path file,\n                                                              final BasicFileAttributes attrs) throws IOException {\n                                 try {\n                                     checkNotNull(\"file\",\n                                                  file);\n                                     checkNotNull(\"attrs\",\n                                                  attrs);\n\n                                     if (file.getFileName().toString().endsWith(DATASET_EXT) && attrs.isRegularFile()) {\n                                         String json = ioService.readAllString(file);\n                                         DataSetDef def = getDataSetDefJsonMarshaller().fromJson(json);\n                                         result.add(def);\n                                     }\n                                 } catch (final Exception e) {\n                                     log.error(\"Data set definition read error: \" + file.getFileName(),\n                                               e);\n                                     return FileVisitResult.TERMINATE;\n                                 }\n                                 return FileVisitResult.CONTINUE;\n                             }\n                         });\n        }\n        return result;\n    }\n\n    public DataSetDef loadDataSetDef(org.uberfire.backend.vfs.Path path) {\n        Path nioPath = convert(path);\n        if (ioService.exists(nioPath)) {\n            try {\n                String json = ioService.readAllString(nioPath);\n                DataSetDef def = getDataSetDefJsonMarshaller().fromJson(json);\n                return def;\n            } catch (Exception e) {\n                String msg = \"Error parsing data set JSON definition: \" + path.getFileName();\n                throw exceptionManager.handleException(new Exception(msg,\n                                                                     e));\n            }\n        }\n        return null;\n    }\n\n    public DataSetDef copyDataSetDef(DataSetDef def,\n                                     String newName,\n                                     String subjectId,\n                                     String message) {\n        DataSetDef clone = def.clone();\n        clone.setUUID(uuidGenerator.newUuid());\n        clone.setName(newName);\n\n        if (subjectId == null || message == null) {\n            ioService.startBatch(fileSystem);\n        } else {\n            ioService.startBatch(fileSystem,\n                                 new CommentedOption(subjectId,\n                                                     message));\n        }\n        try {\n            // CSV specific\n            if (def instanceof CSVDataSetDef) {\n                CSVDataSetDef csvDef = (CSVDataSetDef) def;\n                CSVDataSetDef csvCloneDef = (CSVDataSetDef) clone;\n                Path csvPath = resolveCsvPath(csvDef);\n                Path cloneCsvPath = resolveCsvPath(csvCloneDef);\n                ioService.copy(csvPath,\n                               cloneCsvPath);\n                csvCloneDef.setFilePath(convert(cloneCsvPath).toURI());\n            }\n            String defJson = getDataSetDefJsonMarshaller().toJsonString(clone);\n            Path clonePath = resolveNioPath(clone);\n            ioService.write(clonePath,\n                            defJson);\n\n            super.registerDataSetDef(clone,\n                                     subjectId,\n                                     message);\n            return clone;\n        } catch (Exception e) {\n            throw exceptionManager.handleException(\n                    new Exception(\"Can't register the data set definition\\n\" + def,\n                                  e));\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    public Path createTempFile(String fileName) {\n        Path tempPath = resolveTempPath(fileName);\n        return tempPath;\n    }\n\n    public void deleteTempFiles() {\n        Path tempPath = getTempPath();\n        if (ioService.exists(tempPath)) {\n            ioService.startBatch(fileSystem,\n                                 new CommentedOption(\"system\",\n                                                     \"Delete temporal files\"));\n            try {\n                walkFileTree(tempPath,\n                             new SimpleFileVisitor<Path>() {\n\n                                 @Override\n                                 public FileVisitResult postVisitDirectory(Path dir,\n                                                                           IOException exc) throws IOException {\n                                     Files.delete(dir);\n                                     return FileVisitResult.CONTINUE;\n                                 }\n\n                                 @Override\n                                 public FileVisitResult visitFile(Path file,\n                                                                  BasicFileAttributes attrs) throws IOException {\n                                     Files.delete(file);\n                                     return FileVisitResult.CONTINUE;\n                                 }\n                             });\n            } finally {\n                ioService.endBatch();\n            }\n        }\n    }\n\n    protected Path getDataSetsPath() {\n        return root.resolve(\"definitions\");\n    }\n\n    protected Path getTempPath() {\n        return root.resolve(\"tmp\");\n    }\n\n    protected Path resolveTempPath(String fileName) {\n        return getTempPath().resolve(fileName);\n    }\n\n    protected org.uberfire.backend.vfs.Path convert(Path path) {\n        return Paths.convert(path);\n    }\n\n    protected Path convert(org.uberfire.backend.vfs.Path path) {\n        return Paths.convert(path);\n    }\n\n    //\n    // CSV files storage\n    //\n\n    @Override\n    public String getCSVString(CSVDataSetDef def) {\n        Path nioPath = resolveCsvPath(def);\n        if (ioService.exists(nioPath)) {\n            return ioService.readAllString(nioPath);\n        }\n        return null;\n    }\n\n    @Override\n    public InputStream getCSVInputStream(CSVDataSetDef def) {\n        Path nioPath = resolveCsvTempPath(def);\n        if (ioService.exists(nioPath)) {\n            // In edition process ...\n            return ioService.newInputStream(nioPath);\n        }\n        nioPath = resolveCsvPath(def);\n        if (ioService.exists(nioPath)) {\n            // Already created & persisted\n            return ioService.newInputStream(nioPath);\n        }\n        return null;\n    }\n\n    @Override\n    public void deleteCSVFile(CSVDataSetDef def) {\n        Path csvPath = resolveCsvPath(def);\n\n        if (ioService.exists(csvPath)) {\n            ioService.deleteIfExists(csvPath,\n                                     StandardDeleteOption.NON_EMPTY_DIRECTORIES);\n        }\n    }\n\n    @Override\n    public void saveCSVFile(CSVDataSetDef def) {\n        String path = def.getFilePath();\n        if (StringUtils.isBlank(path)) {\n            return;\n        }\n\n        // The CSV file was uploaded from UI to the temp directory => move the file to the definitions directory\n        Path csvTempPath = resolveCsvTempPath(def);\n        if (ioService.exists(csvTempPath)) {\n            Path csvPath = resolveCsvPath(def);\n            if (ioService.exists(csvPath)) {\n                // Avoid FileAlreadyExistsException on call to move (see below)\n                ioService.delete(csvPath);\n            }\n            ioService.move(csvTempPath,\n                           csvPath);\n            return;\n        }\n        // The CSV was registered or deployed via API => Copy the file contents to the definitions directory\n        File csvFile = new File(path);\n        if (csvFile.exists()) {\n            if (csvFile.length() > maxCsvLength) {\n                String msg = \"CSV file length exceeds the maximum allowed: \" + maxCsvLength / 1024 + \" Kb\";\n                throw exceptionManager.handleException(new Exception(msg));\n            }\n\n            try {\n                Path defPath = resolveCsvPath(def);\n                String csvContent = FileUtils.readFileToString(csvFile);\n                ioService.write(defPath,\n                                csvContent);\n            } catch (Exception e) {\n                String msg = \"Error saving CSV file: \" + csvFile;\n                throw exceptionManager.handleException(new Exception(msg,\n                                                                     e));\n            }\n        }\n    }\n\n    protected Path resolveCsvPath(CSVDataSetDef def) {\n        return getDataSetsPath().resolve(def.getUUID() + CSV_EXT);\n    }\n\n    protected Path resolveCsvTempPath(CSVDataSetDef def) {\n        return resolveTempPath(def.getUUID() + CSV_EXT);\n    }\n\n    void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        dataSetDefMap.put(\n            def.getUUID(),\n            new DataSetDefEntry(def));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/dataset/DataSetManagerCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.config.Config;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryCDI;\nimport org.dashbuilder.dataprovider.StaticDataSetProviderCDI;\n\n@ApplicationScoped\npublic class DataSetManagerCDI extends DataSetManagerImpl {\n\n    public DataSetManagerCDI(){\n    }\n\n    @Inject\n    public DataSetManagerCDI(StaticDataSetProviderCDI staticDataSetProvider,\n                             DataSetDefRegistryCDI dataSetDefRegistry,\n                             DataSetProviderRegistryCDI dataSetProviderRegistry,\n                             @Config(\"true\") boolean dataSetPushEnabled,\n                             @Config(\"1024\") int dataSetPushMaxSize) {\n\n        super(dataSetDefRegistry,\n                dataSetProviderRegistry,\n                staticDataSetProvider,\n                dataSetPushEnabled,\n                dataSetPushMaxSize);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/exception/ExceptionManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.exception;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.config.rebind.EnvUtil;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * <p>Handles backend exceptions.</p>\n * \n * @since 0.3.0 \n */\n@ApplicationScoped\npublic class ExceptionManager {\n\n    private static Logger log = LoggerFactory.getLogger(ExceptionManager.class);\n    \n    /**\n     * <p>Return a <code>@Portable RuntimeException</code> that can be captured by client side widgets.</p>\n     *  \n     * @param e The exception that caused the error.\n     * @return The portable exception to send to the client side.\n     */\n    public RuntimeException handleException(final Exception e) {\n        log.error(e.getMessage(), e);\n        if (e instanceof RuntimeException && EnvUtil.isPortableType(e.getClass()) ) {\n            return (RuntimeException) e;\n        }\n        return new GenericPortableException( e.getMessage(), e );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/exception/GenericPortableException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.exception;\n\nimport java.io.Serializable;\n\n/**\n * <p>Root of all portable Exceptions resulting from server-side errors that need to be sent to the client.</p> \n * @since 0.3.0\n */\npublic class GenericPortableException extends RuntimeException implements Serializable {\n\n    public GenericPortableException() {\n    }\n\n    public GenericPortableException( final String message ) {\n        super( message );\n    }\n\n    public GenericPortableException( final String message, Exception e ) {\n        super( message, e );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/java/org/dashbuilder/scheduler/SchedulerCDI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.scheduler;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.config.Config;\n\n@ApplicationScoped\npublic class SchedulerCDI extends Scheduler {\n\n    public SchedulerCDI() {\n    }\n\n    @Inject\n    public SchedulerCDI(@Config(\"10\") int maxThreadPoolSize) {\n        super.init(maxThreadPoolSize);\n    }\n\n    @PreDestroy\n    public void shutdown() {\n        super.shutdown();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/BootstrapTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport javax.inject.Inject;\n\nimport org.dashbuilder.Bootstrap;\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistry;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryCDI;\nimport org.dashbuilder.dataset.DataSetDefDeployer;\nimport org.dashbuilder.dataset.DataSetDefDeployerCDI;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.def.DataSetDefRegistry;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.test.BaseCDITest;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class BootstrapTest extends BaseCDITest {\n\n    public static final String CSV_JSON = \"{\\n\" +\n            \"  \\\"uuid\\\": \\\"expenseReports\\\",\\n\" +\n            \"  \\\"name\\\": \\\"Expense Reports\\\",\\n\" +\n            \"  \\\"provider\\\": \\\"CSV\\\",\\n\" +\n            \"}\";\n\n    @Inject\n    Bootstrap bootstrap;\n\n    @Inject\n    DataSetProviderRegistryCDI providerRegistryCDI;\n\n    @Inject\n    DataSetDefRegistryCDI dataSetDefRegistryCDI;\n\n    @Inject\n    DataSetDefDeployerCDI dataSetDefDeployerCDI;\n\n    @Before\n    public void setUp() throws Exception {\n        bootstrap.init();\n    }\n\n    @Test\n    public void testStartupAnnotation() throws Exception {\n        Startup startup = Bootstrap.class.getAnnotation(Startup.class);\n        assertNotNull(startup);\n        assertEquals(startup.value(), StartupType.BOOTSTRAP);\n    }\n\n    @Test\n    public void testProviderRegistryInit() throws Exception {\n        bootstrap.init();\n\n        DataSetProviderRegistry dataSetProviderRegistry = DataSetCore.get().getDataSetProviderRegistry();\n        assertEquals(dataSetProviderRegistry, providerRegistryCDI);\n        assertEquals(dataSetProviderRegistry.getAvailableTypes().size(), 6);\n\n        DataSetDefJSONMarshaller jsonMarshaller = DataSetCore.get().getDataSetDefJSONMarshaller();\n        jsonMarshaller.fromJson(CSV_JSON); // No exception\n    }\n\n    @Test\n    public void testDataSetDefRegistryInit() throws Exception {\n        DataSetProviderRegistry providerRegistry = dataSetDefRegistryCDI.getDataSetProviderRegistry();\n        DataSetDefJSONMarshaller jsonMarshaller = dataSetDefRegistryCDI.getDataSetDefJsonMarshaller();\n\n        assertNotNull(providerRegistry);\n        assertNotNull(jsonMarshaller);\n        assertEquals(jsonMarshaller, providerRegistryCDI.getDataSetDefJSONMarshaller());\n    }\n\n    @Test\n    public void testDataSetDeployerInit() throws Exception {\n        DataSetDefDeployer dataSetDefDeployer = DataSetCore.get().getDataSetDefDeployer();\n        assertNotNull(dataSetDefDeployer);\n        assertEquals(dataSetDefDeployer, dataSetDefDeployerCDI);\n    }\n\n    @Test\n    public void testNoListenerRegistration() throws Exception {\n        assertEquals(dataSetDefRegistryCDI.getListeners().size(), 0);\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/config/ConfigAnnotationTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.config;\n\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.dashbuilder.test.BaseCDITest;\nimport org.dashbuilder.test.ShrinkWrapHelper;\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport org.dashbuilder.pojo.Bean;\nimport org.dashbuilder.pojo.BeanExt;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class ConfigAnnotationTest extends BaseCDITest {\n\n    @Inject\n    protected Bean bean;\n\n    @Test\n    public void checkBean() {\n        assertThat(bean.propString1).isEqualTo(\"From class\");\n        assertThat(bean.propString2).isEqualTo(\"From beans.config\");\n        assertThat(bean.propString3).isEqualTo(\"From Bean.config\");\n        assertThat(((BeanExt) bean).propString4).isEqualTo(\"From class\");\n        assertThat(((BeanExt) bean).propString5).isEqualTo(\"From beans.config\");\n        assertThat(((BeanExt) bean).propString6).isEqualTo(\"From BeanExt.config\");\n        assertThat(bean.propMap4.size()).isEqualTo(3);\n        assertThat(bean.propMap4.get(\"a\")).isEqualTo(\"1\");\n        assertThat(bean.propMap4.get(\"b\")).isEqualTo(\"2\");\n        assertThat(bean.propMap4.get(\"c\")).isEqualTo(\"3\");\n        assertThat(bean.props5.size()).isEqualTo(3);\n        assertThat(bean.props5.getProperty(\"a\")).isEqualTo(\"1\");\n        assertThat(bean.props5.getProperty(\"b\")).isEqualTo(\"2\");\n        assertThat(bean.props5.getProperty(\"c\")).isEqualTo(\"3\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/dataset/DataSetDefRegistryCDITest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryCDI;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefFactory;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.dashbuilder.scheduler.SchedulerCDI;\nimport org.dashbuilder.test.BaseCDITest;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class DataSetDefRegistryCDITest extends BaseCDITest {\n\n    @Mock\n    DataSetProviderRegistryCDI dataSetProviderRegistry;\n\n    @Mock\n    SchedulerCDI scheduler;\n\n    @Mock\n    ExceptionManager exceptionManager;\n\n    @Mock\n    Event<DataSetDefModifiedEvent> dataSetDefModifiedEvent;\n\n    @Mock\n    Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent;\n\n    @Mock\n    Event<DataSetDefRemovedEvent> dataSetDefRemovedEvent;\n\n    @Mock\n    Event<DataSetStaleEvent> dataSetStaleEvent;\n\n    @Mock(name = \"datasetsFS\")\n    FileSystem fileSystem;\n\n    DataSetDefRegistryCDI dataSetDefRegistry;\n\n    public DataSetDef dataSetDef = DataSetDefFactory\n            .newCSVDataSetDef()\n            .uuid(\"testDset\")\n            .buildDef();\n\n    @Before\n    public void setUp() throws Exception {\n        MockitoAnnotations.initMocks(this);\n\n        dataSetDefRegistry = spy(new DataSetDefRegistryCDI(\n                10485760,\n                mockIOService(),\n                fileSystem,\n                dataSetProviderRegistry,\n                scheduler,\n                exceptionManager,\n                dataSetDefModifiedEvent,\n                dataSetDefRegisteredEvent,\n                dataSetDefRemovedEvent,\n                dataSetStaleEvent));\n\n        dataSetDefRegistry.init();\n\n        when(dataSetDefRegistry.convert(any(org.uberfire.java.nio.file.Path.class)))\n                .thenReturn(mock(org.uberfire.backend.vfs.Path.class));\n        when(dataSetDefRegistry.convert(any(org.uberfire.backend.vfs.Path.class)))\n                .thenReturn(mock(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testRegistryDataSetDef() throws Exception {\n        dataSetDefRegistry.registerDataSetDef(dataSetDef);\n\n        verify(getIOService()).write(any(Path.class), anyString());\n        verify(dataSetDefRegisteredEvent).fire(any(DataSetDefRegisteredEvent.class));\n    }\n\n    @Test\n    public void testDeleteDataSetDef() throws Exception {\n        when(ioService.exists(any(Path.class))).thenReturn(true);\n        dataSetDefRegistry.registerDataSetDef(dataSetDef);\n        dataSetDefRegistry.removeDataSetDef(dataSetDef.getUUID());\n\n        verify(getIOService(), atLeastOnce()).deleteIfExists(any(Path.class), eq(StandardDeleteOption.NON_EMPTY_DIRECTORIES));\n        verify(dataSetDefRemovedEvent).fire(any(DataSetDefRemovedEvent.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/dataset/DataSetProviderRegistryCDITest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport java.util.List;\nimport java.util.Set;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.*;\nimport org.dashbuilder.test.BaseCDITest;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class DataSetProviderRegistryCDITest extends BaseCDITest {\n\n    @Inject\n    DataSetProviderRegistryCDI dataSetProviderRegistry;\n\n    @Before\n    public void setUp() {\n        dataSetProviderRegistry.init();\n    }\n\n    @Test\n    public void testRegistryDataSetDef() throws Exception {\n        Set<DataSetProviderType> typeList = dataSetProviderRegistry.getAvailableTypes();\n        assertTrue(typeList.contains(DataSetProviderType.STATIC));\n        assertTrue(typeList.contains(DataSetProviderType.BEAN));\n        assertTrue(typeList.contains(DataSetProviderType.CSV));\n        assertTrue(typeList.contains(DataSetProviderType.SQL));\n\n        // In CDI contexts, DataSetProvider implementations are automatically registered\n        assertTrue(typeList.contains(CustomDataSetProvider.TYPE));\n        DataSetProvider customProvider = dataSetProviderRegistry.getDataSetProvider(CustomDataSetProvider.TYPE);\n        assertNotNull(customProvider);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/dataset/DataSetSubsystemCDITest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport org.dashbuilder.Bootstrap;\nimport org.dashbuilder.test.BaseCDITest;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport javax.inject.Inject;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class DataSetSubsystemCDITest extends BaseCDITest {\n\n    @Inject\n    Bootstrap bootstrap;\n\n    DataSetFilterTest dataSetFilterTest;\n    DataSetGroupTest dataSetGroupTest;\n    DataSetNestedGroupTest nestedGroupTest;\n    DataSetSortTest dataSetSortTest;\n    DataSetTrimTest dataSetTrimTest;\n\n    @Before\n    public void setUp() throws Exception {\n        bootstrap.init();\n\n        dataSetFilterTest = new DataSetFilterTest();\n        dataSetGroupTest = new DataSetGroupTest();\n        nestedGroupTest = new DataSetNestedGroupTest();\n        dataSetSortTest = new DataSetSortTest();\n        dataSetTrimTest = new DataSetTrimTest();\n\n        dataSetFilterTest.setUp();\n        dataSetGroupTest.setUp();\n        nestedGroupTest.setUp();\n        dataSetSortTest.setUp();\n        dataSetTrimTest.setUp();\n    }\n\n    @Test\n    public void testFilter() throws Exception {\n        dataSetFilterTest.testColumnTypes();\n        dataSetFilterTest.testFilterByString();\n        dataSetFilterTest.testFilterByNumber();\n        dataSetFilterTest.testFilterByDate();\n        dataSetFilterTest.testFilterMultiple();\n        dataSetFilterTest.testANDExpression();\n        dataSetFilterTest.testNOTExpression();\n        dataSetFilterTest.testORExpression();\n        dataSetFilterTest.testORExpressionMultilple();\n        dataSetFilterTest.testLogicalExprNonEmpty();\n        dataSetFilterTest.testCombinedExpression();\n        dataSetFilterTest.testCombinedExpression2();\n        dataSetFilterTest.testCombinedExpression3();\n        dataSetFilterTest.testLikeOperatorCaseSensitive();\n        dataSetFilterTest.testLikeOperatorNonCaseSensitive();\n        dataSetFilterTest.testFilterByStringWithPreProcessor();\n    }\n\n    @Test\n    public void testGroup() throws Exception {\n        dataSetGroupTest.testDataSetFunctions();\n        dataSetGroupTest.testDateMinMaxFunctions();\n        dataSetGroupTest.testNumberMinMaxFunctions();\n        dataSetGroupTest.testGroupByLabelDynamic();\n        dataSetGroupTest.testGroupByExcludeLabelColumn();\n        dataSetGroupTest.testGroupByYearDynamic();\n        dataSetGroupTest.testGroupByMonthDynamic();\n        dataSetGroupTest.testGroupByMonthDynamicNonEmpty();\n        dataSetGroupTest.testGroupByDayOfWeekDynamic();\n        dataSetGroupTest.testGroupByDayOfWeekFixed();\n        dataSetGroupTest.testGroupByMonthReverse();\n        dataSetGroupTest.testGroupByFixedTrim();\n        dataSetGroupTest.testGroupByMonthFixed();\n        dataSetGroupTest.testGroupByMonthFirstMonth();\n        dataSetGroupTest.testGroupByMonthFirstMonthReverse();\n        dataSetGroupTest.testGroupByQuarter();\n        dataSetGroupTest.testGroupByDateOneRow();\n        dataSetGroupTest.testGroupByDateOneDay();\n        dataSetGroupTest.testGroupAndCountSameColumn();\n        dataSetGroupTest.testGroupNumberAsLabel();\n    }\n\n    @Test\n    public void testNestedGroups() throws Exception {\n        nestedGroupTest.testGroupSelectionFilter();\n        nestedGroupTest.testNestedGroupFromMultipleSelection();\n        nestedGroupTest.testNestedGroupRequiresSelection();\n        nestedGroupTest.testNoResultsSelection();\n        nestedGroupTest.testThreeNestedLevels();\n        nestedGroupTest.testGroupByQuarter();\n    }\n\n    @Test\n    public void testSort() throws Exception {\n        dataSetSortTest.testSortByString();\n        dataSetSortTest.testSortByNumber();\n        dataSetSortTest.testSortByDate();\n        dataSetSortTest.testSortMultiple();\n        dataSetSortTest.testGroupAndSort();\n    }\n\n    @Test\n    public void testTrim() throws Exception {\n        dataSetTrimTest.testTrim();\n        dataSetTrimTest.testTrimGroup();\n        dataSetTrimTest.testDuplicatedColumns();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/dataset/SQLDataSourceLocatorCDITest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport java.util.List;\nimport javax.inject.Inject;\nimport javax.sql.DataSource;\n\nimport org.dashbuilder.dataprovider.SQLDataSetProviderCDI;\nimport org.dashbuilder.dataprovider.sql.SQLDataSourceLocator;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\nimport org.dashbuilder.test.BaseCDITest;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Arquillian.class)\n@Ignore(\"see https://issues.jboss.org/browse/RHPAM-832\")\npublic class SQLDataSourceLocatorCDITest extends BaseCDITest {\n\n    @Inject\n    SQLDataSetProviderCDI sqlDataSetProviderCDI;\n\n    @Test\n    public void testInit() throws Exception {\n        assertNotNull(sqlDataSetProviderCDI);\n        SQLDataSourceLocator dataSourceLocator = sqlDataSetProviderCDI.getDataSourceLocator();\n        assertNotNull(dataSourceLocator);\n        assertTrue(dataSourceLocator instanceof SQLDataSourceLocatorMock);\n    }\n\n    @Test\n    public void testLookup() throws Exception {\n        SQLDataSourceLocator dataSourceLocator = sqlDataSetProviderCDI.getDataSourceLocator();\n        DataSource dataSource = dataSourceLocator.lookup(null);\n        assertNull(dataSource);\n    }\n\n    @Test\n    public void testList() throws Exception {\n        SQLDataSourceLocator dataSourceLocator = sqlDataSetProviderCDI.getDataSourceLocator();\n        List<SQLDataSourceDef> l = dataSourceLocator.list();\n        assertEquals(l.size(), 2);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/dataset/SQLDataSourceLocatorMock.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.inject.Specializes;\nimport javax.sql.DataSource;\n\nimport org.dashbuilder.dataprovider.SQLDataSourceLocatorCDI;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\n\n@Specializes\npublic class SQLDataSourceLocatorMock extends SQLDataSourceLocatorCDI {\n\n    public SQLDataSourceLocatorMock() {\n    }\n\n    @Override\n    public DataSource lookup(SQLDataSetDef def) throws Exception {\n        return null;\n    }\n\n    @Override\n    public List<SQLDataSourceDef> list() {\n        List<SQLDataSourceDef> result = new ArrayList<>();\n        result.add(new SQLDataSourceDef(\"ds1\", \"ds1\"));\n        result.add(new SQLDataSourceDef(\"ds2\", \"ds2\"));\n        return result;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/pojo/Bean.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.pojo;\n\nimport java.util.Map;\nimport java.util.Properties;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.config.Config;\n\npublic class Bean {\n\n    @Inject @Config(\"From class\")\n    public String propString1;\n\n    @Inject @Config(\"From class\")\n    public String propString2;\n\n    @Inject @Config(\"From class\")\n    public String propString3;\n\n    @Inject @Config(\"a=1,b=2,c=3\")\n    public Map<String,String> propMap4;\n\n    @Inject @Config(\"a=1,b=2,c=3\")\n    public Properties props5;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/pojo/BeanExt.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.pojo;\n\nimport javax.enterprise.inject.Specializes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.config.Config;\n\n@Specializes\npublic class BeanExt extends Bean {\n\n    @Inject @Config(\"From class\")\n    public String propString4;\n\n    @Inject @Config(\"From class\")\n    public String propString5;\n\n    @Inject @Config(\"From class\")\n    public String propString6;\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/test/BaseCDITest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.test;\n\nimport java.net.URI;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Map;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Named;\n\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.shrinkwrap.api.Archive;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.mockito.Mockito.*;\n\npublic class BaseCDITest {\n\n    @Deployment\n    public static Archive<?> createTestArchive()  {\n        return ShrinkWrapHelper.createJavaArchive().addPackages(true,\n                                                             \"org.uberfire.backend.server.spaces\")\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"org.dashbuilder.pojo.Bean.config\")\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"org.dashbuilder.pojo.BeanExt.config\")\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.config\")\n                .addAsManifestResource(EmptyAsset.INSTANCE, \"beans.xml\");\n    }\n\n    protected IOService ioService;\n\n    @Produces @Named(\"ioStrategy\")\n    public IOService mockIOService() throws Exception {\n        return getIOService();\n    }\n\n    public IOService getIOService() throws Exception {\n        if (ioService == null) {\n            ioService = mock(IOService.class);\n            FileSystem fileSystem = mock(FileSystem.class);\n            Iterable iterable = mock(Iterable.class);\n            Iterator iterator = mock(Iterator.class);\n            Path path = mock(Path.class);\n\n            when(ioService.newFileSystem(any(URI.class), any(Map.class))).thenReturn(fileSystem);\n            when(ioService.getFileSystem(any(URI.class))).thenReturn(fileSystem);\n\n            when(fileSystem.getRootDirectories()).thenReturn(iterable);\n            when(fileSystem.supportedFileAttributeViews()).thenReturn(new HashSet<String>());\n            when(iterable.iterator()).thenReturn(iterator);\n            when(iterator.next()).thenReturn(path);\n\n            when(path.resolve(anyString())).thenReturn(path);\n            when(path.resolve(any(Path.class))).thenReturn(path);\n            when(path.toUri()).thenReturn(new URI(\"uri\"));\n            when(path.getFileName()).thenReturn(path);\n            when(path.getFileSystem()).thenReturn(fileSystem);\n        }\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/test/MavenProjectHelper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.test;\n\nimport java.io.File;\nimport java.io.FileFilter;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.apache.commons.io.filefilter.FileFilterUtils;\nimport org.apache.commons.lang3.StringUtils;\n\npublic class MavenProjectHelper {\n\n    public static final String JAVA_FOLDER = \"java\";\n\n    public static File getModuleDir(String moduleName) {\n        File rootDir = MavenProjectHelper.getRootDir();\n        if (rootDir == null) throw new NullPointerException(\"Root directory not found\");\n\n        List<File> javaFolders = getFolders(rootDir, FileFilterUtils.nameFileFilter(moduleName));\n        if (!javaFolders.isEmpty()) return javaFolders.get(0);\n\n        throw new RuntimeException(\"Module \" + moduleName + \" dir not found. Root=\" + rootDir.getPath());\n    }\n\n    public static File getRootDir() {\n        File rootDir = new File(System.getProperty(\"user.dir\"));\n        File parentPom = new File(rootDir.getParent(), \"pom.xml\");\n        while (parentPom.exists()) {\n            rootDir = rootDir.getParentFile();\n            parentPom = new File(rootDir.getParent(), \"pom.xml\");\n        }\n        return rootDir;\n    }\n\n    public static Collection<String> getJavaPackages(File root) {\n        Set<String> result = new HashSet<String>();\n        List<File> folders = getSourceFolders(root);\n        for (File folder : folders) {\n            String fullPath = folder.getAbsolutePath();\n            int index = fullPath.indexOf(\"/\" + JAVA_FOLDER + \"/\");\n            if (index == -1) continue;\n\n            String javaPath = fullPath.substring(index + 6);\n            String javaPackage = StringUtils.replace(javaPath, \"/\", \".\");\n            if (!javaPackage.contains(\".client\")) {\n                result.add(javaPackage);\n            }\n        }\n        return result;\n    }\n\n    public static List<File> getSourceFolders(File root) {\n        List<File> javaFolders = getFolders(root, FileFilterUtils.nameFileFilter(JAVA_FOLDER));\n        List<File> result = new ArrayList<File>();\n        for (File javaFolder : javaFolders) {\n            List<File> _folders = getFolders(javaFolder, null);\n            result.add(javaFolder);\n            result.addAll(_folders);\n        }\n        return result;\n    }\n\n    public static List<File> getFolders(File root, FileFilter filter) {\n        List<File> result = new ArrayList<File>();\n        if (root == null || !root.isDirectory()) return result;\n\n        File[] files = root.listFiles();\n        for (File file : files) {\n            if (file.isDirectory()) {\n                if (filter == null || filter.accept(file)) result.add(file);\n                result.addAll(getFolders(file, filter));\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/java/org/dashbuilder/test/ShrinkWrapHelper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.test;\n\nimport java.io.File;\nimport java.util.Collection;\n\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\n\npublic class ShrinkWrapHelper {\n\n    public static JavaArchive createJavaArchive() {\n        File rootDir = MavenProjectHelper.getModuleDir(\"dashbuilder-backend\");\n        if (rootDir == null) throw new NullPointerException(\"Root directory not found\");\n        return createJavaArchive(rootDir);\n    }\n\n    public static JavaArchive createJavaArchive(File root) {\n        Collection<String> javaPackages = MavenProjectHelper.getJavaPackages(root);\n        JavaArchive arch = ShrinkWrap.create(JavaArchive.class);\n        for (String javaPackage : javaPackages) arch.addPackage(javaPackage);\n        return arch;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/resources/META-INF/beans.config",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.dashbuilder.pojo.Bean.propString2=From beans.config\norg.dashbuilder.pojo.BeanExt.propString5=From beans.config\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/resources/META-INF/org.dashbuilder.pojo.Bean.config",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\npropString3=From Bean.config"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-dataset-cdi/src/test/resources/META-INF/org.dashbuilder.pojo.BeanExt.config",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\npropString6=From BeanExt.config"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-external-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder External Backend</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>jakarta.activation</groupId>\n      <artifactId>jakarta.activation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/ExternalComponentServlet.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\n\nimport javax.activation.MimetypesFileTypeMap;\nimport javax.inject.Inject;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.io.IOUtils;\nimport org.dashbuilder.external.service.ComponentAssetProvider;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static java.util.stream.Collectors.joining;\n\npublic class ExternalComponentServlet extends HttpServlet {\n\n    private static final long serialVersionUID = 1L;\n    private static final String CACHE_CONTROL_PARAM = \"cache-control\";\n\n    private static final Logger logger = LoggerFactory.getLogger(ExternalComponentServlet.class);\n\n    @Inject\n    ComponentAssetProvider assetProvider;\n\n    @Inject\n    ComponentLoader loader;\n\n    String cacheControlHeaderValue = \"no-cache\";\n    private MimetypesFileTypeMap mimeTypes;\n\n    @Override\n    public void init(ServletConfig config) throws ServletException {\n        super.init(config);\n        mimeTypes = new MimetypesFileTypeMap();\n        String cacheControl = config.getInitParameter(CACHE_CONTROL_PARAM);\n        if (cacheControl != null) {\n            cacheControlHeaderValue = cacheControl;\n        }\n        addAdditionalMimeTypes();\n    }\n\n    @Override\n    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n        try {\n            handle(req, resp);\n        } catch (IOException e) {\n            logger.error(\"Error handling request to retrieve asset.\");\n            logger.debug(\"Error handling request to retrieve asset.\", e);\n            errorResponse(resp);\n        }\n    }\n\n    private void handle(HttpServletRequest req, HttpServletResponse resp) throws IOException {\n        resp.reset();\n\n        String pathInfo = req.getPathInfo();\n        if (pathInfo == null) {\n            badRequest(resp);\n            return;\n        }\n\n        String[] pathParts = pathInfo.split(\"/\");\n        if (pathParts.length < 3) {\n            badRequest(resp);\n            return;\n        }\n\n        String assetPath = Arrays.stream(pathParts).skip(1).collect(joining(File.separator));\n\n        logger.debug(\"Retrieving component asset {}\", assetPath);\n\n        try (InputStream assetStream = assetProvider.openAsset(assetPath)) {\n            int size = IOUtils.copy(assetStream, resp.getOutputStream());\n            String mimeType = mimeTypes.getContentType(pathInfo);\n            resp.setContentType(mimeType);\n            resp.setContentLength(size);\n            resp.setHeader(CACHE_CONTROL_PARAM, cacheControlHeaderValue);\n        } catch (Exception e) {\n            logger.info(\"Not able to find component asset {}\", assetPath);\n            logger.debug(\"Error opening external component asset\", e);\n            resp.sendError(HttpServletResponse.SC_NOT_FOUND);\n        }\n    }\n\n    private void badRequest(HttpServletResponse resp) throws IOException {\n        resp.sendError(HttpServletResponse.SC_BAD_REQUEST);\n    }\n\n    private void errorResponse(HttpServletResponse resp) {\n        try {\n            resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);\n        } catch (IOException e) {\n            logger.error(\"Error setting \\\"internal server error\\\" response.\");\n            logger.debug(\"Error setting \\\"internal server error\\\" response.\", e);\n        }\n    }\n\n    private void addAdditionalMimeTypes() {\n        mimeTypes.addMimeTypes(\"text/javascript js\");\n        mimeTypes.addMimeTypes(\"text/css css\");\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/BackendComponentFunction.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.util.Map;\n\n/**\n * Server side component functions contract.\n *\n * @param <T>\n * The function return type.\n */\npublic interface BackendComponentFunction<T> {\n\n    default String getName() {\n        return this.getClass().getSimpleName();\n    }\n\n    /**\n     * \n     * The function execution. Must return an object that can be used in browser windows communication. \n     * @param params\n     * Params set by user when configuring the component.\n     * @return\n     * The result\n     * \n     */\n    T exec(Map<String, Object> params);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/BackendComponentFunctionServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.external.impl;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.external.service.BackendComponentFunctionService;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class BackendComponentFunctionServiceImpl implements BackendComponentFunctionService {\n\n    Map<String, BackendComponentFunction<?>> functions;\n    \n    @Inject\n    Instance<BackendComponentFunction<?>> functionsInstances;\n\n    @PostConstruct\n    void loadFunctions() {\n        functions = new HashMap<>();\n        functionsInstances.forEach(instance -> functions.put(instance.getName(), instance));\n    }\n\n    @Override\n    public List<String> listFunctions() {\n        return new ArrayList<>(functions.keySet());\n    }\n\n    @Override\n    public Object callFunction(String name, Map<String, Object> params) {\n        BackendComponentFunction<?> function = functions.get(name);\n        return function.exec(params);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/ComponentAssetProviderImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.InputStream;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.FilenameUtils;\nimport org.dashbuilder.external.service.ComponentAssetProvider;\nimport org.dashbuilder.external.service.ComponentLoader;\n\n/**\n * Looks for components assets.\n *\n */\n@ApplicationScoped\npublic class ComponentAssetProviderImpl implements ComponentAssetProvider {\n\n    @Inject\n    ComponentLoader componentsLoader;\n\n    @Override\n    public InputStream openAsset(String componentAssetPath) {\n        if (componentAssetPath != null) {\n            String normalizedAssetPath = FilenameUtils.normalizeNoEndSeparator(componentAssetPath);\n            if (normalizedAssetPath != null) {\n                return getInternalComponentAsset(normalizedAssetPath).orElseGet(() -> getExternalComponentAsset(normalizedAssetPath));\n            }\n        }\n        throw new IllegalArgumentException(\"Invalid Asset Path.\");\n    }\n\n    String fixSlashes(String componentAssetPath) {\n        return componentAssetPath == null ? \"\" : componentAssetPath.replaceAll(\"\\\\\\\\\", \"/\");\n    }\n\n    private Optional<InputStream> getInternalComponentAsset(String componentAssetPath) {\n        String internalComponentsBaseDir = componentsLoader.getProvidedComponentsPath();\n        String fullPath = \"/\" + internalComponentsBaseDir + \"/\" + fixSlashes(componentAssetPath);\n        return Optional.ofNullable(this.getClass().getResourceAsStream(fullPath));\n    }\n\n    private InputStream getExternalComponentAsset(String componentAssetPath) {\n        if (!componentsLoader.isExternalComponentsEnabled()) {\n            throw new IllegalArgumentException(\"External Components are not enabled\");\n        }\n\n        Path baseDir = Paths.get(componentsLoader.getExternalComponentsDir());\n        Path assetPath = baseDir.resolve(componentAssetPath);\n\n        if (isFileInComponentsDir(baseDir, assetPath)) {\n            return loadExternalComponentFile(assetPath);\n        } else {\n            throw new IllegalArgumentException(\"Not a component file.\");\n\n        }\n    }\n\n    private InputStream loadExternalComponentFile(Path assetPath) {\n        try {\n            return new FileInputStream(assetPath.toFile());\n        } catch (FileNotFoundException e) {\n            throw new IllegalArgumentException(\"Error opening component file: \" + e.getMessage(), e);\n        }\n    }\n\n    // Used to prevent path traversal attacks.\n    // Reference https://portswigger.net/web-security/file-path-traversal\n    private boolean isFileInComponentsDir(Path baseDir, Path assetPath) {\n        return assetPath.toAbsolutePath().normalize().startsWith(baseDir);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/ComponentLoaderImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.Reader;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gson.Gson;\nimport org.dashbuilder.components.internal.ProvidedComponentInfo;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class ComponentLoaderImpl implements ComponentLoader {\n\n    Logger logger = LoggerFactory.getLogger(ComponentLoaderImpl.class);\n\n    public static final String EXTERNAL_COMP_DIR_PROP = \"dashbuilder.components.dir\";\n    public static final String EXTERNAL_COMP_ENABLE_PROP = \"dashbuilder.components.enable\";\n\n    private static final String DEFAULT_COMPONENTS_PATH = \"/tmp/dashbuilder/components/\";\n\n    private ProvidedComponentInfo providedComponentsInfo;\n\n    private String externalComponentsDir;\n\n    private Gson gson;\n\n    private boolean externalComponentEnabled;\n\n    @PostConstruct\n    public void init() {\n        gson = new Gson();\n        providedComponentsInfo = ProvidedComponentInfo.get();\n        externalComponentEnabled = Boolean.parseBoolean(System.getProperty(EXTERNAL_COMP_ENABLE_PROP, Boolean.FALSE.toString()));\n        externalComponentsDir = System.getProperty(EXTERNAL_COMP_DIR_PROP, DEFAULT_COMPONENTS_PATH);\n        if (externalComponentEnabled) {\n            Path baseDirPath = Paths.get(externalComponentsDir);\n            if (!baseDirPath.toFile().exists()) {\n                baseDirPath.toFile().mkdirs();\n            }\n        }\n    }\n\n    @Override\n    public List<ExternalComponent> loadProvided() {\n        return providedComponentsInfo.getInternalComponentsList()\n                                     .stream()\n                                     .map(this::readInternalComponent)\n                                     .filter(Objects::nonNull)\n                                     .collect(Collectors.toList());\n    }\n\n    @Override\n    public List<ExternalComponent> loadExternal() {\n        if (externalComponentEnabled) {\n            try (Stream<Path> walker = Files.walk(Paths.get(externalComponentsDir), 1)) {\n                return walker.filter(p -> p.toFile().isDirectory())\n                             .map(this::getComponentDescriptor)\n                             .filter(File::exists)\n                             .map(this::readComponent)\n                             .filter(Objects::nonNull)\n                             .collect(Collectors.toList());\n\n            } catch (IOException e) {\n                logger.error(\"Error loading components from {}. Error: {}\", externalComponentsDir, e.getMessage());\n                logger.debug(\"Error loading external components.\", e);\n            }\n        }\n        return Collections.emptyList();\n    }\n\n    @Override\n    public String getExternalComponentsDir() {\n        return externalComponentsDir;\n    }\n\n    @Override\n    public String getProvidedComponentsPath() {\n        return providedComponentsInfo.getInternalComponentsRootPath();\n    }\n\n    private ExternalComponent readInternalComponent(String componentId) {\n        String internalComponentDescriptor = \"/\" + providedComponentsInfo.getInternalComponentsRootPath() + \"/\" + componentId + \"/\" + DESCRIPTOR_FILE;\n        InputStream is = this.getClass().getResourceAsStream(internalComponentDescriptor);\n\n        if (is == null) {\n            logger.error(\"Not able to read internal component manifest file for component {}\", componentId);\n            return null;\n        }\n        return readComponent(componentId, new InputStreamReader(is));\n    }\n\n    private ExternalComponent readComponent(File file) {\n        String id = file.getParentFile().getName();\n        FileReader reader;\n        try {\n            reader = new FileReader(file);\n            return this.readComponent(id, reader);\n        } catch (FileNotFoundException e) {\n            logger.error(\"Not able to read component manifest file {}. Error: {}\", file.getPath(), e.getMessage());\n            logger.debug(\"Error reading component file.\", e);\n            return null;\n        }\n    }\n\n    private ExternalComponent readComponent(String componentId, Reader manifestReader) {\n        try {\n            ExternalComponent component = gson.fromJson(manifestReader, ExternalComponent.class);\n            component.setId(componentId);\n            return component;\n        } catch (Exception e) {\n            logger.error(\"Not able to load component {}. Error: {}\", componentId, e.getMessage());\n            logger.debug(\"Error reading component.\", e);\n        }\n        return null;\n    }\n\n    private File getComponentDescriptor(Path p) {\n        return Paths.get(p.toString(), DESCRIPTOR_FILE).toFile();\n    }\n\n    public boolean isExternalComponentsEnabled() {\n        return externalComponentEnabled;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/ComponentServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.external.service.ComponentService;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class ComponentServiceImpl implements ComponentService {\n\n    @Inject\n    ComponentLoader loader;\n\n    @Override\n    public List<ExternalComponent> listExternalComponents() {\n        return loader.loadExternal();\n    }\n\n    @Override\n    public List<ExternalComponent> listProvidedComponents() {\n        return loader.loadProvided();\n    }\n\n    @Override\n    public Optional<ExternalComponent> byId(String componentId) {\n        return Stream.concat(loader.loadProvided().stream(),\n                             loader.loadExternal().stream())\n                     .filter(c -> componentId.equals(c.getId()))\n                     .findFirst();\n    }\n    \n    @Override\n    public List<ExternalComponent> listAllComponents() {\n        List<ExternalComponent> allComponents = new ArrayList<>();\n        List<ExternalComponent> external = loader.loadExternal();\n        List<ExternalComponent> provided = loader.loadProvided();\n\n        external.forEach(c -> c.setProvided(false));\n        provided.forEach(c -> c.setProvided(true));\n        \n        allComponents.addAll(provided);\n        allComponents.addAll(external);\n        return allComponents;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/java/org/dashbuilder/external/impl/function/BackendDateFunction.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.external.impl.function;\n\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.dashbuilder.external.impl.BackendComponentFunction;\n\n/**\n * Component backend function that returns the date.\n *\n */\n@Dependent\npublic class BackendDateFunction implements BackendComponentFunction<String> {\n\n    private static final String FORMAT_PARAM = \"format\";\n\n    @Override\n    public String exec(Map<String, Object> params) {\n        Object pattern = params.get(FORMAT_PARAM);\n        if (pattern != null) {\n            return new SimpleDateFormat(pattern.toString()).format(new Date());\n        }\n        return new Date().toString();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/test/java/org/dashbuilder/external/impl/ComponentAssetProviderImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.io.IOUtils;\nimport org.dashbuilder.components.internal.ProvidedComponentInfo;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class ComponentAssetProviderImplTest {\n\n    @Mock\n    ComponentLoader componentLoader;\n\n    @InjectMocks\n    ComponentAssetProviderImpl componentAssetProviderImpl;\n\n    private Path componentsDir;\n\n    @Before\n    public void prepare() throws IOException {\n        componentsDir = Files.createTempDirectory(\"components\");\n        when(componentLoader.getExternalComponentsDir()).thenReturn(componentsDir.toString());\n\n        when(componentLoader.getProvidedComponentsPath()).thenReturn(ProvidedComponentInfo.get().getInternalComponentsRootPath());\n    }\n\n    @After\n    public void after() {\n        FileUtils.deleteQuietly(componentsDir.toFile());\n    }\n\n    @Test\n    public void testExternalComponentAsset() throws Exception {\n        String componentFileContent = \"abc\";\n        String componentId = \"c1\";\n        String componentFileName = \"testFile\";\n        String assetPath = createComponentFile(componentId, componentFileName, componentFileContent);\n\n        when(componentLoader.isExternalComponentsEnabled()).thenReturn(true);\n        String assetFileLoadedContent = IOUtils.toString(componentAssetProviderImpl.openAsset(assetPath), StandardCharsets.UTF_8);\n\n        assertEquals(componentFileContent, assetFileLoadedContent);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testExternalComponentAssetWithExternalComponentsDisabled() throws Exception {\n        String componentFileContent = \"abc\";\n        String componentId = \"c1\";\n        String componentFileName = \"testFile\";\n\n        String assetPath = createComponentFile(componentId, componentFileName, componentFileContent);\n\n        when(componentLoader.isExternalComponentsEnabled()).thenReturn(false);\n        componentAssetProviderImpl.openAsset(assetPath);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testAvoidTraversalPath() throws Exception {\n        String componentFileContent = \"abc\";\n        String componentId = \"c1\";\n        String componentFileName = \"testFile\";\n\n        createComponentFile(componentId, componentFileName, componentFileContent);\n        Path shouldNotBeAccessible = Files.createTempFile(\"should_not_be_accessible\", \"\");\n        Path relativePath = componentsDir.relativize(shouldNotBeAccessible);\n\n        when(componentLoader.isExternalComponentsEnabled()).thenReturn(true);\n        try {\n            componentAssetProviderImpl.openAsset(relativePath.toString());\n        } catch (Exception e) {\n            throw e;\n        } finally {\n            FileUtils.deleteQuietly(shouldNotBeAccessible.toFile());\n        }\n    }\n\n    @Test\n    public void testInternalComponentAsset() throws Exception {\n        String logoImage = \"logo-provided/images/dashbuilder-logo.png\";\n        String logoIndexJs = \"logo-provided/index.js\";\n        String logoIndexHtml = \"logo-provided/index.html\";\n\n        assertNotNull(componentAssetProviderImpl.openAsset(logoImage));\n        assertNotNull(componentAssetProviderImpl.openAsset(logoIndexJs));\n        assertNotNull(componentAssetProviderImpl.openAsset(logoIndexHtml));\n\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testInternalComponentAssetPathTraversal() throws Exception {\n        assertNotNull(componentAssetProviderImpl.openAsset(\"../../../dashbuilder-components.properties\"));\n    }\n    \n    @Test\n    public void testFixSlashes() throws Exception {\n        assertEquals(\"/abc/cde\", componentAssetProviderImpl.fixSlashes(\"\\\\abc\\\\cde\"));\n        assertEquals(\"/abc/cde\", componentAssetProviderImpl.fixSlashes(\"/abc/cde\"));\n        assertEquals(\"\", componentAssetProviderImpl.fixSlashes(null));\n    }\n\n    private String createComponentFile(String componentId, String fileName, String fileContent) throws Exception {\n        Path componentDir = componentsDir.resolve(componentId);\n        Path componentFile = componentDir.resolve(fileName);\n\n        if (!componentDir.toFile().exists()) {\n            Files.createDirectory(componentDir);\n        }\n        Files.createFile(componentFile);\n        Files.write(componentFile, fileContent.getBytes(StandardCharsets.UTF_8));\n\n        return componentId + \"/\" + fileName;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/test/java/org/dashbuilder/external/impl/ComponentLoaderImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.dashbuilder.external.model.ComponentParameter;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.lesscss.deps.org.apache.commons.io.FileUtils;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class ComponentLoaderImplTest {\n\n    private static final String C1_ID = \"c1_id\";\n    private static final String C2_ID = \"c2_id\";\n\n    private static final String TEXT = \"text\";\n\n    private static final String C2P1_LABEL = \"c2p1 label\";\n    private static final String C2P1_DEFAULT = \"c2p1 default\";\n    private static final String C2P1 = \"c2p1\";\n    private static final String C2_ICON = \"c2 icon\";\n    private static final String C2 = \"c2\";\n\n    private static final String C1P1_LABEL = \"c1p1 label\";\n    private static final String C1P1_DEFAULT = \"c1p1 default\";\n    private static final String C1P1 = \"c1p1\";\n    private static final String C1_ICON = \"c1 icon\";\n    private static final String C1 = \"c1\";\n\n    final String C1_MANIFEST = \"{\\n\" +\n                               \"    \\\"name\\\": \\\"\" + C1 + \"\\\",\\n\" +\n                               \"    \\\"icon\\\": \\\"\" + C1_ICON + \"\\\",\\n\" +\n                               \"    \\\"parameters\\\": [\\n\" +\n                               \"        {\\n\" +\n                               \"            \\\"name\\\": \\\"\" + C1P1 + \"\\\",\\n\" +\n                               \"            \\\"type\\\": \\\"\" + TEXT + \"\\\",\\n\" +\n                               \"            \\\"defaultValue\\\": \\\"\" + C1P1_DEFAULT + \"\\\",\\n\" +\n                               \"            \\\"label\\\": \\\"\" + C1P1_LABEL + \"\\\"\\n\" +\n                               \"        }\\n\" +\n                               \"\\n\" +\n                               \"    ]\\n\" +\n                               \"}\";\n\n    final String C2_MANIFEST = \"{\\n\" +\n                               \"    \\\"name\\\": \\\"\" + C2 + \"\\\",\\n\" +\n                               \"    \\\"icon\\\": \\\"\" + C2_ICON + \"\\\",\\n\" +\n                               \"    \\\"parameters\\\": [\\n\" +\n                               \"        {\\n\" +\n                               \"            \\\"name\\\": \\\"\" + C2P1 + \"\\\",\\n\" +\n                               \"            \\\"type\\\": \\\"text\\\",\\n\" +\n                               \"            \\\"defaultValue\\\": \\\"\" + C2P1_DEFAULT + \"\\\",\\n\" +\n                               \"            \\\"label\\\": \\\"\" + C2P1_LABEL + \"\\\"\\n\" +\n                               \"        }\\n\" +\n                               \"\\n\" +\n                               \"    ]\\n\" +\n                               \"}\";\n\n    private Path componentPath;\n\n    ComponentLoaderImpl externalComponentLoaderImpl;\n\n    @Before\n    public void init() throws URISyntaxException {\n        String rootPath = ComponentLoaderImplTest.class.getResource(\"/\")\n                                                               .getFile();\n        externalComponentLoaderImpl = new ComponentLoaderImpl();\n        componentPath = Paths.get(rootPath, \"components\");\n\n        System.setProperty(ComponentLoaderImpl.EXTERNAL_COMP_DIR_PROP, componentPath.toString());\n        System.setProperty(ComponentLoaderImpl.EXTERNAL_COMP_ENABLE_PROP, Boolean.TRUE.toString());\n    }\n\n    @After\n    public void cleanup() throws IOException {\n        FileUtils.deleteQuietly(componentPath.toFile());\n\n    }\n\n    @Test\n    public void testBaseDirCreated() {\n        assertFalse(Files.exists(componentPath));\n        externalComponentLoaderImpl.init();\n        assertTrue(Files.exists(componentPath));\n    }\n\n    @Test\n    public void testLoad() {\n        externalComponentLoaderImpl.init();\n        createComponentsFiles();\n        List<ExternalComponent> components = externalComponentLoaderImpl.loadExternal();\n        assertEquals(2, components.size());\n        ExternalComponent c1 = getComponent(components, C1_ID);\n        ExternalComponent c2 = getComponent(components, C2_ID);\n\n        assertEquals(1, c1.getParameters().size());\n        assertEquals(C1, c1.getName());\n        assertEquals(C1_ICON, c1.getIcon());\n\n        ComponentParameter cp1 = c1.getParameters().get(0);\n        assertEquals(C1P1, cp1.getName());\n        assertEquals(C1P1_DEFAULT, cp1.getDefaultValue());\n        assertEquals(C1P1_LABEL, cp1.getLabel());\n\n        assertEquals(1, c2.getParameters().size());\n        assertEquals(C2, c2.getName());\n        assertEquals(C2_ICON, c2.getIcon());\n\n        ComponentParameter cp2 = c2.getParameters().get(0);\n        assertEquals(C2P1, cp2.getName());\n        assertEquals(C2P1_DEFAULT, cp2.getDefaultValue());\n        assertEquals(C2P1_LABEL, cp2.getLabel());\n    }\n\n    @Test\n    public void testLoadWhenDisabled() throws IOException {\n        System.setProperty(ComponentLoaderImpl.EXTERNAL_COMP_ENABLE_PROP, Boolean.FALSE.toString());\n        externalComponentLoaderImpl.init();\n        assertFalse(Files.exists(componentPath));\n\n        Files.createDirectory(componentPath);\n        createComponentsFiles();\n\n        assertTrue(externalComponentLoaderImpl.loadExternal().isEmpty());\n    }\n\n    @Test\n    public void testLoadInternalComponents() throws IOException {\n        externalComponentLoaderImpl.init();\n        List<ExternalComponent> internalComponents = externalComponentLoaderImpl.loadProvided();\n\n        assertEquals(4, internalComponents.size());\n\n        ExternalComponent component = internalComponents.get(0);\n        assertEquals(\"logo-provided\", component.getId());\n\n        List<ComponentParameter> parameters = component.getParameters();\n        assertEquals(3, parameters.size());\n\n        Optional<ComponentParameter> srcParamOp = component.getParameters()\n                                                           .stream()\n                                                           .filter(p -> p.getName().equals(\"src\"))\n                                                           .findFirst();\n\n        assertTrue(srcParamOp.isPresent());\n\n        ComponentParameter srcParam = srcParamOp.get();\n        assertEquals(\"src\", srcParam.getName());\n        assertEquals(\"Logo URL\", srcParam.getLabel());\n        assertEquals(\"text\", srcParam.getType());\n\n        Optional<ComponentParameter> widthParamOp = component.getParameters()\n                                                             .stream()\n                                                             .filter(p -> p.getName().equals(\"width\"))\n                                                             .findFirst();\n\n        assertTrue(widthParamOp.isPresent());\n\n        ComponentParameter widthParam = widthParamOp.get();\n        assertEquals(\"width\", widthParam.getName());\n        assertEquals(\"Width\", widthParam.getLabel());\n        assertEquals(\"text\", widthParam.getType());\n\n        Optional<ComponentParameter> heightParamOp = component.getParameters()\n                                                              .stream()\n                                                              .filter(p -> p.getName().equals(\"height\"))\n                                                              .findFirst();\n\n        assertTrue(heightParamOp.isPresent());\n\n        ComponentParameter heightParam = heightParamOp.get();\n        assertEquals(\"height\", heightParam.getName());\n        assertEquals(\"Height\", heightParam.getLabel());\n        assertEquals(\"text\", heightParam.getType());\n    }\n\n    private ExternalComponent getComponent(List<ExternalComponent> components, String id) {\n        return components.stream().filter(c -> c.getId().equals(id)).findFirst().get();\n    }\n\n    private void createComponentsFiles() {\n        try {\n            Path c1 = Paths.get(componentPath.toString(), C1_ID, ComponentLoaderImpl.DESCRIPTOR_FILE);\n            c1.toFile().getParentFile().mkdirs();\n            c1.toFile().createNewFile();\n            Files.write(c1, C1_MANIFEST.getBytes());\n\n            Path c2 = Paths.get(componentPath.toString(), C2_ID, ComponentLoaderImpl.DESCRIPTOR_FILE);\n            c2.toFile().getParentFile().mkdirs();\n            c2.toFile().createNewFile();\n            Files.write(c2, C2_MANIFEST.getBytes());\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-external-backend/src/test/java/org/dashbuilder/external/impl/ComponentServiceImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.impl;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static java.util.Arrays.asList;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ComponentServiceImplTest {\n\n    private static final String C1_ID = \"c1\";\n    private static final String C2_ID = \"c2\";\n\n    @Mock\n    ComponentLoader loader;\n\n    @InjectMocks\n    ComponentServiceImpl externalComponentServiceImpl;\n\n    @Test\n    public void testById() {\n        ExternalComponent c1 = new ExternalComponent(C1_ID, \"c1 name\", \"c1 icon\", false, Collections.emptyList());\n        ExternalComponent c2 = new ExternalComponent(C2_ID, \"c2 name\", \"c2 icon\", false, Collections.emptyList());\n\n        Mockito.when(loader.loadExternal()).thenReturn(asList(c1, c2));\n\n        assertTrue(externalComponentServiceImpl.byId(C1_ID).isPresent());\n        assertTrue(externalComponentServiceImpl.byId(C2_ID).isPresent());\n        assertFalse(externalComponentServiceImpl.byId(\"do not exist\").isPresent());\n    }\n\n    @Test\n    public void testByIdProvidedPriority() {\n        String c1ProvidedName = \"c1 provided\";\n        ExternalComponent c1_provided = new ExternalComponent(C1_ID, c1ProvidedName, \"c1 icon\", false, Collections.emptyList());\n        ExternalComponent c1_external = new ExternalComponent(C1_ID, \"c1 external\", \"c1 icon\", false, Collections.emptyList());\n\n        when(loader.loadProvided()).thenReturn(asList(c1_provided));\n        when(loader.loadExternal()).thenReturn(asList(c1_external));\n\n        assertEquals(c1ProvidedName, externalComponentServiceImpl.byId(C1_ID).get().getName());\n    }\n\n    @Test\n    public void testListAllComponents() {\n        String providedId = \"c1\";\n        String externalId = \"c2\";\n        ExternalComponent c1_provided = new ExternalComponent(providedId, \"name\", \"icon\", false, Collections.emptyList());\n        ExternalComponent c1_external = new ExternalComponent(externalId, \"name\", \"icon\", false, Collections.emptyList());\n\n        when(loader.loadProvided()).thenReturn(asList(c1_provided));\n        when(loader.loadExternal()).thenReturn(asList(c1_external));\n\n        List<ExternalComponent> comps = externalComponentServiceImpl.listAllComponents();\n        ExternalComponent cp = comps.stream().filter(c -> providedId.equals(c.getId())).findAny().get();\n        ExternalComponent ce = comps.stream().filter(c -> externalId.equals(c.getId())).findAny().get();\n        assertTrue(cp.isProvided());\n        assertFalse(ce.isProvided());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- ~ Copyright 2014 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n  the Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n  except in compliance with the License. ~ You may obtain a copy of the License \n  at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n  applicable law or agreed to in writing, software ~ distributed under the \n  License is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n  OF ANY KIND, either express or implied. ~ See the License for the specific \n  language governing permissions and ~ limitations under the License. -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-kie-server-backend</artifactId>\n  <packaging>jar</packaging>\n  <name>Dashbuilder Kie Server Backend</name>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.xml.bind</groupId>\n      <artifactId>jakarta.xml.bind-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-external-backend</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.annotation</groupId>\n          <artifactId>javax.annotation-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/KieServerConnectionInfoProviderImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.function.BiFunction;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n/**\n * Provide access to user configured connection provider\n *\n */\n@Service\n@ApplicationScoped\npublic class KieServerConnectionInfoProviderImpl implements KieServerConnectionInfoProvider {\n\n    static final String CONFIGURATION_NOT_FOUND_MESSAGE = \"Configuration for dataset %s / server template %s not found\";\n    static final String MISSING_URL_MESSAGE = \"URL configuration for dataset %s / server template %s is missing\";\n    static final String MISSING_AUTH_MESSAGE = \"Auth configuration for dataset %s / server template %s is missing.\" +\n                                               \"You should provide user/password or token authentication\";\n\n    private static final String SERVER_TEMPLATE_SEPARATOR = \",\";\n    static final String DEFAULT_SERVER_TEMPLATE_PROPERTY = \"dashbuilder.kieserver.defaultServerTemplate\";\n    static final String SERVER_TEMPLATE_LIST_PROPERTY = \"dashbuilder.kieserver.serverTemplates\";\n    static final String SERVER_TEMPLATE_PROP_PREFFIX = \"dashbuilder.kieserver.serverTemplate\";\n    static final String DATASET_PROP_PREFFIX = \"dashbuilder.kieserver.dataset\";\n\n    private static final String SERVER_TEMPLATE_PROPERTY_TEMPLATE = SERVER_TEMPLATE_PROP_PREFFIX + \".%s.%s\";\n    private static final String REMOTE_DATASET_PROPERTY_TEMPLATE = DATASET_PROP_PREFFIX + \".%s.%s\";\n\n    public static enum KieServerConfigurationKey {\n\n        LOCATION(\"location\"),\n        USER(\"user\"),\n        PASSWORD(\"password\"),\n        REPLACE_QUERY(\"replace_query\"),\n        TOKEN(\"token\");\n\n        private KieServerConfigurationKey(String value) {\n            this.value = value;\n        }\n\n        private String value;\n\n        public String getValue() {\n            return this.value;\n        }\n\n    }\n\n    @Override\n    public List<String> serverTemplates() {\n        return Optional.ofNullable(System.getProperty(SERVER_TEMPLATE_LIST_PROPERTY))\n                       .map(templates -> templates.split(SERVER_TEMPLATE_SEPARATOR))\n                       .map(template -> Arrays.stream(template)\n                                              .map(String::trim)\n                                              .filter(s -> !s.isEmpty())\n                                              .collect(Collectors.toList()))\n                       .orElse(Collections.emptyList());\n    }\n\n    @Override\n    public KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def) {\n        String name = def.getName();\n        String serverTemplateId = def.getServerTemplateId();\n        String missingConfigError = String.format(CONFIGURATION_NOT_FOUND_MESSAGE, name, serverTemplateId);\n        String missingUrlError = String.format(MISSING_URL_MESSAGE, name, serverTemplateId);\n        String missingAuthError = String.format(MISSING_AUTH_MESSAGE, name, serverTemplateId);\n        KieServerConnectionInfo connectionInfo = get(name, serverTemplateId).orElseThrow(() -> new RuntimeException(missingConfigError));\n\n        if (!connectionInfo.getLocation().isPresent()) {\n            throw new RuntimeException(missingUrlError);\n        }\n\n        if (!connectionInfo.getUser().isPresent() &&\n            !connectionInfo.getToken().isPresent()) {\n            throw new RuntimeException(missingAuthError);\n        }\n        return connectionInfo;\n    }\n\n    @Override\n    public Optional<KieServerConnectionInfo> get(String name,\n                                                 String serverTemplate) {\n\n        Optional<KieServerConnectionInfo> optional = get(name, this::remoteDatasetProperty);\n        if (!optional.isPresent()) {\n            optional = get(serverTemplate, this::serverTemplateProperty);\n        }\n        return optional;\n    }\n\n    public Optional<String> serverTemplateProperty(String serverTemplate,\n                                                   KieServerConfigurationKey configurationKey) {\n        String property = String.format(SERVER_TEMPLATE_PROPERTY_TEMPLATE,\n                                        serverTemplate,\n                                        configurationKey.value);\n        return filteredProperty(property);\n    }\n\n    public Optional<String> remoteDatasetProperty(String datasetUUID,\n                                                  KieServerConfigurationKey configurationKey) {\n        String property = String.format(REMOTE_DATASET_PROPERTY_TEMPLATE,\n                                        datasetUUID,\n                                        configurationKey.value);\n        return filteredProperty(property);\n    }\n\n    @Override\n    public Optional<KieServerConnectionInfo> getDefault() {\n        String defaultTemplate = System.getProperty(DEFAULT_SERVER_TEMPLATE_PROPERTY);\n        if (defaultTemplate != null) {\n            return this.get(null, defaultTemplate);\n        }\n        return findFirstServerTemplateConf().flatMap(template -> get(null, template));\n    }\n\n    private Optional<String> filteredProperty(String property) {\n        return Optional.ofNullable(System.getProperty(property)).filter(v -> !v.trim().isEmpty());\n    }\n\n    private Optional<KieServerConnectionInfo> get(String confType,\n                                                  BiFunction<String, KieServerConfigurationKey, Optional<String>> propertyProvider) {\n\n        Optional<String> url = propertyProvider.apply(confType, KieServerConfigurationKey.LOCATION);\n        Optional<String> user = propertyProvider.apply(confType, KieServerConfigurationKey.USER);\n        Optional<String> password = propertyProvider.apply(confType, KieServerConfigurationKey.PASSWORD);\n        Optional<String> token = propertyProvider.apply(confType, KieServerConfigurationKey.TOKEN);\n        Optional<String> replaceQueryOp = propertyProvider.apply(confType, KieServerConfigurationKey.REPLACE_QUERY);\n\n        boolean noPropertyFound = Stream.of(url, user, password, token, replaceQueryOp)\n                                        .noneMatch(Optional::isPresent);\n\n        if (noPropertyFound) {\n            return Optional.empty();\n        }\n\n        boolean replaceQuery = replaceQueryOp.isPresent() && Boolean.TRUE.toString().equalsIgnoreCase(replaceQueryOp.get());\n\n        return Optional.of(new KieServerConnectionInfo(url, user, password, token, replaceQuery));\n    }\n\n    Optional<String> findFirstServerTemplateConf() {\n        return Collections.list(System.getProperties().keys())\n                          .stream()\n                          .map(Object::toString)\n                          .filter(key -> key.startsWith(SERVER_TEMPLATE_PROP_PREFFIX))\n                          .map(this::retrieveTemplateId)\n                          .filter(Objects::nonNull)\n                          .findFirst();\n\n    }\n\n    String retrieveTemplateId(String property) {\n        String[] parts = property.replaceAll(SERVER_TEMPLATE_PROP_PREFFIX, \"\")\n                                 .split(\"\\\\.\");\n        if (parts.length > 1) {\n            return parts[1];\n        }\n        return null;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/KieServerDataSetListener.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.kieserver.backend.rest.KieServerQueryClient;\nimport org.dashbuilder.kieserver.backend.rest.QueryDefinition;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Keeps Kie Server up to date with remote dataset changes\n *\n */\n@ApplicationScoped\npublic class KieServerDataSetListener {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(KieServerDataSetListener.class);\n\n    @Inject\n    KieServerQueryClient queryClient;\n\n    @Inject\n    KieServerConnectionInfoProvider connectionInfoProvider;\n\n    void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        replaceQueryInKieServers(def);\n    }\n\n    void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        DataSetDef def = event.getNewDataSetDef();\n        replaceQueryInKieServers(def);\n    }\n\n    void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        DataSetDef def = event.getDataSetDef();\n        if (def instanceof RemoteDataSetDef) {\n            try {\n                KieServerConnectionInfo connectionInfo = connectionInfoProvider.verifiedConnectionInfo((RemoteDataSetDef) def);\n                queryClient.unregisterQuery(connectionInfo, def.getUUID());\n                LOGGER.info(\"Data set definition {} ({}) deletion event processed\", def.getUUID(), def.getName());\n            } catch (Exception e) {\n                LOGGER.warn(\"Not able to delete query in server for removed dataset definition {} \", def.getName());\n                LOGGER.debug(\"Not able to delete query in server for removed dataset definition {}\", def.getName(), e);\n            }\n        }\n    }\n\n    protected void replaceQueryInKieServers(DataSetDef def) {\n        if (def instanceof RemoteDataSetDef && ((RemoteDataSetDef) def).getServerTemplateId() != null) {\n            try {\n                KieServerConnectionInfo connectionInfo = connectionInfoProvider.verifiedConnectionInfo((RemoteDataSetDef) def);\n                QueryDefinition queryDefinition = QueryDefinition.builder()\n                                                                 .name(def.getUUID())\n                                                                 .source(((RemoteDataSetDef) def).getDataSource())\n                                                                 .target(((RemoteDataSetDef) def).getQueryTarget())\n                                                                 .expression(((RemoteDataSetDef) def).getDbSQL())\n                                                                 .build();\n\n                queryClient.replaceQuery(connectionInfo, queryDefinition);\n                LOGGER.info(\"Data set definition {} ({}) modification event processed\", def.getUUID(), def.getName());\n            } catch (Exception e) {\n                LOGGER.warn(\"Not able to replace query in server for dataset definition {} \", def.getName());\n                LOGGER.debug(\"Not able to replace query in server for dataset definition {} \", def.getName(), e);\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/RuntimeKieServerDataSetProvider.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend;\n\nimport java.text.NumberFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Map.Entry;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.DataSetProvider;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.filter.LogicalExprFilter;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.impl.DataColumnImpl;\nimport org.dashbuilder.dataset.impl.DataSetMetadataImpl;\nimport org.dashbuilder.dataset.sort.ColumnSort;\nimport org.dashbuilder.dataset.sort.DataSetSort;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.kieserver.ConsoleDataSetLookup;\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.kieserver.RuntimeKieServerDataSetProviderType;\nimport org.dashbuilder.kieserver.backend.rest.KieServerQueryClient;\nimport org.dashbuilder.kieserver.backend.rest.QueryDefinition;\nimport org.dashbuilder.kieserver.backend.rest.QueryFilterSpec;\nimport org.dashbuilder.kieserver.backend.rest.QueryParam;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class RuntimeKieServerDataSetProvider implements DataSetProvider {\n\n    public static final DataSetProviderType TYPE = new RuntimeKieServerDataSetProviderType();\n    private static final Logger LOGGER = LoggerFactory.getLogger(RuntimeKieServerDataSetProvider.class);\n\n    @Inject\n    KieServerQueryClient queryClient;\n\n    @Inject\n    KieServerConnectionInfoProvider connectionInfoProvider;\n\n    @Override\n    public DataSetProviderType getType() {\n        return TYPE;\n    }\n\n    @Override\n    public DataSetMetadata getDataSetMetadata(DataSetDef def) throws Exception {\n        List<String> columnNames = new ArrayList<>();\n        List<ColumnType> columnTypes = new ArrayList<>();\n        if (def.getColumns() == null && def instanceof RemoteDataSetDef) {\n            KieServerConnectionInfo connectionInfo = connectionInfoProvider.verifiedConnectionInfo((RemoteDataSetDef) def);\n            QueryDefinition definition = queryClient.getQuery(connectionInfo, def.getUUID());\n            if (definition.getColumns() != null) {\n                addColumnsToDefinition(def, definition);\n            }\n        }\n        def.getColumns().forEach(column -> {\n            columnNames.add(column.getId());\n            columnTypes.add(column.getColumnType());\n        });\n        return new DataSetMetadataImpl(def,\n                                       def.getUUID(),\n                                       -1,\n                                       def.getColumns().size(),\n                                       columnNames,\n                                       columnTypes,\n                                       -1);\n    }\n\n    @Override\n    public DataSet lookupDataSet(DataSetDef def,\n                                 DataSetLookup lookup) throws Exception {\n\n        ConsoleDataSetLookup dataSetLookup = adoptLookup(def,\n                                                         lookup);\n\n        LOGGER.debug(\"Data Set lookup using Server Template Id: {}\",\n                     dataSetLookup.getServerTemplateId());\n        if (dataSetLookup.getServerTemplateId() == null || dataSetLookup.getServerTemplateId().isEmpty()) {\n            return buildDataSet(def,\n                                new ArrayList<>(),\n                                new ArrayList<>());\n        }\n\n        List<QueryParam> filterParams = new ArrayList<>();\n        QueryFilterSpec filterSpec = new QueryFilterSpec();\n        // apply filtering\n\n        for (DataSetFilter filter : dataSetLookup.getOperationList(DataSetFilter.class)) {\n            if (filter != null) {\n\n                for (ColumnFilter cFilter : filter.getColumnFilterList()) {\n                    if (cFilter instanceof CoreFunctionFilter) {\n\n                        CoreFunctionFilter coreFunctionFilter = (CoreFunctionFilter) cFilter;\n\n                        filterParams.add(new QueryParam(coreFunctionFilter.getColumnId(),\n                                                        coreFunctionFilter.getType().toString(),\n                                                        coreFunctionFilter.getParameters()));\n                    } else if (cFilter instanceof LogicalExprFilter) {\n                        LogicalExprFilter logicalExprFilter = (LogicalExprFilter) cFilter;\n                        filterParams.add(new QueryParam(logicalExprFilter.getColumnId(),\n                                                        logicalExprFilter.getLogicalOperator().toString(),\n                                                        logicalExprFilter.getLogicalTerms()));\n                    }\n                }\n            }\n        }\n        List<DataColumn> extraColumns = new ArrayList<DataColumn>();\n\n        List<DataSetGroup> dataSetGroups = lookup.getFirstGroupOpSelections();\n        for (DataSetGroup group : dataSetGroups) {\n            if (group.getSelectedIntervalList() != null && group.getSelectedIntervalList().size() > 0) {\n                appendIntervalSelection(group,\n                                        filterParams);\n            }\n        }\n\n        DataSetGroup dataSetGroup = dataSetLookup.getLastGroupOp();\n        handleDataSetGroup(def,\n                           dataSetGroup,\n                           filterParams,\n                           extraColumns);\n\n        if (!filterParams.isEmpty()) {\n            filterSpec.setParameters(filterParams.toArray(new QueryParam[filterParams.size()]));\n        }\n\n        // apply sorting\n        DataSetSort sort = dataSetLookup.getFirstSortOp();\n        if (sort != null) {\n            SortOrder sortOrder = SortOrder.UNSPECIFIED;\n            StringBuilder orderBy = new StringBuilder();\n            for (ColumnSort cSort : sort.getColumnSortList()) {\n                orderBy.append(cSort.getColumnId()).append(\",\");\n                sortOrder = cSort.getOrder();\n            }\n            // remove last ,\n            orderBy.deleteCharAt(orderBy.length() - 1);\n\n            filterSpec.setOrderBy(orderBy.toString());\n            filterSpec.setAscending(sortOrder.equals(SortOrder.ASCENDING));\n        }\n        final List<List> instances = performQuery((RemoteDataSetDef) def,\n                                                  dataSetLookup,\n                                                  filterSpec);\n        LOGGER.debug(\"Query client returned {} row(s)\",\n                     instances.size());\n\n        return buildDataSet(def,\n                            instances,\n                            extraColumns);\n    }\n\n    protected ConsoleDataSetLookup adoptLookup(DataSetDef def,\n                                               DataSetLookup lookup) {\n        ConsoleDataSetLookup dataSetLookup = null;\n        if (!(lookup instanceof ConsoleDataSetLookup)) {\n\n            if (def instanceof RemoteDataSetDef) {\n                dataSetLookup = (ConsoleDataSetLookup) ConsoleDataSetLookup.fromInstance(lookup,\n                                                                                         ((RemoteDataSetDef) def).getServerTemplateId());\n                DataSetFilter filter = def.getDataSetFilter();\n                if (filter != null) {\n                    dataSetLookup.addOperation(filter);\n                }\n            } else {\n                throw new IllegalArgumentException(\"DataSetLookup is of incorrect type \" + lookup.getClass().getName());\n            }\n        } else {\n            dataSetLookup = (ConsoleDataSetLookup) lookup;\n        }\n\n        return dataSetLookup;\n    }\n\n    protected List<List> performQuery(RemoteDataSetDef def,\n                                      ConsoleDataSetLookup lookup,\n                                      QueryFilterSpec filterSpec) {\n        KieServerConnectionInfo connectionInfo = connectionInfoProvider.verifiedConnectionInfo(def);\n        String queryName = def.getQueryName() != null ? def.getQueryName() : def.getUUID(); \n        int pageNumber = lookup.getRowOffset() / lookup.getNumberOfRows();\n        if (lookup.testMode() || connectionInfo.isReplaceQuery()) {\n            QueryDefinition queryDefinition = QueryDefinition.builder()\n                                                             .name(queryName)\n                                                             .source(def.getDataSource())\n                                                             .target(def.getQueryTarget())\n                                                             .expression(def.getDbSQL())\n                                                             .build();\n            QueryDefinition registered = queryClient.replaceQuery(connectionInfo, queryDefinition);\n            if (registered.getColumns() != null) {\n                addColumnsToDefinition(def, registered);\n            }\n\n            try {\n                return queryClient.query(connectionInfo,\n                                         queryName,\n                                         filterSpec,\n                                         pageNumber,\n                                         lookup.getNumberOfRows());\n            } catch (Exception e) {\n                queryClient.unregisterQuery(connectionInfo, queryName);\n                throw new RuntimeException(e);\n            }\n        } else {\n            if (def.getColumns() != null && def.getColumns().isEmpty()) {\n                QueryDefinition query = queryClient.getQuery(connectionInfo, queryName);\n                addColumnsToDefinition(def, query);\n            }\n            return queryClient.query(connectionInfo,\n                                     queryName,\n                                     filterSpec,\n                                     pageNumber,\n                                     lookup.getNumberOfRows());\n        }\n    }\n\n    @Override\n    public boolean isDataSetOutdated(DataSetDef def) {\n        return false;\n    }\n\n    protected DataSet buildDataSet(DataSetDef def,\n                                   List<List> instances,\n                                   List<DataColumn> extraColumns) throws Exception {\n        DataSet dataSet = DataSetFactory.newEmptyDataSet();\n        dataSet.setUUID(def.getUUID());\n        dataSet.setDefinition(def);\n\n        if (extraColumns != null && !extraColumns.isEmpty()) {\n            for (DataColumn extraColumn : extraColumns) {\n                dataSet.addColumn(extraColumn);\n            }\n        } else {\n            for (DataColumnDef column : def.getColumns()) {\n                DataColumn numRows = new DataColumnImpl(column.getId(),\n                                                        column.getColumnType());\n                dataSet.addColumn(numRows);\n            }\n        }\n\n        for (List<Object> row : instances) {\n\n            int columnIndex = 0;\n            for (Object value : row) {\n                DataColumn intervalBuilder = dataSet.getColumnByIndex(columnIndex);\n                ColumnType columnType = intervalBuilder.getColumnType();\n                if (columnType.equals(ColumnType.DATE) && isNumberValue(value)) {\n                    Number dateNumber = NumberFormat.getInstance().parse(value.toString());\n                    Date dateValue = new Date(dateNumber.longValue());\n                    intervalBuilder.getValues().add(dateValue);\n                } else {\n                    intervalBuilder.getValues().add(value);\n                }\n                columnIndex++;\n            }\n        }\n        // set size of the results to allow paging to be more then the actual size\n        //        dataSet.setRowCountNonTrimmed(instances.size() == 0 ? 0 : instances.size() + 1);\n        dataSet.setRowCountNonTrimmed(instances.size());\n        return dataSet;\n    }\n\n    protected void appendIntervalSelection(DataSetGroup intervalSel,\n                                           List<QueryParam> filterParams) {\n        if (intervalSel != null && intervalSel.isSelect()) {\n            ColumnGroup cg = intervalSel.getColumnGroup();\n            List<Interval> intervalList = intervalSel.getSelectedIntervalList();\n\n            // Get the filter values\n            List<Comparable> names = new ArrayList<Comparable>();\n            Comparable min = null;\n            Comparable max = null;\n            for (Interval interval : intervalList) {\n                names.add(interval.getName());\n                Comparable intervalMin = (Comparable) interval.getMinValue();\n                Comparable intervalMax = (Comparable) interval.getMaxValue();\n\n                if (intervalMin != null) {\n                    if (min == null) {\n                        min = intervalMin;\n                    } else if (min.compareTo(intervalMin) > 0) {\n                        min = intervalMin;\n                    }\n                }\n                if (intervalMax != null) {\n                    if (max == null) {\n                        max = intervalMax;\n                    } else if (max.compareTo(intervalMax) > 0) {\n                        max = intervalMax;\n                    }\n                }\n            }\n            // Min can't be greater than max.\n            if (min != null && max != null && min.compareTo(max) > 0) {\n                min = max;\n            }\n\n            ColumnFilter filter;\n            if (min != null && max != null) {\n                filter = FilterFactory.between(cg.getSourceId(),\n                                               min,\n                                               max);\n            } else if (min != null) {\n                filter = FilterFactory.greaterOrEqualsTo(cg.getSourceId(),\n                                                         min);\n            } else if (max != null) {\n                filter = FilterFactory.lowerOrEqualsTo(cg.getSourceId(),\n                                                       max);\n            } else {\n                filter = FilterFactory.equalsTo(cg.getSourceId(),\n                                                names);\n            }\n            CoreFunctionFilter coreFunctionFilter = (CoreFunctionFilter) filter;\n            filterParams.add(new QueryParam(coreFunctionFilter.getColumnId(),\n                                            coreFunctionFilter.getType().toString(),\n                                            coreFunctionFilter.getParameters()));\n        }\n    }\n\n    protected void handleDataSetGroup(final DataSetDef def,\n                                      final DataSetGroup dataSetGroup,\n                                      final List<QueryParam> filterParams,\n                                      final List<DataColumn> extraColumns) {\n        if (dataSetGroup != null) {\n            if (dataSetGroup.getColumnGroup() != null) {\n                // handle group\n                if (dataSetGroup.getColumnGroup().getIntervalSize() != null) {\n                    filterParams.add(new QueryParam(dataSetGroup.getColumnGroup().getSourceId(),\n                                                    \"group\",\n                                                    Arrays.asList(dataSetGroup.getColumnGroup().getColumnId(),\n                                                                  dataSetGroup.getColumnGroup().getIntervalSize(),\n                                                                  dataSetGroup.getColumnGroup().getMaxIntervals())));\n                } else {\n                    filterParams.add(new QueryParam(dataSetGroup.getColumnGroup().getSourceId(),\n                                                    \"group\",\n                                                    Arrays.asList(dataSetGroup.getColumnGroup().getColumnId())));\n                }\n            }\n\n            // handle additional columns\n            for (GroupFunction groupFunction : dataSetGroup.getGroupFunctions()) {\n                if (groupFunction.getFunction() != null) {\n                    filterParams.add(new QueryParam(groupFunction.getSourceId(),\n                                                    groupFunction.getFunction().toString(),\n                                                    Arrays.asList(groupFunction.getColumnId())));\n                    extraColumns.add(new DataColumnImpl(groupFunction.getSourceId(),\n                                                        ColumnType.NUMBER));\n                } else {\n                    filterParams.add(new QueryParam(groupFunction.getSourceId(),\n                                                    null,\n                                                    Arrays.asList(groupFunction.getColumnId())));\n                    extraColumns.add(new DataColumnImpl(groupFunction.getSourceId(),\n                                                        getGroupFunctionColumnType(def,\n                                                                                   dataSetGroup.getColumnGroup(),\n                                                                                   groupFunction)));\n                }\n            }\n        }\n    }\n\n    protected ColumnType getGroupFunctionColumnType(final DataSetDef def,\n                                                    final ColumnGroup columnGroup,\n                                                    final GroupFunction groupFunction) {\n        ColumnType type = def.getColumnById(groupFunction.getColumnId()).getColumnType();\n        if (type != ColumnType.DATE || columnGroup == null || groupFunction == null) {\n            return type;\n        } else {\n            return columnGroup.getSourceId().equals(groupFunction.getSourceId()) ? ColumnType.LABEL : type;\n        }\n    }\n\n    protected void addColumnsToDefinition(DataSetDef def, QueryDefinition queryDef) {\n        Map<String, String> columns = queryDef.getColumns();\n        if (columns != null) {\n            columns.entrySet().stream()\n                   .filter(e -> def.getColumnById(e.getKey()) == null)\n                   .forEach(e -> def.addColumn(e.getKey(), ColumnType.valueOf(e.getValue())));\n        }\n    }\n\n    protected boolean isNumberValue(Object value) {\n        try {\n            NumberFormat.getInstance().parse(value.toString());\n            return true;\n        } catch (Exception e) {\n            LOGGER.debug(\"Date value is not parseable to number\", e);\n        }\n        return false;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/function/ProcessSVGFunction.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend.function;\n\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.ws.rs.WebApplicationException;\n\nimport org.dashbuilder.external.impl.BackendComponentFunction;\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.backend.rest.KieServerQueryClient;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@Dependent\npublic class ProcessSVGFunction implements BackendComponentFunction<String> {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ProcessSVGFunction.class);\n\n    private static final String ERROR_REQUESTING_SVG = \"Error requesting SVG from Kie Server: %s\";\n\n    private static final String NOT_FOUND_MSG = \"Process SVG not found for container %s and process %s\";\n\n    private static final String CONTAINERID_PARAM = \"containerId\";\n    private static final String PROCESSID_PARAM = \"processId\";\n    private static final String SERVER_TEMPLATE_PARAM = \"serverTemplate\";\n\n    @Inject\n    KieServerQueryClient queryClient;\n\n    @Inject\n    KieServerConnectionInfoProvider connectionInfoProvider;\n\n    @Override\n    public String exec(Map<String, Object> params) {\n        String containerId = getRequiredParam(CONTAINERID_PARAM, params);\n        String processId = getRequiredParam(PROCESSID_PARAM, params);\n        Object serverTemplate = params.get(SERVER_TEMPLATE_PARAM);\n        KieServerConnectionInfo connectionInfo;\n        if (serverTemplate != null && !serverTemplate.toString().trim().isEmpty()) {\n            connectionInfo = connectionInfoProvider.get(null, serverTemplate.toString())\n                                                   .orElseThrow(() -> new RuntimeException(\"Configuration for server template not found \" + serverTemplate));\n        } else {\n            connectionInfo = connectionInfoProvider.getDefault()\n                                                   .orElseThrow(() -> new RuntimeException(\"Not able to find credentials to retrieve processes SVG\"));\n        }\n        try {\n            return queryClient.processSVG(connectionInfo, containerId, processId);\n        } catch (WebApplicationException e) {\n            if (e.getResponse().getStatus() == 404) {\n                notFoundSVGError(containerId, processId);\n            }\n            errorRetrievingSVG(e);\n        } catch (Exception e) {\n            errorRetrievingSVG(e);\n        }\n        return null;\n    }\n\n    private void errorRetrievingSVG(Exception e) {\n        String message = String.format(ERROR_REQUESTING_SVG, e.getMessage());\n        LOGGER.warn(message);\n        LOGGER.debug(message, e);\n        throw new RuntimeException(message, e);\n    }\n\n    private void notFoundSVGError(String containerId, String processId) {\n        String notFoundMessage = String.format(NOT_FOUND_MSG, containerId, processId);\n        LOGGER.warn(notFoundMessage);\n        throw new RuntimeException(notFoundMessage);\n    }\n\n    private String getRequiredParam(String param, Map<String, Object> params) {\n        Object value = params.get(param);\n        if (value == null || value.toString().trim().isEmpty()) {\n            throw new RuntimeException(\"Param '\" + param + \"' is required.\");\n        }\n        return value.toString();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/BasicAuthFilter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\n\nimport javax.ws.rs.client.ClientRequestContext;\nimport javax.ws.rs.client.ClientRequestFilter;\nimport javax.ws.rs.core.HttpHeaders;\n\nimport org.jboss.resteasy.util.Base64;\n\npublic class BasicAuthFilter implements ClientRequestFilter {\n\n    private final String user;\n    private final String password;\n\n    public BasicAuthFilter(String user, String password) {\n        this.user = user;\n        this.password = password;\n    }\n\n    @Override\n    public void filter(ClientRequestContext ctx) throws IOException {\n        final String basicAuthToken = getEncodedToken();\n        ctx.getHeaders().add(HttpHeaders.AUTHORIZATION, basicAuthToken);\n\n    }\n\n    private String getEncodedToken() {\n        String token = this.user + \":\" + this.password;\n        return \"Basic \" + Base64.encodeBytes(token.getBytes(StandardCharsets.UTF_8));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/KieServerQueryClient.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.ws.rs.client.Client;\nimport javax.ws.rs.client.ClientBuilder;\nimport javax.ws.rs.client.Entity;\nimport javax.ws.rs.client.WebTarget;\nimport javax.ws.rs.core.MediaType;\n\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\n\n/**\n * Run queries on Kie Server using its REST API\n * \n */\n@ApplicationScoped\npublic class KieServerQueryClient {\n\n    private static final String PROCESS_ID_PARAM = \"processId\";\n    private static final String CONTAINER_ID_PARAM = \"containerId\";\n\n    private static final String DEFAULT_REQUEST_MEDIA_TYPE = MediaType.APPLICATION_JSON;\n\n    public static final String QUERY_MAP_RAW = \"RawList\";\n\n    public static final String QUERY_DEFINITION_URI = \"queries/definitions/{id}\";\n    public static final String QUERY_EXECUTION_URI = QUERY_DEFINITION_URI + \"/filtered-data\";\n    public static final String PROCESS_SVG_URI = \"containers/{\" + CONTAINER_ID_PARAM + \"}/images/processes/{\" + PROCESS_ID_PARAM + \"}\";\n\n    public QueryDefinition getQuery(KieServerConnectionInfo connectionInfo, String uuid) {\n        Client client = ClientBuilder.newClient();\n        WebTarget target = requestForQueryDefinition(connectionInfo, uuid, client);\n\n        QueryDefinition queryDefinition = target.request()\n                                                .accept(DEFAULT_REQUEST_MEDIA_TYPE)\n                                                .get(QueryDefinition.class);\n        client.close();\n        return queryDefinition;\n    }\n\n    @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n    public List<List> query(KieServerConnectionInfo connectionInfo,\n                            String uuid,\n                            QueryFilterSpec filterSpec,\n                            int i,\n                            int numberOfRows) {\n\n        Client client = ClientBuilder.newClient();\n        WebTarget target = client.target(connectionInfo.getLocation().get())\n                                 .path(QUERY_EXECUTION_URI)\n                                 .resolveTemplate(\"id\", uuid)\n                                 .queryParam(\"mapper\", QUERY_MAP_RAW)\n                                 .queryParam(\"page\", i)\n                                 .queryParam(\"pageSize\", numberOfRows);\n\n        addAuth(connectionInfo, target);\n\n        List<List> response = target.request()\n                                    .accept(DEFAULT_REQUEST_MEDIA_TYPE)\n                                    .post(Entity.entity(filterSpec, DEFAULT_REQUEST_MEDIA_TYPE), List.class);\n        client.close();\n        return response;\n    }\n\n    public QueryDefinition replaceQuery(KieServerConnectionInfo connectionInfo, QueryDefinition queryDefinition) {\n        Client client = ClientBuilder.newClient();\n        WebTarget target = requestForQueryDefinition(connectionInfo, queryDefinition.getName(), client);\n        QueryDefinition def = target.request()\n                                    .accept(DEFAULT_REQUEST_MEDIA_TYPE)\n                                    .put(Entity.entity(queryDefinition, DEFAULT_REQUEST_MEDIA_TYPE), QueryDefinition.class);\n        client.close();\n        return def;\n\n    }\n\n    public void unregisterQuery(KieServerConnectionInfo connectionInfo, String dataSetUUID) {\n        Client client = ClientBuilder.newClient();\n        WebTarget target = requestForQueryDefinition(connectionInfo, dataSetUUID, client);\n        target.request().delete();\n        client.close();\n    }\n\n    public String processSVG(KieServerConnectionInfo connectionInfo, String containerId, String processId) {\n        Optional<String> location = connectionInfo.getLocation();\n        if (location.isPresent()) {\n            Client client = ClientBuilder.newClient();\n            WebTarget target = client.target(location.get())\n                                     .path(PROCESS_SVG_URI)\n                                     .resolveTemplate(CONTAINER_ID_PARAM, containerId)\n                                     .resolveTemplate(PROCESS_ID_PARAM, processId);\n            addAuth(connectionInfo, target);\n            String svg = target.request().get(String.class);\n            client.close();\n            return svg;\n        }\n        \n        throw new RuntimeException(\"Location for Kie Server is required. Check configuration.\");\n    }\n\n    private WebTarget requestForQueryDefinition(KieServerConnectionInfo connectionInfo,\n                                                String dataSetUUID,\n                                                Client client) {\n        WebTarget target = client.target(connectionInfo.getLocation().get())\n                                 .path(QUERY_DEFINITION_URI)\n                                 .resolveTemplate(\"id\", dataSetUUID);\n\n        addAuth(connectionInfo, target);\n        return target;\n    }\n\n    private void addAuth(KieServerConnectionInfo connectionInfo, WebTarget target) {\n        if (connectionInfo.getUser().isPresent()) {\n            String user = connectionInfo.getUser().get();\n            String password = connectionInfo.getPassword().orElse(\"\");\n            target.register(new BasicAuthFilter(user, password));\n        }\n\n        if (connectionInfo.getToken().isPresent()) {\n            target.register(new TokenFilter(connectionInfo.getToken().get()));\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/QueryDefinition.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.util.Map;\n\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlRootElement;\n\n@XmlAccessorType(XmlAccessType.FIELD)\n@XmlRootElement(name = \"query-definition\")\npublic class QueryDefinition {\n\n    @XmlElement(name = \"query-name\")\n    private String name;\n    @XmlElement(name = \"query-source\")\n    private String source;\n    @XmlElement(name = \"query-expression\")\n    private String expression;\n    @XmlElement(name = \"query-target\")\n    private String target;\n    @XmlElement(name = \"query-columns\")\n    private Map<String, String> columns;\n\n    public QueryDefinition() {\n\n    }\n\n    public static Builder builder() {\n        return new Builder();\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getSource() {\n        return source;\n    }\n\n    public void setSource(String source) {\n        this.source = source;\n    }\n\n    public String getExpression() {\n        return expression;\n    }\n\n    public void setExpression(String expression) {\n        this.expression = expression;\n    }\n\n    public String getTarget() {\n        return target;\n    }\n\n    public void setTarget(String target) {\n        this.target = target;\n    }\n\n    public Map<String, String> getColumns() {\n        return columns;\n    }\n\n    public void setColumns(Map<String, String> columns) {\n        this.columns = columns;\n    }\n\n    public static class Builder {\n\n        private QueryDefinition definition = new QueryDefinition();\n\n        public QueryDefinition build() {\n            return definition;\n        }\n\n        public Builder name(String name) {\n            definition.setName(name);\n\n            return this;\n        }\n\n        public Builder source(String source) {\n            definition.setSource(source);\n\n            return this;\n        }\n\n        public Builder expression(String expression) {\n            definition.setExpression(expression);\n\n            return this;\n        }\n\n        public Builder target(String target) {\n            definition.setTarget(target);\n\n            return this;\n        }\n\n        public Builder columns(Map<String, String> columns) {\n            definition.setColumns(columns);\n\n            return this;\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"QueryDefinition{\" +\n               \"name='\" + name + '\\'' +\n               \", source='\" + source + '\\'' +\n               \", expression='\" + expression + '\\'' +\n               \", target='\" + target + '\\'' +\n               '}';\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/QueryFilterSpec.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.util.Arrays;\nimport java.util.Map;\n\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlRootElement;\n\n@XmlAccessorType(XmlAccessType.FIELD)\n@XmlRootElement(name = \"query-filter-spec\")\npublic class QueryFilterSpec {\n\n    @XmlElement(name = \"order-by\")\n    private String orderBy;\n    @XmlElement(name = \"order-asc\")\n    private boolean ascending;\n    @XmlElement(name = \"query-params\")\n    private QueryParam[] parameters;\n    @XmlElement(name = \"result-column-mapping\")\n    private Map<String, String> columnMapping;\n    @XmlElement(name = \"order-by-clause\")\n    private String orderByClause;\n\n\n    public QueryFilterSpec() {\n    }\n\n    public String getOrderBy() {\n        return orderBy;\n    }\n\n    public void setOrderBy(String orderBy) {\n        this.orderBy = orderBy;\n    }\n\n    public boolean isAscending() {\n        return ascending;\n    }\n\n    public void setAscending(boolean ascending) {\n        this.ascending = ascending;\n    }\n\n    public QueryParam[] getParameters() {\n        return parameters;\n    }\n\n    public void setParameters(QueryParam[] parameters) {\n        this.parameters = parameters;\n    }\n\n    public Map<String, String> getColumnMapping() {\n        return columnMapping;\n    }\n\n    public void setColumnMapping(Map<String, String> columnMapping) {\n        this.columnMapping = columnMapping;\n    }\n\n    public String getOrderByClause() {\n        return this.orderByClause;\n    }\n\n    public void setOrderByClause(String orderByClause) {\n        this.orderByClause = orderByClause;\n    }\n\n    @Override\n    public String toString() {\n        return \"QueryFilterSpec{\" + \"orderBy='\" + orderBy + '\\'' + \", ascending=\" + ascending + \", parameters=\" + Arrays.toString(parameters) + '}';\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/QueryParam.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.util.List;\n\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlElement;\nimport javax.xml.bind.annotation.XmlRootElement;\n\n@XmlAccessorType(XmlAccessType.FIELD)\n@XmlRootElement(name = \"query-param\")\npublic class QueryParam {\n\n    @XmlElement(name = \"cond-column\")\n    private String column;\n    @XmlElement(name = \"cond-operator\")\n    private String operator;\n    @XmlElement(name = \"cond-values\")\n    private List<?> value;\n\n    public QueryParam() {\n\n    }\n\n    public QueryParam(String column, String operator, List<?> value) {\n        this.column = column;\n        this.operator = operator;\n        this.value = value;\n    }\n\n    public String getColumn() {\n        return column;\n    }\n\n    public void setColumn(String column) {\n        this.column = column;\n    }\n\n    public String getOperator() {\n        return operator;\n    }\n\n    public void setOperator(String operator) {\n        this.operator = operator;\n    }\n\n    public List<?> getValue() {\n        return value;\n    }\n\n    public void setValue(List<?> value) {\n        this.value = value;\n    }\n\n    @Override\n    public String toString() {\n        return \"QueryParam{\" +\n               ((column != null) ? \"column='\" + column + \"\\',\" : \"\") +\n               \" operator='\" + operator + '\\'' +\n               \", value=\" + value +\n               '}';\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/java/org/dashbuilder/kieserver/backend/rest/TokenFilter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend.rest;\n\nimport java.io.IOException;\n\nimport javax.ws.rs.client.ClientRequestContext;\nimport javax.ws.rs.client.ClientRequestFilter;\n\npublic class TokenFilter implements ClientRequestFilter {\n\n    private String token;\n\n    public TokenFilter(String token) {\n        this.token = token;\n    }\n\n    @Override\n    public void filter(ClientRequestContext ctx) throws IOException {\n        ctx.getHeaders().add(\"Bearer \", token);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/test/java/org/dashbuilder/kieserver/backend/KieServerConnectionInfoProviderImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.kieserver.backend.KieServerConnectionInfoProviderImpl.KieServerConfigurationKey;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.dashbuilder.kieserver.backend.KieServerConnectionInfoProviderImpl.DATASET_PROP_PREFFIX;\nimport static org.dashbuilder.kieserver.backend.KieServerConnectionInfoProviderImpl.SERVER_TEMPLATE_PROP_PREFFIX;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\npublic class KieServerConnectionInfoProviderImplTest {\n\n    private static final String SERVER_USER = \"serveruser\";\n    private static final String SERVER_PASSWORD = \"serverpassword\";\n    private static final String SERVER_TOKEN = \"servertoken\";\n    private static final String SERVER_LOCATION = \"serverlocation\";\n    private static final String DS_USER = \"dsuser\";\n    private static final String DS_PASSWORD = \"dspassword\";\n    private static final String DS_TOKEN = \"dstoken\";\n    private static final String DS_LOCATION = \"dslocation\";\n\n    private KieServerConnectionInfoProviderImpl kieServerConnectionInfoProvider;\n\n    private final static String SERVER_ID = \"server1\";\n    private final static String DATASET_NAME = \"ds1\";\n    private final static String SERVER_TEMPLATE_PROP = SERVER_TEMPLATE_PROP_PREFFIX + \".\" + SERVER_ID + \".\";\n    private final static String DATASET_PROP = DATASET_PROP_PREFFIX + \".\" + DATASET_NAME + \".\";\n\n    private RemoteDataSetDef def;\n\n    @Before\n    public void init() {\n        kieServerConnectionInfoProvider = new KieServerConnectionInfoProviderImpl();\n        def = new RemoteDataSetDef();\n        def.setName(DATASET_NAME);\n        def.setServerTemplateId(SERVER_ID);\n        clearProperties();\n    }\n\n    @Test\n    public void serverListTest() {\n        System.setProperty(KieServerConnectionInfoProviderImpl.SERVER_TEMPLATE_LIST_PROPERTY, \"server1, server2, server3\");\n        List<String> serverTemplates = kieServerConnectionInfoProvider.serverTemplates();\n        assertEquals(3, serverTemplates.size());\n        List<String> expectedList = Arrays.asList(\"server1\", \"server2\", \"server3\");\n        assertEquals(expectedList, serverTemplates);\n    }\n\n    @Test\n    public void emptyServerListTest() {\n        System.setProperty(KieServerConnectionInfoProviderImpl.SERVER_TEMPLATE_LIST_PROPERTY, \"\");\n        List<String> serverTemplates = kieServerConnectionInfoProvider.serverTemplates();\n        assertTrue(serverTemplates.isEmpty());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void absentConfigurationErrorTest() {\n        kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testServerMissingAuth() {\n        setServerProp(KieServerConfigurationKey.LOCATION, \"somelocation\");\n        kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testDataSetMissingAuth() {\n        setDataSetProp(KieServerConfigurationKey.LOCATION, \"somelocation\");\n        kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n    }\n\n    @Test\n    public void testDsPropsPrecedence() {\n        setDataSetProp(KieServerConfigurationKey.LOCATION, DS_LOCATION);\n        setDataSetProp(KieServerConfigurationKey.USER, DS_USER);\n        setDataSetProp(KieServerConfigurationKey.PASSWORD, DS_PASSWORD);\n\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.USER, SERVER_USER);\n        setServerProp(KieServerConfigurationKey.PASSWORD, SERVER_PASSWORD);\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n\n        assertEquals(DS_LOCATION, connectionInfo.getLocation().get());\n        assertEquals(DS_USER, connectionInfo.getUser().get());\n        assertEquals(DS_PASSWORD, connectionInfo.getPassword().get());\n        assertFalse(connectionInfo.isReplaceQuery());\n    }\n\n    @Test\n    public void testServerTemplateProps() {\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.USER, SERVER_USER);\n        setServerProp(KieServerConfigurationKey.PASSWORD, SERVER_PASSWORD);\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n\n        assertEquals(SERVER_LOCATION, connectionInfo.getLocation().get());\n        assertEquals(SERVER_USER, connectionInfo.getUser().get());\n        assertEquals(SERVER_PASSWORD, connectionInfo.getPassword().get());\n        assertFalse(connectionInfo.isReplaceQuery());\n    }\n\n    @Test\n    public void testDsTokenPropPrecedence() {\n        setDataSetProp(KieServerConfigurationKey.LOCATION, DS_LOCATION);\n        setDataSetProp(KieServerConfigurationKey.TOKEN, DS_TOKEN);\n\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.TOKEN, SERVER_TOKEN);\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n\n        assertEquals(DS_LOCATION, connectionInfo.getLocation().get());\n        assertEquals(DS_TOKEN, connectionInfo.getToken().get());\n    }\n\n    @Test\n    public void testServerToken() {\n\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.TOKEN, SERVER_TOKEN);\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n\n        assertEquals(SERVER_LOCATION, connectionInfo.getLocation().get());\n        assertEquals(SERVER_TOKEN, connectionInfo.getToken().get());\n    }\n    \n    @Test\n    public void testReplaceQuery() {\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.USER, SERVER_USER);\n        setServerProp(KieServerConfigurationKey.PASSWORD, SERVER_PASSWORD);\n        setServerProp(KieServerConfigurationKey.REPLACE_QUERY, \"True\");\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n        assertTrue(connectionInfo.isReplaceQuery());\n    }\n    \n    @Test\n    public void testReplaceQueryFalse() {\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.USER, SERVER_USER);\n        setServerProp(KieServerConfigurationKey.PASSWORD, SERVER_PASSWORD);\n        setServerProp(KieServerConfigurationKey.REPLACE_QUERY, \"false\");\n        KieServerConnectionInfo connectionInfo = kieServerConnectionInfoProvider.verifiedConnectionInfo(def);\n        assertFalse(connectionInfo.isReplaceQuery());\n    }\n    \n    @Test\n    public void testRetrieveServerTemplateId() {\n        String serverTemplate = kieServerConnectionInfoProvider.retrieveTemplateId(SERVER_TEMPLATE_PROP_PREFFIX + \".myServerTemplate.url\");\n        assertEquals(\"myServerTemplate\", serverTemplate);\n    }\n    \n    @Test\n    public void testRetrieveServerTemplateIdBadString() {\n        String serverTemplate = kieServerConnectionInfoProvider.retrieveTemplateId(\"test\");\n        assertNull(serverTemplate);\n    }\n    \n    @Test\n    public void testFindFirstServerTemplateConf() {\n        setServerProp(KieServerConfigurationKey.LOCATION, SERVER_LOCATION);\n        setServerProp(KieServerConfigurationKey.USER, SERVER_USER);\n        setServerProp(KieServerConfigurationKey.PASSWORD, SERVER_PASSWORD);\n        \n        Optional<String> conf = kieServerConnectionInfoProvider.findFirstServerTemplateConf();\n        assertTrue(conf.isPresent());\n    }\n    \n    @Test\n    public void testFindFirstServerTemplateConfNotFound() {\n        clearProperties();\n        Optional<String> conf = kieServerConnectionInfoProvider.findFirstServerTemplateConf();\n        assertFalse(conf.isPresent());\n    }\n\n    private void setDataSetProp(KieServerConfigurationKey key, String value) {\n        System.setProperty(DATASET_PROP + key.getValue(), value);\n    }\n\n    private void setServerProp(KieServerConfigurationKey key, String value) {\n        System.setProperty(SERVER_TEMPLATE_PROP + key.getValue(), value);\n    }\n\n    private void clearProperties() {\n        System.setProperty(KieServerConnectionInfoProviderImpl.SERVER_TEMPLATE_LIST_PROPERTY, \"\");\n        for (KieServerConfigurationKey key : KieServerConfigurationKey.values()) {\n            System.clearProperty(DATASET_PROP + key.getValue());\n            System.clearProperty(SERVER_TEMPLATE_PROP + key.getValue());\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-kie-server-backend/src/test/java/org/dashbuilder/kieserver/backend/RuntimeKieServerDataSetProviderTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver.backend;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.impl.DataSetImpl;\nimport org.dashbuilder.kieserver.ConsoleDataSetLookup;\nimport org.dashbuilder.kieserver.KieServerConnectionInfo;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.kieserver.backend.rest.KieServerQueryClient;\nimport org.dashbuilder.kieserver.backend.rest.QueryDefinition;\nimport org.dashbuilder.kieserver.backend.rest.QueryFilterSpec;\nimport org.dashbuilder.kieserver.backend.rest.QueryParam;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.filter.FilterFactory.OR;\nimport static org.dashbuilder.dataset.filter.FilterFactory.likeTo;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class RuntimeKieServerDataSetProviderTest {\n\n    private static final String SERVER_TEMPLATE = \"serverTemplate\";\n\n    public static String COLUMN_TEST = \"columTest\";\n\n    @InjectMocks\n    RuntimeKieServerDataSetProvider kieServerDataSetProvider;\n\n    @Mock\n    KieServerQueryClient queryClient;\n\n    @Mock\n    DataSetImpl dataSet;\n\n    @Mock\n    KieServerConnectionInfoProvider kieServerConnectionInfoProvider;\n\n    @Mock\n    RemoteDataSetDef dataSetDef;\n\n    private KieServerConnectionInfo connectionInfo;\n\n    private KieServerConnectionInfo connectionInfoWithQueryReplace;\n\n    private QueryDefinition definition;\n\n    @Before\n    public void setUp() {\n        connectionInfo = new KieServerConnectionInfo(Optional.of(\"location\"),\n                                                     Optional.of(\"user\"),\n                                                     Optional.of(\"password\"),\n                                                     Optional.of(\"token\"),\n                                                     false);\n        connectionInfoWithQueryReplace = new KieServerConnectionInfo(Optional.of(\"location\"),\n                                                                     Optional.of(\"user\"),\n                                                                     Optional.of(\"password\"),\n                                                                     Optional.of(\"token\"),\n                                                                     true);\n        \n        Map<String, String> columns = new HashMap<>();\n        columns.put(\"test\", \"NUMBER\");\n        definition = QueryDefinition.builder()\n                                                    .name(\"q1\")\n                                                    .columns(columns)\n                                                    .build();\n    }\n\n    @Test\n    public void appendEqualToIntervalSelectionTest() {\n        String filterValue = \"testValue\";\n\n        DataSetGroup dataSetGroup = new DataSetGroup();\n        dataSetGroup.setColumnGroup(new ColumnGroup(COLUMN_TEST,\n                                                    COLUMN_TEST,\n                                                    GroupStrategy.DYNAMIC));\n        List<Interval> intervalList = new ArrayList<Interval>();\n        Interval interval = new Interval(filterValue);\n        intervalList.add(interval);\n        dataSetGroup.setSelectedIntervalList(intervalList);\n\n        List<QueryParam> filterParams = new ArrayList<>();\n        kieServerDataSetProvider.appendIntervalSelection(dataSetGroup,\n                                                         filterParams);\n\n        assertEquals(1,\n                     filterParams.size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getColumn());\n        assertEquals(\"EQUALS_TO\",\n                     filterParams.get(0).getOperator());\n        assertEquals(filterValue,\n                     filterParams.get(0).getValue().get(0));\n    }\n\n    @Test\n    public void appendBetweenIntervalSelectionTest() {\n        String filterValue = \"testValue\";\n        Long minValue = Long.valueOf(0);\n        Long maxValue = Long.valueOf(2);\n\n        DataSetGroup dataSetGroup = new DataSetGroup();\n        dataSetGroup.setColumnGroup(new ColumnGroup(COLUMN_TEST,\n                                                    COLUMN_TEST,\n                                                    GroupStrategy.DYNAMIC));\n        List<Interval> intervalList = new ArrayList<Interval>();\n        Interval interval = new Interval(filterValue);\n        interval.setMinValue(minValue);\n        interval.setMaxValue(maxValue);\n        intervalList.add(interval);\n        dataSetGroup.setSelectedIntervalList(intervalList);\n        List<QueryParam> filterParams = new ArrayList<>();\n\n        kieServerDataSetProvider.appendIntervalSelection(dataSetGroup,\n                                                         filterParams);\n\n        assertEquals(1,\n                     filterParams.size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getColumn());\n        assertEquals(\"BETWEEN\",\n                     filterParams.get(0).getOperator());\n        assertEquals(Double.valueOf(minValue),\n                     filterParams.get(0).getValue().get(0));\n        assertEquals(Double.valueOf(maxValue),\n                     filterParams.get(0).getValue().get(1));\n    }\n\n    @Test\n    public void lookupDataSetLogicalExprTest() throws Exception {\n        DataSetLookup lookup = new DataSetLookup();\n        lookup.setDataSetUUID(\"\");\n        when(dataSetDef.getUUID()).thenReturn(\"\");\n\n        when(kieServerConnectionInfoProvider.verifiedConnectionInfo(dataSetDef)).thenReturn(connectionInfo);\n\n        final ColumnFilter testFilter = OR(likeTo(\"column1\",\n                                                  \"%value%\"),\n                                           likeTo(\"column2\",\n                                                  \"%value%\"));\n\n        DataSetFilter filter = new DataSetFilter();\n        filter.addFilterColumn(testFilter);\n        lookup.addOperation(filter);\n        \n        when(queryClient.getQuery(eq(connectionInfo), any())).thenReturn(definition);\n        \n        kieServerDataSetProvider.lookupDataSet(dataSetDef,\n                                               ConsoleDataSetLookup.fromInstance(lookup,\n                                                                                 SERVER_TEMPLATE));\n\n        final ArgumentCaptor<QueryFilterSpec> captorEdit = ArgumentCaptor.forClass(QueryFilterSpec.class);\n        verify(queryClient).query(eq(connectionInfo),\n                                  any(),\n                                  captorEdit.capture(),\n                                  anyInt(),\n                                  anyInt());\n\n        assertNotNull(captorEdit.getValue());\n        QueryParam[] parameters = captorEdit.getValue().getParameters();\n        assertEquals(1,\n                     parameters.length);\n\n        List<CoreFunctionFilter> expr = (List<CoreFunctionFilter>) parameters[0].getValue();\n        assertEquals(\"OR\",\n                     parameters[0].getOperator());\n\n        assertEquals(\"column1 like %value%, true\",\n                     expr.get(0).toString());\n        assertEquals(\"column2 like %value%, true\",\n                     expr.get(1).toString());\n    }\n\n    @Test\n    public void testGroupWithInterval() {\n\n        DataSetGroup dataSetGroup = new DataSetGroup();\n        dataSetGroup.setColumnGroup(new ColumnGroup(COLUMN_TEST,\n                                                    COLUMN_TEST,\n                                                    GroupStrategy.DYNAMIC,\n                                                    30,\n                                                    DateIntervalType.DAY.name()));\n\n        List<QueryParam> filterParams = new ArrayList<>();\n        List<DataColumn> extraColumns = new ArrayList<>();\n        kieServerDataSetProvider.handleDataSetGroup(dataSetDef,\n                                                    dataSetGroup,\n                                                    filterParams,\n                                                    extraColumns);\n\n        assertEquals(1,\n                     filterParams.size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getColumn());\n        assertEquals(\"group\",\n                     filterParams.get(0).getOperator());\n\n        assertEquals(3,\n                     filterParams.get(0).getValue().size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getValue().get(0));\n        assertEquals(DateIntervalType.DAY.name(),\n                     filterParams.get(0).getValue().get(1));\n        assertEquals(30,\n                     filterParams.get(0).getValue().get(2));\n    }\n\n    @Test\n    public void testGroupWithNotSetInterval() {\n\n        DataSetGroup dataSetGroup = new DataSetGroup();\n        dataSetGroup.setColumnGroup(new ColumnGroup(COLUMN_TEST,\n                                                    COLUMN_TEST,\n                                                    GroupStrategy.DYNAMIC));\n\n        List<QueryParam> filterParams = new ArrayList<>();\n        List<DataColumn> extraColumns = new ArrayList<>();\n        kieServerDataSetProvider.handleDataSetGroup(dataSetDef,\n                                                    dataSetGroup,\n                                                    filterParams,\n                                                    extraColumns);\n\n        assertEquals(1,\n                     filterParams.size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getColumn());\n        assertEquals(\"group\",\n                     filterParams.get(0).getOperator());\n\n        assertEquals(1,\n                     filterParams.get(0).getValue().size());\n        assertEquals(COLUMN_TEST,\n                     filterParams.get(0).getValue().get(0));\n    }\n\n    @Test\n    public void testPerformQueryTestMode() {\n        QueryFilterSpec filterSpec = new QueryFilterSpec();\n\n        ConsoleDataSetLookup dataSetLookup = Mockito.mock(ConsoleDataSetLookup.class);\n        when(dataSetLookup.testMode()).thenReturn(true);\n        when(dataSetLookup.getNumberOfRows()).thenReturn(10);\n        when(dataSetLookup.getRowOffset()).thenReturn(1);\n        when(dataSetLookup.getDataSetUUID()).thenReturn(\"\");\n\n        when(kieServerConnectionInfoProvider.verifiedConnectionInfo(dataSetDef)).thenReturn(connectionInfo);\n\n        when(queryClient.replaceQuery(eq(connectionInfo), any())).thenReturn(definition);\n        kieServerDataSetProvider.performQuery(dataSetDef, dataSetLookup, filterSpec);\n\n        verify(dataSetLookup, times(1)).testMode();\n\n        verify(queryClient).replaceQuery(eq(connectionInfo), any());\n\n        verify(queryClient).query(eq(connectionInfo),\n                                  any(),\n                                  any(QueryFilterSpec.class),\n                                  anyInt(),\n                                  anyInt());\n    }\n\n    @Test\n    public void testPerformQueryWithReplace() {\n        QueryFilterSpec filterSpec = new QueryFilterSpec();\n\n        ConsoleDataSetLookup dataSetLookup = Mockito.mock(ConsoleDataSetLookup.class);\n        when(dataSetLookup.testMode()).thenReturn(true);\n        when(dataSetLookup.getNumberOfRows()).thenReturn(10);\n        when(dataSetLookup.getRowOffset()).thenReturn(1);\n        when(dataSetLookup.getDataSetUUID()).thenReturn(\"\");\n\n        when(kieServerConnectionInfoProvider.verifiedConnectionInfo(dataSetDef)).thenReturn(connectionInfoWithQueryReplace);\n        when(queryClient.replaceQuery(eq(connectionInfoWithQueryReplace), any())).thenReturn(definition);\n\n        kieServerDataSetProvider.performQuery(dataSetDef, dataSetLookup, filterSpec);\n\n        verify(dataSetLookup, times(1)).testMode();\n\n        verify(queryClient).replaceQuery(eq(connectionInfoWithQueryReplace), any());\n\n        verify(queryClient).query(eq(connectionInfoWithQueryReplace),\n                                  any(),\n                                  any(QueryFilterSpec.class),\n                                  anyInt(),\n                                  anyInt());\n    }\n\n    @Test\n    public void testPerformQueryRegularMode() {\n        QueryFilterSpec filterSpec = new QueryFilterSpec();\n\n        ConsoleDataSetLookup dataSetLookup = Mockito.mock(ConsoleDataSetLookup.class);\n        when(dataSetLookup.testMode()).thenReturn(false);\n        when(dataSetLookup.getNumberOfRows()).thenReturn(10);\n        when(dataSetLookup.getRowOffset()).thenReturn(1);\n        when(dataSetLookup.getDataSetUUID()).thenReturn(\"\");\n        \n        when(queryClient.getQuery(eq(connectionInfo), any())).thenReturn(definition);\n\n        when(kieServerConnectionInfoProvider.verifiedConnectionInfo(dataSetDef)).thenReturn(connectionInfo);\n\n        kieServerDataSetProvider.performQuery(dataSetDef, dataSetLookup, filterSpec);\n\n        verify(dataSetLookup, times(1)).testMode();\n        \n        verify(queryClient, times(0)).replaceQuery(eq(connectionInfo), any());\n\n        verify(queryClient).query(eq(connectionInfo),\n                                  any(),\n                                  any(QueryFilterSpec.class),\n                                  anyInt(),\n                                  anyInt());\n    }\n\n    @Test\n    public void testDataSetMetaData() throws Exception {\n        when(kieServerConnectionInfoProvider.verifiedConnectionInfo(dataSetDef)).thenReturn(connectionInfo);\n\n\n        when(dataSetDef.getColumns()).thenReturn(null, new ArrayList<>());\n        when(queryClient.getQuery(eq(connectionInfo), any())).thenReturn(definition);\n\n        kieServerDataSetProvider.getDataSetMetadata(dataSetDef);\n\n        verify(dataSetDef, times(1)).addColumn(eq(\"test\"), eq(ColumnType.NUMBER));\n\n        verify(queryClient).getQuery(eq(connectionInfo), any());\n    }\n\n    @Test\n    public void testNoAdoptLookup() throws Exception {\n        ConsoleDataSetLookup dataSetLookup = Mockito.mock(ConsoleDataSetLookup.class);\n\n        kieServerDataSetProvider.adoptLookup(dataSetDef, dataSetLookup);\n\n        verify(dataSetDef, times(0)).getServerTemplateId();\n    }\n\n    @Test\n    public void testAdoptLookup() throws Exception {\n        DataSetLookup dataSetLookup = Mockito.mock(DataSetLookup.class);\n        when(dataSetDef.getDataSetFilter()).thenReturn(Mockito.mock(DataSetFilter.class));\n        when(dataSetDef.getServerTemplateId()).thenReturn(\"servereTemplateId\");\n\n        ConsoleDataSetLookup adopted = kieServerDataSetProvider.adoptLookup(dataSetDef, dataSetLookup);\n\n        verify(dataSetDef, times(1)).getServerTemplateId();\n        assertNotNull(adopted.getOperationList());\n        assertEquals(1, adopted.getOperationList().size());\n    }\n\n    @Test\n    public void testGroupFunctionColumnType() {\n        for (ColumnType type : ColumnType.values()) {\n            assertGroupFuntionColumnType(type,\n                                         type == ColumnType.DATE ? ColumnType.LABEL : type);\n        }\n    }\n\n    protected void assertGroupFuntionColumnType(final ColumnType source,\n                                                final ColumnType expected) {\n        final DataSetDef def = new DataSetDef();\n        def.addColumn(\"columnId\",\n                      source);\n        final ColumnGroup columnGroup = new ColumnGroup(\"sourceId\",\n                                                        \"columnId\");\n        final GroupFunction groupFunction = new GroupFunction(\"sourceId\",\n                                                              \"columnId\",\n                                                              null);\n\n        assertEquals(expected,\n                     kieServerDataSetProvider.getGroupFunctionColumnType(def,\n                                                                         columnGroup,\n                                                                         groupFunction));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-navigation-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Navigation Backend</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-backend</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/main/java/org/dashbuilder/navigation/service/LayoutTemplateAnalyzer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.layout.LayoutNavigationRef;\nimport org.dashbuilder.navigation.layout.LayoutNavigationRefType;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.NavDragComponentType;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.dashbuilder.navigation.layout.LayoutNavigationRefType.*;\nimport static org.dashbuilder.navigation.layout.NavDragComponentSettings.*;\nimport static org.dashbuilder.navigation.layout.NavDragComponentType.*;\n\n\n@ApplicationScoped\npublic class LayoutTemplateAnalyzer {\n\n    static final List<NavDragComponentType> ALL_NAV_GROUP_COMPONENTS = Arrays.asList(CAROUSEL, MENUBAR, TABLIST, TREE, TILES);\n    static final List<NavDragComponentType> SHOW_ENTIRE_NAV_GROUP_COMPONENTS = Arrays.asList(CAROUSEL);\n    static final List<NavDragComponentType> DEFAULT_ITEM_NAV_GROUP_COMPONENTS = Arrays.asList(MENUBAR, TABLIST, TREE);\n\n    private PerspectivePluginServicesImpl pluginServices;\n    private NavigationServicesImpl navigationServices;\n\n    public LayoutTemplateAnalyzer() {\n    }\n\n    @Inject\n    public LayoutTemplateAnalyzer(PerspectivePluginServicesImpl pluginServices, NavigationServicesImpl navigationServices) {\n        this.pluginServices = pluginServices;\n        this.navigationServices = navigationServices;\n    }\n\n    public LayoutRecursionIssue analyzeRecursion(LayoutTemplate layoutTemplate) {\n        return analyzeRecursion(layoutTemplate, null);\n    }\n\n    public LayoutRecursionIssue analyzeRecursion(LayoutTemplate layoutTemplate, LayoutTemplateContext layoutCtx) {\n        LayoutRecursionIssue info = new LayoutRecursionIssue();\n        info.push(new LayoutNavigationRef(PERSPECTIVE, layoutTemplate.getName()));\n        boolean hasIssue = analyzeRecursion(layoutTemplate, info, layoutCtx);\n        if (!hasIssue) {\n            info.pop();\n        }\n        return info;\n    }\n\n    public boolean analyzeRecursion(LayoutTemplate layoutTemplate, LayoutRecursionIssue issue, LayoutTemplateContext layoutCtx) {\n        for (LayoutRow row : layoutTemplate.getRows()) {\n            boolean hasIssue = analyzeRecursion(row, issue, layoutCtx);\n            if (hasIssue) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public boolean analyzeRecursion(LayoutRow row, LayoutRecursionIssue issue, LayoutTemplateContext layoutCtx) {\n        NavTree navTree = navigationServices.loadNavTree();\n        for (LayoutColumn column : row.getLayoutColumns()) {\n\n            for (LayoutComponent component : column.getLayoutComponents()) {\n                issue.push(new LayoutNavigationRef(NAV_COMPONENT, component.getDragTypeName()));\n\n                // Components pointing to a perspective can cause an infinite recursion issue\n                String perspectiveId = component.getProperties().get(PERSPECTIVE_ID);\n                if (perspectiveId != null) {\n                    boolean hasIssue = analyzeRecursion(perspectiveId, issue);\n                    if (hasIssue) {\n                        return true;\n                    }\n                }\n\n                // Get the nav group the component is tied to\n                String navGroupId = component.getProperties().get(NAV_GROUP_ID);\n                String navDefaultId = component.getProperties().get(NAV_DEFAULT_ID);\n                LayoutNavigationRefType navGroupRefType = NAV_GROUP_DEFINED;\n                if (layoutCtx != null && layoutCtx.getNavGroupId() != null) {\n                    navGroupId = layoutCtx.getNavGroupId();\n                    navDefaultId = null;\n                    navGroupRefType = NAV_GROUP_CONTEXT;\n                }\n                else {\n                    LayoutNavigationRef lastDefaultItemRef = issue.getLastDefaultItemRef();\n                    if (lastDefaultItemRef != null) {\n                        NavItem lastDefaultItem = navTree.getItemById(lastDefaultItemRef.getName());\n                        String lastDefaultGroupId = NavWorkbenchCtx.get(lastDefaultItem).getNavGroupId();\n                        if (lastDefaultGroupId != null) {\n                            navGroupId = lastDefaultGroupId;\n                            navDefaultId = null;\n                            navGroupRefType = NAV_GROUP_CONTEXT;\n                        }\n                    }\n                }\n                NavGroup navGroup = navTree != null ? (NavGroup) navTree.getItemById(navGroupId) : null;\n                if (navGroup != null) {\n\n                    // The configured default item can cause an infinite recursion issue\n                    if (navDefaultId != null) {\n                        issue.push(new LayoutNavigationRef(navGroupRefType, navGroup.getId()));\n                        issue.push(new LayoutNavigationRef(DEFAULT_ITEM_DEFINED, navDefaultId));\n                        NavItem defaultItem = navTree.getItemById(navDefaultId);\n                        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(defaultItem);\n                        perspectiveId = navCtx.getResourceId();\n                        boolean hasIssue = analyzeRecursion(perspectiveId, issue);\n                        if (hasIssue) {\n                            return true;\n                        } else {\n                            issue.pop();\n                            issue.pop();\n                        }\n                    }\n                    // For some components the first available item is taken when there is no default item set\n                    else if (hasDefaultItem(component)) {\n                        NavItem firstItem = getFirstRuntimePerspective(navGroup.getChildren());\n                        if (firstItem != null) {\n                            issue.push(new LayoutNavigationRef(navGroupRefType, navGroup.getId()));\n                            issue.push(new LayoutNavigationRef(DEFAULT_ITEM_FOUND, firstItem.getId()));\n                            perspectiveId = NavWorkbenchCtx.get(firstItem).getResourceId();\n                            boolean hasIssue = analyzeRecursion(perspectiveId, issue);\n                            if (hasIssue) {\n                                return true;\n                            } else {\n                                issue.pop();\n                                issue.pop();\n                            }\n                        }\n                    }\n\n                    // Any layout component linked to a nav group can potentially lead to an infinite recursion issue.\n                    boolean showAtOnce = showEntireNavGroup(component);\n                    if (navGroupId != null && showAtOnce) {\n                        boolean hasIssue = analyzeRecursion(navGroup, navGroupRefType, issue);\n                        if (hasIssue) {\n                            return true;\n                        }\n                    }\n                }\n                issue.pop();\n            }\n\n            for (LayoutRow childRow : column.getRows()) {\n                boolean hasIssue = analyzeRecursion(childRow, issue, layoutCtx);\n                if (hasIssue) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    public boolean analyzeRecursion(NavGroup navGroup, LayoutNavigationRefType navGroupRefType, LayoutRecursionIssue issue) {\n        if (navGroup == null) {\n            return false;\n        }\n        issue.push(new LayoutNavigationRef(navGroupRefType, navGroup.getId()));\n        for (NavItem navItem : navGroup.getChildren()) {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            String perspectiveId = navCtx.getResourceId();\n            boolean hasIssue = analyzeRecursion(perspectiveId, issue);\n            if (hasIssue) {\n                return true;\n            }\n        }\n        issue.pop();\n        return false;\n    }\n\n    public boolean analyzeRecursion(String perspectiveId, LayoutRecursionIssue issue) {\n        LayoutTemplate layoutTemplate = pluginServices.getLayoutTemplate(perspectiveId);\n        if (layoutTemplate != null) {\n\n            // An infinite recursion occurs either when the perspective is linked to an already\n            // traversed perspective or when the layout itself is causing so.\n\n            LayoutNavigationRef perspectiveRef = new LayoutNavigationRef(PERSPECTIVE, perspectiveId);\n            if (issue.contains(perspectiveRef)) {\n                issue.push(new LayoutNavigationRef(PERSPECTIVE, perspectiveId));\n                return true;\n            }\n            else {\n                issue.push(new LayoutNavigationRef(PERSPECTIVE, perspectiveId));\n                boolean hasIssue = analyzeRecursion(layoutTemplate, issue, null);\n                if (hasIssue) {\n                    return true;\n                } else {\n                    issue.pop();\n                }\n            }\n        }\n        return false;\n    }\n\n    public boolean hasNavigationComponents(LayoutTemplate layoutTemplate) {\n        for (LayoutRow row : layoutTemplate.getRows()) {\n            boolean hasNavComps = hasNavigationComponents(row);\n            if (hasNavComps) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public boolean hasNavigationComponents(LayoutRow row) {\n        for (LayoutColumn column : row.getLayoutColumns()) {\n\n            for (LayoutComponent component : column.getLayoutComponents()) {\n                NavDragComponentType dragType = NavDragComponentType.getByClassName(component.getDragTypeName());\n                if (dragType != null && ALL_NAV_GROUP_COMPONENTS.contains(dragType)) {\n                    return true;\n                }\n            }\n\n            for (LayoutRow childRow : column.getRows()) {\n                boolean hasNavComps = hasNavigationComponents(childRow);\n                if (hasNavComps) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    protected boolean showEntireNavGroup(LayoutComponent component) {\n        NavDragComponentType dragType = NavDragComponentType.getByClassName(component.getDragTypeName());\n        return dragType != null && SHOW_ENTIRE_NAV_GROUP_COMPONENTS.contains(dragType);\n    }\n\n    protected boolean hasDefaultItem(LayoutComponent component) {\n        NavDragComponentType dragType = NavDragComponentType.getByClassName(component.getDragTypeName());\n        return dragType != null && DEFAULT_ITEM_NAV_GROUP_COMPONENTS.contains(dragType);\n    }\n\n    protected boolean isRuntimePerspectiveId(NavItem navItem) {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n        String perspectiveId = navCtx.getResourceId();\n        return pluginServices.getLayoutTemplate(perspectiveId) != null;\n    }\n\n    protected NavItem getFirstRuntimePerspective(List<NavItem> itemList) {\n        if (itemList.isEmpty()) {\n            return null;\n        }\n        for (NavItem navItem : itemList) {\n            if (isRuntimePerspectiveId(navItem)) {\n                return navItem;\n            }\n            if (navItem instanceof NavGroup) {\n                NavItem result = getFirstRuntimePerspective(((NavGroup) navItem).getChildren());\n                if (result != null) {\n                    return result;\n                }\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/main/java/org/dashbuilder/navigation/service/NavigationServicesImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.storage.NavTreeStorage;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@ApplicationScoped\n@Service\npublic class NavigationServicesImpl implements NavigationServices {\n\n    private NavTreeStorage storage;\n\n    public NavigationServicesImpl() {\n    }\n\n    @Inject\n    public NavigationServicesImpl(NavTreeStorage storage) {\n        this.storage = storage;\n    }\n\n    @Override\n    public NavTree loadNavTree() {\n        return storage.loadNavTree();\n    }\n\n    @Override\n    public void saveNavTree(NavTree navTree) {\n        storage.saveNavTree(navTree);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/main/java/org/dashbuilder/navigation/service/PerspectivePluginServicesImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.LayoutTemplateInfo;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.impl.LayoutServicesImpl;\nimport org.uberfire.ext.plugin.backend.PluginServicesImpl;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\n\n@ApplicationScoped\n@Service\npublic class PerspectivePluginServicesImpl implements PerspectivePluginServices {\n\n    private PluginServicesImpl pluginServices;\n    private LayoutServicesImpl layoutServices;\n    private LayoutTemplateAnalyzer layoutTemplateAnalyzer;\n\n    public PerspectivePluginServicesImpl() {\n    }\n\n    @Inject\n    public PerspectivePluginServicesImpl(PluginServicesImpl pluginServices, LayoutServicesImpl layoutServices, LayoutTemplateAnalyzer layoutTemplateAnalyzer) {\n        this.pluginServices = pluginServices;\n        this.layoutServices = layoutServices;\n        this.layoutTemplateAnalyzer = layoutTemplateAnalyzer;\n    }\n\n    @Override\n    public Collection<Plugin> listPlugins() {\n        return pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n    }\n\n    @Override\n    public Plugin getPerspectivePlugin(String perspectiveName) {\n        if (perspectiveName == null) {\n            return null;\n        }\n        for (Plugin plugin : listPlugins()) {\n            if (PluginType.PERSPECTIVE_LAYOUT.equals(plugin.getType()) && plugin.getName().equals(perspectiveName)) {\n                return plugin;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(String perspectiveName) {\n        Plugin perspectivePlugin = getPerspectivePlugin(perspectiveName);\n        return perspectivePlugin != null ? getLayoutTemplate(perspectivePlugin) : null;\n    }\n\n    @Override\n    public LayoutTemplateInfo getLayoutTemplateInfo(String perspectiveName) {\n        LayoutTemplate layoutTemplate = getLayoutTemplate(perspectiveName);\n        return layoutTemplate != null ? getLayoutTemplateInfo(layoutTemplate) : null;\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin) {\n        LayoutEditorModel layoutEditorModel = pluginServices.getLayoutEditor(perspectivePlugin.getPath(), PluginType.PERSPECTIVE_LAYOUT);\n        return layoutServices.convertLayoutFromString(layoutEditorModel.getLayoutEditorModel());\n    }\n\n    @Override\n    public LayoutTemplateInfo getLayoutTemplateInfo(Plugin perspectivePlugin, LayoutTemplateContext layoutCtx) {\n        LayoutTemplate layoutTemplate = getLayoutTemplate(perspectivePlugin);\n        LayoutRecursionIssue recursiveIssue = layoutTemplateAnalyzer.analyzeRecursion(layoutTemplate, layoutCtx);\n        boolean hasNavComps = layoutTemplateAnalyzer.hasNavigationComponents(layoutTemplate);\n        return new LayoutTemplateInfo(layoutTemplate, hasNavComps, recursiveIssue);\n    }\n\n    @Override\n    public LayoutTemplateInfo getLayoutTemplateInfo(LayoutTemplate layoutTemplate) {\n        LayoutRecursionIssue recursiveIssue = layoutTemplateAnalyzer.analyzeRecursion(layoutTemplate);\n        boolean hasNavComps = layoutTemplateAnalyzer.hasNavigationComponents(layoutTemplate);\n        return new LayoutTemplateInfo(layoutTemplate, hasNavComps, recursiveIssue);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/main/java/org/dashbuilder/navigation/storage/NavTreeStorage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.storage;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.json.NavTreeJSONMarshaller;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\n@ApplicationScoped\npublic class NavTreeStorage {\n\n    public static final String NAV_TREE_FILE_NAME = \"navtree.json\";\n    private IOService ioService;\n    private NavTreeJSONMarshaller jsonMarshaller;\n    private Path root;\n    private Logger log = LoggerFactory.getLogger(NavTreeStorage.class);\n    private FileSystem fileSystem;\n\n    public NavTreeStorage() {\n    }\n\n    @Inject\n    public NavTreeStorage(@Named(\"ioStrategy\") IOService ioService,\n                          @Named(\"navigationFS\") FileSystem fileSystem) {\n        this.ioService = ioService;\n        this.fileSystem = fileSystem;\n        this.jsonMarshaller = NavTreeJSONMarshaller.get();\n    }\n\n    @PostConstruct\n    public void init() {\n        root = fileSystem.getRootDirectories().iterator().next();\n    }\n\n    protected Path getNavRootPath() {\n        return root.resolve(\"navigation\");\n    }\n\n    protected Path getNavTreePath() {\n        return getNavRootPath().resolve(NAV_TREE_FILE_NAME);\n    }\n\n    public NavTree loadNavTree() {\n        Path path = getNavTreePath();\n        if (!ioService.exists(path)) {\n            return null;\n        }\n        try {\n            String json = ioService.readAllString(path);\n            return jsonMarshaller.fromJson(json);\n        } catch (Exception e) {\n            log.error(\"Error parsing json definition: \" + path.getFileName(),\n                      e);\n            return null;\n        }\n    }\n\n    public void saveNavTree(NavTree navTree) {\n        ioService.startBatch(fileSystem);\n        try {\n            String json = jsonMarshaller.toJson(navTree).toString();\n            Path path = getNavTreePath();\n            ioService.write(path,\n                            json);\n        } catch (Exception e) {\n            log.error(\"Can't save the navigation tree.\",\n                      e);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-navigation-backend/src/test/java/org/dashbuilder/navigation/service/LayoutTemplateAnalyzerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.layout.LayoutNavigationRef;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.dashbuilder.navigation.layout.LayoutNavigationRefType.*;\nimport static org.dashbuilder.navigation.layout.NavDragComponentSettings.*;\nimport static org.dashbuilder.navigation.layout.NavDragComponentType.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutTemplateAnalyzerTest {\n\n    @Mock\n    PerspectivePluginServicesImpl pluginServices;\n\n    @Mock\n    NavigationServicesImpl navigationServices;\n\n    @InjectMocks\n    LayoutTemplateAnalyzer layoutTemplateAnalyzer;\n\n    LayoutTemplate layoutA = new LayoutTemplate(\"A\");\n    LayoutTemplate layoutB = new LayoutTemplate(\"B\");\n    LayoutTemplate layoutC = new LayoutTemplate(\"C\");\n    LayoutTemplate layoutD = new LayoutTemplate(\"D\");\n    LayoutTemplate layoutE = new LayoutTemplate(\"D\");\n    LayoutColumn layoutColumnA = new LayoutColumn(\"12\");\n    LayoutColumn layoutColumnB = new LayoutColumn(\"12\");\n    LayoutColumn layoutColumnD = new LayoutColumn(\"12\");\n    LayoutComponent layoutComponentA = new LayoutComponent(CAROUSEL.getFQClassName());\n    LayoutComponent layoutComponentB = new LayoutComponent(CAROUSEL.getFQClassName());\n    LayoutComponent layoutComponentC1 = new LayoutComponent(TABLIST.getFQClassName());\n    LayoutComponent layoutComponentC2 = new LayoutComponent(TABLIST.getFQClassName());\n    LayoutComponent layoutComponentD = new LayoutComponent(TREE.getFQClassName());\n    LayoutComponent layoutComponentE = new LayoutComponent();\n\n\n    @Before\n    public void setUp() throws Exception {\n        LayoutRow layoutRowA = new LayoutRow();\n        layoutComponentA.addProperty(NAV_GROUP_ID, \"groupA\");\n        layoutRowA.add(layoutColumnA);\n        layoutColumnA.add(layoutComponentA);\n        layoutA.addRow(layoutRowA);\n\n        LayoutRow layoutRowB = new LayoutRow();\n        layoutComponentB.addProperty(NAV_GROUP_ID, \"groupB\");\n        layoutRowB.add(layoutColumnB);\n        layoutColumnB.add(layoutComponentB);\n        layoutB.addRow(layoutRowB);\n\n        LayoutRow layoutRowC = new LayoutRow();\n        LayoutColumn layoutColumnC1 = new LayoutColumn(\"6\");\n        LayoutColumn layoutColumnC2 = new LayoutColumn(\"6\");\n        layoutComponentC1.addProperty(NAV_GROUP_ID, \"groupC\");\n        layoutComponentC2.addProperty(NAV_GROUP_ID, \"groupC\");\n        layoutRowC.add(layoutColumnC1);\n        layoutRowC.add(layoutColumnC2);\n        layoutColumnC1.add(layoutComponentC1);\n        layoutColumnC2.add(layoutComponentC2);\n        layoutC.addRow(layoutRowC);\n\n        LayoutRow layoutRowD = new LayoutRow();\n        layoutComponentD.addProperty(NAV_GROUP_ID, \"groupD\");\n        layoutRowD.add(layoutColumnD);\n        layoutColumnD.add(layoutComponentD);\n        layoutD.addRow(layoutRowD);\n\n        LayoutRow layoutRowE = new LayoutRow();\n        LayoutColumn layoutColumnE = new LayoutColumn(\"12\");\n        layoutRowE.add(layoutColumnE);\n        layoutColumnE.add(layoutComponentE);\n        layoutE.addRow(layoutRowE);\n\n        when(pluginServices.getLayoutTemplate(\"A\")).thenReturn(layoutA);\n        when(pluginServices.getLayoutTemplate(\"B\")).thenReturn(layoutB);\n        when(pluginServices.getLayoutTemplate(\"C\")).thenReturn(layoutC);\n        when(pluginServices.getLayoutTemplate(\"D\")).thenReturn(layoutD);\n    }\n\n    @Test\n    public void testNavTreeNotDefined() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(null);\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertTrue(info.isEmpty());\n    }\n\n    @Test\n    public void testOneLevelNoRecursiveIssue() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupA\", \"\", \"\", true)\n                    .item(\"layout\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"B\"))\n                    .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertTrue(info.isEmpty());\n    }\n\n    @Test\n    public void testPerspectiveReuseNoRecursiveIssue() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupC\", \"\", \"\", true)\n                    .item(\"layout\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"B\"))\n                    .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC);\n        assertTrue(info.isEmpty());\n    }\n\n    @Test\n    public void testSimpleRecursion() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupA\", \"\", \"\", true)\n                    .item(\"layout\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                    .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertEquals(info.getRefList().size(), 4);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, CAROUSEL.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupA\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n    }\n\n    @Test\n    public void testPerspectiveComponent() throws Exception {\n        LayoutComponent layoutComponentB = new LayoutComponent(\"PerspectiveDrag\");\n        layoutComponentB.addProperty(PERSPECTIVE_ID, \"B\");\n        layoutColumnA.add(layoutComponentB);\n\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder().build());\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertTrue(info.isEmpty());\n    }\n\n    @Test\n    public void testPerspectiveRecursiveIssue() throws Exception {\n        LayoutComponent layoutComponentB = new LayoutComponent(\"PerspectiveDrag\");\n        layoutComponentB.addProperty(PERSPECTIVE_ID, \"B\");\n        layoutColumnA.add(layoutComponentB);\n        LayoutComponent layoutComponentA = new LayoutComponent(\"PerspectiveDrag\");\n        layoutComponentB.addProperty(PERSPECTIVE_ID, \"A\");\n        layoutColumnB.add(layoutComponentA);\n\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder().build());\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertEquals(info.getRefList().size(), 3);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, \"PerspectiveDrag\"));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n    }\n\n    @Test\n    public void testIndirectRecursiveIssue() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupA\", \"\", \"\", true)\n                    .item(\"layout\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"B\"))\n                    .endGroup()\n                .group(\"groupB\", \"\", \"\", true)\n                    .item(\"layout\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                    .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutA);\n        assertEquals(info.getRefList().size(), 7);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, CAROUSEL.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupA\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(PERSPECTIVE, \"B\"));\n        assertEquals(info.getRefList().get(4), new LayoutNavigationRef(NAV_COMPONENT, CAROUSEL.getFQClassName()));\n        assertEquals(info.getRefList().get(5), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupB\"));\n        assertEquals(info.getRefList().get(6), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n    }\n\n    @Test\n    public void testDefaultItemNoRecursiveIssue() throws Exception {\n        layoutComponentC1.addProperty(NAV_DEFAULT_ID, \"item2\");\n        layoutComponentC2.addProperty(NAV_DEFAULT_ID, \"item2\");\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupC\", \"\", \"\", true)\n                .item(\"item1\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"C\"))\n                .item(\"item2\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"B\"))\n                .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC);\n        assertTrue(info.isEmpty());\n    }\n\n    @Test\n    public void testIndirectNavGroupRecursiveIssue() throws Exception {\n        layoutComponentC1.addProperty(NAV_DEFAULT_ID, \"item2\");\n        layoutComponentD.addProperty(NAV_DEFAULT_ID, \"item4\");\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupC\", \"\", \"\", true)\n                .item(\"item1\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                .item(\"item2\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"D\").setNavGroupId(\"groupX\"))\n                .endGroup()\n                .group(\"groupX\", \"\", \"\", true)\n                .item(\"item3\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"D\").setNavGroupId(\"groupX\"))\n                .item(\"item4\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC);\n        assertEquals(info.getRefList().size(), 9);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, TABLIST.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupC\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(DEFAULT_ITEM_DEFINED, \"item2\"));\n        assertEquals(info.getRefList().get(4), new LayoutNavigationRef(PERSPECTIVE, \"D\"));\n        assertEquals(info.getRefList().get(5), new LayoutNavigationRef(NAV_COMPONENT, TREE.getFQClassName()));\n        assertEquals(info.getRefList().get(6), new LayoutNavigationRef(NAV_GROUP_CONTEXT, \"groupX\"));\n        assertEquals(info.getRefList().get(7), new LayoutNavigationRef(DEFAULT_ITEM_FOUND, \"item3\"));\n        assertEquals(info.getRefList().get(8), new LayoutNavigationRef(PERSPECTIVE, \"D\"));\n    }\n\n    @Test\n    public void testDefaultItemRecursiveIssue() throws Exception {\n        layoutComponentC1.addProperty(NAV_DEFAULT_ID, \"item1\");\n        layoutComponentC2.addProperty(NAV_DEFAULT_ID, \"item1\");\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupC\", \"\", \"\", true)\n                .item(\"item1\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"C\"))\n                .item(\"item2\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"B\"))\n                .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC);\n        assertEquals(info.getRefList().size(), 5);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, TABLIST.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupC\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(DEFAULT_ITEM_DEFINED, \"item1\"));\n        assertEquals(info.getRefList().get(4), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n    }\n\n    @Test\n    public void testFirstItemIndirectRecursiveIssue() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupA\", \"\", \"\", true)\n                .item(\"itemA\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"C\"))\n                .endGroup()\n                .group(\"groupC\", \"\", \"\", true)\n                .item(\"itemC\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC);\n        assertEquals(info.getRefList().size(), 8);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, TABLIST.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupC\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(DEFAULT_ITEM_FOUND, \"itemC\"));\n        assertEquals(info.getRefList().get(4), new LayoutNavigationRef(PERSPECTIVE, \"A\"));\n        assertEquals(info.getRefList().get(5), new LayoutNavigationRef(NAV_COMPONENT, CAROUSEL.getFQClassName()));\n        assertEquals(info.getRefList().get(6), new LayoutNavigationRef(NAV_GROUP_DEFINED, \"groupA\"));\n        assertEquals(info.getRefList().get(7), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n    }\n\n    @Test\n    public void testNavGroupFromContext() throws Exception {\n        when(navigationServices.loadNavTree()).thenReturn(new NavTreeBuilder()\n                .group(\"groupC\", \"\", \"\", true)\n                .item(\"item1\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"A\"))\n                .endGroup()\n                .group(\"groupX\", \"\", \"\", true)\n                .item(\"item2\", \"\", \"\", true, NavWorkbenchCtx.perspective(\"C\"))\n                .endGroup()\n                .build());\n\n        LayoutRecursionIssue info = layoutTemplateAnalyzer.analyzeRecursion(layoutC, new LayoutTemplateContext(\"groupX\"));\n        assertEquals(info.getRefList().size(), 5);\n        assertEquals(info.getRefList().get(0), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n        assertEquals(info.getRefList().get(1), new LayoutNavigationRef(NAV_COMPONENT, TABLIST.getFQClassName()));\n        assertEquals(info.getRefList().get(2), new LayoutNavigationRef(NAV_GROUP_CONTEXT, \"groupX\"));\n        assertEquals(info.getRefList().get(3), new LayoutNavigationRef(DEFAULT_ITEM_FOUND, \"item2\"));\n        assertEquals(info.getRefList().get(4), new LayoutNavigationRef(PERSPECTIVE, \"C\"));\n    }\n\n    @Test\n    public void testHasNavigationComponents() throws Exception {\n        assertTrue(layoutTemplateAnalyzer.hasNavigationComponents(layoutA));\n        assertTrue(layoutTemplateAnalyzer.hasNavigationComponents(layoutB));\n        assertTrue(layoutTemplateAnalyzer.hasNavigationComponents(layoutC));\n        assertTrue(layoutTemplateAnalyzer.hasNavigationComponents(layoutD));\n        assertFalse(layoutTemplateAnalyzer.hasNavigationComponents(layoutE));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-services</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Services</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-sql</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <!-- CSV Export. -->\n    <dependency>\n      <groupId>net.sf.opencsv</groupId>\n      <artifactId>opencsv</artifactId>\n    </dependency>\n\n    <!-- Excel Export. -->\n    <dependency>\n      <groupId>org.apache.poi</groupId>\n      <artifactId>poi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.poi</groupId>\n      <artifactId>poi-ooxml</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>stax</groupId>\n          <artifactId>stax-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- added because enforce-direct-dependencies check failed -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/dataset/service/DataSetDefServicesImpl.java",
    "content": "/**\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.io.File;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.servlet.ServletContext;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSetDefDeployerCDI;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\n@Service\npublic class DataSetDefServicesImpl implements DataSetDefServices {\n\n    protected static Logger log = LoggerFactory.getLogger(DataSetDefServicesImpl.class);\n    protected User identity;\n    protected ExceptionManager exceptionManager;\n    protected UUIDGenerator uuidGenerator;\n    protected DataSetDefRegistryCDI dataSetDefRegistry;\n    protected DataSetDefDeployerCDI dataSetDefDeployer;\n\n    public DataSetDefServicesImpl() {\n    }\n\n    @Inject\n    public DataSetDefServicesImpl(User identity,\n                                  ExceptionManager exceptionManager,\n                                  DataSetDefRegistryCDI dataSetDefRegistry,\n                                  DataSetDefDeployerCDI dataSetDefDeployer) {\n        this.identity = identity;\n        this.uuidGenerator = DataSetCore.get().getUuidGenerator();\n        this.dataSetDefRegistry = dataSetDefRegistry;\n        this.exceptionManager = exceptionManager;\n        this.dataSetDefDeployer = dataSetDefDeployer;\n    }\n\n    @PostConstruct\n    protected void init() {\n        // By default, enable the register of data set definitions stored into the deployment folder.\n        ServletContext servletContext = RpcContext.getHttpSession().getServletContext();\n        if (!dataSetDefDeployer.isRunning() && servletContext != null) {\n            String dir = servletContext.getRealPath(\"WEB-INF/datasets\");\n            if (dir != null && new File(dir).exists()) {\n                dir = dir.replaceAll(\"\\\\\\\\\", \"/\");\n                dataSetDefDeployer.deploy(dir);\n            }\n        }\n    }\n\n    @Override\n    public List<DataSetDef> getPublicDataSetDefs() {\n        return dataSetDefRegistry.getDataSetDefs(true);\n    }\n\n    @Override\n    public DataSetDef createDataSetDef(DataSetProviderType type) {\n        DataSetDef result = type != null ? type.createDataSetDef() : new DataSetDef();\n        result.setUUID(uuidGenerator.newUuid());\n        return result;\n    }\n\n    @Override\n    public String registerDataSetDef(DataSetDef definition, String comment) {\n        // Data sets registered from the UI does not contain a UUID.\n        if (definition.getUUID() == null) {\n            final String uuid = uuidGenerator.newUuid();\n            definition.setUUID(uuid);\n        }\n        dataSetDefRegistry.registerDataSetDef(definition,\n                identity != null ? identity.getIdentifier() : \"---\",\n                comment);\n        return definition.getUUID();\n    }\n\n    @Override\n    public void removeDataSetDef(final String uuid, String comment) {\n        final DataSetDef def = dataSetDefRegistry.getDataSetDef(uuid);\n        if (def != null) {\n            dataSetDefRegistry.removeDataSetDef(uuid,\n                identity != null ? identity.getIdentifier() : \"---\",\n                comment);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/dataset/service/DataSetDefVfsServicesImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetManagerCDI;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.backend.EditDataSetDef;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.Path;\n\n@ApplicationScoped\n@Service\npublic class DataSetDefVfsServicesImpl implements DataSetDefVfsServices {\n\n    private static final String SYSTEM = \"system\";\n    protected User identity;\n    protected DataSetDefRegistryCDI dataSetDefRegistry;\n    protected DataSetManagerCDI dataSetManager;\n    protected ExceptionManager exceptionManager;\n\n    public DataSetDefVfsServicesImpl() {\n    }\n\n    @Inject\n    public DataSetDefVfsServicesImpl(User identity,\n                                     DataSetDefRegistryCDI dataSetDefRegistry,\n                                     DataSetManagerCDI dataSetManager,\n                                     ExceptionManager exceptionManager) {\n        this.identity = identity;\n        this.dataSetDefRegistry = dataSetDefRegistry;\n        this.dataSetManager = dataSetManager;\n        this.exceptionManager = exceptionManager;\n    }\n\n    @Override\n    public Path resolve(DataSetDef dataSetDef) {\n        return dataSetDefRegistry.resolveVfsPath(dataSetDef);\n    }\n\n    @Override\n    public DataSetDef get(Path path) {\n        return dataSetDefRegistry.loadDataSetDef(path);\n    }\n\n    @Override\n    public EditDataSetDef load(Path path) {\n        try {\n            DataSetDef def = dataSetDefRegistry.loadDataSetDef(path);\n            if (def == null) {\n                return null;\n            }\n\n            // Clone the definition\n            DataSetDef cloned = def.clone();\n\n            // Enable all columns and set columns to null, force to obtain metadata with all original columns\n            // and all original column types.\n            boolean clonedAllColumns = cloned.isAllColumnsEnabled();\n            List<DataColumnDef> clonedColumns = cloned.getColumns();\n            cloned.setAllColumnsEnabled(true);\n            cloned.setColumns(null);\n\n            // Obtain all original columns and all original column types.\n            DataSetMetadata _cd = dataSetManager.resolveProvider(cloned)\n                    .getDataSetMetadata(cloned);\n\n            // Return the list of original columns and its types.\n            List<DataColumnDef> columns = new ArrayList<DataColumnDef>();\n            if (_cd.getNumberOfColumns() > 0) {\n                for (int x = 0; x < _cd.getNumberOfColumns(); x++) {\n                    String cId = _cd.getColumnId(x);\n                    ColumnType cType = _cd.getColumnType(x);\n                    DataColumnDef cdef = new DataColumnDef(cId, cType);\n                    columns.add(cdef);\n                }\n            }\n\n            // Set columns attributes as initially were.\n            cloned.setAllColumnsEnabled(clonedAllColumns);\n            cloned.setColumns(clonedColumns);\n            return new EditDataSetDef(cloned, columns);\n\n        } catch (Exception e) {\n            throw exceptionManager.handleException(e);\n        }\n    }\n\n    @Override\n    public Path save(DataSetDef definition, String commitMessage) {\n        dataSetDefRegistry.registerDataSetDef(definition,\n                identity != null ? identity.getIdentifier() : SYSTEM,\n                commitMessage);\n        return dataSetDefRegistry.resolveVfsPath(definition);\n    }\n\n    @Override\n    public Path copy(Path path, String newName, String commitMessage) {\n        DataSetDef def = dataSetDefRegistry.loadDataSetDef(path);\n        if (def == null) {\n            throw exceptionManager.handleException(\n                    new Exception(\"Data set definition not found: \" + path.getFileName()));\n        }\n        DataSetDef clone = dataSetDefRegistry.copyDataSetDef(def, newName,\n                identity != null ? identity.getIdentifier() : SYSTEM,\n                commitMessage);\n        return dataSetDefRegistry.resolveVfsPath(clone);\n    }\n\n    @Override\n    public Path copy( final Path path,\n                      final String newName,\n                      final Path targetDirectory,\n                      final String comment ) {\n        if (targetDirectory == null) {\n            return copy(path, newName, comment);\n        }\n        throw new UnsupportedOperationException( \"A data set definition cannot be copied to another directory.\" );\n    }\n\n    @Override\n    public void delete(Path path, String commitMessage) {\n        dataSetDefRegistry.removeDataSetDef(path,\n                identity != null ? identity.getIdentifier() : SYSTEM,\n                commitMessage);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/dataset/service/DataSetExportServicesImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.math.BigDecimal;\nimport java.math.BigInteger;\nimport java.text.DateFormat;\nimport java.text.DecimalFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport au.com.bytecode.opencsv.CSVWriter;\nimport org.apache.poi.ss.usermodel.BorderStyle;\nimport org.apache.poi.ss.usermodel.BuiltinFormats;\nimport org.apache.poi.ss.usermodel.Cell;\nimport org.apache.poi.ss.usermodel.CellStyle;\nimport org.apache.poi.ss.usermodel.CellType;\nimport org.apache.poi.ss.usermodel.FillPatternType;\nimport org.apache.poi.ss.usermodel.Font;\nimport org.apache.poi.ss.usermodel.HorizontalAlignment;\nimport org.apache.poi.ss.usermodel.IndexedColors;\nimport org.apache.poi.ss.usermodel.PrintSetup;\nimport org.apache.poi.ss.usermodel.Row;\nimport org.apache.poi.ss.usermodel.VerticalAlignment;\nimport org.apache.poi.ss.usermodel.Workbook;\nimport org.apache.poi.ss.util.DateFormatConverter;\nimport org.apache.poi.xssf.streaming.SXSSFSheet;\nimport org.apache.poi.xssf.streaming.SXSSFWorkbook;\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetManagerCDI;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\n@ApplicationScoped\n@Service\npublic class DataSetExportServicesImpl implements DataSetExportServices {\n\n    private static final String TEXT_CELL = \"text_cell\";\n    protected static Logger log = LoggerFactory.getLogger(DataSetExportServicesImpl.class);\n    protected DataSetManagerCDI dataSetManager;\n    protected DataSetDefRegistryCDI gitStorage;\n    protected UUIDGenerator uuidGenerator;\n    protected ExceptionManager exceptionManager;\n\n    protected String DEFAULT_SEPARATOR_CHAR = \";\";\n    protected String DEFAULT_QUOTE_CHAR = \"\\\"\";\n    protected String DEFAULT_ESCAPE_CHAR = \"\\\\\";\n\n    protected String dateFormatPattern = \"dd/MM/yyyy HH:mm:ss\";\n    protected String numberFormatPattern = \"#,###.##########\";\n\n    protected DecimalFormat decf = new DecimalFormat(numberFormatPattern);\n    protected DateFormat datef = new SimpleDateFormat(dateFormatPattern);\n\n    public DataSetExportServicesImpl() {\n    }\n\n    @Inject\n    public DataSetExportServicesImpl(DataSetManagerCDI dataSetManager,\n                                     DataSetDefRegistryCDI gitStorage,\n                                     ExceptionManager exceptionManager) {\n        this.dataSetManager = dataSetManager;\n        this.gitStorage = gitStorage;\n        this.uuidGenerator = DataSetCore.get().getUuidGenerator();\n        this.exceptionManager = exceptionManager;\n    }\n\n    public org.uberfire.backend.vfs.Path exportDataSetCSV(DataSetLookup lookup) {\n        DataSet dataSet = dataSetManager.lookupDataSet(lookup);\n        return exportDataSetCSV(dataSet);\n    }\n\n    public org.uberfire.backend.vfs.Path exportDataSetCSV(DataSet dataSet) {\n        try {\n            if (dataSet == null) {\n                throw new IllegalArgumentException(\"Null dataSet specified!\");\n            }\n            int columnCount = dataSet.getColumns().size();\n            int rowCount = dataSet.getRowCount();\n\n            List<String[]> lines = new ArrayList<>(rowCount+1);\n\n            String[] line = new String[columnCount];\n            for (int cc = 0; cc < columnCount; cc++) {\n                DataColumn dc = dataSet.getColumnByIndex(cc);\n                line[cc] = dc.getId();\n            }\n            lines.add(line);\n\n            for (int rc = 0; rc < rowCount; rc++) {\n                line = new String[columnCount];\n                for (int cc = 0; cc < columnCount; cc++) {\n                    line[cc] = formatAsString(dataSet.getValueAt(rc, cc));\n                }\n                lines.add(line);\n            }\n\n            String tempCsvFile = uuidGenerator.newUuid() + \".csv\";\n            Path tempCsvPath = gitStorage.createTempFile(tempCsvFile);\n\n            try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(tempCsvPath)));\n                 CSVWriter writer = new CSVWriter(bw,\n                                                  DEFAULT_SEPARATOR_CHAR.charAt(0),\n                                                  DEFAULT_QUOTE_CHAR.charAt(0),\n                                                  DEFAULT_ESCAPE_CHAR.charAt(0))\n                 ) {\n                     writer.writeAll(lines);\n                     writer.flush();\n            }\n\n            return Paths.convert(tempCsvPath);\n        }\n        catch (Exception e) {\n            throw exceptionManager.handleException(e);\n        }\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path exportDataSetExcel(DataSetLookup dataSetLookup) {\n        DataSet dataSet = dataSetManager.lookupDataSet( dataSetLookup );\n        return exportDataSetExcel( dataSet );\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path exportDataSetExcel(DataSet dataSet) {\n        try {\n            SXSSFWorkbook wb = dataSetToWorkbook(dataSet);\n\n            // Write workbook to Path\n            String tempXlsFile = uuidGenerator.newUuid() + \".xlsx\";\n            Path tempXlsPath = gitStorage.createTempFile(tempXlsFile);\n            try (OutputStream os = Files.newOutputStream(tempXlsPath)) {\n                wb.write(os);\n                os.flush();\n            }\n\n            // Dispose of temporary files backing this workbook on disk\n            if (!wb.dispose()) {\n                log.warn(\"Could not dispose of temporary file associated to data export!\");\n            }\n            return Paths.convert(tempXlsPath);\n        } catch (Exception e) {\n            throw exceptionManager.handleException(e);\n        }\n    }\n\n    //Package private to enable testing\n    SXSSFWorkbook dataSetToWorkbook(DataSet dataSet) {\n        // TODO?: Excel 2010 limits: 1,048,576 rows by 16,384 columns; row width 255 characters\n        if (dataSet == null) {\n            throw new IllegalArgumentException(\"Null dataSet specified!\");\n        }\n        int columnCount = dataSet.getColumns().size();\n        int rowCount = dataSet.getRowCount() + 1; //Include header row;\n        int row = 0;\n\n        SXSSFWorkbook wb = new SXSSFWorkbook(100); // keep 100 rows in memory, exceeding rows will be flushed to disk\n        Map<String, CellStyle> styles = createStyles(wb);\n        SXSSFSheet sh = wb.createSheet(\"Sheet 1\");\n\n        // General setup\n        sh.setDisplayGridlines(true);\n        sh.setPrintGridlines(false);\n        sh.setFitToPage(true);\n        sh.setHorizontallyCenter(true);\n        sh.trackAllColumnsForAutoSizing();\n        PrintSetup printSetup = sh.getPrintSetup();\n        printSetup.setLandscape(true);\n\n        // Create header\n        Row header = sh.createRow(row++);\n        header.setHeightInPoints(20f);\n        for (int i = 0; i < columnCount; i++) {\n            Cell cell = header.createCell(i);\n            cell.setCellStyle(styles.get(\"header\"));\n            cell.setCellValue(dataSet.getColumnByIndex(i).getId());\n        }\n\n        // Create data rows\n        for (; row < rowCount; row++) {\n            Row _row = sh.createRow(row);\n            for (int cellnum = 0; cellnum < columnCount; cellnum++) {\n                Cell cell = _row.createCell(cellnum);\n                Object value = dataSet.getValueAt(row - 1,\n                                                  cellnum);\n                if (value instanceof Short || value instanceof Long || value instanceof Integer || value instanceof BigInteger) {\n                    cell.setCellType(CellType.NUMERIC);\n                    cell.setCellStyle(styles.get(\"integer_number_cell\"));\n                    cell.setCellValue(((Number) value).doubleValue());\n                } else if (value instanceof Float || value instanceof Double || value instanceof BigDecimal) {\n                    cell.setCellType(CellType.NUMERIC);\n                    cell.setCellStyle(styles.get(\"decimal_number_cell\"));\n                    cell.setCellValue(((Number) value).doubleValue());\n                } else if (value instanceof Date) {\n                    cell.setCellType(CellType.STRING);\n                    cell.setCellStyle(styles.get(\"date_cell\"));\n                    cell.setCellValue((Date) value);\n                } else if (value instanceof Interval) {\n                    cell.setCellType(CellType.STRING);\n                    cell.setCellStyle(styles.get(TEXT_CELL));\n                    cell.setCellValue(((Interval) value).getName());\n                } else {\n                    cell.setCellType(CellType.STRING);\n                    cell.setCellStyle(styles.get(TEXT_CELL));\n                    String val = value == null ? \"\" : value.toString();\n                    cell.setCellValue(val);\n                }\n            }\n        }\n\n        // Adjust column size\n        for (int i = 0; i < columnCount; i++) {\n            sh.autoSizeColumn(i);\n        }\n        return wb;\n    }\n\n    private String formatAsString(Object value) {\n        if (value == null) return \"\";\n        if (value instanceof Number) return decf.format(value);\n        else if (value instanceof Date) return datef.format(value);\n        // TODO verify if this is correct\n        else if (value instanceof Interval) return ((Interval)value).getName();\n        else return value.toString();\n    }\n\n    private Map<String, CellStyle> createStyles(Workbook wb){\n        Map<String, CellStyle> styles = new HashMap<>();\n        CellStyle style;\n\n        Font titleFont = wb.createFont();\n        titleFont.setFontHeightInPoints((short)12);\n        titleFont.setBold(true);\n        style = wb.createCellStyle();\n        style.setAlignment(HorizontalAlignment.CENTER);\n        style.setVerticalAlignment(VerticalAlignment.CENTER);\n        style.setFillForegroundColor( IndexedColors.GREY_25_PERCENT.getIndex());\n        style.setFillPattern(FillPatternType.SOLID_FOREGROUND);\n        style.setFont(titleFont);\n        style.setWrapText(false);\n        style.setBorderBottom(BorderStyle.THIN);\n        style.setBottomBorderColor(IndexedColors.GREY_80_PERCENT.getIndex());\n        styles.put(\"header\", style);\n\n        Font cellFont = wb.createFont();\n        cellFont.setFontHeightInPoints((short)10);\n        cellFont.setBold(true);\n\n        style = wb.createCellStyle();\n        style.setAlignment(HorizontalAlignment.RIGHT);\n        style.setVerticalAlignment(VerticalAlignment.BOTTOM);\n        style.setFont(cellFont);\n        style.setWrapText(false);\n        style.setDataFormat(wb.createDataFormat().getFormat( BuiltinFormats.getBuiltinFormat( 3 )));\n        styles.put(\"integer_number_cell\", style);\n\n        style = wb.createCellStyle();\n        style.setAlignment(HorizontalAlignment.RIGHT);\n        style.setVerticalAlignment(VerticalAlignment.BOTTOM);\n        style.setFont(cellFont);\n        style.setWrapText(false);\n        style.setDataFormat(wb.createDataFormat().getFormat(BuiltinFormats.getBuiltinFormat(4)));\n        styles.put(\"decimal_number_cell\", style);\n\n        style = wb.createCellStyle();\n        style.setAlignment(HorizontalAlignment.LEFT);\n        style.setVerticalAlignment(VerticalAlignment.BOTTOM);\n        style.setFont(cellFont);\n        style.setWrapText(false);\n        style.setDataFormat( (short) BuiltinFormats.getBuiltinFormat(\"text\") );\n        styles.put(TEXT_CELL, style);\n\n        style = wb.createCellStyle();\n        style.setAlignment(HorizontalAlignment.CENTER);\n        style.setVerticalAlignment(VerticalAlignment.BOTTOM);\n        style.setFont(cellFont);\n        style.setWrapText(false);\n        style.setDataFormat(wb.createDataFormat().getFormat( DateFormatConverter.convert( Locale.getDefault(), dateFormatPattern )));\n        styles.put(\"date_cell\", style);\n        return styles;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/dataset/service/DataSetLookupServicesImpl.java",
    "content": "/**\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.io.File;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.servlet.ServletContext;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetDefDeployerCDI;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetManagerCDI;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.exception.DataSetLookupException;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\n@Service\npublic class DataSetLookupServicesImpl implements DataSetLookupServices {\n\n    protected static Logger log = LoggerFactory.getLogger(DataSetLookupServicesImpl.class);\n    protected DataSetManagerCDI dataSetManager;\n    protected UUIDGenerator uuidGenerator;\n    protected DataSetDefDeployerCDI dataSetDefDeployer;\n    protected ExceptionManager exceptionManager;\n\n    public DataSetLookupServicesImpl() {\n    }\n\n    @Inject\n    public DataSetLookupServicesImpl(DataSetManagerCDI dataSetManager,\n                                     DataSetDefDeployerCDI dataSetDefDeployer,\n                                     ExceptionManager exceptionManager) {\n        this.dataSetManager = dataSetManager;\n        this.uuidGenerator = DataSetCore.get().getUuidGenerator();\n        this.dataSetDefDeployer = dataSetDefDeployer;\n        this.exceptionManager = exceptionManager;\n    }\n\n    @PostConstruct\n    protected void init() {\n        // By default, enable the register of data set definitions stored into the deployment folder.\n        ServletContext servletContext = RpcContext.getHttpSession().getServletContext();\n        if (!dataSetDefDeployer.isRunning() && servletContext != null) {\n            String dir = servletContext.getRealPath(\"WEB-INF/datasets\");\n            if (dir != null && new File(dir).exists()) {\n                dir = dir.replaceAll(\"\\\\\\\\\", \"/\");\n                dataSetDefDeployer.deploy(dir);\n            }\n        }\n    }\n\n    public DataSet lookupDataSet(DataSetLookup lookup) throws Exception {\n        DataSet _d = null;\n        try {\n            _d = dataSetManager.lookupDataSet(lookup);\n        } catch (DataSetLookupException e) {\n            throw exceptionManager.handleException(e);\n        }\n        \n        return _d;\n    }\n\n    public DataSet lookupDataSet(DataSetDef def, DataSetLookup lookup) throws Exception {\n        try {\n            // Although if using a not registered definition, it must have an uuid set for performing lookups.\n            if (def.getUUID() == null) {\n                final String uuid = uuidGenerator.newUuid();\n                def.setUUID(uuid);\n                lookup.setDataSetUUID(uuid);\n            }\n            return dataSetManager.resolveProvider(def)\n                    .lookupDataSet(def, lookup);\n        } catch (Exception e) {\n            throw exceptionManager.handleException(e);\n        }\n    }\n\n    public DataSetMetadata lookupDataSetMetadata(String uuid) throws Exception {\n        DataSetMetadata _d = null;\n        try {\n            _d = dataSetManager.getDataSetMetadata(uuid);\n        } catch (DataSetLookupException e) {\n            throw exceptionManager.handleException(e);\n        }\n\n        return _d;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/dataset/service/SQLProviderServicesImpl.java",
    "content": "/**\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.sql.SQLDataSourceLocator;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@ApplicationScoped\n@Service\npublic class SQLProviderServicesImpl implements SQLProviderServices {\n\n    SQLDataSourceLocator sqlDataSourceLocator;\n\n    public SQLProviderServicesImpl() {\n    }\n\n    @Inject\n    public SQLProviderServicesImpl(SQLDataSourceLocator sqlDataSourceLocator) {\n        this.sqlDataSourceLocator = sqlDataSourceLocator;\n    }\n\n    @Override\n    public List<SQLDataSourceDef> getDataSourceDefs() {\n        return sqlDataSourceLocator.list();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/migration/DashbuilderDataMigration.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.migration;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Predicate;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLockManager;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@ApplicationScoped\n@Startup\npublic class DashbuilderDataMigration {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(DashbuilderDataMigration.class);\n\n    private IOService ioService;\n    private FileSystem datasetsFS;\n    private FileSystem pluginsFS;\n    private FileSystem perspectivesFS;\n    private FileSystem navigationFS;\n\n    public DashbuilderDataMigration() {\n\n    }\n\n    @Inject\n    public DashbuilderDataMigration(\n            final @Named(\"ioStrategy\") IOService ioService,\n            final @Named(\"datasetsFS\") FileSystem datasetsFS,\n            final @Named(\"pluginsFS\") FileSystem pluginsFS,\n            final @Named(\"perspectivesFS\") FileSystem perspectivesFS,\n            final @Named(\"navigationFS\") FileSystem navigationFS) {\n\n        this.ioService = ioService;\n        this.datasetsFS = datasetsFS;\n        this.pluginsFS = pluginsFS;\n        this.perspectivesFS = perspectivesFS;\n        this.navigationFS = navigationFS;\n    }\n\n    @PostConstruct\n    protected void init() {\n        if (this.isMigrationEnabled()) {\n            runWithLock(() -> {\n                migrateDatasets();\n                migratePerspectives();\n                migrateNavigation();\n            });\n        }\n    }\n\n    protected boolean isMigrationEnabled() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n\n    private void migrateDatasets() {\n        FileSystem oldDatasetsFS = lookupFileSystem(SpacesAPI.DEFAULT_SPACE, \"datasets\");\n        this.migrateDatasets(oldDatasetsFS, datasetsFS);\n        cleanupFileSystem(oldDatasetsFS);\n    }\n\n    private FileSystem lookupFileSystem(Space space, String name) {\n        FileSystem fs;\n\n        URI uri = new SpacesAPIImpl().resolveFileSystemURI(\n                SpacesAPI.Scheme.DEFAULT,\n                space,\n                name);\n\n        HashMap<String, Object> env = new HashMap<>();\n        env.put(\"init\", Boolean.TRUE);\n        env.put(\"internal\", Boolean.TRUE);\n\n        try {\n            fs = ioService.newFileSystem(uri, env);\n        } catch (FileSystemAlreadyExistsException e) {\n            fs = ioService.getFileSystem(uri);\n        }\n\n        return fs;\n    }\n\n    private void cleanupFileSystem(FileSystem fs) {\n        Path root = getRoot(fs);\n        if (root != null && fs instanceof JGitFileSystem) {\n            try {\n                Path fsPath = fs.getPath(\"\");\n                Files.delete(fsPath);\n            } catch (Exception e) {\n                LOGGER.error(\"Failed to remove the datasets git repository.\");\n                LOGGER.debug(\"Error during dashbuilder migration\", e);\n            }\n        }\n    }\n\n    private void migratePerspectives() {\n        this.migratePerspectives(pluginsFS, perspectivesFS);\n    }\n\n    private void migrateNavigation() {\n        this.migrateNavigation(pluginsFS, navigationFS);\n    }\n\n    public void migrateDatasets(FileSystem sourceFS, FileSystem targetFS) {\n        LOGGER.info(\"attempt to migrate datasets\");\n        migrate(sourceFS,\n                targetFS,\n                path -> !path.getFileName().toString().equals(\"readme.md\"));\n    }\n\n    public void migratePerspectives(FileSystem sourceFS, FileSystem targetFS) {\n        LOGGER.info(\"attempt to migrate perspectives\");\n        migrate(sourceFS,\n                targetFS,\n                path -> path.getFileName().toString().startsWith(\"perspective_layout\"));\n    }\n\n    public void migrateNavigation(FileSystem sourceFS, FileSystem targetFS) {\n        LOGGER.info(\"attempt to migrate navigation\");\n        migrate(sourceFS,\n                targetFS,\n                path -> path.getFileName().toString().equals(\"navtree.json\"));\n    }\n\n    private void migrate(FileSystem sourceFS, FileSystem targetFS, Predicate<Path> predicate) {\n        Path sourceRoot = getRoot(sourceFS);\n        Path targetRoot = getRoot(targetFS);\n\n        if (sourceRoot == null) {\n            LOGGER.info(\"source does not exists\");\n            return;\n        }\n\n        if (targetRoot == null) {\n            LOGGER.error(\"target does not exists\");\n            return;\n        }\n\n        LOGGER.info(\"moving from \" + sourceFS.getName() + \" to \" + targetFS.getName());\n\n        Files.walkFileTree(sourceRoot, new SimpleFileVisitor<Path>() {\n            @Override\n            public FileVisitResult visitFile(final Path path, final BasicFileAttributes attrs) {\n                checkNotNull(\"file\", path);\n                checkNotNull(\"attrs\", attrs);\n\n                Path targetPath = targetRoot.resolve(path.toString());\n\n                if (!predicate.test(path)) {\n                    LOGGER.debug(\"skip file \" + path.toString());\n                } else if (ioService.exists(targetPath)) {\n                    LOGGER.debug(\"file \" + path.toString() + \" already exists on target\");\n                    Files.delete(path);\n                } else {\n                    LOGGER.debug(\"moving file \" + path.toString());\n                    Files.copy(path, targetPath);\n                    Files.delete(path);\n                }\n\n                return FileVisitResult.CONTINUE;\n            }\n        });\n    }\n\n    private Path getRoot(FileSystem fileSystem) {\n        try {\n            return fileSystem.getRootDirectories().iterator().next();\n        } catch (Exception e) {\n            LOGGER.debug(\"could not get filesystem root\", e);\n            return null;\n        }\n    }\n\n    protected void runWithLock(Command command) {\n        String lockName = \"data-migration.lock\";\n        String markerName = \"data-migration.done\";\n\n        TimeUnit lastAccessTimeUnit = TimeUnit.SECONDS;\n        int lastAccessThreshold = 1;\n\n        // get .niogit/dashbuilder path\n        File dir = navigationFS.getPath(\"/\")\n                .toFile()\n                .getParentFile();\n\n        File marker = new File(dir, markerName);\n\n        FileSystemLock lock = FileSystemLockManager\n                .getInstance()\n                .getFileSystemLock(\n                        dir,\n                        lockName,\n                        lastAccessTimeUnit,\n                        lastAccessThreshold);\n\n        try {\n            lock.lock();\n\n            if (!marker.exists()) {\n                marker.createNewFile();\n                command.execute();\n            }\n        } catch (java.io.IOException e) {\n            LOGGER.error(e.getMessage(), e);\n        } finally {\n            lock.unlock();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/renderer/service/RendererSettingsServiceImpl.java",
    "content": "package org.dashbuilder.renderer.service;\n\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class RendererSettingsServiceImpl implements RendererSettingsService {\n\n    private RendererSettings settings;\n    \n    @PostConstruct\n    public void loadSettings() {\n        String defaultRenderer = System.getProperty(DEFAULT_RENDERER_PROPERTY, \"\");\n        String offlineStr = System.getProperty(OFFLINE_RENDERER_PROPERTY, \"false\");\n        boolean offline=  Boolean.parseBoolean(offlineStr);\n        settings = new RendererSettings(defaultRenderer, offline);\n    }\n    \n    @Override\n    public RendererSettings getSettings() {\n        return settings;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/transfer/DataTransferServicesImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.io.BufferedWriter;\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.FileWriter;\nimport java.net.URI;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\nimport java.util.zip.ZipOutputStream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.http.client.utils.URIBuilder;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.navigation.storage.NavTreeStorage;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.type.TypeConverterUtil;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.dashbuilder.dataset.DataSetDefRegistryCDI.DATASET_EXT;\nimport static org.uberfire.ext.plugin.model.Plugin.FILE_EXT;\n\n@Service\n@ApplicationScoped\npublic class DataTransferServicesImpl implements DataTransferServices {\n\n    public static final String VERSION = \"1.0.0\";\n    private static final Logger LOGGER = LoggerFactory.getLogger(DataTransferServicesImpl.class);\n    private IOService ioService;\n    private FileSystem datasetsFS;\n    private FileSystem perspectivesFS;\n    private FileSystem navigationFS;\n    private FileSystem systemFS;\n    private DataSetDefRegistryCDI dataSetDefRegistryCDI;\n    private SessionInfo sessionInfo;\n    private Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent;\n    private Event<PluginAdded> pluginAddedEvent;\n    private Event<NavTreeChangedEvent> navTreeChangedEvent;\n    private NavTreeStorage navTreeStorage;\n    private byte[] buffer = new byte[1024];\n    private ComponentLoader externalComponentLoader;\n    private LayoutComponentHelper layoutComponentsHelper;\n\n    private String dashbuilderLocation;\n    private String exportDir;\n    private boolean shareOpenModel;\n\n    public DataTransferServicesImpl() {\n        // empty constructor\n    }\n\n    @Inject\n    public DataTransferServicesImpl(\n                                    final @Named(\"ioStrategy\") IOService ioService,\n                                    final @Named(\"datasetsFS\") FileSystem datasetsFS,\n                                    final @Named(\"perspectivesFS\") FileSystem perspectivesFS,\n                                    final @Named(\"navigationFS\") FileSystem navigationFS,\n                                    final @Named(\"systemFS\") FileSystem systemFS,\n                                    final DataSetDefRegistryCDI dataSetDefRegistryCDI,\n                                    final SessionInfo sessionInfo,\n                                    final Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent,\n                                    final Event<PluginAdded> pluginAddedEvent,\n                                    final Event<NavTreeChangedEvent> navTreeChangedEvent,\n                                    final NavTreeStorage navTreeStorage,\n                                    final ComponentLoader externalComponentLoader,\n                                    final LayoutComponentHelper layoutComponentsHelper) {\n\n        this.ioService = ioService;\n        this.datasetsFS = datasetsFS;\n        this.perspectivesFS = perspectivesFS;\n        this.navigationFS = navigationFS;\n        this.systemFS = systemFS;\n        this.dataSetDefRegistryCDI = dataSetDefRegistryCDI;\n        this.sessionInfo = sessionInfo;\n        this.dataSetDefRegisteredEvent = dataSetDefRegisteredEvent;\n        this.pluginAddedEvent = pluginAddedEvent;\n        this.navTreeChangedEvent = navTreeChangedEvent;\n        this.navTreeStorage = navTreeStorage;\n        this.externalComponentLoader = externalComponentLoader;\n        this.layoutComponentsHelper = layoutComponentsHelper;\n    }\n\n    @PostConstruct\n    public void init() {\n        dashbuilderLocation = System.getProperty(DB_STANDALONE_LOCATION_PROP);\n        exportDir = System.getProperty(EXPORT_LOCATION_PROP);\n\n        String shareOpenModelStr = System.getProperty(SHARE_OPEN_MODEL_PROP, Boolean.FALSE.toString());\n        shareOpenModel = Boolean.parseBoolean(shareOpenModelStr);\n    }\n\n    @Override\n    public String doExport(DataTransferExportModel exportModel) throws java.io.IOException {\n        String zipLocation = new StringBuilder().append(System.getProperty(\"java.io.tmpdir\"))\n                                                .append(File.separator)\n                                                .append(FILE_PATH)\n                                                .append(File.separator)\n                                                .append(EXPORT_FILE_NAME)\n                                                .toString()\n                                                .replace(\"\\\\\", \"/\");\n\n        Predicate<Path> readmeFilter = p -> p.toString().toLowerCase().endsWith(\"readme.md\");\n        Predicate<Path> datasetsFilter = def -> true;\n        Predicate<Path> pagesFilter = page -> true;\n        boolean exportNavigation = true;\n\n        if (!exportModel.isExportAll()) {\n            datasetsFilter = filterDatasets(exportModel.getDatasetDefinitions());\n            pagesFilter = filterPages(exportModel.getPages());\n            exportNavigation = exportModel.isExportNavigation();\n        }\n\n        new File(zipLocation).getParentFile().mkdirs();\n        FileOutputStream fos = new FileOutputStream(zipLocation);\n        ZipOutputStream zos = new ZipOutputStream(fos);\n\n        zipFileSystem(datasetsFS, zos, readmeFilter.or(datasetsFilter));\n        zipFileSystem(perspectivesFS, zos, readmeFilter.or(pagesFilter));\n\n        if (exportNavigation) {\n            zipFileSystem(navigationFS, zos, p -> true);\n        } else {\n            zipFileSystem(navigationFS, zos, readmeFilter);\n        }\n\n        if (externalComponentLoader.isExternalComponentsEnabled()) {\n            String componentsPath = externalComponentLoader.getExternalComponentsDir();\n\n            if (componentsPath != null && exists(componentsPath)) {\n                Path componentsBasePath = Paths.get(new StringBuilder().append(SpacesAPI.Scheme.FILE)\n                                                                       .append(\"://\")\n                                                                       .append(componentsPath)\n                                                                       .toString());\n                Predicate<String> pagesComponentsFilter = page -> exportModel.isExportAll() || exportModel.getPages().contains(page);\n                layoutComponentsHelper.findComponentsInTemplates(pagesComponentsFilter)\n                                        .stream()\n                                      .map(c -> componentsBasePath.resolve(c))\n                                      .filter(Files::exists)\n                                      .forEach(c -> {\n                                          Path componentPath = componentsBasePath.resolve(c);\n                                          zipComponentFiles(componentsBasePath,\n                                                            componentPath,\n                                                            zos,\n                                                            p -> true);\n                                      });\n            }\n        }\n\n        zipFile(createVersionFile(), \"VERSION\", zos);\n\n        zos.close();\n        fos.close();\n\n        moveZipToFileSystem(zipLocation, systemFS);\n\n        return new StringBuilder().append(SpacesAPI.Scheme.GIT)\n                                  .append(\"://\")\n                                  .append(systemFS.getName())\n                                  .append(File.separator)\n                                  .append(FILE_PATH)\n                                  .append(File.separator)\n                                  .append(EXPORT_FILE_NAME)\n                                  .toString()\n                                  .replace(\"\\\\\", \"/\");\n    }\n\n    @Override\n    public List<String> doImport() throws Exception {\n        List<String> imported = new ArrayList<>();\n\n        Path root = Paths.get(URI.create(new StringBuilder().append(SpacesAPI.Scheme.GIT)\n                                                            .append(\"://\")\n                                                            .append(systemFS.getName())\n                                                            .append(File.separator)\n                                                            .toString()\n                                                            .replace(\"\\\\\", \"/\")));\n\n        String expectedPath = new StringBuilder().append(File.separator)\n                                                 .append(FILE_PATH)\n                                                 .append(File.separator)\n                                                 .append(IMPORT_FILE_NAME)\n                                                 .toString()\n                                                 .replace(\"\\\\\", \"/\");\n\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) {\n                if (!path.toString().equalsIgnoreCase(expectedPath)) {\n                    return FileVisitResult.CONTINUE;\n                }\n\n                try {\n                    imported.addAll(importFiles(path));\n                    return FileVisitResult.TERMINATE;\n\n                } catch (Exception e) {\n                    LOGGER.error(e.getMessage(), e);\n                    return FileVisitResult.TERMINATE;\n                }\n            }\n        });\n\n        ioService.deleteIfExists(root.resolve(expectedPath));\n\n        return imported;\n    }\n\n    @Override\n    public ExportInfo exportInfo() {\n        List<String> pages = listPaths(perspectivesFS,\n                                       p -> p.endsWith(FILE_EXT)).stream()\n                                                                 .map(p -> p.getName(p.getNameCount() - 2))\n                                                                 .map(Object::toString)\n                                                                 .collect(Collectors.toList());\n\n        List<DataSetDef> datasetsDefs = listPaths(datasetsFS,\n                                                  p -> p.endsWith(DATASET_EXT)).stream()\n                                                                               .map(this::getDataSetFileContent)\n                                                                               .map(this::parseDataSetDefinition)\n                                                                               .filter(DataSetDef::isPublic)\n                                                                               .collect(Collectors.toList());\n        return new ExportInfo(datasetsDefs, pages, isExternalServerConfigured());\n    }\n\n    @Override\n    public String generateExportUrl(DataTransferExportModel exportModel) throws Exception {\n        if (!isExternalServerConfigured()) {\n            throw new RuntimeException(\"External Server is not configured.\");\n        }\n        try {\n            String path = this.doExport(exportModel);\n            String prefix = shareOpenModel ? \"business-central\" : sessionInfo.getIdentity().getIdentifier();\n            String fileName = prefix + \"-dashboard-latest\";\n            String destination = new StringBuilder().append(exportDir)\n                                                    .append(File.separator)\n                                                    .append(fileName)\n                                                    .append(\".zip\")\n                                                    .toString();\n            FileUtils.deleteQuietly(new File(destination));\n            copyFileContents(Paths.get(path).toFile(), destination);\n            return new URIBuilder(dashbuilderLocation).addParameter(\"import\", fileName).toString();\n        } catch (Exception e) {\n            LOGGER.error(\"Error generating model link.\", e);\n            throw new RuntimeException(\"Error generating model link.\", e);\n        }\n\n    }\n\n    private boolean isExternalServerConfigured() {\n        return exportDir != null && dashbuilderLocation != null;\n    }\n\n    private List<String> importFiles(Path path) throws Exception {\n        String tmpDir = System.getProperty(\"java.io.tmpdir\");\n        if (tmpDir.lastIndexOf('/') == tmpDir.length() - 1 || tmpDir.lastIndexOf('\\\\') == tmpDir.length() - 1) {\n            tmpDir = tmpDir.substring(0, tmpDir.length() - 1);\n        }\n\n        String tempPath = new StringBuilder().append(tmpDir)\n                                             .append(File.separator)\n                                             .append(FILE_PATH)\n                                             .append(File.separator)\n                                             .toString().replace(\"\\\\\", \"/\");\n\n        List<String> imported = new ArrayList<>();\n        File destDir = new File(tempPath);\n\n        try (ZipInputStream zis = new ZipInputStream(new FileInputStream(path.toFile()))) {\n\n            ZipEntry zipEntry;\n\n            while ((zipEntry = zis.getNextEntry()) != null) {\n                if (zipEntry.isDirectory()) {\n                    continue;\n                }\n                File newFile = unzipFile(destDir, zipEntry, zis);\n                FileSystem fileSystem = getImportFileSystem(newFile, tempPath);\n\n                if (fileSystem != null) {\n                    String newFilePath = importFSFile(fileSystem.getName(), newFile, tempPath);\n                    imported.add(new StringBuilder().append(fileSystem.getName())\n                                                    .append(newFilePath)\n                                                    .toString());\n                }\n\n                if (isComponent(zipEntry) &&\n                    externalComponentLoader.getExternalComponentsDir() != null &&\n                    externalComponentLoader.isExternalComponentsEnabled()) {\n                    try {\n                        importComponentFile(zipEntry.getName(), newFile);\n                        imported.add(zipEntry.getName());\n                    } catch (Exception e) {\n                        LOGGER.error(\"Error importing component file {}\", zipEntry.getName());\n                        LOGGER.debug(\"Component file import error.\", e);\n                    }\n                }\n\n            }\n        }\n\n        FileUtils.deleteDirectory(destDir);\n\n        return imported;\n    }\n\n    private boolean isComponent(ZipEntry zipEntry) {\n        return zipEntry.getName() != null && zipEntry.getName().startsWith(COMPONENTS_EXPORT_PATH);\n    }\n\n    private String importComponentFile(String entryName, File newFile) {\n        String externalComponentsDir = externalComponentLoader.getExternalComponentsDir();\n        externalComponentsDir = externalComponentsDir.endsWith(File.separator) ? externalComponentsDir : externalComponentsDir + \"/\";\n        String newFileName = externalComponentsDir + entryName.replaceAll(COMPONENTS_EXPORT_PATH, \"\");\n        copyFileContents(newFile, newFileName);\n        return newFileName;\n    }\n\n    private void copyFileContents(File originFile, String newFileName) {\n        File target = new File(newFileName);\n        target.getParentFile().mkdirs();\n        if (!target.exists()) {\n            ioService.copy(Paths.get(originFile.toURI()), Paths.get(target.toURI()));\n        }\n    }\n\n    private String importFSFile(String fsName, File newFile, String workingDir) throws Exception {\n        URI uri = URI.create(new StringBuilder().append(SpacesAPI.Scheme.GIT)\n                                                .append(\"://\")\n                                                .append(fsName)\n                                                .toString()\n                                                .replace(\"\\\\\", \"/\"));\n\n        String newFilePath = newFile.toPath()\n                                    .toString()\n                                    .replace(\"\\\\\", \"/\")\n                                    .replace(new StringBuilder(workingDir).append(fsName),\n                                             \"\");\n\n        ioService.write(Paths.get(uri).resolve(newFilePath),\n                        java.nio.file.Files.readAllBytes(newFile.toPath()));\n\n        fireEvent(newFile, workingDir, uri, newFilePath);\n        return newFilePath;\n\n    }\n\n    private void fireEvent(File newFile, String tempPath, URI uri, String newFilePath) {\n        String filePath = newFile.toURI().toString();\n\n        if (filePath.contains(tempPath + datasetsFS.getName()) && newFilePath.endsWith(DATASET_EXT)) {\n            fireDatasetEvent(uri, newFilePath);\n\n        } else if (filePath.contains(tempPath + perspectivesFS.getName()) && newFilePath.endsWith(FILE_EXT)) {\n            firePerspectiveEvent(newFile, uri, newFilePath);\n\n        } else if (filePath.contains(tempPath + navigationFS.getName()) && newFilePath.endsWith(NavTreeStorage.NAV_TREE_FILE_NAME)) {\n            fireNavigationEvent();\n        }\n    }\n\n    private void fireDatasetEvent(URI uri, String newFilePath) {\n        try {\n            String json = ioService.readAllString(Paths.get(uri).resolve(newFilePath));\n            DataSetDef newDef = dataSetDefRegistryCDI.getDataSetDefJsonMarshaller().fromJson(json);\n            dataSetDefRegisteredEvent.fire(new DataSetDefRegisteredEvent(newDef));\n\n        } catch (Exception e) {\n            LOGGER.error(e.getMessage(), e);\n        }\n    }\n\n    private void firePerspectiveEvent(File newFile, URI uri, String newFilePath) {\n        org.uberfire.backend.vfs.Path pluginPath =\n                org.uberfire.backend.server.util.Paths.convert(\n                                                               Paths.get(uri).resolve(newFilePath));\n\n        Plugin plugin = new Plugin(\n                                   newFile.toPath().getParent().getFileName().toString(),\n                                   TypeConverterUtil.fromPath(pluginPath),\n                                   pluginPath);\n\n        pluginAddedEvent.fire(new PluginAdded(plugin, sessionInfo));\n    }\n\n    private void fireNavigationEvent() {\n        navTreeChangedEvent.fire(\n                                 new NavTreeChangedEvent(\n                                                         navTreeStorage.loadNavTree()));\n    }\n\n    private FileSystem getImportFileSystem(File file, String tempPath) {\n        List<FileSystem> fileSystems = Arrays.asList(datasetsFS, perspectivesFS, navigationFS);\n        String filePath = file.toURI().toString().replace(\"\\\\\", \"/\");\n\n        return fileSystems.stream()\n                          .filter(fs -> filePath.contains(tempPath + fs.getName()))\n                          .findFirst()\n                          .orElse(null);\n    }\n\n    private void moveZipToFileSystem(String zipLocation, FileSystem fileSystem) {\n        String sourceLocation = new StringBuilder()\n                                                   .append(SpacesAPI.Scheme.FILE)\n                                                   .append(\":///\")\n                                                   .append(zipLocation)\n                                                   .toString();\n\n        Path source = Paths.get(URI.create(sourceLocation));\n\n        Path target = Paths.get(URI.create(new StringBuilder().append(SpacesAPI.Scheme.GIT)\n                                                              .append(\"://\")\n                                                              .append(fileSystem.getName())\n                                                              .append(File.separator)\n                                                              .append(FILE_PATH)\n                                                              .append(File.separator)\n                                                              .append(EXPORT_FILE_NAME)\n                                                              .toString()\n                                                              .replace(\"\\\\\", \"/\")));\n\n        ioService.write(target, Files.readAllBytes(source));\n\n        Files.delete(source);\n    }\n\n    private File unzipFile(File destinationDir, ZipEntry zipEntry, ZipInputStream zis) throws java.io.IOException {\n        File destFile = new File(destinationDir, zipEntry.getName());\n        if (!destFile.exists()) {\n            destFile.getParentFile().mkdirs();\n            if (!destFile.createNewFile()) {\n                throw new IOException(\"could not create file \" + destFile.getPath());\n            }\n        }\n\n        try (FileOutputStream fos = new FileOutputStream(destFile)) {\n            int len;\n            while ((len = zis.read(buffer)) > 0) {\n                fos.write(buffer, 0, len);\n            }\n        }\n\n        return destFile;\n    }\n\n    private void zipFileSystem(FileSystem fs, ZipOutputStream zos, Predicate<Path> pathTest) {\n        Path root = fs.getRootDirectories().iterator().next();\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) {\n                try {\n                    if (pathTest.test(path)) {\n                        String location = fs.getName() + path.toString();\n                        zipFile(path.toFile(), location, zos);\n                    }\n                    return FileVisitResult.CONTINUE;\n\n                } catch (Exception e) {\n                    LOGGER.error(e.getMessage(), e);\n                    return FileVisitResult.TERMINATE;\n                }\n            }\n        });\n    }\n\n    private void zipComponentFiles(Path componentsRoot, Path componentRoot, ZipOutputStream zos, Predicate<Path> pathTest) {\n        Files.walkFileTree(componentRoot, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) {\n                try {\n                    if (pathTest.test(path)) {\n                        File file = path.toFile();\n                        Path relativePath = componentsRoot.relativize(path);\n                        String location = COMPONENTS_EXPORT_PATH + relativePath.toString();\n                        zipFile(file, location, zos);\n                    }\n                    return FileVisitResult.CONTINUE;\n\n                } catch (Exception e) {\n                    LOGGER.error(e.getMessage(), e);\n                    return FileVisitResult.TERMINATE;\n                }\n            }\n        });\n    }\n\n    private void zipFile(File file, String path, ZipOutputStream zos) throws java.io.IOException {\n        try (FileInputStream fis = new FileInputStream(file)) {\n            ZipEntry zipEntry = new ZipEntry(path);\n            zos.putNextEntry(zipEntry);\n\n            int length;\n            while ((length = fis.read(buffer)) >= 0) {\n                zos.write(buffer, 0, length);\n            }\n\n            zos.closeEntry();\n        }\n    }\n\n    private File createVersionFile() throws java.io.IOException {\n        File version = File.createTempFile(\"temp\", \"version\");\n\n        try (BufferedWriter out = new BufferedWriter(new FileWriter(version))) {\n            out.write(VERSION);\n        }\n\n        return version;\n    }\n\n    private List<Path> listPaths(FileSystem fs, Predicate<String> pathTester) {\n        List<Path> files = new ArrayList<>();\n        Path root = fs.getRootDirectories().iterator().next();\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(Path path, BasicFileAttributes attrs) {\n                try {\n                    if (pathTester.test(path.toString())) {\n                        files.add(path);\n                    }\n                    return FileVisitResult.CONTINUE;\n\n                } catch (Exception e) {\n                    LOGGER.error(e.getMessage(), e);\n                    return FileVisitResult.TERMINATE;\n                }\n            }\n        });\n        return files;\n    }\n\n    private String getDataSetFileContent(Path path) {\n        return Files.readAllLines(path, StandardCharsets.UTF_8).stream().collect(Collectors.joining());\n    }\n\n    private DataSetDef parseDataSetDefinition(String defJson) {\n        try {\n            return dataSetDefRegistryCDI.getDataSetDefJsonMarshaller().fromJson(defJson);\n        } catch (Exception e) {\n            LOGGER.error(\"Error parsing dataset definition\", e);\n            LOGGER.debug(\"Json Definition: {}\", defJson);\n            throw new IllegalArgumentException(e);\n        }\n    }\n\n    private Predicate<Path> filterPages(List<String> pages) {\n        return page -> {\n            if (pages.isEmpty()) {\n                return false;\n            }\n            int nameCount = page.getNameCount();\n            if (nameCount > 1) {\n                return pages.stream()\n                            .anyMatch(p -> page.getName(nameCount - 2).toString().equals(p));\n            }\n            return false;\n        };\n    }\n\n    private Predicate<Path> filterDatasets(List<DataSetDef> datasets) {\n        return dsPath -> {\n            if (datasets.isEmpty()) {\n                return false;\n            }\n            int nameCount = dsPath.getNameCount();\n            if (nameCount > 1) {\n                String fileName = dsPath.getName(nameCount - 1)\n                                        .toString()\n                                        .split(\"\\\\.\")[0];\n                return datasets.stream()\n                               .anyMatch(ds -> ds.getUUID().equals(fileName));\n            }\n            return false;\n        };\n    }\n\n    private boolean exists(String file) {\n        return java.nio.file.Files.exists(java.nio.file.Paths.get(file));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/transfer/ExportModelValidationServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.navigation.service.PerspectivePluginServices;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class ExportModelValidationServiceImpl implements ExportModelValidationService {\n\n    PerspectivePluginServices perspectivePluginServices;\n\n    DisplayerSettingsJSONMarshaller marshaller;\n\n    public ExportModelValidationServiceImpl() {}\n\n    @Inject\n    public ExportModelValidationServiceImpl(PerspectivePluginServices perspectivePluginServices) {\n        this(perspectivePluginServices, DisplayerSettingsJSONMarshaller.get());\n    }\n\n    ExportModelValidationServiceImpl(PerspectivePluginServices perspectivePluginServices,\n                                     DisplayerSettingsJSONMarshaller marshaller) {\n        this.perspectivePluginServices = perspectivePluginServices;\n        this.marshaller = marshaller;\n    }\n\n    @Override\n    public Map<String, List<String>> checkMissingDatasets(DataTransferExportModel exportModel) {\n        if (exportModel == null || exportModel.getPages().isEmpty()) {\n            return Collections.emptyMap();\n        }\n        Map<String, List<String>> deps = exportModel.getPages()\n                                                    .stream()\n                                                    .collect(Collectors.toMap(p -> p,\n                                                                              p -> datasetsUsedInPage(p, exportModel)));\n\n        deps.entrySet().removeIf(e -> e.getValue().isEmpty());\n        return deps;\n    }\n\n    private List<String> datasetsUsedInPage(String p, DataTransferExportModel exportModel) {\n        List<DataSetDef> exportedDefs = exportModel.getDatasetDefinitions();\n        return allDataSetsFromPage(p).filter(uuid -> isDataSetMissing(uuid, exportedDefs))\n                                     .distinct()\n                                     .collect(Collectors.toList());\n    }\n\n    private boolean isDataSetMissing(String uuid, List<DataSetDef> exportedDefs) {\n        return exportedDefs.isEmpty() || exportedDefs.stream().noneMatch(ds -> ds.getUUID().equals(uuid));\n    }\n\n    private Stream<String> allDataSetsFromPage(String p) {\n        return perspectivePluginServices.getLayoutTemplate(p)\n                                        .getRows().stream()\n                                        .flatMap(r -> r.getLayoutColumns().stream())\n                                        .flatMap(cl -> cl.getLayoutComponents().stream())\n                                        .map(lc -> lc.getProperties().get(\"json\"))\n                                        .filter(Objects::nonNull)\n                                        .map(marshaller::fromJsonString)\n                                        .map(DisplayerSettings::getDataSetLookup)\n                                        .filter(Objects::nonNull)\n                                        .map(DataSetLookup::getDataSetUUID)\n                                        .filter(Objects::nonNull);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/transfer/LayoutComponentHelper.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n@ApplicationScoped\npublic class LayoutComponentHelper {\n\n    @Inject\n    private PerspectiveServices perspectiveServices;\n\n    public List<String> findComponentsInTemplates(Predicate<String> pageFilter) {\n        return perspectiveServices.listLayoutTemplates()\n                                  .stream()\n                                  .filter(lt -> pageFilter.test(lt.getName()))\n                                  .map(LayoutTemplate::getRows)\n                                  .flatMap(this::allComponentsStream)\n                                  .map(lt -> lt.getProperties().get(ExternalComponent.COMPONENT_ID_KEY))\n                                  .filter(Objects::nonNull)\n                                  .collect(Collectors.toList());\n    }\n\n    private Stream<LayoutComponent> allComponentsStream(List<LayoutRow> row) {\n        return row.stream()\n                  .flatMap(r -> r.getLayoutColumns().stream())\n                  .flatMap(cl -> Stream.concat(cl.getLayoutComponents().stream(),\n                                               allComponentsStream(cl.getRows())));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/java/org/dashbuilder/transfer/rest/DataTransferResource.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer.rest;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.Response;\n\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.dashbuilder.transfer.DataTransferServices;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Paths;\n\n@ApplicationScoped\n@Path(\"dashbuilder\")\npublic class DataTransferResource {\n\n    Logger logger = LoggerFactory.getLogger(DataTransferResource.class);\n\n    @Inject\n    private DataTransferServices dataTransferServices;\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @GET\n    @Path(\"export\")\n    @Produces(\"application/zip\")\n    public Response export() {\n        try {\n            String exportFile = dataTransferServices.doExport(DataTransferExportModel.exportAll());\n            org.uberfire.java.nio.file.Path path = Paths.get(exportFile);\n            return Response.ok(ioService.readAllBytes(path)).build();\n        } catch (Exception e) {\n            String errorMessage = \"Error creating export: \" + e.getMessage();\n            logger.error(errorMessage);\n            logger.debug(\"Not able to create export.\", e);\n            return Response.serverError()\n                           .entity(errorMessage)\n                           .build();\n        }\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/dataset/service/DataSetExportServicesTest.java",
    "content": "package org.dashbuilder.dataset.service;\n\nimport org.apache.poi.xssf.streaming.SXSSFRow;\nimport org.apache.poi.xssf.streaming.SXSSFWorkbook;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetManagerCDI;\nimport org.dashbuilder.exception.ExceptionManager;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetExportServicesTest {\n\n    private static final String JAVA_AWT_HEADLESS_PROPERTY = \"java.awt.headless\";\n    private static String originalJavaAwtHeadless;\n\n    @Mock\n    DataSetManagerCDI dataSetManagerM;\n    @Mock\n    DataSetDefRegistryCDI gitStorageM;\n    @Mock\n    ExceptionManager exceptionManagerM;\n\n    @BeforeClass\n    public static void setUp() {\n        /*\n         * Make the test run in headless mode. It used to fail frequently on Jenkins (40 failures in 6 months) with\n         * the following stack trace (abridged):\n         *\n         * java.awt.AWTError: Can't connect to X11 window server using ':93' as the value of the DISPLAY variable.\n         *   at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)\n         *   at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)\n         *   at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)\n         *   at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)\n         *   at java.lang.Class.forName0(Native Method)\n         *   at java.lang.Class.forName(Class.java:264)\n         *   at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)\n         *   at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)\n         *   at sun.awt.X11FontManager.isHeadless(X11FontManager.java:509)\n         *   at sun.awt.X11FontManager.getFontPath(X11FontManager.java:786)\n         *   at sun.font.SunFontManager.getPlatformFontPath(SunFontManager.java:3282)\n         *   at sun.font.SunFontManager$10.run(SunFontManager.java:3308)\n         *   at sun.font.SunFontManager.loadFonts(SunFontManager.java:3304)\n         *   at sun.awt.X11FontManager.loadFonts(X11FontManager.java:460)\n         *   at sun.font.SunFontManager.findFont2D(SunFontManager.java:2348)\n         *   at java.awt.Font.getFont2D(Font.java:500)\n         *   at java.awt.Font.canDisplayUpTo(Font.java:2060)\n         *   at java.awt.font.TextLayout.singleFont(TextLayout.java:470)\n         *   at java.awt.font.TextLayout.<init>(TextLayout.java:531)\n         *   at org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(SheetUtil.java:275)\n         *   at org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(AutoSizeColumnTracker.java:117)\n         *   at org.apache.poi.xssf.streaming.SXSSFSheet.<init>(SXSSFSheet.java:82)\n         *   at org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(SXSSFWorkbook.java:658)\n         *   at org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(SXSSFWorkbook.java:679)\n         *   at org.dashbuilder.dataset.service.DataSetExportServicesImpl.dataSetToWorkbook(DataSetExportServicesImpl.java:194)\n         *   at org.dashbuilder.dataset.service.DataSetExportServicesTest.exportToExcelWorksWhenDataSetHasNulls(DataSetExportServicesTest.java:41)\n         *\n         * To reproduce locally, use -Djava.awt.headless and set DISPLAY to a non-existent display number, e.g. :12345.\n         *\n         * Headless mode doesn't seem to affect the SXSSFWorkbook behavior. SheetUtil.getDefaultCharWidth() returns 0 in\n         * both modes.\n         */\n        originalJavaAwtHeadless = System.getProperty(JAVA_AWT_HEADLESS_PROPERTY);\n        System.setProperty(JAVA_AWT_HEADLESS_PROPERTY, \"true\");\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        if (originalJavaAwtHeadless == null) {\n            System.clearProperty(JAVA_AWT_HEADLESS_PROPERTY);\n        } else {\n            System.setProperty(JAVA_AWT_HEADLESS_PROPERTY, originalJavaAwtHeadless);\n        }\n    }\n\n    @Test\n    public void exportToExcelWorksWhenDataSetHasNulls() {\n        DataSetExportServicesImpl exporter = new DataSetExportServicesImpl(dataSetManagerM,\n                                                                           gitStorageM,\n                                                                           exceptionManagerM);\n\n        DataSet dataSetWithNulls = DataSetFactory.newDataSetBuilder()\n                .date(\"Date of birth\")\n                .number(\"Age\")\n                .text(\"Description\")\n                .row(null,\n                     null,\n                     null).buildDataSet();\n\n        SXSSFWorkbook workbook = exporter.dataSetToWorkbook(dataSetWithNulls);\n        assertNotNull(\"Export of dataset containing null should succeed\",\n                      workbook);\n\n        // Verify header\n        SXSSFRow firstRow = workbook.getSheetAt(0).getRow(0);\n        assertEquals(\"Date of birth\", firstRow.getCell(0).getStringCellValue());\n        assertEquals(\"Age\", firstRow.getCell(1).getStringCellValue());\n        assertEquals(\"Description\", firstRow.getCell(2).getStringCellValue());\n\n        // Verify data row\n        SXSSFRow secondRow = workbook.getSheetAt(0).getRow(1);\n        assertEquals(\"\", secondRow.getCell(0).getStringCellValue());\n        assertEquals(\"\", secondRow.getCell(1).getStringCellValue());\n        assertEquals(\"\", secondRow.getCell(2).getStringCellValue());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/migration/DashbuilderDataMigrationTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.migration;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DashbuilderDataMigrationTest {\n\n    private DashbuilderDataMigration dashbuilderDataMigration;\n    private IOService ioService;\n    private FileSystem sourceFS;\n    private FileSystem targetFS;\n\n    @Before\n    public void setup() {\n        ioService = new IOServiceDotFileImpl();\n\n        sourceFS = createFileSystem();\n        targetFS = createFileSystem();\n\n        dashbuilderDataMigration = spy(\n                new DashbuilderDataMigration(\n                        ioService,\n                        null,\n                        null,\n                        null,\n                        null));\n    }\n\n    @Test\n    public void testMigrateNull() {\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migrateDatasets(null, null);\n        dashbuilderDataMigration.migratePerspectives(null, null);\n        dashbuilderDataMigration.migrateNavigation(null, null);\n\n        dashbuilderDataMigration.migrateDatasets(sourceFS, null);\n        checkInitialCondition();\n        dashbuilderDataMigration.migrateDatasets(null, targetFS);\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migratePerspectives(sourceFS, null);\n        checkInitialCondition();\n        dashbuilderDataMigration.migratePerspectives(null, targetFS);\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migrateNavigation(sourceFS, null);\n        checkInitialCondition();\n        dashbuilderDataMigration.migrateNavigation(null, targetFS);\n        checkInitialCondition();\n    }\n\n    @Test\n    public void testGitIsDefaultFileSystem() {\n        doNothing().when(dashbuilderDataMigration).runWithLock(any());\n        doReturn(true).when(dashbuilderDataMigration).isMigrationEnabled();\n        dashbuilderDataMigration.init();\n        verify(dashbuilderDataMigration, times(1)).runWithLock(any());\n    }\n\n    @Test\n    public void testGitIsNotDefaultFileSystem() {\n\n\n        doReturn(false).when(dashbuilderDataMigration).isMigrationEnabled();\n        dashbuilderDataMigration.init();\n        verify(dashbuilderDataMigration, never()).runWithLock(any());\n    }\n\n    @Test\n    public void testMigrateEmpty() {\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migrateDatasets(sourceFS, targetFS);\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migratePerspectives(sourceFS, targetFS);\n        checkInitialCondition();\n\n        dashbuilderDataMigration.migrateNavigation(sourceFS, targetFS);\n        checkInitialCondition();\n    }\n\n    @Test\n    public void testMigrateDatasets() {\n        checkInitialCondition();\n\n        createFiles(sourceFS);\n\n        dashbuilderDataMigration.migrateDatasets(sourceFS, targetFS);\n\n        List<String> sourceFiles = getFiles(sourceFS);\n        List<String> targetFiles = getFiles(targetFS);\n\n        assertEquals(1, sourceFiles.size());\n        assertEquals(8, targetFiles.size());\n        assertEquals(new ArrayList<String>() {{\n            add(\"/readme.md\");\n        }}, sourceFiles);\n        assertEquals(new ArrayList<String>() {{\n            add(\"/bbb.txt\");\n            add(\"/dataset1.csv\");\n            add(\"/definitions/dataset2.dset\");\n            add(\"/navtree.json\");\n            add(\"/page-abc/perspective_layout.json\");\n            add(\"/perspective_layout2.txt\");\n            add(\"/perspective_layouts/aaa.txt\");\n            add(\"/readme.md\");\n        }}, targetFiles);\n    }\n\n    @Test\n    public void testMigratePerspectives() {\n        checkInitialCondition();\n\n        createFiles(sourceFS);\n\n        dashbuilderDataMigration.migratePerspectives(sourceFS, targetFS);\n\n        List<String> sourceFiles = getFiles(sourceFS);\n        List<String> targetFiles = getFiles(targetFS);\n\n        assertEquals(6, sourceFiles.size());\n        assertEquals(3, targetFiles.size());\n        assertEquals(new ArrayList<String>() {{\n            add(\"/bbb.txt\");\n            add(\"/dataset1.csv\");\n            add(\"/definitions/dataset2.dset\");\n            add(\"/navtree.json\");\n            add(\"/perspective_layouts/aaa.txt\");\n            add(\"/readme.md\");\n        }}, sourceFiles);\n        assertEquals(new ArrayList<String>() {{\n            add(\"/page-abc/perspective_layout.json\");\n            add(\"/perspective_layout2.txt\");\n            add(\"/readme.md\");\n        }}, targetFiles);\n    }\n\n    @Test\n    public void testMigrateNavigation() {\n        checkInitialCondition();\n\n        createFiles(sourceFS);\n\n        dashbuilderDataMigration.migrateNavigation(sourceFS, targetFS);\n\n        List<String> sourceFiles = getFiles(sourceFS);\n        List<String> targetFiles = getFiles(targetFS);\n\n        assertEquals(7, sourceFiles.size());\n        assertEquals(2, targetFiles.size());\n        assertEquals(new ArrayList<String>() {{\n            add(\"/bbb.txt\");\n            add(\"/dataset1.csv\");\n            add(\"/definitions/dataset2.dset\");\n            add(\"/page-abc/perspective_layout.json\");\n            add(\"/perspective_layout2.txt\");\n            add(\"/perspective_layouts/aaa.txt\");\n            add(\"/readme.md\");\n        }}, sourceFiles);\n        assertEquals(new ArrayList<String>() {{\n            add(\"/navtree.json\");\n            add(\"/readme.md\");\n        }}, targetFiles);\n    }\n\n    private void checkInitialCondition() {\n        List<String> sourceFiles = getFiles(sourceFS);\n        List<String> targetFiles = getFiles(targetFS);\n\n        assertEquals(1, sourceFiles.size());\n        assertEquals(1, targetFiles.size());\n        assertEquals(new ArrayList<String>() {{\n            add(\"/readme.md\");\n        }}, sourceFiles);\n        assertEquals(new ArrayList<String>() {{\n            add(\"/readme.md\");\n        }}, targetFiles);\n    }\n\n    private List<String> getFiles(FileSystem fs) {\n        List<String> files = new ArrayList<>();\n        Path root = fs.getRootDirectories().iterator().next();\n\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n            @Override\n            public FileVisitResult visitFile(final Path path, final BasicFileAttributes attrs) throws IOException {\n                files.add(path.toString());\n                return FileVisitResult.CONTINUE;\n            }\n        });\n\n        return files;\n    }\n\n    private void createFiles(FileSystem fs) {\n        Path path = fs.getRootDirectories().iterator().next();\n        ioService.write(path.resolve(\"dataset1.csv\"), \"test\");\n        ioService.write(path.resolve(\"definitions\").resolve(\"dataset2.dset\"), \"test\");\n        ioService.write(path.resolve(\"navtree.json\"), \"test\");\n        ioService.write(path.resolve(\"perspective_layouts\").resolve(\"aaa.txt\"), \"test\");\n        ioService.write(path.resolve(\"bbb.txt\"), \"test\");\n        ioService.write(path.resolve(\"page-abc\").resolve(\"perspective_layout.json\"), \"test\");\n        ioService.write(path.resolve(\"perspective_layout2.txt\"), \"test\");\n    }\n\n    private FileSystem createFileSystem() {\n        return ioService.newFileSystem(\n                URI.create(\"git://migration/temp\" + new Date().getTime()),\n                new HashMap<String, Object>() {{\n                    put(\"init\", Boolean.TRUE);\n                }});\n    }\n\n    @After\n    public void cleanup() {\n        for (FileSystemMetadata fsm : ioService.getFileSystemMetadata()) {\n            URI uri = URI.create(fsm.getUri());\n            if (uri.getScheme().equals(\"git\")) {\n                JGitFileSystem fs = (JGitFileSystem) ioService.getFileSystem(uri);\n                fs.getGit().getRepository().getDirectory().delete();\n                deleteFileSystem(fs);\n            }\n        }\n    }\n\n    private void deleteFileSystem(FileSystem fs) {\n        try {\n            FileUtils.deleteDirectory(\n                    ((JGitFileSystem) fs).getGit()\n                            .getRepository()\n                            .getDirectory()\n                            .getAbsoluteFile()\n                            .getParentFile());\n        } catch (java.io.IOException e) {\n            e.printStackTrace();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/renderer/service/RendererSettingsServiceTest.java",
    "content": "package org.dashbuilder.renderer.service;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.junit.Test;\n\npublic class RendererSettingsServiceTest {\n    \n    private static final String SOME_UUID = \"SOME_UUID\";\n\n    @Test\n    public void propertiesLoadTest() {\n        RendererSettingsServiceImpl serviceImpl = new RendererSettingsServiceImpl();\n        System.setProperty(RendererSettingsService.DEFAULT_RENDERER_PROPERTY, SOME_UUID);\n        System.setProperty(RendererSettingsService.OFFLINE_RENDERER_PROPERTY, \"not valid property\");\n        serviceImpl.loadSettings();\n        RendererSettings settings = serviceImpl.getSettings();\n        assertEquals(settings.getDefaultRenderer(), SOME_UUID);\n        assertTrue(!settings.isOffline());\n        \n        System.setProperty(RendererSettingsService.DEFAULT_RENDERER_PROPERTY, \"\");\n        System.setProperty(RendererSettingsService.OFFLINE_RENDERER_PROPERTY, \"true\");\n        serviceImpl.loadSettings();\n        settings = serviceImpl.getSettings();\n        assertTrue(settings.getDefaultRenderer().isEmpty());\n        assertTrue(settings.isOffline());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/transfer/DataTransferServicesTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\nimport java.net.URI;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataset.DataSetDefRegistryCDI;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.navigation.storage.NavTreeStorage;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.lesscss.deps.org.apache.commons.io.FileUtils;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static java.util.Arrays.asList;\nimport static org.dashbuilder.transfer.DataTransferServices.COMPONENTS_EXPORT_PATH;\nimport static org.junit.Assert.assertArrayEquals;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DataTransferServicesTest {\n\n    private IOService ioService;\n    private FileSystem datasetsFS;\n    private FileSystem perspectivesFS;\n    private FileSystem navigationFS;\n    private FileSystem systemFS;\n    private DataTransferServices dataTransferServices;\n\n    @Mock\n    private DataSetDefRegistryCDI dataSetDefRegistryCDI;\n    @Mock\n    private Event<DataSetDefRegisteredEvent> dataSetDefRegisteredEvent;\n    @Mock\n    private Event<PluginAdded> pluginAddedEvent;\n    @Mock\n    SessionInfo sessionInfo;\n    @Mock\n    private Event<NavTreeChangedEvent> navTreeChangedEvent;\n    @Mock\n    private NavTreeStorage navTreeStorage;\n    @Mock\n    DataSetDefJSONMarshaller dataSetDefJSONMarshaller;\n    @Mock\n    ComponentLoader externalComponentLoader;\n    @Mock\n    LayoutComponentHelper layoutComponentsHelper;\n\n    Path componentsDir;\n    \n    @Before\n    public void setup() {\n        ioService = new IOServiceDotFileImpl();\n        componentsDir = Files.createTempDirectory(\"dashbuilder-components\");\n\n        datasetsFS = createFileSystem(\"datasets\");\n        perspectivesFS = createFileSystem(\"perspectives\");\n        navigationFS = createFileSystem(\"navigation\");\n        systemFS = createFileSystem(\"system\");\n\n        when(dataSetDefRegistryCDI.getDataSetDefJsonMarshaller()).thenReturn(dataSetDefJSONMarshaller);\n        when(externalComponentLoader.getExternalComponentsDir()).thenReturn(componentsDir.toString());\n        when(externalComponentLoader.isExternalComponentsEnabled()).thenReturn(true);\n\n        dataTransferServices = new DataTransferServicesImpl(ioService,\n                                                            datasetsFS,\n                                                            perspectivesFS,\n                                                            navigationFS,\n                                                            systemFS,\n                                                            dataSetDefRegistryCDI,\n                                                            sessionInfo,\n                                                            dataSetDefRegisteredEvent,\n                                                            pluginAddedEvent,\n                                                            navTreeChangedEvent,\n                                                            navTreeStorage,\n                                                            externalComponentLoader,\n                                                            layoutComponentsHelper);\n    }\n\n    @After\n    public void cleanFileSystems() {\n        cleanFileSystem(datasetsFS);\n        cleanFileSystem(perspectivesFS);\n        cleanFileSystem(navigationFS);\n        cleanFileSystem(systemFS);\n        \n        FileUtils.deleteQuietly(componentsDir.toFile());\n    }\n\n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportEmptyFileSystems() throws Exception {\n        String exportPath = dataTransferServices.doExport(DataTransferExportModel.exportAll());\n\n        assertTrue(exportPath.equals(getExpectedExportFileSystemPath()));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(getExpectedExportFilePath());\n                        add(\"/readme.md\");\n                    }}, getFiles(systemFS));\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n    }\n\n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportNotEmptyFileSystems() throws Exception {\n        createFile(datasetsFS, \"definitions/dataset1.csv\", \"Test 1\");\n        createFile(datasetsFS, \"definitions/dataset1.dset\", \"Test ABC\");\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"Test Page 1\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"Test Page 1 Plugin\");\n        createFile(navigationFS, \"navtree.json\", \"{ }\");\n\n        String exportPath = dataTransferServices.doExport(DataTransferExportModel.exportAll());\n\n        assertTrue(exportPath.equals(getExpectedExportFileSystemPath()));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(getExpectedExportFilePath());\n                        add(\"/readme.md\");\n                    }}, getFiles(systemFS));\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/definitions/dataset1.csv\");\n                        add(datasetsFS.getName() + \"/definitions/dataset1.dset\");\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/navtree.json\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportFilteringDataSets() throws Exception {\n        createFile(datasetsFS, \"definitions/dataset1.csv\", \"\");\n        createFile(datasetsFS, \"definitions/dataset1.dset\", \"\");\n        createFile(datasetsFS, \"definitions/dataset2.dset\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n        createFile(navigationFS, \"navtree.json\", \"\");\n        \n        DataSetDef def = mock(DataSetDef.class);\n        when(def.getUUID()).thenReturn(\"dataset1\");\n        DataTransferExportModel model = new DataTransferExportModel(Arrays.asList(def), \n                                                                    Arrays.asList(\"page1\", \"page2\"), \n                                                                    true);\n\n        String exportPath = dataTransferServices.doExport(model);\n\n        assertTrue(exportPath.equals(getExpectedExportFileSystemPath()));\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/definitions/dataset1.csv\");\n                        add(datasetsFS.getName() + \"/definitions/dataset1.dset\");\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/navtree.json\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n        cleanFileSystems();\n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportFilteringPages() throws Exception {\n        createFile(datasetsFS, \"definitions/dataset.csv\", \"\");\n        createFile(datasetsFS, \"definitions/dataset.dset\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n        createFile(perspectivesFS, \"page2/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page2/perspective_layout.plugin\", \"\");\n        createFile(navigationFS, \"navtree.json\", \"\");\n        \n        DataSetDef def = mock(DataSetDef.class);\n        when(def.getUUID()).thenReturn(\"dataset\");\n        DataTransferExportModel model = new DataTransferExportModel(Arrays.asList(def), \n                                                                    Arrays.asList(\"page2\"), \n                                                                    true);\n\n        String exportPath = dataTransferServices.doExport(model);\n\n        assertTrue(exportPath.equals(getExpectedExportFileSystemPath()));\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/definitions/dataset.csv\");\n                        add(datasetsFS.getName() + \"/definitions/dataset.dset\");\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page2/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page2/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/navtree.json\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n        cleanFileSystems();\n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportWithoutNavigation() throws Exception {\n        createFile(datasetsFS, \"definitions/dataset.csv\", \"\");\n        createFile(datasetsFS, \"definitions/dataset.dset\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n        createFile(navigationFS, \"navtree.json\", \"\");\n        \n        DataSetDef def = mock(DataSetDef.class);\n        when(def.getUUID()).thenReturn(\"dataset\");\n        DataTransferExportModel model = new DataTransferExportModel(Arrays.asList(def), \n                                                                    Arrays.asList(\"page1\"), \n                                                                    false);\n\n        String exportPath = dataTransferServices.doExport(model);\n\n        assertTrue(exportPath.equals(getExpectedExportFileSystemPath()));\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/definitions/dataset.csv\");\n                        add(datasetsFS.getName() + \"/definitions/dataset.dset\");\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n        cleanFileSystems();\n    }\n    \n    @Test\n    public void testDoExportWithComponents() throws Exception {\n        when(layoutComponentsHelper.findComponentsInTemplates((any()))).thenReturn(asList(\"c1\"));\n\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n        \n        createComponentFile(\"c1\", \"manifest.json\", \"manifest\");\n        createComponentFile(\"c1\", \"index.html\", \"html\");\n        createComponentFile(\"c1\", \"css/style.css\", \"style\");\n        createComponentFile(\"c1\", \"js/index.js\", \"js\");\n        \n        // lost file in component Dir that should be ignored\n        createComponentFile(\"lost\", \"lostfile\", \"ignore-me-import\");\n        \n        // Other component that is not used so it should not be exported\n        createComponentFile(\"c2\", \"manifest.json\", \"manifest\");\n        createComponentFile(\"c2\", \"index.html\", \"html\");\n        createComponentFile(\"c2\", \"css/style.css\", \"style\");\n        createComponentFile(\"c2\", \"js/index.js\", \"js\");\n        \n        \n        dataTransferServices.doExport(DataTransferExportModel.exportAll());\n\n        ZipInputStream zis = getZipInputStream();\n\n        String[] expectedFiles = {\n                                  datasetsFS.getName() + \"/readme.md\",\n                                  perspectivesFS.getName() + \"/page1/perspective_layout\",\n                                  perspectivesFS.getName() + \"/page1/perspective_layout.plugin\",\n                                  perspectivesFS.getName() + \"/readme.md\",\n                                  navigationFS.getName() + \"/readme.md\",\n                                  COMPONENTS_EXPORT_PATH + \"c1/js/index.js\",\n                                  COMPONENTS_EXPORT_PATH + \"c1/css/style.css\",\n                                  COMPONENTS_EXPORT_PATH + \"c1/index.html\",\n                                  COMPONENTS_EXPORT_PATH + \"c1/manifest.json\",\n                                  \"VERSION\"\n                              };\n        Object[] actualList = getFiles(zis).toArray();\n        Arrays.sort(expectedFiles);\n        Arrays.sort(actualList);\n        assertArrayEquals(expectedFiles, actualList);\n        \n        cleanFileSystems();\n        \n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportIgnoringComponents() throws Exception {\n        when(externalComponentLoader.isExternalComponentsEnabled()).thenReturn(false);\n        when(externalComponentLoader.loadExternal()).thenReturn(asList(component(\"c1\")));\n        \n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n        \n        createComponentFile(\"c1\", \"manifest.json\", \"manifest\");\n        createComponentFile(\"c1\", \"index.html\", \"html\");\n        createComponentFile(\"c1\", \"css/style.css\", \"style\");\n        createComponentFile(\"c1\", \"js/index.js\", \"js\");\n                \n        dataTransferServices.doExport(DataTransferExportModel.exportAll());\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n        \n        cleanFileSystems();\n        \n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoExportWhenComponentsDirIsNotPresent() throws Exception {\n        createFile(perspectivesFS, \"page1/perspective_layout\", \"\");\n        createFile(perspectivesFS, \"page1/perspective_layout.plugin\", \"\");\n\n        FileUtils.deleteQuietly(componentsDir.toFile());\n        \n        dataTransferServices.doExport(DataTransferExportModel.exportAll());\n\n        ZipInputStream zis = getZipInputStream();\n\n        assertEquals(new ArrayList<String>() {{\n                        add(datasetsFS.getName() + \"/readme.md\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout\");\n                        add(perspectivesFS.getName() + \"/page1/perspective_layout.plugin\");\n                        add(perspectivesFS.getName() + \"/readme.md\");\n                        add(navigationFS.getName() + \"/readme.md\");\n                        add(\"VERSION\");\n                    }}, getFiles(zis));\n        \n        cleanFileSystems();        \n    }\n    \n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoImportNoZip() throws Exception {\n        List<String> filesImported = dataTransferServices.doImport();\n\n        assertEquals(new ArrayList<String>(), filesImported);\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(datasetsFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(perspectivesFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(navigationFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\"); \n                    }}, getFiles(systemFS));\n\n        verify(dataSetDefRegisteredEvent, times(0)).fire(any());\n        verify(pluginAddedEvent, times(0)).fire(any());\n        verify(navTreeChangedEvent, times(0)).fire(any());\n    }\n\n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoImportEmptyZip() throws Exception {\n        moveZipToFileSystem(\"/empty.zip\");\n\n        List<String> filesImported = dataTransferServices.doImport();\n\n        assertEquals(new ArrayList<String>(), filesImported);\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(datasetsFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(perspectivesFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(navigationFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(systemFS));\n\n        verify(dataSetDefRegisteredEvent, times(0)).fire(any());\n        verify(pluginAddedEvent, times(0)).fire(any());\n        verify(navTreeChangedEvent, times(0)).fire(any());\n    }\n\n    @Test\n    @SuppressWarnings(\"serial\")\n    public void testDoImportNotEmptyZip() throws Exception {\n        moveZipToFileSystem(\"/import.zip\");\n\n        List<String> filesImported = dataTransferServices.doImport();\n        \n        assertEquals(new ArrayList<String>() {{\n                        add(\"dashbuilder/datasets/readme.md\");\n                        add(\"dashbuilder/datasets/definitions/eb241039-1792-4d08-9596-b6c8d27dfe6b.csv\");\n                        add(\"dashbuilder/datasets/definitions/d1b24449-fe90-40d4-8cd7-f175b498c0bb.dset\");\n                        add(\"dashbuilder/datasets/definitions/8060a7f1-ef03-4ce9-a0a8-266301e79ff6.dset\");\n                        add(\"dashbuilder/datasets/definitions/eb241039-1792-4d08-9596-b6c8d27dfe6b.dset\");\n                        add(\"dashbuilder/datasets/definitions/7e68d20d-6807-4b86-8737-1d429afe9dbc.csv\");\n                        add(\"dashbuilder/datasets/definitions/d1b24449-fe90-40d4-8cd7-f175b498c0bb.csv\");\n                        add(\"dashbuilder/datasets/definitions/8060a7f1-ef03-4ce9-a0a8-266301e79ff6.csv\");\n                        add(\"dashbuilder/datasets/definitions/7e68d20d-6807-4b86-8737-1d429afe9dbc.dset\");\n                        add(\"dashbuilder/components/c2/manifest.json\");\n                        add(\"dashbuilder/components/c2/styles/level/styles.css\");\n                        add(\"dashbuilder/components/c2/index.html\");\n                        add(\"dashbuilder/components/c1/manifest.json\");\n                        add(\"dashbuilder/components/c1/images/db_logo.png\");\n                        add(\"dashbuilder/components/c1/scripts/index.js\");\n                        add(\"dashbuilder/components/c1/index.html\");\n                        add(\"dashbuilder/perspectives/page3/perspective_layout\");\n                        add(\"dashbuilder/perspectives/page3/perspective_layout.plugin\");\n                        add(\"dashbuilder/perspectives/readme.md\");\n                        add(\"dashbuilder/perspectives/page4/perspective_layout\");\n                        add(\"dashbuilder/perspectives/page4/perspective_layout.plugin\");\n                        add(\"dashbuilder/perspectives/page2/perspective_layout\");\n                        add(\"dashbuilder/perspectives/page2/perspective_layout.plugin\");\n                        add(\"dashbuilder/perspectives/page1/perspective_layout\");\n                        add(\"dashbuilder/perspectives/page1/perspective_layout.plugin\");\n                        add(\"dashbuilder/navigation/readme.md\");\n                        add(\"dashbuilder/navigation/navigation/navtree.json\");\n                    }}, filesImported);\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/definitions/7e68d20d-6807-4b86-8737-1d429afe9dbc.csv\");\n                        add(\"/definitions/7e68d20d-6807-4b86-8737-1d429afe9dbc.dset\");\n                        add(\"/definitions/8060a7f1-ef03-4ce9-a0a8-266301e79ff6.csv\");\n                        add(\"/definitions/8060a7f1-ef03-4ce9-a0a8-266301e79ff6.dset\");\n                        add(\"/definitions/d1b24449-fe90-40d4-8cd7-f175b498c0bb.csv\");\n                        add(\"/definitions/d1b24449-fe90-40d4-8cd7-f175b498c0bb.dset\");\n                        add(\"/definitions/eb241039-1792-4d08-9596-b6c8d27dfe6b.csv\");\n                        add(\"/definitions/eb241039-1792-4d08-9596-b6c8d27dfe6b.dset\");\n                        add(\"/readme.md\");\n                    }}, getFiles(datasetsFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/page1/perspective_layout\");\n                        add(\"/page1/perspective_layout.plugin\");\n                        add(\"/page2/perspective_layout\");\n                        add(\"/page2/perspective_layout.plugin\");\n                        add(\"/page3/perspective_layout\");\n                        add(\"/page3/perspective_layout.plugin\");\n                        add(\"/page4/perspective_layout\");\n                        add(\"/page4/perspective_layout.plugin\");\n                        add(\"/readme.md\");\n                    }}, getFiles(perspectivesFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/navigation/navtree.json\");\n                        add(\"/readme.md\");\n                    }}, getFiles(navigationFS));\n\n        assertEquals(new ArrayList<String>() {{\n                        add(\"/readme.md\");\n                    }}, getFiles(systemFS));\n        \n        List<String> expectedComponents = new ArrayList<String>() {{\n            add(\"c1/index.html\");\n            add(\"c1/scripts/index.js\");\n            add(\"c1/images/db_logo.png\");\n            add(\"c1/manifest.json\");\n            add(\"c2/index.html\");\n            add(\"c2/styles/level/styles.css\");\n            add(\"c2/manifest.json\");\n        }};\n        expectedComponents.removeAll(getFiles(componentsDir));\n        assertTrue(expectedComponents.isEmpty());\n\n        verify(dataSetDefRegisteredEvent, times(4)).fire(any());\n        verify(pluginAddedEvent, times(4)).fire(any());\n        verify(navTreeChangedEvent, times(1)).fire(any());\n    }\n\n    @Test\n    public void testAssetsToImport() throws Exception {\n        final String PAGE_ID = \"page\";\n        final String DS_CSV = \"ds.csv\";\n        final String DS = \"ds.dset\";\n        final String DS_CONTENT = \"TEST_CONTENT\";\n        final String DS_NAME = \"test_dataset\";\n        final String PAGE = PAGE_ID + \"/perspective_layout\";\n        final String PAGE_PLUGIN = PAGE_ID + \"/perspective_layout.plugin\";\n        \n        DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.isPublic()).thenReturn(true);\n        when(dataSetDef.getName()).thenReturn(DS_NAME);\n        when(dataSetDefJSONMarshaller.fromJson(DS_CONTENT)).thenReturn(dataSetDef);\n\n        createFile(datasetsFS, DS, DS_CONTENT);\n        createFile(datasetsFS, DS_CSV, \"\");\n        createFile(perspectivesFS, PAGE, \"\");\n        createFile(perspectivesFS, PAGE_PLUGIN, \"\");\n\n        ExportInfo exportInfo = dataTransferServices.exportInfo();\n\n        assertEquals(1, exportInfo.getDatasetsDefinitions().size());\n        assertEquals(DS_NAME, exportInfo.getDatasetsDefinitions().get(0).getName());\n        assertEquals(1, exportInfo.getPages().size());\n        assertEquals(PAGE_ID, exportInfo.getPages().get(0));\n        \n        cleanFileSystems();\n    }\n    \n    @Test\n    public void testAssetsToImportNoFiles() {\n        ExportInfo assetsToExport = dataTransferServices.exportInfo();\n        assertTrue(assetsToExport.getDatasetsDefinitions().isEmpty());\n        assertTrue(assetsToExport.getPages().isEmpty());\n    }\n\n    @SuppressWarnings(\"serial\")\n    private FileSystem createFileSystem(String name) {\n        String path = new StringBuilder().append(\"git://dashbuilder\")\n                                         .append(File.separator)\n                                         .append(name)\n                                         .toString();\n\n        try {\n            return ioService.newFileSystem(URI.create(path),\n                                           new HashMap<String, Object>() {{\n                                                   put(\"init\", Boolean.TRUE);\n                                               }});\n\n        } catch (Exception e) {\n            return ioService.getFileSystem(URI.create(path));\n        }\n    }\n    \n    @Test\n    public void testShouldNotExposePrivateDS() throws Exception {\n        final String DS = \"ds.dset\";\n        final String DS_CONTENT = \"TEST_CONTENT\";\n        final String DS_NAME = \"test_dataset\";\n        \n        DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.isPublic()).thenReturn(false);\n        when(dataSetDef.getName()).thenReturn(DS_NAME);\n        when(dataSetDefJSONMarshaller.fromJson(DS_CONTENT)).thenReturn(dataSetDef);\n\n        createFile(datasetsFS, DS, DS_CONTENT);\n\n        ExportInfo assetsToExport = dataTransferServices.exportInfo();\n\n        assertTrue(assetsToExport.getDatasetsDefinitions().isEmpty());\n        \n        cleanFileSystems();\n    }\n\n    private Path createFile(FileSystem fs, String filename, String data) {\n        Path path = fs.getRootDirectories().iterator().next();\n        Path filePath = path.resolve(filename);\n        ioService.write(filePath, data);\n        return filePath;\n    }\n    \n    private Path createComponentFile(String componentId, String filename, String data) {\n        Path componentPath = componentsDir.resolve(componentId);\n        Path componentFile = componentPath.resolve(filename);\n        componentFile.getParent().toFile().mkdirs();\n        ioService.write(componentFile, data);\n        return componentFile;\n    }\n    \n    private List<String> getFiles(Path root) {\n        List<String> files = new ArrayList<>();\n\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(final Path path, final BasicFileAttributes attrs) throws IOException {\n                files.add(path.toString().replaceAll(componentsDir.toString() + \"/\", \"\"));\n                return FileVisitResult.CONTINUE;\n            }\n        });\n\n        return files;\n    }\n\n    private List<String> getFiles(FileSystem fs) {\n        List<String> files = new ArrayList<>();\n        Path root = fs.getRootDirectories().iterator().next();\n\n        Files.walkFileTree(root, new SimpleFileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult visitFile(final Path path, final BasicFileAttributes attrs) throws IOException {\n                files.add(path.toString());\n                return FileVisitResult.CONTINUE;\n            }\n        });\n\n        return files;\n    }\n\n    private List<String> getFiles(ZipInputStream zis) {\n        List<String> files = new ArrayList<>();\n        ZipEntry entry = null;\n\n        try {\n            while ((entry = zis.getNextEntry()) != null) {\n                files.add(entry.getName());\n            }\n\n        } catch (Exception e) {\n            e.printStackTrace();\n        }\n\n        return files;\n    }\n\n    private String getExpectedExportFilePath() {\n        return new StringBuilder().append(File.separator)\n                                  .append(DataTransferServices.FILE_PATH)\n                                  .append(File.separator)\n                                  .append(DataTransferServices.EXPORT_FILE_NAME)\n                                  .toString();\n    }\n\n    private String getExpectedImportFilePath() {\n        return new StringBuilder().append(File.separator)\n                                  .append(DataTransferServices.FILE_PATH)\n                                  .append(File.separator)\n                                  .append(DataTransferServices.IMPORT_FILE_NAME)\n                                  .toString();\n    }\n\n    private String getExpectedExportFileSystemPath() {\n        return new StringBuilder().append(\"git://\")\n                                  .append(systemFS.getName())\n                                  .append(getExpectedExportFilePath())\n                                  .toString();\n    }\n\n    private void moveZipToFileSystem(String path) {\n        URL url = DataTransferServicesTest.class.getResource(path);\n\n        String sourceLocation = new StringBuilder().append(SpacesAPI.Scheme.FILE)\n                                                   .append(\"://\")\n                                                   .append(url.toString())\n                                                   .toString();\n\n        Path source = Paths.get(URI.create(sourceLocation));\n\n        Path target = systemFS.getRootDirectories()\n                              .iterator()\n                              .next()\n                              .resolve(DataTransferServices.FILE_PATH)\n                              .resolve(DataTransferServices.IMPORT_FILE_NAME);\n\n        ioService.write(target, Files.readAllBytes(source));\n    }\n\n    private void cleanFileSystem(FileSystem fs) {\n        for (String file : getFiles(fs)) {\n            if (file.endsWith(\"readme.md\")) {\n                continue;\n            }\n\n            String path = new StringBuilder().append(\"git://\")\n                                             .append(fs.getName())\n                                             .append(file)\n                                             .toString();\n\n            ioService.delete(Paths.get(URI.create(path)));\n        }\n    }\n\n    private ZipInputStream getZipInputStream() {\n        Path path = Paths.get(URI.create(new StringBuilder().append(\"git://\")\n                                                            .append(systemFS.getName())\n                                                            .append(getExpectedExportFilePath())\n                                                            .toString()));\n        return new ZipInputStream(new ByteArrayInputStream(ioService.readAllBytes(path)));\n    }\n    \n    \n    public ExternalComponent component(String id) {\n        return new ExternalComponent(id, id, \"\", false, Collections.emptyList());\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/transfer/ExportModelValidationServiceImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.navigation.service.PerspectivePluginServices;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExportModelValidationServiceImplTest {\n\n    ExportModelValidationServiceImpl dataTransferExportValidator;\n\n    @Mock\n    PerspectivePluginServices perspectivePluginServices;\n\n    @Mock\n    DisplayerSettingsJSONMarshaller marshaller;\n\n    @Before\n    public void init() {\n        dataTransferExportValidator = new ExportModelValidationServiceImpl(perspectivePluginServices, marshaller);\n    }\n\n    @Test\n    public void testTryingToExportPageWithMissingDataSet() {\n        String page1 = \"page1\";\n        String ds1 = \"ds1\";\n        String json1 = \"json1\";\n\n        DisplayerSettings ds = registerDSMock(ds1);\n        when(marshaller.fromJsonString(json1)).thenReturn(ds);\n        \n        LayoutTemplate ltForPage1 = createTemplate(json1);\n        \n        when(perspectivePluginServices.getLayoutTemplate(page1)).thenReturn(ltForPage1);\n        \n        DataTransferExportModel model = new DataTransferExportModel(Collections.emptyList(),\n                                                                    Arrays.asList(page1),\n                                                                    true);\n\n        Map<String, List<String>> missingDataSets = dataTransferExportValidator.checkMissingDatasets(model);\n        \n        assertTrue(missingDataSets.containsKey(page1));\n        \n        assertEquals(ds1, missingDataSets.get(page1).get(0));\n    }\n    \n    @Test\n    public void testSuccessExportWithAllDatasets() {\n        String page1 = \"page1\";\n        String ds1 = \"ds1\";\n        String json1 = \"json1\";\n\n        DataSetDef def = mock(DataSetDef.class);\n        when(def.getUUID()).thenReturn(ds1);\n        \n        DisplayerSettings ds = registerDSMock(ds1);\n        when(marshaller.fromJsonString(json1)).thenReturn(ds);\n        \n        LayoutTemplate ltForPage1 = createTemplate(json1);\n        \n        when(perspectivePluginServices.getLayoutTemplate(page1)).thenReturn(ltForPage1);\n        \n        DataTransferExportModel model = new DataTransferExportModel(Arrays.asList(def),\n                                                                    Arrays.asList(page1),\n                                                                    true);\n\n        Map<String, List<String>> missingDataSets = dataTransferExportValidator.checkMissingDatasets(model);\n        \n        assertTrue(missingDataSets.isEmpty());\n        assertFalse(missingDataSets.containsKey(page1));\n    }\n\n    private DisplayerSettings registerDSMock(String ds1) {\n        DataSetLookup lookup = mock(DataSetLookup.class);\n        when(lookup.getDataSetUUID()).thenReturn(ds1);\n        \n        DisplayerSettings ds = mock(DisplayerSettings.class);\n        when(ds.getDataSetLookup()).thenReturn(lookup);\n        \n        return ds;\n    }\n\n    public LayoutTemplate createTemplate(String...jsonValues) {\n        LayoutRow r1 = new LayoutRow();\n\n        LayoutColumn lc1r1 = new LayoutColumn(\"\");\n        LayoutComponent cplc1r1 = new LayoutComponent();\n        lc1r1.add(cplc1r1);\n\n        LayoutColumn lc2r1 = new LayoutColumn(\"\");\n        LayoutComponent cplc2r1 = new LayoutComponent();\n        lc2r1.add(cplc2r1);\n\n        r1.add(lc1r1);\n        r1.add(lc2r1);\n\n        List<LayoutRow> createdRows = new ArrayList<>();\n\n        for (String jsonValue : jsonValues) {\n            LayoutRow row = new LayoutRow();\n\n            LayoutColumn lc1r = new LayoutColumn(\"\");\n            LayoutComponent cp1lc1r = new LayoutComponent();\n            lc1r.add(cp1lc1r);\n\n            LayoutColumn lc2r = new LayoutColumn(\"\");\n            LayoutComponent lc2lc2r = new LayoutComponent();\n            lc2lc2r.addProperty(\"json\", jsonValue);\n            lc2r.add(lc2lc2r);\n            row.add(lc1r);\n            row.add(lc2r);\n            createdRows.add(row);\n        }\n\n        LayoutTemplate lt = new LayoutTemplate(\"\");\n        lt.addRow(r1);\n        createdRows.forEach(lt::addRow);\n\n        return lt;\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/transfer/LayoutComponentHelperTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static java.util.Collections.singletonList;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutComponentHelperTest {\n\n    @Mock\n    PerspectiveServices perspectiveServices;\n\n    @InjectMocks\n    LayoutComponentHelper layoutComponentsHelper;\n\n    @Test\n    public void testComponentId() {\n        String c1 = \"c1\";\n        String c2 = \"c2\";\n        LayoutTemplate lt = createLayoutTemplate(\"lt\", c1, c2);\n        when(perspectiveServices.listLayoutTemplates()).thenReturn(singletonList(lt));\n\n        List<String> components = layoutComponentsHelper.findComponentsInTemplates(p -> true);\n\n        assertEquals(2, components.size());\n        assertEquals(components, Arrays.asList(c1, c2));\n    }\n\n    public void testNoComponentId() {\n        LayoutTemplate lt = createLayoutTemplate(\"lt\");\n        when(perspectiveServices.listLayoutTemplates()).thenReturn(singletonList(lt));\n\n        List<String> components = layoutComponentsHelper.findComponentsInTemplates(p -> true);\n\n        assertTrue(components.isEmpty());\n    }\n\n    public void testPageFilter() {\n        String c1 = \"c1\";\n        LayoutTemplate lt = createLayoutTemplate(\"lt\", c1);\n        when(perspectiveServices.listLayoutTemplates()).thenReturn(singletonList(lt));\n\n        List<String> components = layoutComponentsHelper.findComponentsInTemplates(p -> false);\n\n        assertTrue(components.isEmpty());\n    }\n\n    private LayoutTemplate createLayoutTemplate(String name, String... componentIds) {\n        LayoutTemplate lt = new LayoutTemplate(name);\n        LayoutRow lr = new LayoutRow();\n        LayoutColumn lc = new LayoutColumn(\"\");\n\n        lr.add(lc);\n        lt.addRow(lr);\n        for (String componentId : componentIds) {\n            LayoutComponent lComp = new LayoutComponent();\n            lComp.addProperty(ExternalComponent.COMPONENT_ID_KEY, componentId);\n            lc.add(lComp);\n        }\n        return lt;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/java/org/dashbuilder/transfer/rest/DataTransferResourceTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer.rest;\n\nimport java.io.IOException;\n\nimport javax.ws.rs.core.Response;\n\nimport org.dashbuilder.transfer.DataTransferServices;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataTransferResourceTest {\n\n    @Mock\n    private DataTransferServices dataTransferServices;\n\n    @Mock\n    private IOService ioService;\n\n    @InjectMocks\n    DataTransferResource dataTransferResource;\n\n    @Test\n    public void testSuccessExport() throws IOException {\n        when(dataTransferServices.doExport(any())).thenReturn(\"file://.\");\n        Response response = dataTransferResource.export();\n        assertEquals(Response.Status.OK.getStatusCode(),\n                     response.getStatus());\n    }\n\n    @Test\n    public void testBadExport() throws IOException {\n        when(dataTransferServices.doExport(any())).thenThrow(new IOException());\n        Response response = dataTransferResource.export();\n        assertEquals(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(),\n                     response.getStatus());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/dashbuilder-services/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\n"
  },
  {
    "path": "dashbuilder/dashbuilder-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-backend</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Backend</name>\n\n  <modules>\n    <module>dashbuilder-dataset-cdi</module>\n    <module>dashbuilder-navigation-backend</module>\n    <module>dashbuilder-services</module>\n    <module>dashbuilder-kie-server-backend</module>\n    <module>dashbuilder-external-backend</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-cms-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder CMS Client</name>\n  <description>Dashbuilder Content Manager System Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <!-- UberFire -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-simple-docks-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>      \n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/ContentManagerEntryPoint.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/ContentManagerConstants.properties\")\npublic class ContentManagerEntryPoint {\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/layout/editor/PerspectiveDragComponent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.layout.editor;\n\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.cms.widget.PerspectiveWidget;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorCoreComponent;\nimport org.uberfire.ext.plugin.model.Plugin;\n\nimport static org.dashbuilder.navigation.layout.NavDragComponentSettings.PERSPECTIVE_ID;\n\n/**\n * Runtime perspective drag component.\n */\n@Dependent\npublic class PerspectiveDragComponent implements PerspectiveEditorCoreComponent,\n                                                 HasModalConfiguration {\n\n    PerspectiveDragConfigModal perspectiveDragConfigModal;\n    PerspectiveWidget perspectiveWidget;\n\n    @Inject\n    public PerspectiveDragComponent(PerspectiveDragConfigModal perspectiveDragConfigModal, PerspectiveWidget perspectiveWidget) {\n        this.perspectiveDragConfigModal = perspectiveDragConfigModal;\n        this.perspectiveWidget = perspectiveWidget;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return ContentManagerConstants.INSTANCE.perspectiveDragComponent();\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-file-o\";\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return getShowWidget(ctx);\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        Map<String, String> properties = ctx.getComponent().getProperties();\n        String perspectiveId = properties.get(PERSPECTIVE_ID);\n        perspectiveWidget.showPerspective(perspectiveId);\n        return perspectiveWidget;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        Map<String, String> properties = ctx.getComponentProperties();\n        String perspectiveId = properties.get(PERSPECTIVE_ID);\n        perspectiveDragConfigModal.setOnOk(() -> perspectiveSelectionOk(ctx));\n        perspectiveDragConfigModal.setOnCancel(() -> perspectiveSelectionCancel(ctx));\n        perspectiveDragConfigModal.show(perspectiveId);\n        return ((PerspectiveDragConfigModalView) perspectiveDragConfigModal.getView()).getModal();\n    }\n\n    protected void perspectiveSelectionOk(ModalConfigurationContext ctx) {\n        Plugin perspective = perspectiveDragConfigModal.getSelectedItem();\n        ctx.setComponentProperty(PERSPECTIVE_ID, perspective.getName());\n        ctx.configurationFinished();\n    }\n\n    protected void perspectiveSelectionCancel(ModalConfigurationContext ctx) {\n        ctx.configurationCancelled();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/layout/editor/PerspectiveDragConfigModal.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n@Dependent\npublic class PerspectiveDragConfigModal implements IsWidget {\n\n    public interface View extends UberView<PerspectiveDragConfigModal> {\n\n        void clearItems();\n\n        void addItem(String name, Command onSelect);\n\n        void setCurrentSelection(String name);\n\n        void setHelpText(String text);\n\n        void show();\n\n        void hide();\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    PerspectiveTreeProvider perspectiveTreeProvider;\n    Plugin selectedItem = null;\n    Command onOk = null;\n    Command onCancel = null;\n\n    @Inject\n    public PerspectiveDragConfigModal(View view,\n                                      PerspectivePluginManager perspectivePluginManager,\n                                      PerspectiveTreeProvider perspectiveTreeProvider) {\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.perspectiveTreeProvider = perspectiveTreeProvider;\n        this.view.init(this);\n        this.view.setHelpText(ContentManagerConstants.INSTANCE.perspectiveDragComponentHelp());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public void setOnOk(Command onOk) {\n        this.onOk = onOk;\n    }\n\n    public void setOnCancel(Command onCancel) {\n        this.onCancel = onCancel;\n    }\n\n    public Plugin getSelectedItem() {\n        return selectedItem;\n    }\n\n    public void show(String selectedPerspectiveId) {\n        view.clearItems();\n        addItems(selectedPerspectiveId);\n        view.show();\n    }\n\n    private void addItems(String selectedItemId) {\n        perspectivePluginManager.getPerspectivePlugins(plugins -> {\n            for (Plugin plugin : plugins) {\n                String perspectiveName = perspectiveTreeProvider.getPerspectiveName(plugin.getName());\n                view.addItem(perspectiveName, () -> onItemSelected(plugin));\n\n                if (selectedItemId != null && plugin.getName().equals(selectedItemId)) {\n                    view.setCurrentSelection(perspectiveName);\n                }\n            }\n        });\n    }\n\n    // View callbacks\n\n    public void onItemSelected(Plugin plugin) {\n        selectedItem = plugin;\n        view.setCurrentSelection(selectedItem.getName());\n    }\n\n    void onOk() {\n        if (selectedItem != null) {\n            view.hide();\n            if (onOk != null) {\n                onOk.execute();\n            }\n        }\n    }\n\n    void onCancel() {\n        view.hide();\n        if (onCancel != null) {\n            onCancel.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/layout/editor/PerspectiveDragConfigModalView.css",
    "content": ".uf-pdc-selector-body {\n    margin: 15px;\n}\n.uf-pdc-selector-button {\n    min-width: 200px;\n    text-align: left;\n}\n.uf-pdc-selector-menu {\n    margin-left: 20px;\n    min-width: 200px;\n}\n.uf-pdc-selector-caret {\n    float: right;\n    margin-top: 5px;\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/layout/editor/PerspectiveDragConfigModalView.html",
    "content": "<div>\n    <div data-field=\"body\" class=\"uf-pdc-selector-body\">\n        <div class=\"col-md-3\">\n            <label data-field=\"navItemLabel\">Page</label>\n            <span data-field=\"selectorHelp\">\n                <i class=\"pf pficon-help acl-help-icon\" data-toggle=\"tooltip\" data-placement=\"left\"></i>\n            </span>\n        </div>\n        <div class=\"dropdown col-md-9\">\n            <button class=\"btn btn-default dropdown-toggle uf-pdc-selector-button\" type=\"button\" data-toggle=\"dropdown\">\n                <span data-field=\"currentSelection\"></span>\n                <span class=\"uf-pdc-selector-caret caret\" style=\"margin-left: 10px;\"></span>\n            </button>\n            <ul data-field=\"selectorItems\" class=\"dropdown-menu uf-pdc-selector-menu\" role=\"menu\">\n            </ul>\n        </div>\n    </div>\n    <div data-field=\"footer\">\n        <button data-field=\"okButton\" type=\"button\" class=\"btn btn-primary\">Ok</button>\n        <button data-field=\"cancelButton\" type=\"button\" class=\"btn btn-default\">Cancel</button>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/layout/editor/PerspectiveDragConfigModalView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.layout.editor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Label;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.TemplateWidgetMapper;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\n\n@Templated\npublic class PerspectiveDragConfigModalView implements PerspectiveDragConfigModal.View {\n\n    PerspectiveDragConfigModal presenter;\n    BaseModal modal;\n    ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n\n    @Inject\n    @DataField\n    Div body;\n\n    @Inject\n    @DataField\n    Div footer;\n\n    @DataField\n    @Inject\n    Span selectorHelp;\n\n    @DataField\n    @Inject\n    Span currentSelection;\n\n    @DataField\n    @Inject\n    UnorderedList selectorItems;\n\n    @DataField\n    @Inject\n    Label navItemLabel;\n\n    @Override\n    public void init(PerspectiveDragConfigModal presenter) {\n        this.presenter = presenter;\n        currentSelection.setTextContent(ContentManagerConstants.INSTANCE.perspectiveDragSelectorHint());\n        navItemLabel.setTextContent(ContentManagerConstants.INSTANCE.perspectiveDragSelectorLabel());\n\n        modal = new CommonModalBuilder()\n                .addHeader(ContentManagerConstants.INSTANCE.perspectiveDragComponentHeader())\n                .addBody( body )\n                .addFooter( footer )\n                .build();\n\n        modal.addHiddenHandler(hiddenEvent -> {\n            if (ButtonPressed.CLOSE.equals(buttonPressed)) {\n                presenter.onCancel();\n            }\n        });\n\n        modal.setWidth( \"960px\" );\n    }\n\n    public Modal getModal() {\n        return modal;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return TemplateWidgetMapper.get(modal);\n    }\n\n    @Override\n    public void show() {\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public void clearItems() {\n        DOMUtil.removeAllChildren(selectorItems);\n    }\n\n    @Override\n    public void setHelpText(String text) {\n        selectorHelp.setTitle(text);\n    }\n\n    @Override\n    public void setCurrentSelection(String name) {\n        currentSelection.setTextContent(name);\n    }\n\n    @Override\n    public void addItem(String name, Command onSelect) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        selectorItems.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                onSelect.execute();\n            }\n        });\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"okButton\")\n    public void okClick(final Event event) {\n        buttonPressed = ButtonPressed.OK;\n        presenter.onOk();\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"cancelButton\")\n    public void cancelClick(final Event event) {\n        buttonPressed = ButtonPressed.CANCEL;\n        presenter.onCancel();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/perspective/ContentManagerPerspective.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.cms.screen.explorer.NavigationExplorerScreen;\nimport org.dashbuilder.client.cms.screen.explorer.PerspectivesExplorerScreen;\nimport org.dashbuilder.client.cms.screen.home.ContentManagerHomeScreen;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.ioc.client.api.AfterInitialization;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocks;\nimport org.uberfire.client.workbench.events.PlaceHiddenEvent;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.ext.layout.editor.client.LayoutComponentPaletteScreen;\nimport org.uberfire.ext.layout.editor.client.LayoutEditorPropertiesScreen;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutEditorPropertiesPresenter;\nimport org.uberfire.ext.plugin.client.perspective.editor.PerspectiveEditorPresenter;\nimport org.uberfire.ext.plugin.client.perspective.editor.events.PerspectiveEditorFocusEvent;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = ContentManagerPerspective.PERSPECTIVE_ID)\npublic class ContentManagerPerspective {\n\n    public static final String PERSPECTIVE_ID = \"ContentManagerPerspective\";\n\n    @Inject\n    ContentManagerI18n i18n;\n\n    @Inject\n    UberfireDocks uberfireDocks;\n\n    @Inject\n    LayoutEditorPropertiesPresenter propertiesPresenter;\n\n    UberfireDock perspectivesExplorerDock;\n    UberfireDock navigationExplorerDock;\n    UberfireDock componentPaletteDock;\n    UberfireDock propertiesEditorDock;\n    boolean perspectiveVisible = true;\n    boolean propertiesEditorVisible = false;\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return buildPerspective();\n    }\n\n    private PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(ContentManagerConstants.INSTANCE.contentManagerHome());\n        perspective.getRoot().addPart(ContentManagerHomeScreen.SCREEN_ID);\n        return perspective;\n    }\n\n    @AfterInitialization\n    public void init() {\n        perspectivesExplorerDock = new UberfireDock(UberfireDockPosition.WEST,\n                IconType.FILE_TEXT_O.toString(),\n                new DefaultPlaceRequest(PerspectivesExplorerScreen.SCREEN_ID), PERSPECTIVE_ID).withSize(330)\n                .withLabel(i18n.capitalizeFirst(i18n.getPerspectivesResourceName()));\n\n        navigationExplorerDock = new UberfireDock(UberfireDockPosition.WEST,\n                IconType.NAVICON.toString(),\n                new DefaultPlaceRequest(NavigationExplorerScreen.SCREEN_ID), PERSPECTIVE_ID).withSize(330)\n                .withLabel(ContentManagerConstants.INSTANCE.contentExplorerNavigation());\n\n        componentPaletteDock = new UberfireDock(UberfireDockPosition.WEST,\n                IconType.CUBES.toString(),\n                new DefaultPlaceRequest(LayoutComponentPaletteScreen.SCREEN_ID), PERSPECTIVE_ID).withSize(330)\n                .withLabel(ContentManagerConstants.INSTANCE.componentPalette());\n\n        propertiesEditorDock = new UberfireDock(UberfireDockPosition.EAST,\n                IconType.PENCIL.toString(),\n                new DefaultPlaceRequest(LayoutEditorPropertiesScreen.SCREEN_ID), PERSPECTIVE_ID).withSize(300)\n                .withLabel(ContentManagerConstants.INSTANCE.propertiesEditor());\n\n        uberfireDocks.add(perspectivesExplorerDock);\n        uberfireDocks.add(navigationExplorerDock);\n    }\n\n    private void refreshWestDocks(boolean show, UberfireDock dockToOpen) {\n\n        if (show && !perspectiveVisible) {\n            uberfireDocks.add(componentPaletteDock);\n            perspectiveVisible = true;\n        }\n        if (!show && perspectiveVisible) {\n            uberfireDocks.remove(componentPaletteDock);\n            perspectiveVisible = false;\n        }\n\n        uberfireDocks.show(UberfireDockPosition.WEST, PERSPECTIVE_ID);\n        if (dockToOpen != null) {\n            uberfireDocks.open(dockToOpen);\n        }\n    }\n\n    private void refreshEastDocks(boolean show, UberfireDock dockToOpen) {\n        if (show && !propertiesEditorVisible) {\n            uberfireDocks.add(propertiesEditorDock);\n            propertiesEditorVisible = true;\n            uberfireDocks.show(UberfireDockPosition.EAST, PERSPECTIVE_ID);\n\n            if (dockToOpen != null) {\n                uberfireDocks.open(dockToOpen);\n            }\n        }\n        if (!show && propertiesEditorVisible) {\n            uberfireDocks.remove(propertiesEditorDock);\n            propertiesEditorVisible = false;\n            uberfireDocks.hide(UberfireDockPosition.EAST, PERSPECTIVE_ID);\n        }\n    }\n\n    @OnOpen\n    public void onOpen() {\n        refreshWestDocks(false, perspectivesExplorerDock);\n    }\n\n    public void onPerspectiveEditorFocus(@Observes PerspectiveEditorFocusEvent event) {\n        refreshWestDocks(true, componentPaletteDock);\n        refreshEastDocks(true, propertiesEditorDock);\n        propertiesPresenter.edit(event.getLayoutEditor());\n    }\n\n    public void onPerspectiveEditorHidden(@Observes PlaceHiddenEvent event) {\n        String placeId = event.getPlace().getIdentifier();\n        if (PerspectiveEditorPresenter.ID.equals(placeId)) {\n            refreshWestDocks(false, null);\n            refreshEastDocks(false, null);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/perspective/DataTransferPerspective.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.cms.screen.transfer.DataTransferScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = DataTransferPerspective.ID)\npublic class DataTransferPerspective {\n\n    public static final String ID = \"DataTransferPerspective\";\n    public static final String NAME = \"DataTransfer\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(\n                StaticWorkbenchPanelPresenter.class.getName());\n\n        perspective.getRoot().addPart(\n            new PartDefinitionImpl(\n                new DefaultPlaceRequest(DataTransferScreen.ID)));\n\n        perspective.setName(NAME);\n\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface ContentManagerConstants extends Messages {\n\n    public static final ContentManagerConstants INSTANCE = GWT.create(ContentManagerConstants.class);\n\n    String contentExplorerNew();\n\n    String contentExplorerNavigation();\n\n    String navigationTreeItem();\n\n    String contentExplorerTopMenu();\n\n    String contentManagerHome();\n\n    String contentManagerHomeTitle();\n\n    String contentManagerHomeWelcome();\n\n    String contentManagerHomeCreate();\n\n    String contentManagerNavigationChanged();\n\n    String contentManagerHomeNewPerspective(String resourceType);\n\n    String componentPalette();\n\n    String propertiesEditor();\n\n    String perspective();\n\n    String perspectives();\n\n    String noPerspectives();\n\n    String perspectiveDragComponent();\n\n    String perspectiveDragComponentHeader();\n\n    String perspectiveDragComponentHelp();\n\n    String perspectiveDragSelectorHint();\n\n    String perspectiveDragSelectorLabel();\n\n    String perspectiveDragNotFoundError();\n\n    String perspectiveInfiniteRecursionError();\n\n    String newPerspectivePopUpViewName();\n\n    String newPerspectivePopUpViewNameHelp();\n\n    String newPerspectivePopUpViewStyle();\n\n    String newPerspectivePopUpViewStyleHelp();\n\n    String newPerspectivePopUpViewFluid();\n\n    String newPerspectivePopUpViewPage();\n\n    String newPerspectivePopUpViewCancel();\n\n    String newPerspectivePopUpViewOk();\n\n    String newPerspectivePopUpViewTitle();\n\n    String newPerspectivePopUpViewErrorEmptyName();\n\n    String newPerspectivePopUpViewErrorInvalidName();\n\n    String newPerspectivePopUpViewErrorDuplicatedName();\n\n    String workbenchPartTitle();\n\n    String dataTransferPopUpViewTitle();\n\n    String importResultMessageOK(int count);\n    \n    String importResultMessageNoData();\n\n    String exportOK();\n\n    String importOK();\n\n    String exportError();\n\n    String importError();\n\n    String exportText();\n\n    String importText();\n\n    String dataTransferExportPopUpViewTitle();\n\n    String dataTransferExportError();\n\n    String loadAssetsToExport();\n\n    String pageLabel();\n\n    String pagesLabel();\n    \n    String datasetLabel();\n\n    String datasetsLabel();\n\n    String exportWizardTitle();\n\n    String loadingExportWizard();\n\n    String preparingExportDownload();\n\n    String pageMissingDataSets(String page);\n\n    String validatingExport();\n\n    String exportWizardHeadingSuccess();\n\n    String exportWizardHeadingError();\n\n    String noPagesExported();\n\n    String missingDependencies();\n\n    String nothingToExport();\n\n    String navigationHelpText();\n\n    String validationError();\n\n    String openHelpText();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/resources/i18n/ContentManagerI18n.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.resources.i18n;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ContentManagerI18n {\n\n    String contentExplorerNew = ContentManagerConstants.INSTANCE.contentExplorerNew();\n    String contentExplorerNavigation = ContentManagerConstants.INSTANCE.contentExplorerNavigation();\n    String contentExplorerTopMenu = ContentManagerConstants.INSTANCE.contentExplorerTopMenu();\n    String contentManagerHome = ContentManagerConstants.INSTANCE.contentManagerHome();\n    String contentManagerHomeTitle = ContentManagerConstants.INSTANCE.contentManagerHomeTitle();\n    String contentManagerHomeWelcome = ContentManagerConstants.INSTANCE.contentManagerHomeWelcome();\n    String contentManagerHomeCreate = ContentManagerConstants.INSTANCE.contentManagerHomeCreate();\n    String contentManagerNavigationChanged = ContentManagerConstants.INSTANCE.contentManagerNavigationChanged();\n    String perspectiveResourceName = ContentManagerConstants.INSTANCE.perspective();\n    String perspectivesResourceName = ContentManagerConstants.INSTANCE.perspectives();\n    String noPerspectives = ContentManagerConstants.INSTANCE.noPerspectives();\n\n    public String capitalizeFirst(String input) {\n        return input.substring(0, 1).toUpperCase() + input.substring(1);\n    }\n\n    public String lowerCaseFirst(String input) {\n        return input.substring(0, 1).toLowerCase() + input.substring(1);\n    }\n\n    public String getContentExplorerNavigation() {\n        return contentExplorerNavigation;\n    }\n\n    public void setContentExplorerNavigation(String contentExplorerNavigation) {\n        this.contentExplorerNavigation = contentExplorerNavigation;\n    }\n\n    public String getContentExplorerTopMenu() {\n        return contentExplorerTopMenu;\n    }\n\n    public void setContentExplorerTopMenu(String contentExplorerTopMenu) {\n        this.contentExplorerTopMenu = contentExplorerTopMenu;\n    }\n\n    public String getContentExplorerNew() {\n        return contentExplorerNew;\n    }\n\n    public void setContentExplorerNew(String contentExplorerNew) {\n        this.contentExplorerNew = contentExplorerNew;\n    }\n\n    public String getContentManagerHome() {\n        return contentManagerHome;\n    }\n\n    public void setContentManagerHome(String contentManagerHome) {\n        this.contentManagerHome = contentManagerHome;\n    }\n\n    public String getContentManagerHomeTitle() {\n        return contentManagerHomeTitle;\n    }\n\n    public void setContentManagerHomeTitle(String contentManagerHomeTitle) {\n        this.contentManagerHomeTitle = contentManagerHomeTitle;\n    }\n\n    public String getContentManagerHomeWelcome() {\n        return contentManagerHomeWelcome;\n    }\n\n    public void setContentManagerHomeWelcome(String contentManagerHomeWelcome) {\n        this.contentManagerHomeWelcome = contentManagerHomeWelcome;\n    }\n\n    public String getContentManagerHomeCreate() {\n        return contentManagerHomeCreate;\n    }\n\n    public void setContentManagerHomeCreate(String contentManagerHomeCreate) {\n        this.contentManagerHomeCreate = contentManagerHomeCreate;\n    }\n\n    public String getContentManagerHomeNewPerspectiveLink() {\n        String resType = capitalizeFirst(perspectiveResourceName);\n        return ContentManagerConstants.INSTANCE.contentManagerHomeNewPerspective(resType);\n    }\n\n    public String getContentManagerHomeNewPerspectiveButton() {\n        String resType = capitalizeFirst(perspectiveResourceName);\n        return capitalizeFirst(ContentManagerConstants.INSTANCE.contentManagerHomeNewPerspective(resType));\n    }\n\n    public String getContentManagerNavigationChanged() {\n        return contentManagerNavigationChanged;\n    }\n\n    public void setContentManagerNavigationChanged(String contentManagerNavigationChanged) {\n        this.contentManagerNavigationChanged = contentManagerNavigationChanged;\n    }\n\n    public String getPerspectiveResourceName() {\n        return perspectiveResourceName;\n    }\n\n    public String getPerspectivesResourceName() {\n        return perspectivesResourceName;\n    }\n\n    public void setPerspectiveResourceName(String perspectiveResourceName) {\n        this.perspectiveResourceName = perspectiveResourceName;\n    }\n\n    public void setPerspectivesResourceName(String perspectivesResourceName) {\n        this.perspectivesResourceName = perspectivesResourceName;\n    }\n\n    public String getNoPerspectives() {\n        return noPerspectives;\n    }\n\n    public void setNoPerspectives(String noPerspectives) {\n        this.noPerspectives = noPerspectives;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/explorer/NavigationExplorerScreen.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.screen.explorer;\n\nimport java.util.function.Consumer;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.event.NavTreeLoadedEvent;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.navigation.event.PerspectivePluginsChangedEvent;\nimport org.dashbuilder.client.navigation.widget.editor.NavTreeEditor;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = NavigationExplorerScreen.SCREEN_ID)\npublic class NavigationExplorerScreen {\n\n    public static final String SCREEN_ID = \"NavigationExplorerScreen\";\n\n    NavigationManager navigationManager;\n    NavTreeEditor navTreeEditor;\n    ContentManagerI18n i18n;\n    Event<NotificationEvent> workbenchNotification;\n\n    public NavigationExplorerScreen() {\n    }\n\n    @Inject\n    public NavigationExplorerScreen(NavigationManager navigationManager,\n                                 NavTreeEditor navTreeEditor,\n                                 ContentManagerI18n i18n,\n                                 Event<NotificationEvent> workbenchNotification) {\n        this.navigationManager = navigationManager;\n        this.navTreeEditor = navTreeEditor;\n        this.i18n = i18n;\n        this.workbenchNotification = workbenchNotification;\n    }\n\n    @PostConstruct\n    void init() {\n        navTreeEditor.setOnSaveCommand(this::onNavTreeSaved);\n        navTreeEditor.getSettings().setLiteralPerspective(i18n.capitalizeFirst(i18n.getPerspectiveResourceName()));\n        navTreeEditor.getSettings().setGotoPerspectiveEnabled(true);\n\n        if (navTreeEditor.getNavTree() == null && navigationManager.getNavTree() != null) {\n            navTreeEditor.edit(navigationManager.getNavTree());\n        }\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return i18n.getContentExplorerNavigation();\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return navTreeEditor;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory.newTopLevelMenu(i18n.getContentExplorerNew())\n                                     .respondsWith(this::createNewNavigationTree)\n                                     .endMenu()\n                                     .build());\n    }\n\n    public NavTreeEditor getNavTreeEditor() {\n        return navTreeEditor;\n    }\n\n    public void createNewNavigationTree() {\n        navTreeEditor.newTree();\n    }\n\n    void onNavTreeLoaded(@Observes NavTreeLoadedEvent event) {\n        NavTree navTree = event.getNavTree();\n        if (navTree != null) {\n            navTreeEditor.edit(navTree);\n        }\n    }\n\n    void onPerspectivesChanged(@Observes PerspectivePluginsChangedEvent event) {\n        NavTree navTree = navigationManager.getNavTree();\n        if (navTree != null) {\n            navTreeEditor.edit(navTree);\n        }\n    }\n\n    public void onNavTreeChanged(@Observes final NavTreeChangedEvent event) {\n        NavTree navTree = event.getNavTree();\n        if (navTree != null) {\n            navigationManager.update(navTree);\n            navTreeEditor.edit(navTree);\n        }\n    }\n\n    void onNavTreeSaved() {\n        workbenchNotification.fire(new NotificationEvent(i18n.getContentManagerNavigationChanged(), NotificationEvent.NotificationType.SUCCESS));\n    }\n\n    void onAuthzPolicyChanged(@Observes final AuthorizationPolicySavedEvent event) {\n        NavTree navTree = navigationManager.getNavTree();\n        if (navTree != null) {\n            navTreeEditor.edit(navTree);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/explorer/PerspectivesExplorerScreen.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.screen.explorer;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.cms.widget.NewPerspectivePopUp;\nimport org.dashbuilder.client.cms.widget.PerspectivesExplorer;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = PerspectivesExplorerScreen.SCREEN_ID)\npublic class PerspectivesExplorerScreen {\n\n    public static final String SCREEN_ID = \"PerspectivesExplorerScreen\";\n\n    PerspectivesExplorer perspectivesExplorer;\n    NewPerspectivePopUp newPerspectivePopUp;\n    ContentManagerI18n i18n;\n\n    public PerspectivesExplorerScreen() {\n    }\n\n    @Inject\n    public PerspectivesExplorerScreen(PerspectivesExplorer perspectivesExplorer,\n                                 NewPerspectivePopUp newPerspectivePopUp,\n                                 ContentManagerI18n i18n) {\n        this.perspectivesExplorer = perspectivesExplorer;\n        this.newPerspectivePopUp = newPerspectivePopUp;\n        this.i18n = i18n;\n    }\n\n    @OnStartup\n    public void init() {\n        perspectivesExplorer.show();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return i18n.capitalizeFirst(i18n.getPerspectivesResourceName());\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return perspectivesExplorer;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory.newTopLevelMenu(i18n.getContentExplorerNew())\n                                     .withPermission(ActivityResourceType.PERSPECTIVE, PerspectiveAction.CREATE)\n                                     .respondsWith(this::createNewPerspective)\n                                     .endMenu()\n                                     .build());\n    }\n\n    public void createNewPerspective() {\n        newPerspectivePopUp.show();\n    }\n\n    void onAuthzPolicyChanged(@Observes final AuthorizationPolicySavedEvent event) {\n        perspectivesExplorer.show();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/home/ContentManagerHomeScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.screen.home;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.cms.screen.explorer.PerspectivesExplorerScreen;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.plugin.client.security.PluginController;\n\n@Dependent\n@WorkbenchScreen(identifier = ContentManagerHomeScreen.SCREEN_ID)\npublic class ContentManagerHomeScreen {\n\n    public static final String SCREEN_ID = \"ContentManagerHomeScreen\";\n\n    public interface View extends UberView<ContentManagerHomeScreen> {\n\n        void setPerspectiveCreationVisible(boolean visible);\n    }\n\n    View view;\n    PerspectivesExplorerScreen perspectivesExplorerScreen;\n    PluginController pluginController;\n    ContentManagerI18n i18n;\n\n    @Inject\n    public ContentManagerHomeScreen(View view, PerspectivesExplorerScreen perspectivesExplorerScreen, PluginController pluginController, ContentManagerI18n i18n) {\n        this.view = view;\n        this.perspectivesExplorerScreen = perspectivesExplorerScreen;\n        this.pluginController = pluginController;\n        this.i18n = i18n;\n    }\n\n    @PostConstruct\n    private void init() {\n        view.init(this);\n        view.setPerspectiveCreationVisible(pluginController.canCreatePerspectives());\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return i18n.getContentManagerHome();\n    }\n\n    @WorkbenchPartView\n    public Widget getWidget() {\n        return view.asWidget();\n    }\n\n    public void createNewPerspective() {\n        if (pluginController.canCreatePerspectives()) {\n            perspectivesExplorerScreen.createNewPerspective();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/home/ContentManagerHomeView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"container-fluid text-center\" style=\"padding-top: 70px;\">\n  <div class=\"row\">\n    <i class=\"fa fa-puzzle-piece\" style=\"font-size: 100px;\"></i>\n  </div>\n  <div class=\"row\" style=\"padding-top: 20px;\">\n    <h2><strong><span data-field=\"titleSpan\"></span></strong></h2>\n  </div>\n  <div class=\"row\" style=\"padding-top: 20px;\">\n    <p>\n      <span data-field=\"welcomeSpan\" style=\"font-size: larger\"></span>&nbsp;<span data-field=\"createSpan\" style=\"font-size: larger\"></span>&nbsp;<a href=\"#\" data-field=\"createPerspectiveAnchor\"></a>\n    </p>\n  </div>\n  <div class=\"row\" style=\"padding-top: 20px;\">\n    <button class=\"btn btn-primary btn-lg\" type=\"button\" data-field=\"createPerspectiveButton\"></button>\n  </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/home/ContentManagerHomeView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.screen.home;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class ContentManagerHomeView extends Composite implements ContentManagerHomeScreen.View {\n\n    @Inject\n    ContentManagerI18n i18n;\n\n    @Inject\n    @DataField\n    Span titleSpan;\n\n    @Inject\n    @DataField\n    Span welcomeSpan;\n\n    @Inject\n    @DataField\n    Span createSpan;\n\n    @Inject\n    @DataField\n    Anchor createPerspectiveAnchor;\n\n    @Inject\n    @DataField\n    Button createPerspectiveButton;\n\n    ContentManagerHomeScreen presenter;\n\n    @Override\n    public void init(ContentManagerHomeScreen presenter) {\n        this.presenter = presenter;\n        titleSpan.setTextContent(i18n.getContentManagerHomeTitle());\n        welcomeSpan.setTextContent(i18n.getContentManagerHomeWelcome());\n        createSpan.setTextContent(i18n.getContentManagerHomeCreate());\n        createPerspectiveAnchor.setTextContent(i18n.getContentManagerHomeNewPerspectiveLink());\n        createPerspectiveButton.setTextContent(i18n.getContentManagerHomeNewPerspectiveButton());\n    }\n\n    @Override\n    public void setPerspectiveCreationVisible(boolean visible) {\n        if (visible) {\n            createSpan.getStyle().removeProperty(\"display\");\n            createPerspectiveAnchor.getStyle().removeProperty(\"display\");\n            createPerspectiveButton.getStyle().removeProperty(\"display\");\n        } else {\n            createSpan.getStyle().setProperty(\"display\", \"none\");\n            createPerspectiveAnchor.getStyle().setProperty(\"display\", \"none\");\n            createPerspectiveButton.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"createPerspectiveButton\")\n    public void createPerspectiveButton(final ClickEvent event) {\n        presenter.createNewPerspective();\n    }\n\n    @EventHandler(\"createPerspectiveAnchor\")\n    public void createPerspectiveAnchor( final ClickEvent event ) {\n        presenter.createNewPerspective();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferPopUp.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElemental;\n\n@ApplicationScoped\npublic class DataTransferPopUp {\n\n    private View view;\n\n    public DataTransferPopUp() {\n    }\n\n    @Inject\n    public DataTransferPopUp(\n            final DataTransferPopUpView view) {\n\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void show(List<String> filesImported) {\n        view.show(filesImported);\n    }\n\n    public interface View extends UberElemental<DataTransferPopUp> {\n        void show(List<String> filesImported);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferPopUpView.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div data-field=\"root\">\n    <div data-field=\"body\">\n        <p data-field=\"filesImportedMessage\"></p>\n        <ul data-field=\"filesImportedList\" class=\"list-group\">\n        </ul>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferPopUpView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\nimport com.google.gwt.user.client.DOM;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\n\nimport com.google.gwt.dom.client.Element;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLParagraphElement;\nimport elemental2.dom.HTMLUListElement;\nimport elemental2.dom.Node;\nimport jsinterop.base.Js;\n\n@Templated\n@Dependent\npublic class DataTransferPopUpView implements DataTransferPopUp.View, IsElement {\n\n    private BaseModal modal;\n    private ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n    private HTMLDivElement root;\n    private HTMLDivElement body;\n    private HTMLParagraphElement filesImportedMessage;\n    private HTMLUListElement filesImportedList;\n    private Elemental2DomUtil elem2Dom;\n\n    public DataTransferPopUpView() {\n    }\n\n    @Inject\n    public DataTransferPopUpView(\n            final @DataField HTMLDivElement root,\n            final @DataField HTMLDivElement body,\n            final @DataField HTMLParagraphElement filesImportedMessage,\n            final @DataField HTMLUListElement filesImportedList,\n            final Elemental2DomUtil elem2Dom) {\n\n        this.root = root;\n        this.body = body;\n        this.filesImportedMessage = filesImportedMessage;\n        this.filesImportedList = filesImportedList;\n        this.elem2Dom = elem2Dom;\n    }\n\n    @Override\n    public void init(DataTransferPopUp presenter) {\n        modal = new CommonModalBuilder()\n            .addHeader(i18n.dataTransferPopUpViewTitle())\n            .addBody(body)\n            .build();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return root;\n    }\n\n    @Override\n    public void show(List<String> filesImported) {\n        modal.setTitle(i18n.dataTransferPopUpViewTitle());\n        elem2Dom.removeAllElementChildren(filesImportedList);\n        int size = filesImported.size();\n        \n        if (size == 0) {\n            filesImportedMessage.textContent = i18n.importResultMessageNoData();\n        \n        } else {\n            filesImportedMessage.textContent = i18n.importResultMessageOK(size);      \n            filesImported.forEach(fileImported -> {\n                Element element = DOM.createElement(\"li\");\n                element.setClassName(\"list-group-item\");\n                element.setInnerText(fileImported);\n                filesImportedList.appendChild((Node) Js.cast(element));\n            });\n        }\n\n        modal.show();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferScreen.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.dashbuilder.transfer.ExportInfo;\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.dashbuilder.transfer.DataTransferServices;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.cms.screen.transfer.export.wizard.ExportWizard;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = DataTransferScreen.ID)\npublic class DataTransferScreen {\n\n    public static final String ID = \"DataTransferScreen\";\n    private View view;\n    private Caller<DataTransferServices> dataTransferServices;\n    private ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n    private DataTransferPopUp popUp;\n    private ExportWizard exportWizard;\n    private BusyIndicatorView busyIndicatorView;\n\n    protected ParameterizedCommand<DataTransferExportModel> gradualExportCallback;\n\n    public DataTransferScreen() {}\n\n    @Inject\n    public DataTransferScreen(\n                              final View view,\n                              final DataTransferPopUp popUp,\n                              final Caller<DataTransferServices> dataTransferServices,\n                              final ExportWizard exportWizard,\n                              final BusyIndicatorView busyIndicatorView) {\n        this.view = view;\n        this.popUp = popUp;\n        this.dataTransferServices = dataTransferServices;\n        this.exportWizard = exportWizard;\n        this.busyIndicatorView = busyIndicatorView;\n    }\n\n    @WorkbenchPartTitle\n    public String title() {\n        return i18n.workbenchPartTitle();\n    }\n\n    @WorkbenchPartView\n    public View part() {\n        return view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        exportWizard.setDownloadCallback(this::callExportService);\n        exportWizard.setOpenCallback(this::openExportedModel);\n    }\n\n    public void doExport() {\n        callExportService(DataTransferExportModel.exportAll());\n    }\n\n    public void doGradualExport() {\n        busyIndicatorView.showBusyIndicator(i18n.loadingExportWizard());\n        dataTransferServices.call((ExportInfo v) -> {\n            busyIndicatorView.hideBusyIndicator();\n            exportWizard.start(v);\n        }, (message, error) -> {\n            busyIndicatorView.hideBusyIndicator();\n            view.exportError(error);\n            return false;\n        }).exportInfo();\n    }\n\n    public void doImport() {\n        try {\n            dataTransferServices.call((RemoteCallback<List<String>>) imported -> {\n                                          view.importOK();\n                                          popUp.show(imported);\n\n                                      }, (ErrorCallback<Throwable>) (message, throwable) -> {\n                                          view.importError(throwable);\n                                          return false;\n\n                                      }).doImport();\n\n        } catch (Exception e) {\n            view.importError(e);\n        }\n    }\n\n    public interface View extends UberElemental<DataTransferScreen> {\n\n        void importOK();\n\n        void exportOK();\n\n        void importError(Throwable throwable);\n\n        void exportError(Throwable throwable);\n\n        void download(String path);\n\n        void openUrl(String path);\n    }\n\n    public String getFilePath() {\n        return DataTransferServices.FILE_PATH;\n    }\n\n    public String getExportFileName() {\n        return DataTransferServices.EXPORT_FILE_NAME;\n    }\n\n    public String getImportFileName() {\n        return DataTransferServices.IMPORT_FILE_NAME;\n    }\n\n    private void callExportService(DataTransferExportModel dataTransferExportModel) {\n        busyIndicatorView.showBusyIndicator(i18n.preparingExportDownload());\n        try {\n            dataTransferServices.call((RemoteCallback<String>) path -> {\n                busyIndicatorView.hideBusyIndicator();\n                view.exportOK();\n                view.download(path);\n\n            }, (ErrorCallback<Exception>) (message, throwable) -> {\n                busyIndicatorView.hideBusyIndicator();\n                view.exportError(throwable);\n                return false;\n\n            }).doExport(dataTransferExportModel);\n\n        } catch (Exception e) {\n            view.exportError(e);\n        }\n    }\n    \n    private void openExportedModel(DataTransferExportModel dataTransferExportModel) {\n        busyIndicatorView.showBusyIndicator(i18n.preparingExportDownload());\n        try {\n            dataTransferServices.call((RemoteCallback<String>) modelUrl -> {\n                busyIndicatorView.hideBusyIndicator();\n                view.exportOK();\n                view.openUrl(modelUrl);\n\n            }, (ErrorCallback<Exception>) (message, throwable) -> {\n                busyIndicatorView.hideBusyIndicator();\n                view.exportError(throwable);\n                return false;\n\n            }).generateExportUrl(dataTransferExportModel);\n\n        } catch (Exception e) {\n            view.exportError(e);\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferView.css",
    "content": "@charset \"UTF-8\";\n\n.data-transfer-view .card-pf-view {\n\theight: 200px;\n\tposition: relative;\n}\n\n.data-transfer-view .card-pf-items:last-child {\n\tposition: absolute;\n\tbottom: 15px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferView.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"root\" class=\"cards-pf data-transfer-view\">\n    <div class=\"container-fluid container-cards-pf\">\n        <div class=\"row row-cards-pf\">\n            <div class=\"col-xs-12 col-sm-6 col-md-4 col-lg-6\">\n                <div class=\"card-pf card-pf-view\">\n                    <div class=\"card-pf-body\">\n                        <h1 data-i18n-key=\"export\"></h1>\n                        <p data-i18n-key=\"exportText\"></p>\n                        <div class=\"card-pf-items\">\n                            <button class=\"btn btn-primary btn-lg\"\n                                data-field=\"btnExport\"\n                                data-i18n-key=\"export\"></button>\n                            <button class=\"btn btn-primary btn-lg\"\n                                data-field=\"btnGradualExport\"\n                                data-i18n-key=\"gradualExport\"></button>\n                        </div>\n                    </div>\n                </div>\n            </div>\n\n            <div class=\"col-xs-12 col-sm-6 col-md-4 col-lg-6\">\n                <div class=\"card-pf card-pf-view\">\n                    <div class=\"card-pf-body\">\n                        <h1 data-i18n-key=\"import\"></h1>\n                        <p data-i18n-key=\"importText\"></p>\n                        <div class=\"card-pf-items\"\n                            data-field=\"fileUploadContainer\"></div>\n                        <div class=\"card-pf-items\">\n                            <button class=\"btn btn-primary btn-lg\"\n                                data-field=\"btnImport\"\n                                data-i18n-key=\"import\"></button>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/DataTransferView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.cms.screen.transfer.export.wizard.widget.PagesTable;\nimport org.dashbuilder.common.client.backend.PathUrlFactory;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor.FileUploadEditorCallback;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.spaces.SpacesAPI;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Templated\npublic class DataTransferView implements DataTransferScreen.View, IsElement {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(DataTransferView.class);\n    private DataTransferScreen presenter;\n    private ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n    private HTMLDivElement root;\n    private HTMLDivElement fileUploadContainer;\n    private HTMLButtonElement btnImport;\n    private FileUploadEditor fileUploadEditor;\n    private Elemental2DomUtil elem2Dom;\n    private Event<NotificationEvent> workbenchNotification;\n    private PathUrlFactory pathUrlFactory;\n    \n    @Inject PagesTable pagesTable;\n\n    public DataTransferView() {\n    }\n\n    @Inject\n    public DataTransferView(\n            final @DataField HTMLDivElement root,\n            final @DataField HTMLDivElement fileUploadContainer,\n            final @DataField HTMLButtonElement btnImport,\n            final @DataField HTMLButtonElement btnExport,\n            final @DataField HTMLButtonElement btnGradualExport,\n            final FileUploadEditor fileUploadEditor,\n            final Elemental2DomUtil elem2Dom,\n            final Event<NotificationEvent> workbenchNotification,\n            final PathUrlFactory pathUrlFactory) {\n\n        this.root = root;\n        this.fileUploadContainer = fileUploadContainer;\n        this.btnImport = btnImport;\n        this.fileUploadEditor = fileUploadEditor;\n        this.elem2Dom = elem2Dom;\n        this.workbenchNotification = workbenchNotification;\n        this.pathUrlFactory = pathUrlFactory;\n    }\n\n    @Override\n    public void init(DataTransferScreen presenter) {\n        this.presenter = presenter;\n\n        btnImport.disabled = true;\n\n        elem2Dom.appendWidgetToElement(fileUploadContainer, fileUploadEditor.asWidget());\n\n        fileUploadEditor.setAccept(\".zip\");\n        \n        fileUploadEditor.configure(\"fileUpload\", new FileUploadEditorCallback() {\n            @Override\n            public String getUploadFileUrl() {\n                String path = new StringBuilder()\n                    .append(SpacesAPI.Scheme.DEFAULT)\n                    .append(\"://\")\n                    .append(\"system/system\")\n                    .append(\"/\")\n                    .append(presenter.getFilePath())\n                    .append(\"/\")\n                    .append(presenter.getImportFileName())\n                    .toString();\n\n                return pathUrlFactory.getUploadFileUrl(path);\n            }\n\n            @Override\n            public String getUploadFileName() {\n                return presenter.getImportFileName();\n            }\n        });\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return root;\n    }\n\n    @Override\n    public void download(String path) {\n        DomGlobal.window.open(\n            pathUrlFactory.getDownloadFileUrl(path));\n    }\n\n    @Override\n    public void exportError(Throwable throwable) {\n        LOGGER.error(throwable.getMessage(), throwable);\n        workbenchNotification.fire(\n            new NotificationEvent(\n                i18n.exportError(),\n                NotificationEvent.NotificationType.ERROR));\n    }\n\n    @Override\n    public void importError(Throwable throwable) {\n        btnImport.disabled = true;\n        fileUploadEditor.view.clear();\n        LOGGER.error(throwable.getMessage(), throwable);\n        workbenchNotification.fire(\n            new NotificationEvent(\n                i18n.importError(),\n                NotificationEvent.NotificationType.ERROR));\n    }\n\n    @Override\n    public void importOK() {\n        btnImport.disabled = true;\n        fileUploadEditor.view.clear();\n        workbenchNotification.fire(\n            new NotificationEvent(\n                i18n.importOK(),\n                NotificationEvent.NotificationType.SUCCESS));\n    }\n\n    @Override\n    public void exportOK() {\n        workbenchNotification.fire(\n            new NotificationEvent(\n                i18n.exportOK(),\n                NotificationEvent.NotificationType.SUCCESS));\n    }\n\n    @EventHandler(\"btnImport\")\n    public void onImport(ClickEvent event) {\n        presenter.doImport();\n    }\n\n    @EventHandler(\"btnExport\")\n    public void onExport(ClickEvent event) {\n        presenter.doExport();\n    }\n    \n    @EventHandler(\"btnGradualExport\")\n    public void onGradualExport(ClickEvent event) {\n        presenter.doGradualExport();\n    }\n\n    void newFileUploaded(@Observes ValueChangeEvent<String> valueChangeEvent) {\n        if (valueChangeEvent.getContext() == fileUploadEditor) {\n            btnImport.disabled = false;\n        }\n    }\n\n    @Override\n    public void openUrl(String url) {\n        DomGlobal.window.open(url, \"_blank\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/DataSetsWizardPage.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.screen.transfer.export.wizard.widget.DataSetsTable;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.widgets.core.client.wizards.WizardPage;\n\n@ApplicationScoped\npublic class DataSetsWizardPage implements WizardPage {\n\n    @Inject\n    DataSetsTable dataSetsTable;\n\n    @Override\n    public Widget asWidget() {\n        return ElementWrapperWidget.getWidget(dataSetsTable.getElement());\n    }\n\n    @Override\n    public String getTitle() {\n        return \"Select Datasets\";\n    }\n\n    @Override\n    public void isComplete(Callback<Boolean> callback) {\n        callback.callback(true);\n    }\n\n    @Override\n    public void initialise() {}\n\n    @Override\n    public void prepareView() {\n        dataSetsTable.refresh();\n    }\n\n    public void setDataSets(List<DataSetDef> datasetDefinitions) {\n        dataSetsTable.setData(datasetDefinitions);\n    }\n\n    public List<DataSetDef> getSelectedDataSetDefs() {\n        return dataSetsTable.getSelectedData();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportSummaryWizardPage.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.transfer.ExportInfo;\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.dashbuilder.transfer.ExportModelValidationService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.ext.widgets.core.client.wizards.WizardPage;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static java.util.stream.Collectors.toList;\n\n@ApplicationScoped\npublic class ExportSummaryWizardPage implements WizardPage {\n\n    ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n\n    @Inject\n    View view;\n\n    @Inject\n    Caller<ExportModelValidationService> exportModelValidationService;\n\n    @Inject\n    private BusyIndicatorView busyIndicatorView;\n\n    ExportInfo exportInfo;\n\n    private Supplier<DataTransferExportModel> exportModelSupplier;\n    private ParameterizedCommand<DataTransferExportModel> dataTransferExportModelCallback;\n    private DataTransferExportModel exportModel;\n\n    private Command goToDataSetsCommand = () -> {\n    };\n\n    private Command goToPagesCommand = () -> {\n    };\n\n    private ParameterizedCommand<DataTransferExportModel> dataTransferOpenModelCallback;\n\n    public interface View extends UberElemental<ExportSummaryWizardPage> {\n\n        void success(DataTransferExportModel dataTransferExportModel);\n\n        void validationErrors(DataTransferExportModel dataTransferExportModel,\n                              Map<String, List<String>> pageDependencies);\n\n        void exportError(DataTransferExportModel dataTransferExportModel, String message);\n\n        void emptyState();\n\n        void validationError(Throwable error);\n\n        void showOpenExport(boolean externalServerAvailable);\n\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return ElementWrapperWidget.getWidget(view.getElement());\n    }\n\n    @Override\n    public String getTitle() {\n        return i18n.exportWizardTitle();\n    }\n\n    @Override\n    public void isComplete(Callback<Boolean> callback) {\n        callback.callback(true);\n    }\n\n    @Override\n    public void initialise() {\n        view.init(this);\n    }\n\n    @Override\n    public void prepareView() {\n        validateAndUpdateView();\n    }\n\n    public void setGoToDataSetsCommand(Command goToDatasets) {\n        this.goToDataSetsCommand = goToDatasets;\n    }\n\n    public void setGoToPagesCommand(Command goToPages) {\n        this.goToPagesCommand = goToPages;\n    }\n\n    public void setExportSummary(Supplier<DataTransferExportModel> exportModelSupplier) {\n        this.exportModelSupplier = exportModelSupplier;\n    }\n\n    public void setDownloadCallback(ParameterizedCommand<DataTransferExportModel> dataTransferExportModelCallback) {\n        this.dataTransferExportModelCallback = dataTransferExportModelCallback;\n    }\n    \n    public void setOpenCallback(ParameterizedCommand<DataTransferExportModel> dataTransferOpenModelCallback) {\n        this.dataTransferOpenModelCallback = dataTransferOpenModelCallback;\n    }\n\n    void confirmDownload() {\n        dataTransferExportModelCallback.execute(exportModel);\n    }\n    \n    public void openExport() {\n        dataTransferOpenModelCallback.execute(exportModel);\n    }\n\n    public void goToDataSetsPage() {\n        goToDataSetsCommand.execute();\n    }\n\n    public void goToPagesPage() {\n        goToPagesCommand.execute();\n    }\n\n    private void validateAndUpdateView() {\n        exportModel = exportModelSupplier.get();\n        view.showOpenExport(exportInfo.isExternalServerAvailable());\n        if (exportModel.getPages().isEmpty() && exportModel.getDatasetDefinitions().isEmpty()) {\n            view.exportError(exportModel, i18n.nothingToExport());\n            return;\n        }\n        if (exportModel.getPages().isEmpty()) {\n            view.exportError(exportModel, i18n.noPagesExported());\n            return;\n        }\n\n        view.emptyState();\n        busyIndicatorView.showBusyIndicator(i18n.validatingExport());\n        exportModelValidationService.call((Map<String, List<String>> validation) -> {\n            busyIndicatorView.hideBusyIndicator();\n            if (validation.isEmpty()) {\n                view.success(exportModel);\n            } else {\n                remapMissingDependencies(validation);\n                view.validationErrors(exportModel, validation);\n            }\n        }, (message, error) -> {\n            busyIndicatorView.hideBusyIndicator();\n            view.validationError(error);\n            return false;\n        }).checkMissingDatasets(exportModel);\n    }\n\n    void remapMissingDependencies(Map<String, List<String>> validation) {\n        if (exportInfo == null) {\n            return;\n        }\n        List<DataSetDef> datasets = exportInfo.getDatasetsDefinitions();\n        validation.replaceAll((page, deps) -> {\n            return deps.stream()\n                       .map(uuid -> datasets.stream()\n                                            .filter(ds -> ds.getUUID().equals(uuid))\n                                            .map(ds -> ds.getName()).findAny().orElse(uuid))\n                       .collect(toList());\n        });\n    }\n\n    public void setExportInfo(ExportInfo exportInfo) {\n        this.exportInfo = exportInfo;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportSummaryWizardPageView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#exportWizardSummary {\n    width: 100%;\n    height: 600px;\n}\n\n.assetsSummaryContainer {\n    text-align: left;\n    padding-top: 20px;\n}\n\n.errorMsg {\n    overflow: auto;\n    max-height: 120px;\n    text-align: left;\n    padding-left: 10px;\n    margin-top: 20px;\n}\n\n.summaryContainer {\n    background-color: transparent;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportSummaryWizardPageView.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div id=\"exportWizardSummary\">\n    <div class=\"blank-slate-pf summaryContainer\">\n        <div class=\"blank-slate-pf-icon\">\n            <span class=\"pficon pficon-ok\" id=\"iconSpan\"></span>\n        </div>\n        <h1 id=\"exportHeading\"></h1>\n\n        <div class=\"errorMsg alert alert-danger\" id=\"alertContainer\"></div>\n        <div class=\"assetsSummaryContainer\">\n            <h5 data-i18n-key=\"summary\"></h5>\n            <div class=\"list-group\">\n                <div class=\"list-group-item\">\n                    <span class=\"fa fa-database\"></span> <a href=\"#\"\n                        id=\"datasetsInfoAnchor\"> <span\n                        id=\"datasetsInformation\"></span></a>\n                </div>\n                <div class=\"list-group-item\">\n                    <span class=\"fa fa-file-text-o\"></span> <a href=\"#\"\n                        id=\"pagesInfoAnchor\"><span\n                        id=\"pagesInformation\"></span></a>\n                </div>\n                <div class=\"list-group-item\"\n                    id=\"navigationSummaryContainer\">\n                    <span class=\"fa fa-navicon\"></span> <span\n                        data-i18n-key=\"navigation\"></span>\n                </div>\n            </div>\n        </div>\n        <div class=\"blank-slate-pf-main-action\" id=\"actionsContainer\">\n            <button class=\"btn btn-primary btn-lg\" id=\"downloadExport\"\n                data-i18n-key=\"download\"></button>\n            <button class=\"btn btn-primary btn-lg\" id=\"openExport\"\n                data-i18n-key=\"open\"></button>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportSummaryWizardPageView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.dom.client.Style.VerticalAlign;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLHeadingElement;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.client.cms.screen.util.DomFactory;\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.client.views.pfly.widgets.HelpIcon;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Templated\n@ApplicationScoped\npublic class ExportSummaryWizardPageView implements ExportSummaryWizardPage.View {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ExportSummaryWizardPageView.class);\n\n    ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    HTMLDivElement exportWizardSummary;\n\n    @Inject\n    @DataField\n    @Named(\"span\")\n    HTMLElement datasetsInformation;\n\n    @Inject\n    @DataField\n    @Named(\"span\")\n    HTMLElement pagesInformation;\n\n    @Inject\n    @DataField\n    HTMLAnchorElement datasetsInfoAnchor;\n\n    @Inject\n    @DataField\n    HTMLAnchorElement pagesInfoAnchor;\n\n    @Inject\n    @DataField\n    HTMLButtonElement downloadExport;\n\n    @Inject\n    @DataField\n    HTMLButtonElement openExport;\n    \n    @Inject\n    @DataField\n    HTMLDivElement actionsContainer;\n\n    @Inject\n    @DataField\n    @Named(\"h1\")\n    HTMLHeadingElement exportHeading;\n\n    @Inject\n    @DataField\n    @Named(\"span\")\n    HTMLElement iconSpan;\n\n    @Inject\n    @DataField\n    HTMLDivElement alertContainer;\n\n    @Inject\n    @DataField\n    HTMLDivElement navigationSummaryContainer;\n\n    @Inject\n    DomFactory domFactory;\n\n    @Inject\n    Elemental2DomUtil elementalUtil;\n\n    @Inject\n    private Event<NotificationEvent> wbNotification;\n\n    private ExportSummaryWizardPage presenter;\n    \n    private HelpIcon openHelp;\n\n    @Override\n    public void init(ExportSummaryWizardPage presenter) {\n        this.presenter = presenter;\n        alertContainer.hidden = true;\n        \n        openHelp = new HelpIcon();\n        openHelp.setHelpContent(i18n.openHelpText());\n        openHelp.getElement().getStyle().setVerticalAlign(VerticalAlign.SUPER);\n        elementalUtil.appendWidgetToElement(actionsContainer, openHelp);\n\n        HelpIcon navigationhelp = new HelpIcon();\n        navigationhelp.setHelpContent(i18n.navigationHelpText());\n        elementalUtil.appendWidgetToElement(navigationSummaryContainer, navigationhelp);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return exportWizardSummary;\n    }\n\n    @EventHandler(\"downloadExport\")\n    public void downloadAction(ClickEvent click) {\n        presenter.confirmDownload();\n    }\n\n    @EventHandler(\"openExport\")\n    public void openAction(ClickEvent click) {\n        presenter.openExport();\n    }\n\n    @EventHandler(\"datasetsInfoAnchor\")\n    public void datasetsInfoAnchorClicked(ClickEvent click) {\n        presenter.goToDataSetsPage();\n    }\n\n    @EventHandler(\"pagesInfoAnchor\")\n    public void pagesInfoAnchorClicked(ClickEvent click) {\n        presenter.goToPagesPage();\n    }\n\n    @Override\n    public void success(DataTransferExportModel dataTransferExportModel) {\n        successState();\n        showSummary(dataTransferExportModel);\n    }\n\n    @Override\n    public void validationErrors(DataTransferExportModel dataTransferExportModel,\n                                 Map<String, List<String>> pageDependencies) {\n        errorState();\n\n        Element errorHeader = domFactory.element(\"strong\");\n        errorHeader.textContent = i18n.missingDependencies();\n        alertContainer.appendChild(errorHeader);\n\n        Element pageList = domFactory.element(\"ul\");\n        pageDependencies.forEach((page, ds) -> {\n            Element li = domFactory.listItem(i18n.pageMissingDataSets(page));\n            li.appendChild(pageMissingDataSetsList(ds));\n            pageList.appendChild(li);\n        });\n        alertContainer.appendChild(pageList);\n\n        showSummary(dataTransferExportModel);\n    }\n\n    @Override\n    public void exportError(DataTransferExportModel dataTransferExportModel, String warningMessage) {\n        errorState();\n        alertContainer.textContent = warningMessage;\n        showSummary(dataTransferExportModel);\n    }\n\n    private void showSummary(DataTransferExportModel dataTransferExportModel) {\n        pagesInformation.textContent = checkPlural(dataTransferExportModel.getPages().size(),\n                                                   i18n.pageLabel(),\n                                                   i18n.pagesLabel());\n        datasetsInformation.textContent = checkPlural(dataTransferExportModel.getDatasetDefinitions().size(),\n                                                      i18n.datasetLabel(),\n                                                      i18n.datasetsLabel());\n    }\n\n    private String checkPlural(int size, String text, String pluralText) {\n        String result = size + \" \";\n        return size == 1 ? result + text : result + pluralText;\n    }\n\n    private Element pageMissingDataSetsList(List<String> datasets) {\n        Element list = domFactory.element(\"ul\");\n        datasets.stream().map(domFactory::listItem).forEach(list::appendChild);\n        return list;\n    }\n\n    @Override\n    public void emptyState() {\n        state(\"pficon-running\",\n              \"\",\n              true,\n              true);\n        pagesInformation.textContent = \"\";\n        datasetsInformation.textContent = \"\";\n    }\n\n    @Override\n    public void validationError(Throwable throwable) {\n        LOGGER.error(throwable.getMessage(), throwable);\n        wbNotification.fire(new NotificationEvent(i18n.validationError(),\n                                                  NotificationEvent.NotificationType.ERROR));\n    }\n    \n    @Override\n    public void showOpenExport(boolean externalServerAvailable) {\n        openExport.style.visibility = externalServerAvailable ? \"visible\" : \"hidden\";\n        openHelp.setVisible(externalServerAvailable);\n    }\n\n    private void errorState() {\n        state(\"pficon pficon-error-circle-o\",\n              i18n.exportWizardHeadingError(),\n              false,\n              true);\n        alertContainer.innerHTML = \"\";\n    }\n\n    private void successState() {\n        state(\"pficon pficon-ok\",\n              i18n.exportWizardHeadingSuccess(),\n              true,\n              false);\n    }\n\n    private void state(String iconSpanClass,\n                       String headingText,\n                       boolean hideAlert,\n                       boolean hideDownload) {\n        iconSpan.className = iconSpanClass;\n        exportHeading.textContent = headingText;\n        alertContainer.hidden = hideAlert;\n        downloadExport.disabled = hideDownload;\n        openExport.disabled = hideDownload;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportWizard.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.transfer.ExportInfo;\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.widgets.core.client.wizards.AbstractWizard;\nimport org.uberfire.ext.widgets.core.client.wizards.WizardPage;\nimport org.uberfire.ext.widgets.core.client.wizards.WizardPageSelectedEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@ApplicationScoped\npublic class ExportWizard extends AbstractWizard {\n    \n    ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n\n    @Inject\n    DataSetsWizardPage dataSetsWizardPage;\n\n    @Inject\n    PagesWizardPage pagesWizardPage;\n\n    @Inject\n    ExportSummaryWizardPage exportSummaryWizardPage;\n\n    @Inject\n    Event<WizardPageSelectedEvent> wizardPageSelectedEvent;\n\n    private List<WizardPage> wizardPages;\n\n    private boolean canConclude;\n\n    @PostConstruct\n    void init() {\n        wizardPages = new ArrayList<>();\n        wizardPages.add(dataSetsWizardPage);\n        wizardPages.add(pagesWizardPage);\n        wizardPages.add(exportSummaryWizardPage);\n\n        exportSummaryWizardPage.setExportSummary(this::getDataTransferExportModel);\n        exportSummaryWizardPage.setGoToDataSetsCommand(() -> goTo(dataSetsWizardPage));\n        exportSummaryWizardPage.setGoToPagesCommand(() -> goTo(pagesWizardPage));\n    }\n\n    public void start(ExportInfo exportInfo) {\n        dataSetsWizardPage.setDataSets(exportInfo.getDatasetsDefinitions());\n        pagesWizardPage.setPages(exportInfo.getPages());\n        exportSummaryWizardPage.setExportInfo(exportInfo);\n        this.start();\n    }\n\n    @Override\n    public List<WizardPage> getPages() {\n        return wizardPages;\n    }\n\n    @Override\n    public Widget getPageWidget(int pageNumber) {\n        return wizardPages.get(pageNumber).asWidget();\n    }\n\n    @Override\n    public String getTitle() {\n        return i18n.exportWizardTitle();\n    }\n\n    @Override\n    public int getPreferredWidth() {\n        return 900;\n    }\n\n    @Override\n    public int getPreferredHeight() {\n        return 600;\n    }\n\n    @Override\n    public void isComplete(Callback<Boolean> callback) {\n        callback.callback(canConclude);\n    }\n\n    private void goTo(WizardPage page) {\n        wizardPageSelectedEvent.fire(new WizardPageSelectedEvent(page));\n    }\n\n    public DataTransferExportModel getDataTransferExportModel() {\n        return new DataTransferExportModel(dataSetsWizardPage.getSelectedDataSetDefs(),\n                                           pagesWizardPage.getSelectedPages(),\n                                           true);\n    }\n\n    public void setDownloadCallback(ParameterizedCommand<DataTransferExportModel> dataTransferExportModelCallback) {\n        exportSummaryWizardPage.setDownloadCallback(dataTransferExportModelCallback);\n    }\n    \n    public void setOpenCallback(ParameterizedCommand<DataTransferExportModel> dataTransferExportModelCallback) {\n        exportSummaryWizardPage.setOpenCallback(dataTransferExportModelCallback);\n    }\n    \n    @Override\n    public void pageSelected(int pageNumber) {\n        super.pageSelected(pageNumber);\n        WizardPage page = getPages().get(pageNumber);\n        page.prepareView();\n        this.canConclude = page == exportSummaryWizardPage;\n        checkPagesState();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/PagesWizardPage.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.screen.transfer.export.wizard.widget.PagesTable;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.widgets.core.client.wizards.WizardPage;\n\n@ApplicationScoped\npublic class PagesWizardPage implements WizardPage {\n\n    @Inject\n    PagesTable pagesTable;\n\n    @Override\n    public Widget asWidget() {\n        return ElementWrapperWidget.getWidget(pagesTable.getElement());\n    }\n\n    @Override\n    public String getTitle() {\n        return \"Select Pages\";\n    }\n\n    @Override\n    public void isComplete(Callback<Boolean> callback) {\n        callback.callback(true);\n    }\n\n    @Override\n    public void initialise() {\n        // EMPTY\n    }\n\n    @Override\n    public void prepareView() {\n        pagesTable.refresh();\n    }\n\n    public void setPages(List<String> pages) {\n        pagesTable.setData(pages);\n    }\n\n    public List<String> getSelectedPages() {\n        return pagesTable.getSelectedData();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/AssetsTableAbstractPresenter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard.widget;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\n\npublic abstract class AssetsTableAbstractPresenter<T> implements AssetsTableView.Presenter<T> {\n\n    @Inject\n    AssetsTableView view;\n\n    @Inject\n    ManagedInstance<AssetsTableView> viewManagedInstance;\n\n    private List<T> data;\n\n    @PostConstruct\n    public void init() {\n        view = viewManagedInstance.get();\n        view.init(this);\n    }\n\n    @Override\n    public List<T> getData() {\n        return data;\n    }\n\n    @Override\n    public void setData(List<T> data) {\n        this.data = data;\n        view.update();\n    }\n\n    @Override\n    public List<T> getSelectedData() {\n        return (List<T>) view.getSelectedAssets();\n    }\n\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n    \n    public void refresh() {\n        view.clearFilter();\n    }\n\n    @PreDestroy\n    public void destroyView() {\n        viewManagedInstance.destroyAll();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/AssetsTableView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#assetTableWidgetRoot {\n    overflow: scroll;\n    max-width: 680px;\n    max-height: 600px;\n    min-height: 600px;\n}\n\n.assets-table>thead>tr>th:first-child {\n    width: 5%;\n}\n\n.assets-table>tbody>tr>td:first-child {\n    width: 5%;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/AssetsTableView.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"assetTableWidgetRoot\">\n    <!--  Assets Filter -->\n    <div class=\"filter-pf\" id=\"input-filters\">\n        <div class=\"filter-pf-fields\">\n            <div class=\"input-group form-group\">\n                <input type=\"text\" id=\"searchAssets\"\n                    class=\"form-control\" value=\"\" placeholder=\"Filter\">\n            </div>\n        </div>\n    </div>\n    <!-- Assets Table -->\n    <table\n        class=\"table table-striped table-bordered table-hover assets-table\"\n        id=\"assetsTable\">\n        <thead>\n            <tr id=\"assetsTableHeaderRow\">\n                <th><input type=\"checkbox\" id=\"selectAllAssets\"\n                    checked=\"checked\" /></th>\n            </tr>\n        </thead>\n        <tbody id=\"assetsTableBody\">\n        </tbody>\n    </table>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/AssetsTableView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard.widget;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLCollection;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.HTMLTableCellElement;\nimport elemental2.dom.HTMLTableElement;\nimport elemental2.dom.HTMLTableRowElement;\nimport elemental2.dom.NodeList;\nimport org.dashbuilder.client.cms.screen.util.DomFactory;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElemental;\n\n@Dependent\n@Templated\npublic class AssetsTableView implements UberElemental<AssetsTableView.Presenter> {\n\n    @Inject\n    DomFactory domFactory;\n\n    @Inject\n    @DataField\n    HTMLDivElement assetTableWidgetRoot;\n\n    @Inject\n    @DataField\n    HTMLInputElement searchAssets;\n\n    @Inject\n    @DataField\n    HTMLTableElement assetsTable;\n\n    @Inject\n    @DataField\n    HTMLInputElement selectAllAssets;\n\n    @Inject\n    @DataField\n    HTMLTableRowElement assetsTableHeaderRow;\n\n    Presenter presenter;\n\n    public interface Presenter<T> {\n\n        List<T> getData();\n\n        List<T> getSelectedData();\n\n        String[] getHeaders();\n\n        String[] toRow(T t);\n\n        void setData(List<T> data);\n\n        default String[][] rows() {\n            List<T> data = getData();\n            String[][] rows = new String[data.size()][];\n            for (int i = 0; i < rows.length; i++) {\n                rows[i] = toRow(data.get(i));\n            }\n            return rows;\n        }\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n        buildHeaders(presenter.getHeaders());\n    }\n\n    public void update() {\n        assetsTable.tBodies.getAt(0).innerHTML = \"\";\n        selectAllAssets.checked = true;\n        Arrays.stream(presenter.rows())\n              .map(this::toRow)\n              .forEach(this::appendRow);\n    }\n\n    public List<?> getSelectedAssets() {\n        List<?> data = presenter.getData();\n        HTMLCollection<HTMLTableRowElement> rows = assetsTable.tBodies.getAt(0).rows;\n        return IntStream.range(0, rows.getLength())\n                        .filter(i -> {\n                            Element checkBox = rows.getAt(i).querySelector(\"td > input[type=checkbox]\");\n                            return ((HTMLInputElement) checkBox).checked;\n                        }).mapToObj(data::get)\n                        .collect(Collectors.toList());\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return assetTableWidgetRoot;\n    }\n\n    @EventHandler(\"selectAllAssets\")\n    void selectAll(ClickEvent event) {\n        allInputsForTable().forEach(chk -> chk.checked = selectAllAssets.checked);\n    }\n\n    @EventHandler(\"searchAssets\")\n    void onFilter(KeyUpEvent keyDown) {\n        filterTable();\n    }\n\n    public void clearFilter() {\n        searchAssets.value = \"\";\n        filterTable();\n    }\n\n    void appendRow(HTMLTableRowElement row) {\n        assetsTable.tBodies.getAt(0).appendChild(row);\n    }\n\n    HTMLTableRowElement toRow(String[] cells) {\n        HTMLTableRowElement row = domFactory.tableRow();\n\n        // first cell is always a check box\n        row.appendChild(createRowSelectorCell());\n\n        Arrays.stream(cells)\n              .map(this::createCell)\n              .forEach(row::appendChild);\n        return row;\n    }\n\n    void filterTable() {\n        String query = searchAssets.value.trim().toLowerCase();\n        HTMLCollection<HTMLTableRowElement> rows = assetsTable.tBodies.getAt(0).rows;\n        IntStream.range(0, rows.getLength()).mapToObj(rows::getAt).forEach(row -> {\n            row.hidden = false;\n            if (!query.isEmpty()) {\n                row.hidden = IntStream.range(0, row.cells.getLength())\n                                      .mapToObj(row.cells::getAt)\n                                      .noneMatch(c -> c.textContent.toLowerCase().contains(query));\n            }\n\n        });\n    }\n\n    private HTMLInputElement createCheckBox() {\n        HTMLInputElement checkbox = domFactory.input();\n        checkbox.type = \"checkbox\";\n        checkbox.checked = true;\n        return checkbox;\n    }\n\n    private HTMLTableCellElement createCell(String content) {\n        HTMLTableCellElement cell = domFactory.tableCell();\n        cell.innerHTML = content;\n        return cell;\n    }\n\n    private Element createHeaderCell(String content) {\n        Element cell = domFactory.element(\"th\");\n        cell.innerHTML = content;\n        return cell;\n    }\n\n    private HTMLTableCellElement createRowSelectorCell() {\n        HTMLTableCellElement tableCell = domFactory.tableCell();\n        HTMLInputElement rowChk = createCheckBox();\n        rowChk.onclick = e -> {\n            selectAllAssets.checked = allInputsForTable().allMatch(input -> rowChk.checked);\n            return null;\n        };\n        tableCell.appendChild(rowChk);\n        return tableCell;\n    }\n\n    private Stream<HTMLInputElement> allInputsForTable() {\n        // asArray throws cast exception\n        NodeList<Element> items = assetsTable.querySelectorAll(\"tbody > tr > td:first-of-type > input[type=checkbox]\");\n        return IntStream.range(0, items.getLength()).mapToObj(i -> (HTMLInputElement) items.getAt(i));\n    }\n\n    private void buildHeaders(String[] headers) {\n        Arrays.stream(headers)\n              .map(this::createHeaderCell)\n              .forEach(assetsTableHeaderRow::appendChild);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/DataSetsTable.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard.widget;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n@ApplicationScoped\npublic class DataSetsTable extends AssetsTableAbstractPresenter<DataSetDef> {\n\n    private static final String[] HEADERS = {\"UUID\", \"Name\", \"Type\"};\n\n    @Override\n    public String[] getHeaders() {\n        return HEADERS;\n    }\n\n    @Override\n    public String[] toRow(DataSetDef dataSetDef) {\n        return new String[]{\n                            dataSetDef.getUUID(),\n                            dataSetDef.getName(),\n                            dataSetDef.getProvider().getName()\n        };\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/PagesTable.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard.widget;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class PagesTable extends AssetsTableAbstractPresenter<String> {\n\n    private static final String[] HEADERS = {\"Name\"};\n\n    @Override\n    public String[] getHeaders() {\n        return HEADERS;\n    }\n\n    @Override\n    public String[] toRow(String t) {\n        return new String[]{t};\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/screen/util/DomFactory.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.util;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.HTMLTableCellElement;\nimport elemental2.dom.HTMLTableRowElement;\n\n/**\n * Create DOM Elements. Can be mocked in tests.\n *\n */\n@ApplicationScoped\npublic class DomFactory {\n\n    public Element element(String elementType) {\n        return DomGlobal.document.createElement(elementType);\n    }\n    \n    public Element listItem(String text) {\n        Element li = DomGlobal.document.createElement(\"li\");\n        li.textContent = text;\n        return li;\n    }\n\n    public HTMLInputElement input() {\n        return (HTMLInputElement) DomGlobal.document.createElement(\"input\");\n    }\n\n    public HTMLTableCellElement tableCell() {\n        return (HTMLTableCellElement) DomGlobal.document.createElement(\"td\");\n    }\n\n    public HTMLTableRowElement tableRow() {\n        return (HTMLTableRowElement) DomGlobal.document.createElement(\"tr\");\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/NewPerspectivePopUp.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.widget;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.exception.PluginAlreadyExists;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@ApplicationScoped\npublic class NewPerspectivePopUp implements IsElement {\n\n    public interface View extends UberElement<NewPerspectivePopUp> {\n\n        void show();\n\n        void hide();\n\n        String getName();\n\n        String getStyle();\n\n        void errorEmptyName();\n\n        void errorInvalidName();\n\n        void errorDuplicatedName();\n    }\n\n    private Caller<PerspectiveServices> perspectiveServices;\n    private PlaceManager placeManager;\n    private PluginNameValidator pluginNameValidator;\n    private NewPerspectivePopUpView view;\n\n    // For proxying\n    protected NewPerspectivePopUp() {\n    }\n\n    @Inject\n    public NewPerspectivePopUp(NewPerspectivePopUpView view,\n                               Caller<PerspectiveServices> perspectiveServices,\n                               PluginNameValidator pluginNameValidator,\n                               PlaceManager placeManager) {\n        this.view = view;\n        this.perspectiveServices = perspectiveServices;\n        this.pluginNameValidator = pluginNameValidator;\n        this.placeManager = placeManager;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    protected PlaceRequest getPathPlaceRequest(Plugin response) {\n        return new PathPlaceRequest(response.getPath())\n                .addParameter(\"name\", response.getName());\n    }\n\n    public void show() {\n        view.show();\n    }\n\n    public void hide() {\n        view.hide();\n    }\n\n    // View actions\n\n    public void onOK() {\n        String layoutName = view.getName();\n        LayoutTemplate.Style layoutStyle = LayoutTemplate.Style.valueOf(view.getStyle());\n\n        pluginNameValidator.validate(layoutName + \".plugin\",\n                new ValidatorWithReasonCallback() {\n                    @Override\n                    public void onFailure(final String reason) {\n                        if (ValidationErrorReason.EMPTY_NAME.name().equals(reason)) {\n                            view.errorEmptyName();\n                        } else if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {\n                            view.errorDuplicatedName();\n                        } else {\n                            view.errorInvalidName();\n                        }\n                    }\n\n                    @Override\n                    public void onSuccess() {\n                        perspectiveServices.call(\n                            (Plugin response) -> {\n                                placeManager.goTo(getPathPlaceRequest(response));\n                                hide();\n                            },\n                            (message, throwable) -> {\n                                if (throwable instanceof PluginAlreadyExists) {\n                                    view.errorDuplicatedName();\n                                } else {\n                                    view.errorInvalidName();\n                                }\n                                return false;\n                            }\n                        ).createNewPerspective(layoutName, layoutStyle);\n                    }\n\n                    @Override\n                    public void onFailure() {\n                        view.errorInvalidName();\n                    }\n                });\n    }\n\n    public void onCancel() {\n        hide();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/NewPerspectivePopUpView.css",
    "content": ".uf-np-popup-name-label {\n  margin-right: 5px;\n}\n\n.uf-np-popup-name-input {\n  width: 150px;\n}\n\n.uf-np-popup-style-label {\n  margin-right: 5px;\n}\n\n.uf-np-popup-style-select {\n  width: 150px;\n  height: 25px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/NewPerspectivePopUpView.html",
    "content": "<!--\n  ~ Copyright 2017 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div>\n  <div data-field=\"body\">\n    <form class=\"form-horizontal\">\n      <div data-field=\"formDiv\" class=\"form-group\">\n        <label class=\"col-md-3 control-label\">\n          <span class=\"uf-np-popup-name-label\" data-field=\"nameLabel\">Name!</span>\n          <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\"><span data-field=\"nameHelp\" class=\"fa fa-info-circle\"></span></a>\n        </label>\n        <div class=\"dropdown col-md-4\">\n          <input data-field=\"nameInput\" class=\"form-control uf-np-popup-name-input\">\n        </div>\n        <span data-field=\"nameErrorLabel\" class=\"help-block\"></span>\n      </div>\n      <div class=\"form-group\">\n        <label class=\"col-md-3 control-label\">\n          <span class=\"uf-np-popup-style-label\" data-field=\"styleLabel\">Style!</span>\n          <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\"><span data-field=\"styleHelp\" class=\"fa fa-info-circle\"></span></a>\n        </label>\n        <div class=\"dropdown col-md-4\">\n          <select data-field=\"styleSelect\" class=\"form-control uf-np-popup-style-select\">\n            <option value=\"FLUID\" selected data-field=\"fluidOption\">Fluid!</option>\n            <option value=\"PAGE\" data-field=\"pageOption\">Page!</option>\n          </select>\n        </div>\n      </div>\n    </form>\n  </div>\n  <div data-field=\"footer\">\n    <button data-field=\"cancelButton\" type=\"button\" class=\"btn btn-default\">Cancel!</button>\n    <button data-field=\"okButton\" type=\"button\" class=\"btn btn-primary\">Ok!</button>\n  </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/NewPerspectivePopUpView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.user.client.Event;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.Option;\nimport org.jboss.errai.common.client.dom.Select;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\n\n@Templated\n@Dependent\npublic class NewPerspectivePopUpView implements NewPerspectivePopUp.View, IsElement {\n\n    NewPerspectivePopUp presenter;\n    BaseModal modal;\n    ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n    ContentManagerConstants i18n = ContentManagerConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    Div body;\n\n    @Inject\n    @DataField\n    Div footer;\n\n    @Inject\n    @DataField\n    Div formDiv;\n\n    @DataField\n    @Inject\n    Input nameInput;\n\n    @DataField\n    @Inject\n    Span nameLabel;\n\n    @DataField\n    @Inject\n    Span nameHelp;\n\n    @Inject\n    @DataField\n    Span nameErrorLabel;\n\n    @DataField\n    @Inject\n    Select styleSelect;\n\n    @DataField\n    @Inject\n    Span styleLabel;\n\n    @DataField\n    @Inject\n    Span styleHelp;\n\n    @DataField\n    @Inject\n    Option fluidOption;\n\n    @DataField\n    @Inject\n    Option pageOption;\n\n    @DataField\n    @Inject\n    Button okButton;\n\n    @DataField\n    @Inject\n    Button cancelButton;\n\n    @Override\n    public void init(NewPerspectivePopUp presenter) {\n        this.presenter = presenter;\n\n        modal = new CommonModalBuilder()\n                .addHeader(i18n.newPerspectivePopUpViewTitle())\n                .addBody(body)\n                .addFooter(footer)\n                .build();\n\n        modal.addHiddenHandler(hiddenEvent -> {\n            if (ButtonPressed.CLOSE.equals(buttonPressed)) {\n                presenter.onCancel();\n            }\n        });\n    }\n\n    public Modal getModal() {\n        return modal;\n    }\n\n    @Override\n    public void show() {\n        nameInput.setValue(\"\");\n        nameErrorLabel.setTextContent(\"\");\n        formDiv.setClassName(\"form-group\");\n        fluidOption.setSelected(true);\n        pageOption.setSelected(false);\n\n        nameLabel.setTextContent(i18n.newPerspectivePopUpViewName());\n        nameHelp.setTitle(i18n.newPerspectivePopUpViewNameHelp());\n        styleLabel.setTextContent(i18n.newPerspectivePopUpViewStyle());\n        styleHelp.setTitle(i18n.newPerspectivePopUpViewStyleHelp());\n        okButton.setTextContent(i18n.newPerspectivePopUpViewOk());\n        cancelButton.setTextContent(i18n.newPerspectivePopUpViewCancel());\n        fluidOption.setTextContent(i18n.newPerspectivePopUpViewFluid());\n        pageOption.setTextContent(i18n.newPerspectivePopUpViewPage());\n\n        modal.setTitle(i18n.newPerspectivePopUpViewTitle());\n        modal.show();\n        nameInput.focus();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public String getName() {\n        return nameInput.getValue();\n    }\n\n    @Override\n    public String getStyle() {\n        String val = styleSelect.getValue();\n        return val;\n    }\n\n    @Override\n    public void errorEmptyName() {\n        showNameError(i18n.newPerspectivePopUpViewErrorEmptyName());\n    }\n\n    @Override\n    public void errorInvalidName() {\n        showNameError(i18n.newPerspectivePopUpViewErrorInvalidName());\n    }\n\n    @Override\n    public void errorDuplicatedName() {\n        showNameError(i18n.newPerspectivePopUpViewErrorDuplicatedName());\n    }\n\n    private void showNameError(String error) {\n        formDiv.setClassName(\"form-group has-error\");\n        nameErrorLabel.setTextContent(error);\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"okButton\")\n    public void okClick(final Event event) {\n        buttonPressed = ButtonPressed.OK;\n        presenter.onOK();\n    }\n    \n    @SinkNative(Event.ONMOUSEDOWN)\n    @EventHandler(\"nameInput\")\n    public void nameInputEnter(final Event event) {\n        if (event.getKeyCode() == KeyCodes.KEY_ENTER) {\n            buttonPressed = ButtonPressed.OK;\n            presenter.onOK();\n        }\n    }\n\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"cancelButton\")\n    public void cancelClick(final Event event) {\n        buttonPressed = ButtonPressed.CANCEL;\n        presenter.onCancel();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectiveWidget.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n/**\n * Runtime perspective widget\n */\n@Dependent\npublic class PerspectiveWidget implements IsWidget {\n\n    public interface View extends UberView<PerspectiveWidget> {\n\n        void showContent(IsWidget widget);\n\n        void notFoundError();\n\n        void infiniteRecursionError();\n\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    String perspectiveId;\n\n    @Inject\n    public PerspectiveWidget(View view, PerspectivePluginManager perspectivePluginManager) {\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void showPerspective(String id) {\n        perspectiveId = id;\n        if (id == null || !perspectivePluginManager.existsPerspectivePlugin(id)) {\n            view.notFoundError();\n        } else {\n            perspectivePluginManager.buildPerspectiveWidget(id, view::showContent, this::onDeadlock);\n        }\n    }\n\n    private void onDeadlock(LayoutRecursionIssue issue) {\n        view.infiniteRecursionError();\n    }\n\n    private void refreshPerspective(Plugin plugin) {\n        if (perspectiveId != null && perspectiveId.equals(plugin.getName())) {\n            showPerspective(perspectiveId);\n        }\n    }\n\n    // Capture changes on the perspective\n\n    public void onPlugInSaved(@Observes final PluginSaved event) {\n        refreshPerspective(event.getPlugin());\n    }\n\n    public void onPlugInDeleted(@Observes final PluginDeleted event) {\n        refreshPerspective(event.getPlugin());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectiveWidgetView.html",
    "content": "<div data-field=\"mainDiv\"></div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectiveWidgetView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerConstants;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.CSSStyleDeclaration;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\n\npublic class PerspectiveWidgetView implements PerspectiveWidget.View, IsWidget {\n\n    FlowPanel mainPanel = new FlowPanel();\n    PerspectiveWidget presenter;\n    AlertBox alertBox;\n\n    @Inject\n    public PerspectiveWidgetView(AlertBox alertBox) {\n        this.alertBox = alertBox;\n        alertBox.setLevel(AlertBox.Level.WARNING);\n        alertBox.setCloseEnabled(false);\n        CSSStyleDeclaration style = alertBox.getElement().getStyle();\n        style.setProperty(\"width\", \"30%\");\n        style.setProperty(\"margin\", \"10px\");\n    }\n\n    @Override\n    public void init(PerspectiveWidget presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return mainPanel;\n    }\n\n    @Override\n    public void showContent(IsWidget widget) {\n        mainPanel.clear();\n        mainPanel.add(widget);\n    }\n\n    @Override\n    public void notFoundError() {\n        alertBox.setMessage(ContentManagerConstants.INSTANCE.perspectiveDragNotFoundError());\n        mainPanel.clear();\n        mainPanel.add(ElementWrapperWidget.getWidget(alertBox.getElement()));\n    }\n\n    @Override\n    public void infiniteRecursionError() {\n        alertBox.setMessage(ContentManagerConstants.INSTANCE.perspectiveInfiniteRecursionError());\n        mainPanel.clear();\n        mainPanel.add(ElementWrapperWidget.getWidget(alertBox.getElement()));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectivesExplorer.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.navigation.event.PerspectivePluginsChangedEvent;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@Dependent\npublic class PerspectivesExplorer implements IsElement {\n\n    public interface View extends UberElement<PerspectivesExplorer> {\n\n        void clear();\n\n        void addPerspective(String name, Command onClicked);\n\n        void showEmpty(String message);\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    PlaceManager placeManager;\n    PluginController pluginController;\n    ContentManagerI18n i18n;\n\n    @Inject\n    public PerspectivesExplorer(View view,\n                                PerspectivePluginManager perspectivePluginManager,\n                                PluginController pluginController,\n                                PlaceManager placeManager,\n                                ContentManagerI18n i18n) {\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.pluginController = pluginController;\n        this.placeManager = placeManager;\n        this.i18n = i18n;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void show() {\n        view.clear();\n\n        perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> {\n\n            List<Plugin> filteredPlugins = perspectivePlugins.stream()\n                    .filter(pluginController::canRead)\n                    .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName()))\n                    .collect(Collectors.toList());\n\n\n            if (filteredPlugins.isEmpty()) {\n                view.showEmpty(i18n.getNoPerspectives());\n            } else {\n                filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p)));\n            }\n        });\n    }\n\n    public void onPerspectiveClick(Plugin plugin) {\n        PlaceRequest placeRequest = new PathPlaceRequest(plugin.getPath()).addParameter(\"name\", plugin.getName());\n        placeManager.goTo(placeRequest);\n    }\n\n    public void onPerspectivePluginsChanged(@Observes final PerspectivePluginsChangedEvent event) {\n        show();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectivesExplorerView.css",
    "content": ".uf-cms-perspectives-panel {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectivesExplorerView.html",
    "content": "<div data-field=\"perspectivesDiv\" class=\"list-group list-view-pf uf-cms-perspectives-panel\">\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/java/org/dashbuilder/client/cms/widget/PerspectivesExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class PerspectivesExplorerView implements IsElement, PerspectivesExplorer.View {\n\n    @Inject\n    @DataField\n    Div perspectivesDiv;\n\n    PerspectivesExplorer presenter;\n\n    @Override\n    public void init(PerspectivesExplorer presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        DOMUtil.removeAllChildren(perspectivesDiv);\n    }\n\n    private DivElement createItemDiv(Element[] items) {\n        DivElement mi = Document.get().createDivElement();\n        mi.setClassName(\"list-view-pf-main-info\");\n        mi.getStyle().setPaddingTop(5, Style.Unit.PX);\n        mi.getStyle().setPaddingBottom(5, Style.Unit.PX);\n        for (Element item : items) {\n            mi.appendChild(item);\n        }\n\n        DivElement gi = Document.get().createDivElement();\n        gi.setClassName(\"list-group-item\");\n        gi.appendChild(mi);\n        return gi;\n    }\n\n    @Override\n    public void addPerspective(String name, Command onClicked) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.getStyle().setCursor(Style.Cursor.POINTER);\n        anchor.getStyle().setColor(\"black\");\n        anchor.getStyle().setProperty(\"fontSize\", \"larger\");\n        anchor.setInnerText(name);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if (Event.ONCLICK == event.getTypeInt()) {\n                onClicked.execute();\n            }\n        });\n\n        SpanElement icon = Document.get().createSpanElement();\n        icon.getStyle().setMarginRight(10, Style.Unit.PX);\n        icon.setClassName(\"fa fa-file-text-o\");\n        icon.getStyle().setProperty(\"fontSize\", \"larger\");\n\n        DivElement gi = createItemDiv(new Element[]{icon, anchor});\n        perspectivesDiv.appendChild((Node) gi);\n    }\n\n    @Override\n    public void showEmpty(String message) {\n        SpanElement span = Document.get().createSpanElement();\n        span.setInnerText(message);\n        DivElement gi = createItemDiv(new Element[]{span});\n        perspectivesDiv.appendChild((Node) gi);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/ContentManagerClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name='org.jboss.errai.ioc.Container'/>\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginClient\"/>\n\n  <inherits name=\"org.dashbuilder.CommonClient\"/>\n  <inherits name=\"org.dashbuilder.NavigationClient\"/>\n  <inherits name=\"org.dashbuilder.ServicesAPI\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ncontentExplorerNew=New\ncontentExplorerNavigation=Navigation\ncontentExplorerTopMenu=Top Menu\nnavigationTreeItem=Navigation Tree\ncontentManagerHome=Content Manager\ncontentManagerHomeTitle=Content Management\ncontentManagerHomeWelcome=From here you can create & customize both the application content and its navigation menus.\ncontentManagerHomeCreate=You can start by creating a\ncontentManagerHomeNewPerspective=new {0}\ncontentManagerNavigationChanged=Navigation changed succesfully\ncomponentPalette=Components\npropertiesEditor=Properties\nperspective=page\nperspectives=pages\nnoPerspectives=No pages\nperspectiveDragComponent=Page\nperspectiveDragComponentHeader=Page Selector\nperspectiveDragComponentHelp=The selected page will be fully displayed inside the component''s display area.\nperspectiveDragSelectorHint=- Select Page -\nperspectiveDragSelectorLabel=Page\nperspectiveDragNotFoundError=The page is either not configured or not found.\nperspectiveInfiniteRecursionError=The content is not displayed to avoid an infinite loop. In general the page you selected for this component must not contain references (directly nor indirectly) to this page.\nnewPerspectivePopUpViewName=Name\nnewPerspectivePopUpViewNameHelp=The name of the page. Please make sure is not empty and it doesn''t already exist.\nnewPerspectivePopUpViewStyle=Style\nnewPerspectivePopUpViewStyleHelp=The ''Fluid'' option acts more as a classical web page, showing a vertical scrollbar when the page exceeds the available height. Select ''Page'' only if you want to force the page to always fit the window''s 100% height.\nnewPerspectivePopUpViewFluid=Fluid\nnewPerspectivePopUpViewPage=Page\nnewPerspectivePopUpViewCancel=Cancel\nnewPerspectivePopUpViewOk=Ok\nnewPerspectivePopUpViewTitle=New Page ...\nnewPerspectivePopUpViewErrorEmptyName=Name is mandatory\nnewPerspectivePopUpViewErrorInvalidName=Invalid page name\nnewPerspectivePopUpViewErrorDuplicatedName=Page name already exists\nworkbenchPartTitle=Dashbuilder Data Transfer\nDataTransferView.import=Import\nDataTransferView.export=Export all\nDataTransferView.gradualExport=Custom export\ndataTransferPopUpViewTitle=Dashbuilder Data Transfer\nimportResultMessageOK=Data uploaded successfully, {0} files imported.\nimportResultMessageNoData=No data available on Zip archive.\nexportOK=Data exported successfully.\nimportOK=Data imported successfully.\nexportError=Data export error. Check logs for more details.\nimportError=Data import error. Check logs for more details.\nexportText=Export dashbuilder related data (datasets, perspectives and navigation) to a ZIP file.\nimportText=Import dashbuilder related data (datasets, perspectives and navigation) from a ZIP file.\ndataTransferExportPopUpViewTitle=Select Assets to Export\ndataTransferExportError=Error retrieving list of assets to export\nloadAssetsToExport=Export Wizard\npageLabel=page\ndatasetLabel=dataset\npagesLabel=pages\ndatasetsLabel=datasets\nExportSummaryWizardPageView.download=Download\nExportSummaryWizardPageView.open=Open\nExportSummaryWizardPageView.navigation=Navigation\nExportSummaryWizardPageView.errorHighlightedMessage=Missing Dependencies!\nExportSummaryWizardPageView.summary=Summary\nexportWizardTitle=Export Wizard\nloadingExportWizard=Loading Export Wizard\npreparingExportDownload=Preparing Export Download\npageMissingDataSets=Page {0} datasets:\nvalidatingExport=Validating Export\nexportWizardHeadingSuccess=Your export is ready\nexportWizardHeadingError=Error creating export\nnoPagesExported=No page was selected to export\nmissingDependencies=Some dependencies were not fulfilled:\nnothingToExport=No page or dataset was selected to export\nnavigationHelpText=Navigation is always exported.\nvalidationError=Export validation error. Check logs.\nopenHelpText=Open in the connected Dashbuilder Standalone Server"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ncontentExplorerNew=Nuevo\ncontentExplorerNavigation=Navegación\ncontentExplorerTopMenu=Menú superior\nnavigationTreeItem=Árbol de navegación\ncontentManagerHome=Administrador de contenido\ncontentManagerHomeTitle=Gestión de contenido\ncontentManagerHomeWelcome=Desde aquí, puede crear y personalizar tanto el contenido de la aplicación como sus menús de navegación.\ncontentManagerHomeCreate=Puede empezar creando un\ncontentManagerHomeNewPerspective=nuevo {0}\ncontentManagerNavigationChanged=La navegación se modificó correctamente\ncomponentPalette=Componentes\npropertiesEditor=Propiedades\nperspective=página\nperspectives=páginas\nnoPerspectives=No hay páginas\nperspectiveDragComponent=Página\nperspectiveDragComponentHeader=Selector de página\nperspectiveDragComponentHelp=La página seleccionada se mostrará por completo dentro del área de visualización del componente.\nperspectiveDragSelectorHint=- Seleccionar página -\nperspectiveDragSelectorLabel=Página\nperspectiveDragNotFoundError=La página no está configurada o no se encuentra.\nperspectiveInfiniteRecursionError=El contenido no se muestra para evitar un bucle infinito. En general, la página que ha seleccionado para este componente no debe contener referencias (directas o indirectas) a esta página.\nnewPerspectivePopUpViewName=Nombre\nnewPerspectivePopUpViewNameHelp=El nombre de la página. Asegúrese de que no esté vacío y que aún no exista.\nnewPerspectivePopUpViewStyle=Estilo\nnewPerspectivePopUpViewStyleHelp=La opción “Fluido” actúa más como una página web clásica en la que se muestra una barra de desplazamiento vertical cuando la página supera la altura disponible. Seleccione “Página” solo si quiere forzar la página para que se ajuste siempre al 100 % de la altura de la ventana.\nnewPerspectivePopUpViewFluid=Fluido\nnewPerspectivePopUpViewPage=Página\nnewPerspectivePopUpViewCancel=Cancelar\nnewPerspectivePopUpViewOk=Aceptar\nnewPerspectivePopUpViewTitle=Nueva página…\nnewPerspectivePopUpViewErrorEmptyName=El nombre es obligatorio\nnewPerspectivePopUpViewErrorInvalidName=Nombre de página no válido\nnewPerspectivePopUpViewErrorDuplicatedName=El nombre de la página ya existe\nworkbenchPartTitle=Transferencia de datos de Dashbuilder\nDataTransferView.import=Importar\nDataTransferView.export=Exportar EPC\nDataTransferView.gradualExport=Exportación personalizada\ndataTransferPopUpViewTitle=Transferencia de datos de Dashbuilder\nimportResultMessageOK=Los datos se cargaron correctamente; {0} archivos importados.\nimportResultMessageNoData=No hay datos disponibles en el archivo Zip.\nexportOK=Los datos se exportaron correctamente.\nimportOK=Los datos se importaron correctamente.\nexportError=Error de exportación de datos. Revise los registros para obtener más detalles.\nimportError=Error de importación de datos. Revise los registros para obtener más detalles.\nexportText=Exportar datos relacionados con dashbuilder (conjuntos de datos, perspectivas y navegación) a un archivo ZIP.\nimportText=Importar datos relacionados con dashbuilder (conjuntos de datos, perspectivas y navegación) desde un archivo ZIP.\ndataTransferExportPopUpViewTitle=Seleccione los activos a exportar\ndataTransferExportError=Error al recuperar la lista de activos a exportar\nloadAssetsToExport=Asistente de exportación\npageLabel=página\ndatasetLabel=conjunto de datos\npagesLabel=páginas\ndatasetsLabel=conjuntos de datos\nExportSummaryWizardPageView.download=Descargar\nExportSummaryWizardPageView.open=Abrir\nExportSummaryWizardPageView.navigation=Navegación\nExportSummaryWizardPageView.errorHighlightedMessage=Administrar dependencias…\nExportSummaryWizardPageView.summary=Resumen\nexportWizardTitle=Asistente de exportación\nloadingExportWizard=Carga del Asistente de Exportación\npreparingExportDownload=Preparación de la descarga de la exportación\npageMissingDataSets=Página {0} conjuntos de datos:\nvalidatingExport=Validación de la exportación\nexportWizardHeadingSuccess=Su exportación está lista\nexportWizardHeadingError=Error al crear la exportación\nnoPagesExported=No se ha seleccionado ninguna página para exportar\nmissingDependencies=Algunas dependencias no se cumplieron:\nnothingToExport=No se ha seleccionado ninguna página o conjunto de datos para exportar\nnavigationHelpText=La navegación siempre se exporta.\nvalidationError=Error de validación de JSON: Comprueba los registros.\nopenHelpText=Abrir en el servidor autónomo Dashbuilder conectado"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ncontentExplorerNew=Nouveau\ncontentExplorerNavigation=Navigation\ncontentExplorerTopMenu=Menu supérieur\nnavigationTreeItem=Arborescence de navigation\ncontentManagerHome=Gestionnaire de contenu\ncontentManagerHomeTitle=Gestion du contenu\ncontentManagerHomeWelcome=À partir d''ici, vous pouvez créer et personnaliser le contenu de l''application et ses menus de navigation.\ncontentManagerHomeCreate=Vous pouvez commencer par créer un\ncontentManagerHomeNewPerspective=nouveau {0}\ncontentManagerNavigationChanged=La navigation a été modifiée\ncomponentPalette=Composants\npropertiesEditor=Propriétés\nperspective=page\nperspectives=pages\nnoPerspectives=Aucune page\nperspectiveDragComponent=Page\nperspectiveDragComponentHeader=Sélecteur de page\nperspectiveDragComponentHelp=La page sélectionnée sera entièrement affichée dans la zone d''affichage du composant.\nperspectiveDragSelectorHint=- Sélectionner une page -\nperspectiveDragSelectorLabel=Page\nperspectiveDragNotFoundError=La page n''est pas configurée ou est introuvable.\nperspectiveInfiniteRecursionError=Le contenu n''est pas affiché pour éviter une boucle infinie. En règle générale, la page que vous avez sélectionnée pour ce composant ne doit pas contenir de références (directes ou indirectes) à cette page.\nnewPerspectivePopUpViewName=Nom\nnewPerspectivePopUpViewNameHelp=Nom de la page. Assurez-vous qu''elle n''est pas vide et qu''elle n''existe pas encore.\nnewPerspectivePopUpViewStyle=Style\nnewPerspectivePopUpViewStyleHelp=L''option ''Fluide'' fonctionne davantage comme une page Web classique, en affichant une barre de défilement verticale lorsque la page dépasse la hauteur disponible. Sélectionnez \"Page\" uniquement si vous souhaitez que la page s''adapte toujours à la hauteur complète (100 %) de la fenêtre.\nnewPerspectivePopUpViewFluid=Fluide\nnewPerspectivePopUpViewPage=Page\nnewPerspectivePopUpViewCancel=Annuler\nnewPerspectivePopUpViewOk=OK\nnewPerspectivePopUpViewTitle=Nouvelle page…\nnewPerspectivePopUpViewErrorEmptyName=Le nom est obligatoire\nnewPerspectivePopUpViewErrorInvalidName=Nom de page non valide\nnewPerspectivePopUpViewErrorDuplicatedName=Le nom de la page existe déjà\nworkbenchPartTitle=Transfert de données Dashbuilder\nDataTransferView.import=Importer\nDataTransferView.export=Exporter tout\nDataTransferView.gradualExport=Personnaliser Exportation\ndataTransferPopUpViewTitle=Transfert de données Dashbuilder\nimportResultMessageOK=Données envoyés avec succès, {0} fichiers importés.\nimportResultMessageNoData=Aucune donnée disponible dans l''archive ZIP.\nexportOK=Les données ont été exportées.\nimportOK=Les données ont été importées.\nexportError=Erreur d''exportation des données. Consultez les journaux pour plus de détails.\nimportError=Erreur d''importation des données. Consultez les journaux pour plus de détails.\nexportText=Exportez les données relatives à Dashbuilder (ensembles de données, perspectives et navigation) vers un fichier ZIP.\nimportText=Importez les données relatives à Dashbuilder (ensembles de données, perspectives et navigation) depuis un fichier ZIP.\ndataTransferExportPopUpViewTitle=Sélectionnez les ressources à exporter\ndataTransferExportError=Erreur lors de l''extraction de la liste des ressources à exporter\nloadAssetsToExport=Assistant d''exportation\npageLabel=page\ndatasetLabel=ensemble de données\npagesLabel=pages\ndatasetsLabel=ensembles de données\nExportSummaryWizardPageView.download=Télécharger\nExportSummaryWizardPageView.open=Ouvrir\nExportSummaryWizardPageView.navigation=Navigation\nExportSummaryWizardPageView.errorHighlightedMessage=Dépendances manquantes !\nExportSummaryWizardPageView.summary=Résumé\nexportWizardTitle=Assistant d''exportation\nloadingExportWizard=Chargement de l''assistant d''exportation\npreparingExportDownload=Préparation au téléchargement de l''exportation\npageMissingDataSets=Page {0} des ensembles de données :\nvalidatingExport=Validation de l''exportation\nexportWizardHeadingSuccess=Votre exportation est prête\nexportWizardHeadingError=Erreur en créant l''exportation\nnoPagesExported=Aucune page n''a été sélectionnée pour l''exportation\nmissingDependencies=Certaines dépendances n''ont pas été remplies :\nnothingToExport=Aucune page ou ensemble de données n''a été sélectionné pour l''exportation\nnavigationHelpText=La navigation est toujours exportée.\nvalidationError=Erreur de validation d''exportation. Vérifiez les journaux.\nopenHelpText=Ouvert dans le serveur autonome Dashbuilder connecté"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ncontentExplorerNew=Nuovo\ncontentExplorerNavigation=Navigazione\ncontentExplorerTopMenu=Menu Principale\nnavigationTreeItem=Albero di Navigazione\ncontentManagerHome=Gestore dei Contenuti\ncontentManagerHomeTitle=Gestione dei Contenuti\ncontentManagerHomeWelcome=Da qui puoi creare e personalizzare sia il contenuto dell''applicazione che i suoi menu di navigazione.\ncontentManagerHomeCreate=Puoi iniziare creando una\ncontentManagerHomeNewPerspective=nuova {0}\ncontentManagerNavigationChanged=Navigazione modificata con successo\ncomponentPalette=Componenti\npropertiesEditor=Proprietà\nperspective=pagina\nperspectives=pagine\nnoPerspectives=Nessuna pagina\nperspectiveDragComponent=Pagina\nperspectiveDragComponentHeader=Selettore di Pagina\nperspectiveDragComponentHelp=La pagina selezionata verrà visualizzata completamente all''interno dell''area di visualizzazione del componente.\nperspectiveDragSelectorHint=- Seleziona Pagina -\nperspectiveDragSelectorLabel=Pagina\nperspectiveDragNotFoundError=La pagina non è configurata o non è stata trovata.\nperspectiveInfiniteRecursionError=Il contenuto non viene visualizzato per evitare un ciclo infinito. In generale, la pagina selezionata per questo componente non deve contenere riferimenti (diretti o indiretti) a questa pagina.\nnewPerspectivePopUpViewName=Nome\nnewPerspectivePopUpViewNameHelp=Il nome della pagina. Assicurati che non sia vuoto e che non esista già.\nnewPerspectivePopUpViewStyle=Stile\nnewPerspectivePopUpViewStyleHelp=L''opzione \"Fluid\" funziona come una pagina web classica, mostrando una barra di scorrimento verticale quando la pagina supera l''altezza disponibile. Seleziona \"Pagina\" solo se vuoi forzare la pagina a occupare sempre il 100% dell''altezza della finestra.\nnewPerspectivePopUpViewFluid=Fluida\nnewPerspectivePopUpViewPage=Pagina\nnewPerspectivePopUpViewCancel=Annulla\nnewPerspectivePopUpViewOk=Ok\nnewPerspectivePopUpViewTitle=Nuova Pagina ...\nnewPerspectivePopUpViewErrorEmptyName=Il nome è obbligatorio\nnewPerspectivePopUpViewErrorInvalidName=Nome pagina non valido\nnewPerspectivePopUpViewErrorDuplicatedName=Il nome della pagina esiste già\nworkbenchPartTitle=Trasferimento Dati Dashbuilder\nDataTransferView.import=Importa\nDataTransferView.export=Esporta tutto\nDataTransferView.gradualExport=Esportazione personalizzata\ndataTransferPopUpViewTitle=Trasferimento Dati Dashbuilder\nimportResultMessageOK=Dati caricati con successo, {0} file importati.\nimportResultMessageNoData=Nessun dato disponibile nell''archivio Zip.\nexportOK=Dati esportati con successo.\nimportOK=Dati importati con successo.\nexportError=Errore durante l''esportazione dei dati. Controlla i log per ulteriori dettagli.\nimportError=Errore durante l''importazione dei dati. Controlla i log per ulteriori dettagli.\nexportText=Esporta i dati correlati a Dashbuilder (dataset, pagine e navigazione) in un file ZIP.\nimportText=Importa i dati correlati a Dashbuilder (dataset, pagine e navigazione) da un file ZIP.\ndataTransferExportPopUpViewTitle=Seleziona Elementi da Esportare\ndataTransferExportError=Errore durante il recupero dell''elenco degli elementi da esportare\nloadAssetsToExport=Wizard di Esportazione\npageLabel=pagina\ndatasetLabel=dataset\npagesLabel=pagine\ndatasetsLabel=dataset\nExportSummaryWizardPageView.download=Scarica\nExportSummaryWizardPageView.open=Apri\nExportSummaryWizardPageView.navigation=Navigazione\nExportSummaryWizardPageView.errorHighlightedMessage=Dipendenze Mancanti!\nExportSummaryWizardPageView.summary=Sommario\nexportWizardTitle=Wizard di Esportazione\nloadingExportWizard=Caricamento Wizard di Esportazione\npreparingExportDownload=Preparazione Download Esportazione\npageMissingDataSets=Pagina {0} dataset:\nvalidatingExport=Validazione Esportazione\nexportWizardHeadingSuccess=La tua esportazione è pronta\nexportWizardHeadingError=Errore durante la creazione dell''esportazione\nnoPagesExported=Nessuna pagina è stata selezionata per l''esportazione\nmissingDependencies=Alcune dipendenze non sono state soddisfatte:\nnothingToExport=Nessuna pagina o dataset è stato selezionato per l''esportazione\nnavigationHelpText=La navigazione viene sempre esportata.\nvalidationError=Errore di validazione dell''esportazione. Controlla i log.\nopenHelpText=Apri nel server autonomo di Dashbuilder connesso\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/main/resources/org/dashbuilder/client/cms/resources/i18n/ContentManagerConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#    http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ncontentExplorerNew=新規\ncontentExplorerNavigation=ナビゲーション\ncontentExplorerTopMenu=トップメニュー\nnavigationTreeItem=ナビゲーションツリー\ncontentManagerHome=コンテンツマネージャー\ncontentManagerHomeTitle=コンテンツ管理\ncontentManagerHomeWelcome=アプリケーションコンテンツとナビゲーションメニューを作成、カスタマイズできます。\ncontentManagerHomeCreate=次のものが作成可能です\ncontentManagerHomeNewPerspective=新規 {0}\ncontentManagerNavigationChanged=ナビゲーションは変更されました\ncomponentPalette=コンポーネント\npropertiesEditor=プロパティー\nperspective=ページ\nperspectives=ページ\nnoPerspectives=ページがありません\nperspectiveDragComponent=ページ\nperspectiveDragComponentHeader=ページセレクター\nperspectiveDragComponentHelp=選択されたページはコンポーネントの表示エリアに完全に表示されます。\nperspectiveDragSelectorHint=- ページの選択 -\nperspectiveDragSelectorLabel=ページ\nperspectiveDragNotFoundError=ページが設定されていない、または見つかりません。\nperspectiveInfiniteRecursionError=無限ループを避けるためこのコンテンツは表示されません。一般的には、このコンポーネントに対して選択したページは、このページへの (直接もしくは間接的な) 参照を含むことはできません。\nnewPerspectivePopUpViewName=名前\nnewPerspectivePopUpViewNameHelp=ページの名前空欄でないことと、名前がすでに存在していないことを確認してください。\nnewPerspectivePopUpViewStyle=スタイル\nnewPerspectivePopUpViewStyleHelp=「Fluid」オプションは、従来の web ページのように、ページの高さが利用可能な高さよりも長くなると、垂直バーが表示されます。ページの高さを常にウィンドウの高さに一致させる場合は「ページ」を選択してください。\nnewPerspectivePopUpViewFluid=流動\nnewPerspectivePopUpViewPage=ページ\nnewPerspectivePopUpViewCancel=キャンセル\nnewPerspectivePopUpViewOk=OK\nnewPerspectivePopUpViewTitle=新規ページ ...\nnewPerspectivePopUpViewErrorEmptyName=名前は必須項目です\nnewPerspectivePopUpViewErrorInvalidName=無効なページ名\nnewPerspectivePopUpViewErrorDuplicatedName=ページ名がすでに存在します\nworkbenchPartTitle=Dashbuilder のデータ転送\nDataTransferView.import=インポート\nDataTransferView.export=すべてエクスポート\nDataTransferView.gradualExport=カスタムエクスポート\ndataTransferPopUpViewTitle=Dashbuilder のデータ転送\nimportResultMessageOK=データが正常にアップロードされ、{0} 個のファイルがインポートされました。\nimportResultMessageNoData=Zip アーカイブに利用可能なデータはありません。\nexportOK=データが正常にエクスポートされました。\nimportOK=データが正常にインポートされました。\nexportError=データのエクスポートエラー。詳細は、ログを確認してください。\nimportError=データのインポートエラー。詳細は、ログを確認してください。\nexportText=Dashbuilder 関連のデータ (データセット、パースペクティブ、ナビゲーション) を Zip ファイルにエクスポートします。\nimportText=Dashbuilder 関連のデータ (データセット、パースペクティブ、ナビゲーション) を Zip ファイルからインポートします。\ndataTransferExportPopUpViewTitle=エクスポートするアセットを選択します\ndataTransferExportError=エクスポートするアセット一覧の取得中にエラー\nloadAssetsToExport=エクスポートウィザード\npageLabel=ページ\ndatasetLabel=データセット\npagesLabel=ページ\ndatasetsLabel=データセット\nExportSummaryWizardPageView.download=ダウンロード\nExportSummaryWizardPageView.open=開く\nExportSummaryWizardPageView.navigation=ナビゲーション\nExportSummaryWizardPageView.errorHighlightedMessage=依存関係がありません!\nExportSummaryWizardPageView.summary=要約\nexportWizardTitle=エクスポートウィザード\nloadingExportWizard=エクスポートウィザードの読み込み\npreparingExportDownload=エクスポートのダウンロードの準備\npageMissingDataSets=ページ {0} データセット:\nvalidatingExport=エクスポートの検証\nexportWizardHeadingSuccess=エクスポートの準備ができました\nexportWizardHeadingError=エクスポートの作成中にエラー\nnoPagesExported=エクスポートするページが選択されていません\nmissingDependencies=一部の依存関係が満たされませんでした:\nnothingToExport=エクスポートするページまたはデータセットが選択されていません\nnavigationHelpText=ナビゲーションは常にエクスポートされます。\nvalidationError=エクスポート検証エラー:ログを確認してください。\nopenHelpText=接続された Dashbuilder スタンドアロンサーバーで開きます"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/perspective/ContentManagerPerspectiveTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.perspective;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocks;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceHiddenEvent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditor;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutEditorPropertiesPresenter;\nimport org.uberfire.ext.plugin.client.perspective.editor.PerspectiveEditorPresenter;\nimport org.uberfire.ext.plugin.client.perspective.editor.events.PerspectiveEditorFocusEvent;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ContentManagerPerspectiveTest {\n\n    @Mock\n    ContentManagerI18n i18n;\n\n    @Mock\n    UberfireDocks uberfireDocks;\n\n    @Mock\n    PerspectiveChange perspectiveChangeEvent;\n\n    @Mock\n    LayoutEditorPropertiesPresenter propertiesPresenter;\n\n    @Mock\n    LayoutEditor layoutEditor;\n\n    @InjectMocks\n    ContentManagerPerspective perspective;\n\n    @Before\n    public void setUp() {\n        when(perspectiveChangeEvent.getIdentifier()).thenReturn(\"anotherPerspective\");\n        perspective.init();\n        perspective.onOpen();\n    }\n\n    @Test\n    public void testInit() {\n        verify(uberfireDocks).add(perspective.perspectivesExplorerDock);\n        verify(uberfireDocks).add(perspective.navigationExplorerDock);\n        verify(uberfireDocks).remove(perspective.componentPaletteDock);\n        verify(uberfireDocks).open(perspective.perspectivesExplorerDock);\n        verify(uberfireDocks).show(UberfireDockPosition.WEST, ContentManagerPerspective.PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testOnLayoutEditorFocus() {\n        reset(uberfireDocks);\n        perspective.onPerspectiveEditorFocus(new PerspectiveEditorFocusEvent(layoutEditor));\n        verify(uberfireDocks).add(perspective.componentPaletteDock);\n        verify(uberfireDocks).open(perspective.componentPaletteDock);\n        verify(uberfireDocks).show(UberfireDockPosition.WEST, ContentManagerPerspective.PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testOnLayoutEditorHidden() {\n        perspective.onPerspectiveEditorFocus(new PerspectiveEditorFocusEvent(layoutEditor));\n        reset(uberfireDocks);\n        perspective.onPerspectiveEditorHidden(new PlaceHiddenEvent(new DefaultPlaceRequest(PerspectiveEditorPresenter.ID)));\n        verify(uberfireDocks).remove(perspective.componentPaletteDock);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/screen/explorer/NavigationExplorerScreenTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.screen.explorer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.event.NavTreeLoadedEvent;\nimport org.dashbuilder.navigation.event.PerspectivePluginsChangedEvent;\nimport org.dashbuilder.client.navigation.widget.editor.NavItemEditorSettings;\nimport org.dashbuilder.client.navigation.widget.editor.NavTreeEditor;\nimport org.dashbuilder.navigation.NavTree;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NavigationExplorerScreenTest {\n\n    @Mock\n    NavigationManager navigationManager;\n\n    @Mock\n    NavTreeEditor navTreeEditor;\n\n    @Mock\n    NavItemEditorSettings navItemEditorSettings;\n\n    @Mock\n    EventSourceMock<NotificationEvent> notificationEvent;\n\n    @Mock\n    ContentManagerI18n i18n;\n\n    @Mock\n    NavTree navTree;\n\n    NavigationExplorerScreen navigationExplorerScreen;\n\n    @Before\n    public void setUp() {\n        when(navTreeEditor.getSettings()).thenReturn(navItemEditorSettings);\n        navigationExplorerScreen = new NavigationExplorerScreen(navigationManager, navTreeEditor, i18n, notificationEvent);\n    }\n\n    @Test\n    public void testInitTreeAlreadySet() {\n        when(navigationManager.getNavTree()).thenReturn(navTree);\n        navigationExplorerScreen.init();\n\n        verify(navTreeEditor).edit(navTree);\n    }\n\n    @Test\n    public void testOnNavTreeLoaded() {\n        navigationExplorerScreen.init();\n        navigationExplorerScreen.onNavTreeLoaded(new NavTreeLoadedEvent(navTree));\n\n        verify(navTreeEditor).edit(navTree);\n    }\n\n    @Test\n    public void testOnPerspectivesChanged() {\n        navigationExplorerScreen.init();\n        when(navigationManager.getNavTree()).thenReturn(navTree);\n        navigationExplorerScreen.onPerspectivesChanged(new PerspectivePluginsChangedEvent());\n\n        verify(navTreeEditor, times(1)).edit(any(NavTree.class));\n    }\n\n    @Test\n    public void testOnPerspectivesChangedWithNullNavTree() {\n        navigationExplorerScreen.init();\n        navigationExplorerScreen.onPerspectivesChanged(new PerspectivePluginsChangedEvent());\n\n        verify(navTreeEditor, times(0)).edit(any(NavTree.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/screen/transfer/DataTransferScreenTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer;\n\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.client.cms.screen.transfer.export.wizard.ExportWizard;\nimport org.dashbuilder.transfer.DataTransferExportModel;\nimport org.dashbuilder.transfer.DataTransferServices;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.CallerMock;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataTransferScreenTest {\n\n    @Mock\n    private DataTransferScreen.View view;\n\n    @Mock\n    private DataTransferServices dataTransferServices;\n\n    @Mock\n    private DataTransferPopUp dataTransferPopUp;\n\n    @Mock\n    private ExportWizard exportWizard;\n    \n    @Mock\n    BusyIndicatorView busyIndicatorView;\n\n    private DataTransferScreen dataTransferScreen;\n\n    private CallerMock<DataTransferServices> dataTransferServicesCaller;\n\n    @Before\n    public void prepare() {\n        dataTransferServicesCaller = new CallerMock<>(dataTransferServices);\n        dataTransferScreen = new DataTransferScreen(\n            view,\n            dataTransferPopUp,\n            dataTransferServicesCaller,\n            exportWizard,\n            busyIndicatorView);\n    }\n\n    @Test\n    public void doExportTest() throws Exception {\n        String path = \"path\";\n        DataTransferExportModel exportAll = DataTransferExportModel.exportAll();\n        when(dataTransferServices.doExport(exportAll)).thenReturn(path);\n        dataTransferScreen.init();\n        \n        dataTransferScreen.doExport();\n        \n        verify(dataTransferServices).doExport(exportAll);\n        verify(view).exportOK();\n        verify(view).download(path);\n    }\n\n    @Test\n    public void doExportFailureTest() throws Exception {\n        IOException exception = new IOException();\n        DataTransferExportModel exportAll = DataTransferExportModel.exportAll();\n        when(dataTransferServices.doExport(exportAll)).thenThrow(exception);\n        \n        dataTransferScreen.doExport();\n        \n        verify(dataTransferServices).doExport(exportAll);\n        verify(view).exportError(exception);\n    }\n\n    @Test\n    public void doImportTest() throws Exception {\n        List<String> list = new ArrayList<>();\n        when(dataTransferServices.doImport()).thenReturn(list);\n        dataTransferScreen.doImport();\n        verify(dataTransferServices).doImport();\n        verify(view).importOK();\n        verify(dataTransferPopUp).show(list);\n    }\n\n    @Test\n    public void doImportFailureTest() throws Exception {\n        Exception exception = new Exception();\n        when(dataTransferServices.doImport()).thenThrow(exception);\n        dataTransferScreen.doImport();\n        verify(dataTransferServices).doImport();\n        verify(view).importError(exception);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/ExportSummaryWizardPageTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.transfer.ExportInfo;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExportSummaryWizardPageTest {\n\n    ExportSummaryWizardPage exportWizardSummaryPage;\n\n    @Before\n    public void init() {\n        exportWizardSummaryPage = new ExportSummaryWizardPage();\n    }\n\n    @Test\n    public void testRemapMissingDependencies() {\n        String UUID = \"uuid\";\n        String NAME = \"name\";\n        String PAGE = \"page\";\n\n        DataSetDef def1 = new DataSetDef();\n        def1.setUUID(UUID);\n        def1.setName(NAME);\n\n        HashMap<String, List<String>> validation = new HashMap<>();\n        validation.put(PAGE, Collections.singletonList(UUID));\n\n        ExportInfo exportInfo = new ExportInfo(Collections.singletonList(def1), Collections.emptyList(), false);\n\n        exportWizardSummaryPage.setExportInfo(exportInfo);\n        exportWizardSummaryPage.remapMissingDependencies(validation);\n        \n        assertEquals(NAME, validation.get(PAGE).get(0));\n    }\n    \n    @Test\n    public void testRemapMissingDependenciesWithoutDatasetDef() {\n        String UUID = \"uuid\";\n        String PAGE = \"page\";\n\n        HashMap<String, List<String>> validation = new HashMap<>();\n        validation.put(PAGE, Collections.singletonList(UUID));\n        exportWizardSummaryPage.remapMissingDependencies(validation);\n        \n        assertEquals(UUID, validation.get(PAGE).get(0));\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/screen/transfer/export/wizard/widget/AssetsTableViewTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.cms.screen.transfer.export.wizard.widget;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport elemental2.dom.HTMLCollection;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.HTMLTableCellElement;\nimport elemental2.dom.HTMLTableElement;\nimport elemental2.dom.HTMLTableRowElement;\nimport elemental2.dom.HTMLTableSectionElement;\nimport org.dashbuilder.client.cms.screen.util.DomFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class AssetsTableViewTest {\n\n    @Mock\n    DomFactory domFactory;\n\n    @Mock\n    HTMLTableRowElement assetsTableHeaderRow;\n\n    @Mock\n    HTMLInputElement searchAssets;\n    \n    @Mock\n    HTMLInputElement selectAllAssets;\n\n    @InjectMocks\n    AssetsTableView assetsTableView;\n    \n\n    private MockAssetsTablePresenter presenter;\n\n    @Before\n    public void prepare() {\n        presenter = new MockAssetsTablePresenter();\n        when(domFactory.tableCell()).thenReturn(new HTMLTableCellElement());\n        when(domFactory.input()).thenReturn(new HTMLInputElement());\n        when(domFactory.tableRow()).thenReturn(new HTMLTableRowElement());\n        when(domFactory.element(any())).thenReturn(new HTMLElement());\n\n        assetsTableView.assetsTable = buildHTMLTable();\n        assetsTableView.init(presenter);\n        presenter.view = assetsTableView;\n    }\n\n    @Test\n    public void testTableRowsCreated() {\n        List<String> assets = Arrays.asList(\"asset1\", \"asset2\");\n\n\n        presenter.setData(assets);\n\n        HTMLTableSectionElement assetsTable = assetsTableView.assetsTable.tBodies.getAt(0);\n        Mockito.verify(assetsTable, times(assets.size())).appendChild(any());\n    }\n\n    @Test\n    public void testFilterTable() {\n        HTMLInputElement filter = assetsTableView.searchAssets;\n        HTMLTableElement table = assetsTableView.assetsTable;\n        HTMLCollection rows = mock(HTMLCollection.class);\n        HTMLTableRowElement[] actualRows = {\n                                            mock(HTMLTableRowElement.class),\n                                            mock(HTMLTableRowElement.class)\n        };\n        HTMLCollection<HTMLTableCellElement> firstRowCells = mock(HTMLCollection.class);\n        HTMLCollection<HTMLTableCellElement> secondRowCells = mock(HTMLCollection.class);\n\n        HTMLTableCellElement tableCellElement1 = mock(HTMLTableCellElement.class),\n                tableCellElement2 = mock(HTMLTableCellElement.class);\n        tableCellElement1.textContent = \"Abc\";\n        tableCellElement2.textContent = \"dEfx\";\n        when(firstRowCells.getAt(0)).thenReturn(tableCellElement1);\n        when(firstRowCells.getAt(1)).thenReturn(tableCellElement2);\n\n        HTMLTableCellElement tableCellElement3 = mock(HTMLTableCellElement.class),\n                tableCellElement4 = mock(HTMLTableCellElement.class);\n        tableCellElement3.textContent = \"gHi\";\n        tableCellElement4.textContent = \"jKlX\";\n        when(secondRowCells.getAt(0)).thenReturn(tableCellElement3);\n        when(secondRowCells.getAt(1)).thenReturn(tableCellElement4);\n\n        actualRows[0].cells = firstRowCells;\n        actualRows[1].cells = secondRowCells;\n        when(actualRows[0].cells.getLength()).thenReturn(2);\n        when(actualRows[1].cells.getLength()).thenReturn(2);\n\n        for (int i = 0; i < actualRows.length; i++) {\n            when(rows.getAt(i)).thenReturn(actualRows[i]);\n        }\n        when(rows.getLength()).thenReturn(actualRows.length);\n        table.tBodies.getAt(0).rows = rows;\n\n        filter.value = \"abC\";\n        assetsTableView.filterTable();\n        assertTrue(actualRows[1].hidden);\n        assertFalse(actualRows[0].hidden);\n\n        filter.value = \"jkL\";\n        assetsTableView.filterTable();\n        assertTrue(actualRows[0].hidden);\n        assertFalse(actualRows[1].hidden);\n\n        filter.value = \"X\";\n        assetsTableView.filterTable();\n        assertFalse(actualRows[0].hidden);\n        assertFalse(actualRows[1].hidden);\n\n        filter.value = \"z\";\n        assetsTableView.filterTable();\n        assertTrue(actualRows[0].hidden);\n        assertTrue(actualRows[1].hidden);\n    }\n\n    private HTMLTableElement buildHTMLTable() {\n        HTMLTableElement table = new HTMLTableElement();\n        HTMLCollection<HTMLTableSectionElement> tableBodies = mock(HTMLCollection.class);\n        HTMLTableSectionElement tableBody = mock(HTMLTableSectionElement.class);\n        table.tBodies = tableBodies;\n        when(tableBodies.getAt(0)).thenReturn(tableBody);\n        return table;\n    }\n\n    class MockAssetsTablePresenter extends AssetsTableAbstractPresenter<String> {\n\n        @Override\n        public String[] getHeaders() {\n            return new String[]{\"test\"};\n        }\n\n        @Override\n        public String[] toRow(String t) {\n            return new String[]{t};\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/widget/NewPerspectivePopUpTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorCallback;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NewPerspectivePopUpTest {\n\n    @Mock\n    private NewPerspectivePopUpView view;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private PerspectiveServices perspectiveServices;\n\n    @Mock\n    private PathPlaceRequest pathPlaceRequest;\n\n    private PluginNameValidator pluginNameValidator;\n    private NewPerspectivePopUp presenter;\n    private boolean validationError = false;\n\n    @Before\n    public void setUp() {\n        pluginNameValidator = spy(new PluginNameValidator() {\n            @Override\n            public void validate(String value, ValidatorCallback callback) {\n                if (validationError) {\n                    callback.onFailure();\n                } else {\n                    callback.onSuccess();\n                }\n            }\n        });\n        presenter = new NewPerspectivePopUp(view,\n                new CallerMock<>(perspectiveServices),\n                pluginNameValidator,\n                placeManager) {\n\n            @Override\n            protected PlaceRequest getPathPlaceRequest(Plugin response) {\n                return pathPlaceRequest;\n            }\n        };\n    }\n\n    @Test\n    public void testSuccessfulValidation() {\n        this.validationError = false;\n        when(view.getName()).thenReturn(\"newPerspective\");\n        when(view.getStyle()).thenReturn(LayoutTemplate.Style.FLUID.toString());\n        presenter.onOK();\n\n        verify(pluginNameValidator).validate(eq(\"newPerspective.plugin\"), any(ValidatorCallback.class));\n        verify(perspectiveServices).createNewPerspective(\"newPerspective\", LayoutTemplate.Style.FLUID);\n        verify(placeManager).goTo(pathPlaceRequest);\n        verify(view).hide();\n    }\n\n    @Test\n    public void testFailedValidation() {\n        this.validationError = true;\n        when(view.getName()).thenReturn(\"invalid*\");\n        when(view.getStyle()).thenReturn(LayoutTemplate.Style.FLUID.toString());\n        presenter.onOK();\n\n        verify(pluginNameValidator).validate(eq(\"invalid*.plugin\"), any(ValidatorCallback.class));\n        verify(perspectiveServices, never()).createNewPerspective(anyString(), any());\n        verify(view).errorInvalidName();\n        verify(view, never()).hide();\n    }\n\n    @Test\n    public void testPopupCanceled() {\n        presenter.onCancel();\n\n        verify(pluginNameValidator, never()).validate(anyString(), any(ValidatorCallback.class));\n        verify(perspectiveServices, never()).createNewPerspective(anyString(),any());\n        verify(view).hide();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-cms-client/src/test/java/org/dashbuilder/client/cms/widget/PerspectivesExplorerTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.cms.widget;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectivesExplorerTest {\n\n    @Mock\n    PerspectivesExplorer.View viewM;\n\n    @Mock\n    PerspectivePluginManager perspectivePluginManagerM;\n\n    @Mock\n    PlaceManager placeManagerM;\n\n    @Mock\n    PluginController pluginControllerM;\n\n    @Mock\n    ContentManagerI18n i18nM;\n\n    PerspectivesExplorer perspectivesExplorer;\n    Plugin a = mkPlugin(\"a\"), b = mkPlugin(\"B\"), c = mkPlugin(\"cEE\");\n    List<Plugin> pluginList = Arrays.asList(b, c, a);\n\n    private Plugin mkPlugin(String name) {\n        return new Plugin(name, PluginType.PERSPECTIVE, null);\n    }\n\n    @Before\n    public void setUp() {\n        doAnswer(invocationOnMock -> {\n            ParameterizedCommand<Collection<Plugin>> callback = invocationOnMock.getArgument(0, ParameterizedCommand.class);\n            callback.execute(pluginList);\n            return null;\n        }).when(perspectivePluginManagerM).getPerspectivePlugins(any());\n\n        perspectivesExplorer = new PerspectivesExplorer(viewM, perspectivePluginManagerM, pluginControllerM, placeManagerM, i18nM);\n    }\n\n    @Test\n    public void testPerspectiveListEmpty() {\n        pluginList = new ArrayList<>();\n        perspectivesExplorer.show();\n\n        verify(viewM).clear();\n        verify(viewM).showEmpty(any());\n    }\n\n    @Test\n    public void testPerspectivesAvailable() {\n        when(pluginControllerM.canRead(any())).thenReturn(true);\n\n        perspectivesExplorer.show();\n\n        InOrder inOrder = inOrder(viewM);\n        inOrder.verify(viewM).clear();\n        inOrder.verify(viewM).addPerspective(eq(\"a\"), any());\n        inOrder.verify(viewM).addPerspective(eq(\"B\"), any());\n        inOrder.verify(viewM).addPerspective(eq(\"cEE\"), any());\n    }\n\n    @Test\n    public void testPerspectiveReadAccessDenied() {\n        when(pluginControllerM.canRead(a)).thenReturn(true);\n        when(pluginControllerM.canRead(b)).thenReturn(true);\n\n        perspectivesExplorer.show();\n\n        InOrder inOrder = inOrder(viewM);\n        inOrder.verify(viewM).clear();\n        inOrder.verify(viewM).addPerspective(eq(\"a\"), any());\n        inOrder.verify(viewM).addPerspective(eq(\"B\"), any());\n        inOrder.verify(viewM, never()).addPerspective(eq(\"cEE\"), any());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-common-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Common Client</name>\n  <description>Dashbuilder Common Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>      \n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n    \n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/CollectionUtils.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class CollectionUtils {\n\n    /** Constant to avoid repeated object creation */\n    private static Integer INTEGER_ONE = new Integer(1);\n\n    /**\n     * Returns a {@link Collection} containing the intersection\n     * of the given {@link Collection}s.\n     * <p>\n     * The cardinality of each element in the returned {@link Collection}\n     * will be equal to the minimum of the cardinality of that element\n     * in the two given {@link Collection}s.\n     *\n     * @param a  the first collection, must not be null\n     * @param b  the second collection, must not be null\n     * @return the intersection of the two collections\n     */\n    public static Collection intersection(final Collection a, final Collection b) {\n        ArrayList list = new ArrayList();\n        Map mapa = getCardinalityMap(a);\n        Map mapb = getCardinalityMap(b);\n        Set elts = new HashSet(a);\n        elts.addAll(b);\n        Iterator it = elts.iterator();\n        while(it.hasNext()) {\n            Object obj = it.next();\n            for(int i=0,m=Math.min(getFreq(obj,mapa),getFreq(obj,mapb));i<m;i++) {\n                list.add(obj);\n            }\n        }\n        return list;\n    }\n\n    /**\n     * Returns a {@link Map} mapping each unique element in the given\n     * {@link Collection} to an {@link Integer} representing the number\n     * of occurrences of that element in the {@link Collection}.\n     * <p>\n     * Only those elements present in the collection will appear as\n     * keys in the map.\n     *\n     * @param coll  the collection to get the cardinality map for, must not be null\n     * @return the populated cardinality map\n     */\n    public static Map getCardinalityMap(final Collection coll) {\n        Map count = new HashMap();\n        for (Iterator it = coll.iterator(); it.hasNext();) {\n            Object obj = it.next();\n            Integer c = (Integer) (count.get(obj));\n            if (c == null) {\n                count.put(obj,INTEGER_ONE);\n            } else {\n                count.put(obj,new Integer(c.intValue() + 1));\n            }\n        }\n        return count;\n    }\n\n    private static final int getFreq(final Object obj, final Map freqMap) {\n        Integer count = (Integer) freqMap.get(obj);\n        if (count != null) {\n            return count.intValue();\n        }\n        return 0;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/JsonSourceViewer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport org.dashbuilder.json.JsonArray;\nimport org.dashbuilder.json.JsonObject;\nimport org.dashbuilder.json.JsonString;\nimport org.dashbuilder.json.JsonValue;\n\npublic class JsonSourceViewer extends Composite {\n\n    private final static String INDENT = \"    \";\n\n    public FlexTable table;\n\n    public JsonSourceViewer() {\n        this.table = new FlexTable();\n        initWidget( table );\n    }\n\n    public void setContent(JsonObject jsonSource) {\n        clearContent();\n\n        String jsonSourceString = formatJsonObjectAsString(jsonSource, \"\");\n        final String[] rows = jsonSourceString.split( \"\\n\" );\n        for ( int i = 0; i < rows.length; i++ ) {\n            String escaped = replaceLeadingWhitespaces( rows [ i ] );\n            table.setHTML( i, 0, escaped );\n        }\n    }\n\n    private String replaceLeadingWhitespaces( String text ) {\n        String s = text.trim();\n        if ( s.length() == 0) return \"\";\n        StringBuilder sb = new StringBuilder(\"\");\n        int i = 0;\n        while ( ' ' == text.charAt( i ) ) {\n            sb.append( \"&nbsp;\" );\n            i++;\n        }\n        sb.append(text.substring(i));\n        return sb.toString();\n    }\n\n    private void clearContent() {\n        table.removeAllRows();\n    }\n\n    private String formatJsonValueAsString(JsonValue jsonValue, String indent) {\n        if (jsonValue == null) {\n            return \"\";\n        }\n        if (jsonValue instanceof JsonObject) {\n            return formatJsonObjectAsString((JsonObject) jsonValue, indent);\n        }\n        else if (jsonValue instanceof JsonArray) {\n            return formatJsonArrayAsString((JsonArray) jsonValue, indent);\n        }\n        else if (jsonValue instanceof JsonString) {\n            return \"\\\"\" + ((JsonString) jsonValue).getString() + \"\\\"\";\n        }\n        else {\n            return jsonValue.asString();\n        }\n    }\n\n    private String formatJsonObjectAsString(JsonObject jsonObject, String indent) {\n        if ( jsonObject == null ) return \"\";\n\n        String newIndent = indent + INDENT;\n        StringBuilder sb = new StringBuilder( \"{\" );\n\n        String[] keys = jsonObject.keys();\n        for ( int i = 0; i < keys.length; i++ ) {\n            sb.append(\"\\n\");\n            sb.append(newIndent).append(\"\\\"\").append(keys[i]).append(\"\\\"\").append(\": \");\n            sb.append(newIndent).append(formatJsonValueAsString(jsonObject.get(keys[i]), newIndent));\n            sb.append(i == keys.length - 1 ? \"\" : \",\").append(\"\\n\");\n        }\n        sb.append(indent).append(\"}\");\n        return sb.toString();\n    }\n\n    private String formatJsonArrayAsString(JsonArray jsonArray, String indent) {\n        if (jsonArray == null) {\n            return \"\";\n        }\n\n        String newIndent = indent + INDENT;\n        StringBuilder sb = new StringBuilder(\"[\");\n\n        for (int i = 0; i < jsonArray.length(); i++) {\n            sb.append(\"\\n\");\n            sb.append(newIndent ).append(formatJsonValueAsString(jsonArray.get(i), newIndent ));\n            sb.append(i == jsonArray.length() - 1 ? \"\\n\" : \", \");\n        }\n        sb.append(indent).append(\"]\");\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/SpacerWidget.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport java.lang.String;\n\nimport com.google.gwt.user.client.ui.HTML;\n\npublic class SpacerWidget extends HTML {\n\n    public static SpacerWidget SINGLE = new SpacerWidget( \"&nbsp;\" );\n    public static SpacerWidget DOUBLE = new SpacerWidget( \"&nbsp;&nbsp;\" );\n\n    private SpacerWidget( String spaces ) {\n        super( spaces );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/StringTemplateBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class StringTemplateBuilder {\n\n    protected String keyPrefix;\n    protected String keySufix;\n    protected Set<String> keySet = new HashSet<>();\n    protected String sourceCode;\n\n    public StringTemplateBuilder() {\n        this(\"${\", \"}\");\n    }\n\n    public StringTemplateBuilder(String keyPrefix, String keySufix) {\n        this.keyPrefix = keyPrefix;\n        this.keySufix = keySufix;\n    }\n\n    public void setTemplate(String template) {\n        this.sourceCode = template;\n        this.extractKeys();\n    }\n\n    public String getKeyPrefix() {\n        return keyPrefix;\n    }\n\n    public void setKeyPrefix(String keyPrefix) {\n        this.keyPrefix = keyPrefix;\n    }\n\n    public String getKeySufix() {\n        return keySufix;\n    }\n\n    public void setKeySufix(String keySufix) {\n        this.keySufix = keySufix;\n    }\n\n    public String build() {\n        return sourceCode;\n    }\n\n    public Set<String> keys() {\n        return keySet;\n    }\n\n    public String asVar(String key) {\n        return getKeyPrefix() + key + getKeySufix();\n    }\n\n    public StringTemplateBuilder replace(String key, String value) {\n        sourceCode = sourceCode.replace(keyPrefix + key + keySufix, value);\n        return this;\n    }\n\n    protected void extractKeys() {\n        this.keySet.clear();\n\n        if (sourceCode != null) {\n            int idx = 0;\n            int end = 0;\n            while (idx != -1 && end != -1) {\n                idx = sourceCode.indexOf(keyPrefix, end);\n                end = sourceCode.indexOf(keySufix, idx+keyPrefix.length());\n                if (idx != -1 && end != -1) {\n                    String key = sourceCode.substring(idx + 2, end);\n                    keySet.add(key);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/StringUtils.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.List;\n\npublic class StringUtils {\n\n    /**\n     * <p>Checks if a String is empty (\"\") or null.</p>\n     *\n     * <pre>\n     * StringUtils.isEmpty(null)      = true\n     * StringUtils.isEmpty(\"\")        = true\n     * StringUtils.isEmpty(\" \")       = false\n     * StringUtils.isEmpty(\"bob\")     = false\n     * StringUtils.isEmpty(\"  bob  \") = false\n     * </pre>\n     *\n     * <p>NOTE: This method changed in Lang version 2.0.\n     * It no longer trims the String.\n     * That functionality is available in isBlank().</p>\n     *\n     * @param str  the String to check, may be null\n     * @return <code>true</code> if the String is empty or null\n     */\n    public static boolean isEmpty(String str) {\n        return str == null || str.length() == 0;\n    }\n\n    /**\n     * <p>Checks if a String is whitespace, empty (\"\") or null.</p>\n     *\n     * <pre>\n     * StringUtils.isBlank(null)      = true\n     * StringUtils.isBlank(\"\")        = true\n     * StringUtils.isBlank(\" \")       = true\n     * StringUtils.isBlank(\"bob\")     = false\n     * StringUtils.isBlank(\"  bob  \") = false\n     * </pre>\n     *\n     * @param str  the String to check, may be null\n     * @return <code>true</code> if the String is null, empty or whitespace\n     */\n    public static boolean isBlank(String str) {\n        int strLen;\n        if (str == null || (strLen = str.length()) == 0) {\n            return true;\n        }\n        for (int i = 0; i < strLen; i++) {\n            if (!Character.isSpace(str.charAt(i))) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * <p>Joins the elements of the provided array into a single String\n     * containing the provided list of elements.</p>\n     *\n     * <p>No delimiter is added before or after the list.\n     * A <code>null</code> separator is the same as an empty String (\"\").\n     * Null objects or empty strings within the array are represented by\n     * empty strings.</p>\n     *\n     * <pre>\n     * StringUtils.join(null, *)                = null\n     * StringUtils.join([], *)                  = \"\"\n     * StringUtils.join([null], *)              = \"\"\n     * StringUtils.join([\"a\", \"b\", \"c\"], \"--\")  = \"a--b--c\"\n     * StringUtils.join([\"a\", \"b\", \"c\"], null)  = \"abc\"\n     * StringUtils.join([\"a\", \"b\", \"c\"], \"\")    = \"abc\"\n     * StringUtils.join([null, \"\", \"a\"], ',')   = \",,a\"\n     * </pre>\n     *\n     * @param array  the array of values to join together, may be null\n     * @param separator  the separator character to use, null treated as \"\"\n     * @return the joined String, <code>null</code> if null array input\n     */\n    public static String join(Object[] array, String separator) {\n        if (array == null) {\n            return null;\n        }\n        StringBuilder builder = new StringBuilder();\n        for (int i = 0; i < array.length; i++) {\n            Object o = array[i];\n            if (i > 0) {\n                builder.append(separator);\n            }\n            builder.append(o);\n        }\n        return builder.toString();\n    }\n\n    /**\n     * Joins a collection of string with a given delimiter.\n     *\n     * @param strings The collection of strings to join.\n     * @param delimiter The delimiter to use to join them.\n     * @return The string built by joining the string with the delimiter.\n     */\n    public static String join(Collection strings, String delimiter) {\n        StringBuilder builder = new StringBuilder();\n        Iterator<String> iter = strings.iterator();\n        while (iter.hasNext()) {\n            builder.append(iter.next());\n            if (!iter.hasNext()) {\n                break;\n            }\n            builder.append(delimiter);\n        }\n        return builder.toString();\n    }\n\n    /**\n     * <p>Splits the provided text into an array, separator specified.\n     * This is an alternative to using StringTokenizer.</p>\n     *\n     * <p>The separator is not included in the returned String array.\n     * Adjacent separators are treated as one separator.\n     * For more control over the split use the StrTokenizer class.</p>\n     *\n     * <p>A {@code null} input String returns {@code null}.</p>\n     *\n     * <pre>\n     * StringUtils.split(null, *)         = null\n     * StringUtils.split(\"\", *)           = []\n     * StringUtils.split(\"a.b.c\", '.')    = [\"a\", \"b\", \"c\"]\n     * StringUtils.split(\"a..b.c\", '.')   = [\"a\", \"b\", \"c\"]\n     * StringUtils.split(\"a:b:c\", '.')    = [\"a:b:c\"]\n     * StringUtils.split(\"a b c\", ' ')    = [\"a\", \"b\", \"c\"]\n     * </pre>\n     *\n     * @param str  the String to parse, may be null\n     * @param separatorChar  the character used as the delimiter\n     * @return an list of parsed Strings, {@code null} if null String input\n     */\n    public static List<String> split(String str, char separatorChar) {\n        List<String> list = new ArrayList<String>();\n        if (str == null || str.length() == 0) {\n            return list;\n        }\n        if (str.indexOf(separatorChar) == -1) {\n            list.add(str);\n            return list;\n        }\n        int start = 0;\n        for (int i = 0; i < str.length(); i++) {\n            if (str.charAt(i) == separatorChar) {\n                String token = str.substring(start, i).trim();\n                if (token.length() > 0) {\n                    list.add(token);\n                }\n                start = i+1;\n            }\n        }\n        String token = str.substring(start, str.length()).trim();\n        if (token.length() > 0) {\n            list.add(token);\n        }\n        return list;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/backend/PathUrlFactory.java",
    "content": "package org.dashbuilder.common.client.backend;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.http.client.URL;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Factory for the generation of URL for accessing GIT files on backend.\n */\n@ApplicationScoped\npublic class PathUrlFactory {\n\n    private static final String UPLOAD_SERVLET_URL = \"defaulteditor/upload\";\n    private static final String DOWNLOAD_SERVLET_URL = \"defaulteditor/download\";\n\n    private String getUrl(String context, String path) {\n        return new StringBuilder(GWT.getModuleBaseURL())\n            .append(context)\n            .append(\"?\")\n            .append(\"path\")\n            .append(\"=\")\n            .append(URL.encode(path))\n            .toString();\n    }\n\n    /**\n     * <p>Returns the download URL for a given file provided by a servlet method.</p>\n     * @param path The path of the file.\n     */\n    public String getDownloadFileUrl(final Path path) {\n        return getUrl(DOWNLOAD_SERVLET_URL, path.toURI());\n    }\n\n    /**\n     * <p>Returns the download URL for a given file provided by a servlet method.</p>\n     * @param path The path of the file.\n     */\n    public String getDownloadFileUrl(final String path) {\n        return getUrl(DOWNLOAD_SERVLET_URL, path);\n    }\n\n    /**\n     * <p>Returns the upload URL for a given file provided by a servlet method.</p>\n     * @param path The path of the file.\n     */\n    public String getUploadFileUrl(String path) {\n        return getUrl(UPLOAD_SERVLET_URL, path);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/HasConstrainedValue.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\n\n/**\n * <p>Editor that accepts a set of predefined values.</p>\n * \n * @since 0.4.0\n */\npublic interface HasConstrainedValue<T> {\n    /**\n     * <p>Sets acceptable values for the editor.</p>\n     * <p>If no acceptable values set BEFORE editing a T instance, the editor can either disable /remove/modify the editor's value/s or just not edit any value.</p>\n     *\n     * @param acceptableValues Acceptable values for the editor.\n     */\n    @Editor.Ignore\n    void setAcceptableValues(T acceptableValues);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/HasEditMode.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\n\n/**\n * <p>Indicates that an editor can be used as read-only or as edit mode.</p>\n * \n * @since 0.4.0\n */\npublic interface HasEditMode {\n\n    /**\n     * <p>Enables or disables the edition.</p>\n     */\n    @Editor.Ignore\n    void isEditMode(boolean isEdit);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/HasRestrictedValue.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\n\n/**\n * <p>Editor that restrict a set of predefined values to use.</p>\n * \n * @since 0.4.0\n */\npublic interface HasRestrictedValue<T> {\n   \n    /**\n     * Specify the value that is restricted to use. \n     * @param value\n     */\n    @Editor.Ignore\n    void onValueRestricted(T value);\n\n    /**\n     * Specify the value that was restricted for using but it can be used again. \n     * @param value\n     */\n    @Editor.Ignore\n    void onValueUnRestricted(T value);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/LeafAttributeEditor.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport com.google.gwt.editor.client.LeafValueEditor;\n\n/**\n * <p>Editor contract for generic attributes.</p>\n * \n * @since 0.4.0\n */\npublic interface LeafAttributeEditor<T> extends HasEditorErrors<T>, LeafValueEditor<T> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ToggleSwitchEditor.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport com.google.gwt.editor.client.LeafValueEditor;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.List;\n\n/**\n * <p>Provides an editor for Boolean values using a toggle switch for the view.</p>\n * <p>It displays the editor errors using a bootstrap tooltip.</p>\n * \n * @since 0.4.0\n */\n@Dependent\npublic class ToggleSwitchEditor implements IsWidget, LeafAttributeEditor<Boolean> {\n\n    public interface View extends UberView<ToggleSwitchEditor> {\n\n        View setValue(Boolean value);\n\n        View setEnabled(Boolean value);\n\n        View showError(final SafeHtml message);\n\n        View clearError();\n        \n    }\n    \n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent;\n    public View view;\n    \n    Boolean value;\n    \n    @Inject\n    public ToggleSwitchEditor(final View view,\n                              final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>> valueChangeEvent) {\n        this.view = view;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setEnabled(final boolean isEnabled) {\n        view.setEnabled(isEnabled);\n    }\n    \n    @Override\n    public void showErrors(List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (EditorError error : errors) {\n\n            if (error.getEditor() == this) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setValue(Boolean value) {\n        this.value = value;\n        view.setValue(value);\n    }\n\n    @Override\n    public Boolean getValue() {\n        return value;\n    }\n    \n    void onValueChanged(final Boolean value) {\n        // Check value is not same one as current.\n        if (this.value != null && this.value.equals(value)) return;\n        \n        // Clear error messages on the view.\n        view.clearError();\n                \n        // Set the new value.\n        Boolean before = this.value;\n        this.value = value;\n\n        // Fire the value change event.\n        valueChangeEvent.fire(new org.dashbuilder.common.client.event.ValueChangeEvent<Boolean>(this, before, this.value));\n        \n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ToggleSwitchEditorView.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.ToggleSwitch;\n\n/**\n * <p>The ValueBoxEditor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class ToggleSwitchEditorView extends Composite implements ToggleSwitchEditor.View {\n\n    private static final String STYLE_ERROR = \" control-group has-error \";\n    \n    interface Binder extends UiBinder<Widget, ToggleSwitchEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    @UiField\n    @Editor.Ignore\n    HTMLPanel contents;\n    \n    @UiField\n    @Editor.Ignore\n    ToggleSwitch toggleSwitch;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n\n    ToggleSwitchEditor presenter;\n    \n    @Override\n    public void init(final ToggleSwitchEditor presenter) {\n        this.presenter = presenter;\n    }\n    \n    @UiConstructor\n    public ToggleSwitchEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        toggleSwitch.addValueChangeHandler(new ValueChangeHandler<Boolean>() {\n            @Override\n            public void onValueChange(final ValueChangeEvent<Boolean> event) {\n                presenter.onValueChanged(event.getValue());\n            }\n        });\n    }\n\n    @Override\n    public ToggleSwitchEditor.View setValue(final Boolean value) {\n        toggleSwitch.setValue(value);\n        return this;\n    }\n\n    @Override\n    public ToggleSwitchEditor.View setEnabled(final Boolean isEnabled) {\n        // Only set the boolean value is it's different from the current one, if not, the ToggleSwitch remains always disabled, probably due to a gwtboostrap bug.\n        if (toggleSwitch.isEnabled() != isEnabled) {\n            toggleSwitch.setEnabled(isEnabled);\n        }\n        return this;\n    }\n\n    @Override\n    public ToggleSwitchEditor.View showError(final SafeHtml message) {\n        contents.addStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(message.asString());\n        return this;\n    }\n\n    @Override\n    public ToggleSwitchEditor.View clearError() {\n        contents.removeStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(\"\");\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ToggleSwitchEditorView.ui.xml",
    "content": "<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' \n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bts=\"urn:import:org.gwtbootstrap3.extras.toggleswitch.client.ui\">\n  <ui:style>\n    .contents {\n      border: none;\n    }\n  </ui:style>\n  <g:HTMLPanel ui:field=\"contents\" addStyleDependentNames=\"{style.contents}\">\n    <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n      <bts:ToggleSwitch ui:field=\"toggleSwitch\" size=\"MINI\" animate=\"true\"/>\n    </b:Tooltip>\n  </g:HTMLPanel>\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ValueBoxEditor.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport com.google.gwt.editor.client.LeafValueEditor;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.uibinder.client.UiChild;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.ValueBoxBase;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.List;\n\n/**\n * <p>Provides an editor for a ValueBoxBase widget of type T.</p>\n * <p>It displays the editor errors using a bootstrap tooltip.</p>\n * \n * @since 0.4.0\n */\n@Dependent\npublic class ValueBoxEditor<T> implements IsWidget, LeafAttributeEditor<T> {\n\n    public interface View<T> extends UberView<ValueBoxEditor<T>> {\n\n        @UiChild(limit = 1, tagname = \"valuebox\")\n        void setValueBox(final ValueBoxBase<T> widget);\n\n        View<T> addHelpContent(final String title, final String content, final Placement placement);\n        \n        View<T> setValue(T value);\n        \n        View<T> showError(final SafeHtml message);\n        \n        View<T> clearError();\n\n    }\n    \n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<T>> valueChangeEvent;\n    public View<T> view;\n    \n    T value;\n    \n    @Inject\n    public ValueBoxEditor(final View<T> view,\n                          final Event<org.dashbuilder.common.client.event.ValueChangeEvent<T>> valueChangeEvent) {\n        this.view = view;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void addHelpContent(final String title, final String content, final Placement placement) {\n        view.addHelpContent(title, content, placement);    \n    }\n    \n    @Override\n    public void showErrors(List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (final EditorError error : errors) {\n\n            if (error.getEditor() == this) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setValue(T value) {\n        this.value = value;\n        view.setValue(value);\n    }\n\n    @Override\n    public T getValue() {\n        return value;\n    }\n    \n    void onValueChanged(final T value) {\n        // Check value is not same one as current.\n        if (this.value != null && this.value.equals(value)) return;\n        \n        // Clear error messages on the view.\n        view.clearError();\n                \n        // Set the new value.\n        T before = this.value;\n        this.value = value;\n\n        // Fire the value change event.\n        valueChangeEvent.fire(new org.dashbuilder.common.client.event.ValueChangeEvent<T>(this, before, this.value));\n        \n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ValueBoxEditorView.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.ValueBoxBase;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\n/**\n * <p>The ValueBoxEditor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class ValueBoxEditorView<T> extends Composite implements ValueBoxEditor.View<T> {\n\n    private static final String STYLE_ERROR = \" control-group has-error \";\n    \n    interface Binder extends UiBinder<Widget, ValueBoxEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n    \n    @UiField\n    SimplePanel contents;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n    \n    ValueBoxEditor<T> presenter;\n    ValueBoxBase<T> widget;\n    \n    @Override\n    public void init(final ValueBoxEditor<T> presenter) {\n        this.presenter = presenter;\n    }\n    \n    @UiConstructor\n    public ValueBoxEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public void setValueBox(final ValueBoxBase<T> widget) {\n        this.widget = widget;\n        widget.addValueChangeHandler(new ValueChangeHandler<T>() {\n            @Override\n            public void onValueChange(final ValueChangeEvent<T> event) {\n                presenter.onValueChanged(event.getValue());\n            }\n        });\n        contents.add(widget);\n    }\n\n    @Override\n    public ValueBoxEditor.View<T> setValue(T value) {\n        widget.setValue(value);\n        return this;\n    }\n\n    @Override\n    public ValueBoxEditor.View<T> showError(SafeHtml message) {\n        contents.addStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(message.asString());\n        return this;\n    }\n\n    @Override\n    public ValueBoxEditor.View<T> clearError() {\n        contents.removeStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(\"\");\n        return this;\n    }\n\n    public ValueBoxEditor.View<T> addHelpContent(final String title, final String content, final Placement placement) {\n        final Tooltip tooltip = new Tooltip(widget);\n        tooltip.setContainer(\"body\");\n        tooltip.setShowDelayMs(1000);\n        tooltip.setPlacement(placement);\n        tooltip.setTitle(content);\n        contents.add(tooltip);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/ValueBoxEditorView.ui.xml",
    "content": "<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n  <ui:style>\n    .contents {\n      display: inline;\n    }\n  </ui:style>\n  <g:HTMLPanel>\n    <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n      <g:SimplePanel ui:field=\"contents\" stylePrimaryName=\"{style.contents}\" />\n    </b:Tooltip>\n  </g:HTMLPanel>\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/file/FileUploadEditor.java",
    "content": "package org.dashbuilder.common.client.editor.file;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport com.google.gwt.editor.client.LeafValueEditor;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.resources.i18n.DashbuilderCommonConstants;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.List;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.ERROR;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>Presenter for editor component that wraps a gwt bootstrap file upload component an additionally provides:</p>\n * <ul>\n * <li>Error messages - Show validation error messages.</li>\n * <li>Dashbuilder File Upload Servlet integration - It uses the UF Dashbuilder servlet for uploading files and provides a listener to obtain the uploaded file path.</li>\n * </ul>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class FileUploadEditor implements IsWidget, LeafAttributeEditor<String> {\n\n    public interface View extends UberView<FileUploadEditor> {\n\n        View addHelpContent(final String title, final String content, final Placement placement);\n\n        View setFileUploadName(String name);\n\n        View setFileUploadVisible(boolean visible);\n\n        View setFileLabelText(String text);\n\n        View setFileLabelVisible(boolean visible);\n\n        View setLoadingImageVisible(boolean visible);\n\n        String getFileName();\n\n        View setFormAction(String action);\n\n        View submit();\n\n        View showError(final SafeHtml message);\n\n        View clearError();\n\n        View setAccept(String type);\n\n        View clear();\n    }\n\n    public interface FileUploadEditorCallback {\n\n        String getUploadFileName();\n\n        String getUploadFileUrl();\n    }\n\n    Event<NotificationEvent> workbenchNotification;\n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent;\n    public View view;\n\n    String value;\n    FileUploadEditorCallback callback;\n\n    @Inject\n    public FileUploadEditor(final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent,\n                            final Event<NotificationEvent> workbenchNotification,\n                            final View view) {\n        this.valueChangeEvent = valueChangeEvent;\n        this.workbenchNotification = workbenchNotification;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setLoadingImageVisible(false);\n        view.setFileUploadName(\"fileUpload\");\n    }\n\n    public void configure(final String fileUploadName, final FileUploadEditorCallback callback) {\n        view.setFileUploadName(fileUploadName);\n        this.callback = callback;\n    }\n\n    public void addHelpContent(final String title, final String content, final Placement placement) {\n        view.addHelpContent(title, content, placement);\n    }\n\n    @Override\n    public void showErrors(List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (EditorError error : errors) {\n\n            if (error.getEditor() == this) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setValue(final String value) {\n        this.value = value;\n        if ( !isNullOrEmpty( view.getFileName() ) ) {\n            view.setFileLabelVisible(false);\n        } else if ( !isNullOrEmpty( value ) ) {\n\n            int slash = value.lastIndexOf( \"/\" ) != -1 ? value.lastIndexOf( \"/\" ) : value.lastIndexOf( \"\\\\\" );\n\n            if ( slash == -1 ) {\n                view.setFileLabelText( value );\n            } else {\n                view.setFileLabelText( value.substring( slash + 1 ) );\n            }\n            view.setFileLabelVisible(true);\n        }\n    }\n\n    @Override\n    public String getValue() {\n        return value;\n    }\n\n    String getUploadFileName() {\n        assert callback != null;\n        return callback.getUploadFileName();\n    }\n\n\n    String getUploadFileUrl() {\n        assert callback != null;\n        return callback.getUploadFileUrl();\n    }\n\n    boolean onSubmit() {\n        final String fileName = view.getFileName();\n        if ( isNullOrEmpty( fileName ) ) {\n            return false;\n        } else {\n            view.setFileUploadVisible(false);\n            view.setLoadingImageVisible(true);\n        }\n        return true;\n    }\n\n    void onSubmitComplete(final String results) {\n        view.clearError();\n        view.setFileUploadVisible(true);\n        view.setLoadingImageVisible(false);\n        onValueChanged(view.getFileName());\n\n        // Show wb notification.\n        if ( \"OK\".equalsIgnoreCase( results ) ) {\n            workbenchNotification.fire(new NotificationEvent(DashbuilderCommonConstants.INSTANCE.uploadSuccessful(), SUCCESS));\n        } else if ( \"FAIL\".equalsIgnoreCase( results ) ) {\n            workbenchNotification.fire(new NotificationEvent(DashbuilderCommonConstants.INSTANCE.uploadFailed(), ERROR));\n        } else if ( \"FAIL - ALREADY EXISTS\".equalsIgnoreCase( results ) ) {\n            workbenchNotification.fire(new NotificationEvent(DashbuilderCommonConstants.INSTANCE.uploadFailedAlreadyExists(), ERROR));\n        }\n    }\n\n    void fileUploadHandler() {\n        final String _f = getUploadFileName();\n        final String _a = getUploadFileUrl();\n        view.setFormAction( _a );\n        setValue( _f );\n        view.setFileLabelVisible(false);\n        view.submit();\n    }\n\n    private boolean isNullOrEmpty( final String fileName ) {\n        return fileName == null || \"\".equals( fileName );\n    }\n\n    void onValueChanged(final String value) {\n        // Check value is not same one as current.\n        if (this.value != null && this.value.equals(value)) return;\n\n        // Clear error messages on the view.\n        view.clearError();\n\n        // Set the new value.\n        String before = this.value;\n        this.value = value;\n\n        // Fire the value change event.\n        valueChangeEvent.fire(new org.dashbuilder.common.client.event.ValueChangeEvent<String>(this, before, this.value));\n    }\n\n    public void setAccept(String type) {\n        view.setAccept(type);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/file/FileUploadEditorView.java",
    "content": "package org.dashbuilder.common.client.editor.file;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.FormPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.ext.widgets.common.client.common.FileUpload;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>The FileUploadEditor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class FileUploadEditorView extends Composite implements FileUploadEditor.View {\n\n    private static final String STYLE_ERROR = \" control-group has-error \";\n\n    interface Binder extends UiBinder<Widget, FileUploadEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    @UiField\n    @Editor.Ignore\n    FlowPanel mainPanel;\n\n    @UiField\n    @Editor.Ignore\n    FormPanel formPanel;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n\n    @UiField(provided = true)\n    @Editor.Ignore\n    org.uberfire.ext.widgets.common.client.common.FileUpload fileUpload;\n\n    @UiField\n    @Editor.Ignore\n    org.gwtbootstrap3.client.ui.Label fileLabel;\n\n    @UiField\n    org.gwtbootstrap3.client.ui.Icon loadingIcon;\n\n    FileUploadEditor presenter;\n\n    @Override\n    public void init(final FileUploadEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @UiConstructor\n    public FileUploadEditorView() {\n        fileUpload = createFileUpload();\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        initFormPanel();\n    }\n\n    private FileUpload createFileUpload() {\n        return new FileUpload( new Command() {\n            @Override\n            public void execute() {\n                presenter.fileUploadHandler();\n            }\n        }, true );\n    }\n\n    private void initFormPanel() {\n        formPanel.setEncoding( FormPanel.ENCODING_MULTIPART );\n        formPanel.setMethod( FormPanel.METHOD_POST );\n        formPanel.setWidget( fileUpload );\n        formPanel.addSubmitHandler(new FormPanel.SubmitHandler() {\n            @Override\n            public void onSubmit(final FormPanel.SubmitEvent event) {\n                final boolean isFireEvent = presenter.onSubmit();\n                if (!isFireEvent) {\n                    event.cancel();\n                }\n            }\n        });\n        formPanel.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() {\n            @Override\n            public void onSubmitComplete(final FormPanel.SubmitCompleteEvent event) {\n                presenter.onSubmitComplete(event.getResults());\n            }\n        });\n    }\n\n    @Override\n    public FileUploadEditor.View addHelpContent(final String title, final String content, final Placement placement) {\n        final Tooltip tooltip = new Tooltip(fileUpload);\n        tooltip.setContainer(\"body\");\n        tooltip.setShowDelayMs(1000);\n        tooltip.setPlacement(placement);\n        tooltip.setTitle(content);\n        formPanel.add(tooltip);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View setFileUploadName(final String name) {\n        fileUpload.setName(name);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View setFileUploadVisible(final boolean visible) {\n        fileUpload.setVisible(visible);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View setFileLabelText(final String text) {\n        fileLabel.setText(text);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View setFileLabelVisible(final boolean visible) {\n        fileLabel.setVisible(visible);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View setLoadingImageVisible(final boolean visible) {\n        loadingIcon.setVisible(visible);\n        return this;\n    }\n\n    @Override\n    public String getFileName() {\n        return fileUpload.getFilename();\n    }\n\n    @Override\n    public FileUploadEditor.View setFormAction(final String action) {\n        formPanel.setAction( action );\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View submit() {\n        formPanel.submit();\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View showError(final SafeHtml message) {\n        mainPanel.addStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(message.asString());\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View clearError() {\n        mainPanel.removeStyleName(STYLE_ERROR);\n        errorTooltip.setTitle(\"\");\n        return this;\n    }\n    \n    @Override\n    public FileUploadEditor.View setAccept(String type) {\n        fileUpload.setAccept(type);\n        return this;\n    }\n\n    @Override\n    public FileUploadEditor.View clear() {\n        fileUpload.clear();\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/file/FileUploadEditorView.ui.xml",
    "content": "<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' \n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:uf=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n  \n  <ui:with field=\"i18n\" type=\"org.dashbuilder.common.client.resources.i18n.DashbuilderCommonConstants\"/>\n\n  <ui:style>\n    .mainPanel {\n      margin-bottom: 5px;\n    }\n    .form {\n      margin-bottom: -3px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n    <g:FormPanel ui:field=\"formPanel\" addStyleNames=\"{style.form}\">\n      <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n        <uf:FileUpload ui:field=\"fileUpload\" name=\"fileUpload\"/>\n      </b:Tooltip>\n    </g:FormPanel>\n\n    <b:Label visible=\"false\" ui:field=\"fileLabel\" title=\"{i18n.currentFilePath}\"/>\n    <b:Icon type=\"REFRESH\" spin=\"true\" ui:field=\"loadingIcon\"/>\n\n  </g:FlowPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownEditor.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.editor.list;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchResults;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchService;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\n\n@Dependent\npublic class DropDownEditor implements IsWidget, LeafAttributeEditor<String> {\n\n    public interface View extends UberView<DropDownEditor> {\n\n        View addHelpContent(final String title, final String content, final Placement placement);\n\n        View setDropDown(LiveSearchDropDown dropDown);\n\n        View showError(final SafeHtml message);\n\n        View clearError();\n    }\n\n    public class Entry {\n        private String value;\n        private String hint;\n\n        public Entry(String value, String hint) {\n            this.value = value;\n            this.hint = hint;\n        }\n\n        public String getValue() {\n            return value;\n        }\n\n        public String getHint() {\n            return hint;\n        }\n    }\n\n    public View view;\n    LiveSearchDropDown<String> dropDown;\n    LiveSearchService<String> searchService = new LiveSearchService<String>() {\n        @Override\n        public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n            getDropDownEntries(pattern, maxResults, callback);\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n\n        }\n    };\n\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n\n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent;\n    Collection<Entry> entries = new ArrayList<>();\n    String selectorHint;\n    String value;\n\n    @Inject\n    public DropDownEditor(final View view,\n                          final LiveSearchDropDown dropDown,\n                          final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent) {\n        this.view = view;\n        this.dropDown = dropDown;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setDropDown(dropDown);\n        dropDown.setClearSelectionEnabled(false);\n        dropDown.setSearchEnabled(false);\n        dropDown.init(searchService, selectionHandler);\n        dropDown.setOnChange(this::onEntrySelected);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void getDropDownEntries(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n        final LiveSearchResults results = new LiveSearchResults();\n        entries.stream()\n                .filter(e -> e.getHint().contains(pattern))\n                .forEach(e -> results.add(e.getValue(), e.getHint()));\n        callback.afterSearch(results);\n    }\n\n    public void getExactEntry(String key, LiveSearchCallback<String> callback) {\n        final LiveSearchResults results = new LiveSearchResults(1);\n        entries.stream()\n                .filter(e -> e.getValue().equals(key))\n                .findAny()\n                .ifPresent(e -> results.add(e.getValue(), e.getHint()));\n        callback.afterSearch(results);\n    }\n\n    public void onEntrySelected() {\n        String oldValue = value;\n        value = getSelectedValue();\n        valueChangeEvent.fire(new ValueChangeEvent<>(this, oldValue, value));\n    }\n\n    public String getSelectedValue() {\n        String hint = selectionHandler.getSelectedValue();\n        Entry entry = getEntryByHint(hint);\n        return entry.getValue();\n    }\n\n    private Entry getEntryByHint(String hint) {\n        for (Entry entry : entries) {\n            if (entry.getHint().equals(hint)) {\n                return entry;\n            }\n        }\n        return null;\n    }\n\n    private Entry getEntryByValue(String value) {\n        for (Entry entry : entries) {\n            if (entry.getValue().equals(value)) {\n                return entry;\n            }\n        }\n        return null;\n    }\n\n    public void setSelectHint(String hint) {\n        selectorHint = hint;\n        dropDown.setSelectorHint(hint);\n    }\n\n    public Entry newEntry(final String value, String hint) {\n        return new Entry(value, hint);\n    }\n\n    public void setEntries(final Collection<Entry> entries) {\n        this.entries.clear();\n        if (entries != null) {\n            for (Entry entry : entries) {\n                this.entries.add(entry);\n                if (entry.getValue().equals(value)) {\n                    this.dropDown.setSelectedItem(entry.getValue());\n                }\n            }\n        }\n   }\n\n    public void addHelpContent(final String title, final String content, final Placement placement) {\n        view.addHelpContent(title, content, placement);\n    }\n\n    public void clear() {\n        this.entries.clear();\n        this.value = null;\n        this.dropDown.clear();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public void showErrors(final List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (EditorError error : errors) {\n            if (error.getEditor().equals(this)) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public String getValue() {\n        return value;\n    }\n\n    @Override\n    public void setValue(final String value) {\n        this.value = value;\n        Entry entry = getEntryByValue(value);\n        if (entry != null) {\n            this.dropDown.setSelectedItem(value);\n        } else {\n            this.dropDown.setSelectedItem(selectorHint);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownEditorView.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.editor.list;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\n\n@Dependent\npublic class DropDownEditorView extends Composite implements DropDownEditor.View {\n\n    interface Binder extends UiBinder<Widget, DropDownEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    interface DropDownEditorViewStyle extends CssResource {\n        String errorPanel();\n        String errorPanelWithError();\n    }\n\n    @UiField\n    DropDownEditorViewStyle style;\n\n    @UiField\n    @Editor.Ignore\n    HTMLPanel errorPanel;\n\n    @UiField\n    @Editor.Ignore\n    FlowPanel helpPanel;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n\n    LiveSearchDropDown dropDown;\n    DropDownEditor presenter;\n\n    @Override\n    public void init(final DropDownEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @UiConstructor\n    public DropDownEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public DropDownEditorView setDropDown(LiveSearchDropDown dropDown) {\n        this.dropDown = dropDown;\n        helpPanel.add(dropDown);\n        return this;\n    }\n\n    @Override\n    public DropDownEditorView addHelpContent(String title, String content, Placement placement) {\n        final Tooltip tooltip = new Tooltip(dropDown.asWidget());\n        tooltip.setContainer(\"body\");\n        tooltip.setShowDelayMs(1000);\n        tooltip.setPlacement(placement);\n        tooltip.setTitle(content);\n        helpPanel.add(tooltip);\n        return this;\n    }\n\n    @Override\n    public DropDownEditorView showError(SafeHtml message) {\n        errorTooltip.setTitle(message.asString());\n        errorPanel.removeStyleName(style.errorPanel());\n        errorPanel.addStyleName(style.errorPanelWithError());\n        return this;\n    }\n\n    @Override\n    public DropDownEditorView clearError() {\n        errorTooltip.setTitle(\"\");\n        errorPanel.removeStyleName(style.errorPanelWithError());\n        errorPanel.addStyleName(style.errorPanel());\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n    >\n\n  <ui:style type=\"org.dashbuilder.common.client.editor.list.DropDownEditorView.DropDownEditorViewStyle\">\n    .errorPanel {\n      border: none;\n    }\n    .errorPanelWithError {\n      border-style: solid;\n      border-color: red;\n      border-width: 1px;\n    }\n  </ui:style>\n  \n  <g:HTMLPanel ui:field=\"errorPanel\" addStyleNames=\"{style.errorPanel} \">\n    <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n      <g:FlowPanel ui:field=\"helpPanel\">\n      </g:FlowPanel>\n    </b:Tooltip>\n  </g:HTMLPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownImageListEditor.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport org.dashbuilder.common.client.editor.HasEditMode;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>Images are shown using a drop down selector.</p>\n *\n * @param <T> The edited type.\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DropDownImageListEditor<T> extends ImageListEditor<T> implements HasEditMode {\n\n    boolean isEditMode = true;\n\n    public interface View<T> extends ImageListEditorView<T> {\n        void setDropDown(boolean isDropDown);\n    }\n\n    @Inject\n    public DropDownImageListEditor(DropDownImageListEditorView<T> dropDownImageListEditorView, Event<ValueChangeEvent<T>> valueChangeEvent) {\n        super(dropDownImageListEditorView, valueChangeEvent);\n    }\n\n    protected DropDownImageListEditor(ImageListEditorView<T> imageListEditorView, Event<ValueChangeEvent<T>> valueChangeEvent) {\n        super(imageListEditorView, valueChangeEvent);\n    }\n\n    @Override\n    public void isEditMode(final boolean isEdit) {\n        this.isEditMode = isEdit;\n        showElements();\n    }\n    \n    @Override\n    protected void showElements() {\n        super.showElements();\n        ((DropDownImageListEditor.View<T>)view).setDropDown(isEditMode && entries != null && entries.size() > 1);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownImageListEditorView.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.InlineLabel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.DropDown;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>The ImageListEditor view that uses a drop down as selector.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DropDownImageListEditorView<T> extends Composite implements DropDownImageListEditor.View<T> {\n\n    interface Binder extends UiBinder<Widget, DropDownImageListEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    interface DropDownImageListEditorViewStyle extends CssResource {\n        String errorPanel();\n        String errorPanelWithError();\n        String image();\n    }\n\n    @UiField\n    DropDownImageListEditorViewStyle style;\n\n    @UiField\n    @Editor.Ignore\n    HTMLPanel errorPanel;\n\n    @UiField\n    @Editor.Ignore\n    FlowPanel helpPanel;\n    \n    @UiField\n    @Editor.Ignore\n    DropDown dropDown;\n\n    @UiField\n    @Editor.Ignore\n    Anchor dropDownAnchor;\n\n    @UiField\n    @Editor.Ignore\n    DropDownMenu dropDownMenu;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n\n    @Editor.Ignore\n    Image currentTypeImage;\n\n    @Editor.Ignore\n    InlineLabel caret;\n\n    Tooltip currentTypeImageTooltip;\n    ImageListEditor<T> presenter;\n\n    @Override\n    public void init(final ImageListEditor<T> presenter) {\n        this.presenter = presenter;\n    }\n    \n    @UiConstructor\n    public DropDownImageListEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        currentTypeImage = new Image();\n        caret = new InlineLabel();\n        caret.addStyleName( \"caret\" );\n        caret.setVisible( true);\n\n        dropDownAnchor.add( currentTypeImage );\n        dropDownAnchor.add( caret );\n        dropDownAnchor.setEnabled( true );\n\n        currentTypeImageTooltip = new Tooltip(dropDown);\n        currentTypeImageTooltip.setContainer(\"body\");\n        currentTypeImageTooltip.setShowDelayMs(100);\n        currentTypeImage.addClickHandler(e -> currentTypeImageTooltip.hide());\n        caret.addClickHandler(e -> currentTypeImageTooltip.hide());\n        helpPanel.add(currentTypeImageTooltip);\n    }\n\n    @Override\n    public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,\n                                       final SafeHtml heading, final SafeHtml text,\n                                       final boolean selected, final Command clickCommand) {\n\n        if (selected) {\n            currentTypeImage.setUrl( uri );\n            currentTypeImage.setSize( width, height );\n        }\n        else {\n            final Tooltip tooltip = new Tooltip();\n            tooltip.setTitle(text.asString());\n            tooltip.setContainer(\"body\");\n            tooltip.setPlacement(Placement.RIGHT);\n            tooltip.setShowDelayMs(100);\n\n            final Image image = new Image(uri);\n            image.setWidth(width);\n            image.setHeight(height);\n            image.addStyleName(style.image());\n            image.addClickHandler(e -> {\n                tooltip.hide();\n                clickCommand.execute();\n            });\n\n            tooltip.setWidget(image);\n            dropDownMenu.add(image);\n        }\n\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> setHelpContent(String title, String content, Placement placement) {\n        currentTypeImageTooltip.setPlacement(placement);\n        currentTypeImageTooltip.setTitle(content);\n        currentTypeImageTooltip.hide();\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> showError(SafeHtml message) {\n        errorTooltip.setTitle(message.asString());\n        errorPanel.removeStyleName(style.errorPanel());\n        errorPanel.addStyleName(style.errorPanelWithError());\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> clearError() {\n        errorTooltip.setTitle(\"\");\n        errorPanel.removeStyleName(style.errorPanelWithError());\n        errorPanel.addStyleName(style.errorPanel());\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> clear() {\n        clearError();\n        dropDownMenu.clear();\n        return this;\n    }\n\n    @Override\n    public void setDropDown(boolean isDropDown) {\n        dropDownAnchor.setEnabled( isDropDown );\n        caret.setVisible( isDropDown );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/DropDownImageListEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n    >\n\n  <ui:style type=\"org.dashbuilder.common.client.editor.list.DropDownImageListEditorView.DropDownImageListEditorViewStyle\">\n    .errorPanel {\n      border: none;\n    }\n    .errorPanelWithError {\n      border-style: solid;\n      border-color: red;\n      border-width: 1px;\n    }\n    .image {\n      cursor: pointer;\n      margin: 5px;\n    }\n    .dropDown {\n      min-width: 32px;\n    }\n    .dropDown ul {\n      min-width: 0;\n    }\n  </ui:style>\n  \n  <g:HTMLPanel ui:field=\"errorPanel\" addStyleNames=\"{style.errorPanel} \">\n    <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n      <g:FlowPanel ui:field=\"helpPanel\">\n        <b:DropDown ui:field=\"dropDown\" addStyleNames=\"{style.dropDown}\">\n          <b:Anchor dataToggle=\"DROPDOWN\" ui:field=\"dropDownAnchor\"/>\n          <b:DropDownMenu ui:field=\"dropDownMenu\"/>\n        </b:DropDown>\n      </g:FlowPanel>\n    </b:Tooltip>\n  </g:HTMLPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/HorizImageListEditor.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>Images are shown in an single row container.</p>\n *\n * @param <T> The edited type.\n *\n * @since 0.4.0\n */\n@Dependent\npublic class HorizImageListEditor<T> extends ImageListEditor<T> {\n    \n    @Inject\n    public HorizImageListEditor(HorizImageListEditorView<T> horizImageListEditorView, Event<ValueChangeEvent<T>> valueChangeEvent) {\n        super(horizImageListEditorView, valueChangeEvent);\n    }\n\n    protected HorizImageListEditor(ImageListEditorView<T> imageListEditorView, Event<ValueChangeEvent<T>> valueChangeEvent) {\n        super(imageListEditorView, valueChangeEvent);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/HorizImageListEditorView.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.HasAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>The ImageListEditor default view. It places images in an horizontal way.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class HorizImageListEditorView<T> extends Composite implements ImageListEditorView<T> {\n\n    interface Binder extends UiBinder<Widget, HorizImageListEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    interface HorizImageListEditorViewStyle extends CssResource {\n        String errorPanel();\n        String errorPanelWithError();\n        String image();\n    }\n\n\n    @UiField\n    HorizImageListEditorViewStyle style;\n\n    @UiField\n    @Editor.Ignore\n    HTMLPanel errorPanel;\n\n    @UiField\n    @Editor.Ignore\n    FlowPanel helpPanel;\n    \n    @UiField\n    @Editor.Ignore\n    HorizontalPanel mainPanel;\n\n    @UiField\n    @Editor.Ignore\n    Tooltip errorTooltip;\n\n    ImageListEditor<T> presenter;\n\n    @Override\n    public void init(final ImageListEditor<T> presenter) {\n        this.presenter = presenter;\n    }\n    \n    @UiConstructor\n    public HorizImageListEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,\n                                       final SafeHtml heading, final SafeHtml text, \n                                       final boolean selected, final Command clickCommand) {\n        final VerticalPanel panel = new VerticalPanel();\n        panel.setVerticalAlignment(HasAlignment.ALIGN_MIDDLE);\n        panel.setHeight(\"100%\");\n\n        final Image image = new Image(uri);\n        image.setWidth(width);\n        image.setHeight(height);\n        image.addStyleName(style.image());\n        final double alpha = selected ? 1 : 0.2;\n        image.getElement().setAttribute(\"style\", \"filter: alpha(opacity=5);opacity: \" + alpha);\n\n        final Tooltip tooltip = new Tooltip();\n        tooltip.setTitle( text.asString() );\n        tooltip.setWidget(image);\n        tooltip.setContainer(\"body\");\n        tooltip.setPlacement(Placement.BOTTOM);\n        tooltip.setIsAnimated(false);\n        tooltip.setShowDelayMs(100);\n\n        final HTML label = new HTML(heading.asString());\n        final HorizontalPanel labelPanel = new HorizontalPanel();\n        labelPanel.setWidth(\"100%\");\n        labelPanel.setHorizontalAlignment(HasAlignment.ALIGN_CENTER);\n        labelPanel.add(label);\n\n        panel.add(tooltip);\n        panel.add(labelPanel);        \n        mainPanel.add(panel);\n\n        image.addClickHandler(e -> {\n            tooltip.hide();\n            tooltip.destroy();\n            clickCommand.execute();\n        });\n\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> setHelpContent(final String title, final String content, final Placement placement) {\n        final Tooltip tooltip = new Tooltip(mainPanel);\n        tooltip.setContainer(\"body\");\n        tooltip.setShowDelayMs(1000);\n        tooltip.setPlacement(placement);\n        tooltip.setTitle(content);\n        helpPanel.add(tooltip);\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> showError(SafeHtml message) {\n        errorTooltip.setTitle(message.asString());\n        errorPanel.removeStyleName(style.errorPanel());\n        errorPanel.addStyleName(style.errorPanelWithError());\n        return null;\n    }\n\n    @Override\n    public ImageListEditorView<T> clearError() {\n        errorTooltip.setTitle(\"\");\n        errorPanel.removeStyleName(style.errorPanelWithError());\n        errorPanel.addStyleName(style.errorPanel());\n        return this;\n    }\n\n    @Override\n    public ImageListEditorView<T> clear() {\n        clearError();\n        mainPanel.clear();\n        return this;\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/HorizImageListEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n    >\n\n  <ui:style type=\"org.dashbuilder.common.client.editor.list.HorizImageListEditorView.HorizImageListEditorViewStyle\">\n    .errorPanel {\n      border: none;\n    }\n    .errorPanelWithError {\n      border-style: solid;\n      border-color: red;\n      border-width: 1px;\n    }\n    .image {\n      cursor: pointer;\n    }\n  </ui:style>\n  \n  <g:HTMLPanel ui:field=\"errorPanel\" addStyleNames=\"{style.errorPanel} \">\n    <b:Tooltip container=\"body\" title=\"\" ui:field=\"errorTooltip\">\n      <g:FlowPanel ui:field=\"helpPanel\">\n        <g:HorizontalPanel spacing=\"10\" ui:field=\"mainPanel\"/>\n      </g:FlowPanel>\n    </b:Tooltip>\n  </g:HTMLPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/ImageListEditor.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\n/**\n * <p>Presenter for a gwt editor component that accepts multiple values and display each one using a given image.</p>\n * <p>The validation error messages are displayed by changing border color to RED and showing the message using a tooltip.</p>\n * <p>This component is typically used for handling enums.</p>\n *\n * @param <T> The edited type.\n *           \n * @since 0.4.0\n */\npublic abstract class ImageListEditor<T> implements IsWidget, LeafAttributeEditor<T> {\n\n    private static final String IMAGE_SIZE = \"160px\";\n\n    public class Entry {\n        private T value;\n        private SafeUri uri;\n        private SafeHtml heading;\n        private SafeHtml text;\n\n        private Entry(final T value, final SafeUri uri, final SafeHtml heading, final SafeHtml text) {\n            this.value = value;\n            this.uri = uri;\n            this.heading = heading;\n            this.text = text;\n        }\n\n        public T getValue() {\n            return value;\n        }\n\n        public SafeUri getUri() {\n            return uri;\n        }\n\n        public SafeHtml getHeading() {\n            return heading;\n        }\n\n        public SafeHtml getText() {\n            return text;\n        }\n    }\n    \n    \n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<T>> valueChangeEvent;\n    public ImageListEditorView<T> view;\n    \n    final List<Entry> entries = new ArrayList<Entry>();\n    String imageWidth = IMAGE_SIZE;\n    String imageHeight = IMAGE_SIZE;\n    T value;\n\n    public ImageListEditor(final ImageListEditorView<T> view,\n                           final Event<org.dashbuilder.common.client.event.ValueChangeEvent<T>> valueChangeEvent) {\n        this.view = view;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public Entry newEntry(final T value, final SafeUri uri, final SafeHtml heading, final SafeHtml text) {\n        return new Entry(value, uri, heading, text);\n    }\n    \n    public void setEntries(final Collection<Entry> entries) {\n        this.entries.clear();\n        if (entries != null) {\n            this.entries.addAll(entries);\n        }\n        showElements();\n    }\n    \n    public void setImageSize(final String w, final String h) {\n        this.imageWidth = w;\n        this.imageHeight = h;\n    }\n\n    public void setHelpContent(final String title, final String content, final Placement placement) {\n        view.setHelpContent(title, content, placement);\n    }\n    \n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public void showErrors(final List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (EditorError error : errors) {\n            if (error.getEditor().equals(this)) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public T getValue() {\n        return value;\n    }\n\n    @Override\n    public void setValue(final T value) {\n        setValue(value, false);\n    }\n\n    public void setValue(final T value, final boolean fireEvents) {\n        if (this.value != null && this.value.equals(value)) return;\n\n        T before = this.value;\n        this.value = value;\n\n        showElements();\n\n        if (fireEvents) {\n            valueChangeEvent.fire(new org.dashbuilder.common.client.event.ValueChangeEvent<T>(this, before, this.value));\n        }\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n    \n    public void clear() {\n        this.entries.clear();\n        this.imageWidth = IMAGE_SIZE;\n        this.imageHeight = IMAGE_SIZE;\n        this.value = null;\n        view.clear();\n        \n    }\n    /*************************************************************\n     ** PRIVATE EDITOR METHODS **\n     *************************************************************/\n\n    protected void showElements() {\n        view.clear(); \n        for (final Entry entry : entries) {\n            final boolean selected = this.value == null || entry.getValue().equals(this.value);\n            view.add(entry.getUri(), this.imageWidth, this.imageHeight, entry.getHeading(), entry.getText(), selected, () -> {\n                ImageListEditor.this.setValue(entry.getValue(), true);\n            });\n         }\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/list/ImageListEditorView.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>An image list editor view contract.</p>\n *\n * @since 0.4.0\n */\npublic interface ImageListEditorView<T> extends UberView<ImageListEditor<T>> {\n\n    ImageListEditorView<T> add(final SafeUri uri, final String width, final String height,\n                final SafeHtml heading, final SafeHtml text,\n                final boolean selected, final Command clickCommand);\n    ImageListEditorView<T> setHelpContent(final String title, final String content, final Placement placement);\n    ImageListEditorView<T> showError(final SafeHtml message);\n    ImageListEditorView<T> clearError();\n    ImageListEditorView<T> clear();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/map/MapEditor.java",
    "content": "package org.dashbuilder.common.client.editor.map;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport com.google.gwt.editor.client.LeafValueEditor;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.common.client.resources.i18n.DashbuilderCommonConstants;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.*;\n\n/**\n * <p>Provides an editor for a Map instance of String values.</p>\n * \n * @since 0.4.0\n */\n@Dependent\npublic class MapEditor implements IsWidget, LeafAttributeEditor<Map<String, String>> {\n\n    public interface View extends UberView<MapEditor> {\n\n        View setEmptyText(String text);\n\n        View setAddText(String text);\n        \n        View addTextColumn(int columnIndex, String header, boolean isSortable, int width);\n\n        View addButtonColumn(int columnIndex, String header, int width);\n\n        View removeColumn(int index);\n\n        View setRowCount(int count);\n        \n        View setData(List<Map.Entry<String, String>> data);\n        \n        View showError(SafeHtml message);\n\n        View clearError();\n        \n    }\n    \n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<Map<String, String>>> valueChangeEvent;\n    public View view;\n\n    Map<String, String> value;\n    \n    @Inject\n    public MapEditor(final View view,\n                     final Event<org.dashbuilder.common.client.event.ValueChangeEvent<Map<String, String>>> valueChangeEvent) {\n        this.view = view;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setAddText(DashbuilderCommonConstants.INSTANCE.add());\n        initDataGrid();\n    }\n    \n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n    \n    @Override\n    public void showErrors(final List<EditorError> errors) {\n        StringBuilder sb = new StringBuilder();\n        for (EditorError error : errors) {\n\n            if (error.getEditor() == this) {\n                sb.append(\"\\n\").append(error.getMessage());\n            }\n        }\n\n        boolean hasErrors = sb.length() > 0;\n        if (!hasErrors) {\n            view.clearError();\n            return;\n        }\n\n        // Show the errors.\n        view.showError(new SafeHtmlBuilder().appendEscaped(sb.substring(1)).toSafeHtml());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setValue(final Map<String, String> value) {\n        setValue(value, false);\n    }\n    \n    @Override\n    public Map<String, String> getValue() {\n        return value;\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n\n    void addEntry() {\n        onAddEntry();\n    }\n    \n    String getValue(final int columnIndex, final Map.Entry<String, String> object) {\n        \n        // Key updated.\n        if (columnIndex == 0) {\n            return object.getKey();\n        }\n\n        // Value updated.\n        if (columnIndex == 1) {\n            return object.getValue();\n        }\n        \n        return null;\n    }\n\n    void update(final int columnIndex, final int index, final Map.Entry<String, String> object, final String value) {\n        \n        // Key updated.\n        if (columnIndex == 0) {\n            onKeyUpdated(index, object, value);\n        \n        // Value updated.\n        } else if (columnIndex == 1) {\n            onValueUpdated(index, object, value);\n        \n        // Remove action.\n        } else if (columnIndex == 2) {\n            onRemoveEntry(object);\n        }\n        \n    }\n\n    /*************************************************************\n     ** PRIVATE EDITOR METHODS **\n     *************************************************************/\n    \n    private void onKeyUpdated(final int index, final Map.Entry<String, String> object, final String value) {\n        final HashMap<String, String> _m = new LinkedHashMap<String, String>(getValue());\n        final String lastKeyValue = object.getKey();\n        String mapValue = \"\";\n        if (lastKeyValue != null) {\n            mapValue = _m.remove(lastKeyValue);\n        }\n        _m.put(value, mapValue);\n        setValue(_m, true);\n    }\n\n    private void onValueUpdated(final int index, final Map.Entry<String, String> object, final String value) {\n        // Look for the entry.\n        final String key = getKeyParameter(index);\n        final HashMap<String, String> _m = new LinkedHashMap<String, String>(getValue());\n        _m.put(key, value);\n        setValue(_m, true);\n    }\n    \n    private void onRemoveEntry(final Map.Entry<String, String> object) {\n        if (getValue() != null) {\n            final HashMap<String, String> _m = new LinkedHashMap<String, String>(getValue());\n            _m.remove(object.getKey());\n            setValue(_m, true);\n        }\n    }\n\n    private void onAddEntry() {\n        final String key = DashbuilderCommonConstants.INSTANCE.newValue();\n        final String value = DashbuilderCommonConstants.INSTANCE.newValue();\n        final HashMap<String, String> _m = new LinkedHashMap<String, String>();;\n        _m.put(key, value);\n        if (getValue() != null) {\n          _m.putAll(getValue());  \n        }\n\n        // New value.\n        setValue(_m, true);\n    }\n    \n    private void setValue(final Map<String, String> value, final boolean fireEvents) {\n        // Disable current error markers, if present.\n        view.clearError();\n\n        final Map<String, String> before = this.value;\n        this.value = value;\n\n        // Fill grid values.\n        redraw();\n\n        // Fire events, if necessary.\n        if (fireEvents) {\n            valueChangeEvent.fire(new ValueChangeEvent<Map<String, String>>(this, before, value));\n        }\n    }\n\n    private void initDataGrid() {\n        view.setEmptyText(DashbuilderCommonConstants.INSTANCE.noData());\n        addColumns();\n\n    }\n\n    private void addColumns() {\n        // Key column.\n        view.addTextColumn(0, DashbuilderCommonConstants.INSTANCE.key(), false, 20);\n\n        // Value column.\n        view.addTextColumn(1, DashbuilderCommonConstants.INSTANCE.value(), false, 20);\n\n        // Remove action column.\n        view.addButtonColumn(2, DashbuilderCommonConstants.INSTANCE.actions(), 20);\n\n    }\n\n    private String getKeyParameter(final int index) {\n        if (getValue() != null && !getValue().isEmpty() && index > -1) {\n            int x = 0;\n            for (Map.Entry<String, String> entry : getValue().entrySet()) {\n                if (index == x) return entry.getKey();\n                x++;\n            }\n\n        }\n        return null;\n    }\n    \n    private void redraw() {\n        // NOTE: If not removing and re-adding columns, grid tow data refresh is not well done.\n        view.removeColumn(0);\n        view.removeColumn(0);\n        view.removeColumn(0);\n\n        // Rebuild grid columns.\n        initDataGrid();\n\n        // Set new data.\n        final int count = value != null ? value.size() : 0;\n        final List<Map.Entry<String, String>> list = value != null ? new LinkedList<Map.Entry<String, String>>(value.entrySet()) : new LinkedList<Map.Entry<String, String>>();\n        view.setRowCount(count);\n        view.setData(list);\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/map/MapEditorView.java",
    "content": "package org.dashbuilder.common.client.editor.map;\n\nimport com.google.gwt.cell.client.EditTextCell;\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.*;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\n\nimport javax.enterprise.context.Dependent;\nimport java.util.List;\nimport java.util.Map;\n\n/**\n * <p>The MapEditor view that uses a DataGrid widget.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class MapEditorView extends Composite implements MapEditor.View {\n\n    interface Binder extends UiBinder<Widget, MapEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    @UiField\n    @Editor.Ignore\n    HTMLPanel mainPanel;\n\n    @UiField\n    @Editor.Ignore\n    ScrollPanel gridPanel;\n\n    @UiField\n    DataGrid<Map.Entry<String, String>> grid;\n\n    @UiField\n    @Editor.Ignore\n    org.gwtbootstrap3.client.ui.Button addButton;\n\n    @UiField\n    @Editor.Ignore\n    org.gwtbootstrap3.client.ui.Label errorLabel;\n    \n    private MapEditor presenter;\n\n    @UiConstructor\n    public MapEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        addButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                presenter.addEntry();\n            }\n        });\n    }\n    \n    @Override\n    public void init(final MapEditor presenter) {\n        this.presenter = presenter;\n    }\n\n\n    @Override\n    public MapEditor.View setEmptyText(final String text) {\n        grid.setEmptyTableWidget(new org.gwtbootstrap3.client.ui.Label(text));\n        return this;\n    }\n\n    @Override\n    public MapEditor.View setAddText(final String text) {\n        addButton.setText(text);\n        addButton.setTitle(text);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View addTextColumn(final int columnIndex, final String heading, boolean isSortable, int width) {\n        final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> keyColumn =\n                new com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String>(new EditTextCell()) {\n                    @Override\n                    public String getValue(final Map.Entry<String, String> object) {\n                        return presenter.getValue(columnIndex, object);\n                    }\n                };\n        addColumn(keyColumn, columnIndex, heading, isSortable, width);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View addButtonColumn(final int columnIndex, final String header, final int width) {\n        final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> removeColumn =\n                new com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String>(new ButtonCell( IconType.MINUS, ButtonSize.EXTRA_SMALL)) {\n\n                    @Override\n                    public String getValue(Map.Entry<String, String> object) {\n                        return presenter.getValue(columnIndex, object);\n                    }\n                };\n        addColumn(removeColumn, columnIndex, header, false, width);\n        return this;\n    }\n    \n    private void addColumn(final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> column,\n                           final int columnIndex, final String header, final boolean isSortable, final int width) {\n        column.setSortable(isSortable);\n        column.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);\n        grid.addColumn(column, header);\n        grid.setColumnWidth(column, width, Style.Unit.PCT);\n        column.setFieldUpdater(new FieldUpdater<Map.Entry<String, String>, String>() {\n            @Override\n            public void update(final int index, final Map.Entry<String, String> object, final String value) {\n                presenter.update(columnIndex, index, object, value);\n            }\n        });\n    }\n\n    @Override\n    public MapEditor.View removeColumn(final int index) {\n        grid.removeColumn(index);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View setRowCount(final int count) {\n        grid.setRowCount(count);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View setData(final List<Map.Entry<String, String>> data) {\n        grid.setRowData(0, data);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View showError(final SafeHtml message) {\n        final Element element = errorLabel.getElement();\n        element.setInnerText(message.asString());\n        element.getStyle().setDisplay(Style.Display.INLINE);\n        element.getStyle().setBorderColor(\"red\");\n        element.getStyle().setBorderStyle(Style.BorderStyle.SOLID);\n        element.getStyle().setBorderWidth(1, Style.Unit.PX);\n        errorLabel.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public MapEditor.View clearError() {\n        final Element element = errorLabel.getElement();\n        element.setInnerText(\"\");\n        element.getStyle().setDisplay(Style.Display.NONE);\n        element.getStyle().setBorderWidth(0, Style.Unit.PX);\n        errorLabel.setVisible(false);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/editor/map/MapEditorView.ui.xml",
    "content": "<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder' \n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\">\n  <ui:style>\n    .mainPanel {\n\n    }\n    .errorPanelError {\n      border: 1px solid red;\n    }\n    .gridPanel {\n      width: 100%;\n    }\n    .grid {\n      width: 100%;\n      height: 200px;\n      font-size: small;\n      overflow: auto;\n    }\n    .addButtonPanel {\n      width: 100%;\n      text-align: right;\n    }\n  </ui:style>\n\n  <g:HTMLPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel} \">\n\n    <b:Label ui:field=\"errorLabel\" visible=\"false\"/>\n    <g:ScrollPanel ui:field=\"gridPanel\" addStyleNames=\"{style.gridPanel} \">\n      <bg:DataGrid ui:field=\"grid\" addStyleNames=\"{style.grid} \">\n      </bg:DataGrid>\n    </g:ScrollPanel>\n\n    <g:FlowPanel addStyleNames=\"{style.addButtonPanel} \">\n\n      <b:Button ui:field=\"addButton\" icon=\"PLUS\"/>\n\n    </g:FlowPanel>\n\n  </g:HTMLPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/error/ClientRuntimeError.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.error;\n\nimport org.dashbuilder.common.client.StringUtils;\n\n/**\n * Class that wraps errors either captured or generated on client runtime.\n */\npublic class ClientRuntimeError {\n\n    private String message;\n    private Throwable throwable;\n\n    public ClientRuntimeError(String message) {\n        this(message, null);\n    }\n\n    public ClientRuntimeError(Throwable e) {\n        this(null, e);\n    }\n\n    public ClientRuntimeError(String message, Throwable e) {\n        this.message = message;\n        this.throwable = e;\n    }\n\n    public Throwable getThrowable() {\n        return throwable;\n    }\n\n    public String getMessage() {\n        if (!StringUtils.isBlank(message)) {\n            return message;\n        }\n\n        Throwable root = getRootCause();\n        return root.toString();\n    }\n\n    public String getCause() {\n        Throwable root = getRootCause();\n        if (root == null || getMessage().equals(root.toString())) {\n            return null;\n        } else {\n            return root.getMessage();\n        }\n    }\n\n    public Throwable getRootCause() {\n        Throwable target = throwable;\n        while (true) {\n            if (target == null || target.getCause() == null) {\n                return target;\n            } else {\n                target = target.getCause();\n            }\n        }\n    }\n\n    public String toString() {\n        String cause = getCause();\n        return getMessage() + (cause != null ? \" (cause: \" + cause + \")\" : \"\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/event/ContextualEvent.java",
    "content": "package org.dashbuilder.common.client.event;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Base class for any event that is fired for a given context.</p>\n * \n * @since 0.4.0\n */\npublic abstract class ContextualEvent implements UberFireEvent {\n    private final Object context;\n\n    public ContextualEvent(Object context) {\n        this.context = context;\n    }\n\n    public Object getContext() {\n        return context;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/event/ValueChangeEvent.java",
    "content": "package org.dashbuilder.common.client.event;\n\n/**\n * <p>CDI event for components that have a value and it can be changed.</p>\n * \n * @since 0.4.0\n */\npublic class ValueChangeEvent<T> extends ContextualEvent {\n\n    private final T oldValue;\n    private final T value;\n\n    public ValueChangeEvent(final Object context, final T oldValue, final T value) {\n        super(context);\n        this.oldValue = oldValue;\n        this.value = value;\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    public T getOldValue() {\n        return oldValue;\n    }\n\n    @Override\n    public String toString() {\n        return \"ValueChangeEvent [value=\" + value.toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/resources/bundles/DashbuilderCommonImages.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.common.client.resources.bundles;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.DataResource;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for common client components.\n */\npublic interface DashbuilderCommonImages extends ClientBundle {\n\n    /*\n            DEFAULT SLIDER\n     */\n    @Source(\"images/slider/default/lessh.png\")\n    ImageResource lessh();\n\n    @Source(\"images/slider/default/lessv.png\")\n    ImageResource lessv();\n    \n    @Source(\"images/slider/default/moreh.png\")\n    ImageResource moreh();\n\n    @Source(\"images/slider/default/morev.png\")\n    ImageResource morev();\n\n    @Source(\"images/slider/default/scaleh.png\")\n    DataResource scaleh();\n\n    @Source(\"images/slider/default/scalev.png\")\n    DataResource scalev();\n\n    @Source(\"images/slider/default/dragh.png\")\n    ImageResource dragh();\n\n    @Source(\"images/slider/default/dragv.png\")\n    ImageResource dragv();\n\n    /*\n            TRIANGLE SLIDER\n     */\n\n    @Source(\"images/slider/triangle/drag.png\")\n    ImageResource dragt();\n\n    @Source(\"images/slider/triangle/line.png\")\n    DataResource linet();\n\n    @Source(\"images/slider/triangle/more_less.png\")\n    ImageResource moreLesst();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/resources/bundles/DashbuilderCommonResources.java",
    "content": "package org.dashbuilder.common.client.resources.bundles;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface DashbuilderCommonResources extends ClientBundle {\n\n    DashbuilderCommonResources INSTANCE = GWT.create(DashbuilderCommonResources.class);\n    \n    DashbuilderCommonImages IMAGES = GWT.create(DashbuilderCommonImages.class);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface DashbuilderCommonConstants extends ConstantsWithLookup {\n\n    DashbuilderCommonConstants INSTANCE = GWT.create( DashbuilderCommonConstants.class );\n\n    String add();\n    String remove();\n    String noData();\n    String key();\n    String value();\n    String actions();\n    String newValue();\n    String currentFilePath();\n    String uploadSuccessful();\n    String uploadFailed();\n    String uploadFailedAlreadyExists();\n    String clearAll();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages.java",
    "content": "package org.dashbuilder.common.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * <p>Common messages.</p>\n *\n * @since 0.3.0 \n */\npublic interface DashbuilderCommonMessages extends Messages {\n\n    public static final DashbuilderCommonMessages INSTANCE = GWT.create(DashbuilderCommonMessages.class);\n    \n    String timeout(String seconds);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertBox.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.Command;\n\npublic class AlertBox implements IsElement {\n\n    public enum Level {\n        DANGER,\n        WARNING,\n        SUCCESS,\n        INFO\n    }\n\n    public interface View extends UberElement<AlertBox> {\n\n        void setMessage(String text);\n\n        void setLevel(Level level);\n\n        void setCloseEnabled(boolean enabled);\n    }\n\n    private View view;\n    private Command onCloseCommand;\n\n    @Inject\n    public AlertBox(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void setLevel(Level level) {\n        view.setLevel(level);\n    }\n\n    public void setCloseEnabled(boolean enabled) {\n        view.setCloseEnabled(enabled);\n    }\n\n    public void setMessage(String text) {\n        view.setMessage(text);\n    }\n\n    public void setOnCloseCommand(Command onCloseCommand) {\n        this.onCloseCommand = onCloseCommand;\n    }\n\n    public void close() {\n        if (onCloseCommand != null) {\n            onCloseCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertBoxView.html",
    "content": "<div data-field=\"alertDiv\" class=\"alert alert-info\">\n    <button data-field=\"closeButton\" type=\"button\" class=\"close\" data-dismiss=\"alert\" aria-hidden=\"true\">\n        <span class=\"pficon pficon-close\"></span>\n    </button>\n    <span data-field=\"alertIcon\" class=\"pficon pficon-info\"></span>\n    <span data-field=\"alertMessage\"></span>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertBoxView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class AlertBoxView implements AlertBox.View, IsElement {\n\n    @Inject\n    @DataField\n    Div alertDiv;\n\n    @Inject\n    @DataField\n    Button closeButton;\n\n    @Inject\n    @DataField\n    Span alertIcon;\n\n    @Inject\n    @DataField\n    Span alertMessage;\n\n    AlertBox presenter;\n\n    private static final String[] ALERT_CLASS = {\"alert-danger\", \"alert-warning\", \"alert-success\", \"alert-info\"};\n    private static final String[] ALERT_ICON = {\"pficon-error-circle-o\", \"pficon-warning-triangle-o\", \"pficon-ok\", \"pficon-info\"};\n\n    @Override\n    public void init(AlertBox presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setMessage(String text) {\n        alertMessage.setTextContent(text);\n    }\n\n    @Override\n    public void setLevel(AlertBox.Level level) {\n        String _alertClass = ALERT_CLASS[level.ordinal()];\n        String _alertIcon = ALERT_ICON[level.ordinal()];\n        alertDiv.setClassName(\"alert \" + _alertClass);\n        alertIcon.setClassName(\"pficon \" + _alertIcon);\n    }\n\n    @Override\n    public void setCloseEnabled(boolean enabled) {\n        closeButton.setHidden(!enabled);\n    }\n\n    @EventHandler(\"closeButton\")\n    private void onClose(ClickEvent event) {\n        presenter.close();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.AlertType;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class AlertPanel implements IsWidget {\n\n    public interface View extends UberView<AlertPanel> {\n\n        void show(AlertType severity,\n                  String message,\n                  Integer width,\n                  Command onOk,\n                  Command onCancel);\n    }\n\n    View view = null;\n\n    public AlertPanel() {\n        this(new AlertPanelView());\n    }\n\n    @Inject\n    public AlertPanel(View view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(AlertType severity, String message, Integer width, Command onOk, Command onCancel) {\n        view.show(severity, message, width, onOk, onCancel);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Alert;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.AlertType;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class AlertPanelView extends Composite implements AlertPanel.View {\n\n    interface ViewBinder extends UiBinder<Widget, AlertPanelView> {}\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    @UiField\n    Alert alert;\n\n    @UiField\n    Button okButton;\n\n    @UiField\n    Button cancelButton;\n\n    AlertPanel presenter;\n\n    Map<AlertType,String> pflyIconMap = new HashMap<AlertType, String>();\n\n    @Override\n    public void init(AlertPanel presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n        pflyIconMap.put(AlertType.SUCCESS, \"pficon-ok\");\n        pflyIconMap.put(AlertType.INFO, \"pficon-info\");\n        pflyIconMap.put(AlertType.WARNING, \"pficon-warning-triangle-o\");\n        pflyIconMap.put(AlertType.DANGER, \"pficon-error-circle-o\");\n        pflyIconMap.put(AlertType.DEFAULT, \"pficon-info\");\n    }\n\n    @Override\n    public void show(AlertType severity, String message, Integer width, final Command onOk, final Command onCancel) {\n        alert.setType(severity);\n        alert.addStyleName(\"pficon\");\n        alert.addStyleName(pflyIconMap.get(severity));\n        alert.setText(\"  \" + message + \"  \");\n        if (width != null) {\n            alert.setWidth(width + \"px\");\n        }\n\n        if (onOk != null) {\n            okButton.addClickHandler(new ClickHandler() {\n                public void onClick(ClickEvent clickEvent) {\n                    onOk.execute();\n                }\n            });\n        }\n        if (onCancel != null) {\n            cancelButton.setVisible(true);\n            cancelButton.addClickHandler(new ClickHandler() {\n                public void onClick(ClickEvent clickEvent) {\n                    onCancel.execute();\n                }\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/AlertPanelView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .buttonsPanel {\n      float: right;\n      position: relative;\n      margin: 10px;\n    }\n    .button {\n      margin: 5px;\n    }\n  </ui:style>\n\n  <b:Alert ui:field=\"alert\">\n    <g:FlowPanel addStyleNames=\"{style.buttonsPanel}\">\n        <b:Button ui:field=\"okButton\" type=\"DEFAULT\" text=\"{i18nCommon.OK}\" addStyleNames=\"{style.button}\" />\n        <b:Button ui:field=\"cancelButton\" type=\"DEFAULT\" text=\"{i18nCommon.Cancel}\" addStyleNames=\"{style.button}\" />\n    </g:FlowPanel>\n  </b:Alert>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/CharacterBox.java",
    "content": "package org.dashbuilder.common.client.widgets;\n\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.InputElement;\nimport com.google.gwt.user.client.ui.RootPanel;\n\n/**\n * <p>Box class for character entry widgets (Support boostrap style).</p>\n * <p>This class implementation is same as <code>com.github.gwtbootstrap.client.ui.TextBox</code> but this one inherits from <code>CharacterBoxBase</code>.</p> \n *\n * @since 0.3.0\n */\npublic class CharacterBox extends CharacterBoxBase {\n\n    /**\n     * Creates a TextBox widget that wraps an existing &lt;input type='text'&gt;\n     * element.\n     *\n     * This element must already be attached to the document. If the element is\n     * removed from the document, you must call\n     * {@link RootPanel#detachNow(com.google.gwt.user.client.ui.Widget)}.\n     *\n     * @param element\n     *            the element to be wrapped\n     */\n    public static CharacterBox wrap(Element element) {\n        // Assert that the element is attached.\n        assert Document.get().getBody().isOrHasChild(element);\n\n        CharacterBox textBox = new CharacterBox(element);\n\n        // Mark it attached and remember it for cleanup.\n        textBox.onAttach();\n        RootPanel.detachOnWindowClose(textBox);\n\n        return textBox;\n    }\n\n    /**\n     * Creates an empty text box.\n     */\n    public CharacterBox() {\n        this(Document.get().createTextInputElement(), \"gwt-TextBox\");\n    }\n\n    /**\n     * This constructor may be used by subclasses to explicitly use an existing\n     * element. This element must be an &lt;input&gt; element whose type is\n     * 'text'.\n     *\n     * @param element\n     *            the element to be used\n     */\n    protected CharacterBox(Element element) {\n        super(element);\n        assert InputElement.as(element).getType().equalsIgnoreCase(\"text\");\n    }\n\n    CharacterBox(Element element,\n            String styleName) {\n        super(element);\n        if (styleName != null) {\n            setStyleName(styleName);\n        }\n    }\n\n    /**\n     * Gets the maximum allowable length of the text box.\n     *\n     * @return the maximum length, in characters\n     */\n    public int getMaxLength() {\n        return getInputElement().getMaxLength();\n    }\n\n    /**\n     * Gets the number of visible characters in the text box.\n     *\n     * @return the number of visible characters\n     */\n    public int getVisibleLength() {\n        return getInputElement().getSize();\n    }\n\n    /**\n     * Sets the maximum allowable length of the text box.\n     *\n     * @param length\n     *            the maximum length, in characters\n     */\n    public void setMaxLength(int length) {\n        getInputElement().setMaxLength(length);\n    }\n\n    /**\n     * Sets the number of visible characters in the text box.\n     *\n     * @param length\n     *            the number of visible characters\n     */\n    public void setVisibleLength(int length) {\n        getInputElement().setSize(length);\n    }\n\n    private InputElement getInputElement() {\n        return getElement().cast();\n    }\n\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/CharacterBoxBase.java",
    "content": "package org.dashbuilder.common.client.widgets;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.text.shared.AbstractRenderer;\nimport com.google.gwt.text.shared.Parser;\nimport org.gwtbootstrap3.client.ui.base.ValueBoxBase;\n\n/**\n * <p>Abstract base class for most character entry widgets. and Support boostrap style.</p>\n * <p>This class implementation is same as <code>com.github.gwtbootstrap.client.ui.base.TextBoxBase</code> but using Character types instead of String.</p> \n *\n * @since 0.3.0\n */\npublic class CharacterBoxBase extends ValueBoxBase<Character> {\n\n    private static final PassthroughRenderer RENDERER_INSTANCE = new PassthroughRenderer();\n    private static final PassthroughParser PARSER_INSTANCE = new PassthroughParser();\n\n    /**\n     * Creates a text box that wraps the given browser element handle. This is\n     * only used by subclasses.\n     *\n     * @param elem\n     *            the browser element to wrap\n     */\n    protected CharacterBoxBase(Element elem) {\n        super(elem, RENDERER_INSTANCE, PARSER_INSTANCE);\n    }\n\n    /**\n     * Overridden to return \"\" from an empty text box.\n     */\n    @Override\n    public Character getValue() {\n        Character raw = super.getValue();\n        return raw == null\n                ? ' '\n                : raw;\n    }\n\n    private static class PassthroughRenderer extends AbstractRenderer<Character> {\n\n        public PassthroughRenderer() {\n        }\n\n        public String render(Character object) {\n            return object.toString();\n        }\n    }\n\n\n    private static class PassthroughParser implements Parser<Character> {\n\n        public PassthroughParser() {\n            \n        }\n\n        public Character parse(CharSequence object) {\n            if (object.length() > 0) return object.charAt(0);\n            return null;\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabel.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.Command;\n\npublic class FilterLabel implements IsElement {\n\n    public interface View extends UberElement<FilterLabel> {\n\n        void setLabel(String label);\n    }\n\n    private View view;\n    private String label;\n    private Command onRemoveCommand;\n\n    @Inject\n    public FilterLabel(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void setLabel(String label) {\n        this.label = label;\n        view.setLabel(label);\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public void setOnRemoveCommand(Command onRemoveCommand) {\n        this.onRemoveCommand = onRemoveCommand;\n    }\n\n    void onRemove() {\n        if (onRemoveCommand != null) {\n            onRemoveCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabelSet.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.Command;\n\npublic class FilterLabelSet implements IsElement {\n\n    public interface View extends UberElement<FilterLabelSet> {\n\n        void clearAll();\n\n        void setClearAllEnabled(boolean enabled);\n\n        void addLabel(FilterLabel label);\n    }\n\n    private View view;\n    private SyncBeanManager beanManager;\n    private Command onClearAllCommand;\n    private int numberOfLabels = 0;\n\n    @Inject\n    public FilterLabelSet(View view, SyncBeanManager beanManager) {\n        this.view = view;\n        this.beanManager = beanManager;\n        this.view.init(this);\n        this.view.setClearAllEnabled(false);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void clear() {\n        view.clearAll();\n        view.setClearAllEnabled(false);\n        numberOfLabels = 0;\n    }\n\n    public FilterLabel addLabel(String label) {\n        FilterLabel filterLabel = beanManager.lookupBean(FilterLabel.class).newInstance();\n        filterLabel.setLabel(label);\n        view.addLabel(filterLabel);\n        numberOfLabels++;\n        view.setClearAllEnabled(numberOfLabels>1);\n        return filterLabel;\n    }\n\n    public void setOnClearAllCommand(Command onClearAllCommand) {\n        this.onClearAllCommand = onClearAllCommand;\n    }\n\n    void onClearAll() {\n        this.clear();\n        if (onClearAllCommand != null) {\n            onClearAllCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabelSetView.html",
    "content": "<div data-field=\"mainDiv\">\n    <a data-field=\"clearAll\" style=\"cursor: pointer; white-space: nowrap;\">Clear All</a>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabelSetView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.dashbuilder.common.client.resources.i18n.DashbuilderCommonConstants;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class FilterLabelSetView implements FilterLabelSet.View, IsElement {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Anchor clearAll;\n\n    FilterLabelSet presenter;\n\n    @Override\n    public void init(FilterLabelSet presenter) {\n        this.presenter = presenter;\n        clearAll.setTextContent(DashbuilderCommonConstants.INSTANCE.clearAll());\n    }\n\n    @Override\n    public void clearAll() {\n        DOMUtil.removeAllChildren(mainDiv);\n        mainDiv.appendChild(clearAll);\n    }\n\n    @Override\n    public void setClearAllEnabled(boolean enabled) {\n        clearAll.setHidden(!enabled);\n    }\n\n    @Override\n    public void addLabel(FilterLabel label) {\n        mainDiv.insertBefore(label.getElement(), clearAll);\n    }\n\n    @EventHandler(\"clearAll\")\n    private void onClearAll(ClickEvent event) {\n        presenter.onClearAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabelView.html",
    "content": "<span class=\"label label-info\" style=\"margin-right: 5px; font-size: smaller;\">\n    <span data-field=\"labelText\"></span>\n    <a data-field=\"labelRemove\" style=\"color: white; cursor: pointer;\"><i class=\"pficon-close\"></i></a>\n</span>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/java/org/dashbuilder/common/client/widgets/FilterLabelView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class FilterLabelView implements FilterLabel.View, IsElement {\n\n    @Inject\n    @DataField\n    Span labelText;\n\n    @Inject\n    @DataField\n    Anchor labelRemove;\n\n    FilterLabel presenter;\n\n    @Override\n    public void init(FilterLabel presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setLabel(String label) {\n        labelText.setTextContent(label);\n    }\n\n    @EventHandler(\"labelRemove\")\n    private void onRemove(ClickEvent event) {\n        presenter.onRemove();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.common.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/CommonClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.toggleswitch.ToggleSwitch\"/>\n\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.dashbuilder.JSON\"/>\n\n  <source path='common'/>\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants.properties",
    "content": "add=Add\nremove=Remove\nnoData=No data\nkey=Key\nvalue=Value\nactions=Actions\nnewValue=--New Value--\ncurrentFilePath=Current file path\nuploadSuccessful=File uploaded successfully\nuploadFailed=File upload failed\nuploadFailedAlreadyExists=File upload failed. File already exists\nclearAll=Clear All"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_de.properties",
    "content": "add=Hinzufügen\nremove=Entfernen\nnoData=Keine Daten\nkey=Schlüssel\nvalue=Wert\nactions=Aktionen\nnewValue=--Neuer Wert--\ncurrentFilePath=Aktueller Dateipfad \nuploadSuccessful=Datei erfolgreich hochgeladen\nuploadFailed=Hochladen der Datei fehlgeschlagen\nuploadFailedAlreadyExists=Hochladen der Datei fehlgeschlagen. Datei existiert bereits\nclearAll=Alle löschen\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_es.properties",
    "content": "add=Agregar\nremove=Quitar\nnoData=No hay datos\nkey=Clave\nvalue=Valor\nactions=Acciones\nnewValue=--Nuevo valor--\ncurrentFilePath=Ruta de archivo actual\nuploadSuccessful=El archivo se cargó correctamente\nuploadFailed=Error al cargar el archivo\nuploadFailedAlreadyExists=Error al cargar el archivo. El archivo ya existe\nclearAll=Borrar todo"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_fr.properties",
    "content": "add=Ajouter\nremove=Supprimer\nnoData=Aucune donnée\nkey=Clé\nvalue=Valeur\nactions=Actions\nnewValue=--Nouvelle valeur--\ncurrentFilePath=Chemin d''accès du fichier actuel\nuploadSuccessful=Fichier envoyé avec succès\nuploadFailed=Échec d''envoi du fichier\nuploadFailedAlreadyExists=L''envoi du fichier a échoué. Le fichier existe déjà\nclearAll=Effacer tout"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_it.properties",
    "content": "add=Aggiungi\nremove=Rimuovi\nnoData=Nessun dato\nkey=Chiave\nvalue=Valore\nactions=Azioni\nnewValue=--Nuovo Valore--\ncurrentFilePath=Percorso file corrente\nuploadSuccessful=Caricamento file riuscito\nuploadFailed=Caricamento file fallito\nuploadFailedAlreadyExists=Caricamento file fallito. Il file esiste già\nclearAll=Cancella tutto\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_ja.properties",
    "content": "add=追加\nremove=削除\nnoData=データなし\nkey=キー\nvalue=値\nactions=アクション\nnewValue=--新しい値--\ncurrentFilePath=現在のファイルパス\nuploadSuccessful=ファイルが正しくアップロードされました\nuploadFailed=ファイルのアップロードが失敗しました\nuploadFailedAlreadyExists=ファイルのアップロードに失敗しました。ファイルはすでに存在します\nclearAll=すべて消去"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_pt_BR.properties",
    "content": "add=Adicionar\nremove=Remover\nnoData=Nenhum dado\nkey=Key\nvalue=Valor\nactions=Ações\nnewValue=--Novo Valor--\ncurrentFilePath=Caminho do Arquivo Atual\nuploadSuccessful=Arquivo carregado com êxito\nuploadFailed=Falha no carregamento do arquivo\nuploadFailedAlreadyExists=Falha no carregamento do arquivo. O arquivo já existe.\nclearAll=Limpar tudo\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonConstants_zh_CN.properties",
    "content": "add=添加\nremove=删除\nnoData=没有数据\nkey=键\nvalue=值\nactions=动作\nnewValue=--新的值--\ncurrentFilePath=当前文件路径\nuploadSuccessful=成功上传文件\nuploadFailed=文件上传失败\nuploadFailedAlreadyExists=文件上传失败。文件已存在。\nclearAll=清除所有\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages.properties",
    "content": "timeout=Timeout for current action fired after {0} seconds"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages_es.properties",
    "content": "timeout=Tiempo de espera para la acción actual disparada después de {0} segundos"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages_fr.properties",
    "content": "timeout=Délai d'exécution de l'action en cours après {0} secondes"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages_it.properties",
    "content": "timeout=Timeout per l''azione corrente scaduto dopo {0} secondi\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/main/resources/org/dashbuilder/common/client/resources/i18n/DashbuilderCommonMessages_ja.properties",
    "content": "timeout=現在のアクションのタイムアウトを {0} 秒後に実行する"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/StringTemplateBuilderTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client;\n\nimport java.util.Set;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class StringTemplateBuilderTest {\n\n    @Test\n    public void testNoReplacement() {\n        StringTemplateBuilder templateBuilder = new StringTemplateBuilder();\n        templateBuilder.setTemplate(\"Hello ${user} from ${place}.\");\n        Set<String> keys = templateBuilder.keys();\n        String code = templateBuilder.build();\n\n        assertEquals(keys.size(), 2);\n        assertTrue(keys.contains(\"user\"));\n        assertTrue(keys.contains(\"place\"));\n        assertEquals(code, \"Hello ${user} from ${place}.\");\n    }\n\n    @Test\n    public void testReplacement() {\n        StringTemplateBuilder templateBuilder = new StringTemplateBuilder();\n        templateBuilder.setTemplate(\"Hello ${user} from ${place}.\");\n        templateBuilder.replace(\"user\", \"Mark\");\n        templateBuilder.replace(\"place\", \"London\");\n        String code = templateBuilder.build();\n        assertEquals(code, \"Hello Mark from London.\");\n    }\n\n    @Test\n    public void testCustomKeys() {\n        StringTemplateBuilder templateBuilder = new StringTemplateBuilder();\n        templateBuilder.setKeyPrefix(\"[\");\n        templateBuilder.setKeySufix(\"]\");\n        templateBuilder.setTemplate(\"Hello [user] from [place].\");\n        templateBuilder.replace(\"user\", \"Mark\");\n        templateBuilder.replace(\"place\", \"London\");\n        String code = templateBuilder.build();\n        assertEquals(code, \"Hello Mark from London.\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/AbstractEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.EditorError;\nimport org.mockito.MockitoAnnotations;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\n\npublic abstract class AbstractEditorTest {\n\n    \n    protected EditorError mockEditorError(final Editor<?> editor, final String message) {\n        EditorError error = mock(EditorError.class);\n        doReturn(editor).when(error).getEditor();\n        doReturn(message).when(error).getMessage();\n        return error;\n    }\n    \n    protected void setup() {\n        MockitoAnnotations.initMocks(this);\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/ToggleSwitchEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ToggleSwitchEditorTest extends AbstractEditorTest {\n    \n    @Mock ToggleSwitchEditor.View view;\n    @Mock EventSourceMock<ValueChangeEvent<Boolean>> valueChangeEvent;\n    \n    private ToggleSwitchEditor presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new ToggleSwitchEditor(view, valueChangeEvent);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).setValue(anyBoolean());\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        List<EditorError> errors = new ArrayList<EditorError>();\n        presenter.showErrors(errors);\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setValue(anyBoolean());\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        EditorError e1 = mockEditorError(presenter, \"m1\");\n        EditorError e2 = mockEditorError(presenter, \"m2\");\n        List<EditorError> errors = new ArrayList<EditorError>(2);\n        errors.add(e1);\n        errors.add(e2);\n        presenter.showErrors(errors);\n        final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);\n        verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).setValue(anyBoolean());\n        final SafeHtml value = errorSafeHtmlCaptor.getValue();\n        Assert.assertEquals(\"m1\\nm2\", value.asString());\n    }\n\n    @Test\n    public void testEnabled() throws Exception {\n        presenter.setEnabled(true);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setValue(anyBoolean());\n    }\n\n    @Test\n    public void testValue() throws Exception {\n        final Boolean newValue = true;\n        presenter.setValue(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(1)).setValue(newValue);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n    }\n\n    @Test\n    public void testOnValueChanged() throws Exception {\n        final Boolean newValue = true;\n        presenter.onValueChanged(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).setValue(newValue);\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/ValueBoxEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ValueBoxEditorTest extends AbstractEditorTest {\n    \n    @Mock ValueBoxEditor.View<String> view;\n    @Mock EventSourceMock<ValueChangeEvent<String>> valueChangeEvent;\n    \n    private ValueBoxEditor<String> presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new ValueBoxEditor<String>(view, valueChangeEvent);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).setValue(anyString());\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        List<EditorError> errors = new ArrayList<EditorError>();\n        presenter.showErrors(errors);\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setValue(anyString());\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        EditorError e1 = mockEditorError(presenter, \"m1\");\n        EditorError e2 = mockEditorError(presenter, \"m2\");\n        List<EditorError> errors = new ArrayList<EditorError>(2);\n        errors.add(e1);\n        errors.add(e2);\n        presenter.showErrors(errors);\n        final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);\n        verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).setValue(anyString());\n        final SafeHtml value = errorSafeHtmlCaptor.getValue();\n        Assert.assertEquals(\"m1\\nm2\", value.asString());\n    }\n\n    @Test\n    public void testAddHelpContent() throws Exception {\n        final String title = \"title\";\n        final String content = \"content\";\n        final Placement p = Placement.BOTTOM;\n        presenter.addHelpContent(title, content, p);\n        verify(view, times(1)).addHelpContent(title, content, p);\n        verify(view, times(0)).setValue(anyString());\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n    }\n    \n    @Test\n    public void testValue() throws Exception {\n        final String newValue = \"newValue\";  \n        presenter.setValue(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(1)).setValue(newValue);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n    }\n\n    @Test\n    public void testOnValueChanged() throws Exception {\n        final String newValue = \"newValue\";\n        presenter.onValueChanged(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).setValue(newValue);\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/file/FileUploadEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor.file;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.AbstractEditorTest;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FileUploadEditorTest extends AbstractEditorTest {\n    \n    @Mock FileUploadEditor.View view;\n    @Mock EventSourceMock<ValueChangeEvent<String>> valueChangeEvent;\n    @Mock EventSourceMock<NotificationEvent> workbenchNotificationEvent;\n    \n    private FileUploadEditor presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new FileUploadEditor(valueChangeEvent, workbenchNotificationEvent, view);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        assertEquals(view.asWidget(), presenter.asWidget());\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(1)).setLoadingImageVisible(false);\n        verify(view, times(0)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testConfigure() throws Exception {\n        FileUploadEditor.FileUploadEditorCallback callback = mock(FileUploadEditor.FileUploadEditorCallback.class);\n        presenter.configure(\"f1\", callback);\n        assertEquals(view.asWidget(), presenter.asWidget());\n        assertEquals(callback, presenter.callback);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).setFileUploadName(\"f1\");\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(0)).setLoadingImageVisible(false);\n        verify(view, times(0)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        List<EditorError> errors = new ArrayList<EditorError>();\n        presenter.showErrors(errors);\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(0)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        EditorError e1 = mockEditorError(presenter, \"m1\");\n        EditorError e2 = mockEditorError(presenter, \"m2\");\n        List<EditorError> errors = new ArrayList<EditorError>(2);\n        errors.add(e1);\n        errors.add(e2);\n        presenter.showErrors(errors);\n        final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);\n        verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(0)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testAddHelpContent() throws Exception {\n        final String title = \"title\";\n        final String content = \"content\";\n        final Placement p = Placement.BOTTOM;\n        presenter.addHelpContent(title, content, p);\n        verify(view, times(1)).addHelpContent(title, content, p);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(0)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n    \n    @Test\n    public void testValueSet() throws Exception {\n        final String newValue = \"newValue\";  \n        when(view.getFileName()).thenReturn(\"fff\");\n        presenter.setValue(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(1)).setFileLabelVisible(false);\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(1)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testValueUnset() throws Exception {\n        final String newValue = \"newValue\";\n        when(view.getFileName()).thenReturn(null);\n        presenter.setValue(newValue);\n        assertEquals(newValue, presenter.getValue());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(1)).setFileLabelText(newValue);\n        verify(view, times(1)).setFileLabelVisible(true);\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(1)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testGetUploadFileName() throws Exception {\n        FileUploadEditor.FileUploadEditorCallback callback = mock(FileUploadEditor.FileUploadEditorCallback.class);\n        presenter.callback = callback;\n        presenter.getUploadFileName();\n        verify(callback, times(1)).getUploadFileName();\n        verify(callback, times(0)).getUploadFileUrl();\n    }\n\n    @Test\n    public void testGetUploadFileUrl() throws Exception {\n        FileUploadEditor.FileUploadEditorCallback callback = mock(FileUploadEditor.FileUploadEditorCallback.class);\n        presenter.callback = callback;\n        presenter.getUploadFileUrl();\n        verify(callback, times(1)).getUploadFileUrl();\n        verify(callback, times(0)).getUploadFileName();\n    }\n\n    @Test\n    public void testOnSubmitNull() throws Exception {\n        when(view.getFileName()).thenReturn(null);\n        final boolean result = presenter.onSubmit();\n        assertEquals(false, result);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(0)).setFileUploadVisible(anyBoolean());\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(0)).setLoadingImageVisible(anyBoolean());\n        verify(view, times(1)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testOnSubmit() throws Exception {\n        when(view.getFileName()).thenReturn(\"ff\");\n        final boolean result = presenter.onSubmit();\n        assertEquals(true, result);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(1)).setFileUploadVisible(false);\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(1)).setLoadingImageVisible(true);\n        verify(view, times(1)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).clearError();\n    }\n\n    @Test\n    public void testOnSubmitComplete() throws Exception {\n        when(view.getFileName()).thenReturn(\"ff\");\n        presenter.onSubmitComplete(\"OK\");\n        assertEquals(\"ff\", presenter.value);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setFileUploadName(anyString());\n        verify(view, times(1)).setFileUploadVisible(true);\n        verify(view, times(0)).setFileLabelText(anyString());\n        verify(view, times(0)).setFileLabelVisible(anyBoolean());\n        verify(view, times(1)).setLoadingImageVisible(false);\n        verify(view, times(1)).getFileName();\n        verify(view, times(0)).setFormAction(anyString());\n        verify(view, times(0)).submit();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(2)).clearError();\n        verify( workbenchNotificationEvent, times( 1 ) ).fire(any(NotificationEvent.class));\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/list/DropDownEditorTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.editor.list;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\n\nimport static junit.framework.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DropDownEditorTest {\n\n    @Mock\n    DropDownEditor.View view;\n\n    @Mock\n    LiveSearchDropDown<String> liveSearchDropDown;\n\n    @Spy\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n\n    @Mock\n    Event<ValueChangeEvent<String>> valueChangeEvent;\n\n    DropDownEditor presenter;\n    Collection<DropDownEditor.Entry> entries = new ArrayList<>();\n\n    @Before\n    public void setup() {\n        presenter = new DropDownEditor(view, liveSearchDropDown, valueChangeEvent);\n        presenter.selectionHandler = selectionHandler;\n        entries.add(presenter.newEntry(\"entry1\", \"Entry 1\"));\n        entries.add(presenter.newEntry(\"entry2\", \"Entry 2\"));\n        presenter.setEntries(entries);\n        presenter.init();\n    }\n\n    @Test\n    public void testInit() {\n        verify(liveSearchDropDown).setSearchEnabled(false);\n        verify(liveSearchDropDown).init(any(), any());\n        assertNull(presenter.getValue());\n    }\n\n    @Test\n    public void testEntries() {\n        presenter.getDropDownEntries(\"\", -1, itemList -> {\n            assertEquals(itemList.size(), 2);\n            assertEquals(itemList.get(0).getKey(), \"entry1\");\n            assertEquals(itemList.get(1).getKey(), \"entry2\");\n        });\n    }\n\n    @Test\n    public void testSelect() {\n        when(selectionHandler.getSelectedValue()).thenReturn(\"Entry 1\");\n        presenter.setValue(\"entry2\");\n        presenter.onEntrySelected();\n\n        ArgumentCaptor<ValueChangeEvent> ac =  ArgumentCaptor.forClass(ValueChangeEvent.class);\n        verify(valueChangeEvent).fire(ac.capture());\n        assertEquals(presenter.getValue(), \"entry1\");\n        ValueChangeEvent event = ac.getValue();\n        assertEquals(event.getValue(), \"entry1\");\n        assertEquals(event.getOldValue(), \"entry2\");\n    }\n\n    @Test\n    public void testSetValue() {\n        presenter.setValue(\"entry2\");\n        verify(liveSearchDropDown).setSelectedItem(\"entry2\");\n        assertEquals(presenter.getValue(), \"entry2\");\n\n        presenter.setSelectHint(\"- select - \");\n        presenter.setValue(null);\n        verify(liveSearchDropDown).setSelectedItem(\"- select - \");\n        assertNull(presenter.getValue());\n\n        reset(liveSearchDropDown);\n        presenter.clear();\n        presenter.setValue(\"entry2\");\n        presenter.setEntries(entries);\n        verify(liveSearchDropDown).setSelectedItem(\"entry2\");\n\n        reset(liveSearchDropDown);\n        presenter.clear();\n        presenter.setEntries(entries);\n        verify(liveSearchDropDown, never()).setSelectedItem(anyString());\n    }\n\n    @Test\n    public void testClear() {\n        presenter.setValue(\"entry2\");\n        presenter.clear();\n        verify(liveSearchDropDown).clear();;\n        assertNull(presenter.getValue());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/list/DropDownImageListEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DropDownImageListEditorTest extends ImageListEditorTest {\n\n    @Before\n    public void setup() {\n        super.initExpectedValues();\n        // The presenter instance to test.\n        view = mock(DropDownImageListEditor.View.class);\n        presenter = new DropDownImageListEditor<DataSetProviderType>(view, valueChangeEvent);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        super.testClear();\n    }\n\n\n    @Test\n    public void testInit() throws Exception {\n        super.testInit();\n    }\n\n    @Test\n    public void testNewEntry() throws Exception {\n        super.testNewEntry();\n    }\n\n    @Test\n    public void testSetEntries() throws Exception {\n        super.testSetEntries();\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        super.testClearErrors();\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        super.testShowErrors();\n    }\n\n    @Test\n    public void testAddHelpContent() throws Exception {\n        super.testAddHelpContent();\n    }\n    \n    @Test\n    public void testSetValueWithoutEvents() throws Exception {\n        super.testSetValueWithoutEvents();\n    }\n\n    @Test\n    public void testSetValueWithEvents() throws Exception {\n        super.testSetValueWithEvents();\n    }\n\n    @Test\n    public void testEditModeEnabled() throws Exception {\n        presenter.setEntries(expectedEntries);\n        ((DropDownImageListEditor)presenter).isEditMode(true);\n        assertEquals(true, ((DropDownImageListEditor) presenter).isEditMode);\n        verify( ((DropDownImageListEditor.View)view) , times(2)).setDropDown(true);\n        \n    }\n\n    @Test\n    public void testEditModeDisabled() throws Exception {\n        presenter.setEntries(expectedEntries);\n        ((DropDownImageListEditor)presenter).isEditMode(false);\n        assertEquals(false, ((DropDownImageListEditor) presenter).isEditMode);\n        verify( ((DropDownImageListEditor.View)view) , times(1)).setDropDown(false);\n\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/list/HorizImageListEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HorizImageListEditorTest extends ImageListEditorTest {\n    \n    @Before\n    public void setup() {\n        super.initExpectedValues();\n        // The presenter instance to test.\n        view = mock( ImageListEditorView.class );\n        presenter = new HorizImageListEditor<DataSetProviderType>(view, valueChangeEvent);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        super.testClear();\n    }\n\n\n    @Test\n    public void testInit() throws Exception {\n        super.testInit();\n    }\n\n    @Test\n    public void testNewEntry() throws Exception {\n        super.testNewEntry();\n    }\n\n    @Test\n    public void testSetEntries() throws Exception {\n        super.testSetEntries();\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        super.testClearErrors();\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        super.testShowErrors();\n    }\n\n    @Test\n    public void testAddHelpContent() throws Exception {\n        super.testAddHelpContent();\n    }\n    \n    @Test\n    public void testSetValueWithoutEvents() throws Exception {\n        super.testSetValueWithoutEvents();\n    }\n\n    @Test\n    public void testSetValueWithEvents() throws Exception {\n        super.testSetValueWithEvents();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/list/ImageListEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor.list;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport org.dashbuilder.common.client.editor.AbstractEditorTest;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Assert;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertTrue;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\npublic abstract class ImageListEditorTest extends AbstractEditorTest {\n    \n    @Mock EventSourceMock<ValueChangeEvent<DataSetProviderType>> valueChangeEvent;\n    \n    protected final Collection<DataSetProviderType> expectedTypes = new ArrayList<DataSetProviderType>(3);\n    protected final List<ImageListEditor<DataSetProviderType>.Entry> expectedEntries = new ArrayList<ImageListEditor<org.dashbuilder.dataprovider.DataSetProviderType>.Entry>(4);\n    protected ImageListEditor<DataSetProviderType> presenter;\n    protected ImageListEditorView<DataSetProviderType> view;\n    \n    public void initExpectedValues() {\n        \n        // Currently expected provider types supported.\n        expectedTypes.add(DataSetProviderType.BEAN);\n        expectedTypes.add(DataSetProviderType.CSV);\n        expectedTypes.add(DataSetProviderType.SQL);\n        expectedEntries.addAll(mockEntries());\n    }\n\n    public void testClear() throws Exception {\n        presenter.entries.addAll(expectedEntries);\n        presenter.value = DataSetProviderType.BEAN;\n        presenter.clear();\n        assertTrue(presenter.entries.isEmpty());\n        assertNull(presenter.value);\n        verify(view, times(1)).clear();\n        verify(view, times(0)).init(any(ImageListEditor.class));\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class), \n                any(SafeHtml.class), anyBoolean(), any(Command.class));\n    }\n\n\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).clear();\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),\n                any(SafeHtml.class), anyBoolean(), any(Command.class));\n        \n    }\n\n    public void testNewEntry() throws Exception {\n        ImageListEditor<DataSetProviderType>.Entry expectedEntry = mockEntry(DataSetProviderType.BEAN);\n        ImageListEditor<DataSetProviderType>.Entry actualEntry = presenter.newEntry(expectedEntry.getValue(), expectedEntry.getUri(), expectedEntry.getHeading(), expectedEntry.getText());\n        Assert.assertEquals(expectedEntry.getHeading(), actualEntry.getHeading());\n        Assert.assertEquals(expectedEntry.getText(), actualEntry.getText());\n        Assert.assertEquals(expectedEntry.getUri(), actualEntry.getUri());\n        Assert.assertEquals(expectedEntry.getValue(), actualEntry.getValue());\n    }\n\n    public void testSetEntries() throws Exception {\n        presenter.setEntries(expectedEntries);\n        assertShowElements();\n    }\n\n    public void testClearErrors() throws Exception {\n        List<EditorError> errors = new ArrayList<EditorError>();\n        presenter.showErrors(errors);\n        verify(view, times(0)).clear();\n        verify(view, times(0)).init(any(ImageListEditor.class));\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),\n                any(SafeHtml.class), anyBoolean(), any(Command.class));\n    }\n    \n    public void testShowErrors() throws Exception {\n        EditorError e1 = mockEditorError(presenter, \"m1\");\n        EditorError e2 = mockEditorError(presenter, \"m2\");\n        List<EditorError> errors = new ArrayList<EditorError>(2);\n        errors.add(e1);\n        errors.add(e2);\n        \n        presenter.showErrors(errors);\n        final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);\n        verify(view, times(0)).clear();\n        verify(view, times(0)).init(any(ImageListEditor.class));\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),\n                any(SafeHtml.class), anyBoolean(), any(Command.class));\n        verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());\n        final SafeHtml value = errorSafeHtmlCaptor.getValue();\n        Assert.assertEquals(\"m1\\nm2\", value.asString());\n    }\n\n    public void testAddHelpContent() throws Exception {\n        final String title = \"title\";\n        final String content = \"content\";\n        final Placement p = Placement.BOTTOM;\n        presenter.setHelpContent(title, content, p);\n        verify(view, times(1)).setHelpContent(title, content, p);\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).init(presenter);\n    }\n    \n    public void testSetValueWithoutEvents() throws Exception {\n        final DataSetProviderType value = DataSetProviderType.BEAN;\n        presenter.entries.addAll(expectedEntries);\n        presenter.setValue(value, false);\n        Assert.assertEquals(value, presenter.value);\n        assertShowElements();\n    }\n\n    public void testSetValueWithEvents() throws Exception {\n        final DataSetProviderType oldValue = DataSetProviderType.SQL;\n        final DataSetProviderType newValue = DataSetProviderType.BEAN;\n        presenter.value = oldValue;\n        presenter.entries.addAll(expectedEntries);\n        presenter.setValue(newValue, true);\n        Assert.assertEquals(newValue, presenter.value);\n        assertShowElements();\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n    }\n    \n    protected void assertShowElements() {\n        verify(view, times(0)).init(any(ImageListEditor.class));\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(1)).clear();\n        verify(view, times(3)).add(any(SafeUri.class), anyString(), anyString(), any(SafeHtml.class),\n                any(SafeHtml.class), anyBoolean(), any(Command.class));\n        Assert.assertEquals(expectedEntries, presenter.entries);\n    }\n\n    protected List<ImageListEditor<DataSetProviderType>.Entry> mockEntries() {\n        List<ImageListEditor<DataSetProviderType>.Entry> result = new ArrayList<ImageListEditor<org.dashbuilder.dataprovider.DataSetProviderType>.Entry>(4);\n        result.add(mockEntry(DataSetProviderType.BEAN));\n        result.add(mockEntry(DataSetProviderType.CSV));\n        result.add(mockEntry(DataSetProviderType.SQL));\n        return result;\n    }\n\n    protected static ImageListEditor<DataSetProviderType>.Entry mockEntry(DataSetProviderType type) {\n        final String name = type.getName();\n        final SafeUri uri = mock(SafeUri.class);\n        final SafeHtml safeHtml = mock(SafeHtml.class);\n        ImageListEditor<DataSetProviderType>.Entry entry = mock(ImageListEditor.Entry.class);\n        doReturn(type).when(entry).getValue();\n        doReturn(safeHtml).when(entry).getHeading();\n        doReturn(safeHtml).when(entry).getText();\n        doReturn(uri).when(entry).getUri();\n        return entry;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/editor/map/MapEditorTest.java",
    "content": "package org.dashbuilder.common.client.editor.map;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.AbstractEditorTest;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyList;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MapEditorTest extends AbstractEditorTest {\n    \n    @Mock MapEditor.View view;\n    @Mock EventSourceMock<ValueChangeEvent<Map<String, String>>> valueChangeEvent;\n    \n    private MapEditor presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new MapEditor(view, valueChangeEvent);\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).setAddText(anyString());\n        verify(view, times(1)).setEmptyText(anyString());\n        verify(view, times(1)).addButtonColumn(anyInt(), anyString(), anyInt());\n        verify(view, times(2)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).removeColumn(anyInt());\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).setData(anyList());\n        verify(view, times(0)).setRowCount(anyInt());\n    }\n\n    @Test\n    public void testClearErrors() throws Exception {\n        List<EditorError> errors = new ArrayList<EditorError>();\n        presenter.showErrors(errors);\n        verify(view, times(1)).clearError();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setAddText(anyString());\n        verify(view, times(0)).setEmptyText(anyString());\n        verify(view, times(0)).addButtonColumn(anyInt(), anyString(), anyInt());\n        verify(view, times(0)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).setData(anyList());\n        verify(view, times(0)).setRowCount(anyInt());\n        verify(view, times(0)).removeColumn(anyInt());\n    }\n    \n    @Test\n    public void testShowErrors() throws Exception {\n        EditorError e1 = mockEditorError(presenter, \"m1\");\n        EditorError e2 = mockEditorError(presenter, \"m2\");\n        List<EditorError> errors = new ArrayList<EditorError>(2);\n        errors.add(e1);\n        errors.add(e2);\n        presenter.showErrors(errors);\n        final ArgumentCaptor<SafeHtml> errorSafeHtmlCaptor =  ArgumentCaptor.forClass(SafeHtml.class);\n        verify(view, times(1)).showError(errorSafeHtmlCaptor.capture());\n        verify(view, times(0)).clearError();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).setAddText(anyString());\n        verify(view, times(0)).setEmptyText(anyString());\n        verify(view, times(0)).addButtonColumn(anyInt(), anyString(), anyInt());\n        verify(view, times(0)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());\n        verify(view, times(0)).setData(anyList());\n        verify(view, times(0)).setRowCount(anyInt());\n        verify(view, times(0)).removeColumn(anyInt());\n        final SafeHtml value = errorSafeHtmlCaptor.getValue();\n        Assert.assertEquals(\"m1\\nm2\", value.asString());\n    }\n\n    @Test\n    public void testValue() throws Exception {\n        final Map<String, String> value = new HashMap<String, String>(1);\n        value.put(\"key1\", \"value1\");\n        presenter.setValue(value);\n        assertEquals(value, presenter.getValue());\n        assertSetViewValue(1);\n    }\n\n    @Test\n    public void testUpdateKey() throws Exception {\n        final Map<String, String> value = new HashMap<String, String>(1);\n        value.put(\"key1\", \"value1\");\n        presenter.value = value;\n        Map.Entry<String, String> entry = mock(Map.Entry.class);\n        when(entry.getKey()).thenReturn(\"key1\");\n        presenter.update(0, 0, entry, \"key2\");\n        assertEquals(1, presenter.getValue().size());\n        assertEquals(\"value1\", presenter.getValue().get(\"key2\"));\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n        assertSetViewValue(1);\n    }\n\n    @Test\n    public void testUpdateValue() throws Exception {\n        final Map<String, String> value = new HashMap<String, String>(1);\n        value.put(\"key1\", \"value1\");\n        presenter.value = value;\n        Map.Entry<String, String> entry = mock(Map.Entry.class);\n        when(entry.getKey()).thenReturn(\"key1\");\n        when(entry.getValue()).thenReturn(\"value1\");\n        presenter.update(1, 0, entry, \"value2\");\n        assertEquals(1, presenter.getValue().size());\n        assertEquals(\"value2\", presenter.getValue().get(\"key1\"));\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n        assertSetViewValue(1);\n    }\n\n    @Test\n    public void testRemoveEntry() throws Exception {\n        final Map<String, String> value = new HashMap<String, String>(1);\n        value.put(\"key1\", \"value1\");\n        presenter.value = value;\n        Map.Entry<String, String> entry = mock(Map.Entry.class);\n        when(entry.getKey()).thenReturn(\"key1\");\n        presenter.update(2, 0, entry, null);\n        assertEquals(0, presenter.getValue().size());\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n        assertSetViewValue(0);\n    }\n\n    @Test\n    public void testAddEntry() throws Exception {\n        presenter.addEntry();\n        assertEquals(1, presenter.getValue().size());\n        verify( valueChangeEvent, times( 1 ) ).fire(any(ValueChangeEvent.class));\n        assertSetViewValue(1);\n    }\n    \n    protected void assertSetViewValue(final int size) {\n        verify(view, times(3)).removeColumn(0);\n        verify(view, times(1)).clearError();\n        verify(view, times(1)).addButtonColumn(anyInt(), anyString(), anyInt());\n        verify(view, times(2)).addTextColumn(anyInt(), anyString(), anyBoolean(), anyInt());\n        verify(view, times(1)).setEmptyText(anyString());\n        verify(view, times(1)).setRowCount(size);\n        final ArgumentCaptor<List> dataCaptor =  ArgumentCaptor.forClass(List.class);\n        verify(view, times(1)).setData(dataCaptor.capture());\n        final List dataValue = dataCaptor.getValue();\n        assertNotNull(dataValue);\n        assertEquals(size, dataValue.size());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showError(any(SafeHtml.class));\n        verify(view, times(0)).setAddText(anyString());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-common-client/src/test/java/org/dashbuilder/common/client/widgets/FilterLabelSetTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.common.client.widgets;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FilterLabelSetTest {\n\n    @Mock\n    FilterLabelSet.View view;\n\n    @Mock\n    FilterLabel filterLabel;\n\n    @Mock\n    SyncBeanDef<FilterLabel> filterLabelBean;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    FilterLabelSet presenter;\n\n    @Before\n    public void setUp() {\n        when(beanManager.lookupBean(FilterLabel.class)).thenReturn(filterLabelBean);\n        when(filterLabelBean.newInstance()).thenReturn(filterLabel);\n        presenter = new FilterLabelSet(view, beanManager);\n    }\n\n    @Test\n    public void testClearAll() {\n        presenter.clear();\n        verify(view, never()).setClearAllEnabled(true);\n        verify(view, never()).addLabel(any());\n\n        presenter.addLabel(\"a\");\n        verify(view, never()).setClearAllEnabled(true);\n        verify(view, times(1)).addLabel(any());\n\n        presenter.addLabel(\"b\");\n        verify(view).setClearAllEnabled(true);\n        verify(view, times(2)).addLabel(any());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-dataset-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Dataset Client</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-validation</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/ClientDataSetCore.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.dataset.DataSetManager;\nimport org.dashbuilder.dataset.AbstractDataSetCore;\nimport org.dashbuilder.dataset.client.engine.ClientChronometer;\nimport org.dashbuilder.dataset.client.engine.ClientDateFormatter;\nimport org.dashbuilder.dataset.client.engine.ClientDateFormatterImpl;\nimport org.dashbuilder.dataset.client.engine.ClientIntervalBuilderDynamicDate;\nimport org.dashbuilder.dataset.client.engine.ClientIntervalBuilderLocator;\nimport org.dashbuilder.dataset.client.uuid.ClientUUIDGenerator;\nimport org.dashbuilder.dataset.engine.Chronometer;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilderLocator;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\n\npublic class ClientDataSetCore extends AbstractDataSetCore {\n\n    private static ClientDataSetCore _instance = null;\n\n    public static ClientDataSetCore get() {\n        if (_instance == null) {\n            _instance = new ClientDataSetCore();\n        }\n        return _instance;\n    }\n\n    private ClientDataSetManager clientDataSetManager;\n    private ClientIntervalBuilderLocator clientIntervalBuilderLocator;\n    private ClientChronometer clientChronometer;\n    private ClientUUIDGenerator clientUUIDGenerator;\n    private ClientIntervalBuilderDynamicDate clientIntervalBuilderDynamicDate;\n    private ClientDateFormatter clientDateFormatter;\n\n    // Getters\n\n    public ClientDataSetManager getClientDataSetManager() {\n        if (clientDataSetManager == null) {\n            clientDataSetManager = new ClientDataSetManager();\n        }\n        return clientDataSetManager;\n    }\n\n    public ClientIntervalBuilderLocator getClientIntervalBuilderLocator() {\n        if (clientIntervalBuilderLocator == null) {\n            clientIntervalBuilderLocator = new ClientIntervalBuilderLocator(\n                    checkNotNull(getIntervalBuilderDynamicLabel(), \"IntervalBuilderDynamicLabel\"),\n                    checkNotNull(getClientIntervalBuilderDynamicDate(), \"ClientIntervalBuilderDynamicDate\"),\n                    checkNotNull(getIntervalBuilderFixedDate(), \"IntervalBuilderFixedDate\"));\n        }\n        return clientIntervalBuilderLocator;\n    }\n\n    public ClientIntervalBuilderDynamicDate getClientIntervalBuilderDynamicDate() {\n        if (clientIntervalBuilderDynamicDate == null) {\n            clientIntervalBuilderDynamicDate = new ClientIntervalBuilderDynamicDate(\n                    checkNotNull(getClientDateFormatter(), \"ClientDateFormatter\")\n            );\n        }\n        return clientIntervalBuilderDynamicDate;\n    }\n\n    public ClientDateFormatter getClientDateFormatter() {\n        if (clientDateFormatter == null) {\n            clientDateFormatter = new ClientDateFormatterImpl();\n        }\n        return clientDateFormatter;\n    }\n\n    public ClientChronometer getClientChronometer() {\n        if (clientChronometer == null) {\n            clientChronometer = new ClientChronometer();\n        }\n        return clientChronometer;\n    }\n\n    public ClientUUIDGenerator getClientUUIDGenerator() {\n        if (clientUUIDGenerator == null) {\n            clientUUIDGenerator = new ClientUUIDGenerator();\n        }\n        return clientUUIDGenerator;\n    }\n\n    // Setters\n\n    public void setClientDataSetManager(ClientDataSetManager clientDataSetManager) {\n        this.clientDataSetManager = clientDataSetManager;\n    }\n\n    public void setClientIntervalBuilderLocator(ClientIntervalBuilderLocator clientIntervalBuilderLocator) {\n        this.clientIntervalBuilderLocator = clientIntervalBuilderLocator;\n    }\n\n    public void setClientIntervalBuilderDynamicDate(ClientIntervalBuilderDynamicDate clientIntervalBuilderDynamicDate) {\n        this.clientIntervalBuilderDynamicDate = clientIntervalBuilderDynamicDate;\n    }\n\n    public void setClientDateFormatter(ClientDateFormatter clientDateFormatter) {\n        this.clientDateFormatter = clientDateFormatter;\n    }\n\n    public void setClientChronometer(ClientChronometer clientChronometer) {\n        this.clientChronometer = clientChronometer;\n    }\n\n    public void setClientUUIDGenerator(ClientUUIDGenerator clientUUIDGenerator) {\n        this.clientUUIDGenerator = clientUUIDGenerator;\n    }\n\n    // Factory methods\n\n    @Override\n    public DataSetManager newDataSetManager() {\n        return getClientDataSetManager();\n    }\n\n    @Override\n    public IntervalBuilderLocator newIntervalBuilderLocator() {\n        return getClientIntervalBuilderLocator();\n    }\n\n    @Override\n    public Chronometer newChronometer() {\n        return getClientChronometer();\n    }\n\n    @Override\n    public UUIDGenerator newUuidGenerator() {\n        return getClientUUIDGenerator();\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/ClientDataSetManager.java",
    "content": "/**\n/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetManager;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.def.DataSetPreprocessor;\nimport org.dashbuilder.dataset.engine.SharedDataSetOpEngine;\nimport org.dashbuilder.dataset.engine.index.DataSetIndex;\n\n/**\n * Client implementation of a DataSetManager. It hold as map of data sets in memory.\n * It is designed to manipulate not quite big data sets. For big data sets the backend implementation is better,\n */\n@ApplicationScoped\npublic class ClientDataSetManager implements DataSetManager {\n\n    SharedDataSetOpEngine dataSetOpEngine;\n    Map<String,List<DataSetPreprocessor>> preprocessorMap = new HashMap<String, List<DataSetPreprocessor>>();\n\n    public ClientDataSetManager() {\n        this.dataSetOpEngine = ClientDataSetCore.get().getSharedDataSetOpEngine();\n    }\n\n    @Override\n    public DataSet createDataSet(String uuid) {\n        DataSet dataSet = DataSetFactory.newEmptyDataSet();\n        dataSet.setUUID(uuid);\n        return dataSet;\n    }\n\n    @Override\n    public DataSet getDataSet(String uuid) {\n        DataSetIndex index = dataSetOpEngine.getIndexRegistry().get(uuid);\n        if (index == null) {\n            return null;\n        }\n        return index.getDataSet();\n    }\n\n    @Override\n    public void registerDataSet(DataSet dataSet) {\n        if (dataSet != null) {\n            dataSetOpEngine.getIndexRegistry().put(dataSet);\n        }\n    }\n\n    @Override\n    public void registerDataSet(DataSet dataSet, List<DataSetPreprocessor> preprocessors) {\n        if (dataSet != null) {\n            dataSetOpEngine.getIndexRegistry().put(dataSet);\n\n            for (DataSetPreprocessor preprocessor : preprocessors) {\n                registerDataSetPreprocessor(dataSet.getUUID(), preprocessor);\n            }\n        }\n    }\n\n    @Override\n    public DataSet removeDataSet(String uuid) {\n        DataSetIndex index = dataSetOpEngine.getIndexRegistry().remove(uuid);\n        if (index == null) {\n            return null;\n        }\n        return index.getDataSet();\n    }\n\n    @Override\n    public DataSet lookupDataSet(DataSetLookup lookup) {\n        String uuid = lookup.getDataSetUUID();\n        if (StringUtils.isEmpty(uuid)) {\n            return null;\n        }\n\n        // Get the target data set\n        DataSetIndex dataSetIndex = dataSetOpEngine.getIndexRegistry().get(uuid);\n        if (dataSetIndex == null) {\n            return null;\n        }\n        List<DataSetPreprocessor> dataSetDefPreProcessors = getDataSetPreprocessors(uuid);\n        if (dataSetDefPreProcessors != null) {\n            for(DataSetPreprocessor p : dataSetDefPreProcessors){\n                p.preprocess(lookup);\n            }\n        }\n        DataSet dataSet = dataSetIndex.getDataSet();\n\n        // Apply the list of operations specified (if any).\n        if (!lookup.getOperationList().isEmpty()) {\n            dataSet = dataSetOpEngine.execute(uuid, lookup.getOperationList());\n        }\n\n        // Trim the data set as requested.\n        dataSet = dataSet.trim(lookup.getRowOffset(), lookup.getNumberOfRows());\n        return dataSet;\n    }\n\n    @Override\n    public DataSet[] lookupDataSets(DataSetLookup[] lookup) {\n        DataSet[] result = new DataSet[lookup.length];\n        for (int i = 0; i < lookup.length; i++) {\n            result[i] = lookupDataSet(lookup[i]);\n        }\n        return result;\n    }\n\n    @Override\n    public DataSetMetadata getDataSetMetadata(String uuid) {\n        DataSetLookup lookup = new DataSetLookup(uuid);\n        DataSet dataSet = lookupDataSet(lookup);\n        if (dataSet == null) {\n            return null;\n        }\n        return dataSet.getMetadata();\n    }\n\n    public void registerDataSetPreprocessor(String uuid, DataSetPreprocessor preprocessor) {\n        List<DataSetPreprocessor> preprocessors = preprocessorMap.get(uuid);\n        if (preprocessors == null) {\n            preprocessorMap.put(uuid, preprocessors = new ArrayList<DataSetPreprocessor>());\n        }\n        preprocessors.add(preprocessor);\n    }\n\n    public List<DataSetPreprocessor> getDataSetPreprocessors(String uuid) {\n        return preprocessorMap.get(uuid);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetClientServices.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.backend.PathUrlFactory;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilderLocator;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.events.DataSetModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetPushOkEvent;\nimport org.dashbuilder.dataset.events.DataSetPushingEvent;\nimport org.dashbuilder.dataset.events.DataSetStaleEvent;\nimport org.dashbuilder.dataset.group.AggregateFunctionManager;\nimport org.dashbuilder.dataset.service.DataSetDefServices;\nimport org.dashbuilder.dataset.service.DataSetExportServices;\nimport org.dashbuilder.dataset.service.DataSetLookupServices;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Data set services for clients.\n * <p>It hides to client widgets where the data sets are stored and how they are fetched and processed.</p>\n */\n@ApplicationScoped\npublic class DataSetClientServices {\n\n    private ClientDataSetManager clientDataSetManager;\n    private PathUrlFactory pathUrlFactory;\n    private AggregateFunctionManager aggregateFunctionManager;\n    private IntervalBuilderLocator intervalBuilderLocator;\n    private Event<DataSetPushingEvent> dataSetPushingEvent;\n    private Event<DataSetPushOkEvent> dataSetPushOkEvent;\n    private Event<DataSetModifiedEvent> dataSetModifiedEvent;\n    private Caller<DataSetLookupServices> dataSetLookupServices;\n    private Caller<DataSetDefServices> dataSetDefServices;\n    private Caller<DataSetExportServices> dataSetExportServices;\n\n    /**\n     * A cache of DataSetMetadata instances\n     */\n    private Map<String, DataSetMetadata> remoteMetadataMap = new HashMap<String, DataSetMetadata>();\n\n    /**\n     * If enabled then remote data set can be pushed to clients.\n     */\n    private boolean pushRemoteDataSetEnabled = true;\n\n    /**\n     * It holds a set of data set push requests in progress.\n     */\n    private Map<String, DataSetPushHandler> pushRequestMap = new HashMap<String, DataSetPushHandler>();\n\n    public DataSetClientServices() {\n    }\n\n    @Inject\n    public DataSetClientServices(ClientDataSetManager clientDataSetManager,\n                                 PathUrlFactory pathUrlFactory,\n                                 AggregateFunctionManager aggregateFunctionManager,\n                                 IntervalBuilderLocator intervalBuilderLocator,\n                                 Event<DataSetPushingEvent> dataSetPushingEvent,\n                                 Event<DataSetPushOkEvent> dataSetPushOkEvent,\n                                 Event<DataSetModifiedEvent> dataSetModifiedEvent,\n                                 Caller<DataSetLookupServices> dataSetLookupServices,\n                                 Caller<DataSetDefServices> dataSetDefServices,\n                                 Caller<DataSetExportServices> dataSetExportServices) {\n\n        this.clientDataSetManager = clientDataSetManager;\n        this.pathUrlFactory = pathUrlFactory;\n        this.aggregateFunctionManager = aggregateFunctionManager;\n        this.intervalBuilderLocator = intervalBuilderLocator;\n        this.dataSetPushingEvent = dataSetPushingEvent;\n        this.dataSetPushOkEvent = dataSetPushOkEvent;\n        this.dataSetModifiedEvent = dataSetModifiedEvent;\n        this.dataSetLookupServices = dataSetLookupServices;\n        this.dataSetDefServices = dataSetDefServices;\n        this.dataSetExportServices = dataSetExportServices;\n    }\n\n    public boolean isPushRemoteDataSetEnabled() {\n        return pushRemoteDataSetEnabled;\n    }\n\n    /**\n     * Enable/disable the ability to push remote data sets from server.\n     */\n    public void setPushRemoteDataSetEnabled(boolean pushRemoteDataSetEnabled) {\n        this.pushRemoteDataSetEnabled = pushRemoteDataSetEnabled;\n    }\n\n    /**\n     * Fetch the metadata instance for the specified data set.\n     *\n     * @param uuid The UUID of the data set\n     * @throws Exception It there is an unexpected error trying to execute the lookup request.\n     */\n    public void fetchMetadata(final String uuid,\n                              final DataSetMetadataCallback listener) throws Exception {\n        final DataSetMetadata metadata = clientDataSetManager.getDataSetMetadata(uuid);\n\n        if (metadata != null) {\n            listener.callback(metadata);\n        } else if (dataSetLookupServices != null) {\n            if (remoteMetadataMap.containsKey(uuid)) {\n                listener.callback(remoteMetadataMap.get(uuid));\n            } else {\n                dataSetLookupServices.call((DataSetMetadata result) -> {\n                                               if (result == null) {\n                                                   listener.notFound();\n                                               } else {\n                                                   remoteMetadataMap.put(uuid,\n                                                                         result);\n                                                   listener.callback(result);\n                                               }\n                                           },\n                                           (message, throwable) -> {\n                                               return listener.onError(new ClientRuntimeError(throwable));\n                                           }).lookupDataSetMetadata(uuid);\n            }\n        } else {\n            listener.notFound();\n        }\n    }\n\n    Map<String, DataSetMetadata> getRemoteMetadataMap() {\n        return remoteMetadataMap;\n    }\n\n    /**\n     * Get the cached metadata instance for the specified data set.\n     *\n     * @param uuid The UUID of the data set. Null if the metadata is not stored on client yet.\n     */\n    public DataSetMetadata getMetadata(String uuid) {\n        DataSetMetadata metadata = clientDataSetManager.getDataSetMetadata(uuid);\n        if (metadata != null) {\n            return metadata;\n        }\n\n        return remoteMetadataMap.get(uuid);\n    }\n\n    /**\n     * Export a data set, specified by a data set lookup request, to CSV format.\n     *\n     * @param request The data set lookup request\n     * @throws Exception It there is an unexpected error during the export.\n     */\n    public void exportDataSetCSV(final DataSetLookup request,\n                                 final DataSetExportReadyCallback listener) throws Exception {\n\n        if (dataSetLookupServices != null) {\n            // Look always into the client data set manager.\n            if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {\n                DataSet dataSet = clientDataSetManager.lookupDataSet(request);\n                dataSetExportServices.call(\n                        new RemoteCallback<Path>() {\n                            public void callback(Path csvFilePath) {\n                                listener.exportReady(csvFilePath);\n                            }\n                        }\n                        ,\n                        new ErrorCallback<Message>() {\n                            public boolean error(Message message,\n                                                 Throwable throwable) {\n                                listener.onError(new ClientRuntimeError(throwable));\n                                return true;\n                            }\n                        }).exportDataSetCSV(dataSet);\n            }\n            // Data set not found on client.\n            else {\n                // If the data set is not in client, then look up remotely (only if the remote access is available).\n                try {\n                    dataSetExportServices.call(\n                            new RemoteCallback<Path>() {\n                                public void callback(Path csvFilePath) {\n                                    listener.exportReady(csvFilePath);\n                                }\n                            }\n                            ,\n                            new ErrorCallback<Message>() {\n                                public boolean error(Message message,\n                                                     Throwable throwable) {\n                                    listener.onError(new ClientRuntimeError(throwable));\n                                    return true;\n                                }\n                            }).exportDataSetCSV(request);\n                } catch (Exception e) {\n                    listener.onError(new ClientRuntimeError(e));\n                }\n            }\n        } else {\n            listener.onError(new ClientRuntimeError(CommonConstants.INSTANCE.exc_no_client_side_data_export()));\n        }\n    }\n\n    /**\n     * Export a data set, specified by a data set lookup request, to Excel format.\n     *\n     * @param request The data set lookup request\n     * @throws Exception It there is an unexpected error during the export.\n     */\n    public void exportDataSetExcel(final DataSetLookup request,\n                                   final DataSetExportReadyCallback listener) throws Exception {\n\n        if (dataSetLookupServices != null) {\n            // Look always into the client data set manager.\n            if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {\n                DataSet dataSet = clientDataSetManager.lookupDataSet(request);\n                try {\n                    dataSetExportServices.call(\n                            new RemoteCallback<Path>() {\n                                public void callback(Path excelFilePath) {\n                                    listener.exportReady(excelFilePath);\n                                }\n                            }).exportDataSetExcel(dataSet);\n                } catch (Exception e) {\n                    throw new RuntimeException(e);\n                }\n            }\n            // Data set not found on client.\n            else {\n                // If the data set is not in client, then look up remotely (only if the remote access is available).\n                try {\n                    dataSetExportServices.call(\n                            new RemoteCallback<Path>() {\n                                public void callback(Path excelFilePath) {\n                                    listener.exportReady(excelFilePath);\n                                }\n                            }\n                            ,\n                            new ErrorCallback<Message>() {\n                                public boolean error(Message message,\n                                                     Throwable throwable) {\n                                    listener.onError(new ClientRuntimeError(throwable));\n                                    return true;\n                                }\n                            }).exportDataSetExcel(request);\n                } catch (Exception e) {\n                    listener.onError(new ClientRuntimeError(e));\n                }\n            }\n        } else {\n            listener.onError(new ClientRuntimeError(CommonConstants.INSTANCE.exc_no_client_side_data_export()));\n        }\n    }\n\n    /**\n     * Creates a brand new data set definition for the provider type specified\n     *\n     * @param type The provider type\n     * @return A data set definition instance\n     */\n    public void newDataSet(DataSetProviderType type,\n                           RemoteCallback<DataSetDef> callback) throws Exception {\n        dataSetDefServices.call(callback).createDataSetDef(type);\n    }\n\n    /**\n     * Process the specified data set lookup request for a given definition.\n     *\n     * @param def     The data set definition\n     * @param request The data set lookup request\n     * @throws Exception It there is an unexpected error trying to execute the lookup request.\n     */\n    public void lookupDataSet(final DataSetDef def,\n                              final DataSetLookup request,\n                              final DataSetReadyCallback listener) throws Exception {\n\n        if (dataSetLookupServices != null) {\n            try {\n                dataSetLookupServices.call(\n                        new RemoteCallback<DataSet>() {\n                            public void callback(DataSet result) {\n                                if (result == null) {\n                                    listener.notFound();\n                                } else {\n                                    listener.callback(result);\n                                }\n                            }\n                        },\n                        new ErrorCallback<Message>() {\n                            @Override\n                            public boolean error(Message message,\n                                                 Throwable throwable) {\n                                return listener.onError(new ClientRuntimeError(throwable));\n                            }\n                        })\n                        .lookupDataSet(def,\n                                       request);\n            } catch (Exception e) {\n                listener.onError(new ClientRuntimeError(e));\n            }\n        }\n        // Data set not found on client.\n        else {\n            listener.notFound();\n        }\n    }\n\n    /**\n     * Process the specified data set lookup request.\n     *\n     * @param request The data set lookup request\n     * @throws Exception It there is an unexpected error trying to execute the lookup request.\n     */\n    public void lookupDataSet(final DataSetLookup request,\n                              final DataSetReadyCallback listener) throws Exception {\n\n        // Look always into the client data set manager.\n        if (clientDataSetManager.getDataSet(request.getDataSetUUID()) != null) {\n            DataSet dataSet = clientDataSetManager.lookupDataSet(request);\n            listener.callback(dataSet);\n        }\n        // If the data set is not in client, then look up remotely (only if the remote access is available).\n        else if (dataSetLookupServices != null) {\n\n            // First of all, get the target data set estimated size.\n            fetchMetadata(request.getDataSetUUID(),\n                          new DataSetMetadataCallback() {\n                              public void callback(DataSetMetadata metatada) {\n\n                                  // Push the data set to client if and only if the push feature is enabled, the data set is\n                                  // pushable & the data set is smaller than the max push size defined.\n                                  DataSetDef dsetDef = metatada.getDefinition();\n                                  int estimatedSize = metatada.getEstimatedSize() / 1000;\n                                  boolean isPushable = dsetDef != null && dsetDef.isPushEnabled() && estimatedSize < dsetDef.getPushMaxSize();\n                                  if (pushRemoteDataSetEnabled && isPushable) {\n\n                                      // Check if a push is already in progress.\n                                      // (This is necessary in order to avoid repeating multiple push requests over the same data set).\n                                      DataSetPushHandler pushHandler = pushRequestMap.get(request.getDataSetUUID());\n                                      if (pushHandler == null) {\n                                          // Create a push handler.\n                                          pushHandler = new DataSetPushHandler(metatada);\n\n                                          // Send the lookup request to the server...\n                                          DataSetLookup lookupSourceDataSet = new DataSetLookup(request.getDataSetUUID());\n                                          _lookupDataSet(lookupSourceDataSet,\n                                                         pushHandler);\n                                      }\n                                      // Register the lookup request into the current handler.\n                                      pushHandler.registerLookup(request,\n                                                                 listener);\n                                  }\n                                  // Lookup the remote data set otherwise.\n                                  else {\n                                      _lookupDataSet(request,\n                                                     listener);\n                                  }\n                              }\n\n                              // Data set metadata not found\n                              public void notFound() {\n                                  listener.notFound();\n                              }\n\n                              @Override\n                              public boolean onError(final ClientRuntimeError error) {\n                                  return listener.onError(error);\n                              }\n                          });\n        }\n        // Data set not found on client.\n        else {\n            listener.notFound();\n        }\n    }\n\n    private void _lookupDataSet(DataSetLookup request,\n                                final DataSetReadyCallback listener) {\n        try {\n            dataSetLookupServices.call(\n                    new RemoteCallback<DataSet>() {\n                        public void callback(DataSet result) {\n                            if (result == null) {\n                                listener.notFound();\n                            } else {\n                                listener.callback(result);\n                            }\n                        }\n                    },\n                    new ErrorCallback<Message>() {\n                        @Override\n                        public boolean error(Message message,\n                                             Throwable throwable) {\n                            return listener.onError(new ClientRuntimeError(throwable));\n                        }\n                    })\n                    .lookupDataSet(request);\n        } catch (Exception e) {\n            listener.onError(new ClientRuntimeError(e));\n        }\n    }\n\n    /**\n     * @since 0.3.0.Final\n     * @deprecated Use <i>getPublicDataSetDefs</i> instead\n     */\n    public void getRemoteSharedDataSetDefs(RemoteCallback<List<DataSetDef>> callback) {\n        getPublicDataSetDefs(callback);\n    }\n\n    public void getPublicDataSetDefs(RemoteCallback<List<DataSetDef>> callback) {\n        try {\n            dataSetDefServices.call(callback).getPublicDataSetDefs();\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public AggregateFunctionManager getAggregateFunctionManager() {\n        return aggregateFunctionManager;\n    }\n\n    public IntervalBuilderLocator getIntervalBuilderLocator() {\n        return intervalBuilderLocator;\n    }\n\n    // Classes for the handling of concurrent lookup requests over any push-able data set\n\n    private void onDataSetStaleEvent(@Observes DataSetStaleEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        String uuid = event.getDataSetDef().getUUID();\n\n        // Remove any stale data existing on the client.\n        // This will force next lookup requests to push a refreshed data set.\n        clientDataSetManager.removeDataSet(uuid);\n        remoteMetadataMap.remove(uuid);\n\n        // If a data set has been updated on the sever then fire an event.\n        // In this case the notification is always send, no matter whether the data set is pushed to the client or not.\n        dataSetModifiedEvent.fire(new DataSetModifiedEvent(event.getDataSetDef()));\n    }\n\n    private void onDataSetRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        String uuid = event.getDataSetDef().getUUID();\n        clientDataSetManager.removeDataSet(uuid);\n        remoteMetadataMap.remove(uuid);\n\n        // If a data set has been updated on the sever then fire an event.\n        // In this case the notification is always send, no matter whether the data set is pushed to the client or not.\n        dataSetModifiedEvent.fire(new DataSetModifiedEvent(event.getDataSetDef()));\n    }\n\n    // Catch backend events\n\n    /**\n     * <p>Returns the download URL for a given file provided by a servlet method.</p>\n     *\n     * @param path The path of the file.\n     */\n    public String getDownloadFileUrl(final Path path) {\n        return pathUrlFactory.getDownloadFileUrl(path);\n    }\n\n    /**\n     * <p>Returns the upload URL for a given file provided by a servlet method.</p>\n     *\n     * @param path The path of the file.\n     */\n    public String getUploadFileUrl(String path) {\n        return pathUrlFactory.getUploadFileUrl(path);\n    }\n\n    private class DataSetPushHandler implements DataSetReadyCallback {\n\n        private DataSetMetadata dataSetMetadata = null;\n        private List<DataSetLookupListenerPair> listenerList = new ArrayList<DataSetLookupListenerPair>();\n\n        private DataSetPushHandler(DataSetMetadata metadata) {\n            this.dataSetMetadata = metadata;\n\n            pushRequestMap.put(dataSetMetadata.getUUID(),\n                               this);\n\n            dataSetPushingEvent.fire(new DataSetPushingEvent(dataSetMetadata));\n        }\n\n        public void registerLookup(DataSetLookup lookup,\n                                   DataSetReadyCallback listener) {\n            listenerList.add(new DataSetLookupListenerPair(lookup,\n                                                           listener));\n        }\n\n        public void callback(DataSet dataSet) {\n            pushRequestMap.remove(dataSetMetadata.getUUID());\n\n            clientDataSetManager.registerDataSet(dataSet);\n\n            dataSetPushOkEvent.fire(new DataSetPushOkEvent(dataSetMetadata));\n\n            for (DataSetLookupListenerPair pair : listenerList) {\n                DataSet result = clientDataSetManager.lookupDataSet(pair.lookup);\n                pair.listener.callback(result);\n            }\n        }\n\n        public void notFound() {\n            pushRequestMap.remove(dataSetMetadata.getUUID());\n\n            for (DataSetLookupListenerPair pair : listenerList) {\n                pair.listener.notFound();\n            }\n        }\n\n        @Override\n        public boolean onError(final ClientRuntimeError error) {\n            boolean t = false;\n            for (DataSetLookupListenerPair pair : listenerList) {\n                if (pair.listener.onError(error)) {\n                    t = true;\n                }\n            }\n            return t;\n        }\n    }\n\n    private class DataSetLookupListenerPair {\n\n        DataSetLookup lookup;\n        DataSetReadyCallback listener;\n\n        private DataSetLookupListenerPair(DataSetLookup lookup,\n                                          DataSetReadyCallback listener) {\n            this.lookup = lookup;\n            this.listener = listener;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetExportReadyCallback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Interface for capturing the results of a data set export request\n */\npublic interface DataSetExportReadyCallback {\n\n    /**\n     * The path returned after a successful export\n     * @param exportFilePath The path of the exported file in the server\n     */\n    void exportReady(Path exportFilePath);\n\n    /**\n     * An error occurred during the export process\n     * @param error The error details\n     */\n    void onError(ClientRuntimeError error);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetMetadataCallback.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSetMetadata;\n\n/**\n * DataSetMetadata retrieval callback\n */\npublic interface DataSetMetadataCallback {\n\n    void callback(DataSetMetadata metatada);\n    void notFound();\n    boolean onError(ClientRuntimeError error);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/DataSetReadyCallback.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\n\n/**\n * DataSet retrieval callback\n */\npublic interface DataSetReadyCallback {\n\n    void callback(DataSet dataSet);\n    void notFound();\n    boolean onError(ClientRuntimeError error);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/BeanDataSetDefAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\n\nimport java.util.Map;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.dashbuilder.dataset.def.BeanDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>generatorClass</li>\n *     <li>paramaterMap</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface BeanDataSetDefAttributesEditor extends Editor<BeanDataSetDef> {\n\n    LeafAttributeEditor<String> generatorClass();\n\n    LeafAttributeEditor<Map<String, String>> paramaterMap();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/BeanDataSetDefEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\n\nimport java.util.Map;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.BeanDataSetDef</code>.</p>\n *\n * TODO \n * The attributes generatorClass and paramaterMap should be not directly referenced here, here should be referenced just the org.dashbuilder.dataset.client.editor.BeanDataSetDefAttributesEditor.\n * But gwt editor inheritance is not working in this situation, due to https://github.com/gwtproject/gwt/issues/6340\n * Please refactor it when bug from gwt is fixed.\n * \n * @since 0.4.0\n */\npublic interface BeanDataSetDefEditor extends DataSetDefEditor<BeanDataSetDef> {\n\n    LeafAttributeEditor<String> generatorClass();\n\n    LeafAttributeEditor<Map<String, String>> paramaterMap();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/CSVDataSetDefAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.dashbuilder.dataset.def.CSVDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>fileURL</li>\n *     <li>filePath</li>\n *     <li>separatorChar</li>\n *     <li>quoteChar</li>\n *     <li>escapeChar</li>\n *     <li>datePattern</li>\n *     <li>numberPattern</li>\n * </ul>\n * <p>It is a ValueAwareEditor as must nullify filePath or fileURL editors at runtime depending on the instance value.</p>\n * \n * @since 0.4.0\n */\npublic interface CSVDataSetDefAttributesEditor extends ValueAwareEditor<CSVDataSetDef> {\n\n    LeafAttributeEditor<String> fileURL();\n\n    LeafAttributeEditor<String> filePath();\n\n    LeafAttributeEditor<Character> separatorChar();\n\n    LeafAttributeEditor<Character> quoteChar();\n\n    LeafAttributeEditor<Character> escapeChar();\n\n    LeafAttributeEditor<String> datePattern();\n\n    LeafAttributeEditor<String> numberPattern();\n\n    @Ignore\n    boolean isUsingFilePath();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/CSVDataSetDefEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.CSVDataSetDef</code>.</p>\n *\n * TODO \n * All csv specific attributes should be not directly referenced here, here should be referenced just the org.dashbuilder.dataset.client.editor.BeanDataSetDefAttributesEditor.\n * But gwt editor inheritance is not working in this situation, due to https://github.com/gwtproject/gwt/issues/6340\n * Please refactor it when bug from gwt is fixed.\n * \n * @since 0.4.0\n */\npublic interface CSVDataSetDefEditor extends DataSetDefEditor<CSVDataSetDef> {\n\n    LeafAttributeEditor<String> fileURL();\n\n    LeafAttributeEditor<String> filePath();\n\n    LeafAttributeEditor<Character> separatorChar();\n\n    LeafAttributeEditor<Character> quoteChar();\n\n    LeafAttributeEditor<Character> escapeChar();\n\n    LeafAttributeEditor<String> datePattern();\n\n    LeafAttributeEditor<String> numberPattern();\n\n    @Ignore\n    boolean isUsingFilePath();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/ColumnListEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.CompositeEditor;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport org.dashbuilder.common.client.editor.HasConstrainedValue;\nimport org.dashbuilder.common.client.editor.HasEditMode;\nimport org.dashbuilder.common.client.editor.HasRestrictedValue;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\n\nimport java.util.List;\n\n/**\n * <p>The GWT editor contract for a collection of the data set definition columns, which type is <code>org.dashbuilder.dataset.def.DataColumnDef</code>.</p>\n *\n * @since 0.4.0\n */\npublic interface ColumnListEditor extends CompositeEditor<List<DataColumnDef>, DataColumnDef, DataColumnDefEditor>, \n        HasEditorErrors<List<DataColumnDef>>, HasConstrainedValue<List<DataColumnDef>>,\n        HasRestrictedValue<String> {\n\n    /**\n     * Columns edition constrains are different depending on the data set's provider type.\n     * \n     * @param type The data set's provider type.\n     */\n    @Editor.Ignore\n    void setProviderType(DataSetProviderType type);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/ColumnTypeEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.HasEditMode;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.ColumnType</code> of a given data column definition.</p>\n *\n * <p>It's a value aware editor as the available column types to change depend on the current column type value.</p>\n * @since 0.4.0\n */\npublic interface ColumnTypeEditor extends ValueAwareEditor<DataColumnDef>, HasEditMode {\n\n    /**\n     * Column editor requires the original column type in oder to allow changing column types to the types given by the original data set column type.   \n     * @param columnType The original data set column type\n     */\n    @Editor.Ignore\n    void setOriginalColumnType(ColumnType columnType);\n    \n    LeafAttributeEditor<ColumnType> columnType();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataColumnDefEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport org.dashbuilder.common.client.editor.HasEditMode;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataColumnDef</code>.</p>\n *\n * @since 0.4.0\n */\npublic interface DataColumnDefEditor extends Editor<DataColumnDef>, HasEditMode {\n\n\n    /**\n     * Columns edition constrains are different depending on the data set's provider type.\n     *\n     * @param type The data set's provider type.\n     */\n    @Editor.Ignore\n    void setProviderType(DataSetProviderType type);\n\n    /**\n     * Column editor requires the original column type in oder to allow changing column types to the types given by the original data set column type.   \n     * @param columnType The original data set column type\n     */\n    @Editor.Ignore\n    void setOriginalColumnType(ColumnType columnType);\n\n    /**\n     * <p>Called when editor is detached from the editors chain. Remove view from parent element here.</p>\n     */\n    @Editor.Ignore\n    void removeFromParent();\n    \n    LeafAttributeEditor<String> id();\n\n    @Editor.Path(\".\")\n    ColumnTypeEditor columnType();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefBackendCacheAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>cacheEnabled</li>\n *     <li>cacheMaxRows</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefBackendCacheAttributesEditor extends ValueAwareEditor<DataSetDef> {\n\n    LeafAttributeEditor<Boolean> cacheEnabled();\n    LeafAttributeEditor<Integer> cacheMaxRows();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefBasicAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>uuid</li>\n *     <li>name</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefBasicAttributesEditor extends Editor<DataSetDef> {\n\n    LeafAttributeEditor<String> UUID();\n    LeafAttributeEditor<String> name();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefClientCacheAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>pushEnabled</li>\n *     <li>pushMaxSize</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefClientCacheAttributesEditor extends ValueAwareEditor<DataSetDef> {\n\n    LeafAttributeEditor<Boolean> pushEnabled();\n    LeafAttributeEditor<Integer> pushMaxSize();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefColumnsEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.HasConstrainedValue;\nimport org.dashbuilder.common.client.editor.HasRestrictedValue;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\nimport java.util.List;\n\n/**\n * <p>The GWT editor contract for the data set definition columns.</p>\n * <p>It takes care about the allColumnsEnabled flag.</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefColumnsEditor extends ValueAwareEditor<DataSetDef>,\n        HasConstrainedValue<List<DataColumnDef>>, HasRestrictedValue<String> {\n\n    ColumnListEditor columns();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefColumnsFilterEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.HasConstrainedValue;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\nimport java.util.List;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>data set columns</li>\n *     <li>data set filter</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefColumnsFilterEditor extends ValueAwareEditor<DataSetDef>, HasConstrainedValue<List<DataColumnDef>> {\n\n    @Editor.Path(\".\")\n    DataSetDefColumnsEditor columnListEditor();\n\n    DataSetDefFilterEditor dataSetFilter();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.HasConstrainedValue;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\nimport java.util.List;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>It delegates to sub-editors the different attributes edition:</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefEditor<T extends DataSetDef> extends ValueAwareEditor<T>, HasConstrainedValue<List<DataColumnDef>> {\n\n    @Editor.Path(\".\")\n    DataSetDefBasicAttributesEditor basicAttributesEditor();\n\n    @Editor.Path(\".\")\n    DataSetDefColumnsFilterEditor columnsAndFilterEditor();\n    \n    @Editor.Path(\".\")\n    DataSetDefBackendCacheAttributesEditor backendCacheEditor();\n\n    @Editor.Path(\".\")\n    DataSetDefClientCacheAttributesEditor clientCacheEditor();\n\n    @Editor.Path(\".\")\n    DataSetDefRefreshAttributesEditor refreshEditor();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefFilterEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.filter.DataSetFilter</code>.</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefFilterEditor extends ValueAwareEditor<DataSetFilter> {\n    \n    void init(DataSetMetadata metadata);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefProviderTypeEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.HasEditorErrors;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>provider type</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefProviderTypeEditor extends HasEditorErrors<DataSetDef> {\n\n    LeafAttributeEditor<DataSetProviderType> provider();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefRefreshAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.DataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>refreshTime</li>\n *     <li>refreshAlways</li>\n * </ul>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefRefreshAttributesEditor extends ValueAwareEditor<DataSetDef> {\n\n    LeafAttributeEditor<Boolean> refreshAlways();\n    DataSetDefRefreshIntervalEditor refreshTime();\n\n    @Editor.Ignore\n    boolean isRefreshEnabled();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/DataSetDefRefreshIntervalEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.LeafValueEditor;\n\n/**\n * <p>The GWT editor contract for the refreshInterval attribute for a data set definition.</p>\n * \n * @since 0.4.0\n */\npublic interface DataSetDefRefreshIntervalEditor extends LeafValueEditor<String> {\n\n    void setEnabled(boolean isEnabled);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/KafkaDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.dashbuilder.dataset.def.KafkaDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>host</li>\n *     <li>port</li>\n *     <li>target</li>\n *     <li>clientId</li>\n *     <li>nodeId</li>\n *     <li>topic</li>\n *     <li>partition</li>\n * </ul>\n * \n */\npublic interface KafkaDataSetDefAttributesEditor extends ValueAwareEditor<KafkaDataSetDef> {\n\n    LeafAttributeEditor<String> host();\n\n    LeafAttributeEditor<String> port();\n\n    LeafAttributeEditor<KafkaDataSetDef.MetricsTarget> target();\n\n    LeafAttributeEditor<String> filter();\n\n    LeafAttributeEditor<String> clientId();\n\n    LeafAttributeEditor<String> nodeId();\n\n    LeafAttributeEditor<String> topic();\n\n    LeafAttributeEditor<String> partition();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/KafkaDataSetDefEditor.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef.MetricsTarget;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.KafkaDataSetDef</code>.</p>\n *\n */\npublic interface KafkaDataSetDefEditor extends DataSetDefEditor<KafkaDataSetDef> {\n\n    LeafAttributeEditor<String> host();\n\n    LeafAttributeEditor<String> port();\n\n    LeafAttributeEditor<MetricsTarget> target();\n\n    LeafAttributeEditor<String> filter();\n    \n    LeafAttributeEditor<String> clientId();\n\n    LeafAttributeEditor<String> nodeId();\n\n    LeafAttributeEditor<String> topic();\n\n    LeafAttributeEditor<String> partition();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/PrometheusDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.dashbuilder.dataset.def.PrometheusDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>serverUrl</li>\n *     <li>query</li>\n * </ul>\n * \n */\npublic interface PrometheusDataSetDefAttributesEditor extends ValueAwareEditor<PrometheusDataSetDef> {\n\n    LeafAttributeEditor<String> serverUrl();\n\n    LeafAttributeEditor<String> query();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/PrometheusDataSetDefEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.PrometheusDataSetDef</code>.</p>\n *\n */\npublic interface PrometheusDataSetDefEditor extends DataSetDefEditor<PrometheusDataSetDef> {\n\n    LeafAttributeEditor<String> serverUrl();\n\n    LeafAttributeEditor<String> query();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/SQLDataSetDefAttributesEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.dashbuilder.dataset.def.SQLDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>dataSource</li>\n *     <li>dbSchema</li>\n *     <li>dbTable</li>\n *     <li>dbSQL</li>\n * </ul>\n * <p>It is a ValueAwareEditor as must nullify dbTable or dbSQL editors at runtime depending on instance value.</p>\n * @since 0.4.0\n */\npublic interface SQLDataSetDefAttributesEditor extends ValueAwareEditor<SQLDataSetDef> {\n\n    LeafAttributeEditor<String> dataSource();\n    LeafAttributeEditor<String> dbSchema();\n    LeafAttributeEditor<String> dbTable();\n    LeafAttributeEditor<String> dbSQL();\n    \n    @Ignore\n    boolean isUsingQuery();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/editor/SQLDataSetDefEditor.java",
    "content": "package org.dashbuilder.dataset.client.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\n\n/**\n * <p>The GWT editor contract for beans of type <code>org.dashbuilder.dataset.def.SQLDataSetDef</code>.</p>\n *\n * TODO \n * The attributes dataSource, dbSchema, dbTable and dbSQL should be not directly referenced here, here should be referenced just the org.dashbuilder.dataset.client.editor.SQLDataSetDefAttributesEditor.\n * But gwt editor inheritance is not working in this situation, due to https://github.com/gwtproject/gwt/issues/6340\n * Please refactor it when bug from gwt is fixed.\n * \n * @since 0.4.0\n */\npublic interface SQLDataSetDefEditor extends DataSetDefEditor<SQLDataSetDef> {\n\n    LeafAttributeEditor<String> dataSource();\n    LeafAttributeEditor<String> dbSchema();\n    LeafAttributeEditor<String> dbTable();\n    LeafAttributeEditor<String> dbSQL();\n\n    @Ignore\n    boolean isUsingQuery();\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/engine/ClientChronometer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.engine;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.Duration;\nimport org.dashbuilder.dataset.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.dataset.engine.Chronometer;\n\n@Dependent\npublic final class ClientChronometer implements Chronometer {\n\n    protected Double startTime;\n    protected Double stopTime;\n\n    public long start() {\n        stopTime = null;\n        startTime = Duration.currentTimeMillis();\n        return startTime.longValue() * 1000000;\n    }\n\n    public long stop() {\n        stopTime = Duration.currentTimeMillis();\n        return stopTime.longValue() * 1000000;\n    }\n\n    public long elapsedTime() {\n        long stop = stopTime != null ? stopTime.longValue() : System.currentTimeMillis();\n        return (stop - startTime.longValue()) * 1000000;\n    }\n\n    public String formatElapsedTime(long millis) {\n        long milliseconds = millis;\n        long seconds = milliseconds / 1000; milliseconds %= 1000;\n        long minutes = seconds / 60; seconds %= 60;\n        long hours = minutes / 60; minutes %= 60;\n        long days = hours / 24; hours %= 24;\n        long weeks = days / 7; days %= 7;\n        double secondsd = (double) (seconds * 1000 + milliseconds) / 1000;\n\n        StringBuilder buf = new StringBuilder();\n        if (weeks > 0) buf.append(weeks).append(\" \").append( CommonConstants.INSTANCE.weeks()).append(\" \");\n        if (days > 0) buf.append(days).append(\"d \");\n        if (hours > 0) buf.append(hours).append(\"h \");\n        if (minutes > 0) buf.append(minutes).append(\"m \");\n        if (secondsd > 0) buf.append(secondsd).append(\"s\");\n        if (buf.length() == 0) return \"0s\";\n        return buf.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/engine/ClientDateFormatter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.engine;\n\nimport java.util.Date;\n\npublic interface ClientDateFormatter {\n\n    String format(Date d, String pattern);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/engine/ClientDateFormatterImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.engine;\n\nimport java.util.Date;\nimport com.google.gwt.i18n.client.DateTimeFormat;\n\npublic class ClientDateFormatterImpl implements ClientDateFormatter {\n\n    @Override\n    public String format(Date d, String pattern) {\n        DateTimeFormat format  = DateTimeFormat.getFormat(pattern);\n        return format.format(d);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/engine/ClientIntervalBuilderDynamicDate.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.engine;\n\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.date.Quarter;\nimport org.dashbuilder.dataset.engine.DataSetHandler;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilder;\nimport org.dashbuilder.dataset.engine.group.IntervalList;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.sort.ColumnSort;\nimport org.dashbuilder.dataset.sort.DataSetSort;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.dataset.sort.SortedList;\n\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\n\n/**\n * Interval builder for date columns which generates intervals depending on the underlying data available.\n */\n@ApplicationScoped\npublic class ClientIntervalBuilderDynamicDate implements IntervalBuilder {\n\n    private ClientDateFormatter dateFormatter;\n\n    public ClientIntervalBuilderDynamicDate() {\n    }\n\n    @Inject\n    public ClientIntervalBuilderDynamicDate(ClientDateFormatter dateFormatter) {\n        this.dateFormatter = dateFormatter;\n    }\n\n    public IntervalList build(DataSetHandler handler, ColumnGroup columnGroup) {\n        IntervalDateRangeList results = new IntervalDateRangeList(columnGroup);\n        DataSet dataSet = handler.getDataSet();\n        List values = dataSet.getColumnById(columnGroup.getSourceId()).getValues();\n        if (values.isEmpty()) {\n            return results;\n        }\n\n        // Sort the column dates.\n        DataSetSort sortOp = new DataSetSort();\n        sortOp.addSortColumn(new ColumnSort(columnGroup.getSourceId(), SortOrder.ASCENDING));\n        DataSetHandler sortResults = handler.sort(sortOp);\n        List<Integer> sortedRows = sortResults.getRows();\n        if (sortedRows == null || sortedRows.isEmpty()) {\n            return results;\n        }\n\n        // Get the lower & upper limits.\n        SortedList sortedValues = new SortedList(values, sortedRows);\n        Date minDate = null;\n        Date maxDate = null;\n        for (int i = 0; minDate == null && i < sortedValues.size(); i++) {\n            minDate = (Date) sortedValues.get(i);\n        }\n        for (int i = sortedValues.size()-1; maxDate == null && i >= 0; i--) {\n            maxDate = (Date) sortedValues.get(i);\n        }\n\n        // If min/max are equals then create a single interval.\n        DateIntervalType intervalType = calculateIntervalSize(minDate, maxDate, columnGroup);\n        if (minDate == null || minDate.compareTo(maxDate) == 0) {\n            IntervalDateRange interval = new IntervalDateRange(0, intervalType, minDate, maxDate);\n            for (int row = 0; row < sortedValues.size(); row++) interval.getRows().add(row);\n            results.add(interval);\n\n            results.setIntervalType(columnGroup.getIntervalSize());\n            results.setMinValue(minDate);\n            results.setMaxValue(maxDate);\n            return results;\n        }\n\n        // Create the intervals according to the min/max dates.\n        Date intervalMinDate = firstIntervalDate(intervalType, minDate, columnGroup);\n        int index = 0;\n        int counter = 0;\n        while (intervalMinDate.compareTo(maxDate) <= 0) {\n\n            // Go to the next interval\n            Date intervalMaxDate = nextIntervalDate(intervalMinDate, intervalType, 1);\n\n            // Create the interval.\n            IntervalDateRange interval = new IntervalDateRange(counter++, intervalType, intervalMinDate, intervalMaxDate);\n            results.add(interval);\n\n            // Add the target rows to the interval.\n            boolean stop = false;\n            while (!stop) {\n                if (index >= sortedValues.size()) {\n                    stop = true;\n                } else {\n                    Date dateValue = (Date) sortedValues.get(index);\n                    Integer row = sortedRows.get(index);\n                    if (dateValue == null) {\n                        index++;\n                    } else if (dateValue.before(intervalMaxDate)) {\n                        interval.getRows().add(row);\n                        index++;\n                    } else {\n                        stop = true;\n                    }\n                }\n            }\n            // Move to the next interval.\n            intervalMinDate = intervalMaxDate;\n        }\n\n        // Reverse intervals if requested\n        boolean asc = columnGroup.isAscendingOrder();\n        if (!asc) Collections.reverse( results );\n\n        results.setIntervalType(intervalType.toString());\n        results.setMinValue(minDate);\n        results.setMaxValue(maxDate);\n        return results;\n    }\n\n    public IntervalList build(DataColumn dataColumn) {\n        ColumnGroup columnGroup = dataColumn.getColumnGroup();\n        Date minDate = (Date) dataColumn.getMinValue();\n        Date maxDate = (Date) dataColumn.getMaxValue();\n\n        IntervalDateRangeList results = new IntervalDateRangeList(columnGroup);\n        if (minDate == null || maxDate == null) {\n            return results;\n        }\n        DateIntervalType intervalType = DateIntervalType.getByName(dataColumn.getIntervalType());\n        if (intervalType == null) {\n            intervalType = DateIntervalType.YEAR;\n        }\n        Date intervalMinDate = firstIntervalDate(intervalType, minDate, columnGroup);\n        int counter = 0;\n        while (intervalMinDate.compareTo(maxDate) <= 0) {\n\n            // Go to the next interval\n            Date intervalMaxDate = nextIntervalDate(intervalMinDate, intervalType, 1);\n\n            // Create the interval.\n            IntervalDateRange interval = new IntervalDateRange(counter++, intervalType, intervalMinDate, intervalMaxDate);\n            results.add(interval);\n\n            // Move to the next interval.\n            intervalMinDate = intervalMaxDate;\n        }\n\n        // Reverse intervals if requested\n        boolean asc = columnGroup.isAscendingOrder();\n        if (!asc) Collections.reverse( results );\n\n        results.setIntervalType(intervalType.toString());\n        results.setMinValue(minDate);\n        results.setMaxValue(maxDate);\n        return results;\n    }\n\n    public DateIntervalType calculateIntervalSize(Date minDate, Date maxDate, ColumnGroup columnGroup) {\n\n        DateIntervalType intervalType = DateIntervalType.getByName(columnGroup.getIntervalSize());\n        if (intervalType == null) {\n            intervalType = YEAR;\n        }\n\n        if (minDate == null || maxDate == null) {\n            return intervalType;\n        }\n\n        long millis = (maxDate.getTime() - minDate.getTime());\n        if (millis <= 0) {\n            return intervalType;\n        }\n\n        // Calculate the interval type used according to the constraints set.\n        int maxIntervals = columnGroup.getMaxIntervals();\n        if (maxIntervals < 1) maxIntervals = 15;\n        for (DateIntervalType type : values()) {\n            long nintervals = millis / getDurationInMillis(type);\n            if (nintervals < maxIntervals) {\n                intervalType = type;\n                break;\n            }\n        }\n\n        // Ensure the interval mode obtained is always greater or equals than the preferred interval size.\n        DateIntervalType intervalSize = null;\n        String preferredSize = columnGroup.getIntervalSize();\n        if (preferredSize != null && preferredSize.trim().length() > 0) {\n            intervalSize = getByName(columnGroup.getIntervalSize());\n        }\n        if (intervalSize != null && compare(intervalType, intervalSize) == -1) {\n            intervalType = intervalSize;\n        }\n        return intervalType;\n    }\n\n    protected Date firstIntervalDate(DateIntervalType intervalType, Date minDate, ColumnGroup columnGroup) {\n        Date intervalMinDate = new Date(minDate.getTime());\n        if (YEAR.equals(intervalType)) {\n            intervalMinDate.setMonth(0);\n            intervalMinDate.setDate(1);\n            intervalMinDate.setHours(0);\n            intervalMinDate.setMinutes(0);\n            intervalMinDate.setSeconds(0);\n        }\n        if (QUARTER.equals(intervalType)) {\n            int currentMonth = intervalMinDate.getMonth();\n            int firstMonthYear = columnGroup.getFirstMonthOfYear().getIndex();\n            int rest = Quarter.getPositionInQuarter(firstMonthYear, currentMonth + 1);\n            intervalMinDate.setMonth(currentMonth - rest);\n            intervalMinDate.setDate(1);\n            intervalMinDate.setHours(0);\n            intervalMinDate.setMinutes(0);\n            intervalMinDate.setSeconds(0);\n        }\n        if (MONTH.equals(intervalType)) {\n            intervalMinDate.setDate(1);\n            intervalMinDate.setHours(0);\n            intervalMinDate.setMinutes(0);\n            intervalMinDate.setSeconds(0);\n        }\n        if (DAY.equals(intervalType) || DAY_OF_WEEK.equals(intervalType) || WEEK.equals(intervalType)) {\n            intervalMinDate.setHours(0);\n            intervalMinDate.setMinutes(0);\n            intervalMinDate.setSeconds(0);\n        }\n        if (HOUR.equals(intervalType)) {\n            intervalMinDate.setMinutes(0);\n            intervalMinDate.setSeconds(0);\n        }\n        if (MINUTE.equals(intervalType)) {\n            intervalMinDate.setSeconds(0);\n        }\n        return intervalMinDate;\n    }\n\n    protected Date nextIntervalDate(Date intervalMinDate, DateIntervalType intervalType, int intervals) {\n        Date intervalMaxDate = new Date(intervalMinDate.getTime());\n\n        if (MILLENIUM.equals(intervalType)) {\n            intervalMaxDate.setYear(intervalMinDate.getYear() + 1000 * intervals);\n        }\n        else if (CENTURY.equals(intervalType)) {\n            intervalMaxDate.setYear(intervalMinDate.getYear() + 100 * intervals);\n        }\n        else if (DECADE.equals(intervalType)) {\n            intervalMaxDate.setYear(intervalMinDate.getYear() + 10 * intervals);\n        }\n        else if (YEAR.equals(intervalType)) {\n            intervalMaxDate.setYear(intervalMinDate.getYear() +  intervals);\n        }\n        else if (QUARTER.equals(intervalType)) {\n            intervalMaxDate.setMonth(intervalMinDate.getMonth() + 3 * intervals);\n        }\n        else if (MONTH.equals(intervalType)) {\n            intervalMaxDate.setMonth(intervalMinDate.getMonth() + intervals);\n        }\n        else if (WEEK.equals(intervalType)) {\n            intervalMaxDate.setDate(intervalMinDate.getDate() + 7 * intervals);\n        }\n        else if (DAY.equals(intervalType) || DAY_OF_WEEK.equals(intervalType)) {\n            intervalMaxDate.setDate(intervalMinDate.getDate() + intervals);\n        }\n        else if (HOUR.equals(intervalType)) {\n            intervalMaxDate.setHours(intervalMinDate.getHours() + intervals);\n        }\n        else if (MINUTE.equals(intervalType)) {\n            intervalMaxDate.setMinutes(intervalMinDate.getMinutes() + intervals);\n        }\n        else if (SECOND.equals(intervalType)) {\n            intervalMaxDate.setSeconds(intervalMinDate.getSeconds() + intervals);\n        }\n        else {\n            // Default to year to avoid infinite loops\n            intervalMaxDate.setYear(intervalMinDate.getYear() + intervals);\n        }\n        return intervalMaxDate;\n    }\n\n    /**\n     * A list containing date range intervals.\n     */\n    public class IntervalDateRangeList extends IntervalList {\n\n        public IntervalDateRangeList(ColumnGroup columnGroup) {\n            super(columnGroup);\n        }\n\n        public Interval locateInterval(Object value) {\n            Date d = (Date) value;\n            for (Interval interval : this) {\n                IntervalDateRange dateRange = (IntervalDateRange) interval;\n                if (d.equals(dateRange.getMinDate()) || (d.after(dateRange.getMinDate()) && d.before(dateRange.getMaxDate()))) {\n                    return interval;\n                }\n            }\n            return null;\n        }\n    }\n\n    /**\n     * A date interval holding dates belonging to a given range.\n     */\n    public class IntervalDateRange extends Interval {\n\n        public IntervalDateRange(int index, DateIntervalType intervalType, Date minDate, Date maxDate) {\n            super(calculateName(intervalType, minDate));\n            super.setMinValue(minDate);\n            super.setMaxValue(maxDate);\n            super.setIndex(index);\n            super.setType(intervalType != null ? intervalType.toString() : null);\n        }\n\n        public Date getMinDate() {\n            return (Date) minValue;\n        }\n\n        public Date getMaxDate() {\n            return (Date) maxValue;\n        }\n    }\n\n    public String calculateName(DateIntervalType intervalType, Date d) {\n        if (MILLENIUM.equals(intervalType) || CENTURY.equals(intervalType)\n                || DECADE.equals(intervalType) || YEAR.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy\");\n        }\n        if (QUARTER.equals(intervalType) || MONTH.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy-MM\");\n        }\n        if (WEEK.equals(intervalType) || DAY.equals(intervalType) || DAY_OF_WEEK.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy-MM-dd\");\n        }\n        if (HOUR.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy-MM-dd HH\");\n        }\n        if (MINUTE.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy-MM-dd HH:mm\");\n        }\n        if (SECOND.equals(intervalType)) {\n            return dateFormatter.format(d, \"yyyy-MM-dd HH:mm:ss\");\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/engine/ClientIntervalBuilderLocator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.engine;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilder;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilderDynamicLabel;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilderFixedDate;\nimport org.dashbuilder.dataset.engine.group.IntervalBuilderLocator;\nimport org.dashbuilder.dataset.group.GroupStrategy;\n\n@ApplicationScoped\npublic class ClientIntervalBuilderLocator implements IntervalBuilderLocator {\n\n    IntervalBuilderDynamicLabel intervalBuilderDynamicLabel;\n    ClientIntervalBuilderDynamicDate intervalBuilderDynamicDate;\n    IntervalBuilderFixedDate intervalBuilderFixedDate;\n\n    public ClientIntervalBuilderLocator() {\n    }\n\n    @Inject\n    public ClientIntervalBuilderLocator(IntervalBuilderDynamicLabel intervalBuilderDynamicLabel,\n                                        ClientIntervalBuilderDynamicDate intervalBuilderDynamicDate,\n                                        IntervalBuilderFixedDate intervalBuilderFixedDate) {\n\n        this.intervalBuilderDynamicLabel = intervalBuilderDynamicLabel;\n        this.intervalBuilderDynamicDate = intervalBuilderDynamicDate;\n        this.intervalBuilderFixedDate = intervalBuilderFixedDate;\n    }\n\n    public IntervalBuilder lookup(ColumnType columnType, GroupStrategy strategy) {\n        if (ColumnType.LABEL.equals(columnType)) {\n            if (GroupStrategy.FIXED.equals(strategy)) return intervalBuilderDynamicLabel;\n            if (GroupStrategy.DYNAMIC.equals(strategy)) return intervalBuilderDynamicLabel;\n        }\n        if (ColumnType.DATE.equals(columnType)) {\n            if (GroupStrategy.FIXED.equals(strategy)) return intervalBuilderFixedDate;\n            if (GroupStrategy.DYNAMIC.equals(strategy)) return intervalBuilderDynamicDate;\n            return intervalBuilderDynamicDate;\n        }\n        if (ColumnType.NUMBER.equals(columnType)) {\n            return intervalBuilderDynamicLabel;\n        }\n        if (ColumnType.TEXT.equals(columnType)) {\n            throw new IllegalArgumentException( CommonConstants.INSTANCE.exc_text_columns_no_grouping());\n        }\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/bundles/DataSetClientImages.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.dataset.client.resources.bundles;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.DataResource;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for Data Set client components.\n */\npublic interface DataSetClientImages extends ClientBundle {\n\n    @Source(\"images/csv_icon_160.png\")\n    DataResource csvIcon160();\n\n    @Source(\"images/csv_icon_32.png\")\n    DataResource csvIcon32();\n    \n    @Source(\"images/java_icon_160.png\")\n    DataResource javaIcon160();\n\n    @Source(\"images/java_icon_32.png\")\n    DataResource javaIcon32();\n    \n    @Source(\"images/sql_icon_160.png\")\n    DataResource sqlIcon160();\n\n    @Source(\"images/sql_icon_32.png\")\n    DataResource sqlIcon32();\n\n    @Source(\"images/el_icon_160.png\")\n    DataResource elIcon160();\n\n    @Source(\"images/el_icon_32.png\")\n    DataResource elIcon32();\n    \n    @Source(\"images/excel_icon.png\")\n    DataResource excelIcon();\n\n    @Source(\"images/label_icon_16.png\")\n    DataResource labelIcon16();\n\n    @Source(\"images/label_icon_32.png\")\n    DataResource labelIcon32();\n\n    @Source(\"images/number_icon_32_V1.png\")\n    DataResource numberIcon32V1();\n\n    @Source(\"images/number_icon_32_V2.png\")\n    DataResource numberIcon32V2();\n\n    @Source(\"images/number_icon_32_V3.png\")\n    DataResource numberIcon32V3();\n    \n    @Source(\"images/text_icon_16.png\")\n    DataResource textIcon16();\n\n    @Source(\"images/text_icon_32.png\")\n    DataResource textIcon32();\n\n    @Source(\"images/date_icon_16.png\")\n    DataResource dateIcon16();\n\n    @Source(\"images/date_icon_16.png\")\n    DataResource dateIcon32();\n\n    @Source(\"images/ok_icon_small.gif\")\n    ImageResource okIconSmall();\n\n    @Source(\"images/cancel_icon_small.gif\")\n    ImageResource cancelIconSmall();\n\n    @Source(\"images/loading_icon.gif\")\n    DataResource loadingIcon();\n\n    @Source(\"images/prometheus_icon_160.png\")\n    DataResource prometheusIcon160();\n\n    @Source(\"images/prometheus_icon_32.png\")\n    DataResource prometheusIcon32();\n    \n    @Source(\"images/kafka_icon_160.png\")\n    DataResource kafkaIcon160();\n\n    @Source(\"images/kafka_icon_32.png\")\n    DataResource kafkaIcon32();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/bundles/DataSetClientResources.java",
    "content": "package org.dashbuilder.dataset.client.resources.bundles;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface DataSetClientResources\n        extends\n        ClientBundle {\n\n    DataSetClientResources INSTANCE = GWT.create( DataSetClientResources.class );\n\n    DataSetClientImages images();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface AggregateFunctionTypeConstants extends ConstantsWithLookup {\n\n    public static final AggregateFunctionTypeConstants INSTANCE = GWT.create( AggregateFunctionTypeConstants.class );\n\n    String COUNT();\n    String DISTINCT();\n    String AVERAGE();\n    String SUM();\n    String MIN();\n    String MAX();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants extends Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create( CommonConstants.class );\n\n    String weeks();\n\n    String exc_text_columns_no_grouping();\n\n    String exc_no_client_side_data_export();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface CoreFunctionTypeConstants extends ConstantsWithLookup {\n\n    public static final CoreFunctionTypeConstants INSTANCE = GWT.create( CoreFunctionTypeConstants.class );\n\n    String IS_NULL();\n    String NOT_NULL();\n    String EQUALS_TO();\n    String NOT_EQUALS_TO();\n    String LIKE_TO();\n    String GREATER_THAN();\n    String GREATER_OR_EQUALS_TO();\n    String LOWER_THAN();\n    String LOWER_OR_EQUALS_TO();\n    String BETWEEN();\n    String TIME_FRAME();\n    String IN();\n    String NOT_IN();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface DateIntervalTypeConstants extends ConstantsWithLookup {\n\n    public static final DateIntervalTypeConstants INSTANCE = GWT.create( DateIntervalTypeConstants.class );\n\n    String MILLISECOND();\n    String HUNDRETH();\n    String TENTH();\n    String SECOND();\n    String MINUTE();\n    String HOUR();\n    String DAY();\n    String DAY_OF_WEEK();\n    String WEEK();\n    String MONTH();\n    String QUARTER();\n    String YEAR();\n    String DECADE();\n    String CENTURY();\n    String MILLENIUM();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface DayOfWeekConstants extends ConstantsWithLookup {\n\n    public static final DayOfWeekConstants INSTANCE = GWT.create( DayOfWeekConstants.class );\n\n    String SUNDAY();\n    String MONDAY();\n    String TUESDAY();\n    String WEDNESDAY();\n    String THURSDAY();\n    String FRIDAY();\n    String SATURDAY();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/MonthConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface MonthConstants extends ConstantsWithLookup {\n\n    public static final MonthConstants INSTANCE = GWT.create( MonthConstants.class );\n\n    String JANUARY();\n    String FEBRUARY();\n    String MARCH();\n    String APRIL();\n    String MAY();\n    String JUNE();\n    String JULY();\n    String AUGUST();\n    String SEPTEMBER();\n    String OCTOBER();\n    String NOVEMBER();\n    String DECEMBER();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface QuarterConstants extends ConstantsWithLookup {\n\n    public static final QuarterConstants INSTANCE = GWT.create( QuarterConstants.class );\n\n    String Q1();\n    String Q2();\n    String Q3();\n    String Q4();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface TimeModeConstants extends ConstantsWithLookup {\n\n    public static final TimeModeConstants INSTANCE = GWT.create( TimeModeConstants.class );\n\n    String NOW();\n    String BEGIN();\n    String END();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/java/org/dashbuilder/dataset/client/uuid/ClientUUIDGenerator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client.uuid;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.dom.client.Document;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\n\n@ApplicationScoped\npublic class ClientUUIDGenerator implements UUIDGenerator {\n\n    public String newUuid() {\n        return Document.get().createUniqueId();\n    }\n\n    public String newUuidBase64() {\n        return Document.get().createUniqueId();\n    }\n\n    public String uuidToBase64(String str) {\n        return str;\n    }\n\n    public String uuidFromBase64(String str) {\n        return str;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.dataset.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/DatasetClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name='org.jboss.errai.ioc.Container'/>\n\n  <inherits name=\"org.dashbuilder.CommonClient\"/>\n  <inherits name=\"org.dashbuilder.ServicesAPI\"/>\n  <inherits name=\"org.dashbuilder.DatasetAPI\"/>\n  <inherits name=\"org.dashbuilder.DatasetShared\"/>\n\n  <source path='dataset'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCOUNT=Count\nDISTINCT=Distinct\nAVERAGE=Average\nSUM=Sum\nMIN=Min\nMAX=Max\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_de.properties",
    "content": "COUNT=Anzahl\nDISTINCT=Eindeutig\nAVERAGE=Durchschnitt\nSUM=Summe\nMIN=Min.\nMAX=Max.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCOUNT=Recuento\nDISTINCT=Distinto\nAVERAGE=Promedio\nSUM=Suma\nMIN=Mín.\nMAX=Máx.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCOUNT=Nombre\nDISTINCT=Distinct\nAVERAGE=Moyenne\nSUM=Somme\nMIN=Min\nMAX=Max\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCOUNT=Conteggio\nDISTINCT=Distinto\nAVERAGE=Media\nSUM=Somma\nMIN=Minimo\nMAX=Massimo\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCOUNT=回数\nDISTINCT=一意\nAVERAGE=平均\nSUM=合計\nMIN=最小\nMAX=最大\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_pt_BR.properties",
    "content": "COUNT=Contar\nDISTINCT=Distinguir\nAVERAGE=Média\nSUM=Soma\nMIN=Min\nMAX=Max\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/AggregateFunctionTypeConstants_zh_CN.properties",
    "content": "COUNT=计数\nDISTINCT=区分\nAVERAGE=平均值\nSUM=总数\nMIN=最小值\nMAX=最大值\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nweeks=weeks\nexc_text_columns_no_grouping=TEXT columns do not support grouping.\nexc_no_client_side_data_export=Client-side export is not available.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_de.properties",
    "content": "weeks=Wochen\nexc_text_columns_no_grouping=TEXT-Spalten unterstützen keine Gruppierung.\nexc_no_client_side_data_export=Export auf Client-Seite ist nicht verfügbar.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nweeks=semanas\nexc_text_columns_no_grouping=Las columnas de TEXTO no soportan la agrupación.\nexc_no_client_side_data_export=La exportación del lado del cliente no está disponible.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nweeks=semaines\nexc_text_columns_no_grouping=Les colonnes TEXTE ne permettent pas le regroupement.\nexc_no_client_side_data_export=L''exportation côté client n''est pas disponible.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nweeks=settimane\nexc_text_columns_no_grouping=Le colonne di testo non supportano il raggruppamento.\nexc_no_client_side_data_export=L''esportazione lato client non è disponibile.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nweeks=週\nexc_text_columns_no_grouping=TEXT 列はグループ化をサポートしません。\nexc_no_client_side_data_export=クライアントサイドエクスポートは利用不可です。\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "weeks=semanas\nexc_text_columns_no_grouping=Colunas de TEXTO não suportam o agrupamento.\nexc_no_client_side_data_export=Exportação do lado do cliente não está disponível.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "weeks=周\nexc_text_columns_no_grouping=TEXT 字段不支持分组。\nexc_no_client_side_data_export=客户端的导出不可用。\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nIS_NULL=is null\nNOT_NULL=not null\nEQUALS_TO=equals to\nNOT_EQUALS_TO=different to\nLIKE_TO=like\nGREATER_THAN=greater than\nGREATER_OR_EQUALS_TO=greater or equals\nLOWER_THAN=lower than\nLOWER_OR_EQUALS_TO=lower or equals\nBETWEEN=between\nTIME_FRAME=time frame\nIN=in\nNOT_IN=not in\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_de.properties",
    "content": "IS_NULL=ist Null\nNOT_NULL=nicht Null\nEQUALS_TO=gleich \nNOT_EQUALS_TO=ungleich \nLIKE_TO=wie\nGREATER_THAN=größer als \nGREATER_OR_EQUALS_TO=größer oder gleich \nLOWER_THAN=kleiner als \nLOWER_OR_EQUALS_TO=kleiner oder gleich \nBETWEEN=zwischen \nTIME_FRAME=Zeitrahmen\nIN=in\nNOT_IN=nicht in \n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nIS_NULL=es nulo\nNOT_NULL=no es nulo\nEQUALS_TO=es igual a\nNOT_EQUALS_TO=diferente de\nLIKE_TO=como\nGREATER_THAN=mayor a\nGREATER_OR_EQUALS_TO=mayor o igual\nLOWER_THAN=inferior a\nLOWER_OR_EQUALS_TO=inferior o igual\nBETWEEN=entre\nTIME_FRAME=marco de tiempo\nIN=en\nNOT_IN=no en\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nIS_NULL=est nul\nNOT_NULL=non nul\nEQUALS_TO=est égal à\nNOT_EQUALS_TO=différent de\nLIKE_TO=correspond à\nGREATER_THAN=supérieur à\nGREATER_OR_EQUALS_TO=supérieur ou égal\nLOWER_THAN=inférieur à\nLOWER_OR_EQUALS_TO=inférieur ou égal\nBETWEEN=entre\nTIME_FRAME=période\nIN=dans\nNOT_IN=hors de\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nIS_NULL=è nullo\nNOT_NULL=non è nullo\nEQUALS_TO=uguale a\nNOT_EQUALS_TO=diverso da\nLIKE_TO=come\nGREATER_THAN=maggiore di\nGREATER_OR_EQUALS_TO=maggiore o uguale a\nLOWER_THAN=minore di\nLOWER_OR_EQUALS_TO=minore o uguale a\nBETWEEN=tra\nTIME_FRAME=intervallo di tempo\nIN=in\nNOT_IN=non in\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nIS_NULL=は null\nNOT_NULL=null ではない\nEQUALS_TO=等しい\nNOT_EQUALS_TO=異なる\nLIKE_TO=似ている\nGREATER_THAN=は次の値よりも大きい:\nGREATER_OR_EQUALS_TO=以上\nLOWER_THAN=未満\nLOWER_OR_EQUALS_TO=以下\nBETWEEN=は次の値の間にある\nTIME_FRAME=タイムフレーム\nIN=in\nNOT_IN=not in\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_pt_BR.properties",
    "content": "IS_NULL=é nulo\nNOT_NULL=não é nulo\nEQUALS_TO=igual a \nNOT_EQUALS_TO=diferente de \nLIKE_TO=como\nGREATER_THAN=maior do que\nGREATER_OR_EQUALS_TO=maior ou igual a\nLOWER_THAN=menor do que\nLOWER_OR_EQUALS_TO=menor ou igual a\nBETWEEN=entre\nTIME_FRAME=tempo\nIN=em\nNOT_IN=não em \n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/CoreFunctionTypeConstants_zh_CN.properties",
    "content": "IS_NULL=为 null\nNOT_NULL=非 null\nEQUALS_TO=等于\nNOT_EQUALS_TO=不同于\nLIKE_TO=类似\nGREATER_THAN=大于\nGREATER_OR_EQUALS_TO=大于或等于\nLOWER_THAN=低于\nLOWER_OR_EQUALS_TO=低于或等于\nBETWEEN=介于之间\nTIME_FRAME=时间范围\nIN=包括\nNOT_IN=不包括\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nMILLISECOND=Millisecond\nHUNDRETH=Hundreth\nTENTH=Tenth\nSECOND=Second\nMINUTE=Minute\nHOUR=Hour\nDAY=Day\nDAY_OF_WEEK=Day of week\nWEEK=Week\nMONTH=Month\nQUARTER=Quarter\nYEAR=Year\nDECADE=Decade\nCENTURY=Century\nMILLENIUM=Millenium\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_de.properties",
    "content": "MILLISECOND=Millisekunde\nHUNDRETH=Hunderstel\nTENTH=Zehntel\nSECOND=Sekunde\nMINUTE=Minute\nHOUR=Stunde\nDAY=Tag\nDAY_OF_WEEK=Wochentag\nWEEK=Woche\nMONTH=Monat\nQUARTER=Quartal\nYEAR=Jahr\nDECADE=Jahrzehnt\nCENTURY=Jahrhundert\nMILLENIUM=Jahrtausend\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nMILLISECOND=Milisegundo\nHUNDRETH=Centésimo\nTENTH=Décimo\nSECOND=Segundo\nMINUTE=Minuto\nHOUR=Hora\nDAY=Día\nDAY_OF_WEEK=Día de la semana\nWEEK=Semana\nMONTH=Mes\nQUARTER=Trimestre\nYEAR=Año\nDECADE=Década\nCENTURY=Siglo\nMILLENIUM=Milenio\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nMILLISECOND=Milliseconde\nHUNDRETH=Centième\nTENTH=Dixième\nSECOND=Deuxième\nMINUTE=Minute\nHOUR=Heure\nDAY=Jour\nDAY_OF_WEEK=Jour de la semaine\nWEEK=Semaine\nMONTH=Mois\nQUARTER=Trimestre\nYEAR=Année\nDECADE=Décennie\nCENTURY=Siècle\nMILLENIUM=Millénaire\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nMILLISECOND=Millisecondo\nHUNDRETH=Centesimo\nTENTH=Decimo\nSECOND=Secondo\nMINUTE=Minuto\nHOUR=Ora\nDAY=Giorno\nDAY_OF_WEEK=Giorno della settimana\nWEEK=Settimana\nMONTH=Mese\nQUARTER=Trimestre\nYEAR=Anno\nDECADE=Decennio\nCENTURY=Secolo\nMILLENIUM=Millennio\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#   http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nMILLISECOND=ミリ秒\nHUNDRETH=1/100\nTENTH=1/10\nSECOND=2 番目\nMINUTE=分\nHOUR=時間\nDAY=日\nDAY_OF_WEEK=曜日\nWEEK=週\nMONTH=月\nQUARTER=四半期\nYEAR=年\nDECADE=10 年\nCENTURY=100 年\nMILLENIUM=1000 年\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_pt_BR.properties",
    "content": "MILLISECOND=Milésimos de segundos\nHUNDRETH=Centézimo\nTENTH=Décimo\nSECOND=Segundo\nMINUTE=Minuto\nHOUR=Hora\nDAY=Dia\nDAY_OF_WEEK=Dia da semana\nWEEK=Semana\nMONTH=Mês\nQUARTER=Trimestre\nYEAR=Ano\nDECADE=Década\nCENTURY=Século\nMILLENIUM=Milênio\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DateIntervalTypeConstants_zh_CN.properties",
    "content": "MILLISECOND=毫秒\nHUNDRETH=第一百\nTENTH=第十\nSECOND=秒\nMINUTE=分钟\nHOUR=小时\nDAY=天\nDAY_OF_WEEK=星期几\nWEEK=周\nMONTH=月\nQUARTER=季度\nYEAR=年\nDECADE=十年\nCENTURY=世纪\nMILLENIUM=一千年\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSUNDAY=Sunday\nMONDAY=Monday\nTUESDAY=Tuesday\nWEDNESDAY=Wednesday\nTHURSDAY=Thursday\nFRIDAY=Friday\nSATURDAY=Saturday\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_de.properties",
    "content": "SUNDAY=Sonntag\nMONDAY=Montag\nTUESDAY=Dienstag\nWEDNESDAY=Mittwoch\nTHURSDAY=Donnerstag\nFRIDAY=Freitag\nSATURDAY=Samstag\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSUNDAY=Domingo\nMONDAY=Lunes\nTUESDAY=Martes\nWEDNESDAY=Miércoles\nTHURSDAY=Jueves\nFRIDAY=Viernes\nSATURDAY=Sábado\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSUNDAY=Dimanche\nMONDAY=Lundi\nTUESDAY=Mardi\nWEDNESDAY=Mercredi\nTHURSDAY=Jeudi\nFRIDAY=Vendredi\nSATURDAY=Samedi\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSUNDAY=Domenica\nMONDAY=Lunedì\nTUESDAY=Martedì\nWEDNESDAY=Mercoledì\nTHURSDAY=Giovedì\nFRIDAY=Venerdì\nSATURDAY=Sabato\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSUNDAY=日曜日\nMONDAY=月曜日\nTUESDAY=火曜日\nWEDNESDAY=水曜日\nTHURSDAY=木曜日\nFRIDAY=金曜日\nSATURDAY=土曜日\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_pt_BR.properties",
    "content": "SUNDAY=Domingo\nMONDAY=segunda-feira\nTUESDAY=terça-feira\nWEDNESDAY=quarta-feira\nTHURSDAY=quinta-feira\nFRIDAY=sexta-feira\nSATURDAY=Sábado\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/DayOfWeekConstants_zh_CN.properties",
    "content": "SUNDAY=星期天\nMONDAY=星期一\nTUESDAY=星期二\nWEDNESDAY=星期三\nTHURSDAY=星期四\nFRIDAY=星期五\nSATURDAY=星期六\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJANUARY=January\nFEBRUARY=February\nMARCH=March\nAPRIL=April\nMAY=May\nJUNE=June\nJULY=July\nAUGUST=August\nSEPTEMBER=September\nOCTOBER=October\nNOVEMBER=November\nDECEMBER=December"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_de.properties",
    "content": "JANUARY=Januar\nFEBRUARY=Februar\nMARCH=März\nAPRIL=April\nMAY=Mai\nJUNE=Juni\nJULY=Juli\nAUGUST=August\nSEPTEMBER=September\nOCTOBER=Oktober\nNOVEMBER=November\nDECEMBER=Dezember\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJANUARY=Enero\nFEBRUARY=Febrero\nMARCH=Marzo\nAPRIL=Abril\nMAY=Mayo\nJUNE=Junio\nJULY=Julio\nAUGUST=Agosto\nSEPTEMBER=Septiembre\nOCTOBER=Octubre\nNOVEMBER=Noviembre\nDECEMBER=Diciembre"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJANUARY=Janvier\nFEBRUARY=Février\nMARCH=Mars\nAPRIL=Avril\nMAY=Mai\nJUNE=Juin\nJULY=Juillet\nAUGUST=Août\nSEPTEMBER=Septembre\nOCTOBER=Octobre\nNOVEMBER=Novembre\nDECEMBER=Décembre"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJANUARY=Gennaio\nFEBRUARY=Febbraio\nMARCH=Marzo\nAPRIL=Aprile\nMAY=Maggio\nJUNE=Giugno\nJULY=Luglio\nAUGUST=Agosto\nSEPTEMBER=Settembre\nOCTOBER=Ottobre\nNOVEMBER=Novembre\nDECEMBER=Dicembre\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJANUARY=1月\nFEBRUARY=2月\nMARCH=3月\nAPRIL=4月\nMAY=5月\nJUNE=6月\nJULY=7月\nAUGUST=8月\nSEPTEMBER=9月\nOCTOBER=10月\nNOVEMBER=11月\nDECEMBER=12月"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_pt_BR.properties",
    "content": "JANUARY=Janeiro\nFEBRUARY=Fevereiro\nMARCH=Março\nAPRIL=Abril\nMAY=Maio\nJUNE=Junho\nJULY=Julho\nAUGUST=Agosto\nSEPTEMBER=Setembro\nOCTOBER=Outubro\nNOVEMBER=Novembro\nDECEMBER=Dezembro\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/MonthConstants_zh_CN.properties",
    "content": "JANUARY=1月\nFEBRUARY=2月\nMARCH=3月\nAPRIL=4月\nMAY=5月\nJUNE=6月\nJULY=7月\nAUGUST=8月\nSEPTEMBER=9月\nOCTOBER=10月\nNOVEMBER=11月\nDECEMBER=12月\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nQ1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_de.properties",
    "content": "Q1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nQ1=Primer trimestre\nQ2=Segundo trimestre\nQ3=Tercer trimestre\nQ4=Cuarto trimestre\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nQ1=T1\nQ2=T2\nQ3=T3\nQ4=T4\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nQ1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nQ1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_pt_BR.properties",
    "content": "Q1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/QuarterConstants_zh_CN.properties",
    "content": "Q1=Q1\nQ2=Q2\nQ3=Q3\nQ4=Q4\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNOW=Now\nBEGIN=Begin of\nEND=End of\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_de.properties",
    "content": "NOW=Jetzt\nBEGIN=Beginn von\nEND=Ende von\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNOW=Ahora\nBEGIN=Comienzo de\nEND=Fin de\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNOW=Maintenant\nBEGIN=Début de\nEND=Fin de\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNOW=Ora\nBEGIN=Inizio di\nEND=Fine di\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNOW=現在\nBEGIN=開始\nEND=終了\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_pt_BR.properties",
    "content": "NOW=Agora\nBEGIN=Começo de\nEND=Final de\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/main/resources/org/dashbuilder/dataset/client/resources/i18n/TimeModeConstants_zh_CN.properties",
    "content": "NOW=现在\nBEGIN=开始于\nEND=结束于\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/test/java/org/dashbuilder/dataset/client/AbstractDataSetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.common.client.backend.PathUrlFactory;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFormatter;\nimport org.dashbuilder.dataset.ExpenseReportsData;\nimport org.dashbuilder.dataset.events.DataSetModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetPushOkEvent;\nimport org.dashbuilder.dataset.events.DataSetPushingEvent;\nimport org.dashbuilder.dataset.service.DataSetDefServices;\nimport org.dashbuilder.dataset.service.DataSetExportServices;\nimport org.dashbuilder.dataset.service.DataSetLookupServices;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.CallerMock;\n\npublic abstract class AbstractDataSetTest {\n\n    @Mock\n    protected Event<DataSetPushingEvent> dataSetPushingEvent;\n\n    @Mock\n    protected Event<DataSetPushOkEvent> dataSetPushOkEvent;\n\n    @Mock\n    protected Event<DataSetModifiedEvent> dataSetModifiedEvent;\n\n    @Mock\n    protected DataSetLookupServices dataSetLookupServices;\n\n    @Mock\n    protected DataSetExportServices dataSetExportServices;\n\n    @Mock\n    protected PathUrlFactory pathUrlFactory;\n\n    @Mock\n    protected Caller<DataSetDefServices> dataSetDefServicesCaller;\n\n    protected Caller<DataSetExportServices> dataSetExportServicesCaller;\n    protected Caller<DataSetLookupServices> dataSetLookupServicesCaller;\n    protected ClientDataSetCore clientDataSetCore;\n    protected DataSetClientServices clientServices;\n    protected ClientDataSetManager clientDataSetManager;\n    protected DataSet expensesDataSet;\n    protected DataSetFormatter dataSetFormatter = new DataSetFormatter();\n\n    public static final String EXPENSES = \"expenses\";\n\n    public void initClientFactory() {\n        clientDataSetCore = ClientDataSetCore.get();\n        clientDataSetCore.setClientDateFormatter(new ClientDateFormatterMock());\n        clientDataSetCore.setChronometer(new ChronometerMock());\n    }\n\n    public void initClientDataSetManager() {\n        clientDataSetManager = clientDataSetCore.getClientDataSetManager();\n    }\n\n    public void initDataSetClientServices() {\n        dataSetExportServicesCaller = new CallerMock<>(dataSetExportServices);\n        dataSetLookupServicesCaller = new CallerMock<>(dataSetLookupServices);\n        clientServices = new DataSetClientServices(\n                clientDataSetManager,\n                pathUrlFactory,\n                clientDataSetCore.getAggregateFunctionManager(),\n                clientDataSetCore.getIntervalBuilderLocator(),\n                dataSetPushingEvent,\n                dataSetPushOkEvent,\n                dataSetModifiedEvent,\n                dataSetLookupServicesCaller,\n                dataSetDefServicesCaller,\n                dataSetExportServicesCaller);\n    }\n\n    public void registerExpensesDataSet() throws Exception {\n        expensesDataSet = ExpenseReportsData.INSTANCE.toDataSet();\n        expensesDataSet.setUUID(EXPENSES);\n        clientDataSetManager.registerDataSet(expensesDataSet);\n    }\n\n    @Before\n    public void init() throws Exception {\n        initClientFactory();\n        initClientDataSetManager();\n        initDataSetClientServices();\n        registerExpensesDataSet();\n    }\n\n\n    public void printDataSet(DataSet dataSet) {\n        System.out.print(dataSetFormatter.formatDataSet(dataSet, \"{\", \"}\", \",\\n\", \"\\\"\", \"\\\"\", \", \") + \"\\n\\n\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/test/java/org/dashbuilder/dataset/client/ChronometerMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.dataset.engine.Chronometer;\n\npublic class ChronometerMock implements Chronometer {\n\n    @Override\n    public long start() {\n        return 0;\n    }\n\n    @Override\n    public long stop() {\n        return 0;\n    }\n\n    @Override\n    public long elapsedTime() {\n        return 0;\n    }\n\n    @Override\n    public String formatElapsedTime(long millis) {\n        return String.valueOf(millis);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/test/java/org/dashbuilder/dataset/client/ClientDataSetManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClientDataSetManagerTest extends AbstractDataSetTest {\n\n    @Test\n    public void testGroupWithNullDates() {\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DATE));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // Group by date. No NPE must occur.\n        DataSet result = clientDataSetManager.lookupDataSet(\n                DataSetLookupFactory.newDataSetLookupBuilder()\n                        .dataset(EXPENSES)\n                        .group(COLUMN_DATE)\n                        .column(COLUMN_DATE)\n                        .column(COLUMN_AMOUNT, SUM)\n                        .buildLookup());\n\n        assertEquals(result.getRowCount(), 4);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/test/java/org/dashbuilder/dataset/client/ClientDateFormatterMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.client;\n\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\n\nimport org.dashbuilder.dataset.client.engine.ClientDateFormatter;\n\npublic class ClientDateFormatterMock implements ClientDateFormatter {\n\n    @Override\n    public String format(Date d, String pattern) {\n        SimpleDateFormat sdf = new SimpleDateFormat(pattern);\n        return sdf.format(d);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-client/src/test/java/org/dashbuilder/dataset/client/DataSetClientServicesTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.dataset.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.service.DataSetLookupServices;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetClientServicesTest {\n\n    @Mock\n    private ClientDataSetManager clientDataSetManager;\n\n    @Mock\n    private DataSetMetadata dataSetMetadata;\n\n    @Mock\n    private DataSetLookupServices dataSetLookupServices;\n\n    private CallerMock<DataSetLookupServices> dataSetLookupServicesCallerMock;\n\n    private boolean isCallbackCalled = false;\n\n    private boolean isNotFoundCalled = false;\n\n    private boolean isOnErrorCalled = false;\n\n    @Before\n    public void setup() {\n        dataSetLookupServicesCallerMock = new CallerMock<>(dataSetLookupServices);\n    }\n\n    @Test\n    public void testFetchMetadataWhenMetadataIsNotNull() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         dataSetLookupServicesCallerMock);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(dataSetMetadata);\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertTrue(isDataSetMetadataCallbackCalled());\n        assertFalse(isDataSetMetadataNotFoundCallbackCalled());\n        assertFalse(isDataSetMetadataOnErrorCallbackCalled());\n        assertNull(services.getRemoteMetadataMap().get(uuid));\n    }\n\n    @Test\n    public void testFetchMetadataWhenSetLookupServicesIsNull() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         null);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(null);\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertFalse(isDataSetMetadataCallbackCalled());\n        assertTrue(isDataSetMetadataNotFoundCallbackCalled());\n        assertFalse(isDataSetMetadataOnErrorCallbackCalled());\n        assertNull(services.getRemoteMetadataMap().get(uuid));\n    }\n\n    @Test\n    public void testFetchMetadataWhenRemoteMetadataMapContainsTheUUID() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         dataSetLookupServicesCallerMock);\n\n        services.getRemoteMetadataMap().put(uuid,\n                                            null);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(null);\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertTrue(isDataSetMetadataCallbackCalled());\n        assertFalse(isDataSetMetadataNotFoundCallbackCalled());\n        assertFalse(isDataSetMetadataOnErrorCallbackCalled());\n        assertNull(services.getRemoteMetadataMap().get(uuid));\n    }\n\n    @Test\n    public void testFetchMetadataWhenResultIsNull() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         dataSetLookupServicesCallerMock);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(null);\n        when(dataSetLookupServices.lookupDataSetMetadata(eq(uuid))).thenReturn(null);\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertFalse(isDataSetMetadataCallbackCalled());\n        assertTrue(isDataSetMetadataNotFoundCallbackCalled());\n        assertFalse(isDataSetMetadataOnErrorCallbackCalled());\n        assertNull(services.getRemoteMetadataMap().get(uuid));\n    }\n\n    @Test\n    public void testFetchMetadataWhenResultIsNotNull() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         dataSetLookupServicesCallerMock);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(null);\n        when(dataSetLookupServices.lookupDataSetMetadata(eq(uuid))).thenReturn(dataSetMetadata);\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertTrue(isDataSetMetadataCallbackCalled());\n        assertFalse(isDataSetMetadataNotFoundCallbackCalled());\n        assertFalse(isDataSetMetadataOnErrorCallbackCalled());\n        assertEquals(services.getRemoteMetadataMap().get(uuid),\n                     dataSetMetadata);\n    }\n\n    @Test\n    public void testFetchMetadataWhenDataSetLookupServicesReturnsAnError() throws Exception {\n        final String uuid = \"uuid\";\n        final DataSetClientServices services = makeDataSetClientServices(clientDataSetManager,\n                                                                         dataSetLookupServicesCallerMock);\n\n        when(clientDataSetManager.getDataSetMetadata(uuid)).thenReturn(null);\n\n        doThrow(Exception.class).when(dataSetLookupServices).lookupDataSetMetadata(any());\n\n        services.fetchMetadata(uuid,\n                               makeDataSetMetadataCallback());\n\n        assertFalse(isDataSetMetadataCallbackCalled());\n        assertFalse(isDataSetMetadataNotFoundCallbackCalled());\n        assertTrue(isDataSetMetadataOnErrorCallbackCalled());\n        assertNull(services.getRemoteMetadataMap().get(uuid));\n    }\n\n    private DataSetMetadataCallback makeDataSetMetadataCallback() {\n        return new DataSetMetadataCallback() {\n            @Override\n            public void callback(final DataSetMetadata metadata) {\n                callbackCalled();\n            }\n\n            @Override\n            public void notFound() {\n                notFoundCalled();\n            }\n\n            @Override\n            public boolean onError(final ClientRuntimeError error) {\n                onErrorCalled();\n\n                return false;\n            }\n        };\n    }\n\n    private void onErrorCalled() {\n        isOnErrorCalled = true;\n    }\n\n    private void notFoundCalled() {\n        isNotFoundCalled = true;\n    }\n\n    private void callbackCalled() {\n        isCallbackCalled = true;\n    }\n\n    public boolean isDataSetMetadataCallbackCalled() {\n        return isCallbackCalled;\n    }\n\n    public boolean isDataSetMetadataNotFoundCallbackCalled() {\n        return isNotFoundCalled;\n    }\n\n    public boolean isDataSetMetadataOnErrorCallbackCalled() {\n        return isOnErrorCalled;\n    }\n\n    private DataSetClientServices makeDataSetClientServices(final ClientDataSetManager clientDataSetManager,\n                                                            final CallerMock<DataSetLookupServices> dataSetLookupServicesCallerMock) {\n        return new DataSetClientServices(clientDataSetManager,\n                                         null,\n                                         null,\n                                         null,\n                                         null,\n                                         null,\n                                         null,\n                                         dataSetLookupServicesCallerMock,\n                                         null,\n                                         null);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-dataset-editor</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Data Set Editor</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-widgets</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n  </build>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/perspectives/DataSetAuthoringPerspective.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.perspectives;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n/**\n * <p>The authoring perspective for the management of data sets using the UI.</p>\n * <p>Provides:</p>\n * <ul>\n *     <li>The Data Set Explorer widget on the left area.</li>     \n *     <li>The Data Set Authoring Home widget on the center area.</li>\n * </ul>\n *\n * @since 0.3.0 \n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"DataSetAuthoringPerspective\")\npublic class DataSetAuthoringPerspective {\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Data Set Authoring\");\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(\"DataSetAuthoringHome\")));\n        final PanelDefinition west = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        west.setWidth(350);\n        west.setMinWidth(300);\n        west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(\"DataSetDefExplorer\")));\n        perspective.getRoot().insertChild( CompassPosition.WEST, west );\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants.java",
    "content": "package org.dashbuilder.dataset.editor.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface DataSetAuthoringConstants extends Messages {\n\n    public static final DataSetAuthoringConstants INSTANCE = GWT.create(DataSetAuthoringConstants.class);\n\n    String homeTitle();\n    String creationWizardTitle();\n    String dataSetCount(int count);\n    String nextSteps();\n    String defineA();\n    String newDataSet();\n    String toFetchYourDataFromExtSystem();\n    String createDataDisplayers();\n    String createDashboards();\n    String editorTitleGeneric();\n    String editorTitle(String name, String type);\n    String validationOk();\n    String validationFailed();\n    String dataSetNotFound();\n    String saving();\n    String savedOk();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetAuthoringHomePresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.editor.client.resources.i18n.DataSetAuthoringConstants;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchScreen(identifier = \"DataSetAuthoringHome\")\n@Dependent\npublic class DataSetAuthoringHomePresenter {\n\n    public interface View extends UberView<DataSetAuthoringHomePresenter> {\n\n        void setDataSetCount(int n);\n    }\n\n    View view;\n    PlaceManager placeManager;\n    DataSetClientServices clientServices;\n    int dataSetCount = 0;\n\n    @Inject\n    public DataSetAuthoringHomePresenter(final View view,\n                                         final PlaceManager placeManager,\n                                         final DataSetClientServices clientServices) {\n        this.view = view;\n        this.placeManager = placeManager;\n        this.clientServices = clientServices;\n    }\n\n    @OnStartup\n    public void init() {\n        clientServices.getPublicDataSetDefs(dataSetDefs -> {\n            dataSetCount = dataSetDefs.size();\n            view.setDataSetCount(dataSetCount);\n        });\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return DataSetAuthoringConstants.INSTANCE.homeTitle();\n    }\n\n    @WorkbenchPartView\n    public UberView<DataSetAuthoringHomePresenter> getView() {\n        return view;\n    }\n\n    public void newDataSet() {\n        placeManager.goTo(\"DataSetDefWizard\");\n    }\n\n    public int getDataSetCount() {\n        return dataSetCount;\n    }\n\n    // Be aware of data set lifecycle events\n\n    void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {\n        PortablePreconditions.checkNotNull(\"DataSetDefRegisteredEvent\",\n                                           event);\n        view.setDataSetCount(++dataSetCount);\n    }\n\n    void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        PortablePreconditions.checkNotNull(\"DataSetDefRemovedEvent\",\n                                           event);\n        view.setDataSetCount(--dataSetCount);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetAuthoringHomeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.Hyperlink;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.editor.client.resources.i18n.DataSetAuthoringConstants;\n\n@Dependent\npublic class DataSetAuthoringHomeView extends Composite implements DataSetAuthoringHomePresenter.View {\n\n    interface DataSetEditorViewBinder extends UiBinder<Widget, DataSetAuthoringHomeView> {}\n    private static DataSetEditorViewBinder uiBinder = GWT.create(DataSetEditorViewBinder.class);\n\n    @UiField\n    HTMLPanel initialViewPanel;\n\n    @UiField\n    Hyperlink newDataSetLink;\n\n    @UiField\n    HTML dataSetCountText;\n\n    DataSetAuthoringHomePresenter presenter;\n\n    public DataSetAuthoringHomeView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(DataSetAuthoringHomePresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    public void setDataSetCount(int n) {\n        dataSetCountText.setText(DataSetAuthoringConstants.INSTANCE.dataSetCount(n));\n    }\n\n    @UiHandler(\"newDataSetLink\")\n    public void onNewDataSetClicked(ClickEvent event) {\n        presenter.newDataSet();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetAuthoringHomeView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.dataset.editor.client.resources.i18n.DataSetAuthoringConstants\"/>\n\n  <ui:style>\n\n    .initialViewPanel {\n      margin: 50px;\n    }\n\n    .dataSetCountLabel {\n      margin-bottom: 20px;\n    }\n\n    .defineA {\n      float: left;\n      margin-left: 25px;\n    }\n\n    .newDataSet {\n      float: left;\n      margin-right: 5px;\n      margin-left: 5px;\n      cursor: pointer;\n    }\n\n    .toFetchYourDataFromExtSystem {\n      margin-left: 5px;\n    }\n\n    .nextSteps {\n      margin: 5px;\n    }\n\n    .step {\n      margin: 5px;\n      margin-left: 25px;\n    }\n\n    .clear {\n      clear: both;\n    }\n\n  </ui:style>\n\n  <g:HTMLPanel ui:field=\"initialViewPanel\" addStyleNames=\"{style.initialViewPanel}\">\n\n    <g:HTML addStyleNames=\"{style.dataSetCountLabel}\" ui:field=\"dataSetCountText\"/>\n\n    <g:FlowPanel addStyleNames=\"{style.clear} \"/>\n\n    <g:HTML text=\"{i18n.nextSteps}:\" addStyleNames=\"{style.nextSteps} \"/>\n    <g:FlowPanel>\n      <g:FlowPanel>\n        <g:HTML text=\"{i18n.defineA} \" addStyleNames=\"{style.defineA} \"/>\n        <g:Hyperlink text=\"{i18n.newDataSet} \" ui:field=\"newDataSetLink\" addStyleNames=\"{style.newDataSet}\"/>\n        <g:HTML text=\"{i18n.toFetchYourDataFromExtSystem}\" addStyleNames=\"{style.toFetchYourDataFromExtSystem} \"/>\n      </g:FlowPanel>\n      <g:HTML text=\"{i18n.createDataDisplayers}\" addStyleNames=\"{style.step} \"/>\n      <g:HTML text=\"{i18n.createDashboards}\" addStyleNames=\"{style.step} \"/>\n    </g:FlowPanel>\n\n  </g:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefEditorPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflowFactory;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.DataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.backend.EditDataSetDef;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.editor.client.resources.i18n.DataSetAuthoringConstants;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.VALIDATE;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.ERROR;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n@Dependent\n@WorkbenchEditor(identifier = \"DataSetDefEditor\", supportedTypes = {DataSetDefType.class}, priority = Integer.MAX_VALUE)\npublic class DataSetDefEditorPresenter extends BaseEditor<DataSetDef, DefaultMetadata> {\n\n    @Inject\n    SyncBeanManager beanManager;\n    @Inject\n    DataSetEditorWorkflowFactory workflowFactory;\n    @Inject\n    Caller<DataSetDefVfsServices> services;\n    @Inject\n    PlaceManager placeManager;\n    @Inject\n    DataSetDefType resourceType;\n    @Inject\n    ErrorPopupPresenter errorPopupPresenter;\n    @Inject\n    SavePopUpPresenter savePopUpPresenter;\n\n    @Inject\n    public DataSetDefScreenView view;\n    DataSetEditWorkflow workflow;\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        super.baseView = view;\n        init(path,\n             place,\n             resourceType,\n             true,\n             false,\n             VALIDATE,\n             SAVE,\n             COPY,\n             DELETE);\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return buildTitle();\n    }\n\n    protected String buildTitle() {\n        if (getDataSetDef() == null) {\n            return DataSetAuthoringConstants.INSTANCE.editorTitleGeneric();\n        } else {\n            String type = getDataSetDef().getProvider().getName();\n            return DataSetAuthoringConstants.INSTANCE.editorTitle(getDataSetDef().getName(),\n                                                                  type);\n        }\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public Widget getWidget() {\n        return view.asWidget();\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        workflow.flush();\n        return super.mayClose(getCurrentModelHash());\n    }\n\n    @OnClose\n    public void onClose() {\n        disposeWorkflow();\n    }\n\n    @Override\n    protected void loadContent() {\n        try {\n            services.call(loadCallback,\n                          errorCallback).load(versionRecordManager.getCurrentPath());\n        } catch (final Exception e) {\n            // Edit only the definition, so user can fix the wrong attributes, if any.\n            loadDefinition();\n        }\n    }\n\n    private void loadDefinition() {\n        services.call(getDefinitionCallback,\n                      getDefinitionErrorCallback).get(versionRecordManager.getCurrentPath());\n    }\n\n    public DataSetDef getDataSetDef() {\n        return workflow != null ? workflow.getDataSetDef() : null;\n    }\n\n    private void testDataSet() {\n        assert workflow != null;\n        workflow.testDataSet(new DataSetEditorWorkflow.TestDataSetCallback() {\n            @Override\n            public void onSuccess(final DataSet dataSet) {\n                edit(dataSet);\n            }\n\n            @Override\n            public void onError(final ClientRuntimeError error) {\n                showError(error);\n            }\n        });\n    }\n\n    private void edit(final DataSetDef dataSetDef,\n                      final List<DataColumnDef> columnDefs) {\n        final DataSetProviderType type = dataSetDef.getProvider() != null ? dataSetDef.getProvider() : null;\n        workflow = workflowFactory.edit(type);\n        view.setWidget(workflow);\n        workflow.edit(dataSetDef, columnDefs).showPreviewTab();\n    }\n\n    private void edit(final DataSet dataset) {\n        if (dataset != null) {\n            final DataSetDef dataSetDef = workflow.getDataSetDef();\n            List<DataColumn> columns = dataset.getColumns();\n            if (columns != null && !columns.isEmpty()) {\n\n                // Obtain all data columns available from the resulting data set.\n                List<DataColumnDef> columnDefs = new ArrayList<>(columns.size());\n                for (final DataColumn column : columns) {\n                    columnDefs.add(new DataColumnDef(column.getId(),\n                                                     column.getColumnType()));\n                }\n\n                edit(dataSetDef,\n                     columnDefs);\n            } else {\n                showError(\"Data set has no columns\");\n            }\n        } else {\n            showError(\"Data set is empty.\");\n        }\n    }\n\n    @Override\n    protected void onValidate(final Command callFinished) {\n        workflow.flush();\n        if (!workflow.hasErrors()) {\n            notification.fire(new NotificationEvent(DataSetAuthoringConstants.INSTANCE.validationOk(),\n                                                    SUCCESS));\n        } else {\n            notification.fire(new NotificationEvent(DataSetAuthoringConstants.INSTANCE.validationFailed(),\n                                                    ERROR));\n        }\n        callFinished.execute();\n    }\n\n    @Override\n    protected void save() {\n        workflow.flush();\n        if (!workflow.hasErrors()) {\n            savePopUpPresenter.show(versionRecordManager.getCurrentPath(),\n                                    commitMessage -> {\n                                        final DataSetDef def = getDataSetDef();\n                                        services.call(new RemoteCallback<Path>() {\n                                                          @Override\n                                                          public void callback(final Path path) {\n                                                              DataSetDefEditorPresenter.this.getSaveSuccessCallback(getCurrentModelHash()).callback(path);\n                                                              placeManager.closePlace(DataSetDefEditorPresenter.this.place);\n                                                          }\n                                                      },\n                                                      errorCallback)\n                                                .save(def,\n                                                      commitMessage);\n                                    }\n            );\n            concurrentUpdateSessionInfo = null;\n        }\n    }\n\n    public int getCurrentModelHash() {\n        if (getDataSetDef() == null) {\n            return 0;\n        }\n        return getDataSetDef().hashCode();\n    }\n\n    public void disposeWorkflow() {\n        if (workflow != null) {\n            workflowFactory.dispose(workflow);\n        }\n    }\n\n    RemoteCallback<DataSetDef> getDefinitionCallback = result -> {\n        load(result,\n             result != null ? result.getColumns() : null);\n    };\n\n    RemoteCallback<EditDataSetDef> loadCallback = result -> {\n        load(result != null ? result.getDefinition() : null,\n             result != null ? result.getColumns() : null);\n    };\n\n    ErrorCallback<Message> errorCallback = (message, throwable) -> {\n        // Edit only the definition, so user can fix the wrong attributes, if any.\n        loadDefinition();\n        return false;\n    };\n\n    ErrorCallback<Message> getDefinitionErrorCallback = new ErrorCallback<Message>() {\n        @Override\n        public boolean error(Message message,\n                             Throwable throwable) {\n            view.hideBusyIndicator();\n            showError(new ClientRuntimeError(throwable));\n            return false;\n        }\n    };\n\n    protected void load(final DataSetDef dataSetDef,\n                        List<DataColumnDef> columns) {\n        if (dataSetDef == null) {\n            view.hideBusyIndicator();\n            showError(DataSetAuthoringConstants.INSTANCE.dataSetNotFound());\n        } else {\n            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place,\n                                                                    buildTitle()));\n            view.hideBusyIndicator();\n\n            edit(dataSetDef, columns);\n            setOriginalHash(getCurrentModelHash());\n        }\n    }\n\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return services;\n    }\n\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return services;\n    }\n\n    private void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        placeManager.closePlace(place);\n    }\n\n    void showError(final ClientRuntimeError error) {\n        final String message = error.getCause() != null ? error.getCause() : error.getMessage();\n        showError(message);\n    }\n\n    void showError(final String message) {\n        errorPopupPresenter.showMessage(message);\n    }\n\n    /*************************************************************\n     ** CDI EVENT HANDLING METHODS **\n     *************************************************************/\n\n    void onTestEvent(@Observes TestDataSetRequestEvent testDataSetRequestEvent) {\n        checkNotNull(\"testDataSetRequestEvent\",\n                     testDataSetRequestEvent);\n        if (testDataSetRequestEvent.getContext().equals(workflow)) {\n            if (!workflow.hasErrors()) {\n                testDataSet();\n            }\n        }\n    }\n\n    void onCancelEvent(@Observes CancelRequestEvent cancelEvent) {\n        checkNotNull(\"cancelEvent\",\n                     cancelEvent);\n        if (cancelEvent.getContext().equals(workflow)) {\n            workflow.clear();\n        }\n    }\n\n    void onErrorEvent(@Observes ErrorEvent errorEvent) {\n        checkNotNull(\"errorEvent\",\n                     errorEvent);\n        if (errorEvent.getClientRuntimeError() != null) {\n            showError(errorEvent.getClientRuntimeError());\n        } else if (errorEvent.getMessage() != null) {\n            showError(errorEvent.getMessage());\n        }\n    }\n\n    void onTabChangedEvent(@Observes TabChangedEvent tabChangedEvent) {\n        checkNotNull(\"tabChangedEvent\",\n                     tabChangedEvent);\n        if (tabChangedEvent.getContext().equals(workflow.getEditor())) {\n            workflow.clearButtons();\n            String tabId = tabChangedEvent.getTabId();\n            if (tabId != null && DataSetEditor.TAB_CONFIGURATION.equals(tabId)) {\n                workflow.showTestButton();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefExplorerScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.widgets.dataset.event.EditDataSetEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.explorer.DataSetExplorer;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * @since 0.3.0\n */\n@WorkbenchScreen(identifier = \"DataSetDefExplorer\")\n@Dependent\npublic class DataSetDefExplorerScreen {\n\n    private Menus menu = null;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    Caller<DataSetDefVfsServices> services;\n\n    @Inject\n    Event<NotificationEvent> notification;\n\n    @Inject\n    DataSetExplorer explorerWidget;\n\n    @Inject\n    ErrorPopupPresenter errorPopupPresenter;\n\n    @OnStartup\n    public void onStartup(PlaceRequest placeRequest) {\n        this.menu = makeMenuBar();\n        explorerWidget.show();\n    }\n\n    @OnClose\n    public void onClose() {\n\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return DataSetExplorerConstants.INSTANCE.title();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return explorerWidget;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menu);\n    }\n\n    private Menus makeMenuBar() {\n        return MenuFactory\n                .newTopLevelMenu(DataSetExplorerConstants.INSTANCE.newDataSet())\n                .respondsWith(this::newDataSet)\n                .endMenu()\n                .build();\n    }\n\n    void newDataSet() {\n        placeManager.tryClosePlace(new DefaultPlaceRequest(\"DataSetDefWizard\"), () -> {\n            placeManager.goTo(\"DataSetDefWizard\");\n        });\n    }\n\n    private void showError(final ClientRuntimeError error) {\n        final String message = error.getCause() != null ? error.getCause() : error.getMessage();\n        showError(message);\n    }\n\n    private void showError(final String message) {\n        errorPopupPresenter.showMessage(message);\n    }\n\n    void onEditDataSetEvent(@Observes EditDataSetEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        services.call(new RemoteCallback<Path>() {\n            public void callback(Path path) {\n                placeManager.goTo(new PathPlaceRequest(path));\n            }\n        }).resolve(event.getDef());\n    }\n\n    void onErrorEvent(@Observes ErrorEvent errorEvent) {\n        checkNotNull(\"errorEvent\",\n                     errorEvent);\n        if (errorEvent.getClientRuntimeError() != null) {\n            showError(errorEvent.getClientRuntimeError());\n        } else if (errorEvent.getMessage() != null) {\n            showError(errorEvent.getMessage());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefScreenView.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\n\npublic interface DataSetDefScreenView extends BaseEditorView, IsWidget {\n    void setWidget(IsWidget widget);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefScreenViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;\n\nimport javax.enterprise.context.Dependent;\n\n@Dependent\npublic class DataSetDefScreenViewImpl extends BaseEditorViewImpl implements DataSetDefScreenView {\n\n    final FlowPanel mainPanel = new FlowPanel();\n\n    public DataSetDefScreenViewImpl() {\n    }\n\n    \n    @Override\n    public Widget asWidget() {\n        return mainPanel;\n    }\n\n\n    @Override\n    public void setWidget(final IsWidget widget) {\n        mainPanel.clear();\n        mainPanel.add(widget);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class DataSetDefType implements ClientResourceType {\n\n    private Category category;\n\n    public DataSetDefType() {\n    }\n\n    @Inject\n    public DataSetDefType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"dataset\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Data set\";\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"dset\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.dset\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(getSuffix());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefWizardScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.editor.client.screens;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflowFactory;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetProviderTypeWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.DataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.*;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.editor.client.resources.i18n.DataSetAuthoringConstants;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@WorkbenchScreen(identifier = \"DataSetDefWizard\")\n@Dependent\npublic class DataSetDefWizardScreen {\n\n    SyncBeanManager beanManager;\n    DataSetEditorWorkflowFactory workflowFactory;\n    Caller<DataSetDefVfsServices> services;\n    DataSetClientServices clientServices;\n    Event<NotificationEvent> notification;\n    PlaceManager placeManager;\n    ErrorPopupPresenter errorPopupPresenter;\n    public DataSetDefScreenView view;\n\n    PlaceRequest placeRequest;\n    Command nextCommand;\n    Integer originalHash = 0;\n    DataSetEditorWorkflow currentWorkflow;\n    SavePopUpPresenter savePopUpPresenter;\n\n    @Inject\n    public DataSetDefWizardScreen(final SyncBeanManager beanManager,\n                                  final DataSetEditorWorkflowFactory workflowFactory,\n                                  final Caller<DataSetDefVfsServices> services,\n                                  final DataSetClientServices clientServices,\n                                  final Event<NotificationEvent> notification,\n                                  final PlaceManager placeManager,\n                                  final ErrorPopupPresenter errorPopupPresenter,\n                                  final SavePopUpPresenter savePopUpPresenter,\n                                  final DataSetDefScreenView view) {\n        this.beanManager = beanManager;\n        this.workflowFactory = workflowFactory;\n        this.services = services;\n        this.clientServices = clientServices;\n        this.notification = notification;\n        this.placeManager = placeManager;\n        this.errorPopupPresenter = errorPopupPresenter;\n        this.savePopUpPresenter = savePopUpPresenter;\n        this.view = view;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return DataSetAuthoringConstants.INSTANCE.creationWizardTitle();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return view;\n    }\n\n    @OnStartup\n    public void init(PlaceRequest placeRequest) {\n        this.placeRequest = placeRequest;\n        providerTypeEdition();\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return mayClose();\n    }\n\n    @OnClose\n    public void onClose() {\n        disposeCurrentWorkflow();\n    }\n\n    public void setOriginalHash(Integer originalHash) {\n        this.originalHash = originalHash;\n    }\n\n    public int getCurrentModelHash() {\n        if (getDataSetDef() == null) {\n            return 0;\n        }\n        return getDataSetDef().hashCode();\n    }\n\n    public DataSetDef getDataSetDef() {\n        return currentWorkflow != null ? currentWorkflow.getDataSetDef() : null;\n    }\n\n    public boolean mayClose() {\n        try {\n            // Flush the current workflow state\n            if (currentWorkflow != null) {\n                currentWorkflow.flush();\n            }\n        } catch (Exception e) {\n            // Ignore. The provider type selection workflow stage throws an error\n            // due to the dataset def being in partial creation state.\n        }\n        Integer currentHash = getCurrentModelHash();\n        if (isDirty(currentHash)) {\n            return view.confirmClose();\n        } else {\n            return true;\n        }\n    }\n\n    public boolean isDirty(Integer currentHash) {\n        if (originalHash == null) {\n            return currentHash != null;\n        } else {\n            return !originalHash.equals(currentHash);\n        }\n    }\n\n    private void providerTypeEdition() {\n        final DataSetDef dataSetDef = new DataSetDef();\n        final DataSetProviderTypeWorkflow providerTypeWorkflow = workflowFactory.providerType();\n        this.nextCommand = () -> onProviderTypeSelected(providerTypeWorkflow);\n\n        // First step, provider type selection.\n        providerTypeWorkflow.edit(dataSetDef).providerTypeEdition();\n        setCurrentWorkflow(providerTypeWorkflow);\n        setOriginalHash(getCurrentModelHash());\n    }\n\n    void onProviderTypeSelected(final DataSetProviderTypeWorkflow providerTypeWorkflow) {\n        final DataSetProviderType selectedProviderType = providerTypeWorkflow.getProviderType();\n        try {\n            clientServices.newDataSet(selectedProviderType,\n                                      this::basicAttributesEdition);\n        } catch (final Exception e) {\n            showError(e.getCause() != null ? e.getCause().getMessage() : e.getMessage());\n        }\n    }\n\n    private void setCurrentWorkflow(final DataSetEditorWorkflow w) {\n        this.currentWorkflow = w;\n        view.setWidget(w);\n    }\n\n    private void disposeCurrentWorkflow() {\n        if (this.currentWorkflow != null) {\n            workflowFactory.dispose(this.currentWorkflow);\n            this.currentWorkflow = null;\n        }\n    }\n\n    private void basicAttributesEdition(final DataSetDef typedDataSetDef) {\n        final DataSetProviderType type = typedDataSetDef.getProvider() != null ? typedDataSetDef.getProvider() : null;\n        final DataSetBasicAttributesWorkflow basicAttributesWorkflow = workflowFactory.basicAttributes(type);\n        basicAttributesWorkflow.edit(typedDataSetDef).basicAttributesEdition().showBackButton().showTestButton();\n        setCurrentWorkflow(basicAttributesWorkflow);\n        setOriginalHash(getCurrentModelHash());\n    }\n\n    private void testDataSet() {\n        assert currentWorkflow != null;\n        currentWorkflow.testDataSet(new DataSetEditorWorkflow.TestDataSetCallback() {\n            @Override\n            public void onSuccess(final DataSet dataSet) {\n                completeEdition(currentWorkflow.getDataSetDef(),\n                                dataSet);\n            }\n\n            @Override\n            public void onError(final ClientRuntimeError error) {\n                showError(error);\n            }\n        });\n    }\n\n    public void completeEdition(final DataSetDef dataSetDef,\n                                final DataSet dataset) {\n        if (dataset != null) {\n            this.nextCommand = this::save;\n            List<DataColumn> columns = dataset.getColumns();\n            if (columns != null && !columns.isEmpty()) {\n\n                // Obtain all data columns available from the resulting data set.\n                List<DataColumnDef> columnDefs = new ArrayList<>(columns.size());\n                for (final DataColumn column : columns) {\n                    columnDefs.add(new DataColumnDef(column.getId(),\n                                                     column.getColumnType()));\n                }\n\n                // Delegate edition to the dataSetEditWorkflow.\n                final DataSetProviderType type = dataSetDef.getProvider() != null ? dataSetDef.getProvider() : null;\n                final DataSetEditWorkflow editWorkflow = workflowFactory.edit(type);\n                editWorkflow.edit(dataSetDef,\n                                  columnDefs)\n                        .showPreviewTab()\n                        .showBackButton()\n                        .showNextButton();\n\n                setCurrentWorkflow(editWorkflow);\n            } else {\n                showError(\"Data set has no columns\");\n            }\n        } else {\n            showError(\"Data set is empty.\");\n        }\n    }\n\n    protected void save() {\n        final DataSetDef dataSetDef = currentWorkflow.getDataSetDef();\n        savePopUpPresenter.show(message -> onSave(dataSetDef,\n                                                  message));\n    }\n\n    void onSave(final DataSetDef dataSetDef,\n                final String message) {\n        BusyPopup.showMessage(DataSetAuthoringConstants.INSTANCE.saving());\n        services.call(saveSuccessCallback,\n                      errorCallback).save(dataSetDef,\n                                          message);\n        placeManager.goTo(\"DataSetAuthoringHome\");\n    }\n\n    RemoteCallback<Path> saveSuccessCallback = new RemoteCallback<Path>() {\n        @Override\n        public void callback(Path path) {\n            disposeCurrentWorkflow();\n            BusyPopup.close();\n            setOriginalHash(0);\n            notification.fire(new NotificationEvent(DataSetAuthoringConstants.INSTANCE.savedOk()));\n            placeManager.closePlace(placeRequest);\n        }\n    };\n\n    ErrorCallback<Message> errorCallback = (message, throwable) -> {\n        BusyPopup.close();\n        showError(new ClientRuntimeError(throwable));\n        return false;\n    };\n\n    void showError(final ClientRuntimeError error) {\n        final String message = error.getCause() != null ? error.getCause() : error.getMessage();\n        showError(message);\n    }\n\n    void showError(final String message) {\n        errorPopupPresenter.showMessage(message);\n    }\n\n    /*************************************************************\n     ** CDI EVENT HANDLING METHODS **\n     *************************************************************/\n\n    void onTestEvent(@Observes TestDataSetRequestEvent testDataSetRequestEvent) {\n        checkNotNull(\"testDataSetRequestEvent\",\n                     testDataSetRequestEvent);\n        if (testDataSetRequestEvent.getContext().equals(currentWorkflow)) {\n            if (!currentWorkflow.hasErrors()) {\n                testDataSet();\n            }\n        }\n    }\n\n    void onSaveEvent(@Observes SaveRequestEvent saveEvent) {\n        checkNotNull(\"saveEvent\",\n                     saveEvent);\n        if (saveEvent.getContext().equals(currentWorkflow)) {\n            if (this.nextCommand != null && !currentWorkflow.hasErrors()) {\n                this.nextCommand.execute();\n            }\n        }\n    }\n\n    void onCancelEvent(@Observes CancelRequestEvent cancelEvent) {\n        checkNotNull(\"cancelEvent\",\n                     cancelEvent);\n        if (cancelEvent.getContext().equals(currentWorkflow) && mayClose()) {\n            providerTypeEdition();\n        }\n    }\n\n    void onErrorEvent(@Observes ErrorEvent errorEvent) {\n        checkNotNull(\"errorEvent\",\n                     errorEvent);\n        if (errorEvent.getClientRuntimeError() != null) {\n            showError(errorEvent.getClientRuntimeError());\n        } else if (errorEvent.getMessage() != null) {\n            showError(errorEvent.getMessage());\n        }\n    }\n\n    void onTabChangedEvent(@Observes TabChangedEvent tabChangedEvent) {\n        checkNotNull(\"tabChangedEvent\",\n                     tabChangedEvent);\n        try {\n            // This event should only be fired when worklow is an instance of the DataSetEditWorkflow, as it uses the main tabbed editor. \n            if (tabChangedEvent.getContext().equals(((DataSetEditWorkflow) currentWorkflow).getEditor())) {\n                currentWorkflow.clearButtons();\n                String tabId = tabChangedEvent.getTabId();\n                if (tabId != null && DataSetEditor.TAB_CONFIGURATION.equals(tabId)) {\n                    currentWorkflow.showTestButton();\n                } else {\n                    currentWorkflow.showBackButton().showNextButton();\n                }\n            }\n        } catch (final ClassCastException e) {\n            // Skip event.\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.dataset.editor.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/DataSetEditor.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n\n  <inherits name=\"org.dashbuilder.CommonWidgets\"/>\n  <inherits name=\"org.dashbuilder.ServicesAPI\"/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n\n  <source path='dataset'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants.properties",
    "content": "homeTitle=Data Set Authoring Home\ncreationWizardTitle=Data Set Creation Wizard\ndataSetCount=There are {0} data sets available\nnextSteps=Next steps\ndefineA=1. Define a\nnewDataSet=new data set\ntoFetchYourDataFromExtSystem=to fetch your data from an external storage system\ncreateDataDisplayers=2. Create displayers to visualize data from your newly created data sets\ncreateDashboards=3. Create new dashboards to organize and coordinate your displayers\neditorTitleGeneric=Data Set Editor\neditorTitle=Data Set Editor [{0} ({1})]\nvalidationOk=Data set definition is OK\nvalidationFailed=Data set definition has errors\ndataSetNotFound=Data set definition not found\nsaving=Saving...\nsavedOk=Data set definition saved successfully\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_de.properties",
    "content": "homeTitle=Datensatz-Authoring Home\ncreationWizardTitle=Assistent zum Anlegen von Datensätzen\ndataSetCount=Es sind {0} Datensätze verfügbar\nnextSteps=Die nächsten Schritte\ndefineA=1. Definieren eines\nnewDataSet=neuen Datensätze\ntoFetchYourDataFromExtSystem=zum Abruf von Daten von einem externen Speichersystem\ncreateDataDisplayers=2. Erstellen von Displayern zur Visualisierung neu angelegter Datensätze\ncreateDashboards=3. Erstellen neuer Dashboards zur Organisation und Koordination Ihrer Displayer\neditorTitleGeneric=Datensatz-Editor\neditorTitle=Datensatz-Editor [{0} ({1})]\nvalidationOk=Datensatz-Definition ist OK\nvalidationFailed=Datensatz-Definition hat Fehler\ndataSetNotFound=Datensatz-Definition nicht gefunden\nsaving=Speichern ...\nsavedOk=Datensatz-Definition erfolgreich gespeichert\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_es.properties",
    "content": "homeTitle=Inicio de la autoría de conjuntos de datos\ncreationWizardTitle=Asistente de creación de conjuntos de datos\ndataSetCount=Hay {0} conjuntos de datos disponibles\nnextSteps=Próximos pasos\ndefineA=1. Definir un\nnewDataSet=nuevo conjunto de datos\ntoFetchYourDataFromExtSystem=para obtener sus datos de un sistema de almacenamiento externo\ncreateDataDisplayers=2. Crear visualizadores para ver los datos de los conjuntos de datos creados recientemente\ncreateDashboards=3. Crear nuevos cuadros de mando para organizar y coordinar sus visualizadores\neditorTitleGeneric=Editor de conjuntos de datos\neditorTitle=Editor de conjuntos de datos [{0} ({1})]\nvalidationOk=La definición del conjunto de datos es correcta\nvalidationFailed=La definición del conjunto de datos tiene errores\ndataSetNotFound=No se encuentra la definición del conjunto de datos\nsaving=Guardando…\nsavedOk=La definición del conjunto de datos se guardó correctamente\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_fr.properties",
    "content": "homeTitle=Page d''accueil de création d''ensembles de données\ncreationWizardTitle=Assistant de création d''ensembles de données\ndataSetCount={0} ensembles de données sont disponibles\nnextSteps=Étapes suivantes\ndefineA=1. Définir un\nnewDataSet=nouvel ensemble de données\ntoFetchYourDataFromExtSystem=pour extraire vos données d''un système de stockage externe\ncreateDataDisplayers=2. Créer des afficheurs pour visualiser les données de vos nouveaux ensembles de données\ncreateDashboards=3. Créer des tableaux de bord pour organiser et coordonner vos afficheurs\neditorTitleGeneric=Éditeur d''ensembles de données\neditorTitle=Éditeur d''ensembles de données [{0} ({1})]\nvalidationOk=La définition de l''ensemble de données est correcte\nvalidationFailed=La définition de l''ensemble de données comporte des erreurs\ndataSetNotFound=La définition de l''ensemble de données est introuvable\nsaving=Enregistrement…\nsavedOk=La définition de l''ensemble de données a été enregistrée\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_it.properties",
    "content": "homeTitle=Pagina principale dell''autore del set di dati\ncreationWizardTitle=Wizard di creazione del set di dati\ndataSetCount=Sono disponibili {0} set di dati\nnextSteps=Passaggi successivi\ndefineA=1. Definisci un\nnewDataSet=nuevo set di dati\ntoFetchYourDataFromExtSystem=per recuperare i tuoi dati da un sistema di archiviazione esterno\ncreateDataDisplayers=2. Crea display per visualizzare i dati dei tuoi nuovi set di dati\ncreateDashboards=3. Crea nuovi dashboard per organizzare e coordinare i tuoi display\neditorTitleGeneric=Editor del set di dati\neditorTitle=Editor del set di dati [{0} ({1})]\nvalidationOk=La definizione del set di dati è corretta\nvalidationFailed=La definizione del set di dati contiene errori\ndataSetNotFound=Definizione del set di dati non trovata\nsaving=Salvataggio...\nsavedOk=Definizione del set di dati salvata con successo\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_ja.properties",
    "content": "homeTitle=データセットオーサリングホーム\ncreationWizardTitle=データセット作成ウィザード\ndataSetCount={0} データセットが利用可能です\nnextSteps=次のステップ\ndefineA=1.外部ストレージシステムからデータを取得するため\nnewDataSet=新しいデータセット\ntoFetchYourDataFromExtSystem=を定義する\ncreateDataDisplayers=2.新しく作成したデータセットからデータを視覚化するためにディスプレイヤーを作成します\ncreateDashboards=3.ディスプレイヤーを整理および管理するために新しいダッシュボードを作成します\neditorTitleGeneric=データセットエディター\neditorTitle=データセットエディター [{0} ({1})]\nvalidationOk=データセット定義は OK です\nvalidationFailed=データセット定義にエラーがあります\ndataSetNotFound=データセット定義が見つかりません\nsaving=保存中...\nsavedOk=データセット定義が正常に保存されました\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_pt_BR.properties",
    "content": "homeTitle=Página Principal da Autoría do Data Set \ncreationWizardTitle=Assistente de Criação do Data Set\ndataSetCount=Existem  {0} data sets disponíveis\nnextSteps=Próximos passos\ndefineA=1. Define um(a)\nnewDataSet=novo data set\ntoFetchYourDataFromExtSystem=para buscar seus dados de um sistema de armazenamento externo\ncreateDataDisplayers=2. Cria exibidores para visualizar os dados de seus conjuntos de dados recentemente criados\ncreateDashboards=3. Cria novos painéis para organizar e coordenar seus exibidores\neditorTitleGeneric=Editor de Data Set\neditorTitle=Editor de Data Set  [{0} ({1})]\nvalidationOk=Definição de Data Set é OK\nvalidationFailed=Definição de data set possui erros\ndataSetNotFound=Definição de Data set não foi encontrada\nsaving=Salvando...\nsavedOk=Definição de data set salva com sucesso\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/main/resources/org/dashbuilder/dataset/editor/client/resources/i18n/DataSetAuthoringConstants_zh_CN.properties",
    "content": "homeTitle=数据集编辑主页\ncreationWizardTitle=数据集创建向导\ndataSetCount=有 {0} 个可用的数据集\nnextSteps=后续的步骤\ndefineA=1. 定义\nnewDataSet=新的数据集\ntoFetchYourDataFromExtSystem=以从外部存储系统获取数据\ncreateDataDisplayers=2. 创建显示屏显示新创建的数据集中的数据\ncreateDashboards=3. 创建仪表板组织和协调您的数据显示屏\neditorTitleGeneric=数据集编辑器\neditorTitle=数据集编辑器 [{0} ({1})]\nvalidationOk=数据集定义正常\nvalidationFailed=数据集定义有错误\ndataSetNotFound=未找到数据集定义\nsaving=正在保存...\nsavedOk=数据集定义已成功保存\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/test/java/org/dashbuilder/dataset/editor/client/screens/DataSetAuthoringHomePresenterTest.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\n\nimport java.util.List;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetAuthoringHomePresenterTest {\n    \n    @Mock DataSetAuthoringHomePresenter.View view;\n    @Mock PlaceManager placeManager;\n    @Mock DataSetClientServices dataSetClientServices;\n    \n    private DataSetAuthoringHomePresenter presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        final List<DataSetDef> dataSetDefList = mock(List.class);\n        when(dataSetDefList.size()).thenReturn(5);\n        \n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                RemoteCallback<List<DataSetDef>> callback = (RemoteCallback<List<DataSetDef>>) invocationOnMock.getArguments()[0];\n                callback.callback(dataSetDefList);\n                return null;\n            }\n        }).when(dataSetClientServices).getPublicDataSetDefs(any(RemoteCallback.class));\n        \n        // The presenter instance to test.\n        presenter = new DataSetAuthoringHomePresenter(view, placeManager, dataSetClientServices);\n\n    }\n    \n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).setDataSetCount(5);\n    }\n\n    @Test\n    public void testGetView() {\n        final UberView<DataSetAuthoringHomePresenter> view = presenter.getView();\n        assertEquals(this.view, view);\n    }\n\n    @Test\n    public void testNewDataSet() {\n        presenter.newDataSet();\n        verify(placeManager, times(1)).goTo(\"DataSetDefWizard\");\n    }\n\n    @Test\n    public void testDataSetRegistered() {\n        int count = presenter.getDataSetCount();\n        presenter.onDataSetDefRegisteredEvent(new DataSetDefRegisteredEvent(null));\n        assertEquals(presenter.getDataSetCount(), count+1);\n        verify(view).setDataSetCount(count+1);\n    }\n\n    @Test\n    public void testDataSetRemoved() {\n        int count = presenter.getDataSetCount();\n        presenter.onDataSetDefRemovedEvent(new DataSetDefRemovedEvent(null));\n        assertEquals(presenter.getDataSetCount(), count-1);\n        verify(view).setDataSetCount(count-1);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/test/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefEditorPresenterTest.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflowFactory;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.DataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.backend.EditDataSetDef;\nimport org.dashbuilder.dataset.client.editor.DataSetDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.BasicFileMenuBuilder;\nimport org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n/**\n * @since 0.4.0\n */\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefEditorPresenterTest {\n\n    @Mock\n    EventSourceMock<ChangeTitleWidgetEvent> changeTitleNotification;\n    @Mock\n    EventSourceMock<NotificationEvent> notification;\n    @Mock\n    VersionRecordManager versionRecordManager;\n    @Mock\n    BasicFileMenuBuilder menuBuilder;\n    @Mock\n    DefaultFileNameValidator fileNameValidator;\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    PlaceRequest placeRequest;\n    @Mock\n    ObservablePath observablePath;\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    DataSetEditorWorkflowFactory workflowFactory;\n    @Mock\n    DataSetDefType resourceType;\n    @Mock\n    ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    DataSetDefVfsServices dataSetDefVfsServices;\n    @Mock\n    DataSetDef dataSetDef;\n    @Mock\n    DataSetDefEditor dataSetDefEditor;\n    @Mock\n    DataSetDefScreenView view;\n    Caller<DataSetDefVfsServices> services;\n\n    @InjectMocks\n    private DataSetDefEditorPresenter presenter;\n\n    final List<DataColumnDef> columns = mock(List.class);\n    final DataSetEditWorkflow editWorkflow = mock(DataSetEditWorkflow.class);\n\n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        when(dataSetDef.getColumns()).thenReturn(columns);\n        services = new CallerMock<>(dataSetDefVfsServices);\n        presenter.services = services;\n        presenter.workflow = editWorkflow;\n        final EditDataSetDef editDataSetDef = mock(EditDataSetDef.class);\n        when(editDataSetDef.getDefinition()).thenReturn(dataSetDef);\n        when(editDataSetDef.getColumns()).thenReturn(columns);\n        when(dataSetDefVfsServices.load(any())).thenReturn(editDataSetDef);\n        when(dataSetDefVfsServices.get(any())).thenReturn(dataSetDef);\n        when(workflowFactory.edit(any())).thenReturn(editWorkflow);\n        when(editWorkflow.getDataSetDef()).thenReturn(dataSetDef);\n        when(editWorkflow.getEditor()).thenReturn(dataSetDefEditor);\n        when(editWorkflow.edit(any(), any())).thenReturn(editWorkflow);\n        assertEquals(view.asWidget(), presenter.getWidget());\n    }\n\n    @Test\n    public void testOnMayClose() {\n        presenter.loadContent();\n        when(editWorkflow.getDataSetDef()).thenReturn(mock(DataSetDef.class));\n        presenter.onMayClose();\n        verify(view).confirmClose();\n        assertTrue(presenter.isDirty(presenter.getCurrentModelHash()));\n    }\n\n    @Test\n    public void testOnClose() throws Exception {\n        presenter.onClose();\n\n        verify(workflowFactory).dispose(editWorkflow);\n    }\n\n    @Test\n    public void testLoadContent() throws Exception {\n        presenter.loadContent();\n        assertFalse(presenter.isDirty(presenter.getCurrentModelHash()));\n        verify(dataSetDefVfsServices, times(1)).load(any());\n        verify(changeTitleNotification, times(1)).fire(any(ChangeTitleWidgetEvent.class));\n        verify(view, times(1)).hideBusyIndicator();\n        verify(view, times(1)).setWidget(editWorkflow);\n        verify(editWorkflow, times(1)).edit(dataSetDef, columns);\n        verify(editWorkflow, times(1)).showPreviewTab();\n    }\n\n    @Test\n    public void testLoadContentNullified() throws Exception {\n        when(dataSetDefVfsServices.load(any())).thenReturn(null);\n        presenter.loadContent();\n        verify(dataSetDefVfsServices, times(1)).load(any());\n        verify(errorPopupPresenter, times(1)).showMessage(any());\n        verify(view, times(1)).hideBusyIndicator();\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testLoadDefinition() throws Exception {\n        final Exception loadContentException = mock(Exception.class);\n        doThrow(loadContentException).when(dataSetDefVfsServices).load(any());\n        presenter.loadContent();\n        assertFalse(presenter.isDirty(presenter.getCurrentModelHash()));\n        verify(dataSetDefVfsServices, times(1)).get(any());\n        verify(view, times(1)).hideBusyIndicator();\n        verify(view, times(1)).setWidget(editWorkflow);\n        verify(editWorkflow, times(1)).edit(dataSetDef, columns);\n        verify(editWorkflow, times(1)).showPreviewTab();\n    }\n\n    @Test\n    public void testGetDataSetDef() {\n        assertEquals(dataSetDef, presenter.getDataSetDef());\n    }\n\n    @Test\n    public void testGetDataSetDefNullified() {\n        when(editWorkflow.getDataSetDef()).thenReturn(null);\n        DataSetDef d = presenter.getDataSetDef();\n        assertNull(d);\n    }\n\n    @Test\n    public void testOnTestEvent() {\n        TestDataSetRequestEvent event = mock(TestDataSetRequestEvent.class);\n        when(event.getContext()).thenReturn(editWorkflow);\n        when(editWorkflow.hasErrors()).thenReturn(false);\n        presenter.onTestEvent(event);\n        verify(editWorkflow, times(1)).testDataSet(any(DataSetEditorWorkflow.TestDataSetCallback.class));\n    }\n\n    @Test\n    public void testOnTestEventWithErrors() {\n        TestDataSetRequestEvent event = mock(TestDataSetRequestEvent.class);\n        when(event.getContext()).thenReturn(editWorkflow);\n        when(editWorkflow.hasErrors()).thenReturn(true);\n        presenter.onTestEvent(event);\n        verify(editWorkflow, times(0)).testDataSet(any(DataSetEditorWorkflow.TestDataSetCallback.class));\n    }\n\n    @Test\n    public void testOnValidateSuccess() {\n        when(editWorkflow.hasErrors()).thenReturn(false);\n        presenter.getValidateCommand().execute();\n        verify(editWorkflow, times(1)).flush();\n        final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class);\n        verify(notification, times(1)).fire(dataCaptor.capture());\n        NotificationEvent ne = dataCaptor.getValue();\n        assertNotNull(ne);\n        assertEquals(NotificationEvent.NotificationType.SUCCESS, ne.getType());\n    }\n\n    @Test\n    public void validateCallbackIsCalled() throws Exception {\n        final Command command = mock(Command.class);\n        presenter.onValidate(command);\n        verify(command).execute();\n    }\n\n    @Test\n    public void testOnValidateFailed() {\n        when(editWorkflow.hasErrors()).thenReturn(true);\n        presenter.getValidateCommand().execute();\n        verify(editWorkflow, times(1)).flush();\n        final ArgumentCaptor<NotificationEvent> dataCaptor = ArgumentCaptor.forClass(NotificationEvent.class);\n        verify(notification, times(1)).fire(dataCaptor.capture());\n        NotificationEvent ne = dataCaptor.getValue();\n        assertNotNull(ne);\n        assertEquals(NotificationEvent.NotificationType.ERROR, ne.getType());\n    }\n\n    // TODO: @Test - Do it when SaveOperationService refactored.\n    public void testOnSave() {\n        presenter.save();\n    }\n\n    @Test\n    public void testShowError() {\n        final ClientRuntimeError error = mock(ClientRuntimeError.class);\n        when(error.getCause()).thenReturn(\"errorCause\");\n        presenter.showError(error);\n        verify(errorPopupPresenter, times(1)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n        verify(editWorkflow, times(0)).clear();\n        verify(editWorkflow, times(0)).clearButtons();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n    }\n\n    @Test\n    public void testOnCancelEvent() {\n        CancelRequestEvent event = mock(CancelRequestEvent.class);\n        when(event.getContext()).thenReturn(editWorkflow);\n        presenter.onCancelEvent(event);\n        verify(editWorkflow, times(1)).clear();\n        verify(editWorkflow, times(0)).clearButtons();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnErrorEvent() {\n        ErrorEvent event = mock(ErrorEvent.class);\n        when(event.getClientRuntimeError()).thenReturn(null);\n        when(event.getMessage()).thenReturn(\"errorMessage\");\n        presenter.onErrorEvent(event);\n        verify(editWorkflow, times(0)).clear();\n        verify(editWorkflow, times(0)).clearButtons();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(1)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_ConfigurationTab() {\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_CONFIGURATION);\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(1)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_PreviewTab() {\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_PREVIEW);\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_AdvancedTab() {\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_ADVANCED);\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(DataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/test/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefExplorerScreenTest.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.event.EditDataSetEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.explorer.DataSetExplorer;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefExplorerScreenTest {\n\n    @Mock PlaceRequest placeRequest;\n    @Mock PlaceManager placeManager;\n    @Mock EventSourceMock<NotificationEvent> notification;\n    @Mock ErrorPopupPresenter errorPopupPresenter;\n    @Mock DataSetExplorer explorerWidget;\n    @Mock DataSetDefVfsServices dataSetDefVfsServices;\n    @Mock Caller<DataSetDefVfsServices> services;\n    \n    @InjectMocks\n    DataSetDefExplorerScreen presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        presenter.services = services;\n        assertEquals(explorerWidget, presenter.getView());\n\n        doAnswer(invocationOnMock -> {\n            Command callback = (Command ) invocationOnMock.getArguments()[1];\n            callback.execute();\n            return null;\n        }).when(placeManager).tryClosePlace(any(), any());\n\n        doAnswer(invocationOnMock -> {\n            RemoteCallback callback = (RemoteCallback) invocationOnMock.getArguments()[0];\n            callback.callback(mock(Path.class));\n            return null;\n        }).when(services).call(any(RemoteCallback.class));\n    }\n    \n    @Test\n    public void testNewDataSet() {\n        presenter.newDataSet();\n        verify(placeManager).tryClosePlace(eq(new DefaultPlaceRequest(\"DataSetDefWizard\")), any(Command.class));\n        verify(placeManager).goTo(\"DataSetDefWizard\");\n    }\n    \n    // Cannot mock constructor for PathPlaceRequest, but having the classcast exception when mocking it implies that placeManager#goTo is called....\n    @Test(expected = ClassCastException.class)\n    public void testOnEditDataSetEvent() {\n        final DataSetDef def = mock(DataSetDef.class);\n        final EditDataSetEvent editDataSetEvent = mock(EditDataSetEvent.class);\n        when(editDataSetEvent.getDef()).thenReturn(def);\n        presenter.onEditDataSetEvent(editDataSetEvent);\n        verify(placeManager, times(1)).goTo(any(PathPlaceRequest.class));\n    }\n\n    @Test\n    public void testOnErrorEvent() {\n        final ErrorEvent errorDataSetEvent = mock(ErrorEvent.class);\n        when(errorDataSetEvent.getMessage()).thenReturn(\"errorMessage\");\n        presenter.onErrorEvent(errorDataSetEvent);\n        verify(errorPopupPresenter, times(1)).showMessage(\"errorMessage\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/test/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefTypeTest.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Others;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class DataSetDefTypeTest {\n\n    private DataSetDefType tested;\n\n    @Before\n    public void setup() {\n        tested = new DataSetDefType(new Others());\n    }\n\n    @Test\n    public void testIt() {\n        assertEquals(\"dataset\", tested.getShortName());\n        assertEquals(\"Data set\", tested.getDescription());\n        assertEquals(null, tested.getIcon());\n        assertEquals(\"\", tested.getPrefix());\n        assertEquals(\"dset\", tested.getSuffix());\n        assertEquals(0, tested.getPriority());\n        assertEquals(\"*.dset\", tested.getSimpleWildcardPattern());\n        final Path path = mock(Path.class);\n        when(path.getFileName()).thenReturn(\"fff.dset\");\n        assertEquals(true, tested.accept(path));\n        final Path path2 = mock(Path.class);\n        when(path2.getFileName()).thenReturn(\"fff.mock\");\n        assertEquals(false, tested.accept(path2));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-dataset-editor/src/test/java/org/dashbuilder/dataset/editor/client/screens/DataSetDefWizardScreenTest.java",
    "content": "package org.dashbuilder.dataset.editor.client.screens;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflowFactory;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetProviderTypeWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.SQLDataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefFactory;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.service.DataSetDefVfsServices;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.jgroups.util.Util.*;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.*;\n\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefWizardScreenTest {\n\n    @Mock EventSourceMock<NotificationEvent> notification;\n    @Mock PlaceManager placeManager;\n    @Mock SyncBeanManager beanManager;\n    @Mock DataSetEditorWorkflowFactory workflowFactory;\n    @Mock DataSetClientServices clientServices;\n    @Mock ErrorPopupPresenter errorPopupPresenter;\n    @Mock DataSetDefScreenView view;\n    @Mock DataSetProviderTypeWorkflow dataSetProviderTypeWorkflow;\n    @Mock SQLDataSetDef dataSetDef;\n    @Mock SQLDataSetDefEditor dataSetDefEditor;\n    @Mock DataSetBasicAttributesWorkflow dataSetBasicAttributesWorkflow;\n    @Mock SQLDataSetEditWorkflow editWorkflow;\n    @Mock DataSetDefVfsServices dataSetDefVfsServices;\n    @Mock SavePopUpPresenter savePopUpPresenter;\n    Caller<DataSetDefVfsServices> services;\n    private DataSetDefWizardScreen presenter;\n\n    @Before\n    public void setup() throws Exception {\n        services = new CallerMock<>( dataSetDefVfsServices );\n\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(workflowFactory.providerType()).thenReturn(dataSetProviderTypeWorkflow);\n        when(workflowFactory.edit(any(DataSetProviderType.class))).thenReturn(editWorkflow);\n        when(dataSetProviderTypeWorkflow.edit(any(DataSetDef.class))).thenReturn(dataSetProviderTypeWorkflow);\n        when(dataSetProviderTypeWorkflow.providerTypeEdition()).thenReturn(dataSetProviderTypeWorkflow);\n\n        doAnswer(invocationOnMock -> {\n            RemoteCallback callback = (RemoteCallback) invocationOnMock.getArguments()[1];\n            callback.callback(dataSetDef);\n            return null;\n        }).when(clientServices).newDataSet(any(DataSetProviderType.class), any(RemoteCallback.class));\n\n        doAnswer(invocationOnMock -> {\n            presenter.onClose();\n            return null;\n        }).when(placeManager).closePlace(any(PlaceRequest.class));\n\n        when(dataSetBasicAttributesWorkflow.edit(any(DataSetDef.class))).thenReturn(dataSetBasicAttributesWorkflow);\n        when(dataSetBasicAttributesWorkflow.basicAttributesEdition()).thenReturn(editWorkflow);\n        when(editWorkflow.getDataSetDef()).thenReturn(dataSetDef);\n        when(editWorkflow.edit(any(SQLDataSetDef.class), any(List.class))).thenReturn(editWorkflow);\n        when(editWorkflow.showNextButton()).thenReturn(editWorkflow);\n        when(editWorkflow.showBackButton()).thenReturn(editWorkflow);\n        when(editWorkflow.showTestButton()).thenReturn(editWorkflow);\n        when(editWorkflow.showPreviewTab()).thenReturn(editWorkflow);\n        when(editWorkflow.showConfigurationTab()).thenReturn(editWorkflow);\n        when(editWorkflow.showAdvancedTab()).thenReturn(editWorkflow);\n        when(workflowFactory.basicAttributes(any(DataSetProviderType.class))).thenReturn(dataSetBasicAttributesWorkflow);\n        presenter = new DataSetDefWizardScreen( beanManager, workflowFactory, services, clientServices,\n                                                notification, placeManager, errorPopupPresenter, savePopUpPresenter, view );\n        presenter.services = services;\n    }\n\n    @Test\n    public void testOnMayClose() {\n        presenter.init(null);\n        when(dataSetProviderTypeWorkflow.getDataSetDef()).thenReturn(mock(SQLDataSetDef.class));\n        presenter.onMayClose();\n        verify(view).confirmClose();\n        assertTrue(presenter.isDirty(presenter.getCurrentModelHash()));\n    }\n\n    @Test\n    public void testOnClose() {\n        presenter.init(PlaceRequest.NOWHERE);\n        DataSetEditorWorkflow currentWorkflow = presenter.currentWorkflow;\n\n        presenter.onClose();\n        verify(workflowFactory).dispose(currentWorkflow);\n        assertNull(\"current workflow null\", presenter.currentWorkflow);\n    }\n\n    @Test\n    public void testShowError() {\n        final ClientRuntimeError error = mock(ClientRuntimeError.class);\n        when(error.getCause()).thenReturn(\"errorCause\");\n        presenter.showError(error);\n        verify(errorPopupPresenter, times(1)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testInitProviderTypeEdition() {\n        PlaceRequest placeRequest = mock(PlaceRequest.class);\n        presenter.init(placeRequest);\n        assertEquals(dataSetProviderTypeWorkflow, presenter.currentWorkflow);\n        assertFalse(presenter.isDirty(presenter.getCurrentModelHash()));\n        verify(workflowFactory, times(1)).providerType();\n        verify(view, times(1)).setWidget(any(IsWidget.class));\n        verify(dataSetProviderTypeWorkflow, times(1)).edit(any(DataSetDef.class));\n        verify(dataSetProviderTypeWorkflow, times(0)).showNextButton();\n        verify(dataSetProviderTypeWorkflow, times(0)).showTestButton();\n        verify(dataSetProviderTypeWorkflow, times(0)).showBackButton();\n    }\n\n    @Test\n    public void testOnProviderTypeSelected() throws Exception {\n        when(dataSetProviderTypeWorkflow.getProviderType()).thenReturn(DataSetProviderType.SQL);\n        presenter.onProviderTypeSelected(dataSetProviderTypeWorkflow);\n        assertEquals(dataSetBasicAttributesWorkflow, presenter.currentWorkflow);\n        assertFalse(presenter.isDirty(presenter.getCurrentModelHash()));\n        verify(view, times(1)).setWidget(any(IsWidget.class));\n        verify(dataSetBasicAttributesWorkflow, times(1)).edit(any(DataSetDef.class));\n        verify(editWorkflow, times(1)).showTestButton();\n        verify(editWorkflow, times(1)).showBackButton();\n        verify(editWorkflow, times(0)).showNextButton();\n    }\n\n    @Test\n    public void testOnTestEventWithErrors() {\n        TestDataSetRequestEvent event = mock(TestDataSetRequestEvent.class);\n        when(event.getContext()).thenReturn(dataSetBasicAttributesWorkflow);\n        when(dataSetBasicAttributesWorkflow.hasErrors()).thenReturn(true);\n        presenter.currentWorkflow = dataSetBasicAttributesWorkflow;\n        presenter.onTestEvent(event);\n        verify(dataSetBasicAttributesWorkflow, times(0)).testDataSet(any(DataSetEditorWorkflow.TestDataSetCallback.class));\n    }\n\n    @Test\n    public void testOnTestEventAndCompleteEdition() {\n        final DataSet dataSet = mock(DataSet.class);\n        DataColumn col1 = mock(DataColumn.class);\n        when(col1.getId()).thenReturn(\"col1\");\n        when(col1.getColumnType()).thenReturn(ColumnType.LABEL);\n        DataColumn col2 = mock(DataColumn.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        List<DataColumn> columns = new ArrayList<DataColumn>();\n        columns.add(col1);\n        columns.add(col2);\n        when(dataSet.getColumns()).thenReturn(columns);\n        TestDataSetRequestEvent event = mock(TestDataSetRequestEvent.class);\n        when(event.getContext()).thenReturn(dataSetBasicAttributesWorkflow);\n        when(dataSetBasicAttributesWorkflow.hasErrors()).thenReturn(false);\n        when(dataSetBasicAttributesWorkflow.getDataSetDef()).thenReturn(dataSetDef);\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                DataSetEditorWorkflow.TestDataSetCallback callback = (DataSetEditorWorkflow.TestDataSetCallback) invocationOnMock.getArguments()[0];\n                callback.onSuccess(dataSet);\n                return null;\n            }\n        }).when(dataSetBasicAttributesWorkflow).testDataSet(any(DataSetEditorWorkflow.TestDataSetCallback.class));\n        presenter.currentWorkflow = dataSetBasicAttributesWorkflow;\n\n        presenter.onTestEvent(event);\n\n        verify(dataSetBasicAttributesWorkflow, times(1)).testDataSet(any(DataSetEditorWorkflow.TestDataSetCallback.class));\n        assertEquals(editWorkflow, presenter.currentWorkflow);\n        assertTrue(presenter.isDirty(presenter.getCurrentModelHash()));\n        verify(workflowFactory, times(1)).edit(any(DataSetProviderType.class));\n        verify(view, times(1)).setWidget(any(IsWidget.class));\n        final ArgumentCaptor<List> dataCaptor =  ArgumentCaptor.forClass(List.class);\n        verify(editWorkflow, times(1)).edit(any(SQLDataSetDef.class), dataCaptor.capture());\n        List<DataColumnDef> columnsCaptured = dataCaptor.getValue();\n        assertNotNull(columnsCaptured);\n        assertEquals(2, columnsCaptured.size());\n        assertEquals(\"col1\", columnsCaptured.get(0).getId());\n        assertEquals(\"col2\", columnsCaptured.get(1).getId());\n        verify(editWorkflow, times(1)).showPreviewTab();\n        verify(editWorkflow, times(1)).showNextButton();\n        verify(editWorkflow, times(1)).showBackButton();\n        verify(editWorkflow, times(0)).showTestButton();\n    }\n\n    @Test\n    public void testOnSave() {\n        final Path path = mock(Path.class);\n        DataSetDef dataSetDef = DataSetDefFactory.newBeanDataSetDef().buildDef();\n        PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(dataSetDefVfsServices.save(any(DataSetDef.class), anyString())).thenReturn(path);\n        when(dataSetProviderTypeWorkflow.getDataSetDef()).thenReturn(dataSetDef);\n\n        presenter.init(placeRequest);\n        presenter.onSave(dataSetDef, \"saveMessage\");\n        verify(placeManager, times(1)).goTo(\"DataSetAuthoringHome\");\n        verify(notification, times(1)).fire(any(NotificationEvent.class));\n        verify(placeManager, times(1)).closePlace(any(PlaceRequest.class));\n        verify(workflowFactory).dispose(dataSetProviderTypeWorkflow);\n        verify(workflowFactory, times(0)).edit(any(DataSetProviderType.class));\n\n        assertNull(\"current workflow null\", presenter.currentWorkflow);\n        assertFalse(presenter.isDirty(presenter.getCurrentModelHash()));\n        assertTrue(presenter.mayClose());\n    }\n\n    @Test\n    public void testOnCancelEvent() {\n        presenter.currentWorkflow = dataSetBasicAttributesWorkflow;\n        CancelRequestEvent event = mock(CancelRequestEvent.class);\n        when(event.getContext()).thenReturn(dataSetBasicAttributesWorkflow);\n        presenter.onCancelEvent(event);\n        verify(workflowFactory, times(1)).providerType();\n        verify(workflowFactory, times(0)).edit(any(DataSetProviderType.class));\n        verify(workflowFactory, times(0)).basicAttributes(any(DataSetProviderType.class));\n    }\n\n    @Test\n    public void testOnErrorEvent() {\n        ErrorEvent event = mock(ErrorEvent.class);\n        when(event.getClientRuntimeError()).thenReturn(null);\n        when(event.getMessage()).thenReturn(\"errorMessage\");\n        presenter.currentWorkflow = dataSetBasicAttributesWorkflow;\n        presenter.onErrorEvent(event);\n        verify(dataSetBasicAttributesWorkflow, times(0)).clear();\n        verify(dataSetBasicAttributesWorkflow, times(0)).clearButtons();\n        verify(dataSetBasicAttributesWorkflow, times(0)).showTestButton();\n        verify(dataSetBasicAttributesWorkflow, times(0)).showNextButton();\n        verify(dataSetBasicAttributesWorkflow, times(0)).showBackButton();\n        verify(dataSetBasicAttributesWorkflow, times(0)).edit(any(DataSetDef.class));\n        verify(errorPopupPresenter, times(1)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_ConfigurationTab() {\n        when(editWorkflow.getEditor()).thenReturn(dataSetDefEditor);\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_CONFIGURATION);\n        presenter.currentWorkflow = editWorkflow;\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(1)).showTestButton();\n        verify(editWorkflow, times(0)).showNextButton();\n        verify(editWorkflow, times(0)).showBackButton();\n        verify(editWorkflow, times(0)).edit(any(SQLDataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_PreviewTab() {\n        when(editWorkflow.getEditor()).thenReturn(dataSetDefEditor);\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_PREVIEW);\n        presenter.currentWorkflow = editWorkflow;\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(1)).showNextButton();\n        verify(editWorkflow, times(1)).showBackButton();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).edit(any(SQLDataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n    @Test\n    public void testOnTabChangedEvent_AdvancedTab() {\n        when(editWorkflow.getEditor()).thenReturn(dataSetDefEditor);\n        TabChangedEvent event = mock(TabChangedEvent.class);\n        when(event.getContext()).thenReturn(dataSetDefEditor);\n        when(event.getTabId()).thenReturn(DataSetEditor.TAB_ADVANCED);\n        presenter.currentWorkflow = editWorkflow;\n        presenter.onTabChangedEvent(event);\n        verify(editWorkflow, times(1)).clearButtons();\n        verify(editWorkflow, times(1)).showNextButton();\n        verify(editWorkflow, times(1)).showBackButton();\n        verify(editWorkflow, times(0)).showTestButton();\n        verify(editWorkflow, times(0)).edit(any(SQLDataSetDef.class), any(List.class));\n        verify(errorPopupPresenter, times(0)).showMessage(anyString());\n        verify(view, times(0)).setWidget(any(IsWidget.class));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-displayer-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Displayer Client</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-ace</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.OptionalDouble;\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.ValidationError;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.DateIntervalPattern;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatter;\n\n/**\n * Base class for implementing custom displayers.\n * <p>Any derived class must implement:\n * <ul>\n *     <li>The draw(), redraw() & close() methods.</li>\n *     <li>The capture of events coming from the DisplayerListener interface.</li>\n * </ul>\n */\npublic abstract class AbstractDisplayer<V extends AbstractDisplayer.View> implements Displayer {\n\n    public interface View extends IsWidget {\n\n        void errorMissingSettings();\n\n        void errorMissingHandler();\n\n        void showLoading();\n\n        void showVisualization();\n\n        void clear();\n\n        void setId(String id);\n\n        void errorDataSetNotFound(String uuid);\n\n        void error(ClientRuntimeError error);\n\n        void enableRefreshTimer(int seconds);\n\n        void cancelRefreshTimer();\n\n    }\n\n    public interface Formatter {\n\n        String formatDate(String pattern, Date d);\n\n        Date parseDate(String pattern, String d);\n\n        String formatNumber(String pattern, Number n);\n\n        String formatDayOfWeek(DayOfWeek dayOfWeek);\n\n        String formatMonth(Month month);\n    }\n\n    public interface ExpressionEval {\n\n        String evalExpression(String value, String expression);\n    }\n\n\n    protected DataSet dataSet;\n    protected DataSetHandler dataSetHandler;\n    protected DisplayerSettings displayerSettings;\n    protected DisplayerConstraints displayerConstraints;\n    protected List<DisplayerListener> listenerList = new ArrayList<>();\n    protected Map<String,List<Interval>> columnSelectionMap = new HashMap<>();\n    protected Map<String,ValueFormatter> formatterMap = new HashMap<>();\n    protected Formatter formatter = null;\n    protected ExpressionEval evaluator = null;\n    protected DataSetFilter currentFilter = null;\n    protected boolean refreshEnabled = true;\n    protected boolean drawn = false;\n\n    @Override\n    public Widget asWidget() {\n        return getView().asWidget();\n    }\n\n    /**\n     * It returns the actual implementation of the View\n     * <p>- To be provided by the concrete displayer implementation -</p>\n     */\n    public abstract V getView();\n\n    /**\n     * It initializes the constraints this displayer conforms to\n     * <p>- To be provided by the concrete displayer implementation -</p>\n     */\n    public abstract DisplayerConstraints createDisplayerConstraints();\n\n    /**\n     * The required logic in charge of rendering the visualization\n     * once the data has been retrieved during a call to draw()\n     * <p>- To be provided by the concrete displayer implementation -</p>\n     */\n    protected abstract void createVisualization();\n\n    /**\n     * The required logic in charge of updating a visualization\n     * once the data has been retrieved during a call to redraw()\n     * <p>- To be provided by the concrete displayer implementation -</p>\n     */\n    protected abstract void updateVisualization();\n\n    public DisplayerConstraints getDisplayerConstraints() {\n        if (displayerConstraints == null) {\n            displayerConstraints = createDisplayerConstraints();\n        }\n        return displayerConstraints;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setDisplayerSettings(DisplayerSettings displayerSettings) {\n        checkDisplayerSettings(displayerSettings);\n        this.displayerSettings = displayerSettings;\n    }\n\n    public void checkDisplayerSettings(DisplayerSettings displayerSettings) {\n        DisplayerConstraints constraints = getDisplayerConstraints();\n        if (displayerConstraints != null) {\n            ValidationError error = constraints.check(displayerSettings);\n            if (error != null) {\n                throw error;\n            }\n        }\n    }\n\n    public DataSetHandler getDataSetHandler() {\n        return dataSetHandler;\n    }\n\n    public void setDataSetHandler(DataSetHandler dataSetHandler) {\n        this.dataSetHandler = dataSetHandler;\n    }\n\n    public Formatter getFormatter() {\n        if (formatter == null) {\n            formatter = new DisplayerGwtFormatter();\n        }\n        return formatter;\n    }\n\n    public void setFormatter(Formatter formatter) {\n        this.formatter = formatter;\n    }\n\n    public ExpressionEval getEvaluator() {\n        if (evaluator == null) {\n            evaluator = new DisplayerGwtExprEval(this);\n        }\n        return evaluator;\n    }\n\n    public void setEvaluator(ExpressionEval evaluator) {\n        this.evaluator = evaluator;\n    }\n\n    public void addListener(DisplayerListener... listeners) {\n        for (DisplayerListener listener : listeners) {\n            listenerList.add(listener);\n        }\n    }\n\n    public String getDisplayerId() {\n        String id = displayerSettings.getUUID();\n        if (!StringUtils.isBlank(id)) {\n            return id;\n        }\n\n        id = displayerSettings.getTitle();\n        if (!StringUtils.isBlank(id)) {\n            int hash = id.hashCode();\n            return Integer.toString(hash < 0 ? hash*-1 : hash);\n        }\n        return null;\n    }\n\n    // DRAW & REDRAW\n\n    @Override\n    public boolean isDrawn() {\n        return drawn;\n    }\n    \n    /**\n     * Draw the displayer by executing first the lookup call to retrieve the target data set\n     */\n    @Override\n    public void draw() {\n        if (displayerSettings == null) {\n            getView().errorMissingSettings();\n        }\n        else if (dataSetHandler == null) {\n            getView().errorMissingHandler();\n        }\n        else if (!isDrawn()) {\n            try {\n                drawn = true;\n                getView().showLoading();\n\n                beforeLoad();\n                beforeDataSetLookup();\n                dataSetHandler.lookupDataSet(new DataSetReadyCallback() {\n                    public void callback(DataSet result) {\n                        try {\n                            dataSet = result;\n                            afterLoad();\n                            afterDataSetLookup(result);\n                            createVisualization();\n                            getView().showVisualization();\n\n                            // Set the id of the container panel so that the displayer can be easily located\n                            // by testing tools for instance.\n                            String id = getDisplayerId();\n                            if (!StringUtils.isBlank(id)) {\n                                getView().setId(id);\n                            }\n                            // Draw done\n                            afterDraw();\n                        } catch (Exception e) {\n                            // Give feedback on any initialization error\n                            showError(new ClientRuntimeError(e));\n                        }\n                    }\n                    public void notFound() {\n                        getView().errorDataSetNotFound(displayerSettings.getDataSetLookup().getDataSetUUID());\n                    }\n\n                    @Override\n                    public boolean onError(final ClientRuntimeError error) {\n                        showError(error);\n                        return false;\n                    }\n                });\n            } catch (Exception e) {\n                showError(new ClientRuntimeError(e));\n            }\n        }\n    }\n\n    /**\n     * Just reload the data set and make the current displayer to redraw.\n     */\n    @Override\n    public void redraw() {\n        if (!isDrawn()) {\n            draw();\n        } else {\n            try {\n                beforeLoad();\n                beforeDataSetLookup();\n                dataSetHandler.lookupDataSet(new DataSetReadyCallback() {\n                    public void callback(DataSet result) {\n                        try {\n                            dataSet = result;\n                            afterDataSetLookup(result);\n                            updateVisualization();\n\n                            // Redraw done\n                            afterRedraw();\n                        } catch (Exception e) {\n                            // Give feedback on any initialization error\n                            showError(new ClientRuntimeError(e));\n                        }\n                    }\n                    public void notFound() {\n                        String uuid = displayerSettings.getDataSetLookup().getDataSetUUID();\n                        getView().errorDataSetNotFound(uuid);\n                        handleError(\"Data set not found: \" + uuid);\n                    }\n\n                    @Override\n                    public boolean onError(final ClientRuntimeError error) {\n                        showError(error);\n                        requestDraw();\n                        return false;\n                    }\n\n                });\n            } catch (Exception e) {\n                showError(new ClientRuntimeError(e));\n            }\n        }\n    }\n    \n    private void requestDraw() {\n        drawn = false;\n    }\n\n    public void showError(ClientRuntimeError error) {\n        getView().error(error);\n        handleError(error);\n    }\n\n    /**\n     * Close the displayer\n     */\n    @Override\n    public void close() {\n        getView().clear();\n\n        // Close done\n        afterClose();\n    }\n\n    /**\n     * Call back method invoked just before the data set lookup is executed.\n     */\n    protected void beforeDataSetLookup() {\n    }\n\n    /**\n     * Call back method invoked just after the data set lookup is executed.\n     */\n    protected void afterDataSetLookup(DataSet dataSet) {\n    }\n\n    // REFRESH TIMER\n\n    @Override\n    public void setRefreshOn(boolean enabled) {\n        boolean changed = enabled != refreshEnabled;\n        refreshEnabled = enabled;\n        if (changed) {\n            updateRefreshTimer();\n        }\n    }\n\n    @Override\n    public boolean isRefreshOn() {\n        return refreshEnabled;\n    }\n\n    protected void updateRefreshTimer() {\n        if (isDrawn()) {\n            int seconds = displayerSettings.getRefreshInterval();\n            if (refreshEnabled && seconds > 0) {\n                getView().enableRefreshTimer(seconds);\n            } else {\n                getView().cancelRefreshTimer();\n            }\n        }\n    }\n\n    // LIFECYCLE CALLBACKS\n\n    protected void beforeLoad() {\n        for (DisplayerListener listener : listenerList) {\n            listener.onDataLookup(this);\n        }\n    }\n\n    protected void afterLoad() {\n        for (DisplayerListener listener : listenerList) {\n            listener.onDataLoaded(this);\n        }\n    }\n\n    protected void afterDraw() {\n        updateRefreshTimer();\n        for (DisplayerListener listener : listenerList) {\n            listener.onDraw(this);\n        }\n    }\n\n    protected void afterRedraw() {\n        updateRefreshTimer();\n        for (DisplayerListener listener : listenerList) {\n            listener.onRedraw(this);\n        }\n    }\n\n    protected void afterClose() {\n        setRefreshOn(false);\n\n        for (DisplayerListener listener : listenerList) {\n            listener.onClose(this);\n        }\n    }\n\n    public void handleError(final String message) {\n        handleError(new ClientRuntimeError(message, null));\n    }\n\n    public void handleError(final String message, final Throwable error) {\n        handleError(new ClientRuntimeError(message, error));\n    }\n    public void handleError(final Throwable error) {\n        handleError(new ClientRuntimeError(error));\n    }\n\n    public void handleError(final ClientRuntimeError error) {\n        for (DisplayerListener listener : listenerList) {\n            listener.onError(this, error);\n        }\n    }\n\n    // CAPTURE EVENTS RECEIVED FROM OTHER DISPLAYERS\n\n    @Override\n    public void onDataLookup(Displayer displayer) {\n        // Do nothing\n    }\n\n    @Override\n    public void onDataLoaded(Displayer displayer) {\n        // Do nothing\n    }\n\n    @Override\n    public void onDraw(Displayer displayer) {\n        // Do nothing\n    }\n\n    @Override\n    public void onRedraw(Displayer displayer) {\n        // Do nothing\n    }\n\n    @Override\n    public void onClose(Displayer displayer) {\n        // Do nothing\n    }\n\n    @Override\n    public void onError(final Displayer displayer, ClientRuntimeError error) {\n        // Do nothing\n    }\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n        if (displayerSettings.isFilterListeningEnabled()) {\n            if (dataSetHandler.filter(groupOp)) {\n                redraw();\n            }\n        }\n    }\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetFilter filter) {\n        if (displayerSettings.isFilterListeningEnabled()) {\n            if (dataSetHandler.filter(filter)) {\n                redraw();\n            }\n        }\n    }\n\n    @Override\n    public void onFilterUpdate(Displayer displayer, DataSetFilter oldFilter, DataSetFilter newFilter) {\n        if (displayerSettings.isFilterListeningEnabled()) {\n            boolean unfilter = dataSetHandler.unfilter(oldFilter);\n            boolean filter = dataSetHandler.filter(newFilter);\n            if (unfilter || filter) {\n                redraw();\n            }\n        }\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n        if (displayerSettings.isFilterListeningEnabled()) {\n            boolean applied = false;\n            for (DataSetGroup groupOp : groupOps) {\n                if (dataSetHandler.unfilter(groupOp)) {\n                    applied = true;\n                }\n            }\n            if (applied) {\n                redraw();\n            }\n        }\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, DataSetFilter filter) {\n        if (displayerSettings.isFilterListeningEnabled()) {\n            if (dataSetHandler.unfilter(filter)) {\n                redraw();\n            }\n        }\n    }\n\n    // DATA COLUMN VALUES SELECTION, FILTER & NOTIFICATION\n\n    /**\n     * Get the set of columns being filtered.\n     */\n    public Set<String> filterColumns() {\n        return columnSelectionMap.keySet();\n    }\n\n    /**\n     * Get the current filter intervals for the given data set column.\n     *\n     * @param columnId The column identifier.\n     * @return A list of intervals.\n     */\n    public List<Interval> filterIntervals(String columnId) {\n        List<Interval> selected = columnSelectionMap.get(columnId);\n        if (selected == null) {\n            return new ArrayList<>();\n        }\n        return selected;\n    }\n\n    /**\n     * Get the current filter interval matching the specified index\n     *\n     * @param columnId The column identifier.\n     * @param idx The index of the interval\n     * @return The target interval matching the specified parameters or null if it does not exist.\n     */\n    public Interval filterInterval(String columnId, int idx) {\n        List<Interval> selected = columnSelectionMap.get(columnId);\n        if (selected != null && !selected.isEmpty()) {\n            for (Interval interval : selected) {\n                if (interval.getIndex() == idx) {\n                    return interval;\n                }\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Get the current filter selected interval indexes for the given data set column.\n     *\n     * @param columnId The column identifier.\n     * @return A list of interval indexes\n     */\n    public List<Integer> filterIndexes(String columnId) {\n        List<Integer> result = new ArrayList<>();\n        List<Interval> selected = columnSelectionMap.get(columnId);\n        if (selected == null) {\n            return result;\n        }\n        for (Interval interval : selected) {\n            result.add(interval.getIndex());\n        }\n        return result;\n    }\n\n    /**\n     * Updates the current filter values for the given data set column.\n     *\n     * @param columnId The column to filter for.\n     * @param row The row selected.\n     */\n    public void filterUpdate(String columnId, int row) {\n        filterUpdate(columnId, row, null);\n    }\n\n    /**\n     * Updates the current filter values for the given data set column.\n     *\n     * @param columnId The column to filter for.\n     * @param row The row selected.\n     * @param maxSelections The number of different selectable values available.\n     */\n    public void filterUpdate(String columnId, int row, Integer maxSelections) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            List<Interval> selectedIntervals = columnSelectionMap.get(columnId);\n            Interval intervalFiltered = filterInterval(columnId, row);\n\n            // Existing interval reset\n            if (intervalFiltered != null) {\n                selectedIntervals.remove(intervalFiltered);\n                if (!selectedIntervals.isEmpty()) {\n                    filterApply(columnId, selectedIntervals);\n                }\n                else {\n                    filterReset(columnId);\n                }\n            }\n            // No current filter => Add the selected interval\n            else if (selectedIntervals == null) {\n                Interval intervalSelected = dataSetHandler.getInterval(columnId, row);\n                if (intervalSelected != null) {\n                    selectedIntervals = new ArrayList<>();\n                    selectedIntervals.add(intervalSelected);\n                    columnSelectionMap.put(columnId, selectedIntervals);\n                    filterApply(columnId, selectedIntervals);\n                }\n            }\n            // Extra interval added to an already filtered column\n            else {\n                Interval intervalSelected = dataSetHandler.getInterval(columnId, row);\n                if (intervalSelected != null) {\n                    if (displayerSettings.isFilterSelfApplyEnabled()) {\n                        selectedIntervals = new ArrayList<>();\n                        columnSelectionMap.put(columnId, selectedIntervals);\n                    }\n                    selectedIntervals.add(intervalSelected);\n                    if (maxSelections != null && maxSelections > 0 && selectedIntervals.size() >= maxSelections) {\n                        filterReset(columnId);\n                    } else {\n                        filterApply(columnId, selectedIntervals);\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * Filter the values of the given column.\n     *\n     * @param columnId The name of the column to filter.\n     * @param intervalList A list of interval selections to filter for.\n     */\n    public void filterApply(String columnId, List<Interval> intervalList) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            // For string column filters, init the group interval selection operation.\n            DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);\n            groupOp.setSelectedIntervalList(intervalList);\n\n            // Notify to those interested parties the selection event.\n            if (displayerSettings.isFilterNotificationEnabled()) {\n                for (DisplayerListener listener : listenerList) {\n                    listener.onFilterEnabled(this, groupOp);\n                }\n            }\n            // Drill-down support\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                dataSetHandler.drillDown(groupOp);\n                redraw();\n            }\n        }\n    }\n\n    /**\n     * Apply the given filter\n     *\n     * @param filter A filter\n     */\n    public void filterApply(DataSetFilter filter) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            this.currentFilter = filter;\n\n            // Notify to those interested parties the selection event.\n            if (displayerSettings.isFilterNotificationEnabled()) {\n                for (DisplayerListener listener : listenerList) {\n                    listener.onFilterEnabled(this, filter);\n                }\n            }\n            // Drill-down support\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                dataSetHandler.filter(filter);\n                redraw();\n            }\n        }\n    }\n\n    /**\n     * Updates the current filter values for the given data set column. Any previous filter is reset.\n     *\n     * @param filter A filter\n     */\n    public void filterUpdate(DataSetFilter filter) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            DataSetFilter oldFilter = currentFilter;\n            this.currentFilter = filter;\n\n            // Notify to those interested parties the selection event.\n            if (displayerSettings.isFilterNotificationEnabled()) {\n                for (DisplayerListener listener : listenerList) {\n                    listener.onFilterUpdate(this, oldFilter, filter);\n                }\n            }\n            // Drill-down support\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                dataSetHandler.unfilter(oldFilter);\n                dataSetHandler.filter(filter);\n                redraw();\n            }\n        }\n    }\n\n    /**\n     * Clear any filter on the given column.\n     *\n     * @param columnId The name of the column to reset.\n     */\n    public void filterReset(String columnId) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            columnSelectionMap.remove(columnId);\n            DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);\n\n            // Notify to those interested parties the reset event.\n            if (displayerSettings.isFilterNotificationEnabled()) {\n                for (DisplayerListener listener : listenerList) {\n                    listener.onFilterReset(this, Arrays.asList(groupOp));\n                }\n            }\n            // Apply the selection to this displayer\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                dataSetHandler.drillUp(groupOp);\n                redraw();\n            }\n        }\n    }\n\n    /**\n     * Clear any filter.\n     */\n    public void filterReset() {\n        if (displayerSettings.isFilterEnabled()) {\n\n            List<DataSetGroup> groupOpList = new ArrayList<DataSetGroup>();\n            for (String columnId : columnSelectionMap.keySet()) {\n                DataSetGroup groupOp = dataSetHandler.getGroupOperation(columnId);\n                groupOpList.add(groupOp);\n\n            }\n            columnSelectionMap.clear();\n\n            // Notify to those interested parties the reset event.\n            if (displayerSettings.isFilterNotificationEnabled()) {\n                for (DisplayerListener listener : listenerList) {\n                    if (currentFilter != null) {\n                        listener.onFilterReset(this, currentFilter);\n                    }\n                    listener.onFilterReset(this, groupOpList);\n                }\n            }\n            // Apply the selection to this displayer\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                boolean applied = false;\n\n                if (currentFilter != null) {\n                    if (dataSetHandler.unfilter(currentFilter)) {\n                        applied = true;\n                    }\n                }\n                for (DataSetGroup groupOp : groupOpList) {\n                    if (dataSetHandler.drillUp(groupOp)) {\n                        applied = true;\n                    }\n                }\n                if (applied) {\n                    redraw();\n                }\n            }\n            if (currentFilter != null) {\n                currentFilter = null;\n            }\n        }\n    }\n\n    // DATA COLUMN SORT\n\n    /**\n     * Set the sort order operation to apply to the data set.\n     *\n     * @param columnId The name of the column to sort.\n     * @param sortOrder The sort order.\n     */\n    public void sortApply(String columnId, SortOrder sortOrder) {\n        dataSetHandler.sort(columnId, sortOrder);\n    }\n\n\n    // DATA FORMATTING\n\n    public String formatInterval(Interval interval, DataColumn column) {\n\n        // Raw values\n        if (column == null || column.getColumnGroup() == null) {\n            return interval.getName();\n        }\n        // Date interval\n        String type = interval.getType();\n        if (StringUtils.isBlank(type)) type = column.getIntervalType();\n        if (StringUtils.isBlank(type)) type = column.getColumnGroup().getIntervalSize();\n        DateIntervalType intervalType = DateIntervalType.getByName(type);\n        if (intervalType != null) {\n            ColumnSettings columnSettings = displayerSettings.getColumnSettings(column.getId());\n            String pattern = columnSettings != null ? columnSettings.getValuePattern() : ColumnSettings.getDatePattern(intervalType);\n            String expression = columnSettings != null ? columnSettings.getValueExpression() : null;\n\n            if (pattern == null) {\n                pattern = ColumnSettings.getDatePattern(intervalType);\n            }\n            if (expression == null && column.getColumnGroup().getStrategy().equals(GroupStrategy.FIXED)) {\n                expression = ColumnSettings.getFixedExpression(intervalType);\n            }\n\n            return formatDate(intervalType,\n                    column.getColumnGroup().getStrategy(),\n                    interval.getName(), pattern, expression);\n        }\n        // Label interval\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(column);\n        String expression = columnSettings.getValueExpression();\n        if (StringUtils.isBlank(expression)) return interval.getName();\n        return getEvaluator().evalExpression(interval.getName(), expression);\n    }\n\n    public void addFormatter(String columnId, ValueFormatter formatter) {\n        formatterMap.put(columnId, formatter);\n    }\n\n    public ValueFormatter getFormatter(String columnId) {\n        return formatterMap.get(columnId);\n    }\n\n    public String formatValue(int row, int column) {\n        Object value = row < dataSet.getRowCount() ? dataSet.getValueAt(row, column) : null;\n        DataColumn columnObj = dataSet.getColumnByIndex(column);\n        ValueFormatter formatter = getFormatter(columnObj.getId());\n        if (formatter != null) {\n            return formatter.formatValue(dataSet, row, column);\n        }\n        return formatValue(value, columnObj);\n    }\n\n    public String formatValue(Object value, DataColumn column) {\n\n        ValueFormatter formatter = getFormatter(column.getId());\n        if (formatter != null) {\n            return formatter.formatValue(value);\n        }\n\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(column);\n        String pattern = columnSettings.getValuePattern();\n        String empty = columnSettings.getEmptyTemplate();\n        String expression = columnSettings.getValueExpression();\n\n        if (value == null) {\n            return empty;\n        }\n\n        // Date grouped columns\n        DateIntervalType intervalType = DateIntervalType.getByName(column.getIntervalType());\n        if (intervalType != null) {\n            ColumnGroup columnGroup = column.getColumnGroup();\n            return formatDate(intervalType,\n                    columnGroup.getStrategy(),\n                    value.toString(), pattern, expression);\n        }\n        // Label grouped columns, aggregations & raw values\n        else {\n            ColumnType columnType = column.getColumnType();\n            if (ColumnType.DATE.equals(columnType)) {\n                Date d = (Date) value;\n                return getFormatter().formatDate(pattern, d);\n            }\n            else if (ColumnType.NUMBER.equals(columnType)) {\n                OptionalDouble od = OptionalDouble.empty();\n                if (value instanceof Number) {\n                    od = OptionalDouble.of(((Number) value).doubleValue());\n                }\n                if (!StringUtils.isBlank(expression)) {\n                    String r = getEvaluator().evalExpression(value.toString(), expression);\n                    try {\n                        od = OptionalDouble.of(Double.parseDouble(r));\n                    } catch (NumberFormatException e) {\n                        return r;\n                    }\n                }\n                return getFormatter().formatNumber(pattern, od.getAsDouble());\n            }\n            else {\n                if (StringUtils.isBlank(expression)) {\n                    return value.toString();\n                }\n                return getEvaluator().evalExpression(value.toString(), expression);\n            }\n        }\n    }\n\n    // DATE FORMATTING\n\n    protected String formatDate(DateIntervalType type, GroupStrategy strategy, String date, String pattern, String expression) {\n        if (date == null) {\n            return null;\n        }\n        String str = GroupStrategy.FIXED.equals(strategy) ? formatDateFixed(type, date) : formatDateDynamic(type, date, pattern);\n        if (StringUtils.isBlank(expression)) {\n            return str;\n        }\n        return getEvaluator().evalExpression(str, expression);\n    }\n\n    protected String formatDateFixed(DateIntervalType type, String date) {\n        if (date == null) {\n            return null;\n        }\n        int index = Integer.parseInt(date);\n        if (DateIntervalType.DAY_OF_WEEK.equals(type)) {\n            DayOfWeek dayOfWeek = DayOfWeek.getByIndex(index);\n            return getFormatter().formatDayOfWeek(dayOfWeek);\n        }\n        if (DateIntervalType.MONTH.equals(type)) {\n            Month month = Month.getByIndex(index);\n            return getFormatter().formatMonth(month);\n        }\n        return date;\n    }\n\n    protected String formatDateDynamic(DateIntervalType type, String date, String pattern) {\n        if (date == null) {\n            return null;\n        }\n        Date d = parseDynamicGroupDate(type, date);\n        return getFormatter().formatDate(pattern, d);\n    }\n\n    protected Date parseDynamicGroupDate(DateIntervalType type, String date) {\n        String pattern = DateIntervalPattern.getPattern(type);\n        return getFormatter().parseDate(pattern, date);\n    }\n\n    // EXPORT\n\n    @Override\n    public void export(ExportFormat format, int maxRows, ExportCallback callback) {\n        if (dataSetHandler == null) {\n            callback.noData();\n        } else {\n            Map<String,String> columnNameMap = new HashMap<>();\n            displayerSettings.getColumnSettingsList().forEach(cs -> columnNameMap.put(cs.getColumnId(), cs.getColumnName()));\n            dataSetHandler.exportCurrentDataSetLookup(format, maxRows, callback, columnNameMap);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractDisplayerListener.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\n\n/**\n * Base class for implementing custom displayer listeners.\n */\npublic abstract class AbstractDisplayerListener implements DisplayerListener {\n\n    @Override public void onDataLookup(Displayer displayer) {\n\n    }\n\n    @Override\n    public void onDataLoaded(Displayer displayer) {\n\n    }\n\n    @Override public void onDraw(Displayer displayer) {\n\n    }\n\n    @Override public void onRedraw(Displayer displayer) {\n\n    }\n\n    @Override public void onClose(Displayer displayer) {\n\n    }\n\n    @Override public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n\n    }\n\n    @Override public void onFilterEnabled(Displayer displayer, DataSetFilter filter) {\n\n    }\n\n    @Override public void onFilterUpdate(Displayer displayer, DataSetFilter oldFilter, DataSetFilter newFilter) {\n\n    }\n\n    @Override public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n\n    }\n\n    @Override public void onFilterReset(Displayer displayer, DataSetFilter filter) {\n\n    }\n\n    @Override public void onError(Displayer displayer, ClientRuntimeError error) {\n\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractErraiDisplayer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.uberfire.client.mvp.UberElement;\n\n/**\n * Base class for implementing custom displayers where the view is implemented using Errai @Templated.\n */\npublic abstract class AbstractErraiDisplayer<V extends AbstractErraiDisplayer.View> extends AbstractDisplayer<V> {\n\n    public interface View<P extends AbstractErraiDisplayer> extends AbstractDisplayer.View, UberElement<P> {\n\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractErraiDisplayerView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerConstants;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.api.IsElement;\n\npublic abstract class AbstractErraiDisplayerView<P extends AbstractErraiDisplayer>\n        implements AbstractErraiDisplayer.View<P>, IsElement {\n\n    private Element panel = DOM.createDiv();\n    private Element label = DOM.createLabel();\n    private Element visualization = null;\n    private Timer refreshTimer = null;\n    protected P presenter = null;\n    protected Widget asWidget = ElementWrapperWidget.getWidget(panel);\n\n    public void setPresenter(P presenter) {\n        this.presenter = presenter;\n    }\n\n    public P getPresenter() {\n        return presenter;\n    }\n\n    public void setVisualization(Element element) {\n        visualization = element;\n    }\n\n    @Override\n    public void setId(String id) {\n        panel.setId(id);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return asWidget;\n    }\n\n    @Override\n    public void clear() {\n        DOMUtil.removeAllChildren((Node) panel);\n        ElementWrapperWidget.removeWidget(panel);\n    }\n\n    @Override\n    public void showLoading() {\n        displayMessage(DisplayerConstants.INSTANCE.initializing());\n    }\n\n    @Override\n    public void showVisualization() {\n        if (visualization != null) {\n            DOMUtil.removeAllChildren((Node) panel);\n            panel.appendChild(visualization);\n        }\n    }\n\n    @Override\n    public void errorMissingSettings() {\n        displayMessage(DisplayerConstants.INSTANCE.error() + DisplayerConstants.INSTANCE.error_settings_unset());\n    }\n\n    @Override\n    public void errorMissingHandler() {\n        displayMessage(DisplayerConstants.INSTANCE.error() + DisplayerConstants.INSTANCE.error_handler_unset());\n    }\n\n    @Override\n    public void errorDataSetNotFound(String dataSetUUID) {\n        displayMessage(CommonConstants.INSTANCE.dataset_lookup_dataset_notfound(dataSetUUID));\n    }\n\n    @Override\n    public void error(ClientRuntimeError e) {\n        displayMessage(DisplayerConstants.INSTANCE.error() + e.getMessage());\n\n        if (e.getThrowable() != null) {\n            GWT.log(e.getMessage(), e.getThrowable());\n        } else {\n            GWT.log(e.getMessage());\n        }\n    }\n\n    @Override\n    public void enableRefreshTimer(int seconds) {\n        if (refreshTimer == null) {\n            refreshTimer = new Timer() {\n                public void run() {\n                    if (presenter.isDrawn()) {\n                        presenter.redraw();\n                    }\n                }\n            };\n        }\n        refreshTimer.schedule(seconds * 1000);\n    }\n\n    @Override\n    public void cancelRefreshTimer() {\n        if (refreshTimer != null) {\n            refreshTimer.cancel();\n        }\n    }\n\n    public void displayMessage(String msg) {\n        DOMUtil.removeAllChildren((Node) panel);\n        panel.appendChild(label);\n        label.setInnerText(msg);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractGwtDisplayer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * Base class for implementing custom displayers where the view is implemented using GWT widgets.\n */\npublic abstract class AbstractGwtDisplayer<V extends AbstractGwtDisplayer.View> extends AbstractDisplayer<V> {\n\n    public interface View<P extends AbstractGwtDisplayer> extends AbstractDisplayer.View, UberView<P> {\n\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractGwtDisplayerView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerConstants;\n\npublic abstract class AbstractGwtDisplayerView<P extends AbstractGwtDisplayer>\n        extends Composite\n        implements AbstractGwtDisplayer.View<P> {\n\n    private FlowPanel panel = new FlowPanel();\n    private Label label = new Label();\n    private IsWidget visualization = null;\n    private Timer refreshTimer = null;\n    protected P presenter = null;\n\n    public AbstractGwtDisplayerView() {\n        initWidget(panel);\n    }\n\n    public void setPresenter(P presenter) {\n        this.presenter = presenter;\n    }\n\n    public P getPresenter() {\n        return presenter;\n    }\n\n    public void setVisualization(IsWidget widget) {\n        visualization = widget;\n    }\n\n    @Override\n    public void setId(String id) {\n        panel.getElement().setId(id);\n    }\n\n    @Override\n    public void clear() {\n        panel.clear();\n    }\n\n    @Override\n    public void showLoading() {\n        displayMessage(DisplayerConstants.INSTANCE.initializing());\n    }\n\n    @Override\n    public void showVisualization() {\n        if (visualization != null) {\n            panel.clear();\n            panel.add(visualization);\n        }\n    }\n\n    @Override\n    public void errorMissingSettings() {\n        displayMessage(DisplayerConstants.INSTANCE.error() + DisplayerConstants.INSTANCE.error_settings_unset());\n    }\n\n    @Override\n    public void errorMissingHandler() {\n        displayMessage(DisplayerConstants.INSTANCE.error() + DisplayerConstants.INSTANCE.error_handler_unset());\n    }\n\n    @Override\n    public void errorDataSetNotFound(String dataSetUUID) {\n        displayMessage(CommonConstants.INSTANCE.dataset_lookup_dataset_notfound(dataSetUUID));\n    }\n\n    @Override\n    public void error(ClientRuntimeError e) {\n        displayMessage(DisplayerConstants.INSTANCE.error() + e.getMessage());\n\n        if (e.getThrowable() != null) {\n            GWT.log(e.getMessage(), e.getThrowable());\n        } else {\n            GWT.log(e.getMessage());\n        }\n    }\n\n    @Override\n    public void enableRefreshTimer(int seconds) {\n        if (refreshTimer == null) {\n            refreshTimer = new Timer() {\n                public void run() {\n                    if (presenter.isDrawn()) {\n                        presenter.redraw();\n                    }\n                }\n            };\n        }\n        refreshTimer.schedule(seconds * 1000);\n    }\n\n    @Override\n    public void cancelRefreshTimer() {\n        if (refreshTimer != null) {\n            refreshTimer.cancel();\n        }\n    }\n\n    public void displayMessage(String msg) {\n        panel.clear();\n        panel.add(label);\n        label.setText(msg);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/AbstractRendererLibrary.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.displayer.DisplayerType;\n\n/**\n * Base class for implementing custom renderer libraries.\n */\npublic abstract class AbstractRendererLibrary implements RendererLibrary {\n\n    @Override\n    public boolean isDefault(DisplayerType type) {\n        return false;\n    }\n\n    @Override\n    public void draw(List<Displayer> displayerList) {\n        for (Displayer displayer : displayerList) {\n            displayer.draw();\n        }\n    }\n\n    @Override\n    public void redraw(List<Displayer> displayerList) {\n        for (Displayer displayer : displayerList) {\n            displayer.redraw();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/ClientSettings.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.displayer.DisplayerType;\n\n/**\n * This class provides some methods for defining the behaviour of the Dashbuilder client layer\n */\n@ApplicationScoped\npublic class ClientSettings {\n\n    @Inject RendererManager rendererManager;\n    @Inject DataSetClientServices dataSetClientServices;\n\n    /**\n     * Turns off the ability to push data sets from server (is enabled by default). Push is very useful when dealing\n     * with small size data sets as the performance of any lookup request is much faster on client.\n     */\n    public void turnOffDataSetPush() {\n        dataSetClientServices.setPushRemoteDataSetEnabled(false);\n    }\n\n    /**\n     * It's possible to have one or more renderer libs available per displayer type. If a displayer does not define\n     * its renderer lib then the default one is taken. This method can be used to define the default renderers.\n     *\n     * @param displayerType The type of the displayer we want to configure.\n     * @param rendererLib The UUID of the renderer library.\n     */\n    public void setDefaultRenderer(DisplayerType displayerType, String rendererLib) {\n        rendererManager.setDefaultRenderer(displayerType, rendererLib);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DataSetEditHandler.java",
    "content": "package org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * @since 0.4.0\n */\npublic class DataSetEditHandler extends DataSetHandlerImpl {\n\n    DataSetDef defEdit;\n\n    public DataSetEditHandler(final DataSetClientServices clientServices, \n                              final DataSetLookup lookup, final DataSetDef defEdit) {\n        super(clientServices, lookup);\n        this.defEdit = defEdit;\n    }\n\n    @Override\n    public void lookupDataSet(final DataSetReadyCallback callback) throws Exception {\n        lookupCurrent.setTestMode(true);\n        clientServices.lookupDataSet(defEdit, lookupCurrent, new DataSetReadyCallback() {\n            public void callback(DataSet dataSet) {\n                lastLookedUpDataSet = dataSet;\n                callback.callback(dataSet);\n            }\n\n            public void notFound() {\n                callback.notFound();\n            }\n\n            @Override\n            public boolean onError(final ClientRuntimeError error) {\n                return callback.onError(error);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DataSetHandler.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.Map;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\n\n/**\n * Interface addressed to issue lookup requests over a data set instance.\n */\npublic interface DataSetHandler {\n\n    /**\n     * Retrieves any group operation present in the current data set lookup for the target column specified.\n     * @param columnId The column id. to look for.\n     *\n     * @return The group operation that matches the given column id. Or null if no operation is found.\n     */\n    DataSetGroup getGroupOperation(String columnId);\n\n    /**\n     * Get the interval at the given row for the column specified.\n     *\n     * <p>In case of grouped data sets, the interval may contain information\n     * related to the group operation. For instance, for a data set grouped\n     * by month, will return an interval containing the min/max dates of such month.</p>\n     *\n     * <p>For non-grouped or grouped by label data sets, will\n     * return only an interval with the value of the row/column selected.</p>\n     *\n     * The interval information is useful for filtering purposes as the data provider needs\n     * all the information related to the selected interval.\n     *\n     * @param columnId The column id.\n     * @param row The row which interval we want to retrieve.\n     * @return An interval with information related to the target row/column. Or null, if\n     * <ul>\n     *     <li>the column does not exist,</li>\n     *     <li>the row index is out of bounds,</li>\n     *     <li>or the value is null.</li>\n     * </ul>\n     */\n    Interval getInterval(String columnId, int row);\n\n    /**\n     * Forces the underlying data set to be updated according the group interval selection filter.\n     *\n     * @param op The group interval selection operation to apply <i>op.getSelectedIntervalNames()</i> MUST NOT BE EMPTY.\n     * @return false, if the target interval selection has already been applied - true, otherwise.\n     */\n    boolean filter(DataSetGroup op);\n\n    /**\n     * Reverts the changes applied by a previous <i>filter</i> operation.\n     *\n     * @param op The operation to remove.\n     * @return false, if no filter has been applied for the target operation - true, otherwise.\n     */\n    boolean unfilter(DataSetGroup op);\n\n    /**\n     * Forces the underlying data set to be updated according the specified filter.\n     *\n     * @param op The filter operation to apply.\n     * @return false, if the filter requested has already been applied - true, otherwise.\n     */\n    boolean filter(DataSetFilter op);\n\n    /**\n     * Reverts the changes applied by a previous <i>filter</i> operation.\n     *\n     * @param op The operation to remove.\n     * @return false, if no filter has been applied for the target operation - true, otherwise.\n     */\n    boolean unfilter(DataSetFilter op);\n\n    /**\n     * Applies the specified group interval selection operation over the existing group op.\n     *\n     * @param op The group interval selection operation to apply <i>op.getSelectedIntervalNames()</i> MUST NOT BE EMPTY.\n     * @return false, if drillDown is not applicable for the target operation - true, otherwise.\n     */\n    boolean drillDown(DataSetGroup op);\n\n    /**\n     * Reverts the changes applied by a previous <i>drillDown</i> operation.\n     *\n     * @param op The operation to remove.\n     * @return false, if no drillDown has been applied for the target operation - true, otherwise.\n     */\n    boolean drillUp(DataSetGroup op);\n\n    /**\n     * Set the sort order operation to apply to the data set.\n     *\n     * @param columnId The name of the column to sort.\n     * @param sortOrder The sort order.\n     */\n    void sort(String columnId, SortOrder sortOrder);\n\n    /**\n     * Forces the next data set lookup request to retrieve only the specified row sub set.\n     *\n     * @param offset The position where the row sub set starts.\n     * @param rows The number of rows to get.\n     */\n    void limitDataSetRows(int offset, int rows);\n\n    /**\n     * Restore the current data set lookup instance to its base status.\n     */\n    void resetAllOperations();\n\n    /**\n     * Executes the current data set lookup request configured within this handler.\n     *\n     * @param callback The callback interface that is invoked right after the data is available.\n     */\n    void lookupDataSet(DataSetReadyCallback callback) throws Exception;\n\n    /**\n     * Get the data set get on the last lookup call (if any)\n     */\n    DataSet getLastDataSet();\n\n    /**\n     * Get the current data set lookup (if any)\n     */\n    DataSetLookup getCurrentDataSetLookup();\n\n    /**\n     * Export the current data set to a file in the specified output format.\n     *\n     * @param format The output format\n     * @param maxRows Max rows to be exported.\n     * @param callback The callback instance to be notified\n     * @param columnNameMap A map containing the column header names for every column in the data set lookup\n     */\n    void exportCurrentDataSetLookup(ExportFormat format, int maxRows, ExportCallback callback, Map<String,String> columnNameMap);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DataSetHandlerImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.*;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetExportReadyCallback;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.*;\nimport org.dashbuilder.dataset.sort.ColumnSort;\nimport org.dashbuilder.dataset.sort.DataSetSort;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.uberfire.backend.vfs.Path;\n\nimport java.util.*;\n\npublic class DataSetHandlerImpl implements DataSetHandler {\n\n    protected DataSetClientServices clientServices;\n    protected DataSetLookup lookupBase;\n    protected DataSetLookup lookupCurrent;\n    protected DataSet lastLookedUpDataSet;\n\n    public DataSetHandlerImpl(DataSetClientServices clientServices, DataSetLookup lookup) {\n        this.clientServices = clientServices;\n        this.lookupBase = lookup;\n        this.lookupCurrent = lookup.cloneInstance();\n    }\n\n    @Override\n    public DataSet getLastDataSet() {\n        return lastLookedUpDataSet;\n    }\n\n    @Override\n    public DataSetLookup getCurrentDataSetLookup() {\n        return lookupCurrent;\n    }\n\n    @Override\n    public void resetAllOperations() {\n        this.lookupCurrent = lookupBase.cloneInstance();\n    }\n\n    @Override\n    public void limitDataSetRows(int offset, int rows) {\n        int offsetBase = lookupBase.getRowOffset();\n        int rowsBase = lookupBase.getNumberOfRows();\n        lookupCurrent.setRowOffset(offsetBase + offset);\n\n        // base 0 to all, 0 to 20  => offset=0, rows=20\n        // base 0 to 1,   0 to 20  => offset=0, rows=1\n        // base 50 to 51, 0 to 20  => offset=50, rows=20\n        // base 10 to 31, 20 to 10 => offset=30, rows=10\n        // base 10 to 31, 0 to 50  => offset=10, rows=31\n\n        if (rowsBase < 1 || rowsBase > rows) {\n            lookupCurrent.setNumberOfRows(rows);\n        }\n    }\n\n    @Override\n    public DataSetGroup getGroupOperation(String columnId) {\n        String sourceId = _getSourceColumnId(columnId);\n        int index = lookupCurrent.getLastGroupOpIndex(0, sourceId, false);\n        if (index != -1) {\n            return (DataSetGroup) lookupCurrent.getOperation(index).cloneInstance();\n        }\n\n        DataSetGroup result = new DataSetGroup();\n        result.setColumnGroup(new ColumnGroup(sourceId, sourceId, GroupStrategy.DYNAMIC));\n        return result;\n    }\n\n    @Override\n    public boolean filter(DataSetGroup op) {\n        ColumnGroup cg = op.getColumnGroup();\n        if (cg == null) {\n            throw new RuntimeException(\"Group ops require a pivot column to be specified.\");\n        }\n        if (!op.isSelect()) {\n            throw new RuntimeException(\"Group intervals not specified.\");\n        }\n\n        // Avoid duplicates\n        for (DataSetGroup next : lookupCurrent.getOperationList(DataSetGroup.class)) {\n            if (op.equals(next)) {\n                return false;\n            }\n        }\n        // The interval selection op. must be added right before the first existing group op.\n        DataSetGroup clone = op.cloneInstance();\n        //clone.getGroupFunctions().clear();\n        int idx = lookupCurrent.getFirstGroupOpIndex(0, null, null);\n        _filter(idx < 0 ? 0 : idx, clone, false);\n        return true;\n    }\n\n    @Override\n    public boolean filter(DataSetFilter op) {\n        if (op == null) {\n            return false;\n        }\n        // Avoid duplicates\n        for (DataSetFilter next : lookupCurrent.getOperationList(DataSetFilter.class)) {\n            if (op.equals(next)) {\n                return false;\n            }\n        }\n        lookupCurrent.addOperation(0, op);\n        return true;\n    }\n\n    @Override\n    public boolean drillDown(DataSetGroup op) {\n        ColumnGroup cg = op.getColumnGroup();\n        if (cg == null) {\n            throw new RuntimeException(\"Group ops require a pivot column to be specified.\");\n        }\n        if (!op.isSelect()) {\n            throw new RuntimeException(\"Group intervals not specified.\");\n        }\n        // Avoid duplicates\n        for (DataSetGroup next : lookupCurrent.getOperationList(DataSetGroup.class)) {\n            if (op.equals(next)) {\n                return false;\n            }\n        }\n        // Get the latest group op. for the target column being selected.\n        int lastSelection = lookupCurrent.getLastGroupOpIndex(0, null, true) + 1;\n        int targetGroup = lookupCurrent.getLastGroupOpIndex(lastSelection, cg.getColumnId(), false);\n\n        // If the selection does not exists just add it.\n        if (targetGroup == -1) {\n            DataSetGroup clone = op.cloneInstance();\n            //clone.getGroupFunctions().clear();\n            _filter(lastSelection, clone, true);\n            return true;\n        }\n        // If there not exists a group op after the target then the target op must be propagated along the selection.\n        DataSetGroup targetOp = lookupCurrent.getOperation(targetGroup);\n        int latestGroup = lookupCurrent.getLastGroupOpIndex(targetGroup + 1, null, false);\n        if (latestGroup == -1) {\n            DataSetGroup clone = targetOp.cloneInstance();\n            _filter(targetGroup + 1, clone, true);\n        }\n        // Enable the selection\n        _select(targetOp, op.getSelectedIntervalList());\n        return true;\n    }\n\n    @Override\n    public boolean unfilter(DataSetGroup op) {\n        return _unfilter(op, false);\n    }\n\n    @Override\n    public boolean unfilter(DataSetFilter op) {\n        if (op == null) {\n            return false;\n        }\n        int idx = lookupCurrent.getOperationIdx(op);\n        if (idx != -1) {\n            lookupCurrent.removeOperation(idx);\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public boolean drillUp(DataSetGroup op) {\n        return _unfilter(op, true);\n    }\n\n    @Override\n    public void sort(String columnId, SortOrder sortOrder) {\n        unsort();\n        String sourceId = _getSourceColumnId(columnId);\n        DataSetSort sortOp = new DataSetSort();\n        sortOp.addSortColumn(new ColumnSort(sourceId, sortOrder));\n        lookupCurrent.addOperation(sortOp);\n    }\n\n    public boolean unsort() {\n        int n = lookupCurrent.removeOperations(DataSetOpType.SORT);\n        return n > 0;\n    }\n\n    @Override\n    public void lookupDataSet(final DataSetReadyCallback callback) throws Exception {\n        clientServices.lookupDataSet(lookupCurrent, new DataSetReadyCallback() {\n            public void callback(DataSet dataSet) {\n                lastLookedUpDataSet = dataSet;\n                callback.callback(dataSet);\n            }\n            public void notFound() {\n                callback.notFound();\n            }\n\n            @Override\n            public boolean onError(final ClientRuntimeError error) {\n                return callback.onError(error);\n            }\n        });\n    }\n\n    @Override\n    public Interval getInterval(String columnId, int row) {\n        if (lastLookedUpDataSet == null) {\n            return null;\n        }\n\n        DataColumn column = lastLookedUpDataSet.getColumnById(columnId);\n        if (column == null) {\n            return null;\n        }\n\n        // Get the target value\n        List values = column.getValues();\n        Object value = row < values.size() ? values.get(row) : null;\n        if (value == null) {\n            return null;\n        }\n\n        Interval result = new Interval(value.toString(), row);\n        result.setType(column.getIntervalType());\n        result.setMinValue(column.getMinValue());\n        result.setMaxValue(column.getMaxValue());\n        return result;\n    }\n\n    @Override\n    public void exportCurrentDataSetLookup(ExportFormat format, int maxRows, ExportCallback callback, Map<String,String> columnNameMap) {\n\n        // Export an empty data set does not make sense\n        if (lastLookedUpDataSet == null || lastLookedUpDataSet.getRowCount() == 0) {\n            callback.noData();\n            return;\n        }\n        // Ensure the entire dataset does not exceed the maximum export limit\n        int allRows = lastLookedUpDataSet.getRowCountNonTrimmed();\n        if (maxRows > 0 && allRows > maxRows) {\n            callback.tooManyRows(allRows);\n            return;\n        }\n        try {\n            // Create a backend export callback\n            DataSetExportReadyCallback exportReadyCallback = new DataSetExportReadyCallback() {\n\n                @Override\n                public void exportReady(Path exportFilePath) {\n                    final String u = clientServices.getDownloadFileUrl(exportFilePath);\n                    callback.exportFileUrl(u);\n                }\n                @Override\n                public void onError(ClientRuntimeError error) {\n                    callback.error(error);\n                }\n            };\n\n            // Export the entire data set\n            DataSetLookup exportLookup = getCurrentDataSetLookup().cloneInstance();\n            exportLookup.setRowOffset(0);\n            exportLookup.setNumberOfRows(maxRows);\n\n            // Make sure the column names are set as specified\n            if (exportLookup.getLastGroupOp() != null && columnNameMap != null) {\n                for (GroupFunction groupFunction : exportLookup.getLastGroupOp().getGroupFunctions()) {\n                    String columnId = groupFunction.getColumnId();\n                    if (columnNameMap.containsKey(columnId)) {\n                        String columnName = columnNameMap.get(columnId);\n                        groupFunction.setColumnId(columnName);\n                    }\n                }\n            }\n\n            if (ExportFormat.XLS.equals(format)) {\n                clientServices.exportDataSetExcel(exportLookup, exportReadyCallback);\n            } else {\n                clientServices.exportDataSetCSV(exportLookup, exportReadyCallback);\n            }\n        }\n        catch (Exception e) {\n            callback.error(new ClientRuntimeError(e));\n        }\n    }\n\n    // Internal filter/drillDown implementation logic\n\n    protected Map<String,List<GroupOpFilter>> _groupOpsAdded = new HashMap<>();\n    protected Map<String,List<GroupOpFilter>> _groupOpsSelected = new HashMap<>();\n\n    protected void _filter(int index, DataSetGroup op, boolean drillDown) {\n\n        ColumnGroup cgroup = op.getColumnGroup();\n        String columnId = cgroup.getColumnId();\n        if (!_groupOpsAdded.containsKey(columnId)) _groupOpsAdded.put(columnId, new ArrayList<>());\n        List<GroupOpFilter> filterOps = _groupOpsAdded.get(columnId);\n\n        // When adding an external filter, look first if it exists an existing filter already.\n        if (!drillDown) {\n            for (GroupOpFilter filterOp : filterOps) {\n                if (!filterOp.drillDown && filterOp.groupOp.getColumnGroup().equals(cgroup)) {\n                    filterOp.groupOp.getSelectedIntervalList().clear();\n                    filterOp.groupOp.getSelectedIntervalList().addAll(op.getSelectedIntervalList());\n                    return;\n                }\n            }\n        }\n        GroupOpFilter groupOpFilter = new GroupOpFilter(op, drillDown);\n        filterOps.add(groupOpFilter);\n        lookupCurrent.addOperation(index, op);\n    }\n\n    protected void _select(DataSetGroup op, List<Interval> intervalList) {\n        GroupOpFilter groupOpFilter = new GroupOpFilter(op, true);\n        op.setSelectedIntervalList(intervalList);\n\n        String columnId = op.getColumnGroup().getColumnId();\n        if (!_groupOpsSelected.containsKey(columnId)) {\n            _groupOpsSelected.put(columnId, new ArrayList<>());\n        }\n        _groupOpsSelected.get(columnId).add(groupOpFilter);\n    }\n\n    protected boolean _unfilter(DataSetGroup op, boolean drillDown) {\n        boolean opFound = false;\n        String columnId = op.getColumnGroup().getColumnId();\n\n        if (_groupOpsAdded.containsKey(columnId)) {\n\n            Iterator<GroupOpFilter> it1 = _groupOpsAdded.get(columnId).iterator();\n            while (it1.hasNext()) {\n                GroupOpFilter target = it1.next();\n\n                Iterator<DataSetOp> it2 = lookupCurrent.getOperationList().iterator();\n                while (it2.hasNext()) {\n                    DataSetOp next = it2.next();\n                    if (next == target.groupOp && target.drillDown == drillDown) {\n                        it1.remove();\n                        it2.remove();\n                        opFound = true;\n                    }\n                }\n            }\n        }\n\n        if (_groupOpsSelected.containsKey(columnId)) {\n\n            Iterator<GroupOpFilter> it1 = _groupOpsSelected.get(columnId).iterator();\n            while (it1.hasNext()) {\n                GroupOpFilter target = it1.next();\n\n                Iterator<DataSetGroup> it2 = lookupCurrent.getOperationList(DataSetGroup.class).iterator();\n                while (it2.hasNext()) {\n                    DataSetGroup next = it2.next();\n                    if (next == target.groupOp && target.drillDown == drillDown) {\n                        it1.remove();\n                        next.getSelectedIntervalList().clear();\n                        next.getGroupFunctions().clear();\n                        next.getSelectedIntervalList().addAll(target.intervalList);\n                        next.getGroupFunctions().addAll(target.groupFunctions);\n                        opFound = true;\n                    }\n                }\n            }\n        }\n        return opFound;\n    }\n\n    protected String _getSourceColumnId(String columnId) {\n        if (lastLookedUpDataSet != null) {\n            DataColumn column = lastLookedUpDataSet.getColumnById(columnId);\n            if (column != null && column.getGroupFunction() != null) {\n                String sourceId = column.getGroupFunction().getSourceId();\n                if (sourceId != null) {\n                    return sourceId;\n                }\n            }\n        }\n        for (List<GroupOpFilter> currentSelections : _groupOpsSelected.values()) {\n            for (GroupOpFilter groupOpFilter : currentSelections) {\n                GroupFunction gf = groupOpFilter.groupOp.getGroupFunction(columnId);\n                if (gf != null) {\n                    return gf.getSourceId();\n                }\n            }\n        }\n        return columnId;\n    }\n\n    protected static class GroupOpFilter {\n        DataSetGroup groupOp;\n        boolean drillDown = false;\n        List<GroupFunction> groupFunctions;\n        List<Interval> intervalList;\n\n        private GroupOpFilter(DataSetGroup op, boolean drillDown) {\n            this.groupOp = op;\n            this.drillDown = drillDown;\n            this.groupFunctions = new ArrayList<>(op.getGroupFunctions());\n            this.intervalList = new ArrayList<>(op.getSelectedIntervalList());\n        }\n\n        public String toString() {\n            StringBuilder out = new StringBuilder();\n            out.append(\"drillDown(\").append(drillDown).append(\") \");\n            if (groupOp != null) out.append(\"groupOp(\").append(groupOp).append(\")\");\n            return out.toString();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/Displayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatter;\n\n/**\n * A Displayer takes care of drawing a DisplayerSettings instance.\n */\npublic interface Displayer extends DisplayerListener, IsWidget {\n\n    /**\n     * The data displayer to draw.\n     */\n    void setDisplayerSettings(DisplayerSettings displayerSettings);\n    DisplayerSettings getDisplayerSettings();\n\n    /**\n     * The handler used to fetch and manipulate the data set.\n     */\n    void setDataSetHandler(DataSetHandler dataSetHandler);\n    DataSetHandler getDataSetHandler();\n\n    /**\n     * Every Displayer implementation must define the set of features it supports as well as other behavioral settings.\n     * These \"constrains\" are needed for two main reasons:\n     * <ul>\n     *     <li>Validation purposes: in order to ensure the DisplayerSettings are valid and ready for rendering.</li>\n     *     <li>Edition purposes: in order to let the DisplayerEditor know what features/settings/behaviour this Displayer implementation supports.</li>\n     * </ul>\n     */\n    DisplayerConstraints getDisplayerConstraints();\n\n    /**\n     * Add a listener interested in receive events generated within this displayer component.\n     */\n    void addListener(DisplayerListener... listeners);\n\n    /**\n     * Registers a custom formatter for the given column\n     */\n    void addFormatter(String columnId, ValueFormatter formatter);\n\n    /**\n     * Draw the chart\n     */\n    void draw();\n\n    /**\n     * Same as draw but does not necessary implies to repaint everything again.\n     * It's just a matter of update & display the latest data set changes.\n     */\n    void redraw();\n\n    /**\n     * Check if the displayer is completely drawn.\n     */\n    boolean isDrawn();\n\n    /**\n     * Enables or disables the automatic refresh capability (enabled by default).\n     * @see DisplayerSettings#getRefreshInterval()\n     */\n    void setRefreshOn(boolean enabled);\n\n    /**\n     * Check if the automatic refresh is on.\n     */\n    boolean isRefreshOn();\n\n    /**\n     * Export the data being displayed into the specified output format.\n     *\n     * @param format The output format\n     * @param maxRows Max rows to be exported. If lower or equals to 0 then all rows will be exported.\n     * @param callback The callback instance to be notified\n     */\n    void export(ExportFormat format, int maxRows, ExportCallback callback);\n\n    /**\n     * Frees any resource the displayer is consuming.\n     */\n    void close();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerClientEntryPoint.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/CommonConstants.properties\")\npublic class DisplayerClientEntryPoint {\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerCoordinator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.uberfire.mvp.Command;\n\n/**\n * The coordinator class holds a list of Displayer instances and it makes sure that the data shared among\n * all of them is properly synced. This means every time a data display modification request comes from any\n * of the displayer components the rest are updated to reflect those changes.\n */\n@Dependent\npublic class DisplayerCoordinator {\n\n    protected List<Displayer> displayerList = new ArrayList<>();\n    protected Set<DisplayerListener> listenerSet = new HashSet<>();\n    protected Map<RendererLibrary,List<Displayer>> rendererMap = new HashMap<>();\n    protected CoordinatorListener coordinatorListener = new CoordinatorListener();\n    protected Map<Displayer,List<Displayer>> notificationVetoMap = new HashMap<>();\n    protected RendererManager rendererManager;\n\n    @Inject\n    public DisplayerCoordinator(RendererManager rendererManager) {\n        this.rendererManager = rendererManager;\n    }\n\n    public void addListener(DisplayerListener... listeners) {\n        if (listeners != null) {\n            for (DisplayerListener listener : listeners) {\n                listenerSet.add(listener);\n            }\n            displayerList.stream().forEach(displayer -> displayer.addListener(listeners));\n        }\n    }\n\n    public void addDisplayers(Collection<Displayer> displayers) {\n        if (displayers != null) {\n            displayers.stream().forEach(this::addDisplayer);\n        }\n    }\n    \n    public void addDisplayers(Displayer... displayers) {\n        if (displayers != null) {\n            for (Displayer displayer : displayers) {\n                addDisplayer(displayer);\n            }\n        }\n    }\n\n    public void addDisplayer(Displayer displayer) {\n        if (displayer != null && !displayerList.contains(displayer)) {\n            displayerList.add(displayer);\n\n            displayer.addListener(coordinatorListener);\n            listenerSet.stream().forEach(displayer::addListener);\n\n            RendererLibrary renderer = rendererManager.getRendererForDisplayer(displayer.getDisplayerSettings());\n            List<Displayer> rendererGroup = rendererMap.get(renderer);\n            if (rendererGroup == null) {\n                rendererGroup = new ArrayList<>();\n                rendererMap.put(renderer, rendererGroup);\n            }\n            rendererGroup.add(displayer);\n        }\n    }\n\n    public List<Displayer> getDisplayerList() {\n        return displayerList;\n    }\n\n    public boolean removeDisplayer(Displayer displayer) {\n        if (displayer == null) {\n            return false;\n        }\n        RendererLibrary renderer = rendererManager.getRendererForDisplayer(displayer.getDisplayerSettings());\n        List<Displayer> rendererGroup = rendererMap.get(renderer);\n        if (rendererGroup != null) rendererGroup.remove(displayer);\n\n        return displayerList.remove(displayer);\n    }\n\n    public void drawAll() {\n        drawAll(null, null);\n    }\n\n    public void redrawAll() {\n        redrawAll(null, null);\n    }\n\n    public void drawAll(Command onSuccess, Command onFailure) {\n        coordinatorListener.init(onSuccess, onFailure, displayerList.size(), true);\n        for (RendererLibrary renderer : rendererMap.keySet()) {\n            List<Displayer> rendererGroup = rendererMap.get(renderer);\n            renderer.draw(rendererGroup);\n        }\n    }\n\n    public void redrawAll(Command onSuccess, Command onFailure) {\n        coordinatorListener.init(onSuccess, onFailure, displayerList.size(), false);\n        for (RendererLibrary renderer : rendererMap.keySet()) {\n            List<Displayer> rendererGroup = rendererMap.get(renderer);\n            renderer.redraw(rendererGroup);\n        }\n    }\n\n    public void closeAll() {\n        displayerList.stream().forEach(Displayer::close);\n    }\n\n    public void clear() {\n        closeAll();\n        displayerList.clear();\n        listenerSet.clear();\n        rendererMap.clear();\n        notificationVetoMap.clear();\n    }\n\n    public void addNotificationVeto(Displayer target, List<Displayer> vetoedDisplayers) {\n        notificationVetoMap.put(target, vetoedDisplayers);\n    }\n\n    public void addNotificationVeto(List<Displayer> vetoedDisplayers) {\n        for (Displayer target: vetoedDisplayers) {\n            notificationVetoMap.put(target, vetoedDisplayers);\n        }\n    }\n\n    public boolean isNotificationVetoed(Displayer from, Displayer to) {\n        List<Displayer> vetoList = notificationVetoMap.get(to);\n        return vetoList != null && vetoList.contains(from);\n    }\n\n    /**\n     * Internal class that listens to events raised by any of the Displayer instances handled by this coordinator.\n     */\n    private class CoordinatorListener implements DisplayerListener {\n\n        int count = 0;\n        int total = 0;\n        Command onSuccess;\n        Command onFailure;\n        boolean draw;\n\n        protected void init(Command onSuccess, Command onFailure, int total, boolean draw) {\n            count = 0;\n            this.onSuccess = onSuccess;\n            this.onFailure = onFailure;\n            this.draw = draw;\n            this.total = total;\n        }\n\n        protected void count() {\n            count++;\n            if (count == total && onSuccess != null) {\n                onSuccess.execute();\n            }\n        }\n\n        protected void error() {\n            count++;\n            if (count == total && onFailure != null) {\n                onFailure.execute();\n            }\n        }\n\n        @Override\n        public void onDataLookup(Displayer displayer) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onDataLookup(displayer));\n        }\n\n        @Override\n        public void onDataLoaded(Displayer displayer) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onDataLoaded(displayer));\n        }\n\n        @Override\n        public void onDraw(Displayer displayer) {\n            if (draw) {\n                count();\n            }\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onDraw(displayer));\n        }\n\n        @Override\n        public void onRedraw(Displayer displayer) {\n            if (!draw) {\n                count();\n            }\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onRedraw(displayer));\n        }\n\n        public void onClose(Displayer displayer) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onClose(displayer));\n        }\n\n        @Override\n        public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onFilterEnabled(displayer, groupOp));\n        }\n\n        @Override\n        public void onFilterEnabled(Displayer displayer, DataSetFilter filter) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onFilterEnabled(displayer, filter));\n        }\n\n        @Override\n        public void onFilterUpdate(Displayer displayer, DataSetFilter oldFilter, DataSetFilter newFilter) {\n            for (Displayer other : displayerList) {\n                if (other != displayer && !isNotificationVetoed(displayer, other)) {\n                    other.onFilterUpdate(displayer, oldFilter, newFilter);\n                }\n            }\n        }\n\n        @Override\n        public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onFilterReset(displayer, groupOps));\n        }\n\n        @Override\n        public void onFilterReset(Displayer displayer, DataSetFilter filter) {\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onFilterReset(displayer, filter));\n        }\n\n        @Override\n        public void onError(final Displayer displayer, ClientRuntimeError error) {\n            error();\n            displayerList.stream()\n                    .filter(other -> other != displayer && !isNotificationVetoed(displayer, other))\n                    .forEach(other -> other.onError(displayer, error));\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerGwtExprEval.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerConstants;\n\npublic class DisplayerGwtExprEval implements AbstractDisplayer.ExpressionEval {\n\n    public static final String[] _jsMalicious = {\"document.\", \"window.\", \"alert(\", \"eval(\", \".innerHTML\"};\n\n    AbstractDisplayer presenter = null;\n\n    public DisplayerGwtExprEval(AbstractDisplayer presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public String evalExpression(String val, String expr) {\n        if (StringUtils.isBlank(expr)) {\n            return val;\n        }\n        for (String keyword : _jsMalicious) {\n            if (expr.contains(keyword)) {\n                presenter.handleError(DisplayerConstants.INSTANCE.displayer_keyword_not_allowed(expr));\n                throw new RuntimeException(DisplayerConstants.INSTANCE.displayer_keyword_not_allowed(expr));\n            }\n        }\n        try {\n            return _evalExpression(val, expr);\n        } catch (Exception e) {\n            presenter.handleError(DisplayerConstants.INSTANCE.displayer_expr_invalid_syntax(expr), e);\n            throw new RuntimeException(DisplayerConstants.INSTANCE.displayer_expr_invalid_syntax(expr));\n        }\n    }\n\n    protected native String _evalExpression(String val, String expr) /*-{\n        value = val;\n        return eval(expr) + '';\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerGwtFormatter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.i18n.client.NumberFormat;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.client.resources.i18n.DayOfWeekConstants;\nimport org.dashbuilder.dataset.client.resources.i18n.MonthConstants;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.displayer.ColumnSettings;\n\npublic class DisplayerGwtFormatter implements AbstractDisplayer.Formatter {\n\n    protected static Map<String,NumberFormat> numberPatternMap = new HashMap<String, NumberFormat>();\n    protected static Map<String,DateTimeFormat> datePatternMap = new HashMap<String, DateTimeFormat>();\n\n    @Override\n    public Date parseDate(String pattern, String d) {\n        DateTimeFormat df = getDateFormat(pattern);\n        return df.parse(d);\n    }\n\n    @Override\n    public String formatDate(String pattern, Date d) {\n        DateTimeFormat df = getDateFormat(pattern);\n        return df.format(d);\n    }\n\n    @Override\n    public String formatNumber(String pattern, Number n) {\n        NumberFormat f = getNumberFormat(pattern);\n        return f.format(n);\n    }\n\n    @Override\n    public String formatDayOfWeek(DayOfWeek dayOfWeek) {\n        return DayOfWeekConstants.INSTANCE.getString(dayOfWeek.name());\n    }\n\n    @Override\n    public String formatMonth(Month month) {\n        return MonthConstants.INSTANCE.getString(month.name());\n    }\n\n    protected NumberFormat getNumberFormat(String pattern) {\n        if (StringUtils.isBlank(pattern)) {\n            return getNumberFormat(ColumnSettings.NUMBER_PATTERN);\n        }\n        NumberFormat format = numberPatternMap.get(pattern);\n        if (format == null) {\n            format = NumberFormat.getFormat(pattern);\n            numberPatternMap.put(pattern, format);\n        }\n        return format;\n    }\n\n    protected DateTimeFormat getDateFormat(String pattern) {\n        if (StringUtils.isBlank(pattern)) {\n            return getDateFormat(ColumnSettings.DATE_PATTERN);\n        }\n        DateTimeFormat format = datePatternMap.get(pattern);\n        if (format == null) {\n            format = DateTimeFormat.getFormat(pattern);\n            datePatternMap.put(pattern, format);\n        }\n        return format;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerListener.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\n\n/**\n * Interface addressed to capture events coming from a Displayer instance.\n */\npublic interface DisplayerListener {\n\n    /**\n     * Invoked just before the data lookup operation has been started,\n     *\n     * @param displayer The Displayer instance.\n     */\n    void onDataLookup(Displayer displayer);\n\n    /**\n     * Invoked right after the data lookup finishes and the data set is available,\n     *\n     * @param displayer The Displayer instance.\n     */\n    void onDataLoaded(Displayer displayer);\n\n    /**\n     * Invoked just after the displayer has been drawn.\n     *\n     * @param displayer The Displayer instance.\n     */\n    void onDraw(Displayer displayer);\n\n    /**\n     * Invoked just after the displayer has been redrawn.\n     *\n     * @param displayer The Displayer instance.\n     */\n    void onRedraw(Displayer displayer);\n\n    /**\n     * Invoked just after the displayer has been closed.\n     *\n     * @param displayer The Displayer instance.\n     */\n    void onClose(Displayer displayer);\n\n    /**\n     * Invoked when a group interval selection filter request is executed on a given Displayer instance.\n     *\n     * @param displayer The Displayer instance where the interval selection event comes from.\n     * @param groupOp The group interval selection operation.\n     */\n    void onFilterEnabled(Displayer displayer, DataSetGroup groupOp);\n\n    /**\n     * Invoked when a filter request is executed on a given Displayer instance.\n     *\n     * @param displayer The Displayer instance where the filter request event comes from.\n     * @param filter The filter operation.\n     */\n    void onFilterEnabled(Displayer displayer, DataSetFilter filter);\n\n    /**\n     * Invoked when an update filter request is executed on an already filtered Displayer instance.\n     *\n     * @param displayer The Displayer instance where the filter request event comes from.\n     * @param oldFilter The old filter operation.\n     * @param newFilter The new filter operation.\n     */\n    void onFilterUpdate(Displayer displayer, DataSetFilter oldFilter, DataSetFilter newFilter);\n\n    /**\n     * Invoked when a group interval reset request is executed on a given Displayer instance.\n     *\n     * @param displayer The Displayer instance where the interval selection event comes from.\n     * @param groupOps The set of group interval selection operations reset.\n     */\n    void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps);\n\n    /**\n     * Invoked when a filter reset request is executed on a given Displayer instance.\n     *\n     * @param displayer The Displayer instance where the filter event comes from.\n     * @param filter The filter operation to reset.\n     */\n    void onFilterReset(Displayer displayer, DataSetFilter filter);\n\n    /**\n     * Invoked when some error occurs.\n     * @param displayer The Displayer instance event comes from.\n     * @param error The error instance.\n     */\n    void onError(final Displayer displayer, ClientRuntimeError error);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/DisplayerLocator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.ClientDataSetManager;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatter;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatterRegistry;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\n\n/**\n * The locator service for Displayer implementations.\n */\n@ApplicationScoped\npublic class DisplayerLocator {\n\n    private DataSetClientServices clientServices;\n    private ClientDataSetManager clientDataSetManager;\n    private ValueFormatterRegistry formatterRegistry;\n    private RendererManager rendererManager;\n\n    public DisplayerLocator() {\n    }\n\n    @Inject\n    public DisplayerLocator(DataSetClientServices clientServices,\n                            ClientDataSetManager clientDataSetManager,\n                            RendererManager rendererManager,\n                            ValueFormatterRegistry formatterRegistry) {\n\n        this.clientServices = clientServices;\n        this.clientDataSetManager = clientDataSetManager;\n        this.rendererManager = rendererManager;\n        this.formatterRegistry = formatterRegistry;\n    }\n\n    /**\n     * Get the displayer component for the specified data displayer (with no data set attached).\n     */\n    public Displayer lookupDisplayer(DisplayerSettings target) {\n        RendererLibrary renderer = rendererManager.getRendererForDisplayer(target);\n        Displayer displayer = renderer.lookupDisplayer(target);\n        if (displayer == null) {\n            String rendererUuid = target.getRenderer();\n            if (StringUtils.isBlank(rendererUuid)) throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_default_renderer_undeclared(target.getType().toString()));\n            throw new RuntimeException(CommonConstants.INSTANCE.displayerlocator_unsupported_displayer_renderer(target.getType().toString(), rendererUuid));\n        }\n        displayer.setDisplayerSettings(target);\n\n        // Check if a DataSet has been set instead of a DataSetLookup.\n        DataSetLookup dataSetLookup = target.getDataSetLookup();\n        if (target.getDataSet() != null) {\n            DataSet dataSet = target.getDataSet();\n            clientDataSetManager.registerDataSet(dataSet);\n            dataSetLookup = new DataSetLookup(dataSet.getUUID());\n        }\n\n        DataSetHandler handler = new DataSetHandlerImpl(clientServices, dataSetLookup);\n        displayer.setDataSetHandler(handler);\n        setValueFormatters(displayer);\n        return displayer;\n    }\n\n    protected void setValueFormatters(Displayer displayer) {\n        Map<String,ValueFormatter> m = formatterRegistry.get(displayer.getDisplayerSettings().getUUID());\n        for (String columnId : m.keySet()) {\n            displayer.addFormatter(columnId, m.get(columnId));\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/RendererLibrary.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\n\n/**\n * Main interface for renderer implementations.\n *\n * <p>A renderer library must:</p>\n * <ul>\n *     <li>Perform all the required initializations before any displayer can be drawn</li>\n *     <li>Declare the displayer types & subtypes supported</li>\n *     <li>Take care of the initialization of displayer instances</li>\n * </ul>\n */\npublic interface RendererLibrary {\n\n    /**\n     * The unique universal identifier of the rederer\n     */\n    String getUUID();\n\n    /**\n     * The renderer display name\n     */\n    String getName();\n\n    /**\n     * Flag indicating if this renderer can act as the default one for the given displayer type.\n     * <p>Default renderers are used when a displayer does not explicitly specifies one</p>\n     */\n    boolean isDefault(DisplayerType type);\n\n    /**\n     * The list of supported types\n     */\n    List<DisplayerType> getSupportedTypes();\n\n    /**\n     * The list of supported sub-types\n     */\n    List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType);\n\n    /**\n     * Initalize a displayer instance with the specified configuration.\n     */\n    Displayer lookupDisplayer(DisplayerSettings displayer);\n\n    /**\n     * Draw a list of displayers\n     */\n    void draw(List<Displayer> displayerList);\n\n    /**\n     * Re-draw a list of displayers\n     */\n    void redraw(List<Displayer> displayerList);\n    \n    default boolean isOffline() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/RendererManager.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.EnumMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.dashbuilder.renderer.service.RendererSettingsService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * This class holds a registry of all the RendererLibrary implementations available.\n */\n@EntryPoint\n@ApplicationScoped\npublic class RendererManager {\n\n    private SyncBeanManager beanManager;\n    private List<RendererLibrary> renderersList;\n    private Map<DisplayerType, RendererLibrary> renderersDefault = new EnumMap<>(DisplayerType.class);\n    private Map<DisplayerType, List<RendererLibrary>> renderersByType = new EnumMap<>(DisplayerType.class);\n    private Map<DisplayerSubType, List<RendererLibrary>> renderersBySubType = new EnumMap<>(DisplayerSubType.class);\n    \n    CommonConstants i18n = CommonConstants.INSTANCE;\n    \n    Caller<RendererSettingsService> rendererSettingsService;\n\n    public RendererManager() {\n    }\n\n    @Inject\n    public RendererManager(SyncBeanManager beanManager, Caller<RendererSettingsService> rendererSettingsService) {\n        this.beanManager = beanManager;\n        this.rendererSettingsService = rendererSettingsService;\n    }\n\n    @PostConstruct\n    protected void init() {\n        rendererSettingsService.call((RendererSettings settings) -> lookupRenderers(settings))\n                               .getSettings();\n    }\n\n    protected void lookupRenderers(RendererSettings settings) {\n        String defaultUUID = settings.getDefaultRenderer();\n        boolean onlyOffline = settings.isOffline();\n        renderersList = new ArrayList<>();\n        Collection<SyncBeanDef<RendererLibrary>> beanDefs = beanManager.lookupBeans(RendererLibrary.class);\n        \n        if (onlyOffline) {\n            beanDefs = beanDefs.stream().filter(bd -> bd.getInstance().isOffline()).collect(Collectors.toList());\n        }\n        \n        if (defaultUUID != null && ! defaultUUID.isEmpty()) {\n            beanDefs.stream()\n                    .map(SyncBeanDef::getInstance)\n                    .filter(render -> render.getUUID().equals(defaultUUID))\n                    .findFirst().ifPresent(rend -> \n                        rend.getSupportedTypes().forEach(c -> renderersDefault.put(c, rend))\n            );\n        }\n        for (SyncBeanDef<RendererLibrary> beanDef : beanDefs) {\n\n            RendererLibrary lib = beanDef.getInstance();\n            renderersList.add(lib);\n\n            for (DisplayerType displayerType : DisplayerType.values()) {\n                if (lib.isDefault(displayerType)) {\n                    renderersDefault.putIfAbsent(displayerType, lib);\n                }\n            }\n            List<DisplayerType> types = lib.getSupportedTypes();\n            if (types != null && !types.isEmpty()) {\n\n                for (DisplayerType type : types) {\n                    List<RendererLibrary> set = renderersByType.get(type);\n                    if (set == null) {\n                        set = new ArrayList<>();\n                        renderersByType.put(type, set);\n                    }\n                    set.add(lib);\n\n                    List<DisplayerSubType> subTypes = lib.getSupportedSubtypes(type);\n                    if (subTypes != null && !subTypes.isEmpty()) {\n                        for (DisplayerSubType subType : subTypes) {\n                            List<RendererLibrary> subset = renderersBySubType.get(subType);\n                            if (subset == null) {\n                                subset = new ArrayList<>();\n                                renderersBySubType.put(subType, subset);\n                            }\n                            subset.add(lib);\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    public List<RendererLibrary> getRenderers() {\n        return renderersList;\n    }\n\n    public RendererLibrary getDefaultRenderer(DisplayerType displayerType) {\n        return renderersDefault.get(displayerType);\n    }\n\n    public void setDefaultRenderer(DisplayerType displayerType, String rendererName) {\n        renderersDefault.put(displayerType, getRendererByUUID(rendererName));\n    }\n\n    public List<RendererLibrary> getRenderersForType(DisplayerType displayerType) {\n        return  renderersByType.getOrDefault(displayerType, new ArrayList<>());\n    }\n\n    public List<RendererLibrary> getRenderersForType(DisplayerType type, DisplayerSubType subType) {\n        List<RendererLibrary> types  = renderersByType.getOrDefault(type, Collections.emptyList());\n        List<RendererLibrary> subTypes = renderersBySubType.getOrDefault(subType, Collections.emptyList());\n        if (type == null) {\n            return subType == null ? renderersList : subTypes;\n        }\n        else if (subType == null) {\n            return types;\n        }\n        else {\n            List<RendererLibrary> result = new ArrayList<RendererLibrary>(subTypes);\n            Iterator<RendererLibrary> it = result.iterator();\n            while (it.hasNext()) {\n                RendererLibrary rl = it.next();\n                if (!types.contains(rl)) {\n                    it.remove();\n                }\n            }\n            return result;\n        }\n    }\n\n    public RendererLibrary getRendererByUUID(String renderer) {\n        return getRendererByOrThrowError(renderer, lib -> lib.getUUID().equals(renderer));\n    }\n\n    private RendererLibrary _getRendererByUUID(String renderer) {\n        for (RendererLibrary lib : renderersList) {\n            if (lib.getUUID().equals(renderer)) {\n                return lib;\n            }\n        }\n        return null;\n    }\n\n    public RendererLibrary getRendererByName(String renderer) {\n        return getRendererByOrThrowError(renderer, lib -> lib.getName().equals(renderer));\n    }\n    \n    private RendererLibrary getRendererByOrThrowError(String renderer, Predicate<RendererLibrary> test) {\n        return renderersList.stream()\n                     .filter(test)\n                     .findFirst()\n                     .orElseThrow(() -> new RuntimeException(i18n.rendererliblocator_renderer_not_found(renderer)));\n    }\n\n    public RendererLibrary getRendererForType(DisplayerType displayerType) {\n        return renderersDefault.getOrDefault(displayerType, renderersByType.get(displayerType).get(0));\n    }\n\n    public RendererLibrary getRendererForDisplayer(DisplayerSettings target) {\n\n        // Get the renderer specified\n        if (!StringUtils.isBlank(target.getRenderer())) {\n            RendererLibrary targetRenderer = _getRendererByUUID(target.getRenderer());\n            if (targetRenderer != null) return targetRenderer;\n        }\n\n        // Return always the renderer declared as default\n        List<RendererLibrary> renderersSupported = getRenderersForType(target.getType(), target.getSubtype());\n        RendererLibrary defaultRenderer = getDefaultRenderer(target.getType());\n        for (RendererLibrary rendererLibrary : renderersSupported) {\n            if (defaultRenderer != null && rendererLibrary.equals(defaultRenderer)) {\n                return defaultRenderer;\n            }\n        }\n        // If no default then return the first supported one\n        if (!renderersSupported.isEmpty()) return renderersSupported.get(0);\n        throw new RuntimeException(i18n.renderermanager_renderer_not_available(target.getType().name()));\n    }\n    \n    public boolean isTypeSupported(DisplayerType type) {\n        return !getRenderersForType(type).isEmpty();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/ExternalComponentDispatcher.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.component;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.function.Consumer;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport elemental2.core.JsMap;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.MessageEvent;\nimport jsinterop.base.Js;\nimport org.dashbuilder.displayer.client.component.function.ComponentFunctionLocator;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageType;\nimport org.dashbuilder.displayer.external.FunctionCallRequest;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Listen to all component messages and find the destination.\n *\n */\n@ApplicationScoped\npublic class ExternalComponentDispatcher {\n\n    private static final CommonConstants i18n = CommonConstants.INSTANCE;\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ExternalComponentDispatcher.class);\n\n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    @Inject\n    ComponentFunctionLocator functionLocator;\n\n    Set<ExternalComponentListener> listeners;\n\n    @PostConstruct\n    public void setup() {\n        listeners = new HashSet<>();\n        startListening();\n    }\n\n    public void register(ExternalComponentListener listener) {\n        // make the component listener ready by default\n        listener.prepare();\n        listeners.add(listener);\n    }\n\n    public void unregister(ExternalComponentListener listener) {\n        listeners.remove(listener);\n    }\n\n    public void onMessage(ExternalComponentMessage message) {\n\n        ExternalComponentMessageType type = messageHelper.messageType(message);\n\n        switch (type) {\n            case FILTER:\n                handleFilter(message);\n                break;\n\n            case FUNCTION_CALL:\n                handleFunction(message);\n                break;\n\n            case READY:\n                handleReady(message);\n                break;\n\n            case FIX_CONFIGURATION:\n                handleConfiguration(message);\n                break;\n\n            case CONFIGURATION_OK:\n                handleOkConfiguration(message);\n                break;\n\n            default:\n                break;\n        }\n\n    }\n\n    private void handleOkConfiguration(ExternalComponentMessage message) {\n        findDestination(message, ExternalComponentListener::configurationOk);\n    }\n\n    private void handleConfiguration(ExternalComponentMessage message) {\n        findDestination(message, destination -> destination.onConfigurationIssue(messageHelper.getConfigurationIssue(message)\n                                                                                              .orElse(i18n.componentConfigDefaultMessage())));\n    }\n\n    private void handleFunction(ExternalComponentMessage message) {\n        findDestination(message, destination -> {\n            Optional<FunctionCallRequest> functionCallOp = messageHelper.functionCallRequest(message);\n            if (functionCallOp.isPresent()) {\n                callFunction(destination, functionCallOp.get());\n            } else {\n                destination.sendMessage(messageHelper.newFunctionRequestNotFound());\n            }\n        });\n    }\n\n    private void callFunction(ExternalComponentListener destination, FunctionCallRequest functionCallRequest) {\n        Optional<ExternalComponentFunction> target = functionLocator.findFunctionByName(functionCallRequest.getFunctionName());\n        if (target.isPresent()) {\n            execFunction(target.get(), functionCallRequest, destination::sendMessage);\n        } else {\n            destination.sendMessage(messageHelper.newFunctionNotFound(functionCallRequest));\n        }\n    }\n\n    private void execFunction(ExternalComponentFunction target, FunctionCallRequest functionCallRequest, Consumer<ExternalComponentMessage> consumeResult) {\n        try {\n            Map<String, Object> params = extractParams(functionCallRequest);\n            target.exec(params,\n                        result -> consumeResult.accept(messageHelper.newFunctionSuccess(functionCallRequest, result)),\n                        error -> consumeResult.accept(messageHelper.newFunctionError(functionCallRequest, error)));\n        } catch (Exception e) {\n            consumeResult.accept(messageHelper.newFunctionError(functionCallRequest, e.getMessage()));\n        }\n    }\n\n    private Map<String, Object> extractParams(FunctionCallRequest functionCallRequest) {\n        Map<String, Object> params = new HashMap<>();\n        JsMap<String, Object> requestParams = functionCallRequest.getParameters();\n        if (requestParams != null) {\n            requestParams.forEach((v, k, m) -> params.put(k, v));\n        }\n        return params;\n    }\n\n    private void handleReady(ExternalComponentMessage message) {\n        findDestination(message, ExternalComponentListener::prepare);\n    }\n\n    private void handleFilter(ExternalComponentMessage message) {\n        findDestination(message, listener -> messageHelper.filterRequest(message).ifPresent(listener::onFilter));\n    }\n\n    private void findDestination(ExternalComponentMessage message,\n                                 Consumer<ExternalComponentListener> consumeDestination) {\n        Optional<ExternalComponentListener> destinationOp = messageHelper.getComponentId(message)\n                                                                         .flatMap(id -> listeners.stream()\n                                                                                                 .filter(listener -> listener.getId().equals(id))\n                                                                                                 .findAny());\n        destinationOp.ifPresent(consumeDestination);\n        if (!destinationOp.isPresent()) {\n            LOGGER.warn(\"Ignoring message, destination not found.\");\n        }\n    }\n\n    private void startListening() {\n        DomGlobal.window.addEventListener(\"message\", e -> {\n            MessageEvent<Object> event = Js.cast(e);\n            if (event.data instanceof ExternalComponentMessage) {\n                this.onMessage(Js.cast(event.data));\n            }\n        });\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/ExternalComponentListener.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.component;\n\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalFilterRequest;\n\n/**\n * Defines a contract for classes that want to listen for components messages.\n *\n */\npublic interface ExternalComponentListener {\n\n    String getId();\n\n    void sendMessage(ExternalComponentMessage message);\n    \n    void onFilter(ExternalFilterRequest filterRequest);\n    \n    void onConfigurationIssue(String message);\n    \n    void prepare();\n\n    void configurationOk();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/ExternalComponentMessageHelperProducer.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.component;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\n\n/**\n * Produce the helper for messages.\n *\n */\n@ApplicationScoped\npublic class ExternalComponentMessageHelperProducer {\n\n    @Produces\n    public ExternalComponentMessageHelper produce() {\n        return new ExternalComponentMessageHelper();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/function/BackendFunctionLoader.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.component.function;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\nimport org.dashbuilder.external.service.BackendComponentFunctionService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\n\n/**\n * Generated wrapped client functions to proxy the call using BackendFunctionLoaderService.\n *\n */\n@EntryPoint\npublic class BackendFunctionLoader {\n\n    private static final String UNKNOWN_BACKEND_ERROR = \"Unknown backend error.\";\n\n    @Inject\n    ComponentFunctionLocator componentFunctionLocator;\n\n    @Inject\n    Caller<BackendComponentFunctionService> backendFunctionLoaderService;\n\n    @PostConstruct\n    public void loadBackendFunctions() {\n        backendFunctionLoaderService.call((List<String> result) -> this.registerFunctions(result)).listFunctions();\n    }\n\n    private void registerFunctions(List<String> result) {\n        result.forEach(name -> componentFunctionLocator.registerFunction(new ExternalComponentFunction() {\n\n            @Override\n            public String getName() {\n                return name;\n            }\n\n            @Override\n            public void exec(Map<String, Object> params, Consumer<Object> onFinish, Consumer<String> onError) {\n                backendFunctionLoaderService.call(onFinish::accept, (Object message, Throwable throwable) -> {\n                    String errorMessage = UNKNOWN_BACKEND_ERROR;\n                    if (throwable != null && throwable.getMessage() != null) {\n                        errorMessage = throwable.getMessage();\n                    } else if (message != null) {\n                        errorMessage = message.toString();\n                    }\n                    onError.accept(errorMessage);\n                    return false;\n                }).callFunction(name, params);\n            }\n        }));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/function/ComponentFunctionLocator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.component.function;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport elemental2.core.JsArray;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * Looks for components functions\n *\n */\n@ApplicationScoped\npublic class ComponentFunctionLocator {\n\n    @Inject\n    SyncBeanManager beanManager;\n\n    List<ExternalComponentFunction> functions;\n\n    @PostConstruct\n    void loadFunctions() {\n        functions = beanManager.lookupBeans(ExternalComponentFunction.class)\n                               .stream()\n                               .map(SyncBeanDef::getInstance)\n                               .collect(Collectors.toList());\n        DomGlobal.console.log(\"Registered \" + functions.size() + \" functions\");\n    }\n\n    public Optional<ExternalComponentFunction> findFunctionByName(String name) {\n        return functions.stream().filter(f -> name.equals(f.getName())).findAny();\n    }\n\n    public void registerFunction(ExternalComponentFunction function) {\n        functions.add(function);\n    }\n    \n    public JsArray<String> listFunctions() {\n        JsArray<String> array = new JsArray<>();\n        functions.stream().map(ExternalComponentFunction::getName).forEach(array::push);\n        return array;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/function/GWTVersion.java",
    "content": "package org.dashbuilder.displayer.client.component.function;\n\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\n\n/**\n * Returns GWT Version\n *\n */\n@Dependent\npublic class GWTVersion implements ExternalComponentFunction {\n\n    @Override\n    public void exec(Map<String, Object> params, Consumer<Object> onFinish, Consumer<String> onError) {\n        onFinish.accept(GWT.getVersion());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/component/function/ListFunctions.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.component.function;\n\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\n\n/**\n * A meta function to list available functions.\n *\n */\n@Dependent\npublic class ListFunctions implements ExternalComponentFunction {\n\n    @Inject\n    ComponentFunctionLocator locator;\n\n    @Override\n    public void exec(Map<String, Object> params, Consumer<Object> onFinish, Consumer<String> onError) {\n        onFinish.accept(locator.listFunctions());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/ColumnDetailsChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.group.GroupFunction;\n\npublic class ColumnDetailsChangedEvent {\n\n    GroupFunction columnFunction;\n\n    public ColumnDetailsChangedEvent() {\n    }\n\n    public ColumnDetailsChangedEvent(GroupFunction columnFunction) {\n        this.columnFunction = columnFunction;\n    }\n\n    public GroupFunction getColumnFunction() {\n        return columnFunction;\n    }\n\n    public void setColumnFunction(GroupFunction columnFunction) {\n        this.columnFunction = columnFunction;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/ColumnFilterChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.displayer.client.widgets.filter.ColumnFilterEditor;\n\npublic class ColumnFilterChangedEvent {\n\n    ColumnFilterEditor columnFilterEditor;\n\n    public ColumnFilterChangedEvent() {\n    }\n\n    public ColumnFilterChangedEvent(ColumnFilterEditor columnFilterEditor) {\n        this.columnFilterEditor = columnFilterEditor;\n    }\n\n    public ColumnFilterEditor getColumnFilterEditor() {\n        return columnFilterEditor;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/ColumnFilterDeletedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.client.widgets.filter.ColumnFilterEditor;\n\npublic class ColumnFilterDeletedEvent {\n\n    ColumnFilterEditor columnFilterEditor;\n\n    public ColumnFilterDeletedEvent() {\n    }\n\n    public ColumnFilterDeletedEvent(ColumnFilterEditor columnFilterEditor) {\n        this.columnFilterEditor = columnFilterEditor;\n    }\n\n    public ColumnFilterEditor getColumnFilterEditor() {\n        return columnFilterEditor;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DataSetFilterChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.filter.DataSetFilter;\n\npublic class DataSetFilterChangedEvent {\n\n    DataSetFilter filter;\n\n    public DataSetFilterChangedEvent() {\n    }\n\n    public DataSetFilterChangedEvent(DataSetFilter filter) {\n        this.filter = filter;\n    }\n\n    public DataSetFilter getFilter() {\n        return filter;\n    }\n\n    public void setFilter(DataSetFilter filter) {\n        this.filter = filter;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DataSetGroupDateChanged.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.group.ColumnGroup;\n\npublic class DataSetGroupDateChanged {\n\n    ColumnGroup columnGroup;\n\n    public DataSetGroupDateChanged() {\n    }\n\n    public DataSetGroupDateChanged(ColumnGroup columnGroup) {\n        this.columnGroup = columnGroup;\n    }\n\n    public ColumnGroup getColumnGroup() {\n        return columnGroup;\n    }\n\n    public void setColumnGroup(ColumnGroup columnGroup) {\n        this.columnGroup = columnGroup;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DataSetLookupChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.DataSetLookup;\n\npublic class DataSetLookupChangedEvent {\n\n    DataSetLookup dataSetLookup;\n\n    public DataSetLookupChangedEvent() {\n    }\n\n    public DataSetLookupChangedEvent(DataSetLookup dataSetLookup) {\n        this.dataSetLookup = dataSetLookup;\n    }\n\n    public DataSetLookup getDataSetLookup() {\n        return dataSetLookup;\n    }\n\n    public void setDataSetLookup(DataSetLookup dataSetLookup) {\n        this.dataSetLookup = dataSetLookup;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DisplayerEditorClosedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class DisplayerEditorClosedEvent {\n\n    DisplayerSettings displayerSettings;\n\n    public DisplayerEditorClosedEvent() {\n    }\n\n    public DisplayerEditorClosedEvent(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setDisplayerSettings(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DisplayerEditorSavedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class DisplayerEditorSavedEvent {\n\n    DisplayerSettings displayerSettings;\n\n    public DisplayerEditorSavedEvent() {\n    }\n\n    public DisplayerEditorSavedEvent(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setDisplayerSettings(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DisplayerSettingsChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class DisplayerSettingsChangedEvent {\n\n    DisplayerSettings displayerSettings;\n\n    public DisplayerSettingsChangedEvent() {\n    }\n\n    public DisplayerSettingsChangedEvent(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setDisplayerSettings(DisplayerSettings displayerSettings) {\n        this.displayerSettings = displayerSettings;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DisplayerSubtypeSelectedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.DisplayerSubType;\n\npublic class DisplayerSubtypeSelectedEvent {\n\n    DisplayerSubType selectedSubType;\n\n    public DisplayerSubtypeSelectedEvent() {\n    }\n\n    public DisplayerSubtypeSelectedEvent(DisplayerSubType selectedSubType) {\n        this.selectedSubType = selectedSubType;\n    }\n\n    public DisplayerSubType getSelectedSubType() {\n        return selectedSubType;\n    }\n\n    public void setSelectedSubType(DisplayerSubType selectedSubType) {\n        this.selectedSubType = selectedSubType;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/DisplayerTypeSelectedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.displayer.DisplayerType;\n\npublic class DisplayerTypeSelectedEvent {\n\n    DisplayerType selectedType;\n\n    public DisplayerTypeSelectedEvent() {\n    }\n\n    public DisplayerTypeSelectedEvent(DisplayerType selectedType) {\n        this.selectedType = selectedType;\n    }\n\n    public DisplayerType getSelectedType() {\n        return selectedType;\n    }\n\n    public void setSelectedType(DisplayerType selectedType) {\n        this.selectedType = selectedType;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/GroupFunctionChangedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.group.GroupFunction;\n\npublic class GroupFunctionChangedEvent {\n\n    GroupFunction groupFunction;\n\n    public GroupFunctionChangedEvent() {\n    }\n\n    public GroupFunctionChangedEvent(GroupFunction groupFunction) {\n        this.groupFunction = groupFunction;\n    }\n\n    public GroupFunction getGroupFunction() {\n        return groupFunction;\n    }\n\n    public void setGroupFunction(GroupFunction groupFunction) {\n        this.groupFunction = groupFunction;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/events/GroupFunctionDeletedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.events;\n\nimport org.dashbuilder.dataset.group.GroupFunction;\n\npublic class GroupFunctionDeletedEvent {\n\n    GroupFunction groupFunction;\n\n    public GroupFunctionDeletedEvent() {\n    }\n\n    public GroupFunctionDeletedEvent(GroupFunction groupFunction) {\n        this.groupFunction = groupFunction;\n    }\n\n    public GroupFunction getGroupFunction() {\n        return groupFunction;\n    }\n\n    public void setGroupFunction(GroupFunction groupFunction) {\n        this.groupFunction = groupFunction;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/export/ExportCallback.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.export;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.client.Displayer;\n\n/**\n * Interface for capturing the results of a {@link Displayer#export(ExportFormat, int, ExportCallback)} request\n */\npublic interface ExportCallback {\n\n    void noData();\n\n    void tooManyRows(int rowNum);\n\n    void exportFileUrl(String url);\n\n    void error(ClientRuntimeError error);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/export/ExportFormat.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.export;\n\npublic enum ExportFormat {\n\n    CSV,\n    XLS;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/formatter/AbstractValueFormatter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.formatter;\n\nimport org.dashbuilder.dataset.DataSet;\n\npublic abstract class AbstractValueFormatter implements ValueFormatter {\n\n    public String formatValue(DataSet dataSet, int row, int column) {\n        Object value = dataSet.getValueAt(row, column);\n        return formatValue(value);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/formatter/ValueFormatter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.formatter;\n\nimport org.dashbuilder.dataset.DataSet;\n\npublic interface ValueFormatter {\n\n    String formatValue(DataSet dataSet, int row, int column);\n\n    String formatValue(Object value);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/formatter/ValueFormatterRegistry.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.formatter;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class ValueFormatterRegistry {\n\n    Map<String,Map<String,ValueFormatter>> formatterMap = new HashMap<String, Map<String,ValueFormatter>>();\n    public static final String _UNASSIGNED = \"_unassigned\";\n\n    public void register(String columnId, ValueFormatter formatter) {\n        Map<String,ValueFormatter> m = formatterMap.get(_UNASSIGNED);\n        if (m == null) {\n            m = new HashMap<String,ValueFormatter>();\n            formatterMap.put(_UNASSIGNED, m);\n        }\n        m.put(columnId, formatter);\n    }\n\n    public void register(String displayerUuid, String columnId, ValueFormatter formatter) {\n        Map<String,ValueFormatter> m = formatterMap.get(displayerUuid);\n        if (m == null) {\n            m = new HashMap<String,ValueFormatter>();\n            formatterMap.put(displayerUuid, m);\n        }\n        m.put(columnId, formatter);\n    }\n\n    public Map<String,ValueFormatter> get(String displayerUuid) {\n        Map<String,ValueFormatter> results = new HashMap<String,ValueFormatter>();\n\n        Map m = formatterMap.get(_UNASSIGNED);\n        if (m != null) {\n            results.putAll(m);\n        }\n        m = formatterMap.get(displayerUuid);\n        if (m != null) {\n            results.putAll(m);\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/prototypes/DataSetPrototypes.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.prototypes;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.client.ClientDataSetManager;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\n\n@ApplicationScoped\npublic class DataSetPrototypes {\n\n    public static final String CITY = \"City / Urban area\";\n    public static final String COUNTRY = \"Country\";\n    public static final String GDP_2014 = \"GDP 2014\";\n    public static final String GDP_2013 = \"GDP 2013\";\n    public static final String CONTINENT = \"Continent\";\n    public static final String AREA_SIZE = \"Area size (km2)\";\n    public static final String DENSITY = \"Density (people / km2)\";\n    public static final String REGION = \"Region\";\n    public static final String POPULATION = \"Population\";\n\n    ClientDataSetManager dataSetManager;\n\n    public DataSet getWorldPopulation() {\n        return dataSetManager.getDataSet(\"worldPopulation\");\n    }\n\n    public DataSet getTotalPopulation() {\n        return dataSetManager.getDataSet(\"totalPopulation\");\n    }\n\n    public DataSet getCountryPopulation() {\n        return dataSetManager.getDataSet(\"countryPopulation\");\n    }\n\n    public DataSet getTopRichCountries() {\n        return dataSetManager.getDataSet(\"topRichCountries\");\n    }\n\n    public DataSet getContinentPopulation() {\n        return dataSetManager.getDataSet(\"continentPopulation\");\n    }\n\n    public DataSet getPopulationLimits() {\n        return dataSetManager.getDataSet(\"populationLimits\");\n    }\n\n    public DataSet getContinentPopulationExt() {\n        return dataSetManager.getDataSet(\"continentPopulationExt\");\n    }\n\n    public DataSetPrototypes() {\n    }\n\n    @Inject\n    public DataSetPrototypes(ClientDataSetManager dataSetManager) {\n        this.dataSetManager = dataSetManager;\n        init();\n    }\n\n    public void init() {\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"topRichCountries\")\n                .label(COUNTRY)\n                .number(GDP_2013)\n                .number(GDP_2014)\n                .row(\"United States\", 16768100L, 17418925L)\n                .row(\"China\", 9240270L, 1038080L)\n                .row(\"Japan\", 4919563L, 4616335L)\n                .row(\"Germany\", 3730261L, 3859547L)\n                .row(\"United Kingdom\", 2678455L, 2945146L)\n                .row(\"France\", 2806428L, 2846889L)\n                .row(\"Brazil\", 2245673L, 2353025L)\n                .buildDataSet());\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"continentPopulation\")\n                .label(CONTINENT)\n                .number(POPULATION)\n                .row(\"Asia\", 4298723000L)\n                .row(\"Africa\", 1110635000L)\n                .row(\"North America\", 972005000L)\n                .row(\"South America\", 972005000L)\n                .row(\"Europe\", 742452000L)\n                .row(\"Oceania\", 38304000L)\n                .buildDataSet());\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"populationLimits\")\n                .number(POPULATION)\n                .number(POPULATION + \"_max\")\n                .row(38304000L, 4298723000L)\n                .buildDataSet());\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"totalPopulation\")\n                .number(POPULATION)\n                .row(42987L)\n                .buildDataSet());\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"continentPopulationExt\")\n                .label(CONTINENT)\n                .number(AREA_SIZE)\n                .number(DENSITY)\n                .label(REGION)\n                .number(POPULATION)\n                .row(\"Asia\", 43820000L, 95.0, \"Asia\", 4298723000L)\n                .row(\"Africa\", 30370000L, 33.7, \"Africa\", 1110635000L)\n                .row(\"North America\", 24490000L, 22.1, \"North America\", 972005000L)\n                .row(\"South America\", 17840000L, 22.0, \"South America\", 972005000L)\n                .row(\"Europe\", 10180000L, 72.5, \"Europe\", 742452000L)\n                .row(\"Oceania\", 9008500L, 3.2, \"Oceania\", 38304000L)\n                .buildDataSet());\n\n        dataSetManager.registerDataSet(DataSetFactory\n                .newDataSetBuilder()\n                .uuid(\"worldPopulation\")\n                .label(CITY)\n                .label(COUNTRY)\n                .number(POPULATION)\n                .number(AREA_SIZE)\n                .number(DENSITY)\n                .row(\"Tokyo/Yokohama\", \"Japan\", 33200000L, 6993L, 4750L)\n                .row(\"New York Metro\", \"USA\", 17800000L, 8683L, 2050L)\n                .row(\"Sao Paulo\", \"Brazil\", 17700000L, 1968L, 9000L)\n                .row(\"Seoul/Incheon\", \"South Korea\", 17500000L, 1049L, 16700L)\n                .row(\"Mexico City\", \"Mexico\", 17400000L, 2072L, 8400L)\n                .row(\"Osaka/Kobe/Kyoto\", \"Japan\", 16425000L, 2564L, 6400L)\n                .row(\"Manila\", \"Philippines\", 14750000L, 1399L, 10550L)\n                .row(\"Mumbai\", \"India\", 14350000L, 484L, 29650L)\n                .row(\"Delhi\", \"India\", 14300000L, 1295L, 11050L)\n                .row(\"Jakarta\", \"Indonesia\", 14250000L, 1360L, 10500L)\n                .row(\"Lagos\", \"Nigeria\", 13400000L, 738L, 18150L)\n                .row(\"Kolkata\", \"India\", 12700000L, 531L, 23900L)\n                .row(\"Cairo\", \"Egypt\", 12200000L, 1295L, 9400L)\n                .row(\"Los Angeles\", \"USA\", 11789000L, 4320L, 2750L)\n                .row(\"Buenos Aires\", \"Argentina\", 11200000L, 2266L, 4950L)\n                .row(\"Rio de Janeiro\", \"Brazil\", 10800000L, 1580L, 6850L)\n                .row(\"Moscow\", \"Russia\", 10500000L, 2150L, 4900L)\n                .row(\"Shanghai\", \"China\", 10000000L, 746L, 13400L)\n                .row(\"Karachi\", \"Pakistan\", 9800000L, 518L, 18900L)\n                .row(\"Paris\", \"France\", 9645000L, 2723L, 3550L)\n                .row(\"Istanbul\", \"Turkey\", 9000000L, 1166L, 7700L)\n                .row(\"Nagoya\", \"Japan\", 9000000L, 2875L, 3150L)\n                .row(\"Beijing\", \"China\", 8614000L, 748L, 11500L)\n                .row(\"Chicago\", \"USA\", 8308000L, 5498L, 1500L)\n                .row(\"London\", \"UK\", 8278000L, 1623L, 5100L)\n                .row(\"Shenzhen\", \"China\", 8000000L, 466L, 17150L)\n                .row(\"Essen/D�sseldorf\", \"Germany\", 7350000L, 2642L, 2800L)\n                .row(\"Tehran\", \"Iran\", 7250000L, 686L, 10550L)\n                .row(\"Bogota\", \"Colombia\", 7000000L, 518L, 13500L)\n                .row(\"Lima\", \"Peru\", 7000000L, 596L, 11750L)\n                .row(\"Bangkok\", \"Thailand\", 6500000L, 1010L, 6450L)\n                .row(\"Johannesburg/East Rand\", \"South Africa\", 6000000L, 2396L, 2500L)\n                .row(\"Chennai\", \"India\", 5950000L, 414L, 14350L)\n                .row(\"Taipei\", \"Taiwan\", 5700000L, 376L, 15200L)\n                .row(\"Baghdad\", \"Iraq\", 5500000L, 596L, 9250L)\n                .row(\"Santiago\", \"Chile\", 5425000L, 648L, 8400L)\n                .row(\"Bangalore\", \"India\", 5400000L, 534L, 10100L)\n                .row(\"Hyderabad\", \"India\", 5300000L, 583L, 9100L)\n                .row(\"St Petersburg\", \"Russia\", 5300000L, 622L, 8550L)\n                .row(\"Philadelphia\", \"USA\", 5149000L, 4661L, 1100L)\n                .row(\"Lahore\", \"Pakistan\", 5100000L, 622L, 8200L)\n                .row(\"Kinshasa\", \"Congo\", 5000000L, 469L, 10650L)\n                .row(\"Miami\", \"USA\", 4919000L, 2891L, 1700L)\n                .row(\"Ho Chi Minh City\", \"Vietnam\", 4900000L, 518L, 9450L)\n                .row(\"Madrid\", \"Spain\", 4900000L, 945L, 5200L)\n                .row(\"Tianjin\", \"China\", 4750000L, 453L, 10500L)\n                .row(\"Kuala Lumpur\", \"Malaysia\", 4400000L, 1606L, 2750L)\n                .row(\"Toronto\", \"Canada\", 4367000L, 1655L, 2650L)\n                .row(\"Milan\", \"Italy\", 4250000L, 1554L, 2750L)\n                .row(\"Shenyang\", \"China\", 4200000L, 453L, 9250L)\n                .row(\"Dallas/Fort Worth\", \"USA\", 4146000L, 3644L, 1150L)\n                .row(\"Boston\", \"USA\", 4032000L, 4497L, 900L)\n                .row(\"Belo Horizonte\", \"Brazil\", 4000000L, 868L, 4600L)\n                .row(\"Khartoum\", \"Sudan\", 4000000L, 583L, 6850L)\n                .row(\"Riyadh\", \"Saudi Arabia\", 4000000L, 1101L, 3650L)\n                .row(\"Singapore\", \"Singapore\", 4000000L, 479L, 8350L)\n                .row(\"Washington\", \"USA\", 3934000L, 2996L, 1300L)\n                .row(\"Detroit\", \"USA\", 3903000L, 3267L, 1200L)\n                .row(\"Barcelona\", \"Spain\", 3900000L, 803L, 4850L)\n                .row(\"Houston\", \"USA\", 3823000L, 3355L, 1150L)\n                .row(\"Athens\", \"Greece\", 3685000L, 684L, 5400L)\n                .row(\"Berlin\", \"Germany\", 3675000L, 984L, 3750L)\n                .row(\"Sydney\", \"Australia\", 3502000L, 1687L, 2100L)\n                .row(\"Atlanta\", \"USA\", 3500000L, 5083L, 700L)\n                .row(\"Guadalajara\", \"Mexico\", 3500000L, 596L, 5900L)\n                .row(\"San Francisco/Oakland\", \"USA\", 3229000L, 1365L, 2350L)\n                .row(\"Montreal.\", \"Canada\", 3216000L, 1740L, 1850L)\n                .row(\"Monterey\", \"Mexico\", 3200000L, 479L, 6700L)\n                .row(\"Melbourne\", \"Australia\", 3162000L, 2080L, 1500L)\n                .row(\"Ankara\", \"Turkey\", 3100000L, 583L, 5300L)\n                .row(\"Recife\", \"Brazil\", 3025000L, 376L, 8050L)\n                .row(\"Phoenix/Mesa\", \"USA\", 2907000L, 2069L, 1400L)\n                .row(\"Durban\", \"South Africa\", 2900000L, 829L, 3500L)\n                .row(\"Porto Alegre\", \"Brazil\", 2800000L, 583L, 4800L)\n                .row(\"Dalian\", \"China\", 2750000L, 389L, 7100L)\n                .row(\"Jeddah\", \"Saudi Arabia\", 2750000L, 777L, 3550L)\n                .row(\"Seattle\", \"USA\", 2712000L, 2470L, 1100L)\n                .row(\"Cape Town\", \"South Africa\", 2700000L, 686L, 3950L)\n                .row(\"San Diego\", \"USA\", 2674000L, 2026L, 1300L)\n                .row(\"Fortaleza\", \"Brazil\", 2650000L, 583L, 4550L)\n                .row(\"Curitiba\", \"Brazil\", 2500000L, 648L, 3850L)\n                .row(\"Rome\", \"Italy\", 2500000L, 842L, 2950L)\n                .row(\"Naples\", \"Italy\", 2400000L, 583L, 4100L)\n                .row(\"Minneapolis/St. Paul\", \"USA\", 2389000L, 2316L, 1050L)\n                .row(\"Tel Aviv\", \"Israel\", 2300000L, 453L, 5050L)\n                .row(\"Birmingham\", \"UK\", 2284000L, 600L, 3800L)\n                .row(\"Frankfurt\", \"Germany\", 2260000L, 984L, 2300L)\n                .row(\"Lisbon\", \"Portugal\", 2250000L, 881L, 2550L)\n                .row(\"Manchester\", \"UK\", 2245000L, 558L, 4000L)\n                .row(\"San Juan\", \"Puerto Rico\", 2217000L, 2309L, 950L)\n                .row(\"Katowice\", \"Poland\", 2200000L, 544L, 4050L)\n                .row(\"Tashkent\", \"Uzbekistan\", 2200000L, 531L, 4150L)\n                .row(\"Fukuoka\", \"Japan\", 2150000L, 544L, 3950L)\n                .row(\"Baku/Sumqayit\", \"Azerbaijan\", 2100000L, 544L, 3850L)\n                .row(\"St. Louis\", \"USA\", 2078000L, 2147L, 950L)\n                .row(\"Baltimore\", \"USA\", 2076000L, 1768L, 1150L)\n                .row(\"Sapporo\", \"Japan\", 2075000L, 414L, 5000L)\n                .row(\"Tampa/St. Petersburg\", \"USA\", 2062000L, 2078L, 1000L)\n                .row(\"Taichung\", \"Taiwan\", 2000000L, 510L, 3900L)\n                .row(\"Warsaw\", \"Poland\", 2000000L, 466L, 4300L)\n                .row(\"Denver\", \"USA\", 1985000L, 1292L, 1550L)\n                .row(\"Cologne/Bonn\", \"Germany\", 1960000L, 816L, 2400L)\n                .row(\"Hamburg\", \"Germany\", 1925000L, 829L, 2300L)\n                .row(\"Dubai\", \"UAE\", 1900000L, 712L, 2650L)\n                .row(\"Pretoria\", \"South Africa\", 1850000L, 673L, 2750L)\n                .row(\"Vancouver\", \"Canada\", 1830000L, 1120L, 1650L)\n                .row(\"Beirut\", \"Lebanon\", 1800000L, 648L, 2800L)\n                .row(\"Budapest\", \"Hungary\", 1800000L, 702L, 2550L)\n                .row(\"Cleveland\", \"USA\", 1787000L, 1676L, 1050L)\n                .row(\"Pittsburgh\", \"USA\", 1753000L, 2208L, 800L)\n                .row(\"Campinas\", \"Brazil\", 1750000L, 492L, 3550L)\n                .row(\"Harare\", \"Zimbabwe\", 1750000L, 712L, 2450L)\n                .row(\"Brasilia\", \"Brazil\", 1625000L, 583L, 2800L)\n                .row(\"Kuwait\", \"Kuwait\", 1600000L, 544L, 2950L)\n                .row(\"Munich\", \"Germany\", 1600000L, 518L, 3100L)\n                .row(\"Portland\", \"USA\", 1583000L, 1228L, 1300L)\n                .row(\"Brussels\", \"Belgium\", 1570000L, 712L, 2200L)\n                .row(\"Vienna\", \"Austria\", 1550000L, 453L, 3400L)\n                .row(\"San Jose\", \"USA\", 1538000L, 674L, 2300L)\n                .row(\"Damman\", \"Saudi Arabia\", 1525000L, 673L, 2250L)\n                .row(\"Copenhagen\", \"Denmark\", 1525000L, 816L, 1850L)\n                .row(\"Brisbane\", \"Australia\", 1508000L, 1603L, 950L)\n                .row(\"Riverside/San Bernardino\", \"USA\", 1507000L, 1136L, 1350L)\n                .row(\"Cincinnati\", \"USA\", 1503000L, 1740L, 850L)\n                .row(\"Accra\", \"Ghana\", 1500000L, 453L, 3300L)\n                .buildDataSet());\n\n        DataSet result = dataSetManager.lookupDataSet(\n                DataSetFactory.newDataSetLookupBuilder()\n                        .dataset(\"worldPopulation\")\n                        .group(COUNTRY)\n                        .column(COUNTRY)\n                        .column(POPULATION, AggregateFunctionType.SUM)\n                        .column(AREA_SIZE, AggregateFunctionType.SUM)\n                        .buildLookup());\n\n        result.setUUID(\"countryPopulation\");\n        dataSetManager.registerDataSet(result);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/prototypes/DisplayerPrototypes.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.prototypes;\n\nimport java.util.EnumMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.MapColorScheme;\n\nimport static org.dashbuilder.displayer.client.prototypes.DataSetPrototypes.*;\n\n@ApplicationScoped\npublic class DisplayerPrototypes {\n\n    protected DataSetPrototypes dataSetPrototypes;\n\n    protected UUIDGenerator uuidGenerator;\n\n    protected Map<DisplayerType, DisplayerSettings> prototypeMap = new EnumMap<>(DisplayerType.class);\n    protected Map<DisplayerSubType, DisplayerSettings> subprotoMap = new EnumMap<>(DisplayerSubType.class);\n\n    public DisplayerPrototypes() {\n    }\n\n    @Inject\n    public DisplayerPrototypes(DataSetPrototypes dataSetPrototypes, UUIDGenerator uuidGenerator) {\n        this.dataSetPrototypes = dataSetPrototypes;\n        this.uuidGenerator = uuidGenerator;\n        init();\n    }\n\n    public void init() {\n        prototypeMap.put(DisplayerType.PIECHART, DisplayerSettingsFactory\n                .newPieChartSettings()\n                .uuid(\"pieChartPrototype\")\n                .dataset(dataSetPrototypes.getContinentPopulation())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .column(POPULATION)\n                .expression(\"value/1000000\")\n                .format(\"Population\", \"#,### M\")\n                .width(500).height(300)\n                .margins(10, 10, 10, 100)\n                .legendOn(\"right\")\n                .set3d(true)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.BARCHART, DisplayerSettingsFactory\n                .newBarChartSettings()\n                .subType_Bar()\n                .uuid(\"barChartPrototype\")\n                .dataset(dataSetPrototypes.getTopRichCountries())\n                .title(\"Top Rich Countries\")\n                .titleVisible(false)\n                .column(COUNTRY).format(\"Country\")\n                .column(GDP_2013).format(\"2013\", \"$ #,### M\")\n                .column(GDP_2014).format(\"2014\", \"$ #,### M\")\n                .width(500).height(250)\n                .margins(10, 40, 100, 50)\n                .legendOn(\"right\")\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.LINECHART, DisplayerSettingsFactory\n                .newLineChartSettings()\n                .uuid(\"lineChartPrototype\")\n                .dataset(dataSetPrototypes.getContinentPopulation())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .column(POPULATION)\n                .expression(\"value/1000000\")\n                .format(\"Population\", \"#,### M\")\n                .width(500).height(300)\n                .margins(10, 40, 90, 10)\n                .legendOff()\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.AREACHART, DisplayerSettingsFactory\n                .newAreaChartSettings()\n                .uuid(\"areaChartPrototype\")\n                .dataset(dataSetPrototypes.getContinentPopulation())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .column(POPULATION)\n                .expression(\"value/1000000\")\n                .format(\"Population\", \"#,### M\")\n                .width(500).height(300)\n                .margins(10, 40, 90, 10)\n                .legendOff()\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.BUBBLECHART, DisplayerSettingsFactory\n                .newBubbleChartSettings()\n                .uuid(\"bubbleChartPrototype\")\n                .dataset(dataSetPrototypes.getContinentPopulationExt())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .width(500).height(300)\n                .margins(10, 30, 50, 10)\n                .legendOff()\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.METERCHART, DisplayerSettingsFactory\n                .newMeterChartSettings()\n                .uuid(\"meterChartPrototype\")\n                .dataset(dataSetPrototypes.getContinentPopulation())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .width(400).height(300)\n                .column(POPULATION)\n                .expression(\"value/1000000\")\n                .format(\"Population\", \"#,### M\")\n                .margins(10, 10, 10, 10)\n                .meter(0, 1000L, 3000L, 6000L)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        DisplayerSettings metricCard = DisplayerSettingsFactory\n                .newMetricSettings()\n                .uuid(\"metricCardPrototype\")\n                .dataset(dataSetPrototypes.getTotalPopulation())\n                .column(POPULATION).format(\"Population\", \"#,##0 MM\")\n                .subtype(DisplayerSubType.METRIC_CARD)\n                .title(\"World population\")\n                .titleVisible(true)\n                .width(200).height(100)\n                .margins(0, 0, 0, 0)\n                .backgroundColor(\"white\")\n                .filterOn(false, false, true)\n                .htmlTemplate(\"<div id=\\\"${this}\\\" class=\\\"card-pf card-pf-accented card-pf-aggregate-status\\\" \" +\n                        \"style=\\\"background-color:${bgColor}; width:${width}px; height:${height}px; \" +\n                        \"margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;\\\">\\n\" +\n                        \"  <h3>${title}</h3>\\n\" +\n                        \"  <h2>${value}</h2>\\n\" +\n                        \"</div>\")\n                .jsTemplate(\"if (${isFilterEnabled}) {  \\n\" +\n                        \"  var filterOn = false;\\n\" +\n                        \"  ${this}.style.cursor=\\\"pointer\\\";\\n\" +\n                        \"\\n\" +\n                        \"  ${this}.onmouseover = function() {\\n\" +\n                        \"    if (!filterOn) ${this}.style.backgroundColor = \\\"lightblue\\\";\\n\" +\n                        \"  };\\n\" +\n                        \"  ${this}.onmouseout = function() {\\n\" +\n                        \"    if (!filterOn) ${this}.style.backgroundColor = \\\"${bgColor}\\\";\\n\" +\n                        \"  };\\n\" +\n                        \"  ${this}.onclick = function() {\\n\" +\n                        \"    filterOn = !filterOn;\\n\" +\n                        \"    ${this}.style.backgroundColor = filterOn ? \\\"lightblue\\\" : \\\"${bgColor}\\\";\\n\" +\n                        \"    ${doFilter};\\n\" +\n                        \"  };\\n\" +\n                        \"}\")\n                .buildSettings();\n\n        DisplayerSettings metricCard2 = DisplayerSettingsFactory\n                .newMetricSettings()\n                .uuid(\"metricCard2Prototype\")\n                .dataset(dataSetPrototypes.getTotalPopulation())\n                .column(POPULATION).format(\"Population\", \"#,##0 MM\")\n                .subtype(DisplayerSubType.METRIC_CARD2)\n                .title(\"World population\")\n                .titleVisible(true)\n                .width(200).height(100)\n                .margins(0, 0, 0, 0)\n                .backgroundColor(\"white\")\n                .filterOn(false, false, true)\n                .htmlTemplate(\"<h2 class=\\\"card-pf-title\\\">\\n\" +\n                        \"    ${title}\\n\" +\n                        \"  </h2>\\n\" +\n                        \"<div class=\\\"card-pf-body\\\">\\n\" +\n                        \"   <p class=\\\"card-pf-utilization-details\\\">\\n\" +\n                        \"      <span class=\\\"card-pf-utilization-card-details-count\\\">${value}</span>\\n\" +\n                        \"        <span class=\\\"card-pf-utilization-card-details-description\\\">\\n\" +\n                        \"          <span class=\\\"card-pf-utilization-card-details-line-1\\\">people</span>\\n\" +\n                        \"          <span class=\\\"card-pf-utilization-card-details-line-2\\\">in the world</span>\\n\" +\n                        \"        </span>\\n\" +\n                        \"   </p>\\n\" +\n                        \"</div>\")\n                .buildSettings();\n\n        DisplayerSettings metricQuota = DisplayerSettingsFactory\n                .newMetricSettings()\n                .uuid(\"metricQuotaPrototype\")\n                .dataset(dataSetPrototypes.getTotalPopulation())\n                .column(POPULATION).format(\"Population\", \"#,##0 MM\")\n                .subtype(DisplayerSubType.METRIC_QUOTA)\n                .title(\"World population\")\n                .titleVisible(true)\n                .width(200).height(100)\n                .margins(0, 0, 0, 0)\n                .metric(0, 0, 0, 100000)\n                .filterOn(false, false, true)\n                .htmlTemplate(\"<div class=\\\"progress-description\\\">\\n\" +\n                        \"   ${title}\\n\" +\n                        \"</div>\\n\" +\n                        \"<div class=\\\"progress progress-label-top-right\\\">\\n\" +\n                        \"  <div id=\\\"${bar}\\\" class=\\\"progress-bar\\\" role=\\\"progressbar\\\" data-toggle=\\\"tooltip\\\" title=\\\"${value}\\\">\\n\" +\n                        \"    <span><strong>${value}</strong></span>\\n\" +\n                        \"  </div>\\n\" +\n                        \"  <div class=\\\"progress-bar progress-bar-remaining\\\" role=\\\"progressbar\\\" data-toggle=\\\"tooltip\\\">\\n\" +\n                        \"  </div>\\n\" +\n                        \"</div>\")\n                .jsTemplate(\"var end = ${value.end};\\n\" +\n                        \"var current = Math.round(${value.raw} * 100 / end);\\n\" +\n                        \"${bar}.style.width = current + \\\"%\\\";\")\n                .buildSettings();\n\n        DisplayerSettings metricPlainText = DisplayerSettingsFactory\n                .newMetricSettings()\n                .uuid(\"metricPlainTextPrototype\")\n                .dataset(dataSetPrototypes.getTotalPopulation())\n                .column(POPULATION).format(\"Population\", \"#,##0 MM\")\n                .subtype(DisplayerSubType.METRIC_PLAIN_TEXT)\n                .title(\"World population \")\n                .titleVisible(true)\n                .width(200).height(100)\n                .margins(0, 0, 0, 0)\n                .metric(0, 50000, 75000, 100000)\n                .filterOn(false, false, true)\n                .htmlTemplate(\"<div>\\n\" +\n                        \"  ${title}: <span id=\\\"${valref}\\\" style=\\\"font-weight: bold\\\">${value}</span>\\n\" +\n                        \"</div>\\n\")\n                .jsTemplate(\"if (${value.raw} > ${value.critical}) {  \\n\" +\n                        \"    ${valref}.style.color = \\\"red\\\"; \\n\" +\n                        \"} else if (${value.raw} > ${value.warning}) {  \\n\" +\n                        \"    ${valref}.style.color = \\\"yellow\\\"; \\n\" +\n                        \"} else {\\n\" +\n                        \"    ${valref}.style.color = \\\"black\\\";\\n\" +\n                        \"}\")\n                .buildSettings();\n\n        prototypeMap.put(DisplayerType.METRIC, metricCard);\n        subprotoMap.put(DisplayerSubType.METRIC_CARD, metricCard);\n        subprotoMap.put(DisplayerSubType.METRIC_CARD2, metricCard2);\n        subprotoMap.put(DisplayerSubType.METRIC_QUOTA, metricQuota);\n        subprotoMap.put(DisplayerSubType.METRIC_PLAIN_TEXT, metricPlainText);\n\n        prototypeMap.put(DisplayerType.MAP, DisplayerSettingsFactory\n                .newMapChartSettings()\n                .uuid(\"mapChartPrototype\")\n                .dataset(dataSetPrototypes.getCountryPopulation())\n                .title(\"World Population\")\n                .titleVisible(false)\n                .width(500).height(300)\n                .margins(10, 10, 10, 10)\n                .filterOn(false, true, true)\n                .colorScheme(MapColorScheme.GREEN)\n                .buildSettings());\n\n        prototypeMap.put(DisplayerType.TABLE, DisplayerSettingsFactory\n                .newTableSettings()\n                .uuid(\"tablePrototype\")\n                .dataset(dataSetPrototypes.getWorldPopulation())\n                .title(\"Population per Continent\")\n                .titleVisible(false)\n                .column(POPULATION)\n                .expression(\"value/1000000\")\n                .format(\"Population\", \"#,### M\")\n                .tableOrderEnabled(true)\n                .tableOrderDefault(POPULATION, SortOrder.DESCENDING)\n                .tablePageSize(10)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n\n        prototypeMap.put(DisplayerType.EXTERNAL_COMPONENT, DisplayerSettingsFactory\n                         .newExternalDisplayerSettings()\n                         .uuid(\"externalComponentPrototype\")\n                         .dataset(dataSetPrototypes.getTopRichCountries())\n                         .column(COUNTRY).format(\"Country\")\n                         .column(GDP_2014)\n                         .column(GDP_2013)\n                         .buildSettings());\n        \n        DisplayerSettings selectorDropDown = DisplayerSettingsFactory\n                .newSelectorSettings()\n                .uuid(\"selectorDropDownPrototype\")\n                .dataset(dataSetPrototypes.getTopRichCountries())\n                .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n                .title(\"Country selector\").titleVisible(true)\n                .column(COUNTRY).format(\"Country\")\n                .width(200)\n                .multiple(true)\n                .filterOn(false, true, false)\n                .buildSettings();\n\n        DisplayerSettings selectorLabels = DisplayerSettingsFactory\n                .newSelectorSettings()\n                .uuid(\"selectorLabelsPrototype\")\n                .dataset(dataSetPrototypes.getTopRichCountries())\n                .subtype(DisplayerSubType.SELECTOR_LABELS)\n                .title(\"Country selector\").titleVisible(true)\n                .column(COUNTRY).format(\"Country\")\n                .width(-1)\n                .multiple(true)\n                .filterOn(false, true, false)\n                .buildSettings();\n\n        DisplayerSettings selectorSlider = DisplayerSettingsFactory\n                .newSelectorSettings()\n                .uuid(\"selectorSliderPrototype\")\n                .dataset(dataSetPrototypes.getPopulationLimits())\n                .subtype(DisplayerSubType.SELECTOR_SLIDER)\n                .title(\"World population\").titleVisible(true)\n                .column(POPULATION).format(\"Population\", \"#,##0 MM\").expression(\"value/1000000\")\n                .margins(0, 0, 0, 0)\n                .width(-1)\n                .filterOn(false, true, false)\n                .buildSettings();\n\n        prototypeMap.put(DisplayerType.SELECTOR, selectorDropDown);\n        subprotoMap.put(DisplayerSubType.SELECTOR_DROPDOWN, selectorDropDown);\n        subprotoMap.put(DisplayerSubType.SELECTOR_LABELS, selectorLabels);\n        subprotoMap.put(DisplayerSubType.SELECTOR_SLIDER, selectorSlider);\n    }\n\n    public DisplayerSettings getProto(DisplayerType type) {\n        return getProto(type, null);\n    }\n\n    public DisplayerSettings getProto(DisplayerType type, DisplayerSubType subType) {\n        boolean hasSubproto = subType != null && subprotoMap.containsKey(subType);\n        DisplayerSettings proto = hasSubproto ? subprotoMap.get(subType) : prototypeMap.get(type);\n        proto = proto.cloneInstance();\n        proto.setUUID(uuidGenerator.newUuid());\n        if (subType != null) {\n            proto.setSubtype(subType);\n        }\n        return proto;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants extends Messages {\n\n    CommonConstants INSTANCE = GWT.create( CommonConstants.class );\n\n    String ok();\n\n    String cancel();\n\n    String error();\n\n    String cause();\n\n    // Common settings editor literals\n\n    String dataset_editor_notfound();\n\n    String common_button_addnew();\n\n    String common_dropdown_select();\n\n    String settingsEditor_caption();\n\n    String settingsJsonSource_caption();\n\n    String common_group();\n\n    String common_showTitle();\n\n    String common_title();\n\n    String common_title_placeholder();\n\n    String common_export();\n\n    String common_allowCSV();\n\n    String common_allowExcel();\n\n    String common_renderer();\n\n    String common_columns();\n\n    String columns_name();\n\n    String columns_pattern();\n\n    String columns_expression();\n\n    String columns_emptyvalue();\n\n    String common_columns_placeholder();\n\n    String refresh_group();\n\n    String refresh_interval();\n\n    String refresh_stale_data();\n\n    String chart_group();\n\n    String chart_width();\n\n    String chart_height();\n\n    String chart_bgColor();\n\n    String chart_marginGroup();\n\n    String chart_topMargin();\n\n    String chart_bottomMargin();\n\n    String chart_leftMargin();\n\n    String chart_rightMargin();\n\n    String chart_legendGroup();\n\n    String chart_legendShow();\n\n    String chart_legendPosition();\n\n    String chart_3d();\n\n    String table_group();\n\n    String table_pageSize();\n\n    String table_width();\n\n    String table_sortEnabled();\n\n    String table_sortColumn();\n\n    String table_sortColumn_placeholder();\n\n    String table_sortOrder();\n\n    String table_ascSortOrder();\n\n    String table_descSortOrder();\n\n    String table_columnPicker();\n\n    String axis_group();\n\n    String xaxis_showLabels();\n\n    String xaxis_angle();\n\n    String xaxis_title();\n\n    String xaxis_title_placeholder();\n\n    String yaxis_showLabels();\n\n    String yaxis_angle();\n\n    String yaxis_title();\n\n    String yaxis_title_placeholder();\n\n    String meter_group();\n\n    String meter_start();\n\n    String meter_warning();\n\n    String meter_critical();\n\n    String meter_end();\n\n    String filter_group();\n\n    String filter_enabled();\n\n    String filter_self();\n\n    String filter_listening();\n\n    String filter_notifications();\n\n    String selector_group();\n\n    String selector_width();\n\n    String selector_multiple();\n\n    String selector_show_inputs();\n\n    String filter_editor_selectcolumn();\n\n    String timeframe_from();\n\n    String timeframe_to();\n\n    String timeframe_first_month_year();\n\n    String case_sensitive();\n\n    String like_to_pattern_instructions();\n\n    String multiple_input_descriptions();\n\n    String group_columnid_label();\n\n    String dataset_groupdate_fixed_intervals();\n\n    String dataset_groupdate_empty_intervals();\n\n    String dataset_groupdate_interval_type();\n\n    String dataset_groupdate_max_intervals();\n\n    String dataset_groupdate_firstday();\n\n    String dataset_groupdate_firstmonth();\n\n    String settings_validation_integer();\n\n    String settings_validation_double();\n\n    String settings_validation_meter_unknown();\n\n    String settings_validation_meter_higher(String value);\n\n    String settings_validation_meter_lower(String value);\n\n    String settings_validation_meter_invalid();\n\n    // DataSetLookup editor literals\n\n    String dataset_dataset();\n\n    String dataset_filters();\n\n    String dataset_rows();\n\n    String dataset_columns();\n\n    String dataset_lookup_group_columns_all();\n\n    String dataset_lookup_dataset_notfound(String uuid);\n\n    String dataset_lookup_init_error();\n\n    // DisplayerEditor literals\n\n    String displayer_editor_title();\n\n    String displayer_editor_new();\n\n    String displayer_editor_dataset_notfound();\n\n    String displayer_editor_datasetmetadata_fetcherror();\n\n    String displayer_editor_dataset_nolookuprequest();\n\n    String displayer_editor_incompatible_settings();\n\n    String displayer_editor_tab_type();\n\n    String displayer_editor_tab_data();\n\n    String displayer_editor_tab_display();\n\n    String displayer_editor_view_as_table();\n\n    String renderer_selector_title();\n\n    String displayerlocator_default_renderer_undeclared(String targetType);\n\n    String displayerlocator_unsupported_displayer_renderer(String targetType, String rendererUuid);\n\n    String rendererliblocator_renderer_not_found(String renderer);\n\n    String rendererliblocator_multiple_renderers_found(String renderer);\n\n    String expand();\n\n    String collapse();\n\n    String removeFilter();\n\n    String renderermanager_renderer_not_available(String type);\n\n    String displayerviewer_displayer_not_created();\n\n    String chart_resizable();\n\n    String map_group();\n\n    String color_scheme();\n\n    String loadingComponent();\n    \n    String componentEditor();\n\n    String componentNotFound();\n\n    String noPropertiesComponent();\n\n    String componentConfigDefaultMessage();\n\n    String mandatoryHelpHeader();\n\n    String mandatoryHelpText();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface DisplayerConstants extends Messages {\n\n    DisplayerConstants INSTANCE = GWT.create(DisplayerConstants.class);\n\n    String initializing();\n\n    String error();\n\n    String error_settings_unset();\n\n    String error_handler_unset();\n\n    String error_dataset_notfound();\n\n    String displayer_keyword_not_allowed(String expr);\n\n    String displayer_expr_invalid_syntax(String expr);\n\n    String userDefinedVariableDescription();\n\n    String valueRawVariableDescription();\n\n    String valueStartVariableDescription();\n\n    String valueWarningVariableDescription();\n\n    String valueCriticalVariableDescription();\n\n    String valueEndVariableDescription();\n\n    String valueVariableDescription();\n\n    String titleVariableDescription();\n\n    String widthVariableDescription();\n\n    String heightVariableDescription();\n\n    String marginTopVariableDescription();\n\n    String marginBottomVariableDescription();\n\n    String marginRightVariableDescription();\n\n    String marginLeftVariableDescription();\n\n    String bgColorVariableDescription();\n\n    String isFilterEnabledVariableDescription();\n\n    String isFilterOnVariableDescription();\n\n    String isEmptyVariableDescription();\n\n    String doFilterVariableDescription();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/DisplayerHtmlConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface DisplayerHtmlConstants extends ConstantsWithLookup {\n\n    DisplayerHtmlConstants INSTANCE = GWT.create(DisplayerHtmlConstants.class);\n\n    String displayer_html_preview_link();\n\n    String displayer_source_code_html();\n\n    String displayer_source_code_javascript();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface DisplayerTypeConstants extends ConstantsWithLookup {\n\n    DisplayerTypeConstants INSTANCE = GWT.create(DisplayerTypeConstants.class);\n\n    String displayer_type_selector_tab_bar();\n\n    String displayer_type_selector_tab_pie();\n\n    String displayer_type_selector_tab_line();\n\n    String displayer_type_selector_tab_area();\n\n    String displayer_type_selector_tab_bubble();\n\n    String displayer_type_selector_tab_meter();\n\n    String displayer_type_selector_tab_metric();\n\n    String displayer_type_selector_tab_map();\n\n    String displayer_type_selector_tab_table();\n\n    String displayer_type_selector_tab_selector();\n\n    // Subtype enum literals\n\n    String DISPLAYER_SUBTYPE_LINE();\n\n    String DISPLAYER_SUBTYPE_SMOOTH();\n\n    String DISPLAYER_SUBTYPE_AREA();\n\n    String DISPLAYER_SUBTYPE_STACKED();\n\n    String DISPLAYER_SUBTYPE_STEPPED();\n\n    String DISPLAYER_SUBTYPE_BAR();\n\n    String DISPLAYER_SUBTYPE_BAR_STACKED();\n\n    String DISPLAYER_SUBTYPE_COLUMN();\n\n    String DISPLAYER_SUBTYPE_COLUMN_STACKED();\n\n    String DISPLAYER_SUBTYPE_HISTOGRAM();\n\n    String DISPLAYER_SUBTYPE_PIE();\n\n    String DISPLAYER_SUBTYPE_PIE_3D();\n\n    String DISPLAYER_SUBTYPE_DONUT();\n\n    String DISPLAYER_SUBTYPE_MAP_REGIONS();\n\n    String DISPLAYER_SUBTYPE_MAP_MARKERS();\n\n    String DISPLAYER_SUBTYPE_METRIC_CARD();\n\n    String DISPLAYER_SUBTYPE_METRIC_CARD2();\n\n    String DISPLAYER_SUBTYPE_METRIC_QUOTA();\n\n    String DISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT();\n\n    String DISPLAYER_SUBTYPE_SELECTOR_DROPDOWN();\n\n    String DISPLAYER_SUBTYPE_SELECTOR_LABELS();\n\n    String DISPLAYER_SUBTYPE_SELECTOR_SLIDER();\n\n    // Subtype selector tooltips\n\n    String BARCHART_BAR_tt();\n\n    String BARCHART_BAR_STACKED_tt();\n\n    String BARCHART_COLUMN_tt();\n\n    String BARCHART_COLUMN_STACKED_tt();\n\n    String PIECHART_PIE_tt();\n\n    String PIECHART_PIE_3D_tt();\n\n    String PIECHART_DONUT_tt();\n\n    String AREACHART_AREA_tt();\n\n    String AREACHART_AREA_STACKED_tt();\n\n    String LINECHART_LINE_tt();\n\n    String LINECHART_SMOOTH_tt();\n\n    String MAP_MAP_REGIONS_tt();\n\n    String MAP_MAP_MARKERS_tt();\n\n    String BUBBLECHART_default_tt();\n\n    String METERCHART_default_tt();\n\n    String METRIC_METRIC_CARD_tt();\n\n    String METRIC_METRIC_CARD2_tt();\n\n    String METRIC_METRIC_QUOTA_tt();\n\n    String METRIC_METRIC_PLAIN_TEXT_tt();\n\n    String TABLE_default_tt();\n    \n    String EXTERNAL_COMPONENT_default_tt();\n\n    String SELECTOR_SELECTOR_DROPDOWN_tt();\n\n    String SELECTOR_SELECTOR_LABELS_tt();\n\n    String SELECTOR_SELECTOR_SLIDER_tt();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface MapColorSchemeConstants extends ConstantsWithLookup {\n\n    public static final MapColorSchemeConstants INSTANCE = GWT.create(MapColorSchemeConstants.class);\n\n    // MapColorScheme enum literals\n\n    String COLOR_SCHEME_RED();\n\n    String COLOR_SCHEME_BLUE();\n\n    String COLOR_SCHEME_GREEN();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/PositionConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface PositionConstants extends ConstantsWithLookup {\n\n    public static final PositionConstants INSTANCE = GWT.create(PositionConstants.class);\n\n    // Position enum literals\n\n    String POSITION_BOTTOM();\n\n    String POSITION_TOP();\n\n    String POSITION_LEFT();\n\n    String POSITION_RIGHT();\n\n    String POSITION_IN();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface SourceCodeEditorConstants extends Messages {\n\n    SourceCodeEditorConstants INSTANCE = GWT.create( SourceCodeEditorConstants.class );\n\n    String add_variable();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface SourceCodeValidatorConstants extends Messages {\n\n    SourceCodeValidatorConstants INSTANCE = GWT.create( SourceCodeValidatorConstants.class );\n\n    String js_keyword_not_allowed(String expr);\n\n    String js_variable_not_found(String var);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/resources/images/DisplayerImagesResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.images;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundleWithLookup;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface DisplayerImagesResources extends ClientBundleWithLookup {\n\n    DisplayerImagesResources INSTANCE = GWT.create(DisplayerImagesResources.class);\n\n    String DEFAULT_SUFFIX = \"_default\";\n    String SELECTED_SUFFIX = \"_selected\";\n    String UNSELECTED_SUFFIX = \"_unselected\";\n\n    // Convention for image resource method names: type_subtype_selected/unselected\n\n    // TODO replace images with own harvest\n\n    @Source(\"bar_selected.png\")\n    ImageResource BARCHART_BAR_selected();\n\n    @Source(\"bar_unselected.png\")\n    ImageResource BARCHART_BAR_unselected();\n\n    @Source(\"bar_stacked_selected.png\")\n    ImageResource BARCHART_BAR_STACKED_selected();\n\n    @Source(\"bar_stacked_unselected.png\")\n    ImageResource BARCHART_BAR_STACKED_unselected();\n\n    @Source(\"column_selected.png\")\n    ImageResource BARCHART_COLUMN_selected();\n\n    @Source(\"column_unselected.png\")\n    ImageResource BARCHART_COLUMN_unselected();\n\n    @Source(\"column_stacked_selected.png\")\n    ImageResource BARCHART_COLUMN_STACKED_selected();\n\n    @Source(\"column_stacked_unselected.png\")\n    ImageResource BARCHART_COLUMN_STACKED_unselected();\n\n    @Source(\"pie_selected.png\")\n    ImageResource PIECHART_PIE_selected();\n\n    @Source(\"pie_unselected.png\")\n    ImageResource PIECHART_PIE_unselected();\n\n    @Source(\"pie_3d_selected.png\")\n    ImageResource PIECHART_PIE_3D_selected();\n\n    @Source(\"pie_3d_unselected.png\")\n    ImageResource PIECHART_PIE_3D_unselected();\n\n    @Source(\"donut_selected.png\")\n    ImageResource PIECHART_DONUT_selected();\n\n    @Source(\"donut_unselected.png\")\n    ImageResource PIECHART_DONUT_unselected();\n\n    @Source(\"area_selected.png\")\n    ImageResource AREACHART_AREA_selected();\n\n    @Source(\"area_unselected.png\")\n    ImageResource AREACHART_AREA_unselected();\n\n    @Source(\"area_stacked_selected.png\")\n    ImageResource AREACHART_AREA_STACKED_selected();\n\n    @Source(\"area_stacked_unselected.png\")\n    ImageResource AREACHART_AREA_STACKED_unselected();\n\n    @Source(\"line_selected.png\")\n    ImageResource LINECHART_LINE_selected();\n\n    @Source(\"line_unselected.png\")\n    ImageResource LINECHART_LINE_unselected();\n\n    @Source(\"line_smooth_selected.png\")\n    ImageResource LINECHART_SMOOTH_selected();\n\n    @Source(\"line_smooth_unselected.png\")\n    ImageResource LINECHART_SMOOTH_unselected();\n\n    @Source(\"map_regions_selected.png\")\n    ImageResource MAP_MAP_REGIONS_selected();\n\n    @Source(\"map_regions_unselected.png\")\n    ImageResource MAP_MAP_REGIONS_unselected();\n\n    @Source(\"map_markers_selected.png\")\n    ImageResource MAP_MAP_MARKERS_selected();\n\n    @Source(\"map_markers_unselected.png\")\n    ImageResource MAP_MAP_MARKERS_unselected();\n\n    @Source(\"bubble_default.png\")\n    ImageResource BUBBLECHART_default();\n\n    @Source(\"meter_default.png\")\n    ImageResource METERCHART_default();\n\n    @Source(\"metric_card_selected.png\")\n    ImageResource METRIC_METRIC_CARD_selected();\n\n    @Source(\"metric_card_unselected.png\")\n    ImageResource METRIC_METRIC_CARD_unselected();\n\n    @Source(\"metric_card2_selected.png\")\n    ImageResource METRIC_METRIC_CARD2_selected();\n\n    @Source(\"metric_card2_unselected.png\")\n    ImageResource METRIC_METRIC_CARD2_unselected();\n\n    @Source(\"metric_quota_selected.png\")\n    ImageResource METRIC_METRIC_QUOTA_selected();\n\n    @Source(\"metric_quota_unselected.png\")\n    ImageResource METRIC_METRIC_QUOTA_unselected();\n\n    @Source(\"metric_plaintext_selected.png\")\n    ImageResource METRIC_METRIC_PLAIN_TEXT_selected();\n\n    @Source(\"metric_plaintext_unselected.png\")\n    ImageResource METRIC_METRIC_PLAIN_TEXT_unselected();\n\n    @Source(\"selector_dropdown_selected.png\")\n    ImageResource SELECTOR_SELECTOR_DROPDOWN_selected();\n\n    @Source(\"selector_dropdown_unselected.png\")\n    ImageResource SELECTOR_SELECTOR_DROPDOWN_unselected();\n\n    @Source(\"selector_labels_selected.png\")\n    ImageResource SELECTOR_SELECTOR_LABELS_selected();\n\n    @Source(\"selector_labels_unselected.png\")\n    ImageResource SELECTOR_SELECTOR_LABELS_unselected();\n\n    @Source(\"selector_slider_selected.png\")\n    ImageResource SELECTOR_SELECTOR_SLIDER_selected();\n\n    @Source(\"selector_slider_unselected.png\")\n    ImageResource SELECTOR_SELECTOR_SLIDER_unselected();\n\n    @Source(\"table_default.png\")\n    ImageResource TABLE_default();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DataSetLookupEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.DataSetOpType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetMetadataCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.displayer.client.events.DataSetFilterChangedEvent;\nimport org.dashbuilder.displayer.client.events.DataSetGroupDateChanged;\nimport org.dashbuilder.displayer.client.events.DataSetLookupChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionDeletedEvent;\nimport org.dashbuilder.displayer.client.widgets.filter.DataSetFilterEditor;\nimport org.dashbuilder.displayer.client.widgets.group.ColumnFunctionEditor;\nimport org.dashbuilder.displayer.client.widgets.group.DataSetGroupDateEditor;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class DataSetLookupEditor implements IsWidget {\n\n    public interface View extends UberView<DataSetLookupEditor> {\n\n        void clearAll();\n\n        void clearDataSetSelector();\n\n        void enableDataSetSelectorHint();\n\n        void addDataSetItem(String name,\n                            String id);\n\n        void removeDataSetItem(int index);\n\n        void setSelectedDataSetIndex(int index);\n\n        String getSelectedDataSetId();\n\n        void error(ClientRuntimeError error);\n\n        void errorDataSetNotFound(String dataSetUUID);\n\n        void setFilterEnabled(boolean enabled);\n\n        void setGroupEnabled(boolean enabled);\n\n        void clearGroupColumnSelector();\n\n        void setGroupByDateEnabled(boolean enabled);\n\n        void setGroupColumnSelectorTitle(String title);\n\n        void enableGroupColumnSelectorHint();\n\n        void addGroupColumnItem(String column);\n\n        void setSelectedGroupColumnIndex(int index);\n\n        String getSelectedGroupColumnId();\n\n        void setColumnsSectionEnabled(boolean enabled);\n\n        void clearColumnList();\n\n        void setColumnSectionTitle(String title);\n\n        void setAddColumnOptionEnabled(boolean enabled);\n\n        void addColumnEditor(ColumnFunctionEditor editor);\n\n        void removeColumnEditor(ColumnFunctionEditor editor);\n    }\n\n    public interface DataSetDefFilter {\n\n        boolean accept(DataSetDef def);\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n    DataSetClientServices clientServices;\n    DataSetFilterEditor filterEditor;\n    DataSetGroupDateEditor groupDateEditor;\n    DataSetLookup dataSetLookup = null;\n    DataSetLookupConstraints lookupConstraints = null;\n    DataSetMetadata dataSetMetadata = null;\n    Event<DataSetLookupChangedEvent> changeEvent = null;\n    List<DataSetDef> _dataSetDefList = new ArrayList<DataSetDef>();\n    Map<Integer, ColumnFunctionEditor> _editorsMap = new HashMap<Integer, ColumnFunctionEditor>();\n\n    DataSetDefFilter dataSetDefFilter = new DataSetDefFilter() {\n\n        public boolean accept(DataSetDef def) {\n            return true;\n        }\n    };\n\n    @Inject\n    public DataSetLookupEditor(final View view,\n                               SyncBeanManager beanManager,\n                               DataSetFilterEditor filterEditor,\n                               DataSetGroupDateEditor groupDateEditor,\n                               DataSetClientServices clientServices,\n                               Event<DataSetLookupChangedEvent> event) {\n        this.view = view;\n        this.beanManager = beanManager;\n        this.filterEditor = filterEditor;\n        this.groupDateEditor = groupDateEditor;\n        this.clientServices = clientServices;\n        this.changeEvent = event;\n        this.dataSetLookup = null;\n        this.lookupConstraints = null;\n        this.dataSetMetadata = null;\n        view.init(this);\n    }\n\n    public void init(DataSetLookupConstraints lookupConstraints,\n                     final DataSetLookup dataSetLookup) {\n        this.dataSetLookup = dataSetLookup;\n        this.lookupConstraints = lookupConstraints;\n        this.view.clearAll();\n        this.clientServices.getPublicDataSetDefs((List<DataSetDef> dataSetDefs) -> {\n            showDataSetDefs(dataSetDefs);\n            if (dataSetLookup != null && dataSetLookup.getDataSetUUID() != null) {\n                fetchMetadata(dataSetLookup.getDataSetUUID(), (DataSetMetadata metadata) -> updateDataSetLookup());\n            }\n        });\n\n    }\n\n    void fetchMetadata(final String uuid,\n                       final RemoteCallback<DataSetMetadata> callback) {\n        try {\n            clientServices.fetchMetadata(uuid,\n                                         new DataSetMetadataCallback() {\n\n                                             public void callback(DataSetMetadata metadata) {\n                                                 dataSetMetadata = metadata;\n                                                 callback.callback(metadata);\n                                             }\n\n                                             public void notFound() {\n                                                 view.errorDataSetNotFound(uuid);\n                                             }\n\n                                             public boolean onError(ClientRuntimeError error) {\n                                                 view.error(error);\n                                                 return false;\n                                             }\n                                         });\n        } catch (Exception e) {\n            view.error(new ClientRuntimeError(e));\n        }\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public DataSetFilterEditor getFilterEditor() {\n        return filterEditor;\n    }\n\n    public DataSetGroupDateEditor getGroupDateEditor() {\n        return groupDateEditor;\n    }\n\n    public DataSetLookup getDataSetLookup() {\n        return dataSetLookup;\n    }\n\n    public DataSetLookupConstraints getLookupConstraints() {\n        return lookupConstraints;\n    }\n\n    public void setDataSetDefFilter(DataSetDefFilter dataSetDefFilter) {\n        this.dataSetDefFilter = dataSetDefFilter;\n    }\n\n    public String getDataSetUUID() {\n        return dataSetLookup == null ? null : dataSetLookup.getDataSetUUID();\n    }\n\n    public String getColumnId(int index) {\n        return dataSetMetadata.getColumnId(index);\n    }\n\n    public ColumnType getColumnType(int index) {\n        return dataSetMetadata.getColumnType(index);\n    }\n\n    public ColumnType getColumnType(String columnId) {\n        return columnId == null ? null : dataSetMetadata.getColumnType(columnId);\n    }\n\n    public DataSetGroup getFirstGroupOp() {\n        List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);\n        if (groupOpList.isEmpty()) {\n            return null;\n        }\n        return groupOpList.get(0);\n    }\n\n    public boolean isFirstGroupOpDateBased() {\n        DataSetGroup first = getFirstGroupOp();\n        if (first == null) {\n            return false;\n        }\n        ColumnGroup cg = first.getColumnGroup();\n        if (cg == null) {\n            return false;\n        }\n        ColumnType type = getColumnType(cg.getSourceId());\n        return ColumnType.DATE.equals(type);\n    }\n\n    public List<GroupFunction> getFirstGroupFunctions() {\n        List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);\n        if (groupOpList.isEmpty()) {\n            return null;\n        }\n        return groupOpList.get(0).getGroupFunctions();\n    }\n\n    public int getFirstGroupFunctionIdx(GroupFunction gf) {\n        List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);\n        if (groupOpList.isEmpty()) {\n            return -1;\n        }\n        return groupOpList.get(0).getGroupFunctionIdx(gf);\n    }\n\n    public String getFirstGroupColumnId() {\n        List<DataSetGroup> groupOpList = dataSetLookup.getOperationList(DataSetGroup.class);\n        if (groupOpList.isEmpty()) {\n            return null;\n        }\n        DataSetGroup groupOp = groupOpList.get(0);\n        if (groupOp.getColumnGroup() == null) {\n            return null;\n        }\n        return groupOp.getColumnGroup().getSourceId();\n    }\n\n    public List<Integer> getAvailableGroupColumnIdxs() {\n        List<Integer> result = new ArrayList<Integer>();\n        for (int i = 0; i < dataSetMetadata.getNumberOfColumns(); i++) {\n            ColumnType columnType = dataSetMetadata.getColumnType(i);\n            if (ColumnType.LABEL.equals(columnType) || ColumnType.DATE.equals(columnType) || ColumnType.NUMBER.equals(columnType)) {\n                result.add(i);\n            }\n        }\n        return result;\n    }\n\n    public void showDataSetDefs(List<DataSetDef> ds) {\n        _dataSetDefList.clear();\n        view.clearDataSetSelector();\n        String selectedUUID = getDataSetUUID();\n        if (StringUtils.isBlank(selectedUUID)) {\n            view.enableDataSetSelectorHint();\n        }\n\n        boolean found = false;\n        for (int i = 0; i < ds.size(); i++) {\n            DataSetDef def = ds.get(i);\n            if (dataSetDefFilter.accept(def)) {\n\n                addDataSetDef(def);\n\n                if (selectedUUID != null && selectedUUID.equals(def.getUUID())) {\n                    view.setSelectedDataSetIndex(i);\n                    found = true;\n                }\n            }\n        }\n        if (!StringUtils.isBlank(selectedUUID) && !found) {\n            view.errorDataSetNotFound(selectedUUID);\n        }\n    }\n\n    public void addDataSetDef(DataSetDef def) {\n        _dataSetDefList.add(def);\n        if (StringUtils.isBlank(def.getName())) {\n            view.addDataSetItem(def.getUUID(),\n                                def.getUUID());\n        } else {\n            view.addDataSetItem(def.getName(),\n                                def.getUUID());\n        }\n    }\n\n    public void removeDataSetDef(DataSetDef def) {\n        int i = 0;\n        Iterator<DataSetDef> it = _dataSetDefList.iterator();\n        while (it.hasNext()) {\n            DataSetDef item = it.next();\n            if (item.getUUID().equals(def.getUUID())) {\n                it.remove();\n                view.removeDataSetItem(i);\n            }\n            i++;\n        }\n    }\n\n    void updateDataSetLookup() {\n        view.setFilterEnabled(false);\n        view.setGroupEnabled(false);\n        view.setColumnsSectionEnabled(false);\n\n        if (dataSetLookup != null && dataSetMetadata != null && lookupConstraints != null) {\n            updateFilterControls();\n            updateGroupControls();\n            updateColumnControls();\n        }\n    }\n\n    void updateFilterControls() {\n        view.setFilterEnabled(lookupConstraints.isFilterAllowed());\n        filterEditor.init(dataSetLookup.getFirstFilterOp(),\n                          dataSetMetadata);\n    }\n\n    void updateGroupControls() {\n\n        view.setGroupEnabled(false);\n        view.setGroupByDateEnabled(false);\n\n        // Only show the group controls if group is enabled\n        if (lookupConstraints.isGroupRequired() || lookupConstraints.isGroupAllowed()) {\n            String groupColumnId = getFirstGroupColumnId();\n\n            // Always ensure a group exists when required\n            if (lookupConstraints.isGroupRequired() && groupColumnId == null) {\n                dataSetLookup = lookupConstraints.newDataSetLookup(dataSetMetadata);\n                changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n            }\n\n            List<Integer> groupColumnIdxs = getAvailableGroupColumnIdxs();\n            String rowsTitle = lookupConstraints.getGroupsTitle();\n\n            view.setGroupEnabled(true);\n            if (isFirstGroupOpDateBased()) {\n                view.setGroupByDateEnabled(true);\n                ColumnGroup columnGroup = getFirstGroupOp().getColumnGroup();\n                groupDateEditor.init(columnGroup);\n            }\n\n            if (!StringUtils.isBlank(rowsTitle)) {\n                view.setGroupColumnSelectorTitle(rowsTitle);\n            }\n\n            view.clearGroupColumnSelector();\n            if (!lookupConstraints.isGroupRequired()) {\n                view.enableGroupColumnSelectorHint();\n            }\n            for (int i = 0; i < groupColumnIdxs.size(); i++) {\n                int idx = groupColumnIdxs.get(i);\n                String columnId = getColumnId(idx);\n                view.addGroupColumnItem(columnId);\n                if (groupColumnId != null && groupColumnId.equals(columnId)) {\n                    view.setSelectedGroupColumnIndex(i);\n                }\n            }\n        }\n    }\n\n    void updateColumnControls() {\n        String groupColumnId = getFirstGroupColumnId();\n        List<GroupFunction> groupFunctions = getFirstGroupFunctions();\n        String columnsTitle = lookupConstraints.getColumnsTitle();\n        boolean functionsRequired = lookupConstraints.isFunctionRequired();\n        boolean functionsEnabled = (groupColumnId != null || functionsRequired);\n        boolean canDelete = groupFunctions.size() > lookupConstraints.getMinColumns();\n        int n = lookupConstraints.getMaxColumns();\n        boolean canAdd = lookupConstraints.areExtraColumnsAllowed() && (n < 0 || groupFunctions.size() < n);\n\n        // Show the columns section\n        view.setColumnsSectionEnabled(true);\n        view.clearColumnList();\n        if (!StringUtils.isBlank(columnsTitle)) {\n            view.setColumnSectionTitle(columnsTitle);\n        }\n        view.setAddColumnOptionEnabled(canAdd);\n\n        // Destroy old editors\n        Iterator<ColumnFunctionEditor> it = _editorsMap.values().iterator();\n        while (it.hasNext()) {\n            ColumnFunctionEditor editor = it.next();\n            beanManager.destroyBean(editor);\n        }\n\n        // Build the column editors\n        _editorsMap.clear();\n        ColumnType lastTargetType = null;\n        ColumnType[] targetTypes = lookupConstraints.getColumnTypes(groupFunctions.size());\n        for (int i = 0; i < groupFunctions.size(); i++) {\n            final int columnIdx = i;\n            final GroupFunction groupFunction = groupFunctions.get(columnIdx);\n\n            if (targetTypes != null && i < targetTypes.length) {\n                lastTargetType = targetTypes[i];\n            }\n            if (columnIdx == 0 && groupColumnId != null && lookupConstraints.isGroupColumn()) {\n                continue;\n            }\n\n            ColumnType columnType = null;\n            if (targetTypes != null && i < targetTypes.length) {\n                columnType = targetTypes[columnIdx];\n            }\n            if (columnType == null) {\n                columnType = lastTargetType; // Extra columns\n            }\n\n            String columnTitle = lookupConstraints.getColumnTitle(columnIdx);\n            ColumnFunctionEditor columnEditor = beanManager.lookupBean(ColumnFunctionEditor.class).newInstance();\n            columnEditor.init(dataSetMetadata,\n                              groupFunction,\n                              columnType,\n                              columnTitle,\n                              functionsEnabled,\n                              canDelete);\n\n            _editorsMap.put(_editorsMap.size(),\n                            columnEditor);\n            view.addColumnEditor(columnEditor);\n        }\n    }\n\n    int getGroupFunctionLastIdx(List<GroupFunction> groupFunctions,\n                                String sourceId) {\n        int last = -1;\n        for (GroupFunction gf : groupFunctions) {\n            if (gf.getSourceId().equals(sourceId)) {\n                int idx = getGroupFunctionColumnIdx(gf.getColumnId());\n                if (last == -1 || last < idx) {\n                    last = idx;\n                }\n            }\n        }\n        return last;\n    }\n\n    int getGroupFunctionColumnIdx(String columnId) {\n        int sep = columnId.lastIndexOf('_');\n        if (sep != -1) {\n            try {\n                String str = columnId.substring(sep + 1);\n                return Integer.parseInt(str);\n            } catch (Exception e) {\n                // Ignore\n            }\n        }\n        return 1;\n    }\n\n    // View notifications\n\n    void onDataSetSelected() {\n        String selectedUUID = view.getSelectedDataSetId();\n        for (DataSetDef dataSetDef : _dataSetDefList) {\n            if (dataSetDef.getUUID().equals(selectedUUID)) {\n                fetchMetadata(selectedUUID,\n                              new RemoteCallback<DataSetMetadata>() {\n\n                                  public void callback(DataSetMetadata metadata) {\n                                      dataSetLookup = lookupConstraints.newDataSetLookup(metadata);\n                                      updateDataSetLookup();\n                                      changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n                                  }\n                              });\n            }\n        }\n    }\n\n    void onGroupColumnSelected() {\n        DataSetGroup groupOp = getFirstGroupOp();\n        if (groupOp != null) {\n\n            // Group reset\n            String columnId = view.getSelectedGroupColumnId();\n            if (columnId == null) {\n                groupOp.setColumnGroup(null);\n\n                if (lookupConstraints.isGroupColumn()) {\n                    groupOp.getGroupFunctions().remove(0);\n                }\n                if (!lookupConstraints.isFunctionRequired()) {\n                    for (GroupFunction groupFunction : groupOp.getGroupFunctions()) {\n                        groupFunction.setFunction(null);\n                    }\n                }\n            }\n            // Group column change\n            else {\n                groupOp.setColumnGroup(new ColumnGroup(columnId,\n                                                       columnId));\n                if (lookupConstraints.isGroupColumn()) {\n                    if (groupOp.getGroupFunctions().size() > 1) {\n                        groupOp.getGroupFunctions().remove(0);\n                    }\n                    GroupFunction groupFunction = new GroupFunction(columnId,\n                                                                    columnId,\n                                                                    null);\n                    groupOp.getGroupFunctions().add(0,\n                                                    groupFunction);\n                }\n            }\n        }\n\n        // Refresh the group by date editor if required\n        view.setGroupByDateEnabled(false);\n        if (isFirstGroupOpDateBased()) {\n            view.setGroupByDateEnabled(true);\n            ColumnGroup columnGroup = getFirstGroupOp().getColumnGroup();\n            groupDateEditor.init(columnGroup);\n        }\n\n        // Reset the column list\n        updateColumnControls();\n\n        // Notify the changes\n        changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n    }\n\n    void onAddColumn() {\n        if (lookupConstraints.areExtraColumnsAllowed()) {\n            DataSetGroup op = getFirstGroupOp();\n            List<GroupFunction> functionList = op.getGroupFunctions();\n            GroupFunction last = functionList.get(functionList.size() - 1);\n\n            GroupFunction clone = last.cloneInstance();\n            String newColumnId = lookupConstraints.buildUniqueColumnId(dataSetLookup,\n                                                                       clone);\n            clone.setColumnId(newColumnId);\n            functionList.add(clone);\n\n            updateColumnControls();\n            changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n        }\n    }\n\n    // DataSetFilterEditor events\n\n    void onFilterChanged(@Observes DataSetFilterChangedEvent event) {\n        DataSetFilter filterOp = event.getFilter();\n        dataSetLookup.removeOperations(DataSetOpType.FILTER);\n        if (filterOp != null) {\n            dataSetLookup.addOperation(0,\n                                       filterOp);\n        }\n        changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n    }\n\n    // DataSetGroupDateEditor events\n\n    void onDateGroupChanged(@Observes DataSetGroupDateChanged event) {\n        ColumnGroup columnGroup = event.getColumnGroup();\n        DataSetGroup groupOp = getFirstGroupOp();\n        if (groupOp != null) {\n            groupOp.setColumnGroup(columnGroup);\n\n            changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n        }\n    }\n\n    // ColumnFunctionEditor's events\n\n    void onColumnFunctionChanged(@Observes GroupFunctionChangedEvent event) {\n        GroupFunction gf = event.getGroupFunction();\n        String newColumnId = lookupConstraints.buildUniqueColumnId(dataSetLookup,\n                                                                   gf);\n        gf.setColumnId(newColumnId);\n        changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n    }\n\n    void onColumnFunctionDeleted(@Observes GroupFunctionDeletedEvent event) {\n        List<GroupFunction> functionList = getFirstGroupFunctions();\n        boolean canDelete = functionList.size() > lookupConstraints.getMinColumns();\n\n        GroupFunction removed = event.getGroupFunction();\n        int index = getFirstGroupFunctionIdx(removed);\n        if (canDelete && index >= 0) {\n\n            functionList.remove(index);\n            updateColumnControls();\n            changeEvent.fire(new DataSetLookupChangedEvent(dataSetLookup));\n        }\n    }\n\n    // Listen to data set lifecycle events\n\n    void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        addDataSetDef(event.getDataSetDef());\n    }\n\n    void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n\n        removeDataSetDef(event.getOldDataSetDef());\n        addDataSetDef(event.getNewDataSetDef());\n    }\n\n    void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n\n        removeDataSetDef(event.getDataSetDef());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DataSetLookupEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.client.widgets.filter.DataSetFilterEditor;\nimport org.dashbuilder.displayer.client.widgets.group.ColumnFunctionEditor;\nimport org.dashbuilder.displayer.client.widgets.group.DataSetGroupDateEditor;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\n@Dependent\npublic class DataSetLookupEditorView extends Composite\n        implements DataSetLookupEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetLookupEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    DataSetLookupEditor presenter;\n\n    @UiField\n    ListBox dataSetListBox;\n\n    @UiField\n    org.gwtbootstrap3.client.ui.Label statusLabel;\n\n    @UiField\n    Panel groupControlPanel;\n\n    @UiField\n    Label groupControlLabel;\n\n    @UiField\n    Icon groupDetailsIcon;\n\n    @UiField\n    ListBox groupColumnListBox;\n\n    @UiField\n    Panel groupDatePanel;\n\n    @UiField(provided = true)\n    DataSetGroupDateEditor groupDateEditor;\n\n    @UiField\n    Panel columnsControlPanel;\n\n    @UiField\n    Label columnsControlLabel;\n\n    @UiField\n    Panel columnsPanel;\n\n    @UiField\n    Button addColumnButton;\n\n    @UiField\n    Panel filtersControlPanel;\n\n    @UiField(provided = true)\n    DataSetFilterEditor filterEditor;\n\n    boolean dataSetSelectorHintEnabled = false;\n    boolean groupColumnSelectorHintEnabled = false;\n\n    @Override\n    public void init(DataSetLookupEditor presenter) {\n        this.presenter = presenter;\n        this.filterEditor = presenter.getFilterEditor();\n        this.groupDateEditor = presenter.getGroupDateEditor();\n        initWidget(uiBinder.createAndBindUi(this));\n\n        groupDetailsIcon.setType(IconType.ARROW_DOWN);\n        groupDetailsIcon.addDomHandler(this::expandCollapseGroupDetails, ClickEvent.getType());\n    }\n\n    @Override\n    public void clearAll() {\n        setFilterEnabled(false);\n        setGroupEnabled(false);\n        setColumnsSectionEnabled(false);\n        clearDataSetSelector();\n        clearGroupColumnSelector();\n        clearColumnList();\n    }\n\n    @Override\n    public void clearDataSetSelector() {\n        dataSetListBox.clear();\n    }\n\n    @Override\n    public void enableDataSetSelectorHint() {\n        dataSetListBox.addItem(CommonConstants.INSTANCE.common_dropdown_select());\n        dataSetSelectorHintEnabled = true;\n    }\n\n    @Override\n    public void addDataSetItem(String name, String id) {\n        dataSetListBox.addItem(name, id);\n    }\n\n    @Override\n    public void removeDataSetItem(int index) {\n        dataSetListBox.removeItem(dataSetSelectorHintEnabled ? index + 1 : index);\n    }\n\n    @Override\n    public void setSelectedDataSetIndex(int index) {\n        dataSetListBox.setSelectedIndex(dataSetSelectorHintEnabled ? index + 1 : index);\n    }\n\n    @Override\n    public String getSelectedDataSetId() {\n        int idx = dataSetListBox.getSelectedIndex();\n        if (dataSetSelectorHintEnabled && idx == 0) {\n            return null;\n        }\n        return dataSetListBox.getValue(idx);\n    }\n\n    @Override\n    public void errorDataSetNotFound(String dataSetUUID) {\n        statusLabel.setVisible(true);\n        statusLabel.setText(CommonConstants.INSTANCE.dataset_lookup_dataset_notfound(dataSetUUID));\n    }\n\n    @Override\n    public void error(ClientRuntimeError e) {\n        statusLabel.setVisible(true);\n        statusLabel.setText(e.getCause());\n\n        if (e.getThrowable() != null) {\n            GWT.log(e.getMessage(), e.getThrowable());\n        } else {\n            GWT.log(e.getMessage());\n        }\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        filtersControlPanel.setVisible(enabled);\n    }\n\n    @Override\n    public void setGroupEnabled(boolean enabled) {\n        groupControlPanel.setVisible(enabled);\n    }\n\n    @Override\n    public void clearGroupColumnSelector() {\n        groupColumnListBox.clear();\n    }\n\n    @Override\n    public void setGroupByDateEnabled(boolean enabled) {\n        groupDetailsIcon.setVisible(enabled);\n        if (!enabled) {\n            collapseGroupDatePanel();\n        }\n    }\n\n    public void collapseGroupDatePanel() {\n        groupDatePanel.setVisible(false);\n        groupDetailsIcon.setType(IconType.ARROW_DOWN);\n    }\n\n    public void expandGroupDatePanel() {\n        groupDatePanel.setVisible(true);\n        groupDetailsIcon.setType(IconType.ARROW_UP);\n    }\n\n    @Override\n    public void setGroupColumnSelectorTitle(String title) {\n        groupControlLabel.setText(title);\n    }\n\n    @Override\n    public void enableGroupColumnSelectorHint() {\n        groupColumnListBox.insertItem(CommonConstants.INSTANCE.dataset_lookup_group_columns_all(), 0);\n        groupColumnSelectorHintEnabled = true;\n    }\n\n    @Override\n    public void addGroupColumnItem(String column) {\n        groupColumnListBox.addItem(column);\n    }\n\n    @Override\n    public void setSelectedGroupColumnIndex(int index) {\n        groupColumnListBox.setSelectedIndex(groupColumnSelectorHintEnabled ? index + 1 : index);\n    }\n\n    @Override\n    public String getSelectedGroupColumnId() {\n        int index = groupColumnListBox.getSelectedIndex();\n        if (groupColumnSelectorHintEnabled && index == 0) {\n            return null;\n        }\n        return groupColumnListBox.getValue(index);\n    }\n\n    @Override\n    public void setColumnsSectionEnabled(boolean enabled) {\n        columnsControlPanel.setVisible(enabled);\n    }\n\n    @Override\n    public void clearColumnList() {\n        columnsPanel.clear();\n    }\n\n    @Override\n    public void setColumnSectionTitle(String title) {\n        columnsControlLabel.setText(title);\n    }\n\n    @Override\n    public void setAddColumnOptionEnabled(boolean enabled) {\n        addColumnButton.setVisible(enabled);\n    }\n\n    @Override\n    public void addColumnEditor(ColumnFunctionEditor editor) {\n        columnsPanel.add(editor);\n    }\n\n    @Override\n    public void removeColumnEditor(ColumnFunctionEditor editor) {\n        columnsPanel.remove(editor);\n    }\n\n    // UI events\n\n    @UiHandler(value = \"dataSetListBox\")\n    public void onDataSetSelected(ChangeEvent changeEvent) {\n        presenter.onDataSetSelected();\n    }\n\n    @UiHandler(value = \"addColumnButton\")\n    public void onAddColumnClicked(ClickEvent clickEvent) {\n        presenter.onAddColumn();\n    }\n\n    @UiHandler(value = \"groupColumnListBox\")\n    public void onGroupColumnChanged(ChangeEvent changeEvent) {\n        presenter.onGroupColumnSelected();\n    }\n\n    public void expandCollapseGroupDetails(ClickEvent event) {\n        if (groupDatePanel.isVisible()) {\n            collapseGroupDatePanel();\n        } else {\n            expandGroupDatePanel();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DataSetLookupEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:df=\"urn:import:org.dashbuilder.displayer.client.widgets.filter\"\n             xmlns:dg=\"urn:import:org.dashbuilder.displayer.client.widgets.group\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .statusLabel{\n      color: red;\n    }\n    .sectionLabel {\n      font-weight: bold;\n    }\n    .cellPaddingPanel {\n      padding: 3px;\n    }\n    .groupDatePanel {\n      width: 200px;\n      padding: 10px;\n      background: #dddddd;\n      border-radius: 5px;\n    }\n  </ui:style>\n\n  <g:FlowPanel>\n    <g:FlowPanel styleName=\"{style.cellPaddingPanel}\">\n      <b:Label ui:field=\"statusLabel\" visible=\"false\" styleName=\"{style.statusLabel}\" />\n      <g:Label styleName=\"{style.sectionLabel}\" text=\"{i18n.dataset_dataset}\"/>\n      <b:ListBox ui:field=\"dataSetListBox\" width=\"200px\" />\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"filtersControlPanel\" visible=\"false\" styleName=\"{style.cellPaddingPanel}\">\n      <g:Label styleName=\"{style.sectionLabel}\" text=\"{i18n.dataset_filters}\"/>\n      <df:DataSetFilterEditor ui:field=\"filterEditor\" />\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"groupControlPanel\" visible=\"false\" styleName=\"{style.cellPaddingPanel}\">\n      <g:Label ui:field=\"groupControlLabel\" styleName=\"{style.sectionLabel}\" text=\"{i18n.dataset_rows}\"/>\n      <g:HorizontalPanel styleName=\"{style.cellPaddingPanel}\">\n        <b:ListBox ui:field=\"groupColumnListBox\" width=\"200px\" />\n        <b:Icon type=\"ARROW_DOWN\" ui:field=\"groupDetailsIcon\" size=\"LARGE\"/>\n      </g:HorizontalPanel>\n      <g:FlowPanel ui:field=\"groupDatePanel\" visible=\"false\" styleName=\"{style.groupDatePanel}\">\n        <dg:DataSetGroupDateEditor ui:field=\"groupDateEditor\" />\n      </g:FlowPanel>\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"columnsControlPanel\" visible=\"false\" styleName=\"{style.cellPaddingPanel}\">\n        <g:Label ui:field=\"columnsControlLabel\" styleName=\"{style.sectionLabel}\" text=\"{i18n.dataset_columns}\"/>\n        <g:FlowPanel ui:field=\"columnsPanel\"/>\n        <b:Button ui:field=\"addColumnButton\" type=\"LINK\" visible=\"false\" text=\"{i18n.common_button_addnew}\"/>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.ValidationError;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractDisplayerListener;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DataSetLookupChangedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerEditorClosedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerEditorSavedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerSettingsChangedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerSubtypeSelectedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerTypeSelectedEvent;\nimport org.dashbuilder.displayer.client.prototypes.DisplayerPrototypes;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class DisplayerEditor implements IsWidget {\n\n    private static final int DEFAULT_SECTION = 0;\n    private static final int DATASET_LOOKUP_SECTION = 1;\n    private static final int DISPLAY_SETTINGS_SECTION = 2;\n    private static final int EXTERNAL_COMPONENT_SECTION = 3;\n\n    public interface View extends UberView<DisplayerEditor> {\n\n        String getBrandNewDisplayerTitle();\n\n        boolean isTableDisplayModeOn();\n\n        void setTableDisplayModeEnabled(boolean enabled);\n\n        void showDisplayer(IsWidget displayer);\n\n        void setTypeSelectionEnabled(boolean enabled);\n\n        void setDisplaySettingsEnabled(boolean enabled);\n\n        void setDataSetLookupConfEnabled(boolean enabled);\n\n        void setComponentSettingsEnabled(boolean enabled);\n\n        void goToTypeSelection(DisplayerTypeSelector typeSelector);\n\n        void goToDataSetLookupConf(DataSetLookupEditor lookupEditor);\n\n        void goToDisplaySettings(DisplayerSettingsEditor settingsEditor);\n\n        void showTypeChangedWarning(Command yes, Command no);\n\n        void error(String error);\n\n        void error(ClientRuntimeError error);\n\n        void gotoExternalComponentSettings(ExternalComponentPropertiesEditor externalComponentPropertiesEditor);\n\n    }\n\n    protected View view = null;\n    protected DataSetClientServices clientServices = null;\n    protected DisplayerLocator displayerLocator = null;\n    protected DisplayerPrototypes displayerPrototypes = null;\n    protected DisplayerSettings displayerSettings = null;\n    protected DisplayerSettings selectedTypeSettings = null;\n    protected boolean brandNewDisplayer = true;\n    protected DisplayerTypeSelector typeSelector;\n    protected DataSetLookupEditor lookupEditor;\n    protected DisplayerSettingsEditor settingsEditor;\n    protected DisplayerEditorStatus editorStatus;\n    protected Displayer displayer = null;\n    protected DisplayerHtmlEditor displayerHtmlEditor = null;\n    protected int activeSection = -1;\n    protected boolean typeSelectionEnabled = true;\n    protected boolean dataLookupConfEnabled = true;\n    protected boolean displaySettingsEnabled = true;\n    protected boolean externalComponentSettingsEnabled = false;\n    protected Event<DisplayerEditorSavedEvent> saveEvent;\n    protected Event<DisplayerEditorClosedEvent> closeEvent;\n    protected Command onCloseCommand = () -> {\n    };\n    protected Command onSaveCommand = () -> {\n    };\n    protected DisplayerType displayerType = DisplayerType.BARCHART;\n    protected DisplayerSubType displayerSubType = null;\n    protected RendererManager rendererManager;\n    protected Event<DisplayerSettingsChangedEvent> displayerSettingsChangedEvent;\n    private ExternalComponentPropertiesEditor externalComponentPropertiesEditor;\n    protected String currentRenderer = \"\";\n\n    DisplayerListener displayerListener = new AbstractDisplayerListener() {\n\n        public void onError(Displayer displayer, ClientRuntimeError error) {\n            view.error(error);\n        }\n    };\n\n    @Inject\n    public DisplayerEditor(View view,\n                           DataSetClientServices clientServices,\n                           DisplayerLocator displayerLocator,\n                           DisplayerPrototypes displayerPrototypes,\n                           DisplayerTypeSelector typeSelector,\n                           DataSetLookupEditor lookupEditor,\n                           DisplayerSettingsEditor settingsEditor,\n                           DisplayerEditorStatus editorStatus,\n                           DisplayerHtmlEditor displayerHtmlEditor,\n                           Event<DisplayerEditorSavedEvent> savedEvent,\n                           Event<DisplayerEditorClosedEvent> closedEvent,\n                           RendererManager rendererManager,\n                           ExternalComponentPropertiesEditor externalComponentPropertiesEditor,\n                           Event<DisplayerSettingsChangedEvent> displayerSettingsChangedEvent) {\n        this.view = view;\n        this.displayerLocator = displayerLocator;\n        this.clientServices = clientServices;\n        this.displayerPrototypes = displayerPrototypes;\n        this.typeSelector = typeSelector;\n        this.lookupEditor = lookupEditor;\n        this.settingsEditor = settingsEditor;\n        this.editorStatus = editorStatus;\n        this.displayerHtmlEditor = displayerHtmlEditor;\n        this.saveEvent = savedEvent;\n        this.closeEvent = closedEvent;\n        this.rendererManager = rendererManager;\n        this.externalComponentPropertiesEditor = externalComponentPropertiesEditor;\n        this.displayerSettingsChangedEvent = displayerSettingsChangedEvent;\n\n        view.init(this);\n    }\n\n    public void setDisplayerType(DisplayerType displayerType) {\n        this.displayerType = displayerType != null ? displayerType : DisplayerType.BARCHART;\n    }\n\n    public void setDisplayerSubType(DisplayerSubType displayerSubType) {\n        this.displayerSubType = displayerSubType;\n    }\n\n    public void init(DisplayerSettings settings) {\n        if (settings != null) {\n            brandNewDisplayer = false;\n            displayerSettings = settings;\n        } else {\n            brandNewDisplayer = true;\n            displayerSettings = displayerPrototypes.getProto(displayerType, displayerSubType);\n            displayerSettings.setTitle(view.getBrandNewDisplayerTitle());\n        }\n        selectedTypeSettings = displayerSettings;\n\n        initDisplayer();\n        initTypeSelector();\n        initLookupEditor();\n        initSettingsEditor();\n        initComponentEditor();\n        gotoLastSection();\n        showDisplayer();\n\n        currentRenderer = displayerSettings.getRenderer();\n        if (currentRenderer == null || currentRenderer.trim().isEmpty()) {\n            currentRenderer = rendererManager.getDefaultRenderer(displayerSettings.getType()).getUUID();\n        }\n    }\n\n    private void initComponentEditor() {\n        externalComponentPropertiesEditor.init(displayerSettings.getComponentId(),\n                                               displayerSettings.getComponentProperties(),\n                                               this::onComponentPropertiesUpdate);\n    }\n\n    protected boolean supportsHtmlTemplate() {\n        return displayer.getDisplayerConstraints().getSupportedAttributes().contains(DisplayerAttributeDef.HTML_TEMPLATE);\n    }\n\n    protected void initDisplayer() {\n        if (displayer != null) {\n            displayer.close();\n        }\n        displayer = displayerLocator.lookupDisplayer(displayerSettings);\n        displayer.addListener(displayerListener);\n        displayer.setRefreshOn(false);\n        displayer.draw();\n    }\n\n    protected void initLookupEditor() {\n        DataSetLookupConstraints lookupConstraints = displayer.getDisplayerConstraints().getDataSetLookupConstraints();\n        lookupEditor.init(lookupConstraints, displayerSettings.getDataSetLookup());\n    }\n\n    protected void initTypeSelector() {\n        typeSelector.init(displayerSettings.getType(), displayerSettings.getSubtype());\n    }\n\n    protected void initSettingsEditor() {\n        settingsEditor.init(displayer);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public boolean isBrandNewDisplayer() {\n        return brandNewDisplayer;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public Displayer getDisplayer() {\n        return displayer;\n    }\n\n    public String getCurrentRenderer() {\n        return currentRenderer;\n    }\n\n    public DisplayerTypeSelector getTypeSelector() {\n        return typeSelector;\n    }\n\n    public DataSetLookupEditor getLookupEditor() {\n        return lookupEditor;\n    }\n\n    public DisplayerSettingsEditor getSettingsEditor() {\n        return settingsEditor;\n    }\n\n    public void setTypeSelectorEnabled(boolean enabled) {\n        typeSelectionEnabled = enabled;\n        view.setTypeSelectionEnabled(enabled);\n    }\n\n    public void setDataSetLookupConfEnabled(boolean enabled) {\n        dataLookupConfEnabled = enabled;\n        view.setDataSetLookupConfEnabled(enabled);\n    }\n\n    public void setDisplaySettingsEnabled(boolean enabled) {\n        displaySettingsEnabled = enabled;\n        view.setDisplaySettingsEnabled(enabled);\n    }\n\n    public void setExternalComponentSettingsEnabled(boolean enabled) {\n        externalComponentSettingsEnabled = enabled;\n        view.setComponentSettingsEnabled(enabled);\n    }\n\n    public void setOnSaveCommand(Command saveCommand) {\n        this.onSaveCommand = saveCommand != null ? saveCommand : onCloseCommand;\n    }\n\n    public void setOnCloseCommand(Command closeCommand) {\n        this.onCloseCommand = closeCommand != null ? closeCommand : onCloseCommand;\n    }\n\n    public void showDisplayer() {\n        if (view.isTableDisplayModeOn()) {\n            try {\n                DisplayerSettings tableSettings = displayerSettings.cloneInstance();\n                tableSettings.setTitleVisible(false);\n                tableSettings.setType(DisplayerType.TABLE);\n                tableSettings.setTablePageSize(10);\n                tableSettings.setTableWidth(800);\n                tableSettings.setRenderer(\"default\");\n                Displayer tableDisplayer = displayerLocator.lookupDisplayer(tableSettings);\n                tableDisplayer.addListener(displayerListener);\n                tableDisplayer.setRefreshOn(false);\n                tableDisplayer.draw();\n                view.showDisplayer(tableDisplayer);\n            } catch (Exception e) {\n                view.error(new ClientRuntimeError(e));\n            }\n        } else if (supportsHtmlTemplate()) {\n            displayerHtmlEditor.setDisplayer(displayer);\n            view.showDisplayer(displayerHtmlEditor);\n        } else {\n            view.showDisplayer(displayer);\n        }\n    }\n\n    public void gotoFirstSectionEnabled() {\n        if (typeSelectionEnabled) {\n            gotoTypeSelection();\n        } else if (dataLookupConfEnabled) {\n            gotoDataSetLookupConf();\n        } else if (displaySettingsEnabled) {\n            gotoDisplaySettings();\n        } else if (externalComponentSettingsEnabled) {\n            gotoExternalComponentSettings();\n        } else {\n            view.error(\"Nothing to show!\");\n        }\n    }\n\n    public void gotoLastSection() {\n        int lastOption = editorStatus.getSelectedOption(displayerSettings.getUUID());\n        if (activeSection < 0 || activeSection != lastOption) {\n            switch (lastOption) {\n                case EXTERNAL_COMPONENT_SECTION:\n                    gotoExternalComponentSettings();\n                    break;\n                case DISPLAY_SETTINGS_SECTION:\n                    gotoDisplaySettings();\n                    break;\n                case DATASET_LOOKUP_SECTION:\n                    gotoDataSetLookupConf();\n                    break;\n                default:\n                    gotoFirstSectionEnabled();\n                    break;\n            }\n        }\n    }\n\n    public void gotoTypeSelection() {\n        activeSection = DEFAULT_SECTION;\n        editorStatus.saveSelectedOption(displayerSettings.getUUID(), activeSection);\n        view.goToTypeSelection(typeSelector);\n    }\n\n    public void gotoDataSetLookupConf() {\n        activeSection = DATASET_LOOKUP_SECTION;\n        editorStatus.saveSelectedOption(displayerSettings.getUUID(), activeSection);\n        view.goToDataSetLookupConf(lookupEditor);\n        view.setTableDisplayModeEnabled(!DisplayerType.TABLE.equals(displayerSettings.getType()));\n    }\n\n    public void gotoDisplaySettings() {\n        activeSection = DISPLAY_SETTINGS_SECTION;\n        editorStatus.saveSelectedOption(displayerSettings.getUUID(), activeSection);\n        view.goToDisplaySettings(settingsEditor);\n    }\n\n    public void gotoExternalComponentSettings() {\n        activeSection = EXTERNAL_COMPONENT_SECTION;\n        editorStatus.saveSelectedOption(displayerSettings.getUUID(), activeSection);\n        initComponentEditor();\n        view.gotoExternalComponentSettings(externalComponentPropertiesEditor);\n    }\n\n    public void save() {\n        // Clear settings before return\n        DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints();\n        displayerConstraints.removeUnsupportedAttributes(displayerSettings);\n\n        // Dispose the displayer\n        if (displayer != null) {\n            displayer.close();\n        }\n        // Notify event\n        onSaveCommand.execute();\n        saveEvent.fire(new DisplayerEditorSavedEvent(displayerSettings));\n    }\n\n    public void close() {\n        if (displayer != null) {\n            displayer.close();\n        }\n        onCloseCommand.execute();\n        closeEvent.fire(new DisplayerEditorClosedEvent(displayerSettings));\n    }\n\n    // Widget listeners callback notifications\n\n    void onDataSetLookupChanged(@Observes DataSetLookupChangedEvent event) {\n        DataSetLookup dataSetLookup = event.getDataSetLookup();\n        displayerSettings.setDataSet(null);\n        displayerSettings.setDataSetLookup(dataSetLookup);\n        removeStaleSettings();\n        initDisplayer();\n        initSettingsEditor();\n        showDisplayer();\n    }\n\n    void onDisplayerSettingsChanged(@Observes DisplayerSettingsChangedEvent event) {\n        String newRenderer = event.getDisplayerSettings().getRenderer();\n        displayerSettings = event.getDisplayerSettings();\n        initDisplayer();\n        showDisplayer();\n        if (newRenderer != null && !currentRenderer.equals(newRenderer)) {\n            initSettingsEditor();\n            currentRenderer = newRenderer;\n        }\n    }\n\n    void onDisplayerTypeChanged(@Observes DisplayerTypeSelectedEvent event) {\n        displayerTypeChanged(event.getSelectedType(), null);\n    }\n\n    void onDisplayerSubtypeChanged(@Observes DisplayerSubtypeSelectedEvent event) {\n        displayerTypeChanged(selectedTypeSettings.getType(), event.getSelectedSubType());\n    }\n\n    void displayerTypeChanged(DisplayerType type, DisplayerSubType displayerSubType) {\n\n        // Create new settings for the selected type\n        selectedTypeSettings = displayerPrototypes.getProto(type, displayerSubType);\n        DataSet oldDataSet = displayerSettings.getDataSet();\n        DataSetLookup oldDataLookup = displayerSettings.getDataSetLookup();\n\n        // Check if the current data lookup is compatible with the new displayer type\n        if (oldDataSet == null && oldDataLookup != null) {\n            Displayer displayer = displayerLocator.lookupDisplayer(selectedTypeSettings);\n            DisplayerConstraints displayerConstraints = displayer.getDisplayerConstraints();\n            DataSetLookupConstraints dataConstraints = displayerConstraints.getDataSetLookupConstraints();\n            DataSetMetadata metadata = clientServices.getMetadata(oldDataLookup.getDataSetUUID());\n\n            // Keep the current data settings provided it satisfies the data constraints\n            ValidationError validationError = dataConstraints.check(oldDataLookup, metadata);\n            if (validationError == null) {\n                selectedTypeSettings.setDataSet(null);\n                selectedTypeSettings.setDataSetLookup(oldDataLookup);\n                applySelectedType();\n            }\n            // If the data lookup is not compatible then ask the user what to do\n            else {\n                view.showTypeChangedWarning(this::applySelectedType, this::abortSelectedType);\n            }\n        }\n        // If the displayer is static (no data lookup) then just display the selected displayer prototype\n        else {\n            applySelectedType();\n        }\n    }\n\n    void applySelectedType() {\n        // Remove the non supported attributes\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.TYPE);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.SUBTYPE);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.GENERAL_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.CHART_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.AXIS_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.SELECTOR_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.FILTER_GROUP);\n        displayerSettings.removeDisplayerSetting(DisplayerAttributeGroupDef.HTML_GROUP);\n        selectedTypeSettings.getSettingsFlatMap().putAll(displayerSettings.getSettingsFlatMap());\n\n        try {\n            // Ensure the renderer supports the new type\n            displayerLocator.lookupDisplayer(selectedTypeSettings);\n        } catch (Exception e) {\n            // The new type might not support the selected renderer.\n            selectedTypeSettings.removeDisplayerSetting(DisplayerAttributeDef.RENDERER);\n            view.error(new ClientRuntimeError(e));\n        }\n\n        // Re-initialize the editor with the new settings\n        init(selectedTypeSettings);\n        removeStaleSettings();\n    }\n\n    void abortSelectedType() {\n        selectedTypeSettings = displayerSettings;\n        typeSelector.init(displayerSettings.getType(), displayerSettings.getSubtype());\n        view.showDisplayer(displayer);\n    }\n\n    List<String> getExistingDataColumnIds() {\n        DataSet dataSet = displayerSettings.getDataSet();\n        DataSetLookup dataSetLookup = displayerSettings.getDataSetLookup();\n\n        List<String> columnIds = new ArrayList<String>();\n        if (dataSet != null) {\n            for (DataColumn dataColumn : dataSet.getColumns()) {\n                columnIds.add(dataColumn.getId());\n            }\n        } else if (dataSetLookup != null) {\n            int idx = dataSetLookup.getLastGroupOpIndex(0);\n            if (idx != -1) {\n                DataSetGroup groupOp = dataSetLookup.getOperation(idx);\n                for (GroupFunction groupFunction : groupOp.getGroupFunctions()) {\n                    columnIds.add(groupFunction.getColumnId());\n                }\n            }\n        }\n        return columnIds;\n    }\n\n    void removeStaleSettings() {\n        List<String> columnIds = getExistingDataColumnIds();\n\n        // Remove the settings for non existing columns\n        Iterator<ColumnSettings> it = displayerSettings.getColumnSettingsList().iterator();\n        while (it.hasNext()) {\n            ColumnSettings columnSettings = it.next();\n            if (!columnIds.contains(columnSettings.getColumnId())) {\n                it.remove();\n            }\n        }\n        // Reset table sort column\n        if (!columnIds.contains(displayerSettings.getTableDefaultSortColumnId())) {\n            displayerSettings.setTableDefaultSortColumnId(null);\n        }\n    }\n\n    void onComponentPropertiesUpdate(Map<String, String> updatedProperties) {\n        updatedProperties.forEach(displayerSettings::setComponentProperty);\n        displayerSettingsChangedEvent.fire(new DisplayerSettingsChangedEvent(displayerSettings));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorPopup.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.web.bindery.event.shared.HandlerRegistration;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.ModalShownEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShownHandler;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class DisplayerEditorPopup extends BaseModal {\n\n    interface Binder extends UiBinder<ModalBody, DisplayerEditorPopup> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField(provided = true)\n    DisplayerEditor editor;\n\n    private HandlerRegistration showHandlerRegistration;\n    private String editDisplayerTitle = CommonConstants.INSTANCE.displayer_editor_title();\n    private String newDisplayerTitle = CommonConstants.INSTANCE.displayer_editor_new();\n    private DisplayerType displayerType = null;\n    private DisplayerSubType displayerSubType = null;\n    private ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n\n    @Inject\n    public DisplayerEditorPopup(DisplayerEditor editor) {\n        this.editor = editor;\n        add(uiBinder.createAndBindUi(this));\n        ModalFooterOKCancelButtons footer = createModalFooterOKCancelButtons();\n        footer.enableCancelButton(true);\n        footer.enableOkButton(true);\n        add(footer);\n        setWidth(1200+\"px\");\n        addHiddenHandler();\n    }\n\n    public DisplayerEditorPopup init(DisplayerSettings settings) {\n        ModalShownHandler shownHandler = createShownHandler(settings);\n        this.showHandlerRegistration = this.addShownHandler(shownHandler);\n        show();\n        return this;\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return this.editor.getDisplayerSettings();\n    }\n\n    public void setNewDisplayerTitle(String newDisplayerTitle) {\n        this.newDisplayerTitle = newDisplayerTitle;\n    }\n\n    public void setEditDisplayerTitle(String editDisplayerTitle) {\n        this.editDisplayerTitle = editDisplayerTitle;\n    }\n\n    public void setDisplayerType(DisplayerType displayerType) {\n        this.displayerType = displayerType;\n    }\n\n    public void setDisplayerSubType(DisplayerSubType displayerSubType) {\n        this.displayerSubType = displayerSubType;\n    }\n\n    public void setOnSaveCommand(Command saveCommand) {\n        this.editor.setOnSaveCommand(saveCommand);\n    }\n\n    public void setOnCloseCommand(Command closeCommand) {\n        this.editor.setOnCloseCommand(closeCommand);\n    }\n    \n    public void setTypeSelectorEnabled(boolean enableTypeSelector) {\n        this.editor.setTypeSelectorEnabled(enableTypeSelector);\n    }\n\n    public void setExternalDisplayerEnabled(boolean enabled) {\n        this.editor.setExternalComponentSettingsEnabled(enabled);\n    }\n    \n    /**\n     * <p>The popup must be visible in order that the table can display the different row's values. So after popup is shown, initialize the editor.</p>\n     */\n    protected ModalShownHandler createShownHandler(final DisplayerSettings settings) {\n\n        return new ModalShownHandler() {\n            @Override\n            public void onShown(ModalShownEvent modalShownEvent) {\n                editor.setDisplayerType(displayerType);\n                editor.setDisplayerSubType(displayerSubType);\n                editor.init(settings);\n                setTitle(editor.isBrandNewDisplayer() ? newDisplayerTitle : editDisplayerTitle);\n                removeShownHandler();\n            }\n        };\n    }\n\n    protected void removeShownHandler() {\n        if (this.showHandlerRegistration != null) {\n            this.showHandlerRegistration.removeHandler();\n            this.showHandlerRegistration = null;\n        }\n    }\n\n    protected void addHiddenHandler() {\n        addHiddenHandler(new ModalHiddenHandler() {\n            @Override\n            public void onHidden(ModalHiddenEvent hiddenEvent) {\n                if (userPressedCloseOrCancel()) {\n                    editor.close();\n                }\n            }\n        } );\n    }\n\n    private boolean userPressedCloseOrCancel() {\n        return ButtonPressed.CANCEL.equals(buttonPressed) || ButtonPressed.CLOSE.equals(buttonPressed);\n    }\n\n    protected ModalFooterOKCancelButtons createModalFooterOKCancelButtons() {\n        return new ModalFooterOKCancelButtons(\n                new com.google.gwt.user.client.Command() {\n                    @Override\n                    public void execute() {\n                        buttonPressed = ButtonPressed.OK;\n                        hide();\n                        editor.save();\n                    }\n                },\n                new com.google.gwt.user.client.Command() {\n                    @Override\n                    public void execute() {\n                        buttonPressed = ButtonPressed.CANCEL;\n                        hide();\n                    }\n                });\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:dashb=\"urn:import:org.dashbuilder.displayer.client.widgets\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <b:ModalBody>\n    <dashb:DisplayerEditor ui:field=\"editor\" />\n  </b:ModalBody>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorStatus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class DisplayerEditorStatus {\n\n    Map<String,DisplayerStatus> displayerStatusMap = new HashMap<String,DisplayerStatus>();\n\n    public int getSelectedOption(String displayerUuid) {\n        DisplayerStatus status = displayerStatusMap.get(displayerUuid);\n        return (status == null ? -1 : status.selectedOption);\n    }\n\n    public void saveSelectedOption(String displayerUuid, int option) {\n        DisplayerStatus status = fetch(displayerUuid);\n        status.selectedOption = option;\n    }\n\n    private DisplayerStatus fetch(String displayerUuid) {\n        DisplayerStatus status = displayerStatusMap.get(displayerUuid);\n        if (status != null) return status;\n        status = new DisplayerStatus();\n        displayerStatusMap.put(displayerUuid, status);\n        return status;\n    }\n\n    private class DisplayerStatus {\n\n        int selectedOption = -1;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.common.client.widgets.AlertPanel;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.constants.AlertType;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class DisplayerEditorView extends Composite\n        implements DisplayerEditor.View {\n\n    interface Binder extends UiBinder<Widget, DisplayerEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    Column westColumn;\n\n    @UiField\n    Column leftColumn;\n\n    @UiField\n    Column centerColumn;\n\n    @UiField\n    TabListItem optionType;\n\n    @UiField\n    TabListItem optionData;\n\n    @UiField\n    TabListItem optionSettings;\n    \n    @UiField\n    TabListItem optionComponentSettings;\n\n    @UiField\n    Row viewAsTableButtonRow;\n\n    @UiField\n    CheckBox viewAsTableButton;\n\n    protected DisplayerEditor presenter;\n    \n    @Inject\n    protected DisplayerErrorWidget errorWidget;\n\n    public void init(DisplayerEditor presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n        viewAsTableButtonRow.getElement().setAttribute(\"cellpadding\", \"5\");\n        // disabled by default\n        setComponentSettingsEnabled(false);\n    }\n\n    @Override\n    public String getBrandNewDisplayerTitle() {\n        return \"- \" + CommonConstants.INSTANCE.displayer_editor_new() + \" -\";\n    }\n\n    @Override\n    public void showDisplayer(IsWidget displayer) {\n        centerColumn.clear();\n        centerColumn.add(displayer);\n    }\n\n    @Override\n    public void setTypeSelectionEnabled(boolean enabled) {\n        optionType.setVisible(enabled);\n        goToOtherSectionIfActive(optionType);\n    }\n\n    @Override\n    public void setDisplaySettingsEnabled(boolean enabled) {\n        optionSettings.setVisible(enabled);\n        goToOtherSectionIfActive(optionSettings);\n    }\n\n    @Override\n    public void setDataSetLookupConfEnabled(boolean enabled) {\n        optionData.setVisible(enabled);\n        goToOtherSectionIfActive(optionData);\n    }\n    \n    @Override\n    public void setComponentSettingsEnabled(boolean enabled) {\n        optionComponentSettings.setVisible(enabled);\n        goToOtherSectionIfActive(optionComponentSettings);\n    }\n\n    @Override\n    public boolean isTableDisplayModeOn() {\n        return viewAsTableButtonRow.isVisible() && viewAsTableButton.getValue();\n    }\n\n    @Override\n    public void setTableDisplayModeEnabled(boolean enabled) {\n        viewAsTableButtonRow.setVisible(enabled);\n    }\n\n    @Override\n    public void goToTypeSelection(DisplayerTypeSelector typeSelector) {\n        leftColumn.clear();\n        leftColumn.getElement().getStyle().setOverflowY(Style.Overflow.HIDDEN);\n        leftColumn.add(typeSelector);\n\n        viewAsTableButtonRow.setVisible(false);\n        optionData.setActive(false);\n        optionSettings.setActive(false);\n        optionType.setActive(true);\n        optionComponentSettings.setActive(false);\n    }\n\n    @Override\n    public void goToDataSetLookupConf(DataSetLookupEditor lookupEditor) {\n        leftColumn.clear();\n        leftColumn.getElement().getStyle().setOverflowY(Style.Overflow.AUTO);\n        leftColumn.add(lookupEditor);\n        \n        optionSettings.setActive(false);\n        optionType.setActive(false);\n        optionData.setActive(true);\n        optionComponentSettings.setActive(false);\n    }\n\n    @Override\n    public void goToDisplaySettings(DisplayerSettingsEditor settingsEditor) {\n        leftColumn.clear();\n        leftColumn.getElement().getStyle().setOverflowY(Style.Overflow.AUTO);\n        leftColumn.add(settingsEditor);\n\n        viewAsTableButtonRow.setVisible(false);\n        optionType.setActive(false);\n        optionData.setActive(false);\n        optionSettings.setActive(true);\n        optionComponentSettings.setActive(false);\n    }\n    \n    @Override\n    public void gotoExternalComponentSettings(ExternalComponentPropertiesEditor externalComponentPropertiesEditor) {\n        leftColumn.clear();\n        leftColumn.getElement().getStyle().setOverflowY(Style.Overflow.AUTO);\n        leftColumn.add(externalComponentPropertiesEditor);\n\n        viewAsTableButtonRow.setVisible(false);\n        optionType.setActive(false);\n        optionData.setActive(false);\n        optionSettings.setActive(false);\n        optionComponentSettings.setActive(true);\n    }\n\n    @Override\n    public void showTypeChangedWarning(Command yes, Command no) {\n        AlertPanel alertPanel = new AlertPanel();\n        String alertMsg = CommonConstants.INSTANCE.displayer_editor_incompatible_settings();\n        alertPanel.show(AlertType.WARNING, alertMsg, 400, yes, no);\n        centerColumn.clear();\n        centerColumn.add(alertPanel);\n    }\n\n    @Override\n    public void error(String error) {\n        centerColumn.clear();\n        centerColumn.add(errorWidget);\n        errorWidget.show(error, null);\n\n        GWT.log(error);\n    }\n\n    @Override\n    public void error(ClientRuntimeError e) {\n        centerColumn.clear();\n        centerColumn.add(errorWidget);\n        errorWidget.show(e.getMessage(), e.getThrowable());\n\n        if (e.getThrowable() != null) {\n            GWT.log(e.getMessage(), e.getThrowable());\n        } else {\n            GWT.log(e.getMessage());\n        }\n    }\n\n    @UiHandler(value = \"optionType\")\n    public void onTypeSelected(ClickEvent clickEvent) {\n        presenter.gotoTypeSelection();\n    }\n\n    @UiHandler(value = \"optionData\")\n    public void onDataSelected(ClickEvent clickEvent) {\n        presenter.gotoDataSetLookupConf();\n    }\n\n    @UiHandler(value = \"optionSettings\")\n    public void onSettingsSelected(ClickEvent clickEvent) {\n        presenter.gotoDisplaySettings();\n    }\n    \n    @UiHandler(value = \"optionComponentSettings\")\n    public void onExternalComponentSettingsSelected(ClickEvent clickEvent) {\n        presenter.gotoExternalComponentSettings();\n    }\n\n    @UiHandler(value = \"viewAsTableButton\")\n    public void onRawTableChecked(ClickEvent clickEvent) {\n        presenter.showDisplayer();\n    }\n \n    private void goToOtherSectionIfActive(TabListItem item) {\n        if (item.isActive()) {\n            presenter.gotoFirstSectionEnabled();\n        }\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .mainContainer {\n      margin-top: 15px;\n    }\n    .leftColumn {\n      overflow-x: hidden;\n      overflow-y: auto;\n      height: 370px;\n    }\n    .centerColumn {\n      height: 390px;\n      overflow: auto;\n    }\n    .viewAsTableButtonRow {\n      font-size: small;\n    }\n    .viewAsTableButton {\n      margin: 10px;\n    }\n  </ui:style>\n\n  <g:HTMLPanel>\n    <b:NavTabs>\n      <b:TabListItem ui:field=\"optionType\" text=\"{i18n.displayer_editor_tab_type}\" />\n      <b:TabListItem ui:field=\"optionData\" text=\"{i18n.displayer_editor_tab_data}\" />\n      <b:TabListItem ui:field=\"optionSettings\" text=\"{i18n.displayer_editor_tab_display}\" />\n      <b:TabListItem ui:field=\"optionComponentSettings\" text=\"{i18n.componentEditor}\" />      \n    </b:NavTabs>\n    \n    <b:Container fluid=\"true\" addStyleNames=\"{style.mainContainer}\">\n      <b:Row>\n        <b:Column size=\"MD_3\" ui:field=\"westColumn\">\n          <b:Row ui:field=\"viewAsTableButtonRow\" visible=\"false\" addStyleNames=\"{style.viewAsTableButtonRow}\">\n            <b:Column size=\"MD_12\">\n              <!-- View as table button -->\n              <b:CheckBox text=\"{i18n.displayer_editor_view_as_table}\" ui:field=\"viewAsTableButton\" addStyleNames=\"{style.viewAsTableButton}\"/>\n            </b:Column>\n          </b:Row>\n          <b:Row>\n            <b:Column size=\"MD_12\" ui:field=\"leftColumn\" addStyleNames=\"{style.leftColumn}\"/>\n          </b:Row>\n        </b:Column>\n        <b:Column size=\"MD_9\" ui:field=\"centerColumn\" addStyleNames=\"{style.centerColumn}\"/>\n      </b:Row>\n    </b:Container>\n   \n  </g:HTMLPanel>\n  \n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerError.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Row;\n\n@Dependent\npublic class DisplayerError extends Composite {\n\n    interface Binder extends UiBinder<Widget, DisplayerError> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    HTML errorMessage;\n\n    @UiField\n    HTML errorCause;\n\n    @UiField\n    Panel errorMessageRow;\n\n    @UiField\n    Panel errorCauseRow;\n\n    public DisplayerError() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void show(final String message, final String cause) {\n        errorMessage.setText(message != null ? message : \"\");\n        errorMessageRow.setVisible(message != null);\n        errorCause.setText(cause != null ? cause : \"\");\n        errorCauseRow.setVisible(cause != null);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerError.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .errorPanel {\n      padding: 25px;\n    }\n\n    .errorRow {\n      margin-bottom: 10px;\n    }\n\n    .errorLabel {\n      font-weight: bold;\n    }\n  </ui:style>\n\n  <g:FlowPanel addStyleNames=\"{style.errorPanel}\">\n    <b:Row ui:field=\"errorMessageRow\" addStyleNames=\"{style.errorRow}\">\n      <b:Column size=\"MD_1\">\n        <g:Label text=\"{i18n.error}\" addStyleNames=\"{style.errorLabel}\"/>\n      </b:Column>\n      <b:Column size=\"MD_3\">\n        <g:HTML ui:field=\"errorMessage\" text=\"\"/>\n      </b:Column>\n    </b:Row>\n    <b:Row ui:field=\"errorCauseRow\" addStyleNames=\"{style.errorRow}\">\n      <b:Column size=\"MD_1\">\n        <g:Label text=\"{i18n.cause}\" addStyleNames=\"{style.errorLabel}\"/>\n      </b:Column>\n      <b:Column size=\"MD_3\">\n        <g:HTML ui:field=\"errorCause\" text=\"\"/>\n      </b:Column>\n    </b:Row>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerErrorWidget.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.displayer-error {\n    margin: 10px;\n}\n\n.displayer-error-body {\n    overflow-wrap: break-word;\n    overflow: auto;\n    max-height: 110px;\n}\n\n.displayer-error-title-icon {\n    margin-right: 10px;\n}\n\n.error-details {\n    resize: none;\n    white-space: pre;\n    cursor: text;\n    border: none;\n}\n\n.chevron-title {\n    margin-left: 5px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerErrorWidget.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div class=\"card-pf card-pf-view card-pf-view-xs displayer-error\"\n    data-field=\"displayerErrorRoot\">\n    <div class=\"card-pf-body\">\n        <div class=\"card-pf-heading\">\n            <span\n                class=\"pficon pficon-warning-triangle-o displayer-error-title-icon\"></span><span\n                class=\"card-pf-title\"\n                data-i18n-key=\"displayerErrorTitle\"></span>\n        </div>\n        <p data-field=\"errorBody\" class=\"displayer-error-body\"></p>\n        <div>\n            <a data-field=\"chevronDown\" hidden><em\n                class=\"glyphicon glyphicon-chevron-down\"></em></a> <a\n                data-field=\"chevronRight\"><em\n                class=\"glyphicon glyphicon-chevron-right\"></em></a> <span\n                class=\"chevron-title\" data-i18n-key=\"errorDetails\"></span>\n        </div>\n        <div data-field=\"errorDetailsSection\" hidden>\n            <textarea data-field=\"errorDetails\"\n                class=\"error-details form-control\" readonly></textarea>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerErrorWidget.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLParagraphElement;\nimport elemental2.dom.HTMLTextAreaElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class DisplayerErrorWidget extends Composite {\n\n    @Inject\n    @DataField\n    private HTMLDivElement displayerErrorRoot;\n\n    @Inject\n    @DataField\n    private HTMLParagraphElement errorBody;\n\n    @Inject\n    @DataField\n    private HTMLDivElement errorDetailsSection;\n\n    @Inject\n    @DataField\n    private HTMLTextAreaElement errorDetails;\n\n    @Inject\n    @DataField\n    private HTMLAnchorElement chevronRight;\n\n    @Inject\n    @DataField\n    private HTMLAnchorElement chevronDown;\n\n    public void show(String message, Throwable t) {\n        errorBody.textContent = message;\n        errorDetails.value = buildErrorDetails(t);\n    }\n\n    private String buildErrorDetails(Throwable t) {\n        StringBuilder sb = new StringBuilder();\n        Throwable cause = t.getCause();\n\n        sb.append(t.getMessage());\n\n        while (cause != null) {\n            sb.append(\"\\n  Caused by: \" + cause.getMessage());\n            cause = cause.getCause();\n        }\n\n        return sb.toString();\n    }\n\n    @EventHandler(\"chevronRight\")\n    public void onChevronRightClicked(final ClickEvent event) {\n        showErrorDetails(true);\n    }\n\n    @EventHandler(\"chevronDown\")\n    public void onChevronDownClicked(final ClickEvent event) {\n        showErrorDetails(false);\n    }\n\n    private void showErrorDetails(final boolean isVisible) {\n        chevronRight.hidden = isVisible;\n        chevronDown.hidden = !isVisible;\n        errorDetailsSection.hidden = !isVisible;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerHtmlEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.HasHtmlTemplate;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.HasJsTemplate;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.SourceCodeEditor;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.SourceCodeType;\nimport org.uberfire.client.mvp.UberView;\n\nimport static org.dashbuilder.displayer.client.widgets.sourcecode.SourceCodeType.*;\n\n/**\n * UI component for the edition of a displayer component supporting HTML templates\n */\n@Dependent\npublic class DisplayerHtmlEditor implements IsWidget {\n\n    public interface View extends UberView<DisplayerHtmlEditor> {\n\n        void showDisplayer(IsWidget displayer);\n\n        void clearSourceCodeItems();\n\n        void addSourceCodeItem(String name);\n\n        void editSourceCodeItem(String name, IsWidget editor);\n    }\n\n    public class SourceCodeItem {\n        String name;\n        SourceCodeType type;\n        DisplayerAttributeDef attributeDef;\n\n        public SourceCodeItem(String name, SourceCodeType type, DisplayerAttributeDef attributeDef) {\n            this.name = name;\n            this.type = type;\n            this.attributeDef = attributeDef;\n        }\n    }\n\n    Displayer displayer;\n    View view;\n    SourceCodeEditor sourceCodeEditor;\n    Set<SourceCodeItem> sourceCodeItems = new HashSet<>();\n    SourceCodeItem selectedSourceCodeItem = null;\n    boolean showingDisplayer = true;\n\n    @Inject\n    public DisplayerHtmlEditor(View view, SourceCodeEditor sourceCodeEditor) {\n        this.view = view;\n        this.sourceCodeEditor = sourceCodeEditor;\n        view.init(this);\n\n        sourceCodeItems.add(new SourceCodeItem(\"html\", HTML, DisplayerAttributeDef.HTML_TEMPLATE));\n        sourceCodeItems.add(new SourceCodeItem(\"javascript\", JAVASCRIPT, DisplayerAttributeDef.JS_TEMPLATE));\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public Displayer getDisplayer() {\n        return displayer;\n    }\n\n    public void setDisplayer(Displayer displayer) {\n        this.selectedSourceCodeItem = null;\n        this.displayer = displayer;\n\n        initSourceCodeItems();\n        showDisplayer();\n    }\n\n    public boolean showDisplayer() {\n        if (sourceCodeEditor.hasErrors()) {\n            sourceCodeEditor.focus();\n            return false;\n        }\n        view.showDisplayer(displayer);\n        showingDisplayer = true;\n        displayer.redraw();\n        return true;\n    }\n\n    public void initSourceCodeItems() {\n        view.clearSourceCodeItems();\n\n        Set<DisplayerAttributeDef> attrs = displayer.getDisplayerConstraints().getSupportedAttributes();\n        for (SourceCodeItem sourceCodeItem : sourceCodeItems) {\n            if (attrs.contains(sourceCodeItem.attributeDef)) {\n                view.addSourceCodeItem(sourceCodeItem.name);\n            }\n        }\n    }\n\n    public SourceCodeItem getSourceCodeItem(String name) {\n        for (SourceCodeItem sourceCodeItem : sourceCodeItems) {\n            if (sourceCodeItem.name.equals(name)) {\n                return sourceCodeItem;\n            }\n        }\n        return null;\n    }\n\n    public boolean onSourceCodeItemSelected(String name) {\n        selectedSourceCodeItem = getSourceCodeItem(name);\n        String code = displayer.getDisplayerSettings().getDisplayerSetting(selectedSourceCodeItem.attributeDef);\n        Map<String,String> varMap = null;\n        if (selectedSourceCodeItem.type == SourceCodeType.HTML && displayer instanceof HasHtmlTemplate) {\n            varMap = ((HasHtmlTemplate) displayer).getHtmlVariableMap();\n        }\n        if (selectedSourceCodeItem.type == SourceCodeType.JAVASCRIPT && displayer instanceof HasJsTemplate) {\n            varMap = ((HasJsTemplate) displayer).getJsVariableMap();\n        }\n\n        sourceCodeEditor.init(selectedSourceCodeItem.type, code, varMap, this::onSourceCodeChanged);\n        sourceCodeEditor.focus();\n\n        showingDisplayer = false;\n        view.editSourceCodeItem(name, sourceCodeEditor);\n        return true;\n    }\n\n    public void onSourceCodeChanged() {\n        if (!sourceCodeEditor.hasErrors()) {\n            String newCode = sourceCodeEditor.getCode();\n            displayer.getDisplayerSettings().setDisplayerSetting(selectedSourceCodeItem.attributeDef, newCode);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerHtmlEditorView.html",
    "content": "<div class=\"tabbable\">\n    <ul data-field=\"tabList\" class=\"nav nav-tabs nav-tabs-pf\" style=\"margin-bottom: 10px;\">\n        <li class=\"active\" data-field=\"previewItem\">\n            <a href=\"#\" data-field=\"previewAnchor\">Preview</a>\n        </li>\n    </ul>\n    <div class=\"tab-content\" data-field=\"contentPanel\">\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerHtmlEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerHtmlConstants;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.NodeList;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class DisplayerHtmlEditorView extends Composite\n        implements DisplayerHtmlEditor.View {\n\n    @Inject\n    @DataField\n    FlowPanel contentPanel;\n\n    @Inject\n    @DataField\n    UnorderedList tabList;\n\n    @Inject\n    @DataField\n    ListItem previewItem;\n\n    @Inject\n    @DataField\n    Anchor previewAnchor;\n\n    LIElement selectedItem;\n    DisplayerHtmlEditor presenter;\n\n    @Override\n    public void init(DisplayerHtmlEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showDisplayer(IsWidget displayer) {\n        contentPanel.clear();\n        contentPanel.add(displayer);\n        previewItem.setClassName(\"active\");\n        previewAnchor.setTextContent(DisplayerHtmlConstants.INSTANCE.displayer_html_preview_link());\n    }\n\n    @Override\n    public void clearSourceCodeItems() {\n        removeAllChildren(tabList);\n        tabList.appendChild(previewItem);\n    }\n\n    @Override\n    public void editSourceCodeItem(String name, IsWidget editor) {\n        contentPanel.clear();\n        contentPanel.add(editor);\n    }\n\n    @Override\n    public void addSourceCodeItem(String name) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        String displayName = DisplayerHtmlConstants.INSTANCE.getString(\"displayer_source_code_\" + name);\n        anchor.setInnerText(displayName);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        tabList.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                presenter.onSourceCodeItemSelected(name);\n                if (selectedItem != null) {\n                    selectedItem.setClassName(\"\");\n                    selectedItem.getStyle().setCursor(Style.Cursor.POINTER);\n                }\n                selectedItem = li;\n                selectedItem.setClassName(\"active\");\n                selectedItem.getStyle().setCursor(Style.Cursor.DEFAULT);\n                previewItem.setClassName(\"\");\n            }\n        });\n    }\n\n    private void removeAllChildren(org.jboss.errai.common.client.dom.Element element) {\n        NodeList nodeList = element.getChildNodes();\n        int lenght = nodeList.getLength();\n        for (int i=0; i<lenght; i++) {\n            element.removeChild(nodeList.item(0));\n        }\n    }\n\n    @EventHandler(\"previewAnchor\")\n    private void onPreviewClicked(ClickEvent event) {\n        if (!presenter.showDisplayer()) {\n            event.stopPropagation();\n        } else {\n            previewItem.setClassName(\"active\");\n            if (selectedItem != null) {\n                selectedItem.setClassName(\"\");\n                selectedItem.getStyle().setCursor(Style.Cursor.POINTER);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.MapColorScheme;\nimport org.dashbuilder.displayer.Position;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerSettingsChangedEvent;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_3D;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_BGCOLOR;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_HEIGHT;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_LEGENDPOSITION;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_MARGIN_BOTTOM;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_MARGIN_LEFT;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_MARGIN_RIGHT;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_MARGIN_TOP;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_RESIZABLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_SHOWLEGEND;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.CHART_WIDTH;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.EXPORT_TO_CSV;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.EXPORT_TO_XLS;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.FILTER_ENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.FILTER_LISTENING_ENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.FILTER_NOTIFICATION_ENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.FILTER_SELFAPPLY_ENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.MAP_COLOR_SCHEME;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.METER_CRITICAL;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.METER_END;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.METER_START;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.METER_WARNING;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.REFRESH_INTERVAL;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.REFRESH_STALE_DATA;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.RENDERER;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.SELECTOR_MULTIPLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.SELECTOR_SHOW_INPUTS;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.SELECTOR_WIDTH;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_COLUMN_PICKER_ENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_PAGESIZE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_SORTCOLUMNID;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_SORTENABLED;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_SORTORDER;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TABLE_WIDTH;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TITLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.TITLE_VISIBLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.XAXIS_LABELSANGLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.XAXIS_SHOWLABELS;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.XAXIS_TITLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.YAXIS_SHOWLABELS;\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.YAXIS_TITLE;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.CHART_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.CHART_LEGEND_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.CHART_MARGIN_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.COLUMNS_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.EXPORT_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.FILTER_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.GENERAL_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.MAP_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.METER_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.REFRESH_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.SELECTOR_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.TABLE_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.XAXIS_GROUP;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.YAXIS_GROUP;\n\n@Dependent\npublic class DisplayerSettingsEditor implements IsWidget {\n\n    public interface View extends UberView<DisplayerSettingsEditor> {\n\n        void clear();\n\n        void show();\n\n        void dataSetNotFound();\n\n        void error(String message);\n\n        void addCategory(DisplayerAttributeDef attributeDef);\n\n        void addTextProperty(DisplayerAttributeDef attributeDef, String value, PropertyFieldValidator... validators);\n\n        void addTextProperty(String propId, String propName, String value, PropertyFieldValidator... validators);\n\n        void addBooleanProperty(DisplayerAttributeDef attributeDef, boolean value);\n\n        void addColorProperty(DisplayerAttributeDef attributeDef, String color);\n\n        void addListProperty(DisplayerAttributeDef attributeDef, List<String> optionList, String selectedValue);\n\n        String getColumnNameI18n();\n\n        String getColumnExpressionI18n();\n\n        String getColumnPatternI18n();\n\n        String getPositionLiteralI18n(Position position);\n\n        String getIntegerValidationFailedI18n();\n\n        String getDoubleValidationFailedI18n();\n\n        String getMeterStartI18n();\n\n        String getMeterWarningI18n();\n\n        String getMeterCriticalI18n();\n\n        String getMeterEndI18n();\n\n        String getMeterUnknownI18n();\n\n        String getMeterValidationHigherI18n(String level);\n\n        String getMeterValidationLowerI18n(String level);\n\n        String getMeterValidationInvalidI18n();\n\n        String getMapColorSchemeI18n(MapColorScheme colorScheme);\n    }\n\n    protected View view;\n    protected DisplayerLocator displayerLocator;\n    protected RendererManager rendererManager;\n    protected Displayer displayer;\n    protected DisplayerSettings displayerSettings;\n    protected DisplayerConstraints displayerContraints;\n    private Set<DisplayerAttributeDef> supportedAttributes;\n    protected Event<DisplayerSettingsChangedEvent> settingsChangedEvent;\n\n    public static final String COLUMNS_PREFFIX = \"columns.\";\n\n    @Inject\n    public DisplayerSettingsEditor(View view,\n                                   DisplayerLocator displayerLocator,\n                                   RendererManager rendererManager,\n                                   Event<DisplayerSettingsChangedEvent> settingsChangedEvent) {\n        this.view = view;\n        this.displayerLocator = displayerLocator;\n        this.rendererManager = rendererManager;\n        this.settingsChangedEvent = settingsChangedEvent;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void init(Displayer displayer) {\n        try {\n            this.displayer = displayer;\n            this.displayerSettings = displayer.getDisplayerSettings();\n            this.displayerContraints = displayer.getDisplayerConstraints();\n            this.supportedAttributes = displayerContraints.getSupportedAttributes();\n\n            displayer.getDataSetHandler().lookupDataSet(new DataSetReadyCallback() {\n\n                @Override\n                public void callback(DataSet dataSet) {\n                    show();\n                }\n\n                @Override\n                public void notFound() {\n                    view.dataSetNotFound();\n                }\n\n                @Override\n                public boolean onError(final ClientRuntimeError error) {\n                    console(error.getThrowable());\n                    view.error(error.getMessage());\n                    return false;\n                }\n            });\n        } catch (Exception e) {\n            console(e);\n            view.error(e.toString());\n        }\n    }\n\n    public boolean isSupported(DisplayerAttributeDef attributeDef) {\n        return supportedAttributes.contains(attributeDef);\n    }\n\n    public boolean isSupported(DisplayerAttributeGroupDef groupDef) {\n        if (supportedAttributes.contains(groupDef)) {\n\n            for (DisplayerAttributeDef attrDef : groupDef.getChildren()) {\n                if (attrDef instanceof DisplayerAttributeGroupDef) {\n                    continue;\n                }\n                if (supportedAttributes.contains(attrDef)) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    void show() {\n        view.clear();\n\n        if (isSupported(GENERAL_GROUP)) {\n            view.addCategory(GENERAL_GROUP);\n\n            if (isSupported(TITLE)) {\n                view.addTextProperty(TITLE, displayerSettings.getTitle());\n            }\n            if (isSupported(TITLE_VISIBLE)) {\n                view.addBooleanProperty(TITLE_VISIBLE, displayerSettings.isTitleVisible());\n            }\n        }\n        if (isSupported(RENDERER)) {\n            view.addCategory(RENDERER);\n\n            List<String> optionList = new ArrayList<String>();\n            for (RendererLibrary option : rendererManager.getRenderersForType(displayerSettings.getType())) {\n                optionList.add(option.getUUID());\n            }\n            if (optionList.size() > 1) {\n                RendererLibrary renderer = rendererManager.getRendererForDisplayer(displayerSettings);\n                view.addListProperty(RENDERER, optionList, renderer.getUUID());\n            }\n        }\n        if (isSupported(CHART_GROUP)) {\n            view.addCategory(CHART_GROUP);\n\n            if (isSupported(CHART_RESIZABLE)) {\n                view.addBooleanProperty(CHART_RESIZABLE, displayerSettings.isResizable());\n            }\n            if (isSupported(CHART_WIDTH)) {\n                view.addTextProperty(CHART_WIDTH, String.valueOf(displayerSettings.getChartWidth()), createLongValidator());\n            }\n            if (isSupported(CHART_HEIGHT)) {\n                view.addTextProperty(CHART_HEIGHT, String.valueOf(displayerSettings.getChartHeight()), createLongValidator());\n            }\n            if (isSupported(CHART_BGCOLOR)) {\n                view.addColorProperty(CHART_BGCOLOR, displayerSettings.getChartBackgroundColor());\n            }\n            if (isSupported(CHART_3D)) {\n                view.addBooleanProperty(CHART_3D, displayerSettings.isChart3D());\n            }\n        }\n        if (isSupported(CHART_MARGIN_GROUP)) {\n            view.addCategory(CHART_MARGIN_GROUP);\n\n            if (isSupported(CHART_MARGIN_TOP)) {\n                view.addTextProperty(CHART_MARGIN_TOP, String.valueOf(displayerSettings.getChartMarginTop()), createLongValidator());\n            }\n            if (isSupported(CHART_MARGIN_BOTTOM)) {\n                view.addTextProperty(CHART_MARGIN_BOTTOM, String.valueOf(displayerSettings.getChartMarginBottom()), createLongValidator());\n            }\n            if (isSupported(CHART_MARGIN_LEFT)) {\n                view.addTextProperty(CHART_MARGIN_LEFT, String.valueOf(displayerSettings.getChartMarginLeft()), createLongValidator());\n            }\n            if (isSupported(CHART_MARGIN_RIGHT)) {\n                view.addTextProperty(CHART_MARGIN_RIGHT, String.valueOf(displayerSettings.getChartMarginRight()), createLongValidator());\n            }\n        }\n        if (isSupported(CHART_LEGEND_GROUP)) {\n            view.addCategory(CHART_LEGEND_GROUP);\n\n            if (isSupported(CHART_SHOWLEGEND)) {\n                view.addBooleanProperty(CHART_SHOWLEGEND, displayerSettings.isChartShowLegend());\n            }\n            if (isSupported(CHART_LEGENDPOSITION)) {\n                List<String> optionList = new ArrayList<String>();\n                for (Position position : Position.values()) {\n                    String positionLabel = view.getPositionLiteralI18n(position);\n                    optionList.add(positionLabel);\n                }\n                if (optionList.size() > 1) {\n                    String positionLabel = view.getPositionLiteralI18n(displayerSettings.getChartLegendPosition());\n                    view.addListProperty(CHART_LEGENDPOSITION, optionList, positionLabel);\n                }\n            }\n        }\n        if (isSupported(XAXIS_GROUP) || isSupported(YAXIS_GROUP)) {\n            view.addCategory(XAXIS_GROUP);\n\n            if (isSupported(XAXIS_SHOWLABELS)) {\n                view.addBooleanProperty(XAXIS_SHOWLABELS, displayerSettings.isXAxisShowLabels());\n            }\n            if (isSupported(XAXIS_TITLE)) {\n                view.addTextProperty(XAXIS_TITLE, displayerSettings.getXAxisTitle());\n            }\n            if (isSupported(XAXIS_LABELSANGLE)) {\n                view.addTextProperty(XAXIS_LABELSANGLE, String.valueOf(displayerSettings.getXAxisLabelsAngle()));\n            }\n            if (isSupported(YAXIS_SHOWLABELS)) {\n                view.addBooleanProperty(YAXIS_SHOWLABELS, displayerSettings.isXAxisShowLabels());\n            }\n            if (isSupported(YAXIS_TITLE)) {\n                view.addTextProperty(YAXIS_TITLE, displayerSettings.getYAxisTitle());\n            }\n        }\n        if (isSupported(TABLE_GROUP)) {\n            view.addCategory(TABLE_GROUP);\n\n            if (isSupported(TABLE_PAGESIZE)) {\n                view.addTextProperty(TABLE_PAGESIZE, String.valueOf(displayerSettings.getTablePageSize()), createLongValidator());\n            }\n            if (isSupported(TABLE_WIDTH)) {\n                view.addTextProperty(TABLE_WIDTH, String.valueOf(displayerSettings.getTableWidth()), createLongValidator());\n            }\n            if (isSupported(TABLE_SORTENABLED)) {\n                view.addBooleanProperty(TABLE_SORTENABLED, displayerSettings.isTableSortEnabled());\n            }\n            if (isSupported(TABLE_SORTCOLUMNID)) {\n                final List<String> optionList = new ArrayList<String>();\n                DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();\n                List<DataColumn> dsColumns = dataSet.getColumns();\n                optionList.add(\"\");\n                for (DataColumn column : dsColumns) {\n                    optionList.add(column.getId());\n                }\n                view.addListProperty(TABLE_SORTCOLUMNID, optionList, displayerSettings.getTableDefaultSortColumnId());\n            }\n            if (isSupported(TABLE_SORTORDER)) {\n                List<String> optionList = new ArrayList<String>();\n                optionList.add(SortOrder.ASCENDING.toString());\n                optionList.add(SortOrder.DESCENDING.toString());\n                view.addListProperty(TABLE_SORTORDER, optionList, displayerSettings.getTableDefaultSortOrder().toString());\n            }\n            if (isSupported(TABLE_COLUMN_PICKER_ENABLED)) {\n                view.addBooleanProperty(TABLE_COLUMN_PICKER_ENABLED, displayerSettings.isTableColumnPickerEnabled());\n            }\n        }\n        if (isSupported(METER_GROUP)) {\n            view.addCategory(METER_GROUP);\n\n            if (isSupported(METER_START)) {\n                view.addTextProperty(METER_START, String.valueOf(displayerSettings.getMeterStart()), createMeterValidator(displayerSettings, 0));\n            }\n            if (isSupported(METER_WARNING)) {\n                view.addTextProperty(METER_WARNING, String.valueOf(displayerSettings.getMeterWarning()), createMeterValidator(displayerSettings, 1));\n            }\n            if (isSupported(METER_CRITICAL)) {\n                view.addTextProperty(METER_CRITICAL, String.valueOf(displayerSettings.getMeterCritical()), createMeterValidator(displayerSettings, 2));\n            }\n            if (isSupported(METER_END)) {\n                view.addTextProperty(METER_END, String.valueOf(displayerSettings.getMeterEnd()), createMeterValidator(displayerSettings, 3));\n            }\n\n        }\n        if (isSupported(FILTER_GROUP)) {\n            view.addCategory(FILTER_GROUP);\n\n            if (isSupported(FILTER_ENABLED)) {\n                view.addBooleanProperty(FILTER_ENABLED, displayerSettings.isFilterEnabled());\n            }\n            if (isSupported(FILTER_SELFAPPLY_ENABLED)) {\n                view.addBooleanProperty(FILTER_SELFAPPLY_ENABLED, displayerSettings.isFilterSelfApplyEnabled());\n            }\n            if (isSupported(FILTER_LISTENING_ENABLED)) {\n                view.addBooleanProperty(FILTER_LISTENING_ENABLED, displayerSettings.isFilterListeningEnabled());\n            }\n            if (isSupported(FILTER_NOTIFICATION_ENABLED)) {\n                view.addBooleanProperty(FILTER_NOTIFICATION_ENABLED, displayerSettings.isFilterNotificationEnabled());\n            }\n        }\n        if (isSupported(SELECTOR_GROUP)) {\n            view.addCategory(SELECTOR_GROUP);\n\n            if (isSupported(SELECTOR_WIDTH)) {\n                view.addTextProperty(SELECTOR_WIDTH, String.valueOf(displayerSettings.getSelectorWidth()), createLongValidator());\n            }\n            if (isSupported(SELECTOR_MULTIPLE)) {\n                view.addBooleanProperty(SELECTOR_MULTIPLE, displayerSettings.isSelectorMultiple());\n            }\n            if (isSupported(SELECTOR_SHOW_INPUTS)) {\n                view.addBooleanProperty(SELECTOR_SHOW_INPUTS, displayerSettings.isSelectorInputsEnabled());\n            }\n        }\n        if (isSupported(REFRESH_GROUP)) {\n            view.addCategory(REFRESH_GROUP);\n\n            if (isSupported(REFRESH_INTERVAL)) {\n                view.addTextProperty(REFRESH_INTERVAL, String.valueOf(displayerSettings.getRefreshInterval()), createLongValidator());\n            }\n            if (isSupported(REFRESH_STALE_DATA)) {\n                view.addBooleanProperty(REFRESH_STALE_DATA, displayerSettings.isRefreshStaleData());\n            }\n        }\n        if (isSupported(COLUMNS_GROUP)) {\n            view.addCategory(COLUMNS_GROUP);\n\n            DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();\n            for (int i = 0; i < dataSet.getColumns().size(); i++) {\n\n                DataColumn dataColumn = dataSet.getColumnByIndex(i);\n                ColumnSettings cs = displayerSettings.getColumnSettings(dataColumn);\n                String fieldSuffix = COLUMNS_PREFFIX + cs.getColumnId() + \".\";\n                String expression = cs.getValueExpression();\n                String pattern = cs.getValuePattern();\n\n                view.addTextProperty(fieldSuffix + \"name\", view.getColumnNameI18n() + (i + 1), cs.getColumnName());\n\n                if (expression != null) {\n                    view.addTextProperty(fieldSuffix + \"expression\", \"     \" + view.getColumnExpressionI18n(), expression);\n                }\n                if (pattern != null) {\n                    view.addTextProperty(fieldSuffix + \"pattern\", \"     \" + view.getColumnPatternI18n(), pattern);\n                }\n                /* Non-critical. Disable for the time being.\n                if (isSupported(COLUMN_EMPTY)) {\n                    String empty = cs.getEmptyTemplate();\n                    view.addTextProperty(fieldSuffix + \"empty\", \"     \" + view.getColumnEmptyI18n(), empty);\n                }*/\n            }\n        }\n        if (isSupported(EXPORT_GROUP)) {\n            view.addCategory(EXPORT_GROUP);\n\n            if (isSupported(EXPORT_TO_CSV)) {\n                view.addBooleanProperty(EXPORT_TO_CSV, displayerSettings.isCSVExportAllowed());\n            }\n            if (isSupported(EXPORT_TO_XLS)) {\n                view.addBooleanProperty(EXPORT_TO_XLS, displayerSettings.isExcelExportAllowed());\n            }\n        }\n\n        if (isSupported(MAP_GROUP)) {\n            view.addCategory(MAP_GROUP);\n\n            if (isSupported(MAP_COLOR_SCHEME)) {\n                List<String> colorsSchemes = Stream.of(MapColorScheme.values())\n                                                   .map(view::getMapColorSchemeI18n)\n                                                   .collect(Collectors.toList());\n\n                String mapColorSchemePositionLabel = view.getMapColorSchemeI18n(displayerSettings.getMapColorScheme());\n                view.addListProperty(MAP_COLOR_SCHEME, colorsSchemes, mapColorSchemePositionLabel);\n            }\n        }\n        view.show();\n    }\n\n    void onAttributeChanged(String attrKey, String attrValue) {\n        if (attrKey.startsWith(COLUMNS_PREFFIX)) {\n            String[] strings = attrKey.split(\"\\\\.\");\n            if (strings.length == 3) {\n\n                String columnId = strings[1];\n                String setting = strings[2];\n\n                if (\"name\".equals(setting)) {\n                    displayerSettings.setColumnName(columnId, attrValue);\n                } else if (\"empty\".equals(setting)) {\n                    displayerSettings.setColumnEmptyTemplate(columnId, attrValue);\n                } else if (\"pattern\".equals(setting)) {\n                    displayerSettings.setColumnValuePattern(columnId, attrValue);\n                } else if (\"expression\".equals(setting)) {\n                    displayerSettings.setColumnValueExpression(columnId, attrValue);\n                }\n            }\n        } else {\n            displayerSettings.setDisplayerSetting(attrKey, attrValue);\n        }\n\n        settingsChangedEvent.fire(new DisplayerSettingsChangedEvent(displayerSettings));\n    }\n\n    // Custom property validators\n\n    public LongValidator createLongValidator() {\n        return new LongValidator();\n    }\n\n    public DoubleValidator createDoubleValidator() {\n        return new DoubleValidator();\n    }\n\n    public MeterValidator createMeterValidator(DisplayerSettings settings, int level) {\n        return new MeterValidator(settings, level);\n    }\n\n    /**\n     * Property Editor Validator for integers\n     */\n    public class LongValidator implements PropertyFieldValidator {\n\n        @Override\n        public boolean validate(Object value) {\n            try {\n                Long.parseLong(value.toString());\n                return true;\n            } catch (Exception e) {\n                return false;\n            }\n        }\n\n        @Override\n        public String getValidatorErrorMessage() {\n            return view.getIntegerValidationFailedI18n();\n        }\n    }\n\n    /**\n     * Property Editor Validator for doubles\n     */\n    public class DoubleValidator implements PropertyFieldValidator {\n\n        @Override\n        public boolean validate(Object value) {\n            try {\n                Double.parseDouble(value.toString());\n                return true;\n            } catch (Exception e) {\n                return false;\n            }\n        }\n\n        @Override\n        public String getValidatorErrorMessage() {\n            return view.getDoubleValidationFailedI18n();\n        }\n    }\n\n    /**\n     * Property Editor Validator for meter intervals\n     */\n    public class MeterValidator extends LongValidator {\n\n        private DisplayerSettings displayerSettings;\n        private int level;\n        private boolean lowerOk = true;\n        private boolean upperOk = true;\n\n        public MeterValidator(DisplayerSettings displayerSettings, int level) {\n            this.displayerSettings = displayerSettings;\n            this.level = level;\n        }\n\n        private long getLevelValue(int level) {\n            switch (level) {\n                case 0:\n                    return displayerSettings.getMeterStart();\n                case 1:\n                    return displayerSettings.getMeterWarning();\n                case 2:\n                    return displayerSettings.getMeterCritical();\n                case 3:\n                    return displayerSettings.getMeterEnd();\n            }\n            return level < 0 ? Long.MIN_VALUE : Long.MAX_VALUE;\n        }\n\n        private String getLevelDescr(int level) {\n            switch (level) {\n                case 0:\n                    return view.getMeterStartI18n();\n                case 1:\n                    return view.getMeterWarningI18n();\n                case 2:\n                    return view.getMeterCriticalI18n();\n                case 3:\n                    return view.getMeterEndI18n();\n            }\n            return view.getMeterUnknownI18n();\n        }\n\n        @Override\n        public boolean validate(Object value) {\n            if (!super.validate(value)) {\n                return false;\n            }\n            long thisLevel = Long.parseLong(value.toString());\n            long lowerLevel = getLevelValue(level - 1);\n            long upperLevel = getLevelValue(level + 1);\n            lowerOk = thisLevel >= lowerLevel;\n            upperOk = thisLevel <= upperLevel;\n            return lowerOk && upperOk;\n        }\n\n        @Override\n        public String getValidatorErrorMessage() {\n            if (!lowerOk) {\n                return view.getMeterValidationHigherI18n(getLevelDescr(level - 1));\n            }\n            if (!upperOk) {\n                return view.getMeterValidationLowerI18n(getLevelDescr(level + 1));\n            }\n            return view.getMeterValidationInvalidI18n();\n        }\n    }\n\n    private void console(Throwable e) {\n        if (DomGlobal.console != null) {\n            DomGlobal.console.error(\"Error running displayer.\");\n            DomGlobal.console.error(e);\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.MapColorScheme;\nimport org.dashbuilder.displayer.Position;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.client.resources.i18n.MapColorSchemeConstants;\nimport org.dashbuilder.displayer.client.resources.i18n.PositionConstants;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\nimport static org.uberfire.ext.properties.editor.model.PropertyEditorType.*;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.*;\n\n@Dependent\npublic class DisplayerSettingsEditorView extends Composite implements DisplayerSettingsEditor.View {\n\n    interface Binder extends UiBinder<Widget, DisplayerSettingsEditorView> {}\n    private static final Binder uiBinder = GWT.create( Binder.class );\n\n    @UiField\n    Panel mainPanel;\n\n    @UiField\n    PropertyEditorWidget propertyEditor;\n\n    DisplayerSettingsEditor presenter;\n    List<PropertyEditorCategory> categories = new ArrayList<PropertyEditorCategory>();\n    Map<DisplayerAttributeDef,String> attrMapI18n = new HashMap<DisplayerAttributeDef, String>();\n    PropertyEditorCategory category = null;\n\n    public static final String PROPERTY_EDITOR_ID = \"displayerSettingsEditor\";\n\n    @Override\n    public void init(DisplayerSettingsEditor presenter) {\n        this.presenter = presenter;\n\n        attrMapI18n.put(GENERAL_GROUP, CommonConstants.INSTANCE.common_group());\n        attrMapI18n.put(TITLE, CommonConstants.INSTANCE.common_title());\n        attrMapI18n.put(TITLE_VISIBLE, CommonConstants.INSTANCE.common_showTitle());\n        attrMapI18n.put(ALLOW_EXPORT_CSV, CommonConstants.INSTANCE.common_allowCSV());\n        attrMapI18n.put(ALLOW_EXPORT_EXCEL, CommonConstants.INSTANCE.common_allowExcel());\n        attrMapI18n.put(EXPORT_GROUP, CommonConstants.INSTANCE.common_export());\n        attrMapI18n.put(EXPORT_TO_CSV, CommonConstants.INSTANCE.common_allowCSV());\n        attrMapI18n.put(EXPORT_TO_XLS, CommonConstants.INSTANCE.common_allowExcel());\n        attrMapI18n.put(RENDERER, CommonConstants.INSTANCE.common_renderer());\n        attrMapI18n.put(CHART_GROUP, CommonConstants.INSTANCE.chart_group());\n        attrMapI18n.put(CHART_WIDTH, CommonConstants.INSTANCE.chart_width());\n        attrMapI18n.put(CHART_HEIGHT, CommonConstants.INSTANCE.chart_height());\n        attrMapI18n.put(CHART_RESIZABLE, CommonConstants.INSTANCE.chart_resizable());\n        attrMapI18n.put(CHART_BGCOLOR, CommonConstants.INSTANCE.chart_bgColor());\n        attrMapI18n.put(CHART_3D, CommonConstants.INSTANCE.chart_3d());\n        attrMapI18n.put(CHART_MARGIN_GROUP, CommonConstants.INSTANCE.chart_marginGroup());\n        attrMapI18n.put(CHART_MARGIN_TOP, CommonConstants.INSTANCE.chart_topMargin());\n        attrMapI18n.put(CHART_MARGIN_BOTTOM, CommonConstants.INSTANCE.chart_bottomMargin());\n        attrMapI18n.put(CHART_MARGIN_LEFT, CommonConstants.INSTANCE.chart_leftMargin());\n        attrMapI18n.put(CHART_MARGIN_RIGHT, CommonConstants.INSTANCE.chart_rightMargin());\n        attrMapI18n.put(CHART_LEGEND_GROUP, CommonConstants.INSTANCE.chart_legendGroup());\n        attrMapI18n.put(CHART_SHOWLEGEND, CommonConstants.INSTANCE.chart_legendShow());\n        attrMapI18n.put(CHART_LEGENDPOSITION, CommonConstants.INSTANCE.chart_legendPosition());\n        attrMapI18n.put(XAXIS_GROUP, CommonConstants.INSTANCE.axis_group());\n        attrMapI18n.put(YAXIS_GROUP, CommonConstants.INSTANCE.axis_group());\n        attrMapI18n.put(XAXIS_SHOWLABELS, CommonConstants.INSTANCE.xaxis_showLabels());\n        attrMapI18n.put(XAXIS_TITLE, CommonConstants.INSTANCE.xaxis_title());\n        attrMapI18n.put(XAXIS_LABELSANGLE, CommonConstants.INSTANCE.xaxis_angle());\n        attrMapI18n.put(YAXIS_SHOWLABELS, CommonConstants.INSTANCE.yaxis_showLabels());\n        attrMapI18n.put(YAXIS_TITLE, CommonConstants.INSTANCE.yaxis_title());\n        attrMapI18n.put(TABLE_GROUP, CommonConstants.INSTANCE.table_group());\n        attrMapI18n.put(TABLE_PAGESIZE, CommonConstants.INSTANCE.table_pageSize());\n        attrMapI18n.put(TABLE_WIDTH, CommonConstants.INSTANCE.table_width());\n        attrMapI18n.put(TABLE_SORTENABLED, CommonConstants.INSTANCE.table_sortEnabled());\n        attrMapI18n.put(TABLE_SORTCOLUMNID, CommonConstants.INSTANCE.table_sortColumn());\n        attrMapI18n.put(TABLE_SORTORDER, CommonConstants.INSTANCE.table_sortOrder());\n        attrMapI18n.put(TABLE_COLUMN_PICKER_ENABLED, CommonConstants.INSTANCE.table_columnPicker());\n        attrMapI18n.put(METER_GROUP, CommonConstants.INSTANCE.meter_group());\n        attrMapI18n.put(METER_START, CommonConstants.INSTANCE.meter_start());\n        attrMapI18n.put(METER_WARNING, CommonConstants.INSTANCE.meter_warning());\n        attrMapI18n.put(METER_CRITICAL, CommonConstants.INSTANCE.meter_critical());\n        attrMapI18n.put(METER_END, CommonConstants.INSTANCE.meter_end());\n        attrMapI18n.put(FILTER_GROUP, CommonConstants.INSTANCE.filter_group());\n        attrMapI18n.put(FILTER_ENABLED, CommonConstants.INSTANCE.filter_enabled());\n        attrMapI18n.put(FILTER_SELFAPPLY_ENABLED, CommonConstants.INSTANCE.filter_self());\n        attrMapI18n.put(FILTER_LISTENING_ENABLED, CommonConstants.INSTANCE.filter_listening());\n        attrMapI18n.put(FILTER_NOTIFICATION_ENABLED, CommonConstants.INSTANCE.filter_notifications());\n        attrMapI18n.put(SELECTOR_GROUP, CommonConstants.INSTANCE.selector_group());\n        attrMapI18n.put(SELECTOR_WIDTH, CommonConstants.INSTANCE.selector_width());\n        attrMapI18n.put(SELECTOR_MULTIPLE, CommonConstants.INSTANCE.selector_multiple());\n        attrMapI18n.put(SELECTOR_SHOW_INPUTS, CommonConstants.INSTANCE.selector_show_inputs());\n        attrMapI18n.put(REFRESH_GROUP, CommonConstants.INSTANCE.refresh_group());\n        attrMapI18n.put(REFRESH_INTERVAL, CommonConstants.INSTANCE.refresh_interval());\n        attrMapI18n.put(REFRESH_STALE_DATA, CommonConstants.INSTANCE.refresh_stale_data());\n        attrMapI18n.put(COLUMNS_GROUP, CommonConstants.INSTANCE.common_columns());\n        attrMapI18n.put(MAP_GROUP, CommonConstants.INSTANCE.map_group());\n        attrMapI18n.put(MAP_COLOR_SCHEME, CommonConstants.INSTANCE.color_scheme());\n\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void clear() {\n        categories.clear();\n    }\n\n    @Override\n    public void show() {\n        propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories));\n    }\n\n    @Override\n    public void dataSetNotFound() {\n        mainPanel.add(new Label(LabelType.WARNING, CommonConstants.INSTANCE.error() + CommonConstants.INSTANCE.displayer_editor_dataset_notfound()));\n    }\n\n    @Override\n    public void error(String message) {\n        mainPanel.add(new Label(LabelType.WARNING, CommonConstants.INSTANCE.error() + message));\n    }\n\n    @Override\n    public void addCategory(DisplayerAttributeDef attributeDef) {\n        String catName = attrMapI18n.get(attributeDef);\n        category = new PropertyEditorCategory(catName);\n        categories.add(category);\n    }\n\n    @Override\n    public void addTextProperty(DisplayerAttributeDef attributeDef, String value, PropertyFieldValidator... validators) {\n        String propName = attrMapI18n.get(attributeDef);\n        category.withField(new PropertyEditorFieldInfo(propName, value, TEXT)\n                .withValidators(validators)\n                .withKey(attributeDef.getFullId()));\n    }\n\n    @Override\n    public void addTextProperty(String propId, String propName, String value, PropertyFieldValidator... validators) {\n        category.withField(new PropertyEditorFieldInfo(propName, value, TEXT)\n                .withValidators(validators)\n                .withKey(propId));\n    }\n\n    @Override\n    public void addBooleanProperty(DisplayerAttributeDef attributeDef, boolean value) {\n        String propName = attrMapI18n.get(attributeDef);\n        category.withField(new PropertyEditorFieldInfo(propName, Boolean.toString(value), BOOLEAN)\n                .withKey(attributeDef.getFullId()));\n    }\n\n    @Override\n    public void addColorProperty(DisplayerAttributeDef attributeDef, String color) {\n        String propName = attrMapI18n.get(attributeDef);\n        category.withField(new PropertyEditorFieldInfo(propName, color, COLOR)\n                .withKey(attributeDef.getFullId()));\n    }\n\n    @Override\n    public void addListProperty(DisplayerAttributeDef attributeDef, List<String> optionList, String selectedValue) {\n        String propName = attrMapI18n.get(attributeDef);\n        category.withField(new PropertyEditorFieldInfo(propName, selectedValue, COMBO)\n                .withComboValues(optionList)\n                .withKey(attributeDef.getFullId()));\n    }\n\n    @Override\n    public String getColumnNameI18n() {\n        return CommonConstants.INSTANCE.columns_name();\n    }\n\n    @Override\n    public String getColumnExpressionI18n() {\n        return CommonConstants.INSTANCE.columns_expression();\n    }\n\n    @Override\n    public String getColumnPatternI18n() {\n        return CommonConstants.INSTANCE.columns_pattern();\n    }\n\n    @Override\n    public String getPositionLiteralI18n(Position position) {\n        return PositionConstants.INSTANCE.getString(\"POSITION_\" + position.toString());\n    }\n\n    @Override\n    public String getIntegerValidationFailedI18n() {\n        return CommonConstants.INSTANCE.settings_validation_integer();\n    }\n\n    @Override\n    public String getDoubleValidationFailedI18n() {\n        return CommonConstants.INSTANCE.settings_validation_double();\n    }\n\n    @Override\n    public String getMeterStartI18n() {\n        return CommonConstants.INSTANCE.meter_start();\n    }\n\n    @Override\n    public String getMeterWarningI18n() {\n        return CommonConstants.INSTANCE.meter_warning();\n    }\n\n    @Override\n    public String getMeterCriticalI18n() {\n        return CommonConstants.INSTANCE.meter_critical();\n    }\n\n    @Override\n    public String getMeterEndI18n() {\n        return CommonConstants.INSTANCE.meter_end();\n    }\n\n    @Override\n    public String getMeterUnknownI18n() {\n        return CommonConstants.INSTANCE.settings_validation_meter_unknown();\n    }\n\n    @Override\n    public String getMeterValidationHigherI18n(String level) {\n        return CommonConstants.INSTANCE.settings_validation_meter_higher(level);\n    }\n\n    @Override\n    public String getMeterValidationLowerI18n(String level) {\n        return CommonConstants.INSTANCE.settings_validation_meter_lower(level);\n    }\n\n    @Override\n    public String getMeterValidationInvalidI18n() {\n        return CommonConstants.INSTANCE.settings_validation_meter_invalid();\n    }\n    \n    @Override\n    public String getMapColorSchemeI18n(MapColorScheme colorScheme) {\n        return MapColorSchemeConstants.INSTANCE.getString(\"COLOR_SCHEME_\" + colorScheme.toString());\n    }\n\n    /**\n     * Capture & process the modification events sent by the property editor\n     */\n    protected void onPropertyEditorChange(@Observes PropertyEditorChangeEvent event) {\n        PropertyEditorFieldInfo property = event.getProperty();\n        if (property.getEventId().equalsIgnoreCase(PROPERTY_EDITOR_ID)) {\n            String attrKey = property.getKey();\n            String attrValue = event.getNewValue();\n            presenter.onAttributeChanged(attrKey, attrValue);\n        }\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:uf='urn:import:org.uberfire.ext.properties.editor.client'>\n\n  <g:FlowPanel ui:field=\"mainPanel\">\n    <uf:PropertyEditorWidget ui:field=\"propertyEditor\"/>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsJSONSourceViewer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.JsonSourceViewer;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\n\npublic class DisplayerSettingsJSONSourceViewer extends Composite {\n\n    interface SettingsEditorUIBinder extends UiBinder<Widget, DisplayerSettingsJSONSourceViewer> {}\n    private static final SettingsEditorUIBinder uiBinder = GWT.create( SettingsEditorUIBinder.class );\n\n    DisplayerSettings displayerSettings;\n    DisplayerSettingsJSONMarshaller jsonMarshaller;\n\n    @UiField\n    public JsonSourceViewer jsonSourceViewer;\n\n    @Inject\n    public DisplayerSettingsJSONSourceViewer() {\n        initWidget( uiBinder.createAndBindUi( this ) );\n        jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setDisplayerSettings(DisplayerSettings displayerSettings) {\n        jsonSourceViewer.setContent(jsonMarshaller.toJsonObject(displayerSettings));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsJSONSourceViewer.ui.xml",
    "content": "<!--\n  Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:db=\"urn:import:org.dashbuilder.common.client\"\n             xmlns:gwt=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <gwt:HTMLPanel width=\"95%\">\n\n    <div class=\"well\">\n\n      <b:FieldSet>\n        <b:Heading size=\"H4\" text=\"{i18n.settingsJsonSource_caption}\" />\n        <db:JsonSourceViewer ui:field=\"jsonSourceViewer\"/>\n      </b:FieldSet>\n\n    </div>\n\n  </gwt:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSubtypeSelector.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerSubtypeSelectedEvent;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class DisplayerSubtypeSelector implements IsWidget {\n\n    public interface View extends UberView<DisplayerSubtypeSelector> {\n\n        void clear();\n\n        void show(DisplayerType type, DisplayerSubType subtype);\n\n        void select(DisplayerSubType subtype);\n\n        void showDefault(DisplayerType type);\n    }\n\n    View view = null;\n    RendererManager rendererManager;\n    DisplayerSubType selectedSubtype;\n    Event<DisplayerSubtypeSelectedEvent> selectEvent;\n\n    @Inject\n    public DisplayerSubtypeSelector(View view,\n                                    RendererManager rendererManager,\n                                    Event<DisplayerSubtypeSelectedEvent> selectEvent) {\n        this.view = view;\n        this.rendererManager = rendererManager;\n        this.selectEvent = selectEvent;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public DisplayerSubType getSelectedSubtype() {\n        return selectedSubtype;\n    }\n\n    public void init(DisplayerType type, DisplayerSubType selectedSubType) {\n        view.clear();\n\n        RendererLibrary rendererLibrary = rendererManager.getRendererForType(type);\n        if (rendererLibrary != null) {\n            List<DisplayerSubType> supportedSubTypes = rendererLibrary.getSupportedSubtypes(type);\n            if (supportedSubTypes != null && !supportedSubTypes.isEmpty()) {\n                for (int i = 0; i < supportedSubTypes.size(); i++) {\n                    DisplayerSubType subtype = supportedSubTypes.get(i);\n\n                    // Double check the renderer library for invalid subtypes for this type\n                    if (!type.getSubTypes().contains(subtype)) {\n                        throw new RuntimeException(\"Wrong subtype (\" + subtype + \") indicated for type \" + type + \" by renderer library \" + rendererLibrary.getUUID());\n                    }\n\n                    boolean initiallySelected = selectedSubType != null ? subtype == selectedSubType : i == 0;\n                    view.show(type, subtype);\n                    if (initiallySelected) {\n                        view.select(subtype);\n                    }\n                }\n            } else {\n                view.showDefault(type);\n            }\n        }\n    }\n\n    void onSelect(DisplayerSubType subtype) {\n        selectedSubtype = subtype;\n        selectEvent.fire(new DisplayerSubtypeSelectedEvent(selectedSubtype));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerSubtypeSelectorView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.web.bindery.event.shared.HandlerRegistration;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerTypeConstants;\nimport org.dashbuilder.displayer.client.resources.images.DisplayerImagesResources;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.constants.ImageType;\n\npublic class DisplayerSubtypeSelectorView extends Composite implements DisplayerSubtypeSelector.View {\n\n    DisplayerSubtypeSelector presenter;\n    Map<DisplayerSubType,DisplayerSubTypeImageWidget> imageWidgets = new HashMap<DisplayerSubType, DisplayerSubTypeImageWidget>(5);\n    FlexTable subtypes = new FlexTable();\n    VerticalPanel subtypePanel = new VerticalPanel();\n    DisplayerSubTypeImageWidget selectedWidget = null;\n\n    @Override\n    public void init(DisplayerSubtypeSelector presenter) {\n        this.presenter = presenter;\n        subtypePanel.add(subtypes);\n        initWidget(subtypePanel);\n    }\n\n    @Override\n    public void clear() {\n        subtypes.removeAllRows();\n        imageWidgets.clear();\n    }\n\n    @Override\n    public void show(DisplayerType type, final DisplayerSubType subtype) {\n        String resourcePrefix = type.toString() + \"_\" + subtype.toString();\n        ImageResource selectedIR = (ImageResource) DisplayerImagesResources.INSTANCE.getResource(resourcePrefix + DisplayerImagesResources.SELECTED_SUFFIX);\n        ImageResource unselectedIR = (ImageResource) DisplayerImagesResources.INSTANCE.getResource(resourcePrefix + DisplayerImagesResources.UNSELECTED_SUFFIX);\n        String tooltip = DisplayerTypeConstants.INSTANCE.getString(resourcePrefix + \"_tt\");\n\n        final DisplayerSubTypeImageWidget dstiw = new DisplayerSubTypeImageWidget(selectedIR, unselectedIR, tooltip, false);\n        imageWidgets.put(subtype, dstiw);\n        subtypes.setWidget(subtypes.getRowCount(), 0, dstiw);\n\n        dstiw.setSelectClickHandler(e -> {\n            if (!dstiw.isSelected) {\n                select(subtype);\n                presenter.onSelect(subtype);\n            }\n        });\n    }\n\n    @Override\n    public void select(DisplayerSubType subtype) {\n        if (selectedWidget != null) {\n            selectedWidget.unselect();\n        }\n        selectedWidget = imageWidgets.get(subtype);\n        selectedWidget.select();\n    }\n\n    @Override\n    public void showDefault(DisplayerType type) {\n        // Show a default image for those chart types that don't have any subtypes\n        ImageResource selectedIR = (ImageResource)DisplayerImagesResources.INSTANCE.getResource(type.toString() + DisplayerImagesResources.DEFAULT_SUFFIX );\n        String tooltip = DisplayerTypeConstants.INSTANCE.getString(type.toString() + DisplayerImagesResources.DEFAULT_SUFFIX + \"_tt\");\n        DisplayerSubTypeImageWidget dstiw = new DisplayerSubTypeImageWidget(selectedIR, null, tooltip, true);\n        subtypes.clear();\n        subtypes.setWidget(0, 0, dstiw);\n    }\n\n\n    public class DisplayerSubTypeImageWidget extends Composite {\n\n        private FlexTable container = new FlexTable();\n        private boolean isSelected = false;\n        private Image selected;\n        private Image unselected;\n\n        public DisplayerSubTypeImageWidget(ImageResource selectedImage,\n                                           ImageResource unselectedImage,\n                                           String tooltip,\n                                           boolean initiallySelected) {\n\n            initWidget(container);\n\n            isSelected = initiallySelected;\n\n            if (selectedImage != null) {\n                selected = new Image(selectedImage);\n                selected.setType(ImageType.THUMBNAIL);\n                selected.setTitle(tooltip);\n                selected.setVisible(isSelected);\n                selected.addStyleName(\"selDispSubtype\"); //for selenium\n                container.setWidget(0, 0, selected);\n            }\n\n            if (unselectedImage != null) {\n                unselected = new Image(unselectedImage);\n                unselected.setType(ImageType.THUMBNAIL);\n                unselected.setTitle(tooltip);\n                unselected.setVisible(!isSelected);\n                unselected.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n                container.setWidget(0, 1, unselected);\n            }\n        }\n\n        public HandlerRegistration setSelectClickHandler(ClickHandler selectedClickHandler) {\n            return unselected != null ? unselected.addClickHandler(selectedClickHandler) : null;\n        }\n\n        public void select() {\n            isSelected = true;\n            selected.setVisible(true);\n            unselected.setVisible(false);\n        }\n\n        public void unselect() {\n            isSelected = false;\n            selected.setVisible(false);\n            unselected.setVisible(true);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerTypeSelector.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerTypeSelectedEvent;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class DisplayerTypeSelector implements IsWidget {\n\n    public interface View extends UberView<DisplayerTypeSelector> {\n\n        void clear();\n\n        void show(DisplayerType type);\n\n        void select(DisplayerType type);\n    }\n\n    View view = null;\n    DisplayerType selectedType = DisplayerType.BARCHART;\n    DisplayerSubtypeSelector subtypeSelector;\n    Event<DisplayerTypeSelectedEvent> typeSelectedEvent;\n    RendererManager rendererManager;\n\n    @Inject\n    public DisplayerTypeSelector(View view,\n                                 DisplayerSubtypeSelector subtypeSelector,\n                                 Event<DisplayerTypeSelectedEvent> typeSelectedEvent,\n                                 RendererManager rendererManager) {\n        this.view = view;\n        this.subtypeSelector = subtypeSelector;\n        this.typeSelectedEvent = typeSelectedEvent;\n        this.rendererManager = rendererManager;\n        view.init(this);\n        view.clear();\n        Arrays.stream(DisplayerType.values())\n              .filter(rendererManager::isTypeSupported)\n              .forEach(view::show);\n        view.select(selectedType);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public DisplayerType getSelectedType() {\n        return selectedType;\n    }\n\n    public DisplayerSubType getSelectedSubType() {\n        return subtypeSelector.getSelectedSubtype();\n    }\n\n    public DisplayerSubtypeSelector getSubtypeSelector() {\n        return subtypeSelector;\n    }\n\n    public void init(DisplayerType selectedType, DisplayerSubType selectedSubtype) {\n        this.selectedType = selectedType;\n        view.select(selectedType);\n        subtypeSelector.init(selectedType, selectedSubtype);\n    }\n\n    void onSelect(DisplayerType type) {\n        selectedType = type;\n        subtypeSelector.init(type, null);\n        typeSelectedEvent.fire(new DisplayerTypeSelectedEvent(selectedType));\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerTypeSelectorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerTypeConstants;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\n\n@Dependent\npublic class DisplayerTypeSelectorView extends Composite implements DisplayerTypeSelector.View {\n\n    interface ViewBinder extends UiBinder<Widget, DisplayerTypeSelectorView> {}\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    Map<DisplayerType, String> displayerNames = new HashMap<DisplayerType, String>();\n\n    @UiField\n    NavTabs navTabs;\n\n    @UiField\n    TabPane displayerSubTypePane;\n\n    DisplayerTypeSelector presenter;\n\n    @Override\n    public void init(DisplayerTypeSelector presenter) {\n        this.presenter = presenter;\n\n        displayerNames.put(DisplayerType.BARCHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_bar());\n        displayerNames.put(DisplayerType.PIECHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_pie());\n        displayerNames.put(DisplayerType.LINECHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_line());\n        displayerNames.put(DisplayerType.AREACHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_area());\n        displayerNames.put(DisplayerType.BUBBLECHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_bubble());\n        displayerNames.put(DisplayerType.METERCHART, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_meter());\n        displayerNames.put(DisplayerType.METRIC, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_metric());\n        displayerNames.put(DisplayerType.MAP, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_map());\n        displayerNames.put(DisplayerType.TABLE, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_table());\n        displayerNames.put(DisplayerType.SELECTOR, DisplayerTypeConstants.INSTANCE.displayer_type_selector_tab_selector());\n\n        initWidget(uiBinder.createAndBindUi(this));\n        displayerSubTypePane.add(presenter.getSubtypeSelector());\n        displayerSubTypePane.setActive(true);\n    }\n\n    @Override\n    public void clear() {\n        navTabs.clear();\n    }\n\n    @Override\n    public void show(DisplayerType type) {\n        String displayerName = displayerNames.get(type);\n        DisplayerTab tab = new DisplayerTab(displayerName, type);\n        tab.setDataTargetWidget(displayerSubTypePane);\n        navTabs.add(tab);\n    }\n\n    @Override\n    public void select(DisplayerType type) {\n        for (int i=0; i<navTabs.getWidgetCount(); i++) {\n            DisplayerTab tab = (DisplayerTab) navTabs.getWidget(i);\n            tab.setActive(tab.type.equals(type));\n        }\n    }\n\n    private class DisplayerTab extends TabListItem {\n        String name;\n        DisplayerType type;\n\n        public DisplayerTab(final String name, final DisplayerType type) {\n            super(name);\n            this.name = name;\n            this.type = type;\n\n            super.addClickHandler(new ClickHandler() {\n                public void onClick(ClickEvent event) {\n                    event.stopPropagation();\n                    if (!presenter.getSelectedType().equals(type)) {\n                        presenter.onSelect(type);\n                    }\n                }\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerTypeSelectorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:TabPanel tabPosition=\"LEFT\">\n    <b:NavTabs ui:field=\"navTabs\"/>\n    <b:TabContent>\n      <b:TabPane ui:field=\"displayerSubTypePane\"/>\n    </b:TabContent>\n  </b:TabPanel>\n  \n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/DisplayerViewer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.*;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.AbstractDisplayerListener;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class DisplayerViewer extends Composite {\n\n    protected DisplayerSettings displayerSettings;\n    protected Panel container = new FlowPanel();\n    protected Label label = new Label();\n    protected Displayer displayer;\n    protected Boolean isShowRendererSelector = false;\n    @Inject\n    protected DisplayerErrorWidget errorWidget;\n    protected boolean error = true;\n    protected DisplayerLocator displayerLocator;\n    protected RendererSelector rendererSelector;\n    ClientRuntimeError displayerInitializationError;\n    CommonConstants i18n = CommonConstants.INSTANCE;\n\n    DisplayerListener displayerListener = new AbstractDisplayerListener() {\n        public void onDraw(Displayer displayer) {\n            if (error) {\n                show();\n            }\n        }\n\n        public void onRedraw(Displayer displayer) {\n            if (error) {\n                show();\n            }\n        }\n\n        public void onError(Displayer displayer,\n                            ClientRuntimeError error) {\n            error(error);\n        }\n    };\n    \n\n    @Inject\n    public DisplayerViewer(DisplayerLocator displayerLocator,\n                           RendererSelector rendererSelector) {\n        this.displayerLocator = displayerLocator;\n        this.rendererSelector = rendererSelector;\n        initWidget(container);\n    }\n\n    public DisplayerSettings getDisplayerSettings() {\n        return displayerSettings;\n    }\n\n    public void setIsShowRendererSelector(Boolean isShowRendererSelector) {\n        this.isShowRendererSelector = isShowRendererSelector;\n    }\n\n    public Displayer getDisplayer() {\n        return displayer;\n    }\n\n    public void init(DisplayerSettings displayerSettings) {\n        try {\n            // Lookup the displayer\n            checkNotNull(\"displayerSettings\",\n                         displayerSettings);\n            this.displayerSettings = displayerSettings;\n            this.displayer = displayerLocator.lookupDisplayer(displayerSettings);\n            this.displayer.addListener(displayerListener);\n\n            // Make the displayer visible\n            show();\n        } catch (Exception e) {\n            displayerInitializationError = new ClientRuntimeError(e);\n            error(displayerInitializationError);\n        }\n    }\n\n    protected void show() {\n        // Add the displayer into a container\n        container.clear();\n        final FlowPanel displayerContainer = new FlowPanel();\n        displayerContainer.add(displayer);\n\n        // Add the renderer selector (if enabled)\n        if (isShowRendererSelector) {\n            rendererSelector.init(displayerSettings,\n                                  RendererSelector.SelectorType.TAB,\n                                  300,\n                                  new Command() {\n                                      public void execute() {\n                                          displayerSettings.setRenderer(rendererSelector.getRendererLibrary().getUUID());\n                                          displayer = displayerLocator.lookupDisplayer(displayerSettings);\n                                          displayer.draw();\n\n                                          displayerContainer.clear();\n                                          displayerContainer.add(displayer);\n                                      }\n                                  });\n            container.add(rendererSelector);\n        }\n        container.add(displayerContainer);\n        error = false;\n    }\n\n    public Displayer draw() {\n        if (displayerInitializationError != null ) {\n            error(displayerInitializationError, i18n.displayerviewer_displayer_not_created());\n        } else {\n            try {\n                // Draw the displayer\n                displayer.draw();\n            } catch (Exception e) {\n                error(new ClientRuntimeError(e));\n            }\n        }\n        return displayer;\n    }\n\n    public Displayer redraw() {\n        try {\n            checkNotNull(\"displayerSettings\",\n                         displayerSettings);\n            checkNotNull(\"displayer\",\n                         displayer);\n\n            displayer.setDisplayerSettings(displayerSettings);\n            displayer.redraw();\n        } catch (Exception e) {\n            error(new ClientRuntimeError(e));\n        }\n        return displayer;\n    }\n\n    \n    public void error(ClientRuntimeError e) {\n        String message = e.getMessage();\n        if (e.getThrowable() != null) {\n            message = e.getThrowable().getMessage();\n        }\n        error(e, message);\n    }\n    \n    public void error(ClientRuntimeError e, String message) {\n        container.clear();\n        container.add(errorWidget);\n        errorWidget.show(message, e.getThrowable());\n        error = true;\n        GWT.log(e.getMessage(),\n                e.getThrowable());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class ExternalComponentEditor implements IsWidget {\n\n    public interface View extends UberView<ExternalComponentEditor> {\n\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    ExternalComponentPropertiesEditor propertiesEditor;\n\n    @Inject\n    ExternalComponentPresenter externalComponentPresenter;\n    \n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    private Map<String, String> newProperties;\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void withComponent(String componentId, Map<String, String> properties) {\n        propertiesEditor.init(componentId, properties, this::propertiesChange);\n        externalComponentPresenter.withComponent(componentId);\n        propertiesChange(properties);\n    }\n\n    public void propertiesChange(Map<String, String> propertiesChange) {\n        this.newProperties = propertiesChange;\n        Map<String, Object> props = new HashMap<>(propertiesChange);\n        ExternalComponentMessage message = messageHelper.newInitMessage(props);\n        externalComponentPresenter.sendMessage(message);\n    }\n\n    public Map<String, String> getNewProperties() {\n        return newProperties;\n    }\n\n    public ExternalComponentPresenter getExternalComponentPresenter() {\n        return externalComponentPresenter;\n    }\n\n    public ExternalComponentPropertiesEditor getPropertiesEditor() {\n        return propertiesEditor;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentEditorPopUp.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class ExternalComponentEditorPopUp extends BaseModal {\n    \n    private final CommonConstants i18n = CommonConstants.INSTANCE;\n\n    @Inject\n    ExternalComponentEditor externalComponentEditor;\n    private Command closeCommand;\n    private Command saveCommand;\n\n    @PostConstruct\n    public void setup() {\n        ModalFooterOKCancelButtons footer = createModalFooterOKCancelButtons();\n        footer.enableCancelButton(true);\n        footer.enableOkButton(true);\n        setBody(externalComponentEditor.asWidget());\n        add(footer);\n        setTitle(i18n.componentEditor());\n        setWidth(1200 + \"px\");\n    }\n\n    public void init(String componentId, Map<String, String> properties, Command closeCommand, Command saveCommand) {\n        this.closeCommand = closeCommand;\n        this.saveCommand = saveCommand;\n        this.addShowHandler(e -> externalComponentEditor.withComponent(componentId, properties));\n        show();\n    }\n\n    protected ModalFooterOKCancelButtons createModalFooterOKCancelButtons() {\n        return new ModalFooterOKCancelButtons(() -> {\n            hide();\n            saveCommand.execute();\n\n        }, () -> {\n            hide();\n            closeCommand.execute();\n        });\n    }\n\n    public Map<String, String> getProperties() {\n        return externalComponentEditor.getNewProperties();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentEditorView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.componentEditorRootContainer {\n    margin-top: 15px;\n}\n\n.componentEditorPropertiesColumn {\n    overflow-x: hidden;\n    overflow-y: auto;\n    height: 370px;\n}\n\n.componentEditorPreviewColumn {\n    height: 390px;\n    overflow: auto;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentEditorView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.componentEditorRoot\n-->\n<div class=\"componentEditorRootContainer\">\n    <div class=\"container\">\n        <div class=\"row\">\n            <div class=\"col-md-3 componentEditorPropertiesColumn\"></div>\n            <div class=\"col-md-9 componentEditorPreviewColumn\"></div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentEditorView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport elemental2.dom.HTMLDivElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class ExternalComponentEditorView extends Composite implements ExternalComponentEditor.View {\n\n    @Inject\n    @DataField\n    HTMLDivElement componentEditorRootContainer;\n\n    @Inject\n    @DataField\n    HTMLDivElement componentEditorPropertiesColumn;\n\n    @Inject\n    @DataField\n    HTMLDivElement componentEditorPreviewColumn;\n\n    @Inject\n    Elemental2DomUtil domUtil;\n\n    @Override\n    public void init(ExternalComponentEditor presenter) {\n        domUtil.appendWidgetToElement(componentEditorPropertiesColumn, presenter.getPropertiesEditor().asWidget());\n        domUtil.appendWidgetToElement(componentEditorPreviewColumn, presenter.getExternalComponentPresenter().getView().asWidget());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPresenter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.function.Consumer;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.DOM;\nimport org.dashbuilder.displayer.client.component.ExternalComponentDispatcher;\nimport org.dashbuilder.displayer.client.component.ExternalComponentListener;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.dashbuilder.displayer.external.ExternalFilterRequest;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class ExternalComponentPresenter implements ExternalComponentListener {\n\n    /**\n     * The base URL for components server. It should match the \n     */\n    private static final String COMPONENT_SERVER_PATH = \"dashbuilder/component\";\n    /**\n     * Unique Runtime ID for the component. It is used to identify messages coming from the component.\n     */\n    final String componentRuntimeId = DOM.createUniqueId();\n\n    private Consumer<ExternalFilterRequest> filterConsumer;\n\n    public interface View extends UberView<ExternalComponentPresenter> {\n\n        void setComponentURL(String url);\n\n        void postMessage(ExternalComponentMessage message);\n\n        void makeReady();\n\n        void configurationIssue(String message);\n\n        void configurationOk();\n\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    ExternalComponentDispatcher dispatcher;\n\n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        dispatcher.register(this);\n    }\n\n    @PreDestroy\n    public void destroy() {\n        dispatcher.unregister(this);\n    }\n\n    @Override\n    public String getId() {\n        return componentRuntimeId;\n    }\n\n    @Override\n    public void onFilter(ExternalFilterRequest filterRequest) {\n        if (filterConsumer != null) {\n            filterConsumer.accept(filterRequest);\n        }\n    }\n\n    @Override\n    public void prepare() {\n        view.makeReady();\n    }\n\n    @Override\n    public void onConfigurationIssue(String message) {\n        view.configurationIssue(message);\n    }\n\n    @Override\n    public void configurationOk() {\n        view.configurationOk();\n    }\n\n    public void withComponent(String componentId) {\n        String url = buildUrl(componentId);\n        view.setComponentURL(url);\n    }\n\n    public void withComponent(String componentId, String partition) {\n        String url = buildUrl(componentId, partition);\n        view.setComponentURL(url);\n    }\n\n    public void sendMessage(ExternalComponentMessage message) {\n        messageHelper.withId(message, componentRuntimeId);\n        view.postMessage(message);\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public void setFilterConsumer(Consumer<ExternalFilterRequest> filterConsumer) {\n        this.filterConsumer = filterConsumer;\n    }\n\n    public String getComponentId() {\n        return componentRuntimeId;\n    }\n\n    private String buildUrl(String componentId) {\n        return buildUrl(componentId, \"\");\n    }\n\n    private String buildUrl(String componentId, String partition) {\n        return String.join(\"/\",\n                           GWT.getHostPageBaseURL(),\n                           COMPONENT_SERVER_PATH,\n                           partition,\n                           componentId,\n                           \"index.html\");\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPropertiesEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Consumer;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.external.model.ComponentParameter;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.properties.editor.model.validators.MandatoryValidator;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\n\n@Dependent\npublic class ExternalComponentPropertiesEditor implements IsWidget {\n    \n    private static final CommonConstants i18n = CommonConstants.INSTANCE;\n    \n    private static final MandatoryValidator MANDATORY_VALIDATOR = new MandatoryValidator();\n\n    private static final String DEFAULT_CATEGORY = \"Component Properties\";\n\n    public interface View extends UberView<ExternalComponentPropertiesEditor> {\n\n        void componentNotFound();\n\n        void addCategories(Collection<PropertyEditorCategory> categories);\n\n        void noPropertiesComponent();\n\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    Caller<ComponentService> externalComponentService;\n\n    @Inject\n    BusyIndicatorView loading;\n\n    private ExternalComponent currentComp;\n\n    Map<String, String> settings;\n\n    Consumer<Map<String, String>> onPropertiesChange;\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void init(String componentId,\n                     Map<String, String> settings,\n                     Consumer<Map<String, String>> onPropertiesChange) {\n        this.settings = new HashMap<>(settings);\n        this.onPropertiesChange = onPropertiesChange;\n        if (componentId == null) {\n            view.componentNotFound();\n        } else {\n            loading.showBusyIndicator(i18n.loadingComponent());\n            externalComponentService.call((Optional<ExternalComponent> comp) -> this.loadProperties(comp))\n                                    .byId(componentId);\n        }\n\n    }\n\n    private void loadProperties(Optional<ExternalComponent> compOp) {\n        loading.hideBusyIndicator();\n        if (compOp.isPresent()) {\n            currentComp = compOp.get();\n            loadProperties();\n        } else {\n            view.componentNotFound();\n        }\n    }\n\n    private void loadProperties() {\n        List<ComponentParameter> parameters = currentComp.getParameters();\n        if (parameters == null || parameters.isEmpty()) {\n            view.noPropertiesComponent();\n        } else {\n            Map<String, PropertyEditorCategory> categories = new HashMap<>();\n            categories.put(DEFAULT_CATEGORY, new PropertyEditorCategory(DEFAULT_CATEGORY));\n            parameters.forEach(this::initializeSetting);\n            notifyPropertyChange();\n            for (ComponentParameter param : parameters) {\n                PropertyEditorCategory category = categories.get(DEFAULT_CATEGORY);\n                if (param.getCategory() != null) {\n                    String catName = param.getCategory();\n                    category = categories.computeIfAbsent(catName, PropertyEditorCategory::new);\n                }\n                category.withField(buildField(param));\n            }\n            view.addCategories(categories.values());\n        }\n    }\n\n    public void onPropertyChange(String key, String value) {\n        settings.put(key, value);\n        notifyPropertyChange();\n    }\n\n    private void notifyPropertyChange() {\n        if (onPropertiesChange != null) {\n            onPropertiesChange.accept(settings);\n        }\n    }\n\n    private PropertyEditorFieldInfo buildField(ComponentParameter p) {\n        String fieldKey = p.getName();\n        String currentValue = settings.get(fieldKey);\n        PropertyEditorType type = getType(p.getType());\n        PropertyEditorFieldInfo field = new PropertyEditorFieldInfo(p.getLabel(), p.getDefaultValue(), type);\n        field.withKey(fieldKey);\n        if (field.getType() == PropertyEditorType.COMBO) {\n            field.withComboValues(p.getComboValues());\n        }\n        if (p.isMandatory()) {\n            field.withValidators(Collections.singleton(MANDATORY_VALIDATOR));\n            field.withHelpInfo(i18n.mandatoryHelpHeader(), i18n.mandatoryHelpText());\n        }\n        if (currentValue != null) {\n            field.setCurrentStringValue(currentValue);\n        }\n        return field;\n    }\n\n    private PropertyEditorType getType(String type) {\n        return Stream.of(PropertyEditorType.values())\n                     .filter(t -> t.name().equalsIgnoreCase(type))\n                     .findFirst().orElse(PropertyEditorType.TEXT);\n    }\n\n    private void initializeSetting(ComponentParameter p) {\n        String componentProperty = settings.get(p.getName());\n        if (componentProperty == null) {\n            settings.put(p.getName(), p.getDefaultValue());\n        }\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    void setExternalComponentService(Caller<ComponentService> externalComponentService) {\n        this.externalComponentService = externalComponentService;\n    }\n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPropertiesEditorView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#externalComponentPropertiesPane {\n    width: 100%;\n    height: 100%;\n}\n\n#externalComponentPropertiesRoot {\n    overflow: auto;\n    height: auto;\n    width: 100%;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPropertiesEditorView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=\"externalComponentPropertiesPane\">\n    <div class=\"alert alert-warning\" data-field=\"messageContainer\">\n        <span class=\"pficon pficon-warning-triangle-o\"></span> <strong\n            data-field=\"messageTextContainer\"></strong>\n    </div>\n    <div id=\"externalComponentPropertiesRoot\"></div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPropertiesEditorView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.user.client.ui.Composite;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\n@Templated\npublic class ExternalComponentPropertiesEditorView extends Composite\n                                                   implements ExternalComponentPropertiesEditor.View {\n    \n    private final CommonConstants i18n = CommonConstants.INSTANCE;\n\n    private final String externalComponentEditorId = Document.get().createUniqueId();\n\n    @Inject\n    @DataField\n    HTMLDivElement externalComponentPropertiesRoot;\n\n    @Inject\n    @DataField\n    HTMLDivElement messageContainer;\n\n    @Inject\n    @DataField\n    @Named(\"strong\")\n    HTMLElement messageTextContainer;\n\n    @Inject\n    Elemental2DomUtil elementalUtil;\n\n    private PropertyEditorWidget propertyEditorWidget;\n\n    private ExternalComponentPropertiesEditor presenter;\n\n    @Override\n    public void init(ExternalComponentPropertiesEditor presenter) {\n        this.presenter = presenter;\n        messageContainer.hidden = true;\n        propertyEditorWidget = new PropertyEditorWidget();\n        elementalUtil.appendWidgetToElement(externalComponentPropertiesRoot, propertyEditorWidget);\n    }\n\n    @Override\n    public void componentNotFound() {\n        showMessage(i18n.componentNotFound());\n    }\n\n    @Override\n    public void addCategories(Collection<PropertyEditorCategory> categories) {\n        messageContainer.hidden = true;\n        externalComponentPropertiesRoot.hidden = false;\n        List<PropertyEditorCategory> catList = new ArrayList<>(categories);\n        propertyEditorWidget.handle(new PropertyEditorEvent(externalComponentEditorId, catList));\n    }\n\n    protected void onPropertyEditorChange(@Observes PropertyEditorChangeEvent event) {\n        PropertyEditorFieldInfo property = event.getProperty();\n        if (property.getEventId().equalsIgnoreCase(externalComponentEditorId)) {\n            presenter.onPropertyChange(property.getKey(), property.getCurrentStringValue());\n        }\n    }\n\n    @Override\n    public void noPropertiesComponent() {\n        showMessage(i18n.noPropertiesComponent());\n    }\n\n    private void showMessage(String message) {\n        messageContainer.hidden = false;\n        externalComponentPropertiesRoot.hidden = true;\n        messageTextContainer.textContent = message;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#externalComponentIFrame {\n    border: 0;\n    width: 100%;\n    height: 100%;\n    display: block;\n    position: relative;\n}\n\n.configuration-error-title-icon {\n    margin-right: 10px;\n}\n\n.configuration-issue-message-box {\n    margin: 10px;\n}\n\n.externalConfigurationIssueDetails {\n    overflow-wrap: break-word;\n    overflow: auto;\n    max-height: 110px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=\"componentRoot\" style=\"width: 100%; height: 100%\">\n    <div data-field=\"configurationIssueRoot\" class=\"configuration-issue-message-box\">\n        <div class=\"card-pf-heading\">\n            <span\n                class=\"pficon pficon-warning-triangle-o configuration-error-title-icon\"></span><span\n                class=\"card-pf-title\"\n                data-i18n-key=\"configurationIssueTitle\"></span>\n        </div>\n        <p data-i18n-key=\"configurationIssueDescription\" class=\"externalConfigurationIssueDetails\"></p>\n        <p data-field=\"configurationDetails\" class=\"externalConfigurationIssueDetails\"></p>\n    </div>\n    <iframe id=\"externalComponentIFrame\"\n        title=\"External Component Container\"></iframe>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/ExternalComponentView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport elemental2.dom.Event;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLIFrameElement;\nimport elemental2.dom.HTMLParagraphElement;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class ExternalComponentView extends Composite implements ExternalComponentPresenter.View {\n\n    @Inject\n    @DataField\n    HTMLDivElement componentRoot;\n\n    @Inject\n    @DataField\n    HTMLIFrameElement externalComponentIFrame;\n\n    @Inject\n    @DataField\n    HTMLDivElement configurationIssueRoot;\n\n    @Inject\n    @DataField\n    HTMLParagraphElement configurationDetails;\n\n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    private boolean componentLoaded = false;\n\n    private ExternalComponentMessage lastMessage;\n\n    private ExternalComponentMessage initMessage;\n\n    @Override\n    public void init(ExternalComponentPresenter presenter) {\n        showComponent();\n    }\n\n    @Override\n    public void setComponentURL(String url) {\n        externalComponentIFrame.src = url;\n        componentLoaded = false;\n        externalComponentIFrame.onload = this::onInvoke;\n    }\n\n    @Override\n    public void postMessage(ExternalComponentMessage message) {\n        if (componentLoaded) {\n            postMessageToComponent(message);\n        } else {\n            if (messageHelper.isInit(message)) {\n                this.initMessage = message;\n            } else {\n                this.lastMessage = message;\n            }\n        }\n    }\n\n    private void postMessageToComponent(Object message) {\n        if (externalComponentIFrame != null && externalComponentIFrame.contentWindow != null) {\n            externalComponentIFrame.contentWindow.postMessage(message, Window.Location.getHref());\n        }\n    }\n\n    @Override\n    public void makeReady() {\n        // ready not supported at the moment.\n    }\n\n    @Override\n    public void configurationIssue(String message) {\n        configurationDetails.textContent = message;\n        showConfigurationIssue();\n    }\n\n    @Override\n    public void configurationOk() {\n        showComponent();\n    }\n    \n    private void showConfigurationIssue() {\n        configurationIssueRoot.style.display = \"block\";\n        externalComponentIFrame.style.display = \"none\";\n    }\n\n    private void showComponent() {\n        configurationIssueRoot.style.display = \"none\";\n        externalComponentIFrame.style.display = \"block\";\n    }\n\n    /**\n     * Workaround to resolve generics after GWT upgrade. See https://issues.redhat.com/browse/AF-2542\n     */\n    private Object onInvoke(Event e) {\n        componentLoaded = true;\n        if (initMessage != null) {\n            postMessageToComponent(initMessage);\n        }\n        if (lastMessage != null) {\n            postMessageToComponent(lastMessage);\n        }\n        return null;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelector.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n * <p/>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p/>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p/>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.List;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\npublic class RendererSelector implements IsWidget {\n\n    public enum SelectorType {\n        LIST, RADIO, TAB;\n    }\n\n    public interface View extends UberView<RendererSelector> {\n\n        void setVisible(boolean visible);\n\n        void setWidth(int width);\n\n        void setHeight(int height);\n\n        void clearRendererSelector();\n\n        void addRendererItem(String renderer);\n\n        void setSelectedRendererIndex(int index);\n\n        String getRendererSelected();\n    }\n\n    public interface TabListView extends View {\n\n    }\n\n    public interface ListBoxView extends View {\n\n    }\n\n    public interface RadioListView extends View {\n\n    }\n\n    View tabListView;\n    View listBoxView;\n    View radioListView;\n    View view;\n    RendererManager rendererManager;\n    RendererLibrary rendererLibrary;\n\n    Command selectCommand;\n\n    @Inject\n    public RendererSelector(TabListView tabListView,\n                            ListBoxView listBoxView,\n                            RadioListView radioListView,\n                            RendererManager rendererManager) {\n        this.tabListView = tabListView;\n        this.listBoxView = listBoxView;\n        this.radioListView = radioListView;\n        this.rendererManager = rendererManager;\n        this.rendererLibrary = null;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public RendererLibrary getRendererLibrary() {\n        return rendererLibrary;\n    }\n\n    public void init(DisplayerSettings displayerSettings,\n                     SelectorType selectorType, int width,\n                     Command onSelectCommand) {\n\n        // Choose the target view\n        switch (selectorType) {\n            case LIST:\n                view = listBoxView;\n                break;\n            case RADIO:\n                view = radioListView;\n                break;\n            case TAB:\n                view = tabListView;\n                break;\n        }\n\n        this.view.init(this);\n        this.selectCommand = onSelectCommand;\n\n        RendererLibrary rendererLibrary = rendererManager.getRendererForDisplayer(displayerSettings);\n        List<RendererLibrary> renderers = rendererManager.getRenderersForType(displayerSettings.getType(), displayerSettings.getSubtype());\n        if (renderers != null && renderers.size() > 1) {\n\n            view.setVisible(true);\n            view.setWidth(width);\n            view.clearRendererSelector();\n\n            // Build the selector\n            for (int i=0; i<renderers.size(); i++) {\n                RendererLibrary rendererLib = renderers.get(i);\n                view.addRendererItem(rendererLib.getName());\n\n                if (rendererLibrary != null && rendererLib.equals(rendererLibrary)) {\n                    view.setSelectedRendererIndex(i);\n                }\n            }\n        }\n        // If there is only one renderer in the list, do not show the selector.\n        else {\n            view.setVisible(false);\n        }\n    }\n\n    // View notifications\n\n    void onRendererSelected() {\n        if (view.getRendererSelected() != null) {\n            rendererLibrary = rendererManager.getRendererByName(view.getRendererSelected());\n            selectCommand.execute();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorListBoxView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n * <p/>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p/>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p/>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.ListBox;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class RendererSelectorListBoxView extends Composite implements RendererSelector.ListBoxView {\n\n    interface RendererSelectorBinder extends UiBinder<Widget, RendererSelectorListBoxView> {}\n    private static final RendererSelectorBinder uiBinder = GWT.create(RendererSelectorBinder.class);\n\n    @UiField\n    Panel mainPanel;\n\n    @UiField\n    ListBox listBox;\n\n    RendererSelector presenter = null;\n\n    @Override\n    public void init(final RendererSelector presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n\n        listBox.addChangeHandler(new ChangeHandler() {\n            public void onChange(ChangeEvent event) {\n                presenter.onRendererSelected();\n            }\n        });\n    }\n\n    @Override\n    public void setWidth(int width) {\n        super.setWidth(width + \"px\");\n        mainPanel.setWidth(width + \"px\");\n        listBox.setWidth(width + \"px\");\n    }\n\n    @Override\n    public void setHeight(int height) {\n        super.setHeight(height + \"px\");\n        mainPanel.setHeight(height + \"px\");\n        listBox.setWidth(height + \"px\");\n    }\n\n    @Override\n    public void clearRendererSelector() {\n        listBox.clear();\n    }\n\n    @Override\n    public void addRendererItem(String renderer) {\n        listBox.addItem(renderer);\n    }\n\n    @Override\n    public void setSelectedRendererIndex(int index) {\n        listBox.setSelectedIndex(index);\n    }\n\n    @Override\n    public String getRendererSelected() {\n        return listBox.getSelectedValue();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorListBoxView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .mainPanelStyle {\n      margin: 10px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanelStyle}\" title=\"{i18n.renderer_selector_title}\">\n\n    <g:ListBox ui:field=\"listBox\"/>\n\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorRadioListView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n * <p/>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p/>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p/>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.RadioButton;\n\npublic class RendererSelectorRadioListView extends Composite implements RendererSelector.RadioListView {\n\n    interface RendererSelectorBinder extends UiBinder<Widget, RendererSelectorRadioListView> {}\n    private static final RendererSelectorBinder uiBinder = GWT.create(RendererSelectorBinder.class);\n\n    @UiField\n    HorizontalPanel radioButtonsPanel;\n\n    RendererSelector presenter = null;\n    RadioButton selectedRadio = null;\n\n    @Override\n    public void init(final RendererSelector presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setWidth(int width) {\n        super.setWidth(width + \"px\");\n        radioButtonsPanel.setWidth(width + \"px\");\n    }\n\n    @Override\n    public void setHeight(int height) {\n        super.setHeight(height + \"px\");\n        radioButtonsPanel.setHeight(height + \"px\");\n    }\n\n    @Override\n    public void clearRendererSelector() {\n        radioButtonsPanel.clear();\n        selectedRadio = null;\n    }\n\n    @Override\n    public void addRendererItem(final String renderer) {\n        final RadioButton rb = new RadioButton(renderer);\n        rb.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                unselectCurrent();\n                presenter.onRendererSelected();\n            }\n        });\n        radioButtonsPanel.add(rb);\n    }\n\n    protected void unselectCurrent() {\n        if (selectedRadio != null) {\n            selectedRadio.setValue(false);\n        }\n    }\n\n    @Override\n    public void setSelectedRendererIndex(int index) {\n        unselectCurrent();\n        selectedRadio = (RadioButton) radioButtonsPanel.getWidget(index);\n        selectedRadio.setValue(true);\n    }\n\n    @Override\n    public String getRendererSelected() {\n        return selectedRadio == null ? null : selectedRadio.getText();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorRadioListView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .mainPanelStyle {\n      margin: 10px;\n    }\n  </ui:style>\n\n  <g:HorizontalPanel ui:field=\"radioButtonsPanel\" addStyleNames=\"{style.mainPanelStyle}\" title=\"{i18n.renderer_selector_title}\" spacing=\"10\" />\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorTabListView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n * <p/>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p/>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p/>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabContent;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.TabPanel;\n\npublic class RendererSelectorTabListView extends Composite implements RendererSelector.TabListView {\n\n    interface RendererSelectorBinder extends UiBinder<Widget, RendererSelectorTabListView> {}\n    private static final RendererSelectorBinder uiBinder = GWT.create(RendererSelectorBinder.class);\n\n    @UiField\n    TabPanel tabPanel;\n\n    @UiField\n    TabContent tabContent;\n\n    @UiField\n    NavTabs navTabs;\n\n    RendererSelector presenter = null;\n    TabListItem selectedTab = null;\n\n    @Override\n    public void init(final RendererSelector presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setWidth(int width) {\n        super.setWidth(width + \"px\");\n        tabPanel.setWidth(width + \"px\");\n    }\n\n    @Override\n    public void setHeight(int height) {\n        super.setHeight(height + \"px\");\n        tabPanel.setHeight(height + \"px\");\n    }\n\n    @Override\n    public void clearRendererSelector() {\n        tabContent.clear();\n        navTabs.clear();\n        selectedTab = null;\n    }\n\n    @Override\n    public void addRendererItem(final String renderer) {\n        final TabPane pane = new TabPane();\n        final TabListItem tabListItem = new TabListItem();\n\n        tabListItem.setDataTargetWidget(pane);\n        tabListItem.setText(renderer);\n        tabListItem.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                selectedTab = tabListItem;\n                presenter.onRendererSelected();\n            }\n        });\n\n        tabContent.add(pane);\n        navTabs.add(tabListItem);\n    }\n\n    @Override\n    public void setSelectedRendererIndex(int index) {\n        TabListItem tabListItem = (TabListItem) navTabs.getWidget(index);\n        tabListItem.setActive(true);\n        tabListItem.showTab();\n    }\n\n    @Override\n    public String getRendererSelected() {\n        return selectedTab == null ? null : selectedTab.getText().trim();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/RendererSelectorTabListView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .mainPanelStyle {\n      margin: 10px;\n    }\n  </ui:style>\n\n  <b:TabPanel ui:field=\"tabPanel\" addStyleNames=\"{style.mainPanelStyle}\" title=\"{i18n.renderer_selector_title}\" tabPosition=\"TOP\">\n    <b:TabContent ui:field=\"tabContent\"/>\n    <b:NavTabs ui:field=\"navTabs\"/>\n  </b:TabPanel>\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/ColumnFilterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.Iterator;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.date.TimeFrame;\nimport org.dashbuilder.displayer.client.events.ColumnFilterChangedEvent;\nimport org.dashbuilder.displayer.client.events.ColumnFilterDeletedEvent;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class ColumnFilterEditor implements IsWidget {\n\n    public interface View extends UberView<ColumnFilterEditor> {\n\n        void clearFunctionSelector();\n\n        void addFunctionItem(CoreFunctionType function);\n\n        void setFunctionSelected(String function);\n\n        int getSelectedFunctionIndex();\n\n        void showFilterConfig();\n\n        void clearFilterConfig();\n\n        void addFilterConfigWidget(IsWidget widget);\n\n        String formatDate(Date date);\n\n        String formatNumber(Number number);\n    }\n\n    View view = null;\n    SyncBeanManager beanManager = null;\n    ColumnFilter filter = null;\n    DataSetMetadata metadata = null;\n    Event<ColumnFilterChangedEvent> changedEvent = null;\n    Event<ColumnFilterDeletedEvent> deletedEvent = null;\n\n    @Inject\n    public ColumnFilterEditor(View view,\n                              SyncBeanManager beanManager,\n                              Event<ColumnFilterChangedEvent> changedEvent,\n                              Event<ColumnFilterDeletedEvent> deletedEvent) {\n        this.view = view;\n        this.beanManager = beanManager;\n        this.changedEvent = changedEvent;\n        this.deletedEvent = deletedEvent;\n        this.view.init(this);\n    }\n\n    public void init(DataSetMetadata metadata, ColumnFilter filter) {\n        this.filter = filter;\n        this.metadata = metadata;\n        initFilterSelector();\n        initFilterConfig();\n    }\n\n    public ColumnFilter getFilter() {\n        return filter;\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void expand() {\n        view.showFilterConfig();\n    }\n\n    // View notifications\n\n    public void onSelectFilterFunction() {\n        int selectedIdx = view.getSelectedFunctionIndex();\n        if (selectedIdx >= 0) {\n            CoreFunctionFilter coreFilter = getCoreFilter();\n            CoreFunctionType functionType = getAvailableFunctions(coreFilter).get(selectedIdx);\n\n            ColumnType columnType = metadata.getColumnType(coreFilter.getColumnId());\n            List params = FilterFactory.createParameters(columnType, functionType);\n            coreFilter.setType(functionType);\n            coreFilter.setParameters(params);\n\n            initFilterSelector();\n            fireFilterChanged();\n\n            if (!initFilterConfig().isEmpty()) {\n                view.showFilterConfig();\n            }\n        }\n    }\n\n    public void onDeleteFilter() {\n        deletedEvent.fire(new ColumnFilterDeletedEvent(this));\n    }\n\n    // Internals\n\n    protected CoreFunctionFilter getCoreFilter() {\n        try {\n            return (CoreFunctionFilter) filter;\n        }\n        catch (Exception e) {\n            return null;\n        }\n    }\n\n    protected List<FunctionParameterEditor> createFilterInputControls() {\n        List<FunctionParameterEditor> filterInputControls = new ArrayList<FunctionParameterEditor>();\n        CoreFunctionFilter coreFilter = getCoreFilter();\n        if (CoreFunctionType.LIKE_TO.equals(coreFilter.getType())) {\n            FunctionParameterEditor paramInput = createLikeToFunctionWidget(coreFilter);\n            filterInputControls.add(paramInput);\n        }\n        else {\n            for (int i = 0; i < coreFilter.getType().getParametersCount(); i++) {\n                FunctionParameterEditor paramInput = createParamInputWidget(coreFilter, i);\n                filterInputControls.add(paramInput);\n            }\n        }\n        return filterInputControls;\n    }\n\n    protected void initFilterSelector() {\n        CoreFunctionFilter coreFilter = getCoreFilter();\n        if (coreFilter != null) {\n            view.clearFunctionSelector();\n            String currentFunction = formatFilterFunction(coreFilter);\n            view.setFunctionSelected(currentFunction);\n\n            List<CoreFunctionType> calculateAvailableFunctions = getAvailableFunctions(coreFilter);\n            for (CoreFunctionType functionType : calculateAvailableFunctions) {\n                view.addFunctionItem(functionType);\n            }\n        }\n    }\n\n    protected List<CoreFunctionType> getAvailableFunctions(CoreFunctionFilter coreFilter) {\n        ColumnType columnType = metadata.getColumnType(coreFilter.getColumnId());\n        List<CoreFunctionType> functionTypes = CoreFunctionType.getSupportedTypes(columnType);\n        Iterator<CoreFunctionType> it = functionTypes.iterator();\n        while (it.hasNext()) {\n            CoreFunctionType next = it.next();\n            if (next.equals(coreFilter.getType())) {\n                it.remove();\n            }\n        }\n        return functionTypes;\n    }\n\n    protected List<FunctionParameterEditor> initFilterConfig() {\n        view.clearFilterConfig();\n        List<FunctionParameterEditor> inputs = createFilterInputControls();\n        if (!inputs.isEmpty()) {\n            for (IsWidget input : inputs) {\n                view.addFilterConfigWidget(input);\n            }\n            inputs.get(0).setFocus(true);\n        }\n        return inputs;\n    }\n\n    protected void updateSelectedFilter() {\n        String currentFunction = formatFilterFunction(getCoreFilter());\n        view.setFunctionSelected(currentFunction);\n        fireFilterChanged();\n    }\n\n    protected void fireFilterChanged() {\n        changedEvent.fire(new ColumnFilterChangedEvent(this));\n    }\n\n    protected FunctionParameterEditor createParamInputWidget(final CoreFunctionFilter coreFilter, final int paramIndex) {\n        final List paramList = coreFilter.getParameters();\n        ColumnType columnType = metadata.getColumnType(coreFilter.getColumnId());\n        CoreFunctionType functionType = coreFilter.getType();\n        boolean isMultiple = CoreFunctionType.IN.equals(functionType) || CoreFunctionType.NOT_IN.equals(functionType);\n\n        if (ColumnType.DATE.equals(columnType)) {\n            if (CoreFunctionType.TIME_FRAME.equals(coreFilter.getType())) {\n                return createTimeFrameWidget(paramList, paramIndex);\n            }\n            return createDateInputWidget(paramList, paramIndex);\n        }\n\n        if (!isMultiple) {\n            if (ColumnType.NUMBER.equals(columnType)) {\n                return createNumberInputWidget(paramList, paramIndex);\n            }\n            return createTextInputWidget(paramList, paramIndex);\n        } else {\n            if (ColumnType.NUMBER.equals(columnType)) {\n                return createMultipleNumberInputWidget(paramList);\n            }\n            return createMultipleTextInputWidget(paramList);\n        }\n    }\n\n    protected FunctionParameterEditor createDateInputWidget(final List paramList, final int paramIndex) {\n        Date param = (Date) paramList.get(paramIndex);\n\n        final DateParameterEditor input = beanManager.lookupBean(DateParameterEditor.class).newInstance();\n        input.setValue(param);\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                paramList.set(paramIndex, input.getValue());\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createNumberInputWidget(final List paramList, final int paramIndex) {\n        final NumberParameterEditor input = beanManager.lookupBean(NumberParameterEditor.class).newInstance();\n        input.setValue(Double.parseDouble(paramList.get(paramIndex).toString()));\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                paramList.set(paramIndex, input.getValue());\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createTextInputWidget(final List paramList, final int paramIndex) {\n        final TextParameterEditor input = beanManager.lookupBean(TextParameterEditor.class).newInstance();\n        input.setValue((String) paramList.get(paramIndex));\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                paramList.set(paramIndex, input.getValue());\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createMultipleNumberInputWidget(final List paramList) {\n        final MultipleNumberParameterEditor input = beanManager.lookupBean(MultipleNumberParameterEditor.class).newInstance();\n        input.setValues(paramList);\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createMultipleTextInputWidget(final List paramList) {\n        final MultipleTextParameterEditor input = beanManager.lookupBean(MultipleTextParameterEditor.class).newInstance();\n        input.setValues(paramList);\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createTimeFrameWidget(final List paramList, final int paramIndex) {\n        TimeFrame timeFrame = TimeFrame.parse((String) paramList.get(paramIndex));\n\n        final TimeFrameEditor input = beanManager.lookupBean(TimeFrameEditor.class).newInstance();\n        input.init(timeFrame, new Command() {\n            public void execute() {\n                paramList.set(paramIndex, input.getTimeFrame().toString());\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    protected FunctionParameterEditor createLikeToFunctionWidget(final CoreFunctionFilter coreFilter) {\n        final LikeToFunctionEditor input = beanManager.lookupBean(LikeToFunctionEditor.class).newInstance();\n        final List paramList = coreFilter.getParameters();\n        String pattern = (String) paramList.get(0);\n        boolean caseSensitive = paramList.size() < 2 || Boolean.parseBoolean(paramList.get(1).toString());\n\n        input.setCaseSensitive(caseSensitive);\n        input.setPattern(pattern);\n        input.setOnChangeCommand(new Command() {\n            public void execute() {\n                paramList.clear();\n                paramList.add(input.getPattern());\n                if (!input.isCaseSensitive()) {\n                    // Only add if disabled since case sensitive is enabled by default.\n                    paramList.add(input.isCaseSensitive());\n                }\n                updateSelectedFilter();\n            }\n        });\n        return input;\n    }\n\n    public String formatFilterFunction(CoreFunctionFilter filter) {\n        String columnId = filter.getColumnId();\n        CoreFunctionType type = filter.getType();\n        List parameters = filter.getParameters();\n\n        StringBuilder out = new StringBuilder();\n\n        if (CoreFunctionType.BETWEEN.equals(type)) {\n            out.append(columnId).append(\" [\");\n            formatParameters(out, parameters);\n            out.append(\"]\");\n        }\n        else if (CoreFunctionType.GREATER_THAN.equals(type)) {\n            out.append(columnId).append(\" > \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.GREATER_OR_EQUALS_TO.equals(type)) {\n            out.append(columnId).append(\" >= \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.LOWER_THAN.equals(type)) {\n            out.append(columnId).append(\" < \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.LOWER_OR_EQUALS_TO.equals(type)) {\n            out.append(columnId).append(\" <= \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.EQUALS_TO.equals(type)) {\n            out.append(columnId).append(\" = \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.NOT_EQUALS_TO.equals(type)) {\n            out.append(columnId).append(\" != \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.LIKE_TO.equals(type)) {\n            out.append(columnId).append(\" like \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.IS_NULL.equals(type)) {\n            out.append(columnId).append(\" = null \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.NOT_NULL.equals(type)) {\n            out.append(columnId).append(\" != null \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.TIME_FRAME.equals(type)) {\n            out.append(columnId).append(\" = \");\n            formatParameters(out, parameters);\n        }\n        else if (CoreFunctionType.IN.equals(type)) {\n            out.append(columnId).append(\" in (\");\n            formatParameters(out, parameters);\n            out.append(\")\");\n        }\n        else if (CoreFunctionType.NOT_IN.equals(type)) {\n            out.append(columnId).append(\" not in (\");\n            formatParameters(out, parameters);\n            out.append(\")\");\n        }\n        return out.toString();\n    }\n\n    protected StringBuilder formatParameters(StringBuilder out, List parameters) {\n        for (int i=0; i< parameters.size();  i++) {\n            if (i > 0) out.append(\" \");\n            out.append(formatParameter(parameters.get(i)));\n        }\n        return out;\n    }\n\n    protected String formatParameter(Object p) {\n        if (p == null) {\n            return \"\";\n        }\n        if (p instanceof Date) {\n            Date d = (Date) p;\n            return view.formatDate(d);\n        }\n        if (p instanceof Number) {\n            Number n = (Number) p;\n            return view.formatNumber(n);\n        }\n        return p.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/ColumnFilterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Date;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.i18n.client.NumberFormat;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.CoreFunctionTypeConstants;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class ColumnFilterEditorView extends Composite implements ColumnFilterEditor.View {\n\n    interface Binder extends UiBinder<Widget, ColumnFilterEditorView> {\n\n    }\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    ColumnFilterEditor presenter;\n    boolean functionSelected = false;\n\n    @UiField\n    ListBox filterListBox;\n\n    @UiField\n    Button filterDeleteIcon;\n\n    @UiField\n    Button filterExpandIcon;\n\n    @UiField\n    Panel filterDetailsPanel;\n\n    // View interface\n\n    public void init(ColumnFilterEditor presenter) {\n        this.presenter = checkNotNull(\"presenter\",\n                                      presenter);\n        initWidget(uiBinder.createAndBindUi(this));\n\n        filterExpandIcon.addDomHandler(new ClickHandler() {\n                                           public void onClick(ClickEvent event) {\n                                               onExpandCollapseDetails();\n                                           }\n                                       },\n                                       ClickEvent.getType());\n        filterDeleteIcon.addDomHandler(new ClickHandler() {\n                                           public void onClick(ClickEvent event) {\n                                               onDeleteFilter();\n                                           }\n                                       },\n                                       ClickEvent.getType());\n    }\n\n    @Override\n    public void clearFunctionSelector() {\n        filterListBox.clear();\n        functionSelected = false;\n    }\n\n    @Override\n    public void addFunctionItem(CoreFunctionType ft) {\n        String function = CoreFunctionTypeConstants.INSTANCE.getString(ft.name());\n        filterListBox.addItem(function);\n        filterExpandIcon.setVisible(true);\n    }\n\n    @Override\n    public void setFunctionSelected(String function) {\n        filterListBox.insertItem(function,\n                                 0);\n        filterListBox.setTitle(function);\n        if (functionSelected) {\n            filterListBox.removeItem(1);\n        }\n        functionSelected = true;\n    }\n\n    @Override\n    public int getSelectedFunctionIndex() {\n        return filterListBox.getSelectedIndex() - (functionSelected ? 1 : 0);\n    }\n\n    @Override\n    public void showFilterConfig() {\n        filterExpandIcon.setVisible(true);\n        filterExpandIcon.setIcon(IconType.ANGLE_DOWN);\n        filterExpandIcon.setTitle(CommonConstants.INSTANCE.collapse());\n        filterDetailsPanel.setVisible(true);\n    }\n\n    public void hideParamConfigWidgets() {\n        filterDetailsPanel.setVisible(false);\n        filterExpandIcon.setIcon(IconType.ANGLE_RIGHT);\n        filterExpandIcon.setTitle(CommonConstants.INSTANCE.expand());\n    }\n\n    @Override\n    public void addFilterConfigWidget(IsWidget widget) {\n        filterDetailsPanel.add(widget);\n        filterExpandIcon.setVisible(true);\n    }\n\n    @Override\n    public void clearFilterConfig() {\n        filterDetailsPanel.clear();\n        filterDetailsPanel.setVisible(false);\n        filterExpandIcon.setVisible(false);\n    }\n\n    // UI events\n\n    @UiHandler(value = \"filterListBox\")\n    public void onFilterSelected(ChangeEvent changeEvent) {\n        presenter.onSelectFilterFunction();\n    }\n\n    public void onExpandCollapseDetails() {\n        if (filterDetailsPanel.isVisible()) {\n            hideParamConfigWidgets();\n        } else {\n            showFilterConfig();\n        }\n    }\n\n    protected void onDeleteFilter() {\n        presenter.onDeleteFilter();\n    }\n\n    // Internals\n\n    DateTimeFormat _dateTimeFormat = DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_MEDIUM);\n    NumberFormat _numberFormat = NumberFormat.getDecimalFormat();\n\n    @Override\n    public String formatDate(Date date) {\n        return _dateTimeFormat.format(date);\n    }\n\n    @Override\n    public String formatNumber(Number number) {\n        return _numberFormat.format(number);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/ColumnFilterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .filterDetailsPanel {\n      width: 100%;\n      padding: 5px;\n      border-radius: 5px;\n    }\n\n    .filter-padding {\n      padding-bottom: 5px;\n    }\n  </ui:style>\n\n  <g:FlowPanel styleName=\"{style.filter-padding}\">\n    <g:FlowPanel addStyleNames=\"form-inline\">\n      <b:Button icon=\"ANGLE_DOWN\" ui:field=\"filterExpandIcon\" type=\"LINK\" iconSize=\"LARGE\" visible=\"false\" iconFixedWidth=\"true\" />\n      <b:ListBox ui:field=\"filterListBox\" width=\"240px\"/>\n      <b:Button icon=\"TRASH\" ui:field=\"filterDeleteIcon\" type=\"LINK\" iconSize=\"LARGE\" iconFixedWidth=\"true\" title=\"{i18n.removeFilter}\"/>\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"filterDetailsPanel\" visible=\"false\" styleName=\"{style.filterDetailsPanel}\"/>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DataSetFilterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.client.events.ColumnFilterChangedEvent;\nimport org.dashbuilder.displayer.client.events.ColumnFilterDeletedEvent;\nimport org.dashbuilder.displayer.client.events.DataSetFilterChangedEvent;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class DataSetFilterEditor implements IsWidget {\n\n    public interface View extends UberView<DataSetFilterEditor> {\n\n        void showNewFilterHome();\n\n        void clearColumnSelector();\n\n        void showColumnSelector();\n\n        void addColumn(String column);\n\n        int getSelectedColumnIndex();\n\n        void resetSelectedColumn();\n\n        void clearColumnFilterEditors();\n\n        void addColumnFilterEditor(ColumnFilterEditor editor);\n\n        void removeColumnFilterEditor(ColumnFilterEditor editor);\n    }\n\n    View view = null;\n    DataSetFilter filter = null;\n    DataSetMetadata metadata = null;\n    SyncBeanManager beanManager;\n    Event<DataSetFilterChangedEvent> changeEvent;\n\n    @Inject\n    public DataSetFilterEditor(View view,\n                               SyncBeanManager beanManager,\n                               Event<DataSetFilterChangedEvent> changeEvent) {\n        this.view = view;\n        this.beanManager = beanManager;\n        this.changeEvent = changeEvent;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public DataSetFilter getFilter() {\n        return filter;\n    }\n\n    public void init(DataSetFilter filter, DataSetMetadata metadata) {\n        this.filter = filter;\n        this.metadata = metadata;\n        view.showNewFilterHome();\n        view.clearColumnSelector();\n        if (metadata != null) {\n            for (int i = 0; i < metadata.getNumberOfColumns(); i++) {\n                view.addColumn(metadata.getColumnId(i));\n            }\n        }\n\n        view.clearColumnFilterEditors();\n        if (filter != null) {\n            for (ColumnFilter columnFilter : filter.getColumnFilterList()) {\n                ColumnFilterEditor columnFilterEditor = beanManager.lookupBean(ColumnFilterEditor.class).newInstance();\n                columnFilterEditor.init(metadata, columnFilter);\n                view.addColumnFilterEditor(columnFilterEditor);\n            }\n        }\n    }\n\n    // View notifications\n\n    public void onNewFilterStart() {\n        view.showColumnSelector();\n    }\n\n    public void onNewFilterCancel() {\n        view.showNewFilterHome();\n    }\n\n    public void onCreateFilter() {\n        int selectedIdx = view.getSelectedColumnIndex();\n        String columnId = metadata.getColumnId(selectedIdx);\n        ColumnType columnType = metadata.getColumnType(selectedIdx);\n        CoreFunctionFilter columnFilter = FilterFactory.createCoreFunctionFilter(\n                columnId, columnType,\n                ColumnType.DATE.equals(columnType) ? CoreFunctionType.TIME_FRAME : CoreFunctionType.NOT_EQUALS_TO);\n\n        if (filter == null) {\n            filter = new DataSetFilter();\n        }\n        filter.addFilterColumn(columnFilter);\n\n        ColumnFilterEditor columnFilterEditor = beanManager.lookupBean(ColumnFilterEditor.class).newInstance();\n        columnFilterEditor.init(metadata, columnFilter);\n        columnFilterEditor.expand();\n\n        view.addColumnFilterEditor(columnFilterEditor);\n        view.resetSelectedColumn();\n        view.showNewFilterHome();\n        changeEvent.fire(new DataSetFilterChangedEvent(filter));\n    }\n\n    // Column filter child component callbacks\n\n    protected void onColumnFilterChanged(@Observes ColumnFilterChangedEvent event) {\n        changeEvent.fire(new DataSetFilterChangedEvent(filter));\n    }\n\n    protected void onColumnFilterDeleted(@Observes final ColumnFilterDeletedEvent event) {\n        ColumnFilterEditor editor = event.getColumnFilterEditor();\n        ColumnFilter columnFilter = editor.getFilter();\n        filter.getColumnFilterList().remove(columnFilter);\n        view.removeColumnFilterEditor(editor);\n        view.showNewFilterHome();\n\n        beanManager.destroyBean(editor);\n        changeEvent.fire(new DataSetFilterChangedEvent(filter));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DataSetFilterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.ListBox;\n\npublic class DataSetFilterEditorView extends Composite implements DataSetFilterEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetFilterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    ListBox newFilterListBox;\n\n    @UiField\n    Panel filterListPanel;\n\n    @UiField\n    Button addFilterButton;\n\n    @UiField\n    Panel addFilterPanel;\n\n    @UiField\n    Button filterDeleteIcon;\n\n    DataSetFilterEditor presenter = null;\n\n    public DataSetFilterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n        filterDeleteIcon.addDomHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                onNewFilterClosed(event);\n            }\n        }, ClickEvent.getType());\n    }\n\n    @Override\n    public void init(DataSetFilterEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showNewFilterHome() {\n        addFilterButton.setVisible(true);\n        addFilterPanel.setVisible(false);\n    }\n\n    @Override\n    public void clearColumnSelector() {\n        newFilterListBox.clear();\n        newFilterListBox.addItem(CommonConstants.INSTANCE.filter_editor_selectcolumn());\n    }\n\n    @Override\n    public void showColumnSelector() {\n        addFilterButton.setVisible(false);\n        addFilterPanel.setVisible(true);\n    }\n\n    @Override\n    public void addColumn(String column) {\n        newFilterListBox.addItem(column);\n    }\n\n    @Override\n    public int getSelectedColumnIndex() {\n        return newFilterListBox.getSelectedIndex() - 1;\n    }\n\n    @Override\n    public void resetSelectedColumn() {\n        newFilterListBox.setSelectedIndex(0);\n    }\n\n    @Override\n    public void clearColumnFilterEditors() {\n        filterListPanel.clear();\n    }\n\n    @Override\n    public void addColumnFilterEditor(ColumnFilterEditor editor) {\n        filterListPanel.add(editor);\n    }\n\n    @Override\n    public void removeColumnFilterEditor(ColumnFilterEditor editor) {\n        filterListPanel.remove(editor);\n    }\n\n    // UI events\n\n    @UiHandler(value = \"addFilterButton\")\n    public void onAddFilterClicked(ClickEvent event) {\n        presenter.onNewFilterStart();\n    }\n\n    public void onNewFilterClosed(ClickEvent event) {\n        presenter.onNewFilterCancel();\n    }\n\n    @UiHandler(value = \"newFilterListBox\")\n    public void onNewFilterSelected(ChangeEvent changeEvent) {\n        presenter.onCreateFilter();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DataSetFilterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .filter-editor-margin {\n      margin-left: 35px;\n    }\n  </ui:style>\n\n  <g:FlowPanel>\n    <g:FlowPanel ui:field=\"filterListPanel\" />\n    <g:HorizontalPanel ui:field=\"addFilterPanel\" visible=\"false\">\n      <b:ListBox ui:field=\"newFilterListBox\" width=\"240px\" addStyleNames=\"{style.filter-editor-margin}\"/>\n      <b:Button icon=\"TRASH\" ui:field=\"filterDeleteIcon\" type=\"LINK\" iconSize=\"LARGE\" iconFixedWidth=\"true\" title=\"{i18n.removeFilter}\"/>\n    </g:HorizontalPanel>\n    <b:Button ui:field=\"addFilterButton\" type=\"LINK\" text=\"{i18n.common_button_addnew}\"/>\n  </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DateParameterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Date;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class DateParameterEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<DateParameterEditor> {\n\n        Date getValue();\n\n        void setValue(Date value);\n\n        void setWidth(int width);\n    }\n\n    Command onChangeCommand = () -> {};\n    Command onFocusCommand = () -> {};\n    Command onBlurCommand = () -> {};\n    View view;\n    Date currentValue = null;\n\n    @Inject\n    public DateParameterEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public void setOnFocusCommand(Command onFocusCommand) {\n        this.onFocusCommand = onFocusCommand;\n    }\n\n    public void setOnBlurCommand(Command onBlurCommand) {\n        this.onBlurCommand = onBlurCommand;\n    }\n\n    public Date getValue() {\n        return view.getValue();\n    }\n\n    public void setValue(Date value) {\n        Command backup = onChangeCommand;\n        this.currentValue = value;\n        try {\n            onChangeCommand = null;\n            view.setValue(value);\n        } finally {\n            onChangeCommand = backup;\n        }\n    }\n\n    public void setWidth(int width) {\n        if (width > 0) {\n            view.setWidth(width);\n        }\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n    }\n\n    void onChange() {\n        if (onChangeCommand != null && !currentValue.equals(getValue())) {\n            currentValue = getValue();\n            onChangeCommand.execute();\n        }\n    }\n\n    void onBlur() {\n        if (onBlurCommand != null) {\n            onBlurCommand.execute();\n        }\n    }\n\n    void onFocus() {\n        if (onFocusCommand!= null) {\n            onFocusCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DateParameterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Date;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.uberfire.ext.widgets.common.client.common.DatePicker;\n\n@Dependent\npublic class DateParameterEditorView extends Composite implements DateParameterEditor.View {\n\n    interface Binder extends UiBinder<Widget, DateParameterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    DateParameterEditor presenter;\n\n    @UiField\n    DatePicker input;\n\n    @UiField\n    Button icon;\n\n    protected boolean show = false;\n\n    public DateParameterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final DateParameterEditor presenter) {\n        this.presenter = presenter;\n        input.addValueChangeHandler(e -> {\n            presenter.onChange();\n        });\n        input.addBlurHandler(e -> {\n            presenter.onBlur();\n        });\n        input.addShowHandler(e -> {\n            presenter.onFocus();\n            show = true;\n        });\n        input.addHideHandler(e -> {\n            show = false;\n        });\n        icon.addClickHandler(e -> {\n            if (!show) {\n                input.onShow(null);\n            }\n        });\n    }\n\n    @Override\n    public Date getValue() {\n        return input.getValue();\n    }\n\n    @Override\n    public void setValue(Date value) {\n        input.setValue(value);\n    }\n\n    @Override\n    public void setWidth(int width) {\n        input.asWidget().getElement().getStyle().setWidth(width, Style.Unit.PX);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/DateParameterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:u='urn:import:org.uberfire.ext.widgets.common.client.common'>\n\n    <ui:style>\n        .datePicker {\n            float: left;\n            width: 275px;\n        }\n        .calendarIcon {\n            margin-left: -1px;\n        }\n    </ui:style>\n\n    <g:FlowPanel>\n      <u:DatePicker ui:field=\"input\" styleName=\"{style.datePicker}\" addStyleNames=\"form-control\" />\n      <b:Button  ui:field=\"icon\" icon=\"CALENDAR\" styleName=\"{style.calendarIcon}\" />\n    </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/FunctionParameterEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface FunctionParameterEditor extends IsWidget {\n\n    void setFocus(boolean focus);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/LikeToFunctionEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class LikeToFunctionEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<LikeToFunctionEditor> {\n\n        void setPattern(String pattern);\n\n        void setCaseSensitive(boolean caseSensitive);\n\n        String getPattern();\n\n        boolean isCaseSensitive();\n\n        void setFocus(boolean focus);\n\n        void error();\n    }\n\n    Command onChangeCommand = new Command() { public void execute() {} };\n    String pattern;\n    View view;\n\n    @Inject\n    public LikeToFunctionEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public void setPattern(String pattern) {\n        this.pattern = pattern;\n        view.setPattern(pattern);\n    }\n\n    public void setCaseSensitive(boolean caseSensitive) {\n        view.setCaseSensitive(caseSensitive);\n    }\n\n    public String getPattern() {\n        return pattern;\n    }\n\n    public boolean isCaseSensitive() {\n        return view.isCaseSensitive();\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n        view.setFocus(focus);\n    }\n\n    void viewUpdated() {\n        String s = view.getPattern();\n        if (s == null || s.trim().length() == 0) {\n            view.error();\n        } else {\n            pattern = s;\n            onChangeCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/LikeToFunctionEditorView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n@Dependent\npublic class LikeToFunctionEditorView extends Composite implements LikeToFunctionEditor.View {\n\n    interface Binder extends UiBinder<Widget, LikeToFunctionEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    LikeToFunctionEditor presenter;\n\n    @UiField\n    FormGroup form;\n\n    @UiField\n    TextBox searchPatternTextBox;\n\n    @UiField\n    CheckBox caseSensitiveCheckbox;\n\n    public LikeToFunctionEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(LikeToFunctionEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setPattern(String pattern) {\n        form.setValidationState(ValidationState.NONE);\n        searchPatternTextBox.setText(pattern);\n    }\n\n    @Override\n    public void setCaseSensitive(boolean caseSensitive) {\n        caseSensitiveCheckbox.setValue(caseSensitive);\n    }\n\n    @Override\n    public String getPattern() {\n        return searchPatternTextBox.getText();\n    }\n\n    @Override\n    public boolean isCaseSensitive() {\n        return caseSensitiveCheckbox.getValue();\n    }\n\n    @Override\n    public void setFocus(final boolean focus) {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            public void execute () {\n                searchPatternTextBox.setFocus(focus);\n            }\n        });\n    }\n\n    @UiHandler(\"searchPatternTextBox\")\n    public void onPatternChanged(ChangeEvent event) {\n        presenter.viewUpdated();\n        form.setValidationState(ValidationState.NONE);\n    }\n\n    @UiHandler(\"caseSensitiveCheckbox\")\n    public void onCaseChanged(ClickEvent event) {\n        presenter.viewUpdated();\n    }\n\n    @Override\n    public void error() {\n        form.setValidationState(ValidationState.ERROR);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/LikeToFunctionEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .labelFont {\n      font-size: small;\n    }\n    .checkBox {\n      margin-top: 0px;\n      margin-bottom: 0px;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:FormGroup ui:field=\"form\"  validationState=\"NONE\">\n    <g:HorizontalPanel>\n      <b:TextBox ui:field=\"searchPatternTextBox\" />\n      <b:Tooltip isAnimated=\"true\" placement=\"RIGHT\" title=\"{i18n.like_to_pattern_instructions}\">\n        <b:Icon type=\"QUESTION_CIRCLE\" />\n      </b:Tooltip>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <b:CheckBox styleName=\"{style.checkBox}\" ui:field=\"caseSensitiveCheckbox\" />\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.case_sensitive}\"/>\n    </g:HorizontalPanel>\n  </b:FormGroup>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleNumberParameterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class MultipleNumberParameterEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<MultipleNumberParameterEditor> {\n\n        String getValue();\n\n        void setValue(String value);\n\n        void error();\n\n        void setFocus(boolean focus);\n    }\n\n    Command onChangeCommand = new Command() { public void execute() {} };\n    List values = new ArrayList();\n    View view;\n\n    @Inject\n    public MultipleNumberParameterEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public List getValues() {\n        return values;\n    }\n\n    public void setValues(List input) {\n        values = input;\n        view.setValue(format(input));\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n        view.setFocus(focus);\n    }\n\n    void valueChanged() {\n        try {\n            List l = parse(view.getValue().trim());\n            if (l.isEmpty()) {\n                view.error();\n            } else {\n                values.clear();\n                values.addAll(l);\n                onChangeCommand.execute();\n            }\n        } catch (Exception e) {\n            view.error();\n        }\n    }\n\n    public List parse(String s) throws Exception {\n        List result = new ArrayList();\n        List<String> tokens = s.contains(\"|\") ? StringUtils.split(s, '|') : StringUtils.split(s, ',');\n        for (String token : tokens) {\n            result.add(Double.parseDouble(token.trim()));\n        }\n        return result;\n    }\n\n    public String format(List l) {\n        StringBuilder out = new StringBuilder();\n        for (Object val : l) {\n            if (out.length() > 0) {\n                out.append(\" | \");\n            }\n            out.append(val);\n        }\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleNumberParameterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n@Dependent\npublic class MultipleNumberParameterEditorView extends Composite implements MultipleNumberParameterEditor.View {\n\n    interface Binder extends UiBinder<Widget, MultipleNumberParameterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    MultipleNumberParameterEditor presenter;\n\n    @UiField\n    FormGroup form;\n\n    @UiField\n    TextBox input;\n\n    public MultipleNumberParameterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final MultipleNumberParameterEditor presenter) {\n        this.presenter = presenter;\n        input.addValueChangeHandler(new ValueChangeHandler<String>() {\n            public void onValueChange(ValueChangeEvent<String> event) {\n                form.setValidationState(ValidationState.NONE);\n                presenter.valueChanged();\n            }\n        });\n    }\n\n    @Override\n    public String getValue() {\n        return input.getValue();\n    }\n\n    @Override\n    public void setValue(String value) {\n        input.setValue(value);\n        form.setValidationState(ValidationState.NONE);\n    }\n\n    @Override\n    public void setFocus(final boolean focus) {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            public void execute () {\n                input.setFocus(focus);\n            }\n        });\n    }\n\n    @Override\n    public void error() {\n        form.setValidationState(ValidationState.ERROR);\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleNumberParameterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n    <b:FormGroup ui:field=\"form\" validationState=\"NONE\">\n        <g:HorizontalPanel>\n            <b:TextBox ui:field=\"input\" />\n            <b:Tooltip isAnimated=\"true\" placement=\"RIGHT\" title=\"{i18n.multiple_input_descriptions}\">\n                <b:Icon ui:field=\"hintIcon\" type=\"QUESTION_CIRCLE\" />\n            </b:Tooltip>\n        </g:HorizontalPanel>\n    </b:FormGroup>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleTextParameterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class MultipleTextParameterEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<MultipleTextParameterEditor> {\n\n        String getValue();\n\n        void setValue(String value);\n\n        void error();\n\n        void setFocus(boolean focus);\n    }\n\n    Command onChangeCommand = new Command() { public void execute() {} };\n    List values = new ArrayList();\n    View view;\n\n    @Inject\n    public MultipleTextParameterEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public List getValues() {\n        return values;\n    }\n\n    public void setValues(List input) {\n        values = input;\n        view.setValue(format(input));\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n        view.setFocus(focus);\n    }\n\n    void valueChanged() {\n        try {\n            List l = parse(view.getValue().trim());\n            if (l.isEmpty()) {\n                view.error();\n            } else {\n                values.clear();\n                values.addAll(l);\n                onChangeCommand.execute();\n            }\n        } catch (Exception e) {\n            view.error();\n        }\n    }\n\n    public List parse(String s) throws Exception {\n        List result = new ArrayList();\n        List<String> tokens = s.contains(\"|\") ? StringUtils.split(s, '|') : StringUtils.split(s, ',');\n        for (String token : tokens) {\n            result.add(token.trim());\n        }\n        return result;\n    }\n\n    public String format(List l) {\n        StringBuilder out = new StringBuilder();\n        for (Object val : l) {\n            if (out.length() > 0) {\n                out.append(\" | \");\n            }\n            out.append(val);\n        }\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleTextParameterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n@Dependent\npublic class MultipleTextParameterEditorView extends Composite implements MultipleTextParameterEditor.View {\n\n    interface Binder extends UiBinder<Widget, MultipleTextParameterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    MultipleTextParameterEditor presenter;\n\n    @UiField\n    FormGroup form;\n\n    @UiField\n    TextBox input;\n\n    public MultipleTextParameterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final MultipleTextParameterEditor presenter) {\n        this.presenter = presenter;\n        input.addValueChangeHandler(new ValueChangeHandler<String>() {\n            public void onValueChange(ValueChangeEvent<String> event) {\n                form.setValidationState(ValidationState.NONE);\n                presenter.valueChanged();\n            }\n        });\n    }\n\n    @Override\n    public String getValue() {\n        return input.getValue();\n    }\n\n    @Override\n    public void setValue(String value) {\n        input.setValue(value);\n        form.setValidationState(ValidationState.NONE);\n    }\n\n    @Override\n    public void setFocus(final boolean focus) {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            public void execute () {\n                input.setFocus(focus);\n            }\n        });\n    }\n\n    @Override\n    public void error() {\n        form.setValidationState(ValidationState.ERROR);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/MultipleTextParameterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n    <b:FormGroup ui:field=\"form\" validationState=\"NONE\">\n        <g:HorizontalPanel>\n            <b:TextBox ui:field=\"input\" />\n            <b:Tooltip isAnimated=\"true\" placement=\"RIGHT\" title=\"{i18n.multiple_input_descriptions}\">\n                <b:Icon ui:field=\"hintIcon\" type=\"QUESTION_CIRCLE\" />\n            </b:Tooltip>\n        </g:HorizontalPanel>\n    </b:FormGroup>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/NumberParameterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class NumberParameterEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<NumberParameterEditor> {\n\n        String getValue();\n\n        void setValue(String value);\n\n        void setWidth(int width);\n\n        void error();\n\n        void setFocus(boolean focus);\n    }\n\n    Command onChangeCommand = () -> {};\n    Number value;\n    View view;\n\n    @Inject\n    public NumberParameterEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public Number getValue() {\n        return value;\n    }\n\n    public void setValue(Number input) {\n        Command backup = onChangeCommand;\n        try {\n            onChangeCommand = null;\n            value = input;\n            view.setValue(format(value));\n        } finally {\n            onChangeCommand = backup;\n        }\n    }\n\n    public void setWidth(int width) {\n        if (width > 0) {\n            view.setWidth(width);\n        }\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n        view.setFocus(focus);\n    }\n\n    void valueChanged() {\n        try {\n            Number n = parse(view.getValue());\n            if (n == null) {\n                view.error();\n            } else {\n                value = n;\n                if (onChangeCommand != null) {\n                    onChangeCommand.execute();\n                }\n            }\n        } catch (Exception e) {\n            view.error();\n        }\n    }\n\n    public Number parse(String s) throws Exception {\n        if (s == null || s.trim().length() == 0) {\n            return null;\n        }\n        return Double.parseDouble(s.trim());\n    }\n\n    public String format(Number n) {\n        return n.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/NumberParameterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n@Dependent\npublic class NumberParameterEditorView extends Composite implements NumberParameterEditor.View {\n\n    interface Binder extends UiBinder<Widget, NumberParameterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    NumberParameterEditor presenter;\n\n    @UiField\n    FormGroup form;\n\n    @UiField\n    TextBox input;\n\n    public NumberParameterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final NumberParameterEditor presenter) {\n        this.presenter = presenter;\n        input.addValueChangeHandler(new ValueChangeHandler<String>() {\n            public void onValueChange(ValueChangeEvent<String> event) {\n                form.setValidationState(ValidationState.NONE);\n                presenter.valueChanged();\n            }\n        });\n    }\n\n    @Override\n    public String getValue() {\n        return input.getValue();\n    }\n\n    @Override\n    public void setValue(String value) {\n        input.setValue(value);\n        form.setValidationState(ValidationState.NONE);\n    }\n\n    @Override\n    public void setWidth(int width) {\n        input.asWidget().getElement().getStyle().setWidth(width, Style.Unit.PX);\n    }\n\n    @Override\n    public void setFocus(final boolean focus) {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            public void execute () {\n                input.setFocus(focus);\n            }\n        });\n    }\n\n    @Override\n    public void error() {\n        form.setValidationState(ValidationState.ERROR);\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/NumberParameterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <ui:style>\n        .field-editor-margin {\n            margin-bottom: 0px;\n        }\n    </ui:style>\n\n    <b:FormGroup ui:field=\"form\" validationState=\"NONE\" addStyleNames=\"{style.field-editor-margin}\">\n        <b:TextBox ui:field=\"input\" />\n    </b:FormGroup>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TextParameterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TextParameterEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<TextParameterEditor> {\n\n        String getValue();\n\n        void setValue(String value);\n\n        void error();\n\n        void setFocus(boolean focus);\n    }\n\n    Command onChangeCommand = new Command() {\n        public void execute() {\n        }\n    };\n    String value;\n    View view;\n\n    @Inject\n    public TextParameterEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setOnChangeCommand(Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n    }\n\n    public String getValue() {\n        return value;\n    }\n\n    public void setValue(String input) {\n        value = input;\n        view.setValue(input);\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n        view.setFocus(focus);\n    }\n\n    void valueChanged() {\n        String s = view.getValue();\n        if (s == null || s.trim().length() == 0) {\n            view.error();\n        } else {\n            value = s;\n            onChangeCommand.execute();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TextParameterEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n@Dependent\npublic class TextParameterEditorView extends Composite implements TextParameterEditor.View {\n\n    interface Binder extends UiBinder<Widget, TextParameterEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    TextParameterEditor presenter;\n\n    @UiField\n    FormGroup form;\n\n    @UiField\n    TextBox input;\n\n    public TextParameterEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final TextParameterEditor presenter) {\n        this.presenter = presenter;\n        input.addValueChangeHandler(new ValueChangeHandler<String>() {\n            public void onValueChange(ValueChangeEvent<String> event) {\n                form.setValidationState(ValidationState.NONE);\n                presenter.valueChanged();\n            }\n        });\n    }\n\n    @Override\n    public String getValue() {\n        return input.getValue();\n    }\n\n    @Override\n    public void setValue(String value) {\n        input.setValue(value);\n        form.setValidationState(ValidationState.NONE);\n    }\n\n    @Override\n    public void setFocus(final boolean focus) {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            public void execute () {\n                input.setFocus(focus);\n            }\n        });\n    }\n\n    @Override\n    public void error() {\n        form.setValidationState(ValidationState.ERROR);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TextParameterEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n    <ui:style>\n        .form-group-margin {\n            margin-bottom: 0px;\n        }\n    </ui:style>\n\n    <b:FormGroup ui:field=\"form\" validationState=\"NONE\" addStyleNames=\"{style.form-group-margin}\">\n        <b:TextBox ui:field=\"input\" />\n    </b:FormGroup>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeAmountEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TimeAmountEditor implements IsWidget {\n\n    public interface View extends UberView<TimeAmountEditor> {\n\n        void setQuantity(long quantity);\n\n        long getQuantity();\n\n        void clearIntervalTypeSelector();\n\n        void addIntervalTypeItem(DateIntervalType type);\n\n        void setSelectedTypeIndex(int typeIdx);\n\n        int getSelectedTypeIndex();\n    }\n\n    public static List<DateIntervalType> INTERVAL_TYPES = Arrays.asList(\n            DateIntervalType.SECOND,\n            DateIntervalType.MINUTE,\n            DateIntervalType.HOUR,\n            DateIntervalType.DAY,\n            DateIntervalType.WEEK,\n            DateIntervalType.MONTH,\n            DateIntervalType.QUARTER,\n            DateIntervalType.YEAR,\n            DateIntervalType.CENTURY);\n\n    View view;\n    TimeAmount timeAmount = null;\n    Command onChangeCommand = new Command() { public void execute() {} };\n\n    @Inject\n    public TimeAmountEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public TimeAmount getTimeAmount() {\n        return timeAmount;\n    }\n\n    public void init(final TimeAmount ta, Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n        this.timeAmount = ta != null ? ta : new TimeAmount();\n\n        view.setQuantity(timeAmount.getQuantity());\n        view.clearIntervalTypeSelector();\n        for (int i=0; i< INTERVAL_TYPES.size(); i++) {\n            DateIntervalType type = INTERVAL_TYPES.get(i);\n            view.addIntervalTypeItem(type);\n            if (timeAmount != null && timeAmount.getType().equals(type)) {\n                view.setSelectedTypeIndex(i);\n            }\n        }\n    }\n\n    public long getQuantity() {\n        return timeAmount.getQuantity();\n    }\n\n    public void decreaseQuantity() {\n        long q = getQuantity()-1;\n        changeQuantity(q);\n        view.setQuantity(q);\n    }\n\n    public void increaseQuantity() {\n        long q = getQuantity()+1;\n        changeQuantity(q);\n        view.setQuantity(q);\n    }\n\n    public void changeQuantity(String value) {\n        if (StringUtils.isBlank(value)) {\n            changeQuantity(0);\n        } else {\n            changeQuantity(Long.parseLong(value));\n        }\n    }\n\n    public void changeIntervalType() {\n        DateIntervalType type = INTERVAL_TYPES.get(view.getSelectedTypeIndex());\n        timeAmount.setType(type);\n        onChangeCommand.execute();\n    }\n\n    protected void changeQuantity(long q) {\n        if (timeAmount == null) {\n            timeAmount = new TimeAmount();\n            DateIntervalType type = INTERVAL_TYPES.get(0);\n            timeAmount.setType(type);\n        }\n        timeAmount.setQuantity(q);\n        onChangeCommand.execute();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeAmountEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.DateIntervalTypeConstants;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.gwtbootstrap3.client.ui.InputGroupAddon;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.ext.widgets.common.client.common.NumericLongTextBox;\n\n@Dependent\npublic class TimeAmountEditorView extends Composite implements TimeAmountEditor.View {\n\n    interface Binder extends UiBinder<Widget, TimeAmountEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    TimeAmountEditor presenter = null;\n\n    @UiField\n    NumericLongTextBox input;\n\n    @UiField\n    InputGroupAddon minusIcon;\n\n    @UiField\n    InputGroupAddon plusIcon;\n\n    @UiField\n    ListBox typeList;\n\n    @Override\n    public void init(final TimeAmountEditor presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n\n        plusIcon.addDomHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                presenter.increaseQuantity();\n            }\n        }, ClickEvent.getType());\n\n        minusIcon.addDomHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                presenter.decreaseQuantity();\n            }\n        }, ClickEvent.getType());\n\n        input.addValueChangeHandler(new ValueChangeHandler<String>() {\n            public void onValueChange(ValueChangeEvent<String> event) {\n                presenter.changeQuantity(event.getValue());\n            }\n        });\n    }\n\n    @Override\n    public void setQuantity(long quantity) {\n        input.setValue(Long.toString(quantity));\n    }\n\n    @Override\n    public long getQuantity() {\n        return Long.valueOf(input.getValue());\n    }\n\n    @Override\n    public void clearIntervalTypeSelector() {\n        typeList.clear();\n    }\n\n    @Override\n    public void addIntervalTypeItem(DateIntervalType type) {\n        String typeName = DateIntervalTypeConstants.INSTANCE.getString(type.name());\n        typeList.addItem(typeName);\n    }\n\n    @Override\n    public void setSelectedTypeIndex(int idx) {\n        typeList.setSelectedIndex(idx);\n    }\n\n    @Override\n    public int getSelectedTypeIndex() {\n        return typeList.getSelectedIndex();\n    }\n\n    // UI events\n\n    @UiHandler(value = \"typeList\")\n    public void onFilterSelected(ChangeEvent changeEvent) {\n        presenter.changeIntervalType();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeAmountEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:uf=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n\n    <g:HorizontalPanel>\n      <b:InputGroup>\n        <b:InputGroupAddon ui:field=\"minusIcon\" icon=\"MINUS\"/>\n        <uf:NumericLongTextBox ui:field=\"input\" width=\"32px\" />\n        <b:InputGroupAddon ui:field=\"plusIcon\" icon=\"PLUS\"/>\n      </b:InputGroup>\n      <b:ListBox ui:field=\"typeList\" width=\"100px\" />\n    </g:HorizontalPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeFrameEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.date.TimeFrame;\nimport org.dashbuilder.dataset.date.TimeInstant;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TimeFrameEditor implements FunctionParameterEditor {\n\n    public interface View extends UberView<TimeFrameEditor> {\n\n        void hideFirstMonthSelector();\n\n        void showFirstMonthSelector();\n\n        void clearFirstMonthSelector();\n\n        void addFirstMonthItem(Month month);\n\n        void setSelectedFirstMonthIndex(int index);\n\n        int getSelectedFirstMonthIndex();\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n    TimeFrame timeFrame = null;\n    TimeInstantEditor fromEditor;\n    TimeInstantEditor toEditor;\n    Command onChangeCommand = new Command() { public void execute() {} };\n\n    @Inject\n    public TimeFrameEditor(View view, SyncBeanManager beanManager) {\n        this.view = view;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public TimeFrame getTimeFrame() {\n        return timeFrame;\n    }\n\n    public TimeInstantEditor getFromEditor() {\n        return fromEditor;\n    }\n\n    public TimeInstantEditor getToEditor() {\n        return toEditor;\n    }\n\n    public void init(TimeFrame tf, Command onChangeCommand) {\n        this.onChangeCommand = onChangeCommand;\n        this.timeFrame = tf != null ? tf : TimeFrame.parse(\"begin[year] till end[year]\");\n\n        this.fromEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance();\n        this.fromEditor.init(timeFrame.getFrom(), new Command() {\n            public void execute() {\n                fromEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear());\n                timeFrame.setFrom(fromEditor.getTimeInstant());\n                changeFirstMonthAvailability();\n                fireChanges();\n            }\n        });\n        this.toEditor = beanManager.lookupBean(TimeInstantEditor.class).newInstance();\n        this.toEditor.init(timeFrame.getTo(), new Command() {\n            public void execute() {\n                toEditor.getTimeInstant().setFirstMonthOfYear(getFirstMonthOfYear());\n                timeFrame.setTo(toEditor.getTimeInstant());\n                changeFirstMonthAvailability();\n                fireChanges();\n            }\n        });\n\n        view.init(this);\n        initFirstMonthSelector();\n        changeFirstMonthAvailability();\n    }\n\n    protected void initFirstMonthSelector() {\n        view.clearFirstMonthSelector();\n        Month current = getFirstMonthOfYear();\n        Month[] entries = Month.values();\n        for (int i = 0; i < entries.length; i++) {\n            Month entry = entries[i];\n            view.addFirstMonthItem(entry);\n            if (current != null && current.equals(entry)) {\n                view.setSelectedFirstMonthIndex(i);\n            }\n        }\n    }\n\n    protected void changeFirstMonthAvailability() {\n        view.hideFirstMonthSelector();\n\n        if (isFirstMonthAvailable()) {\n            view.showFirstMonthSelector();\n        }\n    }\n\n    public boolean isFirstMonthAvailable() {\n\n        TimeInstant instantFrom = timeFrame.getFrom();\n        TimeInstant.TimeMode modeFrom = instantFrom.getTimeMode();\n        if (modeFrom != null && !modeFrom.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantFrom.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                return true;\n            }\n        }\n        TimeInstant instantTo = timeFrame.getTo();\n        TimeInstant.TimeMode modeTo = instantTo.getTimeMode();\n        if (modeTo != null && !modeTo.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantTo.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public Month getFirstMonthOfYear() {\n\n        TimeInstant instantFrom = timeFrame.getFrom();\n        TimeInstant.TimeMode modeFrom = instantFrom.getTimeMode();\n        if (modeFrom != null && !modeFrom.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantFrom.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                return instantFrom.getFirstMonthOfYear();\n            }\n        }\n        TimeInstant instantTo = timeFrame.getTo();\n        TimeInstant.TimeMode modeTo = instantTo.getTimeMode();\n        if (modeTo != null && !modeTo.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantTo.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                return instantTo.getFirstMonthOfYear();\n            }\n        }\n        return null;\n    }\n\n    public void setFirstMonthOfYear(Month month) {\n\n        TimeInstant instantFrom = timeFrame.getFrom();\n        TimeInstant.TimeMode modeFrom = instantFrom.getTimeMode();\n        if (modeFrom != null && !modeFrom.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantFrom.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                instantFrom.setFirstMonthOfYear(month);\n            }\n        }\n        TimeInstant instantTo = timeFrame.getTo();\n        TimeInstant.TimeMode modeTo = instantTo.getTimeMode();\n        if (modeTo != null && !modeTo.equals(TimeInstant.TimeMode.NOW)) {\n            DateIntervalType intervalType = instantTo.getIntervalType();\n            if (intervalType != null && intervalType.getIndex() > DateIntervalType.MONTH.getIndex()) {\n                instantTo.setFirstMonthOfYear(month);\n            }\n        }\n    }\n\n    @Override\n    public void setFocus(boolean focus) {\n    }\n\n    public void changeFirstMonth() {\n        int selectedIdx = view.getSelectedFirstMonthIndex();\n        Month month = Month.getByIndex(selectedIdx + 1);\n        setFirstMonthOfYear(month);\n        fireChanges();\n    }\n\n    protected void fireChanges() {\n        onChangeCommand.execute();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeFrameEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.MonthConstants;\nimport org.dashbuilder.dataset.date.Month;\nimport org.gwtbootstrap3.client.ui.ListBox;\n\n@Dependent\npublic class TimeFrameEditorView extends Composite implements TimeFrameEditor.View {\n\n    interface Binder extends UiBinder<Widget, TimeFrameEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField(provided = true)\n    TimeInstantEditor fromEditor;\n\n    @UiField(provided = true)\n    TimeInstantEditor toEditor;\n\n    @UiField\n    Label firstMonthLabel;\n\n    @UiField\n    ListBox firstMonthList;\n\n    TimeFrameEditor presenter = null;\n\n    @Override\n    public void init(TimeFrameEditor presenter) {\n        this.presenter = presenter;\n        fromEditor = presenter.getFromEditor();\n        toEditor = presenter.getToEditor();\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void hideFirstMonthSelector() {\n        firstMonthLabel.setVisible(false);\n        firstMonthList.setVisible(false);\n    }\n\n    @Override\n    public void showFirstMonthSelector() {\n        firstMonthLabel.setVisible(true);\n        firstMonthList.setVisible(true);\n    }\n\n    @Override\n    public void clearFirstMonthSelector() {\n        firstMonthList.clear();\n    }\n\n    @Override\n    public void addFirstMonthItem(Month month) {\n        firstMonthList.addItem(MonthConstants.INSTANCE.getString(month.name()));\n    }\n\n    @Override\n    public void setSelectedFirstMonthIndex(int index) {\n        firstMonthList.setSelectedIndex(index);\n    }\n\n    @Override\n    public int getSelectedFirstMonthIndex() {\n        return firstMonthList.getSelectedIndex();\n    }\n\n    // UI events\n\n    @UiHandler(value = \"firstMonthList\")\n    public void onFirstMonthSelected(ChangeEvent changeEvent) {\n        presenter.changeFirstMonth();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeFrameEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:df=\"urn:import:org.dashbuilder.displayer.client.widgets.filter\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .labelFont {\n      font-size: small;\n    }\n  </ui:style>\n\n  <g:VerticalPanel>\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.timeframe_from}\" />\n      <df:TimeInstantEditor ui:field=\"fromEditor\" />\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.timeframe_to}\" />\n      <df:TimeInstantEditor ui:field=\"toEditor\" />\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.timeframe_first_month_year}\" ui:field=\"firstMonthLabel\" visible=\"false\"/>\n      <b:ListBox ui:field=\"firstMonthList\" visible=\"false\" />\n    </g:VerticalPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeInstantEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.date.TimeInstant;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TimeInstantEditor implements IsWidget {\n\n    public interface View extends UberView<TimeInstantEditor> {\n\n        void clearTimeModeSelector();\n\n        void addTimeModeItem(TimeInstant.TimeMode timeMode);\n\n        void setSelectedTimeModeIndex(int index);\n\n        int getTimeModeSelectedIndex();\n\n        void enableIntervalTypeSelector();\n\n        void disableIntervalTypeSelector();\n\n        void clearIntervalTypeSelector();\n\n        void addIntervalTypeItem(DateIntervalType type);\n\n        void setSelectedIntervalTypeIndex(int index);\n\n        int getSelectedIntervalTypeIndex();\n    }\n\n    static List<DateIntervalType> INTERVAL_TYPES = Arrays.asList(\n            DateIntervalType.MINUTE,\n            DateIntervalType.HOUR,\n            DateIntervalType.DAY,\n            DateIntervalType.MONTH,\n            DateIntervalType.QUARTER,\n            DateIntervalType.YEAR,\n            DateIntervalType.CENTURY,\n            DateIntervalType.MILLENIUM);\n\n    View view;\n    TimeInstant timeInstant = null;\n    TimeAmountEditor timeAmountEditor = null;\n    Command onChangeCommand = new Command() { public void execute() {} };\n\n    @Inject\n    public TimeInstantEditor(View view, TimeAmountEditor timeAmountEditor) {\n        this.timeAmountEditor = timeAmountEditor;\n        this.timeInstant = new TimeInstant();\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public TimeInstant getTimeInstant() {\n        return timeInstant;\n    }\n\n    public void init(final TimeInstant ti, final Command onChangeCommand) {\n        this.timeInstant = ti != null ? ti : new TimeInstant();\n        this.onChangeCommand = onChangeCommand;\n        this.timeAmountEditor.init(timeInstant.getTimeAmount(), new Command() {\n            public void execute() {\n                timeInstant.setTimeAmount(timeAmountEditor.getTimeAmount());\n                onChangeCommand.execute();\n            }\n        });\n        initTimeModeSelector();\n        initIntervalTypeSelector();\n    }\n\n    public TimeAmountEditor getTimeAmountEditor() {\n        return timeAmountEditor;\n    }\n\n    protected void initTimeModeSelector() {\n        view.clearTimeModeSelector();\n        TimeInstant.TimeMode current = timeInstant.getTimeMode();\n        TimeInstant.TimeMode[] modes = TimeInstant.TimeMode.values();\n        for (int i=0; i<modes.length ; i++) {\n            TimeInstant.TimeMode mode = modes[i];\n            view.addTimeModeItem(mode);\n            if (current != null && current.equals(mode)) {\n                view.setSelectedTimeModeIndex(i);\n            }\n        }\n    }\n\n    protected void initIntervalTypeSelector() {\n        view.disableIntervalTypeSelector();\n        TimeInstant.TimeMode timeMode = timeInstant.getTimeMode();\n        if (timeMode != null && !timeMode.equals(TimeInstant.TimeMode.NOW)) {\n            view.enableIntervalTypeSelector();\n            view.clearIntervalTypeSelector();\n            DateIntervalType current = timeInstant.getIntervalType();\n            for (int i = 0; i < INTERVAL_TYPES.size(); i++) {\n                DateIntervalType type = INTERVAL_TYPES.get(i);\n                view.addIntervalTypeItem(type);\n                if (current != null && current.equals(type)) {\n                    view.setSelectedIntervalTypeIndex(i);\n                }\n            }\n        }\n    }\n\n    void changeTimeMode() {\n        int selectedIdx = view.getTimeModeSelectedIndex();\n\n        TimeInstant.TimeMode mode = TimeInstant.TimeMode.getByIndex(selectedIdx);\n        timeInstant.setTimeMode(mode);\n        TimeAmount timeAmount = timeInstant.getTimeAmount();\n        if (timeAmount != null) {\n            timeAmount.setQuantity(0);\n        }\n\n        onChangeCommand.execute();\n        initIntervalTypeSelector();\n    }\n\n    void changeIntervalType() {\n        int selectedIdx = view.getSelectedIntervalTypeIndex();\n        DateIntervalType intervalType = INTERVAL_TYPES.get(selectedIdx);\n        timeInstant.setIntervalType(intervalType);\n\n        onChangeCommand.execute();\n        initIntervalTypeSelector();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeInstantEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.DateIntervalTypeConstants;\nimport org.dashbuilder.dataset.client.resources.i18n.TimeModeConstants;\nimport org.dashbuilder.dataset.date.TimeInstant;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.ui.ListBox;\n\n@Dependent\npublic class TimeInstantEditorView extends Composite implements TimeInstantEditor.View {\n\n    interface Binder extends UiBinder<Widget, TimeInstantEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    ListBox timeModeList;\n\n    @UiField\n    ListBox intervalTypeList;\n\n    @UiField(provided = true)\n    TimeAmountEditor timeAmountEditor;\n\n    TimeInstantEditor presenter = null;\n\n    @Override\n    public void init(TimeInstantEditor presenter) {\n        this.presenter = presenter;\n        this.timeAmountEditor = presenter.getTimeAmountEditor();\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void clearTimeModeSelector() {\n        timeModeList.clear();\n    }\n\n    @Override\n    public void addTimeModeItem(TimeInstant.TimeMode mode) {\n        timeModeList.addItem(TimeModeConstants.INSTANCE.getString(mode.name()));\n    }\n\n    @Override\n    public void setSelectedTimeModeIndex(int index) {\n        timeModeList.setSelectedIndex(index);\n    }\n\n    @Override\n    public void enableIntervalTypeSelector() {\n        intervalTypeList.setVisible(true);\n    }\n\n    @Override\n    public void disableIntervalTypeSelector() {\n        intervalTypeList.setVisible(false);\n    }\n\n    @Override\n    public void clearIntervalTypeSelector() {\n        intervalTypeList.clear();\n    }\n\n    @Override\n    public void addIntervalTypeItem(DateIntervalType type) {\n        intervalTypeList.addItem(DateIntervalTypeConstants.INSTANCE.getString(type.name()));\n    }\n\n    @Override\n    public void setSelectedIntervalTypeIndex(int index) {\n        intervalTypeList.setSelectedIndex(index);\n    }\n\n    @Override\n    public int getTimeModeSelectedIndex() {\n        return timeModeList.getSelectedIndex();\n    }\n\n    @Override\n    public int getSelectedIntervalTypeIndex() {\n        return intervalTypeList.getSelectedIndex();\n    }\n\n    // UI events\n\n    @UiHandler(value = \"timeModeList\")\n    public void onTimeModeSelected(ChangeEvent changeEvent) {\n        presenter.changeTimeMode();\n    }\n\n    @UiHandler(value = \"intervalTypeList\")\n    public void onIntervalTypeSelected(ChangeEvent changeEvent) {\n        presenter.changeIntervalType();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/filter/TimeInstantEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:df=\"urn:import:org.dashbuilder.displayer.client.widgets.filter\">\n\n  <g:VerticalPanel>\n    <g:HorizontalPanel>\n      <b:ListBox ui:field=\"timeModeList\" width=\"75px\" />\n      <b:ListBox ui:field=\"intervalTypeList\" width=\"100px\" visible=\"false\" />\n    </g:HorizontalPanel>\n    <df:TimeAmountEditor ui:field=\"timeAmountEditor\" />\n  </g:VerticalPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnDetailsEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.displayer.client.events.ColumnDetailsChangedEvent;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class ColumnDetailsEditor implements IsWidget {\n\n    public interface View extends UberView<ColumnDetailsEditor> {\n        void setColumnId(String columnId);\n        String getColumnId();\n    }\n\n    View view = null;\n    GroupFunction column = null;\n    DataSetMetadata metadata = null;\n    Event<ColumnDetailsChangedEvent> changedEvent = null;\n\n    @Inject\n    public ColumnDetailsEditor(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public GroupFunction getColumn() {\n        return column;\n    }\n\n    public void init(DataSetMetadata metadata, GroupFunction groupFunction) {\n        this.column = groupFunction;\n        this.metadata = metadata;\n\n        if (StringUtils.isBlank(column.getColumnId())) {\n            view.setColumnId(column.getSourceId());\n        }\n        else {\n            view.setColumnId(column.getColumnId());\n        }\n    }\n\n    void onColumnNameChanged() {\n        String text = view.getColumnId();\n        if (!StringUtils.isBlank(text)) {\n            column.setColumnId(text);\n            changedEvent.fire(new ColumnDetailsChangedEvent(column));\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnDetailsEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TextBox;\n\n@Dependent\npublic class ColumnDetailsEditorView extends Composite implements ColumnDetailsEditor.View {\n\n    interface Binder extends UiBinder<Widget, ColumnDetailsEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    Label columnIdLabel;\n\n    @UiField\n    TextBox columnIdTextBox;\n\n    ColumnDetailsEditor presenter;\n\n    @Override\n    public void init(ColumnDetailsEditor columnDetailsEditor) {\n        this.presenter = columnDetailsEditor;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setColumnId(String columnId) {\n        columnIdTextBox.setText(columnId);\n    }\n\n    @Override\n    public String getColumnId() {\n        return columnIdTextBox.getText();\n    }\n\n    // UI events\n\n    @UiHandler(value = \"columnIdTextBox\")\n    public void onColumnNameChanged(ChangeEvent changeEvent) {\n        presenter.onColumnNameChanged();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnDetailsEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <g:Label ui:field=\"columnIdLabel\" text=\"{i18n.group_columnid_label}\"/>\n    <b:TextBox ui:field=\"columnIdTextBox\" width=\"100px\" />\n  </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnFunctionEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport java.util.List;\nimport java.util.ArrayList;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.displayer.client.events.GroupFunctionChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionDeletedEvent;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class ColumnFunctionEditor implements IsWidget {\n\n    public interface View extends UberView<ColumnFunctionEditor> {\n\n        void setDeleteOptionEnabled(boolean enabled);\n\n        void setColumnSelectorTitle(String title);\n\n        void clearColumnSelector();\n\n        void addColumnItem(String columnId);\n\n        void setSelectedColumnIndex(int i);\n\n        String getSelectedColumnId();\n\n        void setFunctionSelectorEnabled(boolean enabled);\n\n        void clearFunctionSelector();\n\n        void setVoidFunctionEnabled(boolean enabled);\n\n        void addFunctionItem(AggregateFunctionType functionType);\n\n        void setSelectedFunctionIndex(int i);\n\n        int getSelectedFunctionIndex();\n     }\n\n    View view = null;\n    GroupFunction groupFunction = null;\n    ColumnType targetType = null;\n    boolean functionsEnabled = false;\n    DataSetMetadata metadata = null;\n    ColumnDetailsEditor columnDetailsEditor = null;\n    Event<GroupFunctionChangedEvent> changeEvent = null;\n    Event<GroupFunctionDeletedEvent> deleteEvent = null;\n\n    @Inject\n    public ColumnFunctionEditor(View view,\n                                ColumnDetailsEditor columnDetailsEditor,\n                                Event<GroupFunctionChangedEvent> changeEvent,\n                                Event<GroupFunctionDeletedEvent> deleteEvent) {\n        this.view = view;\n        this.columnDetailsEditor = columnDetailsEditor;\n        this.changeEvent = changeEvent;\n        this.deleteEvent = deleteEvent;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public GroupFunction getGroupFunction() {\n        return groupFunction;\n    }\n\n    public ColumnType getTargetType() {\n        return targetType;\n    }\n\n    public ColumnDetailsEditor getColumnDetailsEditor() {\n        return columnDetailsEditor;\n    }\n\n    public void init(DataSetMetadata metadata,\n                     GroupFunction groupFunction,\n                     ColumnType targetType,\n                     String columnTitle,\n                     boolean functionsEnabled,\n                     boolean canDelete) {\n\n        this.groupFunction = groupFunction;\n        this.targetType = targetType;\n        this.metadata = metadata;\n        this.functionsEnabled = functionsEnabled;\n\n        columnDetailsEditor.init(metadata, this.groupFunction);\n        view.setColumnSelectorTitle(columnTitle);\n        view.setDeleteOptionEnabled(canDelete);\n        initColumnListBox();\n\n        if (functionsEnabled && (targetType == null || isColumnNumeric())) {\n            view.setFunctionSelectorEnabled(true);\n            initFunctionListBox();\n        } else {\n            view.setFunctionSelectorEnabled(false);\n        }\n    }\n\n    public void delete() {\n        deleteEvent.fire(new GroupFunctionDeletedEvent(groupFunction));\n    }\n\n    void onColumnSelected() {\n        groupFunction.setSourceId(view.getSelectedColumnId());\n        if (!isColumnNumeric()) {\n            groupFunction.setFunction(null);\n        } else {\n            groupFunction.setFunction(getSupportedFunctionTypes().get(0));\n        }\n        initFunctionListBox();\n        changeEvent.fire(new GroupFunctionChangedEvent(groupFunction));\n    }\n\n    void onFunctionSelected() {\n        AggregateFunctionType selected = null;\n        int i = view.getSelectedFunctionIndex();\n        if (i >= 0) {\n            List<AggregateFunctionType> supportedFunctions = getSupportedFunctionTypes();\n            selected = supportedFunctions.get(i);\n        }\n        groupFunction.setFunction(selected);\n        changeEvent.fire(new GroupFunctionChangedEvent(groupFunction));\n    }\n\n    protected boolean isColumnNumeric() {\n        return targetType != null && targetType.equals(ColumnType.NUMBER) && functionsEnabled;\n    }\n\n    protected void initColumnListBox() {\n        view.clearColumnSelector();\n\n        for (int i=0; i<metadata.getNumberOfColumns(); i++) {\n            String columnId = metadata.getColumnId(i);\n            ColumnType columnType = metadata.getColumnType(i);\n\n            // Only add columns that match the target type.\n            // When the target is not specified or is numeric then all the columns are eligible\n            if (targetType == null || columnType == null || isColumnNumeric() || targetType.equals(columnType)) {\n                view.addColumnItem(columnId);\n                if (columnId != null && columnId.equals(groupFunction.getSourceId())) {\n                    view.setSelectedColumnIndex(i);\n                }\n            }\n        }\n    }\n\n    protected void initFunctionListBox() {\n        view.clearFunctionSelector();\n        view.setVoidFunctionEnabled(!isColumnNumeric());\n\n        AggregateFunctionType selected = groupFunction.getFunction();\n        List<AggregateFunctionType> supportedFunctions = getSupportedFunctionTypes();\n        for (int i=0; i<supportedFunctions.size(); i++) {\n            AggregateFunctionType functionType = supportedFunctions.get(i);\n            view.addFunctionItem(functionType);\n            if (selected != null && functionType.equals(selected)) {\n                view.setSelectedFunctionIndex(i);\n            }\n        }\n    }\n\n    public List<AggregateFunctionType> getSupportedFunctionTypes() {\n        ColumnType columnType = metadata.getColumnType(groupFunction.getSourceId());\n        return getSupportedFunctionTypes(columnType);\n    }\n\n    public List<AggregateFunctionType> getSupportedFunctionTypes(ColumnType columnType) {\n        List<AggregateFunctionType> result = new ArrayList<AggregateFunctionType>();\n        for (AggregateFunctionType function : AggregateFunctionType.values()) {\n            if (function.supportType(columnType)) {\n                result.add(function);\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnFunctionEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.AggregateFunctionTypeConstants;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\n@Dependent\npublic class ColumnFunctionEditorView extends Composite implements ColumnFunctionEditor.View {\n\n    interface Binder extends UiBinder<Widget, ColumnFunctionEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    ListBox columnListBox;\n\n    @UiField\n    ListBox functionListBox;\n\n    @UiField\n    Icon columnDeleteIcon;\n\n    @UiField\n    Icon columnExpandIcon;\n\n    @UiField\n    Panel columnDetailsPanel;\n\n    @UiField(provided = true)\n    ColumnDetailsEditor columnDetailsEditor;\n\n    ColumnFunctionEditor presenter = null;\n    boolean voidFunctionEnabled = false;\n\n    @Override\n    public void init(final ColumnFunctionEditor presenter) {\n        this.presenter = presenter;\n        this.columnDetailsEditor = presenter.getColumnDetailsEditor();\n        initWidget(uiBinder.createAndBindUi(this));\n\n        columnExpandIcon.addDomHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                expandOrCollapse();\n            }\n        }, ClickEvent.getType());\n        columnDeleteIcon.addDomHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                presenter.delete();\n            }\n        }, ClickEvent.getType());\n    }\n\n    @Override\n    public void setDeleteOptionEnabled(boolean enabled) {\n        columnDeleteIcon.setVisible(enabled);\n    }\n\n    @Override\n    public void setColumnSelectorTitle(String title) {\n        columnListBox.setTitle(title);\n    }\n\n    @Override\n    public void clearColumnSelector() {\n        columnListBox.clear();\n    }\n\n    @Override\n    public void addColumnItem(String columnId) {\n        columnListBox.addItem(columnId);\n    }\n\n    @Override\n    public void setSelectedColumnIndex(int i) {\n        columnListBox.setSelectedIndex(i);\n    }\n\n    @Override\n    public String getSelectedColumnId() {\n        return columnListBox.getValue(columnListBox.getSelectedIndex());\n    }\n\n    @Override\n    public void setFunctionSelectorEnabled(boolean enabled) {\n        if (enabled) {\n            functionListBox.setVisible(true);\n            columnListBox.setWidth(\"120px\");\n        } else {\n            functionListBox.setVisible(false);\n            columnListBox.setWidth(\"200px\");\n        }\n    }\n\n    @Override\n    public void clearFunctionSelector() {\n        functionListBox.clear();\n    }\n\n    @Override\n    public void setVoidFunctionEnabled(boolean enabled) {\n        voidFunctionEnabled = enabled;\n        if (enabled) {\n            functionListBox.addItem(\"---\");\n        }\n    }\n\n    @Override\n    public void addFunctionItem(AggregateFunctionType functionType) {\n        String functionName = AggregateFunctionTypeConstants.INSTANCE.getString(functionType.name());\n        functionListBox.addItem(functionName);\n    }\n\n    @Override\n    public void setSelectedFunctionIndex(int i) {\n        functionListBox.setSelectedIndex(voidFunctionEnabled ? i+1 : i);\n    }\n\n    @Override\n    public int getSelectedFunctionIndex() {\n        int i = functionListBox.getSelectedIndex();\n        return voidFunctionEnabled ? i-1 : i;\n    }\n\n    // UI events\n\n    protected void expandOrCollapse() {\n        if (columnDetailsPanel.isVisible()) {\n            collapse();\n        } else {\n            expand();\n        }\n    }\n\n    protected void expand() {\n        columnDetailsPanel.setVisible(true);\n        columnExpandIcon.setType(IconType.ARROW_UP);\n    }\n\n    protected void collapse() {\n        columnDetailsPanel.setVisible(false);\n        columnExpandIcon.setType(IconType.ARROW_DOWN);\n    }\n\n    @UiHandler(value = \"columnListBox\")\n    protected void onColumnSelected(ChangeEvent changeEvent) {\n        presenter.onColumnSelected();\n    }\n\n    @UiHandler(value = \"functionListBox\")\n    protected void onFunctionSelected(ChangeEvent changeEvent) {\n        presenter.onFunctionSelected();\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/ColumnFunctionEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:dg=\"urn:import:org.dashbuilder.displayer.client.widgets.group\">\n\n\n  <ui:style>\n    .columnDetailsPanel {\n      width: 200px;\n      padding: 5px;\n      background: #dddddd;\n      border-radius: 5px;\n    }\n  </ui:style>\n\n  <g:VerticalPanel>\n    <g:HorizontalPanel>\n      <b:ListBox ui:field=\"columnListBox\" width=\"120px\" />\n      <b:ListBox ui:field=\"functionListBox\" width=\"80px\" />\n      <b:Icon type=\"REMOVE\" ui:field=\"columnDeleteIcon\" size=\"LARGE\" visible=\"false\"/>\n      <b:Icon type=\"ARROW_DOWN\" ui:field=\"columnExpandIcon\" size=\"LARGE\" visible=\"false\"/>\n    </g:HorizontalPanel>\n    <g:FlowPanel ui:field=\"columnDetailsPanel\" visible=\"false\" styleName=\"{style.columnDetailsPanel}\">\n      <dg:ColumnDetailsEditor ui:field=\"columnDetailsEditor\" />\n    </g:FlowPanel>\n  </g:VerticalPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/DataSetGroupDateEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.dashbuilder.displayer.client.events.DataSetGroupDateChanged;\nimport org.uberfire.client.mvp.UberView;\n\n@Dependent\npublic class DataSetGroupDateEditor implements IsWidget {\n\n    public interface View extends UberView<DataSetGroupDateEditor> {\n\n        void setFixedModeValue(boolean enabled);\n\n        boolean getFixedModeValue();\n\n        void clearIntervalTypeSelector();\n\n        void addIntervalTypeItem(DateIntervalType entry);\n\n        void setSelectedIntervalTypeIndex(int index);\n\n        int getSelectedIntervalTypeIndex();\n\n        void setFirstDayVisibility(boolean visible);\n\n        void clearFirstDaySelector();\n\n        void addFirstDaySelectorItem(DayOfWeek entry);\n\n        void setSelectedFirstDayIndex(int index);\n\n        int getSelectedFirstDayIndex();\n\n        void setFirstMonthVisibility(boolean visible);\n\n        void clearFirstMonthSelector();\n\n        void addFirstMonthSelectorItem(Month entry);\n\n        void setSelectedFirstMonthIndex(int index);\n\n        int getSelectedFirstMonthIndex();\n\n        void setEmptyIntervalsValue(boolean enabled);\n\n        boolean getEmptyIntervalsValue();\n\n        void setMaxIntervalsVisibility(boolean visible);\n\n        void setMaxIntervalsValue(String max);\n\n        String getMaxIntervalsValue();\n    }\n\n    View view = null;\n    ColumnGroup columnGroup = null;\n    Event<DataSetGroupDateChanged> changeEvent = null;\n\n    @Inject\n    public DataSetGroupDateEditor(View view, Event<DataSetGroupDateChanged> changeEvent) {\n        this.view = view;\n        this.changeEvent = changeEvent;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public ColumnGroup getColumnGroup() {\n        return columnGroup;\n    }\n\n    public void init(ColumnGroup columnGroup) {\n        this.columnGroup = columnGroup;\n        if (columnGroup != null) {\n            if (isFixedStrategy()) {\n                gotoFixedMode();\n            } else {\n                gotoDynamicMode();\n            }\n        }\n    }\n\n    public boolean isFixedStrategy() {\n        return GroupStrategy.FIXED.equals(columnGroup.getStrategy());\n    }\n\n    protected void initIntervalTypeSelector() {\n        view.clearIntervalTypeSelector();\n        DateIntervalType current = DateIntervalType.getByName(columnGroup.getIntervalSize());\n        List<DateIntervalType> entries = getListOfIntervalTypes();\n        for (int i = 0; i < entries.size(); i++) {\n            DateIntervalType entry = entries.get(i);\n            view.addIntervalTypeItem(entry);\n            if (current != null && current.equals(entry)) {\n                view.setSelectedIntervalTypeIndex(i);\n            }\n        }\n    }\n\n    public List<DateIntervalType> getListOfIntervalTypes() {\n        if (isFixedStrategy()) {\n            return DateIntervalType.FIXED_INTERVALS_SUPPORTED;\n        }\n        return Arrays.asList(DateIntervalType.values());\n    }\n\n    protected void initFirstDayListBox() {\n        view.setFirstDayVisibility(true);\n        view.clearFirstDaySelector();\n        DayOfWeek current = columnGroup.getFirstDayOfWeek();\n        DayOfWeek[] entries = DayOfWeek.values();\n        for (int i = 0; i < entries.length; i++) {\n            DayOfWeek entry = entries[i];\n            view.addFirstDaySelectorItem(entry);\n            if (current != null && current.equals(entry)) {\n                view.setSelectedFirstDayIndex(i);\n            }\n        }\n    }\n\n    protected void initFirstMonthListBox() {\n        view.setFirstMonthVisibility(true);\n        view.clearFirstMonthSelector();\n        Month current = columnGroup.getFirstMonthOfYear();\n        Month[] entries = Month.values();\n        for (int i = 0; i < entries.length; i++) {\n            Month entry = entries[i];\n            view.addFirstMonthSelectorItem(entry);\n            if (current != null && current.equals(entry)) {\n                view.setSelectedFirstMonthIndex(i);\n            }\n        }\n    }\n\n    protected void initMaxIntervalsTextBox() {\n        view.setMaxIntervalsVisibility(true);\n        view.setMaxIntervalsValue(Integer.toString(columnGroup.getMaxIntervals()));\n    }\n\n    protected void initEmptyIntervalsFlag() {\n        view.setEmptyIntervalsValue(columnGroup.areEmptyIntervalsAllowed());\n    }\n\n    protected void resetCommon() {\n        view.setFixedModeValue(isFixedStrategy());\n        view.setMaxIntervalsVisibility(false);\n        view.setFirstDayVisibility(false);\n        view.setFirstMonthVisibility(false);\n\n        initIntervalTypeSelector();\n        initEmptyIntervalsFlag();\n    }\n\n    public void gotoDynamicMode() {\n        resetCommon();\n        initMaxIntervalsTextBox();\n    }\n\n    public void gotoFixedMode() {\n        resetCommon();\n\n        DateIntervalType current = DateIntervalType.getByName(columnGroup.getIntervalSize());\n        if (DateIntervalType.DAY_OF_WEEK.equals(current)) {\n            initFirstDayListBox();\n        }\n        else if (DateIntervalType.MONTH.equals(current)) {\n            initFirstMonthListBox();\n        }\n    }\n\n    public void onFixedStrategyChanged() {\n        columnGroup.setFirstMonthOfYear(null);\n        columnGroup.setFirstDayOfWeek(null);\n\n        if (view.getFixedModeValue()) {\n\n            // Reset current interval type selected if not allowed.\n            DateIntervalType intervalType = DateIntervalType.getByIndex(view.getSelectedIntervalTypeIndex());\n            if (!DateIntervalType.FIXED_INTERVALS_SUPPORTED.contains(intervalType)) {\n                view.setSelectedIntervalTypeIndex(DateIntervalType.MONTH.getIndex());\n                columnGroup.setIntervalSize(DateIntervalType.MONTH.name());\n            }\n            columnGroup.setStrategy(GroupStrategy.FIXED);\n            gotoFixedMode();\n        } else {\n            columnGroup.setStrategy(GroupStrategy.DYNAMIC);\n            gotoDynamicMode();\n        }\n        changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n    }\n\n    void onIntervalTypeSelected() {\n        DateIntervalType intervalType = DateIntervalType.getByIndex(view.getSelectedIntervalTypeIndex());\n        if (isFixedStrategy()) {\n            intervalType = DateIntervalType.FIXED_INTERVALS_SUPPORTED.get(view.getSelectedIntervalTypeIndex());\n        }\n\n        columnGroup.setIntervalSize(intervalType.name());\n        columnGroup.setFirstMonthOfYear(null);\n        columnGroup.setFirstDayOfWeek(null);\n\n        view.setFirstMonthVisibility(false);\n        view.setFirstDayVisibility(false);\n\n        if (GroupStrategy.FIXED.equals(columnGroup.getStrategy())) {\n            if (DateIntervalType.MONTH.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) {\n                view.setFirstMonthVisibility(true);\n                initFirstMonthListBox();\n            }\n            else if (DateIntervalType.DAY_OF_WEEK.equals(DateIntervalType.getByName(columnGroup.getIntervalSize()))) {\n                view.setFirstDayVisibility(true);\n                initFirstDayListBox();\n            }\n        }\n        changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n    }\n\n    void onEmptyIntervalsChanged() {\n        columnGroup.setEmptyIntervalsAllowed(view.getEmptyIntervalsValue());\n        changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n    }\n\n    void onMaxIntervalsChanged() {\n        try {\n            columnGroup.setMaxIntervals(Integer.parseInt(view.getMaxIntervalsValue()));\n            changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n        } catch (Exception e) {\n            // Just ignore\n        }\n    }\n\n    void onFirstDaySelected() {\n        DayOfWeek dayOfWeek = DayOfWeek.getByIndex(view.getSelectedFirstDayIndex()+1);\n        columnGroup.setFirstDayOfWeek(dayOfWeek);\n        changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n    }\n\n    void onFirstMonthSelected() {\n        Month month = Month.getByIndex(view.getSelectedFirstMonthIndex()+1);\n        columnGroup.setFirstMonthOfYear(month);\n        changeEvent.fire(new DataSetGroupDateChanged(columnGroup));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/DataSetGroupDateEditorView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.DateIntervalTypeConstants;\nimport org.dashbuilder.dataset.client.resources.i18n.DayOfWeekConstants;\nimport org.dashbuilder.dataset.client.resources.i18n.MonthConstants;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.TextBox;\n\n@Dependent\npublic class DataSetGroupDateEditorView extends Composite implements DataSetGroupDateEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetGroupDateEditorView> {}\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    CheckBox fixedStrategyCheckBox;\n\n    @UiField\n    ListBox intervalTypeListBox;\n\n    @UiField\n    Panel maxIntervalsGroup;\n\n    @UiField\n    Panel firstDayPanel;\n\n    @UiField\n    Panel firstMonthPanel;\n\n    @UiField\n    TextBox maxIntervalsTextBox;\n\n    @UiField\n    CheckBox emptyIntervalsCheckBox;\n\n    @UiField\n    ListBox firstDayListBox;\n\n    @UiField\n    ListBox firstMonthListBox;\n\n    DataSetGroupDateEditor presenter;\n\n    @Override\n    public void init(DataSetGroupDateEditor presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setFixedModeValue(boolean enabled) {\n        fixedStrategyCheckBox.setValue(enabled);\n    }\n\n    @Override\n    public boolean getFixedModeValue() {\n        return fixedStrategyCheckBox.getValue();\n    }\n\n    @Override\n    public void clearIntervalTypeSelector() {\n        intervalTypeListBox.clear();\n    }\n\n    @Override\n    public void addIntervalTypeItem(DateIntervalType entry) {\n        intervalTypeListBox.addItem(DateIntervalTypeConstants.INSTANCE.getString(entry.name()));\n    }\n\n    @Override\n    public void setSelectedIntervalTypeIndex(int index) {\n        intervalTypeListBox.setSelectedIndex(index);\n    }\n\n    @Override\n    public int getSelectedIntervalTypeIndex() {\n        return intervalTypeListBox.getSelectedIndex();\n    }\n\n    @Override\n    public void setFirstDayVisibility(boolean visible) {\n        firstDayPanel.setVisible(visible);\n    }\n\n    @Override\n    public void clearFirstDaySelector() {\n        firstDayListBox.clear();\n    }\n\n    @Override\n    public void addFirstDaySelectorItem(DayOfWeek entry) {\n        firstDayListBox.addItem(DayOfWeekConstants.INSTANCE.getString(entry.name()));\n    }\n\n    @Override\n    public void setSelectedFirstDayIndex(int index) {\n        firstDayListBox.setSelectedIndex(index);\n    }\n\n    @Override\n    public int getSelectedFirstDayIndex() {\n        return firstDayListBox.getSelectedIndex();\n    }\n\n    @Override\n    public void setFirstMonthVisibility(boolean visible) {\n        firstMonthPanel.setVisible(visible);\n    }\n\n    @Override\n    public void clearFirstMonthSelector() {\n        firstMonthListBox.clear();\n    }\n\n    @Override\n    public void addFirstMonthSelectorItem(Month entry) {\n        firstMonthListBox.addItem(MonthConstants.INSTANCE.getString(entry.name()));\n    }\n\n    @Override\n    public void setSelectedFirstMonthIndex(int index) {\n        firstMonthListBox.setSelectedIndex(index);\n    }\n\n    @Override\n    public int getSelectedFirstMonthIndex() {\n        return firstMonthListBox.getSelectedIndex();\n    }\n\n    @Override\n    public void setEmptyIntervalsValue(boolean enabled) {\n        emptyIntervalsCheckBox.setValue(enabled);\n    }\n\n    @Override\n    public boolean getEmptyIntervalsValue() {\n        return emptyIntervalsCheckBox.getValue();\n    }\n\n    @Override\n    public void setMaxIntervalsVisibility(boolean visible) {\n        maxIntervalsGroup.setVisible(visible);\n    }\n\n    @Override\n    public void setMaxIntervalsValue(String max) {\n        maxIntervalsTextBox.setText(max);\n    }\n\n    @Override\n    public String getMaxIntervalsValue() {\n        return maxIntervalsTextBox.getText();\n    }\n\n    // UI events\n\n    @UiHandler(value = \"fixedStrategyCheckBox\")\n    public void onFixedModeSelected(ClickEvent clickEvent) {\n        presenter.onFixedStrategyChanged();\n    }\n\n    @UiHandler(value = \"intervalTypeListBox\")\n    public void onIntervalTypeSelected(ChangeEvent changeEvent) {\n        presenter.onIntervalTypeSelected();\n    }\n\n    @UiHandler(value = \"emptyIntervalsCheckBox\")\n    public void onEmptyIntervalsChanged(ClickEvent clickEvent) {\n        presenter.onEmptyIntervalsChanged();\n    }\n\n    @UiHandler(value = \"maxIntervalsTextBox\")\n    public void onMaxIntervalsChanged(ChangeEvent changeEvent) {\n        presenter.onMaxIntervalsChanged();\n    }\n\n    @UiHandler(value = \"firstDayListBox\")\n    public void onFirstDaySelected(ChangeEvent changeEvent) {\n        presenter.onFirstDaySelected();\n    }\n\n    @UiHandler(value = \"firstMonthListBox\")\n    public void onFirstMonthSelected(ChangeEvent changeEvent) {\n        presenter.onFirstMonthSelected();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/group/DataSetGroupDateEditorView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.displayer.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .labelFont {\n      font-size: small;\n    }\n    .checkBox {\n      margin-top: 0px;\n      margin-bottom: 0px;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <g:FlowPanel>\n    <g:HorizontalPanel>\n      <b:CheckBox styleName=\"{style.checkBox}\" ui:field=\"fixedStrategyCheckBox\" />\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_fixed_intervals}\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <b:CheckBox styleName=\"{style.checkBox}\" ui:field=\"emptyIntervalsCheckBox\" />\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_empty_intervals}\"/>\n    </g:HorizontalPanel>\n    <g:FlowPanel>\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_interval_type}\"/>\n      <b:ListBox ui:field=\"intervalTypeListBox\" width=\"130px\" />\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"maxIntervalsGroup\" visible=\"false\">\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_max_intervals}\"/>\n      <b:TextBox ui:field=\"maxIntervalsTextBox\" width=\"130px\" />\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"firstDayPanel\" visible=\"false\">\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_firstday}\"/>\n      <b:ListBox ui:field=\"firstDayListBox\" width=\"130px\"/>\n    </g:FlowPanel>\n    <g:FlowPanel ui:field=\"firstMonthPanel\" visible=\"false\">\n      <g:Label styleName=\"{style.labelFont}\" text=\"{i18n.dataset_groupdate_firstmonth}\"/>\n      <b:ListBox ui:field=\"firstMonthListBox\" width=\"130px\"/>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/DefaultHtmlValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.xml.client.XMLParser;\n\n@Dependent\npublic class DefaultHtmlValidator implements HtmlValidator {\n\n    public String validate(String code) {\n        try {\n            XMLParser.parse(code);\n            return null;\n        } catch (Exception e) {\n            return e.getMessage();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/DefaultJsEvaluator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport javax.enterprise.context.Dependent;\n\n@Dependent\npublic class DefaultJsEvaluator implements JsEvaluator {\n\n    @Override\n    public void evaluate(String js) throws Exception {\n        _evalJs(js);\n    }\n\n    protected native void _evalJs(String js) /*-{\n        eval(js) + '';\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/DefaultJsValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringTemplateBuilder;\nimport org.dashbuilder.displayer.client.resources.i18n.SourceCodeValidatorConstants;\n\n@Dependent\npublic class DefaultJsValidator implements JsValidator {\n\n    public static final String[] _jsMalicious = {\"document.\", \"window.\", \"eval(\", \"eval \", \"eval\\t\", \"eval\\n\", \".innerHTML\"};\n\n    protected JsEvaluator jsEvaluator;\n    protected StringTemplateBuilder codeBuilder;\n    protected StringTemplateBuilder restoreBuilder;\n    Map<String,String> _variables;\n\n    @Inject\n    public DefaultJsValidator(JsEvaluator jsEvaluator) {\n        this.jsEvaluator = jsEvaluator;\n        codeBuilder = new StringTemplateBuilder();\n        restoreBuilder = new StringTemplateBuilder(\"__\", \"__\");\n        _variables = new HashMap<>();\n    }\n\n    @Override\n    public String validate(String jsTemplate, Collection<String> allowedVariables) {\n\n        // Ban some JS keywords that could lead to potential XSS attacks\n        for (String keyword : _jsMalicious) {\n            int idx = jsTemplate.toLowerCase().indexOf(keyword.toLowerCase());\n            if (idx >= 0) {\n                int end = jsTemplate.indexOf(\"\\n\", idx);\n                end = (end != -1 && end-idx < 30) ? end : idx + 30;\n                String expr = jsTemplate.substring(idx, end >= jsTemplate.length() ? jsTemplate.length() : end);\n                return SourceCodeValidatorConstants.INSTANCE.js_keyword_not_allowed(expr);\n            }\n        }\n        try {\n            // Ensure all the variables in the template match the allowed ones\n            codeBuilder.setTemplate(jsTemplate);\n            for (String key : codeBuilder.keys()) {\n                String var = codeBuilder.asVar(key);\n                if (allowedVariables != null && !allowedVariables.contains(var)) {\n                    return SourceCodeValidatorConstants.INSTANCE.js_variable_not_found(var);\n                }\n            }\n            // Mock the variables in the template and evaluate the whole script\n            String js = replaceVariables(jsTemplate);\n            jsEvaluator.evaluate(js);\n\n            // Evaluate each line individually\n            js = isolateLines(js);\n            jsEvaluator.evaluate(js);\n            return null;\n        }\n        catch (Exception e) {\n            // Replace back the original variables into the error message\n            String error = e.getMessage();\n            return restoreVariables(error);\n        }\n    }\n\n    public String replaceVariables(String code) {\n        StringBuilder header = new StringBuilder();\n        header.append(\"function __alert(msg) {};\\n\");\n        codeBuilder.setTemplate(code.replace(\"alert\", \"__alert\"));\n        _variables.clear();\n\n        int idx = 0;\n        for (String key : codeBuilder.keys()) {\n            String var = \"var\" + idx++;\n            _variables.put(var, key);\n            header.append(\"var __\" + var + \"__ = document.createElement(\\\"div\\\");\\n\");\n            codeBuilder.replace(key, \"__\" + var + \"__\");\n        }\n\n        String body = codeBuilder.build();\n        return header + body;\n    }\n\n    public String restoreVariables(String code) {\n        restoreBuilder.setTemplate(code);\n        for (String var : _variables.keySet()) {\n            restoreBuilder.replace(var, codeBuilder.getKeyPrefix() + _variables.get(var) + codeBuilder.getKeySufix());\n        }\n        return restoreBuilder.build();\n    }\n\n    public String isolateLines(String code) {\n        StringBuilder out = new StringBuilder();\n        String[] lines = code.split(\"\\n\");\n        for (String line : lines) {\n            line = line.trim();\n            line = line.contains(\"else \") ? line.replace(\"else \", \"\") : line;\n\n            if (line.startsWith(\"{\") && !line.endsWith(\"}\") && occurrences(line, \"{\") > occurrences(line, \"}\")) {\n                line = line.substring(1);\n            }\n            if (!line.startsWith(\"{\") && line.endsWith(\"}\") && occurrences(line, \"{\") < occurrences(line, \"}\")) {\n                line = line.substring(0, line.length()-1);\n            }\n            if (line.endsWith(\"{\")) {\n                line = line + \"}\";\n            }\n            if (line.startsWith(\"}\")) {\n                line = \"{\" + line;\n            }\n            if (line.equals(\"\") || line.equals(\"{}\") || line.equals(\"{};\")) {\n                continue;\n            }\n            out.append(line).append(\"\\n\");\n        }\n        return out.toString();\n    }\n\n    public int occurrences(String str, String target) {\n        int idx = 0;\n        int count = 0;\n        while (idx != -1 && idx < str.length()) {\n            idx = str.indexOf(target, idx);\n            if (idx != -1) {\n                count++;\n                idx += target.length();\n            }\n        }\n        return count;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/HasHtmlTemplate.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.Map;\n\npublic interface HasHtmlTemplate {\n\n    String getHtmlTemplate();\n\n    Map<String,String> getHtmlVariableMap();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/HasJsTemplate.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.Map;\n\npublic interface HasJsTemplate {\n\n    String getJsTemplate();\n\n    Map<String,String> getJsVariableMap();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/HtmlValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\npublic interface HtmlValidator {\n\n    /**\n     * Check if the the given HTML fragment has no syntax errors.\n     *\n     * @param html the HTML to validate\n     * @return An error message in case an error exists, or null if everything is ok.\n     */\n    String validate(String html);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/JsEvaluator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\npublic interface JsEvaluator {\n\n    void evaluate(String js) throws Exception;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/JsValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.Collection;\n\npublic interface JsValidator {\n\n    /**\n     * Check if the the given javascript fragment has no syntax errors.\n     *\n     * @param jsTemplate The javascript template to validate.\n     * @param allowedVariables The only set of variables that can be referenced from the JS body\n     * @return An error message in case an error exists, or null if everything is ok.\n     */\n    String validate(String jsTemplate, Collection<String> allowedVariables);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n/**\n * Source code editor supporting the HTML and Javascript languages.\n *\n * <p>(Check out the {@link SourceCodeType} interface which contains the list of supported languages)</p>\n */\n@Dependent\npublic class SourceCodeEditor implements IsWidget {\n\n    public interface View extends UberView<SourceCodeEditor> {\n\n        void clearAll();\n\n        void edit(SourceCodeType type, String code);\n\n        void declareVariable(String var, String description);\n\n        void injectVariable(String var);\n\n        void focus();\n\n        void error(String error);\n\n        void clearError();\n    }\n\n    View view;\n    SourceCodeType type;\n    String code;\n    Command onSourceCodeChanged;\n    HtmlValidator htmlValidator;\n    JsValidator jsValidator;\n    boolean hasErrors = false;\n    Map<String,String> varMap;\n\n    @Inject\n    public SourceCodeEditor(View view, HtmlValidator htmlValidator, JsValidator jsValidator) {\n        this.view = view;\n        this.htmlValidator = htmlValidator;\n        this.jsValidator = jsValidator;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public String getCode() {\n        return code;\n    }\n\n    public boolean hasErrors() {\n        return hasErrors;\n    }\n\n    public void init(SourceCodeType type, String code, Map<String,String> varMap, Command onSourceCodeChanged) {\n        this.type = type;\n        this.code = code;\n        this.varMap = varMap == null ? new HashMap<>() : varMap;\n        this.hasErrors = false;\n        this.onSourceCodeChanged = onSourceCodeChanged;\n\n        view.clearAll();\n        view.edit(type, code);\n        view.focus();\n\n        for (String var : varMap.keySet()) {\n            view.declareVariable(var, varMap.get(var));\n        }\n\n        String error = validateSourceCode(code);\n        if (error != null) {\n            hasErrors = true;\n            view.error(error);\n        }\n    }\n\n    public void focus() {\n        view.focus();\n    }\n\n    public String validateSourceCode(String newCode) {\n        if (newCode != null && newCode.length() > 0) {\n            switch (type) {\n                case JAVASCRIPT:\n                    return jsValidator.validate(newCode, varMap.keySet());\n                case HTML:\n                    return htmlValidator.validate(newCode);\n            }\n        }\n        return null;\n    }\n\n    public void onVariableSelected(String var) {\n        view.injectVariable(var);\n        view.focus();\n    }\n\n    public boolean onSourceCodeChanged(String newCode) {\n        String error = validateSourceCode(newCode);\n        if (error != null) {\n            hasErrors = true;\n            view.error(error);\n            view.focus();\n            return false;\n        } else {\n            code = newCode;\n            hasErrors = false;\n            view.clearError();\n            onSourceCodeChanged.execute();\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeEditorView.css",
    "content": ".sce-error {\n    font-size: smaller;\n}\n\n.sce-variable-menu {\n    height: 300px;\n    overflow: auto;\n    position: absolute;\n    top: 5px;\n    margin-right: 40px;\n}\n\n.sce-variable-button {\n    position: absolute;\n    top: 0px;\n    right: 20px;\n    z-index: 1;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeEditorView.html",
    "content": "<div data-field=\"mainDiv\" class=\"form-group\">\n    <div data-field=\"aceEditor\" class=\"form-control\" style=\"height: 300px\"></div>\n    <div class=\"dropdown sce-variable-button\" >\n        <button class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" data-field=\"addVariableButton\" title=\"Add variable\">\n            <span class=\"glyphicon glyphicon-asterisk\"></span><span class=\"caret\"></span>\n        </button>\n        <ul class=\"dropdown-menu pull-right sce-variable-menu\" role=\"menu\" data-field=\"variablesMenu\">\n        </ul>\n    </div>\n    <span data-field=\"errorLabel\" class=\"help-block sce-error\"></span>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.dashbuilder.displayer.client.resources.i18n.SourceCodeEditorConstants;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.NodeList;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditor;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorMode;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorTheme;\n\n@Dependent\n@Templated\npublic class SourceCodeEditorView extends Composite\n        implements SourceCodeEditor.View {\n\n    SourceCodeEditor presenter;\n    boolean eventsEnabled = true;\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    AceEditor aceEditor;\n\n    @Inject\n    @DataField\n    Span errorLabel;\n\n    @Inject\n    @DataField\n    Button addVariableButton;\n\n    @Inject\n    @DataField\n    UnorderedList variablesMenu;\n\n    @Override\n    public void init(SourceCodeEditor presenter) {\n        this.presenter = presenter;\n        aceEditor.startEditor();\n        aceEditor.setTheme(AceEditorTheme.CHROME);\n        aceEditor.setReadOnly(false);\n        aceEditor.addOnChangeHandler(this::onEditorChange);\n        aceEditor.setAutocompleteEnabled(true);\n        addVariableButton.setTitle(SourceCodeEditorConstants.INSTANCE.add_variable());\n    }\n\n    protected void onEditorChange(JavaScriptObject obj) {\n        if (eventsEnabled && !presenter.onSourceCodeChanged(aceEditor.getText())) {\n            aceEditor.setFocus();\n        }\n    }\n\n    @Override\n    public void clearAll() {\n        clearError();\n        removeAllChildren(variablesMenu);\n        aceEditor.setFocus();\n    }\n\n    @Override\n    public void edit(SourceCodeType type, String code) {\n        switch (type) {\n            case HTML:\n                aceEditor.setMode(AceEditorMode.HTML);\n                break;\n            case JAVASCRIPT:\n                aceEditor.setMode(AceEditorMode.JAVASCRIPT);\n                break;\n        }\n\n        eventsEnabled = false;\n        aceEditor.setText(code != null ? code : \"\");\n        aceEditor.setFocus();\n        eventsEnabled = true;\n    }\n\n    @Override\n    public void focus() {\n        aceEditor.setFocus();\n    }\n\n    @Override\n    public void error(String error) {\n        mainDiv.setClassName(\"form-group has-error\");\n        errorLabel.setInnerHTML(error);\n    }\n\n    @Override\n    public void clearError() {\n        mainDiv.setClassName(\"form-group\");\n        errorLabel.setInnerHTML(\"\");\n    }\n\n    @Override\n    public void declareVariable(String var, String description) {\n\n        SpanElement span = Document.get().createSpanElement();\n        span.setInnerText(var);\n\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setTitle(description);\n        anchor.appendChild(span);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n\n        variablesMenu.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                presenter.onVariableSelected(var);\n            }\n        });\n    }\n\n    @Override\n    public void injectVariable(String var) {\n        aceEditor.insertAtCursor(var);\n    }\n\n    private void removeAllChildren(org.jboss.errai.common.client.dom.Element element) {\n        NodeList nodeList = element.getChildNodes();\n        int lenght = nodeList.getLength();\n        for (int i=0; i<lenght; i++) {\n            element.removeChild(nodeList.item(0));\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\npublic enum SourceCodeType {\n    JAVASCRIPT,\n    HTML;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.displayer.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/DisplayerClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  \n  <inherits name='com.google.gwt.xml.XML'/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.positionedtabs.PositionedTabs\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.datetimepicker.DateTimePicker\"/>\n\n  <inherits name='org.jboss.errai.ioc.Container'/>\n\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireAceEditor\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorClient\"/>\n\n  <inherits name=\"org.dashbuilder.DatasetClient\"/>\n  <inherits name=\"org.dashbuilder.DisplayerAPI\"/>\n\n  <source path='displayer'/>\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nok=Ok\ncancel=Cancel\nerror=Error:\ncause=Cause:\n\n# Position enum literals\nPOSITION_BOTTOM=Bottom\nPOSITION_TOP=Top\nPOSITION_LEFT=Left\nPOSITION_RIGHT=Right\nPOSITION_IN=In\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Red\nCOLOR_SCHEME_BLUE=Blue\nCOLOR_SCHEME_GREEN=Green\n\n# Common settings editor literals\n\ndataset_editor_notfound=Data set not found\ncommon_dropdown_select=- Select -\ncommon_button_addnew=Add New\n\nsettingsEditor_caption=Displayer Settings Editor\nsettingsJsonSource_caption=Displayer Settings Json Source View\n\ncommon_group=General\ncommon_showTitle=Visible\ncommon_title=Title\ncommon_title_placeholder=Insert the chart''s title\ncommon_export=Export\ncommon_allowCSV=CSV\ncommon_allowExcel=Excel\ncommon_renderer=Renderer\ncommon_columns=Columns\ncolumns_name=Column\ncolumns_expression=Expression\ncolumns_pattern=Pattern\ncolumns_emptyvalue=Empty\ncommon_columns_placeholder=Insert the displayer''s columns, separated by commas\n\nchart_group=Chart\nchart_width=Width\nchart_height=Height\nchart_resizable=Automatic Resize\nchart_bgColor=Background color\n\nchart_marginGroup=Margins\nchart_topMargin=Top margin\nchart_bottomMargin=Bottom margin\nchart_leftMargin=Left margin\nchart_rightMargin=Right margin\n\nchart_legendGroup=Legend\nchart_legendShow=Visible\nchart_legendPosition=Position\nchart_3d=3D\n\ntable_group=Table\ntable_pageSize=Page size\ntable_width=Width\ntable_sortEnabled=Sort enabled\ntable_sortColumn=Sort by default\ntable_sortColumn_placeholder=Insert the default sort column id\ntable_sortOrder=Sort order\ntable_ascSortOrder=Ascending\ntable_descSortOrder=Descending\ntable_columnPicker=Column picker\n\naxis_group=Axis\nxaxis_showLabels=X axis labels visible\nxaxis_angle=X axis labels angle\nxaxis_title=X axis title\nxaxis_title_placeholder=Insert the X axis title\nyaxis_showLabels=Y axis label visible\nyaxis_angle=Y axis labels angle\nyaxis_title=Y axis title\nyaxis_title_placeholder=Insert the Y axis title\n\nmeter_group=Meter\nmeter_start=Start\nmeter_warning=Warning level\nmeter_critical=Critical level\nmeter_end=End\n\nmap_group=Map\ncolor_scheme=Color Scheme\n\nrefresh_group=Refresh\nrefresh_interval=Refresh (seconds)\nrefresh_stale_data=Refresh stale data\n\n# Filter\n\nfilter_group=Filter\nfilter_enabled=Enabled\nfilter_self=Self apply\nfilter_listening=Listen to others\nfilter_notifications=Notify others\nselector_group=Selector\nselector_width=Width\nselector_multiple=Multiple\nselector_show_inputs=Show inputs\n\nfilter_editor_selectcolumn=- Select column -\n\ntimeframe_from=From\ntimeframe_to=To\ntimeframe_first_month_year=First month of year\n\ncase_sensitive=Case sensitive\nlike_to_pattern_instructions=''%'' means zero or more characters while ''_'' means a single character\nmultiple_input_descriptions=Multiple values are supported. Either ''|'' or '','' can be used as a separator\n\ndataset_groupdate_fixed_intervals=Fixed intervals\ndataset_groupdate_empty_intervals=Empty intervals\ndataset_groupdate_interval_type=Interval type\ndataset_groupdate_max_intervals=Max. intervals\ndataset_groupdate_firstday=First Day\ndataset_groupdate_firstmonth=First Month\n\nsettings_validation_integer=Value must be an integer number.\nsettings_validation_double=Value must be a double.\nsettings_validation_meter_unknown=Unknown\nsettings_validation_meter_higher=Must be higher than the {0} value.\nsettings_validation_meter_lower=Must be lower than the {0} value.\nsettings_validation_meter_invalid=Invalid value\n\n# DataSetLookup literals\ndataset_dataset=Data Set\ndataset_filters=Filters\ndataset_rows=Rows\ndataset_columns=Columns\ngroup_columnid_label=Column Id.\ndataset_lookup_group_columns_all=- No grouping -\ndataset_lookup_dataset_notfound=Data set {0} not found\ndataset_lookup_init_error=Initialization error\n\n# DisplayerEditor literals\ndisplayer_editor_title=Displayer Editor\ndisplayer_editor_new=New Displayer\ndisplayer_editor_dataset_notfound=Selected data set not found.\ndisplayer_editor_datasetmetadata_fetcherror=Error fetching the data set metadata.\ndisplayer_editor_dataset_nolookuprequest=It is not possible to create a data lookup request for the selected data set.\ndisplayer_editor_incompatible_settings=Data settings are not compatible. The current settings will be lost. Continue?\ndisplayer_editor_tab_type=Type\ndisplayer_editor_tab_data=Data\ndisplayer_editor_tab_display=Display\ndisplayer_editor_view_as_table=View as table\n\nrenderer_selector_title=Renderer selector\n\ndisplayerlocator_default_renderer_undeclared={0} displayer default renderer not declared.\ndisplayerlocator_unsupported_displayer_renderer={0} displayer not supported in the {1} renderer.\n\nrendererliblocator_renderer_not_found={0} renderer not found.\nrendererliblocator_multiple_renderers_found=Multiple renderer implementations found for: {0}\nrenderermanager_renderer_not_available=No renderer is available for type:  {0}.\n\ndisplayerviewer_displayer_not_created=It was not possible to create the displayer\n\nexpand=Expand\ncollapse=Collapse\nremoveFilter=Remove filter\n\nDisplayerErrorWidget.displayerErrorTitle=Unexpected Error\nDisplayerErrorWidget.errorDetails=Details\n\nExternalComponentView.configurationIssueTitle=Modify Configuration\nExternalComponentView.configurationIssueDescription=Component does not support the current configuration.\n\nloadingComponent=Loading Component\ncomponentEditor=Component Editor\ncomponentNotFound=Component Not Found\nnoPropertiesComponent=This component has no properties.\ncomponentConfigDefaultMessage=Read the component configuration to find which columns it supports. \nmandatoryHelpHeader=Mandatory\nmandatoryHelpText=This field is mandatory."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_de.properties",
    "content": "ok=Ok\ncancel=Abbrechen\nerror=Fehler\\:\ncause=Ursache\\:\nPOSITION_BOTTOM=Unten\nPOSITION_TOP=Oben\nPOSITION_LEFT=Links\nPOSITION_RIGHT=Rechts\nPOSITION_IN=In\ndataset_editor_notfound=Datensatz nicht gefunden\ncommon_dropdown_select=- Auswählen -\ncommon_button_addnew=Neu hinzufügen\nsettingsEditor_caption=Displayer-Einstellungen-Editor.\nsettingsJsonSource_caption=Displayer-Einstellungen Json-Quellen-Anzeige\ncommon_group=Allgemein\ncommon_showTitle=Sichtbar\ncommon_title=Titel\ncommon_title_placeholder=Diagrammtitel einfügen\ncommon_renderer=Renderer\ncommon_columns=Spalten\ncolumns_name=Spalte\ncolumns_expression=Ausdruck\ncolumns_pattern=Muster\ncolumns_emptyvalue=Leer\ncommon_columns_placeholder=Displayer-Spalten einfügen, getrennt durch Kommas\nchart_group=Diagramm\nchart_width=Breite\nchart_height=Höhe\nchart_bgColor=Hintergrundfarbe\nchart_marginGroup=Ränder\nchart_topMargin=Oberer Rand\nchart_bottomMargin=Unterer Rand\nchart_leftMargin=Linker Rand\nchart_rightMargin=Rechter Rand\nchart_legendGroup=Legende\nchart_legendShow=Sichtbar\nchart_legendPosition=Position\nchart_3d=3D\ntable_group=Tabelle\ntable_pageSize=Seitengröße\ntable_width=Breite\ntable_sortEnabled=Sortierung aktiviert\ntable_sortColumn=Standardsortierung\ntable_sortColumn_placeholder=Standardsortierung-Spalten-ID einfügen\ntable_sortOrder=Sortierreihenfolge\ntable_ascSortOrder=Aufsteigend\ntable_descSortOrder=Absteigend\naxis_group=Achse\nxaxis_showLabels=X-Achsenbezeichnungen sichtbar\nxaxis_angle=X-Achsenbezeichnungen Winkel\nxaxis_title=X-Achsen-Titel\nxaxis_title_placeholder=X-Achsen-Titel einfügen\nyaxis_showLabels=Y-Achsenbezeichnung sichtbar\nyaxis_angle=Y-Achsenbezeichnungen Winkel\nyaxis_title=Y-Achsen-Titel\nyaxis_title_placeholder=Y-Achsen-Titel einfügen\nmeter_group=Meter\nmeter_start=Start\nmeter_warning=Warnebene\nmeter_critical=Kritische Ebene\nmeter_end=Ende\nrefresh_group=Aktualisieren\nrefresh_interval=Aktualisieren (Sekunden)\nrefresh_stale_data=Veraltete Daten aktualisieren\nfilter_group=Filter\nfilter_enabled=Aktiviert\nfilter_self=Selbst anwenden\nfilter_listening=Auf andere horchen\nfilter_notifications=Andere benachrichtigen\nfilter_editor_selectcolumn=- Spalte auswählen -\ntimeframe_from=Von\ntimeframe_to=Bis\ntimeframe_first_month_year=Erster Monat des Jahres\ncase_sensitive=Groß- und Kleinschreibung beachten\\:\nlike_to_pattern_instructions=''%'' bedeutet Null oder mehr Zeichen, ''_'' hingegen bedeutet ein einzelnes Zeichen\nmultiple_input_descriptions=Mehrere Werte werden unterstützt. Entweder ''|'' oder '','' kann als Trennzeichen verwendet werden\ndataset_groupdate_fixed_intervals=Feste Intervalle\ndataset_groupdate_empty_intervals=Leere Intervalle\ndataset_groupdate_interval_type=Intervalltyp\ndataset_groupdate_max_intervals=Max. Intervalle\ndataset_groupdate_firstday=Erster Tag\ndataset_groupdate_firstmonth=Erster Monat\nsettings_validation_integer=Wert muss eine ganze Zahl sein.\nsettings_validation_double=Wert muss doppelt sein\nsettings_validation_meter_unknown=Unbekannt\nsettings_validation_meter_higher=Muss höher als der {0} Wert sein.\nsettings_validation_meter_lower=Muss niedriger als der {0} Wert sein.\nsettings_validation_meter_invalid=Ungültiger Wert\ndataset_dataset=Datensatz\ndataset_filters=Filter\ndataset_rows=Reihen\ndataset_columns=Spalten\ngroup_columnid_label=Spalten-ID.\ndataset_lookup_dataset_notfound=Datensatz {0} nicht gefunden\ndataset_lookup_init_error=Initialisierungsfehler\ndisplayer_editor_title=Displayer-Editor\ndisplayer_editor_new=Neuer Displayer\ndisplayer_editor_dataset_notfound=Ausgewählter Datensatz nicht gefunden.\ndisplayer_editor_datasetmetadata_fetcherror=Fehler beim Abruf von Datensatz-Metadaten.\ndisplayer_editor_dataset_nolookuprequest=Es ist nicht möglich, eine Daten-Lookup-Anfrage für den ausgewählten Datensatz zu erstellen.\ndisplayer_editor_incompatible_settings=Dateneinstellungen sind nicht kompatibel. Die aktuellen Einstellungen gehen verloren. Fortfahren?\ndisplayer_editor_tab_type=Typ\ndisplayer_editor_tab_data=Daten\ndisplayer_editor_tab_display=Anzeige\ndisplayer_editor_view_as_table=Als Tabelle anzeigen\nrenderer_selector_title=Renderer-Selektor\ndisplayerlocator_default_renderer_undeclared={0} Displayer-Standardrenderer nicht deklariert.\ndisplayerlocator_unsupported_displayer_renderer={0} Displayer im {1} Renderer nicht unterstützt.\nrendererliblocator_renderer_not_found={0} Renderer nicht gefunden.\nrendererliblocator_multiple_renderers_found=Mehrere Renderer-Implementierungen gefunden für\\: {0}\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CollapseExpandConstants, author jdimanos\ncollapse=Reduzieren\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nok=Aceptar\ncancel=Cancelar\nerror=Error:\ncause=Motivo:\n\n# Position enum literals\nPOSITION_BOTTOM=Inferior\nPOSITION_TOP=Superior\nPOSITION_LEFT=Izquierda\nPOSITION_RIGHT=Derecha\nPOSITION_IN=En\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rojo\nCOLOR_SCHEME_BLUE=Azul\nCOLOR_SCHEME_GREEN=Verde\n\n# Common settings editor literals\n\ndataset_editor_notfound=No se encuentra el conjunto de datos\ncommon_dropdown_select=- Seleccionar -\ncommon_button_addnew=Agregar nuevo\n\nsettingsEditor_caption=Editor de ajustes de visualizador\nsettingsJsonSource_caption=Vista de fuente Json de ajustes de visualizador\n\ncommon_group=General\ncommon_showTitle=Visible\ncommon_title=Título\ncommon_title_placeholder=Insertar el título del gráfico\ncommon_export=Exportar\ncommon_allowCSV=CSV\ncommon_allowExcel=Excel\ncommon_renderer=Renderizador\ncommon_columns=Columnas\ncolumns_name=Columna\ncolumns_expression=Expresión\ncolumns_pattern=Patrón\ncolumns_emptyvalue=Vacío\ncommon_columns_placeholder=Insertar las columnas del visualizador, separadas por comas\n\nchart_group=Gráfico\nchart_width=Ancho\nchart_height=Altura\nchart_resizable=Redimensionamiento automático\nchart_bgColor=Color de fondo\n\nchart_marginGroup=Márgenes\nchart_topMargin=Margen superior\nchart_bottomMargin=Margen inferior\nchart_leftMargin=Margen izquierdo\nchart_rightMargin=Margen derecho\n\nchart_legendGroup=Leyenda\nchart_legendShow=Visible\nchart_legendPosition=Posición\nchart_3d=3D\n\ntable_group=Tabla\ntable_pageSize=Tamaño de la página\ntable_width=Ancho\ntable_sortEnabled=Clasificación habilitada\ntable_sortColumn=Valor predeterminado de clasificación\ntable_sortColumn_placeholder=Insertar la ID de columna de clasificación predeterminada\ntable_sortOrder=Orden de clasificación\ntable_ascSortOrder=Ascendente\ntable_descSortOrder=Descendente\ntable_columnPicker=Selector de columna\n\naxis_group=Eje\nxaxis_showLabels=Visibilidad de etiquetas del eje X\nxaxis_angle=Ángulo de etiquetas del eje X\nxaxis_title=Título del eje X\nxaxis_title_placeholder=Insertar el título del eje X\nyaxis_showLabels=Visibilidad de etiquetas del eje Y\nyaxis_angle=Ángulo de etiquetas del eje Y\nyaxis_title=Título del eje Y\nyaxis_title_placeholder=Insertar el título del eje Y\n\nmeter_group=Medidor\nmeter_start=Inicio\nmeter_warning=Nivel de advertencia\nmeter_critical=Nivel crítico\nmeter_end=Fin\n\nmap_group=Mapa\ncolor_scheme=Esquema de colores\n\nrefresh_group=Actualizar\nrefresh_interval=Actualizar (segundos)\nrefresh_stale_data=Actualizar datos obsoletos\n\n# Filter\n\nfilter_group=Filtro\nfilter_enabled=Habilitado\nfilter_self=Se aplica solo\nfilter_listening=Escuchar a otros\nfilter_notifications=Notificar a otros\nselector_group=Selector\nselector_width=Ancho\nselector_multiple=Múltiple\nselector_show_inputs=Mostrar entradas\n\nfilter_editor_selectcolumn=- Seleccionar columna -\n\ntimeframe_from=Desde\ntimeframe_to=Hasta\ntimeframe_first_month_year=El primer mes del año\n\ncase_sensitive=Distingue entre mayúsculas y minúsculas\nlike_to_pattern_instructions=''%'' significa cero o más caracteres mientras que ''_'' significa un solo carácter\nmultiple_input_descriptions=Se admiten múltiples valores. Se puede usar “|” o “,” como separador\n\ndataset_groupdate_fixed_intervals=Intervalos fijos\ndataset_groupdate_empty_intervals=Intervalos vacíos\ndataset_groupdate_interval_type=Tipo de intervalo\ndataset_groupdate_max_intervals=Intervalos máximos\ndataset_groupdate_firstday=Primer día\ndataset_groupdate_firstmonth=Primer mes\n\nsettings_validation_integer=El valor debe ser un número entero.\nsettings_validation_double=El valor debe ser el doble.\nsettings_validation_meter_unknown=Desconocido\nsettings_validation_meter_higher=Debe ser más alto que el valor {0}.\nsettings_validation_meter_lower=Debe ser más bajo que el valor {0}.\nsettings_validation_meter_invalid=Valor no válido\n\n# DataSetLookup literals\ndataset_dataset=Conjunto de datos\ndataset_filters=Filtros\ndataset_rows=Filas\ndataset_columns=Columnas\ngroup_columnid_label=ID de columna\ndataset_lookup_group_columns_all=- Sin agrupación -\ndataset_lookup_dataset_notfound=No se encuentra el conjunto de datos {0}\ndataset_lookup_init_error=Error de inicialización\n\n# DisplayerEditor literals\ndisplayer_editor_title=Editor de visualizador\ndisplayer_editor_new=Nuevo visualizador\ndisplayer_editor_dataset_notfound=No se encuentra el conjunto de datos seleccionado.\ndisplayer_editor_datasetmetadata_fetcherror=Error al extraer los metadatos del conjunto de datos.\ndisplayer_editor_dataset_nolookuprequest=No se puede crear una solicitud de búsqueda de datos para el conjunto de datos seleccionado.\ndisplayer_editor_incompatible_settings=Los ajustes de los datos no son compatibles. Se perderán los ajustes actuales. ¿Continuar?\ndisplayer_editor_tab_type=Tipo\ndisplayer_editor_tab_data=Datos\ndisplayer_editor_tab_display=Pantalla\ndisplayer_editor_view_as_table=Ver como tabla\n\nrenderer_selector_title=Selector de renderizador\n\ndisplayerlocator_default_renderer_undeclared=No se declaró el renderizador predeterminado del visualizador {0}.\ndisplayerlocator_unsupported_displayer_renderer=El visualizador {0} no cuenta con soporte en el renderizador {1}.\n\nrendererliblocator_renderer_not_found=No se encuentra el renderizador {0}.\nrendererliblocator_multiple_renderers_found=Se encontraron múltiples implementaciones de renderizador para: {0}\nrenderermanager_renderer_not_available=No hay renderizador disponible para el tipo: {0}.\n\ndisplayerviewer_displayer_not_created=No se pudo crear el visualizador\n\nexpand=Ampliar\ncollapse=Contraer\nremoveFilter=Quitar filtro\n\nDisplayerErrorWidget.displayerErrorTitle=Se produjo un error inesperado: {0}\nDisplayerErrorWidget.errorDetails=Detalles\n\nExternalComponentView.configurationIssueTitle=Configuración de fases\nExternalComponentView.configurationIssueDescription=El componente no es compatible con la configuración actual.\n\nloadingComponent=Componente de carga\ncomponentEditor=Editor de componentes\ncomponentNotFound=Componente no encontrado\nnoPropertiesComponent=Este componente no tiene propiedades.\ncomponentConfigDefaultMessage=Lea la configuración del componente para saber qué columnas admite. \nmandatoryHelpHeader=Campo obligatorio\nmandatoryHelpText=Este campo es obligatorio\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nok=OK\ncancel=Annuler\nerror=Erreur :\ncause=Cause :\n\n# Position enum literals\nPOSITION_BOTTOM=Bas\nPOSITION_TOP=Haut\nPOSITION_LEFT=Gauche\nPOSITION_RIGHT=Droite\nPOSITION_IN=Dans\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rouge\nCOLOR_SCHEME_BLUE=Bleu\nCOLOR_SCHEME_GREEN=Vert\n\n# Common settings editor literals\n\ndataset_editor_notfound=Ensemble de données introuvable\ncommon_dropdown_select=- Sélectionner -\ncommon_button_addnew=Ajouter\n\nsettingsEditor_caption=Éditeur de paramètres de l''afficheur\nsettingsJsonSource_caption=Vue de source Json des paramètres de l''afficheur\n\ncommon_group=Général\ncommon_showTitle=Visible\ncommon_title=Titre\ncommon_title_placeholder=Insérer le titre du graphique\ncommon_export=Exporter\ncommon_allowCSV=CSV\ncommon_allowExcel=Excel\ncommon_renderer=Moteur de rendu\ncommon_columns=Colonnes\ncolumns_name=Colonne\ncolumns_expression=Expression\ncolumns_pattern=Modèle\ncolumns_emptyvalue=Vide\ncommon_columns_placeholder=Insérer les colonnes de l''afficheur, séparées par des virgules\n\nchart_group=Graphique\nchart_width=Largeur\nchart_height=Hauteur\nchart_resizable=Redimensionnement automatique\nchart_bgColor=Couleur d''arrière-plan\n\nchart_marginGroup=Marges\nchart_topMargin=Marge supérieure\nchart_bottomMargin=Marge inférieure\nchart_leftMargin=Marge gauche\nchart_rightMargin=Marge droite\n\nchart_legendGroup=Légende\nchart_legendShow=Visible\nchart_legendPosition=Position\nchart_3d=3D\n\ntable_group=Tableau\ntable_pageSize=Taille de la page\ntable_width=Largeur\ntable_sortEnabled=Tri activé\ntable_sortColumn=Tri par défaut\ntable_sortColumn_placeholder=Insérer l''ID de la colonne de tri par défaut\ntable_sortOrder=Ordre de tri\ntable_ascSortOrder=Croissant\ntable_descSortOrder=Décroissant\ntable_columnPicker=Sélecteur de colonne\n\naxis_group=Axe\nxaxis_showLabels=Étiquettes de l''axe X visibles\nxaxis_angle=Angle des étiquettes de l''axe X\nxaxis_title=Titre de l''axe X\nxaxis_title_placeholder=Insérer le titre de l''axe X\nyaxis_showLabels=Étiquettes de l''axe Y visibles\nyaxis_angle=Angle des étiquettes de l''axe Y\nyaxis_title=Titre de l''axe Y\nyaxis_title_placeholder=Insérer le titre de l''axe Y\n\nmeter_group=Compteur\nmeter_start=Démarrer\nmeter_warning=Niveau d''avertissement\nmeter_critical=Niveau critique\nmeter_end=Fin\n\nmap_group=Carte\ncolor_scheme=Schéma de couleurs\n\nrefresh_group=Rafraîchir\nrefresh_interval=Rafraîchir (secondes)\nrefresh_stale_data=Rafraîchir les données périmées\n\n# Filter\n\nfilter_group=Filtrer\nfilter_enabled=Activé\nfilter_self=Applique automatiquement\nfilter_listening=Écouter les autres\nfilter_notifications=Informer les autres\nselector_group=Sélecteur\nselector_width=Largeur\nselector_multiple=Multiple\nselector_show_inputs=Afficher les entrées\n\nfilter_editor_selectcolumn=- Sélectionner une colonne -\n\ntimeframe_from=De\ntimeframe_to=À\ntimeframe_first_month_year=Premier mois de l''année\n\ncase_sensitive=Respect de la casse\nlike_to_pattern_instructions=\"%\" signifie zéro ou plusieurs caractères, tandis que \"_\" signifie un seul caractère\nmultiple_input_descriptions=Les valeurs multiples sont prises en charge. \"|\" ou \",\" peut être utilisé comme séparateur\n\ndataset_groupdate_fixed_intervals=Intervalles fixes\ndataset_groupdate_empty_intervals=Intervalles vides\ndataset_groupdate_interval_type=Type d''intervalle\ndataset_groupdate_max_intervals=Nombre max. d''intervalles\ndataset_groupdate_firstday=Premier jour\ndataset_groupdate_firstmonth=Premier mois\n\nsettings_validation_integer=La valeur doit être un nombre entier.\nsettings_validation_double=La valeur doit être un double.\nsettings_validation_meter_unknown=Inconnu\nsettings_validation_meter_higher=Doit être supérieur à la valeur {0}.\nsettings_validation_meter_lower=Doit être inférieur à la valeur {0}.\nsettings_validation_meter_invalid=Valeur incorrecte\n\n# DataSetLookup literals\ndataset_dataset=Ensemble de données\ndataset_filters=Filtres\ndataset_rows=Lignes\ndataset_columns=Colonnes\ngroup_columnid_label=ID de colonne\ndataset_lookup_group_columns_all=- Pas de regroupement -\ndataset_lookup_dataset_notfound=Ensemble de données {0} introuvable\ndataset_lookup_init_error=Erreur d''initialisation\n\n# DisplayerEditor literals\ndisplayer_editor_title=Éditeur de l''afficheur\ndisplayer_editor_new=Nouvel afficheur\ndisplayer_editor_dataset_notfound=Ensemble de données sélectionné introuvable.\ndisplayer_editor_datasetmetadata_fetcherror=Erreur lors de l''extraction des métadonnées de l''ensemble de données.\ndisplayer_editor_dataset_nolookuprequest=Il n''est pas possible de créer une demande de recherche de données pour l''ensemble de données sélectionné.\ndisplayer_editor_incompatible_settings=Les paramètres des données ne sont pas compatibles. Les paramètres actuels seront perdus. Continuer ?\ndisplayer_editor_tab_type=Type\ndisplayer_editor_tab_data=Données\ndisplayer_editor_tab_display=Afficher\ndisplayer_editor_view_as_table=Afficher sous la forme d''un tableau\n\nrenderer_selector_title=Sélecteur de rendu\n\ndisplayerlocator_default_renderer_undeclared=Moteur de rendu par défaut de l''afficheur {0} non déclaré.\ndisplayerlocator_unsupported_displayer_renderer=Afficheur {0} non pris en charge dans le moteur de rendu {1}.\n\nrendererliblocator_renderer_not_found={0} Le moteur de rendu est introuvable.\nrendererliblocator_multiple_renderers_found=Plusieurs implémentations du moteur de rendu ont été trouvées pour : {0}\nrenderermanager_renderer_not_available=Aucun moteur de rendu pour le type : {0}.\n\ndisplayerviewer_displayer_not_created=L''afficheur n''a pas pu être créé\n\nexpand=Développer\ncollapse=Réduire\nremoveFilter=Supprimer le filtre\n\nDisplayerErrorWidget.displayerErrorTitle=Erreur inattendue\nDisplayerErrorWidget.errorDetails=Détails\n\nExternalComponentView.configurationIssueTitle=Modifier la configuration\nExternalComponentView.configurationIssueDescription=Le composant ne prend pas en charge la configuration actuelle.\n\nloadingComponent=Chargement du composant\ncomponentEditor=Éditeur du composant\ncomponentNotFound=Composant non trouvé\nnoPropertiesComponent=Ce composant n''a pas de propriétés.\ncomponentConfigDefaultMessage=Lisez la configuration du composant pour savoir quelles colonnes il prend en charge. \nmandatoryHelpHeader=Obligatoire\nmandatoryHelpText=Ce champ est obligatoire."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nok=Ok\ncancel=Annulla\nerror=Errore:\ncause=Causa:\n\n# Position enum literals\nPOSITION_BOTTOM=Inferiore\nPOSITION_TOP=Superiore\nPOSITION_LEFT=Sinistra\nPOSITION_RIGHT=Destra\nPOSITION_IN=Interno\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rosso\nCOLOR_SCHEME_BLUE=Blu\nCOLOR_SCHEME_GREEN=Verde\n\n# Common settings editor literals\n\ndataset_editor_notfound=Set di dati non trovato\ncommon_dropdown_select=- Seleziona -\ncommon_button_addnew=Aggiungi Nuovo\n\nsettingsEditor_caption=Editor Impostazioni Displayer\nsettingsJsonSource_caption=Visualizzazione Sorgente JSON Impostazioni Displayer\n\ncommon_group=Generale\ncommon_showTitle=Visibile\ncommon_title=Titolo\ncommon_title_placeholder=Inserisci il titolo del grafico\ncommon_export=Esporta\ncommon_allowCSV=CSV\ncommon_allowExcel=Excel\ncommon_renderer=Renderer\ncommon_columns=Colonne\ncolumns_name=Colonna\ncolumns_expression=Espressione\ncolumns_pattern=Pattern\ncolumns_emptyvalue=Vuoto\ncommon_columns_placeholder=Inserisci le colonne del displayer, separate da virgole\n\nchart_group=Grafico\nchart_width=Larghezza\nchart_height=Altezza\nchart_resizable=Ridimensionamento Automatico\nchart_bgColor=Colore di sfondo\n\nchart_marginGroup=Margini\nchart_topMargin=Margine superiore\nchart_bottomMargin=Margine inferiore\nchart_leftMargin=Margine sinistro\nchart_rightMargin=Margine destro\n\nchart_legendGroup=Legenda\nchart_legendShow=Visibile\nchart_legendPosition=Posizione\nchart_3d=3D\n\ntable_group=Tabella\ntable_pageSize=Dimensione pagina\ntable_width=Larghezza\ntable_sortEnabled=Ordinamento abilitato\ntable_sortColumn=Ordina per default\ntable_sortColumn_placeholder=Inserisci l''ID della colonna di ordinamento predefinito\ntable_sortOrder=Ordine di ordinamento\ntable_ascSortOrder=Crescente\ntable_descSortOrder=Decrescente\ntable_columnPicker=Selettore di colonne\n\naxis_group=Asse\nxaxis_showLabels=Etichette asse X visibili\nxaxis_angle=Angolo etichette asse X\nxaxis_title=Titolo asse X\nxaxis_title_placeholder=Inserisci il titolo dell''asse X\nyaxis_showLabels=Etichette asse Y visibili\nyaxis_angle=Angolo etichette asse Y\nyaxis_title=Titolo asse Y\nyaxis_title_placeholder=Inserisci il titolo dell''asse Y\n\nmeter_group=Misuratore\nmeter_start=Inizio\nmeter_warning=Livello di avviso\nmeter_critical=Livello critico\nmeter_end=Fine\n\nmap_group=Mappa\ncolor_scheme=Schema di colori\n\nrefresh_group=Aggiorna\nrefresh_interval=Aggiorna (secondi)\nrefresh_stale_data=Aggiorna dati obsoleti\n\n# Filter\n\nfilter_group=Filtro\nfilter_enabled=Abilitato\nfilter_self=Applica a se stesso\nfilter_listening=Ascolta altri\nfilter_notifications=Notifica altri\nselector_group=Selettore\nselector_width=Larghezza\nselector_multiple=Multiplo\nselector_show_inputs=Mostra input\n\nfilter_editor_selectcolumn=- Seleziona colonna -\n\ntimeframe_from=Da\ntimeframe_to=A\ntimeframe_first_month_year=Primo mese dell''anno\n\ncase_sensitive=Maiuscole/minuscole\nlike_to_pattern_instructions=''%'' significa zero o più caratteri mentre ''_'' significa un singolo carattere\nmultiple_input_descriptions=Sono supportati valori multipli. Può essere utilizzato ''|'' o '','' come separatore\n\ndataset_groupdate_fixed_intervals=Intervalli fissi\ndataset_groupdate_empty_intervals=Intervalli vuoti\ndataset_groupdate_interval_type=Tipo di intervallo\ndataset_groupdate_max_intervals=Max. intervalli\ndataset_groupdate_firstday=Primo giorno\ndataset_groupdate_firstmonth=Primo mese\n\nsettings_validation_integer=Il valore deve essere un numero intero.\nsettings_validation_double=Il valore deve essere un numero decimale.\nsettings_validation_meter_unknown=Sconosciuto\nsettings_validation_meter_higher=Deve essere superiore al valore {0}.\nsettings_validation_meter_lower=Deve essere inferiore al valore {0}.\nsettings_validation_meter_invalid=Valore non valido\n\n# DataSetLookup literals\ndataset_dataset=Set di dati\ndataset_filters=Filtri\ndataset_rows=Righe\ndataset_columns=Colonne\ngroup_columnid_label=ID Colonna.\ndataset_lookup_group_columns_all=- Nessun raggruppamento -\ndataset_lookup_dataset_notfound=Set di dati {0} non trovato\ndataset_lookup_init_error=Errore di inizializzazione\n\n# DisplayerEditor literals\ndisplayer_editor_title=Editor Displayer\ndisplayer_editor_new=Nuovo Displayer\ndisplayer_editor_dataset_notfound=Set di dati selezionato non trovato.\ndisplayer_editor_datasetmetadata_fetcherror=Errore durante il recupero dei metadati del set di dati.\ndisplayer_editor_dataset_nolookuprequest=Non è possibile creare una richiesta di ricerca dati per il set di dati selezionato.\ndisplayer_editor_incompatible_settings=Le impostazioni dei dati non sono compatibili. Le impostazioni correnti verranno perse. Continuare?\ndisplayer_editor_tab_type=Tipo\ndisplayer_editor_tab_data=Dati\ndisplayer_editor_tab_display=Visualizzazione\ndisplayer_editor_view_as_table=Visualizza come tabella\n\nrenderer_selector_title=Selettore Renderer\n\ndisplayerlocator_default_renderer_undeclared=Renderer predefinito per il displayer {0} non dichiarato.\ndisplayerlocator_unsupported_displayer_renderer=Displayer {0} non supportato nel renderer {1}.\n\nrendererliblocator_renderer_not_found=Renderer {0} non trovato.\nrendererliblocator_multiple_renderers_found=Trovate più implementazioni del renderer per: {0}\nrenderermanager_renderer_not_available=Nessun renderer disponibile per il tipo: {0}.\n\ndisplayerviewer_displayer_not_created=Impossibile creare il displayer\n\nexpand=Espandi\ncollapse=Comprimi\nremoveFilter=Rimuovi filtro\n\nDisplayerErrorWidget.displayerErrorTitle=Errore Imprevisto\nDisplayerErrorWidget.errorDetails=Dettagli\n\nExternalComponentView.configurationIssueTitle=Modifica Configurazione\nExternalComponentView.configurationIssueDescription=Il componente non supporta la configurazione corrente.\n\nloadingComponent=Caricamento Componente\ncomponentEditor=Editor Componente\ncomponentNotFound=Componente Non Trovato\nnoPropertiesComponent=Questo componente non ha proprietà.\ncomponentConfigDefaultMessage=Leggere la configurazione del componente per trovare quali colonne supporta. \nmandatoryHelpHeader=Obbligatorio\nmandatoryHelpText=Questo campo è obbligatorio.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nok=OK\ncancel=キャンセル\nerror=エラー:\ncause=原因:\n\n# Position enum literals\nPOSITION_BOTTOM=下揃え\nPOSITION_TOP=上揃え\nPOSITION_LEFT=左揃え\nPOSITION_RIGHT=右揃え\nPOSITION_IN=In\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=赤\nCOLOR_SCHEME_BLUE=青\nCOLOR_SCHEME_GREEN=緑\n\n# Common settings editor literals\n\ndataset_editor_notfound=データセットが見つかりません\ncommon_dropdown_select=- 選択 -\ncommon_button_addnew=新規の追加\n\nsettingsEditor_caption=ディスプレイヤー設定エディター\nsettingsJsonSource_caption=ディスプレイヤー設定 JSON ソースビュー\n\ncommon_group=全般\ncommon_showTitle=可視\ncommon_title=タイトル\ncommon_title_placeholder=チャートのタイトルの挿入\ncommon_export=エクスポート\ncommon_allowCSV=CSV \ncommon_allowExcel=Excel \ncommon_renderer=レンダラー\ncommon_columns=カラム\ncolumns_name=カラム\ncolumns_expression=式\ncolumns_pattern=パターン\ncolumns_emptyvalue=空\ncommon_columns_placeholder=ディスプレイヤーの列をカンマで区切って挿入\n\nchart_group=チャート\nchart_width=幅\nchart_height=高さ\nchart_resizable=自動のサイズ変更\nchart_bgColor=背景色\n\nchart_marginGroup=余白\nchart_topMargin=上余白\nchart_bottomMargin=下余白\nchart_leftMargin=左余白\nchart_rightMargin=右余白\n\nchart_legendGroup=凡例\nchart_legendShow=可視\nchart_legendPosition=ポジション\nchart_3d=3D\n\ntable_group=テーブル\ntable_pageSize=ページサイズ\ntable_width=幅\ntable_sortEnabled=ソートが有効化\ntable_sortColumn=デフォルトでソート\ntable_sortColumn_placeholder=デフォルトソート列 ID の挿入\ntable_sortOrder=ソート順序\ntable_ascSortOrder=昇順\ntable_descSortOrder=降順\ntable_columnPicker=列取得\n\naxis_group=軸\nxaxis_showLabels=X 軸ラベルを表示\nxaxis_angle=X 軸ラベルの角度\nxaxis_title=X 軸タイトル\nxaxis_title_placeholder=X 軸タイトルの挿入\nyaxis_showLabels=Y 軸ラベルを表示\nyaxis_angle=Y 軸ラベルの角度\nyaxis_title=Y 軸タイトル\nyaxis_title_placeholder=Y 軸タイトルの挿入\n\nmeter_group=メーター\nmeter_start=開始\nmeter_warning=警告レベル\nmeter_critical=重大レベル\nmeter_end=終了\n\nmap_group=マップ\ncolor_scheme=カラースキーム\n\nrefresh_group=更新\nrefresh_interval=更新 (秒)\nrefresh_stale_data=古いデータの更新\n\n# Filter\n\nfilter_group=フィルター\nfilter_enabled=有効\nfilter_self=自己適用\nfilter_listening=他のコンポーネントをリッスン\nfilter_notifications=他のコンポーネントに通知\nselector_group=セレクター\nselector_width=幅\nselector_multiple=複数\nselector_show_inputs=入力を表示\n\nfilter_editor_selectcolumn=- 列の選択 -\n\ntimeframe_from=から\ntimeframe_to=終了\ntimeframe_first_month_year=年度開始月\n\ncase_sensitive=大文字と小文字を区別します\nlike_to_pattern_instructions=''%'' は 0 以上の文字数で ''_'' は 1 文字になります\nmultiple_input_descriptions=複数の値がサポートされています。セパレーターには、''|'' または '','' を使用できます。\n\ndataset_groupdate_fixed_intervals=固定された間隔\ndataset_groupdate_empty_intervals=空の間隔\ndataset_groupdate_interval_type=間隔タイプ\ndataset_groupdate_max_intervals=最大間隔\ndataset_groupdate_firstday=開始日\ndataset_groupdate_firstmonth=開始月\n\nsettings_validation_integer=値は整数でなければなりません。\nsettings_validation_double=値は倍精度形式でなければなりません。\nsettings_validation_meter_unknown=不明\nsettings_validation_meter_higher={0} 値よりも大きい必要があります。\nsettings_validation_meter_lower={0} 値よりも小さい必要があります。\nsettings_validation_meter_invalid=無効値\n\n# DataSetLookup literals\ndataset_dataset=データセット\ndataset_filters=フィルター\ndataset_rows=行\ndataset_columns=カラム\ngroup_columnid_label=列 ID\ndataset_lookup_group_columns_all=グループ化無し\ndataset_lookup_dataset_notfound=データセット {0} が見つかりません\ndataset_lookup_init_error=初期化エラー\n\n# DisplayerEditor literals\ndisplayer_editor_title=ディスプレイヤーエディター\ndisplayer_editor_new=新規ディスプレイヤー\ndisplayer_editor_dataset_notfound=選択されたデータセットが見つかりません。\ndisplayer_editor_datasetmetadata_fetcherror=データセットメタデータのフェッチ中にエラがー発生しました。\ndisplayer_editor_dataset_nolookuprequest=選択されたデータセットに対してデータルックアップ要求を作成できません。\ndisplayer_editor_incompatible_settings=データ設定には互換性がありません。現在の設定は失われます。続行しますか?\ndisplayer_editor_tab_type=タイプ\ndisplayer_editor_tab_data=データ\ndisplayer_editor_tab_display=表示\ndisplayer_editor_view_as_table=テーブルとして表示\n\nrenderer_selector_title=レンダラーセレクター\n\ndisplayerlocator_default_renderer_undeclared={0} ディスプレイヤーのデフォルトレンダラーが宣言されていません。\ndisplayerlocator_unsupported_displayer_renderer={0} ディスプレイヤーは {1} レンダラーでサポートされていません。\n\nrendererliblocator_renderer_not_found={0} レンダラーが見つかりません。\nrendererliblocator_multiple_renderers_found=複数のレンダラー実装が見つかりました: {0}\nrenderermanager_renderer_not_available=タイプ:  {0} で利用可能なレンダラーがありません。\n\ndisplayerviewer_displayer_not_created=ディスプレイヤーを作成できませんでした。\n\nexpand=展開\ncollapse=折りたたむ\nremoveFilter=フィルターの削除\n\nDisplayerErrorWidget.displayerErrorTitle=予期しないエラー\nDisplayerErrorWidget.errorDetails=詳細\n\nExternalComponentView.configurationIssueTitle=設定の変更\nExternalComponentView.configurationIssueDescription=コンポーネントは現在の設定をサポートしていません。\n\nloadingComponent=コンポーネントのロード\ncomponentEditor=コンポーネントエディター\ncomponentNotFound=コンポーネントが見つかりません\nnoPropertiesComponent=このコンポーネントにはプロパティーがありません。\ncomponentConfigDefaultMessage=コンポーネント設定を読んで、サポートする列を見つけてください。\nmandatoryHelpHeader=必須\nmandatoryHelpText=このフィールドは必須です。"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "ok=Ok\ncancel=Cancelar\nerror=Erro\ncause=Causa\nPOSITION_BOTTOM=Inferior\nPOSITION_TOP=Superior\nPOSITION_LEFT=Esquerda\nPOSITION_RIGHT=Direita\nPOSITION_IN=em\ndataset_editor_notfound=Definição de Data não foi encontrada\ncommon_dropdown_select=- Selecionar -\ncommon_button_addnew=Adicionar Novo\nsettingsEditor_caption=Editor de Configurações de Exibição\nsettingsJsonSource_caption=Visualização da Fonte Json  Configurações de Exibidor\ncommon_group=Geral\ncommon_showTitle=Visível\ncommon_title=Título\ncommon_title_placeholder=Ensira o títolo do gráfico\ncommon_renderer=Renderizador\ncommon_columns=Colunas\ncolumns_name=Coluna\ncolumns_expression=Expressão\ncolumns_pattern=Modelo\ncolumns_emptyvalue=Vazio\ncommon_columns_placeholder=Ensira as colunas do exibidor, separado por vírgulas\nchart_group=Gráfico\nchart_width=Largura\nchart_height=Altura\nchart_bgColor=Cor de fundo\nchart_marginGroup=Margens\nchart_topMargin=Margem Superior\nchart_bottomMargin=Margem Inferior\nchart_leftMargin=Margem esquerda\nchart_rightMargin=Margem Direita\nchart_legendGroup=Legenda\nchart_legendShow=Visível\nchart_legendPosition=Posição\nchart_3d=3D\ntable_group=Tabela\ntable_pageSize=Tamanho da Página\ntable_width=Largura\ntable_sortEnabled=Organizar pos habilitados\ntable_sortColumn=Organizar por default\ntable_sortColumn_placeholder=Inserir o id da coluna de organizar default\ntable_sortOrder=Organizar por ordem\ntable_ascSortOrder=Ascendente\ntable_descSortOrder=Descendente\naxis_group=Axis\nxaxis_showLabels=rótulos X axis visíveis\nxaxis_angle=ângulo dos rótulos X axis \nxaxis_title=título do X axis \nxaxis_title_placeholder=Inserir título do X axis \nyaxis_showLabels=rótulos Y axis visíveis\nyaxis_angle=ângulo dos rótulos Y axis \nyaxis_title=título do Y axis \nyaxis_title_placeholder=Inserir título do Y axis \nmeter_group=Metro\nmeter_start=Iniciar\nmeter_warning=Nível do Aviso\nmeter_critical=Nível Crítico\nmeter_end=Fim\nrefresh_group=Atualizar\nrefresh_interval=Atualizar (segundos)\nrefresh_stale_data=Atualizar dados interrompidos\nfilter_group=Flitro\nfilter_enabled=Ativado\nfilter_self=Auto Aplicar\nfilter_listening=Ouvir Outros\nfilter_notifications=Notificar Outros\nfilter_editor_selectcolumn=- Selecionar Coluna - \ntimeframe_from=A partir de\ntimeframe_to=Até\ntimeframe_first_month_year=Primeiro mês do ano\ncase_sensitive=Diferencia letras maiúsculas de minúsculas\nlike_to_pattern_instructions=''%'' significa zero ou mais caracteres enquanto ''_'' significa um único caractere\nmultiple_input_descriptions=Múltiplos valores possuem suporte. Tanto  ''|'' como '','' podem ser usados como um separador\ndataset_groupdate_fixed_intervals=Intervalos fixos\ndataset_groupdate_empty_intervals=Intervalos Vazios\ndataset_groupdate_interval_type=Tipo de Intervalo\ndataset_groupdate_max_intervals=Max. de intervalos\ndataset_groupdate_firstday=Primeiro Dia\ndataset_groupdate_firstmonth=Primeiro Mês\nsettings_validation_integer=Valor deve ser um número inteiro\nsettings_validation_double=Valor deve ser um dobro.\nsettings_validation_meter_unknown=Desconhecido\nsettings_validation_meter_higher=Deve ser maior do que o valor {0}\nsettings_validation_meter_lower=Deve ser menor do que o valor {0}\nsettings_validation_meter_invalid=Valor inválido\ndataset_dataset=Data Set\ndataset_filters=Filtros\ndataset_rows=Linhas\ndataset_columns=Colunas\ngroup_columnid_label=Id de Coluna\ndataset_lookup_dataset_notfound=Data set {0} não foi encontrado\ndataset_lookup_init_error=Erro de inicialização\ndisplayer_editor_title=Editor de exibição\ndisplayer_editor_new=Novo Exibidor\ndisplayer_editor_dataset_notfound=Data set selecionados não foram encontrados.\ndisplayer_editor_datasetmetadata_fetcherror=Erro ao buscar o metadado do data set.\ndisplayer_editor_dataset_nolookuprequest=Não é possível criar uma requisição de procura de dados  para data set selecionado.\ndisplayer_editor_incompatible_settings=Configurações de dados não são compatíveis. As configurações atuais serão perdidas. Você deseja continuar?\ndisplayer_editor_tab_type=Tipo\ndisplayer_editor_tab_data=Dados\ndisplayer_editor_tab_display=Display\ndisplayer_editor_view_as_table=Vsualizar como Tabela\nrenderer_selector_title=Selecionador de renderizador\ndisplayerlocator_default_renderer_undeclared={0} renderizador default do exibidor não foi declarado.\ndisplayerlocator_unsupported_displayer_renderer={0} exibidor não é suportado no renderizador {1}.\nrendererliblocator_renderer_not_found={0} renderizador não foi encontrado.\nrendererliblocator_multiple_renderers_found=Implementações de renderizadores múltiplos encontrados para\\: {0}\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CollapseExpandConstants, author ldelima@redhat.com\ncollapse=Recolher\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "ok=确认\ncancel=取消\nerror=错误：\ncause=原因：\nPOSITION_BOTTOM=底部\nPOSITION_TOP=顶部\nPOSITION_LEFT=左\nPOSITION_RIGHT=右\nPOSITION_IN=里面\ndataset_editor_notfound=未找到数据集。\ncommon_dropdown_select=- 选择 -\ncommon_button_addnew=添加新显示屏\nsettingsEditor_caption=显示屏设置编辑器\nsettingsJsonSource_caption=显示屏设置的 JSON 源视图\ncommon_group=普通\ncommon_showTitle=可见的\ncommon_title=标题\ncommon_title_placeholder=插入图表的标题\ncommon_renderer=渲染器\ncommon_columns=列\ncolumns_name=列\ncolumns_expression=表达式\ncolumns_pattern=模式\ncolumns_emptyvalue=空的\ncommon_columns_placeholder=插入显示屏的列，有逗号隔开。\nchart_group=图表\nchart_width=宽\nchart_height=高\nchart_bgColor=背景色\nchart_marginGroup=边距\nchart_topMargin=顶边距\nchart_bottomMargin=底边距\nchart_leftMargin=左边距\nchart_rightMargin=右边距\nchart_legendGroup=图例\nchart_legendShow=可见的\nchart_legendPosition=位置\nchart_3d=3D\ntable_group=表\ntable_pageSize=页面大小\ntable_width=宽\ntable_sortEnabled=启用排序\ntable_sortColumn=默认排序\ntable_sortColumn_placeholder=插入默认的排序列 ID\ntable_sortOrder=排列顺序\ntable_ascSortOrder=升序排列\ntable_descSortOrder=降序排列\naxis_group=轴\nxaxis_showLabels=X 轴标签可见\nxaxis_angle=X 轴标签角度\nxaxis_title=X  轴标题\nxaxis_title_placeholder=插入 X  轴标题\nyaxis_showLabels=Y 轴标签可见\nyaxis_angle=Y 轴标签角度\nyaxis_title=Y 轴标题\nyaxis_title_placeholder=插入 Y  轴标题\nmeter_group=计量\nmeter_start=开始\nmeter_warning=警告级别\nmeter_critical=关键级别\nmeter_end=结束\nrefresh_group=刷新\nrefresh_interval=刷新（秒）\nrefresh_stale_data=刷新过时数据\nfilter_group=过滤器\nfilter_enabled=已启用的\nfilter_self=自适用\nfilter_listening=侦听其他\nfilter_notifications=通知其他\nfilter_editor_selectcolumn=- 选择列 -\ntimeframe_from=从\ntimeframe_to=到\ntimeframe_first_month_year=年度的第一个月\ncase_sensitive=区分大小\nlike_to_pattern_instructions=''%'' 代表 0 或多个字符，而 ''_'' 代表单一字符。\nmultiple_input_descriptions=不支持多个值。可使用 ''|'' 或者 '','' 作为分隔符。\ndataset_groupdate_fixed_intervals=固定间隔\ndataset_groupdate_empty_intervals=空间隔\ndataset_groupdate_interval_type=间隔类型\ndataset_groupdate_max_intervals=最大间隔\ndataset_groupdate_firstday=第一天\ndataset_groupdate_firstmonth=第一个月\nsettings_validation_integer=值必须为整数。\nsettings_validation_double=值必须为实数。\nsettings_validation_meter_unknown=未知的\nsettings_validation_meter_higher=必须大于 {0} 值。\nsettings_validation_meter_lower=必须小于 {0} 值。\nsettings_validation_meter_invalid=无效值\ndataset_dataset=数据集\ndataset_filters=过滤器\ndataset_rows=行\ndataset_columns=列\ngroup_columnid_label=列 ID。\ndataset_lookup_dataset_notfound=未找到数据集 {0} 。\ndataset_lookup_init_error=初始化错误\ndisplayer_editor_title=显示屏编辑器\ndisplayer_editor_new=新建显示屏\ndisplayer_editor_dataset_notfound=未找到所选的数据集。\ndisplayer_editor_datasetmetadata_fetcherror=获取数据集元数据出错。\ndisplayer_editor_dataset_nolookuprequest=为所选的数据集创建数据查找请求是不可能的。\ndisplayer_editor_incompatible_settings=数据设置不兼容。当前的设置将会丢失。要继续吗？\ndisplayer_editor_tab_type=类型\ndisplayer_editor_tab_data=数据\ndisplayer_editor_tab_display=显示\ndisplayer_editor_view_as_table=表视图\nrenderer_selector_title=渲染器选择器\ndisplayerlocator_default_renderer_undeclared=没有声明 {0} 显示屏的默认渲染器。\ndisplayerlocator_unsupported_displayer_renderer={1} 渲染器不支持 {0} 显示屏。\nrendererliblocator_renderer_not_found=未找到 {0} 渲染器\nrendererliblocator_multiple_renderers_found=找到了 {0} 的多个渲染器实现\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CollapseExpandConstants, author xi.huang\ncollapse=收缩\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ninitializing=Initializing ...\nerror=ERROR:\nerror_settings_unset=DisplayerSettings property not set\nerror_handler_unset=DataSetHandler property not set\nerror_dataset_notfound=Data set not found\ndisplayer_keyword_not_allowed=Not allowed ( {0} )\ndisplayer_expr_invalid_syntax=Invalid syntax ( {0} )\nuserDefinedVariableDescription=User defined HTML identifier (see the HTML template)\nvalueRawVariableDescription=The value without applying any formatting\nvalueStartVariableDescription=The start value setting (see the ''Display'' section)\nvalueWarningVariableDescription=The warning value setting (see the ''Display'' section)\nvalueCriticalVariableDescription=The critical value setting (see the ''Display'' section)\nvalueEndVariableDescription=The end value setting (see the ''Display'' section)\nvalueVariableDescription=The formatted value\ntitleVariableDescription=The title setting (see the ''Display'' section)\nwidthVariableDescription=The width setting (see the ''Display'' section)\nheightVariableDescription=The height setting (see the ''Display'' section)\nmarginTopVariableDescription=The margin top setting (see the ''Display'' section)\nmarginBottomVariableDescription=The margin bottom setting (see the ''Display'' section)\nmarginRightVariableDescription=The margin right setting (see the ''Display'' section)\nmarginLeftVariableDescription=The margin left setting (see the ''Display'' section)\nbgColorVariableDescription=The background color setting (see the ''Display'' section)\nisFilterEnabledVariableDescription=Returns true when both the displayer supports filtering and the filter setting is enabled (see the ''Display'' section)\nisFilterOnVariableDescription=Returns true when a filter is active\nisEmptyVariableDescription=Returns true when the underlying data set returns no data\ndoFilterVariableDescription=Function to notify and force other displayers in the same page to update according the filters defined by this displayer (if any)\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_de.properties",
    "content": "initializing=Initialisiere...\nerror=FEHLER\\:\nerror_settings_unset=DisplayerSettings-Eigenschaft nicht eingestellt.\nerror_handler_unset=DataSetHandler-Eigenschaft nicht eingestellt.\nerror_dataset_notfound=Datensatz nicht gefunden\ndisplayer_keyword_not_allowed=Nicht erlaubt ( {0} )\ndisplayer_expr_invalid_syntax=Ungültige Syntax ( {0} )\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ninitializing=Iniciando…\nerror=ERROR:\nerror_settings_unset=La propiedad DisplayerSettings no está establecida\nerror_handler_unset=La propiedad DataSetHandler no está establecida\nerror_dataset_notfound=No se encuentra el conjunto de datos\ndisplayer_keyword_not_allowed=No está permitido ( {0} )\ndisplayer_expr_invalid_syntax=Sintaxis no válida ( {0} )\nuserDefinedVariableDescription=Identificador HTML definido por el usuario (consultar la plantilla HTML)\nvalueRawVariableDescription=El valor sin aplicar ningún formato\nvalueStartVariableDescription=El ajuste del valor inicial (consultar la sección “Pantalla”)\nvalueWarningVariableDescription=El ajuste del valor de advertencia (consultar la sección “Pantalla”)\nvalueCriticalVariableDescription=El ajuste del valor crítico (consultar la sección “Pantalla”)\nvalueEndVariableDescription=El ajuste del valor final (consultar la sección “Pantalla”)\nvalueVariableDescription=El valor con formato\ntitleVariableDescription=El ajuste del título (consultar la sección “Pantalla”)\nwidthVariableDescription=El ajuste del ancho (consultar la sección “Pantalla”)\nheightVariableDescription=El ajuste de la altura (consultar la sección “Pantalla”)\nmarginTopVariableDescription=El ajuste de la parte superior (consultar la sección “Pantalla”)\nmarginBottomVariableDescription=El ajuste de la parte inferior (consultar la sección “Pantalla”)\nmarginRightVariableDescription=El ajuste del margen derecho (consultar la sección “Pantalla”)\nmarginLeftVariableDescription=El ajuste del margen izquierdo (consultar la sección “Pantalla”)\nbgColorVariableDescription=El ajuste del color de fondo (consultar la sección “Pantalla”)\nisFilterEnabledVariableDescription=Indica verdadero cuando el visualizador admite el filtrado y el ajuste del filtro está habilitado (consultar la sección “Pantalla”)\nisFilterOnVariableDescription=Indica verdadero cuando un filtro está activo\nisEmptyVariableDescription=Indica verdadero cuando el conjunto de datos subyacente no devuelve datos\ndoFilterVariableDescription=Función para notificar y forzar a otros visualizadores en la misma página a actualizar en función de los filtros definidos por este visualizador (si los hay)\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ninitializing=Initialisation…\nerror=ERREUR :\nerror_settings_unset=Propriété DisplayerSettings non définie\nerror_handler_unset=Propriété DataSetHandler non définie\nerror_dataset_notfound=Ensemble de données introuvable\ndisplayer_keyword_not_allowed=Non autorisé ( {0} )\ndisplayer_expr_invalid_syntax=Syntaxe non valide ( {0} )\nuserDefinedVariableDescription=Identificateur HTML défini par l''utilisateur (voir le modèle HTML)\nvalueRawVariableDescription=Valeur sans application de formatage\nvalueStartVariableDescription=Définition de la valeur de début (voir la section ''Affichage'')\nvalueWarningVariableDescription=Définition de la valeur d''avertissement (voir la section ''Affichage'')\nvalueCriticalVariableDescription=Définition de la valeur critique (voir la section ''Affichage'')\nvalueEndVariableDescription=Définition de la valeur de fin (voir la section ''Affichage'')\nvalueVariableDescription=Valeur formatée\ntitleVariableDescription=Paramètre de titre (voir la section ''Affichage'')\nwidthVariableDescription=Paramètre de largeur (voir la section ''Affichage'')\nheightVariableDescription=Paramètre de hauteur (voir la section ''Affichage'')\nmarginTopVariableDescription=Paramètre de marge supérieure (voir la section ''Affichage'')\nmarginBottomVariableDescription=Paramètre de marge inférieure (voir la section ''Affichage'')\nmarginRightVariableDescription=Paramètre de marge droite (voir la section ''Affichage'')\nmarginLeftVariableDescription=Paramètre de marge de gauche (voir la section ''Affichage'')\nbgColorVariableDescription=Paramètre de couleur d''arrière-plan (voir la section ''Affichage'')\nisFilterEnabledVariableDescription=Renvoie la valeur ''vrai'' lorsque l''afficheur prend en charge le filtrage et que le paramètre de filtrage est activé (voir la section ''Affichage'')\nisFilterOnVariableDescription=Renvoie la valeur ''vrai'' lorsqu''un filtre est actif\nisEmptyVariableDescription=Renvoie la valeur ''vrai'' lorsque l''ensemble de données sous-jacent ne renvoie aucune donnée\ndoFilterVariableDescription=Fonction permettant de notifier et de forcer les autres afficheurs de la même page à se mettre à jour en fonction des filtres définis par cet afficheur (le cas échéant)\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ninitializing=Inizializzazione ...\nerror=ERRORE:\nerror_settings_unset=Proprietà DisplayerSettings non impostata\nerror_handler_unset=Proprietà DataSetHandler non impostata\nerror_dataset_notfound=Set di dati non trovato\ndisplayer_keyword_not_allowed=Non consentito ( {0} )\ndisplayer_expr_invalid_syntax=Sintassi non valida ( {0} )\nuserDefinedVariableDescription=Identificatore HTML definito dall''utente (vedi il template HTML)\nvalueRawVariableDescription=Il valore senza applicare alcun formato\nvalueStartVariableDescription=L''impostazione del valore iniziale (vedi la sezione ''Visualizzazione'')\nvalueWarningVariableDescription=L''impostazione del valore di avviso (vedi la sezione ''Visualizzazione'')\nvalueCriticalVariableDescription=L''impostazione del valore critico (vedi la sezione ''Visualizzazione'')\nvalueEndVariableDescription=L''impostazione del valore finale (vedi la sezione ''Visualizzazione'')\nvalueVariableDescription=Il valore formattato\ntitleVariableDescription=L''impostazione del titolo (vedi la sezione ''Visualizzazione'')\nwidthVariableDescription=L''impostazione della larghezza (vedi la sezione ''Visualizzazione'')\nheightVariableDescription=L''impostazione dell''altezza (vedi la sezione ''Visualizzazione'')\nmarginTopVariableDescription=L''impostazione del margine superiore (vedi la sezione ''Visualizzazione'')\nmarginBottomVariableDescription=L''impostazione del margine inferiore (vedi la sezione ''Visualizzazione'')\nmarginRightVariableDescription=L''impostazione del margine destro (vedi la sezione ''Visualizzazione'')\nmarginLeftVariableDescription=L''impostazione del margine sinistro (vedi la sezione ''Visualizzazione'')\nbgColorVariableDescription=L''impostazione del colore di sfondo (vedi la sezione ''Visualizzazione'')\nisFilterEnabledVariableDescription=Restituisce true quando sia il displayer supporta il filtraggio che l''impostazione del filtro è abilitata (vedi la sezione ''Visualizzazione'')\nisFilterOnVariableDescription=Restituisce true quando è attivo un filtro\nisEmptyVariableDescription=Restituisce true quando il set di dati sottostante non restituisce dati\ndoFilterVariableDescription=Funzione per notificare e forzare altri displayers nella stessa pagina ad aggiornarsi in base ai filtri definiti da questo displayer (se presenti)\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ninitializing=初期化中 ...\nerror=エラー:\nerror_settings_unset=DisplayerSettings プロパティーが設定されていません\nerror_handler_unset=DataSetHandler プロパティーが設定されていません\nerror_dataset_notfound=データセットが見つかりません\ndisplayer_keyword_not_allowed=使用できません ( {0} )\ndisplayer_expr_invalid_syntax=無効な構文 ( {0} )\nuserDefinedVariableDescription=ユーザ定義のHTML識別子(HTMLテンプレート参照)\nvalueRawVariableDescription=フォーマットを適用しない値\nvalueStartVariableDescription=開始値設定(”ディスプレイ\"の項 を参照)\nvalueWarningVariableDescription=警告値設定(”ディスプレイ\"の項を参照)\nvalueCriticalVariableDescription=重大値設定(”ディスプレイ\"の項を参照)\nvalueEndVariableDescription=終了値設定(”ディスプレイ\"の項を参照)\nvalueVariableDescription=フォーマットされた値\ntitleVariableDescription=タイトル設定(”ディスプレイ\"の項を参照)\nwidthVariableDescription=幅設定(”ディスプレイ\"の項を参照)\nheightVariableDescription=高さ設定(”ディスプレイ\"の項を参照)\nmarginTopVariableDescription=上余白設定(”ディスプレイ\"の項を参照)\nmarginBottomVariableDescription=下余白設定(”ディスプレイ\"の項を参照)\nmarginRightVariableDescription=右余白設定(”ディスプレイ\"の項を参照)\nmarginLeftVariableDescription=左余白設定(”ディスプレイ\"の項を参照)\nbgColorVariableDescription=背景色設定(”ディスプレイ\"の項を参照)\nisFilterEnabledVariableDescription=ディスプレイヤーがフィルタリングとフィルタ設定の両方が有効化をサポートしている場合にtrueを返す (”ディスプレイ\"の項を参照)\nisFilterOnVariableDescription=フィルターがアクティブな場合にtrueを返す\nisEmptyVariableDescription=基礎的データが何も返さないように設定されている場合はtrueを返す\ndoFilterVariableDescription=このディスプレイヤーによって定義されたフィルター(もし設定されていれば)に従い同じページの別のディスプレイヤーに更新を通知及び強制する機能\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_pt_BR.properties",
    "content": "initializing=Inicializando...\nerror=ERRO\\:\nerror_settings_unset=Propriedade DisplayerSettings não definida\nerror_handler_unset=Propriedade DataSetHandler não definida\nerror_dataset_notfound=Conjunto de dados não encontrado\ndisplayer_keyword_not_allowed=( {0} ) não permitido(a)\ndisplayer_expr_invalid_syntax=( {0} ) sintaxe inválida \n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerConstants_zh_CN.properties",
    "content": "initializing=正在初始化......\nerror=错误：\nerror_settings_unset=没有设置 DisplayerSettings 属性\nerror_handler_unset=没有设置 DataSetHandler 属性\nerror_dataset_notfound=未找到数据集\ndisplayer_keyword_not_allowed=不允许（{0}）\ndisplayer_expr_invalid_syntax=无效语法（{0}）\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerHtmlConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_html_preview_link=Preview\ndisplayer_source_code_html=HTML\ndisplayer_source_code_javascript=Javascript\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerHtmlConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_html_preview_link=Vista previa\ndisplayer_source_code_html=HTML\ndisplayer_source_code_javascript=Javascript\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerHtmlConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_html_preview_link=Aperçu\ndisplayer_source_code_html=HTML\ndisplayer_source_code_javascript=JavaScript\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerHtmlConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_html_preview_link=プレビュー\ndisplayer_source_code_html=HTML\ndisplayer_source_code_javascript=Javascript\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ndisplayer_type_selector_tab_bar=Bar\ndisplayer_type_selector_tab_pie=Pie\ndisplayer_type_selector_tab_line=Line\ndisplayer_type_selector_tab_area=Area\ndisplayer_type_selector_tab_bubble=Bubble\ndisplayer_type_selector_tab_meter=Meter\ndisplayer_type_selector_tab_metric=Metric\ndisplayer_type_selector_tab_map=Map\ndisplayer_type_selector_tab_table=Table\ndisplayer_type_selector_tab_selector=Selector\n\n# Subtype enum literals\nDISPLAYER_SUBTYPE_LINE=Line\nDISPLAYER_SUBTYPE_SMOOTH=Smooth\nDISPLAYER_SUBTYPE_AREA=Area\nDISPLAYER_SUBTYPE_STACKED=Stacked\nDISPLAYER_SUBTYPE_STEPPED=Stepped\nDISPLAYER_SUBTYPE_BAR=Bar\nDISPLAYER_SUBTYPE_BAR_STACKED=Bar Stacked\nDISPLAYER_SUBTYPE_COLUMN=Column\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Column Stacked\nDISPLAYER_SUBTYPE_HISTOGRAM=Histogram\nDISPLAYER_SUBTYPE_PIE=Pie\nDISPLAYER_SUBTYPE_PIE_3D=3D Pie\nDISPLAYER_SUBTYPE_DONUT=Donut\nDISPLAYER_SUBTYPE_MAP_REGIONS=Map (Regions)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Map (Markers)\nDISPLAYER_SUBTYPE_METRIC_CARD=Metric Card\nDISPLAYER_SUBTYPE_METRIC_CARD2=Metric Card 2\nDISPLAYER_SUBTYPE_METRIC_QUOTA=Metric Quota\nDISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT=Metric Text\nDISPLAYER_SUBTYPE_SELECTOR_DROPDOWN=Drop Down\nDISPLAYER_SUBTYPE_SELECTOR_LABELS=Label Set\nDISPLAYER_SUBTYPE_SELECTOR_SLIDER=Slider\n\n# Subtype selector tooltips\nBARCHART_BAR_tt=Bar Chart\nBARCHART_BAR_STACKED_tt=Stacked Bar Chart\nBARCHART_COLUMN_tt=Column Chart\nBARCHART_COLUMN_STACKED_tt=Stacked Column Chart\nPIECHART_PIE_tt=Pie Chart\nPIECHART_PIE_3D_tt=3D Pie Chart\nPIECHART_DONUT_tt=Pie Chart (donut)\nAREACHART_AREA_tt=Area Chart\nAREACHART_AREA_STACKED_tt=Stacked Area Chart\nLINECHART_LINE_tt=Line Chart\nLINECHART_SMOOTH_tt=Smooth Line Chart\nMAP_MAP_REGIONS_tt=Map Chart (regions)\nMAP_MAP_MARKERS_tt=Map Chart (markers)\nBUBBLECHART_default_tt=Bubble Chart\nMETERCHART_default_tt=Meter Chart\nMETRIC_METRIC_CARD_tt=Metric Card\nMETRIC_METRIC_CARD2_tt=Metric Card 2\nMETRIC_METRIC_QUOTA_tt=Metric Quota\nMETRIC_METRIC_PLAIN_TEXT_tt=Metric Text\nTABLE_default_tt=Table\nEXTERNAL_COMPONENT_default_tt=External Component\nSELECTOR_SELECTOR_DROPDOWN_tt=Drop Down\nSELECTOR_SELECTOR_LABELS_tt=Label Set\nSELECTOR_SELECTOR_SLIDER_tt=Slider\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_de.properties",
    "content": "displayer_type_selector_tab_bar=Balken\ndisplayer_type_selector_tab_pie=Kreis\ndisplayer_type_selector_tab_line=Linie\ndisplayer_type_selector_tab_area=Fläche\ndisplayer_type_selector_tab_bubble=Blase\ndisplayer_type_selector_tab_meter=Messung\ndisplayer_type_selector_tab_metric=Metrisch\ndisplayer_type_selector_tab_map=Karte\ndisplayer_type_selector_tab_table=Tabelle\nDISPLAYER_SUBTYPE_LINE=Linie\nDISPLAYER_SUBTYPE_SMOOTH=Geglättet\nDISPLAYER_SUBTYPE_AREA=Bereich\nDISPLAYER_SUBTYPE_STACKED=Gestapelt\nDISPLAYER_SUBTYPE_STEPPED=Abgestuft\nDISPLAYER_SUBTYPE_BAR=Balken\nDISPLAYER_SUBTYPE_BAR_STACKED=Balken-gestapelt\nDISPLAYER_SUBTYPE_COLUMN=Säule\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Säulen-gestapelt\nDISPLAYER_SUBTYPE_HISTOGRAM=Histogram\nDISPLAYER_SUBTYPE_PIE=Kreis\nDISPLAYER_SUBTYPE_PIE_3D=3D Kreis\nDISPLAYER_SUBTYPE_DONUT=Ring\nDISPLAYER_SUBTYPE_MAP_REGIONS=Karte (Regionen)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Karte (Marker)\nBARCHART_BAR_tt=Balkendiagramm\nBARCHART_BAR_STACKED_tt=Gestapeltes Balkendiagramm\nBARCHART_COLUMN_tt=Säulendiagramm\nBARCHART_COLUMN_STACKED_tt=Gestapeltes Säulendiagramm\nPIECHART_PIE_tt=Kreisdiagramm\nPIECHART_PIE_3D_tt=3D Kreisdiagramm\nPIECHART_DONUT_tt=Ringdiagramm\nAREACHART_AREA_tt=Flächendiagramm\nAREACHART_AREA_STACKED_tt=Gestapeltes Flächendiagramm\nLINECHART_LINE_tt=Liniendiagramm\nLINECHART_SMOOTH_tt=Geglättetes Liniendiagramm\nMAP_MAP_REGIONS_tt=Kartendiagramm (Regionen)\nMAP_MAP_MARKERS_tt=Kartendiagramm (Marker)\nBUBBLECHART_default_tt=Blasendiagramm\nMETERCHART_default_tt=Meter-Diagramm\nTABLE_default_tt=Tabelle\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ndisplayer_type_selector_tab_bar=Barra\ndisplayer_type_selector_tab_pie=Circular\ndisplayer_type_selector_tab_line=Línea\ndisplayer_type_selector_tab_area=Área\ndisplayer_type_selector_tab_bubble=Burbuja\ndisplayer_type_selector_tab_meter=Medidor\ndisplayer_type_selector_tab_metric=Métrica\ndisplayer_type_selector_tab_map=Mapa\ndisplayer_type_selector_tab_table=Tabla\ndisplayer_type_selector_tab_selector=Selector\n\n# Subtype enum literals\nDISPLAYER_SUBTYPE_LINE=Línea\nDISPLAYER_SUBTYPE_SMOOTH=Suave\nDISPLAYER_SUBTYPE_AREA=Área\nDISPLAYER_SUBTYPE_STACKED=Apilado\nDISPLAYER_SUBTYPE_STEPPED=Escalonado\nDISPLAYER_SUBTYPE_BAR=Barra\nDISPLAYER_SUBTYPE_BAR_STACKED=Barra apilada\nDISPLAYER_SUBTYPE_COLUMN=Columna\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Columna apilada\nDISPLAYER_SUBTYPE_HISTOGRAM=Histograma\nDISPLAYER_SUBTYPE_PIE=Circular\nDISPLAYER_SUBTYPE_PIE_3D=Circular 3D\nDISPLAYER_SUBTYPE_DONUT=Dona\nDISPLAYER_SUBTYPE_MAP_REGIONS=Mapa (Regiones)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Mapa (Marcadores)\nDISPLAYER_SUBTYPE_METRIC_CARD=Tarjeta de métrica\nDISPLAYER_SUBTYPE_METRIC_CARD2=Tarjeta de métrica 2\nDISPLAYER_SUBTYPE_METRIC_QUOTA=Cuota de métrica\nDISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT=Texto de métrica\nDISPLAYER_SUBTYPE_SELECTOR_DROPDOWN=Desplegar\nDISPLAYER_SUBTYPE_SELECTOR_LABELS=Conjunto de etiquetas\nDISPLAYER_SUBTYPE_SELECTOR_SLIDER=Control deslizante\n\n# Subtype selector tooltips\nBARCHART_BAR_tt=Gráfico de barras\nBARCHART_BAR_STACKED_tt=Gráfico de barras apiladas\nBARCHART_COLUMN_tt=Gráfico de columnas\nBARCHART_COLUMN_STACKED_tt=Gráfico de columnas apiladas\nPIECHART_PIE_tt=Gráfico circular\nPIECHART_PIE_3D_tt=Gráfico circular 3D\nPIECHART_DONUT_tt=Gráfico circular (dona)\nAREACHART_AREA_tt=Gráfico de área\nAREACHART_AREA_STACKED_tt=Gráfico de área apilada\nLINECHART_LINE_tt=Gráfico de líneas\nLINECHART_SMOOTH_tt=Gráfico de líneas suaves\nMAP_MAP_REGIONS_tt=Cuadro de mapa (regiones)\nMAP_MAP_MARKERS_tt=Cuadro de mapa (marcadores)\nBUBBLECHART_default_tt=Gráfico de burbujas\nMETERCHART_default_tt=Gráfico de medidor\nMETRIC_METRIC_CARD_tt=Tarjeta de métrica\nMETRIC_METRIC_CARD2_tt=Tarjeta de métrica 2\nMETRIC_METRIC_QUOTA_tt=Cuota de métrica\nMETRIC_METRIC_PLAIN_TEXT_tt=Texto de métrica\nTABLE_default_tt=Tabla\nEXTERNAL_COMPONENT_default_tt=Componente externo\nSELECTOR_SELECTOR_DROPDOWN_tt=Desplegar\nSELECTOR_SELECTOR_LABELS_tt=Conjunto de etiquetas\nSELECTOR_SELECTOR_SLIDER_tt=Control deslizante\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ndisplayer_type_selector_tab_bar=Barres\ndisplayer_type_selector_tab_pie=Secteurs\ndisplayer_type_selector_tab_line=Ligne\ndisplayer_type_selector_tab_area=Aires\ndisplayer_type_selector_tab_bubble=Bulles\ndisplayer_type_selector_tab_meter=Compteur\ndisplayer_type_selector_tab_metric=Métrique\ndisplayer_type_selector_tab_map=Carte\ndisplayer_type_selector_tab_table=Tableau\ndisplayer_type_selector_tab_selector=Sélecteur\n\n# Subtype enum literals\nDISPLAYER_SUBTYPE_LINE=Ligne\nDISPLAYER_SUBTYPE_SMOOTH=Lisse\nDISPLAYER_SUBTYPE_AREA=Aires\nDISPLAYER_SUBTYPE_STACKED=Empilé\nDISPLAYER_SUBTYPE_STEPPED=Paliers\nDISPLAYER_SUBTYPE_BAR=Barres\nDISPLAYER_SUBTYPE_BAR_STACKED=Barres empilées\nDISPLAYER_SUBTYPE_COLUMN=Colonne\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Colonnes empilées\nDISPLAYER_SUBTYPE_HISTOGRAM=Histogramme\nDISPLAYER_SUBTYPE_PIE=Secteurs\nDISPLAYER_SUBTYPE_PIE_3D=Secteurs 3D\nDISPLAYER_SUBTYPE_DONUT=Anneau\nDISPLAYER_SUBTYPE_MAP_REGIONS=Carte (régions)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Carte (marqueurs)\nDISPLAYER_SUBTYPE_METRIC_CARD=Carte métrique\nDISPLAYER_SUBTYPE_METRIC_CARD2=Carte métrique 2\nDISPLAYER_SUBTYPE_METRIC_QUOTA=Quota métrique\nDISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT=Texte métrique\nDISPLAYER_SUBTYPE_SELECTOR_DROPDOWN=Liste déroulante\nDISPLAYER_SUBTYPE_SELECTOR_LABELS=Jeu d''étiquettes\nDISPLAYER_SUBTYPE_SELECTOR_SLIDER=Curseur\n\n# Subtype selector tooltips\nBARCHART_BAR_tt=Graphique à barres\nBARCHART_BAR_STACKED_tt=Graphique à barres empilées\nBARCHART_COLUMN_tt=Histogramme\nBARCHART_COLUMN_STACKED_tt=Histogramme empilé\nPIECHART_PIE_tt=Graphique en secteurs\nPIECHART_PIE_3D_tt=Graphique en secteurs 3D\nPIECHART_DONUT_tt=Graphique en secteurs (anneau)\nAREACHART_AREA_tt=Graphique en aires\nAREACHART_AREA_STACKED_tt=Graphique en aires empilées\nLINECHART_LINE_tt=Graphique en courbes\nLINECHART_SMOOTH_tt=Graphique en courbes lisses\nMAP_MAP_REGIONS_tt=Graphique de carte (régions)\nMAP_MAP_MARKERS_tt=Graphique de carte (marqueurs)\nBUBBLECHART_default_tt=Graphique en bulles\nMETERCHART_default_tt=Graphique de mesure\nMETRIC_METRIC_CARD_tt=Carte métrique\nMETRIC_METRIC_CARD2_tt=Carte métrique 2\nMETRIC_METRIC_QUOTA_tt=Quota métrique\nMETRIC_METRIC_PLAIN_TEXT_tt=Texte métrique\nTABLE_default_tt=Tableau\nEXTERNAL_COMPONENT_default_tt=Composant externe\nSELECTOR_SELECTOR_DROPDOWN_tt=Liste déroulante\nSELECTOR_SELECTOR_LABELS_tt=Jeu d''étiquettes\nSELECTOR_SELECTOR_SLIDER_tt=Curseur\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ndisplayer_type_selector_tab_bar=Barra\ndisplayer_type_selector_tab_pie=Torta\ndisplayer_type_selector_tab_line=Linea\ndisplayer_type_selector_tab_area=Area\ndisplayer_type_selector_tab_bubble=Bolla\ndisplayer_type_selector_tab_meter=Contatore\ndisplayer_type_selector_tab_metric=Metrica\ndisplayer_type_selector_tab_map=Mappa\ndisplayer_type_selector_tab_table=Tabella\ndisplayer_type_selector_tab_selector=Selettore\n\n# Subtype enum literals\nDISPLAYER_SUBTYPE_LINE=Linea\nDISPLAYER_SUBTYPE_SMOOTH=Linea Smussata\nDISPLAYER_SUBTYPE_AREA=Area\nDISPLAYER_SUBTYPE_STACKED=Sovrapposta\nDISPLAYER_SUBTYPE_STEPPED=A tratti\nDISPLAYER_SUBTYPE_BAR=Barra\nDISPLAYER_SUBTYPE_BAR_STACKED=Barra Sovrapposta\nDISPLAYER_SUBTYPE_COLUMN=Colonna\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Colonna Sovrapposta\nDISPLAYER_SUBTYPE_HISTOGRAM=Istogramma\nDISPLAYER_SUBTYPE_PIE=Torta\nDISPLAYER_SUBTYPE_PIE_3D=Torta 3D\nDISPLAYER_SUBTYPE_DONUT=Ciambella\nDISPLAYER_SUBTYPE_MAP_REGIONS=Mappa (Regioni)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Mappa (Marcatori)\nDISPLAYER_SUBTYPE_METRIC_CARD=Scheda Metrica\nDISPLAYER_SUBTYPE_METRIC_CARD2=Scheda Metrica 2\nDISPLAYER_SUBTYPE_METRIC_QUOTA=Quota Metrica\nDISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT=Testo Metrica\nDISPLAYER_SUBTYPE_SELECTOR_DROPDOWN=Menu a Tendina\nDISPLAYER_SUBTYPE_SELECTOR_LABELS=Set di Etichette\nDISPLAYER_SUBTYPE_SELECTOR_SLIDER=Slider\n\n# Subtype selector tooltips\nBARCHART_BAR_tt=Grafico a Barre\nBARCHART_BAR_STACKED_tt=Grafico a Barre Sovrapposte\nBARCHART_COLUMN_tt=Grafico a Colonne\nBARCHART_COLUMN_STACKED_tt=Grafico a Colonne Sovrapposte\nPIECHART_PIE_tt=Grafico a Torta\nPIECHART_PIE_3D_tt=Grafico a Torta 3D\nPIECHART_DONUT_tt=Grafico a Torta (ciambella)\nAREACHART_AREA_tt=Grafico ad Area\nAREACHART_AREA_STACKED_tt=Grafico ad Area Sovrapposta\nLINECHART_LINE_tt=Grafico a Linee\nLINECHART_SMOOTH_tt=Grafico a Linee Smussate\nMAP_MAP_REGIONS_tt=Grafico Mappa (Regioni)\nMAP_MAP_MARKERS_tt=Grafico Mappa (Marcatori)\nBUBBLECHART_default_tt=Grafico a Bolle\nMETERCHART_default_tt=Grafico Contatore\nMETRIC_METRIC_CARD_tt=Scheda Metrica\nMETRIC_METRIC_CARD2_tt=Scheda Metrica 2\nMETRIC_METRIC_QUOTA_tt=Quota Metrica\nMETRIC_METRIC_PLAIN_TEXT_tt=Testo Metrica\nTABLE_default_tt=Tabella\nEXTERNAL_COMPONENT_default_tt=Componente Esterno\nSELECTOR_SELECTOR_DROPDOWN_tt=Menu a Tendina\nSELECTOR_SELECTOR_LABELS_tt=Set di Etichette\nSELECTOR_SELECTOR_SLIDER_tt=Slider\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\ndisplayer_type_selector_tab_bar=バー\ndisplayer_type_selector_tab_pie=円 (パイ)\ndisplayer_type_selector_tab_line=Line\ndisplayer_type_selector_tab_area=エリア\ndisplayer_type_selector_tab_bubble=バブル\ndisplayer_type_selector_tab_meter=メーター\ndisplayer_type_selector_tab_metric=メトリック\ndisplayer_type_selector_tab_map=マップ\ndisplayer_type_selector_tab_table=テーブル\ndisplayer_type_selector_tab_selector=セレクター\n\n# Subtype enum literals\nDISPLAYER_SUBTYPE_LINE=Line\nDISPLAYER_SUBTYPE_SMOOTH=スムーズ\nDISPLAYER_SUBTYPE_AREA=エリア\nDISPLAYER_SUBTYPE_STACKED=スタック\nDISPLAYER_SUBTYPE_STEPPED=階段状\nDISPLAYER_SUBTYPE_BAR=バー\nDISPLAYER_SUBTYPE_BAR_STACKED=スタックされたのバー\nDISPLAYER_SUBTYPE_COLUMN=カラム\nDISPLAYER_SUBTYPE_COLUMN_STACKED=スタックされた列\nDISPLAYER_SUBTYPE_HISTOGRAM=ヒストグラム\nDISPLAYER_SUBTYPE_PIE=円 (パイ)\nDISPLAYER_SUBTYPE_PIE_3D=3D の円 (パイ)\nDISPLAYER_SUBTYPE_DONUT=ドーナツ\nDISPLAYER_SUBTYPE_MAP_REGIONS=マップ (リージョン)\nDISPLAYER_SUBTYPE_MAP_MARKERS=マップ (マーカー)\nDISPLAYER_SUBTYPE_METRIC_CARD=メトリックカード\nDISPLAYER_SUBTYPE_METRIC_CARD2=メトリックカード 2\nDISPLAYER_SUBTYPE_METRIC_QUOTA=メトリッククォータ\nDISPLAYER_SUBTYPE_METRIC_PLAIN_TEXT=メトリックテキスト\nDISPLAYER_SUBTYPE_SELECTOR_DROPDOWN=ドロップダウン\nDISPLAYER_SUBTYPE_SELECTOR_LABELS=ラベルセット\nDISPLAYER_SUBTYPE_SELECTOR_SLIDER=スライダー\n\n# Subtype selector tooltips\nBARCHART_BAR_tt=棒グラフ\nBARCHART_BAR_STACKED_tt=スタック状の棒グラフ\nBARCHART_COLUMN_tt=コラムチャート\nBARCHART_COLUMN_STACKED_tt=スタック状のコラムチャート\nPIECHART_PIE_tt=円グラフ\nPIECHART_PIE_3D_tt=3D の円グラフ\nPIECHART_DONUT_tt=円グラフ (ドーナツ型)\nAREACHART_AREA_tt=エリアチャート\nAREACHART_AREA_STACKED_tt=スタック状のエリアチャート\nLINECHART_LINE_tt=折れ線グラフ\nLINECHART_SMOOTH_tt=平滑線グラフ\nMAP_MAP_REGIONS_tt=マップチャート (リージョン)\nMAP_MAP_MARKERS_tt=マップチャート (マーカー)\nBUBBLECHART_default_tt=バブルチャート\nMETERCHART_default_tt=メーターチャート\nMETRIC_METRIC_CARD_tt=メトリックカード\nMETRIC_METRIC_CARD2_tt=メトリックカード 2\nMETRIC_METRIC_QUOTA_tt=メトリッククォータ\nMETRIC_METRIC_PLAIN_TEXT_tt=メトリックテキスト\nTABLE_default_tt=テーブル\nEXTERNAL_COMPONENT_default_tt=外部コンポーネント\nSELECTOR_SELECTOR_DROPDOWN_tt=ドロップダウン\nSELECTOR_SELECTOR_LABELS_tt=ラベルセット\nSELECTOR_SELECTOR_SLIDER_tt=スライダー\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_pt_BR.properties",
    "content": "displayer_type_selector_tab_bar=Barra\ndisplayer_type_selector_tab_pie=Setor\ndisplayer_type_selector_tab_line=Linha\ndisplayer_type_selector_tab_area=Área\ndisplayer_type_selector_tab_bubble=Bolha\ndisplayer_type_selector_tab_meter=Medidor\ndisplayer_type_selector_tab_metric=Métrica\ndisplayer_type_selector_tab_map=Mapa\ndisplayer_type_selector_tab_table=Tabela\nDISPLAYER_SUBTYPE_LINE=Linha\nDISPLAYER_SUBTYPE_SMOOTH=Suave\nDISPLAYER_SUBTYPE_AREA=Área\nDISPLAYER_SUBTYPE_STACKED=Empilhada\nDISPLAYER_SUBTYPE_STEPPED=Nìvel\nDISPLAYER_SUBTYPE_BAR=Barra\nDISPLAYER_SUBTYPE_BAR_STACKED=Barra Empilhada\nDISPLAYER_SUBTYPE_COLUMN=Coluna\nDISPLAYER_SUBTYPE_COLUMN_STACKED=Coluna Empilhada\nDISPLAYER_SUBTYPE_HISTOGRAM=Histograma\nDISPLAYER_SUBTYPE_PIE=Setor\nDISPLAYER_SUBTYPE_PIE_3D=Setor 3D\nDISPLAYER_SUBTYPE_DONUT=Rosca\nDISPLAYER_SUBTYPE_MAP_REGIONS=Mapa (Regiões)\nDISPLAYER_SUBTYPE_MAP_MARKERS=Mapa (Marcadores)\nBARCHART_BAR_tt=Gráfico de Barra\nBARCHART_BAR_STACKED_tt=Gráfico de Barra Empilhada\nBARCHART_COLUMN_tt=Gráfico de Coluna\nBARCHART_COLUMN_STACKED_tt=Gráfico de Coluna Empilhada\nPIECHART_PIE_tt=Gráfico de Setor\nPIECHART_PIE_3D_tt=Gráfico de Setor 3D\nPIECHART_DONUT_tt=Gráfico de Setor (rosca)\nAREACHART_AREA_tt=Gráfico de Área\nAREACHART_AREA_STACKED_tt=Gráfico de Área Empilhada\nLINECHART_LINE_tt=Gráfico de Linha\nLINECHART_SMOOTH_tt=Gráfico de Linha Suave\nMAP_MAP_REGIONS_tt=Gráfico de Mapa (regiões)\nMAP_MAP_MARKERS_tt=Gráfico de Mapa (marcadores)\nBUBBLECHART_default_tt=Gráfico de Bolha\nMETERCHART_default_tt=Gráfico de Medidor\nTABLE_default_tt=Tabela\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/DisplayerTypeConstants_zh_CN.properties",
    "content": "displayer_type_selector_tab_bar=条形\ndisplayer_type_selector_tab_pie=饼\ndisplayer_type_selector_tab_line=折线\ndisplayer_type_selector_tab_area=面积\ndisplayer_type_selector_tab_bubble=气泡\ndisplayer_type_selector_tab_meter=仪表\ndisplayer_type_selector_tab_metric=度量\ndisplayer_type_selector_tab_map=映射\ndisplayer_type_selector_tab_table=图表\nDISPLAYER_SUBTYPE_LINE=折线\nDISPLAYER_SUBTYPE_SMOOTH=平滑\nDISPLAYER_SUBTYPE_AREA=面积\nDISPLAYER_SUBTYPE_STACKED=堆叠图\nDISPLAYER_SUBTYPE_STEPPED=递阶\nDISPLAYER_SUBTYPE_BAR=条形\nDISPLAYER_SUBTYPE_BAR_STACKED=条形堆叠图\nDISPLAYER_SUBTYPE_COLUMN=柱\nDISPLAYER_SUBTYPE_COLUMN_STACKED=柱状堆叠图\nDISPLAYER_SUBTYPE_HISTOGRAM=直方图\nDISPLAYER_SUBTYPE_PIE=饼状图\nDISPLAYER_SUBTYPE_PIE_3D=3D 饼状图\nDISPLAYER_SUBTYPE_DONUT=圈图\nDISPLAYER_SUBTYPE_MAP_REGIONS=映射（区域）\nDISPLAYER_SUBTYPE_MAP_MARKERS=映射（标记）\nBARCHART_BAR_tt=条形图\nBARCHART_BAR_STACKED_tt=堆叠条形图\nBARCHART_COLUMN_tt=柱状图\nBARCHART_COLUMN_STACKED_tt=堆叠柱状图\nPIECHART_PIE_tt=饼状图\nPIECHART_PIE_3D_tt=3D 饼状图\nPIECHART_DONUT_tt=饼状图（圈状）\nAREACHART_AREA_tt=面积图\nAREACHART_AREA_STACKED_tt=堆叠面积图\nLINECHART_LINE_tt=折线图\nLINECHART_SMOOTH_tt=平滑折线图\nMAP_MAP_REGIONS_tt=映射图（区域）\nMAP_MAP_MARKERS_tt=映射图（标记）\nBUBBLECHART_default_tt=气泡图\nMETERCHART_default_tt=仪表图\nTABLE_default_tt=图表\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Red\nCOLOR_SCHEME_BLUE=Blue\nCOLOR_SCHEME_GREEN=Green\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants_es.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rojo\nCOLOR_SCHEME_BLUE=Azul\nCOLOR_SCHEME_GREEN=Verde\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants_fr.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rouge\nCOLOR_SCHEME_BLUE=Bleu\nCOLOR_SCHEME_GREEN=Vert\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants_it.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=Rosso\nCOLOR_SCHEME_BLUE=Blu\nCOLOR_SCHEME_GREEN=Verde\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/MapColorSchemeConstants_ja.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# MapColorScheme enum literals\nCOLOR_SCHEME_RED=赤\nCOLOR_SCHEME_BLUE=青\nCOLOR_SCHEME_GREEN=緑\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# Position enum literals\nPOSITION_BOTTOM=Bottom\nPOSITION_TOP=Top\nPOSITION_LEFT=Left\nPOSITION_RIGHT=Right\nPOSITION_IN=In\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_de.properties",
    "content": "POSITION_BOTTOM=Unten\nPOSITION_TOP=Oben\nPOSITION_LEFT=Links\nPOSITION_RIGHT=Rechts\nPOSITION_IN=In\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_es.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# Position enum literals\nPOSITION_BOTTOM=Inferior\nPOSITION_TOP=Superior\nPOSITION_LEFT=Izquierda\nPOSITION_RIGHT=Derecha\nPOSITION_IN=En\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_fr.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# Position enum literals\nPOSITION_BOTTOM=Bas\nPOSITION_TOP=Haut\nPOSITION_LEFT=Gauche\nPOSITION_RIGHT=Droite\nPOSITION_IN=Dans\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_it.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# Position enum literals\nPOSITION_BOTTOM=Fondo\nPOSITION_TOP=Superiore\nPOSITION_LEFT=Sinistra\nPOSITION_RIGHT=Destra\nPOSITION_IN=Interno\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_ja.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# Position enum literals\nPOSITION_BOTTOM=下揃え\nPOSITION_TOP=上揃え\nPOSITION_LEFT=左揃え\nPOSITION_RIGHT=右揃え\nPOSITION_IN=In\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_pt_BR.properties",
    "content": "POSITION_BOTTOM=Inferior\nPOSITION_TOP=Superior\nPOSITION_LEFT=Esquerda\nPOSITION_RIGHT=Direita\nPOSITION_IN=Dentro\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/PositionConstants_zh_CN.properties",
    "content": "POSITION_BOTTOM=底部\nPOSITION_TOP=顶部\nPOSITION_LEFT=左\nPOSITION_RIGHT=右\nPOSITION_IN=内\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nadd_variable=Add variable\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nadd_variable=Agregar variable\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nadd_variable=Ajouter une variable\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nadd_variable=Aggiungi una variabile\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeEditorConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nadd_variable=変数を追加\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\njs_keyword_not_allowed=Not allowed: \"{0}\"\njs_variable_not_found=The variable {0} is not defined\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\njs_keyword_not_allowed=No está permitido: \"{0}\"\njs_variable_not_found=La variable {0} no está definida\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\njs_keyword_not_allowed=Non autorisé : \"{0}\"\njs_variable_not_found=La variable {0} n''est pas définie\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\njs_keyword_not_allowed=Non consentito: \"{0}\"\njs_variable_not_found=La variabile {0} non è definita\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/SourceCodeValidatorConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\njs_keyword_not_allowed=許可されていません:''{0}'' \njs_variable_not_found=変数 {0}は設定されていません\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/AbstractDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyListOf;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\nimport java.util.Date;\nimport java.text.SimpleDateFormat;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.client.AbstractDataSetTest;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.impl.DataColumnImpl;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatterRegistry;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class AbstractDisplayerTest extends AbstractDataSetTest {\n\n    @Mock\n    protected RendererManager rendererManager;\n\n    @Mock\n    protected RendererLibrary rendererLibrary;\n\n    @Mock\n    protected ValueFormatterRegistry formatterRegistry;\n\n    protected DisplayerLocator displayerLocator;\n\n    @Before\n    public void init() throws Exception {\n        super.init();\n\n        displayerLocator = new DisplayerLocator(clientServices,\n                clientDataSetManager,\n                rendererManager,\n                formatterRegistry);\n\n        when(rendererManager.getRendererForDisplayer(any(DisplayerSettings.class))).thenReturn(rendererLibrary);\n\n        doAnswer(mock ->  createNewDisplayer((DisplayerSettings) mock.getArguments()[0]))\n                .when(rendererLibrary).lookupDisplayer(any(DisplayerSettings.class));\n\n        doAnswer(mock -> createNewDisplayer((DisplayerSettings) mock.getArguments()[0]))\n                .when(rendererLibrary).lookupDisplayer(any(DisplayerSettings.class));\n\n        doAnswer(mock -> {\n            List<Displayer> displayerList = (List<Displayer>) mock.getArguments()[0];\n            for (Displayer displayer : displayerList) {\n                displayer.draw();\n            }\n            return null;\n        }).when(rendererLibrary).draw(anyListOf(Displayer.class));\n    }\n\n    public AbstractDisplayer createNewDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new DisplayerMock(mock(AbstractDisplayer.View.class), null), settings);\n    }\n    \n    public AbstractDisplayer createNewDisplayer(DisplayerSettings settings, boolean ignoreError) {\n        return initDisplayer(new DisplayerMock(mock(AbstractDisplayer.View.class), null, ignoreError), settings);\n    }\n\n    public <D extends AbstractDisplayer> D initDisplayer(D displayer, DisplayerSettings settings) {\n        displayer.setEvaluator(new DisplayerEvaluatorMock());\n        displayer.setFormatter(new DisplayerFormatterMock());\n        displayer.addListener(new AbstractDisplayerListener() {\n            public void onError(Displayer displayer, ClientRuntimeError error) {\n                throw new RuntimeException(error.getRootCause());\n            }\n        });\n        if (settings != null) {\n            displayer.setDisplayerSettings(settings);\n            displayer.setDataSetHandler(new DataSetHandlerImpl(clientServices, settings.getDataSetLookup()));\n        }\n        return displayer;\n    }\n    \n    @Test\n    public void callbackOnErrorTest() throws Exception {\n        DataSetHandler dataSetHandler = mock(DataSetHandler.class);\n        DisplayerSettings simpleSettings = DisplayerSettingsFactory.newTableSettings()\n        .dataset(EXPENSES)\n        .filterOn(true, false, true)\n        .buildSettings();\n        AbstractDisplayer simpleDisplayer = createNewDisplayer(simpleSettings, true);\n        \n        simpleDisplayer.listenerList = java.util.Collections.emptyList();\n        simpleDisplayer.setDataSetHandler(dataSetHandler);\n        simpleDisplayer.redraw();\n        assertTrue(simpleDisplayer.isDrawn());\n        \n        doAnswer((InvocationOnMock invocation) -> {\n            DataSetReadyCallback callback =  (DataSetReadyCallback) invocation.getArguments()[0];\n            callback.onError(new ClientRuntimeError(\"test\"));\n            return null;\n        }).when(dataSetHandler).lookupDataSet(any());\n        \n        simpleDisplayer.redraw();\n        assertTrue(!simpleDisplayer.isDrawn());\n    }\n    \n    @Test\n    public void testFormatValue() throws Exception {\n        DisplayerSettings simpleSettings = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .filterOn(true, false, true)\n                .buildSettings();\n        AbstractDisplayer simpleDisplayer = createNewDisplayer(simpleSettings, true);\n    \n        DataColumn dateColumn = new DataColumnImpl();\n        dateColumn.setId(\"proceesedDate\");\n        dateColumn.setColumnType(ColumnType.DATE);\n        Date date1= new SimpleDateFormat(\"dd/MM/yyyy\")\n                .parse(\"28/10/2020\");\n        dateColumn.setValues(Arrays.asList(date1));\n        assertEquals(\"Oct 28, 2020 00:00\", simpleDisplayer.formatValue(date1, dateColumn));\n        \n        DataColumn column = new DataColumnImpl();\n        column.setId(\"slaCompliance\");\n        column.setColumnType(ColumnType.NUMBER);\n        column.setValues(Arrays.asList(0));\n        assertEquals(\"0.00\", simpleDisplayer.formatValue(0, column));\n\n        DataColumn numberColumn = new DataColumnImpl();\n        numberColumn.setId(\"slaCompliance\");\n        numberColumn.setColumnType(ColumnType.NUMBER);\n        numberColumn.setValues(Arrays.asList(\"0\"));\n        assertEquals(\"0.00\", simpleDisplayer.formatValue(\"0\", numberColumn));\n    \n        DataColumn emptyNumberColumn = new DataColumnImpl();\n        emptyNumberColumn.setId(\"dataId\");\n        emptyNumberColumn.setColumnType(ColumnType.NUMBER);\n        emptyNumberColumn.setValues(Arrays.asList(\"\"));\n        assertEquals(\"\", simpleDisplayer.formatValue(\"\", emptyNumberColumn));\n        \n        DataColumn textColumn = new DataColumnImpl();\n        textColumn.setId(\"dataId\");\n        textColumn.setColumnType(ColumnType.TEXT);\n        textColumn.setValues(Arrays.asList(\"test\"));\n        assertEquals(\"test\", simpleDisplayer.formatValue(\"test\", textColumn));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerCoordinatorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.Date;\nimport java.util.List;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DisplayerCoordinatorTest extends AbstractDisplayerTest {\n\n    DisplayerSettings byDepartment = DisplayerSettingsFactory.newPieChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DEPARTMENT)\n            .column(COLUMN_DEPARTMENT)\n            .column(COLUMN_AMOUNT, SUM)\n            .sort(COLUMN_DEPARTMENT, SortOrder.ASCENDING)\n            .filterOn(false, true, true)\n            .buildSettings();\n\n    DisplayerSettings byDepartmentSelector = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DEPARTMENT)\n            .column(COLUMN_DEPARTMENT)\n            .column(COLUMN_AMOUNT, SUM)\n            .sort(COLUMN_DEPARTMENT, SortOrder.ASCENDING)\n            .filterOn(false, true, false)\n            .buildSettings();\n\n    DisplayerSettings byYear = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE).dynamic(DateIntervalType.YEAR, true)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, true)\n            .sort(COLUMN_DATE, SortOrder.ASCENDING)\n            .buildSettings();\n\n    DisplayerSettings byQuarter = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .filter(COLUMN_ID, FilterFactory.equalsTo(1))\n            .group(COLUMN_DATE).fixed(DateIntervalType.QUARTER, false)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, true)\n            .sort(COLUMN_DATE, SortOrder.ASCENDING)\n            .buildSettings();\n\n    DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_DEPARTMENT)\n            .column(COLUMN_CITY)\n            .column(COLUMN_EMPLOYEE)\n            .column(COLUMN_AMOUNT)\n            .column(COLUMN_DATE)\n            .filterOn(true, false, true)\n            .buildSettings();\n\n    DisplayerCoordinator displayerCoordinator;\n    AbstractDisplayer allRowsTable;\n    AbstractDisplayer deptPieChart;\n    AbstractDisplayer deptSelector;\n    AbstractDisplayer yearBarChart;\n    AbstractDisplayer quarterPieChart;\n\n    @Mock\n    DisplayerListener listener;\n\n    @Before\n    public void init() throws Exception {\n        super.init();\n\n        allRowsTable = createNewDisplayer(allRows);\n        deptPieChart = createNewDisplayer(byDepartment);\n        deptSelector = createNewDisplayer(byDepartmentSelector);\n        yearBarChart = createNewDisplayer(byYear);\n        quarterPieChart = createNewDisplayer(byQuarter);\n\n        displayerCoordinator = new DisplayerCoordinator(rendererManager);\n        displayerCoordinator.addDisplayers(allRowsTable, deptPieChart, deptSelector, yearBarChart, quarterPieChart);\n        displayerCoordinator.addListener(listener);\n    }\n\n    @Test\n    public void testDrawAll() {\n        displayerCoordinator.drawAll();\n\n        verify(listener, times(5)).onDataLookup(any(Displayer.class));\n        verify(listener, times(5)).onDraw(any(Displayer.class));\n    }\n\n    @Test\n    public void testFilterPropagations() {\n        displayerCoordinator.drawAll();\n\n        // Click on the \"Engineering\" slice\n        reset(listener);\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0);\n\n        // Check the allRowsTable receives the filter request\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 19);\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(allRowsTable);\n    }\n\n    @Test\n    public void testFilterReset() {\n        displayerCoordinator.drawAll();\n\n        // Click on a slice\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0);\n        List<Interval> deptIntervalList = deptPieChart.filterIntervals(COLUMN_DEPARTMENT);\n        assertEquals(deptIntervalList.size(), 1);\n        Interval deptInterval = deptIntervalList.get(0);\n\n        // Click on a selector entry different from the slice selected above\n        deptSelector.filterUpdate(COLUMN_DEPARTMENT, 1);\n\n        // Check the pie chart receives the selector filter request\n        DataSet dataSet = deptPieChart.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 1);\n        assertEquals(deptPieChart.filterIndexes(COLUMN_DEPARTMENT).size(), 1);\n\n        // Reset the pie chart filter\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, deptInterval.getIndex());\n        deptIntervalList = deptPieChart.filterIntervals(COLUMN_DEPARTMENT);\n        assertEquals(deptIntervalList.size(), 0);\n    }\n\n    @Test\n    public void testQuarterFilter() {\n        displayerCoordinator.drawAll();\n\n        // Click on the \"Q4\" slice\n        reset(listener);\n        quarterPieChart.filterUpdate(COLUMN_DATE, 0);\n\n        // Check the allRowsTable receives the filter request\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 10);\n        for (int i = 0; i < dataSet.getRowCount(); i++) {\n            Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE);\n            assertTrue(d.getMonth() > 8);\n        }\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(allRowsTable);\n    }\n\n    @Test\n    public void testYearFilter() {\n        displayerCoordinator.drawAll();\n\n        // Click on the \"2014\" slice\n        reset(listener);\n        yearBarChart.filterUpdate(COLUMN_DATE, 2);\n\n        // Check the allRowsTable receives the filter request\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 11);\n        for (int i = 0; i < dataSet.getRowCount(); i++) {\n            Date d = (Date) dataSet.getValueAt(i, COLUMN_DATE);\n            assertEquals(d.getYear(), 114);\n        }\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(allRowsTable);\n    }\n\n    @Test\n    public void testMultipleFilter() {\n        displayerCoordinator.drawAll();\n\n        // Click on the \"2014\" slice\n        yearBarChart.filterUpdate(COLUMN_DATE, 2);\n\n        // Click on the \"Sales\" slice\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 1);\n\n        // Check the allRowsTable receives all the filter requests\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 2);\n    }\n\n    @Test\n    public void testFilterUpdates() {\n        displayerCoordinator.drawAll();\n\n        // Filter by amount\n        DataSetFilter filterOp = new DataSetFilter();\n        CoreFunctionFilter columnFilter = new CoreFunctionFilter(COLUMN_AMOUNT, CoreFunctionType.BETWEEN, 1d, 1.2d);\n        filterOp.addFilterColumn(columnFilter);\n        yearBarChart.filterUpdate(filterOp);\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 1);\n\n        // Filter by a different range\n        filterOp = new DataSetFilter();\n        columnFilter = new CoreFunctionFilter(COLUMN_AMOUNT, CoreFunctionType.BETWEEN, 1000d, 2000d);\n        filterOp.addFilterColumn(columnFilter);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        allRowsTable.addListener(listener);\n        yearBarChart.filterUpdate(filterOp);\n        verify(listener).onRedraw(allRowsTable);\n        dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 2);\n    }\n\n    @Test\n    public void testFilterWithNull() {\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n\n        // Click on the \"Engineering\" slice\n        reset(listener);\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 1);\n\n        // Check the allRowsTable receives the filter request\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        verify(listener, never()).onError(any(Displayer.class), any(ClientRuntimeError.class));\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(allRowsTable);\n        assertEquals(dataSet.getRowCount(), 18);\n    }\n\n    /**\n     * Avoid IndexOutOfBoundsException caused when a filter is notified to\n     * a table consuming the whole data set (no data lookup columns set).\n     */\n    @Test\n    public void testFullTableFilterEvent() {\n\n        AbstractDisplayer tableNoColumns = createNewDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .filterOn(true, false, true)\n                .buildSettings());\n\n        displayerCoordinator = new DisplayerCoordinator(rendererManager);\n        displayerCoordinator.addDisplayers(deptPieChart, tableNoColumns);\n        displayerCoordinator.addListener(listener);\n        displayerCoordinator.drawAll();\n\n        // Click on the \"Engineering\" slice\n        reset(listener);\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0);\n\n        // Check the allRowsTable receives the filter request\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 19);\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(tableNoColumns);\n   }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerEvaluatorMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\npublic class DisplayerEvaluatorMock implements AbstractDisplayer.ExpressionEval {\n\n    @Override\n    public String evalExpression(String value, String expression) {\n        return value;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerExportTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DisplayerExportTest extends AbstractDisplayerTest {\n\n    DisplayerSettings EMPTY = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .filter(COLUMN_CITY, FilterFactory.isNull())\n            .buildSettings();\n\n    DisplayerSettings ALLROWS = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .buildSettings();\n\n    DisplayerSettings CUSTOM_NAMES = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_DEPARTMENT).format(\"Dept\")\n            .column(COLUMN_EMPLOYEE).format(\"Emp\")\n            .column(COLUMN_CITY).format(\"City\")\n            .column(COLUMN_DATE).format(\"Date\")\n            .column(COLUMN_AMOUNT).format(\"$\")\n            .buildSettings();\n\n    @Mock\n    ExportCallback exportCallback;\n\n    @Test\n    public void testExportDisplayer() {\n        Displayer displayer = displayerLocator.lookupDisplayer(ALLROWS);\n        displayer.draw();\n        displayer.export(ExportFormat.CSV, -1, exportCallback);\n\n        verify(exportCallback).exportFileUrl(any());\n    }\n\n    @Test\n    public void testExportNonDrawnDisplayer() {\n        Displayer displayer = displayerLocator.lookupDisplayer(ALLROWS);\n        displayer.export(ExportFormat.CSV, -1, exportCallback);\n\n        verify(exportCallback).noData();\n    }\n\n    @Test\n    public void testExportEmptyDisplayer() {\n        Displayer displayer = displayerLocator.lookupDisplayer(EMPTY);\n        displayer.draw();\n        displayer.export(ExportFormat.CSV, -1, exportCallback);\n\n        verify(exportCallback).noData();\n    }\n\n    @Test\n    public void testExportLimitExceeded() {\n        Displayer displayer = displayerLocator.lookupDisplayer(ALLROWS);\n        displayer.draw();\n        displayer.export(ExportFormat.CSV, 10, exportCallback);\n\n        verify(exportCallback).tooManyRows(50);\n    }\n\n    @Test\n    public void testExportLimitRuledOut() {\n        Displayer displayer = displayerLocator.lookupDisplayer(ALLROWS);\n        displayer.draw();\n        displayer.export(ExportFormat.CSV, 0, exportCallback);\n\n        verify(exportCallback, never()).tooManyRows(anyInt());\n        verify(exportCallback).exportFileUrl(any());\n    }\n\n    @Test\n    public void testDefaultNamesCsv() throws Exception {\n        testDefaultNames(ExportFormat.CSV);\n    }\n\n    @Test\n    public void testCustomNamesCsv() throws Exception {\n        testCustomNames(ExportFormat.CSV);\n    }\n\n    @Test\n    public void testDefaultNamesXls() throws Exception {\n        testDefaultNames(ExportFormat.XLS);\n    }\n\n    @Test\n    public void testCustomNamesXls() throws Exception {\n        testCustomNames(ExportFormat.XLS);\n    }\n\n    public void testDefaultNames(ExportFormat format) throws Exception {\n        Displayer displayer = displayerLocator.lookupDisplayer(ALLROWS);\n        displayer.draw();\n        displayer.export(format, 0, exportCallback);\n\n        ArgumentCaptor<DataSet> dataSetCaptor = ArgumentCaptor.forClass(DataSet.class);\n        if (ExportFormat.CSV.equals(format)) {\n            verify(dataSetExportServices).exportDataSetCSV(dataSetCaptor.capture());\n        } else {\n            verify(dataSetExportServices).exportDataSetExcel(dataSetCaptor.capture());\n        }\n\n        DataSet dataSet = dataSetCaptor.getValue();\n        assertEquals(dataSet.getColumns().size(), 6);\n        assertEquals(dataSet.getColumns().get(0).getId(), COLUMN_ID);\n        assertEquals(dataSet.getColumns().get(1).getId(), COLUMN_CITY);\n        assertEquals(dataSet.getColumns().get(2).getId(), COLUMN_DEPARTMENT);\n        assertEquals(dataSet.getColumns().get(3).getId(), COLUMN_EMPLOYEE);\n        assertEquals(dataSet.getColumns().get(4).getId(), COLUMN_DATE);\n        assertEquals(dataSet.getColumns().get(5).getId(), COLUMN_AMOUNT);\n    }\n\n    public void testCustomNames(ExportFormat format) throws Exception {\n        Displayer displayer = displayerLocator.lookupDisplayer(CUSTOM_NAMES);\n        displayer.draw();\n        displayer.export(format, 0, exportCallback);\n\n        ArgumentCaptor<DataSet> dataSetCaptor = ArgumentCaptor.forClass(DataSet.class);\n        if (ExportFormat.CSV.equals(format)) {\n            verify(dataSetExportServices).exportDataSetCSV(dataSetCaptor.capture());\n        } else {\n            verify(dataSetExportServices).exportDataSetExcel(dataSetCaptor.capture());\n        }\n\n        DataSet dataSet = dataSetCaptor.getValue();\n        assertEquals(dataSet.getColumns().size(), 5);\n        assertEquals(dataSet.getColumns().get(0).getId(), \"Dept\");\n        assertEquals(dataSet.getColumns().get(1).getId(), \"Emp\");\n        assertEquals(dataSet.getColumns().get(2).getId(), \"City\");\n        assertEquals(dataSet.getColumns().get(3).getId(), \"Date\");\n        assertEquals(dataSet.getColumns().get(4).getId(), \"$\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerFilterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DisplayerFilterTest extends AbstractDisplayerTest {\n\n    DisplayerSettings byDepartment = DisplayerSettingsFactory.newPieChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DEPARTMENT)\n            .column(COLUMN_DEPARTMENT)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, true)\n            .buildSettings();\n\n    DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .filterOn(true, false, true)\n            .sort(COLUMN_DEPARTMENT, SortOrder.ASCENDING)\n            .buildSettings();\n\n    @Test\n    public void testDrawRequired() {\n        AbstractDisplayer allRowsTable = (AbstractDisplayer) displayerLocator.lookupDisplayer(allRows);\n        allRowsTable.filterUpdate(COLUMN_DEPARTMENT, 0);\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertNull(dataSet);\n    }\n\n    @Test\n    public void testNotifications() {\n        AbstractDisplayer deptPieChart = (AbstractDisplayer) displayerLocator.lookupDisplayer(byDepartment);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        deptPieChart.addListener(listener);\n        deptPieChart.draw();\n\n        deptPieChart.filterUpdate(COLUMN_DEPARTMENT, 0);\n        verify(listener).onFilterEnabled(eq(deptPieChart), any(DataSetGroup.class));\n        verify(listener, never()).onRedraw(deptPieChart);\n\n        deptPieChart.filterReset();\n        verify(listener).onFilterReset(eq(deptPieChart), anyList());\n        verify(listener, never()).onRedraw(deptPieChart);\n    }\n\n    @Test\n    public void testDrillDown() {\n        AbstractDisplayer allRowsTable = (AbstractDisplayer) displayerLocator.lookupDisplayer(allRows);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        allRowsTable.addListener(listener);\n        allRowsTable.draw();\n\n        // Filter by \"Engineering\"\n        reset(listener);\n        allRowsTable.filterUpdate(COLUMN_DEPARTMENT, 0);\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 19);\n\n        verify(listener).onDataLookup(allRowsTable);\n        verify(listener).onRedraw(allRowsTable);\n    }\n\n    @Test\n    public void testFilterNotAllowed() {\n        AbstractDisplayer allRowsTable = (AbstractDisplayer) displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .filterOff(true)\n                .buildSettings());\n\n        DisplayerListener listener = mock(DisplayerListener.class);\n        allRowsTable.addListener(listener);\n        allRowsTable.draw();\n\n        reset(listener);\n        allRowsTable.filterUpdate(COLUMN_DEPARTMENT, 0);\n        DataSet dataSet = allRowsTable.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 50);\n        verify(listener, never()).onDataLookup(allRowsTable);\n        verify(listener, never()).onRedraw(allRowsTable);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerFormatterMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.text.DecimalFormat;\nimport java.text.ParseException;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\n\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\n\npublic class DisplayerFormatterMock implements AbstractDisplayer.Formatter {\n\n    @Override\n    public String formatMonth(Month month) {\n        return month.name();\n    }\n\n    @Override\n    public String formatDayOfWeek(DayOfWeek dayOfWeek) {\n        return dayOfWeek.name();\n    }\n\n    @Override\n    public String formatNumber(String pattern, Number n) {\n        DecimalFormat df = new DecimalFormat(pattern);\n        return df.format(n);\n    }\n\n    @Override\n    public Date parseDate(String pattern, String d) {\n        try {\n            SimpleDateFormat df = new SimpleDateFormat(pattern);\n            return df.parse(d);\n        } catch (ParseException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public String formatDate(String pattern, Date d) {\n        SimpleDateFormat df = new SimpleDateFormat(pattern);\n        return df.format(d);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerLifecycleTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.Assertions.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DisplayerLifecycleTest extends AbstractDisplayerTest {\n\n    DisplayerSettings settings = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"expenses\")\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, COUNT)\n            .column(COLUMN_AMOUNT, SUM)\n            .buildSettings();\n\n    @Mock\n    DisplayerListener listener;\n\n    @Test\n    public void testLookup() {\n        Displayer displayer = displayerLocator.lookupDisplayer(settings);\n        assertNotNull(displayer);\n        assertNotNull(displayer.getDataSetHandler());\n        assertNotNull(displayer.getDisplayerSettings());\n        assertEquals(displayer.getDisplayerSettings(), settings);\n    }\n\n    @Test\n    public void testDraw() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(settings);\n        AbstractDisplayer.View view = displayer.getView();\n        displayer.addListener(listener);\n\n        assertEquals(displayer.isDrawn(), false);\n        displayer.draw();\n        assertEquals(displayer.isDrawn(), true);\n\n        verify(view).showLoading();\n        verify(view).setId(\"expenses\");\n\n        verify(listener).onDataLookup(displayer);\n        verify(listener).onDataLoaded(displayer);\n        verify(listener).onDraw(displayer);\n        verify(listener, never()).onRedraw(displayer);\n\n        assertDataSetValues(displayer.getDataSetHandler().getLastDataSet(), new String[][]{\n                {\"2012\", \"13.00\", \"6,126.13\"},\n                {\"2013\", \"11.00\", \"5,252.96\"},\n                {\"2014\", \"11.00\", \"4,015.48\"},\n                {\"2015\", \"15.00\", \"7,336.69\"}\n        }, 0);\n    }\n\n    @Test\n    public void testRedraw() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(settings);\n        AbstractDisplayer.View view = displayer.getView();\n        displayer.addListener(listener);\n        displayer.draw();\n\n        reset(view);\n        reset(listener);\n        assertEquals(displayer.isDrawn(), true);\n        displayer.redraw();\n        assertEquals(displayer.isDrawn(), true);\n\n        verify(listener).onDataLookup(displayer);\n        verify(listener).onRedraw(displayer);\n        verify(listener, never()).onDraw(displayer);\n        verify(view, never()).showLoading();\n\n        assertDataSetValues(displayer.getDataSetHandler().getLastDataSet(), new String[][]{\n                {\"2012\", \"13.00\", \"6,126.13\"},\n                {\"2013\", \"11.00\", \"5,252.96\"},\n                {\"2014\", \"11.00\", \"4,015.48\"},\n                {\"2015\", \"15.00\", \"7,336.69\"}\n        }, 0);\n    }\n\n    @Test\n    public void testClose() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(settings);\n        AbstractDisplayer.View view = displayer.getView();\n        displayer.addListener(listener);\n        displayer.close();\n\n        verify(view).clear();\n        verify(listener).onClose(displayer);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\npublic class DisplayerMock extends AbstractDisplayer<AbstractDisplayer.View> {\n\n    private AbstractDisplayer.View view;\n    private DisplayerConstraints constraints;\n    private boolean ignoreError;\n\n    public DisplayerMock(AbstractDisplayer.View view, DisplayerConstraints constraints) {\n        this.view = view;\n        this.constraints = constraints;\n    }\n    \n    public DisplayerMock(AbstractDisplayer.View view, DisplayerConstraints constraints, boolean ignoreError) {\n        this.view = view;\n        this.constraints = constraints;\n        this.ignoreError = ignoreError;\n    }\n\n    @Override\n    public AbstractDisplayer.View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        return constraints;\n    }\n\n    @Override\n    protected void createVisualization() {\n        // Mock\n    }\n\n    @Override\n    protected void updateVisualization() {\n        // Mock\n    }\n\n    @Override\n    public void handleError(ClientRuntimeError error) {\n        super.handleError(error);\n        if (! ignoreError) {\n            throw new RuntimeException(error.getRootCause());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/DisplayerRefreshTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DisplayerRefreshTest extends AbstractDisplayerTest {\n\n    @Test\n    public void testRefreshEnabled() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(EXPENSES)\n                        .refreshOn(10, false)\n                        .buildSettings()\n        );\n        displayer.draw();\n        assertEquals(displayer.isRefreshOn(), true);\n        verify(displayer.getView()).enableRefreshTimer(10);\n        verify(displayer.getView(), never()).cancelRefreshTimer();\n    }\n\n    @Test\n    public void testRefreshDisabled() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(EXPENSES)\n                        .refreshOff()\n                        .buildSettings()\n        );\n        displayer.draw();\n        assertEquals(displayer.isRefreshOn(), true);\n        verify(displayer.getView()).cancelRefreshTimer();\n        verify(displayer.getView(), never()).enableRefreshTimer(anyInt());\n    }\n\n    @Test\n    public void testSwitchRefreshOff() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(EXPENSES)\n                        .refreshOn(10, false)\n                        .buildSettings()\n        );\n        // Draw is always required ion order to switch refresh on\n        displayer.draw();\n\n        // Switch off\n        reset(displayer.getView());\n        displayer.setRefreshOn(false);\n        assertEquals(displayer.isRefreshOn(), false);\n        verify(displayer.getView()).cancelRefreshTimer();\n    }\n\n    @Test\n    public void testSwitchRefreshOn() {\n        AbstractDisplayer displayer = (AbstractDisplayer) displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(EXPENSES)\n                        .refreshOn(10, false)\n                        .buildSettings()\n        );\n        // Refresh enabled on draw\n        AbstractDisplayer.View view = displayer.getView();\n        displayer.draw();\n        verify(view).enableRefreshTimer(10);\n\n        // Already on, nothing happens\n        reset(view);\n        displayer.setRefreshOn(true);\n        verify(view, never()).enableRefreshTimer(anyInt());\n        verify(view, never()).cancelRefreshTimer();\n   }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/RendererManagerTest.java",
    "content": "package org.dashbuilder.displayer.client;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.dashbuilder.renderer.service.RendererSettingsService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\nimport static org.dashbuilder.displayer.DisplayerType.*;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.*;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.CallerMock;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RendererManagerTest {\n\n    private static final String REND2_NAME = \"renderer 2\";\n\n    private static final String REND1_NAME = \"renderer 1\";\n\n    private static final String REND2_UUID = \"rend2\";\n\n    private static final String REND1_UUID = \"rend1\";\n    \n    private static final String DEFAULT_REND_FOR_BARCHART_UUID = REND1_UUID;\n\n    @Mock\n    SyncBeanManager beanManager;\n    \n    @Mock\n    DisplayerSettings displayerSettings;\n    \n    @Mock\n    RendererSettingsService rendererSettingsService;\n    \n    @Mock\n    RendererSettings rendererSettings;\n    \n    Caller<RendererSettingsService> rendererSettingsServiceCaller;\n    \n    RendererManager rendererManager;\n    \n    int totalBeans;\n    \n    \n    @Before\n    public void setUp() {\n        rendererSettingsServiceCaller = new CallerMock<>(rendererSettingsService);\n        when(rendererSettingsService.getSettings()).thenReturn(rendererSettings);\n        rendererManager = new RendererManager(beanManager, rendererSettingsServiceCaller);\n        mockConstants();\n        Map<DisplayerType, List<DisplayerSubType>> typesAndSubTypes1 = new HashMap<>();\n        typesAndSubTypes1.put(BARCHART, Arrays.asList(BAR));\n        typesAndSubTypes1.put(AREACHART, Arrays.asList(AREA));\n        typesAndSubTypes1.put(LINECHART, Arrays.asList(LINE));\n        \n        Map<DisplayerType, List<DisplayerSubType>> typesAndSubTypes2 = new HashMap<>();\n        typesAndSubTypes2.put(LINECHART, Arrays.asList(LINE, SMOOTH));\n        typesAndSubTypes2.put(BARCHART, Arrays.asList(BAR, BAR_STACKED));\n        \n        List<SyncBeanDef<RendererLibrary>> rendererLibrariesBeans = Arrays.asList(\n                mockSyncBeanForRendererLib(REND1_NAME, REND1_UUID, Arrays.asList(BARCHART, AREACHART), typesAndSubTypes1, true),\n                mockSyncBeanForRendererLib(REND2_NAME, REND2_UUID,  Collections.emptyList(), typesAndSubTypes2, false)\n        );\n        totalBeans = rendererLibrariesBeans.size();\n        when(beanManager.lookupBeans(RendererLibrary.class))\n                        .thenReturn(rendererLibrariesBeans);\n        rendererManager.init();\n    }\n\n    @Test\n    public void renderersForType2Test() {\n        List<RendererLibrary> renderersForType = rendererManager.getRenderersForType(null, null);\n        assertEquals(totalBeans, renderersForType.size());\n        renderersForType = rendererManager.getRenderersForType(BARCHART, null);\n        assertEquals(2, renderersForType.size());\n        renderersForType = rendererManager.getRenderersForType(AREACHART, AREA);\n        assertEquals(1, renderersForType.size());\n        renderersForType = rendererManager.getRenderersForType(BARCHART, BAR);\n        assertEquals(2, renderersForType.size());\n        renderersForType = rendererManager.getRenderersForType(MAP, null);\n        assertEquals(0, renderersForType.size());\n        renderersForType = rendererManager.getRenderersForType(MAP, MAP_REGIONS);\n        assertEquals(0, renderersForType.size());\n    }\n    \n    @Test\n    public void renderersForType2SubTypesTest() {\n        List<RendererLibrary> renderersForSubType = rendererManager.getRenderersForType(null, AREA);\n        assertEquals(1, renderersForSubType.size());\n        renderersForSubType = rendererManager.getRenderersForType(null, LINE);\n        assertEquals(2, renderersForSubType.size());\n        renderersForSubType = rendererManager.getRenderersForType(null, MAP_REGIONS);\n        assertEquals(0, renderersForSubType.size());        \n        \n    }\n\n    @Test\n    public void rendererForTypeTest() {\n        List<RendererLibrary> renderers = rendererManager.getRenderers();\n        assertEquals(totalBeans, renderers.size());\n        assertEquals(2, rendererManager.getRenderersForType(BARCHART).size());\n        assertEquals(1, rendererManager.getRenderersForType(AREACHART).size());\n    }\n    \n    @Test\n    public void rendererForSubTypeTest() {\n        assertEquals(2, rendererManager.getRenderersForType(BARCHART).size());\n        assertEquals(1, rendererManager.getRenderersForType(AREACHART).size());\n    }\n     \n    @Test\n    public void rendererByNameTest() {\n        assertNotNull(rendererManager.getRendererByName(REND1_NAME));\n    }\n    \n    @Test(expected=RuntimeException.class)\n    public void rendererByNameNotFoundTest() {\n        assertNotNull(rendererManager.getRendererByName(\"NO NAME\"));\n    }\n    \n    @Test\n    public void rendererByUUIDTest() {\n        assertNotNull(rendererManager.getRendererByUUID(REND1_UUID));\n    }\n    \n    @Test(expected=RuntimeException.class)\n    public void rendererByUUIDNotFoundTest() {\n        assertNotNull(rendererManager.getRendererByUUID(\"NO UUID\"));\n    }\n    \n    @Test\n    public void typeSupportedTest() {\n        assertTrue(rendererManager.isTypeSupported(BARCHART));\n        assertTrue(!rendererManager.isTypeSupported(MAP));\n    }\n    \n    \n    @Test\n    public void rendererByDisplayerTest() {\n        DisplayerSettings settings = mock(DisplayerSettings.class);\n        when(settings.getRenderer()).thenReturn(REND1_UUID);\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(BAR);\n        RendererLibrary lib = rendererManager.getRendererForDisplayer(settings);\n        assertNotNull(lib);\n        assertEquals(REND1_UUID, lib.getUUID());\n    }\n    \n    @Test\n    public void rendererByDisplayerWithoutUUIDTest() {\n        DisplayerSettings settings = mock(DisplayerSettings.class);\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(BAR);\n        RendererLibrary lib = rendererManager.getRendererForDisplayer(settings);\n        assertNotNull(lib);\n        assertEquals(DEFAULT_REND_FOR_BARCHART_UUID, lib.getUUID());\n    }\n    \n    @Test(expected=RuntimeException.class)\n    public void rendererByDisplayerTypeNotSupportedTest() {\n        DisplayerSettings settings = mock(DisplayerSettings.class);\n        when(settings.getType()).thenReturn(MAP);\n        when(settings.getSubtype()).thenReturn(MAP_MARKERS);\n        rendererManager.getRendererForDisplayer(settings);\n    }\n    \n    @Test\n    public void defaultRendererTest() {\n        assertNotNull(rendererManager.getDefaultRenderer(BARCHART));\n        assertNull(rendererManager.getDefaultRenderer(LINECHART));\n    }\n    \n    @Test\n    public void defaultRendererSetByUserTest() {\n        when(rendererSettings.getDefaultRenderer()).thenReturn(REND2_UUID);\n        rendererManager.init();\n        RendererLibrary barChartDefaultRenderer = rendererManager.getDefaultRenderer(BARCHART);\n        RendererLibrary areaChartDefaultRenderer = rendererManager.getDefaultRenderer(AREACHART);\n        RendererLibrary lineChartDefaultRenderer = rendererManager.getDefaultRenderer(LINECHART);\n        assertEquals(REND2_UUID, barChartDefaultRenderer.getUUID());\n        assertNotNull(barChartDefaultRenderer);\n        // now rend 2 becomes also default renderer for LINECHART, so it is not null\n        assertNotNull(lineChartDefaultRenderer);\n        // since rend 2 does not support areachart, so rend1 should still be the default renderer for it\n        assertNotNull(areaChartDefaultRenderer);\n        assertEquals(REND1_UUID, areaChartDefaultRenderer.getUUID());\n    }\n    \n    @Test\n    public void defaultRendererWithUserBadSettingTest() {\n        when(rendererSettings.getDefaultRenderer()).thenReturn(\"DO NO EXIST\");\n        rendererManager.init();\n        defaultRendererTest();\n    }\n    \n    @Test\n    public void offlineRendererTest() {\n        when(rendererSettings.isOffline()).thenReturn(true);\n        rendererManager.init();\n        assertEquals(1, rendererManager.getRenderers().size());\n    }\n    \n    private SyncBeanDef<RendererLibrary> mockSyncBeanForRendererLib(String name,\n                                                                    String uuid,\n                                                                    List<DisplayerType> defaultTypes,\n                                                                    Map<DisplayerType, List<DisplayerSubType>> typesAndSubTypes,\n                                                                    boolean offline) {\n        SyncBeanDef<RendererLibrary> libBean = mock(SyncBeanDef.class);\n        RendererLibrary lib = mock(RendererLibrary.class);\n        when(lib.getName()).thenReturn(name);\n        when(lib.getUUID()).thenReturn(uuid);\n        when(lib.isOffline()).thenReturn(offline);\n        List<DisplayerType> supportedTypesList = typesAndSubTypes.keySet().stream().collect(Collectors.toList());\n        when(lib.getSupportedTypes()).thenReturn(supportedTypesList);\n        typesAndSubTypes.forEach((type, subTypes) -> when(lib.getSupportedSubtypes(type)).thenReturn(subTypes));\n        defaultTypes.forEach(type -> when(lib.isDefault(type)).thenReturn(true));\n        when(libBean.getInstance()).thenReturn(lib);\n        return libBean;\n    }    \n  \n    \n    private void mockConstants() {\n        rendererManager.i18n = mock(CommonConstants.class,\n                                    (Answer) invocation -> {\n                                            return RETURNS_DEFAULTS.answer(invocation);\n                                    });\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/component/ExternalComponentDispatcherTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.component;\n\nimport java.util.HashSet;\nimport java.util.Optional;\nimport java.util.function.Consumer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.displayer.client.component.function.ComponentFunctionLocator;\nimport org.dashbuilder.displayer.client.resources.i18n.CommonConstants;\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageType;\nimport org.dashbuilder.displayer.external.ExternalFilterRequest;\nimport org.dashbuilder.displayer.external.FunctionCallRequest;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\n\nimport static java.util.Optional.empty;\nimport static java.util.Optional.of;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExternalComponentDispatcherTest {\n\n    private static final String DEST1 = \"DEST1\";\n\n    @Mock\n    ExternalComponentMessageHelper messageHelper;\n\n    @Mock\n    ComponentFunctionLocator functionLocator;\n\n    @Mock\n    ExternalComponentListener listener;\n\n    @InjectMocks\n    ExternalComponentDispatcher dispatcher;\n\n    @Captor\n    ArgumentCaptor<Consumer<Object>> functionExecutionCaptor;\n\n    @Before\n    public void setup() {\n        dispatcher.listeners = new HashSet<>();\n        when(listener.getId()).thenReturn(DEST1);\n        dispatcher.register(listener);\n    }\n\n    @Test\n    public void testFilterWithoutFilterRequest() {\n        ExternalComponentMessage message = filterMessage();\n        withId(message, Optional.of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(listener, times(0)).onFilter(any());\n    }\n\n    @Test\n    public void testFilterWithoutDestination() {\n        ExternalComponentMessage message = filterMessage();\n        noId(message);\n\n        dispatcher.onMessage(message);\n\n        verify(listener, times(0)).onFilter(any());\n    }\n\n    @Test\n    public void testFilter() {\n        ExternalFilterRequest filterRequest = mock(ExternalFilterRequest.class);\n        Optional<ExternalFilterRequest> filterRequestOp = Optional.of(filterRequest);\n        ExternalComponentMessage message = filterMessage(filterRequestOp);\n\n        withId(message, Optional.of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(listener).onFilter(eq(filterRequest));\n    }\n\n    @Test\n    public void testFunctionCallWithoutDestination() {\n        ExternalComponentMessage message = functionCallMessage();\n        noId(message);\n\n        dispatcher.onMessage(message);\n\n        verify(functionLocator, times(0)).findFunctionByName(any());\n    }\n\n    @Test\n    public void testFunctionCallWithoutRequest() {\n        ExternalComponentMessage message = functionCallMessage();\n        ExternalComponentMessage noRequestMessage = mock(ExternalComponentMessage.class);\n\n        when(messageHelper.newFunctionRequestNotFound()).thenReturn(noRequestMessage);\n        withId(message, of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(functionLocator, times(0)).findFunctionByName(any());\n        verify(messageHelper).functionCallRequest(eq(message));\n        verify(listener).sendMessage(noRequestMessage);\n    }\n\n    @Test\n    public void testFunctionCallFunctionNotFound() {\n        FunctionCallRequest callRequest = mock(FunctionCallRequest.class);\n        Optional<FunctionCallRequest> callRequestOp = Optional.of(callRequest);\n        ExternalComponentMessage message = functionCallMessage(callRequestOp);\n        ExternalComponentMessage functionNotFoundMessage = mock(ExternalComponentMessage.class);\n        String functionName = \"f1\";\n\n        when(callRequest.getFunctionName()).thenReturn(functionName);\n        when(messageHelper.newFunctionNotFound(eq(callRequest))).thenReturn(functionNotFoundMessage);\n        when(functionLocator.findFunctionByName(eq(functionName))).thenReturn(empty());\n        withId(message, of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(messageHelper).functionCallRequest(eq(message));\n        verify(functionLocator).findFunctionByName(eq(functionName));\n        verify(listener).sendMessage(functionNotFoundMessage);\n    }\n\n    @Test\n    public void testFunctionCallError() {\n        ExternalComponentFunction function = mock(ExternalComponentFunction.class);\n        FunctionCallRequest callRequest = mock(FunctionCallRequest.class);\n        Optional<FunctionCallRequest> callRequestOp = Optional.of(callRequest);\n        ExternalComponentMessage message = functionCallMessage(callRequestOp);\n        ExternalComponentMessage functionErrorMessage = mock(ExternalComponentMessage.class);\n        String functionName = \"f1\";\n        String functionError = \"error\";\n\n        Mockito.doThrow(new RuntimeException(functionError)).when(function).exec(any(), any(), any());\n        when(callRequest.getFunctionName()).thenReturn(functionName);\n        when(messageHelper.newFunctionError(eq(callRequest), eq(functionError))).thenReturn(functionErrorMessage);\n        when(functionLocator.findFunctionByName(eq(functionName))).thenReturn(Optional.of(function));\n\n        withId(message, of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(messageHelper).functionCallRequest(eq(message));\n        verify(functionLocator).findFunctionByName(eq(functionName));\n        verify(function).exec(any(), any(), any());\n        verify(listener).sendMessage(functionErrorMessage);\n    }\n\n    @Test\n    public void testFunctionCallSuccess() {\n        ExternalComponentFunction function = mock(ExternalComponentFunction.class);\n        FunctionCallRequest callRequest = mock(FunctionCallRequest.class);\n        Optional<FunctionCallRequest> callRequestOp = Optional.of(callRequest);\n        ExternalComponentMessage message = functionCallMessage(callRequestOp);\n        ExternalComponentMessage functionSuccessMessage = mock(ExternalComponentMessage.class);\n        String functionName = \"f1\";\n\n        String result = \"success\";\n        when(callRequest.getFunctionName()).thenReturn(functionName);\n        when(messageHelper.newFunctionSuccess(eq(callRequest), eq(result))).thenReturn(functionSuccessMessage);\n        when(functionLocator.findFunctionByName(eq(functionName))).thenReturn(Optional.of(function));\n\n        withId(message, of(DEST1));\n\n        dispatcher.onMessage(message);\n\n        verify(messageHelper).functionCallRequest(eq(message));\n        verify(functionLocator).findFunctionByName(eq(functionName));\n        verify(function).exec(any(), functionExecutionCaptor.capture(), any());\n\n        functionExecutionCaptor.getValue().accept(result);\n\n        verify(messageHelper).newFunctionSuccess(eq(callRequest), eq(result));\n        verify(listener).sendMessage(eq(functionSuccessMessage));\n    }\n\n    @Test\n    public void testFixConfigurationWithoutMessage() {\n        ExternalComponentMessage configurationIssueMsg = mock(ExternalComponentMessage.class);\n        withId(configurationIssueMsg, Optional.of(DEST1));\n\n        when(messageHelper.messageType(eq(configurationIssueMsg))).thenReturn(ExternalComponentMessageType.FIX_CONFIGURATION);\n        when(messageHelper.getConfigurationIssue(eq(configurationIssueMsg))).thenReturn(empty());\n\n        dispatcher.onMessage(configurationIssueMsg);\n\n        verify(listener).onConfigurationIssue(CommonConstants.INSTANCE.componentConfigDefaultMessage());\n    }\n\n    @Test\n    public void testFixConfigurationWithMessage() {\n        ExternalComponentMessage configurationIssueMsg = mock(ExternalComponentMessage.class);\n        String configurationMessage = \"config error\";\n\n        withId(configurationIssueMsg, Optional.of(DEST1));\n        when(messageHelper.messageType(eq(configurationIssueMsg))).thenReturn(ExternalComponentMessageType.FIX_CONFIGURATION);\n        when(messageHelper.getConfigurationIssue(eq(configurationIssueMsg))).thenReturn(Optional.of(configurationMessage));\n\n        dispatcher.onMessage(configurationIssueMsg);\n\n        verify(listener).onConfigurationIssue(configurationMessage);\n    }\n\n    @Test\n    public void testOkConfigurationWithMessage() {\n        ExternalComponentMessage configurationOkMsg = mock(ExternalComponentMessage.class);\n\n        withId(configurationOkMsg, Optional.of(DEST1));\n        when(messageHelper.messageType(eq(configurationOkMsg))).thenReturn(ExternalComponentMessageType.CONFIGURATION_OK);\n\n        dispatcher.onMessage(configurationOkMsg);\n\n        verify(listener).configurationOk();\n    }\n\n    private void noId(ExternalComponentMessage message) {\n        withId(message, empty());\n    }\n\n    private ExternalComponentMessage filterMessage() {\n        return filterMessage(empty());\n    }\n\n    private ExternalComponentMessage functionCallMessage() {\n        return functionCallMessage(empty());\n    }\n\n    private void withId(ExternalComponentMessage message, Optional<String> id) {\n        when(messageHelper.getComponentId(eq(message))).thenReturn(id);\n    }\n\n    private ExternalComponentMessage filterMessage(Optional<ExternalFilterRequest> filterRequestOp) {\n        ExternalComponentMessage message = Mockito.mock(ExternalComponentMessage.class);\n        when(messageHelper.messageType(eq(message))).thenReturn(ExternalComponentMessageType.FILTER);\n        when(messageHelper.filterRequest(eq(message))).thenReturn(filterRequestOp);\n        return message;\n    }\n\n    private ExternalComponentMessage functionCallMessage(Optional<FunctionCallRequest> callRequestOp) {\n        ExternalComponentMessage message = Mockito.mock(ExternalComponentMessage.class);\n        when(messageHelper.messageType(eq(message))).thenReturn(ExternalComponentMessageType.FUNCTION_CALL);\n        when(messageHelper.functionCallRequest(eq(message))).thenReturn(callRequestOp);\n        return message;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/component/function/ComponentFunctionLocatorTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.component.function;\n\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport org.dashbuilder.displayer.external.ExternalComponentFunction;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class ComponentFunctionLocatorTest {\n\n    private final String F1_NAME = \"f1\";\n    private ExternalComponentFunction f1;\n    private ComponentFunctionLocator locator;\n\n    @Before\n    public void prepare() {\n        locator = new ComponentFunctionLocator();\n        f1 = mock(ExternalComponentFunction.class);\n        when(f1.getName()).thenReturn(F1_NAME);\n        locator.functions = Collections.singletonList(f1);\n    }\n\n    @Test\n    public void testFindFunctionByName() {\n        Optional<ExternalComponentFunction> result = locator.findFunctionByName(F1_NAME);\n        assertEquals(f1, result.get());\n    }\n\n    @Test\n    public void testFindFunctionByNameNotFound() {\n        Optional<ExternalComponentFunction> result = locator.findFunctionByName(\"not found\");\n        assertFalse(result.isPresent());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DataSetLookupEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.DataSetLookupFactory;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetMetadataCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefFactory;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.dataset.impl.DataSetMetadataImpl;\nimport org.dashbuilder.displayer.client.events.DataSetLookupChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionDeletedEvent;\nimport org.dashbuilder.displayer.client.widgets.filter.DataSetFilterEditor;\nimport org.dashbuilder.displayer.client.widgets.group.ColumnFunctionEditor;\nimport org.dashbuilder.displayer.client.widgets.group.DataSetGroupDateEditor;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\n\nimport static org.dashbuilder.dataset.filter.FilterFactory.*;\nimport static org.dashbuilder.dataset.ColumnType.*;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetLookupEditorTest {\n\n    public static final String POPULATION_UUID = \"population\";\n\n    public static final String REVENUE_UUID = \"revenue\";\n\n    public static final DataSetDef POPULATION_DSET = DataSetDefFactory.newStaticDataSetDef()\n            .uuid(POPULATION_UUID)\n            .name(\"Population\")\n            .label(\"continent\")\n            .label(\"country\")\n            .number(\"population\")\n            .date(\"year\")\n            .buildDef();\n\n    public static final DataSetDef REVENUE_DSET = DataSetDefFactory.newStaticDataSetDef()\n            .uuid(REVENUE_UUID)\n            .name(\"Revenue\")\n            .label(\"company\")\n            .label(\"sector\")\n            .number(\"revenue\")\n            .date(\"year\")\n            .buildDef();\n\n    public static final List<DataSetDef> DATA_SET_LIST = Arrays.asList(POPULATION_DSET, REVENUE_DSET);\n\n    public static final DataSetMetadata POPULATION_META = new DataSetMetadataImpl(\n            POPULATION_DSET, POPULATION_UUID, 0, 4,\n            Arrays.asList(\"continent\", \"country\", \"population\", \"year\"),\n            Arrays.asList(LABEL, LABEL, NUMBER, DATE), 0);\n\n    public static final DataSetMetadata REVENUE_META = new DataSetMetadataImpl(\n            POPULATION_DSET, REVENUE_UUID, 0, 4,\n            Arrays.asList(\"company\", \"sector\", \"revenue\", \"year\"),\n            Arrays.asList(LABEL, LABEL, NUMBER, DATE), 0);\n\n    public static final DataSetLookupConstraints DATA_2D_MULTIPLE = new DataSetLookupConstraints()\n            .setGroupRequired(true)\n            .setGroupColumn(true)\n            .setMaxColumns(10)\n            .setMinColumns(2)\n            .setExtraColumnsAllowed(true)\n            .setExtraColumnsType(ColumnType.NUMBER)\n            .setGroupsTitle(\"Categories\")\n            .setColumnsTitle(\"Series\")\n            .setColumnTypes(new ColumnType[]{\n                    LABEL,\n                    NUMBER});\n\n    public static final DataSetLookupConstraints DATA_2D_FIXED = new DataSetLookupConstraints()\n            .setGroupRequired(true)\n            .setGroupColumn(true)\n            .setMaxColumns(2)\n            .setMinColumns(2)\n            .setExtraColumnsAllowed(false)\n            .setGroupsTitle(\"Categories\")\n            .setColumnsTitle(\"Series\")\n            .setColumnTypes(new ColumnType[]{\n                    LABEL,\n                    NUMBER});\n\n    public static final DataSetLookupConstraints DATA_MULTIPLE = new DataSetLookupConstraints()\n            .setGroupAllowed(true)\n            .setGroupRequired(false)\n            .setMaxColumns(-1)\n            .setMinColumns(1)\n            .setExtraColumnsAllowed(true)\n            .setGroupsTitle(\"Rows\")\n            .setColumnsTitle(\"Columns\")\n            .setColumnTypes(new ColumnType[]{\n                    LABEL,\n                    NUMBER});\n\n    public static final DataSetLookupConstraints DATA_MULTIPLE_NO_GROUP = new DataSetLookupConstraints()\n            .setGroupAllowed(false)\n            .setGroupRequired(false)\n            .setMaxColumns(-1)\n            .setMinColumns(1)\n            .setExtraColumnsAllowed(true)\n            .setGroupsTitle(\"Rows\")\n            .setColumnsTitle(\"Columns\")\n            .setColumnTypes(new ColumnType[]{\n                    LABEL,\n                    NUMBER});\n\n    @Mock\n    DataSetLookupEditor.View view;\n\n    @Mock\n    Event<DataSetLookupChangedEvent> event;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<ColumnFunctionEditor> columnFunctionEditorBeanDef;\n\n    @Mock\n    ColumnFunctionEditor columnFunctionEditor;\n\n    @Mock\n    DataSetFilterEditor filterEditor;\n\n    @Mock\n    DataSetGroupDateEditor groupDateEditor;\n\n    @Mock\n    DataSetClientServices clientServices;\n\n    DataSetLookupEditor presenter = null;\n\n    @Before\n    public void init() throws Exception {\n        presenter = new DataSetLookupEditor(view, beanManager, filterEditor, groupDateEditor, clientServices, event);\n\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {\n                RemoteCallback<List<DataSetDef>> callback = (RemoteCallback<List<DataSetDef>>) invocationOnMock.getArguments()[0];\n                callback.callback(DATA_SET_LIST);\n                return null;\n            }\n        }).when(clientServices).getPublicDataSetDefs(any(RemoteCallback.class));\n\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {\n                DataSetMetadataCallback callback = (DataSetMetadataCallback) invocationOnMock.getArguments()[1];\n                callback.callback(POPULATION_META);\n                return null;\n            }\n        }).when(clientServices).fetchMetadata(eq(POPULATION_UUID), any(DataSetMetadataCallback.class));\n\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {\n                DataSetMetadataCallback callback = (DataSetMetadataCallback) invocationOnMock.getArguments()[1];\n                callback.callback(REVENUE_META);\n                return null;\n            }\n        }).when(clientServices).fetchMetadata(eq(REVENUE_UUID), any(DataSetMetadataCallback.class));\n\n        when(beanManager.lookupBean(ColumnFunctionEditor.class)).thenReturn(columnFunctionEditorBeanDef);\n        when(columnFunctionEditorBeanDef.newInstance()).thenReturn(columnFunctionEditor);\n    }\n\n    @Test\n    public void testNonExistingLookup() {\n        presenter.init(DATA_2D_FIXED, null);\n\n        verify(view).clearDataSetSelector();\n        verify(view).enableDataSetSelectorHint();\n        verify(view).addDataSetItem(\"Population\", POPULATION_UUID);\n        verify(view).addDataSetItem(\"Revenue\", REVENUE_UUID);\n        verify(view, never()).setSelectedDataSetIndex(anyInt());\n\n        verify(view, never()).setFilterEnabled(true);\n        verify(view, never()).setGroupEnabled(true);\n        verify(view, never()).setColumnsSectionEnabled(true);\n        verify(view, never()).setAddColumnOptionEnabled(true);\n    }\n\n    @Test\n    public void testExistingLookup() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .filter(greaterThan(100))\n                .group(\"country\")\n                .column(\"country\", \"Country\")\n                .column(\"population\", AggregateFunctionType.SUM, \"Total\")\n                .buildLookup());\n\n        verify(view).clearDataSetSelector();\n        verify(view, never()).enableDataSetSelectorHint();\n        verify(view).addDataSetItem(\"Population\", POPULATION_UUID);\n        verify(view).addDataSetItem(\"Revenue\", REVENUE_UUID);\n        verify(view, times(1)).setSelectedDataSetIndex(anyInt());\n\n        verify(view).setFilterEnabled(true);\n        verify(filterEditor).init(presenter.getDataSetLookup().getFirstFilterOp(), POPULATION_META);\n\n        verify(view).setGroupEnabled(true);\n        verify(view, never()).setGroupByDateEnabled(true);\n        verify(view).setGroupColumnSelectorTitle(\"Categories\");\n        verify(view, never()).enableGroupColumnSelectorHint();\n        verify(groupDateEditor, never()).init(any(ColumnGroup.class));\n\n        verify(view).clearGroupColumnSelector();\n        verify(view).addGroupColumnItem(\"continent\");\n        verify(view).addGroupColumnItem(\"country\");\n        verify(view).addGroupColumnItem(\"year\");\n        verify(view).addGroupColumnItem(\"population\");\n\n        verify(view).setColumnsSectionEnabled(true);\n        verify(view, never()).setGroupByDateEnabled(true);\n        verify(view).setColumnSectionTitle(\"Series\");\n        verify(view).setAddColumnOptionEnabled(false);\n        verify(view, never()).setAddColumnOptionEnabled(true);\n\n        GroupFunction gf = presenter.getFirstGroupFunctions().get(1);\n        verify(columnFunctionEditor).init(POPULATION_META, gf, NUMBER, null, true, false);\n        verify(view).addColumnEditor(any(ColumnFunctionEditor.class));\n    }\n\n    @Test\n    public void testFromNonExistingLookup() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .filter(greaterThan(100))\n                .group(\"country\")\n                .column(\"country\", \"Country\")\n                .column(\"population\", AggregateFunctionType.SUM, \"Total\")\n                .buildLookup());\n\n        verify(view, never()).enableDataSetSelectorHint();\n\n        reset(view);\n        presenter.init(DATA_2D_FIXED, null);\n        verify(view).enableDataSetSelectorHint();\n    }\n\n    @Test\n    public void testDataSetDefFilter() {\n\n        presenter.setDataSetDefFilter(new DataSetLookupEditor.DataSetDefFilter() {\n            public boolean accept(DataSetDef def) {\n                return def.getUUID().equals(REVENUE_UUID);\n            }\n        });\n\n        presenter.init(DATA_2D_FIXED, null);\n\n        verify(view).clearDataSetSelector();\n        verify(view, never()).addDataSetItem(\"Population\", POPULATION_UUID);\n        verify(view).addDataSetItem(\"Revenue\", REVENUE_UUID);\n    }\n\n    @Test\n    public void testDateGroup() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .filter(greaterThan(100))\n                .group(\"year\")\n                .column(\"year\", \"Year\")\n                .column(\"population\", AggregateFunctionType.SUM, \"Total\")\n                .buildLookup());\n\n        verify(view).setGroupEnabled(true);\n        verify(view).setGroupByDateEnabled(true);\n        verify(view, never()).enableGroupColumnSelectorHint();\n        verify(groupDateEditor).init(any(ColumnGroup.class));\n    }\n\n    @Test\n    public void testGroupAllowed() {\n        presenter.init(DATA_MULTIPLE, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .column(\"year\")\n                .column(\"population\")\n                .buildLookup());\n\n        verify(view).setGroupEnabled(true);\n        verify(view).enableGroupColumnSelectorHint();\n        verify(view).setAddColumnOptionEnabled(true);\n        verify(event, never()).fire(any(DataSetLookupChangedEvent.class));\n    }\n\n    @Test\n    public void testDeleteColumns() {\n        DataSetLookup lookup = DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .column(\"year\")\n                .column(\"population\")\n                .buildLookup();\n\n        GroupFunction year = lookup.getLastGroupOp().getGroupFunction(\"year\");\n        presenter.init(DATA_MULTIPLE, lookup);\n\n        reset(view);\n        presenter.onColumnFunctionDeleted(new GroupFunctionDeletedEvent(year));\n\n        verify(view).clearColumnList();\n        verify(view, times(1)).addColumnEditor(any(ColumnFunctionEditor.class));\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n    }\n\n    @Test\n    public void testGroupNotAllowed() {\n        presenter.init(DATA_MULTIPLE_NO_GROUP, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .column(\"year\")\n                .column(\"population\")\n                .buildLookup());\n\n        verify(view, never()).setGroupEnabled(true);\n        verify(view, never()).enableGroupColumnSelectorHint();\n        verify(event, never()).fire(any(DataSetLookupChangedEvent.class));\n    }\n\n    @Test\n    public void testAutoCreateRequiredGroup() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .filter(greaterThan(100))\n                .column(\"country\")\n                .column(\"population\", AggregateFunctionType.SUM)\n                .buildLookup());\n\n        assertEquals(presenter.getFirstGroupColumnId(), \"continent\");\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n    }\n\n    @Test\n    public void testDataSetSelected() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .group(\"country\")\n                .column(\"country\")\n                .column(\"population\", AggregateFunctionType.SUM)\n                .buildLookup());\n\n        when(view.getSelectedDataSetId()).thenReturn(REVENUE_UUID);\n        presenter.onDataSetSelected();\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n\n        DataSetLookup newLookup = presenter.getDataSetLookup();\n        assertEquals(newLookup.getDataSetUUID(), REVENUE_UUID);\n        assertEquals(presenter.getFirstGroupColumnId(), \"company\");\n        assertEquals(presenter.getFirstGroupFunctions().size(), 2);\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getSourceId(), \"company\");\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getSourceId(), \"revenue\");\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getFunction(), null);\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getFunction(), AggregateFunctionType.SUM);\n    }\n\n    @Test\n    public void testGroupColumnSelected() {\n        presenter.init(DATA_2D_FIXED, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .group(\"country\")\n                .column(\"country\")\n                .column(\"population\", AggregateFunctionType.SUM)\n                .buildLookup());\n\n        when(view.getSelectedGroupColumnId()).thenReturn(\"continent\");\n        presenter.onGroupColumnSelected();\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n\n        assertEquals(presenter.getFirstGroupColumnId(), \"continent\");\n        assertEquals(presenter.getFirstGroupFunctions().size(), 2);\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getSourceId(), \"continent\");\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getFunction(), null);\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getFunction(), AggregateFunctionType.SUM);\n    }\n\n    @Test\n    public void testGroupColumnDeselected() {\n        presenter.init(DATA_MULTIPLE, DataSetLookupFactory.newDataSetLookupBuilder()\n                .dataset(POPULATION_UUID)\n                .group(\"country\")\n                .column(\"country\")\n                .column(\"population\", AggregateFunctionType.SUM)\n                .buildLookup());\n\n        when(view.getSelectedGroupColumnId()).thenReturn(null);\n        presenter.onGroupColumnSelected();\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n\n        assertEquals(presenter.getFirstGroupColumnId(), null);\n        assertEquals(presenter.getFirstGroupFunctions().size(), 2);\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getSourceId(), \"country\");\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(0).getFunction(), null);\n        assertEquals(presenter.getFirstGroupFunctions().get(1).getFunction(), null);\n    }\n\n    @Test\n    public void testAddColumns() {\n\n        DataSetLookup lookup = DATA_2D_MULTIPLE.newDataSetLookup(POPULATION_META);\n        presenter.init(DATA_2D_MULTIPLE, lookup);\n\n        verify(view).setAddColumnOptionEnabled(true);\n        presenter.onAddColumn();\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n\n        assertEquals(presenter.getFirstGroupFunctions().size(), 3);\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getColumnId(), \"population_2\");\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getFunction(), AggregateFunctionType.SUM);\n\n        presenter.onAddColumn();\n        assertEquals(presenter.getFirstGroupFunctions().size(), 4);\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getColumnId(), \"population_3\");\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getFunction(), AggregateFunctionType.SUM);\n\n        reset(event);\n        GroupFunction gf = new GroupFunction(\"population\", \"population_2\", AggregateFunctionType.SUM);\n        presenter.onColumnFunctionDeleted(new GroupFunctionDeletedEvent(gf));\n        verify(event).fire(any(DataSetLookupChangedEvent.class));\n        assertEquals(presenter.getFirstGroupFunctions().size(), 3);\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getColumnId(), \"population_3\");\n        assertEquals(presenter.getFirstGroupFunctions().get(2).getFunction(), AggregateFunctionType.SUM);\n\n        presenter.onAddColumn();\n        assertEquals(presenter.getFirstGroupFunctions().size(), 4);\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getSourceId(), \"population\");\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getColumnId(), \"population_2\");\n        assertEquals(presenter.getFirstGroupFunctions().get(3).getFunction(), AggregateFunctionType.SUM);\n    }\n\n    @Test\n    public void testColumnChanged() {\n        DataSetLookup lookup = DATA_2D_MULTIPLE.newDataSetLookup(POPULATION_META);\n        presenter.init(DATA_2D_MULTIPLE, lookup);\n\n        GroupFunction gf = new GroupFunction(\"population\", \"population\", AggregateFunctionType.SUM);\n        presenter.onColumnFunctionChanged(new GroupFunctionChangedEvent(gf));\n        assertEquals(gf.getColumnId(), \"population_2\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DisplayerEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\n\nimport javax.enterprise.event.Event;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DataSetLookupChangedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerEditorClosedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerEditorSavedEvent;\nimport org.dashbuilder.displayer.client.events.DisplayerSettingsChangedEvent;\nimport org.dashbuilder.displayer.client.prototypes.DisplayerPrototypes;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DisplayerEditorTest {\n\n    @Mock\n    DisplayerEditor.View view;\n\n    @Mock\n    DataSetClientServices clientServices;\n    \n    @Mock \n    RendererManager rendererManager;\n    \n    @Mock\n    RendererLibrary rendererLibrary;\n\n    @Mock\n    DisplayerLocator displayerLocator;\n\n    @Mock\n    DisplayerTypeSelector typeSelector;\n\n    @Mock\n    DataSetLookupEditor lookupEditor;\n\n    @Mock\n    DisplayerSettingsEditor settingsEditor;\n\n    @Mock\n    DisplayerEditorStatus editorStatus;\n\n    @Mock\n    Event<DisplayerEditorSavedEvent> saveEvent;\n\n    @Mock\n    Event<DisplayerEditorClosedEvent> closeEvent;\n\n    @Mock\n    DisplayerSettings displayerSettings;\n\n    @Mock\n    DisplayerSettings tableSettings;\n\n    @Mock\n    Displayer displayer;\n\n    @Mock\n    DisplayerHtmlEditor displayerHtmlEditor;\n\n    @Mock\n    Displayer tableDisplayer;\n\n    @Mock\n    UUIDGenerator uuidGenerator;\n\n    @Mock\n    DisplayerPrototypes displayerPrototypes;\n\n    @Mock\n    DisplayerConstraints displayerConstraints;\n\n    @Mock\n    DataSetLookupConstraints lookupConstraints;\n    \n    @Mock\n    DisplayerSettingsChangedEvent displayerSettingsChangedEvent;\n    \n    @Mock\n    ExternalComponentPropertiesEditor componentPropertiesEditor;\n    \n    @Mock\n    Event<DisplayerSettingsChangedEvent> displayerSettingsChangedEventSource;\n\n    DisplayerEditor presenter = null;\n\n    @Before\n    public void init() throws Exception {\n        when(displayerPrototypes.getProto(any(), any())).thenReturn(displayerSettings);\n        when(displayerSettings.cloneInstance()).thenReturn(tableSettings);\n        when(displayerLocator.lookupDisplayer(displayerSettings)).thenReturn(displayer);\n        when(displayerLocator.lookupDisplayer(tableSettings)).thenReturn(tableDisplayer);\n        when(displayer.getDisplayerConstraints()).thenReturn(displayerConstraints);\n        when(displayerConstraints.getDataSetLookupConstraints()).thenReturn(lookupConstraints);\n        when(rendererManager.getDefaultRenderer(any())).thenReturn(rendererLibrary);\n\n        presenter = new DisplayerEditor(view, clientServices, displayerLocator, displayerPrototypes,\n                typeSelector, lookupEditor, settingsEditor, editorStatus, displayerHtmlEditor, saveEvent, \n                closeEvent, rendererManager, componentPropertiesEditor, displayerSettingsChangedEventSource);\n\n    }\n\n    @Test\n    public void testBrandNewDisplayer() {\n        when(view.getBrandNewDisplayerTitle()).thenReturn(\"New displayer\");\n        presenter.setDisplayerType(DisplayerType.SELECTOR);\n        presenter.setDisplayerSubType(DisplayerSubType.SELECTOR_DROPDOWN);\n        presenter.init(null);\n\n        assertEquals(presenter.isBrandNewDisplayer(), true);\n        verify(displayerSettings).setTitle(\"New displayer\");\n        verify(displayerPrototypes).getProto(DisplayerType.SELECTOR, DisplayerSubType.SELECTOR_DROPDOWN);\n        verify(displayerLocator).lookupDisplayer(displayerSettings);\n        verify(displayer).draw();\n\n        verify(typeSelector).init(any(), any());\n        verify(lookupEditor).init(lookupConstraints, null);\n        verify(settingsEditor).init(displayer);\n\n        verify(view).showDisplayer(displayer);\n    }\n\n    @Test\n    public void testNavigation() {\n        presenter.setTypeSelectorEnabled(true);\n        presenter.setDataSetLookupConfEnabled(true);\n        presenter.setDisplaySettingsEnabled(true);\n\n        // Default\n        when(editorStatus.getSelectedOption(any())).thenReturn(-1);\n        presenter.init(null);\n        verify(view).goToTypeSelection(typeSelector);\n\n        // Type selector\n        when(editorStatus.getSelectedOption(any())).thenReturn(0);\n        presenter.init(null);\n        verify(view).goToTypeSelection(typeSelector);\n\n        // Data lookup conf\n        when(editorStatus.getSelectedOption(any())).thenReturn(1);\n        presenter.init(null);\n        verify(view).goToDataSetLookupConf(lookupEditor);\n\n        // Display settings\n        when(editorStatus.getSelectedOption(any())).thenReturn(2);\n        presenter.init(null);\n        verify(view).goToDisplaySettings(settingsEditor);\n    }\n\n    @Test\n    public void testTypeSelectorDisabled() {\n        presenter.setTypeSelectorEnabled(false);\n        presenter.setDataSetLookupConfEnabled(true);\n        presenter.setDisplaySettingsEnabled(true);\n\n        when(editorStatus.getSelectedOption(any())).thenReturn(-1);\n        presenter.init(null);\n        verify(view).goToDataSetLookupConf(lookupEditor);\n        verify(view, never()).goToTypeSelection(typeSelector);\n        verify(view, never()).goToDisplaySettings(settingsEditor);\n    }\n\n    @Test\n    public void testDataLookupConfDisabled() {\n        presenter.setTypeSelectorEnabled(false);\n        presenter.setDataSetLookupConfEnabled(false);\n        presenter.setDisplaySettingsEnabled(true);\n\n        when(editorStatus.getSelectedOption(any())).thenReturn(-1);\n        presenter.init(null);\n        verify(view, never()).goToDataSetLookupConf(lookupEditor);\n        verify(view, never()).goToTypeSelection(typeSelector);\n        verify(view).goToDisplaySettings(settingsEditor);\n    }\n\n    @Test\n    public void testTableModeAvailable() {\n        for (DisplayerType type : Arrays.asList(\n                DisplayerType.BARCHART,\n                DisplayerType.LINECHART,\n                DisplayerType.PIECHART,\n                DisplayerType.AREACHART,\n                DisplayerType.BUBBLECHART,\n                DisplayerType.METERCHART,\n                DisplayerType.METRIC,\n                DisplayerType.MAP)) {\n\n            reset(view);\n            when(displayerSettings.getType()).thenReturn(type);\n            presenter.init(null);\n            presenter.gotoDataSetLookupConf();\n\n            verify(view).setTableDisplayModeEnabled(true);\n        }\n    }\n\n    @Test\n    public void testTableModeNotAvailable() {\n        when(displayerSettings.getType()).thenReturn(DisplayerType.TABLE);\n        presenter.init(null);\n        presenter.gotoDataSetLookupConf();\n\n        verify(view).setTableDisplayModeEnabled(false);\n        verify(view, never()).setTableDisplayModeEnabled(true);\n    }\n\n    @Test\n    public void testTableMode() {\n        when(view.isTableDisplayModeOn()).thenReturn(true);\n        presenter.init(null);\n\n        verify(tableDisplayer).draw();\n        verify(view).showDisplayer(tableDisplayer);\n    }\n\n    @Test\n    public void testDataLookupChanged() {\n        DisplayerSettings settings1 = DisplayerSettingsFactory.newPieChartSettings()\n                .uuid(\"test1\")\n                .dataset(\"test\")\n                .group(\"employee\")\n                .column(\"employee\").format(\"Employee\")\n                .column(AggregateFunctionType.COUNT, \"#items\").format(\"#Items\")\n                .buildSettings();\n\n        DisplayerSettings settings2 = DisplayerSettingsFactory.newPieChartSettings()\n                .uuid(\"test2\")\n                .dataset(\"test\")\n                .group(\"department\")\n                .column(\"department\").format(\"Department\")\n                .column(\"amount\", AggregateFunctionType.SUM).format(\"Total amount\")\n                .buildSettings();\n\n        when(displayerLocator.lookupDisplayer(any())).thenReturn(displayer);\n        presenter.init(settings1);\n        assertEquals(presenter.getDisplayerSettings().getColumnSettingsList().size(), 2);\n        reset(settingsEditor);\n\n        presenter.onDataSetLookupChanged(new DataSetLookupChangedEvent(settings2.getDataSetLookup()));\n        verify(settingsEditor).init(any());\n        assertEquals(presenter.getDisplayerSettings().getColumnSettingsList().size(), 0);\n    }\n    \n    @Test\n    public void rendererSettingChangedTest() {\n        String otherRenderer = \"otherRenderer\";\n        when(displayerSettingsChangedEvent.getDisplayerSettings()).thenReturn(displayerSettings);\n        \n        presenter.onDisplayerSettingsChanged(displayerSettingsChangedEvent);\n        verify(settingsEditor, times(0)).init(any());\n        \n        when(displayerSettings.getRenderer()).thenReturn(otherRenderer);\n        presenter.onDisplayerSettingsChanged(displayerSettingsChangedEvent);\n        verify(settingsEditor).init(any());\n        assertEquals(otherRenderer, presenter.getCurrentRenderer());\n        \n        reset(displayerSettings);\n        when(displayerSettings.getRenderer()).thenReturn(null);\n        presenter.onDisplayerSettingsChanged(displayerSettingsChangedEvent);\n        assertEquals(otherRenderer, presenter.getCurrentRenderer());\n        \n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DisplayerHtmlEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.SourceCodeEditor;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisplayerHtmlEditorTest {\n\n    @Mock\n    DisplayerHtmlEditor.View view;\n\n    @Mock\n    SourceCodeEditor codeEditor;\n\n    @Mock\n    DisplayerConstraints constraints;\n\n    @Mock\n    Displayer displayer;\n\n    DisplayerHtmlEditor presenter;\n\n    @Before\n    public void init() throws Exception {\n        Set<DisplayerAttributeDef> supportedAttrs = new HashSet<>();\n        supportedAttrs.add(DisplayerAttributeDef.HTML_TEMPLATE);\n        supportedAttrs.add(DisplayerAttributeDef.JS_TEMPLATE);\n        when(constraints.getSupportedAttributes()).thenReturn(supportedAttrs);\n        when(displayer.getDisplayerConstraints()).thenReturn(constraints);\n\n        presenter = new DisplayerHtmlEditor(view, codeEditor);\n        presenter.setDisplayer(displayer);\n    }\n\n    @Test\n    public void testInit() {\n        verify(view).showDisplayer(displayer);\n        verify(codeEditor, never()).init(any(), any(), any(), any());\n    }\n\n    @Test\n    public void testSourceCodeItems() {\n        verify(view).addSourceCodeItem(\"html\");\n        verify(view).addSourceCodeItem(\"javascript\");\n   }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DisplayerSettingsEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\n\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.Position;\nimport org.dashbuilder.displayer.client.DataSetHandler;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerSettingsChangedEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.dashbuilder.displayer.DisplayerAttributeDef.*;\nimport static org.dashbuilder.displayer.DisplayerAttributeGroupDef.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisplayerSettingsEditorTest {\n\n    @Mock\n    DisplayerSettingsEditor.View view;\n\n    @Mock\n    Displayer displayer;\n\n    @Mock\n    DataSetHandler dataSetHandler;\n\n    @Mock\n    EventSourceMock<DisplayerSettingsChangedEvent> event;\n\n    @Mock\n    DisplayerLocator displayerLocator;\n\n    @Mock\n    RendererManager rendererManager;\n\n    @Mock\n    RendererLibrary rendererA;\n\n    @Mock\n    RendererLibrary rendererB;\n\n    DisplayerSettingsEditor presenter;\n\n    @Before\n    public void init() throws Exception {\n        when(rendererManager.getRenderersForType(any(DisplayerType.class))).thenReturn(Arrays.asList(rendererA, rendererB));\n        when(rendererA.getUUID()).thenReturn(\"rendererA\");\n        when(rendererB.getUUID()).thenReturn(\"rendererB\");\n        when(rendererManager.getRendererForDisplayer(any(DisplayerSettings.class))).thenReturn(rendererB);\n\n        when(displayer.getDataSetHandler()).thenReturn(dataSetHandler);\n        when(displayer.getDisplayerConstraints()).thenReturn(new DisplayerConstraints(null)\n                .supportsAttribute(TYPE)\n                .supportsAttribute(SUBTYPE)\n                .supportsAttribute(RENDERER)\n                .supportsAttribute(GENERAL_GROUP)\n                .supportsAttribute(COLUMNS_GROUP)\n                .supportsAttribute(REFRESH_GROUP)\n                .supportsAttribute(FILTER_GROUP)\n                .supportsAttribute(CHART_GROUP)\n                .supportsAttribute(TABLE_GROUP)\n                .supportsAttribute(AXIS_GROUP)\n                .supportsAttribute(METER_GROUP));\n\n        presenter = new DisplayerSettingsEditor(view, displayerLocator, rendererManager, event);\n\n        // Call to init implies calling to presenter.show() internally\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {\n                presenter.show();\n                return null;\n            }\n        }).when(dataSetHandler).lookupDataSet(any(DataSetReadyCallback.class));\n    }\n\n    @Test\n    public void testGeneralSettings() {\n\n        when(dataSetHandler.getLastDataSet()).thenReturn(DataSetFactory.newDataSetBuilder()\n                .label(\"dept\")\n                .number(\"amount\")\n                .buildDataSet());\n\n        when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newBarChartSettings()\n                .dataset(\"dset\")\n                .group(\"dept\")\n                .column(\"dept\").format(\"Department\")\n                .column(\"amount\").format(\"Total\", \"#.##0\").expression(\"value/100\")\n                .title(\"Sales by dept\")\n                .titleVisible(true)\n                .legendOn(Position.BOTTOM)\n                .width(400).height(200)\n                .xAxisTitle(\"Depts\")\n                .yAxisTitle(\"Amount $\")\n                .margins(10, 80, 80, 100)\n                .filterOn(false, true, true)\n                .refreshOn(3, false)\n                .buildSettings());\n\n        // Call to init implies calling to presenter.show() internally (see above)\n        presenter.init(displayer);\n\n        verify(view).clear();\n        verify(view).addTextProperty(TITLE, \"Sales by dept\");\n        verify(view).addBooleanProperty(TITLE_VISIBLE, true);\n        verify(view, never()).addBooleanProperty(EXPORT_TO_CSV, false);\n        verify(view, never()).addBooleanProperty(EXPORT_TO_XLS, false);\n        verify(view).addTextProperty(eq(CHART_WIDTH), eq(\"400\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(CHART_HEIGHT), eq(\"200\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addColorProperty(eq(CHART_BGCOLOR), anyString());\n        verify(view).addBooleanProperty(CHART_3D, false);\n        verify(view).addTextProperty(eq(CHART_MARGIN_TOP), eq(\"10\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(CHART_MARGIN_BOTTOM), eq(\"80\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(CHART_MARGIN_LEFT), eq(\"80\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(CHART_MARGIN_RIGHT), eq(\"100\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addBooleanProperty(CHART_SHOWLEGEND, true);\n        verify(view).addListProperty(eq(CHART_LEGENDPOSITION), anyList(), any());\n        verify(view).addBooleanProperty(XAXIS_SHOWLABELS, true);\n        verify(view).addTextProperty(XAXIS_LABELSANGLE, \"0\");\n        verify(view).addTextProperty(XAXIS_TITLE, \"Depts\");\n        verify(view).addBooleanProperty(YAXIS_SHOWLABELS, true);\n        verify(view).addTextProperty(YAXIS_TITLE, \"Amount $\");\n        verify(view).addBooleanProperty(FILTER_ENABLED, true);\n        verify(view).addBooleanProperty(FILTER_SELFAPPLY_ENABLED, false);\n        verify(view).addBooleanProperty(FILTER_NOTIFICATION_ENABLED, true);\n        verify(view).addBooleanProperty(FILTER_LISTENING_ENABLED, true);\n        verify(view).addTextProperty(eq(REFRESH_INTERVAL), eq(\"3\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addBooleanProperty(REFRESH_STALE_DATA, false);\n        verify(view).addTextProperty(eq(\"columns.dept.name\"), anyString(), eq(\"Department\"));\n        verify(view).addTextProperty(eq(\"columns.amount.name\"), anyString(), eq(\"Total\"));\n        verify(view).addTextProperty(eq(\"columns.amount.expression\"), anyString(), eq(\"value/100\"));\n        verify(view).addTextProperty(eq(\"columns.amount.pattern\"), anyString(), eq(\"#.##0\"));\n        verify(view).show();\n    }\n\n    @Test\n    public void testChangeAttributes() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings().buildSettings();\n        when(displayer.getDisplayerSettings()).thenReturn(settings);\n\n        presenter.init(displayer);\n        presenter.onAttributeChanged(TITLE.getFullId(), \"Test\");\n        presenter.onAttributeChanged(TITLE_VISIBLE.getFullId(), \"true\");\n        presenter.onAttributeChanged(EXPORT_TO_CSV.getFullId(), \"false\");\n        presenter.onAttributeChanged(EXPORT_TO_XLS.getFullId(), \"false\");\n        presenter.onAttributeChanged(CHART_HEIGHT.getFullId(), \"400\");\n        presenter.onAttributeChanged(\"columns.amount.name\", \"Total\");\n        presenter.onAttributeChanged(\"columns.amount.pattern\", \"#.###,00\");\n        presenter.onAttributeChanged(\"columns.amount.expression\", \"value\");\n\n        assertEquals(settings.getTitle(), \"Test\");\n        assertEquals(settings.isTitleVisible(), true);\n        assertEquals(settings.isCSVExportAllowed(), false);\n        assertEquals(settings.isExcelExportAllowed(), false);\n        assertEquals(settings.getChartHeight(), 400);\n        assertEquals(settings.getColumnSettings(\"amount\").getColumnName(), \"Total\");\n        assertEquals(settings.getColumnSettings(\"amount\").getValuePattern(), \"#.###,00\");\n        assertEquals(settings.getColumnSettings(\"amount\").getValueExpression(), \"value\");\n\n        verify(event, atLeastOnce()).fire(any(DisplayerSettingsChangedEvent.class));\n    }\n\n    @Test\n    public void testTableSettings() {\n\n        when(dataSetHandler.getLastDataSet()).thenReturn(DataSetFactory.newDataSetBuilder()\n                .label(\"dept\")\n                .date(\"date\")\n                .number(\"amount\")\n                .buildDataSet());\n\n        when(displayer.getDisplayerConstraints()).thenReturn(\n                new DisplayerConstraints(null)\n                        .supportsAttribute(TABLE_GROUP)\n                        .supportsAttribute(EXPORT_GROUP));\n\n        when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newTableSettings()\n                .tablePageSize(10)\n                .tableWidth(500)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(\"date\", SortOrder.ASCENDING)\n                .tableColumnPickerEnabled(false)\n                .allowCsvExport(true)\n                .allowExcelExport(false)\n                .buildSettings());\n\n        presenter.init(displayer);\n\n        verify(view).clear();\n        verify(view).addTextProperty(eq(TABLE_WIDTH), eq(\"500\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addBooleanProperty(TABLE_SORTENABLED, true);\n        verify(view).addListProperty(eq(TABLE_SORTCOLUMNID), anyListOf(String.class), eq(\"date\"));\n        verify(view).addListProperty(eq(TABLE_SORTORDER), anyListOf(String.class), eq(SortOrder.ASCENDING.toString()));\n        verify(view).addBooleanProperty(TABLE_COLUMN_PICKER_ENABLED, false);\n        verify(view).addBooleanProperty(EXPORT_TO_CSV, true);\n        verify(view).addBooleanProperty(EXPORT_TO_XLS, false);\n        verify(view).show();\n    }\n\n    @Test\n    public void testMeterSettings() {\n\n        when(displayer.getDisplayerConstraints()).thenReturn(\n                new DisplayerConstraints(null)\n                        .supportsAttribute(METER_GROUP));\n\n\n        when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newMeterChartSettings()\n                        .meter(0, 100, 500, 900)\n                        .buildSettings());\n\n        presenter.init(displayer);\n\n        verify(view).clear();\n        verify(view).addTextProperty(eq(METER_START), eq(\"0\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(METER_WARNING), eq(\"100\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(METER_CRITICAL), eq(\"500\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).addTextProperty(eq(METER_END), eq(\"900\"), any(DisplayerSettingsEditor.LongValidator.class));\n        verify(view).show();\n    }\n\n    @Test\n    public void testRenderer() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newBarChartSettings()\n                .renderer(\"rendererB\")\n                .buildSettings();\n\n        when(rendererManager.getRendererForDisplayer(settings)).thenReturn(rendererB);\n        when(displayer.getDisplayerConstraints()).thenReturn(\n                new DisplayerConstraints(null)\n                        .supportsAttribute(RENDERER));\n\n        when(displayer.getDisplayerSettings()).thenReturn(settings);\n\n        presenter.init(displayer);\n        verify(view).clear();\n        verify(view).addListProperty(RENDERER, Arrays.asList(\"rendererA\", \"rendererB\"), \"rendererB\");\n        verify(view).show();\n    }\n\n    @Test\n    public void testSupportedAttrs() {\n        when(displayer.getDisplayerConstraints()).thenReturn(new DisplayerConstraints(null)\n                .supportsAttribute(TYPE)\n                .supportsAttribute(SUBTYPE)\n                .supportsAttribute(TITLE)\n                .supportsAttribute(FILTER_GROUP));\n\n        when(displayer.getDisplayerSettings()).thenReturn(DisplayerSettingsFactory.newBarChartSettings().buildSettings());\n\n        presenter.init(displayer);\n        assertEquals(presenter.isSupported(TYPE), true);\n        assertEquals(presenter.isSupported(SUBTYPE), true);\n        assertEquals(presenter.isSupported(TITLE), true);\n        assertEquals(presenter.isSupported(TITLE_VISIBLE), false);\n        assertEquals(presenter.isSupported(RENDERER), false);\n        assertEquals(presenter.isSupported(FILTER_ENABLED), true);\n        assertEquals(presenter.isSupported(FILTER_LISTENING_ENABLED), true);\n        assertEquals(presenter.isSupported(FILTER_NOTIFICATION_ENABLED), true);\n        assertEquals(presenter.isSupported(FILTER_SELFAPPLY_ENABLED), true);\n    }\n\n    @Test\n    public void testLongValidator() {\n        PropertyFieldValidator validator = presenter.createLongValidator();\n        assertEquals(validator.validate(\"500\"), true);\n        assertEquals(validator.validate(\"500d\"), false);\n        assertEquals(validator.validate(\"aaa\"), false);\n    }\n\n    @Test\n    public void testMeterValidator() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newMeterChartSettings()\n                .meter(0, 100, 500, 900)\n                .buildSettings();\n\n        when(displayer.getDisplayerSettings()).thenReturn(settings);\n        presenter.init(displayer);\n\n        PropertyFieldValidator validator = presenter.createMeterValidator(settings, 0);\n        assertEquals(validator.validate(\"aaa\"), false);\n        assertEquals(validator.validate(\"0\"), true);\n        assertEquals(validator.validate(\"99\"), true);\n        assertEquals(validator.validate(\"100\"), true);\n        assertEquals(validator.validate(\"101\"), false);\n        assertEquals(validator.validate(\"-999999999999\"), true);\n\n        validator = presenter.createMeterValidator(settings, 1);\n        assertEquals(validator.validate(\"0\"), true);\n        assertEquals(validator.validate(\"99\"), true);\n        assertEquals(validator.validate(\"100\"), true);\n        assertEquals(validator.validate(\"101\"), true);\n        assertEquals(validator.validate(\"500\"), true);\n        assertEquals(validator.validate(\"501\"), false);\n        assertEquals(validator.validate(\"-1\"), false);\n\n        validator = presenter.createMeterValidator(settings, 2);\n        assertEquals(validator.validate(\"99\"), false);\n        assertEquals(validator.validate(\"100\"), true);\n        assertEquals(validator.validate(\"900\"), true);\n        assertEquals(validator.validate(\"901\"), false);\n\n        validator = presenter.createMeterValidator(settings, 3);\n        assertEquals(validator.validate(\"499\"), false);\n        assertEquals(validator.validate(\"500\"), true);\n        assertEquals(validator.validate(\"900\"), true);\n        assertEquals(validator.validate(\"10000000000000\"), true);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DisplayerSubtypeSelectorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\n\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerSubtypeSelectedEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\nimport static org.dashbuilder.displayer.DisplayerType.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisplayerSubtypeSelectorTest {\n\n    @Mock\n    DisplayerSubtypeSelector.View subtypeView;\n\n    @Mock\n    RendererManager rendererManager;\n\n    @Mock\n    RendererLibrary rendererLibrary;\n\n    @Mock\n    EventSourceMock<DisplayerSubtypeSelectedEvent> subtypeSelectedEvent;\n\n    DisplayerSubtypeSelector presenter;\n\n    @Before\n    public void init() {\n        when(rendererManager.getRendererForType(any(DisplayerType.class))).thenReturn(rendererLibrary);\n\n        when(rendererLibrary.getSupportedSubtypes(BARCHART)).thenReturn(Arrays.asList(BAR, BAR_STACKED));\n        when(rendererLibrary.getSupportedSubtypes(LINECHART)).thenReturn(Arrays.asList(LINE, SMOOTH));\n        when(rendererLibrary.getSupportedSubtypes(BUBBLECHART)).thenReturn(null);\n\n        presenter = new DisplayerSubtypeSelector(subtypeView, rendererManager, subtypeSelectedEvent);\n    }\n\n    @Test\n    public void testInitialization1() {\n        presenter.init(BARCHART, BAR);\n        verify(subtypeView).show(BARCHART, BAR);\n        verify(subtypeView).show(BARCHART, BAR_STACKED);\n        verify(subtypeView).select(BAR);\n    }\n\n    @Test\n    public void testInitialization2() {\n        presenter.init(LINECHART, null);\n        verify(subtypeView).show(LINECHART, LINE);\n        verify(subtypeView).show(LINECHART, SMOOTH);\n        verify(subtypeView).select(LINE);\n    }\n\n    @Test\n    public void testInitialization3() {\n        presenter.init(BUBBLECHART, null);\n        verify(subtypeView, never()).show(any(DisplayerType.class), any(DisplayerSubType.class));\n        verify(subtypeView).showDefault(BUBBLECHART);\n    }\n\n    @Test\n    public void testOnSelect() {\n        presenter.onSelect(LINE);\n        assertEquals(presenter.getSelectedSubtype(), LINE);\n        verify(subtypeSelectedEvent).fire(any(DisplayerSubtypeSelectedEvent.class));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/DisplayerTypeSelectorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.SMOOTH;\nimport static org.dashbuilder.displayer.DisplayerType.BARCHART;\nimport static org.dashbuilder.displayer.DisplayerType.LINECHART;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.dashbuilder.displayer.client.events.DisplayerTypeSelectedEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisplayerTypeSelectorTest {\n\n    @Mock\n    DisplayerTypeSelector.View typeView;\n\n    @Mock\n    DisplayerSubtypeSelector subtypeSelector;\n\n    @Mock\n    EventSourceMock<DisplayerTypeSelectedEvent> typeSelectedEvent;\n    \n    @Mock\n    RendererManager rendererManager;\n\n    DisplayerTypeSelector presenter;\n\n    @Before\n    public void init() {\n        presenter = new DisplayerTypeSelector(typeView, subtypeSelector, typeSelectedEvent, rendererManager);\n    }\n\n    @Test\n    public void testInitialization() {\n        presenter.init(LINECHART, SMOOTH);\n        verify(typeView).select(LINECHART);\n    }\n\n    @Test\n    public void testOnSelect() {\n        presenter.onSelect(BARCHART);\n        assertEquals(presenter.getSelectedType(), BARCHART);\n        verify(typeSelectedEvent).fire(any(DisplayerTypeSelectedEvent.class));\n    }\n    \n    @Test\n    public void testNotSupportedDisplayer() {\n        Mockito.when(rendererManager.isTypeSupported(DisplayerType.BARCHART)).thenReturn(true);\n        Mockito.when(rendererManager.isTypeSupported(DisplayerType.LINECHART)).thenReturn(true);\n        presenter = new DisplayerTypeSelector(typeView, subtypeSelector, typeSelectedEvent, rendererManager);\n        verify(typeView, times(2)).show(any());\n        verify(typeView, times(0)).show(DisplayerType.MAP);\n        verify(typeView).show(DisplayerType.BARCHART);\n        verify(typeView).show(DisplayerType.LINECHART);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPresenterTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.displayer.client.component.ExternalComponentDispatcher;\nimport org.dashbuilder.displayer.client.widgets.ExternalComponentPresenter.View;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExternalComponentPresenterTest {\n\n    @Mock\n    View view;\n\n    @Mock\n    ExternalComponentDispatcher dispatcher;\n\n    @Mock\n    ExternalComponentMessageHelper messageHelper;\n\n    @InjectMocks\n    ExternalComponentPresenter externalComponentPresenter;\n\n    @Test\n    public void testSendMessage() {\n        ExternalComponentMessage message = new ExternalComponentMessage();\n\n        externalComponentPresenter.sendMessage(message);\n\n        verify(messageHelper).withId(eq(message), eq(externalComponentPresenter.getId()));\n        verify(view).postMessage(eq(message));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/ExternalComponentPropertiesEditorTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.external.model.ComponentParameter;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.CallerMock;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.emptyList;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.matches;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExternalComponentPropertiesEditorTest {\n\n    @Mock\n    ComponentService externalComponentServiceMock;\n\n    @Mock\n    ExternalComponentPropertiesEditor.View view;\n\n    @Mock\n    BusyIndicatorView loading;\n\n    @Captor\n    ArgumentCaptor<Collection<PropertyEditorCategory>> categoriesCaptor;\n\n    CallerMock<ComponentService> externalComponentService;\n\n    @InjectMocks\n    ExternalComponentPropertiesEditor externalComponentPropertiesEditor;\n\n    @Before\n    public void init() {\n        externalComponentService = new CallerMock<>(externalComponentServiceMock);\n        externalComponentPropertiesEditor.setExternalComponentService(externalComponentService);\n    }\n\n    @Test\n    public void testComponentNotFound() {\n        String c1 = \"c1\";\n        when(externalComponentServiceMock.byId(matches(c1))).thenReturn(Optional.empty());\n        externalComponentPropertiesEditor.init(c1, Collections.emptyMap(), props -> {\n        });\n        verify(view).componentNotFound();\n    }\n\n    @Test\n    public void testNoProperties() {\n        ExternalComponent c1 = new ExternalComponent(\"c1\", \"c1 name\", \"c1 icon\", false, Collections.emptyList());\n\n        when(externalComponentServiceMock.byId(matches(c1.getId()))).thenReturn(Optional.of(c1));\n        externalComponentPropertiesEditor.init(c1.getId(), Collections.emptyMap(), props -> {\n        });\n\n        verify(view).noPropertiesComponent();\n    }\n\n    @Test\n    public void testLoadProperties() {\n        ComponentParameter p1 = param(\"P1 CAT\", \"p1val\", \"text\", \"P1 Field\", \"p1\", emptyList());\n        ComponentParameter p2 = param(\"P2 CAT\", \"p2val\", \"combo\", \"P2 Field\", \"p2\", asList(\"V1\", \"V2\"));\n        ExternalComponent c1 = new ExternalComponent(\"c1\", \"c1 name\", \"c1 icon\", false, asList(p1, p2));\n\n        when(externalComponentServiceMock.byId(matches(c1.getId()))).thenReturn(Optional.of(c1));\n        externalComponentPropertiesEditor.init(c1.getId(), new HashMap<>(), props -> {\n        });\n\n        verify(view).addCategories(categoriesCaptor.capture());\n\n        Collection<PropertyEditorCategory> categories = categoriesCaptor.getValue();\n\n        assertEquals(3, categories.size());\n    }\n\n    private ComponentParameter param(String category, String defaultValue, String type, String label, String name, List<String> comboValues) {\n        return new ComponentParameter(name, type, category, defaultValue, label, comboValues);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/RendererSelectorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractRendererLibrary;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RendererSelectorTest {\n\n    @Mock\n    RendererSelector.RadioListView radioListView;\n\n    @Mock\n    RendererSelector.TabListView tabListView;\n\n    @Mock\n    RendererSelector.ListBoxView listBoxView;\n\n    @Mock\n    RendererManager rendererManager;\n\n    @Mock\n    Command selectCommand;\n\n    RendererLibMock gwtLib = new RendererLibMock(\"gwt\");\n    RendererLibMock d3Lib = new RendererLibMock(\"d3\");\n    RendererLibMock lienzoLib = new RendererLibMock(\"lienzo\");\n\n    DisplayerSettings settings = DisplayerSettingsFactory\n            .newPieChartSettings()\n            .renderer(\"d3\")\n            .buildSettings();\n\n    RendererSelector presenter;\n\n    class RendererLibMock extends AbstractRendererLibrary {\n\n        String name;\n\n        public RendererLibMock(String name) {\n            this.name = name;\n        }\n\n        @Override\n        public String getUUID() {\n            return null;\n        }\n\n        @Override\n        public String getName() {\n            return name;\n        }\n\n        @Override\n        public List<DisplayerType> getSupportedTypes() {\n            return null;\n        }\n\n        @Override\n        public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {\n            return null;\n        }\n\n        @Override\n        public Displayer lookupDisplayer(DisplayerSettings displayer) {\n            return null;\n        }\n    }\n\n    @Before\n    public void init() {\n        presenter = new RendererSelector(tabListView, listBoxView, radioListView, rendererManager);\n    }\n\n    @Test\n    public void testSingleRenderer() {\n        List<RendererLibrary> rendererLibs = Arrays.asList((RendererLibrary) d3Lib);\n        when(rendererManager.getRendererForDisplayer(settings)).thenReturn(d3Lib);\n\n        presenter.init(settings, RendererSelector.SelectorType.TAB, 300, selectCommand);\n\n        verify(tabListView).setVisible(false);\n        verify(tabListView, never()).setWidth(anyInt());\n        verify(tabListView, never()).clearRendererSelector();\n        verify(tabListView, never()).addRendererItem(anyString());\n        verify(tabListView, never()).setSelectedRendererIndex(anyInt());\n\n        verifyZeroInteractions(listBoxView, radioListView);\n    }\n\n    @Test\n    public void testMultipleRenderers() {\n        List<RendererLibrary> rendererLibs = Arrays.asList((RendererLibrary) gwtLib, d3Lib, lienzoLib);\n        when(rendererManager.getRenderersForType(any(), any())).thenReturn(rendererLibs);\n        when(rendererManager.getRendererForDisplayer(settings)).thenReturn(d3Lib);\n\n        presenter.init(settings, RendererSelector.SelectorType.LIST, 300, selectCommand);\n\n        verify(listBoxView).setVisible(true);\n        verify(listBoxView).setWidth(300);\n        verify(listBoxView).clearRendererSelector();\n        verify(listBoxView).addRendererItem(\"gwt\");\n        verify(listBoxView).addRendererItem(\"d3\");\n        verify(listBoxView).addRendererItem(\"lienzo\");\n        verify(listBoxView).setSelectedRendererIndex(1);\n\n        verifyZeroInteractions(tabListView, radioListView);\n    }\n\n    @Test\n    public void testOnSelect() {\n        List<RendererLibrary> rendererLibs = Arrays.asList((RendererLibrary) gwtLib, d3Lib);\n        when(rendererManager.getRendererForDisplayer(settings)).thenReturn(d3Lib);\n        when(rendererManager.getRendererByName(gwtLib.getName())).thenReturn(gwtLib);\n        when(tabListView.getRendererSelected()).thenReturn(gwtLib.getName());\n\n        presenter.init(settings, RendererSelector.SelectorType.TAB, 300, selectCommand);\n        presenter.onRendererSelected();\n\n        verify(selectCommand).execute();\n        assertEquals(presenter.getRendererLibrary(), gwtLib);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/ColumnFilterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.text.NumberFormat;\nimport java.text.SimpleDateFormat;\nimport java.util.Date;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.displayer.client.events.ColumnFilterChangedEvent;\nimport org.dashbuilder.displayer.client.events.ColumnFilterDeletedEvent;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ColumnFilterEditorTest {\n\n    @Mock\n    ColumnFilterEditor.View view;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<TextParameterEditor> textParameterBeanDef;\n\n    @Mock\n    SyncBeanDef<NumberParameterEditor> numberParameterBeanDef;\n\n    @Mock\n    SyncBeanDef<DateParameterEditor> dateParameterBeanDef;\n\n    @Mock\n    SyncBeanDef<TimeFrameEditor> timeFrameBeanDef;\n\n    @Mock\n    SyncBeanDef<LikeToFunctionEditor> likeToFunctionBeanDef;\n\n    @Mock\n    TextParameterEditor textParameterEditor;\n\n    @Mock\n    NumberParameterEditor numberParameterEditor;\n\n    @Mock\n    DateParameterEditor dateParameterEditor;\n\n    @Mock\n    TimeFrameEditor timeFrameEditor;\n\n    @Mock\n    LikeToFunctionEditor likeToFunctionEditor;\n\n    @Mock\n    DataSetMetadata metadata;\n\n    @Mock\n    EventSourceMock<ColumnFilterChangedEvent> changedEvent;\n\n    @Mock\n    EventSourceMock<ColumnFilterDeletedEvent> deletedEvent;\n\n    @Before\n    public void init() {\n        when(beanManager.lookupBean(TextParameterEditor.class)).thenReturn(textParameterBeanDef);\n        when(beanManager.lookupBean(NumberParameterEditor.class)).thenReturn(numberParameterBeanDef);\n        when(beanManager.lookupBean(DateParameterEditor.class)).thenReturn(dateParameterBeanDef);\n        when(beanManager.lookupBean(TimeFrameEditor.class)).thenReturn(timeFrameBeanDef);\n        when(beanManager.lookupBean(LikeToFunctionEditor.class)).thenReturn(likeToFunctionBeanDef);\n\n        when(textParameterBeanDef.newInstance()).thenReturn(textParameterEditor);\n        when(numberParameterBeanDef.newInstance()).thenReturn(numberParameterEditor);\n        when(dateParameterBeanDef.newInstance()).thenReturn(dateParameterEditor);\n        when(likeToFunctionBeanDef.newInstance()).thenReturn(likeToFunctionEditor);\n        when(timeFrameBeanDef.newInstance()).thenReturn(timeFrameEditor);\n    }\n\n    protected ColumnFilterEditor setupEditor(ColumnType columnType, CoreFunctionType functionType, Comparable... params) {\n        when(metadata.getColumnType(\"col\")).thenReturn(columnType);\n\n        CoreFunctionFilter filter = new CoreFunctionFilter(\"col\", functionType, params);\n        ColumnFilterEditor filterEditor = new ColumnFilterEditor(view, beanManager, changedEvent, deletedEvent);\n        filterEditor.init(metadata, filter);\n\n        assertEquals(view, filterEditor.getView());\n        return filterEditor;\n    }\n\n    @Test\n    public void testTextParam() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.EQUALS_TO, \"Test\");\n\n        int n = CoreFunctionType.getSupportedTypes(ColumnType.LABEL).size()-1;\n        verify(view).clearFunctionSelector();\n        verify(view, times(n)).addFunctionItem(Mockito.<CoreFunctionType> any());\n        verify(view, never()).addFunctionItem(CoreFunctionType.TIME_FRAME);\n\n        verify(view).clearFilterConfig();\n        verify(view).addFilterConfigWidget(textParameterEditor);\n        verify(view).setFunctionSelected(\"col = Test\");\n    }\n\n    @Test\n    public void testNumberParam() throws Exception {\n        double number = 1000.23;\n        NumberFormat numberFormat = NumberFormat.getNumberInstance();\n        when(view.formatNumber(number)).thenReturn(numberFormat.format(number));\n        setupEditor(ColumnType.NUMBER, CoreFunctionType.EQUALS_TO, number);\n\n        int n = CoreFunctionType.getSupportedTypes(ColumnType.NUMBER).size()-1;\n        verify(view).clearFunctionSelector();\n        verify(view, times(n)).addFunctionItem(Mockito.<CoreFunctionType> any());\n        verify(view, never()).addFunctionItem(CoreFunctionType.TIME_FRAME);\n        verify(view, never()).addFunctionItem(CoreFunctionType.LIKE_TO);\n\n        verify(view).clearFilterConfig();\n        verify(view).addFilterConfigWidget(numberParameterEditor);\n        verify(view).setFunctionSelected(\"col = \" + numberFormat.format(number));\n    }\n\n    @Test\n    public void testDateParam() throws Exception {\n        SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd-MM-yyyy HH:mm:ss\");\n        String dateStr = \"23-11-2020 23:59:59\";\n        Date d = dateFormat.parse(dateStr);\n        when(view.formatDate(d)).thenReturn(dateStr);\n        setupEditor(ColumnType.DATE, CoreFunctionType.EQUALS_TO, d);\n\n        int n = CoreFunctionType.getSupportedTypes(ColumnType.DATE).size()-1;\n        verify(view).clearFunctionSelector();\n        verify(view, times(n)).addFunctionItem(Mockito.<CoreFunctionType> any());\n        verify(view).addFunctionItem(CoreFunctionType.TIME_FRAME);\n        verify(view, never()).addFunctionItem(CoreFunctionType.LIKE_TO);\n\n        verify(view).clearFilterConfig();\n        verify(view).addFilterConfigWidget(dateParameterEditor);\n        verify(view).setFunctionSelected(\"col = \" + dateStr);\n    }\n\n    @Test\n    public void testNotEquals() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.NOT_EQUALS_TO, \"Test\");\n        verify(view).setFunctionSelected(\"col != Test\");\n    }\n\n    @Test\n    public void testBetween() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.BETWEEN, \"A\", \"B\");\n        verify(view).setFunctionSelected(\"col [A B]\");\n    }\n\n    @Test\n    public void testGreaterOrEquals() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.GREATER_OR_EQUALS_TO, \"Test\");\n        verify(view).setFunctionSelected(\"col >= Test\");\n    }\n\n    @Test\n    public void testGreaterThan() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.GREATER_THAN, \"Test\");\n        verify(view).setFunctionSelected(\"col > Test\");\n    }\n    @Test\n    public void testLowerOrEquals() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.LOWER_OR_EQUALS_TO, \"Test\");\n        verify(view).setFunctionSelected(\"col <= Test\");\n    }\n\n    @Test\n    public void testLowerThan() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.LOWER_THAN, \"Test\");\n        verify(view).setFunctionSelected(\"col < Test\");\n    }\n\n    @Test\n    public void testNull() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.IS_NULL);\n        verify(view).setFunctionSelected(\"col = null \");\n    }\n\n    @Test\n    public void testNotNull() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.NOT_NULL);\n        verify(view).setFunctionSelected(\"col != null \");\n    }\n\n    @Test\n    public void testLikeTo() {\n        setupEditor(ColumnType.LABEL, CoreFunctionType.LIKE_TO, \"Test\");\n        verify(view).clearFilterConfig();\n        verify(view).setFunctionSelected(\"col like Test\");\n        verify(view).addFilterConfigWidget(likeToFunctionEditor);\n    }\n\n    @Test\n    public void testTimeFrame() {\n        setupEditor(ColumnType.DATE, CoreFunctionType.TIME_FRAME, \"begin[year February] till now\");\n        verify(view).clearFilterConfig();\n        verify(view).setFunctionSelected(\"col = begin[year February] till now\");\n        verify(view).addFilterConfigWidget(timeFrameEditor);\n    }\n\n    @Test\n    public void testSelectFunction() {\n        ColumnFilterEditor presenter = setupEditor(ColumnType.LABEL, CoreFunctionType.EQUALS_TO, \"value\");\n        verify(view).clearFilterConfig();\n        verify(view).setFunctionSelected(\"col = value\");\n\n        reset(view);\n        when(view.getSelectedFunctionIndex()).thenReturn(2);\n        presenter.onSelectFilterFunction();\n\n        assertEquals(presenter.getCoreFilter().getType(), CoreFunctionType.NOT_EQUALS_TO);\n        verify(changedEvent).fire(Mockito.<ColumnFilterChangedEvent>any());\n        verify(view).clearFilterConfig();\n        verify(view).setFunctionSelected(\"col != value1\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/DataSetFilterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupFactory;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.client.events.ColumnFilterDeletedEvent;\nimport org.dashbuilder.displayer.client.events.DataSetFilterChangedEvent;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetFilterEditorTest {\n\n    @Mock\n    ColumnFilterEditor columnFilterEditor;\n\n    @Mock\n    DataSetFilterEditor.View filterView;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<ColumnFilterEditor> columnFilterEditorBeanDef;\n\n    @Mock\n    DataSetMetadata metadata;\n\n    @Mock\n    Event<DataSetFilterChangedEvent> changedEvent;\n\n    @Before\n    public void setup() {\n        when(beanManager.lookupBean(ColumnFilterEditor.class)).thenReturn(columnFilterEditorBeanDef);\n        when(columnFilterEditorBeanDef.newInstance()).thenReturn(columnFilterEditor);\n        when(metadata.getNumberOfColumns()).thenReturn(3);\n        when(metadata.getColumnId(0)).thenReturn(\"column1\");\n        when(metadata.getColumnId(1)).thenReturn(\"column2\");\n        when(metadata.getColumnId(2)).thenReturn(\"column3\");\n        when(metadata.getColumnType(0)).thenReturn(ColumnType.LABEL);\n        when(metadata.getColumnType(2)).thenReturn(ColumnType.DATE);\n    }\n\n    @Test\n    public void testViewInitialization() {\n        DataSetFilter filter = new DataSetFilter();\n        ColumnFilter filter1 = FilterFactory.equalsTo(\"column1\", \"Test\");\n        filter.addFilterColumn(filter1);\n\n        DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);\n        filterEditor.init(filter, metadata);\n\n        assertEquals(filterView, filterEditor.view);\n        verify(filterView).showNewFilterHome();\n        verify(filterView).addColumn(\"column1\");\n        verify(filterView).addColumn(\"column2\");\n        verify(filterView).addColumn(\"column3\");\n        verify(filterView, times(filter.getColumnFilterList().size())).addColumnFilterEditor(any(ColumnFilterEditor.class));\n    }\n\n    @Test\n    public void testWorkflow() {\n        DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);\n        filterEditor.init(null, metadata);\n        reset(filterView);\n\n        filterEditor.onNewFilterStart();\n        verify(filterView).showColumnSelector();\n\n        filterEditor.onNewFilterCancel();\n        verify(filterView).showNewFilterHome();\n    }\n\n    @Test\n    public void testCreateLabelFilter() {\n        DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);\n        filterEditor.init(null, metadata);\n        reset(filterView);\n        when(filterView.getSelectedColumnIndex()).thenReturn(0);\n\n        filterEditor.onCreateFilter();\n        verify(changedEvent).fire(any(DataSetFilterChangedEvent.class));\n\n        DataSetFilter filter = filterEditor.getFilter();\n        assertNotNull(filter);\n        assertEquals(filter.getColumnFilterList().size(), 1);\n\n        ColumnFilter expected = FilterFactory.createCoreFunctionFilter(\"column1\", ColumnType.LABEL, CoreFunctionType.NOT_EQUALS_TO);\n        assertEquals(filter.getColumnFilterList().get(0), expected);\n    }\n\n    @Test\n    public void testCreateDateFilter() {\n        DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);\n        filterEditor.init(null, metadata);\n        reset(filterView);\n        when(filterView.getSelectedColumnIndex()).thenReturn(2);\n\n        filterEditor.onCreateFilter();\n        verify(changedEvent).fire(any(DataSetFilterChangedEvent.class));\n\n        DataSetFilter filter = filterEditor.getFilter();\n        assertNotNull(filter);\n        assertEquals(filter.getColumnFilterList().size(), 1);\n\n        ColumnFilter expected = FilterFactory.createCoreFunctionFilter(\"column3\", ColumnType.DATE, CoreFunctionType.TIME_FRAME);\n        assertEquals(filter.getColumnFilterList().get(0), expected);\n    }\n\n    @Test\n    public void testDeleteDuplicatedFilters() {\n        ColumnFilter columnFilter1 = FilterFactory.notEqualsTo(\"column\", \"val1\");\n        ColumnFilter columnFilter2 = FilterFactory.notEqualsTo(\"column\", \"val1\");\n        ColumnFilterEditor columnFilterEditor1 = mock(ColumnFilterEditor.class);\n        ColumnFilterEditor columnFilterEditor2 = mock(ColumnFilterEditor.class);\n        when(columnFilterEditor1.getFilter()).thenReturn(columnFilter1);\n        when(columnFilterEditor2.getFilter()).thenReturn(columnFilter2);\n        when(columnFilterEditorBeanDef.newInstance()).thenReturn(columnFilterEditor1, columnFilterEditor2);\n\n        DataSetFilter filter = new DataSetFilter();\n        filter.addFilterColumn(columnFilter1, columnFilter2);\n\n        DataSetFilterEditor filterEditor = new DataSetFilterEditor(filterView, beanManager, changedEvent);\n        filterEditor.init(filter, metadata);\n        filterEditor.onColumnFilterDeleted(new ColumnFilterDeletedEvent(columnFilterEditor2));\n        filterEditor.onColumnFilterDeleted(new ColumnFilterDeletedEvent(columnFilterEditor1));\n\n        assertEquals(filter.getColumnFilterList().size(), 0);\n        verify(filterView).removeColumnFilterEditor(columnFilterEditor1);\n        verify(filterView).removeColumnFilterEditor(columnFilterEditor2);\n        verify(beanManager).destroyBean(columnFilterEditor1);\n        verify(beanManager).destroyBean(columnFilterEditor2);\n        verify(changedEvent, times(2)).fire(any(DataSetFilterChangedEvent.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/LikeToFunctionEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LikeToFunctionEditorTest {\n\n    LikeToFunctionEditor presenter;\n\n    @Mock\n    LikeToFunctionEditor.View view;\n\n    @Mock\n    Command changedEvent;\n\n    @Before\n    public void init() {\n        presenter = new LikeToFunctionEditor(view);\n    }\n\n    @Test\n    public void testShowValue() {\n        presenter.setPattern(\"%val%\");\n        verify(view).setPattern(\"%val%\");\n    }\n\n    @Test\n    public void testParseVoidInput() {\n        when(view.getPattern()).thenReturn(\"\");\n        presenter.viewUpdated();\n        verify(view).error();\n        assertNull(presenter.getPattern());\n    }\n\n    @Test\n    public void testParseInput() {\n        when(view.getPattern()).thenReturn(\"val\");\n        presenter.viewUpdated();\n        assertEquals(presenter.getPattern(), \"val\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/MultipleNumberParameterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MultipleNumberParameterEditorTest {\n\n    MultipleNumberParameterEditor presenter;\n\n    @Mock\n    MultipleNumberParameterEditor.View view;\n\n    @Mock\n    Command changedEvent;\n\n    @Before\n    public void init() {\n        presenter = new MultipleNumberParameterEditor(view);\n    }\n\n    @Test\n    public void testShowSingleValue() {\n        presenter.setValues(Arrays.asList(10d));\n        verify(view).setValue(\"10.0\");\n    }\n\n    @Test\n    public void testShowSingleValue2() {\n        presenter.setValues(Arrays.asList(\"10\"));\n        verify(view).setValue(\"10\");\n    }\n\n    @Test\n    public void testShowMultipleValues() {\n        presenter.setValues(Arrays.asList(10d, 20d, 30d));\n        verify(view).setValue(\"10.0 | 20.0 | 30.0\");\n    }\n\n    @Test\n    public void testParseVoidInput() {\n        when(view.getValue()).thenReturn(\"\");\n        presenter.valueChanged();\n        assertTrue(presenter.getValues().isEmpty());\n        verify(view).error();\n    }\n\n    @Test\n    public void testParseSingleInput() {\n        when(view.getValue()).thenReturn(\"3\");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 1);\n        assertEquals(presenter.getValues().get(0), 3d);\n    }\n\n    @Test\n    public void testMultipleInput() {\n        when(view.getValue()).thenReturn(\"|1| 2 | 3|4|  \");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n        assertEquals(presenter.getValues().get(0), 1d);\n        assertEquals(presenter.getValues().get(1), 2d);\n        assertEquals(presenter.getValues().get(2), 3d);\n        assertEquals(presenter.getValues().get(3), 4d);\n\n        // Endure values are cleared on every change\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n    }\n\n    @Test\n    public void testMultipleInput2() {\n        when(view.getValue()).thenReturn(\",1, 2 , 3,4,  \");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n        assertEquals(presenter.getValues().get(0), 1d);\n        assertEquals(presenter.getValues().get(1), 2d);\n        assertEquals(presenter.getValues().get(2), 3d);\n        assertEquals(presenter.getValues().get(3), 4d);\n    }\n\n    @Test\n    public void testSingleInputError() {\n        when(view.getValue()).thenReturn(\"a\");\n        presenter.valueChanged();\n        assertTrue(presenter.getValues().isEmpty());\n        verify(view).error();\n    }\n\n    @Test\n    public void testMultipleInputError() {\n        when(view.getValue()).thenReturn(\"a,3\");\n        presenter.valueChanged();\n        assertTrue(presenter.getValues().isEmpty());\n        verify(view).error();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/MultipleTextParameterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MultipleTextParameterEditorTest {\n\n    MultipleTextParameterEditor presenter;\n\n    @Mock\n    MultipleTextParameterEditor.View view;\n\n    @Mock\n    Command changedEvent;\n\n    @Before\n    public void init() {\n        presenter = new MultipleTextParameterEditor(view);\n    }\n\n    @Test\n    public void testShowSingleValue() {\n        presenter.setValues(Arrays.asList(\"val\"));\n        verify(view).setValue(\"val\");\n    }\n\n    @Test\n    public void testShowMultipleValues() {\n        presenter.setValues(Arrays.asList(\"val1\", \"val2\", \"val3\"));\n        verify(view).setValue(\"val1 | val2 | val3\");\n    }\n\n    @Test\n    public void testParseVoidInput() {\n        when(view.getValue()).thenReturn(\"\");\n        presenter.valueChanged();\n        assertTrue(presenter.getValues().isEmpty());\n        verify(view).error();\n    }\n\n    @Test\n    public void testParseSingleInput() {\n        when(view.getValue()).thenReturn(\"val\");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 1);\n        assertEquals(presenter.getValues().get(0), \"val\");\n    }\n\n    @Test\n    public void testMultipleInput() {\n        when(view.getValue()).thenReturn(\"|1| 2 | 3|4|  \");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n        assertEquals(presenter.getValues().get(0), \"1\");\n        assertEquals(presenter.getValues().get(1), \"2\");\n        assertEquals(presenter.getValues().get(2), \"3\");\n        assertEquals(presenter.getValues().get(3), \"4\");\n\n        // Endure values are cleared on every change\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n    }\n\n    @Test\n    public void testMultipleInput2() {\n        when(view.getValue()).thenReturn(\",1, 2 , 3,4,  \");\n        presenter.valueChanged();\n        assertEquals(presenter.getValues().size(), 4);\n        assertEquals(presenter.getValues().get(0), \"1\");\n        assertEquals(presenter.getValues().get(1), \"2\");\n        assertEquals(presenter.getValues().get(2), \"3\");\n        assertEquals(presenter.getValues().get(3), \"4\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/NumberParameterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NumberParameterEditorTest {\n\n    NumberParameterEditor presenter;\n\n    @Mock\n    NumberParameterEditor.View view;\n\n    @Mock\n    Command changedEvent;\n\n    @Before\n    public void init() {\n        presenter = new NumberParameterEditor(view);\n    }\n\n    @Test\n    public void testShowValue() {\n        presenter.setValue(10d);\n        verify(view).setValue(\"10.0\");\n    }\n\n    @Test\n    public void testParseVoidInput() {\n        when(view.getValue()).thenReturn(\"\");\n        presenter.valueChanged();\n        assertNull(presenter.getValue());\n        verify(view).error();;\n    }\n\n    @Test\n    public void testParseSingleInput() {\n        when(view.getValue()).thenReturn(\"3\");\n        presenter.valueChanged();\n        verify(view, never()).error();;\n        assertEquals(presenter.getValue(), 3d);\n    }\n\n    @Test\n    public void testInputError() {\n        when(view.getValue()).thenReturn(\"a\");\n        presenter.valueChanged();\n        assertNull(presenter.getValue());\n        verify(view).error();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/TextParameterEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TextParameterEditorTest {\n\n    TextParameterEditor presenter;\n\n    @Mock\n    TextParameterEditor.View view;\n\n    @Mock\n    Command changedEvent;\n\n    @Before\n    public void init() {\n        presenter = new TextParameterEditor(view);\n    }\n\n    @Test\n    public void testShowValue() {\n        presenter.setValue(\"val\");\n        verify(view).setValue(\"val\");\n    }\n\n    @Test\n    public void testParseVoidInput() {\n        when(view.getValue()).thenReturn(\"\");\n        presenter.valueChanged();\n        verify(view).error();\n        assertNull(presenter.getValue());\n    }\n\n    @Test\n    public void testParseInput() {\n        when(view.getValue()).thenReturn(\"val\");\n        presenter.valueChanged();\n        assertEquals(presenter.getValue(), \"val\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/TimeAmountEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TimeAmountEditorTest {\n\n    @Mock\n    TimeAmountEditor.View timeAmountView;\n\n    @Mock\n    Command changeCommand;\n\n    @Test\n    public void testViewInitialization() {\n        TimeAmount timeAmount = new TimeAmount(10, DateIntervalType.DAY);\n        TimeAmountEditor editor = new TimeAmountEditor(timeAmountView);\n        editor.init(timeAmount, changeCommand);\n\n        verify(timeAmountView).clearIntervalTypeSelector();\n        verify(timeAmountView, times(TimeAmountEditor.INTERVAL_TYPES.size())).addIntervalTypeItem(any(DateIntervalType.class));\n        verify(timeAmountView).setSelectedTypeIndex(3);\n        verify(timeAmountView).setQuantity(10);\n    }\n\n    @Test\n    public void testNullInitialization() {\n        TimeAmountEditor editor = new TimeAmountEditor(timeAmountView);\n        editor.init(null, changeCommand);\n\n        verify(timeAmountView).clearIntervalTypeSelector();\n        verify(timeAmountView, times(TimeAmountEditor.INTERVAL_TYPES.size())).addIntervalTypeItem(any(DateIntervalType.class));\n\n        // \"0year\" set by default\n        verify(timeAmountView).setSelectedTypeIndex(7);\n        verify(timeAmountView).setQuantity(0);\n    }\n\n    @Test\n    public void testDecreaseQuantity() {\n        TimeAmount timeAmount = new TimeAmount(10, DateIntervalType.DAY);\n        TimeAmountEditor timeAmountEditor = new TimeAmountEditor(timeAmountView);\n        timeAmountEditor.init(timeAmount, changeCommand);\n        timeAmountEditor.decreaseQuantity();\n\n        verify(timeAmountView).setQuantity(9);\n        verify(changeCommand).execute();\n\n        assertEquals(timeAmount.getQuantity(), 9);\n    }\n\n    @Test\n    public void testIncreaseQuantity() {\n        TimeAmount timeAmount = new TimeAmount(10, DateIntervalType.DAY);\n        TimeAmountEditor timeAmountEditor = new TimeAmountEditor(timeAmountView);\n        timeAmountEditor.init(timeAmount, changeCommand);\n        timeAmountEditor.increaseQuantity();\n\n        verify(timeAmountView).setQuantity(11);\n        verify(changeCommand).execute();\n\n        assertEquals(timeAmount.getQuantity(), 11);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/TimeFrameEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.date.TimeFrame;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TimeFrameEditorTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    Command changeCommand;\n\n    @Mock\n    TimeFrameEditor.View timeFrameView;\n\n    @Mock\n    TimeAmountEditor.View timeAmountView;\n\n    @Mock\n    TimeInstantEditor.View timeInstantView;\n\n    TimeAmountEditor fromAmountEditor;\n    TimeAmountEditor toAmountEditor;\n    TimeInstantEditor fromInstantEditor;\n    TimeInstantEditor toInstantEditor;\n    TimeFrameEditor timeFrameEditor;\n\n    public static final TimeFrame TEN_DAYS = TimeFrame.parse(\"begin[year March] till 10day\");\n    public static final TimeFrame LAST_DAY = TimeFrame.parse(\"now -1day till now\");\n    public static final TimeFrame CURRENT_YEAR = TimeFrame.parse(\"begin[year] till end[year]\");\n    public static final TimeFrame UNDEFINED = null;\n\n    @Before\n    public void init() {\n        fromAmountEditor = new TimeAmountEditor(timeAmountView);\n        toAmountEditor = new TimeAmountEditor(timeAmountView);\n        fromInstantEditor = new TimeInstantEditor(timeInstantView, fromAmountEditor);\n        toInstantEditor = new TimeInstantEditor(timeInstantView, toAmountEditor);\n        timeFrameEditor = new TimeFrameEditor(timeFrameView, beanManager);\n\n        SyncBeanDef tieBeanDef = mock(SyncBeanDef.class);\n        when(beanManager.lookupBean(TimeInstantEditor.class)).thenReturn(tieBeanDef);\n        when(tieBeanDef.newInstance()).thenReturn(fromInstantEditor, toInstantEditor);\n    }\n\n    @Test\n    public void testViewInitialization() {\n        timeFrameEditor.init(TEN_DAYS, changeCommand);\n\n        assertEquals(timeFrameView, timeFrameEditor.view);\n        verify(timeFrameView).init(timeFrameEditor);\n        verify(timeFrameView).clearFirstMonthSelector();\n        verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class));\n        verify(timeFrameView).setSelectedFirstMonthIndex(Month.MARCH.getIndex() - 1);\n    }\n\n    @Test\n    public void testNullInitialization() {\n        timeFrameEditor.init(UNDEFINED, changeCommand);\n\n        assertEquals(timeFrameView, timeFrameEditor.view);\n        verify(timeFrameView).init(timeFrameEditor);\n        verify(timeFrameView).clearFirstMonthSelector();\n        verify(timeFrameView, times(Month.values().length)).addFirstMonthItem(any(Month.class));\n        verify(timeFrameView).setSelectedFirstMonthIndex(Month.JANUARY.getIndex() - 1);\n    }\n\n    @Test\n    public void testChangeTimeAmountQuantity() {\n        TimeFrame timeFrame = TimeFrame.parse(\"now -1year till now\");\n        timeFrameEditor.init(timeFrame, changeCommand);\n\n        long qb = timeFrame.getFrom().getTimeAmount().getQuantity();\n        fromAmountEditor.decreaseQuantity();\n        long qa = timeFrame.getFrom().getTimeAmount().getQuantity();\n\n        verify(changeCommand).execute();\n        assertEquals(qb - 1, qa);\n    }\n\n    @Test\n    public void testChangeTimeAmountType() {\n        TimeFrame timeFrame = TimeFrame.parse(\"now -1year till now\");\n        timeFrameEditor.init(timeFrame, changeCommand);\n\n        when(timeAmountView.getSelectedTypeIndex()).thenReturn(3);\n        fromAmountEditor.changeIntervalType();\n        DateIntervalType type = timeFrame.getFrom().getTimeAmount().getType();\n\n        verify(changeCommand).execute();\n        assertEquals(type, DateIntervalType.DAY);\n    }\n\n    @Test\n    public void testChangeTimeInstant() {\n        TimeFrame timeFrame = TimeFrame.parse(\"now -1year till now\");\n        timeFrameEditor.init(timeFrame, changeCommand);\n\n        when(timeInstantView.getSelectedIntervalTypeIndex()).thenReturn(3);\n        fromInstantEditor.changeIntervalType();\n        DateIntervalType type = timeFrame.getFrom().getIntervalType();\n        verify(changeCommand).execute();\n        assertEquals(type, DateIntervalType.MONTH);\n    }\n\n    @Test\n    public void testFirstMonthAvailable() {\n        timeFrameEditor.init(CURRENT_YEAR, changeCommand);\n        assertEquals(timeFrameEditor.isFirstMonthAvailable(), true);\n    }\n\n    @Test\n    public void testFirstMonthUnavailable() {\n        timeFrameEditor.init(LAST_DAY, changeCommand);\n        assertEquals(timeFrameEditor.isFirstMonthAvailable(), false);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/filter/TimeInstantEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.filter;\n\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.date.TimeInstant;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TimeInstantEditorTest {\n\n    @Mock\n    TimeInstantEditor.View timeInstantView;\n\n    @Mock\n    TimeAmountEditor timeAmountEditor;\n\n    @Mock\n    Command changeCommand;\n\n    @Test\n    public void testViewInitialization() {\n        TimeInstant beginMonth = new TimeInstant(TimeInstant.TimeMode.BEGIN, DateIntervalType.MONTH, Month.JANUARY, new TimeAmount(10, DateIntervalType.DAY));\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(beginMonth, changeCommand);\n\n        assertEquals(timeInstantView, timeInstantEditor.view);\n        verify(timeInstantView).init(timeInstantEditor);\n        verify(timeInstantView).clearTimeModeSelector();\n        verify(timeInstantView, times(TimeInstant.TimeMode.values().length)).addTimeModeItem(any(TimeInstant.TimeMode.class));\n        verify(timeInstantView).setSelectedTimeModeIndex(TimeInstant.TimeMode.BEGIN.getIndex());\n\n        verify(timeInstantView).enableIntervalTypeSelector();\n        verify(timeInstantView).clearIntervalTypeSelector();\n        verify(timeInstantView, times(TimeInstantEditor.INTERVAL_TYPES.size())).addIntervalTypeItem(any(DateIntervalType.class));\n        verify(timeInstantView).setSelectedIntervalTypeIndex(3);\n    }\n\n    @Test\n    public void testNullInitialization() {\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(null, changeCommand);\n\n        assertEquals(timeInstantView, timeInstantEditor.view);\n        verify(timeInstantView).init(timeInstantEditor);\n        verify(timeInstantView).clearTimeModeSelector();\n        verify(timeInstantView, times(TimeInstant.TimeMode.values().length)).addTimeModeItem(any(TimeInstant.TimeMode.class));\n        verify(timeInstantView).setSelectedTimeModeIndex(TimeInstant.TimeMode.NOW.getIndex());\n\n        verify(timeInstantView).disableIntervalTypeSelector();\n        verify(timeInstantView, never()).clearIntervalTypeSelector();\n        verify(timeInstantView, never()).enableIntervalTypeSelector();\n        verify(timeInstantView, never()).addIntervalTypeItem(any(DateIntervalType.class));\n        verify(timeInstantView, never()).setSelectedIntervalTypeIndex(any(Integer.class));\n    }\n\n    @Test\n    public void testChangeTimeMode() {\n        when(timeInstantView.getTimeModeSelectedIndex()).thenReturn(TimeInstant.TimeMode.BEGIN.getIndex());\n\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(null, changeCommand);\n        timeInstantEditor.changeTimeMode();\n\n        TimeInstant timeInstant = timeInstantEditor.getTimeInstant();\n        assertEquals(timeInstant.getTimeMode(), TimeInstant.TimeMode.BEGIN);\n        verify(changeCommand).execute();\n    }\n\n    @Test\n    public void testChangeIntervalType() {\n        when(timeInstantView.getSelectedIntervalTypeIndex()).thenReturn(0);\n\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(null, changeCommand);\n        timeInstantEditor.changeIntervalType();\n\n        TimeInstant timeInstant = timeInstantEditor.getTimeInstant();\n        assertEquals(timeInstant.getIntervalType(), DateIntervalType.MINUTE);\n        verify(changeCommand).execute();\n    }\n\n    @Test\n    public void testSwitchToNow() {\n\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(null, changeCommand);\n\n        reset(timeInstantView);\n        when(timeInstantView.getTimeModeSelectedIndex()).thenReturn(TimeInstant.TimeMode.NOW.getIndex());\n        timeInstantEditor.changeTimeMode();\n\n        TimeInstant timeInstant = timeInstantEditor.getTimeInstant();\n        assertEquals(timeInstant.getTimeMode(), TimeInstant.TimeMode.NOW);\n        verify(timeInstantView).disableIntervalTypeSelector();\n        verify(timeInstantView, never()).enableIntervalTypeSelector();\n        verify(changeCommand).execute();\n    }\n\n    @Test\n    public void testSwitchFromNow() {\n\n        TimeInstantEditor timeInstantEditor = new TimeInstantEditor(timeInstantView, timeAmountEditor);\n        timeInstantEditor.init(null, changeCommand);\n        reset(timeInstantView);\n\n        when(timeInstantView.getTimeModeSelectedIndex()).thenReturn(TimeInstant.TimeMode.END.getIndex());\n        timeInstantEditor.changeTimeMode();\n\n        TimeInstant timeInstant = timeInstantEditor.getTimeInstant();\n        assertEquals(timeInstant.getTimeMode(), TimeInstant.TimeMode.END);\n        verify(timeInstantView).enableIntervalTypeSelector();\n        verify(changeCommand).execute();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/group/ColumnFunctionEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport java.util.List;\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.displayer.client.events.GroupFunctionChangedEvent;\nimport org.dashbuilder.displayer.client.events.GroupFunctionDeletedEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ColumnFunctionEditorTest {\n\n    @Mock\n    ColumnFunctionEditor.View view;\n\n    @Mock\n    ColumnDetailsEditor columnDetailsEditor;\n\n    @Mock\n    Event<GroupFunctionChangedEvent> changeEvent;\n\n    @Mock\n    Event<GroupFunctionDeletedEvent> deleteEvent;\n\n    @Mock\n    DataSetMetadata metadata;\n\n    ColumnFunctionEditor presenter;\n\n    @Before\n    public void init() {\n        presenter = new ColumnFunctionEditor(view, columnDetailsEditor, changeEvent, deleteEvent);\n\n        when(metadata.getNumberOfColumns()).thenReturn(3);\n        when(metadata.getColumnId(0)).thenReturn(\"column1\");\n        when(metadata.getColumnId(1)).thenReturn(\"column2\");\n        when(metadata.getColumnId(2)).thenReturn(\"column3\");\n        when(metadata.getColumnType(0)).thenReturn(ColumnType.LABEL);\n        when(metadata.getColumnType(1)).thenReturn(ColumnType.NUMBER);\n        when(metadata.getColumnType(2)).thenReturn(ColumnType.DATE);\n        when(metadata.getColumnType(\"column1\")).thenReturn(ColumnType.LABEL);\n        when(metadata.getColumnType(\"column2\")).thenReturn(ColumnType.NUMBER);\n    }\n\n    @Test\n    public void testViewInitialization() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", null);\n        presenter.init(metadata, groupFunction, null, \"Title\", false, false);\n\n        verify(view).setDeleteOptionEnabled(false);\n        verify(view, never()).setDeleteOptionEnabled(true);\n\n        verify(view).setColumnSelectorTitle(\"Title\");\n        verify(view).clearColumnSelector();\n        verify(view, times(3)).addColumnItem(anyString());\n        verify(view).setSelectedColumnIndex(0);\n\n        verify(view).setFunctionSelectorEnabled(false);\n        verify(view, never()).setFunctionSelectorEnabled(true);\n    }\n\n    @Test\n    public void testLabelTarget() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", null);\n        presenter.init(metadata, groupFunction, ColumnType.LABEL, \"Title\", true, true);\n\n        verify(view).clearColumnSelector();\n        verify(view, times(1)).addColumnItem(anyString());\n        verify(view).setSelectedColumnIndex(0);\n\n        verify(view).setFunctionSelectorEnabled(false);\n        verify(view, never()).setFunctionSelectorEnabled(true);\n    }\n\n    @Test\n    public void testNumericTarget() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", null);\n        presenter.init(metadata, groupFunction, ColumnType.NUMBER, \"Title\", true, true);\n\n        verify(view).clearColumnSelector();\n        verify(view, times(3)).addColumnItem(anyString());\n        verify(view).setSelectedColumnIndex(0);\n\n        verify(view).setFunctionSelectorEnabled(true);\n        verify(view, never()).setVoidFunctionEnabled(true);\n        verify(view, times(presenter.getSupportedFunctionTypes().size())).addFunctionItem(any(AggregateFunctionType.class));\n        verify(view, never()).setSelectedFunctionIndex(anyInt());\n    }\n\n    @Test\n    public void testUnspecifiedTarget() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", AggregateFunctionType.COUNT);\n        presenter.init(metadata, groupFunction, null, \"Title\", true, true);\n\n        verify(view).clearColumnSelector();\n        verify(view, times(3)).addColumnItem(anyString());\n        verify(view).setSelectedColumnIndex(0);\n\n        List<AggregateFunctionType> supportedFunctions = presenter.getSupportedFunctionTypes();\n        verify(view).setFunctionSelectorEnabled(true);\n        verify(view).setVoidFunctionEnabled(true);\n        verify(view, times(supportedFunctions.size())).addFunctionItem(any(AggregateFunctionType.class));\n        verify(view).setSelectedFunctionIndex(anyInt());\n    }\n\n    @Test\n    public void testSelectColumn() {\n        when(view.getSelectedColumnId()).thenReturn(\"column2\");\n\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", AggregateFunctionType.COUNT);\n        presenter.init(metadata, groupFunction, null, \"Title\", true, true);\n        presenter.onColumnSelected();\n\n        assertEquals(presenter.getGroupFunction().getSourceId(), \"column2\");\n        verify(changeEvent).fire(any(GroupFunctionChangedEvent.class));\n    }\n\n    @Test\n    public void testUpdateFunctionsAvailable() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", AggregateFunctionType.COUNT);\n        presenter.init(metadata, groupFunction, null, \"Title\", true, true);\n\n        List<AggregateFunctionType> typeListColumn1 = presenter.getSupportedFunctionTypes();\n        List<AggregateFunctionType> typeListLabel = presenter.getSupportedFunctionTypes(ColumnType.LABEL);\n        assertEquals(typeListColumn1.size(), typeListLabel.size());\n        verify(view).clearFunctionSelector();\n        verify(view, times(typeListLabel.size())).addFunctionItem(any(AggregateFunctionType.class));\n\n        reset(view);\n        when(view.getSelectedColumnId()).thenReturn(\"column2\");\n        presenter.onColumnSelected();\n\n        List<AggregateFunctionType> typeListColumn2 = presenter.getSupportedFunctionTypes();\n        List<AggregateFunctionType> typeListNumber = presenter.getSupportedFunctionTypes(ColumnType.NUMBER);\n        assertEquals(typeListColumn2.size(), typeListNumber.size());\n        assertEquals(presenter.getGroupFunction().getSourceId(), \"column2\");\n        verify(view).clearFunctionSelector();\n        verify(view, times(typeListNumber.size())).addFunctionItem(any(AggregateFunctionType.class));\n        verify(changeEvent).fire(any(GroupFunctionChangedEvent.class));\n    }\n\n    @Test\n    public void testSelectFunction() {\n        when(view.getSelectedFunctionIndex()).thenReturn(1);\n\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", AggregateFunctionType.COUNT);\n        presenter.init(metadata, groupFunction, null, \"Title\", true, true);\n        presenter.onFunctionSelected();\n\n        List<AggregateFunctionType> supportedFunctions = presenter.getSupportedFunctionTypes();\n        assertEquals(presenter.getGroupFunction().getFunction(), supportedFunctions.get(1));\n        verify(changeEvent).fire(any(GroupFunctionChangedEvent.class));\n    }\n\n    @Test\n    public void testDelete() {\n        GroupFunction groupFunction = new GroupFunction(\"column1\", \"column1\", AggregateFunctionType.COUNT);\n        presenter.init(metadata, groupFunction, null, \"Title\", true, true);\n        presenter.delete();\n\n        verify(deleteEvent).fire(any(GroupFunctionDeletedEvent.class));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/group/DataSetGroupDateEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.group;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.displayer.client.events.DataSetGroupDateChanged;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.group.GroupStrategy.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetGroupDateEditorTest {\n\n    @Mock\n    DataSetGroupDateEditor.View view;\n\n    @Mock\n    Event<DataSetGroupDateChanged> changeEvent;\n\n    DataSetGroupDateEditor presenter;\n\n    @Before\n    public void init() {\n        presenter = new DataSetGroupDateEditor(view, changeEvent);\n    }\n\n    @Test\n    public void testFixedModeInit() {\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, HOUR.toString()));\n\n        verify(view).setFixedModeValue(true);\n        verify(view).clearIntervalTypeSelector();\n        verify(view, times(FIXED_INTERVALS_SUPPORTED.size())).addIntervalTypeItem(any(DateIntervalType.class));\n        verify(view).setSelectedIntervalTypeIndex(anyInt());\n        verify(view, never()).setMaxIntervalsVisibility(true);\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n    }\n\n    @Test\n    public void testDynamicModeInit() {\n        ColumnGroup columnGroup = new ColumnGroup(\"col\", \"col\", DYNAMIC, 15, HOUR.toString());\n        presenter.init(columnGroup);\n\n        verify(view).setFixedModeValue(false);\n        verify(view).clearIntervalTypeSelector();\n        verify(view, times(DateIntervalType.values().length)).addIntervalTypeItem(any(DateIntervalType.class));\n        verify(view).setSelectedIntervalTypeIndex(anyInt());\n        verify(view).setMaxIntervalsVisibility(true);\n        verify(view).setMaxIntervalsValue(\"15\");\n\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n    }\n\n    @Test\n    public void testFirstMonthDayVisibility() {\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, QUARTER.toString()));\n        verify(view).setFirstMonthVisibility(false);\n        verify(view).setFirstDayVisibility(false);\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n\n        reset(view);\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, MONTH.toString()));\n        verify(view).setFirstMonthVisibility(true);\n        verify(view).setFirstDayVisibility(false);\n        verify(view, never()).setFirstDayVisibility(true);\n\n        reset(view);\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, DAY_OF_WEEK.toString()));\n        verify(view).setFirstDayVisibility(true);\n        verify(view).setFirstMonthVisibility(false);\n        verify(view, never()).setFirstMonthVisibility(true);\n\n        reset(view);\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, HOUR.toString()));\n        verify(view).setFirstMonthVisibility(false);\n        verify(view).setFirstDayVisibility(false);\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n\n        reset(view);\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, MINUTE.toString()));\n        verify(view).setFirstMonthVisibility(false);\n        verify(view).setFirstDayVisibility(false);\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n\n        reset(view);\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, SECOND.toString()));\n        verify(view).setFirstMonthVisibility(false);\n        verify(view).setFirstDayVisibility(false);\n        verify(view, never()).setFirstDayVisibility(true);\n        verify(view, never()).setFirstMonthVisibility(true);\n\n    }\n\n    @Test\n    public void testEnableFixedMode() {\n        presenter.init(new ColumnGroup(\"col\", \"col\", DYNAMIC, 15, CENTURY.toString()));\n        reset(view);\n\n        when(view.getFixedModeValue()).thenReturn(true);\n        presenter.onFixedStrategyChanged();\n        verify(changeEvent).fire(any(DataSetGroupDateChanged.class));\n\n        ColumnGroup result = presenter.getColumnGroup();\n        assertEquals(result.getStrategy(), FIXED);\n        verify(view).setFirstMonthVisibility(true);\n        verify(view, never()).setMaxIntervalsVisibility(true);\n        verify(view, never()).setFirstDayVisibility(true);\n    }\n\n    @Test\n    public void testDisableFixedMode() {\n        when(view.getFixedModeValue()).thenReturn(false);\n\n        presenter.init(new ColumnGroup(\"col\", \"col\", FIXED, 15, HOUR.toString()));\n        presenter.onFixedStrategyChanged();\n        verify(changeEvent).fire(any(DataSetGroupDateChanged.class));\n\n        ColumnGroup result = presenter.getColumnGroup();\n        assertEquals(result.getStrategy(), DYNAMIC);\n        verify(view).setMaxIntervalsVisibility(true);\n        verify(view).setMaxIntervalsValue(\"15\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/sourcecode/JsValidatorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class JsValidatorTest {\n\n    @Mock\n    JsEvaluator jsEvaluator;\n\n    DefaultJsValidator validator;\n\n    @Before\n    public void setUp() {\n        validator = new DefaultJsValidator(jsEvaluator);\n    }\n\n    @Test\n    public void testNoError() {\n        String error = validator.validate(\"var a=1; var b = 42+a; alert(b);\", null);\n        assertNull(error);\n    }\n\n    @Test\n    public void testNotAllowed_document() {\n        String error = validator.validate(\"document.getElementById(\\\"\\\");\", null);\n        assertNotNull(error);\n    }\n\n    @Test\n    public void testNotAllowed_window() {\n        String error = validator.validate(\"window.location=\\\"\\\"\", null);\n        assertNotNull(error);\n    }\n\n    @Test\n    public void testNotAllowed_eval() {\n        String error = validator.validate(\"eval(\\\"\\\");\", null);\n        assertNotNull(error);\n        error = validator.validate(\"eval\\n(\\\"\\\");\", null);\n        assertNotNull(error);\n        error = validator.validate(\"eval     (\\\"\\\");\", null);\n        assertNotNull(error);\n        error = validator.validate(\"eval\\t(\\\"\\\");\", null);\n        assertNotNull(error);\n    }\n\n    @Test\n    public void testNotAllowed_innerHtml() {\n        String error = validator.validate(\"this.innerHtml=\\\"\\\"\", null);\n        assertNotNull(error);\n    }\n\n    @Test\n    public void testVariableReplacement() throws Exception {\n        String error = validator.validate(\"${this}.style.cursor=\\\"pointer\\\";\", null);\n        String js = \"function __alert(msg) {};\\nvar __var0__ = document.createElement(\\\"div\\\");\\n__var0__.style.cursor=\\\"pointer\\\";\";\n        verify(jsEvaluator).evaluate(js);\n        assertNull(error);\n\n        doThrow(new Exception(\"error __var0__\")).when(jsEvaluator).evaluate(anyString());\n        error = validator.validate(\"${this}.style.cursor=\\\"pointer\\\";\", null);\n        assertEquals(error, \"error ${this}\");\n    }\n\n    @Test\n    public void testAllowedVariables() throws Exception {\n        List<String> vars = Arrays.asList(\"${this}\");\n        String error = validator.validate(\"${this}.style.cursor=\\\"pointer\\\";\", vars);\n        assertNull(error);\n\n        vars = new ArrayList<>();\n        error = validator.validate(\"${this}.style.cursor=\\\"pointer\\\";\", vars);\n        assertNotNull(error);\n    }\n\n    @Test\n    public void testOcurrences() throws Exception {\n        assertEquals(validator.occurrences(\"\", \"{\"), 0);\n        assertEquals(validator.occurrences(\"{\", \"{\"), 1);\n        assertEquals(validator.occurrences(\"{\", \"}\"), 0);\n        assertEquals(validator.occurrences(\"{}\", \"}\"), 1);\n        assertEquals(validator.occurrences(\"{}\", \"{\"), 1);\n        assertEquals(validator.occurrences(\"{{}}\", \"{\"), 2);\n    }\n\n    @Test\n    public void testIsolateLines() throws Exception {\n        String js = \"if (a) b;\\nelse c;\";\n        String isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) b;\\nc;\\n\");\n\n        js = \"   \";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated.length(), 0);\n\n        js = \"if (a) {\\nb;\\n} else c;\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) {}\\nb;\\n{} c;\\n\");\n\n        js = \"if (a) {\\nb; }\\nelse c;\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) {}\\nb; \\nc;\\n\");\n\n        js = \"if (a)\\n{ b;\\n} else c;\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a)\\n b;\\n{} c;\\n\");\n\n        js = \"if (a) { b; } else c;\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) { b; } c;\\n\");\n\n        js = \"if (a) { if (b) {}}\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) { if (b) {}}\\n\");\n\n        js = \"if (a) {\\nif (b) {\\n}\\n}\";\n        isolated = validator.isolateLines(js);\n        assertEquals(isolated, \"if (a) {}\\nif (b) {}\\n\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-client/src/test/java/org/dashbuilder/displayer/client/widgets/sourcecode/SourceCodeEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.widgets.sourcecode;\n\nimport java.util.HashMap;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SourceCodeEditorTest {\n\n    @Mock\n    SourceCodeEditor.View view;\n\n    @Mock\n    Command onChange;\n\n    @Mock\n    HtmlValidator htmlValidator;\n\n    @Mock\n    JsValidator jsValidator;\n\n    SourceCodeEditor presenter;\n\n    @Before\n    public void init() {\n        presenter = new SourceCodeEditor(view, htmlValidator, jsValidator);\n        presenter.init(SourceCodeType.HTML, \"Hi\", new HashMap<>(), onChange);\n    }\n\n    @Test\n    public void testInitialization() {\n        verify(view).edit(SourceCodeType.HTML, \"Hi\");\n    }\n\n    @Test\n    public void testEmpty() {\n        reset(htmlValidator);\n        presenter.init(SourceCodeType.HTML, null, new HashMap<>(), onChange);\n        verify(htmlValidator, never()).validate(any());\n\n        reset(htmlValidator);\n        presenter.init(SourceCodeType.HTML, \"\", new HashMap<>(), onChange);\n        verify(htmlValidator, never()).validate(any());\n\n        reset(jsValidator);\n        presenter.init(SourceCodeType.JAVASCRIPT, null, new HashMap<>(), onChange);\n        verify(jsValidator, never()).validate(any(), anyCollection());\n\n        reset(jsValidator);\n        presenter.init(SourceCodeType.JAVASCRIPT, \"\", new HashMap<>(), onChange);\n        verify(jsValidator, never()).validate(any(), anyCollection());\n    }\n\n    @Test\n    public void testOnChange() {\n        presenter.onSourceCodeChanged(\"howdy?\");\n\n        assertEquals(presenter.getCode(), \"howdy?\");\n        assertEquals(presenter.hasErrors(), false);\n        verify(htmlValidator).validate(\"howdy?\");\n        verify(onChange).execute();\n        verify(view, never()).error(anyString());\n    }\n\n    @Test\n    public void testError() {\n        when(htmlValidator.validate(\"howdy?\")).thenReturn(\"Error\");\n        boolean ok = presenter.onSourceCodeChanged(\"howdy?\");\n\n        assertFalse(ok);\n        assertEquals(presenter.getCode(), \"Hi\");\n        assertEquals(presenter.hasErrors(), true    );\n        verify(htmlValidator).validate(\"howdy?\");\n        verify(onChange, never()).execute();\n        verify(view).error(\"Error\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-displayer-editor</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Displayer Editor Widgets</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-screen</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/AreaChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class AreaChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public AreaChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.AREACHART;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-area-chart\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_areachart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/BarChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\npublic class BarChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public BarChartDragComponent(SyncBeanManager beanManager,\n                                 DisplayerViewer viewer,\n                                 PlaceManager placeManager,\n                                 PerspectiveCoordinator perspectiveCoordinator) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.BARCHART;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-bar-chart\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_barchart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/BubbleChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class BubbleChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public BubbleChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.BUBBLECHART;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_bubblechart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/DisplayerDragComponent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerEditorPopup;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport java.util.Map;\n\n@Dependent\npublic class DisplayerDragComponent implements LayoutDragComponent, HasModalConfiguration {\n\n    SyncBeanManager beanManager;\n    DisplayerViewer viewer;\n    PlaceManager placeManager;\n    PerspectiveCoordinator perspectiveCoordinator;\n    DisplayerSettingsJSONMarshaller marshaller;\n\n    @Inject\n    public DisplayerDragComponent(SyncBeanManager beanManager,\n                                  DisplayerViewer viewer,\n                                  PlaceManager placeManager,\n                                  PerspectiveCoordinator perspectiveCoordinator) {\n\n        this.beanManager = beanManager;\n        this.viewer = viewer;\n        this.placeManager = placeManager;\n        this.perspectiveCoordinator = perspectiveCoordinator;\n        this.marshaller = DisplayerSettingsJSONMarshaller.get();\n    }\n\n    public DisplayerType getDisplayerType() {\n        return null;\n    }\n\n    public DisplayerSubType getDisplayerSubType() {\n        return null;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.DisplayerComponent();\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(final RenderingContext ctx) {\n        return getShowWidget(ctx);\n    }\n\n    @Override\n    public IsWidget getShowWidget(final RenderingContext ctx) {\n        Map<String, String> properties = ctx.getComponent().getProperties();\n        String json = properties.get(\"json\");\n        if (json == null) {\n            return null;\n        }\n\n        final DisplayerSettings settings = marshaller.fromJsonString(json);\n        viewer.removeFromParent();\n        viewer.init(settings);\n        viewer.addAttachHandler(attachEvent -> {\n            if (attachEvent.isAttached()) {\n                final int offsetWidth = ctx.getContainer().getOffsetWidth();\n                int containerWidth = offsetWidth > 40 ? offsetWidth - 40 : 0;\n                adjustSize(settings, containerWidth);\n                Displayer displayer = viewer.draw();\n                perspectiveCoordinator.addDisplayer(displayer);\n            }\n        });\n        int containerWidth = ctx.getContainer().getOffsetWidth() - 40;\n        adjustSize(settings, containerWidth);\n        Displayer displayer = viewer.draw();\n        perspectiveCoordinator.addDisplayer(displayer);\n        return viewer;\n    }\n\n    @Override\n    public Modal getConfigurationModal(final ModalConfigurationContext ctx) {\n        return buildEditorPopUp(ctx);\n    }\n\n    @Override\n    public void removeCurrentWidget(RenderingContext ctx) {\n        Displayer displayer = viewer.getDisplayer();\n        if (displayer != null) {\n            perspectiveCoordinator.removeDisplayer(displayer);\n            displayer.close();\n        }\n    }\n\n    protected DisplayerEditorPopup buildEditorPopUp(final ModalConfigurationContext ctx) {\n        Map<String, String> properties = ctx.getComponentProperties();\n        String json = properties.get(\"json\");\n        DisplayerSettings settings = json != null ? marshaller.fromJsonString(json) : initialSettings(ctx);\n        DisplayerEditorPopup editor = beanManager.lookupBean(DisplayerEditorPopup.class).newInstance();\n\n        // For brand new components set the default type/subtype to create\n        if (settings == null) {\n            if (getDisplayerType() != null) {\n                editor.setDisplayerType(getDisplayerType());\n            }\n            if (getDisplayerSubType() != null) {\n                editor.setDisplayerSubType(getDisplayerSubType());\n            }\n        }\n\n        editor.init(settings);\n        editor.setOnSaveCommand(getSaveCommand(editor, ctx));\n        editor.setOnCloseCommand(getCloseCommand(editor, ctx));\n        return editor;\n    }\n\n    protected DisplayerSettings initialSettings(final ModalConfigurationContext ct) {\n        return null;\n    }\n\n    protected Command getSaveCommand(final DisplayerEditorPopup editor, final ModalConfigurationContext ctx) {\n        return () -> {\n            String json = marshaller.toJsonString(editor.getDisplayerSettings());\n            ctx.setComponentProperty(\"json\", json);\n            ctx.configurationFinished();\n            beanManager.destroyBean(editor);\n        };\n    }\n\n    protected Command getCloseCommand(final DisplayerEditorPopup editor, final ModalConfigurationContext ctx) {\n        return () -> {\n            ctx.configurationCancelled();\n            beanManager.destroyBean(editor);\n        };\n    }\n\n    protected void adjustSize(DisplayerSettings settings, int containerWidth) {\n        int displayerWidth = settings.getChartWidth();\n        int tableWidth = settings.getTableWidth();\n        if (containerWidth > 0 && displayerWidth > containerWidth) {\n            int ratio = containerWidth * 100 / displayerWidth;\n            settings.setChartWidth(containerWidth);\n            settings.setChartHeight(settings.getChartHeight() * ratio / 100);\n        }\n        if (tableWidth == 0 || tableWidth > containerWidth) {\n            settings.setTableWidth(containerWidth > 20 ? containerWidth - 20 : 0);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/DisplayerEditorEntryPoint.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport javax.annotation.PostConstruct;\n\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.jboss.errai.ioc.client.api.AfterInitialization;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\n\n@EntryPoint\npublic class DisplayerEditorEntryPoint {\n\n    /**\n     * https://issues.jboss.org/browse/DASHBUILDE-105 => Sometimes, due to unknown reasons, the Displayer editor\n     * does not show all the attributes in the \"Display\" tab The fix is to force the DisplayerAttributeDef static\n     * fields to initialize on startup.\n     */\n    @PostConstruct\n    public void init() {\n        DisplayerAttributeDef def = DisplayerAttributeDef.TITLE;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/LineChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class LineChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public LineChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.LINECHART;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-line-chart\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_linechart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/MapChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class MapChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public MapChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.MAP;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-map\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_mapchart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/MeterChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class MeterChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public MeterChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.METERCHART;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-tachometer\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_meterchart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/MetricDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class MetricDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public MetricDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.METRIC;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-calculator\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_metric();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/PerspectiveEditorReportingGroupProvider.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorComponentGroupProvider;\n\nimport static org.dashbuilder.displayer.DisplayerType.AREACHART;\nimport static org.dashbuilder.displayer.DisplayerType.BARCHART;\nimport static org.dashbuilder.displayer.DisplayerType.BUBBLECHART;\nimport static org.dashbuilder.displayer.DisplayerType.LINECHART;\nimport static org.dashbuilder.displayer.DisplayerType.MAP;\nimport static org.dashbuilder.displayer.DisplayerType.METERCHART;\nimport static org.dashbuilder.displayer.DisplayerType.METRIC;\nimport static org.dashbuilder.displayer.DisplayerType.PIECHART;\nimport static org.dashbuilder.displayer.DisplayerType.SELECTOR;\nimport static org.dashbuilder.displayer.DisplayerType.TABLE;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\n/**\n * {@link PerspectiveEditorComponentGroupProvider} holding all the chart displayer components\n */\n@ApplicationScoped\npublic class PerspectiveEditorReportingGroupProvider implements PerspectiveEditorComponentGroupProvider {\n\n    private SyncBeanManager beanManager;\n    private Constants i18n = Constants.INSTANCE;\n    private RendererManager rendererManager;\n\n    @Inject\n    public PerspectiveEditorReportingGroupProvider(SyncBeanManager beanManager, \n                                                   RendererManager rendererManager) {\n        this.beanManager = beanManager;\n        this.rendererManager = rendererManager;\n    }\n\n    @Override\n    public String getName() {\n        return i18n.drag_group_name_reporting();\n    }\n\n    @Override\n    public LayoutDragComponentGroup getComponentGroup() {\n        LayoutDragComponentGroup group = new LayoutDragComponentGroup(getName());\n        addComponent(BARCHART, group, i18n.drag_component_name_barchart(), BarChartDragComponent.class);\n        addComponent(PIECHART, group, i18n.drag_component_name_piechart(), PieChartDragComponent.class);\n        addComponent(LINECHART, group, i18n.drag_component_name_linechart(), LineChartDragComponent.class);\n        addComponent(AREACHART, group, i18n.drag_component_name_areachart(), AreaChartDragComponent.class);\n        addComponent(BUBBLECHART, group, i18n.drag_component_name_bubblechart(), BubbleChartDragComponent.class);\n        addComponent(METERCHART, group, i18n.drag_component_name_meterchart(), MeterChartDragComponent.class);\n        addComponent(MAP, group, i18n.drag_component_name_mapchart(), MapChartDragComponent.class);\n        addComponent(METRIC, group, i18n.drag_component_name_metric(), MetricDragComponent.class);\n        addComponent(TABLE, group, i18n.drag_component_name_table(), TableDragComponent.class);\n        addComponent(SELECTOR, group, i18n.drag_component_name_filter(), SelectorDragComponent.class);\n        return group;\n    }\n\n    private void addComponent(DisplayerType type, LayoutDragComponentGroup group, String name, Class dragClass) {\n        if (rendererManager.isTypeSupported(type)) {\n            group.addLayoutDragComponent(name, lookupDisplayerComponent(dragClass));\n        }\n    }\n    \n    protected DisplayerDragComponent lookupDisplayerComponent(Class dragClass) {\n        SyncBeanDef<DisplayerDragComponent> displayerBeanDef = beanManager.lookupBean(dragClass);\n        return displayerBeanDef.newInstance();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/PieChartDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class PieChartDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public PieChartDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.PIECHART;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-pie-chart\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_piechart();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/SelectorDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class SelectorDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public SelectorDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.SELECTOR;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-filter\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_filter();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/TableDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class TableDragComponent extends DisplayerDragComponent {\n\n    @Inject\n    public TableDragComponent(SyncBeanManager beanManager,\n            DisplayerViewer viewer,\n            PlaceManager placeManager,\n            PerspectiveCoordinator perspectiveCoordinator ) {\n\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.TABLE;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-table\";\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return Constants.INSTANCE.drag_component_name_table();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/external/ComponentGroupProducer.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.editor.external;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.editor.resources.i18n.Constants;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentPalette;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.plugin.client.perspective.editor.events.PerspectiveEditorFocusEvent;\n\n@ApplicationScoped\npublic class ComponentGroupProducer {\n\n    private static final Constants i18n = Constants.INSTANCE;\n\n    private SyncBeanManager beanManager;\n    private LayoutDragComponentPalette layoutDragComponentPalette;\n    private Caller<ComponentService> componentService;\n\n    @Inject\n    public ComponentGroupProducer(Caller<ComponentService> externalComponentService,\n                                  SyncBeanManager beanManager,\n                                  LayoutDragComponentPalette layoutDragComponentPalette) {\n        this.componentService = externalComponentService;\n        this.beanManager = beanManager;\n        this.layoutDragComponentPalette = layoutDragComponentPalette;\n    }\n\n    public void onEditorFocus(@Observes PerspectiveEditorFocusEvent event) {\n        loadComponents();\n    }\n\n    public void loadComponents() {\n\n        componentService.call((List<ExternalComponent> components) -> {\n            addProvidedComponents(components.stream()\n                                            .filter(c -> c.isProvided())\n                                            .collect(Collectors.toList()));\n            addExternalComponents(components.stream()\n                                            .filter(c -> !c.isProvided())\n                                            .collect(Collectors.toList()));\n        }).listAllComponents();\n\n    }\n\n    public void addExternalComponents(List<ExternalComponent> components) {\n        String groupId = i18n.externalComponentsGroupName();\n        if (!components.isEmpty()) {\n            checkGroup(groupId);\n        }\n        components.forEach(comp -> {\n            layoutDragComponentPalette.addDraggableComponent(groupId,\n                                                             comp.getId(),\n                                                             produceDragComponent(comp));\n        });\n\n    }\n\n    public void addProvidedComponents(List<ExternalComponent> components) {\n        components.stream().forEach(component -> {\n            String groupId = component.getCategory() != null ? component.getCategory() : i18n.internalComponentsGroupName();\n            checkGroup(groupId);\n            layoutDragComponentPalette.addDraggableComponent(groupId, component.getId(), produceDragComponent(component));\n        });\n\n    }\n\n    private void checkGroup(String groupId) {\n        if (!layoutDragComponentPalette.hasDraggableGroup(groupId)) {\n            layoutDragComponentPalette.addDraggableGroup(new LayoutComponentPaletteGroupProvider() {\n\n                @Override\n                public String getName() {\n                    return groupId;\n                }\n\n                @Override\n                public LayoutDragComponentGroup getComponentGroup() {\n                    return new LayoutDragComponentGroup(groupId);\n                }\n            });\n        }\n\n    }\n\n    ExternalComponentDragDef produceDragComponent(ExternalComponent comp) {\n        ExternalComponentDragDef dragComp;\n        if (comp.isNoData()) {\n            dragComp = beanManager.lookupBean(ExternalDragComponent.class).getInstance();\n        } else {\n            dragComp = beanManager.lookupBean(ExternalDisplayerDragComponent.class).getInstance();\n        }\n        dragComp.setDragInfo(comp.getName(), comp.getIcon());\n        dragComp.setComponentId(comp.getId());\n        return dragComp;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/external/ExternalComponentDragDef.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.editor.external;\n\nimport java.util.Collections;\nimport java.util.Map;\n\nimport org.uberfire.ext.layout.editor.client.api.HasDragAndDropSettings;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\n\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\n\npublic interface ExternalComponentDragDef extends LayoutDragComponent, HasDragAndDropSettings {\n\n    public default String getDragComponentTitle() {\n        final String componentName = getComponentName();\n        return componentName == null ? \"Unknown\" : componentName;\n    }\n\n    public default String getDragComponentIconClass() {\n        final String componentIcon = getComponentIcon();\n        return componentIcon != null ? componentIcon : LayoutDragComponent.super.getDragComponentIconClass();\n    }\n\n    public default String[] getSettingsKeys() {\n        return new String[]{COMPONENT_ID_KEY};\n    }\n\n    public default String getSettingValue(String key) {\n        if (COMPONENT_ID_KEY.equals(key)) {\n            return getComponentId();\n        }\n        return null;\n    }\n\n    public default void setSettingValue(String key, String value) {\n        if (COMPONENT_ID_KEY.equals(key)) {\n            setComponentId(value);\n        }\n    }\n\n    public default Map<String, String> getMapSettings() {\n        return Collections.singletonMap(COMPONENT_ID_KEY, getComponentId());\n    }\n\n    String getComponentName();\n\n    String getComponentIcon();\n\n    String getComponentId();\n\n    void setComponentId(String componentId);\n\n    void setDragInfo(String componentName, String componentIcon);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/external/ExternalDisplayerDragComponent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.editor.external;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.editor.DisplayerDragComponent;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.client.events.DisplayerSettingsChangedEvent;\nimport org.dashbuilder.displayer.client.prototypes.DisplayerPrototypes;\nimport org.dashbuilder.displayer.client.widgets.DisplayerEditorPopup;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\n\nimport static org.dashbuilder.displayer.DisplayerType.EXTERNAL_COMPONENT;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\n\n@Dependent\npublic class ExternalDisplayerDragComponent extends DisplayerDragComponent implements ExternalComponentDragDef {\n\n    String componentId;\n\n    private String componentName;\n\n    private String componentIcon;\n\n    @Inject\n    Event<DisplayerSettingsChangedEvent> displayerSettingsChangedEvent;\n\n    @Inject\n    DisplayerPrototypes displayerPrototypes;\n\n    @Inject\n    public ExternalDisplayerDragComponent(SyncBeanManager beanManager,\n                                          DisplayerViewer viewer,\n                                          PlaceManager placeManager,\n                                          PerspectiveCoordinator perspectiveCoordinator) {\n        super(beanManager, viewer, placeManager, perspectiveCoordinator);\n    }\n\n    @Override\n    public void setDragInfo(String componentName, String componentIcon) {\n        this.componentName = componentName;\n        this.componentIcon = componentIcon;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        DisplayerEditorPopup editorPopUp = buildEditorPopUp(ctx);\n        editorPopUp.setTypeSelectorEnabled(false);\n        editorPopUp.setExternalDisplayerEnabled(true);\n        return editorPopUp;\n    }\n\n    @Override\n    protected DisplayerSettings initialSettings(ModalConfigurationContext ctx) {\n        DisplayerSettings settings = displayerPrototypes.getProto(EXTERNAL_COMPONENT);\n        String storedComponentId = ctx.getComponentProperty(COMPONENT_ID_KEY);\n        settings.setComponentId(storedComponentId);\n        return settings;\n    }\n\n    @Override\n    public DisplayerType getDisplayerType() {\n        return DisplayerType.EXTERNAL_COMPONENT;\n    }\n\n    public void setComponentId(String componentId) {\n        this.componentId = componentId;\n    }\n\n    @Override\n    public String getComponentName() {\n        return componentName;\n    }\n\n    @Override\n    public String getComponentIcon() {\n        return componentIcon;\n    }\n\n    @Override\n    public String getComponentId() {\n        return componentId;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return ExternalComponentDragDef.super.getDragComponentTitle();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/external/ExternalDragComponent.java",
    "content": "package org.dashbuilder.client.editor.external;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.displayer.client.widgets.ExternalComponentEditorPopUp;\nimport org.dashbuilder.displayer.client.widgets.ExternalComponentPresenter;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.mvp.Command;\n\nimport static java.util.stream.Collectors.toMap;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_PARTITION_KEY;\n\n@Dependent\npublic class ExternalDragComponent implements ExternalComponentDragDef, HasModalConfiguration {\n\n    @Inject\n    SyncBeanManager beanManager;\n    @Inject\n    ExternalComponentPresenter externalComponentPresenter;\n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    private String componentId;\n    private String componentName;\n    private String componentIcon;\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return getShowWidget(ctx);\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        Map<String, String> ltProps = ctx.getComponent().getProperties();\n        String storedComponentId = ltProps.get(COMPONENT_ID_KEY);\n        String partition = ltProps.get(COMPONENT_PARTITION_KEY);\n        if (storedComponentId == null) {\n            return new Label(\"Component not found.\");\n        }\n        \n        if (partition != null) {\n            externalComponentPresenter.withComponent(storedComponentId, partition);\n        } else {\n            externalComponentPresenter.withComponent(storedComponentId);\n        }\n        \n        Map<String, Object> componentProperties = new HashMap<>(retrieveComponentProperties(storedComponentId, ltProps));\n        ExternalComponentMessage message = messageHelper.newInitMessage(componentProperties);\n        externalComponentPresenter.sendMessage(message);\n        \n        return externalComponentPresenter.getView();\n    }\n\n    @Override\n    public String getComponentName() {\n        return componentName;\n    }\n\n    @Override\n    public String getComponentIcon() {\n        return componentIcon;\n    }\n\n    @Override\n    public String getComponentId() {\n        return componentId;\n    }\n\n    @Override\n    public void setComponentId(String componentId) {\n        this.componentId = componentId;\n    }\n\n    @Override\n    public void setDragInfo(String componentName, String componentIcon) {\n        this.componentName = componentName;\n        this.componentIcon = componentIcon;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        String storedComponentId = ctx.getComponentProperty(COMPONENT_ID_KEY);\n        ExternalComponentEditorPopUp editor = beanManager.lookupBean(ExternalComponentEditorPopUp.class).newInstance();\n        Map<String, String> existingProps = retrieveComponentProperties(storedComponentId, ctx.getComponentProperties());\n        editor.init(storedComponentId,\n                    existingProps,\n                    getCloseCommand(editor, ctx),\n                    getSaveCommand(storedComponentId, editor, ctx));\n        return editor;\n    }\n\n    protected Command getSaveCommand(String componentId, final ExternalComponentEditorPopUp editor, final ModalConfigurationContext ctx) {\n        return () -> {\n            editor.getProperties().forEach((k, v) -> {\n                String key = appendComponentPrefix(componentId, k);\n                ctx.getComponentProperties().put(key, v);\n            });\n            ctx.configurationFinished();\n            beanManager.destroyBean(editor);\n        };\n    }\n\n    protected Command getCloseCommand(final ExternalComponentEditorPopUp editor, final ModalConfigurationContext ctx) {\n        return () -> {\n            ctx.configurationCancelled();\n            beanManager.destroyBean(editor);\n        };\n    }\n\n    private Map<String, String> retrieveComponentProperties(String componentId, Map<String, String> componentProperties) {\n        String prefix = getComponentPrefix(componentId);\n        return componentProperties.entrySet()\n                                  .stream().filter(e -> e.getKey().startsWith(prefix))\n                                  .collect(toMap(e -> removeComponentPrefix(componentId, e.getKey()),\n                                                 Map.Entry::getValue));\n    }\n\n    private String getComponentPrefix(String componentId) {\n        return componentId + \".\";\n    }\n\n    private String appendComponentPrefix(String componentId, String key) {\n        return componentId + \".\" + key;\n    }\n\n    private String removeComponentPrefix(String componentId, String key) {\n        return key.replaceFirst(componentId + \".\", \"\");\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/java/org/dashbuilder/client/editor/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface Constants extends Messages {\n\n    public static final Constants INSTANCE = GWT.create( Constants.class );\n\n    String displayer_perspective_editor_title();\n\n    String DisplayerComponent();\n\n    String drag_group_name_reporting();\n\n    String drag_component_name_barchart();\n\n    String drag_component_name_piechart();\n\n    String drag_component_name_areachart();\n\n    String drag_component_name_linechart();\n\n    String drag_component_name_bubblechart();\n\n    String drag_component_name_meterchart();\n\n    String drag_component_name_mapchart();\n\n    String drag_component_name_metric();\n\n    String drag_component_name_table();\n\n    String drag_component_name_filter();\n\n    String externalComponentsGroupName();\n\n    String internalComponentsGroupName();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.client.editor.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/DisplayerEditor.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <inherits name='org.jboss.errai.ioc.Container'/>\n\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginClient\"/>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_perspective_editor_title=Edit Displayer\nDisplayerComponent=Displayer\ndrag_group_name_reporting=Reporting\ndrag_component_name_barchart=Bar\ndrag_component_name_piechart=Pie\ndrag_component_name_areachart=Area\ndrag_component_name_linechart=Line\ndrag_component_name_bubblechart=Bubble\ndrag_component_name_meterchart=Meter\ndrag_component_name_mapchart=Map\ndrag_component_name_metric=Metric\ndrag_component_name_table=Table\ndrag_component_name_filter=Filter\nexternalComponentsGroupName=External Components\ninternalComponentsGroupName=Components"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_de.properties",
    "content": "displayer_perspective_editor_title=Displayer bearbeiten\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_perspective_editor_title=Editar visualizador\nDisplayerComponent=Visualizador\ndrag_group_name_reporting=Generación de informes\ndrag_component_name_barchart=Barra\ndrag_component_name_piechart=Circular\ndrag_component_name_areachart=Área\ndrag_component_name_linechart=Línea\ndrag_component_name_bubblechart=Burbuja\ndrag_component_name_meterchart=Medidor\ndrag_component_name_mapchart=Mapa\ndrag_component_name_metric=Métrica\ndrag_component_name_table=Tabla\ndrag_component_name_filter=Filtro\nexternalComponentsGroupName=Componentes externos\ninternalComponentsGroupName=Componentes"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_perspective_editor_title=Modifier l''afficheur\nDisplayerComponent=Afficheur\ndrag_group_name_reporting=Rapports\ndrag_component_name_barchart=Barres\ndrag_component_name_piechart=Secteurs\ndrag_component_name_areachart=Aires\ndrag_component_name_linechart=Ligne\ndrag_component_name_bubblechart=Bulles\ndrag_component_name_meterchart=Compteur\ndrag_component_name_mapchart=Carte\ndrag_component_name_metric=Métrique\ndrag_component_name_table=Tableau\ndrag_component_name_filter=Filtrer\nexternalComponentsGroupName=Composants externes\ninternalComponentsGroupName=Composants"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_perspective_editor_title=Modifica Displayer\nDisplayerComponent=Displayer\ndrag_group_name_reporting=Reporting\ndrag_component_name_barchart=Grafico a barre\ndrag_component_name_piechart=Grafico a torta\ndrag_component_name_areachart=Grafico ad area\ndrag_component_name_linechart=Grafico a linea\ndrag_component_name_bubblechart=Grafico a bolle\ndrag_component_name_meterchart=Grafico a misuratore\ndrag_component_name_mapchart=Mappa\ndrag_component_name_metric=Metrica\ndrag_component_name_table=Tabella\ndrag_component_name_filter=Filtro\nexternalComponentsGroupName=Componenti Esterni\ninternalComponentsGroupName=Componenti Interni"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ndisplayer_perspective_editor_title=ディスプレイヤーの編集\nDisplayerComponent=ディスプレイヤー\ndrag_group_name_reporting=レポート\ndrag_component_name_barchart=バー\ndrag_component_name_piechart=円 (パイ)\ndrag_component_name_areachart=エリア\ndrag_component_name_linechart=Line\ndrag_component_name_bubblechart=バブル\ndrag_component_name_meterchart=メーター\ndrag_component_name_mapchart=マップ\ndrag_component_name_metric=メトリック\ndrag_component_name_table=テーブル\ndrag_component_name_filter=フィルター\nexternalComponentsGroupName=外部コンポーネント\ninternalComponentsGroupName=コンポーネント"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_pt_BR.properties",
    "content": "displayer_perspective_editor_title=Editar Exibidor\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/main/resources/org/dashbuilder/client/editor/resources/i18n/Constants_zh_CN.properties",
    "content": "displayer_perspective_editor_title=编辑显示屏\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/test/java/org/dashbuilder/client/editor/DisplayerDragComponentTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.widgets.DisplayerEditorPopup;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\n\nimport java.util.Map;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DisplayerDragComponentTest {\n\n    @InjectMocks\n    DisplayerDragComponent displayerDragComponent;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<DisplayerEditorPopup> editorBeanDef;\n\n    @Mock\n    DisplayerEditorPopup editorPopup;\n\n    @Mock\n    ModalConfigurationContext configurationContext;\n\n    @Mock\n    Map<String,String> configurationProperties;\n\n    @InjectMocks\n    LineChartDragComponent lineChartDragComponent;\n\n    @Before\n    public void setUp(){\n        when(configurationContext.getComponentProperties()).thenReturn(configurationProperties);\n        when(beanManager.lookupBean(DisplayerEditorPopup.class)).thenReturn(editorBeanDef);\n        when(editorBeanDef.newInstance()).thenReturn(editorPopup);\n    }\n\n    @Test\n    public void testDefaultDisplayerType() {\n        assertEquals(lineChartDragComponent.getDisplayerType(), DisplayerType.LINECHART);\n        assertEquals(lineChartDragComponent.getDisplayerSubType(), null);\n\n        lineChartDragComponent.getConfigurationModal(configurationContext);\n        verify(editorPopup).setDisplayerType(DisplayerType.LINECHART);\n        verify(editorPopup, never()).setDisplayerSubType(any());\n    }\n\n    @Test\n    public void testDoNotSetDisplayerType() {\n        when(configurationProperties.get(\"json\")).thenReturn(\"\");\n        lineChartDragComponent.getConfigurationModal(configurationContext);\n        verify(editorPopup, never()).setDisplayerType(any());\n        verify(editorPopup, never()).setDisplayerSubType(any());\n    }\n\n    @Test\n    public void testAdjustSize(){\n        final DisplayerSettings settings = mock(DisplayerSettings.class);\n        when(settings.getChartWidth()).thenReturn(0);\n        when(settings.getTableWidth()).thenReturn(0);\n\n        displayerDragComponent.adjustSize(settings, 0);\n\n        verify(settings).setTableWidth(0);\n\n        displayerDragComponent.adjustSize(settings, 30);\n\n        verify(settings).setTableWidth(10);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/test/java/org/dashbuilder/client/editor/PerspectiveEditorReportingGroupProviderTest.java",
    "content": "package org.dashbuilder.client.editor;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.when;\n\nimport java.util.Arrays;\n\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.RendererLibrary;\nimport org.dashbuilder.displayer.client.RendererManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PerspectiveEditorReportingGroupProviderTest {\n\n    @Mock\n    RendererManager rendererManager;\n    \n    @Mock\n    SyncBeanManager beanManager;\n    \n    @InjectMocks\n    PerspectiveEditorReportingGroupProvider perspectiveEditorReportingGroupProvider;\n    \n    @Mock\n    RendererLibrary rendererLibrary;\n    \n    @Mock\n    SyncBeanDef<DisplayerDragComponent> displayerDragComponentBeanDef;\n    \n    @Mock DisplayerDragComponent displayerDragComponent;\n    \n    @Before\n    public void setUp() {\n        when(beanManager.lookupBean(any(DisplayerDragComponent.class.getClass())))\n                        .thenReturn(displayerDragComponentBeanDef);\n        when(displayerDragComponentBeanDef.getInstance()).thenReturn(displayerDragComponent);\n    }\n    \n    @Test\n    public void groupShouldBeEmptyWhenTheresNoRendererTest() {\n        LayoutDragComponentGroup componentGroup = perspectiveEditorReportingGroupProvider.getComponentGroup();\n        assertTrue(componentGroup.getLayoutDragComponentIds().isEmpty());\n    }\n    \n    @Test\n    public void groupShouldHaveNComponentWhenTheresRendererTest() {\n        when(rendererManager.isTypeSupported(DisplayerType.BARCHART)).thenReturn(true);\n        when(rendererManager.isTypeSupported(DisplayerType.LINECHART)).thenReturn(true);\n        LayoutDragComponentGroup componentGroup = perspectiveEditorReportingGroupProvider.getComponentGroup();\n        assertEquals(componentGroup.getLayoutDragComponentIds().size(), 2);\n    }\n    \n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-editor/src/test/java/org/dashbuilder/client/editor/external/ExternalComponentGroupProviderTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.editor.external;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExternalComponentGroupProviderTest {\n\n    @Mock\n    ExternalDragComponent drag1;\n    @Mock\n    SyncBeanDef<ExternalDragComponent> c1Bean;\n    @Mock\n    ExternalComponent c1;\n\n    @Mock\n    ExternalDisplayerDragComponent drag2;\n    @Mock\n    SyncBeanDef<ExternalDisplayerDragComponent> c2Bean;\n    @Mock\n    ExternalComponent c2;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @InjectMocks\n    ComponentGroupProducer componentGroupProducer;\n\n    @Test\n    public void testProduceDragComponent() {\n        when(c1Bean.getInstance()).thenReturn(drag1);\n        when(beanManager.lookupBean(eq(ExternalDragComponent.class))).thenReturn(c1Bean);\n\n        when(c2Bean.getInstance()).thenReturn(drag2);\n        when(beanManager.lookupBean(eq(ExternalDisplayerDragComponent.class))).thenReturn(c2Bean);\n\n        when(c1.isNoData()).thenReturn(false);\n        when(c2.isNoData()).thenReturn(true);\n\n        componentGroupProducer.produceDragComponent(c1);\n        componentGroupProducer.produceDragComponent(c2);\n\n        verify(beanManager).lookupBean(eq(ExternalDisplayerDragComponent.class));\n        verify(beanManager).lookupBean(eq(ExternalDragComponent.class));\n\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-displayer-screen</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Displayer Screen</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/java/org/dashbuilder/displayer/client/DisplayerScreenPresenter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n * <p/>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p/>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p/>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.uuid.UUIDGenerator;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.displayer.client.resources.i18n.Constants;\nimport org.dashbuilder.displayer.client.widgets.DisplayerEditorPopup;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@WorkbenchScreen(identifier = \"DisplayerScreen\")\n@Dependent\npublic class DisplayerScreenPresenter {\n\n    private SyncBeanManager beanManager;\n    private DataSetClientServices dataSetClientServices;\n    private DisplayerViewer displayerViewer;\n    private PerspectiveCoordinator perspectiveCoordinator;\n    private PerspectiveManager perspectiveManager;\n    private PanelManager panelManager;\n    private PlaceManager placeManager;\n    private UUIDGenerator uuidGenerator;\n    private Event<ChangeTitleWidgetEvent> changeTitleEvent;\n    private DisplayerSettingsJSONMarshaller jsonMarshaller;\n\n    private DisplayerSettings displayerSettings;\n    private PlaceRequest placeRequest;\n    private Menus menu = null;\n    private boolean editEnabled = false;\n    private boolean cloneEnabled = false;\n    private boolean csvExportAllowed = false;\n    private boolean excelExportAllowed = false;\n    private ButtonGroup menuActionsButton;\n\n    // TODO allow configuration of this through a custom system property?\n    private static final int MAX_EXPORT_LIMIT = 100000;\n\n    @Inject\n    public DisplayerScreenPresenter(SyncBeanManager beanManager,\n                                    DataSetClientServices dataSetClientServices,\n                                    UUIDGenerator uuidGenerator,\n                                    PerspectiveManager perspectiveManager,\n                                    PlaceManager placeManager,\n                                    DisplayerViewer displayerViewer,\n                                    PanelManager panelManager,\n                                    PerspectiveCoordinator perspectiveCoordinator,\n                                    Event<ChangeTitleWidgetEvent> changeTitleEvent) {\n\n        this.beanManager = beanManager;\n        this.dataSetClientServices = dataSetClientServices;\n        this.uuidGenerator = uuidGenerator;\n        this.placeManager = placeManager;\n        this.perspectiveManager = perspectiveManager;\n        this.displayerViewer = displayerViewer;\n        this.panelManager = panelManager;\n        this.perspectiveCoordinator = perspectiveCoordinator;\n        this.menuActionsButton = getMenuActionsButton();\n        this.changeTitleEvent = changeTitleEvent;\n        this.jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n    }\n\n    @OnStartup\n    public void onStartup( final PlaceRequest placeRequest ) {\n        this.placeRequest = placeRequest;\n        String json = placeRequest.getParameter(\"json\", \"\");\n        if (!StringUtils.isBlank(json)) {\n            this.displayerSettings = jsonMarshaller.fromJsonString(json);\n        }\n        if (displayerSettings == null ) {\n            throw new IllegalArgumentException(Constants.INSTANCE.displayer_presenter_displayer_notfound());\n        }\n\n        // Check if display renderer selector component.\n        Boolean showRendererSelector = Boolean.parseBoolean(placeRequest.getParameter(\"showRendererSelector\",\"false\"));\n        displayerViewer.setIsShowRendererSelector(showRendererSelector);\n\n        // Draw the Displayer.\n        if ( StringUtils.isBlank(displayerSettings.getUUID())) {\n            displayerSettings.setUUID(uuidGenerator.newUuid());\n        }\n        displayerViewer.init(displayerSettings);\n        Displayer displayer = displayerViewer.draw();\n\n        // Register the Displayer into the coordinator.\n        perspectiveCoordinator.addDisplayer(displayer);\n\n        // Check edit mode\n        String edit = placeRequest.getParameter(\"edit\", \"false\" );\n        String clone = placeRequest.getParameter(\"clone\", \"false\" );\n        editEnabled = Boolean.parseBoolean(edit);\n        cloneEnabled = Boolean.parseBoolean(clone);\n        csvExportAllowed = displayerSettings.isCSVExportAllowed();\n        excelExportAllowed = displayerSettings.isExcelExportAllowed();\n        this.menu = makeMenuBar();\n        adjustMenuActions(this.displayerSettings);\n    }\n\n    @OnClose\n    public void onClose() {\n        this.removeDisplayer();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return displayerSettings.getTitle();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return displayerViewer;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menu);\n    }\n\n    private Menus makeMenuBar() {\n        return MenuFactory\n                .newTopLevelCustomMenu( new MenuFactory.CustomMenuBuilder() {\n                    @Override\n                    public void push( MenuFactory.CustomMenuBuilder element ) {\n                    }\n\n                    @Override\n                    public MenuItem build() {\n                        return new BaseMenuCustom<IsWidget>() {\n                            @Override\n                            public IsWidget build() {\n                                return menuActionsButton;\n                            }\n\n                            @Override\n                            public boolean isEnabled() {\n                                return editEnabled || cloneEnabled || csvExportAllowed || excelExportAllowed;\n                            }\n\n                            @Override\n                            public void setEnabled( boolean enabled ) {\n                            }\n                        };\n                    }\n                } ).endMenu()\n                .build();\n    }\n\n    private Command getEditCommand() {\n        return () -> {\n            perspectiveCoordinator.editOn();\n\n            String currentTitle = displayerSettings.getTitle();\n            DisplayerEditorPopup displayerEditor = beanManager.lookupBean(DisplayerEditorPopup.class).newInstance();\n            displayerEditor.init(displayerSettings.cloneInstance());\n            displayerEditor.setOnSaveCommand(getSaveCommand(displayerEditor, currentTitle));\n            displayerEditor.setOnCloseCommand(getCloseCommand(displayerEditor));\n        };\n    }\n\n    protected Command getCloneCommand() {\n        return () -> {\n            perspectiveCoordinator.editOn();\n\n            DisplayerSettings clonedSettings = displayerSettings.cloneInstance();\n            clonedSettings.setUUID(uuidGenerator.newUuid());\n            clonedSettings.setTitle(\"Copy of \" + clonedSettings.getTitle());\n            DisplayerEditorPopup displayerEditor = beanManager.lookupBean(DisplayerEditorPopup.class).newInstance();\n            displayerEditor.init(clonedSettings);\n            displayerEditor.setOnSaveCommand(getSaveCloneCommand(displayerEditor));\n            displayerEditor.setOnCloseCommand(getCloseCommand(displayerEditor));\n        };\n    }\n\n    protected Command getSaveCommand(final DisplayerEditorPopup displayerEditor, final String currentTitle) {\n        return () -> {\n            // On save\n            perspectiveCoordinator.editOff();\n            DisplayerSettings newSettings = displayerEditor.getDisplayerSettings();\n            if (!displayerSettings.equals(newSettings)) {\n\n                String newTitle = newSettings.getTitle();\n                if (!currentTitle.equals(newTitle)) {\n                    changeTitleEvent.fire(new ChangeTitleWidgetEvent(placeRequest, newSettings.getTitle()));\n                }\n\n                PanelDefinition panelDefinition = panelManager.getPanelForPlace(placeRequest);\n                beanManager.destroyBean(displayerEditor);\n                placeManager.goTo(createPlaceRequest(newSettings), panelDefinition);\n                placeManager.closePlace(placeRequest);\n                perspectiveManager.savePerspectiveState(() -> {});\n            }\n        };\n    }\n\n    protected Command getSaveCloneCommand(final DisplayerEditorPopup displayerEditor) {\n        return () -> {\n            perspectiveCoordinator.editOff();\n            beanManager.destroyBean(displayerEditor);\n\n            PanelDefinition panelDefinition = panelManager.getPanelForPlace(placeRequest);\n            placeManager.goTo(createPlaceRequest(displayerEditor.getDisplayerSettings()), panelDefinition);\n            perspectiveManager.savePerspectiveState(() -> {});\n        };\n    }\n\n    protected Command getCloseCommand(final DisplayerEditorPopup displayerEditor) {\n        return () -> {\n            perspectiveCoordinator.editOff();\n            beanManager.destroyBean(displayerEditor);\n        };\n    }\n\n    protected Command getExportCsvCommand() {\n        return getExportCommand(ExportFormat.CSV);\n    }\n\n    protected Command getExportExcelCommand() {\n        return getExportCommand(ExportFormat.XLS);\n    }\n\n    protected Command getExportCommand(ExportFormat format) {\n        return () -> displayerViewer.getDisplayer().export(format, MAX_EXPORT_LIMIT, new ExportCallback() {\n\n            @Override\n            public void noData() {\n                Window.alert(Constants.INSTANCE.displayer_presenter_export_no_data());\n            }\n\n            @Override\n            public void tooManyRows(int rowNum) {\n                Window.alert(Constants.INSTANCE.displayer_presenter_export_large_dataset());\n            }\n\n            @Override\n            public void exportFileUrl(String url) {\n                Window.open(url, \"downloading\", \"resizable=no,scrollbars=yes,status=no\");\n            }\n\n            @Override\n            public void error(ClientRuntimeError error) {\n                displayerViewer.error(error);\n            }\n        });\n    }\n\n    protected void removeDisplayer() {\n        Displayer displayer = displayerViewer.getDisplayer();\n        perspectiveCoordinator.removeDisplayer(displayer);\n        displayer.close();\n        beanManager.destroyBean(displayerViewer);\n    }\n\n    protected PlaceRequest createPlaceRequest( DisplayerSettings displayerSettings ) {\n        String json = jsonMarshaller.toJsonString(displayerSettings);\n        Map<String, String> params = new HashMap<>();\n        params.put(\"json\", json);\n        params.put(\"edit\", \"true\");\n        params.put(\"clone\", \"true\");\n        return new DefaultPlaceRequest(\"DisplayerScreen\", params);\n    }\n\n    protected void adjustMenuActions(DisplayerSettings displayerSettings) {\n        final ComplexPanel menu = (ComplexPanel) menuActionsButton.getWidget(1);\n        menu.getWidget(2).setVisible(displayerSettings.isCSVExportAllowed());\n        menu.getWidget(3).setVisible(displayerSettings.isExcelExportAllowed());\n    }\n\n    protected ButtonGroup getMenuActionsButton() {\n        return new ButtonGroup() {{\n            add(new Button( Constants.INSTANCE.menu_button_actions()) {{\n                setSize(ButtonSize.EXTRA_SMALL);\n                addStyleName(Pull.RIGHT.getCssName());\n                setDataToggle(Toggle.DROPDOWN);\n            }} );\n            add(new DropDownMenu() {{\n                add(new AnchorListItem(Constants.INSTANCE.menu_edit()) {{\n                    addClickHandler(event -> getEditCommand().execute());\n                }} );\n                add(new AnchorListItem(Constants.INSTANCE.menu_clone() ) {{\n                    addClickHandler(event -> getCloneCommand().execute());\n                }} );\n                add(new AnchorListItem(Constants.INSTANCE.menu_export_csv() ) {{\n                    addClickHandler(event -> getExportCsvCommand().execute());\n                }} );\n                add(new AnchorListItem(Constants.INSTANCE.menu_export_excel()) {{\n                    addClickHandler(event -> getExportExcelCommand().execute());\n                }} );\n            }} );\n        }};\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/java/org/dashbuilder/displayer/client/PerspectiveCoordinator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.events.DataSetModifiedEvent;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\n\n/**\n * It holds the set of Displayer instances being displayed on the current perspective.\n * <p>It also makes sure those instances are properly synced to reflect the data set manipulation requests\n * issued by any Displayer on the dashboard.</p>\n */\n@ApplicationScoped\npublic class PerspectiveCoordinator {\n\n    /**\n     * The real coordinator.\n     */\n    private DisplayerCoordinator displayerCoordinator;\n\n    /**\n     * Flag indicating if the perspective is on edit mode.\n     */\n    boolean editOn = false;\n\n    public PerspectiveCoordinator() {\n    }\n\n    @Inject\n    public PerspectiveCoordinator(DisplayerCoordinator coordinator) {\n        this.displayerCoordinator = coordinator;\n    }\n\n    /**\n     * Adds a Displayer instance to the current perspective context.\n     */\n    public void addDisplayer(Displayer displayer) {\n        displayerCoordinator.addDisplayer(displayer);\n    }\n\n    /**\n     * Removes a Displayer instance from the current perspective context.\n     */\n    public boolean removeDisplayer(Displayer displayer) {\n        return displayerCoordinator.removeDisplayer(displayer);\n    }\n\n    /**\n     *\n     * @return the current list of displayers\n     */\n    public List<Displayer> getDisplayerList(){\n        return displayerCoordinator.getDisplayerList();\n    }\n\n    /**\n     * Turn on the edition of the perspective\n     */\n    public void editOn() {\n        editOn = true;\n\n        // Turns off the automatic refresh of all the displayers.\n        for (Displayer displayer : displayerCoordinator.getDisplayerList()) {\n            displayer.setRefreshOn(false);\n        }\n    }\n\n    /**\n     * Turn off the edition of the perspective\n     */\n    public void editOff() {\n        editOn = false;\n\n        // Resumes the automatic refresh on all the displayers.\n        for (Displayer displayer : displayerCoordinator.getDisplayerList()) {\n            displayer.setRefreshOn(true);\n        }\n    }\n\n    /**\n     * Reset the coordinator every time the perspective is changed.\n     */\n    private void onPerspectiveChanged(@Observes final PerspectiveChange event) {\n        displayerCoordinator.clear();\n    }\n\n    /**\n     * Listen to modifications on any of the data set being used in this perspective.\n     */\n    private void onDataSetModifiedEvent(@Observes DataSetModifiedEvent event) {\n        if (!editOn) {\n\n            String targetUUID = event.getDataSetDef().getUUID();\n            for (Displayer displayer : displayerCoordinator.getDisplayerList()) {\n                DisplayerSettings settings = displayer.getDisplayerSettings();\n\n                // Do nothing if the displayer:\n                // - Is not drawn\n                // - Is handling the refresh by itself\n                // - Is not configured to be updated on stale data\n                if (!displayer.isDrawn() || displayer.isRefreshOn() || !settings.isRefreshStaleData()) {\n                    continue;\n                }\n\n                String uuid = null;\n                DataSet dataSet = settings.getDataSet();\n                if (dataSet != null) {\n                    uuid = dataSet.getUUID();\n                }\n                DataSetLookup dataSetLookup = settings.getDataSetLookup();\n                if (uuid == null && dataSetLookup != null) {\n                    uuid = dataSetLookup.getDataSetUUID();\n                }\n                if (uuid != null && targetUUID.equals(uuid)) {\n                    displayer.redraw();\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/java/org/dashbuilder/displayer/client/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface Constants extends Messages {\n\n    Constants INSTANCE = GWT.create(Constants.class);\n\n    String menu_button_actions();\n\n    String menu_edit();\n\n    String menu_clone();\n\n    String menu_export_csv();\n\n    String menu_export_excel();\n\n    String displayer_presenter_displayer_notfound();\n\n    String displayer_presenter_export_large_dataset();\n\n    String displayer_presenter_export_no_data();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.displayer.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/DisplayerScreen.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path='displayer'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmenu_button_actions=Actions\nmenu_edit=Edit\nmenu_clone=Clone\nmenu_export_csv=Export to CSV\nmenu_export_excel=Export to Excel\ndisplayer_presenter_displayer_notfound=Displayer settings not found.\ndisplayer_presenter_export_large_dataset=The data set about to be exported might be large,  no more than 100K rows will be exported.\ndisplayer_presenter_export_no_data=No data to export.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_de.properties",
    "content": "menu_button_actions=Aktionen\nmenu_edit=Bearbeiten\nmenu_clone=Klonen\nmenu_export_csv=In CSV exportieren\nmenu_export_excel=In Excel exportieren\ndisplayer_presenter_displayer_notfound=Displayer-Einstellungen nicht gefunden.\ndisplayer_presenter_export_large_dataset=Der zu exportierende Datensatz könnte groß sein, es werden nicht mehr als 100K Reihen exportiert.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmenu_button_actions=Acciones\nmenu_edit=Editar\nmenu_clone=Clonar\nmenu_export_csv=Exportar a CSV\nmenu_export_excel=Exportar a Excel\ndisplayer_presenter_displayer_notfound=No se encuentran los ajustes de pantalla.\ndisplayer_presenter_export_large_dataset=El conjunto de datos a punto de ser exportado podría ser grande; no se exportarán más de 100 000 filas.\ndisplayer_presenter_export_no_data=No hay datos para exportar.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmenu_button_actions=Actions\nmenu_edit=Modifier\nmenu_clone=Cloner\nmenu_export_csv=Exporter au format CSV\nmenu_export_excel=Exporter vers Excel\ndisplayer_presenter_displayer_notfound=Paramètres de l''afficheur introuvables.\ndisplayer_presenter_export_large_dataset=Il se peut que l''ensemble de données qui est sur le point d''être exporté soit trop volumineux ; 100 000 lignes au maximum seront exportées.\ndisplayer_presenter_export_no_data=Aucune donnée à exporter.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmenu_button_actions=Azioni\nmenu_edit=Modifica\nmenu_clone=Clona\nmenu_export_csv=Esporta in CSV\nmenu_export_excel=Esporta in Excel\ndisplayer_presenter_displayer_notfound=Impostazioni del visualizzatore non trovate.\ndisplayer_presenter_export_large_dataset=Il set di dati da esportare potrebbe essere grande, verranno esportate al massimo 100.000 righe.\ndisplayer_presenter_export_no_data=Nessun dato da esportare.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmenu_button_actions=アクション\nmenu_edit=編集\nmenu_clone=クローン\nmenu_export_csv=CSVにエクスポート\nmenu_export_excel=Excelにエクスポート\ndisplayer_presenter_displayer_notfound=ディスプレイヤー設定が見つかりません。\ndisplayer_presenter_export_large_dataset=エクスポートするデータセットが大きい可能性があります。100K 行超はエクスポートされません。\ndisplayer_presenter_export_no_data=エクスポートするデータがありません\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_pt_BR.properties",
    "content": "menu_button_actions=Ações\nmenu_edit=Editar\nmenu_clone=Clonar\nmenu_export_csv=Exportar ao CSV\nmenu_export_excel=Exportar ao Excel\ndisplayer_presenter_displayer_notfound=Configurações do exibidor não foi encontrado.\ndisplayer_presenter_export_large_dataset=O data set a ser exportado deve ser muito grande, serão exportadas até 100K linhas.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/main/resources/org/dashbuilder/displayer/client/resources/i18n/Constants_zh_CN.properties",
    "content": "menu_button_actions=动作\nmenu_edit=编辑\nmenu_clone=克隆\nmenu_export_csv=导出到 CSV\nmenu_export_excel=导出到 Excel\ndisplayer_presenter_displayer_notfound=未找到显示屏设置\ndisplayer_presenter_export_large_dataset=要导出的数据集可能太大，少于 100K 行数据将被导出。\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-displayer-screen/src/test/java/org/dashbuilder/displayer/client/PerspectiveCoordinatorTest.java",
    "content": "package org.dashbuilder.displayer.client;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectiveCoordinatorTest {\n\n    PerspectiveCoordinator coordinator;\n\n    @Before\n    public void init(){\n        final RendererManager rendererManager = mock(RendererManager.class);\n        final DisplayerCoordinator displayerCoordinator = new DisplayerCoordinator(rendererManager);\n        coordinator = new PerspectiveCoordinator(displayerCoordinator);\n    }\n\n    @Test\n    public void testDisplayerList() {\n        assertNotNull(coordinator.getDisplayerList());\n        assertEquals(0, coordinator.getDisplayerList().size());\n\n        final Displayer displayer = mock(Displayer.class);\n        coordinator.addDisplayer(displayer);\n\n        assertEquals(1, coordinator.getDisplayerList().size());\n\n        coordinator.removeDisplayer(displayer);\n\n        assertEquals(0, coordinator.getDisplayerList().size());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\n\t<modelVersion>4.0.0</modelVersion>\n\t\n\t<parent>\n\t\t<groupId>org.dashbuilder</groupId>\n\t\t<artifactId>dashbuilder-client</artifactId>\n\t\t<version>7.75.0-SNAPSHOT</version>\n\t</parent>\n\t<artifactId>dashbuilder-kie-server-client</artifactId>\n\t<packaging>jar</packaging>\n\n\t<name>Dashbuilder Kie Server Client</name>\n\n\n\t<dependencies>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-kie-server-api</artifactId>\n\t\t</dependency>\n\t\t<!-- Dashbuilder -->\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-client-all</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-common-client</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.kie.soup</groupId>\n\t\t\t<artifactId>kie-soup-dataset-api</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-dataset-client</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-dataset-client</artifactId>\n\t\t\t<type>test-jar</type>\n\t\t\t<scope>test</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-displayer-api</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-displayer-client</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-displayer-screen</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-renderer-default</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-validations</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.dashbuilder</groupId>\n\t\t\t<artifactId>dashbuilder-widgets</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<!-- Uberfire -->\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-api</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-commons</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.kie.soup</groupId>\n\t\t\t<artifactId>kie-soup-commons</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-client-api</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-workbench-client</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-workbench-processors</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.uberfire</groupId>\n\t\t\t<artifactId>uberfire-widgets-commons</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t\t<!-- Errai -->\n\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-ui</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-ioc</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-common</artifactId>\n\t\t</dependency>\n\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-data-binding</artifactId>\n\t\t</dependency>\n\n\t\t<!-- GWT and GWT Extensions -->\n\n\t\t<dependency>\n\t\t\t<groupId>com.google.gwt</groupId>\n\t\t\t<artifactId>gwt-user</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\n\t</dependencies>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/RemoteDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor;\n\nimport com.google.gwt.editor.client.ValueAwareEditor;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\n\n/**\n * <p>The GWT editor contract for the specific attributes of type <code>org.jbpm.workbench.ks.integration.RemoteDataSetDef</code>.</p>\n * <p>Used to to edit the following sub-set of attributes:</p>\n * <ul>\n *     <li>queryTarget</li>\n *     <li>dataSource</li>\n *     <li>dbSQL</li>\n * </ul>\n */\npublic interface RemoteDataSetDefAttributesEditor extends ValueAwareEditor<RemoteDataSetDef> {\n\n    LeafAttributeEditor<String> queryTarget();\n    LeafAttributeEditor<String> serverTemplateId();\n    public ValueBoxEditor<String> dataSource();\n    LeafAttributeEditor<String> dbSQL();\n   \n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/RemoteDataSetDefEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor;\n\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataset.client.editor.DataSetDefEditor;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\n\npublic interface RemoteDataSetDefEditor extends DataSetDefEditor<RemoteDataSetDef> {\n\n    LeafAttributeEditor<String> queryTarget();\n    LeafAttributeEditor<String> serverTemplateId();\n    public ValueBoxEditor<String> dataSource();\n    LeafAttributeEditor<String> dbSQL();\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/RemoteDataSetEditorDriverFactory.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport com.google.gwt.core.client.GWT;\nimport org.dashbuilder.client.kieserver.dataset.editor.driver.RemoteDataSetDefAttributesDriver;\nimport org.dashbuilder.client.kieserver.dataset.editor.driver.RemoteDataSetDefDriver;\n\n\n@ApplicationScoped\npublic class RemoteDataSetEditorDriverFactory {\n\n    final RemoteDataSetDefAttributesDriver remoteDataSetDefAttributesDriver = GWT.create(RemoteDataSetDefAttributesDriver.class);\n\n    final RemoteDataSetDefDriver remoteDataSetDefDriver = GWT.create(RemoteDataSetDefDriver.class);\n\n    @Produces\n    public RemoteDataSetDefDriver remoteDataSetDefDriver() {\n        return remoteDataSetDefDriver;\n    }\n\n    @Produces\n    public RemoteDataSetDefAttributesDriver remoteDataSetDefAttributesDriver() {\n        return remoteDataSetDefAttributesDriver;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/driver/RemoteDataSetDefAttributesDriver.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefAttributesEditor;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\n\n/**\n * <p>Driver for RemoteDataSetDefAttributesEditor.</p>\n * \n */\npublic interface RemoteDataSetDefAttributesDriver extends SimpleBeanEditorDriver<RemoteDataSetDef, RemoteDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/driver/RemoteDataSetDefDriver.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefEditor;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\n\n/**\n * <p>Driver for RemoteDataSetDefEditor.</p>\n * \n */\npublic interface RemoteDataSetDefDriver extends SimpleBeanEditorDriver<RemoteDataSetDef, RemoteDataSetDefEditor> {\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/impl/RemoteDataSetDefAttributesEditorImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.impl;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefAttributesEditor;\nimport org.dashbuilder.client.kieserver.resources.i18n.KieServerClientConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.kieserver.KieServerConnectionInfoProvider;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * <p>KIE Server/Remote Data Set specific attributes editor presenter.</p>\n */\n@Dependent\npublic class RemoteDataSetDefAttributesEditorImpl implements IsWidget, RemoteDataSetDefAttributesEditor {\n\n    public interface View extends UberView<RemoteDataSetDefAttributesEditorImpl> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(DropDownEditor.View queryTarget,\n                         DropDownEditor.View serverTemplateId,\n                         ValueBoxEditor.View dbSourceName,\n                         ValueBoxEditor.View dbSQL);\n\n    }\n\n    DropDownEditor queryTarget;\n    DropDownEditor serverTemplateId;\n    ValueBoxEditor<String> dataSource;\n\n    ValueBoxEditor<String> dbSQL;\n    public View view;\n\n    private Caller<KieServerConnectionInfoProvider> kieServerConnectionInfoProvider;\n\n    @Inject\n    public RemoteDataSetDefAttributesEditorImpl(final DropDownEditor queryTarget,\n                                                final DropDownEditor serverTemplateId,\n                                                final ValueBoxEditor<String> dataSource,\n                                                final ValueBoxEditor<String> dbSQL,\n                                                final View view,\n                                                final Caller<KieServerConnectionInfoProvider> specManagementService) {\n        this.queryTarget = queryTarget;\n        this.serverTemplateId = serverTemplateId;\n        this.dataSource = dataSource;\n        this.dbSQL = dbSQL;\n        this.view = view;\n\n        this.kieServerConnectionInfoProvider = specManagementService;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(queryTarget.view, serverTemplateId.view, dataSource.view, dbSQL.view);\n\n        queryTarget.setSelectHint(KieServerClientConstants.INSTANCE.remoteQueryTargetHint());\n        List<DropDownEditor.Entry> entries = Stream.of(\"CUSTOM\",\n                                                       \"PROCESS\",\n                                                       \"TASK\",\n                                                       \"BA_TASK\",\n                                                       \"PO_TASK\",\n                                                       \"JOBS\",\n                                                       \"FILTERED_PROCESS\",\n                                                       \"FILTERED_BA_TASK\",\n                                                       \"FILTERED_PO_TASK\")\n                                                   .map(s -> queryTarget.newEntry(s, s)).collect(Collectors.toList());\n        queryTarget.setEntries(entries);\n\n        queryTarget.addHelpContent(KieServerClientConstants.INSTANCE.remoteQueryTarget(),\n                                   KieServerClientConstants.INSTANCE.remoteQueryTargetDescription(),\n                                   Placement.RIGHT); //bottom placement would interfere with the dropdown\n\n        serverTemplateId.setSelectHint(KieServerClientConstants.INSTANCE.remoteServerTemplateHint());\n\n        kieServerConnectionInfoProvider.call((List<String> serverTemplates) -> onServerTemplateLoad(serverTemplates)).serverTemplates();\n\n        serverTemplateId.addHelpContent(KieServerClientConstants.INSTANCE.remoteServerTemplate(),\n                                        KieServerClientConstants.INSTANCE.remoteServerTemplateDescription(),\n                                        Placement.RIGHT);\n\n        dataSource.addHelpContent(KieServerClientConstants.INSTANCE.remoteDataSetEditor(),\n                                  KieServerClientConstants.INSTANCE.remoteDatasourceDescription(),\n                                  Placement.BOTTOM);\n\n        dbSQL.addHelpContent(KieServerClientConstants.INSTANCE.remoteDataSetEditor(),\n                             KieServerClientConstants.INSTANCE.remoteDatasourceDescription(),\n                             Placement.BOTTOM);\n    }\n\n    private void onServerTemplateLoad(List<String> templates) {\n        List<DropDownEditor.Entry> entries = templates.stream().map(st -> serverTemplateId.newEntry(st, st)).collect(Collectors.toList());\n        serverTemplateId.setEntries(entries);\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public DropDownEditor queryTarget() {\n        return queryTarget;\n    }\n\n    @Override\n    public DropDownEditor serverTemplateId() {\n        return serverTemplateId;\n    }\n\n    @Override\n    public ValueBoxEditor<String> dataSource() {\n        return dataSource;\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSQL() {\n        return dbSQL;\n    }\n\n    @Override\n    public void flush() {\n        // empty\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n        // empty\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<RemoteDataSetDef> delegate) {\n        // No delegation required.\n    }\n\n    @Override\n    public void setValue(RemoteDataSetDef value) {\n        queryTarget.setValue(value.getQueryTarget());\n        serverTemplateId.setValue(value.getServerTemplateId());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/impl/RemoteDataSetDefAttributesEditorView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.impl;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\n\n/**\n * <p>The KIE Server/Remote Data Set attributes editor view.</p>\n *\n */\n@Dependent\npublic class RemoteDataSetDefAttributesEditorView extends Composite implements RemoteDataSetDefAttributesEditorImpl.View {\n\n    interface Binder extends UiBinder<Widget, RemoteDataSetDefAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    RemoteDataSetDefAttributesEditorImpl presenter;\n\n    @UiField(provided = true)\n    DropDownEditor.View queryTarget;\n    \n    @UiField(provided = true)\n    DropDownEditor.View serverTemplateId;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View dataSource;\n\n    @UiField\n    FlowPanel dbSQLPanel;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View dbSQL;\n\n    @Override\n    public void init(final RemoteDataSetDefAttributesEditorImpl presenter) {\n        this.presenter = presenter;\n    }\n    \n    @Override\n    public void initWidgets(final DropDownEditor.View queryTarget, final DropDownEditor.View serverTemplateId, final ValueBoxEditor.View dataSource,\n                            final ValueBoxEditor.View dbSQL) {\n        this.queryTarget = queryTarget;\n        this.serverTemplateId = serverTemplateId;\n        this.dataSource = dataSource;\n        this.dbSQL = dbSQL;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/impl/RemoteDataSetDefAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n             xmlns:ddwn=\"urn:import:org.dashbuilder.common.client.editor.list\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.kieserver.resources.i18n.KieServerClientConstants\"/>\n\n  <ui:style>\n    .sourceSelectorButton {\n      float: left;\n      margin-right: 10px;\n    }\n    .queryBox {\n      height: 200px;\n    }\n    .row {\n      margin-bottom: 5px;\n    }\n    .attr {\n      float: left;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <!-- source -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.remoteSqlDatasource}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.remoteDatasourceDescription}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"dataSource\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n    \n    <!-- server template id -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.remoteServerTemplate}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.remoteServerTemplateDescription}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <ddwn:DropDownEditor.View ui:field=\"serverTemplateId\" />\n      </b:Column>\n    </b:Row>\n    \n    <!-- target -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.remoteQueryTarget}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.remoteQueryTargetDescription}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <ddwn:DropDownEditor.View ui:field=\"queryTarget\" />\n      </b:Column>\n    </b:Row>\n\n    <!-- Source selector (table or query). -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.remoteSqlSource}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.remoteSourceDescription}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n\n        <g:FlowPanel ui:field=\"dbSQLPanel\">\n          <editor:ValueBoxEditor.View ui:field=\"dbSQL\">\n            <editor:valuebox>\n              <b:TextArea placeholder=\"{i18n.remoteQueryPlaceHolder}\" addStyleNames=\"{style.queryBox}\"/>\n            </editor:valuebox>\n          </editor:ValueBoxEditor.View>\n        </g:FlowPanel>\n\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/impl/RemoteDataSetEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.kieserver.dataset.editor.impl;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefEditor;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\n\n/**\n * <p>KIE Server/Remote Data Set editor presenter.</p>\n * \n */\n@Dependent\npublic class RemoteDataSetEditor extends DataSetEditor<RemoteDataSetDef> implements RemoteDataSetDefEditor {\n\n    RemoteDataSetDefAttributesEditorImpl attributesEditor;\n\n    @Inject\n    public RemoteDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                               final RemoteDataSetDefAttributesEditorImpl attributesEditor,\n                               final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                               final DataSetDefPreviewTable previewTable,\n                               final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                               final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                               final DataSetDefRefreshAttributesEditor refreshEditor,\n                               final DataSetClientServices clientServices,\n                               final LoadingBox loadingBox,\n                               final Event<ErrorEvent> errorEvent,\n                               final Event<TabChangedEvent> tabChangedEvent,\n                               final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor,\n              previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n              refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the generic data set editor view.\n        super.init();\n    }\n\n    public RemoteDataSetDefAttributesEditorImpl getAttributesEditor() {\n        return attributesEditor;\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public DropDownEditor queryTarget() {\n        return attributesEditor.queryTarget();\n    }\n\n    @Override\n    public ValueBoxEditor<String> dataSource() {\n        return attributesEditor.dataSource();\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSQL() {\n        return attributesEditor.dbSQL();\n    }\n\n    @Override\n    public DropDownEditor serverTemplateId() {\n        return attributesEditor.serverTemplateId();\n    }\n\n    @Override\n    public void setValue(RemoteDataSetDef value) {\n        super.setValue(value);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/impl/RemoteDataSetEditorPlugin.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.impl;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport org.dashbuilder.client.kieserver.dataset.editor.workflow.RemoteDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.kieserver.dataset.editor.workflow.RemoteDataSetEditWorkflow;\nimport org.dashbuilder.client.kieserver.resources.i18n.KieServerClientConstants;\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.resources.bundles.DataSetClientResources;\nimport org.dashbuilder.kieserver.RuntimeKieServerDataSetProviderType;\n\n@Dependent\npublic class RemoteDataSetEditorPlugin implements DataSetEditorPlugin {\n\n    private static DataSetProviderType TYPE = new RuntimeKieServerDataSetProviderType();\n    \n    @Override\n    public String getTypeSelectorTitle() {\n        return KieServerClientConstants.INSTANCE.remoteDataSetEditor();\n    }\n\n    @Override\n    public String getTypeSelectorText() {\n        return KieServerClientConstants.INSTANCE.remoteDataSetEditorDescription();\n    }\n\n    @Override\n    public SafeUri getTypeSelectorImageUri() {\n        return DataSetClientResources.INSTANCE.images().sqlIcon160().getSafeUri();\n    }\n\n    @Override\n    public DataSetProviderType getProviderType() {\n        return TYPE;\n    }\n\n    @Override\n    public Class<?> getBasicAttributesWorkflowClass() {\n        return RemoteDataSetBasicAttributesWorkflow.class;\n    }\n\n    @Override\n    public Class<?> getWorkflowClass() {\n        return RemoteDataSetEditWorkflow.class;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/validator/RemoteDataSetDefValidator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.dataset.editor.validator;\n\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefDbSQLValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefValidation;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.kieserver.RemoteDataSetDefValidation;\nimport org.dashbuilder.kieserver.RuntimeKieServerDataSetProviderType;\nimport org.dashbuilder.validations.dataset.AbstractDataSetDefValidator;\n\n/**\n * <p>The singleton application Remote data set definition validator.</p>\n */\n@Dependent\npublic class RemoteDataSetDefValidator extends AbstractDataSetDefValidator<RemoteDataSetDef> {\n\n    @Inject\n    public RemoteDataSetDefValidator(Validator validator) {\n        super(validator);\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return new RuntimeKieServerDataSetProviderType();\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes(RemoteDataSetDef dataSetDef, Object... params) {\n\n        Set<ConstraintViolation<RemoteDataSetDef>> violations = validator.validate(dataSetDef,\n                                                                                    RemoteDataSetDefValidation.class,\n                                                                                    SQLDataSetDefValidation.class,\n                                                                                    SQLDataSetDefDbSQLValidation.class);\n        return toIterable(violations);\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate(RemoteDataSetDef dataSetDef,\n                                                     boolean isCacheEnabled,\n                                                     boolean isPushEnabled,\n                                                     boolean isRefreshEnabled,\n                                                     Object... params) {\n\n        Set<ConstraintViolation<RemoteDataSetDef>> _violations = validator.validate(dataSetDef,\n                                                                                    getValidationGroups(isCacheEnabled,\n                                                                                                        isPushEnabled,\n                                                                                                        isRefreshEnabled,\n                                                                                                        RemoteDataSetDefValidation.class,\n                                                                                                        SQLDataSetDefValidation.class,\n                                                                                                        SQLDataSetDefDbSQLValidation.class));\n        return toIterable(_violations);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/workflow/RemoteDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.kieserver.dataset.editor.workflow;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefAttributesEditor;\nimport org.dashbuilder.client.kieserver.dataset.editor.driver.RemoteDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetLookupFactory;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.client.DataSetEditHandler;\nimport org.dashbuilder.displayer.client.DataSetHandler;\nimport org.dashbuilder.kieserver.ConsoleDataSetLookup;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>SQL Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n */\n@Dependent\npublic class RemoteDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<RemoteDataSetDef, RemoteDataSetDefAttributesEditor> {\n\n    @Inject\n    public RemoteDataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,\n                                                final DataSetValidatorProvider validatorProvider,\n                                                final SyncBeanManager beanManager,\n                                                final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                                final Event<SaveRequestEvent> saveRequestEvent,\n                                                final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                                final Event<CancelRequestEvent> cancelRequestEvent,\n                                                final View view) {\n\n        super(clientServices,\n              validatorProvider,\n              beanManager,\n              basicAttributesEditor,\n              saveRequestEvent,\n              testDataSetEvent,\n              cancelRequestEvent,\n              view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<RemoteDataSetDef, RemoteDataSetDefAttributesEditor>> getDriverClass() {\n        return RemoteDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends RemoteDataSetDefAttributesEditor> getEditorClass() {\n        return RemoteDataSetDefAttributesEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes(getDataSetDef());\n    }\n\n    @Override\n    public void testDataSet(org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow.TestDataSetCallback testDataSetCallback) {\n        checkDataSetDefNotNull();\n\n        // Reset columns and filter configuration.\n        getDataSetDef().setAllColumnsEnabled(true);\n        getDataSetDef().setColumns(null);\n        getDataSetDef().setDataSetFilter(null);\n\n        DataSetDef editCloneWithoutCacheSettings = getDataSetDef().clone();\n        editCloneWithoutCacheSettings.setCacheEnabled(false);\n\n        final DataSetLookup lookup = DataSetLookupFactory.newDataSetLookupBuilder()\n                                                         .dataset(dataSetDef.getUUID())\n                                                         .rowOffset(0)\n                                                         .rowNumber(10)\n                                                         .buildLookup();\n\n        try {\n            DataSetHandler editHandler = new DataSetEditHandler(clientServices,\n                                                                ConsoleDataSetLookup.fromInstance(lookup, getDataSetDef().getServerTemplateId()),\n                                                                editCloneWithoutCacheSettings);\n            editHandler.lookupDataSet(new DataSetReadyCallback() {\n\n                @Override\n                public void callback(final DataSet dataSet) {\n                    getDataSetDef().setColumns(dataSet.getDefinition().getColumns());\n                    testDataSetCallback.onSuccess(dataSet);\n                }\n\n                @Override\n                public void notFound() {\n                    testDataSetCallback.onError(new ClientRuntimeError(DataSetEditorConstants.INSTANCE.defNotFound()));\n                }\n\n                @Override\n                public boolean onError(final ClientRuntimeError error) {\n                    testDataSetCallback.onError(error);\n                    return false;\n                }\n            });\n        } catch (final Exception e) {\n            testDataSetCallback.onError(new ClientRuntimeError(e));\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/dataset/editor/workflow/RemoteDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.kieserver.dataset.editor.workflow;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.kieserver.dataset.editor.RemoteDataSetDefEditor;\nimport org.dashbuilder.client.kieserver.dataset.editor.driver.RemoteDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.DataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.client.DataSetEditHandler;\nimport org.dashbuilder.displayer.client.DataSetHandler;\nimport org.dashbuilder.kieserver.ConsoleDataSetLookup;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>SQL Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class RemoteDataSetEditWorkflow extends DataSetEditWorkflow<RemoteDataSetDef, RemoteDataSetDefEditor> {\n\n    @Inject\n    public RemoteDataSetEditWorkflow(final DataSetClientServices clientServices,\n                                     final DataSetValidatorProvider validatorProvider,\n                                     final SyncBeanManager beanManager,\n                                     final Event<SaveRequestEvent> saveRequestEvent,\n                                     final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                     final Event<CancelRequestEvent> cancelRequestEvent,\n                                     final View view) {\n        super(clientServices,\n              validatorProvider,\n              beanManager,\n              saveRequestEvent,\n              testDataSetEvent,\n              cancelRequestEvent,\n              view);\n    }\n\n    @Override\n    public void testDataSet(TestDataSetCallback testDataSetCallback) {\n        checkDataSetDefNotNull();\n\n        // Reset columns and filter configuration.\n        getDataSetDef().setAllColumnsEnabled(true);\n        getDataSetDef().setColumns(null);\n        getDataSetDef().setDataSetFilter(null);\n\n        DataSetDef editCloneWithoutCacheSettings = getDataSetDef().clone();\n        editCloneWithoutCacheSettings.setCacheEnabled(false);\n\n        final DataSetLookup lookup = DataSetFactory.newDataSetLookupBuilder()\n                                                   .dataset(dataSetDef.getUUID())\n                                                   .rowOffset(0)\n                                                   .rowNumber(10)\n                                                   .buildLookup();\n\n        try {\n            DataSetHandler editHandler = new DataSetEditHandler(clientServices,\n                                                                ConsoleDataSetLookup.fromInstance(lookup, getDataSetDef().getServerTemplateId()),\n                                                                editCloneWithoutCacheSettings);\n            editHandler.lookupDataSet(new DataSetReadyCallback() {\n\n                @Override\n                public void callback(final DataSet dataSet) {\n                    getDataSetDef().setColumns(dataSet.getDefinition().getColumns());\n                    testDataSetCallback.onSuccess(dataSet);\n                }\n\n                @Override\n                public void notFound() {\n                    testDataSetCallback.onError(new ClientRuntimeError(DataSetEditorConstants.INSTANCE.defNotFound()));\n                }\n\n                @Override\n                public boolean onError(final ClientRuntimeError error) {\n                    testDataSetCallback.onError(error);\n                    return false;\n                }\n            });\n        } catch (final Exception e) {\n            testDataSetCallback.onError(new ClientRuntimeError(e));\n        }\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<RemoteDataSetDef, RemoteDataSetDefEditor>> getDriverClass() {\n        return RemoteDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends RemoteDataSetDefEditor> getEditorClass() {\n        return RemoteDataSetDefEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate(boolean isCacheEnabled,\n                                                        boolean isPushEnabled,\n                                                        boolean isRefreshEnabled) {\n\n        return validatorProvider.validate(dataSetDef,\n                                          isCacheEnabled,\n                                          isPushEnabled,\n                                          isRefreshEnabled);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/java/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.kieserver.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface KieServerClientConstants extends Messages {\n\n    public static final KieServerClientConstants INSTANCE = GWT.create(KieServerClientConstants.class);\n\n    public String remoteDataSetEditor();\n\n    public String remoteDataSetEditorDescription();\n\n    public String remoteQueryTarget();\n\n    public String remoteQueryTargetHint();\n\n    public String remoteServerTemplateHint();\n\n    public String remoteServerTemplate();\n\n    public String remoteServerTemplateDescription();\n\n    public String remoteDatasourceDescription();\n\n    public String remoteQueryTargetDescription();\n\n    public String remoteSourceDescription();\n    \n    public String remoteQueryPlaceHolder();\n    \n    public String remoteSqlSource();\n    \n    public String remoteSqlDatasource();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n</beans>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/DashbuilderKieServerClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n~\n~ Licensed under the Apache License, Version 2.0 (the \"License\");\n~ you may not use this file except in compliance with the License.\n~ You may obtain a copy of the License at\n~\n~       http://www.apache.org/licenses/LICENSE-2.0\n~\n~ Unless required by applicable law or agreed to in writing, software\n~ distributed under the License is distributed on an \"AS IS\" BASIS,\n~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n~ See the License for the specific language governing permissions and\n~ limitations under the License.\n-->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.dashbuilder.DashbuilderKieServerAPI\" />\n  \n  <inherits name=\"org.dashbuilder.DashbuilderClientAll\"/>\n  \n  <source path=\"client\"/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nremoteDataSetEditor=Execution Server\nremoteDataSetEditorDescription=Execution Server provider allows to consume data via custom queries feature of the Execution Server\nremoteQueryTarget=Remote query target\nremoteQueryTargetHint=Select query target\nremoteServerTemplateHint=Select server configuration\nremoteServerTemplate=Remote Server Template\nremoteServerTemplateDescription=Server configuration\nremoteDatasourceDescription=Data source\nremoteQueryTargetDescription=Query target that will be executed on Kie Server\nremoteSourceDescription=The source\nremoteQueryPlaceHolder=select * from ProcessInstanceLog\nremoteSqlSource=Source\nremoteSqlDatasource=Datasource used to run queries"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants_es.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nremoteDataSetEditor=Servidor de ejecución\nremoteDataSetEditorDescription=El proveedor del servidor de ejecución permite consumir datos mediante la función de consultas personalizadas del servidor de ejecución\nremoteQueryTarget=Seleccione el objetivo de la consulta\nremoteQueryTargetHint=Seleccione el objetivo de la consulta\nremoteServerTemplateHint=Seleccione la configuración del servidor\nremoteServerTemplate=Plantilla de servidor remoto\nremoteServerTemplateDescription=Configuración del servidor\nremoteDatasourceDescription=Fuente de datos\nremoteQueryTargetDescription=Objetivo de la consulta que se ejecutará en el servidor Kie\nremoteSourceDescription=Fuente del nodo\nremoteQueryPlaceHolder=seleccione * de ProcessInstanceLog\nremoteSqlSource=Fuente\nremoteSqlDatasource=Fuente de datos utilizada para ejecutar las consultas"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants_fr.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nremoteDataSetEditor=Serveur d''exécution\nremoteDataSetEditorDescription=Le fournisseur du serveur d''exécution autorise la consommation de données via la fonctionnalité de requêtes personnalisées du serveur d''exécution\nremoteQueryTarget=Cible d''interrogation à distance\nremoteQueryTargetHint=Sélectionner la cible de la requête\nremoteServerTemplateHint=Sélectionner la configuration du serveur\nremoteServerTemplate=Modèle de serveur à distance\nremoteServerTemplateDescription=Configuration de serveur\nremoteDatasourceDescription=Source de données\nremoteQueryTargetDescription=Cible de la requête qui sera exécutée sur le serveur Kie\nremoteSourceDescription=La source\nremoteQueryPlaceHolder=sélectionnez * dans ProcessInstanceLog\nremoteSqlSource=Source\nremoteSqlDatasource=Source de données utilisée pour effectuer des recherches"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants_it.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nremoteDataSetEditor=Esecuzione Server\nremoteDataSetEditorDescription=Il provider Esecuzione Server consente di consumare dati tramite la funzionalità di query personalizzate del Server di Esecuzione\nremoteQueryTarget=Target di query remoto\nremoteQueryTargetHint=Seleziona il target di query\nremoteServerTemplateHint=Seleziona la configurazione del server\nremoteServerTemplate=Modello Server Remoto\nremoteServerTemplateDescription=Configurazione del server\nremoteDatasourceDescription=Base dati\nremoteQueryTargetDescription=Target di query che verrà eseguito su Kie Server\nremoteSourceDescription=La Base dati\nremoteQueryPlaceHolder=seleziona * da ProcessInstanceLog\nremoteSqlSource=Base dati\nremoteSqlDatasource=La base dati utilizzata per eseguire le query\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-kie-server-client/src/main/resources/org/dashbuilder/client/kieserver/resources/i18n/KieServerClientConstants_ja.properties",
    "content": "#\n# Copyright 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nremoteDataSetEditor=実行サーバー\nremoteDataSetEditorDescription=実行サーバープロバイダーは、実行サーバーのカスタムクエリー機能でデータを使用できるようにします。\nremoteQueryTarget=リモートクエリーターゲット\nremoteQueryTargetHint=クエリーターゲットを選択してください\nremoteServerTemplateHint=サーバー設定を選択してください\nremoteServerTemplate=リモートサーバーテンプレート\nremoteServerTemplateDescription=サーバー設定\nremoteDatasourceDescription=データソース\nremoteQueryTargetDescription=KIE Server で実行されるクエリーターゲット\nremoteSourceDescription=ソース\nremoteQueryPlaceHolder=select * from ProcessInstanceLog\nremoteSqlSource=ソース\nremoteSqlDatasource=クエリーの実行に使用されるデータソース"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-navigation-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Navigation Client</name>\n  <description>Dashbuilder Navigation Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-security-management</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-servlet-security</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-widgets</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>      \n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/NavBarHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navigation;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuFactory.MenuBuilder;\nimport org.uberfire.workbench.model.menu.MenuFactory.TopLevelMenusBuilder;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@ApplicationScoped\npublic class NavBarHelper {\n\n    // code taken from DefaultWorkbenchFeaturesMenusHelper\n\n    public TopLevelMenusBuilder<MenuBuilder> buildMenusFromNavTree(NavTree navTree) {\n        if (navTree == null) {\n            return null;\n        }\n\n        MenuBuilder<TopLevelMenusBuilder<MenuBuilder>> builder = null;\n        for (NavItem navItem : navTree.getRootItems()) {\n\n            // Skip dividers\n            if (navItem instanceof NavDivider) {\n                continue;\n            }\n            // AF-953: Ignore empty groups\n            if (navItem instanceof NavGroup && ((NavGroup) navItem).getChildren().isEmpty()) {\n                continue;\n            }\n            // Build a top level menu entry\n            if (builder == null) {\n                builder = MenuFactory.newTopLevelMenu(navItem.getName());\n            } else {\n                builder = builder.endMenu().newTopLevelMenu(navItem.getName());\n            }\n            // Append its children\n            if (navItem instanceof NavGroup) {\n                List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);\n                if (!childItems.isEmpty()) {\n                    builder.withItems(childItems);\n                }\n            }\n            // Append the place request\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n                PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());\n                builder = builder.place(placeRequest);\n            }\n        }\n        return builder != null ? builder.endMenu() : null;\n    }\n\n    private List<MenuItem> buildMenuItemsFromNavGroup(NavGroup navGroup) {\n        List<MenuItem> result = new ArrayList<>();\n        for (NavItem navItem : navGroup.getChildren()) {\n\n            // Skip dividers\n            if (navItem instanceof NavDivider) {\n                continue;\n            }\n            // Append its children\n            MenuBuilder<MenuFactory.Builder> builder = MenuFactory.newSimpleItem(navItem.getName());\n            if (navItem instanceof NavGroup) {\n                List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);\n                if (!childItems.isEmpty()) {\n                    builder.withItems(childItems);\n                }\n            }\n            // Append the place request\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n                PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());\n                builder.place(placeRequest);\n            }\n            // Build the menu item & continue with the next one\n            MenuItem menuItem = builder.endMenu().build().getItems().get(0);\n            result.add(menuItem);\n        }\n        return result;\n    }\n\n    public PlaceRequest resolvePlaceRequest(String perspectiveId) {\n        return new DefaultPlaceRequest(perspectiveId);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/NavigationManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation;\n\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.uberfire.mvp.Command;\n\npublic interface NavigationManager {\n\n    void init(Command afterInit);\n\n    void setDefaultNavTree(NavTree navTree);\n\n    NavTree getDefaultNavTree();\n\n    NavTree getNavTree();\n\n    boolean hasNavTree();\n\n    void saveNavTree(NavTree navTree, Command afterSave);\n\n    NavTree secure(NavTree navTree, boolean removeEmptyGroups);\n\n    void secure(List<NavItem> itemList, boolean removeEmptyGroups);\n\n    void navItemClicked(NavItem navItem);\n\n    void update(NavTree navTree);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/event/NavItemEditCancelledEvent.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.event;\n\n\nimport org.dashbuilder.client.navigation.widget.editor.NavItemEditor;\n\n/**\n * Event fired when a {@link NavItemEditor} cancels the edition of an item\n */\npublic class NavItemEditCancelledEvent {\n\n    private NavItemEditor navItemEditor;\n\n    public NavItemEditCancelledEvent(NavItemEditor navItemEditor) {\n        this.navItemEditor = navItemEditor;\n    }\n\n    public NavItemEditor getNavItemEditor() {\n        return navItemEditor;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/event/NavItemEditStartedEvent.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.event;\n\n\nimport org.dashbuilder.client.navigation.widget.editor.NavItemEditor;\n\n/**\n * Event fired when a {@link NavItemEditor} starts the edition of an item\n */\npublic class NavItemEditStartedEvent {\n\n    private NavItemEditor navItemEditor;\n\n    public NavItemEditStartedEvent(NavItemEditor navItemEditor) {\n        this.navItemEditor = navItemEditor;\n    }\n\n    public NavItemEditor getNavItemEditor() {\n        return navItemEditor;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/event/NavItemGotoEvent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.event;\n\nimport org.dashbuilder.client.navigation.widget.NavWidget;\nimport org.dashbuilder.navigation.NavItem;\n\n/**\n * Event fired when a {@link NavItem} has been clicked on a {@link NavWidget}\n */\npublic class NavItemGotoEvent {\n\n    private NavItem navItem;\n\n    public NavItemGotoEvent(NavItem navItem) {\n        this.navItem = navItem;\n    }\n\n    public NavItem getNavItem() {\n        return navItem;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/event/NavTreeLoadedEvent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.event;\n\nimport org.dashbuilder.navigation.NavTree;\n\n/**\n * Event fired when the application navigation tree is loaded from backend\n */\npublic class NavTreeLoadedEvent {\n\n    private NavTree navTree;\n\n    public NavTreeLoadedEvent(NavTree navTree) {\n        this.navTree = navTree;\n    }\n\n    public NavTree getNavTree() {\n        return navTree;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/impl/NavigationManagerImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.impl;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.event.NavItemGotoEvent;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.client.navigation.event.NavTreeLoadedEvent;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.service.NavigationServices;\nimport org.dashbuilder.navigation.workbench.NavSecurityController;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.mvp.Command;\n\n@ApplicationScoped\npublic class NavigationManagerImpl implements NavigationManager {\n\n    private Caller<NavigationServices> navServices;\n    private Event<NavItemGotoEvent> navItemGotoEvent;\n    private Event<NavTreeLoadedEvent> navTreeLoadedEvent;\n    private Event<NavTreeChangedEvent> navTreeChangedEvent;\n    private NavSecurityController navController;\n    private NavTree navTree;\n    private NavTree defaultNavTree;\n\n    @Inject\n    public NavigationManagerImpl(Caller<NavigationServices> navServices,\n                                 NavSecurityController navController,\n                                 Event<NavTreeLoadedEvent> navTreeLoadedEvent,\n                                 Event<NavTreeChangedEvent> navTreeChangedEvent,\n                                 Event<NavItemGotoEvent> navItemGotoEvent) {\n        this.navServices = navServices;\n        this.navController = navController;\n        this.navTreeLoadedEvent = navTreeLoadedEvent;\n        this.navTreeChangedEvent = navTreeChangedEvent;\n        this.navItemGotoEvent = navItemGotoEvent;\n    }\n\n    @Override\n    public void init(Command afterInit) {\n        navServices.call((NavTree n) -> {\n            navTree = n;\n            if (afterInit != null) {\n                afterInit.execute();\n            }\n            navTreeLoadedEvent.fire(new NavTreeLoadedEvent(getNavTree()));\n        }).loadNavTree();\n    }\n\n    @Override\n    public NavTree getDefaultNavTree() {\n        return defaultNavTree;\n    }\n\n    @Override\n    public void setDefaultNavTree(NavTree defaultNavTree) {\n        this.defaultNavTree = defaultNavTree;\n    }\n\n    @Override\n    public NavTree getNavTree() {\n        return !hasNavTree() ? defaultNavTree : navTree;\n    }\n\n    @Override\n    public boolean hasNavTree() {\n        return Optional.ofNullable(navTree).isPresent();\n    }\n\n    @Override\n    public void saveNavTree(NavTree newTree, Command afterSave) {\n        navServices.call((Void v) -> {\n            navTree = newTree;\n            navTreeChangedEvent.fire(new NavTreeChangedEvent(newTree));\n            if (afterSave != null) {\n                afterSave.execute();\n            }\n        }).saveNavTree(newTree);\n    }\n\n    @Override\n    public NavTree secure(NavTree navTree, boolean removeEmptyGroups) {\n        return navController.secure(navTree, removeEmptyGroups);\n    }\n\n    @Override\n    public void secure(List<NavItem> itemList, boolean removeEmptyGroups) {\n        navController.secure(itemList, removeEmptyGroups);\n    }\n\n    @Override\n    public void navItemClicked(NavItem navItem) {\n        if (navController.canRead(navItem)) {\n            navItemGotoEvent.fire(new NavItemGotoEvent(navItem));\n        }\n    }\n\n    @Override\n    public void update(NavTree navTree) {\n        this.defaultNavTree = navTree;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/AbstractNavDragComponent.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.event.Observes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.widget.HasDefaultNavItem;\nimport org.dashbuilder.client.navigation.widget.HasTargetDiv;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModalView;\nimport org.dashbuilder.client.navigation.widget.NavWidget;\nimport org.dashbuilder.client.navigation.widget.TargetDivNavWidget;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivList;\n\nimport static org.dashbuilder.navigation.layout.NavDragComponentSettings.*;\n\npublic abstract class AbstractNavDragComponent implements NavDragComponent {\n\n    NavigationManager navigationManager;\n    PerspectivePluginManager pluginManager;\n    NavComponentConfigModal navComponentConfigModal;\n    NavWidget navWidget;\n    String navGroupId = null;\n    LayoutTemplate layoutTemplate;\n\n    public AbstractNavDragComponent() {\n    }\n\n    public AbstractNavDragComponent(NavigationManager navigationManager,\n                                    PerspectivePluginManager pluginManager,\n                                    NavComponentConfigModal navComponentConfigModal,\n                                    NavWidget navWidget) {\n        this.navigationManager = navigationManager;\n        this.pluginManager = pluginManager;\n        this.navComponentConfigModal = navComponentConfigModal;\n        this.navWidget = navWidget;\n        this.navWidget.setOnStaleCommand(this::showNavWidget);\n    }\n\n    @Override\n    public NavWidget getNavWidget() {\n        return navWidget;\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return getShowWidget(ctx);\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        Map<String, String> properties = ctx.getComponent().getProperties();\n\n        // Nav group settings\n        NavGroup navGroup = pluginManager.getLastBuildPerspectiveNavGroup();\n        navGroupId = navGroup != null ? navGroup.getId() : properties.get(NAV_GROUP_ID);\n        navWidget.setHideEmptyGroups(true);\n\n        // Default item settings\n        if (navWidget instanceof HasDefaultNavItem) {\n            String navItemId = properties.get(NAV_DEFAULT_ID);\n            ((HasDefaultNavItem) navWidget).setDefaultNavItemId(navItemId);\n        }\n        // Target div settings\n        if (navWidget instanceof HasTargetDiv) {\n           String targetDivId = properties.get(TARGET_DIV_ID);\n            ((HasTargetDiv) navWidget).setTargetDivId(targetDivId);\n            ((HasTargetDiv) navWidget).setGotoItemEnabled(true);\n        }\n        this.showNavWidget();\n        return navWidget;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        List<String> targetDivIdList = TargetDivList.list(ctx.getCurrentLayoutTemplate());\n        navComponentConfigModal.clear();\n        navComponentConfigModal.setTargetDivIdList(targetDivIdList);\n\n        // Nav group settings\n        NavTree navTree = navigationManager.getNavTree();\n        String groupId = ctx.getComponentProperty(NAV_GROUP_ID);\n        navComponentConfigModal.setNavGroup(navTree.getRootItems(), navTree.getItemById(groupId) != null ? groupId : null);\n        navComponentConfigModal.setNavGroupHelpHint(getDragComponentNavGroupHelp());\n\n        // Default item settings\n        boolean supportsDefaultNavItem = navWidget instanceof HasDefaultNavItem;\n        navComponentConfigModal.setDefaultNavItemSupported(supportsDefaultNavItem);\n        if (supportsDefaultNavItem) {\n            String navItemId = ctx.getComponentProperty(NAV_DEFAULT_ID);\n            navComponentConfigModal.setDefaultNavItemId(navItemId);\n        }\n        // Target div settings\n        boolean supportsTargetDiv = navWidget instanceof HasTargetDiv;\n        navComponentConfigModal.setTargetDivSupported(supportsTargetDiv);\n        if (supportsTargetDiv) {\n            String targetDivId = ctx.getComponentProperty(TARGET_DIV_ID);\n            navComponentConfigModal.setTargetDiv(targetDivId);\n            layoutTemplate = ctx.getCurrentLayoutTemplate();\n        }\n\n        navComponentConfigModal.setOnOk(() -> navConfigOk(ctx, supportsDefaultNavItem, supportsTargetDiv));\n        navComponentConfigModal.setOnCancel(() -> navConfigCancel(ctx));\n        navComponentConfigModal.show();\n        return ((NavComponentConfigModalView) navComponentConfigModal.getView()).getModal();\n    }\n\n    @Override\n    public void dispose() {\n        navWidget.dispose();\n    }\n\n    protected void showNavWidget() {\n        if (navGroupId != null) {\n            NavGroup navGroup = (NavGroup) navigationManager.getNavTree().getItemById(navGroupId);\n            navWidget.show(navGroup);\n        } else {\n            navWidget.show(Collections.emptyList());\n        }\n    }\n\n    protected void navConfigOk(ModalConfigurationContext ctx, boolean supportsDefaultNavItem, boolean supportsTargetDiv) {\n\n        navGroupId = navComponentConfigModal.getGroupId();\n        if (navGroupId != null) {\n            ctx.setComponentProperty(NAV_GROUP_ID, navGroupId);\n        } else {\n            ctx.removeComponentProperty(NAV_GROUP_ID);\n        }\n\n        String defaultItemId = navComponentConfigModal.getDefaultItemId();\n        if (supportsDefaultNavItem && defaultItemId != null) {\n            ctx.setComponentProperty(NAV_DEFAULT_ID, defaultItemId);\n        } else {\n            ctx.removeComponentProperty(NAV_DEFAULT_ID);\n        }\n\n        String targetDivId = navComponentConfigModal.getTargetDivId();\n        if (supportsTargetDiv && targetDivId != null) {\n            ctx.setComponentProperty(TARGET_DIV_ID, targetDivId);\n            checkLayoutTemplate();\n        } else {\n            ctx.removeComponentProperty(TARGET_DIV_ID);\n        }\n\n        ctx.configurationFinished();\n    }\n\n    protected void navConfigCancel(ModalConfigurationContext ctx) {\n        ctx.configurationCancelled();\n    }\n\n    protected void checkLayoutTemplate() {\n        if ((navWidget instanceof TargetDivNavWidget) && layoutTemplate != null) {\n            pluginManager.getLayoutTemplateInfo(layoutTemplate, layoutTemplateInfo -> {\n                if (!layoutTemplateInfo.getRecursionIssue().isEmpty()) {\n                    TargetDivNavWidget targetDivNavWidget = (TargetDivNavWidget) navWidget;\n                    targetDivNavWidget.onInfiniteRecursion(layoutTemplateInfo.getRecursionIssue());\n                }\n            });\n        }\n    }\n\n    // Check the layout template every time the navigation tree changes\n\n    public void onNavTreeChanged(@Observes final NavTreeChangedEvent event) {\n        checkLayoutTemplate();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavCarouselDragComponent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.navigation.widget.NavCarouselWidget;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\n\n/**\n * A layout editor's navigation component that a carousel of runtime perspectives\n */\n@Dependent\npublic class NavCarouselDragComponent extends AbstractNavDragComponent {\n\n    @Inject\n    public NavCarouselDragComponent(NavigationManager navigationManager,\n                                    PerspectivePluginManager pluginManager,\n                                    NavComponentConfigModal navComponentConfigModal,\n                                    NavCarouselWidget navWidget) {\n        super(navigationManager,\n                pluginManager,\n                navComponentConfigModal,\n                navWidget);\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return NavigationConstants.INSTANCE.navCarouselDragComponent();\n    }\n\n    @Override\n    public String getDragComponentNavGroupHelp() {\n        return NavigationConstants.INSTANCE.navCarouselDragComponentNavGroupHelp();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavDragComponent.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport org.dashbuilder.client.navigation.widget.NavWidget;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorNavComponent;\n\npublic interface NavDragComponent extends PerspectiveEditorNavComponent, HasModalConfiguration {\n\n    NavWidget getNavWidget();\n\n    String getDragComponentNavGroupHelp();\n\n    void dispose();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavMenuBarDragComponent.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.client.navigation.widget.NavMenuBarWidget;\n\n/**\n * A layout editor's navigation component that displays the entries under a given nav tree node as a menu bar\n */\n@Dependent\npublic class NavMenuBarDragComponent extends AbstractNavDragComponent {\n\n    @Inject\n    public NavMenuBarDragComponent(NavigationManager navigationManager,\n                                   PerspectivePluginManager pluginManager,\n                                   NavComponentConfigModal navComponentConfigModal,\n                                   NavMenuBarWidget navWidget) {\n        super(navigationManager,\n                pluginManager,\n                navComponentConfigModal,\n                navWidget);\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return NavigationConstants.INSTANCE.navMenubarDragComponent();\n    }\n\n    @Override\n    public String getDragComponentNavGroupHelp() {\n        return NavigationConstants.INSTANCE.navMenubarDragComponentNavGroupHelp();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavTabListDragComponent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.client.navigation.widget.NavTabListWidget;\n\n/**\n * A layout editor's navigation component that shows a list of tabs providing links to workbench assets\n */\n@Dependent\npublic class NavTabListDragComponent extends AbstractNavDragComponent {\n\n    @Inject\n    public NavTabListDragComponent(NavigationManager navigationManager,\n                                   PerspectivePluginManager pluginManager,\n                                   NavComponentConfigModal navComponentConfigModal,\n                                   NavTabListWidget navWidget) {\n        super(navigationManager,\n                pluginManager,\n                navComponentConfigModal,\n                navWidget);\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return NavigationConstants.INSTANCE.navTabListDragComponent();\n    }\n\n    @Override\n    public String getDragComponentNavGroupHelp() {\n        return NavigationConstants.INSTANCE.navTabListDragComponentNavGroupHelp();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavTilesDragComponent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.client.navigation.widget.NavTilesWidget;\n\n/**\n * A layout editor's navigation component that shows a navigation group structure using two tile types: folders\n * (for nav group items) and links to perspective items.\n * @see NavTilesWidget\n */\n@Dependent\npublic class NavTilesDragComponent extends AbstractNavDragComponent {\n\n    @Inject\n    public NavTilesDragComponent(NavigationManager navigationManager,\n                                 PerspectivePluginManager pluginManager,\n                                 NavComponentConfigModal navComponentConfigModal,\n                                 NavTilesWidget navWidget) {\n        super(navigationManager,\n                pluginManager,\n                navComponentConfigModal,\n                navWidget);\n\n        this.navWidget.setHideEmptyGroups(true);\n\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return NavigationConstants.INSTANCE.navTilesDragComponent();\n    }\n\n    @Override\n    public String getDragComponentNavGroupHelp() {\n        return NavigationConstants.INSTANCE.navTilesDragComponentNavGroupHelp();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/layout/editor/NavTreeDragComponent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.layout.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.client.navigation.widget.NavTreeWidget;\n\n@Dependent\npublic class NavTreeDragComponent extends AbstractNavDragComponent {\n\n    @Inject\n    public NavTreeDragComponent(NavigationManager navigationManager,\n                                PerspectivePluginManager pluginManager,\n                                NavComponentConfigModal navComponentConfigModal,\n                                NavTreeWidget navWidget) {\n        super(navigationManager,\n                pluginManager,\n                navComponentConfigModal,\n                navWidget);\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return NavigationConstants.INSTANCE.navTreeDragComponent();\n    }\n\n    @Override\n    public String getDragComponentNavGroupHelp() {\n        return NavigationConstants.INSTANCE.navTreeDragComponentNavGroupHelp();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/plugin/PerspectivePluginEntryPoint.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navigation.plugin;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\n\n@EntryPoint\n@ApplicationScoped\npublic class PerspectivePluginEntryPoint {\n\n    @Inject\n    PerspectivePluginManager perspectivePluginManager;\n\n    @PostConstruct\n    private void init() {\n        perspectivePluginManager.loadPlugins();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/plugin/PerspectivePluginManager.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.plugin;\n\nimport java.util.Collection;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.LayoutTemplateInfo;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface PerspectivePluginManager {\n    \n    void loadPlugins();\n\n    void getPerspectivePlugins(ParameterizedCommand<Collection<Plugin>> callback);\n\n    boolean isRuntimePerspective(Plugin plugin);\n\n    boolean isRuntimePerspective(NavItem navItem);\n\n    boolean isRuntimePerspective(String perspectiveId);\n\n    String getRuntimePerspectiveId(NavItem navItem);\n\n    boolean existsPerspectivePlugin(String perspectiveName);\n\n    void getLayoutTemplateInfo(String perspectiveName, ParameterizedCommand<LayoutTemplateInfo> callback);\n\n    void getLayoutTemplateInfo(LayoutTemplate layoutTemplate, ParameterizedCommand<LayoutTemplateInfo> callback);\n\n    void buildPerspectiveWidget(String perspectiveName, LayoutTemplateContext layoutCtx, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion);\n\n    default void buildPerspectiveWidget(String perspectiveName, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion) {\n        buildPerspectiveWidget(perspectiveName, null, afterBuild, onInfiniteRecursion);\n    }\n\n    NavGroup getLastBuildPerspectiveNavGroup();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/plugin/PerspectivePluginManagerImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.plugin;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Stack;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.navigation.event.PerspectivePluginsChangedEvent;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.LayoutTemplateInfo;\nimport org.dashbuilder.navigation.service.PerspectivePluginServices;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.ClientTypeRegistry;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.ext.plugin.client.type.PerspectiveLayoutPluginResourceType;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@EntryPoint\n@ApplicationScoped\npublic class PerspectivePluginManagerImpl implements PerspectivePluginManager {\n\n    private ClientTypeRegistry clientTypeRegistry;\n    private LayoutGenerator layoutGenerator;\n    private NavigationManager navigationManager;\n    private Caller<PerspectivePluginServices> pluginServices;\n    private Event<PerspectivePluginsChangedEvent> perspectivesChangedEvent;\n    private Map<String, Plugin> pluginMap = new HashMap<>();\n    private boolean pluginsLoaded = false;\n    private Stack<NavGroup> navGroupStack = new Stack<>();\n\n    @Inject\n    public PerspectivePluginManagerImpl(ClientTypeRegistry clientTypeRegistry,\n                                        LayoutGenerator layoutGenerator,\n                                        NavigationManager navigationManager,\n                                        Caller<PerspectivePluginServices> pluginServices,\n                                        Event<PerspectivePluginsChangedEvent> perspectivesChangedEvent) {\n        this.clientTypeRegistry = clientTypeRegistry;\n        this.layoutGenerator = layoutGenerator;\n        this.navigationManager = navigationManager;\n        this.pluginServices = pluginServices;\n        this.perspectivesChangedEvent = perspectivesChangedEvent;\n    }\n\n    @Override\n    public void getPerspectivePlugins(ParameterizedCommand<Collection<Plugin>> callback) {\n        loadPlugins(callback);\n    }\n\n    @Override\n    public boolean isRuntimePerspective(Plugin plugin) {\n        ClientResourceType type = clientTypeRegistry.resolve(plugin.getPath());\n        return type != null && type instanceof PerspectiveLayoutPluginResourceType;\n    }\n\n    @Override\n    public boolean isRuntimePerspective(NavItem navItem) {\n        return getRuntimePerspectiveId(navItem) != null;\n    }\n\n    @Override\n    public boolean isRuntimePerspective(String perspectiveId) {\n        return pluginMap.containsKey(perspectiveId);\n    }\n\n    @Override\n    public String getRuntimePerspectiveId(NavItem navItem) {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n        String resourceId = navCtx.getResourceId();\n        ActivityResourceType resourceType = navCtx.getResourceType();\n        boolean isRuntimePerspective = resourceId != null && ActivityResourceType.PERSPECTIVE.equals(resourceType) && isRuntimePerspective(resourceId);\n        return isRuntimePerspective ? resourceId : null;\n    }\n\n    @Override\n    public boolean existsPerspectivePlugin(String perspectiveName) {\n        return perspectiveName != null && pluginMap.get(perspectiveName) != null;\n    }\n\n    @Override\n    public void getLayoutTemplateInfo(String perspectiveName, ParameterizedCommand<LayoutTemplateInfo> callback) {\n        pluginServices.call((RemoteCallback<LayoutTemplateInfo>) callback::execute).getLayoutTemplateInfo(perspectiveName);\n    }\n\n    @Override\n    public void getLayoutTemplateInfo(LayoutTemplate layoutTemplate, ParameterizedCommand<LayoutTemplateInfo> callback) {\n        pluginServices.call((RemoteCallback<LayoutTemplateInfo>) callback::execute).getLayoutTemplateInfo(layoutTemplate);\n    }\n\n    @Override\n    public void buildPerspectiveWidget(String perspectiveName, LayoutTemplateContext layoutCtx, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion) {\n        Plugin plugin = pluginMap.get(perspectiveName);\n        pluginServices.call((LayoutTemplateInfo layoutInfo) -> {\n\n            if (!layoutInfo.getRecursionIssue().isEmpty()) {\n                onInfiniteRecursion.execute(layoutInfo.getRecursionIssue());\n            } else {\n                String navGroupId = layoutCtx != null && layoutCtx.getNavGroupId() != null ? layoutCtx.getNavGroupId() : null;\n                NavGroup navGroup = navGroupId != null ? (NavGroup) navigationManager.getNavTree().getItemById(navGroupId) : null;\n                try {\n                    if (navGroup != null) {\n                        navGroupStack.push(navGroup);\n                    }\n                    LayoutInstance result = layoutGenerator.build(layoutInfo.getLayoutTemplate());\n                    IsWidget widget = ElementWrapperWidget.getWidget(result.getElement());\n                    afterBuild.execute(widget);\n                } finally {\n                    if (navGroup != null) {\n                        navGroupStack.pop();\n                    }\n                }\n            }\n        }).getLayoutTemplateInfo(plugin, layoutCtx);\n    }\n\n    /**\n     * Get the last nav group instance passed to the execution of a {@link #buildPerspectiveWidget(String, LayoutTemplateContext, ParameterizedCommand, ParameterizedCommand)} call.\n     *\n     * @return The {@link NavGroup} instance passed to the build method or null if none.\n     */\n    @Override\n    public NavGroup getLastBuildPerspectiveNavGroup() {\n        return navGroupStack.isEmpty() ? null : navGroupStack.peek();\n    }\n\n    // Sync up both the internals plugin & widget registry\n\n    public void onPlugInAdded(@Observes final PluginAdded event) {\n        Plugin plugin = event.getPlugin();\n        if (isRuntimePerspective(plugin)) {\n            pluginMap.put(plugin.getName(), plugin);\n            perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent());\n        }\n    }\n\n    public void onPlugInSaved(@Observes final PluginSaved event) {\n        Plugin plugin = event.getPlugin();\n        if (isRuntimePerspective(plugin)) {\n            pluginMap.put(plugin.getName(), plugin);\n            perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent());\n        }\n    }\n\n    public void onPlugInRenamed(@Observes final PluginRenamed event) {\n        Plugin plugin = event.getPlugin();\n        if (isRuntimePerspective(plugin)) {\n            pluginMap.remove(event.getOldPluginName());\n            pluginMap.put(plugin.getName(), plugin);\n\n            NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(event.getOldPluginName());\n            NavWorkbenchCtx newCtx = NavWorkbenchCtx.perspective(event.getPlugin().getName());\n            List<NavItem> itemsToRename = navigationManager.getNavTree().searchItems(ctx);\n            for (NavItem navItem : itemsToRename) {\n                navItem.setContext(newCtx.toString());\n            }\n            if (!itemsToRename.isEmpty()) {\n                navigationManager.saveNavTree(navigationManager.getNavTree(), () -> {\n                });\n            }\n            perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent());\n        }\n    }\n\n    public void onPlugInDeleted(@Observes final PluginDeleted event) {\n        String pluginName = event.getPluginName();\n        pluginMap.remove(pluginName);\n\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName);\n        NavTree navTree = navigationManager.getNavTree();\n        List<NavItem> itemsToDelete = navTree.searchItems(ctx);\n        for (NavItem item : itemsToDelete) {\n            navTree.deleteItem(item.getId());\n        }\n        if (!itemsToDelete.isEmpty()) {\n            navigationManager.saveNavTree(navTree, null);\n        }\n        perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent());\n    }\n\n    @Override\n    public void loadPlugins() {\n        loadPlugins(plugins -> {\n        });\n    }\n\n    private void loadPlugins(ParameterizedCommand<Collection<Plugin>> callback) {\n        if (pluginsLoaded) {\n            callback.execute(pluginMap.values());\n        } else {\n            pluginServices.call(((Collection<Plugin> plugins) -> {\n                pluginMap.clear();\n                plugins.stream().filter(this::isRuntimePerspective).forEach(p -> pluginMap.put(p.getName(), p));\n                pluginsLoaded = true;\n                callback.execute(pluginMap.values());\n            })).listPlugins();\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface NavigationConstants extends Messages {\n\n    NavigationConstants INSTANCE = GWT.create(NavigationConstants.class);\n\n    String newItem(String itemName);\n\n    String newItemName(String itemName);\n\n    String itemMenuTitle();\n\n    String editItem();\n\n    String deleteItem();\n\n    String pageIconTitle();\n\n    String perspectiveIconTitle();\n\n    String moveUp();\n\n    String moveDown();\n\n    String moveFirst();\n\n    String moveLast();\n\n    String gotoItem(String itemName);\n\n    String saveChanges();\n\n    String save();\n\n    String cancel();\n\n    String navMenubarDragComponent();\n\n    String navTabListDragComponent();\n\n    String navTreeDragComponent();\n\n    String navTilesDragComponent();\n\n    String navCarouselDragComponent();\n\n    String navMenubarDragComponentNavGroupHelp();\n\n    String navTabListDragComponentNavGroupHelp();\n\n    String navTreeDragComponentNavGroupHelp();\n\n    String navTilesDragComponentNavGroupHelp();\n\n    String navCarouselDragComponentNavGroupHelp();\n\n    String navGroupEmptyError();\n\n    String navCarouselDragComponentEmptyError();\n\n    String navTilesDragComponentInfiniteRecursion();\n\n    String navCarouselDragComponentInfiniteRecursion();\n\n    String targetDivIdPerspectiveInfiniteRecursion();\n\n    String navWidgetTargetDivMissing();\n\n    String navGroupNotFound();\n\n    String navItemsEmpty();\n\n    String openNavItem(String itemName);\n\n    String gotoNavItem(String itemName);\n\n    String showNavItem(String itemName);\n\n    String navConfigHeader();\n\n    String navGroupLabel();\n\n    String navGroupHelp();\n\n    String navGroupSelectorHint();\n\n    String defaultItemLabel();\n\n    String defaultItemHelp();\n\n    String defaultItemSelectorHint();\n\n    String defaultItemsNotFound();\n\n    String targetDivLabel();\n\n    String targetDivHelp();\n\n    String targetDivSelectorHint();\n\n    String targetDivsNotFound();\n\n    String navItemEditorPerspectiveHelp();\n\n    String navItemEditorGroupHelp();\n\n    String navRefPerspective(String name);\n\n    String navRefGroupDefined(String name);\n\n    String navRefGroupContext(String name);\n\n    String navRefPerspectiveFound(String name);\n\n    String navRefPerspectiveDefault(String name);\n\n    String navRefPerspectiveInGroup(String name);\n\n    String navRefComponent(String name);\n\n    String navRefDefaultItemDefined(String name);\n\n    String navRefDefaultItemFound(String name);\n\n    String navRefPerspectiveRecursionEnd();\n }\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/BaseNavWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveRoleEvent;\nimport org.uberfire.mvp.Command;\n\npublic abstract class BaseNavWidget implements NavWidget {\n\n    NavigationManager navigationManager;\n    boolean secure = true;\n    boolean hideEmptyGroups = true;\n    Command onItemSelectedCommand;\n    Command onStaleCommand;\n    NavItem itemSelected;\n    NavGroup navGroup;\n    NavWidget parent;\n    NavWidgetView view;\n    int maxLevels = -1;\n    List<NavItem> navItemList = null;\n    NavWidget activeNavSubgroup = null;\n    List<NavWidget> navSubgroupList = new ArrayList<>();\n\n    @Inject\n    public BaseNavWidget(NavWidgetView view, NavigationManager navigationManager) {\n        this.view = view;\n        this.navigationManager = navigationManager;\n        view.init(this);\n    }\n\n    public NavigationManager getNavigationManager() {\n        return navigationManager;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setSecure(boolean secure) {\n        this.secure = secure;\n    }\n\n    @Override\n    public void setHideEmptyGroups(boolean hide) {\n        this.hideEmptyGroups = hide;\n    }\n\n    @Override\n    public void setOnItemSelectedCommand(Command onItemSelected) {\n        this.onItemSelectedCommand = onItemSelected;\n    }\n\n    @Override\n    public void setOnStaleCommand(Command onStaleCommand) {\n        this.onStaleCommand = onStaleCommand;\n    }\n\n    public NavItem getItem(String id) {\n        if (navItemList == null || id == null) {\n            return null;\n        }\n        for (NavItem navItem : navItemList) {\n            if (id.equals(navItem.getId())) {\n                return navItem;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public int getLevel() {\n        int level = 0;\n        NavWidget root = parent;\n        while (root != null) {\n            level++;\n            root = root.getParent();\n        }\n        return level;\n    }\n\n    @Override\n    public NavWidget getParent() {\n        return parent;\n    }\n\n    @Override\n    public void setParent(NavWidget parent) {\n        this.parent = parent;\n    }\n\n    @Override\n    public int getMaxLevels() {\n        return maxLevels;\n    }\n\n    @Override\n    public void setMaxLevels(int maxLevels) {\n        this.maxLevels = maxLevels;\n    }\n\n    @Override\n    public NavGroup getNavGroup() {\n        return navGroup;\n    }\n\n    public boolean areSubGroupsSupported() {\n        return maxLevels < 1 || getLevel() < maxLevels-1;\n    }\n\n    protected NavWidget getSubgroupNavWidget(String groupId) {\n        for (NavWidget navWidget : navSubgroupList) {\n            if (navWidget.getNavGroup().getId().equals(groupId)) {\n                return navWidget;\n            }\n        }\n        return null;\n    }\n\n    protected NavWidget lookupNavGroupWidget() {\n        return null;\n    }\n\n    @Override\n    public void hide() {\n        view.clearItems();\n        navSubgroupList.forEach(NavWidget::hide);\n    }\n\n    @Override\n    public void show(NavGroup navGroup) {\n        this.navGroup = navGroup;\n        if (navGroup == null) {\n            view.errorNavGroupNotFound();\n        } else {\n            this.show(navGroup.getChildren());\n        }\n    }\n\n    @Override\n    public void show(NavTree navTree) {\n        if (navTree == null) {\n            view.errorNavItemsEmpty();\n        } else {\n            this.show(navTree.getRootItems());\n        }\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        this.hide();\n\n        this.navItemList = itemList;\n        this.navSubgroupList.clear();\n\n        // Make sure the items shown comply with the authz policy defined\n        if (secure) {\n            navItemList = new ArrayList<>(itemList);\n            navigationManager.secure(navItemList, hideEmptyGroups);\n        }\n\n        if (navItemList.isEmpty()) {\n            view.errorNavItemsEmpty();\n        }\n\n        for (NavItem navChild : navItemList) {\n\n            // A subgroup\n            if (navChild instanceof NavGroup) {\n\n                // Ensure to not exceed the maximum number of levels\n                if (areSubGroupsSupported()) {\n                    showGroup((NavGroup) navChild);\n                } else {\n                    showItem(navChild);\n                }\n            }\n            // A divider\n            else if (navChild instanceof NavDivider) {\n                view.addDivider();\n            }\n            // A regular item\n            else {\n                showItem(navChild);\n            }\n        }\n    }\n\n    protected void showGroup(NavGroup navGroup) {\n        NavWidget subGroupNavWidget = lookupNavGroupWidget();\n        if (subGroupNavWidget != null) {\n            subGroupNavWidget.setParent(this);\n            subGroupNavWidget.setMaxLevels(maxLevels > 0 ? maxLevels - 1 : -1);\n            subGroupNavWidget.setSecure(secure);\n            subGroupNavWidget.setHideEmptyGroups(hideEmptyGroups);\n            subGroupNavWidget.setOnItemSelectedCommand(() -> onSubGroupItemClicked(subGroupNavWidget));\n            subGroupNavWidget.show(navGroup);\n            navSubgroupList.add(subGroupNavWidget);\n            view.addGroupItem(navGroup.getId(), navGroup.getName(), navGroup.getDescription(), subGroupNavWidget);\n        }\n    }\n\n    protected void showItem(NavItem navItem) {\n        view.addItem(navItem.getId(), navItem.getName(), navItem.getDescription(), () -> {\n            onItemClicked(navItem);\n        });\n    }\n\n    @Override\n    public NavItem getItemSelected() {\n        return itemSelected;\n    }\n\n    @Override\n    public boolean setSelectedItem(String id) {\n        clearSelectedItem();\n\n        NavItem navItem = getItem(id);\n        if (navItem != null) {\n            itemSelected = navItem;\n            view.setSelectedItem(navItem.getId());\n            return true;\n        }\n\n        for (NavWidget navWidget : navSubgroupList) {\n            if (navWidget.setSelectedItem(id)) {\n                itemSelected = navWidget.getItemSelected();\n                activeNavSubgroup = navWidget;\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public void clearSelectedItem() {\n        itemSelected = null;\n        view.clearSelectedItem();\n        if (activeNavSubgroup != null) {\n            activeNavSubgroup.clearSelectedItem();\n            activeNavSubgroup = null;\n        }\n    }\n\n    public void onSubGroupItemClicked(NavWidget subGroup) {\n        if (activeNavSubgroup != null && activeNavSubgroup != subGroup) {\n            activeNavSubgroup.clearSelectedItem();\n        }\n\n        activeNavSubgroup = subGroup;\n        view.clearSelectedItem();\n        view.setSelectedItem(subGroup.getNavGroup().getId());\n        itemSelected = subGroup.getItemSelected();\n\n        if (onItemSelectedCommand != null) {\n            onItemSelectedCommand.execute();\n        }\n    }\n\n    public void onItemClicked(NavItem navItem) {\n        clearSelectedItem();\n\n        itemSelected = navItem;\n        view.setSelectedItem(navItem.getId());\n\n        navigationManager.navItemClicked(navItem);\n\n        if (onItemSelectedCommand != null) {\n            onItemSelectedCommand.execute();\n        }\n    }\n\n    protected void refresh() {\n        if (onStaleCommand != null) {\n            onStaleCommand.execute();\n        }\n    }\n\n    @Override\n    public void dispose() {\n        view.clearItems();\n        navSubgroupList.forEach(NavWidget::dispose);\n    }\n\n    // Listen to changes in the navigation tree\n\n    public void onNavTreeChanged(@Observes final NavTreeChangedEvent event) {\n        navigationManager.update(event.getNavTree());\n        refresh();\n    }\n\n    // Listen to authorization policy changes as it might impact the menu items shown\n\n    public void onAuthzPolicyChanged(@Observes final SaveRoleEvent event) {\n        if (secure) {\n            refresh();\n        }\n    }\n\n    public void onAuthzPolicyChanged(@Observes final SaveGroupEvent event) {\n        if (secure) {\n            refresh();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/BaseNavWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.uberfire.mvp.Command;\n\npublic abstract class BaseNavWidgetView<T> extends Composite implements NavWidgetView<T> {\n\n    protected Node navWidget = null;\n    protected Element selectedItem = null;\n    protected Map<String,Element> itemMap = new HashMap<>();\n    protected Set<IsWidget> widgetSet = new HashSet<>();\n\n    protected void appendWidgetToElement(HTMLElement element, IsWidget widget) {\n        DOMUtil.appendWidgetToElement(element, widget);\n        widgetSet.add(widget);\n    }\n\n    @Override\n    public void clearItems() {\n        DOMUtil.removeAllChildren(navWidget);\n        widgetSet.forEach(DOMUtil::removeFromParent);\n    }\n\n    @Override\n    public void addGroupItem(String id, String name, String description, IsWidget widget) {\n        Element el = widget.asWidget().getElement();\n        navWidget.appendChild((Node) el);\n    }\n\n    @Override\n    public void addItem(String id, String name, String description, Command onItemSelected) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n        if (description != null && !description.equals(name)) {\n            anchor.setTitle(description);\n        }\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        navWidget.appendChild((Node) li);\n        itemMap.put(id, li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if (Event.ONCLICK == event.getTypeInt()) {\n                onItemSelected.execute();\n            }\n        });\n    }\n\n    @Override\n    public void setSelectedItem(String id) {\n        Element el = itemMap.get(id);\n        if (el != null) {\n            clearSelectedItem();\n            selectedItem = el;\n            setSelectedEnabled(true);\n        }\n    }\n\n    @Override\n    public void clearSelectedItem() {\n        if (selectedItem != null) {\n            setSelectedEnabled(false);\n            selectedItem = null;\n        }\n    }\n\n    protected void setSelectedEnabled(boolean enabled) {\n        if (enabled) {\n            selectedItem.setClassName(\"active\");\n        } else {\n            selectedItem.setClassName(\"\");\n        }\n    }\n\n    @Override\n    public void errorNavGroupNotFound() {\n        addItem(\"error\", NavigationConstants.INSTANCE.navGroupNotFound(), null, () -> {});\n    }\n\n    @Override\n    public void errorNavItemsEmpty() {\n        addItem(\"error\", NavigationConstants.INSTANCE.navItemsEmpty(), null, () -> {});\n    }\n\n    // LayoutRecursionIssueI18n\n\n    public String navRefPerspectiveI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefPerspective(name);\n    }\n\n    public String navRefPerspectiveFoundI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefPerspectiveFound(name);\n    }\n\n    public String navRefPerspectiveDefaultI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefPerspectiveDefault(name);\n    }\n\n    public String navRefPerspectiveInGroupI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefPerspectiveInGroup(name);\n    }\n\n    public String navRefComponentI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefComponent(name);\n    }\n\n    public String navRefGroupDefinedI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefGroupDefined(name);\n    }\n\n    public String navRefGroupContextI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefGroupContext(name);\n    }\n\n    public String navRefDefaultItemDefinedI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefDefaultItemDefined(name);\n    }\n\n    public String navRefDefaultItemFoundI18n(String name) {\n        return NavigationConstants.INSTANCE.navRefDefaultItemFound(name);\n    }\n\n    public String navRefPerspectiveRecursionEndI18n() {\n        return NavigationConstants.INSTANCE.navRefPerspectiveRecursionEnd();\n    }\n\n    public String navMenubarDragComponentI18n() {\n        return NavigationConstants.INSTANCE.navMenubarDragComponent();\n    }\n\n    public String navTreeDragComponentI18n() {\n        return NavigationConstants.INSTANCE.navTreeDragComponent();\n    }\n\n    public String navTilesDragComponentI18n() {\n        return NavigationConstants.INSTANCE.navTilesDragComponent();\n    }\n\n    public String navTabListDragComponentI18n() {\n        return NavigationConstants.INSTANCE.navTabListDragComponent();\n    }\n\n    public String navCarouselDragComponentI18n() {\n        return NavigationConstants.INSTANCE.navCarouselDragComponent();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/HasDefaultNavItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\n/**\n * Interface implemented for those {@link NavWidget} implementations that allows for\n * the definition of a default nav item to display.\n */\npublic interface HasDefaultNavItem {\n\n    String getDefaultNavItemId();\n\n    void setDefaultNavItemId(String navItemId);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/HasTargetDiv.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\n/**\n * Interface implemented for those {@link NavWidget} implementations that accept a target div as the location to\n * display the content of the nav items clicked by the user.\n */\npublic interface HasTargetDiv {\n\n    String getTargetDivId();\n\n    void setTargetDivId(String targetDivId);\n\n    void setGotoItemEnabled(boolean gotoDefaultItem);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavCarouselWidget.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssueI18n;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n@Dependent\npublic class NavCarouselWidget extends BaseNavWidget implements HasDefaultNavItem {\n\n    public interface View extends NavWidgetView<NavCarouselWidget>, LayoutRecursionIssueI18n {\n\n        void addContentSlide(IsWidget widget);\n\n        void infiniteRecursionError(String cause);\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    List<String> perspectiveIds = new ArrayList<>();\n    String defaultNavItemId = null;\n\n    @Inject\n    public NavCarouselWidget(View view, NavigationManager navigationManager, PerspectivePluginManager perspectivePluginManager) {\n        super(view, navigationManager);\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n        super.setMaxLevels(1);\n    }\n\n    @Override\n    public boolean areSubGroupsSupported() {\n        return false;\n    }\n\n    @Override\n    public String getDefaultNavItemId() {\n        return defaultNavItemId;\n    }\n\n    @Override\n    public void setDefaultNavItemId(String defaultNavItemId) {\n        this.defaultNavItemId = defaultNavItemId;\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        // Discard everything but runtime perspectives\n        List<NavItem> itemsFiltered = itemList.stream()\n                .filter(perspectivePluginManager::isRuntimePerspective)\n                .collect(Collectors.toList());\n\n        // Get the default item configured (if any)\n        NavItem defaultNavItem = null;\n        if (defaultNavItemId != null) {\n            for (NavItem navItem : itemsFiltered) {\n                if (defaultNavItemId.equals(navItem.getId())) {\n                    defaultNavItem = navItem;\n                }\n            }\n        }\n        // Place the default item at the beginning of the carousel\n        if (defaultNavItem != null) {\n            itemsFiltered.remove(defaultNavItem);\n            itemsFiltered.add(0, defaultNavItem);\n        }\n\n        perspectiveIds.clear();\n        super.show(itemsFiltered);\n    }\n\n    @Override\n    protected void showItem(NavItem navItem) {\n        // Only runtime perspectives can be displayed\n        String perspectiveId = perspectivePluginManager.getRuntimePerspectiveId(navItem);\n        if (perspectiveId != null) {\n            perspectiveIds.add(perspectiveId);\n            perspectivePluginManager.buildPerspectiveWidget(perspectiveId, view::addContentSlide, this::onInfiniteRecursion);\n        }\n    }\n\n    public void onInfiniteRecursion(LayoutRecursionIssue issue) {\n        String cause = issue.printReport(navigationManager.getNavTree(), view);\n        view.infiniteRecursionError(cause);\n    }\n\n    // Catch changes on runtime perspectives so as to display the most up to date changes\n\n    private void onPerspectiveChanged(@Observes PluginSaved event) {\n        Plugin plugin = event.getPlugin();\n        String pluginName = plugin.getName();\n        if (perspectiveIds.contains(pluginName)) {\n            super.refresh();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavCarouselWidgetView.html",
    "content": "<div data-field=\"mainDiv\">\n    <div data-field=\"carouselDiv\" id=\"myCarousel\" class=\"carousel slide\" data-ride=\"carousel\">\n        <!-- Wrapper for slides -->\n        <div data-field=\"slidesDiv\" class=\"carousel-inner\" role=\"listbox\">\n        </div>\n\n        <!-- Left and right controls -->\n        <a class=\"left carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"prev\">\n            <span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>\n            <span class=\"sr-only\">Previous</span>\n        </a>\n        <a class=\"right carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"next\">\n            <span class=\"glyphicon glyphicon-chevron-right\" aria-hidden=\"true\"></span>\n            <span class=\"sr-only\">Next</span>\n        </a>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavCarouselWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.CSSStyleDeclaration;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class NavCarouselWidgetView extends BaseNavWidgetView<NavCarouselWidget>\n    implements NavCarouselWidget.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div carouselDiv;\n\n    @Inject\n    @DataField\n    Div slidesDiv;\n\n    NavCarouselWidget presenter;\n    AlertBox alertBox;\n\n    @Inject\n    public NavCarouselWidgetView(AlertBox alertBox) {\n        this.alertBox = alertBox;\n        alertBox.setLevel(AlertBox.Level.WARNING);\n        alertBox.setCloseEnabled(false);\n        alertBox.getElement().getStyle().setProperty(\"width\", \"96%\");\n    }\n\n    @Override\n    public void init(NavCarouselWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = slidesDiv;\n    }\n\n    @Override\n    public void addDivider() {\n        // Useless in a tab list\n    }\n\n    @Override\n    public void addContentSlide(IsWidget widget) {\n        DOMUtil.removeAllChildren(mainDiv);\n        mainDiv.appendChild(carouselDiv);\n\n        Div div = (Div) Window.getDocument().createElement(\"div\");\n        div.setClassName(slidesDiv.getChildNodes().getLength() == 0 ? \"item active\" : \"item\");\n        super.appendWidgetToElement(div, widget);\n        slidesDiv.appendChild(div);\n    }\n\n    @Override\n    public void errorNavGroupNotFound() {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(NavigationConstants.INSTANCE.navGroupNotFound());\n        mainDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void errorNavItemsEmpty() {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(NavigationConstants.INSTANCE.navCarouselDragComponentEmptyError());\n        mainDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void infiniteRecursionError(String cause) {\n        Div div = (Div) Window.getDocument().createElement(\"div\");\n        div.setClassName(slidesDiv.getChildNodes().getLength() == 0 ? \"item active\" : \"item\");\n        alertBox.setMessage(NavigationConstants.INSTANCE.navCarouselDragComponentInfiniteRecursion() + \" \" + cause);\n        div.appendChild(alertBox.getElement());\n        slidesDiv.appendChild(div);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavComponentConfigModal.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivList;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class NavComponentConfigModal implements IsWidget {\n\n    public interface View extends UberView<NavComponentConfigModal> {\n\n        void clearNavGroupItems();\n\n        void setNavGroupEnabled(boolean enabled);\n\n        void addNavGroupItem(String name, Command onSelect);\n\n        void setNavGroupSelection(String name, Command onReset);\n\n        void setNavGroupHelpText(String text);\n\n        void setDefaultNavItemEnabled(boolean enabled);\n\n        void setDefaultNavItemVisible(boolean enabled);\n\n        void clearDefaultItems();\n\n        void defaultItemsNotFound();\n\n        void setDefaultItemSelection(String name, Command onReset);\n\n        void addDefaultItem(String name, Command onSelect);\n\n        void setTargetDivVisible(boolean enabled);\n\n        void clearTargetDivItems();\n\n        void targetDivsNotFound();\n\n        void addTargetDivItem(String name, Command onSelect);\n\n        void setTargetDivSelection(String name, Command onReset);\n\n        void show();\n\n        void hide();\n    }\n\n    View view;\n    String groupId = null;\n    NavGroup group = null;\n    String defaultItemId = null;\n    String targetDivId = null;\n    List<NavItem> navItemList = null;\n    List<String> targetDivIdList = null;\n    Command onOk = null;\n    Command onCancel = null;\n\n    @Inject\n    public NavComponentConfigModal(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public void setTargetDivIdList(List<String> targetDivIdList) {\n        this.targetDivIdList = targetDivIdList;\n    }\n\n    public void setOnOk(Command onOk) {\n        this.onOk = onOk;\n    }\n\n    public void setOnCancel(Command onCancel) {\n        this.onCancel = onCancel;\n    }\n\n    public void setNavGroupHelpHint(String text) {\n        view.setNavGroupHelpText(text);\n    }\n\n    public String getGroupId() {\n        return groupId;\n    }\n\n    public String getDefaultItemId() {\n        return defaultItemId;\n    }\n\n    public String getTargetDivId() {\n        return targetDivId;\n    }\n\n    public void setTargetDivSupported(boolean supported) {\n        view.setTargetDivVisible(supported);\n    }\n\n    public void setTargetDiv(String targetDivId) {\n        this.targetDivId = targetDivId;\n    }\n\n    public void setDefaultNavItemSupported(boolean supported) {\n        view.setDefaultNavItemVisible(supported);\n    }\n\n    public void setDefaultNavItemId(String navItemId) {\n        defaultItemId = navItemId;\n    }\n\n    public void setNavGroup(List<NavItem> navItemList, String selectedGroupId) {\n        this.navItemList = navItemList;\n        this.groupId = selectedGroupId;\n        this.group = null;\n    }\n\n    private void updateNavGroups() {\n        group = null;\n        view.clearNavGroupItems();\n        if (navItemList != null) {\n            updateNavGroups(navItemList);\n        }\n    }\n\n    private void updateNavGroups(List<NavItem> navItemList) {\n        navItemList.stream()\n                .filter(navItem -> navItem instanceof NavGroup)\n                .forEach(this::addNavGroup);\n    }\n\n    private void addNavGroup(NavItem navItem) {\n        String fullPath = calculateFullPath(navItem);\n        if (groupId == null || navItem.getId().equals(groupId)) {\n            groupId = navItem.getId();\n            group = (NavGroup) navItem;\n            view.setNavGroupSelection(fullPath, () -> {});\n        } else {\n            view.addNavGroupItem(fullPath, () -> onGroupSelected(navItem.getId()));\n        }\n        // Add the children items\n        updateNavGroups(((NavGroup) navItem).getChildren());\n    }\n\n    private void updateDefaultItems() {\n        view.clearDefaultItems();\n        view.setDefaultNavItemEnabled(group != null);\n        if (group == null || group.getChildren().isEmpty()) {\n            view.defaultItemsNotFound();\n        } else {\n            NavGroup clone = (NavGroup) group.cloneItem();\n            clone.setParent(null);\n            updateDefaultItems(clone, 1);\n        }\n    }\n\n    private void updateDefaultItems(NavGroup navGroup, int level) {\n        for (NavItem navItem : navGroup.getChildren()) {\n\n            // Divider N/A\n            if (navItem instanceof NavDivider) {\n                continue;\n            }\n            // Add the default item. Skip groups.\n            if (!(navItem instanceof NavGroup)) {\n                String fullPath = calculateFullPath(navItem);\n                if (defaultItemId != null && navItem.getId().equals(defaultItemId)) {\n                    view.setDefaultItemSelection(fullPath, () -> onDefaultItemSelected(null));\n                } else {\n                    view.addDefaultItem(fullPath, () -> onDefaultItemSelected(navItem.getId()));\n                }\n            }\n            // Append children\n            if (navItem instanceof NavGroup) {\n                updateDefaultItems((NavGroup) navItem, level+1);\n            }\n        }\n    }\n\n    private void updateTargetDivs() {\n        view.clearTargetDivItems();\n\n        if (targetDivIdList == null || targetDivIdList.isEmpty()) {\n            view.targetDivsNotFound();\n        } else {\n            for (String divId : targetDivIdList) {\n                if (targetDivId == null || !targetDivIdList.contains(targetDivId) || divId.equals(targetDivId)) {\n                    targetDivId = divId;\n                    view.setTargetDivSelection(divId, () -> onTargetDivSelected(null));\n                } else {\n                    view.addTargetDivItem(divId, () -> onTargetDivSelected(divId));\n                }\n            }\n        }\n    }\n\n    public String calculateFullPath(NavItem navItem) {\n        StringBuilder out = new StringBuilder();\n        NavItem parent = navItem.getParent();\n        while (parent != null) {\n            out.insert(0, parent.getName() + \">\");\n            parent = parent.getParent();\n        }\n        out.append(navItem.getName());\n        return out.toString();\n    }\n\n    public void clear() {\n        groupId = null;\n        group = null;\n        defaultItemId = null;\n        targetDivId = null;\n        navItemList = null;\n        targetDivIdList = null;\n        view.clearNavGroupItems();\n        view.clearDefaultItems();\n        view.clearTargetDivItems();\n    }\n\n    public void show() {\n        updateNavGroups();\n        updateDefaultItems();\n        updateTargetDivs();\n        view.show();\n    }\n\n    // View callbacks\n\n    public void onGroupSelected(String id) {\n        groupId = id;\n        defaultItemId = null;\n        updateNavGroups();\n        updateDefaultItems();\n    }\n\n    public void onDefaultItemSelected(String id) {\n        defaultItemId = id;\n        updateDefaultItems();\n    }\n\n    public void onTargetDivSelected(String id) {\n        targetDivId = id;\n        updateTargetDivs();\n    }\n\n    public void onOk() {\n        if (groupId != null) {\n            view.hide();\n            if (onOk != null) {\n                onOk.execute();\n            }\n        }\n    }\n\n    public void onCancel() {\n        view.hide();\n        if (onCancel != null) {\n            onCancel.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavComponentConfigModalView.css",
    "content": ".uf-navconfig-body {\n    margin: 15px;\n}\n.uf-navconfig-selector-button {\n    min-width: 200px;\n    text-align: left;\n}\n.uf-navconfig-selector-menu {\n    margin-left: 20px;\n    min-width: 200px;\n}\n.uf-navconfig-selector-caret {\n    float: right;\n    margin-top: 5px;\n}\n.uf-navconfig-disabled {\n    opacity: .5;\n    pointer-events: none;\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavComponentConfigModalView.html",
    "content": "<div>\n    <div data-field=\"body\">\n        <form class=\"form-horizontal\">\n            <div class=\"form-group\" data-field=\"navGroupDiv\">\n                <label class=\"col-md-3 control-label\">\n                    <span style=\"margin-right: 5px;\" data-field=\"navGroupLabel\">Navigation group</span>\n                    <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\"><span data-field=\"navGroupHelp\" class=\"fa fa-info-circle\"></span></a>\n                </label>\n                <div class=\"dropdown col-md-4\">\n                    <button class=\"btn btn-default dropdown-toggle uf-navconfig-selector-button\" type=\"button\" data-toggle=\"dropdown\">\n                        <span data-field=\"navGroupSelection\"></span>\n                        <span class=\"uf-navconfig-selector-caret caret\" style=\"margin-left: 10px;\"></span>\n                    </button>\n                    <ul data-field=\"navGroupItems\" class=\"dropdown-menu uf-navconfig-selector-menu\" role=\"menu\">\n                    </ul>\n                </div>\n            </div>\n            <div class=\"form-group\" data-field=\"defaultItemDiv\">\n                <label class=\"col-md-3 control-label\">\n                    <span style=\"margin-right: 5px;\" data-field=\"defaultItemLabel\">Default item to display</span>\n                    <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\"><span data-field=\"defaultItemHelp\" class=\"fa fa-info-circle\"></span></a>\n                </label>\n                <div class=\"dropdown col-md-4\">\n                    <button class=\"btn btn-default dropdown-toggle uf-navconfig-selector-button\" type=\"button\" data-toggle=\"dropdown\">\n                        <span data-field=\"defaultItemSelection\"></span>\n                        <span class=\"uf-navconfig-selector-caret caret\" style=\"margin-left: 10px;\"></span>\n                    </button>\n                    <ul data-field=\"defaultItems\" class=\"dropdown-menu uf-navconfig-selector-menu\" role=\"menu\">\n                    </ul>\n                </div>\n            </div>\n            <div class=\"form-group\" data-field=\"targetDivDiv\">\n                <label class=\"col-md-3 control-label\">\n                    <span style=\"margin-right: 5px;\" data-field=\"targetDivLabel\">Target div</span>\n                    <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\"><span data-field=\"targetDivHelp\" class=\"fa fa-info-circle\"></span></a>\n                </label>\n                <div class=\"dropdown col-md-4\">\n                    <button class=\"btn btn-default dropdown-toggle uf-navconfig-selector-button\" type=\"button\" data-toggle=\"dropdown\">\n                        <span data-field=\"targetDivSelection\"></span>\n                        <span class=\"uf-navconfig-selector-caret caret\" style=\"margin-left: 10px;\"></span>\n                    </button>\n                    <ul data-field=\"targetDivItems\" class=\"dropdown-menu uf-navconfig-selector-menu\" role=\"menu\">\n                    </ul>\n                </div>\n            </div>\n        </form>\n    </div>\n    <div data-field=\"footer\">\n        <button data-field=\"cancelButton\" type=\"button\" class=\"btn btn-default\">Cancel</button>\n        <button data-field=\"okButton\" type=\"button\" class=\"btn btn-primary\">Ok</button>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavComponentConfigModalView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.TemplateWidgetMapper;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class NavComponentConfigModalView implements NavComponentConfigModal.View {\n\n    NavComponentConfigModal presenter;\n    BaseModal modal;\n    ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n\n    @Inject\n    @DataField\n    Div body;\n\n    @Inject\n    @DataField\n    Div footer;\n\n    @Inject\n    @DataField\n    Div navGroupDiv;\n\n    @Inject\n    @DataField\n    Span navGroupLabel;\n\n    @DataField\n    @Inject\n    Span navGroupHelp;\n\n    @DataField\n    @Inject\n    Span navGroupSelection;\n\n    @DataField\n    @Inject\n    UnorderedList navGroupItems;\n\n    @Inject\n    @DataField\n    Div defaultItemDiv;\n\n    @Inject\n    @DataField\n    Span defaultItemLabel;\n\n    @DataField\n    @Inject\n    Span defaultItemHelp;\n\n    @DataField\n    @Inject\n    Span defaultItemSelection;\n\n    @DataField\n    @Inject\n    UnorderedList defaultItems;\n\n    @Inject\n    @DataField\n    Div targetDivDiv;\n\n    @Inject\n    @DataField\n    Span targetDivLabel;\n\n    @DataField\n    @Inject\n    Span targetDivHelp;\n\n    @DataField\n    @Inject\n    Span targetDivSelection;\n\n    @DataField\n    @Inject\n    UnorderedList targetDivItems;\n\n    @Override\n    public void init(NavComponentConfigModal presenter) {\n        this.presenter = presenter;\n        navGroupLabel.setTextContent(NavigationConstants.INSTANCE.navGroupLabel());\n        navGroupHelp.setTitle(NavigationConstants.INSTANCE.navGroupHelp());\n        navGroupSelection.setTextContent(NavigationConstants.INSTANCE.navGroupSelectorHint());\n        defaultItemLabel.setTextContent(NavigationConstants.INSTANCE.defaultItemLabel());\n        defaultItemHelp.setTitle(NavigationConstants.INSTANCE.defaultItemHelp());\n        defaultItemSelection.setTextContent(NavigationConstants.INSTANCE.defaultItemSelectorHint());\n        targetDivLabel.setTextContent(NavigationConstants.INSTANCE.targetDivLabel());\n        targetDivHelp.setTitle(NavigationConstants.INSTANCE.targetDivHelp());\n        targetDivSelection.setTextContent(NavigationConstants.INSTANCE.targetDivSelectorHint());\n\n        modal = new CommonModalBuilder()\n                .addHeader(NavigationConstants.INSTANCE.navConfigHeader())\n                .addBody( body )\n                .addFooter( footer )\n                .build();\n\n        modal.addHiddenHandler(hiddenEvent -> {\n            if (ButtonPressed.CLOSE.equals(buttonPressed)) {\n                presenter.onCancel();\n            }\n        });\n\n        modal.setWidth( \"960px\" );\n    }\n\n    public Modal getModal() {\n        return modal;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return TemplateWidgetMapper.get(modal);\n    }\n\n    @Override\n    public void show() {\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public void setNavGroupEnabled(boolean enabled) {\n        navGroupDiv.setClassName(\"form-group\" + (enabled ? \"\" : \" uf-navconfig-disabled\"));\n    }\n\n    @Override\n    public void clearNavGroupItems() {\n        DOMUtil.removeAllChildren(navGroupItems);\n        navGroupSelection.setTextContent(NavigationConstants.INSTANCE.navGroupSelectorHint());\n    }\n\n    @Override\n    public void setNavGroupHelpText(String text) {\n        navGroupHelp.setTitle(text);\n    }\n\n    @Override\n    public void setNavGroupSelection(String name, Command onReset) {\n        navGroupSelection.setTextContent(name);\n        addItem(navGroupItems, name, true, onReset);\n    }\n\n    @Override\n    public void addNavGroupItem(String name, Command onSelect) {\n        addItem(navGroupItems, name, false, onSelect);\n    }\n\n    @Override\n    public void setDefaultNavItemVisible(boolean enabled) {\n        defaultItemDiv.setHidden(!enabled);\n    }\n\n    @Override\n    public void setDefaultNavItemEnabled(boolean enabled) {\n        defaultItemDiv.setClassName(\"form-group\" + (enabled ? \"\" : \" uf-navconfig-disabled\"));\n    }\n\n    @Override\n    public void clearDefaultItems() {\n        DOMUtil.removeAllChildren(defaultItems);\n        defaultItemSelection.setTextContent(NavigationConstants.INSTANCE.defaultItemSelectorHint());\n    }\n\n    @Override\n    public void defaultItemsNotFound() {\n        clearDefaultItems();\n        addDefaultItem(NavigationConstants.INSTANCE.defaultItemsNotFound(), () -> {});\n    }\n\n    @Override\n    public void setDefaultItemSelection(String name, Command onReset) {\n        defaultItemSelection.setTextContent(name);\n        addItem(defaultItems, name, true, onReset);\n    }\n\n    @Override\n    public void addDefaultItem(String name, Command onSelect) {\n        addItem(defaultItems, name, false, onSelect);\n    }\n\n    @Override\n    public void setTargetDivVisible(boolean enabled) {\n        targetDivDiv.setHidden(!enabled);\n    }\n\n    @Override\n    public void clearTargetDivItems() {\n        DOMUtil.removeAllChildren(targetDivItems);\n        targetDivSelection.setTextContent(NavigationConstants.INSTANCE.targetDivSelectorHint());\n    }\n\n    @Override\n    public void targetDivsNotFound() {\n        clearTargetDivItems();\n        addTargetDivItem(NavigationConstants.INSTANCE.targetDivsNotFound(), () -> {});\n    }\n\n    @Override\n    public void addTargetDivItem(String name, Command onSelect) {\n        addItem(targetDivItems, name, false, onSelect);\n    }\n\n    @Override\n    public void setTargetDivSelection(String name, Command onReset) {\n        targetDivSelection.setTextContent(name);\n        addItem(targetDivItems, name, true, onReset);\n    }\n\n    private void addItem(UnorderedList unorderedList, String name, boolean selected, Command onSelect) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        li.setClassName(selected ? \"selected\" : \"\");\n        unorderedList.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                onSelect.execute();\n            }\n        });\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"okButton\")\n    public void okClick(final Event event) {\n        buttonPressed = ButtonPressed.OK;\n        presenter.onOk();\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"cancelButton\")\n    public void cancelClick(final Event event) {\n        buttonPressed = ButtonPressed.CANCEL;\n        presenter.onCancel();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavDropDownWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n@Dependent\npublic class NavDropDownWidget extends BaseNavWidget {\n\n    public interface View extends NavWidgetView<NavDropDownWidget> {\n\n        void setDropDownName(String name);\n\n        void showAsSubmenu(boolean enabled);\n\n        void setActive(boolean active);\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n\n    @Inject\n    public NavDropDownWidget(View view, SyncBeanManager beanManager, NavigationManager navigationManager) {\n        super(view, navigationManager);\n        this.view = view;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    public NavWidget lookupNavGroupWidget() {\n        return beanManager.lookupBean(NavDropDownWidget.class).newInstance();\n    }\n\n    @Override\n    public void show(NavGroup navGroup) {\n        if (navGroup == null) {\n            view.errorNavGroupNotFound();\n        } else {\n            view.setDropDownName(navGroup.getName());\n            view.showAsSubmenu(getLevel() > 1);\n            super.show(navGroup);\n        }\n    }\n\n    @Override\n    public void onItemClicked(NavItem navItem) {\n        super.onItemClicked(navItem);\n        setActive(true);\n    }\n\n    @Override\n    public void onSubGroupItemClicked(NavWidget subGroup) {\n        super.onSubGroupItemClicked(subGroup);\n        setActive(true);\n    }\n\n    @Override\n    public boolean setSelectedItem(String id) {\n        boolean enabled = super.setSelectedItem(id);\n        setActive(enabled);\n        return enabled;\n    }\n\n    @Override\n    public void clearSelectedItem() {\n        super.clearSelectedItem();\n        setActive(false);\n    }\n\n    private void setActive(boolean enabled) {\n        // Disable for subgroups, as it is not working well\n        view.setActive(enabled && getLevel() == 1);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavDropDownWidgetView.html",
    "content": "<li data-field=\"dropDownItem\" class=\"dropdown\">\n    <a data-field=\"dropDownAnchor\" href=\"#\" class=\"dropdown-toggle\" data-toggle=\"dropdown\">\n        <span data-field=\"dropDownName\"></span>\n        <b class=\"caret\"></b>\n    </a>\n    <ul data-field=\"dropDownMenu\" class=\"dropdown-menu\">\n    </ul>\n</li>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavDropDownWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class NavDropDownWidgetView extends BaseNavWidgetView<NavDropDownWidget>\n    implements NavDropDownWidget.View {\n\n    @Inject\n    @DataField\n    ListItem dropDownItem;\n\n    @Inject\n    @DataField\n    Anchor dropDownAnchor;\n\n    @Inject\n    @DataField\n    Span dropDownName;\n\n    @Inject\n    @DataField\n    UnorderedList dropDownMenu;\n\n    NavDropDownWidget presenter;\n    boolean active = false;\n    boolean submenu = false;\n\n    @Override\n    public void init(NavDropDownWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = dropDownMenu;\n    }\n\n    @Override\n    public void setDropDownName(String name) {\n        dropDownName.setTextContent(name);\n    }\n\n    private String calculateDropDownClassName() {\n        if (submenu) {\n            if (active) {\n                return \"dropdown-submenu active\";\n            } else {\n                return \"dropdown-submenu\";\n            }\n        } else {\n            if (active) {\n                return \"dropdown active\";\n            } else {\n                return \"dropdown\";\n            }\n        }\n    }\n\n    @Override\n    public void showAsSubmenu(boolean enabled) {\n        submenu = enabled;\n        String className = calculateDropDownClassName();\n        dropDownItem.setClassName(className);\n        if (enabled) {\n            DOMUtil.removeAllChildren(dropDownAnchor);\n            dropDownAnchor.appendChild(dropDownName);\n        }\n    }\n\n    @Override\n    public void setActive(boolean active) {\n        this.active = active;\n        String className = calculateDropDownClassName();\n        dropDownItem.setClassName(className);\n    }\n\n    @Override\n    public void addDivider() {\n        LIElement li = Document.get().createLIElement();\n        li.setClassName(\"divider\");\n        dropDownMenu.appendChild((Node) li);\n    }\n\n    @Override\n    public void errorNavGroupNotFound() {\n        setDropDownName(\"ERROR: Nav group not found\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavItemTileWidget.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * A widget that shows a tile representing a {@link NavItem}\n */\n@Dependent\npublic class NavItemTileWidget implements IsElement {\n\n    public interface View extends UberElement<NavItemTileWidget> {\n\n        enum ItemType {\n            GROUP,\n            PERSPECTIVE,\n            RUNTIME_PERSPECTIVE;\n        }\n\n        void show(String name, String descr, ItemType type);\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    Command onClick = null;\n\n    @Inject\n    public NavItemTileWidget(View view, PerspectivePluginManager perspectivePluginManager) {\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void setOnClick(Command onClick) {\n        this.onClick = onClick;\n    }\n\n    public void show(NavItem navItem) {\n        String name = navItem.getName();\n        String descr = navItem.getDescription();\n\n        if (navItem instanceof NavGroup) {\n            view.show(name, descr, View.ItemType.GROUP);\n        }\n        else {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            String resourceId = navCtx.getResourceId();\n            if (resourceId != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n                if (perspectivePluginManager.isRuntimePerspective(resourceId)) {\n                    view.show(name, descr, View.ItemType.RUNTIME_PERSPECTIVE);\n                } else {\n                    view.show(name, descr, View.ItemType.PERSPECTIVE);\n                }\n            }\n        }\n    }\n\n    // View callbacks\n\n    void onClick() {\n        if (onClick != null) {\n            onClick.execute();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavItemTileWidgetView.css",
    "content": ".uf-navitem-tile-body {\n    cursor: pointer;\n    float: left;\n    height: 160px;\n    width: 160px;\n    margin: 0 10px 10px 0;\n    font-size: 16px;\n    position: relative;\n    text-align: center;\n    overflow: hidden;\n}\n.uf-navitem-tile-icon {\n    margin-top: 25px;\n    font-size: 46px;\n    color: #FFFFFF;\n}\n.uf-navitem-tile-text {\n    color: #FFFFFF;\n}\n.uf-navitem-tile-group {\n    background: rgba(76, 98, 154, 0.52);\n}\n.uf-navitem-tile-perspective {\n    background: rgba(67, 154, 99, 0.60);\n}\n.uf-navitem-tile-runtime-perspective {\n    background: rgba(67, 154, 99, 0.60);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavItemTileWidgetView.html",
    "content": "<div data-field=\"mainDiv\" class=\"uf-navitem-tile-body\">\n    <div data-field=\"iconDiv\" class=\"uf-navitem-tile-icon\">\n        <span data-field=\"iconSpan\" class=\"fa fa-folder-open\"></span>\n    </div>\n    <div>\n        <span data-field=\"textSpan\" class=\"uf-navitem-tile-text\">Test</span>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavItemTileWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class NavItemTileWidgetView implements NavItemTileWidget.View, IsElement {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div iconDiv;\n\n    @Inject\n    @DataField\n    Span iconSpan;\n\n    @Inject\n    @DataField\n    Span textSpan;\n\n    NavItemTileWidget presenter;\n\n    @Override\n    public void init(NavItemTileWidget presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void show(String name, String descr, ItemType type) {\n        textSpan.setTextContent(name);\n        mainDiv.getStyle().setProperty(\"title\", descr);\n\n        if (ItemType.GROUP == type) {\n            mainDiv.setClassName(\"uf-navitem-tile-body uf-navitem-tile-group\");\n            iconSpan.setClassName(\"pficon-folder-open\");\n            mainDiv.setTitle(NavigationConstants.INSTANCE.openNavItem(name));\n        }\n        else if (ItemType.PERSPECTIVE == type) {\n            mainDiv.setClassName(\"uf-navitem-tile-body uf-navitem-tile-perspective\");\n            iconSpan.setClassName(\"pficon-screen\");\n            mainDiv.setTitle(NavigationConstants.INSTANCE.gotoNavItem(name));\n        }\n        else if (ItemType.RUNTIME_PERSPECTIVE == type) {\n            mainDiv.setClassName(\"uf-navitem-tile-body uf-navitem-tile-runtime-perspective\");\n            iconSpan.setClassName(\"pficon-virtual-machine\");\n            mainDiv.setTitle(NavigationConstants.INSTANCE.showNavItem(name));\n        }\n    }\n\n    @EventHandler(\"mainDiv\")\n    public void onMainDivClick(ClickEvent event) {\n        presenter.onClick();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavMenuBarWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\npublic class NavMenuBarWidget extends TargetDivNavWidget {\n\n    public interface View extends TargetDivNavWidget.View<NavMenuBarWidget> {\n\n        void setNavHeaderVisible(boolean visible);\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n\n    @Inject\n    public NavMenuBarWidget(View view,\n                            SyncBeanManager beanManager,\n                            PerspectivePluginManager pluginManager,\n                            PlaceManager placeManager,\n                            NavigationManager navigationManager) {\n        super(view, pluginManager, placeManager, navigationManager);\n        this.view = view;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    public NavWidget lookupNavGroupWidget() {\n        return beanManager.lookupBean(NavDropDownWidget.class).newInstance();\n    }\n\n    public void setNavHeaderVisible(boolean visible) {\n        view.setNavHeaderVisible(visible);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavMenuBarWidgetView.html",
    "content": "<div data-field=\"mainDiv\">\n    <nav data-field=\"nav\" class=\"navbar navbar-default navbar-pf\" role=\"navigation\">\n        <div class=\"collapse navbar-collapse navbar-collapse-5\">\n            <ul data-field=\"navBar\" class=\"nav navbar-nav navbar-primary\">\n            </ul>\n        </div>\n    </nav>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavMenuBarWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class NavMenuBarWidgetView extends TargetDivNavWidgetView<NavMenuBarWidget>\n        implements NavMenuBarWidget.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    UnorderedList navBar;\n\n    @Inject\n    @DataField\n    @Named(\"nav\")\n    HTMLElement nav;\n\n    NavMenuBarWidget presenter;\n\n    @Inject\n    public NavMenuBarWidgetView(AlertBox alertBox) {\n        super(alertBox);\n    }\n\n    @Override\n    public void init(NavMenuBarWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = navBar;\n        setNavHeaderVisible(true);\n    }\n\n    @Override\n    public void addDivider() {\n        // Useless in a menu bar\n    }\n\n    @Override\n    public void clearItems() {\n        super.clearItems();\n        DOMUtil.removeAllChildren(mainDiv);\n        mainDiv.appendChild(navBar.getParentElement().getParentElement());\n    }\n\n    @Override\n    public void error(String message) {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(message);\n        mainDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void setNavHeaderVisible(boolean visible) {\n        nav.setClassName(visible ? \"navbar navbar-default navbar-pf\" : \"\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTabListWidget.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavItem;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\npublic class NavTabListWidget extends TargetDivNavWidget {\n\n    public interface View extends TargetDivNavWidget.View<NavTabListWidget> {\n\n        void clearChildrenTabs();\n\n        void showChildrenTabs(IsWidget tabListWidget);\n\n        void showAsSubmenu(boolean enabled);\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n\n    @Inject\n    public NavTabListWidget(View view,\n                            SyncBeanManager beanManager,\n                            PerspectivePluginManager pluginManager,\n                            PlaceManager placeManager,\n                            NavigationManager navigationManager) {\n        super(view, pluginManager, placeManager, navigationManager);\n        this.view = view;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    protected NavWidget lookupNavGroupWidget() {\n        return beanManager.lookupBean(NavTabListWidget.class).newInstance();\n    }\n\n    @Override\n    public boolean setSelectedItem(String id) {\n        boolean selected = super.setSelectedItem(id);\n        if (selected && activeNavSubgroup != null) {\n            view.setSelectedItem(activeNavSubgroup.getNavGroup().getId());\n            view.showChildrenTabs(activeNavSubgroup);\n        }\n        return selected;\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        view.showAsSubmenu(getLevel() > 0);\n        super.show(itemList);\n    }\n\n    @Override\n    public void onItemClicked(NavItem navItem) {\n        view.clearChildrenTabs();\n        super.onItemClicked(navItem);\n    }\n\n    // View callbacks\n\n    void onGroupTabClicked(String id) {\n        TargetDivNavWidget navGroupWidget = (TargetDivNavWidget) super.getSubgroupNavWidget(id);\n        if (navGroupWidget != null) {\n            super.onItemClicked(navGroupWidget.getNavGroup());\n            view.showChildrenTabs(navGroupWidget);\n            navGroupWidget.gotoDefaultItem();\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTabListWidgetView.html",
    "content": "<div data-field=\"mainDiv\">\n    <div data-field=\"tabsDiv\">\n        <div>\n            <ul data-field=\"tabList\" class=\"nav nav-tabs\">\n            </ul>\n        </div>\n        <div data-field=\"childrenDiv\">\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTabListWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class NavTabListWidgetView extends TargetDivNavWidgetView<NavTabListWidget>\n    implements NavTabListWidget.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div tabsDiv;\n\n    @Inject\n    @DataField\n    UnorderedList tabList;\n\n    @Inject\n    @DataField\n    Div childrenDiv;\n\n    NavTabListWidget presenter;\n\n    @Inject\n    public NavTabListWidgetView(AlertBox alertBox) {\n        super(alertBox);\n    }\n\n    @Override\n    public void init(NavTabListWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = tabList;\n    }\n\n    @Override\n    public void addDivider() {\n        // Useless in a tab list\n    }\n\n    @Override\n    public void addGroupItem(String id, String name, String description, IsWidget widget) {\n        this.addItem(id, name, description, () -> presenter.onGroupTabClicked(id));\n    }\n\n    @Override\n    public void showAsSubmenu(boolean enabled) {\n        tabList.setClassName(\"nav nav-tabs\" + (enabled ? \" nav-tabs-pf\" : \"\"));\n    }\n\n    @Override\n    public void clearChildrenTabs() {\n        DOMUtil.removeAllChildren(childrenDiv);\n    }\n\n    @Override\n    public void showChildrenTabs(IsWidget tabListWidget) {\n        DOMUtil.removeAllChildren(childrenDiv);\n        super.appendWidgetToElement(childrenDiv, tabListWidget);\n        if (presenter.getLevel() == 0) {\n            childrenDiv.getStyle().setProperty(\"margin-left\", \"15px\");\n        }\n    }\n\n    @Override\n    public void clearItems() {\n        super.clearItems();\n        DOMUtil.removeAllChildren(mainDiv);\n        mainDiv.appendChild(tabsDiv);\n    }\n\n    @Override\n    public void error(String message) {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(message);\n        mainDiv.appendChild(alertBox.getElement());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTilesWidget.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\nimport java.util.Stack;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssueI18n;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * A navigation widget that displays a set of navigation items using a navigable tile based approach where\n * {@link NavGroup} instances are displayed as folders and {@link NavItem} are shown as links to a specific\n * target asset (f.i: a perspective).\n */\n@Dependent\npublic class NavTilesWidget extends BaseNavWidget {\n\n    public interface View extends NavWidgetView<NavTilesWidget>, LayoutRecursionIssueI18n {\n\n        void addTileWidget(IsElement tileWidget);\n\n        void showTileContent(IsWidget tileContent);\n\n        void clearBreadcrumb();\n\n        void addBreadcrumbItem(String navItemName);\n\n        void addBreadcrumbItem(String navItemName, Command onClicked);\n\n        void infiniteRecursionError(String cause);\n    }\n\n    View view;\n    PerspectivePluginManager perspectivePluginManager;\n    PlaceManager placeManager;\n    SyncBeanManager beanManager;\n    NavItem currentPerspectiveNavItem = null;\n    Stack<NavItem> navItemStack = new Stack<>();\n\n    @Inject\n    public NavTilesWidget(View view,\n                          NavigationManager navigationManager,\n                          PerspectivePluginManager perspectivePluginManager,\n                          PlaceManager placeManager,\n                          SyncBeanManager beanManager) {\n        super(view, navigationManager);\n        this.view = view;\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.placeManager = placeManager;\n        this.beanManager = beanManager;\n    }\n\n    public Stack<NavItem> getNavItemStack() {\n        return navItemStack;\n    }\n\n    @Override\n    public void show(NavGroup navGroup) {\n        this.show(navGroup, true);\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        currentPerspectiveNavItem = null;\n        super.show(itemList);\n    }\n\n    public void show(NavGroup navGroup, boolean clearBreadcrumb) {\n        if (navGroup == null) {\n            view.errorNavGroupNotFound();\n        }\n        else {\n            NavGroup clone = (NavGroup) navGroup.cloneItem();\n            clone.setParent(null);\n\n            if (clearBreadcrumb) {\n                navItemStack.clear();\n                updateBreadcrumb();\n            }\n            currentPerspectiveNavItem = null;\n            super.show(clone);\n        }\n    }\n\n    @Override\n    protected void showItem(NavItem navItem) {\n        NavItemTileWidget tileWidget = beanManager.lookupBean(NavItemTileWidget.class).getInstance();\n        tileWidget.setOnClick(() -> this.openItem(navItem));\n        tileWidget.show(navItem);\n        view.addTileWidget(tileWidget);\n    }\n\n    @Override\n    protected void showGroup(NavGroup navGroup) {\n        showItem(navGroup);\n    }\n\n    public void openItem(NavItem navItem) {\n        NavItem parent = navItem.getParent();\n        if (navItemStack.isEmpty()) {\n            if (parent != null) {\n                navItemStack.add(parent);\n                navItemStack.add(navItem);\n            }\n        } else {\n            navItemStack.add(navItem);\n        }\n        this.updateBreadcrumb();\n\n        if (navItem instanceof NavGroup) {\n            this.show((NavGroup) navItem, false);\n        }\n        else {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            String resourceId = navCtx.getResourceId();\n            if (resourceId != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n\n                // Runtime perspectives are displayed inline\n                if (perspectivePluginManager.isRuntimePerspective(resourceId)) {\n                    openPerspective(navItem);\n                }\n                // Classic UF perspectives take over the entire window\n                else {\n                    placeManager.goTo(resourceId);\n                }\n            }\n        }\n    }\n\n    protected void openPerspective(NavItem perspectiveItem) {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(perspectiveItem);\n        String perspectiveId = navCtx.getResourceId();\n        String navRootId = navCtx.getNavGroupId();\n        currentPerspectiveNavItem = perspectiveItem;\n        LayoutTemplateContext layoutCtx = new LayoutTemplateContext(navRootId);\n        perspectivePluginManager.buildPerspectiveWidget(perspectiveId, layoutCtx, view::showTileContent, this::onInfiniteRecursion);\n    }\n\n    public void onInfiniteRecursion(LayoutRecursionIssue issue) {\n        String cause = issue.printReport(navigationManager.getNavTree(), view);\n        view.infiniteRecursionError(cause);\n    }\n\n    protected void updateBreadcrumb() {\n        view.clearBreadcrumb();\n        for (int i=0; i<navItemStack.size(); i++) {\n            final NavItem navItem = navItemStack.get(i);\n            if (i == navItemStack.size()-1) {\n                view.addBreadcrumbItem(navItem.getName());\n            } else {\n                view.addBreadcrumbItem(navItem.getName(), () -> gotoBreadcrumbItem(navItem));\n            }\n        }\n    }\n\n    public void gotoBreadcrumbItem(NavItem navItem) {\n        while (navItemStack.peek() != navItem) {\n            navItemStack.pop();\n        }\n        // Re-open the item\n        if (!navItemStack.isEmpty()) {\n            navItemStack.pop();\n        }\n        openItem(navItem);\n    }\n\n    // Catch changes on runtime perspectives so as to display the most up to date changes\n\n    private void onPerspectiveChanged(@Observes PluginSaved event) {\n        if (currentPerspectiveNavItem != null) {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(currentPerspectiveNavItem);\n            String perspectiveId = navCtx.getResourceId();\n            if (event.getPlugin().getName().equals(perspectiveId)) {\n                openPerspective(currentPerspectiveNavItem);\n            }\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTilesWidgetView.html",
    "content": "<div data-field=\"mainDiv\">\n    <div data-field=\"contentDiv\">\n        <div>\n            <ol class=\"breadcrumb\" style=\"height: 20px;\">\n            </ol>\n        </div>\n        <div data-field=\"tilesDiv\">\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTilesWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.OrderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class NavTilesWidgetView extends BaseNavWidgetView<NavTilesWidget>\n    implements NavTilesWidget.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div contentDiv;\n\n    @Inject\n    @DataField\n    Div tilesDiv;\n\n    @Inject\n    @DataField(\"breadcrumb\")\n    OrderedList breadcrumb;\n\n    NavTilesWidget presenter;\n    AlertBox alertBox;\n\n    @Inject\n    public NavTilesWidgetView(AlertBox alertBox) {\n        this.alertBox = alertBox;\n        alertBox.setLevel(AlertBox.Level.WARNING);\n        alertBox.setCloseEnabled(false);\n        alertBox.getElement().getStyle().setProperty(\"width\", \"96%\");\n    }\n\n    @Override\n    public void init(NavTilesWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = tilesDiv;\n    }\n\n    @Override\n    public void addDivider() {\n        // Useless in tile navigator\n    }\n\n    @Override\n    public void addTileWidget(IsElement tileWidget) {\n        DOMUtil.removeAllChildren(mainDiv);\n        mainDiv.appendChild(contentDiv);\n        tilesDiv.appendChild(tileWidget.getElement());\n    }\n\n    @Override\n    public void showTileContent(IsWidget tileContent) {\n        DOMUtil.removeAllChildren(tilesDiv);\n        super.appendWidgetToElement(tilesDiv, tileContent);\n    }\n\n    @Override\n    public void errorNavItemsEmpty() {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(NavigationConstants.INSTANCE.navGroupEmptyError());\n        mainDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void errorNavGroupNotFound() {\n        DOMUtil.removeAllChildren(mainDiv);\n        alertBox.setMessage(NavigationConstants.INSTANCE.navGroupNotFound());\n        mainDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void infiniteRecursionError(String cause) {\n        DOMUtil.removeAllChildren(tilesDiv);\n        alertBox.setMessage(NavigationConstants.INSTANCE.navTilesDragComponentInfiniteRecursion() + cause);\n        tilesDiv.appendChild(alertBox.getElement());\n    }\n\n    @Override\n    public void clearBreadcrumb() {\n        DOMUtil.removeAllChildren(breadcrumb);\n    }\n\n    @Override\n    public void addBreadcrumbItem(String navItemName) {\n        addBreadcrumbItem(navItemName, null);\n    }\n\n    @Override\n    public void addBreadcrumbItem(String navItemName, Command onClicked) {\n        LIElement li = Document.get().createLIElement();\n        breadcrumb.appendChild((Node) li);\n\n        if (onClicked != null) {\n            AnchorElement anchor = Document.get().createAnchorElement();\n            anchor.setInnerText(navItemName);\n            li.appendChild(anchor);\n            li.getStyle().setCursor(Style.Cursor.POINTER);\n\n            Event.sinkEvents(anchor, Event.ONCLICK);\n            Event.setEventListener(anchor, event -> {\n                if (Event.ONCLICK == event.getTypeInt()) {\n                    onClicked.execute();\n                }\n            });\n        } else {\n            ((Node) li).setTextContent(navItemName);\n            li.setClassName(\"active\");\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTreeWidget.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class NavTreeWidget extends TargetDivNavWidget {\n\n    public interface View extends TargetDivNavWidget.View<NavTreeWidget> {\n\n        void setLevel(int level);\n\n        void addRuntimePerspective(String id, String name, String description, Command onClicked);\n\n        void addPerspective(String id, String name, String description, Command onClicked);\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n\n    @Inject\n    public NavTreeWidget(View view,\n                         SyncBeanManager beanManager,\n                         PerspectivePluginManager pluginManager,\n                         PlaceManager placeManager,\n                         NavigationManager navigationManager) {\n        super(view, pluginManager, placeManager, navigationManager);\n        this.view = view;\n        this.beanManager = beanManager;\n    }\n\n    @Override\n    protected NavWidget lookupNavGroupWidget() {\n        return beanManager.lookupBean(NavTreeWidget.class).newInstance();\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        view.setLevel(getLevel());\n        super.show(itemList);\n    }\n\n    @Override\n    protected void showItem(NavItem navItem) {\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.get(navItem);\n        if (pluginManager.isRuntimePerspective(ctx.getResourceId())) {\n            view.addRuntimePerspective(navItem.getId(), navItem.getName(), navItem.getDescription(), () -> {\n                onItemClicked(navItem);\n            });\n        } else {\n            view.addPerspective(navItem.getId(), navItem.getName(), navItem.getDescription(), () -> {\n                onItemClicked(navItem);\n            });\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTreeWidgetView.css",
    "content": ".uf-navtree-widget-icon {\n    font-size: larger;\n    margin-right: 5px;\n}\n\n.uf-navtree-widget-non-clickable {\n    font-size: larger;\n    color: black;\n}\n\n.uf-navtree-widget-non-clicked {\n    font-size: larger;\n    color: black;\n    cursor: pointer;\n}\n\n.uf-navtree-widget-clicked {\n    font-size: larger;\n    color: black;\n    text-decoration: underline;\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTreeWidgetView.html",
    "content": "<div data-field=\"mainDiv\">\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavTreeWidgetView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class NavTreeWidgetView extends TargetDivNavWidgetView<NavTreeWidget>\n    implements NavTreeWidget.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    NavTreeWidget presenter;\n\n    @Inject\n    public NavTreeWidgetView(AlertBox alertBox) {\n        super(alertBox);\n    }\n\n    @Override\n    public void init(NavTreeWidget presenter) {\n        this.presenter = presenter;\n        super.navWidget = mainDiv;\n    }\n\n    @Override\n    public void addDivider() {\n        // Useless in a tree\n    }\n\n    @Override\n    public void setLevel(int level) {\n        int margin = level*10;\n        mainDiv.getStyle().setProperty(\"margin-left\", margin + \"px\");\n        if (level == 0) {\n            mainDiv.getStyle().setProperty(\"padding\", \"10px\");\n        }\n    }\n\n    @Override\n    public void addRuntimePerspective(String id, String name, String description, Command onClicked) {\n        this.addItem(\"pficon-virtual-machine\", id, name, description, onClicked);\n    }\n\n    @Override\n    public void addPerspective(String id, String name, String description, Command onClicked) {\n        this.addItem(\"pficon-screen\", id, name, description, onClicked);\n    }\n\n    @Override\n    public void addGroupItem(String id, String name, String description, IsWidget widget) {\n        this.addItem(\"pficon-folder-open\",id, name, description, null);\n        super.addGroupItem(id, name, description, widget);\n    }\n\n    @Override\n    protected void setSelectedEnabled(boolean enabled) {\n        String cname = selectedItem.getClassName();\n        if (!cname.equals(\"uf-navtree-widget-non-clickable\")) {\n            if (enabled) {\n                selectedItem.setClassName(\"uf-navtree-widget-clicked\");\n            } else {\n                selectedItem.setClassName(\"uf-navtree-widget-non-clicked\");\n            }\n        }\n    }\n\n    protected void addItem(String iconClass, String id, String name, String description, Command onClicked) {\n        Element nameEl = onClicked != null ? Document.get().createAnchorElement() : Document.get().createSpanElement();\n        nameEl.setInnerText(name);\n        nameEl.setClassName(onClicked != null ? \"uf-navtree-widget-non-clicked\" : \"uf-navtree-widget-non-clickable\");\n        if (description != null && !description.equals(name)) {\n            nameEl.setTitle(description);\n        }\n\n        SpanElement iconSpan = Document.get().createSpanElement();\n        iconSpan.setClassName(\"uf-navtree-widget-icon \" + iconClass);\n\n        DivElement div = Document.get().createDivElement();\n        div.appendChild(iconSpan);\n        div.appendChild(nameEl);\n\n        navWidget.appendChild((Node) div);\n        itemMap.put(id, nameEl);\n\n        if (onClicked != null) {\n            Event.sinkEvents(nameEl, Event.ONCLICK);\n            Event.setEventListener(nameEl, event -> {\n                if (Event.ONCLICK == event.getTypeInt()) {\n                    onClicked.execute();\n                }\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.uberfire.mvp.Command;\n\n/**\n * Interface for widgets in charge of the display of navigation items\n */\npublic interface NavWidget extends IsWidget {\n\n    void hide();\n\n    void show(NavTree navTree);\n\n    void show(NavGroup navGroup);\n\n    void show(List<NavItem> itemList);\n\n    void setSecure(boolean secure);\n\n    void setHideEmptyGroups(boolean hide);\n\n    void setOnItemSelectedCommand(Command onItemSelected);\n\n    void setOnStaleCommand(Command onStaleStatusCommand);\n\n    NavWidget getParent();\n\n    void setParent(NavWidget parent);\n\n    int getLevel();\n\n    int getMaxLevels();\n\n    void setMaxLevels(int maxLevels);\n\n    NavGroup getNavGroup();\n\n    NavItem getItemSelected();\n\n    boolean setSelectedItem(String id);\n\n    void clearSelectedItem();\n\n    void dispose();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/NavWidgetView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\npublic interface NavWidgetView<T> extends UberView<T> {\n\n    void clearItems();\n\n    void addGroupItem(String id, String name, String description, IsWidget widget);\n\n    void addItem(String id, String name, String description, Command onItemSelected);\n\n    void addDivider();\n\n    void setSelectedItem(String id);\n\n    void clearSelectedItem();\n\n    void errorNavGroupNotFound();\n\n    void errorNavItemsEmpty();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/TargetDivNavWidget.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.List;\n\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssueI18n;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n/**\n * Base class for nav widgets that uses a target div to show a nav item's content once clicked.\n */\npublic abstract class TargetDivNavWidget extends BaseNavWidget implements HasTargetDiv, HasDefaultNavItem {\n\n    public interface View<T extends TargetDivNavWidget> extends NavWidgetView<T>, LayoutRecursionIssueI18n {\n\n        void clearContent(String targetDivId);\n\n        void showContent(String targetDivId, IsWidget content);\n\n        void infiniteRecursionError(String targetDivId, String cause);\n    }\n\n    View view;\n    PerspectivePluginManager pluginManager;\n    PlaceManager placeManager;\n    String targetDivId = null;\n    String defaultNavItemId = null;\n    boolean gotoItemEnabled = false;\n\n    @Inject\n    public TargetDivNavWidget(View view,\n                              PerspectivePluginManager pluginManager,\n                              PlaceManager placeManager,\n                              NavigationManager navigationManager) {\n        super(view, navigationManager);\n        this.view = view;\n        this.pluginManager = pluginManager;\n        this.placeManager = placeManager;\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public void setGotoItemEnabled(boolean enabled) {\n        this.gotoItemEnabled = enabled;\n    }\n\n    @Override\n    public String getTargetDivId() {\n        return targetDivId;\n    }\n\n    @Override\n    public void setTargetDivId(String targetDivId) {\n        this.targetDivId = targetDivId;\n    }\n\n    @Override\n    public String getDefaultNavItemId() {\n        return defaultNavItemId;\n    }\n\n    @Override\n    public void setDefaultNavItemId(String defaultNavItemId) {\n        this.defaultNavItemId = defaultNavItemId;\n    }\n\n    @Override\n    public void show(List<NavItem> itemList) {\n        super.show(itemList);\n        if (parent == null && gotoItemEnabled) {\n            gotoDefaultItem();\n        }\n    }\n\n    protected boolean gotoDefaultItem() {\n        boolean gotoItem = _gotoDefaultItem();\n        if (!gotoItem) {\n            defaultNavItemId = getFirstRuntimePerspective(navItemList);\n            gotoItem = _gotoDefaultItem();\n        }\n        return gotoItem;\n    }\n\n    protected boolean _gotoDefaultItem() {\n        if (defaultNavItemId != null) {\n            if (setSelectedItem(defaultNavItemId)) {\n                gotoNavItem(true);\n                if (parent != null && onItemSelectedCommand != null) {\n                    onItemSelectedCommand.execute();\n                }\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected String getFirstRuntimePerspective(List<NavItem> itemList) {\n        if (itemList.isEmpty()) {\n            return null;\n        }\n        for (NavItem navItem : itemList) {\n            if (pluginManager.isRuntimePerspective(navItem)) {\n                return navItem.getId();\n            }\n            if (navItem instanceof NavGroup) {\n                String result = getFirstRuntimePerspective(((NavGroup) navItem).getChildren());\n                if (result != null) {\n                    return result;\n                }\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public void onItemClicked(NavItem navItem) {\n        super.onItemClicked(navItem);\n        this.gotoNavItem(false);\n    }\n\n    @Override\n    public void onSubGroupItemClicked(NavWidget subGroup) {\n        super.onSubGroupItemClicked(subGroup);\n        this.gotoNavItem(false);\n    }\n\n    protected void gotoNavItem(boolean onlyRuntimePerspectives) {\n        if (parent == null && gotoItemEnabled) {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(getItemSelected());\n            String resourceId = navCtx.getResourceId();\n            String navRootId = navCtx.getNavGroupId();\n            if (resourceId != null) {\n                if (pluginManager.isRuntimePerspective(resourceId)) {\n                    LayoutTemplateContext layoutCtx = new LayoutTemplateContext(navRootId);\n                    pluginManager.buildPerspectiveWidget(resourceId, layoutCtx,\n                            w -> view.showContent(targetDivId, w),\n                            this::onInfiniteRecursion);\n                }\n                else if (!onlyRuntimePerspectives) {\n                    placeManager.goTo(resourceId);\n                }\n            } else {\n                view.clearContent(targetDivId);\n            }\n        }\n    }\n\n    public void onInfiniteRecursion(LayoutRecursionIssue issue) {\n        String cause = issue.printReport(navigationManager.getNavTree(), view);\n        view.infiniteRecursionError(targetDivId, cause);\n    }\n\n    // Catch changes on runtime perspectives so as to display the most up to date changes\n\n    private void onPluginSaved(@Observes PluginSaved event) {\n        Plugin plugin = event.getPlugin();\n        String pluginName = plugin.getName();\n        String selectedPerspectiveId = pluginManager.getRuntimePerspectiveId(itemSelected);\n        if (selectedPerspectiveId != null && selectedPerspectiveId.equals(pluginName)) {\n            gotoNavItem(true);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/TargetDivNavWidgetView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.common.client.widgets.AlertBox;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.uberfire.ext.layout.editor.client.generator.AbstractLayoutGenerator;\nimport org.uberfire.mvp.Command;\n\npublic abstract class TargetDivNavWidgetView<T extends TargetDivNavWidget> extends BaseNavWidgetView<T>\n                                            implements TargetDivNavWidget.View<T> {\n\n    AlertBox alertBox;\n\n    public TargetDivNavWidgetView(AlertBox alertBox) {\n        this.alertBox = alertBox;\n        alertBox.setLevel(AlertBox.Level.WARNING);\n        alertBox.setCloseEnabled(false);\n        alertBox.getElement().getStyle().setProperty(\"width\", \"96%\");\n    }\n\n    @Override\n    public void clearContent(String targetDivId) {\n        Element targetDiv = getTargetDiv(targetDivId);\n        if (targetDiv != null) {\n            DOMUtil.removeAllChildren(targetDiv);\n        }\n    }\n\n    @Override\n    public void showContent(String targetDivId, IsWidget content) {\n        getTargetDiv(targetDivId, targetDiv -> {\n            DOMUtil.removeAllChildren(targetDiv);\n            Div container = (Div) Window.getDocument().createElement(\"div\");\n            container.getStyle().setProperty(\"overflow\", \"hidden\");\n            targetDiv.appendChild(container);\n            super.appendWidgetToElement(container, content);\n        }, () -> error(NavigationConstants.INSTANCE.navWidgetTargetDivMissing()));\n    }\n\n    @Override\n    public void errorNavGroupNotFound() {\n        error(NavigationConstants.INSTANCE.navGroupNotFound());\n    }\n\n    @Override\n    public void errorNavItemsEmpty() {\n        error(NavigationConstants.INSTANCE.navGroupEmptyError());\n    }\n\n    @Override\n    public void infiniteRecursionError(String targetDivId, String cause) {\n        Element targetDiv = getTargetDiv(targetDivId);\n        if (targetDiv != null) {\n            DOMUtil.removeAllChildren(targetDiv);\n            String message = NavigationConstants.INSTANCE.targetDivIdPerspectiveInfiniteRecursion() + cause;\n            alertBox.setMessage(message);\n            targetDiv.appendChild(alertBox.getElement());\n        } else {\n            error(NavigationConstants.INSTANCE.targetDivIdPerspectiveInfiniteRecursion());\n        }\n    }\n\n    public void error(String message) {\n        DOMUtil.removeAllChildren(navWidget);\n        alertBox.setMessage(message);\n        navWidget.appendChild(alertBox.getElement());\n    }\n\n    protected Element getLayoutRootElement(Element el) {\n        if (el == null) {\n            return null;\n        }\n        String id = el.getAttribute(\"id\");\n        if (id != null && (id.equals(AbstractLayoutGenerator.CONTAINER_ID) || id.equals(\"layout\"))) {\n            return el;\n        } else {\n            return getLayoutRootElement(el.getParentElement());\n        }\n    }\n\n    public void getTargetDiv(String targetDivId,\n                             Consumer<HTMLElement> divConsumer,\n                             Command notFoundDivCallback) {\n        Scheduler.get().scheduleDeferred(() -> {\n            HTMLElement targetDiv = getTargetDiv(targetDivId);\n            if (targetDiv != null) {\n                divConsumer.accept(targetDiv);\n            } else {\n                notFoundDivCallback.execute();\n            }\n        });\n\n    }\n\n    public HTMLElement getTargetDiv(String targetDivId) {\n        HTMLElement targetDiv = null;\n        if (targetDivId != null) {\n            Element layoutRoot = getLayoutRootElement(navWidget.getParentElement());\n            if (layoutRoot != null) {\n                targetDiv = (HTMLElement) layoutRoot.querySelector(\"#\" + targetDivId);\n            }\n        }\n        return targetDiv;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemDefaultEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\npublic class NavItemDefaultEditor extends NavItemEditor {\n\n    @Inject\n    public NavItemDefaultEditor(NavItemDefaultEditorView view,\n                                SyncBeanManager beanManager,\n                                PlaceManager placeManager,\n                                PerspectiveTreeProvider perspectiveTreeProvider,\n                                TargetPerspectiveEditor targetPerspectiveEditor,\n                                PerspectivePluginManager perspectivePluginManager,\n                                Event<NavItemEditStartedEvent> navItemEditStartedEvent,\n                                Event<NavItemEditCancelledEvent> navItemEditCancelledEvent) {\n\n        super(view, beanManager,\n                placeManager,\n                perspectiveTreeProvider,\n                targetPerspectiveEditor,\n                perspectivePluginManager,\n                navItemEditStartedEvent,\n                navItemEditCancelledEvent);\n\n        super.setChildEditorClass(NavItemDefaultEditor.class);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemDefaultEditorView.css",
    "content": ".uf-navitem-container {\n    clear: both;\n}\n\n.uf-navitem-name {\n    margin-left: 7px;\n}\n\n.uf-navitem-cog-icon,\n.uf-navitem-edit-icon,\n.uf-navitem-delete-icon {\n    margin-left: 5px;\n    visibility: hidden;\n    cursor: pointer;\n}\n\n.uf-navitem-confirm-icon,\n.uf-navitem-cancel-icon {\n    margin-left: 5px;\n    cursor: pointer;\n}\n\n.uf-navitem-name-div {\n    float: left;\n}\n\n.uf-navitem-name-input {\n    margin-left: 7px;\n    font-size: smaller;\n    float: left;\n    width: 150px;\n}\n\n.uf-navitem-name-error {\n    border-color: #c00;\n    border-width: 1px;\n}\n\n.uf-navitem-edit-div {\n}\n\n.uf-navitem-extra-div {\n    margin-left: 22px;\n    margin-bottom: 10px;\n    display: none;\n}\n\n.uf-navitem-extra-div .dropdown-menu:before,\n.uf-navitem-extra-div .dropdown-menu:after {\n    content: none;\n}\n\n.uf-navitem-extra-div .dropdown-menu {\n    margin-top: -1px;\n    margin-left: 15px;\n}\n\n.uf-navitem-view-div:hover,\n.uf-navitem-edit-div:hover {\n    background-color: lightcyan;\n}\n\n.uf-navitem-view-div:hover .uf-navitem-cog-icon,\n.uf-navitem-view-div:hover .uf-navitem-edit-icon,\n.uf-navitem-view-div:hover .uf-navitem-delete-icon {\n    visibility: visible;\n}\n\n.uf-navitem-edit-icon:hover,\n.uf-navitem-confirm-icon:hover,\n.uf-navitem-cancel-icon:hover {\n    color: #0088ce;\n}\n\n.uf-navitem-delete-icon:hover {\n    color: #990000;\n}\n\n.uf-navitem-children {\n    margin-left: 15px;\n}\n\n.uf-navitem-command-menu {\n    margin-left: 30px;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemDefaultEditorView.html",
    "content": "<div class=\"uf-navitem-container\">\n    <div class=\"dropdown dropdown-kebab-pf\">\n        <div class=\"pull-left\">\n            <span data-field=\"itemIcon\"></span>\n        </div>\n        <div data-field=\"itemViewDiv\" class=\"uf-navitem-view-div\">\n            <span data-field=\"itemName\" class=\"uf-navitem-name\"></span>\n            <button class=\"btn btn-link dropdown-toggle\" type=\"button\" id=\"dropdownKebab\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n                <span data-field=\"itemMenuIcon\" class=\"fa fa-cog uf-navitem-cog-icon\" title=\"Show menu\"></span>\n            </button>\n            <ul data-field=\"commandMenu\" class=\"dropdown-menu uf-navitem-command-menu\" aria-labelledby=\"dropdownKebab\">\n            </ul>\n            <span data-field=\"itemEditIcon\" class=\"pf pficon-edit uf-navitem-edit-icon\"></span>\n            <span data-field=\"itemDeleteIcon\" class=\"pf pficon-delete uf-navitem-delete-icon\"></span>\n        </div>\n        <div data-field=\"itemEditDiv\" class=\"uf-navitem-edit-div\">\n            <div data-field=\"itemNameDiv\" class=\"uf-navitem-name-div\">\n                <input data-field=\"itemNameInput\" class=\"form-control uf-navitem-name-input\" type=\"text\" />\n                <span data-field=\"itemConfirmIcon\" class=\"fa fa-check uf-navitem-confirm-icon\"></span>\n                <span data-field=\"itemCancelIcon\" class=\"fa fa-close uf-navitem-cancel-icon\"></span>\n            </div>\n            <div data-field=\"extraDiv\" class=\"uf-navitem-extra-div\"></div>\n        </div>\n    </div>\n    <div data-field=\"childrenDiv\" class=\"uf-navitem-children\">\n\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemDefaultEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyPressEvent;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.user.client.Event;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class NavItemDefaultEditorView extends NavItemEditorView<NavItemEditor>\n        implements NavItemEditor.View<NavItemEditor> {\n\n    @Inject\n    @DataField\n    Span itemIcon;\n\n    @Inject\n    @DataField\n    Span itemMenuIcon;\n\n    @Inject\n    @DataField\n    Span itemEditIcon;\n\n    @Inject\n    @DataField\n    Span itemDeleteIcon;\n\n    @Inject\n    @DataField\n    Span itemConfirmIcon;\n\n    @Inject\n    @DataField\n    Span itemCancelIcon;\n\n    @Inject\n    @DataField\n    Span itemName;\n\n    @Inject\n    @DataField\n    Input itemNameInput;\n\n    @Inject\n    @DataField\n    Div extraDiv;\n\n    @Inject\n    @DataField\n    Div itemViewDiv;\n\n    @Inject\n    @DataField\n    Div itemEditDiv;\n\n    @Inject\n    @DataField\n    UnorderedList commandMenu;\n\n    @Inject\n    @DataField\n    Div childrenDiv;\n\n    NavItemEditor presenter;\n\n    @Override\n    public void init(NavItemEditor presenter) {\n        this.presenter = presenter;\n        itemViewDiv.setHidden(false);\n        itemEditDiv.setHidden(true);\n        itemMenuIcon.setTitle(i18n.itemMenuTitle());\n        itemEditIcon.setTitle(i18n.editItem());\n        itemDeleteIcon.setTitle(i18n.deleteItem());\n    }\n\n    @Override\n    public void clearChildren() {\n        DOMUtil.removeAllChildren(childrenDiv);\n    }\n\n    @Override\n    public void addChild(org.jboss.errai.common.client.api.IsElement editor) {\n        childrenDiv.appendChild(editor.getElement());\n    }\n\n    @Override\n    public void setExpandEnabled(boolean enabled) {\n        if (enabled) {\n            itemIcon.getStyle().removeProperty(\"opacity\");\n            itemIcon.getStyle().removeProperty(\"pointer-events\");\n            itemIcon.getStyle().setProperty(\"cursor\", \"pointer\");\n            itemName.getStyle().setProperty(\"cursor\", \"pointer\");\n        } else {\n            itemIcon.getStyle().setProperty(\"opacity\", \".5\");\n            itemIcon.getStyle().setProperty(\"pointer-events\", \"none\");\n            itemIcon.getStyle().removeProperty(\"cursor\");\n            itemName.getStyle().removeProperty(\"cursor\");\n        }\n    }\n\n    @Override\n    public void setExpanded(boolean expanded) {\n        itemIcon.setClassName(expanded ? \"fa fa-angle-down\" : \"fa fa-angle-right\");\n        childrenDiv.setHidden(!expanded);\n    }\n\n    @Override\n    public void setItemName(String name) {\n        itemName.setTextContent(name);\n        itemNameInput.setValue(name);\n    }\n\n    @Override\n    public String getItemName() {\n        return itemNameInput.getValue();\n    }\n\n    @Override\n    public void setItemNameError(boolean hasError) {\n        String classes = \"uf-navitem-name-input\" + (hasError ? \" uf-navitem-name-error\" : \" form-control\");\n        itemNameInput.setClassName(classes);\n    }\n\n    @Override\n    public void setItemDescription(String description) {\n        itemName.setTitle(description);\n    }\n\n    @Override\n    public void setItemType(NavItemEditor.ItemType type) {\n        itemIcon.getStyle().removeProperty(\"cursor\");\n\n        if (type == NavItemEditor.ItemType.GROUP) {\n            itemIcon.setClassName(\"fa fa-angle-right\");\n            itemEditDiv.getStyle().setProperty(\"height\", \"25px\");\n            itemIcon.setTitle(\"\");\n        }\n        else if (type == NavItemEditor.ItemType.DIVIDER) {\n            itemIcon.setClassName(\"fa fa-minus\");\n            itemIcon.setTitle(\"\");\n        }\n        else if (type == NavItemEditor.ItemType.PERSPECTIVE) {\n            itemIcon.setClassName(\"fa fa-file-text-o\");\n            itemIcon.setTitle(NavigationConstants.INSTANCE.perspectiveIconTitle());\n        }\n        else if (type == NavItemEditor.ItemType.RUNTIME_PERSPECTIVE) {\n            itemIcon.setClassName(\"fa fa-file-text-o\");\n            itemIcon.setTitle(NavigationConstants.INSTANCE.pageIconTitle());\n        }\n    }\n\n    @Override\n    public void addCommand(String name, Command command) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        commandMenu.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void addCommandDivider() {\n        LIElement li = Document.get().createLIElement();\n        li.setClassName(\"divider\");\n        commandMenu.appendChild((Node) li);\n    }\n\n    @Override\n    public void setCommandsEnabled(boolean enabled) {\n        itemMenuIcon.setHidden(!enabled);\n        commandMenu.setHidden(!enabled);\n    }\n\n    @Override\n    public void clearCommands() {\n        DOMUtil.removeAllChildren(commandMenu);\n    }\n\n    @Override\n    public void startItemEdition() {\n        itemViewDiv.setHidden(true);\n        itemEditDiv.setHidden(false);\n        itemNameInput.focus();\n    }\n\n    @Override\n    public void finishItemEdition() {\n        itemViewDiv.setHidden(false);\n        itemEditDiv.setHidden(true);\n    }\n\n    @Override\n    public void setContextWidget(IsElement widget) {\n        extraDiv.getStyle().setProperty(\"display\", \"block\");\n        DOMUtil.removeAllChildren(extraDiv);\n        extraDiv.appendChild(widget.getElement());\n    }\n\n    @Override\n    public void setItemEditable(boolean editable) {\n        if (editable) {\n            itemEditIcon.getStyle().removeProperty(\"display\");\n        } else {\n            itemEditIcon.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @Override\n    public void setItemDeletable(boolean deletable) {\n        if (deletable) {\n            itemDeleteIcon.getStyle().removeProperty(\"display\");\n        } else {\n            itemDeleteIcon.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"itemIcon\")\n    public void onItemIconClick(ClickEvent event) {\n        presenter.expandOrCollapse();\n    }\n\n    @EventHandler(\"itemName\")\n    public void onItemNameClick(ClickEvent event) {\n        presenter.expandOrCollapse();\n    }\n\n    @EventHandler(\"itemEditIcon\")\n    public void onItemEditClick(ClickEvent event) {\n        presenter.startEdition();\n    }\n\n    @EventHandler(\"itemDeleteIcon\")\n    public void onItemDeleteClick(ClickEvent event) {\n        presenter.deleteItemCommand();\n    }\n\n    @EventHandler(\"itemConfirmIcon\")\n    public void onItemEditOkClick(ClickEvent event) {\n        presenter.onChangesOk();\n    }\n\n    @EventHandler(\"itemCancelIcon\")\n    public void onItemEditCancelClick(ClickEvent event) {\n        presenter.cancelEdition();\n    }\n\n    @EventHandler(\"itemNameInput\")\n    public void onItemNameInputOver(MouseOverEvent event) {\n        itemNameInput.focus();\n    }\n\n    @EventHandler(\"itemNameInput\")\n    public void onItemNameChanged(KeyPressEvent keyEvent) {\n        if (keyEvent.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {\n            presenter.onChangesOk();\n        } else {\n            presenter.onItemNameChanged();\n        }\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.core.client.GWT;\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\npublic abstract class NavItemEditor implements IsElement {\n\n    public enum ItemType {\n        DIVIDER,\n        GROUP,\n        PERSPECTIVE,\n        RUNTIME_PERSPECTIVE;\n    }\n\n    public interface View<P extends NavItemEditor> extends UberElement<P> {\n\n        void clearChildren();\n\n        void addChild(IsElement editor);\n\n        void setExpandEnabled(boolean enabled);\n\n        void setExpanded(boolean expanded);\n\n        void setItemName(String name);\n\n        String getItemName();\n\n        void setItemNameError(boolean hasError);\n\n        void setItemDescription(String description);\n\n        void setItemType(ItemType type);\n\n        void addCommand(String name, Command command);\n\n        void addCommandDivider();\n\n        void setCommandsEnabled(boolean enabled);\n\n        void clearCommands();\n\n        void setItemEditable(boolean editable);\n\n        void setItemDeletable(boolean deletable);\n\n        void startItemEdition();\n\n        void finishItemEdition();\n\n        void setContextWidget(IsElement widget);\n\n        String i18nNewItem(String item);\n\n        String i18nNewItemName(String item);\n\n        String i18nGotoItem(String item);\n\n        String i18nDeleteItem();\n\n        String i18nMoveUp();\n\n        String i18nMoveDown();\n\n        String i18nMoveFirst();\n\n        String i18nMoveLast();\n\n        String generateId();\n    }\n\n    View view;\n    SyncBeanManager beanManager;\n    PlaceManager placeManager;\n    PerspectiveTreeProvider perspectiveTreeProvider;\n    TargetPerspectiveEditor targetPerspectiveEditor;\n    PerspectivePluginManager perspectivePluginManager;\n    Event<NavItemEditStartedEvent> navItemEditStartedEvent;\n    Event<NavItemEditCancelledEvent> navItemEditCancelledEvent;\n\n    boolean creationEnabled = false;\n\n    boolean moveUpEnabled = true;\n    boolean moveDownEnabled = true;\n    boolean editEnabled = false;\n    boolean deleteEnabled = false;\n    boolean itemNameFromPerspective = false;\n\n    private NavItemEditorSettings settings;\n    private Class<? extends NavItemEditor> childEditorClass;\n\n    NavItemEditor parentEditor = null;\n    List<NavItemEditor> childEditorList = new ArrayList<>();\n    NavItem navItem = null;\n    NavItem navItemBackup = null;\n    ItemType itemType = null;\n    String perspectiveId = null;\n    boolean expanded;\n\n    Command onUpdateCommand;\n    Command onCancelCommand;\n    Command onMoveUpCommand;\n    Command onMoveDownCommand;\n    Command onMoveFirstCommand;\n    Command onMoveLastCommand;\n    Command onDeleteCommand;\n    Command onExpandCommand;\n\n    public static final NavigationConstants i18n = NavigationConstants.INSTANCE;\n\n    public NavItemEditor(View view,\n                         SyncBeanManager beanManager,\n                         PlaceManager placeManager,\n                         PerspectiveTreeProvider perspectiveTreeProvider,\n                         TargetPerspectiveEditor targetPerspectiveEditor,\n                         PerspectivePluginManager perspectivePluginManager,\n                         Event<NavItemEditStartedEvent> navItemEditStartedEvent,\n                         Event<NavItemEditCancelledEvent> navItemEditCancelledEvent) {\n        this.beanManager = beanManager;\n        this.placeManager = placeManager;\n        this.perspectiveTreeProvider = perspectiveTreeProvider;\n        this.targetPerspectiveEditor = targetPerspectiveEditor;\n        this.targetPerspectiveEditor.setOnUpdateCommand(this::onTargetPerspectiveUpdated);\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.navItemEditStartedEvent = navItemEditStartedEvent;\n        this.navItemEditCancelledEvent = navItemEditCancelledEvent;\n\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public NavItemEditorSettings getSettings() {\n        if (settings == null) {\n            settings = new NavItemEditorSettings();\n        }\n        return settings;\n    }\n\n    public void setSettings(NavItemEditorSettings settings) {\n        this.settings = settings;\n    }\n\n    public Class<? extends NavItemEditor> getChildEditorClass() {\n        return childEditorClass;\n    }\n\n    public void setChildEditorClass(Class<? extends NavItemEditor> childEditorClass) {\n        this.childEditorClass = childEditorClass;\n    }\n\n    public NavItemEditor getParentEditor() {\n        return parentEditor;\n    }\n\n    public void setParentEditor(NavItemEditor parentEditor) {\n        this.parentEditor = parentEditor;\n        NavItemEditor rootEditor = getRootEditor();\n        if (rootEditor != null && rootEditor.getNavItem() instanceof NavGroup) {\n            NavGroup rootGroup = (NavGroup) rootEditor.getNavItem();\n            targetPerspectiveEditor.setNavItemList(rootGroup.getChildren());\n        }\n    }\n\n    public NavItemEditor getRootEditor() {\n        return parentEditor == null ? this : parentEditor.getRootEditor();\n    }\n\n    public int getLevel() {\n        if (parentEditor == null) {\n            return 0;\n        }\n        return parentEditor.getLevel() + 1;\n    }\n\n    public boolean isExpanded() {\n        return expanded;\n    }\n\n    public String getGroupLiteral() {\n        return settings != null ? settings.getLiteralGroup() : \"Group\";\n    }\n\n    public String getNewPerspectiveI18n() {\n        String newItemName = view.i18nNewItemName(getPerspectiveLiteral());\n        return newItemName != null ? newItemName : \"- New Perspective -\";\n    }\n\n    public String getPerspectiveLiteral() {\n        return settings != null ? settings.getLiteralPerspective() : \"Perspective\";\n    }\n\n    public String getDividerLiteral() {\n        return settings != null ? settings.getLiteralDivider() : \"Divider\";\n    }\n\n    public boolean isNewGroupEnabled() {\n        return (settings == null || settings.isNewGroupEnabled(navItem)) && areSubgroupsAllowed();\n    }\n\n    public boolean isNewPerspectiveEnabled() {\n        return (settings == null || settings.isNewPerspectiveEnabled(navItem))\n                && areChildrenAllowed()\n                && (!getPerspectiveIds(navItem, true).isEmpty());\n    }\n\n    public boolean isNewDividerEnabled() {\n        return (settings == null || settings.isNewDividerEnabled(navItem)) && areChildrenAllowed();\n    }\n\n    public boolean isGotoPerspectiveEnabled() {\n        return (settings == null || settings.isGotoPerspectiveEnabled(navItem)) && perspectiveId != null;\n    }\n\n    public boolean isMoveUpEnabled() {\n        return moveUpEnabled;\n    }\n\n    public void setMoveUpEnabled(boolean moveUpEnabled) {\n        this.moveUpEnabled = moveUpEnabled;\n    }\n\n    public boolean isMoveDownEnabled() {\n        return moveDownEnabled;\n    }\n\n    public void setMoveDownEnabled(boolean moveDownEnabled) {\n        this.moveDownEnabled = moveDownEnabled;\n    }\n\n    public void setOnUpdateCommand(Command onUpdateCommand) {\n        this.onUpdateCommand = onUpdateCommand;\n    }\n\n    public void setOnCancelCommand(Command onCancelCommand) {\n        this.onCancelCommand = onCancelCommand;\n    }\n\n    public void setOnMoveFirstCommand(Command onMoveFirstCommand) {\n        this.onMoveFirstCommand = onMoveFirstCommand;\n    }\n\n    public void setOnMoveLastCommand(Command onMoveLastCommand) {\n        this.onMoveLastCommand = onMoveLastCommand;\n    }\n\n    public void setOnMoveUpCommand(Command onMoveUpCommand) {\n        this.onMoveUpCommand = onMoveUpCommand;\n    }\n\n    public void setOnMoveDownCommand(Command onMoveDownCommand) {\n        this.onMoveDownCommand = onMoveDownCommand;\n    }\n\n    public void setOnDeleteCommand(Command onDeleteCommand) {\n        this.onDeleteCommand = onDeleteCommand;\n    }\n\n    public void setOnExpandCommand(Command onExpandCommand) {\n        this.onExpandCommand = onExpandCommand;\n    }\n\n    public NavItem getNavItem() {\n        return navItem;\n    }\n\n    public void edit(NavItem navItem) {\n        this.clear();\n        this.navItem = navItem.cloneItem();\n        this.navItemBackup = navItem;\n        this.doEdit();\n    }\n\n    public boolean canBeExpanded() {\n        return ItemType.GROUP.equals(itemType) && !childEditorList.isEmpty();\n    }\n\n    public void expand() {\n        if (!expanded && canBeExpanded()) {\n            expanded = true;\n            view.setExpanded(expanded);\n        }\n    }\n\n    public void collapse() {\n        if (expanded && canBeExpanded()) {\n            expanded = false;\n            view.setExpanded(expanded);\n        }\n    }\n\n    public void expandAll() {\n        this.expand();\n        childEditorList.forEach(NavItemEditor::expandAll);\n    }\n\n    public void collapseAll() {\n        this.collapse();\n        childEditorList.forEach(NavItemEditor::collapseAll);\n    }\n\n    public void expandOrCollapse() {\n        if (canBeExpanded()) {\n            if (expanded) {\n                collapse();\n            } else {\n                expand();\n            }\n            if (onExpandCommand != null) {\n                onExpandCommand.execute();\n            }\n        }\n    }\n\n    public void startEdition() {\n        if (editEnabled) {\n            if (itemNameFromPerspective) {\n                String perspectiveName = targetPerspectiveEditor.getPerspectiveName(perspectiveId);\n                view.setItemName(perspectiveName);\n            }\n            if (settings == null || settings.isPerspectiveContextEnabled(navItem)) {\n                perspectivePluginManager.getLayoutTemplateInfo(perspectiveId, info -> {\n                    targetPerspectiveEditor.setNavGroupEnabled(info != null && info.hasNavigationComponents());\n                    view.startItemEdition();\n                    navItemEditStartedEvent.fire(new NavItemEditStartedEvent(this));\n                });\n            } else {\n                targetPerspectiveEditor.setNavGroupEnabled(false);\n                view.startItemEdition();\n                navItemEditStartedEvent.fire(new NavItemEditStartedEvent(this));\n            }\n        }\n    }\n\n    public void finishEdition() {\n        view.finishItemEdition();\n        childEditorList.forEach(NavItemEditor::finishEdition);\n    }\n\n    public void cancelEdition() {\n        view.finishItemEdition();\n        edit(navItemBackup);\n        onEditCancelled();\n    }\n\n    private void doEdit() {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n        if (navItem.getName() != null) {\n            view.setItemName(navItem.getName());\n            String newPerspectiveI18n = getNewPerspectiveI18n();\n            itemNameFromPerspective = newPerspectiveI18n.equals(navItem.getName());\n        }\n\n        if (navItem.getDescription() != null) {\n            view.setItemDescription(navItem.getDescription());\n        }\n\n        creationEnabled = false;\n        editEnabled = navItem.isModifiable();\n        deleteEnabled = navItem.isModifiable();\n\n        // Nav group\n        if (navItem instanceof NavGroup) {\n            view.setItemType(itemType = ItemType.GROUP);\n            view.setExpandEnabled(false);\n            if (areChildrenAllowed()) {\n                view.setExpanded(expanded);\n                creationEnabled = true;\n                NavGroup navGroup = (NavGroup) navItem;\n                registerChildren(navGroup);\n            }\n        }\n        // Divider\n        else if (navItem instanceof NavDivider) {\n            view.setItemType(itemType = ItemType.DIVIDER);\n            view.setItemName(\"--------------\");\n            editEnabled = false;\n        }\n        else {\n            if (navCtx.getResourceId() != null) {\n\n                // Nav perspective item\n                if (ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n\n                    Set<String> visiblePerspectiveIds = getPerspectiveIds(navItem, true);\n                    if (visiblePerspectiveIds.isEmpty() || visiblePerspectiveIds.contains(navCtx.getResourceId())) {\n                        perspectiveId = navCtx.getResourceId();\n                    } else if (!visiblePerspectiveIds.isEmpty()) {\n                        perspectiveId = visiblePerspectiveIds.iterator().next();\n                        navCtx.setResourceId(perspectiveId);\n                        navItem.setContext(navCtx.toString());\n                    }\n\n                    Set<String> hiddenPerspectiveIds = getPerspectiveIds(navItem, false);\n                    boolean isRuntimePerspective = perspectivePluginManager.isRuntimePerspective(perspectiveId);\n                    String selectedNavGroupId = navCtx.getNavGroupId();\n                    targetPerspectiveEditor.clear();\n                    targetPerspectiveEditor.setPerspectiveId(perspectiveId);\n                    targetPerspectiveEditor.setNavGroupId(selectedNavGroupId);\n                    targetPerspectiveEditor.setPerspectiveIdsExcluded(hiddenPerspectiveIds);\n                    targetPerspectiveEditor.show();\n\n                    view.setItemType(itemType = isRuntimePerspective ? ItemType.RUNTIME_PERSPECTIVE : ItemType.PERSPECTIVE);\n                    view.setContextWidget(targetPerspectiveEditor);\n                }\n            } else {\n                // Ignore non supported items\n            }\n        }\n\n        view.setItemEditable(editEnabled);\n        view.setItemDeletable(deleteEnabled);\n        addCommands();\n    }\n\n    public void clear() {\n        navItem = null;\n        perspectiveId = null;\n        view.clearChildren();\n        view.clearCommands();\n    }\n\n    public boolean areChildrenAllowed() {\n        return areChildrenAllowed(0, this);\n    }\n\n    public boolean areSubgroupsAllowed() {\n        return areSubgroupsAllowed(0, this);\n    }\n\n    private boolean areChildrenAllowed(int levels, NavItemEditor editor) {\n        if (editor == null) {\n            return settings == null || settings.getMaxLevels() < 0 || levels < settings.getMaxLevels();\n        } else {\n            int itemMaxLevels = settings != null ? settings.getMaxLevels(editor.getNavItem().getId()) : -1;\n            return itemMaxLevels != -1 ? levels < itemMaxLevels : areChildrenAllowed(levels+1, editor.getParentEditor());\n        }\n    }\n\n    private boolean areSubgroupsAllowed(int levels, NavItemEditor editor) {\n        if (editor == null) {\n            return settings == null || settings.getMaxLevels() < 0 || levels < settings.getMaxLevels() - 1;\n        } else {\n            int itemMaxLevels = settings != null ? settings.getMaxLevels(editor.getNavItem().getId()) - 1 : -1;\n            return itemMaxLevels > -1 ? levels < itemMaxLevels : areSubgroupsAllowed(levels+1, editor.getParentEditor());\n        }\n    }\n\n    public NavItemEditor createChildEditor(NavItem navItem) {\n        Class<? extends NavItemEditor> childEditorClass = getChildEditorClass();\n        NavItemEditor navItemEditor = beanManager.lookupBean(childEditorClass).newInstance();\n        navItemEditor.setParentEditor(this);\n        navItemEditor.setSettings(settings);\n        navItemEditor.setOnUpdateCommand(() -> onUpdateChild(navItem, navItemEditor));\n        navItemEditor.setOnCancelCommand(() -> onCancelChild(navItem, navItemEditor));\n        navItemEditor.setOnDeleteCommand(() -> onDeleteChild(navItemEditor));\n        navItemEditor.setOnMoveFirstCommand(() -> onMoveFirstChild(navItemEditor));\n        navItemEditor.setOnMoveLastCommand(() -> onMoveLastChild(navItemEditor));\n        navItemEditor.setOnMoveUpCommand(() -> onMoveUpChild(navItemEditor));\n        navItemEditor.setOnMoveDownCommand(() -> onMoveDownChild(navItemEditor));\n        return navItemEditor;\n    }\n\n    public Set<String> getPerspectiveIds(NavItem navItem, boolean visible) {\n        boolean onlyRuntime = settings == null || settings.onlyRuntimePerspectives(navItem);\n        Set<String> runtimeIds = getRuntimePerspectiveIds();\n        Set<String> hardCodedIds = getHardCodedPerspectiveIds();\n        Set<String> excludedIds = perspectiveTreeProvider.getPerspectiveIdsExcluded();\n\n        if (visible) {\n            if (!onlyRuntime) {\n                runtimeIds.addAll(hardCodedIds);\n            }\n            return runtimeIds.stream()\n                    .filter(id -> !excludedIds.contains(id))\n                    .collect(Collectors.toSet());\n        } else {\n            if (onlyRuntime) {\n                hardCodedIds.addAll(excludedIds);\n                return hardCodedIds;\n            }\n            return excludedIds;\n        }\n    }\n\n    private Set<String> getRuntimePerspectiveIds() {\n        Set<String> result = new HashSet<>();\n        perspectivePluginManager.getPerspectivePlugins(plugins -> {\n            plugins.forEach(p -> {\n                String perspectiveId = p.getName();\n                result.add(perspectiveId);\n            });\n        });\n        return result;\n    }\n\n    private Set<String> getHardCodedPerspectiveIds() {\n        Set<String> result = new HashSet<>();\n        Collection<SyncBeanDef<AbstractWorkbenchPerspectiveActivity>> beanDefs =  beanManager.lookupBeans(AbstractWorkbenchPerspectiveActivity.class);\n        beanDefs.forEach(beanDef -> {\n            AbstractWorkbenchPerspectiveActivity bean = beanDef.getInstance();\n            String perspectiveId = bean.getIdentifier();\n            result.add(perspectiveId);\n            beanManager.destroyBean(bean);\n        });\n        return result;\n    }\n\n\n    // Item commands\n\n    private void addCommands() {\n        boolean dividerRequired = false;\n\n        if (creationEnabled) {\n            boolean newGroupEnabled = isNewGroupEnabled();\n            if (newGroupEnabled) {\n                this.addCommand(view.i18nNewItem(getGroupLiteral()), this::newGroup);\n                dividerRequired = true;\n            }\n            boolean newDividerEnabled = isNewDividerEnabled();\n            if (newDividerEnabled) {\n                this.addCommand(view.i18nNewItem(getDividerLiteral()), this::newDivider);\n                dividerRequired = true;\n            }\n            boolean newPerspectiveEnabled = isNewPerspectiveEnabled();\n            if (newPerspectiveEnabled) {\n                this.addCommand(view.i18nNewItem(getPerspectiveLiteral()), this::newPerspective);\n                dividerRequired = true;\n            }\n        }\n\n        if (moveUpEnabled || moveDownEnabled) {\n            if (dividerRequired) {\n                view.addCommandDivider();\n            }\n            dividerRequired = true;\n            if (moveUpEnabled) {\n                this.addCommand(view.i18nMoveFirst(), this::moveFirstCommand);\n                this.addCommand(view.i18nMoveUp(), this::moveUpCommand);\n            }\n            if (moveDownEnabled) {\n                this.addCommand(view.i18nMoveDown(), this::moveDownCommand);\n                this.addCommand(view.i18nMoveLast(), this::moveLastCommand);\n            }\n        }\n        if (isGotoPerspectiveEnabled()) {\n            if (dividerRequired) {\n                view.addCommandDivider();\n            }\n            dividerRequired = true;\n            this.addCommand(view.i18nGotoItem(getPerspectiveLiteral()), this::gotoPerspectiveCommand);\n        }\n    }\n\n    private void addCommand(String name, Command action) {\n        view.addCommand(name, action);\n        view.setCommandsEnabled(true);\n    }\n\n    private void refreshCommands() {\n        view.clearCommands();\n        this.addCommands();\n    }\n\n    public NavItemEditor newGroup() {\n        NavGroup navGroup = (NavGroup) navItem;\n        String id = \"group_\" + view.generateId();\n        String name = i18n.newItemName(getGroupLiteral());\n\n        NavGroup newItem = NavFactory.get().createNavGroup();\n        newItem.setParent(navGroup);\n        newItem.setId(id);\n        newItem.setName(name);\n        newItem.setModifiable(true);\n\n        NavItemEditor childEditor = registerChild(newItem);\n        childEditor.startEdition();\n        this.expand();\n        return childEditor;\n    }\n\n    public NavItemEditor newPerspective() {\n        NavGroup navGroup = (NavGroup) navItem;\n        String id = \"perspective_\" + view.generateId();\n        String name = i18n.newItemName(getPerspectiveLiteral());\n        NavItem newItem = NavFactory.get().createNavItem();\n        newItem.setParent(navGroup);\n        newItem.setId(id);\n        newItem.setName(name);\n        newItem.setModifiable(true);\n\n        Set<String> visiblePerspectiveIds = getPerspectiveIds(navGroup, true);\n        if (!visiblePerspectiveIds.isEmpty()) {\n            String firstPerspective = visiblePerspectiveIds.iterator().next();\n            newItem.setContext(NavWorkbenchCtx.perspective(firstPerspective).toString());\n        }\n\n        NavItemEditor childEditor = registerChild(newItem);\n        childEditor.startEdition();\n        this.expand();\n        return childEditor;\n    }\n\n    public NavItemEditor newDivider() {\n        NavGroup navGroup = (NavGroup) navItem;\n        String id = \"divider_\" + view.generateId();\n        NavDivider newItem = NavFactory.get().createDivider();\n        newItem.setId(id);\n        newItem.setParent(navGroup);\n        newItem.setModifiable(true);\n\n        NavItemEditor childEditor = registerChild(newItem);\n        this.onUpdateChild(newItem, childEditor);\n        this.expand();\n        return childEditor;\n    }\n\n    void gotoPerspectiveCommand() {\n        if (perspectiveId != null) {\n            placeManager.goTo(perspectiveId);\n        }\n    }\n\n    void deleteItemCommand() {\n        if (deleteEnabled && onDeleteCommand != null) {\n            onDeleteCommand.execute();\n        }\n    }\n\n    void moveUpCommand() {\n        if (onMoveUpCommand != null) {\n            onMoveUpCommand.execute();\n        }\n    }\n\n    void moveDownCommand() {\n        if (onMoveDownCommand != null) {\n            onMoveDownCommand.execute();\n        }\n    }\n\n    void moveFirstCommand() {\n        if (onMoveFirstCommand != null) {\n            onMoveFirstCommand.execute();\n        }\n    }\n\n    void moveLastCommand() {\n        if (onMoveLastCommand != null) {\n            onMoveLastCommand.execute();\n        }\n    }\n\n    // Children callbacks\n\n    void onItemUpdated() {\n        navItemBackup = navItem.cloneItem();\n        if (onUpdateCommand != null) {\n            onUpdateCommand.execute();\n        }\n    }\n\n    void onEditCancelled() {\n        if (onCancelCommand != null) {\n            onCancelCommand.execute();\n        }\n    }\n\n    void onMoveUpChild(NavItemEditor navItemEditor) {\n        if (childEditorList.size() > 1) {\n            int idx = childEditorList.indexOf(navItemEditor);\n            if (idx > 0 && idx < childEditorList.size()) {\n                childEditorList.remove(idx);\n                childEditorList.add(idx-1, navItemEditor);\n                refreshChildren();\n\n                NavGroup navGroup = (NavGroup) navItem;\n                navGroup.getChildren().remove(idx);\n                navGroup.getChildren().add(idx-1, navItemEditor.getNavItem());\n                onItemUpdated();\n            }\n        }\n    }\n\n    void onMoveDownChild(NavItemEditor navItemEditor) {\n        if (childEditorList.size() > 1) {\n            int idx = childEditorList.indexOf(navItemEditor);\n            if (idx > -1 && idx < childEditorList.size()-1) {\n                childEditorList.remove(idx);\n                childEditorList.add(idx+1, navItemEditor);\n                refreshChildren();\n\n                NavGroup navGroup = (NavGroup) navItem;\n                navGroup.getChildren().remove(idx);\n                navGroup.getChildren().add(idx+1, navItemEditor.getNavItem());\n                onItemUpdated();\n            }\n        }\n    }\n\n    void onMoveFirstChild(NavItemEditor navItemEditor) {\n        if (childEditorList.size() > 1) {\n            int idx = childEditorList.indexOf(navItemEditor);\n            if (idx > 0 && idx < childEditorList.size()) {\n                childEditorList.remove(idx);\n                childEditorList.add(0, navItemEditor);\n                refreshChildren();\n\n                NavGroup navGroup = (NavGroup) navItem;\n                navGroup.getChildren().remove(idx);\n                navGroup.getChildren().add(0, navItemEditor.getNavItem());\n                onItemUpdated();\n            }\n        }\n    }\n\n    void onMoveLastChild(NavItemEditor navItemEditor) {\n        if (childEditorList.size() > 1) {\n            int idx = childEditorList.indexOf(navItemEditor);\n            if (idx > -1 && idx < childEditorList.size()-1) {\n                childEditorList.remove(idx);\n                childEditorList.add(navItemEditor);\n                refreshChildren();\n\n                NavGroup navGroup = (NavGroup) navItem;\n                navGroup.getChildren().remove(idx);\n                navGroup.getChildren().add(navItemEditor.getNavItem());\n                onItemUpdated();\n            }\n        }\n    }\n\n    void onUpdateChild(NavItem oldItem, NavItemEditor childEditor) {\n        NavItem newItem = childEditor.getNavItem();\n        NavGroup navGroup = (NavGroup) navItem;\n        int idx = navGroup.getChildren().indexOf(oldItem);\n        if (idx != -1) {\n            navGroup.getChildren().remove(idx);\n            navGroup.getChildren().add(idx, newItem);\n            onItemUpdated();\n        }\n        else {\n            // Creation of a brand new child\n            navGroup.getChildren().add(newItem);\n            onItemUpdated();\n        }\n    }\n\n    void onCancelChild(NavItem oldItem, NavItemEditor childEditor) {\n        NavGroup navGroup = (NavGroup) navItem;\n        int idx = navGroup.getChildren().indexOf(oldItem);\n        if (idx == -1) {\n            // Cancel of a brand new child creation\n            childEditorList.remove(childEditor);\n            refreshChildren();\n        }\n    }\n\n    void onDeleteChild(NavItemEditor navItemEditor) {\n        NavGroup navGroup = (NavGroup) navItem;\n        navGroup.getChildren().remove(navItemEditor.getNavItem());\n        childEditorList.remove(navItemEditor);\n        refreshChildren();\n        onItemUpdated();\n    }\n\n    private void registerChildren(NavGroup navGroup) {\n        List<NavItemEditor> oldChildEditorList = new ArrayList<>(childEditorList);\n        childEditorList.clear();\n\n        List<NavItem> childList = navGroup.getChildren();\n        for (int i=0; i<childList.size(); i++) {\n            NavItem childItem = childList.get(i);\n            if ((childItem instanceof NavGroup) && !areSubgroupsAllowed()) {\n                continue;\n            }\n\n            Optional<NavItemEditor> result = oldChildEditorList.stream()\n                    .filter(editor -> editor.getNavItem().equals(childItem))\n                    .findFirst();\n\n            NavItemEditor childEditor = result.isPresent() ? result.get() : createChildEditor(childItem);\n            oldChildEditorList.remove(childEditor);\n            childEditor.edit(childItem);\n            childEditorList.add(childEditor);\n        }\n        // Destroy the remaining editors\n        oldChildEditorList.forEach(beanManager::destroyBean);\n        oldChildEditorList.clear();\n\n        // Refresh the children view\n        this.refreshChildren();\n    }\n\n    private NavItemEditor registerChild(NavItem item) {\n        NavItemEditor childEditor = createChildEditor(item);\n        childEditor.edit(item);\n        childEditorList.add(childEditor);\n        refreshChildren();\n        return childEditor;\n    }\n\n    private void refreshChildren() {\n        view.clearChildren();\n        view.setExpandEnabled(canBeExpanded());\n\n        if (childEditorList.isEmpty()) {\n            expanded = false;\n            view.setExpanded(false);\n        }\n\n        for (int i = 0; i< childEditorList.size(); i++) {\n            NavItemEditor childEditor = childEditorList.get(i);\n            childEditor.setMoveUpEnabled(i > 0);\n            childEditor.setMoveDownEnabled(i < childEditorList.size()-1);\n            childEditor.refreshCommands();\n            view.addChild(childEditor);\n        }\n    }\n\n    // View actions\n\n    void onChangesOk() {\n        boolean error = false;\n\n        // Capture name changes\n        String name = view.getItemName();\n        if (name != null && !name.trim().isEmpty()) {\n            if (!name.equals(navItem.getName())) {\n                navItem.setName(name);\n                view.setItemName(name);\n                String newPerspectiveI18n = getNewPerspectiveI18n();\n                itemNameFromPerspective = newPerspectiveI18n.equals(name);\n            }\n        } else {\n            error = true;\n            view.setItemNameError(error);\n        }\n\n        // Capture perspective changes\n        if (!error && ItemType.PERSPECTIVE.equals(itemType) || ItemType.RUNTIME_PERSPECTIVE.equals(itemType)) {\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            String oldPerspectiveId = navCtx.getResourceId();\n            String newPerspectiveId = targetPerspectiveEditor.getPerspectiveId();\n            if (newPerspectiveId != null && !newPerspectiveId.trim().isEmpty()) {\n                if (oldPerspectiveId != null && !oldPerspectiveId.equals(newPerspectiveId)){\n                    navCtx.setResourceId(perspectiveId = newPerspectiveId);\n                    navItem.setContext(navCtx.toString());\n                }\n            } else {\n                error = true;\n            }\n            boolean isRuntimePerspective = perspectivePluginManager.isRuntimePerspective(newPerspectiveId);\n            String newGroupId =  isRuntimePerspective ? targetPerspectiveEditor.getNavGroupId() : null;\n            String oldGroupId = navCtx.getNavGroupId();\n            if ((oldGroupId == null && newGroupId != null) || oldGroupId != null && !oldGroupId.equals(newGroupId)) {\n                navCtx.setNavGroupId(newGroupId);\n                navItem.setContext(navCtx.toString());\n            }\n        }\n\n        // Process updates\n        if (!error) {\n            finishEdition();\n            onItemUpdated();\n        }\n    }\n\n    void onItemNameChanged() {\n        itemNameFromPerspective = false;\n    }\n\n    void onTargetPerspectiveUpdated() {\n        String perspectiveId = targetPerspectiveEditor.getPerspectiveId();\n        if (itemNameFromPerspective) {\n            String perspectiveName = targetPerspectiveEditor.getPerspectiveName(perspectiveId);\n            view.setItemName(perspectiveName);\n        }\n        if (settings == null || settings.isPerspectiveContextEnabled(navItem)) {\n            perspectivePluginManager.getLayoutTemplateInfo(perspectiveId, info -> {\n                targetPerspectiveEditor.setNavGroupEnabled(info != null && info.hasNavigationComponents());\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemEditorSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.dashbuilder.navigation.NavItem;\n\npublic class NavItemEditorSettings {\n\n    private int maxLevels = -1;\n    private String literalGroup = \"Group\";\n    private String literalPerspective = \"Perspective\";\n    private String literalDivider = \"Divider\";\n    private boolean newDividerEnabled = true;\n    private boolean newGroupEnabled = true;\n    private boolean newPerspectiveEnabled = true;\n    private boolean gotoPerspectiveEnabled = false;\n    private boolean perspectiveContextEnabled = true;\n    private boolean onlyRuntimePerspectives = true;\n    private Map<String, Integer> maxLevelsMap = new HashMap<>();\n    private Map<String, Flags> flagsMap = new HashMap<>();\n\n    public class Flags {\n\n        public static final String NEW_GROUP = \"newGroup\";\n        public static final String NEW_PERSPECTIVE = \"newPerspective\";\n        public static final String NEW_DIVIDER = \"newDivider\";\n        public static final String ONLY_RUNTIME_PERSPECTIVES = \"onlyRuntimePerspectives\";\n        public static final String GOTO_PERSPECTIVE = \"gotoPerspective\";\n        public static final String PERSPECTIVE_CONTEXT = \"perspectiveContext\";\n\n        Map<String, Boolean> flagMap = new HashMap<>();\n        Map<String, Boolean> recursiveMap = new HashMap<>();\n        String lastProp = null;\n\n        void setFlag(String prop, boolean enabled) {\n            flagMap.put(prop, enabled);\n            lastProp = prop;\n        }\n\n        boolean isEnabled(String prop) {\n            if (flagMap.containsKey(prop)) {\n                return flagMap.get(prop);\n            } else {\n                return false;\n            }\n        }\n\n        public void applyToAllChildren() {\n            if (lastProp != null) {\n                recursiveMap.put(lastProp, true);\n            }\n        }\n    }\n\n    public void setLiteralGroup(String literalGroup) {\n        this.literalGroup = literalGroup;\n    }\n\n    public void setLiteralPerspective(String literalPerspective) {\n        this.literalPerspective = literalPerspective;\n    }\n\n    public void setLiteralDivider(String literalDivider) {\n        this.literalDivider = literalDivider;\n    }\n\n    public String getLiteralGroup() {\n        return literalGroup;\n    }\n\n    public String getLiteralPerspective() {\n        return literalPerspective;\n    }\n\n    public String getLiteralDivider() {\n        return literalDivider;\n    }\n\n    private Flags setNavItemPropertyEnabled(String navItemId, String prop, boolean enabled) {\n        Flags config = flagsMap.get(navItemId);\n        if (config == null) {\n            flagsMap.put(navItemId, config = new Flags());\n        }\n        config.setFlag(prop, enabled);\n        return config;\n    }\n\n    private Boolean isNavItemPropertyEnabled(NavItem navItem, String prop) {\n        Flags config = flagsMap.get(navItem.getId());\n        if (config != null && config.flagMap.get(prop) != null) {\n            return config.flagMap.get(prop);\n        }\n        return isNavAncestorPropertyEnabled(navItem.getParent(), prop);\n    }\n\n    private Boolean isNavAncestorPropertyEnabled(NavItem navItem, String prop) {\n        if (navItem == null) {\n            return null;\n        }\n        Flags config = flagsMap.get(navItem.getId());\n        if (config != null && config.flagMap.get(prop) != null && config.recursiveMap.get(prop) != null && config.recursiveMap.get(prop)) {\n            return config.flagMap.get(prop);\n        } else {\n            return isNavAncestorPropertyEnabled(navItem.getParent(), prop);\n        }\n    }\n\n    public boolean isNewGroupEnabled() {\n        return newGroupEnabled;\n    }\n\n    public NavItemEditorSettings setNewGroupEnabled(boolean newGroupEnabled) {\n        this.newGroupEnabled = newGroupEnabled;\n        return this;\n    }\n\n    public boolean isNewGroupEnabled(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.NEW_GROUP);\n        return enabled != null ? enabled : newGroupEnabled;\n    }\n\n    public Flags setNewGroupEnabled(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.NEW_GROUP, enabled);\n    }\n\n    public boolean isNewPerspectiveEnabled() {\n        return newPerspectiveEnabled;\n    }\n\n    public NavItemEditorSettings setNewPerspectiveEnabled(boolean newPerspectiveEnabled) {\n        this.newPerspectiveEnabled = newPerspectiveEnabled;\n        return this;\n    }\n\n    public boolean isNewPerspectiveEnabled(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.NEW_PERSPECTIVE);\n        return enabled != null ? enabled : newPerspectiveEnabled;\n    }\n\n    public Flags setNewPerspectiveEnabled(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.NEW_PERSPECTIVE, enabled);\n    }\n\n    public boolean isNewDividerEnabled() {\n        return newDividerEnabled;\n    }\n\n    public NavItemEditorSettings setNewDividerEnabled(boolean newDividerEnabled) {\n        this.newDividerEnabled = newDividerEnabled;\n        return this;\n    }\n\n    public boolean isNewDividerEnabled(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.NEW_DIVIDER);\n        return enabled != null ? enabled : newDividerEnabled;\n    }\n\n    public Flags setNewDividerEnabled(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.NEW_DIVIDER, enabled);\n    }\n\n    public boolean onlyRuntimePerspectives(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.ONLY_RUNTIME_PERSPECTIVES);\n        return enabled != null ? enabled : onlyRuntimePerspectives;\n    }\n\n    public Flags setOnlyRuntimePerspectives(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.ONLY_RUNTIME_PERSPECTIVES, enabled);\n    }\n\n    public boolean isGotoPerspectiveEnabled() {\n        return gotoPerspectiveEnabled;\n    }\n\n    public NavItemEditorSettings setGotoPerspectiveEnabled(boolean gotoPerspectiveEnabled) {\n        this.gotoPerspectiveEnabled = gotoPerspectiveEnabled;\n        return this;\n    }\n\n    public boolean isGotoPerspectiveEnabled(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.GOTO_PERSPECTIVE);\n        return enabled != null ? enabled : gotoPerspectiveEnabled;\n    }\n\n    public Flags setGotoPerspectiveEnabled(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.GOTO_PERSPECTIVE, enabled);\n    }\n\n    public boolean isPerspectiveContextEnabled() {\n        return perspectiveContextEnabled;\n    }\n\n    public NavItemEditorSettings setPerspectiveContextEnabled(boolean perspectiveContextEnabled) {\n        this.perspectiveContextEnabled = perspectiveContextEnabled;\n        return this;\n    }\n\n    public boolean isPerspectiveContextEnabled(NavItem navItem) {\n        Boolean enabled = isNavItemPropertyEnabled(navItem, Flags.PERSPECTIVE_CONTEXT);\n        return enabled != null ? enabled : perspectiveContextEnabled;\n    }\n\n    public Flags setPerspectiveContextEnabled(String navItemId, boolean enabled) {\n        return setNavItemPropertyEnabled(navItemId, Flags.PERSPECTIVE_CONTEXT, enabled);\n    }\n\n    public int getMaxLevels() {\n        return maxLevels;\n    }\n\n    public NavItemEditorSettings setMaxLevels(String navItemId, int maxLevels) {\n        maxLevelsMap.put(navItemId, maxLevels);\n        return this;\n    }\n\n    public int getMaxLevels(String navItemId) {\n        if (!maxLevelsMap.containsKey(navItemId)) {\n            return -1;\n        } else {\n            return maxLevelsMap.get(navItemId);\n        }\n    }\n\n    public NavItemEditorSettings setMaxLevels(int maxLevels) {\n        this.maxLevels = maxLevels;\n        return this;\n    }\n\n    public boolean isOnlyRuntimePerspectives() {\n        return onlyRuntimePerspectives;\n    }\n\n    public NavItemEditorSettings setOnlyRuntimePerspectives(boolean onlyRuntimePerspectives) {\n        this.onlyRuntimePerspectives = onlyRuntimePerspectives;\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavItemEditorView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport com.google.gwt.core.client.Duration;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\n\npublic abstract class NavItemEditorView<P extends NavItemEditor> implements org.jboss.errai.ui.client.local.api.IsElement, NavItemEditor.View<P> {\n\n    NavigationConstants i18n = NavigationConstants.INSTANCE;\n\n    @Override\n    public String i18nNewItem(String item) {\n        return i18n.newItem(item);\n    }\n\n    @Override\n    public String i18nNewItemName(String item) {\n        return i18n.newItemName(item);\n    }\n\n    @Override\n    public String i18nGotoItem(String item) {\n        return i18n.gotoItem(item);\n    }\n\n    @Override\n    public String i18nDeleteItem() {\n        return i18n.deleteItem();\n    }\n\n    @Override\n    public String i18nMoveUp() {\n        return i18n.moveUp();\n    }\n\n    @Override\n    public String i18nMoveDown() {\n        return i18n.moveDown();\n    }\n\n    @Override\n    public String i18nMoveFirst() {\n        return i18n.moveFirst();\n    }\n\n    @Override\n    public String i18nMoveLast() {\n        return i18n.moveLast();\n    }\n\n    @Override\n    public String generateId() {\n        return Double.toString(Duration.currentTimeMillis());\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavRootNodeEditor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PlaceManager;\n\n/**\n * An item editor used to handle {@link NavTree} root nodes\n */\n@Dependent\npublic class NavRootNodeEditor extends NavItemEditor {\n\n    public interface View extends NavItemEditor.View<NavRootNodeEditor> {\n\n    }\n\n    NavRootNodeEditorView view;\n\n    @Inject\n    public NavRootNodeEditor(NavRootNodeEditorView view,\n                             SyncBeanManager beanManager,\n                             PlaceManager placeManager,\n                             PerspectiveTreeProvider perspectiveTreeProvider,\n                             TargetPerspectiveEditor targetPerspectiveEditor,\n                             PerspectivePluginManager perspectivePluginManager,\n                             Event<NavItemEditStartedEvent> navItemEditStartedEvent,\n                             Event<NavItemEditCancelledEvent> navItemEditCancelledEvent) {\n\n        super(view, beanManager,\n                placeManager,\n                perspectiveTreeProvider,\n                targetPerspectiveEditor,\n                perspectivePluginManager,\n                navItemEditStartedEvent,\n                navItemEditCancelledEvent);\n\n        this.view = view;\n        this.view.init(this);\n\n        super.setChildEditorClass(NavItemDefaultEditor.class);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavRootNodeEditorView.css",
    "content": ".uf-navitem-container {\n    clear: both;\n}\n\n.uf-navitem-name {\n    margin-left: 7px;\n}\n\n.uf-navitem-cog-icon,\n.uf-navitem-edit-icon,\n.uf-navitem-delete-icon {\n    margin-left: 5px;\n    visibility: hidden;\n    cursor: pointer;\n}\n\n.uf-navitem-confirm-icon,\n.uf-navitem-cancel-icon {\n    margin-left: 5px;\n    cursor: pointer;\n}\n\n.uf-navitem-name-div {\n    float: left;\n}\n\n.uf-navitem-name-input {\n    margin-left: 7px;\n    font-size: smaller;\n    float: left;\n    width: 150px;\n}\n\n.uf-navitem-name-error {\n    border-color: #c00;\n    border-width: 1px;\n}\n\n.uf-navitem-edit-div {\n}\n\n.uf-navitem-extra-div {\n    margin-left: 22px;\n    margin-bottom: 10px;\n    display: none;\n}\n\n.uf-navitem-extra-div .dropdown-menu:before,\n.uf-navitem-extra-div .dropdown-menu:after {\n    content: none;\n}\n\n.uf-navitem-extra-div .dropdown-menu {\n    margin-top: -1px;\n    margin-left: 15px;\n}\n\n.uf-navitem-view-div:hover,\n.uf-navitem-edit-div:hover {\n    background-color: lightcyan;\n}\n\n.uf-navitem-view-div:hover .uf-navitem-cog-icon,\n.uf-navitem-view-div:hover .uf-navitem-edit-icon,\n.uf-navitem-view-div:hover .uf-navitem-delete-icon {\n    visibility: visible;\n}\n\n.uf-navitem-edit-icon:hover,\n.uf-navitem-confirm-icon:hover,\n.uf-navitem-cancel-icon:hover {\n    color: #0088ce;\n}\n\n.uf-navitem-delete-icon:hover {\n    color: #990000;\n}\n\n.uf-navitem-children {\n    margin-left: 15px;\n}\n\n.uf-navitem-command-menu {\n    margin-left: 30px;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavRootNodeEditorView.html",
    "content": "<div class=\"uf-navitem-container\">\n    <div class=\"dropdown dropdown-kebab-pf\">\n        <div class=\"pull-left\">\n            <span data-field=\"itemIcon\"></span>\n        </div>\n        <div data-field=\"itemViewDiv\" class=\"uf-navitem-view-div\">\n            <span data-field=\"itemName\" class=\"uf-navitem-name\"></span>\n            <button class=\"btn btn-link dropdown-toggle\" type=\"button\" id=\"dropdownKebab\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n                <span data-field=\"itemMenuIcon\" class=\"fa fa-cog uf-navitem-cog-icon\" title=\"Show menu\"></span>\n            </button>\n            <ul data-field=\"commandMenu\" class=\"dropdown-menu uf-navitem-command-menu\" aria-labelledby=\"dropdownKebab\">\n            </ul>\n            <span data-field=\"itemEditIcon\" class=\"pf pficon-edit uf-navitem-edit-icon\"></span>\n            <span data-field=\"itemDeleteIcon\" class=\"pf pficon-delete uf-navitem-delete-icon\"></span>\n        </div>\n        <div data-field=\"itemEditDiv\" class=\"uf-navitem-edit-div\">\n            <div data-field=\"itemNameDiv\" class=\"uf-navitem-name-div\">\n                <input data-field=\"itemNameInput\" class=\"form-control uf-navitem-name-input\" type=\"text\" />\n                <span data-field=\"itemConfirmIcon\" class=\"fa fa-check uf-navitem-confirm-icon\"></span>\n                <span data-field=\"itemCancelIcon\" class=\"fa fa-close uf-navitem-cancel-icon\"></span>\n            </div>\n            <div data-field=\"extraDiv\" class=\"uf-navitem-extra-div\"></div>\n        </div>\n    </div>\n    <div data-field=\"childrenDiv\" class=\"uf-navitem-children\">\n\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavRootNodeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyPressEvent;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.user.client.Event;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class NavRootNodeEditorView extends NavItemEditorView<NavRootNodeEditor> implements NavRootNodeEditor.View {\n\n    @Inject\n    @DataField\n    Span itemIcon;\n\n    @Inject\n    @DataField\n    Span itemMenuIcon;\n\n    @Inject\n    @DataField\n    Span itemEditIcon;\n\n    @Inject\n    @DataField\n    Span itemDeleteIcon;\n\n    @Inject\n    @DataField\n    Span itemConfirmIcon;\n\n    @Inject\n    @DataField\n    Span itemCancelIcon;\n\n    @Inject\n    @DataField\n    Span itemName;\n\n    @Inject\n    @DataField\n    Input itemNameInput;\n\n    @Inject\n    @DataField\n    Div extraDiv;\n\n    @Inject\n    @DataField\n    Div itemViewDiv;\n\n    @Inject\n    @DataField\n    Div itemEditDiv;\n\n    @Inject\n    @DataField\n    UnorderedList commandMenu;\n\n    @Inject\n    @DataField\n    Div childrenDiv;\n\n    NavRootNodeEditor presenter;\n\n    @Override\n    public void init(NavRootNodeEditor presenter) {\n        this.presenter = presenter;\n        itemViewDiv.setHidden(false);\n        itemEditDiv.setHidden(true);\n        itemMenuIcon.setTitle(i18n.itemMenuTitle());\n        itemEditIcon.setTitle(i18n.editItem());\n        itemDeleteIcon.setTitle(i18n.deleteItem());\n    }\n\n    @Override\n    public void clearChildren() {\n        DOMUtil.removeAllChildren(childrenDiv);\n    }\n\n    @Override\n    public void addChild(org.jboss.errai.common.client.api.IsElement editor) {\n        childrenDiv.appendChild(editor.getElement());\n    }\n\n    @Override\n    public void setExpandEnabled(boolean enabled) {\n        if (enabled) {\n            itemIcon.getStyle().removeProperty(\"opacity\");\n            itemIcon.getStyle().removeProperty(\"pointer-events\");\n            itemIcon.getStyle().setProperty(\"cursor\", \"pointer\");\n            itemName.getStyle().setProperty(\"cursor\", \"pointer\");\n        } else {\n            itemIcon.getStyle().setProperty(\"opacity\", \".5\");\n            itemIcon.getStyle().setProperty(\"pointer-events\", \"none\");\n            itemIcon.getStyle().removeProperty(\"cursor\");\n            itemName.getStyle().removeProperty(\"cursor\");\n        }\n    }\n\n    @Override\n    public void setExpanded(boolean expanded) {\n        itemIcon.setClassName(expanded ? \"fa fa-angle-down\" : \"fa fa-angle-right\");\n        childrenDiv.setHidden(!expanded);\n    }\n\n    @Override\n    public void setItemName(String name) {\n        itemName.setTextContent(name);\n        itemNameInput.setValue(name);\n    }\n\n    @Override\n    public String getItemName() {\n        return itemNameInput.getValue();\n    }\n\n    @Override\n    public void setItemNameError(boolean hasError) {\n        String classes = \"uf-navitem-name-input\" + (hasError ? \" uf-navitem-name-error\" : \" form-control\");\n        itemNameInput.setClassName(classes);\n    }\n\n    @Override\n    public void setItemDescription(String description) {\n        itemName.setTitle(description);\n    }\n\n    @Override\n    public void setItemType(NavItemEditor.ItemType type) {\n        itemIcon.getStyle().removeProperty(\"cursor\");\n\n        if (type == NavItemEditor.ItemType.GROUP) {\n            itemIcon.setClassName(\"fa fa-angle-right\");\n            itemIcon.setTitle(\"\");\n        }\n        else if (type == NavItemEditor.ItemType.DIVIDER) {\n            itemIcon.setClassName(\"fa fa-minus\");\n            itemIcon.setTitle(\"\");\n        }\n        else if (type == NavItemEditor.ItemType.PERSPECTIVE) {\n            itemIcon.setClassName(\"pficon-screen\");\n            itemIcon.setTitle(NavigationConstants.INSTANCE.perspectiveIconTitle());\n        }\n        else if (type == NavItemEditor.ItemType.RUNTIME_PERSPECTIVE) {\n            itemIcon.setClassName(\"pficon-virtual-machine\");\n            itemIcon.setTitle(NavigationConstants.INSTANCE.pageIconTitle());\n        }\n    }\n\n    @Override\n    public void addCommand(String name, Command command) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        commandMenu.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void addCommandDivider() {\n        LIElement li = Document.get().createLIElement();\n        li.setClassName(\"divider\");\n        commandMenu.appendChild((Node) li);\n    }\n\n    @Override\n    public void setCommandsEnabled(boolean enabled) {\n        itemMenuIcon.setHidden(!enabled);\n        commandMenu.setHidden(!enabled);\n    }\n\n    @Override\n    public void clearCommands() {\n        DOMUtil.removeAllChildren(commandMenu);\n    }\n\n    @Override\n    public void startItemEdition() {\n        itemViewDiv.setHidden(true);\n        itemEditDiv.setHidden(false);\n        itemNameInput.focus();\n    }\n\n    @Override\n    public void finishItemEdition() {\n        itemViewDiv.setHidden(false);\n        itemEditDiv.setHidden(true);\n    }\n\n    @Override\n    public void setContextWidget(IsElement widget) {\n        extraDiv.getStyle().setProperty(\"display\", \"block\");\n        DOMUtil.removeAllChildren(extraDiv);\n        extraDiv.appendChild(widget.getElement());\n    }\n\n    @Override\n    public void setItemEditable(boolean editable) {\n        if (editable) {\n            itemEditIcon.getStyle().removeProperty(\"display\");\n        } else {\n            itemEditIcon.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @Override\n    public void setItemDeletable(boolean deletable) {\n        if (deletable) {\n            itemDeleteIcon.getStyle().removeProperty(\"display\");\n        } else {\n            itemDeleteIcon.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"itemIcon\")\n    public void onItemIconClick(ClickEvent event) {\n        presenter.expandOrCollapse();\n    }\n\n    @EventHandler(\"itemName\")\n    public void onItemNameClick(ClickEvent event) {\n        presenter.expandOrCollapse();\n    }\n\n    @EventHandler(\"itemEditIcon\")\n    public void onItemEditClick(ClickEvent event) {\n        presenter.startEdition();\n    }\n\n    @EventHandler(\"itemDeleteIcon\")\n    public void onItemDeleteClick(ClickEvent event) {\n        presenter.deleteItemCommand();\n    }\n\n    @EventHandler(\"itemConfirmIcon\")\n    public void onItemEditOkClick(ClickEvent event) {\n        presenter.onChangesOk();\n    }\n\n    @EventHandler(\"itemCancelIcon\")\n    public void onItemEditCancelClick(ClickEvent event) {\n        presenter.cancelEdition();\n    }\n\n    @EventHandler(\"itemNameInput\")\n    public void onItemNameInputOver(MouseOverEvent event) {\n        itemNameInput.focus();\n    }\n\n    @EventHandler(\"itemNameInput\")\n    public void onItemNameChanged(KeyPressEvent keyEvent) {\n        if (keyEvent.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {\n            presenter.onChangesOk();\n        } else {\n            presenter.onItemNameChanged();\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavTreeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class NavTreeEditor extends NavItemEditor {\n\n    public interface View extends NavItemEditor.View<NavTreeEditor> {\n\n        void setChangedFlag(boolean on);\n    }\n\n    public static final NavigationConstants i18n = NavigationConstants.INSTANCE;\n    public static final String ROOT_GROUP_ID = \"NavTreeEditorRootGroupId\";\n\n    NavTreeEditorView view;\n    NavigationManager navigationManager;\n    NavTree navTree;\n    Command onSaveCommand;\n    Optional<NavItemEditor> currentlyEditedItem = Optional.empty();\n    LoadingBox loadingBox;\n\n    @Inject\n    public NavTreeEditor(NavTreeEditorView view,\n                         NavigationManager navigationManager,\n                         SyncBeanManager beanManager,\n                         PlaceManager placeManager,\n                         PerspectiveTreeProvider perspectiveTreeProvider,\n                         TargetPerspectiveEditor targetPerspectiveEditor,\n                         PerspectivePluginManager perspectivePluginManager,\n                         Event<NavItemEditStartedEvent> navItemEditStartedEvent,\n                         Event<NavItemEditCancelledEvent> navItemEditCancelledEvent,\n                         LoadingBox loadingBox) {\n\n        super(view, beanManager,\n                placeManager,\n                perspectiveTreeProvider,\n                targetPerspectiveEditor,\n                perspectivePluginManager,\n                navItemEditStartedEvent,\n                navItemEditCancelledEvent);\n\n        this.view = view;\n        this.navigationManager = navigationManager;\n        this.loadingBox = loadingBox;\n        this.view.init(this);\n\n        super.setChildEditorClass(NavItemDefaultEditor.class);\n    }\n\n    public void setOnSaveCommand(Command onSaveCommand) {\n        this.onSaveCommand = onSaveCommand;\n    }\n\n    @Override\n    public String getGroupLiteral() {\n        return \"Tree\";\n    }\n\n    public NavTree getNavTree() {\n        return navTree;\n    }\n\n    public void edit(NavTree navTree) {\n        this.navTree = navTree.cloneTree();\n        this.currentlyEditedItem = Optional.empty();\n        view.setChangedFlag(false);\n\n        NavGroup rootGroup = NavFactory.get().createNavGroup(navTree);\n        rootGroup.setId(ROOT_GROUP_ID);\n\n        // Only allow the creation of groups in the first tree level\n        getSettings().setNewDividerEnabled(ROOT_GROUP_ID, false);\n        getSettings().setNewPerspectiveEnabled(ROOT_GROUP_ID, false);\n\n        super.edit(rootGroup);\n        super.expand();\n    }\n\n    @Override\n    void onItemUpdated() {\n        view.setChangedFlag(true);\n        currentlyEditedItem = Optional.empty();\n        super.onItemUpdated();\n    }\n\n    public void newTree() {\n        saveDefaultNavTree();\n        newGroup();\n    }\n\n    // View actions\n\n    void saveDefaultNavTree() {\n\n        final boolean hasNoSavedTree = !navigationManager.hasNavTree();\n\n        if (hasNoSavedTree) {\n            showLoading();\n            navigationManager.saveNavTree(navigationManager.getNavTree(), this::hideLoading);\n        }\n    }\n\n    void showLoading() {\n        loadingBox.show();\n    }\n\n    void hideLoading() {\n        loadingBox.hide();\n    }\n\n    void onSaveClicked() {\n        NavGroup rootGroup = (NavGroup) super.getNavItem();\n        NavTree modifiedTree = NavFactory.get().createNavTree(rootGroup);\n        navigationManager.saveNavTree(modifiedTree, () -> {\n            navTree = modifiedTree;\n            view.setChangedFlag(false);\n            currentlyEditedItem = Optional.empty();\n            if (onSaveCommand != null) {\n                onSaveCommand.execute();\n            }\n        });\n    }\n\n    void onCancelClicked() {\n        edit(navTree);\n    }\n\n    // Keep track of the item under edition so as to avoid editing multiple items simultaneously\n\n    void onItemEditStarted(@Observes NavItemEditStartedEvent event) {\n        currentlyEditedItem.filter(e -> !e.equals(event.getNavItemEditor())).ifPresent(NavItemEditor::cancelEdition);\n        currentlyEditedItem = Optional.of(event.getNavItemEditor());\n    }\n\n    void onItemEditCancelled(@Observes NavItemEditCancelledEvent event) {\n        currentlyEditedItem = Optional.empty();\n    }\n\n    NavItemEditor getCurrentlyEditedItem() {\n        return currentlyEditedItem.isPresent() ? currentlyEditedItem.get() : null;\n    }\n\n    // NavItemEditorSettings proxy methods\n\n    public NavItemEditorSettings setMaxLevels(String navItemId, int maxLevels) {\n        return getSettings().setMaxLevels(navItemId, maxLevels);\n    }\n\n    public NavItemEditorSettings.Flags setNewGroupEnabled(String navItemId, boolean enabled) {\n        return getSettings().setNewGroupEnabled(navItemId, enabled);\n    }\n\n    public NavItemEditorSettings.Flags setNewPerspectiveEnabled(String navItemId, boolean enabled) {\n        return getSettings().setNewPerspectiveEnabled(navItemId, enabled);\n    }\n\n    public NavItemEditorSettings.Flags setNewDividerEnabled(String navItemId, boolean enabled) {\n        return getSettings().setNewDividerEnabled(navItemId, enabled);\n    }\n\n    public NavItemEditorSettings.Flags setOnlyRuntimePerspectives(String navItemId, boolean enabled) {\n        return getSettings().setOnlyRuntimePerspectives(navItemId, enabled);\n    }\n\n    public NavItemEditorSettings.Flags setPerspectiveContextEnabled(String navItemId, boolean enabled) {\n        return getSettings().setPerspectiveContextEnabled(navItemId, enabled);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavTreeEditorView.css",
    "content": ".uf-cms-nav-tree-panel {\n    overflow: auto;\n    height: 100%;\n}\n\n.uf-cms-nav-alert-panel {\n    margin: 15px;\n}\n\n.uf-cms-nav-children-panel {\n    margin: 10px 0px 5px 15px;\n    font-size: larger;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavTreeEditorView.html",
    "content": "<div data-field=\"mainDiv\" class=\"uf-cms-nav-tree-panel\">\n    <div data-field=\"alertDiv\" class=\"uf-cms-nav-alert-panel alert alert-info\">\n        <div class=\"pull-right\">\n            <button data-field=\"saveButton\" class=\"btn btn-primary\" type=\"submit\">Save</button>\n            <button data-field=\"cancelButton\" class=\"btn btn-default\" type=\"submit\">Cancel</button>\n        </div>\n        <span class=\"pficon pficon-info\"></span>\n        <span data-field=\"alertMessage\">Save changes?</span>\n    </div>\n    <div data-field=\"childrenDiv\" class=\"uf-cms-nav-children-panel\">\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/NavTreeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class NavTreeEditorView extends NavItemEditorView<NavTreeEditor> implements NavTreeEditor.View {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div childrenDiv;\n\n    @Inject\n    @DataField\n    Div alertDiv;\n\n    @Inject\n    @DataField\n    Span alertMessage;\n\n    @Inject\n    @DataField\n    Button saveButton;\n\n    @Inject\n    @DataField\n    Button cancelButton;\n\n    NavTreeEditor presenter;\n\n    @Override\n    public void init(NavTreeEditor presenter) {\n        this.presenter = presenter;\n        alertMessage.setTextContent(i18n.saveChanges());\n        saveButton.setTextContent(i18n.save());\n        cancelButton.setTextContent(i18n.cancel());\n    }\n\n    @Override\n    public void setExpandEnabled(boolean enabled) {\n    }\n\n    @Override\n    public void setExpanded(boolean expanded) {\n        childrenDiv.setHidden(!expanded);\n    }\n\n    @Override\n    public void clearChildren() {\n        DOMUtil.removeAllChildren(childrenDiv);\n        setChangedFlag(false);\n    }\n\n    @Override\n    public void addChild(IsElement editor) {\n        childrenDiv.appendChild(editor.getElement());\n    }\n\n    @Override\n    public void setChangedFlag(boolean on) {\n        if (on) {\n            alertDiv.getStyle().removeProperty(\"display\");\n        } else {\n            alertDiv.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"saveButton\")\n    public void onSaveClicked(ClickEvent event) {\n        presenter.onSaveClicked();\n    }\n\n    @EventHandler(\"cancelButton\")\n    public void onCancelClicked(ClickEvent event) {\n        presenter.onCancelClicked();\n    }\n\n    // N/A: The rest of the NavItemEditorView methods below does not apply since the NavTreeEditor\n    // item is non editable and it only allows for the creation of subgroup items.\n\n    @Override\n    public void setItemName(String name) {\n    }\n\n    @Override\n    public String getItemName() {\n        return null;\n    }\n\n    @Override\n    public void setItemNameError(boolean hasError) {\n    }\n\n    @Override\n    public void setItemDescription(String description) {\n    }\n\n    @Override\n    public void setItemType(NavItemEditor.ItemType type) {\n    }\n\n    @Override\n    public void clearCommands() {\n    }\n\n    @Override\n    public void addCommand(String name, Command command) {\n    }\n\n    @Override\n    public void addCommandDivider() {\n    }\n\n    @Override\n    public void setCommandsEnabled(boolean enabled) {\n    }\n\n    @Override\n    public void setItemEditable(boolean editable) {\n    }\n\n    @Override\n    public void setItemDeletable(boolean deletable) {\n    }\n\n    @Override\n    public void startItemEdition() {\n    }\n\n    @Override\n    public void finishItemEdition() {\n    }\n\n    @Override\n    public void setContextWidget(IsElement widget) {\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/TargetPerspectiveEditor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.widgets.common.client.dropdown.PerspectiveDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.PerspectiveNameProvider;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TargetPerspectiveEditor implements IsElement, PerspectiveNameProvider {\n\n    public interface View extends UberElement<TargetPerspectiveEditor> {\n\n        void setPerspectiveSelector(IsWidget perspectiveDropDown);\n\n        void clearNavGroupItems();\n\n        void setNavGroupEnabled(boolean enabled);\n\n        void addNavGroupItem(String name, Command onSelect);\n\n        void setNavGroupSelection(String name, Command onReset);\n    }\n\n    View view;\n    String navGroupId;\n    PerspectiveDropDown perspectiveDropDown;\n    PerspectivePluginManager perspectivePluginManager;\n    PerspectiveTreeProvider perspectiveTreeProvider;\n    List<NavItem> navItemList;\n    Command onUpdateCommand;\n\n    @Inject\n    public TargetPerspectiveEditor(View view,\n                                   PerspectiveDropDown perspectiveDropDown,\n                                   PerspectivePluginManager perspectivePluginManager,\n                                   PerspectiveTreeProvider perspectiveTreeProvider) {\n        this.view = view;\n        this.perspectiveDropDown = perspectiveDropDown;\n        this.perspectivePluginManager = perspectivePluginManager;\n        this.perspectiveTreeProvider = perspectiveTreeProvider;\n        this.perspectiveDropDown.setPerspectiveNameProvider(this);\n        this.perspectiveDropDown.setMaxItems(50);\n        this.perspectiveDropDown.setWidth(150);\n        this.perspectiveDropDown.setOnChange(this::onPerspectiveChanged);\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void setNavItemList(List<NavItem> navItemList) {\n        this.navItemList = navItemList;\n    }\n\n    public void setOnUpdateCommand(Command onUpdateCommand) {\n        this.onUpdateCommand = onUpdateCommand;\n    }\n\n    public void setPerspectiveIdsExcluded(Set<String> perspectiveIdsExcluded) {\n        perspectiveDropDown.setPerspectiveIdsExcluded(perspectiveIdsExcluded);\n    }\n\n    public void setPerspectiveId(String perspectiveId) {\n        perspectiveDropDown.setSelectedPerspective(perspectiveId);\n    }\n\n    public String getPerspectiveId() {\n        return perspectiveDropDown.getSelectedPerspective().getIdentifier();\n    }\n\n    @Override\n    public String getPerspectiveName(String perspectiveId) {\n        if (perspectivePluginManager.isRuntimePerspective(perspectiveId)) {\n            return perspectiveId;\n        }\n        return perspectiveTreeProvider.getPerspectiveName(perspectiveId);\n    }\n\n    public void setNavGroupEnabled(boolean enabled) {\n        view.setNavGroupEnabled(enabled);\n    }\n\n    public void setNavGroupId(String navGroupId) {\n        this.navGroupId = navGroupId;\n    }\n\n    public String getNavGroupId() {\n        return navGroupId;\n    }\n\n    public void show() {\n        view.setPerspectiveSelector(perspectiveDropDown);\n        updateNavGroups();\n    }\n\n    public void clear() {\n        navGroupId = null;\n        perspectiveDropDown.clear();\n        view.clearNavGroupItems();\n    }\n\n    private void updateNavGroups() {\n        view.clearNavGroupItems();\n        if (navItemList != null) {\n            updateNavGroups(navItemList);\n        }\n    }\n\n    private void updateNavGroups(List<NavItem> navItemList) {\n        navItemList.stream()\n            .filter(navItem -> navItem instanceof NavGroup)\n            .forEach(this::addNavGroup);\n    }\n\n    private void addNavGroup(NavItem navItem) {\n        // Discard items with no name\n        if (navItem.getName() != null) {\n            // Check if the group is already selected\n            String fullPath = calculateFullPath(navItem);\n            if (navGroupId != null && navItem.getId().equals(navGroupId)) {\n                view.setNavGroupSelection(fullPath, () -> onGroupSelected(null));\n            } else {\n                view.addNavGroupItem(fullPath, () -> onGroupSelected(navItem.getId()));\n            }\n        }\n        // Add the children items\n        updateNavGroups(((NavGroup) navItem).getChildren());\n    }\n\n    private String calculateFullPath(NavItem navItem) {\n        StringBuilder out = new StringBuilder();\n        NavItem parent = navItem.getParent();\n        while (parent != null && parent.getName() != null) {\n            out.insert(0, parent.getName() + \">\");\n            parent = parent.getParent();\n        }\n        out.append(navItem.getName());\n        return out.toString();\n    }\n\n    // View callbacks\n\n    public void onGroupSelected(String id) {\n        navGroupId = id;\n        updateNavGroups();\n        if (onUpdateCommand != null) {\n            onUpdateCommand.execute();\n        }\n    }\n\n    public void onPerspectiveChanged() {\n        if (onUpdateCommand != null) {\n            onUpdateCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/TargetPerspectiveEditorView.css",
    "content": ".uf-tpe-selector-button {\n    width: 150px;\n    text-align: left;\n}\n.uf-tpe-selector-menu {\n    margin-left: 37px;\n    width: 150px;\n    overflow: auto;\n    max-height: 250px;\n}\n.uf-tpe-help-icon {\n    position: absolute;\n    margin-left: 155px;\n    margin-top: -25px;\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/TargetPerspectiveEditorView.html",
    "content": "<div>\n    <div data-field=\"perspectiveSelectorDiv\">\n    </div>\n    <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\" class=\"uf-tpe-help-icon\"><span data-field=\"perspectiveSelectorHelp\" class=\"fa fa-info-circle\"></span></a>\n    <div data-field=\"groupSelectorDiv\">\n        <div class=\"btn-group bootstrap-select\" style=\"width: 150px;\">\n            <button class=\"btn btn-default dropdown-toggle uf-tpe-selector-button\" type=\"button\" data-toggle=\"dropdown\">\n                <span data-field=\"navGroupSelection\" class=\"filter-option pull-left\"></span>&nbsp;<span class=\"bs-caret\"><span class=\"caret\"></span></span>\n            </button>\n            <ul data-field=\"navGroupItems\" class=\"dropdown-menu uf-tpe-selector-menu\" role=\"menu\">\n            </ul>\n        </div>\n    </div>\n    <a href=\"#\" data-toggle=\"tooltip\" data-delay=\"0\" class=\"uf-tpe-help-icon\"><span data-field=\"navGroupSelectorHelp\" class=\"fa fa-info-circle\"></span></a>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/java/org/dashbuilder/client/navigation/widget/editor/TargetPerspectiveEditorView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LIElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class TargetPerspectiveEditorView implements TargetPerspectiveEditor.View, IsElement {\n\n    @Inject\n    @DataField\n    Div perspectiveSelectorDiv;\n\n    @Inject\n    @DataField\n    Div groupSelectorDiv;\n\n    @Inject\n    @DataField\n    Span navGroupSelection;\n\n    @Inject\n    @DataField\n    UnorderedList navGroupItems;\n\n    @Inject\n    @DataField\n    Span perspectiveSelectorHelp;\n\n    @Inject\n    @DataField\n    Span navGroupSelectorHelp;\n\n    TargetPerspectiveEditor presenter;\n\n    @Override\n    public void init(TargetPerspectiveEditor presenter) {\n        this.presenter = presenter;\n        this.perspectiveSelectorHelp.setTitle(NavigationConstants.INSTANCE.navItemEditorPerspectiveHelp());\n        this.navGroupSelectorHelp.setTitle(NavigationConstants.INSTANCE.navItemEditorGroupHelp());\n    }\n\n    @Override\n    public void setPerspectiveSelector(IsWidget perspectiveDropDown) {\n        perspectiveDropDown.asWidget().getElement().getStyle().setWidth(150, Style.Unit.PX);\n        DOMUtil.removeAllChildren(perspectiveSelectorDiv);\n        DOMUtil.appendWidgetToElement(perspectiveSelectorDiv, perspectiveDropDown);\n    }\n\n    @Override\n    public void clearNavGroupItems() {\n        DOMUtil.removeAllChildren(navGroupItems);\n        navGroupSelection.setTextContent(NavigationConstants.INSTANCE.navGroupSelectorHint());\n    }\n\n    @Override\n    public void setNavGroupEnabled(boolean enabled) {\n        if (enabled) {\n            groupSelectorDiv.getStyle().removeProperty(\"display\");\n            navGroupSelectorHelp.getStyle().removeProperty(\"display\");\n        } else {\n            groupSelectorDiv.getStyle().setProperty(\"display\", \"none\");\n            navGroupSelectorHelp.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @Override\n    public void addNavGroupItem(String name, Command onSelect) {\n        addItem(navGroupItems, name, false, onSelect);\n    }\n\n    @Override\n    public void setNavGroupSelection(String name, Command onReset) {\n        navGroupSelection.setTextContent(name);\n        navGroupSelection.setTitle(name);\n        addItem(navGroupItems, name, true, onReset);\n    }\n\n    private void addItem(UnorderedList unorderedList, String name, boolean selected, Command onSelect) {\n        AnchorElement anchor = Document.get().createAnchorElement();\n        anchor.setInnerText(name);\n\n        LIElement li = Document.get().createLIElement();\n        li.getStyle().setCursor(Style.Cursor.POINTER);\n        li.appendChild(anchor);\n        li.setClassName(selected ? \"selected\" : \"\");\n        unorderedList.appendChild((Node) li);\n\n        Event.sinkEvents(anchor, Event.ONCLICK);\n        Event.setEventListener(anchor, event -> {\n            if(Event.ONCLICK == event.getTypeInt()) {\n                onSelect.execute();\n            }\n        });\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/NavigationClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.dashbuilder.NavigationAPI\"/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nnewItem=+ New {0}\ngotoItem=Goto {0}\nitemMenuTitle=Show menu\nnewItemName=- New {0} -\neditItem=Edit\ndeleteItem=Delete\npageIconTitle=A user created page\nperspectiveIconTitle=A hard-coded static perspective\nmoveUp=Move up\nmoveDown=Move down\nmoveFirst=Move first\nmoveLast=Move last\nsaveChanges=Save changes?\nsave=Save\ncancel=Cancel\nnavGroupNotFound=The navigation group configured might have been deleted or does not exit. Please, check the configuration of this component.\nnavItemsEmpty=No items found\nnavMenubarDragComponent=Menu Bar\nnavTabListDragComponent=Tab List\nnavTreeDragComponent=Tree\nnavTilesDragComponent=Tile Navigator\nnavCarouselDragComponent=Carousel\nnavMenubarDragComponentNavGroupHelp=The menu bar will display items from the navigation group you select.\nnavTabListDragComponentNavGroupHelp=The navigation group you select is used to retrieve a list of pages, which are displayed in the form of tabs - one page per tab.\nnavTreeDragComponentNavGroupHelp=The tree component will display iems from the navigation group you select.\nnavTilesDragComponentNavGroupHelp=The tile navigator will display items from the navigation group you select. Groups are displayed as folders whereas single items show its content once clicked.\nnavCarouselDragComponentNavGroupHelp=The navigation group you select is used to retrieve a list of pages, which are displayed as an slideshow carousel - one page per slide.\nnavGroupEmptyError=Please, make sure the group configured is not empty.\nnavCarouselDragComponentEmptyError=Please, make sure the group configured contains at least one user created page.\nnavTilesDragComponentInfiniteRecursion=The content is not displayed to avoid an infinite loop. In general the pages in the navigation group you selected for this component must not contain navigation components which refer (directly nor indirectly) to the pages in that same group. Please double check the configuration of both the navigation tree and the navigation components. Reason:\nnavCarouselDragComponentInfiniteRecursion=This carousel slide is not displayed to avoid an infinite loop. In general the pages in the navigation group you selected for this component must not contain navigation components which refer (directly nor indirectly) to the pages in that same group. Please double check the configuration of both the navigation tree and the navigation components. Reason:\ntargetDivIdPerspectiveInfiniteRecursion=The content is not displayed to avoid an infinite loop. In general a page must not contain references (directly nor indirectly) to itself. Please double check the configuration of both the navigation tree and the navigation components. Reason:\nnavWidgetTargetDivMissing=The target div is either not found or not defined. Please, review the component''s configuration.\nopenNavItem=Open {0}\ngotoNavItem=Go to {0}\nshowNavItem=Show {0}\nnavConfigHeader=Navigation component configuration\nnavGroupLabel=Navigation group\nnavGroupHelp=The navigation component will display items from the selected group.\nnavGroupSelectorHint=-Select group -\ndefaultItemLabel=Default item\ndefaultItemHelp=The item (e.g. a page) the navigation component displays by default. If nothing selected then the first item is taken.\ndefaultItemSelectorHint=-Select default item -\ndefaultItemsNotFound=The selected group has no items\ntargetDivLabel=Target div\ntargetDivHelp=Every time a navigation item is clicked, the content of its associated page is displayed in the target div component you select.\ntargetDivSelectorHint=-Select target div -\ntargetDivsNotFound=No target divs defined\nnavItemEditorPerspectiveHelp=The page to display when this navigation item is clicked from any navigation component: menu bar, tile navigator, tab list, tree, ...\nnavItemEditorGroupHelp=The navigation group to be used by the target page''s navigation components. This setting only makes sense when the page selected above contains navigation components.\nnavRefPerspective=The page {0}\nnavRefPerspectiveDefault=The item points to the page {0}.\nnavRefPerspectiveFound=The item points to the page {0}.\nnavRefPerspectiveInGroup=The group contains at least one item linked to the page {0}.\nnavRefComponent=contains a {0}\nnavRefGroupDefined=displaying items from group {0}.\nnavRefGroupContext=receiving the {0} navigation group.\nnavRefDefaultItemDefined=The default item defined is {0}.\nnavRefDefaultItemFound=The first available item found is {0}.\nnavRefPerspectiveRecursionEnd=which would cause an infinite loop\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_de.properties",
    "content": "# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveUp=Nach oben\n# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveDown=Nach unten\nsave=Speichern\ncancel=Abbrechen\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nnewItem=+ Nuevo {0}\ngotoItem=Ir a {0}\nitemMenuTitle=Mostrar menú\nnewItemName=- Nuevo {0} -\neditItem=Editar\ndeleteItem=Eliminar\npageIconTitle=Una página creada por el usuario\nperspectiveIconTitle=Una perspectiva estática preprogramada\nmoveUp=Mover hacia arriba\nmoveDown=Mover hacia abajo\nmoveFirst=Mover al principio\nmoveLast=Mover al final\nsaveChanges=¿Guardar los cambios?\nsave=Guardar\ncancel=Cancelar\nnavGroupNotFound=Es posible que el grupo de navegación configurado se haya eliminado o no exista. Compruebe la configuración de este componente.\nnavItemsEmpty=No se encuentran ítems\nnavMenubarDragComponent=Barra de menú\nnavTabListDragComponent=Lista de pestañas\nnavTreeDragComponent=Árbol\nnavTilesDragComponent=Navegador de fichas\nnavCarouselDragComponent=Carrusel\nnavMenubarDragComponentNavGroupHelp=La barra de menú mostrará los ítems del grupo de navegación que seleccione.\nnavTabListDragComponentNavGroupHelp=El grupo de navegación que seleccione se usa para recuperar una lista de páginas, que se muestran en pestañas; una página por pestaña.\nnavTreeDragComponentNavGroupHelp=El componente de árbol mostrará artículos del grupo de navegación que seleccione.\nnavTilesDragComponentNavGroupHelp=El navegador de fichas mostrará ítems del grupo de navegación que seleccione. Los grupos se muestran como carpetas, mientras que los ítems individuales muestran su contenido una vez que se hace clic en ellos.\nnavCarouselDragComponentNavGroupHelp=El grupo de navegación que seleccione se usa para recuperar una lista de páginas, que se muestran como un carrusel de diapositivas; una página por diapositiva.\nnavGroupEmptyError=Asegúrese de que el grupo configurado no esté vacío.\nnavCarouselDragComponentEmptyError=Asegúrese de que el grupo configurado contenga al menos una página creada por el usuario.\nnavTilesDragComponentInfiniteRecursion=El contenido no se muestra para evitar un bucle infinito. Por lo general, las páginas del grupo de navegación que ha seleccionado para este componente no deben contener componentes de navegación que se refieran (directa o indirectamente) a las páginas de ese mismo grupo. Compruebe la configuración del árbol de navegación y de los componentes de navegación. Motivo:\nnavCarouselDragComponentInfiniteRecursion=Esta diapositiva de carrusel no se muestra para evitar un bucle infinito. Por lo general, las páginas del grupo de navegación que ha seleccionado para este componente no deben contener componentes de navegación que se refieran (directa o indirectamente) a las páginas de ese mismo grupo. Compruebe la configuración del árbol de navegación y de los componentes de navegación. Motivo:\ntargetDivIdPerspectiveInfiniteRecursion=El contenido no se muestra para evitar un bucle infinito. En general, una página no debe contener referencias (directas o indirectas) a sí misma. Compruebe la configuración del árbol de navegación y de los componentes de navegación. Motivo:\nnavWidgetTargetDivMissing=El div objetivo no se encuentra o no está definido. Revise la configuración del componente.\nopenNavItem=Abrir {0}\ngotoNavItem=Ir a {0}\nshowNavItem=Mostrar {0}\nnavConfigHeader=Configuración del componente de navegación\nnavGroupLabel=Grupo de navegación\nnavGroupHelp=El componente de navegación mostrará los ítems del grupo seleccionado.\nnavGroupSelectorHint=-Seleccionar grupo -\ndefaultItemLabel=Ítem predeterminado\ndefaultItemHelp=El ítem (p. ej., una página) que el componente de navegación muestra de forma predeterminada. Si no se selecciona nada, se usa el primer ítem.\ndefaultItemSelectorHint=-Seleccionar el ítem predeterminado -\ndefaultItemsNotFound=El grupo seleccionado no tiene ítems\ntargetDivLabel=Div objetivo\ntargetDivHelp=Cada vez que se hace clic en un ítem de navegación, el contenido de su página asociada se muestra en el componente div objetivo que seleccione.\ntargetDivSelectorHint=-Seleccionar el div objetivo -\ntargetDivsNotFound=No hay divs objetivo definidos\nnavItemEditorPerspectiveHelp=La página que se muestra cuando se hace clic en este ítem de navegación desde cualquier componente de navegación: barra de menú, navegador de fichas, lista de pestañas, árbol…\nnavItemEditorGroupHelp=El grupo de navegación que será usado por los componentes de navegación de la página de destino. Este ajuste solo tiene sentido cuando la página seleccionada anteriormente contiene componentes de navegación.\nnavRefPerspective=La página {0}\nnavRefPerspectiveDefault=El ítem apunta a la página {0}.\nnavRefPerspectiveFound=El ítem apunta a la página {0}.\nnavRefPerspectiveInGroup=El grupo contiene al menos un ítem vinculado a la página {0}.\nnavRefComponent=contiene un {0}\nnavRefGroupDefined=mostrando ítems del grupo {0}.\nnavRefGroupContext=recibiendo el grupo de navegación {0}.\nnavRefDefaultItemDefined=El ítem definido de forma predeterminada es {0}.\nnavRefDefaultItemFound=El primer ítem disponible encontrado es {0}.\nnavRefPerspectiveRecursionEnd=que causaría un bucle infinito\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nnewItem=+ Nouveau {0}\ngotoItem=Aller à {0}\nitemMenuTitle=Afficher le menu\nnewItemName=- Nouveau {0} -\neditItem=Modifier\ndeleteItem=Supprimer\npageIconTitle=Page créée par l''utilisateur\nperspectiveIconTitle=Perspective statique codée en dur\nmoveUp=Déplacer vers le haut\nmoveDown=Déplacer vers le bas\nmoveFirst=Placer en premier\nmoveLast=Placer en dernier\nsaveChanges=Enregistrer les modifications ?\nsave=Enregistrer\ncancel=Annuler\nnavGroupNotFound=Il se peut que le groupe de navigation configuré ait été supprimé ou ne se ferme pas. Veuillez vérifier la configuration de ce composant.\nnavItemsEmpty=Aucun élément trouvé\nnavMenubarDragComponent=Barre de menus\nnavTabListDragComponent=Liste des onglets\nnavTreeDragComponent=Arborescence\nnavTilesDragComponent=Navigateur de vignettes\nnavCarouselDragComponent=Carrousel\nnavMenubarDragComponentNavGroupHelp=La barre de menus affichera les éléments du groupe de navigation que vous avez sélectionnés.\nnavTabListDragComponentNavGroupHelp=Le groupe de navigation sélectionné permet de récupérer une liste de pages, qui s''affichent sous la forme d''onglets ; une page par onglet.\nnavTreeDragComponentNavGroupHelp=Le composant d''arborescence affichera les éléments du groupe de navigation que vous avez sélectionné.\nnavTilesDragComponentNavGroupHelp=Le navigateur de vignettes affichera les éléments du groupe de navigation que vous avez sélectionné. Les groupes sont affichés sous la forme de dossiers, tandis que le contenu des éléments individuels s''affiche lorsque vous cliquez dessus.\nnavCarouselDragComponentNavGroupHelp=Le groupe de navigation sélectionné permet de récupérer une liste de pages, qui s''affichent sous la forme d''un diaporama ; une page par diapositive.\nnavGroupEmptyError=Assurez-vous que le groupe configuré n''est pas vide.\nnavCarouselDragComponentEmptyError=Assurez-vous que le groupe configuré contient au moins une page créée par l''utilisateur.\nnavTilesDragComponentInfiniteRecursion=Le contenu n''est pas affiché pour éviter une boucle infinie. En règle générale, les pages du groupe de navigation que vous avez sélectionnées pour ce composant ne doivent pas contenir de composants de navigation faisant référence (directement ou indirectement) aux pages de ce même groupe. Vérifiez à nouveau la configuration de l''arborescence de navigation et des composants de navigation. Raison :\nnavCarouselDragComponentInfiniteRecursion=Cette diapositive du carrousel n''est pas affichée pour éviter une boucle infinie. En règle générale, les pages du groupe de navigation que vous avez sélectionnées pour ce composant ne doivent pas contenir de composants de navigation faisant référence (directement ou indirectement) aux pages de ce même groupe. Vérifiez à nouveau la configuration de l''arborescence de navigation et des composants de navigation. Raison :\ntargetDivIdPerspectiveInfiniteRecursion=Le contenu n''est pas affiché pour éviter une boucle infinie. En règle générale, une page ne doit pas contenir de références (directes ou indirectes) à elle-même. Vérifiez à nouveau la configuration de l''arborescence de navigation et des composants de navigation. Raison :\nnavWidgetTargetDivMissing=Le composant div cible est introuvable ou n''est pas défini. Vérifiez la configuration du composant.\nopenNavItem=Ouvrir {0}\ngotoNavItem=Aller à {0}\nshowNavItem=Afficher {0}\nnavConfigHeader=Configuration des composants de navigation\nnavGroupLabel=Groupe de navigation\nnavGroupHelp=Le composant de navigation affichera des éléments du groupe sélectionné.\nnavGroupSelectorHint=- Sélectionner un groupe -\ndefaultItemLabel=Élément par défaut\ndefaultItemHelp=Élément (une page, par exemple) que le composant de navigation affiche par défaut. Si rien n''est sélectionné, le premier élément est choisi.\ndefaultItemSelectorHint=- Sélectionner l''élément par défaut -\ndefaultItemsNotFound=Le groupe sélectionné ne comporte aucun élément\ntargetDivLabel=Div cible\ntargetDivHelp=Chaque fois que vous cliquez sur un élément de navigation, le contenu de la page qui lui est associée s''affiche dans le composant div cible sélectionné.\ntargetDivSelectorHint=- Sélectionner le composant div cible -\ntargetDivsNotFound=Aucun composant div cible défini\nnavItemEditorPerspectiveHelp=Page à afficher lorsque l''utilisateur clique sur cet élément de navigation à partir de n''importe quel composant de navigation : barre de menus, navigateur de vignettes, liste d''onglets, arborescence, ...\nnavItemEditorGroupHelp=Groupe de navigation qui doit être utilisé par les composants de navigation de la page cible. Ce paramètre n''a de sens que si la page sélectionnée ci-dessus contient des composants de navigation.\nnavRefPerspective=La page {0}\nnavRefPerspectiveDefault=L''élément pointe vers la page {0}.\nnavRefPerspectiveFound=L''élément pointe vers la page {0}.\nnavRefPerspectiveInGroup=Le groupe contient au moins un élément lié à la page {0}.\nnavRefComponent=contient un {0}\nnavRefGroupDefined=affiche des éléments du groupe {0}.\nnavRefGroupContext=reçoit le groupe de navigation {0}.\nnavRefDefaultItemDefined=L''élément défini par défaut est {0}.\nnavRefDefaultItemFound=Le premier élément disponible trouvé est {0}.\nnavRefPerspectiveRecursionEnd=ce qui provoquerait une boucle infinie\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nnewItem=+ Nuovo {0}\ngotoItem=Vai a {0}\nitemMenuTitle=Mostra menu\nnewItemName=- Nuovo {0} -\neditItem=Modifica\ndeleteItem=Elimina\npageIconTitle=Una pagina creata dall''utente\nperspectiveIconTitle=Una prospettiva statica codificata\nmoveUp=Sposta su\nmoveDown=Sposta giù\nmoveFirst=Sposta in prima posizione\nmoveLast=Sposta in ultima posizione\nsaveChanges=Salvare le modifiche?\nsave=Salva\ncancel=Annulla\nnavGroupNotFound=Il gruppo di navigazione configurato potrebbe essere stato eliminato o non esiste. Si prega di controllare la configurazione di questo componente.\nnavItemsEmpty=Nessun elemento trovato\nnavMenubarDragComponent=Barra dei menu\nnavTabListDragComponent=Elenco schede\nnavTreeDragComponent=Albero\nnavTilesDragComponent=Navigatore a riquadri\nnavCarouselDragComponent=Carosello\nnavMenubarDragComponentNavGroupHelp=La barra dei menu mostrerà gli elementi del gruppo di navigazione che selezioni.\nnavTabListDragComponentNavGroupHelp=Il gruppo di navigazione che selezioni viene utilizzato per recuperare un elenco di pagine, che vengono visualizzate sotto forma di schede - una pagina per scheda.\nnavTreeDragComponentNavGroupHelp=Il componente albero mostrerà gli elementi del gruppo di navigazione che selezioni.\nnavTilesDragComponentNavGroupHelp=Il navigatore a riquadri mostrerà gli elementi del gruppo di navigazione che selezioni. I gruppi vengono visualizzati come cartelle, mentre gli elementi singoli mostrano il loro contenuto una volta cliccati.\nnavCarouselDragComponentNavGroupHelp=Il gruppo di navigazione che selezioni viene utilizzato per recuperare un elenco di pagine, che vengono visualizzate come un carosello - una pagina per slide.\nnavGroupEmptyError,Assicurati che il gruppo configurato non sia vuoto.\nnavCarouselDragComponentEmptyError,Assicurati che il gruppo configurato contenga almeno una pagina creata dall''utente.\nnavTilesDragComponentInfiniteRecursion,Il contenuto non viene visualizzato per evitare un ciclo infinito. In generale, le pagine nel gruppo di navigazione selezionato per questo componente non devono contenere componenti di navigazione che si riferiscono (direttamente o indirettamente) alle pagine nello stesso gruppo. Si prega di controllare la configurazione sia dell''albero di navigazione che dei componenti di navigazione. Motivo:\nnavCarouselDragComponentInfiniteRecursion,Questa slide del carosello non viene visualizzata per evitare un ciclo infinito. In generale, le pagine nel gruppo di navigazione selezionato per questo componente non devono contenere componenti di navigazione che si riferiscono (direttamente o indirettamente) alle pagine nello stesso gruppo. Si prega di controllare la configurazione sia dell''albero di navigazione che dei componenti di navigazione. Motivo:\ntargetDivIdPerspectiveInfiniteRecursion,Il contenuto non viene visualizzato per evitare un ciclo infinito. In generale, una pagina non deve contenere riferimenti (diretti o indiretti) a se stessa. Si prega di controllare la configurazione sia dell''albero di navigazione che dei componenti di navigazione. Motivo:\nnavWidgetTargetDivMissing,Il div di destinazione non viene trovato o non è definito. Si prega di rivedere la configurazione del componente.\nopenNavItem=Apri {0}\ngotoNavItem=Vai a {0}\nshowNavItem=Mostra {0}\nnavConfigHeader=Configurazione del componente di navigazione\nnavGroupLabel=Gruppo di navigazione\nnavGroupHelp=Il componente di navigazione mostrerà gli elementi del gruppo selezionato.\nnavGroupSelectorHint=- Seleziona gruppo -\ndefaultItemLabel=Elemento predefinito\ndefaultItemHelp=L''elemento (ad esempio una pagina) che il componente di navigazione mostra per impostazione predefinita. Se non viene selezionato nulla, viene preso il primo elemento.\ndefaultItemSelectorHint=- Seleziona elemento predefinito -\ndefaultItemsNotFound=Il gruppo selezionato non ha elementi\ntargetDivLabel=Div di destinazione\ntargetDivHelp=Ogni volta che viene cliccato un elemento di navigazione, il contenuto della pagina associata viene visualizzato nel componente div di destinazione che selezioni.\ntargetDivSelectorHint=- Seleziona div di destinazione -\ntargetDivsNotFound=Nessun div di destinazione definito\nnavItemEditorPerspectiveHelp=La pagina da visualizzare quando viene cliccato questo elemento di navigazione da qualsiasi componente di navigazione: barra dei menu, navigatore a riquadri, elenco schede, albero, ...\nnavItemEditorGroupHelp=Il gruppo di navigazione da utilizzare dai componenti di navigazione della pagina di destinazione. Questa impostazione ha senso solo quando la pagina selezionata sopra contiene componenti di navigazione.\nnavRefPerspective=La pagina {0}\nnavRefPerspectiveDefault=L''elemento punta alla pagina {0}.\nnavRefPerspectiveFound=L''elemento punta alla pagina {0}.\nnavRefPerspectiveInGroup=Il gruppo contiene almeno un elemento collegato alla pagina {0}.\nnavRefComponent=contiene un {0}\nnavRefGroupDefined=mostrando elementi dal gruppo {0}.\nnavRefGroupContext=ricevendo il gruppo di navigazione {0}.\nnavRefDefaultItemDefined=L''elemento predefinito definito è {0}.\nnavRefDefaultItemFound=Il primo elemento disponibile trovato è {0}.\nnavRefPerspectiveRecursionEnd=che causerebbe un ciclo infinito\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nnewItem=+ 新規 {0}\ngotoItem={0} へ移動\nitemMenuTitle=メニューを表示\nnewItemName=- 新規 {0} -\neditItem=編集\ndeleteItem=削除\npageIconTitle=ユーザーが作成したページ\nperspectiveIconTitle=ハードコードの静的パースペクティブ\nmoveUp=上に移動\nmoveDown=下に移動\nmoveFirst=最初に移動\nmoveLast=最後に移動\nsaveChanges=変更を保存しますか？\nsave=保存\ncancel=キャンセル\nnavGroupNotFound=設定されたナビゲーショングループが削除された可能性があるか、終了されません。このコンポーネントの設定を確認してください。\nnavItemsEmpty=アイテムが見つかりません\nnavMenubarDragComponent=メニューバー\nnavTabListDragComponent=タブリスト\nnavTreeDragComponent=ツリー\nnavTilesDragComponent=タイルナビゲーター\nnavCarouselDragComponent=カルーセル\nnavMenubarDragComponentNavGroupHelp=メニューバーは、選択したナビゲーショングループのアイテムを表示します。\nnavTabListDragComponentNavGroupHelp=選択したナビゲーショングループは、ページ一覧の検索に使用され、タブ形式で表示されます (タブごとに 1 ページ)。\nnavTreeDragComponentNavGroupHelp=ツリーコンポーネントは、選択したナビゲーショングループのアイテムを表示します。\nnavTilesDragComponentNavGroupHelp=タイルナビゲーションは、選択したナビゲーショングループのアイテムを表示します。グループはフォルダーとして表示されますが、単一のアイテムを 1 回クリックするとそのコンテンツが表示されます。\nnavCarouselDragComponentNavGroupHelp=選択したナビゲーショングループはページの一覧の検索に使用され、スライドショーカルーセルとして表示されます (スライドごとに 1 ページ)。\nnavGroupEmptyError=設定したグループが空でないことを確認してください。\nnavCarouselDragComponentEmptyError=設定したグループに、ユーザーが作成したページが 1 つ以上含まれていることを確認します。\nnavTilesDragComponentInfiniteRecursion=無限ループを避けるためこのコンテンツは表示されません。通常は、このコンポーネントに選択したナビゲーショングループのページには、同じグループ内のページを (直接／間接的に) 参照するナビゲーションコンポーネントを含めないでください。ナビゲーションツリーとナビゲーションコンポーネントの両方の設定を再確認してください。理由:\nnavCarouselDragComponentInfiniteRecursion=無限ループを避けるためこのカルーセルスライドは表示されません。通常は、このコンポーネントに選択したナビゲーショングループのページには、同じグループ内のページを (直接／間接的に) 参照するナビゲーションコンポーネントを含めないでください。ナビゲーションツリーとナビゲーションコンポーネントの両方の設定を再確認してください。理由:\ntargetDivIdPerspectiveInfiniteRecursion=無限ループを避けるためこのコンテンツは表示されません。通常、ページには、そのページ自体への参照を (直接／間接的に) 含めることはできません。ナビゲーションツリーとナビゲーションコンポーネントの両方の設定を再確認してください。理由:\nnavWidgetTargetDivMissing=ターゲットdivが見つからないか、定義されていません。コンポーネントの設定を確認してください。\nopenNavItem=開く {0}\ngotoNavItem= {0} へ移動\nshowNavItem={0} を表示\nnavConfigHeader=ナビゲーションコンポーネントの設定\nnavGroupLabel=ナビゲーショングループ\nnavGroupHelp=ナビゲーションコンポーネントは、選択したグループのアイテムを表示します。\nnavGroupSelectorHint=- グループの選択 -\ndefaultItemLabel=デフォルトのアイテム\ndefaultItemHelp=ナビゲーションコンポーネントがデフォルトで表示するアイテム (例: ページ)。何も選択されていない場合には、最初のアイテムが取得されます。\ndefaultItemSelectorHint=- デフォルトのアイテムを選択 -\ndefaultItemsNotFound=選択したグループにはアイテムがありません\ntargetDivLabel=ターゲット div\ntargetDivHelp=ナビゲーションアイテムがクリックされると、関連付けられたページのコンテンツが、選択したターゲット div コンポーネントに表示されます。\ntargetDivSelectorHint=ターゲット div を選択\ntargetDivsNotFound=ターゲット div が定義されていません\nnavItemEditorPerspectiveHelp=ナビゲーションコンポーネントからこのナビゲーションアイテムをクリックすると表示するページ: メニューバー、タイルナビゲーター、タブリスト、ツリーなど\nnavItemEditorGroupHelp=ターゲットページのナビゲーションコンポーネントで使用されるナビゲーショングループ。この設定は、上記で選択したページにナビゲーションコンポーネントが含まれている場合にのみ意味があります。\nnavRefPerspective=ページ {0}\nnavRefPerspectiveDefault=このアイテムはページ {0} を指しています。\nnavRefPerspectiveFound=このアイテムはページ {0} を指しています。\nnavRefPerspectiveInGroup=グループには、ページ {0} にリンクしているアイテムが 1 つ以上含まれます。\nnavRefComponent={0} を含む\nnavRefGroupDefined=グループ {0} のアイテムの表示\nnavRefGroupContext={0} ナビゲーショングループの受信\nnavRefDefaultItemDefined=定義したデフォルトアイテムは {0} です。\nnavRefDefaultItemFound=見つかったアイテムで最初に利用可能なものは {0} です。\nnavRefPerspectiveRecursionEnd=無限ループを発生させるもの\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_pt_BR.properties",
    "content": "# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveUp=Mover para cima\n# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveDown=Mover para baixo\nsave=Salvar\ncancel=Cancelar\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/main/resources/org/dashbuilder/client/navigation/resources/i18n/NavigationConstants_zh_CN.properties",
    "content": "# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveUp=上移\n# translation auto-copied from project jBPM Form Modeler, version 6.0.0, document org.jbpm/jbpm-form-modeler-form-editor/org/jbpm/formModeler/components/editor/messages\nmoveDown=下移\nsave=保存\ncancel=取消\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/NavComponentConfigModalTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.dashbuilder.client.navigation.widget.NavComponentConfigModal;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NavComponentConfigModalTest {\n\n    @Mock\n    NavComponentConfigModal.View view;\n\n    @Mock\n    Command onOk;\n\n    NavTree tree;\n    NavComponentConfigModal presenter;\n\n    @Before\n    public void setUp() throws Exception {\n        tree = new NavTreeBuilder()\n                .item(\"H1\", \"H1\", null, false)\n                .divider()\n                .group(\"A\", \"A\", null, false)\n                .item(\"A1\", \"A1\", null, false)\n                .item(\"A2\", \"A2\", null, false)\n                .group(\"B\", \"B\", null, false)\n                .group(\"C\", \"C\", null, false)\n                .build();\n\n        presenter = new NavComponentConfigModal(view);\n        presenter.setOnOk(onOk);\n    }\n\n    @Test\n    public void testInitDefault() {\n        presenter.setNavGroup(tree.getRootItems(), null);\n        presenter.show();\n\n        verify(view).init(presenter);\n        verify(view).clearNavGroupItems();\n        verify(view).setNavGroupSelection(eq(\"A\"), any());\n        verify(view).addNavGroupItem(eq(\"A>B\"), any());\n        verify(view).addNavGroupItem(eq(\"A>B>C\"), any());\n        verify(view).show();\n    }\n\n    @Test\n    public void testInitSelected() {\n        presenter.setNavGroup(tree.getRootItems(), \"B\");\n        presenter.show();\n\n        verify(view).init(presenter);\n        verify(view).clearNavGroupItems();\n        verify(view).setNavGroupSelection(eq(\"A>B\"), any());\n        verify(view).addNavGroupItem(eq(\"A\"), any());\n        verify(view).addNavGroupItem(eq(\"A>B>C\"), any());\n        verify(view).show();\n    }\n\n    @Test\n    public void testSelectItem() {\n        presenter.setNavGroup(tree.getRootItems(), \"A\");\n        presenter.show();\n\n        reset(view);\n        presenter.onGroupSelected(\"B\");\n\n        assertEquals(presenter.getGroupId(), \"B\");\n        verify(view).clearNavGroupItems();\n        verify(view).setNavGroupSelection(eq(\"A>B\"), any());\n        verify(view).addNavGroupItem(eq(\"A\"), any());\n        verify(view).addNavGroupItem(eq(\"A>B>C\"), any());\n    }\n\n    @Test\n    public void testDefaultItemsPerGroup() {\n        presenter.setNavGroup(tree.getRootItems(), \"A\");\n        presenter.show();\n\n        verify(view).setDefaultNavItemEnabled(true);\n        verify(view).clearDefaultItems();\n        verify(view).addDefaultItem(eq(\"A>A1\"), any());\n        verify(view).addDefaultItem(eq(\"A>A2\"), any());\n        verify(view, never()).addDefaultItem(eq(\"A>B\"), any());\n        verify(view, never()).addDefaultItem(eq(\"C\"), any());\n\n        reset(view);\n        presenter.onGroupSelected(\"C\");\n        verify(view).setDefaultNavItemEnabled(true);\n        verify(view).clearDefaultItems();\n        verify(view, never()).addDefaultItem(anyString(), any());\n    }\n\n    @Test\n    public void testTargetDivList() {\n        List<String> targetDivIdList = Arrays.asList(\"div1\", \"div2\");\n        presenter.setTargetDivIdList(targetDivIdList);\n        presenter.show();\n\n        verify(view).clearTargetDivItems();\n        verify(view).setTargetDivSelection(eq(\"div1\"), any());\n        verify(view).addTargetDivItem(eq(\"div2\"), any());\n        assertEquals(presenter.getTargetDivId(), \"div1\");\n\n        reset(view);\n        presenter.setTargetDiv(\"t\");\n        presenter.show();\n        verify(view).clearTargetDivItems();\n        verify(view).setTargetDivSelection(eq(\"div1\"), any());\n        verify(view).addTargetDivItem(eq(\"div2\"), any());\n        assertEquals(presenter.getTargetDivId(), \"div1\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/plugin/PerspectivePluginManagerImplTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.plugin;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.dashbuilder.navigation.workbench.NavWorkbenchCtx.perspective;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyObject;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.navigation.event.PerspectivePluginsChangedEvent;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.service.PerspectivePluginServices;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.workbench.type.ClientTypeRegistry;\nimport org.uberfire.ext.plugin.client.type.PerspectiveLayoutPluginResourceType;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.category.Others;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectivePluginManagerImplTest {\n\n    private static final String PERSPECTIVE_ID = \"Persp1\";\n    private static final NavTree TEST_NAV_TREE = new NavTreeBuilder()\n            .item(PERSPECTIVE_ID, \"name1\", \"description1\", true, perspective(PERSPECTIVE_ID))\n            .build();\n    @Mock\n    private NavigationManager navigationManager;\n\n    @Mock\n    private ClientTypeRegistry clientTypeRegistry;\n\n    @Mock\n    private PerspectivePluginServices pluginServices;\n\n    @Mock\n    private Event<PerspectivePluginsChangedEvent> perspectiveChangedEvent;\n\n    private PluginAdded pluginAddedEvent;\n    private PluginSaved pluginSavedEvent;\n    private PluginRenamed pluginRenamedEvent;\n    private PluginDeleted pluginDeletedEvent;\n    private Plugin perspectivePlugin;\n    private Plugin perspectiveRenamedPlugin;\n    private PerspectivePluginManagerImpl testedPluginManager;\n\n    @Before\n    public void setUp() {\n        when(clientTypeRegistry.resolve(any())).thenReturn(new PerspectiveLayoutPluginResourceType(new Others()));\n\n        perspectivePlugin = new Plugin(PERSPECTIVE_ID, PluginType.PERSPECTIVE_LAYOUT, null);\n        perspectiveRenamedPlugin = new Plugin(\"newName\", PluginType.PERSPECTIVE_LAYOUT, null);\n\n        pluginAddedEvent = new PluginAdded(perspectivePlugin, null);\n        pluginSavedEvent = new PluginSaved(perspectivePlugin, null);\n        pluginRenamedEvent = new PluginRenamed(PERSPECTIVE_ID, perspectiveRenamedPlugin, null);\n        pluginDeletedEvent = new PluginDeleted(perspectivePlugin, null);\n\n        when(pluginServices.listPlugins()).thenReturn(Collections.emptyList());\n\n        testedPluginManager = new PerspectivePluginManagerImpl(clientTypeRegistry, null, navigationManager, new CallerMock<>(pluginServices), perspectiveChangedEvent);\n        testedPluginManager.getPerspectivePlugins(plugins -> {});\n    }\n\n    @Test\n    public void testPluginAdded() {\n        testedPluginManager.getPerspectivePlugins(plugins -> assertThat(plugins).isEmpty());\n\n        testedPluginManager.onPlugInAdded(pluginAddedEvent);\n        verify(perspectiveChangedEvent).fire(anyObject());\n\n        testedPluginManager.getPerspectivePlugins(plugins -> assertThat(plugins).hasSize(1));\n    }\n\n    @Test\n    public void testPluginSaved() {\n        assertThat(testedPluginManager.existsPerspectivePlugin(PERSPECTIVE_ID)).isFalse();\n\n        testedPluginManager.onPlugInSaved(pluginSavedEvent);\n        verify(perspectiveChangedEvent, times(1)).fire(anyObject());\n\n        assertThat(testedPluginManager.existsPerspectivePlugin(PERSPECTIVE_ID)).isTrue();\n    }\n\n    @Test\n    public void testPluginRenamed() {\n        NavTree tree = TEST_NAV_TREE.cloneTree();\n        List<NavItem> items = tree.searchItems(NavWorkbenchCtx.perspective(PERSPECTIVE_ID));\n\n        assertThat((items).get(0).getName()).isEqualTo(\"name1\");\n        assertThat((items).get(0).getContext()).contains(\"resourceId=\" + PERSPECTIVE_ID);\n\n        when(navigationManager.getNavTree()).thenReturn(tree);\n        testedPluginManager.onPlugInRenamed(pluginRenamedEvent);\n\n        assertThat(tree.searchItems(NavWorkbenchCtx.perspective(PERSPECTIVE_ID))).isEmpty();\n        assertThat(tree.searchItems(NavWorkbenchCtx.perspective(perspectiveRenamedPlugin.getName())).get(0).getContext()).contains(\"resourceId=\" + perspectiveRenamedPlugin.getName());\n\n        ArgumentCaptor<Command> argumentCaptor = ArgumentCaptor.forClass(Command.class);\n\n        verify(navigationManager, times(1)).saveNavTree(anyObject(), argumentCaptor.capture());\n        verify(perspectiveChangedEvent).fire(anyObject());\n    }\n\n    @Test\n    public void testPluginDeleted() {\n        NavTree testTree = TEST_NAV_TREE.cloneTree();\n\n        assertThat(testTree.getItemById(PERSPECTIVE_ID)).isNotNull();\n\n        when(navigationManager.getNavTree()).thenReturn(testTree);\n        testedPluginManager.onPlugInDeleted(pluginDeletedEvent);\n\n        assertThat(testTree.getItemById(PERSPECTIVE_ID)).isNull();\n        verify(navigationManager).saveNavTree(anyObject(), eq(null));\n        verify(perspectiveChangedEvent).fire(anyObject());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/NavMenuBarWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NavMenuBarWidgetTest {\n\n    @Mock\n    NavMenuBarWidget.View view;\n\n    @Mock\n    NavDropDownWidget.View viewAdmin;\n\n    @Mock\n    NavDropDownWidget.View viewDashboards;\n\n    @Mock\n    SyncBeanDef<NavDropDownWidget> dropDownBean;\n\n    @Mock\n    PerspectivePluginManager pluginManager;\n\n    @Mock\n    NavigationManager navigationManager;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PlaceManager placeManager;\n\n    NavDropDownWidget dropDownAdmin;\n    NavDropDownWidget dropDownDashboards;\n    NavMenuBarWidget presenter;\n    NavTree tree;\n\n    public static final String ITEM_ID_HOME = \"home\";\n    public static final String ITEM_ID_GALLERY = \"gallery\";\n    public static final String ITEM_ID_ADMIN = \"admin\";\n    public static final String ITEM_ID_DATASETS = \"datasets\";\n    public static final String ITEM_ID_CONTENTMGMT = \"contentmgmt\";\n    public static final String ITEM_ID_DASHBOARDS = \"dashboards\";\n    public static final String ITEM_ID_DASHBOARD1 = \"dashboard1\";\n    public static final String ITEM_ID_DASHBOARD2 = \"dashboard2\";\n\n    @Before\n    public void setUp() throws Exception {\n        dropDownAdmin = new NavDropDownWidget(viewAdmin, beanManager, navigationManager);\n        dropDownDashboards = new NavDropDownWidget(viewDashboards, beanManager, navigationManager);\n        presenter = new NavMenuBarWidget(view, beanManager, pluginManager, placeManager, navigationManager);\n\n        tree = new NavTreeBuilder()\n                .item(ITEM_ID_HOME, \"Home\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_HOME))\n                .item(ITEM_ID_GALLERY, \"Gallery\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_GALLERY))\n                .group(ITEM_ID_ADMIN, \"Administration\", null, false)\n                    .item(ITEM_ID_DATASETS, \"Datasets\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DATASETS))\n                    .item(ITEM_ID_CONTENTMGMT, \"Content Manager\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_CONTENTMGMT))\n                    .endGroup()\n                .group(ITEM_ID_DASHBOARDS, \"Dashboards\", null, false)\n                    .item(ITEM_ID_DASHBOARD1, \"Dashboard 1\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DASHBOARD1))\n                    .item(ITEM_ID_DASHBOARD2, \"Dashboard 2\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DASHBOARD2))\n                    .endGroup()\n                .build();\n\n        when(beanManager.lookupBean(NavDropDownWidget.class)).thenReturn(dropDownBean);\n        when(dropDownBean.newInstance()).thenReturn(dropDownAdmin, dropDownDashboards);\n    }\n\n    @Test\n    public void testShowMenuBar() {\n        presenter.show(tree);\n\n        verify(view).init(presenter);\n\n        verify(view, never()).setSelectedItem(anyString());\n        verify(view).addItem(eq(ITEM_ID_HOME), anyString(), any(), any());\n        verify(view).addItem(eq(ITEM_ID_GALLERY), anyString(), any(), any());\n        verify(view).addGroupItem(eq(ITEM_ID_ADMIN), anyString(), any(), eq(dropDownAdmin));\n        verify(view).addGroupItem(eq(ITEM_ID_DASHBOARDS), anyString(), any(), eq(dropDownDashboards));\n\n        verify(viewAdmin).setDropDownName(\"Administration\");\n        verify(viewAdmin, never()).setActive(true);\n        verify(viewAdmin).addItem(eq(ITEM_ID_DATASETS), anyString(), any(), any());\n        verify(viewAdmin).addItem(eq(ITEM_ID_CONTENTMGMT), anyString(), any(), any());\n\n        verify(viewDashboards).setDropDownName(\"Dashboards\");\n        verify(viewDashboards, never()).setActive(true);\n        verify(viewDashboards).addItem(eq(ITEM_ID_DASHBOARD1), anyString(), any(), any());\n        verify(viewDashboards).addItem(eq(ITEM_ID_DASHBOARD2), anyString(), any(), any());\n    }\n\n    @Test\n    public void testSelectRootItem() {\n        presenter.show(tree);\n        reset(view, viewAdmin, viewDashboards);\n\n        presenter.setSelectedItem(ITEM_ID_HOME);\n\n        verify(view).setSelectedItem(ITEM_ID_HOME);\n        verify(viewAdmin, never()).setActive(true);\n        verify(viewDashboards, never()).setActive(true);\n    }\n\n    @Test\n    public void testSelectNestedItem() {\n        presenter.show(tree);\n        reset(view, viewAdmin, viewDashboards);\n\n        presenter.setSelectedItem(ITEM_ID_CONTENTMGMT);\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_CONTENTMGMT));\n        assertEquals(dropDownAdmin.getItemSelected(), tree.getItemById(ITEM_ID_CONTENTMGMT));\n        assertNull(dropDownDashboards.getItemSelected());\n\n        verify(view).clearSelectedItem();\n        verify(viewAdmin).setActive(true);\n        verify(viewAdmin).setSelectedItem(ITEM_ID_CONTENTMGMT);\n        verify(viewDashboards, never()).setActive(true);\n    }\n\n    @Test\n    public void testSwitchFromNestedToRoot() {\n        presenter.show(tree);\n        presenter.setSelectedItem(ITEM_ID_CONTENTMGMT);\n        reset(view, viewAdmin, viewDashboards);\n\n        presenter.onItemClicked(tree.getItemById(ITEM_ID_HOME));\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_HOME));\n        assertNull(dropDownAdmin.getItemSelected());\n        assertNull(dropDownDashboards.getItemSelected());\n\n        verify(view).clearSelectedItem();\n        verify(view).setSelectedItem(ITEM_ID_HOME);\n        verify(viewAdmin).setActive(false);\n        verify(viewDashboards, never()).setActive(true);\n    }\n\n    @Test\n    public void testNullNavGroup() {\n        presenter.show((NavGroup) null);\n        verify(view).errorNavGroupNotFound();\n    }\n\n    @Test\n    public void testNullNavTree() {\n        presenter.show((NavTree) null);\n        verify(view).errorNavItemsEmpty();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/NavTabListWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NavTabListWidgetTest {\n\n    @Mock\n    NavTabListWidget.View view;\n\n    @Mock\n    NavTabListWidget.View viewAdmin;\n\n    @Mock\n    NavTabListWidget.View viewDashboards;\n\n    @Mock\n    SyncBeanDef<NavTabListWidget> tablistBean;\n\n    @Mock\n    PerspectivePluginManager pluginManager;\n\n    @Mock\n    NavigationManager navigationManager;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PlaceManager placeManager;\n\n    NavTabListWidget tabsAdmin;\n    NavTabListWidget tabsDashboards;\n    NavTabListWidget presenter;\n    NavTree tree;\n\n    public static final String ITEM_ID_HOME = \"home\";\n    public static final String ITEM_ID_GALLERY = \"gallery\";\n    public static final String ITEM_ID_ADMIN = \"admin\";\n    public static final String ITEM_ID_DATASETS = \"datasets\";\n    public static final String ITEM_ID_CONTENTMGMT = \"contentmgmt\";\n    public static final String ITEM_ID_DASHBOARDS = \"dashboards\";\n    public static final String ITEM_ID_DASHBOARD1 = \"dashboard1\";\n    public static final String ITEM_ID_DASHBOARD2 = \"dashboard2\";\n\n    @Before\n    public void setUp() throws Exception {\n        tabsAdmin = new NavTabListWidget(viewAdmin, beanManager, pluginManager, placeManager, navigationManager);\n        tabsDashboards = new NavTabListWidget(viewDashboards, beanManager, pluginManager, placeManager, navigationManager);\n        presenter = new NavTabListWidget(view, beanManager, pluginManager, placeManager, navigationManager);\n        presenter.setGotoItemEnabled(true);\n\n        tree = new NavTreeBuilder()\n                .item(ITEM_ID_HOME, \"Home\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_HOME))\n                .item(ITEM_ID_GALLERY, \"Gallery\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_GALLERY))\n                .group(ITEM_ID_ADMIN, \"Administration\", null, false)\n                    .item(ITEM_ID_DATASETS, \"Datasets\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DATASETS))\n                    .item(ITEM_ID_CONTENTMGMT, \"Content Manager\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_CONTENTMGMT))\n                    .endGroup()\n                .group(ITEM_ID_DASHBOARDS, \"Dashboards\", null, false)\n                    .item(ITEM_ID_DASHBOARD1, \"Dashboard 1\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DASHBOARD1))\n                    .item(ITEM_ID_DASHBOARD2, \"Dashboard 2\", null, false, NavWorkbenchCtx.perspective(ITEM_ID_DASHBOARD2))\n                    .endGroup()\n                .build();\n\n        when(beanManager.lookupBean(NavTabListWidget.class)).thenReturn(tablistBean);\n        when(tablistBean.newInstance()).thenReturn(tabsAdmin, tabsDashboards);\n        when(pluginManager.isRuntimePerspective(any(NavItem.class))).thenReturn(true);\n    }\n\n    @Test\n    public void testShow() {\n        presenter.show(tree);\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_HOME));\n\n        verify(view).init(presenter);\n        verify(view).addItem(eq(ITEM_ID_HOME), anyString(), any(), any());\n        verify(view).addItem(eq(ITEM_ID_GALLERY), anyString(), any(), any());\n        verify(view).addGroupItem(eq(ITEM_ID_ADMIN), anyString(), any(), eq(tabsAdmin));\n        verify(view).addGroupItem(eq(ITEM_ID_DASHBOARDS), anyString(), any(), eq(tabsDashboards));\n        verify(view).setSelectedItem(ITEM_ID_HOME);\n\n        verify(viewAdmin).showAsSubmenu(true);\n        verify(viewAdmin, never()).showChildrenTabs(any());\n        verify(viewAdmin).addItem(eq(ITEM_ID_DATASETS), anyString(), any(), any());\n        verify(viewAdmin).addItem(eq(ITEM_ID_CONTENTMGMT), anyString(), any(), any());\n\n        verify(viewDashboards).showAsSubmenu(true);\n        verify(viewDashboards, never()).showChildrenTabs(any());\n        verify(viewDashboards).addItem(eq(ITEM_ID_DASHBOARD1), anyString(), any(), any());\n        verify(viewDashboards).addItem(eq(ITEM_ID_DASHBOARD2), anyString(), any(), any());\n    }\n\n    @Test\n    public void testDefaultNestedItem() {\n        presenter.setDefaultNavItemId(ITEM_ID_DASHBOARD2);\n        presenter.show(tree);\n\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_DASHBOARD2));\n        assertEquals(tabsDashboards.getItemSelected(), tree.getItemById(ITEM_ID_DASHBOARD2));\n        assertNull(tabsAdmin.getItemSelected());\n\n        verify(view, atLeastOnce()).clearSelectedItem();\n        verify(view, atLeastOnce()).setSelectedItem(ITEM_ID_DASHBOARDS);\n        verify(view).showChildrenTabs(tabsDashboards);\n        verify(viewDashboards).setSelectedItem(ITEM_ID_DASHBOARD2);\n        verify(viewAdmin, never()).showChildrenTabs(any());\n    }\n\n\n    @Test\n    public void testSelectNestedItem() {\n        presenter.show(tree);\n        reset(view, viewAdmin, viewDashboards);\n\n        presenter.setSelectedItem(ITEM_ID_CONTENTMGMT);\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_CONTENTMGMT));\n        assertEquals(tabsAdmin.getItemSelected(), tree.getItemById(ITEM_ID_CONTENTMGMT));\n        assertNull(tabsDashboards.getItemSelected());\n\n        verify(view).clearSelectedItem();\n        verify(view).showChildrenTabs(any());\n        verify(viewAdmin).setSelectedItem(ITEM_ID_CONTENTMGMT);\n        verify(viewDashboards, never()).showChildrenTabs(any());\n    }\n\n    @Test\n    public void testSwitchFromNestedToRoot() {\n        presenter.show(tree);\n        presenter.setSelectedItem(ITEM_ID_CONTENTMGMT);\n        reset(view, viewAdmin, viewDashboards);\n\n        presenter.onItemClicked(tree.getItemById(ITEM_ID_HOME));\n        assertEquals(presenter.getItemSelected(), tree.getItemById(ITEM_ID_HOME));\n        assertNull(tabsAdmin.getItemSelected());\n        assertNull(tabsDashboards.getItemSelected());\n\n        verify(view).clearSelectedItem();\n        verify(view).setSelectedItem(ITEM_ID_HOME);\n        verify(view, never()).showChildrenTabs(any());\n        verify(viewAdmin, never()).showChildrenTabs(any());\n        verify(viewDashboards, never()).showChildrenTabs(any());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/NavTilesWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget;\n\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NavTilesWidgetTest {\n\n    @Mock\n    NavTilesWidget.View view;\n\n    @Mock\n    PerspectivePluginManager pluginManager;\n\n    @Mock\n    NavigationManager navigationManager;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PlaceManager placeManager;\n\n    @Mock\n    SyncBeanDef<NavItemTileWidget> tileWidgetBeanDef;\n\n    @Mock\n    NavItemTileWidget tileWidget;\n\n    NavTilesWidget presenter;\n    NavTree tree;\n\n    @Before\n    public void setUp() throws Exception {\n        when(beanManager.lookupBean(NavItemTileWidget.class)).thenReturn(tileWidgetBeanDef);\n        when(tileWidgetBeanDef.getInstance()).thenReturn(tileWidget);\n        presenter = new NavTilesWidget(view, navigationManager, pluginManager, placeManager, beanManager);\n\n        tree = new NavTreeBuilder()\n                .group(\"Home\", \"Home\", null, false)\n                .group(\"A\", \"A\", null, false)\n                .item(\"A1\", \"A1\", null, false)\n                .item(\"A2\", \"A2\", null, false)\n                .group(\"A3\", \"A3\", null, false)\n                .item(\"A31\", \"A3\", null, false)\n                .build();\n    }\n\n    @Test\n    public void testOpenItem() {\n        NavItem navItem = tree.getItemById(\"A\");\n        presenter.openItem(navItem);\n        assertEquals(presenter.getNavItemStack().size(), 2);\n\n        verify(view, times(3)).addTileWidget(tileWidget);\n        verify(view).clearBreadcrumb();\n        verify(view).addBreadcrumbItem(eq(\"Home\"), any());\n        verify(view).addBreadcrumbItem(eq(\"A\"));\n\n        reset(view);\n        navItem = tree.getItemById(\"A3\");\n        presenter.openItem(navItem);\n        assertEquals(presenter.getNavItemStack().size(), 3);\n\n        verify(view, times(1)).addTileWidget(tileWidget);\n        verify(view).clearBreadcrumb();\n        verify(view).addBreadcrumbItem(eq(\"Home\"), any());\n        verify(view).addBreadcrumbItem(eq(\"A\"), any());\n        verify(view).addBreadcrumbItem(eq(\"A3\"));\n    }\n\n    @Test\n    public void testGotoHome() {\n        NavItem navItem = tree.getItemById(\"A\");\n        presenter.openItem(navItem);\n        reset(view);\n\n        NavItem homeItem = tree.getItemById(\"Home\");\n        presenter.gotoBreadcrumbItem(homeItem);\n        assertEquals(presenter.getNavItemStack().size(), 0);\n\n        verify(view, times(1)).addTileWidget(tileWidget);\n        verify(view).clearBreadcrumb();\n        verify(view, never()).addBreadcrumbItem(any(), any());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/editor/NavItemEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NavItemEditorTest {\n\n    @Mock\n    NavItemDefaultEditorView view;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PerspectiveTreeProvider perspectiveTreeProvider;\n\n    @Mock\n    EventSourceMock<NavItemEditStartedEvent> navItemEditStartedEvent;\n\n    @Mock\n    EventSourceMock<NavItemEditCancelledEvent> navItemEditCancelledEvent;\n\n    @Mock\n    PlaceManager placeManager;\n\n    @Mock\n    TargetPerspectiveEditor targetPerspectiveEditor;\n\n    @Mock\n    PerspectivePluginManager perspectivePluginManager;\n\n    @Mock\n    Command updateCommand;\n\n    NavItemEditor presenter;\n    static final String NEW_PERSPECTIVE_NAME = \"- New Perspective -\";\n\n    @Before\n    public void setUp() throws Exception {\n        presenter = new NavItemDefaultEditor(view, beanManager,\n                placeManager, perspectiveTreeProvider, targetPerspectiveEditor,\n                perspectivePluginManager, navItemEditStartedEvent, navItemEditCancelledEvent);\n\n        when(view.i18nNewItemName(\"Perspective\")).thenReturn(NEW_PERSPECTIVE_NAME);\n        presenter.getSettings().setLiteralPerspective(\"Perspective\");\n\n        doAnswer(invocationOnMock -> invocationOnMock.getArguments()[0])\n                .when(targetPerspectiveEditor).getPerspectiveName(anyString());\n    }\n\n    @Test\n    public void testChangeGroup() {\n        NavGroup navGroup = NavFactory.get().createNavGroup();\n        navGroup.setId(\"id\");\n        navGroup.setName(\"name\");\n        navGroup.setDescription(\"description\");\n        navGroup.setModifiable(true);\n        presenter.setOnUpdateCommand(updateCommand);\n        presenter.edit(navGroup);\n\n        when(view.getItemName()).thenReturn(\"name\");\n        presenter.onChangesOk();\n        verify(view).finishItemEdition();\n        verify(updateCommand).execute();\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n\n        reset(updateCommand);\n        reset(view);\n        when(view.getItemName()).thenReturn(\"  \\t   \");\n        presenter.onChangesOk();\n        verify(view, never()).finishItemEdition();\n        verify(updateCommand, never()).execute();\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n\n        reset(updateCommand);\n        reset(view);\n        when(view.getItemName()).thenReturn(\"newName\");\n        presenter.onChangesOk();\n        verify(view).finishItemEdition();\n        verify(updateCommand).execute();\n        assertEquals(presenter.getNavItem().getName(), \"newName\");\n    }\n\n    @Test\n    public void testChangePerspective() {\n        NavItem navItem = NavFactory.get().createNavItem();\n        NavWorkbenchCtx navCtxA = NavWorkbenchCtx.perspective(\"A\");\n        NavWorkbenchCtx navCtxB = NavWorkbenchCtx.perspective(\"B\");\n        navItem.setContext(navCtxA.toString());\n\n        navItem.setId(\"id\");\n        navItem.setName(\"name\");\n        navItem.setDescription(\"description\");\n        navItem.setModifiable(true);\n        presenter.setOnUpdateCommand(updateCommand);\n        presenter.edit(navItem);\n\n        // Empty perspective\n        when(view.getItemName()).thenReturn(\"name\");\n        presenter.onChangesOk();\n        verify(view, never()).finishItemEdition();\n\n        // Perspective changes\n        reset(updateCommand);\n        reset(view);\n        when(view.getItemName()).thenReturn(\"name\");\n        when(targetPerspectiveEditor.getPerspectiveId()).thenReturn(\"B\");\n        presenter.onChangesOk();\n        verify(view).finishItemEdition();\n        verify(updateCommand).execute();\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n        assertEquals(presenter.getNavItem().getContext(), navCtxB.toString());\n\n        // Cancel changes\n        navItem.setContext(navCtxA.toString());\n        presenter.edit(navItem);\n        reset(updateCommand);\n        reset(targetPerspectiveEditor);\n        reset(view);\n        when(view.getItemName()).thenReturn(\"newName\");\n        when(targetPerspectiveEditor.getPerspectiveId()).thenReturn(\"B\");\n        presenter.cancelEdition();\n        verify(view).finishItemEdition();\n        verify(view).setItemName(\"name\");\n        verify(targetPerspectiveEditor).setPerspectiveId(\"A\");\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n        assertEquals(presenter.getNavItem().getContext(), navCtxA.toString());\n    }\n\n    @Test\n    public void testEditGroup() {\n        NavGroup navGroup = NavFactory.get().createNavGroup();\n        navGroup.setId(\"id\");\n        navGroup.setName(\"name\");\n        navGroup.setDescription(\"description\");\n        navGroup.setModifiable(false);\n        presenter.edit(navGroup);\n\n        verify(view, atLeastOnce()).clearChildren();\n        verify(view, atLeastOnce()).clearCommands();\n        verify(view).setItemName(\"name\");\n        verify(view).setItemDescription(\"description\");\n        verify(view).setItemEditable(false);\n        verify(view).setItemType(NavItemEditor.ItemType.GROUP);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n        verify(view, atLeastOnce()).addCommand(any(), any());\n        verify(view, never()).setContextWidget(any());\n    }\n\n    @Test\n    public void testEditDivider() {\n        NavDivider divider = NavFactory.get().createDivider();\n        divider.setId(\"id\");\n        divider.setName(\"name\");\n        divider.setDescription(\"description\");\n        divider.setModifiable(true);\n        presenter.edit(divider);\n\n        verify(view, atLeastOnce()).clearChildren();\n        verify(view, atLeastOnce()).clearCommands();\n        verify(view).setItemName(\"name\");\n        verify(view).setItemDescription(\"description\");\n        verify(view).setItemEditable(false);\n        verify(view).setItemType(NavItemEditor.ItemType.DIVIDER);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n        verify(view, atLeastOnce()).addCommand(any(), any());\n        verify(view, never()).setContextWidget(any());\n\n        reset(view);\n        presenter.startEdition();\n        verify(view, never()).startItemEdition();\n    }\n\n    @Test\n    public void testEditPerspective() {\n        NavItem navItem = NavFactory.get().createNavItem();\n        navItem.setModifiable(false);\n        navItem.setContext(NavWorkbenchCtx.perspective(\"p1\").toString());\n        presenter.edit(navItem);\n\n        verify(view, atLeastOnce()).clearChildren();\n        verify(view, atLeastOnce()).clearCommands();\n        verify(view).setItemEditable(false);\n        verify(view).setItemType(NavItemEditor.ItemType.PERSPECTIVE);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n        verify(view, atLeastOnce()).addCommand(any(), any());\n        verify(view).setContextWidget(targetPerspectiveEditor);\n    }\n\n    @Test\n    public void testCommandsAvailability() {\n        // Disable move actions\n        presenter.setMoveUpEnabled(false);\n        presenter.setMoveDownEnabled(false);\n\n        // Non-modifiable group (only creation actions available)\n        NavGroup navGroup = NavFactory.get().createNavGroup();\n        navGroup.setModifiable(false);\n        presenter.edit(navGroup);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n\n        // Modifiable group (creation actions)\n        reset(view);\n        navGroup.setModifiable(true);\n        presenter.edit(navGroup);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n\n        // Non-modifiable perspective (move actions disabled => no actions)\n        reset(view);\n        NavItem navItem = NavFactory.get().createNavItem();\n        navItem.setContext(NavWorkbenchCtx.perspective(\"p1\").toString());\n        navItem.setModifiable(false);\n        presenter.edit(navItem);\n        verify(view, never()).setCommandsEnabled(true);\n\n        // Modifiable perspective (only delete action)\n        reset(view);\n        navItem.setModifiable(true);\n        presenter.edit(navItem);\n        verify(view).setItemEditable(true);\n        verify(view).setItemDeletable(true);\n        verify(view, never()).setCommandsEnabled(true);\n\n        // Modifiable divider (only delete action)\n        reset(view);\n        NavDivider navDivider = NavFactory.get().createDivider();\n        navDivider.setModifiable(true);\n        presenter.edit(navDivider);\n        verify(view).setItemEditable(false);\n        verify(view).setItemDeletable(true);\n        verify(view, never()).setCommandsEnabled(true);\n\n        // Non-modifiable divider (no actions)\n        reset(view);\n        navDivider.setModifiable(false);\n        presenter.edit(navDivider);\n        verify(view, never()).setCommandsEnabled(true);\n\n        // Move actions available\n        reset(view);\n        presenter.setMoveUpEnabled(true);\n        presenter.setMoveDownEnabled(true);\n        presenter.edit(navItem);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n        reset(view);\n        presenter.edit(navDivider);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n        reset(view);\n        presenter.edit(navGroup);\n        verify(view, atLeastOnce()).setCommandsEnabled(true);\n    }\n\n    @Test\n    public void testItemNameFromPerspective() {\n        NavItem navItem = NavFactory.get().createNavItem();\n        navItem.setId(\"id\");\n        navItem.setName(\"name\");\n        navItem.setModifiable(true);\n        navItem.setContext(NavWorkbenchCtx.perspective(\"A\").toString());\n\n        // Existing item => The name does not changes on perspective change\n        presenter.edit(navItem);\n        presenter.startEdition();\n        verify(view).setItemName(\"name\");\n        when(targetPerspectiveEditor.getPerspectiveId()).thenReturn(\"B\");\n        presenter.onTargetPerspectiveUpdated();\n        verify(view, never()).setItemName(\"B\");\n\n        // Newly created item => The name always matches the selected perspective\n        reset(view);\n        navItem.setName(NEW_PERSPECTIVE_NAME);\n        presenter.edit(navItem);\n        presenter.startEdition();\n        verify(view).setItemName(\"A\");\n        when(targetPerspectiveEditor.getPerspectiveId()).thenReturn(\"B\");\n        presenter.onTargetPerspectiveUpdated();\n        verify(view).setItemName(\"B\");\n\n        // If user changes the name then the auto-matching is disabled\n        reset(view);\n        presenter.onItemNameChanged();\n        presenter.onTargetPerspectiveUpdated();\n        verify(view, never()).setItemName(\"B\");\n    }\n\n    @Test\n    public void testCancelRestoresLastBackup() {\n        NavItem navItem = NavFactory.get().createNavItem();\n        navItem.setId(\"id\");\n        navItem.setName(\"name\");\n        navItem.setModifiable(true);\n        navItem.setContext(NavWorkbenchCtx.perspective(\"A\").toString());\n\n        // Modify the item\n        when(targetPerspectiveEditor.getPerspectiveId()).thenReturn(\"A\");\n        presenter.edit(navItem);\n        presenter.startEdition();\n        when(view.getItemName()).thenReturn(\"newName\");\n        presenter.onChangesOk();\n        assertEquals(presenter.getNavItem().getName(), \"newName\");\n\n        // Edit again and cancel edition. The name must match the latest name set.\n        presenter.startEdition();\n        presenter.cancelEdition();\n        assertEquals(presenter.getNavItem().getName(), \"newName\");\n\n        // Editing a new item resets the latest backup\n        presenter.edit(navItem);\n        presenter.startEdition();\n        presenter.cancelEdition();\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n    }\n\n    @Test\n    public void testBackupIsNotUpdatedOnError() {\n        NavItem navItem = NavFactory.get().createNavItem();\n        navItem.setId(\"id\");\n        navItem.setName(\"name\");\n        navItem.setModifiable(true);\n        navItem.setContext(NavWorkbenchCtx.perspective(\"A\").toString());\n\n        // Edit with errors (missing perspective selected)\n        presenter.edit(navItem);\n        presenter.startEdition();\n        when(view.getItemName()).thenReturn(\"newName\");\n        presenter.onChangesOk();\n        assertEquals(presenter.getNavItem().getName(), \"newName\");\n\n        // Cancel edition restores the initial backup\n        presenter.cancelEdition();\n        assertEquals(presenter.getNavItem().getName(), \"name\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/editor/NavTreeEditorTest.java",
    "content": "package org.dashbuilder.client.navigation.widget.editor;\n\nimport java.util.Collection;\nimport java.util.HashSet;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.navigation.event.NavItemEditCancelledEvent;\nimport org.dashbuilder.client.navigation.event.NavItemEditStartedEvent;\nimport org.dashbuilder.client.navigation.event.NavItemGotoEvent;\nimport org.dashbuilder.navigation.event.NavTreeChangedEvent;\nimport org.dashbuilder.client.navigation.event.NavTreeLoadedEvent;\nimport org.dashbuilder.client.navigation.impl.NavigationManagerImpl;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.service.NavigationServices;\nimport org.dashbuilder.navigation.workbench.NavSecurityController;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NavTreeEditorTest {\n\n    @Mock\n    NavTreeEditorView view;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PerspectiveTreeProvider perspectiveTreeProvider;\n\n    @Mock\n    EventSourceMock<NavItemEditStartedEvent> navItemEditStartedEvent;\n\n    @Mock\n    EventSourceMock<NavItemEditCancelledEvent> navItemEditCancelledEvent;\n\n    @Mock\n    LoadingBox loadingBox;\n\n    @Mock\n    EventSourceMock<NavItemGotoEvent> navItemGotoEvent;\n\n    @Mock\n    EventSourceMock<NavTreeLoadedEvent> navTreeLoadedEvent;\n\n    @Mock\n    EventSourceMock<NavTreeChangedEvent> navTreeChangedEvent;\n\n    @Mock\n    NavigationServices navServices;\n\n    @Mock\n    NavSecurityController navController;\n\n    @Mock\n    PlaceManager placeManager;\n\n    @Mock\n    TargetPerspectiveEditor targetPerspectiveEditor;\n\n    @Mock\n    PerspectivePluginManager perspectivePluginManager;\n\n    @Mock\n    NavItemDefaultEditorView navItemEditorView;\n\n    @Mock\n    NavRootNodeEditorView navRootNodeEditorView;\n\n    @Mock\n    SyncBeanDef<NavItemDefaultEditor> navItemEditorBeanDef;\n\n    @Mock\n    SyncBeanDef<NavRootNodeEditor> navRootNodeEditorBeanDef;\n\n    @Mock\n    Command updateCommand;\n\n    @Mock\n    Plugin perspectivePlugin;\n\n    Collection<Plugin> perspectivePlugins = new HashSet<>();\n    NavigationManager navigationManager;\n    NavTreeEditor navTreeEditor;\n    NavItemDefaultEditor navItemEditor;\n    NavRootNodeEditor navRootNodeEditor;\n\n    NavTree NAV_TREE = new NavTreeBuilder()\n            .group(\"level1a\", \"level1a\", \"level1a\", true)\n            .group(\"level2a\", \"level2a\", \"level2a\", true)\n            .endGroup()\n            .endGroup()\n            .group(\"level1b\", \"level1b\", \"level1b\", true)\n            .group(\"level2b\", \"level2b\", \"level2b\", true)\n            .endGroup()\n            .endGroup()\n            .build();\n\n    @Before\n    public void setUp() {\n        navigationManager = spy(new NavigationManagerImpl(new CallerMock<>(navServices),\n                                                          navController,\n                                                          navTreeLoadedEvent,\n                                                          navTreeChangedEvent,\n                                                          navItemGotoEvent));\n\n        navTreeEditor = spy(new NavTreeEditor(view,\n                                              navigationManager,\n                                              beanManager,\n                                              placeManager,\n                                              perspectiveTreeProvider,\n                                              targetPerspectiveEditor,\n                                              perspectivePluginManager,\n                                              navItemEditStartedEvent,\n                                              navItemEditCancelledEvent,\n                                              loadingBox));\n\n        navTreeEditor.setChildEditorClass(NavRootNodeEditor.class);\n\n        navItemEditor = spy(new NavItemDefaultEditor(navItemEditorView, beanManager, placeManager,\n                                                     perspectiveTreeProvider, targetPerspectiveEditor, perspectivePluginManager,\n                                                     navItemEditStartedEvent, navItemEditCancelledEvent));\n\n        navRootNodeEditor = spy(new NavRootNodeEditor(navRootNodeEditorView, beanManager, placeManager,\n                                                      perspectiveTreeProvider, targetPerspectiveEditor, perspectivePluginManager,\n                                                      navItemEditStartedEvent, navItemEditCancelledEvent));\n\n        when(beanManager.lookupBean(NavItemDefaultEditor.class)).thenReturn(navItemEditorBeanDef);\n        when(beanManager.lookupBean(NavRootNodeEditor.class)).thenReturn(navRootNodeEditorBeanDef);\n        when(navItemEditorBeanDef.newInstance()).thenReturn(navItemEditor);\n        when(navRootNodeEditorBeanDef.newInstance()).thenReturn(navRootNodeEditor);\n\n        when(navItemEditorView.getItemName()).thenReturn(\"editor1\");\n        when(navRootNodeEditorView.getItemName()).thenReturn(\"editor2\");\n\n        perspectivePlugins.add(perspectivePlugin);\n        doAnswer(invocationOnMock -> {\n            ParameterizedCommand callback = (ParameterizedCommand) invocationOnMock.getArguments()[0];\n            callback.execute(perspectivePlugins);\n            return null;\n        }).when(perspectivePluginManager).getPerspectivePlugins(any());\n    }\n\n    @Test\n    public void testNewPerspectiveEnabled() {\n        navTreeEditor.getSettings().setNewPerspectiveEnabled(true);\n        assertTrue(navTreeEditor.getSettings().isNewPerspectiveEnabled(NAV_TREE.getItemById(\"level1b\")));\n\n        navTreeEditor.setNewPerspectiveEnabled(\"level1b\", false);\n        assertFalse(navTreeEditor.getSettings().isNewPerspectiveEnabled(NAV_TREE.getItemById(\"level1b\")));\n        assertTrue(navTreeEditor.getSettings().isNewPerspectiveEnabled(NAV_TREE.getItemById(\"level2b\")));\n\n        navTreeEditor.setNewPerspectiveEnabled(\"level1b\", false).applyToAllChildren();\n        assertFalse(navTreeEditor.getSettings().isNewPerspectiveEnabled(NAV_TREE.getItemById(\"level1b\")));\n        assertFalse(navTreeEditor.getSettings().isNewPerspectiveEnabled(NAV_TREE.getItemById(\"level2b\")));\n    }\n\n    @Test\n    public void testNewDividerEnabled() {\n        navTreeEditor.getSettings().setNewDividerEnabled(true);\n        assertTrue(navTreeEditor.getSettings().isNewDividerEnabled(NAV_TREE.getItemById(\"level1b\")));\n\n        navTreeEditor.setNewDividerEnabled(\"level1b\", false);\n        assertFalse(navTreeEditor.getSettings().isNewDividerEnabled(NAV_TREE.getItemById(\"level1b\")));\n        assertTrue(navTreeEditor.getSettings().isNewDividerEnabled(NAV_TREE.getItemById(\"level2b\")));\n\n        navTreeEditor.setNewDividerEnabled(\"level1b\", false).applyToAllChildren();\n        assertFalse(navTreeEditor.getSettings().isNewDividerEnabled(NAV_TREE.getItemById(\"level1b\")));\n        assertFalse(navTreeEditor.getSettings().isNewDividerEnabled(NAV_TREE.getItemById(\"level2b\")));\n    }\n\n    @Test\n    public void testAllSubgroupsAllowed() {\n        navTreeEditor.getSettings().setMaxLevels(-1);\n        navTreeEditor.edit(NAV_TREE);\n\n        verify(navTreeEditor, times(2)).createChildEditor(any());\n        verify(navRootNodeEditor, times(2)).createChildEditor(any());\n        verify(navItemEditor, never()).createChildEditor(any());\n    }\n\n    @Test\n    public void testNoSubgroupsAllowed() {\n        navTreeEditor.getSettings().setMaxLevels(1);\n        navTreeEditor.edit(NAV_TREE);\n\n        NavItem level1a = NAV_TREE.getItemById(\"level1a\");\n        NavItem level2a = NAV_TREE.getItemById(\"level2a\");\n        NavItem level1b = NAV_TREE.getItemById(\"level1b\");\n        NavItem level2b = NAV_TREE.getItemById(\"level2b\");\n\n        verify(navTreeEditor, never()).createChildEditor(eq(level1a));\n        verify(navTreeEditor, never()).createChildEditor(eq(level1b));\n        verify(navRootNodeEditor, never()).createChildEditor(eq(level2b));\n        verify(navRootNodeEditor, never()).createChildEditor(eq(level2a));\n    }\n\n    @Test\n    public void testSubgroupNotAllowed() {\n        NavItem level1a = NAV_TREE.getItemById(\"level1a\");\n        NavItem level2a = NAV_TREE.getItemById(\"level2a\");\n        NavItem level1b = NAV_TREE.getItemById(\"level1b\");\n        NavItem level2b = NAV_TREE.getItemById(\"level2b\");\n\n        navTreeEditor.getSettings().setMaxLevels(\"level1a\", 1);\n        navTreeEditor.edit(NAV_TREE);\n\n        verify(navTreeEditor).createChildEditor(eq(level1a));\n        verify(navTreeEditor).createChildEditor(eq(level1b));\n        verify(navRootNodeEditor).createChildEditor(eq(level2b));\n        verify(navRootNodeEditor, never()).createChildEditor(eq(level2a));\n    }\n\n    @Test\n    public void testOnlyThreeLevelsAllowed() {\n        NavItem level1a = NAV_TREE.getItemById(\"level1a\");\n        NavItem level2a = NAV_TREE.getItemById(\"level2a\");\n        NavItem level1b = NAV_TREE.getItemById(\"level1b\");\n        NavItem level2b = NAV_TREE.getItemById(\"level2b\");\n\n        navTreeEditor.getSettings().setMaxLevels(\"root\", 3);\n        navTreeEditor.edit(NAV_TREE);\n\n        verify(navTreeEditor).createChildEditor(eq(level1a));\n        verify(navTreeEditor).createChildEditor(eq(level1b));\n        verify(navTreeEditor, never()).createChildEditor(eq(level2a));\n        verify(navTreeEditor, never()).createChildEditor(eq(level2b));\n    }\n\n    @Test\n    public void testFinishEdition() {\n        navTreeEditor.edit(NAV_TREE);\n\n        navRootNodeEditor.newGroup();\n        navRootNodeEditor.finishEdition();\n\n        assertNull(navTreeEditor.getCurrentlyEditedItem());\n    }\n\n    @Test\n    public void itShouldBeImpossibleToOpenMultipleNavItemEditorInputs() { // DASHBUILDE-217\n        NavTree tree = NavFactory.get().createNavTree();\n        navTreeEditor.edit(tree);\n\n        NavItemEditor first = mock(NavItemEditor.class);\n        NavItemEditor second = mock(NavItemEditor.class);\n        NavItem firstItem = mock(NavItem.class);\n        when(first.getNavItem()).thenReturn(firstItem);\n\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(first));\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(second));\n\n        verify(first).cancelEdition();\n    }\n\n    @Test\n    public void whenItemEditFinishedNavTreeEditorCleared() {\n        navTreeEditor.edit(NAV_TREE);\n\n        // When item editing starts the item is remembered in the tree\n        NavItemEditor navItemEditor = navTreeEditor.newGroup();\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(navItemEditor));\n        assertEquals(navItemEditor, navTreeEditor.currentlyEditedItem.get());\n\n        // When item editing finishes, it is cleaned from the navTreeEditor and view resets to \"non-editing\" state\n        navItemEditor.onItemUpdated();\n        assertFalse(navTreeEditor.currentlyEditedItem.isPresent());\n    }\n\n    @Test\n    public void testNewGroup() {\n        navTreeEditor.setOnUpdateCommand(updateCommand);\n        navTreeEditor.edit(NAV_TREE);\n        navTreeEditor.collapse();\n        assertFalse(navTreeEditor.isExpanded());\n\n        reset(view);\n        NavItemEditor navItemEditor = navTreeEditor.newGroup();\n        assertEquals(((NavGroup) navTreeEditor.getNavItem()).getChildren().size(), 2);\n        assertTrue(navTreeEditor.isExpanded());\n        verify(navItemEditor).startEdition();\n        verify(view, times(3)).addChild(any());\n        verify(updateCommand, never()).execute();\n\n        when(navRootNodeEditorView.getItemName()).thenReturn(\"A\");\n        navItemEditor.onChangesOk();\n        verify(updateCommand).execute();\n    }\n\n    @Test\n    public void testNewPerspective() {\n        navTreeEditor.setOnUpdateCommand(updateCommand);\n        navTreeEditor.edit(NAV_TREE);\n        navTreeEditor.collapse();\n        assertFalse(navTreeEditor.isExpanded());\n\n        reset(view);\n        NavItemEditor navItemEditor = navTreeEditor.newPerspective();\n        assertEquals(((NavGroup) navTreeEditor.getNavItem()).getChildren().size(), 2);\n        assertTrue(navTreeEditor.isExpanded());\n        verify(navItemEditor).startEdition();\n        verify(view, times(3)).addChild(any());\n        verify(updateCommand, never()).execute();\n    }\n\n    @Test\n    public void testNewDivider() {\n        navTreeEditor.setOnUpdateCommand(updateCommand);\n        navTreeEditor.edit(NAV_TREE);\n        navTreeEditor.collapse();\n        assertFalse(navTreeEditor.isExpanded());\n\n        reset(view);\n        navTreeEditor.newDivider();\n        assertTrue(navTreeEditor.isExpanded());\n        assertEquals(((NavGroup) navTreeEditor.getNavItem()).getChildren().size(), 3);\n        verify(view, times(3)).addChild(any());\n        verify(updateCommand).execute();\n    }\n\n    @Test\n    public void testSaveAndCancel() {\n        navTreeEditor.edit(NAV_TREE);\n        NavItemEditor newEditor = navTreeEditor.newGroup();\n        newEditor.onChangesOk();\n        navTreeEditor.onSaveClicked();\n\n        NavTree navTree = navTreeEditor.getNavTree();\n        assertNotNull(navTree.getItemById(newEditor.getNavItem().getId()));\n    }\n\n    @Test\n    public void testNewPerspectiveActionAvailable() {\n        NavItemEditor navItemEditor = navTreeEditor.newGroup();\n        assertTrue(navItemEditor.isNewPerspectiveEnabled());\n\n        perspectivePlugins.clear();\n        assertFalse(navItemEditor.isNewPerspectiveEnabled());\n    }\n\n    @Test\n    public void testCancelLastEditedItem() {\n        NavItemEditor navItemEditorA = mock(NavItemEditor.class);\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(navItemEditorA));\n        assertEquals(navTreeEditor.getCurrentlyEditedItem(), navItemEditorA);\n\n        // No need for cancel if the same item is edited again\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(navItemEditorA));\n        verify(navItemEditorA, never()).cancelEdition();\n\n        // Last edited item must be cancelled\n        NavItemEditor navItemEditorB = mock(NavItemEditor.class);\n        navTreeEditor.onItemEditStarted(new NavItemEditStartedEvent(navItemEditorB));\n        assertEquals(navTreeEditor.getCurrentlyEditedItem(), navItemEditorB);\n        verify(navItemEditorA).cancelEdition();\n    }\n\n    @Test\n    public void testEditIsNotInvokedTwiceAfterCancel() {\n        navTreeEditor.edit(NAV_TREE);\n\n        // When edit is cancelled avoid the parent's editor to invoke edit again\n        reset(navItemEditor);\n        navItemEditor.startEdition();\n        navItemEditor.cancelEdition();\n        verify(navItemEditor, times(1)).edit(any());\n    }\n\n    @Test\n    public void testOnNewTreeClicked() {\n\n        navTreeEditor.newTree();\n\n        verify(navTreeEditor).saveDefaultNavTree();\n        verify(navTreeEditor).newGroup();\n    }\n\n    @Test\n    public void testSaveDefaultNavTreeWhenNavigationManagerDoesNotHaveNavTree() {\n\n        doReturn(false).when(navigationManager).hasNavTree();\n\n        navTreeEditor.saveDefaultNavTree();\n\n        verify(navTreeEditor).showLoading();\n        verify(navigationManager).saveNavTree(any(), any(Command.class));\n    }\n\n    @Test\n    public void testSaveDefaultNavTreeWhenNavigationManagerHasNavTree() {\n\n        doReturn(true).when(navigationManager).hasNavTree();\n\n        navTreeEditor.saveDefaultNavTree();\n\n        verify(navTreeEditor, never()).showLoading();\n        verify(navigationManager, never()).saveNavTree(any(NavTree.class), any(Command.class));\n    }\n\n    @Test\n    public void testShowLoading() {\n\n        navTreeEditor.showLoading();\n\n        verify(loadingBox).show();\n    }\n\n    @Test\n    public void testHideLoading() {\n\n        navTreeEditor.hideLoading();\n\n        verify(loadingBox).hide();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-navigation-client/src/test/java/org/dashbuilder/client/navigation/widget/editor/TargetPerspectiveEditorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation.widget.editor;\n\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.ext.widgets.common.client.dropdown.PerspectiveDropDown;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TargetPerspectiveEditorTest {\n\n    @Mock\n    TargetPerspectiveEditor.View view;\n\n    @Mock\n    PerspectivePluginManager perspectivePluginManager;\n\n    @Mock\n    PerspectiveDropDown perspectiveDropDown;\n\n    @Mock\n    PerspectiveTreeProvider perspectiveTreeProvider;\n\n    @Mock\n    Command updateCommand;\n\n    TargetPerspectiveEditor presenter;\n\n    NavTree NAV_TREE = new NavTreeBuilder()\n            .group(\"root\", \"root\", \"root\", true)\n                .group(\"level1a\", \"level1a\", \"level1a\", true)\n                .endGroup()\n                .group(\"level1b\", \"level1b\", \"level1b\", true)\n                .endGroup()\n                .group(\"levelnull\", null, null, true)\n                    .group(\"level2a\", \"level2a\", \"level2a\", true)\n                    .endGroup()\n                .endGroup()\n            .build();\n\n    @Before\n    public void setUp() throws Exception {\n        presenter = new TargetPerspectiveEditor(view, perspectiveDropDown,perspectivePluginManager, perspectiveTreeProvider);\n        presenter.setNavItemList(NAV_TREE.getRootItems());\n        presenter.setPerspectiveId(\"A\");\n        presenter.setNavGroupId(\"level1a\");\n        presenter.setOnUpdateCommand(updateCommand);\n        presenter.show();\n    }\n\n    @Test\n    public void testShow() {\n        verify(perspectiveDropDown).setSelectedPerspective(\"A\");\n        verify(view).setPerspectiveSelector(perspectiveDropDown);\n        verify(view).clearNavGroupItems();\n        verify(view).setNavGroupSelection(eq(\"root>level1a\"), any());\n        verify(view).addNavGroupItem(eq(\"root\"), any());\n        verify(view).addNavGroupItem(eq(\"root>level1b\"), any());\n        verify(view).addNavGroupItem(eq(\"level2a\"), any());\n        verify(view, times(3)).addNavGroupItem(anyString(), any());\n        verify(view, never()).addNavGroupItem(eq(\"root>level1a\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"root>null\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"null\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"null>level2a\"), any());\n    }\n\n    @Test\n    public void testGroupChange() {\n        reset(view);\n        presenter.onGroupSelected(\"level1b\");\n\n        verify(view).clearNavGroupItems();\n        verify(view).setNavGroupSelection(eq(\"root>level1b\"), any());\n        verify(view).addNavGroupItem(eq(\"root\"), any());\n        verify(view).addNavGroupItem(eq(\"root>level1a\"), any());\n        verify(view).addNavGroupItem(eq(\"level2a\"), any());\n        verify(view, times(3)).addNavGroupItem(anyString(), any());\n        verify(view, never()).addNavGroupItem(eq(\"root>level1b\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"root>null\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"null\"), any());\n        verify(view, never()).addNavGroupItem(eq(\"null>level2a\"), any());\n\n        verify(updateCommand).execute();\n    }\n\n    @Test\n    public void testPerspectiveName() {\n        when(perspectivePluginManager.isRuntimePerspective(\"A.1\")).thenReturn(true);\n        when(perspectiveTreeProvider.getPerspectiveName(\"B.1\")).thenReturn(\"Pretty\");\n\n        assertEquals(presenter.getPerspectiveName(\"A.1\"), \"A.1\");\n        assertEquals(presenter.getPerspectiveName(\"B.1\"), \"Pretty\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>dashbuilder-renderers</artifactId>\n    <groupId>org.dashbuilder</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>dashbuilder-renderer-c3</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Renderer C3</name>\n  <description>Dashbuilder Renderer for the C3 Chart API</description>\n\n  <dependencyManagement>\n    <dependencies>\n      <dependency>\n        <groupId>org.webjars</groupId>\n        <artifactId>c3</artifactId>\n        <version>${version.org.webjars.bower.c3}</version>\n      </dependency>\n      <dependency>\n        <groupId>org.webjars.npm</groupId>\n        <artifactId>d3-geo-projection</artifactId>\n        <version>${version.org.webjars.bower.d3geoprojection}</version>\n      </dependency>\n    </dependencies>\n  </dependencyManagement>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.webjars</groupId>\n      <artifactId>c3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.webjars.npm</groupId>\n      <artifactId>d3-geo-projection</artifactId>\n      <exclusions>\n        <exclusion> \n          <groupId>org.webjars.npm</groupId>\n          <artifactId>d3-geo</artifactId>\n        </exclusion>\n        <exclusion> \n          <groupId>org.webjars.npm</groupId>\n          <artifactId>d3-array</artifactId>\n        </exclusion>        \n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>base</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack-c3</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars</groupId>\n                  <artifactId>c3</artifactId>\n                  <version>${version.org.webjars.bower.c3}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/c3</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-d3-geo-projection</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.npm</groupId>\n                  <artifactId>d3-geo-projection</artifactId>\n                  <version>${version.org.webjars.bower.d3geoprojection}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/d3geoprojection</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>copy-c3-resources-js</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/dashbuilder/renderer/c3/client/exports/js</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/c3/META-INF/resources/webjars/c3/${version.org.webjars.bower.c3}</directory>\n                  <includes>\n                    <include>c3.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-d3geoprojection-resources-js</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/dashbuilder/renderer/c3/client/exports/js</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/d3geoprojection/META-INF/resources/webjars/d3-geo-projection/${version.org.webjars.bower.d3geoprojection}/dist/</directory>\n                  <includes>\n                    <include>d3-geo-projection.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3AbstractDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\n\npublic abstract class C3AbstractDisplayer<V extends C3AbstractDisplayer.View> extends AbstractGwtDisplayer<V>  {\n\n    protected FilterLabelSet filterLabelSet;\n    \n    public C3AbstractDisplayer(FilterLabelSet filterLabelSet) {\n        super();\n        this.filterLabelSet = filterLabelSet;\n        this.filterLabelSet.setOnClearAllCommand(this::onFilterClearAll);\n    }\n    \n    public interface View<P extends C3AbstractDisplayer> extends AbstractGwtDisplayer.View<P> {\n\n        void noData();\n        \n        void setSize(int width, int height);\n\n        void setFilterLabelSet(FilterLabelSet filterLabelSet);\n        \n        void showTitle(String title);\n\n    }\n    \n    @Override\n    protected void createVisualization() {\n        getView().setFilterLabelSet(filterLabelSet);\n        updateVisualization();\n    }\n    \n    @Override\n    protected void updateVisualization() {\n        getView().setSize(displayerSettings.getChartWidth(), \n                          displayerSettings.getChartHeight());\n        if (dataSet.getRowCount() == 0) {\n            getView().noData();\n        } else {\n            updateFilterStatus();\n            updateVisualizationWithData();\n        }\n    }\n    \n    \n    protected abstract void updateVisualizationWithData();\n\n    void onFilterClearAll() {\n        super.filterReset();\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n    \n    void onFilterLabelRemoved(String columnId, int row) {\n        super.filterUpdate(columnId, row);\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n    \n    protected void addToSelection(int row) {\n        String columnId =  dataSet.getColumns().get(0).getId();\n        Integer maxSelections = displayerSettings.isFilterSelfApplyEnabled() ? null : dataSet.getRowCount();\n        filterUpdate(columnId, row, maxSelections);\n\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n    \n    protected void updateFilterStatus() {\n        filterLabelSet.clear();\n        Set<String> columnFilters = filterColumns();\n        if (displayerSettings.isFilterEnabled() && !columnFilters.isEmpty()) {\n\n            for (String columnId : columnFilters) {\n                List<Interval> selectedValues = filterIntervals(columnId);\n                DataColumn column = dataSet.getColumnById(columnId);\n                for (Interval interval : selectedValues) {\n                    String formattedValue = formatInterval(interval, column);\n                    FilterLabel filterLabel = filterLabelSet.addLabel(formattedValue);\n                    filterLabel.setOnRemoveCommand(() -> onFilterLabelRemoved(columnId, interval.getIndex()));\n                }\n            }\n        }\n    }\n    \n    \n    protected String evaluateValueToString(Object mightBeNull, ColumnSettings settings) {\n        String value = columnValueToString(mightBeNull);\n        return getEvaluator().evalExpression(value, settings.getValueExpression());\n    }\n    \n    protected String columnValueToString(Object mightBeNull) {\n        return mightBeNull == null ? \"\" : mightBeNull.toString();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3AbstractDisplayerView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.renderer.c3.client.resources.i18n.C3DisplayerConstants;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Panel;\n\npublic abstract class C3AbstractDisplayerView<P extends C3AbstractDisplayer>\n                                             extends AbstractGwtDisplayerView<P>\n                                             implements C3AbstractDisplayer.View<P> {\n\n    protected Panel container = GWT.create(FlowPanel.class);\n    protected Panel displayerPanel = GWT.create(FlowPanel.class);\n    private Panel filterPanel = GWT.create(FlowPanel.class);\n    private Panel dataPanel = GWT.create(FlowPanel.class);\n    private HTML titleHtml = GWT.create(HTML.class);\n\n    FlexTable dataTable = GWT.create(FlexTable.class);\n\n    protected int width;\n    protected int height;\n\n    @Override\n    public void init(P presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(container);\n        dataPanel.setVisible(false);\n        dataPanel.add(dataTable);\n        container.add(titleHtml);\n        container.add(filterPanel);\n        container.add(displayerPanel);\n        container.add(dataPanel);\n        filterPanel.getElement().setAttribute(\"cellpadding\", \"2\");\n    }\n\n    @Override\n    public void showTitle(String title) {\n        titleHtml.setText(title);\n    }\n\n    @Override\n    public void setFilterLabelSet(FilterLabelSet widget) {\n        HTMLElement element = widget.getElement();\n        element.getStyle().setProperty(\"position\", \"absolute\");\n        element.getStyle().setProperty(\"z-index\", \"20\");\n        filterPanel.clear();\n        filterPanel.add(ElementWrapperWidget.getWidget(element));\n    }\n\n    @Override\n    public void noData() {\n        FlowPanel noDataPanel = GWT.create(FlowPanel.class);\n        noDataPanel.setWidth(width + \"px\");\n        noDataPanel.setHeight(height + \"px\");\n        Label lblNoData = GWT.create(Label.class);\n        lblNoData.setText(C3DisplayerConstants.INSTANCE.common_noData());\n        noDataPanel.add(lblNoData);\n        displayerPanel.clear();\n        displayerPanel.add(noDataPanel);\n        dataTable.clear();\n    }\n\n    @Override\n    public void setSize(int width, int height) {\n        this.width = width;\n        this.height = height;\n    }\n\n    public void setTableData(String[][] data) {\n        dataTable.clear();\n        for (int i = 0; i < data.length; i++) {\n            for (int j = 0; j < data[i].length; j++) {\n                dataTable.setWidget(j, i, new Text(data[i][j]));\n            }\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3Displayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport java.util.Iterator;\nimport java.util.List;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.Position;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisX;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisY;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartData;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartSize;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Color;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3DataInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Legend;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Padding;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Point;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Selection;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tick;\n\nimport com.google.gwt.i18n.client.NumberFormat;\n\nimport elemental2.core.JsObject;\n\npublic abstract class C3Displayer<V extends C3Displayer.View> extends C3AbstractDisplayer<V> {\n    \n    private static final double DEFAULT_POINT_RADIUS = 2.5;\n    protected C3JsTypesFactory factory;\n    \n    public static final String[] COLOR_PATTERN = {\n                                    \"#0088CE\", \"#CC0000\", \"#EC7A08\", \"#3F9C35\", \"#F0AB00\", \"#703FEC\", \"#007A87\", \"#92D400\", \"#35CAED\",\n                                    \"#00659C\", \"#A30000\", \"#B35C00\", \"#B58100\", \"#6CA100\", \"#2D7623\", \"#005C66\", \"#008BAD\", \"#40199A\"};\n\n    public interface View<P extends C3AbstractDisplayer> extends C3AbstractDisplayer.View<P> {\n\n        void updateChart(C3ChartConf conf);\n        \n        String getType();\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n        \n        void showTitle(String title);\n\n        void setFilterLabelSet(FilterLabelSet filterLabelSet);\n        \n        void setBackgroundColor(String color);\n        \n        void setResizable(int maxWidth, int maxHeight);\n        \n        void setTableData(String[][] data);\n\n    }\n    \n    public C3Displayer(FilterLabelSet filterLabelSet, C3JsTypesFactory builder) {\n        super(filterLabelSet);\n        this.factory = builder;\n    }\n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(10)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setColumnTypes(new ColumnType[]{\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);      \n    }\n\n    @Override\n    protected void updateVisualizationWithData() {\n        if (displayerSettings.isResizable()) {\n            getView().setResizable(displayerSettings.getChartWidth(),\n                                   displayerSettings.getChartHeight());\n        } \n\n        C3ChartConf conf = buildConfiguration();\n        getView().updateChart(conf);\n        applyPropertiesToView();\n        String[][] tableData = getDataTable();\n        getView().setTableData(tableData);\n    }\n\n    protected C3ChartConf buildConfiguration() {\n        C3AxisInfo axis = createAxis();\n        C3ChartData data = createData();\n        C3Point point = createPoint();\n        C3Padding padding = createPadding();\n        C3Legend legend = factory.c3Legend(displayerSettings.isChartShowLegend(), \n                                           getLegendPosition());\n        C3Color color = createColor();\n        C3ChartSize size = createSize();\n        return factory.c3ChartConf(\n                    size,\n                    data,\n                    axis,\n                    factory.c3Grid(true, true),\n                    factory.c3Transition(0),\n                    point,\n                    padding, \n                    legend,\n                    color\n                );\n    }\n\n    protected C3Color createColor() {\n        return factory.c3Color(COLOR_PATTERN);\n    }\n\n    protected C3ChartSize createSize() {\n        C3ChartSize size = null;\n        if (! displayerSettings.isResizable()) {\n            size = factory.c3ChartSize(displayerSettings.getChartWidth(), \n                                       displayerSettings.getChartHeight());\n        } \n        return size;\n    }\n\n    protected C3Padding createPadding() {\n        return factory.c3Padding(displayerSettings.getChartMarginTop(), \n                                 displayerSettings.getChartMarginRight(), \n                                 displayerSettings.getChartMarginBottom(), \n                                 displayerSettings.getChartMarginLeft());\n    }\n\n    protected C3Point createPoint() {\n        return factory.c3Point(d -> DEFAULT_POINT_RADIUS);\n    }\n\n    protected C3ChartData createData() {\n        String[][] series = createSeries();\n        String type = getView().getType();\n        String[][] groups = createGroups();\n        JsObject xs = createXs();\n        C3Selection selection = createSelection();\n        C3ChartData c3Data = factory.c3ChartData(series, type, groups, xs, selection);\n        if (displayerSettings.isFilterNotificationEnabled()) {\n            c3Data.setOnselected(this::addToSelection);\n        }\n        return c3Data;\n    }\n\n    protected C3Selection createSelection() {\n        boolean filterEnabled = displayerSettings.isFilterNotificationEnabled();\n        return factory.c3Selection(filterEnabled, true, false);\n    }\n\n    protected JsObject createXs() {\n        return null;\n    }\n\n    protected String[][] createGroups() {\n        return new String[0][0];\n    }\n\n    protected C3AxisInfo createAxis() {\n        C3AxisX axisX = createAxisX();\n        C3AxisY axisY = createAxisY();\n        return factory.c3AxisInfo(false, axisX, axisY);\n    }\n    \n    protected C3AxisX createAxisX() {\n       String[] categories = createCategories();\n       C3Tick tick = createTickX();\n       return factory.c3AxisX(\"category\", categories, tick);\n    }\n    \n    protected C3Tick createTickX() {\n        return factory.createC3Tick(null);\n    }\n\n    protected C3AxisY createAxisY() {\n        C3Tick tickY = createTickY();\n        return factory.c3AxisY(true, tickY);\n     }\n\n    protected C3Tick createTickY() {\n        return factory.createC3Tick(f -> {\n            try {\n                double doubleFormat = Double.parseDouble(f);\n                return NumberFormat.getFormat(\"#,###.##\").format(doubleFormat);\n            } catch(NumberFormatException e) {\n                return f;\n            }\n        });\n    }\n\n    /**\n     * This method extracts the categories of a dataset.\n     * For most of the charts the first column of the dataset contains the categories. \n     * \n     * @return\n     */\n    protected String[] createCategories() {\n        List<DataColumn> columns = dataSet.getColumns();\n        DataColumn dataColumn = columns.get(0);\n        String[] categories = null;\n        if (columns.size() > 0) {\n            List<?> values = dataColumn.getValues();\n            categories = new String[values.size()];\n            for (int i = 0; i < categories.length; i++) {\n                Object val = values.get(i);\n                if (val != null) {\n                    categories[i] = super.formatValue(val, dataColumn);\n                } else {\n                    categories[i] = \"cat_\" + i;\n                }\n            }\n        }\n        return categories;\n    }\n\n    /**\n     * Extracts the series of the column 1 and other columns\n     * @return\n     */\n    protected String[][] createSeries() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String[][] data  = null;\n        if (columns.size() > 1) {\n            data = new String[columns.size() - 1][];\n            for (int i = 1; i < columns.size(); i++) {\n                DataColumn dataColumn = columns.get(i);\n                ColumnSettings columnSettings = displayerSettings.getColumnSettings(dataColumn);\n                List<?> values = dataColumn.getValues();\n                String[] seriesValues = new String[values.size() + 1];\n                seriesValues[0] = columnSettings.getColumnName();\n                for (int j = 0; j < values.size(); j++) {\n                    seriesValues[j + 1] = values.get(j).toString(); \n                }\n                data[i - 1] = seriesValues;\n            }\n        }\n        return data;\n    }\n    \n    protected int getSelectedRowIndex(C3DataInfo info) {\n        return info.getIndex();\n    }\n    \n    \n    protected String getSelectedCategory(C3DataInfo info) {\n        List<?> values = dataSet.getColumns().get(0).getValues();\n        return values.get(info.getIndex()).toString();\n    }\n    \n    protected String[][] getDataTable() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String data[][] = new String[columns.size()][];\n        for (int i = 0; i < columns.size(); i++) {\n            List<?> values = columns.get(i).getValues();\n            data[i] = new String[values.size()];\n            for (int j = 0; j < values.size(); j++) {\n                data[i][j] = columnValueToString(values.get(j));\n            }\n        }\n        return data;\n    }    \n    \n    private void addToSelection(C3DataInfo data) {\n        int row = getSelectedRowIndex(data);\n        addToSelection(row);\n    }\n\n    private void applyPropertiesToView() {\n        if (displayerSettings.isTitleVisible()) {\n            getView().showTitle(displayerSettings.getTitle());\n        }\n        getView().setBackgroundColor(displayerSettings.getChartBackgroundColor());\n    }\n\n    private String getLegendPosition() {\n        Position legendPosition = displayerSettings.getChartLegendPosition();\n        String c3LegendPosition = C3Legend.convertPosition(legendPosition);\n        return c3LegendPosition;\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3DisplayerView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.MutationObserver;\nimport elemental2.dom.MutationObserverInit;\nimport elemental2.dom.Node;\nimport jsinterop.base.Js;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Chart;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.resources.i18n.C3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.mutationobserver.MutationObserverFactory;\n\npublic abstract class C3DisplayerView<P extends C3Displayer>\n        extends C3AbstractDisplayerView<P>\n        implements C3Displayer.View<P> {\n\n    protected C3Chart chart;\n\n    @Override\n    public void init(P presenter) {\n        super.init(presenter);\n    }\n\n    @Override\n    public void updateChart(C3ChartConf conf) {\n        displayerPanel.clear();\n        conf.setBindto(displayerPanel.getElement());\n        chart = C3.generate(conf);\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return C3DisplayerConstants.INSTANCE.common_Categories();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return C3DisplayerConstants.INSTANCE.common_Series();\n    }\n\n    @Override\n    public void setBackgroundColor(String color) {\n        chart.getElement().getElementsByTagName(\"svg\")\n                .getItem(0).getStyle()\n                .setBackgroundColor(color);\n    }\n\n    public void setResizable(int maxWidth, int maxHeight) {\n        displayerPanel.setWidth(\"100%\");\n        displayerPanel.getElement().getStyle().setProperty(\"maxWidth\", maxWidth + \"px\");\n        displayerPanel.getElement().getStyle().setProperty(\"maxHeight\", maxHeight + \"px\");\n        registerMutationObserver();\n    }\n\n    private void registerMutationObserver() {\n        MutationObserver observer = new MutationObserver((records, obs) -> {\n            Node elementalNode = Js.cast(displayerPanel.getElement());\n            if (DomGlobal.document.body.contains((elementalNode))) {\n                if (chart != null) {\n                    chart.flush();\n                }\n                obs.disconnect();\n            }\n            return null;\n        });\n        MutationObserverInit options = new MutationObserverFactory().mutationObserverInit();\n        options.setChildList(true);\n        observer.observe(DomGlobal.document.body, options);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3Renderer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.AREA;\nimport static org.dashbuilder.displayer.DisplayerSubType.AREA_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.BAR;\nimport static org.dashbuilder.displayer.DisplayerSubType.BAR_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.COLUMN;\nimport static org.dashbuilder.displayer.DisplayerSubType.COLUMN_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.DONUT;\nimport static org.dashbuilder.displayer.DisplayerSubType.LINE;\nimport static org.dashbuilder.displayer.DisplayerSubType.MAP_MARKERS;\nimport static org.dashbuilder.displayer.DisplayerSubType.MAP_REGIONS;\nimport static org.dashbuilder.displayer.DisplayerSubType.PIE;\nimport static org.dashbuilder.displayer.DisplayerSubType.PIE_3D;\nimport static org.dashbuilder.displayer.DisplayerSubType.SMOOTH;\nimport static org.dashbuilder.displayer.DisplayerType.AREACHART;\nimport static org.dashbuilder.displayer.DisplayerType.BARCHART;\nimport static org.dashbuilder.displayer.DisplayerType.BUBBLECHART;\nimport static org.dashbuilder.displayer.DisplayerType.LINECHART;\nimport static org.dashbuilder.displayer.DisplayerType.MAP;\nimport static org.dashbuilder.displayer.DisplayerType.METERCHART;\nimport static org.dashbuilder.displayer.DisplayerType.PIECHART;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractRendererLibrary;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.bar.C3BarChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.bubble.C3BubbleChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.line.C3LineChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.map.D3MapDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.meter.C3MeterChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.pie.C3PieChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.exports.ResourcesInjector;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n@ApplicationScoped\npublic class C3Renderer extends AbstractRendererLibrary {\n\n    public static final String UUID = \"c3\";\n    \n    @PostConstruct\n    public void prepare() {\n        ResourcesInjector.ensureC3Injected();\n    }\n    \n    @Inject\n    protected SyncBeanManager beanManager;\n\n    private static List<DisplayerType> SUPPORTED_TYPES = Arrays.asList(LINECHART, \n                                                                       BARCHART, \n                                                                       PIECHART, \n                                                                       AREACHART, \n                                                                       BUBBLECHART,\n                                                                       METERCHART,\n                                                                       MAP);\n    \n    @Override\n    public String getUUID() {\n        return UUID;\n    }\n\n    @Override\n    public String getName() {\n        return \"C3 Charts\";\n    }\n\n    @Override\n    public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {\n        switch (displayerType) {\n            case LINECHART:\n                return Arrays.asList(LINE, SMOOTH);\n            case BARCHART:\n                return Arrays.asList(BAR, BAR_STACKED, COLUMN, COLUMN_STACKED);    \n            case PIECHART:\n                return Arrays.asList(PIE, DONUT, PIE_3D);\n            case AREACHART:\n                return Arrays.asList(AREA, AREA_STACKED);\n            case MAP:\n                return Arrays.asList(MAP_MARKERS, MAP_REGIONS);  \n            default:\n                return Collections.emptyList();\n        }\n    }\n\n    public Displayer lookupDisplayer(DisplayerSettings displayerSettings) {\n        DisplayerType displayerType = displayerSettings.getType();\n        DisplayerSubType subtype = displayerSettings.getSubtype();\n        C3AbstractDisplayer displayer;\n        switch (displayerType) {\n            case LINECHART:\n                displayer = getLineChartForSubType(subtype);\n                break;\n            case BARCHART:\n                displayer = createBarChartForSubType(subtype);\n                break;\n            case PIECHART:\n                displayer = getPieChartForSubType(subtype);\n                break;\n            case AREACHART:\n                displayer = getAreaChartForSubType(subtype);\n                break;\n            case BUBBLECHART:\n                displayer = beanManager.lookupBean(C3BubbleChartDisplayer.class).newInstance();\n                break;\n            case METERCHART:\n                displayer = beanManager.lookupBean(C3MeterChartDisplayer.class).newInstance();                \n                break;\n            case MAP:\n                displayer = createMapChartForSubType(subtype);                \n                break;                \n            default:\n                return null;\n        }\n        return displayer;\n    }\n\n    private D3MapDisplayer createMapChartForSubType(DisplayerSubType subtype) {\n        ResourcesInjector.ensureD3GeoProjectionInjected();\n        D3MapDisplayer displayer = beanManager.lookupBean(D3MapDisplayer.class).newInstance();\n        if (subtype == MAP_MARKERS) {\n                displayer =  displayer.markers();\n        } else {\n            displayer = displayer.regions();\n        }\n        return displayer;\n    }\n\n    private C3Displayer createBarChartForSubType(DisplayerSubType subtype) {\n        C3Displayer displayer;\n        switch (subtype) {\n            case BAR:\n                displayer = beanManager.lookupBean(C3BarChartDisplayer.class)\n                                        .newInstance()\n                                        .rotated();\n                break;\n            case BAR_STACKED:\n                displayer = beanManager.lookupBean(C3BarChartDisplayer.class)\n                                       .newInstance()\n                                       .stackedAndRotated();\n                break;\n            case COLUMN:\n                displayer = beanManager.lookupBean(C3BarChartDisplayer.class)\n                                       .newInstance()\n                                       .notRotated();\n                break;\n            case COLUMN_STACKED:\n                displayer = beanManager.lookupBean(C3BarChartDisplayer.class)\n                                       .newInstance()\n                                       .stacked();\n                break;                \n            default:\n                displayer = beanManager.lookupBean(C3BarChartDisplayer.class)\n                                       .newInstance()\n                                       .rotated();\n                break;\n        }\n        return displayer;\n    }\n\n    private C3Displayer getLineChartForSubType(DisplayerSubType subtype) {\n        C3LineChartDisplayer displayer =  beanManager.lookupBean(C3LineChartDisplayer.class)\n                                                     .newInstance();\n        if (subtype == SMOOTH) { \n            displayer = displayer.smooth();\n        } \n        return displayer;\n    }\n    \n    private C3Displayer getPieChartForSubType(DisplayerSubType subtype) {\n        C3PieChartDisplayer displayer = beanManager.lookupBean(C3PieChartDisplayer.class)\n                                                   .newInstance();\n        if (subtype == DONUT) { \n            displayer = displayer.donut();\n        } \n        return displayer;\n    }\n    \n    private C3Displayer getAreaChartForSubType(DisplayerSubType subtype) {\n        C3AreaChartDisplayer areaChartDisplayer = beanManager.lookupBean(C3AreaChartDisplayer.class)\n                .newInstance();\n        if (subtype == AREA_STACKED) {\n            areaChartDisplayer = areaChartDisplayer.stacked();\n        }\n        return areaChartDisplayer;\n    }\n\n    @Override\n    public List<DisplayerType> getSupportedTypes() {\n        return SUPPORTED_TYPES;\n    }\n    \n    @Override\n    public boolean isDefault(DisplayerType type) {\n        return SUPPORTED_TYPES.contains(type);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/C3XYDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisLabel;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tick;\n\npublic abstract class C3XYDisplayer<V extends C3Displayer.View> extends C3Displayer {\n    \n    private static final String DEFAULT_LABEL_POS = \"outer-center\";\n    \n    private boolean stacked;\n\n    public C3XYDisplayer(FilterLabelSet filterLabelSet, C3JsTypesFactory builder) {\n        super(filterLabelSet, builder);\n    }\n\n    @Override\n    protected C3ChartConf buildConfiguration() {\n         C3ChartConf conf = super.buildConfiguration();\n         applyPropertiesToAxes(conf.getAxis());\n         return conf;\n    }\n    \n    protected C3Tick createTickY() {\n        return factory.createC3Tick(f -> {\n            List<DataColumn> columns = dataSet.getColumns();\n            if (columns.size() > 1) {\n                DataColumn dataColumn = columns.get(1);\n                f = super.formatValue(f, dataColumn);\n            }\n            return f;\n        });\n    }\n    \n    private void applyPropertiesToAxes(C3AxisInfo axis) {\n        axis.getX().getTick().setRotate(displayerSettings.getXAxisLabelsAngle());\n        if (displayerSettings.isXAxisShowLabels()) {\n            C3AxisLabel xLabel = factory.createC3Label(displayerSettings.getXAxisTitle(), \n                                                       DEFAULT_LABEL_POS);\n            axis.getX().setLabel(xLabel);\n        }\n        if (displayerSettings.isYAxisShowLabels()) {\n            C3AxisLabel yLabel = factory.createC3Label(displayerSettings.getYAxisTitle(), \n                                                       DEFAULT_LABEL_POS);\n            axis.getY().setLabel(yLabel);\n        }\n    }\n    \n    protected String[][] stackedGroups() {\n        String[][] groups;\n        groups = new String[1][];\n        groups[0] = dataSet.getColumns()\n                            .stream().skip(1)\n                            .map(displayerSettings::getColumnSettings)\n                            .map(ColumnSettings::getColumnName)\n                            .toArray(String[]::new);\n        return groups;\n    }\n    \n    @Override\n    protected String[][] createGroups() {\n        String[][] groups = new String[0][0];\n        if (isStacked()) {\n            groups = stackedGroups();\n            \n        }\n        return groups;\n    }\n\n    public boolean isStacked() {\n        return stacked;\n    }\n    \n    public void setStacked(boolean stacked) {\n        this.stacked = stacked;\n    }    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/CommonC3DisplayerConstants.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts;\n\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n/**\n * A common class for displayer constraints supported by a C3 displayer. \n */\npublic class CommonC3DisplayerConstants {\n    \n    private DataSetLookupConstraints lookupConstraints;\n\n    public CommonC3DisplayerConstants(DataSetLookupConstraints lookupConstraints) {\n        this.lookupConstraints = lookupConstraints;\n    }\n    \n    public DisplayerConstraints create() {\n        return new DisplayerConstraints(lookupConstraints).supportsAttribute(DisplayerAttributeDef.TYPE)\n                                                          .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_RESIZABLE)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_WIDTH)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_HEIGHT)\n                                                          .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP);\n                                                            \n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/area/C3AreaChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.area;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.C3XYDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.CommonC3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf.RenderedCallback;\n\n\n@Dependent\npublic class C3AreaChartDisplayer extends C3XYDisplayer<C3AreaChartDisplayer.View> {\n    \n    \n    public interface View extends C3Displayer.View<C3AreaChartDisplayer> {\n        \n        public void fixAreaOpacity();\n    }\n    \n    private View view;\n    \n    RenderedCallback fixAreaOpacityCallback = () -> getView().fixAreaOpacity();\n    \n    @Inject\n    public C3AreaChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory factory) {\n        super(filterLabelSet, factory);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    public C3AreaChartDisplayer stacked() {\n        this.setStacked(true);\n        return this;\n    }\n    \n    @Override\n    protected C3ChartConf buildConfiguration() {\n        C3ChartConf conf = super.buildConfiguration();\n        conf.setOnrendered(fixAreaOpacityCallback);\n        return conf;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxGroups(1)\n                .setMinColumns(2)\n                .setMaxColumns(10)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new CommonC3DisplayerConstants(lookupConstraints).create()\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n\n\n    @Override\n    public View getView() {\n        return view;\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/area/C3AreaChartView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.area;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NodeList;\n\npublic class C3AreaChartView \n       extends C3DisplayerView<C3AreaChartDisplayer> \n       implements C3AreaChartDisplayer.View {\n\n    @Override\n    public void updateChart(C3ChartConf conf) {\n        super.updateChart(conf);\n        fixAreaOpacity();\n    }\n\n    @Override\n    public String getType() {\n        return \"area\";\n    }\n    \n    @Override\n    public void fixAreaOpacity() {\n        // This is a workaround for: https://github.com/c3js/c3/issues/2551\n        if (chart != null) {\n            NodeList<Element> paths = chart.getElement().getElementsByTagName(\"path\");\n            int n = paths.getLength();\n            for (int i = 0; i < n; i++) {\n                Element child = paths.getItem(i);\n                String className = child.getAttribute(\"class\");\n                if (className != null && className.contains(\"c3-area-\")) {\n                    child.getStyle().setOpacity(0.2);\n                }\n            }\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/bar/C3BarChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.bar;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.C3XYDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.CommonC3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tick;\n\nimport com.google.gwt.i18n.client.NumberFormat;\n\n@Dependent\npublic class C3BarChartDisplayer extends C3XYDisplayer<C3BarChartDisplayer.View> {\n    \n    \n    public interface View extends C3Displayer.View<C3BarChartDisplayer> {\n    }\n    \n    private boolean rotated;\n    private View view;\n    \n    \n    @Inject\n    public C3BarChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory factory) {\n        super(filterLabelSet, factory);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    public C3BarChartDisplayer notRotated() {\n        this.setRotated(false);\n        this.setStacked(false);\n        return this;\n    }\n    \n    public C3BarChartDisplayer rotated() {\n        this.setRotated(true);\n        this.setStacked(false);\n        return this;\n    }\n    \n    public C3BarChartDisplayer stacked() {\n        this.setRotated(false);\n        this.setStacked(true);\n        return this;\n    }\n    \n    public C3BarChartDisplayer stackedAndRotated() {\n        this.setRotated(true);\n        this.setStacked(true);\n        return this;\n    }\n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(10)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType( ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new CommonC3DisplayerConstants(lookupConstraints).create()\n                        .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                        .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n    \n    \n    @Override\n    protected C3AxisInfo createAxis() {\n        C3AxisInfo axis = super.createAxis();\n        axis.setRotated(isRotated());\n        axis.getY().getTick().setRotate(30);\n        return axis;\n    }\n    \n    public boolean isRotated() {\n        return rotated;\n    }\n    \n    public void setRotated(boolean rotated) {\n        this.rotated = rotated;\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/bar/C3BarChartView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.bar;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\n\npublic class C3BarChartView \n      extends C3DisplayerView<C3BarChartDisplayer> \n      implements C3BarChartDisplayer.View {\n\n    @Override\n    public String getType() {\n        return \"bar\";\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/bubble/BubbleData.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.bubble;\n\npublic class BubbleData {\n    public Double x, y;\n    public String category;\n    \n    public BubbleData(Double x, Double y, String category) {\n        super();\n        this.x = x;\n        this.y = y;\n        this.category = category;\n    }\n\n    public Double getX() {\n        return x;\n    }\n\n    public Double getY() {\n        return y;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/bubble/C3BubbleChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.bubble;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.C3XYDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.CommonC3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3DataInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Point;\n\nimport com.google.gwt.core.shared.GWT;\n\nimport elemental2.core.JsObject;\nimport jsinterop.base.Any;\nimport jsinterop.base.Js;\n\n@Dependent\npublic class C3BubbleChartDisplayer extends C3XYDisplayer<C3BubbleChartDisplayer.View> {\n    \n    public interface View extends C3Displayer.View<C3BubbleChartDisplayer> {\n    }\n    \n    private static final int X_INDEX = 1;\n    private static final int Y_INDEX = 2;\n    private static final int R_INDEX = 4;\n\n    private static double MIN_BUBBLE_SIZE  = 5;\n    private static double MAX_BUBBLE_SIZE  = 45;\n    \n    private View view;\n    \n    @Inject\n    public C3BubbleChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory factory) {\n        super(filterLabelSet, factory);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    @Override\n    public View getView() {\n        return view;\n    }\n    \n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(5)\n                .setMinColumns(5)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTitle(1, \"X\")\n                .setColumnTitle(2, \"Y\")\n                .setColumnTitle(3, \"Bubble Size\")\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER,\n                        ColumnType.NUMBER,\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new CommonC3DisplayerConstants(lookupConstraints).create()\n                   .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n    \n    protected String[][] createSeries() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String[] categories = createCategories();\n        String[][] data  = new String[categories.length * 2][];\n        List<BubbleData> bubbleData = new ArrayList<>();\n        for (int i = 0; i < categories.length; i++) {\n            String x = columns.get(X_INDEX).getValues().get(i).toString();\n            String y = columns.get(Y_INDEX).getValues().get(i).toString();\n            bubbleData.add(new BubbleData(Double.valueOf(x), \n                                          Double.valueOf(y),\n                                          categories[i]));\n        }\n        Collections.sort(bubbleData, Comparator.comparingDouble(BubbleData::getX));\n        for (int i = 0, y = 0; i < bubbleData.size(); i++) {\n            BubbleData bData = bubbleData.get(i);\n            String catY = bData.getCategory();\n            String catX = bData.getCategory() + \"_x\";\n            Double xVal = bData.getX();\n            Double yVal = bData.getY();\n            data[y] = new String[] {catX, xVal.toString()};\n            data[y + 1] = new String[] {catY, yVal.toString()};\n            y+=2;\n        }\n        return data;\n    }\n    \n    @Override\n    protected JsObject createXs() {\n        JsObject xs = JsObject.create(null);\n        String[] categories = createCategories();\n        for (String category : categories) {\n            Js.<Any>cast(xs).asPropertyMap().set(category, category + \"_x\");\n        }\n        return xs;\n    }\n    \n    @Override\n    protected C3Point createPoint() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String[] categories = createCategories();\n        int n = categories.length;\n        Map<String, Double> rValues = new HashMap<>();\n        List<Double> valuesBeforeMap = new ArrayList<>();\n        for (int i = 0; i < n; i++) {\n            String valueStr = columns.get(R_INDEX).getValues().get(i).toString();\n            try {\n                valuesBeforeMap.add(Double.parseDouble(valueStr));\n            } catch (NumberFormatException e) {\n                GWT.log(\"Not able to retrieve radius values. Exiting radius calculation.\", e);\n                return super.createPoint();\n            }\n        }\n        double min = Collections.min(valuesBeforeMap);\n        double max = Collections.max(valuesBeforeMap);\n        for (int i = 0; i < n; i++) {\n            String cat = categories[i];\n            double r;\n            if (min == max) {\n                r = (MAX_BUBBLE_SIZE + MIN_BUBBLE_SIZE) / 2;\n            } else {\n                r = map(valuesBeforeMap.get(i), min, max, MIN_BUBBLE_SIZE, MAX_BUBBLE_SIZE);\n            }\n            rValues.put(cat, r);\n        }\n        return factory.c3Point(d -> rValues.get(d.getId()));\n    }\n    \n    @Override\n    protected String getSelectedCategory(C3DataInfo info) {\n        return info.getName();\n    }\n    \n    @Override\n    protected int getSelectedRowIndex(C3DataInfo info) {\n        String[] categories = createCategories();\n        return Arrays.asList(categories).indexOf(info.getName());\n    }    \n    \n    private double map(double value, double start1, double stop1, double start2, double stop2) {\n        return start2 + (stop2 - start2) * ((value - start1) / (stop1 - start1));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/bubble/C3BubbleChartView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.bubble;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\n\npublic class C3BubbleChartView \n       extends C3DisplayerView<C3BubbleChartDisplayer> \n       implements C3BubbleChartDisplayer.View {\n\n    @Override\n    public String getType() {\n        return \"scatter\";\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/line/C3LineChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.line;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.C3XYDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.CommonC3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\n\n@Dependent\npublic class C3LineChartDisplayer extends C3XYDisplayer<C3LineChartDisplayer.View> {\n    \n    public interface View extends C3Displayer.View<C3LineChartDisplayer> {\n        \n        void setSmooth(boolean smooth);\n        \n    }\n    \n    private View view;\n\n    @Inject\n    public C3LineChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory builder) {\n        super(filterLabelSet, builder);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    @Override\n    public View getView() {\n        return view;\n    }\n    \n    public C3LineChartDisplayer smooth() {\n        getView().setSmooth(true);\n        return this;\n    }\n   \n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxGroups(1)\n                .setMinColumns(2)\n                .setMaxColumns(10)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new CommonC3DisplayerConstants(lookupConstraints).create()\n                   .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                   .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/line/C3LineChartView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.line;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\n\npublic class C3LineChartView \n       extends C3DisplayerView<C3LineChartDisplayer>\n       implements C3LineChartDisplayer.View {\n\n    boolean smooth = false;\n    \n    @Override\n    public void init(C3LineChartDisplayer presenter) {\n        super.init(presenter);\n    }\n    \n    @Override\n    public String getType() {\n        return smooth ? \"spline\" : \"line\";\n    }\n\n    @Override\n    public void setSmooth(boolean smooth) {\n        this.smooth =  smooth;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/D3MapConf.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map;\n\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\nimport org.dashbuilder.displayer.MapColorScheme;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.CountriesGeoJsonService;\n\npublic class D3MapConf {\n\n    private String title;\n    private Map<String, Double> data;\n    private boolean markers;\n    private boolean regions;\n    private String backgroundColor = \"#DDDDFF\";\n    private CountriesGeoJsonService countriesGeoJsonService;\n    private Function<Double, String> formatter;\n    private Consumer<String> pathClickHandler;\n    private MapColorScheme colorScheme;\n    private boolean showLegend;\n\n    public D3MapConf(String title,\n                     Map<String, Double> data,\n                     boolean markers,\n                     boolean regions,\n                     String backgroundColor,\n                     CountriesGeoJsonService countriesGeoJsonService,\n                     Function<Double, String> formatter,\n                     Consumer<String> pathClickHandler,\n                     MapColorScheme colorScheme,\n                     boolean showLegend) {\n        this.title = title;\n        this.data = data;\n        this.markers = markers;\n        this.regions = regions;\n        this.backgroundColor = backgroundColor;\n        this.formatter = formatter;\n        this.countriesGeoJsonService = countriesGeoJsonService;\n        this.pathClickHandler = pathClickHandler;\n        this.colorScheme = colorScheme;\n        this.showLegend = showLegend;\n    }\n\n    public static D3MapConf of(String title,\n                               Map<String, Double> data,\n                               boolean markers,\n                               boolean regions,\n                               String backgroundColor,\n                               CountriesGeoJsonService countriesGeoJsonService,\n                               Function<Double, String> formatter,\n                               Consumer<String> pathClickHandler,\n                               MapColorScheme colorScheme,\n                               boolean showLegend) {\n        return new D3MapConf(title,\n                             data,\n                             markers,\n                             regions,\n                             backgroundColor,\n                             countriesGeoJsonService,\n                             formatter,\n                             pathClickHandler,\n                             colorScheme,\n                             showLegend);\n    }\n\n    public boolean isMarkers() {\n        return markers;\n    }\n\n    public boolean isRegions() {\n        return regions;\n    }\n\n    public Map<String, Double> getData() {\n        return data;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public String getBackgroundColor() {\n        return backgroundColor;\n    }\n\n    public Function<Double, String> getFormatter() {\n        return formatter;\n    }\n\n    public CountriesGeoJsonService getCountriesGeoJsonService() {\n        return countriesGeoJsonService;\n    }\n\n    public Consumer<String> getPathClickHandler() {\n        return pathClickHandler;\n    }\n\n    public MapColorScheme getColorScheme() {\n        return colorScheme;\n    }\n\n    public boolean isShowLegend() {\n        return showLegend;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/D3MapDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.MapColorScheme;\nimport org.dashbuilder.renderer.c3.client.C3AbstractDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.CountriesGeoJsonService;\n\n@Dependent\npublic class D3MapDisplayer extends C3AbstractDisplayer<D3MapDisplayer.View>  {\n    \n    View view;\n    private boolean markers;\n    private boolean regions;\n    private CountriesGeoJsonService geoService;\n    private D3MapConf conf;\n\n    public interface View extends C3AbstractDisplayer.View<D3MapDisplayer> {\n\n        String getColumnsTitle();\n\n        String getGroupsTitle();\n        \n        void createMap(D3MapConf conf);\n\n    }\n    \n    @Override\n    protected void createVisualization() {\n        getView().setFilterLabelSet(filterLabelSet);\n        super.createVisualization();\n    }\n    \n    @Inject\n    public D3MapDisplayer(FilterLabelSet filterLabelSet, View view, CountriesGeoJsonService countriesGeoJsonService) {\n        super(filterLabelSet);\n        view.init(this);\n        this.view = view;\n        this.geoService = countriesGeoJsonService;\n    }\n    \n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMinColumns(2)\n                .setMaxColumns(3)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(getView().getGroupsTitle())\n                .setColumnsTitle(getView().getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_SHOWLEGEND)\n                   .supportsAttribute(DisplayerAttributeGroupDef.MAP_GROUP);        \n    }\n\n    @Override\n    protected void updateVisualizationWithData() {\n        Map<String, Double> data = retrieveData(dataSet);\n        String backgroundColor = displayerSettings.getChartBackgroundColor();\n        String columnName = getDataColumnName();\n        MapColorScheme colorScheme = displayerSettings.getMapColorScheme();\n        conf = D3MapConf.of(columnName, \n                            data, \n                            markers, \n                            regions, \n                            backgroundColor, \n                            geoService, \n                            this::format, \n                            this::selectLocation, \n                            colorScheme,\n                            isShowLegend());\n        getView().createMap(conf);\n    }\n\n    private String getDataColumnName() {\n        String name = \"Data\";\n        if (dataSet.getColumns().size() > 1) {\n            DataColumn column = dataSet.getColumns().get(1);\n            name = displayerSettings.getColumnSettings(column).getColumnName();\n        }\n        return name;\n    }\n\n    protected Map<String, Double> retrieveData(DataSet dataSet) {\n        Map<String, Double> data = new HashMap<>();\n        List<DataColumn> columns = dataSet.getColumns();\n        List<?> locations  = columns.get(0).getValues();\n        List<?> numbers = columns.get(1).getValues();\n        \n        int total = locations.size();\n        \n        for (int i = 0; i < total; i++) {\n            Object locationValue = locations.get(i);\n            Object numberValue = numbers.get(i);\n            String numberStr = columnValueToString(numberValue);\n            String location = columnValueToString(locationValue);\n            Double value = Double.parseDouble(numberStr);\n            data.put(location, value);\n        }\n        \n        return data;\n    }\n    \n    public void selectLocation(String location) {\n        if (displayerSettings.isFilterNotificationEnabled()) {\n            List<DataColumn> columns = dataSet.getColumns();\n            List<?> locations  = columns.get(0).getValues();\n            int rowIndex = locations.indexOf(location);\n            if (rowIndex != -1) {\n                addToSelection(rowIndex);\n            }\n        }\n    }\n    \n    public String format(Double value) {\n        String textValue = value.toString();\n        List<DataColumn> columns = dataSet.getColumns();\n        if (columns.size() > 1) {\n            textValue  = super.formatValue(value, columns.get(1));\n        }\n        return textValue;\n    }\n\n    public D3MapDisplayer markers() {\n        this.markers = true;\n        return this;\n    }\n\n    public D3MapDisplayer regions() {\n        this.regions = true;\n        return this;\n    }\n\n    public D3MapConf getConf() {\n        return conf;\n    }\n    \n    public boolean isShowLegend() {\n        return displayerSettings.isChartShowLegend();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/D3MapDisplayerView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map;\n\nimport javax.inject.Inject;\n\nimport org.dashbuilder.renderer.c3.client.C3AbstractDisplayerView;\nimport org.dashbuilder.renderer.c3.client.charts.map.widgets.D3Map;\n\nimport jsinterop.base.Js;\n\npublic class D3MapDisplayerView extends C3AbstractDisplayerView<D3MapDisplayer> \n                                                      implements D3MapDisplayer.View {\n    \n    D3Map map;\n    \n    @Inject     \n    public D3MapDisplayerView(D3Map map) {\n        this.map = map;\n    }\n\n    @Override\n    public void init(D3MapDisplayer presenter) {\n        super.init(presenter);\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return \"Columns\";\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return \"Groups\";\n    }\n\n    @Override\n    public void createMap(D3MapConf conf) {\n        displayerPanel.getElement().removeAllChildren();\n        map.generateMap(width, height, conf);\n        displayerPanel.getElement().appendChild(Js.cast( map.getElement()));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/geojson/CountriesGeoJsonService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.geojson;\n\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.Feature;\n\n/**\n * Class for handling GeoJson files that contains country information \n */\npublic interface CountriesGeoJsonService {\n\n    public Feature[] getCountries();\n\n    public String getCountryName(Feature country);\n\n    public String getCountryNameByCode(String code);\n\n    public Optional<Feature> findCountry(String idNameOrLocation);\n\n    public Optional<Map.Entry<String, Double>> findEntry(Map<String, Double> data, Feature feature);\n\n    public Optional<Double> findValue(Map<String, Double> data, Feature feature);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/geojson/GeoJsonLoader.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.geojson;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.FeatureCollection;\n\n@ApplicationScoped\npublic interface GeoJsonLoader {\n    \n    public FeatureCollection load();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/geojson/impl/CountriesGeoJsonServiceImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.geojson.impl;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.CountriesGeoJsonService;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.GeoJsonLoader;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.Feature;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.FeatureCollection;\nimport org.uberfire.client.views.pfly.widgets.D3;\n\npublic class CountriesGeoJsonServiceImpl implements CountriesGeoJsonService {\n\n    static final String COUNTRY_NAME_PROPERTY = \"name\";\n\n    static final String LAT_LONG_REGEX = \"\\\\s*(\\\\-?\\\\d+(\\\\.\\\\d+)?),\\\\s*(\\\\-?\\\\d+(\\\\.\\\\d+)?)\\\\s*\";\n\n    @Inject\n    GeoJsonLoader geoJsonLoader;\n\n    D3 d3;\n\n    private FeatureCollection featureCollection;\n\n    @PostConstruct\n    public void setup() {\n        featureCollection = geoJsonLoader.load();\n        d3 = D3.Builder.get();\n    }\n\n    @Override\n    public Feature[] getCountries() {\n        return featureCollection.getFeatures();\n    }\n\n    @Override\n    public String getCountryName(Feature country) {\n        Object name = country == null ? null : country.getProperties().get(COUNTRY_NAME_PROPERTY);\n        if (name != null) {\n            return name.toString();\n        }\n        return \"\";\n    }\n\n    @Override\n    public String getCountryNameByCode(String code) {\n        return Arrays.stream(featureCollection.getFeatures())\n                     .filter(f -> f.getId().equalsIgnoreCase(code))\n                     .map(this::getCountryName)\n                     .findFirst().orElse(\"\");\n    }\n\n    @Override\n    public Optional<Entry<String, Double>> findEntry(Map<String, Double> data, Feature feature) {\n        if (usesLocation(data)) {\n            return entriesByLocation(data, feature).findAny();\n        } else {\n            return entryByCountry(data, feature);\n        }\n    }\n\n    @Override\n    public Optional<Double> findValue(Map<String, Double> data, Feature feature) {\n        if (usesLocation(data)) {\n            return valueByLocation(data, feature);\n        }\n        return findEntry(data, feature).flatMap(e -> Optional.ofNullable(e.getValue()));\n    }\n\n    @Override\n    public Optional<Feature> findCountry(String idNameOrLocation) {\n        if (idNameOrLocation.matches(LAT_LONG_REGEX)) {\n            return countryByLocation(idNameOrLocation);\n        }\n        return countryByIdOrName(idNameOrLocation);\n    }\n\n    public Optional<Feature> countryByIdOrName(String idOrName) {\n        return Arrays.stream(featureCollection.getFeatures())\n                     .filter(f -> {\n                         String countryName = getCountryName(f);\n                         return idOrName.equalsIgnoreCase(f.getId()) ||\n                                idOrName.equalsIgnoreCase(countryName);\n                     })\n                     .findFirst();\n    }\n\n    public Optional<Feature> countryByLocation(String location) {\n        return Arrays.stream(featureCollection.getFeatures())\n                     .filter(f -> containsLocation(location, f))\n                     .findFirst();\n    }\n\n    public Optional<Entry<String, Double>> entryByCountry(Map<String, Double> data, Feature value) {\n        if (value == null) {\n            return Optional.empty();\n        }\n\n        String countryID = value.getId();\n        String countryName = getCountryName(value);\n\n        return data.entrySet().stream().filter(k -> k.getKey().equalsIgnoreCase(countryID) ||\n                                                    k.getKey().equalsIgnoreCase(countryName))\n                   .findFirst();\n    }\n\n    public Optional<Double> valueByCountry(Map<String, Double> data, Feature value) {\n        return entryByCountry(data, value).flatMap(e -> Optional.ofNullable(e.getValue()));\n    }\n\n    public Stream<Entry<String, Double>> entriesByLocation(Map<String, Double> data, Feature feature) {\n        return data.entrySet().stream()\n                   .filter(e -> e.getKey().matches(LAT_LONG_REGEX))\n                   .filter(e -> containsLocation(e.getKey(), feature));\n    }\n\n    public Optional<Double> valueByLocation(Map<String, Double> data, Feature feature) {\n        // we may have multiple entries for a given feature (for example, multiple states of a country)\n        // stream not working here for some reason... (applyAsDouble is not a function)\n        // entriesByLocation(data, feature).flatMapToDouble(Entry::getKey).sum();\n        List<Double> values = entriesByLocation(data, feature).map(Entry::getValue).collect(Collectors.toList());\n        if (values.isEmpty()) {\n            return Optional.empty();\n        }\n        Double value = 0.0;\n        for (Double v : values) {\n            value += v;\n        }\n        return Optional.of(value);\n    }\n\n    protected boolean containsLocation(String latitudeLongitudeStr, Feature feature) {\n        if (latitudeLongitudeStr == null || !latitudeLongitudeStr.matches(LAT_LONG_REGEX)) {\n            return false;\n        }\n        // we use lat - long, but d3 considers long-lat\n        Double[] latLong = extractLatLongInfo(latitudeLongitudeStr);\n        Double[] longLat = {latLong[1], latLong[0]};\n        return d3.geoContains(feature, longLat);\n    }\n\n    protected Double[] extractLatLongInfo(String value) {\n        return Stream.of(value.replaceAll(\"\\\\s\", \"\").split(\",\"))\n                     .map(Double::parseDouble)\n                     .toArray(Double[]::new);\n    }\n\n    private boolean usesLocation(Map<String, Double> data) {\n        if (data.isEmpty()) {\n            return false;\n        }\n        return data.keySet().iterator().next().matches(LAT_LONG_REGEX);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/geojson/impl/GWTGeoJsonLoader.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.geojson.impl;\n\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.GeoJsonLoader;\nimport org.dashbuilder.renderer.c3.client.exports.NativeLibraryResources;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.FeatureCollection;\n\nimport com.google.gwt.json.client.JSONParser;\nimport com.google.gwt.json.client.JSONValue;\n\nimport jsinterop.base.Js;\n\npublic class GWTGeoJsonLoader implements GeoJsonLoader {\n\n    @Override\n    public FeatureCollection load() {\n        String geoJsonStr = NativeLibraryResources.INSTANCE.countriesgeojson().getText();\n        JSONValue geoJsonObject = JSONParser.parseStrict(geoJsonStr);\n        return Js.cast(geoJsonObject.isObject().getJavaScriptObject());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/D3Map.css",
    "content": ".countries path {\n    stroke: #AAAAAA;\n    stroke-width: 0.4;\n    fill: #D4D4D4;\n}\n\n.map-legend-caption {\n    font: 14px sans-serif;\n    text-anchor: start;\n    font-weight: bold;\n    color: black;\n}\n\n.fill-region {\n    stroke-width: 0.4;\n}\n\n.fill-region:hover {\n    stroke-width: 2.0;\n    stroke: #777777;\n}\n\n.data-circle {\n    fill-opacity: 0.6;\n    stroke: #00DD00;\n    stroke-width: 0.4;\n}\n\n.data-circle:hover {\n    stroke-width: 2.0;\n}\n\n.map-legend-val {\n    font: italic 10px sans-serif;\n    text-anchor: start;\n    font-weight: bold;\n    color: black;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/D3Map.html",
    "content": "<div id=\"mapContainer\"></div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/D3Map.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.widgets;\n\nimport java.util.IntSummaryStatistics;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.MapColorScheme;\nimport org.dashbuilder.renderer.c3.client.charts.map.D3MapConf;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.CountriesGeoJsonService;\nimport org.dashbuilder.renderer.c3.client.jsbinding.d3.D3PathGenerator;\nimport org.dashbuilder.renderer.c3.client.jsbinding.d3.D3Projection;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.Feature;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.widgets.D3;\nimport org.uberfire.client.views.pfly.widgets.D3.Selection;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\n\n@Templated\n@Dependent\npublic class D3Map implements IsElement {\n\n    /**\n     * Colors schemes for the map can be taken from D3 scheme colors and when doing\n     * it we can define which index of scheme we will be getting using the constant\n     * D3_COLOR_SCHEME_TOTAL\n     */\n    private static final int D3_COLOR_SCHEME_TOTAL = 7;\n    /**\n     * In Marks map the max radius proportion based on the map width. \n     * For example, if 20, then the radius of markers can't be bigger than width / 20.\n     */\n    private static final int RADIUS_PROPORTION = 20;\n    /**\n     * The smallest radius for markers\n     */\n    private static final int MIN_RADIUS = 2;\n\n    private int width;\n    private int height;\n    private D3MapConf conf;\n    private D3.Scale colorScale;\n    private CountriesGeoJsonService countriesGeoJsonService;\n    private Map<String, Double> data;\n\n    @Inject\n    private MapTooltip mapTooltip;\n\n    @Inject\n    private HTMLDivElement mapContainer;\n\n    D3 d3 = D3.Builder.get();\n    \n    private String[] colorsScheme;\n\n    @PostConstruct\n    public void init() {\n        addTooltipElement();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return mapContainer;\n    }\n\n    public void generateMap(int width, int height, D3MapConf conf) {\n        mapContainer.innerHTML = \"\";\n        this.width = width;\n        this.height = height;\n        this.conf = conf;\n        this.countriesGeoJsonService = conf.getCountriesGeoJsonService();\n        this.data = conf.getData();\n        this.colorsScheme = getScheme(conf.getColorScheme())[D3_COLOR_SCHEME_TOTAL];\n        final Element mapSVG = DomGlobal.document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n        final Selection d3Selection = d3.select(mapSVG);\n        final D3PathGenerator pathGenerator = createPathGenerator();\n        final IntSummaryStatistics statistics = data.values().stream()\n                                                    .mapToInt(v -> v.intValue()).summaryStatistics();\n        Integer[] domain = new Integer[]{statistics.getMin(), statistics.getMax()};\n        colorScale = d3.scaleQuantize().domain(domain).range(colorsScheme);\n\n        D3 map = createMap(d3Selection, pathGenerator);\n\n        if (conf.isRegions()) {\n            fillRegions(map);\n        }\n        if (conf.isMarkers()) {\n            addMarkers(d3Selection, pathGenerator);\n        }\n        if (conf.isShowLegend()) {\n            createLegend(d3Selection);\n        }\n        mapContainer.appendChild(mapSVG);\n    }\n\n    private String[][] getScheme(MapColorScheme colorScheme) {\n        switch (colorScheme) {\n            case BLUE:\n                return d3.getSchemeBlues();\n            case GREEN:\n                return d3.getSchemeGreens();\n            case RED:\n                return d3.getSchemeReds();\n            default:\n                return d3.getSchemeGreens();\n        }\n    }\n\n    private D3 createMap(Selection d3Selection, D3PathGenerator pathGenerator) {\n        Feature[] countriesFeatures = countriesGeoJsonService.getCountries();\n        return d3Selection.attr(\"width\", width).attr(\"height\", height)\n                          .style(\"background\", conf.getBackgroundColor())\n                          .append(\"g\").attr(\"class\", \"countries\")\n                          .selectAll(\"path\")\n                          .data(countriesFeatures)\n                          .enter().append(\"path\")\n                          .attr(\"d\", pathGenerator);\n    }\n\n    private void createLegend(D3 d3Selection) {\n        int titleSize = 5;\n        int legendSquareSize = 12;\n        int legendSize = titleSize + (legendSquareSize * colorsScheme.length);\n        AtomicInteger rectPos = new AtomicInteger();\n        AtomicInteger textPos = new AtomicInteger(legendSquareSize);\n        String translate = \"translate(0, \" + (height - legendSize - 2) + \")\";\n        D3 legendGroup = d3Selection.append(\"g\").attr(\"transform\", translate);\n\n        legendGroup.append(\"text\").attr(\"class\", \"map-legend-caption\")\n                   .attr(\"x\", 0).attr(\"y\", titleSize * -1)\n                   .text(conf.getTitle());\n\n        D3 legendValuesGroup = legendGroup.append(\"g\");\n\n        legendValuesGroup.selectAll(\"rect\")\n                         .data(colorScale.range()).enter().append(\"rect\")\n                         .attr(\"height\", legendSquareSize).attr(\"width\", legendSquareSize)\n                         .attr(\"y\", (d, i, el) -> rectPos.getAndAdd(legendSquareSize))\n                         .attr(\"fill\", (d, i, el) -> d)\n                         .append(\"svg:title\")\n                         .text((d, i, el) -> String.join(\" - \", getFormattedBoundaryValues(d)));\n        legendValuesGroup.selectAll(\"text\").data(colorScale.range()).enter().append(\"text\")\n                         .attr(\"class\", \"map-legend-val\").attr(\"x\", legendSquareSize + 2)\n                         .attr(\"y\", (d, i, el) -> textPos.getAndAdd(legendSquareSize)).text((d, i, el) -> buildLegendValue(d, i));\n    }\n\n    private void fillRegions(D3 map) {\n        Feature[] countriesFeatures = countriesGeoJsonService.getCountries();\n        map.style(\"fill\", (d, i, el) -> {\n            Optional<Double> val = countriesGeoJsonService.findValue(data, countriesFeatures[i]);\n            d3.select(el[i]).attr(\"class\", \"fill-region\");\n            if (val.isPresent()) {\n                return colorScale.call(colorScale, val.get());\n            }\n            return null;\n        }).on(\"mouseenter\", (d, i, el) -> {\n            Optional<Double> val = countriesGeoJsonService.findValue(data, countriesFeatures[i]);\n            String countryName = countriesGeoJsonService.getCountryName(countriesFeatures[i]);\n            mapTooltip.show(countryName, conf.getTitle(), val, conf.getFormatter());\n            return null;\n        }).on(\"mousemove\", (d, i, el) -> {\n            mapTooltip.move();\n            return null;\n        }).on(\"mouseleave\", (d, i, el) -> {\n            mapTooltip.hide();\n            return null;\n        }).on(\"click\", (d, i, el) -> {\n            countriesGeoJsonService.findEntry(data, countriesFeatures[i])\n                                   .ifPresent(v -> conf.getPathClickHandler().accept(v.getKey()));\n            return null;\n        });\n    }\n\n    private void addMarkers(Selection d3Selection, D3PathGenerator pathGenerator) {\n        int maxRadius = width / RADIUS_PROPORTION;\n        if (maxRadius < MIN_RADIUS) {\n            maxRadius = MIN_RADIUS + 1;\n        }\n        D3.Scale radiusScale = d3.scaleSqrt().domain(colorScale.domain())\n                                 .range(new Integer[]{MIN_RADIUS, maxRadius});\n        Object[] countriesNames = data.keySet().toArray();\n        d3Selection.append(\"g\").selectAll(\"circle\").data(countriesNames).enter().append(\"circle\")\n                   .attr(\"class\", \"data-circle\").style(\"fill\", (d, i, el) -> {\n                       double val = data.get(d);\n                       return colorScale.call(colorScale, val);\n                   }).attr(\"r\", (d, i, el) -> {\n                       Optional<Feature> path = countriesGeoJsonService.findCountry((String) d);\n                       if (path.isPresent()) {\n                           double val = data.get(d);\n                           return radiusScale.call(radiusScale, val);\n                       }\n                       return 0;\n                   }).attr(\"transform\", (d, i, el) -> {\n                       String translate = \"\";\n                       Optional<Feature> path = countriesGeoJsonService.findCountry((String) d);\n                       if (path.isPresent()) {\n                           double[] center = pathGenerator.centroid(path.get());\n                           translate = \"translate(\" + center[0] + \", \" + center[1] + \")\";\n                       }\n                       return translate;\n                   }).on(\"mouseenter\", (d, i, el) -> {\n                       Optional<Double> valOp = Optional.ofNullable(data.get(d));\n                       mapTooltip.show((String) d, conf.getTitle(), valOp, conf.getFormatter());\n                       return null;\n                   }).on(\"mousemove\", (d, i, el) -> {\n                       mapTooltip.move();\n                       return null;\n                   }).on(\"mouseleave\", (d, i, el) -> {\n                       mapTooltip.hide();\n                       return null;\n                   }).on(\"click\", (d, i, el) -> {\n                       conf.getPathClickHandler().accept((String) d);\n                       return null;\n                   });\n    }\n\n    private D3PathGenerator createPathGenerator() {\n        double w = (double) width;\n        double h = (double) height;\n        D3Projection projection = D3Projection.Builder.get().geoNaturalEarth2().scale(w / 5.5d)\n                                                      .translate(new double[]{w / 2d, h / 2d});\n        return D3PathGenerator.Builder.get().geoPath()\n                                      .projection(projection);\n    }\n\n    private void addTooltipElement() {\n        HTMLElement tooltipElement = mapTooltip.getElement();\n        boolean elementNotAdded = DomGlobal.document.getElementById(tooltipElement.id) == null;\n        if (elementNotAdded) {\n            DomGlobal.document.body.appendChild(tooltipElement);\n        }\n    }\n\n    private String buildLegendValue(Object d, int index) {\n        String[] values = getFormattedBoundaryValues(d);\n        int totalLegendColors = colorScale.range().length;\n        if (values[0].equals(values[1])) {\n            return values[0];\n        } else if (index + 1 == totalLegendColors) {\n            return \"> \" + values[0];\n        }\n        return \"< \" + values[1];\n    }\n\n    private String[] getFormattedBoundaryValues(Object color) {\n        Object[] values = colorScale.invertExtent(color);\n        String minStr = String.valueOf(values[0]);\n        String maxStr = String.valueOf(values[1]);\n        double max = Double.parseDouble(maxStr);\n        double min = Double.parseDouble(minStr);\n        return new String[]{conf.getFormatter().apply(min), conf.getFormatter().apply(max)};\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/MapTooltip.css",
    "content": ".mapTooltipContainer {\n    min-width: 100px;\n    min-height: 50px;\n    position: absolute;\n    pointer-events: none;\n    z-index: 10;\n    background-color: AliceBlue;\n    border-style: groove;\n    border-radius: 8px;\n    position: absolute;\n    font-size: 10px;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/MapTooltip.html",
    "content": "<div id=\"uniqueD3MapTooltip\" class=\"mapTooltipContainer\">\n<strong class=\"lblTooltipTitle\">Country Name</strong> <br />\n<span class=\"lblTooltipCategory\">Data</span><strong class=\"lblTooltipValue\">123456</strong>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/map/widgets/MapTooltip.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.widgets;\n\nimport java.util.Optional;\nimport java.util.function.Function;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.widgets.D3;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\n\n@Templated\n@ApplicationScoped\npublic class MapTooltip implements IsElement {\n    \n    @Inject @DataField\n    HTMLDivElement mapTooltipContainer;\n    \n    @Inject \n    @DataField\n    @Named(\"strong\")\n    HTMLElement lblTooltipTitle;\n    \n    @Inject \n    @DataField\n    @Named(\"span\")\n    HTMLElement lblTooltipCategory;\n    \n    @Inject \n    @DataField\n    @Named(\"strong\")\n    HTMLElement lblTooltipValue;\n    \n    private D3 d3 = D3.Builder.get();\n    \n    @PostConstruct\n    public void init() {\n        mapTooltipContainer.style.opacity = Js.cast(\"0\");\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return mapTooltipContainer;\n    }\n    \n    public void show(String title, String category, Optional<Double> data, Function<Double, String> formatter) {\n        d3.select(mapTooltipContainer).transition().duration(400).style(\"opacity\", \"0.9\");\n        lblTooltipTitle.textContent = title;\n        if (data.isPresent()) {\n            lblTooltipValue.style.visibility = \"visible\";\n            lblTooltipCategory.textContent = category + \": \";\n            lblTooltipValue.textContent = formatter.apply(data.get());\n        } else {\n            lblTooltipCategory.textContent = \"No data.\";\n            lblTooltipValue.style.visibility = \"hidden\";\n        }\n    }\n    \n    public void hide() {\n        d3.select(mapTooltipContainer).transition().duration(500).style(\"opacity\", \"0\");\n    }\n    \n    public void move() {\n        int x = d3.getEvent().getPageX() + 10;\n        int y = d3.getEvent().getPageY() - 40;\n        d3.select(mapTooltipContainer).style(\"left\", x + \"px\").style(\"top\", y + \"px\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/meter/C3MeterChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.meter;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Color;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Gauge;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Threshold;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tooltip;\n\n@Dependent\npublic class C3MeterChartDisplayer extends C3Displayer<C3Displayer.View> {\n    \n    \n    public interface View extends C3Displayer.View<C3MeterChartDisplayer> {\n\n        String[] getColorPattern();\n    }\n  \n    private View view;\n    \n    @Inject\n    public C3MeterChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory factory) {\n        super(filterLabelSet, factory);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(false)\n                .setGroupAllowed(true)\n                .setGroupColumn(true)\n                .setMaxColumns(2)\n                .setMinColumns(1)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setFunctionRequired(true)\n                .setColumnTypes(new ColumnType[] {ColumnType.NUMBER},\n                                new ColumnType[] {ColumnType.LABEL, ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.METER_GROUP);\n    }\n    \n    @Override\n    public View getView() {\n        return view;\n    }\n    \n    @Override\n    protected C3ChartConf buildConfiguration() {\n        C3ChartConf conf = super.buildConfiguration();\n        C3Gauge gaugeConf = createGauge();\n        C3Tooltip tooltip = factory.c3Tooltip(this::formatTooltip);\n        conf.setGauge(gaugeConf);\n        conf.setTooltip(tooltip);\n        return conf;\n    }\n    \n    @Override\n    protected String[][] createSeries() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String[][] output = new String[0][0];\n        if (columns.size() == 1) {\n            output = new String[1][];\n            output[0] = extractSingleColumnValues(columns.get(0));\n        } else {\n            DataColumn groupsColumn = columns.get(0);\n            DataColumn valuesColumn = columns.get(1);\n            output = extractGroupingValues(groupsColumn, valuesColumn);\n        }\n        return output;\n    }\n    \n    @Override\n    protected C3Color createColor() {\n        C3Color color = super.createColor();\n        int[] thresholdValues = {\n                (int) displayerSettings.getMeterWarning(),\n                (int) displayerSettings.getMeterCritical(),\n                (int) displayerSettings.getMeterEnd()\n        };\n        C3Threshold c3Threshold = factory.c3Threshold(thresholdValues);\n        color.setPattern(getView().getColorPattern());\n        color.setThreshold(c3Threshold);\n        return color;\n    }\n    \n    private C3Gauge createGauge() {\n        int meterStart = (int) displayerSettings.getMeterStart();\n        int meterEnd = (int) displayerSettings.getMeterEnd();\n        return factory.c3Gauge(meterStart, meterEnd);\n    }\n\n    String[][] extractGroupingValues(DataColumn groupsColumn, DataColumn valuesColumn) {\n        int n = groupsColumn.getValues().size();\n        ColumnSettings settings = displayerSettings.getColumnSettings(valuesColumn);\n        String[][] output = new String[n][2];\n        for (int i = 0; i < n; i++) {\n            Object group = groupsColumn.getValues().get(i);\n            Object value = valuesColumn.getValues().get(i);\n            output[i][0] = columnValueToString(group);\n            output[i][1] = evaluateValueToString(value, settings);\n        }\n        return output;\n    }\n\n    String[] extractSingleColumnValues(DataColumn dataColumn) {\n        List<?> values = dataColumn.getValues();\n        ColumnSettings settings = displayerSettings.getColumnSettings(dataColumn);\n        String[] data = new String[values.size() + 1];\n        data[0] = dataColumn.getId();\n        for (int i = 0; i < values.size(); i++) {\n            Object value = values.get(i);\n            data[i + 1] = evaluateValueToString(value, settings);\n        }\n        return data;\n    }\n    \n    protected Object formatTooltip(Long value, Object threshold, String data) {\n        List<DataColumn> columns = dataSet.getColumns();\n        int size = columns.size();\n        if (size == 1) {\n            return formatValueForColumn(value, columns.get(0));\n        }\n        if (size > 1) {\n            return formatValueForColumn(value, columns.get(1));\n        } \n        return value;\n    }\n\n    private Object formatValueForColumn(Long value, DataColumn targetColumn) {\n        String pattern = displayerSettings.getColumnSettings(targetColumn).getValuePattern();\n        return getFormatter().formatNumber(pattern, value);\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/meter/C3MeterView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.meter;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\n\npublic class C3MeterView \n      extends C3DisplayerView<C3MeterChartDisplayer> \n      implements C3MeterChartDisplayer.View {\n\n    private static final String RED = \"#FF0000\";\n    private static final String ORANGE = \"#F97600\";\n    private static final String GREEN = \"#60B044\";\n    String[] colors = {\n            GREEN,\n            ORANGE,\n            RED\n    };\n    \n    @Override\n    public String getType() {\n        return \"gauge\";\n    }\n\n    @Override\n    public String[] getColorPattern() {\n        return colors;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/pie/C3PieChartDisplayer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.pie;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.renderer.c3.client.C3Displayer;\nimport org.dashbuilder.renderer.c3.client.charts.CommonC3DisplayerConstants;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisX;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Donut;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\n\n@Dependent\npublic class C3PieChartDisplayer extends C3Displayer<C3PieChartDisplayer.View> {\n    \n    public interface View extends C3Displayer.View<C3PieChartDisplayer> {\n        \n        void setShowAsDonut(boolean showAsDonut);\n        \n    }\n    \n    private View view;\n\n    @Override\n    protected C3ChartConf buildConfiguration() {\n        C3ChartConf conf = super.buildConfiguration();\n        if (DisplayerSubType.DONUT == displayerSettings.getSubtype() &&\n                !StringUtils.isBlank(displayerSettings.getDonutHoleTitle())) {\n            C3Donut donutConf = createDonut();\n            conf.setDonut(donutConf);\n        }\n        return conf;\n    }\n\n    @Inject\n    public C3PieChartDisplayer(View view, FilterLabelSet filterLabelSet, C3JsTypesFactory builder) {\n        super(filterLabelSet, builder);\n        this.view = view;\n        this.view.init(this);\n    }\n    \n    @Override\n    public View getView() {\n        return view;\n    }\n    \n    public C3PieChartDisplayer donut() {\n        getView().setShowAsDonut(true);\n        return this;\n    }\n    \n    // In C3 we only need the series for PieCharts, categories are not needed\n    @Override\n    protected String[][] createSeries() {\n        List<DataColumn> columns = dataSet.getColumns();\n        String[][] data  = null;\n        // first columns hold the pie series name\n        DataColumn categoriesColumn = columns.get(0);\n        List<?> values = categoriesColumn.getValues();\n        data = new String[values.size()][];\n        // next columns hold the values for each series\n        for (int i = 0; i < values.size(); i++) {\n            String[] seriesValues = new String[columns.size()];\n            seriesValues[0] = super.formatValue(values.get(i), categoriesColumn);\n            for (int j = 1; j < columns.size(); j++) {\n                DataColumn dataColumn = columns.get(j);\n                seriesValues[j] = dataColumn.getValues().get(i).toString();\n            }\n            data[i] = seriesValues;\n        }\n        return data;\n    }\n    \n    @Override\n    protected C3AxisX createAxisX() {\n        return null;\n     }\n\n    @Override\n    protected String[] createCategories() {\n        return null;\n    }\n    \n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(2)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[]{\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new CommonC3DisplayerConstants(lookupConstraints).create()\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE);\n    }\n\n    protected C3Donut createDonut() {\n        String donutHoleTitle = displayerSettings.getDonutHoleTitle();\n        return factory.c3Donut(donutHoleTitle);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/charts/pie/C3PieChartView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.pie;\n\nimport org.dashbuilder.renderer.c3.client.C3DisplayerView;\n\npublic class C3PieChartView \n       extends C3DisplayerView<C3PieChartDisplayer>\n       implements C3PieChartDisplayer.View {\n\n    private boolean showAsDonut;\n\n    @Override\n    public String getType() {\n        return showAsDonut ? \"donut\" : \"pie\";\n    }\n\n    @Override\n    public void setShowAsDonut(boolean showAsDonut) {\n        this.showAsDonut = showAsDonut;\n        \n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/exports/NativeLibraryResources.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.exports;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\npublic interface NativeLibraryResources extends ClientBundle {\n\n    NativeLibraryResources INSTANCE = GWT.create(NativeLibraryResources.class);\n\n    @Source(\"js/c3.min.js\")\n    TextResource c3js();\n\n    @Source(\"js/d3-geo-projection.min.js\")\n    TextResource d3geoprojectionjs();    \n    \n    @Source(\"json/countries.geo.json\")\n    TextResource countriesgeojson();    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/exports/ResourcesInjector.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.exports;\n\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\n\nimport com.google.gwt.core.client.ScriptInjector;\n\npublic class ResourcesInjector {\n\n    static boolean c3Injected;\n    static boolean d3geoprojectionInjected;\n\n\n    public static void ensureC3Injected() {\n        if (!c3Injected) {\n            injectC3Resources();\n            c3Injected = true;\n        }\n    }\n    \n    public static void ensureD3GeoProjectionInjected() {\n        if (!d3geoprojectionInjected) {\n            injectD3GeoProjectionResources();\n            d3geoprojectionInjected = true;\n        }\n    }\n\n    private static void injectC3Resources() {\n        PatternFlyBootstrapper.ensureD3IsAvailable();\n        ScriptInjector.fromString(NativeLibraryResources.INSTANCE.c3js().getText())\n                        .setWindow(ScriptInjector.TOP_WINDOW)\n                        .inject();\n    }\n    \n    private static void injectD3GeoProjectionResources() {\n        PatternFlyBootstrapper.ensureD3IsAvailable();\n        ScriptInjector.fromString(NativeLibraryResources.INSTANCE.d3geoprojectionjs().getText())\n                        .setWindow(ScriptInjector.TOP_WINDOW)\n                        .inject();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"c3\")\npublic class C3 {\n    \n    @JsMethod\n    public static native C3Chart generate(C3ChartConf conf);\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3AxisInfo.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3AxisInfo {\n    \n    @JsOverlay\n    static C3AxisInfo create(boolean rotated, C3AxisX x, C3AxisY y) {\n        C3AxisInfo instance = new C3AxisInfo();\n        instance.setRotated(rotated);\n        instance.setX(x);\n        instance.setY(y);\n        return instance;\n    }\n    \n    @JsProperty\n    public native void setRotated(boolean rotated);\n    \n    @JsProperty\n    public native void setX(C3AxisX x);\n    \n    @JsProperty\n    public native C3AxisX getX();\n    \n    @JsProperty\n    public native void setY(C3AxisY y);\n    \n    @JsProperty\n    public native C3AxisY getY();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3AxisLabel.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3AxisLabel {\n    \n    @JsOverlay\n    static C3AxisLabel create(String text, String position) {\n        C3AxisLabel instance = new C3AxisLabel();\n        instance.setText(text);\n        instance.setPosition(position);\n        return instance;\n    }\n    \n    @JsProperty\n    public native void setText(String text);\n\n    \n    @JsProperty\n    public native void setPosition(String position);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3AxisX.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3AxisX {\n    \n    @JsOverlay\n    static C3AxisX create(String type, String[] categories, C3Tick tick) {\n        C3AxisX instance = new C3AxisX();\n        instance.setType(type);\n        instance.setCategories(categories);\n        instance.setTick(tick);\n        return instance;\n    }\n\n    @JsProperty\n    public native void setType(String type);\n    \n    @JsProperty\n    public native void setCategories(String categories[]);\n    \n    @JsProperty\n    public native void setTick(C3Tick tick);\n    \n    @JsProperty\n    public native C3Tick getTick();\n    \n    @JsProperty\n    public native void setShow(boolean show);\n    \n    @JsProperty\n    public native void setLabel(C3AxisLabel label);\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3AxisY.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3AxisY {\n    \n    @JsOverlay\n    static C3AxisY create(boolean show, C3Tick tick) {\n        C3AxisY instance = new C3AxisY();\n        instance.setShow(show);\n        instance.setTick(tick);\n        return instance;\n    }\n\n    @JsProperty\n    public native void setShow(boolean show);\n    \n    @JsProperty\n    public native void setTick(C3Tick tick);\n    \n    @JsProperty\n    public native C3Tick getTick();\n    \n    @JsProperty\n    public native void setLabel(C3AxisLabel label);    \n    \n        \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Chart.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport com.google.gwt.dom.client.DivElement;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Chart {\n    \n    @JsProperty\n    public native DivElement getElement();\n    \n    @JsProperty\n    public native C3Legend getLegend();\n    \n    @JsMethod\n    public native void flush();\n    \n    @JsMethod\n    public native void select(String[] points);\n    \n    \n    public native void focus(String points);\n    \n    @JsMethod\n    public native void defocus();\n    \n    @JsMethod\n    public native void resize();\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3ChartConf.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport com.google.gwt.user.client.Element;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * Bind the type that should be passed to c3.generate\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3ChartConf {  \n  \n    @JsOverlay\n    static C3ChartConf create(C3ChartSize size, \n                              C3ChartData data, \n                              C3AxisInfo axis,\n                              C3Grid grid,\n                              C3Transition transition,\n                              C3Point point,\n                              C3Padding padding,\n                              C3Legend legend,\n                              C3Color color) {\n        C3ChartConf instance = new C3ChartConf();\n        instance.setSize(size);\n        instance.setData(data);\n        instance.setAxis(axis);\n        instance.setGrid(grid);\n        instance.setTransition(transition);\n        instance.setPoint(point);\n        instance.setPadding(padding);\n        instance.setLegend(legend);\n        instance.setColor(color);\n        return instance;\n    }\n    \n    @JsOverlay\n    static C3ChartConf create(C3ChartSize size, \n                              C3ChartData data, \n                              C3AxisInfo axis,\n                              C3Grid grid,\n                              C3Transition transition,\n                              C3Point point,\n                              C3Padding padding,\n                              C3Legend legend,\n                              C3Color color,\n                              C3Tooltip tooltip) {\n        C3ChartConf instance = new C3ChartConf();\n        instance.setSize(size);\n        instance.setData(data);\n        instance.setAxis(axis);\n        instance.setGrid(grid);\n        instance.setTransition(transition);\n        instance.setPoint(point);\n        instance.setPadding(padding);\n        instance.setLegend(legend);\n        instance.setColor(color);\n        instance.setTooltip(tooltip);\n        return instance;\n    }    \n    \n    @JsProperty\n    public native void setBindto(Element element);\n    \n    @JsProperty\n    public native void setSize(C3ChartSize size);\n    \n    @JsProperty\n    public native void setData(C3ChartData data);\n    \n    @JsProperty\n    public native void setAxis(C3AxisInfo axis);\n    \n    @JsProperty\n    public native C3AxisInfo getAxis();\n    \n    @JsProperty\n    public native void setGrid(C3Grid grid);\n    \n    @JsProperty\n    public native void setTransition(C3Transition transition);\n    \n    @JsProperty\n    public native void setPoint(C3Point point);\n    \n    @JsProperty\n    public native void setPadding(C3Padding padding);\n\n    @JsProperty\n    public native void setLegend(C3Legend legend);\n    \n    @JsProperty\n    public native void setTooltip(C3Tooltip tooltip);    \n    \n    @JsProperty\n    public native void setOnrendered(RenderedCallback callback);\n    \n    \n    @JsFunction\n    @FunctionalInterface\n    public interface RenderedCallback {\n        \n        void callback();\n    \n    }\n    \n    @JsProperty\n    public native void setColor(C3Color color);    \n    \n    @JsProperty\n    public native void setGauge(C3Gauge gauge);\n\n    @JsProperty\n    public native void setDonut(C3Donut donut);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3ChartData.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport elemental2.core.JsObject;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3ChartData {\n    \n    @JsOverlay\n    static C3ChartData create(String[][] columns, \n                                     String type, \n                                     String[][] groups, \n                                     JsObject xs, \n                                     C3Selection selection) {\n        C3ChartData data = new C3ChartData();\n        data.setColumns(columns);\n        data.setType(type);\n        data.setGroups(groups);\n        data.setXs(xs);\n        data.setSelection(selection);\n        return data;\n    }\n    \n    @JsProperty\n    public native void setColumns(String columns[][]);\n\n    @JsProperty\n    public native void setType(String type);\n    \n    @JsProperty\n    public native void setGroups(String groups[][]); \n    \n    @JsProperty\n    public native void setXs(JsObject xs);\n    \n    @JsProperty\n    public native void setOrder(String order);\n    \n    @JsProperty\n    public native void setOnselected(SelectCallback callback);\n    \n    @JsProperty\n    public native void setOnunselected(SelectCallback callback);\n    \n    @JsProperty\n    public native void setSelection(C3Selection selection);\n    \n    @JsFunction\n    @FunctionalInterface\n    public static interface SelectCallback {\n        \n        void callback(C3DataInfo data);\n    \n    }\n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3ChartSize.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3ChartSize {\n    \n    @JsOverlay\n    static C3ChartSize create(double width, double height) {\n        C3ChartSize instance = new C3ChartSize();\n        instance.setWidth(width);\n        instance.setHeight(height);\n        return instance;\n    }\n\n\n    @JsProperty\n    public native void setWidth(double width);\n\n    @JsProperty\n    public native void setHeight(double height);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Color.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Color {\n    \n    @JsOverlay\n    static C3Color create(String[] pattern, C3Threshold threshold) {\n        C3Color color = new C3Color();\n        color.setPattern(pattern);\n        color.setThreshold(threshold);\n        return color;\n    }\n    \n    @JsOverlay\n    static C3Color create(String[] pattern) {\n        C3Color color = new C3Color();\n        color.setPattern(pattern);\n        return color;\n    }\n    \n    @JsProperty\n    public native void setPattern(String[] pattern); \n    \n    @JsProperty\n    public native void setThreshold(C3Threshold threshold); \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3DataInfo.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3DataInfo {\n    \n    @JsProperty\n    public native String getId();\n    \n    @JsProperty\n    public native int getIndex();\n    \n    @JsProperty\n    public native String getX();\n    \n    @JsProperty\n    public native String getValue();\n    \n    @JsProperty\n    public native String getName();\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Donut.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Donut {\n\n    @JsOverlay\n    static C3Donut create(String title) {\n        C3Donut data = new C3Donut();\n        data.setTitle(title);\n        return data;\n    }\n\n    @JsProperty\n    public native void setTitle(String title);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Format.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n *\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Format {\n    \n    @JsOverlay\n    static C3Format create(FormatCallback callback) {\n        C3Format format = new C3Format();\n        format.setValue(callback);\n        return format;\n    }\n    \n    @JsProperty\n    public native void setValue(FormatCallback callback);\n    \n    @JsFunction\n    @FunctionalInterface\n    public interface FormatCallback {\n        \n        Object callback(Long value, Object ratio, String data);\n    \n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Gauge.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Gauge {\n    \n    @JsOverlay\n    static C3Gauge create(int min, int max) {\n        C3Gauge gauge = new C3Gauge();\n        gauge.setMin(min);\n        gauge.setMax(max);\n        return gauge;\n    }\n    \n    @JsProperty\n    public native void setMin(int min); \n\n    @JsProperty\n    public native void setMax(int max);\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Grid.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Grid {\n    \n    @JsOverlay\n    static C3Grid create(C3GridConf x , C3GridConf y) {\n        C3Grid instance = new C3Grid();\n        instance.setX(x);\n        instance.setY(y);\n        return instance;\n    }\n    \n    @JsProperty\n    public native void setX(C3GridConf x);\n\n    \n    @JsProperty\n    public native void setY(C3GridConf y);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3GridConf.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3GridConf {\n    \n    @JsOverlay\n    static C3GridConf create(boolean show) {\n        C3GridConf instance = new C3GridConf();\n        instance.setShow(show);\n        return instance;\n    }\n    \n    @JsProperty\n    public native void setShow(boolean show);\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3JsTypesFactory.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Point.RadiusCallback;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tick.FormatterCallback;\n\nimport elemental2.core.JsObject;\n\n/**\n * Build C3 JS Types\n */\n@ApplicationScoped\npublic class C3JsTypesFactory {\n    \n    public C3Tick createC3Tick(FormatterCallback callback) {\n        C3Tick instance = new C3Tick();\n        instance.setFormat(callback);\n        return instance;\n    }\n    \n    public C3Grid c3Grid(boolean showX, boolean showY) {\n        return C3Grid.create(C3GridConf.create(showX), \n                             C3GridConf.create(showY));\n    }\n\n    public C3Padding c3Padding(int top, int right, \n                               int bottom, int left) {\n        return C3Padding.create(top, right, bottom, left);\n    }\n\n    public C3ChartSize c3ChartSize(double width, double height) {\n        return C3ChartSize.create(width, height);\n    }\n\n    public C3Selection c3Selection(boolean enabled, boolean multiple, \n                                   boolean grouped) {\n        return C3Selection.create(enabled, multiple, grouped);\n    }\n\n    public C3AxisY c3AxisY(boolean show, C3Tick tickY) {\n        return C3AxisY.create(show, tickY);\n    }\n    public C3AxisX c3AxisX(String type, String[] categories, C3Tick tick) {\n        return C3AxisX.create(type, categories, tick);\n    }\n    \n    \n    public C3Legend c3Legend(boolean show, String position) {\n        return C3Legend.create(show, position);\n    }\n\n    public C3Point c3Point(RadiusCallback r) {\n        return C3Point.create(r);\n    }\n\n    public C3ChartData c3ChartData(String[][] columns, String type, \n                                   String[][] groups, JsObject xs,\n                                   C3Selection selection) {\n        return C3ChartData.create(columns, type, groups, xs, selection);\n    }\n\n    public C3AxisInfo c3AxisInfo(boolean rotated, C3AxisX axisX, C3AxisY axisY) {\n        return C3AxisInfo.create(rotated, axisX, axisY);\n    }\n\n\n\n    public C3ChartConf c3ChartConf(C3ChartSize size, \n                                   C3ChartData data, \n                                   C3AxisInfo axis, \n                                   C3Grid grid,\n                                   C3Transition transition, \n                                   C3Point point, \n                                   C3Padding padding, \n                                   C3Legend legend,\n                                   C3Color color) {\n        return C3ChartConf.create(size, data, axis, grid, transition, point, padding, legend, color);\n    }\n\n    public C3Transition c3Transition(int duration) {\n        return C3Transition.create(duration);\n    }\n\n    public C3AxisLabel createC3Label(String text, String position) {\n        return C3AxisLabel.create(text, position);\n    }\n    \n    public C3Color c3Color(String[] pattern) {\n        return C3Color.create(pattern);\n    }\n    \n    public C3Color c3Color(String[] pattern, C3Threshold threshold) {\n        return C3Color.create(pattern, threshold);\n    }\n    \n    public C3Threshold c3Threshold(int[] values) {\n        return C3Threshold.create(values);\n    }\n    \n    public C3Gauge c3Gauge(int min, int max) {\n        return C3Gauge.create(min, max);\n    }\n\n    public C3Donut c3Donut(String holeTitle) {\n        return C3Donut.create(holeTitle);\n    }\n\n    public C3Tooltip c3Tooltip(C3Format.FormatCallback callback) {\n        C3Format format = C3Format.create(callback);\n        return C3Tooltip.create(format);\n    }    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Legend.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport org.dashbuilder.displayer.Position;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Legend {\n    \n    @JsOverlay\n    static C3Legend create(boolean show, String position) {\n        C3Legend instance = new C3Legend();\n        instance.setShow(show);\n        instance.setPosition(position);\n        return instance;\n    }\n    \n    @JsOverlay\n    public static String convertPosition(Position position) {\n        // Not all positions are supported by C3.\n        switch(position) {\n        case BOTTOM:\n            return position.name().toLowerCase();\n        case IN:\n            return \"inset\";\n        case RIGHT:\n            return position.name().toLowerCase();\n        default:\n            return \"\";\n        }\n    }\n    \n    @JsProperty\n    public native void setShow(boolean show);\n    \n    @JsProperty\n    public native void setPosition(String position);\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Padding.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Padding {\n    \n    @JsOverlay\n    static C3Padding create(int top, int right, int bottom, int left ) {\n        C3Padding instance = new C3Padding();\n        instance.setTop(top);\n        instance.setRight(right);\n        instance.setBottom(bottom);\n        instance.setLeft(left);\n        return instance;\n    }\n    \n    @JsProperty\n    public native void setTop(int top);\n    \n    @JsProperty\n    public native void setRight(int right);\n    \n    @JsProperty\n    public native void setBottom(int bottom);\n    \n    @JsProperty\n    public native void setLeft(int left);\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Point.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Point {\n    \n    @JsOverlay\n    static C3Point create(RadiusCallback r) {\n        C3Point instance = new C3Point();\n        instance.setR(r);\n        return instance;\n    }\n\n    @JsProperty\n    public native void setR(RadiusCallback callback);\n\n    @JsFunction\n    @FunctionalInterface\n    public interface RadiusCallback {\n        \n        double callback(C3DataInfo value);\n    \n    }\n        \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Selection.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Selection {\n    \n    @JsOverlay\n    static C3Selection create(boolean enabled, boolean multiple, boolean grouped) {\n        C3Selection c3Selection = new C3Selection();\n        c3Selection.setEnabled(enabled);\n        c3Selection.setMultiple(multiple);\n        c3Selection.setGrouped(grouped);\n        return c3Selection;\n    }\n    \n    @JsProperty\n    public native void setEnabled(boolean enabled);\n\n    @JsProperty\n    public native void setMultiple(boolean multiple);\n    \n    @JsProperty\n    public native void setGrouped(boolean grouped);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Threshold.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Threshold {\n    \n    @JsOverlay\n    static C3Threshold create(int[] values) {\n        C3Threshold threshold = new C3Threshold();\n        threshold.setValues(values);\n        return threshold;\n    }\n\n    @JsProperty\n    public native void setValues(int[] values); \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Tick.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Tick {\n    \n    @JsOverlay\n    static C3Tick create(FormatterCallback callback) {\n        C3Tick instance = new C3Tick();\n        instance.setFormat(callback);\n        return instance;\n    }\n\n    @JsProperty\n    public native void setFormat(FormatterCallback callback);\n    \n    @JsProperty\n    public native void setFit(boolean fit);\n    \n    @JsProperty\n    public native void setRotate(int rotate);\n\n    @JsFunction\n    @FunctionalInterface\n    public interface FormatterCallback {\n        \n        String callback(String value);\n    \n    }\n        \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Tooltip.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Tooltip {\n    \n    @JsOverlay\n    static C3Tooltip create(C3Format format) {\n        C3Tooltip tooltip = new C3Tooltip();\n        tooltip.setFormat(format);\n        return tooltip;\n    }\n    \n    @JsProperty\n    public native void setFormat(C3Format format); \n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/C3Transition.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class C3Transition {\n    \n    @JsOverlay\n    public static C3Transition create(int duration) {\n        C3Transition instance = new C3Transition();\n        instance.setDuration(duration);\n        return instance;\n    }\n\n\n    @JsProperty\n    public native void setDuration(int duration);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/d3/D3PathGenerator.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.d3;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic interface D3PathGenerator {\n    \n    D3PathGenerator projection(D3Projection projection);\n    \n    D3PathGenerator geoPath();\n    \n    double[] centroid(Object path);\n    \n    class Builder {\n\n        @JsProperty(name = \"d3\", namespace = JsPackage.GLOBAL)\n        public static native D3PathGenerator get();\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/d3/D3Projection.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.d3;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic interface D3Projection  {\n    \n    public D3Projection geoNaturalEarth2();\n    \n    public D3Projection geoCylindricalEqualArea();\n    \n    public D3Projection geoMercator();\n    \n    public D3Projection scale(double s);\n    \n    public D3Projection translate(double xy[]);\n    \n    class Builder {\n\n        @JsProperty(name = \"d3\", namespace = JsPackage.GLOBAL)\n        public static native D3Projection get();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/geojson/Feature.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.geojson;\n\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\nimport jsinterop.base.JsPropertyMap;\n\n@JsType(isNative = true)\npublic interface Feature {\n\n    @JsProperty\n    public String getType();\n    @JsProperty\n    public Geometry getGeometry();\n    @JsProperty\n    public JsPropertyMap<Object> getProperties();\n    @JsProperty\n    public String getId();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/geojson/FeatureCollection.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.geojson;\n\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic interface FeatureCollection {\n    @JsProperty\n    public String getType();\n    @JsProperty\n    public Feature[] getFeatures();\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/geojson/Geometry.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.geojson;\n\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic interface Geometry {\n    \n    @JsProperty\n    public GeometryType getType();\n    @JsProperty\n    public double[][][] getCoordinates();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/jsbinding/geojson/GeometryType.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.jsbinding.geojson;\n\npublic enum GeometryType {\n    Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface C3DisplayerConstants extends Messages {\n\n    public static final C3DisplayerConstants INSTANCE = GWT.create( C3DisplayerConstants.class );\n\n    String common_Categories();\n\n    String common_Series();\n\n    String common_Values();\n\n    String common_Value();\n\n    String common_Locations();\n\n    String common_Rows();\n\n    String common_Columns();\n\n    String common_noData();\n\n    String googleDisplayer_resetAnchor();\n\n    String googleBubbleDisplayer_XAxis();\n\n    String googleBubbleDisplayer_YAxis();\n\n    String googleBubbleDisplayer_BubbleColor();\n\n    String googleBubbleDisplayer_BubbleSize();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/java/org/dashbuilder/renderer/c3/mutationobserver/MutationObserverFactory.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.mutationobserver;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport elemental2.dom.MutationObserver;\nimport elemental2.dom.MutationObserver.MutationObserverCallbackFn;\nimport elemental2.dom.MutationObserverInit;\n\n@ApplicationScoped\npublic class MutationObserverFactory {\n\n    public MutationObserverInit mutationObserverInit() {\n        return MutationObserverInit.create();\n    }\n\n    public MutationObserver mutationObserver(MutationObserverCallbackFn callback) {\n        return new MutationObserver(callback);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.renderer.c3.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/C3Renderer.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path='c3'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/exports/json/countries.geo.json",
    "content": "{\"type\":\"FeatureCollection\",\"features\":[\n{\"type\":\"Feature\",\"id\":\"AFG\",\"properties\":{\"name\":\"Afghanistan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[61.210817,35.650072],[62.230651,35.270664],[62.984662,35.404041],[63.193538,35.857166],[63.982896,36.007957],[64.546479,36.312073],[64.746105,37.111818],[65.588948,37.305217],[65.745631,37.661164],[66.217385,37.39379],[66.518607,37.362784],[67.075782,37.356144],[67.83,37.144994],[68.135562,37.023115],[68.859446,37.344336],[69.196273,37.151144],[69.518785,37.608997],[70.116578,37.588223],[70.270574,37.735165],[70.376304,38.138396],[70.806821,38.486282],[71.348131,38.258905],[71.239404,37.953265],[71.541918,37.905774],[71.448693,37.065645],[71.844638,36.738171],[72.193041,36.948288],[72.63689,37.047558],[73.260056,37.495257],[73.948696,37.421566],[74.980002,37.41999],[75.158028,37.133031],[74.575893,37.020841],[74.067552,36.836176],[72.920025,36.720007],[71.846292,36.509942],[71.262348,36.074388],[71.498768,35.650563],[71.613076,35.153203],[71.115019,34.733126],[71.156773,34.348911],[70.881803,33.988856],[69.930543,34.02012],[70.323594,33.358533],[69.687147,33.105499],[69.262522,32.501944],[69.317764,31.901412],[68.926677,31.620189],[68.556932,31.71331],[67.792689,31.58293],[67.683394,31.303154],[66.938891,31.304911],[66.381458,30.738899],[66.346473,29.887943],[65.046862,29.472181],[64.350419,29.560031],[64.148002,29.340819],[63.550261,29.468331],[62.549857,29.318572],[60.874248,29.829239],[61.781222,30.73585],[61.699314,31.379506],[60.941945,31.548075],[60.863655,32.18292],[60.536078,32.981269],[60.9637,33.528832],[60.52843,33.676446],[60.803193,34.404102],[61.210817,35.650072]]]}},\n{\"type\":\"Feature\",\"id\":\"AGO\",\"properties\":{\"name\":\"Angola\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[16.326528,-5.87747],[16.57318,-6.622645],[16.860191,-7.222298],[17.089996,-7.545689],[17.47297,-8.068551],[18.134222,-7.987678],[18.464176,-7.847014],[19.016752,-7.988246],[19.166613,-7.738184],[19.417502,-7.155429],[20.037723,-7.116361],[20.091622,-6.94309],[20.601823,-6.939318],[20.514748,-7.299606],[21.728111,-7.290872],[21.746456,-7.920085],[21.949131,-8.305901],[21.801801,-8.908707],[21.875182,-9.523708],[22.208753,-9.894796],[22.155268,-11.084801],[22.402798,-10.993075],[22.837345,-11.017622],[23.456791,-10.867863],[23.912215,-10.926826],[24.017894,-11.237298],[23.904154,-11.722282],[24.079905,-12.191297],[23.930922,-12.565848],[24.016137,-12.911046],[21.933886,-12.898437],[21.887843,-16.08031],[22.562478,-16.898451],[23.215048,-17.523116],[21.377176,-17.930636],[18.956187,-17.789095],[18.263309,-17.309951],[14.209707,-17.353101],[14.058501,-17.423381],[13.462362,-16.971212],[12.814081,-16.941343],[12.215461,-17.111668],[11.734199,-17.301889],[11.640096,-16.673142],[11.778537,-15.793816],[12.123581,-14.878316],[12.175619,-14.449144],[12.500095,-13.5477],[12.738479,-13.137906],[13.312914,-12.48363],[13.633721,-12.038645],[13.738728,-11.297863],[13.686379,-10.731076],[13.387328,-10.373578],[13.120988,-9.766897],[12.87537,-9.166934],[12.929061,-8.959091],[13.236433,-8.562629],[12.93304,-7.596539],[12.728298,-6.927122],[12.227347,-6.294448],[12.322432,-6.100092],[12.735171,-5.965682],[13.024869,-5.984389],[13.375597,-5.864241],[16.326528,-5.87747]]],[[[12.436688,-5.684304],[12.182337,-5.789931],[11.914963,-5.037987],[12.318608,-4.60623],[12.62076,-4.438023],[12.995517,-4.781103],[12.631612,-4.991271],[12.468004,-5.248362],[12.436688,-5.684304]]]]}},\n{\"type\":\"Feature\",\"id\":\"ALB\",\"properties\":{\"name\":\"Albania\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[20.590247,41.855404],[20.463175,41.515089],[20.605182,41.086226],[21.02004,40.842727],[20.99999,40.580004],[20.674997,40.435],[20.615,40.110007],[20.150016,39.624998],[19.98,39.694993],[19.960002,39.915006],[19.406082,40.250773],[19.319059,40.72723],[19.40355,41.409566],[19.540027,41.719986],[19.371769,41.877548],[19.304486,42.195745],[19.738051,42.688247],[19.801613,42.500093],[20.0707,42.58863],[20.283755,42.32026],[20.52295,42.21787],[20.590247,41.855404]]]}},\n{\"type\":\"Feature\",\"id\":\"ARE\",\"properties\":{\"name\":\"United Arab Emirates\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[51.579519,24.245497],[51.757441,24.294073],[51.794389,24.019826],[52.577081,24.177439],[53.404007,24.151317],[54.008001,24.121758],[54.693024,24.797892],[55.439025,25.439145],[56.070821,26.055464],[56.261042,25.714606],[56.396847,24.924732],[55.886233,24.920831],[55.804119,24.269604],[55.981214,24.130543],[55.528632,23.933604],[55.525841,23.524869],[55.234489,23.110993],[55.208341,22.70833],[55.006803,22.496948],[52.000733,23.001154],[51.617708,24.014219],[51.579519,24.245497]]]}},\n{\"type\":\"Feature\",\"id\":\"ARG\",\"properties\":{\"name\":\"Argentina\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-65.5,-55.2],[-66.45,-55.25],[-66.95992,-54.89681],[-67.56244,-54.87001],[-68.63335,-54.8695],[-68.63401,-52.63637],[-68.25,-53.1],[-67.75,-53.85],[-66.45,-54.45],[-65.05,-54.7],[-65.5,-55.2]]],[[[-64.964892,-22.075862],[-64.377021,-22.798091],[-63.986838,-21.993644],[-62.846468,-22.034985],[-62.685057,-22.249029],[-60.846565,-23.880713],[-60.028966,-24.032796],[-58.807128,-24.771459],[-57.777217,-25.16234],[-57.63366,-25.603657],[-58.618174,-27.123719],[-57.60976,-27.395899],[-56.486702,-27.548499],[-55.695846,-27.387837],[-54.788795,-26.621786],[-54.625291,-25.739255],[-54.13005,-25.547639],[-53.628349,-26.124865],[-53.648735,-26.923473],[-54.490725,-27.474757],[-55.162286,-27.881915],[-56.2909,-28.852761],[-57.625133,-30.216295],[-57.874937,-31.016556],[-58.14244,-32.044504],[-58.132648,-33.040567],[-58.349611,-33.263189],[-58.427074,-33.909454],[-58.495442,-34.43149],[-57.22583,-35.288027],[-57.362359,-35.97739],[-56.737487,-36.413126],[-56.788285,-36.901572],[-57.749157,-38.183871],[-59.231857,-38.72022],[-61.237445,-38.928425],[-62.335957,-38.827707],[-62.125763,-39.424105],[-62.330531,-40.172586],[-62.145994,-40.676897],[-62.745803,-41.028761],[-63.770495,-41.166789],[-64.73209,-40.802677],[-65.118035,-41.064315],[-64.978561,-42.058001],[-64.303408,-42.359016],[-63.755948,-42.043687],[-63.458059,-42.563138],[-64.378804,-42.873558],[-65.181804,-43.495381],[-65.328823,-44.501366],[-65.565269,-45.036786],[-66.509966,-45.039628],[-67.293794,-45.551896],[-67.580546,-46.301773],[-66.597066,-47.033925],[-65.641027,-47.236135],[-65.985088,-48.133289],[-67.166179,-48.697337],[-67.816088,-49.869669],[-68.728745,-50.264218],[-69.138539,-50.73251],[-68.815561,-51.771104],[-68.149995,-52.349983],[-68.571545,-52.299444],[-69.498362,-52.142761],[-71.914804,-52.009022],[-72.329404,-51.425956],[-72.309974,-50.67701],[-72.975747,-50.74145],[-73.328051,-50.378785],[-73.415436,-49.318436],[-72.648247,-48.878618],[-72.331161,-48.244238],[-72.447355,-47.738533],[-71.917258,-46.884838],[-71.552009,-45.560733],[-71.659316,-44.973689],[-71.222779,-44.784243],[-71.329801,-44.407522],[-71.793623,-44.207172],[-71.464056,-43.787611],[-71.915424,-43.408565],[-72.148898,-42.254888],[-71.746804,-42.051386],[-71.915734,-40.832339],[-71.680761,-39.808164],[-71.413517,-38.916022],[-70.814664,-38.552995],[-71.118625,-37.576827],[-71.121881,-36.658124],[-70.364769,-36.005089],[-70.388049,-35.169688],[-69.817309,-34.193571],[-69.814777,-33.273886],[-70.074399,-33.09121],[-70.535069,-31.36501],[-69.919008,-30.336339],[-70.01355,-29.367923],[-69.65613,-28.459141],[-69.001235,-27.521214],[-68.295542,-26.89934],[-68.5948,-26.506909],[-68.386001,-26.185016],[-68.417653,-24.518555],[-67.328443,-24.025303],[-66.985234,-22.986349],[-67.106674,-22.735925],[-66.273339,-21.83231],[-64.964892,-22.075862]]]]}},\n{\"type\":\"Feature\",\"id\":\"ARM\",\"properties\":{\"name\":\"Armenia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[43.582746,41.092143],[44.97248,41.248129],[45.179496,40.985354],[45.560351,40.81229],[45.359175,40.561504],[45.891907,40.218476],[45.610012,39.899994],[46.034534,39.628021],[46.483499,39.464155],[46.50572,38.770605],[46.143623,38.741201],[45.735379,39.319719],[45.739978,39.473999],[45.298145,39.471751],[45.001987,39.740004],[44.79399,39.713003],[44.400009,40.005],[43.656436,40.253564],[43.752658,40.740201],[43.582746,41.092143]]]}},\n{\"type\":\"Feature\",\"id\":\"ATA\",\"properties\":{\"name\":\"Antarctica\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-59.572095,-80.040179],[-59.865849,-80.549657],[-60.159656,-81.000327],[-62.255393,-80.863178],[-64.488125,-80.921934],[-65.741666,-80.588827],[-65.741666,-80.549657],[-66.290031,-80.255773],[-64.037688,-80.294944],[-61.883246,-80.39287],[-61.138976,-79.981371],[-60.610119,-79.628679],[-59.572095,-80.040179]]],[[[-159.208184,-79.497059],[-161.127601,-79.634209],[-162.439847,-79.281465],[-163.027408,-78.928774],[-163.066604,-78.869966],[-163.712896,-78.595667],[-163.105801,-78.223338],[-161.245113,-78.380176],[-160.246208,-78.693645],[-159.482405,-79.046338],[-159.208184,-79.497059]]],[[[-45.154758,-78.04707],[-43.920828,-78.478103],[-43.48995,-79.08556],[-43.372438,-79.516645],[-43.333267,-80.026123],[-44.880537,-80.339644],[-46.506174,-80.594357],[-48.386421,-80.829485],[-50.482107,-81.025442],[-52.851988,-80.966685],[-54.164259,-80.633528],[-53.987991,-80.222028],[-51.853134,-79.94773],[-50.991326,-79.614623],[-50.364595,-79.183487],[-49.914131,-78.811209],[-49.306959,-78.458569],[-48.660616,-78.047018],[-48.660616,-78.047019],[-48.151396,-78.04707],[-46.662857,-77.831476],[-45.154758,-78.04707]]],[[[-121.211511,-73.50099],[-119.918851,-73.657725],[-118.724143,-73.481353],[-119.292119,-73.834097],[-120.232217,-74.08881],[-121.62283,-74.010468],[-122.621735,-73.657778],[-122.621735,-73.657777],[-122.406245,-73.324619],[-121.211511,-73.50099]]],[[[-125.559566,-73.481353],[-124.031882,-73.873268],[-124.619469,-73.834097],[-125.912181,-73.736118],[-127.28313,-73.461769],[-127.28313,-73.461768],[-126.558472,-73.246226],[-125.559566,-73.481353]]],[[[-98.98155,-71.933334],[-97.884743,-72.070535],[-96.787937,-71.952971],[-96.20035,-72.521205],[-96.983765,-72.442864],[-98.198083,-72.482035],[-99.432013,-72.442864],[-100.783455,-72.50162],[-101.801868,-72.305663],[-102.330725,-71.894164],[-101.703967,-71.717792],[-100.430919,-71.854993],[-98.98155,-71.933334]]],[[[-68.451346,-70.955823],[-68.333834,-71.406493],[-68.510128,-71.798407],[-68.784297,-72.170736],[-69.959471,-72.307885],[-71.075889,-72.503842],[-72.388134,-72.484257],[-71.8985,-72.092343],[-73.073622,-72.229492],[-74.19004,-72.366693],[-74.953895,-72.072757],[-75.012625,-71.661258],[-73.915819,-71.269345],[-73.915819,-71.269344],[-73.230331,-71.15178],[-72.074717,-71.190951],[-71.780962,-70.681473],[-71.72218,-70.309196],[-71.741791,-69.505782],[-71.173815,-69.035475],[-70.253252,-68.87874],[-69.724447,-69.251017],[-69.489422,-69.623346],[-69.058518,-70.074016],[-68.725541,-70.505153],[-68.451346,-70.955823]]],[[[-58.614143,-64.152467],[-59.045073,-64.36801],[-59.789342,-64.211223],[-60.611928,-64.309202],[-61.297416,-64.54433],[-62.0221,-64.799094],[-62.51176,-65.09303],[-62.648858,-65.484942],[-62.590128,-65.857219],[-62.120079,-66.190326],[-62.805567,-66.425505],[-63.74569,-66.503847],[-64.294106,-66.837004],[-64.881693,-67.150474],[-65.508425,-67.58161],[-65.665082,-67.953887],[-65.312545,-68.365335],[-64.783715,-68.678908],[-63.961103,-68.913984],[-63.1973,-69.227556],[-62.785955,-69.619419],[-62.570516,-69.991747],[-62.276736,-70.383661],[-61.806661,-70.716768],[-61.512906,-71.089045],[-61.375809,-72.010074],[-61.081977,-72.382351],[-61.003661,-72.774265],[-60.690269,-73.166179],[-60.827367,-73.695242],[-61.375809,-74.106742],[-61.96337,-74.439848],[-63.295201,-74.576997],[-63.74569,-74.92974],[-64.352836,-75.262847],[-65.860987,-75.635124],[-67.192818,-75.79191],[-68.446282,-76.007452],[-69.797724,-76.222995],[-70.600724,-76.634494],[-72.206776,-76.673665],[-73.969536,-76.634494],[-75.555977,-76.712887],[-77.24037,-76.712887],[-76.926979,-77.104802],[-75.399294,-77.28107],[-74.282876,-77.55542],[-73.656119,-77.908112],[-74.772536,-78.221633],[-76.4961,-78.123654],[-77.925858,-78.378419],[-77.984666,-78.789918],[-78.023785,-79.181833],[-76.848637,-79.514939],[-76.633224,-79.887216],[-75.360097,-80.259545],[-73.244852,-80.416331],[-71.442946,-80.69063],[-70.013163,-81.004151],[-68.191646,-81.317672],[-65.704279,-81.474458],[-63.25603,-81.748757],[-61.552026,-82.042692],[-59.691416,-82.37585],[-58.712121,-82.846106],[-58.222487,-83.218434],[-57.008117,-82.865691],[-55.362894,-82.571755],[-53.619771,-82.258235],[-51.543644,-82.003521],[-49.76135,-81.729171],[-47.273931,-81.709586],[-44.825708,-81.846735],[-42.808363,-82.081915],[-42.16202,-81.65083],[-40.771433,-81.356894],[-38.244818,-81.337309],[-36.26667,-81.121715],[-34.386397,-80.906172],[-32.310296,-80.769023],[-30.097098,-80.592651],[-28.549802,-80.337938],[-29.254901,-79.985195],[-29.685805,-79.632503],[-29.685805,-79.260226],[-31.624808,-79.299397],[-33.681324,-79.456132],[-35.639912,-79.456132],[-35.914107,-79.083855],[-35.77701,-78.339248],[-35.326546,-78.123654],[-33.896763,-77.888526],[-32.212369,-77.65345],[-30.998051,-77.359515],[-29.783732,-77.065579],[-28.882779,-76.673665],[-27.511752,-76.497345],[-26.160336,-76.360144],[-25.474822,-76.281803],[-23.927552,-76.24258],[-22.458598,-76.105431],[-21.224694,-75.909474],[-20.010375,-75.674346],[-18.913543,-75.439218],[-17.522982,-75.125698],[-16.641589,-74.79254],[-15.701491,-74.498604],[-15.40771,-74.106742],[-16.46532,-73.871614],[-16.112784,-73.460114],[-15.446855,-73.146542],[-14.408805,-72.950585],[-13.311973,-72.715457],[-12.293508,-72.401936],[-11.510067,-72.010074],[-11.020433,-71.539767],[-10.295774,-71.265416],[-9.101015,-71.324224],[-8.611381,-71.65733],[-7.416622,-71.696501],[-7.377451,-71.324224],[-6.868232,-70.93231],[-5.790985,-71.030289],[-5.536375,-71.402617],[-4.341667,-71.461373],[-3.048981,-71.285053],[-1.795492,-71.167438],[-0.659489,-71.226246],[-0.228637,-71.637745],[0.868195,-71.304639],[1.886686,-71.128267],[3.022638,-70.991118],[4.139055,-70.853917],[5.157546,-70.618789],[6.273912,-70.462055],[7.13572,-70.246512],[7.742866,-69.893769],[8.48711,-70.148534],[9.525135,-70.011333],[10.249845,-70.48164],[10.817821,-70.834332],[11.953824,-70.638375],[12.404287,-70.246512],[13.422778,-69.972162],[14.734998,-70.030918],[15.126757,-70.403247],[15.949342,-70.030918],[17.026589,-69.913354],[18.201711,-69.874183],[19.259373,-69.893769],[20.375739,-70.011333],[21.452985,-70.07014],[21.923034,-70.403247],[22.569403,-70.697182],[23.666184,-70.520811],[24.841357,-70.48164],[25.977309,-70.48164],[27.093726,-70.462055],[28.09258,-70.324854],[29.150242,-70.20729],[30.031583,-69.93294],[30.971733,-69.75662],[31.990172,-69.658641],[32.754053,-69.384291],[33.302443,-68.835642],[33.870419,-68.502588],[34.908495,-68.659271],[35.300202,-69.012014],[36.16201,-69.247142],[37.200035,-69.168748],[37.905108,-69.52144],[38.649404,-69.776205],[39.667894,-69.541077],[40.020431,-69.109941],[40.921358,-68.933621],[41.959434,-68.600514],[42.938702,-68.463313],[44.113876,-68.267408],[44.897291,-68.051866],[45.719928,-67.816738],[46.503343,-67.601196],[47.44344,-67.718759],[48.344419,-67.366068],[48.990736,-67.091718],[49.930885,-67.111303],[50.753471,-66.876175],[50.949325,-66.523484],[51.791547,-66.249133],[52.614133,-66.053176],[53.613038,-65.89639],[54.53355,-65.818049],[55.414943,-65.876805],[56.355041,-65.974783],[57.158093,-66.249133],[57.255968,-66.680218],[58.137361,-67.013324],[58.744508,-67.287675],[59.939318,-67.405239],[60.605221,-67.679589],[61.427806,-67.953887],[62.387489,-68.012695],[63.19049,-67.816738],[64.052349,-67.405239],[64.992447,-67.620729],[65.971715,-67.738345],[66.911864,-67.855909],[67.891133,-67.934302],[68.890038,-67.934302],[69.712624,-68.972791],[69.673453,-69.227556],[69.555941,-69.678226],[68.596258,-69.93294],[67.81274,-70.305268],[67.949889,-70.697182],[69.066307,-70.677545],[68.929157,-71.069459],[68.419989,-71.441788],[67.949889,-71.853287],[68.71377,-72.166808],[69.869307,-72.264787],[71.024895,-72.088415],[71.573285,-71.696501],[71.906288,-71.324224],[72.454627,-71.010703],[73.08141,-70.716768],[73.33602,-70.364024],[73.864877,-69.874183],[74.491557,-69.776205],[75.62756,-69.737034],[76.626465,-69.619419],[77.644904,-69.462684],[78.134539,-69.07077],[78.428371,-68.698441],[79.113859,-68.326216],[80.093127,-68.071503],[80.93535,-67.875546],[81.483792,-67.542388],[82.051767,-67.366068],[82.776426,-67.209282],[83.775331,-67.30726],[84.676206,-67.209282],[85.655527,-67.091718],[86.752359,-67.150474],[87.477017,-66.876175],[87.986289,-66.209911],[88.358411,-66.484261],[88.828408,-66.954568],[89.67063,-67.150474],[90.630365,-67.228867],[91.5901,-67.111303],[92.608539,-67.189696],[93.548637,-67.209282],[94.17542,-67.111303],[95.017591,-67.170111],[95.781472,-67.385653],[96.682399,-67.248504],[97.759646,-67.248504],[98.68021,-67.111303],[99.718182,-67.248504],[100.384188,-66.915346],[100.893356,-66.58224],[101.578896,-66.30789],[102.832411,-65.563284],[103.478676,-65.700485],[104.242557,-65.974783],[104.90846,-66.327527],[106.181561,-66.934931],[107.160881,-66.954568],[108.081393,-66.954568],[109.15864,-66.837004],[110.235835,-66.699804],[111.058472,-66.425505],[111.74396,-66.13157],[112.860378,-66.092347],[113.604673,-65.876805],[114.388088,-66.072762],[114.897308,-66.386283],[115.602381,-66.699804],[116.699161,-66.660633],[117.384701,-66.915346],[118.57946,-67.170111],[119.832924,-67.268089],[120.871,-67.189696],[121.654415,-66.876175],[122.320369,-66.562654],[123.221296,-66.484261],[124.122274,-66.621462],[125.160247,-66.719389],[126.100396,-66.562654],[127.001427,-66.562654],[127.882768,-66.660633],[128.80328,-66.758611],[129.704259,-66.58224],[130.781454,-66.425505],[131.799945,-66.386283],[132.935896,-66.386283],[133.85646,-66.288304],[134.757387,-66.209963],[135.031582,-65.72007],[135.070753,-65.308571],[135.697485,-65.582869],[135.873805,-66.033591],[136.206705,-66.44509],[136.618049,-66.778197],[137.460271,-66.954568],[138.596223,-66.895761],[139.908442,-66.876175],[140.809421,-66.817367],[142.121692,-66.817367],[143.061842,-66.797782],[144.374061,-66.837004],[145.490427,-66.915346],[146.195552,-67.228867],[145.999699,-67.601196],[146.646067,-67.895131],[147.723263,-68.130259],[148.839629,-68.385024],[150.132314,-68.561292],[151.483705,-68.71813],[152.502247,-68.874813],[153.638199,-68.894502],[154.284567,-68.561292],[155.165857,-68.835642],[155.92979,-69.149215],[156.811132,-69.384291],[158.025528,-69.482269],[159.181013,-69.599833],[159.670699,-69.991747],[160.80665,-70.226875],[161.570479,-70.579618],[162.686897,-70.736353],[163.842434,-70.716768],[164.919681,-70.775524],[166.11444,-70.755938],[167.309095,-70.834332],[168.425616,-70.971481],[169.463589,-71.20666],[170.501665,-71.402617],[171.20679,-71.696501],[171.089227,-72.088415],[170.560422,-72.441159],[170.109958,-72.891829],[169.75737,-73.24452],[169.287321,-73.65602],[167.975101,-73.812806],[167.387489,-74.165498],[166.094803,-74.38104],[165.644391,-74.772954],[164.958851,-75.145283],[164.234193,-75.458804],[163.822797,-75.870303],[163.568239,-76.24258],[163.47026,-76.693302],[163.489897,-77.065579],[164.057873,-77.457442],[164.273363,-77.82977],[164.743464,-78.182514],[166.604126,-78.319611],[166.995781,-78.750748],[165.193876,-78.907483],[163.666217,-79.123025],[161.766385,-79.162248],[160.924162,-79.730482],[160.747894,-80.200737],[160.316964,-80.573066],[159.788211,-80.945395],[161.120016,-81.278501],[161.629287,-81.690001],[162.490992,-82.062278],[163.705336,-82.395435],[165.095949,-82.708956],[166.604126,-83.022477],[168.895665,-83.335998],[169.404782,-83.825891],[172.283934,-84.041433],[172.477049,-84.117914],[173.224083,-84.41371],[175.985672,-84.158997],[178.277212,-84.472518],[180,-84.71338],[-179.942499,-84.721443],[-179.058677,-84.139412],[-177.256772,-84.452933],[-177.140807,-84.417941],[-176.084673,-84.099259],[-175.947235,-84.110449],[-175.829882,-84.117914],[-174.382503,-84.534323],[-173.116559,-84.117914],[-172.889106,-84.061019],[-169.951223,-83.884647],[-168.999989,-84.117914],[-168.530199,-84.23739],[-167.022099,-84.570497],[-164.182144,-84.82521],[-161.929775,-85.138731],[-158.07138,-85.37391],[-155.192253,-85.09956],[-150.942099,-85.295517],[-148.533073,-85.609038],[-145.888918,-85.315102],[-143.107718,-85.040752],[-142.892279,-84.570497],[-146.829068,-84.531274],[-150.060732,-84.296146],[-150.902928,-83.904232],[-153.586201,-83.68869],[-153.409907,-83.23802],[-153.037759,-82.82652],[-152.665637,-82.454192],[-152.861517,-82.042692],[-154.526299,-81.768394],[-155.29018,-81.41565],[-156.83745,-81.102129],[-154.408787,-81.160937],[-152.097662,-81.004151],[-150.648293,-81.337309],[-148.865998,-81.043373],[-147.22075,-80.671045],[-146.417749,-80.337938],[-146.770286,-79.926439],[-148.062947,-79.652089],[-149.531901,-79.358205],[-151.588416,-79.299397],[-153.390322,-79.162248],[-155.329376,-79.064269],[-155.975668,-78.69194],[-157.268302,-78.378419],[-158.051768,-78.025676],[-158.365134,-76.889207],[-157.875474,-76.987238],[-156.974573,-77.300759],[-155.329376,-77.202728],[-153.742832,-77.065579],[-152.920247,-77.496664],[-151.33378,-77.398737],[-150.00195,-77.183143],[-148.748486,-76.908845],[-147.612483,-76.575738],[-146.104409,-76.47776],[-146.143528,-76.105431],[-146.496091,-75.733154],[-146.20231,-75.380411],[-144.909624,-75.204039],[-144.322037,-75.537197],[-142.794353,-75.34124],[-141.638764,-75.086475],[-140.209007,-75.06689],[-138.85759,-74.968911],[-137.5062,-74.733783],[-136.428901,-74.518241],[-135.214583,-74.302699],[-134.431194,-74.361455],[-133.745654,-74.439848],[-132.257168,-74.302699],[-130.925311,-74.479019],[-129.554284,-74.459433],[-128.242038,-74.322284],[-126.890622,-74.420263],[-125.402082,-74.518241],[-124.011496,-74.479019],[-122.562152,-74.498604],[-121.073613,-74.518241],[-119.70256,-74.479019],[-118.684145,-74.185083],[-117.469801,-74.028348],[-116.216312,-74.243891],[-115.021552,-74.067519],[-113.944331,-73.714828],[-113.297988,-74.028348],[-112.945452,-74.38104],[-112.299083,-74.714198],[-111.261059,-74.420263],[-110.066325,-74.79254],[-108.714909,-74.910103],[-107.559346,-75.184454],[-106.149148,-75.125698],[-104.876074,-74.949326],[-103.367949,-74.988497],[-102.016507,-75.125698],[-100.645531,-75.302018],[-100.1167,-74.870933],[-100.763043,-74.537826],[-101.252703,-74.185083],[-102.545337,-74.106742],[-103.113313,-73.734413],[-103.328752,-73.362084],[-103.681289,-72.61753],[-102.917485,-72.754679],[-101.60524,-72.813436],[-100.312528,-72.754679],[-99.13738,-72.911414],[-98.118889,-73.20535],[-97.688037,-73.558041],[-96.336595,-73.616849],[-95.043961,-73.4797],[-93.672907,-73.283743],[-92.439003,-73.166179],[-91.420564,-73.401307],[-90.088733,-73.322914],[-89.226951,-72.558722],[-88.423951,-73.009393],[-87.268337,-73.185764],[-86.014822,-73.087786],[-85.192236,-73.4797],[-83.879991,-73.518871],[-82.665646,-73.636434],[-81.470913,-73.851977],[-80.687447,-73.4797],[-80.295791,-73.126956],[-79.296886,-73.518871],[-77.925858,-73.420892],[-76.907367,-73.636434],[-76.221879,-73.969541],[-74.890049,-73.871614],[-73.852024,-73.65602],[-72.833533,-73.401307],[-71.619215,-73.264157],[-70.209042,-73.146542],[-68.935916,-73.009393],[-67.956622,-72.79385],[-67.369061,-72.480329],[-67.134036,-72.049244],[-67.251548,-71.637745],[-67.56494,-71.245831],[-67.917477,-70.853917],[-68.230843,-70.462055],[-68.485452,-70.109311],[-68.544209,-69.717397],[-68.446282,-69.325535],[-67.976233,-68.953206],[-67.5845,-68.541707],[-67.427843,-68.149844],[-67.62367,-67.718759],[-67.741183,-67.326845],[-67.251548,-66.876175],[-66.703184,-66.58224],[-66.056815,-66.209963],[-65.371327,-65.89639],[-64.568276,-65.602506],[-64.176542,-65.171423],[-63.628152,-64.897073],[-63.001394,-64.642308],[-62.041686,-64.583552],[-61.414928,-64.270031],[-60.709855,-64.074074],[-59.887269,-63.95651],[-59.162585,-63.701745],[-58.594557,-63.388224],[-57.811143,-63.27066],[-57.223582,-63.525425],[-57.59573,-63.858532],[-58.614143,-64.152467]]]]}},\n{\"type\":\"Feature\",\"id\":\"ATF\",\"properties\":{\"name\":\"French Southern and Antarctic Lands\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[68.935,-48.625],[69.58,-48.94],[70.525,-49.065],[70.56,-49.255],[70.28,-49.71],[68.745,-49.775],[68.72,-49.2425],[68.8675,-48.83],[68.935,-48.625]]]}},\n{\"type\":\"Feature\",\"id\":\"AUS\",\"properties\":{\"name\":\"Australia\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[145.397978,-40.792549],[146.364121,-41.137695],[146.908584,-41.000546],[147.689259,-40.808258],[148.289068,-40.875438],[148.359865,-42.062445],[148.017301,-42.407024],[147.914052,-43.211522],[147.564564,-42.937689],[146.870343,-43.634597],[146.663327,-43.580854],[146.048378,-43.549745],[145.43193,-42.693776],[145.29509,-42.03361],[144.718071,-41.162552],[144.743755,-40.703975],[145.397978,-40.792549]]],[[[143.561811,-13.763656],[143.922099,-14.548311],[144.563714,-14.171176],[144.894908,-14.594458],[145.374724,-14.984976],[145.271991,-15.428205],[145.48526,-16.285672],[145.637033,-16.784918],[145.888904,-16.906926],[146.160309,-17.761655],[146.063674,-18.280073],[146.387478,-18.958274],[147.471082,-19.480723],[148.177602,-19.955939],[148.848414,-20.39121],[148.717465,-20.633469],[149.28942,-21.260511],[149.678337,-22.342512],[150.077382,-22.122784],[150.482939,-22.556142],[150.727265,-22.402405],[150.899554,-23.462237],[151.609175,-24.076256],[152.07354,-24.457887],[152.855197,-25.267501],[153.136162,-26.071173],[153.161949,-26.641319],[153.092909,-27.2603],[153.569469,-28.110067],[153.512108,-28.995077],[153.339095,-29.458202],[153.069241,-30.35024],[153.089602,-30.923642],[152.891578,-31.640446],[152.450002,-32.550003],[151.709117,-33.041342],[151.343972,-33.816023],[151.010555,-34.31036],[150.714139,-35.17346],[150.32822,-35.671879],[150.075212,-36.420206],[149.946124,-37.109052],[149.997284,-37.425261],[149.423882,-37.772681],[148.304622,-37.809061],[147.381733,-38.219217],[146.922123,-38.606532],[146.317922,-39.035757],[145.489652,-38.593768],[144.876976,-38.417448],[145.032212,-37.896188],[144.485682,-38.085324],[143.609974,-38.809465],[142.745427,-38.538268],[142.17833,-38.380034],[141.606582,-38.308514],[140.638579,-38.019333],[139.992158,-37.402936],[139.806588,-36.643603],[139.574148,-36.138362],[139.082808,-35.732754],[138.120748,-35.612296],[138.449462,-35.127261],[138.207564,-34.384723],[137.71917,-35.076825],[136.829406,-35.260535],[137.352371,-34.707339],[137.503886,-34.130268],[137.890116,-33.640479],[137.810328,-32.900007],[136.996837,-33.752771],[136.372069,-34.094766],[135.989043,-34.890118],[135.208213,-34.47867],[135.239218,-33.947953],[134.613417,-33.222778],[134.085904,-32.848072],[134.273903,-32.617234],[132.990777,-32.011224],[132.288081,-31.982647],[131.326331,-31.495803],[129.535794,-31.590423],[128.240938,-31.948489],[127.102867,-32.282267],[126.148714,-32.215966],[125.088623,-32.728751],[124.221648,-32.959487],[124.028947,-33.483847],[123.659667,-33.890179],[122.811036,-33.914467],[122.183064,-34.003402],[121.299191,-33.821036],[120.580268,-33.930177],[119.893695,-33.976065],[119.298899,-34.509366],[119.007341,-34.464149],[118.505718,-34.746819],[118.024972,-35.064733],[117.295507,-35.025459],[116.625109,-35.025097],[115.564347,-34.386428],[115.026809,-34.196517],[115.048616,-33.623425],[115.545123,-33.487258],[115.714674,-33.259572],[115.679379,-32.900369],[115.801645,-32.205062],[115.689611,-31.612437],[115.160909,-30.601594],[114.997043,-30.030725],[115.040038,-29.461095],[114.641974,-28.810231],[114.616498,-28.516399],[114.173579,-28.118077],[114.048884,-27.334765],[113.477498,-26.543134],[113.338953,-26.116545],[113.778358,-26.549025],[113.440962,-25.621278],[113.936901,-25.911235],[114.232852,-26.298446],[114.216161,-25.786281],[113.721255,-24.998939],[113.625344,-24.683971],[113.393523,-24.384764],[113.502044,-23.80635],[113.706993,-23.560215],[113.843418,-23.059987],[113.736552,-22.475475],[114.149756,-21.755881],[114.225307,-22.517488],[114.647762,-21.82952],[115.460167,-21.495173],[115.947373,-21.068688],[116.711615,-20.701682],[117.166316,-20.623599],[117.441545,-20.746899],[118.229559,-20.374208],[118.836085,-20.263311],[118.987807,-20.044203],[119.252494,-19.952942],[119.805225,-19.976506],[120.85622,-19.683708],[121.399856,-19.239756],[121.655138,-18.705318],[122.241665,-18.197649],[122.286624,-17.798603],[122.312772,-17.254967],[123.012574,-16.4052],[123.433789,-17.268558],[123.859345,-17.069035],[123.503242,-16.596506],[123.817073,-16.111316],[124.258287,-16.327944],[124.379726,-15.56706],[124.926153,-15.0751],[125.167275,-14.680396],[125.670087,-14.51007],[125.685796,-14.230656],[126.125149,-14.347341],[126.142823,-14.095987],[126.582589,-13.952791],[127.065867,-13.817968],[127.804633,-14.276906],[128.35969,-14.86917],[128.985543,-14.875991],[129.621473,-14.969784],[129.4096,-14.42067],[129.888641,-13.618703],[130.339466,-13.357376],[130.183506,-13.10752],[130.617795,-12.536392],[131.223495,-12.183649],[131.735091,-12.302453],[132.575298,-12.114041],[132.557212,-11.603012],[131.824698,-11.273782],[132.357224,-11.128519],[133.019561,-11.376411],[133.550846,-11.786515],[134.393068,-12.042365],[134.678632,-11.941183],[135.298491,-12.248606],[135.882693,-11.962267],[136.258381,-12.049342],[136.492475,-11.857209],[136.95162,-12.351959],[136.685125,-12.887223],[136.305407,-13.29123],[135.961758,-13.324509],[136.077617,-13.724278],[135.783836,-14.223989],[135.428664,-14.715432],[135.500184,-14.997741],[136.295175,-15.550265],[137.06536,-15.870762],[137.580471,-16.215082],[138.303217,-16.807604],[138.585164,-16.806622],[139.108543,-17.062679],[139.260575,-17.371601],[140.215245,-17.710805],[140.875463,-17.369069],[141.07111,-16.832047],[141.274095,-16.38887],[141.398222,-15.840532],[141.702183,-15.044921],[141.56338,-14.561333],[141.63552,-14.270395],[141.519869,-13.698078],[141.65092,-12.944688],[141.842691,-12.741548],[141.68699,-12.407614],[141.928629,-11.877466],[142.118488,-11.328042],[142.143706,-11.042737],[142.51526,-10.668186],[142.79731,-11.157355],[142.866763,-11.784707],[143.115947,-11.90563],[143.158632,-12.325656],[143.522124,-12.834358],[143.597158,-13.400422],[143.561811,-13.763656]]]]}},\n{\"type\":\"Feature\",\"id\":\"AUT\",\"properties\":{\"name\":\"Austria\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[16.979667,48.123497],[16.903754,47.714866],[16.340584,47.712902],[16.534268,47.496171],[16.202298,46.852386],[16.011664,46.683611],[15.137092,46.658703],[14.632472,46.431817],[13.806475,46.509306],[12.376485,46.767559],[12.153088,47.115393],[11.164828,46.941579],[11.048556,46.751359],[10.442701,46.893546],[9.932448,46.920728],[9.47997,47.10281],[9.632932,47.347601],[9.594226,47.525058],[9.896068,47.580197],[10.402084,47.302488],[10.544504,47.566399],[11.426414,47.523766],[12.141357,47.703083],[12.62076,47.672388],[12.932627,47.467646],[13.025851,47.637584],[12.884103,48.289146],[13.243357,48.416115],[13.595946,48.877172],[14.338898,48.555305],[14.901447,48.964402],[15.253416,49.039074],[16.029647,48.733899],[16.499283,48.785808],[16.960288,48.596982],[16.879983,48.470013],[16.979667,48.123497]]]}},\n{\"type\":\"Feature\",\"id\":\"AZE\",\"properties\":{\"name\":\"Azerbaijan\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[45.001987,39.740004],[45.298145,39.471751],[45.739978,39.473999],[45.735379,39.319719],[46.143623,38.741201],[45.457722,38.874139],[44.952688,39.335765],[44.79399,39.713003],[45.001987,39.740004]]],[[[47.373315,41.219732],[47.815666,41.151416],[47.987283,41.405819],[48.584353,41.80887],[49.110264,41.282287],[49.618915,40.572924],[50.08483,40.526157],[50.392821,40.256561],[49.569202,40.176101],[49.395259,39.399482],[49.223228,39.049219],[48.856532,38.815486],[48.883249,38.320245],[48.634375,38.270378],[48.010744,38.794015],[48.355529,39.288765],[48.060095,39.582235],[47.685079,39.508364],[46.50572,38.770605],[46.483499,39.464155],[46.034534,39.628021],[45.610012,39.899994],[45.891907,40.218476],[45.359175,40.561504],[45.560351,40.81229],[45.179496,40.985354],[44.97248,41.248129],[45.217426,41.411452],[45.962601,41.123873],[46.501637,41.064445],[46.637908,41.181673],[46.145432,41.722802],[46.404951,41.860675],[46.686071,41.827137],[47.373315,41.219732]]]]}},\n{\"type\":\"Feature\",\"id\":\"BDI\",\"properties\":{\"name\":\"Burundi\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[29.339998,-4.499983],[29.276384,-3.293907],[29.024926,-2.839258],[29.632176,-2.917858],[29.938359,-2.348487],[30.469696,-2.413858],[30.527677,-2.807632],[30.743013,-3.034285],[30.752263,-3.35933],[30.50556,-3.568567],[30.116333,-4.090138],[29.753512,-4.452389],[29.339998,-4.499983]]]}},\n{\"type\":\"Feature\",\"id\":\"BEL\",\"properties\":{\"name\":\"Belgium\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[3.314971,51.345781],[4.047071,51.267259],[4.973991,51.475024],[5.606976,51.037298],[6.156658,50.803721],[6.043073,50.128052],[5.782417,50.090328],[5.674052,49.529484],[4.799222,49.985373],[4.286023,49.907497],[3.588184,50.378992],[3.123252,50.780363],[2.658422,50.796848],[2.513573,51.148506],[3.314971,51.345781]]]}},\n{\"type\":\"Feature\",\"id\":\"BEN\",\"properties\":{\"name\":\"Benin\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[2.691702,6.258817],[1.865241,6.142158],[1.618951,6.832038],[1.664478,9.12859],[1.463043,9.334624],[1.425061,9.825395],[1.077795,10.175607],[0.772336,10.470808],[0.899563,10.997339],[1.24347,11.110511],[1.447178,11.547719],[1.935986,11.64115],[2.154474,11.94015],[2.490164,12.233052],[2.848643,12.235636],[3.61118,11.660167],[3.572216,11.327939],[3.797112,10.734746],[3.60007,10.332186],[3.705438,10.06321],[3.220352,9.444153],[2.912308,9.137608],[2.723793,8.506845],[2.749063,7.870734],[2.691702,6.258817]]]}},\n{\"type\":\"Feature\",\"id\":\"BFA\",\"properties\":{\"name\":\"Burkina Faso\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-2.827496,9.642461],[-3.511899,9.900326],[-3.980449,9.862344],[-4.330247,9.610835],[-4.779884,9.821985],[-4.954653,10.152714],[-5.404342,10.370737],[-5.470565,10.95127],[-5.197843,11.375146],[-5.220942,11.713859],[-4.427166,12.542646],[-4.280405,13.228444],[-4.006391,13.472485],[-3.522803,13.337662],[-3.103707,13.541267],[-2.967694,13.79815],[-2.191825,14.246418],[-2.001035,14.559008],[-1.066363,14.973815],[-0.515854,15.116158],[-0.266257,14.924309],[0.374892,14.928908],[0.295646,14.444235],[0.429928,13.988733],[0.993046,13.33575],[1.024103,12.851826],[2.177108,12.625018],[2.154474,11.94015],[1.935986,11.64115],[1.447178,11.547719],[1.24347,11.110511],[0.899563,10.997339],[0.023803,11.018682],[-0.438702,11.098341],[-0.761576,10.93693],[-1.203358,11.009819],[-2.940409,10.96269],[-2.963896,10.395335],[-2.827496,9.642461]]]}},\n{\"type\":\"Feature\",\"id\":\"BGD\",\"properties\":{\"name\":\"Bangladesh\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[92.672721,22.041239],[92.652257,21.324048],[92.303234,21.475485],[92.368554,20.670883],[92.082886,21.192195],[92.025215,21.70157],[91.834891,22.182936],[91.417087,22.765019],[90.496006,22.805017],[90.586957,22.392794],[90.272971,21.836368],[89.847467,22.039146],[89.70205,21.857116],[89.418863,21.966179],[89.031961,22.055708],[88.876312,22.879146],[88.52977,23.631142],[88.69994,24.233715],[88.084422,24.501657],[88.306373,24.866079],[88.931554,25.238692],[88.209789,25.768066],[88.563049,26.446526],[89.355094,26.014407],[89.832481,25.965082],[89.920693,25.26975],[90.872211,25.132601],[91.799596,25.147432],[92.376202,24.976693],[91.915093,24.130414],[91.46773,24.072639],[91.158963,23.503527],[91.706475,22.985264],[91.869928,23.624346],[92.146035,23.627499],[92.672721,22.041239]]]}},\n{\"type\":\"Feature\",\"id\":\"BGR\",\"properties\":{\"name\":\"Bulgaria\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[22.65715,44.234923],[22.944832,43.823785],[23.332302,43.897011],[24.100679,43.741051],[25.569272,43.688445],[26.065159,43.943494],[27.2424,44.175986],[27.970107,43.812468],[28.558081,43.707462],[28.039095,43.293172],[27.673898,42.577892],[27.99672,42.007359],[27.135739,42.141485],[26.117042,41.826905],[26.106138,41.328899],[25.197201,41.234486],[24.492645,41.583896],[23.692074,41.309081],[22.952377,41.337994],[22.881374,41.999297],[22.380526,42.32026],[22.545012,42.461362],[22.436595,42.580321],[22.604801,42.898519],[22.986019,43.211161],[22.500157,43.642814],[22.410446,44.008063],[22.65715,44.234923]]]}},\n{\"type\":\"Feature\",\"id\":\"BHS\",\"properties\":{\"name\":\"The Bahamas\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-77.53466,23.75975],[-77.78,23.71],[-78.03405,24.28615],[-78.40848,24.57564],[-78.19087,25.2103],[-77.89,25.17],[-77.54,24.34],[-77.53466,23.75975]]],[[[-77.82,26.58],[-78.91,26.42],[-78.98,26.79],[-78.51,26.87],[-77.85,26.84],[-77.82,26.58]]],[[[-77,26.59],[-77.17255,25.87918],[-77.35641,26.00735],[-77.34,26.53],[-77.78802,26.92516],[-77.79,27.04],[-77,26.59]]]]}},\n{\"type\":\"Feature\",\"id\":\"BIH\",\"properties\":{\"name\":\"Bosnia and Herzegovina\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[19.005486,44.860234],[19.36803,44.863],[19.11761,44.42307],[19.59976,44.03847],[19.454,43.5681],[19.21852,43.52384],[19.03165,43.43253],[18.70648,43.20011],[18.56,42.65],[17.674922,43.028563],[17.297373,43.446341],[16.916156,43.667722],[16.456443,44.04124],[16.23966,44.351143],[15.750026,44.818712],[15.959367,45.233777],[16.318157,45.004127],[16.534939,45.211608],[17.002146,45.233777],[17.861783,45.06774],[18.553214,45.08159],[19.005486,44.860234]]]}},\n{\"type\":\"Feature\",\"id\":\"BLR\",\"properties\":{\"name\":\"Belarus\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[23.484128,53.912498],[24.450684,53.905702],[25.536354,54.282423],[25.768433,54.846963],[26.588279,55.167176],[26.494331,55.615107],[27.10246,55.783314],[28.176709,56.16913],[29.229513,55.918344],[29.371572,55.670091],[29.896294,55.789463],[30.873909,55.550976],[30.971836,55.081548],[30.757534,54.811771],[31.384472,54.157056],[31.791424,53.974639],[31.731273,53.794029],[32.405599,53.618045],[32.693643,53.351421],[32.304519,53.132726],[31.497644,53.167427],[31.305201,53.073996],[31.540018,52.742052],[31.785998,52.101678],[30.927549,52.042353],[30.619454,51.822806],[30.555117,51.319503],[30.157364,51.416138],[29.254938,51.368234],[28.992835,51.602044],[28.617613,51.427714],[28.241615,51.572227],[27.454066,51.592303],[26.337959,51.832289],[25.327788,51.910656],[24.553106,51.888461],[24.005078,51.617444],[23.527071,51.578454],[23.508002,52.023647],[23.199494,52.486977],[23.799199,52.691099],[23.804935,53.089731],[23.527536,53.470122],[23.484128,53.912498]]]}},\n{\"type\":\"Feature\",\"id\":\"BLZ\",\"properties\":{\"name\":\"Belize\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-89.14308,17.808319],[-89.150909,17.955468],[-89.029857,18.001511],[-88.848344,17.883198],[-88.490123,18.486831],[-88.300031,18.499982],[-88.296336,18.353273],[-88.106813,18.348674],[-88.123479,18.076675],[-88.285355,17.644143],[-88.197867,17.489475],[-88.302641,17.131694],[-88.239518,17.036066],[-88.355428,16.530774],[-88.551825,16.265467],[-88.732434,16.233635],[-88.930613,15.887273],[-89.229122,15.886938],[-89.150806,17.015577],[-89.14308,17.808319]]]}},\n{\"type\":\"Feature\",\"id\":\"BMU\",\"properties\":{\"name\":\"Bermuda\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-64.7799734332998,32.3072000581802],[-64.7873319183061,32.3039237143428],[-64.7946942710173,32.3032682700388],[-64.8094297981283,32.3098175728414],[-64.8167896352437,32.3058845718466],[-64.8101968029642,32.3022833180511],[-64.7962291465484,32.2934409732427],[-64.7815086336978,32.2868973114514],[-64.7997025513437,32.2796896417328],[-64.8066707691087,32.2747767569465],[-64.8225587873683,32.2669111289395],[-64.8287548840306,32.2669075473817],[-64.8306732143498,32.2583944840235],[-64.8399924854972,32.254782282336],[-64.8566090462354,32.2547740387514],[-64.8682296789446,32.2616393614322],[-64.8628241459563,32.2724481933959],[-64.8748651338951,32.2757120264753],[-64.8717752856644,32.2819371582026],[-64.8671422127295,32.2930760547989],[-64.8559068764437,32.2960321186471],[-64.8597429072279,32.3015842021933],[-64.8439233486717,32.3140553852543],[-64.8350242329311,32.3242161760006],[-64.8338690593672,32.3294587561557],[-64.8520298651164,32.3110911879954],[-64.8635922932573,32.3048469433363],[-64.8686668994079,32.30910745083],[-64.8721354593415,32.3041908606301],[-64.8779667328485,32.3038632800462],[-64.8780046844321,32.2907757831692],[-64.8849776658292,32.2819261366004],[-64.8783230004629,32.2613001418681],[-64.863194968877,32.2465799485801],[-64.8519819555722,32.2485519134663],[-64.842311980074,32.2492123317296],[-64.8388242605209,32.2475773472534],[-64.8334002575532,32.2462714714698],[-64.8256389530584,32.2472637398594],[-64.8205697556026,32.2531698880328],[-64.8105087275579,32.2561208974156],[-64.7900177727338,32.2659446936992],[-64.7745415970416,32.2718413023427],[-64.7644742436426,32.2855931353214],[-64.7551803442276,32.2908326702531],[-64.7423982971436,32.2996734994024],[-64.7206991797682,32.3137542201258],[-64.7117851247134,32.3176823360806],[-64.6962778813133,32.3275029115532],[-64.6768921127452,32.3324095397555],[-64.6567136927777,32.3451776458469],[-64.6532168823499,32.3494356627941],[-64.6605720384429,32.3589423487763],[-64.65125819471,32.3615600906466],[-64.6462011670816,32.36975169749],[-64.6613227512832,32.3763135008721],[-64.6690666074397,32.388444543924],[-64.6834270548595,32.3854968316788],[-64.6954617672714,32.3763221285869],[-64.70438689565,32.3704254760469],[-64.7117569982798,32.368132600249],[-64.7061764744404,32.3600110593559],[-64.700531552697,32.3590601356818],[-64.6940348033967,32.3640708659835],[-64.6895164826082,32.3633598579866],[-64.6864150099255,32.3547797587266],[-64.6824635995504,32.3540628176846],[-64.6835876652835,32.3626447677968],[-64.6801998697415,32.3631199096979],[-64.6672170444687,32.3597751617473],[-64.6598811264978,32.3497625771755],[-64.6737331235384,32.3390281851635],[-64.6887090648183,32.3342439408053],[-64.706732854446,32.3429010723036],[-64.7149301576112,32.3552188753513],[-64.7185967666669,32.3552239212394],[-64.7214189847314,32.3518830231342],[-64.7270616067222,32.3466461715475],[-64.734962460882,32.3442819830499],[-64.7383521549094,32.3407216514918],[-64.7411729976333,32.3311790864627],[-64.7423019216485,32.323311561213],[-64.7462482354281,32.318538611581],[-64.7566773739613,32.3130509130175],[-64.768738200563,32.3088369816572],[-64.7799734332998,32.3072000581802]]]}},\n{\"type\":\"Feature\",\"id\":\"BOL\",\"properties\":{\"name\":\"Bolivia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-62.846468,-22.034985],[-63.986838,-21.993644],[-64.377021,-22.798091],[-64.964892,-22.075862],[-66.273339,-21.83231],[-67.106674,-22.735925],[-67.82818,-22.872919],[-68.219913,-21.494347],[-68.757167,-20.372658],[-68.442225,-19.405068],[-68.966818,-18.981683],[-69.100247,-18.260125],[-69.590424,-17.580012],[-68.959635,-16.500698],[-69.389764,-15.660129],[-69.160347,-15.323974],[-69.339535,-14.953195],[-68.948887,-14.453639],[-68.929224,-13.602684],[-68.88008,-12.899729],[-68.66508,-12.5613],[-69.529678,-10.951734],[-68.786158,-11.03638],[-68.271254,-11.014521],[-68.048192,-10.712059],[-67.173801,-10.306812],[-66.646908,-9.931331],[-65.338435,-9.761988],[-65.444837,-10.511451],[-65.321899,-10.895872],[-65.402281,-11.56627],[-64.316353,-12.461978],[-63.196499,-12.627033],[-62.80306,-13.000653],[-62.127081,-13.198781],[-61.713204,-13.489202],[-61.084121,-13.479384],[-60.503304,-13.775955],[-60.459198,-14.354007],[-60.264326,-14.645979],[-60.251149,-15.077219],[-60.542966,-15.09391],[-60.15839,-16.258284],[-58.24122,-16.299573],[-58.388058,-16.877109],[-58.280804,-17.27171],[-57.734558,-17.552468],[-57.498371,-18.174188],[-57.676009,-18.96184],[-57.949997,-19.400004],[-57.853802,-19.969995],[-58.166392,-20.176701],[-58.183471,-19.868399],[-59.115042,-19.356906],[-60.043565,-19.342747],[-61.786326,-19.633737],[-62.265961,-20.513735],[-62.291179,-21.051635],[-62.685057,-22.249029],[-62.846468,-22.034985]]]}},\n{\"type\":\"Feature\",\"id\":\"BRA\",\"properties\":{\"name\":\"Brazil\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-57.625133,-30.216295],[-56.2909,-28.852761],[-55.162286,-27.881915],[-54.490725,-27.474757],[-53.648735,-26.923473],[-53.628349,-26.124865],[-54.13005,-25.547639],[-54.625291,-25.739255],[-54.428946,-25.162185],[-54.293476,-24.5708],[-54.29296,-24.021014],[-54.652834,-23.839578],[-55.027902,-24.001274],[-55.400747,-23.956935],[-55.517639,-23.571998],[-55.610683,-22.655619],[-55.797958,-22.35693],[-56.473317,-22.0863],[-56.88151,-22.282154],[-57.937156,-22.090176],[-57.870674,-20.732688],[-58.166392,-20.176701],[-57.853802,-19.969995],[-57.949997,-19.400004],[-57.676009,-18.96184],[-57.498371,-18.174188],[-57.734558,-17.552468],[-58.280804,-17.27171],[-58.388058,-16.877109],[-58.24122,-16.299573],[-60.15839,-16.258284],[-60.542966,-15.09391],[-60.251149,-15.077219],[-60.264326,-14.645979],[-60.459198,-14.354007],[-60.503304,-13.775955],[-61.084121,-13.479384],[-61.713204,-13.489202],[-62.127081,-13.198781],[-62.80306,-13.000653],[-63.196499,-12.627033],[-64.316353,-12.461978],[-65.402281,-11.56627],[-65.321899,-10.895872],[-65.444837,-10.511451],[-65.338435,-9.761988],[-66.646908,-9.931331],[-67.173801,-10.306812],[-68.048192,-10.712059],[-68.271254,-11.014521],[-68.786158,-11.03638],[-69.529678,-10.951734],[-70.093752,-11.123972],[-70.548686,-11.009147],[-70.481894,-9.490118],[-71.302412,-10.079436],[-72.184891,-10.053598],[-72.563033,-9.520194],[-73.226713,-9.462213],[-73.015383,-9.032833],[-73.571059,-8.424447],[-73.987235,-7.52383],[-73.723401,-7.340999],[-73.724487,-6.918595],[-73.120027,-6.629931],[-73.219711,-6.089189],[-72.964507,-5.741251],[-72.891928,-5.274561],[-71.748406,-4.593983],[-70.928843,-4.401591],[-70.794769,-4.251265],[-69.893635,-4.298187],[-69.444102,-1.556287],[-69.420486,-1.122619],[-69.577065,-0.549992],[-70.020656,-0.185156],[-70.015566,0.541414],[-69.452396,0.706159],[-69.252434,0.602651],[-69.218638,0.985677],[-69.804597,1.089081],[-69.816973,1.714805],[-67.868565,1.692455],[-67.53781,2.037163],[-67.259998,1.719999],[-67.065048,1.130112],[-66.876326,1.253361],[-66.325765,0.724452],[-65.548267,0.789254],[-65.354713,1.095282],[-64.611012,1.328731],[-64.199306,1.492855],[-64.083085,1.916369],[-63.368788,2.2009],[-63.422867,2.411068],[-64.269999,2.497006],[-64.408828,3.126786],[-64.368494,3.79721],[-64.816064,4.056445],[-64.628659,4.148481],[-63.888343,4.02053],[-63.093198,3.770571],[-62.804533,4.006965],[-62.08543,4.162124],[-60.966893,4.536468],[-60.601179,4.918098],[-60.733574,5.200277],[-60.213683,5.244486],[-59.980959,5.014061],[-60.111002,4.574967],[-59.767406,4.423503],[-59.53804,3.958803],[-59.815413,3.606499],[-59.974525,2.755233],[-59.718546,2.24963],[-59.646044,1.786894],[-59.030862,1.317698],[-58.540013,1.268088],[-58.429477,1.463942],[-58.11345,1.507195],[-57.660971,1.682585],[-57.335823,1.948538],[-56.782704,1.863711],[-56.539386,1.899523],[-55.995698,1.817667],[-55.9056,2.021996],[-56.073342,2.220795],[-55.973322,2.510364],[-55.569755,2.421506],[-55.097587,2.523748],[-54.524754,2.311849],[-54.088063,2.105557],[-53.778521,2.376703],[-53.554839,2.334897],[-53.418465,2.053389],[-52.939657,2.124858],[-52.556425,2.504705],[-52.249338,3.241094],[-51.657797,4.156232],[-51.317146,4.203491],[-51.069771,3.650398],[-50.508875,1.901564],[-49.974076,1.736483],[-49.947101,1.04619],[-50.699251,0.222984],[-50.388211,-0.078445],[-48.620567,-0.235489],[-48.584497,-1.237805],[-47.824956,-0.581618],[-46.566584,-0.941028],[-44.905703,-1.55174],[-44.417619,-2.13775],[-44.581589,-2.691308],[-43.418791,-2.38311],[-41.472657,-2.912018],[-39.978665,-2.873054],[-38.500383,-3.700652],[-37.223252,-4.820946],[-36.452937,-5.109404],[-35.597796,-5.149504],[-35.235389,-5.464937],[-34.89603,-6.738193],[-34.729993,-7.343221],[-35.128212,-8.996401],[-35.636967,-9.649282],[-37.046519,-11.040721],[-37.683612,-12.171195],[-38.423877,-13.038119],[-38.673887,-13.057652],[-38.953276,-13.79337],[-38.882298,-15.667054],[-39.161092,-17.208407],[-39.267339,-17.867746],[-39.583521,-18.262296],[-39.760823,-19.599113],[-40.774741,-20.904512],[-40.944756,-21.937317],[-41.754164,-22.370676],[-41.988284,-22.97007],[-43.074704,-22.967693],[-44.647812,-23.351959],[-45.352136,-23.796842],[-46.472093,-24.088969],[-47.648972,-24.885199],[-48.495458,-25.877025],[-48.641005,-26.623698],[-48.474736,-27.175912],[-48.66152,-28.186135],[-48.888457,-28.674115],[-49.587329,-29.224469],[-50.696874,-30.984465],[-51.576226,-31.777698],[-52.256081,-32.24537],[-52.7121,-33.196578],[-53.373662,-33.768378],[-53.650544,-33.202004],[-53.209589,-32.727666],[-53.787952,-32.047243],[-54.572452,-31.494511],[-55.60151,-30.853879],[-55.973245,-30.883076],[-56.976026,-30.109686],[-57.625133,-30.216295]]]}},\n{\"type\":\"Feature\",\"id\":\"BRN\",\"properties\":{\"name\":\"Brunei\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[114.204017,4.525874],[114.599961,4.900011],[115.45071,5.44773],[115.4057,4.955228],[115.347461,4.316636],[114.869557,4.348314],[114.659596,4.007637],[114.204017,4.525874]]]}},\n{\"type\":\"Feature\",\"id\":\"BTN\",\"properties\":{\"name\":\"Bhutan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[91.696657,27.771742],[92.103712,27.452614],[92.033484,26.83831],[91.217513,26.808648],[90.373275,26.875724],[89.744528,26.719403],[88.835643,27.098966],[88.814248,27.299316],[89.47581,28.042759],[90.015829,28.296439],[90.730514,28.064954],[91.258854,28.040614],[91.696657,27.771742]]]}},\n{\"type\":\"Feature\",\"id\":\"BWA\",\"properties\":{\"name\":\"Botswana\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[25.649163,-18.536026],[25.850391,-18.714413],[26.164791,-19.293086],[27.296505,-20.39152],[27.724747,-20.499059],[27.727228,-20.851802],[28.02137,-21.485975],[28.794656,-21.639454],[29.432188,-22.091313],[28.017236,-22.827754],[27.11941,-23.574323],[26.786407,-24.240691],[26.485753,-24.616327],[25.941652,-24.696373],[25.765849,-25.174845],[25.664666,-25.486816],[25.025171,-25.71967],[24.211267,-25.670216],[23.73357,-25.390129],[23.312097,-25.26869],[22.824271,-25.500459],[22.579532,-25.979448],[22.105969,-26.280256],[21.605896,-26.726534],[20.889609,-26.828543],[20.66647,-26.477453],[20.758609,-25.868136],[20.165726,-24.917962],[19.895768,-24.76779],[19.895458,-21.849157],[20.881134,-21.814327],[20.910641,-18.252219],[21.65504,-18.219146],[23.196858,-17.869038],[23.579006,-18.281261],[24.217365,-17.889347],[24.520705,-17.887125],[25.084443,-17.661816],[25.264226,-17.73654],[25.649163,-18.536026]]]}},\n{\"type\":\"Feature\",\"id\":\"CAF\",\"properties\":{\"name\":\"Central African Republic\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[15.27946,7.421925],[16.106232,7.497088],[16.290562,7.754307],[16.456185,7.734774],[16.705988,7.508328],[17.96493,7.890914],[18.389555,8.281304],[18.911022,8.630895],[18.81201,8.982915],[19.094008,9.074847],[20.059685,9.012706],[21.000868,9.475985],[21.723822,10.567056],[22.231129,10.971889],[22.864165,11.142395],[22.977544,10.714463],[23.554304,10.089255],[23.55725,9.681218],[23.394779,9.265068],[23.459013,8.954286],[23.805813,8.666319],[24.567369,8.229188],[25.114932,7.825104],[25.124131,7.500085],[25.796648,6.979316],[26.213418,6.546603],[26.465909,5.946717],[27.213409,5.550953],[27.374226,5.233944],[27.044065,5.127853],[26.402761,5.150875],[25.650455,5.256088],[25.278798,5.170408],[25.128833,4.927245],[24.805029,4.897247],[24.410531,5.108784],[23.297214,4.609693],[22.84148,4.710126],[22.704124,4.633051],[22.405124,4.02916],[21.659123,4.224342],[20.927591,4.322786],[20.290679,4.691678],[19.467784,5.031528],[18.932312,4.709506],[18.542982,4.201785],[18.453065,3.504386],[17.8099,3.560196],[17.133042,3.728197],[16.537058,3.198255],[16.012852,2.26764],[15.907381,2.557389],[15.862732,3.013537],[15.405396,3.335301],[15.03622,3.851367],[14.950953,4.210389],[14.478372,4.732605],[14.558936,5.030598],[14.459407,5.451761],[14.53656,6.226959],[14.776545,6.408498],[15.27946,7.421925]]]}},\n{\"type\":\"Feature\",\"id\":\"CAN\",\"properties\":{\"name\":\"Canada\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-63.6645,46.55001],[-62.9393,46.41587],[-62.01208,46.44314],[-62.50391,46.03339],[-62.87433,45.96818],[-64.1428,46.39265],[-64.39261,46.72747],[-64.01486,47.03601],[-63.6645,46.55001]]],[[[-61.806305,49.10506],[-62.29318,49.08717],[-63.58926,49.40069],[-64.51912,49.87304],[-64.17322,49.95718],[-62.85829,49.70641],[-61.835585,49.28855],[-61.806305,49.10506]]],[[[-123.510002,48.510011],[-124.012891,48.370846],[-125.655013,48.825005],[-125.954994,49.179996],[-126.850004,49.53],[-127.029993,49.814996],[-128.059336,49.994959],[-128.444584,50.539138],[-128.358414,50.770648],[-127.308581,50.552574],[-126.695001,50.400903],[-125.755007,50.295018],[-125.415002,49.950001],[-124.920768,49.475275],[-123.922509,49.062484],[-123.510002,48.510011]]],[[[-56.134036,50.68701],[-56.795882,49.812309],[-56.143105,50.150117],[-55.471492,49.935815],[-55.822401,49.587129],[-54.935143,49.313011],[-54.473775,49.556691],[-53.476549,49.249139],[-53.786014,48.516781],[-53.086134,48.687804],[-52.958648,48.157164],[-52.648099,47.535548],[-53.069158,46.655499],[-53.521456,46.618292],[-54.178936,46.807066],[-53.961869,47.625207],[-54.240482,47.752279],[-55.400773,46.884994],[-55.997481,46.91972],[-55.291219,47.389562],[-56.250799,47.632545],[-57.325229,47.572807],[-59.266015,47.603348],[-59.419494,47.899454],[-58.796586,48.251525],[-59.231625,48.523188],[-58.391805,49.125581],[-57.35869,50.718274],[-56.73865,51.287438],[-55.870977,51.632094],[-55.406974,51.588273],[-55.600218,51.317075],[-56.134036,50.68701]]],[[[-132.710008,54.040009],[-131.74999,54.120004],[-132.04948,52.984621],[-131.179043,52.180433],[-131.57783,52.182371],[-132.180428,52.639707],[-132.549992,53.100015],[-133.054611,53.411469],[-133.239664,53.85108],[-133.180004,54.169975],[-132.710008,54.040009]]],[[[-79.26582,62.158675],[-79.65752,61.63308],[-80.09956,61.7181],[-80.36215,62.01649],[-80.315395,62.085565],[-79.92939,62.3856],[-79.52002,62.36371],[-79.26582,62.158675]]],[[[-81.89825,62.7108],[-83.06857,62.15922],[-83.77462,62.18231],[-83.99367,62.4528],[-83.25048,62.91409],[-81.87699,62.90458],[-81.89825,62.7108]]],[[[-85.161308,65.657285],[-84.975764,65.217518],[-84.464012,65.371772],[-83.882626,65.109618],[-82.787577,64.766693],[-81.642014,64.455136],[-81.55344,63.979609],[-80.817361,64.057486],[-80.103451,63.725981],[-80.99102,63.411246],[-82.547178,63.651722],[-83.108798,64.101876],[-84.100417,63.569712],[-85.523405,63.052379],[-85.866769,63.637253],[-87.221983,63.541238],[-86.35276,64.035833],[-86.224886,64.822917],[-85.883848,65.738778],[-85.161308,65.657285]]],[[[-75.86588,67.14886],[-76.98687,67.09873],[-77.2364,67.58809],[-76.81166,68.14856],[-75.89521,68.28721],[-75.1145,68.01036],[-75.10333,67.58202],[-75.21597,67.44425],[-75.86588,67.14886]]],[[[-95.647681,69.10769],[-96.269521,68.75704],[-97.617401,69.06003],[-98.431801,68.9507],[-99.797401,69.40003],[-98.917401,69.71003],[-98.218261,70.14354],[-97.157401,69.86003],[-96.557401,69.68003],[-96.257401,69.49003],[-95.647681,69.10769]]],[[[-90.5471,69.49766],[-90.55151,68.47499],[-89.21515,69.25873],[-88.01966,68.61508],[-88.31749,67.87338],[-87.35017,67.19872],[-86.30607,67.92146],[-85.57664,68.78456],[-85.52197,69.88211],[-84.10081,69.80539],[-82.62258,69.65826],[-81.28043,69.16202],[-81.2202,68.66567],[-81.96436,68.13253],[-81.25928,67.59716],[-81.38653,67.11078],[-83.34456,66.41154],[-84.73542,66.2573],[-85.76943,66.55833],[-86.0676,66.05625],[-87.03143,65.21297],[-87.32324,64.77563],[-88.48296,64.09897],[-89.91444,64.03273],[-90.70398,63.61017],[-90.77004,62.96021],[-91.93342,62.83508],[-93.15698,62.02469],[-94.24153,60.89865],[-94.62931,60.11021],[-94.6846,58.94882],[-93.21502,58.78212],[-92.76462,57.84571],[-92.29703,57.08709],[-90.89769,57.28468],[-89.03953,56.85172],[-88.03978,56.47162],[-87.32421,55.99914],[-86.07121,55.72383],[-85.01181,55.3026],[-83.36055,55.24489],[-82.27285,55.14832],[-82.4362,54.28227],[-82.12502,53.27703],[-81.40075,52.15788],[-79.91289,51.20842],[-79.14301,51.53393],[-78.60191,52.56208],[-79.12421,54.14145],[-79.82958,54.66772],[-78.22874,55.13645],[-77.0956,55.83741],[-76.54137,56.53423],[-76.62319,57.20263],[-77.30226,58.05209],[-78.51688,58.80458],[-77.33676,59.85261],[-77.77272,60.75788],[-78.10687,62.31964],[-77.41067,62.55053],[-75.69621,62.2784],[-74.6682,62.18111],[-73.83988,62.4438],[-72.90853,62.10507],[-71.67708,61.52535],[-71.37369,61.13717],[-69.59042,61.06141],[-69.62033,60.22125],[-69.2879,58.95736],[-68.37455,58.80106],[-67.64976,58.21206],[-66.20178,58.76731],[-65.24517,59.87071],[-64.58352,60.33558],[-63.80475,59.4426],[-62.50236,58.16708],[-61.39655,56.96745],[-61.79866,56.33945],[-60.46853,55.77548],[-59.56962,55.20407],[-57.97508,54.94549],[-57.3332,54.6265],[-56.93689,53.78032],[-56.15811,53.64749],[-55.75632,53.27036],[-55.68338,52.14664],[-56.40916,51.7707],[-57.12691,51.41972],[-58.77482,51.0643],[-60.03309,50.24277],[-61.72366,50.08046],[-63.86251,50.29099],[-65.36331,50.2982],[-66.39905,50.22897],[-67.23631,49.51156],[-68.51114,49.06836],[-69.95362,47.74488],[-71.10458,46.82171],[-70.25522,46.98606],[-68.65,48.3],[-66.55243,49.1331],[-65.05626,49.23278],[-64.17099,48.74248],[-65.11545,48.07085],[-64.79854,46.99297],[-64.47219,46.23849],[-63.17329,45.73902],[-61.52072,45.88377],[-60.51815,47.00793],[-60.4486,46.28264],[-59.80287,45.9204],[-61.03988,45.26525],[-63.25471,44.67014],[-64.24656,44.26553],[-65.36406,43.54523],[-66.1234,43.61867],[-66.16173,44.46512],[-64.42549,45.29204],[-66.02605,45.25931],[-67.13741,45.13753],[-67.79134,45.70281],[-67.79046,47.06636],[-68.23444,47.35486],[-68.905,47.185],[-69.237216,47.447781],[-69.99997,46.69307],[-70.305,45.915],[-70.66,45.46],[-71.08482,45.30524],[-71.405,45.255],[-71.50506,45.0082],[-73.34783,45.00738],[-74.867,45.00048],[-75.31821,44.81645],[-76.375,44.09631],[-76.5,44.018459],[-76.820034,43.628784],[-77.737885,43.629056],[-78.72028,43.625089],[-79.171674,43.466339],[-79.01,43.27],[-78.92,42.965],[-78.939362,42.863611],[-80.247448,42.3662],[-81.277747,42.209026],[-82.439278,41.675105],[-82.690089,41.675105],[-83.02981,41.832796],[-83.142,41.975681],[-83.12,42.08],[-82.9,42.43],[-82.43,42.98],[-82.137642,43.571088],[-82.337763,44.44],[-82.550925,45.347517],[-83.592851,45.816894],[-83.469551,45.994686],[-83.616131,46.116927],[-83.890765,46.116927],[-84.091851,46.275419],[-84.14212,46.512226],[-84.3367,46.40877],[-84.6049,46.4396],[-84.543749,46.538684],[-84.779238,46.637102],[-84.87608,46.900083],[-85.652363,47.220219],[-86.461991,47.553338],[-87.439793,47.94],[-88.378114,48.302918],[-89.272917,48.019808],[-89.6,48.01],[-90.83,48.27],[-91.64,48.14],[-92.61,48.45],[-93.63087,48.60926],[-94.32914,48.67074],[-94.64,48.84],[-94.81758,49.38905],[-95.15609,49.38425],[-95.15907,49],[-97.22872,49.0007],[-100.65,49],[-104.04826,48.99986],[-107.05,49],[-110.05,49],[-113,49],[-116.04818,49],[-117.03121,49],[-120,49],[-122.84,49],[-122.97421,49.002538],[-124.91024,49.98456],[-125.62461,50.41656],[-127.43561,50.83061],[-127.99276,51.71583],[-127.85032,52.32961],[-129.12979,52.75538],[-129.30523,53.56159],[-130.51497,54.28757],[-130.53611,54.80278],[-129.98,55.285],[-130.00778,55.91583],[-131.70781,56.55212],[-132.73042,57.69289],[-133.35556,58.41028],[-134.27111,58.86111],[-134.945,59.27056],[-135.47583,59.78778],[-136.47972,59.46389],[-137.4525,58.905],[-138.34089,59.56211],[-139.039,60],[-140.013,60.27682],[-140.99778,60.30639],[-140.9925,66.00003],[-140.986,69.712],[-139.12052,69.47102],[-137.54636,68.99002],[-136.50358,68.89804],[-135.62576,69.31512],[-134.41464,69.62743],[-132.92925,69.50534],[-131.43136,69.94451],[-129.79471,70.19369],[-129.10773,69.77927],[-128.36156,70.01286],[-128.13817,70.48384],[-127.44712,70.37721],[-125.75632,69.48058],[-124.42483,70.1584],[-124.28968,69.39969],[-123.06108,69.56372],[-122.6835,69.85553],[-121.47226,69.79778],[-119.94288,69.37786],[-117.60268,69.01128],[-116.22643,68.84151],[-115.2469,68.90591],[-113.89794,68.3989],[-115.30489,67.90261],[-113.49727,67.68815],[-110.798,67.80612],[-109.94619,67.98104],[-108.8802,67.38144],[-107.79239,67.88736],[-108.81299,68.31164],[-108.16721,68.65392],[-106.95,68.7],[-106.15,68.8],[-105.34282,68.56122],[-104.33791,68.018],[-103.22115,68.09775],[-101.45433,67.64689],[-99.90195,67.80566],[-98.4432,67.78165],[-98.5586,68.40394],[-97.66948,68.57864],[-96.11991,68.23939],[-96.12588,67.29338],[-95.48943,68.0907],[-94.685,68.06383],[-94.23282,69.06903],[-95.30408,69.68571],[-96.47131,70.08976],[-96.39115,71.19482],[-95.2088,71.92053],[-93.88997,71.76015],[-92.87818,71.31869],[-91.51964,70.19129],[-92.40692,69.69997],[-90.5471,69.49766]]],[[[-114.16717,73.12145],[-114.66634,72.65277],[-112.44102,72.9554],[-111.05039,72.4504],[-109.92035,72.96113],[-109.00654,72.63335],[-108.18835,71.65089],[-107.68599,72.06548],[-108.39639,73.08953],[-107.51645,73.23598],[-106.52259,73.07601],[-105.40246,72.67259],[-104.77484,71.6984],[-104.46476,70.99297],[-102.78537,70.49776],[-100.98078,70.02432],[-101.08929,69.58447],[-102.73116,69.50402],[-102.09329,69.11962],[-102.43024,68.75282],[-104.24,68.91],[-105.96,69.18],[-107.12254,69.11922],[-109,68.78],[-111.534149,68.630059],[-113.3132,68.53554],[-113.85496,69.00744],[-115.22,69.28],[-116.10794,69.16821],[-117.34,69.96],[-116.67473,70.06655],[-115.13112,70.2373],[-113.72141,70.19237],[-112.4161,70.36638],[-114.35,70.6],[-116.48684,70.52045],[-117.9048,70.54056],[-118.43238,70.9092],[-116.11311,71.30918],[-117.65568,71.2952],[-119.40199,71.55859],[-118.56267,72.30785],[-117.86642,72.70594],[-115.18909,73.31459],[-114.16717,73.12145]]],[[[-104.5,73.42],[-105.38,72.76],[-106.94,73.46],[-106.6,73.6],[-105.26,73.64],[-104.5,73.42]]],[[[-76.34,73.102685],[-76.251404,72.826385],[-77.314438,72.855545],[-78.39167,72.876656],[-79.486252,72.742203],[-79.775833,72.802902],[-80.876099,73.333183],[-80.833885,73.693184],[-80.353058,73.75972],[-78.064438,73.651932],[-76.34,73.102685]]],[[[-86.562179,73.157447],[-85.774371,72.534126],[-84.850112,73.340278],[-82.31559,73.750951],[-80.600088,72.716544],[-80.748942,72.061907],[-78.770639,72.352173],[-77.824624,72.749617],[-75.605845,72.243678],[-74.228616,71.767144],[-74.099141,71.33084],[-72.242226,71.556925],[-71.200015,70.920013],[-68.786054,70.525024],[-67.91497,70.121948],[-66.969033,69.186087],[-68.805123,68.720198],[-66.449866,68.067163],[-64.862314,67.847539],[-63.424934,66.928473],[-61.851981,66.862121],[-62.163177,66.160251],[-63.918444,64.998669],[-65.14886,65.426033],[-66.721219,66.388041],[-68.015016,66.262726],[-68.141287,65.689789],[-67.089646,65.108455],[-65.73208,64.648406],[-65.320168,64.382737],[-64.669406,63.392927],[-65.013804,62.674185],[-66.275045,62.945099],[-68.783186,63.74567],[-67.369681,62.883966],[-66.328297,62.280075],[-66.165568,61.930897],[-68.877367,62.330149],[-71.023437,62.910708],[-72.235379,63.397836],[-71.886278,63.679989],[-73.378306,64.193963],[-74.834419,64.679076],[-74.818503,64.389093],[-77.70998,64.229542],[-78.555949,64.572906],[-77.897281,65.309192],[-76.018274,65.326969],[-73.959795,65.454765],[-74.293883,65.811771],[-73.944912,66.310578],[-72.651167,67.284576],[-72.92606,67.726926],[-73.311618,68.069437],[-74.843307,68.554627],[-76.869101,68.894736],[-76.228649,69.147769],[-77.28737,69.76954],[-78.168634,69.826488],[-78.957242,70.16688],[-79.492455,69.871808],[-81.305471,69.743185],[-84.944706,69.966634],[-87.060003,70.260001],[-88.681713,70.410741],[-89.51342,70.762038],[-88.467721,71.218186],[-89.888151,71.222552],[-90.20516,72.235074],[-89.436577,73.129464],[-88.408242,73.537889],[-85.826151,73.803816],[-86.562179,73.157447]]],[[[-100.35642,73.84389],[-99.16387,73.63339],[-97.38,73.76],[-97.12,73.47],[-98.05359,72.99052],[-96.54,72.56],[-96.72,71.66],[-98.35966,71.27285],[-99.32286,71.35639],[-100.01482,71.73827],[-102.5,72.51],[-102.48,72.83],[-100.43836,72.70588],[-101.54,73.36],[-100.35642,73.84389]]],[[[-93.196296,72.771992],[-94.269047,72.024596],[-95.409856,72.061881],[-96.033745,72.940277],[-96.018268,73.43743],[-95.495793,73.862417],[-94.503658,74.134907],[-92.420012,74.100025],[-90.509793,73.856732],[-92.003965,72.966244],[-93.196296,72.771992]]],[[[-120.46,71.383602],[-123.09219,70.90164],[-123.62,71.34],[-125.928949,71.868688],[-125.5,72.292261],[-124.80729,73.02256],[-123.94,73.68],[-124.91775,74.29275],[-121.53788,74.44893],[-120.10978,74.24135],[-117.55564,74.18577],[-116.58442,73.89607],[-115.51081,73.47519],[-116.76794,73.22292],[-119.22,72.52],[-120.46,71.82],[-120.46,71.383602]]],[[[-93.612756,74.979997],[-94.156909,74.592347],[-95.608681,74.666864],[-96.820932,74.927623],[-96.288587,75.377828],[-94.85082,75.647218],[-93.977747,75.29649],[-93.612756,74.979997]]],[[[-98.5,76.72],[-97.735585,76.25656],[-97.704415,75.74344],[-98.16,75],[-99.80874,74.89744],[-100.88366,75.05736],[-100.86292,75.64075],[-102.50209,75.5638],[-102.56552,76.3366],[-101.48973,76.30537],[-99.98349,76.64634],[-98.57699,76.58859],[-98.5,76.72]]],[[[-108.21141,76.20168],[-107.81943,75.84552],[-106.92893,76.01282],[-105.881,75.9694],[-105.70498,75.47951],[-106.31347,75.00527],[-109.7,74.85],[-112.22307,74.41696],[-113.74381,74.39427],[-113.87135,74.72029],[-111.79421,75.1625],[-116.31221,75.04343],[-117.7104,75.2222],[-116.34602,76.19903],[-115.40487,76.47887],[-112.59056,76.14134],[-110.81422,75.54919],[-109.0671,75.47321],[-110.49726,76.42982],[-109.5811,76.79417],[-108.54859,76.67832],[-108.21141,76.20168]]],[[[-94.684086,77.097878],[-93.573921,76.776296],[-91.605023,76.778518],[-90.741846,76.449597],[-90.969661,76.074013],[-89.822238,75.847774],[-89.187083,75.610166],[-87.838276,75.566189],[-86.379192,75.482421],[-84.789625,75.699204],[-82.753445,75.784315],[-81.128531,75.713983],[-80.057511,75.336849],[-79.833933,74.923127],[-80.457771,74.657304],[-81.948843,74.442459],[-83.228894,74.564028],[-86.097452,74.410032],[-88.15035,74.392307],[-89.764722,74.515555],[-92.422441,74.837758],[-92.768285,75.38682],[-92.889906,75.882655],[-93.893824,76.319244],[-95.962457,76.441381],[-97.121379,76.751078],[-96.745123,77.161389],[-94.684086,77.097878]]],[[[-116.198587,77.645287],[-116.335813,76.876962],[-117.106051,76.530032],[-118.040412,76.481172],[-119.899318,76.053213],[-121.499995,75.900019],[-122.854924,76.116543],[-122.854925,76.116543],[-121.157535,76.864508],[-119.103939,77.51222],[-117.570131,77.498319],[-116.198587,77.645287]]],[[[-93.840003,77.519997],[-94.295608,77.491343],[-96.169654,77.555111],[-96.436304,77.834629],[-94.422577,77.820005],[-93.720656,77.634331],[-93.840003,77.519997]]],[[[-110.186938,77.697015],[-112.051191,77.409229],[-113.534279,77.732207],[-112.724587,78.05105],[-111.264443,78.152956],[-109.854452,77.996325],[-110.186938,77.697015]]],[[[-109.663146,78.601973],[-110.881314,78.40692],[-112.542091,78.407902],[-112.525891,78.550555],[-111.50001,78.849994],[-110.963661,78.804441],[-109.663146,78.601973]]],[[[-95.830295,78.056941],[-97.309843,77.850597],[-98.124289,78.082857],[-98.552868,78.458105],[-98.631984,78.87193],[-97.337231,78.831984],[-96.754399,78.765813],[-95.559278,78.418315],[-95.830295,78.056941]]],[[[-100.060192,78.324754],[-99.670939,77.907545],[-101.30394,78.018985],[-102.949809,78.343229],[-105.176133,78.380332],[-104.210429,78.67742],[-105.41958,78.918336],[-105.492289,79.301594],[-103.529282,79.165349],[-100.825158,78.800462],[-100.060192,78.324754]]],[[[-87.02,79.66],[-85.81435,79.3369],[-87.18756,79.0393],[-89.03535,78.28723],[-90.80436,78.21533],[-92.87669,78.34333],[-93.95116,78.75099],[-93.93574,79.11373],[-93.14524,79.3801],[-94.974,79.37248],[-96.07614,79.70502],[-96.70972,80.15777],[-96.01644,80.60233],[-95.32345,80.90729],[-94.29843,80.97727],[-94.73542,81.20646],[-92.40984,81.25739],[-91.13289,80.72345],[-89.45,80.509322],[-87.81,80.32],[-87.02,79.66]]],[[[-68.5,83.106322],[-65.82735,83.02801],[-63.68,82.9],[-61.85,82.6286],[-61.89388,82.36165],[-64.334,81.92775],[-66.75342,81.72527],[-67.65755,81.50141],[-65.48031,81.50657],[-67.84,80.9],[-69.4697,80.61683],[-71.18,79.8],[-73.2428,79.63415],[-73.88,79.430162],[-76.90773,79.32309],[-75.52924,79.19766],[-76.22046,79.01907],[-75.39345,78.52581],[-76.34354,78.18296],[-77.88851,77.89991],[-78.36269,77.50859],[-79.75951,77.20968],[-79.61965,76.98336],[-77.91089,77.022045],[-77.88911,76.777955],[-80.56125,76.17812],[-83.17439,76.45403],[-86.11184,76.29901],[-87.6,76.42],[-89.49068,76.47239],[-89.6161,76.95213],[-87.76739,77.17833],[-88.26,77.9],[-87.65,77.970222],[-84.97634,77.53873],[-86.34,78.18],[-87.96192,78.37181],[-87.15198,78.75867],[-85.37868,78.9969],[-85.09495,79.34543],[-86.50734,79.73624],[-86.93179,80.25145],[-84.19844,80.20836],[-83.408696,80.1],[-81.84823,80.46442],[-84.1,80.58],[-87.59895,80.51627],[-89.36663,80.85569],[-90.2,81.26],[-91.36786,81.5531],[-91.58702,81.89429],[-90.1,82.085],[-88.93227,82.11751],[-86.97024,82.27961],[-85.5,82.652273],[-84.260005,82.6],[-83.18,82.32],[-82.42,82.86],[-81.1,83.02],[-79.30664,83.13056],[-76.25,83.172059],[-75.71878,83.06404],[-72.83153,83.23324],[-70.665765,83.169781],[-68.5,83.106322]]]]}},\n{\"type\":\"Feature\",\"id\":\"CHE\",\"properties\":{\"name\":\"Switzerland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[9.594226,47.525058],[9.632932,47.347601],[9.47997,47.10281],[9.932448,46.920728],[10.442701,46.893546],[10.363378,46.483571],[9.922837,46.314899],[9.182882,46.440215],[8.966306,46.036932],[8.489952,46.005151],[8.31663,46.163642],[7.755992,45.82449],[7.273851,45.776948],[6.843593,45.991147],[6.5001,46.429673],[6.022609,46.27299],[6.037389,46.725779],[6.768714,47.287708],[6.736571,47.541801],[7.192202,47.449766],[7.466759,47.620582],[8.317301,47.61358],[8.522612,47.830828],[9.594226,47.525058]]]}},\n{\"type\":\"Feature\",\"id\":\"CHL\",\"properties\":{\"name\":\"Chile\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-68.63401,-52.63637],[-68.63335,-54.8695],[-67.56244,-54.87001],[-66.95992,-54.89681],[-67.29103,-55.30124],[-68.14863,-55.61183],[-68.639991,-55.580018],[-69.2321,-55.49906],[-69.95809,-55.19843],[-71.00568,-55.05383],[-72.2639,-54.49514],[-73.2852,-53.95752],[-74.66253,-52.83749],[-73.8381,-53.04743],[-72.43418,-53.7154],[-71.10773,-54.07433],[-70.59178,-53.61583],[-70.26748,-52.93123],[-69.34565,-52.5183],[-68.63401,-52.63637]]],[[[-68.219913,-21.494347],[-67.82818,-22.872919],[-67.106674,-22.735925],[-66.985234,-22.986349],[-67.328443,-24.025303],[-68.417653,-24.518555],[-68.386001,-26.185016],[-68.5948,-26.506909],[-68.295542,-26.89934],[-69.001235,-27.521214],[-69.65613,-28.459141],[-70.01355,-29.367923],[-69.919008,-30.336339],[-70.535069,-31.36501],[-70.074399,-33.09121],[-69.814777,-33.273886],[-69.817309,-34.193571],[-70.388049,-35.169688],[-70.364769,-36.005089],[-71.121881,-36.658124],[-71.118625,-37.576827],[-70.814664,-38.552995],[-71.413517,-38.916022],[-71.680761,-39.808164],[-71.915734,-40.832339],[-71.746804,-42.051386],[-72.148898,-42.254888],[-71.915424,-43.408565],[-71.464056,-43.787611],[-71.793623,-44.207172],[-71.329801,-44.407522],[-71.222779,-44.784243],[-71.659316,-44.973689],[-71.552009,-45.560733],[-71.917258,-46.884838],[-72.447355,-47.738533],[-72.331161,-48.244238],[-72.648247,-48.878618],[-73.415436,-49.318436],[-73.328051,-50.378785],[-72.975747,-50.74145],[-72.309974,-50.67701],[-72.329404,-51.425956],[-71.914804,-52.009022],[-69.498362,-52.142761],[-68.571545,-52.299444],[-69.461284,-52.291951],[-69.94278,-52.537931],[-70.845102,-52.899201],[-71.006332,-53.833252],[-71.429795,-53.856455],[-72.557943,-53.53141],[-73.702757,-52.835069],[-73.702757,-52.83507],[-74.946763,-52.262754],[-75.260026,-51.629355],[-74.976632,-51.043396],[-75.479754,-50.378372],[-75.608015,-48.673773],[-75.18277,-47.711919],[-74.126581,-46.939253],[-75.644395,-46.647643],[-74.692154,-45.763976],[-74.351709,-44.103044],[-73.240356,-44.454961],[-72.717804,-42.383356],[-73.3889,-42.117532],[-73.701336,-43.365776],[-74.331943,-43.224958],[-74.017957,-41.794813],[-73.677099,-39.942213],[-73.217593,-39.258689],[-73.505559,-38.282883],[-73.588061,-37.156285],[-73.166717,-37.12378],[-72.553137,-35.50884],[-71.861732,-33.909093],[-71.43845,-32.418899],[-71.668721,-30.920645],[-71.370083,-30.095682],[-71.489894,-28.861442],[-70.905124,-27.64038],[-70.724954,-25.705924],[-70.403966,-23.628997],[-70.091246,-21.393319],[-70.16442,-19.756468],[-70.372572,-18.347975],[-69.858444,-18.092694],[-69.590424,-17.580012],[-69.100247,-18.260125],[-68.966818,-18.981683],[-68.442225,-19.405068],[-68.757167,-20.372658],[-68.219913,-21.494347]]]]}},\n{\"type\":\"Feature\",\"id\":\"CHN\",\"properties\":{\"name\":\"China\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[110.339188,18.678395],[109.47521,18.197701],[108.655208,18.507682],[108.626217,19.367888],[109.119056,19.821039],[110.211599,20.101254],[110.786551,20.077534],[111.010051,19.69593],[110.570647,19.255879],[110.339188,18.678395]]],[[[127.657407,49.76027],[129.397818,49.4406],[130.582293,48.729687],[130.987282,47.790132],[132.506672,47.78897],[133.373596,48.183442],[135.026311,48.47823],[134.500814,47.57844],[134.112362,47.212467],[133.769644,46.116927],[133.097127,45.144066],[131.883454,45.321162],[131.025212,44.967953],[131.288555,44.11152],[131.144688,42.92999],[130.633866,42.903015],[130.640016,42.395009],[129.994267,42.985387],[129.596669,42.424982],[128.052215,41.994285],[128.208433,41.466772],[127.343783,41.503152],[126.869083,41.816569],[126.182045,41.107336],[125.079942,40.569824],[124.265625,39.928493],[122.86757,39.637788],[122.131388,39.170452],[121.054554,38.897471],[121.585995,39.360854],[121.376757,39.750261],[122.168595,40.422443],[121.640359,40.94639],[120.768629,40.593388],[119.639602,39.898056],[119.023464,39.252333],[118.042749,39.204274],[117.532702,38.737636],[118.059699,38.061476],[118.87815,37.897325],[118.911636,37.448464],[119.702802,37.156389],[120.823457,37.870428],[121.711259,37.481123],[122.357937,37.454484],[122.519995,36.930614],[121.104164,36.651329],[120.637009,36.11144],[119.664562,35.609791],[119.151208,34.909859],[120.227525,34.360332],[120.620369,33.376723],[121.229014,32.460319],[121.908146,31.692174],[121.891919,30.949352],[121.264257,30.676267],[121.503519,30.142915],[122.092114,29.83252],[121.938428,29.018022],[121.684439,28.225513],[121.125661,28.135673],[120.395473,27.053207],[119.585497,25.740781],[118.656871,24.547391],[117.281606,23.624501],[115.890735,22.782873],[114.763827,22.668074],[114.152547,22.22376],[113.80678,22.54834],[113.241078,22.051367],[111.843592,21.550494],[110.785466,21.397144],[110.444039,20.341033],[109.889861,20.282457],[109.627655,21.008227],[109.864488,21.395051],[108.522813,21.715212],[108.05018,21.55238],[107.04342,21.811899],[106.567273,22.218205],[106.725403,22.794268],[105.811247,22.976892],[105.329209,23.352063],[104.476858,22.81915],[103.504515,22.703757],[102.706992,22.708795],[102.170436,22.464753],[101.652018,22.318199],[101.80312,21.174367],[101.270026,21.201652],[101.180005,21.436573],[101.150033,21.849984],[100.416538,21.558839],[99.983489,21.742937],[99.240899,22.118314],[99.531992,22.949039],[98.898749,23.142722],[98.660262,24.063286],[97.60472,23.897405],[97.724609,25.083637],[98.671838,25.918703],[98.712094,26.743536],[98.68269,27.508812],[98.246231,27.747221],[97.911988,28.335945],[97.327114,28.261583],[96.248833,28.411031],[96.586591,28.83098],[96.117679,29.452802],[95.404802,29.031717],[94.56599,29.277438],[93.413348,28.640629],[92.503119,27.896876],[91.696657,27.771742],[91.258854,28.040614],[90.730514,28.064954],[90.015829,28.296439],[89.47581,28.042759],[88.814248,27.299316],[88.730326,28.086865],[88.120441,27.876542],[86.954517,27.974262],[85.82332,28.203576],[85.011638,28.642774],[84.23458,28.839894],[83.898993,29.320226],[83.337115,29.463732],[82.327513,30.115268],[81.525804,30.422717],[81.111256,30.183481],[79.721367,30.882715],[78.738894,31.515906],[78.458446,32.618164],[79.176129,32.48378],[79.208892,32.994395],[78.811086,33.506198],[78.912269,34.321936],[77.837451,35.49401],[76.192848,35.898403],[75.896897,36.666806],[75.158028,37.133031],[74.980002,37.41999],[74.829986,37.990007],[74.864816,38.378846],[74.257514,38.606507],[73.928852,38.505815],[73.675379,39.431237],[73.960013,39.660008],[73.822244,39.893973],[74.776862,40.366425],[75.467828,40.562072],[76.526368,40.427946],[76.904484,41.066486],[78.187197,41.185316],[78.543661,41.582243],[80.11943,42.123941],[80.25999,42.349999],[80.18015,42.920068],[80.866206,43.180362],[79.966106,44.917517],[81.947071,45.317027],[82.458926,45.53965],[83.180484,47.330031],[85.16429,47.000956],[85.720484,47.452969],[85.768233,48.455751],[86.598776,48.549182],[87.35997,49.214981],[87.751264,49.297198],[88.013832,48.599463],[88.854298,48.069082],[90.280826,47.693549],[90.970809,46.888146],[90.585768,45.719716],[90.94554,45.286073],[92.133891,45.115076],[93.480734,44.975472],[94.688929,44.352332],[95.306875,44.241331],[95.762455,43.319449],[96.349396,42.725635],[97.451757,42.74889],[99.515817,42.524691],[100.845866,42.663804],[101.83304,42.514873],[103.312278,41.907468],[104.522282,41.908347],[104.964994,41.59741],[106.129316,42.134328],[107.744773,42.481516],[109.243596,42.519446],[110.412103,42.871234],[111.129682,43.406834],[111.829588,43.743118],[111.667737,44.073176],[111.348377,44.457442],[111.873306,45.102079],[112.436062,45.011646],[113.463907,44.808893],[114.460332,45.339817],[115.985096,45.727235],[116.717868,46.388202],[117.421701,46.672733],[118.874326,46.805412],[119.66327,46.69268],[119.772824,47.048059],[118.866574,47.74706],[118.064143,48.06673],[117.295507,47.697709],[116.308953,47.85341],[115.742837,47.726545],[115.485282,48.135383],[116.191802,49.134598],[116.678801,49.888531],[117.879244,49.510983],[119.288461,50.142883],[119.279366,50.582908],[120.18205,51.643566],[120.738191,51.964115],[120.725789,52.516226],[120.177089,52.753886],[121.003085,53.251401],[122.245748,53.431726],[123.571507,53.458804],[125.068211,53.161045],[125.946349,52.792799],[126.564399,51.784255],[126.939157,51.353894],[127.287456,50.739797],[127.657407,49.76027]]]]}},\n{\"type\":\"Feature\",\"id\":\"CIV\",\"properties\":{\"name\":\"Ivory Coast\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-2.856125,4.994476],[-3.311084,4.984296],[-4.00882,5.179813],[-4.649917,5.168264],[-5.834496,4.993701],[-6.528769,4.705088],[-7.518941,4.338288],[-7.712159,4.364566],[-7.635368,5.188159],[-7.539715,5.313345],[-7.570153,5.707352],[-7.993693,6.12619],[-8.311348,6.193033],[-8.60288,6.467564],[-8.385452,6.911801],[-8.485446,7.395208],[-8.439298,7.686043],[-8.280703,7.68718],[-8.221792,8.123329],[-8.299049,8.316444],[-8.203499,8.455453],[-7.8321,8.575704],[-8.079114,9.376224],[-8.309616,9.789532],[-8.229337,10.12902],[-8.029944,10.206535],[-7.89959,10.297382],[-7.622759,10.147236],[-6.850507,10.138994],[-6.666461,10.430811],[-6.493965,10.411303],[-6.205223,10.524061],[-6.050452,10.096361],[-5.816926,10.222555],[-5.404342,10.370737],[-4.954653,10.152714],[-4.779884,9.821985],[-4.330247,9.610835],[-3.980449,9.862344],[-3.511899,9.900326],[-2.827496,9.642461],[-2.56219,8.219628],[-2.983585,7.379705],[-3.24437,6.250472],[-2.810701,5.389051],[-2.856125,4.994476]]]}},\n{\"type\":\"Feature\",\"id\":\"CMR\",\"properties\":{\"name\":\"Cameroon\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[13.075822,2.267097],[12.951334,2.321616],[12.35938,2.192812],[11.751665,2.326758],[11.276449,2.261051],[9.649158,2.283866],[9.795196,3.073404],[9.404367,3.734527],[8.948116,3.904129],[8.744924,4.352215],[8.488816,4.495617],[8.500288,4.771983],[8.757533,5.479666],[9.233163,6.444491],[9.522706,6.453482],[10.118277,7.03877],[10.497375,7.055358],[11.058788,6.644427],[11.745774,6.981383],[11.839309,7.397042],[12.063946,7.799808],[12.218872,8.305824],[12.753672,8.717763],[12.955468,9.417772],[13.1676,9.640626],[13.308676,10.160362],[13.57295,10.798566],[14.415379,11.572369],[14.468192,11.904752],[14.577178,12.085361],[14.181336,12.483657],[14.213531,12.802035],[14.495787,12.859396],[14.893386,12.219048],[14.960152,11.555574],[14.923565,10.891325],[15.467873,9.982337],[14.909354,9.992129],[14.627201,9.920919],[14.171466,10.021378],[13.954218,9.549495],[14.544467,8.965861],[14.979996,8.796104],[15.120866,8.38215],[15.436092,7.692812],[15.27946,7.421925],[14.776545,6.408498],[14.53656,6.226959],[14.459407,5.451761],[14.558936,5.030598],[14.478372,4.732605],[14.950953,4.210389],[15.03622,3.851367],[15.405396,3.335301],[15.862732,3.013537],[15.907381,2.557389],[16.012852,2.26764],[15.940919,1.727673],[15.146342,1.964015],[14.337813,2.227875],[13.075822,2.267097]]]}},\n{\"type\":\"Feature\",\"id\":\"COD\",\"properties\":{\"name\":\"Democratic Republic of the Congo\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[30.83386,3.509166],[30.773347,2.339883],[31.174149,2.204465],[30.85267,1.849396],[30.468508,1.583805],[30.086154,1.062313],[29.875779,0.59738],[29.819503,-0.20531],[29.587838,-0.587406],[29.579466,-1.341313],[29.291887,-1.620056],[29.254835,-2.21511],[29.117479,-2.292211],[29.024926,-2.839258],[29.276384,-3.293907],[29.339998,-4.499983],[29.519987,-5.419979],[29.419993,-5.939999],[29.620032,-6.520015],[30.199997,-7.079981],[30.740015,-8.340007],[30.346086,-8.238257],[29.002912,-8.407032],[28.734867,-8.526559],[28.449871,-9.164918],[28.673682,-9.605925],[28.49607,-10.789884],[28.372253,-11.793647],[28.642417,-11.971569],[29.341548,-12.360744],[29.616001,-12.178895],[29.699614,-13.257227],[28.934286,-13.248958],[28.523562,-12.698604],[28.155109,-12.272481],[27.388799,-12.132747],[27.16442,-11.608748],[26.553088,-11.92444],[25.75231,-11.784965],[25.418118,-11.330936],[24.78317,-11.238694],[24.314516,-11.262826],[24.257155,-10.951993],[23.912215,-10.926826],[23.456791,-10.867863],[22.837345,-11.017622],[22.402798,-10.993075],[22.155268,-11.084801],[22.208753,-9.894796],[21.875182,-9.523708],[21.801801,-8.908707],[21.949131,-8.305901],[21.746456,-7.920085],[21.728111,-7.290872],[20.514748,-7.299606],[20.601823,-6.939318],[20.091622,-6.94309],[20.037723,-7.116361],[19.417502,-7.155429],[19.166613,-7.738184],[19.016752,-7.988246],[18.464176,-7.847014],[18.134222,-7.987678],[17.47297,-8.068551],[17.089996,-7.545689],[16.860191,-7.222298],[16.57318,-6.622645],[16.326528,-5.87747],[13.375597,-5.864241],[13.024869,-5.984389],[12.735171,-5.965682],[12.322432,-6.100092],[12.182337,-5.789931],[12.436688,-5.684304],[12.468004,-5.248362],[12.631612,-4.991271],[12.995517,-4.781103],[13.25824,-4.882957],[13.600235,-4.500138],[14.144956,-4.510009],[14.209035,-4.793092],[14.582604,-4.970239],[15.170992,-4.343507],[15.75354,-3.855165],[16.00629,-3.535133],[15.972803,-2.712392],[16.407092,-1.740927],[16.865307,-1.225816],[17.523716,-0.74383],[17.638645,-0.424832],[17.663553,-0.058084],[17.82654,0.288923],[17.774192,0.855659],[17.898835,1.741832],[18.094276,2.365722],[18.393792,2.900443],[18.453065,3.504386],[18.542982,4.201785],[18.932312,4.709506],[19.467784,5.031528],[20.290679,4.691678],[20.927591,4.322786],[21.659123,4.224342],[22.405124,4.02916],[22.704124,4.633051],[22.84148,4.710126],[23.297214,4.609693],[24.410531,5.108784],[24.805029,4.897247],[25.128833,4.927245],[25.278798,5.170408],[25.650455,5.256088],[26.402761,5.150875],[27.044065,5.127853],[27.374226,5.233944],[27.979977,4.408413],[28.428994,4.287155],[28.696678,4.455077],[29.159078,4.389267],[29.715995,4.600805],[29.9535,4.173699],[30.83386,3.509166]]]}},\n{\"type\":\"Feature\",\"id\":\"COG\",\"properties\":{\"name\":\"Republic of the Congo\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[12.995517,-4.781103],[12.62076,-4.438023],[12.318608,-4.60623],[11.914963,-5.037987],[11.093773,-3.978827],[11.855122,-3.426871],[11.478039,-2.765619],[11.820964,-2.514161],[12.495703,-2.391688],[12.575284,-1.948511],[13.109619,-2.42874],[13.992407,-2.470805],[14.29921,-1.998276],[14.425456,-1.333407],[14.316418,-0.552627],[13.843321,0.038758],[14.276266,1.19693],[14.026669,1.395677],[13.282631,1.314184],[13.003114,1.830896],[13.075822,2.267097],[14.337813,2.227875],[15.146342,1.964015],[15.940919,1.727673],[16.012852,2.26764],[16.537058,3.198255],[17.133042,3.728197],[17.8099,3.560196],[18.453065,3.504386],[18.393792,2.900443],[18.094276,2.365722],[17.898835,1.741832],[17.774192,0.855659],[17.82654,0.288923],[17.663553,-0.058084],[17.638645,-0.424832],[17.523716,-0.74383],[16.865307,-1.225816],[16.407092,-1.740927],[15.972803,-2.712392],[16.00629,-3.535133],[15.75354,-3.855165],[15.170992,-4.343507],[14.582604,-4.970239],[14.209035,-4.793092],[14.144956,-4.510009],[13.600235,-4.500138],[13.25824,-4.882957],[12.995517,-4.781103]]]}},\n{\"type\":\"Feature\",\"id\":\"COL\",\"properties\":{\"name\":\"Colombia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-75.373223,-0.152032],[-75.801466,0.084801],[-76.292314,0.416047],[-76.57638,0.256936],[-77.424984,0.395687],[-77.668613,0.825893],[-77.855061,0.809925],[-78.855259,1.380924],[-78.990935,1.69137],[-78.617831,1.766404],[-78.662118,2.267355],[-78.42761,2.629556],[-77.931543,2.696606],[-77.510431,3.325017],[-77.12769,3.849636],[-77.496272,4.087606],[-77.307601,4.667984],[-77.533221,5.582812],[-77.318815,5.845354],[-77.476661,6.691116],[-77.881571,7.223771],[-77.753414,7.70984],[-77.431108,7.638061],[-77.242566,7.935278],[-77.474723,8.524286],[-77.353361,8.670505],[-76.836674,8.638749],[-76.086384,9.336821],[-75.6746,9.443248],[-75.664704,9.774003],[-75.480426,10.61899],[-74.906895,11.083045],[-74.276753,11.102036],[-74.197223,11.310473],[-73.414764,11.227015],[-72.627835,11.731972],[-72.238195,11.95555],[-71.75409,12.437303],[-71.399822,12.376041],[-71.137461,12.112982],[-71.331584,11.776284],[-71.973922,11.608672],[-72.227575,11.108702],[-72.614658,10.821975],[-72.905286,10.450344],[-73.027604,9.73677],[-73.304952,9.152],[-72.78873,9.085027],[-72.660495,8.625288],[-72.439862,8.405275],[-72.360901,8.002638],[-72.479679,7.632506],[-72.444487,7.423785],[-72.198352,7.340431],[-71.960176,6.991615],[-70.674234,7.087785],[-70.093313,6.960376],[-69.38948,6.099861],[-68.985319,6.206805],[-68.265052,6.153268],[-67.695087,6.267318],[-67.34144,6.095468],[-67.521532,5.55687],[-67.744697,5.221129],[-67.823012,4.503937],[-67.621836,3.839482],[-67.337564,3.542342],[-67.303173,3.318454],[-67.809938,2.820655],[-67.447092,2.600281],[-67.181294,2.250638],[-66.876326,1.253361],[-67.065048,1.130112],[-67.259998,1.719999],[-67.53781,2.037163],[-67.868565,1.692455],[-69.816973,1.714805],[-69.804597,1.089081],[-69.218638,0.985677],[-69.252434,0.602651],[-69.452396,0.706159],[-70.015566,0.541414],[-70.020656,-0.185156],[-69.577065,-0.549992],[-69.420486,-1.122619],[-69.444102,-1.556287],[-69.893635,-4.298187],[-70.394044,-3.766591],[-70.692682,-3.742872],[-70.047709,-2.725156],[-70.813476,-2.256865],[-71.413646,-2.342802],[-71.774761,-2.16979],[-72.325787,-2.434218],[-73.070392,-2.308954],[-73.659504,-1.260491],[-74.122395,-1.002833],[-74.441601,-0.53082],[-75.106625,-0.057205],[-75.373223,-0.152032]]]}},\n{\"type\":\"Feature\",\"id\":\"CRI\",\"properties\":{\"name\":\"Costa Rica\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-82.965783,8.225028],[-83.508437,8.446927],[-83.711474,8.656836],[-83.596313,8.830443],[-83.632642,9.051386],[-83.909886,9.290803],[-84.303402,9.487354],[-84.647644,9.615537],[-84.713351,9.908052],[-84.97566,10.086723],[-84.911375,9.795992],[-85.110923,9.55704],[-85.339488,9.834542],[-85.660787,9.933347],[-85.797445,10.134886],[-85.791709,10.439337],[-85.659314,10.754331],[-85.941725,10.895278],[-85.71254,11.088445],[-85.561852,11.217119],[-84.903003,10.952303],[-84.673069,11.082657],[-84.355931,10.999226],[-84.190179,10.79345],[-83.895054,10.726839],[-83.655612,10.938764],[-83.40232,10.395438],[-83.015677,9.992982],[-82.546196,9.566135],[-82.932891,9.476812],[-82.927155,9.07433],[-82.719183,8.925709],[-82.868657,8.807266],[-82.829771,8.626295],[-82.913176,8.423517],[-82.965783,8.225028]]]}},\n{\"type\":\"Feature\",\"id\":\"CUB\",\"properties\":{\"name\":\"Cuba\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-82.268151,23.188611],[-81.404457,23.117271],[-80.618769,23.10598],[-79.679524,22.765303],[-79.281486,22.399202],[-78.347434,22.512166],[-77.993296,22.277194],[-77.146422,21.657851],[-76.523825,21.20682],[-76.19462,21.220565],[-75.598222,21.016624],[-75.67106,20.735091],[-74.933896,20.693905],[-74.178025,20.284628],[-74.296648,20.050379],[-74.961595,19.923435],[-75.63468,19.873774],[-76.323656,19.952891],[-77.755481,19.855481],[-77.085108,20.413354],[-77.492655,20.673105],[-78.137292,20.739949],[-78.482827,21.028613],[-78.719867,21.598114],[-79.285,21.559175],[-80.217475,21.827324],[-80.517535,22.037079],[-81.820943,22.192057],[-82.169992,22.387109],[-81.795002,22.636965],[-82.775898,22.68815],[-83.494459,22.168518],[-83.9088,22.154565],[-84.052151,21.910575],[-84.54703,21.801228],[-84.974911,21.896028],[-84.447062,22.20495],[-84.230357,22.565755],[-83.77824,22.788118],[-83.267548,22.983042],[-82.510436,23.078747],[-82.268151,23.188611]]]}},\n{\"type\":\"Feature\",\"id\":\"-99\",\"properties\":{\"name\":\"Northern Cyprus\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[32.73178,35.140026],[32.802474,35.145504],[32.946961,35.386703],[33.667227,35.373216],[34.576474,35.671596],[33.900804,35.245756],[33.973617,35.058506],[33.86644,35.093595],[33.675392,35.017863],[33.525685,35.038688],[33.475817,35.000345],[33.455922,35.101424],[33.383833,35.162712],[33.190977,35.173125],[32.919572,35.087833],[32.73178,35.140026]]]}},\n{\"type\":\"Feature\",\"id\":\"CYP\",\"properties\":{\"name\":\"Cyprus\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[33.973617,35.058506],[34.004881,34.978098],[32.979827,34.571869],[32.490296,34.701655],[32.256667,35.103232],[32.73178,35.140026],[32.919572,35.087833],[33.190977,35.173125],[33.383833,35.162712],[33.455922,35.101424],[33.475817,35.000345],[33.525685,35.038688],[33.675392,35.017863],[33.86644,35.093595],[33.973617,35.058506]]]}},\n{\"type\":\"Feature\",\"id\":\"CZE\",\"properties\":{\"name\":\"Czech Republic\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[16.960288,48.596982],[16.499283,48.785808],[16.029647,48.733899],[15.253416,49.039074],[14.901447,48.964402],[14.338898,48.555305],[13.595946,48.877172],[13.031329,49.307068],[12.521024,49.547415],[12.415191,49.969121],[12.240111,50.266338],[12.966837,50.484076],[13.338132,50.733234],[14.056228,50.926918],[14.307013,51.117268],[14.570718,51.002339],[15.016996,51.106674],[15.490972,50.78473],[16.238627,50.697733],[16.176253,50.422607],[16.719476,50.215747],[16.868769,50.473974],[17.554567,50.362146],[17.649445,50.049038],[18.392914,49.988629],[18.853144,49.49623],[18.554971,49.495015],[18.399994,49.315001],[18.170498,49.271515],[18.104973,49.043983],[17.913512,48.996493],[17.886485,48.903475],[17.545007,48.800019],[17.101985,48.816969],[16.960288,48.596982]]]}},\n{\"type\":\"Feature\",\"id\":\"DEU\",\"properties\":{\"name\":\"Germany\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[9.921906,54.983104],[9.93958,54.596642],[10.950112,54.363607],[10.939467,54.008693],[11.956252,54.196486],[12.51844,54.470371],[13.647467,54.075511],[14.119686,53.757029],[14.353315,53.248171],[14.074521,52.981263],[14.4376,52.62485],[14.685026,52.089947],[14.607098,51.745188],[15.016996,51.106674],[14.570718,51.002339],[14.307013,51.117268],[14.056228,50.926918],[13.338132,50.733234],[12.966837,50.484076],[12.240111,50.266338],[12.415191,49.969121],[12.521024,49.547415],[13.031329,49.307068],[13.595946,48.877172],[13.243357,48.416115],[12.884103,48.289146],[13.025851,47.637584],[12.932627,47.467646],[12.62076,47.672388],[12.141357,47.703083],[11.426414,47.523766],[10.544504,47.566399],[10.402084,47.302488],[9.896068,47.580197],[9.594226,47.525058],[8.522612,47.830828],[8.317301,47.61358],[7.466759,47.620582],[7.593676,48.333019],[8.099279,49.017784],[6.65823,49.201958],[6.18632,49.463803],[6.242751,49.902226],[6.043073,50.128052],[6.156658,50.803721],[5.988658,51.851616],[6.589397,51.852029],[6.84287,52.22844],[7.092053,53.144043],[6.90514,53.482162],[7.100425,53.693932],[7.936239,53.748296],[8.121706,53.527792],[8.800734,54.020786],[8.572118,54.395646],[8.526229,54.962744],[9.282049,54.830865],[9.921906,54.983104]]]}},\n{\"type\":\"Feature\",\"id\":\"DJI\",\"properties\":{\"name\":\"Djibouti\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[43.081226,12.699639],[43.317852,12.390148],[43.286381,11.974928],[42.715874,11.735641],[43.145305,11.46204],[42.776852,10.926879],[42.55493,11.10511],[42.31414,11.0342],[41.75557,11.05091],[41.73959,11.35511],[41.66176,11.6312],[42,12.1],[42.35156,12.54223],[42.779642,12.455416],[43.081226,12.699639]]]}},\n{\"type\":\"Feature\",\"id\":\"DNK\",\"properties\":{\"name\":\"Denmark\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[12.690006,55.609991],[12.089991,54.800015],[11.043543,55.364864],[10.903914,55.779955],[12.370904,56.111407],[12.690006,55.609991]]],[[[10.912182,56.458621],[10.667804,56.081383],[10.369993,56.190007],[9.649985,55.469999],[9.921906,54.983104],[9.282049,54.830865],[8.526229,54.962744],[8.120311,55.517723],[8.089977,56.540012],[8.256582,56.809969],[8.543438,57.110003],[9.424469,57.172066],[9.775559,57.447941],[10.580006,57.730017],[10.546106,57.215733],[10.25,56.890016],[10.369993,56.609982],[10.912182,56.458621]]]]}},\n{\"type\":\"Feature\",\"id\":\"DOM\",\"properties\":{\"name\":\"Dominican Republic\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-71.712361,19.714456],[-71.587304,19.884911],[-70.806706,19.880286],[-70.214365,19.622885],[-69.950815,19.648],[-69.76925,19.293267],[-69.222126,19.313214],[-69.254346,19.015196],[-68.809412,18.979074],[-68.317943,18.612198],[-68.689316,18.205142],[-69.164946,18.422648],[-69.623988,18.380713],[-69.952934,18.428307],[-70.133233,18.245915],[-70.517137,18.184291],[-70.669298,18.426886],[-70.99995,18.283329],[-71.40021,17.598564],[-71.657662,17.757573],[-71.708305,18.044997],[-71.687738,18.31666],[-71.945112,18.6169],[-71.701303,18.785417],[-71.624873,19.169838],[-71.712361,19.714456]]]}},\n{\"type\":\"Feature\",\"id\":\"DZA\",\"properties\":{\"name\":\"Algeria\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[11.999506,23.471668],[8.572893,21.565661],[5.677566,19.601207],[4.267419,19.155265],[3.158133,19.057364],[3.146661,19.693579],[2.683588,19.85623],[2.060991,20.142233],[1.823228,20.610809],[-1.550055,22.792666],[-4.923337,24.974574],[-8.6844,27.395744],[-8.665124,27.589479],[-8.66559,27.656426],[-8.674116,28.841289],[-7.059228,29.579228],[-6.060632,29.7317],[-5.242129,30.000443],[-4.859646,30.501188],[-3.690441,30.896952],[-3.647498,31.637294],[-3.06898,31.724498],[-2.616605,32.094346],[-1.307899,32.262889],[-1.124551,32.651522],[-1.388049,32.864015],[-1.733455,33.919713],[-1.792986,34.527919],[-2.169914,35.168396],[-1.208603,35.714849],[-0.127454,35.888662],[0.503877,36.301273],[1.466919,36.605647],[3.161699,36.783905],[4.815758,36.865037],[5.32012,36.716519],[6.26182,37.110655],[7.330385,37.118381],[7.737078,36.885708],[8.420964,36.946427],[8.217824,36.433177],[8.376368,35.479876],[8.140981,34.655146],[7.524482,34.097376],[7.612642,33.344115],[8.430473,32.748337],[8.439103,32.506285],[9.055603,32.102692],[9.48214,30.307556],[9.805634,29.424638],[9.859998,28.95999],[9.683885,28.144174],[9.756128,27.688259],[9.629056,27.140953],[9.716286,26.512206],[9.319411,26.094325],[9.910693,25.365455],[9.948261,24.936954],[10.303847,24.379313],[10.771364,24.562532],[11.560669,24.097909],[11.999506,23.471668]]]}},\n{\"type\":\"Feature\",\"id\":\"ECU\",\"properties\":{\"name\":\"Ecuador\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-80.302561,-3.404856],[-79.770293,-2.657512],[-79.986559,-2.220794],[-80.368784,-2.685159],[-80.967765,-2.246943],[-80.764806,-1.965048],[-80.933659,-1.057455],[-80.58337,-0.906663],[-80.399325,-0.283703],[-80.020898,0.36034],[-80.09061,0.768429],[-79.542762,0.982938],[-78.855259,1.380924],[-77.855061,0.809925],[-77.668613,0.825893],[-77.424984,0.395687],[-76.57638,0.256936],[-76.292314,0.416047],[-75.801466,0.084801],[-75.373223,-0.152032],[-75.233723,-0.911417],[-75.544996,-1.56161],[-76.635394,-2.608678],[-77.837905,-3.003021],[-78.450684,-3.873097],[-78.639897,-4.547784],[-79.205289,-4.959129],[-79.624979,-4.454198],[-80.028908,-4.346091],[-80.442242,-4.425724],[-80.469295,-4.059287],[-80.184015,-3.821162],[-80.302561,-3.404856]]]}},\n{\"type\":\"Feature\",\"id\":\"EGY\",\"properties\":{\"name\":\"Egypt\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[34.9226,29.50133],[34.64174,29.09942],[34.42655,28.34399],[34.15451,27.8233],[33.92136,27.6487],[33.58811,27.97136],[33.13676,28.41765],[32.42323,29.85108],[32.32046,29.76043],[32.73482,28.70523],[33.34876,27.69989],[34.10455,26.14227],[34.47387,25.59856],[34.79507,25.03375],[35.69241,23.92671],[35.49372,23.75237],[35.52598,23.10244],[36.69069,22.20485],[36.86623,22],[32.9,22],[29.02,22],[25,22],[25,25.6825],[25,29.238655],[24.70007,30.04419],[24.95762,30.6616],[24.80287,31.08929],[25.16482,31.56915],[26.49533,31.58568],[27.45762,31.32126],[28.45048,31.02577],[28.91353,30.87005],[29.68342,31.18686],[30.09503,31.4734],[30.97693,31.55586],[31.68796,31.4296],[31.96041,30.9336],[32.19247,31.26034],[32.99392,31.02407],[33.7734,30.96746],[34.26544,31.21936],[34.9226,29.50133]]]}},\n{\"type\":\"Feature\",\"id\":\"ERI\",\"properties\":{\"name\":\"Eritrea\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[42.35156,12.54223],[42.00975,12.86582],[41.59856,13.45209],[41.155194,13.77332],[40.8966,14.11864],[40.026219,14.519579],[39.34061,14.53155],[39.0994,14.74064],[38.51295,14.50547],[37.90607,14.95943],[37.59377,14.2131],[36.42951,14.42211],[36.323189,14.822481],[36.75386,16.291874],[36.85253,16.95655],[37.16747,17.26314],[37.904,17.42754],[38.41009,17.998307],[38.990623,16.840626],[39.26611,15.922723],[39.814294,15.435647],[41.179275,14.49108],[41.734952,13.921037],[42.276831,13.343992],[42.589576,13.000421],[43.081226,12.699639],[42.779642,12.455416],[42.35156,12.54223]]]}},\n{\"type\":\"Feature\",\"id\":\"ESP\",\"properties\":{\"name\":\"Spain\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-9.034818,41.880571],[-8.984433,42.592775],[-9.392884,43.026625],[-7.97819,43.748338],[-6.754492,43.567909],[-5.411886,43.57424],[-4.347843,43.403449],[-3.517532,43.455901],[-1.901351,43.422802],[-1.502771,43.034014],[0.338047,42.579546],[0.701591,42.795734],[1.826793,42.343385],[2.985999,42.473015],[3.039484,41.89212],[2.091842,41.226089],[0.810525,41.014732],[0.721331,40.678318],[0.106692,40.123934],[-0.278711,39.309978],[0.111291,38.738514],[-0.467124,38.292366],[-0.683389,37.642354],[-1.438382,37.443064],[-2.146453,36.674144],[-3.415781,36.6589],[-4.368901,36.677839],[-4.995219,36.324708],[-5.37716,35.94685],[-5.866432,36.029817],[-6.236694,36.367677],[-6.520191,36.942913],[-7.453726,37.097788],[-7.537105,37.428904],[-7.166508,37.803894],[-7.029281,38.075764],[-7.374092,38.373059],[-7.098037,39.030073],[-7.498632,39.629571],[-7.066592,39.711892],[-7.026413,40.184524],[-6.86402,40.330872],[-6.851127,41.111083],[-6.389088,41.381815],[-6.668606,41.883387],[-7.251309,41.918346],[-7.422513,41.792075],[-8.013175,41.790886],[-8.263857,42.280469],[-8.671946,42.134689],[-9.034818,41.880571]]]}},\n{\"type\":\"Feature\",\"id\":\"EST\",\"properties\":{\"name\":\"Estonia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[24.312863,57.793424],[24.428928,58.383413],[24.061198,58.257375],[23.42656,58.612753],[23.339795,59.18724],[24.604214,59.465854],[25.864189,59.61109],[26.949136,59.445803],[27.981114,59.475388],[28.131699,59.300825],[27.420166,58.724581],[27.716686,57.791899],[27.288185,57.474528],[26.463532,57.476389],[25.60281,57.847529],[25.164594,57.970157],[24.312863,57.793424]]]}},\n{\"type\":\"Feature\",\"id\":\"ETH\",\"properties\":{\"name\":\"Ethiopia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[37.90607,14.95943],[38.51295,14.50547],[39.0994,14.74064],[39.34061,14.53155],[40.02625,14.51959],[40.8966,14.11864],[41.1552,13.77333],[41.59856,13.45209],[42.00975,12.86582],[42.35156,12.54223],[42,12.1],[41.66176,11.6312],[41.73959,11.35511],[41.75557,11.05091],[42.31414,11.0342],[42.55493,11.10511],[42.776852,10.926879],[42.55876,10.57258],[42.92812,10.02194],[43.29699,9.54048],[43.67875,9.18358],[46.94834,7.99688],[47.78942,8.003],[44.9636,5.00162],[43.66087,4.95755],[42.76967,4.25259],[42.12861,4.23413],[41.855083,3.918912],[41.1718,3.91909],[40.76848,4.25702],[39.85494,3.83879],[39.559384,3.42206],[38.89251,3.50074],[38.67114,3.61607],[38.43697,3.58851],[38.120915,3.598605],[36.855093,4.447864],[36.159079,4.447864],[35.817448,4.776966],[35.817448,5.338232],[35.298007,5.506],[34.70702,6.59422],[34.25032,6.82607],[34.0751,7.22595],[33.56829,7.71334],[32.95418,7.78497],[33.2948,8.35458],[33.8255,8.37916],[33.97498,8.68456],[33.96162,9.58358],[34.25745,10.63009],[34.73115,10.91017],[34.83163,11.31896],[35.26049,12.08286],[35.86363,12.57828],[36.27022,13.56333],[36.42951,14.42211],[37.59377,14.2131],[37.90607,14.95943]]]}},\n{\"type\":\"Feature\",\"id\":\"FIN\",\"properties\":{\"name\":\"Finland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[28.59193,69.064777],[28.445944,68.364613],[29.977426,67.698297],[29.054589,66.944286],[30.21765,65.80598],[29.54443,64.948672],[30.444685,64.204453],[30.035872,63.552814],[31.516092,62.867687],[31.139991,62.357693],[30.211107,61.780028],[28.069998,60.503517],[26.255173,60.423961],[24.496624,60.057316],[22.869695,59.846373],[22.290764,60.391921],[21.322244,60.72017],[21.544866,61.705329],[21.059211,62.607393],[21.536029,63.189735],[22.442744,63.81781],[24.730512,64.902344],[25.398068,65.111427],[25.294043,65.534346],[23.903379,66.006927],[23.56588,66.396051],[23.539473,67.936009],[21.978535,68.616846],[20.645593,69.106247],[21.244936,69.370443],[22.356238,68.841741],[23.66205,68.891247],[24.735679,68.649557],[25.689213,69.092114],[26.179622,69.825299],[27.732292,70.164193],[29.015573,69.766491],[28.59193,69.064777]]]}},\n{\"type\":\"Feature\",\"id\":\"FJI\",\"properties\":{\"name\":\"Fiji\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[178.3736,-17.33992],[178.71806,-17.62846],[178.55271,-18.15059],[177.93266,-18.28799],[177.38146,-18.16432],[177.28504,-17.72465],[177.67087,-17.38114],[178.12557,-17.50481],[178.3736,-17.33992]]],[[[179.364143,-16.801354],[178.725059,-17.012042],[178.596839,-16.63915],[179.096609,-16.433984],[179.413509,-16.379054],[180,-16.067133],[180,-16.555217],[179.364143,-16.801354]]],[[[-179.917369,-16.501783],[-180,-16.555217],[-180,-16.067133],[-179.79332,-16.020882],[-179.917369,-16.501783]]]]}},\n{\"type\":\"Feature\",\"id\":\"FLK\",\"properties\":{\"name\":\"Falkland Islands\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-61.2,-51.85],[-60,-51.25],[-59.15,-51.5],[-58.55,-51.1],[-57.75,-51.55],[-58.05,-51.9],[-59.4,-52.2],[-59.85,-51.85],[-60.7,-52.3],[-61.2,-51.85]]]}},\n{\"type\":\"Feature\",\"id\":\"FRA\",\"properties\":{\"name\":\"France\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[9.560016,42.152492],[9.229752,41.380007],[8.775723,41.583612],[8.544213,42.256517],[8.746009,42.628122],[9.390001,43.009985],[9.560016,42.152492]]],[[[3.588184,50.378992],[4.286023,49.907497],[4.799222,49.985373],[5.674052,49.529484],[5.897759,49.442667],[6.18632,49.463803],[6.65823,49.201958],[8.099279,49.017784],[7.593676,48.333019],[7.466759,47.620582],[7.192202,47.449766],[6.736571,47.541801],[6.768714,47.287708],[6.037389,46.725779],[6.022609,46.27299],[6.5001,46.429673],[6.843593,45.991147],[6.802355,45.70858],[7.096652,45.333099],[6.749955,45.028518],[7.007562,44.254767],[7.549596,44.127901],[7.435185,43.693845],[6.529245,43.128892],[4.556963,43.399651],[3.100411,43.075201],[2.985999,42.473015],[1.826793,42.343385],[0.701591,42.795734],[0.338047,42.579546],[-1.502771,43.034014],[-1.901351,43.422802],[-1.384225,44.02261],[-1.193798,46.014918],[-2.225724,47.064363],[-2.963276,47.570327],[-4.491555,47.954954],[-4.59235,48.68416],[-3.295814,48.901692],[-1.616511,48.644421],[-1.933494,49.776342],[-0.989469,49.347376],[1.338761,50.127173],[1.639001,50.946606],[2.513573,51.148506],[2.658422,50.796848],[3.123252,50.780363],[3.588184,50.378992]]]]}},\n{\"type\":\"Feature\",\"id\":\"GAB\",\"properties\":{\"name\":\"Gabon\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[11.093773,-3.978827],[10.066135,-2.969483],[9.405245,-2.144313],[8.797996,-1.111301],[8.830087,-0.779074],[9.04842,-0.459351],[9.291351,0.268666],[9.492889,1.01012],[9.830284,1.067894],[11.285079,1.057662],[11.276449,2.261051],[11.751665,2.326758],[12.35938,2.192812],[12.951334,2.321616],[13.075822,2.267097],[13.003114,1.830896],[13.282631,1.314184],[14.026669,1.395677],[14.276266,1.19693],[13.843321,0.038758],[14.316418,-0.552627],[14.425456,-1.333407],[14.29921,-1.998276],[13.992407,-2.470805],[13.109619,-2.42874],[12.575284,-1.948511],[12.495703,-2.391688],[11.820964,-2.514161],[11.478039,-2.765619],[11.855122,-3.426871],[11.093773,-3.978827]]]}},\n{\"type\":\"Feature\",\"id\":\"GBR\",\"properties\":{\"name\":\"United Kingdom\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-5.661949,54.554603],[-6.197885,53.867565],[-6.95373,54.073702],[-7.572168,54.059956],[-7.366031,54.595841],[-7.572168,55.131622],[-6.733847,55.17286],[-5.661949,54.554603]]],[[[-3.005005,58.635],[-4.073828,57.553025],[-3.055002,57.690019],[-1.959281,57.6848],[-2.219988,56.870017],[-3.119003,55.973793],[-2.085009,55.909998],[-2.005676,55.804903],[-1.114991,54.624986],[-0.430485,54.464376],[0.184981,53.325014],[0.469977,52.929999],[1.681531,52.73952],[1.559988,52.099998],[1.050562,51.806761],[1.449865,51.289428],[0.550334,50.765739],[-0.787517,50.774989],[-2.489998,50.500019],[-2.956274,50.69688],[-3.617448,50.228356],[-4.542508,50.341837],[-5.245023,49.96],[-5.776567,50.159678],[-4.30999,51.210001],[-3.414851,51.426009],[-3.422719,51.426848],[-4.984367,51.593466],[-5.267296,51.9914],[-4.222347,52.301356],[-4.770013,52.840005],[-4.579999,53.495004],[-3.093831,53.404547],[-3.09208,53.404441],[-2.945009,53.985],[-3.614701,54.600937],[-3.630005,54.615013],[-4.844169,54.790971],[-5.082527,55.061601],[-4.719112,55.508473],[-5.047981,55.783986],[-5.586398,55.311146],[-5.644999,56.275015],[-6.149981,56.78501],[-5.786825,57.818848],[-5.009999,58.630013],[-4.211495,58.550845],[-3.005005,58.635]]]]}},\n{\"type\":\"Feature\",\"id\":\"GEO\",\"properties\":{\"name\":\"Georgia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[41.554084,41.535656],[41.703171,41.962943],[41.45347,42.645123],[40.875469,43.013628],[40.321394,43.128634],[39.955009,43.434998],[40.076965,43.553104],[40.922185,43.382159],[42.394395,43.220308],[43.756017,42.740828],[43.9312,42.554974],[44.537623,42.711993],[45.470279,42.502781],[45.77641,42.092444],[46.404951,41.860675],[46.145432,41.722802],[46.637908,41.181673],[46.501637,41.064445],[45.962601,41.123873],[45.217426,41.411452],[44.97248,41.248129],[43.582746,41.092143],[42.619549,41.583173],[41.554084,41.535656]]]}},\n{\"type\":\"Feature\",\"id\":\"GHA\",\"properties\":{\"name\":\"Ghana\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[1.060122,5.928837],[-0.507638,5.343473],[-1.063625,5.000548],[-1.964707,4.710462],[-2.856125,4.994476],[-2.810701,5.389051],[-3.24437,6.250472],[-2.983585,7.379705],[-2.56219,8.219628],[-2.827496,9.642461],[-2.963896,10.395335],[-2.940409,10.96269],[-1.203358,11.009819],[-0.761576,10.93693],[-0.438702,11.098341],[0.023803,11.018682],[-0.049785,10.706918],[0.36758,10.191213],[0.365901,9.465004],[0.461192,8.677223],[0.712029,8.312465],[0.490957,7.411744],[0.570384,6.914359],[0.836931,6.279979],[1.060122,5.928837]]]}},\n{\"type\":\"Feature\",\"id\":\"GIN\",\"properties\":{\"name\":\"Guinea\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-8.439298,7.686043],[-8.722124,7.711674],[-8.926065,7.309037],[-9.208786,7.313921],[-9.403348,7.526905],[-9.33728,7.928534],[-9.755342,8.541055],[-10.016567,8.428504],[-10.230094,8.406206],[-10.505477,8.348896],[-10.494315,8.715541],[-10.65477,8.977178],[-10.622395,9.26791],[-10.839152,9.688246],[-11.117481,10.045873],[-11.917277,10.046984],[-12.150338,9.858572],[-12.425929,9.835834],[-12.596719,9.620188],[-12.711958,9.342712],[-13.24655,8.903049],[-13.685154,9.494744],[-14.074045,9.886167],[-14.330076,10.01572],[-14.579699,10.214467],[-14.693232,10.656301],[-14.839554,10.876572],[-15.130311,11.040412],[-14.685687,11.527824],[-14.382192,11.509272],[-14.121406,11.677117],[-13.9008,11.678719],[-13.743161,11.811269],[-13.828272,12.142644],[-13.718744,12.247186],[-13.700476,12.586183],[-13.217818,12.575874],[-12.499051,12.33209],[-12.278599,12.35444],[-12.203565,12.465648],[-11.658301,12.386583],[-11.513943,12.442988],[-11.456169,12.076834],[-11.297574,12.077971],[-11.036556,12.211245],[-10.87083,12.177887],[-10.593224,11.923975],[-10.165214,11.844084],[-9.890993,12.060479],[-9.567912,12.194243],[-9.327616,12.334286],[-9.127474,12.30806],[-8.905265,12.088358],[-8.786099,11.812561],[-8.376305,11.393646],[-8.581305,11.136246],[-8.620321,10.810891],[-8.407311,10.909257],[-8.282357,10.792597],[-8.335377,10.494812],[-8.029944,10.206535],[-8.229337,10.12902],[-8.309616,9.789532],[-8.079114,9.376224],[-7.8321,8.575704],[-8.203499,8.455453],[-8.299049,8.316444],[-8.221792,8.123329],[-8.280703,7.68718],[-8.439298,7.686043]]]}},\n{\"type\":\"Feature\",\"id\":\"GMB\",\"properties\":{\"name\":\"Gambia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-16.841525,13.151394],[-16.713729,13.594959],[-15.624596,13.623587],[-15.39877,13.860369],[-15.081735,13.876492],[-14.687031,13.630357],[-14.376714,13.62568],[-14.046992,13.794068],[-13.844963,13.505042],[-14.277702,13.280585],[-14.712197,13.298207],[-15.141163,13.509512],[-15.511813,13.27857],[-15.691001,13.270353],[-15.931296,13.130284],[-16.841525,13.151394]]]}},\n{\"type\":\"Feature\",\"id\":\"GNB\",\"properties\":{\"name\":\"Guinea Bissau\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-15.130311,11.040412],[-15.66418,11.458474],[-16.085214,11.524594],[-16.314787,11.806515],[-16.308947,11.958702],[-16.613838,12.170911],[-16.677452,12.384852],[-16.147717,12.547762],[-15.816574,12.515567],[-15.548477,12.62817],[-13.700476,12.586183],[-13.718744,12.247186],[-13.828272,12.142644],[-13.743161,11.811269],[-13.9008,11.678719],[-14.121406,11.677117],[-14.382192,11.509272],[-14.685687,11.527824],[-15.130311,11.040412]]]}},\n{\"type\":\"Feature\",\"id\":\"GNQ\",\"properties\":{\"name\":\"Equatorial Guinea\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[9.492889,1.01012],[9.305613,1.160911],[9.649158,2.283866],[11.276449,2.261051],[11.285079,1.057662],[9.830284,1.067894],[9.492889,1.01012]]]}},\n{\"type\":\"Feature\",\"id\":\"GRC\",\"properties\":{\"name\":\"Greece\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[23.69998,35.705004],[24.246665,35.368022],[25.025015,35.424996],[25.769208,35.354018],[25.745023,35.179998],[26.290003,35.29999],[26.164998,35.004995],[24.724982,34.919988],[24.735007,35.084991],[23.514978,35.279992],[23.69998,35.705004]]],[[[26.604196,41.562115],[26.294602,40.936261],[26.056942,40.824123],[25.447677,40.852545],[24.925848,40.947062],[23.714811,40.687129],[24.407999,40.124993],[23.899968,39.962006],[23.342999,39.960998],[22.813988,40.476005],[22.626299,40.256561],[22.849748,39.659311],[23.350027,39.190011],[22.973099,38.970903],[23.530016,38.510001],[24.025025,38.219993],[24.040011,37.655015],[23.115003,37.920011],[23.409972,37.409991],[22.774972,37.30501],[23.154225,36.422506],[22.490028,36.41],[21.670026,36.844986],[21.295011,37.644989],[21.120034,38.310323],[20.730032,38.769985],[20.217712,39.340235],[20.150016,39.624998],[20.615,40.110007],[20.674997,40.435],[20.99999,40.580004],[21.02004,40.842727],[21.674161,40.931275],[22.055378,41.149866],[22.597308,41.130487],[22.76177,41.3048],[22.952377,41.337994],[23.692074,41.309081],[24.492645,41.583896],[25.197201,41.234486],[26.106138,41.328899],[26.117042,41.826905],[26.604196,41.562115]]]]}},\n{\"type\":\"Feature\",\"id\":\"GRL\",\"properties\":{\"name\":\"Greenland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-46.76379,82.62796],[-43.40644,83.22516],[-39.89753,83.18018],[-38.62214,83.54905],[-35.08787,83.64513],[-27.10046,83.51966],[-20.84539,82.72669],[-22.69182,82.34165],[-26.51753,82.29765],[-31.9,82.2],[-31.39646,82.02154],[-27.85666,82.13178],[-24.84448,81.78697],[-22.90328,82.09317],[-22.07175,81.73449],[-23.16961,81.15271],[-20.62363,81.52462],[-15.76818,81.91245],[-12.77018,81.71885],[-12.20855,81.29154],[-16.28533,80.58004],[-16.85,80.35],[-20.04624,80.17708],[-17.73035,80.12912],[-18.9,79.4],[-19.70499,78.75128],[-19.67353,77.63859],[-18.47285,76.98565],[-20.03503,76.94434],[-21.67944,76.62795],[-19.83407,76.09808],[-19.59896,75.24838],[-20.66818,75.15585],[-19.37281,74.29561],[-21.59422,74.22382],[-20.43454,73.81713],[-20.76234,73.46436],[-22.17221,73.30955],[-23.56593,73.30663],[-22.31311,72.62928],[-22.29954,72.18409],[-24.27834,72.59788],[-24.79296,72.3302],[-23.44296,72.08016],[-22.13281,71.46898],[-21.75356,70.66369],[-23.53603,70.471],[-24.30702,70.85649],[-25.54341,71.43094],[-25.20135,70.75226],[-26.36276,70.22646],[-23.72742,70.18401],[-22.34902,70.12946],[-25.02927,69.2588],[-27.74737,68.47046],[-30.67371,68.12503],[-31.77665,68.12078],[-32.81105,67.73547],[-34.20196,66.67974],[-36.35284,65.9789],[-37.04378,65.93768],[-38.37505,65.69213],[-39.81222,65.45848],[-40.66899,64.83997],[-40.68281,64.13902],[-41.1887,63.48246],[-42.81938,62.68233],[-42.41666,61.90093],[-42.86619,61.07404],[-43.3784,60.09772],[-44.7875,60.03676],[-46.26364,60.85328],[-48.26294,60.85843],[-49.23308,61.40681],[-49.90039,62.38336],[-51.63325,63.62691],[-52.14014,64.27842],[-52.27659,65.1767],[-53.66166,66.09957],[-53.30161,66.8365],[-53.96911,67.18899],[-52.9804,68.35759],[-51.47536,68.72958],[-51.08041,69.14781],[-50.87122,69.9291],[-52.013585,69.574925],[-52.55792,69.42616],[-53.45629,69.283625],[-54.68336,69.61003],[-54.75001,70.28932],[-54.35884,70.821315],[-53.431315,70.835755],[-51.39014,70.56978],[-53.10937,71.20485],[-54.00422,71.54719],[-55,71.406537],[-55.83468,71.65444],[-54.71819,72.58625],[-55.32634,72.95861],[-56.12003,73.64977],[-57.32363,74.71026],[-58.59679,75.09861],[-58.58516,75.51727],[-61.26861,76.10238],[-63.39165,76.1752],[-66.06427,76.13486],[-68.50438,76.06141],[-69.66485,76.37975],[-71.40257,77.00857],[-68.77671,77.32312],[-66.76397,77.37595],[-71.04293,77.63595],[-73.297,78.04419],[-73.15938,78.43271],[-69.37345,78.91388],[-65.7107,79.39436],[-65.3239,79.75814],[-68.02298,80.11721],[-67.15129,80.51582],[-63.68925,81.21396],[-62.23444,81.3211],[-62.65116,81.77042],[-60.28249,82.03363],[-57.20744,82.19074],[-54.13442,82.19962],[-53.04328,81.88833],[-50.39061,82.43883],[-48.00386,82.06481],[-46.59984,81.985945],[-44.523,81.6607],[-46.9007,82.19979],[-46.76379,82.62796]]]}},\n{\"type\":\"Feature\",\"id\":\"GTM\",\"properties\":{\"name\":\"Guatemala\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-90.095555,13.735338],[-90.608624,13.909771],[-91.23241,13.927832],[-91.689747,14.126218],[-92.22775,14.538829],[-92.20323,14.830103],[-92.087216,15.064585],[-92.229249,15.251447],[-91.74796,16.066565],[-90.464473,16.069562],[-90.438867,16.41011],[-90.600847,16.470778],[-90.711822,16.687483],[-91.08167,16.918477],[-91.453921,17.252177],[-91.002269,17.254658],[-91.00152,17.817595],[-90.067934,17.819326],[-89.14308,17.808319],[-89.150806,17.015577],[-89.229122,15.886938],[-88.930613,15.887273],[-88.604586,15.70638],[-88.518364,15.855389],[-88.225023,15.727722],[-88.68068,15.346247],[-89.154811,15.066419],[-89.22522,14.874286],[-89.145535,14.678019],[-89.353326,14.424133],[-89.587343,14.362586],[-89.534219,14.244816],[-89.721934,14.134228],[-90.064678,13.88197],[-90.095555,13.735338]]]}},\n{\"type\":\"Feature\",\"id\":\"GUF\",\"properties\":{\"name\":\"French Guiana\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-52.556425,2.504705],[-52.939657,2.124858],[-53.418465,2.053389],[-53.554839,2.334897],[-53.778521,2.376703],[-54.088063,2.105557],[-54.524754,2.311849],[-54.27123,2.738748],[-54.184284,3.194172],[-54.011504,3.62257],[-54.399542,4.212611],[-54.478633,4.896756],[-53.958045,5.756548],[-53.618453,5.646529],[-52.882141,5.409851],[-51.823343,4.565768],[-51.657797,4.156232],[-52.249338,3.241094],[-52.556425,2.504705]]]}},\n{\"type\":\"Feature\",\"id\":\"GUY\",\"properties\":{\"name\":\"Guyana\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-59.758285,8.367035],[-59.101684,7.999202],[-58.482962,7.347691],[-58.454876,6.832787],[-58.078103,6.809094],[-57.542219,6.321268],[-57.147436,5.97315],[-57.307246,5.073567],[-57.914289,4.812626],[-57.86021,4.576801],[-58.044694,4.060864],[-57.601569,3.334655],[-57.281433,3.333492],[-57.150098,2.768927],[-56.539386,1.899523],[-56.782704,1.863711],[-57.335823,1.948538],[-57.660971,1.682585],[-58.11345,1.507195],[-58.429477,1.463942],[-58.540013,1.268088],[-59.030862,1.317698],[-59.646044,1.786894],[-59.718546,2.24963],[-59.974525,2.755233],[-59.815413,3.606499],[-59.53804,3.958803],[-59.767406,4.423503],[-60.111002,4.574967],[-59.980959,5.014061],[-60.213683,5.244486],[-60.733574,5.200277],[-61.410303,5.959068],[-61.139415,6.234297],[-61.159336,6.696077],[-60.543999,6.856584],[-60.295668,7.043911],[-60.637973,7.415],[-60.550588,7.779603],[-59.758285,8.367035]]]}},\n{\"type\":\"Feature\",\"id\":\"HND\",\"properties\":{\"name\":\"Honduras\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-87.316654,12.984686],[-87.489409,13.297535],[-87.793111,13.38448],[-87.723503,13.78505],[-87.859515,13.893312],[-88.065343,13.964626],[-88.503998,13.845486],[-88.541231,13.980155],[-88.843073,14.140507],[-89.058512,14.340029],[-89.353326,14.424133],[-89.145535,14.678019],[-89.22522,14.874286],[-89.154811,15.066419],[-88.68068,15.346247],[-88.225023,15.727722],[-88.121153,15.688655],[-87.901813,15.864458],[-87.61568,15.878799],[-87.522921,15.797279],[-87.367762,15.84694],[-86.903191,15.756713],[-86.440946,15.782835],[-86.119234,15.893449],[-86.001954,16.005406],[-85.683317,15.953652],[-85.444004,15.885749],[-85.182444,15.909158],[-84.983722,15.995923],[-84.52698,15.857224],[-84.368256,15.835158],[-84.063055,15.648244],[-83.773977,15.424072],[-83.410381,15.270903],[-83.147219,14.995829],[-83.489989,15.016267],[-83.628585,14.880074],[-83.975721,14.749436],[-84.228342,14.748764],[-84.449336,14.621614],[-84.649582,14.666805],[-84.820037,14.819587],[-84.924501,14.790493],[-85.052787,14.551541],[-85.148751,14.560197],[-85.165365,14.35437],[-85.514413,14.079012],[-85.698665,13.960078],[-85.801295,13.836055],[-86.096264,14.038187],[-86.312142,13.771356],[-86.520708,13.778487],[-86.755087,13.754845],[-86.733822,13.263093],[-86.880557,13.254204],[-87.005769,13.025794],[-87.316654,12.984686]]]}},\n{\"type\":\"Feature\",\"id\":\"HRV\",\"properties\":{\"name\":\"Croatia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[18.829838,45.908878],[19.072769,45.521511],[19.390476,45.236516],[19.005486,44.860234],[18.553214,45.08159],[17.861783,45.06774],[17.002146,45.233777],[16.534939,45.211608],[16.318157,45.004127],[15.959367,45.233777],[15.750026,44.818712],[16.23966,44.351143],[16.456443,44.04124],[16.916156,43.667722],[17.297373,43.446341],[17.674922,43.028563],[18.56,42.65],[18.450016,42.479991],[17.50997,42.849995],[16.930006,43.209998],[16.015385,43.507215],[15.174454,44.243191],[15.37625,44.317915],[14.920309,44.738484],[14.901602,45.07606],[14.258748,45.233777],[13.952255,44.802124],[13.656976,45.136935],[13.679403,45.484149],[13.71506,45.500324],[14.411968,45.466166],[14.595109,45.634941],[14.935244,45.471695],[15.327675,45.452316],[15.323954,45.731783],[15.67153,45.834154],[15.768733,46.238108],[16.564808,46.503751],[16.882515,46.380632],[17.630066,45.951769],[18.456062,45.759481],[18.829838,45.908878]]]}},\n{\"type\":\"Feature\",\"id\":\"HTI\",\"properties\":{\"name\":\"Haiti\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-73.189791,19.915684],[-72.579673,19.871501],[-71.712361,19.714456],[-71.624873,19.169838],[-71.701303,18.785417],[-71.945112,18.6169],[-71.687738,18.31666],[-71.708305,18.044997],[-72.372476,18.214961],[-72.844411,18.145611],[-73.454555,18.217906],[-73.922433,18.030993],[-74.458034,18.34255],[-74.369925,18.664908],[-73.449542,18.526053],[-72.694937,18.445799],[-72.334882,18.668422],[-72.79165,19.101625],[-72.784105,19.483591],[-73.415022,19.639551],[-73.189791,19.915684]]]}},\n{\"type\":\"Feature\",\"id\":\"HUN\",\"properties\":{\"name\":\"Hungary\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[16.202298,46.852386],[16.534268,47.496171],[16.340584,47.712902],[16.903754,47.714866],[16.979667,48.123497],[17.488473,47.867466],[17.857133,47.758429],[18.696513,47.880954],[18.777025,48.081768],[19.174365,48.111379],[19.661364,48.266615],[19.769471,48.202691],[20.239054,48.327567],[20.473562,48.56285],[20.801294,48.623854],[21.872236,48.319971],[22.085608,48.422264],[22.64082,48.15024],[22.710531,47.882194],[22.099768,47.672439],[21.626515,46.994238],[21.021952,46.316088],[20.220192,46.127469],[19.596045,46.17173],[18.829838,45.908878],[18.456062,45.759481],[17.630066,45.951769],[16.882515,46.380632],[16.564808,46.503751],[16.370505,46.841327],[16.202298,46.852386]]]}},\n{\"type\":\"Feature\",\"id\":\"IDN\",\"properties\":{\"name\":\"Indonesia\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[120.715609,-10.239581],[120.295014,-10.25865],[118.967808,-9.557969],[119.90031,-9.36134],[120.425756,-9.665921],[120.775502,-9.969675],[120.715609,-10.239581]]],[[[124.43595,-10.140001],[123.579982,-10.359987],[123.459989,-10.239995],[123.550009,-9.900016],[123.980009,-9.290027],[124.968682,-8.89279],[125.07002,-9.089987],[125.08852,-9.393173],[124.43595,-10.140001]]],[[[117.900018,-8.095681],[118.260616,-8.362383],[118.87846,-8.280683],[119.126507,-8.705825],[117.970402,-8.906639],[117.277731,-9.040895],[116.740141,-9.032937],[117.083737,-8.457158],[117.632024,-8.449303],[117.900018,-8.095681]]],[[[122.903537,-8.094234],[122.756983,-8.649808],[121.254491,-8.933666],[119.924391,-8.810418],[119.920929,-8.444859],[120.715092,-8.236965],[121.341669,-8.53674],[122.007365,-8.46062],[122.903537,-8.094234]]],[[[108.623479,-6.777674],[110.539227,-6.877358],[110.759576,-6.465186],[112.614811,-6.946036],[112.978768,-7.594213],[114.478935,-7.776528],[115.705527,-8.370807],[114.564511,-8.751817],[113.464734,-8.348947],[112.559672,-8.376181],[111.522061,-8.302129],[110.58615,-8.122605],[109.427667,-7.740664],[108.693655,-7.6416],[108.277763,-7.766657],[106.454102,-7.3549],[106.280624,-6.9249],[105.365486,-6.851416],[106.051646,-5.895919],[107.265009,-5.954985],[108.072091,-6.345762],[108.486846,-6.421985],[108.623479,-6.777674]]],[[[134.724624,-6.214401],[134.210134,-6.895238],[134.112776,-6.142467],[134.290336,-5.783058],[134.499625,-5.445042],[134.727002,-5.737582],[134.724624,-6.214401]]],[[[127.249215,-3.459065],[126.874923,-3.790983],[126.183802,-3.607376],[125.989034,-3.177273],[127.000651,-3.129318],[127.249215,-3.459065]]],[[[130.471344,-3.093764],[130.834836,-3.858472],[129.990547,-3.446301],[129.155249,-3.362637],[128.590684,-3.428679],[127.898891,-3.393436],[128.135879,-2.84365],[129.370998,-2.802154],[130.471344,-3.093764]]],[[[134.143368,-1.151867],[134.422627,-2.769185],[135.457603,-3.367753],[136.293314,-2.307042],[137.440738,-1.703513],[138.329727,-1.702686],[139.184921,-2.051296],[139.926684,-2.409052],[141.00021,-2.600151],[141.017057,-5.859022],[141.033852,-9.117893],[140.143415,-8.297168],[139.127767,-8.096043],[138.881477,-8.380935],[137.614474,-8.411683],[138.039099,-7.597882],[138.668621,-7.320225],[138.407914,-6.232849],[137.92784,-5.393366],[135.98925,-4.546544],[135.164598,-4.462931],[133.66288,-3.538853],[133.367705,-4.024819],[132.983956,-4.112979],[132.756941,-3.746283],[132.753789,-3.311787],[131.989804,-2.820551],[133.066845,-2.460418],[133.780031,-2.479848],[133.696212,-2.214542],[132.232373,-2.212526],[131.836222,-1.617162],[130.94284,-1.432522],[130.519558,-0.93772],[131.867538,-0.695461],[132.380116,-0.369538],[133.985548,-0.78021],[134.143368,-1.151867]]],[[[125.240501,1.419836],[124.437035,0.427881],[123.685505,0.235593],[122.723083,0.431137],[121.056725,0.381217],[120.183083,0.237247],[120.04087,-0.519658],[120.935905,-1.408906],[121.475821,-0.955962],[123.340565,-0.615673],[123.258399,-1.076213],[122.822715,-0.930951],[122.38853,-1.516858],[121.508274,-1.904483],[122.454572,-3.186058],[122.271896,-3.5295],[123.170963,-4.683693],[123.162333,-5.340604],[122.628515,-5.634591],[122.236394,-5.282933],[122.719569,-4.464172],[121.738234,-4.851331],[121.489463,-4.574553],[121.619171,-4.188478],[120.898182,-3.602105],[120.972389,-2.627643],[120.305453,-2.931604],[120.390047,-4.097579],[120.430717,-5.528241],[119.796543,-5.6734],[119.366906,-5.379878],[119.653606,-4.459417],[119.498835,-3.494412],[119.078344,-3.487022],[118.767769,-2.801999],[119.180974,-2.147104],[119.323394,-1.353147],[119.825999,0.154254],[120.035702,0.566477],[120.885779,1.309223],[121.666817,1.013944],[122.927567,0.875192],[124.077522,0.917102],[125.065989,1.643259],[125.240501,1.419836]]],[[[128.688249,1.132386],[128.635952,0.258486],[128.12017,0.356413],[127.968034,-0.252077],[128.379999,-0.780004],[128.100016,-0.899996],[127.696475,-0.266598],[127.39949,1.011722],[127.600512,1.810691],[127.932378,2.174596],[128.004156,1.628531],[128.594559,1.540811],[128.688249,1.132386]]],[[[117.875627,1.827641],[118.996747,0.902219],[117.811858,0.784242],[117.478339,0.102475],[117.521644,-0.803723],[116.560048,-1.487661],[116.533797,-2.483517],[116.148084,-4.012726],[116.000858,-3.657037],[114.864803,-4.106984],[114.468652,-3.495704],[113.755672,-3.43917],[113.256994,-3.118776],[112.068126,-3.478392],[111.703291,-2.994442],[111.04824,-3.049426],[110.223846,-2.934032],[110.070936,-1.592874],[109.571948,-1.314907],[109.091874,-0.459507],[108.952658,0.415375],[109.069136,1.341934],[109.66326,2.006467],[109.830227,1.338136],[110.514061,0.773131],[111.159138,0.976478],[111.797548,0.904441],[112.380252,1.410121],[112.859809,1.49779],[113.80585,1.217549],[114.621355,1.430688],[115.134037,2.821482],[115.519078,3.169238],[115.865517,4.306559],[117.015214,4.306094],[117.882035,4.137551],[117.313232,3.234428],[118.04833,2.28769],[117.875627,1.827641]]],[[[105.817655,-5.852356],[104.710384,-5.873285],[103.868213,-5.037315],[102.584261,-4.220259],[102.156173,-3.614146],[101.399113,-2.799777],[100.902503,-2.050262],[100.141981,-0.650348],[99.26374,0.183142],[98.970011,1.042882],[98.601351,1.823507],[97.699598,2.453184],[97.176942,3.308791],[96.424017,3.86886],[95.380876,4.970782],[95.293026,5.479821],[95.936863,5.439513],[97.484882,5.246321],[98.369169,4.26837],[99.142559,3.59035],[99.693998,3.174329],[100.641434,2.099381],[101.658012,2.083697],[102.498271,1.3987],[103.07684,0.561361],[103.838396,0.104542],[103.437645,-0.711946],[104.010789,-1.059212],[104.369991,-1.084843],[104.53949,-1.782372],[104.887893,-2.340425],[105.622111,-2.428844],[106.108593,-3.061777],[105.857446,-4.305525],[105.817655,-5.852356]]]]}},\n{\"type\":\"Feature\",\"id\":\"IND\",\"properties\":{\"name\":\"India\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[77.837451,35.49401],[78.912269,34.321936],[78.811086,33.506198],[79.208892,32.994395],[79.176129,32.48378],[78.458446,32.618164],[78.738894,31.515906],[79.721367,30.882715],[81.111256,30.183481],[80.476721,29.729865],[80.088425,28.79447],[81.057203,28.416095],[81.999987,27.925479],[83.304249,27.364506],[84.675018,27.234901],[85.251779,26.726198],[86.024393,26.630985],[87.227472,26.397898],[88.060238,26.414615],[88.174804,26.810405],[88.043133,27.445819],[88.120441,27.876542],[88.730326,28.086865],[88.814248,27.299316],[88.835643,27.098966],[89.744528,26.719403],[90.373275,26.875724],[91.217513,26.808648],[92.033484,26.83831],[92.103712,27.452614],[91.696657,27.771742],[92.503119,27.896876],[93.413348,28.640629],[94.56599,29.277438],[95.404802,29.031717],[96.117679,29.452802],[96.586591,28.83098],[96.248833,28.411031],[97.327114,28.261583],[97.402561,27.882536],[97.051989,27.699059],[97.133999,27.083774],[96.419366,27.264589],[95.124768,26.573572],[95.155153,26.001307],[94.603249,25.162495],[94.552658,24.675238],[94.106742,23.850741],[93.325188,24.078556],[93.286327,23.043658],[93.060294,22.703111],[93.166128,22.27846],[92.672721,22.041239],[92.146035,23.627499],[91.869928,23.624346],[91.706475,22.985264],[91.158963,23.503527],[91.46773,24.072639],[91.915093,24.130414],[92.376202,24.976693],[91.799596,25.147432],[90.872211,25.132601],[89.920693,25.26975],[89.832481,25.965082],[89.355094,26.014407],[88.563049,26.446526],[88.209789,25.768066],[88.931554,25.238692],[88.306373,24.866079],[88.084422,24.501657],[88.69994,24.233715],[88.52977,23.631142],[88.876312,22.879146],[89.031961,22.055708],[88.888766,21.690588],[88.208497,21.703172],[86.975704,21.495562],[87.033169,20.743308],[86.499351,20.151638],[85.060266,19.478579],[83.941006,18.30201],[83.189217,17.671221],[82.192792,17.016636],[82.191242,16.556664],[81.692719,16.310219],[80.791999,15.951972],[80.324896,15.899185],[80.025069,15.136415],[80.233274,13.835771],[80.286294,13.006261],[79.862547,12.056215],[79.857999,10.357275],[79.340512,10.308854],[78.885345,9.546136],[79.18972,9.216544],[78.277941,8.933047],[77.941165,8.252959],[77.539898,7.965535],[76.592979,8.899276],[76.130061,10.29963],[75.746467,11.308251],[75.396101,11.781245],[74.864816,12.741936],[74.616717,13.992583],[74.443859,14.617222],[73.534199,15.990652],[73.119909,17.92857],[72.820909,19.208234],[72.824475,20.419503],[72.630533,21.356009],[71.175273,20.757441],[70.470459,20.877331],[69.16413,22.089298],[69.644928,22.450775],[69.349597,22.84318],[68.176645,23.691965],[68.842599,24.359134],[71.04324,24.356524],[70.844699,25.215102],[70.282873,25.722229],[70.168927,26.491872],[69.514393,26.940966],[70.616496,27.989196],[71.777666,27.91318],[72.823752,28.961592],[73.450638,29.976413],[74.42138,30.979815],[74.405929,31.692639],[75.258642,32.271105],[74.451559,32.7649],[74.104294,33.441473],[73.749948,34.317699],[74.240203,34.748887],[75.757061,34.504923],[76.871722,34.653544],[77.837451,35.49401]]]}},\n{\"type\":\"Feature\",\"id\":\"IRL\",\"properties\":{\"name\":\"Ireland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-6.197885,53.867565],[-6.032985,53.153164],[-6.788857,52.260118],[-8.561617,51.669301],[-9.977086,51.820455],[-9.166283,52.864629],[-9.688525,53.881363],[-8.327987,54.664519],[-7.572168,55.131622],[-7.366031,54.595841],[-7.572168,54.059956],[-6.95373,54.073702],[-6.197885,53.867565]]]}},\n{\"type\":\"Feature\",\"id\":\"IRN\",\"properties\":{\"name\":\"Iran\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[53.921598,37.198918],[54.800304,37.392421],[55.511578,37.964117],[56.180375,37.935127],[56.619366,38.121394],[57.330434,38.029229],[58.436154,37.522309],[59.234762,37.412988],[60.377638,36.527383],[61.123071,36.491597],[61.210817,35.650072],[60.803193,34.404102],[60.52843,33.676446],[60.9637,33.528832],[60.536078,32.981269],[60.863655,32.18292],[60.941945,31.548075],[61.699314,31.379506],[61.781222,30.73585],[60.874248,29.829239],[61.369309,29.303276],[61.771868,28.699334],[62.72783,28.259645],[62.755426,27.378923],[63.233898,27.217047],[63.316632,26.756532],[61.874187,26.239975],[61.497363,25.078237],[59.616134,25.380157],[58.525761,25.609962],[57.397251,25.739902],[56.970766,26.966106],[56.492139,27.143305],[55.72371,26.964633],[54.71509,26.480658],[53.493097,26.812369],[52.483598,27.580849],[51.520763,27.86569],[50.852948,28.814521],[50.115009,30.147773],[49.57685,29.985715],[48.941333,30.31709],[48.567971,29.926778],[48.014568,30.452457],[48.004698,30.985137],[47.685286,30.984853],[47.849204,31.709176],[47.334661,32.469155],[46.109362,33.017287],[45.416691,33.967798],[45.64846,34.748138],[46.151788,35.093259],[46.07634,35.677383],[45.420618,35.977546],[44.77267,37.17045],[44.225756,37.971584],[44.421403,38.281281],[44.109225,39.428136],[44.79399,39.713003],[44.952688,39.335765],[45.457722,38.874139],[46.143623,38.741201],[46.50572,38.770605],[47.685079,39.508364],[48.060095,39.582235],[48.355529,39.288765],[48.010744,38.794015],[48.634375,38.270378],[48.883249,38.320245],[49.199612,37.582874],[50.147771,37.374567],[50.842354,36.872814],[52.264025,36.700422],[53.82579,36.965031],[53.921598,37.198918]]]}},\n{\"type\":\"Feature\",\"id\":\"IRQ\",\"properties\":{\"name\":\"Iraq\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[45.420618,35.977546],[46.07634,35.677383],[46.151788,35.093259],[45.64846,34.748138],[45.416691,33.967798],[46.109362,33.017287],[47.334661,32.469155],[47.849204,31.709176],[47.685286,30.984853],[48.004698,30.985137],[48.014568,30.452457],[48.567971,29.926778],[47.974519,29.975819],[47.302622,30.05907],[46.568713,29.099025],[44.709499,29.178891],[41.889981,31.190009],[40.399994,31.889992],[39.195468,32.161009],[38.792341,33.378686],[41.006159,34.419372],[41.383965,35.628317],[41.289707,36.358815],[41.837064,36.605854],[42.349591,37.229873],[42.779126,37.385264],[43.942259,37.256228],[44.293452,37.001514],[44.772699,37.170445],[45.420618,35.977546]]]}},\n{\"type\":\"Feature\",\"id\":\"ISL\",\"properties\":{\"name\":\"Iceland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-14.508695,66.455892],[-14.739637,65.808748],[-13.609732,65.126671],[-14.909834,64.364082],[-17.794438,63.678749],[-18.656246,63.496383],[-19.972755,63.643635],[-22.762972,63.960179],[-21.778484,64.402116],[-23.955044,64.89113],[-22.184403,65.084968],[-22.227423,65.378594],[-24.326184,65.611189],[-23.650515,66.262519],[-22.134922,66.410469],[-20.576284,65.732112],[-19.056842,66.276601],[-17.798624,65.993853],[-16.167819,66.526792],[-14.508695,66.455892]]]}},\n{\"type\":\"Feature\",\"id\":\"ISR\",\"properties\":{\"name\":\"Israel\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[35.719918,32.709192],[35.545665,32.393992],[35.18393,32.532511],[34.974641,31.866582],[35.225892,31.754341],[34.970507,31.616778],[34.927408,31.353435],[35.397561,31.489086],[35.420918,31.100066],[34.922603,29.501326],[34.265433,31.219361],[34.556372,31.548824],[34.488107,31.605539],[34.752587,32.072926],[34.955417,32.827376],[35.098457,33.080539],[35.126053,33.0909],[35.460709,33.08904],[35.552797,33.264275],[35.821101,33.277426],[35.836397,32.868123],[35.700798,32.716014],[35.719918,32.709192]]]}},\n{\"type\":\"Feature\",\"id\":\"ITA\",\"properties\":{\"name\":\"Italy\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[15.520376,38.231155],[15.160243,37.444046],[15.309898,37.134219],[15.099988,36.619987],[14.335229,36.996631],[13.826733,37.104531],[12.431004,37.61295],[12.570944,38.126381],[13.741156,38.034966],[14.761249,38.143874],[15.520376,38.231155]]],[[[9.210012,41.209991],[9.809975,40.500009],[9.669519,39.177376],[9.214818,39.240473],[8.806936,38.906618],[8.428302,39.171847],[8.388253,40.378311],[8.159998,40.950007],[8.709991,40.899984],[9.210012,41.209991]]],[[[12.376485,46.767559],[13.806475,46.509306],[13.69811,46.016778],[13.93763,45.591016],[13.141606,45.736692],[12.328581,45.381778],[12.383875,44.885374],[12.261453,44.600482],[12.589237,44.091366],[13.526906,43.587727],[14.029821,42.761008],[15.14257,41.95514],[15.926191,41.961315],[16.169897,41.740295],[15.889346,41.541082],[16.785002,41.179606],[17.519169,40.877143],[18.376687,40.355625],[18.480247,40.168866],[18.293385,39.810774],[17.73838,40.277671],[16.869596,40.442235],[16.448743,39.795401],[17.17149,39.4247],[17.052841,38.902871],[16.635088,38.843572],[16.100961,37.985899],[15.684087,37.908849],[15.687963,38.214593],[15.891981,38.750942],[16.109332,38.964547],[15.718814,39.544072],[15.413613,40.048357],[14.998496,40.172949],[14.703268,40.60455],[14.060672,40.786348],[13.627985,41.188287],[12.888082,41.25309],[12.106683,41.704535],[11.191906,42.355425],[10.511948,42.931463],[10.200029,43.920007],[9.702488,44.036279],[8.888946,44.366336],[8.428561,44.231228],[7.850767,43.767148],[7.435185,43.693845],[7.549596,44.127901],[7.007562,44.254767],[6.749955,45.028518],[7.096652,45.333099],[6.802355,45.70858],[6.843593,45.991147],[7.273851,45.776948],[7.755992,45.82449],[8.31663,46.163642],[8.489952,46.005151],[8.966306,46.036932],[9.182882,46.440215],[9.922837,46.314899],[10.363378,46.483571],[10.442701,46.893546],[11.048556,46.751359],[11.164828,46.941579],[12.153088,47.115393],[12.376485,46.767559]]]]}},\n{\"type\":\"Feature\",\"id\":\"JAM\",\"properties\":{\"name\":\"Jamaica\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-77.569601,18.490525],[-76.896619,18.400867],[-76.365359,18.160701],[-76.199659,17.886867],[-76.902561,17.868238],[-77.206341,17.701116],[-77.766023,17.861597],[-78.337719,18.225968],[-78.217727,18.454533],[-77.797365,18.524218],[-77.569601,18.490525]]]}},\n{\"type\":\"Feature\",\"id\":\"JOR\",\"properties\":{\"name\":\"Jordan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[35.545665,32.393992],[35.719918,32.709192],[36.834062,32.312938],[38.792341,33.378686],[39.195468,32.161009],[39.004886,32.010217],[37.002166,31.508413],[37.998849,30.5085],[37.66812,30.338665],[37.503582,30.003776],[36.740528,29.865283],[36.501214,29.505254],[36.068941,29.197495],[34.956037,29.356555],[34.922603,29.501326],[35.420918,31.100066],[35.397561,31.489086],[35.545252,31.782505],[35.545665,32.393992]]]}},\n{\"type\":\"Feature\",\"id\":\"JPN\",\"properties\":{\"name\":\"Japan\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[134.638428,34.149234],[134.766379,33.806335],[134.203416,33.201178],[133.79295,33.521985],[133.280268,33.28957],[133.014858,32.704567],[132.363115,32.989382],[132.371176,33.463642],[132.924373,34.060299],[133.492968,33.944621],[133.904106,34.364931],[134.638428,34.149234]]],[[[140.976388,37.142074],[140.59977,36.343983],[140.774074,35.842877],[140.253279,35.138114],[138.975528,34.6676],[137.217599,34.606286],[135.792983,33.464805],[135.120983,33.849071],[135.079435,34.596545],[133.340316,34.375938],[132.156771,33.904933],[130.986145,33.885761],[132.000036,33.149992],[131.33279,31.450355],[130.686318,31.029579],[130.20242,31.418238],[130.447676,32.319475],[129.814692,32.61031],[129.408463,33.296056],[130.353935,33.604151],[130.878451,34.232743],[131.884229,34.749714],[132.617673,35.433393],[134.608301,35.731618],[135.677538,35.527134],[136.723831,37.304984],[137.390612,36.827391],[138.857602,37.827485],[139.426405,38.215962],[140.05479,39.438807],[139.883379,40.563312],[140.305783,41.195005],[141.368973,41.37856],[141.914263,39.991616],[141.884601,39.180865],[140.959489,38.174001],[140.976388,37.142074]]],[[[143.910162,44.1741],[144.613427,43.960883],[145.320825,44.384733],[145.543137,43.262088],[144.059662,42.988358],[143.18385,41.995215],[141.611491,42.678791],[141.067286,41.584594],[139.955106,41.569556],[139.817544,42.563759],[140.312087,43.333273],[141.380549,43.388825],[141.671952,44.772125],[141.967645,45.551483],[143.14287,44.510358],[143.910162,44.1741]]]]}},\n{\"type\":\"Feature\",\"id\":\"KAZ\",\"properties\":{\"name\":\"Kazakhstan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[70.962315,42.266154],[70.388965,42.081308],[69.070027,41.384244],[68.632483,40.668681],[68.259896,40.662325],[67.985856,41.135991],[66.714047,41.168444],[66.510649,41.987644],[66.023392,41.994646],[66.098012,42.99766],[64.900824,43.728081],[63.185787,43.650075],[62.0133,43.504477],[61.05832,44.405817],[60.239972,44.784037],[58.689989,45.500014],[58.503127,45.586804],[55.928917,44.995858],[55.968191,41.308642],[55.455251,41.259859],[54.755345,42.043971],[54.079418,42.324109],[52.944293,42.116034],[52.50246,41.783316],[52.446339,42.027151],[52.692112,42.443895],[52.501426,42.792298],[51.342427,43.132975],[50.891292,44.031034],[50.339129,44.284016],[50.305643,44.609836],[51.278503,44.514854],[51.316899,45.245998],[52.16739,45.408391],[53.040876,45.259047],[53.220866,46.234646],[53.042737,46.853006],[52.042023,46.804637],[51.191945,47.048705],[50.034083,46.60899],[49.10116,46.39933],[48.593241,46.561034],[48.694734,47.075628],[48.057253,47.743753],[47.315231,47.715847],[46.466446,48.394152],[47.043672,49.152039],[46.751596,49.356006],[47.54948,50.454698],[48.577841,49.87476],[48.702382,50.605128],[50.766648,51.692762],[52.328724,51.718652],[54.532878,51.02624],[55.716941,50.621717],[56.777961,51.043551],[58.363291,51.063653],[59.642282,50.545442],[59.932807,50.842194],[61.337424,50.79907],[61.588003,51.272659],[59.967534,51.96042],[60.927269,52.447548],[60.739993,52.719986],[61.699986,52.979996],[60.978066,53.664993],[61.436591,54.006265],[65.178534,54.354228],[65.666876,54.601267],[68.1691,54.970392],[69.068167,55.38525],[70.865267,55.169734],[71.180131,54.133285],[72.22415,54.376655],[73.508516,54.035617],[73.425679,53.48981],[74.384845,53.546861],[76.8911,54.490524],[76.525179,54.177003],[77.800916,53.404415],[80.03556,50.864751],[80.568447,51.388336],[81.945986,50.812196],[83.383004,51.069183],[83.935115,50.889246],[84.416377,50.3114],[85.11556,50.117303],[85.54127,49.692859],[86.829357,49.826675],[87.35997,49.214981],[86.598776,48.549182],[85.768233,48.455751],[85.720484,47.452969],[85.16429,47.000956],[83.180484,47.330031],[82.458926,45.53965],[81.947071,45.317027],[79.966106,44.917517],[80.866206,43.180362],[80.18015,42.920068],[80.25999,42.349999],[79.643645,42.496683],[79.142177,42.856092],[77.658392,42.960686],[76.000354,42.988022],[75.636965,42.8779],[74.212866,43.298339],[73.645304,43.091272],[73.489758,42.500894],[71.844638,42.845395],[71.186281,42.704293],[70.962315,42.266154]]]}},\n{\"type\":\"Feature\",\"id\":\"KEN\",\"properties\":{\"name\":\"Kenya\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[40.993,-0.85829],[41.58513,-1.68325],[40.88477,-2.08255],[40.63785,-2.49979],[40.26304,-2.57309],[40.12119,-3.27768],[39.80006,-3.68116],[39.60489,-4.34653],[39.20222,-4.67677],[37.7669,-3.67712],[37.69869,-3.09699],[34.07262,-1.05982],[33.903711,-0.95],[33.893569,0.109814],[34.18,0.515],[34.6721,1.17694],[35.03599,1.90584],[34.59607,3.05374],[34.47913,3.5556],[34.005,4.249885],[34.620196,4.847123],[35.298007,5.506],[35.817448,5.338232],[35.817448,4.776966],[36.159079,4.447864],[36.855093,4.447864],[38.120915,3.598605],[38.43697,3.58851],[38.67114,3.61607],[38.89251,3.50074],[39.559384,3.42206],[39.85494,3.83879],[40.76848,4.25702],[41.1718,3.91909],[41.855083,3.918912],[40.98105,2.78452],[40.993,-0.85829]]]}},\n{\"type\":\"Feature\",\"id\":\"KGZ\",\"properties\":{\"name\":\"Kyrgyzstan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[70.962315,42.266154],[71.186281,42.704293],[71.844638,42.845395],[73.489758,42.500894],[73.645304,43.091272],[74.212866,43.298339],[75.636965,42.8779],[76.000354,42.988022],[77.658392,42.960686],[79.142177,42.856092],[79.643645,42.496683],[80.25999,42.349999],[80.11943,42.123941],[78.543661,41.582243],[78.187197,41.185316],[76.904484,41.066486],[76.526368,40.427946],[75.467828,40.562072],[74.776862,40.366425],[73.822244,39.893973],[73.960013,39.660008],[73.675379,39.431237],[71.784694,39.279463],[70.549162,39.604198],[69.464887,39.526683],[69.55961,40.103211],[70.648019,39.935754],[71.014198,40.244366],[71.774875,40.145844],[73.055417,40.866033],[71.870115,41.3929],[71.157859,41.143587],[70.420022,41.519998],[71.259248,42.167711],[70.962315,42.266154]]]}},\n{\"type\":\"Feature\",\"id\":\"KHM\",\"properties\":{\"name\":\"Cambodia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[103.49728,10.632555],[103.09069,11.153661],[102.584932,12.186595],[102.348099,13.394247],[102.988422,14.225721],[104.281418,14.416743],[105.218777,14.273212],[106.043946,13.881091],[106.496373,14.570584],[107.382727,14.202441],[107.614548,13.535531],[107.491403,12.337206],[105.810524,11.567615],[106.24967,10.961812],[105.199915,10.88931],[104.334335,10.486544],[103.49728,10.632555]]]}},\n{\"type\":\"Feature\",\"id\":\"KOR\",\"properties\":{\"name\":\"South Korea\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[128.349716,38.612243],[129.21292,37.432392],[129.46045,36.784189],[129.468304,35.632141],[129.091377,35.082484],[128.18585,34.890377],[127.386519,34.475674],[126.485748,34.390046],[126.37392,34.93456],[126.559231,35.684541],[126.117398,36.725485],[126.860143,36.893924],[126.174759,37.749686],[126.237339,37.840378],[126.68372,37.804773],[127.073309,38.256115],[127.780035,38.304536],[128.205746,38.370397],[128.349716,38.612243]]]}},\n{\"type\":\"Feature\",\"id\":\"CS-KM\",\"properties\":{\"name\":\"Kosovo\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[20.76216,42.05186],[20.71731,41.84711],[20.59023,41.85541],[20.52295,42.21787],[20.28374,42.32025],[20.0707,42.58863],[20.25758,42.81275],[20.49679,42.88469],[20.63508,43.21671],[20.81448,43.27205],[20.95651,43.13094],[21.143395,43.068685],[21.27421,42.90959],[21.43866,42.86255],[21.63302,42.67717],[21.77505,42.6827],[21.66292,42.43922],[21.54332,42.32025],[21.576636,42.245224],[21.3527,42.2068],[20.76216,42.05186]]]}},\n{\"type\":\"Feature\",\"id\":\"KWT\",\"properties\":{\"name\":\"Kuwait\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[47.974519,29.975819],[48.183189,29.534477],[48.093943,29.306299],[48.416094,28.552004],[47.708851,28.526063],[47.459822,29.002519],[46.568713,29.099025],[47.302622,30.05907],[47.974519,29.975819]]]}},\n{\"type\":\"Feature\",\"id\":\"LAO\",\"properties\":{\"name\":\"Laos\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[105.218777,14.273212],[105.544338,14.723934],[105.589039,15.570316],[104.779321,16.441865],[104.716947,17.428859],[103.956477,18.240954],[103.200192,18.309632],[102.998706,17.961695],[102.413005,17.932782],[102.113592,18.109102],[101.059548,17.512497],[101.035931,18.408928],[101.282015,19.462585],[100.606294,19.508344],[100.548881,20.109238],[100.115988,20.41785],[100.329101,20.786122],[101.180005,21.436573],[101.270026,21.201652],[101.80312,21.174367],[101.652018,22.318199],[102.170436,22.464753],[102.754896,21.675137],[103.203861,20.766562],[104.435,20.758733],[104.822574,19.886642],[104.183388,19.624668],[103.896532,19.265181],[105.094598,18.666975],[105.925762,17.485315],[106.556008,16.604284],[107.312706,15.908538],[107.564525,15.202173],[107.382727,14.202441],[106.496373,14.570584],[106.043946,13.881091],[105.218777,14.273212]]]}},\n{\"type\":\"Feature\",\"id\":\"LBN\",\"properties\":{\"name\":\"Lebanon\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[35.821101,33.277426],[35.552797,33.264275],[35.460709,33.08904],[35.126053,33.0909],[35.482207,33.90545],[35.979592,34.610058],[35.998403,34.644914],[36.448194,34.593935],[36.61175,34.201789],[36.06646,33.824912],[35.821101,33.277426]]]}},\n{\"type\":\"Feature\",\"id\":\"LBR\",\"properties\":{\"name\":\"Liberia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-7.712159,4.364566],[-7.974107,4.355755],[-9.004794,4.832419],[-9.91342,5.593561],[-10.765384,6.140711],[-11.438779,6.785917],[-11.199802,7.105846],[-11.146704,7.396706],[-10.695595,7.939464],[-10.230094,8.406206],[-10.016567,8.428504],[-9.755342,8.541055],[-9.33728,7.928534],[-9.403348,7.526905],[-9.208786,7.313921],[-8.926065,7.309037],[-8.722124,7.711674],[-8.439298,7.686043],[-8.485446,7.395208],[-8.385452,6.911801],[-8.60288,6.467564],[-8.311348,6.193033],[-7.993693,6.12619],[-7.570153,5.707352],[-7.539715,5.313345],[-7.635368,5.188159],[-7.712159,4.364566]]]}},\n{\"type\":\"Feature\",\"id\":\"LBY\",\"properties\":{\"name\":\"Libya\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[14.8513,22.86295],[14.143871,22.491289],[13.581425,23.040506],[11.999506,23.471668],[11.560669,24.097909],[10.771364,24.562532],[10.303847,24.379313],[9.948261,24.936954],[9.910693,25.365455],[9.319411,26.094325],[9.716286,26.512206],[9.629056,27.140953],[9.756128,27.688259],[9.683885,28.144174],[9.859998,28.95999],[9.805634,29.424638],[9.48214,30.307556],[9.970017,30.539325],[10.056575,30.961831],[9.950225,31.37607],[10.636901,31.761421],[10.94479,32.081815],[11.432253,32.368903],[11.488787,33.136996],[12.66331,32.79278],[13.08326,32.87882],[13.91868,32.71196],[15.24563,32.26508],[15.71394,31.37626],[16.61162,31.18218],[18.02109,30.76357],[19.08641,30.26639],[19.57404,30.52582],[20.05335,30.98576],[19.82033,31.75179],[20.13397,32.2382],[20.85452,32.7068],[21.54298,32.8432],[22.89576,32.63858],[23.2368,32.19149],[23.60913,32.18726],[23.9275,32.01667],[24.92114,31.89936],[25.16482,31.56915],[24.80287,31.08929],[24.95762,30.6616],[24.70007,30.04419],[25,29.238655],[25,25.6825],[25,22],[25,20.00304],[23.85,20],[23.83766,19.58047],[19.84926,21.49509],[15.86085,23.40972],[14.8513,22.86295]]]}},\n{\"type\":\"Feature\",\"id\":\"LKA\",\"properties\":{\"name\":\"Sri Lanka\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[81.787959,7.523055],[81.637322,6.481775],[81.21802,6.197141],[80.348357,5.96837],[79.872469,6.763463],[79.695167,8.200843],[80.147801,9.824078],[80.838818,9.268427],[81.304319,8.564206],[81.787959,7.523055]]]}},\n{\"type\":\"Feature\",\"id\":\"LSO\",\"properties\":{\"name\":\"Lesotho\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[28.978263,-28.955597],[29.325166,-29.257387],[29.018415,-29.743766],[28.8484,-30.070051],[28.291069,-30.226217],[28.107205,-30.545732],[27.749397,-30.645106],[26.999262,-29.875954],[27.532511,-29.242711],[28.074338,-28.851469],[28.5417,-28.647502],[28.978263,-28.955597]]]}},\n{\"type\":\"Feature\",\"id\":\"LTU\",\"properties\":{\"name\":\"Lithuania\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[22.731099,54.327537],[22.651052,54.582741],[22.757764,54.856574],[22.315724,55.015299],[21.268449,55.190482],[21.0558,56.031076],[22.201157,56.337802],[23.878264,56.273671],[24.860684,56.372528],[25.000934,56.164531],[25.533047,56.100297],[26.494331,55.615107],[26.588279,55.167176],[25.768433,54.846963],[25.536354,54.282423],[24.450684,53.905702],[23.484128,53.912498],[23.243987,54.220567],[22.731099,54.327537]]]}},\n{\"type\":\"Feature\",\"id\":\"LUX\",\"properties\":{\"name\":\"Luxembourg\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[6.043073,50.128052],[6.242751,49.902226],[6.18632,49.463803],[5.897759,49.442667],[5.674052,49.529484],[5.782417,50.090328],[6.043073,50.128052]]]}},\n{\"type\":\"Feature\",\"id\":\"LVA\",\"properties\":{\"name\":\"Latvia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[21.0558,56.031076],[21.090424,56.783873],[21.581866,57.411871],[22.524341,57.753374],[23.318453,57.006236],[24.12073,57.025693],[24.312863,57.793424],[25.164594,57.970157],[25.60281,57.847529],[26.463532,57.476389],[27.288185,57.474528],[27.770016,57.244258],[27.855282,56.759326],[28.176709,56.16913],[27.10246,55.783314],[26.494331,55.615107],[25.533047,56.100297],[25.000934,56.164531],[24.860684,56.372528],[23.878264,56.273671],[22.201157,56.337802],[21.0558,56.031076]]]}},\n{\"type\":\"Feature\",\"id\":\"MAR\",\"properties\":{\"name\":\"Morocco\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-5.193863,35.755182],[-4.591006,35.330712],[-3.640057,35.399855],[-2.604306,35.179093],[-2.169914,35.168396],[-1.792986,34.527919],[-1.733455,33.919713],[-1.388049,32.864015],[-1.124551,32.651522],[-1.307899,32.262889],[-2.616605,32.094346],[-3.06898,31.724498],[-3.647498,31.637294],[-3.690441,30.896952],[-4.859646,30.501188],[-5.242129,30.000443],[-6.060632,29.7317],[-7.059228,29.579228],[-8.674116,28.841289],[-8.66559,27.656426],[-8.817809,27.656426],[-8.817828,27.656426],[-8.794884,27.120696],[-9.413037,27.088476],[-9.735343,26.860945],[-10.189424,26.860945],[-10.551263,26.990808],[-11.392555,26.883424],[-11.71822,26.104092],[-12.030759,26.030866],[-12.500963,24.770116],[-13.89111,23.691009],[-14.221168,22.310163],[-14.630833,21.86094],[-14.750955,21.5006],[-17.002962,21.420734],[-17.020428,21.42231],[-16.973248,21.885745],[-16.589137,22.158234],[-16.261922,22.67934],[-16.326414,23.017768],[-15.982611,23.723358],[-15.426004,24.359134],[-15.089332,24.520261],[-14.824645,25.103533],[-14.800926,25.636265],[-14.43994,26.254418],[-13.773805,26.618892],[-13.139942,27.640148],[-13.121613,27.654148],[-12.618837,28.038186],[-11.688919,28.148644],[-10.900957,28.832142],[-10.399592,29.098586],[-9.564811,29.933574],[-9.814718,31.177736],[-9.434793,32.038096],[-9.300693,32.564679],[-8.657476,33.240245],[-7.654178,33.697065],[-6.912544,34.110476],[-6.244342,35.145865],[-5.929994,35.759988],[-5.193863,35.755182]]]}},\n{\"type\":\"Feature\",\"id\":\"MDA\",\"properties\":{\"name\":\"Moldova\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[26.619337,48.220726],[26.857824,48.368211],[27.522537,48.467119],[28.259547,48.155562],[28.670891,48.118149],[29.122698,47.849095],[29.050868,47.510227],[29.415135,47.346645],[29.559674,46.928583],[29.908852,46.674361],[29.83821,46.525326],[30.024659,46.423937],[29.759972,46.349988],[29.170654,46.379262],[29.072107,46.517678],[28.862972,46.437889],[28.933717,46.25883],[28.659987,45.939987],[28.485269,45.596907],[28.233554,45.488283],[28.054443,45.944586],[28.160018,46.371563],[28.12803,46.810476],[27.551166,47.405117],[27.233873,47.826771],[26.924176,48.123264],[26.619337,48.220726]]]}},\n{\"type\":\"Feature\",\"id\":\"MDG\",\"properties\":{\"name\":\"Madagascar\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[49.543519,-12.469833],[49.808981,-12.895285],[50.056511,-13.555761],[50.217431,-14.758789],[50.476537,-15.226512],[50.377111,-15.706069],[50.200275,-16.000263],[49.860606,-15.414253],[49.672607,-15.710204],[49.863344,-16.451037],[49.774564,-16.875042],[49.498612,-17.106036],[49.435619,-17.953064],[49.041792,-19.118781],[48.548541,-20.496888],[47.930749,-22.391501],[47.547723,-23.781959],[47.095761,-24.94163],[46.282478,-25.178463],[45.409508,-25.601434],[44.833574,-25.346101],[44.03972,-24.988345],[43.763768,-24.460677],[43.697778,-23.574116],[43.345654,-22.776904],[43.254187,-22.057413],[43.433298,-21.336475],[43.893683,-21.163307],[43.89637,-20.830459],[44.374325,-20.072366],[44.464397,-19.435454],[44.232422,-18.961995],[44.042976,-18.331387],[43.963084,-17.409945],[44.312469,-16.850496],[44.446517,-16.216219],[44.944937,-16.179374],[45.502732,-15.974373],[45.872994,-15.793454],[46.312243,-15.780018],[46.882183,-15.210182],[47.70513,-14.594303],[48.005215,-14.091233],[47.869047,-13.663869],[48.293828,-13.784068],[48.84506,-13.089175],[48.863509,-12.487868],[49.194651,-12.040557],[49.543519,-12.469833]]]}},\n{\"type\":\"Feature\",\"id\":\"MEX\",\"properties\":{\"name\":\"Mexico\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-97.140008,25.869997],[-97.528072,24.992144],[-97.702946,24.272343],[-97.776042,22.93258],[-97.872367,22.444212],[-97.699044,21.898689],[-97.38896,21.411019],[-97.189333,20.635433],[-96.525576,19.890931],[-96.292127,19.320371],[-95.900885,18.828024],[-94.839063,18.562717],[-94.42573,18.144371],[-93.548651,18.423837],[-92.786114,18.524839],[-92.037348,18.704569],[-91.407903,18.876083],[-90.77187,19.28412],[-90.53359,19.867418],[-90.451476,20.707522],[-90.278618,20.999855],[-89.601321,21.261726],[-88.543866,21.493675],[-87.658417,21.458846],[-87.05189,21.543543],[-86.811982,21.331515],[-86.845908,20.849865],[-87.383291,20.255405],[-87.621054,19.646553],[-87.43675,19.472403],[-87.58656,19.04013],[-87.837191,18.259816],[-88.090664,18.516648],[-88.300031,18.499982],[-88.490123,18.486831],[-88.848344,17.883198],[-89.029857,18.001511],[-89.150909,17.955468],[-89.14308,17.808319],[-90.067934,17.819326],[-91.00152,17.817595],[-91.002269,17.254658],[-91.453921,17.252177],[-91.08167,16.918477],[-90.711822,16.687483],[-90.600847,16.470778],[-90.438867,16.41011],[-90.464473,16.069562],[-91.74796,16.066565],[-92.229249,15.251447],[-92.087216,15.064585],[-92.20323,14.830103],[-92.22775,14.538829],[-93.359464,15.61543],[-93.875169,15.940164],[-94.691656,16.200975],[-95.250227,16.128318],[-96.053382,15.752088],[-96.557434,15.653515],[-97.263592,15.917065],[-98.01303,16.107312],[-98.947676,16.566043],[-99.697397,16.706164],[-100.829499,17.171071],[-101.666089,17.649026],[-101.918528,17.91609],[-102.478132,17.975751],[-103.50099,18.292295],[-103.917527,18.748572],[-104.99201,19.316134],[-105.493038,19.946767],[-105.731396,20.434102],[-105.397773,20.531719],[-105.500661,20.816895],[-105.270752,21.076285],[-105.265817,21.422104],[-105.603161,21.871146],[-105.693414,22.26908],[-106.028716,22.773752],[-106.90998,23.767774],[-107.915449,24.548915],[-108.401905,25.172314],[-109.260199,25.580609],[-109.444089,25.824884],[-109.291644,26.442934],[-109.801458,26.676176],[-110.391732,27.162115],[-110.641019,27.859876],[-111.178919,27.941241],[-111.759607,28.467953],[-112.228235,28.954409],[-112.271824,29.266844],[-112.809594,30.021114],[-113.163811,30.786881],[-113.148669,31.170966],[-113.871881,31.567608],[-114.205737,31.524045],[-114.776451,31.799532],[-114.9367,31.393485],[-114.771232,30.913617],[-114.673899,30.162681],[-114.330974,29.750432],[-113.588875,29.061611],[-113.424053,28.826174],[-113.271969,28.754783],[-113.140039,28.411289],[-112.962298,28.42519],[-112.761587,27.780217],[-112.457911,27.525814],[-112.244952,27.171727],[-111.616489,26.662817],[-111.284675,25.73259],[-110.987819,25.294606],[-110.710007,24.826004],[-110.655049,24.298595],[-110.172856,24.265548],[-109.771847,23.811183],[-109.409104,23.364672],[-109.433392,23.185588],[-109.854219,22.818272],[-110.031392,22.823078],[-110.295071,23.430973],[-110.949501,24.000964],[-111.670568,24.484423],[-112.182036,24.738413],[-112.148989,25.470125],[-112.300711,26.012004],[-112.777297,26.32196],[-113.464671,26.768186],[-113.59673,26.63946],[-113.848937,26.900064],[-114.465747,27.14209],[-115.055142,27.722727],[-114.982253,27.7982],[-114.570366,27.741485],[-114.199329,28.115003],[-114.162018,28.566112],[-114.931842,29.279479],[-115.518654,29.556362],[-115.887365,30.180794],[-116.25835,30.836464],[-116.721526,31.635744],[-117.12776,32.53534],[-115.99135,32.61239],[-114.72139,32.72083],[-114.815,32.52528],[-113.30498,32.03914],[-111.02361,31.33472],[-109.035,31.34194],[-108.24194,31.34222],[-108.24,31.754854],[-106.50759,31.75452],[-106.1429,31.39995],[-105.63159,31.08383],[-105.03737,30.64402],[-104.70575,30.12173],[-104.45697,29.57196],[-103.94,29.27],[-103.11,28.97],[-102.48,29.76],[-101.6624,29.7793],[-100.9576,29.38071],[-100.45584,28.69612],[-100.11,28.11],[-99.52,27.54],[-99.3,26.84],[-99.02,26.37],[-98.24,26.06],[-97.53,25.84],[-97.140008,25.869997]]]}},\n{\"type\":\"Feature\",\"id\":\"MKD\",\"properties\":{\"name\":\"Macedonia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[20.59023,41.85541],[20.71731,41.84711],[20.76216,42.05186],[21.3527,42.2068],[21.576636,42.245224],[21.91708,42.30364],[22.380526,42.32026],[22.881374,41.999297],[22.952377,41.337994],[22.76177,41.3048],[22.597308,41.130487],[22.055378,41.149866],[21.674161,40.931275],[21.02004,40.842727],[20.60518,41.08622],[20.46315,41.51509],[20.59023,41.85541]]]}},\n{\"type\":\"Feature\",\"id\":\"MLI\",\"properties\":{\"name\":\"Mali\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-12.17075,14.616834],[-11.834208,14.799097],[-11.666078,15.388208],[-11.349095,15.411256],[-10.650791,15.132746],[-10.086846,15.330486],[-9.700255,15.264107],[-9.550238,15.486497],[-5.537744,15.50169],[-5.315277,16.201854],[-5.488523,16.325102],[-5.971129,20.640833],[-6.453787,24.956591],[-4.923337,24.974574],[-1.550055,22.792666],[1.823228,20.610809],[2.060991,20.142233],[2.683588,19.85623],[3.146661,19.693579],[3.158133,19.057364],[4.267419,19.155265],[4.27021,16.852227],[3.723422,16.184284],[3.638259,15.56812],[2.749993,15.409525],[1.385528,15.323561],[1.015783,14.968182],[0.374892,14.928908],[-0.266257,14.924309],[-0.515854,15.116158],[-1.066363,14.973815],[-2.001035,14.559008],[-2.191825,14.246418],[-2.967694,13.79815],[-3.103707,13.541267],[-3.522803,13.337662],[-4.006391,13.472485],[-4.280405,13.228444],[-4.427166,12.542646],[-5.220942,11.713859],[-5.197843,11.375146],[-5.470565,10.95127],[-5.404342,10.370737],[-5.816926,10.222555],[-6.050452,10.096361],[-6.205223,10.524061],[-6.493965,10.411303],[-6.666461,10.430811],[-6.850507,10.138994],[-7.622759,10.147236],[-7.89959,10.297382],[-8.029944,10.206535],[-8.335377,10.494812],[-8.282357,10.792597],[-8.407311,10.909257],[-8.620321,10.810891],[-8.581305,11.136246],[-8.376305,11.393646],[-8.786099,11.812561],[-8.905265,12.088358],[-9.127474,12.30806],[-9.327616,12.334286],[-9.567912,12.194243],[-9.890993,12.060479],[-10.165214,11.844084],[-10.593224,11.923975],[-10.87083,12.177887],[-11.036556,12.211245],[-11.297574,12.077971],[-11.456169,12.076834],[-11.513943,12.442988],[-11.467899,12.754519],[-11.553398,13.141214],[-11.927716,13.422075],[-12.124887,13.994727],[-12.17075,14.616834]]]}},\n{\"type\":\"Feature\",\"id\":\"MLT\",\"properties\":{\"name\":\"Malta\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[14.566171,35.852721],[14.532684,35.820191],[14.436463,35.821664],[14.352334,35.872281],[14.3513,35.978399],[14.448348,35.957444],[14.537025,35.886285],[14.566171,35.852721]]],[[[14.313473,36.027569],[14.253632,36.012143],[14.194204,36.042245],[14.180354,36.060383],[14.263243,36.075809],[14.303758,36.062295],[14.320914,36.03625],[14.313473,36.027569]]]]}},\n{\"type\":\"Feature\",\"id\":\"MMR\",\"properties\":{\"name\":\"Myanmar\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[99.543309,20.186598],[98.959676,19.752981],[98.253724,19.708203],[97.797783,18.62708],[97.375896,18.445438],[97.859123,17.567946],[98.493761,16.837836],[98.903348,16.177824],[98.537376,15.308497],[98.192074,15.123703],[98.430819,14.622028],[99.097755,13.827503],[99.212012,13.269294],[99.196354,12.804748],[99.587286,11.892763],[99.038121,10.960546],[98.553551,9.93296],[98.457174,10.675266],[98.764546,11.441292],[98.428339,12.032987],[98.509574,13.122378],[98.103604,13.64046],[97.777732,14.837286],[97.597072,16.100568],[97.16454,16.928734],[96.505769,16.427241],[95.369352,15.71439],[94.808405,15.803454],[94.188804,16.037936],[94.533486,17.27724],[94.324817,18.213514],[93.540988,19.366493],[93.663255,19.726962],[93.078278,19.855145],[92.368554,20.670883],[92.303234,21.475485],[92.652257,21.324048],[92.672721,22.041239],[93.166128,22.27846],[93.060294,22.703111],[93.286327,23.043658],[93.325188,24.078556],[94.106742,23.850741],[94.552658,24.675238],[94.603249,25.162495],[95.155153,26.001307],[95.124768,26.573572],[96.419366,27.264589],[97.133999,27.083774],[97.051989,27.699059],[97.402561,27.882536],[97.327114,28.261583],[97.911988,28.335945],[98.246231,27.747221],[98.68269,27.508812],[98.712094,26.743536],[98.671838,25.918703],[97.724609,25.083637],[97.60472,23.897405],[98.660262,24.063286],[98.898749,23.142722],[99.531992,22.949039],[99.240899,22.118314],[99.983489,21.742937],[100.416538,21.558839],[101.150033,21.849984],[101.180005,21.436573],[100.329101,20.786122],[100.115988,20.41785],[99.543309,20.186598]]]}},\n{\"type\":\"Feature\",\"id\":\"MNE\",\"properties\":{\"name\":\"Montenegro\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[19.801613,42.500093],[19.738051,42.688247],[19.30449,42.19574],[19.37177,41.87755],[19.16246,41.95502],[18.88214,42.28151],[18.45,42.48],[18.56,42.65],[18.70648,43.20011],[19.03165,43.43253],[19.21852,43.52384],[19.48389,43.35229],[19.63,43.21378],[19.95857,43.10604],[20.3398,42.89852],[20.25758,42.81275],[20.0707,42.58863],[19.801613,42.500093]]]}},\n{\"type\":\"Feature\",\"id\":\"MNG\",\"properties\":{\"name\":\"Mongolia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[87.751264,49.297198],[88.805567,49.470521],[90.713667,50.331812],[92.234712,50.802171],[93.104219,50.49529],[94.147566,50.480537],[94.815949,50.013433],[95.814028,49.977467],[97.259728,49.726061],[98.231762,50.422401],[97.82574,51.010995],[98.861491,52.047366],[99.981732,51.634006],[100.88948,51.516856],[102.065223,51.259921],[102.255909,50.510561],[103.676545,50.089966],[104.621552,50.275329],[105.886591,50.406019],[106.888804,50.274296],[107.868176,49.793705],[108.475167,49.282548],[109.402449,49.292961],[110.662011,49.130128],[111.581231,49.377968],[112.89774,49.543565],[114.362456,50.248303],[114.96211,50.140247],[115.485695,49.805177],[116.678801,49.888531],[116.191802,49.134598],[115.485282,48.135383],[115.742837,47.726545],[116.308953,47.85341],[117.295507,47.697709],[118.064143,48.06673],[118.866574,47.74706],[119.772824,47.048059],[119.66327,46.69268],[118.874326,46.805412],[117.421701,46.672733],[116.717868,46.388202],[115.985096,45.727235],[114.460332,45.339817],[113.463907,44.808893],[112.436062,45.011646],[111.873306,45.102079],[111.348377,44.457442],[111.667737,44.073176],[111.829588,43.743118],[111.129682,43.406834],[110.412103,42.871234],[109.243596,42.519446],[107.744773,42.481516],[106.129316,42.134328],[104.964994,41.59741],[104.522282,41.908347],[103.312278,41.907468],[101.83304,42.514873],[100.845866,42.663804],[99.515817,42.524691],[97.451757,42.74889],[96.349396,42.725635],[95.762455,43.319449],[95.306875,44.241331],[94.688929,44.352332],[93.480734,44.975472],[92.133891,45.115076],[90.94554,45.286073],[90.585768,45.719716],[90.970809,46.888146],[90.280826,47.693549],[88.854298,48.069082],[88.013832,48.599463],[87.751264,49.297198]]]}},\n{\"type\":\"Feature\",\"id\":\"MOZ\",\"properties\":{\"name\":\"Mozambique\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[34.559989,-11.52002],[35.312398,-11.439146],[36.514082,-11.720938],[36.775151,-11.594537],[37.471284,-11.568751],[37.827645,-11.268769],[38.427557,-11.285202],[39.52103,-10.896854],[40.316589,-10.317096],[40.478387,-10.765441],[40.437253,-11.761711],[40.560811,-12.639177],[40.59962,-14.201975],[40.775475,-14.691764],[40.477251,-15.406294],[40.089264,-16.100774],[39.452559,-16.720891],[38.538351,-17.101023],[37.411133,-17.586368],[36.281279,-18.659688],[35.896497,-18.84226],[35.1984,-19.552811],[34.786383,-19.784012],[34.701893,-20.497043],[35.176127,-21.254361],[35.373428,-21.840837],[35.385848,-22.14],[35.562546,-22.09],[35.533935,-23.070788],[35.371774,-23.535359],[35.60747,-23.706563],[35.458746,-24.12261],[35.040735,-24.478351],[34.215824,-24.816314],[33.01321,-25.357573],[32.574632,-25.727318],[32.660363,-26.148584],[32.915955,-26.215867],[32.83012,-26.742192],[32.071665,-26.73382],[31.985779,-26.29178],[31.837778,-25.843332],[31.752408,-25.484284],[31.930589,-24.369417],[31.670398,-23.658969],[31.191409,-22.25151],[32.244988,-21.116489],[32.508693,-20.395292],[32.659743,-20.30429],[32.772708,-19.715592],[32.611994,-19.419383],[32.654886,-18.67209],[32.849861,-17.979057],[32.847639,-16.713398],[32.328239,-16.392074],[31.852041,-16.319417],[31.636498,-16.07199],[31.173064,-15.860944],[30.338955,-15.880839],[30.274256,-15.507787],[30.179481,-14.796099],[33.214025,-13.97186],[33.7897,-14.451831],[34.064825,-14.35995],[34.459633,-14.61301],[34.517666,-15.013709],[34.307291,-15.478641],[34.381292,-16.18356],[35.03381,-16.8013],[35.339063,-16.10744],[35.771905,-15.896859],[35.686845,-14.611046],[35.267956,-13.887834],[34.907151,-13.565425],[34.559989,-13.579998],[34.280006,-12.280025],[34.559989,-11.52002]]]}},\n{\"type\":\"Feature\",\"id\":\"MRT\",\"properties\":{\"name\":\"Mauritania\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-12.17075,14.616834],[-12.830658,15.303692],[-13.435738,16.039383],[-14.099521,16.304302],[-14.577348,16.598264],[-15.135737,16.587282],[-15.623666,16.369337],[-16.12069,16.455663],[-16.463098,16.135036],[-16.549708,16.673892],[-16.270552,17.166963],[-16.146347,18.108482],[-16.256883,19.096716],[-16.377651,19.593817],[-16.277838,20.092521],[-16.536324,20.567866],[-17.063423,20.999752],[-16.845194,21.333323],[-12.929102,21.327071],[-13.118754,22.77122],[-12.874222,23.284832],[-11.937224,23.374594],[-11.969419,25.933353],[-8.687294,25.881056],[-8.6844,27.395744],[-4.923337,24.974574],[-6.453787,24.956591],[-5.971129,20.640833],[-5.488523,16.325102],[-5.315277,16.201854],[-5.537744,15.50169],[-9.550238,15.486497],[-9.700255,15.264107],[-10.086846,15.330486],[-10.650791,15.132746],[-11.349095,15.411256],[-11.666078,15.388208],[-11.834208,14.799097],[-12.17075,14.616834]]]}},\n{\"type\":\"Feature\",\"id\":\"MWI\",\"properties\":{\"name\":\"Malawi\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[34.559989,-11.52002],[34.280006,-12.280025],[34.559989,-13.579998],[34.907151,-13.565425],[35.267956,-13.887834],[35.686845,-14.611046],[35.771905,-15.896859],[35.339063,-16.10744],[35.03381,-16.8013],[34.381292,-16.18356],[34.307291,-15.478641],[34.517666,-15.013709],[34.459633,-14.61301],[34.064825,-14.35995],[33.7897,-14.451831],[33.214025,-13.97186],[32.688165,-13.712858],[32.991764,-12.783871],[33.306422,-12.435778],[33.114289,-11.607198],[33.31531,-10.79655],[33.485688,-10.525559],[33.231388,-9.676722],[32.759375,-9.230599],[33.739729,-9.417151],[33.940838,-9.693674],[34.280006,-10.16],[34.559989,-11.52002]]]}},\n{\"type\":\"Feature\",\"id\":\"MYS\",\"properties\":{\"name\":\"Malaysia\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[101.075516,6.204867],[101.154219,5.691384],[101.814282,5.810808],[102.141187,6.221636],[102.371147,6.128205],[102.961705,5.524495],[103.381215,4.855001],[103.438575,4.181606],[103.332122,3.726698],[103.429429,3.382869],[103.502448,2.791019],[103.854674,2.515454],[104.247932,1.631141],[104.228811,1.293048],[103.519707,1.226334],[102.573615,1.967115],[101.390638,2.760814],[101.27354,3.270292],[100.695435,3.93914],[100.557408,4.76728],[100.196706,5.312493],[100.30626,6.040562],[100.085757,6.464489],[100.259596,6.642825],[101.075516,6.204867]]],[[[118.618321,4.478202],[117.882035,4.137551],[117.015214,4.306094],[115.865517,4.306559],[115.519078,3.169238],[115.134037,2.821482],[114.621355,1.430688],[113.80585,1.217549],[112.859809,1.49779],[112.380252,1.410121],[111.797548,0.904441],[111.159138,0.976478],[110.514061,0.773131],[109.830227,1.338136],[109.66326,2.006467],[110.396135,1.663775],[111.168853,1.850637],[111.370081,2.697303],[111.796928,2.885897],[112.995615,3.102395],[113.712935,3.893509],[114.204017,4.525874],[114.659596,4.007637],[114.869557,4.348314],[115.347461,4.316636],[115.4057,4.955228],[115.45071,5.44773],[116.220741,6.143191],[116.725103,6.924771],[117.129626,6.928053],[117.643393,6.422166],[117.689075,5.98749],[118.347691,5.708696],[119.181904,5.407836],[119.110694,5.016128],[118.439727,4.966519],[118.618321,4.478202]]]]}},\n{\"type\":\"Feature\",\"id\":\"NAM\",\"properties\":{\"name\":\"Namibia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[16.344977,-28.576705],[15.601818,-27.821247],[15.210472,-27.090956],[14.989711,-26.117372],[14.743214,-25.39292],[14.408144,-23.853014],[14.385717,-22.656653],[14.257714,-22.111208],[13.868642,-21.699037],[13.352498,-20.872834],[12.826845,-19.673166],[12.608564,-19.045349],[11.794919,-18.069129],[11.734199,-17.301889],[12.215461,-17.111668],[12.814081,-16.941343],[13.462362,-16.971212],[14.058501,-17.423381],[14.209707,-17.353101],[18.263309,-17.309951],[18.956187,-17.789095],[21.377176,-17.930636],[23.215048,-17.523116],[24.033862,-17.295843],[24.682349,-17.353411],[25.07695,-17.578823],[25.084443,-17.661816],[24.520705,-17.887125],[24.217365,-17.889347],[23.579006,-18.281261],[23.196858,-17.869038],[21.65504,-18.219146],[20.910641,-18.252219],[20.881134,-21.814327],[19.895458,-21.849157],[19.895768,-24.76779],[19.894734,-28.461105],[19.002127,-28.972443],[18.464899,-29.045462],[17.836152,-28.856378],[17.387497,-28.783514],[17.218929,-28.355943],[16.824017,-28.082162],[16.344977,-28.576705]]]}},\n{\"type\":\"Feature\",\"id\":\"NCL\",\"properties\":{\"name\":\"New Caledonia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[165.77999,-21.080005],[166.599991,-21.700019],[167.120011,-22.159991],[166.740035,-22.399976],[166.189732,-22.129708],[165.474375,-21.679607],[164.829815,-21.14982],[164.167995,-20.444747],[164.029606,-20.105646],[164.459967,-20.120012],[165.020036,-20.459991],[165.460009,-20.800022],[165.77999,-21.080005]]]}},\n{\"type\":\"Feature\",\"id\":\"NER\",\"properties\":{\"name\":\"Niger\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[2.154474,11.94015],[2.177108,12.625018],[1.024103,12.851826],[0.993046,13.33575],[0.429928,13.988733],[0.295646,14.444235],[0.374892,14.928908],[1.015783,14.968182],[1.385528,15.323561],[2.749993,15.409525],[3.638259,15.56812],[3.723422,16.184284],[4.27021,16.852227],[4.267419,19.155265],[5.677566,19.601207],[8.572893,21.565661],[11.999506,23.471668],[13.581425,23.040506],[14.143871,22.491289],[14.8513,22.86295],[15.096888,21.308519],[15.471077,21.048457],[15.487148,20.730415],[15.903247,20.387619],[15.685741,19.95718],[15.300441,17.92795],[15.247731,16.627306],[13.972202,15.684366],[13.540394,14.367134],[13.956699,13.996691],[13.954477,13.353449],[14.595781,13.330427],[14.495787,12.859396],[14.213531,12.802035],[14.181336,12.483657],[13.995353,12.461565],[13.318702,13.556356],[13.083987,13.596147],[12.302071,13.037189],[11.527803,13.32898],[10.989593,13.387323],[10.701032,13.246918],[10.114814,13.277252],[9.524928,12.851102],[9.014933,12.826659],[7.804671,13.343527],[7.330747,13.098038],[6.820442,13.115091],[6.445426,13.492768],[5.443058,13.865924],[4.368344,13.747482],[4.107946,13.531216],[3.967283,12.956109],[3.680634,12.552903],[3.61118,11.660167],[2.848643,12.235636],[2.490164,12.233052],[2.154474,11.94015]]]}},\n{\"type\":\"Feature\",\"id\":\"NGA\",\"properties\":{\"name\":\"Nigeria\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[8.500288,4.771983],[7.462108,4.412108],[7.082596,4.464689],[6.698072,4.240594],[5.898173,4.262453],[5.362805,4.887971],[5.033574,5.611802],[4.325607,6.270651],[3.57418,6.2583],[2.691702,6.258817],[2.749063,7.870734],[2.723793,8.506845],[2.912308,9.137608],[3.220352,9.444153],[3.705438,10.06321],[3.60007,10.332186],[3.797112,10.734746],[3.572216,11.327939],[3.61118,11.660167],[3.680634,12.552903],[3.967283,12.956109],[4.107946,13.531216],[4.368344,13.747482],[5.443058,13.865924],[6.445426,13.492768],[6.820442,13.115091],[7.330747,13.098038],[7.804671,13.343527],[9.014933,12.826659],[9.524928,12.851102],[10.114814,13.277252],[10.701032,13.246918],[10.989593,13.387323],[11.527803,13.32898],[12.302071,13.037189],[13.083987,13.596147],[13.318702,13.556356],[13.995353,12.461565],[14.181336,12.483657],[14.577178,12.085361],[14.468192,11.904752],[14.415379,11.572369],[13.57295,10.798566],[13.308676,10.160362],[13.1676,9.640626],[12.955468,9.417772],[12.753672,8.717763],[12.218872,8.305824],[12.063946,7.799808],[11.839309,7.397042],[11.745774,6.981383],[11.058788,6.644427],[10.497375,7.055358],[10.118277,7.03877],[9.522706,6.453482],[9.233163,6.444491],[8.757533,5.479666],[8.500288,4.771983]]]}},\n{\"type\":\"Feature\",\"id\":\"NIC\",\"properties\":{\"name\":\"Nicaragua\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-85.71254,11.088445],[-86.058488,11.403439],[-86.52585,11.806877],[-86.745992,12.143962],[-87.167516,12.458258],[-87.668493,12.90991],[-87.557467,13.064552],[-87.392386,12.914018],[-87.316654,12.984686],[-87.005769,13.025794],[-86.880557,13.254204],[-86.733822,13.263093],[-86.755087,13.754845],[-86.520708,13.778487],[-86.312142,13.771356],[-86.096264,14.038187],[-85.801295,13.836055],[-85.698665,13.960078],[-85.514413,14.079012],[-85.165365,14.35437],[-85.148751,14.560197],[-85.052787,14.551541],[-84.924501,14.790493],[-84.820037,14.819587],[-84.649582,14.666805],[-84.449336,14.621614],[-84.228342,14.748764],[-83.975721,14.749436],[-83.628585,14.880074],[-83.489989,15.016267],[-83.147219,14.995829],[-83.233234,14.899866],[-83.284162,14.676624],[-83.182126,14.310703],[-83.4125,13.970078],[-83.519832,13.567699],[-83.552207,13.127054],[-83.498515,12.869292],[-83.473323,12.419087],[-83.626104,12.32085],[-83.719613,11.893124],[-83.650858,11.629032],[-83.85547,11.373311],[-83.808936,11.103044],[-83.655612,10.938764],[-83.895054,10.726839],[-84.190179,10.79345],[-84.355931,10.999226],[-84.673069,11.082657],[-84.903003,10.952303],[-85.561852,11.217119],[-85.71254,11.088445]]]}},\n{\"type\":\"Feature\",\"id\":\"NLD\",\"properties\":{\"name\":\"Netherlands\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[6.074183,53.510403],[6.90514,53.482162],[7.092053,53.144043],[6.84287,52.22844],[6.589397,51.852029],[5.988658,51.851616],[6.156658,50.803721],[5.606976,51.037298],[4.973991,51.475024],[4.047071,51.267259],[3.314971,51.345755],[3.830289,51.620545],[4.705997,53.091798],[6.074183,53.510403]]]}},\n{\"type\":\"Feature\",\"id\":\"NOR\",\"properties\":{\"name\":\"Norway\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[28.165547,71.185474],[31.293418,70.453788],[30.005435,70.186259],[31.101079,69.55808],[29.399581,69.156916],[28.59193,69.064777],[29.015573,69.766491],[27.732292,70.164193],[26.179622,69.825299],[25.689213,69.092114],[24.735679,68.649557],[23.66205,68.891247],[22.356238,68.841741],[21.244936,69.370443],[20.645593,69.106247],[20.025269,69.065139],[19.87856,68.407194],[17.993868,68.567391],[17.729182,68.010552],[16.768879,68.013937],[16.108712,67.302456],[15.108411,66.193867],[13.55569,64.787028],[13.919905,64.445421],[13.571916,64.049114],[12.579935,64.066219],[11.930569,63.128318],[11.992064,61.800362],[12.631147,61.293572],[12.300366,60.117933],[11.468272,59.432393],[11.027369,58.856149],[10.356557,59.469807],[8.382,58.313288],[7.048748,58.078884],[5.665835,58.588155],[5.308234,59.663232],[4.992078,61.970998],[5.9129,62.614473],[8.553411,63.454008],[10.527709,64.486038],[12.358347,65.879726],[14.761146,67.810642],[16.435927,68.563205],[19.184028,69.817444],[21.378416,70.255169],[23.023742,70.202072],[24.546543,71.030497],[26.37005,70.986262],[28.165547,71.185474]]],[[[24.72412,77.85385],[22.49032,77.44493],[20.72601,77.67704],[21.41611,77.93504],[20.8119,78.25463],[22.88426,78.45494],[23.28134,78.07954],[24.72412,77.85385]]],[[[18.25183,79.70175],[21.54383,78.95611],[19.02737,78.5626],[18.47172,77.82669],[17.59441,77.63796],[17.1182,76.80941],[15.91315,76.77045],[13.76259,77.38035],[14.66956,77.73565],[13.1706,78.02493],[11.22231,78.8693],[10.44453,79.65239],[13.17077,80.01046],[13.71852,79.66039],[15.14282,79.67431],[15.52255,80.01608],[16.99085,80.05086],[18.25183,79.70175]]],[[[25.447625,80.40734],[27.407506,80.056406],[25.924651,79.517834],[23.024466,79.400012],[20.075188,79.566823],[19.897266,79.842362],[18.462264,79.85988],[17.368015,80.318896],[20.455992,80.598156],[21.907945,80.357679],[22.919253,80.657144],[25.447625,80.40734]]]]}},\n{\"type\":\"Feature\",\"id\":\"NPL\",\"properties\":{\"name\":\"Nepal\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[88.120441,27.876542],[88.043133,27.445819],[88.174804,26.810405],[88.060238,26.414615],[87.227472,26.397898],[86.024393,26.630985],[85.251779,26.726198],[84.675018,27.234901],[83.304249,27.364506],[81.999987,27.925479],[81.057203,28.416095],[80.088425,28.79447],[80.476721,29.729865],[81.111256,30.183481],[81.525804,30.422717],[82.327513,30.115268],[83.337115,29.463732],[83.898993,29.320226],[84.23458,28.839894],[85.011638,28.642774],[85.82332,28.203576],[86.954517,27.974262],[88.120441,27.876542]]]}},\n{\"type\":\"Feature\",\"id\":\"NZL\",\"properties\":{\"name\":\"New Zealand\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[173.020375,-40.919052],[173.247234,-41.331999],[173.958405,-40.926701],[174.247587,-41.349155],[174.248517,-41.770008],[173.876447,-42.233184],[173.22274,-42.970038],[172.711246,-43.372288],[173.080113,-43.853344],[172.308584,-43.865694],[171.452925,-44.242519],[171.185138,-44.897104],[170.616697,-45.908929],[169.831422,-46.355775],[169.332331,-46.641235],[168.411354,-46.619945],[167.763745,-46.290197],[166.676886,-46.219917],[166.509144,-45.852705],[167.046424,-45.110941],[168.303763,-44.123973],[168.949409,-43.935819],[169.667815,-43.555326],[170.52492,-43.031688],[171.12509,-42.512754],[171.569714,-41.767424],[171.948709,-41.514417],[172.097227,-40.956104],[172.79858,-40.493962],[173.020375,-40.919052]]],[[[174.612009,-36.156397],[175.336616,-37.209098],[175.357596,-36.526194],[175.808887,-36.798942],[175.95849,-37.555382],[176.763195,-37.881253],[177.438813,-37.961248],[178.010354,-37.579825],[178.517094,-37.695373],[178.274731,-38.582813],[177.97046,-39.166343],[177.206993,-39.145776],[176.939981,-39.449736],[177.032946,-39.879943],[176.885824,-40.065978],[176.508017,-40.604808],[176.01244,-41.289624],[175.239567,-41.688308],[175.067898,-41.425895],[174.650973,-41.281821],[175.22763,-40.459236],[174.900157,-39.908933],[173.824047,-39.508854],[173.852262,-39.146602],[174.574802,-38.797683],[174.743474,-38.027808],[174.697017,-37.381129],[174.292028,-36.711092],[174.319004,-36.534824],[173.840997,-36.121981],[173.054171,-35.237125],[172.636005,-34.529107],[173.007042,-34.450662],[173.551298,-35.006183],[174.32939,-35.265496],[174.612009,-36.156397]]]]}},\n{\"type\":\"Feature\",\"id\":\"OMN\",\"properties\":{\"name\":\"Oman\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[58.861141,21.114035],[58.487986,20.428986],[58.034318,20.481437],[57.826373,20.243002],[57.665762,19.736005],[57.7887,19.06757],[57.694391,18.94471],[57.234264,18.947991],[56.609651,18.574267],[56.512189,18.087113],[56.283521,17.876067],[55.661492,17.884128],[55.269939,17.632309],[55.2749,17.228354],[54.791002,16.950697],[54.239253,17.044981],[53.570508,16.707663],[53.108573,16.651051],[52.782184,17.349742],[52.00001,19.000003],[54.999982,19.999994],[55.666659,22.000001],[55.208341,22.70833],[55.234489,23.110993],[55.525841,23.524869],[55.528632,23.933604],[55.981214,24.130543],[55.804119,24.269604],[55.886233,24.920831],[56.396847,24.924732],[56.84514,24.241673],[57.403453,23.878594],[58.136948,23.747931],[58.729211,23.565668],[59.180502,22.992395],[59.450098,22.660271],[59.80806,22.533612],[59.806148,22.310525],[59.442191,21.714541],[59.282408,21.433886],[58.861141,21.114035]]],[[[56.391421,25.895991],[56.261042,25.714606],[56.070821,26.055464],[56.362017,26.395934],[56.485679,26.309118],[56.391421,25.895991]]]]}},\n{\"type\":\"Feature\",\"id\":\"PAK\",\"properties\":{\"name\":\"Pakistan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[75.158028,37.133031],[75.896897,36.666806],[76.192848,35.898403],[77.837451,35.49401],[76.871722,34.653544],[75.757061,34.504923],[74.240203,34.748887],[73.749948,34.317699],[74.104294,33.441473],[74.451559,32.7649],[75.258642,32.271105],[74.405929,31.692639],[74.42138,30.979815],[73.450638,29.976413],[72.823752,28.961592],[71.777666,27.91318],[70.616496,27.989196],[69.514393,26.940966],[70.168927,26.491872],[70.282873,25.722229],[70.844699,25.215102],[71.04324,24.356524],[68.842599,24.359134],[68.176645,23.691965],[67.443667,23.944844],[67.145442,24.663611],[66.372828,25.425141],[64.530408,25.237039],[62.905701,25.218409],[61.497363,25.078237],[61.874187,26.239975],[63.316632,26.756532],[63.233898,27.217047],[62.755426,27.378923],[62.72783,28.259645],[61.771868,28.699334],[61.369309,29.303276],[60.874248,29.829239],[62.549857,29.318572],[63.550261,29.468331],[64.148002,29.340819],[64.350419,29.560031],[65.046862,29.472181],[66.346473,29.887943],[66.381458,30.738899],[66.938891,31.304911],[67.683394,31.303154],[67.792689,31.58293],[68.556932,31.71331],[68.926677,31.620189],[69.317764,31.901412],[69.262522,32.501944],[69.687147,33.105499],[70.323594,33.358533],[69.930543,34.02012],[70.881803,33.988856],[71.156773,34.348911],[71.115019,34.733126],[71.613076,35.153203],[71.498768,35.650563],[71.262348,36.074388],[71.846292,36.509942],[72.920025,36.720007],[74.067552,36.836176],[74.575893,37.020841],[75.158028,37.133031]]]}},\n{\"type\":\"Feature\",\"id\":\"PAN\",\"properties\":{\"name\":\"Panama\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-77.881571,7.223771],[-78.214936,7.512255],[-78.429161,8.052041],[-78.182096,8.319182],[-78.435465,8.387705],[-78.622121,8.718124],[-79.120307,8.996092],[-79.557877,8.932375],[-79.760578,8.584515],[-80.164481,8.333316],[-80.382659,8.298409],[-80.480689,8.090308],[-80.00369,7.547524],[-80.276671,7.419754],[-80.421158,7.271572],[-80.886401,7.220541],[-81.059543,7.817921],[-81.189716,7.647906],[-81.519515,7.70661],[-81.721311,8.108963],[-82.131441,8.175393],[-82.390934,8.292362],[-82.820081,8.290864],[-82.850958,8.073823],[-82.965783,8.225028],[-82.913176,8.423517],[-82.829771,8.626295],[-82.868657,8.807266],[-82.719183,8.925709],[-82.927155,9.07433],[-82.932891,9.476812],[-82.546196,9.566135],[-82.187123,9.207449],[-82.207586,8.995575],[-81.808567,8.950617],[-81.714154,9.031955],[-81.439287,8.786234],[-80.947302,8.858504],[-80.521901,9.111072],[-79.9146,9.312765],[-79.573303,9.61161],[-79.021192,9.552931],[-79.05845,9.454565],[-78.500888,9.420459],[-78.055928,9.24773],[-77.729514,8.946844],[-77.353361,8.670505],[-77.474723,8.524286],[-77.242566,7.935278],[-77.431108,7.638061],[-77.753414,7.70984],[-77.881571,7.223771]]]}},\n{\"type\":\"Feature\",\"id\":\"PER\",\"properties\":{\"name\":\"Peru\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-69.590424,-17.580012],[-69.858444,-18.092694],[-70.372572,-18.347975],[-71.37525,-17.773799],[-71.462041,-17.363488],[-73.44453,-16.359363],[-75.237883,-15.265683],[-76.009205,-14.649286],[-76.423469,-13.823187],[-76.259242,-13.535039],[-77.106192,-12.222716],[-78.092153,-10.377712],[-79.036953,-8.386568],[-79.44592,-7.930833],[-79.760578,-7.194341],[-80.537482,-6.541668],[-81.249996,-6.136834],[-80.926347,-5.690557],[-81.410943,-4.736765],[-81.09967,-4.036394],[-80.302561,-3.404856],[-80.184015,-3.821162],[-80.469295,-4.059287],[-80.442242,-4.425724],[-80.028908,-4.346091],[-79.624979,-4.454198],[-79.205289,-4.959129],[-78.639897,-4.547784],[-78.450684,-3.873097],[-77.837905,-3.003021],[-76.635394,-2.608678],[-75.544996,-1.56161],[-75.233723,-0.911417],[-75.373223,-0.152032],[-75.106625,-0.057205],[-74.441601,-0.53082],[-74.122395,-1.002833],[-73.659504,-1.260491],[-73.070392,-2.308954],[-72.325787,-2.434218],[-71.774761,-2.16979],[-71.413646,-2.342802],[-70.813476,-2.256865],[-70.047709,-2.725156],[-70.692682,-3.742872],[-70.394044,-3.766591],[-69.893635,-4.298187],[-70.794769,-4.251265],[-70.928843,-4.401591],[-71.748406,-4.593983],[-72.891928,-5.274561],[-72.964507,-5.741251],[-73.219711,-6.089189],[-73.120027,-6.629931],[-73.724487,-6.918595],[-73.723401,-7.340999],[-73.987235,-7.52383],[-73.571059,-8.424447],[-73.015383,-9.032833],[-73.226713,-9.462213],[-72.563033,-9.520194],[-72.184891,-10.053598],[-71.302412,-10.079436],[-70.481894,-9.490118],[-70.548686,-11.009147],[-70.093752,-11.123972],[-69.529678,-10.951734],[-68.66508,-12.5613],[-68.88008,-12.899729],[-68.929224,-13.602684],[-68.948887,-14.453639],[-69.339535,-14.953195],[-69.160347,-15.323974],[-69.389764,-15.660129],[-68.959635,-16.500698],[-69.590424,-17.580012]]]}},\n{\"type\":\"Feature\",\"id\":\"PHL\",\"properties\":{\"name\":\"Philippines\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[126.376814,8.414706],[126.478513,7.750354],[126.537424,7.189381],[126.196773,6.274294],[125.831421,7.293715],[125.363852,6.786485],[125.683161,6.049657],[125.396512,5.581003],[124.219788,6.161355],[123.93872,6.885136],[124.243662,7.36061],[123.610212,7.833527],[123.296071,7.418876],[122.825506,7.457375],[122.085499,6.899424],[121.919928,7.192119],[122.312359,8.034962],[122.942398,8.316237],[123.487688,8.69301],[123.841154,8.240324],[124.60147,8.514158],[124.764612,8.960409],[125.471391,8.986997],[125.412118,9.760335],[126.222714,9.286074],[126.306637,8.782487],[126.376814,8.414706]]],[[[123.982438,10.278779],[123.623183,9.950091],[123.309921,9.318269],[122.995883,9.022189],[122.380055,9.713361],[122.586089,9.981045],[122.837081,10.261157],[122.947411,10.881868],[123.49885,10.940624],[123.337774,10.267384],[124.077936,11.232726],[123.982438,10.278779]]],[[[118.504581,9.316383],[117.174275,8.3675],[117.664477,9.066889],[118.386914,9.6845],[118.987342,10.376292],[119.511496,11.369668],[119.689677,10.554291],[119.029458,10.003653],[118.504581,9.316383]]],[[[121.883548,11.891755],[122.483821,11.582187],[123.120217,11.58366],[123.100838,11.165934],[122.637714,10.741308],[122.00261,10.441017],[121.967367,10.905691],[122.03837,11.415841],[121.883548,11.891755]]],[[[125.502552,12.162695],[125.783465,11.046122],[125.011884,11.311455],[125.032761,10.975816],[125.277449,10.358722],[124.801819,10.134679],[124.760168,10.837995],[124.459101,10.88993],[124.302522,11.495371],[124.891013,11.415583],[124.87799,11.79419],[124.266762,12.557761],[125.227116,12.535721],[125.502552,12.162695]]],[[[121.527394,13.06959],[121.26219,12.20556],[120.833896,12.704496],[120.323436,13.466413],[121.180128,13.429697],[121.527394,13.06959]]],[[[121.321308,18.504065],[121.937601,18.218552],[122.246006,18.47895],[122.336957,18.224883],[122.174279,17.810283],[122.515654,17.093505],[122.252311,16.262444],[121.662786,15.931018],[121.50507,15.124814],[121.728829,14.328376],[122.258925,14.218202],[122.701276,14.336541],[123.950295,13.782131],[123.855107,13.237771],[124.181289,12.997527],[124.077419,12.536677],[123.298035,13.027526],[122.928652,13.55292],[122.671355,13.185836],[122.03465,13.784482],[121.126385,13.636687],[120.628637,13.857656],[120.679384,14.271016],[120.991819,14.525393],[120.693336,14.756671],[120.564145,14.396279],[120.070429,14.970869],[119.920929,15.406347],[119.883773,16.363704],[120.286488,16.034629],[120.390047,17.599081],[120.715867,18.505227],[121.321308,18.504065]]]]}},\n{\"type\":\"Feature\",\"id\":\"PNG\",\"properties\":{\"name\":\"Papua New Guinea\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[155.880026,-6.819997],[155.599991,-6.919991],[155.166994,-6.535931],[154.729192,-5.900828],[154.514114,-5.139118],[154.652504,-5.042431],[154.759991,-5.339984],[155.062918,-5.566792],[155.547746,-6.200655],[156.019965,-6.540014],[155.880026,-6.819997]]],[[[151.982796,-5.478063],[151.459107,-5.56028],[151.30139,-5.840728],[150.754447,-6.083763],[150.241197,-6.317754],[149.709963,-6.316513],[148.890065,-6.02604],[148.318937,-5.747142],[148.401826,-5.437756],[149.298412,-5.583742],[149.845562,-5.505503],[149.99625,-5.026101],[150.139756,-5.001348],[150.236908,-5.53222],[150.807467,-5.455842],[151.089672,-5.113693],[151.647881,-4.757074],[151.537862,-4.167807],[152.136792,-4.14879],[152.338743,-4.312966],[152.318693,-4.867661],[151.982796,-5.478063]]],[[[147.191874,-7.388024],[148.084636,-8.044108],[148.734105,-9.104664],[149.306835,-9.071436],[149.266631,-9.514406],[150.038728,-9.684318],[149.738798,-9.872937],[150.801628,-10.293687],[150.690575,-10.582713],[150.028393,-10.652476],[149.78231,-10.393267],[148.923138,-10.280923],[147.913018,-10.130441],[147.135443,-9.492444],[146.567881,-8.942555],[146.048481,-8.067414],[144.744168,-7.630128],[143.897088,-7.91533],[143.286376,-8.245491],[143.413913,-8.983069],[142.628431,-9.326821],[142.068259,-9.159596],[141.033852,-9.117893],[141.017057,-5.859022],[141.00021,-2.600151],[142.735247,-3.289153],[144.583971,-3.861418],[145.27318,-4.373738],[145.829786,-4.876498],[145.981922,-5.465609],[147.648073,-6.083659],[147.891108,-6.614015],[146.970905,-6.721657],[147.191874,-7.388024]]],[[[153.140038,-4.499983],[152.827292,-4.766427],[152.638673,-4.176127],[152.406026,-3.789743],[151.953237,-3.462062],[151.384279,-3.035422],[150.66205,-2.741486],[150.939965,-2.500002],[151.479984,-2.779985],[151.820015,-2.999972],[152.239989,-3.240009],[152.640017,-3.659983],[153.019994,-3.980015],[153.140038,-4.499983]]]]}},\n{\"type\":\"Feature\",\"id\":\"POL\",\"properties\":{\"name\":\"Poland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[15.016996,51.106674],[14.607098,51.745188],[14.685026,52.089947],[14.4376,52.62485],[14.074521,52.981263],[14.353315,53.248171],[14.119686,53.757029],[14.8029,54.050706],[16.363477,54.513159],[17.622832,54.851536],[18.620859,54.682606],[18.696255,54.438719],[19.66064,54.426084],[20.892245,54.312525],[22.731099,54.327537],[23.243987,54.220567],[23.484128,53.912498],[23.527536,53.470122],[23.804935,53.089731],[23.799199,52.691099],[23.199494,52.486977],[23.508002,52.023647],[23.527071,51.578454],[24.029986,50.705407],[23.922757,50.424881],[23.426508,50.308506],[22.51845,49.476774],[22.776419,49.027395],[22.558138,49.085738],[21.607808,49.470107],[20.887955,49.328772],[20.415839,49.431453],[19.825023,49.217125],[19.320713,49.571574],[18.909575,49.435846],[18.853144,49.49623],[18.392914,49.988629],[17.649445,50.049038],[17.554567,50.362146],[16.868769,50.473974],[16.719476,50.215747],[16.176253,50.422607],[16.238627,50.697733],[15.490972,50.78473],[15.016996,51.106674]]]}},\n{\"type\":\"Feature\",\"id\":\"PRI\",\"properties\":{\"name\":\"Puerto Rico\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-66.282434,18.514762],[-65.771303,18.426679],[-65.591004,18.228035],[-65.847164,17.975906],[-66.599934,17.981823],[-67.184162,17.946553],[-67.242428,18.37446],[-67.100679,18.520601],[-66.282434,18.514762]]]}},\n{\"type\":\"Feature\",\"id\":\"PRK\",\"properties\":{\"name\":\"North Korea\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[130.640016,42.395009],[130.780007,42.220007],[130.400031,42.280004],[129.965949,41.941368],[129.667362,41.601104],[129.705189,40.882828],[129.188115,40.661808],[129.0104,40.485436],[128.633368,40.189847],[127.967414,40.025413],[127.533436,39.75685],[127.50212,39.323931],[127.385434,39.213472],[127.783343,39.050898],[128.349716,38.612243],[128.205746,38.370397],[127.780035,38.304536],[127.073309,38.256115],[126.68372,37.804773],[126.237339,37.840378],[126.174759,37.749686],[125.689104,37.94001],[125.568439,37.752089],[125.27533,37.669071],[125.240087,37.857224],[124.981033,37.948821],[124.712161,38.108346],[124.985994,38.548474],[125.221949,38.665857],[125.132859,38.848559],[125.38659,39.387958],[125.321116,39.551385],[124.737482,39.660344],[124.265625,39.928493],[125.079942,40.569824],[126.182045,41.107336],[126.869083,41.816569],[127.343783,41.503152],[128.208433,41.466772],[128.052215,41.994285],[129.596669,42.424982],[129.994267,42.985387],[130.640016,42.395009]]]}},\n{\"type\":\"Feature\",\"id\":\"PRT\",\"properties\":{\"name\":\"Portugal\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-9.034818,41.880571],[-8.671946,42.134689],[-8.263857,42.280469],[-8.013175,41.790886],[-7.422513,41.792075],[-7.251309,41.918346],[-6.668606,41.883387],[-6.389088,41.381815],[-6.851127,41.111083],[-6.86402,40.330872],[-7.026413,40.184524],[-7.066592,39.711892],[-7.498632,39.629571],[-7.098037,39.030073],[-7.374092,38.373059],[-7.029281,38.075764],[-7.166508,37.803894],[-7.537105,37.428904],[-7.453726,37.097788],[-7.855613,36.838269],[-8.382816,36.97888],[-8.898857,36.868809],[-8.746101,37.651346],[-8.839998,38.266243],[-9.287464,38.358486],[-9.526571,38.737429],[-9.446989,39.392066],[-9.048305,39.755093],[-8.977353,40.159306],[-8.768684,40.760639],[-8.790853,41.184334],[-8.990789,41.543459],[-9.034818,41.880571]]]}},\n{\"type\":\"Feature\",\"id\":\"PRY\",\"properties\":{\"name\":\"Paraguay\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-62.685057,-22.249029],[-62.291179,-21.051635],[-62.265961,-20.513735],[-61.786326,-19.633737],[-60.043565,-19.342747],[-59.115042,-19.356906],[-58.183471,-19.868399],[-58.166392,-20.176701],[-57.870674,-20.732688],[-57.937156,-22.090176],[-56.88151,-22.282154],[-56.473317,-22.0863],[-55.797958,-22.35693],[-55.610683,-22.655619],[-55.517639,-23.571998],[-55.400747,-23.956935],[-55.027902,-24.001274],[-54.652834,-23.839578],[-54.29296,-24.021014],[-54.293476,-24.5708],[-54.428946,-25.162185],[-54.625291,-25.739255],[-54.788795,-26.621786],[-55.695846,-27.387837],[-56.486702,-27.548499],[-57.60976,-27.395899],[-58.618174,-27.123719],[-57.63366,-25.603657],[-57.777217,-25.16234],[-58.807128,-24.771459],[-60.028966,-24.032796],[-60.846565,-23.880713],[-62.685057,-22.249029]]]}},\n{\"type\":\"Feature\",\"id\":\"QAT\",\"properties\":{\"name\":\"Qatar\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[50.810108,24.754743],[50.743911,25.482424],[51.013352,26.006992],[51.286462,26.114582],[51.589079,25.801113],[51.6067,25.21567],[51.389608,24.627386],[51.112415,24.556331],[50.810108,24.754743]]]}},\n{\"type\":\"Feature\",\"id\":\"ROU\",\"properties\":{\"name\":\"Romania\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[22.710531,47.882194],[23.142236,48.096341],[23.760958,47.985598],[24.402056,47.981878],[24.866317,47.737526],[25.207743,47.891056],[25.945941,47.987149],[26.19745,48.220881],[26.619337,48.220726],[26.924176,48.123264],[27.233873,47.826771],[27.551166,47.405117],[28.12803,46.810476],[28.160018,46.371563],[28.054443,45.944586],[28.233554,45.488283],[28.679779,45.304031],[29.149725,45.464925],[29.603289,45.293308],[29.626543,45.035391],[29.141612,44.82021],[28.837858,44.913874],[28.558081,43.707462],[27.970107,43.812468],[27.2424,44.175986],[26.065159,43.943494],[25.569272,43.688445],[24.100679,43.741051],[23.332302,43.897011],[22.944832,43.823785],[22.65715,44.234923],[22.474008,44.409228],[22.705726,44.578003],[22.459022,44.702517],[22.145088,44.478422],[21.562023,44.768947],[21.483526,45.18117],[20.874313,45.416375],[20.762175,45.734573],[20.220192,46.127469],[21.021952,46.316088],[21.626515,46.994238],[22.099768,47.672439],[22.710531,47.882194]]]}},\n{\"type\":\"Feature\",\"id\":\"RUS\",\"properties\":{\"name\":\"Russia\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[143.648007,50.7476],[144.654148,48.976391],[143.173928,49.306551],[142.558668,47.861575],[143.533492,46.836728],[143.505277,46.137908],[142.747701,46.740765],[142.09203,45.966755],[141.906925,46.805929],[142.018443,47.780133],[141.904445,48.859189],[142.1358,49.615163],[142.179983,50.952342],[141.594076,51.935435],[141.682546,53.301966],[142.606934,53.762145],[142.209749,54.225476],[142.654786,54.365881],[142.914616,53.704578],[143.260848,52.74076],[143.235268,51.75666],[143.648007,50.7476]]],[[[22.731099,54.327537],[20.892245,54.312525],[19.66064,54.426084],[19.888481,54.86616],[21.268449,55.190482],[22.315724,55.015299],[22.757764,54.856574],[22.651052,54.582741],[22.731099,54.327537]]],[[[-175.01425,66.58435],[-174.33983,66.33556],[-174.57182,67.06219],[-171.85731,66.91308],[-169.89958,65.97724],[-170.89107,65.54139],[-172.53025,65.43791],[-172.555,64.46079],[-172.95533,64.25269],[-173.89184,64.2826],[-174.65392,64.63125],[-175.98353,64.92288],[-176.20716,65.35667],[-177.22266,65.52024],[-178.35993,65.39052],[-178.90332,65.74044],[-178.68611,66.11211],[-179.88377,65.87456],[-179.43268,65.40411],[-180,64.979709],[-180,68.963636],[-177.55,68.2],[-174.92825,67.20589],[-175.01425,66.58435]]],[[[180,70.832199],[178.903425,70.78114],[178.7253,71.0988],[180,71.515714],[180,70.832199]]],[[[-178.69378,70.89302],[-180,70.832199],[-180,71.515714],[-179.871875,71.55762],[-179.02433,71.55553],[-177.577945,71.26948],[-177.663575,71.13277],[-178.69378,70.89302]]],[[[143.60385,73.21244],[142.08763,73.20544],[140.038155,73.31692],[139.86312,73.36983],[140.81171,73.76506],[142.06207,73.85758],[143.48283,73.47525],[143.60385,73.21244]]],[[[150.73167,75.08406],[149.575925,74.68892],[147.977465,74.778355],[146.11919,75.17298],[146.358485,75.49682],[148.22223,75.345845],[150.73167,75.08406]]],[[[145.086285,75.562625],[144.3,74.82],[140.61381,74.84768],[138.95544,74.61148],[136.97439,75.26167],[137.51176,75.94917],[138.831075,76.13676],[141.471615,76.09289],[145.086285,75.562625]]],[[[57.535693,70.720464],[56.944979,70.632743],[53.677375,70.762658],[53.412017,71.206662],[51.601895,71.474759],[51.455754,72.014881],[52.478275,72.229442],[52.444169,72.774731],[54.427614,73.627548],[53.50829,73.749814],[55.902459,74.627486],[55.631933,75.081412],[57.868644,75.60939],[61.170044,76.251883],[64.498368,76.439055],[66.210977,76.809782],[68.15706,76.939697],[68.852211,76.544811],[68.180573,76.233642],[64.637326,75.737755],[61.583508,75.260885],[58.477082,74.309056],[56.986786,73.333044],[55.419336,72.371268],[55.622838,71.540595],[57.535693,70.720464]]],[[[106.97013,76.97419],[107.24,76.48],[108.1538,76.72335],[111.07726,76.71],[113.33151,76.22224],[114.13417,75.84764],[113.88539,75.32779],[112.77918,75.03186],[110.15125,74.47673],[109.4,74.18],[110.64,74.04],[112.11919,73.78774],[113.01954,73.97693],[113.52958,73.33505],[113.96881,73.59488],[115.56782,73.75285],[118.77633,73.58772],[119.02,73.12],[123.20066,72.97122],[123.25777,73.73503],[125.38,73.56],[126.97644,73.56549],[128.59126,73.03871],[129.05157,72.39872],[128.46,71.98],[129.71599,71.19304],[131.28858,70.78699],[132.2535,71.8363],[133.85766,71.38642],[135.56193,71.65525],[137.49755,71.34763],[138.23409,71.62803],[139.86983,71.48783],[139.14791,72.41619],[140.46817,72.84941],[149.5,72.2],[150.35118,71.60643],[152.9689,70.84222],[157.00688,71.03141],[158.99779,70.86672],[159.83031,70.45324],[159.70866,69.72198],[160.94053,69.43728],[162.27907,69.64204],[164.05248,69.66823],[165.94037,69.47199],[167.83567,69.58269],[169.57763,68.6938],[170.81688,69.01363],[170.0082,69.65276],[170.45345,70.09703],[173.64391,69.81743],[175.72403,69.87725],[178.6,69.4],[180,68.963636],[180,64.979709],[179.99281,64.97433],[178.7072,64.53493],[177.41128,64.60821],[178.313,64.07593],[178.90825,63.25197],[179.37034,62.98262],[179.48636,62.56894],[179.22825,62.3041],[177.3643,62.5219],[174.56929,61.76915],[173.68013,61.65261],[172.15,60.95],[170.6985,60.33618],[170.33085,59.88177],[168.90046,60.57355],[166.29498,59.78855],[165.84,60.16],[164.87674,59.7316],[163.53929,59.86871],[163.21711,59.21101],[162.01733,58.24328],[162.05297,57.83912],[163.19191,57.61503],[163.05794,56.15924],[162.12958,56.12219],[161.70146,55.28568],[162.11749,54.85514],[160.36877,54.34433],[160.02173,53.20257],[158.53094,52.95868],[158.23118,51.94269],[156.78979,51.01105],[156.42,51.7],[155.99182,53.15895],[155.43366,55.38103],[155.91442,56.76792],[156.75815,57.3647],[156.81035,57.83204],[158.36433,58.05575],[160.15064,59.31477],[161.87204,60.343],[163.66969,61.1409],[164.47355,62.55061],[163.25842,62.46627],[162.65791,61.6425],[160.12148,60.54423],[159.30232,61.77396],[156.72068,61.43442],[154.21806,59.75818],[155.04375,59.14495],[152.81185,58.88385],[151.26573,58.78089],[151.33815,59.50396],[149.78371,59.65573],[148.54481,59.16448],[145.48722,59.33637],[142.19782,59.03998],[138.95848,57.08805],[135.12619,54.72959],[136.70171,54.60355],[137.19342,53.97732],[138.1647,53.75501],[138.80463,54.25455],[139.90151,54.18968],[141.34531,53.08957],[141.37923,52.23877],[140.59742,51.23967],[140.51308,50.04553],[140.06193,48.44671],[138.55472,46.99965],[138.21971,46.30795],[136.86232,45.1435],[135.51535,43.989],[134.86939,43.39821],[133.53687,42.81147],[132.90627,42.79849],[132.27807,43.28456],[130.93587,42.55274],[130.78,42.22],[130.64,42.395],[130.633866,42.903015],[131.144688,42.92999],[131.288555,44.11152],[131.02519,44.96796],[131.883454,45.321162],[133.09712,45.14409],[133.769644,46.116927],[134.11235,47.21248],[134.50081,47.57845],[135.026311,48.47823],[133.373596,48.183442],[132.50669,47.78896],[130.98726,47.79013],[130.582293,48.729687],[129.397818,49.4406],[127.6574,49.76027],[127.287456,50.739797],[126.939157,51.353894],[126.564399,51.784255],[125.946349,52.792799],[125.068211,53.161045],[123.57147,53.4588],[122.245748,53.431726],[121.003085,53.251401],[120.177089,52.753886],[120.725789,52.516226],[120.7382,51.96411],[120.18208,51.64355],[119.27939,50.58292],[119.288461,50.142883],[117.879244,49.510983],[116.678801,49.888531],[115.485695,49.805177],[114.96211,50.140247],[114.362456,50.248303],[112.89774,49.543565],[111.581231,49.377968],[110.662011,49.130128],[109.402449,49.292961],[108.475167,49.282548],[107.868176,49.793705],[106.888804,50.274296],[105.886591,50.406019],[104.62158,50.27532],[103.676545,50.089966],[102.25589,50.51056],[102.06521,51.25991],[100.88948,51.516856],[99.981732,51.634006],[98.861491,52.047366],[97.82574,51.010995],[98.231762,50.422401],[97.25976,49.72605],[95.81402,49.97746],[94.815949,50.013433],[94.147566,50.480537],[93.10421,50.49529],[92.234712,50.802171],[90.713667,50.331812],[88.805567,49.470521],[87.751264,49.297198],[87.35997,49.214981],[86.829357,49.826675],[85.54127,49.692859],[85.11556,50.117303],[84.416377,50.3114],[83.935115,50.889246],[83.383004,51.069183],[81.945986,50.812196],[80.568447,51.388336],[80.03556,50.864751],[77.800916,53.404415],[76.525179,54.177003],[76.8911,54.490524],[74.38482,53.54685],[73.425679,53.48981],[73.508516,54.035617],[72.22415,54.376655],[71.180131,54.133285],[70.865267,55.169734],[69.068167,55.38525],[68.1691,54.970392],[65.66687,54.60125],[65.178534,54.354228],[61.4366,54.00625],[60.978066,53.664993],[61.699986,52.979996],[60.739993,52.719986],[60.927269,52.447548],[59.967534,51.96042],[61.588003,51.272659],[61.337424,50.79907],[59.932807,50.842194],[59.642282,50.545442],[58.36332,51.06364],[56.77798,51.04355],[55.71694,50.62171],[54.532878,51.02624],[52.328724,51.718652],[50.766648,51.692762],[48.702382,50.605128],[48.577841,49.87476],[47.54948,50.454698],[46.751596,49.356006],[47.043672,49.152039],[46.466446,48.394152],[47.31524,47.71585],[48.05725,47.74377],[48.694734,47.075628],[48.59325,46.56104],[49.10116,46.39933],[48.64541,45.80629],[47.67591,45.64149],[46.68201,44.6092],[47.59094,43.66016],[47.49252,42.98658],[48.58437,41.80888],[47.987283,41.405819],[47.815666,41.151416],[47.373315,41.219732],[46.686071,41.827137],[46.404951,41.860675],[45.7764,42.09244],[45.470279,42.502781],[44.537623,42.711993],[43.93121,42.55496],[43.75599,42.74083],[42.3944,43.2203],[40.92219,43.38215],[40.076965,43.553104],[39.955009,43.434998],[38.68,44.28],[37.53912,44.65721],[36.67546,45.24469],[37.40317,45.40451],[38.23295,46.24087],[37.67372,46.63657],[39.14767,47.04475],[39.1212,47.26336],[38.223538,47.10219],[38.255112,47.5464],[38.77057,47.82562],[39.738278,47.898937],[39.89562,48.23241],[39.67465,48.78382],[40.080789,49.30743],[40.06904,49.60105],[38.594988,49.926462],[38.010631,49.915662],[37.39346,50.383953],[36.626168,50.225591],[35.356116,50.577197],[35.37791,50.77394],[35.022183,51.207572],[34.224816,51.255993],[34.141978,51.566413],[34.391731,51.768882],[33.7527,52.335075],[32.715761,52.238465],[32.412058,52.288695],[32.15944,52.06125],[31.78597,52.10168],[31.540018,52.742052],[31.305201,53.073996],[31.49764,53.16743],[32.304519,53.132726],[32.693643,53.351421],[32.405599,53.618045],[31.731273,53.794029],[31.791424,53.974639],[31.384472,54.157056],[30.757534,54.811771],[30.971836,55.081548],[30.873909,55.550976],[29.896294,55.789463],[29.371572,55.670091],[29.229513,55.918344],[28.176709,56.16913],[27.855282,56.759326],[27.770016,57.244258],[27.288185,57.474528],[27.716686,57.791899],[27.42015,58.72457],[28.131699,59.300825],[27.98112,59.47537],[29.1177,60.02805],[28.07,60.50352],[30.211107,61.780028],[31.139991,62.357693],[31.516092,62.867687],[30.035872,63.552814],[30.444685,64.204453],[29.54443,64.948672],[30.21765,65.80598],[29.054589,66.944286],[29.977426,67.698297],[28.445944,68.364613],[28.59193,69.064777],[29.39955,69.15692],[31.10108,69.55811],[32.13272,69.90595],[33.77547,69.30142],[36.51396,69.06342],[40.29234,67.9324],[41.05987,67.45713],[41.12595,66.79158],[40.01583,66.26618],[38.38295,65.99953],[33.91871,66.75961],[33.18444,66.63253],[34.81477,65.90015],[34.878574,65.436213],[34.94391,64.41437],[36.23129,64.10945],[37.01273,63.84983],[37.14197,64.33471],[36.539579,64.76446],[37.17604,65.14322],[39.59345,64.52079],[40.4356,64.76446],[39.7626,65.49682],[42.09309,66.47623],[43.01604,66.41858],[43.94975,66.06908],[44.53226,66.75634],[43.69839,67.35245],[44.18795,67.95051],[43.45282,68.57079],[46.25,68.25],[46.82134,67.68997],[45.55517,67.56652],[45.56202,67.01005],[46.34915,66.66767],[47.89416,66.88455],[48.13876,67.52238],[50.22766,67.99867],[53.71743,68.85738],[54.47171,68.80815],[53.48582,68.20131],[54.72628,68.09702],[55.44268,68.43866],[57.31702,68.46628],[58.802,68.88082],[59.94142,68.27844],[61.07784,68.94069],[60.03,69.52],[60.55,69.85],[63.504,69.54739],[64.888115,69.234835],[68.51216,68.09233],[69.18068,68.61563],[68.16444,69.14436],[68.13522,69.35649],[66.93008,69.45461],[67.25976,69.92873],[66.72492,70.70889],[66.69466,71.02897],[68.54006,71.9345],[69.19636,72.84336],[69.94,73.04],[72.58754,72.77629],[72.79603,72.22006],[71.84811,71.40898],[72.47011,71.09019],[72.79188,70.39114],[72.5647,69.02085],[73.66787,68.4079],[73.2387,67.7404],[71.28,66.32],[72.42301,66.17267],[72.82077,66.53267],[73.92099,66.78946],[74.18651,67.28429],[75.052,67.76047],[74.46926,68.32899],[74.93584,68.98918],[73.84236,69.07146],[73.60187,69.62763],[74.3998,70.63175],[73.1011,71.44717],[74.89082,72.12119],[74.65926,72.83227],[75.15801,72.85497],[75.68351,72.30056],[75.28898,71.33556],[76.35911,71.15287],[75.90313,71.87401],[77.57665,72.26717],[79.65202,72.32011],[81.5,71.75],[80.61071,72.58285],[80.51109,73.6482],[82.25,73.85],[84.65526,73.80591],[86.8223,73.93688],[86.00956,74.45967],[87.16682,75.11643],[88.31571,75.14393],[90.26,75.64],[92.90058,75.77333],[93.23421,76.0472],[95.86,76.14],[96.67821,75.91548],[98.92254,76.44689],[100.75967,76.43028],[101.03532,76.86189],[101.99084,77.28754],[104.3516,77.69792],[106.06664,77.37389],[104.705,77.1274],[106.97013,76.97419]]],[[[105.07547,78.30689],[99.43814,77.921],[101.2649,79.23399],[102.08635,79.34641],[102.837815,79.28129],[105.37243,78.71334],[105.07547,78.30689]]],[[[51.136187,80.54728],[49.793685,80.415428],[48.894411,80.339567],[48.754937,80.175468],[47.586119,80.010181],[46.502826,80.247247],[47.072455,80.559424],[44.846958,80.58981],[46.799139,80.771918],[48.318477,80.78401],[48.522806,80.514569],[49.09719,80.753986],[50.039768,80.918885],[51.522933,80.699726],[51.136187,80.54728]]],[[[99.93976,78.88094],[97.75794,78.7562],[94.97259,79.044745],[93.31288,79.4265],[92.5454,80.14379],[91.18107,80.34146],[93.77766,81.0246],[95.940895,81.2504],[97.88385,80.746975],[100.186655,79.780135],[99.93976,78.88094]]]]}},\n{\"type\":\"Feature\",\"id\":\"RWA\",\"properties\":{\"name\":\"Rwanda\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[30.419105,-1.134659],[30.816135,-1.698914],[30.758309,-2.28725],[30.469696,-2.413858],[29.938359,-2.348487],[29.632176,-2.917858],[29.024926,-2.839258],[29.117479,-2.292211],[29.254835,-2.21511],[29.291887,-1.620056],[29.579466,-1.341313],[29.821519,-1.443322],[30.419105,-1.134659]]]}},\n{\"type\":\"Feature\",\"id\":\"ESH\",\"properties\":{\"name\":\"Western Sahara\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-8.794884,27.120696],[-8.817828,27.656426],[-8.66559,27.656426],[-8.665124,27.589479],[-8.6844,27.395744],[-8.687294,25.881056],[-11.969419,25.933353],[-11.937224,23.374594],[-12.874222,23.284832],[-13.118754,22.77122],[-12.929102,21.327071],[-16.845194,21.333323],[-17.063423,20.999752],[-17.020428,21.42231],[-17.002962,21.420734],[-14.750955,21.5006],[-14.630833,21.86094],[-14.221168,22.310163],[-13.89111,23.691009],[-12.500963,24.770116],[-12.030759,26.030866],[-11.71822,26.104092],[-11.392555,26.883424],[-10.551263,26.990808],[-10.189424,26.860945],[-9.735343,26.860945],[-9.413037,27.088476],[-8.794884,27.120696]]]}},\n{\"type\":\"Feature\",\"id\":\"SAU\",\"properties\":{\"name\":\"Saudi Arabia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[42.779332,16.347891],[42.649573,16.774635],[42.347989,17.075806],[42.270888,17.474722],[41.754382,17.833046],[41.221391,18.6716],[40.939341,19.486485],[40.247652,20.174635],[39.801685,20.338862],[39.139399,21.291905],[39.023696,21.986875],[39.066329,22.579656],[38.492772,23.688451],[38.02386,24.078686],[37.483635,24.285495],[37.154818,24.858483],[37.209491,25.084542],[36.931627,25.602959],[36.639604,25.826228],[36.249137,26.570136],[35.640182,27.37652],[35.130187,28.063352],[34.632336,28.058546],[34.787779,28.607427],[34.83222,28.957483],[34.956037,29.356555],[36.068941,29.197495],[36.501214,29.505254],[36.740528,29.865283],[37.503582,30.003776],[37.66812,30.338665],[37.998849,30.5085],[37.002166,31.508413],[39.004886,32.010217],[39.195468,32.161009],[40.399994,31.889992],[41.889981,31.190009],[44.709499,29.178891],[46.568713,29.099025],[47.459822,29.002519],[47.708851,28.526063],[48.416094,28.552004],[48.807595,27.689628],[49.299554,27.461218],[49.470914,27.109999],[50.152422,26.689663],[50.212935,26.277027],[50.113303,25.943972],[50.239859,25.60805],[50.527387,25.327808],[50.660557,24.999896],[50.810108,24.754743],[51.112415,24.556331],[51.389608,24.627386],[51.579519,24.245497],[51.617708,24.014219],[52.000733,23.001154],[55.006803,22.496948],[55.208341,22.70833],[55.666659,22.000001],[54.999982,19.999994],[52.00001,19.000003],[49.116672,18.616668],[48.183344,18.166669],[47.466695,17.116682],[47.000005,16.949999],[46.749994,17.283338],[46.366659,17.233315],[45.399999,17.333335],[45.216651,17.433329],[44.062613,17.410359],[43.791519,17.319977],[43.380794,17.579987],[43.115798,17.08844],[43.218375,16.66689],[42.779332,16.347891]]]}},\n{\"type\":\"Feature\",\"id\":\"SDN\",\"properties\":{\"name\":\"Sudan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[33.963393,9.464285],[33.824963,9.484061],[33.842131,9.981915],[33.721959,10.325262],[33.206938,10.720112],[33.086766,11.441141],[33.206938,12.179338],[32.743419,12.248008],[32.67475,12.024832],[32.073892,11.97333],[32.314235,11.681484],[32.400072,11.080626],[31.850716,10.531271],[31.352862,9.810241],[30.837841,9.707237],[29.996639,10.290927],[29.618957,10.084919],[29.515953,9.793074],[29.000932,9.604232],[28.966597,9.398224],[27.97089,9.398224],[27.833551,9.604232],[27.112521,9.638567],[26.752006,9.466893],[26.477328,9.55273],[25.962307,10.136421],[25.790633,10.411099],[25.069604,10.27376],[24.794926,9.810241],[24.537415,8.917538],[24.194068,8.728696],[23.88698,8.61973],[23.805813,8.666319],[23.459013,8.954286],[23.394779,9.265068],[23.55725,9.681218],[23.554304,10.089255],[22.977544,10.714463],[22.864165,11.142395],[22.87622,11.38461],[22.50869,11.67936],[22.49762,12.26024],[22.28801,12.64605],[21.93681,12.58818],[22.03759,12.95546],[22.29658,13.37232],[22.18329,13.78648],[22.51202,14.09318],[22.30351,14.32682],[22.56795,14.94429],[23.02459,15.68072],[23.88689,15.61084],[23.83766,19.58047],[23.85,20],[25,20.00304],[25,22],[29.02,22],[32.9,22],[36.86623,22],[37.18872,21.01885],[36.96941,20.83744],[37.1147,19.80796],[37.48179,18.61409],[37.86276,18.36786],[38.41009,17.998307],[37.904,17.42754],[37.16747,17.26314],[36.85253,16.95655],[36.75389,16.29186],[36.32322,14.82249],[36.42951,14.42211],[36.27022,13.56333],[35.86363,12.57828],[35.26049,12.08286],[34.83163,11.31896],[34.73115,10.91017],[34.25745,10.63009],[33.96162,9.58358],[33.963393,9.464285]]]}},\n{\"type\":\"Feature\",\"id\":\"SSD\",\"properties\":{\"name\":\"South Sudan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[33.963393,9.464285],[33.97498,8.68456],[33.8255,8.37916],[33.2948,8.35458],[32.95418,7.78497],[33.56829,7.71334],[34.0751,7.22595],[34.25032,6.82607],[34.70702,6.59422],[35.298007,5.506],[34.620196,4.847123],[34.005,4.249885],[33.39,3.79],[32.68642,3.79232],[31.88145,3.55827],[31.24556,3.7819],[30.83385,3.50917],[29.95349,4.1737],[29.715995,4.600805],[29.159078,4.389267],[28.696678,4.455077],[28.428994,4.287155],[27.979977,4.408413],[27.374226,5.233944],[27.213409,5.550953],[26.465909,5.946717],[26.213418,6.546603],[25.796648,6.979316],[25.124131,7.500085],[25.114932,7.825104],[24.567369,8.229188],[23.88698,8.61973],[24.194068,8.728696],[24.537415,8.917538],[24.794926,9.810241],[25.069604,10.27376],[25.790633,10.411099],[25.962307,10.136421],[26.477328,9.55273],[26.752006,9.466893],[27.112521,9.638567],[27.833551,9.604232],[27.97089,9.398224],[28.966597,9.398224],[29.000932,9.604232],[29.515953,9.793074],[29.618957,10.084919],[29.996639,10.290927],[30.837841,9.707237],[31.352862,9.810241],[31.850716,10.531271],[32.400072,11.080626],[32.314235,11.681484],[32.073892,11.97333],[32.67475,12.024832],[32.743419,12.248008],[33.206938,12.179338],[33.086766,11.441141],[33.206938,10.720112],[33.721959,10.325262],[33.842131,9.981915],[33.824963,9.484061],[33.963393,9.464285]]]}},\n{\"type\":\"Feature\",\"id\":\"SEN\",\"properties\":{\"name\":\"Senegal\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-16.713729,13.594959],[-17.126107,14.373516],[-17.625043,14.729541],[-17.185173,14.919477],[-16.700706,15.621527],[-16.463098,16.135036],[-16.12069,16.455663],[-15.623666,16.369337],[-15.135737,16.587282],[-14.577348,16.598264],[-14.099521,16.304302],[-13.435738,16.039383],[-12.830658,15.303692],[-12.17075,14.616834],[-12.124887,13.994727],[-11.927716,13.422075],[-11.553398,13.141214],[-11.467899,12.754519],[-11.513943,12.442988],[-11.658301,12.386583],[-12.203565,12.465648],[-12.278599,12.35444],[-12.499051,12.33209],[-13.217818,12.575874],[-13.700476,12.586183],[-15.548477,12.62817],[-15.816574,12.515567],[-16.147717,12.547762],[-16.677452,12.384852],[-16.841525,13.151394],[-15.931296,13.130284],[-15.691001,13.270353],[-15.511813,13.27857],[-15.141163,13.509512],[-14.712197,13.298207],[-14.277702,13.280585],[-13.844963,13.505042],[-14.046992,13.794068],[-14.376714,13.62568],[-14.687031,13.630357],[-15.081735,13.876492],[-15.39877,13.860369],[-15.624596,13.623587],[-16.713729,13.594959]]]}},\n{\"type\":\"Feature\",\"id\":\"SLB\",\"properties\":{\"name\":\"Solomon Islands\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[162.119025,-10.482719],[162.398646,-10.826367],[161.700032,-10.820011],[161.319797,-10.204751],[161.917383,-10.446701],[162.119025,-10.482719]]],[[[160.852229,-9.872937],[160.462588,-9.89521],[159.849447,-9.794027],[159.640003,-9.63998],[159.702945,-9.24295],[160.362956,-9.400304],[160.688518,-9.610162],[160.852229,-9.872937]]],[[[161.679982,-9.599982],[161.529397,-9.784312],[160.788253,-8.917543],[160.579997,-8.320009],[160.920028,-8.320009],[161.280006,-9.120011],[161.679982,-9.599982]]],[[[159.875027,-8.33732],[159.917402,-8.53829],[159.133677,-8.114181],[158.586114,-7.754824],[158.21115,-7.421872],[158.359978,-7.320018],[158.820001,-7.560003],[159.640003,-8.020027],[159.875027,-8.33732]]],[[[157.538426,-7.34782],[157.33942,-7.404767],[156.90203,-7.176874],[156.491358,-6.765943],[156.542828,-6.599338],[157.14,-7.021638],[157.538426,-7.34782]]]]}},\n{\"type\":\"Feature\",\"id\":\"SLE\",\"properties\":{\"name\":\"Sierra Leone\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-11.438779,6.785917],[-11.708195,6.860098],[-12.428099,7.262942],[-12.949049,7.798646],[-13.124025,8.163946],[-13.24655,8.903049],[-12.711958,9.342712],[-12.596719,9.620188],[-12.425929,9.835834],[-12.150338,9.858572],[-11.917277,10.046984],[-11.117481,10.045873],[-10.839152,9.688246],[-10.622395,9.26791],[-10.65477,8.977178],[-10.494315,8.715541],[-10.505477,8.348896],[-10.230094,8.406206],[-10.695595,7.939464],[-11.146704,7.396706],[-11.199802,7.105846],[-11.438779,6.785917]]]}},\n{\"type\":\"Feature\",\"id\":\"SLV\",\"properties\":{\"name\":\"El Salvador\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-87.793111,13.38448],[-87.904112,13.149017],[-88.483302,13.163951],[-88.843228,13.259734],[-89.256743,13.458533],[-89.812394,13.520622],[-90.095555,13.735338],[-90.064678,13.88197],[-89.721934,14.134228],[-89.534219,14.244816],[-89.587343,14.362586],[-89.353326,14.424133],[-89.058512,14.340029],[-88.843073,14.140507],[-88.541231,13.980155],[-88.503998,13.845486],[-88.065343,13.964626],[-87.859515,13.893312],[-87.723503,13.78505],[-87.793111,13.38448]]]}},\n{\"type\":\"Feature\",\"id\":\"-99\",\"properties\":{\"name\":\"Somaliland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[48.93813,9.451749],[48.486736,8.837626],[47.78942,8.003],[46.948328,7.996877],[43.67875,9.18358],[43.296975,9.540477],[42.92812,10.02194],[42.55876,10.57258],[42.776852,10.926879],[43.145305,11.46204],[43.47066,11.27771],[43.666668,10.864169],[44.117804,10.445538],[44.614259,10.442205],[45.556941,10.698029],[46.645401,10.816549],[47.525658,11.127228],[48.021596,11.193064],[48.378784,11.375482],[48.948206,11.410622],[48.942005,11.394266],[48.938491,10.982327],[48.938233,9.9735],[48.93813,9.451749]]]}},\n{\"type\":\"Feature\",\"id\":\"SOM\",\"properties\":{\"name\":\"Somalia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[49.72862,11.5789],[50.25878,11.67957],[50.73202,12.0219],[51.1112,12.02464],[51.13387,11.74815],[51.04153,11.16651],[51.04531,10.6409],[50.83418,10.27972],[50.55239,9.19874],[50.07092,8.08173],[49.4527,6.80466],[48.59455,5.33911],[47.74079,4.2194],[46.56476,2.85529],[45.56399,2.04576],[44.06815,1.05283],[43.13597,0.2922],[42.04157,-0.91916],[41.81095,-1.44647],[41.58513,-1.68325],[40.993,-0.85829],[40.98105,2.78452],[41.855083,3.918912],[42.12861,4.23413],[42.76967,4.25259],[43.66087,4.95755],[44.9636,5.00162],[47.78942,8.003],[48.486736,8.837626],[48.93813,9.451749],[48.938233,9.9735],[48.938491,10.982327],[48.942005,11.394266],[48.948205,11.410617],[49.26776,11.43033],[49.72862,11.5789]]]}},\n{\"type\":\"Feature\",\"id\":\"SRB\",\"properties\":{\"name\":\"Republic of Serbia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[20.874313,45.416375],[21.483526,45.18117],[21.562023,44.768947],[22.145088,44.478422],[22.459022,44.702517],[22.705726,44.578003],[22.474008,44.409228],[22.65715,44.234923],[22.410446,44.008063],[22.500157,43.642814],[22.986019,43.211161],[22.604801,42.898519],[22.436595,42.580321],[22.545012,42.461362],[22.380526,42.32026],[21.91708,42.30364],[21.576636,42.245224],[21.54332,42.32025],[21.66292,42.43922],[21.77505,42.6827],[21.63302,42.67717],[21.43866,42.86255],[21.27421,42.90959],[21.143395,43.068685],[20.95651,43.13094],[20.81448,43.27205],[20.63508,43.21671],[20.49679,42.88469],[20.25758,42.81275],[20.3398,42.89852],[19.95857,43.10604],[19.63,43.21378],[19.48389,43.35229],[19.21852,43.52384],[19.454,43.5681],[19.59976,44.03847],[19.11761,44.42307],[19.36803,44.863],[19.00548,44.86023],[19.390476,45.236516],[19.072769,45.521511],[18.82982,45.90888],[19.596045,46.17173],[20.220192,46.127469],[20.762175,45.734573],[20.874313,45.416375]]]}},\n{\"type\":\"Feature\",\"id\":\"SUR\",\"properties\":{\"name\":\"Suriname\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-57.147436,5.97315],[-55.949318,5.772878],[-55.84178,5.953125],[-55.03325,6.025291],[-53.958045,5.756548],[-54.478633,4.896756],[-54.399542,4.212611],[-54.006931,3.620038],[-54.181726,3.18978],[-54.269705,2.732392],[-54.524754,2.311849],[-55.097587,2.523748],[-55.569755,2.421506],[-55.973322,2.510364],[-56.073342,2.220795],[-55.9056,2.021996],[-55.995698,1.817667],[-56.539386,1.899523],[-57.150098,2.768927],[-57.281433,3.333492],[-57.601569,3.334655],[-58.044694,4.060864],[-57.86021,4.576801],[-57.914289,4.812626],[-57.307246,5.073567],[-57.147436,5.97315]]]}},\n{\"type\":\"Feature\",\"id\":\"SVK\",\"properties\":{\"name\":\"Slovakia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[18.853144,49.49623],[18.909575,49.435846],[19.320713,49.571574],[19.825023,49.217125],[20.415839,49.431453],[20.887955,49.328772],[21.607808,49.470107],[22.558138,49.085738],[22.280842,48.825392],[22.085608,48.422264],[21.872236,48.319971],[20.801294,48.623854],[20.473562,48.56285],[20.239054,48.327567],[19.769471,48.202691],[19.661364,48.266615],[19.174365,48.111379],[18.777025,48.081768],[18.696513,47.880954],[17.857133,47.758429],[17.488473,47.867466],[16.979667,48.123497],[16.879983,48.470013],[16.960288,48.596982],[17.101985,48.816969],[17.545007,48.800019],[17.886485,48.903475],[17.913512,48.996493],[18.104973,49.043983],[18.170498,49.271515],[18.399994,49.315001],[18.554971,49.495015],[18.853144,49.49623]]]}},\n{\"type\":\"Feature\",\"id\":\"SVN\",\"properties\":{\"name\":\"Slovenia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[13.806475,46.509306],[14.632472,46.431817],[15.137092,46.658703],[16.011664,46.683611],[16.202298,46.852386],[16.370505,46.841327],[16.564808,46.503751],[15.768733,46.238108],[15.67153,45.834154],[15.323954,45.731783],[15.327675,45.452316],[14.935244,45.471695],[14.595109,45.634941],[14.411968,45.466166],[13.71506,45.500324],[13.93763,45.591016],[13.69811,46.016778],[13.806475,46.509306]]]}},\n{\"type\":\"Feature\",\"id\":\"SWE\",\"properties\":{\"name\":\"Sweden\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[22.183173,65.723741],[21.213517,65.026005],[21.369631,64.413588],[19.778876,63.609554],[17.847779,62.7494],[17.119555,61.341166],[17.831346,60.636583],[18.787722,60.081914],[17.869225,58.953766],[16.829185,58.719827],[16.44771,57.041118],[15.879786,56.104302],[14.666681,56.200885],[14.100721,55.407781],[12.942911,55.361737],[12.625101,56.30708],[11.787942,57.441817],[11.027369,58.856149],[11.468272,59.432393],[12.300366,60.117933],[12.631147,61.293572],[11.992064,61.800362],[11.930569,63.128318],[12.579935,64.066219],[13.571916,64.049114],[13.919905,64.445421],[13.55569,64.787028],[15.108411,66.193867],[16.108712,67.302456],[16.768879,68.013937],[17.729182,68.010552],[17.993868,68.567391],[19.87856,68.407194],[20.025269,69.065139],[20.645593,69.106247],[21.978535,68.616846],[23.539473,67.936009],[23.56588,66.396051],[23.903379,66.006927],[22.183173,65.723741]]],[[[17.061767,57.385783],[17.210083,57.326521],[16.430053,56.179196],[16.364135,56.556455],[17.061767,57.385783]]],[[[19.357910,57.958588],[18.803100,57.651279],[18.825073,57.444949],[18.995361,57.441993],[18.951416,57.370976],[18.693237,57.305756],[18.709716,57.204734],[18.462524,57.127295],[18.319702,56.926992],[18.105468,56.891003],[18.187866,57.109402],[18.072509,57.267163],[18.154907,57.394664],[18.094482,57.545312],[18.660278,57.929434],[19.039306,57.941098],[19.105224,57.993543],[19.374389,57.996454],[19.357910,57.958588]]],[[[20.846557,63.823710],[21.066284,63.829768],[20.972900,63.715670],[20.824584,63.579121],[20.695495,63.591340],[20.819091,63.714454],[20.799865,63.780059],[20.846557,63.823710]]]]}},\n{\"type\":\"Feature\",\"id\":\"SWZ\",\"properties\":{\"name\":\"Swaziland\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[32.071665,-26.73382],[31.86806,-27.177927],[31.282773,-27.285879],[30.685962,-26.743845],[30.676609,-26.398078],[30.949667,-26.022649],[31.04408,-25.731452],[31.333158,-25.660191],[31.837778,-25.843332],[31.985779,-26.29178],[32.071665,-26.73382]]]}},\n{\"type\":\"Feature\",\"id\":\"SYR\",\"properties\":{\"name\":\"Syria\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[38.792341,33.378686],[36.834062,32.312938],[35.719918,32.709192],[35.700798,32.716014],[35.836397,32.868123],[35.821101,33.277426],[36.06646,33.824912],[36.61175,34.201789],[36.448194,34.593935],[35.998403,34.644914],[35.905023,35.410009],[36.149763,35.821535],[36.41755,36.040617],[36.685389,36.259699],[36.739494,36.81752],[37.066761,36.623036],[38.167727,36.90121],[38.699891,36.712927],[39.52258,36.716054],[40.673259,37.091276],[41.212089,37.074352],[42.349591,37.229873],[41.837064,36.605854],[41.289707,36.358815],[41.383965,35.628317],[41.006159,34.419372],[38.792341,33.378686]]]}},\n{\"type\":\"Feature\",\"id\":\"TCD\",\"properties\":{\"name\":\"Chad\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[14.495787,12.859396],[14.595781,13.330427],[13.954477,13.353449],[13.956699,13.996691],[13.540394,14.367134],[13.97217,15.68437],[15.247731,16.627306],[15.300441,17.92795],[15.685741,19.95718],[15.903247,20.387619],[15.487148,20.730415],[15.47106,21.04845],[15.096888,21.308519],[14.8513,22.86295],[15.86085,23.40972],[19.84926,21.49509],[23.83766,19.58047],[23.88689,15.61084],[23.02459,15.68072],[22.56795,14.94429],[22.30351,14.32682],[22.51202,14.09318],[22.18329,13.78648],[22.29658,13.37232],[22.03759,12.95546],[21.93681,12.58818],[22.28801,12.64605],[22.49762,12.26024],[22.50869,11.67936],[22.87622,11.38461],[22.864165,11.142395],[22.231129,10.971889],[21.723822,10.567056],[21.000868,9.475985],[20.059685,9.012706],[19.094008,9.074847],[18.81201,8.982915],[18.911022,8.630895],[18.389555,8.281304],[17.96493,7.890914],[16.705988,7.508328],[16.456185,7.734774],[16.290562,7.754307],[16.106232,7.497088],[15.27946,7.421925],[15.436092,7.692812],[15.120866,8.38215],[14.979996,8.796104],[14.544467,8.965861],[13.954218,9.549495],[14.171466,10.021378],[14.627201,9.920919],[14.909354,9.992129],[15.467873,9.982337],[14.923565,10.891325],[14.960152,11.555574],[14.89336,12.21905],[14.495787,12.859396]]]}},\n{\"type\":\"Feature\",\"id\":\"TGO\",\"properties\":{\"name\":\"Togo\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[1.865241,6.142158],[1.060122,5.928837],[0.836931,6.279979],[0.570384,6.914359],[0.490957,7.411744],[0.712029,8.312465],[0.461192,8.677223],[0.365901,9.465004],[0.36758,10.191213],[-0.049785,10.706918],[0.023803,11.018682],[0.899563,10.997339],[0.772336,10.470808],[1.077795,10.175607],[1.425061,9.825395],[1.463043,9.334624],[1.664478,9.12859],[1.618951,6.832038],[1.865241,6.142158]]]}},\n{\"type\":\"Feature\",\"id\":\"THA\",\"properties\":{\"name\":\"Thailand\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[102.584932,12.186595],[101.687158,12.64574],[100.83181,12.627085],[100.978467,13.412722],[100.097797,13.406856],[100.018733,12.307001],[99.478921,10.846367],[99.153772,9.963061],[99.222399,9.239255],[99.873832,9.207862],[100.279647,8.295153],[100.459274,7.429573],[101.017328,6.856869],[101.623079,6.740622],[102.141187,6.221636],[101.814282,5.810808],[101.154219,5.691384],[101.075516,6.204867],[100.259596,6.642825],[100.085757,6.464489],[99.690691,6.848213],[99.519642,7.343454],[98.988253,7.907993],[98.503786,8.382305],[98.339662,7.794512],[98.150009,8.350007],[98.25915,8.973923],[98.553551,9.93296],[99.038121,10.960546],[99.587286,11.892763],[99.196354,12.804748],[99.212012,13.269294],[99.097755,13.827503],[98.430819,14.622028],[98.192074,15.123703],[98.537376,15.308497],[98.903348,16.177824],[98.493761,16.837836],[97.859123,17.567946],[97.375896,18.445438],[97.797783,18.62708],[98.253724,19.708203],[98.959676,19.752981],[99.543309,20.186598],[100.115988,20.41785],[100.548881,20.109238],[100.606294,19.508344],[101.282015,19.462585],[101.035931,18.408928],[101.059548,17.512497],[102.113592,18.109102],[102.413005,17.932782],[102.998706,17.961695],[103.200192,18.309632],[103.956477,18.240954],[104.716947,17.428859],[104.779321,16.441865],[105.589039,15.570316],[105.544338,14.723934],[105.218777,14.273212],[104.281418,14.416743],[102.988422,14.225721],[102.348099,13.394247],[102.584932,12.186595]]]}},\n{\"type\":\"Feature\",\"id\":\"TJK\",\"properties\":{\"name\":\"Tajikistan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[71.014198,40.244366],[70.648019,39.935754],[69.55961,40.103211],[69.464887,39.526683],[70.549162,39.604198],[71.784694,39.279463],[73.675379,39.431237],[73.928852,38.505815],[74.257514,38.606507],[74.864816,38.378846],[74.829986,37.990007],[74.980002,37.41999],[73.948696,37.421566],[73.260056,37.495257],[72.63689,37.047558],[72.193041,36.948288],[71.844638,36.738171],[71.448693,37.065645],[71.541918,37.905774],[71.239404,37.953265],[71.348131,38.258905],[70.806821,38.486282],[70.376304,38.138396],[70.270574,37.735165],[70.116578,37.588223],[69.518785,37.608997],[69.196273,37.151144],[68.859446,37.344336],[68.135562,37.023115],[67.83,37.144994],[68.392033,38.157025],[68.176025,38.901553],[67.44222,39.140144],[67.701429,39.580478],[68.536416,39.533453],[69.011633,40.086158],[69.329495,40.727824],[70.666622,40.960213],[70.45816,40.496495],[70.601407,40.218527],[71.014198,40.244366]]]}},\n{\"type\":\"Feature\",\"id\":\"TKM\",\"properties\":{\"name\":\"Turkmenistan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[61.210817,35.650072],[61.123071,36.491597],[60.377638,36.527383],[59.234762,37.412988],[58.436154,37.522309],[57.330434,38.029229],[56.619366,38.121394],[56.180375,37.935127],[55.511578,37.964117],[54.800304,37.392421],[53.921598,37.198918],[53.735511,37.906136],[53.880929,38.952093],[53.101028,39.290574],[53.357808,39.975286],[52.693973,40.033629],[52.915251,40.876523],[53.858139,40.631034],[54.736845,40.951015],[54.008311,41.551211],[53.721713,42.123191],[52.91675,41.868117],[52.814689,41.135371],[52.50246,41.783316],[52.944293,42.116034],[54.079418,42.324109],[54.755345,42.043971],[55.455251,41.259859],[55.968191,41.308642],[57.096391,41.32231],[56.932215,41.826026],[57.78653,42.170553],[58.629011,42.751551],[59.976422,42.223082],[60.083341,41.425146],[60.465953,41.220327],[61.547179,41.26637],[61.882714,41.084857],[62.37426,40.053886],[63.518015,39.363257],[64.170223,38.892407],[65.215999,38.402695],[66.54615,37.974685],[66.518607,37.362784],[66.217385,37.39379],[65.745631,37.661164],[65.588948,37.305217],[64.746105,37.111818],[64.546479,36.312073],[63.982896,36.007957],[63.193538,35.857166],[62.984662,35.404041],[62.230651,35.270664],[61.210817,35.650072]]]}},\n{\"type\":\"Feature\",\"id\":\"TLS\",\"properties\":{\"name\":\"East Timor\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[124.968682,-8.89279],[125.086246,-8.656887],[125.947072,-8.432095],[126.644704,-8.398247],[126.957243,-8.273345],[127.335928,-8.397317],[126.967992,-8.668256],[125.925885,-9.106007],[125.08852,-9.393173],[125.07002,-9.089987],[124.968682,-8.89279]]]}},\n{\"type\":\"Feature\",\"id\":\"TTO\",\"properties\":{\"name\":\"Trinidad and Tobago\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-61.68,10.76],[-61.105,10.89],[-60.895,10.855],[-60.935,10.11],[-61.77,10],[-61.95,10.09],[-61.66,10.365],[-61.68,10.76]]]}},\n{\"type\":\"Feature\",\"id\":\"TUN\",\"properties\":{\"name\":\"Tunisia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[9.48214,30.307556],[9.055603,32.102692],[8.439103,32.506285],[8.430473,32.748337],[7.612642,33.344115],[7.524482,34.097376],[8.140981,34.655146],[8.376368,35.479876],[8.217824,36.433177],[8.420964,36.946427],[9.509994,37.349994],[10.210002,37.230002],[10.18065,36.724038],[11.028867,37.092103],[11.100026,36.899996],[10.600005,36.41],[10.593287,35.947444],[10.939519,35.698984],[10.807847,34.833507],[10.149593,34.330773],[10.339659,33.785742],[10.856836,33.76874],[11.108501,33.293343],[11.488787,33.136996],[11.432253,32.368903],[10.94479,32.081815],[10.636901,31.761421],[9.950225,31.37607],[10.056575,30.961831],[9.970017,30.539325],[9.48214,30.307556]]]}},\n{\"type\":\"Feature\",\"id\":\"TUR\",\"properties\":{\"name\":\"Turkey\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[36.913127,41.335358],[38.347665,40.948586],[39.512607,41.102763],[40.373433,41.013673],[41.554084,41.535656],[42.619549,41.583173],[43.582746,41.092143],[43.752658,40.740201],[43.656436,40.253564],[44.400009,40.005],[44.79399,39.713003],[44.109225,39.428136],[44.421403,38.281281],[44.225756,37.971584],[44.772699,37.170445],[44.293452,37.001514],[43.942259,37.256228],[42.779126,37.385264],[42.349591,37.229873],[41.212089,37.074352],[40.673259,37.091276],[39.52258,36.716054],[38.699891,36.712927],[38.167727,36.90121],[37.066761,36.623036],[36.739494,36.81752],[36.685389,36.259699],[36.41755,36.040617],[36.149763,35.821535],[35.782085,36.274995],[36.160822,36.650606],[35.550936,36.565443],[34.714553,36.795532],[34.026895,36.21996],[32.509158,36.107564],[31.699595,36.644275],[30.621625,36.677865],[30.391096,36.262981],[29.699976,36.144357],[28.732903,36.676831],[27.641187,36.658822],[27.048768,37.653361],[26.318218,38.208133],[26.8047,38.98576],[26.170785,39.463612],[27.28002,40.420014],[28.819978,40.460011],[29.240004,41.219991],[31.145934,41.087622],[32.347979,41.736264],[33.513283,42.01896],[35.167704,42.040225],[36.913127,41.335358]]],[[[27.192377,40.690566],[26.358009,40.151994],[26.043351,40.617754],[26.056942,40.824123],[26.294602,40.936261],[26.604196,41.562115],[26.117042,41.826905],[27.135739,42.141485],[27.99672,42.007359],[28.115525,41.622886],[28.988443,41.299934],[28.806438,41.054962],[27.619017,40.999823],[27.192377,40.690566]]]]}},\n{\"type\":\"Feature\",\"id\":\"TWN\",\"properties\":{\"name\":\"Taiwan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[121.777818,24.394274],[121.175632,22.790857],[120.74708,21.970571],[120.220083,22.814861],[120.106189,23.556263],[120.69468,24.538451],[121.495044,25.295459],[121.951244,24.997596],[121.777818,24.394274]]]}},\n{\"type\":\"Feature\",\"id\":\"TZA\",\"properties\":{\"name\":\"United Republic of Tanzania\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[33.903711,-0.95],[34.07262,-1.05982],[37.69869,-3.09699],[37.7669,-3.67712],[39.20222,-4.67677],[38.74054,-5.90895],[38.79977,-6.47566],[39.44,-6.84],[39.47,-7.1],[39.19469,-7.7039],[39.25203,-8.00781],[39.18652,-8.48551],[39.53574,-9.11237],[39.9496,-10.0984],[40.31659,-10.3171],[39.521,-10.89688],[38.427557,-11.285202],[37.82764,-11.26879],[37.47129,-11.56876],[36.775151,-11.594537],[36.514082,-11.720938],[35.312398,-11.439146],[34.559989,-11.52002],[34.28,-10.16],[33.940838,-9.693674],[33.73972,-9.41715],[32.759375,-9.230599],[32.191865,-8.930359],[31.556348,-8.762049],[31.157751,-8.594579],[30.74,-8.34],[30.2,-7.08],[29.62,-6.52],[29.419993,-5.939999],[29.519987,-5.419979],[29.339998,-4.499983],[29.753512,-4.452389],[30.11632,-4.09012],[30.50554,-3.56858],[30.75224,-3.35931],[30.74301,-3.03431],[30.52766,-2.80762],[30.46967,-2.41383],[30.758309,-2.28725],[30.816135,-1.698914],[30.419105,-1.134659],[30.76986,-1.01455],[31.86617,-1.02736],[33.903711,-0.95]]]}},\n{\"type\":\"Feature\",\"id\":\"UGA\",\"properties\":{\"name\":\"Uganda\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[31.86617,-1.02736],[30.76986,-1.01455],[30.419105,-1.134659],[29.821519,-1.443322],[29.579466,-1.341313],[29.587838,-0.587406],[29.8195,-0.2053],[29.875779,0.59738],[30.086154,1.062313],[30.468508,1.583805],[30.85267,1.849396],[31.174149,2.204465],[30.77332,2.33989],[30.83385,3.50917],[31.24556,3.7819],[31.88145,3.55827],[32.68642,3.79232],[33.39,3.79],[34.005,4.249885],[34.47913,3.5556],[34.59607,3.05374],[35.03599,1.90584],[34.6721,1.17694],[34.18,0.515],[33.893569,0.109814],[33.903711,-0.95],[31.86617,-1.02736]]]}},\n{\"type\":\"Feature\",\"id\":\"UKR\",\"properties\":{\"name\":\"Ukraine\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[31.785998,52.101678],[32.159412,52.061267],[32.412058,52.288695],[32.715761,52.238465],[33.7527,52.335075],[34.391731,51.768882],[34.141978,51.566413],[34.224816,51.255993],[35.022183,51.207572],[35.377924,50.773955],[35.356116,50.577197],[36.626168,50.225591],[37.39346,50.383953],[38.010631,49.915662],[38.594988,49.926462],[40.069058,49.601055],[40.080789,49.30743],[39.674664,48.783818],[39.895632,48.232405],[39.738278,47.898937],[38.770585,47.825608],[38.255112,47.5464],[38.223538,47.10219],[37.425137,47.022221],[36.759855,46.6987],[35.823685,46.645964],[34.962342,46.273197],[35.020788,45.651219],[35.510009,45.409993],[36.529998,45.46999],[36.334713,45.113216],[35.239999,44.939996],[33.882511,44.361479],[33.326421,44.564877],[33.546924,45.034771],[32.454174,45.327466],[32.630804,45.519186],[33.588162,45.851569],[33.298567,46.080598],[31.74414,46.333348],[31.675307,46.706245],[30.748749,46.5831],[30.377609,46.03241],[29.603289,45.293308],[29.149725,45.464925],[28.679779,45.304031],[28.233554,45.488283],[28.485269,45.596907],[28.659987,45.939987],[28.933717,46.25883],[28.862972,46.437889],[29.072107,46.517678],[29.170654,46.379262],[29.759972,46.349988],[30.024659,46.423937],[29.83821,46.525326],[29.908852,46.674361],[29.559674,46.928583],[29.415135,47.346645],[29.050868,47.510227],[29.122698,47.849095],[28.670891,48.118149],[28.259547,48.155562],[27.522537,48.467119],[26.857824,48.368211],[26.619337,48.220726],[26.19745,48.220881],[25.945941,47.987149],[25.207743,47.891056],[24.866317,47.737526],[24.402056,47.981878],[23.760958,47.985598],[23.142236,48.096341],[22.710531,47.882194],[22.64082,48.15024],[22.085608,48.422264],[22.280842,48.825392],[22.558138,49.085738],[22.776419,49.027395],[22.51845,49.476774],[23.426508,50.308506],[23.922757,50.424881],[24.029986,50.705407],[23.527071,51.578454],[24.005078,51.617444],[24.553106,51.888461],[25.327788,51.910656],[26.337959,51.832289],[27.454066,51.592303],[28.241615,51.572227],[28.617613,51.427714],[28.992835,51.602044],[29.254938,51.368234],[30.157364,51.416138],[30.555117,51.319503],[30.619454,51.822806],[30.927549,52.042353],[31.785998,52.101678]]]}},\n{\"type\":\"Feature\",\"id\":\"URY\",\"properties\":{\"name\":\"Uruguay\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-57.625133,-30.216295],[-56.976026,-30.109686],[-55.973245,-30.883076],[-55.60151,-30.853879],[-54.572452,-31.494511],[-53.787952,-32.047243],[-53.209589,-32.727666],[-53.650544,-33.202004],[-53.373662,-33.768378],[-53.806426,-34.396815],[-54.935866,-34.952647],[-55.67409,-34.752659],[-56.215297,-34.859836],[-57.139685,-34.430456],[-57.817861,-34.462547],[-58.427074,-33.909454],[-58.349611,-33.263189],[-58.132648,-33.040567],[-58.14244,-32.044504],[-57.874937,-31.016556],[-57.625133,-30.216295]]]}},\n{\"type\":\"Feature\",\"id\":\"USA\",\"properties\":{\"name\":\"United States of America\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[-155.54211,19.08348],[-155.68817,18.91619],[-155.93665,19.05939],[-155.90806,19.33888],[-156.07347,19.70294],[-156.02368,19.81422],[-155.85008,19.97729],[-155.91907,20.17395],[-155.86108,20.26721],[-155.78505,20.2487],[-155.40214,20.07975],[-155.22452,19.99302],[-155.06226,19.8591],[-154.80741,19.50871],[-154.83147,19.45328],[-155.22217,19.23972],[-155.54211,19.08348]]],[[[-156.07926,20.64397],[-156.41445,20.57241],[-156.58673,20.783],[-156.70167,20.8643],[-156.71055,20.92676],[-156.61258,21.01249],[-156.25711,20.91745],[-155.99566,20.76404],[-156.07926,20.64397]]],[[[-156.75824,21.17684],[-156.78933,21.06873],[-157.32521,21.09777],[-157.25027,21.21958],[-156.75824,21.17684]]],[[[-157.65283,21.32217],[-157.70703,21.26442],[-157.7786,21.27729],[-158.12667,21.31244],[-158.2538,21.53919],[-158.29265,21.57912],[-158.0252,21.71696],[-157.94161,21.65272],[-157.65283,21.32217]]],[[[-159.34512,21.982],[-159.46372,21.88299],[-159.80051,22.06533],[-159.74877,22.1382],[-159.5962,22.23618],[-159.36569,22.21494],[-159.34512,21.982]]],[[[-94.81758,49.38905],[-94.64,48.84],[-94.32914,48.67074],[-93.63087,48.60926],[-92.61,48.45],[-91.64,48.14],[-90.83,48.27],[-89.6,48.01],[-89.272917,48.019808],[-88.378114,48.302918],[-87.439793,47.94],[-86.461991,47.553338],[-85.652363,47.220219],[-84.87608,46.900083],[-84.779238,46.637102],[-84.543749,46.538684],[-84.6049,46.4396],[-84.3367,46.40877],[-84.14212,46.512226],[-84.091851,46.275419],[-83.890765,46.116927],[-83.616131,46.116927],[-83.469551,45.994686],[-83.592851,45.816894],[-82.550925,45.347517],[-82.337763,44.44],[-82.137642,43.571088],[-82.43,42.98],[-82.9,42.43],[-83.12,42.08],[-83.142,41.975681],[-83.02981,41.832796],[-82.690089,41.675105],[-82.439278,41.675105],[-81.277747,42.209026],[-80.247448,42.3662],[-78.939362,42.863611],[-78.92,42.965],[-79.01,43.27],[-79.171674,43.466339],[-78.72028,43.625089],[-77.737885,43.629056],[-76.820034,43.628784],[-76.5,44.018459],[-76.375,44.09631],[-75.31821,44.81645],[-74.867,45.00048],[-73.34783,45.00738],[-71.50506,45.0082],[-71.405,45.255],[-71.08482,45.30524],[-70.66,45.46],[-70.305,45.915],[-69.99997,46.69307],[-69.237216,47.447781],[-68.905,47.185],[-68.23444,47.35486],[-67.79046,47.06636],[-67.79134,45.70281],[-67.13741,45.13753],[-66.96466,44.8097],[-68.03252,44.3252],[-69.06,43.98],[-70.11617,43.68405],[-70.645476,43.090238],[-70.81489,42.8653],[-70.825,42.335],[-70.495,41.805],[-70.08,41.78],[-70.185,42.145],[-69.88497,41.92283],[-69.96503,41.63717],[-70.64,41.475],[-71.12039,41.49445],[-71.86,41.32],[-72.295,41.27],[-72.87643,41.22065],[-73.71,40.931102],[-72.24126,41.11948],[-71.945,40.93],[-73.345,40.63],[-73.982,40.628],[-73.952325,40.75075],[-74.25671,40.47351],[-73.96244,40.42763],[-74.17838,39.70926],[-74.90604,38.93954],[-74.98041,39.1964],[-75.20002,39.24845],[-75.52805,39.4985],[-75.32,38.96],[-75.071835,38.782032],[-75.05673,38.40412],[-75.37747,38.01551],[-75.94023,37.21689],[-76.03127,37.2566],[-75.72205,37.93705],[-76.23287,38.319215],[-76.35,39.15],[-76.542725,38.717615],[-76.32933,38.08326],[-76.989998,38.239992],[-76.30162,37.917945],[-76.25874,36.9664],[-75.9718,36.89726],[-75.86804,36.55125],[-75.72749,35.55074],[-76.36318,34.80854],[-77.397635,34.51201],[-78.05496,33.92547],[-78.55435,33.86133],[-79.06067,33.49395],[-79.20357,33.15839],[-80.301325,32.509355],[-80.86498,32.0333],[-81.33629,31.44049],[-81.49042,30.72999],[-81.31371,30.03552],[-80.98,29.18],[-80.535585,28.47213],[-80.53,28.04],[-80.056539,26.88],[-80.088015,26.205765],[-80.13156,25.816775],[-80.38103,25.20616],[-80.68,25.08],[-81.17213,25.20126],[-81.33,25.64],[-81.71,25.87],[-82.24,26.73],[-82.70515,27.49504],[-82.85526,27.88624],[-82.65,28.55],[-82.93,29.1],[-83.70959,29.93656],[-84.1,30.09],[-85.10882,29.63615],[-85.28784,29.68612],[-85.7731,30.15261],[-86.4,30.4],[-87.53036,30.27433],[-88.41782,30.3849],[-89.18049,30.31598],[-89.593831,30.159994],[-89.413735,29.89419],[-89.43,29.48864],[-89.21767,29.29108],[-89.40823,29.15961],[-89.77928,29.30714],[-90.15463,29.11743],[-90.880225,29.148535],[-91.626785,29.677],[-92.49906,29.5523],[-93.22637,29.78375],[-93.84842,29.71363],[-94.69,29.48],[-95.60026,28.73863],[-96.59404,28.30748],[-97.14,27.83],[-97.37,27.38],[-97.38,26.69],[-97.33,26.21],[-97.14,25.87],[-97.53,25.84],[-98.24,26.06],[-99.02,26.37],[-99.3,26.84],[-99.52,27.54],[-100.11,28.11],[-100.45584,28.69612],[-100.9576,29.38071],[-101.6624,29.7793],[-102.48,29.76],[-103.11,28.97],[-103.94,29.27],[-104.45697,29.57196],[-104.70575,30.12173],[-105.03737,30.64402],[-105.63159,31.08383],[-106.1429,31.39995],[-106.50759,31.75452],[-108.24,31.754854],[-108.24194,31.34222],[-109.035,31.34194],[-111.02361,31.33472],[-113.30498,32.03914],[-114.815,32.52528],[-114.72139,32.72083],[-115.99135,32.61239],[-117.12776,32.53534],[-117.295938,33.046225],[-117.944,33.621236],[-118.410602,33.740909],[-118.519895,34.027782],[-119.081,34.078],[-119.438841,34.348477],[-120.36778,34.44711],[-120.62286,34.60855],[-120.74433,35.15686],[-121.71457,36.16153],[-122.54747,37.55176],[-122.51201,37.78339],[-122.95319,38.11371],[-123.7272,38.95166],[-123.86517,39.76699],[-124.39807,40.3132],[-124.17886,41.14202],[-124.2137,41.99964],[-124.53284,42.76599],[-124.14214,43.70838],[-124.020535,44.615895],[-123.89893,45.52341],[-124.079635,46.86475],[-124.39567,47.72017],[-124.68721,48.184433],[-124.566101,48.379715],[-123.12,48.04],[-122.58736,47.096],[-122.34,47.36],[-122.5,48.18],[-122.84,49],[-120,49],[-117.03121,49],[-116.04818,49],[-113,49],[-110.05,49],[-107.05,49],[-104.04826,48.99986],[-100.65,49],[-97.22872,49.0007],[-95.15907,49],[-95.15609,49.38425],[-94.81758,49.38905]]],[[[-153.006314,57.115842],[-154.00509,56.734677],[-154.516403,56.992749],[-154.670993,57.461196],[-153.76278,57.816575],[-153.228729,57.968968],[-152.564791,57.901427],[-152.141147,57.591059],[-153.006314,57.115842]]],[[[-165.579164,59.909987],[-166.19277,59.754441],[-166.848337,59.941406],[-167.455277,60.213069],[-166.467792,60.38417],[-165.67443,60.293607],[-165.579164,59.909987]]],[[[-171.731657,63.782515],[-171.114434,63.592191],[-170.491112,63.694975],[-169.682505,63.431116],[-168.689439,63.297506],[-168.771941,63.188598],[-169.52944,62.976931],[-170.290556,63.194438],[-170.671386,63.375822],[-171.553063,63.317789],[-171.791111,63.405846],[-171.731657,63.782515]]],[[[-155.06779,71.147776],[-154.344165,70.696409],[-153.900006,70.889989],[-152.210006,70.829992],[-152.270002,70.600006],[-150.739992,70.430017],[-149.720003,70.53001],[-147.613362,70.214035],[-145.68999,70.12001],[-144.920011,69.989992],[-143.589446,70.152514],[-142.07251,69.851938],[-140.985988,69.711998],[-140.992499,66.000029],[-140.99777,60.306397],[-140.012998,60.276838],[-139.039,60.000007],[-138.34089,59.56211],[-137.4525,58.905],[-136.47972,59.46389],[-135.47583,59.78778],[-134.945,59.27056],[-134.27111,58.86111],[-133.355549,58.410285],[-132.73042,57.69289],[-131.70781,56.55212],[-130.00778,55.91583],[-129.979994,55.284998],[-130.53611,54.802753],[-131.085818,55.178906],[-131.967211,55.497776],[-132.250011,56.369996],[-133.539181,57.178887],[-134.078063,58.123068],[-135.038211,58.187715],[-136.628062,58.212209],[-137.800006,58.499995],[-139.867787,59.537762],[-140.825274,59.727517],[-142.574444,60.084447],[-143.958881,59.99918],[-145.925557,60.45861],[-147.114374,60.884656],[-148.224306,60.672989],[-148.018066,59.978329],[-148.570823,59.914173],[-149.727858,59.705658],[-150.608243,59.368211],[-151.716393,59.155821],[-151.859433,59.744984],[-151.409719,60.725803],[-150.346941,61.033588],[-150.621111,61.284425],[-151.895839,60.727198],[-152.57833,60.061657],[-154.019172,59.350279],[-153.287511,58.864728],[-154.232492,58.146374],[-155.307491,57.727795],[-156.308335,57.422774],[-156.556097,56.979985],[-158.117217,56.463608],[-158.433321,55.994154],[-159.603327,55.566686],[-160.28972,55.643581],[-161.223048,55.364735],[-162.237766,55.024187],[-163.069447,54.689737],[-164.785569,54.404173],[-164.942226,54.572225],[-163.84834,55.039431],[-162.870001,55.348043],[-161.804175,55.894986],[-160.563605,56.008055],[-160.07056,56.418055],[-158.684443,57.016675],[-158.461097,57.216921],[-157.72277,57.570001],[-157.550274,58.328326],[-157.041675,58.918885],[-158.194731,58.615802],[-158.517218,58.787781],[-159.058606,58.424186],[-159.711667,58.93139],[-159.981289,58.572549],[-160.355271,59.071123],[-161.355003,58.670838],[-161.968894,58.671665],[-162.054987,59.266925],[-161.874171,59.633621],[-162.518059,59.989724],[-163.818341,59.798056],[-164.662218,60.267484],[-165.346388,60.507496],[-165.350832,61.073895],[-166.121379,61.500019],[-165.734452,62.074997],[-164.919179,62.633076],[-164.562508,63.146378],[-163.753332,63.219449],[-163.067224,63.059459],[-162.260555,63.541936],[-161.53445,63.455817],[-160.772507,63.766108],[-160.958335,64.222799],[-161.518068,64.402788],[-160.777778,64.788604],[-161.391926,64.777235],[-162.45305,64.559445],[-162.757786,64.338605],[-163.546394,64.55916],[-164.96083,64.446945],[-166.425288,64.686672],[-166.845004,65.088896],[-168.11056,65.669997],[-166.705271,66.088318],[-164.47471,66.57666],[-163.652512,66.57666],[-163.788602,66.077207],[-161.677774,66.11612],[-162.489715,66.735565],[-163.719717,67.116395],[-164.430991,67.616338],[-165.390287,68.042772],[-166.764441,68.358877],[-166.204707,68.883031],[-164.430811,68.915535],[-163.168614,69.371115],[-162.930566,69.858062],[-161.908897,70.33333],[-160.934797,70.44769],[-159.039176,70.891642],[-158.119723,70.824721],[-156.580825,71.357764],[-155.06779,71.147776]]]]}},\n{\"type\":\"Feature\",\"id\":\"UZB\",\"properties\":{\"name\":\"Uzbekistan\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[66.518607,37.362784],[66.54615,37.974685],[65.215999,38.402695],[64.170223,38.892407],[63.518015,39.363257],[62.37426,40.053886],[61.882714,41.084857],[61.547179,41.26637],[60.465953,41.220327],[60.083341,41.425146],[59.976422,42.223082],[58.629011,42.751551],[57.78653,42.170553],[56.932215,41.826026],[57.096391,41.32231],[55.968191,41.308642],[55.928917,44.995858],[58.503127,45.586804],[58.689989,45.500014],[60.239972,44.784037],[61.05832,44.405817],[62.0133,43.504477],[63.185787,43.650075],[64.900824,43.728081],[66.098012,42.99766],[66.023392,41.994646],[66.510649,41.987644],[66.714047,41.168444],[67.985856,41.135991],[68.259896,40.662325],[68.632483,40.668681],[69.070027,41.384244],[70.388965,42.081308],[70.962315,42.266154],[71.259248,42.167711],[70.420022,41.519998],[71.157859,41.143587],[71.870115,41.3929],[73.055417,40.866033],[71.774875,40.145844],[71.014198,40.244366],[70.601407,40.218527],[70.45816,40.496495],[70.666622,40.960213],[69.329495,40.727824],[69.011633,40.086158],[68.536416,39.533453],[67.701429,39.580478],[67.44222,39.140144],[68.176025,38.901553],[68.392033,38.157025],[67.83,37.144994],[67.075782,37.356144],[66.518607,37.362784]]]}},\n{\"type\":\"Feature\",\"id\":\"VEN\",\"properties\":{\"name\":\"Venezuela\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[-71.331584,11.776284],[-71.360006,11.539994],[-71.94705,11.423282],[-71.620868,10.96946],[-71.633064,10.446494],[-72.074174,9.865651],[-71.695644,9.072263],[-71.264559,9.137195],[-71.039999,9.859993],[-71.350084,10.211935],[-71.400623,10.968969],[-70.155299,11.375482],[-70.293843,11.846822],[-69.943245,12.162307],[-69.5843,11.459611],[-68.882999,11.443385],[-68.233271,10.885744],[-68.194127,10.554653],[-67.296249,10.545868],[-66.227864,10.648627],[-65.655238,10.200799],[-64.890452,10.077215],[-64.329479,10.389599],[-64.318007,10.641418],[-63.079322,10.701724],[-61.880946,10.715625],[-62.730119,10.420269],[-62.388512,9.948204],[-61.588767,9.873067],[-60.830597,9.38134],[-60.671252,8.580174],[-60.150096,8.602757],[-59.758285,8.367035],[-60.550588,7.779603],[-60.637973,7.415],[-60.295668,7.043911],[-60.543999,6.856584],[-61.159336,6.696077],[-61.139415,6.234297],[-61.410303,5.959068],[-60.733574,5.200277],[-60.601179,4.918098],[-60.966893,4.536468],[-62.08543,4.162124],[-62.804533,4.006965],[-63.093198,3.770571],[-63.888343,4.02053],[-64.628659,4.148481],[-64.816064,4.056445],[-64.368494,3.79721],[-64.408828,3.126786],[-64.269999,2.497006],[-63.422867,2.411068],[-63.368788,2.2009],[-64.083085,1.916369],[-64.199306,1.492855],[-64.611012,1.328731],[-65.354713,1.095282],[-65.548267,0.789254],[-66.325765,0.724452],[-66.876326,1.253361],[-67.181294,2.250638],[-67.447092,2.600281],[-67.809938,2.820655],[-67.303173,3.318454],[-67.337564,3.542342],[-67.621836,3.839482],[-67.823012,4.503937],[-67.744697,5.221129],[-67.521532,5.55687],[-67.34144,6.095468],[-67.695087,6.267318],[-68.265052,6.153268],[-68.985319,6.206805],[-69.38948,6.099861],[-70.093313,6.960376],[-70.674234,7.087785],[-71.960176,6.991615],[-72.198352,7.340431],[-72.444487,7.423785],[-72.479679,7.632506],[-72.360901,8.002638],[-72.439862,8.405275],[-72.660495,8.625288],[-72.78873,9.085027],[-73.304952,9.152],[-73.027604,9.73677],[-72.905286,10.450344],[-72.614658,10.821975],[-72.227575,11.108702],[-71.973922,11.608672],[-71.331584,11.776284]]]}},\n{\"type\":\"Feature\",\"id\":\"VNM\",\"properties\":{\"name\":\"Vietnam\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[108.05018,21.55238],[106.715068,20.696851],[105.881682,19.75205],[105.662006,19.058165],[106.426817,18.004121],[107.361954,16.697457],[108.269495,16.079742],[108.877107,15.276691],[109.33527,13.426028],[109.200136,11.666859],[108.36613,11.008321],[107.220929,10.364484],[106.405113,9.53084],[105.158264,8.59976],[104.795185,9.241038],[105.076202,9.918491],[104.334335,10.486544],[105.199915,10.88931],[106.24967,10.961812],[105.810524,11.567615],[107.491403,12.337206],[107.614548,13.535531],[107.382727,14.202441],[107.564525,15.202173],[107.312706,15.908538],[106.556008,16.604284],[105.925762,17.485315],[105.094598,18.666975],[103.896532,19.265181],[104.183388,19.624668],[104.822574,19.886642],[104.435,20.758733],[103.203861,20.766562],[102.754896,21.675137],[102.170436,22.464753],[102.706992,22.708795],[103.504515,22.703757],[104.476858,22.81915],[105.329209,23.352063],[105.811247,22.976892],[106.725403,22.794268],[106.567273,22.218205],[107.04342,21.811899],[108.05018,21.55238]]]}},\n{\"type\":\"Feature\",\"id\":\"VUT\",\"properties\":{\"name\":\"Vanuatu\"},\"geometry\":{\"type\":\"MultiPolygon\",\"coordinates\":[[[[167.844877,-16.466333],[167.515181,-16.59785],[167.180008,-16.159995],[167.216801,-15.891846],[167.844877,-16.466333]]],[[[167.107712,-14.93392],[167.270028,-15.740021],[167.001207,-15.614602],[166.793158,-15.668811],[166.649859,-15.392704],[166.629137,-14.626497],[167.107712,-14.93392]]]]}},\n{\"type\":\"Feature\",\"id\":\"PSE\",\"properties\":{\"name\":\"West Bank\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[35.545665,32.393992],[35.545252,31.782505],[35.397561,31.489086],[34.927408,31.353435],[34.970507,31.616778],[35.225892,31.754341],[34.974641,31.866582],[35.18393,32.532511],[35.545665,32.393992]]]}},\n{\"type\":\"Feature\",\"id\":\"YEM\",\"properties\":{\"name\":\"Yemen\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[53.108573,16.651051],[52.385206,16.382411],[52.191729,15.938433],[52.168165,15.59742],[51.172515,15.17525],[49.574576,14.708767],[48.679231,14.003202],[48.238947,13.94809],[47.938914,14.007233],[47.354454,13.59222],[46.717076,13.399699],[45.877593,13.347764],[45.62505,13.290946],[45.406459,13.026905],[45.144356,12.953938],[44.989533,12.699587],[44.494576,12.721653],[44.175113,12.58595],[43.482959,12.6368],[43.222871,13.22095],[43.251448,13.767584],[43.087944,14.06263],[42.892245,14.802249],[42.604873,15.213335],[42.805015,15.261963],[42.702438,15.718886],[42.823671,15.911742],[42.779332,16.347891],[43.218375,16.66689],[43.115798,17.08844],[43.380794,17.579987],[43.791519,17.319977],[44.062613,17.410359],[45.216651,17.433329],[45.399999,17.333335],[46.366659,17.233315],[46.749994,17.283338],[47.000005,16.949999],[47.466695,17.116682],[48.183344,18.166669],[49.116672,18.616668],[52.00001,19.000003],[52.782184,17.349742],[53.108573,16.651051]]]}},\n{\"type\":\"Feature\",\"id\":\"ZAF\",\"properties\":{\"name\":\"South Africa\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[31.521001,-29.257387],[31.325561,-29.401978],[30.901763,-29.909957],[30.622813,-30.423776],[30.055716,-31.140269],[28.925553,-32.172041],[28.219756,-32.771953],[27.464608,-33.226964],[26.419452,-33.61495],[25.909664,-33.66704],[25.780628,-33.944646],[25.172862,-33.796851],[24.677853,-33.987176],[23.594043,-33.794474],[22.988189,-33.916431],[22.574157,-33.864083],[21.542799,-34.258839],[20.689053,-34.417175],[20.071261,-34.795137],[19.616405,-34.819166],[19.193278,-34.462599],[18.855315,-34.444306],[18.424643,-33.997873],[18.377411,-34.136521],[18.244499,-33.867752],[18.25008,-33.281431],[17.92519,-32.611291],[18.24791,-32.429131],[18.221762,-31.661633],[17.566918,-30.725721],[17.064416,-29.878641],[17.062918,-29.875954],[16.344977,-28.576705],[16.824017,-28.082162],[17.218929,-28.355943],[17.387497,-28.783514],[17.836152,-28.856378],[18.464899,-29.045462],[19.002127,-28.972443],[19.894734,-28.461105],[19.895768,-24.76779],[20.165726,-24.917962],[20.758609,-25.868136],[20.66647,-26.477453],[20.889609,-26.828543],[21.605896,-26.726534],[22.105969,-26.280256],[22.579532,-25.979448],[22.824271,-25.500459],[23.312097,-25.26869],[23.73357,-25.390129],[24.211267,-25.670216],[25.025171,-25.71967],[25.664666,-25.486816],[25.765849,-25.174845],[25.941652,-24.696373],[26.485753,-24.616327],[26.786407,-24.240691],[27.11941,-23.574323],[28.017236,-22.827754],[29.432188,-22.091313],[29.839037,-22.102216],[30.322883,-22.271612],[30.659865,-22.151567],[31.191409,-22.25151],[31.670398,-23.658969],[31.930589,-24.369417],[31.752408,-25.484284],[31.837778,-25.843332],[31.333158,-25.660191],[31.04408,-25.731452],[30.949667,-26.022649],[30.676609,-26.398078],[30.685962,-26.743845],[31.282773,-27.285879],[31.86806,-27.177927],[32.071665,-26.73382],[32.83012,-26.742192],[32.580265,-27.470158],[32.462133,-28.301011],[32.203389,-28.752405],[31.521001,-29.257387]],[[28.978263,-28.955597],[28.5417,-28.647502],[28.074338,-28.851469],[27.532511,-29.242711],[26.999262,-29.875954],[27.749397,-30.645106],[28.107205,-30.545732],[28.291069,-30.226217],[28.8484,-30.070051],[29.018415,-29.743766],[29.325166,-29.257387],[28.978263,-28.955597]]]}},\n{\"type\":\"Feature\",\"id\":\"ZMB\",\"properties\":{\"name\":\"Zambia\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[32.759375,-9.230599],[33.231388,-9.676722],[33.485688,-10.525559],[33.31531,-10.79655],[33.114289,-11.607198],[33.306422,-12.435778],[32.991764,-12.783871],[32.688165,-13.712858],[33.214025,-13.97186],[30.179481,-14.796099],[30.274256,-15.507787],[29.516834,-15.644678],[28.947463,-16.043051],[28.825869,-16.389749],[28.467906,-16.4684],[27.598243,-17.290831],[27.044427,-17.938026],[26.706773,-17.961229],[26.381935,-17.846042],[25.264226,-17.73654],[25.084443,-17.661816],[25.07695,-17.578823],[24.682349,-17.353411],[24.033862,-17.295843],[23.215048,-17.523116],[22.562478,-16.898451],[21.887843,-16.08031],[21.933886,-12.898437],[24.016137,-12.911046],[23.930922,-12.565848],[24.079905,-12.191297],[23.904154,-11.722282],[24.017894,-11.237298],[23.912215,-10.926826],[24.257155,-10.951993],[24.314516,-11.262826],[24.78317,-11.238694],[25.418118,-11.330936],[25.75231,-11.784965],[26.553088,-11.92444],[27.16442,-11.608748],[27.388799,-12.132747],[28.155109,-12.272481],[28.523562,-12.698604],[28.934286,-13.248958],[29.699614,-13.257227],[29.616001,-12.178895],[29.341548,-12.360744],[28.642417,-11.971569],[28.372253,-11.793647],[28.49607,-10.789884],[28.673682,-9.605925],[28.449871,-9.164918],[28.734867,-8.526559],[29.002912,-8.407032],[30.346086,-8.238257],[30.740015,-8.340007],[31.157751,-8.594579],[31.556348,-8.762049],[32.191865,-8.930359],[32.759375,-9.230599]]]}},\n{\"type\":\"Feature\",\"id\":\"ZWE\",\"properties\":{\"name\":\"Zimbabwe\"},\"geometry\":{\"type\":\"Polygon\",\"coordinates\":[[[31.191409,-22.25151],[30.659865,-22.151567],[30.322883,-22.271612],[29.839037,-22.102216],[29.432188,-22.091313],[28.794656,-21.639454],[28.02137,-21.485975],[27.727228,-20.851802],[27.724747,-20.499059],[27.296505,-20.39152],[26.164791,-19.293086],[25.850391,-18.714413],[25.649163,-18.536026],[25.264226,-17.73654],[26.381935,-17.846042],[26.706773,-17.961229],[27.044427,-17.938026],[27.598243,-17.290831],[28.467906,-16.4684],[28.825869,-16.389749],[28.947463,-16.043051],[29.516834,-15.644678],[30.274256,-15.507787],[30.338955,-15.880839],[31.173064,-15.860944],[31.636498,-16.07199],[31.852041,-16.319417],[32.328239,-16.392074],[32.847639,-16.713398],[32.849861,-17.979057],[32.654886,-18.67209],[32.611994,-19.419383],[32.772708,-19.715592],[32.659743,-20.30429],[32.508693,-20.395292],[32.244988,-21.116489],[31.191409,-22.25151]]]}}\n]}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categories\ncommon_Series=Series\ncommon_Values=Values\ncommon_Value=Value\ncommon_Locations=Locations\ncommon_Rows=Group By\ncommon_Columns=Columns\ncommon_noData=No data\n\ngoogleDisplayer_resetAnchor=reset\n\ngoogleBubbleDisplayer_XAxis=X Axis\ngoogleBubbleDisplayer_YAxis=Y Axis\ngoogleBubbleDisplayer_BubbleColor=Bubble color\ngoogleBubbleDisplayer_BubbleSize=Bubble size"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_de.properties",
    "content": "common_Categories=Kategorien\ncommon_Series=Serie\ncommon_Values=Werte\ncommon_Value=Wert\ncommon_Locations=Speicherorte\ncommon_Columns=Spalten\ncommon_noData=Keine Daten\ngoogleDisplayer_resetAnchor=zurücksetzen\ngoogleBubbleDisplayer_XAxis=X-Achse\ngoogleBubbleDisplayer_YAxis=Y-Achse\ngoogleBubbleDisplayer_BubbleColor=Blasen-Farbe\ngoogleBubbleDisplayer_BubbleSize=Blasen-Größe\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorías\ncommon_Series=Serie\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Ubicaciones\ncommon_Rows=Agrupar por\ncommon_Columns=Columnas\ncommon_noData=No hay datos\n\ngoogleDisplayer_resetAnchor=restablecer\n\ngoogleBubbleDisplayer_XAxis=Eje X\ngoogleBubbleDisplayer_YAxis=Eje Y\ngoogleBubbleDisplayer_BubbleColor=Color de la burbuja\ngoogleBubbleDisplayer_BubbleSize=Tamaño de la burbuja"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Catégories\ncommon_Series=Séries\ncommon_Values=Valeurs\ncommon_Value=Valeur\ncommon_Locations=Sites\ncommon_Rows=Grouper par\ncommon_Columns=Colonnes\ncommon_noData=Aucune donnée\n\ngoogleDisplayer_resetAnchor=réinitialiser\n\ngoogleBubbleDisplayer_XAxis=Axe X\ngoogleBubbleDisplayer_YAxis=Axe Y\ngoogleBubbleDisplayer_BubbleColor=Couleur de la bulle\ngoogleBubbleDisplayer_BubbleSize=Taille de la bulle"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorie\ncommon_Series=Serie\ncommon_Values=Valori\ncommon_Value=Valore\ncommon_Locations=Posizioni\ncommon_Rows=Raggruppa per\ncommon_Columns=Colonne\ncommon_noData=Nessun dato\n\ngoogleDisplayer_resetAnchor=reset\n\ngoogleBubbleDisplayer_XAxis=Asse X\ngoogleBubbleDisplayer_YAxis=Asse Y\ngoogleBubbleDisplayer_BubbleColor=Colore bolle\ngoogleBubbleDisplayer_BubbleSize=Dimensione bolle\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=カテゴリ\ncommon_Series=シリーズ\ncommon_Values=値\ncommon_Value=値\ncommon_Locations=場所\ncommon_Rows=グループ化\ncommon_Columns=カラム\ncommon_noData=データなし\n\ngoogleDisplayer_resetAnchor=リセット\n\ngoogleBubbleDisplayer_XAxis=X 軸\ngoogleBubbleDisplayer_YAxis=Y 軸\ngoogleBubbleDisplayer_BubbleColor=バブル色\ngoogleBubbleDisplayer_BubbleSize=バブルサイズ"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_pt_BR.properties",
    "content": "common_Categories=Categorias\ncommon_Series=Séries\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Locais\ncommon_Columns=Colunas\ncommon_noData=Não há dados\ngoogleDisplayer_resetAnchor=reiniciar\ngoogleBubbleDisplayer_XAxis=X Axis\ngoogleBubbleDisplayer_YAxis=Y Axis\ngoogleBubbleDisplayer_BubbleColor=Cor do Bubble\ngoogleBubbleDisplayer_BubbleSize=Tamanho do Bubble\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/main/resources/org/dashbuilder/renderer/c3/client/resources/i18n/C3DisplayerConstants_zh_CN.properties",
    "content": "common_Categories=类别\ncommon_Series=序列\ncommon_Values=值\ncommon_Value=值\ncommon_Locations=位置\ncommon_Columns=列\ncommon_noData=没有数据\ngoogleDisplayer_resetAnchor=重置\ngoogleBubbleDisplayer_XAxis=X  轴\ngoogleBubbleDisplayer_YAxis=Y 轴\ngoogleBubbleDisplayer_BubbleColor=Bubble 颜色\ngoogleBubbleDisplayer_BubbleSize=Bubble 大小\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/C3BaseTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.lenient;\nimport static org.mockito.Mockito.when;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.line.C3LineChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.map.D3MapDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.CountriesGeoJsonService;\nimport org.dashbuilder.renderer.c3.client.charts.meter.C3MeterChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisInfo;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisX;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3AxisY;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartData;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3JsTypesFactory;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3Tick;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class C3BaseTest extends AbstractDisplayerTest {\n\n    @Mock\n    C3JsTypesFactory c3Factory;\n\n    @Mock\n    protected C3AxisInfo c3AxisInfo;\n    @Mock\n    protected C3AxisY c3AxisY;\n    @Mock\n    protected C3AxisX c3AxisX;\n    @Mock\n    protected  C3Tick c3Tick;\n    @Mock\n    protected C3ChartConf c3Conf;\n    @Mock\n    protected C3ChartData c3ChartData;\n    @Mock\n    FilterLabelSet filterLabelSet;\n    @Mock\n    C3LineChartDisplayer.View c3LineChartview;\n    @Mock\n    C3AreaChartDisplayer.View c3AreaChartview;\n    @Mock\n    C3MeterChartDisplayer.View c3Meterview;\n    @Mock \n    D3MapDisplayer.View d3MapDisplayerView;\n    @Mock\n    CountriesGeoJsonService geoService;\n\n\n    public C3LineChartDisplayer c3LineChartDisplayer(DisplayerSettings settings) {\n        c3Factory = mockC3JsTypesFactory();\n        return initDisplayer(new C3LineChartDisplayer(c3LineChartview, filterLabelSet, c3Factory), settings);\n    }\n    \n    public C3AreaChartDisplayer c3AreaChartDisplayer(DisplayerSettings settings) {\n        c3Factory = mockC3JsTypesFactory();\n        return initDisplayer(new C3AreaChartDisplayer(c3AreaChartview, filterLabelSet, c3Factory), settings);\n    }\n    \n    public C3MeterChartDisplayer c3MeterChartDisplayer(DisplayerSettings settings) {\n        c3Factory = mockC3JsTypesFactory();\n        return initDisplayer(new C3MeterChartDisplayer(c3Meterview, filterLabelSet, c3Factory), settings);\n    }\n    \n    public D3MapDisplayer d3MapDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new D3MapDisplayer(filterLabelSet, d3MapDisplayerView, geoService), settings);\n    }\n    \n    private C3JsTypesFactory mockC3JsTypesFactory() {\n        when(c3AxisInfo.getX()).thenReturn(c3AxisX);\n        lenient().when(c3AxisInfo.getY()).thenReturn(c3AxisY);\n        when(c3AxisX.getTick()).thenReturn(c3Tick);\n        when(c3Conf.getAxis()).thenReturn(c3AxisInfo);\n        when(c3Factory.c3ChartData(any(), any(), any(), any(), any())).thenReturn(c3ChartData);\n        when(c3Factory.c3ChartConf(any(), any(), any(), any(), any(), any(), any(), any(), any())).thenReturn(c3Conf);\n        return c3Factory;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/C3DisplayerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_AMOUNT;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_DATE;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_ID;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.junit.Assert.assertArrayEquals;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.renderer.c3.client.charts.line.C3LineChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.jsbinding.C3ChartConf;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class C3DisplayerTest extends C3BaseTest {\n    \n    private static final boolean RECEIVE_NOTIFICATION = true;\n    private static final String LEGEND_POSITION = \"right\";\n    private static final int SIZE = 300;\n    private static final String TITLE = \"Title\";\n    private static final String BLACK = \"black\";\n    \n    DisplayerSettings simpleSettings = DisplayerSettingsFactory.newBarChartSettings()\n                                                        .dataset(EXPENSES)\n                                                        .group(COLUMN_DATE)\n                                                        .column(COLUMN_DATE)\n                                                        .column(COLUMN_AMOUNT, SUM)\n                                                        .width(SIZE)\n                                                        .height(SIZE)\n                                                        .title(TITLE)\n                                                        .backgroundColor(BLACK)\n                                                        .titleVisible(true)\n                                                        .legendOn(LEGEND_POSITION)\n                                                        .filterOn(RECEIVE_NOTIFICATION, \n                                                                  RECEIVE_NOTIFICATION, \n                                                                  RECEIVE_NOTIFICATION)\n                                                        .buildSettings();\n    private C3LineChartDisplayer displayer;\n    \n    @Before \n    public void conf() {\n        displayer = c3LineChartDisplayer(simpleSettings);\n        displayer.draw();\n    }\n    \n    /**\n     * Tests if C3 configuration is built based on settings values\n     */\n    @Test\n    public void c3ConfigurationTest() {\n        verify(c3Factory).c3ChartSize(SIZE, SIZE);\n        verify(c3Factory).c3AxisInfo(eq(false), any(), any());\n        verify(c3Factory).c3Legend(true, LEGEND_POSITION);\n        verify(c3Factory).c3Selection(RECEIVE_NOTIFICATION, true, false);\n    }\n    \n    /**\n     * Check if settings are passed to view\n     */\n    @Test\n    public void viewParametersTest() {\n        C3LineChartDisplayer.View view = displayer.getView();\n        verify(view).init(any());\n        verify(view).updateChart(any(C3ChartConf.class));\n        verify(view).showTitle(TITLE);\n        verify(view).setBackgroundColor(BLACK);\n    }\n    \n    /**\n     * Verify if data is generated correctly\n     */\n    @Test\n    public void c3DataTest() {\n        DataSet lastDataSet = displayer.getDataSetHandler().getLastDataSet();\n        List<?> categories = lastDataSet.getColumns().get(0).getValues();\n        DataColumn seriesColumn = lastDataSet.getColumns().get(1);\n        String[][] createdSeries = displayer.createSeries();\n        assertArrayEquals(displayer.createCategories(), categories.toArray());\n        assertEquals(createdSeries[0].length, seriesColumn.getValues().size() + 1);\n        assertEquals(createdSeries[0][0], seriesColumn.getId());\n    }\n    \n    @Test\n    public void c3NoData() {\n        DisplayerSettings noData = DisplayerSettingsFactory.newLineChartSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM)\n                .buildSettings();\n        displayer = c3LineChartDisplayer(noData);\n        displayer.draw();\n        C3LineChartDisplayer.View view = displayer.getView();\n        verify(view).noData();\n    }\n    \n    @Test\n    public void tableDataTest() {\n        String[][] expectedDataTable = {\n                { \"2012\",    \"2013\",    \"2014\", \"2015\" },\n                { \"6126.13\", \"5252.96\", \"4015.48\", \"7336.69\"}\n        }; \n        displayer.draw();\n        C3LineChartDisplayer.View view = displayer.getView();\n        String[][] dataTable = displayer.getDataTable();\n        assertArrayEquals(expectedDataTable, dataTable);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/C3RendererTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport static org.mockito.Mockito.when;\nimport static org.dashbuilder.displayer.DisplayerSubType.AREA_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.BAR;\nimport static org.dashbuilder.displayer.DisplayerSubType.BAR_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.COLUMN;\nimport static org.dashbuilder.displayer.DisplayerSubType.COLUMN_STACKED;\nimport static org.dashbuilder.displayer.DisplayerSubType.DONUT;\nimport static org.dashbuilder.displayer.DisplayerSubType.LINE;\nimport static org.dashbuilder.displayer.DisplayerSubType.PIE;\nimport static org.dashbuilder.displayer.DisplayerSubType.SMOOTH;\nimport static org.dashbuilder.displayer.DisplayerType.AREACHART;\nimport static org.dashbuilder.displayer.DisplayerType.BARCHART;\nimport static org.dashbuilder.displayer.DisplayerType.BUBBLECHART;\nimport static org.dashbuilder.displayer.DisplayerType.LINECHART;\nimport static org.dashbuilder.displayer.DisplayerType.METERCHART;\nimport static org.dashbuilder.displayer.DisplayerType.PIECHART;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.bar.C3BarChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.bubble.C3BubbleChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.line.C3LineChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.meter.C3MeterChartDisplayer;\nimport org.dashbuilder.renderer.c3.client.charts.pie.C3PieChartDisplayer;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class C3RendererTest {\n    \n    @Mock\n    SyncBeanManager beanManager;\n    @InjectMocks\n    C3Renderer renderer;\n    \n    @Mock\n    private SyncBeanDef<C3AreaChartDisplayer> areaChartDisplayerBeanDef;\n    @Mock\n    private SyncBeanDef<C3BarChartDisplayer> barChartDisplayerBeanDef;\n    @Mock\n    private SyncBeanDef<C3LineChartDisplayer> lineChartDisplayerBeanDef;\n    @Mock\n    private SyncBeanDef<C3PieChartDisplayer> pieChartDisplayerBeanDef;\n    @Mock\n    private SyncBeanDef<C3BubbleChartDisplayer> bubbleChartDisplayerBeanDef;\n    @Mock\n    private SyncBeanDef<C3MeterChartDisplayer> meterChartDisplayerBeanDef;\n    @Mock\n    private C3AreaChartDisplayer c3AreaChartDisplayer;\n    @Mock\n    private C3BarChartDisplayer c3BarChartDisplayer;\n    @Mock\n    private C3LineChartDisplayer c3LineChartDisplayer;\n    @Mock\n    private C3PieChartDisplayer c3PieChartDisplayer;\n    @Mock\n    private C3BubbleChartDisplayer c3BubbleChartDisplayer;\n    @Mock\n    private C3MeterChartDisplayer c3MeterChartDisplayer;\n    \n    private DisplayerSettings settings;\n    \n    \n    \n    @Before\n    public void prepareTypes() {\n        when(beanManager.lookupBean(C3AreaChartDisplayer.class)).thenReturn(areaChartDisplayerBeanDef);\n        when(areaChartDisplayerBeanDef.newInstance()).thenReturn(c3AreaChartDisplayer);\n        \n        when(beanManager.lookupBean(C3BarChartDisplayer.class)).thenReturn(barChartDisplayerBeanDef);\n        when(barChartDisplayerBeanDef.newInstance()).thenReturn(c3BarChartDisplayer);\n        \n        when(beanManager.lookupBean(C3LineChartDisplayer.class)).thenReturn(lineChartDisplayerBeanDef);\n        when(lineChartDisplayerBeanDef.newInstance()).thenReturn(c3LineChartDisplayer);        \n        \n        when(beanManager.lookupBean(C3PieChartDisplayer.class)).thenReturn(pieChartDisplayerBeanDef);\n        when(pieChartDisplayerBeanDef.newInstance()).thenReturn(c3PieChartDisplayer);     \n        \n        when(beanManager.lookupBean(C3BubbleChartDisplayer.class)).thenReturn(bubbleChartDisplayerBeanDef);\n        when(bubbleChartDisplayerBeanDef.newInstance()).thenReturn(c3BubbleChartDisplayer);   \n        \n        when(beanManager.lookupBean(C3MeterChartDisplayer.class)).thenReturn(meterChartDisplayerBeanDef);\n        when(meterChartDisplayerBeanDef.newInstance()).thenReturn(c3MeterChartDisplayer);        \n        \n        settings = mock(DisplayerSettings.class);\n    }\n    \n    @Test\n    public void lookupAreaChartTest() {\n        when(settings.getType()).thenReturn(AREACHART);\n        when(settings.getSubtype()).thenReturn(AREA_STACKED);\n        renderer.lookupDisplayer(settings);\n        verify(c3AreaChartDisplayer).stacked();\n    }\n\n    @Test\n    public void lookupBarChartColumnStacked() {\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(COLUMN_STACKED);\n        renderer.lookupDisplayer(settings);\n        verify(c3BarChartDisplayer).stacked();\n    }\n    \n    @Test\n    public void lookuBarChartColumn() {\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(COLUMN);\n        renderer.lookupDisplayer(settings);\n        verify(c3BarChartDisplayer).notRotated();\n    }\n\n    @Test\n    public void lookupBarChartStacked() {\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(BAR_STACKED);\n        renderer.lookupDisplayer(settings);\n        verify(c3BarChartDisplayer).stackedAndRotated();\n    }\n\n    @Test\n    public void lookupBarChartBar() {\n        when(settings.getType()).thenReturn(BARCHART);\n        when(settings.getSubtype()).thenReturn(BAR);\n        renderer.lookupDisplayer(settings);\n        verify(c3BarChartDisplayer).rotated();\n    }\n    \n    @Test\n    public void lookupLineChart() {\n        when(settings.getType()).thenReturn(LINECHART);\n        when(settings.getSubtype()).thenReturn(LINE);\n        renderer.lookupDisplayer(settings);\n        verify(c3LineChartDisplayer, times(0)).smooth();\n    }\n    \n    @Test\n    public void lookupLineChartSmooth() {\n        when(settings.getType()).thenReturn(LINECHART);\n        when(settings.getSubtype()).thenReturn(SMOOTH);\n        renderer.lookupDisplayer(settings);\n        verify(c3LineChartDisplayer).smooth();\n    }\n    \n    @Test\n    public void lookupPieChart() {\n        when(settings.getType()).thenReturn(PIECHART);\n        when(settings.getSubtype()).thenReturn(PIE);\n        renderer.lookupDisplayer(settings);\n        verify(c3PieChartDisplayer, times(0)).donut();\n    }\n    \n    @Test\n    public void lookupPieChartDonut() {\n        when(settings.getType()).thenReturn(PIECHART);\n        when(settings.getSubtype()).thenReturn(DONUT);\n        renderer.lookupDisplayer(settings);\n        verify(c3PieChartDisplayer).donut();\n    }\n    \n    @Test\n    public void lookupBubbleChart() {\n        when(settings.getType()).thenReturn(BUBBLECHART);\n        renderer.lookupDisplayer(settings);\n        verify(bubbleChartDisplayerBeanDef).newInstance();\n    }\n    \n    @Test\n    public void lookupMeterChart() {\n        when(settings.getType()).thenReturn(METERCHART);\n        renderer.lookupDisplayer(settings);\n        verify(meterChartDisplayerBeanDef).newInstance();\n    }    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/C3ResizableChartTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_AMOUNT;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_DATE;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.renderer.c3.client.charts.line.C3LineChartDisplayer;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class C3ResizableChartTest extends C3BaseTest {\n    \n    private static final int SIZE = 300;\n    \n    private C3LineChartDisplayer displayer;\n\n    @Test\n    public void c3Resizable() {\n        DisplayerSettings resizableSettings = DisplayerSettingsFactory.newBarChartSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM)\n                .width(SIZE)\n                .height(SIZE)\n                .resizableOn(SIZE, SIZE)\n                .buildSettings();\n        displayer = c3LineChartDisplayer(resizableSettings);\n        displayer.draw();\n        C3LineChartDisplayer.View view = displayer.getView();\n        verify(c3Factory, times(0)).c3ChartSize(300, 300);\n        verify(view).setResizable(SIZE, SIZE);\n    }\n    \n    @Test\n    public void c3NotResizable() {\n        DisplayerSettings notResizableSettings = DisplayerSettingsFactory.newBarChartSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM)\n                .width(SIZE)\n                .height(SIZE)\n                .buildSettings();\n        displayer = c3LineChartDisplayer(notResizableSettings);\n        displayer.draw();\n        C3LineChartDisplayer.View view = displayer.getView();\n        verify(c3Factory).c3ChartSize(300, 300);\n        verify(view, times(0)).setResizable(SIZE, SIZE);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/charts/area/C3AreaChartDisplayerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.area;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_AMOUNT;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_DATE;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.any;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.renderer.c3.client.C3BaseTest;\nimport org.dashbuilder.renderer.c3.client.charts.area.C3AreaChartDisplayer.View;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class C3AreaChartDisplayerTest extends C3BaseTest {\n    \n    private static final boolean RECEIVE_NOTIFICATION = true;\n    private static final String LEGEND_POSITION = \"right\";\n    private static final int SIZE = 300;\n    private static final String TITLE = \"Title\";\n    private static final String BLACK = \"black\";\n    \n    DisplayerSettings simpleSettings = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .width(SIZE)\n            .height(SIZE)\n            .title(TITLE)\n            .backgroundColor(BLACK)\n            .titleVisible(true)\n            .legendOn(LEGEND_POSITION)\n            .filterOn(RECEIVE_NOTIFICATION, \n                      RECEIVE_NOTIFICATION, \n                      RECEIVE_NOTIFICATION)\n            .buildSettings();\n    \n    private C3AreaChartDisplayer displayer;\n    \n    @Before \n    public void conf() {\n        displayer = c3AreaChartDisplayer(simpleSettings);\n        displayer.draw();\n    }\n    \n    @Test\n    public void fixAreaCallbackRegisteredTest() {\n        verify(c3Conf).setOnrendered(displayer.fixAreaOpacityCallback);\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/charts/map/D3MapDisplayerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_AMOUNT;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_DATE;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_ID;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\nimport java.text.ParseException;\nimport java.util.Map;\n\nimport org.dashbuilder.dataset.RawDataSet;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.renderer.c3.client.C3BaseTest;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class D3MapDisplayerTest extends C3BaseTest {\n    \n    private static final String COUNTRY_1= \"Country1\";\n    private static final String COUNTRY_2= \"Country2\";\n    \n    private static final Integer VAL_1= 1;\n    private static final Integer VAL_2= 2;\n    private static final String CL_TITLE = \"Title in Column\";\n    private static final String BG_COLOR = \"red\";\n    \n    RawDataSet twoColumnsRawDS = new RawDataSet(\n                new String [] {\"cl\", \"cl2\"},\n                new Class[] {String.class, String.class}, \n                new String[][]{\n                    {COUNTRY_1, VAL_1.toString()},\n                    {COUNTRY_2, VAL_2.toString()}\n                });\n    \n    private D3MapDisplayer displayer;\n    \n    \n    @Before\n    public void conf() {\n        DisplayerSettings noData = DisplayerSettingsFactory.newLineChartSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM, CL_TITLE)\n                .backgroundColor(BG_COLOR)\n                .buildSettings();\n        displayer = d3MapDisplayer(noData);\n        displayer.draw();\n    }\n    \n    @Test\n    public void dataRetrievalTest() throws ParseException {\n        Map<String, Double> data = displayer.retrieveData(twoColumnsRawDS.toDataSet());\n        Double val1 = data.get(COUNTRY_1);\n        assertNotNull(val1);\n        assertEquals(VAL_1.intValue(), val1.intValue());\n    }\n    \n    @Test\n    public void mapConfTest() throws ParseException {\n        displayer.updateVisualizationWithData();\n        D3MapConf conf = displayer.getConf();\n        assertEquals(CL_TITLE, conf.getTitle());\n        assertEquals(BG_COLOR, conf.getBackgroundColor());\n        Mockito.verify(displayer.getView()).createMap(conf);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/charts/map/geojson/impl/CountriesGeoJsonServiceImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.map.geojson.impl;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Optional;\n\nimport jsinterop.base.JsPropertyMap;\nimport org.dashbuilder.renderer.c3.client.charts.map.geojson.GeoJsonLoader;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.Feature;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.FeatureCollection;\nimport org.dashbuilder.renderer.c3.client.jsbinding.geojson.Geometry;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.views.pfly.widgets.D3;\n\nimport static org.dashbuilder.renderer.c3.client.charts.map.geojson.impl.CountriesGeoJsonServiceImpl.COUNTRY_NAME_PROPERTY;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CountriesGeoJsonServiceImplTest {\n\n    private static final String COUNTRY_LOCATION = \"2.0, 1.0\";\n    private static final Double[] LONG_LAT = {1.0, 2.0};\n\n    private static final String COUNTRY_CODE = \"ID\";\n\n    private static final String COUNTRY_NAME = \"Name\";\n\n    @Mock\n    GeoJsonLoader geoJsonLoader;\n\n    @Mock\n    JsPropertyMap<Object> properties;\n\n    @Mock\n    Feature feature;\n\n    @Mock\n    FeatureCollection featureCollection;\n\n    @Mock\n    Geometry geometry;\n\n    @Mock\n    D3 d3;\n\n    @InjectMocks\n    CountriesGeoJsonServiceImpl countriesGeoJsonServiceImpl;\n\n    @Before\n    public void setup() {\n        when(properties.get(COUNTRY_NAME_PROPERTY)).thenReturn(COUNTRY_NAME);\n        when(feature.getProperties()).thenReturn(properties);\n        when(feature.getId()).thenReturn(COUNTRY_CODE);\n        when(featureCollection.getFeatures()).thenReturn(new Feature[]{feature});\n    }\n\n    @Test\n    public void getCountryNameTest() {\n        String countryName = countriesGeoJsonServiceImpl.getCountryName(feature);\n        assertEquals(COUNTRY_NAME, countryName);\n        countryName = countriesGeoJsonServiceImpl.getCountryName(null);\n        assertTrue(countryName.isEmpty());\n    }\n\n    @Test\n    public void getCountryNameByCodeTest() {\n        String countryName = countriesGeoJsonServiceImpl.getCountryNameByCode(COUNTRY_CODE);\n        assertEquals(COUNTRY_NAME, countryName);\n        countryName = countriesGeoJsonServiceImpl.getCountryNameByCode(\"123\");\n        assertTrue(countryName.isEmpty());\n        countryName = countriesGeoJsonServiceImpl.getCountryNameByCode(null);\n        assertTrue(countryName.isEmpty());\n    }\n\n    @Test\n    public void countryByIdOrNameTest() {\n        Optional<Feature> countryByIdOrName = countriesGeoJsonServiceImpl.countryByIdOrName(COUNTRY_CODE);\n        assertTrue(countryByIdOrName.isPresent());\n        assertEquals(feature, countryByIdOrName.get());\n        countryByIdOrName = countriesGeoJsonServiceImpl.countryByIdOrName(COUNTRY_NAME);\n        assertTrue(countryByIdOrName.isPresent());\n        assertEquals(feature, countryByIdOrName.get());\n        countryByIdOrName = countriesGeoJsonServiceImpl.countryByIdOrName(\"123\");\n        assertTrue(!countryByIdOrName.isPresent());\n    }\n\n    @Test\n    public void entryByCountryTest() {\n        Optional<Entry<String, Double>> entryByCountry;\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_NAME, 1d);\n        entryByCountry = countriesGeoJsonServiceImpl.entryByCountry(data, feature);\n        assertTrue(entryByCountry.isPresent());\n        entryByCountry = countriesGeoJsonServiceImpl.entryByCountry(data, null);\n        assertTrue(!entryByCountry.isPresent());\n        entryByCountry = countriesGeoJsonServiceImpl.entryByCountry(new HashMap<>(), feature);\n        assertTrue(!entryByCountry.isPresent());\n    }\n\n    @Test\n    public void valueByCountryTest() {\n        Double val = 1d;\n        Optional<Double> valueByCountry;\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_NAME, val);\n        valueByCountry = countriesGeoJsonServiceImpl.valueByCountry(data, feature);\n        assertTrue(valueByCountry.isPresent());\n        assertEquals(val, valueByCountry.get());\n        valueByCountry = countriesGeoJsonServiceImpl.valueByCountry(data, null);\n        assertFalse(valueByCountry.isPresent());\n        valueByCountry = countriesGeoJsonServiceImpl.valueByCountry(new HashMap<>(), null);\n        assertFalse(valueByCountry.isPresent());\n    }\n\n    @Test\n    public void entryByLocationTest() {\n        when(d3.geoContains(any(), any())).thenReturn(true);\n        Optional<Entry<String, Double>> entryByLocation;\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_LOCATION, 1d);\n        entryByLocation = countriesGeoJsonServiceImpl.entriesByLocation(data, feature).findFirst();\n        ;\n        assertTrue(entryByLocation.isPresent());\n        verify(d3).geoContains(any(), any());\n\n        when(d3.geoContains(any(), any())).thenReturn(false);\n        entryByLocation = countriesGeoJsonServiceImpl.entriesByLocation(data, null).findFirst();\n        assertFalse(entryByLocation.isPresent());\n\n        entryByLocation = countriesGeoJsonServiceImpl.entriesByLocation(new HashMap<>(), feature).findFirst();\n        assertFalse(entryByLocation.isPresent());\n\n        when(d3.geoContains(any(), any())).thenReturn(false);\n        entryByLocation = countriesGeoJsonServiceImpl.entriesByLocation(data, feature).findFirst();\n        assertFalse(entryByLocation.isPresent());\n    }\n\n    @Test\n    public void valueByLocationTest() {\n        when(d3.geoContains(any(), any())).thenReturn(true);\n        Double val = 1d;\n        Optional<Double> valueByLocation;\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_LOCATION, val);\n        valueByLocation = countriesGeoJsonServiceImpl.valueByLocation(data, feature);\n        assertTrue(valueByLocation.isPresent());\n        assertEquals(val, valueByLocation.get());\n        verify(d3).geoContains(feature, LONG_LAT);\n\n        when(d3.geoContains(any(), any())).thenReturn(false);\n        valueByLocation = countriesGeoJsonServiceImpl.valueByLocation(data, null);\n        assertFalse(valueByLocation.isPresent());\n\n        valueByLocation = countriesGeoJsonServiceImpl.valueByLocation(new HashMap<>(), null);\n        assertFalse(valueByLocation.isPresent());\n    }\n\n    @Test\n    public void findCountryWithLocationTest() {\n        when(d3.geoContains(any(), any())).thenReturn(true);\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_LOCATION, 1d);\n        Optional<Feature> findCountry = countriesGeoJsonServiceImpl.findCountry(COUNTRY_LOCATION);\n        assertTrue(findCountry.isPresent());\n        assertEquals(COUNTRY_CODE, findCountry.get().getId());\n        assertEquals(COUNTRY_NAME, countriesGeoJsonServiceImpl.getCountryName(findCountry.get()));\n        verify(d3).geoContains(feature, LONG_LAT);\n    }\n\n    @Test\n    public void findCountryWithCountryNameTest() {\n        Map<String, Double> data = new HashMap<>();\n        data.put(COUNTRY_NAME, 1d);\n        Optional<Feature> findCountry = countriesGeoJsonServiceImpl.findCountry(COUNTRY_NAME);\n        assertTrue(findCountry.isPresent());\n        assertEquals(COUNTRY_CODE, findCountry.get().getId());\n        assertEquals(COUNTRY_NAME, countriesGeoJsonServiceImpl.getCountryName(findCountry.get()));\n        verify(d3, times(0)).geoContains(any(), any());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-c3/src/test/java/org/dashbuilder/renderer/c3/client/charts/meter/C3MeterDisplayerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.c3.client.charts.meter;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_AMOUNT;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_DATE;\nimport static org.dashbuilder.dataset.ExpenseReportsData.COLUMN_ID;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.SUM;\nimport static org.junit.Assert.assertArrayEquals;\nimport static org.junit.Assert.assertEquals;\n\nimport java.text.ParseException;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.RawDataSet;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.renderer.c3.client.C3BaseTest;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class C3MeterDisplayerTest extends C3BaseTest {\n    \n    private static final String CL1 = \"CL1\";\n    private static final String CL2 = \"CL2\";\n    \n    RawDataSet twoColumnsRawDS = new RawDataSet(\n                new String [] {CL1,CL2},\n                new Class[] {String.class, String.class}, \n                new String[][]{\n                    {\"VAL1\", \"1\"},\n                    {\"VAL2\", \"2\"}\n                });\n    \n    RawDataSet oneColumnsRawDS = new RawDataSet(\n                new String [] {CL1},\n                new Class[] {String.class}, \n                new String[][]{\n                    {\"1\"},\n                    {\"2\"}\n                });\n    \n    DisplayerSettings meterSettings = DisplayerSettingsFactory.newMeterChartSettings()\n            .dataset(EXPENSES)\n            .filter(COLUMN_ID, FilterFactory.isNull())\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM).format(\"\",\"0.0000\")\n            .buildSettings();\n    \n    DisplayerSettings meterSettingsOneColumn = DisplayerSettingsFactory.newMeterChartSettings()\n            .dataset(EXPENSES)\n            .filter(COLUMN_ID, FilterFactory.isNull())\n            .column(COLUMN_AMOUNT).format(\"\",\"0.0\")\n            .buildSettings();\n\n    @Test\n    public void c3meterColumnsExtractorsTest() throws ParseException {\n        C3MeterChartDisplayer c3MeterChartDisplayer = c3MeterChartDisplayer(meterSettings);\n        c3MeterChartDisplayer.draw();\n        \n        DataSet twoColumnDS = twoColumnsRawDS.toDataSet();\n        DataSet oneColumnDS = oneColumnsRawDS.toDataSet();\n        \n        DataColumn cl1 = twoColumnDS.getColumnById(CL1);\n        DataColumn cl2 = twoColumnDS.getColumnById(CL2);\n        \n        String[][] valuesWhenUsingGrouping = c3MeterChartDisplayer.extractGroupingValues(cl1, cl2);\n        \n        assertEquals(2, valuesWhenUsingGrouping.length);\n        \n        assertArrayEquals(new String[] {\"VAL1\", \"1\"}, valuesWhenUsingGrouping[0]);\n        assertArrayEquals(new String[] {\"VAL2\", \"2\"}, valuesWhenUsingGrouping[1]);\n        \n        cl1 = oneColumnDS.getColumnById(CL1);\n        \n        String[] singleColumnValues = c3MeterChartDisplayer.extractSingleColumnValues(cl1);\n        \n        assertEquals(3, singleColumnValues.length);\n        \n        assertArrayEquals(new String[] {CL1, \"1\", \"2\"}, singleColumnValues);\n        \n    }\n    \n    @Test\n    public void columnFormatTest() throws ParseException {\n        C3MeterChartDisplayer c3MeterChartDisplayer = c3MeterChartDisplayer(meterSettings);\n        c3MeterChartDisplayer.draw();\n        \n        Object formattedTooltip = c3MeterChartDisplayer.formatTooltip(1l, null, null);\n        assertEquals(\"1.0000\", formattedTooltip);\n        \n        c3MeterChartDisplayer = c3MeterChartDisplayer(meterSettingsOneColumn);\n        c3MeterChartDisplayer.draw();\n        \n        formattedTooltip = c3MeterChartDisplayer.formatTooltip(1l, null, null);\n        assertEquals(\"1.0\", formattedTooltip);\n    }\n    \n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>dashbuilder-renderers</artifactId>\n    <groupId>org.dashbuilder</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>dashbuilder-renderer-chartjs</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Renderer ChartJS</name>\n  <description>Dashbuilder Renderer for the Chart JS API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n\n  </build>\n\n</project>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/ChartJsBarChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.chartjs;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class ChartJsBarChartDisplayer extends ChartJsDisplayer<ChartJsBarChartDisplayer.View> {\n\n    public interface View extends ChartJsDisplayer.View<ChartJsBarChartDisplayer> {\n\n    }\n\n    private View view;\n\n    public ChartJsBarChartDisplayer() {\n        this(new ChartJsBarChartDisplayerView());\n    }\n\n    @Inject\n    public ChartJsBarChartDisplayer(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(10)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[]{\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/ChartJsBarChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.chartjs;\n\nimport org.dashbuilder.renderer.chartjs.lib.BarChart;\nimport org.dashbuilder.renderer.chartjs.lib.Chart;\n\npublic class ChartJsBarChartDisplayerView\n        extends ChartJsDisplayerView<ChartJsBarChartDisplayer>\n        implements ChartJsBarChartDisplayer.View {\n\n    @Override\n    protected Chart createChart() {\n        BarChart chart = new BarChart();\n        if (title != null) {\n            chart.setTitle(title);\n        }\n        String displayerId = getPresenter().getDisplayerId();\n        chart.setTooltipTemplate(\"<%= label %>: <%= window.chartJsFormatValue('\" + displayerId + \"', value, 1) %>\");\n        chart.setMultiTooltipTemplate(\"<%= datasetLabel %>: <%= window.chartJsFormatValue('\" + displayerId + \"', value, 1) %>\");\n        chart.setScaleStepWidth(10);\n        chart.setLegendTemplate(\"<ul class=\\\"<%=name.toLowerCase()%>-legend\\\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\\\"background-color:<%=datasets[i].fillColor%>\\\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul>\");\n        chart.setDataProvider(super.createAreaDataProvider());\n        return chart;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/ChartJsDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.chartjs;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\n\npublic abstract class ChartJsDisplayer<V extends ChartJsDisplayer.View> extends AbstractGwtDisplayer<V> {\n\n    public interface View<P extends ChartJsDisplayer> extends AbstractGwtDisplayer.View<P> {\n\n        void setWidth(int width);\n\n        void setHeight(int height);\n\n        void setMarginTop(int marginTop);\n\n        void setMarginBottom(int marginBottom);\n\n        void setMarginRight(int marginRight);\n\n        void setMarginLeft(int marginLeft);\n\n        void dataClear();\n\n        void dataAddLabel(String label);\n\n        void dataAddSerie(String columnName, String color, double[] values);\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n\n        void setTitle(String title);\n\n        void setFilterEnabled(boolean enabled);\n\n        void clearFilterStatus();\n\n        void addFilterValue(String value);\n\n        void addFilterReset();\n\n        void nodata();\n\n        void drawChart();\n    }\n\n    public static final String[] COLOR_ARRAY = new String[] {\n            \"blue\",\n            \"red\",\n            \"orange\",\n            \"brown\",\n            \"coral\",\n            \"aqua\",\n            \"fuchsia\",\n            \"gold\",\n            \"green\",\n            \"grey\",\n            \"lime\",\n            \"magenta\",\n            \"pink\",\n            \"silver\",\n            \"yellow\"};\n\n    @Override\n    protected void createVisualization() {\n        if (displayerSettings.isTitleVisible()) {\n            getView().setTitle(displayerSettings.getTitle());\n        }\n        getView().setFilterEnabled(displayerSettings.isFilterEnabled());\n        getView().setWidth(displayerSettings.getChartWidth());\n        getView().setHeight(displayerSettings.getChartHeight());\n        getView().setMarginTop(displayerSettings.getChartMarginTop());\n        getView().setMarginBottom(displayerSettings.getChartMarginBottom());\n        getView().setMarginLeft(displayerSettings.getChartMarginLeft());\n        getView().setMarginRight(displayerSettings.getChartMarginRight());\n\n        drawChart();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        updateFilterStatus();\n        drawChart();\n    }\n\n    protected void drawChart() {\n        if (dataSet.getRowCount() == 0) {\n            getView().nodata();\n        } else {\n            pushDataToView();\n            getView().drawChart();\n        }\n    }\n\n    protected void updateFilterStatus() {\n        getView().clearFilterStatus();\n        Set<String> columnFilters = filterColumns();\n        if (displayerSettings.isFilterEnabled() && !columnFilters.isEmpty()) {\n\n            for (String columnId : columnFilters) {\n                List<Interval> selectedValues = filterIntervals(columnId);\n                DataColumn column = dataSet.getColumnById(columnId);\n                for (Interval interval : selectedValues) {\n                    String formattedValue = formatInterval(interval, column);\n                    getView().addFilterValue(formattedValue);\n                }\n            }\n            getView().addFilterReset();\n        }\n    }\n\n    // View notifications\n\n    void onFilterResetClicked() {\n        filterReset();\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    // Data generation\n\n    protected void pushDataToView() {\n\n        getView().dataClear();\n\n        for (int i=0; i<dataSet.getRowCount(); i++) {\n            String label = super.formatValue(i, 0);\n            getView().dataAddLabel(label);\n        }\n\n        List<DataColumn> columns = dataSet.getColumns();\n        for (int i=1; i<columns.size(); i++) {\n            DataColumn seriesColumn = columns.get(0);\n            ColumnSettings columnSettings = displayerSettings.getColumnSettings(seriesColumn);\n            String columnName = columnSettings.getColumnName();\n            String color = COLOR_ARRAY[i - 1];\n\n            double[] values = new double[dataSet.getRowCount()];\n            for (int j=0; j<dataSet.getRowCount(); j++) {\n                values[j] = ((Number) dataSet.getValueAt(j, i)).doubleValue();\n            }\n\n            getView().dataAddSerie(columnName, color, values);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/ChartJsDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.chartjs;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport com.google.gwt.user.client.ui.Anchor;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.renderer.chartjs.lib.Chart;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartData;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartDataProvider;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaSeries;\nimport org.dashbuilder.renderer.chartjs.lib.data.SeriesBuilder;\nimport org.dashbuilder.renderer.chartjs.lib.event.DataSelectionEvent;\nimport org.dashbuilder.renderer.chartjs.lib.event.DataSelectionHandler;\nimport org.dashbuilder.renderer.chartjs.resources.i18n.ChartJsDisplayerConstants;\nimport org.gwtbootstrap3.client.ui.Label;\n\npublic abstract class ChartJsDisplayerView<P extends ChartJsDisplayer>\n        extends AbstractGwtDisplayerView<P>\n        implements ChartJsDisplayer.View<P> {\n\n    private Panel container = new FlowPanel();\n    private Panel filterPanel = new HorizontalPanel();\n    private Panel displayerPanel = new FlowPanel();\n    private HTML titleHtml = new HTML();\n    private Chart chart = null;\n    private List<String> labels = new ArrayList<String>();\n    private JsArray<AreaSeries> series;\n\n    protected boolean filterEnabled = false;\n    protected String title = null;\n    protected int width = 500;\n    protected int height= 300;\n    protected int marginTop = 10;\n    protected int marginBottom = 10;\n    protected int marginRight = 10;\n    protected int marginLeft = 10;\n\n    public void showDisplayer(Widget w) {\n        displayerPanel.clear();\n        displayerPanel.add(w);\n    }\n\n    @Override\n    public void init(P presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(container);\n\n        container.add(titleHtml);\n        container.add(filterPanel);\n        container.add(displayerPanel);\n\n        filterPanel.getElement().setAttribute(\"cellpadding\", \"2\");\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        ChartJsRenderer.closeDisplayer(getPresenter());\n    }\n\n    @Override\n    public void setWidth(int width) {\n        this.width = width;\n    }\n\n    @Override\n    public void setHeight(int height) {\n        this.height = height;\n    }\n\n    @Override\n    public void setMarginTop(int marginTop) {\n        this.marginTop = marginTop;\n    }\n\n    @Override\n    public void setMarginBottom(int marginBottom) {\n        this.marginBottom = marginBottom;\n    }\n\n    @Override\n    public void setMarginRight(int marginRight) {\n        this.marginRight = marginRight;\n    }\n\n    @Override\n    public void setMarginLeft(int marginLeft) {\n        this.marginLeft = marginLeft;\n    }\n\n    @Override\n    public void dataClear() {\n        labels.clear();\n        series =  JavaScriptObject.createArray().cast();\n    }\n\n    @Override\n    public void dataAddLabel(String label) {\n        labels.add(label);\n    }\n\n    @Override\n    public void dataAddSerie(String columnName, String color, double[] values) {\n        series.push(SeriesBuilder.create()\n                .withLabel(columnName)\n                .withFillColor(color)\n                .withStoreColor(color)\n                .withPointColor(color)\n                .withPointStrokeColor(\"#FFFF\")\n                .withData(values)\n                .get());\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return ChartJsDisplayerConstants.INSTANCE.common_Categories();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return ChartJsDisplayerConstants.INSTANCE.common_Series();\n    }\n\n    @Override\n    public void setTitle(String title) {\n        titleHtml.setText(title);\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        this.filterEnabled = enabled;\n    }\n\n    @Override\n    public void clearFilterStatus() {\n        if (filterPanel != null) {\n            filterPanel.clear();\n        }\n    }\n\n    @Override\n    public void addFilterValue(String value) {\n        filterPanel.add(new Label(value));\n    }\n\n    @Override\n    public void addFilterReset() {\n        Anchor anchor = new Anchor(ChartJsDisplayerConstants.INSTANCE.chartjsDisplayer_resetAnchor());\n        filterPanel.add(anchor);\n        anchor.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                getPresenter().onFilterResetClicked();\n            }\n        });\n    }\n\n    @Override\n    public void nodata() {\n        showDisplayer(new Label(ChartJsDisplayerConstants.INSTANCE.common_noData()));\n    }\n\n    @Override\n    public void drawChart() {\n        if (chart == null) {\n            chart = createChart();\n            showDisplayer(chart);\n        }\n        if (filterEnabled) {\n            chart.addDataSelectionHandler(new DataSelectionHandler() {\n                public void onDataSelected(DataSelectionEvent event) {\n                    // TODO\n                    Object o = event.getSource();\n                }\n            });\n        }\n        adjustChartSize(chart);\n        chart.update();\n    }\n\n    // Common methods used in subclasses\n\n    protected Chart createChart() {\n        return null;\n    }\n\n    protected void adjustChartSize(Chart chart) {\n        int chartWidth = width-marginLeft;\n        int chartHeight = height-marginTop;\n\n        chart.getElement().getStyle().setPaddingTop(marginTop, Style.Unit.PX);\n        chart.getElement().getStyle().setPaddingLeft(marginLeft, Style.Unit.PX);\n        chart.setPixelWidth(chartWidth);\n        chart.setPixelHeight(chartHeight);\n    }\n\n    protected AreaChartDataProvider createAreaDataProvider() {\n        return new AreaChartDataProvider() {\n            public JavaScriptObject getData() {\n                return createChartData();\n            }\n            public void reload(AsyncCallback<AreaChartData> callback) {\n                AreaChartData data = createChartData();\n                callback.onSuccess(data);\n            }\n        };\n    }\n\n    protected AreaChartData createChartData() {\n        String[] labelsArray = new String[labels.size()];\n        labels.toArray(labelsArray);\n        AreaChartData data = JavaScriptObject.createObject().cast();\n        data.setLabels(labelsArray);\n        data.setSeries(series);\n        return data;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/ChartJsRenderer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.chartjs;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractRendererLibrary;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.renderer.chartjs.lib.ChartJs;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\nimport static org.dashbuilder.displayer.DisplayerType.*;\n\n/**\n * Chart JS renderer\n */\n@ApplicationScoped\npublic class ChartJsRenderer extends AbstractRendererLibrary {\n\n    public static final String UUID = \"chartjs\";\n\n    @PostConstruct\n    private void init() {\n        publishChartJsFunctions();\n    }\n\n    @Override\n    public String getUUID() {\n        return UUID;\n    }\n\n    @Override\n    public String getName() {\n        return \"Chart JS\";\n    }\n\n    @Override\n    public List<DisplayerType> getSupportedTypes() {\n        return Arrays.asList(BARCHART);\n    }\n\n    @Override\n    public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {\n        switch (displayerType) {\n            case BARCHART:\n                return Arrays.asList(COLUMN);\n            case PIECHART:\n                return Arrays.asList(PIE, DONUT);\n            case AREACHART:\n                return Arrays.asList(AREA);\n            case LINECHART:\n                return Arrays.asList(LINE);\n            default:\n                return Arrays.asList();\n        }\n    }\n\n    @Override\n    public Displayer lookupDisplayer(DisplayerSettings displayerSettings) {\n        ChartJsDisplayer displayer = _lookupDisplayer(displayerSettings);\n        if (displayer != null) {\n            _displayerMap.put(displayerSettings.getUUID(), displayer);\n        }\n        return displayer;\n    }\n\n    protected ChartJsDisplayer _lookupDisplayer(DisplayerSettings displayerSettings) {\n        ChartJs.ensureInjected();\n        DisplayerType type = displayerSettings.getType();\n        if ( DisplayerType.BARCHART.equals(type)) {\n            return new ChartJsBarChartDisplayer();\n        }\n        return null;\n    }\n\n    private native void publishChartJsFunctions() /*-{\n        $wnd.chartJsFormatValue = $entry(@org.dashbuilder.renderer.chartjs.ChartJsRenderer::formatValue(Ljava/lang/String;DI));\n    }-*/;\n\n    protected static Map<String,ChartJsDisplayer> _displayerMap = new HashMap<String, ChartJsDisplayer>();\n\n    public static String formatValue(String displayerId, double value, int column) {\n        ChartJsDisplayer displayer = _displayerMap.get(displayerId);\n        if (displayer == null) return Double.toString(value);\n\n        DataColumn dataColumn = displayer.getDataSetHandler().getLastDataSet().getColumnByIndex(column);\n        return displayer.formatValue(value, dataColumn);\n    }\n\n    public static void closeDisplayer(ChartJsDisplayer displayer) {\n        _displayerMap.remove(displayer.getDisplayerId());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/BarChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartData;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartDataProvider;\n\n\npublic class BarChart extends ChartWithScale {\n\t\n\tprivate AreaChartDataProvider provider;\n\t\n\t@Override\n\tpublic void draw() {\n\t\treload();\n\t\t\n\t}\n\t\n\tprivate native void drawBar(JavaScriptObject data)/*-{\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeElement()();\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeCanvas()();\n        if(nativeCanvas != null) {\n            nativeCanvas.destroy();\n        }\n\n        var options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).Bar(data, options);\n        this.@org.dashbuilder.renderer.chartjs.lib.Chart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\n\t}-*/;\n\n\t@Override\n\tpublic void update() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider is not specified before invoking update()\");\n        drawBar(provider.getData());\n\t}\n\n\t@Override\n\tpublic void reload() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider is not specified before invoking reload()\");\n\n\t\t//TODO : show loading\n\t\tprovider.reload(new AsyncCallback<AreaChartData>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(AreaChartData result) {\n                drawBar(result);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic void setDataProvider(AreaChartDataProvider provider){\n\t\tthis.provider = provider;\n\t}\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/Chart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\nimport com.google.gwt.core.client.JavaScriptObject;\r\nimport com.google.gwt.dom.client.CanvasElement;\r\nimport com.google.gwt.dom.client.Document;\r\nimport com.google.gwt.event.dom.client.ClickEvent;\r\nimport com.google.gwt.event.dom.client.ClickHandler;\r\nimport com.google.gwt.event.dom.client.HasClickHandlers;\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.google.gwt.user.client.Event;\r\nimport com.google.gwt.user.client.ui.Image;\r\nimport com.google.gwt.user.client.ui.SimplePanel;\r\nimport org.dashbuilder.renderer.chartjs.lib.event.*;\r\nimport org.dashbuilder.renderer.chartjs.lib.options.*;\r\nimport org.dashbuilder.renderer.chartjs.lib.resources.ChartStyle;\r\nimport org.dashbuilder.renderer.chartjs.lib.resources.Resources;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\n/**\r\n * Base class for all chart widgets<br/>\r\n * Class describes generic behavior of all chart widgets\r\n */\r\npublic abstract class Chart extends SimplePanel implements HasAnimationCompleteHandlers, HasClickHandlers,HasAnimation, HasDataSelectionEventHandlers, IsResponsive{\r\n\r\n    private static Resources resources;\r\n\r\n    protected LegendOption options = LegendOption.get();\r\n    protected JavaScriptObject nativeCanvas;\r\n\tprivate CanvasElement canvas;\r\n\tprotected ChartStyle style;\r\n    protected List<AnimationCallback> callbackList = new ArrayList<AnimationCallback>();\r\n\t\r\n\t\r\n\tstatic{\r\n\t\tresources = GWT.create(Resources.class);\r\n\t}\r\n\t\r\n\t/**\r\n\t * This constructor creates new chart instance with custom {@link ChartStyle}\r\n\t * @param style - new CssResource used for styling charts\r\n\t */\r\n\tpublic Chart(ChartStyle style){\r\n\t\t//setChartStyle(style);\r\n        registerNativeAnimationHandlers();\r\n\t\tcanvas = Document.get().createCanvasElement();\r\n\t\tgetElement().appendChild(canvas);\r\n        sinkEvents(Event.ONCLICK);\r\n        addClickHandler(new ClickHandler() {\r\n            @Override\r\n            public void onClick(final ClickEvent clickEvent) {\r\n                JavaScriptObject obj = clickEvent.getNativeEvent().cast();\r\n\r\n                JavaScriptObject data = getClickPoints(obj, nativeCanvas);\r\n                if (data != null)\r\n                    DataSelectionEvent.fire(Chart.this, Chart.this, data);\r\n            }\r\n        });\r\n\t}\r\n\t\r\n\t/**\r\n\t * Constructor creates chart with default style\r\n\t */\r\n\tpublic Chart() {\r\n\t\tthis(resources.chartStyle());\r\n\t}\r\n\r\n    private native JavaScriptObject getClickPoints(JavaScriptObject event, JavaScriptObject canvas)/*-{\r\n        if(canvas == null || event == null)\r\n            return null;\r\n        try {\r\n            return canvas.getPointsAtEvent(event);\r\n        }\r\n        catch(e){\r\n            //exception occurred when added additional ClickHandler which destroys chart before processing.\r\n            return null;\r\n        }\r\n    }-*/;\r\n\r\n\t/**\r\n\t * Set new style to the char widget. New style will be injected automatically.<br/>\r\n\t * NOTICE: new style will be applied after re-drawing of chart<br/>\r\n\t * @param style\r\n\t */\r\n\tpublic void setChartStyle(ChartStyle style){\r\n\t\tstyle.ensureInjected();\r\n\t\tsetStylePrimaryName(style.chart());\r\n\t}\r\n\r\n    protected void processEvents(JavaScriptObject object){\r\n        this.nativeCanvas = object;\r\n    }\r\n\r\n\t@Override\r\n\tprotected void onAttach() {\r\n\t\tChartJs.ensureInjected();\r\n\t\tsuper.onAttach();\r\n\t\tdraw();\r\n\t}\r\n\r\n\t/**\r\n\t * Method re-drawing chart widget without re-requesting data from data provider.<br/>\r\n\t * To update data call {@link #reload()} method instead\r\n\t */\r\n\tpublic abstract void update();\r\n\t\r\n\t/**\r\n\t * Method requesting data from data provider and re-drawing chart.\r\n\t */\r\n\tpublic abstract void reload();\r\n\t\r\n\t/**\r\n\t * Method preparing data and invoking native draw method<br/>\r\n\t * This method should not be overridden by sub-classes\r\n\t */\r\n\tprotected abstract void draw();\r\n\t\r\n\t/**\r\n\t * Method sets pixel width of chart area\r\n\t * @param width - width in pixels\r\n\t * TODO: replace it with generic {@link #setWidth(String)} and {@link #setSize(String, String)}\r\n\t */\r\n\tpublic void setPixelWidth(int width) {\r\n\t\tcanvas.setWidth(width);\r\n\t}\r\n\r\n    public void setWidth(String width) {\r\n        canvas.getStyle().setProperty(\"width\", width);\r\n    }\r\n\r\n    public void setHeight(String height){\r\n        canvas.getStyle().setProperty(\"height\", height);\r\n    }\r\n\r\n\t/**\r\n\t * Method sets pixel height of chart area\r\n\t * @param height - height in pixels\r\n\t * TODO: replace it with generic {@link #setHeight(String)} and {@link #setSize(String, String)}\r\n\t */\r\n\tpublic void setPixelHeight(int height) {\r\n\t\tcanvas.setHeight(height);\r\n\t}\r\n\t\r\n\t@Override\r\n\tpublic void addAnimationCompleteHandler(AnimationCompleteHandler handler) {\r\n\t\taddHandler(handler, AnimationCompleteEvent.getType());\r\n\t}\r\n\r\n    /**\r\n     * Creates snapshot of current state of chart as image\r\n     * @return Image object or null if Chart not rendered (or in progress)\r\n     */\r\n    public Image getSnapshot(){\r\n        String code= getBase64Image(nativeCanvas);\r\n        if(code == null)\r\n            return null;\r\n        Image image = new Image(code);\r\n        return image;\r\n    }\r\n\r\n    private native String getBase64Image(JavaScriptObject nativeCanvas)/*-{\r\n        if(nativeCanvas != null)\r\n            return nativeCanvas.toBase64Image();\r\n        return null;\r\n    }-*/;\r\n\r\n    @Override\r\n    /**\r\n     * Important Note : clickHandler added internally by default to handle DataSelectionEvent.\r\n     * In case external clickHandler destroying chart (eg update() method invoked) this will lead\r\n     * to DataSelectionEvent won't be created\r\n     */\r\n    public HandlerRegistration addClickHandler(ClickHandler clickHandler) {\r\n        return addHandler(clickHandler, ClickEvent.getType());\r\n    }\r\n\r\n    @Override\r\n    public HandlerRegistration addDataSelectionHandler(DataSelectionHandler handler) {\r\n        return addHandler(handler, DataSelectionEvent.getType());\r\n    }\r\n\r\n    protected JavaScriptObject getNativeCanvas(){\r\n        return nativeCanvas;\r\n    }\r\n\r\n    protected CanvasElement getNativeElement(){\r\n        return canvas;\r\n    }\r\n\r\n    protected void setNativeCanvas(JavaScriptObject object){\r\n        this.nativeCanvas = object;\r\n        processEvents(object);\r\n    }\r\n\r\n    /**\r\n     * Specify should chart be animated or not\r\n     * Default value is <code>true</code>\r\n     * @param enabled\r\n     */\r\n    public void setAnimationEnabled(boolean enabled){\r\n        if(!enabled) //\"animation\" : false interpreted by chart.js as \"true\"\r\n            options.clearProperty(ANIMATION);\r\n        else\r\n            options.setProperty(ANIMATION, enabled);\r\n    }\r\n\r\n    /**\r\n     * Specify animation easing\r\n     * Default value is {@link org.dashbuilder.renderer.chartjs.lib.options.Type#EASE_OUT_QUART}\r\n     * @param type\r\n     */\r\n    public void setAnimationType(Type type){\r\n        if(type == null)\r\n            options.clearProperty(ANIMATION_EASING);\r\n        else\r\n            options.setProperty(ANIMATION_EASING, type.getValue());\r\n    }\r\n\r\n    /**\r\n     * Add animation callback to handle animation state changes\r\n     * @param callback\r\n     */\r\n    public void addAnimationCallback(AnimationCallback callback){\r\n        if(callback != null)\r\n            callbackList.add(callback);\r\n    }\r\n\r\n    @Override\r\n    public void setAnimationSteps(int steps) {\r\n        if(steps <= 0)\r\n            throw new IndexOutOfBoundsException(\"Number of animation steps should be positive. Found '\"+steps+\"'\");\r\n\r\n        options.setProperty(ANIMATION_STEPS, steps);\r\n    }\r\n\r\n    /**\r\n     * Method returns custom options for chart\r\n     * @return\r\n     */\r\n    protected JavaScriptObject constructOptions(){\r\n        return options;\r\n    }\r\n\r\n    protected native void registerNativeAnimationHandlers()/*-{\r\n        options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\r\n        self = this;\r\n        options.onAnimationProgress = function(progress){\r\n            self.@org.dashbuilder.renderer.chartjs.lib.Chart::onAnimationProgress(D)(progress);\r\n            return;\r\n        }\r\n        options.onAnimationComplete = function(){\r\n            self.@org.dashbuilder.renderer.chartjs.lib.Chart::onAnimationComplete()();\r\n            return;\r\n        }\r\n    }-*/;\r\n\r\n    protected void onAnimationProgress(double progress){\r\n        for(AnimationCallback callback : callbackList){\r\n            if(callback != null)\r\n                callback.onProgress(progress);\r\n        }\r\n    }\r\n\r\n    protected void onAnimationComplete(){\r\n        for(AnimationCallback callback : callbackList){\r\n            if(callback != null)\r\n                callback.onAnimationComplete();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    public void setResponsive(boolean responsive){\r\n        if(!responsive)\r\n            options.clearProperty(RESPONSIVE);\r\n        else\r\n            options.setProperty(RESPONSIVE, true);\r\n    }\r\n\r\n    @Override\r\n    public void setMaintainAspectRatio(boolean aspectRatio){\r\n        if(!aspectRatio)\r\n            options.clearProperty(MAINTAIN_ASPECT_RATIO);\r\n        else\r\n            options.setProperty(MAINTAIN_ASPECT_RATIO, true);\r\n    }\r\n\r\n    public void setLegendTemplate(String template) {\r\n        options.setLegendTemplate(template);\r\n    }\r\n}\r\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/ChartJs.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\r\n\r\nimport com.google.gwt.dom.client.Document;\r\nimport com.google.gwt.dom.client.ScriptElement;\r\nimport org.dashbuilder.renderer.chartjs.lib.resources.Resources;\r\n\r\nimport com.google.gwt.core.client.GWT;\r\n\r\n\r\n/**\r\n * Utility class which helps to inject native chart.js code into browser\r\n */\r\npublic final class ChartJs {\r\n\r\n\tprivate static boolean injected = false;\r\n\t\r\n\t/**\r\n\t * Method injecting native chart.js code into the browser<br/>\r\n\t * In case code already been injected do nothing\r\n\t */\r\n\tpublic static void ensureInjected(){ //TODO: do real injection (lazy loading)\r\n\t\tif(injected)\r\n\t\t\treturn;\r\n\t\tResources res = GWT.create(Resources.class);\r\n\t\tString source = res.chartJsSource().getText();\r\n        ScriptElement scriptElement = Document.get().createScriptElement();\r\n        scriptElement.setId(\"_chartjs\");\r\n        scriptElement.setInnerText(source);\r\n        Document.get().getBody().appendChild(scriptElement);\r\n\t\tinjected = true;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/ChartWithAnimation.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport org.dashbuilder.renderer.chartjs.lib.event.AnimationCompleteEvent;\nimport org.dashbuilder.renderer.chartjs.lib.event.AnimationCompleteHandler;\nimport org.dashbuilder.renderer.chartjs.lib.event.HasAnimationCompleteHandlers;\nimport org.dashbuilder.renderer.chartjs.lib.options.AnimationCallback;\nimport org.dashbuilder.renderer.chartjs.lib.options.HasAnimation;\nimport org.dashbuilder.renderer.chartjs.lib.options.IsResponsive;\nimport org.dashbuilder.renderer.chartjs.lib.options.Type;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic abstract class ChartWithAnimation<T> extends Chart implements IsResponsive, HasAnimation,HasAnimationCompleteHandlers {\n\n    protected List<AnimationCallback> callbackList = new ArrayList<AnimationCallback>();\n\n    public ChartWithAnimation(){\n        super();\n        registerNativeAnimationHandlers();\n    }\n\n\n    @Override\n    public void setResponsive(boolean responsive){\n        if(!responsive)\n            options.clearProperty(RESPONSIVE);\n        else\n            options.setProperty(RESPONSIVE, true);\n    }\n\n    /**\n     * Specify should chart be animated or not\n     * Default value is <code>true</code>\n     * @param enabled\n     */\n    public void setAnimationEnabled(boolean enabled){\n        if(!enabled) //\"animation\" : false interpreted by chart.js as \"true\"\n            options.clearProperty(ANIMATION);\n        else\n            options.setProperty(ANIMATION, enabled);\n    }\n\n    /**\n     * Specify animation easing\n     * Default value is {@link org.dashbuilder.renderer.chartjs.lib.options.Type#EASE_OUT_QUART}\n     * @param type\n     */\n    public void setAnimationType(Type type){\n        if(type == null)\n            options.clearProperty(ANIMATION_EASING);\n        else\n            options.setProperty(ANIMATION_EASING, type.getValue());\n    }\n\n    /**\n     * Add animation callback to handle animation state changes\n     * @param callback\n     */\n    public void addAnimationCallback(AnimationCallback callback){\n        if(callback != null)\n            callbackList.add(callback);\n    }\n\n    @Override\n    public void setAnimationSteps(int steps) {\n        if(steps <= 0)\n            throw new IndexOutOfBoundsException(\"Number of animation steps should be positive. Found '\"+steps+\"'\");\n\n        options.setProperty(ANIMATION_STEPS, steps);\n    }\n\n    @Override\n    public void addAnimationCompleteHandler(AnimationCompleteHandler handler) {\n        addHandler(handler, AnimationCompleteEvent.getType());\n    }\n\n\n    protected void onAnimationProgress(double progress){\n        for(AnimationCallback callback : callbackList){\n            if(callback != null)\n                callback.onProgress(progress);\n        }\n    }\n\n    protected void onAnimationComplete(){\n        for(AnimationCallback callback : callbackList){\n            if(callback != null)\n                callback.onAnimationComplete();\n        }\n    }\n\n    protected native void registerNativeAnimationHandlers()/*-{\n        options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        self = this;\n        options.onAnimationProgress = function(progress){\n            self.@org.dashbuilder.renderer.chartjs.lib.Chart::onAnimationProgress(D)(progress);\n            return;\n        }\n        options.onAnimationComplete = function(){\n            self.@org.dashbuilder.renderer.chartjs.lib.Chart::onAnimationComplete()();\n            return;\n        }\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/ChartWithScale.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.dom.client.Style;\nimport org.dashbuilder.renderer.chartjs.lib.options.HasScale;\n\npublic abstract class ChartWithScale extends ChartWithTooltip implements HasScale{\n\n    @Override\n    public void showScale(boolean scale) {\n        if(!scale)\n            options.clearProperty(SHOWSCALE);\n        else\n            options.setProperty(SHOWSCALE, true);\n    }\n\n    @Override\n    public void setScaleOverride(boolean override) {\n        if(!override)\n            options.clearProperty(SCALEOVERRIDE);\n        else\n            options.setProperty(SCALEOVERRIDE, override);\n    }\n\n    @Override\n    public void setScaleSteps(int steps) {\n        options.setProperty(SCALESTEPS, steps);\n    }\n\n    @Override\n    public void setScaleStepWidth(int width) {\n        options.setProperty(SCALESTEPWIDTH, width);\n    }\n\n    @Override\n    public void setScaleStartValue(double startValue) {\n        options.setProperty(SCALESTARTVALUE, startValue);\n    }\n\n    @Override\n    public void setScaleLineColor(String color) {\n        options.setProperty(SCALELINECOLOR, color);\n    }\n\n    @Override\n    public void setScaleLineWidth(int pixelWidth) {\n        options.setProperty(SCALELINEWIDTH, pixelWidth);\n    }\n\n    @Override\n    public void setScaleShowLabels(boolean showLabels) {\n        if(!showLabels)\n            options.clearProperty(SCALESHOWLABELS);\n        else\n            options.setProperty(SCALESHOWLABELS, true);\n    }\n\n    @Override\n    public void setScaleLabel(String template) {\n        options.setProperty(SCALELABEL, template);\n    }\n\n    @Override\n    public void setScaleIntegersOnly(boolean only) {\n        if(!only)\n            options.clearProperty(SCALEINTEGERSONLY);\n        else\n            options.setProperty(SCALEINTEGERSONLY, only);\n    }\n\n    @Override\n    public void setScaleBeginAtZero(boolean beginAtZero) {\n        options.setProperty(SCALEBEGINATZERO, beginAtZero);\n    }\n\n    @Override\n    public void setScaleFontFamily(String fontFamily) {\n        options.setProperty(SCALEFONTFAMILY, fontFamily);\n    }\n\n    @Override\n    public void setScaleFontSize(int size) {\n        options.setProperty(SCALEFONTSIZE, size);\n    }\n\n    @Override\n    public void setScaleFontStyle(Style.FontStyle style) {\n        options.setProperty(SCALEFONTSTYLE, style.getCssName());\n    }\n\n    @Override\n    public void setScaleFontColor(String color) {\n        options.setProperty(SCALEFONTCOLOR, color);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/ChartWithTooltip.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\nimport org.dashbuilder.renderer.chartjs.lib.options.HasTooltip;\n\n/**\n * Adds tooltip configurations to Chart object\n */\npublic abstract class ChartWithTooltip extends Chart implements HasTooltip{\n\n    @Override\n    public void setTooltipEvents(Event... events) {\n        String[] eventsString = new String[events.length];\n        for(int i=0;i<events.length;i++){\n            eventsString[i] = events[i].getType();\n        }\n        options.setArrayProperty(TOOLTIPEVENTS, eventsString);\n    }\n\n    @Override\n    public void setTooltipFillColor(String color) {\n        options.setProperty(TOOLTIPFILLCOLOR, color);\n    }\n\n    @Override\n    public void showTooltips(boolean show) {\n        if(!show)\n            options.clearProperty(SHOWTOOLTIPS);\n        else\n            options.setProperty(SHOWTOOLTIPS, show);\n    }\n\n    @Override\n    public void setTooltipFontFamily(String fontFamily) {\n        options.setProperty(TOOLTIPFONTFAMILY, fontFamily);\n    }\n\n    @Override\n    public void setTooltipFontSize(int fontSize) {\n        options.setProperty(TOOLTIPFONTSIZE, fontSize);\n    }\n\n    @Override\n    public void setTooltipFontStyle(Style.FontStyle fontStyle) {\n        options.setProperty(TOOLTIPFONTSTYLE, fontStyle.getCssName());\n    }\n\n    @Override\n    public void setTooltipFontColor(String color) {\n        options.setProperty(TOOLTIPFONTCOLOR, color);\n    }\n\n    @Override\n    public void setTooltipTitleFontFamily(String fontFamily) {\n        options.setProperty(TOOLTIPTITLEFONTFAMILY, fontFamily);\n    }\n\n    @Override\n    public void setTooltipTitleFontSize(int size) {\n        options.setProperty(TOOLTIPTITLEFONTSIZE, size);\n    }\n\n    @Override\n    public void setTooltipTitleFontStyle(Style.FontStyle style) {\n        options.setProperty(TOOLTIPTITLEFONTSTYLE, style.getCssName());\n    }\n\n    @Override\n    public void setTooltipTitleFontColor(String color) {\n        options.setProperty(TOOLTIPTITLEFONTCOLOR, color);\n    }\n\n    @Override\n    public void setTooltipYPadding(int padding) {\n        options.setProperty(TOOLTIPYPADDING, padding);\n    }\n\n    @Override\n    public void setTooltipXPadding(int padding) {\n        options.setProperty(TOOLTIPXPADDING, padding);\n    }\n\n    @Override\n    public void setCornerRadius(int radius) {\n        options.setProperty(TOOLTIPCORNERRADIUS, radius);\n    }\n\n    @Override\n    public void setTooltipCaretSize(int size) {\n        options.setProperty(TOOLTIPCARETSIZE, size);\n    }\n\n    @Override\n    public void setTooltipXOffset(int offset) {\n        options.setProperty(TOOLTIPXOFFSET, offset);\n    }\n\n    @Override\n    public void setTooltipTemplate(String template) {\n        options.setProperty(TOOLTIPTEMPLATE, template);\n    }\n\n    @Override\n    public void setMultiTooltipTemplate(String template) {\n        options.setProperty(MULTITOOLTIPTEMPLATE, template);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/DoughnutChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport org.dashbuilder.renderer.chartjs.lib.data.PieChartDataProvider;\nimport org.dashbuilder.renderer.chartjs.lib.data.Series;\n\n\npublic class DoughnutChart extends ChartWithScale {\n\t\n\tprivate PieChartDataProvider provider;\n\t\n\t@Override\n\tpublic void draw() {\n\t\treload();\n\t\t\n\t}\n\t\n\tprivate native void drawDoughnut(JavaScriptObject data)/*-{\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeElement()();\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeCanvas()();\n        if(nativeCanvas != null) {\n            nativeCanvas.destroy();\n        }\n\n        var options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).Doughnut(data, options);\n        this.@org.dashbuilder.renderer.chartjs.lib.Chart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\n\n\n\t}-*/;\n\n\t@Override\n\tpublic void update() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider is not initialized before invoking update()\");\n\t\tdrawDoughnut(provider.getData());\n\t}\n\n\t@Override\n\tpublic void reload() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider is not initialized before invoking reload()\");\n\t\t\n\t\t//TODO: show loading\n\t\tprovider.reload(new AsyncCallback<JsArray<Series>>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(JsArray<Series> result) {\n                drawDoughnut(result);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic void setDataProvider(PieChartDataProvider provider){\n\t\tthis.provider = provider;\n\t}\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/LineChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\r\n\r\nimport com.google.gwt.core.client.JavaScriptObject;\r\nimport com.google.gwt.user.client.rpc.AsyncCallback;\r\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartData;\r\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartDataProvider;\r\n\r\n\r\n\r\n\r\npublic class LineChart extends ChartWithScale {\r\n\r\n\tprivate AreaChartDataProvider provider = null;\r\n\r\n\r\n\t@Override\r\n\tpublic void draw() {\r\n\t\treload();\r\n\t}\r\n\t\r\n\tprivate native void drawLine(JavaScriptObject data)/*-{\r\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.LineChart::getNativeElement()();\r\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.LineChart::getNativeCanvas()();\r\n        if(nativeCanvas != null) {\r\n            nativeCanvas.destroy();\r\n        }\r\n\r\n        var options = this.@org.dashbuilder.renderer.chartjs.lib.LineChart::constructOptions()();\r\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).Line(data,options);\r\n        this.@org.dashbuilder.renderer.chartjs.lib.LineChart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\r\n\t}-*/;\r\n\r\n\t@Override\r\n\tpublic void update() {\r\n\t\tif(provider == null)\r\n\t\t\tthrow new NullPointerException(\"Data provider is not specified before calling update()\");\r\n        drawLine(provider.getData());\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void reload() {\r\n\t\tif(provider == null)\r\n\t\t\tthrow new NullPointerException(\"Data provider is not specified before calling reload()\");\r\n\t\t//TODO: show some king of loading to user\r\n\t\tprovider.reload(new AsyncCallback<AreaChartData>() {\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void onSuccess(AreaChartData result) {\r\n                drawLine(result);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t@Override\r\n\t\t\tpublic void onFailure(Throwable caught) {\r\n\t\t\t\t//TODO: show loading error to user \r\n\t\t\t}\r\n\t\t});\r\n\t}\r\n\t\r\n\tpublic void setDataProvider(AreaChartDataProvider provider){\r\n\t\tthis.provider = provider;\r\n\t}\r\n}\r\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/PieChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport org.dashbuilder.renderer.chartjs.lib.data.PieChartDataProvider;\nimport org.dashbuilder.renderer.chartjs.lib.data.Series;\n\n\npublic class PieChart extends ChartWithScale {\n\t\n\tprivate PieChartDataProvider provider;\n\t\n\t@Override\n\tpublic void draw() {\n\t\treload();\n\t}\n\t\n\tprivate native void drawPie(JavaScriptObject data)/*-{\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeElement()();\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeCanvas()();\n        if(nativeCanvas != null) {\n            nativeCanvas.destroy();\n        }\n\n        options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).Pie(data,options);\n        this.@org.dashbuilder.renderer.chartjs.lib.Chart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\n\t}-*/;\n\n\t@Override\n\tpublic void update() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieChartDataProvider not initialized before invoking update()\");\n        drawPie(provider.getData());\n\t}\n\n\t@Override\n\tpublic void reload() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieChartDataProvider not initialized before invoking update()\");\n\t\t\n\t\t//TODO: show loading\n\t\tprovider.reload(new AsyncCallback<JsArray<Series>>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(JsArray<Series> result) {\n                drawPie(provider.getData());\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic void setDataProvider(PieChartDataProvider provider){\n\t\tthis.provider = provider;\n\t}\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/PolarAreaChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport org.dashbuilder.renderer.chartjs.lib.data.PieChartDataProvider;\nimport org.dashbuilder.renderer.chartjs.lib.data.Series;\n\n\npublic class PolarAreaChart extends ChartWithScale {\n\t\n\tprivate PieChartDataProvider provider;\n\t\n\t@Override\n\tpublic void draw() {\n\t\treload();\n\t}\n\t\n\tprivate native void drawPolarArea(JavaScriptObject data)/*-{\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeElement()();\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeCanvas()();\n        if(nativeCanvas != null) {\n            nativeCanvas.destroy();\n        }\n\n        var options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).PolarArea(data,options);\n        this.@org.dashbuilder.renderer.chartjs.lib.Chart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\n\t}-*/;\n\n\t@Override\n\tpublic void update() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieChartDataProvider is not initialized before invoking update()\");\n        drawPolarArea(provider.getData());\n\t}\n\n\t@Override\n\tpublic void reload() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieChartDataProvider is not initialized before invoking reload()\");\n\t\t\n\t\t\n\t\t//TODO: show loading to user\n\t\t\n\t\tprovider.reload(new AsyncCallback<JsArray<Series>>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(JsArray<Series> result) {\n                drawPolarArea(provider.getData());\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic void setDataProvider(PieChartDataProvider provider){\n\t\tthis.provider = provider;\n\t}\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/RadarChart.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartData;\nimport org.dashbuilder.renderer.chartjs.lib.data.AreaChartDataProvider;\n\n\npublic class RadarChart extends ChartWithScale {\n\t\n\tprivate AreaChartDataProvider provider;\n\tprivate boolean scaleShowLabels = false;\n\t\n\t@Override\n\tpublic void draw() {\n\t\treload();\n\t}\n\t\n\tpublic void setScaleShowLabels(boolean scaleShowLabels){\n\t\tthis.scaleShowLabels = scaleShowLabels;\n\t}\n\t\n\tprivate native void drawRadar(JavaScriptObject data)/*-{\n        canvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeElement()();\n        nativeCanvas = this.@org.dashbuilder.renderer.chartjs.lib.Chart::getNativeCanvas()();\n        if(nativeCanvas != null) {\n            nativeCanvas.destroy();\n        }\n\n        var options = this.@org.dashbuilder.renderer.chartjs.lib.Chart::constructOptions()();\n        if(options == null)\n            options = {scaleShowLabels : true, pointLabelFontSize : 10};\n        nativeCanvas = new $wnd.Chart(canvas.getContext(\"2d\")).Radar(data,options);\n        this.@org.dashbuilder.renderer.chartjs.lib.Chart::setNativeCanvas(Lcom/google/gwt/core/client/JavaScriptObject;)(nativeCanvas);\n\t}-*/;\n\n\t@Override\n\tpublic void update() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider was not initialized before invoking update()\");\n\n        drawRadar(provider.getData());\n\t}\n\n\t@Override\n\tpublic void reload() {\n\t\tif(provider == null)\n\t\t\tthrow new NullPointerException(\"PieCharDataProvider was not initialized before invoking reload()\");\n\t\t\n\t\t//TODO: show loading..\n\t\t\n\t\tprovider.reload(new AsyncCallback<AreaChartData>() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSuccess(AreaChartData result) {\n                drawRadar(result);\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\t\t});\n\t}\n\t\n\tpublic void setDataProvider(AreaChartDataProvider provider){\n\t\tthis.provider = provider;\n\t}\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/AreaChartData.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.core.client.JsArrayString;\n\npublic class AreaChartData extends JavaScriptObject{\n\n\tprotected AreaChartData(){\n\t}\n\t\n\tpublic final void setLabels(String[] labels){\n\t\tJsArrayString array = JsArrayString.createArray().cast();\n\t\tfor(String str : labels)\n\t\t\tarray.push(str);\n\t\tsetLabels(array);\n\t}\n\t\n\tprivate final native void setLabels(JsArrayString labels) /*-{\n\t\tthis.labels = labels;\n\t}-*/;\n\n\tpublic final native JsArray<AreaSeries> getSeries() /*-{\n\t\treturn this.datasets;\n\t}-*/;\n\n\tpublic final native void setSeries(JsArray<AreaSeries> series) /*-{\n\t\tthis.datasets = series;\n\t}-*/;\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/AreaChartDataProvider.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\n\npublic interface AreaChartDataProvider {\n\t\n\tpublic JavaScriptObject getData();\n\t\n\tpublic void reload(AsyncCallback<AreaChartData> callback);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/AreaSeries.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArrayNumber;\n\n\npublic class AreaSeries extends JavaScriptObject{\n\t\n\tprotected AreaSeries() {\n\t}\n\t\n\tpublic final native String getFillColor() /*-{\n\t\treturn this.fillColor;\n\t}-*/;\n\t\n\tpublic final native void setFillColor(String fillColor) /*-{\n\t\tthis.fillColor = fillColor;\n\t}-*/;\n\n\tpublic final native String getStrokeColor() /*-{\n\t\treturn this.strokeColor;\n\t}-*/;\n\n\tpublic final native void setStrokeColor(String strokeColor) /*-{\n\t\tthis.strokeColor = strokeColor;\n\t}-*/;\n\n\tpublic final native String getPointColor() /*-{\n\t\treturn this.pointColor;\n\t}-*/;\n\n\tpublic final native void setPointColor(String printColor) /*-{\n\t\tthis.pointColor = printColor;\n\t}-*/;\n\n\tpublic final native String getPointStrokeColor() /*-{\n\t\treturn this.pointStrokeColor;\n\t}-*/;\n\n\tpublic final native void setPointStrokeColor(String pointStrokeColor) /*-{\n\t\tthis.pointStrokeColor = pointStrokeColor;\n\t}-*/;\n\n\tpublic final native String[] getData() /*-{\n\t\treturn this.data;\n\t}-*/;\n\n    public final native void setLabel(String label)/*-{\n        this.label = label;\n    }-*/;\n\n    public final native String getLabel()/*-{\n        return this.label;\n    }-*/;\n\n\tpublic final void setData(double[] data){\n\t\tJsArrayNumber array = JsArrayNumber.createArray().cast();\n\t\tfor(double str : data)\n\t\t\tarray.push(str);\n\t\tsetData(array);\n\t}\n\t\n\tprivate final native void setData(JsArrayNumber data) /*-{\n\t\tthis.data = data;\n\t}-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/ChartDataProvider.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.user.client.rpc.AsyncCallback;\n\nimport java.util.List;\n\npublic abstract class ChartDataProvider<T>{\n\n    protected List<T> data;\n\n    public List<T> getData(){\n        return data;\n    }\n\n    public void setData(List<T> data){\n        this.data = data;\n    }\n\n    public abstract void update(AsyncCallback<Void> callback);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/Data.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Data storage used for Pie, Radar charts\n */\npublic class Data extends JavaScriptObject{\n\n    protected Data() {\n    }\n\n    public final native void setValue(double value)/*-{\n        this.value = value;\n    }-*/;\n    public final native double setValue()/*-{\n        return this.value;\n    }-*/;\n\n    public final native void setColor(String color)/*-{\n        this.color = color;\n    }-*/;\n    public final native String setColor()/*-{\n        return this.color;\n    }-*/;\n\n    public final native void setHighlighColor(String color)/*-{\n        this.highlightColor = color;\n    }-*/;\n    public final native String setHighlighColor()/*-{\n        return this.highlightColor;\n    }-*/;\n\n    public final native void setLabel(String label)/*-{\n        this.label = label;\n    }-*/;\n    public final native String setLabel()/*-{\n        return this.label;\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/Dataset.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Set of data which used for constructing Line/Bar charts\n */\npublic class Dataset extends JavaScriptObject{\n\n    protected Dataset() {\n    }\n\n    public final native void setLabel(String label)/*-{\n        this.label = label;\n    }-*/;\n\n    public final native String getLabel()/*-{\n        return this.label;\n    }-*/;\n\n    public final native void setFillColor(String fillColor)/*-{\n        this.fillColor = fillColor;\n    }-*/;\n\n    public final native String getFillColor()/*-{\n        return this.fillColor;\n    }-*/;\n\n    public final native void setStrokeColor(String strokeColor)/*-{\n        this.strokeColor = strokeColor;\n    }-*/;\n    public final native String getStrokeColor()/*-{\n        return  this.strokeColor;\n    }-*/;\n\n    public final native void setPointColor(String pointColor)/*-{\n        this.pointColor = pointColor;\n    }-*/;\n    public final native String getPointColor()/*-{\n        return this.pointColor;\n    }-*/;\n\n    public final native void setPointStrokeColor(String pointStrokeColor)/*-{\n        this.pointStrokeColor = pointStrokeColor;\n    }-*/;\n    public final native String getPointStrokeColor()/*-{\n        return this.pointStrokeColor;\n    }-*/;\n\n    public final native void setPointHighlightFill(String pointHighlightFill)/*-{\n        this.pointHighlightFill = pointHighlightFill;\n    }-*/;\n    public final native String getPointHighlightFill()/*-{\n        return this.pointHighlightFill;\n    }-*/;\n\n    public final native void setPointHighlightStroke(String pointHighlightStroke)/*-{\n        this.pointHighlightStroke = pointHighlightStroke;\n    }-*/;\n    public final native String getPointHighlightStroke()/*-{\n        return this.pointHighlightStroke;\n    }-*/;\n\n    public final native void setData(double[] data)/*-{\n        this.data = data;\n    }-*/;\n    public final native double[] getData()/*-{\n        return this.data;\n    }-*/;\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/LineChartData.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic class LineChartData extends JavaScriptObject{\n\n    protected LineChartData() {\n    }\n\n    public final native void setLabels(String[] label)/*-{\n        this.labels = labels;\n    }-*/;\n\n    public final native void addLabel(String label)/*-{\n        labels.push(label);\n    }-*/;\n\n    public final native String[] getLabels()/*-{\n        return this.labels;\n    }-*/;\n\n    public final native void setDataset(Dataset[] dataset)/*-{\n        this.datasets = dataset;\n    }-*/;\n\n    public final native Dataset[] getDataset()/*-{\n        return this.datasets;\n    }-*/;\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/PieChartDataProvider.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.user.client.rpc.AsyncCallback;\n\npublic interface PieChartDataProvider {\n\t\n\tpublic JsArray<Series> getData();\n\t\n\tpublic void reload(AsyncCallback<JsArray<Series>> callback);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/RadarChartData.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic class RadarChartData extends JavaScriptObject{\n\n    protected RadarChartData() {\n    }\n\n    public final native void setData(Data[] data)/*-{\n        this.data = data;\n    }-*/;\n\n    public final native void getData()/*-{\n        return this.data;\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/Series.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n\npublic class Series extends JavaScriptObject{\n\t\n\tprotected Series() {\n\t}\n\t\n\tpublic final native double getValue() /*-{\n\t\treturn this.value;\n\t}-*/;\n\t\n\tpublic final native void setValue(double value) /*-{\n\t\tthis.value = value;\n\t}-*/;\n\n\tpublic final native String getColor() /*-{\n\t\treturn this.color;\n\t}-*/;\n\n\tpublic final native void setColor(String color) /*-{\n\t\tthis.color = color;\n\t}-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/data/SeriesBuilder.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.data;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic class SeriesBuilder {\n\t\n\tprivate AreaSeries series = null;\n\t\n\tprivate SeriesBuilder(){\n\t\tseries = JavaScriptObject.createObject().cast();\n\t}\n\t\n\tpublic static SeriesBuilder create(){\n\t\treturn new SeriesBuilder();\n\t}\n\n    public SeriesBuilder withLabel(String label){\n        series.setLabel(label);\n        return this;\n    }\n\n\tpublic SeriesBuilder withFillColor(String fillColor){\n\t\tseries.setFillColor(fillColor);\n\t\treturn this;\n\t}\n\t\n\tpublic SeriesBuilder withStoreColor(String strokeColor){\n\t\tseries.setStrokeColor(strokeColor);\n\t\treturn this;\n\t}\n\t\n\tpublic SeriesBuilder withPointColor(String pointColor){\n\t\tseries.setPointColor(pointColor);\n\t\treturn this;\n\t}\n\n\tpublic SeriesBuilder withPointStrokeColor(String pointStrokeColor){\n\t\tseries.setPointStrokeColor(pointStrokeColor);\n\t\treturn this;\n\t}\n\t\n\tpublic SeriesBuilder withData(double[] data){\n\t\tseries.setData(data);\n\t\treturn this;\n\t}\n\t\n\tpublic AreaSeries get(){\n\t\treturn series;\n\t}\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/AnimationCompleteEvent.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport org.dashbuilder.renderer.chartjs.lib.Chart;\n\nimport com.google.gwt.event.shared.GwtEvent;\n\n/**\n * Class represents event occurred when {@link Chart} animation has been finished\n */\npublic class AnimationCompleteEvent extends GwtEvent<AnimationCompleteHandler>{\n\n\tprivate static Type<AnimationCompleteHandler> TYPE = new Type<AnimationCompleteHandler>();\n\t\n\tprivate Object sender;\n\t\n\tprotected AnimationCompleteEvent(Object sender){\n\t\tthis.sender = sender;\n\t}\n\n\tpublic Object getSender(){\n\t\treturn sender;\n\t}\n\t\n\t@Override\n\tpublic com.google.gwt.event.shared.GwtEvent.Type<AnimationCompleteHandler> getAssociatedType() {\n\t\treturn TYPE;\n\t}\n\t\n\tpublic static Type<AnimationCompleteHandler> getType(){\n\t\treturn TYPE;\n\t}\n\n\t@Override\n\tprotected void dispatch(AnimationCompleteHandler handler) {\n\t\thandler.onAnimationComplete(this);\n\t}\n\n\t  public static void fire(HasAnimationCompleteHandlers source, Object sender) {\n\t\t  AnimationCompleteEvent event = new AnimationCompleteEvent(sender);\n\t\t  source.fireEvent(event);\n\t  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/AnimationCompleteHandler.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport com.google.gwt.event.shared.EventHandler;\n\n/**\n * Handler interface for handling {@link AnimationCompleteEvent}\n */\npublic interface AnimationCompleteHandler extends EventHandler{\n\n\t/**\n\t * Method will be invoked when animation is complete\n\t * @param event : object contains reference to the instance of chart\n\t */\n\tpublic void onAnimationComplete(AnimationCompleteEvent event);\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/DataSelectionEvent.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.event.shared.GwtEvent;\nimport com.google.gwt.json.client.JSONArray;\nimport com.google.gwt.json.client.JSONObject;\nimport com.google.gwt.json.client.JSONParser;\nimport com.google.gwt.json.client.JSONValue;\nimport org.dashbuilder.renderer.chartjs.lib.data.Series;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\npublic class DataSelectionEvent extends GwtEvent<DataSelectionHandler> {\n\n    private static Type<DataSelectionHandler> TYPE = new Type<DataSelectionHandler>();\n\n    private Object sender;\n    private LinkedList<Series> series;\n\n    protected DataSelectionEvent(Object sender){\n        this.sender = sender;\n    }\n\n    public Object getSender(){\n        return sender;\n    }\n\n    @Override\n    public com.google.gwt.event.shared.GwtEvent.Type<DataSelectionHandler> getAssociatedType() {\n        return TYPE;\n    }\n\n    public static Type<DataSelectionHandler> getType(){\n        return TYPE;\n    }\n\n    @Override\n    protected void dispatch(DataSelectionHandler handler) {\n        handler.onDataSelected(this);\n    }\n\n    public static void fire(HasDataSelectionEventHandlers source, Object sender, JavaScriptObject data) {\n        DataSelectionEvent event = new DataSelectionEvent(sender);\n        JSONObject array = new JSONObject(data);\n        event.series = new LinkedList<Series>();\n        for(String key : array.keySet()){\n\n            JSONObject obj = array.get(key).isObject();\n            if(obj != null){\n                Series series1 = JavaScriptObject.createObject().cast();\n                series1.setValue(obj.get(\"value\").isNumber().doubleValue());\n                series1.setColor(obj.get(\"fillColor\").isString().stringValue());\n                event.series.add(series1);\n            }\n        }\n        source.fireEvent(event);\n    }\n\n    public List<Series> getSeries(){\n        return series;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/DataSelectionHandler.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport com.google.gwt.event.shared.EventHandler;\n\n/**\n * Handler interface for handling {@link org.dashbuilder.renderer.chartjs.lib.event.AnimationCompleteEvent}\n */\npublic interface DataSelectionHandler extends EventHandler{\n\n\t/**\n\t * Method will be invoked when animation is complete\n\t * @param event : object contains reference to the instance of chart\n\t */\n\tpublic void onDataSelected(DataSelectionEvent event);\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/HasAnimationCompleteHandlers.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport com.google.gwt.event.shared.HasHandlers;\n\n/**\n * Interface describe methods required for adding new handlers of {@link AnimationCompleteEvent}\n */\npublic interface HasAnimationCompleteHandlers extends HasHandlers{\n\n\t/**\n\t * Add {@link AnimationCompleteEvent} handler to widget.\n\t * @param handler\n\t */\n\tpublic void addAnimationCompleteHandler(AnimationCompleteHandler handler);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/event/HasDataSelectionEventHandlers.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.event;\n\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.event.shared.HasHandlers;\n\n/**\n * Interface describe methods required for adding new handlers of {@link org.dashbuilder.renderer.chartjs.lib.event.AnimationCompleteEvent}\n */\npublic interface HasDataSelectionEventHandlers extends HasHandlers{\n\n\t/**\n\t * Add {@link org.dashbuilder.renderer.chartjs.lib.event.AnimationCompleteEvent} handler to widget.\n\t * @param handler\n\t */\n\tpublic HandlerRegistration addDataSelectionHandler(DataSelectionHandler handler);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/AnimationCallback.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\n/**\n * Callback used to handle animation state changes for charts\n */\npublic interface AnimationCallback {\n\n    /**\n     * Method will be invoked during animation in progress\n     * @param progress - from 0 to 1\n     */\n    public void onProgress(double progress);\n\n    /**\n     * Method will be invoked when animation complete\n     */\n    public void onAnimationComplete();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/ChartOption.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Simple container for chart options\n */\npublic class ChartOption extends JavaScriptObject{\n\n    protected ChartOption(){\n        super();\n    }\n\n    public static ChartOption get(){\n        return JavaScriptObject.createObject().cast();\n    }\n\n    public final native void setProperty(String key, Object value)/*-{\n        this[key] = value;\n    }-*/;\n\n    public final native void clearProperty(String key)/*-{\n        this[key] = null;\n    }-*/;\n\n    public final native void appendTo(JavaScriptObject parent)/*-{\n        for(var key in this) parent[key]=this[key];\n    }-*/;\n\n    public final native void setArrayProperty(String key, Object[] value)/*-{\n        this[key] = value;\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/HasAnimation.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\n/**\n * Enum contains types of easing of chart animation\n */\npublic interface HasAnimation{\n\n    final String ANIMATION = \"animation\";\n    final String ANIMATION_STEPS = \"animationSteps\";\n    final String ANIMATION_EASING = \"animationEasing\";\n\n\n    /**\n     * Specify should chart be animated or not\n     * Default value is <code>true</code>\n     * @param enabled\n     */\n    public void setAnimationEnabled(boolean enabled);\n\n    /**\n     * Particularly specify quality of animation\n     * Default value is 60\n     * @param steps\n     */\n    public void setAnimationSteps(int steps);\n\n    /**\n     * Specify animation easing\n     * Default value is {@link Type#EASE_OUT_QUART}\n     * @param type\n     */\n    public void setAnimationType(Type type);\n\n    /**\n     * Add animation callback to handle animation state changes\n     * @param callback\n     */\n    public void addAnimationCallback(AnimationCallback callback);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/HasScale.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\nimport com.google.gwt.dom.client.Style;\n\npublic interface HasScale {\n\n    final String SHOWSCALE = \"showScale\";\n    final String SCALEOVERRIDE = \"scaleOverride\";\n    final String SCALESTEPS = \"scaleSteps\";\n    final String SCALESTEPWIDTH = \"scaleStepWidth\";\n    final String SCALESTARTVALUE = \"scaleStartValue\";\n    final String SCALELINECOLOR = \"scaleLineColor\";\n    final String SCALELINEWIDTH = \"scaleLineWidth\";\n    final String SCALESHOWLABELS = \"scaleShowLabels\";\n    final String SCALELABEL = \"scaleLabel\";\n    final String SCALEINTEGERSONLY = \"scaleIntegersOnly\";\n    final String SCALEBEGINATZERO = \"scaleBeginAtZero\";\n    final String SCALEFONTFAMILY = \"scaleFontFamily\";\n    final String SCALEFONTSIZE = \"scaleFontSize\";\n    final String SCALEFONTSTYLE = \"scaleFontStyle\";\n    final String SCALEFONTCOLOR = \"scaleFontColor\";\n\n    /**\n     * Default true\n     */\n    public void showScale(boolean scale);\n\n    /**\n     * Default false\n     */\n    public void setScaleOverride(boolean override);\n\n    /**\n     * Scale steps\n     * Default null\n     */\n    public void setScaleSteps(int steps);\n\n    /**\n     * Default null\n     */\n    public void setScaleStepWidth(int width);\n\n    /**\n     * Double\n     */\n    public void setScaleStartValue(double startValue);\n\n    /**\n     *\n     */\n    public void setScaleLineColor(String color);\n\n    /**\n     * Default 1\n     */\n    public void setScaleLineWidth(int pixelWidth);\n\n    /**\n     * true\n     */\n    public void setScaleShowLabels(boolean showLabels);\n\n    /**\n     * Default <code>\"<%=value%>\"</code>\n     */\n    public void setScaleLabel(String template);\n\n    /**\n     * Default true\n     */\n    public void setScaleIntegersOnly(boolean only);\n\n    /**\n     * Default false\n     */\n    public void setScaleBeginAtZero(boolean beginAtZero);\n\n    /**\n     * Default \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\"\n     */\n    public void setScaleFontFamily(String fontFamily);\n\n    /**\n     * Default 12\n     */\n    public void setScaleFontSize(int size);\n\n    /**\n     * Default normal\n     */\n    public void setScaleFontStyle(Style.FontStyle style);\n\n    /**\n     * Default #666\n     */\n    public void setScaleFontColor(String color);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/HasTooltip.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Event;\n\n/**\n * Interface describes options available for configuring tooltips for Chart\n */\npublic interface HasTooltip {\n\n    final String SHOWTOOLTIPS = \"showTooltips\";\n    final String TOOLTIPEVENTS = \"tooltipEvents\";\n    final String TOOLTIPFILLCOLOR = \"tooltipFillColor\";\n    final String TOOLTIPFONTFAMILY = \"tooltipFontFamily\";\n    final String TOOLTIPFONTSIZE = \"tooltipFontSize\";\n    final String TOOLTIPFONTSTYLE = \"tooltipFontStyle\";\n    final String TOOLTIPFONTCOLOR = \"tooltipFontColor\";\n    final String TOOLTIPTITLEFONTFAMILY = \"tooltipTitleFontFamily\";\n    final String TOOLTIPTITLEFONTSIZE = \"tooltipTitleFontSize\";\n    final String TOOLTIPTITLEFONTSTYLE = \"tooltipTitleFontStyle\";\n    final String TOOLTIPTITLEFONTCOLOR = \"tooltipTitleFontColor\";\n    final String TOOLTIPYPADDING = \"tooltipYPadding\";\n    final String TOOLTIPXPADDING = \"tooltipXPadding\";\n    final String TOOLTIPCARETSIZE = \"tooltipCaretSize\";\n    final String TOOLTIPCORNERRADIUS = \"tooltipCornerRadius\";\n    final String TOOLTIPXOFFSET = \"tooltipXOffset\";\n    final String TOOLTIPTEMPLATE = \"tooltipTemplate\";\n    final String MULTITOOLTIPTEMPLATE = \"multiTooltipTemplate\";\n\n    /**\n     * Specify event on which tooltip should be shown\n     * By default {@link com.google.gwt.user.client.Event#ONMOUSEMOVE},\n     * {@link com.google.gwt.user.client.Event#ONTOUCHSTART},\n     * {@link com.google.gwt.user.client.Event#ONTOUCHMOVE}\n     *\n     */\n    public void setTooltipEvents(Event...events);\n\n    /**\n     * Specify tooltip background color in String representation of CSS property (like red or #FFFFFF or rgb(0,0,0) etc)\n     *\n     * Default rgba(0,0,0,.8)\n     * @param color\n     */\n    public void setTooltipFillColor(String color);\n\n    /**\n     * Indicates should tooltips been shown or not\n     *\n     * Default value is true\n     * @param show\n     */\n    public void showTooltips(boolean show);\n\n    /**\n     * Specify font family which will be used for label\n     * Default one \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\"\n     */\n    public void setTooltipFontFamily(String fontFamily);\n\n    /**\n     * Specify font-size of tooltip label\n     * @param fontSize\n     */\n    public void setTooltipFontSize(int fontSize);\n\n    /**\n     * Default is {@link com.google.gwt.dom.client.Style.FontStyle#NORMAL}\n     * @param fontStyle\n     */\n    public void setTooltipFontStyle(Style.FontStyle fontStyle);\n\n    /**\n     * Color of tooltip font\n     * Default is #FFF\n     * @param color\n     */\n    public void setTooltipFontColor(String color);\n\n    /**\n     * Font-family for tooltip title\n     *\n     * Default one is \"'Helvetica Neue', 'Helvetica', 'Arial', sans-serif\"\n     * @param fontFamily\n     */\n    public void setTooltipTitleFontFamily(String fontFamily);\n\n    /**\n     *\n     *\n     * Default 14\n     * @param size\n     */\n    public void setTooltipTitleFontSize(int size);\n\n    /**\n     * Default is {@link com.google.gwt.dom.client.Style.FontStyle#FONT_WEIGHT_BOLD}\n     * @param style\n     */\n    public void setTooltipTitleFontStyle(Style.FontStyle style);\n\n    /**\n     *\n     * Default is #fff\n     * @param color\n     */\n    public void setTooltipTitleFontColor(String color);\n\n    /**\n     * Default is 6\n     * @param padding\n     */\n    public void setTooltipYPadding(int padding);\n\n    /**\n     * Default is 6\n     * @param padding\n     */\n    public void setTooltipXPadding(int padding);\n\n    /**\n     *\n     * Default is 6\n     * @param radius\n     */\n    public void setCornerRadius(int radius);\n\n    /**\n     * Default 8\n     * @param size\n     */\n    public void setTooltipCaretSize(int size);\n\n    /**\n     * Default 10\n     * @param offset\n     */\n    public void setTooltipXOffset(int offset);\n\n    /**\n     * Default <code>\"<%if (label){%><%=label%>: <%}%><%= value %>\"</code>\n     * @param template\n     */\n    public void setTooltipTemplate(String template);\n\n    /**\n     * Default <code>\"<%= value %>\"</code>\n     * @param template\n     */\n    public void setMultiTooltipTemplate(String template);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/IsResponsive.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\npublic interface IsResponsive {\n\n    final String RESPONSIVE = \"responsive\";\n    final String MAINTAIN_ASPECT_RATIO = \"maintainAspectRatio\";\n\n    public void setResponsive(boolean responsive);\n\n    public void setMaintainAspectRatio(boolean aspectRatio);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/LegendOption.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic class LegendOption extends ChartOption{\n\n    protected LegendOption(){\n        super();\n    }\n\n    public static LegendOption get(){\n        return JavaScriptObject.createObject().cast();\n    }\n\n    /**\n     * Template String of legend widget.\n     * For example <code><ul class=\\\"<%=name.toLowerCase()%>-legend\\\"><% for (var i=0; i<datasets.length; i++){%><li><span style=\\\"background-color:<%=datasets[i].points[0].x%>\\\"></span><%if(datasets[i].label){%><%=datasets[i].label%><%}%></li><%}%></ul></code>\n     * @param template\n     */\n    public final native void setLegendTemplate(String template)/*-{\n        this.legendTemplate = template;\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/options/Type.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.options;\n\npublic enum Type {\n    LINEAR(\"linear\"),\n    EASE_IN_QUAD(\"easeInQuad\"),\n    EASE_OUT_QUAD(\"easeOutQuad\"),\n    EASE_IN_OUT_QUAD(\"easeInOutQuad\"),\n    EASE_IN_CUBIC(\"easeInCubic\"),\n    EASE_OUT_CUBIC(\"easeOutCubic\"),\n    EASE_IN_OUT_CUBIC(\"easeInOutCubic\"),\n    EASE_IN_QUART(\"easeInQuart\"),\n    EASE_OUT_QUART(\"easeOutQuart\"),\n    EASE_IN_OUT_QUART(\"easeInOutQuart\"),\n    EASE_IN_QUINT(\"easeInQuint\"),\n    EASE_OUT_QUINT(\"easeOutQuint\"),\n    EASE_IN_OUT_QUINT(\"easeInOutQuint\"),\n    EASE_IN_SINE(\"easeInSine\"),\n    EASE_OUT_SINE(\"easeOutSine\"),\n    EASE_IN_OUT_SINE(\"easeInOutSine\"),\n    EASE_IN_EXPO(\"easeInExpo\"),\n    EASE_OUT_EXPO(\"easeOutExpo\"),\n    EASE_IN_OUT_EXPO(\"easeInOutExpo\"),\n    EASE_IN_CIRC(\"easeInCirc\"),\n    EASE_OUT_CIRC(\"easeOutCirc\"),\n    EASE_IN_OUT_CIRC(\"easeInOutCirc\"),\n    EASE_IN_BACK(\"easeInBack\"),\n    EASE_OUT_BACK(\"easeOutBack\"),\n    EASE_IN_OUT_BACK(\"easeInOutBack\"),\n    EASE_IN_BOUNCE(\"easeInBounce\"),\n    EASE_OUT_BOUNCE(\"easeOutBounce\"),\n    EASE_IN_OUT_BOUNCE(\"easeInOutBounce\");\n\n    private String value;\n\n    private Type(String value){\n        this.value = value;\n    }\n\n    /**\n     * @return - javascript name of easing function (used in native chart.js code)\n     */\n    public String getValue(){\n        return value;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/resources/ChartStyle.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface ChartStyle extends CssResource{\n\n\t/**\n\t * Style for chart area (applied to div wrapper of canvas element)\n\t * @return\n\t */\n\tString chart();\n\t\n\t/**\n\t * Style of default series\n\t * @return\n\t */\n\tString defaultSeries();\n\t\n\tString series1();\n\t\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/resources/Resources.java",
    "content": "package org.dashbuilder.renderer.chartjs.lib.resources;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\n/**\n * Class contains resources required for chart library\n */\npublic interface Resources extends ClientBundle{\n\t\n\t/**\n\t * Contains text representation of native chart.js code\n\t */\n\t@Source(\"js/chart.min.js\")\n\tTextResource chartJsSource();\n\t\n\t/**\n\t * Default style required for chart styling\n\t */\n\t@Source(\"js/chart.css\")\n\tChartStyle chartStyle();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/lib/resources/js/chart.css",
    "content": "@CHARSET \"UTF-8\";\r\n\r\n.chart {\r\n\tdisplay: inline-block;\r\n}\r\n\r\n.chart .defaultSeries {\r\n\t\r\n}\r\n\r\n.chart .series1 {\r\n\t\r\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/java/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.chartjs.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface ChartJsDisplayerConstants extends Messages {\n\n    public static final ChartJsDisplayerConstants INSTANCE = GWT.create( ChartJsDisplayerConstants.class );\n\n    String common_Categories();\n\n    String common_Series();\n\n    String common_Values();\n\n    String common_Value();\n\n    String common_Locations();\n\n    String common_Rows();\n\n    String common_Columns();\n\n    String common_noData();\n\n    String chartjsDisplayer_resetAnchor();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.renderer.chartjs.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/ChartJsRenderer.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"com.google.gwt.json.JSON\"/>\n\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path='chartjs'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categories\ncommon_Series=Series\ncommon_Values=Values\ncommon_Value=Value\ncommon_Locations=Locations\ncommon_Rows=Rows\ncommon_Columns=Columns\ncommon_noData=No data\n\nchartjsDisplayer_resetAnchor=reset"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_de.properties",
    "content": "common_Categories=Kategorien\ncommon_Series=Serien\ncommon_Values=Werte\ncommon_Value=Wert\ncommon_Locations=Speicherorte\ncommon_Rows=Reihen\ncommon_Columns=Spalten\ncommon_noData=Keine Daten\nchartjsDisplayer_resetAnchor=zurücksetzen\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorías\ncommon_Series=Serie\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Ubicaciones\ncommon_Rows=Filas\ncommon_Columns=Columnas\ncommon_noData=No hay datos\n\nchartjsDisplayer_resetAnchor=restablecer"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Catégories\ncommon_Series=Séries\ncommon_Values=Valeurs\ncommon_Value=Valeur\ncommon_Locations=Sites\ncommon_Rows=Lignes\ncommon_Columns=Colonnes\ncommon_noData=Aucune donnée\n\nchartjsDisplayer_resetAnchor=réinitialiser"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorie\ncommon_Series=Serie\ncommon_Values=Valori\ncommon_Value=Valore\ncommon_Locations=Posizioni\ncommon_Rows=Righe\ncommon_Columns=Colonne\ncommon_noData=Nessun dato\n\nchartjsDisplayer_resetAnchor=reset"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=カテゴリ\ncommon_Series=シリーズ\ncommon_Values=値\ncommon_Value=値\ncommon_Locations=場所\ncommon_Rows=行\ncommon_Columns=カラム\ncommon_noData=データなし\n\nchartjsDisplayer_resetAnchor=リセット"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_pt_BR.properties",
    "content": "common_Categories=Categorias\ncommon_Series=Séries\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Locais\ncommon_Rows=Linhas\ncommon_Columns=Colunas\ncommon_noData=Nenhum dado\nchartjsDisplayer_resetAnchor=reiniciar\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-chartjs/src/main/resources/org/dashbuilder/renderer/chartjs/resources/i18n/ChartJsDisplayerConstants_zh_CN.properties",
    "content": "common_Categories=类别\ncommon_Series=序列\ncommon_Values=值\ncommon_Value=值\ncommon_Locations=位置\ncommon_Rows=行\ncommon_Columns=列\ncommon_noData=没有数据\nchartjsDisplayer_resetAnchor=重置\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-renderers</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-renderer-default</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Default Renderer</name>\n  <description>Dashbuilder Default Renderer</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-table</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/DefaultRenderer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractRendererLibrary;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.renderer.client.external.ExternalComponentDisplayer;\nimport org.dashbuilder.renderer.client.metric.MetricDisplayer;\nimport org.dashbuilder.renderer.client.selector.SelectorDisplayer;\nimport org.dashbuilder.renderer.client.selector.SelectorDropDownDisplayer;\nimport org.dashbuilder.renderer.client.selector.SelectorLabelSetDisplayer;\nimport org.dashbuilder.renderer.client.selector.SelectorSliderDisplayer;\nimport org.dashbuilder.renderer.client.table.TableDisplayer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\nimport static org.dashbuilder.displayer.DisplayerType.*;\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\n\n/**\n * Default renderer\n */\n@ApplicationScoped\npublic class DefaultRenderer extends AbstractRendererLibrary {\n\n    public static final String UUID = \"default\";\n\n    @Inject\n    protected SyncBeanManager beanManager;\n\n    @PostConstruct\n    private void init() {\n        publishJsFunctions();\n    }\n\n    @Override\n    public String getUUID() {\n        return UUID;\n    }\n\n    @Override\n    public String getName() {\n        return \"GWT Core\";\n    }\n\n    @Override\n    public boolean isDefault(DisplayerType type) {\n        return TABLE.equals(type) ||\n                SELECTOR.equals(type) ||\n                METRIC.equals(type) ||\n                EXTERNAL_COMPONENT.equals(type);\n    }\n\n    @Override\n    public List<DisplayerType> getSupportedTypes() {\n        return Arrays.asList(\n                TABLE,\n                SELECTOR,\n                METRIC,\n                EXTERNAL_COMPONENT);\n    }\n\n    @Override\n    public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {\n        switch (displayerType) {\n            case METRIC:\n                return Arrays.asList(METRIC_CARD, METRIC_CARD2, METRIC_QUOTA, METRIC_PLAIN_TEXT);\n            case SELECTOR:\n                return Arrays.asList(SELECTOR_DROPDOWN, SELECTOR_LABELS, SELECTOR_SLIDER);\n            default:\n                return Collections.emptyList();\n        }\n    }\n\n    @Override\n    public Displayer lookupDisplayer(DisplayerSettings displayerSettings) {\n        DisplayerType type = displayerSettings.getType();\n        DisplayerSubType subtype = displayerSettings.getSubtype();\n\n        if (TABLE.equals(type)) {\n            return  beanManager.lookupBean(TableDisplayer.class).newInstance();\n        }\n        if (SELECTOR.equals(type)) {\n            if (SELECTOR_DROPDOWN.equals(subtype)) {\n                return beanManager.lookupBean(SelectorDropDownDisplayer.class).newInstance();\n            }\n            if (SELECTOR_LABELS.equals(subtype)) {\n                return beanManager.lookupBean(SelectorLabelSetDisplayer.class).newInstance();\n            }\n            if (SELECTOR_SLIDER.equals(subtype)) {\n                return beanManager.lookupBean(SelectorSliderDisplayer.class).newInstance();\n            }\n            // Keep backward compatibility with 0.6 and prior versions\n            return beanManager.lookupBean(SelectorDisplayer.class).newInstance();\n        }\n        if (METRIC.equals(type)) {\n            MetricDisplayer displayer = beanManager.lookupBean(MetricDisplayer.class).newInstance();\n            _metricDisplayerMap.put(displayer.getView().getUniqueId(), displayer);\n            return displayer;\n        }\n        \n        if (EXTERNAL_COMPONENT.equals(type)) {\n            return beanManager.lookupBean(ExternalComponentDisplayer.class).newInstance();\n        }\n\n        return null;\n    }\n\n    private native void publishJsFunctions() /*-{\n        $wnd.metricDisplayerDoFilter = $entry(@org.dashbuilder.renderer.client.DefaultRenderer::metricDisplayerDoFilter(Ljava/lang/String;));\n    }-*/;\n\n    protected static Map<String,MetricDisplayer> _metricDisplayerMap = new HashMap<>();\n\n    public static void metricDisplayerDoFilter(String displayerId) {\n        MetricDisplayer displayer = _metricDisplayerMap.get(displayerId);\n        if (displayer != null) {\n            displayer.updateFilter();\n        }\n    }\n\n    public static void closeDisplayer(String displayerId) {\n        _metricDisplayerMap.remove(displayerId);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/external/ExternalComponentDisplayer.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.external;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayer;\nimport org.dashbuilder.displayer.client.widgets.ExternalComponentPresenter;\nimport org.dashbuilder.displayer.external.ExternalColumn;\nimport org.dashbuilder.displayer.external.ExternalColumnSettings;\nimport org.dashbuilder.displayer.external.ExternalComponentMessage;\nimport org.dashbuilder.displayer.external.ExternalComponentMessageHelper;\nimport org.dashbuilder.displayer.external.ExternalDataSet;\nimport org.dashbuilder.displayer.external.ExternalFilterRequest;\n\n@Dependent\npublic class ExternalComponentDisplayer extends AbstractErraiDisplayer<ExternalComponentDisplayer.View> {\n\n    public interface View extends AbstractErraiDisplayer.View<ExternalComponentDisplayer> {\n\n        void setSize(int chartWidth, int chartHeight);\n\n        void setMargin(int chartMarginTop, int chartMarginRight, int chartMarginBottom, int chartMarginLeft);\n\n        void setFilterLabelSet(FilterLabelSet widget);\n\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    ExternalComponentPresenter externalComponentPresenter;\n\n    @Inject\n    FilterLabelSet filterLabelSet;\n\n    @Inject\n    ExternalComponentMessageHelper messageHelper;\n\n    private String componentId;\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setFilterLabelSet(filterLabelSet);\n        this.filterLabelSet.setOnClearAllCommand(this::onFilterClearAll);\n        externalComponentPresenter.setFilterConsumer(this::receiveFilterRequest);\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints().setGroupAllowed(true)\n                                                                                   .setGroupRequired(false)\n                                                                                   .setExtraColumnsAllowed(true)\n                                                                                   .setGroupsTitle(\"Groups\")\n                                                                                   .setColumnsTitle(\"Columns\");\n\n        return new DisplayerConstraints(lookupConstraints).supportsAttribute(DisplayerAttributeDef.TYPE)\n                                                          .supportsAttribute(DisplayerAttributeDef.EXTERNAL_COMPONENT_ID)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_WIDTH)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_HEIGHT)\n                                                          .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    }\n\n    @Override\n    protected void createVisualization() {\n        ExternalComponentMessage init = initMessage();\n        externalComponentPresenter.sendMessage(init);\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        String currentComponentId = displayerSettings.getComponentId();\n        if (currentComponentId != null && !currentComponentId.equals(componentId)) {\n            componentId = currentComponentId;\n            String partitionId = displayerSettings.getComponentPartition();\n            if (partitionId != null) {\n                externalComponentPresenter.withComponent(componentId, partitionId);\n            } else {\n                externalComponentPresenter.withComponent(componentId);\n            }\n        }\n\n        ExternalComponentMessage message = dataSetMessage();\n        externalComponentPresenter.sendMessage(message);\n\n        view.setSize(displayerSettings.getChartWidth(), displayerSettings.getChartHeight());\n        \n        view.setMargin(displayerSettings.getChartMarginTop(),\n                       displayerSettings.getChartMarginRight(),\n                       displayerSettings.getChartMarginBottom(),\n                       displayerSettings.getChartMarginLeft());\n        updateFilterStatus();\n    }\n\n    private ExternalComponentMessage dataSetMessage() {\n        Map<String, Object> componentProperties = new HashMap<>(displayerSettings.getComponentProperties());\n        ExternalDataSet ds = ExternalDataSet.of(buildColumns(),\n                                                buildData(dataSet));\n        return messageHelper.newDataSetMessage(ds, componentProperties);\n    }\n\n    private ExternalComponentMessage initMessage() {\n        Map<String, Object> componentProperties = new HashMap<>(displayerSettings.getComponentProperties());\n        return messageHelper.newInitMessage(componentProperties);\n    }\n\n    private ExternalColumn[] buildColumns() {\n        return dataSet.getColumns()\n                      .stream()\n                      .map(this::buildExternalColumn)\n                      .toArray(ExternalColumn[]::new);\n    }\n\n    public ExternalComponentPresenter getExternalComponentPresenter() {\n        return externalComponentPresenter;\n    }\n\n    public String[][] buildData(DataSet ds) {\n        List<DataColumn> columns = ds.getColumns();\n        int rows = columns.get(0).getValues().size();\n        int cols = columns.size();\n        String[][] result = new String[rows][];\n        for (int i = 0; i < rows; i++) {\n            String[] line = new String[cols];\n            for (int j = 0; j < cols; j++) {\n                line[j] = getEvaluatedValue(ds, i, j);\n            }\n            result[i] = line;\n        }\n        return result;\n    }\n\n    @Override\n    protected void afterClose() {\n        super.afterClose();\n        externalComponentPresenter.destroy();\n    }\n\n    protected String columnValueToString(Object mightBeNull) {\n        return mightBeNull == null ? \"\" : mightBeNull.toString();\n    }\n\n    protected ExternalColumn buildExternalColumn(DataColumn cl) {\n        ColumnSettings clSettings = displayerSettings.getColumnSettings(cl);\n        ExternalColumnSettings settings = ExternalColumnSettings.of(clSettings.getColumnId(),\n                                                                    clSettings.getColumnName(),\n                                                                    clSettings.getValueExpression(),\n                                                                    clSettings.getEmptyTemplate(),\n                                                                    clSettings.getValuePattern());\n        return ExternalColumn.of(cl.getId(),\n                                 cl.getColumnType().name(),\n                                 settings);\n\n    }\n\n    protected void updateFilterStatus() {\n        filterLabelSet.clear();\n        Set<String> columnFilters = filterColumns();\n        if (displayerSettings.isFilterEnabled() && !columnFilters.isEmpty()) {\n\n            for (String columnId : columnFilters) {\n                List<Interval> selectedValues = filterIntervals(columnId);\n                DataColumn column = dataSet.getColumnById(columnId);\n                for (Interval interval : selectedValues) {\n                    String formattedValue = formatInterval(interval, column);\n                    FilterLabel filterLabel = filterLabelSet.addLabel(formattedValue);\n                    filterLabel.setOnRemoveCommand(() -> onFilterLabelRemoved(columnId, interval.getIndex()));\n                }\n            }\n        }\n    }\n\n    protected void onFilterLabelRemoved(String columnId, int row) {\n        super.filterUpdate(columnId, row);\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    protected void onFilterClearAll() {\n        super.filterReset();\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    private void receiveFilterRequest(ExternalFilterRequest filterRequest) {\n        if (displayerSettings.isFilterEnabled()) {\n            if (filterRequest.isReset()) {\n                super.filterReset();\n            } else {\n                DataColumn column = dataSet.getColumnByIndex(filterRequest.getColumn());\n                super.filterUpdate(column.getId(), filterRequest.getRow());\n            }\n            updateFilterStatus();\n        }\n    }\n\n    private String getEvaluatedValue(DataSet ds, int i, int j) {\n        String value = columnValueToString(ds.getValueAt(i, j));\n        try {\n            String columnId = ds.getColumnByIndex(j).getId();\n            ColumnSettings settings = displayerSettings.getColumnSettings(columnId);\n            String expression = settings.getValueExpression();\n            if (!StringUtils.isBlank(expression)) {\n                return getEvaluator().evalExpression(value, expression);\n            }\n        } catch (Exception e) {\n            DomGlobal.console.log(\"Error evaluating value at \" + i + \",\" + j);\n        }\n        return value;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/external/ExternalComponentDisplayerView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div data-field=\"externalComponentDisplayerRoot\">\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/external/ExternalComponentDisplayerView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.external;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.CSSProperties.HeightUnionType;\nimport elemental2.dom.CSSProperties.MarginUnionType;\nimport elemental2.dom.CSSProperties.WidthUnionType;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayerView;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class ExternalComponentDisplayerView extends AbstractErraiDisplayerView<ExternalComponentDisplayer>\n                                            implements ExternalComponentDisplayer.View {\n\n    @Inject\n    @DataField\n    HTMLDivElement externalComponentDisplayerRoot;\n\n    @Inject\n    Elemental2DomUtil domUtil;\n\n    private HTMLElement externalComponentView;\n\n    @Override\n    public void init(ExternalComponentDisplayer presenter) {\n        super.setPresenter(presenter);\n        externalComponentView = Js.cast(presenter.getExternalComponentPresenter().getView().asWidget().getElement());\n        externalComponentDisplayerRoot.appendChild(externalComponentView);\n        super.setVisualization(Js.cast(externalComponentDisplayerRoot));\n    }\n\n    @Override\n    public org.jboss.errai.common.client.dom.HTMLElement getElement() {\n        return Js.cast(externalComponentDisplayerRoot);\n    }\n\n    @Override\n    public void setSize(int chartWidth, int chartHeight) {\n        externalComponentDisplayerRoot.style.width = WidthUnionType.of(asPixel(chartWidth));\n        externalComponentDisplayerRoot.style.height = HeightUnionType.of(asPixel(chartHeight));\n    }\n\n    @Override\n    public void setMargin(int top, int right, int bottom, int left) {\n        externalComponentDisplayerRoot.style.margin = MarginUnionType.of(String.join(\" \",\n                                                                                     asPixel(top),\n                                                                                     asPixel(right),\n                                                                                     asPixel(bottom),\n                                                                                     asPixel(left)));\n    }\n    \n    private String asPixel(int value) {\n        return value + \"px\";\n    }\n\n    @Override\n    public void setFilterLabelSet(FilterLabelSet widget) {\n        org.jboss.errai.common.client.dom.HTMLElement element = widget.getElement();\n        element.getStyle().setProperty(\"position\", \"absolute\");\n        element.getStyle().setProperty(\"z-index\", \"20\");\n        externalComponentDisplayerRoot.insertBefore(Js.cast(element), externalComponentView);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/metric/MetricDisplayer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.metric;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringTemplateBuilder;\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\nimport org.dashbuilder.displayer.client.resources.i18n.DisplayerConstants;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.HasHtmlTemplate;\nimport org.dashbuilder.displayer.client.widgets.sourcecode.HasJsTemplate;\n\n@Dependent\npublic class MetricDisplayer extends AbstractGwtDisplayer<MetricDisplayer.View>\n        implements HasHtmlTemplate, HasJsTemplate {\n\n    public interface View extends AbstractGwtDisplayer.View<MetricDisplayer> {\n\n        String getUniqueId();\n\n        void setHtml(String html);\n\n        void eval(String js);\n\n        String getNoDataString();\n\n        String getColumnsTitle();\n    }\n\n    public static final List<String> TEMPLATE_KEYS = Arrays.asList(\"value.raw\", \"value\", \"title\",\n            \"width\", \"height\", \"marginTop\", \"marginBottom\", \"marginRight\", \"marginLeft\", \"bgColor\",\n            \"isFilterEnabled\", \"isFilterOn\", \"isEmpty\", \"doFilter\");\n\n    public static final String DEFAULT_HTML_TEMPLATE = \"<div id=\\\"${this}\\\" class=\\\"card-pf card-pf-accented card-pf-aggregate-status\\\" \" +\n            \"style=\\\"background-color:${bgColor}; width:${width}px; height:${height}px; \" +\n            \"margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;\\\">\\n\" +\n            \"  <h3>${title}</h3>\\n\" +\n            \"  <h2>${value}</h2>\\n\" +\n            \"</div>\";\n\n    public static final String DEFAULT_JS_TEMPLATE = \"if (${isFilterEnabled}) {  \\n\" +\n            \"  var filterOn = false;\\n\" +\n            \"  ${this}.style.cursor=\\\"pointer\\\";\\n\" +\n            \"\\n\" +\n            \"  ${this}.onmouseover = function() {\\n\" +\n            \"    if (!filterOn) ${this}.style.backgroundColor = \\\"lightblue\\\";\\n\" +\n            \"  };\\n\" +\n            \"  ${this}.onmouseout = function() {\\n\" +\n            \"    if (!filterOn) ${this}.style.backgroundColor = \\\"${bgColor}\\\";\\n\" +\n            \"  };\\n\" +\n            \"  ${this}.onclick = function() {\\n\" +\n            \"    filterOn = !filterOn;\\n\" +\n            \"    ${this}.style.backgroundColor = filterOn ? \\\"lightblue\\\" : \\\"${bgColor}\\\";\\n\" +\n            \"    ${doFilter};\\n\" +\n            \"  };\\n\" +\n            \"}\";\n\n    protected View view;\n    protected boolean filterOn = false;\n    protected StringTemplateBuilder codeBuilder = new StringTemplateBuilder();\n\n    @Inject\n    public MetricDisplayer(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupAllowed(false)\n                .setMaxColumns(1)\n                .setMinColumns(1)\n                .setFunctionRequired(true)\n                .setExtraColumnsAllowed(false)\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.METER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.HTML_GROUP);\n    }\n\n    @Override\n    protected void createVisualization() {\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        String template = getHtmlTemplate();\n        String html = parseHtmlTemplate(template);\n        view.setHtml(html);\n\n        // Invoke the onDraw JS callback if defined\n        String onDrawJs = getJsTemplate();\n        if (onDrawJs != null) {\n            onDrawJs = parseJsTemplate(onDrawJs);\n            view.eval(onDrawJs);\n        }\n    }\n\n    public String parseHtmlTemplate(String str) {\n        parseTemplate(str);\n\n        // Replace the extra keys with a reference to a displayer-bounded identifier\n        for (String key : codeBuilder.keys()) {\n            if (!TEMPLATE_KEYS.contains(key)) {\n                String id = getExtraKeyId(key);\n                codeBuilder.replace(key, id);\n            }\n        }\n        return codeBuilder.build();\n    }\n\n    public String parseJsTemplate(String str) {\n        parseTemplate(str);\n\n        // Replace the extra keys with a reference to its DOM element\n        for (String key : codeBuilder.keys()) {\n            if (!TEMPLATE_KEYS.contains(key)) {\n                String id = getExtraKeyId(key);\n                codeBuilder.replace(key, \"document.getElementById(\\\"\" + id + \"\\\")\");\n            }\n        }\n        return codeBuilder.build();\n    }\n\n    protected void parseTemplate(String template) {\n        boolean isEmpty = dataSet.getRowCount() == 0;\n        Double valueRaw = isEmpty ? 0 : (Double) dataSet.getValueAt(0, 0);\n        String valueStr = isEmpty ? view.getNoDataString() : super.formatValue(0, 0);\n        String title = displayerSettings.isTitleVisible() ? displayerSettings.getTitle() : \"\";\n        String bgcolor = displayerSettings.getChartBackgroundColor();\n        bgcolor = !StringUtils.isBlank(bgcolor) ? bgcolor : \"white\";\n\n        try {\n            Integer.parseInt(bgcolor, 16);\n            bgcolor = \"#\" + bgcolor;\n        } catch (NumberFormatException e) {\n            // No hash prefix needed\n        }\n\n        // Replace the core keys by their corresponding displayer settings.\n        codeBuilder.setTemplate(template);\n        codeBuilder.replace(\"value.raw\", Double.toString(valueRaw))\n                .replace(\"value\", valueStr != null ? valueStr : \"\")\n                .replace(\"title\", title)\n                .replace(\"width\", Integer.toString(displayerSettings.getChartWidth()))\n                .replace(\"height\", Integer.toString(displayerSettings.getChartHeight()))\n                .replace(\"marginTop\", Integer.toString(displayerSettings.getChartMarginTop()))\n                .replace(\"marginBottom\", Integer.toString(displayerSettings.getChartMarginBottom()))\n                .replace(\"marginRight\", Integer.toString(displayerSettings.getChartMarginRight()))\n                .replace(\"marginLeft\", Integer.toString(displayerSettings.getChartMarginLeft()))\n                .replace(\"value.start\", Long.toString(displayerSettings.getMeterStart()))\n                .replace(\"value.warning\", Long.toString(displayerSettings.getMeterWarning()))\n                .replace(\"value.critical\", Long.toString(displayerSettings.getMeterCritical()))\n                .replace(\"value.end\", Long.toString(displayerSettings.getMeterEnd()))\n                .replace(\"bgColor\", bgcolor)\n                .replace(\"isFilterEnabled\", Boolean.toString(isFilterEnabled()))\n                .replace(\"isFilterOn\", Boolean.toString(isFilterOn()))\n                .replace(\"isEmpty\", Boolean.toString(isEmpty))\n                .replace(\"doFilter\", \"window.metricDisplayerDoFilter('\" + view.getUniqueId() + \"')\");\n    }\n\n    public String getExtraKeyId(String key) {\n        return view.getUniqueId()  + \"_\" + key;\n    }\n\n    public boolean isFilterOn() {\n        return filterOn;\n    }\n\n    public void setFilterOn(boolean on) {\n        filterOn = on;\n    }\n\n    public boolean isFilterEnabled() {\n        return displayerSettings.isFilterEnabled() && fetchFilter() != null;\n    }\n\n    public void updateFilter() {\n        if (isFilterEnabled()) {\n\n            if (filterOn) {\n                filterReset();\n            } else {\n                if (displayerSettings.isFilterEnabled()) {\n                    filterApply();\n                }\n            }\n        }\n    }\n\n    public DataSetFilter fetchFilter() {\n        if (displayerSettings.getDataSetLookup() == null) {\n            return null;\n        }\n        List<DataSetFilter> filterOps = displayerSettings.getDataSetLookup().getOperationList(DataSetFilter.class);\n        if (filterOps == null || filterOps.isEmpty()) {\n            return null;\n        }\n        DataSetFilter filter = new DataSetFilter();\n        for (DataSetFilter filterOp : filterOps) {\n            filter.getColumnFilterList().addAll(filterOp.getColumnFilterList());\n        }\n        return filter;\n    }\n\n    public void filterApply() {\n        DataSetFilter filter = fetchFilter();\n        if (displayerSettings.isFilterEnabled() && filter != null) {\n            filterOn = true;\n            super.filterApply(filter);\n        }\n    }\n\n    @Override\n    public void filterReset() {\n        DataSetFilter filter = fetchFilter();\n        if (filterOn && filter != null) {\n            filterOn = false;\n            super.filterReset();\n        }\n    }\n\n    @Override\n    public String getHtmlTemplate() {\n        String template = displayerSettings.getHtmlTemplate();\n        if (StringUtils.isBlank(template)) {\n            return DEFAULT_HTML_TEMPLATE;\n        }\n        return template;\n    }\n\n    @Override\n    public Map<String, String> getHtmlVariableMap() {\n        return getCommonVariableMap();\n    }\n\n    @Override\n    public String getJsTemplate() {\n        String template = displayerSettings.getJsTemplate();\n        if (StringUtils.isBlank(template)) {\n            return DEFAULT_JS_TEMPLATE;\n        }\n        return template;\n\n    }\n\n    @Override\n    public Map<String, String> getJsVariableMap() {\n        Map<String, String> varMap = new HashMap<>();\n\n        // Append the user defined variables\n        String template = getHtmlTemplate();\n        codeBuilder.setTemplate(template);\n        for (String key : codeBuilder.keys()) {\n            if (!TEMPLATE_KEYS.contains(key)) {\n                String var = codeBuilder.asVar(key);\n                varMap.put(var, DisplayerConstants.INSTANCE.userDefinedVariableDescription());\n            }\n        }\n        varMap.putAll(getCommonVariableMap());\n        varMap.put(asVar(\"doFilter\"), DisplayerConstants.INSTANCE.doFilterVariableDescription());\n        return varMap;\n    }\n\n    protected Map<String, String> getCommonVariableMap() {\n        Map<String, String> varMap = new HashMap<>();\n        varMap.put(asVar(\"value.raw\"), DisplayerConstants.INSTANCE.valueRawVariableDescription());\n        varMap.put(asVar(\"value.start\"), DisplayerConstants.INSTANCE.valueStartVariableDescription());\n        varMap.put(asVar(\"value.warning\"), DisplayerConstants.INSTANCE.valueWarningVariableDescription());\n        varMap.put(asVar(\"value.critical\"), DisplayerConstants.INSTANCE.valueCriticalVariableDescription());\n        varMap.put(asVar(\"value.end\"), DisplayerConstants.INSTANCE.valueEndVariableDescription());\n        varMap.put(asVar(\"value\"), DisplayerConstants.INSTANCE.valueVariableDescription());\n        varMap.put(asVar(\"title\"), DisplayerConstants.INSTANCE.titleVariableDescription());\n        varMap.put(asVar(\"width\"), DisplayerConstants.INSTANCE.widthVariableDescription());\n        varMap.put(asVar(\"height\"), DisplayerConstants.INSTANCE.heightVariableDescription());\n        varMap.put(asVar(\"marginTop\"), DisplayerConstants.INSTANCE.marginTopVariableDescription());\n        varMap.put(asVar(\"marginBottom\"), DisplayerConstants.INSTANCE.marginBottomVariableDescription());\n        varMap.put(asVar(\"marginRight\"), DisplayerConstants.INSTANCE.marginRightVariableDescription());\n        varMap.put(asVar(\"marginLeft\"), DisplayerConstants.INSTANCE.marginLeftVariableDescription());\n        varMap.put(asVar(\"bgColor\"), DisplayerConstants.INSTANCE.bgColorVariableDescription());\n        varMap.put(asVar(\"isFilterEnabled\"), DisplayerConstants.INSTANCE.isFilterEnabledVariableDescription());\n        varMap.put(asVar(\"isFilterOn\"), DisplayerConstants.INSTANCE.isFilterOnVariableDescription());\n        varMap.put(asVar(\"isEmpty\"), DisplayerConstants.INSTANCE.isEmptyVariableDescription());\n        return varMap;\n    }\n\n    protected String asVar(String key) {\n        return codeBuilder.asVar(key);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/metric/MetricView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.metric;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.core.client.ScriptInjector;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\nimport org.dashbuilder.renderer.client.resources.i18n.MetricConstants;\n\n@Dependent\npublic class MetricView extends AbstractGwtDisplayerView<MetricDisplayer> implements MetricDisplayer.View {\n\n    FlowPanel container = new FlowPanel();\n    HTMLPanel htmlPanel = null;\n    String uniqueId = Document.get().createUniqueId();\n\n    @Override\n    public void init(MetricDisplayer presenter) {\n        container.getElement().setAttribute(\"id\", uniqueId);\n        super.setPresenter(presenter);\n        super.setVisualization(container);\n    }\n\n    @Override\n    public String getUniqueId() {\n        return uniqueId;\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        htmlPanel = null;\n        container.clear();\n        DefaultRenderer.closeDisplayer(uniqueId);\n    }\n\n    @Override\n    public void setHtml(String html) {\n        htmlPanel = new HTMLPanel(html);\n        container.clear();\n        container.add(htmlPanel);\n    }\n\n    @Override\n    public String getNoDataString() {\n        return MetricConstants.INSTANCE.metricDisplayer_noDataAvailable();\n    }\n\n    @Override\n    public void eval(String js) {\n        Scheduler.get().scheduleFixedDelay(() -> {\n            Element el = Document.get().getElementById(uniqueId);\n            if (el != null) {\n                ScriptInjector.fromString(js).setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(true).inject();\n                return false;\n            }\n            return true;\n        }, 100);\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return MetricConstants.INSTANCE.metricDisplayer_columnsTitle();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants extends Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    public String error();\n\n    public String error_settings_unset();\n\n    public String error_handler_unset();\n\n    public String error_dataset_notfound();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/resources/i18n/MetricConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface MetricConstants extends Messages {\n\n    public static final MetricConstants INSTANCE = GWT.create( MetricConstants.class );\n\n    String metricDisplayer_noDataAvailable();\n\n    String metricDisplayer_columnsTitle();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface SelectorConstants extends Messages {\n\n    SelectorConstants INSTANCE = GWT.create( SelectorConstants.class );\n\n    String selectorDisplayer_noDataAvailable();\n\n    String selectorDisplayer_groupsTitle();\n\n    String selectorDisplayer_columnsTitle();\n\n    String selectorDisplayer_select();\n\n    String selectorDisplayer_reset();\n\n    String selectorDisplayer_clearAll();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/resources/i18n/SliderConstants.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface SliderConstants extends Messages {\n\n    SliderConstants INSTANCE = GWT.create(SliderConstants.class);\n\n    String sliderTooltip(String from, String to);\n\n    String sliderColumnName();\n\n    String textColumnsNotSupported();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/resources/i18n/TableConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface TableConstants extends Messages {\n\n    TableConstants INSTANCE = GWT.create(TableConstants.class);\n\n    String tableDisplayer_noDataAvailable();\n\n    String tableDisplayer_groupsTitle();\n\n    String tableDisplayer_columnsTitle();\n\n    String tableDisplayer_export_to_csv();\n\n    String tableDisplayer_export_to_xls();\n\n    String tableDisplayer_reset();\n\n    String tableDisplayer_export_no_data();\n\n    String tableDisplayer_export_too_many_rows(int rowNum, int limit);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/AbstractSelectorItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport org.uberfire.mvp.Command;\n\npublic abstract class AbstractSelectorItemPresenter implements SelectorItemPresenter {\n\n    protected Command onSelectCommand;\n    protected Command onResetCommand;\n    protected int id;\n    protected boolean selected = false;\n\n    public void init(int id, String value, String descr) {\n        this.id = id;\n        getView().setValue(value);\n        getView().setDescription(descr);\n        this.reset();\n    }\n\n    public int getId() {\n        return id;\n    }\n\n    public boolean isSelected() {\n        return selected;\n    }\n\n    public void setOnSelectCommand(Command onSelectCommand) {\n        this.onSelectCommand = onSelectCommand;\n    }\n\n    public void setOnResetCommand(Command onResetCommand) {\n        this.onResetCommand = onResetCommand;\n    }\n\n    public void select() {\n        selected = true;\n        getView().select();\n    }\n\n    public void reset() {\n        selected = false;\n        getView().reset();\n    }\n\n    // View notifications\n\n    public void onItemClick() {\n        if (selected) {\n            selected = false;\n            getView().reset();\n\n            if (onResetCommand != null) {\n                onResetCommand.execute();\n            }\n        }\n        else {\n            selected = true;\n            getView().select();\n\n            if (onSelectCommand != null) {\n                onSelectCommand.execute();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\nimport org.dashbuilder.displayer.client.Displayer;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class SelectorDisplayer extends AbstractGwtDisplayer<SelectorDisplayer.View> {\n\n    public interface View extends AbstractGwtDisplayer.View<SelectorDisplayer> {\n\n        void showSelectHint(String column);\n\n        void showResetHint(String column);\n\n        void clearItems();\n\n        void addItem(String id, String value, boolean selected);\n\n        String getSelectedId();\n\n        int getItemCount();\n\n        void setItemTitle(int id, String title);\n\n        void setFilterEnabled(boolean enabled);\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n    }\n\n    protected View view;\n    protected boolean filterOn = false;\n\n    public SelectorDisplayer() {\n        this(new SelectorDisplayerView());\n    }\n\n    @Inject\n    public SelectorDisplayer(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(-1)\n                .setMinColumns(1)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute( DisplayerAttributeDef.TYPE )\n                .supportsAttribute( DisplayerAttributeGroupDef.COLUMNS_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.FILTER_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.REFRESH_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.GENERAL_GROUP );\n    }\n\n    @Override\n    protected void createVisualization() {\n        view.setFilterEnabled(displayerSettings.isFilterEnabled());\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        view.clearItems();\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        String firstColumnId = firstColumn.getId();\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(firstColumn);\n        String firstColumnName = columnSettings.getColumnName();\n        List<Integer> currentFilter = super.filterIndexes(firstColumnId);\n\n        // Add a selector hint according to the filter status\n        if (currentFilter.isEmpty()) {\n            view.showSelectHint(firstColumnName);\n        } else {\n            view.showResetHint(firstColumnName);\n        }\n\n        // Generate the list entries from the current data set\n        for (int i = 0; i < dataSet.getRowCount(); i++) {\n\n            Object obj = dataSet.getValueAt(i, 0);\n            if (obj == null) {\n                continue;\n            }\n\n            String value = super.formatValue(i, 0);\n            boolean selected = currentFilter != null && currentFilter.contains(i);\n            view.addItem(Integer.toString(i), value, selected);\n\n            // Generate an option tooltip (only if extra data set columns are defined)\n            int ncolumns = dataSet.getColumns().size();\n            if (ncolumns > 1) {\n                StringBuilder out = new StringBuilder();\n                for (int j = 1; j < ncolumns; j++) {\n\n                    DataColumn extraColumn = dataSet.getColumnByIndex(j);\n                    columnSettings = displayerSettings.getColumnSettings(extraColumn);\n                    String extraColumnName = columnSettings.getColumnName();\n                    Object extraValue = dataSet.getValueAt(i, j);\n\n                    if (extraValue != null) {\n                        out.append(j > 1 ? \"  \" : \"\");\n                        String formattedValue = super.formatValue(i, j);\n                        out.append(extraColumnName).append(\"=\").append(formattedValue);\n                    }\n                }\n                view.setItemTitle(view.getItemCount()-1, out.toString());\n            }\n        }\n    }\n\n    // View notifications\n\n    public void onItemSelected() {\n\n        // Reset the current filter (if any)\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        String firstColumnId = firstColumn.getId();\n        List<Integer> currentFilter = filterIndexes(firstColumnId);\n        if (currentFilter != null && !currentFilter.isEmpty()) {\n            filterReset();\n        }\n\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(firstColumn);\n        String firstColumnName = columnSettings.getColumnName();\n        String selected = view.getSelectedId();\n        if (selected != null) {\n            // Filter by the selected value (if any)\n            filterUpdate(firstColumnId, Integer.parseInt(selected));\n            view.showResetHint(firstColumnName);\n        } else {\n            view.showSelectHint(firstColumnName);\n        }\n    }\n\n    // KEEP IN SYNC THE CURRENT SELECTION WITH ANY EXTERNAL FILTER\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n        String firstColumnId = dataSet.getColumnByIndex(0).getId();\n        List<Integer> currentFilter = super.filterIndexes(firstColumnId);\n\n        // If selector is active then ignore external filters.\n        if (currentFilter.isEmpty()) {\n            if (firstColumnId.equals(groupOp.getColumnGroup().getColumnId())) {\n                columnSelectionMap.put(groupOp.getColumnGroup().getColumnId(), groupOp.getSelectedIntervalList());\n            }\n            super.onFilterEnabled(displayer, groupOp);\n        }\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n        String firstColumnId = dataSet.getColumnByIndex(0).getId();\n        List<Integer> currentFilter = super.filterIndexes(firstColumnId);\n\n        // If selector is active then ignore external filters.\n        if (currentFilter.isEmpty()) {\n            for (DataSetGroup groupOp : groupOps) {\n                if (firstColumnId.equals(groupOp.getColumnGroup().getColumnId())) {\n                    columnSelectionMap.remove(groupOp.getColumnGroup().getColumnId());\n                }\n            }\n            super.onFilterReset(displayer, groupOps);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport com.google.gwt.dom.client.NodeList;\nimport com.google.gwt.dom.client.OptionElement;\nimport com.google.gwt.dom.client.SelectElement;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.renderer.client.resources.i18n.SelectorConstants;\nimport org.gwtbootstrap3.client.ui.ListBox;\n\npublic class SelectorDisplayerView extends AbstractGwtDisplayerView<SelectorDisplayer> implements SelectorDisplayer.View {\n\n    protected ListBox listBox = new ListBox();\n    protected boolean hintEnabled = false;\n\n    @Override\n    public void init(SelectorDisplayer presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(listBox);\n    }\n\n    @Override\n    public void showSelectHint(String column) {\n        showHint(\"- \" + SelectorConstants.INSTANCE.selectorDisplayer_select() + \" \" + column + \" -\");\n    }\n\n    @Override\n    public void showResetHint(String column) {\n        showHint(\"- \" + SelectorConstants.INSTANCE.selectorDisplayer_reset() + \" \" + column + \" -\");\n    }\n\n    protected void showHint(String hint) {\n        if (hintEnabled) {\n            SelectElement selectElement = SelectElement.as(listBox.getElement());\n            NodeList<OptionElement> options = selectElement.getOptions();\n            options.getItem(0).setText(hint);\n        } else {\n            listBox.addItem(hint);\n            hintEnabled = true;\n        }\n    }\n\n    @Override\n    public void clearItems() {\n        listBox.clear();\n        hintEnabled = false;\n    }\n\n    @Override\n    public void addItem(String id, String value, boolean selected) {\n        listBox.addItem(value, id);\n        if (selected) {\n            listBox.setSelectedIndex(listBox.getItemCount()-1);\n        }\n    }\n\n    @Override\n    public String getSelectedId() {\n        if (hintEnabled && listBox.getSelectedIndex() == 0) {\n            return null;\n        }\n        return listBox.getSelectedValue();\n    }\n\n    @Override\n    public int getItemCount() {\n        return listBox.getItemCount() - (hintEnabled ? 1 : 0);\n    }\n\n    @Override\n    public void setItemTitle(int index, String title) {\n        SelectElement selectElement = SelectElement.as(listBox.getElement());\n        NodeList<OptionElement> options = selectElement.getOptions();\n        OptionElement optionElement = options.getItem(index + (hintEnabled ? 1: 0));\n        if (optionElement != null) {\n            optionElement.setTitle(title);\n        }\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        if (enabled) {\n            listBox.addChangeHandler(new ChangeHandler() {\n                public void onChange(ChangeEvent event) {\n                    getPresenter().onItemSelected();\n                }\n            });\n        }\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_groupsTitle();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_columnsTitle();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownDisplayer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.dashbuilder.dataset.sort.DataSetSort;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n@Dependent\npublic class SelectorDropDownDisplayer extends AbstractErraiDisplayer<SelectorDropDownDisplayer.View> {\n\n    public interface View extends AbstractErraiDisplayer.View<SelectorDropDownDisplayer> {\n\n        void showTitle(String title);\n\n        void margins(int top, int bottom, int left, int right);\n\n        void setWidth(int width);\n\n        void showSelectHint(String column, boolean multiple);\n\n        void showResetHint(String column, boolean multiple);\n\n        void showCurrentSelection(String text, String hint);\n\n        void clearItems();\n\n        void addItem(SelectorDropDownItem item);\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n    }\n\n    protected View view;\n    protected boolean filterOn = false;\n    protected boolean multipleSelections = false;\n    protected SyncBeanManager beanManager;\n    protected Set<SelectorDropDownItem> itemCollection = new HashSet<>();\n\n    @Inject\n    public SelectorDropDownDisplayer(View view, SyncBeanManager beanManager) {\n        this.beanManager = beanManager;\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void close() {\n        super.close();\n        clearItems();\n    }\n\n    protected void clearItems() {\n        view.clearItems();\n        for (SelectorDropDownItem item : itemCollection) {\n            beanManager.destroyBean(item);\n        }\n        itemCollection.clear();\n    }\n\n    protected void resetItems() {\n        for (SelectorDropDownItem item : itemCollection) {\n            item.reset();\n        }\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(-1)\n                .setMinColumns(1)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle());\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeDef.TITLE)\n                .supportsAttribute(DisplayerAttributeDef.TITLE_VISIBLE)\n                .supportsAttribute(DisplayerAttributeGroupDef.SELECTOR_GROUP)\n                .excludeAttribute(DisplayerAttributeGroupDef.SELECTOR_SHOW_INPUTS)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP);\n    }\n\n    @Override\n    protected void beforeDataSetLookup() {\n        // Make sure the drop down entries are sorted\n        DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp();\n        if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) {\n            ColumnGroup column = group.getColumnGroup();\n            if (!GroupStrategy.FIXED.equals(column.getStrategy())) {\n                dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING);\n            }\n        }\n    }\n\n    @Override\n    protected void createVisualization() {\n        if (displayerSettings.isTitleVisible()) {\n            view.showTitle(displayerSettings.getTitle());\n        }\n        if (displayerSettings.getSelectorWidth() > 0) {\n            view.setWidth(displayerSettings.getSelectorWidth());\n        }\n        view.margins(displayerSettings.getChartMarginTop(),\n                displayerSettings.getChartMarginBottom(),\n                displayerSettings.getChartMarginLeft(),\n                displayerSettings.getChartMarginRight());\n\n        multipleSelections = displayerSettings.isSelectorMultiple();\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(firstColumn);\n        String firstColumnName = columnSettings.getColumnName();\n        List<Integer> currentFilter = super.filterIndexes(firstColumn.getId());\n\n        clearItems();\n\n        // Generate the list entries from the current data set\n        for (int i = 0; i < dataSet.getRowCount(); i++) {\n\n            Object obj = dataSet.getValueAt(i, 0);\n            if (obj == null) {\n                continue;\n            }\n\n            String value = super.formatValue(i, 0);\n            StringBuilder title = new StringBuilder();\n\n            int ncolumns = dataSet.getColumns().size();\n            if (ncolumns > 1) {\n                for (int j = 1; j < ncolumns; j++) {\n                    DataColumn extraColumn = dataSet.getColumnByIndex(j);\n                    columnSettings = displayerSettings.getColumnSettings(extraColumn);\n                    String extraColumnName = columnSettings.getColumnName();\n                    Object extraValue = dataSet.getValueAt(i, j);\n                    if (extraValue != null) {\n                        title.append(j > 1 ? \" \" : \"\");\n                        String formattedValue = super.formatValue(i, j);\n                        title.append(extraColumnName).append(\"=\").append(formattedValue);\n                    }\n                }\n            }\n            final SelectorDropDownItem item = beanManager.lookupBean(SelectorDropDownItem.class).newInstance();\n            item.init(i, value, title.toString());\n            item.setSelectionIconVisible(multipleSelections);\n            item.setOnSelectCommand(() -> onItemSelected(item));\n            item.setOnResetCommand(() -> onItemReset(item));\n            if (currentFilter.contains(i)) {\n                item.select();\n            } else {\n                item.reset();\n            }\n            view.addItem(item);\n            itemCollection.add(item);\n        }\n\n        // Add a selector hint according to the filter status\n        if (currentFilter.isEmpty()) {\n            view.showSelectHint(firstColumnName, multipleSelections);\n        } else {\n            view.showResetHint(firstColumnName, multipleSelections);\n        }\n    }\n\n    public String getFirstColumnId() {\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        return firstColumn.getId();\n    }\n\n    public String getFirstColumnName() {\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        ColumnSettings columnSettings = displayerSettings.getColumnSettings(firstColumn);\n        return columnSettings.getColumnName();\n    }\n\n    protected void onItemSelected(SelectorDropDownItem item) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            String firstColumnId = getFirstColumnId();\n            String firstColumnName = getFirstColumnName();\n\n            // Reset current selection (if any) in single selection mode\n            if (!multipleSelections) {\n                List<Integer> currentFilter = filterIndexes(firstColumnId);\n                if (currentFilter != null && !currentFilter.isEmpty()) {\n                    resetItems();\n                    super.filterReset();\n                    item.select();\n                }\n            }\n            // Filter by the selected entry\n            filterUpdate(firstColumnId, item.getId());\n            List<Integer> currentFilter = super.filterIndexes(firstColumnId);\n            showSelectedItems(currentFilter);\n            view.showResetHint(firstColumnName, multipleSelections);\n        }\n    }\n\n    protected void onItemReset(SelectorDropDownItem item) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            String firstColumnId = getFirstColumnId();\n            String firstColumnName = getFirstColumnName();\n\n            filterUpdate(firstColumnId, item.getId());\n            List<Integer> currentFilter = super.filterIndexes(firstColumnId);\n            if (currentFilter.isEmpty()) {\n                view.showSelectHint(firstColumnName, multipleSelections);\n            } else {\n                showSelectedItems(currentFilter);\n            }\n        }\n    }\n\n    protected void showSelectedItems(List<Integer> currentFilter) {\n        List<String> itemList = new ArrayList<>();\n        for (Integer idx : currentFilter) {\n            String value = super.formatValue(idx, 0);\n            itemList.add(value);\n        }\n        int width = displayerSettings.getSelectorWidth();\n        String hint = formatItemList(itemList);\n        String text = width > 0 ? formatItemList(itemList, width) : hint;\n        view.showCurrentSelection(text, hint);\n    }\n\n    public String formatItemList(List<String> itemList) {\n        StringBuffer out = new StringBuffer();\n        for (String item : itemList) {\n            if (out.length() > 0) {\n                out.append(\", \");\n            }\n            out.append(item);\n        }\n        return out.toString() + \" \";\n    }\n    public String formatItemList(List<String> itemList, int maxWidth) {\n        StringBuffer out = new StringBuffer();\n        int charLength = 9;\n        int availableChars = maxWidth / charLength;\n        for (String item : itemList) {\n            if (availableChars < 0) {\n                out.append(\" ...\");\n                return out.toString();\n            }\n            if (out.length() > 0) {\n                availableChars -= 2;\n                if (availableChars <= 0) {\n                    out.append(\" ...\");\n                    return out.toString();\n                } else {\n                    out.append(\", \");\n                }\n            }\n            if (item.length() > availableChars) {\n                out.append(item.substring(0, availableChars)).append(\"...\");\n                return out.toString();\n            }\n            else {\n                availableChars -= item.length();\n                out.append(item);\n            }\n        }\n        return out.toString() + \" \";\n    }\n\n    void onResetSelections() {\n        filterReset();\n        updateVisualization();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownDisplayerView.css",
    "content": ".selector-ddown-container {\n    margin: 5px;\n}\n\n.selector-ddown-button {\n    text-align: left;\n    overflow: hidden;\n}\n\n.selector-ddown-text {\n    float: left;\n    overflow: hidden;\n}\n\n.selector-ddown-reset-anchor {\n    margin-right: 10px;\n    cursor: pointer;\n    float: right;\n}\n\n.selector-ddown-caret {\n    float: right;\n    margin-top: 5px;\n    margin-left: 10px;\n}\n\n.selector-ddown-menu {\n    max-height: 252px;\n    overflow-y: auto;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownDisplayerView.html",
    "content": "<div data-field=\"containerDiv\">\n    <div>\n        <span data-field=\"titleSpan\"></span>\n    </div>\n    <div data-field=\"dropDownDiv\" class=\"dropdown btn-group selector-ddown-container\">\n        <button data-field=\"dropDownButton\" class=\"btn btn-default dropdown-toggle selector-ddown-button\" type=\"button\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n            <div data-field=\"dropDownText\" class=\"selector-ddown-text\"></div>\n            <span class=\"caret selector-ddown-caret\"></span>\n        </button>\n        <ul data-field=\"dropDownMenu\" class=\"dropdown-menu selector-ddown-menu\" role=\"menu\">\n        </ul>\n        <ul data-field=\"resetMenu\" class=\"dropdown-menu\" role=\"menu\">\n            <a data-field=\"resetAnchor\" class=\"selector-ddown-reset-anchor\">Clear All</a>\n        </ul>\n    </div>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownDisplayerView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayerView;\nimport org.dashbuilder.renderer.client.resources.i18n.SelectorConstants;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectorDropDownDisplayerView extends AbstractErraiDisplayerView<SelectorDropDownDisplayer>\n        implements SelectorDropDownDisplayer.View {\n\n    @Inject\n    @DataField\n    Div containerDiv;\n\n    @Inject\n    @DataField\n    Span titleSpan;\n\n    @Inject\n    @DataField\n    Div dropDownDiv;\n\n    @Inject\n    @DataField\n    Button dropDownButton;\n\n    @Inject\n    @DataField\n    Div dropDownText;\n\n    @Inject\n    @DataField\n    UnorderedList resetMenu;\n\n    @Inject\n    @DataField\n    UnorderedList dropDownMenu;\n\n    @Inject\n    @DataField\n    Anchor resetAnchor;\n\n    @Override\n    public void init(SelectorDropDownDisplayer presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization((Element) containerDiv);\n    }\n\n    @Override\n    public void showTitle(String title) {\n        titleSpan.setTextContent(title);\n    }\n\n    @Override\n    public void margins(int top, int bottom, int left, int right) {\n        containerDiv.getStyle().setProperty(\"margin-top\", top + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-bottom\", bottom + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-left\", left + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-right\", right + \"px\");\n    }\n\n    @Override\n    public void setWidth(int width) {\n        if (width > 0) {\n            dropDownButton.getStyle().setProperty(\"width\", width + \"px\");\n            dropDownMenu.getStyle().setProperty(\"width\", width + \"px\");\n            resetMenu.getStyle().setProperty(\"width\", width + \"px\");\n            dropDownText.getStyle().setProperty(\"max-width\", (width - 30) + \"px\");\n        } else {\n            dropDownButton.getStyle().removeProperty(\"width\");\n            dropDownMenu.getStyle().removeProperty(\"width\");\n            resetMenu.getStyle().removeProperty(\"width\");\n            dropDownText.getStyle().removeProperty(\"max-width\");\n        }\n    }\n\n    @Override\n    public void showSelectHint(String column, boolean multiple) {\n        String hint = \"- \" + SelectorConstants.INSTANCE.selectorDisplayer_select() + \" \" + column + \" - \";\n        dropDownText.setTextContent(hint);\n        resetMenu.getStyle().setProperty(\"display\", \"none\");\n    }\n\n    @Override\n    public void showResetHint(String column, boolean multiple) {\n        String resetAction = multiple ? SelectorConstants.INSTANCE.selectorDisplayer_clearAll() : SelectorConstants.INSTANCE.selectorDisplayer_reset();\n        resetAnchor.setTextContent(resetAction);\n        resetMenu.getStyle().removeProperty(\"display\");\n        int n = dropDownMenu.getChildNodes().getLength() * 25;\n        resetMenu.getStyle().setProperty(\"margin-top\", (n > 250 ? 250 : n) + \"px\");\n    }\n\n    @Override\n    public void showCurrentSelection(String text, String hint) {\n        dropDownText.setTextContent(text);\n        dropDownButton.setTitle(hint);\n    }\n\n    @Override\n    public void clearItems() {\n        DOMUtil.removeAllChildren(dropDownMenu);\n    }\n\n    @Override\n    public void addItem(SelectorDropDownItem item) {\n        dropDownMenu.appendChild(item.getView().getElement());\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_groupsTitle();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_columnsTitle();\n    }\n\n    @EventHandler(\"resetAnchor\")\n    private void onResetClicked(ClickEvent event) {\n        presenter.onResetSelections();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class SelectorDropDownItem extends AbstractSelectorItemPresenter {\n\n    public interface View extends SelectorItemView<SelectorDropDownItem> {\n\n        void setSelectionIconVisible(boolean visible);\n    }\n\n    protected View view;\n\n    @Inject\n    public SelectorDropDownItem(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public void setSelectionIconVisible(boolean selectionIconVisible) {\n        view.setSelectionIconVisible(selectionIconVisible);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownItemView.css",
    "content": ".selector-dditem {\n    cursor: pointer;\n}\n.selector-dditem-icon {\n    margin-left: 5px;\n    cursor: pointer;\n    float: right;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownItemView.html",
    "content": "<li data-field=\"item\">\n    <a data-field=\"itemAnchor\">\n        <span data-field=\"itemText\" class=\"text\"></span>\n        <span data-field=\"itemIcon\" class=\"glyphicon glyphicon-ok check-mark selector-dditem-icon\"></span>\n    </a>\n</li>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorDropDownItemView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectorDropDownItemView implements SelectorDropDownItem.View, IsElement {\n\n    @Inject\n    @DataField\n    ListItem item;\n\n    @Inject\n    @DataField\n    Anchor itemAnchor;\n\n    @Inject\n    @DataField\n    Span itemText;\n\n    @Inject\n    @DataField\n    Span itemIcon;\n\n    SelectorDropDownItem presenter;\n    boolean iconVisible = true;\n\n    @Override\n    public void init(SelectorDropDownItem presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setValue(String value) {\n        itemText.setTextContent(value);\n    }\n\n    @Override\n    public void setDescription(String description) {\n        item.setTitle(description);\n    }\n\n    @Override\n    public void select() {\n        item.setClassName(\"selector-dditem selected\");\n        if (iconVisible) {\n            itemIcon.getStyle().removeProperty(\"display\");\n        }\n    }\n\n    @Override\n    public void reset() {\n        item.setClassName(\"selector-dditem\");\n        itemIcon.getStyle().setProperty(\"display\", \"none\");\n    }\n\n    @Override\n    public void setSelectionIconVisible(boolean visible) {\n        iconVisible = visible;\n        if (!iconVisible) {\n            itemIcon.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"itemAnchor\")\n    public void onItemClick(ClickEvent event) {\n        presenter.onItemClick();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport org.uberfire.mvp.Command;\n\npublic interface SelectorItemPresenter {\n\n    void init(int id, String value, String descr);\n\n    int getId();\n\n    boolean isSelected();\n\n    void setOnSelectCommand(Command onSelectCommand);\n\n    void setOnResetCommand(Command onResetCommand);\n\n    void select();\n\n    void reset();\n\n    SelectorItemView getView();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport org.uberfire.client.mvp.UberElement;\n\npublic interface SelectorItemView<P extends SelectorItemPresenter> extends UberElement<P> {\n\n    void setValue(String value);\n\n    void setDescription(String description);\n\n    void select();\n\n    void reset();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class SelectorLabelItem extends AbstractSelectorItemPresenter {\n\n    public interface View extends SelectorItemView<SelectorLabelItem> {\n\n        void setWidth(int percentage);\n    }\n\n    protected View view;\n\n    @Inject\n    public SelectorLabelItem(View view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public void setWidth(int percentage) {\n        if (percentage > 0 && percentage <= 100) {\n            view.setWidth(percentage);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelItemView.html",
    "content": "<button data-field=\"item\" class=\"btn btn-default\" type=\"button\"></button>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelItemView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.CSSStyleDeclaration;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectorLabelItemView implements SelectorLabelItem.View, IsElement {\n\n    @Inject\n    @DataField\n    Button item;\n\n    SelectorLabelItem presenter;\n\n    @Override\n    public void init(SelectorLabelItem presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setValue(String value) {\n        item.setTextContent(value);\n        // setTitle to make the whole value visible on mouse over when selector width is restricted and value is trimmed\n        item.setTitle(value);\n    }\n\n    @Override\n    public void setDescription(String description) {\n        item.setTitle(description);\n    }\n\n    @Override\n    public void setWidth(int percentage) {\n        CSSStyleDeclaration style = item.getStyle();\n        style.setProperty(\"width\", percentage + \"%\");\n\n        // Labels too long to fit into the button width will be trimmed and ended with \"...\"\n        // Based on https://www.w3schools.com/cssref/css3_pr_text-overflow.asp\n        style.setProperty(\"white-space\",\"nowrap\");\n        style.setProperty(\"overflow\",\"hidden\");\n        style.setProperty(\"text-overflow\",\"ellipsis\");\n    }\n\n    @Override\n    public void select() {\n        item.setClassName(\"btn btn-primary\");\n    }\n\n    @Override\n    public void reset() {\n        item.setClassName(\"btn btn-default\");\n    }\n\n    @EventHandler(\"item\")\n    public void onItemClick(ClickEvent event) {\n        presenter.onItemClick();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelSetDisplayer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.dashbuilder.dataset.sort.DataSetSort;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n@Dependent\npublic class SelectorLabelSetDisplayer extends AbstractErraiDisplayer<SelectorLabelSetDisplayer.View> {\n\n    public interface View extends AbstractErraiDisplayer.View<SelectorLabelSetDisplayer> {\n\n        void showTitle(String title);\n\n        void setWidth(int width);\n\n        void margins(int top, int bottom, int left, int right);\n\n        void clearItems();\n\n        void addItem(SelectorLabelItem item);\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n\n        void noData();\n    }\n\n    protected View view;\n    protected boolean filterOn = false;\n    protected boolean multipleSelections = false;\n    protected SyncBeanManager beanManager;\n    protected Set<SelectorLabelItem> itemCollection = new HashSet<>();\n\n    @Inject\n    public SelectorLabelSetDisplayer(View view, SyncBeanManager beanManager) {\n        this.beanManager = beanManager;\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void close() {\n        super.close();\n        clearItems();\n    }\n\n    protected void clearItems() {\n        view.clearItems();\n        for (SelectorLabelItem item : itemCollection) {\n            beanManager.destroyBean(item);\n        }\n        itemCollection.clear();\n    }\n\n    protected void resetItems() {\n        for (SelectorLabelItem item : itemCollection) {\n            item.reset();\n        }\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(-1)\n                .setMinColumns(1)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle());\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeDef.TITLE)\n                .supportsAttribute(DisplayerAttributeDef.TITLE_VISIBLE)\n                .supportsAttribute(DisplayerAttributeGroupDef.SELECTOR_GROUP)\n                .excludeAttribute(DisplayerAttributeDef.SELECTOR_SHOW_INPUTS)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP);\n    }\n\n    @Override\n    protected void beforeDataSetLookup() {\n        // Make sure the drop down entries are sorted\n        DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp();\n        if (dataSetHandler.getCurrentDataSetLookup().getOperationList(DataSetSort.class).isEmpty() && group != null) {\n            ColumnGroup column = group.getColumnGroup();\n            if (!GroupStrategy.FIXED.equals(column.getStrategy())) {\n                dataSetHandler.sort(column.getSourceId(), SortOrder.ASCENDING);\n            }\n        }\n    }\n\n    @Override\n    protected void createVisualization() {\n        if (displayerSettings.isTitleVisible()) {\n            view.showTitle(displayerSettings.getTitle());\n        }\n        view.margins(displayerSettings.getChartMarginTop(),\n                displayerSettings.getChartMarginBottom(),\n                displayerSettings.getChartMarginLeft(),\n                displayerSettings.getChartMarginRight());\n\n        multipleSelections = displayerSettings.isSelectorMultiple();\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        clearItems();\n        if (dataSet.getRowCount() == 0) {\n            view.noData();\n        }\n        else {\n            // Generate the list entries from the current data set\n            for (int i = 0; i < dataSet.getRowCount(); i++) {\n\n                Object obj = dataSet.getValueAt(i, 0);\n                if (obj == null) {\n                    continue;\n                }\n\n                String value = super.formatValue(i, 0);\n                StringBuilder title = new StringBuilder();\n\n                int ncolumns = dataSet.getColumns().size();\n                if (ncolumns > 1) {\n                    for (int j = 1; j < ncolumns; j++) {\n                        DataColumn extraColumn = dataSet.getColumnByIndex(j);\n                        ColumnSettings columnSettings = displayerSettings.getColumnSettings(extraColumn);\n                        String extraColumnName = columnSettings.getColumnName();\n                        Object extraValue = dataSet.getValueAt(i, j);\n                        if (extraValue != null) {\n                            title.append(j > 1 ? \" \" : \"\");\n                            String formattedValue = super.formatValue(i, j);\n                            title.append(extraColumnName).append(\"=\").append(formattedValue);\n                        }\n                    }\n                }\n                final SelectorLabelItem item = beanManager.lookupBean(SelectorLabelItem.class).newInstance();\n                item.init(i, value, title.toString());\n                item.setOnSelectCommand(() -> onItemSelected(item));\n                item.setOnResetCommand(() -> onItemReset(item));\n                view.addItem(item);\n                itemCollection.add(item);\n            }\n\n            // Set both the global and each item width\n            if (displayerSettings.getSelectorWidth() > 0) {\n                view.setWidth(displayerSettings.getSelectorWidth() + 100);\n                int itemWidth = 85 / itemCollection.size();\n                for (SelectorLabelItem labelItem : itemCollection) {\n                    labelItem.setWidth(itemWidth);\n                }\n            }\n        }\n    }\n\n    public String getFirstColumnId() {\n        DataColumn firstColumn = dataSet.getColumnByIndex(0);\n        return firstColumn.getId();\n    }\n\n    void onItemSelected(SelectorLabelItem item) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            String firstColumnId = getFirstColumnId();\n\n            // Reset current selection (if any) in single selection mode\n            if (!multipleSelections) {\n                List<Integer> currentFilter = filterIndexes(firstColumnId);\n                if (currentFilter != null && !currentFilter.isEmpty()) {\n                    resetItems();\n                    super.filterReset();\n                    item.select();\n                }\n            }\n            // Filter by the selected entry\n            filterUpdate(firstColumnId, item.getId());\n        }\n    }\n\n    void onItemReset(SelectorLabelItem item) {\n        if (displayerSettings.isFilterEnabled()) {\n\n            String firstColumnId = getFirstColumnId();\n            filterUpdate(firstColumnId, item.getId());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelSetDisplayerView.html",
    "content": "<div data-field=\"containerDiv\">\n    <span data-field=\"titleSpan\"></span>\n    <div data-field=\"labelSetDiv\"></div>\n    <span data-field=\"noDataSpan\"></span>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorLabelSetDisplayerView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport org.dashbuilder.displayer.client.AbstractErraiDisplayerView;\nimport org.dashbuilder.renderer.client.resources.i18n.SelectorConstants;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectorLabelSetDisplayerView extends AbstractErraiDisplayerView<SelectorLabelSetDisplayer>\n        implements SelectorLabelSetDisplayer.View {\n\n    @Inject\n    @DataField\n    Div containerDiv;\n\n    @Inject\n    @DataField\n    Span titleSpan;\n\n    @Inject\n    @DataField\n    Span noDataSpan;\n\n    @Inject\n    @DataField\n    Div labelSetDiv;\n\n    @Override\n    public void init(SelectorLabelSetDisplayer presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization((Element) containerDiv);\n    }\n\n    @Override\n    public void showTitle(String title) {\n        titleSpan.setTextContent(title);\n    }\n\n    @Override\n    public void setWidth(int width) {\n        containerDiv.getStyle().setProperty(\"width\", width + \"px\");\n    }\n\n    @Override\n    public void margins(int top, int bottom, int left, int right) {\n        containerDiv.getStyle().setProperty(\"margin-top\", top + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-bottom\", bottom + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-left\", left + \"px\");\n        containerDiv.getStyle().setProperty(\"margin-right\", right + \"px\");\n    }\n\n    @Override\n    public void clearItems() {\n        DOMUtil.removeAllChildren(labelSetDiv);\n        noDataSpan.setTextContent(\"\");\n    }\n\n    @Override\n    public void addItem(SelectorLabelItem item) {\n        HTMLElement element = item.getView().getElement();\n        element.getStyle().setProperty(\"margin\", \"3px\");\n        labelSetDiv.appendChild(element);\n    }\n\n    @Override\n    public void noData() {\n        noDataSpan.setTextContent(SelectorConstants.INSTANCE.selectorDisplayer_noDataAvailable());\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_groupsTitle();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return SelectorConstants.INSTANCE.selectorDisplayer_columnsTitle();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorSliderDisplayer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.Date;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.dataset.impl.DataColumnImpl;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\nimport org.dashbuilder.displayer.client.widgets.filter.DateParameterEditor;\nimport org.dashbuilder.displayer.client.widgets.filter.NumberParameterEditor;\n\n@Dependent\npublic class SelectorSliderDisplayer extends AbstractGwtDisplayer<SelectorSliderDisplayer.View> {\n\n    public interface View extends AbstractGwtDisplayer.View<SelectorSliderDisplayer> {\n\n        void showTitle(String title);\n\n        void setWidth(int width);\n\n        String getColumnsTitle();\n\n        void setSliderEnabled(boolean enabled);\n\n        void showSlider(double min, double max, double step, double minSelected, double maxSelected);\n\n        void showInputs(IsWidget minValueEditor, IsWidget maxValueEditor);\n\n        void margins(int top, int bottom, int left, int right);\n\n        String formatRange(String from, String to);\n\n        void textColumnsNotSupported();\n\n        void noData();\n    }\n\n    protected View view;\n    protected DataColumn dataColumnMin;\n    protected DataColumn dataColumnMax;\n    protected double rangeMin = -1;\n    protected double rangeMax = -1;\n    protected double selectedMin = -1;\n    protected double selectedMax = -1;\n    protected DateParameterEditor minDateEditor;\n    protected DateParameterEditor maxDateEditor;\n    protected NumberParameterEditor minNumberEditor;\n    protected NumberParameterEditor maxNumberEditor;\n\n    @Inject\n    public SelectorSliderDisplayer(View view, DateParameterEditor minDateEditor,\n                                   DateParameterEditor maxDateEditor,\n                                   NumberParameterEditor minNumberEditor,\n                                   NumberParameterEditor maxNumberEditor) {\n        this.view = view;\n        this.view.init(this);\n        this.minDateEditor = minDateEditor;\n        this.maxDateEditor = maxDateEditor;\n        this.minNumberEditor = minNumberEditor;\n        this.maxNumberEditor = maxNumberEditor;;\n        this.minDateEditor.setOnChangeCommand(this::onMinDateInputChange);\n        this.minDateEditor.setOnFocusCommand(this::onMinDateInputFocus);\n        this.minDateEditor.setOnBlurCommand(this::onMinDateInputBlur);\n        this.maxDateEditor.setOnChangeCommand(this::onMaxDateInputChange);\n        this.maxDateEditor.setOnFocusCommand(this::onMaxDateInputFocus);\n        this.maxDateEditor.setOnBlurCommand(this::onMaxDateInputBlur);\n        this.minNumberEditor.setOnChangeCommand(this::onMinNumberInputChange);\n        this.maxNumberEditor.setOnChangeCommand(this::onMaxNumberInputChange);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        // A single a number or date column is required as the filter column used by the slider\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupAllowed(false)\n                .setMaxColumns(2)\n                .setMinColumns(1)\n                .setFunctionRequired(false)\n                .setExtraColumnsAllowed(false)\n                .setColumnsTitle(view.getColumnsTitle());\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeDef.TITLE)\n                .supportsAttribute(DisplayerAttributeDef.TITLE_VISIBLE)\n                .supportsAttribute(DisplayerAttributeGroupDef.SELECTOR_GROUP)\n                .excludeAttribute(DisplayerAttributeGroupDef.SELECTOR_MULTIPLE)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP);\n    }\n\n    @Override\n    protected void beforeDataSetLookup() {\n        DataSetGroup group = dataSetHandler.getCurrentDataSetLookup().getLastGroupOp();\n        if (group != null && (group.getAggregationFunctions().isEmpty() || group.getColumnGroup() != null || group.getGroupFunctions().size() < 2)) {\n            group.setColumnGroup(null);\n            GroupFunction minFunction = group.getGroupFunctions().get(0);\n            minFunction.setFunction(AggregateFunctionType.MIN);\n            GroupFunction maxFunction = minFunction.cloneInstance();\n            maxFunction.setFunction(AggregateFunctionType.MAX);\n            group.addGroupFunction(maxFunction);\n        }\n    }\n\n    @Override\n    protected void createVisualization() {\n        if (displayerSettings.isTitleVisible()) {\n            view.showTitle(displayerSettings.getTitle());\n        }\n        if (displayerSettings.getSelectorWidth() > 0) {\n            view.setWidth(displayerSettings.getSelectorWidth());\n        }\n        view.margins(displayerSettings.getChartMarginTop(),\n                displayerSettings.getChartMarginBottom(),\n                displayerSettings.getChartMarginLeft(),\n                displayerSettings.getChartMarginRight());\n\n        updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        DataColumn minColumn = dataSet.getColumnByIndex(0);\n        DataColumn maxColumn = dataSet.getColumnByIndex(1);\n        Object minValue = minColumn.getValues().isEmpty() ? null : minColumn.getValues().get(0);\n        Object maxValue = maxColumn.getValues().isEmpty() ? null : maxColumn.getValues().get(0);\n        String minColumnId = minColumn.getId();\n        String maxColumnId = maxColumn.getId();\n        ColumnType columnType = minColumn.getColumnType();\n        dataColumnMin = new DataColumnImpl(minColumnId, columnType);\n        dataColumnMax = new DataColumnImpl(maxColumnId, columnType);\n\n        int inputsWidth = displayerSettings.getSelectorWidth();\n        inputsWidth = inputsWidth > 0 ? (inputsWidth/2) - 10  : -1;\n        inputsWidth = inputsWidth > 100 ? 100 : inputsWidth;\n\n        if (minValue == null || maxValue == null) {\n            view.noData();\n        }\n        else if (ColumnType.DATE.equals(columnType)) {\n            rangeMin = ((Date) minValue).getTime();\n            rangeMax = ((Date) maxValue).getTime() + 1;\n            selectedMin = selectedMin == -1 ? rangeMin : selectedMin;\n            selectedMax = selectedMax == -1 ? rangeMax : selectedMax;\n            view.showSlider(rangeMin, rangeMax, 1, selectedMin, selectedMax);\n\n            if (displayerSettings.isSelectorInputsEnabled()) {\n                minDateEditor.setValue((Date) minValue);\n                maxDateEditor.setValue((Date) maxValue);\n                minDateEditor.setWidth(inputsWidth);\n                maxDateEditor.setWidth(inputsWidth);\n                view.showInputs(minDateEditor, maxDateEditor);\n            }\n        }\n        else if (ColumnType.NUMBER.equals(columnType)) {\n            // Round to integer\n            rangeMin = ((Number) minValue).intValue();\n            rangeMax = ((Number) maxValue).intValue() + 1;\n            selectedMin = selectedMin == -1 ? rangeMin : selectedMin;\n            selectedMax = selectedMax == -1 ? rangeMax : selectedMax;\n            view.showSlider(rangeMin, rangeMax, 1, selectedMin, selectedMax);\n\n            if (displayerSettings.isSelectorInputsEnabled()) {\n                minNumberEditor.setValue((Number) minValue);\n                maxNumberEditor.setValue((Number) maxValue);\n                minNumberEditor.setWidth(inputsWidth);\n                maxNumberEditor.setWidth(inputsWidth);\n                view.showInputs(minNumberEditor, maxNumberEditor);\n            }\n        }\n        else {\n            view.textColumnsNotSupported();\n        }\n    }\n\n    public Object getSelectedMin() {\n        if (selectedMin == -1) {\n            return new Date((long) rangeMin);\n        }\n        if (ColumnType.DATE.equals(dataColumnMin.getColumnType())) {\n            return new Date((long) selectedMin);\n        }\n        else if (ColumnType.NUMBER.equals(dataColumnMin.getColumnType())) {\n            return (long) selectedMin;\n        }\n        else {\n            return null;\n        }\n    }\n\n    public Object getSelectedMax() {\n        if (selectedMax == -1) {\n            return new Date((long) rangeMax);\n        }\n        if (ColumnType.DATE.equals(dataColumnMax.getColumnType())) {\n            return new Date((long) selectedMax);\n        }\n        else if (ColumnType.NUMBER.equals(dataColumnMax.getColumnType())) {\n            return (long) selectedMax;\n        }\n        else {\n            return null;\n        }\n    }\n\n    // View callbacks\n\n    void onSliderChange(double min, double max) {\n        if (selectedMin != min || selectedMax != max) {\n            selectedMin = min;\n            selectedMax = max;\n\n            DataSetFilter filter = new DataSetFilter();\n            CoreFunctionFilter columnFilter = new CoreFunctionFilter();\n            columnFilter.setColumnId(dataColumnMin.getId());\n            columnFilter.setType(CoreFunctionType.BETWEEN);\n            filter.addFilterColumn(columnFilter);\n\n            if (ColumnType.DATE.equals(dataColumnMin.getColumnType())) {\n                Date dateFrom = new Date((long) min);\n                Date dateTo = new Date((long) max);\n                columnFilter.setParameters(dateFrom, dateTo);\n                minDateEditor.setValue(dateFrom);\n                maxDateEditor.setValue(dateTo);\n                super.filterUpdate(filter);\n            }\n            else if (ColumnType.NUMBER.equals(dataColumnMin.getColumnType())) {\n                columnFilter.setParameters(min, max);\n                minNumberEditor.setValue(min);\n                maxNumberEditor.setValue(max);\n                super.filterUpdate(filter);\n            }\n        }\n    }\n\n    void onMinDateInputChange() {\n        long min = minDateEditor.getValue().getTime();\n        double max = selectedMax != -1 ? selectedMax : rangeMax;\n        this.onSliderChange(min, max);\n        view.showSlider(rangeMin, rangeMax, 1, min, max);\n        view.setSliderEnabled(true);\n    }\n\n    void onMinDateInputFocus() {\n        view.setSliderEnabled(false);\n    }\n\n    void onMinDateInputBlur() {\n        view.setSliderEnabled(true);\n    }\n\n    void onMaxDateInputChange() {\n        double min = selectedMin != -1 ? selectedMin : rangeMin;\n        long max = maxDateEditor.getValue().getTime();\n        this.onSliderChange(min, max);\n        view.showSlider(rangeMin, rangeMax, 1, min, max);\n        view.setSliderEnabled(true);\n    }\n\n    void onMaxDateInputFocus() {\n        view.setSliderEnabled(false);\n    }\n\n    void onMaxDateInputBlur() {\n        view.setSliderEnabled(true);\n    }\n\n    void onMinNumberInputChange() {\n        double min = minNumberEditor.getValue().doubleValue();\n        double max = selectedMax != -1 ? selectedMax : rangeMax;\n        this.onSliderChange(min, max);\n        view.showSlider(rangeMin, rangeMax, 1, min, max);\n    }\n\n    void onMaxNumberInputChange() {\n        double min = selectedMin != -1 ? selectedMin : rangeMin;\n        double max = maxNumberEditor.getValue().doubleValue();\n        this.onSliderChange(min, max);\n        view.showSlider(rangeMin, rangeMax, 1, min, max);\n    }\n\n    String formatRange(double min, double max) {\n        String fromStr = this.formatValue(min, dataColumnMin);\n        String toStr = this.formatValue(max, dataColumnMax);\n        return view.formatRange(fromStr, toStr);\n    }\n\n    String formatValue(double val, DataColumn dataColumn) {\n        if (ColumnType.DATE.equals(dataColumn.getColumnType())) {\n            Date date = new Date((long) val);\n            return super.formatValue(date, dataColumn);\n        }\n        else if (ColumnType.NUMBER.equals(dataColumn.getColumnType())) {\n            return super.formatValue(val, dataColumn);\n        }\n        else {\n            return Double.toString(val);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/selector/SelectorSliderDisplayerView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.StyleInjector;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.renderer.client.resources.i18n.SelectorConstants;\nimport org.dashbuilder.renderer.client.resources.i18n.SliderConstants;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.extras.slider.client.ui.Range;\nimport org.gwtbootstrap3.extras.slider.client.ui.RangeSlider;\nimport org.gwtbootstrap3.extras.slider.client.ui.base.constants.HandleType;\nimport org.gwtbootstrap3.extras.slider.client.ui.base.constants.TooltipType;\n\npublic class SelectorSliderDisplayerView extends AbstractGwtDisplayerView<SelectorSliderDisplayer>\n        implements SelectorSliderDisplayer.View {\n\n    FlowPanel container = new FlowPanel();\n    HTML header = new HTML();\n    FlowPanel body = new FlowPanel();\n    RangeSlider slider = new RangeSlider();\n    HorizontalPanel inputs = new HorizontalPanel();\n    FlowPanel error = new FlowPanel();\n\n    @Override\n    public void init(SelectorSliderDisplayer presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(container);\n\n        // Enlarge the tooltip max width\n        StyleInjector.inject(\".slider .tooltip-inner { max-width: 900px; }\");\n\n        header.setVisible(false);\n        slider.setHandle(HandleType.ROUND);\n        slider.setFormatter(r -> presenter.formatRange(r.getMinValue(), r.getMaxValue()));\n        slider.addSlideStopHandler(e -> presenter.onSliderChange(e.getValue().getMinValue(), e.getValue().getMaxValue()));\n        slider.getElement().getStyle().setWidth(100, Style.Unit.PCT);\n        inputs.getElement().getStyle().setWidth(100, Style.Unit.PCT);\n\n        body.add(slider);\n        body.getElement().getStyle().setMarginLeft(10, Style.Unit.PX);\n\n        container.add(header);\n        container.add(body);\n        container.add(inputs);\n        container.add(error);\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return SliderConstants.INSTANCE.sliderColumnName();\n    }\n\n    @Override\n    public void showTitle(String title) {\n        error.setVisible(false);\n        header.setVisible(true);\n        header.setText(title);\n    }\n\n    @Override\n    public void setWidth(int width) {\n        slider.getElement().getStyle().setWidth(width, Style.Unit.PX);\n        inputs.getElement().getStyle().setWidth(width, Style.Unit.PX);\n    }\n\n    @Override\n    public void margins(int top, int bottom, int left, int right) {\n        container.getElement().getStyle().setMarginTop(top, Style.Unit.PX);\n        container.getElement().getStyle().setMarginBottom(bottom, Style.Unit.PX);\n        container.getElement().getStyle().setMarginLeft(left, Style.Unit.PX);\n        container.getElement().getStyle().setMarginRight(right, Style.Unit.PX);\n    }\n\n    @Override\n    public void setSliderEnabled(boolean enabled) {\n        slider.setEnabled(enabled);\n        slider.setTooltip(enabled ? TooltipType.SHOW : TooltipType.HIDE);\n    }\n\n    @Override\n    public void showSlider(double min, double max, double step, double minSelected, double maxSelected) {\n        slider.setMin(min);\n        slider.setMax(max);\n        slider.setValue(new Range(minSelected, maxSelected));\n        slider.setStep(step);\n\n        header.setVisible(true);\n        body.setVisible(true);\n        error.setVisible(false);\n    }\n\n    @Override\n    public void showInputs(IsWidget minValueEditor, IsWidget maxValueEditor) {\n        minValueEditor.asWidget().getElement().getStyle().setMarginTop(5, Style.Unit.PX);\n        maxValueEditor.asWidget().getElement().getStyle().setMarginTop(5, Style.Unit.PX);\n        minValueEditor.asWidget().getElement().getStyle().setMarginBottom(5, Style.Unit.PX);\n        maxValueEditor.asWidget().getElement().getStyle().setMarginBottom(5, Style.Unit.PX);\n        maxValueEditor.asWidget().getElement().getStyle().setFloat(Style.Float.RIGHT);\n\n        inputs.clear();\n        inputs.add(minValueEditor);\n        inputs.add(maxValueEditor);\n\n        header.setVisible(true);\n        inputs.setVisible(true);\n        error.setVisible(false);\n    }\n\n    @Override\n    public String formatRange(String from, String to) {\n        return SliderConstants.INSTANCE.sliderTooltip(from, to);\n    }\n\n    @Override\n    public void textColumnsNotSupported() {\n        header.setVisible(false);\n        error(SliderConstants.INSTANCE.textColumnsNotSupported());\n    }\n\n    @Override\n    public void noData() {\n        error(SelectorConstants.INSTANCE.selectorDisplayer_noDataAvailable());\n    }\n\n    protected void error(String msg) {\n        body.setVisible(false);\n        inputs.setVisible(false);\n        error.setVisible(true);\n        error.clear();\n        error.add(new Label(msg));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/table/TableDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.table;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.export.ExportCallback;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class TableDisplayer extends AbstractGwtDisplayer<TableDisplayer.View> {\n\n    public interface View extends AbstractGwtDisplayer.View<TableDisplayer> {\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n\n        void showTitle(String title);\n\n        void createTable(int pageSize, FilterLabelSet widget);\n\n        void redrawTable();\n\n        void setWidth(int width);\n        \n        void fullWidth();\n\n        void setSortEnabled(boolean enabled);\n\n        void setTotalRows(int rows, boolean isExact);\n\n        void setPagerEnabled(boolean enabled);\n\n        void setColumnPickerEnabled(boolean enabled);\n\n        void setExportToCsvEnabled(boolean enabled);\n\n        void setExportToXlsEnabled(boolean enabled);\n\n        void addColumn(ColumnType columnType, String columnId, String columnName, int index, boolean selectEnabled, boolean sortEnabled);\n\n        void gotoFirstPage();\n\n        int getLastOffset();\n\n        int getPageSize();\n\n        void exportNoData();\n\n        void exportTooManyRows(int rowNum, int limit);\n\n        void exportFileUrl(String url);\n    }\n\n    protected View view;\n    protected int totalRows = 0;\n    protected String lastOrderedColumn = null;\n    protected SortOrder lastSortOrder = null;\n    protected List<Command> onCellSelectedCommands = new ArrayList<>();\n    protected String selectedCellColumn = null;\n    protected Integer selectedCellRow = null;\n    protected int exportRowNumMax = 100000;\n    protected FilterLabelSet filterLabelSet;\n\n    @Inject\n    public TableDisplayer(View view, FilterLabelSet filterLabelSet) {\n        this.view = view;\n        this.view.init(this);\n        this.filterLabelSet = filterLabelSet;\n        this.filterLabelSet.setOnClearAllCommand(this::onFilterClearAll);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public FilterLabelSet getFilterLabelSet() {\n        return filterLabelSet;\n    }\n\n    public int getTotalRows() {\n        return totalRows;\n    }\n\n    public String getLastOrderedColumn() {\n        return lastOrderedColumn;\n    }\n\n    public SortOrder getLastSortOrder() {\n        return lastSortOrder;\n    }\n\n    public String getSelectedCellColumn() {\n        return selectedCellColumn;\n    }\n\n    public Integer getSelectedCellRow() {\n        return selectedCellRow;\n    }\n\n    public int getExportRowNumMax() {\n        return exportRowNumMax;\n    }\n\n    public void setExportRowNumMax(int exportRowNumMax) {\n        this.exportRowNumMax = exportRowNumMax;\n    }\n\n    public void addOnCellSelectedCommand(Command onCellSelectedCommand) {\n        this.onCellSelectedCommands.add(onCellSelectedCommand);\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupAllowed(true)\n                .setGroupRequired(false)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle());\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute( DisplayerAttributeDef.TYPE )\n                .supportsAttribute( DisplayerAttributeDef.RENDERER )\n                .supportsAttribute( DisplayerAttributeGroupDef.COLUMNS_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.FILTER_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.REFRESH_GROUP )\n                .supportsAttribute( DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute( DisplayerAttributeGroupDef.CHART_RESIZABLE )\n                .supportsAttribute( DisplayerAttributeGroupDef.EXPORT_GROUP)\n                .supportsAttribute( DisplayerAttributeGroupDef.TABLE_GROUP );\n    }\n\n    @Override\n    protected void beforeDataSetLookup() {\n        // Get the sort settings\n        if (lastOrderedColumn == null) {\n            String defaultSortColumn = displayerSettings.getTableDefaultSortColumnId();\n            if (!StringUtils.isBlank(defaultSortColumn)) {\n                lastOrderedColumn = defaultSortColumn;\n                lastSortOrder = displayerSettings.getTableDefaultSortOrder();\n            }\n        }\n        // Apply the sort order specified (if any)\n        if (lastOrderedColumn != null) {\n            sortApply(lastOrderedColumn, lastSortOrder);\n        }\n        // Lookup only the target rows\n        dataSetHandler.limitDataSetRows(view.getLastOffset(), getPageSize());\n    }\n\n    protected int getPageSize() {\n        return view.getPageSize() == 0 ? displayerSettings.getTablePageSize() : view.getPageSize();\n    }\n\n    @Override\n    protected void afterDataSetLookup(DataSet dataSet) {\n        totalRows = dataSet.getRowCountNonTrimmed();\n        view.setTotalRows(totalRows, isTotalRowsExact(dataSet, totalRows));\n    }\n\n    @Override\n    protected void createVisualization() {\n        if (displayerSettings.isTitleVisible()) {\n            view.showTitle(displayerSettings.getTitle());\n        }\n\n        List<DataColumn> dataColumns = dataSet.getColumns();\n        int width = displayerSettings.getTableWidth();\n\n        view.createTable(displayerSettings.getTablePageSize(), filterLabelSet);\n        view.setWidth(width == 0 ? dataColumns.size() * 100 + 40 : width);\n        view.setSortEnabled(displayerSettings.isTableSortEnabled());\n        view.setTotalRows(totalRows, isTotalRowsExact(dataSet, totalRows));\n        view.setPagerEnabled(isPagerEnabled(dataSet, totalRows));\n        view.setColumnPickerEnabled(displayerSettings.isTableColumnPickerEnabled());\n        view.setExportToCsvEnabled(displayerSettings.isCSVExportAllowed());\n        view.setExportToXlsEnabled(displayerSettings.isExcelExportAllowed());\n        \n        if(displayerSettings.isResizable()) {\n            view.fullWidth();\n        }\n\n        for ( int i = 0; i < dataColumns.size(); i++ ) {\n            DataColumn dataColumn = dataColumns.get(i);\n            ColumnSettings columnSettings = displayerSettings.getColumnSettings(dataColumn);\n            String columnName = columnSettings.getColumnName();\n            switch (dataColumn.getColumnType()) {\n\n                case LABEL: {\n                    // Only label columns cells are selectable\n                    view.addColumn(dataColumn.getColumnType(), dataColumn.getId(), columnName, i, displayerSettings.isFilterEnabled(), true);\n                    break;\n                }\n                default: {\n                    view.addColumn(dataColumn.getColumnType(), dataColumn.getId(), columnName, i, false, true);\n                    break;\n                }\n            }\n        }\n        view.gotoFirstPage();\n    }\n\n    protected boolean isTotalRowsExact(DataSet dataSet,\n                                       int totalRows) {\n        return isRemoteProvider(dataSet) ? totalRows < getPageSize() : true;\n    }\n\n    protected boolean isPagerEnabled(DataSet dataSet,\n                                     int totalRows) {\n        return isRemoteProvider(dataSet) ? totalRows == getPageSize() : getPageSize() < dataSet.getRowCountNonTrimmed();\n    }\n\n    protected boolean isRemoteProvider(DataSet dataSet) {\n        final DataSetDef def = dataSet.getDefinition();\n        return def == null || def.getProvider() == null ? false : def.getProvider().getName().equals(\"REMOTE\");\n    }\n\n    @Override\n    protected void updateVisualization() {\n        view.setTotalRows(totalRows, isTotalRowsExact(dataSet, totalRows));\n        view.setPagerEnabled(isPagerEnabled(dataSet, totalRows));\n        view.gotoFirstPage();\n        view.redrawTable();\n        updateFilterStatus();\n    }\n\n    protected void updateFilterStatus() {\n        filterLabelSet.clear();\n        Set<String> columnFilters = filterColumns();\n        if (displayerSettings.isFilterEnabled() && !columnFilters.isEmpty()) {\n\n            for (String columnId : columnFilters) {\n                List<Interval> selectedValues = filterIntervals(columnId);\n                DataColumn column = dataSet.getColumnById(columnId);\n                for (Interval interval : selectedValues) {\n                    String formattedValue = formatInterval(interval, column);\n                    FilterLabel filterLabel = filterLabelSet.addLabel(formattedValue);\n                    filterLabel.setOnRemoveCommand(() -> onFilterLabelRemoved(columnId, interval.getIndex()));\n                }\n            }\n        }\n    }\n\n    public void sortBy(String column, SortOrder order) {\n        if (displayerSettings.isTableSortEnabled()) {\n            lastOrderedColumn = column;\n            lastSortOrder = order;\n            super.redraw();\n        }\n    }\n\n    public void selectCell(String columnId, int rowIndex) {\n        if (displayerSettings.isFilterEnabled()) {\n            selectedCellColumn = columnId;\n            selectedCellRow = rowIndex;\n            for(Command cmd : onCellSelectedCommands){\n                cmd.execute();\n            }\n            if (displayerSettings.isFilterSelfApplyEnabled()) {\n                view.gotoFirstPage();\n            }\n            super.filterUpdate(columnId, rowIndex);\n            updateFilterStatus();\n        }\n    }\n\n    @Override\n    public void filterReset(String columnId) {\n        super.filterReset(columnId);\n        if (selectedCellColumn != null && selectedCellColumn.equals(columnId)) {\n            selectedCellColumn = null;\n            selectedCellRow = null;\n        }\n    }\n\n    @Override\n    public void filterReset() {\n        selectedCellColumn = null;\n        selectedCellRow = null;\n        filterLabelSet.clear();\n        super.filterReset();\n    }\n\n    public void lookupCurrentPage(final Callback<Integer> callback) {\n        try {\n            beforeDataSetLookup();\n            dataSetHandler.lookupDataSet(new DataSetReadyCallback() {\n                public void callback(DataSet ds) {\n                    try {\n                        dataSet = ds;\n                        afterDataSetLookup(dataSet);\n                        callback.callback(dataSet.getRowCount());\n                    }\n                    catch (Exception e) {\n                        showError(new ClientRuntimeError(e));\n                    }\n                }\n                public void notFound() {\n                    view.errorDataSetNotFound(displayerSettings.getDataSetLookup().getDataSetUUID());\n                }\n                public boolean onError(ClientRuntimeError error) {\n                    showError(error);\n                    return false;\n                }\n            });\n        } catch (Exception e) {\n            showError(new ClientRuntimeError(e));\n        }\n    }\n\n    public void export(ExportFormat format) {\n        super.export(format, exportRowNumMax, new ExportCallback() {\n\n            @Override\n            public void noData() {\n                view.exportNoData();\n            }\n\n            @Override\n            public void tooManyRows(int rowNum) {\n                view.exportTooManyRows(rowNum, exportRowNumMax);\n            }\n\n            @Override\n            public void exportFileUrl(String url) {\n                view.exportFileUrl(url);\n            }\n\n            @Override\n            public void error(ClientRuntimeError error) {\n                view.error(error);\n            }\n        });\n    }\n\n    // Filter label set component notifications\n\n    void onFilterLabelRemoved(String columnId, int row) {\n        super.filterUpdate(columnId, row);\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    void onFilterClearAll() {\n        filterReset();\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    // Reset the current navigation status on filter requests from external displayers\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n        view.gotoFirstPage();\n        super.onFilterEnabled(displayer, groupOp);\n    }\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetFilter filter) {\n        view.gotoFirstPage();\n        super.onFilterEnabled(displayer, filter);\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n        view.gotoFirstPage();\n        super.onFilterReset(displayer, groupOps);\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, DataSetFilter filter) {\n        view.gotoFirstPage();\n        super.onFilterReset(displayer, filter);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/java/org/dashbuilder/renderer/client/table/TableDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.table;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\n\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.displayer.client.export.ExportFormat;\nimport org.dashbuilder.renderer.client.resources.i18n.TableConstants;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\n\nimport static com.google.gwt.dom.client.BrowserEvents.CLICK;\nimport static com.google.gwt.dom.client.BrowserEvents.MOUSEOVER;\n\npublic class TableDisplayerView extends AbstractGwtDisplayerView<TableDisplayer> implements TableDisplayer.View {\n\n    protected HTML titleHtml = new HTML();\n    protected TableProvider tableProvider = new TableProvider();\n    protected VerticalPanel rootPanel = new VerticalPanel();\n    protected PagedTable<Integer> table;\n    protected Button exportToCsvButton;\n    protected Button exportToXlsButton;\n\n    @Override\n    public void init(TableDisplayer presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(rootPanel);\n        rootPanel.add(titleHtml);\n    }\n\n    @Override\n    public void showTitle(String title) {\n        titleHtml.setText(title);\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return TableConstants.INSTANCE.tableDisplayer_groupsTitle();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return TableConstants.INSTANCE.tableDisplayer_columnsTitle();\n    }\n\n    @Override\n    public void createTable(int pageSize, FilterLabelSet filterLabelSet) {\n        table = new PagedTable<>(pageSize);\n        table.pageSizesSelector.setVisible(false);\n        table.setEmptyTableCaption(TableConstants.INSTANCE.tableDisplayer_noDataAvailable());\n        table.pageSizesSelector.setForceDropup(true);\n        table.pageSizesSelector.setDropupAuto(false);\n        tableProvider.addDataDisplay(table);\n        tableProvider.lastPageSize = pageSize;\n\n        HTMLElement element = filterLabelSet.getElement();\n        element.getStyle().setProperty(\"margin-bottom\", \"5px\");\n        table.getLeftToolbar().add(ElementWrapperWidget.getWidget(filterLabelSet.getElement()));\n\n        exportToCsvButton = new Button(\"\", IconType.FILE_TEXT, e -> getPresenter().export(ExportFormat.CSV));\n        exportToXlsButton = new Button(\"\", IconType.FILE_EXCEL_O, e -> getPresenter().export(ExportFormat.XLS));\n        exportToCsvButton.setTitle(TableConstants.INSTANCE.tableDisplayer_export_to_csv());\n        exportToXlsButton.setTitle(TableConstants.INSTANCE.tableDisplayer_export_to_xls());\n\n        setupToolbar();\n        rootPanel.add(table);\n    }\n\n    protected void setupToolbar() {\n        HasWidgets rightToolbar = table.getRightToolbar();\n        if (rightToolbar instanceof HorizontalPanel) {\n            ((HorizontalPanel) rightToolbar).insert(exportToCsvButton,\n                                                    0);\n            ((HorizontalPanel) rightToolbar).insert(exportToXlsButton,\n                                                    1);\n        } else {\n            rightToolbar.add(exportToCsvButton);\n            rightToolbar.add(exportToXlsButton);\n        }\n    }\n\n    @Override\n    public void redrawTable() {\n        table.redraw();\n    }\n\n    @Override\n    public void setWidth(int width) {\n        table.setWidth(width + \"px\");\n    }\n    \n    @Override\n    public void fullWidth() {\n        table.setWidth(\"100%\");\n        rootPanel.setWidth(\"100%\");\n    }\n\n    @Override\n    public void setSortEnabled(boolean enabled) {\n        table.addColumnSortHandler(new ColumnSortEvent.AsyncHandler(table) {\n            public void onColumnSort(ColumnSortEvent event) {\n                String column = ((DataColumnCell) event.getColumn().getCell()).columnId;\n                SortOrder order = event.isSortAscending() ? SortOrder.ASCENDING : SortOrder.DESCENDING;\n                getPresenter().sortBy(column, order);\n            }\n        });\n    }\n\n    @Override\n    public void setTotalRows(int rows, boolean isExact) {\n        if(table != null) {\n            table.setRowCount(rows, isExact);\n        }\n    }\n\n    @Override\n    public void setPagerEnabled(boolean enabled) {\n        table.pager.setVisible(enabled);\n    }\n\n    @Override\n    public void setColumnPickerEnabled(boolean enabled) {\n        table.setColumnPickerButtonVisible(enabled);\n    }\n\n    @Override\n    public void setExportToCsvEnabled(boolean enabled) {\n        exportToCsvButton.setVisible(enabled);\n    }\n\n    @Override\n    public void setExportToXlsEnabled(boolean enabled) {\n        exportToXlsButton.setVisible(enabled);\n    }\n\n    @Override\n    public void addColumn(ColumnType columnType, String columnId, String columnName, int index, boolean selectEnabled, boolean sortEnabled) {\n        Column<Integer,?> column = createColumn(columnType, columnId, selectEnabled, index);\n        if (column != null) {\n            column.setSortable(sortEnabled);\n            table.addColumn(column, columnName);\n        }\n    }\n\n    @Override\n    public void gotoFirstPage() {\n        tableProvider.gotoFirstPage();\n    }\n\n    @Override\n    public int getLastOffset() {\n        return tableProvider.lastOffset;\n    }\n\n    @Override\n    public int getPageSize() {\n        return tableProvider.lastPageSize;\n    }\n\n    @Override\n    public void exportNoData() {\n        Window.alert(TableConstants.INSTANCE.tableDisplayer_export_no_data());\n    }\n\n    @Override\n    public void exportTooManyRows(int rowNum, int limit) {\n        Window.alert(TableConstants.INSTANCE.tableDisplayer_export_too_many_rows(rowNum, limit));\n    }\n\n    @Override\n    public void exportFileUrl(String url) {\n        Window.open(url, \"downloading\", \"resizable=no,scrollbars=yes,status=no\");\n    }\n\n    // Table internals\n\n    protected Column<Integer,?> createColumn(ColumnType type,\n                                             String columnId,\n                                             final boolean selectable,\n                                             final int columnNumber) {\n\n        switch (type) {\n            case LABEL: return new Column<Integer,String>(new DataColumnCell(columnId, selectable)) {\n                            public String getValue(Integer row) {\n                                return getPresenter().formatValue(row, columnNumber);\n                            }\n                        };\n\n            case NUMBER:\n            case DATE:\n            case TEXT: return new Column<Integer,String>(new DataColumnCell(columnId, selectable)) {\n                            public String getValue(Integer row) {\n                                return getPresenter().formatValue(row, columnNumber);\n                            }\n                        };\n        }\n        return null;\n    }\n\n    protected class DataColumnCell extends TextCell {\n\n        private String columnId;\n        private boolean selectable = false;\n\n        DataColumnCell(String columnId, boolean selectable) {\n            this.columnId = columnId;\n            this.selectable = selectable;\n        }\n\n        @Override\n        public Set<String> getConsumedEvents() {\n            Set<String> consumedEvents = new HashSet<String>();\n            if (selectable) {\n                consumedEvents.add(CLICK);\n                consumedEvents.add(MOUSEOVER);\n            }\n            return consumedEvents;\n        }\n\n        @Override\n        public void onBrowserEvent(Context context,\n                                   Element parent,\n                                   String value,\n                                   NativeEvent event,\n                                   ValueUpdater<String> valueUpdater) {\n\n            if (selectable) {\n                String eventType = event.getType();\n                switch (eventType) {\n\n                    case MOUSEOVER:\n                        parent.getStyle().setCursor(Style.Cursor.POINTER);\n                        break;\n\n                    case CLICK:\n                        int rowIndexInPage = context.getIndex() - table.getPageStart();\n                        getPresenter().selectCell(columnId, rowIndexInPage);\n                        break;\n                }\n            }\n        }\n    }\n\n    /**\n     * The table data provider\n     */\n    protected class TableProvider extends AsyncDataProvider<Integer> {\n\n        protected int lastOffset = 0;\n        protected int lastPageSize = 0;\n\n        protected List<Integer> getCurrentPageRows(HasData<Integer> display) {\n            final int start = display.getVisibleRange().getStart();\n            int pageSize =  display.getVisibleRange().getLength();\n            int items = Integer.min(pageSize, table.getRowCount() > start ? table.getRowCount() - start : table.getRowCount());\n            return IntStream.range(0, items).boxed().collect(Collectors.toList());\n        }\n\n        /**\n         * Both filter & sort invoke this method from redraw()\n         */\n        public void gotoFirstPage() {\n            // Avoid fetching the data set again\n            lastOffset = 0;\n            lastPageSize = table.getVisibleRange().getLength();\n\n            // This calls internally to onRangeChanged() when the page changes\n            table.pager.setPage(0);\n\n            int start = table.getVisibleRange().getStart();\n            final List<Integer> rows = getCurrentPageRows(table);\n            updateRowData(start, rows);\n        }\n\n        /**\n         * Invoked from createWidget just after the data set has been fetched.\n         */\n        public void addDataDisplay(HasData<Integer> display) {\n            // Avoid fetching the data set again\n            lastOffset = 0;\n            lastPageSize = table.getVisibleRange().getLength();\n\n            // This calls internally to onRangeChanged()\n            super.addDataDisplay(display);\n        }\n\n        /**\n         * This is invoked internally by the PagedTable on navigation actions.\n         */\n        protected void onRangeChanged(final HasData<Integer> display) {\n            final Range range = display.getVisibleRange();\n            if (lastOffset == range.getStart() && range.getLength() <= lastPageSize) {\n                lastPageSize = range.getLength();\n                if(table.getRowCount() > range.getLength()) {\n                    setPagerEnabled(true);\n                }\n                updateRowData(lastOffset, getCurrentPageRows(display));\n            }  else {\n                lastOffset = range.getStart();\n                lastPageSize = range.getLength();\n                getPresenter().lookupCurrentPage(rowsFetched -> {\n                    final List<Integer> rows = getCurrentPageRows(display);\n                    updateRowData(lastOffset, rows);\n                });\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.renderer.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/DefaultRenderer.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.slider.Slider\"/>\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nerror=ERROR:\nerror_settings_unset=DisplayerSettings property not set.\nerror_handler_unset=DataSetHandler property not set.\nerror_dataset_notfound=Data set not found.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_de.properties",
    "content": "error=FEHLER\\:\nerror_settings_unset=DisplayerSettings-Eigenschaft nicht eingestellt.\nerror_handler_unset=DataSetHandler-Eigenschaft nicht eingestellt.\nerror_dataset_notfound=Datensatz nicht gefunden.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nerror=ERROR:\nerror_settings_unset=Propiedad DisplayerSettings no establecida.\nerror_handler_unset=Propiedad DataSetHandler no establecida.\nerror_dataset_notfound=No se encuentra el conjunto de datos.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nerror=ERREUR :\nerror_settings_unset=La propriété DisplayerSettings n''est pas définie.\nerror_handler_unset=La propriété DataSetHandler n''est pas définie.\nerror_dataset_notfound=Ensemble de données introuvable.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nerror=ERRORE:\nerror_settings_unset=Proprietà DisplayerSettings non impostata.\nerror_handler_unset=Proprietà DataSetHandler non impostata.\nerror_dataset_notfound=Set di dati non trovato.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nerror=エラー:\nerror_settings_unset=DisplayerSettings プロパティーが設定されていません。\nerror_handler_unset=DataSetHandler プロパティーが設定されていません。\nerror_dataset_notfound=データセットが見つかりません。\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "error=ERRO\\:\nerror_settings_unset=Propriedade do DisplayerSettings não foi definida.\nerror_handler_unset=Propriedade do DataSetHandler não foi definida.\nerror_dataset_notfound=Data set não foi encontrado.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "error=错误：\nerror_settings_unset=没有设置 DisplayerSettings 属性。\nerror_handler_unset=没有设置 DataSetHandler 属性。\nerror_dataset_notfound=未找到数据集。\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmetricDisplayer_noDataAvailable=No data\nmetricDisplayer_columnsTitle=Metric\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_de.properties",
    "content": "metricDisplayer_columnsTitle=Metrik\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmetricDisplayer_noDataAvailable=No hay datos\nmetricDisplayer_columnsTitle=Métrica\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmetricDisplayer_noDataAvailable=Aucune donnée\nmetricDisplayer_columnsTitle=Métrique\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmetricDisplayer_noDataAvailable=Nessun dato\nmetricDisplayer_columnsTitle=Metrica\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmetricDisplayer_noDataAvailable=データなし\nmetricDisplayer_columnsTitle=メトリック\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_pt_BR.properties",
    "content": "metricDisplayer_columnsTitle=Métrica\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/MetricConstants_zh_CN.properties",
    "content": "metricDisplayer_columnsTitle=度量\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectorDisplayer_noDataAvailable=No data\nselectorDisplayer_groupsTitle=Entries\nselectorDisplayer_columnsTitle=Tooltip\nselectorDisplayer_select=Select\nselectorDisplayer_reset=Clear\nselectorDisplayer_clearAll=Clear All\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_de.properties",
    "content": "selectorDisplayer_select=Auswählen\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectorDisplayer_noDataAvailable=No hay datos\nselectorDisplayer_groupsTitle=Entradas\nselectorDisplayer_columnsTitle=Información sobre herramientas\nselectorDisplayer_select=Seleccionar\nselectorDisplayer_reset=Borrar\nselectorDisplayer_clearAll=Borrar todo\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectorDisplayer_noDataAvailable=Aucune donnée\nselectorDisplayer_groupsTitle=Entrées\nselectorDisplayer_columnsTitle=Info-bulle\nselectorDisplayer_select=Sélectionner\nselectorDisplayer_reset=Effacer\nselectorDisplayer_clearAll=Effacer tout\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectorDisplayer_noDataAvailable=Nessun dato\nselectorDisplayer_groupsTitle=Voci\nselectorDisplayer_columnsTitle=Tooltip\nselectorDisplayer_select=Seleziona\nselectorDisplayer_reset=Cancella\nselectorDisplayer_clearAll=Cancella tutto\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectorDisplayer_noDataAvailable=データなし\nselectorDisplayer_groupsTitle=エントリー\nselectorDisplayer_columnsTitle=値\nselectorDisplayer_select=選択\nselectorDisplayer_reset=消去\nselectorDisplayer_clearAll=すべて消去\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_pt_BR.properties",
    "content": "selectorDisplayer_select=Selecionar\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SelectorConstants_zh_CN.properties",
    "content": "selectorDisplayer_select=选择\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SliderConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsliderColumnName=Column\nsliderTooltip={0} to {1}\ntextColumnsNotSupported=Text columns not supported (only date and numeric are)\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SliderConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsliderColumnName=Columna\nsliderTooltip={0} a {1}\ntextColumnsNotSupported=Columnas de texto no admitidas (solo se admiten las de fecha y número)\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SliderConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsliderColumnName=Colonne\nsliderTooltip={0} à {1}\ntextColumnsNotSupported=Colonnes de texte non prises en charge (seules les colonnes de date et numériques le sont)\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SliderConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsliderColumnName=Colonna\nsliderTooltip={0} a {1}\ntextColumnsNotSupported=Colonne di testo non supportate (solo date e numeriche)\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/SliderConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsliderColumnName=カラム\nsliderTooltip={0} を {1} へ\ntextColumnsNotSupported=テキスト列はサポートされません（日付と数値のみサポート）\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ntableDisplayer_noDataAvailable=No data\ntableDisplayer_groupsTitle=Group By\ntableDisplayer_columnsTitle=Columns\ntableDisplayer_reset=reset\ntableDisplayer_export_to_csv=Export to CSV\ntableDisplayer_export_to_xls=Export to Excel\ntableDisplayer_export_no_data=No data to export. The table is empty.\ntableDisplayer_export_too_many_rows=The table rows={0} exceed the maximum allowed={1}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_de.properties",
    "content": "tableDisplayer_columnsTitle=Spalten\ntableDisplayer_reset=zurücksetzen\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ntableDisplayer_noDataAvailable=No hay datos\ntableDisplayer_groupsTitle=Agrupar por\ntableDisplayer_columnsTitle=Columnas\ntableDisplayer_reset=restablecer\ntableDisplayer_export_to_csv=Exportar a CSV\ntableDisplayer_export_to_xls=Exportar a Excel\ntableDisplayer_export_no_data=No hay datos para exportar. La tabla está vacía.\ntableDisplayer_export_too_many_rows=Las filas de la tabla={0} supera la cantidad máxima permitida={1}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ntableDisplayer_noDataAvailable=Aucune donnée\ntableDisplayer_groupsTitle=Grouper par\ntableDisplayer_columnsTitle=Colonnes\ntableDisplayer_reset=réinitialiser\ntableDisplayer_export_to_csv=Exporter au format CSV\ntableDisplayer_export_to_xls=Exporter vers Excel\ntableDisplayer_export_no_data=Aucune donnée à exporter. La table est vide.\ntableDisplayer_export_too_many_rows=Les lignes de la table={0} dépassent le maximum autorisé={1}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ntableDisplayer_noDataAvailable=Nessun dato\ntableDisplayer_groupsTitle=Raggruppa per\ntableDisplayer_columnsTitle=Colonne\ntableDisplayer_reset=reset\ntableDisplayer_export_to_csv=Esporta in CSV\ntableDisplayer_export_to_xls=Esporta in Excel\ntableDisplayer_export_no_data=Nessun dato da esportare. La tabella è vuota.\ntableDisplayer_export_too_many_rows=Le righe della tabella={0} superano il limite massimo consentito={1}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ntableDisplayer_noDataAvailable=データなし\ntableDisplayer_groupsTitle=グループ化\ntableDisplayer_columnsTitle=カラム\ntableDisplayer_reset=リセット\ntableDisplayer_export_to_csv=CSVにエクスポート\ntableDisplayer_export_to_xls=Excelにエクスポート\ntableDisplayer_export_no_data=エクスポートするデータがありませんテーブルは空です。\ntableDisplayer_export_too_many_rows=テーブル列 {0} は、最大数 {1} を超えています。\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_pt_BR.properties",
    "content": "tableDisplayer_columnsTitle=Colunas\ntableDisplayer_reset=reiniciar\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/main/resources/org/dashbuilder/renderer/client/resources/i18n/TableConstants_zh_CN.properties",
    "content": "tableDisplayer_columnsTitle=列\ntableDisplayer_reset=重置\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/external/ExternalComponentDisplayerTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.external;\n\nimport java.text.ParseException;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.ExpenseReportsData;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.AbstractDisplayer;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class ExternalComponentDisplayerTest extends AbstractDisplayerTest {\n\n    @Test\n    public void testBuildData() throws ParseException {\n        DataSet dataSet = ExpenseReportsData.INSTANCE.toDataSet();\n        DisplayerSettings settings = mock(DisplayerSettings.class);\n        ColumnSettings clSettings = mock(ColumnSettings.class);\n        ExternalComponentDisplayer displayer = new ExternalComponentDisplayer();\n\n        when(settings.getColumnSettings(anyString())).thenReturn(clSettings);\n\n        displayer.setDisplayerSettings(settings);\n        displayer.setEvaluator(new AbstractDisplayer.ExpressionEval() {\n\n            @Override\n            public String evalExpression(String value, String expression) {\n                return value;\n            }\n        });\n        String[][] buildData = displayer.buildData(dataSet);\n\n        for (int i = 0; i < buildData.length; i++) {\n            for (int j = 0; j < buildData[i].length; j++) {\n                assertEquals(buildData[i][j], dataSet.getValueAt(i, j).toString());\n            }\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/metric/MetricDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.metric;\n\nimport org.dashbuilder.common.client.StringUtils;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class MetricDisplayerTest extends AbstractDisplayerTest {\n\n    public static final String HTML_TEMPLATE =\n            \"<div id=\\\"${this}\\\" style=\\\"background-color:${bgColor}; width:${width}px; height:${height}px; \" +\n            \"margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;\\\">\\n\" +\n            \"  <span>${title}</span>\\n\" +\n            \"  <span>${value}</span>\\n\" +\n            \"</div>\";\n\n    public static final String JS_TEMPLATE = \"if (${isFilterEnabled}) {  \\n\" +\n            \"  var filterOn = ${isFilterOn};\\n\" +\n            \"  ${this}.style.cursor=\\\"pointer\\\";\\n\" +\n            \"  ${this}.onclick = function() {\\n\" +\n            \"    filterOn = !filterOn;\\n\" +\n            \"    ${this}.style.backgroundColor = filterOn ? \\\"lightblue\\\" : \\\"${bgColor}\\\";\\n\" +\n            \"    ${doFilter};\\n\" +\n            \"  };\\n\" +\n            \"}\";\n\n    @Mock\n    MetricDisplayer.View view;\n\n    @Mock\n    DisplayerListener listener;\n\n    public MetricDisplayer createMetricDisplayer(DisplayerSettings settings) {\n        MetricDisplayer displayer = initDisplayer(new MetricDisplayer(view), settings);\n        displayer.addListener(listener);\n        return displayer;\n    }\n\n    @Before\n    public void setUp() {\n        when(view.getUniqueId()).thenReturn(\"test\");\n    }\n\n    @Test\n    public void testDraw() {\n        DisplayerSettings engExpenses = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_DEPARTMENT, FilterFactory.equalsTo(\"Engineering\"))\n                .column(COLUMN_AMOUNT, AggregateFunctionType.SUM)\n                .title(\"Title\").titleVisible(true)\n                .width(300).height(200)\n                .margins(10, 20, 30, 40)\n                .backgroundColor(\"FDE8D4\")\n                .filterOff(true)\n                .htmlTemplate(HTML_TEMPLATE)\n                .jsTemplate(\"alert('${value.raw}');\")\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(engExpenses);\n        presenter.draw();\n\n        verify(view).setHtml(\"<div id=\\\"test_this\\\" style=\\\"background-color:#FDE8D4; width:300px; height:200px; \" +\n                \"margin-top:10px; margin-right:40px; margin-bottom:20px; margin-left:30px;\\\">\\n\" +\n                \"  <span>Title</span>\\n\" +\n                \"  <span>7,650.16</span>\\n\" +\n                \"</div>\");\n\n        verify(view).eval(\"alert('7650.16');\");\n    }\n\n    @Test\n    public void testDefaultTemplates() {\n        DisplayerSettings engExpenses = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(engExpenses);\n        String html = presenter.getHtmlTemplate();\n        String js = presenter.getJsTemplate();\n        assertFalse(StringUtils.isBlank(html));\n        assertFalse(StringUtils.isBlank(js));\n        assertFalse(html.equals(js));\n    }\n\n    @Test\n    public void testNoData() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .column(COLUMN_AMOUNT)\n                .title(\"Title\").titleVisible(true)\n                .width(300).height(200)\n                .margins(10, 20, 30, 40)\n                .backgroundColor(\"FDE8D4\")\n                .htmlTemplate(HTML_TEMPLATE)\n                .buildSettings();\n\n        when(view.getNoDataString()).thenReturn(\"0,0\");\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        MetricDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view, atLeastOnce()).getNoDataString();\n        verify(view).setHtml(\"<div id=\\\"test_this\\\" style=\\\"background-color:#FDE8D4; width:300px; height:200px; \" +\n                \"margin-top:10px; margin-right:40px; margin-bottom:20px; margin-left:30px;\\\">\\n\" +\n                \"  <span>Title</span>\\n\" +\n                \"  <span>0,0</span>\\n\" +\n                \"</div>\");\n    }\n\n    @Test\n    public void testNoFilter() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .column(COLUMN_AMOUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        MetricDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        reset(listener);\n        presenter.filterApply();\n\n        verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetFilter.class));\n    }\n\n    @Test\n    public void testSwitchOnFilter() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .column(COLUMN_AMOUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        MetricDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        reset(listener);\n        presenter.updateFilter();\n\n        verify(listener).onFilterEnabled(eq(presenter), any(DataSetFilter.class));\n    }\n\n    @Test\n    public void testSwitchOffFilter() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .column(COLUMN_AMOUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        MetricDisplayer.View view = presenter.getView();\n        presenter.draw();\n        presenter.filterApply();\n\n        reset(view);\n        reset(listener);\n        presenter.filterReset();\n\n        verify(listener).onFilterReset(eq(presenter), any(DataSetFilter.class));\n    }\n\n    @Test\n    public void testFilterOn() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .column(COLUMN_AMOUNT)\n                .filterOn(false, true, true)\n                .jsTemplate(JS_TEMPLATE)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        presenter.setFilterOn(true);\n        presenter.draw();\n        assertEquals(presenter.isFilterOn(), true);\n        verify(view).eval(\"if (true) {  \\n\" +\n                \"  var filterOn = true;\\n\" +\n                \"  document.getElementById(\\\"test_this\\\").style.cursor=\\\"pointer\\\";\\n\" +\n                \"  document.getElementById(\\\"test_this\\\").onclick = function() {\\n\" +\n                \"    filterOn = !filterOn;\\n\" +\n                \"    document.getElementById(\\\"test_this\\\").style.backgroundColor = filterOn ? \\\"lightblue\\\" : \\\"white\\\";\\n\" +\n                \"    window.metricDisplayerDoFilter('test');\\n\" +\n                \"  };\\n\" +\n                \"}\");\n    }\n\n    @Test\n    public void testFilterOff() {\n        DisplayerSettings empty = DisplayerSettingsFactory.newMetricSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .column(COLUMN_AMOUNT)\n                .filterOn(false, true, true)\n                .jsTemplate(JS_TEMPLATE)\n                .buildSettings();\n\n        MetricDisplayer presenter = createMetricDisplayer(empty);\n        presenter.setFilterOn(false);\n        presenter.draw();\n        assertEquals(presenter.isFilterOn(), false);\n        verify(view).eval(\"if (true) {  \\n\" +\n                \"  var filterOn = false;\\n\" +\n                \"  document.getElementById(\\\"test_this\\\").style.cursor=\\\"pointer\\\";\\n\" +\n                \"  document.getElementById(\\\"test_this\\\").onclick = function() {\\n\" +\n                \"    filterOn = !filterOn;\\n\" +\n                \"    document.getElementById(\\\"test_this\\\").style.backgroundColor = filterOn ? \\\"lightblue\\\" : \\\"white\\\";\\n\" +\n                \"    window.metricDisplayerDoFilter('test');\\n\" +\n                \"  };\\n\" +\n                \"}\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/selector/SelectorCoordinatorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.Date;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.client.AbstractDisplayer;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.widgets.filter.DateParameterEditor;\nimport org.dashbuilder.displayer.client.widgets.filter.NumberParameterEditor;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SelectorCoordinatorTest extends AbstractDisplayerTest {\n\n    DisplayerSettings yearLabels = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, false)\n            .subtype(DisplayerSubType.SELECTOR_LABELS)\n            .buildSettings();\n\n    DisplayerSettings dateSlider = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_DATE)\n            .filterOn(false, true, true)\n            .subtype(DisplayerSubType.SELECTOR_SLIDER)\n            .buildSettings();\n\n    DisplayerSettings numberSlider = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_AMOUNT)\n            .filterOn(false, true, false)\n            .subtype(DisplayerSubType.SELECTOR_SLIDER)\n            .buildSettings();\n\n    DisplayerSettings dropDownDept = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DEPARTMENT)\n            .column(COLUMN_DEPARTMENT)\n            .filterOn(false, true, true)\n            .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n            .multiple(true)\n            .buildSettings();\n\n    DisplayerSettings dropDownCity = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_CITY)\n            .column(COLUMN_CITY)\n            .filterOn(false, true, true)\n            .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n            .multiple(true)\n            .buildSettings();\n\n    DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_DEPARTMENT)\n            .column(COLUMN_CITY)\n            .column(COLUMN_EMPLOYEE)\n            .column(COLUMN_AMOUNT)\n            .column(COLUMN_DATE)\n            .filterOn(true, false, true)\n            .buildSettings();\n\n    DisplayerCoordinator displayerCoordinator;\n    AbstractDisplayer allRowsDisplayer;\n    SelectorLabelSetDisplayer yearLabelDisplayer;\n    SelectorSliderDisplayer dateSliderDisplayer;\n    SelectorSliderDisplayer numberSliderDisplayer;\n    SelectorDropDownDisplayer deptDropDownDisplayer;\n    SelectorDropDownDisplayer cityDropDownDisplayer;\n\n    @Mock\n    SelectorLabelSetDisplayer.View labelSetView;\n\n    @Mock\n    SelectorSliderDisplayer.View sliderView;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    DateParameterEditor dateEditor;\n\n    @Mock\n    NumberParameterEditor numberEditor;\n\n    @Mock\n    DisplayerListener listener;\n\n    @Mock\n    SelectorLabelItem labelItem;\n\n    @Mock\n    SyncBeanDef<SelectorLabelItem> labelItemBean;\n\n    @Mock\n    SyncBeanDef<SelectorDropDownItem> dropDownItemBean;\n\n    @Mock\n    SelectorDropDownItem dropDownItem;\n\n    public SelectorLabelSetDisplayer createLabelSetDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorLabelSetDisplayer(labelSetView, beanManager), settings);\n    }\n\n    public SelectorSliderDisplayer createSliderDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorSliderDisplayer(sliderView, dateEditor, dateEditor, numberEditor, numberEditor), settings);\n    }\n\n    public SelectorDropDownDisplayer createDropDownDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorDropDownDisplayer(mock(SelectorDropDownDisplayerView.class), beanManager), settings);\n    }\n\n    @Before\n    public void init() throws Exception {\n        super.init();\n\n        when(beanManager.lookupBean(SelectorLabelItem.class)).thenReturn(labelItemBean);\n        when(labelItemBean.newInstance()).thenReturn(labelItem);\n\n        when(beanManager.lookupBean(SelectorDropDownItem.class)).thenReturn(dropDownItemBean);\n        when(dropDownItemBean.newInstance()).thenReturn(dropDownItem);\n\n        allRowsDisplayer = createNewDisplayer(allRows);\n        dateSliderDisplayer = createSliderDisplayer(dateSlider);\n        numberSliderDisplayer = createSliderDisplayer(numberSlider);\n        yearLabelDisplayer = createLabelSetDisplayer(yearLabels);\n        cityDropDownDisplayer = createDropDownDisplayer(dropDownCity);\n        deptDropDownDisplayer = createDropDownDisplayer(dropDownDept);\n\n        displayerCoordinator = new DisplayerCoordinator(rendererManager);\n        displayerCoordinator.addDisplayers(allRowsDisplayer, dateSliderDisplayer, numberSliderDisplayer, yearLabelDisplayer, cityDropDownDisplayer, deptDropDownDisplayer);\n        displayerCoordinator.addListener(listener);\n    }\n\n    @Test\n    public void testDrawAll() {\n        displayerCoordinator.drawAll();\n\n        verify(listener, times(6)).onDraw(any(Displayer.class));\n    }\n\n    @Test\n    public void testFilterPropagations() {\n        displayerCoordinator.drawAll();\n\n        // Select the first year label (2009)\n        reset(listener);\n        when(labelItem.getId()).thenReturn(0);\n        yearLabelDisplayer.onItemSelected(labelItem);\n\n        // Check the allRowsDisplayer receives the filter request\n        DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 13);\n        verify(listener).onDataLookup(allRowsDisplayer);\n        verify(listener).onRedraw(allRowsDisplayer);\n    }\n    @Test\n    public void testTwoDateFilters() {\n        displayerCoordinator.drawAll();\n\n        // Select the first year label (2012)\n        when(labelItem.getId()).thenReturn(0);\n        yearLabelDisplayer.onItemSelected(labelItem);\n        reset(listener);\n\n        // Select 2012 year on slider\n        when(labelItem.getId()).thenReturn(0);\n        Date min = new Date(112, 0, 1);\n        Date max = new Date(112, 11, 31);\n        dateSliderDisplayer.onSliderChange(min.getTime(), max.getTime());\n\n        // Check the allRowsDisplayer receives all the filter requests\n        DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 13);\n        verify(listener).onDataLookup(allRowsDisplayer);\n        verify(listener).onRedraw(allRowsDisplayer);\n    }\n\n    @Test\n    public void testSliderDateKeepsSelection() {\n        displayerCoordinator.drawAll();\n        Date min = (Date) dateSliderDisplayer.getSelectedMin();\n        Date max = (Date) dateSliderDisplayer.getSelectedMax();\n\n        // Select the first year label (2012)\n        when(labelItem.getId()).thenReturn(0);\n        yearLabelDisplayer.onItemSelected(labelItem);\n        Date min2012 = (Date) dateSliderDisplayer.getSelectedMin();\n        Date max2012 = (Date) dateSliderDisplayer.getSelectedMax();\n        verify(sliderView).showSlider(min2012.getTime(), max2012.getTime(), 1, min2012.getTime(), max2012.getTime());\n\n        // Shorten the slider\n        Date newMin = new Date(112, 3, 3);\n        dateSliderDisplayer.onSliderChange(newMin.getTime(), max.getTime());\n        assertEquals(dateSliderDisplayer.getSelectedMin(), newMin);\n        assertEquals(dateSliderDisplayer.getSelectedMax(), max);\n\n        // Reset the label filter and check the slider keeps its latest selection\n        reset(sliderView);\n        yearLabelDisplayer.filterReset();\n        assertEquals(dateSliderDisplayer.getSelectedMin(), newMin);\n        assertEquals(dateSliderDisplayer.getSelectedMax(), max);\n        verify(sliderView).showSlider(min.getTime(), max.getTime(), 1, newMin.getTime(), max.getTime());\n    }\n\n    @Test\n    public void testMinMaxNumberSliderEquals() {\n        displayerCoordinator.drawAll();\n\n        // Filter by a range\n        numberSliderDisplayer.onSliderChange(11, 100);\n        DataSet dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 3);\n\n        // Select the same min/max amount\n        reset(listener);\n        numberSliderDisplayer.onSliderChange(100, 100);\n\n        // Check the allRowsDisplayer receives all the filter requests and no data is found\n        dataSet = allRowsDisplayer.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getRowCount(), 1);\n        verify(listener).onDataLookup(allRowsDisplayer);\n        verify(listener).onRedraw(allRowsDisplayer);\n    }\n\n    @Test\n    public void testSelectedDropDownItems() {\n        displayerCoordinator.drawAll();\n\n        // Select the first item on both drop down selectors\n        when(dropDownItem.getId()).thenReturn(0);\n        cityDropDownDisplayer.onItemSelected(dropDownItem);\n\n        reset(dropDownItem);\n        deptDropDownDisplayer.onItemSelected(dropDownItem);\n        verify(dropDownItem).select();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/selector/SelectorDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SelectorDisplayerTest extends AbstractDisplayerTest {\n\n    public SelectorDisplayer createSelectorDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorDisplayer(mock(SelectorDisplayer.View.class)), settings);\n    }\n\n    @Test\n    public void testDraw() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, false)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).setFilterEnabled(true);\n        verify(view).clearItems();\n        verify(view).showSelectHint(COLUMN_DEPARTMENT);\n        verify(view, times(5)).addItem(anyString(), anyString(), eq(false));\n        verify(view, never()).showResetHint(anyString());\n    }\n\n    @Test\n    public void testNoData() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).clearItems();\n        verify(view).showSelectHint(COLUMN_DEPARTMENT);\n        verify(view, never()).addItem(anyString(), anyString(), anyBoolean());\n    }\n\n    @Test\n    public void testNullNotShown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // ... and make sure it's not shown\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view, never()).addItem(anyString(), eq((String) null), anyBoolean());\n        verify(view, times(5)).addItem(anyString(), anyString(), eq(false));\n    }\n\n    @Test\n    public void testSelectDisabled() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOff(true)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        SelectorDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        when(view.getSelectedId()).thenReturn(\"1\");\n        presenter.addListener(listener);\n        presenter.onItemSelected();\n\n        // Check filter notifications\n        verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener, never()).onRedraw(presenter);\n\n        // Ensure data does not change\n        verify(view).showResetHint(COLUMN_DEPARTMENT);\n        verify(view, never()).clearItems();\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT);\n        verify(view, never()).addItem(anyString(), anyString(), anyBoolean());\n    }\n\n    @Test\n    public void testSelectItem() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select an item\n        reset(view);\n        when(view.getSelectedId()).thenReturn(\"1\");\n        presenter.addListener(listener);\n        presenter.onItemSelected();\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(anyString(), anyString(), anyBoolean());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(view).showResetHint(COLUMN_DEPARTMENT);\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetGroup dataSetGroup = argument.getValue();\n        Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);\n        assertEquals(selectedInterval.getName(), \"Services\");\n    }\n\n    @Test\n    public void testDrillDown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(true, true, true)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        reset(view);\n        when(view.getSelectedId()).thenReturn(\"1\");\n        presenter.addListener(listener);\n        presenter.onItemSelected();\n\n        // Check filter notifications\n        verify(listener).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener).onRedraw(presenter);\n\n        // Check selector refreshes\n        verify(view).clearItems();\n        verify(view, atLeastOnce()).showResetHint(COLUMN_DEPARTMENT);\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT);\n        verify(view, times(1)).addItem(anyString(), anyString(), eq(false));\n    }\n\n\n    @Test\n    public void testNullEntries() {\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // Create a selector displayer\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        SelectorDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.addListener(listener);\n        presenter.draw();\n\n        // Verify that null entries are not shown\n        verify(view, times(5)).addItem(anyString(), anyString(), eq(false));\n        verify(view, never()).addItem(anyString(), eq((String) null), anyBoolean());\n\n        // Select an item\n        reset(listener);\n        when(view.getSelectedId()).thenReturn(\"1\");\n        presenter.onItemSelected();\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        DataSetGroup dataSetGroup = argument.getValue();\n        Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);\n        assertEquals(selectedInterval.getName(), \"Engineering\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/selector/SelectorDropDownDisplayerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SelectorDropDownDisplayerTest extends AbstractDisplayerTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<SelectorDropDownItem> dropDownItemBean;\n\n    @Mock\n    SelectorDropDownItem dropDownItem;\n\n    public SelectorDropDownDisplayer createSelectorDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorDropDownDisplayer(mock(SelectorDropDownDisplayer.View.class), beanManager), settings);\n    }\n\n    @Before\n    public void setUp() {\n        when(beanManager.lookupBean(SelectorDropDownItem.class)).thenReturn(dropDownItemBean);\n        when(dropDownItemBean.newInstance()).thenReturn(dropDownItem);\n    }\n\n    @Test\n    public void testDraw() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, false)\n                .multiple(false)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).clearItems();\n        verify(view).showSelectHint(COLUMN_DEPARTMENT, false);\n        verify(view, times(5)).addItem(any());\n        verify(view, never()).showResetHint(anyString(), anyBoolean());\n\n        // Verify the entries are sorted by default\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"Engineering\");\n        assertEquals(dataSet.getValueAt(4, 0), \"Support\");\n    }\n\n    @Test\n    public void testNoData() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .multiple(false)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).clearItems();\n        verify(view).showSelectHint(COLUMN_DEPARTMENT, false);\n        verify(view, never()).addItem(any());\n    }\n\n    @Test\n    public void testNullNotShown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // ... and make sure it's not shown\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view, times(5)).addItem(any());\n        verify(view, never()).addItem(null);\n    }\n\n    @Test\n    public void testSelectDisabled() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOff(true)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        presenter.addListener(listener);\n        presenter.onItemSelected(dropDownItem);\n\n        // Check filter notifications\n        verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener, never()).onRedraw(presenter);\n\n        // Ensure data does not change\n        verify(view, never()).showResetHint(COLUMN_DEPARTMENT, true);\n        verify(view, never()).clearItems();\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, true);\n        verify(view, never()).addItem(any());\n    }\n\n    @Test\n    public void testSelectItem() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .multiple(false)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select an item\n        reset(view);\n        when(dropDownItem.getId()).thenReturn(1);\n        presenter.addListener(listener);\n        presenter.onItemSelected(dropDownItem);\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(any());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(view).showResetHint(COLUMN_DEPARTMENT, false);\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, false);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetGroup dataSetGroup = argument.getValue();\n        List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();\n        assertEquals(selectedIntervals.size(), 1);\n        Interval selectedInterval = selectedIntervals.get(0);\n        assertEquals(selectedInterval.getName(), \"Management\");\n    }\n\n    @Test\n    public void testMultipleSelect() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .multiple(true)\n                .width(100)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select an item\n        presenter.addListener(listener);\n        when(dropDownItem.getId()).thenReturn(1);\n        presenter.onItemSelected(dropDownItem);\n\n        // Select another item\n        reset(view);\n        reset(listener);\n        when(dropDownItem.getId()).thenReturn(2);\n        presenter.onItemSelected(dropDownItem);\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(any());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(view).showResetHint(COLUMN_DEPARTMENT, true);\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, true);\n        verify(view).showCurrentSelection(\"Management ...\", \"Management, Sales \");\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetGroup dataSetGroup = argument.getValue();\n        List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();\n        assertEquals(selectedIntervals.size(), 2);\n        Interval selectedInterval1 = selectedIntervals.get(0);\n        Interval selectedInterval2 = selectedIntervals.get(1);\n        assertEquals(selectedInterval1.getName(), \"Management\");\n        assertEquals(selectedInterval2.getName(), \"Sales\");\n\n    }\n\n    @Test\n    public void testFormatItemList() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .multiple(true)\n                .width(90)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n\n        String result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"), 200);\n        assertEquals(result, \"Sales, Management, IT \");\n\n        result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"));\n        assertEquals(result, \"Sales, Management, IT \");\n\n        result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"), 150);\n        assertEquals(result, \"Sales, Managemen...\");\n\n        result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"), 130);\n        assertEquals(result, \"Sales, Managem...\");\n\n        result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"), 60);\n        assertEquals(result, \"Sales ...\");\n\n        result = presenter.formatItemList(Arrays.asList(\"Sales\", \"Management\", \"IT\"), 10);\n        assertEquals(result, \"S...\");\n    }\n\n    @Test\n    public void testDrillDown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(true, true, true)\n                .multiple(false)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        reset(view);\n        when(dropDownItem.getId()).thenReturn(1);\n        presenter.addListener(listener);\n        presenter.onItemSelected(dropDownItem);\n\n        // Check filter notifications\n        verify(listener).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener).onRedraw(presenter);\n\n        // Check selector refreshes\n        verify(view).clearItems();\n        verify(view, atLeastOnce()).showResetHint(COLUMN_DEPARTMENT, false);\n        verify(view, never()).showSelectHint(COLUMN_DEPARTMENT, false);\n        verify(view, times(1)).addItem(any());\n    }\n\n    @Test\n    public void testNullEntries() {\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // Create a selector displayer\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorDropDownDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.addListener(listener);\n        presenter.draw();\n\n        // Verify that null entries are not shown\n        verify(view, times(5)).addItem(any());\n        verify(view, never()).addItem(null);\n\n        // Select an item\n        reset(listener);\n        when(dropDownItem.getId()).thenReturn(1);\n        presenter.onItemSelected(dropDownItem);\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        DataSetGroup dataSetGroup = argument.getValue();\n        Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);\n        assertEquals(selectedInterval.getName(), \"Engineering\");\n    }\n\n    @Test\n    public void testSortFixedMonthDefault() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MONTH, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"1\");\n        assertEquals(dataSet.getValueAt(11, 0), \"12\");\n    }\n\n    @Test\n    public void testSortFixedFirstMonth() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MONTH, true).firstMonth(Month.FEBRUARY)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"2\");\n        assertEquals(dataSet.getValueAt(11, 0), \"1\");\n    }\n\n    @Test\n    public void testSortFixedDayOfWeekDefault() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.DAY_OF_WEEK, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"2\");\n        assertEquals(dataSet.getValueAt(6, 0), \"1\");\n    }\n\n    @Test\n    public void testSortFixedFirstDayOfWeek() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.DAY_OF_WEEK, true).firstDay(DayOfWeek.SUNDAY)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"1\");\n        assertEquals(dataSet.getValueAt(6, 0), \"7\");\n    }\n\n    @Test\n    public void testSortFixedHour() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.HOUR, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(23, 0), \"23\");\n    }\n\n    @Test\n    public void testSortFixedMinute() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MINUTE, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(59, 0), \"59\");\n    }\n\n    @Test\n    public void testSortFixedSecond() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.SECOND, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorDropDownDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(59, 0), \"59\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/selector/SelectorLabelSetDisplayerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.date.DayOfWeek;\nimport org.dashbuilder.dataset.date.Month;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SelectorLabelSetDisplayerTest extends AbstractDisplayerTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    SyncBeanDef<SelectorLabelItem> labelItemBean;\n\n    @Mock\n    SelectorLabelItem labelItem;\n\n    public SelectorLabelSetDisplayer createSelectorDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorLabelSetDisplayer(mock(SelectorLabelSetDisplayer.View.class), beanManager), settings);\n    }\n\n    @Before\n    public void setUp() {\n        when(beanManager.lookupBean(SelectorLabelItem.class)).thenReturn(labelItemBean);\n        when(labelItemBean.newInstance()).thenReturn(labelItem);\n    }\n\n    @Test\n    public void testDraw() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, false)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).clearItems();\n        verify(view, times(5)).addItem(any());\n\n        // Verify the entries are sorted by default\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"Engineering\");\n        assertEquals(dataSet.getValueAt(4, 0), \"Support\");\n    }\n\n    @Test\n    public void testNoData() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).clearItems();\n        verify(view, never()).addItem(any());\n    }\n\n    @Test\n    public void testNullNotShown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // ... and make sure it's not shown\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view, times(5)).addItem(any());\n        verify(view, never()).addItem(null);\n    }\n\n    @Test\n    public void testSelectDisabled() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOff(true)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        presenter.addListener(listener);\n        presenter.onItemSelected(labelItem);\n\n        // Check filter notifications\n        verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener, never()).onRedraw(presenter);\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(any());\n    }\n\n    @Test\n    public void testSelectItem() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select an item\n        reset(view);\n        when(labelItem.getId()).thenReturn(1);\n        presenter.addListener(listener);\n        presenter.onItemSelected(labelItem);\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(any());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetGroup dataSetGroup = argument.getValue();\n        List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();\n        assertEquals(selectedIntervals.size(), 1);\n        Interval selectedInterval = selectedIntervals.get(0);\n        assertEquals(selectedInterval.getName(), \"Management\");\n    }\n\n    @Test\n    public void testMultipleSelect() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .multiple(true)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select an item\n        reset(view);\n        presenter.addListener(listener);\n        when(labelItem.getId()).thenReturn(1);\n        presenter.onItemSelected(labelItem);\n        when(labelItem.getId()).thenReturn(2);\n        presenter.onItemSelected(labelItem);\n\n        // Ensure data does not change\n        verify(view, never()).clearItems();\n        verify(view, never()).addItem(any());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(listener, times(2)).onFilterEnabled(eq(presenter), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetGroup dataSetGroup = argument.getValue();\n        List<Interval> selectedIntervals = dataSetGroup.getSelectedIntervalList();\n        assertEquals(selectedIntervals.size(), 2);\n        Interval selectedInterval1 = selectedIntervals.get(0);\n        Interval selectedInterval2 = selectedIntervals.get(1);\n        assertEquals(selectedInterval1.getName(), \"Management\");\n        assertEquals(selectedInterval2.getName(), \"Sales\");\n    }\n\n    @Test\n    public void testDrillDown() {\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(true, true, true)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        reset(view);\n        when(labelItem.getId()).thenReturn(1);\n        presenter.addListener(listener);\n        presenter.onItemSelected(labelItem);\n\n        // Check filter notifications\n        verify(listener).onFilterEnabled(eq(presenter), any(DataSetGroup.class));\n        verify(listener).onRedraw(presenter);\n\n        // Check selector refreshes\n        verify(view).clearItems();\n        verify(view, times(1)).addItem(any());\n    }\n\n\n    @Test\n    public void testNullEntries() {\n        // Insert a null entry into the dataset\n        DataSet expensesDataSet = clientDataSetManager.getDataSet(EXPENSES);\n        int column = expensesDataSet.getColumnIndex(expensesDataSet.getColumnById(COLUMN_DEPARTMENT));\n        expensesDataSet.setValueAt(0, column, null);\n\n        // Create a selector displayer\n        DisplayerSettings departmentList = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DEPARTMENT)\n                .column(COLUMN_DEPARTMENT)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(departmentList);\n        SelectorLabelSetDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.addListener(listener);\n        presenter.draw();\n\n        // Verify that null entries are not shown\n        verify(view, times(5)).addItem(any());\n        verify(view, never()).addItem(null);\n\n        // Select an item\n        reset(listener);\n        when(labelItem.getId()).thenReturn(1);\n        presenter.onItemSelected(labelItem);\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetGroup> argument = ArgumentCaptor.forClass(DataSetGroup.class);\n        verify(listener).onFilterEnabled(eq(presenter), argument.capture());\n        DataSetGroup dataSetGroup = argument.getValue();\n        Interval selectedInterval = dataSetGroup.getSelectedIntervalList().get(0);\n        assertEquals(selectedInterval.getName(), \"Engineering\");\n    }\n\n\n    @Test\n    public void testSortFixedMonthDefault() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MONTH, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"1\");\n        assertEquals(dataSet.getValueAt(11, 0), \"12\");\n    }\n\n    @Test\n    public void testSortFixedFirstMonth() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MONTH, true).firstMonth(Month.FEBRUARY)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"2\");\n        assertEquals(dataSet.getValueAt(11, 0), \"1\");\n    }\n\n    @Test\n    public void testSortFixedDayOfWeekDefault() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.DAY_OF_WEEK, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"2\");\n        assertEquals(dataSet.getValueAt(6, 0), \"1\");\n    }\n\n    @Test\n    public void testSortFixedFirstDayOfWeek() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.DAY_OF_WEEK, true).firstDay(DayOfWeek.SUNDAY)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"1\");\n        assertEquals(dataSet.getValueAt(6, 0), \"7\");\n    }\n\n    @Test\n    public void testSortFixedHour() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.HOUR, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(23, 0), \"23\");\n    }\n\n    @Test\n    public void testSortFixedMinute() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.MINUTE, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(59, 0), \"59\");\n    }\n\n    @Test\n    public void testSortFixedSecond() {\n        DisplayerSettings displayerSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE).fixed(DateIntervalType.SECOND, true)\n                .column(COLUMN_DATE)\n                .column(COLUMN_ID, AggregateFunctionType.COUNT)\n                .buildSettings();\n\n        SelectorLabelSetDisplayer presenter = createSelectorDisplayer(displayerSettings);\n        presenter.draw();\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        assertEquals(dataSet.getValueAt(0, 0), \"0\");\n        assertEquals(dataSet.getValueAt(59, 0), \"59\");\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/selector/SelectorSliderDisplayerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.selector;\n\nimport java.util.Date;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.engine.ClientDateFormatter;\nimport org.dashbuilder.dataset.filter.CoreFunctionFilter;\nimport org.dashbuilder.dataset.filter.CoreFunctionType;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.widgets.filter.DateParameterEditor;\nimport org.dashbuilder.displayer.client.widgets.filter.NumberParameterEditor;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SelectorSliderDisplayerTest extends AbstractDisplayerTest {\n\n    @Mock\n    ClientDateFormatter clientDateFormatter;\n\n    @Mock\n    DateParameterEditor minDateInputEditor;\n\n    @Mock\n    DateParameterEditor maxDateInputEditor;\n\n    @Mock\n    NumberParameterEditor minNumberInputEditor;\n\n    @Mock\n    NumberParameterEditor maxNumberInputEditor;\n\n    DisplayerSettings dateSelectorSettings = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_DATE)\n            .width(200)\n            .filterOn(false, true, false)\n            .buildSettings();\n\n    DisplayerSettings numberSelectorSettings = DisplayerSettingsFactory.newSelectorSettings()\n            .dataset(EXPENSES)\n            .column(COLUMN_AMOUNT)\n            .width(200)\n            .filterOn(false, true, false)\n            .buildSettings();\n\n\n    public SelectorSliderDisplayer createSelectorDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new SelectorSliderDisplayer(mock(SelectorSliderDisplayer.View.class),\n                minDateInputEditor, maxDateInputEditor, minNumberInputEditor, maxNumberInputEditor), settings);\n    }\n\n    @Test\n    public void testDateSelector() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.addListener(listener);\n        presenter.draw();\n\n        verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());\n        verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());\n        verify(view).setWidth(anyInt());\n\n        // Ensure no filter is executed if the range does not change\n        presenter.onSliderChange(1, 6);\n        reset(listener);\n        presenter.onSliderChange(1, 6);\n        verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));\n    }\n\n    @Test\n    public void testNumberSelector() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(numberSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.addListener(listener);\n        presenter.draw();\n\n        verify(view).showSlider(1, 1101, 1, 1, 1101);\n        verify(view).margins(anyInt(), anyInt(), anyInt(), anyInt());\n        verify(view).setWidth(anyInt());\n\n        // Ensure no filter is executed if the range does not change\n        presenter.onSliderChange(1, 6);\n        reset(listener);\n        presenter.onSliderChange(1, 6);\n        verify(listener, never()).onFilterUpdate(eq(presenter), any(DataSetFilter.class), any(DataSetFilter.class));\n    }\n\n    @Test\n    public void testNoData() {\n        DisplayerSettings dateSelectorSettings = DisplayerSettingsFactory.newSelectorSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_DATE, FilterFactory.isNull())\n                .column(COLUMN_DATE)\n                .buildSettings();\n\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        verify(view).noData();\n        verify(view, never()).showSlider(anyInt(), anyInt(), anyInt(), anyInt(), anyInt());\n    }\n\n    @Test\n    public void testSelectDisabled() {\n        dateSelectorSettings.setFilterEnabled(false);\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        DisplayerListener listener = mock(DisplayerListener.class);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        presenter.addListener(listener);\n        presenter.onSliderChange(0, 1);\n\n        // Check filter notifications\n        verify(listener, never()).onFilterEnabled(eq(presenter), any(DataSetFilter.class));\n        verify(listener, never()).onRedraw(presenter);\n\n        // Ensure data does not change\n        verify(view, never()).showSlider(anyInt(), anyInt(), anyInt(), anyInt(), anyInt());\n    }\n\n    @Test\n    public void testDateRangeSelection() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select a range\n        reset(view);\n        presenter.addListener(listener);\n        presenter.onSliderChange(1328050800000d, 1333231200000d);\n\n        // Ensure data does not change\n        verify(view, never()).showSlider(anyInt(), anyInt(), anyInt(), anyInt(), anyInt());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetFilter> argument = ArgumentCaptor.forClass(DataSetFilter.class);\n        verify(listener).onFilterUpdate(eq(presenter), any(), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetFilter dataSetFilter = argument.getValue();\n        CoreFunctionFilter columnFilter = (CoreFunctionFilter) dataSetFilter.getColumnFilterList().get(0);\n        assertEquals(columnFilter.getColumnId(), COLUMN_DATE);\n        assertEquals(columnFilter.getType(), CoreFunctionType.BETWEEN);\n        assertEquals(columnFilter.getParameters().size(), 2);\n        assertEquals(columnFilter.getParameters().get(0), new Date(1328050800000L));\n        assertEquals(columnFilter.getParameters().get(1), new Date(1333231200000L));\n\n        // Select another range\n        reset(listener);\n        presenter.onSliderChange(1328050800000d, 1335823200000d);\n        verify(listener).onFilterUpdate(eq(presenter), any(), argument.capture());\n        dataSetFilter = argument.getValue();\n        columnFilter = (CoreFunctionFilter) dataSetFilter.getColumnFilterList().get(0);\n        assertEquals(columnFilter.getParameters().get(0), new Date(1328050800000L));\n        assertEquals(columnFilter.getParameters().get(1), new Date(1335823200000L));\n    }\n\n    @Test\n    public void testNumberRangeSelection() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(numberSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        DisplayerListener listener = mock(DisplayerListener.class);\n        presenter.draw();\n\n        // Select a range\n        reset(view);\n        presenter.addListener(listener);\n        presenter.onSliderChange(1, 101);\n\n        // Ensure data does not change\n        verify(view, never()).showSlider(anyInt(), anyInt(), anyInt(), anyInt(), anyInt());\n\n        // Verify the item selected is correct\n        ArgumentCaptor<DataSetFilter> argument = ArgumentCaptor.forClass(DataSetFilter.class);\n        verify(listener).onFilterUpdate(eq(presenter), any(), argument.capture());\n        verify(listener, never()).onRedraw(presenter);\n        DataSetFilter dataSetFilter = argument.getValue();\n        CoreFunctionFilter columnFilter = (CoreFunctionFilter) dataSetFilter.getColumnFilterList().get(0);\n        assertEquals(columnFilter.getColumnId(), COLUMN_AMOUNT);\n        assertEquals(columnFilter.getType(), CoreFunctionType.BETWEEN);\n        assertEquals(columnFilter.getParameters().size(), 2);\n        assertEquals(columnFilter.getParameters().get(0), 1d);\n        assertEquals(columnFilter.getParameters().get(1), 101d);\n\n        // Select another range\n        reset(listener);\n        presenter.onSliderChange(51, 101);\n        verify(listener).onFilterUpdate(eq(presenter), any(), argument.capture());\n        dataSetFilter = argument.getValue();\n        columnFilter = (CoreFunctionFilter) dataSetFilter.getColumnFilterList().get(0);\n        assertEquals(columnFilter.getParameters().get(0), 51d);\n        assertEquals(columnFilter.getParameters().get(1), 101d);\n    }\n\n    @Test\n    public void testIgnoreNullDates() {\n        expensesDataSet.setValueAt(0, 4, null);\n        expensesDataSet.setValueAt(49, 4, null);\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        presenter.draw();\n\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        Object min = dataSet.getValueAt(0, 0);\n        Object max = dataSet.getValueAt(0, 1);\n\n        assertEquals(min, expensesDataSet.getValueAt(48, 4));\n        assertEquals(max, expensesDataSet.getValueAt(1, 4));\n    }\n\n    @Test\n    public void testIgnoreNullNumbers() {\n        expensesDataSet.setValueAt(0, 5, null);\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(numberSelectorSettings);\n        presenter.draw();\n\n        DataSet dataSet = presenter.getDataSetHandler().getLastDataSet();\n        Object min = dataSet.getValueAt(0, 0);\n        Object max = dataSet.getValueAt(0, 1);\n\n        assertEquals(min, 1.1d);\n        assertEquals(max, 1100.1d);\n    }\n\n    @Test\n    public void testDateAllNullNoData() {\n        for (int i = 0; i < 50; i++) {\n            expensesDataSet.setValueAt(i, 4, null);\n        }\n\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        presenter.draw();\n        verify(presenter.getView()).noData();\n    }\n\n    @Test\n    public void testNumberAllNullNoData() {\n        for (int i = 0; i < 50; i++) {\n            expensesDataSet.setValueAt(i, 5, null);\n        }\n\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(numberSelectorSettings);\n        presenter.draw();\n        verify(presenter.getView()).noData();\n    }\n\n    @Test\n    public void testOnMinDateEditorChanged() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        presenter.onMinDateInputFocus();\n        verify(view).setSliderEnabled(false);\n\n        reset(view);\n        when(minDateInputEditor.getValue()).thenReturn(new Date());\n        presenter.onMinDateInputChange();\n        verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());\n        verify(view).setSliderEnabled(true);\n    }\n\n    @Test\n    public void testOnMaxDateEditorChanged() {\n        SelectorSliderDisplayer presenter = createSelectorDisplayer(dateSelectorSettings);\n        SelectorSliderDisplayer.View view = presenter.getView();\n        presenter.draw();\n\n        reset(view);\n        presenter.onMaxDateInputFocus();\n        verify(view).setSliderEnabled(false);\n\n        reset(view);\n        when(maxDateInputEditor.getValue()).thenReturn(new Date());\n        presenter.onMaxDateInputChange();\n        verify(view).showSlider(anyDouble(), anyDouble(), anyDouble(), anyDouble(), anyDouble());\n        verify(view).setSliderEnabled(true);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/table/TableDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.client.table;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.formatter.ValueFormatter;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.COUNT;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.MIN;\nimport static org.dashbuilder.dataset.sort.SortOrder.ASCENDING;\nimport static org.dashbuilder.dataset.sort.SortOrder.DESCENDING;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class TableDisplayerTest extends AbstractDisplayerTest {\n\n    public TableDisplayer createTableDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new TableDisplayer(mock(TableDisplayer.View.class), mock(FilterLabelSet.class)), settings);\n    }\n\n    @Mock\n    DisplayerListener displayerListener;\n\n    @Mock\n    Command selectCommand;\n\n    @Mock\n    FilterLabel filterLabel;\n\n    public void resetFilterLabelSet(FilterLabelSet filterLabelSet) {\n        reset(filterLabelSet);\n        doAnswer(invocationOnMock -> filterLabel).when(filterLabelSet).addLabel(anyString());\n    }\n\n    @Test\n    public void testTableDraw() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tableOrderDefault(COLUMN_DEPARTMENT, SortOrder.DESCENDING)\n                .tableOrderEnabled(true)\n                .tablePageSize(10)\n                .tableWidth(1000)\n                .filterOn(true, true, true)\n                .allowCsvExport(true)\n                .allowExcelExport(false)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View tableView = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.draw();\n\n        verify(tableView).setWidth(1000);\n        verify(tableView).setSortEnabled(true);\n        verify(tableView, times(2)).setTotalRows(50, true);\n        verify(tableView).createTable(10, filterLabelSet);\n        verify(tableView).addColumn(ColumnType.NUMBER, COLUMN_ID, COLUMN_ID, 0, false, true);\n        verify(tableView).addColumn(ColumnType.LABEL, COLUMN_CITY, COLUMN_CITY, 1, true, true);\n        verify(tableView).addColumn(ColumnType.LABEL, COLUMN_DEPARTMENT, COLUMN_DEPARTMENT, 2, true, true);\n        verify(tableView).addColumn(ColumnType.LABEL, COLUMN_EMPLOYEE, COLUMN_EMPLOYEE, 3, true, true);\n        verify(tableView).addColumn(ColumnType.DATE, COLUMN_DATE, COLUMN_DATE, 4, false, true);\n        verify(tableView).addColumn(ColumnType.NUMBER, COLUMN_AMOUNT, COLUMN_AMOUNT, 5, false, true);\n        verify(tableView).setExportToCsvEnabled(true);\n        verify(tableView).setExportToXlsEnabled(false);\n        verify(tableView).gotoFirstPage();\n    }\n\n    @Test\n    public void testEmptyTableDraw() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .tablePageSize(10)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View tableView = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.draw();\n\n        verify(tableView).createTable(10, filterLabelSet);\n        verify(tableView, times(2)).setTotalRows(0, true);\n        verify(tableView).setPagerEnabled(false);\n        verify(tableView, never()).setPagerEnabled(true);\n\n        reset(tableView);\n        table.redraw();\n        verify(tableView, never()).setPagerEnabled(true);\n    }\n\n    @Test\n    public void testTableSort() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .buildSettings();\n\n        // Sorted by ID descending by default\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View tableView = table.getView();\n        table.draw();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0, 0), 50d);\n\n        // Sort disabled (no effect)\n        allRows.setTableSortEnabled(false);\n        table = createTableDisplayer(allRows);\n        tableView = table.getView();\n        table.draw();\n        reset(tableView);\n        table.sortBy(COLUMN_ID, SortOrder.DESCENDING);\n        verify(tableView, never()).redrawTable();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0, 0), 50d);\n\n        // Sort enabled\n        allRows.setTableSortEnabled(true);\n        table = createTableDisplayer(allRows);\n        tableView = table.getView();\n        table.draw();\n        reset(tableView);\n        table.sortBy(COLUMN_ID, SortOrder.ASCENDING);\n        verify(tableView).redrawTable();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0, 0), 1d);\n    }\n\n    @Test\n    public void testSelectCellDisabled() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .filterOff(false)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View view = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.addListener(displayerListener);\n        table.addOnCellSelectedCommand(selectCommand);\n        table.draw();\n\n        reset(view);\n        reset(displayerListener);\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        verify(selectCommand, never()).execute();\n        verify(view, never()).gotoFirstPage();\n        verify(filterLabelSet, never()).addLabel(anyString());\n        verify(displayerListener, never()).onRedraw(table);\n        assertNull(table.getSelectedCellColumn());\n        assertNull(table.getSelectedCellRow());\n    }\n\n    @Test\n    public void testSelectCellNoDrillDown() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View view = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.addListener(displayerListener);\n        table.addOnCellSelectedCommand(selectCommand);\n        table.draw();\n\n        reset(view);\n        reset(displayerListener);\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        verify(selectCommand).execute();\n        verify(view, never()).gotoFirstPage();\n        verify(filterLabelSet).addLabel(anyString());\n        verify(displayerListener, never()).onRedraw(table);\n        assertEquals(table.getSelectedCellColumn(), COLUMN_DEPARTMENT);\n        assertEquals(table.getSelectedCellRow(), new Integer(3));\n    }\n\n    @Test\n    public void testSelectCellDrillDown() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .filterOn(true, true, true)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View view = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.addListener(displayerListener);\n        table.addOnCellSelectedCommand(selectCommand);\n        table.draw();\n\n        reset(view);\n        reset(displayerListener);\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        verify(view, atLeastOnce()).gotoFirstPage();\n        verify(view).redrawTable();\n        verify(filterLabelSet, atLeastOnce()).addLabel(anyString());\n        verify(view, times(2)).setTotalRows(11, true);\n        verify(displayerListener).onRedraw(table);\n        verify(selectCommand).execute();\n        assertEquals(table.getSelectedCellColumn(), COLUMN_DEPARTMENT);\n        assertEquals(table.getSelectedCellRow(), new Integer(3));\n    }\n\n    @Test\n    public void testSelectCellReset() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View view = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.addListener(displayerListener);\n        table.addOnCellSelectedCommand(selectCommand);\n        table.draw();\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        reset(view);\n        reset(selectCommand);\n        reset(displayerListener);\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        verify(selectCommand).execute();\n        verify(view, never()).gotoFirstPage();\n        verify(filterLabelSet, never()).addLabel(anyString());\n        verify(displayerListener, never()).onRedraw(table);\n        assertNull(table.getSelectedCellColumn());\n        assertNull(table.getSelectedCellRow());\n    }\n\n    @Test\n    public void testSelectCellCommands() {\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(allRows);\n        TableDisplayer.View view = table.getView();\n        FilterLabelSet filterLabelSet = table.getFilterLabelSet();\n        table.addListener(displayerListener);\n        table.addOnCellSelectedCommand(selectCommand);\n        final Command selectedCommand = mock(Command.class);\n        table.addOnCellSelectedCommand(selectedCommand);\n        table.draw();\n        resetFilterLabelSet(filterLabelSet);\n        table.selectCell(COLUMN_DEPARTMENT, 3);\n\n        verify(selectCommand).execute();\n        verify(selectedCommand).execute();\n    }\n\n    @Test\n    public void testFormatEmpty() {\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .buildSettings());\n\n        table.addFormatter(COLUMN_EMPLOYEE, new ValueFormatter() {\n            public String formatValue(DataSet dataSet, int row, int column) {\n                return \"test\";\n            }\n            public String formatValue(Object value) {\n                return \"test\";\n            }\n        });\n        table.draw();\n        String value = table.formatValue(100, 3);\n        assertEquals(value, \"test\");\n    }\n\n    @Test\n    public void test_DASHBUILDE_20_Fix() {\n        DisplayerSettings groupedTable = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_CITY)\n                .column(COLUMN_CITY, \"City\")\n                .column(COUNT, \"#Expenses\").format(\"Number of expenses\", \"#,##0\")\n                .column(COLUMN_AMOUNT, MIN).format(\"Min\", \"$ #,###\")\n                .column(COLUMN_AMOUNT, MIN).format(\"Min\", \"$ #,###\")\n                .column(COLUMN_AMOUNT, MIN).format(\"Min\", \"$ #,###\")\n                .column(COLUMN_AMOUNT, MIN).format(\"Min\", \"$ #,###\")\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(COLUMN_CITY, DESCENDING)\n                .filterOn(false, true, true)\n                .buildSettings();\n\n        TableDisplayer table = createTableDisplayer(groupedTable);\n        table.addListener(displayerListener);\n        table.draw();\n        table.sortBy(\"#Expenses\", ASCENDING);\n        verify(displayerListener, never()).onError(eq(table), any(ClientRuntimeError.class));\n    }\n\n    @Test\n    public void testIsTotalRowsExactSQL() {\n        final DataSet dataSet = mock(DataSet.class);\n        final DataSetDef dataSetDef = new DataSetDef();\n        dataSetDef.setProvider(DataSetProviderType.SQL);\n        when(dataSet.getDefinition()).thenReturn(dataSetDef);\n\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings().tablePageSize(10).buildSettings());\n\n        assertTrue(table.isTotalRowsExact(dataSet,\n                                          5));\n        assertTrue(table.isTotalRowsExact(dataSet,\n                                          10));\n        assertTrue(table.isTotalRowsExact(dataSet,\n                                          15));\n    }\n\n    @Test\n    public void testIsTotalRowsExactRemote() {\n        final DataSet dataSet = mock(DataSet.class);\n        final DataSetDef dataSetDef = new DataSetDef();\n        dataSetDef.setProvider(() -> \"REMOTE\");\n        when(dataSet.getDefinition()).thenReturn(dataSetDef);\n\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings().tablePageSize(10).buildSettings());\n\n        assertTrue(table.isTotalRowsExact(dataSet,\n                                          5));\n        assertFalse(table.isTotalRowsExact(dataSet,\n                                           10));\n        assertFalse(table.isTotalRowsExact(dataSet,\n                                           15));\n    }\n\n    @Test\n    public void testIsPagerEnabledRemote() {\n        final DataSet dataSet = mock(DataSet.class);\n        final DataSetDef dataSetDef = new DataSetDef();\n        dataSetDef.setProvider(() -> \"REMOTE\");\n        when(dataSet.getDefinition()).thenReturn(dataSetDef);\n\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings().tablePageSize(10).buildSettings());\n\n        assertFalse(table.isPagerEnabled(dataSet,\n                                         5));\n        assertTrue(table.isPagerEnabled(dataSet,\n                                        10));\n        verify(dataSet,\n               never()).getRowCountNonTrimmed();\n    }\n\n    @Test\n    public void testIsPagerEnabledSQL() {\n        final DataSet dataSet = mock(DataSet.class);\n        final DataSetDef dataSetDef = new DataSetDef();\n        dataSetDef.setProvider(DataSetProviderType.SQL);\n        when(dataSet.getDefinition()).thenReturn(dataSetDef);\n        when(dataSet.getRowCountNonTrimmed()).thenReturn(5,\n                                                         10,\n                                                         15);\n\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings().tablePageSize(10).buildSettings());\n\n        assertFalse(table.isPagerEnabled(dataSet,\n                                         5));\n        assertFalse(table.isPagerEnabled(dataSet,\n                                         10));\n        assertTrue(table.isPagerEnabled(dataSet,\n                                        15));\n    }\n\n    @Test\n    public void testIsRemoteProvider() {\n        final DataSet dataSet = mock(DataSet.class);\n        final DataSetDef dataSetDefSQL = new DataSetDef();\n        dataSetDefSQL.setProvider(DataSetProviderType.SQL);\n        final DataSetDef dataSetDefRemote = new DataSetDef();\n        dataSetDefRemote.setProvider(() -> \"REMOTE\");\n        when(dataSet.getDefinition()).thenReturn(new DataSetDef(),\n                                                 dataSetDefSQL,\n                                                 dataSetDefRemote);\n\n        TableDisplayer table = createTableDisplayer(null);\n\n        //No provider set\n        assertFalse(table.isRemoteProvider(dataSet));\n        //Provider SQL\n        assertFalse(table.isRemoteProvider(dataSet));\n        //Provider REMOTE\n        assertTrue(table.isRemoteProvider(dataSet));\n    }\n\n    @Test\n    public void testPageSize() {\n        TableDisplayer table = createTableDisplayer(DisplayerSettingsFactory.newTableSettings().tablePageSize(10).buildSettings());\n\n        assertEquals(10,\n                     table.getPageSize());\n\n        when(table.getView().getPageSize()).thenReturn(20);\n\n        assertEquals(20,\n                     table.getPageSize());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-default/src/test/java/org/dashbuilder/renderer/client/table/TableDisplayerViewTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.client.table;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\nimport org.uberfire.ext.widgets.table.client.DataGrid;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(DataGrid.class)\npublic class TableDisplayerViewTest {\n\n    @Mock\n    PagedTable<Integer> table;\n\n    @InjectMocks\n    TableDisplayerView tableDisplayerView;\n\n    @Test\n    public void testCreateTable() {\n        final HasWidgets hasWidgets = mock(HasWidgets.class);\n        when(table.getRightToolbar()).thenReturn(hasWidgets);\n\n        tableDisplayerView.setupToolbar();\n\n        verify(hasWidgets,\n               times(2)).add(any());\n    }\n\n    @Test\n    public void testCreateTableUsingHorizontalPanel() {\n        final HorizontalPanel panel = mock(HorizontalPanel.class);\n        when(table.getRightToolbar()).thenReturn(panel);\n\n        tableDisplayerView.setupToolbar();\n\n        verify(panel).insert(any(),\n                             eq(0));\n        verify(panel).insert(any(),\n                             eq(1));\n    }\n\n    @Test\n    public void testCurrentPageForNextPageWithoutTotalCount(){\n        final HasData display = mock(HasData.class);\n        when(table.getRowCount()).thenReturn(1);\n        when(display.getVisibleRange()).thenReturn(new Range(10, 10));\n        assertEquals(1, tableDisplayerView.tableProvider.getCurrentPageRows(display).size());\n    }\n\n    @Test\n    public void testCurrentPageForNextPageWithTotalCount(){\n        final HasData display = mock(HasData.class);\n        when(table.getRowCount()).thenReturn(11);\n        when(display.getVisibleRange()).thenReturn(new Range(10, 10));\n        assertEquals(1, tableDisplayerView.tableProvider.getCurrentPageRows(display).size());\n    }\n\n    @Test\n    public void testCurrentPageForNextPageWithoutRows(){\n        final HasData display = mock(HasData.class);\n        when(table.getRowCount()).thenReturn(0);\n        when(display.getVisibleRange()).thenReturn(new Range(10, 10));\n        assertEquals(0, tableDisplayerView.tableProvider.getCurrentPageRows(display).size());\n    }\n\n    @Test\n    public void testCurrentPage(){\n        final HasData display = mock(HasData.class);\n        when(table.getRowCount()).thenReturn(5);\n        when(display.getVisibleRange()).thenReturn(new Range(0, 10));\n        assertEquals(5, tableDisplayerView.tableProvider.getCurrentPageRows(display).size());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/README.md",
    "content": "Google Charts Renderer for Dashbuilder\n--\nThis project is a Dashbuilder renderer implementation. It is not provided by default in Dashbuilder, Business Central, jBPM WB or Drools WB distribution. The default implementation is `dashbuilder-renderer-c3`. Users that want to use Google Renderer again must build the target web application from sources after including google renderer JAR. For example, if you want the Google Charts back in Business Central you must:\n\n1) Go to `kie-wb-distributions/business-central-parent/business-central-webapp` and modify `pom.xml` to add google charts back:\n\n~~~\n...\n<dependencies>\n...\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-google</artifactId>\n      <scope>provided</scope>\n    </dependency>\n...\n</dependencies>\n...\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>gwt-maven-plugin</artifactId>\n        <configuration>\n          <compileSourcesArtifacts>\n            ...\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-google</compileSourcesArtifact>\n            ...\n          <//compileSourcesArtifacts>\n        </configuration>\n      </plugin>        \n...\n~~~\n\n2) Also add the GCharts module (`org.dashbuilder.renderer.GChartsRenderer`) to `kie-wb-distributions/business-central-parent/business-central-webapp/src/main/resources/org/kie/bc/KIEWebapp.gwt.xml`:\n\n\n\n~~~\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  ...\n  <inherits name=\"org.dashbuilder.renderer.GChartsRenderer\"/>\n  ...\n</module>\n~~~\n\n3) On `business-central-webapp` run `mvn clean install`. It will build the business-central-webapp WAR. After the build finishes you can build a distribution WAR by building some of the projects in `kie-wb-distributions/business-central-parent/business-central-distribution-wars`\n\n4) Finally make sure to select Google Charts using the system property `org.dashbuilder.renderer.default=gwtcharts` when starting the server were Business Central is installed. If you don't do this C3 will still be used.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-renderers</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-renderer-google</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Renderer Google</name>\n  <description>Dashbuilder Renderer for the Google Visualization API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.googlecode.gwt-charts</groupId>\n      <artifactId>gwt-charts</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleAreaChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSubType;\n\n@Dependent\npublic class GoogleAreaChartDisplayer extends GoogleCategoriesDisplayer<GoogleAreaChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleAreaChartDisplayer> {\n\n        void setIsStacked(boolean isStacked);\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleAreaChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxGroups(1)\n                .setMinColumns(2)\n                .setMaxColumns(10)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP )\n                .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n\n    public boolean isStacked() {\n        return DisplayerSubType.AREA_STACKED.equals(displayerSettings.getSubtype());\n    }\n\n    @Override\n    protected void createVisualization() {\n        view.setIsStacked(isStacked());\n\n        super.createVisualization();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleAreaChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.corechart.AreaChart;\nimport com.googlecode.gwt.charts.client.corechart.AreaChartOptions;\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.options.Animation;\nimport com.googlecode.gwt.charts.client.options.AnimationEasing;\n\npublic class GoogleAreaChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleAreaChartDisplayer>\n        implements GoogleAreaChartDisplayer.View {\n\n    protected boolean isStacked = true;\n\n    @Override\n    public void setIsStacked(boolean isStacked) {\n        this.isStacked = isStacked;\n    }\n\n    @Override\n    protected CoreChartWidget _createChart() {\n        return new AreaChart();\n    }\n\n    @Override\n    protected AreaChartOptions createOptions() {\n        AreaChartOptions options = AreaChartOptions.create();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setLegend(createChartLegend());\n        options.setChartArea(createChartArea());\n        options.setColors(colors);\n        options.setIsStacked(isStacked);\n        options.setHAxis(createHAxis());\n        options.setVAxis(createVAxis());\n\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleBarChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.DisplayerSubType;\n\n@Dependent\npublic class GoogleBarChartDisplayer extends GoogleCategoriesDisplayer<GoogleBarChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleBarChartDisplayer> {\n\n        void setIsBar(boolean isBar);\n\n        void setIsStacked(boolean isStacked);\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleBarChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(10)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType( ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n\n    public boolean isBarChart() {\n        return displayerSettings.getSubtype() == null ||\n                DisplayerSubType.BAR.equals(displayerSettings.getSubtype()) ||\n                DisplayerSubType.BAR_STACKED.equals(displayerSettings.getSubtype());\n    }\n\n    public boolean isStacked() {\n        return displayerSettings.getSubtype() != null &&\n                (DisplayerSubType.BAR_STACKED.equals(displayerSettings.getSubtype()) ||\n                DisplayerSubType.COLUMN_STACKED.equals(displayerSettings.getSubtype()));\n    }\n\n    @Override\n    protected void createVisualization() {\n        view.setIsBar(isBarChart());\n        view.setIsStacked(isStacked());\n\n        super.createVisualization();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleBarChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.corechart.BarChart;\nimport com.googlecode.gwt.charts.client.corechart.BarChartOptions;\nimport com.googlecode.gwt.charts.client.corechart.ColumnChart;\nimport com.googlecode.gwt.charts.client.corechart.ColumnChartOptions;\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.options.Animation;\nimport com.googlecode.gwt.charts.client.options.AnimationEasing;\nimport com.googlecode.gwt.charts.client.options.CoreOptions;\nimport com.googlecode.gwt.charts.client.options.Options;\n\npublic class GoogleBarChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleBarChartDisplayer>\n        implements GoogleBarChartDisplayer.View {\n\n    protected boolean isBar = true;\n    protected boolean isStacked = true;\n\n    @Override\n    public void setIsBar(boolean isBar) {\n        this.isBar = isBar;\n    }\n\n    @Override\n    public void setIsStacked(boolean isStacked) {\n        this.isStacked = isStacked;\n    }\n\n    @Override\n    protected CoreChartWidget _createChart() {\n        return isBar ? new BarChart() : new ColumnChart();\n    }\n\n    @Override\n    protected Options createOptions() {\n        return isBar ? createBarOptions() : createColumnOptions();\n    }\n\n    protected CoreOptions createBarOptions() {\n        BarChartOptions options = BarChartOptions.create();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setLegend(createChartLegend());\n        options.setIsStacked(isStacked);\n        options.setHAxis(createHAxis());\n        options.setVAxis(createVAxis());\n\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        // TODO: options.set3D(displayerSettings.is3d());\n        options.setChartArea(createChartArea());\n        options.setColors(colors);\n        return options;\n    }\n\n    protected CoreOptions createColumnOptions() {\n        ColumnChartOptions options = ColumnChartOptions.create();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setLegend(createChartLegend());\n        options.setIsStacked(isStacked);\n        options.setChartArea(createChartArea());\n        options.setColors(colors);\n\n        if (showXLabels) {\n            options.setHAxis(createHAxis());\n        }\n        if (showYLabels) {\n            options.setVAxis(createVAxis());\n        }\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleBubbleChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class GoogleBubbleChartDisplayer extends GoogleCategoriesDisplayer<GoogleBubbleChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleBubbleChartDisplayer> {\n\n        String getXAxisColumnTitle();\n\n        String getYAxisColumnTitle();\n\n        String getBubbleColorColumnTitle();\n\n        String getBubbleSizeColumnTitle();\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleBubbleChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(5)\n                .setMinColumns(5)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTitle(1, view.getXAxisColumnTitle())\n                .setColumnTitle(2, view.getYAxisColumnTitle())\n                .setColumnTitle(3, view.getBubbleColorColumnTitle())\n                .setColumnTitle(4, view.getBubbleSizeColumnTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER,\n                        ColumnType.NUMBER,\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleBubbleChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.corechart.BubbleChart;\nimport com.googlecode.gwt.charts.client.corechart.BubbleChartOptions;\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.options.Animation;\nimport com.googlecode.gwt.charts.client.options.AnimationEasing;\nimport com.googlecode.gwt.charts.client.options.Options;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\n\npublic class GoogleBubbleChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleBubbleChartDisplayer>\n        implements GoogleBubbleChartDisplayer.View {\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Values();\n    }\n\n    @Override\n    public String getXAxisColumnTitle() {\n        return GoogleDisplayerConstants.INSTANCE.googleBubbleDisplayer_XAxis();\n    }\n\n    @Override\n    public String getYAxisColumnTitle() {\n        return GoogleDisplayerConstants.INSTANCE.googleBubbleDisplayer_YAxis();\n    }\n\n    @Override\n    public String getBubbleColorColumnTitle() {\n        return GoogleDisplayerConstants.INSTANCE.googleBubbleDisplayer_BubbleColor();\n    }\n\n    @Override\n    public String getBubbleSizeColumnTitle() {\n        return GoogleDisplayerConstants.INSTANCE.googleBubbleDisplayer_BubbleSize();\n    }\n\n    @Override\n    protected CoreChartWidget _createChart() {\n        return new BubbleChart();\n    }\n\n    @Override\n    protected Options createOptions() {\n        BubbleChartOptions options = BubbleChartOptions.create();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setChartArea(createChartArea());\n        options.setLegend(createChartLegend());\n        options.setColors(colors);\n        options.setHAxis(createHAxis());\n        options.setVAxis(createVAxis());\n\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleCategoriesDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport java.util.List;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\n\npublic abstract class GoogleCategoriesDisplayer<V extends GoogleCategoriesDisplayer.View> extends GoogleChartDisplayer<V> {\n\n    public interface View<P extends GoogleCategoriesDisplayer> extends GoogleChartDisplayer.View<P> {\n\n        void setFilterEnabled(boolean filterEnabled);\n\n        void setBgColor(String bgColor);\n\n        void setShowXLabels(boolean showXLabels);\n\n        void setShowYLabels(boolean showYLabels);\n\n        void setXAxisTitle(String xAxisTitle);\n\n        void setXAxisAngle(int xAxisAngle);\n\n        void setYAxisTitle(String yAxisTitle);\n\n        void setColors(String[] colors);\n\n        void setAnimationOn(boolean animationOn);\n\n        void setAnimationDuration(int animationDuration);\n\n        void createChart();\n\n        void nodata();\n\n        void drawChart();\n    }\n\n    public static final String[] COLOR_ARRAY = new String[] {\n            \"#0088CE\", \"#CC0000\", \"#EC7A08\", \"#3F9C35\", \"#F0AB00\", \"#703FEC\", \"#007A87\", \"#92D400\", \"#35CAED\",\n            \"#00659C\", \"#A30000\", \"#B35C00\", \"#B58100\", \"#6CA100\", \"#2D7623\", \"#005C66\", \"#008BAD\", \"#40199A\"};\n\n    public static final String COLOR_NOT_SELECTED = \"#8B8D8F\";\n\n    public GoogleCategoriesDisplayer(FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n    }\n\n    protected String[] createColorArray() {\n        String[] colorArray = new String[dataSet.getRowCount()];\n        for (int i = 0, j = 0; i < dataSet.getRowCount(); i++, j++) {\n            if (j >= COLOR_ARRAY.length) j = 0;\n            colorArray[i] = COLOR_ARRAY[j];\n\n            List<Integer> selectedIdxs = filterIndexes(dataSet.getColumnByIndex(0).getId());\n            if (!displayerSettings.isFilterSelfApplyEnabled()\n                    && selectedIdxs != null\n                    && !selectedIdxs.isEmpty() && !selectedIdxs.contains(i)) {\n\n                colorArray[i] = COLOR_NOT_SELECTED;\n            }\n        }\n        return colorArray;\n    }\n\n    @Override\n    protected void createVisualization() {\n        super.createVisualization();\n\n        getView().createChart();\n        getView().setAnimationOn(true);\n        getView().setAnimationDuration(700);\n        getView().setFilterEnabled(displayerSettings.isFilterEnabled());\n        getView().setBgColor(displayerSettings.getChartBackgroundColor());\n        getView().setShowXLabels(displayerSettings.isXAxisShowLabels());\n        getView().setShowYLabels(displayerSettings.isYAxisShowLabels());\n        getView().setXAxisTitle(displayerSettings.getXAxisTitle());\n        getView().setXAxisAngle(displayerSettings.getXAxisLabelsAngle());\n        getView().setYAxisTitle(displayerSettings.getYAxisTitle());\n        drawChart();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        super.updateFilterStatus();\n        drawChart();\n    }\n\n    protected void drawChart() {\n        if (dataSet.getRowCount() == 0) {\n            getView().nodata();\n        } else {\n            super.pushDataToView();\n            getView().setColors(createColorArray());\n            getView().drawChart();\n        }\n    }\n\n    // View notifications\n\n    public void onCategorySelected(String columnId, int row) {\n        Integer maxSelections = displayerSettings.isFilterSelfApplyEnabled() ? null : dataSet.getRowCount();\n        filterUpdate(columnId, row, maxSelections);\n\n        // Update the displayer in order to reflect the current selection\n        // (only if not has already been redrawn as part of the drill-down processing in the above filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleCategoriesDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.googlecode.gwt.charts.client.Selection;\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.event.SelectEvent;\nimport com.googlecode.gwt.charts.client.event.SelectHandler;\nimport com.googlecode.gwt.charts.client.geochart.GeoChart;\nimport com.googlecode.gwt.charts.client.options.ChartArea;\nimport com.googlecode.gwt.charts.client.options.HAxis;\nimport com.googlecode.gwt.charts.client.options.Options;\nimport com.googlecode.gwt.charts.client.options.VAxis;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\nimport org.gwtbootstrap3.client.ui.Label;\n\npublic abstract class GoogleCategoriesDisplayerView<P extends GoogleCategoriesDisplayer>\n        extends GoogleChartDisplayerView<P>\n        implements GoogleCategoriesDisplayer.View<P> {\n\n    private CoreChartWidget chart = null;\n    protected String bgColor = null;\n    protected boolean showXLabels = false;\n    protected boolean showYLabels = false;\n    protected String xAxisTitle = null;\n    protected String yAxisTitle = null;\n    protected int xAxisAngle = 0;\n    protected boolean animationOn = false;\n    protected int animationDuration = 700;\n    protected String[] colors = null;\n\n    @Override\n    public void setBgColor(String bgColor) {\n        this.bgColor = bgColor;\n    }\n\n    @Override\n    public void setShowXLabels(boolean showXLabels) {\n        this.showXLabels = showXLabels;\n    }\n\n    @Override\n    public void setShowYLabels(boolean showYLabels) {\n        this.showYLabels = showYLabels;\n    }\n\n    @Override\n    public void setXAxisTitle(String xAxisTitle) {\n        this.xAxisTitle = xAxisTitle;\n    }\n\n    @Override\n    public void setXAxisAngle(int xAxisAngle) {\n        this.xAxisAngle = xAxisAngle;\n    }\n\n    @Override\n    public void setYAxisTitle(String yAxisTitle) {\n        this.yAxisTitle = yAxisTitle;\n    }\n\n    @Override\n    public void setColors(String[] colors) {\n        this.colors = colors;\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        if (enabled) {\n            checkChartCreated();\n            chart.addSelectHandler(createSelectHandler(chart));\n        }\n    }\n\n    @Override\n    public void setAnimationOn(boolean animationOn) {\n        this.animationOn = animationOn;\n    }\n\n    @Override\n    public void setAnimationDuration(int animationDuration) {\n        this.animationDuration = animationDuration;\n    }\n\n    @Override\n    public void createChart() {\n        chart = _createChart();\n    }\n\n    @Override\n    public void drawChart() {\n        checkChartCreated();\n        chart.draw(getDataTable(), createOptions());\n        super.showDisplayer(chart);\n    }\n\n    @Override\n    public void nodata() {\n        FlowPanel noDataPanel = new FlowPanel();\n        noDataPanel.setWidth(width + \"px\");\n        noDataPanel.setHeight(height + \"px\");\n        noDataPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.common_noData()));\n\n        super.showDisplayer(noDataPanel);\n    }\n\n    // Common methods used in subclasses\n\n    protected void checkChartCreated() {\n        if (chart == null) {\n            throw new RuntimeException(\"Chart not created. Call to view.createChart() first\");\n        }\n    }\n\n    protected CoreChartWidget _createChart() {\n        return null;\n    }\n\n    protected Options createOptions() {\n        return null;\n    }\n\n    protected SelectHandler createSelectHandler(final CoreChartWidget selectable) {\n        return new SelectHandler() {\n            public void onSelect(SelectEvent event) {\n                JsArray<Selection> selections = selectable.getSelection();\n                for (int i = 0; i < selections.length(); i++) {\n                    Selection selection = selections.get(i);\n                    int row = selection.getRow();\n                    getPresenter().onCategorySelected(getDataTable().getColumnId(0), row);\n                }\n            }\n        };\n    }\n\n    protected SelectHandler createSelectHandler(final GeoChart selectable) {\n        return new SelectHandler() {\n            public void onSelect(SelectEvent event) {\n                JsArray<Selection> selections = selectable.getSelection();\n                for (int i = 0; i < selections.length(); i++) {\n                    Selection selection = selections.get(i);\n                    int row = selection.getRow();\n                    getPresenter().onCategorySelected(getDataTable().getColumnId(0), row);\n                }\n            }\n        };\n    }\n\n    protected ChartArea createChartArea() {\n        int chartWidth = width - marginRight - marginLeft;\n        int chartHeight = height - marginTop - marginBottom;\n\n        ChartArea chartArea = ChartArea.create();\n        chartArea.setLeft(marginLeft);\n        chartArea.setTop(marginTop);\n        chartArea.setWidth(chartWidth);\n        chartArea.setHeight(chartHeight);\n        return chartArea;\n    }\n\n    protected HAxis createHAxis() {\n        HAxis xAxis = xAxisTitle == null ? HAxis.create() : HAxis.create(xAxisTitle);\n        xAxis.setSlantedTextAngle(xAxisAngle);\n        return xAxis;\n    }\n\n    protected VAxis createVAxis() {\n        return yAxisTitle == null ? null : VAxis.create(yAxisTitle);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.Position;\n\n/**\n * Base class for all the Google chart displayers\n */\npublic abstract class GoogleChartDisplayer<V extends GoogleChartDisplayer.View> extends GoogleDisplayer<V> {\n\n    public interface View<P extends GoogleChartDisplayer> extends GoogleDisplayer.View<P> {\n\n        void setWidth(int width);\n\n        void setHeight(int height);\n\n        void setMarginTop(int marginTop);\n\n        void setMarginBottom(int marginBottom);\n\n        void setMarginRight(int marginRight);\n\n        void setMarginLeft(int marginLeft);\n\n        void setLegendPosition(Position position);\n\n        void setSubType(DisplayerSubType subType);\n    }\n\n    public GoogleChartDisplayer(FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n    }\n\n    @Override\n    protected void createVisualization() {\n        super.createVisualization();\n\n        getView().setWidth(displayerSettings.getChartWidth());\n        getView().setHeight(displayerSettings.getChartHeight());\n        getView().setMarginTop(displayerSettings.getChartMarginTop());\n        getView().setMarginBottom(displayerSettings.getChartMarginBottom());\n        getView().setMarginRight(displayerSettings.getChartMarginRight());\n        getView().setMarginLeft(displayerSettings.getChartMarginLeft());\n        getView().setLegendPosition(displayerSettings.isChartShowLegend() ? displayerSettings.getChartLegendPosition() : null);\n        getView().setSubType(displayerSettings.getSubtype());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.options.Legend;\nimport com.googlecode.gwt.charts.client.options.LegendAlignment;\nimport com.googlecode.gwt.charts.client.options.LegendPosition;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.Position;\n\n/**\n * Base class for all the Google chart like displayers\n */\npublic abstract class GoogleChartDisplayerView<P extends GoogleChartDisplayer>\n        extends GoogleDisplayerView<P>\n        implements GoogleChartDisplayer.View<P> {\n\n    protected int width = 500;\n    protected int height= 300;\n    protected int marginTop = 10;\n    protected int marginBottom = 10;\n    protected int marginRight = 10;\n    protected int marginLeft = 10;\n    protected Position legendPosition = null;\n    protected DisplayerSubType subType = null;\n\n    @Override\n    public void setWidth(int width) {\n        this.width = width;\n    }\n\n    @Override\n    public void setHeight(int height) {\n        this.height = height;\n    }\n\n    @Override\n    public void setMarginTop(int marginTop) {\n        this.marginTop = marginTop;\n    }\n\n    @Override\n    public void setMarginBottom(int marginBottom) {\n        this.marginBottom = marginBottom;\n    }\n\n    @Override\n    public void setMarginRight(int marginRight) {\n        this.marginRight = marginRight;\n    }\n\n    @Override\n    public void setMarginLeft(int marginLeft) {\n        this.marginLeft = marginLeft;\n    }\n\n    @Override\n    public void setLegendPosition(Position legendPosition) {\n        this.legendPosition = legendPosition;\n    }\n\n    @Override\n    public void setSubType(DisplayerSubType subType) {\n        this.subType = subType;\n    }\n\n    protected Legend createChartLegend() {\n        GoogleLegendWrapper legend = GoogleLegendWrapper.create();\n        legend.setLegendPosition(getLegendPosition());\n        legend.setAligment(LegendAlignment.CENTER);\n        return legend;\n    }\n\n    protected String getLegendPosition() {\n        if (legendPosition != null) {\n            switch (legendPosition) {\n                case TOP:\n                    return LegendPosition.TOP.toString().toLowerCase();\n                case BOTTOM:\n                    return LegendPosition.BOTTOM.toString().toLowerCase();\n                case RIGHT:\n                    return LegendPosition.RIGHT.toString().toLowerCase();\n                case IN:\n                    return LegendPosition.IN.toString().toLowerCase();\n                case LEFT:\n                    return \"left\";\n                default:\n                    return LegendPosition.RIGHT.toString().toLowerCase();\n            }\n        }\n        return LegendPosition.NONE.toString().toLowerCase();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.group.Interval;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayer;\n\npublic abstract class GoogleDisplayer<V extends GoogleDisplayer.View> extends AbstractGwtDisplayer<V> {\n\n    public interface View<P extends GoogleDisplayer> extends AbstractGwtDisplayer.View<P> {\n\n        void draw();\n\n        void dataClear();\n\n        void dataRowCount(int rowCount);\n\n        void dataAddColumn(ColumnType type, String id, String name);\n\n        void dataSetValue(int row, int column, Date value);\n\n        void dataSetValue(int row, int column, double value);\n\n        void dataSetValue(int row, int column, String value);\n\n        void dataFormatDateColumn(String pattern, int column);\n\n        void dataFormatNumberColumn(String pattern, int column);\n\n        String getGroupsTitle();\n\n        String getColumnsTitle();\n\n        void showTitle(String title);\n\n        void setFilterLabelSet(FilterLabelSet widget);\n    }\n\n    private FilterLabelSet filterLabelSet;\n\n    public GoogleDisplayer(FilterLabelSet filterLabelSet) {\n        this.filterLabelSet = filterLabelSet;\n        this.filterLabelSet.setOnClearAllCommand(this::onFilterClearAll);\n    }\n\n    public FilterLabelSet getFilterLabelSet() {\n        return filterLabelSet;\n    }\n\n    /**\n     * GCharts drawing is done asynchronously via the GoogleRenderer (see ready() method below)\n     */\n    @Override\n    public void draw() {\n        getView().draw();\n    }\n\n    /**\n     * Invoked asynchronously by the GoogleRenderer when the displayer is ready for display\n     */\n    public void ready() {\n        super.draw();\n    }\n\n    @Override\n    protected void createVisualization() {\n        getView().setFilterLabelSet(filterLabelSet);\n        if (displayerSettings.isTitleVisible()) {\n            getView().showTitle(displayerSettings.getTitle());\n        }\n    }\n\n    protected void updateFilterStatus() {\n        filterLabelSet.clear();\n        Set<String> columnFilters = filterColumns();\n        if (displayerSettings.isFilterEnabled() && !columnFilters.isEmpty()) {\n\n            for (String columnId : columnFilters) {\n                List<Interval> selectedValues = filterIntervals(columnId);\n                DataColumn column = dataSet.getColumnById(columnId);\n                for (Interval interval : selectedValues) {\n                    String formattedValue = formatInterval(interval, column);\n                    FilterLabel filterLabel = filterLabelSet.addLabel(formattedValue);\n                    filterLabel.setOnRemoveCommand(() -> onFilterLabelRemoved(columnId, interval.getIndex()));\n                }\n            }\n        }\n    }\n\n    // Data generation\n\n    public void pushDataToView() {\n\n        getView().dataClear();\n        getView().dataRowCount(dataSet.getRowCount());\n\n        List<DataColumn> columns = dataSet.getColumns();\n        for (int i = 0; i < columns.size(); i++) {\n            DataColumn dataColumn = columns.get(i);\n            String columnId = dataColumn.getId();\n            ColumnType columnType = dataColumn.getColumnType();\n            ColumnSettings columnSettings = displayerSettings.getColumnSettings(dataColumn);\n\n            getView().dataAddColumn(dataColumn.getColumnType(), columnId, columnSettings.getColumnName());\n\n            List columnValues = dataColumn.getValues();\n            for (int j = 0; j < columnValues.size(); j++) {\n                Object value = columnValues.get(j);\n\n                if (ColumnType.DATE.equals(columnType)) {\n                    getView().dataSetValue(j, i, value == null ? new Date() : (Date) value);\n                }\n                else if (ColumnType.NUMBER.equals(columnType)) {\n                    if (value == null) {\n                        getView().dataSetValue(j, i, 0d);\n                    } else {\n                        String valueStr = getEvaluator().evalExpression(value.toString(), columnSettings.getValueExpression());\n                        getView().dataSetValue(j, i, Double.parseDouble(valueStr));\n                    }\n                }\n                else {\n                    String valueStr = super.formatValue(j, i);\n                    getView().dataSetValue(j, i, valueStr);\n                }\n            }\n        }\n\n        // Format the table values\n        for (int i = 0; i < dataSet.getColumns().size(); i++) {\n            DataColumn dataColumn = columns.get(i);\n            ColumnSettings columnSettings = displayerSettings.getColumnSettings(dataColumn);\n            String pattern = columnSettings.getValuePattern();\n\n            if (ColumnType.DATE.equals(dataColumn.getColumnType())) {\n                getView().dataFormatDateColumn(pattern, i);\n            }\n            else if (ColumnType.NUMBER.equals(dataColumn.getColumnType())) {\n                getView().dataFormatNumberColumn(pattern, i);\n            }\n        }\n    }\n\n    // Filter label set component notifications\n\n    void onFilterLabelRemoved(String columnId, int row) {\n        super.filterUpdate(columnId, row);\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n\n    void onFilterClearAll() {\n        super.filterReset();\n\n        // Update the displayer view in order to reflect the current selection\n        // (only if not has already been redrawn in the previous filterUpdate() call)\n        if (!displayerSettings.isFilterSelfApplyEnabled()) {\n            updateVisualization();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.googlecode.gwt.charts.client.DataTable;\nimport com.googlecode.gwt.charts.client.format.DateFormat;\nimport com.googlecode.gwt.charts.client.format.DateFormatOptions;\nimport com.googlecode.gwt.charts.client.format.NumberFormat;\nimport com.googlecode.gwt.charts.client.format.NumberFormatOptions;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.displayer.client.AbstractGwtDisplayerView;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\n\npublic abstract class GoogleDisplayerView<P extends GoogleDisplayer>\n        extends AbstractGwtDisplayerView<P>\n        implements GoogleDisplayer.View<P> {\n\n    private Panel container = new FlowPanel();\n    private Panel filterPanel = new FlowPanel();\n    private Panel displayerPanel = new FlowPanel();\n    private HTML titleHtml = new HTML();\n    private DataTable dataTable ;\n    private GoogleRenderer googleRenderer;\n\n    public void setRenderer(GoogleRenderer googleRenderer) {\n        this.googleRenderer = googleRenderer;\n    }\n\n    public DataTable getDataTable() {\n        return dataTable;\n    }\n\n    public void showDisplayer(Widget w) {\n        displayerPanel.clear();\n        displayerPanel.add(w);\n    }\n\n    @Override\n    public void init(P presenter) {\n        super.setPresenter(presenter);\n        super.setVisualization(container);\n\n        container.add(titleHtml);\n        container.add(filterPanel);\n        container.add(displayerPanel);\n\n        filterPanel.getElement().setAttribute(\"cellpadding\", \"2\");\n    }\n\n    /**\n     * GCharts drawing is performed asynchronously\n     */\n    @Override\n    public void draw() {\n        if (googleRenderer == null)  {\n            getPresenter().showError(new ClientRuntimeError(\"Google renderer not set\"));\n        }\n        else if (!getPresenter().isDrawn())  {\n            List<Displayer> displayerList = new ArrayList<Displayer>();\n            displayerList.add(getPresenter());\n            googleRenderer.draw(displayerList);\n        }\n    }\n\n    @Override\n    public void dataClear() {\n        dataTable = DataTable.create();\n    }\n\n    @Override\n    public void dataRowCount(int rowCount) {\n        dataTable.addRows(rowCount);\n    }\n\n    @Override\n    public void dataAddColumn(ColumnType type, String id, String name) {\n        dataTable.addColumn(getColumnType(type), name, id);\n    }\n\n    @Override\n    public void dataSetValue(int row, int column, Date value) {\n        dataTable.setValue(row, column, value);\n    }\n\n    @Override\n    public void dataSetValue(int row, int column, double value) {\n        dataTable.setValue(row, column, value);\n    }\n\n    @Override\n    public void dataSetValue(int row, int column, String value) {\n        dataTable.setValue(row, column, value);\n    }\n\n    @Override\n    public void dataFormatDateColumn(String pattern, int column) {\n        DateFormatOptions dateFormatOptions = DateFormatOptions.create();\n        dateFormatOptions.setPattern(pattern);\n        DateFormat dateFormat = DateFormat.create(dateFormatOptions);\n        dateFormat.format(dataTable, column);\n    }\n\n    @Override\n    public void dataFormatNumberColumn(String pattern, int column) {\n        NumberFormatOptions numberFormatOptions = NumberFormatOptions.create();\n        numberFormatOptions.setPattern(pattern);\n        NumberFormat numberFormat = NumberFormat.create(numberFormatOptions);\n        numberFormat.format(dataTable, column);\n    }\n\n    @Override\n    public String getGroupsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Categories();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Series();\n    }\n\n    @Override\n    public void showTitle(String title) {\n        titleHtml.setText(title);\n    }\n\n    @Override\n    public void setFilterLabelSet(FilterLabelSet widget) {\n        HTMLElement element = widget.getElement();\n        element.getStyle().setProperty(\"position\", \"absolute\");\n        element.getStyle().setProperty(\"z-index\", \"10\");\n        filterPanel.clear();\n        filterPanel.add(ElementWrapperWidget.getWidget(element));\n    }\n\n    public com.googlecode.gwt.charts.client.ColumnType getColumnType(ColumnType type) {\n        if (ColumnType.LABEL.equals(type)) {\n            return com.googlecode.gwt.charts.client.ColumnType.STRING;\n        }\n        if (ColumnType.TEXT.equals(type)) {\n            return com.googlecode.gwt.charts.client.ColumnType.STRING;\n        }\n        if (ColumnType.NUMBER.equals(type)) {\n            return com.googlecode.gwt.charts.client.ColumnType.NUMBER;\n        }\n        if (ColumnType.DATE.equals(type)) {\n            return com.googlecode.gwt.charts.client.ColumnType.DATE;\n        }\n        return com.googlecode.gwt.charts.client.ColumnType.STRING;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleLegendWrapper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.options.Legend;\n\n/**\n * Extension of the google Legend in order to allow for positioning the legend to the left of the chart, which is not\n * possible with the original class, because the LegendPosition enum does not include the 'left' value.\n */\npublic class GoogleLegendWrapper extends Legend {\n\n    public static GoogleLegendWrapper create() {\n        return createObject().cast();\n    }\n\n    protected GoogleLegendWrapper() {\n    }\n\n    public final void setLegendPosition(String alignment) {\n        setPosition(alignment);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleLineChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class GoogleLineChartDisplayer extends GoogleCategoriesDisplayer<GoogleLineChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleLineChartDisplayer> {\n\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleLineChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxGroups(1)\n                .setMinColumns(2)\n                .setMaxColumns(10)\n                .setExtraColumnsAllowed(true)\n                .setExtraColumnsType(ColumnType.NUMBER)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_BGCOLOR)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.AXIS_GROUP);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleLineChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.corechart.LineChart;\nimport com.googlecode.gwt.charts.client.corechart.LineChartOptions;\nimport com.googlecode.gwt.charts.client.options.Animation;\nimport com.googlecode.gwt.charts.client.options.AnimationEasing;\nimport com.googlecode.gwt.charts.client.options.CurveType;\nimport com.googlecode.gwt.charts.client.options.Options;\nimport org.dashbuilder.displayer.DisplayerSubType;\n\npublic class GoogleLineChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleLineChartDisplayer>\n        implements GoogleLineChartDisplayer.View {\n\n    @Override\n    protected  CoreChartWidget _createChart() {\n        return new LineChart();\n    }\n\n    @Override\n    protected Options createOptions() {\n        boolean isLine = DisplayerSubType.LINE.equals(subType);\n\n        LineChartOptions options = LineChartOptions.create();\n        options.setCurveType(isLine ? CurveType.NONE : CurveType.FUNCTION);\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setChartArea(createChartArea());\n        options.setLegend(createChartLegend());\n        options.setColors(colors);\n        options.setHAxis(createHAxis());\n        options.setVAxis(createVAxis());\n\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleMapDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class GoogleMapDisplayer extends GoogleCategoriesDisplayer<GoogleMapDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleMapDisplayer> {\n\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleMapDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMinColumns(2)\n                .setMaxColumns(3)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[] {\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleMapDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.geochart.GeoChart;\nimport com.googlecode.gwt.charts.client.geochart.GeoChartOptions;\nimport com.googlecode.gwt.charts.client.options.DisplayMode;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\n\npublic class GoogleMapDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleMapDisplayer>\n        implements GoogleMapDisplayer.View {\n\n    protected GeoChart map = null;\n\n    @Override\n    public String getGroupsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Locations();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Series();\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        if (enabled) {\n            checkMapCreated();\n            map.addSelectHandler(createSelectHandler(map));\n        }\n    }\n\n    @Override\n    public void createChart() {\n        map  = new GeoChart();\n    }\n\n    @Override\n    public void drawChart() {\n        checkMapCreated();\n        map.draw(getDataTable(), createMapOptions());\n        super.showDisplayer(map);\n    }\n\n    protected void checkMapCreated() {\n        if (map == null) {\n            throw new RuntimeException(\"Map not created. Call to view.createChart() first\");\n        }\n    }\n\n    protected GeoChartOptions createMapOptions() {\n        GeoChartOptions options = GeoChartOptions.create();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setDisplayMode(DisplayerSubType.MAP_REGIONS.equals(subType) ? DisplayMode.REGIONS : DisplayMode.MARKERS);\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleMeterChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class GoogleMeterChartDisplayer extends GoogleCategoriesDisplayer<GoogleMeterChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GoogleMeterChartDisplayer> {\n\n        void setMeterStart(long meterStart);\n\n        void setMeterWarning(long meterWarning);\n\n        void setMeterCritical(long meterCritical);\n\n        void setMeterEnd(long meterEnd);\n    }\n\n    private View view;\n\n    @Inject\n    public GoogleMeterChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(false)\n                .setGroupAllowed(true)\n                .setGroupColumn(true)\n                .setMaxColumns(2)\n                .setMinColumns(1)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setFunctionRequired(true)\n                .setColumnTypes(new ColumnType[] {ColumnType.NUMBER},\n                        new ColumnType[] {ColumnType.LABEL, ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute(DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_WIDTH)\n                   .supportsAttribute(DisplayerAttributeDef.CHART_HEIGHT)\n                   .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.METER_GROUP);\n    }\n\n    @Override\n    protected void createVisualization() {\n        view.setMeterStart(displayerSettings.getMeterStart());\n        view.setMeterWarning(displayerSettings.getMeterWarning());\n        view.setMeterCritical(displayerSettings.getMeterCritical());\n        view.setMeterEnd(displayerSettings.getMeterEnd());\n\n        super.createVisualization();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleMeterChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.gauge.Gauge;\nimport com.googlecode.gwt.charts.client.gauge.GaugeOptions;\nimport com.googlecode.gwt.charts.client.options.Animation;\nimport com.googlecode.gwt.charts.client.options.AnimationEasing;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\n\npublic class GoogleMeterChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GoogleMeterChartDisplayer>\n        implements GoogleMeterChartDisplayer.View {\n\n    private Gauge meter = null;\n    protected long meterStart = 0;\n    protected long meterWarning = 600;\n    protected long meterCritical = 800;\n    protected long meterEnd = 1000;\n\n    @Override\n    public void setMeterStart(long meterStart) {\n        this.meterStart = meterStart;\n    }\n\n    @Override\n    public void setMeterWarning(long meterWarning) {\n        this.meterWarning = meterWarning;\n    }\n\n    @Override\n    public void setMeterCritical(long meterCritical) {\n        this.meterCritical = meterCritical;\n    }\n\n    @Override\n    public void setMeterEnd(long meterEnd) {\n        this.meterEnd = meterEnd;\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Value();\n    }\n\n    @Override\n    public void setFilterEnabled(boolean enabled) {\n        // Metrics does not provide filter support\n    }\n\n    @Override\n    public void createChart() {\n        meter = new Gauge();\n    }\n\n    @Override\n    public void drawChart() {\n        meter.draw(getDataTable(), createMeterOptions());\n        super.showDisplayer(meter);\n    }\n\n    protected GaugeOptions createMeterOptions() {\n        GaugeOptions options = GaugeOptions.create();\n        options.setWidth(width);\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setMin(meterStart);\n        options.setMax(meterEnd);\n        options.setGreenFrom(meterStart);\n        options.setGreenTo(meterWarning);\n        options.setYellowFrom(meterWarning);\n        options.setYellowTo(meterCritical);\n        options.setRedFrom(meterCritical);\n        options.setRedTo(meterEnd);\n        options.setGreenColor(\"#0088CE\");\n        options.setYellowColor(\"#EC7A08\");\n        options.setRedColor(\"#CC0000\");\n        if (animationOn) {\n            Animation anim = Animation.create();\n            anim.setDuration(animationDuration);\n            anim.setEasing(AnimationEasing.IN_AND_OUT);\n            options.setAnimation(anim);\n        }\n        return options;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GooglePieChartDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\n\n@Dependent\npublic class GooglePieChartDisplayer extends GoogleCategoriesDisplayer<GooglePieChartDisplayer.View> {\n\n    public interface View extends GoogleCategoriesDisplayer.View<GooglePieChartDisplayer> {\n\n    }\n\n    private View view;\n\n    @Inject\n    public GooglePieChartDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupRequired(true)\n                .setGroupColumn(true)\n                .setMaxColumns(2)\n                .setMinColumns(2)\n                .setExtraColumnsAllowed(false)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle())\n                .setColumnTypes(new ColumnType[]{\n                        ColumnType.LABEL,\n                        ColumnType.NUMBER});\n\n        return new DisplayerConstraints(lookupConstraints)\n                .supportsAttribute(DisplayerAttributeDef.TYPE)\n                .supportsAttribute(DisplayerAttributeDef.SUBTYPE)\n                .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_WIDTH)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_HEIGHT)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_RESIZABLE)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MAX_WIDTH)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MAX_HEIGHT)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_BGCOLOR)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_MARGIN_GROUP)\n                .supportsAttribute(DisplayerAttributeGroupDef.CHART_LEGEND_GROUP);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GooglePieChartDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.googlecode.gwt.charts.client.corechart.CoreChartWidget;\nimport com.googlecode.gwt.charts.client.corechart.PieChart;\nimport com.googlecode.gwt.charts.client.options.Options;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\n\npublic class GooglePieChartDisplayerView\n        extends GoogleCategoriesDisplayerView<GooglePieChartDisplayer>\n        implements GooglePieChartDisplayer.View {\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Values();\n    }\n\n    @Override\n    protected CoreChartWidget _createChart() {\n        return new PieChart();\n    }\n\n    @Override\n    protected Options createOptions() {\n        PieChartOptionsWrapper options = PieChartOptionsWrapper.newInstance();\n        options.setWidth(width);\n        options.setHeight(height);\n        options.setBackgroundColor(bgColor);\n        options.setLegend(createChartLegend());\n        options.setColors(colors);\n        options.setChartArea(createChartArea());\n        options.setIs3D(DisplayerSubType.PIE_3D.equals(subType));\n        options.setHole(DisplayerSubType.DONUT.equals(subType) ? 0.4d : 0);\n        return options.get();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleRenderer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.googlecode.gwt.charts.client.ChartLoader;\nimport com.googlecode.gwt.charts.client.ChartPackage;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.AbstractRendererLibrary;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\nimport static org.dashbuilder.displayer.DisplayerType.*;\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\n\nimport java.util.EnumSet;\n\n/**\n * Google's Visualization API based renderer.\n */\n@ApplicationScoped\npublic class GoogleRenderer extends AbstractRendererLibrary {\n\n    public static final String UUID = \"gwtcharts\";\n\n    private static Map<DisplayerType,ChartPackage> _packageTypes = new HashMap<DisplayerType,ChartPackage>();\n    static {\n        _packageTypes.put(BARCHART, ChartPackage.CORECHART);\n        _packageTypes.put(PIECHART, ChartPackage.CORECHART);\n        _packageTypes.put(AREACHART, ChartPackage.CORECHART);\n        _packageTypes.put(LINECHART, ChartPackage.CORECHART);\n        _packageTypes.put(BUBBLECHART, ChartPackage.CORECHART);\n        _packageTypes.put(METERCHART, ChartPackage.GAUGE);\n        _packageTypes.put(TABLE, ChartPackage.TABLE);\n        _packageTypes.put(MAP, ChartPackage.GEOCHART);\n    }\n\n    private List<DisplayerType> _supportedTypes = Arrays.asList(\n            BARCHART,\n            PIECHART,\n            AREACHART,\n            LINECHART,\n            BUBBLECHART,\n            METERCHART,\n            TABLE,\n            MAP);\n\n    @Inject\n    protected SyncBeanManager beanManager;\n\n    @Override\n    public String getUUID() {\n        return UUID;\n    }\n\n    @Override\n    public String getName() {\n        return \"GWT Charts\";\n    }\n\n    @Override\n    public List<DisplayerType> getSupportedTypes() {\n        return _supportedTypes;\n    }\n\n    @Override\n    public List<DisplayerSubType> getSupportedSubtypes(DisplayerType displayerType) {\n        switch (displayerType) {\n            case BARCHART:\n                return Arrays.asList(BAR, BAR_STACKED, COLUMN, COLUMN_STACKED);\n            case PIECHART:\n                return Arrays.asList(PIE, PIE_3D, DONUT);\n            case AREACHART:\n                return Arrays.asList(AREA, AREA_STACKED /*,STEPPED*/);\n            case LINECHART:\n                return Arrays.asList(LINE, SMOOTH);\n            case MAP:\n                return Arrays.asList(MAP_REGIONS, MAP_MARKERS);\n            default:\n                return Arrays.asList();\n        }\n    }\n\n    public Displayer lookupDisplayer(DisplayerSettings displayerSettings) {\n        DisplayerType displayerType = displayerSettings.getType();\n        GoogleDisplayer displayer;\n        switch (displayerType) {\n            case BARCHART:\n                displayer = beanManager.lookupBean(GoogleBarChartDisplayer.class).newInstance();\n                break;\n            case PIECHART:\n                displayer = beanManager.lookupBean(GooglePieChartDisplayer.class).newInstance();\n                break;\n            case AREACHART:\n                displayer = beanManager.lookupBean(GoogleAreaChartDisplayer.class).newInstance();\n                break;\n            case LINECHART:\n                displayer = beanManager.lookupBean(GoogleLineChartDisplayer.class).newInstance();\n                break;\n            case BUBBLECHART:\n                displayer = beanManager.lookupBean(GoogleBubbleChartDisplayer.class).newInstance();\n                break;\n            case METERCHART:\n                displayer = beanManager.lookupBean(GoogleMeterChartDisplayer.class).newInstance();\n                break;\n            case TABLE:\n                displayer = beanManager.lookupBean(GoogleTableDisplayer.class).newInstance();\n                break;\n            case MAP:\n                displayer = beanManager.lookupBean(GoogleMapDisplayer.class).newInstance();\n                break;\n            default:\n                return null;\n        }\n        ((GoogleDisplayerView) displayer.getView()).setRenderer(this);\n        return displayer;\n    }\n\n    /**\n     *  In Google the renderer mechanism is asynchronous.\n     */\n    public void draw(final List<Displayer> displayerList) {\n        // Get the modules to load.\n        Set<ChartPackage> packageList = EnumSet.noneOf(ChartPackage.class);\n        for (Displayer displayer : displayerList) {\n            try {\n                GoogleDisplayer googleDisplayer = (GoogleDisplayer) displayer;\n                packageList.add(_packageTypes.get(googleDisplayer.getDisplayerSettings().getType()));\n            } catch (ClassCastException e) {\n                // Just ignore non Google displayers.\n            }\n        }\n        // Create an array of packages.\n        ChartPackage[] packageArray = new ChartPackage[packageList.size()];\n        int i = 0;\n        for (ChartPackage pkg : packageList) {\n            packageArray[i++] = pkg;\n        }\n        // Load the visualization API\n        ChartLoader chartLoader = new ChartLoader(packageArray);\n        chartLoader.loadApi(new Runnable() {\n\n            // Called when the visualization API has been loaded.\n            public void run() {\n                for (Displayer displayer : displayerList) {\n                    try {\n                        GoogleDisplayer googleDisplayer = (GoogleDisplayer) displayer;\n                        googleDisplayer.ready();\n                    } catch (ClassCastException e) {\n                        // Just ignore non Google displayers.\n                    }\n                }\n            }\n        });\n    }\n    \n    @Override\n    public boolean isOffline() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleTableDisplayer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerAttributeDef;\nimport org.dashbuilder.displayer.DisplayerAttributeGroupDef;\nimport org.dashbuilder.displayer.DisplayerConstraints;\nimport org.dashbuilder.displayer.client.Displayer;\n\n@Dependent\npublic class GoogleTableDisplayer extends GoogleDisplayer<GoogleTableDisplayer.View> {\n\n    public interface View extends GoogleDisplayer.View<GoogleTableDisplayer> {\n\n        void createTable();\n\n        void setSortEnabled(boolean enabled);\n\n        void setTotalPagesHintEnabled(boolean enabled);\n\n        void setTotalRowsHintEnabled(boolean enabled);\n\n        void setPageSize(int size);\n\n        void setWidth(int width);\n\n        void setPagerEnabled(boolean enabled);\n\n        void setCurrentPage(int currentPage);\n\n        void setTotalRows(int numberOfRows);\n\n        void setTotalPages(int numberOfPages);\n\n        void setLeftMostPageNumber(int n);\n\n        void setRightMostPageNumber(int n);\n\n        void nodata();\n\n        void drawTable();\n    }\n\n    protected View view;\n    protected int pageSize = 20;\n    protected int currentPage = 1;\n    protected int numberOfRows = 0;\n    protected int numberOfPages = 1;\n    protected int pageSelectorSize = 6;\n    protected String lastOrderedColumn = null;\n    protected SortOrder lastSortOrder = null;\n    protected boolean showTotalRowsHint = true;\n    protected boolean showTotalPagesHint = true;\n\n    @Inject\n    public GoogleTableDisplayer(View view, FilterLabelSet filterLabelSet) {\n        super(filterLabelSet);\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public DisplayerConstraints createDisplayerConstraints() {\n        DataSetLookupConstraints lookupConstraints = new DataSetLookupConstraints()\n                .setGroupAllowed(true)\n                .setGroupRequired(false)\n                .setExtraColumnsAllowed(true)\n                .setGroupsTitle(view.getGroupsTitle())\n                .setColumnsTitle(view.getColumnsTitle());\n\n        return new DisplayerConstraints(lookupConstraints)\n                   .supportsAttribute( DisplayerAttributeDef.TYPE)\n                   .supportsAttribute(DisplayerAttributeDef.RENDERER)\n                   .supportsAttribute(DisplayerAttributeGroupDef.COLUMNS_GROUP)\n                   .supportsAttribute(DisplayerAttributeDef.COLUMN_EMPTY)\n                   .supportsAttribute(DisplayerAttributeGroupDef.FILTER_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.REFRESH_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.GENERAL_GROUP)\n                   .supportsAttribute(DisplayerAttributeGroupDef.TABLE_GROUP);\n    }\n\n    @Override\n    protected void beforeDataSetLookup() {\n        // Get the sort settings\n        if (lastOrderedColumn == null) {\n            String defaultSortColumn = displayerSettings.getTableDefaultSortColumnId();\n            if (defaultSortColumn != null && !\"\".equals( defaultSortColumn)) {\n                lastOrderedColumn = defaultSortColumn;\n                lastSortOrder = displayerSettings.getTableDefaultSortOrder();\n            }\n        }\n        // Apply the sort order specified (if any)\n        if (lastOrderedColumn != null) {\n            sortApply(lastOrderedColumn, lastSortOrder);\n        }\n        // Draw only the data subset corresponding to the current page.\n        int pageSize = displayerSettings.getTablePageSize();\n        int offset = (currentPage - 1) * pageSize;\n        dataSetHandler.limitDataSetRows(offset, pageSize);\n    }\n\n    @Override\n    protected void afterDataSetLookup(DataSet dataSet) {\n        pageSize = displayerSettings.getTablePageSize();\n        numberOfRows = dataSet.getRowCountNonTrimmed();\n        numberOfPages = ((numberOfRows - 1) / pageSize) + 1;\n        if (currentPage > numberOfPages) {\n            currentPage = 1;\n        }\n    }\n\n    @Override\n    protected void createVisualization() {\n        super.createVisualization();\n\n        int tableWidth = displayerSettings.getTableWidth();\n\n        view.createTable();\n        view.setSortEnabled(displayerSettings.isTableSortEnabled());\n        view.setTotalPagesHintEnabled(showTotalPagesHint);\n        view.setTotalRowsHintEnabled(showTotalRowsHint);\n        view.setPageSize(displayerSettings.getTablePageSize());\n        view.setWidth(tableWidth > 0 ? tableWidth : dataSet.getColumns().size() * 100);\n\n        this.updateVisualization();\n    }\n\n    @Override\n    protected void updateVisualization() {\n        view.setPagerEnabled(displayerSettings.getTablePageSize() < dataSet.getRowCountNonTrimmed());\n        view.setCurrentPage(currentPage);\n        view.setTotalRows(numberOfRows);\n        view.setTotalPages(numberOfPages);\n        view.setLeftMostPageNumber(getLeftMostPageNumber());\n        view.setRightMostPageNumber(getRightMostPageNumber());\n\n        if (numberOfRows == 0) {\n            view.nodata();\n        } else {\n            super.pushDataToView();\n            view.drawTable();\n        }\n    }\n\n    public void sortBy(String column) {\n        if (displayerSettings.isTableSortEnabled()) {\n            lastOrderedColumn = column;\n            lastSortOrder = lastSortOrder != null ? lastSortOrder.reverse() : SortOrder.ASCENDING;\n            super.redraw();\n        }\n    }\n\n    public void gotoPage(int pageNumber) {\n        if (pageNumber != currentPage && pageNumber > 0 && pageNumber < numberOfPages + 1) {\n            currentPage = pageNumber;\n            super.redraw();\n        }\n    }\n\n    public int getLeftMostPageNumber() {\n        int page = currentPage - pageSelectorSize/2;\n        if (page < 1) return 1;\n        return page;\n    }\n\n    public int getRightMostPageNumber() {\n        int page = getLeftMostPageNumber() + pageSelectorSize - 1;\n        if (page > numberOfPages) return numberOfPages;\n        return page;\n    }\n\n    public int getCurrentPage() {\n        return currentPage;\n    }\n\n    // Reset the current navigation status on filter requests from external displayers.\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetGroup groupOp) {\n        currentPage = 1;\n        super.onFilterEnabled(displayer, groupOp);\n    }\n\n    @Override\n    public void onFilterEnabled(Displayer displayer, DataSetFilter filter) {\n        currentPage = 1;\n        super.onFilterEnabled(displayer, filter);\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, List<DataSetGroup> groupOps) {\n        currentPage = 1;\n        super.onFilterReset(displayer, groupOps);\n    }\n\n    @Override\n    public void onFilterReset(Displayer displayer, DataSetFilter filter) {\n        currentPage = 1;\n        super.onFilterReset(displayer, filter);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/GoogleTableDisplayerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HasVerticalAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.googlecode.gwt.charts.client.event.SortEvent;\nimport com.googlecode.gwt.charts.client.event.SortHandler;\nimport com.googlecode.gwt.charts.client.options.TableSort;\nimport com.googlecode.gwt.charts.client.table.Table;\nimport com.googlecode.gwt.charts.client.table.TableOptions;\nimport org.dashbuilder.renderer.google.client.resources.i18n.GoogleDisplayerConstants;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.Pagination;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.IconSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.PaginationSize;\n\npublic class GoogleTableDisplayerView\n        extends GoogleDisplayerView<GoogleTableDisplayer>\n        implements GoogleTableDisplayer.View {\n\n    private Table table;\n    protected int pageSize = 10;\n    protected int width = 500;\n    protected int totalPages = 1;\n    protected int currentPage = 1;\n    protected int totalRows = 0;\n    protected int leftMostPageNumber = 0;\n    protected int rightMostPageNumber = 0;\n    protected boolean pagerEnabled = false;\n    protected boolean totalPagesHintEnabled = false;\n    protected boolean totalRowsHintEnabled = false;\n\n    @Override\n    public String getGroupsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Rows();\n    }\n\n    @Override\n    public String getColumnsTitle() {\n        return GoogleDisplayerConstants.INSTANCE.common_Columns();\n    }\n\n    @Override\n    public void createTable() {\n        table = new Table();\n    }\n\n    @Override\n    public void setSortEnabled(boolean enabled) {\n        if (enabled) {\n            table.addSortHandler(new SortHandler() {\n                public void onSort(SortEvent sortEvent) {\n                    String columnId = getDataTable().getColumnId(sortEvent.getColumn());\n                    getPresenter().sortBy(columnId);\n                }\n            } );\n        }\n    }\n\n    @Override\n    public void setTotalPagesHintEnabled(boolean enabled) {\n        this.totalPagesHintEnabled = enabled;\n    }\n\n    @Override\n    public void setTotalRowsHintEnabled(boolean enabled) {\n        this.totalRowsHintEnabled = enabled;\n    }\n\n    @Override\n    public void setPageSize(int size) {\n        this.pageSize = size;\n    }\n\n    @Override\n    public void setWidth(int width) {\n        this.width = width;\n    }\n\n    @Override\n    public void setPagerEnabled(boolean enabled) {\n        this.pagerEnabled = enabled;\n    }\n\n    @Override\n    public void setCurrentPage(int currentPage) {\n        this.currentPage = currentPage;\n    }\n\n    @Override\n    public void setTotalRows(int numberOfRows) {\n        this.totalRows = numberOfRows;\n    }\n\n    @Override\n    public void setTotalPages(int numberOfPages) {\n        this.totalPages = numberOfPages;\n    }\n\n    @Override\n    public void setLeftMostPageNumber(int n) {\n        this.leftMostPageNumber = n;\n    }\n\n    @Override\n    public void setRightMostPageNumber(int n) {\n        this.rightMostPageNumber = n;\n    }\n\n    @Override\n    public void nodata() {\n        table.draw(getDataTable(), createOptions());\n\n        FlowPanel tablePanel  = new FlowPanel();\n        tablePanel.add(table);\n        tablePanel.add(new Label(GoogleDisplayerConstants.INSTANCE.common_noData()));\n        super.showDisplayer(tablePanel);\n    }\n\n    @Override\n    public void drawTable() {\n        table.draw(getDataTable(), createOptions());\n\n        FlowPanel tablePanel  = new FlowPanel();\n        tablePanel.add(table);\n        if (pagerEnabled) {\n            HorizontalPanel pager = createTablePager();\n            tablePanel.add(pager);\n        }\n        super.showDisplayer(tablePanel);\n    }\n\n    protected TableOptions createOptions() {\n        TableOptions options = TableOptions.create();\n        options.setSort(TableSort.EVENT);\n        options.setPageSize(pageSize);\n        options.setShowRowNumber(false);\n        options.setWidth(width);\n        return options;\n    }\n\n    protected HorizontalPanel createTablePager() {\n        HorizontalPanel pagerPanel = new HorizontalPanel();\n        pagerPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);\n        pagerPanel.getElement().setAttribute(\"cellpadding\", \"5\");\n\n        Pagination pagination = new Pagination();\n        pagination.setPaginationSize(PaginationSize.NONE);\n\n        for (int i = leftMostPageNumber; i <= rightMostPageNumber; i++) {\n            AnchorListItem pageLink = new AnchorListItem(Integer.toString(i));\n            final Integer _currentPage = i;\n            if (currentPage != i) {\n                pageLink.setActive(false);\n                pageLink.addClickHandler(new ClickHandler() {\n                    public void onClick(ClickEvent event) {\n                        getPresenter().gotoPage(_currentPage.intValue());\n                    }\n                });\n            } else {\n                pageLink.setActive(true);\n            }\n            pagination.add(pageLink);\n        }\n\n        Icon leftPageIcon = new Icon(IconType.ANGLE_LEFT);\n        leftPageIcon.setSize(IconSize.LARGE );\n        leftPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        leftPageIcon.sinkEvents(Event.ONCLICK);\n        leftPageIcon.addHandler(createGotoPageHandler(currentPage - 1), ClickEvent.getType());\n        Tooltip leftPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoPreviousPage());\n        leftPageTooltip.add(leftPageIcon);\n\n        Icon rightPageIcon = new Icon(IconType.ANGLE_RIGHT);\n        rightPageIcon.setSize(IconSize.LARGE);\n        rightPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        rightPageIcon.sinkEvents(Event.ONCLICK);\n        rightPageIcon.addHandler(createGotoPageHandler(currentPage + 1), ClickEvent.getType());\n        Tooltip rightPageTooltip = new Tooltip( GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoNextPage() );\n        rightPageTooltip.add(rightPageIcon);\n\n        Icon firstPageIcon = new Icon(IconType.ANGLE_DOUBLE_LEFT);\n        firstPageIcon.setSize(IconSize.LARGE);\n        firstPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        firstPageIcon.sinkEvents(Event.ONCLICK);\n        firstPageIcon.addHandler(createGotoPageHandler(1), ClickEvent.getType());\n        Tooltip firstPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoFirstPage());\n        firstPageTooltip.add(firstPageIcon);\n\n        Icon lastPageIcon = new Icon(IconType.ANGLE_DOUBLE_RIGHT);\n        lastPageIcon.setSize(IconSize.LARGE);\n        lastPageIcon.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        lastPageIcon.sinkEvents(Event.ONCLICK);\n        lastPageIcon.addHandler(createGotoPageHandler(totalPages), ClickEvent.getType());\n        Tooltip lastPageTooltip = new Tooltip(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_gotoLastPage());\n        lastPageTooltip.add(lastPageIcon);\n\n        pagerPanel.add(firstPageTooltip);\n        pagerPanel.add(leftPageTooltip);\n        pagerPanel.add(pagination);\n        pagerPanel.add(rightPageTooltip);\n        pagerPanel.add(lastPageTooltip);\n\n        if (totalPagesHintEnabled) {\n            pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_pages(\n                    Integer.toString(leftMostPageNumber),\n                    Integer.toString(rightMostPageNumber),\n                    Integer.toString(totalPages))));\n        }\n        if (totalRowsHintEnabled) {\n            int currentRowsShown = currentPage * pageSize > totalRows ? totalRows : currentPage * pageSize;\n            pagerPanel.add(new Label(GoogleDisplayerConstants.INSTANCE.googleTableDisplayer_rows(\n                    Integer.toString(((currentPage - 1) * pageSize) + 1),\n                    Integer.toString(currentRowsShown),\n                    Integer.toString(totalRows))));\n        }\n        return pagerPanel;\n    }\n\n    protected ClickHandler createGotoPageHandler(final int page) {\n        return new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                getPresenter().gotoPage(page);\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/PieChartOptionsWrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport com.google.gwt.core.client.JsArray;\nimport com.googlecode.gwt.charts.client.corechart.PieChartOptions;\nimport com.googlecode.gwt.charts.client.corechart.PieChartTooltip;\nimport com.googlecode.gwt.charts.client.options.BackgroundColor;\nimport com.googlecode.gwt.charts.client.options.ChartArea;\nimport com.googlecode.gwt.charts.client.options.Legend;\nimport com.googlecode.gwt.charts.client.options.Options;\nimport com.googlecode.gwt.charts.client.options.PieSliceText;\nimport com.googlecode.gwt.charts.client.options.Slice;\nimport com.googlecode.gwt.charts.client.options.TextStyle;\n\npublic class PieChartOptionsWrapper {\n\n    private PieChartOptions _this;\n\n    private PieChartOptionsWrapper() {\n        _this = PieChartOptions.create();\n    }\n\n    public static PieChartOptionsWrapper newInstance() {\n        return new PieChartOptionsWrapper();\n    }\n\n    public PieChartOptions get() {\n        return _this;\n    }\n\n    public final void setHeight(int height) {\n        _this.setHeight(height);\n    }\n\n    public final void setWidth(int width) {\n        _this.setWidth(width);\n    }\n\n    public final void setBackgroundColor(BackgroundColor backgroundColor) {\n        _this.setBackgroundColor(backgroundColor);\n    }\n\n    public final void setBackgroundColor(String color) {\n        _this.setBackgroundColor(color);\n    }\n\n    public final void setChartArea(ChartArea chartArea) {\n        _this.setChartArea(chartArea);\n    }\n\n    public final void setColors(String... colors) {\n        _this.setColors(colors);\n    }\n\n    public final void setFontName(String name) {\n        _this.setFontName(name);\n    }\n\n    public final void setFontSize(double size) {\n        _this.setFontSize(size);\n    }\n\n    public final void setIs3D(boolean is3D) {\n        _this.setIs3D(is3D);\n    }\n\n    public final void setLegend(Legend legend) {\n        _this.setLegend(legend);\n    }\n\n    public final void setPieResidueSliceColor(String pieResidueSliceColor) {\n        _this.setPieResidueSliceColor(pieResidueSliceColor);\n    }\n\n    public final void setPieResidueSliceLabel(String pieResidueSliceLabel) {\n        _this.setPieResidueSliceLabel(pieResidueSliceLabel);\n    }\n\n    public final void setPieSliceBorderColor(String pieSliceBorderColor) {\n        _this.setPieSliceBorderColor(pieSliceBorderColor);\n    }\n\n    public final void setPieSliceText(PieSliceText pieSliceText) {\n        _this.setPieSliceText(pieSliceText);\n    }\n\n    public final void setPieSliceTextStyle(TextStyle pieSliceTextStyle) {\n        _this.setPieSliceTextStyle(pieSliceTextStyle);\n    }\n\n    public final void setReverseCategories(boolean reverseCategories) {\n        _this.setReverseCategories(reverseCategories);\n    }\n\n    public final void setSlices(JsArray<Slice> slices) {\n        _this.setSlices(slices);\n    }\n\n    public final void setSliceVisibilityThreshold(\n            double sliceVisibilityThreshold) {\n        _this.setSliceVisibilityThreshold(sliceVisibilityThreshold);\n    }\n\n    public final void setTitle(String title) {\n        _this.setTitle(title);\n    }\n\n    public final void setTitleTextStyle(TextStyle textStyle) {\n        _this.setTitleTextStyle(textStyle);\n    }\n\n    public final void setTooltip(PieChartTooltip tooltip) {\n        _this.setTooltip(tooltip);\n    }\n\n    public void setHole(double d) {\n        setHole(get(), d);\n    }\n\n    private final native void setHole(PieChartOptions chartOptions, double d) /*-{\n        chartOptions.pieHole = d;\n    }-*/;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/java/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.renderer.google.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface GoogleDisplayerConstants extends Messages {\n\n    public static final GoogleDisplayerConstants INSTANCE = GWT.create( GoogleDisplayerConstants.class );\n\n    String common_Categories();\n\n    String common_Series();\n\n    String common_Values();\n\n    String common_Value();\n\n    String common_Locations();\n\n    String common_Rows();\n\n    String common_Columns();\n\n    String common_noData();\n\n    String googleDisplayer_resetAnchor();\n\n    String googleBubbleDisplayer_XAxis();\n\n    String googleBubbleDisplayer_YAxis();\n\n    String googleBubbleDisplayer_BubbleColor();\n\n    String googleBubbleDisplayer_BubbleSize();\n\n    String googleTableDisplayer_gotoFirstPage();\n\n    String googleTableDisplayer_gotoPreviousPage();\n\n    String googleTableDisplayer_gotoNextPage();\n\n    String googleTableDisplayer_gotoLastPage();\n\n    String googleTableDisplayer_pages( String leftMostPageNumber, String rightMostPageNumber, String totalPages);\n\n    String googleTableDisplayer_rows( String from, String to, String totalRows);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.renderer.google.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/GChartsRenderer.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n\n  <inherits name=\"com.googlecode.gwt.charts.Charts\"/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path='google'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categories\ncommon_Series=Series\ncommon_Values=Values\ncommon_Value=Value\ncommon_Locations=Locations\ncommon_Rows=Group By\ncommon_Columns=Columns\ncommon_noData=No data\n\ngoogleDisplayer_resetAnchor=reset\n\ngoogleBubbleDisplayer_XAxis=X Axis\ngoogleBubbleDisplayer_YAxis=Y Axis\ngoogleBubbleDisplayer_BubbleColor=Bubble color\ngoogleBubbleDisplayer_BubbleSize=Bubble size\n\ngoogleTableDisplayer_gotoFirstPage=Go to first page\ngoogleTableDisplayer_gotoPreviousPage=Go to previous page\ngoogleTableDisplayer_gotoNextPage=Go to next page\ngoogleTableDisplayer_gotoLastPage=Go to last page\ngoogleTableDisplayer_pages=Pages {0}-{1} of {2}\ngoogleTableDisplayer_rows=Rows {0}-{1} of {2}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_de.properties",
    "content": "common_Categories=Kategorien\ncommon_Series=Serie\ncommon_Values=Werte\ncommon_Value=Wert\ncommon_Locations=Speicherorte\ncommon_Columns=Spalten\ncommon_noData=Keine Daten\ngoogleDisplayer_resetAnchor=zurücksetzen\ngoogleBubbleDisplayer_XAxis=X-Achse\ngoogleBubbleDisplayer_YAxis=Y-Achse\ngoogleBubbleDisplayer_BubbleColor=Blasen-Farbe\ngoogleBubbleDisplayer_BubbleSize=Blasen-Größe\ngoogleTableDisplayer_gotoFirstPage=Zur ersten Seite\ngoogleTableDisplayer_gotoPreviousPage=Zur vorherigen Seite\ngoogleTableDisplayer_gotoNextPage=Zur nächsten Seite\ngoogleTableDisplayer_gotoLastPage=Zur letzten Seite\ngoogleTableDisplayer_pages=Seiten {0}-{1} von {2}\ngoogleTableDisplayer_rows=Reihen {0}-{1} von {2}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_es.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorías\ncommon_Series=Serie\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Ubicaciones\ncommon_Rows=Agrupar por\ncommon_Columns=Columnas\ncommon_noData=No hay datos\n\ngoogleDisplayer_resetAnchor=restablecer\n\ngoogleBubbleDisplayer_XAxis=Eje X\ngoogleBubbleDisplayer_YAxis=Eje Y\ngoogleBubbleDisplayer_BubbleColor=Color de la burbuja\ngoogleBubbleDisplayer_BubbleSize=Tamaño de la burbuja\n\ngoogleTableDisplayer_gotoFirstPage=Ir a la primera página\ngoogleTableDisplayer_gotoPreviousPage=Ir a la página anterior\ngoogleTableDisplayer_gotoNextPage=Ir a la siguiente página\ngoogleTableDisplayer_gotoLastPage=Ir a la última página\ngoogleTableDisplayer_pages=Páginas {0}-{1} de {2}\ngoogleTableDisplayer_rows=Filas {0}-{1} de {2}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_fr.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Catégories\ncommon_Series=Séries\ncommon_Values=Valeurs\ncommon_Value=Valeur\ncommon_Locations=Sites\ncommon_Rows=Grouper par\ncommon_Columns=Colonnes\ncommon_noData=Aucune donnée\n\ngoogleDisplayer_resetAnchor=réinitialiser\n\ngoogleBubbleDisplayer_XAxis=Axe X\ngoogleBubbleDisplayer_YAxis=Axe Y\ngoogleBubbleDisplayer_BubbleColor=Couleur de la bulle\ngoogleBubbleDisplayer_BubbleSize=Taille de la bulle\n\ngoogleTableDisplayer_gotoFirstPage=Aller à la première page\ngoogleTableDisplayer_gotoPreviousPage=Aller à la page précédente\ngoogleTableDisplayer_gotoNextPage=Aller à la page suivante\ngoogleTableDisplayer_gotoLastPage=Aller à la dernière page\ngoogleTableDisplayer_pages=Pages {0}-{1} sur {2}\ngoogleTableDisplayer_rows=Lignes {0}-{1} sur {2}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_it.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=Categorie\ncommon_Series=Serie\ncommon_Values=Valori\ncommon_Value=Valore\ncommon_Locations=Posizioni\ncommon_Rows=Raggruppa per\ncommon_Columns=Colonne\ncommon_noData=Nessun dato\n\ngoogleDisplayer_resetAnchor=reset\n\ngoogleBubbleDisplayer_XAxis=Asse X\ngoogleBubbleDisplayer_YAxis=Asse Y\ngoogleBubbleDisplayer_BubbleColor=Colore bolle\ngoogleBubbleDisplayer_BubbleSize=Dimensione bolle\n\ngoogleTableDisplayer_gotoFirstPage=Vai alla prima pagina\ngoogleTableDisplayer_gotoPreviousPage=Vai alla pagina precedente\ngoogleTableDisplayer_gotoNextPage=Vai alla pagina successiva\ngoogleTableDisplayer_gotoLastPage=Vai all''ultima pagina\ngoogleTableDisplayer_pages=Pagine {0}-{1} di {2}\ngoogleTableDisplayer_rows=Righe {0}-{1} di {2}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_ja.properties",
    "content": "#\n# Copyright (C) 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\ncommon_Categories=カテゴリ\ncommon_Series=シリーズ\ncommon_Values=値\ncommon_Value=値\ncommon_Locations=場所\ncommon_Rows=グループ化\ncommon_Columns=カラム\ncommon_noData=データなし\n\ngoogleDisplayer_resetAnchor=リセット\n\ngoogleBubbleDisplayer_XAxis=X 軸\ngoogleBubbleDisplayer_YAxis=Y 軸\ngoogleBubbleDisplayer_BubbleColor=バブル色\ngoogleBubbleDisplayer_BubbleSize=バブルサイズ\n\ngoogleTableDisplayer_gotoFirstPage=最初のページに移動\ngoogleTableDisplayer_gotoPreviousPage=前のページに移動\ngoogleTableDisplayer_gotoNextPage=次のページに移動\ngoogleTableDisplayer_gotoLastPage=最後のページに移動\ngoogleTableDisplayer_pages=ページ {0}-{1} / {2}\ngoogleTableDisplayer_rows=行 {0}-{1} / {2}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_pt_BR.properties",
    "content": "common_Categories=Categorias\ncommon_Series=Séries\ncommon_Values=Valores\ncommon_Value=Valor\ncommon_Locations=Locais\ncommon_Columns=Colunas\ncommon_noData=Não há dados\ngoogleDisplayer_resetAnchor=reiniciar\ngoogleBubbleDisplayer_XAxis=X Axis\ngoogleBubbleDisplayer_YAxis=Y Axis\ngoogleBubbleDisplayer_BubbleColor=Cor do Bubble\ngoogleBubbleDisplayer_BubbleSize=Tamanho do Bubble\ngoogleTableDisplayer_gotoFirstPage=Vá para a primeira página\ngoogleTableDisplayer_gotoPreviousPage=Vá para a página anterior\ngoogleTableDisplayer_gotoNextPage=Vá para a próxima página\ngoogleTableDisplayer_gotoLastPage=Vá para a última página\ngoogleTableDisplayer_pages=Páginas {0}-{1} de {2}\ngoogleTableDisplayer_rows=Linhas {0}-{1} of {2}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/main/resources/org/dashbuilder/renderer/google/client/resources/i18n/GoogleDisplayerConstants_zh_CN.properties",
    "content": "common_Categories=类别\ncommon_Series=序列\ncommon_Values=值\ncommon_Value=值\ncommon_Locations=位置\ncommon_Columns=列\ncommon_noData=没有数据\ngoogleDisplayer_resetAnchor=重置\ngoogleBubbleDisplayer_XAxis=X  轴\ngoogleBubbleDisplayer_YAxis=Y 轴\ngoogleBubbleDisplayer_BubbleColor=Bubble 颜色\ngoogleBubbleDisplayer_BubbleSize=Bubble 大小\ngoogleTableDisplayer_gotoFirstPage=进入第一页\ngoogleTableDisplayer_gotoPreviousPage=进入前一页\ngoogleTableDisplayer_gotoNextPage=进入下一页\ngoogleTableDisplayer_gotoLastPage=进入最后一页\ngoogleTableDisplayer_pages={2} 的 {0}-{1} 页\ngoogleTableDisplayer_rows={2} 的 {0}-{1} 行\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/test/java/org/dashbuilder/renderer/google/client/GoogleDisplayerDataTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class GoogleDisplayerDataTest extends GoogleDisplayerTest {\n\n    DisplayerSettings byYear = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, true)\n            .sort(COLUMN_DATE, SortOrder.ASCENDING)\n            .buildSettings();\n\n    DisplayerSettings noData = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .filter(COLUMN_ID, FilterFactory.isNull())\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .buildSettings();\n\n    @Test\n    public void testDataPush() {\n\n        // Google renderer draw calls are processed asynchronously\n        // A ready() call needs to be executed in order to ignite the real chart display\n        GoogleBarChartDisplayer barChart = createBarChartDisplayer(byYear);\n        barChart.ready();\n\n        GoogleBarChartDisplayer.View view = barChart.getView();\n        verify(view).dataClear();\n        verify(view).dataAddColumn(ColumnType.LABEL, COLUMN_DATE, COLUMN_DATE);\n        verify(view).dataAddColumn(eq(ColumnType.NUMBER), anyString(), anyString());\n        verify(view).dataRowCount(4);\n        verify(view, times(4)).dataSetValue(anyInt(), anyInt(), anyString());\n        verify(view, times(4)).dataSetValue(anyInt(), anyInt(), any(Double.class));\n        verify(view).dataFormatNumberColumn(anyString(), eq(1));\n    }\n\n    @Test\n    public void testNoData() {\n\n        // Google renderer draw calls are processed asynchronously\n        // A ready() call needs to be executed in order to ignite the real chart display\n        GoogleBarChartDisplayer barChart = createBarChartDisplayer(noData);\n        barChart.ready();\n\n        GoogleBarChartDisplayer.View view = barChart.getView();\n        verify(view).nodata();\n        verify(view, never()).dataClear();\n        verify(view, never()).dataAddColumn(any(ColumnType.class), anyString(), anyString());\n        verify(view, never()).dataRowCount(anyInt());\n        verify(view, never()).dataSetValue(anyInt(), anyInt(), anyString());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/test/java/org/dashbuilder/renderer/google/client/GoogleDisplayerDrawTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.Position;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class GoogleDisplayerDrawTest extends GoogleDisplayerTest {\n\n    @Test\n    public void testGeneralSettings() {\n\n        DisplayerSettings byYear = DisplayerSettingsFactory.newBarChartSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM)\n                .subType_Bar()\n                .title(\"Title\").titleVisible(true)\n                .width(500).height(300)\n                .margins(1, 2, 3, 4)\n                .backgroundColor(\"white\")\n                .legendOn(Position.LEFT)\n                .refreshOn(5, false)\n                .filterOn(false, true, true)\n                .xAxisTitle(\"Date\")\n                .yAxisTitle(\"Total\")\n                .buildSettings();\n\n        // Google renderer draw calls are processed asynchronously\n        // A ready() call needs to be executed in order to ignite the real chart display\n        GoogleBarChartDisplayer barChart = createBarChartDisplayer(byYear);\n        GoogleBarChartDisplayer.View barChartView = barChart.getView();\n        barChart.ready();\n\n        verify(barChartView).showTitle(\"Title\");\n        verify(barChartView).setFilterEnabled(true);\n        verify(barChartView).setSubType(DisplayerSubType.BAR);\n        verify(barChartView).setWidth(500);\n        verify(barChartView).setHeight(300);\n        verify(barChartView).setBgColor(\"white\");\n        verify(barChartView).setMarginTop(1);\n        verify(barChartView).setMarginBottom(2);\n        verify(barChartView).setMarginLeft(3);\n        verify(barChartView).setMarginRight(4);\n        verify(barChartView).setLegendPosition(Position.LEFT);\n        verify(barChartView).enableRefreshTimer(5);\n        verify(barChartView).setShowXLabels(true);\n        verify(barChartView).setShowYLabels(true);\n        verify(barChartView).setXAxisTitle(\"Date\");\n        verify(barChartView).setYAxisTitle(\"Total\");\n        verify(barChartView).setIsStacked(false);\n        verify(barChartView).setIsBar(true);\n        verify(barChartView).drawChart();\n    }\n\n    @Test\n    public void testBarChartDraw() {\n\n        DisplayerSettings byYear = DisplayerSettingsFactory.newBarChartSettings()\n                .dataset(EXPENSES)\n                .group(COLUMN_DATE)\n                .column(COLUMN_DATE)\n                .column(COLUMN_AMOUNT, SUM)\n                .subType_Bar()\n                .buildSettings();\n\n        // Bar\n        GoogleBarChartDisplayer barChart = createBarChartDisplayer(byYear);\n        GoogleBarChartDisplayer.View barChartView = barChart.getView();\n        barChart.ready();\n        verify(barChartView).setIsStacked(false);\n        verify(barChartView).setIsBar(true);\n\n        // Bar stacked\n        byYear.setSubtype(DisplayerSubType.BAR_STACKED);\n        barChart = createBarChartDisplayer(byYear);\n        barChart.ready();\n        barChartView = barChart.getView();\n        verify(barChartView).setIsStacked(true);\n        verify(barChartView).setIsBar(true);\n\n        // Column\n        byYear.setSubtype(DisplayerSubType.COLUMN);\n        barChart = createBarChartDisplayer(byYear);\n        barChart.ready();\n        barChartView = barChart.getView();\n        verify(barChartView).setIsStacked(false);\n        verify(barChartView).setIsBar(false);\n\n        // Bar stacked\n        byYear.setSubtype(DisplayerSubType.COLUMN_STACKED);\n        barChart = createBarChartDisplayer(byYear);\n        barChart.ready();\n        barChartView = barChart.getView();\n        verify(barChartView).setIsStacked(true);\n        verify(barChartView).setIsBar(false);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/test/java/org/dashbuilder/renderer/google/client/GoogleDisplayerFilterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.common.client.widgets.FilterLabel;\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class GoogleDisplayerFilterTest extends GoogleDisplayerTest {\n\n    DisplayerSettings byYear = DisplayerSettingsFactory.newBarChartSettings()\n            .dataset(EXPENSES)\n            .group(COLUMN_DATE)\n            .column(COLUMN_DATE)\n            .column(COLUMN_AMOUNT, SUM)\n            .filterOn(false, true, true)\n            .sort(COLUMN_DATE, SortOrder.ASCENDING)\n            .buildSettings();\n\n    @Mock\n    FilterLabel filterLabel;\n\n    public void resetFilterLabelSet(FilterLabelSet filterLabelSet) {\n        reset(filterLabelSet);\n        doAnswer(invocationOnMock -> filterLabel).when(filterLabelSet).addLabel(anyString());\n    }\n\n    @Test\n    public void testFilter() {\n\n        // Google renderer draw calls are processed asynchronously\n        // A ready() call needs to be executed in order to ignite the real chart display\n        GoogleBarChartDisplayer barChart = createBarChartDisplayer(byYear);\n        GoogleBarChartDisplayer.View barChartView = barChart.getView();\n        FilterLabelSet filterLabelSet = barChart.getFilterLabelSet();\n        barChart.ready();\n\n        // Select first bar\n        reset(barChartView);\n        resetFilterLabelSet(filterLabelSet);\n        barChart.onCategorySelected(COLUMN_DATE, 0);\n        verify(filterLabelSet).clear();\n        verify(filterLabelSet).addLabel(\"2012\");\n        verify(barChartView).drawChart();\n\n        // Select another bar\n        reset(barChartView);\n        resetFilterLabelSet(filterLabelSet);\n        barChart.onCategorySelected(COLUMN_DATE, 1);\n        verify(filterLabelSet).clear();\n        verify(filterLabelSet).addLabel(\"2012\");\n        verify(filterLabelSet).addLabel(\"2013\");\n        verify(barChartView).drawChart();\n\n        // Reset the filter\n        reset(barChartView);\n        resetFilterLabelSet(filterLabelSet);\n        barChart.onFilterClearAll();\n        verify(filterLabelSet).clear();\n        verify(filterLabelSet, never()).addLabel(anyString());\n        verify(barChartView).drawChart();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/test/java/org/dashbuilder/renderer/google/client/GoogleDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.common.client.widgets.FilterLabelSet;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\n\nimport static org.mockito.Mockito.*;\n\npublic abstract class GoogleDisplayerTest extends AbstractDisplayerTest {\n\n    public GoogleBarChartDisplayer createBarChartDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new GoogleBarChartDisplayer(mock(GoogleBarChartDisplayer.View.class), mock(FilterLabelSet.class)), settings);\n    }\n\n    public GoogleTableDisplayer createTableDisplayer(DisplayerSettings settings) {\n        return initDisplayer(new GoogleTableDisplayer(mock(GoogleTableDisplayer.View.class), mock(FilterLabelSet.class)), settings);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/dashbuilder-renderer-google/src/test/java/org/dashbuilder/renderer/google/client/GoogleTableDisplayerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.renderer.google.client;\n\nimport org.dashbuilder.dataset.filter.FilterFactory;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.dashbuilder.dataset.ExpenseReportsData.*;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class GoogleTableDisplayerTest extends GoogleDisplayerTest {\n\n    @Test\n    public void testTableDraw() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tableOrderDefault(COLUMN_DEPARTMENT, SortOrder.DESCENDING)\n                .tableOrderEnabled(true)\n                .tablePageSize(10)\n                .tableWidth(1000)\n                .buildSettings();\n\n        GoogleTableDisplayer table = createTableDisplayer(allRows);\n        GoogleTableDisplayer.View tableView = table.getView();\n        table.ready();\n\n        verify(tableView).setWidth(1000);\n        verify(tableView).setSortEnabled(true);\n        verify(tableView).setPageSize(10);\n        verify(tableView).setTotalRows(50);\n        verify(tableView).setTotalPages(5);\n        verify(tableView).setPagerEnabled(true);\n        verify(tableView).drawTable();\n    }\n\n    @Test\n    public void testEmptyTableDraw() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .filter(COLUMN_ID, FilterFactory.isNull())\n                .tablePageSize(10)\n                .buildSettings();\n\n        GoogleTableDisplayer table = createTableDisplayer(allRows);\n        GoogleTableDisplayer.View tableView = table.getView();\n        table.ready();\n\n        verify(tableView).setPageSize(10);\n        verify(tableView).setTotalRows(0);\n        verify(tableView).setTotalPages(1);\n        verify(tableView).setPagerEnabled(false);\n        verify(tableView).nodata();\n    }\n\n    @Test\n    public void testTablePager() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .buildSettings();\n\n        GoogleTableDisplayer table = createTableDisplayer(allRows);\n        GoogleTableDisplayer.View tableView = table.getView();\n        table.ready();\n\n        // Initialization\n        verify(tableView).setPageSize(10);\n        verify(tableView).setTotalRows(50);\n        verify(tableView).setTotalPages(5);\n        verify(tableView).setCurrentPage(1);\n        verify(tableView).setPagerEnabled(true);\n        verify(tableView).drawTable();\n\n        // Non existent page (no effect)\n        reset(tableView);\n        table.gotoPage(-1);\n        assertEquals(table.getCurrentPage(), 1);\n        verifyZeroInteractions(tableView);\n\n        // Non existent page (no effect)\n        reset(tableView);\n        table.gotoPage(11);\n        assertEquals(table.getCurrentPage(), 1);\n        verifyZeroInteractions(tableView);\n\n        // Goto page\n        reset(tableView);\n        table.gotoPage(5);\n        verify(tableView).setCurrentPage(5);\n        assertEquals(table.getCurrentPage(), 5);\n        verify(tableView).drawTable();\n    }\n\n    @Test\n    public void testTableSort() {\n\n        DisplayerSettings allRows = DisplayerSettingsFactory.newTableSettings()\n                .dataset(EXPENSES)\n                .tablePageSize(10)\n                .tableOrderDefault(COLUMN_ID, SortOrder.DESCENDING)\n                .buildSettings();\n\n        // Sorted by ID descending by default\n        GoogleTableDisplayer table = createTableDisplayer(allRows);\n        GoogleTableDisplayer.View tableView = table.getView();\n        table.ready();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0,0), 50d);\n\n        // Sort disabled (no effect)\n        allRows.setTableSortEnabled(false);\n        table = createTableDisplayer(allRows);\n        tableView = table.getView();\n        table.ready();\n        reset(tableView);\n        table.sortBy(COLUMN_ID);\n        verify(tableView, never()).drawTable();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0, 0), 50d);\n\n        // Sort enabled\n        allRows.setTableSortEnabled(true);\n        table = createTableDisplayer(allRows);\n        tableView = table.getView();\n        table.ready();\n        reset(tableView);\n        table.sortBy(COLUMN_ID);\n        verify(tableView).setCurrentPage(1);\n        verify(tableView).drawTable();\n        assertEquals(table.getDataSetHandler().getLastDataSet().getValueAt(0, 0), 1d);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-renderers/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-client</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-renderers</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Renderer Libraries</name>\n\n  <modules>\n    <module>dashbuilder-renderer-default</module>\n    <module>dashbuilder-renderer-chartjs</module>\n    <module>dashbuilder-renderer-c3</module>\n    <module>dashbuilder-renderer-google</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>dashbuilder-client</artifactId>\n    <groupId>org.dashbuilder</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>dashbuilder-widgets</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Widgets</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-validations</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-default</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/common/ClientRuntimeErrorPopupPresenter.java",
    "content": "package org.dashbuilder.client.widgets.common;\n\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Specializes;\nimport javax.inject.Inject;\n\n/**\n * <p>Error Popup presenter for client runtime errors.</p>\n * @since 0.4.0\n */\n@ApplicationScoped\n@Specializes\npublic class ClientRuntimeErrorPopupPresenter extends ErrorPopupPresenter {\n\n    @Inject\n    public ClientRuntimeErrorPopupPresenter(View view) {\n        super(view);\n    }\n\n    /**\n     * Shows the given message in a modal popup that appears above all other workbench contents.\n     * // TODO: Improve generated message by getting intermediate exception cause messages.\n     * @param error The client runtime error.\n     */\n    public void showMessage( final ClientRuntimeError error) {\n        StringBuilder result = new StringBuilder(DataSetExplorerConstants.INSTANCE.error());\n        \n        if (error != null) {\n            final String message = error.getMessage();\n            Throwable t = error.getRootCause();\n            String localizedMessage = t != null ? t.getLocalizedMessage() : null;\n            result = new StringBuilder(message);\n            if (localizedMessage != null) {\n                result.append(\" \").append(DataSetExplorerConstants.INSTANCE.cause()).\n                        append(\": \").append(localizedMessage);\n            }\n        }\n        \n        showMessage(result.toString());\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/common/DataSetEditorPlugin.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets.common;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\n\nimport com.google.gwt.safehtml.shared.SafeUri;\n\npublic interface DataSetEditorPlugin {\n\n    String getTypeSelectorTitle();\n    \n    String getTypeSelectorText();\n    \n    SafeUri getTypeSelectorImageUri();\n    \n    DataSetProviderType getProviderType();\n\n    Class<?> getBasicAttributesWorkflowClass();\n\n    Class<?> getWorkflowClass();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/common/LoadingBox.java",
    "content": "package org.dashbuilder.client.widgets.common;\n\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\n/**\n * <p>A loading box presenter.</p>\n *\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class LoadingBox {\n\n    public interface View {\n        void show(String message);\n        void close();\n    }\n\n    View view;\n\n    public LoadingBox() {\n    }\n\n    @Inject\n    public LoadingBox(View view) {\n        this.view = view;\n    }\n\n    public void show() {\n        view.show(DataSetEditorConstants.INSTANCE.loading());\n    }\n    \n    public void hide() {\n        view.close();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/common/LoadingBoxView.java",
    "content": "package org.dashbuilder.client.widgets.common;\n\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\n\n/**\n * <p>A loading box view using <code>org.uberfire.ext.widgets.common.client.common.BusyPopup</code>.</p>\n *\n * @since 0.8.0\n */\npublic class LoadingBoxView implements LoadingBox.View {\n\n    @Override\n    public void show(final String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void close() {\n        BusyPopup.close();\n    }\n\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefColumnsFilterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.editor.column.DataSetDefColumnsEditor;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>Data Set columns and filter editor presenter.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefColumnsFilterEditor implements IsWidget,\n                                                      org.dashbuilder.dataset.client.editor.DataSetDefColumnsFilterEditor {\n\n    public interface View extends UberView<DataSetDefColumnsFilterEditor> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(IsWidget columnsEditorView,\n                         DataSetDefFilterEditor.View dataSetFilterEditorView);\n\n        void setMaxHeight(final String maxHeight);\n    }\n\n    DataSetDefColumnsEditor columnsEditor;\n    DataSetDefFilterEditor dataSetFilterEditor;\n    public View view;\n\n    @Inject\n    public DataSetDefColumnsFilterEditor(final DataSetDefColumnsEditor columnsEditor,\n                                         final DataSetDefFilterEditor dataSetFilterEditor,\n                                         final View view) {\n        this.columnsEditor = columnsEditor;\n        this.dataSetFilterEditor = dataSetFilterEditor;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(columnsEditor.asWidget(),\n                         dataSetFilterEditor.view);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setMaxHeight(final String maxHeight) {\n        view.setMaxHeight(maxHeight);\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefColumnsEditor columnListEditor() {\n        return columnsEditor;\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefFilterEditor dataSetFilter() {\n        return dataSetFilterEditor;\n    }\n\n    @Override\n    public void setAcceptableValues(final List<DataColumnDef> acceptableValues) {\n        columnsEditor.setAcceptableValues(acceptableValues);\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetDef value) {\n        if (value != null && value.getDataSetFilter() != null) {\n            updateColumnsRestrictedByFilter(null,\n                                            value.getDataSetFilter());\n        }\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetDef> delegate) {\n\n    }\n\n    private void updateColumnsRestrictedByFilter(final DataSetFilter oldFilter,\n                                                 final DataSetFilter f) {\n        final List<String> oldFilterColumns = getFilterColumnIds(oldFilter);\n        final List<String> newFilterColumns = getFilterColumnIds(f);\n\n        // Check columns removed from filter.\n        if (!oldFilterColumns.isEmpty()) {\n            for (final String oldFilterColumn : oldFilterColumns) {\n                final boolean isRemoved = !newFilterColumns.contains(oldFilterColumn);\n                if (isRemoved) {\n                    columnsEditor.onValueUnRestricted(oldFilterColumn);\n                }\n            }\n        }\n\n        // Check columns removed from filter.\n        if (!newFilterColumns.isEmpty()) {\n            for (final String newFilterColumn : newFilterColumns) {\n                columnsEditor.onValueRestricted(newFilterColumn);\n            }\n        }\n    }\n\n    private List<String> getFilterColumnIds(final DataSetFilter filter) {\n        final List<String> result = new ArrayList<String>();\n        if (filter != null) {\n            List<ColumnFilter> columnFilters = filter.getColumnFilterList();\n            if (columnFilters != null && !columnFilters.isEmpty()) {\n                for (final ColumnFilter cFilter : columnFilters) {\n                    result.add(cFilter.getColumnId());\n                }\n            }\n        }\n        return result;\n    }\n\n    /**\n     * Listen to filter changed event in order to restrict or enable again columns used in it.\n     *\n     * @param filterChangedEvent The event.\n     */\n    void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) {\n        checkNotNull(\"filterChangedEvent\",\n                     filterChangedEvent);\n        if (filterChangedEvent.getContext().equals(dataSetFilterEditor)) {\n            final DataSetFilter old = filterChangedEvent.getOldFilter();\n            final DataSetFilter f = filterChangedEvent.getFilter();\n            updateColumnsRestrictedByFilter(old,\n                                            f);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefColumnsFilterEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TabContent;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Data Set columns and filter editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefColumnsFilterEditorView extends Composite implements DataSetDefColumnsFilterEditor.View {\n\n    \n\n    interface Binder extends UiBinder<Widget, DataSetDefColumnsFilterEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataSetDefColumnsFilterEditor presenter;\n\n    @UiField\n    TabListItem columnsTabItem;\n\n    @UiField\n    TabListItem filterTabItem;\n    \n    @UiField\n    TabContent tabContent;\n    \n    @UiField\n    TabPane columnsTabPane;\n\n    @UiField\n    TabPane filterTabPane;\n    \n    @UiField(provided = true)\n    IsWidget columnsEditorView;\n\n    @UiField(provided = true)\n    DataSetDefFilterEditor.View dataSetFilterEditorView;\n\n    @Override\n    public void init(final DataSetDefColumnsFilterEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(IsWidget columnsEditorView, DataSetDefFilterEditor.View dataSetFilterEditorView) {\n        this.columnsEditorView = columnsEditorView;\n        this.dataSetFilterEditorView = dataSetFilterEditorView;\n        initWidget(Binder.BINDER.createAndBindUi(this));   \n        columnsTabItem.setDataTargetWidget(columnsTabPane);\n        filterTabItem.setDataTargetWidget(filterTabPane);\n    }\n    \n    public void setMaxHeight(final String maxHeight) {\n        tabContent.getElement().getStyle().setProperty(\"maxHeight\", maxHeight);\n    } \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefColumnsFilterEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editors=\"urn:import:org.dashbuilder.client.widgets.dataset.editor\"\n>\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .tabContent {\n      margin-top: 10px;\n      margin-right: 10px;\n      overflow-y: auto;\n    }\n  </ui:style>\n\n  <b:TabPanel tabPosition=\"TOP\">\n\n    <b:NavTabs addStyleNames=\"nav-tabs-pf\">\n      <b:TabListItem title=\"{i18n.dataColumns}\" text=\"{i18n.dataColumns}\" ui:field=\"columnsTabItem\" active=\"true\" />\n      <b:TabListItem title=\"{i18n.filter}\" text=\"{i18n.filter}\" ui:field=\"filterTabItem\"/>\n    </b:NavTabs>\n\n    <b:TabContent ui:field=\"tabContent\" addStyleNames=\"{style.tabContent}\">\n\n      <!-- Columns tab. -->\n      <b:TabPane ui:field=\"columnsTabPane\" active=\"true\">\n        <g:IsWidget ui:field=\"columnsEditorView\"/>\n      </b:TabPane>\n\n      <!-- Filter tab. -->\n      <b:TabPane ui:field=\"filterTabPane\">\n        <editors:DataSetDefFilterEditor.View ui:field=\"dataSetFilterEditorView\"/>\n      </b:TabPane>\n\n    </b:TabContent>\n\n  </b:TabPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefFilterEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.displayer.client.events.DataSetFilterChangedEvent;\nimport org.dashbuilder.displayer.client.widgets.filter.DataSetFilterEditor;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\n/**\n * <p>Data Set filter editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataSetDefFilterEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefFilterEditor {\n    \n    public interface View extends UberView<DataSetDefFilterEditor> {\n        View setWidget(IsWidget filterView);\n    }\n    \n    Event<FilterChangedEvent> filterChangedEvent;\n    public View view;\n    DataSetFilterEditor filterEditor;\n    DataSetFilter value;\n\n    @Inject\n    public DataSetDefFilterEditor(View view, DataSetFilterEditor filterEditor, final Event<FilterChangedEvent> filterChangedEvent) {\n        this.view = view;\n        this.filterEditor = filterEditor;\n        this.filterChangedEvent = filterChangedEvent;\n        view.init(this);\n    }\n\n    @Override\n    public void init(DataSetMetadata metadata) {\n        view.setWidget(filterEditor);\n        filterEditor.init(value != null ? value.cloneInstance() : null, metadata);\n    }\n    \n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetFilter value) {\n        this.value = value != null ? value.cloneInstance() : null;\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetFilter> delegate) {\n        // No delegation required.\n    }\n\n    void onValueChanged(@Observes DataSetFilterChangedEvent event) {\n\n        // Set the new value.\n        DataSetFilter before = this.value;\n        setValue(event.getFilter());\n\n        // Fire the value change event.\n        filterChangedEvent.fire(new FilterChangedEvent(DataSetDefFilterEditor.this, before, value));\n\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefFilterEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Data Set filter editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefFilterEditorView extends Composite implements DataSetDefFilterEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetDefFilterEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataSetDefFilterEditor presenter;\n\n    @UiField\n    FlowPanel mainPanel;\n\n    @Override\n    public void init(final DataSetDefFilterEditor presenter) {\n        this.presenter = presenter;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public DataSetDefFilterEditor.View setWidget(final IsWidget filterView) {\n        mainPanel.clear();\n        mainPanel.add(filterView);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefFilterEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <g:FlowPanel ui:field=\"mainPanel\" width=\"100%\"/>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTable.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.TableDisplayerSettingsBuilder;\nimport org.dashbuilder.displayer.client.AbstractDisplayerListener;\nimport org.dashbuilder.displayer.client.DataSetEditHandler;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport java.util.Collection;\n\n/**\n * <p>Data Set table preview presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataSetDefPreviewTable implements IsWidget {\n\n    public interface View extends UberView<DataSetDefPreviewTable> {\n        \n        View setDisplayer(IsWidget widget);\n        \n        View clear();\n    }\n\n    DataSetClientServices clientServices;\n    DisplayerLocator displayerLocator;\n    public View view;\n\n    Displayer tableDisplayer;\n\n    @Inject\n    public DataSetDefPreviewTable(final DisplayerLocator displayerLocator,\n                                  final DataSetClientServices clientServices,\n                                  final View view) {\n        this.displayerLocator = displayerLocator;\n        this.clientServices = clientServices;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(final DataSetDef dataSetDef, final Collection<DataColumnDef> columns,\n                     final DisplayerListener displayerListener) {\n        clear();\n        \n        if (dataSetDef != null) {\n            \n            // Build the table displayer settings.\n            final TableDisplayerSettingsBuilder settingsBuilder = DisplayerSettingsFactory.newTableSettings()\n                    .dataset(dataSetDef.getUUID())\n                    .renderer(DefaultRenderer.UUID)\n                    .titleVisible(false)\n                    .tablePageSize(10)\n                    .resizable(true)\n                    .tableOrderEnabled(true)\n                    .tableColumnPickerEnabled(false)\n                    .filterOn(true, false, false);\n\n            // Make only the specified columns visible (if null then show all)\n            if (columns != null && !columns.isEmpty()) {\n                for (final DataColumnDef column : columns) {\n                    settingsBuilder.column(column.getId());\n                }\n            }\n\n            // Disable backend cache for preview.\n            DataSetDef editCloneWithoutCacheSettings = dataSetDef.clone();\n            editCloneWithoutCacheSettings.setCacheEnabled(false);\n\n            // Close the current displayer (if any)\n            if (tableDisplayer != null) {\n                tableDisplayer.close();\n            }\n\n            // Configure the table displayer and the data set handler for edition.\n            DisplayerSettings settings = settingsBuilder.buildSettings();\n            tableDisplayer = displayerLocator.lookupDisplayer(settings);\n            tableDisplayer.setDataSetHandler(new DataSetEditHandler(clientServices, settings.getDataSetLookup(), editCloneWithoutCacheSettings));\n\n            // For CSV datasets, make sure dates & numbers are displayed as defined in the CSV configuration\n            if (dataSetDef instanceof CSVDataSetDef) {\n                CSVDataSetDef csvDataSetDef = (CSVDataSetDef) dataSetDef;\n                tableDisplayer.addListener(new AbstractDisplayerListener() {\n\n                    // The column settings are set right after the data set load, once the dataset columns are known\n                    @Override\n                    public void onDataLoaded(Displayer displayer) {\n                        configureColumnSettings(displayer, csvDataSetDef);\n                    }\n                });\n            }\n\n            // Draw the table\n            draw(displayerListener);\n        }\n    }\n\n    protected void configureColumnSettings(Displayer displayer, CSVDataSetDef csvDataSetDef) {\n\n        DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();\n        dataSet.getColumns().stream().forEach(column -> {\n\n            if (column.getColumnType().equals(ColumnType.DATE)) {\n                String pattern = csvDataSetDef.getDatePattern(column.getId());\n                if (pattern != null) {\n                    displayer.getDisplayerSettings().setColumnValuePattern(column.getId(), pattern);\n                }\n            }\n            else if (column.getColumnType().equals(ColumnType.NUMBER)) {\n                String pattern = csvDataSetDef.getNumberPattern(column.getId());\n                if (pattern != null) {\n                    displayer.getDisplayerSettings().setColumnValuePattern(column.getId(), pattern);\n                }\n            }\n        });\n    }\n\n    // Show the table displayer.\n    void draw(final DisplayerListener displayerListener) {\n        tableDisplayer.addListener(displayerListener);\n        view.setDisplayer(tableDisplayer);\n        tableDisplayer.draw();\n    }\n    \n    public void clear() {\n        tableDisplayer = null;\n        view.clear();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTableView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Data Set table preview view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefPreviewTableView extends Composite implements DataSetDefPreviewTable.View {\n\n    interface Binder extends UiBinder<Widget, DataSetDefPreviewTableView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataSetDefPreviewTable presenter;\n\n    @UiField\n    FlowPanel mainPanel;\n\n    @UiConstructor\n    public DataSetDefPreviewTableView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n\n        // Set id for selenium tests\n        mainPanel.getElement()\n                .setId(\"ds-preview-editor-\" + Document.get().createUniqueId());\n    }\n\n    @Override\n    public void init(final DataSetDefPreviewTable presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public DataSetDefPreviewTable.View setDisplayer(final IsWidget widget) {\n        mainPanel.add(widget);\n        return this;\n    }\n\n    @Override\n    public DataSetDefPreviewTable.View clear() {\n        mainPanel.clear();\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTableView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .mainPanel {\n      margin-top: 10px;\n      width: 100%;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n    \n  </g:FlowPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefProviderTypeEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor;\n\nimport static org.dashbuilder.dataprovider.DataSetProviderType.BEAN;\nimport static org.dashbuilder.dataprovider.DataSetProviderType.CSV;\nimport static org.dashbuilder.dataprovider.DataSetProviderType.PROMETHEUS;\nimport static org.dashbuilder.dataprovider.DataSetProviderType.SQL;\nimport static org.dashbuilder.dataprovider.DataSetProviderType.KAFKA;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.client.widgets.dataset.event.DataSetDefCreationRequestEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.list.HorizImageListEditor;\nimport org.dashbuilder.common.client.editor.list.ImageListEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.resources.bundles.DataSetClientResources;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.UberView;\n\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * <p>Data Set provider type editor presenter.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefProviderTypeEditor implements IsWidget,\n                                                     org.dashbuilder.dataset.client.editor.DataSetDefProviderTypeEditor {\n\n    public interface View extends UberView<DataSetDefProviderTypeEditor> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(IsWidget listEditorView);\n    }\n\n    HorizImageListEditor<DataSetProviderType> provider;\n    Event<DataSetDefCreationRequestEvent> createEvent;\n    public View view;\n    ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n\n    @Inject\n    public DataSetDefProviderTypeEditor(final HorizImageListEditor<DataSetProviderType> provider,\n                                        final Event<DataSetDefCreationRequestEvent> createEvent,\n                                        final View view,\n                                        final ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin) {\n        this.provider = provider;\n        this.createEvent = createEvent;\n        this.view = view;\n        this.dataSetEditorPlugin = dataSetEditorPlugin;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n\n        // Initialize the acceptable values for DataSetProviderType.\n        final Collection<ImageListEditor<DataSetProviderType>.Entry> entries = getDefaultEntries();\n        provider.setEntries(entries);\n        view.initWidgets(provider.view);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    void onItemClicked(@Observes ValueChangeEvent<DataSetProviderType> event) {\n        PortablePreconditions.checkNotNull(\"ValueChangeEvent<DataSetProviderType>\",\n                                           event);\n        if (event.getContext().equals(provider)) {\n            createEvent.fire(new DataSetDefCreationRequestEvent(this,\n                                                                event.getValue()));\n        }\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public void showErrors(final List<EditorError> errors) {\n        // Defaults to no-operation. Errors are delegated to the ImageListEditor component.\n    }\n\n    @Override\n    public HorizImageListEditor<DataSetProviderType> provider() {\n        return provider;\n    }\n\n    /**\n     * The provider types supported by this editor\n     */\n    DataSetProviderType[] CORE_TYPES = new DataSetProviderType[]{BEAN, CSV, SQL, PROMETHEUS, KAFKA};\n\n    protected Collection<ImageListEditor<DataSetProviderType>.Entry> getDefaultEntries() {\n        final DataSetProviderType[] providerTypes = CORE_TYPES;\n        final Collection<ImageListEditor<DataSetProviderType>.Entry> entries = new ArrayList<>(providerTypes.length);\n        for (final DataSetProviderType type : providerTypes) {\n            final String title = getTypeSelectorTitle(type);\n            final String text = getTypeSelectorText(type);\n            final SafeUri uri = getTypeSelectorImageUri(type);\n            final ImageListEditor<DataSetProviderType>.Entry entry = provider.newEntry(type,\n                                                                                       uri,\n                                                                                       new SafeHtmlBuilder().appendEscaped(title).toSafeHtml(),\n                                                                                       new SafeHtmlBuilder().appendEscaped(text).toSafeHtml());\n            entries.add(entry);\n        }  \n        \n        if (!dataSetEditorPlugin.isUnsatisfied()) {\n            \n            for (DataSetEditorPlugin pluginEditor : dataSetEditorPlugin) {\n                final String title = pluginEditor.getTypeSelectorTitle();\n                final String text = pluginEditor.getTypeSelectorText();\n                final SafeUri uri = pluginEditor.getTypeSelectorImageUri();\n                final ImageListEditor<DataSetProviderType>.Entry entry = provider.newEntry(pluginEditor.getProviderType(),\n                                                                                           uri,\n                                                                                           new SafeHtmlBuilder().appendEscaped(title).toSafeHtml(),\n                                                                                           new SafeHtmlBuilder().appendEscaped(text).toSafeHtml());\n                entries.add(entry);\n            }\n        }\n        \n        return entries;\n    }\n\n    String getTypeSelectorTitle(final DataSetProviderType type) {\n        if (BEAN.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.bean();\n        }\n        if (CSV.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.csv();\n        }\n        if (SQL.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.sql();\n        }\n        if (PROMETHEUS.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.prometheus();\n        }\n        if (KAFKA.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.kafka();\n        }\n        return null;\n    }\n\n    String getTypeSelectorText(final DataSetProviderType type) {\n        if (BEAN.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.bean_description();\n        }\n        if (CSV.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.csv_description();\n        }\n        if (SQL.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.sql_description();\n        }\n        if (PROMETHEUS.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.prometheus_description();\n        }\n        if (KAFKA.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.kafka_description();\n        }\n        return null;\n    }\n\n    SafeUri getTypeSelectorImageUri(final DataSetProviderType type) {\n        if (BEAN.equals(type)) {\n            return DataSetClientResources.INSTANCE.images().javaIcon160().getSafeUri();\n        }\n        if (CSV.equals(type)) {\n            return DataSetClientResources.INSTANCE.images().csvIcon160().getSafeUri();\n        }\n        if (SQL.equals(type)) {\n            return DataSetClientResources.INSTANCE.images().sqlIcon160().getSafeUri();\n        }\n        if (PROMETHEUS.equals(type)) {\n            return DataSetClientResources.INSTANCE.images().prometheusIcon160().getSafeUri();\n        }\n        if (KAFKA.equals(type)) {\n            return DataSetClientResources.INSTANCE.images().kafkaIcon160().getSafeUri();\n        }    \n        return null;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefProviderTypeEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set provider type editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefProviderTypeEditorView extends Composite implements DataSetDefProviderTypeEditor.View {\n\n    \n    interface Binder extends UiBinder<Widget, DataSetDefProviderTypeEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n    \n    @UiField(provided = true)\n    IsWidget listEditorView;\n    \n    DataSetDefProviderTypeEditor presenter;\n\n    @Override\n    public void init(final DataSetDefProviderTypeEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final IsWidget listEditorView) {\n        this.listEditorView = listEditorView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefProviderTypeEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n  \n  <ui:style>\n    \n  </ui:style>\n\n  <b:Container fluid=\"true\">\n    \n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <g:VerticalPanel width=\"100%\">\n          <g:HTML text=\"{i18n.selectType}:\"/>\n          <g:IsWidget ui:field=\"listEditorView\"/>\n        </g:VerticalPanel>\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.*;\nimport org.dashbuilder.client.widgets.dataset.event.ColumnsChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.DataSetDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.displayer.client.AbstractDisplayerListener;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport java.util.List;\n\nimport static org.dashbuilder.dataprovider.DataSetProviderType.*;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>Data Set Editor presenter.</p>\n *\n * @since 0.4.0\n */\npublic abstract class DataSetEditor<T extends DataSetDef> implements IsWidget,\n                                                                     DataSetDefEditor<T> {\n\n    public static final String TAB_CONFIGURATION = \"configuration\";\n    public static final String TAB_PREVIEW = \"preview\";\n    public static final String TAB_ADVANCED = \"advanced\";\n\n    public interface View extends UberView<DataSetEditor> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(DataSetDefBasicAttributesEditor.View basicAttributesEditorView,\n                         IsWidget providerAttributesEditorView,\n                         DataSetDefColumnsFilterEditor.View columnsAndFilterEditorView,\n                         DataSetDefPreviewTable.View previewTableView,\n                         DataSetDefCacheAttributesEditorView backendCacheAttributesEditorView,\n                         DataSetDefCacheAttributesEditorView clientCacheAttributesEditorView,\n                         DataSetDefRefreshAttributesEditor.View refreshEditorView);\n\n        void setConfigurationTabTitle(String title);\n\n        void showConfigurationTab();\n\n        void addConfigurationTabItemClickHandler(final Command command);\n\n        void showPreviewTab();\n\n        void addPreviewTabItemClickHandler(final Command command);\n\n        void showAdvancedTab();\n\n        void addAdvancedTabItemClickHandler(final Command command);\n\n        void openColumnsFilterPanel(String title);\n\n        void closeColumnsFilterPanel(String title);\n\n        void showErrorNotification(final SafeHtml text);\n\n        void clearErrorNotification();\n    }\n\n    protected DataSetDefBasicAttributesEditor basicAttributesEditor;\n    protected IsWidget providerAttributesEditorView;\n    protected DataSetDefColumnsFilterEditor columnsAndFilterEditor;\n    protected DataSetDefPreviewTable previewTable;\n    protected DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor;\n    protected DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor;\n    private DataSetDefRefreshAttributesEditor refreshEditor;\n    protected DataSetClientServices clientServices;\n    protected LoadingBox loadingBox;\n    protected Event<ErrorEvent> errorEvent;\n    protected Event<TabChangedEvent> tabChangedEvent;\n\n    /* The Data Set Editor view. */\n    public View view;\n    protected DataSetDef dataSetDef;\n    protected Command afterPreviewCommand;\n\n    @Inject\n    public DataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                         final IsWidget providerAttributesEditorView,\n                         final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                         final DataSetDefPreviewTable previewTable,\n                         final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                         final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                         final DataSetDefRefreshAttributesEditor refreshEditor,\n                         final DataSetClientServices clientServices,\n                         final LoadingBox loadingBox,\n                         final Event<ErrorEvent> errorEvent,\n                         final Event<TabChangedEvent> tabChangedEvent,\n                         final View view) {\n        this.basicAttributesEditor = basicAttributesEditor;\n        this.providerAttributesEditorView = providerAttributesEditorView;\n        this.columnsAndFilterEditor = columnsAndFilterEditor;\n        this.previewTable = previewTable;\n        this.backendCacheAttributesEditor = backendCacheAttributesEditor;\n        this.clientCacheAttributesEditor = clientCacheAttributesEditor;\n        this.refreshEditor = refreshEditor;\n        this.clientServices = clientServices;\n        this.loadingBox = loadingBox;\n        this.errorEvent = errorEvent;\n        this.tabChangedEvent = tabChangedEvent;\n        this.view = view;\n    }\n\n    public void init() {\n        view.init(this);\n        view.initWidgets(basicAttributesEditor.view,\n                         providerAttributesEditorView,\n                         columnsAndFilterEditor.view,\n                         previewTable.view,\n                         backendCacheAttributesEditor.view,\n                         clientCacheAttributesEditor.view,\n                         refreshEditor.view);\n        view.addConfigurationTabItemClickHandler(configurationTabItemClickHandler);\n        view.addPreviewTabItemClickHandler(previewTabItemClickHandler);\n        view.addAdvancedTabItemClickHandler(advancedTabItemClickHandler);\n        columnsAndFilterEditor.setMaxHeight(\"400px\");\n        backendCacheAttributesEditor.setRange(200d,\n                                              10000d);\n        clientCacheAttributesEditor.setRange(00d,\n                                             4096d);\n    }\n\n    /*************************************************************\n     ** PUBLIC EDITOR METHODS **\n     *************************************************************/\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void showConfigurationTab() {\n        afterPreviewCommand = new Command() {\n            @Override\n            public void execute() {\n                view.showConfigurationTab();\n            }\n        };\n    }\n\n    public void showPreviewTab() {\n        afterPreviewCommand = new Command() {\n            @Override\n            public void execute() {\n                view.showPreviewTab();\n            }\n        };\n    }\n\n    public void showAdvancedTab() {\n        afterPreviewCommand = new Command() {\n            @Override\n            public void execute() {\n                view.showAdvancedTab();\n            }\n        };\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public void setAcceptableValues(final List<DataColumnDef> acceptableValues) {\n        columnsAndFilterEditor.setAcceptableValues(acceptableValues);\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final T value) {\n        this.dataSetDef = value;\n\n        // Check specific provider type constraints.\n        final DataSetProviderType type = value.getProvider() != null ? value.getProvider() : null;\n        final String typeTitle = getTypeTitle(type);\n        view.setConfigurationTabTitle(new StringBuffer(typeTitle).append(\" \")\n                                              .append(DataSetEditorConstants.INSTANCE.tab_configguration()).toString());\n\n        final boolean isBean = type != null && DataSetProviderType.BEAN.equals(type);\n        if (isBean) {\n            // Bean data sets do not support backend cache, its used by its own nature...\n            backendCacheAttributesEditor = null;\n        }\n\n        // Load the preview table and update filter editor when having the resulting data set.\n        doPreview(true);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<T> delegate) {\n        // No delegation required.\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor basicAttributesEditor() {\n        return basicAttributesEditor;\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefColumnsFilterEditor columnsAndFilterEditor() {\n        return columnsAndFilterEditor;\n    }\n\n    @Override\n    public DataSetDefBackendCacheAttributesEditor backendCacheEditor() {\n        return backendCacheAttributesEditor;\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefClientCacheAttributesEditor clientCacheEditor() {\n        return clientCacheAttributesEditor;\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor refreshEditor() {\n        return refreshEditor;\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n\n    void onOpenColumnsFilterPanel() {\n        view.openColumnsFilterPanel(DataSetEditorConstants.INSTANCE.hideColumnsAndFilter());\n    }\n\n    void onCloseColumnsFilterPanel() {\n        view.closeColumnsFilterPanel(DataSetEditorConstants.INSTANCE.showColumnsAndFilter());\n    }\n\n    /*************************************************************\n     ** PRIVATE EDITOR METHODS **\n     *************************************************************/\n\n    protected void doPreview(final boolean isUpdateFilter) {\n        loadingBox.show();\n        previewTable.show(dataSetDef,\n                          dataSetDef.getColumns(),\n                          new DataSetEditorListener(isUpdateFilter));\n    }\n\n    protected void afterPreview(final DataSet dataSet,\n                                final boolean isUpdateFilter) {\n        view.clearErrorNotification();\n        if (isUpdateFilter) {\n            columnsAndFilterEditor.dataSetFilter().init(dataSet.getMetadata());\n        }\n        if (afterPreviewCommand != null) {\n            afterPreviewCommand.execute();\n            afterPreviewCommand = null;\n        }\n        loadingBox.hide();\n    }\n\n    private class DataSetEditorListener extends AbstractDisplayerListener {\n\n        private boolean isUpdateFilter;\n\n        public DataSetEditorListener(final boolean isUpdateFilter) {\n            this.isUpdateFilter = isUpdateFilter;\n        }\n\n        @Override\n        public void onDraw(final Displayer displayer) {\n            final DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();\n            afterPreview(dataSet,\n                         isUpdateFilter);\n        }\n\n        @Override\n        public void onRedraw(final Displayer displayer) {\n            final DataSet dataSet = displayer.getDataSetHandler().getLastDataSet();\n            afterPreview(dataSet,\n                         isUpdateFilter);\n        }\n\n        @Override\n        public void onClose(final Displayer displayer) {\n            loadingBox.hide();\n        }\n\n        @Override\n        public void onError(final Displayer displayer,\n                            final ClientRuntimeError error) {\n            showError(error);\n        }\n    }\n\n    protected void showError(final ClientRuntimeError error) {\n        loadingBox.hide();\n        final String message = error.getCause() != null ? error.getCause() : error.getMessage();\n        view.showErrorNotification(new SafeHtmlBuilder().appendEscaped(message).toSafeHtml());\n        errorEvent.fire(new ErrorEvent(this,\n                                       error));\n\n        if (afterPreviewCommand != null) {\n            this.afterPreviewCommand.execute();\n        }\n    }\n\n    private String getTypeTitle(final DataSetProviderType type) {\n        if (BEAN.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.bean();\n        }\n        if (CSV.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.csv();\n        }\n        if (SQL.equals(type)) {\n            return DataSetEditorConstants.INSTANCE.sql();\n        }\n        return \"\";\n    }\n\n    protected final Command configurationTabItemClickHandler = new Command() {\n        @Override\n        public void execute() {\n            tabChangedEvent.fire(new TabChangedEvent(DataSetEditor.this,\n                                                     TAB_CONFIGURATION));\n        }\n    };\n\n    protected final Command previewTabItemClickHandler = new Command() {\n        @Override\n        public void execute() {\n            tabChangedEvent.fire(new TabChangedEvent(DataSetEditor.this,\n                                                     TAB_PREVIEW));\n        }\n    };\n\n    protected final Command advancedTabItemClickHandler = new Command() {\n        @Override\n        public void execute() {\n            tabChangedEvent.fire(new TabChangedEvent(DataSetEditor.this,\n                                                     TAB_ADVANCED));\n        }\n    };\n\n    void onColumnsChangedEvent(@Observes ColumnsChangedEvent columnsChangedEvent) {\n        checkNotNull(\"columnsChangedEvent\",\n                     columnsChangedEvent);\n        if (columnsChangedEvent.getContext().equals(columnsAndFilterEditor.columnListEditor().columns())) {\n            final List<DataColumnDef> cols = columnsChangedEvent.getColumns();\n            dataSetDef.setColumns(cols);\n            doPreview(true);\n        }\n    }\n\n    void onFilterChangedEvent(@Observes FilterChangedEvent filterChangedEvent) {\n        checkNotNull(\"filterChangedEvent\",\n                     filterChangedEvent);\n        if (filterChangedEvent.getContext().equals(columnsAndFilterEditor.dataSetFilter())) {\n            final DataSetFilter f = filterChangedEvent.getFilter();\n            dataSetDef.setDataSetFilter(f);\n            // Do not update filter, as the component status has been already updated by the user interaction.\n            doPreview(false);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.*;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.*;\nimport org.gwtbootstrap3.client.ui.Alert;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set Editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetEditorView extends Composite implements DataSetEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n    \n    DataSetEditor presenter;\n\n    @UiField\n    TabListItem basicAttributesTabItem;\n\n    @UiField\n    TabListItem previewTabItem;\n\n    @UiField\n    TabListItem advancedAttributesTabItem;\n    \n    @UiField\n    TabPane basicAttributesTabPane;\n\n    @UiField\n    TabPane previewTabPane;\n\n    @UiField\n    DisclosurePanel filterAndColumnsPanel;\n    \n    @UiField\n    Button filterAndColumnsPanelToggleButton;\n    \n    @UiField\n    TabPane advancedAttributesTabPane;\n    \n    @UiField(provided = true)\n    DataSetDefBasicAttributesEditor.View basicAttributesEditorView;\n    \n    @UiField(provided = true)\n    IsWidget providerAttributesEditorView;\n\n    @UiField(provided = true)\n    DataSetDefColumnsFilterEditor.View columnsAndFilterEditorView;\n\n    @UiField\n    FlowPanel previewTablePanel;\n    \n    @UiField(provided = true)\n    DataSetDefPreviewTable.View previewTableView;\n\n    @UiField\n    Alert previewErrorNotification;\n    \n    @UiField\n    Text notificationLabel;\n    \n    @UiField(provided = true)\n    DataSetDefCacheAttributesEditorView backendCacheAttributesEditorView;\n\n    @UiField(provided = true)\n    DataSetDefCacheAttributesEditorView clientCacheAttributesEditorView;\n    \n    @UiField(provided = true)\n    DataSetDefRefreshAttributesEditor.View refreshEditorView;\n    \n    @Override\n    public void init(final DataSetEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final DataSetDefBasicAttributesEditor.View basicAttributesEditorView,\n                            final IsWidget providerAttributesEditorView,\n                            final DataSetDefColumnsFilterEditor.View columnsAndFilterEditorView,\n                            final DataSetDefPreviewTable.View previewTableView,\n                            final DataSetDefCacheAttributesEditorView backendCacheAttributesEditorView,\n                            final DataSetDefCacheAttributesEditorView clientCacheAttributesEditorView,\n                            final DataSetDefRefreshAttributesEditor.View refreshEditorView) {\n        this.basicAttributesEditorView = basicAttributesEditorView;\n        this.providerAttributesEditorView = providerAttributesEditorView;\n        this.columnsAndFilterEditorView = columnsAndFilterEditorView;\n        this.previewTableView = previewTableView;\n        this.backendCacheAttributesEditorView = backendCacheAttributesEditorView;\n        this.clientCacheAttributesEditorView = clientCacheAttributesEditorView;\n        this.refreshEditorView = refreshEditorView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        basicAttributesTabItem.setDataTargetWidget(basicAttributesTabPane);\n        previewTabItem.setDataTargetWidget(previewTabPane);\n        advancedAttributesTabItem.setDataTargetWidget(advancedAttributesTabPane);\n        filterAndColumnsPanel.addOpenHandler(new OpenHandler<DisclosurePanel>() {\n            @Override\n            public void onOpen(final OpenEvent<DisclosurePanel> event) {\n                presenter.onOpenColumnsFilterPanel();\n            }\n        });\n        filterAndColumnsPanel.addCloseHandler(new CloseHandler<DisclosurePanel>() {\n            @Override\n            public void onClose(final CloseEvent<DisclosurePanel> event) {\n                presenter.onCloseColumnsFilterPanel();\n            }\n        });\n    }\n\n    @Override\n    public void setConfigurationTabTitle(String title) {\n        basicAttributesTabItem.setText(title);\n        basicAttributesTabItem.setTitle(title);\n    }\n\n    @Override\n    public void showConfigurationTab() {\n        basicAttributesTabItem.showTab();\n    }\n\n    @Override\n    public void showPreviewTab() {\n        previewTabItem.showTab();\n    }\n\n    @Override\n    public void addPreviewTabItemClickHandler(final Command command) {\n        previewTabItem.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void showAdvancedTab() {\n        advancedAttributesTabItem.showTab();\n    }\n\n    @Override\n    public void addAdvancedTabItemClickHandler(final Command command) {\n        advancedAttributesTabItem.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void openColumnsFilterPanel(final String title) {\n        filterAndColumnsPanelToggleButton.setTitle(title);\n        filterAndColumnsPanelToggleButton.setIcon(IconType.STEP_BACKWARD);\n        filterAndColumnsPanelToggleButton.getElement().getStyle().setBorderStyle(Style.BorderStyle.SOLID);\n    }\n\n    @Override\n    public void closeColumnsFilterPanel(final String title) {\n        filterAndColumnsPanelToggleButton.setTitle(title);\n        filterAndColumnsPanelToggleButton.setIcon(IconType.STEP_FORWARD);\n        filterAndColumnsPanelToggleButton.getElement().getStyle().setBorderStyle(Style.BorderStyle.NONE);\n    }\n\n    public void addConfigurationTabItemClickHandler(final Command command) {\n        basicAttributesTabItem.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                command.execute();\n            }\n        });\n    }\n\n    public void showErrorNotification(final SafeHtml text) {\n        notificationLabel.setText(text.asString());\n        previewErrorNotification.setVisible(true);\n        filterAndColumnsPanel.setVisible(false);\n        previewTablePanel.setVisible(false);\n    }\n\n    public void clearErrorNotification() {\n        notificationLabel.setText(\"\");\n        previewErrorNotification.setVisible(false);\n        filterAndColumnsPanel.setVisible(true);\n        previewTablePanel.setVisible(true);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/DataSetEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bhtml=\"urn:import:org.gwtbootstrap3.client.ui.html\"\n             xmlns:editors=\"urn:import:org.dashbuilder.client.widgets.dataset.editor\"\n             xmlns:editors.attrs=\"urn:import:org.dashbuilder.client.widgets.dataset.editor.attributes\">\n  \n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n  \n  <ui:style>\n    .mainPanel {\n      width: 100%;\n      margin: 20px;\n    }\n    .tabPane {\n      margin-top: 25px;\n    }\n    .editorPanel {\n      width: 100%;\n    }\n    .filterAndColumnsPanel {\n      float: left;\n      margin-right: 20px;\n    }\n    .filterAndColumnsPanelToggleButton {\n      position: absolute;\n      left: 25px;\n      color: black;\n      filter: alpha(opacity=5);\n      opacity: 0.5;\n    }\n    .tablePreviewPanel {\n      margin-left: 40px;\n      height: 100%;\n      max-height: 450px;\n      overflow: auto;\n    }\n    .previewErrorAlert {\n      margin-top: 20px;\n    }\n  </ui:style>\n  \n  <g:FlowPanel addStyleNames=\"{style.mainPanel}\">\n\n    <b:NavTabs>\n      <b:TabListItem ui:field=\"basicAttributesTabItem\" text=\"{i18n.tab_configguration}\" title=\"{i18n.tab_configguration}\" active=\"true\" />\n      <b:TabListItem ui:field=\"previewTabItem\" text=\"{i18n.tab_preview}\" title=\"{i18n.tab_preview}\"/>\n      <b:TabListItem ui:field=\"advancedAttributesTabItem\" text=\"{i18n.tab_advancedConfiguration}\" title=\"{i18n.tab_advancedConfiguration}\"/>\n    </b:NavTabs>\n\n    <b:TabContent>\n\n      <!-- Configuration tab. -->\n      <b:TabPane ui:field=\"basicAttributesTabPane\" active=\"true\" addStyleNames=\"{style.tabPane}\">\n        \n        <g:FlowPanel addStyleNames=\"{style.editorPanel}\">\n          <editors.attrs:DataSetDefBasicAttributesEditor.View ui:field=\"basicAttributesEditorView\"/>\n        </g:FlowPanel>\n        \n        <g:FlowPanel addStyleNames=\"{style.editorPanel}\">\n          <g:IsWidget ui:field=\"providerAttributesEditorView\"/>\n        </g:FlowPanel>\n        \n      </b:TabPane>\n\n      <!-- Preview tab. -->\n      <b:TabPane ui:field=\"previewTabPane\">\n\n        <!-- Using a disclosure panel so this panel can be collapsed to allow full witdh table preview. -->\n        <g:DisclosurePanel ui:field=\"filterAndColumnsPanel\" open=\"true\" addStyleNames=\"{style.filterAndColumnsPanel}\">\n          \n          <g:customHeader>\n            <b:Button icon=\"STEP_BACKWARD\" type=\"LINK\" size=\"LARGE\" ui:field=\"filterAndColumnsPanelToggleButton\" \n                      title=\"{i18n.hideColumnsAndFilter}\" addStyleNames=\"{style.filterAndColumnsPanelToggleButton} \"/>\n          </g:customHeader>\n\n          <g:FlowPanel addStyleNames=\"{style.editorPanel} {style.filterAndColumnsPanel}\">\n            <editors:DataSetDefColumnsFilterEditor.View ui:field=\"columnsAndFilterEditorView\"/>\n          </g:FlowPanel>\n          \n        </g:DisclosurePanel>\n\n        <g:FlowPanel ui:field=\"previewTablePanel\" addStyleNames=\"{style.tablePreviewPanel}\">\n          <editors:DataSetDefPreviewTable.View ui:field=\"previewTableView\"/>\n        </g:FlowPanel>\n\n        <b:Alert ui:field=\"previewErrorNotification\" type=\"DANGER\" dismissable=\"false\" visible=\"false\"\n                 addStyleNames=\"{style.previewErrorAlert}\">\n          <b:Icon type=\"EXCLAMATION_TRIANGLE\" marginRight=\"10\"/>\n          <bhtml:Text ui:field=\"notificationLabel\"/>\n        </b:Alert>\n        \n      </b:TabPane>\n\n      <!-- Preview tab. -->\n      <b:TabPane ui:field=\"advancedAttributesTabPane\" addStyleNames=\"{style.tabPane}\">\n\n        <g:FlowPanel addStyleNames=\"{style.editorPanel}\">\n          <editors.attrs:DataSetDefCacheAttributesEditorView ui:field=\"clientCacheAttributesEditorView\"/>\n        </g:FlowPanel>\n        \n        <g:FlowPanel addStyleNames=\"{style.editorPanel}\">\n          <editors.attrs:DataSetDefCacheAttributesEditorView ui:field=\"backendCacheAttributesEditorView\"/>\n        </g:FlowPanel>\n\n        <g:FlowPanel addStyleNames=\"{style.editorPanel}\">\n          <editors.attrs:DataSetDefRefreshAttributesEditor.View ui:field=\"refreshEditorView\"/>\n        </g:FlowPanel>\n\n      </b:TabPane>\n      \n    </b:TabContent>\n    \n  </g:FlowPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBackendCacheAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>Data Set backend cache attributes editor presenter.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefBackendCacheAttributesEditor implements IsWidget,\n                                                               org.dashbuilder.dataset.client.editor.DataSetDefBackendCacheAttributesEditor {\n\n    ToggleSwitchEditor cacheEnabled;\n    ValueBoxEditor<Integer> cacheMaxRows;\n    public DataSetDefCacheAttributesEditorView view;\n\n    @Inject\n    public DataSetDefBackendCacheAttributesEditor(final ToggleSwitchEditor cacheEnabled,\n                                                  final ValueBoxEditor<Integer> cacheMaxRows,\n                                                  final DataSetDefCacheAttributesEditorView view) {\n        this.cacheEnabled = cacheEnabled;\n        this.cacheMaxRows = cacheMaxRows;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(viewCallback);\n        view.init(DataSetEditorConstants.INSTANCE.backendCache(),\n                  DataSetEditorConstants.INSTANCE.rows(),\n                  cacheEnabled.asWidget(),\n                  cacheMaxRows.view);\n        cacheMaxRows.addHelpContent(DataSetEditorConstants.INSTANCE.attributeMaxRows(),\n                                    DataSetEditorConstants.INSTANCE.attributeMaxRows_description(),\n                                    Placement.BOTTOM);\n    }\n\n    public void setRange(final Double min,\n                         final Double max) {\n        view.setRange(min,\n                      max);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ToggleSwitchEditor cacheEnabled() {\n        return cacheEnabled;\n    }\n\n    @Override\n    public ValueBoxEditor<Integer> cacheMaxRows() {\n        return cacheMaxRows;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetDef value) {\n        Double _value = value != null ? value.getCacheMaxRows() : 100d;\n        if (value != null && value.isCacheEnabled()) {\n            enable();\n        } else {\n            disable();\n        }\n        view.setValue(_value);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetDef> delegate) {\n\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n\n    final DataSetDefCacheAttributesEditorView.ViewCallback viewCallback = new DataSetDefCacheAttributesEditorView.ViewCallback() {\n        @Override\n        public void onValueChange(final Double value) {\n            cacheMaxRows.setValue(value != null ? value.intValue() : 100);\n        }\n    };\n\n    /*************************************************************\n     ** PRIVATE PRESENTER METHODS **\n     *************************************************************/\n\n    void enable() {\n        view.setEnabled(true);\n    }\n\n    void disable() {\n        view.setEnabled(false);\n    }\n\n    void onEnabledChangedEvent(@Observes ValueChangeEvent<Boolean> valueChangeEvent) {\n        checkNotNull(\"valueChangeEvent\",\n                     valueChangeEvent);\n        if (valueChangeEvent.getContext().equals(cacheEnabled)) {\n            if (valueChangeEvent.getValue()) {\n                enable();\n            } else {\n                disable();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBasicAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>Data Set basic attributes (uuid, name) editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataSetDefBasicAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor {\n\n    public interface View extends UberView<DataSetDefBasicAttributesEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View uuidEditor, ValueBoxEditor.View nameEditor);\n    }\n    \n    ValueBoxEditor<String> uuidEditor;\n    ValueBoxEditor<String> nameEditor;\n    public View view;\n\n    @Inject\n    public DataSetDefBasicAttributesEditor(final ValueBoxEditor<String> uuidEditor,\n                                           final ValueBoxEditor<String> nameEditor,\n                                           final View view) {\n        this.uuidEditor = uuidEditor;\n        this.nameEditor = nameEditor;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(uuidEditor.view, nameEditor.view);\n        uuidEditor.addHelpContent(DataSetEditorConstants.INSTANCE.attributeUUID(),\n                DataSetEditorConstants.INSTANCE.attributeUUID_description(),\n                Placement.BOTTOM);\n        nameEditor.addHelpContent(DataSetEditorConstants.INSTANCE.attributeName(),\n                DataSetEditorConstants.INSTANCE.attributeName_description(),\n                Placement.BOTTOM);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    \n    /*************************************************************\n            ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ValueBoxEditor<String> UUID() {\n        return uuidEditor;\n    }\n\n    @Override\n    public ValueBoxEditor<String> name() {\n        return nameEditor;\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBasicAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set Editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefBasicAttributesEditorView extends Composite implements DataSetDefBasicAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetDefBasicAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataSetDefBasicAttributesEditor presenter;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View uuid;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View name;\n\n    @Override\n    public void init(final DataSetDefBasicAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final ValueBoxEditor.View uuidEditor, final ValueBoxEditor.View nameEditor) {\n        this.uuid = uuidEditor;\n        this.name = nameEditor;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBasicAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .row {\n      margin-bottom: 5px;\n    }\n    .attr {\n      float: left;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <!-- UUID. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.attributeUUID}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.attributeUUID_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"uuid\">\n          <editor:valuebox>\n            <b:TextBox enabled=\"false\" allowBlank=\"false\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Name. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.attributeName}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.attributeName_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"name\">\n          <editor:valuebox>\n            <b:TextBox placeholder=\"{i18n.attributeName}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefCacheAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * <p>The Data Set cache attributes editor view.</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefCacheAttributesEditorView extends UberView<DataSetDefCacheAttributesEditorView.ViewCallback> {\n    \n    interface ViewCallback {\n        void onValueChange(Double value);\n    }\n\n    /**\n     * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n     */\n    void init(String title, String units, IsWidget enabledView, ValueBoxEditor.View valueView);\n\n    void setValue(final Double value);\n\n    void setRange(Double min, Double max);\n\n    void setEnabled(final boolean isEnabled);\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefCacheAttributesEditorViewImpl.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.gwtbootstrap3.client.ui.IntegerBox;\nimport org.gwtbootstrap3.extras.slider.client.ui.Slider;\nimport org.gwtbootstrap3.extras.slider.client.ui.base.event.SlideStopEvent;\nimport org.gwtbootstrap3.extras.slider.client.ui.base.event.SlideStopHandler;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set cache attributes editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefCacheAttributesEditorViewImpl extends Composite implements DataSetDefCacheAttributesEditorView {\n\n    interface Binder extends UiBinder<Widget, DataSetDefCacheAttributesEditorViewImpl> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    ViewCallback callback;\n\n    @UiField\n    Container mainContainer;\n    \n    @UiField(provided = true)\n    IsWidget enabledView;\n\n    @UiField\n    HTML title;\n    \n    @UiField(provided = true)\n    ValueBoxEditor.View valueView;\n\n    @UiField\n    IntegerBox valueBox;\n    \n    @UiField\n    HTML units;\n    \n    @UiField\n    Slider slider;\n    \n    @Override\n    public void init(final ViewCallback callback) {\n        this.callback = callback;\n    }\n\n    @Override\n    public void init(final String title, final String units, final IsWidget enabledView, final ValueBoxEditor.View valueView) {\n        this.enabledView = enabledView;\n        this.valueView = valueView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        this.units.setText(units);\n        this.units.setTitle(units);\n        this.title.setText(title);\n        slider.addSlideStopHandler(new SlideStopHandler<Double>() {\n            @Override\n            public void onSlideStop(final SlideStopEvent<Double> event) {\n                // NOTE: Parse double from string value to avoid https://github.com/gwtbootstrap3/gwtbootstrap3-extras/issues/169\n                final Object value = event.getValue();\n                final Double _v = Double.parseDouble(value.toString());\n                callback.onValueChange(_v);\n            }\n        });\n    }\n    \n    public void setEnabled(final boolean isEnabled) {\n        valueBox.setEnabled(isEnabled);\n        slider.setEnabled(isEnabled);\n    }\n\n    public void setValue(final Double value) {\n        mainContainer.setVisible(true);\n        slider.setValue(value);\n    }\n\n    @Override\n    public void setRange(final Double min, final Double max) {\n        slider.setMin(min);\n        slider.setMax(max);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefCacheAttributesEditorViewImpl.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n             xmlns:b3=\"urn:import:org.gwtbootstrap3.extras.slider.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .valueBox {\n        width: 50px;\n    }\n    .inlineText {\n      margin-left: 10px;\n    }\n  </ui:style>\n\n  <b:Container ui:field=\"mainContainer\" fluid=\"true\" visible=\"false\">\n    <b:Row>\n\n      <!-- Cache enabled. -->\n      <b:Column size=\"MD_3\">\n        <g:HorizontalPanel verticalAlignment=\"ALIGN_MIDDLE\">\n          <g:IsWidget ui:field=\"enabledView\" />\n          <g:HTML ui:field=\"title\" addStyleNames=\"{style.inlineText}\"/>\n        </g:HorizontalPanel>\n      </b:Column>\n\n      <b:Column size=\"MD_2\">\n        <g:HorizontalPanel verticalAlignment=\"ALIGN_MIDDLE\">\n          <editor:ValueBoxEditor.View ui:field=\"valueView\">\n            <editor:valuebox>\n              <b:IntegerBox ui:field=\"valueBox\" stylePrimaryName=\"form-control\" addStyleNames=\"{style.valueBox}\"/>\n            </editor:valuebox>\n          </editor:ValueBoxEditor.View>\n          <g:HTML ui:field=\"units\" addStyleNames=\"{style.inlineText}\"/>\n        </g:HorizontalPanel>\n      </b:Column>\n\n      <b:Column size=\"MD_7\">\n        <b3:Slider ui:field=\"slider\" max=\"10\" min=\"1\" value=\"0\" step=\"1\" addStyleNames=\"{style.inlineText}\"/>\n      </b:Column>\n      \n    </b:Row>\n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefClientCacheAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>Data Set client cache attributes editor presenter.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefClientCacheAttributesEditor implements IsWidget,\n                                                              org.dashbuilder.dataset.client.editor.DataSetDefClientCacheAttributesEditor {\n\n    ToggleSwitchEditor pushEnabled;\n    ValueBoxEditor<Integer> pushMaxSize;\n    public DataSetDefCacheAttributesEditorView view;\n\n    @Inject\n    public DataSetDefClientCacheAttributesEditor(final ToggleSwitchEditor pushEnabled,\n                                                 final ValueBoxEditor<Integer> pushMaxSize,\n                                                 final DataSetDefCacheAttributesEditorView view) {\n        this.pushEnabled = pushEnabled;\n        this.pushMaxSize = pushMaxSize;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(viewCallback);\n        view.init(DataSetEditorConstants.INSTANCE.clientCache(),\n                  DataSetEditorConstants.INSTANCE.bytes(),\n                  pushEnabled.asWidget(),\n                  pushMaxSize.view);\n        pushMaxSize.addHelpContent(DataSetEditorConstants.INSTANCE.attributeMaxBytes(),\n                                   DataSetEditorConstants.INSTANCE.attributeMaxBytes_description(),\n                                   Placement.BOTTOM);\n    }\n\n    public void setRange(final Double min,\n                         final Double max) {\n        view.setRange(min,\n                      max);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ToggleSwitchEditor pushEnabled() {\n        return pushEnabled;\n    }\n\n    @Override\n    public ValueBoxEditor<Integer> pushMaxSize() {\n        return pushMaxSize;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetDef value) {\n        Double _value = value != null ? value.getPushMaxSize() : 100d;\n        if (value != null && value.isPushEnabled()) {\n            enable();\n        } else {\n            disable();\n        }\n        view.setValue(_value);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetDef> delegate) {\n\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n\n    final DataSetDefCacheAttributesEditorView.ViewCallback viewCallback = new DataSetDefCacheAttributesEditorView.ViewCallback() {\n        @Override\n        public void onValueChange(Double value) {\n            pushMaxSize.setValue(value != null ? value.intValue() : 100);\n        }\n    };\n\n    /*************************************************************\n     ** PRIVATE PRESENTER METHODS **\n     *************************************************************/\n\n    void enable() {\n        view.setEnabled(true);\n    }\n\n    void disable() {\n        view.setEnabled(false);\n    }\n\n    void onEnabledChangedEvent(@Observes ValueChangeEvent<Boolean> valueChangeEvent) {\n        checkNotNull(\"valueChangeEvent\",\n                     valueChangeEvent);\n        if (valueChangeEvent.getContext().equals(pushEnabled)) {\n            if (valueChangeEvent.getValue()) {\n                enable();\n            } else {\n                disable();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>Data Set refresh attributes editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataSetDefRefreshAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor {\n\n    public interface View extends UberView<DataSetDefRefreshAttributesEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(IsWidget enabledView, DataSetDefRefreshIntervalEditor.View valueView);\n        \n        void addRefreshEnabledButtonHandler(Command handler);\n        \n        void setEnabled(boolean enabled);\n    }\n    \n    ToggleSwitchEditor refreshAlways;\n    DataSetDefRefreshIntervalEditor refreshTime;\n    public View view;\n    boolean isRefreshEnabled;\n\n    @Inject\n    public DataSetDefRefreshAttributesEditor(final ToggleSwitchEditor refreshAlways,\n                                             final DataSetDefRefreshIntervalEditor refreshTime,\n                                             final View view) {\n        this.refreshAlways = refreshAlways;\n        this.refreshTime = refreshTime;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(refreshAlways.asWidget(), refreshTime.view);\n        view.addRefreshEnabledButtonHandler(refreshEnabledButtonHandler);\n        refreshTime.addHelpContent(DataSetEditorConstants.INSTANCE.attributeRefreshInterval(),\n                DataSetEditorConstants.INSTANCE.attributeRefreshInterval_description(),\n                Placement.RIGHT);\n    }\n    \n    public boolean isRefreshEnabled() {\n        return isRefreshEnabled;\n    }\n    \n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*************************************************************\n            ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ToggleSwitchEditor refreshAlways() {\n        return refreshAlways;\n    }\n\n    @Override\n    public DataSetDefRefreshIntervalEditor refreshTime() {\n        return refreshTime;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetDef value) {\n        final String rTime = value != null ? value.getRefreshTime() : null;\n        setRefreshEnabled(rTime != null);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetDef> delegate) {\n\n    }\n\n    /*************************************************************\n     ** PRIVATE PRESENTER METHODS **\n     *************************************************************/\n    \n    private void setRefreshEnabled(final boolean refreshEnabled) {\n        this.isRefreshEnabled = refreshEnabled;\n        view.setEnabled(refreshEnabled);\n        refreshTime.setEnabled(refreshEnabled);\n        refreshAlways.setEnabled(refreshEnabled);\n    }\n\n    final Command refreshEnabledButtonHandler = new Command() {\n        @Override\n        public void execute() {\n            setRefreshEnabled(!isRefreshEnabled);\n        }\n    };\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.ToggleSwitch;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set refresh attributes editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefRefreshAttributesEditorView extends Composite implements DataSetDefRefreshAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetDefRefreshAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataSetDefRefreshAttributesEditor presenter;\n\n    @UiField\n    ToggleSwitch refreshEnabled;\n    \n    @UiField(provided = true)\n    DataSetDefRefreshIntervalEditor.View refreshTimeView;\n\n    @UiField(provided = true)\n    IsWidget refreshOnStaleDataView;\n\n    private HandlerRegistration handlerRegistration;\n    \n    @Override\n    public void init(final DataSetDefRefreshAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final IsWidget enabledView, final DataSetDefRefreshIntervalEditor.View refreshTimeView) {\n        this.refreshOnStaleDataView = enabledView;\n        this.refreshTimeView = refreshTimeView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public void addRefreshEnabledButtonHandler(final Command handler) {\n        \n        if (handlerRegistration != null) {\n            handlerRegistration.removeHandler();\n        }\n        \n        handlerRegistration = refreshEnabled.addValueChangeHandler(new ValueChangeHandler<Boolean>() {\n            @Override\n            public void onValueChange(final ValueChangeEvent<Boolean> event) {\n                handler.execute();;\n            }\n        });\n        \n    }\n\n    @Override\n    public void setEnabled(final boolean isEnabled) {\n        refreshEnabled.setValue(isEnabled);\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bts=\"urn:import:org.gwtbootstrap3.extras.toggleswitch.client.ui\"\n             xmlns:attributes=\"urn:import:org.dashbuilder.client.widgets.dataset.editor.attributes\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .inlineText {\n      margin-left: 10px;\n    }\n    .refreshOnStaleDataRow {\n      margin-top: 10px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n    <b:Row>\n\n      <!-- Refresh enabled. -->\n      <b:Column size=\"MD_3\">\n        <g:HorizontalPanel verticalAlignment=\"ALIGN_MIDDLE\">\n          <bts:ToggleSwitch ui:field=\"refreshEnabled\" size=\"MINI\" animate=\"true\"/>\n          <g:HTML text=\"{i18n.refreshEvery}\" addStyleNames=\"{style.inlineText}\"/>\n        </g:HorizontalPanel>\n      </b:Column>\n\n      <!-- Refresh time. -->\n      <b:Column size=\"MD_9\">\n        <attributes:DataSetDefRefreshIntervalEditor.View ui:field=\"refreshTimeView\"/>\n      </b:Column>\n      \n    </b:Row>\n    \n    <b:Row addStyleNames=\"{style.refreshOnStaleDataRow}\">\n      <!-- Refresh on stale data. -->\n      <b:Column offset=\"MD_3\" size=\"MD_9\">\n        <g:HorizontalPanel verticalAlignment=\"ALIGN_MIDDLE\">\n          <g:IsWidget ui:field=\"refreshOnStaleDataView\"/>\n          <g:HTML text=\"{i18n.refreshOnStaleData}\" addStyleNames=\"{style.inlineText}\"/>\n        </g:HorizontalPanel>\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshIntervalEditor.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataset.client.resources.i18n.DateIntervalTypeConstants;\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.Arrays;\nimport java.util.List;\n\n/**\n * <p>Provides an editor for a the refreshInterval data set definition attribute..</p>\n * \n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefRefreshIntervalEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefRefreshIntervalEditor {\n\n    private static final DateIntervalType DEFAULT_INTERVAL_TYPE = DateIntervalType.HOUR;\n\n    private static List<DateIntervalType> ALLOWED_TYPES = Arrays.asList(\n            DateIntervalType.SECOND,\n            DateIntervalType.MINUTE,\n            DateIntervalType.HOUR,\n            DateIntervalType.DAY,\n            DateIntervalType.MONTH,\n            DateIntervalType.YEAR);\n\n    public interface View extends UberView<DataSetDefRefreshIntervalEditor> {\n\n        View addHelpContent(final String title, final String content, final Placement placement);\n        \n        View addIntervalTypeItem(String item);\n\n        View setSelectedIntervalType(int index);\n\n        int getSelectedIntervalTypeIndex();\n\n        View setQuantity(double value);\n        \n        double getQuantity();\n        \n        View setEnabled(boolean enabled);\n    }\n    \n    Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent;\n    public View view;\n    \n    @Inject\n    public DataSetDefRefreshIntervalEditor(final View view,\n                                           final Event<org.dashbuilder.common.client.event.ValueChangeEvent<String>> valueChangeEvent) {\n        this.view = view;\n        this.valueChangeEvent = valueChangeEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n\n        // List box for available date interval types.\n        for (final DateIntervalType dateInterval : ALLOWED_TYPES) {\n            final String s = DateIntervalTypeConstants.INSTANCE.getString(dateInterval.name());\n            view.addIntervalTypeItem(s);\n        }\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void addHelpContent(final String title, final String content, final Placement placement) {\n        view.addHelpContent(title, content, placement);\n    }\n    \n    @Override\n    public void setEnabled(final boolean isEnabled) {\n        view.setEnabled(isEnabled);\n    }\n\n    @Override\n    public void setValue(final String value) {\n        double quantity = 1;\n        int index = -1;\n        if (value != null) {\n            final TimeAmount timeAmount = TimeAmount.parse(value);\n            quantity = timeAmount.getQuantity();\n            final DateIntervalType dType = timeAmount.getType();\n            index = getIntervalTypeIndex(dType);\n        }\n        \n        view.setQuantity(quantity);\n        view.setSelectedIntervalType(index > -1 ? index : getIntervalTypeIndex(DEFAULT_INTERVAL_TYPE));\n    }\n\n    @Override\n    public String getValue() {\n        final Double quantity = view.getQuantity();\n        final DateIntervalType type = getSelectedIntervalType();\n        return new TimeAmount(quantity.longValue(), type).toString();\n    }\n    \n    private DateIntervalType getSelectedIntervalType() {\n        return ALLOWED_TYPES.get(view.getSelectedIntervalTypeIndex());\n    }\n\n    private int getIntervalTypeIndex(DateIntervalType type) {\n        for (int i=0; i<ALLOWED_TYPES.size(); i++) {\n            if (ALLOWED_TYPES.get(i).equals(type)) {\n                return i;\n            }\n        }\n        return 0;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshIntervalEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor;\nimport org.gwtbootstrap3.client.ui.IntegerBox;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.Popover;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The DataSetDefRefreshIntervalEditor editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetDefRefreshIntervalEditorView extends Composite implements DataSetDefRefreshIntervalEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataSetDefRefreshIntervalEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    @UiField\n    HorizontalPanel mainPanel;\n    \n    @UiField\n    IntegerBox valueBox;\n\n    @UiField\n    ListBox intervalType;\n    \n    DataSetDefRefreshIntervalEditor presenter;\n\n    @UiConstructor\n    public DataSetDefRefreshIntervalEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final DataSetDefRefreshIntervalEditor presenter) {\n        this.presenter = presenter;\n    }\n\n\n    @Override\n    public DataSetDefRefreshIntervalEditor.View addIntervalTypeItem(final String item) {\n        intervalType.addItem(item);\n        return this;\n    }\n\n    @Override\n    public DataSetDefRefreshIntervalEditor.View setSelectedIntervalType(final int index) {\n        intervalType.setSelectedIndex(index);\n        return this;\n    }\n\n    @Override\n    public int getSelectedIntervalTypeIndex() {\n        return intervalType.getSelectedIndex();\n    }\n\n    @Override\n    public DataSetDefRefreshIntervalEditor.View setQuantity(final double value) {\n        valueBox.setValue((int) value);\n        return this;\n    }\n\n    @Override\n    public double getQuantity() {\n        final Integer value = valueBox.getValue();\n        return value != null ? value.doubleValue() : 0;\n    }\n\n    @Override\n    public DataSetDefRefreshIntervalEditor.View setEnabled(final boolean isEnabled) {\n        valueBox.setEnabled(isEnabled);\n        intervalType.setEnabled(isEnabled);\n        return this;\n    }\n\n    @Override\n    public DataSetDefRefreshIntervalEditor.View addHelpContent(final String title, final String content, final Placement placement) {\n        final Tooltip tooltip = new Tooltip(intervalType);\n        tooltip.setContainer(\"body\");\n        tooltip.setShowDelayMs(1000);\n        tooltip.setPlacement(placement);\n        tooltip.setTitle(content);\n        mainPanel.add(tooltip);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshIntervalEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .valueBox {\n      width: 50px;\n    }\n    .inline {\n      margin-left: 10px;\n    }\n  </ui:style>\n\n  <g:HorizontalPanel ui:field=\"mainPanel\" verticalAlignment=\"ALIGN_MIDDLE\">\n    <b:IntegerBox ui:field=\"valueBox\" addStyleNames=\"{style.valueBox}\"/>\n    <b:ListBox ui:field=\"intervalType\" addStyleNames=\"{style.inline}\"/>\n  </g:HorizontalPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.bean;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.map.MapEditor;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>Bean Data Set specific attributes editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class BeanDataSetDefAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.BeanDataSetDefAttributesEditor {\n\n    public interface View extends UberView<BeanDataSetDefAttributesEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View generatorClassView, IsWidget parameterMapView);\n        \n    }\n\n    ValueBoxEditor<String> generatorClass;\n    MapEditor paramaterMap;\n    public View view;\n\n    @Inject\n    public BeanDataSetDefAttributesEditor(final ValueBoxEditor<String> generatorClass,\n                                          final MapEditor paramaterMap,\n                                          final View view) {\n        this.generatorClass = generatorClass;\n        this.paramaterMap = paramaterMap;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the Bean specific attributes editor view.\n        view.init(this);\n        view.initWidgets(generatorClass.view, paramaterMap.asWidget());\n        generatorClass.addHelpContent(DataSetEditorConstants.INSTANCE.bean_generator_class(),\n                DataSetEditorConstants.INSTANCE.bean_generator_class_description(),\n                Placement.BOTTOM);\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n    \n    @Override\n    public ValueBoxEditor<String> generatorClass() {\n        return generatorClass;\n    }\n\n    @Override\n    public MapEditor paramaterMap() {\n        return paramaterMap;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetDefAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.bean;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Bean Data Set attributes editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class BeanDataSetDefAttributesEditorView extends Composite implements BeanDataSetDefAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, BeanDataSetDefAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    BeanDataSetDefAttributesEditor presenter;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View generatorClassView;\n\n    @UiField(provided = true)\n    IsWidget parameterMapView;\n\n    @Override\n    public void init(final BeanDataSetDefAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n    \n    @Override\n    public void initWidgets(final ValueBoxEditor.View generatorClassView, final IsWidget parameterMapView) {\n        this.generatorClassView = generatorClassView;\n        this.parameterMapView = parameterMapView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetDefAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n  \n  <ui:style>\n    .row {\n      margin-bottom: 5px;\n    }\n    .parameterMap {\n      width: 80%;\n      background-color: ghostwhite;\n      border: 1px solid #E3E3E3;\n      border-radius: 4px 4px 4px 4px;\n      box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05) inset;\n      min-height: 20px;\n      padding: 20px;\n    }\n    .attr {\n      float: left;\n      margin-right: 5px;\n    }\n  </ui:style>\n  \n  <b:Container fluid=\"true\">\n\n    <!-- Generator class. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.bean_generator_class}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.bean_generator_class_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"generatorClassView\">\n          <editor:valuebox>\n            <b:TextBox placeholder=\"{i18n.bean_generator_class_placeholder}\" />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Generator parameters. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.bean_generator_params}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.bean_generator_params_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <g:FlowPanel addStyleNames=\"{style.parameterMap}\">\n          <g:IsWidget ui:field=\"parameterMapView\"/>\n        </g:FlowPanel>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.bean;\n\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.map.MapEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>Bean Data Set editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class BeanDataSetEditor extends DataSetEditor<BeanDataSetDef> implements org.dashbuilder.dataset.client.editor.BeanDataSetDefEditor {\n\n    BeanDataSetDefAttributesEditor attributesEditor;\n    \n    @Inject\n    public BeanDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                             final BeanDataSetDefAttributesEditor attributesEditor,\n                             final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                             final DataSetDefPreviewTable previewTable,\n                             final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                             final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                             final DataSetDefRefreshAttributesEditor refreshEditor,\n                             final DataSetClientServices clientServices,\n                             final LoadingBox loadingBox,\n                             final Event<ErrorEvent> errorEvent,\n                             final Event<TabChangedEvent> tabChangedEvent,\n                             final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n                refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the generic data set editor view.\n        super.init();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ValueBoxEditor<String> generatorClass() {\n        return attributesEditor.generatorClass();\n    }\n\n    @Override\n    public MapEditor paramaterMap() {\n        return attributesEditor.paramaterMap();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnListEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.editor.client.adapters.EditorSource;\nimport com.google.gwt.editor.client.adapters.ListEditor;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataColumnDefDriver;\nimport org.dashbuilder.client.widgets.dataset.event.ColumnsChangedEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.editor.DataColumnDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * <p>Data Set column list editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class ColumnListEditor implements IsWidget, org.dashbuilder.dataset.client.editor.ColumnListEditor {\n\n    public interface View extends UberView<ColumnListEditor> {\n        \n        View insert(int index, org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor.View columnEditorView,\n                    boolean selected, boolean enabled, String altText);\n        View remove(int index);\n        View clear();\n    }\n\n    SyncBeanManager beanManager;\n    DataColumnDefDriver dataColumnDefDriver;\n    Event<ColumnsChangedEvent> columnsChangedEvent;\n    public View view;\n\n    ListEditor<DataColumnDef, DataColumnDefEditor> listEditor;\n    List<DataColumnDef> acceptableColumns;\n    final List<String> restrictedColumns = new LinkedList<String>();\n    DataSetProviderType providerType;\n\n    @Inject\n    public ColumnListEditor(final SyncBeanManager beanManager,\n                            final DataColumnDefDriver dataColumnDefDriver,\n                            final Event<ColumnsChangedEvent> columnsChangedEvent,\n                            final View view) {\n        this.beanManager = beanManager;\n        this.dataColumnDefDriver = dataColumnDefDriver;\n        this.columnsChangedEvent = columnsChangedEvent;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        listEditor = ListEditor.of(createDataColumnDefEditorSource());\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /**\n     * Set all data set available columns (not only the current used ones)\n     * \n     * @param acceptableValues Acceptable values for the editor.\n     */\n    @Override\n    public void setAcceptableValues(final List<DataColumnDef> acceptableValues) {\n\n        clear();\n\n        // Register column editor for each available column of the data set.\n        this.acceptableColumns = new LinkedList<DataColumnDef>(acceptableValues);\n        int index = 0;\n        for (final DataColumnDef columnDef : this.acceptableColumns ) {\n            org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createDummyColumnEditor(columnDef);\n            view.insert(index, editor.view, false, true, null);\n            index++;\n        }\n    }\n\n    /**\n     * Set the column that cannot be removed from the list, as it's used by the filter.\n     * @param value The column id.\n     */\n    @Override\n    public void onValueRestricted(final String value) {\n        this.restrictedColumns.add(value);\n        setEditorEnabled(value, false, DataSetEditorConstants.INSTANCE.columnIsUsedInFilter());\n    }\n\n    /**\n     * Set the column that can be removed again from the list, as it's no longer used by the filter.\n     * @param value The column id.\n     */\n    @Override\n    public void onValueUnRestricted(final String value) {\n        this.restrictedColumns.remove(value);\n        \n        // Check single column used in data set -> it cannot be unselected.\n        if (listEditor.getList().size() == 1) {\n            setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn());\n        } else {\n            setEditorEnabled(value, true, null);\n        }\n    }\n\n    @Override\n    public void setProviderType(final DataSetProviderType type) {\n        this.providerType = type;\n    }\n\n\n    public void clear() {\n        acceptableColumns = null;\n        providerType = null;\n        view.clear();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public DataColumnDefEditor createEditorForTraversal() {\n        return listEditor.createEditorForTraversal();\n    }\n\n    @Override\n    public String getPathElement(final DataColumnDefEditor subEditor) {\n        return listEditor.getPathElement(subEditor);\n    }\n\n    @Override\n    public void setEditorChain(final EditorChain<DataColumnDef, DataColumnDefEditor> chain) {\n        listEditor.setEditorChain(chain);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<List<DataColumnDef>> delegate) {\n        listEditor.setDelegate(delegate);\n    }\n\n    @Override\n    public void showErrors(final List<EditorError> errors) {\n\n    }\n\n    @Override\n    public void flush() {\n        listEditor.flush();\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n        listEditor.onPropertyChange(paths);\n    }\n\n    @Override\n    public void setValue(final List<DataColumnDef> value) {\n        listEditor.setValue(value);\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n    \n    void onColumnSelect(final int index, final boolean selected) {\n        final DataColumnDef columnDef = acceptableColumns.get(index);\n        if (selected) {\n            listEditor.getList().add(columnDef.clone());\n        } else {\n            listEditor.getList().remove(columnDef);\n        }\n        columnsChangedEvent.fire(new ColumnsChangedEvent(this, listEditor.getList()));\n    }\n    \n    /*************************************************************\n     ** PRIVATE EDITOR METHODS **\n     *************************************************************/\n\n    private void replace(final int index, \n                         final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor columnEditor,\n                         final boolean selected, final boolean enabled, final String altText) {\n        view.remove(index);\n        columnEditor.isEditMode(selected && enabled);\n        view.insert(index, columnEditor.view, selected, enabled, altText);\n    }\n\n    private int getAvailableColumnIndex(final String id) {\n        int x = 0;\n        for (final DataColumnDef column : acceptableColumns) {\n            if (column.getId().equals(id)) return x;\n            x++;\n        }\n        return -1;\n    }\n\n    DataColumnDefEditorSource createDataColumnDefEditorSource() {\n        return new DataColumnDefEditorSource();\n    }\n\n    class DataColumnDefEditorSource extends EditorSource<DataColumnDefEditor> {\n\n        @Override\n        public DataColumnDefEditor create(final int index) {\n            final DataColumnDef column = listEditor.getList().get(index);\n            final int localIndex = acceptableColumns.indexOf(column);\n\n            // Check single column used in data set -> it cannot be unselected.\n            if (!checkSingleColumnEditorDisabled()) {\n                // Enable column selection if more than one column remains on the data set.\n                checkMultipleColumnsEditorEnabled();\n            }\n            \n            // Create the new editor.\n            final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createColumnEditor();\n            final boolean hasSingleColumn = listEditor.getList().size() == 1;\n            final boolean isRestricted = restrictedColumns.contains(column.getId());\n            final String tooltipText = hasSingleColumn ? DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn() \n                    : ( isRestricted ? DataSetEditorConstants.INSTANCE.columnIsUsedInFilter() : null );\n            doSetOriginalColumnType(column.getId(), editor);\n            replace(localIndex, editor, true, !isRestricted && !hasSingleColumn, tooltipText);\n            return editor;\n        }\n        \n        \n\n        @Override\n        public void dispose(DataColumnDefEditor subEditor) {\n            \n            // Column to be removed.\n            final String columnId = subEditor.id().getValue();\n            final int localIndex = getAvailableColumnIndex(columnId);\n\n            if (localIndex > -1) {\n                final DataColumnDef column = acceptableColumns.get(localIndex);\n\n                // Dispose and remove sub-editor.\n                super.dispose(subEditor);\n                subEditor.removeFromParent();\n\n                // Create a new dummy editor for the available column.\n                final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createDummyColumnEditor(column);\n                replace(localIndex, editor, false, true, null);\n\n                // Disable column selection if only one column remains on the data set.\n                checkSingleColumnEditorDisabled();\n            }\n        }\n    };\n\n    /**\n     * Checks that if only single column used in data set -> it cannot be unselected. \n     */\n    private boolean checkSingleColumnEditorDisabled() {\n        final int size = listEditor.getList().size();\n        final boolean hasEditors = !listEditor.getEditors().isEmpty();\n        if (size == 1 && hasEditors) {\n            setEditorEnabled(0 ,false, DataSetEditorConstants.INSTANCE.dataSetMustHaveAtLeastOneColumn());\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Checks that if multiple columns are used in data set -> the column editors must be enabed, if the columns are not are restricted. \n     */\n    private boolean checkMultipleColumnsEditorEnabled() {\n        final int size = listEditor.getList().size();\n        if (size == 2 && !listEditor.getEditors().isEmpty()) {\n            final String cId = listEditor.getEditors().get(0).id().getValue();\n            if (!restrictedColumns.contains(cId)) {\n                setEditorEnabled(0, true, null);\n            }\n            return true;\n        }\n        return false;\n    }\n\n    private void setEditorEnabled(final String columnId, final boolean enabled, final String altText) {\n        final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor e = getEditor(columnId);\n        if (e != null) {\n            setEditorEnabled(e, enabled, altText);\n        }\n    }\n    \n    private void setEditorEnabled(final int index, final boolean enabled, final String altText) {\n        final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor _e = (org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor) listEditor.getEditors().get(index);\n        if (_e != null) {\n            setEditorEnabled(_e, enabled, altText);\n        }\n    }\n\n    private void setEditorEnabled(org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor _e, final boolean enabled, final String altText) {\n        final String cId = _e.id().getValue();\n        final int _index = getAvailableColumnIndex(cId);\n        if (_index > -1) {\n            replace(_index, _e, true, enabled, altText);\n        }\n    }\n    \n    private void doSetOriginalColumnType(final String cId, final DataColumnDefEditor editor) {\n        final int _index = getAvailableColumnIndex(cId);\n        final DataColumnDef originalCol = acceptableColumns.get(_index);\n        if (originalCol != null) {\n            editor.setOriginalColumnType(originalCol.getColumnType());\n        }\n    }\n    \n    private org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor getEditor(final String columnId) {\n        List<DataColumnDefEditor> editors = listEditor.getEditors();\n        if (editors != null && !editors.isEmpty()) {\n            for (final DataColumnDefEditor editor : editors) {\n                final String cId = editor.id().getValue();\n                if (columnId.equals(cId)) return (org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor) editor;\n            }\n        }\n        return null;\n    }\n    \n    \n    private org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor createColumnEditor() {\n        org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor e = beanManager.lookupBean(org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor.class).newInstance();\n        e.setProviderType(providerType);\n        return e;\n    }\n\n    private org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor createDummyColumnEditor(final DataColumnDef def) {\n        final org.dashbuilder.client.widgets.dataset.editor.column.DataColumnDefEditor editor = createColumnEditor();\n        // Column is available but not selected, do not allow edition.\n        editor.isEditMode(false);\n        \n        // Initialze edtiro with the column attributes.\n        dataColumnDefDriver.initialize(editor);\n        dataColumnDefDriver.edit(def);\n        \n        doSetOriginalColumnType(def.getId(), editor);\n\n        return editor;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnListEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.Row;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Data Set column list editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class ColumnListEditorView extends Composite implements ColumnListEditor.View {\n\n    interface Binder extends UiBinder<Widget, ColumnListEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    ColumnListEditor presenter;\n\n    @UiField\n    FlowPanel container;\n\n    @UiConstructor\n    public ColumnListEditorView() {\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n    \n    @Override\n    public void init(final ColumnListEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public ColumnListEditor.View insert(final int index,\n                                        final DataColumnDefEditor.View columnEditorView,\n                                        final boolean selected, final boolean enabled,\n                                        final String altText) {\n        final CheckBox selectedInput = new CheckBox();\n        selectedInput.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        selectedInput.getElement().getStyle().setTop(-7, Style.Unit.PX);\n        selectedInput.setEnabled(enabled);\n        selectedInput.setValue(selected);\n        selectedInput.setTitle(altText != null ? altText : \"\");\n        selectedInput.addValueChangeHandler(new ValueChangeHandler<Boolean>() {\n            @Override\n            public void onValueChange(final ValueChangeEvent<Boolean> event) {\n                presenter.onColumnSelect(index, event.getValue());\n            }\n        });\n\n        final HorizontalPanel panel = new HorizontalPanel();\n        panel.setWidth(\"100%\");\n        panel.add(selectedInput);\n        panel.add(columnEditorView.asWidget());\n        container.insert(panel, index);\n        return this;\n    }\n\n    @Override\n    public ColumnListEditor.View remove(final int index) {\n        container.remove(index);\n        return this;\n    }\n\n    @Override\n    public ColumnListEditor.View clear() {\n        container.clear();\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnListEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <g:FlowPanel ui:field=\"container\">\n    \n  </g:FlowPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnTypeEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.list.DropDownImageListEditor;\nimport org.dashbuilder.common.client.editor.list.ImageListEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.client.resources.bundles.DataSetClientResources;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\n/**\n * <p>Data Set column  type editor presenter.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class ColumnTypeEditor implements IsWidget,\n                                         org.dashbuilder.dataset.client.editor.ColumnTypeEditor {\n\n    DropDownImageListEditor<ColumnType> columnType;\n    ColumnType originalColumnType;\n\n    @Inject\n    public ColumnTypeEditor(final DropDownImageListEditor<ColumnType> columnType) {\n        this.columnType = columnType;\n    }\n\n    @PostConstruct\n    public void init() {\n        final Collection<ImageListEditor<ColumnType>.Entry> entries = getDefaultEntries();\n        columnType.setImageSize(\"16px\",\n                                \"16px\");\n        columnType.setEntries(entries);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return columnType.asWidget();\n    }\n\n    public void addHelpContent(final String title,\n                               final String content,\n                               final Placement placement) {\n        columnType.setHelpContent(title,\n                                  content,\n                                  placement);\n    }\n\n    @Override\n    public void setOriginalColumnType(final ColumnType columnType) {\n        this.originalColumnType = columnType;\n        final Collection<ImageListEditor<ColumnType>.Entry> acceptableEntries = getAcceptableEntries(columnType);\n        this.columnType.setEntries(acceptableEntries);\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public DropDownImageListEditor<ColumnType> columnType() {\n        return columnType;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataColumnDef value) {\n        final ColumnType ct = originalColumnType != null ? originalColumnType : (value != null ? value.getColumnType() : null);\n        String columnTypeDescr = getColumnTypeDescription(ct);\n        final Collection<ImageListEditor<ColumnType>.Entry> acceptableEntries = getAcceptableEntries(ct);\n        columnType.setEntries(acceptableEntries);\n        columnType.setHelpContent(DataSetEditorConstants.INSTANCE.attributeColumnType(),\n                                  columnTypeDescr,\n                                  Placement.RIGHT);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataColumnDef> delegate) {\n\n    }\n\n    /**\n     * Acceptable column types to be changed from:\n     * LABEL -> TEXT\n     * NUMBER -> LABEL\n     */\n    private Collection<ImageListEditor<ColumnType>.Entry> getAcceptableEntries(final ColumnType type) {\n        final Collection<ImageListEditor<ColumnType>.Entry> result = new ArrayList<ImageListEditor<org.dashbuilder.dataset.ColumnType>.Entry>();\n        if (type != null) {\n            if (ColumnType.DATE.equals(type)) {\n                result.add(buildEntry(ColumnType.DATE));\n            } else if (ColumnType.LABEL.equals(type)) {\n                result.add(buildEntry(ColumnType.LABEL));\n                result.add(buildEntry(ColumnType.TEXT));\n            } else if (ColumnType.TEXT.equals(type)) {\n                result.add(buildEntry(ColumnType.LABEL));\n                result.add(buildEntry(ColumnType.TEXT));\n            } else if (ColumnType.NUMBER.equals(type)) {\n                result.add(buildEntry(ColumnType.LABEL));\n                result.add(buildEntry(ColumnType.NUMBER));\n            }\n        }\n        return result;\n    }\n\n    protected Collection<ImageListEditor<ColumnType>.Entry> getDefaultEntries() {\n        final ColumnType[] providerTypes = ColumnType.values();\n        final Collection<ImageListEditor<ColumnType>.Entry> entries = new ArrayList<ImageListEditor<ColumnType>.Entry>(providerTypes.length);\n        for (final ColumnType type : providerTypes) {\n            final ImageListEditor<ColumnType>.Entry entry = buildEntry(type);\n            entries.add(entry);\n        }\n        return entries;\n    }\n\n    private ImageListEditor<ColumnType>.Entry buildEntry(final ColumnType type) {\n        final String name = type.name();\n        final String descr = getColumnTypeDescription(type);\n        final SafeUri uri = getImageUri(type);\n        return columnType.newEntry(type,\n                                   uri,\n                                   new SafeHtmlBuilder().appendEscaped(name).toSafeHtml(),\n                                   new SafeHtmlBuilder().appendEscaped(descr).toSafeHtml());\n    }\n\n    SafeUri getImageUri(final ColumnType type) {\n        SafeUri result = null;\n        switch (type) {\n            case DATE:\n                result = DataSetClientResources.INSTANCE.images().dateIcon32().getSafeUri();\n                break;\n            case NUMBER:\n                result = DataSetClientResources.INSTANCE.images().numberIcon32V3().getSafeUri();\n                break;\n            case TEXT:\n                result = DataSetClientResources.INSTANCE.images().textIcon32().getSafeUri();\n                break;\n            case LABEL:\n                result = DataSetClientResources.INSTANCE.images().labelIcon32().getSafeUri();\n                break;\n        }\n        return result;\n    }\n\n    String getColumnTypeDescription(final ColumnType type) {\n        switch (type) {\n            case DATE:\n                return DataSetEditorConstants.INSTANCE.dateColumnType_description();\n            case NUMBER:\n                return DataSetEditorConstants.INSTANCE.numberColumnType_description();\n            case TEXT:\n                return DataSetEditorConstants.INSTANCE.textColumnType_description();\n            case LABEL:\n                return DataSetEditorConstants.INSTANCE.labelColumnType_description();\n            default:\n                return null;\n        }\n    }\n\n    @Override\n    public void isEditMode(final boolean isEdit) {\n        columnType.isEditMode(isEdit);\n    }\n\n    // Listen to changes in the column type\n\n    void onColumnTypeChanged(@Observes ValueChangeEvent<ColumnType> event) {\n        PortablePreconditions.checkNotNull(\"ValueChangeEvent<ColumnType>\",\n                                           event);\n        if (event.getContext().equals(columnType)) {\n\n            // Update the help tooltip when the column type changes\n            String columnTypeDescr = getColumnTypeDescription(event.getValue());\n            columnType.setHelpContent(DataSetEditorConstants.INSTANCE.attributeColumnType(),\n                                      columnTypeDescr,\n                                      Placement.RIGHT);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/DataColumnDefEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>Data Column Definition editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataColumnDefEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataColumnDefEditor {\n\n    public interface View extends UberView<DataColumnDefEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View idView, IsWidget columnTypeView);\n                \n    }\n\n    ValueBoxEditor<String> id;\n    ColumnTypeEditor columnType;\n    public View view;\n\n    boolean isEditMode = true;\n    DataSetProviderType providerType;\n\n    @Inject\n    public DataColumnDefEditor(final ValueBoxEditor<String> id,\n                               final ColumnTypeEditor columnType,\n                               final View view) {\n        this.id = id;\n        this.columnType = columnType;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(id.view, columnType.asWidget());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void removeFromParent() {\n        id.asWidget().removeFromParent();\n    }\n\n    @Override\n    public void setProviderType(final DataSetProviderType type) {\n        this.providerType = type;\n        updateColumnTypeEditMode();\n    }\n\n    @Override\n    public void setOriginalColumnType(final ColumnType columnType) {\n        this.columnType.setOriginalColumnType(columnType);\n    }\n\n    @Override\n    public void isEditMode(final boolean isEdit) {\n        this.isEditMode = isEdit;\n        updateColumnTypeEditMode();\n    }\n\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ValueBoxEditor<String> id() {\n        return id;\n    }\n\n    @Override\n    public org.dashbuilder.dataset.client.editor.ColumnTypeEditor columnType() {\n        return columnType;\n    }\n    \n    private void updateColumnTypeEditMode() {\n        final boolean isTypeEditable = !DataSetProviderType.BEAN.equals(providerType);\n        columnType.isEditMode(isTypeEditable && isEditMode);\n\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/DataColumnDefEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Data Column Definition editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataColumnDefEditorView extends Composite implements DataColumnDefEditor.View {\n\n    interface Binder extends UiBinder<Widget, DataColumnDefEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    DataColumnDefEditor presenter;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View idView;\n\n    @UiField(provided = true)\n    IsWidget columnTypeView;\n    \n    @Override\n    public void init(final DataColumnDefEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final ValueBoxEditor.View idView, final IsWidget columnTypeView) {\n        this.idView = idView;\n        this.columnTypeView = columnTypeView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/DataColumnDefEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n  \n  <ui:style>\n    .columnTypePanel {\n      margin-left: 5px;\n    }\n  </ui:style>\n\n  <g:HorizontalPanel width=\"100%\">\n\n    <!-- Id value box editor. -->\n    <editor:ValueBoxEditor.View ui:field=\"idView\">\n      <editor:valuebox>\n        <b:TextBox enabled=\"false\" maxLength=\"20\" placeholder=\"{i18n.attributeId}\"/>\n      </editor:valuebox>\n    </editor:ValueBoxEditor.View>\n\n    <!-- Column type editor. -->\n    <g:FlowPanel addStyleNames=\"{style.columnTypePanel}\">\n      <g:IsWidget ui:field=\"columnTypeView\"/>\n    </g:FlowPanel>\n    \n  </g:HorizontalPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/column/DataSetDefColumnsEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\n/**\n * <p>Data Set columns editor.</p>\n * <p>It's attached in the gwt editors chain to handle the <code>allColumns</code> flag.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class DataSetDefColumnsEditor implements IsWidget, org.dashbuilder.dataset.client.editor.DataSetDefColumnsEditor  {\n\n    ColumnListEditor columnListEditor;\n    List<DataColumnDef> acceptableValues;\n\n    @Inject\n    public DataSetDefColumnsEditor(final ColumnListEditor columnListEditor) {\n        this.columnListEditor = columnListEditor;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return columnListEditor.asWidget();\n    }\n\n    @Override\n    public ColumnListEditor columns() {\n        return columnListEditor;\n    }\n\n    @Override\n    public void setAcceptableValues(final List<DataColumnDef> acceptableValues) {\n        this.acceptableValues = acceptableValues;\n        columnListEditor.setAcceptableValues(acceptableValues);\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final DataSetDef value) {\n        checkAvailableColumns();\n\n        /*\n            This editor and sub-editors do not take care about 'allColumnsEnable' flag. \n            If all column flag is enabled, just add all the available column into the data set definition. \n         */\n        if (value != null && value.isAllColumnsEnabled()) {\n            final List<DataColumnDef> columns = new ArrayList<DataColumnDef>(acceptableValues.size());\n            for (final DataColumnDef columnDef : acceptableValues) {\n                columns.add(columnDef.clone());\n            }\n            value.setColumns(columns);\n            value.setAllColumnsEnabled(false);\n        }\n\n        // Columns edition depends on the data set provider type.\n        columnListEditor.setProviderType( value != null ? value.getProvider() : null);\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<DataSetDef> delegate) {\n\n    }\n    \n    private void checkAvailableColumns() {\n        if (acceptableValues == null) {\n            throw new IllegalArgumentException(\"Must call setAcceptableValues() before setting the data set definition columns to edit.\");\n        }\n    }\n\n    @Override\n    public void onValueRestricted(final String value) {\n        columnListEditor.onValueRestricted(value);\n    }\n\n    @Override\n    public void onValueUnRestricted(final String value) {\n        columnListEditor.onValueUnRestricted(value);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.csv;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>CSV Data Set specific attributes editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class CSVDataSetDefAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.CSVDataSetDefAttributesEditor {\n\n    public interface View extends UberView<CSVDataSetDefAttributesEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View fileURLView, IsWidget filePathView,\n                         ValueBoxEditor.View sepCharView, ValueBoxEditor.View quoteCharView,\n                         ValueBoxEditor.View escCharView, ValueBoxEditor.View datePatternView,\n                         ValueBoxEditor.View numberPatternView);\n        \n        void showFilePathInput();\n\n        void showFileURLInput();\n        \n    }\n\n    DataSetClientServices dataSetClientServices;\n    ValueBoxEditor<String> fileURL;\n    FileUploadEditor filePath;\n    ValueBoxEditor<Character> separatorChar;\n    ValueBoxEditor<Character> quoteChar;\n    ValueBoxEditor<Character> escapeChar;\n    ValueBoxEditor<String> datePattern;\n    ValueBoxEditor<String> numberPattern;\n    public View view;\n    CSVDataSetDef value;\n    boolean isUsingFilePath = true;\n\n    @Inject\n    public CSVDataSetDefAttributesEditor(final DataSetClientServices dataSetClientServices,\n                                         final ValueBoxEditor<String> fileURL,\n                                         final FileUploadEditor filePath,\n                                         final ValueBoxEditor<Character> separatorChar,\n                                         final ValueBoxEditor<Character> quoteChar,\n                                         final ValueBoxEditor<Character> escapeChar,\n                                         final ValueBoxEditor<String> datePattern,\n                                         final ValueBoxEditor<String> numberPattern,\n                                         final View view) {\n        this.dataSetClientServices = dataSetClientServices;\n        this.fileURL = fileURL;\n        this.filePath = filePath;\n        this.separatorChar = separatorChar;\n        this.quoteChar = quoteChar;\n        this.escapeChar = escapeChar;\n        this.datePattern = datePattern;\n        this.numberPattern = numberPattern;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the Bean specific attributes editor view.\n        view.init(this);\n        view.initWidgets(fileURL.view, filePath.view, separatorChar.view, quoteChar.view,\n                escapeChar.view, datePattern.view, numberPattern.view);\n        fileURL.addHelpContent(DataSetEditorConstants.INSTANCE.csv_URL(),\n                DataSetEditorConstants.INSTANCE.csv_URL_description(),\n                Placement.BOTTOM);\n        filePath.addHelpContent(DataSetEditorConstants.INSTANCE.csv_filePath(),\n                DataSetEditorConstants.INSTANCE.csv_filePath_description(),\n                Placement.BOTTOM);\n        separatorChar.addHelpContent(DataSetEditorConstants.INSTANCE.csv_sepChar(),\n                DataSetEditorConstants.INSTANCE.csv_sepChar_description(),\n                Placement.BOTTOM);\n        quoteChar.addHelpContent(DataSetEditorConstants.INSTANCE.csv_quoteChar(),\n                DataSetEditorConstants.INSTANCE.csv_quoteChar_description(),\n                Placement.BOTTOM);\n        escapeChar.addHelpContent(DataSetEditorConstants.INSTANCE.csv_escapeChar(),\n                DataSetEditorConstants.INSTANCE.csv_escapeChar_description(),\n                Placement.BOTTOM);\n        datePattern.addHelpContent(DataSetEditorConstants.INSTANCE.csv_datePattern(),\n                DataSetEditorConstants.INSTANCE.csv_datePattern_description(),\n                Placement.BOTTOM);\n        numberPattern.addHelpContent(DataSetEditorConstants.INSTANCE.csv_numberPattern(),\n                DataSetEditorConstants.INSTANCE.csv_numberPattern_description(),\n                Placement.BOTTOM);\n\n        // Configure file upload component.\n        filePath.configure(\"csvFileUpload\", new FileUploadEditor.FileUploadEditorCallback() {\n            @Override\n            public String getUploadFileName() {\n                return value.getUUID() + \".csv\";\n            }\n\n            @Override\n            public String getUploadFileUrl() {\n                String csvPath = \"default://master@dashbuilder/datasets/tmp/\" + value.getUUID() + \".csv\";\n                return dataSetClientServices.getUploadFileUrl(csvPath);\n            }\n        });\n        \n        // By default, show the file path input.\n        view.showFilePathInput();\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public ValueBoxEditor<String> fileURL() {\n        return fileURL;\n    }\n\n    @Override\n    public FileUploadEditor filePath() {\n        return filePath;\n    }\n\n    @Override\n    public ValueBoxEditor<Character> separatorChar() {\n        return separatorChar;\n    }\n\n    @Override\n    public ValueBoxEditor<Character> quoteChar() {\n        return quoteChar;\n    }\n\n    @Override\n    public ValueBoxEditor<Character> escapeChar() {\n        return escapeChar;\n    }\n\n    @Override\n    public ValueBoxEditor<String> datePattern() {\n        return datePattern;\n    }\n\n    @Override\n    public ValueBoxEditor<String> numberPattern() {\n        return numberPattern;\n    }\n\n    @Override\n    public boolean isUsingFilePath() {\n        return isUsingFilePath;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final CSVDataSetDef value) {\n        this.value = value;\n        if (value != null && value.getFileURL() != null) {\n            useFileURL();\n        } else {\n            useFilePath();\n        }\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<CSVDataSetDef> delegate) {\n\n    }\n\n    /*************************************************************\n     ** VIEW CALLBACK METHODS **\n     *************************************************************/\n    \n    void onUseFilePathButtonClick() {\n        useFilePath();\n    }\n\n    void onUseFileURLButtonClick() {\n        useFileURL();\n    }\n\n    /*************************************************************\n     ** PRIVATE PRESENTER METHODS **\n     *************************************************************/\n    \n    void useFilePath() {\n        this.isUsingFilePath = true;\n        view.showFilePathInput();\n    }\n    \n    void useFileURL() {\n        this.isUsingFilePath = false;\n        view.showFileURLInput();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetDefAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.csv;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Row;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The CSV Data Set attributes editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class CSVDataSetDefAttributesEditorView extends Composite implements CSVDataSetDefAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, CSVDataSetDefAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    CSVDataSetDefAttributesEditor presenter;\n\n    @UiField\n    Row filePathRow;\n    \n    @UiField(provided = true)\n    IsWidget filePathView;\n\n    @UiField\n    Row fileURLRow;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View fileURLView;\n    \n    @UiField\n    Button useFilePathButton;\n\n    @UiField\n    Button useFileURLButton;\n    \n    @UiField(provided = true)\n    ValueBoxEditor.View sepCharView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View quoteCharView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View escCharView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View datePatternView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View numberPatternView;\n\n    @Override\n    public void init(final CSVDataSetDefAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n    \n    @Override\n    public void initWidgets(final ValueBoxEditor.View fileURLView, final IsWidget filePathView,\n                            final ValueBoxEditor.View sepCharView, final ValueBoxEditor.View quoteCharView,\n                            final ValueBoxEditor.View escCharView, final ValueBoxEditor.View datePatternView,\n                            final ValueBoxEditor.View numberPatternView) {\n        this.fileURLView = fileURLView;\n        this.filePathView = filePathView;\n        this.sepCharView = sepCharView;\n        this.quoteCharView = quoteCharView;\n        this.escCharView = escCharView;\n        this.datePatternView = datePatternView;\n        this.numberPatternView = numberPatternView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n        useFilePathButton.addClickHandler(useFilePathButtonHandler);\n        useFileURLButton.addClickHandler(useFileURLButtonHandler);\n    }\n\n    @Override\n    public void showFilePathInput() {\n        fileURLRow.setVisible(false);\n        filePathRow.setVisible(true);\n    }\n\n    @Override\n    public void showFileURLInput() {\n        fileURLRow.setVisible(true);\n        filePathRow.setVisible(false);\n    }\n\n    final ClickHandler useFilePathButtonHandler = new ClickHandler() {\n        @Override\n        public void onClick(final ClickEvent event) {\n            presenter.onUseFilePathButtonClick();\n        }\n    };\n    final ClickHandler useFileURLButtonHandler = new ClickHandler() {\n        @Override\n        public void onClick(final ClickEvent event) {\n            presenter.onUseFileURLButtonClick();\n        }\n    };\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetDefAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n             xmlns:common=\"urn:import:org.dashbuilder.common.client.widgets\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n  \n  <ui:style>\n    .inline {\n      margin-right: 5px;\n    }\n    .row {\n      margin-bottom: 5px;\n    }\n    .attr {\n      float: left;\n      margin-right: 5px;\n    }\n  </ui:style>\n  \n  <b:Container fluid=\"true\">\n\n    <!-- File path. -->\n    <b:Row ui:field=\"filePathRow\" addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_filePath}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_filePath_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <g:HorizontalPanel width=\"100%\">\n          <g:cell width=\"1%\" verticalAlignment=\"MIDDLE\">\n            <b:Popover container=\"body\" showDelayMs=\"1000\" content=\"{i18n.csv_URL_description}\" title=\"{i18n.csv_useFileURL}\" placement=\"BOTTOM\">\n              <b:Button icon=\"CLOUD_UPLOAD\" type=\"DEFAULT\" ui:field=\"useFileURLButton\" size=\"EXTRA_SMALL\" addStyleNames=\"{style.inline}\"/>\n            </b:Popover>\n          </g:cell>\n          <g:cell width=\"99%\" verticalAlignment=\"MIDDLE\">\n            <g:IsWidget ui:field=\"filePathView\"/>\n          </g:cell>\n        </g:HorizontalPanel>\n      </b:Column>\n    </b:Row>\n\n    <!-- File URL. -->\n    <b:Row ui:field=\"fileURLRow\" addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_URL}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_URL_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <g:HorizontalPanel width=\"100%\">\n          <g:cell width=\"1%\" verticalAlignment=\"MIDDLE\">\n            <b:Popover container=\"body\" showDelayMs=\"1000\" content=\"{i18n.csv_filePath_description}\" title=\"{i18n.csv_useFilePath}\" placement=\"BOTTOM\">\n              <b:Button icon=\"FILE\" type=\"DEFAULT\" ui:field=\"useFilePathButton\" size=\"EXTRA_SMALL\" addStyleNames=\"{style.inline}\"/>\n            </b:Popover>\n          </g:cell>\n          <g:cell width=\"99%\" verticalAlignment=\"MIDDLE\">\n            <editor:ValueBoxEditor.View ui:field=\"fileURLView\">\n              <editor:valuebox>\n                <b:TextBox placeholder=\"{i18n.csv_URL_placeholder}\" />\n              </editor:valuebox>\n            </editor:ValueBoxEditor.View>\n          </g:cell>\n        </g:HorizontalPanel>\n      </b:Column>\n    </b:Row>\n\n    <!-- Separator character. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_sepChar}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_sepChar_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"sepCharView\">\n          <editor:valuebox>\n            <common:CharacterBox alignment=\"CENTER\" visibleLength=\"1\" placeholder=\"{i18n.csv_sepChar_placeholder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Quote character. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_quoteChar}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_quoteChar_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"quoteCharView\">\n          <editor:valuebox>\n            <common:CharacterBox alignment=\"CENTER\" visibleLength=\"1\" placeholder=\"{i18n.csv_quoteChar_placeholder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Escape character. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_escapeChar}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_escapeChar_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"escCharView\">\n          <editor:valuebox>\n            <common:CharacterBox alignment=\"CENTER\" visibleLength=\"1\" placeholder=\"{i18n.csv_escapeChar_placeholder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Date pattern. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_datePattern}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_datePattern_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"datePatternView\">\n          <editor:valuebox>\n            <b:TextBox placeholder=\"{i18n.csv_datePattern_placeholder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Number pattern. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.csv_numberPattern}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.csv_numberPattern_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"numberPatternView\">\n          <editor:valuebox>\n            <b:TextBox placeholder=\"{i18n.csv_numberPattern_placeholder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.csv;\n\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>CSV Data Set editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class CSVDataSetEditor extends DataSetEditor<CSVDataSetDef> implements org.dashbuilder.dataset.client.editor.CSVDataSetDefEditor {\n\n    CSVDataSetDefAttributesEditor attributesEditor;\n    \n    @Inject\n    public CSVDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                            final CSVDataSetDefAttributesEditor attributesEditor,\n                            final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                            final DataSetDefPreviewTable previewTable,\n                            final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                            final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                            final DataSetDefRefreshAttributesEditor refreshEditor,\n                            final DataSetClientServices clientServices,\n                            final LoadingBox loadingBox,\n                            final Event<ErrorEvent> errorEvent,\n                            final Event<TabChangedEvent> tabChangedEvent,\n                            final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n                refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the generic data set editor view.\n        super.init();\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n    @Override\n    public ValueBoxEditor<String> fileURL() {\n        return attributesEditor.fileURL();\n    }\n\n    @Override\n    public FileUploadEditor filePath() {\n        return attributesEditor.filePath();\n    }\n\n    @Override\n    public ValueBoxEditor<Character> separatorChar() {\n        return attributesEditor.separatorChar();\n    }\n\n    @Override\n    public ValueBoxEditor<Character> quoteChar() {\n        return attributesEditor.quoteChar();\n    }\n\n    @Override\n    public ValueBoxEditor<Character> escapeChar() {\n        return attributesEditor.escapeChar();\n    }\n\n    @Override\n    public ValueBoxEditor<String> datePattern() {\n        return attributesEditor.datePattern();\n    }\n\n    @Override\n    public ValueBoxEditor<String> numberPattern() {\n        return attributesEditor.numberPattern();\n    }\n\n    public boolean isUsingFilePath() {\n        return attributesEditor.isUsingFilePath();\n    }\n\n    @Override\n    public void setValue(final CSVDataSetDef value) {\n        super.setValue(value);\n        // As gwt editor inheritance does not work fine, try to reuse CSV attributes editor logic here. \n        attributesEditor.setValue(value);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/BeanDataSetDefAttributesDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.BeanDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\n\n/**\n * <p>Driver for BeanDataSetDefAttributesEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface BeanDataSetDefAttributesDriver extends SimpleBeanEditorDriver<BeanDataSetDef, BeanDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/BeanDataSetDefDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.BeanDataSetDefEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\n\n/**\n * <p>Driver for BeanDataSetDefEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface BeanDataSetDefDriver extends SimpleBeanEditorDriver<BeanDataSetDef, BeanDataSetDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/CSVDataSetDefAttributesDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.CSVDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\n/**\n * <p>Driver for CSVDataSetDefAttributesEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface CSVDataSetDefAttributesDriver extends SimpleBeanEditorDriver<CSVDataSetDef, CSVDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/CSVDataSetDefDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.CSVDataSetDefEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\n/**\n * <p>Driver for CSVDataSetDefEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface CSVDataSetDefDriver extends SimpleBeanEditorDriver<CSVDataSetDef, CSVDataSetDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/DataColumnDefDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.DataColumnDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\n\n/**\n * <p>Driver for DataColumnDefEditor.</p>\n *\n * @since 0.4.0\n */\npublic interface DataColumnDefDriver extends SimpleBeanEditorDriver<DataColumnDef, DataColumnDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/DataSetDefBasicAttributesDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>Driver for DataSetDefBasicAttributesEditor.</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefBasicAttributesDriver extends SimpleBeanEditorDriver<DataSetDef, DataSetDefBasicAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/DataSetDefProviderTypeDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.DataSetDefProviderTypeEditor;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * <p>Driver for DataSetDefProviderTypeEditor.</p>\n *\n * @since 0.4.0\n */\npublic interface DataSetDefProviderTypeDriver extends SimpleBeanEditorDriver<DataSetDef, DataSetDefProviderTypeEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/DataSetEditorDriverFactory.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport com.google.gwt.core.client.GWT;\n\n/**\n * <p>Factory for the different gwt editor drivers for a DataSetDef. Drivers must be created at compile time via deferred binding.</p>\n */\n@ApplicationScoped\npublic class DataSetEditorDriverFactory {\n\n    final DataSetDefProviderTypeDriver dataSetDefProviderTypeDriver = GWT.create(DataSetDefProviderTypeDriver.class);\n    final DataSetDefBasicAttributesDriver dataSetDefBasicAttributesDriver = GWT.create(DataSetDefBasicAttributesDriver.class);\n    final SQLDataSetDefAttributesDriver sqlDataSetDefAttributesDriver = GWT.create(SQLDataSetDefAttributesDriver.class);\n    final BeanDataSetDefAttributesDriver beanDataSetDefAttributesDriver = GWT.create(BeanDataSetDefAttributesDriver.class);\n    final PrometheusDataSetDefAttributesDriver prometheusSearchDataSetDefAttributesDriver = GWT.create(PrometheusDataSetDefAttributesDriver.class);\n    final KafkaDataSetDefAttributesDriver kafkaSearchDataSetDefAttributesDriver = GWT.create(KafkaDataSetDefAttributesDriver.class);\n    final CSVDataSetDefAttributesDriver csvDataSetDefAttributesDriver = GWT.create(CSVDataSetDefAttributesDriver.class);\n    final SQLDataSetDefDriver sqlDataSetDefDriver = GWT.create(SQLDataSetDefDriver.class);\n    final BeanDataSetDefDriver beanDataSetDefDriver = GWT.create(BeanDataSetDefDriver.class);\n    final CSVDataSetDefDriver csvDataSetDefDriver = GWT.create(CSVDataSetDefDriver.class);\n    final PrometheusDataSetDefDriver prometheusSearchDataSetDefDriver = GWT.create(PrometheusDataSetDefDriver.class);\n    final KafkaDataSetDefDriver kafkaSearchDataSetDefDriver = GWT.create(KafkaDataSetDefDriver.class);\n    final DataColumnDefDriver dataColumnDefDriver = GWT.create(DataColumnDefDriver.class);\n\n    @Produces\n    public DataSetDefProviderTypeDriver dataSetDefProviderTypeDriver() {\n        return dataSetDefProviderTypeDriver;\n    }\n\n    @Produces\n    public SQLDataSetDefDriver sqlDataSetDefDriver() {\n        return sqlDataSetDefDriver;\n    }\n\n    @Produces\n    public DataColumnDefDriver dataColumnDefDriver() {\n        return dataColumnDefDriver;\n    }\n\n    @Produces\n    public SQLDataSetDefAttributesDriver sqlDataSetDefAttributesDriver() {\n        return sqlDataSetDefAttributesDriver;\n    }\n\n    @Produces\n    public DataSetDefBasicAttributesDriver dataSetDefBasicAttributesDriver() {\n        return dataSetDefBasicAttributesDriver;\n    }\n\n    @Produces\n    public BeanDataSetDefAttributesDriver beanDataSetDefAttributesDriver() {\n        return beanDataSetDefAttributesDriver;\n    }\n\n    @Produces\n    public CSVDataSetDefAttributesDriver csvDataSetDefAttributesDriver() {\n        return csvDataSetDefAttributesDriver;\n    }\n\n    @Produces\n    public CSVDataSetDefDriver csvDataSetDefDriver() {\n        return csvDataSetDefDriver;\n    }\n\n    @Produces\n    public BeanDataSetDefDriver beanDataSetDefDriver() {\n        return beanDataSetDefDriver;\n    }\n\n    @Produces\n    public PrometheusDataSetDefAttributesDriver prometheusDataSetDefAttributesDriver() {\n        return prometheusSearchDataSetDefAttributesDriver;\n    }\n\n    @Produces\n    public PrometheusDataSetDefDriver prometheusDataSetDefDriver() {\n        return prometheusSearchDataSetDefDriver;\n    }\n    \n    @Produces\n    public KafkaDataSetDefAttributesDriver kafkaDataSetDefAttributesDriver() {\n        return kafkaSearchDataSetDefAttributesDriver;\n    }\n    \n    @Produces\n    public KafkaDataSetDefDriver kafkaDataSetDefDriver() {\n        return kafkaSearchDataSetDefDriver;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/KafkaDataSetDefAttributesDriver.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.kafka.KafkaDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\n\n/**\n * <p>Driver for KafkaDataSetDefAttributesEditor.</p>\n * \n */\npublic interface KafkaDataSetDefAttributesDriver extends SimpleBeanEditorDriver<KafkaDataSetDef, KafkaDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/KafkaDataSetDefDriver.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.KafkaDataSetDefEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\n\n/**\n * <p>Driver for KafkaDataSetDefEditor.</p>\n * \n */\npublic interface KafkaDataSetDefDriver extends SimpleBeanEditorDriver<KafkaDataSetDef, KafkaDataSetDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/PrometheusDataSetDefAttributesDriver.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.PrometheusDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\n\n/**\n * <p>Driver for PrometheusDataSetDefAttributesEditor.</p>\n * \n */\npublic interface PrometheusDataSetDefAttributesDriver extends SimpleBeanEditorDriver<PrometheusDataSetDef, PrometheusDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/PrometheusDataSetDefDriver.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.PrometheusDataSetDefEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\n\n/**\n * <p>Driver for PrometheusDataSetDefEditor.</p>\n * \n */\npublic interface PrometheusDataSetDefDriver extends SimpleBeanEditorDriver<PrometheusDataSetDef, PrometheusDataSetDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/SQLDataSetDefAttributesDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\n\n/**\n * <p>Driver for SQLDataSetDefAttributesEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface SQLDataSetDefAttributesDriver extends SimpleBeanEditorDriver<SQLDataSetDef, SQLDataSetDefAttributesEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/driver/SQLDataSetDefDriver.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.driver;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\n\n/**\n * <p>Driver for SQLDataSetDefEditor.</p>\n * \n * @since 0.4.0\n */\npublic interface SQLDataSetDefDriver extends SimpleBeanEditorDriver<SQLDataSetDef, SQLDataSetDefEditor> {\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/kafka/KafkaDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.kafka;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef.MetricsTarget;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * <p>Kafka Data Set specific attributes editor presenter.</p>\n * \n */\n@Dependent\npublic class KafkaDataSetDefAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.KafkaDataSetDefAttributesEditor {\n\n    public interface View extends UberView<KafkaDataSetDefAttributesEditor> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View hostView,\n                         ValueBoxEditor.View portView,\n                         DropDownEditor.View targetView,\n                         ValueBoxEditor.View clientIdView,\n                         ValueBoxEditor.View filterView,\n                         ValueBoxEditor.View nodeIdView,\n                         ValueBoxEditor.View topicView,\n                         ValueBoxEditor.View partitionView);\n\n        void brokerFields();\n\n        void consumerConstraints();\n\n        void producerConstraints();\n\n    }\n\n    DataSetClientServices dataSetClientServices;\n    ValueBoxEditor<String> host;\n    ValueBoxEditor<String> port;\n    MetricsTargetEditorAdapter target;\n    ValueBoxEditor<String> filter;\n    ValueBoxEditor<String> clientId;\n    ValueBoxEditor<String> nodeId;\n    ValueBoxEditor<String> topic;\n    ValueBoxEditor<String> partition;\n\n    public View view;\n    KafkaDataSetDef value;\n\n    @Inject\n    public KafkaDataSetDefAttributesEditor(final DataSetClientServices dataSetClientServices,\n                                           final View view,\n                                           final ValueBoxEditor<String> host,\n                                           final ValueBoxEditor<String> port,\n                                           final MetricsTargetEditorAdapter target,\n                                           final ValueBoxEditor<String> filter,\n                                           final ValueBoxEditor<String> clientId,\n                                           final ValueBoxEditor<String> nodeId,\n                                           final ValueBoxEditor<String> topic,\n                                           final ValueBoxEditor<String> partition) {\n        this.dataSetClientServices = dataSetClientServices;\n        this.view = view;\n        this.host = host;\n        this.port = port;\n        this.target = target;\n        this.filter = filter;\n        this.clientId = clientId;\n        this.nodeId = nodeId;\n        this.topic = topic;\n        this.partition = partition;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the Bean specific attributes editor view.\n        view.init(this);\n        view.initWidgets(host.view, port.view, target.getDropDownEditor().view, filter.view, clientId.view, nodeId.view, topic.view, partition.view);\n\n        host.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_host(),\n                            DataSetEditorConstants.INSTANCE.kafka_host_description(),\n                            Placement.BOTTOM);\n        port.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_port(),\n                            DataSetEditorConstants.INSTANCE.kafka_port_description(),\n                            Placement.BOTTOM);\n        target.getDropDownEditor().addHelpContent(DataSetEditorConstants.INSTANCE.kafka_target(),\n                                                  DataSetEditorConstants.INSTANCE.kafka_target_description(),\n                                                  Placement.TOP);\n        filter.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_filter(),\n                              DataSetEditorConstants.INSTANCE.kafka_filter_description(),\n                              Placement.BOTTOM);\n        clientId.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_clientId(),\n                                DataSetEditorConstants.INSTANCE.kafka_clientId_description(),\n                                Placement.BOTTOM);\n        nodeId.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_nodeId(),\n                              DataSetEditorConstants.INSTANCE.kafka_nodeId_description(),\n                              Placement.BOTTOM);\n        topic.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_topic(),\n                             DataSetEditorConstants.INSTANCE.kafka_topic_description(),\n                             Placement.BOTTOM);\n        partition.addHelpContent(DataSetEditorConstants.INSTANCE.kafka_partition(),\n                                 DataSetEditorConstants.INSTANCE.kafka_partition_description(),\n                                 Placement.BOTTOM);\n\n        target.getDropDownEditor().setValue(MetricsTarget.BROKER.name());\n\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void flush() {\n        // do nothing\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final KafkaDataSetDef value) {\n        this.value = value;\n        target.setValue(value.getTarget());\n        updateViewFields(this.value.getTarget());\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<KafkaDataSetDef> delegate) {\n\n    }\n\n    @Override\n    public LeafAttributeEditor<String> host() {\n        return host;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> port() {\n        return port;\n    }\n\n    @Override\n    public LeafAttributeEditor<MetricsTarget> target() {\n        return target;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> filter() {\n        return filter;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> clientId() {\n        return clientId;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> nodeId() {\n        return nodeId;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> topic() {\n        return topic;\n    }\n\n    @Override\n    public LeafAttributeEditor<String> partition() {\n        return partition;\n    }\n\n    public void onTargetChanged(@Observes ValueChangeEvent valueChangeEvent) {\n        if (valueChangeEvent.getContext() == target.getDropDownEditor() &&\n            valueChangeEvent.getValue() != null) {\n            MetricsTarget target = MetricsTarget.valueOf(valueChangeEvent.getValue().toString());\n            updateViewFields(target);\n        }\n    }\n    \n    private void updateViewFields(MetricsTarget target) {\n        switch (target) {\n            case BROKER:\n                view.brokerFields();\n                break;\n            case CONSUMER:\n                view.consumerConstraints();\n                break;\n            case PRODUCER:\n                view.producerConstraints();\n                break;\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/kafka/KafkaDataSetDefAttributesEditorView.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.kafka;\n\nimport java.util.Iterator;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NodeList;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.TextBox;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor.View;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\n\n/**\n * <p>The Prometheus Data Set attributes editor view.</p>\n *\n */\n@Dependent\npublic class KafkaDataSetDefAttributesEditorView extends Composite implements KafkaDataSetDefAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, KafkaDataSetDefAttributesEditorView> {\n\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    KafkaDataSetDefAttributesEditor presenter;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View hostView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View portView;\n\n    @UiField(provided = true)\n    DropDownEditor.View targetView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View filterView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View clientIdView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View nodeIdView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View topicView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View partitionView;\n\n    @Override\n    public void init(final KafkaDataSetDefAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(View hostView,\n                            View portView,\n                            DropDownEditor.View targetView,\n                            View filterView,\n                            View clientIdView,\n                            View nodeIdView,\n                            View topicView,\n                            View partitionView) {\n        this.hostView = hostView;\n        this.portView = portView;\n        this.targetView = targetView;\n        this.filterView = filterView;\n        this.clientIdView = clientIdView;\n        this.nodeIdView = nodeIdView;\n        this.topicView = topicView;\n        this.partitionView = partitionView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public void brokerFields() {\n        disable(clientIdView, nodeIdView, topicView, partitionView);\n    }\n\n    @Override\n    public void consumerConstraints() {\n        enable(clientIdView, nodeIdView, topicView, partitionView);\n    }\n\n    @Override\n    public void producerConstraints() {\n        disable(partitionView);\n        enable(clientIdView, nodeIdView, topicView);\n    }\n\n    void enable(IsWidget... isWidgets) {\n        elementOp(el -> el.removeAttribute(\"disabled\"), isWidgets);\n    }\n\n    void disable(IsWidget... isWidgets) {\n        elementOp(el -> el.setAttribute(\"disabled\", \"true\"), isWidgets);\n    }\n\n    void elementOp(Consumer<Element> action, IsWidget... isWidgets) {\n        for (IsWidget isWidget : isWidgets) {\n            NodeList<Element> inputs = isWidget.asWidget().getElement().getElementsByTagName(\"input\");\n            for (int i = 0; i < inputs.getLength(); i++) {\n                action.accept(inputs.getItem(i));\n            }\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/kafka/KafkaDataSetDefAttributesEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n  xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n  xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n  xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n  xmlns:common=\"urn:import:org.dashbuilder.common.client.widgets\"\n  xmlns:ddwn=\"urn:import:org.dashbuilder.common.client.editor.list\">\n\n  <ui:with field=\"i18n\"\n    type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\" />\n\n  <ui:style>\n    .inline {\n    margin-right: 5px;\n    }\n    .row {\n    margin-bottom: 5px;\n    }\n    .attr\n    {\n    float: left;\n    margin-right: 5px;\n    }\n    .hidden {\n    display: none;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <!-- host -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_host}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_host_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"hostView\">\n          <editor:valuebox>\n            <b:TextBox\n              placeholder=\"{i18n.kafka_host_placeholder}\" />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- port -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_port}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_port_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"portView\">\n          <editor:valuebox>\n            <b:TextBox\n              placeholder=\"{i18n.kafka_port_placeholder}\" />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- target -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_target}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_target_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <ddwn:DropDownEditor.View\n          ui:field=\"targetView\" />\n      </b:Column>\n    </b:Row>\n\n    <!-- filter -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_filter}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_filter_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"filterView\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n\n    <!-- clientId -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_clientId}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_clientId_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"clientIdView\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- nodeId -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_nodeId}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_nodeId_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"nodeIdView\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- topic -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_topic}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_topic_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"topicView\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- partition [Hidden for simplicity]-->\n    <b:Row addStyleNames=\"{style.hidden}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.kafka_partition}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.kafka_partition_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"partitionView\">\n          <editor:valuebox>\n            <b:TextBox />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/kafka/KafkaDataSetEditor.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.kafka;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.KafkaDataSetDefEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef.MetricsTarget;\n\n/**\n * <p>Kafka Data Set editor presenter.</p>\n * \n */\n@Dependent\npublic class KafkaDataSetEditor extends DataSetEditor<KafkaDataSetDef> implements KafkaDataSetDefEditor {\n\n    KafkaDataSetDefAttributesEditor attributesEditor;\n\n    @Inject\n    public KafkaDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                              final KafkaDataSetDefAttributesEditor attributesEditor,\n                              final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                              final DataSetDefPreviewTable previewTable,\n                              final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                              final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                              final DataSetDefRefreshAttributesEditor refreshEditor,\n                              final DataSetClientServices clientServices,\n                              final LoadingBox loadingBox,\n                              final Event<ErrorEvent> errorEvent,\n                              final Event<TabChangedEvent> tabChangedEvent,\n                              final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor,\n              previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n              refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        super.init();\n    }\n\n    @Override\n    public void setValue(KafkaDataSetDef value) {\n        super.setValue(value);\n        attributesEditor.setValue(value);\n    }\n\n    @Override\n    public LeafAttributeEditor<String> host() {\n        return attributesEditor.host();\n    }\n\n    @Override\n    public LeafAttributeEditor<String> port() {\n        return attributesEditor.port();\n    }\n\n    @Override\n    public LeafAttributeEditor<MetricsTarget> target() {\n        return attributesEditor.target();\n    }\n    \n    @Override\n    public LeafAttributeEditor<String> filter() {\n        return attributesEditor.filter();\n    }\n\n    @Override\n    public LeafAttributeEditor<String> clientId() {\n        return attributesEditor.clientId();\n    }\n\n    @Override\n    public LeafAttributeEditor<String> nodeId() {\n        return attributesEditor.nodeId();\n    }\n\n    @Override\n    public LeafAttributeEditor<String> topic() {\n        return attributesEditor.topic();\n    }\n\n    @Override\n    public LeafAttributeEditor<String> partition() {\n        return attributesEditor.partition();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/kafka/MetricsTargetEditorAdapter.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.kafka;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.EditorError;\nimport org.dashbuilder.common.client.editor.LeafAttributeEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor.Entry;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef.MetricsTarget;\n\n/**\n * Adapts values from a DropDownEditor to work with MetricsTarget enum.\n *\n */\n@Dependent\npublic class MetricsTargetEditorAdapter implements LeafAttributeEditor<MetricsTarget> {\n\n    private DropDownEditor editor;\n\n    @Inject\n    public MetricsTargetEditorAdapter(DropDownEditor editor) {\n        this.editor = editor;\n        updateEntries();\n    }\n\n    public void showErrors(List<EditorError> errors) {\n        editor.showErrors(errors);\n    }\n\n    @Override\n    public void setValue(MetricsTarget value) {\n        editor.setValue(value.name());\n    }\n\n    @Override\n    public MetricsTarget getValue() {\n        return MetricsTarget.valueOf(editor.getValue());\n    }\n\n    public DropDownEditor getDropDownEditor() {\n        return this.editor;\n    }\n\n    private void updateEntries() {\n        List<Entry> entries = Arrays.stream(MetricsTarget.values())\n                                    .map(e -> editor.newEntry(e.name(), e.name()))\n                                    .collect(Collectors.toList());\n        editor.setEntries(entries);\n        editor.setValue(MetricsTarget.BROKER.name());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/prometheus/PrometheusDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.prometheus;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * <p>Prometheus Data Set specific attributes editor presenter.</p>\n * \n */\n@Dependent\npublic class PrometheusDataSetDefAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.PrometheusDataSetDefAttributesEditor {\n\n    public interface View extends UberView<PrometheusDataSetDefAttributesEditor> {\n\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(ValueBoxEditor.View serverUrlView, ValueBoxEditor.View queryView);\n\n    }\n\n    DataSetClientServices dataSetClientServices;\n    ValueBoxEditor<String> serverUrl;\n    ValueBoxEditor<String> query;\n\n    public View view;\n    PrometheusDataSetDef value;\n\n    @Inject\n    public PrometheusDataSetDefAttributesEditor(final DataSetClientServices dataSetClientServices,\n                                                final ValueBoxEditor<String> serverUrl,\n                                                final ValueBoxEditor<String> query,\n                                                final View view) {\n        this.dataSetClientServices = dataSetClientServices;\n        this.serverUrl = serverUrl;\n        this.query = query;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the Bean specific attributes editor view.\n        view.init(this);\n        view.initWidgets(serverUrl.view, query.view);\n        serverUrl.addHelpContent(DataSetEditorConstants.INSTANCE.prometheus_server_url(),\n                                 DataSetEditorConstants.INSTANCE.prometheus_server_url_description(),\n                                 Placement.BOTTOM);\n        query.addHelpContent(DataSetEditorConstants.INSTANCE.prometheus_query(),\n                             DataSetEditorConstants.INSTANCE.prometheus_query_description(),\n                             Placement.BOTTOM);\n\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public ValueBoxEditor<String> serverUrl() {\n        return this.serverUrl;\n    }\n\n    @Override\n    public ValueBoxEditor<String> query() {\n        return this.query;\n    }\n\n    @Override\n    public void flush() {\n        // do nothing\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final PrometheusDataSetDef value) {\n        this.value = value;\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<PrometheusDataSetDef> delegate) {\n\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/prometheus/PrometheusDataSetDefAttributesEditorView.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.prometheus;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\n\n/**\n * <p>The Prometheus Data Set attributes editor view.</p>\n *\n */\n@Dependent\npublic class PrometheusDataSetDefAttributesEditorView extends Composite implements PrometheusDataSetDefAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, PrometheusDataSetDefAttributesEditorView> {\n\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    PrometheusDataSetDefAttributesEditor presenter;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View serverUrlView;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View queryView;\n\n    @Override\n    public void init(final PrometheusDataSetDefAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void initWidgets(final ValueBoxEditor.View serverUrlView,\n                            final ValueBoxEditor.View queryView) {\n        this.serverUrlView = serverUrlView;\n        this.queryView = queryView;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/prometheus/PrometheusDataSetDefAttributesEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n  xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n  xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n  xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n  xmlns:common=\"urn:import:org.dashbuilder.common.client.widgets\">\n\n  <ui:with field=\"i18n\"\n    type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\" />\n\n  <ui:style>\n    .inline {\n    margin-right: 5px;\n    }\n    .row {\n    margin-bottom: 5px;\n    }\n    .attr {\n    float: left;\n    margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n\n    <!-- serverUrl -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.prometheus_server_url}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.prometheus_server_url_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"serverUrlView\">\n          <editor:valuebox>\n            <b:TextBox\n              placeholder=\"{i18n.prometheus_server_url_placeholder}\" />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Query -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.prometheus_query}\"\n          addStyleNames=\"{style.attr}\" />\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\"\n          title=\"{i18n.prometheus_query_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View\n          ui:field=\"queryView\">\n          <editor:valuebox>\n            <b:TextBox\n              placeholder=\"{i18n.prometheus_query_placeholder}\" />\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/prometheus/PrometheusDataSetEditor.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.prometheus;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.PrometheusDataSetDefEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\n\n/**\n * <p>Prometheus Data Set editor presenter.</p>\n * \n */\n@Dependent\npublic class PrometheusDataSetEditor extends DataSetEditor<PrometheusDataSetDef> implements PrometheusDataSetDefEditor {\n\n    PrometheusDataSetDefAttributesEditor attributesEditor;\n\n    @Inject\n    public PrometheusDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                   final PrometheusDataSetDefAttributesEditor attributesEditor,\n                                   final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                                   final DataSetDefPreviewTable previewTable,\n                                   final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                                   final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                                   final DataSetDefRefreshAttributesEditor refreshEditor,\n                                   final DataSetClientServices clientServices,\n                                   final LoadingBox loadingBox,\n                                   final Event<ErrorEvent> errorEvent,\n                                   final Event<TabChangedEvent> tabChangedEvent,\n                                   final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor,\n              previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n              refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        super.init();\n    }\n\n    @Override\n    public ValueBoxEditor<String> serverUrl() {\n        return attributesEditor.serverUrl();\n    }\n\n    @Override\n    public ValueBoxEditor<String> query() {\n        return attributesEditor.query();\n    }\n\n    @Override\n    public void setValue(PrometheusDataSetDef value) {\n        super.setValue(value);\n        attributesEditor.setValue(value);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetDefAttributesEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.sql;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\nimport org.dashbuilder.dataset.service.SQLProviderServices;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>SQL Data Set specific attributes editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class SQLDataSetDefAttributesEditor implements IsWidget, org.dashbuilder.dataset.client.editor.SQLDataSetDefAttributesEditor {\n\n    public interface View extends UberView<SQLDataSetDefAttributesEditor> {\n        /**\n         * <p>Specify the views to use for each sub-editor before calling <code>initWidget</code>.</p>\n         */\n        void initWidgets(DropDownEditor.View dataSource, ValueBoxEditor.View dbSchema,\n                         ValueBoxEditor.View dbTable, ValueBoxEditor.View dbSQL);\n\n        /**\n         * <p>Enables edition for sql attribute <code>dbTable</code></p>\n         */\n        void table();\n\n        /**\n         * <p>Enables edition for sql attribute <code>dbSQL</code></p>\n         */\n        void query();\n    }\n\n    Caller<SQLProviderServices> sqlProviderServices;\n    DropDownEditor dataSource;\n    ValueBoxEditor<String> dbSchema;\n    ValueBoxEditor<String> dbTable;\n    ValueBoxEditor<String> dbSQL;\n    public View view;\n    private boolean isQuery;\n\n    @Inject\n    public SQLDataSetDefAttributesEditor(final DropDownEditor dataSource,\n                                         final ValueBoxEditor<String> dbSchema,\n                                         final ValueBoxEditor<String> dbTable,\n                                         final ValueBoxEditor<String> dbSQL,\n                                         final Caller<SQLProviderServices> sqlProviderServices,\n                                         final View view) {\n        this.dataSource = dataSource;\n        this.dbSchema = dbSchema;\n        this.dbTable = dbTable;\n        this.dbSQL = dbSQL;\n        this.sqlProviderServices = sqlProviderServices;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the SQL specific attributes editor view.\n        view.init(this);\n        view.initWidgets(dataSource.view, dbSchema.view, dbTable.view, dbSQL.view);\n\n        dataSource.setSelectHint(DataSetEditorConstants.INSTANCE.sql_datasource_selectHint());\n        sqlProviderServices.call((List<SQLDataSourceDef> list) -> onSqlDataSourcesLoad(list)).getDataSourceDefs();\n\n        dataSource.addHelpContent(DataSetEditorConstants.INSTANCE.sql_datasource(),\n                DataSetEditorConstants.INSTANCE.sql_datasource_description(),\n                Placement.RIGHT); //bottom placement would interfere with the dropdown\n        dbSchema.addHelpContent(DataSetEditorConstants.INSTANCE.sql_schema(),\n                DataSetEditorConstants.INSTANCE.sql_schema_description(),\n                Placement.BOTTOM);\n        dbTable.addHelpContent(DataSetEditorConstants.INSTANCE.sql_table(),\n                DataSetEditorConstants.INSTANCE.sql_table_description(),\n                Placement.BOTTOM);\n        dbSQL.addHelpContent(DataSetEditorConstants.INSTANCE.sql_query(),\n                DataSetEditorConstants.INSTANCE.sql_query_description(),\n                Placement.BOTTOM);\n\n        // Use query editor by default.\n        onSelectQuery();\n    }\n\n    private DropDownEditor.Entry toDropDownEntry(SQLDataSourceDef d) {\n        return dataSource.newEntry(d.getName(), d.getDescription());\n    }\n\n    private void onSqlDataSourcesLoad(List<SQLDataSourceDef> list) {\n        List<DropDownEditor.Entry> entries = list.stream().map(this::toDropDownEntry).collect(Collectors.toList());\n        dataSource.setEntries(entries);\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n    \n    @Override\n    public DropDownEditor dataSource() {\n        return dataSource;\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSchema() {\n        return dbSchema;\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbTable() {\n        return dbTable;\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSQL() {\n        return dbSQL;\n    }\n\n    @Override\n    public void flush() {\n\n    }\n\n    @Override\n    public void onPropertyChange(final String... paths) {\n\n    }\n\n    @Override\n    public void setValue(final SQLDataSetDef value) {\n        if (value != null && value.getDbTable() != null) {\n            onSelectTable();\n        } else {\n            onSelectQuery();\n        }\n    }\n\n    @Override\n    public void setDelegate(final EditorDelegate<SQLDataSetDef> delegate) {\n        // No delegation required.\n    }\n\n    public boolean isUsingQuery() {\n        return this.isQuery;\n    }\n\n    void onSelectTable() {\n        view.table();\n        isQuery = false;\n    }\n\n    void onSelectQuery() {\n        view.query();\n        isQuery = true;\n    }    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetDefAttributesEditorView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.sql;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.gwtbootstrap3.client.ui.RadioButton;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The SQL Data Set attributes editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class SQLDataSetDefAttributesEditorView extends Composite implements SQLDataSetDefAttributesEditor.View {\n\n    interface Binder extends UiBinder<Widget, SQLDataSetDefAttributesEditorView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    SQLDataSetDefAttributesEditor presenter;\n\n    @UiField(provided = true)\n    DropDownEditor.View dataSource;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View dbSchema;\n\n    @UiField\n    @Editor.Ignore\n    RadioButton tableButton;\n\n    @UiField\n    @Editor.Ignore\n    RadioButton queryButton;\n\n    @UiField\n    FlowPanel dbTablePanel;\n    \n    @UiField(provided = true)\n    ValueBoxEditor.View dbTable;\n\n    @UiField\n    FlowPanel dbSQLPanel;\n\n    @UiField(provided = true)\n    ValueBoxEditor.View dbSQL;\n\n    @Override\n    public void init(final SQLDataSetDefAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n    \n    @Override\n    public void initWidgets(final DropDownEditor.View dataSource, final ValueBoxEditor.View dbSchema,\n                            final ValueBoxEditor.View dbTable, final ValueBoxEditor.View dbSQL) {\n        this.dataSource = dataSource;\n        this.dbSchema = dbSchema;\n        this.dbTable = dbTable;\n        this.dbSQL = dbSQL;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    public void table() {\n        dbTablePanel.setVisible(true);\n        dbSQLPanel.setVisible(false);\n        tableButton.setValue(true);\n        queryButton.setValue(false);\n    }\n\n    public void query() {\n        dbTablePanel.setVisible(false);\n        dbSQLPanel.setVisible(true);\n        tableButton.setValue(false);\n        queryButton.setValue(true);\n    }\n    \n    @UiHandler(\"tableButton\")\n    void handleTableRadioClick(ClickEvent e) {\n        presenter.onSelectTable();\n    }\n\n    @UiHandler(\"queryButton\")\n    void handleQueryRadioClick(ClickEvent e) {\n        presenter.onSelectQuery();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetDefAttributesEditorView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.dashbuilder.common.client.editor\"\n             xmlns:ddwn=\"urn:import:org.dashbuilder.common.client.editor.list\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants\"/>\n\n  <ui:style>\n    .sourceSelectorButton {\n      float: left;\n      margin-right: 10px;\n    }\n    .queryBox {\n      height: 200px;\n    }\n    .row {\n      margin-bottom: 5px;\n    }\n    .attr {\n      float: left;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <!-- dataSource. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.sql_datasource}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.sql_datasource_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <ddwn:DropDownEditor.View ui:field=\"dataSource\" />\n      </b:Column>\n    </b:Row>\n\n    <!-- dbSchema. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.sql_schema}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.sql_schema_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <editor:ValueBoxEditor.View ui:field=\"dbSchema\">\n          <editor:valuebox>\n            <b:TextBox placeholder=\"{i18n.sql_schema_placeHolder}\"/>\n          </editor:valuebox>\n        </editor:ValueBoxEditor.View>\n      </b:Column>\n    </b:Row>\n\n    <!-- Source selector (table or query). -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_3\">\n        <g:HTML text=\"{i18n.sql_source}\" addStyleNames=\"{style.attr}\"/>\n        <b:Tooltip isAnimated=\"true\" placement=\"BOTTOM\" title=\"{i18n.sql_source_description}\">\n          <b:Icon type=\"QUESTION_CIRCLE\" />\n        </b:Tooltip>\n      </b:Column>\n      <b:Column size=\"MD_9\">\n        <g:FlowPanel>\n          <b:RadioButton ui:field='tableButton' name=\"sourceType\" text=\"{i18n.sql_table}\" addStyleNames=\"{style.sourceSelectorButton} \"/>\n          <b:RadioButton ui:field='queryButton' name=\"sourceType\" text=\"{i18n.sql_query}\" addStyleNames=\"{style.sourceSelectorButton} \"/>\n        </g:FlowPanel>\n      </b:Column>\n    </b:Row>\n\n\n    <!-- Table / Query. -->\n    <b:Row addStyleNames=\"{style.row}\">\n      <b:Column size=\"MD_9\" offset=\"MD_3\">\n\n        <g:FlowPanel ui:field=\"dbTablePanel\">\n          <editor:ValueBoxEditor.View ui:field=\"dbTable\">\n            <editor:valuebox>\n              <b:TextBox placeholder=\"{i18n.sql_table_placeHolder}\"/>\n            </editor:valuebox>\n          </editor:ValueBoxEditor.View>\n        </g:FlowPanel>\n\n        <g:FlowPanel ui:field=\"dbSQLPanel\">\n          <editor:ValueBoxEditor.View ui:field=\"dbSQL\">\n            <editor:valuebox>\n              <b:TextArea placeholder=\"{i18n.sql_query_placeHolder}\" addStyleNames=\"{style.queryBox}\"/>\n            </editor:valuebox>\n          </editor:ValueBoxEditor.View>\n        </g:FlowPanel>\n\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetEditor.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.sql;\n\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>SQL Data Set editor presenter.</p>\n * \n * @since 0.4.0 \n */\n@Dependent\npublic class SQLDataSetEditor extends DataSetEditor<SQLDataSetDef> implements org.dashbuilder.dataset.client.editor.SQLDataSetDefEditor {\n\n    SQLDataSetDefAttributesEditor attributesEditor;\n    \n    @Inject\n    public SQLDataSetEditor(final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                            final SQLDataSetDefAttributesEditor attributesEditor,\n                            final DataSetDefColumnsFilterEditor columnsAndFilterEditor,\n                            final DataSetDefPreviewTable previewTable,\n                            final DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor,\n                            final DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor,\n                            final DataSetDefRefreshAttributesEditor refreshEditor,\n                            final DataSetClientServices clientServices,\n                            final LoadingBox loadingBox,\n                            final Event<ErrorEvent> errorEvent,\n                            final Event<TabChangedEvent> tabChangedEvent,\n                            final View view) {\n        super(basicAttributesEditor, attributesEditor.view, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor,\n                refreshEditor, clientServices, loadingBox, errorEvent, tabChangedEvent, view);\n        this.attributesEditor = attributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        // Initialize the generic data set editor view.\n        super.init();\n    }\n\n    public SQLDataSetDefAttributesEditor getAttributesEditor() {\n        return attributesEditor;\n    }\n\n    /*************************************************************\n     ** GWT EDITOR CONTRACT METHODS **\n     *************************************************************/\n\n    @Override\n    public DropDownEditor dataSource() {\n        return attributesEditor.dataSource();\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSchema() {\n        return attributesEditor.dbSchema();\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbTable() {\n        return attributesEditor.dbTable();\n    }\n\n    @Override\n    public ValueBoxEditor<String> dbSQL() {\n        return attributesEditor.dbSQL();\n    }\n\n    @Override\n    public boolean isUsingQuery() {\n        return attributesEditor.isUsingQuery();\n    }\n\n    @Override\n    public void setValue(SQLDataSetDef value) {\n        super.setValue(value);\n        // As gwt editor inheritance does not work fine, try to reuse SQL attributes editor logic here. \n        attributesEditor.setValue(value);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/DataSetEditorWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetEditorConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.client.DataSetEditHandler;\nimport org.dashbuilder.displayer.client.DataSetHandler;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\n\n\n/**\n * <p>Data Set Editor workflow presenter.</p>\n *\n * @since 0.4.0\n */\npublic abstract class DataSetEditorWorkflow<T extends DataSetDef> implements IsWidget {\n\n    public interface View extends UberView<DataSetEditorWorkflow> {\n\n        View add(IsWidget widget);\n\n        View addButton(final String text, final String content, final boolean isPrimary, final Command clickCommand);\n\n        View clearButtons();\n\n        View clearView();\n\n    }\n\n    /**\n     * -------------- CDI Injections --------------\n     **/\n    protected SyncBeanManager beanManager;\n    protected DataSetClientServices clientServices;\n    protected DataSetValidatorProvider validatorProvider;\n    protected Event<SaveRequestEvent> saveRequestEvent;\n    protected Event<TestDataSetRequestEvent> testDataSetEvent;\n    protected Event<CancelRequestEvent> cancelRequestEvent;\n    public View view;\n\n    /**\n     * -------------- Private class members. --------------\n     **/\n    protected T dataSetDef;\n    protected Collection<ConstraintViolation<?>> violations = new ArrayList<ConstraintViolation<?>>();\n    protected Command flushCommand;\n    protected Command stepValidator;\n\n    @Inject\n    public DataSetEditorWorkflow(final DataSetClientServices clientServices,\n                                 final DataSetValidatorProvider validatorProvider,\n                                 final SyncBeanManager beanManager,\n                                 final Event<SaveRequestEvent> saveRequestEvent,\n                                 final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                 final Event<CancelRequestEvent> cancelRequestEvent,\n                                 final View view) {\n        this.clientServices = clientServices;\n        this.validatorProvider = validatorProvider;\n        this.beanManager = beanManager;\n        this.saveRequestEvent = saveRequestEvent;\n        this.cancelRequestEvent = cancelRequestEvent;\n        this.testDataSetEvent = testDataSetEvent;\n        this.view = view;\n    }\n\n    public void init() {\n        view.init(this);\n    }\n\n    public interface TestDataSetCallback {\n        void onSuccess(DataSet dataSet);\n        void onError(ClientRuntimeError error);\n    }\n\n    /**\n     * <p>Test the data set connection and obtain the preview result.</p>\n     *\n     */\n    public void testDataSet(final TestDataSetCallback testDataSetCallback) {\n        checkDataSetDefNotNull();\n\n        // Reset columns and filter configuration.\n        getDataSetDef().setAllColumnsEnabled(true);\n        getDataSetDef().setColumns(null);\n        getDataSetDef().setDataSetFilter(null);\n\n        DataSetDef editCloneWithoutCacheSettings = getDataSetDef().clone();\n        editCloneWithoutCacheSettings.setCacheEnabled(false);\n\n        final DataSetLookup lookup = DataSetFactory.newDataSetLookupBuilder()\n                .dataset(dataSetDef.getUUID())\n                .rowOffset(0)\n                .rowNumber(6)\n                .buildLookup();\n\n        try {\n            DataSetHandler editHandler = new DataSetEditHandler(clientServices, lookup, editCloneWithoutCacheSettings);\n            editHandler.lookupDataSet(new DataSetReadyCallback() {\n                @Override\n                public void callback(final DataSet dataSet) {\n                    testDataSetCallback.onSuccess(dataSet);\n                }\n\n                @Override\n                public void notFound() {\n                    testDataSetCallback.onError(new ClientRuntimeError(DataSetEditorConstants.INSTANCE.defNotFound()));\n                }\n\n                @Override\n                public boolean onError(final ClientRuntimeError error) {\n                    testDataSetCallback.onError(error);\n                    return false;\n                }\n            });\n        } catch (final Exception e) {\n            testDataSetCallback.onError(new ClientRuntimeError(e));\n        }\n\n\n    }\n\n    public DataSetEditorWorkflow flush() {\n        if (DataSetEditorWorkflow.this.flushCommand != null) {\n            DataSetEditorWorkflow.this.flushCommand.execute();\n        }\n        return this;\n    }\n\n    public DataSetEditorWorkflow showNextButton() {\n        view.addButton(DataSetEditorConstants.INSTANCE.next(), DataSetEditorConstants.INSTANCE.next_description(), true,\n                saveButtonCommand);\n        return this;\n    }\n\n    public DataSetEditorWorkflow showTestButton() {\n        view.addButton(DataSetEditorConstants.INSTANCE.test(), DataSetEditorConstants.INSTANCE.test_description(), true,\n                testButtonCommand);\n        return this;\n    }\n\n    public DataSetEditorWorkflow showBackButton() {\n        view.addButton(DataSetEditorConstants.INSTANCE.back(), DataSetEditorConstants.INSTANCE.back_description(), false,\n                cancelButtonCommand);\n        return this;\n    }\n\n    public DataSetEditorWorkflow clearButtons() {\n        view.clearButtons();\n        return this;\n    }\n\n    public boolean hasErrors() {\n        return !violations.isEmpty();\n    }\n\n    public T getDataSetDef() {\n        return this.dataSetDef;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void flush(final SimpleBeanEditorDriver driver) {\n        checkDataSetDefNotNull();\n\n        this.violations.clear();\n\n        driver.flush();\n        afterFlush();\n\n        // Validations for current step.\n        if (stepValidator != null) {\n            stepValidator.execute();\n        }\n    }\n\n    protected void afterFlush() {\n        // Override by typed sub-classes to perform specific data set definition flush constraints that depends on the editor state.\n    }\n\n    protected void dispose() {\n    }\n\n    protected void addViolations(final Iterable<ConstraintViolation<?>> _violations) {\n        if (_violations != null) {\n            final Iterator<ConstraintViolation<?>> it = _violations.iterator();\n            while (it.hasNext()) {\n                final ConstraintViolation<?> _v = it.next();\n                this.violations.add(_v);\n            }\n        }\n    }\n\n    public DataSetEditorWorkflow clear() {\n        this.dataSetDef = null;\n        this.flushCommand = null;\n        this.stepValidator = null;\n        violations.clear();\n        view.clearView();\n        return this;\n    }\n\n    protected void checkDataSetDefNotNull() {\n        checkDataSetDefNotNull(dataSetDef);\n    }\n\n    protected void checkDataSetDefNotNull(final T def) {\n        if (def == null) {\n            throw new RuntimeException(\"Must call edit() before using the data set definition editor workflow methods.\");\n        }\n    }\n\n    protected final Command testButtonCommand = new Command() {\n        @Override\n        public void execute() {\n            flush();\n            testDataSetEvent.fire(new TestDataSetRequestEvent(DataSetEditorWorkflow.this));\n        }\n    };\n\n    protected final Command saveButtonCommand = new Command() {\n        @Override\n        public void execute() {\n            flush();\n            saveRequestEvent.fire(new SaveRequestEvent(DataSetEditorWorkflow.this));\n        }\n    };\n\n    protected final Command cancelButtonCommand = new Command() {\n        @Override\n        public void execute() {\n            cancelRequestEvent.fire(new CancelRequestEvent(DataSetEditorWorkflow.this));\n        }\n    };\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/DataSetEditorWorkflowFactory.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.BeanDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.CSVDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.DataSetProviderTypeWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.KafkaDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.PrometheusDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.create.SQLDataSetBasicAttributesWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.BeanDataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.CSVDataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.DataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.KafkaDataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.PrometheusDataSetEditWorkflow;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.edit.SQLDataSetEditWorkflow;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>Main entry point for editing or creating a data set definition instance.</p>\n * <p>It provides the workflow beans for each driver & editor.</p>\n * \n * @since 0.4.0\n */\n@Dependent\npublic class DataSetEditorWorkflowFactory {\n    \n    SyncBeanManager beanManager;\n    DataSetProviderTypeWorkflow providerTypeWorkflow;\n    ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n\n    @Inject\n    public DataSetEditorWorkflowFactory(final SyncBeanManager beanManager,\n                                        final DataSetProviderTypeWorkflow providerTypeWorkflow,\n                                        final ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin) {\n        this.beanManager = beanManager;\n        this.providerTypeWorkflow = providerTypeWorkflow;\n        this.dataSetEditorPlugin = dataSetEditorPlugin;\n    }\n\n    /**\n     * Obtain the bean for editing a data set definition for a given type.\n     * @param type The data set definition provider type to edit.\n     * @return The workflow instance.\n     */\n    public DataSetEditWorkflow edit(final DataSetProviderType type) {\n        final boolean isSQL = type != null && DataSetProviderType.SQL.equals(type);\n        final boolean isBean = type != null && DataSetProviderType.BEAN.equals(type);\n        final boolean isCSV = type != null && DataSetProviderType.CSV.equals(type);\n        final boolean isPrometheus = type != null && DataSetProviderType.PROMETHEUS.equals(type);\n        final boolean isKafka = type != null && DataSetProviderType.KAFKA.equals(type);\n        \n        Class workflowClass = null;\n        if (isSQL) {\n            workflowClass = SQLDataSetEditWorkflow.class;\n        } else if (isCSV) {\n            workflowClass = CSVDataSetEditWorkflow.class;\n        } else if (isBean) {\n            workflowClass = BeanDataSetEditWorkflow.class;\n        } else if (isPrometheus) {\n            workflowClass = PrometheusDataSetEditWorkflow.class;\n        } else if (isKafka) {\n            workflowClass = KafkaDataSetEditWorkflow.class;\n        }  else if (!dataSetEditorPlugin.isUnsatisfied()) {\n            for (DataSetEditorPlugin plugin : dataSetEditorPlugin) {\n                if (plugin.getProviderType().equals(type)) {\n                    workflowClass = plugin.getWorkflowClass();\n                    break;\n                }\n            }\n        }\n        return  (DataSetEditWorkflow) beanManager.lookupBean( workflowClass ).newInstance();\n    }\n\n    /**\n     * Dispose the given workflow instance.\n     */\n    public void dispose(DataSetEditorWorkflow workflow) {\n        workflow.dispose();\n        beanManager.destroyBean(workflow);\n    }\n\n    /**\n     * Obtain the bean for editing the data set definition's provider type.\n     * @return The workflow instance.\n     */\n    public DataSetProviderTypeWorkflow providerType() {\n        return providerTypeWorkflow;\n    }\n\n    /**\n     * Obtain the bean for creating (editing basic attributes to be able to perform a lookup)  a data set definition for a given type.\n     * @param type The data set definition provider type to edit the basic attributes.\n     * @return The workflow instance.\n     */\n    public DataSetBasicAttributesWorkflow basicAttributes(final DataSetProviderType type) {\n        final boolean isSQL = type != null && DataSetProviderType.SQL.equals(type);\n        final boolean isBean = type != null && DataSetProviderType.BEAN.equals(type);\n        final boolean isCSV = type != null && DataSetProviderType.CSV.equals(type);\n        final boolean isPrometheus = type != null && DataSetProviderType.PROMETHEUS.equals(type);\n        final boolean isKafka = type != null && DataSetProviderType.KAFKA.equals(type);\n        \n        Class workflowClass = null;\n        if (isSQL) {\n            workflowClass = SQLDataSetBasicAttributesWorkflow.class;\n        } else if (isCSV) {\n            workflowClass = CSVDataSetBasicAttributesWorkflow.class;\n        } else if (isBean) {\n            workflowClass = BeanDataSetBasicAttributesWorkflow.class;\n        } else if (isPrometheus) {\n            workflowClass = PrometheusDataSetBasicAttributesWorkflow.class;            \n        } else if (isKafka) {\n            workflowClass = KafkaDataSetBasicAttributesWorkflow.class;            \n        } else if (!dataSetEditorPlugin.isUnsatisfied()) {\n            for (DataSetEditorPlugin plugin : dataSetEditorPlugin) {\n                if (plugin.getProviderType().equals(type)) {\n                    workflowClass = plugin.getBasicAttributesWorkflowClass();\n                    break;\n                }\n            }\n        }\n        return  (DataSetBasicAttributesWorkflow) beanManager.lookupBean( workflowClass ).newInstance();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/DataSetEditorWorkflowView.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.gwtbootstrap3.client.ui.Popover;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.mvp.Command;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>The Data Set workflow editor view.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetEditorWorkflowView extends Composite implements DataSetEditorWorkflow.View {\n\n    interface Binder extends UiBinder<Widget, DataSetEditorWorkflowView> {\n        Binder BINDER = GWT.create(Binder.class);\n    }\n\n    @UiField\n    Container container;\n\n    @UiField\n    Column buttonsPanel;\n\n    DataSetEditorWorkflow presenter;\n\n    @Override\n    public void init(final DataSetEditorWorkflow presenter) {\n        this.presenter = presenter;\n        initWidget(Binder.BINDER.createAndBindUi(this));\n    }\n\n    @Override\n    public DataSetEditorWorkflow.View add(IsWidget widget) {\n        container.add(widget.asWidget());\n        return this;\n    }\n\n    @Override\n    public DataSetEditorWorkflow.View addButton(final String text, final String content, final boolean isPrimary, final Command clickCommand) {\n        final Button button = new Button(text);\n        if (isPrimary) {\n            button.setType(ButtonType.PRIMARY);\n        }\n\n        final Tooltip tooltip = new Tooltip(button);\n        tooltip.setTitle(content);\n        tooltip.setContainer(\"body\");\n        tooltip.setPlacement(Placement.BOTTOM);\n        tooltip.setShowDelayMs(500);\n        tooltip.setHideDelayMs(100);\n\n        buttonsPanel.add(tooltip);\n\n        button.addClickHandler(e -> {\n            tooltip.hide();\n            clickCommand.execute();\n        });\n        return this;\n    }\n\n    @Override\n    public DataSetEditorWorkflow.View clearButtons() {\n        buttonsPanel.clear();\n        return this;\n    }\n\n    @Override\n    public DataSetEditorWorkflow.View clearView() {\n        container.clear();\n        clearButtons();\n        return this;\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/DataSetEditorWorkflowView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .mainPanel {\n      font-size: 11pt;\n      margin: 10px;\n    }\n    .buttonsPanel {\n      margin-top: 10px;\n    }\n  </ui:style>\n  \n  <g:FlowPanel addStyleNames=\"{style.mainPanel}\">\n    <b:Container ui:field=\"container\" fluid=\"true\"/>\n    <b:Container fluid=\"true\" addStyleNames=\"{style.buttonsPanel}\">\n      <b:Row>\n        <b:Column size=\"MD_12\" ui:field=\"buttonsPanel\"/>\n      </b:Row>\n    </b:Container>\n  </g:FlowPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/BeanDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.BeanDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.BeanDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>Bean Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class BeanDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<BeanDataSetDef, BeanDataSetDefAttributesEditor> {\n\n    @Inject\n    public BeanDataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,\n                                              final DataSetValidatorProvider validatorProvider,\n                                              final SyncBeanManager beanManager,\n                                              final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                              final Event<SaveRequestEvent> saveRequestEvent,\n                                              final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                              final Event<CancelRequestEvent> cancelRequestEvent,\n                                              final View view) {\n        super(clientServices, validatorProvider, beanManager, basicAttributesEditor, saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<BeanDataSetDef, BeanDataSetDefAttributesEditor>> getDriverClass() {\n        return BeanDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends BeanDataSetDefAttributesEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetDefAttributesEditor.class;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/CSVDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.CSVDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.CSVDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>CSV Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class CSVDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<CSVDataSetDef, CSVDataSetDefAttributesEditor> {\n\n    @Inject\n    public CSVDataSetBasicAttributesWorkflow( final DataSetClientServices clientServices,\n                                              final DataSetValidatorProvider validatorProvider,\n                                              final SyncBeanManager beanManager,\n                                              final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                              final Event<SaveRequestEvent> saveRequestEvent,\n                                              final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                              final Event<CancelRequestEvent> cancelRequestEvent,\n                                              final View view ) {\n\n        super( clientServices,\n               validatorProvider,\n               beanManager,\n               basicAttributesEditor,\n               saveRequestEvent,\n               testDataSetEvent,\n               cancelRequestEvent,\n               view );\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<CSVDataSetDef, CSVDataSetDefAttributesEditor>> getDriverClass() {\n        return CSVDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends CSVDataSetDefAttributesEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetDefAttributesEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes( getDataSetDef(), editor.isUsingFilePath() );\n    }\n\n    @Override\n    protected void afterFlush() {\n        super.afterFlush();\n        if ( !editor.isUsingFilePath() ) {\n            dataSetDef.setFilePath( null );\n        } else {\n            dataSetDef.setFileURL( null );\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/DataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataSetDefBasicAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.mvp.Command;\n\n\n/**\n * <p>Data Set Editor workflow presenter for creating a data set definition instance.</p>\n * <p>GWT editors and drivers must be type safe as they're generated during the deferred binding at compile time, so this class must be extended using concretes types for each driver & editor.</p>\n *\n * @since 0.4.0\n */\npublic abstract class DataSetBasicAttributesWorkflow<T extends DataSetDef, E extends Editor<? super T>> extends DataSetEditorWorkflow<T> {\n\n    DataSetDefBasicAttributesEditor basicAttributesEditor;\n    DataSetDefBasicAttributesDriver dataSetDefBasicAttributesDriver;\n\n    SimpleBeanEditorDriver<T, E> driver;\n    E editor;\n\n    @Inject\n    public DataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,\n                                          final DataSetValidatorProvider validatorProvider,\n                                          final SyncBeanManager beanManager,\n                                          final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                          final Event<SaveRequestEvent> saveRequestEvent,\n                                          final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                          final Event<CancelRequestEvent> cancelRequestEvent,\n                                          final View view) {\n\n        super(clientServices, validatorProvider, beanManager,\n                saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n        this.basicAttributesEditor = basicAttributesEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        super.init();\n    }\n\n    protected abstract Class<? extends SimpleBeanEditorDriver<T, E>> getDriverClass();\n\n    protected abstract Class<? extends E> getEditorClass();\n\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes( getDataSetDef() );\n    }\n\n    public DataSetBasicAttributesWorkflow edit(final T def) {\n        checkDataSetDefNotNull(def);\n\n        clear();\n        this.dataSetDef = def;\n        return this;\n    }\n\n    public DataSetEditorWorkflow basicAttributesEdition() {\n        checkDataSetDefNotNull();\n\n        dataSetDefBasicAttributesDriver = beanManager.lookupBean(DataSetDefBasicAttributesDriver.class).newInstance();\n        dataSetDefBasicAttributesDriver.initialize(basicAttributesEditor);\n        dataSetDefBasicAttributesDriver.edit(getDataSetDef());\n\n        driver = beanManager.lookupBean( getDriverClass() ).newInstance();\n        editor = beanManager.lookupBean( getEditorClass() ).newInstance();\n        driver.initialize(editor);\n        driver.edit(getDataSetDef());\n\n        this.flushCommand = new Command() {\n            @Override\n            public void execute() {\n                flush(dataSetDefBasicAttributesDriver);\n                flush(driver);\n            }\n        };\n\n        this.stepValidator = new Command() {\n            @Override\n            public void execute() {\n\n                // Data set definition basic attributes validation.\n                Iterable<ConstraintViolation<?>> basicAttsViolations = validatorProvider.validateBasicAttributes(getDataSetDef());\n                dataSetDefBasicAttributesDriver.setConstraintViolations(basicAttsViolations);\n                addViolations(basicAttsViolations);\n\n                Iterable<ConstraintViolation<?>> violations = validate();\n                driver.setConstraintViolations(violations);\n                addViolations(violations);\n            }\n        };\n\n        // Show the view.\n        view.clearView();\n        view.add(basicAttributesEditor.asWidget());\n        view.add(((IsWidget) editor));\n\n        return this;\n    }\n\n    /**\n     * For unit tests use cases.\n     */\n    void _setDataSetDef(final T def) {\n        this.dataSetDef = def;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/DataSetProviderTypeWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefProviderTypeEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataSetDefProviderTypeDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.DataSetDefCreationRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * <p>Data Set Editor workflow presenter for creating a data set definition instance by selecting the provider type.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class DataSetProviderTypeWorkflow extends DataSetEditorWorkflow<DataSetDef> {\n\n    DataSetDefProviderTypeEditor providerTypeEditor;\n    DataSetDefProviderTypeDriver dataSetDefProviderTypeDriver;\n\n    @Inject\n    public DataSetProviderTypeWorkflow(final DataSetClientServices clientServices,\n                                       final DataSetValidatorProvider validatorProvider,\n                                       final SyncBeanManager beanManager,\n                                       final DataSetDefProviderTypeEditor providerTypeEditor,\n                                       final Event<SaveRequestEvent> saveRequestEvent,\n                                       final Event<CancelRequestEvent> cancelRequestEvent,\n                                       final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                       final View view) {\n\n        super(clientServices,\n              validatorProvider,\n              beanManager,\n              saveRequestEvent,\n              testDataSetEvent,\n              cancelRequestEvent,\n              view);\n\n        this.providerTypeEditor = providerTypeEditor;\n    }\n\n    @PostConstruct\n    public void init() {\n        super.init();\n    }\n\n    public DataSetProviderTypeWorkflow edit(final DataSetDef def) {\n        checkDataSetDefNotNull(def);\n\n        clear();\n        this.dataSetDef = def;\n        return this;\n    }\n\n    public DataSetProviderType getProviderType() {\n        return providerTypeEditor.provider().getValue();\n    }\n\n    public DataSetProviderTypeWorkflow providerTypeEdition() {\n        checkDataSetDefNotNull();\n\n        // Provider type editor driver edition.\n        dataSetDefProviderTypeDriver = beanManager.lookupBean(DataSetDefProviderTypeDriver.class).newInstance();\n        dataSetDefProviderTypeDriver.initialize(providerTypeEditor);\n        dataSetDefProviderTypeDriver.edit(getDataSetDef());\n\n        this.flushCommand = () -> {\n            flush(dataSetDefProviderTypeDriver);\n        };\n\n        this.stepValidator = () -> {\n            Iterable<ConstraintViolation<?>> violations = validatorProvider.validateProviderType(getDataSetDef());\n            dataSetDefProviderTypeDriver.setConstraintViolations(violations);\n            addViolations(violations);\n        };\n\n        // Show provider type editor view.\n        view.clearView();\n        view.add(providerTypeEditor.asWidget());\n\n        return this;\n    }\n\n    void onProviderTypeSelected(@Observes DataSetDefCreationRequestEvent event) {\n        PortablePreconditions.checkNotNull(\"CreateDataSetDefRequestEvent\",\n                                           event);\n        if (event.getContext().equals(providerTypeEditor)) {\n            super.saveButtonCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/KafkaDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.KafkaDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.kafka.KafkaDataSetDefAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>Kafka Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n */\n@Dependent\npublic class KafkaDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<KafkaDataSetDef, KafkaDataSetDefAttributesEditor> {\n\n    @Inject\n    public KafkaDataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,\n                                               final DataSetValidatorProvider validatorProvider,\n                                               final SyncBeanManager beanManager,\n                                               final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                               final Event<SaveRequestEvent> saveRequestEvent,\n                                               final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                               final Event<CancelRequestEvent> cancelRequestEvent,\n                                               final View view) {\n\n        super(clientServices,\n              validatorProvider,\n              beanManager,\n              basicAttributesEditor,\n              saveRequestEvent,\n              testDataSetEvent,\n              cancelRequestEvent,\n              view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<KafkaDataSetDef, KafkaDataSetDefAttributesEditor>> getDriverClass() {\n        return KafkaDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends KafkaDataSetDefAttributesEditor> getEditorClass() {\n        return KafkaDataSetDefAttributesEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes(getDataSetDef());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/PrometheusDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.PrometheusDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.PrometheusDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>Prometheus Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n */\n@Dependent\npublic class PrometheusDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<PrometheusDataSetDef, PrometheusDataSetDefAttributesEditor> {\n\n    @Inject\n    public PrometheusDataSetBasicAttributesWorkflow(final DataSetClientServices clientServices,\n                                                    final DataSetValidatorProvider validatorProvider,\n                                                    final SyncBeanManager beanManager,\n                                                    final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                                    final Event<SaveRequestEvent> saveRequestEvent,\n                                                    final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                                    final Event<CancelRequestEvent> cancelRequestEvent,\n                                                    final View view) {\n\n        super(clientServices,\n              validatorProvider,\n              beanManager,\n              basicAttributesEditor,\n              saveRequestEvent,\n              testDataSetEvent,\n              cancelRequestEvent,\n              view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<PrometheusDataSetDef, PrometheusDataSetDefAttributesEditor>> getDriverClass() {\n        return PrometheusDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends PrometheusDataSetDefAttributesEditor> getEditorClass() {\n        return PrometheusDataSetDefAttributesEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes(getDataSetDef());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/SQLDataSetBasicAttributesWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.SQLDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefAttributesEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>SQL Data Set Editor workflow presenter for setting data set definition basic attributes.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class SQLDataSetBasicAttributesWorkflow extends DataSetBasicAttributesWorkflow<SQLDataSetDef, SQLDataSetDefAttributesEditor> {\n\n    @Inject\n    public SQLDataSetBasicAttributesWorkflow( final DataSetClientServices clientServices,\n                                              final DataSetValidatorProvider validatorProvider,\n                                              final SyncBeanManager beanManager,\n                                              final DataSetDefBasicAttributesEditor basicAttributesEditor,\n                                              final Event<SaveRequestEvent> saveRequestEvent,\n                                              final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                              final Event<CancelRequestEvent> cancelRequestEvent,\n                                              final View view ) {\n\n        super( clientServices,\n               validatorProvider,\n               beanManager,\n               basicAttributesEditor,\n               saveRequestEvent,\n               testDataSetEvent,\n               cancelRequestEvent,\n               view );\n    }\n\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<SQLDataSetDef, SQLDataSetDefAttributesEditor>> getDriverClass() {\n        return SQLDataSetDefAttributesDriver.class;\n    }\n\n    @Override\n    protected Class<? extends SQLDataSetDefAttributesEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetDefAttributesEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate() {\n        return validatorProvider.validateAttributes( getDataSetDef(), editor.isUsingQuery() );\n    }\n\n    @Override\n    protected void afterFlush() {\n        super.afterFlush();\n        if ( editor.isUsingQuery() ) {\n            dataSetDef.setDbTable( null );\n        } else {\n            dataSetDef.setDbSQL( null );\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/BeanDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.BeanDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.BeanDataSetDefEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>Bean Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class BeanDataSetEditWorkflow extends DataSetEditWorkflow<BeanDataSetDef, BeanDataSetDefEditor> {\n\n    @Inject\n    public BeanDataSetEditWorkflow(final DataSetClientServices clientServices,\n                                   final DataSetValidatorProvider validatorProvider,\n                                   final SyncBeanManager beanManager,\n                                   final Event<SaveRequestEvent> saveRequestEvent,\n                                   final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                   final Event<CancelRequestEvent> cancelRequestEvent,\n                                   final View view) {\n        super(clientServices, validatorProvider, beanManager, saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<BeanDataSetDef, BeanDataSetDefEditor>> getDriverClass() {\n        return BeanDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends BeanDataSetDefEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetEditor.class;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/CSVDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.CSVDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.CSVDataSetDefEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>CSV Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class CSVDataSetEditWorkflow extends DataSetEditWorkflow<CSVDataSetDef, CSVDataSetDefEditor> {\n\n    @Inject\n    public CSVDataSetEditWorkflow(final DataSetClientServices clientServices,\n                                   final DataSetValidatorProvider validatorProvider,\n                                   final SyncBeanManager beanManager,\n                                   final Event<SaveRequestEvent> saveRequestEvent,\n                                   final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                   final Event<CancelRequestEvent> cancelRequestEvent,\n                                   final View view) {\n        super(clientServices, validatorProvider, beanManager, saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n    }\n\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<CSVDataSetDef, CSVDataSetDefEditor>> getDriverClass() {\n        return CSVDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends CSVDataSetDefEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate( boolean isCacheEnabled,\n                                                         boolean isPushEnabled,\n                                                         boolean isRefreshEnabled ) {\n\n        return validatorProvider.validate( dataSetDef,\n                                           isCacheEnabled,\n                                           isPushEnabled,\n                                           isRefreshEnabled, editor.isUsingFilePath() );\n    }\n\n    @Override\n    protected void afterFlush() {\n        super.afterFlush();\n        if (!editor.isUsingFilePath()) {\n            dataSetDef.setFilePath(null);\n        } else {\n            dataSetDef.setFileURL(null);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/DataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.DataSetDefEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.mvp.Command;\n\n\n/**\n * <p>Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>GWT editors and drivers must be type safe as they're generated during the deferred binding at compile time, so this class must be extended using concretes types for each driver & editor.</p>\n * @since 0.4.0\n */\npublic abstract class DataSetEditWorkflow<T extends DataSetDef, E extends DataSetDefEditor<? super T>> extends DataSetEditorWorkflow<T> {\n\n    protected SimpleBeanEditorDriver<T, E> driver;\n    protected E editor;\n\n    @Inject\n    public DataSetEditWorkflow( final DataSetClientServices clientServices,\n                                final DataSetValidatorProvider validatorProvider,\n                                final SyncBeanManager beanManager,\n                                final Event<SaveRequestEvent> saveRequestEvent,\n                                final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                final Event<CancelRequestEvent> cancelRequestEvent,\n                                final View view ) {\n        super( clientServices, validatorProvider, beanManager,\n               saveRequestEvent, testDataSetEvent, cancelRequestEvent, view );\n    }\n\n    @PostConstruct\n    public void init() {\n        super.init();\n    }\n\n    protected abstract Class<? extends SimpleBeanEditorDriver<T, E>> getDriverClass();\n\n    protected abstract Class<? extends E> getEditorClass();\n\n    protected Iterable<ConstraintViolation<?>> validate( boolean isCacheEnabled,\n                                                         boolean isPushEnabled,\n                                                         boolean isRefreshEnabled ) {\n\n        return validatorProvider.validate( dataSetDef,\n                                           isCacheEnabled,\n                                           isPushEnabled,\n                                           isRefreshEnabled );\n    }\n\n    public DataSetEditWorkflow edit( final T definition, List<DataColumnDef> allColumns ) {\n        clear();\n        this.dataSetDef = definition;\n        checkDataSetDefNotNull();\n\n        this.driver = beanManager.lookupBean( getDriverClass() ).newInstance();\n        this.editor = beanManager.lookupBean( getEditorClass() ).newInstance();\n        driver.initialize( editor );\n        editor.setAcceptableValues( allColumns );\n        driver.edit( definition );\n\n        this.flushCommand = () -> flush(DataSetEditWorkflow.this.driver);\n        this.stepValidator = () -> {\n            final boolean isCacheEnabled = definition.isCacheEnabled();\n            final boolean isPushEnabled = definition.isPushEnabled();\n            final boolean isRefreshEnabled = definition.getRefreshTime() != null;\n            Iterable<ConstraintViolation<?>> violations = validate( isCacheEnabled,\n                                                                    isPushEnabled,\n                                                                    isRefreshEnabled );\n            driver.setConstraintViolations( violations );\n            addViolations( violations );\n        };\n\n        // Show data set editor view.\n        view.clearView();\n        view.add( getWidget() );\n\n        return this;\n    }\n\n    @Override\n    public void dispose() {\n        if (driver != null) {\n            beanManager.destroyBean(driver);\n        }\n        if (editor != null) {\n            beanManager.destroyBean(editor);\n        }\n    }\n\n    public E getEditor() {\n        return editor;\n    }\n\n    @Override\n    protected void afterFlush() {\n        super.afterFlush();\n        if ( !getEditor().refreshEditor().isRefreshEnabled() ) {\n            dataSetDef.setRefreshTime( null );\n        }\n    }\n\n    protected org.dashbuilder.client.widgets.dataset.editor.DataSetEditor getWidget() {\n        return ( (org.dashbuilder.client.widgets.dataset.editor.DataSetEditor) editor );\n    }\n\n    public DataSetEditorWorkflow showConfigurationTab() {\n        getWidget().showConfigurationTab();\n        return this;\n    }\n\n    public DataSetEditorWorkflow showPreviewTab() {\n        getWidget().showPreviewTab();\n        return this;\n    }\n\n    public DataSetEditorWorkflow showAdvancedTab() {\n        getWidget().showAdvancedTab();\n        return this;\n    }\n\n    /**\n     * For unit tests use cases.\n     */\n    void _setDataSetDef( final T def ) {\n        this.dataSetDef = def;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/KafkaDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.KafkaDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.kafka.KafkaDataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.KafkaDataSetDefEditor;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>Kafka Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n *\n */\n@Dependent\npublic class KafkaDataSetEditWorkflow extends DataSetEditWorkflow<KafkaDataSetDef, KafkaDataSetDefEditor> {\n\n    @Inject\n    public KafkaDataSetEditWorkflow(final DataSetClientServices clientServices,\n                                    final DataSetValidatorProvider validatorProvider,\n                                    final SyncBeanManager beanManager,\n                                    final Event<SaveRequestEvent> saveRequestEvent,\n                                    final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                    final Event<CancelRequestEvent> cancelRequestEvent,\n                                    final View view) {\n        super(clientServices, validatorProvider, beanManager, saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<KafkaDataSetDef, KafkaDataSetDefEditor>> getDriverClass() {\n        return KafkaDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends KafkaDataSetDefEditor> getEditorClass() {\n        return KafkaDataSetEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate(boolean isCacheEnabled,\n                                                        boolean isPushEnabled,\n                                                        boolean isRefreshEnabled) {\n\n        return validatorProvider.validate(dataSetDef,\n                                          isCacheEnabled,\n                                          isPushEnabled,\n                                          isRefreshEnabled);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/PrometheusDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.PrometheusDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.prometheus.PrometheusDataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.PrometheusDataSetDefEditor;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * <p>Prometheus Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n *\n */\n@Dependent\npublic class PrometheusDataSetEditWorkflow extends DataSetEditWorkflow<PrometheusDataSetDef, PrometheusDataSetDefEditor> {\n\n    @Inject\n    public PrometheusDataSetEditWorkflow(final DataSetClientServices clientServices,\n                                         final DataSetValidatorProvider validatorProvider,\n                                         final SyncBeanManager beanManager,\n                                         final Event<SaveRequestEvent> saveRequestEvent,\n                                         final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                         final Event<CancelRequestEvent> cancelRequestEvent,\n                                         final View view) {\n        super(clientServices, validatorProvider, beanManager, saveRequestEvent, testDataSetEvent, cancelRequestEvent, view);\n    }\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<PrometheusDataSetDef, PrometheusDataSetDefEditor>> getDriverClass() {\n        return PrometheusDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends PrometheusDataSetDefEditor> getEditorClass() {\n        return PrometheusDataSetEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate(boolean isCacheEnabled,\n                                                        boolean isPushEnabled,\n                                                        boolean isRefreshEnabled) {\n\n        return validatorProvider.validate(dataSetDef,\n                                          isCacheEnabled,\n                                          isPushEnabled,\n                                          isRefreshEnabled);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/SQLDataSetEditWorkflow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.SQLDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n\n/**\n * <p>SQL Data Set Editor workflow presenter for editing a data set definition instance.</p>\n * <p>This class is the main entry point for editing an existing data set definition instance. It links the gwt editors with the given driver to perform flushing and validations.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class SQLDataSetEditWorkflow extends DataSetEditWorkflow<SQLDataSetDef, SQLDataSetDefEditor> {\n\n    @Inject\n    public SQLDataSetEditWorkflow( final DataSetClientServices clientServices,\n                                   final DataSetValidatorProvider validatorProvider,\n                                   final SyncBeanManager beanManager,\n                                   final Event<SaveRequestEvent> saveRequestEvent,\n                                   final Event<TestDataSetRequestEvent> testDataSetEvent,\n                                   final Event<CancelRequestEvent> cancelRequestEvent,\n                                   final View view ) {\n        super( clientServices,\n               validatorProvider,\n               beanManager,\n               saveRequestEvent,\n               testDataSetEvent,\n               cancelRequestEvent,\n               view );\n    }\n\n\n    @Override\n    protected Class<? extends SimpleBeanEditorDriver<SQLDataSetDef, SQLDataSetDefEditor>> getDriverClass() {\n        return SQLDataSetDefDriver.class;\n    }\n\n    @Override\n    protected Class<? extends SQLDataSetDefEditor> getEditorClass() {\n        return org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetEditor.class;\n    }\n\n    @Override\n    protected Iterable<ConstraintViolation<?>> validate( boolean isCacheEnabled,\n                                                         boolean isPushEnabled,\n                                                         boolean isRefreshEnabled ) {\n\n        return validatorProvider.validate( dataSetDef,\n                                           isCacheEnabled,\n                                           isPushEnabled,\n                                           isRefreshEnabled,\n                                           editor.isUsingQuery() );\n    }\n\n    @Override\n    protected void afterFlush() {\n        super.afterFlush();\n        if ( editor.isUsingQuery() ) {\n            dataSetDef.setDbTable( null );\n        } else {\n            dataSetDef.setDbSQL( null );\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/CancelRequestEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\n\n/**\n * <p>CDI event when a cancel operation is requested.</p>\n *\n * @since 0.4.0\n */\npublic class CancelRequestEvent extends ContextualEvent {\n\n    public CancelRequestEvent(Object context) {\n        super(context);\n    }\n\n    @Override\n    public String toString() {\n        return \"CancelRequestEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/ColumnsChangedEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\nimport org.dashbuilder.dataset.def.DataColumnDef;\n\nimport java.util.List;\n\n/**\n * <p>CDI event when data set definition instance columns have changed.</p>\n *\n * @since 0.4.0\n */\npublic class ColumnsChangedEvent extends ContextualEvent {\n\n    private List<DataColumnDef> columns;\n\n    public ColumnsChangedEvent(Object context, List<DataColumnDef> columns) {\n        super(context);\n        this.columns = columns;\n    }\n\n    public List<DataColumnDef> getColumns() {\n        return columns;\n    }\n\n    @Override\n    public String toString() {\n        return \"ColumnsChangedEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/DataSetDefCreationRequestEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\n\n/**\n * <p>CDI event fired when a data set definition creation request is requested.</p>\n *\n * @since 0.6.0\n */\npublic class DataSetDefCreationRequestEvent extends ContextualEvent {\n\n    DataSetProviderType providerType;\n\n    public DataSetDefCreationRequestEvent(Object context, DataSetProviderType providerType) {\n        super(context);\n        this.providerType = providerType;\n    }\n\n    public DataSetProviderType getProviderType() {\n        return providerType;\n    }\n\n    @Override\n    public String toString() {\n        return \"DataSetDefCreationRequestEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/EditDataSetEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>CDI event to request a data set definition edition.</p>\n * \n * @since 0.4.0\n */\npublic class EditDataSetEvent implements UberFireEvent {\n\n    private final DataSetDef def;\n\n    public EditDataSetEvent(final DataSetDef def) {\n        this.def = def;\n    }\n\n    public DataSetDef getDef() {\n        return def;\n    }\n\n    @Override\n    public String toString() {\n        return \"EditDataSetEvent [UUID=\" + def.getUUID() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/ErrorEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.common.client.event.ContextualEvent;\n\n/**\n * <p>CDI event when a operation produces an error.</p>\n *\n * @since 0.4.0\n */\npublic class ErrorEvent extends ContextualEvent {\n\n    private ClientRuntimeError clientRuntimeError;\n    private String uuid;\n    private String message;\n\n    public ErrorEvent(final Object context, final ClientRuntimeError clientRuntimeError) {\n        super(context);\n        this.clientRuntimeError = clientRuntimeError;\n    }\n\n    public ErrorEvent(final Object context, final ClientRuntimeError clientRuntimeError, final String uuid) {\n        this(context, clientRuntimeError);\n        this.uuid = uuid;\n        \n    }\n\n    public ErrorEvent(final Object context, final String message, final String uuid) {\n        super(context);\n        this.message = message;\n        this.uuid = uuid;\n    }\n\n    public ErrorEvent(final Object context) {\n        super(context);\n    }\n\n    public ClientRuntimeError getClientRuntimeError() {\n        return clientRuntimeError;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public String getUUID() {\n        return uuid;\n    }\n\n    @Override\n    public String toString() {\n        return \"ErrorEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/FilterChangedEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\n\n/**\n * <p>CDI event when data set definition's filter instance has changed.</p>\n *\n * @since 0.4.0\n */\npublic class FilterChangedEvent extends ContextualEvent {\n\n    private DataSetFilter oldFilter;\n    private DataSetFilter filter;\n\n    public FilterChangedEvent(Object context, DataSetFilter oldFilter, DataSetFilter filter) {\n        super(context);\n        this.oldFilter = oldFilter;\n        this.filter = filter;\n    }\n\n    public DataSetFilter getFilter() {\n        return filter;\n    }\n\n    public DataSetFilter getOldFilter() {\n        return oldFilter;\n    }\n\n    @Override\n    public String toString() {\n        return \"FilterChangedEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/SaveRequestEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\n\n/**\n * <p>CDI event when a save operation is requested.</p>\n *\n * @since 0.4.0\n */\npublic class SaveRequestEvent extends ContextualEvent {\n\n    public SaveRequestEvent(Object context) {\n        super(context);\n    }\n\n    @Override\n    public String toString() {\n        return \"SaveRequestEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/TabChangedEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\n\n/**\n * <p>CDI event when a tab is changed.</p>\n *\n * @since 0.4.0\n */\npublic class TabChangedEvent extends ContextualEvent {\n\n    private String tabId;\n\n    public TabChangedEvent(Object context, String tabId) {\n        super(context);\n        this.tabId = tabId;\n    }\n\n    public String getTabId() {\n        return tabId;\n    }\n\n    @Override\n    public String toString() {\n        return \"TabChangedEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/event/TestDataSetRequestEvent.java",
    "content": "package org.dashbuilder.client.widgets.dataset.event;\n\nimport org.dashbuilder.common.client.event.ContextualEvent;\n\n/**\n * <p>CDI event when a test data set operation is requested.</p>\n *\n * @since 0.4.0\n */\npublic class TestDataSetRequestEvent extends ContextualEvent {\n\n    public TestDataSetRequestEvent(Object context) {\n        super(context);\n    }\n\n    @Override\n    public String toString() {\n        return \"SaveRequestEvent [Context=\" + getContext().toString() + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetExplorer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.dashbuilder.dataprovider.DataSetProviderType.*;\n\n/**\n * <p>Data Set Explorer widget.</p>\n *\n * @since 0.3.0\n */\n@Dependent\npublic class DataSetExplorer implements IsWidget {\n\n    public interface View extends UberView<DataSetExplorer> {\n\n        View addPanel(final DataSetPanel.View panelView);\n\n        View clear();\n    }\n\n    List<DataSetProviderType> SUPPORTED_TYPES = Arrays.asList(BEAN,\n                                                              CSV,\n                                                              SQL,\n                                                              PROMETHEUS,\n                                                              KAFKA);\n\n    Instance<DataSetPanel> panelInstances;\n    DataSetClientServices clientServices;\n    View view;\n    List<DataSetPanel> panels = new LinkedList<DataSetPanel>();\n    \n    ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n\n    @Inject\n    public DataSetExplorer(final Instance<DataSetPanel> panelInstances,\n                           final DataSetClientServices clientServices,\n                           final View view,\n                           final ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin) {\n        this.panelInstances = panelInstances;\n        this.clientServices = clientServices;\n        this.view = view;\n        this.dataSetEditorPlugin = dataSetEditorPlugin;\n    }\n\n    @PostConstruct\n    public void init() {\n                \n        if (!dataSetEditorPlugin.isUnsatisfied()) {\n            List<DataSetProviderType> allTypes = new ArrayList<DataSetProviderType>(SUPPORTED_TYPES);\n            \n            for (DataSetEditorPlugin plugin : dataSetEditorPlugin) {\n                allTypes.add(plugin.getProviderType());\n            }\n            \n            SUPPORTED_TYPES = allTypes;\n        }\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show() {\n        clear();\n\n        clientServices.getPublicDataSetDefs(dataSetDefs -> {\n            if (dataSetDefs != null && !dataSetDefs.isEmpty()) {\n                dataSetDefs.stream()\n                        .filter(DataSetExplorer.this::isSupported)\n                        .sorted((o1, o2) -> o1.getName().compareTo(o2.getName()))\n                        .forEach(DataSetExplorer.this::addDataSetDef);\n            }\n        });\n    }\n\n    private boolean isSupported(DataSetDef def) {\n        return SUPPORTED_TYPES.contains(def.getProvider());\n    }\n\n    private void addDataSetDef(final DataSetDef def) {\n        // Check panel for the given data set does not exists yet and it is supported as well\n        if (getDataSetPanel(def.getUUID()) == null) {\n            final DataSetPanel panel = panelInstances.get();\n            panels.add(panel);\n            panel.show(def,\n                       \"dataSetsExplorerPanelGroup\");\n            view.addPanel(panel.view);\n        }\n    }\n\n    private void updateDataSetDef(final DataSetDef def) {\n        DataSetPanel panel = getDataSetPanel(def.getUUID());\n        if (panel != null) {\n            panel.show(def,\n                       \"dataSetsExplorerPanelGroup\");\n            panel.close();\n        }\n    }\n\n    private DataSetPanel getDataSetPanel(final String uuid) {\n        if (uuid != null) {\n            for (final DataSetPanel panel : panels) {\n                if (panel.getDataSetDef().getUUID().equals(uuid)) {\n                    return panel;\n                }\n            }\n        }\n        return null;\n    }\n\n    private void clear() {\n        panels.clear();\n        view.clear();\n    }\n\n    // Be aware of data set lifecycle events\n\n    void onDataSetDefRegisteredEvent(@Observes DataSetDefRegisteredEvent event) {\n        checkNotNull(\"event\",\n                     event);\n\n        final DataSetDef def = event.getDataSetDef();\n        if (def != null && def.isPublic() && isSupported(def)) {\n            // Reload the whole data set panels list.\n            show();\n        }\n    }\n\n    void onDataSetDefModifiedEvent(@Observes DataSetDefModifiedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n\n        final DataSetDef def = event.getNewDataSetDef();\n        if (def != null && def.isPublic()) {\n            updateDataSetDef(def);\n        }\n    }\n\n    void onDataSetDefRemovedEvent(@Observes DataSetDefRemovedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        final DataSetDef def = event.getDataSetDef();\n        if (def != null && def.isPublic()) {\n            // Reload the whole data set panels list.\n            show();\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetExplorerView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Default view for DataSetPanel presenter.</p>\n * \n * @since 0.3.0\n */\n@Dependent\npublic class DataSetExplorerView extends Composite implements DataSetExplorer.View {\n\n    interface DataSetExplorerViewBinder extends UiBinder<Widget, DataSetExplorerView> {}\n    private static DataSetExplorerViewBinder uiBinder = GWT.create(DataSetExplorerViewBinder.class);\n\n    interface DataSetExplorerViewStyle extends CssResource {\n    }\n\n    @UiField\n    DataSetExplorerViewStyle style;\n\n    @UiField\n    com.google.gwt.user.client.ui.Label emptyLabel;\n\n    @UiField\n    PanelGroup dataSetsPanelGroup;\n\n    private DataSetExplorer presenter;\n\n    public DataSetExplorerView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n    \n    @Override\n    public void init(final DataSetExplorer presenter)\n    {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public DataSetExplorer.View addPanel(final DataSetPanel.View panelView) {\n        dataSetsPanelGroup.add(panelView);\n        emptyLabel.setVisible(false);\n        dataSetsPanelGroup.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public DataSetExplorer.View clear() {\n        dataSetsPanelGroup.clear();\n        dataSetsPanelGroup.setVisible(false);\n        emptyLabel.setVisible(true);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetExplorerView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n    >\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants\"/>\n  <ui:with field='res' type='org.dashbuilder.dataset.client.resources.bundles.DataSetClientImages'/>\n  \n  <ui:style type=\"org.dashbuilder.client.widgets.dataset.explorer.DataSetExplorerView.DataSetExplorerViewStyle\">\n    .mainPanel {\n      width: 100%;\n    }\n    .errorPanel {\n      margin: 25px;\n    }\n    .errorRow {\n      margin-bottom: 10px;\n    }\n    .errorLabel {\n      font-weight: bold;\n\n    }\n    .emptyLabel {\n      padding: 10px 20px;\n      text-align: center;\n    }\n  </ui:style>\n\n  <g:HTMLPanel addStyleNames=\"{style.mainPanel} \">\n\n    <g:Label visible=\"false\" ui:field=\"emptyLabel\" text=\"{i18n.noDataSets}\" addStyleNames=\"{style.emptyLabel}\"/>\n\n    <g:FlowPanel>\n      <b:PanelGroup ui:field=\"dataSetsPanelGroup\" b:id=\"dataSetsExplorerPanelGroup\">\n\n      </b:PanelGroup>\n    </g:FlowPanel>\n\n  </g:HTMLPanel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetPanel.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.client.widgets.dataset.event.EditDataSetEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants;\nimport org.dashbuilder.dataset.client.resources.bundles.DataSetClientResources;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport static org.dashbuilder.dataprovider.DataSetProviderType.*;\n\n/**\n * <p>Data Set Panel widget with a collapsed by default summary.</p>\n * <p>It displays a panel with a header and a collape panel body.</p>\n * \n * @since 0.3.0 \n */\n@Dependent\npublic class DataSetPanel implements IsWidget {\n\n    public interface View extends UberView<DataSetPanel> {\n\n        \n        View configure(final DataSetSummary.View summaryView);\n\n        /**\n         * <p>Displays the summary header's.</p>\n         * @param uuid The data set unique identifier.\n         * @param parentCollapseId The identifier of the parent collage widget to refer for data toggle features.\n         * @param dataSetTypeImageUri The uri for the data set type image.\n         * @param dataSetTypeImageTitle The title for the data set type image.\n         * @param dataSetTitle The title for the data set.\n         * @return The view instance.\n         */\n        View showHeader(final String uuid, final String parentCollapseId, final SafeUri dataSetTypeImageUri,\n                        final String dataSetTypeImageTitle, final String dataSetTitle);\n\n        \n        View showSummary();\n        \n        View hideSummary();\n        \n        View enableActionButton(final String buttonTitle, final ClickHandler clickHandler);\n\n        View disableActionButton();\n        \n    }\n\n    DataSetSummary dataSetSummary;\n    Event<EditDataSetEvent> editDataSetEvent;\n    View view;\n    ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n    \n    DataSetDef def;\n\n    @Inject\n    public DataSetPanel(final DataSetSummary dataSetSummary, \n                        final Event<EditDataSetEvent> editDataSetEvent, \n                        final View view,\n                        final ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin) {\n        this.dataSetSummary = dataSetSummary;\n        this.editDataSetEvent = editDataSetEvent;\n        this.view = view;\n        this.dataSetEditorPlugin = dataSetEditorPlugin;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.configure(dataSetSummary.view);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(final DataSetDef def, final String parentPanelId) {\n        this.def = def;\n        if (def != null) {\n            final String name = def.getName();\n            final SafeUri typeIconUri = getTypeIconUri(def);\n            final String typeName = getTypeIconTitle(def);\n            view.showHeader(def.getUUID(), parentPanelId, typeIconUri, typeName, name);\n        }\n    }\n    \n    public void close() {\n        view.hideSummary();\n    }\n\n    public void disable() {\n        view.disableActionButton();\n    }\n\n    public DataSetDef getDataSetDef() {\n        return def;\n    }\n\n    void open() {\n        dataSetSummary.show(def);\n        view.showSummary();\n\n        view.enableActionButton(DataSetExplorerConstants.INSTANCE.edit(), new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent clickEvent) {\n                editDataSetEvent.fire(new EditDataSetEvent(def));\n            }\n        });;\n    }\n\n    SafeUri getTypeIconUri(final DataSetDef dataSetDef) {\n        if (BEAN.equals(dataSetDef.getProvider())) {\n            return DataSetClientResources.INSTANCE.images().javaIcon32().getSafeUri();\n        }\n        if (CSV.equals(dataSetDef.getProvider())) {\n            return DataSetClientResources.INSTANCE.images().csvIcon32().getSafeUri();\n        }\n        if (SQL.equals(dataSetDef.getProvider())) {\n            return DataSetClientResources.INSTANCE.images().sqlIcon32().getSafeUri();\n        }\n        if (PROMETHEUS.equals(dataSetDef.getProvider())) {\n            return DataSetClientResources.INSTANCE.images().prometheusIcon32().getSafeUri();\n        }\n        if (KAFKA.equals(dataSetDef.getProvider())) {\n            return DataSetClientResources.INSTANCE.images().kafkaIcon32().getSafeUri();\n        }\n        \n        if (!dataSetEditorPlugin.isUnsatisfied()) {\n            for (DataSetEditorPlugin plugin : dataSetEditorPlugin) {\n                if (plugin.getProviderType().equals(dataSetDef.getProvider())) {\n                   return plugin.getTypeSelectorImageUri();\n                }\n            }\n        }\n        return null;\n    }\n\n    String getTypeIconTitle(final DataSetDef dataSetDef) {\n        if (BEAN.equals(dataSetDef.getProvider())) {\n            return DataSetExplorerConstants.INSTANCE.bean();\n        }\n        if (CSV.equals(dataSetDef.getProvider())) {\n            return DataSetExplorerConstants.INSTANCE.csv();\n        }\n        if (SQL.equals(dataSetDef.getProvider())) {\n            return DataSetExplorerConstants.INSTANCE.sql();\n        }\n        if (PROMETHEUS.equals(dataSetDef.getProvider())) {\n            return DataSetExplorerConstants.INSTANCE.prometheus();\n        }\n        if (KAFKA.equals(dataSetDef.getProvider())) {\n            return DataSetExplorerConstants.INSTANCE.kafka();\n        }\n        if (!dataSetEditorPlugin.isUnsatisfied()) {\n            for (DataSetEditorPlugin plugin : dataSetEditorPlugin) {\n                if (plugin.getProviderType().equals(dataSetDef.getProvider())) {\n                   return plugin.getTypeSelectorTitle();\n                }\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetPanelView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.ShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ShowHandler;\nimport org.gwtbootstrap3.client.ui.*;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Default view for DataSetPanel presenter.</p>\n * \n * @since 0.3.0\n */\n@Dependent\npublic class DataSetPanelView extends Composite implements DataSetPanel.View {\n\n    interface DataSetPanelViewBinder extends UiBinder<Widget, DataSetPanelView> {}\n    private static DataSetPanelViewBinder uiBinder = GWT.create(DataSetPanelViewBinder.class);\n\n    interface DataSetPanelViewStyle extends CssResource {\n    }\n\n    @UiField\n    DataSetPanelViewStyle style;\n    \n    @UiField\n    PanelHeader headerPanel;\n    \n    @UiField\n    Image typeIcon;\n\n    @UiField\n    Heading title;\n    \n    @UiField\n    PanelCollapse collapsePanel;\n\n    @UiField\n    PanelBody bodyPanel;\n\n    @UiField(provided = true)\n    DataSetSummary.View summaryView;\n    \n    @UiField\n    Button actionButton;\n\n    private DataSetPanel presenter;\n    private HandlerRegistration actionButtonHandlerRegistration;\n\n    public DataSetPanelView() {\n    }\n    \n    @Override\n    public void init(final DataSetPanel presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public DataSetPanel.View configure(final DataSetSummary.View summaryView) {\n        this.summaryView = summaryView;\n        initWidget(uiBinder.createAndBindUi(this));\n        return this;\n    }\n\n    @Override\n    public DataSetPanel.View showHeader(final String uuid, final String parentCollapseId, \n                                        final SafeUri dataSetTypeImageUri, final String dataSetTypeImageTitle, final String dataSetTitle) {\n        typeIcon.setUrl(dataSetTypeImageUri);\n        typeIcon.setTitle(dataSetTypeImageTitle);\n        typeIcon.setAltText(dataSetTypeImageTitle);\n        title.setText(dataSetTitle);\n        setDynamicToggleId(uuid, parentCollapseId);\n        collapsePanel.addShowHandler(new ShowHandler() {\n            @Override\n            public void onShow(final ShowEvent shownEvent) {\n                presenter.open();\n            }\n        });\n        return this;\n    }\n    \n    private void setDynamicToggleId(final String uuid, final String parentCollapseId) {\n        final String tId = \"collapsePanel\" + uuid;\n        collapsePanel.setId(tId);\n        headerPanel.setDataToggle(Toggle.COLLAPSE);\n        headerPanel.setDataTarget(\"#\" + tId);\n        headerPanel.setDataParent(\"#\" + parentCollapseId);\n    }\n\n    @Override\n    public DataSetPanel.View showSummary() {\n        return this;\n\n    }\n\n    @Override\n    public DataSetPanel.View hideSummary() {\n        collapsePanel.setIn(false);\n        return this;\n    }\n\n    @Override\n    public DataSetPanel.View enableActionButton(final String buttonTitle, final ClickHandler clickHandler) {\n        actionButton.setText(buttonTitle);\n        actionButton.setEnabled(true);\n        if (actionButtonHandlerRegistration != null) {\n            actionButtonHandlerRegistration.removeHandler();\n        }\n        actionButtonHandlerRegistration = actionButton.addClickHandler(clickHandler);\n        return this;\n    }\n\n    @Override\n    public DataSetPanel.View disableActionButton() {\n        actionButton.setEnabled(false);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetPanelView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:explorer=\"urn:import:org.dashbuilder.client.widgets.dataset.explorer\"\n    >\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants\"/>\n  <ui:with field='res' type='org.dashbuilder.dataset.client.resources.bundles.DataSetClientImages'/>\n  \n  <ui:style type=\"org.dashbuilder.client.widgets.dataset.explorer.DataSetPanelView.DataSetPanelViewStyle\">\n    .headerPanel {\n      cursor: pointer;\n    }\n    .actionButtonColumn {\n      text-align: center;\n    }\n    .actionButton {\n      margin-bottom: 10px;\n    }\n    .typeIcon {\n      float: left;\n      height: 16px;\n      width: 16px;\n      margin-right: 5px;\n    }\n  </ui:style>\n\n  <b:Panel>\n    <b:PanelHeader ui:field=\"headerPanel\" addStyleNames=\"{style.headerPanel}\">\n      <b:Image ui:field=\"typeIcon\" addStyleNames=\"{style.typeIcon}\"/>\n      <b:Heading ui:field=\"title\" size=\"H6\"/>\n    </b:PanelHeader>\n    <b:PanelCollapse ui:field=\"collapsePanel\">\n      <b:PanelBody ui:field=\"bodyPanel\">\n        <b:Container fluid=\"true\">\n          <b:Row>\n            <b:Column size=\"MD_12\">\n              <explorer:DataSetSummary.View ui:field=\"summaryView\"/>\n            </b:Column>\n          </b:Row>\n          <b:Row>\n            <b:Column size=\"MD_12\" addStyleNames=\"{style.actionButtonColumn}\">\n              <b:Button ui:field=\"actionButton\" addStyleNames=\"{style.actionButton}\"/>\n            </b:Column>\n          </b:Row>\n        </b:Container>\n      </b:PanelBody>\n    </b:PanelCollapse>\n  </b:Panel>\n  \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetSummary.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.i18n.client.NumberFormat;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetMetadataCallback;\nimport org.dashbuilder.dataset.client.resources.bundles.DataSetClientResources;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.mvp.UberView;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\n/**\n * <p>Data Set Summary widget</p>\n * <p>It displays:</p>\n * <ul>\n *     <li>The current cache status</li>\n *     <li>Current size on backend / client side</li>\n * </ul>\n * \n * @since 0.3.0 \n */\n@Dependent\npublic class DataSetSummary implements IsWidget {\n\n    private final static String ESTIMATIONS_FORMAT = \"#,###.0\";\n    private final static String ICON_COLOR_DEFAULT = \"black\";\n    private final static String ICON_COLOR_ERROR = \"red\";\n    \n    public interface View extends UberView<DataSetSummary> {\n\n        /**\n         * <p>Displays some data set feature's status in a panel.It produces the loading icon in the status panel to be removed from parent.</p>\n         * @param backendCacheStatus The status for the backend cache. If <code>null</code>, the widget for the status will be not displayed.\n         * @param pushEnabled The status for the client push feature. If <code>null</code>, the widget for the status will be not displayed.\n         * @param refreshStatus The status for the refresh feature. If <code>null</code>, the widget for the status will be not displayed.\n         * @return The view instance.\n         */\n        View showStatusPanel(final Boolean backendCacheStatus, final Boolean pushEnabled,\n                             final Boolean refreshStatus);\n\n        /**\n         * <p>Displays an icon icon in the size panel such as a loading or error icon.</p>\n         * @return The view instance.\n         */\n        View showSizePanelIcon(final IconType type, final String title, final String color, final boolean spin);\n        \n        /**\n         * <p>Displays some data set feature's sizes in a panel.</p>\n         * @param backendSizeRow The formatted size value for backend cache (in rows).\n         * @param clientSizeKb The formatted size value for client cache (in KByes).\n         * @return The view instance.\n         */\n        View showSizePanel(final String backendSizeRow, final String clientSizeKb);\n\n    }\n\n    DataSetClientServices clientServices;\n    Event<ErrorEvent> errorEvent;\n    View view;\n\n    @Inject\n    public DataSetSummary(final DataSetClientServices clientServices, \n                          final Event<ErrorEvent> errorEvent, \n                          final View view) {\n        this.clientServices = clientServices;\n        this.errorEvent = errorEvent;\n        this.view = view;\n    }\n    \n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(final DataSetDef def) {\n        if (def != null) {\n            // Cache status panel.\n            final boolean isShowBackendCache = def.getProvider() != null\n                    && ( !DataSetProviderType.BEAN.equals(def.getProvider())\n                    && !DataSetProviderType.CSV.equals(def.getProvider() ));\n            final Boolean isCacheEnabled = isShowBackendCache ? def.isCacheEnabled() : null;\n            final boolean isPushEnabled = def.isPushEnabled();\n            final boolean isRefreshEnabled = def.getRefreshTime() != null;\n            view.showStatusPanel(isCacheEnabled, isPushEnabled, isRefreshEnabled);\n            \n            \n            // Show loading icon on size panel while performing the backend request.\n            showLoadingIcon();\n\n            getMetadata(def, new DataSetMetadataCallback() {\n                @Override\n                public void callback(final DataSetMetadata metadata) {\n                    final int estimatedSize = metadata.getEstimatedSize();\n                    final int rowCount = metadata.getNumberOfRows();\n                    view.showSizePanel(humanReadableRowCount(rowCount) + \" \" + DataSetExplorerConstants.INSTANCE.rows(), \n                            humanReadableByteCount(estimatedSize));\n                }\n\n                @Override\n                public void notFound() {\n                    showErrorIcon();\n                    showError(def.getUUID(), DataSetExplorerConstants.INSTANCE.notFound());\n                    \n                }\n\n                @Override\n                public boolean onError(final ClientRuntimeError error) {\n                    showErrorIcon();\n                    showError(def.getUUID(), error);\n                    return false;\n                }\n            });\n        }\n    }\n\n    String humanReadableByteCount(long bytes) {\n        final String _b = \" \" + DataSetExplorerConstants.INSTANCE.bytes();\n        int unit = 1024;\n        if (bytes < unit) return Long.toString(bytes) + _b;\n        int exp = (int) (Math.log(bytes) / Math.log(unit));\n        String pre = (\"KMGTPE\").charAt(exp-1) + _b;\n        return NumberFormat.getFormat(ESTIMATIONS_FORMAT).format(bytes / Math.pow(unit, exp)) + pre;\n    }\n\n    String humanReadableRowCount(long rows) {\n        int unit = 1000;\n        if (rows < unit) return Long.toString(rows);\n        int exp = (int) (Math.log(rows) / Math.log(unit));\n        String pre = (\"KMGTPE\" ).charAt(exp-1) + (\"\");\n        return NumberFormat.getFormat(ESTIMATIONS_FORMAT).format(rows / Math.pow(unit, exp)) + pre;\n    }\n    \n    private void getMetadata(final DataSetDef def, final DataSetMetadataCallback callback) {\n        try {\n            clientServices.fetchMetadata(def.getUUID(), callback);\n        } catch (Exception e) {\n            showError(def.getUUID(), e);\n        }\n    }\n    \n    void showLoadingIcon() {\n        view.showSizePanelIcon(IconType.REFRESH, DataSetExplorerConstants.INSTANCE.loading(), ICON_COLOR_DEFAULT, true);\n    }\n\n    void showErrorIcon() {\n        view.showSizePanelIcon(IconType.EXCLAMATION_TRIANGLE, DataSetExplorerConstants.INSTANCE.error(), ICON_COLOR_ERROR, false);\n    }\n\n    void showError(final String uuid, final ClientRuntimeError error) {\n        errorEvent.fire(new ErrorEvent(DataSetSummary.this, error, uuid));\n    }\n    \n    void showError(final String uuid, final Throwable throwable) {\n        final String msg = throwable != null ? throwable.getMessage() : DataSetExplorerConstants.INSTANCE.error();\n        errorEvent.fire(new ErrorEvent(DataSetSummary.this, msg, uuid));\n    }\n\n    void showError(final String uuid, final String message) {\n        errorEvent.fire(new ErrorEvent(DataSetSummary.this, message, uuid));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetSummaryView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Span;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * <p>Default view for DataSetSummary presenter.</p>\n * \n * @since 0.3.0\n */\n@Dependent\npublic class DataSetSummaryView extends Composite implements DataSetSummary.View {\n\n    interface DataSetSummaryViewBinder extends UiBinder<Row, DataSetSummaryView> {}\n    private static DataSetSummaryViewBinder uiBinder = GWT.create(DataSetSummaryViewBinder.class);\n\n    interface DataSetSummaryViewStyle extends CssResource {\n    }\n\n    @UiField\n    DataSetSummaryViewStyle style;\n    \n    @UiField\n    Span backendStatus;\n    \n    @UiField\n    Icon backendStatusIcon;\n\n    @UiField\n    Span pushStatus;\n\n    @UiField\n    Icon pushEnabledIcon;\n\n    @UiField\n    Span refreshStatus;\n\n    @UiField\n    Icon refreshEnabledIcon;\n    \n    @UiField\n    Icon statusIcon;\n    \n    @UiField\n    HTML estimatedSizeText;\n\n    @UiField\n    HTML estimatedRowsText;\n    \n    private DataSetSummary presenter;\n\n    public DataSetSummaryView() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n    \n    @Override\n    public void init(final DataSetSummary presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public DataSetSummary.View showStatusPanel(final Boolean backendCacheStatus, final Boolean pushEnabled, final Boolean _refreshStatus) {\n        if (backendCacheStatus != null) {\n            configureStatusIcon(backendStatusIcon, backendCacheStatus);\n            backendStatus.setVisible(true);\n        } else {\n            backendStatus.setVisible(false);\n        }\n        if (pushEnabled != null) {\n            configureStatusIcon(pushEnabledIcon, pushEnabled);\n            pushStatus.setVisible(true);\n        } else {\n            pushStatus.setVisible(false);\n        }\n        if (_refreshStatus != null) {\n            configureStatusIcon(refreshEnabledIcon, _refreshStatus);\n            refreshStatus.setVisible(true);\n        } else {\n            refreshStatus.setVisible(false);\n        }\n        return this;\n    }\n    \n    private void configureStatusIcon(final Icon icon, final boolean value) {\n        final String t = value ? DataSetExplorerConstants.INSTANCE.enabled() : DataSetExplorerConstants.INSTANCE.disabled();\n        icon.setType(value ? IconType.CHECK : IconType.REMOVE);\n        icon.setTitle(t);\n    }\n\n    @Override\n    public DataSetSummary.View showSizePanelIcon(final IconType type, final String title, final String color, final boolean spin) {\n        statusIcon.setType(type);\n        statusIcon.setTitle(title != null ? title : \"\");\n        statusIcon.setColor(color != null ? color  : \"black\");\n        statusIcon.setSpin(spin);\n        statusIcon.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public DataSetSummary.View showSizePanel(final String backendSizeRow, final String clientSizeKb) {\n        estimatedRowsText.setText(backendSizeRow);\n        estimatedSizeText.setText(clientSizeKb);\n        statusIcon.setVisible(false);\n        return this;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetSummaryView.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bh=\"urn:import:org.gwtbootstrap3.client.ui.html\"\n    >\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.widgets.resources.i18n.DataSetExplorerConstants\"/>\n \n  <ui:style type=\"org.dashbuilder.client.widgets.dataset.explorer.DataSetSummaryView.DataSetSummaryViewStyle\">\n    .panel {\n      font-size: small;\n      margin-top: 10px;\n      padding: 10px;\n      text-align: center;\n      white-space: nowrap;\n    }\n    .statusTextTitle {\n      font-size: small;\n      font-weight: bold;\n      white-space: nowrap;\n    }\n    .statusText {\n      font-size: smaller;\n      text-align: left;\n      white-space: nowrap;\n    }\n    .statusIcon {\n      float: left;\n      margin-right: 5px;\n    }\n    .panelSpan {\n      text-align: center;\n    }\n  </ui:style>\n\n    <b:Row>\n      <b:Column size=\"MD_6\">\n        <b:Well addStyleNames=\"{style.panel}\">\n          <g:HTML text=\"{i18n.currentStatus}\" addStyleNames=\"{style.statusTextTitle}\"/>\n          <bh:Span ui:field=\"backendStatus\">\n            <b:Icon ui:field=\"backendStatusIcon\" type=\"CHECK\" addStyleNames=\"{style.statusIcon}\"/>\n            <g:HTML text=\"{i18n.cache}\" addStyleNames=\"{style.statusText}\"/>\n          </bh:Span>\n          <bh:Span ui:field=\"pushStatus\">\n            <b:Icon ui:field=\"pushEnabledIcon\" type=\"CHECK\" addStyleNames=\"{style.statusIcon}\"/>\n            <g:HTML text=\"{i18n.push}\" addStyleNames=\"{style.statusText}\"/>\n          </bh:Span>\n          <bh:Span ui:field=\"refreshStatus\">\n            <b:Icon ui:field=\"refreshEnabledIcon\" type=\"CHECK\" addStyleNames=\"{style.statusIcon}\"/>\n            <g:HTML text=\"{i18n.refresh}\" addStyleNames=\"{style.statusText}\"/>\n          </bh:Span>\n        </b:Well>\n      </b:Column>\n      <b:Column size=\"MD_6\">\n        <b:Well addStyleNames=\"{style.panel}\">\n          <g:HTML text=\"{i18n.currentSize}\" addStyleNames=\"{style.statusTextTitle}\"/>\n          <bh:Span addStyleNames=\"{style.panelSpan}\">\n            <b:Icon size=\"LARGE\" type=\"REFRESH\" ui:field=\"statusIcon\" width=\"100%\"/>\n            <g:HTML ui:field=\"estimatedRowsText\"/>\n            <g:HTML ui:field=\"estimatedSizeText\"/>\n          </bh:Span>\n        </b:Well>\n      </b:Column>\n    </b:Row>\n    \n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\nimport com.google.gwt.uibinder.client.UiField;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\n\n/**\n * <p>Data set editor constants.</p>\n *\n * @since 0.3.0 \n */\npublic interface DataSetEditorConstants extends Messages {\n\n    DataSetEditorConstants INSTANCE = GWT.create( DataSetEditorConstants.class );\n\n    String newDataSet(String providerType);\n    String error();\n    String type();\n    String message();\n    String cause();\n    String ok();\n    String loading();\n    String selectType();\n    String bean();\n    String csv();\n    String sql();\n    String bean_description();\n    String csv_description();\n    String sql_description();\n    String next();\n    String next_description();\n    String updateTest_description();\n    String test();\n    String test_description();\n    String save();\n    String save_description();\n    String back();\n    String back_description();\n    String performance();\n    String backendCache();\n    String clientCache();\n    String none();\n    String refreshOnStaleData();\n    String refreshEvery();\n    String bytes();\n    String rows();\n    String attributeId();\n    String attributeColumnType();\n    String attributeColumnType_description();\n    String labelColumnType_description();\n    String textColumnType_description();\n    String numberColumnType_description();\n    String dateColumnType_description();\n    String attributeUUID();\n    String attributeUUID_description();\n    String attributeName();\n    String attributeName_description();\n    String attributeMaxBytes();\n    String attributeMaxBytes_description();\n    String attributeMaxRows();\n    String attributeMaxRows_description();\n    String attributeRefreshInterval();\n    String attributeRefreshInterval_description();\n    String on();\n    String off();\n    String sql_datasource();\n    String sql_datasource_description();\n    String sql_datasource_placeHolder();\n    String sql_datasource_selectHint();\n    String sql_schema();\n    String sql_schema_description();\n    String sql_schema_placeHolder();\n    String sql_table();\n    String sql_table_description();\n    String sql_table_placeHolder();\n    String sql_source();\n    String sql_source_description();\n    String sql_query();\n    String sql_query_description();\n    String sql_query_placeHolder();\n    String csv_filePath();\n    String csv_filePath_description();\n    String csv_URL();\n    String csv_URL_description();\n    String csv_URL_placeholder();\n    String csv_useFilePath();\n    String csv_useFileURL();\n    String csv_sepChar();\n    String csv_sepChar_description();\n    String csv_sepChar_placeholder();\n    String csv_quoteChar();\n    String csv_quoteChar_description();\n    String csv_quoteChar_placeholder();\n    String csv_escapeChar();\n    String csv_escapeChar_description();\n    String csv_escapeChar_placeholder();\n    String csv_datePattern();\n    String csv_datePattern_description();\n    String csv_datePattern_placeholder();\n    String csv_numberPattern();\n    String csv_numberPattern_description();\n    String csv_numberPattern_placeholder();\n    String bean_generator_class();\n    String bean_generator_class_description();\n    String bean_generator_class_placeholder();\n    String bean_generator_params();\n    String bean_generator_params_description();\n    String tab_configguration();\n    String tab_preview();\n    String tab_advancedConfiguration();\n    String filter();\n    String dataColumns();\n    String dataSetMustHaveAtLeastOneColumn();\n    String columnIsUsedInFilter();\n    String label();\n    String text();\n    String number();\n    String date();\n    String showColumnsAndFilter();\n    String hideColumnsAndFilter();\n    String defNotFound();\n    \n    String prometheus_query();\n    String prometheus_query_description();\n    String prometheus_server_url();\n    String prometheus_server_url_description();\n    String prometheus();\n    String prometheus_description();\n    String prometheus_query_placeholder();\n    String prometheus_server_url_placeholder();\n    \n    String kafka();\n    String kafka_description();\n    String kafka_host();\n    String kafka_host_description();\n    String kafka_host_placeholder();\n    String kafka_port();\n    String kafka_port_description();\n    String kafka_port_placeholder();\n    String kafka_target();\n    String kafka_target_description();\n    String kafka_filter();\n    String kafka_filter_description();\n    String kafka_clientId();\n    String kafka_clientId_description();\n    String kafka_nodeId();\n    String kafka_nodeId_description();\n    String kafka_topic();\n    String kafka_topic_description();\n    String kafka_partition();\n    String kafka_partition_description();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/java/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.widgets.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\n/**\n * <p>Data Set Explorer constants.</p>\n *\n * @since 0.3.0 \n */\npublic interface DataSetExplorerConstants extends ConstantsWithLookup {\n\n    DataSetExplorerConstants INSTANCE = GWT.create( DataSetExplorerConstants.class );\n\n    String title();\n    String newDataSet();\n    String noDataSets();\n    String cache();\n    String push();\n    String refresh();\n    String edit();\n    String delete();\n    String bean();\n    String csv();\n    String sql();\n    String enabled();\n    String disabled();\n    String bytes();\n    String rows();\n    String currentStatus();\n    String currentSize();\n    String notFound();\n    String loading();\n    String error();\n    String type();\n    String message();\n    String cause();\n    String ok();\n    String prometheus();\n    String kafka();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.client.widgets.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/CommonWidgets.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n\n  \n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name='org.jboss.errai.ioc.Container'/>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.UberfireClientAPI\"/>\n  <inherits name=\"org.dashbuilder.CommonValidations\"/>\n  <inherits name=\"org.dashbuilder.CommonClient\"/>\n  <inherits name=\"org.dashbuilder.DatasetAPI\"/>\n  <inherits name=\"org.dashbuilder.DatasetShared\"/>\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n  <inherits name=\"org.dashbuilder.renderer.DefaultRenderer\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.slider.Slider\"/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants.properties",
    "content": "newDataSet=New {0} Data Set\nerror=An error has occurred\ntype=Type\nmessage=Message\ncause=Cause\nok=Ok\nloading=Loading\nselectType=Select the provider type\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nbean_description=Bean provider allows to consume data generated by a Java class\ncsv_description=CSV provider allows to consume data present in a CSV file\nsql_description=SQL provider allows to consume data present in an SQL storage system\nprometheus_description=Prometheus provider allows you to consume data from a Prometheus Query\nkafka_description=Kafka provider allows to grab metrics from Kafka broker, consumer or producer\nnext=Next\nnext_description=Go to provider configuration edition\nupdateTest_description=Test your data provider configuration updated parameters by performing a data lookup to the remote system. Attention: the table on preview tab will be updated and you will lose your current columns and filter configurations, if any.\ntest=Test\ntest_description=Test your data provider configuration parameters by performing a data lookup to the remote system. The result of the lookup is displayed on the next screen.\nsave=Save\nsave_description=Save your data set and register it to make it available\nback=Back\nback_description=Go back to the type selection screen\nperformance=Performance\nbackendCache=Backend Cache\nclientCache=Client Cache\nnone=None\nrefreshOnStaleData=Refresh on stale data\nrefreshEvery=Data refresh every\nbytes=Bytes\nrows=Rows\nattributeId=Id\nattributeColumnType=Column data type\nattributeColumnType_description=The data type for the data set column\nlabelColumnType_description=Label columns support group operations. A group operation on a Label column generates one row per distinct value. For instance, a pie chart will display as many slices as labels available.\ntextColumnType_description=Text columns do not support group operations  (unlike Label columns). So they are usually displayed as raw data in non-categorized visualizations like table reports.\nnumberColumnType_description=Number columns do not support group operations.  However, when the dataset is grouped by a label or date column, different aggregation functions can be applied over the Number column: sum, average, min, max, etc.\ndateColumnType_description=Date columns support group operations. Different time intervals are supported: second, hour, day, week, month, etc.\nattributeUUID=UUID\nattributeUUID_description=Data set''s unique identifier. Useful for referencing the data set\nattributeName=Name\nattributeName_description=Data set''s name. A descriptive string that describes the data set\nattributeMaxBytes=Max bytes\nattributeMaxBytes_description=If client cache is enabled, specify the maximum size (in bytes) allows for pushing data set into client. If data set size is greater than this value, it is not pushed into client\nattributeMaxRows=Max rows\nattributeMaxRows_description=If backend cache is enabled, specify the maximum size (in rows) allowed for caching data set in memory. If data set size is greater than this value, it is not cached\nattributeRefreshInterval=Interval\nattributeRefreshInterval_description=If data set refresh is enabled, specify the interval for refreshing it. On each refresh, a look up to the external storage system is done\non=ON\noff=OFF\nsql_datasource=Data Source\nsql_datasource_description=The connection to the database. It is always provided by the underlying container.\nsql_datasource_placeHolder=java:jboss/datasources/ExampleDS\nsql_datasource_selectHint=- Select data source -\nsql_schema=Schema\nsql_schema_description=The database schema, if necessary. Can be empty\nsql_schema_placeHolder=MySchema01\nsql_table=Table\nsql_table_description=The database table to query\nsql_table_placeHolder=MyTable\nsql_source=Source\nsql_source_description=Either the name of an existing database table or a complete SQL sentence\nsql_query=Query\nsql_query_description=An ANSI SQL query for fetching the data set\nsql_query_placeHolder=select * from MyTable\ncsv_filePath=File path\ncsv_filePath_description=The local file system path where the CSV file is located\ncsv_URL=File URL\ncsv_URL_description=The URL to the CSV contents, f.i: http://myhost.com/myreports.csv\ncsv_URL_placeholder=file:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Switch to file selector mode\ncsv_useFileURL=Switch to remote URL mode\ncsv_sepChar= Separator char\ncsv_sepChar_description= The character used to separate values\ncsv_sepChar_placeholder= Separator char (;)\ncsv_quoteChar=Quote char\ncsv_quoteChar_description=The character used for quotes\ncsv_quoteChar_placeholder=Quote char (\\\\)\ncsv_escapeChar=Escape char\ncsv_escapeChar_description=The character used for escaping values\ncsv_escapeChar_placeholder=Escape char (\\\\)\ncsv_datePattern=Date pattern\ncsv_datePattern_description=The date pattern for consuming date column values present in the CSV file\ncsv_datePattern_placeholder=Date pattern  (MM-dd-yyyy)\ncsv_numberPattern=Number pattern\ncsv_numberPattern_description=The number pattern for consuming number column values present in the CSV file\ncsv_numberPattern_placeholder=Number pattern (#,###.##)\nbean_generator_class=Generator class\nbean_generator_class_description=The full qualified class name of the Java class that generates the data set. f.i: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Generator parameters\nbean_generator_params_description=A list of value pair parameters to use as generator''s class arguments\ntab_configguration=Configuration\ntab_preview=Preview\ntab_advancedConfiguration=Advanced\nfilter=Filter\ndataColumns=Data columns\ndataSetMustHaveAtLeastOneColumn=Data Set must have at least one column\ncolumnIsUsedInFilter=The column is used in the filter\nlabel=Label\ntext=Text\nnumber=Number\ndate=Date\nshowColumnsAndFilter=Show columns and filter panel\nhideColumnsAndFilter=Hide columns and filter panel\ndefNotFound=Data Set definition not found or this data set has no definition\nprometheus_server_url=Server Url\nprometheus_server_url_description=Prometheus server URL f.i: http://localhost:9090/\nprometheus_server_url_placeholder=http://localhost:9090\nprometheus_query=Query\nprometheus_query_description=The query used to retrieve data for this dataset\nprometheus_query_placeholder=time()\nkafka_host=Host\nkafka_host_description=Host where Kafka Broker/Consumer/Producer is running\nkafka_host_placeholder=127.0.0.1\nkafka_port=Port\nkafka_port_description=JMX Port according to Kafka JMX\nkafka_port_placeholder=9999\nkafka_target=Target\nkafka_target_description=The target for metric collection. The output changes according to the selected target.\nkafka_filter=Filter\nkafka_filter_description=Filter the metrics from data set result. Filter works on domain, type and name columns.\nkafka_clientId=Client ID\nkafka_clientId_description=The Client ID. Required for Consumer/Producer metrics.\nkafka_nodeId=Node ID\nkafka_nodeId_description=Node ID that can be used with Consumer/Producer metrics\nkafka_topic=Topic\nkafka_topic_description=Topic to monitor. Should be used with Consumer/Producer metrics\nkafka_partition=Partition\nkafka_partition_description=Partition to monitor. It should be used specifically with Consumer and topic configuration."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_de.properties",
    "content": "newDataSet=Neuer {0} Datensatz\nerror=Ein Fehler ist aufgetreten.\ntype=Typ\nmessage=Nachricht\ncause=Ursache\nok=Ok\nloading=Lade\nselectType=Provider-Typ auswählen\nbean=Bean\ncsv=CSV\nsql=SQL\nbean_description=Bean-Provider erlaubt die Verwendung von durch eine Java-Klasse generierte Daten\ncsv_description=CSV-Provider erlaubt die Verwendung von in einer CSV-Datei vorhandenen Daten\nsql_description=SQL-Provider erlaubt die Verwendung von in einem SQL-Speichersystem vorhandenen Daten\nnext=Weiter\nnext_description=Zur Provider-Konfigurationsedition\ntest=Test\nsave=Speichern\nsave_description=Speichern und registrieren Sie Ihren Datensatz, damit dieser verfügbar wird\nback=Zurück\nperformance=Performance\nbackendCache=Backend-Cache\nclientCache=Client-Cache\nnone=Keine\nrefreshOnStaleData=Veraltete Daten aktualisieren\nrefreshEvery=Datenaktualisierung alle\nbytes=Bytes\nrows=Reihen\nattributeId=Id\nattributeColumnType=Spalten-Datentyp\nattributeColumnType_description=Der Datentyp für die Datensatzspalte\nattributeUUID=UUID\nattributeUUID_description=Der eindeutige Bezeichner des datensatzes. Nützlich für das Referenzieren des Datensatzes\nattributeName=Name\nattributeName_description=Name des Datensatzes. Ein deskriptiver String, der den Datensatz beschreibt\nattributeMaxBytes=Max. Bytes\nattributeMaxBytes_description=Ist das Client-Cache aktiviert, so geben Sie die maximal gestattete Größe (in Bytes) für den Push des Datensatzes in den Client an. Überschreitet der Datensatz diesen Wert, so erfolgt kein Push in den Client\nattributeMaxRows=Max. Reihen\nattributeMaxRows_description=Ist das Backend-Cache aktiviert, so geben Sie die maximal gestattete Größe (in Reihen) für das Cachen des Datensatzes im Arbeitsspeicher an. Überschreitet der Datensatz diesen Wert, so erfolgt kein Cachen\nattributeRefreshInterval=Intervall\nattributeRefreshInterval_description=Ist das Aktualisieren von Datensätzen aktiviert, so muss der Aktualisierungsintervall festgelegt werden. Bei jeder Aktualisierung erfolgt ein Lookup am externen Speichersystem\non=AN\noff=AUS\nsql_datasource=Datenquelle\nsql_datasource_placeHolder=java\\:jboss/datasources/ExampleDS\nsql_schema=Schema\nsql_schema_description=Das Datenbankschema, falls erforderlich. Kann leer sein\nsql_schema_placeHolder=MySchema01\nsql_table=Tabelle\nsql_table_description=Die abzufragende Datenbanktabelle\nsql_table_placeHolder=MyTable\nsql_source=Quelle\nsql_query=Anfrage\nsql_query_description=Eine ANSI SQL-Anfrage für den Abruf des Datensatzes\nsql_query_placeHolder=Wählen Sie * aus MyTable aus\ncsv_filePath=Dateipfad \ncsv_filePath_description=Der lokale Dateisystempfad, auf dem sich die CSV-Datei befindet\ncsv_URL=Datei-URL\ncsv_URL_description=Die URL zu CSV-Inhalten, f.i\\: http\\://myhost.com/myreports.csv\ncsv_URL_placeholder=file\\:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Zum Datei-Selektor Modus wechseln\ncsv_useFileURL=Zum Entfernte URL Modus wechseln\ncsv_sepChar=Separator-Char\ncsv_sepChar_description=Das zum Trennen von Werten verwendete Zeichen\ncsv_sepChar_placeholder=Separator-Char (;)\ncsv_quoteChar=Anführungszeichen-Char\ncsv_quoteChar_description=Das für Anführungszeichen verwendete Zeichen\ncsv_quoteChar_placeholder=Anführungszeichen-Char (\\\\)\ncsv_escapeChar=Escape-Char\ncsv_escapeChar_description=Das Escape-Zeichen für Werte\ncsv_escapeChar_placeholder=Escape-Zeichen (\\\\)\ncsv_datePattern=Datumsmuster\ncsv_datePattern_description=Das Datumsmuster für die Verwendung der Datumsspaltenwerte for consuming date column values present in the CSV file\ncsv_datePattern_placeholder=Datumsmuster  (MM-tt-jjjj)\ncsv_numberPattern=Zahlenmuster\ncsv_numberPattern_description=Das Zahlenmuster für die Verwendung von in der CSV-Datei vorhandenen Zahlenspaltenwerten\ncsv_numberPattern_placeholder=Zahlenmuster (\\#,\\#\\#\\#.\\#\\#)\nel_cluster_name=Cluster-Name\nel_cluster_name_description=Der Name des Clusters. Kann leer sein\nel_cluster_name_placeholder=my_cluster\nel_index=Index\nel_index_placeholder=my_index\nel_type=Dokument-Typ\nel_type_description=Der Dokumententyp zur Abfrage des gegebenen Index. Kann mehrere, kommagetrennte Werte enthalten. Falls leer, werden alle Dokumententypen des gegebenen aktuellen Index verwendet\nel_type_placeholder=my_type\nbean_generator_class=Generator-Klasse\nbean_generator_class_description=Der vollqualifizierte Klassenname der Java-Klasse, die den Datensatz generiert. f.i\\: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Generator-Parameter\nbean_generator_params_description=Eine Liste von Wertepaarparametern zur Verwendung als Generator-Klassen-Argumente\ntab_configguration=Konfiguration\ntab_preview=Vorschau\ntab_advancedConfiguration=Fortgeschritten\nfilter=Filter\ndataColumns=Datenspalten\ndataSetMustHaveAtLeastOneColumn=Datensatz muss mindestens eine Spalte haben\ncolumnIsUsedInFilter=Die Spalte wird im Filter verwendet\nlabel=Bezeichnung\ntext=Text\nnumber=Zahl\ndate=Datum\nshowColumnsAndFilter=Spalten- und Filter-Panel anzeigen\nhideColumnsAndFilter=Spalten- und Filter-Panel ausblenden\ndefNotFound=Datensatzdefinition nicht gefunden oder dieser Datensatz besitzt keine Definition\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_es.properties",
    "content": "newDataSet=Nuevo conjunto de datos {0}\nerror=Se produjo un error\ntype=Tipo\nmessage=Mensaje\ncause=Motivo\nok=Aceptar\nloading=Cargando\nselectType=Seleccione el tipo de proveedor\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometeo\nkafka=Kafka\nbean_description=El proveedor Bean permite consumir los datos generados por una clase de Java\ncsv_description=El proveedor CSV permite consumir los datos presentes en un archivo CSV\nsql_description=El proveedor SQL permite consumir los datos presentes en un sistema de almacenamiento SQL\nprometheus_description=El proveedor de Prometheus le permite consumir datos de una consulta de Prometheus\nkafka_description=El proveedor Kafka permite obtener métricas del broker, consumidor o productor Kafka\nnext=Siguiente\nnext_description=Ir a la edición de configuración de proveedores\nupdateTest_description=Pruebe los parámetros actualizados de la configuración de su proveedor de datos realizando una búsqueda de datos en el sistema remoto. Atención: la tabla de la pestaña de vista previa se actualizará y perderá sus columnas y configuraciones de filtro actuales, si las hubiera.\ntest=Prueba\ntest_description=Pruebe los parámetros de configuración de su proveedor de datos realizando una búsqueda de datos en el sistema remoto. El resultado de la búsqueda se muestra en la siguiente pantalla.\nsave=Guardar\nsave_description=Guarde su conjunto de datos y regístrelo para que esté disponible\nback=Atrás\nback_description=Volver a la pantalla de selección de tipo\nperformance=Desempeño\nbackendCache=Caché back-end\nclientCache=Caché cliente\nnone=Ninguno\nrefreshOnStaleData=Actualizar al encontrar datos obsoletos\nrefreshEvery=Los datos se actualizan cada\nbytes=Bytes\nrows=Filas\nattributeId=Id\nattributeColumnType=Tipo de datos de la columna\nattributeColumnType_description=El tipo de datos para la columna de conjuntos de datos\nlabelColumnType_description=Las columnas de etiquetas respaldan las operaciones de grupo. Una operación de grupo en una columna de etiquetas genera una fila por cada valor único. Por ejemplo, un gráfico circular mostrará tantos cortes como etiquetas haya disponibles.\ntextColumnType_description=Las columnas de texto no admiten operaciones de grupo (a diferencia de las columnas de etiquetas). Por lo tanto, normalmente se muestran como datos sin formato en visualizaciones no categorizadas como informes de tablas.\nnumberColumnType_description=Las columnas de números no admiten las operaciones de grupo.  Sin embargo, cuando el conjunto de datos se agrupa por una columna de fecha o etiqueta, se pueden aplicar diferentes funciones de agregación sobre la columna de número: suma, promedio, mínimo, máximo, etc.\ndateColumnType_description=Las columnas de fecha admiten las operaciones del grupo. Se admiten diferentes intervalos de tiempo: segundo, hora, día, semana, mes, etc.\nattributeUUID=UUID\nattributeUUID_description=El identificador único del conjunto de datos. Es útil para referirse al conjunto de datos\nattributeName=Nombre\nattributeName_description=El nombre del conjunto de datos. Una cadena descriptiva que describe el conjunto de datos\nattributeMaxBytes=Cantidad máxima de bytes\nattributeMaxBytes_description=Si la caché de clientes está habilitada, especifique el tamaño máximo (en bytes) permitido para la introducción del conjunto de datos en el cliente. Si el tamaño del conjunto de datos es mayor a este valor, no se introduce en el cliente\nattributeMaxRows=Cantidad máxima de filas\nattributeMaxRows_description=Si la caché del back-end está habilitada, especifique el tamaño máximo (en filas) permitido para el almacenamiento de los conjuntos de datos en la caché de la memoria . Si el tamaño del conjunto de datos es mayor a este valor, no se almacena en caché\nattributeRefreshInterval=Intervalo\nattributeRefreshInterval_description=Si la actualización del conjunto de datos está habilitada, especifique el intervalo para actualizarla. En cada actualización, se realiza una búsqueda en el sistema de almacenamiento externo\non=ENCENDIDO\noff=APAGADO\nsql_datasource=Fuente de datos\nsql_datasource_description=La conexión a la base de datos. Siempre la proporciona el contenedor subyacente.\nsql_datasource_placeHolder=java:jboss/datasources/ExampleDS\nsql_datasource_selectHint=- Seleccionar la fuente de datos -\nsql_schema=Esquema\nsql_schema_description=El esquema de la base de datos, si es necesario. Puede estar vacío\nsql_schema_placeHolder=MySchema01\nsql_table=Tabla\nsql_table_description=La tabla de la base de datos a consultar\nsql_table_placeHolder=MyTable\nsql_source=Fuente\nsql_source_description=El nombre de una tabla de la base de datos existente o una sentencia de SQL completa\nsql_query=Consulta\nsql_query_description=Una consulta ANSI SQL para obtener el conjunto de datos\nsql_query_placeHolder=seleccionar * de MyTable\ncsv_filePath=Ruta de archivo\ncsv_filePath_description=La ruta del sistema de archivos local donde se encuentra el archivo CSV\ncsv_URL=URL del archivo\ncsv_URL_description=El URL del contenido del CSV, f.i: http://myhost.com/myreports.csv\ncsv_URL_placeholder=file:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Cambiar al modo de selección de archivos\ncsv_useFileURL=Cambiar al modo URL remoto\ncsv_sepChar= Carácter separador\ncsv_sepChar_description= El carácter usado para separar los valores\ncsv_sepChar_placeholder= Carácter separador (;)\ncsv_quoteChar=Carácter de cita\ncsv_quoteChar_description=El carácter usado para citar\ncsv_quoteChar_placeholder=Carácter de cita (\\)\ncsv_escapeChar=Carácter de escape\ncsv_escapeChar_description=El carácter usado para valores de escape\ncsv_escapeChar_placeholder=Carácter de escape (\\)\ncsv_datePattern=Patrón de fechas\ncsv_datePattern_description=El patrón de fechas para consumir los valores de la columna de fecha presentes en el archivo CSV\ncsv_datePattern_placeholder=Patrón de fechas (MM-dd-aaaa)\ncsv_numberPattern=Patrón de números\ncsv_numberPattern_description=El patrón de números para consumir los valores de las columnas de números presentes en el archivo CSV\ncsv_numberPattern_placeholder=Patrón de números (#,###.##)\nbean_generator_class=Clase de generador\nbean_generator_class_description=El nombre completo de la clase calificada de la clase Java que genera el conjunto de datos. f.i: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Parámetros del generador\nbean_generator_params_description=Una lista de parámetros de pares de valores para usar como argumentos de clase del generador\ntab_configguration=Configuración\ntab_preview=Vista previa\ntab_advancedConfiguration=Avanzado\nfilter=Filtro\ndataColumns=Columnas de datos\ndataSetMustHaveAtLeastOneColumn=El conjunto de datos debe tener al menos una columna\ncolumnIsUsedInFilter=La columna se usa en el filtro\nlabel=Etiqueta\ntext=Texto\nnumber=Número\ndate=Fecha\nshowColumnsAndFilter=Mostrar las columnas y el panel de filtro\nhideColumnsAndFilter=Ocultar las columnas y el panel de filtro\ndefNotFound=No se encuentra la definición del conjunto de datos o este conjunto de datos no tiene definición\nprometheus_server_url=Url del servidor\nprometheus_server_url_description=URL del servidor Prometheus f.i: http://localhost:9090/\nprometheus_server_url_placeholder=http://localhost:9090\nprometheus_query=Consulta\nprometheus_query_description=La consulta utilizada para recuperar los datos de este conjunto de datos\nprometheus_query_placeholder=tiempo\nkafka_host=Host\nkafka_host_description=Host en el que se ejecuta Kafka Broker/Consumer/Producer\nkafka_host_placeholder=127.0.0.1\nkafka_port=Puerto\nkafka_port_description=Puerto JMX según Kafka JMX\nkafka_port_placeholder=9999\nkafka_target=Destino\nkafka_target_description=El objetivo de la recogida de métricas. La salida cambia según el objetivo seleccionado.\nkafka_filter=Filtro\nkafka_filter_description=Filtrar las métricas del resultado del conjunto de datos. El filtro funciona en las columnas de dominio, tipo y nombre.\nkafka_clientId=Identificación del cliente\nkafka_clientId_description=La identificación del cliente. Necesario para las métricas de los consumidores/productores.\nkafka_nodeId=ID del nodo\nkafka_nodeId_description=ID de nodo que puede utilizarse con las métricas de consumidor/productor\nkafka_topic=Tema\nkafka_topic_description=Tema a vigilar. Debe utilizarse con las métricas del consumidor/productor\nkafka_partition=Partición\nkafka_partition_description=Partición a vigilar. Debe utilizarse específicamente con la configuración de los consumidores y los temas."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_fr.properties",
    "content": "newDataSet=Nouvel ensemble de données {0}\nerror=Une erreur s''est produite\ntype=Type\nmessage=Message\ncause=Cause\nok=OK\nloading=Chargement\nselectType=Sélectionner le type de fournisseur\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nbean_description=Le fournisseur Bean permet de consommer des données générées par une classe Java\ncsv_description=Le fournisseur CSV permet de consommer les données présentes dans un fichier CSV\nsql_description=Le fournisseur SQL permet de consommer les données présentes dans un système de stockage SQL\nprometheus_description=Le fournisseur Prometheus vous permet de consommer des données à partir d''une requête Prometheus\nkafka_description=Le fournisseur Kafka permet de récupérer les métriques du courtier, du consommateur ou du producteur Kafka\nnext=Suivant\nnext_description=Aller à l''édition de la configuration du fournisseur\nupdateTest_description=Testez les paramètres mis à jour de la configuration de votre fournisseur de données en effectuant une recherche de données sur le système distant. Attention : le tableau de l''onglet \"Aperçu\" sera mis à jour, et vous perdrez les configurations de filtrage et de colonnes en cours, le cas échéant.\ntest=Tester\ntest_description=Testez les paramètres de configuration de votre fournisseur de données en effectuant une recherche de données sur le système distant. Le résultat de la recherche est affiché sur l''écran suivant.\nsave=Enregistrer\nsave_description=Enregistrez votre ensemble de données et inscrivez-le pour le rendre disponible\nback=Retour\nback_description=Revenir à l''écran de sélection du type\nperformance=Performance\nbackendCache=Cache du backend\nclientCache=Cache du client\nnone=Aucun\nrefreshOnStaleData=Rafraîchir les données périmées\nrefreshEvery=Rafraîchir les données tous les\nbytes=Octets\nrows=Lignes\nattributeId=ID\nattributeColumnType=Type de données de la colonne\nattributeColumnType_description=Type de données de la colonne de l''ensemble de données\nlabelColumnType_description=Les colonnes Étiquette prennent en charge les opérations de groupe. Une opération de groupe sur une colonne Étiquette génère une ligne par valeur distincte. Par exemple, un graphique en secteurs affichera autant de secteurs que d''étiquettes disponibles.\ntextColumnType_description=Les colonnes Texte ne prennent pas en charge les opérations de groupe (contrairement aux colonnes d''étiquettes). Elles sont donc généralement affichées sous la forme de données brutes dans des visualisations non catégorisées comme des rapports de tableaux.\nnumberColumnType_description=Les colonnes Nombre ne prennent pas en charge les opérations de groupe.  Cependant, lorsque l''ensemble de données est regroupé en fonction d''une colonne de date ou d''étiquette, différentes fonctions d''agrégation peuvent être appliquées sur la colonne Nombre : somme, moyenne, min, max, etc.\ndateColumnType_description=Les colonnes Date prennent en charge les opérations de groupe. Différents intervalles de temps sont pris en charge : seconde, heure, jour, semaine, mois, etc.\nattributeUUID=UUID\nattributeUUID_description=Identificateur unique de l''ensemble de données. Utile pour référencer l''ensemble des données\nattributeName=Nom\nattributeName_description=Nom de l''ensemble de données. Chaîne descriptive qui décrit l''ensemble de données\nattributeMaxBytes=Nombre maximal d''octets\nattributeMaxBytes_description=Si le cache du client est activé, indiquez la taille maximale (en octets) permettant d''envoyer l''ensemble de données au client. Si la taille de l''ensemble de données est supérieure à cette valeur, il n''est pas envoyé au client\nattributeMaxRows=Nombre maximal de lignes\nattributeMaxRows_description=Si le cache du backend est activé, indiquez la taille maximale (en lignes) autorisée pour la mise en cache de l''ensemble de données en mémoire. Si la taille de l''ensemble de données est supérieure à cette valeur, il n''est pas mis en cache\nattributeRefreshInterval=Intervalle\nattributeRefreshInterval_description=Si le rafraîchissement de l''ensemble de données est activé, indiquez l''intervalle de rafraîchissement. À chaque rafraîchissement, une recherche est effectuée dans le système de stockage externe\non=ACTIVÉ\noff=DÉSACTIVÉ\nsql_datasource=Source de données\nsql_datasource_description=Connexion à la base de données. Elle est toujours fournie par le conteneur sous-jacent.\nsql_datasource_placeHolder=java:jboss/datasources/ExampleDS\nsql_datasource_selectHint=- Sélectionner la source de données -\nsql_schema=Schéma\nsql_schema_description=Schéma de la base de données, si nécessaire. Peut être vide\nsql_schema_placeHolder=MySchema01\nsql_table=Tableau\nsql_table_description=Table de base de données à interroger\nsql_table_placeHolder=MyTable\nsql_source=Source\nsql_source_description=Soit le nom d''une table de base de données existante, soit une phrase SQL complète\nsql_query=Requête\nsql_query_description=Requête SQL ANSI pour extraire l''ensemble de données\nsql_query_placeHolder=sélectionnez * dans MyTable\ncsv_filePath=Chemin d''accès au fichier\ncsv_filePath_description=Chemin d''accès au système de fichiers local où se trouve le fichier CSV\ncsv_URL=URL du fichier\ncsv_URL_description=URL du contenu CSV, par exemple : http://myhost.com/myreports.csv\ncsv_URL_placeholder=file:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Passer en mode sélecteur de fichiers\ncsv_useFileURL=Passer en mode URL distante\ncsv_sepChar= Caractère de séparation\ncsv_sepChar_description= Caractère utilisé pour séparer les valeurs\ncsv_sepChar_placeholder= Caractère de séparation (;)\ncsv_quoteChar=Guillemet\ncsv_quoteChar_description=Caractère utilisé pour les guillemets\ncsv_quoteChar_placeholder=Guillemet (\\)\ncsv_escapeChar=Caractère d''échappement\ncsv_escapeChar_description=Le caractère utilisé pour l''échappement des valeurs\ncsv_escapeChar_placeholder=Caractère d''échappement (\\)\ncsv_datePattern=Modèle de date\ncsv_datePattern_description=Modèle de date utilisé pour la consommation des valeurs de colonne Date présentes dans le fichier CSV\ncsv_datePattern_placeholder=Modèle de date (MM-jj-aaaa)\ncsv_numberPattern=Modèle de numéro\ncsv_numberPattern_description=Modèle de numéro utilisé pour la consommation des valeurs de colonne Nombre présentes dans le fichier CSV\ncsv_numberPattern_placeholder=Modèle de numéro (#,###.##)\nbean_generator_class=Classe de générateur\nbean_generator_class_description=Nom de classe complet de la classe Java qui génère l''ensemble de données, par exemple : org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Paramètres du générateur\nbean_generator_params_description=Liste de paramètres de paires de valeurs à utiliser comme arguments de classe du générateur\ntab_configguration=Configuration\ntab_preview=Aperçu\ntab_advancedConfiguration=Avancé\nfilter=Filtrer\ndataColumns=Colonnes de données\ndataSetMustHaveAtLeastOneColumn=L''ensemble de données doit comporter au moins une colonne\ncolumnIsUsedInFilter=La colonne est utilisée dans le filtre\nlabel=Étiquette\ntext=Texte\nnumber=Numéro\ndate=Date\nshowColumnsAndFilter=Afficher le panneau de filtre et les colonnes\nhideColumnsAndFilter=Masquer le panneau de filtre et les colonnes\ndefNotFound=Définition de l''ensemble de données introuvable ou cet ensemble de données ne comporte aucune définition\nprometheus_server_url=Url du serveur\nprometheus_server_url_description=URL du serveur Prometheus f.i : http://localhost:9090/\nprometheus_server_url_placeholder=http://localhost:9090\nprometheus_query=Requête\nprometheus_query_description=La requête utilisée pour récupérer les données de cet ensemble de données\nprometheus_query_placeholder=time()\nkafka_host=Hôte \nkafka_host_description=Hôte où les Broker/Consommateur/Producteur Kafka sont exécutés\nkafka_host_placeholder=127.0.0.1\nkafka_port=Port\nkafka_port_description=Port JMX selon Kafka JMX\nkafka_port_placeholder=9999\nkafka_target=Cible\nkafka_target_description=La cible de la collecte de métriques. La sortie change en fonction de la cible sélectionnée.\nkafka_filter=Filtrer\nkafka_filter_description=Filtrer les métriques à partir du résultat de l''ensemble de données. Le filtre fonctionne sur les colonnes domaine, type et nom.\nkafka_clientId=ID du client\nkafka_clientId_description=L''ID du client. Requis pour les métriques Consommateur/Producteur.\nkafka_nodeId=ID du nœud\nkafka_nodeId_description=ID du nœud qui peut être utilisé avec les métriques du consommateur/producteur\nkafka_topic=Sujet\nkafka_topic_description=Sujet à surveiller. Doit être utilisé avec les mesures du consommateur/producteur\nkafka_partition=Partition\nkafka_partition_description=Partition à surveiller. Doit être utilisé spécifiquement avec la configuration des consommateurs et des sujets."
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_it.properties",
    "content": "newDataSet=Nuovo {0} Data Set\nerror=Si è verificato un errore\ntype=Tipo\nmessage=Messaggio\ncause=Causa\nok=Ok\nloading=Caricamento\nselectType=Seleziona il tipo di provider\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nbean_description=Il provider Bean consente di consumare dati generati da una classe Java\ncsv_description=Il provider CSV consente di consumare dati presenti in un file CSV\nsql_description=Il provider SQL consente di consumare dati presenti in un sistema di archiviazione SQL\nprometheus_description=Il provider Prometheus consente di consumare dati da una query Prometheus\nkafka_description=Il provider Kafka consente di ottenere metriche da un broker, un consumatore o un produttore Kafka\nnext=Avanti\nnext_description=Vai alla configurazione del provider\nupdateTest_description=Testa la configurazione aggiornata del provider eseguendo una ricerca dei dati nel sistema remoto. Attenzione: la tabella nella scheda di anteprima verrà aggiornata e perderai le tue colonne e le configurazioni dei filtri correnti, se presenti.\ntest=Test\ntest_description=Testa i parametri di configurazione del provider eseguendo una ricerca dei dati nel sistema remoto. Il risultato della ricerca viene visualizzato nella schermata successiva.\nsave=Salva\nsave_description=Salva il tuo data set e registrarlo per renderlo disponibile\nback=Indietro\nback_description=Torna alla schermata di selezione del tipo\nperformance=Prestazioni\nbackendCache=Cache del backend\nclientCache=Cache del client\nnone=Nessuno\nrefreshOnStaleData=Aggiorna su dati obsoleti\nrefreshEvery=Aggiorna i dati ogni\nbytes=Byte\nrows=Righe\nattributeId=ID\nattributeColumnType=Tipo di dati della colonna\nattributeColumnType_description=Il tipo di dati per la colonna del data set\nlabelColumnType_description=Le colonne delle etichette supportano operazioni di raggruppamento. Un''operazione di raggruppamento su una colonna delle etichette genera una riga per ogni valore distinto. Ad esempio, un grafico a torta visualizzerà tante fette quante sono le etichette disponibili.\ntextColumnType_description=Le colonne di testo non supportano operazioni di raggruppamento (a differenza delle colonne delle etichette). Quindi di solito vengono visualizzate come dati grezzi in visualizzazioni non categorizzate come i report tabellari.\nnumberColumnType_description=Le colonne numeriche non supportano operazioni di raggruppamento. Tuttavia, quando il data set è raggruppato per una colonna di etichetta o data, è possibile applicare diverse funzioni di aggregazione sulla colonna numerica: somma, media, minimo, massimo, ecc.\ndateColumnType_description=Le colonne delle date supportano operazioni di raggruppamento. Sono supportati diversi intervalli di tempo: secondo, ora, giorno, settimana, mese, ecc.\nattributeUUID=UUID\nattributeUUID_description=Identificatore univoco del data set. Utile per fare riferimento al data set\nattributeName=Nome\nattributeName_description=Nome del data set. Una stringa descrittiva che descrive il data set\nattributeMaxBytes=Byte massimi\nattributeMaxBytes_description=Se la cache del client è abilitata, specifica la dimensione massima (in byte) consentita per l''inserimento del data set nel client. Se la dimensione del data set è maggiore di questo valore, non viene inserito nel client\nattributeMaxRows=Righe massime\nattributeMaxRows_description=Se la cache del backend è abilitata, specifica la dimensione massima (in righe) consentita per la memorizzazione nella cache del data set in memoria. Se la dimensione del data set è maggiore di questo valore, non viene memorizzato nella cache\nattributeRefreshInterval=Intervallo\nattributeRefreshInterval_description=Se il refresh del data set è abilitato, specifica l''intervallo per l''aggiornamento. Ad ogni aggiornamento viene effettuata una ricerca nel sistema di archiviazione esterno\non=ON\noff=OFF\nsql_datasource=Origine dati\nsql_datasource_description=La connessione al database. Viene sempre fornita dal contenitore sottostante.\nsql_datasource_placeHolder=java:jboss/datasources/ExampleDS\nsql_datasource_selectHint=- Seleziona origine dati -\nsql_schema=Schema\nsql_schema_description=Lo schema del database, se necessario. Può essere vuoto\nsql_schema_placeHolder=MySchema01\nsql_table=Tabella\nsql_table_description=La tabella del database da interrogare\nsql_table_placeHolder=MyTable\nsql_source=Origine\nsql_source_description=Il nome di una tabella di database esistente o una frase SQL completa\nsql_query=Query\nsql_query_description=Una query SQL ANSI per recuperare il data set\nsql_query_placeHolder=select * from MyTable\ncsv_filePath=Percorso del file\ncsv_filePath_description=Il percorso nel file system locale in cui si trova il file CSV\ncsv_URL=URL del file\ncsv_URL_description=L''URL per il contenuto CSV, ad esempio: http://myhost.com/myreports.csv\ncsv_URL_placeholder=file:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Passa alla modalità selezione file\ncsv_useFileURL=Passa alla modalità URL remoto\ncsv_sepChar=Carattere separatore\ncsv_sepChar_description=Il carattere utilizzato per separare i valori\ncsv_sepChar_placeholder=Carattere separatore (;)\ncsv_quoteChar=Carattere di citazione\ncsv_quoteChar_description=Il carattere utilizzato per le citazioni\ncsv_quoteChar_placeholder=Carattere di citazione (\\\\)\ncsv_escapeChar=Carattere di escape\ncsv_escapeChar_description=Il carattere utilizzato per l''escape dei valori\ncsv_escapeChar_placeholder=Carattere di escape (\\\\)\ncsv_datePattern=Pattern data\ncsv_datePattern_description=Il pattern di data per consumare i valori delle colonne di data presenti nel file CSV\ncsv_datePattern_placeholder=Pattern data (MM-dd-yyyy)\ncsv_numberPattern=Pattern numerico\ncsv_numberPattern_description=Il pattern numerico per consumare i valori delle colonne numeriche presenti nel file CSV\ncsv_numberPattern_placeholder=Pattern numerico (#,###.##)\nbean_generator_class=Classe generatore\nbean_generator_class_description=Il nome completo della classe Java che genera il data set, ad esempio: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Parametri generatore\nbean_generator_params_description=Un elenco di coppie di valori da utilizzare come argomenti della classe generatore\ntab_configguration=Configurazione\ntab_preview=Anteprima\ntab_advancedConfiguration=Avanzate\nfilter=Filtro\ndataColumns=Colonne dati\ndataSetMustHaveAtLeastOneColumn=Il data set deve avere almeno una colonna\ncolumnIsUsedInFilter=La colonna è utilizzata nel filtro\nlabel=Etichetta\ntext=Testo\nnumber=Numero\ndate=Data\nshowColumnsAndFilter=Mostra pannello colonne e filtro\nhideColumnsAndFilter=Nascondi pannello colonne e filtro\ndefNotFound=Definizione del data set non trovata o questo data set non ha una definizione\nprometheus_server_url=URL server\nprometheus_server_url_description=URL del server Prometheus, ad esempio: http://localhost:9090/\nprometheus_server_url_placeholder=http://localhost:9090\nprometheus_query=Query\nprometheus_query_description=La query utilizzata per recuperare i dati per questo data set\nprometheus_query_placeholder=time()\nkafka_host=Host\nkafka_host_description=Host in cui è in esecuzione il broker/consumatore/produttore Kafka\nkafka_host_placeholder=127.0.0.1\nkafka_port=Porta\nkafka_port_description=Porta JMX secondo Kafka JMX\nkafka_port_placeholder=9999\nkafka_target=Destinazione\nkafka_target_description=La destinazione per la raccolta delle metriche. L''output cambia in base alla destinazione selezionata.\nkafka_filter=Filtro\nkafka_filter_description=Filtrare le metriche dal risultato del data set. Il filtro funziona sulle colonne dominio, tipo e nome.\nkafka_clientId=ID client\nkafka_clientId_description=L''ID client. Richiesto per le metriche del consumatore/produttore.\nkafka_nodeId=ID nodo\nkafka_nodeId_description=ID nodo che può essere utilizzato con le metriche del consumatore/produttore\nkafka_topic=Argomento\nkafka_topic_description=Argomento da monitorare. Dovrebbe essere utilizzato con le metriche del consumatore/produttore\nkafka_partition=Partizione\nkafka_partition_description=Partizione da monitorare. Dovrebbe essere utilizzata specificamente con la configurazione del consumatore e dell''argomento.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_ja.properties",
    "content": "newDataSet=新しい {0} データセット\nerror=エラーが発生しました\ntype=タイプ\nmessage=メッセージ\ncause=原因\nok=OK\nloading=ロード中\nselectType=プロバイダータイプの選択\nbean=Bean\ncsv=CSV \nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nbean_description=Bean プロバイダーにより Java クラスで生成されたデータを消費できるようになります\ncsv_description=CSV プロバイダーにより CSV ファイルに含まれるデータを消費できるようになります\nsql_description=SQL プロバイダーにより SQL ストレージシステムに存在するデータを消費できるようになります\nprometheus_description=Prometheus プロバイダーを使用すると、Prometheus Query からのデータを使用できます。\nkafka_description=Kafka プロバイダーを使用すると、Kafka ブローカー、コンシューマー、またはプロデューサーからメトリクスを取得できます。\nnext=次へ\nnext_description=プロバイダー設定エディションに移動\nupdateTest_description=リモートシステムに対してデータルックアップを実行して、データプロバイダー設定の更新パラメーターをテストします。注意: プレビュータブの表が更新されるため、現在の列とフィルター設定がある場合には失われます。\ntest=テスト\ntest_description=リモートシステムに対してデータルックアップを実行して、データプロバイダー設定パラメーターをテストします。ルックアップの結果は次の画面に表示されます。\nsave=保存\nsave_description=データセットを保存および登録して利用可能にする\nback=戻る\nback_description=タイプ選択画面に戻る\nperformance=パフォーマンス\nbackendCache=バックエンドキャッシュ\nclientCache=クライアントキャッシュ\nnone=なし\nrefreshOnStaleData=古いデータの更新\nrefreshEvery=データ更新間隔\nbytes=バイト\nrows=行\nattributeId=Id\nattributeColumnType=列データタイプ\nattributeColumnType_description=データセット列のデータタイプ\nlabelColumnType_description=ラベル列はグループ操作をサポートします。ラベル列のグループ操作では、個別の値ごとに 1 行生成します。たとえば、円グラフには、使用可能なラベルと同じ数のスライスが表示されます。\ntextColumnType_description=テキスト列は (ラベル列とは異なり) グループ操作をサポートしていません 。そのため、通常、テーブルレポートなど、分類されていない視覚化部分にローデータとして表示されます。\nnumberColumnType_description=数値の列はグループ操作をサポートしません。 ただし、データセットをラベル列または日付列でグループ化すると、数値列に様々な集約関数 (sum、average、min、max など) が適用されます。\ndateColumnType_description=日付列はグループ操作をサポートします。様々な時間間隔 (second、hour、day、week、month など) がサポートされます。\nattributeUUID=UUID\nattributeUUID_description=データセットの一意の識別子。データセットの参照に便利\nattributeName=名前\nattributeName_description=データセットの名前。データセットを表す記述的な文字列にします\nattributeMaxBytes=最大バイト\nattributeMaxBytes_description=クライアントキャッシュが有効な場合は、データセットをクライアントにプッシュできる最大サイズ (バイト単位) を指定します。データセットのサイズがこの値より大きい場合には、クライアントにプッシュされません\nattributeMaxRows=最大行\nattributeMaxRows_description=バックエンドキャッシュが有効な場合は、データセットをメモリーでキャッシュするために許可される最大サイズ (行単位) を指定します。データセットサイズがこの値よりも大きい場合は、キャッシュされません\nattributeRefreshInterval=間隔\nattributeRefreshInterval_description=データセットの更新が有効な場合には、更新の間隔を指定します。更新ごとに、外部ストレージシステムのルックアップが行われます\non=ON\noff=OFF\nsql_datasource=データソース\nsql_datasource_description=データベースへの接続。常に基本コンテナーによって提供されます。\nsql_datasource_placeHolder=java:jboss/datasources/ExampleDS\nsql_datasource_selectHint=- データソースの選択 -\nsql_schema=スキーマ\nsql_schema_description=データベーススキーマ (必要な場合)。空白にすることができます\nsql_schema_placeHolder=MySchema01\nsql_table=テーブル\nsql_table_description=クエリーを実行するデータベーステーブル\nsql_table_placeHolder=MyTable\nsql_source=ソース\nsql_source_description=既存のデータベーステーブルの名前、または完全な SQL 文\nsql_query=クエリー\nsql_query_description=データセットを取得する ANSI SQL クエリー\nsql_query_placeHolder=select * from MyTable\ncsv_filePath=ファイルパス\ncsv_filePath_description=CSV ファイルが存在するローカルのファイルシステムパス\ncsv_URL=ファイル URL\ncsv_URL_description=CSV コンテンツへの URL、f.i: http://myhost.com/myreports.csv\ncsv_URL_placeholder=file:///home/dashbuilder/myReports.csv\ncsv_useFilePath=ファイル選択モードに切り替える\ncsv_useFileURL=リモート URL モードに切り替える\ncsv_sepChar= セパレーター文字\ncsv_sepChar_description= 値を区切るために使用する文字\ncsv_sepChar_placeholder= セパレーター文字 (;)\ncsv_quoteChar=引用符\ncsv_quoteChar_description=引用に使用する文字\ncsv_quoteChar_placeholder=引用符 (\\)\ncsv_escapeChar=エスケープ文字\ncsv_escapeChar_description=値をエスケープするために使用する文字\ncsv_escapeChar_placeholder=エスケープ文字 (\\)\ncsv_datePattern=日付形式\ncsv_datePattern_description=CSV ファイルに存在する日付列値を消費するための日付形式\ncsv_datePattern_placeholder=日付形式  (MM-dd-yyyy)\ncsv_numberPattern=数値形式\ncsv_numberPattern_description=CSV ファイルに存在する数値列値を消費するための数値形式\ncsv_numberPattern_placeholder=数値形式 (#,###.##)\nbean_generator_class=ジェネレータークラス\nbean_generator_class_description=データセットを生成する Java クラスの完全修飾クラス名、f.i: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=ジェネレーターパラメーター\nbean_generator_params_description=ジェネレーターのクラス引数として使用する値ペアのパラメーターリスト\ntab_configguration=設定\ntab_preview=プレビュー\ntab_advancedConfiguration=高度\nfilter=フィルター\ndataColumns=データ列\ndataSetMustHaveAtLeastOneColumn=データセットに少なくとも 1 列は指定してください\ncolumnIsUsedInFilter=列はフィルターで使用されます\nlabel=ラベル\ntext=テキスト\nnumber=数値\ndate=日付\nshowColumnsAndFilter=列とフィルターパネルの表示\nhideColumnsAndFilter=列とフィルターパネルを隠す\ndefNotFound=データセット定義が見つからないか、このデータセットに定義がありません\nprometheus_server_url=サーバー URL\nprometheus_server_url_description=Prometheus サーバーの URL f.i: http://localhost:9090/\nprometheus_server_url_placeholder=http://localhost:9090\nprometheus_query=クエリー\nprometheus_query_description=このデータセットのデータの取得に使用するクエリー。\nprometheus_query_placeholder=時間()\nkafka_host=ホスト\nkafka_host_description=Kafka ブローカー/コンシューマー/プロデューサーの実行先のホスト\nkafka_host_placeholder=127.0.0.1\nkafka_port=ポート\nkafka_port_description=Kafka JMX に基づく JMX ポート\nkafka_port_placeholder=9999\nkafka_target=ターゲット\nkafka_target_description=メトリック収集のターゲット。出力は、選択したターゲットに合わせて変更されます。\nkafka_filter=フィルター\nkafka_filter_description=データセットの結果からメトリクスをフィルタリングします。フィルターはドメイン、タイプ、名前の列で使用できます。\nkafka_clientId=クライアント ID\nkafka_clientId_description=クライアント ID。コンシューマー/プロデューサーメトリクスに必要です。\nkafka_nodeId=ノード ID\nkafka_nodeId_description=コンシューマー/プロデューサーメトリクスと併用できるノード ID\nkafka_topic=トピック\nkafka_topic_description=監視するトピック。コンシューマー/プロデューサーメトリクスと合わせて使用する必要があります。\nkafka_partition=パーティション\nkafka_partition_description=監視するパーティション。これは、特にコンシューマーとトピック設定と合わせて使用する必要があります。"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_pt_BR.properties",
    "content": "newDataSet=Novo{0}  Data Set\nerror=Ocorreu um erro\ntype=Tipo\nmessage=Mensagem\ncause=Causa\nok=Ok\nloading=Carregando\nselectType=Selecione o tipo de provedor\nbean=Bean\ncsv=CSV\nsql=SQL\nbean_description=O provedor Bean permite consumir dados gerados pela classe do Java\ncsv_description=O provedor CSV permite consumir dados presentes no arquivo CSV\nsql_description=O provedor SQL permite consumir dados presentes em um sistema de armazenamento de SQL\nnext=Próximo\nnext_description=Vá para a edição da configuração do provedor\ntest=Teste\nsave=Salvar\nsave_description=Salve seus data sets e registre-o para torná-lo disponível\nback=Retornar\nperformance=Desempenho\nbackendCache=Cache de backend\nclientCache=Cache de cliente\nnone=Nenhum\nrefreshOnStaleData=Atualizar em dados interrompidos\nrefreshEvery=Atualizar dados a cada\nbytes=Bytes\nrows=Linhas\nattributeId=Id\nattributeColumnType=O tipo de dados da coluna\nattributeColumnType_description=O tipo de dados para a coluna do data set\nattributeUUID=UUID\nattributeUUID_description=Identificador único do data set. Útil para referenciar o data set\nattributeName=Nome\nattributeName_description=Nome do conjunto de dados. Uma sequência de caracteres que descreve o conjunto de dados\nattributeMaxBytes=Max bytes\nattributeMaxBytes_description=Se o cache do cliente está ativado, especifique o tamanho máximo (em bytes) permitido para enviar o data set ao cliente. Se o tamanho do conjunto de dados for maior do que este valor, ele não será enviado ao cliente\nattributeMaxRows=Máximo de Linhas\nattributeMaxRows_description=Se o cache backend estiver ativado, especifique o tamanho máximo (em linhas) permitidos para agrupar o data set na memória. Se o tamanho do conjunto de dados for maior do que esse valor, ele não foi agrupado\nattributeRefreshInterval=Intervalo\nattributeRefreshInterval_description=Caso a atualização do data set esteja habilitada, especifique o intervalo para atualizá-lo. Em cada atualização, será realizada uma busca no sistema de armazenamento.\non=LIGADO\noff=DESLIGADO\nsql_datasource=Data Source\nsql_datasource_placeHolder=java\\:jboss/datasources/ExampleDS\nsql_schema=Esquema\nsql_schema_description=O esquema do banco de dados, se necessário. Pode ser vazio.\nsql_schema_placeHolder=MySchema01\nsql_table=Tabela\nsql_table_description=A tabela de banco de dados para pesquisa\nsql_table_placeHolder=Minha Tabela\nsql_source=Fonte\nsql_query=Pesquisa\nsql_query_description=Consulta ANSI SQL para buscar o conjunto de dados \nsql_query_placeHolder=selecione * a partir de Minha Tabela\ncsv_filePath=Caminho do Arquivo\ncsv_filePath_description=Caminho do sistema do arquivo local onde o arquivo CSV está localizado\ncsv_URL=Arquivar URL\ncsv_URL_description=URL para os conteúdos CSV, f.i\\: http\\://myhost.com/myreports.csv\ncsv_URL_placeholder=file\\:///home/dashbuilder/myReports.csv\ncsv_useFilePath=Altere para o modo seletor do arquivo \ncsv_useFileURL=Altere para o modo do URL remoto\ncsv_sepChar=Carac. Separador\ncsv_sepChar_description=A codificação do caractere usado para valores separados\ncsv_sepChar_placeholder=Carac. Separador (;)\ncsv_quoteChar=Caractere Aspas\ncsv_quoteChar_description=A codificação do caractere usado para cotas\ncsv_quoteChar_placeholder=Carac. de Cotas (\\\\)\ncsv_escapeChar=Carac Escape\ncsv_escapeChar_description=A codificação do caractere usado para valores de escape\ncsv_escapeChar_placeholder=Carac Escape(\\\\)\ncsv_datePattern=Modelo da data\\:\ncsv_datePattern_description=O modelo de data para o consumo de valores das colunas de data presentes no arquivo CSV\ncsv_datePattern_placeholder=Modelo de data (MM-dd-yyy)\ncsv_numberPattern=Modelo de número\ncsv_numberPattern_description=O modelo de número para valores de coluna de números presente no arquivo CSV\ncsv_numberPattern_placeholder=Modelo de número (\\#,\\#\\#\\#.\\#\\#)\nel_cluster_name=nome do Cluster\nel_cluster_name_description=O nome do cluster. Pode ser vazio\nel_cluster_name_placeholder=my_cluster\nel_index=Índice\nel_index_placeholder=my_index\nel_type=Tipo do Documento\nel_type_description=Tipo de documento para consulta do índice fornecido. Pode conter vários valores separados por vírgula. Se vazio, o índice atual fornecido será consumido \nel_type_placeholder=my_type\nbean_generator_class=Classe geradora\nbean_generator_class_description=Nome de classe totalmente qualificado da classe em Java que gera o conjunto de dados. f.i\\: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=Parâmetros de geradores\nbean_generator_params_description=Lista de parâmetros do par valor para uso como argumentos de classe do gerador\ntab_configguration=Configuração \ntab_preview=Visualização\ntab_advancedConfiguration=Avançado\nfilter=Flitro\ndataColumns=Colunas de dados\ndataSetMustHaveAtLeastOneColumn=O Conjunto de Dados deve ter pelo menos uma coluna\ncolumnIsUsedInFilter=A coluna é usada no filtro\nlabel=Rótulo\ntext=Texto\nnumber=Número\ndate=Data\nshowColumnsAndFilter=Exibe as colunas e filtra o painel\nhideColumnsAndFilter=Esconde as colunas e filtra o painel\ndefNotFound=Definição do data set não foi encontrado ou este data set não possui definição\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetEditorConstants_zh_CN.properties",
    "content": "newDataSet=新建 {0} 数据集\nerror=发生了错误\ntype=类型\nmessage=消息\ncause=原因\nok=确认\nloading=正在加载\nselectType=选择供应商类型\nbean=Bean\ncsv=CSV\nsql=SQL\nbean_description=Bean 供应商允许消费 Java 类生成的数据\ncsv_description=CSV 供应商允许消费 CSV 文件里的数据\nsql_description=SQL 供应商允许消费 SQL 存储系统里的数据\nnext=下一步\nnext_description=编辑供应商配置\ntest=测试\nsave=保存\nsave_description=保存您的数据并注册它以使其可用\nback=后退\nperformance=性能\nbackendCache=后台缓存\nclientCache=客户缓存\nnone=无\nrefreshOnStaleData=刷新过时数据\nrefreshEvery=数据刷新频率\nbytes=字节\nrows=行\nattributeId=ID\nattributeColumnType=列数据类型\nattributeColumnType_description=数据集列的数据类型\nattributeUUID=UUID\nattributeUUID_description=数据集的唯一标识符。用于引用数据集。\nattributeName=名称\nattributeName_description=数据集名称。是一个描述该数据集的描述性字符串。\nattributeMaxBytes=最大字节\nattributeMaxBytes_description=如果启用了客户缓存，指定推送数据集到客户所允许的最大规格（字节）。如果数据集的大小大于这个值，它不会被推送至客户。\nattributeMaxRows=最大行数\nattributeMaxRows_description=如果启用了后台缓存，指定内存里缓存数据集所允许的最大规格（行数）。如果数据集的大小大于这个值，它不会被缓存。\nattributeRefreshInterval=间隔\nattributeRefreshInterval_description=如果启用过了数据集刷新，它指定刷新的时间间隔。每次刷新时都会完成一次对外部存储系统的查找。\non=ON\noff=OFF\nsql_datasource=数据源\nsql_datasource_placeHolder=java\\:jboss/datasources/ExampleDS\nsql_schema=模式\nsql_schema_description=数据库模式。它可以为空。\nsql_schema_placeHolder=MySchema01\nsql_table=表\nsql_table_description=要查询的数据库表\nsql_table_placeHolder=MyTable\nsql_source=源\nsql_query=查询\nsql_query_description=用于获取数据集的 ANSI SQL 查询\nsql_query_placeHolder=select * from MyTable\ncsv_filePath=文件路径\ncsv_filePath_description=CSV 文件所在的本地文件系统路径\ncsv_URL=文件 URL\ncsv_URL_description=CSV 内容的 URL，f.i\\: http\\://myhost.com/myreports.csv\ncsv_URL_placeholder=file\\:///home/dashbuilder/myReports.csv\ncsv_useFilePath=切换到文件选择器模式\ncsv_useFileURL=切换到远程 URL 模式\ncsv_sepChar=分隔符\ncsv_sepChar_description=用于分隔值的字符\ncsv_sepChar_placeholder=分隔符 (;)\ncsv_quoteChar=引用字符\ncsv_quoteChar_description=用于引用的字符\ncsv_quoteChar_placeholder=引用字符 (\\\\)\ncsv_escapeChar=转义字符\ncsv_escapeChar_description=用于转义的字符\ncsv_escapeChar_placeholder=转义字符 (\\\\)\ncsv_datePattern=日期格式\ncsv_datePattern_description=消费 CSV 文件里日期列的值所使用的模式\ncsv_datePattern_placeholder=日期格式  (MM-dd-yyyy)\ncsv_numberPattern=数字格式\ncsv_numberPattern_description=消费 CSV 文件里数字列的值所使用的模式\ncsv_numberPattern_placeholder=数字格式 (\\#,\\#\\#\\#.\\#\\#)\nel_cluster_name=群集名称\nel_cluster_name_description=群集的名称。它可以为空。\nel_cluster_name_placeholder=my_cluster\nel_index=索引\nel_index_placeholder=my_index\nel_type=文档类型\nel_type_description=对给定索引进行查询的文档类型。可包含使用逗号分开的多个值。如果为空，则会消耗给出当前索引的所有文档类型。\nel_type_placeholder=my_type\nbean_generator_class=生成器类\nbean_generator_class_description=生成数据集的 Java 类的全限定类名称。 f.i\\: org.example.MyDataSetGenerator\nbean_generator_class_placeholder=org.example.MyDataSetGenerator\nbean_generator_params=生成器参数\nbean_generator_params_description=作为生成器类参数使用的值对参数列表\ntab_configguration=配置\ntab_preview=预览\ntab_advancedConfiguration=高级的\nfilter=过滤器\ndataColumns=数据列\ndataSetMustHaveAtLeastOneColumn=数据集中必须至少有一列\ncolumnIsUsedInFilter=将该列作为过滤器使用\nlabel=标签\ntext=文本\nnumber=数字\ndate=日期\nshowColumnsAndFilter=显示列和过滤器面板\nhideColumnsAndFilter=隐藏列和过滤器面板\ndefNotFound=未找到数据集定义或者这个数据集没有定义\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants.properties",
    "content": "title=Data Set Explorer\nnewDataSet=New Data Set\nnoDataSets=No data sets\ncache=Backend cache\npush=Client cache\nrefresh=Refresh\nedit=Edit\ndelete=Delete\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nenabled=Enabled\ndisabled=Disabled\nbytes=Bytes\nrows=Rows\ncurrentStatus=Current status\ncurrentSize=Current size\nnotFound=Data Set definition not found\nloading=Loading\nerror=An error has occurred\ntype=Type\nmessage=Message\ncause=Cause\nok=Ok"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_de.properties",
    "content": "title=Datensatz-Explorer\nnewDataSet=Neuer Datensatz\nnoDataSets=Keine Datensätze\ncache=Backend-Cache\npush=Client-Cache\nrefresh=Aktualisieren\nedit=Bearbeiten\ndelete=Löschen\nbean=Bean\ncsv=CSV\nsql=SQL\nenabled=Aktiviert\ndisabled=Deaktiviert\nbytes=Bytes\nrows=Reihen\ncurrentStatus=Aktueller Status\ncurrentSize=Aktuelle Größe\nnotFound=Datensatzdefinition nicht gefunden\nloading=Lade\nerror=Ein Fehler ist aufgetreten\ntype=Typ\nmessage=Nachricht\ncause=Ursache\nok=Ok\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_es.properties",
    "content": "title=Explorador de conjuntos de datos\nnewDataSet=Nuevo conjunto de datos\nnoDataSets=No hay conjuntos de datos\ncache=Caché back-end\npush=Caché cliente\nrefresh=Actualizar\nedit=Editar\ndelete=Eliminar\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometeo\nkafka=Kafka\nenabled=Habilitado\ndisabled=Deshabilitado\nbytes=Bytes\nrows=Filas\ncurrentStatus=Estado actual\ncurrentSize=Tamaño actual\nnotFound=No se encuentra la definición del conjunto de datos\nloading=Cargando\nerror=Se produjo un error\ntype=Tipo\nmessage=Mensaje\ncause=Motivo\nok=Aceptar"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_fr.properties",
    "content": "title=Explorateur d''ensembles de données\nnewDataSet=Nouvel ensemble de données\nnoDataSets=Aucun ensemble de données\ncache=Cache du backend\npush=Cache du client\nrefresh=Rafraîchir\nedit=Modifier\ndelete=Supprimer\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nenabled=Activé\ndisabled=Désactivé\nbytes=Octets\nrows=Lignes\ncurrentStatus=État actuel\ncurrentSize=Taille actuelle\nnotFound=Définition de l''ensemble de données introuvable\nloading=Chargement\nerror=Une erreur s''est produite\ntype=Type\nmessage=Message\ncause=Cause\nok=OK"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_it.properties",
    "content": "title=Esploratore di set di dati\nnewDataSet=Nuovo set di dati\nnoDataSets=Nessun set di dati\ncache=Cache backend\npush=Cache client\nrefresh=Aggiorna\nedit=Modifica\ndelete=Elimina\nbean=Bean\ncsv=CSV\nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nenabled=Abilitato\ndisabled=Disabilitato\nbytes=Byte\nrows=Righe\ncurrentStatus=Stato corrente\ncurrentSize=Dimensione corrente\nnotFound=Definizione del set di dati non trovata\nloading=Caricamento\nerror=Si è verificato un errore\ntype=Tipo\nmessage=Messaggio\ncause=Causa\nok=Ok"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_ja.properties",
    "content": "title=データセットエクスプローラー\nnewDataSet=新しいデータセット\nnoDataSets=データセットなし\ncache=バックエンドキャッシュ\npush=クライアントキャッシュ\nrefresh=更新\nedit=編集\ndelete=削除\nbean=Bean\ncsv=CSV \nsql=SQL\nprometheus=Prometheus\nkafka=Kafka\nenabled=有効\ndisabled=無効\nbytes=バイト\nrows=行\ncurrentStatus=現在のステータス\ncurrentSize=現在のサイズ\nnotFound=データセット定義が見つかりません\nloading=ロード中\nerror=エラーが発生しました\ntype=タイプ\nmessage=メッセージ\ncause=原因\nok=OK"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_pt_BR.properties",
    "content": "title=Explorador do Data Set\nnewDataSet=Novo Data Set\nnoDataSets=Nenhum Data set\ncache=Cache de backend\npush=Cache de cliente\nrefresh=Atualizar\nedit=Editar\ndelete=Deletar\nbean=Bean\ncsv=CSV\nsql=SQL\nenabled=Ativado\ndisabled=Desativado\nbytes=Bytes\nrows=Linhas\ncurrentStatus=Status atual\ncurrentSize=Tamanho atual\nnotFound=Definição de Data Set não foi encontrada\nloading=Carregando\nerror=Ocorreu um erro\ntype=Tipo\nmessage=Mensagem\ncause=Causa\nok=Ok\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/main/resources/org/dashbuilder/client/widgets/resources/i18n/DataSetExplorerConstants_zh_CN.properties",
    "content": "title=数据集浏览器\nnewDataSet=新建数据集\nnoDataSets=没有数据集\ncache=后台缓存\npush=客户缓存\nrefresh=刷新\nedit=编辑\ndelete=删除\nbean=Bean\ncsv=CSV\nsql=SQL\nenabled=已启用的\ndisabled=已禁用的\nbytes=字节\nrows=行\ncurrentStatus=当前状态\ncurrentSize=当前大小\nnotFound=未找到数据集定义\nloading=正在加载\nerror=出错\ntype=类型\nmessage=消息\ncause=原因\nok=确认\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/common/ClientRuntimeErrorPopupPresenterTest.java",
    "content": "package org.dashbuilder.client.widgets.common;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ClientRuntimeErrorPopupPresenterTest {\n    \n    @Mock ErrorPopupPresenter.View view;\n    \n    private ClientRuntimeErrorPopupPresenter presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new ClientRuntimeErrorPopupPresenter(view);\n    }\n\n    @Test\n    public void testShowMessage() throws Exception {\n        final ClientRuntimeError error = mock(ClientRuntimeError.class);\n        final String message = \"message\";\n        final Throwable cause = mock(Throwable.class);\n        final String localizedMessage = \"localizedMessage\";\n        when(cause.getLocalizedMessage()).thenReturn(localizedMessage);\n        when(error.getMessage()).thenReturn(message);\n        when(error.getRootCause()).thenReturn(cause);\n        presenter.showMessage(error);\n        verify(view, times(1)).showMessage(anyString(), any(Command.class), any(Command.class));\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/common/CustomDataSetProviderType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets.common;\n\nimport org.dashbuilder.dataprovider.AbstractProviderType;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.StaticDataSetDef;\n\n\npublic class CustomDataSetProviderType extends AbstractProviderType<StaticDataSetDef> {\n\n    @Override\n    public String getName() {\n        return \"CUSTOM\";\n    }\n\n    @Override\n    public StaticDataSetDef createDataSetDef() {\n        StaticDataSetDef custom = new StaticDataSetDef();\n        custom.setProvider(this);\n        return custom;\n    }\n    \n    @Override\n    public boolean equals(Object obj) {\n        if (! (obj instanceof DataSetProviderType)) {\n            return false;\n        }\n        return getName().equals(((DataSetProviderType) obj).getName());\n    }\n\n    @Override\n    public int hashCode() {\n        return getName().hashCode();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/common/LoadingBoxTest.java",
    "content": "package org.dashbuilder.client.widgets.common;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class LoadingBoxTest {\n    \n    @Mock LoadingBox.View view;\n    \n    private LoadingBox presenter;\n    \n    @Before\n    public void setup() {\n        // The presenter instance to test.\n        presenter = new LoadingBox(view);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show();\n        verify(view, times(1)).show(anyString());\n    }\n\n    @Test\n    public void testHide() throws Exception {\n        presenter.hide();\n        verify(view, times(1)).close();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefColumnsFilterEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.column.DataSetDefColumnsEditor;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.ColumnFilter;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefColumnsFilterEditorTest {\n\n    @Mock DataSetDefColumnsEditor columnsEditor;\n    @Mock DataSetDefFilterEditor dataSetFilterEditor;\n    @Mock DataSetDefColumnsFilterEditor.View view;\n    @Mock DataSetDef dataSetDef;\n    \n    private DataSetDefColumnsFilterEditor tested;\n\n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        \n        tested = new DataSetDefColumnsFilterEditor(columnsEditor, dataSetFilterEditor, view);\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        tested.init();\n        verify(view, times(1)).init(tested);\n        verify(view, times(1)).initWidgets(any(), any());\n        verify(view, times(0)).setMaxHeight(anyString());\n    }\n\n    @Test\n    public void testSetMaxHeight() throws Exception {\n        final String maxH = \"100px\";\n        tested.setMaxHeight(maxH);\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefFilterEditor.View.class));\n        verify(view, times(1)).setMaxHeight(maxH);\n    }\n\n    @Test\n    public void testColumnListEditor() throws Exception {\n        assertEquals(columnsEditor, tested.columnListEditor());\n    }\n\n    @Test\n    public void testDataSetFilterEditor() throws Exception {\n        assertEquals(dataSetFilterEditor, tested.dataSetFilter());\n    }\n\n    @Test\n    public void testSetAcceptableValues() throws Exception {\n        final List l = mock(List.class);\n        tested.setAcceptableValues(l);\n        verify(columnsEditor, times(1)).setAcceptableValues(l);\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefFilterEditor.View.class));\n        verify(view, times(0)).setMaxHeight(anyString());\n    }\n\n    @Test\n    public void testSetValue() throws Exception {\n        DataSetFilter newFilter = mock(DataSetFilter.class);\n        List<ColumnFilter> createColumnFilters = createColumnFilters(\"col1\", \"col2\");\n        when(newFilter.getColumnFilterList()).thenReturn(createColumnFilters);\n        when(dataSetDef.getDataSetFilter()).thenReturn(newFilter);\n        tested.setValue(dataSetDef);\n        verify(columnsEditor, times(1)).onValueRestricted(\"col1\");\n        verify(columnsEditor, times(1)).onValueRestricted(\"col2\");\n        verify(columnsEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnsEditor, times(0)).setAcceptableValues(any(List.class));\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefFilterEditor.View.class));\n        verify(view, times(0)).setMaxHeight(anyString());\n    }\n\n    @Test\n    public void testOnFilterChangedEvent() throws Exception {\n        DataSetFilter oldFilter = mock(DataSetFilter.class);\n        List<ColumnFilter> oldCreateColumnFilters = createColumnFilters(\"col1\", \"col2\", \"col3\");\n        when(oldFilter.getColumnFilterList()).thenReturn(oldCreateColumnFilters);\n        DataSetFilter newFilter = mock(DataSetFilter.class);\n        List<ColumnFilter> createColumnFilters = createColumnFilters(\"col2\");\n        when(newFilter.getColumnFilterList()).thenReturn(createColumnFilters);\n        when(dataSetDef.getDataSetFilter()).thenReturn(newFilter);\n        FilterChangedEvent filterChangedEvent = mock(FilterChangedEvent.class);\n        when(filterChangedEvent.getContext()).thenReturn(dataSetFilterEditor);\n        when(filterChangedEvent.getOldFilter()).thenReturn(oldFilter);\n        when(filterChangedEvent.getFilter()).thenReturn(newFilter);\n        tested.onFilterChangedEvent(filterChangedEvent);\n        verify(columnsEditor, times(1)).onValueRestricted(\"col2\");\n        verify(columnsEditor, times(1)).onValueUnRestricted(\"col1\");\n        verify(columnsEditor, times(1)).onValueUnRestricted(\"col3\");\n        verify(columnsEditor, times(0)).setAcceptableValues(any(List.class));\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefFilterEditor.View.class));\n        verify(view, times(0)).setMaxHeight(anyString());\n    }\n\n    private List<ColumnFilter> createColumnFilters(String... columns) {\n        List<ColumnFilter> result = new ArrayList<ColumnFilter>();\n        for (String column : columns) {\n            ColumnFilter cf = mock(ColumnFilter.class);\n            when(cf.getColumnId()).thenReturn(column);\n            result.add(cf);\n        }\n        return result;\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefFilterEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.displayer.client.events.DataSetFilterChangedEvent;\nimport org.dashbuilder.displayer.client.widgets.filter.DataSetFilterEditor;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefFilterEditorTest {\n    \n    @Mock EventSourceMock<FilterChangedEvent> filterChangedEvent;\n    @Mock DataSetDefFilterEditor.View view;\n    @Mock DataSetDef dataSetDef;\n    @Mock DataSetFilterEditor dataSetFilterEditor;\n    @Mock DataSetMetadata dataSetMetadata = mock(DataSetMetadata.class);\n    @Mock DataSetFilter filter1 = mock(DataSetFilter.class);\n    @Mock DataSetFilter filter2 = mock(DataSetFilter.class);\n\n    private DataSetDefFilterEditor tested;\n    \n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        \n        when(filter1.cloneInstance()).thenReturn(filter2);\n        tested = new DataSetDefFilterEditor(view, dataSetFilterEditor, filterChangedEvent);\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        verify(view).init(tested);\n    }\n\n    @Test\n    public void testInitFilterEditor() throws Exception {\n        tested.value = filter1;\n        tested.init(dataSetMetadata);\n        verify(view).setWidget(any(IsWidget.class));\n        verify(dataSetFilterEditor).init(eq(filter2), eq(dataSetMetadata));\n    }\n\n    @Test\n    public void testSetValue() throws Exception {\n        tested.setValue(filter1);\n        assertEquals(filter2, tested.value);\n        verify(view, never()).setWidget(any(IsWidget.class));\n        verify(dataSetFilterEditor, never()).init(any(DataSetFilter.class), any(DataSetMetadata.class));\n    }\n\n    @Test\n    public void testOnValueChanged() throws Exception {\n        DataSetFilter filter3 = mock(DataSetFilter.class);\n        when(filter2.cloneInstance()).thenReturn(filter3);\n        tested.value = filter1;\n        tested.onValueChanged(new DataSetFilterChangedEvent(filter2));\n        assertEquals(filter3, tested.value);\n        verify(view, never()).setWidget(any(IsWidget.class));\n        verify(dataSetFilterEditor, never()).init(any(DataSetFilter.class), any(DataSetMetadata.class));\n        verify(filterChangedEvent).fire(any(FilterChangedEvent.class));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefPreviewTableTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.AbstractDisplayerTest;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport java.util.Date;\nimport java.util.List;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class DataSetDefPreviewTableTest extends AbstractDisplayerTest {\n    \n    @Mock DataSetDefPreviewTable.View view;\n    @Mock DataSetDef dataSetDef;\n    \n    private DataSetDefPreviewTable tested;\n    final List<DataColumnDef> columnDefList = mock(List.class);\n    final Displayer displayer = mock(Displayer.class);\n    final DisplayerListener displayerListener = mock(DisplayerListener.class);\n    final DisplayerSettings displayerSettings = mock(DisplayerSettings.class);\n    \n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        \n        when(columnDefList.isEmpty()).thenReturn(true);\n        when(dataSetDef.clone()).thenReturn(dataSetDef);\n        tested = new DataSetDefPreviewTable(displayerLocator, clientServices, view);\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        tested.init();\n        verify(view, times(1)).init(tested);\n        verify(view, times(0)).setDisplayer(any(IsWidget.class));\n        verify(view, times(0)).clear();\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        tested.tableDisplayer = displayer;\n        tested.clear();\n        assertNull(tested.tableDisplayer);\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).setDisplayer(any(IsWidget.class));\n        verify(view, times(1)).clear();\n    }\n\n    // TODO - David: @Test - Do the test after DisplayerLocator#get() removed.\n    public void testShow() throws Exception {\n        when(displayerSettings.getRenderer()).thenReturn(\"gwtcharts\");\n        tested.show(dataSetDef, columnDefList, displayerListener);\n        assertNotNull(tested.tableDisplayer);\n        verify(view, times(0)).init(tested);\n        verify(view, times(1)).setDisplayer(any(IsWidget.class));\n        verify(view, times(1)).clear();\n    }\n\n    @Test\n    public void testDraw() throws Exception {\n        tested.tableDisplayer = displayer;\n        tested.draw(displayerListener);\n        verify(displayer, times(1)).addListener(displayerListener);\n        verify(displayer, times(1)).draw();\n        verify(view, times(1)).setDisplayer(any(IsWidget.class));\n        verify(view, times(0)).init(tested);\n        verify(view, times(0)).clear();\n    }\n\n    @Test\n    public void testCSVConfig() throws Exception {\n        DataSetDef dataSetDef = DataSetDefFactory.newCSVDataSetDef()\n                .datePattern(\"dd/MM/yyyy\")\n                .numberPattern(\"#,###\")\n                .allColumns(true)\n                .buildDef();\n\n        DataSet dataSet = DataSetFactory.newDataSetBuilder()\n                .date(\"date\")\n                .number(\"number\")\n                .row(new Date(), 1d)\n                .buildDataSet();\n\n        when(dataSetLookupServices.lookupDataSet(any(), any())).thenReturn(dataSet);\n        tested.show(dataSetDef, null, displayerListener);\n\n        ArgumentCaptor<Displayer> argumentCaptor = ArgumentCaptor.forClass(Displayer.class);\n        verify(displayerListener).onDataLoaded(argumentCaptor.capture());\n        Displayer displayer = argumentCaptor.getValue();\n        DisplayerSettings settings = displayer.getDisplayerSettings();\n        assertEquals(settings.getColumnSettings(\"date\").getValuePattern(), \"dd/MM/yyyy\");\n        assertEquals(settings.getColumnSettings(\"number\").getValuePattern(), \"#,###\");\n        assertEquals(settings.isTableColumnPickerEnabled(), false);\n    }\n\n    @Test\n    public void testSQLConfig() throws Exception {\n        DataSetDef dataSetDef = DataSetDefFactory.newSQLDataSetDef()\n                .column(\"date\", ColumnType.DATE)\n                .column(\"number\", ColumnType.NUMBER)\n                .buildDef();\n\n        DataSet dataSet = DataSetFactory.newDataSetBuilder()\n                .date(\"date\")\n                .number(\"number\")\n                .row(new Date(), 1d)\n                .buildDataSet();\n\n        when(dataSetLookupServices.lookupDataSet(any(), any())).thenReturn(dataSet);\n        tested.show(dataSetDef, null, displayerListener);\n\n        ArgumentCaptor<Displayer> argumentCaptor = ArgumentCaptor.forClass(Displayer.class);\n        verify(displayerListener).onDataLoaded(argumentCaptor.capture());\n        Displayer displayer = argumentCaptor.getValue();\n        DisplayerSettings settings = displayer.getDisplayerSettings();\n        assertFalse(settings.isTableColumnPickerEnabled());\n        assertEquals(settings.getTablePageSize(), 10);\n        assertTrue(settings.isTableSortEnabled());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetDefProviderTypeEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\nimport org.dashbuilder.client.widgets.common.CustomDataSetProviderType;\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.client.widgets.dataset.event.DataSetDefCreationRequestEvent;\nimport org.dashbuilder.common.client.editor.list.HorizImageListEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport javax.enterprise.event.Event;\n\nimport static junit.framework.TestCase.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefProviderTypeEditorTest {\n    \n    @Mock HorizImageListEditor<DataSetProviderType> provider;\n    @Mock DataSetDefProviderTypeEditor.View view;\n    @Mock EventSourceMock<DataSetDefCreationRequestEvent> createEvent;\n\n    private DataSetDefProviderTypeEditor tested;\n    \n    @Mock ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n    @Mock DataSetEditorPlugin pluginEditor;\n    \n    @Before\n    public void setup() {\n        when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(true);\n        tested = spy(new DataSetDefProviderTypeEditor(provider, createEvent, view, dataSetEditorPlugin));\n\n        final String typeTitle = \"typeTitle\";\n        doReturn(typeTitle).when(tested).getTypeSelectorTitle(any(DataSetProviderType.class));\n        final String typeText = \"typeText\";\n        doReturn(typeText).when(tested).getTypeSelectorText(any(DataSetProviderType.class));\n        final SafeUri imageUri = mock(SafeUri.class);\n        doReturn(imageUri).when(tested).getTypeSelectorImageUri(any(DataSetProviderType.class));\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        tested.init();\n        verify(view, times(1)).init(tested);\n        verify(view, times(1)).initWidgets(any());\n        final ArgumentCaptor<Collection> actualEntriesCaptor = ArgumentCaptor.forClass(Collection.class);\n        verify(provider, times(1)).setEntries(actualEntriesCaptor.capture());\n        final Collection actualEntries = actualEntriesCaptor.getValue();\n        assertEquals(5, actualEntries.size());\n    }\n\n    @Test\n    public void testProviderInstance() throws Exception {\n        assertEquals(provider, tested.provider());\n    }\n\n    @Test\n    public void testProviderSelected() throws Exception {\n        tested.onItemClicked(new ValueChangeEvent<>(provider, null, DataSetProviderType.BEAN));\n        verify(createEvent).fire(any());\n    }\n    \n    @Test\n    public void testInitWithEditorPlugin() throws Exception {\n        when(pluginEditor.getProviderType()).thenReturn(new CustomDataSetProviderType());\n        when(pluginEditor.getTypeSelectorTitle()).thenReturn(\"Custom\");\n        when(pluginEditor.getTypeSelectorText()).thenReturn(\"CustomText\");\n        when(pluginEditor.getTypeSelectorImageUri()).thenReturn(Mockito.mock(SafeUri.class));\n        \n        when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(false);\n        when(dataSetEditorPlugin.iterator()).thenReturn(Arrays.asList(pluginEditor).iterator(), Arrays.asList(pluginEditor).iterator());\n        \n        \n        tested.init();\n        verify(view, times(1)).init(tested);\n        verify(view, times(1)).initWidgets(any());\n        final ArgumentCaptor<Collection> actualEntriesCaptor = ArgumentCaptor.forClass(Collection.class);\n        verify(provider, times(1)).setEntries(actualEntriesCaptor.capture());\n        final Collection actualEntries = actualEntriesCaptor.getValue();\n        assertEquals(6, actualEntries.size());\n        \n        verify(pluginEditor, times(1)).getTypeSelectorImageUri();\n        verify(pluginEditor, times(1)).getTypeSelectorTitle();\n        verify(pluginEditor, times(1)).getTypeSelectorText();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/DataSetEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor;\n\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.*;\nimport org.dashbuilder.client.widgets.dataset.event.ColumnsChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.FilterChangedEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.ColumnListEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.filter.DataSetFilter;\nimport org.dashbuilder.displayer.client.DataSetHandler;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerListener;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetEditorTest {\n\n    @Mock protected DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock protected IsWidget providerAttributesEditorView;\n    @Mock protected DataSetDefColumnsFilterEditor columnsAndFilterEditor;\n    @Mock protected DataSetDefPreviewTable previewTable;\n    @Mock protected DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor;\n    @Mock protected DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor;\n    @Mock protected DataSetDefRefreshAttributesEditor refreshEditor;\n    @Mock protected DataSetClientServices clientServices;\n    @Mock protected LoadingBox loadingBox;\n    @Mock protected EventSourceMock<ErrorEvent> errorEvent;\n    @Mock protected EventSourceMock<TabChangedEvent> tabChangedEvent;\n    @Mock protected DataSetEditor.View view;\n    @Mock protected DataSetDefFilterEditor filterEditor;\n    @Mock protected org.dashbuilder.dataset.client.editor.DataSetDefColumnsEditor columnsEditor;\n    @Mock protected ColumnListEditor columnListEditor;\n    @Mock protected DataSetDef dataSetDef;\n    \n    private DataSetEditor<DataSetDef> presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        MockitoAnnotations.initMocks(this);\n        IsWidget attributesEditor = mock(IsWidget.class);\n        \n        presenter = new DataSetEditor<DataSetDef>(basicAttributesEditor, attributesEditor, columnsAndFilterEditor,\n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor, refreshEditor, clientServices,\n                loadingBox, errorEvent, tabChangedEvent, view) {\n            @Override\n            public void init() {\n                super.init();\n            }\n        };\n        \n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        when(columnsAndFilterEditor.dataSetFilter()).thenReturn(filterEditor);\n        when(columnsAndFilterEditor.columnListEditor()).thenReturn(columnsEditor);\n        when(columnsEditor.columns()).thenReturn(columnListEditor);\n    }\n    \n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(\n                any(),\n                any(),\n                any(),\n                any(),\n                any(),\n                any(),\n                any()\n        );\n        verify(view, times(1)).addConfigurationTabItemClickHandler(any(Command.class));\n        verify(view, times(1)).addPreviewTabItemClickHandler(any(Command.class));\n        verify(view, times(1)).addAdvancedTabItemClickHandler(any(Command.class));\n        verify(columnsAndFilterEditor, times(1)).setMaxHeight(anyString());\n        verify(backendCacheAttributesEditor, times(1)).setRange(anyDouble(), anyDouble());\n        verify(clientCacheAttributesEditor, times(1)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n        verify(view, times(0)).openColumnsFilterPanel(anyString());\n        verify(view, times(0)).closeColumnsFilterPanel(anyString());\n        verify(view, times(0)).showErrorNotification(any(SafeHtml.class));\n        verify(view, times(0)).clearErrorNotification();\n    }\n\n    @Test\n    public void testShowConfigurationTab() {\n        presenter.showConfigurationTab();\n        presenter.afterPreviewCommand.execute();\n        verify(view, times(1)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n    }\n\n    @Test\n    public void testShowPreviewTab() {\n        presenter.showPreviewTab();\n        presenter.afterPreviewCommand.execute();\n        verify(view, times(1)).showPreviewTab();\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showAdvancedTab();\n    }\n\n    @Test\n    public void testShowAdvTab() {\n        presenter.showAdvancedTab();\n        presenter.afterPreviewCommand.execute();\n        verify(view, times(1)).showAdvancedTab();\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n    }\n\n    @Test\n    public void testSetAcceptableValues() {\n        List<DataColumnDef> acceptableValues = mock(List.class);\n        presenter.setAcceptableValues(acceptableValues);\n        verify(columnsAndFilterEditor, times(1)).setAcceptableValues(acceptableValues);\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testBasicAttributesEditor() {\n        assertEquals(basicAttributesEditor, presenter.basicAttributesEditor());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testColumnsAndFilterEditor() {\n        assertEquals(columnsAndFilterEditor, presenter.columnsAndFilterEditor());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testBackendCacheEditor() {\n        assertEquals(backendCacheAttributesEditor, presenter.backendCacheEditor());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testClientCacheEditor() {\n        assertEquals(clientCacheAttributesEditor, presenter.clientCacheEditor());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testRefreshEditor() {\n        assertEquals(refreshEditor, presenter.refreshEditor());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testOnOpenColumnsFilterPanel() {\n        presenter.onOpenColumnsFilterPanel();\n        verify(view, times(1)).openColumnsFilterPanel(anyString());\n    }\n\n    @Test\n    public void testOnCloseColumnsFilterPanel() {\n        presenter.onCloseColumnsFilterPanel();\n        verify(view, times(1)).closeColumnsFilterPanel(anyString());\n    }\n\n    @Test\n    public void testConfigurationTabItemClickHandler() {\n        presenter.configurationTabItemClickHandler.execute();\n        final ArgumentCaptor<TabChangedEvent> tabChangedEventCaptor =  ArgumentCaptor.forClass(TabChangedEvent.class);\n        verify(tabChangedEvent, times(1)).fire(tabChangedEventCaptor.capture());\n        final TabChangedEvent tabChangedEvent = tabChangedEventCaptor.getValue();\n        assertEquals(presenter, tabChangedEvent.getContext());\n        assertEquals(DataSetEditor.TAB_CONFIGURATION, tabChangedEvent.getTabId());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testPreviewTabItemClickHandler() {\n        presenter.previewTabItemClickHandler.execute();\n        final ArgumentCaptor<TabChangedEvent> tabChangedEventCaptor =  ArgumentCaptor.forClass(TabChangedEvent.class);\n        verify(tabChangedEvent, times(1)).fire(tabChangedEventCaptor.capture());\n        final TabChangedEvent tabChangedEvent = tabChangedEventCaptor.getValue();\n        assertEquals(presenter, tabChangedEvent.getContext());\n        assertEquals(DataSetEditor.TAB_PREVIEW, tabChangedEvent.getTabId());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testAdvTabItemClickHandler() {\n        presenter.advancedTabItemClickHandler.execute();\n        final ArgumentCaptor<TabChangedEvent> tabChangedEventCaptor =  ArgumentCaptor.forClass(TabChangedEvent.class);\n        verify(tabChangedEvent, times(1)).fire(tabChangedEventCaptor.capture());\n        final TabChangedEvent tabChangedEvent = tabChangedEventCaptor.getValue();\n        assertEquals(presenter, tabChangedEvent.getContext());\n        assertEquals(DataSetEditor.TAB_ADVANCED, tabChangedEvent.getTabId());\n        assertViewNotUsed();\n    }\n\n    @Test\n    public void testShowError() {\n        final ClientRuntimeError error = mock(ClientRuntimeError.class);\n        when(error.getCause()).thenReturn(\"errorCause\");\n        presenter.afterPreviewCommand = mock(Command.class);\n        presenter.showError(error);\n        verify(loadingBox, times(1)).hide();\n        verify(view, times(1)).showErrorNotification(any(SafeHtml.class));\n        verify(errorEvent, times(1)).fire(any(ErrorEvent.class));\n        verify(presenter.afterPreviewCommand, times(1)).execute();\n        verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n        verify(view, times(0)).openColumnsFilterPanel(anyString());\n        verify(view, times(0)).closeColumnsFilterPanel(anyString());\n        verify(view, times(0)).clearErrorNotification();\n    }\n\n    @Test\n    public void testOnColumnsChangedEvent() {\n        final DataColumnDef col1 = mock(DataColumnDef.class);\n        when(col1.getId()).thenReturn(\"col1\");\n        when(col1.getColumnType()).thenReturn(ColumnType.LABEL);\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.NUMBER);\n        final List<DataColumnDef> cols = new ArrayList<DataColumnDef>();\n        cols.add(col1);\n        cols.add(col2);\n        final ColumnsChangedEvent event = mock(ColumnsChangedEvent.class);\n        when(event.getContext()).thenReturn(columnListEditor);\n        when(event.getColumns()).thenReturn(cols);\n        presenter.dataSetDef = this.dataSetDef;\n        mockPreviewTableCall();\n        final Command afterPreviewCommand = mock(Command.class);\n        presenter.afterPreviewCommand = afterPreviewCommand;\n        presenter.onColumnsChangedEvent(event);\n        verify(dataSetDef, times(1)).setColumns(cols);\n        verify(loadingBox, times(1)).show();\n        verify(loadingBox, times(1)).hide();\n        verify(view, times(1)).clearErrorNotification();\n        verify(filterEditor, times(1)).init(any());\n        verify(afterPreviewCommand, times(1)).execute();\n        verify(view, times(0)).init(any(DataSetEditor.class));\n        verify(view, times(0)).initWidgets(\n                any(DataSetDefBasicAttributesEditor.View.class),\n                any(IsWidget.class),\n                any(DataSetDefColumnsFilterEditor.View.class),\n                any(DataSetDefPreviewTable.View.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefRefreshAttributesEditor.View.class)\n        );\n        verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n        verify(view, times(0)).openColumnsFilterPanel(anyString());\n        verify(view, times(0)).closeColumnsFilterPanel(anyString());\n        verify(view, times(0)).showErrorNotification(any(SafeHtml.class));\n    }\n\n    @Test\n    public void testOnFilterChangedEvent() {\n        final FilterChangedEvent event = mock(FilterChangedEvent.class);\n        final DataSetFilter filter = mock(DataSetFilter.class);\n        when(event.getContext()).thenReturn(filterEditor);\n        when(event.getFilter()).thenReturn(filter);\n        presenter.dataSetDef = this.dataSetDef;\n        mockPreviewTableCall();\n        final Command afterPreviewCommand = mock(Command.class);\n        presenter.afterPreviewCommand = afterPreviewCommand;\n        presenter.onFilterChangedEvent(event);\n        verify(dataSetDef, times(1)).setDataSetFilter(filter);\n        verify(loadingBox, times(1)).show();\n        verify(loadingBox, times(1)).hide();\n        verify(view, times(1)).clearErrorNotification();\n        verify(filterEditor, times(0)).init(any(DataSetMetadata.class));\n        verify(afterPreviewCommand, times(1)).execute();\n        verify(view, times(0)).init(any(DataSetEditor.class));\n        verify(view, times(0)).initWidgets(\n                any(DataSetDefBasicAttributesEditor.View.class),\n                any(IsWidget.class),\n                any(DataSetDefColumnsFilterEditor.View.class),\n                any(DataSetDefPreviewTable.View.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefRefreshAttributesEditor.View.class)\n        );\n        verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n        verify(view, times(0)).openColumnsFilterPanel(anyString());\n        verify(view, times(0)).closeColumnsFilterPanel(anyString());\n        verify(view, times(0)).showErrorNotification(any(SafeHtml.class));\n    }\n\n    protected void mockPreviewTableCall() {\n        final Displayer displayer = mock(Displayer.class);\n        final DataSetHandler dataSetHandler = mock(DataSetHandler.class);\n        final DataSet dataSet = mock(DataSet.class);\n        when(displayer.getDataSetHandler()).thenReturn(dataSetHandler);\n        when(dataSetHandler.getLastDataSet()).thenReturn(dataSet);\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(final InvocationOnMock invocationOnMock) throws Throwable {\n                DisplayerListener listener = (DisplayerListener) invocationOnMock.getArguments()[2];\n                listener.onDraw(displayer);\n                return null;\n            }\n        }).when(previewTable).show(any(DataSetDef.class), any(Collection.class), any(DisplayerListener.class));\n        \n    }\n\n    protected void assertViewNotUsed() {\n        verify(view, times(0)).init(any(DataSetEditor.class));\n        verify(view, times(0)).initWidgets(\n                any(DataSetDefBasicAttributesEditor.View.class),\n                any(IsWidget.class),\n                any(DataSetDefColumnsFilterEditor.View.class),\n                any(DataSetDefPreviewTable.View.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefCacheAttributesEditorView.class),\n                any(DataSetDefRefreshAttributesEditor.View.class)\n        );\n        verify(view, times(0)).addConfigurationTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addPreviewTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).addAdvancedTabItemClickHandler(any(Command.class));\n        verify(view, times(0)).showConfigurationTab();\n        verify(view, times(0)).showPreviewTab();\n        verify(view, times(0)).showAdvancedTab();\n        verify(view, times(0)).openColumnsFilterPanel(anyString());\n        verify(view, times(0)).closeColumnsFilterPanel(anyString());\n        verify(view, times(0)).showErrorNotification(any(SafeHtml.class));\n        verify(view, times(0)).clearErrorNotification();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBackendCacheAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefBackendCacheAttributesEditorTest {\n\n    @Mock ToggleSwitchEditor cacheEnabled;\n    @Mock ValueBoxEditor<Integer> cacheMaxRows;\n    @Mock DataSetDefCacheAttributesEditorView view;\n    private DataSetDefBackendCacheAttributesEditor presenter;\n    \n    @Before\n    public void setup() {\n        presenter = new DataSetDefBackendCacheAttributesEditor(cacheEnabled, cacheMaxRows, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(cacheMaxRows, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(1)).init(anyString(), anyString(), any(), any());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).setValue(anyDouble());\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n\n    @Test\n    public void testSetRange() {\n        presenter.setRange(1d, 2d);\n        verify(view, times(1)).setRange(1d, 2d);\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n    \n    @Test\n    public void testCacheEnabled() {\n        assertEquals(cacheEnabled, presenter.cacheEnabled());\n    }\n\n    @Test\n    public void testCacheMaxRows() {\n        assertEquals(cacheMaxRows, presenter.cacheMaxRows());\n    }\n    \n    @Test\n    public void testSetValueEnabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isCacheEnabled()).thenReturn(true);\n        presenter.setValue(dataSetDef);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(1)).setValue(anyDouble());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n    }\n\n    @Test\n    public void testSetValueDisabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isCacheEnabled()).thenReturn(false);\n        presenter.setValue(dataSetDef);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(1)).setValue(anyDouble());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n    }\n\n    @Test\n    public void testViewCallback() {\n        final Double value = 1d;\n        presenter.viewCallback.onValueChange(value);\n        verify(cacheMaxRows, times(1)).setValue(anyInt());\n        verify(cacheEnabled, times(0)).setValue(anyBoolean());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n\n    @Test\n    public void testViewCallbackNullified() {\n        final Double value = null;\n        presenter.viewCallback.onValueChange(value);\n        verify(cacheMaxRows, times(1)).setValue(100);\n        verify(cacheEnabled, times(0)).setValue(anyBoolean());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n    \n    public void testOnEnabledChangedEventUsingTrue() {\n        final ValueChangeEvent<Boolean> event = mock(ValueChangeEvent.class);\n        when(event.getContext()).thenReturn(cacheEnabled);\n        when(event.getValue()).thenReturn(true);\n        presenter.onEnabledChangedEvent(event);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n\n    public void testOnEnabledChangedEventUsingFalse() {\n        final ValueChangeEvent<Boolean> event = mock(ValueChangeEvent.class);\n        when(event.getContext()).thenReturn(cacheEnabled);\n        when(event.getValue()).thenReturn(false);\n        presenter.onEnabledChangedEvent(event);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefBasicAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefBasicAttributesEditorTest {\n\n    @Mock ValueBoxEditor<String> uuidEditor;\n    @Mock ValueBoxEditor<String> nameEditor;\n    @Mock DataSetDefBasicAttributesEditor.View view;\n    private DataSetDefBasicAttributesEditor presenter;\n    \n    @Before\n    public void setup() {\n        presenter = new DataSetDefBasicAttributesEditor(uuidEditor, nameEditor, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any());\n        verify(uuidEditor, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(nameEditor, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n    }\n\n    @Test\n    public void testUUID() {\n        assertEquals(uuidEditor, presenter.UUID());\n    }\n\n    @Test\n    public void testName() {\n        assertEquals(nameEditor, presenter.name());\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefClientCacheAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefClientCacheAttributesEditorTest {\n\n    @Mock ToggleSwitchEditor pushEnabled;\n    @Mock ValueBoxEditor<Integer> pushMaxSize;\n    @Mock DataSetDefCacheAttributesEditorView view;\n    private DataSetDefClientCacheAttributesEditor presenter;\n    \n    @Before\n    public void setup() {\n        presenter = new DataSetDefClientCacheAttributesEditor(pushEnabled, pushMaxSize, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(pushMaxSize, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(1)).init(anyString(), anyString(), any(), any());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).setValue(anyDouble());\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n\n    @Test\n    public void testSetRange() {\n        presenter.setRange(1d, 2d);\n        verify(view, times(1)).setRange(1d, 2d);\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n    \n    @Test\n    public void testPushEnabled() {\n        assertEquals(pushEnabled, presenter.pushEnabled());\n    }\n\n    @Test\n    public void testPushMaxSize() {\n        assertEquals(pushMaxSize, presenter.pushMaxSize());\n    }\n    \n    @Test\n    public void testSetValueEnabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isPushEnabled()).thenReturn(true);\n        presenter.setValue(dataSetDef);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(1)).setValue(anyDouble());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n    }\n\n    @Test\n    public void testSetValueDisabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isPushEnabled()).thenReturn(false);\n        presenter.setValue(dataSetDef);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(1)).setValue(anyDouble());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n    }\n\n    @Test\n    public void testViewCallback() {\n        final Double value = 1d;\n        presenter.viewCallback.onValueChange(value);\n        verify(pushMaxSize, times(1)).setValue(anyInt());\n        verify(pushEnabled, times(0)).setValue(anyBoolean());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n\n    @Test\n    public void testViewCallbackNullified() {\n        final Double value = null;\n        presenter.viewCallback.onValueChange(value);\n        verify(pushMaxSize, times(1)).setValue(100);\n        verify(pushEnabled, times(0)).setValue(anyBoolean());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n    \n    public void testOnEnabledChangedEventUsingTrue() {\n        final ValueChangeEvent<Boolean> event = mock(ValueChangeEvent.class);\n        when(event.getContext()).thenReturn(pushEnabled);\n        when(event.getValue()).thenReturn(true);\n        presenter.onEnabledChangedEvent(event);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n\n    public void testOnEnabledChangedEventUsingFalse() {\n        final ValueChangeEvent<Boolean> event = mock(ValueChangeEvent.class);\n        when(event.getContext()).thenReturn(pushEnabled);\n        when(event.getValue()).thenReturn(false);\n        presenter.onEnabledChangedEvent(event);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(0)).setRange(anyDouble(), anyDouble());\n        verify(view, times(0)).init(anyString(), anyString(), any(IsWidget.class), any(ValueBoxEditor.View.class));\n        verify(view, times(0)).init(any(DataSetDefCacheAttributesEditorView.ViewCallback.class));\n        verify(view, times(0)).setValue(anyDouble());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ToggleSwitchEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefRefreshAttributesEditorTest {\n\n    @Mock ToggleSwitchEditor refreshAlways;\n    @Mock DataSetDefRefreshIntervalEditor refreshTime;\n    @Mock DataSetDefRefreshAttributesEditor.View view;\n    private DataSetDefRefreshAttributesEditor presenter;\n    \n    @Before\n    public void setup() {\n        presenter = new DataSetDefRefreshAttributesEditor(refreshAlways, refreshTime, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(refreshTime, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any());\n        verify(view, times(1)).addRefreshEnabledButtonHandler(any(Command.class));\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n    \n    @Test\n    public void testRefreshAlways() {\n        assertEquals(refreshAlways, presenter.refreshAlways());\n    }\n\n    @Test\n    public void testRefreshTime() {\n        assertEquals(refreshTime, presenter.refreshTime());\n    }\n\n    @Test\n    public void testRefreshEnabledButtonHandlerDisabled() {\n        presenter.isRefreshEnabled = false;\n        presenter.refreshEnabledButtonHandler.execute();\n        assertEquals(true, presenter.isRefreshEnabled());\n        verify(refreshTime, times(1)).setEnabled(true);\n        verify(refreshAlways, times(1)).setEnabled(true);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class));\n        verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class));\n    }\n\n    @Test\n    public void testRefreshEnabledButtonHandlerEnabled() {\n        presenter.isRefreshEnabled = true;\n        presenter.refreshEnabledButtonHandler.execute();\n        assertEquals(false, presenter.isRefreshEnabled());\n        verify(refreshTime, times(1)).setEnabled(false);\n        verify(refreshAlways, times(1)).setEnabled(false);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class));\n        verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class));\n    }\n    \n    @Test\n    public void testSetValueEnabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.getRefreshTime()).thenReturn(\"1 second\");\n        presenter.setValue(dataSetDef);\n        assertEquals(true, presenter.isRefreshEnabled());\n        verify(refreshTime, times(1)).setEnabled(true);\n        verify(refreshAlways, times(1)).setEnabled(true);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class));\n        verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class));\n    }\n\n    @Test\n    public void testSetValueDisabled() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.getRefreshTime()).thenReturn(null);\n        presenter.setValue(dataSetDef);\n        assertEquals(false, presenter.isRefreshEnabled());\n        verify(refreshTime, times(1)).setEnabled(false);\n        verify(refreshAlways, times(1)).setEnabled(false);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(IsWidget.class), any(DataSetDefRefreshIntervalEditor.View.class));\n        verify(view, times(0)).addRefreshEnabledButtonHandler(any(Command.class));\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/attributes/DataSetDefRefreshIntervalEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.attributes;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.event.ValueChangeEvent;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetDefRefreshIntervalEditorTest {\n    \n    @Mock EventSourceMock<ValueChangeEvent<String>> valueChangeEvent;\n    @Mock DataSetDefRefreshIntervalEditor.View view;\n    \n    private DataSetDefRefreshIntervalEditor presenter;\n\n    @Before\n    public void setup() {\n        presenter = new DataSetDefRefreshIntervalEditor(view, valueChangeEvent);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(6)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).setQuantity(anyDouble());\n        verify(view, times(0)).getQuantity();\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n\n    @Test\n    public void testAddHelpContent() {\n        final Placement p = mock(Placement.class);\n        presenter.addHelpContent(\"t1\", \"c1\", p);\n        verify(view, times(1)).addHelpContent(\"t1\", \"c1\", p);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).setQuantity(anyDouble());\n        verify(view, times(0)).getQuantity();\n        verify(view, times(0)).setEnabled(anyBoolean());\n    }\n\n    @Test\n    public void testSetEnabled() {\n        presenter.setEnabled(true);\n        verify(view, times(1)).setEnabled(true);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).setQuantity(anyDouble());\n        verify(view, times(0)).getQuantity();\n    }\n\n    @Test\n    public void testSetDisabled() {\n        presenter.setEnabled(false);\n        verify(view, times(1)).setEnabled(false);\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).setQuantity(anyDouble());\n        verify(view, times(0)).getQuantity();\n    }\n\n    @Test\n    public void testSetValue() {\n        final String value = \"1second\";\n        presenter.setValue(value);\n        verify(view, times(1)).setQuantity(1d);\n        verify(view, times(1)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).getQuantity();\n    }\n\n    @Test\n    public void testSetAnotherValue() {\n        final String value = \"10minute\";\n        presenter.setValue(value);\n        verify(view, times(1)).setQuantity(10d);\n        verify(view, times(1)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n        verify(view, times(0)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).getQuantity();\n    }\n\n    @Test\n    public void testGetValue() {\n        when(view.getQuantity()).thenReturn(1d);\n        when(view.getSelectedIntervalTypeIndex()).thenReturn(0);\n        final String value = presenter.getValue();\n        assertEquals(\"1 second\", value);\n        verify(view, times(1)).getQuantity();\n        verify(view, times(1)).getSelectedIntervalTypeIndex();\n        verify(view, times(0)).setQuantity(10d);\n        verify(view, times(0)).setSelectedIntervalType(anyInt());\n        verify(view, times(0)).setEnabled(anyBoolean());\n        verify(view, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).addIntervalTypeItem(anyString());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetDefAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.bean;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.map.MapEditor;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BeanDataSetDefAttributesEditorTest {\n\n    @Mock ValueBoxEditor<String> generatorClass;\n    @Mock MapEditor paramaterMap;\n    @Mock BeanDataSetDefAttributesEditor.View view;\n    \n    private BeanDataSetDefAttributesEditor presenter;\n    \n    \n    @Before\n    public void setup() {\n        presenter = new BeanDataSetDefAttributesEditor(generatorClass, paramaterMap, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any());\n        verify(generatorClass, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n    }\n    \n    @Test\n    public void testGeneratorClass() {\n        assertEquals(generatorClass, presenter.generatorClass());\n    }\n\n    @Test\n    public void testParameterMap() {\n        assertEquals(paramaterMap, presenter.paramaterMap());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/bean/BeanDataSetEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.bean;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BeanDataSetEditorTest {\n\n    @Mock protected DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock protected DataSetDefColumnsFilterEditor columnsAndFilterEditor;\n    @Mock protected DataSetDefPreviewTable previewTable;\n    @Mock protected DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor;\n    @Mock protected DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor;\n    @Mock protected DataSetDefRefreshAttributesEditor refreshEditor;\n    @Mock protected DataSetClientServices clientServices;\n    @Mock protected LoadingBox loadingBox;\n    @Mock protected EventSourceMock<ErrorEvent> errorEvent;\n    @Mock protected EventSourceMock<TabChangedEvent> tabChangedEvent;\n    @Mock protected DataSetEditor.View view;\n    @Mock protected BeanDataSetDef dataSetDef;\n    @Mock BeanDataSetDefAttributesEditor attributesEditor;\n    BeanDataSetEditor presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        this.presenter = new BeanDataSetEditor(basicAttributesEditor, attributesEditor, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor, refreshEditor, clientServices,\n                loadingBox, errorEvent, tabChangedEvent, view);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n    }\n\n    @Test\n    public void testGeneratorClass() {\n        assertEquals(attributesEditor.generatorClass, presenter.generatorClass());\n    }\n\n    @Test\n    public void testParameterMap() {\n        assertEquals(attributesEditor.paramaterMap, presenter.paramaterMap());\n    }\n\n    /* Bean types does not support backend cache attributes edition. */\n    @Test\n    public void testSetValue() {\n        presenter.setValue(dataSetDef);\n        assertNull(presenter.backendCacheEditor());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnListEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.editor.client.CompositeEditor;\nimport com.google.gwt.editor.client.EditorDelegate;\nimport com.google.gwt.editor.client.adapters.ListEditor;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataColumnDefDriver;\nimport org.dashbuilder.client.widgets.dataset.event.ColumnsChangedEvent;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ColumnListEditorTest {\n\n    @Mock SyncBeanManager beanManager;\n    @Mock DataColumnDefDriver dataColumnDefDriver;\n    @Mock EventSourceMock<ColumnsChangedEvent> columnsChangedEvent;\n    @Mock ColumnListEditor.View view;\n    @Mock SyncBeanDef<DataColumnDefEditor> columnDefEditorSyncBeanDef;\n    @Mock DataColumnDefEditor dataColumnDefEditor;\n    private ColumnListEditor presenter;\n    final ListEditor<DataColumnDef, org.dashbuilder.dataset.client.editor.DataColumnDefEditor> listEditor = mock(ListEditor.class);\n    @Mock DataColumnDef col1;\n\n    @Before\n    public void setup() {\n        presenter = new ColumnListEditor(beanManager, dataColumnDefDriver, columnsChangedEvent, view);\n        \n        // Bean instantiation mocks.\n        when(beanManager.lookupBean(DataColumnDefEditor.class)).thenReturn(columnDefEditorSyncBeanDef);\n        when( columnDefEditorSyncBeanDef.newInstance() ).thenAnswer( new Answer<DataColumnDefEditor>() {\n            @Override\n            public DataColumnDefEditor answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return dataColumnDefEditor;\n            }\n        } );\n        \n        // Acceptable values.\n        when(col1.getId()).thenReturn(\"col1\");\n        when(col1.getColumnType()).thenReturn(ColumnType.LABEL);\n        final List<DataColumnDef> acceptableValues = buildAcceptableValues();\n        presenter.acceptableColumns = acceptableValues;\n        \n        // Column Editors.\n        final ValueBoxEditor<String> id = mock(ValueBoxEditor.class);\n        when(id.getValue()).thenReturn(\"col1\");\n        when(dataColumnDefEditor.id()).thenReturn(id);\n        final List<org.dashbuilder.dataset.client.editor.DataColumnDefEditor> editors = new ArrayList<org.dashbuilder.dataset.client.editor.DataColumnDefEditor>();\n        final List<DataColumnDef> columns = new ArrayList<DataColumnDef>();\n        columns.add(col1);\n        editors.add(dataColumnDefEditor);\n        when(listEditor.getEditors()).thenReturn(editors);\n        when(listEditor.getList()).thenReturn(columns);\n        presenter.listEditor = listEditor;\n\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        assertNotNull(presenter.listEditor);\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(0)).remove(anyInt());\n        verify(view, times(0)).clear();\n    }\n\n    @Test\n    public void testClear() {\n        presenter.clear();\n        assertNull(presenter.acceptableColumns);\n        verify(view, times(1)).clear();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).insert(anyInt(), any(DataColumnDefEditor.View.class), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(0)).remove(anyInt());\n    }\n\n    @Test\n    public void testSetAcceptableValues() {\n        final List<DataColumnDef> acceptableValues = buildAcceptableValues();\n        presenter.setAcceptableValues(acceptableValues);\n        verify(dataColumnDefEditor, times(1)).isEditMode(false);\n        verify(dataColumnDefDriver, times(1)).initialize(dataColumnDefEditor);\n        verify(dataColumnDefDriver, times(1)).edit(col1);\n        verify(view, times(1)).clear();\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).remove(anyInt());\n    }\n    \n    @Test\n    public void testOnValueRestricted() {\n        final String value = \"col1\";\n        presenter.restrictedColumns.clear();\n        presenter.onValueRestricted(value);\n        assertEquals(1, presenter.restrictedColumns.size());\n        assertEquals(\"col1\", presenter.restrictedColumns.get(0));\n        verify(dataColumnDefEditor, times(1)).isEditMode(false);\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * Column editor editMode set to false, as only one column present in the dset definition, so it cannot be unselected. \n     */\n    @Test\n    public void testOnValueUnRestrictedSingleColumn() {\n        final String value = \"col1\";\n        presenter.restrictedColumns.add(\"col1\");\n        presenter.onValueUnRestricted(value);\n        assertTrue(presenter.restrictedColumns.isEmpty());\n        verify(dataColumnDefEditor, times(1)).isEditMode(false);\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * Column editor editMode set to true, as more than one column present in the dset definition, so it can be selected/unselected. \n     */\n    @Test\n    public void testOnValueUnRestricted() {\n        final String value = \"col1\";\n        presenter.restrictedColumns.add(\"col1\");\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        presenter.listEditor.getList().add(col2);\n        presenter.onValueUnRestricted(value);\n        assertTrue(presenter.restrictedColumns.isEmpty());\n        verify(dataColumnDefEditor, times(1)).isEditMode(true);\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n    \n    @Test\n    public void testCreateEditorForTraversal() {\n        presenter.createEditorForTraversal();\n        verify(listEditor, times(1)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n\n    @Test\n    public void testGetPathElement() {\n        presenter.getPathElement(dataColumnDefEditor);\n        verify(listEditor, times(1)).getPathElement(dataColumnDefEditor);\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n    @Test\n    public void testSetEditorChain() {\n        final CompositeEditor.EditorChain<DataColumnDef, org.dashbuilder.dataset.client.editor.DataColumnDefEditor> chain = mock(CompositeEditor.EditorChain.class);\n        presenter.setEditorChain(chain);\n        verify(listEditor, times(1)).setEditorChain(chain);\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n    @Test\n    public void testSetDelegate() {\n        final EditorDelegate<List<DataColumnDef>> delegate = mock(EditorDelegate.class);\n        presenter.setDelegate(delegate);\n        verify(listEditor, times(1)).setDelegate(delegate);\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n    @Test\n    public void testFlush() {\n        presenter.flush();\n        verify(listEditor, times(1)).flush();\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n    @Test\n    public void testOnPropertyChange() {\n        final String s = \"prop1\";\n        presenter.onPropertyChange(s);\n        verify(listEditor, times(1)).onPropertyChange(s);\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).setValue(any(List.class));\n    }\n\n    @Test\n    public void testSetValue() {\n        final List<DataColumnDef> value = mock(List.class);\n        presenter.setValue(value);\n        verify(listEditor, times(1)).setValue(value);\n        verify(listEditor, times(0)).createEditorForTraversal();\n        verify(listEditor, times(0)).getPathElement(any(DataColumnDefEditor.class));\n        verify(listEditor, times(0)).setEditorChain(any(CompositeEditor.EditorChain.class));\n        verify(listEditor, times(0)).setDelegate(any(EditorDelegate.class));\n        verify(listEditor, times(0)).flush();\n        verify(listEditor, times(0)).onPropertyChange(anyString());\n    }\n\n    @Test\n    public void testSetProviderType() {\n        DataSetProviderType type = mock(DataSetProviderType.class);\n        presenter.setProviderType(type);\n        assertEquals(type, presenter.providerType);\n    }\n\n    @Test\n    public void testOnColumnSelected() {\n        listEditor.getList().clear();\n        when(col1.clone()).thenReturn(col1);\n        presenter.onColumnSelect(0, true);\n        assertEquals(1, listEditor.getList().size());\n        assertEquals(col1, listEditor.getList().get(0));\n        verify(columnsChangedEvent, times(1)).fire(any(ColumnsChangedEvent.class));\n    }\n\n    @Test\n    public void testOnColumnUnSelected() {\n        when(col1.clone()).thenReturn(col1);\n        presenter.onColumnSelect(0, false);\n        assertTrue(listEditor.getList().isEmpty());\n        verify(columnsChangedEvent, times(1)).fire(any(ColumnsChangedEvent.class));\n    }\n\n    /**\n     * Column editor created with editMode set to false, as only one column present in the dset definition, so it cannot be unselected. \n     */\n    @Test\n    public void testDataColumnDefEditorSource_Create() {\n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);\n        verify(dataColumnDefEditor, times(2)).isEditMode(false);\n        verify(dataColumnDefEditor, times(1)).setProviderType(any());\n        verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));\n        verify(view, times(2)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(2)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * Column editor created with editMode set to true, as more than one column present in the dset definition. First column enabled too, as it was disabled as was the unique one before this creation.\n     */\n    @Test\n    public void testDataColumnDefEditorSource_CreateMultiple() {\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        presenter.acceptableColumns.add(col2);\n        presenter.listEditor.getList().add(col2);\n        presenter.restrictedColumns.clear();\n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);\n        verify(dataColumnDefEditor, times(2)).isEditMode(true);\n        verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));\n        verify(dataColumnDefEditor, times(1)).setProviderType(any());\n        verify(view, times(2)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(2)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * See https://issues.jboss.org/browse/DASHBUILDE-79\n     */\n    @Test\n    public void testDataColumnDefEditorSource_Create_DASHBUILDE79_A() {\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        presenter.acceptableColumns.add(col2);\n        presenter.listEditor.getList().add(col2);\n        presenter.listEditor.getEditors().clear();\n        presenter.restrictedColumns.clear();\n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);\n        verify(dataColumnDefEditor, times(1)).isEditMode(true);\n        verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));\n        verify(dataColumnDefEditor, times(1)).setProviderType(any());\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * See https://issues.jboss.org/browse/DASHBUILDE-79 (re-opened)\n     */\n    @Test\n    public void testDataColumnDefEditorSource_Create_DASHBUILDE79_B() {\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        presenter.acceptableColumns.add(col2);\n        presenter.listEditor.getList().clear();\n        presenter.listEditor.getList().add(col2);\n        presenter.listEditor.getEditors().clear();\n        presenter.restrictedColumns.clear();\n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        org.dashbuilder.dataset.client.editor.DataColumnDefEditor e = source.create(0);\n        verify(dataColumnDefEditor, times(1)).isEditMode(false);\n        verify(dataColumnDefEditor, times(1)).setOriginalColumnType(any(ColumnType.class));\n        verify(dataColumnDefEditor, times(1)).setProviderType(any());\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), anyString());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    /**\n     * Ensure create a dummy not editable column when disposing the only one present from the definition.\n     */\n    @Test\n    public void testDataColumnDefEditorSource_Dispose() {\n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        source.dispose(dataColumnDefEditor);\n        verify(dataColumnDefEditor, times(1)).removeFromParent();\n        verify(dataColumnDefEditor, times(3)).isEditMode(false);\n        verify(dataColumnDefDriver, times(1)).initialize(dataColumnDefEditor);\n        verify(dataColumnDefDriver, times(1)).edit(col1);\n        verify(view, times(2)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(2)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n\n    /**\n     * Ensure create a dummy not editable column when disposing the only one present from the definition and ensure first column is set to editMode=false, as will be the only one column in the definition.\n     */\n    @Test\n    public void testDataColumnDefEditorSource_Dispose_UniqueColumn() {\n        final DataColumnDef col2 = mock(DataColumnDef.class);\n        when(col2.getId()).thenReturn(\"col2\");\n        when(col2.getColumnType()).thenReturn(ColumnType.LABEL);\n        final DataColumnDefEditor col2Editor = mock(DataColumnDefEditor.class);\n        final ValueBoxEditor<String> id2 = mock(ValueBoxEditor.class);\n        when(id2.getValue()).thenReturn(\"col2\");\n        when(col2Editor.id()).thenReturn(id2);        \n        presenter.acceptableColumns.add(col2);\n        presenter.listEditor.getList().add(col2);\n        presenter.listEditor.getEditors().add(col2Editor);\n\n        when( columnDefEditorSyncBeanDef.newInstance() ).thenAnswer( new Answer<DataColumnDefEditor>() {\n            @Override\n            public DataColumnDefEditor answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return col2Editor;\n            }\n        } );\n        \n        ColumnListEditor.DataColumnDefEditorSource source = presenter.createDataColumnDefEditorSource();\n        source.dispose(col2Editor);\n        verify(dataColumnDefEditor, times(0)).removeFromParent();\n        verify(dataColumnDefEditor, times(0)).isEditMode(false);\n        verify(col2Editor, times(1)).removeFromParent();\n        verify(col2Editor, times(2)).isEditMode(false);\n        \n        verify(dataColumnDefDriver, times(1)).initialize(col2Editor);\n        verify(dataColumnDefDriver, times(1)).edit(col2);\n        verify(view, times(1)).insert(anyInt(), any(), anyBoolean(), anyBoolean(), any());\n        verify(view, times(1)).remove(anyInt());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clear();\n    }\n\n    protected List<DataColumnDef> buildAcceptableValues() {\n        final List<DataColumnDef> acceptableValues = new ArrayList<DataColumnDef>();\n        acceptableValues.add(col1);\n        return acceptableValues;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/column/ColumnTypeEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.list.DropDownImageListEditor;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport java.util.Collection;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ColumnTypeEditorTest {\n\n    @Mock DropDownImageListEditor<ColumnType> columnType;\n    @Mock Widget columnTypeWidget;\n    private ColumnTypeEditor presenter;\n\n    @Before\n    public void setup() {\n        presenter = spy(new ColumnTypeEditor(columnType));\n        final SafeUri uri = mock(SafeUri.class);\n        doReturn(uri).when(presenter).getImageUri(any(ColumnType.class));\n        when(columnType.asWidget()).thenReturn(columnTypeWidget);\n    }\n\n    @Test\n    public void testAsWidget() {\n        assertEquals(columnTypeWidget, presenter.asWidget());\n    }\n    \n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(columnType, times(1)).setImageSize(anyString(), anyString());\n        verify(columnType, times(1)).setEntries(any(Collection.class));\n        verify(columnType, times(0)).setHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(columnType, times(0)).isEditMode(anyBoolean());\n    }\n\n\n    @Test\n    public void testAddHelpContent() {\n        final Placement p = mock(Placement.class);\n        presenter.addHelpContent(\"t1\", \"c1\", p);\n        verify(columnType, times(1)).setHelpContent(\"t1\", \"c1\", p);\n        verify(columnType, times(0)).setImageSize(anyString(), anyString());\n        verify(columnType, times(0)).setEntries(any(Collection.class));\n        verify(columnType, times(0)).isEditMode(anyBoolean());\n    }\n    \n    @Test\n    public void testColumnType() {\n        assertEquals(columnType, presenter.columnType());\n    }\n\n    @Test\n    public void testEnableEditMode() {\n        presenter.isEditMode(true);\n        verify(columnType, times(1)).isEditMode(true);\n        verify(columnType, times(0)).setHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(columnType, times(0)).setImageSize(anyString(), anyString());\n        verify(columnType, times(0)).setEntries(any(Collection.class));\n    }\n\n    @Test\n    public void testDisableEditMode() {\n        presenter.isEditMode(false);\n        verify(columnType, times(1)).isEditMode(false);\n        verify(columnType, times(0)).setHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(columnType, times(0)).setImageSize(anyString(), anyString());\n        verify(columnType, times(0)).setEntries(any(Collection.class));\n    }\n\n    @Test\n    public void testSetValue() {\n        final DataColumnDef col1 = mock(DataColumnDef.class);\n        when(col1.getId()).thenReturn(\"col1\");\n        when(col1.getColumnType()).thenReturn(ColumnType.LABEL);\n        presenter.setValue(col1);\n        verify(columnType, times(1)).setEntries(any(Collection.class));\n        verify(columnType, times(0)).isEditMode(anyBoolean());\n        verify(columnType, times(1)).setHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(columnType, times(0)).setImageSize(anyString(), anyString());\n    }\n\n    @Test\n    public void testSetOriginalColumnType() {\n        ColumnType type = mock(ColumnType.class);\n        presenter.setOriginalColumnType(type);\n        verify(columnType, times(1)).setEntries(any(Collection.class));\n        verify(columnType, times(0)).isEditMode(anyBoolean());\n        verify(columnType, times(0)).setHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(columnType, times(0)).setImageSize(anyString(), anyString());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/column/DataColumnDefEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataColumnDefEditorTest {\n\n    @Mock ValueBoxEditor<String> id;\n    @Mock ColumnTypeEditor columnType;\n    @Mock DataColumnDefEditor.View view;\n    @Mock Widget idWidget;\n    private DataColumnDefEditor presenter;\n\n    @Before\n    public void setup() {\n        presenter = new DataColumnDefEditor(id, columnType, view);\n        presenter.providerType = DataSetProviderType.SQL;\n        when(id.asWidget()).thenReturn(idWidget);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any());\n        verify(columnType, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n    }\n\n    @Test\n    public void testRemoveFromParent() {\n        presenter.removeFromParent();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class));\n        verify(idWidget, times(1)).removeFromParent();\n    }\n\n    @Test\n    public void testEnableEditMode() {\n        presenter.isEditMode(true);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class));\n        verify(columnType, times(1)).isEditMode(true);\n    }\n\n    @Test\n    public void testEnableEditModeSpecificForBeanTypes() {\n        presenter.providerType = DataSetProviderType.BEAN;\n        presenter.isEditMode(true);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class));\n        verify(columnType, times(1)).isEditMode(false);\n    }\n\n    @Test\n    public void testDisableEditMode() {\n        presenter.isEditMode(false);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class));\n        verify(columnType, times(1)).isEditMode(false);\n    }\n\n    @Test\n    public void testSetOriginalColumnType() {\n        ColumnType type = mock(ColumnType.class);\n        presenter.setOriginalColumnType(type);\n        verify(columnType, times(1)).setOriginalColumnType(type);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class));\n        verify(columnType, times(0)).isEditMode(anyBoolean());\n    }\n    \n    @Test\n    public void testId() {\n        assertEquals(id, presenter.id());\n    }\n\n    @Test\n    public void testColumnType() {\n        assertEquals(columnType, presenter.columnType());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/column/DataSetDefColumnsEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.column;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetDefColumnsEditorTest {\n\n    @Mock\n    ColumnListEditor columnListEditor;\n    \n    private DataSetDefColumnsEditor presenter;\n\n    @Before\n    public void setup() {\n        presenter = new DataSetDefColumnsEditor(columnListEditor);\n    }\n\n    @Test\n    public void testSetAcceptableValues() {\n        final List acceptableValues = mock(List.class);\n        presenter.setAcceptableValues(acceptableValues);\n        assertEquals(acceptableValues, presenter.acceptableValues);\n        verify(columnListEditor, times(1)).setAcceptableValues(acceptableValues);\n        verify(columnListEditor, times(0)).onValueRestricted(anyString());\n        verify(columnListEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnListEditor, times(0)).setProviderType(any(DataSetProviderType.class));\n    }\n\n    @Test\n    public void testOnValueRestricted() {\n        final String v = \"value\";\n        presenter.onValueRestricted(v);\n        verify(columnListEditor, times(1)).onValueRestricted(v);\n        verify(columnListEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnListEditor, times(0)).setAcceptableValues(any(List.class));\n        verify(columnListEditor, times(0)).setProviderType(any(DataSetProviderType.class));\n    }\n\n    @Test\n    public void testOnValueUnRestricted() {\n        final String v = \"value\";\n        presenter.onValueUnRestricted(v);\n        verify(columnListEditor, times(1)).onValueUnRestricted(v);\n        verify(columnListEditor, times(0)).onValueRestricted(anyString());\n        verify(columnListEditor, times(0)).setAcceptableValues(any(List.class));\n        verify(columnListEditor, times(0)).setProviderType(any(DataSetProviderType.class));\n    }\n\n    @Test\n    public void testSetValueBeanType() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        when(dataSetDef.isAllColumnsEnabled()).thenReturn(false);\n        presenter.acceptableValues = buildAcceptableValues();\n        presenter.setValue(dataSetDef);\n        verify(dataSetDef, times(0)).setColumns(any(List.class));\n        verify(dataSetDef, times(0)).setAllColumnsEnabled(anyBoolean());\n        verify(columnListEditor, times(1)).setProviderType(DataSetProviderType.BEAN);\n        verify(columnListEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnListEditor, times(0)).onValueRestricted(anyString());\n        verify(columnListEditor, times(0)).setAcceptableValues(any(List.class));\n    }\n\n    @Test\n    public void testSetValueWithNotAllColumns() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isAllColumnsEnabled()).thenReturn(false);\n        presenter.acceptableValues = buildAcceptableValues();\n        presenter.setValue(dataSetDef);\n        verify(dataSetDef, times(0)).setColumns(any(List.class));\n        verify(dataSetDef, times(0)).setAllColumnsEnabled(anyBoolean());\n        verify(columnListEditor, times(1)).setProviderType(any(DataSetProviderType.class));\n        verify(columnListEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnListEditor, times(0)).onValueRestricted(anyString());\n        verify(columnListEditor, times(0)).setAcceptableValues(any(List.class));\n    }\n\n    @Test\n    public void testSetValueWithAllColumns() {\n        final DataSetDef dataSetDef = mock(DataSetDef.class);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isAllColumnsEnabled()).thenReturn(true);\n        presenter.acceptableValues = buildAcceptableValues();\n        presenter.setValue(dataSetDef);\n        verify(dataSetDef, times(1)).setColumns(any(List.class));\n        verify(dataSetDef, times(1)).setAllColumnsEnabled(false);\n        verify(columnListEditor, times(1)).setProviderType(any(DataSetProviderType.class));\n        verify(columnListEditor, times(0)).onValueUnRestricted(anyString());\n        verify(columnListEditor, times(0)).onValueRestricted(anyString());\n        verify(columnListEditor, times(0)).setAcceptableValues(any(List.class));\n    }\n    \n    private List<DataColumnDef> buildAcceptableValues() {\n        final DataColumnDef col1 = mock(DataColumnDef.class);\n        final List<DataColumnDef> acceptableValues = new ArrayList<DataColumnDef>();\n        acceptableValues.add(col1);\n        return acceptableValues;\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetDefAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.csv;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetDefAttributesEditor;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.file.FileUploadEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefFactory;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class CSVDataSetDefAttributesEditorTest {\n\n    @Mock DataSetClientServices dataSetClientServices;\n    @Mock ValueBoxEditor<String> fileURL;\n    @Mock FileUploadEditor filePath;\n    @Mock ValueBoxEditor<Character> separatorChar;\n    @Mock ValueBoxEditor<Character> quoteChar;\n    @Mock ValueBoxEditor<Character> escapeChar;\n    @Mock ValueBoxEditor<String> datePattern;\n    @Mock ValueBoxEditor<String> numberPattern;\n    @Mock CSVDataSetDefAttributesEditor.View view;\n    \n    private CSVDataSetDefAttributesEditor presenter;\n    \n    \n    @Before\n    public void setup() {\n        doAnswer(args -> args.getArguments()[0])\n                .when(dataSetClientServices)\n                .getUploadFileUrl(anyString());\n\n        presenter = new CSVDataSetDefAttributesEditor(dataSetClientServices,\n                fileURL, filePath, separatorChar, quoteChar,\n                escapeChar, datePattern, numberPattern, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any(),any(), any(), any(), any(), any());\n        verify(fileURL, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(filePath, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(separatorChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(quoteChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(escapeChar, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(datePattern, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(numberPattern, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(filePath, times(1)).configure(anyString(), any(FileUploadEditor.FileUploadEditorCallback.class));\n        verify(view, times(1)).showFilePathInput();\n        verify(view, times(0)).showFileURLInput();\n        ArgumentCaptor<FileUploadEditor.FileUploadEditorCallback> callbackCaptor = ArgumentCaptor.forClass(FileUploadEditor.FileUploadEditorCallback.class);\n        verify(filePath).configure(anyString(), callbackCaptor.capture());\n\n\n        CSVDataSetDef dataSetDef = (CSVDataSetDef) DataSetDefFactory.newCSVDataSetDef().uuid(\"test\").buildDef();\n        presenter.setValue(dataSetDef);\n        FileUploadEditor.FileUploadEditorCallback fileCallback = callbackCaptor.getValue();\n        String fileUrl = fileCallback.getUploadFileUrl();\n        assertEquals(fileUrl, \"default://master@dashbuilder/datasets/tmp/test.csv\");\n    }\n    \n    @Test\n    public void testFileUrl() {\n        assertEquals(fileURL, presenter.fileURL());\n    }\n\n    @Test\n    public void testFilePath() {\n        assertEquals(filePath, presenter.filePath());\n    }\n\n    @Test\n    public void testSepChar() {\n        assertEquals(separatorChar, presenter.separatorChar());\n    }\n\n    @Test\n    public void testQuoteChar() {\n        assertEquals(quoteChar, presenter.quoteChar());\n    }\n\n    @Test\n    public void testEscapeChar() {\n        assertEquals(escapeChar, presenter.escapeChar());\n    }\n\n    @Test\n    public void testDatePattern() {\n        assertEquals(datePattern, presenter.datePattern());\n    }\n\n    @Test\n    public void testNumberPattern() {\n        assertEquals(numberPattern, presenter.numberPattern());\n    }\n\n    @Test\n    public void testSetValueUsingFileUrl() {\n        final CSVDataSetDef dataSetDef = mock(CSVDataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.CSV);\n        when(dataSetDef.getFileURL()).thenReturn(\"fileUrl\");\n        when(dataSetDef.getFilePath()).thenReturn(null);\n        presenter.setValue(dataSetDef);\n        assertEquals(false, presenter.isUsingFilePath());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class));\n        verify(view, times(1)).showFileURLInput();\n        verify(view, times(0)).showFilePathInput();\n    }\n\n    @Test\n    public void testSetValueUsingFilePath() {\n        final CSVDataSetDef dataSetDef = mock(CSVDataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.CSV);\n        when(dataSetDef.getFileURL()).thenReturn(null);\n        when(dataSetDef.getFilePath()).thenReturn(\"filePath\");\n        presenter.setValue(dataSetDef);\n        assertEquals(true, presenter.isUsingFilePath());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class));\n        verify(view, times(1)).showFilePathInput();\n        verify(view, times(0)).showFileURLInput();\n    }\n    \n    public void testCallbackUseFileUrl() {\n        presenter.onUseFileURLButtonClick();\n        assertEquals(false, presenter.isUsingFilePath());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class));\n        verify(view, times(1)).showFileURLInput();\n        verify(view, times(0)).showFilePathInput();\n    }\n\n    public void testCallbackUseFilePath() {\n        presenter.onUseFilePathButtonClick();\n        assertEquals(true, presenter.isUsingFilePath());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(ValueBoxEditor.View.class), any(IsWidget.class),any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class), any(ValueBoxEditor.View.class));\n        verify(view, times(1)).showFilePathInput();\n        verify(view, times(0)).showFileURLInput();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/csv/CSVDataSetEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.csv;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class CSVDataSetEditorTest {\n\n    @Mock protected DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock protected DataSetDefColumnsFilterEditor columnsAndFilterEditor;\n    @Mock protected DataSetDefPreviewTable previewTable;\n    @Mock protected DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor;\n    @Mock protected DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor;\n    @Mock protected DataSetDefRefreshAttributesEditor refreshEditor;\n    @Mock protected DataSetClientServices clientServices;\n    @Mock protected LoadingBox loadingBox;\n    @Mock protected EventSourceMock<ErrorEvent> errorEvent;\n    @Mock protected EventSourceMock<TabChangedEvent> tabChangedEvent;\n    @Mock protected DataSetEditor.View view;\n    @Mock protected CSVDataSetDef dataSetDef;\n    @Mock CSVDataSetDefAttributesEditor attributesEditor;\n    CSVDataSetEditor presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        this.presenter = new CSVDataSetEditor(basicAttributesEditor, attributesEditor, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor, refreshEditor, clientServices,\n                loadingBox, errorEvent, tabChangedEvent, view);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.CSV);\n    }\n\n    @Test\n    public void testFileUrl() {\n        assertEquals(attributesEditor.fileURL, presenter.fileURL());\n    }\n\n    @Test\n    public void testFilePath() {\n        assertEquals(attributesEditor.filePath, presenter.filePath());\n    }\n\n    @Test\n    public void testSepChar() {\n        assertEquals(attributesEditor.separatorChar, presenter.separatorChar());\n    }\n\n    @Test\n    public void testQuoteChar() {\n        assertEquals(attributesEditor.quoteChar, presenter.quoteChar());\n    }\n\n    @Test\n    public void testEscapeChar() {\n        assertEquals(attributesEditor.escapeChar, presenter.escapeChar());\n    }\n\n    @Test\n    public void testDatePattern() {\n        assertEquals(attributesEditor.datePattern, presenter.datePattern());\n    }\n\n    @Test\n    public void testNumberPattern() {\n        assertEquals(attributesEditor.numberPattern, presenter.numberPattern());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetDefAttributesEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.sql;\n\nimport java.util.Arrays;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.common.client.editor.ValueBoxEditor;\nimport org.dashbuilder.common.client.editor.list.DropDownEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\nimport org.dashbuilder.dataset.service.SQLProviderServices;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SQLDataSetDefAttributesEditorTest {\n\n    @Mock DropDownEditor dataSource;\n    @Mock ValueBoxEditor<String> dbSchema;\n    @Mock ValueBoxEditor<String> dbTable;\n    @Mock ValueBoxEditor<String> dbSQL;\n    @Mock SQLProviderServices sqlProviderServices;\n    @Mock SQLDataSetDefAttributesEditor.View view;\n\n    Caller<SQLProviderServices> sqlProviderServicesCaller;\n    SQLDataSetDefAttributesEditor presenter;\n    SQLDataSourceDef dataSourceDef = new SQLDataSourceDef(\"test\", \"test\");\n\n    @Before\n    public void setup() {\n        when(sqlProviderServices.getDataSourceDefs()).thenReturn(Arrays.asList(dataSourceDef));\n        sqlProviderServicesCaller = new CallerMock<>(sqlProviderServices);\n        presenter = new SQLDataSetDefAttributesEditor(dataSource, dbSchema, dbTable, dbSQL, sqlProviderServicesCaller, view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).initWidgets(any(), any(), any() ,any());\n        verify(dataSource, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSchema, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbTable, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSQL, times(1)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(1)).query();\n        verify(view, times(0)).table();\n\n        verify(sqlProviderServices).getDataSourceDefs();\n        verify(dataSource).setEntries(any());\n        verify(dataSource).setSelectHint(anyString());\n    }\n    \n    @Test\n    public void testDataSource() {\n        assertEquals(dataSource, presenter.dataSource());\n    }\n\n    @Test\n    public void testDbSchema() {\n        assertEquals(dbSchema, presenter.dbSchema());\n    }\n\n    @Test\n    public void testDbTable() {\n        assertEquals(dbTable, presenter.dbTable());\n    }\n\n    @Test\n    public void testDbSQL() {\n        assertEquals(dbSQL, presenter.dbSQL());\n    }\n\n    @Test\n    public void testSetValueUsingTable() {\n        final SQLDataSetDef dataSetDef = mock(SQLDataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.getDbTable()).thenReturn(\"table1\");\n        when(dataSetDef.getDbSQL()).thenReturn(null);\n        presenter.setValue(dataSetDef);\n        assertEquals(false, presenter.isUsingQuery());\n        verify(view, times(1)).table();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(DropDownEditor.View.class), any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class) ,any(ValueBoxEditor.View.class));\n        verify(dataSource, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSchema, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbTable, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSQL, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).query();\n    }\n\n    @Test\n    public void testSetValueUsingQuery() {\n        final SQLDataSetDef dataSetDef = mock(SQLDataSetDef.class);\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.getDbTable()).thenReturn(null);\n        when(dataSetDef.getDbSQL()).thenReturn(\"query1\");\n        presenter.setValue(dataSetDef);\n        assertEquals(true, presenter.isUsingQuery());\n        verify(view, times(1)).query();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).initWidgets(any(DropDownEditor.View.class), any(ValueBoxEditor.View.class),\n                any(ValueBoxEditor.View.class) ,any(ValueBoxEditor.View.class));\n        verify(dataSource, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSchema, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbTable, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(dbSQL, times(0)).addHelpContent(anyString(), anyString(), any(Placement.class));\n        verify(view, times(0)).table();\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/sql/SQLDataSetEditorTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.sql;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.common.LoadingBox;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefColumnsFilterEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefPreviewTable;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBackendCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefClientCacheAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TabChangedEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SQLDataSetEditorTest  {\n\n    @Mock protected DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock protected DataSetDefColumnsFilterEditor columnsAndFilterEditor;\n    @Mock protected DataSetDefPreviewTable previewTable;\n    @Mock protected DataSetDefBackendCacheAttributesEditor backendCacheAttributesEditor;\n    @Mock protected DataSetDefClientCacheAttributesEditor clientCacheAttributesEditor;\n    @Mock protected DataSetDefRefreshAttributesEditor refreshEditor;\n    @Mock protected DataSetClientServices clientServices;\n    @Mock protected LoadingBox loadingBox;\n    @Mock protected EventSourceMock<ErrorEvent> errorEvent;\n    @Mock protected EventSourceMock<TabChangedEvent> tabChangedEvent;\n    @Mock protected DataSetEditor.View view;\n    @Mock protected SQLDataSetDef dataSetDef;\n    @Mock SQLDataSetDefAttributesEditor attributesEditor;\n    SQLDataSetEditor presenter;\n    \n    @Before\n    public void setup() throws Exception {\n        this.presenter = new SQLDataSetEditor(basicAttributesEditor, attributesEditor, columnsAndFilterEditor, \n                previewTable, backendCacheAttributesEditor, clientCacheAttributesEditor, refreshEditor, clientServices,\n                loadingBox, errorEvent, tabChangedEvent, view);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n    }\n\n    @Test\n    public void testDataSource() {\n        Assert.assertEquals(attributesEditor.dataSource, presenter.dataSource());\n    }\n\n    @Test\n    public void testDbSchema() {\n        Assert.assertEquals(attributesEditor.dbSchema, presenter.dbSchema());\n    }\n\n    @Test\n    public void testDbTable() {\n        Assert.assertEquals(attributesEditor.dbTable, presenter.dbTable());\n    }\n\n    @Test\n    public void testDbSQL() {\n        Assert.assertEquals(attributesEditor.dbSQL, presenter.dbSQL());\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/AbstractDataSetWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets.dataset.editor.workflow;\n\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.validations.DataSetValidatorProvider;\nimport org.dashbuilder.validations.dataset.BeanDataSetDefValidator;\nimport org.dashbuilder.validations.dataset.CSVDataSetDefValidator;\nimport org.dashbuilder.validations.dataset.SQLDataSetDefValidator;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\npublic abstract class AbstractDataSetWorkflowTest {\n\n    @Mock\n    protected BeanDataSetDefValidator beanDataSetDefValidator;\n\n    @Mock\n    protected CSVDataSetDefValidator csvDataSetDefValidator;\n\n    @Mock\n    protected SQLDataSetDefValidator sqlDataSetDefValidator;\n\n    protected DataSetValidatorProvider validatorProvider;\n\n    protected void setup() throws Exception {\n\n        when( beanDataSetDefValidator.getSupportedProvider() ).thenReturn( DataSetProviderType.BEAN );\n        when( csvDataSetDefValidator.getSupportedProvider() ).thenReturn( DataSetProviderType.CSV );\n        when( sqlDataSetDefValidator.getSupportedProvider() ).thenReturn( DataSetProviderType.SQL );\n\n        validatorProvider = new DataSetValidatorProvider( mock( ManagedInstance.class ) ) {\n            {\n                registerValidator( beanDataSetDefValidator );\n                registerValidator( csvDataSetDefValidator );\n                registerValidator( sqlDataSetDefValidator );\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/DataSetEditorWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.validation.client.impl.ConstraintViolationImpl;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetEditorWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    public static final String UUID = \"uuid1\";\n    public static final String NAME = \"name1\";\n\n    @Mock SyncBeanManager beanManager;\n    @Mock EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock DataSetClientServices clientServices;\n    @Mock DataSetDef dataSetDef;\n    @Mock DataSet dataSet;\n    @Mock SimpleBeanEditorDriver driver;\n\n    @Mock DataSetEditorWorkflow.View view;\n\n    private DataSetEditorWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new DataSetEditorWorkflow(clientServices, validatorProvider, beanManager, saveRequestEvent,\n                testDataSetEvent, cancelRequestEvent, view) {\n\n        };\n        presenter.dataSetDef = this.dataSetDef;\n\n        when(dataSetDef.getUUID()).thenReturn(UUID);\n        when(dataSetDef.getName()).thenReturn(NAME);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        when(dataSet.getUUID()).thenReturn(UUID);\n        when(dataSet.getRowCount()).thenReturn(0);\n        when(dataSetDef.clone()).thenReturn(dataSetDef);\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(final InvocationOnMock invocationOnMock) throws Throwable {\n                DataSetReadyCallback callback = (DataSetReadyCallback) invocationOnMock.getArguments()[2];\n                callback.callback(dataSet);\n                return null;\n            }\n        }).when(clientServices).lookupDataSet(any(dataSetDef.getClass()), any(DataSetLookup.class), any(DataSetReadyCallback.class));\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testClear() {\n        presenter.dataSetDef = this.dataSetDef;\n        final Command c = mock(Command.class);\n        presenter.flushCommand = c;\n        presenter.stepValidator = c;\n        presenter.clear();\n        assertNull(presenter.getDataSetDef());\n        assertNull(presenter.flushCommand);\n        assertNull(presenter.stepValidator);\n        assertTrue(presenter.violations.isEmpty());\n        verify(view, times(1)).clearView();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).clearButtons();\n    }\n\n    // Expect RuntimeException!!!\n    @Test(expected = RuntimeException.class)\n    public void testDoTestDataSetNotEdited() {\n        presenter.dataSetDef = null;\n        final DataSetEditorWorkflow.TestDataSetCallback testDataSetCallback = mock(DataSetEditorWorkflow.TestDataSetCallback.class);\n        presenter.testDataSet(testDataSetCallback);\n    }\n\n    @Test\n    public void testDoTestDataSet() throws Exception {\n        final DataSetEditorWorkflow.TestDataSetCallback testDataSetCallback = mock(DataSetEditorWorkflow.TestDataSetCallback.class);\n        presenter.testDataSet(testDataSetCallback);\n        verify(dataSetDef, times(1)).setAllColumnsEnabled(true);\n        verify(dataSetDef, times(1)).setColumns(null);\n        verify(dataSetDef, times(1)).setDataSetFilter(null);\n        verify(dataSetDef, times(1)).clone();\n        verify(dataSetDef, times(1)).setCacheEnabled(false);\n        verify(testDataSetCallback, times(1)).onSuccess(dataSet);\n        verify(testDataSetCallback, times(0)).onError(any(ClientRuntimeError.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testFlush() {\n        final Command c = mock(Command.class);\n        presenter.flushCommand = c;\n        presenter.flush();\n        verify(c, times(1)).execute();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testShowNextButton() {\n        presenter.showNextButton();\n        verify(view, times(1)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testShowTestButton() {\n        presenter.showTestButton();\n        verify(view, times(1)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testShowBackButton() {\n        presenter.showBackButton();\n        verify(view, times(1)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testClearButtons() {\n        presenter.clearButtons();\n        verify(view, times(1)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testNoHasErrors() {\n        final Collection violations = mock(Collection.class);\n        when(violations.isEmpty()).thenReturn(true);\n        presenter.violations = violations;\n        assertFalse(presenter.hasErrors());\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testHasErrors() {\n        final Collection violations = mock(Collection.class);\n        when(violations.isEmpty()).thenReturn(false);\n        presenter.violations = violations;\n        assertTrue(presenter.hasErrors());\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testFlushDriver() {\n        final Collection violations = mock(Collection.class);\n        when(violations.isEmpty()).thenReturn(true);\n        presenter.violations = violations;\n        final Command c = mock(Command.class);\n        presenter.stepValidator = c;\n        presenter.flush(driver);\n        verify(driver, times(1)).flush();\n        verify(c, times(1)).execute();\n        assertFalse(presenter.hasErrors());\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testAddViolations() {\n        presenter.violations.clear();\n        ConstraintViolationImpl v1 = mock(ConstraintViolationImpl.class);\n        List<ConstraintViolation> _violations = new ArrayList<ConstraintViolation>();\n        _violations.add(v1);\n        presenter.addViolations(_violations);\n        assertTrue(presenter.hasErrors());\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n\n    }\n\n    @Test\n    public void testButtonCommand() {\n        final Command c = mock(Command.class);\n        presenter.flushCommand = c;\n        presenter.testButtonCommand.execute();\n        verify(c, times(1)).execute();\n        verify(testDataSetEvent, times(1)).fire(any(TestDataSetRequestEvent.class));\n        verify(saveRequestEvent, times(0)).fire(any(SaveRequestEvent.class));\n        verify(cancelRequestEvent, times(0)).fire(any(CancelRequestEvent.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testSaveButtonCommand() {\n        final Command c = mock(Command.class);\n        presenter.flushCommand = c;\n        presenter.saveButtonCommand.execute();\n        verify(c, times(1)).execute();\n        verify(saveRequestEvent, times(1)).fire(any(SaveRequestEvent.class));\n        verify(testDataSetEvent, times(0)).fire(any(TestDataSetRequestEvent.class));\n        verify(cancelRequestEvent, times(0)).fire(any(CancelRequestEvent.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n    @Test\n    public void testCancelButtonCommand() {\n        presenter.cancelButtonCommand.execute();\n        verify(cancelRequestEvent, times(1)).fire(any(CancelRequestEvent.class));\n        verify(saveRequestEvent, times(0)).fire(any(SaveRequestEvent.class));\n        verify(testDataSetEvent, times(0)).fire(any(TestDataSetRequestEvent.class));\n        verify(view, times(0)).clearButtons();\n        verify(view, times(0)).addButton(anyString(), anyString(), anyBoolean(), any(Command.class));\n        verify(view, times(0)).add(any(IsWidget.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).clearView();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/BeanDataSetBasicAttributesWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.BeanDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class BeanDataSetBasicAttributesWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    BeanDataSetDef dataSetDef;\n    @Mock\n    DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetDefAttributesEditor beanDataSetDefAttributesEditor;\n    @Mock\n    DataSetEditorWorkflow.View view;\n\n    private BeanDataSetBasicAttributesWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new BeanDataSetBasicAttributesWorkflow( clientServices,\n                                                            validatorProvider,\n                                                            beanManager,\n                                                            basicAttributesEditor,\n                                                            saveRequestEvent,\n                                                            testDataSetEvent,\n                                                            cancelRequestEvent,\n                                                            view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.BEAN );\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( BeanDataSetDefAttributesDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetDefAttributesEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidate() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.validate();\n        verify( beanDataSetDefValidator, times( 1 ) ).validateCustomAttributes( any( BeanDataSetDef.class ) );\n        verify( beanDataSetDefValidator, times( 0 ) ).validate( any( BeanDataSetDef.class ),\n                                                                anyBoolean(),\n                                                                anyBoolean(),\n                                                                anyBoolean() );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/CSVDataSetBasicAttributesWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.CSVDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class CSVDataSetBasicAttributesWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    CSVDataSetDef dataSetDef;\n    @Mock\n    DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetDefAttributesEditor csvDataSetDefAttributesEditor;\n    @Mock\n    DataSetEditorWorkflow.View view;\n\n    private CSVDataSetBasicAttributesWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new CSVDataSetBasicAttributesWorkflow( clientServices,\n                                                           validatorProvider,\n                                                           beanManager,\n                                                           basicAttributesEditor,\n                                                           saveRequestEvent,\n                                                           testDataSetEvent,\n                                                           cancelRequestEvent,\n                                                           view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.CSV );\n\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( CSVDataSetDefAttributesDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetDefAttributesEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidateUsingFilePath() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = csvDataSetDefAttributesEditor;\n        when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( true );\n        presenter.validate();\n        verify( csvDataSetDefValidator, times( 1 ) ).validateCustomAttributes( dataSetDef, true );\n        verify( csvDataSetDefValidator, times( 0 ) ).validate( any( CSVDataSetDef.class ),\n                                                               anyBoolean(),\n                                                               anyBoolean(),\n                                                               anyBoolean() );\n    }\n\n    @Test\n    public void testValidateUsingFileUrl() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = csvDataSetDefAttributesEditor;\n        when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( false );\n        presenter.validate();\n        verify( csvDataSetDefValidator, times( 1 ) ).validateCustomAttributes( dataSetDef, false );\n        verify( csvDataSetDefValidator, times( 0 ) ).validate( any( CSVDataSetDef.class ),\n                                                               anyBoolean(),\n                                                               anyBoolean(),\n                                                               anyBoolean() );\n    }\n\n    @Test\n    public void testFlushDriverUsingFilePath() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = csvDataSetDefAttributesEditor;\n        when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( true );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setFileURL( null );\n        verify( dataSetDef, times( 0 ) ).setFilePath( null );\n    }\n\n    @Test\n    public void testFlushDriverUsingFileUrl() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = csvDataSetDefAttributesEditor;\n        when( csvDataSetDefAttributesEditor.isUsingFilePath() ).thenReturn( false );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setFilePath( null );\n        verify( dataSetDef, times( 0 ) ).setFileURL( null );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/DataSetBasicAttributesWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataSetDefBasicAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class DataSetBasicAttributesWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock\n    DataSetDefBasicAttributesDriver dataSetDefBasicAttributesDriver;\n    @Mock\n    SyncBeanDef<DataSetDefBasicAttributesDriver> simpleBeanEditorDriverSyncBeanDef;\n    @Mock\n    SyncBeanDef<DataSetDefBasicAttributesEditor> simpleEditorSyncBeanDef;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    private DataSetBasicAttributesWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        // Bean instantiation mocks.\n        when( beanManager.lookupBean( DataSetDefBasicAttributesDriver.class ) ).thenReturn(\n                simpleBeanEditorDriverSyncBeanDef );\n        when( simpleBeanEditorDriverSyncBeanDef.newInstance() ).thenAnswer( new Answer<DataSetDefBasicAttributesDriver>() {\n            @Override\n            public DataSetDefBasicAttributesDriver answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return dataSetDefBasicAttributesDriver;\n            }\n        } );\n        when( beanManager.lookupBean( DataSetDefBasicAttributesEditor.class ) ).thenReturn( simpleEditorSyncBeanDef );\n        when( simpleEditorSyncBeanDef.newInstance() ).thenAnswer( new Answer<DataSetDefBasicAttributesEditor>() {\n            @Override\n            public DataSetDefBasicAttributesEditor answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return basicAttributesEditor;\n            }\n        } );\n\n        presenter = new DataSetBasicAttributesWorkflow( clientServices,\n                                                        validatorProvider,\n                                                        beanManager,\n                                                        basicAttributesEditor,\n                                                        saveRequestEvent,\n                                                        testDataSetEvent,\n                                                        cancelRequestEvent,\n                                                        view ) {\n\n            @Override\n            protected Class<? extends SimpleBeanEditorDriver> getDriverClass() {\n                return DataSetDefBasicAttributesDriver.class;\n            }\n\n            @Override\n            protected Class getEditorClass() {\n                return DataSetDefBasicAttributesEditor.class;\n            }\n\n            @Override\n            protected Iterable<ConstraintViolation<?>> validate() {\n                return null;\n            }\n        };\n\n    }\n\n    @Test\n    public void testBasicAttributesEdition() {\n        DataSetDef def = mock( DataSetDef.class );\n        presenter.edit( def ).basicAttributesEdition();\n        verify( beanManager, times( 2 ) ).lookupBean( DataSetDefBasicAttributesDriver.class );\n        verify( dataSetDefBasicAttributesDriver, times( 2 ) ).initialize( basicAttributesEditor );\n        verify( dataSetDefBasicAttributesDriver, times( 2 ) ).edit( def );\n        verify( view, times( 2 ) ).clearView();\n        verify( view, times( 2 ) ).add( any() );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/DataSetProviderTypeWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetDefProviderTypeEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.DataSetDefProviderTypeDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.DataSetDefCreationRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.common.client.editor.list.HorizImageListEditor;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.jgroups.util.Util.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class DataSetProviderTypeWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSetDefProviderTypeEditor providerTypeEditor;\n    @Mock\n    DataSetDefProviderTypeDriver dataSetDefProviderTypeDriver;\n    @Mock\n    SyncBeanDef<DataSetDefProviderTypeDriver> simpleBeanEditorDriverSyncBeanDef;\n    @Mock\n    HorizImageListEditor<DataSetProviderType> provider;\n    @Mock\n    DataSetEditorWorkflow.View view;\n\n    private DataSetProviderTypeWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n\n        // Bean instantiation mocks.\n        when( beanManager.lookupBean( DataSetDefProviderTypeDriver.class ) ).thenReturn(\n                simpleBeanEditorDriverSyncBeanDef );\n        when( simpleBeanEditorDriverSyncBeanDef.newInstance() ).thenAnswer( new Answer<SimpleBeanEditorDriver>() {\n            @Override\n            public SimpleBeanEditorDriver answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return dataSetDefProviderTypeDriver;\n            }\n        } );\n\n        presenter = new DataSetProviderTypeWorkflow( clientServices,\n                                                     validatorProvider,\n                                                     beanManager,\n                                                     providerTypeEditor,\n                                                     saveRequestEvent,\n                                                     cancelRequestEvent,\n                                                     testDataSetEvent,\n                                                     view );\n        when( providerTypeEditor.provider() ).thenReturn( provider );\n    }\n\n\n    @Test\n    public void testProviderTypeValue() {\n        when( provider.getValue() ).thenReturn( DataSetProviderType.SQL );\n        assertEquals( DataSetProviderType.SQL, presenter.getProviderType() );\n    }\n\n    @Test\n    public void testProviderTypeEdition() {\n        DataSetDef def = mock( DataSetDef.class );\n        presenter.edit( def ).providerTypeEdition();\n        verify( beanManager, times( 1 ) ).lookupBean( DataSetDefProviderTypeDriver.class );\n        verify( dataSetDefProviderTypeDriver, times( 1 ) ).initialize( providerTypeEditor );\n        verify( dataSetDefProviderTypeDriver, times( 1 ) ).edit( any( DataSetDef.class ) );\n        verify( view, times( 2 ) ).clearView();\n        verify( view, times( 1 ) ).add( any() );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n    @Test\n    public void testProviderTypeSelected() {\n        DataSetDefCreationRequestEvent createEvent = new DataSetDefCreationRequestEvent(providerTypeEditor, DataSetProviderType.BEAN);\n        presenter.onProviderTypeSelected(createEvent);\n\n        verify(saveRequestEvent).fire(any());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/create/SQLDataSetBasicAttributesWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.create;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.attributes.DataSetDefBasicAttributesEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.SQLDataSetDefAttributesDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class SQLDataSetBasicAttributesWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    SQLDataSetDef dataSetDef;\n    @Mock\n    DataSetDefBasicAttributesEditor basicAttributesEditor;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetDefAttributesEditor sqlDataSetDefAttributesEditor;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    private SQLDataSetBasicAttributesWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new SQLDataSetBasicAttributesWorkflow( clientServices,\n                                                           validatorProvider,\n                                                           beanManager,\n                                                           basicAttributesEditor,\n                                                           saveRequestEvent,\n                                                           testDataSetEvent,\n                                                           cancelRequestEvent,\n                                                           view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.SQL );\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( SQLDataSetDefAttributesDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetDefAttributesEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidateUsingQuery() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = sqlDataSetDefAttributesEditor;\n        when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( true );\n        presenter.validate();\n        verify( sqlDataSetDefValidator, times( 1 ) ).validateCustomAttributes( any( SQLDataSetDef.class ), eq( true ) );\n        verify( sqlDataSetDefValidator, times( 0 ) ).validate( any( SQLDataSetDef.class ),\n                                                               anyBoolean(),\n                                                               anyBoolean(),\n                                                               anyBoolean() );\n    }\n\n    @Test\n    public void testValidateUsingTable() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = sqlDataSetDefAttributesEditor;\n        when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( false );\n        presenter.validate();\n        verify( sqlDataSetDefValidator, times( 1 ) ).validateCustomAttributes( any( SQLDataSetDef.class ),\n                                                                               eq( false ) );\n        verify( sqlDataSetDefValidator, times( 0 ) ).validate( any( SQLDataSetDef.class ),\n                                                               anyBoolean(),\n                                                               anyBoolean(),\n                                                               anyBoolean() );\n    }\n\n    @Test\n    public void testFlushDriverUsingQuery() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = sqlDataSetDefAttributesEditor;\n        when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( true );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setDbTable( null );\n        verify( dataSetDef, times( 0 ) ).setDbSQL( null );\n    }\n\n    @Test\n    public void testFlushDriverUsingTable() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.editor = sqlDataSetDefAttributesEditor;\n        when( sqlDataSetDefAttributesEditor.isUsingQuery() ).thenReturn( false );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setDbSQL( null );\n        verify( dataSetDef, times( 0 ) ).setDbTable( null );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/BeanDataSetEditWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.BeanDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class BeanDataSetEditWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSet dataSet;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetEditor beanEditor;\n    @Mock\n    BeanDataSetDef dataSetDef;\n    @Mock\n    DataSetDefRefreshAttributesEditor refreshEditor;\n\n    private BeanDataSetEditWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new BeanDataSetEditWorkflow( clientServices, validatorProvider, beanManager,\n                                                 saveRequestEvent, testDataSetEvent, cancelRequestEvent, view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.BEAN );\n        when( beanEditor.refreshEditor() ).thenReturn( refreshEditor );\n        when( refreshEditor.isRefreshEnabled() ).thenReturn( true );\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( BeanDataSetDefDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.bean.BeanDataSetEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidate() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.validate( true, true, true );\n        verify( beanDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true );\n        verify( beanDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, true );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/CSVDataSetEditWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.CSVDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.CSVDataSetDefEditor;\nimport org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class CSVDataSetEditWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSet dataSet;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    @Mock\n    SimpleBeanEditorDriver<CSVDataSetDef, CSVDataSetDefEditor> driver;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetEditor csvEditor;\n    @Mock\n    CSVDataSetDef dataSetDef;\n    @Mock\n    DataSetDefRefreshAttributesEditor refreshEditor;\n\n    private CSVDataSetEditWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n        presenter = new CSVDataSetEditWorkflow( clientServices, validatorProvider, beanManager,\n                                                saveRequestEvent, testDataSetEvent, cancelRequestEvent, view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.CSV );\n        when( csvEditor.refreshEditor() ).thenReturn( refreshEditor );\n        when( refreshEditor.isRefreshEnabled() ).thenReturn( true );\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( CSVDataSetDefDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.csv.CSVDataSetEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidateUsingFilePath() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = csvEditor;\n        when( csvEditor.isUsingFilePath() ).thenReturn( true );\n        presenter.validate( true, true, true );\n        verify( csvDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, true );\n        verify( csvDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, true );\n    }\n\n    @Test\n    public void testValidateUsingFileUrl() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = csvEditor;\n\n        when( csvEditor.isUsingFilePath() ).thenReturn( false );\n        presenter.validate( true, true, true );\n        verify( csvDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, false );\n        verify( csvDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, false );\n    }\n\n    @Test\n    public void testFlushDriverUsingFileUrl() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = csvEditor;\n        when( csvEditor.isUsingFilePath() ).thenReturn( false );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setFilePath( null );\n        verify( dataSetDef, times( 0 ) ).setFileURL( null );\n    }\n\n    @Test\n    public void testFlushUsingFilePath() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = csvEditor;\n        when( csvEditor.isUsingFilePath() ).thenReturn( true );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setFileURL( null );\n        verify( dataSetDef, times( 0 ) ).setFilePath( null );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/DataSetEditWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport java.util.List;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.DataSetEditor;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetReadyCallback;\nimport org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.dataset.def.DataColumnDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class DataSetEditWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    public static final String UUID = \"uuid1\";\n    public static final String NAME = \"name1\";\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSetDef dataSetDef;\n    @Mock\n    DataSet dataSet;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    @Mock\n    DataSetDefRefreshAttributesEditor refreshEditor;\n    @Mock\n    SyncBeanDef<SimpleBeanEditorDriver> simpleBeanEditorDriverSyncBeanDef;\n    @Mock\n    SyncBeanDef<DataSetEditor> dataSetEditorSyncBeanDef;\n    @Mock\n    SimpleBeanEditorDriver driver;\n    @Mock\n    DataSetEditor editor;\n\n    DataSetEditWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n        when( dataSetDef.getUUID() ).thenReturn( UUID );\n        when( dataSetDef.getName() ).thenReturn( NAME );\n        when( dataSet.getUUID() ).thenReturn( UUID );\n        when( dataSet.getRowCount() ).thenReturn( 0 );\n        when( dataSetDef.clone() ).thenReturn( dataSetDef );\n        when( editor.refreshEditor() ).thenReturn( refreshEditor );\n\n        // Bean instantiation mocks.\n        when( beanManager.lookupBean( SimpleBeanEditorDriver.class ) ).thenReturn( simpleBeanEditorDriverSyncBeanDef );\n        when( simpleBeanEditorDriverSyncBeanDef.newInstance() ).thenAnswer( new Answer<SimpleBeanEditorDriver>() {\n            @Override\n            public SimpleBeanEditorDriver answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return driver;\n            }\n        } );\n        when( beanManager.lookupBean( DataSetEditor.class ) ).thenReturn( dataSetEditorSyncBeanDef );\n        when( dataSetEditorSyncBeanDef.newInstance() ).thenAnswer( new Answer<DataSetEditor>() {\n            @Override\n            public DataSetEditor answer( InvocationOnMock invocationOnMock ) throws Throwable {\n                return editor;\n            }\n        } );\n\n\n        doAnswer( new Answer<Void>() {\n            @Override\n            public Void answer( final InvocationOnMock invocationOnMock ) throws Throwable {\n                DataSetReadyCallback callback = (DataSetReadyCallback) invocationOnMock.getArguments()[2];\n                callback.callback( dataSet );\n                return null;\n            }\n        } ).when( clientServices ).lookupDataSet( any( dataSetDef.getClass() ),\n                                                  any( DataSetLookup.class ),\n                                                  any( DataSetReadyCallback.class ) );\n\n        presenter = new DataSetEditWorkflow( clientServices, validatorProvider, beanManager, saveRequestEvent,\n                                             testDataSetEvent, cancelRequestEvent, view ) {\n\n            @Override\n            protected Class<? extends SimpleBeanEditorDriver> getDriverClass() {\n                return SimpleBeanEditorDriver.class;\n            }\n\n            @Override\n            protected Class getEditorClass() {\n                return DataSetEditor.class;\n            }\n\n            @Override\n            protected Iterable<ConstraintViolation<?>> validate( boolean isCacheEnabled,\n                                                                 boolean isPushEnabled,\n                                                                 boolean isRefreshEnabled ) {\n                return null;\n            }\n        };\n    }\n\n    @Test\n    public void testEdit() {\n        List<DataColumnDef> columnDefs = mock( List.class );\n        presenter.edit( dataSetDef, columnDefs );\n        assertEquals( editor, presenter.getEditor() );\n        verify( driver, times( 1 ) ).initialize( editor );\n        verify( editor, times( 1 ) ).setAcceptableValues( columnDefs );\n        verify( driver, times( 1 ) ).edit( dataSetDef );\n        verify( view, times( 2 ) ).clearView();\n        verify( view, times( 1 ) ).add( any( IsWidget.class ) );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n    @Test\n    public void testShowConfigurationTab() {\n        presenter.editor = editor;\n        presenter.showConfigurationTab();\n        verify( editor, times( 1 ) ).showConfigurationTab();\n        verify( editor, times( 0 ) ).showPreviewTab();\n        verify( editor, times( 0 ) ).showAdvancedTab();\n        verify( view, times( 0 ) ).clearView();\n        verify( view, times( 0 ) ).add( any( IsWidget.class ) );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n    @Test\n    public void testShowPreviewTab() {\n        presenter.editor = editor;\n        presenter.showPreviewTab();\n        verify( editor, times( 1 ) ).showPreviewTab();\n        verify( editor, times( 0 ) ).showConfigurationTab();\n        verify( editor, times( 0 ) ).showAdvancedTab();\n        verify( view, times( 0 ) ).clearView();\n        verify( view, times( 0 ) ).add( any( IsWidget.class ) );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n    @Test\n    public void testShowAdvancedTab() {\n        presenter.editor = editor;\n        presenter.showAdvancedTab();\n        verify( editor, times( 1 ) ).showAdvancedTab();\n        verify( editor, times( 0 ) ).showPreviewTab();\n        verify( editor, times( 0 ) ).showConfigurationTab();\n        verify( view, times( 0 ) ).clearView();\n        verify( view, times( 0 ) ).add( any( IsWidget.class ) );\n        verify( view, times( 0 ) ).init( presenter );\n        verify( view, times( 0 ) ).addButton( anyString(), anyString(), anyBoolean(), any( Command.class ) );\n        verify( view, times( 0 ) ).clearButtons();\n    }\n\n    @Test\n    public void testFlushDriverRefreshEnabled() throws Exception {\n        presenter.editor = editor;\n        when( refreshEditor.isRefreshEnabled() ).thenReturn( true );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 0 ) ).setRefreshTime( null );\n    }\n\n    @Test\n    public void testFlushDriverRefreshDisabled() throws Exception {\n        presenter.editor = editor;\n        presenter._setDataSetDef( dataSetDef );\n        when( refreshEditor.isRefreshEnabled() ).thenReturn( false );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setRefreshTime( null );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/editor/workflow/edit/SQLDataSetEditWorkflowTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.editor.workflow.edit;\n\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.editor.driver.SQLDataSetDefDriver;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.AbstractDataSetWorkflowTest;\nimport org.dashbuilder.client.widgets.dataset.editor.workflow.DataSetEditorWorkflow;\nimport org.dashbuilder.client.widgets.dataset.event.CancelRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.SaveRequestEvent;\nimport org.dashbuilder.client.widgets.dataset.event.TestDataSetRequestEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.editor.DataSetDefRefreshAttributesEditor;\nimport org.dashbuilder.dataset.client.editor.SQLDataSetDefEditor;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith( GwtMockitoTestRunner.class )\npublic class SQLDataSetEditWorkflowTest extends AbstractDataSetWorkflowTest {\n\n    @Mock\n    SyncBeanManager beanManager;\n    @Mock\n    EventSourceMock<SaveRequestEvent> saveRequestEvent;\n    @Mock\n    EventSourceMock<TestDataSetRequestEvent> testDataSetEvent;\n    @Mock\n    EventSourceMock<CancelRequestEvent> cancelRequestEvent;\n    @Mock\n    DataSetClientServices clientServices;\n    @Mock\n    DataSet dataSet;\n    @Mock\n    DataSetEditorWorkflow.View view;\n    @Mock\n    SimpleBeanEditorDriver<SQLDataSetDef, SQLDataSetDefEditor> driver;\n    @Mock\n    org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetEditor sqlEditor;\n    @Mock\n    SQLDataSetDef dataSetDef;\n    @Mock\n    DataSetDefRefreshAttributesEditor refreshEditor;\n\n    private SQLDataSetEditWorkflow presenter;\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n\n        presenter = new SQLDataSetEditWorkflow( clientServices, validatorProvider, beanManager,\n                                                saveRequestEvent, testDataSetEvent, cancelRequestEvent, view );\n        when( dataSetDef.getProvider() ).thenReturn( DataSetProviderType.SQL );\n        when( sqlEditor.refreshEditor() ).thenReturn( refreshEditor );\n        when( refreshEditor.isRefreshEnabled() ).thenReturn( true );\n    }\n\n    @Test\n    public void testGetDriverClass() {\n        assertEquals( SQLDataSetDefDriver.class, presenter.getDriverClass() );\n    }\n\n    @Test\n    public void testGetEditorClass() {\n        assertEquals( org.dashbuilder.client.widgets.dataset.editor.sql.SQLDataSetEditor.class,\n                      presenter.getEditorClass() );\n    }\n\n    @Test\n    public void testValidateUsingQuery() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = sqlEditor;\n        when( sqlEditor.isUsingQuery() ).thenReturn( true );\n        presenter.validate( true, true, true );\n        verify( sqlDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, true );\n        verify( sqlDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, true );\n    }\n\n    @Test\n    public void testValidateUsingTable() {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = sqlEditor;\n        when( sqlEditor.isUsingQuery() ).thenReturn( false );\n        presenter.validate( true, true, true );\n        verify( sqlDataSetDefValidator, times( 1 ) ).validate( dataSetDef, true, true, true, false );\n        verify( sqlDataSetDefValidator, times( 0 ) ).validateCustomAttributes( dataSetDef, false );\n    }\n\n    @Test\n    public void testFlushDriverUsingQuery() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = sqlEditor;\n        when( sqlEditor.isUsingQuery() ).thenReturn( true );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setDbTable( null );\n        verify( dataSetDef, times( 0 ) ).setDbSQL( null );\n    }\n\n    @Test\n    public void testFlushDriverUsingTable() throws Exception {\n        presenter._setDataSetDef( dataSetDef );\n        presenter.driver = driver;\n        presenter.editor = sqlEditor;\n        when( sqlEditor.isUsingQuery() ).thenReturn( false );\n        presenter.afterFlush();\n        verify( dataSetDef, times( 1 ) ).setDbSQL( null );\n        verify( dataSetDef, times( 0 ) ).setDbTable( null );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetExplorerTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\nimport org.dashbuilder.client.widgets.common.CustomDataSetProviderType;\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetDefModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRegisteredEvent;\nimport org.dashbuilder.dataset.events.DataSetDefRemovedEvent;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.util.TypeLiteral;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimport java.util.List;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetExplorerTest {\n\n    @Mock DataSetExplorer.View view;\n    @Mock DataSetPanel dataSetPanel;\n    @Mock DataSetDef dataSetDef;\n    @Mock DataSetDef dataSetDefCustom;\n    @Mock DataSetClientServices dataSetClientServices;\n    Instance<DataSetPanel> panelInstances;\n    \n    private DataSetExplorer presenter;\n    final List<DataSetDef> dataSetDefList = new ArrayList<DataSetDef>();\n    \n    @Mock ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n    @Mock DataSetEditorPlugin pluginEditor;\n\n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.isPublic()).thenReturn(true);\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);\n        \n        when(dataSetDefCustom.getUUID()).thenReturn(\"uuid2\");\n        when(dataSetDefCustom.getName()).thenReturn(\"name2\");\n        when(dataSetDefCustom.isPublic()).thenReturn(true);\n        when(dataSetDefCustom.getProvider()).thenReturn(() -> \"CUSTOM\");\n\n        dataSetDefList.add(dataSetDef);\n        dataSetDefList.add(dataSetDefCustom);\n\n        final Widget widget = mock(Widget.class);\n        when(view.asWidget()).thenReturn(widget);\n        panelInstances = new MockInstance();\n        \n        // Client services method mocks.\n        when(dataSetPanel.getDataSetDef()).thenReturn(dataSetDef);\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                RemoteCallback<List<DataSetDef>> callback = (RemoteCallback<List<DataSetDef>>) invocationOnMock.getArguments()[0];\n                callback.callback(dataSetDefList);\n                return null;\n            }\n        }).when(dataSetClientServices).getPublicDataSetDefs(any(RemoteCallback.class));\n        \n        when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(true);\n        \n        // The presenter instance to test.\n        presenter = new DataSetExplorer(panelInstances, dataSetClientServices, view, dataSetEditorPlugin);\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n    }\n\n    @Test\n    public void testAsWidget() throws Exception {\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show();\n        assertEquals(1, presenter.panels.size());\n        assertEquals(dataSetPanel, presenter.panels.get(0));\n        verify(view, times(1)).clear();\n        verify(view, times(1)).addPanel(any());\n        verify(dataSetPanel, times(1)).show(dataSetDef, \"dataSetsExplorerPanelGroup\");\n    }\n\n    @Test\n    public void testShowTwice() throws Exception {\n        // Add same data set def again, but only one panel must be visible.\n        dataSetDefList.add(dataSetDef);\n        presenter.show();\n        assertEquals(1, presenter.panels.size());\n        assertEquals(dataSetPanel, presenter.panels.get(0));\n        verify(view, times(1)).clear();\n        verify(view, times(1)).addPanel(any());\n        verify(dataSetPanel, times(1)).show(dataSetDef, \"dataSetsExplorerPanelGroup\");\n    }\n\n    @Test\n    public void testOnDataSetDefRegisteredEvent() {\n        final DataSetDefRegisteredEvent event = mock(DataSetDefRegisteredEvent.class);\n        when(event.getDataSetDef()).thenReturn(dataSetDef);\n        presenter.onDataSetDefRegisteredEvent(event);\n        assertEquals(1, presenter.panels.size());\n        assertEquals(dataSetPanel, presenter.panels.get(0));\n        verify(view).clear();\n        verify(view).addPanel(any());\n        verify(dataSetPanel).show(dataSetDef, \"dataSetsExplorerPanelGroup\");\n    }\n\n    @Test\n    public void testOnDataSetDefModifiedEvent() {\n        final DataSetDefModifiedEvent event = mock(DataSetDefModifiedEvent.class);\n        when(event.getOldDataSetDef()).thenReturn(dataSetDef);\n        when(event.getNewDataSetDef()).thenReturn(dataSetDef);\n        presenter.panels.add(dataSetPanel);\n        presenter.onDataSetDefModifiedEvent(event);\n        assertEquals(1, presenter.panels.size());\n        assertEquals(dataSetPanel, presenter.panels.get(0));\n        verify(view, times(0)).clear();\n        verify(view, times(0)).addPanel(any(DataSetPanel.View.class));\n        verify(dataSetPanel, times(1)).show(dataSetDef, \"dataSetsExplorerPanelGroup\");\n        verify(dataSetPanel, times(1)).close();\n    }\n\n    @Test\n    public void testOnDataSetDefRemovedEvent() {\n        final DataSetDef removedDataSetDef = mock(DataSetDef.class);\n        when(removedDataSetDef.getUUID()).thenReturn(\"removed\");\n        when(removedDataSetDef.getName()).thenReturn(\"removedDef\");\n        when(removedDataSetDef.isPublic()).thenReturn(true);\n        when(removedDataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        final DataSetDefRemovedEvent event = mock(DataSetDefRemovedEvent.class);\n        when(event.getDataSetDef()).thenReturn(removedDataSetDef);\n        presenter.onDataSetDefRemovedEvent(event);\n        assertEquals(1, presenter.panels.size());\n        assertEquals(dataSetPanel, presenter.panels.get(0));\n        verify(view, times(1)).clear();\n        verify(view, times(1)).addPanel(any());\n        verify(dataSetPanel, times(1)).show(dataSetDef, \"dataSetsExplorerPanelGroup\");\n    }\n    \n    @Test\n    public void testInitWithEditorPlugin() throws Exception {\n        when(pluginEditor.getProviderType()).thenReturn(new CustomDataSetProviderType());\n        when(pluginEditor.getTypeSelectorTitle()).thenReturn(\"Custom\");\n        when(pluginEditor.getTypeSelectorImageUri()).thenReturn(Mockito.mock(SafeUri.class));\n        \n        when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(false);\n        when(dataSetEditorPlugin.iterator()).thenReturn(Arrays.asList(pluginEditor).iterator(), Arrays.asList(pluginEditor).iterator());\n        \n        when(dataSetDef.getProvider()).thenReturn(new CustomDataSetProviderType());\n        \n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(dataSetEditorPlugin, times(1)).isUnsatisfied();\n        verify(dataSetEditorPlugin, times(1)).iterator();\n        assertEquals(5, presenter.SUPPORTED_TYPES.size());\n    }\n\n    // Mockito complains when mocking Instance<U>, so let's create an empty implementation for it. It returns a single mocked DataSetPanel instance.\n    private class MockInstance implements Instance<DataSetPanel> {\n\n        @Override\n        public Instance<DataSetPanel> select(Annotation... annotations) {\n            return null;\n        }\n\n        @Override\n        public <U extends DataSetPanel> Instance<U> select(Class<U> aClass, Annotation... annotations) {\n            return (Instance<U>) dataSetPanel;\n        }\n\n        @Override\n        public boolean isUnsatisfied() {\n            return false;\n        }\n\n        @Override\n        public boolean isAmbiguous() {\n            return false;\n        }\n\n        @Override\n        public void destroy(DataSetPanel dataSetPanel) {\n\n        }\n\n        @Override\n        public Iterator<DataSetPanel> iterator() {\n            return null;\n        }\n\n        @Override\n        public DataSetPanel get() {\n            return dataSetPanel;\n        }\n\n        @Override\n        public <U extends DataSetPanel> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {\n            return (Instance<U>) dataSetPanel;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetPanelTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeUri;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\nimport org.dashbuilder.client.widgets.common.CustomDataSetProviderType;\nimport org.dashbuilder.client.widgets.common.DataSetEditorPlugin;\nimport org.dashbuilder.client.widgets.dataset.event.EditDataSetEvent;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\nimport java.util.Arrays;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetPanelTest {\n\n    @Mock DataSetSummary dataSetSummary;\n    @Mock EventSourceMock<EditDataSetEvent> editDataSetEvent;\n    @Mock DataSetPanel.View view;\n    @Mock DataSetDef dataSetDef;\n    @Mock ManagedInstance<DataSetEditorPlugin> dataSetEditorPlugin;\n    @Mock DataSetEditorPlugin pluginEditor;\n    \n    private DataSetPanel presenter;\n\n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.BEAN);               \n        \n        // The presenter instance to test.\n        final Widget widget = mock(Widget.class);\n        when(view.asWidget()).thenReturn(widget);\n        presenter = spy(new DataSetPanel(dataSetSummary, editDataSetEvent, view, dataSetEditorPlugin));\n        \n    }\n    \n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(1)).configure(any());\n        verify(view, times(0)).showHeader(anyString(), anyString(), any(SafeUri.class), anyString(), anyString());\n        verify(view, times(0)).showSummary();\n        verify(view, times(0)).hideSummary();\n        verify(view, times(0)).enableActionButton(anyString(), any(ClickHandler.class));\n        verify(view, times(0)).disableActionButton();\n    }\n\n    @Test\n    public void testAsWidget() throws Exception {\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n\n    @Test\n    public void testClose() throws Exception {\n        presenter.close();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).configure(any(DataSetSummary.View.class));\n        verify(view, times(0)).showHeader(anyString(), anyString(), any(SafeUri.class), anyString(), anyString());\n        verify(view, times(0)).showSummary();\n        verify(view, times(1)).hideSummary();\n        verify(view, times(0)).enableActionButton(anyString(), any(ClickHandler.class));\n        verify(view, times(0)).disableActionButton();\n    }\n\n    @Test\n    public void testDisable() throws Exception {\n        presenter.disable();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).configure(any(DataSetSummary.View.class));\n        verify(view, times(0)).showHeader(anyString(), anyString(), any(SafeUri.class), anyString(), anyString());\n        verify(view, times(0)).showSummary();\n        verify(view, times(0)).hideSummary();\n        verify(view, times(0)).enableActionButton(anyString(), any(ClickHandler.class));\n        verify(view, times(1)).disableActionButton();\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        final String iconTitle = \"iconTitle\";\n        doReturn(iconTitle).when(presenter).getTypeIconTitle(dataSetDef);\n        final SafeUri iconUri = mock(SafeUri.class);\n        doReturn(iconUri).when(presenter).getTypeIconUri(dataSetDef);\n        final String parentPanelId = \"parentPanel\";\n        presenter.show(dataSetDef, parentPanelId);\n        assertEquals(dataSetDef, presenter.getDataSetDef());\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).configure(any(DataSetSummary.View.class));\n        verify(view, times(1)).showHeader(\"uuid1\", parentPanelId, iconUri, iconTitle, \"name1\");\n        verify(view, times(0)).showSummary();\n        verify(view, times(0)).hideSummary();\n        verify(view, times(0)).enableActionButton(anyString(), any(ClickHandler.class));\n        verify(view, times(0)).disableActionButton();\n    }\n\n    @Test\n    public void testOpen() throws Exception {\n        presenter.def = dataSetDef;\n        presenter.open();\n        verify(dataSetSummary, times(1)).show(dataSetDef);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).configure(any(DataSetSummary.View.class));\n        verify(view, times(0)).showHeader(anyString(), anyString(), any(SafeUri.class), anyString(), anyString());\n        verify(view, times(1)).showSummary();\n        verify(view, times(0)).hideSummary();\n        verify(view, times(1)).enableActionButton(anyString(), any(ClickHandler.class));\n        verify(view, times(0)).disableActionButton();\n    }\n    \n    @Test\n    public void testEditorPlugin() throws Exception {\n\n        when(pluginEditor.getProviderType()).thenReturn(new CustomDataSetProviderType());\n        when(pluginEditor.getTypeSelectorTitle()).thenReturn(\"Custom\");\n        when(pluginEditor.getTypeSelectorImageUri()).thenReturn(Mockito.mock(SafeUri.class));\n        \n        when(dataSetEditorPlugin.isUnsatisfied()).thenReturn(false);\n        when(dataSetEditorPlugin.iterator()).thenReturn(Arrays.asList(pluginEditor).iterator(), Arrays.asList(pluginEditor).iterator());\n        \n        when(dataSetDef.getProvider()).thenReturn(new CustomDataSetProviderType());\n        presenter.def = dataSetDef;\n        final String parentPanelId = \"parentPanel\";\n        presenter.show(dataSetDef, parentPanelId);\n        verify(dataSetEditorPlugin, times(2)).isUnsatisfied();\n        verify(dataSetEditorPlugin, times(2)).iterator();\n        \n        verify(pluginEditor, times(1)).getTypeSelectorImageUri();\n        verify(pluginEditor, times(1)).getTypeSelectorTitle();\n        \n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/dashbuilder-widgets/src/test/java/org/dashbuilder/client/widgets/dataset/explorer/DataSetSummaryTest.java",
    "content": "package org.dashbuilder.client.widgets.dataset.explorer;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.widgets.dataset.event.ErrorEvent;\nimport org.dashbuilder.common.client.error.ClientRuntimeError;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.client.ClientDataSetManager;\nimport org.dashbuilder.dataset.client.DataSetClientServices;\nimport org.dashbuilder.dataset.client.DataSetMetadataCallback;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DataSetSummaryTest {\n    \n    @Mock DataSetClientServices dataSetClientServices;\n    @Mock ClientDataSetManager clientDataSetManager;\n    @Mock EventSourceMock<ErrorEvent> errorEvent;\n    @Mock DataSetDef dataSetDef;\n    @Mock DataSetSummary.View view;\n    \n    private DataSetSummary presenter;\n    final DataSetMetadata dataSetMetadata = mock(DataSetMetadata.class);\n    \n    @Before\n    public void setup() throws Exception {\n        when(dataSetDef.getUUID()).thenReturn(\"uuid1\");\n        when(dataSetDef.getName()).thenReturn(\"name1\");\n        when(dataSetDef.getProvider()).thenReturn(DataSetProviderType.SQL);\n        when(dataSetDef.isCacheEnabled()).thenReturn(true);\n        when(dataSetDef.isPushEnabled()).thenReturn(true);\n        when(dataSetDef.isRefreshAlways()).thenReturn(true);\n        when(dataSetDef.getRefreshTime()).thenReturn(\"1second\");\n        \n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                DataSetMetadataCallback callback = (DataSetMetadataCallback) invocationOnMock.getArguments()[1];\n                callback.callback(dataSetMetadata);\n                return null;\n            }\n        }).when(dataSetClientServices).fetchMetadata(anyString(), any(DataSetMetadataCallback.class));\n        \n        // The presenter instance to test.\n        final Widget widget = mock(Widget.class);\n        when(view.asWidget()).thenReturn(widget);\n        presenter = new DataSetSummary(dataSetClientServices, errorEvent, view);\n    }\n\n    @Test\n    public void testInit() throws Exception {\n        presenter.init();\n        verify(view, times(1)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(0)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n    \n    @Test\n    public void testAsWidget() throws Exception {\n        assertEquals(view.asWidget(), presenter.asWidget());\n    }\n    \n    @Test\n    public void testShow() throws Exception {\n        final int estimatedSize = 100;\n        final int rowCount = 10;\n        when(dataSetMetadata.getEstimatedSize()).thenReturn(estimatedSize);\n        when(dataSetMetadata.getNumberOfRows()).thenReturn(rowCount);\n        presenter.show(dataSetDef);\n        verify(view, times(0)).init(presenter);\n        verify(view, times(1)).showStatusPanel(true, true, true);\n        verify(view, times(1)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(1)).showSizePanel(anyString(), anyString());\n    }\n\n    // TODO: @Test - Mock NumberFormat\n    public void testHumanReadableByteCount() throws Exception {\n        long estimatedSize = (long) 2024.2;\n        String s = presenter.humanReadableByteCount(estimatedSize);\n        // assertEquals(\"\", s);\n    }\n\n    // TODO: @Test - Mock NumberFormat\n    public void testHumanReadableRowCount() throws Exception {\n        long rows = (long) 1000;\n        String s = presenter.humanReadableRowCount(rows);\n        // assertEquals(\"\", s);\n    }\n\n    @Test\n    public void testShowLoadingIcon() {\n        presenter.showLoadingIcon();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(1)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n\n    @Test\n    public void testShowErrorIcon() {\n        presenter.showErrorIcon();\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(1)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n\n    @Test\n    public void testShowClientRuntimeError() {\n        final ClientRuntimeError error = mock(ClientRuntimeError.class);\n        presenter.showError(\"uuid1\", error);\n        verify(errorEvent, times(1)).fire(any(ErrorEvent.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(0)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n\n    @Test\n    public void testShowThrowable() {\n        final Throwable error = mock(Throwable.class);\n        presenter.showError(\"uuid1\", error);\n        verify(errorEvent, times(1)).fire(any(ErrorEvent.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(0)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n\n    @Test\n    public void testShowErrorMessage() {\n        presenter.showError(\"uuid1\", \"errorMessage\");\n        verify(errorEvent, times(1)).fire(any(ErrorEvent.class));\n        verify(view, times(0)).init(presenter);\n        verify(view, times(0)).showStatusPanel(anyBoolean(), anyBoolean(), anyBoolean());\n        verify(view, times(0)).showSizePanelIcon(any(IconType.class), anyString(), anyString(), anyBoolean());\n        verify(view, times(0)).showSizePanel(anyString(), anyString());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-client</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Client modules</name>\n\n  <modules>\n    <module>dashbuilder-common-client</module>\n    <module>dashbuilder-dataset-client</module>\n    <module>dashbuilder-displayer-client</module>\n    <module>dashbuilder-widgets</module>\n    <module>dashbuilder-dataset-editor</module>\n    <module>dashbuilder-displayer-screen</module>\n    <module>dashbuilder-displayer-editor</module>\n    <module>dashbuilder-renderers</module>\n    <module>dashbuilder-navigation-client</module>\n    <module>dashbuilder-cms-client</module>\n    <module>dashbuilder-kie-server-client</module>\n  </modules>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/README.md",
    "content": "UF Dashbuilder - Distributions Builder\n=======================================\n\nThis module generates the product distribution for different applications servers.             \n\nUsage\n-----\nThis module is not build by default. You can build it in two ways:\n\n*Run the maven build on this module path `dashbuilder-distros`:\n \n    $ cd dashbuilder/dashbuilder-distros/\n    $ mvn clean install -DskipTests\n\n*Run the maven build on the root path for the project and use the `full` Maven profile:            \n\n    $ cd dashbuilder/\n    $ mvn clean install -DskipTests -Dfull\n    \nDistributions\n-------------\n \nCurrently, the following artifact is generated:                   \n\n* **dashbuilder-wildfly10.war:**  Product distribution for the JBoss WildFly 10.x application server.\n\n  Detailed installation instructions [here](./src/main/wildfly10/README.md).\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-distros</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Distribution WARs</name>\n  <description>\n    This module builds the download wars for different application servers.\n  </description>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-assembly-plugin</artifactId>\n        <executions>\n          <execution>\n            <phase>package</phase>\n            <goals>\n              <goal>single</goal>\n            </goals>\n          </execution>\n        </executions>\n        <configuration>\n          <finalName>dashbuilder-${project.version}</finalName>\n          <descriptors>\n            <descriptor>src/main/assembly/assembly-wildfly-10.xml</descriptor>\n          </descriptors>\n          <archive>\n            <addMavenDescriptor>false</addMavenDescriptor>\n          </archive>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-webapp</artifactId>\n      <type>war</type>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.sun.xml.bind</groupId>\n      <artifactId>jaxb-impl</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.sun.xml.bind</groupId>\n      <artifactId>jaxb-xjc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet.jsp.jstl</groupId>\n      <artifactId>jakarta.servlet.jsp.jstl-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.logging</groupId>\n      <artifactId>jboss-logging</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.persistence</groupId>\n      <artifactId>jakarta.persistence-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.activation</groupId>\n      <artifactId>jakarta.activation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.scannotation</groupId>\n      <artifactId>scannotation</artifactId>\n      <exclusions>\n        <!-- Collides with org.javassist:javassist -->\n        <exclusion>\n          <groupId>javassist</groupId>\n          <artifactId>javassist</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.enterprise</groupId>\n          <artifactId>cdi-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld.servlet</groupId>\n      <artifactId>weld-servlet-core</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/src/main/assembly/assembly-wildfly-10.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<assembly xmlns=\"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2\"\n          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n          xsi:schemaLocation=\"http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd\">\n\n  <id>wildfly10</id>\n  <formats>\n    <format>war</format>\n    <format>dir</format>\n  </formats>\n\n  <includeBaseDirectory>false</includeBaseDirectory>\n  <dependencySets>\n    <dependencySet>\n      <includes>\n        <include>org.dashbuilder:dashbuilder-webapp:war</include>\n      </includes>\n      <outputDirectory>.</outputDirectory>\n      <unpack>true</unpack>\n      <unpackOptions>\n        <excludes>\n          <!-- JBoss specific files from development environment war artifact. -->\n          <exclude>WEB-INF/classes/application-roles.properties</exclude>\n          <exclude>WEB-INF/classes/application-users.properties</exclude>\n          <exclude>WEB-INF/jboss-web.xml</exclude>\n          <exclude>WEB-INF/beans.xml</exclude>          \n          \n          <!-- GWT DevMode related. -->\n          <exclude>**/*devmode.js</exclude>\n        </excludes>\n      </unpackOptions>\n    </dependencySet>\n  </dependencySets>\n\n  <fileSets>\n    <fileSet>\n      <directory>${project.basedir}/src/main/wildfly10/</directory>\n      <outputDirectory>.</outputDirectory>\n    </fileSet>\n  </fileSets>\n  \n</assembly>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/src/main/wildfly10/README.md",
    "content": "Deployment into JBoss WidlFly 10.X\n==================================\n\nPlease follow the next steps in order to deploy the application.           \n\nDeploy\n------\n\nRun your JBoss WildFly instance using the `full` server profile as:\n\n    $JBOSS_HOME/bin/standalone.sh --server-config=standalone-full.xml\n\nOnce server is up and running, get the proper WAR file (e.g. `dashbuilder-<version>-wildfly10.war`) and execute the following command to deploy the application into your JBoss Wildfly instance:              \n\n    $ cd $JBOSS_HOME/bin\n    $ ./jboss-cli.sh --connect --command=\"deploy <path_to_war_file>\"\n    \n    NOTES:\n        - <path_to_war_file>: is the local path to the application war file.\n        - e.g. $ ./jboss-cli.sh --connect --command=\"deploy /home/myuser/myfiles/dashbuilder-0.5.0-SNAPSHOT-wildfly10.war\" )\n\n\nUser Authentication\n--------------------\n\nOnce started, open a browser and type the following URL:          \n        \n        http://localhost:8080/dashbuilder        # A login screen should be displayed.\n\nHowever, some extra configuration is needed before you can sign in:               \n\n* The application is based on the J2EE container managed authentication  mechanism.\nThis means that the login itself is delegated to the application server.\n\n* To create users and define the roles use the command line utility provided by JBoss WildFly at `$JBOSS_HOME/bin/add-user.sh`.\n\n* The application roles are defined at [web.xml](./WEB-INF/web.xml) file.\nRoles can be used to create access profiles and define custom authorization policies.\nThere exist a single application role named `admin`. In order to use the application, create a user with role `admin`.               \n\n* The application uses the JBoss' default security domain as you can see [here](./WEB-INF/jboss-web.xml).\nAlternatively, you can define your own security domain and use, for instance, an LDAP, a database, or whatever mechanism you want to use as your credential storage.            \nThere are plenty of examples in the JBoss WildFly documentation about.\n\nFeel free to change any settings regarding the application security and, once finished, to generate a distribution war that fits your needs.          \n\nFile System provider\n---------------------\nDashbuilder stores all the internal artifacts (such as the data set definition files, the uploaded files, etc) into a GIT repository. You can clone the repository and noddle around with it if you need to.                \n\nBy default, the GIT repository is created when the application starts for first time at `$WORKING_DIR/.niogit`, considering `$WORKING_DIR` as the current directory where the application server is started.            \n\nYou can specify a custom repository location by setting the following Java system property to your target file system directory:                   \n \n        -Dorg.uberfire.nio.git.dir=/home/youruser/some/path\n        \nIf necessary you can make GIT repositories available from outside localhost using the following Java system property:                 \n \n        -org.uberfire.nio.git.ssh.host=0.0.0.0\n        \nYou can set this Java system properties permanent by adding the following lines in your `standalone-full.xml` file as:                \n \n        <system-properties>\n          <!-- Custom repository location. -->\n          <property name=\"org.uberfire.nio.git.dir\" value=\"/home/youruser/some/path\"/>\n          <!-- Make GIT repositories available from outside localhost. -->\n          <property name=\"org.uberfire.nio.git.ssh.host\" value=\"0.0.0.0\"/>\n        </system-properties>\n        \n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/src/main/wildfly10/WEB-INF/beans.xml",
    "content": "<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"\n    bean-discovery-mode=\"all\">\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-distros/src/main/wildfly10/WEB-INF/jboss-web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n\n    Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n\n    Licensed under the Apache License, Version 2.0 (the \"License\");\n    you may not use this file except in compliance with the License.\n    You may obtain a copy of the License at\n\n          http://www.apache.org/licenses/LICENSE-2.0\n\n    Unless required by applicable law or agreed to in writing, software\n    distributed under the License is distributed on an \"AS IS\" BASIS,\n    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n    See the License for the specific language governing permissions and\n    limitations under the License.\n\n-->\n<jboss-web>\n    <!--\n        Use by default the WildFly security domain.\n\n        If you choose to use a custom security domain then you should define it into the\n        <wildfly-home>/standalone/configuration/standalone.xml file.\n     -->\n    <security-domain>other</security-domain>\n\n</jboss-web>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/dashbuilder-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-all</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder All Libraries</name>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-server-all</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/dashbuilder-client-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-client-all</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder All Client Libraries</name>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-widgets</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-widgets</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-screen</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-screen</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-editor</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-editor</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-default</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-default</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-client</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-cms-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-cms-client</artifactId>\n      <classifier>sources</classifier>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/dashbuilder-client-all/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/dashbuilder-client-all/src/main/resources/org/dashbuilder/DashbuilderClientAll.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.dashbuilder.CommonClient\"/>\n  <inherits name=\"org.dashbuilder.CommonWidgets\"/>\n  <inherits name=\"org.dashbuilder.ServicesAPI\"/>\n  <inherits name=\"org.dashbuilder.DatasetAPI\"/>\n  <inherits name=\"org.dashbuilder.DatasetShared\"/>\n  <inherits name=\"org.dashbuilder.DatasetClient\"/>\n  <inherits name=\"org.dashbuilder.DataSetEditor\"/>\n  <inherits name=\"org.dashbuilder.NavigationAPI\"/>\n  <inherits name=\"org.dashbuilder.DisplayerAPI\"/>\n  <inherits name=\"org.dashbuilder.DisplayerClient\"/>\n  <inherits name=\"org.dashbuilder.DisplayerScreen\"/>\n  <inherits name=\"org.dashbuilder.NavigationClient\"/>\n  <inherits name=\"org.dashbuilder.ContentManagerClient\"/>\n  <inherits name=\"org.dashbuilder.renderer.DefaultRenderer\"/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/dashbuilder-server-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-server-all</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder All Server Libraries</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-sql</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-csv</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-external-backend</artifactId>\n    </dependency>\n\n  </dependencies>\n  \n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-packaging/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-packaging</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Packaging</name>\n\n  <modules>\n    <module>dashbuilder-client-all</module>\n    <module>dashbuilder-server-all</module>\n    <module>dashbuilder-all</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/.gitignore",
    "content": "*.deploy\n/src/main/gwt-unitCache\n/src/main/webapp/WEB-INF/classes/\n/src/main/webapp/WEB-INF/lib\n/src/main/webapp/org.dashbuilder.DashbuilderRuntime/\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- ~ Copyright 2020 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n  the Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n  except in compliance with the License. ~ You may obtain a copy of the License \n  at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n  applicable law or agreed to in writing, software ~ distributed under the \n  License is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n  OF ANY KIND, either express or implied. ~ See the License for the specific \n  language governing permissions and ~ limitations under the License. -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-runtime</artifactId>\n  <packaging>war</packaging>\n\n  <name>Dashbuilder Runtime</name>\n  <description>Dashbuilder Runtime for running standalone dashboards</description>\n\n  <properties>\n    <!-- Add the absolute path for $JBOSS_HOME below to manage another instance -->\n    <errai.jboss.home>${project.build.directory}/wildfly-${version.org.wildfly}</errai.jboss.home>\n    <gwt.compiler.skip>false</gwt.compiler.skip>\n    <gwt.compiler.localWorkers>4</gwt.compiler.localWorkers>\n  </properties>\n\n  <!-- NOTE: GWT client deps are needed for GWT compilation purposes (scope=provided) -->\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-multipart-provider</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.resteasy</groupId>\n          <artifactId>resteasy-jaxrs</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.sun.mail</groupId>\n          <artifactId>javax.mail</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.jboss.resteasy</groupId>\n          <artifactId>resteasy-jaxb-provider</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.apache.james</groupId>\n          <artifactId>apache-mime4j</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.jboss.resteasy</groupId>\n          <artifactId>resteasy-client</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.xnio</groupId>\n      <artifactId>xnio-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.xml.bind</groupId>\n      <artifactId>jakarta.xml.bind-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.security.jacc</groupId>\n      <artifactId>jakarta.security.jacc-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise.concurrent</groupId>\n      <artifactId>jakarta.enterprise.concurrent-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <!-- Dashbuilder -->\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-csv</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-sql</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-prometheus</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-kafka</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-client-all</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.dashbuilder</groupId>\n          <artifactId>dashbuilder-cms-client</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-screen</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-editor</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-default</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-c3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- needed due navigation drag components -->\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <!-- navigation dependency... -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-security-management</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n    <!-- Kie Server Support -->\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-backend</artifactId>\n    </dependency>\n\n    <!-- External Components -->\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-external-backend</artifactId>\n    </dependency>\n\n    <!-- UberFire -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-bridge</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-table</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-simple-docks-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- UberFire Preferences. -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client-backend</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-ui-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- UberFire Security (Extension) -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- Log -->\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>log4j-over-slf4j</artifactId>\n    </dependency>\n\n    <!-- Errai -->\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>de.benediktmeurer.gwt-slf4j</groupId>\n      <artifactId>gwt-slf4j</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-jboss-as-support</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-javax-enterprise</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.owasp.encoder</groupId>\n      <artifactId>encoder</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-codegen-gwt</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Experimental - when backend is cleaned we must remove it -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <!-- Validation Needed by GWT Constraint Validation -->\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.hibernate</groupId>\n      <artifactId>hibernate-validator</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Container provided dependencies -->\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-jboss</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>xml-apis</groupId>\n      <artifactId>xml-apis</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.sun.xml.bind</groupId>\n      <artifactId>jaxb-impl</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-cdi</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-jaxrs</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.servlet</groupId>\n          <artifactId>javax.servlet-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire SSH -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.errai</groupId>\n          <artifactId>errai-security-server</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.inject</groupId>\n      <artifactId>guice</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-data-binding</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n\n    <dependency>\n      <groupId>org.mockito</groupId>\n      <artifactId>mockito-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.mockito</groupId>\n          <artifactId>mockito-core</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.mockito</groupId>\n          <artifactId>mockito-core</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n\n  </dependencies>\n\n  <build>\n    <finalName>${project.artifactId}</finalName>\n    <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>\n\n    <plugins>\n\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>gwt-maven-plugin</artifactId>\n        <configuration>\n          <deploy>${project.build.directory}/gwt-symbols-deploy</deploy>\n          <localWorkers>${gwt.compiler.localWorkers}</localWorkers>\n          <module>org.dashbuilder.FastCompiledDashbuilderRuntime</module>\n          <draftCompile>true</draftCompile>\n          <logLevel>INFO</logLevel>\n          <strict>true</strict>\n          <compileSourcesArtifacts>\n\n            <!-- Validation -->\n            <compileSourcesArtifact>org.hibernate:hibernate-validator</compileSourcesArtifact>\n\n            <!-- Dashbuilder -->\n            <compileSourcesArtifact>org.kie.soup:kie-soup-json</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-widgets</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-validations</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-common-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-services-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-dataset-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-dataset-shared</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-screen</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-editor</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-default</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-c3</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-navigation-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-navigation-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-kie-server-api</compileSourcesArtifact>\n\n            <!-- Uberfire ext -->\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-layout-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-layout-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-service-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-table</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-simple-docks-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-ui-client</compileSourcesArtifact>\n\n            <compileSourcesArtifact>org.kie.soup:kie-soup-commons</compileSourcesArtifact>\n\n            <!-- UberFire -->\n            <compileSourcesArtifact>org.uberfire:uberfire-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-nio2-model</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-io</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-js</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:appformer-js-bridge</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-client-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-backend</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-views-patternfly</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-backend-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-api</compileSourcesArtifact>\n\n            <!-- Dependencies for Navigation -->\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-security-management</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-management-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-management-api</compileSourcesArtifact>\n\n            <!-- Uberfire Experimentals -->\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-client</compileSourcesArtifact>\n\n          </compileSourcesArtifacts>\n          <runTarget>dashbuilder.html</runTarget>\n          <extraJvmArgs>-Xmx4024m -XX:CompileThreshold=7000\n            -Derrai.jboss.home=${errai.jboss.home}\n            -Derrai.dynamic_validation.enabled=true\n            -Ddashbuilder.runtime.multi=true\n            -Ddashbuilder.components.enable=true\n            -Ddashbuilder.removeModelFile=true\n            -Ddashbuilder.kieserver.serverTemplate.sample-server.location=http://localhost:8080/kie-server/services/rest/server\n            -Ddashbuilder.kieserver.serverTemplate.sample-server.user=kieserver\n            -Ddashbuilder.kieserver.serverTemplate.sample-server.password=kieserver1!\n            -Ddashbuilder.kieserver.defaultServerTemplate=default\n            -Ddashbuilder.kieserver.serverTemplate.sample-server.replace_query=true\n            -Ddashbuilder.dev=true</extraJvmArgs>\n          <noServer>false</noServer>\n          <server>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</server>\n          <hostedWebapp>src/main/webapp</hostedWebapp>\n          <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>\n          <disableCastChecking>true</disableCastChecking>\n        </configuration>\n        <executions>\n          <execution>\n            <id>gwt-clean</id>\n            <phase>clean</phase>\n            <goals>\n              <goal>clean</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>gwt-compile</id>\n            <goals>\n              <goal>resources</goal>\n              <goal>compile</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-war-plugin</artifactId>\n        <configuration>\n          <packagingExcludes>**/javax/**/*.*,**/client/**/*.class,**/*.symbolMap</packagingExcludes>\n          <archive>\n            <addMavenDescriptor>false</addMavenDescriptor>\n          </archive>\n        </configuration>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>src/main/webapp/org.dashbuilder.DashbuilderRuntime/</include>\n                <include>src/main/webapp/WEB-INF/classes/</include>\n                <include>src/main/webapp/WEB-INF/deploy/</include>\n                <include>src/main/webapp/WEB-INF/lib/</include>\n                <include>**/gwt-unitCache/**</include>\n                <include>.errai/</include>\n                <include>.niogit/**</include>\n                <include>.index/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.jboss.errai</groupId>\n                  <artifactId>wildfly-dist</artifactId>\n                  <version>${version.org.jboss.errai.wildfly}</version>\n                  <type>zip</type>\n                  <overWrite>false</overWrite>\n                  <outputDirectory>${project.build.directory}</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <skip>${gwt.compiler.skip}</skip>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n\n  </build>\n\n  <profiles>\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <plugin><!-- Keep in sync with soa profile -->\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <!-- Build all GWT permutations and optimize them -->\n              <module>org.dashbuilder.DashbuilderRuntime</module>\n              <draftCompile>false</draftCompile>\n              <force>true</force>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n    <!-- profile to disable GWT compilation of showcase (useful in full downstream \n      builds) -->\n    <profile>\n      <id>no-showcase</id>\n      <build>\n        <plugins>\n          <plugin>\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <skip>true</skip>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/DataSetContentListener.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.backend.helper.PartitionHelper;\nimport org.dashbuilder.backend.services.dataset.RuntimeCSVFileStorage;\nimport org.dashbuilder.backend.services.dataset.provider.RuntimeDataSetProviderRegistry;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefRegistry;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.kieserver.RemoteDataSetDef;\nimport org.dashbuilder.shared.event.NewDataSetContentEvent;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.model.DataSetContent;\nimport org.dashbuilder.shared.model.DataSetContentType;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Listen for new dataset contents and register it accordingly.\n *\n */\n@ApplicationScoped\npublic class DataSetContentListener {\n\n    private final Logger logger = LoggerFactory.getLogger(DataSetContentListener.class);\n\n    @Inject\n    DataSetDefRegistry registry;\n\n    @Inject\n    RuntimeCSVFileStorage storage;\n\n    @Inject\n    RuntimeDataSetProviderRegistry runtimeDataSetProviderRegistry;\n\n    DataSetDefJSONMarshaller defMarshaller;\n\n    /**\n     * Keep tracks of contents by runtime model to remove it later\n     */\n    Map<String, List<String>> runtimeModelDatasetContents;\n\n    @PostConstruct\n    public void init() {\n        defMarshaller = runtimeDataSetProviderRegistry.getDataSetDefJSONMarshaller();\n        runtimeModelDatasetContents = new HashMap<>();\n    }\n\n    public void register(@Observes NewDataSetContentEvent newDataSetContentEvent) {\n        runtimeModelDatasetContents.put(newDataSetContentEvent.getRuntimeModelId(),\n                                        newDataSetContentEvent.getContent()\n                                                              .stream()\n                                                              .map(DataSetContent::getId)\n                                                              .collect(Collectors.toList()));\n        newDataSetContentEvent.getContent()\n                              .forEach(this::registerDataSetContent);\n    }\n\n    public void unregister(@Observes RemovedRuntimeModelEvent removedRuntimeModelEvent) {\n        List<String> removedIds = runtimeModelDatasetContents.remove(removedRuntimeModelEvent.getRuntimeModelId());\n        if (removedIds != null) {\n            removedIds.forEach(id -> {\n                storage.deleteCSVFile(id);\n                registry.removeDataSetDef(id);\n            });\n        }\n    }\n\n    public void registerDataSetContent(final DataSetContent content) {\n        try {\n            DataSetContentType contentType = content.getContentType();\n            switch (contentType) {\n                case CSV:\n                    storage.storeCSV(content.getId(), content.getContent());\n                    break;\n                case DEFINITION:\n                    registerDataSetDefinition(content);\n                    break;\n                default:\n                    logger.error(\"Unknown DataSet Content Type: {}\", contentType.name(), null);\n                    break;\n            }\n        } catch (Exception e) {\n            logger.error(\"Error registering dataset\", e);\n        }\n    }\n\n    private void registerDataSetDefinition(final DataSetContent content) throws Exception {\n        try {\n            DataSetDef dataSetDef = defMarshaller.fromJson(content.getContent());\n            dataSetDef.setUUID(content.getId());\n            if (dataSetDef instanceof RemoteDataSetDef) {\n                String queryName = PartitionHelper.removePartition(dataSetDef.getUUID());\n                ((RemoteDataSetDef) dataSetDef).setQueryName(queryName);\n            }\n            \n            registry.registerDataSetDef(dataSetDef);\n        } catch (Exception e) {\n            logger.warn(\"Ignoring Dataset {}: error parsing Json\", content.getId());\n            logger.debug(\"Error parsing dataset {}. Content: {}\",\n                         content.getId(),\n                         content.getContent(),\n                         e);\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/ExternalComponentsContentListener.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.io.File;\nimport java.nio.file.Paths;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.FileUtils;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\n\n/**\n * When a runtime model is removed then we should remove components content as well.\n *\n */\n@ApplicationScoped\npublic class ExternalComponentsContentListener {\n\n    @Inject\n    ComponentLoader loader;\n\n    @Inject\n    RuntimeOptions options;\n\n    public void onRuntimeModelRemoved(@Observes RemovedRuntimeModelEvent event) {\n        if (options.isComponentPartition()) {\n            String componentsDir = loader.getExternalComponentsDir();\n            String runtimeModelId = event.getRuntimeModelId();\n            if (componentsDir != null && runtimeModelId != null) {\n                File runtimeModelComponentsFile = Paths.get(componentsDir, runtimeModelId).toFile();\n                FileUtils.deleteQuietly(runtimeModelComponentsFile);\n            }\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/RuntimeModelListener.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\n\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.event.UpdatedRuntimeModelEvent;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Register model events\n *\n */\n@ApplicationScoped\npublic class RuntimeModelListener {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeModelListener.class);\n\n    public void logUpdatedModel(@Observes UpdatedRuntimeModelEvent modelUpdated) {\n        logger.info(\"Updated dashboard {}\", modelUpdated.getRuntimeModelId());\n    }\n\n    public void logRemovedModel(@Observes RemovedRuntimeModelEvent modelUpdated) {\n        logger.info(\"Removed dashboard {}\", modelUpdated.getRuntimeModelId());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/RuntimeModelLoader.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\n\nimport static org.dashbuilder.backend.RuntimeOptions.DASHBOARD_EXTENSION;\n\n/**\n * Responsible for runtime model files loading.\n *\n */\n@Startup\n@ApplicationScoped\npublic class RuntimeModelLoader {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeModelLoader.class);\n\n    @Inject\n    RuntimeModelRegistry runtimeModelRegistry;\n\n    @Inject\n    RuntimeOptions runtimeOptions;\n\n    @PostConstruct\n    private void runtimeModelSetup() {\n        setupBaseDir();\n        runtimeOptions.importFileLocation().ifPresent(importFile -> {\n            logger.info(\"Importing file {}\", importFile);\n            runtimeModelRegistry.registerFile(importFile);\n            runtimeModelRegistry.setMode(DashbuilderRuntimeMode.STATIC);\n        });\n\n        if (runtimeOptions.isMultipleImport() && !runtimeOptions.importFileLocation().isPresent()) {\n            runtimeModelRegistry.setMode(DashbuilderRuntimeMode.MULTIPLE_IMPORT);\n            loadAvailableModels();\n        }\n    }\n\n    /**\n     * Create, if do not exist, the base directory for runtime models\n     */\n    protected void setupBaseDir() {\n        Paths.get(runtimeOptions.getImportsBaseDir()).toFile().mkdirs();\n    }\n\n    protected void loadAvailableModels() {\n        logger.info(\"Registering existing models\");\n        try (Stream<Path> walk = Files.walk(Paths.get(runtimeOptions.getImportsBaseDir()), 1)) {\n            walk.filter(p -> p.toFile().isFile() && p.toString().toLowerCase().endsWith(DASHBOARD_EXTENSION))\n                .map(Object::toString)\n                .forEach(p -> {\n                    logger.info(\"Registering {}\", p);\n                    runtimeModelRegistry.registerFile(p);\n                    logger.info(\"Sucessfully Registered {}\", p);\n                });\n\n        } catch (Exception e) {\n            throw new RuntimeException(\"Error registering existing models.\", e);\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/RuntimeModelWatcherServiceManager.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend;\n\nimport java.io.IOException;\nimport java.nio.file.FileSystems;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardWatchEventKinds;\nimport java.nio.file.WatchEvent;\nimport java.nio.file.WatchEvent.Kind;\nimport java.nio.file.WatchKey;\nimport java.nio.file.WatchService;\nimport java.util.Optional;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.annotation.Resource;\nimport javax.enterprise.concurrent.ManagedExecutorService;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\n\n@Startup\n@ApplicationScoped\npublic class RuntimeModelWatcherServiceManager {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeModelWatcherServiceManager.class);\n\n    @Inject\n    RuntimeOptions runtimeOptions;\n\n    @Inject\n    RuntimeModelRegistry registry;\n\n    @Resource\n    private ManagedExecutorService executorService;\n\n    private WatchService watchService;\n\n    @PostConstruct\n    public void start() {\n        if (runtimeOptions.isWatchModels()) {\n            logger.info(\"Scheduling model watcher\");\n            executorService.execute(() -> {\n                try {\n                    createWatcherTask(runtimeOptions.getImportsBaseDir());\n                } catch (IOException e) {\n                    logger.error(\"Error setting models watcher: {}\", e.getMessage());\n                    logger.debug(\"Error setting models watcher.\", e);\n                    throw new RuntimeException(e);\n                } catch (InterruptedException e) {\n                    logger.warn(\"Thread Interrupted!\", e);\n                    Thread.currentThread().interrupt();\n                }\n            });\n\n        } else {\n            logger.info(\"Not watching for model changes.\");\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public void createWatcherTask(String baseDir) throws IOException, InterruptedException {\n\n        Path baseDirPath = Paths.get(baseDir);\n        logger.info(\"Watching models directory for changes\");\n        watchService = FileSystems.getDefault().newWatchService();\n        baseDirPath.register(watchService,\n                             StandardWatchEventKinds.ENTRY_CREATE,\n                             StandardWatchEventKinds.ENTRY_DELETE);\n        WatchKey key;\n        while ((key = watchService.take()) != null) {\n            for (WatchEvent<?> event : key.pollEvents()) {\n                final Kind<?> kind = event.kind();\n                if (kind == StandardWatchEventKinds.OVERFLOW) {\n                    continue;\n                }\n\n                WatchEvent<Path> ev = (WatchEvent<Path>) event;\n                Path modelPath = ev.context();\n\n                String modelId = modelPath.toFile().getName().replaceAll(RuntimeOptions.DASHBOARD_EXTENSION, \"\");\n\n                if (kind == StandardWatchEventKinds.ENTRY_DELETE) {\n                    unregister(modelId);\n                }\n\n                if (kind == StandardWatchEventKinds.ENTRY_MODIFY) {\n                    unregister(modelId);\n                    register(modelId);\n                }\n\n                if (kind == StandardWatchEventKinds.ENTRY_CREATE) {\n                    register(modelId);\n                }\n\n                key.reset();\n            }\n        }\n\n    }\n\n    private void unregister(String modelId) {\n\n        try {\n            registry.unregister(modelId);\n        } catch (Exception e) {\n            logger.error(\"Error unregistering model {}\", e.getMessage());\n            logger.debug(\"Error unregistering model\", e);\n        }\n    }\n\n    private void register(String modelId) {\n        Optional<String> modelPathOp = runtimeOptions.modelPath(modelId);\n        if (modelPathOp.isPresent()) {\n            try {\n                String modelPath = modelPathOp.get();\n                registry.registerFile(modelPath);\n            } catch (Exception e) {\n                logger.error(\"Error registering model {}\", e.getMessage());\n                logger.debug(\"Error registering model\", e);\n            }\n        } else {\n            logger.info(\"File for model {} not found.\", modelId);\n        }\n    }\n\n    @PreDestroy\n    public void stop() {\n        try {\n            if (watchService != null) {\n                watchService.close();\n            }\n        } catch (IOException e) {\n            logger.warn(\"Error stopping watch service: {}\", e.getMessage());\n            logger.debug(\"Error stopping watch service.\", e);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/RuntimeOptions.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Optional;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.data.Pair;\n\n/**\n * Holds Runtime System properties and information.\n *\n */\n@ApplicationScoped\npublic class RuntimeOptions {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeOptions.class);\n\n    public static final String DASHBOARD_EXTENSION = \".zip\";\n\n    private static final String DEFAULT_MODEL_DIR = \"/tmp/dashbuilder/models\";\n\n    private static final int DEFAULT_UPLOAD_SIZE_KB = 10 * 1024 * 1024;\n\n    /**\n     * Base Directory where dashboards ZIPs are stored\n     */\n    private static final String IMPORTS_BASE_DIR_PROP = \"dashbuilder.import.base.dir\";\n\n    /**\n     * Set a static dashboard to run with runtime. When this property is set no new imports are allowed.\n     */\n    private static final String IMPORT_FILE_LOCATION_PROP = \"dashbuilder.runtime.import\";\n\n    /**\n     * Limits the size of uploaded dashboards (in kb).\n     */\n    private static final String UPLOAD_SIZE_PROP = \"dashbuilder.runtime.upload.size\";\n\n    /**\n     * When true will allow download of external (remote) files into runtime.\n     */\n    private static final String ALLOW_EXTERNAL_FILE_REGISTER_PROP = \"dashbuilder.runtime.allowExternal\";\n\n    /**\n     * If set to true Runtime will always allow use of new imports (multi tenancy)\n     */\n    private static final String DASHBUILDER_RUNTIME_MULTIPLE_IMPORT_PROP = \"dashbuilder.runtime.multi\";\n\n    /**\n     * If true datasets IDs will partitioned by the Runtime Model ID.\n     */\n    private static final String DATASET_PARTITION_PROP = \"dashbuilder.dataset.partition\";\n\n    /**\n     * If true components will be partitioned by the Runtime Model ID.\n     */\n    private static final String COMPONENT_PARTITION_PROP = \"dashbuilder.components.partition\";\n\n    /**\n     * Boolean property that allows Runtime to check model last update in FS to update its content.\n     */\n    private static final String MODEL_UPDATE_PROP = \"dashbuilder.model.update\";\n\n    /**\n     * Boolean property when true will also remove actual model file from file system.\n     */\n    private static final String MODEL_FILE_REMOVAL_PROP = \"dashbuilder.removeModelFile\";\n\n    /**\n     * Boolean property when true will make Dashbuilder Runtime run on dev mode.\n     */\n    private static final String DEV_MODE_PROP = \"dashbuilder.dev\";\n    \n    /**\n     * Boolean property when true will make dashbuilder watch the models dir to dynamically import models\n     */\n    private static final String WATCH_MODELS_PROP = \"dashbuilder.models.watch\";\n\n    private boolean multipleImport;\n    private boolean datasetPartition;\n    private boolean componentPartition;\n    private boolean allowExternal;\n    private boolean modelUpdate;\n    private boolean removeModelFile;\n    private boolean devMode;\n    boolean watchModels;\n    private String importFileLocation;\n    private String importsBaseDir;\n    private int uploadSize;\n\n    @PostConstruct\n    public void init() {\n\n        importFileLocation = System.getProperty(IMPORT_FILE_LOCATION_PROP);\n        importsBaseDir = System.getProperty(IMPORTS_BASE_DIR_PROP, DEFAULT_MODEL_DIR);\n\n        multipleImport = booleanProp(DASHBUILDER_RUNTIME_MULTIPLE_IMPORT_PROP, Boolean.FALSE);\n        allowExternal = booleanProp(ALLOW_EXTERNAL_FILE_REGISTER_PROP, Boolean.FALSE);\n        datasetPartition = booleanProp(DATASET_PARTITION_PROP, Boolean.TRUE);\n        componentPartition = booleanProp(COMPONENT_PARTITION_PROP, Boolean.TRUE);\n        modelUpdate = booleanProp(MODEL_UPDATE_PROP, Boolean.TRUE);\n        removeModelFile = booleanProp(MODEL_FILE_REMOVAL_PROP, Boolean.FALSE);\n        devMode = booleanProp(DEV_MODE_PROP, Boolean.FALSE);\n        watchModels = booleanProp(WATCH_MODELS_PROP, Boolean.FALSE);\n        uploadSize = DEFAULT_UPLOAD_SIZE_KB;\n\n        String uploadSizeStr = System.getProperty(UPLOAD_SIZE_PROP);\n        if (uploadSizeStr != null) {\n            try {\n                uploadSize = 1024 * Integer.parseInt(uploadSizeStr);\n            } catch (Exception e) {\n                logger.warn(\"Not able to parse upload size {}\", uploadSizeStr);\n                logger.debug(\"Not able to parse upload size {}\", uploadSizeStr, e);\n            }\n        }\n        logger.info(\"Max upload size is {}\", uploadSize);\n    }\n\n    /**\n     * \n     * Returns the model path for the given id\n     * @param id\n     * The model ID \n     * @return\n     * An optional containing the file path or an empty optional otherwise.\n     */\n    public Optional<String> modelPath(String id) {\n        String filePath = buildFilePath(id);\n        return Paths.get(filePath).toFile().exists() ? Optional.of(filePath) : Optional.empty();\n    }\n\n    /**\n     * Generates a new valid file path.\n     * @param fileName\n     * The fileName\n     * @return\n     */\n    public Pair<String, String> newFilePath(final String fileName) {\n        String newFileName = fileName;\n        if (fileName == null || fileName.trim().isEmpty()) {\n            newFileName = System.currentTimeMillis() + \"\";\n        } else if (fileName.endsWith(DASHBOARD_EXTENSION)) {\n            int lastIndex = fileName.length() - DASHBOARD_EXTENSION.length();\n            newFileName = fileName.substring(0, lastIndex);\n        }\n\n        String filePath = buildFilePath(newFileName);\n        return Pair.newPair(newFileName, filePath);\n    }\n\n    public boolean isMultipleImport() {\n        return multipleImport;\n    }\n\n    public Optional<String> importFileLocation() {\n        return Optional.ofNullable(importFileLocation);\n    }\n\n    public String getImportsBaseDir() {\n        return importsBaseDir;\n    }\n\n    public int getUploadSize() {\n        return uploadSize;\n    }\n\n    public boolean isAllowExternal() {\n        return allowExternal;\n    }\n\n    public boolean isDatasetPartition() {\n        return datasetPartition;\n    }\n\n    public boolean isComponentPartition() {\n        return componentPartition;\n    }\n\n    public boolean isModelUpdate() {\n        // dev mode forces model update\n        return modelUpdate || devMode;\n    }\n\n    public boolean isRemoveModelFile() {\n        return removeModelFile;\n    }\n\n    public boolean isDevMode() {\n        return devMode;\n    }\n    \n    public boolean isWatchModels() {\n        // dev mode requires to watch models\n        return watchModels || devMode;\n    }\n\n    public String buildFilePath(String fileId) {\n        Path modelFile = Paths.get(fileId + DASHBOARD_EXTENSION);\n        return Paths.get(getImportsBaseDir()).resolve(modelFile).toString();\n    }\n\n    private boolean booleanProp(String prop, Boolean defaultValue) {\n        String propStr = System.getProperty(prop, defaultValue.toString());\n        return Boolean.parseBoolean(propStr);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/ServerSideProducers.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.preferences.client.store.PreferenceBeanStoreClientImpl;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\n\n@ApplicationScoped\npublic class ServerSideProducers {\n\n    @Inject\n    @FallbackImplementation\n    DefaultPreferenceScopeResolutionStrategy defaultPreferenceScopeResolutionStrategy;\n\n    @Produces\n    @ApplicationScoped\n    public User produceUser() {\n        return User.ANONYMOUS;\n    }\n\n    @Produces\n    @ApplicationScoped\n    public SessionInfo produceSessionInfo() {\n        return new SessionInfoImpl();\n    }\n\n    @Produces\n    @ApplicationScoped\n    public PreferenceBeanStore producePreferenceBeanStore() {\n        return new PreferenceBeanStoreClientImpl();\n    }\n\n    @Produces\n    @Customizable\n    @ApplicationScoped\n    public PreferenceScopeResolutionStrategy producePreferenceScopeResolutionStrategy() {\n        return defaultPreferenceScopeResolutionStrategy;\n    }\n\n    @Produces\n    @ApplicationScoped\n    public UsernameProvider produceUsernameProvider() {\n        return () -> User.ANONYMOUS.getIdentifier();\n    }\n\n    @Produces\n    @ApplicationScoped\n    public AuthenticationService produceAuthenticationService() {\n        return new AuthenticationService() {\n\n            @Override\n            public void logout() {\n                // not used\n            }\n\n            @Override\n            public User login(String username, String password) {\n                return null;\n            }\n\n            @Override\n            public boolean isLoggedIn() {\n                return false;\n            }\n\n            @Override\n            public User getUser() {\n                return User.ANONYMOUS;\n            }\n        };\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/gzip/GzipFilter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.gzip;\n\nimport java.io.IOException;\n\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport static javax.ws.rs.core.HttpHeaders.ACCEPT_ENCODING;\n\n// NOTE: Brought this from uberfire-backend-server\npublic class GzipFilter implements Filter {\n\n    static final String GZIP = \"gzip\";\n\n    static final String ORG_UBERFIRE_GZIP_ENABLE = \"org.uberfire.gzip.enable\";\n\n    public void init(final FilterConfig filterConfig) {\n        // Empty on purpose\n    }\n\n    public void doFilter(final ServletRequest req,\n                         final ServletResponse res,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        switch (getAction(req)) {\n            case HALT:\n                break;\n            case DO_NOT_ACCEPT_GZIP:\n            case DO_NOT_COMPRESS:\n                chain.doFilter(req, res);\n                break;\n            case COMPRESS:\n                compressAndContinue(req, (HttpServletResponse) res, chain);\n                break;\n        }\n    }\n\n    void compressAndContinue(final ServletRequest req,\n                             final HttpServletResponse res,\n                             final FilterChain chain) throws IOException, ServletException {\n\n        final GzipHttpServletResponseWrapper wResponse = new GzipHttpServletResponseWrapper(res);\n        chain.doFilter(req, wResponse);\n        wResponse.close();\n    }\n\n    Action getAction(final ServletRequest req) {\n\n        final String enabled = System.getProperty(ORG_UBERFIRE_GZIP_ENABLE);\n        if (enabled != null && !enabled.equals(\"true\")) {\n            return Action.DO_NOT_COMPRESS;\n        }\n\n        if (!(req instanceof HttpServletRequest)) {\n            return Action.HALT;\n        }\n\n        final String acceptEncodingHeader = ((HttpServletRequest) req).getHeader(ACCEPT_ENCODING);\n        if (acceptEncodingHeader == null || !acceptEncodingHeader.contains(GZIP)) {\n            return Action.DO_NOT_ACCEPT_GZIP;\n        }\n\n        return Action.COMPRESS;\n    }\n\n    public void destroy() {\n        // Empty on purpose\n    }\n\n    enum Action {\n        HALT,\n        DO_NOT_COMPRESS,\n        DO_NOT_ACCEPT_GZIP,\n        COMPRESS;\n    }\n}\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/gzip/GzipHttpServerResponseWrapper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.gzip;\n\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.nio.charset.StandardCharsets;\n\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpServletResponseWrapper;\n\nclass GzipHttpServletResponseWrapper extends HttpServletResponseWrapper {\n\n    private HttpServletResponse response;\n    private ServletOutputStream stream;\n    private PrintWriter writer;\n\n    GzipHttpServletResponseWrapper(final HttpServletResponse response) {\n        super(response);\n        this.response = response;\n        this.stream = null;\n        this.writer = null;\n    }\n\n    @Override\n    public void flushBuffer() throws IOException {\n        stream.flush();\n    }\n\n    @Override\n    public ServletOutputStream getOutputStream() throws IOException {\n        if (writer != null) {\n            throw new IllegalStateException(\"getOutputStream() was already called\");\n        }\n\n        if (stream == null) {\n            stream = createOutputStream();\n        }\n\n        return stream;\n    }\n\n    @Override\n    public PrintWriter getWriter() throws IOException {\n        if (writer != null) {\n            return writer;\n        }\n\n        if (stream != null) {\n            throw new IllegalStateException(\"getWriter() was already called\");\n        }\n\n        stream = createOutputStream();\n        writer = new PrintWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8));\n        return writer;\n    }\n\n    @Override\n    public void setContentLength(final int length) {\n        // Empty on purpose\n    }\n\n    private ServletOutputStream createOutputStream() throws IOException {\n        return new GzipResponseServletOutputStream(response);\n    }\n\n    void close() {\n        try {\n            if (writer != null) {\n                writer.close();\n            } else if (stream != null) {\n                stream.close();\n            }\n        } catch (final IOException e) {\n            // Error on closing writer or stream.\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/gzip/GzipOutputStream.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.gzip;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.util.zip.GZIPOutputStream;\n\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.WriteListener;\nimport javax.servlet.http.HttpServletResponse;\n\nclass GzipResponseServletOutputStream extends ServletOutputStream {\n\n    private static final String CONTENT_LENGTH_HEADER = \"Content-Length\";\n    private static final String CONTENT_ENCODING_HEADER = \"Content-Encoding\";\n\n    private ByteArrayOutputStream baos;\n    private GZIPOutputStream gzipStream;\n    private HttpServletResponse response;\n    private ServletOutputStream outputStream;\n    private boolean closed;\n\n    GzipResponseServletOutputStream(final HttpServletResponse response) throws IOException {\n        super();\n        this.closed = false;\n        this.response = response;\n        this.outputStream = response.getOutputStream();\n        this.baos = new ByteArrayOutputStream();\n        this.gzipStream = new GZIPOutputStream(baos);\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (closed) {\n            return;\n        }\n\n        gzipStream.finish();\n        final byte[] bytes = baos.toByteArray();\n\n        response.addHeader(CONTENT_LENGTH_HEADER, Integer.toString(bytes.length));\n        response.addHeader(CONTENT_ENCODING_HEADER, GzipFilter.GZIP);\n\n        outputStream.write(bytes);\n        outputStream.flush();\n        outputStream.close();\n        closed = true;\n    }\n\n    @Override\n    public void flush() throws IOException {\n        if (closed) {\n            return;\n        }\n\n        gzipStream.flush();\n    }\n\n    @Override\n    public void write(final int b) throws IOException {\n        if (closed) {\n            throw new IOException(\"Output stream already closed.\");\n        }\n\n        gzipStream.write((byte) b);\n    }\n\n    @Override\n    public void write(final byte[] data) throws IOException {\n        write(data, 0, data.length);\n    }\n\n    @Override\n    public void write(final byte[] data, final int offset, final int length) throws IOException {\n        if (closed) {\n            throw new IOException(\"Output stream already closed.\");\n        }\n\n        gzipStream.write(data, offset, length);\n    }\n\n    @Override\n    public boolean isReady() {\n        return true;\n    }\n\n    @Override\n    public void setWriteListener(final WriteListener writeListener) {\n        // Empty on purpose\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/health/HealthService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.health;\n\nimport javax.annotation.security.PermitAll;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\n\nimport static javax.ws.rs.core.MediaType.APPLICATION_JSON;\n\n/**\n * Service that reports if Runtime is ready and healthy.\n *\n */\n@Path(\"/\")\npublic class HealthService {\n    \n    private static final String SUCCESS_RESPONSE = \"{\\\"success\\\": true}\";\n    \n    @GET\n    @PermitAll\n    @Path(\"/ready\")\n    @Produces(APPLICATION_JSON)\n    public String ready() {\n        return SUCCESS_RESPONSE;\n    }\n    \n    @GET\n    @PermitAll\n    @Path(\"/healthy\")\n    @Produces(APPLICATION_JSON)\n    public String alive() {\n        return SUCCESS_RESPONSE;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/helper/PartitionHelper.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.helper;\n\npublic class PartitionHelper {\n\n    private static final String PARTITION_SEPARATOR = \"|\";\n\n    private PartitionHelper() {\n        // empty\n    }\n\n    public static String partition(String modelId, String id) {\n        return id + PARTITION_SEPARATOR + \" RuntimeModel=\" + modelId;\n    }\n\n    public static String removePartition(String id) {\n        if (id != null) {\n            int sepatorIndex = id.indexOf(PARTITION_SEPARATOR);\n            if (sepatorIndex > -1) {\n                return id.substring(0, sepatorIndex);\n            }\n        }\n        return id;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/navigation/RuntimeNavigationBuilder.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.navigation;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemContext;\nimport org.dashbuilder.navigation.NavItemVisitor;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.json.NavTreeJSONMarshaller;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n/**\n * Builds the navigation for Dashbuilder Runtime\n *\n */\n@ApplicationScoped\npublic class RuntimeNavigationBuilder {\n\n    static final String ORPHAN_GROUP_ID = \"__runtime_dashboards\";\n    static final String ORPHAN_GROUP_NAME = \"Runtime Dashboards\";\n    static final String ORPHAN_GROUP_DESC = \"Dashboards\";\n\n    Logger logger = LoggerFactory.getLogger(RuntimeNavigationBuilder.class);\n\n    public NavTree build(Optional<String> navTreeJson, List<LayoutTemplate> layoutTemplates) {\n        if (navTreeJson.isPresent()) {\n            NavTree navTree = NavTreeJSONMarshaller.get().fromJson(navTreeJson.get());\n            return buildRuntimeTree(navTree, layoutTemplates);\n        }\n        return navTreeForTemplates(layoutTemplates);\n    }\n\n    protected NavTree buildRuntimeTree(NavTree navTree, List<LayoutTemplate> layoutTemplates) {\n        RuntimeNavItemVisitor visitor = new RuntimeNavItemVisitor(layoutTemplates);\n\n        navTree.accept(visitor);\n\n        List<NavGroup> groups = visitor.getGroups();\n        List<String> notExported = visitor.getNotExportedPerspectives();\n        List<LayoutTemplate> orphanTemplates = visitor.getOrphanItems();\n\n        groups.forEach(grp -> grp.getChildren().removeIf(i -> notExported.contains(i.getId())));\n        groups.removeIf(grp -> grp.getChildren().isEmpty());\n\n        NavTreeBuilder builder = new NavTreeBuilder();\n\n        if (!orphanTemplates.isEmpty()) {\n            logger.info(\"Found {} layout components without a group\", orphanTemplates.size());\n            buildLayoutTemplatesGroup(orphanTemplates, builder);\n        }\n\n        NavTree runtimeNavTree = builder.build();\n        runtimeNavTree.getRootItems().addAll(groups);\n        return runtimeNavTree;\n    }\n\n    private NavTree navTreeForTemplates(List<LayoutTemplate> layoutTemplates) {\n        NavTreeBuilder treeBuilder = new NavTreeBuilder();\n        return buildLayoutTemplatesGroup(layoutTemplates, treeBuilder).build();\n    }\n\n    private NavTreeBuilder buildLayoutTemplatesGroup(List<LayoutTemplate> layoutTemplates, NavTreeBuilder treeBuilder) {\n        treeBuilder.group(ORPHAN_GROUP_ID, ORPHAN_GROUP_NAME, ORPHAN_GROUP_DESC, false);\n        layoutTemplates.forEach(lt -> {\n            NavItemContext ctx = NavWorkbenchCtx.perspective(lt.getName());\n            treeBuilder.item(lt.getName(), lt.getName(), \"\", true, ctx);\n        });\n        treeBuilder.endGroup();\n        return treeBuilder;\n    }\n\n    List<LayoutTemplate> checkOrphansLayoutTemplates(NavTree navTree,\n                                                     List<LayoutTemplate> layoutTemplates) {\n        return layoutTemplates.stream()\n                              .filter(lt -> navTree.getItemById(lt.getName()) == null)\n                              .collect(Collectors.toList());\n    }\n\n    /**\n     * \n     * Remove groups with child groups that have no children\n     * @param navGroup\n     * @param originTree\n     */\n    void removedEmptyNestedGroups(NavGroup navGroup, List<String> itemsToRemove) {\n\n        filteringGroups(navGroup.getChildren()).forEach(group -> removedEmptyNestedGroups(group, itemsToRemove));\n\n        if (navGroup.getChildren().isEmpty()) {\n            logger.info(\"Removing groups {}\", navGroup.getName());\n            itemsToRemove.add(navGroup.getId());\n        }\n\n    }\n\n    Stream<NavGroup> filteringGroups(List<NavItem> items) {\n        return items.stream()\n                    .filter(item -> item instanceof NavGroup)\n                    .map(item -> (NavGroup) item);\n    }\n\n    /**\n     * Collects non empty groups and create a flatten tree (all groups as root items). \n     *\n     */\n    class RuntimeNavItemVisitor implements NavItemVisitor {\n\n        List<NavGroup> groups;\n        List<LayoutTemplate> layoutTemplates;\n        List<LayoutTemplate> orphanItems;\n        List<String> notExportedPerspectives;\n\n        public RuntimeNavItemVisitor(List<LayoutTemplate> layoutTemplates) {\n            this.groups = new ArrayList<>();\n            this.notExportedPerspectives = new ArrayList<>();\n            this.orphanItems = new ArrayList<>(layoutTemplates);\n            this.layoutTemplates = layoutTemplates;\n        }\n\n        @Override\n        public void visitGroup(NavGroup group) {\n            if (!group.getChildren().isEmpty()) {\n                NavGroup clonnedGroup = (NavGroup) group.cloneItem();\n                clonnedGroup.setParent(null);\n                clonnedGroup.getChildren().removeIf(item -> item instanceof NavGroup);\n                groups.add(clonnedGroup);\n            }\n        }\n\n        @Override\n        public void visitItem(NavItem item) {\n            String resourceId = NavWorkbenchCtx.get(item.getContext()).getResourceId();\n            if (layoutTemplates.stream().noneMatch(lt -> lt.getName().equals(resourceId))) {\n                notExportedPerspectives.add(item.getId());\n            }\n\n            orphanItems.stream()\n                       .filter(lt -> lt.getName().equals(resourceId))\n                       .findFirst().ifPresent(notOrphanItem -> orphanItems.remove(notOrphanItem));\n        }\n\n        @Override\n        public void visitDivider(NavDivider divider) {\n            // do nothing\n        }\n\n        public List<NavGroup> getGroups() {\n            return groups;\n        }\n\n        public List<LayoutTemplate> getOrphanItems() {\n            return orphanItems;\n        }\n\n        public List<String> getNotExportedPerspectives() {\n            return notExportedPerspectives;\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/RuntimeModelServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.nio.file.attribute.BasicFileAttributes;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.backend.navigation.RuntimeNavigationBuilder;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.model.RuntimeServiceResponse;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.dashbuilder.shared.service.RuntimeModelService;\nimport org.dashbuilder.shared.services.ExternalImportService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@Service\n@ApplicationScoped\npublic class RuntimeModelServiceImpl implements RuntimeModelService {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeModelServiceImpl.class);\n\n    @Inject\n    RuntimeModelRegistry registry;\n\n    @Inject\n    RuntimeNavigationBuilder runtimeNavigationBuilder;\n\n    @Inject\n    RuntimeOptions runtimeOptions;\n\n    @Inject\n    ExternalImportService externalImportService;\n\n    @Override\n    public RuntimeServiceResponse info(String runtimeModelId) {\n        List<String> availableModels = new ArrayList<>(registry.availableModels());\n        return new RuntimeServiceResponse(registry.getMode(),\n                                          getRuntimeModel(runtimeModelId),\n                                          availableModels);\n    }\n\n    @Override\n    public Optional<RuntimeModel> getRuntimeModel(String exportId) {\n        if (!registry.acceptingNewImports()) {\n            return registry.single();\n        }\n\n        if (exportId == null || exportId.trim().isEmpty()) {\n            return Optional.empty();\n        }\n\n        return loadImportById(exportId);\n\n    }\n\n    /**\n     * Attempts to load a model which could be a local file, an already loaded model or an external file.\n     * @param id\n     * The model id or path\n     * @return\n     * An optional containing the loaded model or empty.\n     */\n    private Optional<RuntimeModel> loadImportById(String id) {\n        Optional<RuntimeModel> runtimeModelOp = registry.get(id);\n        if (runtimeModelOp.isPresent()) {\n            return loadLatestModel(id, runtimeModelOp.get());\n        }\n\n        Optional<String> modelPath = runtimeOptions.modelPath(id);\n        if (modelPath.isPresent()) {\n            return registry.registerFile(modelPath.get());\n        }\n\n        if (runtimeOptions.isAllowExternal()) {\n            return externalImportService.registerExternalImport(id);\n        }\n        return Optional.empty();\n    }\n\n    private Optional<RuntimeModel> loadLatestModel(String id, RuntimeModel runtimeModel) {\n        Optional<String> modelPath = runtimeOptions.modelPath(id);\n        if (runtimeOptions.isModelUpdate() && modelPath.isPresent()) {\n            String modelFilePath = modelPath.get();\n            if (lastModified(modelFilePath) > runtimeModel.getLastModified()) {\n                logger.info(\"Replacing model {}\", id);\n                registry.unregister(id);\n                return registry.registerFile(modelFilePath);\n            }\n        }\n        return Optional.of(runtimeModel);\n    }\n\n    private long lastModified(String modelFilePath) {\n        try {\n            return Files.readAttributes(Paths.get(modelFilePath), BasicFileAttributes.class)\n                        .lastModifiedTime()\n                        .toMillis();\n        } catch (IOException e) {\n            logger.error(\"Error reading file last modified time\");\n            logger.debug(\"Error reading file last modified time\", e);\n            return -1;\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dataset/RuntimeDataSetLookupServices.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dataset;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetManager;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.service.DataSetLookupServices;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class RuntimeDataSetLookupServices implements DataSetLookupServices {\n\n    @Inject\n    DataSetManager manager;\n\n    public RuntimeDataSetLookupServices() {\n        // not used, but must exist\n    }\n\n    @Override\n    public DataSet lookupDataSet(DataSetLookup lookup) throws Exception {\n        return manager.lookupDataSet(lookup);\n    }\n\n    @Override\n    public DataSet lookupDataSet(DataSetDef def, DataSetLookup lookup) throws Exception {\n        return manager.lookupDataSet(lookup);\n    }\n\n    @Override\n    public DataSetMetadata lookupDataSetMetadata(String uuid) throws Exception {\n        return manager.getDataSetMetadata(uuid);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyBackendExperimentalFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\n\n@Service\n@ApplicationScoped\npublic class DummyBackendExperimentalFeatureDefRegistry implements BackendExperimentalFeatureDefRegistry {\n\n    @Override\n    public ExperimentalFeatureDefinition getFeatureById(String definitionId) {\n        return null;\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> getAllFeatures() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> getGlobalFeatures() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> getUserFeatures() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> loadFeatureDefinitions(Collection<ExperimentalFeatureDefinition> clientDefinitions) {\n        return Collections.emptyList();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyBackendExperimentalFeaturesRegistryService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport java.util.Collections;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.backend.ExperimentalFeaturesSession;\nimport org.uberfire.experimental.service.backend.impl.ExperimentalFeaturesSessionImpl;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\n\n@Service\n@ApplicationScoped\npublic class DummyBackendExperimentalFeaturesRegistryService implements BackendExperimentalFeaturesRegistryService{\n\n    @Override\n    public ExperimentalFeaturesSession getExperimentalFeaturesSession() {\n        ExperimentalFeaturesSessionImpl session = new ExperimentalFeaturesSessionImpl();\n        session.setRegistry(new ExperimentalFeaturesRegistryImpl(Collections.emptyList()));\n        return session;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyPerspectiveServices.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate.Style;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n@Service\n@ApplicationScoped\npublic class DummyPerspectiveServices implements PerspectiveServices {\n\n    @Override\n    public Path copy(Path path, String newName, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path copy(Path path, String newName, Path targetDirectory, String comment) {\n        return null;\n    }\n\n    @Override\n    public void delete(Path path, String comment) {\n        // ignored\n    }\n\n    @Override\n    public Path saveAndRename(Path path, String newFileName, DefaultMetadata metadata, LayoutTemplate content, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path rename(Path path, String newName, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path save(Path path, LayoutTemplate content, DefaultMetadata metadata, String comment) {\n        return null;\n    }\n\n    @Override\n    public Plugin createNewPerspective(String name, Style style) {\n        return null;\n    }\n\n    @Override\n    public Collection<LayoutTemplate> listLayoutTemplates() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(String perspectiveName) {\n        return null;\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(Path perspectivePath) {\n        return null;\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin) {\n        return null;\n    }\n\n    @Override\n    public LayoutTemplate convertToLayoutTemplate(String layoutModel) {\n        return null;\n    }\n\n    @Override\n    public Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage) {\n        return null;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyPluginServices.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\n\n/**\n * This should be removed as soon as PluginServices cliend side mocked service starts working.\n *\n */\n@Service\n@ApplicationScoped\npublic class DummyPluginServices implements PluginServices {\n\n    @Override\n    public void delete(Path path, String comment) {\n        // not used\n    }\n\n    @Override\n    public Path copy(Path path, String newName, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path copy(Path path, String newName, Path targetDirectory, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path saveAndRename(Path path, String newFileName, DefaultMetadata metadata, Plugin content, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path rename(Path path, String newName, String comment) {\n        return null;\n    }\n\n    @Override\n    public Path save(Path path, Plugin content, DefaultMetadata metadata, String comment) {\n        return null;\n    }\n\n    @Override\n    public String getMediaServletURI() {\n        return null;\n    }\n\n    @Override\n    public Collection<RuntimePlugin> listRuntimePlugins() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<RuntimePlugin> listPluginRuntimePlugins(Path pluginPath) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Plugin> listPlugins() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Plugin> listPlugins(PluginType type) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Plugin createNewPlugin(String name, PluginType type) {\n        return null;\n    }\n\n    @Override\n    public PluginContent getPluginContent(Path path) {\n        return null;\n    }\n\n    @Override\n    public void deleteMedia(Media media) {\n        // not used\n    }\n\n    @Override\n    public DynamicMenu getDynamicMenuContent(Path path) {\n        return null;\n    }\n\n    @Override\n    public Path save(Plugin plugin, String commitMessage) {\n        return null;\n    }\n\n    @Override\n    public LayoutEditorModel getLayoutEditor(Path path, PluginType pluginType) {\n        return null;\n    }\n\n    @Override\n    public Path saveMenu(DynamicMenu menu, String commitMessage) {\n        return null;\n    }\n\n    @Override\n    public Path saveLayout(LayoutEditorModel layoutContent, String commitMessage) {\n        return null;\n    }\n\n    @Override\n    public Collection<DynamicMenu> listDynamicMenus() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<LayoutEditorModel> listLayoutEditor(PluginType pluginType) {\n        return Collections.emptyList();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyRendererSettingsService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.dashbuilder.renderer.service.RendererSettingsService;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class DummyRendererSettingsService implements RendererSettingsService {\n\n    @Override\n    public RendererSettings getSettings() {\n        return new RendererSettings();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/remote/services/dummy/DummyRuntimePluginService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.remote.services.dummy;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.plugin.RuntimePlugin;\nimport org.uberfire.backend.plugin.RuntimePluginService;\n\n@Service\n@ApplicationScoped\npublic class DummyRuntimePluginService implements RuntimePluginService {\n\n    @Override\n    public Collection<String> listFrameworksContent() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<String> listPluginsContent() {\n        return Collections.emptyList();\n\n    }\n\n    @Override\n    public String getTemplateContent(String url) {\n        return \"\";\n    }\n\n    @Override\n    public String getRuntimePluginTemplateContent(String url) {\n        return \"\";\n    }\n\n    @Override\n    public List<RuntimePlugin> getRuntimePlugins() {\n        return Collections.emptyList();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/resources/FileUploadModel.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.resources;\n\nimport javax.ws.rs.FormParam;\n\nimport org.jboss.resteasy.annotations.providers.multipart.PartType;\n\n/**\n * File sent by upload.\n *\n */\npublic class FileUploadModel {\n\n    private byte[] fileData;\n    private String fileName;\n\n    public byte[] getFileData() {\n        return fileData;\n    }\n\n    public String getFileName() {\n        return fileName;\n    }\n\n    @FormParam(\"inputFileName\")\n    public void setFileName(final String fileName) {\n        this.fileName = fileName;\n    }\n\n    @FormParam(\"selectedFile\")\n    @PartType(\"application/octet-stream\")\n    public void setFileData(final byte[] fileData) {\n        this.fileData = fileData;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/resources/RuntimeJaxApp.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.resources;\n\nimport javax.ws.rs.ApplicationPath;\nimport javax.ws.rs.core.Application;\n\n@ApplicationPath(\"/rest\")\npublic class RuntimeJaxApp extends Application {\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/resources/UploadResourceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.resources;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.WebApplicationException;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Response.Status;\n\nimport org.apache.commons.io.IOUtils;\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.jboss.resteasy.annotations.providers.multipart.MultipartForm;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.data.Pair;\n\nimport static org.dashbuilder.backend.RuntimeOptions.DASHBOARD_EXTENSION;\n\n/**\n * Resource to receive new imports.\n *\n */\n@Path(\"/upload\")\n@ApplicationScoped\npublic class UploadResourceImpl {\n\n    Logger logger = LoggerFactory.getLogger(UploadResourceImpl.class);\n\n    @Inject\n    RuntimeOptions runtimeOptions;\n\n    @Inject\n    RuntimeModelRegistry runtimeModelRegistry;\n\n    @POST\n    @Consumes(MediaType.MULTIPART_FORM_DATA)\n    public Response uploadFile(@MultipartForm FileUploadModel form) throws IOException {\n        byte[] inputBytes = form.getFileData();\n\n        checkInputSize(inputBytes);\n\n        Optional<String> dashboardOp = checkForExistingFile(inputBytes);\n        if (dashboardOp.isPresent()) {\n            String dashboardName = dashboardOp.get();\n            logger.info(\"Found existing file with same contents: {}\", dashboardName);\n            if (runtimeModelRegistry.get(dashboardName).isPresent()) {\n                return Response.status(Status.CONFLICT).entity(dashboardName).build();\n            } else {\n                return registerExistingFile(dashboardName);\n            }\n        }\n\n        return registerNewFile(form.getFileName(), inputBytes);\n    }\n\n    /**\n     * Reads the uploaded model bytes controlling the size and throwing exception when the size exceeds the allowed size.\n     * @param fileData\n     * @return\n     */\n    private void checkInputSize(byte[] bytes) {\n        if (bytes.length > runtimeOptions.getUploadSize()) {\n            logger.debug(\"Total size {} is greater than the allowed size {}\",\n                         bytes.length,\n                         runtimeOptions.getUploadSize());\n            throw new WebApplicationException(\"Upload size is greater than the allowed size: \" + runtimeOptions.getUploadSize(),\n                                              Response.Status.BAD_REQUEST);\n        }\n    }\n\n    /**\n     * \n     * If a file exists with a given size then probably it is a repeated.\n     * \n     * @param uploadSize\n     * @return\n     * @throws IOException \n     */\n    private Optional<String> checkForExistingFile(byte[] uploadedFile) throws IOException {\n        try (Stream<java.nio.file.Path> walk = Files.walk(Paths.get(runtimeOptions.getImportsBaseDir()), 1)) {\n            return walk\n                       .filter(p -> p.toFile().isFile() &&\n                                    p.toString().toLowerCase().endsWith(DASHBOARD_EXTENSION) &&\n                                    isContentEquals(uploadedFile, p))\n                       .map(p -> p.getFileName().toString().replace(DASHBOARD_EXTENSION, \"\"))\n                       .findFirst();\n\n        } catch (Exception e) {\n            logger.info(\"Error checking for duplicated file contents.\");\n            logger.debug(\"Error checking for duplicated file contents.\", e);\n            return Optional.empty();\n        }\n\n    }\n\n    private boolean isContentEquals(byte[] uploadedFile, java.nio.file.Path p) {\n        try (InputStream fis = Files.newInputStream(p)) {\n            return IOUtils.contentEquals(fis, new ByteArrayInputStream(uploadedFile));\n        } catch (IOException e) {\n            logger.debug(\"Error checking file {}. Skipping from verification.\", p, e);\n        }\n        return false;\n    }\n\n    private Response registerNewFile(String fileName, byte[] inputBytes) throws IOException {\n        Pair<String, String> newImportInfo = runtimeOptions.newFilePath(fileName);\n        java.nio.file.Path path = Paths.get(newImportInfo.getK2());\n        Files.write(path, inputBytes);\n\n        try {\n            runtimeModelRegistry.registerFile(newImportInfo.getK2());\n        } catch (Exception e) {\n            Files.delete(path);\n            logger.error(\"Error uploading file\", e);\n            return Response.status(Response.Status.BAD_REQUEST)\n                           .entity(e.getMessage())\n                           .build();\n        }\n\n        return Response.ok(newImportInfo.getK1()).build();\n    }\n\n    private Response registerExistingFile(String dashboardName) {\n        String filePath = runtimeOptions.buildFilePath(dashboardName);\n        runtimeModelRegistry.registerFile(filePath);\n        return Response.ok(dashboardName).build();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/resources/api/DashbuilderRuntimeResource.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.resources.api;\n\nimport java.io.IOException;\nimport java.util.Optional;\n\nimport javax.inject.Inject;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Response.Status;\n\nimport org.dashbuilder.backend.resources.FileUploadModel;\nimport org.dashbuilder.backend.resources.UploadResourceImpl;\nimport org.dashbuilder.backend.services.RuntimeInfoService;\nimport org.dashbuilder.shared.model.DashboardInfo;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeInfo;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.jboss.resteasy.annotations.providers.multipart.MultipartForm;\n\n@Path(\"api/\")\n@Produces(MediaType.APPLICATION_JSON)\npublic class DashbuilderRuntimeResource {\n\n    private static final String DASHBOARD_BASE_URI = \"dashboard\";\n    private static final String DASHBOARD_ID_URI = DASHBOARD_BASE_URI + \"/{id}\";\n\n    @Inject\n    RuntimeInfoService runtimeInfoService;\n\n    @Inject\n    UploadResourceImpl uploadResourceImpl;\n\n    @Inject\n    RuntimeModelRegistry registry;\n\n    @GET\n    public DashbuilderRuntimeInfo info() {\n        return runtimeInfoService.info();\n    }\n\n    @GET\n    @Path(DASHBOARD_ID_URI)\n    public Response dashboard(@PathParam(\"id\") String id) {\n        return runtimeInfoService.dashboardInfo(id)\n                                 .map(info -> Response.ok().entity(info).build())\n                                 .orElse(Response.status(Status.NOT_FOUND).build());\n    }\n\n    @POST\n    @Path(DASHBOARD_BASE_URI)\n    @Consumes(MediaType.MULTIPART_FORM_DATA)\n    public Response uploadResource(@MultipartForm FileUploadModel form) throws IOException {\n        return uploadResourceImpl.uploadFile(form);\n    }\n\n    @DELETE\n    @Path(DASHBOARD_BASE_URI)\n    public void removeAll() {\n        registry.clear();\n    }\n\n    @DELETE\n    @Path(DASHBOARD_ID_URI)\n    public Response remove(@PathParam(\"id\") String id) {\n        Optional<DashboardInfo> dashboardInfo = runtimeInfoService.dashboardInfo(id);\n        if (dashboardInfo.isPresent()) {\n            registry.remove(id);\n            return Response.ok().build();\n        } else {\n            return Response.status(Status.NOT_FOUND).build();\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/security/BasicAuthSecurityFilter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.security;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.inject.Inject;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport com.google.common.base.Charsets;\nimport org.apache.commons.codec.binary.Base64;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\n\nimport static java.util.stream.Collectors.toSet;\nimport static org.apache.commons.lang3.StringUtils.isBlank;\n\npublic class BasicAuthSecurityFilter implements Filter {\n\n    public static final String REALM_NAME_PARAM = \"realmName\";\n    public static final String INVALIDATE_PARAM = \"invalidate\";\n    public static final String EXCEPTION_PATHS = \"excludedPaths\";\n    public static final String ALLOW_OPTIONS = \"allowOptions\";\n\n    private static final String OPTIONS = \"OPTIONS\";\n\n    @Inject\n    AuthenticationService authenticationService;\n\n    private String realmName = \"UberFire Security Extension Default Realm\";\n    private Boolean invalidate = true;\n    private Boolean allowOptions = true;\n    private Set<String> excludedPaths = new HashSet<>();\n\n    @Override\n    public void init(final FilterConfig filterConfig) {\n        final String realmName = filterConfig.getInitParameter(REALM_NAME_PARAM);\n        if (realmName != null) {\n            this.realmName = realmName;\n        }\n        final String invalidate = filterConfig.getInitParameter(INVALIDATE_PARAM);\n        if (invalidate != null) {\n            this.invalidate = Boolean.valueOf(invalidate);\n        }\n        final String excludedPaths = filterConfig.getInitParameter(EXCEPTION_PATHS);\n        if (excludedPaths != null) {\n            this.excludedPaths = Arrays.stream(excludedPaths.split(\",\")).filter(s -> !isBlank(s)).collect(toSet());\n        }\n        final String allowOptions = filterConfig.getInitParameter(ALLOW_OPTIONS);\n        if (allowOptions != null) {\n            this.allowOptions = Boolean.parseBoolean(allowOptions);\n        }\n    }\n\n    @Override\n    public void destroy() {}\n\n    @Override\n    public void doFilter(final ServletRequest _request,\n                         final ServletResponse _response,\n                         final FilterChain chain) throws IOException, ServletException {\n        final HttpServletRequest request = (HttpServletRequest) _request;\n        final HttpServletResponse response = (HttpServletResponse) _response;\n        \n        if (isExceptionPath(request) || checkOptions(request)) {\n            chain.doFilter(request, response);\n            return;\n        }\n\n        HttpSession session = request.getSession(false);\n        final User user = authenticationService.getUser();\n        try {\n            if (user == null || isAnonymousUser(user)) {\n                if (authenticate(request)) {\n                    chain.doFilter(request,\n                                   response);\n                    if (response.isCommitted()) {\n                        authenticationService.logout();\n                    }\n                } else {\n                    challengeClient(request,\n                                    response);\n                }\n            } else {\n                chain.doFilter(request,\n                               response);\n            }\n        } finally {\n            // invalidate session only when it did not exists before this request,\n            // it was created as part of this request and filter is configured to invalidate.\n            if (session == null && invalidate) {\n                session = request.getSession(false);\n                if (session != null) {\n                    session.invalidate();\n                }\n            }\n        }\n    }\n\n    private boolean checkOptions(HttpServletRequest request) {\n        return OPTIONS.equalsIgnoreCase(request.getMethod()) && allowOptions;\n    }\n\n    private boolean isExceptionPath(final HttpServletRequest request) {\n        String requestURI = request.getRequestURI();\n\n        while (requestURI != null && requestURI.endsWith(\"/\")) {\n            requestURI = requestURI.substring(0, requestURI.length() - 1);\n        }\n\n        if (requestURI != null && requestURI.startsWith(request.getContextPath())) {\n            requestURI = requestURI.replaceFirst(request.getContextPath(), \"\");\n        }\n\n        return excludedPaths.contains(requestURI);\n    }\n\n    public void challengeClient(final HttpServletRequest request,\n                                final HttpServletResponse response) throws IOException {\n        response.setHeader(\"WWW-Authenticate\",\n                           \"Basic realm=\\\"\" + this.realmName + \"\\\"\");\n\n        // this usually means we have a failing authentication request from an ajax client. so we return SC_FORBIDDEN instead.\n        if (isAjaxRequest(request)) {\n            response.sendError(HttpServletResponse.SC_FORBIDDEN);\n        } else {\n            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);\n        }\n    }\n\n    private boolean authenticate(final HttpServletRequest req) {\n        final String authHead = req.getHeader(\"Authorization\");\n\n        if (authHead != null) {\n            final int index = authHead.indexOf(' ');\n            final String[] credentials = new String(Base64.decodeBase64(authHead.substring(index)),\n                                                    Charsets.UTF_8).split(\":\",\n                                                                          -1);\n\n            try {\n                authenticationService.login(credentials[0],\n                                            credentials[1]);\n                return true;\n            } catch (final FailedAuthenticationException e) {\n                return false;\n            }\n        }\n\n        return false;\n    }\n\n    private boolean isAjaxRequest(HttpServletRequest request) {\n        return request.getHeader(\"X-Requested-With\") != null && \"XMLHttpRequest\".equalsIgnoreCase(request.getHeader(\"X-Requested-With\"));\n    }\n\n    private boolean isAnonymousUser(User user) {\n        if (user.getRoles().size() != 1) {\n            return false;\n        }\n        String roleName = user.getRoles().iterator().next().getName();\n        return User.ANONYMOUS.getIdentifier().equals(user.getIdentifier()) &&\n               Role.NOBODY.getName().equals(roleName);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/security/LoginRedirectServlet.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.security;\n\nimport java.io.IOException;\nimport java.io.UnsupportedEncodingException;\nimport java.net.URLEncoder;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * \n * A workaround for the servlet form authentication process (j_security_check), which, at least on WildFly 8.1, uses the\n * HTTP POST method when forwarding the request after successful login. This blows up after login, giving an\n * <code>HTTP 405 Method Not Allowed</code> response when the desired resource is a static one, such as a GWT host page.\n * <p>\n * This servlet works around the issue by sending an HTTP redirect <i>only if the request comes from an authenticated\n * user</i> to a URL of your choice. The end result is that your user will see the real resource's URL in their\n * browser's location bar after login. In addition, this servlet copies all request parameters that were submitted along\n * with the login form (except j_username and j_password) to the redirect URL.\n * <p>\n * To set this servlet up, configure your web application as follows:\n * <ul>\n * <li>Declare this servlet in web.xml with init-param <code>display-after-login</code> set to the context-relative URI\n * of the page you want the user to land on after a successful login. (for example, <code>/host_page.html</code>)\n * <li>Map this servlet to a url-pattern that makes sense for a sign-in page, such as <code>/login</code>.\n * <li>Mark this servlet's url-pattern with a security-constraint that only allows logged-in users to see it. (I know,\n * this part is confusing! The login URL has to be a protected resource!)\n * <li>Configure web.xml for auth-method <code>FORM</code>\n * <li>Configure the form-login-page and form-error-page to any resource you like. It can even be JSP's under /WEB-INF,\n * since the login and error pages will never display under their \"own\" URLs. They always display in place of the \"real\"\n * resource that was being requested by an unauthorized user. In our case, that resource should always be whatever this\n * servlet is mapped to (eg. <code>/login</code>).\n * <li>(Optional) set welcome-page-uri to this servlet's uri-pattern, as an easy way to direct new visitors into this\n * tangled web of deceit.\n * </ul>\n * \n * === COPIED FROM UBERFIRE SERVLETS ===\n */\npublic class LoginRedirectServlet extends HttpServlet {\n\n    public static final String DISPLAY_AFTER_LOGIN_INIT_PARAM = \"display-after-login\";\n    public static final String DISPLAY_WHEN_NOT_AUTH_INIT_PARAM = \"display-when-not-authenticated\";\n    private static final Logger logger = LoggerFactory.getLogger(LoginRedirectServlet.class);\n    /**\n     * URI of the GWT host page, relative to the servlet container root (so it starts with '/' and includes the context\n     * path).\n     */\n    private String displayAfterLoginUri;\n    /**\n     * Optional URI of a page to redirect in case coming request is not authenticated (no user principal exists),\n     * relative to the servlet container root (so it starts with '/' and does not include context path)\n     */\n    private String displayWhenNotAuthenticatedUri;\n\n    @Override\n    public void init(ServletConfig config) throws ServletException {\n        String contextRelativeHostPageUri = config.getInitParameter(DISPLAY_AFTER_LOGIN_INIT_PARAM);\n        if (contextRelativeHostPageUri == null) {\n            throw new IllegalStateException(getClass().getSimpleName() + \" requires that you set the init parameter \\\"\" + DISPLAY_AFTER_LOGIN_INIT_PARAM + \"\\\" to the context-relative URI of the host page.\");\n        }\n        displayAfterLoginUri = config.getServletContext().getContextPath() + contextRelativeHostPageUri;\n\n        // optional display-when-not-authenticated\n        String contextRelativeNotAuthPageUri = config.getInitParameter(DISPLAY_WHEN_NOT_AUTH_INIT_PARAM);\n        if (contextRelativeNotAuthPageUri != null) {\n            displayWhenNotAuthenticatedUri = config.getServletContext().getContextPath() + contextRelativeNotAuthPageUri;\n        }\n    }\n\n    @Override\n    protected void doGet(HttpServletRequest req,\n                         HttpServletResponse resp) throws ServletException, IOException {\n        try {\n            handleRequest(req, resp);\n        } catch (Exception e) {\n            handleError(resp, e);\n        }\n    }\n\n    @Override\n    protected void doPost(HttpServletRequest req,\n                          HttpServletResponse resp) throws ServletException, IOException {\n        // perform optional check and redirect in case no authenticated request is available\n        try {\n            handleRequest(req, resp);\n        } catch (Exception e) {\n            handleError(resp, e);\n        }\n    }\n\n    private void handleError(HttpServletResponse resp, Exception e) throws IOException {\n        logger.error(\"Error during login redirect filter execution: {}\", e.getMessage());\n        logger.debug(\"Error during redirect\", e);\n        resp.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, \"Error handling request\");\n    }\n\n    private void handleRequest(HttpServletRequest req, HttpServletResponse resp) throws Exception {\n        if (displayWhenNotAuthenticatedUri != null && req.getUserPrincipal() == null) {\n            logger.debug(\"No authorized user thus cleaning up session and redirecting to {}\", displayWhenNotAuthenticatedUri);\n            try {\n                // clean up session\n                req.logout();\n                req.getSession().invalidate();\n            } catch (Exception e) {\n                // to avoid cases where logout causes issues for first request\n            }\n            resp.sendRedirect(displayWhenNotAuthenticatedUri);\n\n            return;\n        }\n\n        logger.debug(\"Redirecting {} to {}\", req.getUserPrincipal(), displayAfterLoginUri);\n        StringBuilder redirectTarget = new StringBuilder(displayAfterLoginUri);\n        String extraParams = extractParameters(req);\n        if (extraParams.length() > 0) {\n            redirectTarget.append(\"?\").append(extraParams);\n        }\n\n        resp.sendRedirect(redirectTarget.toString());\n    }\n    \n    /**\n     * Extracts all parameters except the username and password into a URL-encoded query string. The string does not begin\n     * or end with a \"&amp;\".\n     */\n    private static String extractParameters(HttpServletRequest fromRequest) {\n        try {\n            StringBuilder sb = new StringBuilder();\n            for (Map.Entry<String, String[]> param : (Set<Map.Entry<String, String[]>>) fromRequest.getParameterMap().entrySet()) {\n                String paramName = URLEncoder.encode(param.getKey(),\n                                                     \"UTF-8\");\n                if (paramName.equals(\"j_username\") || paramName.equals(\"j_password\")) {\n                    continue;\n                }\n                for (String value : param.getValue()) {\n                    if (sb.length() != 0) {\n                        sb.append(\"&\");\n                    }\n                    sb.append(paramName).append(\"=\").append(URLEncoder.encode(value,\n                                                                              \"UTF-8\"));\n                }\n            }\n            return sb.toString();\n        } catch (UnsupportedEncodingException e) {\n            throw new AssertionError(\"UTF-8 not supported on this JVM?\");\n        }\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/RuntimeInfoService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services;\n\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.DashboardInfo;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeInfo;\n\n/**\n * Provides information about the running server.\n *\n */\npublic interface RuntimeInfoService {\n\n    /**\n     * Access Server information.\n     */\n    DashbuilderRuntimeInfo info();\n\n    /**\n     * Information about a specific runtime model. Used in MULTI mode.\n     * \n     * @param modelId\n     * The model ID.\n     * @return\n     * The dashboard information for the given runtime model id or empty if no dashboard is found.\n     */\n    Optional<DashboardInfo> dashboardInfo(String modelId);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/dataset/DataSetServicesProducer.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.dataset;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.backend.services.dataset.provider.RuntimeDataSetProviderRegistry;\nimport org.dashbuilder.backend.services.dataset.provider.RuntimeSQLDataSourceLocator;\nimport org.dashbuilder.dataprovider.StaticDataSetProvider;\nimport org.dashbuilder.dataprovider.csv.CSVDataSetProvider;\nimport org.dashbuilder.dataprovider.csv.CSVFileStorage;\nimport org.dashbuilder.dataprovider.kafka.KafkaDataSetProvider;\nimport org.dashbuilder.dataprovider.prometheus.PrometheusDataSetProvider;\nimport org.dashbuilder.dataprovider.sql.SQLDataSetProvider;\nimport org.dashbuilder.dataset.DataSetDefRegistryImpl;\nimport org.dashbuilder.dataset.DataSetManager;\nimport org.dashbuilder.dataset.DataSetManagerImpl;\nimport org.dashbuilder.dataset.def.DataSetDefRegistry;\nimport org.dashbuilder.scheduler.Scheduler;\n\n/**\n * Produces types related to DataSet\n *\n */\npublic class DataSetServicesProducer {\n\n    @Produces\n    @ApplicationScoped\n    public CSVDataSetProvider produceCSVProvider(StaticDataSetProvider staticDataSetProvider,\n                                                 CSVFileStorage csvStorage) {\n        return new CSVDataSetProvider(staticDataSetProvider, csvStorage);\n    }\n\n    @Produces\n    @ApplicationScoped\n    public StaticDataSetProvider produceStaticDataSetProviderCDI() {\n        return new StaticDataSetProvider(DataSetCore.get().getSharedDataSetOpEngine());\n    }\n\n    @Produces\n    @ApplicationScoped\n    public SQLDataSetProvider produceSQLDataSetProvider(StaticDataSetProvider staticDataSetProvider,\n                                                        RuntimeSQLDataSourceLocator sqlDataSourceLocator) {\n\n        SQLDataSetProvider provider = new SQLDataSetProvider(staticDataSetProvider,\n                                                             DataSetCore.get().getIntervalBuilderLocator(),\n                                                             DataSetCore.get().getIntervalBuilderDynamicDate(),\n                                                             DataSetCore.get().getSharedDataSetOpEngine());\n\n        provider.setDataSourceLocator(sqlDataSourceLocator);\n        return provider;\n    }\n\n    @Produces\n    @ApplicationScoped\n    public PrometheusDataSetProvider producePrometheusProvider(StaticDataSetProvider staticDataSetProvider) {\n        return new PrometheusDataSetProvider(staticDataSetProvider);\n    }\n    \n    @Produces\n    @ApplicationScoped\n    public KafkaDataSetProvider produceKafkaProvider(StaticDataSetProvider staticDataSetProvider) {\n        return new KafkaDataSetProvider(staticDataSetProvider);\n    }\n\n    @Produces\n    @ApplicationScoped\n    public DataSetDefRegistry produceDataSetDefRegistry(RuntimeDataSetProviderRegistry providerRegistry) {\n        Scheduler scheduler = new Scheduler();\n        scheduler.init(10);\n        return new DataSetDefRegistryImpl(providerRegistry, scheduler);\n    }\n\n    @Produces\n    @ApplicationScoped\n    public DataSetManager produceDataSetManager(StaticDataSetProvider staticDataSetProvider,\n                                                DataSetDefRegistry dataSetDefRegistry,\n                                                RuntimeDataSetProviderRegistry dataSetProviderRegistry) {\n        return new DataSetManagerImpl(dataSetDefRegistry,\n                                      dataSetProviderRegistry,\n                                      staticDataSetProvider,\n                                      true,\n                                      1024);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/dataset/RuntimeCSVFileStorage.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.dataset;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.dataprovider.csv.CSVFileStorage;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\n\n/**\n * In Memory CSV storage.\n *\n */\n@ApplicationScoped\npublic class RuntimeCSVFileStorage implements CSVFileStorage {\n\n    Map<String, String> csvStorage;\n\n    public RuntimeCSVFileStorage() {\n        // not used\n    }\n\n    @PostConstruct\n    public void init() {\n        csvStorage = new HashMap<>();\n    }\n\n    @Override\n    public InputStream getCSVInputStream(CSVDataSetDef def) {\n        String csvStr = getCSVString(def);\n        return new ByteArrayInputStream(csvStr.getBytes());\n    }\n\n    @Override\n    public String getCSVString(CSVDataSetDef def) {\n        return csvStorage.getOrDefault(def.getUUID(), \"\");\n    }\n\n    public void storeCSV(String uuid, String csvContent) {\n        csvStorage.put(uuid, csvContent);\n    }\n\n    @Override\n    public void saveCSVFile(CSVDataSetDef def) {\n        // not going to save\n\n    }\n\n    @Override\n    public void deleteCSVFile(CSVDataSetDef def) {\n        csvStorage.remove(def.getUUID());\n    }\n    \n    public void deleteCSVFile(String uuid) {\n        csvStorage.remove(uuid);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/dataset/provider/RuntimeBeanDataSetProvider.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.services.dataset.provider;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.dataprovider.BeanDataSetProvider;\nimport org.dashbuilder.dataprovider.StaticDataSetProvider;\nimport org.dashbuilder.dataset.DataSetGenerator;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n@ApplicationScoped\npublic class RuntimeBeanDataSetProvider extends BeanDataSetProvider {\n\n    protected BeanManager beanManager;\n    protected Map<String, DataSetGenerator> generatorMap = new HashMap<>();\n    \n    public RuntimeBeanDataSetProvider() {\n        super();\n    }\n\n    @Inject\n    public RuntimeBeanDataSetProvider(StaticDataSetProvider staticDataSetProvider,\n                                      BeanManager beanManager) {\n\n        super(staticDataSetProvider);\n        this.beanManager = beanManager;\n    }\n\n    @PostConstruct\n    protected void init() {\n        Set<Bean<?>> beans = beanManager.getBeans(DataSetGenerator.class);\n        for (Bean<?> bean : beans) {\n            CreationalContext<?> ctx = beanManager.createCreationalContext(bean);\n            DataSetGenerator generator = (DataSetGenerator) beanManager.getReference(bean, DataSetGenerator.class, ctx);\n            generatorMap.put(bean.getBeanClass().getName(), generator);\n        }\n    }\n\n    @Override\n    public DataSetGenerator lookupGenerator(DataSetDef def) {\n        if (def instanceof BeanDataSetDef) {\n            return loadDataSetGenerator((BeanDataSetDef) def);\n        }\n\n        throw new IllegalArgumentException(\"Not a BeanDataSetDef instance\");\n\n    }\n\n    private DataSetGenerator loadDataSetGenerator(BeanDataSetDef beanDef) {\n        String beanName = beanDef.getGeneratorClass();\n        DataSetGenerator generator = generatorMap.get(beanName);\n        if (generator != null) {\n            return generator;\n        } else {\n            throw new IllegalArgumentException(\"Data set generator class not found: \" + beanName);\n        }\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/dataset/provider/RuntimeDataSetProviderRegistry.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.services.dataset.provider;\n\nimport java.util.Iterator;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.DataSetCore;\nimport org.dashbuilder.dataprovider.DataSetProvider;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistryImpl;\nimport org.dashbuilder.dataprovider.StaticDataSetProvider;\nimport org.dashbuilder.dataprovider.csv.CSVDataSetProvider;\nimport org.dashbuilder.dataprovider.sql.SQLDataSetProvider;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\n\n@ApplicationScoped\npublic class RuntimeDataSetProviderRegistry extends DataSetProviderRegistryImpl {\n\n    @Inject\n    private StaticDataSetProvider staticDataSetProvider;\n\n    @Inject\n    private RuntimeBeanDataSetProvider beanDataSetProvider;\n\n    @Inject\n    private CSVDataSetProvider csvDataSetProvider;\n\n    @Inject\n    private SQLDataSetProvider sqlDataSetProvider;\n\n    @Inject\n    private Instance<DataSetProvider> providerSet;\n\n    protected DataSetDefJSONMarshaller dataSetDefJSONMarshaller = new DataSetDefJSONMarshaller(this);\n\n    @PostConstruct\n    public void init() {\n        DataSetCore.get().setDataSetDefJSONMarshaller(dataSetDefJSONMarshaller);\n\n        // Register all the providers available in classpath\n        Iterator<DataSetProvider> it = providerSet.iterator();\n        while (it.hasNext()) {\n            DataSetProvider provider = it.next();\n            super.registerDataProvider(provider);\n        }\n\n        // Register the core providers\n        super.registerDataProvider(staticDataSetProvider);\n        super.registerDataProvider(beanDataSetProvider);\n        super.registerDataProvider(csvDataSetProvider);\n        super.registerDataProvider(sqlDataSetProvider);\n    }\n\n    public StaticDataSetProvider getStaticDataSetProvider() {\n        return staticDataSetProvider;\n    }\n\n    public RuntimeBeanDataSetProvider getBeanDataSetProvider() {\n        return beanDataSetProvider;\n    }\n\n    public CSVDataSetProvider getCsvDataSetProvider() {\n        return csvDataSetProvider;\n    }\n\n    public SQLDataSetProvider getSqlDataSetProvider() {\n        return sqlDataSetProvider;\n    }\n\n    public DataSetDefJSONMarshaller getDataSetDefJSONMarshaller() {\n        return dataSetDefJSONMarshaller;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/dataset/provider/RuntimeSQLDataSourceLocator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.services.dataset.provider;\n\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.naming.InitialContext;\nimport javax.sql.DataSource;\n\nimport org.dashbuilder.dataprovider.sql.JDBCUtils;\nimport org.dashbuilder.dataprovider.sql.SQLDataSourceLocator;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\n\n@ApplicationScoped\npublic class RuntimeSQLDataSourceLocator implements SQLDataSourceLocator {\n\n    @Override\n    public DataSource lookup(SQLDataSetDef def) throws Exception {\n        return InitialContext.doLookup(def.getDataSource());\n    }\n\n    @Override\n    public List<SQLDataSourceDef> list() {\n        return JDBCUtils.listDatasourceDefs();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/impl/ExternalImportServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.BufferedInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.dashbuilder.shared.services.ExternalImportService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class ExternalImportServiceImpl implements ExternalImportService {\n\n    private static final String ERROR_PARSING_URL = \"Error parsing URL: {}\";\n\n    Logger logger = LoggerFactory.getLogger(ExternalImportServiceImpl.class);\n\n    @Inject\n    RuntimeOptions runtimeOptions;\n\n    @Inject\n    RuntimeModelRegistry runtimeModelRegistry;\n\n    @Override\n    public Optional<RuntimeModel> registerExternalImport(String externalModelUrl) {\n        String modelId = \"\";\n        URL url = getExternalModelUrl(externalModelUrl);\n        modelId = buildURLIdentifier(url);\n\n        final String filePath = runtimeOptions.buildFilePath(modelId);\n        int totalBytes = 0;\n        final int pageSize = 1024;\n        try (BufferedInputStream in = new BufferedInputStream(url.openStream());\n                FileOutputStream fos = new FileOutputStream(filePath)) {\n            byte[] dataBuffer = new byte[pageSize];\n            int bytesRead;\n            while ((bytesRead = in.read(dataBuffer, 0, pageSize)) != -1) {\n                fos.write(dataBuffer, 0, bytesRead);\n                totalBytes += pageSize;\n                checkSize(filePath, totalBytes);\n            }\n        } catch (IOException e) {\n            logger.debug(\"Error downloading and parsing content from URL {}\", externalModelUrl, e);\n            logger.warn(\"Error downloading and parsing content from URL {}\", externalModelUrl);\n            deleteFile(filePath);\n            throw new IllegalArgumentException(\"Not able to download file\", e);\n        }\n        return runtimeModelRegistry.registerFile(filePath);\n    }\n\n    private void checkSize(final String filePath, int totalBytes) {\n        if (totalBytes > runtimeOptions.getUploadSize()) {\n            deleteFile(filePath);\n            logger.error(\"Size file is bigger than max upload size {}\", runtimeOptions.getUploadSize());\n            throw new IllegalArgumentException(\"External file size is too big.\");\n        }\n    }\n\n    private String buildURLIdentifier(URL url) {\n        try {\n            return Math.abs(url.toURI().hashCode()) + \"\";\n        } catch (URISyntaxException e) {\n            logger.debug(ERROR_PARSING_URL, url.toExternalForm(), e);\n            logger.warn(ERROR_PARSING_URL, url.toExternalForm());\n            throw new IllegalArgumentException(\"Not a valid URL: \" + url.toExternalForm(), e);\n        }\n    }\n\n    private URL getExternalModelUrl(String externalModelUrl) {\n        try {\n            return new URL(externalModelUrl);\n        } catch (Exception e) {\n            logger.debug(ERROR_PARSING_URL, externalModelUrl, e);\n            logger.error(ERROR_PARSING_URL, externalModelUrl);\n            throw new IllegalArgumentException(\"Not a valid URL: \" + externalModelUrl, e);\n        }\n    }\n\n    private void deleteFile(final String filePath) {\n        try {\n            Files.deleteIfExists(Paths.get(filePath));\n        } catch (IOException e) {\n            logger.error(\"Error deleting bad model file: {}\", filePath, e);\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/impl/ImportValidationServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.FileInputStream;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.shared.service.ImportValidationService;\n\nimport static org.dashbuilder.shared.model.ImportDefinitions.DATASET_PREFIX;\nimport static org.dashbuilder.shared.model.ImportDefinitions.NAVIGATION_PREFIX;\nimport static org.dashbuilder.shared.model.ImportDefinitions.PERSPECTIVE_PREFIX;\n\n/**\n * Simple Validation Service Implementation that checks if the ZIPs contains the necessary structure.\n *\n */\n@ApplicationScoped\npublic class ImportValidationServiceImpl implements ImportValidationService {\n\n    /**\n     * Checks if the given file URL is valid for a Runtime Model.\n     */\n    @Override\n    public boolean validate(final String file) {\n        boolean hasDatasetDir = false;\n        boolean hasPage = false;\n        boolean hasNavigation = false;\n        try (final ZipInputStream zis = new ZipInputStream(new FileInputStream(file))) {\n            ZipEntry entry;\n            while ((entry = zis.getNextEntry()) != null) {\n\n                hasDatasetDir = hasDatasetDir || entryStartsWith(entry, DATASET_PREFIX);\n                hasPage = hasPage || entryStartsWith(entry, PERSPECTIVE_PREFIX);\n                hasNavigation = hasNavigation || entryStartsWith(entry, NAVIGATION_PREFIX);\n\n                if (hasNavigation && hasDatasetDir && hasPage) {\n                    return true;\n                }\n            }\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\"Error validating file: \" + file, e);\n        }\n\n        return false;\n    }\n\n    private boolean entryStartsWith(ZipEntry entry, String path) {\n        return entry.getName().startsWith(path);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/impl/RuntimeInfoServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.backend.services.RuntimeInfoService;\nimport org.dashbuilder.shared.model.DashboardInfo;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeInfo;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static java.util.stream.Collectors.toList;\n\n@ApplicationScoped\npublic class RuntimeInfoServiceImpl implements RuntimeInfoService {\n\n    @Inject\n    RuntimeModelRegistry registry;\n\n    @Override\n    public DashbuilderRuntimeInfo info() {\n        return new DashbuilderRuntimeInfo(registry.getMode().name(),\n                                          registry.availableModels(),\n                                          registry.acceptingNewImports());\n    }\n\n    @Override\n    public Optional<DashboardInfo> dashboardInfo(String modelId) {\n        return registry.get(modelId)\n                       .map(model -> new DashboardInfo(modelId, perspectives(model)));\n    }\n\n    private List<String> perspectives(RuntimeModel runtimeModel) {\n        return runtimeModel.getLayoutTemplates().stream()\n                           .map(LayoutTemplate::getName)\n                           .collect(toList());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/impl/RuntimeModelParserImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Stream;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.backend.helper.PartitionHelper;\nimport org.dashbuilder.backend.navigation.RuntimeNavigationBuilder;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.shared.event.NewDataSetContentEvent;\nimport org.dashbuilder.shared.model.DataSetContent;\nimport org.dashbuilder.shared.model.DataSetContentType;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelParser;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_PARTITION_KEY;\nimport static org.dashbuilder.shared.model.ImportDefinitions.DATASET_DEF_PREFIX;\nimport static org.dashbuilder.shared.model.ImportDefinitions.NAVIGATION_FILE;\nimport static org.dashbuilder.shared.model.ImportDefinitions.PERSPECTIVE_SUFFIX;\nimport static org.dashbuilder.transfer.DataTransferServices.COMPONENTS_EXPORT_PATH;\n\n/**\n * Parses an exported zip file from Transfer Services into RuntimeModel.\n *\n */\n@ApplicationScoped\npublic class RuntimeModelParserImpl implements RuntimeModelParser {\n\n    @Inject\n    Event<NewDataSetContentEvent> newDataSetContentEvent;\n\n    @Inject\n    RuntimeNavigationBuilder runtimeNavigationBuilder;\n\n    @Inject\n    RuntimeOptions options;\n\n    @Inject\n    RuntimeModelRegistry registry;\n\n    @Inject\n    ComponentLoader externalComponentLoader;\n\n    Gson gson;\n\n    private DisplayerSettingsJSONMarshaller displayerSettingsMarshaller;\n\n    @PostConstruct\n    void init() {\n        gson = new GsonBuilder().create();\n        displayerSettingsMarshaller = DisplayerSettingsJSONMarshaller.get();\n    }\n\n    @Override\n    public RuntimeModel parse(String modelId, InputStream is) {\n        try {\n            return retrieveRuntimeModel(modelId, is);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    RuntimeModel retrieveRuntimeModel(String modelId, InputStream is) throws IOException {\n        List<DataSetContent> datasetContents = new ArrayList<>();\n        List<LayoutTemplate> layoutTemplates = new ArrayList<>();\n        Optional<String> navTreeOp = Optional.empty();\n        try (ZipInputStream zis = new ZipInputStream(is)) {\n            ZipEntry entry;\n            while ((entry = zis.getNextEntry()) != null) {\n                if (entry.isDirectory()) {\n                    continue;\n                }\n                String entryName = entry.getName();\n\n                if (entryName.startsWith(DATASET_DEF_PREFIX)) {\n                    datasetContents.add(retrieveDataSetContent(entry, zis));\n                }\n\n                if (entryName.endsWith(PERSPECTIVE_SUFFIX)) {\n                    layoutTemplates.add(retrieveLayoutTemplate(zis));\n                }\n\n                if (entryName.equalsIgnoreCase(NAVIGATION_FILE)) {\n                    navTreeOp = Optional.of(nextEntryContentAsString(zis));\n                }\n\n                if (entryName.startsWith(COMPONENTS_EXPORT_PATH)) {\n                    extractComponentFile(modelId, zis, entry.getName());\n                }\n            }\n        }\n\n        if (options.isMultipleImport()) {\n            if (options.isDatasetPartition()) {\n                datasetContents.forEach(ds -> ds.setId(PartitionHelper.partition(modelId, ds.getId())));\n            }\n            layoutTemplates.forEach(lt -> partitionLayoutTemplate(modelId, lt));\n        }\n\n        if (!datasetContents.isEmpty()) {\n            newDataSetContentEvent.fire(new NewDataSetContentEvent(modelId, datasetContents));\n        }\n        NavTree navTree = runtimeNavigationBuilder.build(navTreeOp, layoutTemplates);\n\n        return new RuntimeModel(navTree, layoutTemplates, System.currentTimeMillis());\n    }\n\n    void extractComponentFile(String modelId, InputStream zis, String name) throws IOException {\n        String externalComponentsDir = externalComponentLoader.getExternalComponentsDir();\n        if (externalComponentsDir != null) {\n            externalComponentsDir = externalComponentsDir.endsWith(File.separator) ? externalComponentsDir : externalComponentsDir + File.separator;\n            String newFileName = null;\n            if (options.isComponentPartition() && options.isMultipleImport()) {\n                newFileName = externalComponentsDir + modelId + File.separator + name.replaceAll(COMPONENTS_EXPORT_PATH, \"\");\n            } else {\n                newFileName = externalComponentsDir + name.replaceAll(COMPONENTS_EXPORT_PATH, \"\");\n            }\n            File target = new File(newFileName);\n            target.getParentFile().mkdirs();\n\n            final int BUFFER_SIZE = 1024;\n            byte[] buffer = new byte[BUFFER_SIZE];\n            int read = 0;\n            try (FileOutputStream fos = new FileOutputStream(target)) {\n                while ((read = zis.read(buffer, 0, BUFFER_SIZE)) >= 0) {\n                    fos.write(buffer, 0, read);\n                }\n            }\n        }\n\n    }\n\n    private LayoutTemplate retrieveLayoutTemplate(final ZipInputStream zis) {\n        String content = nextEntryContentAsString(zis);\n        return gson.fromJson(content, LayoutTemplate.class);\n    }\n\n    private DataSetContent retrieveDataSetContent(final ZipEntry entry, final ZipInputStream zis) {\n        String fileName = entry.getName().split(\"/\")[3];\n        String[] nameParts = fileName.split(\"\\\\.\");\n        String id = nameParts[0];\n        String ext = nameParts[1];\n        String content = nextEntryContentAsString(zis);\n        return new DataSetContent(id, content, DataSetContentType.fromFileExtension(ext));\n    }\n\n    private String nextEntryContentAsString(final ZipInputStream zis) {\n        try {\n            final int BUFFER_SIZE = 8192;\n            byte[] buffer = new byte[BUFFER_SIZE];\n            int read = 0;\n            String output = \"\";\n            while ((read = zis.read(buffer, 0, BUFFER_SIZE)) != -1) {\n                output = output.concat(new String(buffer, 0, read));\n            }\n            return output.trim();\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private void partitionLayoutTemplate(String modelId, LayoutTemplate lt) {\n        allComponentsStream(lt.getRows()).forEach(lc -> {\n            String json = lc.getProperties().get(\"json\");\n            String componentId = lc.getProperties().get(COMPONENT_ID_KEY);\n            if (json != null) {\n                partitionDisplayer(lc, modelId, json);\n            }\n            // For components that does not use displayers (noData components)\n            if (options.isComponentPartition() && isExternalComponent(componentId)) {\n                lc.getProperties().put(COMPONENT_PARTITION_KEY, modelId);\n            }\n        });\n\n    }\n\n    private void partitionDisplayer(LayoutComponent lc, String modelId, String json) {\n        DisplayerSettings settings = displayerSettingsMarshaller.fromJsonString(json);\n        String componentId = settings.getComponentId();\n\n        if (options.isDatasetPartition() &&\n            settings.getDataSetLookup() != null) {\n            DataSetLookup dataSetLookup = settings.getDataSetLookup();\n            String newId = PartitionHelper.partition(modelId, dataSetLookup.getDataSetUUID());\n            settings.getDataSetLookup().setDataSetUUID(newId);\n        }\n\n        if (options.isComponentPartition() &&\n            settings.getType() == DisplayerType.EXTERNAL_COMPONENT &&\n            isExternalComponent(componentId)) {\n            settings.setComponentPartition(modelId);\n        }\n\n        lc.getProperties().put(\"json\", displayerSettingsMarshaller.toJsonString(settings));\n    }\n\n    private Stream<LayoutComponent> allComponentsStream(List<LayoutRow> row) {\n        return row.stream()\n                  .flatMap(r -> r.getLayoutColumns().stream())\n                  .flatMap(cl -> Stream.concat(cl.getLayoutComponents().stream(),\n                                               allComponentsStream(cl.getRows())));\n    }\n\n    private boolean isExternalComponent(String componentId) {\n        return externalComponentLoader.loadProvided().stream().noneMatch(c -> c.getId().equals(componentId));\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/backend/services/impl/RuntimeModelRegistryImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.UUID;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.FileUtils;\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.shared.event.NewDataSetContentEvent;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.event.UpdatedRuntimeModelEvent;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.ImportValidationService;\nimport org.dashbuilder.shared.service.RuntimeModelParser;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.apache.commons.io.FilenameUtils;\n\n@ApplicationScoped\npublic class RuntimeModelRegistryImpl implements RuntimeModelRegistry {\n\n    Logger logger = LoggerFactory.getLogger(RuntimeModelRegistryImpl.class);\n\n    Map<String, RuntimeModel> runtimeModels;\n\n    DashbuilderRuntimeMode mode = DashbuilderRuntimeMode.SINGLE_IMPORT;\n\n    @Inject\n    RuntimeModelParser parser;\n\n    @Inject\n    Event<NewDataSetContentEvent> newDataSetContentEvent;\n\n    @Inject\n    ImportValidationService importValidationService;\n\n    @Inject\n    Event<UpdatedRuntimeModelEvent> runtimeModelUpdatedEvent;\n\n    @Inject\n    Event<RemovedRuntimeModelEvent> removedRuntimeModelEvent;\n\n    @Inject\n    RuntimeOptions options;\n\n    @PostConstruct\n    public void init() {\n        runtimeModels = new HashMap<>();\n    }\n\n    @Override\n    public Optional<RuntimeModel> single() {\n        return runtimeModels.values().stream().findFirst();\n    }\n\n    @Override\n    public Optional<RuntimeModel> get(String id) {\n        if (mode == DashbuilderRuntimeMode.MULTIPLE_IMPORT) {\n            return Optional.ofNullable(runtimeModels.get(id));\n        }\n        return single();\n    }\n\n    @Override\n    public Optional<RuntimeModel> registerFile(String fileName) {\n        // it could be possible to NOT STORE models\n        if (fileName == null || fileName.trim().isEmpty()) {\n            logger.error(\"Invalid file name: {}\", fileName);\n            throw new IllegalArgumentException(\"Invalid file name.\");\n        }\n\n        File file = new File(fileName);\n        if (!file.exists()) {\n            logger.error(\"File does not exist: {}\", fileName);\n            throw new IllegalArgumentException(\"File does not exist\");\n        }\n\n        if (!importValidationService.validate(fileName)) {\n            logger.error(\"File does not have a valid structure: {}\", fileName);\n            throw new IllegalArgumentException(\"Not a valid file structure.\");\n        }\n\n        try (FileInputStream fis = new FileInputStream(fileName)) {\n            String importId = FilenameUtils.getBaseName(file.getPath());\n            return register(importId, fis);\n        } catch (IOException e) {\n            logger.error(\"Not able to load file {}\", fileName, e);\n            throw new IllegalArgumentException(\"Error loading import file: \" + fileName, e);\n        }\n    }\n\n    @Override\n    public void setMode(DashbuilderRuntimeMode mode) {\n        this.mode = mode;\n    }\n\n    @Override\n    public boolean isEmpty() {\n        return runtimeModels.isEmpty();\n    }\n\n    @Override\n    public DashbuilderRuntimeMode getMode() {\n        return mode;\n    }\n\n    @Override\n    public void remove(String modelId) {\n        internalRemove(modelId, true);\n    }\n\n    public Optional<RuntimeModel> register(String id, InputStream fileStream) {\n        if (!acceptingNewImports()) {\n            throw new IllegalArgumentException(\"New imports are not allowed in mode \" + mode);\n        }\n        try {\n            if (id == null) {\n                id = UUID.randomUUID().toString();\n            }\n            RuntimeModel runtimeModel = parser.parse(id, fileStream);\n            runtimeModels.put(id, runtimeModel);\n\n            if (options.isDevMode()) {\n                runtimeModelUpdatedEvent.fire(new UpdatedRuntimeModelEvent(id));\n            }\n\n            return Optional.of(runtimeModel);\n        } catch (Exception e) {\n            throw new IllegalArgumentException(\"Error parsing import model.\", e);\n        }\n    }\n\n    @Override\n    public Collection<String> availableModels() {\n        return Collections.unmodifiableCollection(runtimeModels.keySet());\n    }\n\n    @Override\n    public void clear() {\n        availableModels().forEach(this::remove);\n        runtimeModels.clear();\n    }\n\n    @Override\n    public void unregister(String id) {\n        internalRemove(id, false);\n    }\n\n    public void internalRemove(String modelId, boolean deleteFile) {\n        if (runtimeModels.remove(modelId) != null) {\n            removedRuntimeModelEvent.fire(new RemovedRuntimeModelEvent(modelId));\n            if (options.isRemoveModelFile() && deleteFile) {\n                removeModelFile(modelId);\n            }\n        }\n    }\n\n    private void removeModelFile(String modelId) {\n        String modelPath = options.buildFilePath(modelId);\n        FileUtils.deleteQuietly(new File(modelPath));\n    }\n\n    void setRemovedRuntimeModelEvent(Event<RemovedRuntimeModelEvent> removedRuntimeModelEvent) {\n        this.removedRuntimeModelEvent = removedRuntimeModelEvent;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/RuntimeClientLoader.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.perspective.generator.RuntimePerspectiveGenerator;\nimport org.dashbuilder.client.plugins.RuntimePerspectivePluginManager;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.model.RuntimeServiceResponse;\nimport org.dashbuilder.shared.service.RuntimeModelService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mvp.Command;\n\n@ApplicationScoped\npublic class RuntimeClientLoader {\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    public static final String IMPORT_ID_PARAM = \"import\";\n\n    private Caller<RuntimeModelService> runtimeModelServiceCaller;\n\n    RuntimePerspectiveGenerator perspectiveEditorGenerator;\n\n    RuntimePerspectivePluginManager runtimePerspectivePluginManager;\n\n    NavigationManager navigationManager;\n\n    BusyIndicatorView loading;\n\n    public RuntimeClientLoader() {\n        // do nothing\n    }\n\n    @Inject\n    public RuntimeClientLoader(Caller<RuntimeModelService> runtimeModelServiceCaller,\n                               RuntimePerspectiveGenerator perspectiveEditorGenerator,\n                               RuntimePerspectivePluginManager runtimePerspectivePluginManager,\n                               NavigationManager navigationManager,\n                               BusyIndicatorView loading) {\n        this.runtimeModelServiceCaller = runtimeModelServiceCaller;\n        this.perspectiveEditorGenerator = perspectiveEditorGenerator;\n        this.runtimePerspectivePluginManager = runtimePerspectivePluginManager;\n        this.navigationManager = navigationManager;\n        this.loading = loading;\n    }\n\n    public void load(Consumer<RuntimeServiceResponse> responseConsumer,\n                     BiConsumer<Object, Throwable> error) {\n        String importID = getImportId();\n        loading.showBusyIndicator(i18n.loadingDashboards());\n        runtimeModelServiceCaller.call((RuntimeServiceResponse response) -> {\n            loading.hideBusyIndicator();\n            response.getRuntimeModelOp().ifPresent(this::registerModel);\n            responseConsumer.accept(response);\n        }, (msg, t) -> handleError(error, msg, t))\n                                 .info(importID);\n\n    }\n\n    public void loadModel(Consumer<RuntimeModel> modelLoaded,\n                          Command emptyModel,\n                          BiConsumer<Object, Throwable> error) {\n        String importID = getImportId();\n        loadModel(importID, modelLoaded, emptyModel, error);\n\n    }\n\n    public void loadModel(String importId,\n                          Consumer<RuntimeModel> modelLoaded,\n                          Command emptyModel,\n                          BiConsumer<Object, Throwable> error) {\n        loading.showBusyIndicator(i18n.loadingDashboards());\n        runtimeModelServiceCaller.call((Optional<RuntimeModel> runtimeModelOp) -> handleResponse(modelLoaded, emptyModel, runtimeModelOp),\n                                       (msg, t) -> handleError(error, msg, t))\n                                 .getRuntimeModel(importId);\n\n    }\n\n    private boolean handleError(BiConsumer<Object, Throwable> error, Object message, Throwable throwable) {\n        loading.hideBusyIndicator();\n        error.accept(message, throwable);\n        return false;\n    }\n\n    private void handleResponse(Consumer<RuntimeModel> modelLoaded, Command emptyModel, Optional<RuntimeModel> runtimeModelOp) {\n        loading.hideBusyIndicator();\n        if (runtimeModelOp.isPresent()) {\n            RuntimeModel runtimeModel = runtimeModelOp.get();\n            registerModel(runtimeModel);\n            modelLoaded.accept(runtimeModel);\n        } else {\n            emptyModel.execute();\n        }\n    }\n\n    private void registerModel(RuntimeModel runtimeModel) {\n        runtimeModel.getLayoutTemplates().forEach(perspectiveEditorGenerator::generatePerspective);\n        runtimePerspectivePluginManager.setTemplates(runtimeModel.getLayoutTemplates());\n        navigationManager.setDefaultNavTree(runtimeModel.getNavTree());\n    }\n\n    public String getImportId() {\n        return Window.Location.getParameter(IMPORT_ID_PARAM);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/RuntimeCommunication.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport elemental2.dom.DomGlobal;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n/**\n * Utility methods to perform user communication\n *\n */\n@ApplicationScoped\npublic class RuntimeCommunication {\n\n    @Inject\n    Event<NotificationEvent> wbNotification;\n\n    public void showError(final String message, final Object details) {\n        DomGlobal.console.log(details);\n        wbNotification.fire(new NotificationEvent(message, NotificationEvent.NotificationType.ERROR));\n    }\n\n    public void showWarning(final String message) {\n        wbNotification.fire(new NotificationEvent(message, NotificationEvent.NotificationType.WARNING));\n    }\n\n    public void showSuccess(final String message) {\n        wbNotification.fire(new NotificationEvent(message, NotificationEvent.NotificationType.SUCCESS));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/RuntimeEntryPoint.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.Window;\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.Element;\nimport org.dashbuilder.client.error.DefaultRuntimeErrorCallback;\nimport org.dashbuilder.client.perspective.NotFoundPerspective;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.api.UncaughtExceptionHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\n\n@EntryPoint\n@ApplicationScoped\n@Bundle(\"resources/i18n/AppConstants.properties\")\npublic class RuntimeEntryPoint {\n\n    public static final String DASHBOARD_PARAM = \"dashboard\";\n\n    public static final String PERSPECTIVE_PARAM = \"perspective\";\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    Workbench workbench;\n\n    @Inject\n    RuntimeClientLoader modelLoader;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    RuntimeCommunication runtimeCommunication;\n\n    @Inject\n    DefaultRuntimeErrorCallback defaultRuntimeErrorCallback;\n\n    private String dashboard;\n\n    @PostConstruct\n    public void startup() {\n        workbench.addStartupBlocker(RuntimeEntryPoint.class);\n\n        Map<String, List<String>> params = Window.Location.getParameterMap();\n        boolean isStandalone = params.containsKey(\"standalone\");\n        List<String> dashboardParams = params.get(DASHBOARD_PARAM);\n\n        if (!foundDashboard(dashboardParams)) {\n            dashboardParams = params.get(PERSPECTIVE_PARAM);\n        }\n\n        if (isStandalone && foundDashboard(dashboardParams)) {\n            dashboard = dashboardParams.get(0);\n            modelLoader.loadModel(this::foundRuntimeModel,\n                                  this::notFound,\n                                  this::error);\n        } else {\n            this.hideLoading();\n        }\n    }\n\n    private void foundRuntimeModel(RuntimeModel runtimeModel) {\n        boolean perspectiveNotFound = runtimeModel.getLayoutTemplates().stream()\n                                                  .noneMatch(lt -> lt.getName().equals(dashboard));\n        if (perspectiveNotFound) {\n            notFound();\n        } else {\n            targetPerspective();\n        }\n    }\n\n    public void notFound() {\n        String newUrl = GWT.getHostPageBaseURL() + \"?standalone&\" +\n                        PERSPECTIVE_PARAM + \"=\" + NotFoundPerspective.ID + \"&\" +\n                        DASHBOARD_PARAM + \"=\" + dashboard;\n        DomGlobal.window.history.pushState(null,\n                                           \"Dashbuilder Runtime | Not Found\",\n                                           newUrl);\n        this.hideLoading();\n\n    }\n\n    public void targetPerspective() {\n        String newUrl = Window.Location.createUrlBuilder()\n                                       .setParameter(PERSPECTIVE_PARAM, dashboard)\n                                       .buildString();\n        DomGlobal.window.history.pushState(null,\n                                           \"Dashbuilder Runtime\",\n                                           newUrl);\n        this.hideLoading();\n    }\n\n    public void error(Object e, Throwable t) {\n        runtimeCommunication.showError(i18n.errorLoadingDashboards(), t);\n        this.hideLoading();\n    }\n\n    @UncaughtExceptionHandler\n    public void generalErrorHandling(final Throwable t) {\n        defaultRuntimeErrorCallback.error(t);\n    }\n    \n\n    private void hideLoading() {\n        workbench.removeStartupBlocker(RuntimeEntryPoint.class);\n        Element loading = DomGlobal.document.getElementById(\"loading\");\n        if (loading != null) {\n            loading.remove();\n        }\n    }\n\n    private boolean foundDashboard(List<String> dashboardParams) {\n        return dashboardParams != null && !dashboardParams.isEmpty();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/error/DefaultRuntimeErrorCallback.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.error;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.jboss.errai.bus.client.api.InvalidBusContentException;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\nimport static org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup.newYesNoCancelPopup;\nimport static org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup.showMessage;\n\n@Dependent\npublic class DefaultRuntimeErrorCallback {\n\n    public static final String PARSING_JSON_SYNTAX_MSG = \"Error parsing JSON: SyntaxError: JSON.parse: unexpected character at line 1 column 2 of the JSON data\";\n    public static final String PARSING_JSON_MSG = \"Error parsing JSON: SyntaxError: Unexpected token � in JSON at position 1\";\n    public static final String SCRIPT_ERROR_MSG = \"Script error. (:0)\";\n\n    @Inject\n    BusyIndicatorView loading;\n\n    AppConstants i18n = AppConstants.INSTANCE;\n\n    private boolean errorPopUpLock = false;\n\n    public void error(final Throwable throwable) {\n        if (errorPopUpLock) {\n            return;\n        }\n        loading.hideBusyIndicator();\n        errorPopUpLock = true;\n        if (isServerOfflineException(throwable)) {\n            showPopup(i18n.disconnectedFromServer(), i18n.couldNotConnectToServer());\n        } else if (isInvalidBusContentException(throwable)) {\n            showPopup(i18n.sessionTimeout(), i18n.invalidBusResponseProbablySessionTimeout());\n        } else {\n            showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(extractMessageRecursively(throwable)),\n                        this::unlock,\n                        this::unlock);\n        }\n\n    }\n\n    private void showPopup(String title, String content) {\n        final YesNoCancelPopup result = newYesNoCancelPopup(title,\n                                                            content,\n                                                            Window.Location::reload,\n                                                            null,\n                                                            this::unlock);\n        result.clearScrollHeight();\n        result.show();\n    }\n\n    protected static String extractMessageRecursively(final Throwable t) {\n        if (t == null) {\n            return \"\";\n        }\n        if (t.getCause() == null) {\n            return t.getMessage();\n        }\n        return t.getMessage() + \" Caused by: \" + extractMessageRecursively(t.getCause());\n    }\n\n    private static boolean isInvalidBusContentException(final Throwable throwable) {\n        return throwable instanceof InvalidBusContentException;\n    }\n\n    protected static boolean isServerOfflineException(final Throwable throwable) {\n        Throwable cause = throwable.getCause();\n        String message = throwable.getMessage();\n        List<String> messages = Arrays.asList(SCRIPT_ERROR_MSG,\n                                              PARSING_JSON_MSG,\n                                              PARSING_JSON_SYNTAX_MSG);\n\n        return cause == null && message != null && messages.stream().anyMatch(message::equals);\n    }\n\n    public void unlock() {\n        errorPopUpLock = false;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/AppNavBar.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<div id=\"header\">\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/AppNavBar.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport jsinterop.base.Js;\nimport org.jboss.errai.ioc.client.api.AfterInitialization;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.Header;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.WorkbenchMegaMenuPresenter;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Templated\n@ApplicationScoped\npublic class AppNavBar implements Header {\n\n    @Inject\n    @DataField\n    HTMLDivElement header;\n\n    @Inject\n    WorkbenchMegaMenuPresenter menuBarPresenter;\n\n    @Inject\n    LogoutMenuBuilder logoutMenu;\n    \n    @Inject\n    GoToDashboardMenuBuilder goToDashboardMenu;\n    \n    @Inject\n    DashboardListMenuBuilder dashboardsListMenu;\n    \n    private boolean isDashboardListEnabled = false;\n    \n    private boolean isGoToDashboardMenuEnabled = false;\n\n    @AfterInitialization\n    public void setup() {\n        setupMenus();\n    }\n\n    public void setupMenus(final Menus menus) {\n        setupMenus();\n        menuBarPresenter.addMenus(menus);\n    }\n\n    @Override\n    public String getId() {\n        return \"AppNavBar\";\n    }\n\n    @Override\n    public int getOrder() {\n        return 20;\n    }\n    \n    public void setDashboardListEnabled(boolean isDashboardListEnabled) {\n        this.isDashboardListEnabled = isDashboardListEnabled;\n    }\n    \n    \n    public void setExternalMenuEnabled(boolean isExternalMenuEnabled) {\n        this.isGoToDashboardMenuEnabled = isExternalMenuEnabled;\n    }\n\n    public void setupMenus() {\n        menuBarPresenter.clear();\n        menuBarPresenter.clearContextMenu();\n        if (isGoToDashboardMenuEnabled) {\n            menuBarPresenter.addMenus(MenuFactory.newTopLevelCustomMenu(goToDashboardMenu).endMenu().build());\n        }\n        if (isDashboardListEnabled) {\n            menuBarPresenter.addMenus(MenuFactory.newTopLevelCustomMenu(dashboardsListMenu).endMenu().build());\n        }\n        menuBarPresenter.addMenus(MenuFactory.newTopLevelCustomMenu(logoutMenu).endMenu().build());\n        \n        header.innerHTML = \"\";\n        header.appendChild(Js.cast(menuBarPresenter.getView().getElement()));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/DashboardListMenuBuilder.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.RouterScreen;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuFactory.CustomMenuBuilder;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@ApplicationScoped\npublic class DashboardListMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    private static final AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    MenuBuilderHelper menuBuilderHelper;\n\n    @Inject\n    private RouterScreen router;\n\n    @Override\n    public void push(CustomMenuBuilder element) {\n        // do nothing\n    }\n\n    @Override\n    public MenuItem build() {\n        return menuBuilderHelper.buildMenuItem(i18n.dashboardListTooltip(),\n                                               IconType.LIST,\n                                               this::goToList);\n    }\n\n    private void goToList() {\n        router.listDashboards();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/GoToDashboardMenuBuilder.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.client.RuntimeEntryPoint;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuFactory.CustomMenuBuilder;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@ApplicationScoped\npublic class GoToDashboardMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    @Inject\n    private PerspectiveManager perspectiveManager;\n\n    @Inject\n    MenuBuilderHelper menuBuilderHelper;\n\n    @Override\n    public void push(CustomMenuBuilder element) {\n        // do nothing\n    }\n\n    @Override\n    public MenuItem build() {\n        return menuBuilderHelper.buildMenuItem(AppConstants.INSTANCE.dashboardOpenTooltip(),\n                                               IconType.EXTERNAL_LINK,\n                                               this::openDashboardInNewWindow);\n    }\n\n    private void openDashboardInNewWindow() {\n        String currentPlace = perspectiveManager.getCurrentPerspective().getIdentifier();\n        String standaloneUrl = Window.Location.createUrlBuilder()\n                                              .setParameter(RuntimeEntryPoint.DASHBOARD_PARAM, currentPlace)\n                                              .setParameter(\"standalone\", \"true\")\n                                              .buildString();\n        DomGlobal.window.open(standaloneUrl);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/LogoutMenuBuilder.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuFactory.CustomMenuBuilder;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@ApplicationScoped\npublic class LogoutMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    private static final AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    MenuBuilderHelper menuBuilderHelper;\n\n    @Inject\n    private Caller<AuthenticationService> authService;\n\n    @Override\n    public void push(CustomMenuBuilder element) {\n        // do nothing\n    }\n\n    @Override\n    public MenuItem build() {\n        return menuBuilderHelper.buildMenuItem(i18n.logoutMenuTooltip(),\n                                               IconType.SIGN_OUT,\n                                               this::logout);\n    }\n\n    private void logout() {\n        authService.call(r -> {\n            final String location = GWT.getModuleBaseURL()\n                                       .replaceFirst(\"/\" + GWT.getModuleName() + \"/\", \"/logout.jsp\");\n            DomGlobal.window.location.assign(location);\n        }).logout();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/MenuBuilderHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@ApplicationScoped\npublic class MenuBuilderHelper {\n\n    public MenuItem buildMenuItem(String title, IconType icon, Command action) {\n        AnchorListItem link = new AnchorListItem();\n        link.setIcon(icon);\n\n        link.getWidget(0).setStyleName(\"nav-item-iconic\"); // Fix for IE11\n        link.setTitle(title);\n\n        link.addClickHandler(e -> action.execute());\n        return new BaseMenuCustom<IsWidget>() {\n\n            @Override\n            public IsWidget build() {\n                return link;\n            }\n\n            @Override\n            public MenuPosition getPosition() {\n                return MenuPosition.RIGHT;\n            }\n        };\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/NavBarHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuFactory.MenuBuilder;\nimport org.uberfire.workbench.model.menu.MenuFactory.TopLevelMenusBuilder;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@ApplicationScoped\npublic class NavBarHelper {\n\n    // code taken from DefaultWorkbenchFeaturesMenusHelper\n\n    public TopLevelMenusBuilder<MenuBuilder> buildMenusFromNavTree(NavTree navTree) {\n        if (navTree == null) {\n            return null;\n        }\n\n        MenuBuilder<TopLevelMenusBuilder<MenuBuilder>> builder = null;\n        for (NavItem navItem : navTree.getRootItems()) {\n\n            // Skip dividers\n            if (navItem instanceof NavDivider) {\n                continue;\n            }\n            // AF-953: Ignore empty groups\n            if (navItem instanceof NavGroup && ((NavGroup) navItem).getChildren().isEmpty()) {\n                continue;\n            }\n            // Build a top level menu entry\n            if (builder == null) {\n                builder = MenuFactory.newTopLevelMenu(navItem.getName());\n            } else {\n                builder = builder.endMenu().newTopLevelMenu(navItem.getName());\n            }\n            // Append its children\n            if (navItem instanceof NavGroup) {\n                List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);\n                if (! childItems.isEmpty()) {\n                    builder.withItems(childItems);\n                }\n            }\n            // Append the place request\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n                PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());\n                builder = builder.place(placeRequest);\n            }\n        }\n        return builder != null ? builder.endMenu() : null;\n    }\n\n    private List<MenuItem> buildMenuItemsFromNavGroup(NavGroup navGroup) {\n        List<MenuItem> result = new ArrayList<>();\n        for (NavItem navItem : navGroup.getChildren()) {\n\n            // Skip dividers\n            if (navItem instanceof NavDivider) {\n                continue;\n            }\n            // Append its children\n            MenuBuilder<MenuFactory.Builder> builder = MenuFactory.newSimpleItem(navItem.getName());\n            if (navItem instanceof NavGroup) {\n                List<MenuItem> childItems = buildMenuItemsFromNavGroup((NavGroup) navItem);\n                if (!childItems.isEmpty()) {\n                    builder.withItems(childItems);\n                }\n            }\n            // Append the place request\n            NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n            if (navCtx.getResourceId() != null && ActivityResourceType.PERSPECTIVE.equals(navCtx.getResourceType())) {\n                PlaceRequest placeRequest = resolvePlaceRequest(navCtx.getResourceId());\n                builder.place(placeRequest);\n            }\n            // Build the menu item & continue with the next one\n            MenuItem menuItem = builder.endMenu().build().getItems().get(0);\n            result.add(menuItem);\n        }\n        return result;\n    }\n\n    public PlaceRequest resolvePlaceRequest(String perspectiveId) {\n        return new DefaultPlaceRequest(perspectiveId);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/navbar/RuntimeNavBrand.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\n\n@ApplicationScoped\npublic class RuntimeNavBrand implements MegaMenuBrand {\n\n    @Override\n    public String brandImageUrl() {\n        return \"./images/runtime_logo.png\";\n    }\n\n    @Override\n    public String brandImageLabel() {\n        return \"Dashbuilder Runtime\";\n    }\n\n    @Override\n    public String menuAccessorLabel() {\n        return \"Dashboards\";\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/DashboardsListPerspective.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.DashboardsListScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = DashboardsListPerspective.ID)\npublic class DashboardsListPerspective {\n    \n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n\n    public static final String ID = \"DashboardsListPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(DashboardsListScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(i18n.listDashboardsScreenTitle());\n        return perspective;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/EmptyPerspective.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.screens.EmptyScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = EmptyPerspective.ID)\npublic class EmptyPerspective {\n\n    public static final String ID = \"EmptyPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(EmptyScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(\"Upload Dashboard\");\n        return perspective;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/NotFoundPerspective.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.screens.NotFoundScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = NotFoundPerspective.ID)\npublic class NotFoundPerspective {\n\n    public static final String ID = \"NotFoundPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(NotFoundScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(\"Not Found Perspective\");\n        return perspective;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/RouterPerspective.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.RouterScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = RouterPerspective.ID, isDefault = true)\npublic class RouterPerspective {\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    \n    public static final String ID = \"RouterPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(RouterScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(i18n.routerPerspective());\n        return perspective;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/RuntimePerspective.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.screens.RuntimeScreen;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = RuntimePerspective.ID)\npublic class RuntimePerspective {\n\n    public static final String ID = \"RuntimePerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(RuntimeScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(\"Dashboards\");\n        return perspective;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/generator/RuntimePerspectiveEditorActivity.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective.generator;\n\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorActivity;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorScreenActivity;\n\npublic class RuntimePerspectiveEditorActivity extends PerspectiveEditorActivity {\n\n    public RuntimePerspectiveEditorActivity(LayoutTemplate editor, PerspectiveEditorScreenActivity screen) {\n        super(editor, screen);\n    }\n\n    @Override\n    protected String getDefaultPanelType() {\n        return StaticWorkbenchPanelPresenter.class.getName();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/perspective/generator/RuntimePerspectiveGenerator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.perspective.generator;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorActivity;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorScreenActivity;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class RuntimePerspectiveGenerator {\n\n    @Inject\n    private SyncBeanManager beanManager;\n\n    @Inject\n    private ActivityBeansCache activityBeansCache;\n\n    @Inject\n    private LayoutGenerator layoutGenerator;\n\n    public PerspectiveEditorActivity generatePerspective(LayoutTemplate layoutTemplate) {\n        if (isANewPerspective(layoutTemplate)) {\n            PerspectiveEditorScreenActivity screen = createNewScreen(layoutTemplate);\n            return createNewPerspective(layoutTemplate,\n                                        screen);\n        } else {\n            PerspectiveEditorScreenActivity screen = updateScreen(layoutTemplate);\n            return updatePerspective(layoutTemplate,\n                                     screen);\n        }\n    }\n\n    private PerspectiveEditorScreenActivity createNewScreen(LayoutTemplate perspective) {\n        PerspectiveEditorScreenActivity activity = new PerspectiveEditorScreenActivity(perspective,\n                                                                                       layoutGenerator);\n\n        final Set<Annotation> qualifiers = new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS));\n        final SingletonBeanDefinition<PerspectiveEditorScreenActivity, PerspectiveEditorScreenActivity> beanDef =\n                new SingletonBeanDefinition<>(\n                                              activity,\n                                              PerspectiveEditorScreenActivity.class,\n                                              qualifiers,\n                                              activity.getIdentifier(),\n                                              true,\n                                              WorkbenchScreenActivity.class,\n                                              Activity.class);\n\n        beanManager.registerBean(beanDef);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          Activity.class);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          WorkbenchScreenActivity.class);\n        String activityID = activity.getIdentifier();\n        activityBeansCache.removeActivity(activityID);\n        activityBeansCache.addNewScreenActivity(beanManager.lookupBeans(activityID).iterator().next());\n        return activity;\n    }\n\n    private PerspectiveEditorActivity createNewPerspective(LayoutTemplate perspective,\n                                                           PerspectiveEditorScreenActivity screen) {\n        final PerspectiveEditorActivity activity = new RuntimePerspectiveEditorActivity(perspective,\n                                                                                        screen);\n\n        String perspectiveName = perspective.getName();\n        beanManager.registerBean(new SingletonBeanDefinition<>(activity,\n                                                               PerspectiveActivity.class,\n                                                               new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                                                               perspectiveName,\n                                                               true));\n        activityBeansCache.removeActivity(perspectiveName);\n        activityBeansCache.addNewPerspectiveActivity(beanManager.lookupBeans(perspectiveName).iterator().next());\n        return activity;\n    }\n\n    private PerspectiveEditorScreenActivity updateScreen(LayoutTemplate layoutTemplate) {\n        final String perspectiveScreenId = PerspectiveEditorScreenActivity.buildScreenId(layoutTemplate.getName());\n        final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(perspectiveScreenId);\n        final PerspectiveEditorScreenActivity screenActivity = (PerspectiveEditorScreenActivity) activity.getInstance();\n        screenActivity.setLayoutTemplate(layoutTemplate);\n        return screenActivity;\n    }\n\n    private PerspectiveEditorActivity updatePerspective(LayoutTemplate layoutTemplate,\n                                                        PerspectiveEditorScreenActivity screen) {\n        final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(layoutTemplate.getName());\n        final PerspectiveEditorActivity perspectiveEditorActivity = (PerspectiveEditorActivity) activity.getInstance();\n        perspectiveEditorActivity.update(layoutTemplate,\n                                         screen);\n        return perspectiveEditorActivity;\n    }\n\n    private boolean isANewPerspective(LayoutTemplate layoutTemplate) {\n        return activityBeansCache.getActivity(layoutTemplate.getName()) == null;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/plugins/RuntimePerspectivePluginManager.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.plugins;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.navigation.plugin.PerspectivePluginManager;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.layout.LayoutRecursionIssue;\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.LayoutTemplateInfo;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * A specific Runtime perspective plugin manager. This is used by Navigation Components to load a custom perspective.\n *\n */\n@Alternative\n@ApplicationScoped\npublic class RuntimePerspectivePluginManager implements PerspectivePluginManager {\n\n    @Inject\n    LayoutGenerator layoutGenerator;\n\n    List<LayoutTemplate> templates = new ArrayList<>();\n\n    @Override\n    public void loadPlugins() {\n        // not used in Runtime\n    }\n\n    @Override\n    public void getPerspectivePlugins(ParameterizedCommand<Collection<Plugin>> callback) {\n        List<Plugin> plugins = templates.stream()\n                                        .map(lt -> new Plugin(lt.getName(),\n                                                              PluginType.PERSPECTIVE,\n                                                              null))\n                                        .collect(Collectors.toList());\n        callback.execute(plugins);\n    }\n\n    @Override\n    public boolean isRuntimePerspective(Plugin plugin) {\n        return searchLayoutTemplate(plugin.getName());\n    }\n\n    @Override\n    public boolean isRuntimePerspective(NavItem navItem) {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n        String resourceId = navCtx.getResourceId();\n        return searchLayoutTemplate(resourceId);\n    }\n\n    @Override\n    public boolean isRuntimePerspective(String perspectiveId) {\n        return searchLayoutTemplate(perspectiveId);\n    }\n\n    @Override\n    public String getRuntimePerspectiveId(NavItem navItem) {\n        NavWorkbenchCtx navCtx = NavWorkbenchCtx.get(navItem);\n        return navCtx.getResourceId();\n    }\n\n    @Override\n    public boolean existsPerspectivePlugin(String perspectiveName) {\n        return searchLayoutTemplate(perspectiveName);\n    }\n\n    @Override\n    public void getLayoutTemplateInfo(String perspectiveName, ParameterizedCommand<LayoutTemplateInfo> callback) {\n        // not used in runtime\n    }\n\n    @Override\n    public void getLayoutTemplateInfo(LayoutTemplate layoutTemplate, ParameterizedCommand<LayoutTemplateInfo> callback) {\n        // not used in runtime\n    }\n\n    @Override\n    public void buildPerspectiveWidget(String perspectiveName, LayoutTemplateContext layoutCtx, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion) {\n        templates.stream().filter(lt -> lt.getName().equals(perspectiveName)).findFirst().ifPresent(lt -> {\n            LayoutInstance result = layoutGenerator.build(lt);\n            IsWidget widget = ElementWrapperWidget.getWidget(result.getElement());\n            afterBuild.execute(widget);\n        });\n    }\n\n    @Override\n    public NavGroup getLastBuildPerspectiveNavGroup() {\n        return null;\n    }\n\n    public void setTemplates(List<LayoutTemplate> templates) {\n        this.templates = templates;\n    }\n\n    private boolean searchLayoutTemplate(String name) {\n        return templates.stream().anyMatch(lt -> lt.getName().equals(name));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/resources/i18n/AppConstants.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface AppConstants extends Messages {\n\n    public static final AppConstants INSTANCE = GWT.create(AppConstants.class);\n\n    String logoutMenuTooltip();\n\n    String errorLoadingDashboards();\n\n    String loadingDashboards();\n\n    String errorUploadingDashboards();\n\n    String uploadingDashboards();\n\n    String runtimeScreenTitle();\n\n    String uploadDashboardsTitle();\n\n    String notFoundScreenTitle();\n\n    String notFoundDashboard(String perspectiveName);\n\n    String routerScreenTitle();\n\n    String dashboardsListScreenTitle();\n\n    String dashboardListTooltip();\n\n    String listDashboardsScreenTitle();\n\n    String routerPerspective();\n    \n    String dashboardAlreadyImport(String newModelId, String exitingModel);\n\n    String importSuccess(String fileName);\n\n    String disconnectedFromServer();\n\n    String couldNotConnectToServer();\n\n    String sessionTimeout();\n\n    String invalidBusResponseProbablySessionTimeout();\n    \n    String dashboardOpenTooltip();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/DashboardsListScreen.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.perspective.DashboardsListPerspective;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.widgets.DashboardCard;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.event.UpdatedRuntimeModelEvent;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.lifecycle.OnClose;\n\n/**\n * Screen that shows a list of dashboards available in a MULTI dashboards installation. \n *\n */\n@ApplicationScoped\n@WorkbenchScreen(identifier = DashboardsListScreen.ID)\npublic class DashboardsListScreen {\n\n    public static final String ID = \"ListDashboardsScreen\";\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    RouterScreen router;\n\n    @Inject\n    PerspectiveManager perspectiveManager;\n\n    public interface View extends UberElemental<DashboardsListScreen> {\n\n        void addCard(DashboardCard card);\n\n        void clear();\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    ManagedInstance<DashboardCard> dashboardCardInstance;\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void loadList(List<String> dashboardsNames) {\n        clear();\n        dashboardsNames.stream()\n                       .map(this::createDashboardCard)\n                       .forEach(view::addCard);\n    }\n\n    private DashboardCard createDashboardCard(String id) {\n        DashboardCard card = dashboardCardInstance.get();\n        card.setDashboardId(id);\n        return card;\n    }\n\n    @WorkbenchPartTitle\n    public String getScreenTitle() {\n        return i18n.dashboardsListScreenTitle();\n    }\n\n    @WorkbenchPartView\n    public View workbenchPart() {\n        return this.view;\n    }\n\n    @OnClose\n    public void clear() {\n        dashboardCardInstance.destroyAll();\n        view.clear();\n    }\n\n    public void onModelUpdated(@Observes UpdatedRuntimeModelEvent event) {\n        reload();\n    }\n\n    public void onModelRemoved(@Observes RemovedRuntimeModelEvent event) {\n        reload();\n    }\n\n    private void reload() {\n        String currentPlace = perspectiveManager.getCurrentPerspective().getIdentifier();\n        if (DashboardsListPerspective.ID.equals(currentPlace)) {\n            router.listDashboards();\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/EmptyScreen.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.perspective.EmptyPerspective;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.shared.event.UpdatedRuntimeModelEvent;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.UberElemental;\n\n/**\n * Screen displayed when there's no dashboards available.\n *\n */\n@ApplicationScoped\n@WorkbenchScreen(identifier = EmptyScreen.ID)\npublic class EmptyScreen {\n\n    public static final String ID = \"EmptyScreen\";\n\n    private static final AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    View view;\n    \n    @Inject\n    RouterScreen router;\n\n    @Inject\n    PerspectiveManager perspectiveManager;\n    \n    public interface View extends UberElemental<EmptyScreen> {\n        \n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @WorkbenchPartTitle\n    public String title() {\n        return i18n.uploadDashboardsTitle();\n    }\n\n    @WorkbenchPartView\n    protected View getPart() {\n        return view;\n    }\n    \n    public void onModelUpdated(@Observes UpdatedRuntimeModelEvent event) {\n        reload();\n    }\n\n    private void reload() {\n        String currentPlace = perspectiveManager.getCurrentPerspective().getIdentifier();\n        if (EmptyPerspective.ID.equals(currentPlace)) {\n            router.listDashboards();\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/NotFoundScreen.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport org.dashbuilder.client.RuntimeEntryPoint;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.lifecycle.OnOpen;\n\n/**\n * Screen displayed when a perspective is not found.\n *\n */\n@ApplicationScoped\n@WorkbenchScreen(identifier = NotFoundScreen.ID)\npublic class NotFoundScreen {\n\n    public static final String ID = \"NotFoundScreen\";\n    \n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    public interface View extends UberElemental<NotFoundScreen> {\n\n        void setNotFoundDashboard(String perspectiveName);\n    }\n\n    @Inject\n    View view;\n    \n    @OnOpen\n    public void onOpen() {\n        List<String> targetParams = Window.Location.getParameterMap().get(RuntimeEntryPoint.DASHBOARD_PARAM);\n        if (targetParams != null && !targetParams.isEmpty()) {\n            String dashboardName = targetParams.get(0);\n            view.setNotFoundDashboard(dashboardName);\n        }\n    }\n\n    @WorkbenchPartTitle\n    public String getScreenTitle() {\n        return i18n.notFoundScreenTitle();\n    }\n\n    @WorkbenchPartView\n    public View workbenchPart() {\n        return this.view;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/RouterScreen.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.client.RuntimeClientLoader;\nimport org.dashbuilder.client.RuntimeCommunication;\nimport org.dashbuilder.client.navbar.AppNavBar;\nimport org.dashbuilder.client.perspective.DashboardsListPerspective;\nimport org.dashbuilder.client.perspective.EmptyPerspective;\nimport org.dashbuilder.client.perspective.RuntimePerspective;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.shared.event.UpdatedRuntimeModelEvent;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.model.RuntimeServiceResponse;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.lifecycle.OnOpen;\n\n/**\n * \n * Responsible for handling screens transition and communication. \n * \n */\n@ApplicationScoped\n@WorkbenchScreen(identifier = RouterScreen.ID)\npublic class RouterScreen {\n\n    public static final String ID = \"RouterScreen\";\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    public interface View extends UberElemental<RouterScreen> {\n\n    }\n\n    @Inject\n    RuntimeClientLoader clientLoader;\n\n    @Inject\n    RuntimeScreen runtimeScreen;\n\n    @Inject\n    DashboardsListScreen dashboardsListScreen;\n\n    @Inject\n    RuntimeCommunication runtimeCommunication;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    AppNavBar appNavBar;\n\n    @Inject\n    View view;\n\n    private DashbuilderRuntimeMode mode;\n\n    @WorkbenchPartTitle\n    public String title() {\n        return i18n.routerScreenTitle();\n    }\n\n    @WorkbenchPartView\n    public View getView() {\n        return view;\n    }\n\n    @OnOpen\n    public void onOpen() {\n        doRoute();\n    }\n\n    public void doRoute() {\n        clientLoader.load(this::route,\n                          (a, t) -> runtimeCommunication.showError(i18n.errorLoadingDashboards(), t));\n    }\n\n    protected void route(RuntimeServiceResponse response) {\n        this.mode  = response.getMode();\n        Optional<RuntimeModel> runtimeModelOp = response.getRuntimeModelOp();\n\n        if (mode == DashbuilderRuntimeMode.MULTIPLE_IMPORT) {\n            appNavBar.setDashboardListEnabled(true);\n            appNavBar.setup();\n        }\n\n        if (runtimeModelOp.isPresent()) {\n            RuntimeModel runtimeModel = runtimeModelOp.get();\n            placeManager.goTo(RuntimePerspective.ID);\n            runtimeScreen.loadDashboards(runtimeModel);\n            runtimeScreen.goToIndex(runtimeModel.getLayoutTemplates());\n            return;\n        }\n\n        if (response.getAvailableModels().isEmpty()) {\n            placeManager.goTo(EmptyPerspective.ID);\n            return;\n        }\n\n        dashboardsListScreen.loadList(response.getAvailableModels());\n        placeManager.goTo(DashboardsListPerspective.ID);\n    }\n    \n    public void afterDashboardUpload(String id) {\n        if (mode != null && mode == DashbuilderRuntimeMode.MULTIPLE_IMPORT) {\n            listDashboards();\n        } else {\n            loadDashboard(id);\n        }      \n    }\n\n    public void loadDashboard(String importId) {\n        String newUrl = GWT.getHostPageBaseURL() + \"?\" +\n                        RuntimeClientLoader.IMPORT_ID_PARAM + \"=\" +\n                        importId;\n        DomGlobal.window.history.replaceState(null,\n                                              \"Dashbuilder Runtime |\" + importId,\n                                              newUrl);\n        doRoute();\n    }\n\n    public void listDashboards() {\n        DomGlobal.window.history.replaceState(null,\n                                              \"Dashbuilder Runtime\",\n                                              GWT.getHostPageBaseURL());\n        doRoute();\n    }\n    \n    public void onUpdatedRuntimeModelEvent(@Observes UpdatedRuntimeModelEvent updatedRuntimeModelEvent) {\n        String updatedModel = updatedRuntimeModelEvent.getRuntimeModelId();\n        \n        if (updatedModel.equals(clientLoader.getImportId())) {\n            doRoute();\n            runtimeScreen.setKeepHistory(true);\n        }\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/RuntimeScreen.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.navbar.AppNavBar;\nimport org.dashbuilder.client.navbar.NavBarHelper;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * The Main application screen that contains dashboards from a RuntimeModel. \n *\n */\n@ApplicationScoped\n@WorkbenchScreen(identifier = RuntimeScreen.ID)\npublic class RuntimeScreen {\n\n    public static final String ID = \"RuntimeScreen\";\n\n    public static final String INDEX_PAGE_NAME = \"index\";\n\n    private static AppConstants i18n = AppConstants.INSTANCE;\n\n    public interface View extends UberElemental<RuntimeScreen> {\n\n        void addMenus(Menus menus);\n\n    }\n\n    @Inject\n    View view;\n\n    @Inject\n    NavBarHelper menusHelper;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    AppNavBar appNavBar;\n\n    private RuntimeModel currentRuntimeModel;\n\n    String lastVisited;\n\n    boolean keepHistory;\n\n    @WorkbenchPartTitle\n    public String getScreenTitle() {\n        return i18n.runtimeScreenTitle();\n    }\n\n    @WorkbenchPartView\n    public View workbenchPart() {\n        return this.view;\n    }\n\n    public void loadDashboards(RuntimeModel runtimeModel) {\n        this.currentRuntimeModel = runtimeModel;\n        refreshMenus();\n    }\n\n    public void goToIndex(List<LayoutTemplate> templates) {\n        if (keepHistory &&\n            lastVisited != null &&\n            templates.stream().anyMatch(t -> t.getName().equals(lastVisited))) {\n            keepHistory = false;\n            placeManager.goTo(lastVisited);\n        }\n\n        else if (templates.size() == 1) {\n            placeManager.goTo(templates.get(0).getName());\n        } else {\n            templates.stream()\n                     .map(LayoutTemplate::getName)\n                     .filter(INDEX_PAGE_NAME::equals)\n                     .findFirst()\n                     .ifPresent(placeManager::goTo);\n        }\n    }\n\n    public void setKeepHistory(boolean keepHistory) {\n        this.keepHistory = keepHistory;\n    }\n\n    void onPerspectiveChange(@Observes PerspectiveChange perspectiveChange) {\n        if (currentRuntimeModel != null) {\n            String perspective = perspectiveChange.getIdentifier();\n            boolean isLayoutTemplate = currentRuntimeModel.getLayoutTemplates()\n                                                                   .stream()\n                                                                   .anyMatch(lt -> lt.getName().equals(perspective));\n            appNavBar.setExternalMenuEnabled(isLayoutTemplate);\n            refreshMenus();\n            if (isLayoutTemplate) {\n                lastVisited = perspective;\n            }\n        } else {\n            appNavBar.setupMenus();\n        }\n    }\n\n    private void refreshMenus() {\n        NavTree navTree = currentRuntimeModel.getNavTree();\n        Menus menus = menusHelper.buildMenusFromNavTree(navTree).build();\n        view.addMenus(menus);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/DashboardsListScreenView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.listTitle {\n    font-size: 1.5em;\n    margin: 0px 8px 0px 8px;\n    float: left;\n}\n\n.uploadButtonContainer {\n    float: right;\n    margin-right: 15px;\n    margin-bottom: 5px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/DashboardsListScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=dashboardsListRoot>\n\n    <div class=\"row toolbar-pf\">\n        <div class=\"col-sm-12\">\n            <div class=\"listTitle\" data-i18n-key=\"title\"></div>\n            <div class=\"uploadButtonContainer\">\n                <div class=\"btn-group\" id=\"uploadWidgetContainer\"></div>\n            </div>\n        </div>\n    </div>\n\n    <div class=\"container-cards-pf\">\n        <div class=\"row row-cards-pf\" data-field=\"dashboardsList\"></div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/DashboardsListScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.DashboardsListScreen;\nimport org.dashbuilder.client.widgets.DashboardCard;\nimport org.dashbuilder.client.widgets.UploadWidget;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@Dependent\npublic class DashboardsListScreenView implements DashboardsListScreen.View {\n\n    AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    HTMLDivElement dashboardsListRoot;\n\n    @Inject\n    @DataField\n    HTMLDivElement uploadWidgetContainer;\n\n    @Inject\n    @DataField\n    HTMLDivElement dashboardsList;\n\n    @Inject\n    UploadWidget uploadWidget;\n\n    @Override\n    public HTMLElement getElement() {\n        return dashboardsListRoot;\n    }\n\n    @Override\n    public void init(DashboardsListScreen presenter) {\n        uploadWidgetContainer.appendChild(uploadWidget.getElement());\n    }\n\n    @Override\n    public void addCard(DashboardCard card) {\n        dashboardsList.appendChild(card.getElement());\n    }\n\n    @Override\n    public void clear() {\n        dashboardsList.innerHTML = \"\";\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/EmptyScreenView.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#emptyImport {\n    height: 100%;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/EmptyScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div class=\"blank-slate-pf \" id=\"emptyImport\">\n    <div class=\"blank-slate-pf-icon\">\n        <span class=\"pficon pficon pficon-add-circle-o\"></span>\n    </div>\n    <h1 data-i18n-key=\"title\"></h1>\n    <p data-i18n-key=\"subTitle\"></p>\n    <div class=\"blank-slate-pf-main-action\" id=\"uploadContainer\">\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/EmptyScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.EmptyScreen;\nimport org.dashbuilder.client.widgets.UploadWidget;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@Dependent\npublic class EmptyScreenView implements EmptyScreen.View {\n\n    AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    HTMLDivElement emptyImport;\n\n    @Inject\n    @DataField\n    HTMLDivElement uploadContainer;\n\n    @Inject\n    UploadWidget uploadWidget;\n\n    @Override\n    public HTMLElement getElement() {\n        return emptyImport;\n    }\n\n    @Override\n    public void init(EmptyScreen presenter) {\n        uploadContainer.appendChild(uploadWidget.getElement());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/NotFoundScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div class=\"blank-slate-pf\" id=\"root\" style=\"height: 100%\">\n    <div class=\"blank-slate-pf-icon\">\n        <span class=\"fa fa-ban\"></span>\n    </div>\n    <h1 data-i18n-key=\"title\"></h1>\n    <p data-i18n-key=\"subTitle\" id=\"subTitle\"></p>\n\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/NotFoundScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLParagraphElement;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.NotFoundScreen;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class NotFoundScreenView implements NotFoundScreen.View {\n    \n    private static AppConstants i18n = AppConstants.INSTANCE;\n    \n    @Inject\n    @DataField\n    HTMLDivElement root;\n    \n    @Inject\n    @DataField\n    HTMLParagraphElement subTitle;\n\n    @Override\n    public HTMLElement getElement() {\n        return root;\n    }\n\n    @Override\n    public void init(NotFoundScreen presenter) {\n        // do nothing\n    }\n    \n    @Override\n    public void setNotFoundDashboard(String perspectiveName) {\n        subTitle.textContent = i18n.notFoundDashboard(perspectiveName);\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/RouterScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=\"routerRoot\"></div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/RouterScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.RouterScreen;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@Dependent\npublic class RouterScreenView implements RouterScreen.View {\n\n    AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    HTMLDivElement routerRoot;\n\n    @Override\n    public HTMLElement getElement() {\n        return routerRoot;\n    }\n\n    @Override\n    public void init(RouterScreen presenter) {\n        // not used        \n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/RuntimeScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=\"runtimePage\">\n    <div class=\"runtimePageBody\">\n        <div\n            class=\"runtimePage__content runtimeContent--bg-image runtime-blank-slate\">\n            <div\n                class=\"container-fluid runtime-container-fluid--blank-slate\">\n                <div class=\"blank-slate-pf row\">\n                    <h1 data-i18n-key=\"title\"></h1>\n\n                    <p data-i18n-key=\"subTitle\"></p>\n\n                </div>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/RuntimeScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.RuntimeCommunication;\nimport org.dashbuilder.client.navbar.AppNavBar;\nimport org.dashbuilder.client.screens.RuntimeScreen;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@Templated\npublic class RuntimeScreenView implements RuntimeScreen.View {\n\n    @Inject\n    @DataField\n    HTMLDivElement runtimePage;\n\n    @Inject\n    AppNavBar appNavBar;\n\n    @Inject\n    RuntimeCommunication runtimeCommunication;\n\n    @Inject\n    BusyIndicatorView loading;\n\n    @Override\n    public HTMLElement getElement() {\n        return runtimePage;\n    }\n\n    @Override\n    public void init(RuntimeScreen presenter) {\n        // empty\n    }\n\n    @Override\n    public void addMenus(Menus menus) {\n        appNavBar.setupMenus(menus);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/screens/view/RuntimeScreenView.less",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n#runtimePage {\n\n  height: 100%;\n\n  .runtimePageBody {\n    background-image: url('./images/runtime_home_bg.jpg');\n    align-items: stretch;\n    display: flex;\n    justify-content: space-between;\n    flex-flow: column nowrap;\n    height: 100%;\n    max-height: 100vh;\n  }\n  .runtimePage__content {\n    flex: 1 1 auto;\n  }\n  .runtimeContent--bg-image {\n    background-color: #4d5258;\n    background-position: top center;\n    background-size: cover;\n    .blank-slate-pf {\n      background-color: transparent;\n      color: #d1d1d1;\n      border: 0;\n    }\n  }\n  .runtime-container-fluid--blank-slate {\n    @media (min-width: 992px) {\n      width: 100%;\n      background-color: rgba(0, 0, 0, .2);\n    }\n  }\n  .runtime-blank-slate {\n    display: flex;\n    background-color: transparent;\n    @media (min-width: 992px) {\n      align-items: center;\n    }\n  }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/DashboardCard.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.RouterScreen;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\n\n/**\n * Allow users to upload new dashboards\n *\n */\n@Dependent\npublic class DashboardCard implements IsElement {\n\n    static final AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    View view;\n\n    @Inject\n    RouterScreen routerScreen;\n\n    @Inject\n    PlaceManager placeManager;\n    \n\n    public interface View extends UberElemental<DashboardCard> {\n\n        void setDashboardId(String title);\n\n    }\n\n    @PostConstruct\n    public void init() {\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return this.view.getElement();\n    }\n\n    public void setDashboardId(String dashboardId) {\n        view.setDashboardId(dashboardId);\n    }\n\n    public void onCardSelected(String dashboardId) {\n        routerScreen.loadDashboard(dashboardId);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/UploadWidget.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.FormData;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLFormElement;\nimport elemental2.dom.RequestInit;\nimport elemental2.dom.Response;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.RouterScreen;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\n\n/**\n * Allow users to upload new dashboards\n *\n */\n@Dependent\npublic class UploadWidget implements IsElement {\n\n    static final AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    View view;\n\n    @Inject\n    RouterScreen routerScreen;\n\n    @Inject\n    PlaceManager placeManager;\n\n    public interface View extends UberElemental<UploadWidget> {\n\n        void loading();\n\n        void stopLoading();\n\n        void badResponseUploading(Response response);\n\n        void errorDuringUpload(Object error);\n\n        void dashboardAlreadyImportedError(String importName, String modelId);\n\n        void importSuccess(String importName);\n\n    }\n\n    @PostConstruct\n    public void init() {\n        this.view.init(this);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return this.view.getElement();\n    }\n\n    public void submit(String fileName, final HTMLFormElement uploadForm) {\n        RequestInit request = RequestInit.create();\n        request.setMethod(\"POST\");\n        request.setBody(new FormData(uploadForm));\n        view.loading();\n        DomGlobal.window.fetch(\"./rest/upload\", request)\n                        .then((Response response) -> response.text().then(newImportName -> {\n                            view.stopLoading();\n                            if (response.status == 200) {\n                                openImport(newImportName);\n                            } \n                            else if(response.status == 409) {\n                                importAlreadyExists(fileName, newImportName);\n                            } else {\n                                view.badResponseUploading(response);\n                            }\n                            return null;\n                        }), error -> {\n                            view.stopLoading();\n                            view.errorDuringUpload(error);\n                            return null;\n                        });\n    }\n\n    private void openImport(final String newImportName) {\n        view.importSuccess(newImportName);\n        routerScreen.afterDashboardUpload(newImportName);\n    }\n    \n    private void importAlreadyExists(final String fileName, final String modelId) {\n        view.dashboardAlreadyImportedError(fileName, modelId);\n        routerScreen.afterDashboardUpload(modelId);\n    }\n\n    public String retrieveFileName(String value) {\n        int pos = 0;\n        if (value.contains(\"\\\\\")) {\n            pos = value.lastIndexOf('\\\\');\n        } else if (value.contains(\"/\")) {\n            pos = value.lastIndexOf('/');\n        }\n        return value.substring(pos + 1);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/view/DashboardCardView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div class=\"col-xs-12 col-sm-4 col-md-3 col-lg-2\" id=\"dashboardCardRoot\">\n    <div class=\"card-pf card-pf-view card-pf-view-select card-pf-view-single-select\">\n        <div class=\"card-pf-body\">\n            <div class=\"card-pf-top-element\">\n                <span class=\"fa fa-cubes card-pf-icon-circle\"></span>\n            </div>\n            <h2 class=\"card-pf-title text-center\" id=\"cardTitle\"></h2>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/view/DashboardCardView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLHeadingElement;\nimport org.dashbuilder.client.widgets.DashboardCard;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class DashboardCardView implements DashboardCard.View {\n\n    @Inject\n    @DataField\n    HTMLDivElement dashboardCardRoot;\n\n    @Inject\n    @DataField\n    @Named(\"h2\")\n    HTMLHeadingElement cardTitle;\n\n    private String dashboardId;\n\n    private DashboardCard presenter;\n\n    @Override\n    public HTMLElement getElement() {\n        return dashboardCardRoot;\n    }\n\n    @Override\n    public void init(DashboardCard presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setDashboardId(String dashboardId) {\n        this.dashboardId = dashboardId;\n        cardTitle.textContent = dashboardId;\n    }\n    \n    @EventHandler(\"dashboardCardRoot\")\n    public void onCardSelected(ClickEvent e) {\n        presenter.onCardSelected(dashboardId);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/view/UploadWidgetView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n<div id=\"uploadButtonContainer\">\n    <button class=\"btn btn-primary btn-lg\" id=\"btnImport\"\n        data-i18n-key=\"importButton\"></button>\n\n    <form id=\"uploadForm\" action=\"/rest/upload\" method=\"post\"\n        enctype=\"multipart/form-data\" style=\"display: none\">\n        <input id=\"inputFile\" accept=\".zip\" type=\"file\"\n            name=\"selectedFile\" /> <input type=\"hidden\"\n            name=\"inputFileName\" id=\"inputFileName\" />\n    </form>\n\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/client/widgets/view/UploadWidgetView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.widgets.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLFormElement;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.Response;\nimport org.dashbuilder.client.RuntimeCommunication;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.widgets.UploadWidget;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\n\n@Dependent\n@Templated\npublic class UploadWidgetView implements UploadWidget.View {\n\n    private static final AppConstants i18n = AppConstants.INSTANCE;\n\n    UploadWidget presenter;\n\n    @Inject\n    @DataField\n    HTMLDivElement uploadButtonContainer;\n\n    @Inject\n    @DataField\n    HTMLButtonElement btnImport;\n\n    @Inject\n    @DataField\n    HTMLFormElement uploadForm;\n\n    @Inject\n    @DataField\n    HTMLInputElement inputFile;\n\n    @Inject\n    @DataField\n    HTMLInputElement inputFileName;\n\n    @Inject\n    RuntimeCommunication runtimeCommunication;\n\n    @Inject\n    BusyIndicatorView loading;\n\n    @Override\n    public void init(UploadWidget presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void loading() {\n        loading.showBusyIndicator(i18n.uploadingDashboards());\n    }\n\n    @Override\n    public void stopLoading() {\n        loading.hideBusyIndicator();\n    }\n\n    @Override\n    public void badResponseUploading(Response response) {\n        runtimeCommunication.showError(i18n.errorUploadingDashboards(), response);\n    }\n\n    @Override\n    public void errorDuringUpload(Object error) {\n        runtimeCommunication.showError(i18n.errorUploadingDashboards(), error);\n    }\n    \n    @Override\n    public void dashboardAlreadyImportedError(String newImportName, String existingImport) {\n        runtimeCommunication.showWarning(i18n.dashboardAlreadyImport(newImportName, existingImport));\n    }\n\n    @EventHandler(\"btnImport\")\n    public void handleImport(ClickEvent e) {\n        inputFile.click();\n    }\n\n    @EventHandler(\"inputFile\")\n    public void handleInputFileChange(ChangeEvent e) {\n        String importName = presenter.retrieveFileName(inputFile.value);\n        inputFileName.value = importName;\n        presenter.submit(importName, uploadForm);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return uploadButtonContainer;\n    }\n\n    @Override\n    public void importSuccess(String importName) {\n        runtimeCommunication.showSuccess(i18n.importSuccess(importName));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/event/NewDataSetContentEvent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.event;\n\nimport java.util.List;\n\nimport org.dashbuilder.shared.model.DataSetContent;\n\n/**\n * Fired when new datasets are found in a Runtime model.\n *\n */\npublic class NewDataSetContentEvent {\n\n    private String runtimeModelId;\n    \n    private List<DataSetContent> content;\n\n    public NewDataSetContentEvent(String runtimeModelId, List<DataSetContent> content) {\n        this.runtimeModelId = runtimeModelId;\n        this.content = content;\n    }\n\n    public List<DataSetContent> getContent() {\n        return content;\n    }\n\n    public String getRuntimeModelId() {\n        return runtimeModelId;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/event/RemovedRuntimeModelEvent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Fired when datasets are removed.\n *\n */\n@Portable\npublic class RemovedRuntimeModelEvent {\n\n    /**\n     * Removed runtime model IDs\n     */\n    String runtimeModelId;\n\n    public RemovedRuntimeModelEvent(@MapsTo(\"id\") String id) {\n        this.runtimeModelId = id;\n    }\n\n    public String getRuntimeModelId() {\n        return runtimeModelId;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/event/UpdatedRuntimeModelEvent.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Fired only in dev mode when Runtime Models are updated\n *\n */\n@Portable\npublic class UpdatedRuntimeModelEvent {\n\n    /**\n     * Updated runtime model ID\n     */\n    String runtimeModelId;\n    \n    public UpdatedRuntimeModelEvent() {\n        // empty constructor for marshalling\n    }\n\n    public UpdatedRuntimeModelEvent(@MapsTo(\"id\") String id) {\n        this.runtimeModelId = id;\n    }\n\n    public String getRuntimeModelId() {\n        return runtimeModelId;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/DashboardInfo.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport java.util.Collection;\n\n/**\n * Specific Dashboard information.\n *\n */\npublic class DashboardInfo {\n\n    private String runtimeModelId;\n\n    private Collection<String> pages;\n\n    public DashboardInfo(String runtimeModelId, Collection<String> pages) {\n        this.runtimeModelId = runtimeModelId;\n        this.pages = pages;\n    }\n\n    public String getRuntimeModelId() {\n        return runtimeModelId;\n    }\n\n    public Collection<String> getPages() {\n        return pages;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/DashbuilderRuntimeInfo.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport java.util.Collection;\n\n/**\n * Dashbuilder Runtime information.\n *\n */\npublic class DashbuilderRuntimeInfo {\n\n    private String mode;\n    private Collection<String> availableModels;\n    private boolean acceptingNewImports;\n\n    public DashbuilderRuntimeInfo(String mode,\n                                  Collection<String> availableModels,\n                                  boolean acceptingNewImports) {\n        this.mode = mode;\n        this.availableModels = availableModels;\n        this.acceptingNewImports = acceptingNewImports;\n    }\n\n    public String getMode() {\n        return mode;\n    }\n\n    public Collection<String> getAvailableModels() {\n        return availableModels;\n    }\n\n    public boolean isAcceptingNewImports() {\n        return acceptingNewImports;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/DashbuilderRuntimeMode.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\n/**\n * Execution for dashbuilder Runtime\n *\n */\npublic enum DashbuilderRuntimeMode {\n\n    /**\n     * Used when only the first import is used\n     */\n    STATIC,\n\n    /**\n     * Allow users to import once\n     */\n    SINGLE_IMPORT,\n\n    /**\n     * Users can import how many dashboards they want and reopen them later.\n     */\n    MULTIPLE_IMPORT;\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/DataSetContent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DataSetContent {\n\n    private String id;\n    private String content;\n    private DataSetContentType contentType;\n\n    public DataSetContent() {}\n\n    public DataSetContent(@MapsTo(\"id\") String id,\n                          @MapsTo(\"content\") String content,\n                          @MapsTo(\"contentType\") DataSetContentType contentType) {\n        this.id = id;\n        this.content = content;\n        this.contentType = contentType;\n    }\n\n    \n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getContent() {\n        return content;\n    }\n\n    public DataSetContentType getContentType() {\n        return contentType;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/DataSetContentType.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum DataSetContentType {\n\n    DEFINITION,\n    CSV;\n\n    public static DataSetContentType fromFileExtension(String ext) {\n        if (ext.equalsIgnoreCase(\"dset\")) {\n            return DEFINITION;\n        }\n\n        if (ext.equalsIgnoreCase(\"csv\")) {\n            return CSV;\n        }\n\n        throw new IllegalArgumentException(\"Extension not supported: \" + ext);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/ImportDefinitions.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\n/**\n * Holds Constants for the Import ZIP\n *\n */\npublic class ImportDefinitions {\n\n    public static final String DATASET_PREFIX = \"dashbuilder/datasets\";\n    public static final String DATASET_DEF_PREFIX = DATASET_PREFIX + \"/definitions\";\n    public static final String DATASET_SUFFIX = \".dset\";\n    \n    public static final String PERSPECTIVE_PREFIX = \"dashbuilder/perspectives\";\n    public static final String PERSPECTIVE_SUFFIX = \"perspective_layout\";\n\n    public static final String NAVIGATION_PREFIX = \"dashbuilder/navigation\";\n    public static final String NAVIGATION_FILE = NAVIGATION_PREFIX + \"/navigation/navtree.json\";\n    \n    public static final String COMPONENT_PREFIX = \"dashbuilder/components\";\n\n    private ImportDefinitions() {\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/RuntimeModel.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n/**\n * Representation of assets and information needed to build Runtime Dashbuilder client.\n *\n */\n@Portable\npublic class RuntimeModel {\n\n    NavTree navTree;\n\n    List<LayoutTemplate> layoutTemplates;\n    \n    Long lastModified;\n\n    public RuntimeModel(@MapsTo(\"navTree\") final NavTree navTree,\n                        @MapsTo(\"layoutTemplates\") final List<LayoutTemplate> layoutTemplates,\n                        @MapsTo(\"lastModified\") Long lastModified) {\n        this.navTree = navTree;\n        this.layoutTemplates = layoutTemplates;\n        this.lastModified = lastModified;\n    }\n\n    public NavTree getNavTree() {\n        return navTree;\n    }\n\n    public List<LayoutTemplate> getLayoutTemplates() {\n        return layoutTemplates;\n    }\n    \n    public Long getLastModified() {\n        return lastModified;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/model/RuntimeServiceResponse.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.model;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Runtime Service response model object that contains any useful information for the client.\n */\n@Portable\npublic class RuntimeServiceResponse {\n\n    private DashbuilderRuntimeMode mode;\n\n    private Optional<RuntimeModel> runtimeModelOp;\n\n    private List<String> availableModels;\n\n    public RuntimeServiceResponse() {\n        // not used\n    }\n\n    public RuntimeServiceResponse(@MapsTo(\"mode\") DashbuilderRuntimeMode mode,\n                                  @MapsTo(\"runtimeModelOp\") Optional<RuntimeModel> runtimeModelOp,\n                                  @MapsTo(\"availableModels\") List<String> availableModels) {\n        this.mode = mode;\n        this.runtimeModelOp = runtimeModelOp;\n        this.availableModels = availableModels;\n    }\n\n    public Optional<RuntimeModel> getRuntimeModelOp() {\n        return runtimeModelOp;\n    }\n\n    public List<String> getAvailableModels() {\n        return availableModels;\n    }\n\n    public DashbuilderRuntimeMode getMode() {\n        return mode;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/service/ImportValidationService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.service;\n\n/**\n * Validates an imported ZIP file\n *\n */\npublic interface ImportValidationService {\n\n    /**\n     * \n     * Validate the file from the given path. \n     * @param file\n     * The File path\n     * @return\n     * true if the file is valid, false otherwise;\n     */\n    public boolean validate(String file);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/service/RuntimeModelParser.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.service;\n\nimport java.io.InputStream;\n\nimport org.dashbuilder.shared.model.RuntimeModel;\n\n/**\n * Parses an imported content to RuntimeModel.\n *\n */\npublic interface RuntimeModelParser {\n\n    /**\n     * Parse the given input stream into a RuntimeModel.\n     * @param is\n     * The input stream with runtime model binary content to be parsed.\n     * @return\n     * The parsed runtime model.\n     */\n    RuntimeModel parse(String runtimeModelId, InputStream is);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/service/RuntimeModelRegistry.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.service;\n\nimport java.util.Collection;\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\n\nimport static org.dashbuilder.shared.model.DashbuilderRuntimeMode.MULTIPLE_IMPORT;\n\n/**\n * Provides access to a saved ImportModelService.\n *\n */\npublic interface RuntimeModelRegistry {\n\n    public default boolean acceptingNewImports() {\n        return getMode() == MULTIPLE_IMPORT ||\n               (getMode() == DashbuilderRuntimeMode.SINGLE_IMPORT && isEmpty());\n    }\n\n    /**\n     * Returns the first model available. \n     * \n     * @return\n     */\n    Optional<RuntimeModel> single();\n\n    /**\n     * Returns if this registry has at least one model.\n     * @return\n     */\n    boolean isEmpty();\n\n    /**\n     * Returns the registry mode\n     * \n     * @return\n     */\n    DashbuilderRuntimeMode getMode();\n\n    /**\n     * Get a previously registered import model.\n     * @param id\n     * @return\n     */\n    Optional<RuntimeModel> get(String id);\n\n    /**\n     * Sets this runtime mode.\n     * \n     * @param mode\n     * The mode to be used.\n     */\n    void setMode(DashbuilderRuntimeMode mode);\n\n    /**\n     * Store the import from a File path;\n     * @param filePath\n     * The path to the file.\n     */\n    Optional<RuntimeModel> registerFile(String filePath);\n\n    /**\n     * Removes a runtime model.\n     * @param runtimeModelid\n     * The id of the runtime model to be removed.\n     */\n    void remove(String runtimeModelid);\n    \n    /**\n     * Unregister a model from memory\n     * @param runtimeModelid\n     * The id of the runtime model to be unregistered.\n     */\n    void unregister(String runtimeModelid);\n\n    /**\n     * List all models that are currently available.\n     */\n    Collection<String> availableModels();\n\n    /**\n     * Remove all registered models.\n     */\n    void clear();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/service/RuntimeModelService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.service;\n\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.RuntimeServiceResponse;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Service to access RuntimeModel.\n *\n */\n@Remote\npublic interface RuntimeModelService {\n\n    /**\n     * Loads information about this installation.\n     * \n     * @param runtimeModelId\n     * A runtime model id to be loaded. Can be null or an empty String.\n     * @return\n     * \n     */\n    public RuntimeServiceResponse info(String runtimeModelId);\n\n    /**\n     * \n     * Get a runtime model given an ID.\n     * \n     * @param runtimeModelId\n     * The Runtime model represented by runtimeModelId.\n     * @return\n     * An optional containing the RuntimeModel or empty if the runtime model couldn't be found or built.\n     */\n    Optional<RuntimeModel> getRuntimeModel(String runtimeModelId);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/java/org/dashbuilder/shared/services/ExternalImportService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.services;\n\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.RuntimeModel;\n\n/**\n * Responsible for downloading external models and registering it\n *\n */\npublic interface ExternalImportService {\n    \n    /**\n     * Register an external model coming from an external server\n     * @param externalModelUrl\n     * the external model URL\n     * @return\n     * Optional containing the downloaded RuntimeModel or empty\n     */\n    Optional<RuntimeModel> registerExternalImport(String externalModelUrl);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\nerrai.marshalling.use_static_marshallers=false\nerrai.marshalling.force_static_marshallers=false \nerrai.ioc.enabled.alternatives=org.dashbuilder.client.plugins.RuntimePerspectivePluginManager \\\n\t\t\t\t\t\t\t   org.uberfire.client.plugin.RuntimePluginsServiceProxyClientImpl \\\n                               org.uberfire.client.workbench.WorkbenchServicesProxyClientImpl \\\n                               org.uberfire.client.workbench.VFSServiceProxyClientImpl \\\n                               org.uberfire.client.workbench.VFSLockServiceProxyClientImpl \\\n                               org.uberfire.preferences.client.store.PreferenceBeanStoreClientImpl \\\n\nerrai.ioc.denylist=org.uberfire.preferences.client.store.PreferenceBeanStoreImpl \\\n                    org.uberfire.client.RuntimePluginsServiceProxyBackendImpl \\\n                    org.uberfire.client.WorkbenchServicesProxyBackendImpl\n\nerrai.marshalling.serializableTypes=org.dashbuilder.dataprovider.StaticProviderType \\\n                                    org.dashbuilder.dataprovider.BeanProviderType \\\n                                    org.dashbuilder.dataprovider.CSVProviderType \\\n                                    org.dashbuilder.dataprovider.SQLProviderType \\\n                                    org.dashbuilder.dataset.ColumnType \\\n                                    org.dashbuilder.dataset.ColumnType \\\n                                    org.dashbuilder.dataset.DataSetLookup \\\n                                    org.dashbuilder.dataset.backend.EditDataSetDef \\\n                                    org.dashbuilder.dataset.date.DayOfWeek \\\n                                    org.dashbuilder.dataset.date.Month \\\n                                    org.dashbuilder.dataset.date.Quarter \\\n                                    org.dashbuilder.dataset.date.TimeAmount \\\n                                    org.dashbuilder.dataset.date.TimeFrame \\\n                                    org.dashbuilder.dataset.date.TimeInstant \\\n                                    org.dashbuilder.dataset.def.DataSetDef \\\n                                    org.dashbuilder.dataset.def.BeanDataSetDef \\\n                                    org.dashbuilder.dataset.def.CSVDataSetDef \\\n                                    org.dashbuilder.dataset.def.SQLDataSetDef \\\n                                    org.dashbuilder.dataset.def.SQLDataSourceDef \\\n                                    org.dashbuilder.dataset.def.StaticDataSetDef \\\n                                    org.dashbuilder.dataset.def.DataColumnDef \\\n                                    org.dashbuilder.dataset.events.DataSetDefModifiedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetDefRegisteredEvent \\\n                                    org.dashbuilder.dataset.events.DataSetDefRemovedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetModifiedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetPushingEvent \\\n                                    org.dashbuilder.dataset.events.DataSetPushOkEvent \\\n                                    org.dashbuilder.dataset.events.DataSetStaleEvent \\\n                                    org.dashbuilder.dataset.exception.DataSetLookupException \\\n                                    org.dashbuilder.dataset.filter.CoreFunctionFilter \\\n                                    org.dashbuilder.dataset.filter.CoreFunctionType \\\n                                    org.dashbuilder.dataset.filter.DataSetFilter \\\n                                    org.dashbuilder.dataset.filter.LogicalExprFilter \\\n                                    org.dashbuilder.dataset.filter.LogicalExprType \\\n                                    org.dashbuilder.dataset.group.AggregateFunctionType \\\n                                    org.dashbuilder.dataset.group.ColumnGroup \\\n                                    org.dashbuilder.dataset.group.DataSetGroup \\\n                                    org.dashbuilder.dataset.group.DateIntervalType \\\n                                    org.dashbuilder.dataset.group.GroupFunction \\\n                                    org.dashbuilder.dataset.group.GroupStrategy \\\n                                    org.dashbuilder.dataset.group.Interval \\\n                                    org.dashbuilder.dataset.impl.DataColumnImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetBuilderImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetLookupBuilderImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetMetadataImpl \\\n                                    org.dashbuilder.dataset.sort.ColumnSort \\\n                                    org.dashbuilder.dataset.sort.DataSetSort \\\n                                    org.dashbuilder.dataset.sort.SortedList"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/application-roles.properties",
    "content": "admin=admin\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/application-users.properties",
    "content": "admin=207b6e0cc556d7084b5e2db7d822555c\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/DashbuilderRuntime.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\t<inherits name=\"org.uberfire.UberfireClient\" />\n\t<inherits name=\"org.uberfire.UberfireBackend\"/>\n\t<inherits name=\"org.uberfire.client.views.PatternFlyTheme\" />\n\n\t<inherits name=\"org.uberfire.ext.plugin.RuntimePluginClient\" />\n\t<inherits name=\"org.uberfire.ext.preferences.UberfirePreferences\" />\n\t<inherits name=\"org.uberfire.preferences.UberfirePreferencesClient\"/>\n\t\n\t<!-- Navigation Dependency -->\n\t<inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementWidgets\"/>\n\n\t<!-- Experimental -->\n  \t<inherits name=\"org.uberfire.experimental.UberfireExperimentalAPI\"/>\n  \t<inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n\t<!-- Dashbuilder Client Deps -->\n\t<inherits name=\"org.dashbuilder.CommonClient\" />\n\t<inherits name=\"org.dashbuilder.CommonWidgets\" />\n\t<inherits name=\"org.dashbuilder.ServicesAPI\" />\n\t<inherits name=\"org.dashbuilder.DatasetAPI\" />\n\t<inherits name=\"org.dashbuilder.DatasetShared\" />\n\t<inherits name=\"org.dashbuilder.NavigationAPI\" />\n\t<inherits name=\"org.dashbuilder.NavigationClient\" />\n\t<inherits name=\"org.dashbuilder.DisplayerAPI\" />\n\t<inherits name=\"org.dashbuilder.DisplayerClient\" />\n\t<inherits name=\"org.dashbuilder.DisplayerScreen\" />\n\t<inherits name=\"org.dashbuilder.DisplayerEditor\" />\n\t<inherits name=\"org.dashbuilder.renderer.DefaultRenderer\" />\n\t<inherits name=\"org.dashbuilder.renderer.C3Renderer\" />\n  <inherits name=\"org.dashbuilder.DashbuilderKieServerAPI\"/>\n\n\t<source path=\"client\" />\n\t<source path=\"shared\" />\n\n\t<!-- We don't need to support IE10 or older -->\n\t<!-- There is no \"ie11\" permutation. IE11 uses the Firefox one (gecko1_8) -->\n\t<set-property name=\"user.agent\" value=\"gecko1_8,safari\" />\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/FastCompiledDashbuilderRuntime.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module rename-to=\"org.dashbuilder.DashbuilderRuntime\">\n\n  <inherits name=\"org.dashbuilder.DashbuilderRuntime\"/>\n\n  <set-property name=\"user.agent\" value=\"gecko1_8,safari\"/>\n  <set-property name=\"locale\" value=\"default\"/>\n\n  <collapse-all-properties />\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nEmptyScreenView.title=Dashboards are not available\nEmptyScreenView.subTitle=Dashboards were not imported. You can import them by uploading a file previously exported in Business Central.\nUploadWidgetView.importButton=Import Dashboards\nRuntimeScreenView.title=Welcome to Dashbuilder Runtimes\nRuntimeScreenView.subTitle=Select a Dashboard from menu to get started.\nNotFoundScreenView.title=Dashboard not found\nNotFoundScreenView.subTitle=Dashboard not found in this installation. Please check the dashboard name and try again.\nlogoutMenuTooltip=Logout\nerrorLoadingDashboards=Error Loading Dashboards\nloadingDashboards=Loading Dashboards\nerrorUploadingDashboards=Error Uploading Dashboards\nuploadingDashboards=Uploading Dashboards\nruntimeScreenTitle=Welcome to Dashboards\nuploadDashboardsTitle=Upload Dashboards\nnotFoundScreenTitle=Page not found\nnotFoundDashboard=Dashboard {0} not found. Please review the dashboard name and try again.\nrouterScreenTitle=Dashbuilder Runtime\ndashboardsListScreenTitle=Dashboards List\nDashboardsListScreenView.title=Available Dashboards\ndashboardListTooltip=Dashboards List\nlistDashboardsScreenTitle=Dashboards List\nrouterPerspective=Router\ndashboardAlreadyImport=Dashboard {0} already imported with name {1}\nimportSuccess=Dashboard {0} successfully imported\n\n# Error messages\ndisconnectedFromServer=Disconnected from server\ncouldNotConnectToServer=Could not connect to server. This very likely means a network problem. Do you want to reload the application?\nsessionTimeout=Session timeout\ninvalidBusResponseProbablySessionTimeout=Invalid response received from the server. This very likely means that you have been logged out due to inactivity. Do you want to log in again?\ndashboardOpenTooltip=Open this page in another tab"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_es.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nEmptyScreenView.title=Los cuadros de mando no están disponibles\nEmptyScreenView.subTitle=Los cuadros de mando no se han importado. Puede importarlos cargando un archivo previamente exportado en Business Central.\nUploadWidgetView.importButton=No hay cuadros de mando\nRuntimeScreenView.title=¡Bienvenido a Dashbuilder!\nRuntimeScreenView.subTitle=Seleccione un panel en el menú para empezar.\nNotFoundScreenView.title=No se encuentra el tablero de mandos\nNotFoundScreenView.subTitle=No se encuentra el tablero de mandos en esta instalación. Por favor, compruebe el nombre del panel de control y vuelva a intentarlo.\nlogoutMenuTooltip=Cierre de sesión\nerrorLoadingDashboards=Cargando el cuadro de mando ...\nloadingDashboards=Cargando el cuadro de mando ...\nerrorUploadingDashboards=Error al cargar los cuadros de mando\nuploadingDashboards=Carga de cuadros de mando\nruntimeScreenTitle=¡Bienvenido a Dashbuilder!\nuploadDashboardsTitle=No hay cuadros de mando\nnotFoundScreenTitle=No se encuentra la página\nnotFoundDashboard=Tablero {0} no encontrado. Por favor, revise el nombre del tablero y vuelva a intentarlo.\nrouterScreenTitle=Tiempo de ejecución de Dashbuilder\ndashboardsListScreenTitle=cuadros de mando\nDashboardsListScreenView.title=Cuadros de mando disponibles\ndashboardListTooltip=cuadros de mando\nlistDashboardsScreenTitle=cuadros de mando\nrouterPerspective=Router\ndashboardAlreadyImport=El tablero {0} ya se ha importado con el nombre \\ {1\\}\nimportSuccess=Proyecto importado correctamente.\n\n# Error messages\ndisconnectedFromServer=Desconectado del servidor\ncouldNotConnectToServer=No se pudo conectar al servidor. Es muy probable que esto implique la existencia de un problema en la red. ¿Desea recargar la aplicación?\nsessionTimeout=Tiempo de espera de la sesión\ninvalidBusResponseProbablySessionTimeout=Respuesta no válida recibida del servidor. Esto probablemente significa que se ha cerrado la sesión debido a la inactividad. ¿Desea iniciar sesión otra vez?\ndashboardOpenTooltip=Abrir esta página en otra pestaña"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_fr.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nEmptyScreenView.title=Les tableaux de bord ne sont pas disponibles\nEmptyScreenView.subTitle=Les tableaux de bord n''ont pas été importés. Vous pouvez les importer en téléchargeant un fichier précédemment exporté dans Business Central.\nUploadWidgetView.importButton=Tableaux de bord des importations\nRuntimeScreenView.title=Bienvenue dans les Runtimes de Dashbuilder !\nRuntimeScreenView.subTitle=Sélectionnez un tableau de bord dans le menu pour commencer.\nNotFoundScreenView.title=Tableau de bord non trouvé\nNotFoundScreenView.subTitle=Tableau de bord non trouvé dans cette installation. Veuillez vérifier le nom du tableau de bord et réessayer.\nlogoutMenuTooltip=Déconnexion\nerrorLoadingDashboards=Erreur lors du chargement des tableaux de bord…\nloadingDashboards=Chargement des tableaux de bord…\nerrorUploadingDashboards=Erreur lors du téléchargement des tableaux de bord…\nuploadingDashboards=Téléchargement des tableaux de bord\nruntimeScreenTitle=Bienvenue à Dashboards\nuploadDashboardsTitle=Télécharger les tableaux de bord\nnotFoundScreenTitle=Page introuvable\nnotFoundDashboard=Tableau de bord {0} non trouvé. Veuillez revoir le nom du tableau de bord et réessayer.\nrouterScreenTitle=Dashbuilder Runtime\ndashboardsListScreenTitle=Liste des tableaux de bord\nDashboardsListScreenView.title=Tableaux de bord disponibles\ndashboardListTooltip=Liste des tableaux de bord\nlistDashboardsScreenTitle=Liste des tableaux de bord\nrouterPerspective=Routeur\ndashboardAlreadyImport=Tableau de bord {0} déjà importé avec le nom {1}\nimportSuccess=Tableau de bord {0} importé avec succès\n\n# Error messages\ndisconnectedFromServer=Déconnecté du serveur\ncouldNotConnectToServer=Impossible de se connecter au serveur. Cela indique un probable problème réseau. Voulez-vous recharger l''application ?\nsessionTimeout=Timeout de session\ninvalidBusResponseProbablySessionTimeout=Réponse non valide reçue du serveur. Cela signifie probablement que vous avez été déconnecté en raison de votre inactivité. Voulez-vous vous reconnecter ?\ndashboardOpenTooltip=Ouvrir cette page dans un autre onglet"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_it.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nEmptyScreenView.title=I dashboard non sono disponibili\nEmptyScreenView.subTitle=I dashboard non sono stati importati. Puoi importarli caricando un file precedentemente esportato in Business Central.\nUploadWidgetView.importButton=Importa Dashboard\nRuntimeScreenView.title=Benvenuto in Dashbuilder Runtimes\nRuntimeScreenView.subTitle=Seleziona un Dashboard dal menu per iniziare.\nNotFoundScreenView.title=Dashboard non trovato\nNotFoundScreenView.subTitle=Dashboard non trovato in questa installazione. Controlla il nome del dashboard e riprova.\nlogoutMenuTooltip=Logout\nerrorLoadingDashboards=Errore durante il caricamento delle dashboard\nloadingDashboards=Caricamento delle dashboard in corso\nerrorUploadingDashboards=Errore durante l''importazione delle dashboard\nuploadingDashboards=Importazione delle dashboard in corso\nruntimeScreenTitle=Benvenuto in Dashboards\nuploadDashboardsTitle=Carica Dashboard\nnotFoundScreenTitle=Pagina non trovata\nnotFoundDashboard=Dashboard {0} non trovato. Controlla il nome del dashboard e riprova.\nrouterScreenTitle=Dashbuilder Runtime\ndashboardsListScreenTitle=Elenco delle Dashboard\nDashboardsListScreenView.title=Dashboard disponibili\ndashboardListTooltip=Elenco delle Dashboard\nlistDashboardsScreenTitle=Elenco delle Dashboard\nrouterPerspective=Router\ndashboardAlreadyImport=Dashboard {0} già importato con nome {1}\nimportSuccess=Dashboard {0} importato con successo\n\n# Error messages\ndisconnectedFromServer=Disconnesso dal server\ncouldNotConnectToServer=Impossibile connettersi al server. Molto probabilmente significa un problema di rete. Vuoi ricaricare l''applicazione?\nsessionTimeout=Timeout della sessione\ninvalidBusResponseProbablySessionTimeout=Risposta non valida ricevuta dal server. Molto probabilmente significa che sei stato disconnesso a causa di inattività. Vuoi effettuare nuovamente il login?\ndashboardOpenTooltip=Apri questa pagina in un''altra scheda\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_ja.properties",
    "content": "#\n# Copyright (C) 2020 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nEmptyScreenView.title=ダッシュボードは利用できません\nEmptyScreenView.subTitle=ダッシュボードはインポートされませんでした。以前に Business Central でエクスポートしたファイルをアップロードすることで、そのファイルをインポートできます。\nUploadWidgetView.importButton=ダッシュボードのインポート\nRuntimeScreenView.title=Dashbuilder Runtime にようこそ!\nRuntimeScreenView.subTitle=メニューからダッシュボードを選択して開始します。\nNotFoundScreenView.title=ダッシュボードが見つかりません\nNotFoundScreenView.subTitle=このインストールではダッシュボードが見つかりません。ダッシュボード名を確認して再試行してください。\nlogoutMenuTooltip=ログアウト\nerrorLoadingDashboards=ダッシュボードのロードエラー\nloadingDashboards=ダッシュボードのロード中\nerrorUploadingDashboards=ダッシュボードのアップロード中にエラー\nuploadingDashboards=ダッシュボードのアップロード\nruntimeScreenTitle=ダッシュボードへようこそ\nuploadDashboardsTitle=ダッシュボードのアップロード\nnotFoundScreenTitle=ページが見つかりません\nnotFoundDashboard=ダッシュボード {0} が見つかりません。ダッシュボード名を確認して再試行してください。\nrouterScreenTitle=Dashbuilder Runtime\ndashboardsListScreenTitle=ダッシュボードリスト\nDashboardsListScreenView.title=利用可能なダッシュボード\ndashboardListTooltip=ダッシュボードリスト\nlistDashboardsScreenTitle=ダッシュボードリスト\nrouterPerspective=ルーター\ndashboardAlreadyImport=ダッシュボード {0} はすでに {1} という名前でインポートされています\nimportSuccess=ダッシュボード {0} が正常にインポートされました\n\n# Error messages\ndisconnectedFromServer=サーバーから切断しました\ncouldNotConnectToServer=サーバーに接続できませんでした。これはネットワークの問題である可能性が非常に高いです。アプリケーションをリロードしますか?\nsessionTimeout=セッションタイムアウト\ninvalidBusResponseProbablySessionTimeout=サーバーから無効な応答を受け取りました。しばらく操作されなかったため、ログアウトした可能性が非常に高いです。再度ログインしますか?\ndashboardOpenTooltip=このページを別のタブで開く"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/WEB-INF/.gitignore",
    "content": "/classes/\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n\tbean-discovery-mode=\"all\">\n\t<scan>\n    <!-- These exclusions were added by Errai to avoid deploying client-side classes to the server -->\n    <!-- End of Errai exclusions -->\n\n\t\t<!-- These exclusions were added by Errai to avoid deploying client-side \n\t\t\tclasses to the server -->\n\t\t<!-- End of Errai exclusions -->\n\n\t\t<!-- These exclusions were added by Errai to avoid deploying client-side \n\t\t\tclasses to the server -->\n\t\t<!-- End of Errai exclusions -->\n\n\t\t<exclude name=\"org.hibernate.validator.**\" />\n\t\t<exclude name=\"org.dashbuilder.validations.**\" />\n\t\t<exclude name=\"org.dashbuilder.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.common.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.dataset.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.dataset.validation.**\" />\n\t\t<exclude name=\"org.dashbuilder.dataset.editor.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.displayer.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.renderer.client.**\" />\n\t\t<exclude name=\"org.dashbuilder.renderer.google.**\" />\n\t\t<exclude name=\"org.dashbuilder.renderer.chartjs.**\" />\n\t\t<exclude name=\"org.dashbuilder.renderer.lienzo.**\" />\n\n\t\t<!-- Uberfire -->\n\t\t<exclude name=\"org.uberfire.client.**\" />\n\t\t<exclude name=\"org.uberfire.security.client.**\" />\n\n\t\t<!-- UF Extensions -->\n\t\t<exclude name=\"org.uberfire.ext.apps.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.plugin.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.layout.editor.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.security.management.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.editor.commons.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.properties.editor.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.widgets.common.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.widgets.sandbox.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.widgets.core.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.widgets.table.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.wires.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.wires.bpmn.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.wires.core.api.**\" />\n\t\t<exclude name=\"org.uberfire.ext.wires.core.client.**\" />\n\t\t<exclude name=\"org.uberfire.ext.wires.core.trees.client.**\" />\n\t\t<exclude\n\t\t\tname=\"org.uberfire.ext.wires.core.scratchpad.client.**\" />\n\t\t<exclude\n\t\t\tname=\"org.uberfire.ext.wires.bayesian.network.client.**\" />\n\t</scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/WEB-INF/jboss-deployment-structure.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ JBoss, Home of Professional Open Source\n  ~ Copyright 2020 Red Hat Inc. and/or its affiliates and other contributors\n  ~ as indicated by the @author tags. All rights reserved.\n  ~ See the copyright.txt in the distribution for a\n  ~ full listing of individual contributors.\n  ~\n  ~ This copyrighted material is made available to anyone wishing to use,\n  ~ modify, copy, or redistribute it subject to the terms and conditions\n  ~ of the GNU Lesser General Public License, v. 2.1.\n  ~ This program is distributed in the hope that it will be useful, but WITHOUT A\n  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n  ~ PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.\n  ~ You should have received a copy of the GNU Lesser General Public License,\n  ~ v.2.1 along with this distribution; if not, write to the Free Software\n  ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n  ~ MA  02110-1301, USA.\n  -->\n<jboss-deployment-structure\n  xmlns=\"urn:jboss:deployment-structure:1.1\">\n  <deployment>\n    <dependencies>\n      <module name=\"javax.activation.api\" />\n      <module name=\"javax.persistence.api\" />\n      <module name=\"javax.servlet.api\" />\n      <module name=\"javax.transaction.api\" />\n      <module name=\"javax.validation.api\" />\n      <module name=\"org.jboss.logging\" />\n      <module name=\"org.jboss.logmanager\" />\n      <module name=\"org.jboss.marshalling\" />\n      <module name=\"org.jboss.xnio\" />\n      <module name=\"org.slf4j\" />\n\n      <!-- Module dependencies for Wildfly / EAP security management providers. -->\n      <module name=\"org.jboss.as.controller-client\" />\n      <module name=\"org.jboss.as.domain-management\" />\n      <module name=\"org.jboss.msc\" />\n      <module name=\"org.jboss.dmr\" />\n\n      <module\n        name=\"org.jboss.resteasy.resteasy-multipart-provider\" />\n      <module name=\"org.apache.xerces\" />\n      <module name=\"org.apache.xalan\" />\n\n    </dependencies>\n  </deployment>\n</jboss-deployment-structure>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/WEB-INF/jboss-web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<jboss-web>\n    <security-domain>other</security-domain>\n    <context-root>/</context-root>\n</jboss-web>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-app xmlns=\"http://java.sun.com/xml/ns/javaee\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n  version=\"2.5\">\n\n  <filter>\n    <filter-name>GzipFilter</filter-name>\n    <filter-class>org.dashbuilder.backend.gzip.GzipFilter</filter-class>\n  </filter>\n\n  <filter-mapping>\n    <filter-name>GzipFilter</filter-name>\n    <url-pattern>*.js</url-pattern>\n  </filter-mapping>\n\n  <servlet>\n    <servlet-name>ErraiServlet</servlet-name>\n    <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>\n\n    <init-param>\n      <param-name>service-locator</param-name>\n      <param-value>org.jboss.errai.cdi.server.CDIServiceLocator\n      </param-value>\n    </init-param>\n    <load-on-startup>1</load-on-startup>\n  </servlet>\n\n  <servlet-mapping>\n    <servlet-name>ErraiServlet</servlet-name>\n    <url-pattern>*.erraiBus</url-pattern>\n  </servlet-mapping>\n\n  <servlet>\n    <servlet-name>LoginRedirectServlet</servlet-name>\n    <servlet-class>org.dashbuilder.backend.security.LoginRedirectServlet</servlet-class>\n    <init-param>\n      <param-name>display-after-login</param-name>\n      <param-value>/dashbuilder.html</param-value>\n    </init-param>\n  </servlet>\n\n  <servlet-mapping>\n    <servlet-name>LoginRedirectServlet</servlet-name>\n    <url-pattern>/login</url-pattern>\n  </servlet-mapping>\n\n\n  <welcome-file-list>\n    <welcome-file>dashbuilder.html</welcome-file>\n  </welcome-file-list>\n\n  <!-- Custom Component assets server -->\n  <servlet>\n    <servlet-name>DashbuilderExternalComponentsServlet</servlet-name>\n    <servlet-class>org.dashbuilder.external.ExternalComponentServlet</servlet-class>\n    <!--  Enable this parameter to cache components and have a better performance\n    <init-param>\n      <param-name>cache-control</param-name>\n      <param-value>max-age=2592000</param-value>\n    </init-param>\n    -->\n  </servlet>\n  <servlet-mapping>\n    <servlet-name>DashbuilderExternalComponentsServlet</servlet-name>\n    <url-pattern>/dashbuilder/component/*</url-pattern>\n  </servlet-mapping>\n\n  <!-- Basic Auth Filter for REST API -->\n  <filter>\n    <filter-name>HTTP Basic Auth Filter</filter-name>\n    <filter-class>org.dashbuilder.backend.security.BasicAuthSecurityFilter</filter-class>\n    <init-param>\n      <param-name>realmName</param-name>\n      <param-value>Dashbuilder Runtime Realm</param-value>\n    </init-param>\n    <init-param>\n      <param-name>excludedPaths</param-name>\n      <param-value>/rest/upload,/rest/healthy,/rest/ready</param-value>\n    </init-param>\n  </filter>\n  <filter-mapping>\n    <filter-name>HTTP Basic Auth Filter</filter-name>\n    <url-pattern>/rest/api/*</url-pattern>\n  </filter-mapping>\n\n\n  <login-config>\n    <auth-method>FORM</auth-method>\n    <form-login-config>\n      <form-login-page>/login.html</form-login-page>\n      <form-error-page>/login.html?loginMessage=Login failed. Please try\n        again.</form-error-page>\n    </form-login-config>\n  </login-config>\n\n  <!-- Security roles -->\n  <security-role>\n    <description>Admin - Can import and read dashboards</description>\n    <role-name>admin</role-name>\n  </security-role>\n\n  <!-- Open resources for login page. -->\n  <security-constraint>\n    <web-resource-collection>\n      <web-resource-name>openResources</web-resource-name>\n      <url-pattern>/org.dashbuilder.DashbuilderRuntime/css/*\n      </url-pattern>\n      <url-pattern>/org.dashbuilder.DashbuilderRuntime/fonts/*\n      </url-pattern>\n      <url-pattern>/org.dashbuilder.DashbuilderRuntime/img/*\n      </url-pattern>\n      <url-pattern>/org.dashbuilder.DashbuilderRuntime/images/*\n      </url-pattern>\n      <!-- HealthCheck -->\n      <url-pattern>/rest/ready</url-pattern>\n      <url-pattern>/rest/healthy</url-pattern>\n\n    </web-resource-collection>\n  </security-constraint>\n\n  <error-page>\n    <error-code>403</error-code>\n    <location>/not_authorized.jsp</location>\n  </error-page>\n\n  <!-- Default security constraints. -->\n  <security-constraint>\n    <web-resource-collection>\n      <web-resource-name>default</web-resource-name>\n      <url-pattern>/rest/upload/*</url-pattern>\n      <url-pattern>/dashbuilder.html</url-pattern>\n      <url-pattern>/org.dashbuilder.DashbuilderRuntime/*</url-pattern>\n      <url-pattern>*.erraiBus</url-pattern>\n      <url-pattern>/plugins/*</url-pattern>\n      <url-pattern>/dashbuilder/component/*</url-pattern>\n    </web-resource-collection>\n    <auth-constraint>\n      <role-name>admin</role-name>\n    </auth-constraint>\n  </security-constraint>\n</web-app>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/banner/banner.html",
    "content": "<div class=\"navbar-header\">\n    <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse-5\">\n        <span class=\"sr-only\">Toggle navigation</span>\n        <span class=\"icon-bar\"></span>\n        <span class=\"icon-bar\"></span>\n        <span class=\"icon-bar\"></span>\n    </button>\n    <a class=\"navbar-brand\" href=\"#\">\n        <img src=\"banner/logo.png\"  alt=\"Open source dashboards and reporting\" />\n    </a>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/dashbuilder.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n\n<title>Dashbuilder Runtime</title>\n<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n<link rel=\"stylesheet\"\n    href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly.min.css\">\n</head>\n<body>\n    <iframe id=\"__gwt_historyFrame\"\n        style=\"width: 0; height: 0; border: 0\" title=\"GWTIframe\"></iframe>\n\n    <!--add loading indicator while the app is being loaded-->\n    <div id=\"loading\" class=\"container-fluid\">\n        <div class=\"row\">\n            <div class=\"col-lg-12\">\n                <div class=\"center-block text-center\">\n                    <div class=\"spinner spinner-lg\"></div>\n                </div>\n            </div>\n            <div class=\"col-lg-12\">\n                <div class=\"center-block text-center\">\n                    <h3>Please wait</h3>\n                </div>\n            </div>\n            <div class=\"col-lg-12\">\n                <div class=\"center-block text-center\">\n                    <span>Loading application...</span>\n                </div>\n            </div>\n        </div>\n    </div>\n\n    <!-- The GWT js file generated at run time -->\n    <script type=\"text/javascript\"\n        src='org.dashbuilder.DashbuilderRuntime/org.dashbuilder.DashbuilderRuntime.nocache.js'></script>\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/login.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\">\n<head>\n<title>Dashbuilder Runtime</title>\n<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\" />\n<link rel=\"stylesheet\"\n    href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly.min.css\" />\n<link rel=\"stylesheet\"\n    href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly-additions.min.css\" />\n</head>\n<body>\n\n\n    <div class=\"container\">\n        <div class=\"row\">\n            <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n                <p>\n                    <strong>Welcome to Dashbuilder Runtime!</strong>\n                </p>\n                <div class=\"alert alert-danger\" id=\"messageContainer\" style=\"display:none\">\n                    <span class=\"pficon pficon-error-circle-o\"></span> <strong\n                        id=\"errorMessage\"></strong>\n                </div>\n                <form class=\"form-horizontal\" role=\"form\"\n                    action=\"j_security_check\" method=\"post\">\n                    <div class=\"form-group\">\n                        <label for=\"j_username\"\n                            class=\"col-sm-2 col-md-2 control-label\"><i18n:message\n                                key=\"userName\">Username</i18n:message></label>\n                        <div class=\"col-sm-10 col-md-10\">\n                            <input type=\"text\" class=\"form-control\"\n                                id=\"j_username\" name=\"j_username\"\n                                placeholder=\"admin\" tabindex=\"1\"\n                                autofocus>\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <label for=\"j_password\"\n                            class=\"col-sm-2 col-md-2 control-label\"><i18n:message\n                                key=\"password\">Password</i18n:message></label>\n                        <div class=\"col-sm-10 col-md-10\">\n                            <input type=\"password\" class=\"form-control\"\n                                id=\"j_password\" name=\"j_password\"\n                                placeholder=\"admin\" tabindex=\"2\">\n                        </div>\n                    </div>\n                    <div class=\"form-group\">\n                        <div\n                            class=\"col-xs-8 col-sm-offset-2 col-sm-6 col-md-offset-2 col-md-6\">\n                        </div>\n                        <div class=\"col-xs-4 col-sm-4 col-md-4 submit\">\n                            <button type=\"submit\"\n                                class=\"btn btn-primary btn-lg\"\n                                tabindex=\"4\">Sign In</button>\n                        </div>\n                    </div>\n                </form>\n            </div>\n        </div>\n    </div>\n    <script type=\"text/javascript\">\n        var urlParams = new URLSearchParams(window.location.search);\n        var message = urlParams.get(\"loginMessage\");\n        var messageContainer = document.getElementById(\"messageContainer\");\n        if (message) {\n            messageContainer.style.display = \"block\";\n            document.getElementById(\"errorMessage\").textContent = message;\n        } else {\n            messageContainer.style.display = \"none\";\n        }\n    </script>\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/logout.jsp",
    "content": "<%--\n~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\"\n    pageEncoding=\"UTF-8\"%>\n<%\nrequest.logout();\njavax.servlet.http.HttpSession httpSession = request.getSession(false);\nif (httpSession != null) {\n    httpSession.invalidate();\n}\n%>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\" lang=\"en\">\n<head>\n<title>Dashbuilder Runtime</title>\n<link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\" />\n<link rel=\"stylesheet\"\n    href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly.min.css\" />\n<link rel=\"stylesheet\"\n    href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly-additions.min.css\" />\n</head>\n\n<body>\n    <div class=\"container\">\n        <div class=\"row\">\n            <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n                <p>\n                    <strong>Logout successful</strong>\n                </p>\n                <form class=\"form-horizontal\" role=\"form\"\n                    action=\"<%=request.getContextPath()%>/dashbuilder.html\"\n                    method=\"post\">\n                    <div class=\"form-group\">\n                        <div class=\"col-xs-4 col-sm-4 col-md-4 submit\"\n                            style=\"text-align: left;\">\n                            <button type=\"submit\"\n                                class=\"btn btn-primary btn-lg\"\n                                tabindex=\"4\">Login again</button>\n                        </div>\n                    </div>\n                </form>\n            </div>\n        </div>\n    </div>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/main/webapp/not_authorized.jsp",
    "content": "<%--\n~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>\n<%\n    request.getSession().invalidate();\n%>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\" lang=\"en\">\n<head>\n    <title>Dashbuilder Runtime</title>\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\" />\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly.min.css\" />\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderRuntime/css/patternfly-additions.min.css\" />\n</head>\n\n<body>\n<div class=\"container\">\n    <div class=\"row\">\n        <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n            <p><strong>Login failed: Not Authorized</strong></p>\n            <form class=\"form-horizontal\" role=\"form\" action=\"<%= request.getContextPath() %>/dashbuilder.html\" method=\"post\">\n                <div class=\"form-group\">\n                    <div class=\"col-xs-4 col-sm-4 col-md-4 submit\">\n                        <button type=\"submit\" class=\"btn btn-primary btn-lg\" tabindex=\"4\">\n                            Login as another user\n                        </button>\n                    </div>\n                </div>\n            </form>\n        </div>\n    </div>\n</div>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/DataSetContentListenerTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.dashbuilder.backend.services.dataset.RuntimeCSVFileStorage;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDefRegistry;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.shared.event.NewDataSetContentEvent;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.model.DataSetContent;\nimport org.dashbuilder.shared.model.DataSetContentType;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.ArgumentMatchers.matches;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DataSetContentListenerTest {\n\n    @Mock\n    DataSetDefRegistry registry;\n\n    @Mock\n    RuntimeCSVFileStorage storage;\n\n    @Mock\n    DataSetDefJSONMarshaller defMarshaller;\n\n    @Mock\n    Map<String, List<String>> runtimeModelDatasetContents;\n\n    @InjectMocks\n    DataSetContentListener datasetContentListener;\n\n    @Test\n    public void testRegister() throws Exception {\n        final String runtimeModelId = \"TEST\";\n        final String C1 = \"C1\";\n        final String C2 = \"C2\";\n        final String content2 = \"TESTCONTENT\";\n        final String content3 = \"TESTCSV\";\n        \n        List<DataSetContent> content = Arrays.asList(new DataSetContent(C1, content2, DataSetContentType.DEFINITION),\n                                                     new DataSetContent(C2, content3, DataSetContentType.CSV));\n        List<String> contentIds = Arrays.asList(C1, C2);\n        DataSetDef def = mock(DataSetDef.class);\n        when(defMarshaller.fromJson(matches(content2))).thenReturn(def);\n\n        datasetContentListener.register(new NewDataSetContentEvent(runtimeModelId, content));\n\n        verify(runtimeModelDatasetContents).put(runtimeModelId, contentIds);\n        verify(storage).storeCSV(C2, content3);\n        verify(def).setUUID(matches(C1));\n        verify(registry).registerDataSetDef(def);\n    }\n    \n    @Test\n    public void testUnregister() {\n        final String id = \"ID\";\n        final String C1 = \"C1\";\n        \n        List<String> registeredContent = Arrays.asList(C1);\n        when(runtimeModelDatasetContents.remove(matches(id))).thenReturn(registeredContent);\n        \n        datasetContentListener.unregister(new RemovedRuntimeModelEvent(id));\n        \n        verify(storage).deleteCSVFile(matches(C1));\n        verify(registry).removeDataSetDef(matches(C1));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/RuntimeModelLoaderTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Arrays;\n\nimport org.apache.commons.io.FileUtils;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.matches;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RuntimeModelLoaderTest {\n\n    Path baseTempDir;\n\n    @Mock\n    RuntimeModelRegistry registry;\n\n    @Mock\n    RuntimeOptions runtimeOptions;\n\n    @InjectMocks\n    RuntimeModelLoader runtimeModelLoader;\n\n    @Before\n    public void init() throws IOException {\n        baseTempDir = Files.createTempDirectory(\"dashbuilder-tests\");\n    }\n\n    @After\n    public void cleanup() {\n        FileUtils.deleteQuietly(baseTempDir.toFile());\n    }\n\n    @Test\n    public void testCreateBaseDir() {\n        String tempPath = Paths.get(baseTempDir.toString(), \"tmp\").toString();\n        when(runtimeOptions.getImportsBaseDir()).thenReturn(tempPath);\n        assertFalse(Paths.get(tempPath).toFile().exists());\n        runtimeModelLoader.setupBaseDir();\n        assertTrue(Paths.get(tempPath).toFile().exists());\n    }\n\n    @Test\n    public void testLoadAvailableModels() throws IOException {\n        String baseDir = baseTempDir.toString();\n        when(runtimeOptions.getImportsBaseDir()).thenReturn(baseDir);\n\n        Path p1 = Paths.get(baseDir, \"model1\" + RuntimeOptions.DASHBOARD_EXTENSION);\n        Path p2 = Paths.get(baseDir, \"model2\" + RuntimeOptions.DASHBOARD_EXTENSION);\n        Path p3 = Paths.get(baseDir, \"ignored.bkp\");\n        Path p4 = Paths.get(baseDir, \"intermediary\", \"ignored.bkp\");\n\n        p4.toFile().getParentFile().mkdirs();\n        \n        for (Path p : Arrays.asList(p1, p2, p3, p4)) {\n            p.toFile().createNewFile();\n        }\n\n        runtimeModelLoader.loadAvailableModels();\n\n        verify(registry).registerFile(matches(p1.toString()));\n        verify(registry).registerFile(matches(p2.toString()));\n        verify(registry, times(0)).registerFile(matches(p3.toString()));\n        verify(registry, times(0)).registerFile(matches(p4.toString()));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/helper/PartitionHelperTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.helper;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class PartitionHelperTest {\n    \n    @Test\n    public void testPartition() {\n        String id = PartitionHelper.partition(\"model\", \"abc\");\n        assertEquals(\"abc| RuntimeModel=model\", id);\n    }\n    \n    @Test\n    public void testRemovePartition() {\n        String id = PartitionHelper.removePartition(\"abc| RuntimeModel=model\");\n        assertEquals(\"abc\", id);\n    }\n    \n    @Test\n    public void testRemovePartitionWithoutSeparator() {\n        String idWithoutSeparator = \"abc\";\n        String id = PartitionHelper.removePartition(idWithoutSeparator);\n        assertEquals(idWithoutSeparator, id);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/navigation/RuntimeNavigationBuilderTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.navigation;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\npublic class RuntimeNavigationBuilderTest {\n\n    private static final String ITEM = \"item1\";\n    private static final String GROUP = \"group\";\n    private static final String EMPTY_GROUP = \"emptyGroup\";\n\n    RuntimeNavigationBuilder runtimeNavigationBuilder;\n\n    @Before\n    public void init() {\n        runtimeNavigationBuilder = new RuntimeNavigationBuilder();\n    }\n\n    /**\n     * Checks if groups are pruned correctly\n     */\n    @Test\n    public void groupPruneTest() {\n        NavTreeBuilder builder = new NavTreeBuilder();\n        LayoutTemplate lt = new LayoutTemplate(\"lt1\");\n\n        final String NOT_PRUNED_GROUP = \"notemptygroup\";\n        final String EMPTYCHILDGROUP = \"emptychildgroup\";\n        final String EMPTYONANONEMPTY = \"empty_on_a_not_empty\";\n\n        builder.group(EMPTY_GROUP, \"empty\", \"\", false);\n        builder.group(EMPTYCHILDGROUP, \"\", \"\", false);\n        builder.endGroup();\n        builder.endGroup();\n\n        builder.group(NOT_PRUNED_GROUP, \"notemptygroup\", \"\", false);\n        builder.item(ITEM, ITEM, \"\", false, NavWorkbenchCtx.perspective(lt.getName()));\n        builder.group(EMPTYONANONEMPTY, EMPTYONANONEMPTY, \"\", false);\n        builder.endGroup();\n        builder.endGroup();\n\n        List<LayoutTemplate> templates = new ArrayList<>();\n        templates.add(lt);\n        NavTree originalTree = builder.build();\n\n        assertEquals(2, originalTree.getRootItems().size());\n        assertNotNull(originalTree.getItemById(EMPTYONANONEMPTY));\n        assertNotNull(originalTree.getItemById(EMPTY_GROUP));\n        assertNotNull(originalTree.getItemById(EMPTYCHILDGROUP));\n\n        NavTree runtimeTree = runtimeNavigationBuilder.buildRuntimeTree(originalTree, templates);\n\n        assertNull(runtimeTree.getItemById(EMPTYONANONEMPTY));\n        assertNull(runtimeTree.getItemById(EMPTY_GROUP));\n        assertNull(runtimeTree.getItemById(EMPTYCHILDGROUP));\n\n        assertEquals(1, runtimeTree.getRootItems().size());\n        NavGroup notPrunedGroup = (NavGroup) runtimeTree.getItemById(NOT_PRUNED_GROUP);\n        NavItem item = runtimeTree.getItemById(ITEM);\n        assertNotNull(notPrunedGroup);\n        assertNotNull(item);\n        assertEquals(notPrunedGroup, item.getParent());\n        assertEquals(1, notPrunedGroup.getChildren().size());\n    }\n\n    @Test\n    public void removeItemWithoutTemplateTest() {\n        NavTreeBuilder builder = new NavTreeBuilder();\n        LayoutTemplate lt = new LayoutTemplate(\"lt1\");\n\n        final String ITEM_TO_REMOVE = \"item2\";\n\n        builder.group(GROUP, GROUP, \"\", false);\n        builder.item(ITEM, ITEM, \"\", false, NavWorkbenchCtx.perspective(lt.getName()));\n        builder.item(ITEM_TO_REMOVE, ITEM_TO_REMOVE, \"\", false);\n        builder.endGroup();\n\n        NavTree originalTree = builder.build();\n\n        assertNotNull(originalTree.getItemById(ITEM_TO_REMOVE));\n\n        List<LayoutTemplate> templates = new ArrayList<>();\n        templates.add(lt);\n        NavTree runtimeTree = runtimeNavigationBuilder.buildRuntimeTree(originalTree, templates);\n\n        assertEquals(1, runtimeTree.getRootItems().size());\n        NavGroup group = (NavGroup) runtimeTree.getItemById(GROUP);\n        assertNotNull(group);\n        assertEquals(1, group.getChildren().size());\n        assertNull(runtimeTree.getItemById(ITEM_TO_REMOVE));\n        assertNotNull(runtimeTree.getItemById(ITEM));\n    }\n\n    @Test\n    public void groupForOrphanItemsTest() {\n        final String ORPHAN_ITEM = \"orphanitem\";\n\n        NavTreeBuilder builder = new NavTreeBuilder();\n        LayoutTemplate lt = new LayoutTemplate(\"lt1\");\n        LayoutTemplate lt2 = new LayoutTemplate(ORPHAN_ITEM);\n\n        final String ITEM_TO_REMOVE = \"item2\";\n\n        builder.group(GROUP, GROUP, \"\", false);\n        builder.item(ITEM, ITEM, \"\", false, NavWorkbenchCtx.perspective(lt.getName()));\n        builder.item(ITEM_TO_REMOVE, ITEM_TO_REMOVE, \"\", false);\n        builder.endGroup();\n\n        List<LayoutTemplate> templates = Arrays.asList(lt, lt2);\n        NavTree originalTree = builder.build();\n        assertNull(originalTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID));\n        assertEquals(1, originalTree.getRootItems().size());\n\n        NavTree runtimeTree = runtimeNavigationBuilder.buildRuntimeTree(originalTree, templates);\n        assertEquals(2, runtimeTree.getRootItems().size());\n\n        NavGroup orphanItemsGroup = (NavGroup) runtimeTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID);\n        assertNotNull(orphanItemsGroup);\n        assertEquals(1, orphanItemsGroup.getChildren().size());\n\n        NavItem orphanItem = runtimeTree.getItemById(ORPHAN_ITEM);\n        String resourceId = NavWorkbenchCtx.get(orphanItem).getResourceId();\n        assertEquals(ORPHAN_ITEM, resourceId);\n        assertEquals(orphanItemsGroup, orphanItem.getParent());\n    }\n\n    @Test\n    public void treeForEmptyNavigationTest() {\n        LayoutTemplate lt1 = new LayoutTemplate(\"lt1\");\n        LayoutTemplate lt2 = new LayoutTemplate(\"lt2\");\n        LayoutTemplate lt3 = new LayoutTemplate(\"lt3\");\n\n        List<LayoutTemplate> templates = Arrays.asList(lt1, lt2, lt3);\n        NavTree runtimeTree = runtimeNavigationBuilder.build(Optional.empty(), templates);\n\n        NavGroup orphanItemsGroup = (NavGroup) runtimeTree.getItemById(RuntimeNavigationBuilder.ORPHAN_GROUP_ID);\n        assertNotNull(orphanItemsGroup);\n\n        assertEquals(3, orphanItemsGroup.getChildren().size());\n        assertTrue(containsLayoutTemplate(orphanItemsGroup, lt1));\n        assertTrue(containsLayoutTemplate(orphanItemsGroup, lt2));\n        assertTrue(containsLayoutTemplate(orphanItemsGroup, lt3));\n    }\n\n    private boolean containsLayoutTemplate(NavGroup group, LayoutTemplate lt) {\n        return group.getChildren().stream()\n                    .anyMatch(lt1 -> lt1.getName().equals(lt.getName()));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/services/impl/ImportValidationServiceImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class ImportValidationServiceImplTest {\n\n    ImportValidationServiceImpl importValidationService;\n\n    @Before\n    public void init() {\n        importValidationService = new ImportValidationServiceImpl();\n    }\n\n    @Test\n    public void validFileTest() {\n        String file = this.getClass().getResource(\"/valid_import.zip\").getFile();\n        assertTrue(importValidationService.validate(file));\n    }\n    \n    @Test\n    public void invalidFileTest() {\n        String file = this.getClass().getResource(\"/not_valid.zip\").getFile();\n        assertFalse(importValidationService.validate(file));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/services/impl/RuntimeInfoServiceImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.DashboardInfo;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeInfo;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.dashbuilder.shared.model.DashbuilderRuntimeMode.MULTIPLE_IMPORT;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RuntimeInfoServiceImplTest {\n\n    final static String RUNTIME_MODEL_ID = \"ID\";\n    final static String NOT_FOUND_ID = \"NOT FOUND\";\n    final static String LT_NAME = \"LAYOUT TEMPLATE\";\n\n    @Mock\n    RuntimeModel runtimeModel;\n\n    @Mock\n    RuntimeModelRegistry registry;\n\n    @InjectMocks\n    RuntimeInfoServiceImpl runtimeInfoService;\n\n    @Before\n    public void init() {\n        LayoutTemplate lt = new LayoutTemplate(LT_NAME);\n        when(runtimeModel.getLayoutTemplates()).thenReturn(Arrays.asList(lt));\n        when(registry.getMode()).thenReturn(MULTIPLE_IMPORT);\n        when(registry.get(RUNTIME_MODEL_ID)).thenReturn(Optional.of(runtimeModel));\n        when(registry.get(NOT_FOUND_ID)).thenReturn(Optional.empty());\n        when(registry.availableModels()).thenReturn(new HashSet<>(Arrays.asList(RUNTIME_MODEL_ID)));\n    }\n\n    @Test\n    public void testInfo() {\n        DashbuilderRuntimeInfo info = runtimeInfoService.info();\n\n        assertEquals(1, info.getAvailableModels().size());\n        assertTrue(info.getAvailableModels().contains(RUNTIME_MODEL_ID));\n        assertEquals(MULTIPLE_IMPORT.name(), info.getMode());\n        assertFalse(info.isAcceptingNewImports());\n    }\n\n    @Test\n    public void testDashboardInfoWithFoundModel() {\n        Optional<DashboardInfo> dashboardInfoOp = runtimeInfoService.dashboardInfo(RUNTIME_MODEL_ID);\n        DashboardInfo dashboardInfo = dashboardInfoOp.get();\n        assertEquals(1, dashboardInfo.getPages().size());\n        assertTrue(dashboardInfo.getPages().contains(LT_NAME));\n        assertEquals(RUNTIME_MODEL_ID, dashboardInfo.getRuntimeModelId());\n    }\n\n    @Test\n    public void testDashboardInfoWithNotFoundModel() {\n        Optional<DashboardInfo> dashboardInfoOp = runtimeInfoService.dashboardInfo(NOT_FOUND_ID);\n        assertFalse(dashboardInfoOp.isPresent());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/services/impl/RuntimeModelParserImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.backend.helper.PartitionHelper;\nimport org.dashbuilder.backend.navigation.RuntimeNavigationBuilder;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.shared.event.NewDataSetContentEvent;\nimport org.dashbuilder.shared.model.DataSetContent;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelRegistry;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.dashbuilder.shared.model.DataSetContentType.CSV;\nimport static org.dashbuilder.shared.model.DataSetContentType.DEFINITION;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RuntimeModelParserImplTest {\n\n    @Mock\n    Event<NewDataSetContentEvent> newDataSetContentEventSource;\n\n    @Mock\n    RuntimeNavigationBuilder navigationBuilder;\n    \n    @Mock\n    RuntimeOptions runtimeOptions;\n    \n    @Mock\n    RuntimeModelRegistry runtimeModelRegistry;\n    \n    @Mock\n    ComponentLoader externalComponentLoader;\n\n    @InjectMocks\n    RuntimeModelParserImpl parser;\n\n    @Test\n    public void testEmptyImport() throws IOException {\n        when(navigationBuilder.build(any(), any())).thenReturn(new NavTreeBuilder().build());\n        InputStream emptyImport = this.getClass().getResourceAsStream(\"/empty.zip\");\n        RuntimeModel runtimeModel = parser.retrieveRuntimeModel(\"\", emptyImport);\n\n        verify(newDataSetContentEventSource, times(0)).fire(any());\n        assertTrue(runtimeModel.getLayoutTemplates().isEmpty());\n        assertTrue(runtimeModel.getNavTree().getRootItems().isEmpty());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testValidImport() throws IOException {\n        parser.init();\n        InputStream validImport = this.getClass().getResourceAsStream(\"/valid_import.zip\");\n        RuntimeModel runtimeModel = parser.parse(\"\", validImport);\n\n        @SuppressWarnings(\"rawtypes\")\n        ArgumentCaptor<Optional> navigationContent = ArgumentCaptor.forClass(Optional.class);\n        verify(navigationBuilder).build(navigationContent.capture(), any());\n        assertEquals(\"{}\", navigationContent.getValue().get());\n\n        List<LayoutTemplate> layoutTemplates = runtimeModel.getLayoutTemplates();\n        assertEquals(1, layoutTemplates.size());\n\n        LayoutTemplate layoutTemplate = layoutTemplates.get(0);\n        assertEquals(\"life_expectancy\", layoutTemplate.getName());\n        assertEquals(3, layoutTemplate.getVersion());\n\n        ArgumentCaptor<NewDataSetContentEvent> datasetContents = ArgumentCaptor.forClass(NewDataSetContentEvent.class);\n        verify(newDataSetContentEventSource).fire(datasetContents.capture());\n\n        NewDataSetContentEvent newDataSetContentEvent = datasetContents.getValue();\n        assertEquals(2, newDataSetContentEvent.getContent().size());\n\n        List<DataSetContent> datasets = newDataSetContentEvent.getContent();\n        assertEquals(2, datasets.size());\n        assertEquals(\"e26a81a1-5636-493c-96e0-51bc32322b17\", datasets.get(0).getId());\n        assertEquals(\"e26a81a1-5636-493c-96e0-51bc32322b17\", datasets.get(1).getId());\n        Predicate<DataSetContent> csvMatcher = ds -> ds.getContentType().equals(CSV);\n        Predicate<DataSetContent> defMatcher = ds -> ds.getContentType().equals(DEFINITION);\n        assertTrue(datasets.stream().anyMatch(csvMatcher));\n        assertTrue(datasets.stream().anyMatch(defMatcher));\n        String dsContent = datasets.stream().filter(defMatcher).findAny().get().getContent();\n        String csvContent = datasets.stream().filter(csvMatcher).findAny().get().getContent();\n\n        assertEquals(getFileContent(\"/ds.dset\"), dsContent);\n        assertEquals(getFileContent(\"/ds.csv\"), csvContent);\n    }\n    \n    @Test\n    public void testTransformedUuid() {\n        when(runtimeOptions.isMultipleImport()).thenReturn(true);\n        when(runtimeOptions.isDatasetPartition()).thenReturn(true);\n        final String runtimeModelId = \"123\";\n        final String transformedId = PartitionHelper.partition(runtimeModelId, \"e26a81a1-5636-493c-96e0-51bc32322b17\");\n        \n        parser.init();\n        InputStream validImport = this.getClass().getResourceAsStream(\"/valid_import.zip\");\n        RuntimeModel runtimeModel = parser.parse(runtimeModelId, validImport);\n\n        List<LayoutTemplate> layoutTemplates = runtimeModel.getLayoutTemplates();\n        \n        // check if ID in the layout template component was transformed\n        LayoutTemplate layoutTemplate = layoutTemplates.get(0);\n        String json = layoutTemplate.getRows().get(1).getLayoutColumns().get(0).getLayoutComponents().get(0).getProperties().get(\"json\");\n        String loadedUUID = DisplayerSettingsJSONMarshaller.get().fromJsonString(json).getDataSetLookup().getDataSetUUID();\n        assertEquals(transformedId, loadedUUID);\n        \n        // check if dataset ID was changed\n        ArgumentCaptor<NewDataSetContentEvent> datasetContents = ArgumentCaptor.forClass(NewDataSetContentEvent.class);\n        verify(newDataSetContentEventSource).fire(datasetContents.capture());\n        NewDataSetContentEvent newDataSetContentEvent = datasetContents.getValue();\n        List<DataSetContent> datasets = newDataSetContentEvent.getContent();\n\n        assertEquals(transformedId, datasets.get(0).getId());\n        assertEquals(transformedId, datasets.get(1).getId());\n        \n    }\n    \n    @Test\n    public void testUnzipComponentFile() throws IOException, URISyntaxException {\n        Path componentPath = Paths.get(this.getClass().getResource(\"/\").toURI());\n        when(externalComponentLoader.getExternalComponentsDir()).thenReturn(componentPath.toString());\n        \n        String componentFileContent1 = \"This is a component file.\";\n        String fileName = \"component1/someFile.txt\";\n\n        InputStream zis = new ByteArrayInputStream(componentFileContent1.getBytes());\n        \n        parser.extractComponentFile(\"test\", zis, fileName);\n        \n        Path componentFilePath = componentPath.resolve(fileName);\n        assertTrue(Files.exists(componentFilePath));\n        assertEquals(componentFileContent1, Files.readAllLines(componentFilePath).get(0));\n        Files.delete(componentFilePath);\n    }\n    \n    @Test\n    public void testUnzipComponentFileWithPartition() throws IOException, URISyntaxException {\n        Path componentPath = Paths.get(this.getClass().getResource(\"/\").toURI());\n        \n        when(externalComponentLoader.getExternalComponentsDir()).thenReturn(componentPath.toString());\n        when(runtimeOptions.isComponentPartition()).thenReturn(true);\n        when(runtimeOptions.isMultipleImport()).thenReturn(true);\n        \n        String modelId = \"testModel\";\n        String componentFileContent1 = \"This is a component file.\";\n        String fileName = \"component1/someFile.txt\";\n\n        InputStream zis = new ByteArrayInputStream(componentFileContent1.getBytes());\n        \n        parser.extractComponentFile(modelId, zis, fileName);\n        \n        Path componentFilePath = Paths.get(componentPath.toString(), modelId, fileName);\n        \n        assertTrue(Files.exists(componentFilePath));\n        assertEquals(componentFileContent1, Files.readAllLines(componentFilePath).get(0));\n        Files.delete(componentFilePath);\n    }\n\n    private String getFileContent(String resource) throws IOException {\n        Path csvActualPath = Paths.get(this.getClass()\n                                           .getResource(resource)\n                                           .getFile());\n        return Files.readAllLines(csvActualPath)\n                    .stream()\n                    .collect(Collectors.joining(System.lineSeparator()));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/backend/services/impl/RuntimeModelRegistryImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend.services.impl;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.backend.RuntimeOptions;\nimport org.dashbuilder.shared.event.RemovedRuntimeModelEvent;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.ImportValidationService;\nimport org.dashbuilder.shared.service.RuntimeModelParser;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.apache.commons.io.FilenameUtils;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.AdditionalMatchers.or;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RuntimeModelRegistryImplTest {\n\n    @Mock\n    ImportValidationService importValidationService;\n\n    @Mock\n    Map<String, RuntimeModel> runtimeModels;\n\n    @Mock\n    RuntimeModelParser parser;\n\n    @Mock\n    RuntimeOptions options;\n\n    @Mock\n    Event<RemovedRuntimeModelEvent> removedRuntimeModelEvent;\n\n    @InjectMocks\n    RuntimeModelRegistryImpl registry;\n\n    private Path tempFile;\n    private Path tempFile2;\n\n    @Before\n    public void init() throws IOException {\n        tempFile = Files.createTempFile(\"test\", RuntimeOptions.DASHBOARD_EXTENSION);\n        tempFile2 = Files.createTempFile(\"test\", RuntimeOptions.DASHBOARD_EXTENSION);\n        registry.setRemovedRuntimeModelEvent(removedRuntimeModelEvent);\n    }\n\n    @After\n    public void cleanup() throws IOException {\n        Files.deleteIfExists(tempFile);\n        Files.deleteIfExists(tempFile2);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileEmpty() {\n        registry.registerFile(\"\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileNull() {\n        registry.registerFile(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileNotExist() {\n        registry.registerFile(\"file\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileInvalid() throws IOException {\n        String file = tempFile.toString();\n\n        when(importValidationService.validate(file)).thenReturn(false);\n\n        registry.registerFile(file);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileNotAcceptingImports() throws IOException {\n        String file = tempFile.toString();\n\n        when(importValidationService.validate(file)).thenReturn(true);\n        // to make sure that it is not accepting new imports\n        registry.setMode(DashbuilderRuntimeMode.STATIC);\n\n        registry.registerFile(file);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testRegisterFileParsingError() throws IOException {\n        String file = tempFile.toString();\n        String importId = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n\n        when(runtimeModels.isEmpty()).thenReturn(true);\n        when(importValidationService.validate(file)).thenReturn(true);\n        when(parser.parse(eq(importId), any())).thenThrow(new RuntimeException());\n\n        registry.registerFile(file);\n    }\n\n    @Test\n    public void testRegisterFileSuccess() throws IOException {\n        String file = tempFile.toString();\n        String importId = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n        RuntimeModel runtimeModel = mock(RuntimeModel.class);\n\n        when(runtimeModels.isEmpty()).thenReturn(true);\n        when(importValidationService.validate(file)).thenReturn(true);\n        when(parser.parse(eq(importId), any())).thenReturn(runtimeModel);\n\n        registry.registerFile(file);\n\n        verify(runtimeModels).put(eq(importId), eq(runtimeModel));\n    }\n\n    @Test\n    public void testRegisterFileSuccessMultiMode() throws IOException {\n\n        String file1 = tempFile.toString();\n        String file2 = tempFile2.toString();\n\n        String importId1 = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n        String importId2 = FilenameUtils.getBaseName(tempFile2.toFile().getPath());\n\n        RuntimeModel runtimeModel1 = mock(RuntimeModel.class);\n        RuntimeModel runtimeModel2 = mock(RuntimeModel.class);\n\n\n        when(importValidationService.validate(or(eq(file1), eq(file2)))).thenReturn(true);\n        when(parser.parse(eq(importId1), any())).thenReturn(runtimeModel1);\n        when(parser.parse(eq(importId2), any())).thenReturn(runtimeModel2);\n\n        registry.setMode(DashbuilderRuntimeMode.MULTIPLE_IMPORT);\n\n        registry.registerFile(file1);\n        verify(runtimeModels).put(eq(importId1), eq(runtimeModel1));\n\n        registry.registerFile(file2);\n        verify(runtimeModels).put(eq(importId2), eq(runtimeModel2));\n    }\n\n    @Test\n    public void testSingle() {\n        RuntimeModel model1 = mock(RuntimeModel.class);\n        when(runtimeModels.values()).thenReturn(Collections.singleton(model1));\n        assertEquals(model1, registry.single().get());\n    }\n\n    @Test\n    public void testGetInMultipleMode() {\n        registry.setMode(DashbuilderRuntimeMode.MULTIPLE_IMPORT);\n        String id = \"ID\";\n        registry.get(id);\n        verify(runtimeModels).get(eq(id));\n    }\n\n    @Test\n    public void testGetWithSingleMode() {\n        registry.setMode(DashbuilderRuntimeMode.SINGLE_IMPORT);\n        String id = \"ID\";\n        RuntimeModel model1 = mock(RuntimeModel.class);\n\n        when(runtimeModels.values()).thenReturn(Collections.singleton(model1));\n\n        assertEquals(model1, registry.single().get());\n\n        verify(runtimeModels, Mockito.times(0)).get(eq(id));\n        verify(runtimeModels).values();\n    }\n\n    @Test\n    public void testRemoveExistingModel() throws IOException {\n        String file = tempFile.toString();\n\n        String importId = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n        RuntimeModel runtimeModel = mock(RuntimeModel.class);\n\n        when(options.buildFilePath(eq(importId))).thenReturn(tempFile.toFile().getPath());\n        when(runtimeModels.remove(eq(importId))).thenReturn(runtimeModel);\n\n        when(options.isRemoveModelFile()).thenReturn(true);\n\n        registry.remove(importId);\n\n        verify(runtimeModels).remove(eq(importId));\n        verify(removedRuntimeModelEvent).fire(any());\n        assertFalse(Files.exists(Paths.get(file)));\n    }\n\n    @Test\n    public void testRemoveWithoutDeletingFile() throws IOException {\n        String file = tempFile.toString();\n        String importId = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n        RuntimeModel runtimeModel = mock(RuntimeModel.class);\n\n        when(runtimeModels.remove(eq(importId))).thenReturn(runtimeModel);\n\n        when(options.isRemoveModelFile()).thenReturn(false);\n\n        registry.remove(importId);\n\n        verify(runtimeModels).remove(eq(importId));\n        verify(removedRuntimeModelEvent).fire(any());\n        assertTrue(Files.exists(Paths.get(file)));\n    }\n\n    @Test\n    public void testRemoveNotExistingModel() throws IOException {\n        String file = tempFile.toString();\n        String importId = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n\n        registry.remove(importId);\n\n        verify(runtimeModels).remove(eq(importId));\n        verify(removedRuntimeModelEvent, times(0)).fire(any());\n        assertTrue(Files.exists(Paths.get(file)));\n    }\n\n    @Test\n    public void testClear() throws IOException {\n        String importId1 = FilenameUtils.getBaseName(tempFile.toFile().getPath());\n        String importId2 = FilenameUtils.getBaseName(tempFile2.toFile().getPath());\n\n        when(options.buildFilePath(eq(importId1))).thenReturn(tempFile.toFile().getPath());\n        when(options.buildFilePath(eq(importId2))).thenReturn(tempFile2.toFile().getPath());\n        when(options.isRemoveModelFile()).thenReturn(true);\n\n        Set<String> keys = new HashSet<>();\n        keys.add(importId1);\n        keys.add(importId2);\n        when(runtimeModels.keySet()).thenReturn(keys);\n        \n        when(runtimeModels.remove(importId1)).thenReturn(mock(RuntimeModel.class));\n        when(runtimeModels.remove(importId2)).thenReturn(mock(RuntimeModel.class));\n\n        registry.clear();\n\n        verify(removedRuntimeModelEvent, times(2)).fire(any());\n        verify(runtimeModels).clear();\n        assertFalse(Files.exists(Paths.get(tempFile.toString())));\n        assertFalse(Files.exists(Paths.get(tempFile2.toString())));\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/client/ClientRuntimeModelLoaderTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\nimport java.util.function.Consumer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.perspective.generator.RuntimePerspectiveGenerator;\nimport org.dashbuilder.client.plugins.RuntimePerspectivePluginManager;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.service.RuntimeModelService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ClientRuntimeModelLoaderTest {\n\n    CallerMock<RuntimeModelService> importModelServiceCaller;\n\n    @Mock\n    RuntimeModelService runtimeModelService;\n\n    @Mock\n    RuntimePerspectiveGenerator runtimePerspectiveGenerator;\n\n    @Mock\n    RuntimePerspectivePluginManager runtimePerspectivePluginManager;\n\n    @Mock\n    NavigationManager navigationManager;\n    \n    @Mock\n    BusyIndicatorView loading;\n\n    RuntimeClientLoader clientRuntimeModelLoader;\n\n    @Before\n    public void setup() {\n        importModelServiceCaller = new CallerMock<>(runtimeModelService);\n        clientRuntimeModelLoader = new RuntimeClientLoader(importModelServiceCaller,\n                                                                runtimePerspectiveGenerator,\n                                                                runtimePerspectivePluginManager,\n                                                                navigationManager,\n                                                                loading);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testLoadModelSuccess() {\n        String modelId = \"abc\";\n        LayoutTemplate perspective = mock(LayoutTemplate.class);\n        List<LayoutTemplate> perspectives = Arrays.asList(perspective);\n        NavTree navTree = mock(NavTree.class);\n        RuntimeModel runtimeModel = new RuntimeModel(navTree, perspectives, System.currentTimeMillis());\n        when(runtimeModelService.getRuntimeModel(eq(modelId))).thenReturn(Optional.of(runtimeModel));\n\n        Consumer<RuntimeModel> runtimeModelConsumer = mock(Consumer.class);\n        Command empty = mock(Command.class);\n        BiConsumer<Object, Throwable> error = mock(BiConsumer.class);\n\n        clientRuntimeModelLoader.loadModel(modelId, runtimeModelConsumer, empty, error);\n\n        verify(runtimeModelConsumer).accept(runtimeModel);\n        verify(runtimePerspectiveGenerator).generatePerspective(eq(perspective));\n        verify(runtimePerspectivePluginManager).setTemplates(eq(perspectives));\n        verify(navigationManager).setDefaultNavTree(navTree);\n\n        verify(empty, times(0)).execute();\n        verify(error, times(0)).accept(any(), any());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testLoadModelNotFound() {\n        when(runtimeModelService.getRuntimeModel(any())).thenReturn(Optional.empty());\n\n        Consumer<RuntimeModel> runtimeModelConsumer = mock(Consumer.class);\n        Command empty = mock(Command.class);\n        BiConsumer<Object, Throwable> error = mock(BiConsumer.class);\n\n        clientRuntimeModelLoader.loadModel(\"\", runtimeModelConsumer, empty, error);\n\n        verify(runtimeModelConsumer, times(0)).accept(any());\n        verify(empty, times(1)).execute();\n        verify(error, times(0)).accept(any(), any());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testLoadModelError() {\n        when(runtimeModelService.getRuntimeModel(any())).thenThrow(new RuntimeException());\n\n        Consumer<RuntimeModel> runtimeModelConsumer = mock(Consumer.class);\n        Command empty = mock(Command.class);\n        BiConsumer<Object, Throwable> error = mock(BiConsumer.class);\n\n        clientRuntimeModelLoader.loadModel(\"\", runtimeModelConsumer, empty, error);\n\n        verify(runtimeModelConsumer, times(0)).accept(any());\n        verify(empty, times(0)).execute();\n        verify(error, times(1)).accept(any(), any());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/client/error/DefaultRuntimeErrorCallbackTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.error;\n\nimport org.junit.Test;\n\nimport static org.dashbuilder.client.error.DefaultRuntimeErrorCallback.PARSING_JSON_MSG;\nimport static org.dashbuilder.client.error.DefaultRuntimeErrorCallback.SCRIPT_ERROR_MSG;\nimport static org.dashbuilder.client.error.DefaultRuntimeErrorCallback.extractMessageRecursively;\nimport static org.dashbuilder.client.error.DefaultRuntimeErrorCallback.PARSING_JSON_SYNTAX_MSG;\nimport static org.dashbuilder.client.error.DefaultRuntimeErrorCallback.isServerOfflineException;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class DefaultRuntimeErrorCallbackTest {\n\n    @Test\n    public void testIsServerOfflineException() {\n        assertTrue(isServerOfflineException(new Exception(PARSING_JSON_SYNTAX_MSG)));\n        assertTrue(isServerOfflineException(new Exception(PARSING_JSON_MSG)));\n        assertTrue(isServerOfflineException(new Exception(SCRIPT_ERROR_MSG)));\n        \n        assertFalse(isServerOfflineException(new Exception()));\n        assertFalse(isServerOfflineException(new Exception(\"any message\")));\n    }\n\n    @Test\n    public void testExtractMessageRecursively() {\n        Exception cause = new Exception(\"CAUSE\");\n        Exception intermediary = new Exception(\"INTERMEDIARY\", cause);\n        Exception e = new Exception(\"FIRST\", intermediary);\n        String message = DefaultRuntimeErrorCallback.extractMessageRecursively(e);\n        assertEquals(\"FIRST Caused by: INTERMEDIARY Caused by: CAUSE\", message);\n\n        String MESSAGE = \"Message\";\n        message = extractMessageRecursively(new Exception(MESSAGE));\n        assertEquals(MESSAGE, message);\n\n        assertEquals(\"\", extractMessageRecursively(null));\n        \n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/client/screens/RouterScreenTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.client.navbar.AppNavBar;\nimport org.dashbuilder.client.perspective.DashboardsListPerspective;\nimport org.dashbuilder.client.perspective.EmptyPerspective;\nimport org.dashbuilder.client.perspective.RuntimePerspective;\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.dashbuilder.shared.model.RuntimeServiceResponse;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RouterScreenTest {\n    \n    @Mock\n    PlaceManager placeManager;\n    \n    @Mock\n    AppNavBar appNavBar;\n\n    @Mock\n    RuntimeScreen runtimeScreen;\n    \n    @Mock\n    DashboardsListScreen dashboardsListScreen;\n    \n    @InjectMocks\n    RouterScreen routerScreen;\n    \n    @Test\n    public void testRouteToRuntimePerspective() {\n        RuntimeModel runtimeModel = mock(RuntimeModel.class);\n        RuntimeServiceResponse response = new RuntimeServiceResponse(DashbuilderRuntimeMode.SINGLE_IMPORT, \n                                                                     Optional.of(runtimeModel), \n                                                                     Collections.emptyList());\n        routerScreen.route(response);\n        \n        verify(runtimeScreen).loadDashboards(eq(runtimeModel));\n        verify(placeManager).goTo(eq(RuntimePerspective.ID));\n    }\n    \n    @Test\n    public void testRouteToEmptyPerspective() {\n        RuntimeServiceResponse response = new RuntimeServiceResponse(DashbuilderRuntimeMode.SINGLE_IMPORT, \n                                                                     Optional.empty(), \n                                                                     Collections.emptyList());\n        routerScreen.route(response);\n        \n        verify(placeManager).goTo(eq(EmptyPerspective.ID));\n    }\n    \n    \n    @Test\n    public void testRouteToDashboardsListPerspective() {\n        List<String> models = Arrays.asList(\"m1\", \"m2\");\n        RuntimeServiceResponse response = new RuntimeServiceResponse(DashbuilderRuntimeMode.MULTIPLE_IMPORT, \n                                                                     Optional.empty(), \n                                                                     models);\n        routerScreen.route(response);\n        \n        verify(dashboardsListScreen).loadList(eq(models));\n        verify(placeManager).goTo(eq(DashboardsListPerspective.ID));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/client/screens/RuntimeScreenTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.screens;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RuntimeScreenTest {\n\n    @Mock\n    PlaceManager placeManager;\n\n    @InjectMocks\n    RuntimeScreen runtimeScreen;\n\n    @Test\n    public void testGoToIndexWithIndexPage() {\n        String randomPage = \"randomPage\";\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(randomPage),\n                                                       new LayoutTemplate(RuntimeScreen.INDEX_PAGE_NAME));\n        \n        runtimeScreen.goToIndex(templates);\n\n        verify(placeManager).goTo(RuntimeScreen.INDEX_PAGE_NAME);\n        verify(placeManager, times(0)).goTo(randomPage);\n    }\n\n    @Test\n    public void testGoToIndexWithSinglePage() {\n        String randomPage = \"randomPage\";\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(randomPage));\n\n        runtimeScreen.goToIndex(templates);\n\n        verify(placeManager).goTo(randomPage);\n    }\n\n    @Test\n    public void testGoToIndexWithoutIndex() {\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(\"page1\"),\n                                                       new LayoutTemplate(\"page2\"));\n        runtimeScreen.goToIndex(templates);\n        verify(placeManager, times(0)).goTo(anyString());\n    }\n    \n    @Test\n    public void testGoToIndexWithHistoryAndKeepIndex() {\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(\"page1\"),\n                                                       new LayoutTemplate(\"page2\"));\n        runtimeScreen.keepHistory = true;\n        runtimeScreen.lastVisited = \"page1\";\n        runtimeScreen.goToIndex(templates);\n        verify(placeManager).goTo(\"page1\");\n    }\n    \n    @Test\n    public void testGoToIndexWithoutHistory() {\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(\"page1\"),\n                                                       new LayoutTemplate(\"page2\"));\n        runtimeScreen.keepHistory = false;\n        runtimeScreen.lastVisited = \"page1\";\n        runtimeScreen.goToIndex(templates);\n        verify(placeManager, times(0)).goTo(anyString());\n    }\n    \n    @Test\n    public void testGoToIndexWithDeletedPage() {\n        List<LayoutTemplate> templates = Arrays.asList(new LayoutTemplate(\"page1\"),\n                                                       new LayoutTemplate(\"page2\"));\n        runtimeScreen.keepHistory = true;\n        runtimeScreen.lastVisited = \"deleted\";\n        runtimeScreen.goToIndex(templates);\n        verify(placeManager, times(0)).goTo(anyString());\n    }\n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/java/org/dashbuilder/shared/service/RuntimeModelRegistryTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.shared.service;\n\nimport java.util.Collection;\nimport java.util.Optional;\n\nimport org.dashbuilder.shared.model.DashbuilderRuntimeMode;\nimport org.dashbuilder.shared.model.RuntimeModel;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class RuntimeModelRegistryTest {\n\n    @Test\n    public void testAcceptingNewImportsMultiple() {\n        RuntimeModelRegistry registry = new RuntimeModelRegistryMock(DashbuilderRuntimeMode.MULTIPLE_IMPORT, false);\n        assertTrue(registry.acceptingNewImports());\n    }\n\n    @Test\n    public void testNotAcceptingNewImportsStatic() {\n        RuntimeModelRegistry registry = new RuntimeModelRegistryMock(DashbuilderRuntimeMode.STATIC, false);\n        assertFalse(registry.acceptingNewImports());\n    }\n\n    @Test\n    public void testNotAcceptingNewImportsSingleAndNotEmpty() {\n        RuntimeModelRegistry registry = new RuntimeModelRegistryMock(DashbuilderRuntimeMode.SINGLE_IMPORT, false);\n        assertFalse(registry.acceptingNewImports());\n    }\n\n    @Test\n    public void testNotAcceptingNewImportsSingleAndEmpty() {\n        RuntimeModelRegistry registry = new RuntimeModelRegistryMock(DashbuilderRuntimeMode.SINGLE_IMPORT, true);\n        assertTrue(registry.acceptingNewImports());\n    }\n\n    // Having classloading issues with Mockito, hence having to create this\n    public class RuntimeModelRegistryMock implements RuntimeModelRegistry {\n\n        private DashbuilderRuntimeMode mode;\n\n        public RuntimeModelRegistryMock(DashbuilderRuntimeMode mode, boolean b) {\n            super();\n            this.mode = mode;\n            this.b = b;\n        }\n\n        private boolean b;\n\n        @Override\n        public Optional<RuntimeModel> single() {\n            return null;\n        }\n\n        @Override\n        public boolean isEmpty() {\n            return b;\n        }\n\n        @Override\n        public DashbuilderRuntimeMode getMode() {\n            return mode;\n        }\n\n        @Override\n        public Optional<RuntimeModel> get(String id) {\n            return null;\n        }\n\n        @Override\n        public void setMode(DashbuilderRuntimeMode mode) {}\n\n        @Override\n        public Optional<RuntimeModel> registerFile(String filePath) {\n            return null;\n        }\n\n        @Override\n        public void remove(String runtimeModelid) {\n\n        }\n\n        @Override\n        public Collection<String> availableModels() {\n            return null;\n        }\n\n        @Override\n        public void clear() {\n\n        }\n\n        @Override\n        public void unregister(String runtimeModelid) {\n                        \n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/resources/ds.csv",
    "content": "Country,Life Expectancy\nMacau,84.7\nJapan,84.5\nSingapore,83.8\nSwitzerland,83.6\nItaly,83.4\nSpain,83.4\nAustralia,83.3\nIceland,82.9\nSouth Korea,82.8\nIsrael,82.8\nSweden,82.7\nFrance,82.5\nMalta,82.4\nCanada,82.3\nNorway,82.3\nLuxembourg,82.1\nIreland,82.1\nNew Zealand,82.1\nNetherlands,82.1\nGreece,82.1\nPortugal,81.9\nAndorra,81.8\nFinland,81.7\nBelgium,81.5\nAscension Island,81.5\nAustria,81.4\nGermany,81.2\nUnited Kingdom,81.2\nSlovenia,81.2\nCyprus,80.8\nDenmark,80.8\nLiechtenstein,80.5\nCosta Rica,80.1\nChile,80\nCzech Republic,79.2\nBarbados,79.1\nLebanon,78.9\nUnited States of America,78.9\nCuba,78.6\nPoland,78.5\nPanama,78.3\nCroatia,78.3\nTurkey,78.3\nUnited Arab Emirates,77.8\nUruguay,77.8\nOman,77.6\nSlovakia,77.4\nBosnia and Herzegovina,77.3\nBahrain,77.2\nColombia,77.1\nAntigua and Barbuda,76.9\nThailand,76.9\nEcuador,76.8\nMontenegro,76.8\nSri Lanka,76.8\nAlgeria,76.7\nChina,76.7\nHungary,76.7\nArgentina,76.5\nIran,76.5\nMorocco,76.5\nPeru,76.5\nTunisia,76.5\nSaint Lucia,76.1\nMalaysia,76.1\nRomania,75.9\nSerbia,75.8\nBrazil,75.7\nBrunei,75.7\nLithuania,75.7\nNorth Macedonia,75.7\nKuwait,75.4\nLatin America and the Caribbean,75.4\n\"East Asia, Southeast Asia and Oceania\",75.3\nVietnam,75.3\nLatvia,75.2\nHonduras,75.1\nMexico,75\nSaudi Arabia,75\nArmenia,74.9\nBulgaria,74.9\nMauritius,74.9\nBelarus,74.6\nSaint Kitts and Nevis,74.6\nBelize,74.5\nJamaica,74.4\nJordan,74.4\nNicaragua,74.3\nEurope and Central Asia,74.2\nGuatemala,74.1\nParaguay,74.1\nDominican Republic,73.9\nMarshall Islands,73.9\nPalestine,73.9\nBahamas,73.8\nPalau,73.7\nGeorgia,73.6\nTrinidad and Tobago,73.4\nSeychelles,73.3\nKazakhstan,73.2\nSamoa,73.2\nEl Salvador,73.1\nAzerbaijan,72.9\nCabo Verde,72.8\nSolomon Islands,72.8\nLibya,72.7\nWorld,72.6\nGrenada,72.4\nRussia,72.4\nSaint Vincent and the Grenadines,72.4\nBangladesh,72.3\nVenezuela,72.1\nUkraine,72\nArab States,71.9\nEgypt,71.8\nMoldova,71.8\nSyria,71.8\nSuriname,71.6\nUzbekistan,71.6\nBhutan,71.5\nIndonesia,71.5\nKyrgyzstan,71.3\nBolivia,71.2\nPhilippines,71.1\nTajikistan,70.9\nTonga,70.8\nIraq,70.5\nNepal,70.5\nVanuatu,70.3\nSao Tome and Principe,70.2\nGuyana,69.8\nMongolia,69.7\nSouth Asia,69.7\nCambodia,69.6\nIndia,69.4\nBotswana,69.3\nTimor Leste,69.3\nRwanda,68.7\nKiribati,68.1\nTurkmenistan,68.1\nFederated States of Micronesia,67.8\nSenegal,67.7\nLaos,67.6\nFiji,67.3\nPakistan,67.1\nMyanmar,66.9\nMadagascar,66.7\nDjibouti,66.6\nEthiopia,66.2\nGabon,66.2\nYemen,66.1\nEritrea,65.9\nSudan,65.1\nUnited Republic of Tanzania,65\nMauritania,64.7\nAfghanistan,64.5\nRepublic of Congo,64.3\nPapua New Guinea,64.3\nComoros,64.1\nSouth Africa,63.9\nGhana,63.8\nMalawi,63.8\nHaiti,63.7\nLiberia,63.7\nZambia,63.5\nNamibia,63.4\nKenya,63.3\nUganda,63\nNiger,62\nGambia,61.7\nBenin,61.5\nBurkina Faso,61.2\nBurundi,61.2\nGuinea,61.2\nSub-Saharan Africa,61.2\nZimbabwe,61.2\nAngola,60.8\nTogo,60.8\nDemocratic Republic of the Congo,60.4\nMozambique,60.2\nEswatini,59.4\nMali,58.9\nCameroon,58.9\nEquatorial Guinea,58.4\nGuinea-Bissau,58\nSouth Sudan,57.6\nCôte d'Ivoire,57.4\nNigeria,54.3\nSierra Leone,54.3\nChad,54\nLesotho,53.7\nCentral African Republic,52.8\n"
  },
  {
    "path": "dashbuilder/dashbuilder-runtime/src/test/resources/ds.dset",
    "content": "{\n  \"uuid\": \"e26a81a1-5636-493c-96e0-51bc32322b17\",\n  \"name\": \"uploaded_life_expectancy\",\n  \"provider\": \"CSV\",\n  \"isPublic\": true,\n  \"cacheEnabled\": false,\n  \"cacheMaxRows\": 1000,\n  \"pushEnabled\": false,\n  \"pushMaxSize\": 1024,\n  \"refreshAlways\": false,\n  \"filePath\": \"C:\\\\fakepath\\\\life_expectancy.csv\",\n  \"separatorChar\": \",\",\n  \"quoteChar\": \"\\\"\",\n  \"escapeChar\": \"\\\\\",\n  \"datePattern\": \"MM-dd-yyyy HH:mm:ss\",\n  \"numberPattern\": \"#,###.##\",\n  \"allColumns\": false,\n  \"columns\": [\n    {\n      \"id\": \"Country\",\n      \"type\": \"label\"\n    },\n    {\n      \"id\": \"Life Expectancy\",\n      \"type\": \"number\",\n      \"pattern\": \"#,###.##\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- ~ Copyright 2014 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n  the Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n  except in compliance with the License. ~ You may obtain a copy of the License \n  at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n  applicable law or agreed to in writing, software ~ distributed under the \n  License is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n  OF ANY KIND, either express or implied. ~ See the License for the specific \n  language governing permissions and ~ limitations under the License. -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-shared</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-displayer-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Displayer API</name>\n  <description>Dashbuilder Displayer API shared between client and server.</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/AreaChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for area charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newAreaChartSettings()\n *   .title(\"By Product\")\n *   .column(\"Product\")\n *   .column(\"Total amount\")\n * </pre>\n */\npublic interface AreaChartSettingsBuilder<T extends AreaChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n    /**\n     * Set this area chart's subtype to a simple area chart (i.e. normal non-stacked areas)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure an Area chart data displayer.\n     */\n    T subType_Area();\n\n    /**\n     * Set this area chart's subtype to a stacked area chart (i.e. stacked areas)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure an Area chart data displayer.\n     */\n    T subType_StackedArea();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/BarChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for bar charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newBarChartSettings()\n *   .title(\"By Product\")\n *   .column(\"Product\")\n *   .column(\"Total amount\")\n *   .buildSettings()\n * </pre>\n */\npublic interface BarChartSettingsBuilder<T extends BarChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n    /**\n     * @param b True if the bars of this bar chart are to be shown in 3D, false if they are to be shown flat.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Bar chart data displayer.\n     */\n    T set3d(boolean b);\n\n    /**\n     * Set this bar chart's subtype to a simple bar chart (i.e. horizontal non-stacked bars)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Bar chart data displayer.\n     */\n    T subType_Bar();\n\n    /**\n     * Set this bar chart's subtype to a stacked bar chart (i.e. horizontal stacked bars)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Bar chart data displayer.\n     */\n    T subType_StackedBar();\n\n    /**\n     * Set this bar chart's subtype to a simple column chart (i.e. vertical non-stacked bars)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Bar chart data displayer.\n     */\n    T subType_Column();\n\n    /**\n     * Set this bar chart's subtype to a stacked column chart (i.e. vertical stacked bars)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Bar chart data displayer.\n     */\n    T subType_StackedColumn();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/BubbleChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for bubble charts.\n *\n * <pre>\n *   DisplayerSettingsFactory.newBubbleChartSettings()\n *   .title(\"Opportunities distribution by Country \")\n *   .width(500).height(350)\n *   .margins(20, 50, 50, 0)\n *   .column(COUNTRY, \"Country\")\n *   .column(\"opps\", \"Number of opportunities\")\n *   .column(PROBABILITY, \"Average probability\")\n *   .column(COUNTRY, \"Country\")\n *   .column(EXPECTED_AMOUNT, \"Expected amount\")\n *   .buildSettings());\n * </pre>\n */\npublic interface BubbleChartSettingsBuilder<T extends BubbleChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/ChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for the assembly of Chart based data displayer instances.\n */\npublic interface ChartSettingsBuilder<T extends ChartSettingsBuilder> extends DisplayerSettingsBuilder<T> {\n\n    /**\n     * Sets the width of the chart.\n     * @param width The width of the chart.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T width(int width);\n\n    /**\n     * Sets the height of the chart.\n     * @param height The height of the chart.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T height(int height);\n\n    /**\n     * Set the margins for this chart.\n     * @param top The top margin.\n     * @param bottom The bottom margin.\n     * @param left The left margin.\n     * @param right The right margin.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T margins(int top, int bottom, int left, int right);\n\n    /**\n     * Hides off the char legend.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T legendOff();\n\n    /**\n     * Turns on the char legend display.\n     * @param position The display position.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T legendOn(String position);\n    T legendOn(Position position);\n\n    /**\n     * Set the chart as resizable, it can change its size from the original one, defined by <code>width</code> and <code>height</code> attributes.\n     * @param maxWidth The maximum width value.\n     * @param maxHeight The maximum height value.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T resizableOn(int maxWidth, int maxHeight);\n\n    /**\n     * Set the chart as no resizable, it cannot change its size from the original one, defined by <code>width</code> and <code>height</code> attributes. \n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Chart data displayer.\n     */\n    T resizableOff();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/ColumnSettings.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.group.ColumnGroup;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.dataset.group.GroupStrategy;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ColumnSettings {\n\n    public static final String NUMBER_PATTERN = \"#,##0.00\";\n    public static final String EXPRESSION = \"value\";\n\n    public static final String DATE_PATTERN = \"MMM dd, yyyy HH:mm\";\n    public static final String DATE_YEAR  = \"yyyy\";\n    public static final String DATE_MONTH = \"MMM yyyy\";\n    public static final String DATE_QUARTER = \"MMM yyyy\";\n    public static final String DATE_DAY = \"dd MMM\";\n    public static final String DATE_WEEK = \"'Week' dd MMM\";\n    public static final String DATE_HOUR = \"HH'h'\";\n    public static final String DATE_MINUTE = \"mm'm'\";\n    public static final String DATE_SECOND = \"ss's'\";\n\n    public static String getFixedExpression(DateIntervalType type) {\n        if (DateIntervalType.SECOND.equals(type)) {\n            return \"value + \\\"\\\\\\\"\\\"\";\n        }\n        if (DateIntervalType.MINUTE.equals(type)) {\n            return \"value + \\\"'\\\"\";\n        }\n        if (DateIntervalType.HOUR.equals(type)) {\n            return \"value + \\\"h\\\"\";\n        }\n        if (DateIntervalType.QUARTER.equals(type)) {\n            return \"\\\"Q\\\" + value\";\n        }\n        return \"value\";\n    }\n\n    public static String getDatePattern(DateIntervalType type) {\n        if (type.getIndex() <= DateIntervalType.SECOND.getIndex()) {\n            return DATE_SECOND;\n        }\n        if (DateIntervalType.MINUTE.equals(type)) {\n            return DATE_MINUTE;\n        }\n        if (DateIntervalType.HOUR.equals(type)) {\n            return DATE_HOUR;\n        }\n        if (DateIntervalType.DAY.equals(type)) {\n            return DATE_DAY;\n        }\n        if (DateIntervalType.WEEK.equals(type)) {\n            return DATE_WEEK;\n        }\n        if (DateIntervalType.MONTH.equals(type)) {\n            return DATE_MONTH;\n        }\n        if (DateIntervalType.QUARTER.equals(type)) {\n            return DATE_QUARTER;\n        }\n        return DATE_YEAR;\n    }\n\n    public static ColumnSettings cloneWithDefaults(ColumnSettings columnSettings, DataColumn column) {\n\n        ColumnSettings clone = columnSettings == null ? new ColumnSettings(column.getId()) : columnSettings.cloneInstance();\n        ColumnType columnType = column.getColumnType();\n        ColumnGroup columnGroup = column.getColumnGroup();\n        DateIntervalType intervalType = DateIntervalType.getByName(column.getIntervalType());\n\n        if (clone.columnName == null) {\n            clone.columnName = column.getId();\n        }\n        if (clone.emptyTemplate == null) {\n            clone.emptyTemplate = \"---\";\n        }\n        if (clone.valuePattern == null) {\n            if (intervalType != null && columnGroup.getStrategy().equals(GroupStrategy.DYNAMIC)) {\n                clone.valuePattern = getDatePattern(intervalType);\n            }\n            else if (ColumnType.DATE.equals(columnType)) {\n                clone.valuePattern = DATE_PATTERN;\n            }\n            else if (ColumnType.NUMBER.equals(columnType)) {\n                clone.valuePattern = NUMBER_PATTERN;\n            }\n        }\n        if (clone.valueExpression == null) {\n            if (intervalType != null && columnGroup.getStrategy().equals(GroupStrategy.FIXED)) {\n                clone.valueExpression = getFixedExpression(intervalType);\n            }\n            else if (!ColumnType.DATE.equals(columnType)) {\n                clone.valueExpression = EXPRESSION;\n            }\n        }\n        return clone;\n    }\n\n    protected String columnId;\n    protected String columnName;\n    protected String valueExpression;\n    protected String emptyTemplate;\n    protected String valuePattern;\n\n    public ColumnSettings() {\n    }\n\n    public ColumnSettings(String columnId) {\n        this.columnId = columnId;\n    }\n\n    public String getColumnId() {\n        return columnId;\n    }\n\n    public void setColumnId(String columnId) {\n        this.columnId = columnId;\n    }\n\n    public String getColumnName() {\n        return columnName;\n    }\n\n    public void setColumnName(String name) {\n        this.columnName = name;\n    }\n\n    public String getValueExpression() {\n        return valueExpression;\n    }\n\n    public void setValueExpression(String valueExpression) {\n        this.valueExpression = valueExpression;\n    }\n\n    public String getValuePattern() {\n        return valuePattern;\n    }\n\n    public void setValuePattern(String pattern) {\n        this.valuePattern = pattern;\n    }\n\n    public String getEmptyTemplate() {\n        return emptyTemplate;\n    }\n\n    public void setEmptyTemplate(String emptyTemplate) {\n        this.emptyTemplate = emptyTemplate;\n    }\n\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        if (columnId != null) out.append(columnId).append(\" \");\n        if (columnName != null) out.append(columnName).append(\" \");\n        if (valuePattern != null) out.append(valuePattern).append(\" \");\n        if (valueExpression != null) out.append(valueExpression).append(\" \");\n        if (emptyTemplate != null) out.append(emptyTemplate).append(\" \");\n        return out.toString();\n    }\n\n    public ColumnSettings cloneInstance() {\n        ColumnSettings other = new ColumnSettings();\n        other.columnId = columnId;\n        other.columnName = columnName;\n        other.valuePattern = valuePattern;\n        other.valueExpression = valueExpression;\n        other.emptyTemplate = emptyTemplate;\n        return other;\n    }\n\n    public boolean equals(Object obj) {\n        try {\n            ColumnSettings other = (ColumnSettings) obj;\n            if (other == null) {\n                return false;\n            }\n            if (columnId != null && !columnId.equals(other.columnId)) {\n                return false;\n            }\n            if (columnName != null && !columnName.equals(other.columnName)) {\n                return false;\n            }\n            if (valuePattern != null && !valuePattern.equals(other.valuePattern)) {\n                return false;\n            }\n            if (valueExpression != null && !valueExpression.equals(other.valueExpression)) {\n                return false;\n            }\n            if (emptyTemplate != null && !emptyTemplate.equals(other.emptyTemplate)) {\n                return false;\n            }\n            return true;\n        } catch (ClassCastException e) {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerAttributeDef.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\npublic class DisplayerAttributeDef {\n\n    public static final DisplayerAttributeDef TYPE = new DisplayerAttributeDef(\"type\");\n    public static final DisplayerAttributeDef SUBTYPE = new DisplayerAttributeDef(\"subtype\");\n    public static final DisplayerAttributeDef RENDERER = new DisplayerAttributeDef(\"renderer\");\n\n    public static final DisplayerAttributeDef COLUMN_EXPRESSION = new DisplayerAttributeDef(\"expression\", DisplayerAttributeGroupDef.COLUMNS_GROUP);\n    public static final DisplayerAttributeDef COLUMN_PATTERN = new DisplayerAttributeDef(\"pattern\", DisplayerAttributeGroupDef.COLUMNS_GROUP);\n    public static final DisplayerAttributeDef COLUMN_EMPTY = new DisplayerAttributeDef(\"empty\", DisplayerAttributeGroupDef.COLUMNS_GROUP);\n\n    public static final DisplayerAttributeDef TITLE = new DisplayerAttributeDef(\"title\", DisplayerAttributeGroupDef.GENERAL_GROUP);\n    public static final DisplayerAttributeDef TITLE_VISIBLE = new DisplayerAttributeDef(\"visible\", DisplayerAttributeGroupDef.GENERAL_GROUP);\n\n    /**\n     * @deprecated Replaced by {@link #EXPORT_TO_CSV}. (Kept for backward compatibility)\n     * @since 0.6\n     */\n    public static final DisplayerAttributeDef ALLOW_EXPORT_CSV = new DisplayerAttributeDef(\"allow_csv\", DisplayerAttributeGroupDef.GENERAL_GROUP);\n\n    /**\n     * @deprecated Replaced by {@link #EXPORT_TO_XLS}. (Kept for backward compatibility)\n     * @since 0.6\n     */\n    public static final DisplayerAttributeDef ALLOW_EXPORT_EXCEL = new DisplayerAttributeDef(\"allow_excel\", DisplayerAttributeGroupDef.GENERAL_GROUP);\n\n    public static final DisplayerAttributeDef EXPORT_TO_CSV = new DisplayerAttributeDef(\"export_csv\", DisplayerAttributeGroupDef.EXPORT_GROUP);\n    public static final DisplayerAttributeDef EXPORT_TO_XLS = new DisplayerAttributeDef(\"export_xls\", DisplayerAttributeGroupDef.EXPORT_GROUP);\n\n    public static final DisplayerAttributeDef REFRESH_STALE_DATA = new DisplayerAttributeDef(\"staleData\", DisplayerAttributeGroupDef.REFRESH_GROUP);\n    public static final DisplayerAttributeDef REFRESH_INTERVAL = new DisplayerAttributeDef(\"interval\", DisplayerAttributeGroupDef.REFRESH_GROUP);\n\n    public static final DisplayerAttributeDef FILTER_ENABLED = new DisplayerAttributeDef(\"enabled\", DisplayerAttributeGroupDef.FILTER_GROUP);\n    public static final DisplayerAttributeDef FILTER_SELFAPPLY_ENABLED = new DisplayerAttributeDef(\"selfapply\", DisplayerAttributeGroupDef.FILTER_GROUP);\n    public static final DisplayerAttributeDef FILTER_NOTIFICATION_ENABLED = new DisplayerAttributeDef(\"notification\", DisplayerAttributeGroupDef.FILTER_GROUP);\n    public static final DisplayerAttributeDef FILTER_LISTENING_ENABLED = new DisplayerAttributeDef(\"listening\", DisplayerAttributeGroupDef.FILTER_GROUP);\n\n    public static final DisplayerAttributeDef SELECTOR_WIDTH = new DisplayerAttributeDef(\"width\", DisplayerAttributeGroupDef.SELECTOR_GROUP);\n    public static final DisplayerAttributeDef SELECTOR_MULTIPLE = new DisplayerAttributeDef(\"multiple\", DisplayerAttributeGroupDef.SELECTOR_GROUP);\n    public static final DisplayerAttributeDef SELECTOR_SHOW_INPUTS = new DisplayerAttributeDef(\"inputs_show\", DisplayerAttributeGroupDef.SELECTOR_GROUP);\n\n    public static final DisplayerAttributeDef CHART_WIDTH = new DisplayerAttributeDef(\"width\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_HEIGHT = new DisplayerAttributeDef(\"height\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_RESIZABLE = new DisplayerAttributeDef(\"resizable\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_MAX_WIDTH = new DisplayerAttributeDef(\"maxWidth\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_MAX_HEIGHT = new DisplayerAttributeDef(\"maxHeight\", DisplayerAttributeGroupDef.CHART_GROUP);\n    \n    public static final DisplayerAttributeDef CHART_BGCOLOR = new DisplayerAttributeDef(\"bgColor\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_3D = new DisplayerAttributeDef(\"3d\", DisplayerAttributeGroupDef.CHART_GROUP);\n    public static final DisplayerAttributeDef CHART_MARGIN_TOP = new DisplayerAttributeDef(\"top\", DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    public static final DisplayerAttributeDef CHART_MARGIN_BOTTOM = new DisplayerAttributeDef(\"bottom\", DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    public static final DisplayerAttributeDef CHART_MARGIN_LEFT = new DisplayerAttributeDef(\"left\", DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    public static final DisplayerAttributeDef CHART_MARGIN_RIGHT = new DisplayerAttributeDef(\"right\", DisplayerAttributeGroupDef.CHART_MARGIN_GROUP);\n    public static final DisplayerAttributeDef CHART_SHOWLEGEND = new DisplayerAttributeDef(\"show\", DisplayerAttributeGroupDef.CHART_LEGEND_GROUP);\n    public static final DisplayerAttributeDef CHART_LEGENDPOSITION = new DisplayerAttributeDef(\"position\", DisplayerAttributeGroupDef.CHART_LEGEND_GROUP);\n\n    public static final DisplayerAttributeDef TABLE_PAGESIZE = new DisplayerAttributeDef(\"pageSize\", DisplayerAttributeGroupDef.TABLE_GROUP);\n    public static final DisplayerAttributeDef TABLE_WIDTH = new DisplayerAttributeDef(\"width\", DisplayerAttributeGroupDef.TABLE_GROUP);\n    public static final DisplayerAttributeDef TABLE_SORTENABLED = new DisplayerAttributeDef(\"enabled\", DisplayerAttributeGroupDef.TABLE_SORT_GROUP);\n    public static final DisplayerAttributeDef TABLE_SORTCOLUMNID = new DisplayerAttributeDef(\"columnId\", DisplayerAttributeGroupDef.TABLE_SORT_GROUP);\n    public static final DisplayerAttributeDef TABLE_SORTORDER = new DisplayerAttributeDef(\"order\", DisplayerAttributeGroupDef.TABLE_SORT_GROUP);\n    public static final DisplayerAttributeDef TABLE_COLUMN_PICKER_ENABLED = new DisplayerAttributeDef(\"show_column_picker\", DisplayerAttributeGroupDef.TABLE_GROUP);\n\n    public static final DisplayerAttributeDef XAXIS_SHOWLABELS = new DisplayerAttributeDef(\"labels_show\", DisplayerAttributeGroupDef.XAXIS_GROUP);\n    public static final DisplayerAttributeDef XAXIS_TITLE = new DisplayerAttributeDef(\"title\", DisplayerAttributeGroupDef.XAXIS_GROUP);\n    public static final DisplayerAttributeDef XAXIS_LABELSANGLE = new DisplayerAttributeDef(\"labels_angle\", DisplayerAttributeGroupDef.XAXIS_GROUP);\n    public static final DisplayerAttributeDef YAXIS_SHOWLABELS = new DisplayerAttributeDef(\"labels_show\", DisplayerAttributeGroupDef.YAXIS_GROUP);\n    public static final DisplayerAttributeDef YAXIS_TITLE = new DisplayerAttributeDef(\"title\", DisplayerAttributeGroupDef.YAXIS_GROUP);\n\n    public static final DisplayerAttributeDef METER_START = new DisplayerAttributeDef(\"start\", DisplayerAttributeGroupDef.METER_GROUP);\n    public static final DisplayerAttributeDef METER_WARNING = new DisplayerAttributeDef(\"warning\", DisplayerAttributeGroupDef.METER_GROUP);\n    public static final DisplayerAttributeDef METER_CRITICAL = new DisplayerAttributeDef(\"critical\", DisplayerAttributeGroupDef.METER_GROUP);\n    public static final DisplayerAttributeDef METER_END = new DisplayerAttributeDef(\"end\", DisplayerAttributeGroupDef.METER_GROUP);\n\n    public static final DisplayerAttributeDef DONUT_HOLE_TITLE = new DisplayerAttributeDef(\"hole_title\", DisplayerAttributeGroupDef.DONUT_GROUP);\n\n    public static final DisplayerAttributeDef HTML_TEMPLATE = new DisplayerAttributeDef(\"html\", DisplayerAttributeGroupDef.HTML_GROUP);\n    public static final DisplayerAttributeDef JS_TEMPLATE = new DisplayerAttributeDef(\"javascript\", DisplayerAttributeGroupDef.HTML_GROUP);\n    \n    public static final DisplayerAttributeDef MAP_COLOR_SCHEME = new DisplayerAttributeDef(\"color_scheme\", DisplayerAttributeGroupDef.MAP_GROUP);\n\n    public static final DisplayerAttributeDef EXTERNAL_COMPONENT_ID = new DisplayerAttributeDef(\"external_component_id\");\n    \n    public static final DisplayerAttributeDef EXTERNAL_COMPONENT_PARTITION = new DisplayerAttributeDef(\"external_component_partition\");\n\n    \n    protected String id;\n    protected DisplayerAttributeGroupDef parent;\n\n    public DisplayerAttributeDef() {\n    }\n\n    public DisplayerAttributeDef( String id ) {\n        this( id, null );\n    }\n\n    public DisplayerAttributeDef( String id, DisplayerAttributeGroupDef parent ) {\n        this.id = id;\n        if (parent != null) {\n            parent.addChild(this);\n        }\n    }\n\n    public String getFullId() {\n        return parent != null ? parent.getFullId() + \".\" + id : id;\n    }\n\n    public DisplayerAttributeDef getParent() {\n        return parent;\n    }\n\n    public void setParent(DisplayerAttributeGroupDef parent) {\n        this.parent = parent;\n    }\n\n    @Override\n    public boolean equals( Object obj ) {\n        if ( obj == null ) {\n            return false;\n        }\n        if ( !( obj.getClass().getName().equalsIgnoreCase(this.getClass().getName()) ) ) {\n            return false;\n        }\n        DisplayerAttributeDef that = (DisplayerAttributeDef) obj;\n        return that.getFullId().equalsIgnoreCase( this.getFullId() );\n    }\n\n    @Override\n    public int hashCode() {\n        int result = 23;\n        result = 31 * result + getFullId().hashCode();\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return getFullId();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerAttributeGroupDef.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\npublic class DisplayerAttributeGroupDef extends DisplayerAttributeDef {\n\n    // ROOT-GROUPS\n    public static final DisplayerAttributeGroupDef GENERAL_GROUP = new DisplayerAttributeGroupDef( \"general\" );\n\n    public static final DisplayerAttributeGroupDef COLUMNS_GROUP = new DisplayerAttributeGroupDef( \"columns\" );\n\n    public static final DisplayerAttributeGroupDef REFRESH_GROUP = new DisplayerAttributeGroupDef( \"refresh\" );\n\n    public static final DisplayerAttributeGroupDef FILTER_GROUP = new DisplayerAttributeGroupDef( \"filter\" );\n\n    public static final DisplayerAttributeGroupDef SELECTOR_GROUP = new DisplayerAttributeGroupDef( \"selector\" );\n\n    public static final DisplayerAttributeGroupDef CHART_GROUP = new DisplayerAttributeGroupDef( \"chart\" );\n\n    public static final DisplayerAttributeGroupDef TABLE_GROUP = new DisplayerAttributeGroupDef( \"table\" );\n\n    public static final DisplayerAttributeGroupDef AXIS_GROUP = new DisplayerAttributeGroupDef( \"axis\" );\n\n    public static final DisplayerAttributeGroupDef METER_GROUP = new DisplayerAttributeGroupDef( \"meter\" );\n\n    public static final DisplayerAttributeGroupDef DONUT_GROUP = new DisplayerAttributeGroupDef( \"donut\" );\n\n    public static final DisplayerAttributeGroupDef HTML_GROUP = new DisplayerAttributeGroupDef( \"html\" );\n\n    public static final DisplayerAttributeGroupDef EXPORT_GROUP = new DisplayerAttributeGroupDef( \"export\" );\n    \n    public static final DisplayerAttributeGroupDef MAP_GROUP = new DisplayerAttributeGroupDef( \"map\" );\n\n\n    // SUBGROUPS\n    public static final DisplayerAttributeGroupDef CHART_MARGIN_GROUP =\n            new DisplayerAttributeGroupDef( \"margin\", DisplayerAttributeGroupDef.CHART_GROUP);\n\n    public static final DisplayerAttributeGroupDef CHART_LEGEND_GROUP =\n            new DisplayerAttributeGroupDef( \"legend\", DisplayerAttributeGroupDef.CHART_GROUP );\n\n    public static final DisplayerAttributeGroupDef TABLE_SORT_GROUP =\n            new DisplayerAttributeGroupDef( \"sort\", DisplayerAttributeGroupDef.TABLE_GROUP );\n\n    public static final DisplayerAttributeGroupDef XAXIS_GROUP =\n            new DisplayerAttributeGroupDef( \"x\", DisplayerAttributeGroupDef.AXIS_GROUP );\n\n    public static final DisplayerAttributeGroupDef YAXIS_GROUP =\n            new DisplayerAttributeGroupDef( \"y\", DisplayerAttributeGroupDef.AXIS_GROUP );\n\n    private Set<DisplayerAttributeDef> children = new HashSet<DisplayerAttributeDef>();\n\n    public DisplayerAttributeGroupDef() {\n    }\n\n    public DisplayerAttributeGroupDef( String id ) {\n        super( id );\n    }\n\n    public DisplayerAttributeGroupDef( String id, DisplayerAttributeGroupDef parent ) {\n        super( id, parent );\n    }\n\n    public Set<DisplayerAttributeDef> getChildren() {\n        return children;\n    }\n\n    public DisplayerAttributeGroupDef addChild(DisplayerAttributeDef member) {\n        children.add(member);\n        member.setParent(this);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerConstraints.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.dashbuilder.dataset.DataSetLookupConstraints;\nimport org.dashbuilder.dataset.ValidationError;\n\n/**\n * Every Displayer implementation use this class to specify what are the supported DisplayerSettings attributes\n * as well as the supported data sets in order to fit the displayer needs.\n */\npublic class DisplayerConstraints {\n\n    protected DataSetLookupConstraints dataSetLookupConstraints;\n    protected Set<DisplayerAttributeDef> supportedEditorAttributes;\n    protected Set<DisplayerAttributeDef> excludedEditorAttributes;\n    protected Set<String> supportedEditorAttrStrings;\n    protected boolean supportingComponentAttributes;\n\n    public DisplayerConstraints(DataSetLookupConstraints dataSetLookupConstraints) {\n        this.dataSetLookupConstraints = dataSetLookupConstraints;\n        supportedEditorAttributes = new HashSet<>();\n        supportedEditorAttrStrings = new HashSet<>();\n        excludedEditorAttributes = new HashSet<>();\n    }\n\n    public DisplayerConstraints supportingComponentAttributes(boolean supportingComponentAttributes) {\n        this.supportingComponentAttributes = supportingComponentAttributes;\n        return this;\n    }\n\n    public DisplayerConstraints supportsAttribute(DisplayerAttributeDef attributeDef) {\n\n        // Discard excluded attributes\n        if (!excludedEditorAttributes.contains(attributeDef)) {\n\n            // Support the attribute and all its ancestors.\n            DisplayerAttributeDef _attr = attributeDef;\n            while (_attr != null) {\n                supportedEditorAttributes.add(_attr);\n                supportedEditorAttrStrings.add(_attr.getFullId());\n                _attr = _attr.getParent();\n            }\n            // ... and all its descendants as well.\n            if (attributeDef instanceof DisplayerAttributeGroupDef) {\n                for (DisplayerAttributeDef member : ((DisplayerAttributeGroupDef) attributeDef).getChildren()) {\n                    supportsAttribute(member);\n                }\n            }\n        }\n        return this;\n    }\n\n    public DisplayerConstraints excludeAttribute(DisplayerAttributeDef attributeDef) {\n        excludedEditorAttributes.add(attributeDef);\n        supportedEditorAttributes.remove(attributeDef);\n        supportedEditorAttrStrings.remove(attributeDef.getFullId());\n        return this;\n    }\n\n    public Set<DisplayerAttributeDef> getSupportedAttributes() {\n        return supportedEditorAttributes;\n    }\n\n    public DataSetLookupConstraints getDataSetLookupConstraints() {\n        return dataSetLookupConstraints;\n    }\n\n    public DisplayerConstraints setDataSetLookupConstraints(DataSetLookupConstraints dataSetLookupConstraints) {\n        this.dataSetLookupConstraints = dataSetLookupConstraints;\n        return this;\n    }\n\n    public void removeUnsupportedAttributes(DisplayerSettings displayerSettings) {\n        String componentId = displayerSettings.getComponentId();\n        if (componentId != null) {\n            Map<String, String> settingsMap = displayerSettings.getSettingsFlatMap();\n            for (String setting : new HashSet<>(settingsMap.keySet())) {\n                if (!supportedEditorAttrStrings.contains(setting) && !setting.startsWith(componentId)) {\n                    displayerSettings.removeDisplayerSetting(setting);\n                }\n            }\n        }\n    }\n\n    public ValidationError check(DisplayerSettings settings) {\n        if (dataSetLookupConstraints == null) {\n            return createValidationError(ERROR_DATASET_LOOKUP_CONSTRAINTS_NOT_FOUND);\n        }\n        if (settings.getDataSet() != null) {\n            ValidationError error = dataSetLookupConstraints.check(settings.getDataSet());\n            if (error != null)\n                return error;\n        } else if (settings.getDataSetLookup() != null) {\n            ValidationError error = dataSetLookupConstraints.check(settings.getDataSetLookup());\n            if (error != null)\n                return error;\n        }\n        return null;\n    }\n\n    public static final int ERROR_DATASET_LOOKUP_CONSTRAINTS_NOT_FOUND = 301;\n\n    protected ValidationError createValidationError(int error) {\n        switch (error) {\n            case ERROR_DATASET_LOOKUP_CONSTRAINTS_NOT_FOUND:\n                return new ValidationError(error, \"Missing DataSetLookupContraints instance\");\n        }\n        return new ValidationError(error);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerSettings.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.dashbuilder.dataset.DataColumn;\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DisplayerSettings {\n\n    protected String UUID;\n    protected DataSet dataSet;\n    protected DataSetLookup dataSetLookup;\n    protected List<ColumnSettings> columnSettingsList = new ArrayList<ColumnSettings>();\n    protected Map<String, String> settings = new HashMap<String, String>(30);\n\n    public DisplayerSettings() {}\n\n    public DisplayerSettings(DisplayerType displayerType) {\n        this();\n        setType(displayerType);\n    }\n    \n    public DisplayerSettings(DisplayerType displayerType, DisplayerSubType subType) {\n        this(displayerType);\n        setSubtype(subType);\n    }\n\n    public DisplayerSettings cloneInstance() {\n        DisplayerSettings clone = new DisplayerSettings();\n        clone.UUID = UUID;\n        clone.settings = new HashMap(settings);\n        clone.columnSettingsList = new ArrayList();\n        for (ColumnSettings columnSettings : columnSettingsList) {\n            clone.columnSettingsList.add(columnSettings.cloneInstance());\n        }\n        if (dataSet != null) {\n            clone.dataSet = dataSet.cloneInstance();\n        }\n        if (dataSetLookup != null) {\n            clone.dataSetLookup = dataSetLookup.cloneInstance();\n        }\n        return clone;\n    }\n\n    public boolean equals(Object obj) {\n        try {\n            DisplayerSettings other = (DisplayerSettings) obj;\n            if (other == this) {\n                return true;\n            }\n            if (other == null) {\n                return false;\n            }\n            if (UUID != null && !UUID.equals(other.UUID)) {\n                return false;\n            }\n            if (dataSet != null && !dataSet.equals(other.dataSet)) {\n                return false;\n            }\n            if (dataSetLookup != null && !dataSetLookup.equals(other.dataSetLookup)) {\n                return false;\n            }\n            if (columnSettingsList.size() != other.columnSettingsList.size()) {\n                return false;\n            }\n            for (int i = 0; i < columnSettingsList.size(); i++) {\n                if (!columnSettingsList.get(i).equals(other.columnSettingsList.get(i))) {\n                    return false;\n                }\n            }\n            if (settings.size() != other.settings.size()) {\n                return false;\n            }\n            for (String setting : settings.keySet()) {\n                if (!settings.get(setting).equals(other.settings.get(setting))) {\n                    return false;\n                }\n            }\n            return true;\n        } catch (ClassCastException e) {\n            return false;\n        }\n    }\n\n    public List<ColumnSettings> getColumnSettingsList() {\n        return columnSettingsList;\n    }\n\n    public void setColumnSettingsList(List<ColumnSettings> columnSettingsList) {\n        if (columnSettingsList != null) {\n            this.columnSettingsList = columnSettingsList;\n        } else {\n            this.columnSettingsList.clear();\n        }\n    }\n\n    public void removeColumnSettings(String columnId) {\n        Iterator<ColumnSettings> it = columnSettingsList.iterator();\n        while (it.hasNext()) {\n            ColumnSettings columnSettings = it.next();\n            if (columnSettings.getColumnId().equals(columnId)) {\n                it.remove();\n            }\n        }\n    }\n\n    public ColumnSettings getColumnSettings(String columnId) {\n        for (ColumnSettings columnSettings : columnSettingsList) {\n            if (columnSettings.getColumnId().equals(columnId))\n                return columnSettings;\n        }\n        return null;\n    }\n\n    public ColumnSettings getColumnSettings(DataColumn column) {\n        ColumnSettings sourceSettings = getColumnSettings(column.getId());\n        return ColumnSettings.cloneWithDefaults(sourceSettings, column);\n    }\n\n    public void setColumnName(String columnId, String name) {\n        ColumnSettings columnSettings = getColumnSettings(columnId);\n        if (columnSettings == null)\n            columnSettingsList.add(columnSettings = new ColumnSettings(columnId));\n\n        columnSettings.setColumnName(name);\n    }\n\n    public void setColumnValueExpression(String columnId, String expression) {\n        ColumnSettings columnSettings = getColumnSettings(columnId);\n        if (columnSettings == null)\n            columnSettingsList.add(columnSettings = new ColumnSettings(columnId));\n\n        columnSettings.setValueExpression(expression);\n    }\n\n    public void setColumnValuePattern(String columnId, String pattern) {\n        ColumnSettings columnSettings = getColumnSettings(columnId);\n        if (columnSettings == null)\n            columnSettingsList.add(columnSettings = new ColumnSettings(columnId));\n\n        columnSettings.setValuePattern(pattern);\n    }\n\n    public void setColumnEmptyTemplate(String columnId, String template) {\n        ColumnSettings columnSettings = getColumnSettings(columnId);\n        if (columnSettings == null)\n            columnSettingsList.add(columnSettings = new ColumnSettings(columnId));\n\n        columnSettings.setEmptyTemplate(template);\n    }\n\n    private String getSettingPath(DisplayerAttributeDef displayerAttributeDef) {\n        return displayerAttributeDef.getFullId();\n    }\n\n    private int parseInt(String value, int defaultValue) {\n        if (value == null || value.trim().length() == 0)\n            return defaultValue;\n        return Integer.parseInt(value);\n    }\n\n    private long parseLong(String value, long defaultValue) {\n        if (value == null || value.trim().length() == 0)\n            return defaultValue;\n        return Long.parseLong(value);\n    }\n\n    private boolean parseBoolean(String value) {\n        return parseBoolean(value, false);\n    }\n\n    private boolean parseBoolean(String value, boolean defaultValue) {\n        if (value == null || value.trim().length() == 0)\n            return defaultValue;\n        return Boolean.parseBoolean(value);\n    }\n\n    private String parseString(String value) {\n        if (value == null || value.trim().length() == 0)\n            return \"\";\n        return value;\n    }\n\n    public String getUUID() {\n        return UUID;\n    }\n\n    public void setUUID(String UUID) {\n        this.UUID = UUID;\n    }\n\n    public DataSet getDataSet() {\n        return dataSet;\n    }\n\n    public void setDataSet(DataSet dataSet) {\n        this.dataSet = dataSet;\n    }\n\n    public DataSetLookup getDataSetLookup() {\n        return dataSetLookup;\n    }\n\n    public void setDataSetLookup(DataSetLookup dataSetLookup) {\n        this.dataSetLookup = dataSetLookup;\n    }\n\n    // 'Generic' getter method\n    public String getDisplayerSetting(DisplayerAttributeDef displayerAttributeDef) {\n        return settings.get(getSettingPath(displayerAttributeDef));\n    }\n\n    // 'Generic' setter method\n    public void setDisplayerSetting(DisplayerAttributeDef displayerAttributeDef, String value) {\n        settings.put(getSettingPath(displayerAttributeDef), value);\n    }\n\n    // 'Generic' setter method\n    public void setDisplayerSetting(String displayerAttributeDef, String value) {\n        settings.put(displayerAttributeDef, value);\n    }\n\n    // 'Generic' remove method\n    public void removeDisplayerSetting(DisplayerAttributeDef displayerAttributeDef) {\n        settings.remove(getSettingPath(displayerAttributeDef));\n    }\n\n    // 'Generic' remove method\n    public void removeDisplayerSetting(DisplayerAttributeGroupDef displayerAttributeGroup) {\n        for (DisplayerAttributeDef attributeDef : displayerAttributeGroup.getChildren()) {\n            settings.remove(getSettingPath(attributeDef));\n        }\n    }\n\n    // 'Generic' remove method\n    public void removeDisplayerSetting(String displayerAttributeDef) {\n        settings.remove(displayerAttributeDef);\n    }\n\n    public Map<String, String> getSettingsFlatMap() {\n        return settings;\n    }\n\n    public void setSettingsFlatMap(Map<String, String> settings) {\n        this.settings = settings;\n    }\n\n    public DisplayerType getType() {\n        String strType = settings.get(getSettingPath(DisplayerAttributeDef.TYPE));\n        return DisplayerType.getByName(strType);\n    }\n\n    public void setType(DisplayerType displayerType) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TYPE), displayerType.toString());\n    }\n\n    public DisplayerSubType getSubtype() {\n        String strSubtype = settings.get(getSettingPath(DisplayerAttributeDef.SUBTYPE));\n        return DisplayerSubType.getByName(strSubtype);\n    }\n\n    public void setSubtype(DisplayerSubType subtype) {\n        if (subtype != null)\n            settings.put(getSettingPath(DisplayerAttributeDef.SUBTYPE), subtype.toString());\n        else\n            settings.remove(getSettingPath(DisplayerAttributeDef.SUBTYPE));\n    }\n\n    public String getRenderer() {\n        return settings.get(getSettingPath(DisplayerAttributeDef.RENDERER));\n    }\n\n    public void setRenderer(String renderer) {\n        settings.put(getSettingPath(DisplayerAttributeDef.RENDERER), renderer);\n    }\n\n    public String getTitle() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.TITLE)));\n    }\n\n    public void setTitle(String title) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TITLE), title);\n    }\n\n    public boolean isTitleVisible() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.TITLE_VISIBLE)));\n    }\n\n    public void setTitleVisible(boolean titleVisible) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TITLE_VISIBLE), Boolean.toString(titleVisible));\n    }\n\n    public boolean isCSVExportAllowed() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.ALLOW_EXPORT_CSV))) || parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.EXPORT_TO_CSV)));\n    }\n\n    public void setCSVExportAllowed(boolean csvExportAllowed) {\n        settings.put(getSettingPath(DisplayerAttributeDef.EXPORT_TO_CSV), Boolean.toString(csvExportAllowed));\n    }\n\n    public boolean isExcelExportAllowed() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.ALLOW_EXPORT_EXCEL))) || parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.EXPORT_TO_XLS)));\n    }\n\n    public void setExcelExportAllowed(boolean excelExportAllowed) {\n        settings.put(getSettingPath(DisplayerAttributeDef.EXPORT_TO_XLS), Boolean.toString(excelExportAllowed));\n    }\n\n    public int getRefreshInterval() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.REFRESH_INTERVAL)), -1);\n    }\n\n    public void setRefreshInterval(int refreshInSeconds) {\n        settings.put(getSettingPath(DisplayerAttributeDef.REFRESH_INTERVAL), Integer.toString(refreshInSeconds));\n    }\n\n    public boolean isRefreshStaleData() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.REFRESH_STALE_DATA)));\n    }\n\n    public void setRefreshStaleData(boolean refresh) {\n        settings.put(getSettingPath(DisplayerAttributeDef.REFRESH_STALE_DATA), Boolean.toString(refresh));\n    }\n\n    public boolean isFilterEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.FILTER_ENABLED)));\n    }\n\n    public void setFilterEnabled(boolean filterEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.FILTER_ENABLED), Boolean.toString(filterEnabled));\n    }\n\n    public boolean isFilterSelfApplyEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.FILTER_SELFAPPLY_ENABLED)));\n    }\n\n    public void setFilterSelfApplyEnabled(boolean filterSelfApplyEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.FILTER_SELFAPPLY_ENABLED), Boolean.toString(filterSelfApplyEnabled));\n    }\n\n    public boolean isFilterNotificationEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.FILTER_NOTIFICATION_ENABLED)));\n    }\n\n    public void setFilterNotificationEnabled(boolean filterNotificationEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.FILTER_NOTIFICATION_ENABLED), Boolean.toString(filterNotificationEnabled));\n    }\n\n    public boolean isFilterListeningEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.FILTER_LISTENING_ENABLED)));\n    }\n\n    public void setFilterListeningEnabled(boolean filterListeningEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.FILTER_LISTENING_ENABLED), Boolean.toString(filterListeningEnabled));\n    }\n\n    public int getSelectorWidth() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.SELECTOR_WIDTH)), -1);\n    }\n\n    public void setSelectorWidth(int filterWidth) {\n        settings.put(getSettingPath(DisplayerAttributeDef.SELECTOR_WIDTH), Integer.toString(filterWidth));\n    }\n\n    public boolean isSelectorMultiple() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.SELECTOR_MULTIPLE)));\n    }\n\n    public void setSelectorMultiple(boolean filterMultiple) {\n        settings.put(getSettingPath(DisplayerAttributeDef.SELECTOR_MULTIPLE), Boolean.toString(filterMultiple));\n    }\n\n    public boolean isSelectorInputsEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.SELECTOR_SHOW_INPUTS)), true);\n    }\n\n    public void setSelectorInputsEnabled(boolean enabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.SELECTOR_SHOW_INPUTS), Boolean.toString(enabled));\n    }\n\n    public int getChartWidth() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_WIDTH)), 500);\n    }\n\n    public void setChartWidth(int chartWidth) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_WIDTH), Integer.toString(chartWidth));\n    }\n\n    public String getChartBackgroundColor() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.CHART_BGCOLOR)));\n    }\n\n    public void setChartBackgroundColor(String color) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_BGCOLOR), color);\n    }\n\n    public int getChartHeight() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_HEIGHT)), 300);\n    }\n\n    public void setChartHeight(int chartHeight) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_HEIGHT), Integer.toString(chartHeight));\n    }\n\n    public int getChartMarginTop() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_TOP)), 0);\n    }\n\n    public void setChartMarginTop(int chartMarginTop) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_TOP), Integer.toString(chartMarginTop));\n    }\n\n    public int getChartMarginBottom() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_BOTTOM)), 0);\n    }\n\n    public void setChartMarginBottom(int chartMarginBottom) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_BOTTOM), Integer.toString(chartMarginBottom));\n    }\n\n    public int getChartMarginLeft() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_LEFT)), 0);\n    }\n\n    public void setChartMarginLeft(int chartMarginLeft) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_LEFT), Integer.toString(chartMarginLeft));\n    }\n\n    public int getChartMarginRight() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_RIGHT)), 0);\n    }\n\n    public void setChartMarginRight(int chartMarginRight) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MARGIN_RIGHT), Integer.toString(chartMarginRight));\n    }\n\n    public int getChartMaxWidth() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MAX_WIDTH)), 600);\n    }\n\n    public void setChartMaxWidth(int chartWidth) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MAX_WIDTH), Integer.toString(chartWidth));\n    }\n\n    public int getChartMaxHeight() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.CHART_MAX_HEIGHT)), 400);\n    }\n\n    public void setChartMaxHeight(int chartHeight) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_MAX_HEIGHT), Integer.toString(chartHeight));\n    }\n\n    public void setResizable(boolean resizable) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_RESIZABLE), Boolean.toString(resizable));\n    }\n\n    public boolean isResizable() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.CHART_RESIZABLE)));\n    }\n\n    public boolean isChartShowLegend() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.CHART_SHOWLEGEND)));\n    }\n\n    public void setChartShowLegend(boolean chartShowLegend) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_SHOWLEGEND), Boolean.toString(chartShowLegend));\n    }\n\n    public Position getChartLegendPosition() {\n        Position pos = Position.getByName(settings.get(getSettingPath(DisplayerAttributeDef.CHART_LEGENDPOSITION)));\n        if (pos == null)\n            return Position.RIGHT;\n        return pos;\n    }\n\n    public void setChartLegendPosition(Position chartLegendPosition) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_LEGENDPOSITION), chartLegendPosition.toString());\n    }\n\n    public int getTablePageSize() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_PAGESIZE)), 10);\n    }\n\n    public void setTablePageSize(int tablePageSize) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_PAGESIZE), Integer.toString(tablePageSize));\n    }\n\n    public int getTableWidth() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_WIDTH)), 0);\n    }\n\n    public void setTableWidth(int tableWidth) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_WIDTH), Integer.toString(tableWidth));\n    }\n\n    public boolean isTableSortEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_SORTENABLED)));\n    }\n\n    public void setTableSortEnabled(boolean tableSortEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_SORTENABLED), Boolean.toString(tableSortEnabled));\n    }\n\n    public void setTableColumnPickerEnabled(boolean tableColumnPickerEnabled) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_COLUMN_PICKER_ENABLED), Boolean.toString(tableColumnPickerEnabled));\n    }\n\n    public String getTableDefaultSortColumnId() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_SORTCOLUMNID)));\n    }\n\n    public void setTableDefaultSortColumnId(String tableDefaultSortColumnId) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_SORTCOLUMNID), tableDefaultSortColumnId);\n    }\n\n    public SortOrder getTableDefaultSortOrder() {\n        SortOrder order = SortOrder.getByName(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_SORTORDER)));\n        if (order == null)\n            return SortOrder.ASCENDING;\n        return order;\n    }\n\n    public void setTableDefaultSortOrder(SortOrder tableDefaultSortOrder) {\n        settings.put(getSettingPath(DisplayerAttributeDef.TABLE_SORTORDER), tableDefaultSortOrder.toString());\n    }\n\n    public boolean isTableColumnPickerEnabled() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.TABLE_COLUMN_PICKER_ENABLED)), true);\n    }\n\n    public boolean isXAxisShowLabels() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.XAXIS_SHOWLABELS)));\n    }\n\n    public void setXAxisShowLabels(boolean axisShowLabels) {\n        settings.put(getSettingPath(DisplayerAttributeDef.XAXIS_SHOWLABELS), Boolean.toString(axisShowLabels));\n    }\n\n    public int getXAxisLabelsAngle() {\n        return parseInt(settings.get(getSettingPath(DisplayerAttributeDef.XAXIS_LABELSANGLE)), 0);\n    }\n\n    public void setXAxisLabelsAngle(int axisLabelsAngle) {\n        settings.put(getSettingPath(DisplayerAttributeDef.XAXIS_LABELSANGLE), Integer.toString(axisLabelsAngle));\n    }\n\n    public String getXAxisTitle() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.XAXIS_TITLE)));\n    }\n\n    public void setXAxisTitle(String axisTitle) {\n        settings.put(getSettingPath(DisplayerAttributeDef.XAXIS_TITLE), axisTitle);\n    }\n\n    public boolean isYAxisShowLabels() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.YAXIS_SHOWLABELS)));\n    }\n\n    public void setYAxisShowLabels(boolean axisShowLabels) {\n        settings.put(getSettingPath(DisplayerAttributeDef.YAXIS_SHOWLABELS), Boolean.toString(axisShowLabels));\n    }\n\n    //    public int getYAxisLabelsAngle() {\n    //        return parseInt( settings.get( getSettingPath( DisplayerAttributeDef.YAXIS_LABELSANGLE ) ), 10 );\n    //    }\n    //\n    //    public void setYAxisLabelsAngle( int axisLabelsAngle ) {\n    //        settings.put( getSettingPath( DisplayerAttributeDef.YAXIS_LABELSANGLE ), Integer.toString( axisLabelsAngle ) );\n    //    }\n\n    public String getYAxisTitle() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.YAXIS_TITLE)));\n    }\n\n    public void setYAxisTitle(String axisTitle) {\n        settings.put(getSettingPath(DisplayerAttributeDef.YAXIS_TITLE), axisTitle);\n    }\n\n    public long getMeterStart() {\n        return parseLong(settings.get(getSettingPath(DisplayerAttributeDef.METER_START)), 0);\n    }\n\n    public void setMeterStart(long meterStart) {\n        settings.put(getSettingPath(DisplayerAttributeDef.METER_START), Long.toString(meterStart));\n    }\n\n    public long getMeterWarning() {\n        return parseLong(settings.get(getSettingPath(DisplayerAttributeDef.METER_WARNING)), 60);\n    }\n\n    public void setMeterWarning(long meterWarning) {\n        settings.put(getSettingPath(DisplayerAttributeDef.METER_WARNING), Long.toString(meterWarning));\n    }\n\n    public long getMeterCritical() {\n        return parseLong(settings.get(getSettingPath(DisplayerAttributeDef.METER_CRITICAL)), 90);\n    }\n\n    public void setMeterCritical(long meterCritical) {\n        settings.put(getSettingPath(DisplayerAttributeDef.METER_CRITICAL), Long.toString(meterCritical));\n    }\n\n    public long getMeterEnd() {\n        return parseLong(settings.get(getSettingPath(DisplayerAttributeDef.METER_END)), 100);\n    }\n\n    public void setMeterEnd(long meterEnd) {\n        settings.put(getSettingPath(DisplayerAttributeDef.METER_END), Long.toString(meterEnd));\n    }\n\n    public String getDonutHoleTitle() {\n        return settings.get(getSettingPath(DisplayerAttributeDef.DONUT_HOLE_TITLE));\n    }\n\n    public void setDonutHoleTitle(String holeTitle) {\n        settings.put(getSettingPath(DisplayerAttributeDef.DONUT_HOLE_TITLE), holeTitle);\n    }\n\n    public boolean isChart3D() {\n        return parseBoolean(settings.get(getSettingPath(DisplayerAttributeDef.CHART_3D)));\n    }\n\n    public void setChart3D(boolean barchartThreeDimension) {\n        settings.put(getSettingPath(DisplayerAttributeDef.CHART_3D), Boolean.toString(barchartThreeDimension));\n    }\n\n    public void setHtmlTemplate(String htmlTemplate) {\n        settings.put(getSettingPath(DisplayerAttributeDef.HTML_TEMPLATE), htmlTemplate);\n    }\n\n    public void setJsTemplate(String jsTemplate) {\n        settings.put(getSettingPath(DisplayerAttributeDef.JS_TEMPLATE), jsTemplate);\n    }\n\n    public String getHtmlTemplate() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.HTML_TEMPLATE)));\n    }\n\n    public String getJsTemplate() {\n        return parseString(settings.get(getSettingPath(DisplayerAttributeDef.JS_TEMPLATE)));\n    }\n\n    public void setMapColorScheme(MapColorScheme colorScheme) {\n        settings.put(getSettingPath(DisplayerAttributeDef.MAP_COLOR_SCHEME), colorScheme.toString());\n\n    }\n\n    public MapColorScheme getMapColorScheme() {\n        return MapColorScheme.from(settings.get(getSettingPath(DisplayerAttributeDef.MAP_COLOR_SCHEME)));\n    }\n\n    public String getComponentId() {\n        return settings.get(getSettingPath(DisplayerAttributeDef.EXTERNAL_COMPONENT_ID));\n    }\n\n    public String setComponentId(String componentId) {\n        return settings.put(getSettingPath(DisplayerAttributeDef.EXTERNAL_COMPONENT_ID), componentId);\n    }\n\n    public void setComponentProperty(String key, String value) {\n        String componentId = getComponentId();\n        if (componentId != null) {\n            String newParamKey = componentPrefix(componentId, key);\n            settings.put(newParamKey, value);\n        }\n    }\n\n    public String getComponentProperty(String key) {\n        String componentId = getComponentId();\n        if (componentId == null) {\n            return null;\n        }\n        String newKey = componentPrefix(componentId, key);\n        return settings.get(newKey);\n    }\n\n    public Map<String, String> getComponentProperties() {\n        String componentId = getComponentId();\n        if (componentId == null) {\n            return Collections.emptyMap();\n        }\n        return settings.entrySet()\n                       .stream()\n                       .filter(e -> e.getKey().startsWith(componentId))\n                       .collect(Collectors.toMap(e -> removeComponentPrefix(componentId, e.getKey()), Map.Entry::getValue));\n    }\n\n    public String getComponentPartition() {\n        return settings.get(getSettingPath(DisplayerAttributeDef.EXTERNAL_COMPONENT_PARTITION));\n    }\n\n    public String setComponentPartition(String componentPartition) {\n        return settings.put(getSettingPath(DisplayerAttributeDef.EXTERNAL_COMPONENT_PARTITION), componentPartition);\n    }\n\n    private String componentPrefix(String componentId, String key) {\n        return componentId + \".\" + key;\n    }\n\n    private String removeComponentPrefix(String componentId, String key) {\n        return key.replaceAll(componentId + \".\", \"\");\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookupBuilder;\n\n/**\n * A DisplayerSettingsBuilder allows for the assembly of a DisplayerSettings instance in a friendly manner.\n *\n * <pre>\n *   DisplayerSettingsFactory.newBarChartSettings()\n *   .title(\"By Product\")\n *   .titleVisible(false)\n *   .margins(10, 50, 100, 100)\n *   .column(\"Product\")\n *   .column(\"Total amount\")\n *   .horizontal()\n *   .buildSettings();\n * </pre>\n *\n * @see DisplayerSettings\n */\npublic interface DisplayerSettingsBuilder<T> extends DataSetLookupBuilder<T> {\n\n    /**\n     * Set the DisplayerSettings' UUID.\n     *\n     * @param uuid The UUID of the DisplayerSettings that is being assembled.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T uuid(String uuid);\n\n    /**\n     * Set a direct reference to the source data set that will be used by the Displayer that is being assembled.\n     * <p>When using this <i>dataset provided mode</i> the data set lookup operations set (if any): filter, group & sort  will not be taking into account).\n     *\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     * @see org.dashbuilder.dataset.DataSet\n     */\n    T dataset(DataSet dataSet);\n\n    /**\n     * Sets the caption that will be shown for this particular visualization of the data.\n     * @param title The caption to be shown\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T title(String title);\n\n    /**\n     * Set whether the caption should be visible or not.\n     * @param visible True if the caption is to be visible, false if not.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T titleVisible(boolean visible);\n\n    /**\n     * Set the background color for the displayer. \n     * @param backgroundColor The background color code.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T backgroundColor(String backgroundColor);\n    \n    /**\n     * Set the renderer that will be used for visualizing this DisplayerSettings.\n     * @param renderer The identifier of the renderer.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T renderer(String renderer);\n\n    /**\n     * Set the DisplayerSettings' subtype.\n     *\n     * @param displayerSubType The displayer's subtype.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T subtype(DisplayerSubType displayerSubType);\n\n    /**\n     * Enable the ability to select/filter values (or range of values) within the data displayer.\n     *\n     * <p> Usually, in a dashboard there exists a unique coordinator which takes cares of propagate all the data\n     * selection events among the other displayers. If enabled then there exists also the ability to configure how to\n     * interact with other displayers in the same dashboard.</p>\n\n     * @param applySelf If true then any filter request issued within the data displayer will be applied to the own displayer.\n     * @param notifyOthers If true then any filter request issued within the data displayer will be propagated to other interested displayers.\n     * @param receiveFromOthers If true then the data displayer will listen for filter requests coming from other displayers.\n     *\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers);\n\n    /**\n     * Disable the ability to select/filter values (or range of values) within the displayer.\n     *\n     * @param receiveFromOthers If true then the data displayer will listen for filter requests coming from other displayers.\n     * @see DisplayerSettingsBuilder#filterOn DisplayerSettingsBuilder's filterOn method.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T filterOff(boolean receiveFromOthers);\n\n    /**\n     * Force the displayer to redraw only when data becomes stale.\n     *\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T refreshOn();\n\n    /**\n     * Force the displayer to redraw every time interval.\n     *\n     * @param seconds The refresh time frame in seconds. If < 0 then periodic refresh is disabled.\n     * @param onStale Refresh when the data becomes stale.\n     *\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T refreshOn(int seconds, boolean onStale);\n\n    /**\n     * Switch off the automatic refresh.\n     *\n     * @see DisplayerSettingsBuilder#refreshOn DisplayerSettingsBuilder's refreshOn method.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T refreshOff();\n\n    /**\n     * Defines the display name for the last specified data set column.\n     *\n     * NOTE: This method can only be called right after a call to <i>DataSetLookupBuilder#column(...)</i>.\n     *\n     * @param name The column display name.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T format(String name);\n\n    /**\n     * Defines the display format for the last specified data set column.Every data set value will be formatted\n     * according to the specified <i>pattern</i> parameter which defines the string format of the data set value.\n     * Examples:\n     * <ul>\n     *     <li>format(\"Amount\", \"$ #,###.##\") => \"$ 10,450.5\"</li>\n     *     <li>format(\"Amount\", \"$ #,### K\") => \"$ 450 K\"</li>\n     * </ul>\n     *\n     * NOTE: This method can only be called right after a call to <i>DataSetLookupBuilder#column(...)</i>.\n     *\n     * @param name The column display name.\n     * @param pattern The standard java <i>DecimalFormat</i> and <i>DateFormat</i> can be used used for both number and date columns.\n     * @see java.text.DecimalFormat\n     * @see java.text.SimpleDateFormat\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T format(String name, String pattern);\n\n    /**\n     * Defines the display format for the specified data set column. Every data set value will be formatted\n     * according to the specified <i>pattern</i> parameter which defines the string format of the data set value.\n     * Examples:\n     * <ul>\n     *     <li>format(\"Amount\", \"$ #,###.##\") => \"$ 10,450.5\"</li>\n     *     <li>format(\"Amount\", \"$ #,### K\") => \"$ 450 K\"</li>\n     * </ul>\n     *\n     * @param columnId The column identifier.\n     * @param name The column display name.\n     * @param pattern The standard java <i>DecimalFormat</i> and <i>DateFormat</i> are used for both number and date columns.\n     * @see java.text.DecimalFormat\n     * @see java.text.SimpleDateFormat\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T format(String columnId, String name, String pattern);\n\n    /**\n     * Defines a mathematical expression used to calculate the real values to display for the last specified data set\n     * column.\n     *\n     * <p>For numeric columns the expression can be any basic math expression where the <i>value</i> keyword represent\n     * the source data set value and any of the basic math operators \"/ * + -\" are allowed. Examples:\n     * <ul>\n     *     <li>format(\"Amount\", \"$ #,###.##\").expression(\"value\") => \"$ 10,450.5\"</li>\n     *     <li>format(\"Amount\", \"$ #,###.##\").expression(\"value-1\") => \"$ 10,449.5\"</li>\n     *     <li>format(\"Amount\", \"$ #,##0.00 K\").expression(\"value/1000\") => \"$ 10.45 K\"</li>\n     * </ul>\n     *\n     * <p> For text columns you can manipulate the string using any javascript statement: Examples</p>\n     * <ul>\n     *     <li>format(\"Quarter\").expression(\"[\"1st Q\", \"2nd Q\", \"3rd Q\", \"4th Q\"][value+1]\") => \"3rd Q\" (value=1 in a date fixed grouped column)</li>\n     *     <li>format(\"3 chars\").expression(\"value.substring(0, 3) + \"...\") => \"Dav...\" it takes the first 3 chars only</li>\n     * </ul>\n     *\n     * NOTE: This method can only be called right after a call to <i>DataSetLookupBuilder#column(...)</i>\n     *\n     * @param expression The expression used to calculate the value to display\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T expression(String expression);\n\n    /**\n     * Sames as <i>expression(String expression)</i> but using the specified column.\n     *\n     * @param columnId The column identifier.\n     * @param expression The expression used to calculate the value to display\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T expression(String columnId, String expression);\n\n    /**\n     * <p>Support for user-provided HTML templates. For instance, a metric displayer could be configured as follows:</p>\n     *\n     *  <pre>\n     * {@code <div class=\"card-pf card-pf-accented card-pf-aggregate-status\"\n     *      style=\"background-color:${bgColor}; width:${width}px; height:${height}px; margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;\">\n     *      <h3>${title}</span></h3>\n     *      <h2 id=\"${value.ref}\">${value}</h2>\n     *  </div>\n     *  }</pre>\n     *\n     * Notice that, references (like \"${value.ref}\" in the example above) can be added to any of the HTML elements so that they can be referenced from the Javascript template.\n     * See {@link #jsTemplate(String)} for further details.\n     *\n     * @param html The HTML template used to render the displayer. The following enumeration contains all the available variables:\n     * <ul>\n     *     <li><b>id</b>: An identifier that it is unique among all the displayers</li>\n     *     <li><b>title</b>: The metric title</li>\n     *     <li><b>value</b>: The formatted value</li>\n     *     <li><b>value.raw</b>: The raw value</li>\n     *     <li><b>width</b>: The metric width</li>\n     *     <li><b>height</b>: The metric height</li>\n     *     <li><b>marginTop</b>: The top margin</li>\n     *     <li><b>marginBottom</b>: The bottom margin</li>\n     *     <li><b>marginLeft</b>: The left margin</li>\n     *     <li><b>marginRight</b>: The right margin</li>\n     *     <li><b>bgColor</b>: The background color</li>\n     *     <li><b>isFilterEnabled</b>: true or false depending whether the filter setting is enabled (see {@link #filterOn(boolean, boolean, boolean)})</li>\n     *     <li><b>isFilterOn</b>: true or false depending whether the filter function is currently on or of</li>\n     * </ul>\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T htmlTemplate(String html);\n\n    /**\n     * Specifies the JS template that is invoked every time the displayer is drawn.\n     *\n     * <p>Notice, HTML elements tagged as \"${...}\" can be referenced from the JS template. For instance, given the following\n     * HTML template:</p>\n     *\n     *  <pre>\n     * {@code <div class=\"card-pf card-pf-accented card-pf-aggregate-status\"\n     *      style=\"background-color:${bgColor}; width:${width}px; height:${height}px; margin-top:${marginTop}px; margin-right:${marginRight}px; margin-bottom:${marginBottom}px; margin-left:${marginLeft}px;\">\n     *      <h3>${title}</span></h3>\n     *      <h2 id=\"${valref}\">${value}</h2>\n     *  </div>\n     *  }</pre>\n     *\n     * <p>It is possible to implement some conditional into the JS so that the color of the text displayed depends on its value:</p>\n     *\n     * <pre>\n     * {@code ${valref}.style.color= ${value.raw} > 1000 ? \"red\" : \"black\";\n     *  }</pre>\n     *\n     * where the \"${valref}\" is the identifier of the HTML element holding the value.\n     *\n     * @param js A JS template. Notice, the same variables supported in {@link #htmlTemplate(String)} can be used in the JS.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T jsTemplate(String js);\n\n    /**\n     * @return The DisplayerSettings instance that has been configured.\n     * @see DisplayerSettings\n     */\n    DisplayerSettings buildSettings();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerSettingsFactory.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport org.dashbuilder.displayer.impl.AreaChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.BarChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.BubbleChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.ExternalDisplayerSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.LineChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.MapChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.MeterChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.MetricSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.PieChartSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.SelectorDisplayerSettingsBuilderImpl;\nimport org.dashbuilder.displayer.impl.TableDisplayerSettingsBuilderImpl;\n\n/**\n * Factory class for creating  DisplayerSettingsBuilder instances.\n */\npublic final class DisplayerSettingsFactory {\n\n    public static BarChartSettingsBuilder<BarChartSettingsBuilderImpl> newBarChartSettings() {\n        return new BarChartSettingsBuilderImpl();\n    }\n\n    public static PieChartSettingsBuilder<PieChartSettingsBuilderImpl> newPieChartSettings() {\n        return new PieChartSettingsBuilderImpl();\n    }\n\n    public static AreaChartSettingsBuilder<AreaChartSettingsBuilderImpl> newAreaChartSettings() {\n        return new AreaChartSettingsBuilderImpl();\n    }\n\n    public static LineChartSettingsBuilder<LineChartSettingsBuilderImpl> newLineChartSettings() {\n        return new LineChartSettingsBuilderImpl();\n    }\n\n    public static BubbleChartSettingsBuilder<BubbleChartSettingsBuilderImpl> newBubbleChartSettings() {\n        return new BubbleChartSettingsBuilderImpl();\n    }\n\n    public static MapChartSettingsBuilder<MapChartSettingsBuilderImpl> newMapChartSettings() {\n        return new MapChartSettingsBuilderImpl();\n    }\n\n    public static TableDisplayerSettingsBuilder<TableDisplayerSettingsBuilderImpl> newTableSettings() {\n        return new TableDisplayerSettingsBuilderImpl();\n    }\n\n    public static MeterChartSettingsBuilder<MeterChartSettingsBuilderImpl> newMeterChartSettings() {\n        return new MeterChartSettingsBuilderImpl();\n    }\n\n    public static SelectorDisplayerSettingsBuilder<SelectorDisplayerSettingsBuilderImpl> newSelectorSettings() {\n        return new SelectorDisplayerSettingsBuilderImpl();\n    }\n\n    public static MetricSettingsBuilder<MetricSettingsBuilderImpl> newMetricSettings() {\n        return new MetricSettingsBuilderImpl();\n    }\n    \n    public static ExternalDisplayerSettingsBuilder<ExternalDisplayerSettingsBuilderImpl> newExternalDisplayerSettings() {\n        return new ExternalDisplayerSettingsBuilderImpl();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerSubType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\npublic enum DisplayerSubType {\n    LINE,\n    SMOOTH,\n    AREA,\n    AREA_STACKED,\n    //        STEPPED,\n    BAR,\n    BAR_STACKED,\n    COLUMN,\n    COLUMN_STACKED,\n    PIE,\n    PIE_3D,\n    DONUT,\n    MAP_REGIONS,\n    MAP_MARKERS,\n    METRIC_CARD,\n    METRIC_CARD2,\n    METRIC_PLAIN_TEXT,\n    METRIC_QUOTA,\n    SELECTOR_DROPDOWN,\n    SELECTOR_SLIDER,\n    SELECTOR_LABELS;\n\n    public static DisplayerSubType getByName(String str) {\n        if (str == null) return null;\n        try {\n            return valueOf(str.toUpperCase());\n        } catch (Exception e) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/DisplayerType.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport static org.dashbuilder.displayer.DisplayerSubType.*;\n\n/**\n * An enumeration for the different types of displayers.\n */\npublic enum DisplayerType {\n\n    /**\n     * Bar Chart\n     */\n    BARCHART(BAR, BAR_STACKED, COLUMN, COLUMN_STACKED),\n\n    /**\n     * Pie Chart\n     */\n    PIECHART(PIE, PIE_3D, DONUT),\n\n    /**\n     * Area Chart\n     */\n    AREACHART(AREA, AREA_STACKED/*, STEPPED*/),\n\n    /**\n     * Line Chart\n     */\n    LINECHART(LINE, SMOOTH),\n\n    /**\n     * Bubble Chart\n     */\n    BUBBLECHART(),\n\n    /**\n     * Meter Chart\n     */\n    METERCHART(),\n\n    /**\n     * Table reports\n     */\n    TABLE(),\n\n    /**\n     * Map\n     */\n    MAP(MAP_REGIONS, MAP_MARKERS),\n\n    /**\n     * Selector\n     */\n    SELECTOR(SELECTOR_DROPDOWN, SELECTOR_LABELS, SELECTOR_SLIDER),\n\n    /**\n     * Metric\n     */\n    METRIC(METRIC_CARD, METRIC_CARD2, METRIC_QUOTA, METRIC_PLAIN_TEXT),\n\n    /**\n     * External Component Displayer\n     */\n    EXTERNAL_COMPONENT();\n\n    DisplayerType(DisplayerSubType... subtypes) {\n        for (DisplayerSubType displayerSubType : subtypes) {\n            this.subtypes.add(displayerSubType);\n        }\n    }\n\n    private List<DisplayerSubType> subtypes = new ArrayList<>();\n\n    public static DisplayerType getByName(String str) {\n        try {\n            return valueOf(str.toUpperCase());\n        } catch (Exception e) {\n            return null;\n        }\n    }\n\n    public List<DisplayerSubType> getSubTypes() {\n        return subtypes;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/ExternalDisplayerSettingsBuilder.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for external components\n *\n */\npublic interface ExternalDisplayerSettingsBuilder<T extends ExternalDisplayerSettingsBuilder> extends ChartSettingsBuilder<T> {\n\n    /**\n     * Set the external component id.\n     * @param id\n     *  The component Id\n     * @return\n     * This builder instance\n     */\n    T componentId(String id);\n\n    /**\n     * Set an external component property\n     * @param key\n     * The parameter key\n     * @param value\n     * The parameter value\n     * @return\n     * this builder instance\n     */\n    T componentProperty(String key, String value);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/LineChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for line charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newLineChartSettings()\n *   .title(\"By Product\")\n *   .column(\"Product\")\n *   .column(\"Total amount\")\n * </pre>\n */\npublic interface LineChartSettingsBuilder<T extends LineChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n    /**\n     * Set this line chart's subtype to a simple line chart\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Line chart data displayer.\n     */\n    T subType_Line();\n\n    /**\n     * Set this line chart's subtype to a smooth line chart (i.e. a line chart without sharp edges)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Line chart data displayer.\n     */\n    T subType_SmoothLine();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/MapChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for map charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newMapChartSettings()\n *   .title(\"By Country\")\n *   .column(\"Country\")\n *   .column(\"Total amount\")\n * </pre>\n */\npublic interface MapChartSettingsBuilder<T extends MapChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n    /**\n     * Set this map chart's subtype to a region map chart (i.e. a Map chart that highlights certain regions)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Map chart data displayer.\n     */\n    T subType_Region_Map();\n\n    /**\n     * Set this map chart's subtype to a marker map chart (i.e. a Map chart that shows a magnitude indication for certain regions)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Map chart data displayer.\n     */\n    T subType_Marker_Map();\n\n    /**\n     * Set this map color scheme.\n     * @param colorScheme\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Map chart data displayer.\n     */\n    T colorScheme(MapColorScheme colorScheme);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/MapColorScheme.java",
    "content": "package org.dashbuilder.displayer;\n\nimport java.util.stream.Stream;\n\npublic enum MapColorScheme {\n\n    RED,\n    GREEN,\n    BLUE;\n\n    public static MapColorScheme from(String value) {\n        return Stream.of(values())\n                     .filter(v -> v.toString().equalsIgnoreCase(value))\n                     .findFirst().orElseGet(() -> GREEN);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/MeterChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for meter charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newMeterChartSettings()\n *   .title(\"Sales goal\")\n *   .titleVisible(true)\n *   .width(250).height(250)\n *   .meter(0, 15000000, 25000000, 35000000)\n *   .column(\"Total amount\")\n *   .buildSettings());\n * </pre>\n */\npublic interface MeterChartSettingsBuilder<T extends MeterChartSettingsBuilder> extends ChartSettingsBuilder<T> {\n\n    /**\n     * Set specific the configuration parameters for this meter chart.\n     * @param start The start of the meter scale\n     * @param warning The warning level, any value above this level will be shown in orange on the meter chart.\n     * Values below this level are shown in green.\n     * @param critical The critical level, any value above this level will be shown in red on the meter chart.\n     * @param end The end of the meter scale.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Meter data displayer.\n     */\n    T meter(long start, long warning, long critical, long end);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/MetricSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for meter charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newMetricSettings()\n *   .dataset(\"sales\")\n *   .column(\"amount\", \"sum\", \"Total amount\")\n *   .title(\"Total Sales\")\n *   .titleVisible(true)\n *   .titlePosition(\"bottom\")\n *   .width(250).height(200)\n *   .metric(0, 0, 0, 100000)\n *   .buildSettings());\n * </pre>\n */\npublic interface MetricSettingsBuilder<T extends MetricSettingsBuilder> extends ChartSettingsBuilder<T> {\n\n    /**\n     * Set specific the configuration parameters for this metric chart.\n     *\n     * <p>All the reference values specified <i>start, warning, critical, and end</i> can be used to customize how the\n     * metric is displayed according its current value. </p>\n     *\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Meter data displayer.\n     */\n    T metric(long start, long warning, long critical, long end);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/PieChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for pie charts\n *\n * <pre>\n *   DisplayerSettingsFactory.newPieChartSettings()\n *   .title(\"By Product\")\n *   .column(\"Product\")\n *   .column(\"Total amount\")\n * </pre>\n */\npublic interface PieChartSettingsBuilder<T extends PieChartSettingsBuilder> extends XAxisChartSettingsBuilder<T> {\n\n    /**\n     * Set this pie chart's subtype to a simple pie chart\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Pie chart data displayer.\n     */\n    T subType_Pie();\n\n    /**\n     * Set this pie chart's subtype to a 3D pie chart\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Pie chart data displayer.\n     */\n    T subType_Pie_3d();\n\n    /**\n     * Set this pie chart's subtype to a donut-like simple pie chart (i.e. a pie chart with a hole in its center)\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Pie chart data displayer.\n     */\n    T subType_Donut();\n\n    /**\n     * Set this pie chart's subtype to a donut-like simple pie chart (i.e. a pie chart with a hole in its center)\n     * and, in addition, with the label to assign inside the donut graph hole.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Pie chart data displayer.\n     */\n    T subType_Donut(String holeLabel);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/Position.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/*\n * Generic enum for displayer element positioning purposes.\n */\npublic enum Position {\n\n    BOTTOM,\n    TOP,\n    LEFT,\n    RIGHT,\n    IN;\n\n    public static Position getByName(String str) {\n        try {\n            return valueOf(str.toUpperCase());\n        } catch (Exception e) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/SelectorDisplayerSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A displayer settings builder for selectors\n *\n * <pre>\n *   DisplayerSettingsFactory.newSelectorSettings()\n *   .dataset(\"products\")\n *   .group(\"product\")\n *   .count(\"items\")\n *   .title(\"Product selector\")\n *   .column(\"Product\")\n *   .column(\"Number of items\")\n * </pre>\n */\npublic interface SelectorDisplayerSettingsBuilder<T extends SelectorDisplayerSettingsBuilder> extends DisplayerSettingsBuilder<T> {\n\n    /**\n     * Sets the width of the selector.\n     * @param width The width of selector.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a selector.\n     */\n    T width(int width);\n\n    /**\n     * Set the margins for this selector.\n     * @param top The top margin.\n     * @param bottom The bottom margin.\n     * @param left The left margin.\n     * @param right The right margin.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure the selector.\n     */\n    T margins(int top, int bottom, int left, int right);\n\n    /**\n     * Enables or disables the selection of multiple entries\n     * @param multiple The multiple selection flag.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a selector.\n     */\n    T multiple(boolean multiple);\n    \n    \n    /**\n     * Set this selector chart's subtype to a selector Drop Down \n     * @return The DisplayerSettingsBuilder instance that is being used to configure a selector.\n     */\n    T subType_Dropdown();\n    \n    \n    /**\n     * Set this selector chart's subtype to a selector Slider. Used with dates and numeric values.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a selector.\n     */\n    T subType_Slider();\n    \n    /**\n     * Set this selector chart's subtype to a selector Labels. where labels will allow users to select a value\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a selector.\n     */\n    T subType_Labels();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/TableDisplayerSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\nimport org.dashbuilder.dataset.sort.SortOrder;\n\n/**\n * A displayer settings builder for tables\n *\n * <pre>\n *   DisplayerSettingsFactory.newTableSettings()\n *   .title(\"List of Opportunities\")\n *   .tablePageSize(20)\n *   .tableOrderEnabled(true)\n *   .tableOrderDefault(\"amount\", \"desc\")\n *   .buildSettings()\n * </pre>\n */\npublic interface TableDisplayerSettingsBuilder<T extends TableDisplayerSettingsBuilder> extends DisplayerSettingsBuilder<T> {\n\n    /**\n     * Sets the page size (i.e. the number of rows per page) for this table displayer.\n     * @param pageSize The page size.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T tablePageSize(int pageSize);\n\n    /**\n     * If true, it enables the table columns to be ordered.\n     * @param enabled True to enable, false to disable.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T tableOrderEnabled(boolean enabled);\n\n    /**\n     * Set the default ordering column.\n     * @param columnId The identifier of the column by which the table should by default be ordered.\n     * @param order The sort order to apply on the specified column.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     * @see org.dashbuilder.dataset.sort.SortOrder\n     */\n    T tableOrderDefault(String columnId, SortOrder order);\n\n    /**\n     * Set the default ordering column.\n     * @param columnId The identifier of the column by which the table should by default be ordered.\n     * @param order The sort order to apply on the specified column, as a String (accepted values are \"asc\" and \"desc\".\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T tableOrderDefault(String columnId, String order);\n\n    /**\n     * Set the table total width.\n     * @param tableWidth The total table width, in pixels.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T tableWidth(int tableWidth);\n\n    /**\n     * If true, it enables to show/hide the table columns by means of a column picker widget.\n     * @param enabled True to enable, false to disable.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T tableColumnPickerEnabled(boolean enabled);\n    \n    \n    /**\n     * If true, makes the table with full width and responsible\n     * @param enabled True to enable, false to disable.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a Table data displayer.\n     */\n    T resizable(boolean enabled);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/XAxisChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer;\n\n/**\n * A common base interface for al charts that are axis-based.\n */\npublic interface XAxisChartSettingsBuilder<T extends XAxisChartSettingsBuilder> extends ChartSettingsBuilder<T> {\n\n    /**\n     * Set the X axis title.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T xAxisTitle(String title);\n\n    /**\n     * Set the X axis labels display angle (from 0 to 360).\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T xAxisAngle(int angle);\n\n    /**\n     * Set the Y axis title.\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T yAxisTitle(String title);\n    \n    /**\n     * Set if the Y axis labels should be displayed\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T yAxisShowLabels(boolean axisShowLabels);\n    \n    /**\n     * Set if the X axis labels should be displayed\n     * @return The DisplayerSettingsBuilder instance that is being used to configure a DisplayerSettings.\n     */\n    T xAxisShowLabels(boolean axisShowLabels);\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalColumn.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class ExternalColumn {\n    \n    @JsProperty\n    String name;\n    \n    @JsProperty\n    String type;\n    \n    ExternalColumnSettings settings;\n    \n    @JsOverlay\n    public static ExternalColumn of(String name, String type, ExternalColumnSettings settings) {\n        ExternalColumn column = new ExternalColumn();\n        column.name = name;\n        column.type = type;\n        column.settings = settings;\n        return column;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalColumnSettings.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.external;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class ExternalColumnSettings {\n\n    @JsProperty\n    String columnId;\n    @JsProperty\n    String columnName;\n    @JsProperty\n    String valueExpression;\n    @JsProperty\n    String emptyTemplate;\n    @JsProperty\n    String valuePattern;\n\n    @JsOverlay\n    public static ExternalColumnSettings of(String columnId,\n                                            String columnName,\n                                            String valueExpression,\n                                            String emptyTemplate,\n                                            String valuePattern) {\n        ExternalColumnSettings settings = new ExternalColumnSettings();\n        settings.columnId = columnId;\n        settings.columnName = columnName;\n        settings.valueExpression = valueExpression;\n        settings.emptyTemplate = emptyTemplate;\n        settings.valuePattern = valuePattern;\n        return settings;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalComponentFunction.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.external;\n\nimport java.util.Map;\nimport java.util.function.Consumer;\n\npublic interface ExternalComponentFunction {\n\n    default String getName() {\n        return this.getClass().getSimpleName();\n    }\n\n    void exec(Map<String, Object> params, Consumer<Object> onFinish, Consumer<String> onError);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalComponentMessage.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport java.util.Map;\n\nimport elemental2.core.JsMap;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class ExternalComponentMessage {\n\n    JsMap<String, Object> properties;\n\n    // Change this when @JsEnum is supported.\n    String type;\n\n    @JsOverlay\n    static ExternalComponentMessage create(String messageType, Map<String, Object> properties) {\n        ExternalComponentMessage message = new ExternalComponentMessage();\n        message.properties = new JsMap<>();\n        message.type = messageType;\n        properties.forEach(message::setProperty);\n        return message;\n    }\n\n    @JsOverlay\n    public final void setProperty(String key, Object value) {\n        properties.set(key, value);\n    }\n\n    @JsOverlay\n    public final Object getProperty(String key) {\n        return properties != null ? properties.get(key) : null;\n    }\n\n    @JsOverlay\n    public final String getType() {\n        return type;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalComponentMessageHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport jsinterop.base.Js;\n\n/**\n * Helper to deal with External Component Messages.\n *\n */\npublic class ExternalComponentMessageHelper {\n\n    /**\n     * Message when a requested function is not found\n     */\n    public static final String FUNCTION_NOT_FOUND = \"Function not found.\";\n\n    /**\n     * Message when a function is executed with success\n     */\n    public static final String FUNCTION_CALL_SUCESS = \"Function called with success\";\n\n    /**\n     * Message when a message is of type FUNCTION_CALL, but the request to call the function is not found.\n     */\n    public static final String FUNCTION_CALL_REQUEST_NOT_FOUND = \"You must provide a function request to call a function.\";\n\n    /**\n     * Default message when there was an error executing the function.\n     */\n    public static final String FUNCTION_EXECUTION_ERROR_FOUND = \"There was an error executing the function\";\n\n    /**\n     * The property that should be used by components to find its unique ID during Runtime.\n     */\n    static final String COMPONENT_RUNTIME_ID_PROP = \"component_id\";\n\n    /**\n     * Inbound property to define the dataset to be consumed by components.\n     */\n    static final String DATA_SET_PROP = \"dataSet\";\n\n    /**\n     * Outbound property to define the filter request. Should be used with messages of type Filter Request.\n     */\n    static final String FILTER_PROP = \"filter\";\n\n    /**\n     * Outbound property to define the name of a function to be invoked.\n     */\n    static final String FUNCTION_CALL_PROP = \"functionCallRequest\";\n\n    /**\n     * Inbound property to define the result of a function call.\n     */\n    static final String FUNCTION_RESPONSE_PROP = \"functionResponse\";\n\n    /**\n     * Inbound property to define the result of a function call.\n     */\n    static final String CONFIGURATION_ISSUE_PROP = \"configurationIssue\";\n\n    /**\n     * Extract filter request from messages coming from the component.\n     * \n     * @param message\n     * The message sent by the component.\n     * @return\n     * An optional containing the filter extracted from the message.\n     */\n    public Optional<ExternalFilterRequest> filterRequest(ExternalComponentMessage message) {\n        Object filterProp = message.getProperty(FILTER_PROP);\n        if (filterProp != null) {\n            ExternalFilterRequest filterRequest = Js.cast(filterProp);\n            return Optional.ofNullable(filterRequest);\n        }\n        return Optional.empty();\n    }\n\n    /**\n     * \n     * Retrieves a function call object from a message.\n     * \n     * @param message\n     */\n    public Optional<FunctionCallRequest> functionCallRequest(ExternalComponentMessage message) {\n        Object functionCallObj = message.getProperty(FUNCTION_CALL_PROP);\n        if (functionCallObj != null) {\n            FunctionCallRequest functionCallRequest = Js.cast(functionCallObj);\n            return Optional.ofNullable(functionCallRequest);\n        }\n        return Optional.empty();\n    }\n\n    /**\n     * Builds a message that contains dataset and component properties.\n     * @param ds\n     * The dataset that will be sent to client\n     * @param componentProperties\n     * All the component properties\n     * @return\n     * The message ready to be sent to the user.\n     */\n    public ExternalComponentMessage newDataSetMessage(ExternalDataSet ds, Map<String, Object> componentProperties) {\n        ExternalComponentMessage message = ExternalComponentMessage.create(ExternalComponentMessageType.DATASET.name(), componentProperties);\n        message.setProperty(DATA_SET_PROP, ds);\n        return message;\n    }\n\n    /**\n     * Creates a message of type INIT, which is the first message sent to the component.\n     * @param componentProperties\n     * The initial properties.\n     * @return\n     * The message ready to be sent.\n     */\n    public ExternalComponentMessage newInitMessage(Map<String, Object> componentProperties) {\n        return ExternalComponentMessage.create(ExternalComponentMessageType.INIT.name(), componentProperties);\n    }\n\n    public ExternalComponentMessage newFunctionError(FunctionCallRequest functionCallRequest, String errorMessage) {\n        Map<String, Object> props = Collections.singletonMap(FUNCTION_RESPONSE_PROP,\n                                                             FunctionResponse.create(functionCallRequest,\n                                                                                     FunctionResultType.ERROR.name(),\n                                                                                     FUNCTION_EXECUTION_ERROR_FOUND,\n                                                                                     errorMessage));\n        return ExternalComponentMessage.create(ExternalComponentMessageType.FUNCTION_RESPONSE.name(), props);\n    }\n\n    /**\n     * \n     * Produces a message to respond function call requests here the function could not be found.\n     * @param functionCallRequest\n     * @return\n     */\n    public ExternalComponentMessage newFunctionNotFound(FunctionCallRequest functionCallRequest) {\n        Map<String, Object> props = Collections.singletonMap(FUNCTION_RESPONSE_PROP,\n                                                             FunctionResponse.create(functionCallRequest,\n                                                                                     FunctionResultType.NOT_FOUND.name(),\n                                                                                     FUNCTION_NOT_FOUND,\n                                                                                     null));\n        return ExternalComponentMessage.create(ExternalComponentMessageType.FUNCTION_RESPONSE.name(), props);\n    }\n\n    /**\n     * Generate messages for function call message types that does not specify a function call request.\n     * @return\n     */\n    public ExternalComponentMessage newFunctionRequestNotFound() {\n        Map<String, Object> props = Collections.singletonMap(FUNCTION_RESPONSE_PROP,\n                                                             FunctionResponse.create(null,\n                                                                                     FunctionResultType.ERROR.name(),\n                                                                                     FUNCTION_CALL_REQUEST_NOT_FOUND,\n                                                                                     null));\n        return ExternalComponentMessage.create(ExternalComponentMessageType.FUNCTION_RESPONSE.name(), props);\n    }\n\n    /**\n     * \n     * Messages to sent when a function is called with success\n     * \n     * @param functionCallRequest\n     * @param result\n     * The function execution result.\n     * @return\n     */\n    public ExternalComponentMessage newFunctionSuccess(FunctionCallRequest functionCallRequest, Object result) {\n        Map<String, Object> props = Collections.singletonMap(FUNCTION_RESPONSE_PROP,\n                                                             FunctionResponse.create(functionCallRequest,\n                                                                                     FunctionResultType.SUCCESS.name(),\n                                                                                     FUNCTION_CALL_SUCESS,\n                                                                                     result));\n        return ExternalComponentMessage.create(ExternalComponentMessageType.FUNCTION_RESPONSE.name(), props);\n    }\n\n    /**\n     * \n     * Add the component runtime ID to a message\n     * @param message\n     * The message which the ID should be set\n     * @param componentId\n     * The component unique ID. It should be used by components to send messages to DB.\n     */\n    public void withId(ExternalComponentMessage message, String componentId) {\n        message.setProperty(COMPONENT_RUNTIME_ID_PROP, componentId);\n    }\n\n    /**\n     * Extract the component Id from a message.\n     * @param message\n     * The target message to have the component id removed.\n     * @return\n     * An optional containing the component id.\n     */\n    public Optional<String> getComponentId(ExternalComponentMessage message) {\n        return getValue(COMPONENT_RUNTIME_ID_PROP, message);\n    }\n\n    public Optional<String> getConfigurationIssue(ExternalComponentMessage message) {\n        return getValue(CONFIGURATION_ISSUE_PROP, message);\n    }\n\n    /**\n     * \n     * Check if the given message is an INIT message.\n     * @param message\n     * The message to be checked.\n     * @return\n     * true if it is a message of type INIT.\n     */\n    public boolean isInit(ExternalComponentMessage message) {\n        String type = verifyTypeNotNull(message);\n        return ExternalComponentMessageType.INIT.name().equals(type);\n    }\n\n    public ExternalComponentMessageType messageType(ExternalComponentMessage message) {\n        String type = verifyTypeNotNull(message);\n        return ExternalComponentMessageType.valueOf(type);\n    }\n\n    private String verifyTypeNotNull(ExternalComponentMessage message) {\n        String type = message.getType();\n        if (type == null) {\n            throw new IllegalArgumentException(\"Message type cannot be null.\");\n        }\n        return type;\n    }\n\n    private Optional<String> getValue(String valueKey, ExternalComponentMessage message) {\n        Object valueObj = message.getProperty(valueKey);\n        if (valueObj != null) {\n            String componentId = valueObj.toString();\n            return Optional.ofNullable(componentId);\n        }\n        return Optional.empty();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalComponentMessageType.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\n/**\n * External Component Message types\n *\n */\npublic enum ExternalComponentMessageType {\n\n    // DB Sent messages\n    FUNCTION_RESPONSE,\n    DATASET,\n    INIT,\n\n    // Component Sent messages\n    FUNCTION_CALL,\n    FILTER,\n    FIX_CONFIGURATION,\n    CONFIGURATION_OK,\n    READY;\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalDataSet.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport elemental2.core.JsArray;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * DataSet representation for external Components.\n *\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class ExternalDataSet {\n\n    @JsProperty\n    JsArray<ExternalColumn> columns;\n\n    @JsProperty\n    JsArray<JsArray<String>> data;\n\n    @JsOverlay\n    public static ExternalDataSet of(ExternalColumn[] columns, String[][] data) {\n        ExternalDataSet ds = new ExternalDataSet();\n        ds.columns = new JsArray<>();\n        ds.data = new JsArray<>();\n\n        for(ExternalColumn column : columns) {\n            ds.columns.push(column);\n        }\n\n        for (String[] line: data) {\n            JsArray<String> lineArray = new JsArray<>();\n            for (String v : line) {\n                lineArray.push(v);\n            }\n            ds.data.push(lineArray);\n        }         \n        return ds;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/ExternalFilterRequest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class ExternalFilterRequest {\n\n    @JsProperty\n    public native boolean isReset();\n\n    @JsProperty\n    public native int getRow();\n\n    @JsProperty\n    public native int getColumn();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/FunctionCallRequest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport elemental2.core.JsMap;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class FunctionCallRequest {\n\n    @JsProperty\n    public native String getFunctionName();\n\n    @JsProperty\n    public native JsMap<String, Object> getParameters();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/FunctionResponse.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class FunctionResponse {\n\n    FunctionCallRequest request;\n\n    String resultType;\n\n    String message;\n\n    Object result;\n\n    @JsOverlay\n    public static FunctionResponse create(FunctionCallRequest request, String resultType, String message, Object result) {\n        FunctionResponse response = new FunctionResponse();\n        response.request = request;\n        response.resultType = resultType;\n        response.message = message;\n        response.result = result;\n        return response;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/external/FunctionResultType.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.displayer.external;\n\n/**\n * Values for a function result.\n *\n */\npublic enum FunctionResultType {\n\n    /**\n     * Used when a function is successfully invoked.\n     */\n    SUCCESS,\n    /**\n     * Some error happened when executing the function.\n     */\n    ERROR,\n    /**\n     * The function was not found.\n     */\n    NOT_FOUND;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/AbstractChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.ChartSettingsBuilder;\nimport org.dashbuilder.displayer.Position;\n\npublic abstract class AbstractChartSettingsBuilder<T extends ChartSettingsBuilder> extends AbstractDisplayerSettingsBuilder<T> implements ChartSettingsBuilder<T> {\n\n    public T width(int width) {\n        displayerSettings.setChartWidth( width );\n        return (T) this;\n    }\n\n    public T height(int height) {\n        displayerSettings.setChartHeight( height );\n        return (T) this;\n    }\n\n    public T margins(int top, int bottom, int left, int right) {\n        displayerSettings.setChartMarginTop(top);\n        displayerSettings.setChartMarginBottom(bottom);\n        displayerSettings.setChartMarginLeft(left);\n        displayerSettings.setChartMarginRight(right);\n        return (T) this;\n    }\n\n    public T legendOff() {\n        displayerSettings.setChartShowLegend(false);\n        return (T) this;\n    }\n\n    public T legendOn(Position position) {\n        return legendOn(position.name());\n    }\n\n    public T legendOn(String position) {\n        displayerSettings.setChartShowLegend(true);\n        displayerSettings.setChartLegendPosition(Position.getByName(position));\n        return (T) this;\n    }\n\n    public T resizableOn(int maxWidth, int maxHeight) {\n        displayerSettings.setResizable(true);\n        displayerSettings.setChartMaxWidth(maxWidth);\n        displayerSettings.setChartMaxHeight(maxHeight);\n        return (T) this;\n    }\n\n    public T resizableOff() {\n        displayerSettings.setResizable(false);\n        return (T) this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/AbstractDisplayerSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetOp;\nimport org.dashbuilder.dataset.group.DataSetGroup;\nimport org.dashbuilder.dataset.group.GroupFunction;\nimport org.dashbuilder.dataset.impl.AbstractDataSetLookupBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSubType;\n\n/**\n * Base class for DisplayerSettingsBuilder implementations.\n */\npublic abstract class AbstractDisplayerSettingsBuilder<T> extends AbstractDataSetLookupBuilder<T> implements DisplayerSettingsBuilder<T> {\n\n    protected DisplayerSettings displayerSettings = createDisplayerSettings();\n\n    protected abstract DisplayerSettings createDisplayerSettings();\n\n    public T uuid(String uuid) {\n        displayerSettings.setUUID(uuid);\n        return (T) this;\n    }\n\n    public T dataset(DataSet dataSet) {\n        displayerSettings.setDataSet(dataSet);\n        return (T) this;\n    }\n\n    public T title(String title) {\n        displayerSettings.setTitle(title);\n        return (T) this;\n    }\n\n    public T titleVisible(boolean visible) {\n        displayerSettings.setTitleVisible(visible);\n        return (T) this;\n    }\n\n    public T allowCsvExport(boolean allowCsvExport) {\n        displayerSettings.setCSVExportAllowed(allowCsvExport);\n        return (T) this;\n    }\n\n    public T allowExcelExport(boolean allowExcelExport) {\n        displayerSettings.setExcelExportAllowed(allowExcelExport);\n        return (T) this;\n    }\n\n    public T backgroundColor(String backgroundColor) {\n        displayerSettings.setChartBackgroundColor(backgroundColor);\n        return (T) this;\n    }\n\n    public T xAxisTitle(String title) {\n        displayerSettings.setXAxisShowLabels(true);\n        displayerSettings.setXAxisTitle(title);\n        return (T) this;\n    }\n\n    public T xAxisAngle(int angle) {\n        displayerSettings.setXAxisLabelsAngle(angle);\n        return (T) this;\n    }\n\n    public T yAxisTitle(String title) {\n        displayerSettings.setYAxisShowLabels(true);\n        displayerSettings.setYAxisTitle(title);\n        return (T) this;\n    }\n\n    public T yAxisShowLabels(boolean show) {\n        displayerSettings.setYAxisShowLabels(show);\n        return (T) this;\n    }\n\n    public T xAxisShowLabels(boolean show) {\n        displayerSettings.setXAxisShowLabels(show);\n        return (T) this;\n    }\n\n    public T renderer(String renderer) {\n        displayerSettings.setRenderer(renderer);\n        return (T) this;\n    }\n\n    @Override\n    public T subtype(DisplayerSubType displayerSubType) {\n        displayerSettings.setSubtype(displayerSubType);\n        return (T) this;\n    }\n\n    public T filterOn(boolean applySelf, boolean notifyOthers, boolean receiveFromOthers) {\n        displayerSettings.setFilterEnabled(true);\n        displayerSettings.setFilterSelfApplyEnabled(applySelf);\n        displayerSettings.setFilterNotificationEnabled(notifyOthers);\n        displayerSettings.setFilterListeningEnabled(receiveFromOthers);\n        return (T) this;\n    }\n\n    public T filterOff(boolean receiveFromOthers) {\n        displayerSettings.setFilterEnabled(false);\n        displayerSettings.setFilterListeningEnabled(receiveFromOthers);\n        return (T) this;\n    }\n\n    public T refreshOn() {\n        displayerSettings.setRefreshInterval(-1);\n        displayerSettings.setRefreshStaleData(true);\n        return (T) this;\n    }\n\n    public T refreshOn(int seconds, boolean staleData) {\n        displayerSettings.setRefreshInterval(seconds);\n        displayerSettings.setRefreshStaleData(staleData);\n        return (T) this;\n    }\n\n    public T refreshOff() {\n        displayerSettings.setRefreshInterval(-1);\n        return (T) this;\n    }\n\n    public T format(String name) {\n        return format(name, null);\n    }\n\n    public T format(String name, String pattern) {\n        DataSetOp op = getCurrentOp();\n        if (op == null || !(op instanceof DataSetGroup)) {\n            throw new RuntimeException(\"column(...) must be called first.\");\n        }\n        DataSetGroup gOp = (DataSetGroup) getCurrentOp();\n        List<GroupFunction> columns = gOp.getGroupFunctions();\n        if (columns.isEmpty()) {\n            throw new RuntimeException(\"column(...) must be called first.\");\n        }\n        GroupFunction lastColumn = columns.get(columns.size() - 1);\n        return format(lastColumn.getColumnId(), name, pattern);\n    }\n\n    public T format(String columnId, String name, String pattern) {\n        displayerSettings.setColumnName(columnId, name);\n        displayerSettings.setColumnValuePattern(columnId, pattern);\n        return (T) this;\n    }\n\n    public T expression(String expression) {\n        DataSetOp op = getCurrentOp();\n        if (op == null || !(op instanceof DataSetGroup)) {\n            throw new RuntimeException(\"column(...) must be called first.\");\n        }\n        DataSetGroup gOp = (DataSetGroup) getCurrentOp();\n        List<GroupFunction> columns = gOp.getGroupFunctions();\n        if (columns.isEmpty()) {\n            throw new RuntimeException(\"column(...) must be called first.\");\n        }\n        GroupFunction lastColumn = columns.get(columns.size() - 1);\n        return expression(lastColumn.getColumnId(), expression);\n    }\n\n    public T expression(String columnId, String expression) {\n        displayerSettings.setColumnValueExpression(columnId, expression);\n        return (T) this;\n    }\n\n    public T htmlTemplate(String html) {\n        displayerSettings.setHtmlTemplate(html);\n        return (T) this;\n    }\n\n    public T jsTemplate(String onDrawJs) {\n        displayerSettings.setJsTemplate(onDrawJs);\n        return (T) this;\n    }\n\n    public DisplayerSettings buildSettings() {\n        displayerSettings.setDataSetLookup(super.buildLookup());\n        return displayerSettings;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/AbstractSelectorSettingsBuilder.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.SelectorDisplayerSettingsBuilder;\n\npublic abstract class AbstractSelectorSettingsBuilder<T extends SelectorDisplayerSettingsBuilder> extends AbstractDisplayerSettingsBuilder<T> implements SelectorDisplayerSettingsBuilder<T> {\n\n    @Override\n    public T width(int width) {\n        displayerSettings.setSelectorWidth(width);\n        return (T) this;\n    }\n\n    @Override\n    public T margins(int top, int bottom, int left, int right) {\n        displayerSettings.setChartMarginTop(top);\n        displayerSettings.setChartMarginBottom(bottom);\n        displayerSettings.setChartMarginLeft(left);\n        displayerSettings.setChartMarginRight(right);\n        return (T) this;\n    }\n\n    @Override\n    public T multiple(boolean multiple) {\n        displayerSettings.setSelectorMultiple(multiple);\n        return (T) this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/AbstractXAxisChartSettingsBuilder.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.XAxisChartSettingsBuilder;\n\npublic abstract class AbstractXAxisChartSettingsBuilder<T extends XAxisChartSettingsBuilder> extends AbstractChartSettingsBuilder<T> {\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/AreaChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.AreaChartSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\n\npublic class AreaChartSettingsBuilderImpl extends AbstractXAxisChartSettingsBuilder<AreaChartSettingsBuilderImpl> implements AreaChartSettingsBuilder<AreaChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.AREACHART, DisplayerSubType.AREA);\n    }\n\n    @Override\n    public AreaChartSettingsBuilderImpl subType_Area() {\n        displayerSettings.setSubtype(DisplayerSubType.AREA);\n        return this;\n    }\n\n    @Override\n    public AreaChartSettingsBuilderImpl subType_StackedArea() {\n        displayerSettings.setSubtype(DisplayerSubType.AREA_STACKED);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/BarChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.BarChartSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\n\npublic class BarChartSettingsBuilderImpl extends AbstractXAxisChartSettingsBuilder<BarChartSettingsBuilderImpl> implements BarChartSettingsBuilder<BarChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.BARCHART, DisplayerSubType.BAR);\n    }\n\n    public BarChartSettingsBuilderImpl set3d(boolean b) {\n        displayerSettings.setChart3D(b);\n        return this;\n    }\n\n    @Override\n    public BarChartSettingsBuilderImpl subType_Bar() {\n        displayerSettings.setSubtype(DisplayerSubType.BAR);\n        return this;\n    }\n\n    @Override\n    public BarChartSettingsBuilderImpl subType_StackedBar() {\n        displayerSettings.setSubtype(DisplayerSubType.BAR_STACKED);\n        return this;\n    }\n\n    @Override\n    public BarChartSettingsBuilderImpl subType_Column() {\n        displayerSettings.setSubtype(DisplayerSubType.COLUMN);\n        return this;\n    }\n\n    @Override\n    public BarChartSettingsBuilderImpl subType_StackedColumn() {\n        displayerSettings.setSubtype(DisplayerSubType.COLUMN_STACKED);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/BubbleChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.BubbleChartSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\n\npublic class BubbleChartSettingsBuilderImpl extends AbstractChartSettingsBuilder<BubbleChartSettingsBuilderImpl> implements BubbleChartSettingsBuilder<BubbleChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings( DisplayerType.BUBBLECHART );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/ExternalDisplayerSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.ExternalDisplayerSettingsBuilder;\n\npublic class ExternalDisplayerSettingsBuilderImpl extends AbstractChartSettingsBuilder<ExternalDisplayerSettingsBuilderImpl> implements ExternalDisplayerSettingsBuilder<ExternalDisplayerSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.EXTERNAL_COMPONENT);\n    }\n\n    @Override\n    public ExternalDisplayerSettingsBuilderImpl componentId(String id) {\n        this.displayerSettings.setComponentId(id);\n        return this;\n    }\n\n    @Override\n    public ExternalDisplayerSettingsBuilderImpl componentProperty(String key, String value) {\n        this.displayerSettings.setComponentProperty(key, value);\n        return this;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/LineChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.LineChartSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class LineChartSettingsBuilderImpl extends AbstractXAxisChartSettingsBuilder<LineChartSettingsBuilderImpl> implements LineChartSettingsBuilder<LineChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.LINECHART, DisplayerSubType.LINE);\n    }\n\n    @Override\n    public LineChartSettingsBuilderImpl subType_Line() {\n        displayerSettings.setSubtype(DisplayerSubType.LINE);\n        return this;\n    }\n\n    @Override\n    public LineChartSettingsBuilderImpl subType_SmoothLine() {\n        displayerSettings.setSubtype(DisplayerSubType.SMOOTH);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/MapChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.MapChartSettingsBuilder;\nimport org.dashbuilder.displayer.MapColorScheme;\n\npublic class MapChartSettingsBuilderImpl extends AbstractXAxisChartSettingsBuilder<MapChartSettingsBuilderImpl> implements MapChartSettingsBuilder<MapChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.MAP, DisplayerSubType.MAP_REGIONS);\n    }\n\n    @Override\n    public MapChartSettingsBuilderImpl subType_Region_Map() {\n        displayerSettings.setSubtype(DisplayerSubType.MAP_REGIONS);\n        return this;\n    }\n\n    @Override\n    public MapChartSettingsBuilderImpl subType_Marker_Map() {\n        displayerSettings.setSubtype(DisplayerSubType.MAP_MARKERS);\n        return this;\n    }\n\n    @Override\n    public MapChartSettingsBuilderImpl colorScheme(MapColorScheme colorScheme) {\n        displayerSettings.setMapColorScheme(colorScheme);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/MeterChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.MeterChartSettingsBuilder;\n\npublic class MeterChartSettingsBuilderImpl extends AbstractChartSettingsBuilder<MeterChartSettingsBuilderImpl> implements MeterChartSettingsBuilder<MeterChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings( DisplayerType.METERCHART );\n    }\n\n    public MeterChartSettingsBuilderImpl meter(long start, long warning, long critical, long end) {\n        displayerSettings.setMeterStart(start);\n        displayerSettings.setMeterWarning(warning);\n        displayerSettings.setMeterCritical(critical);\n        displayerSettings.setMeterEnd(end);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/MetricSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.MetricSettingsBuilder;\n\npublic class MetricSettingsBuilderImpl extends AbstractChartSettingsBuilder<MetricSettingsBuilderImpl> implements MetricSettingsBuilder<MetricSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings( DisplayerType.METRIC );\n    }\n\n    public MetricSettingsBuilderImpl metric(long start, long warning, long critical, long end) {\n        displayerSettings.setMeterStart(start);\n        displayerSettings.setMeterWarning(warning);\n        displayerSettings.setMeterCritical(critical);\n        displayerSettings.setMeterEnd(end);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/PieChartSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.PieChartSettingsBuilder;\n\npublic class PieChartSettingsBuilderImpl extends AbstractXAxisChartSettingsBuilder<PieChartSettingsBuilderImpl> implements PieChartSettingsBuilder<PieChartSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.PIECHART, DisplayerSubType.PIE);\n    }\n\n    public PieChartSettingsBuilderImpl set3d(boolean b) {\n        displayerSettings.setChart3D(b);\n        return this;\n    }\n\n    @Override\n    public PieChartSettingsBuilderImpl subType_Pie() {\n        displayerSettings.setSubtype(DisplayerSubType.PIE);\n        return this;\n    }\n\n    @Override\n    public PieChartSettingsBuilderImpl subType_Pie_3d() {\n        displayerSettings.setSubtype(DisplayerSubType.PIE_3D);\n        return this;\n    }\n\n    @Override\n    public PieChartSettingsBuilderImpl subType_Donut() {\n        displayerSettings.setSubtype(DisplayerSubType.DONUT);\n        return this;\n    }\n\n    @Override\n    public PieChartSettingsBuilderImpl subType_Donut(String holeLabel) {\n        displayerSettings.setSubtype(DisplayerSubType.DONUT);\n        displayerSettings.setDonutHoleTitle(holeLabel);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/SelectorDisplayerSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.SelectorDisplayerSettingsBuilder;\n\npublic class SelectorDisplayerSettingsBuilderImpl extends AbstractSelectorSettingsBuilder<SelectorDisplayerSettingsBuilderImpl> implements SelectorDisplayerSettingsBuilder<SelectorDisplayerSettingsBuilderImpl> {\n\n    protected DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.SELECTOR, DisplayerSubType.SELECTOR_DROPDOWN);\n    }\n\n    @Override\n    public SelectorDisplayerSettingsBuilderImpl subType_Dropdown() {\n        displayerSettings.setSubtype(DisplayerSubType.SELECTOR_DROPDOWN);\n        return this;\n    }\n\n    @Override\n    public SelectorDisplayerSettingsBuilderImpl subType_Slider() {\n        displayerSettings.setSubtype(DisplayerSubType.SELECTOR_SLIDER);\n        return this;\n    }\n\n    @Override\n    public SelectorDisplayerSettingsBuilderImpl subType_Labels() {\n        displayerSettings.setSubtype(DisplayerSubType.SELECTOR_LABELS);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/impl/TableDisplayerSettingsBuilderImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.impl;\n\nimport org.dashbuilder.dataset.sort.SortOrder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.TableDisplayerSettingsBuilder;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class TableDisplayerSettingsBuilderImpl extends AbstractDisplayerSettingsBuilder<TableDisplayerSettingsBuilderImpl> implements TableDisplayerSettingsBuilder<TableDisplayerSettingsBuilderImpl> {\n\n    public DisplayerSettings createDisplayerSettings() {\n        return new DisplayerSettings(DisplayerType.TABLE);\n    }\n\n    public TableDisplayerSettingsBuilderImpl tablePageSize(int pageSize) {\n        displayerSettings.setTablePageSize(pageSize);\n        return this;\n    }\n\n    public TableDisplayerSettingsBuilderImpl tableOrderEnabled(boolean enabled) {\n        displayerSettings.setTableSortEnabled(enabled);\n        return this;\n    }\n\n    public TableDisplayerSettingsBuilderImpl tableOrderDefault(String columnId, SortOrder order) {\n        displayerSettings.setTableDefaultSortColumnId(columnId);\n        displayerSettings.setTableDefaultSortOrder(order);\n        return this;\n    }\n\n    public TableDisplayerSettingsBuilderImpl tableOrderDefault(String columnId, String order) {\n        return tableOrderDefault(columnId, SortOrder.getByName(order));\n    }\n\n    public TableDisplayerSettingsBuilderImpl tableWidth(int tableWidth) {\n        displayerSettings.setTableWidth(tableWidth);\n        return this;\n    }\n\n    public TableDisplayerSettingsBuilderImpl tableColumnPickerEnabled(boolean enabled) {\n        displayerSettings.setTableColumnPickerEnabled(enabled);\n        return this;\n    }\n\n    @Override\n    public TableDisplayerSettingsBuilderImpl resizable(boolean resizable) {\n        displayerSettings.setResizable(resizable);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/displayer/json/DisplayerSettingsJSONMarshaller.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.json;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.json.DataSetJSONMarshaller;\nimport org.dashbuilder.dataset.json.DataSetLookupJSONMarshaller;\nimport org.dashbuilder.displayer.ColumnSettings;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.json.Json;\nimport org.dashbuilder.json.JsonArray;\nimport org.dashbuilder.json.JsonObject;\nimport org.dashbuilder.json.JsonString;\nimport org.dashbuilder.json.JsonValue;\n\npublic class DisplayerSettingsJSONMarshaller {\n\n    private static final String DATASET_PREFIX = \"dataSet\";\n    private static final String DATASET_LOOKUP_PREFIX = \"dataSetLookup\";\n    private static final String COLUMNS_PREFIX = \"columns\";\n    private static final String COLUMN_ID = \"id\";\n    private static final String COLUMN_NAME = \"name\";\n    private static final String COLUMN_EXPRESSION = \"expression\";\n    private static final String COLUMN_PATTERN = \"pattern\";\n    private static final String COLUMN_EMPTY = \"empty\";\n    private static final String SETTINGS_UUID = \"uuid\";\n\n    private static DisplayerSettingsJSONMarshaller SINGLETON = new DisplayerSettingsJSONMarshaller();\n\n    public static DisplayerSettingsJSONMarshaller get() {\n        return SINGLETON;\n    }\n\n    private DataSetJSONMarshaller dataSetJsonMarshaller;\n    private DataSetLookupJSONMarshaller dataSetLookupJsonMarshaller;\n\n    public DisplayerSettingsJSONMarshaller() {\n        this(DataSetJSONMarshaller.get(), DataSetLookupJSONMarshaller.get());\n    }\n\n    public DisplayerSettingsJSONMarshaller(DataSetJSONMarshaller dataSetJsonMarshaller, DataSetLookupJSONMarshaller dataSetLookupJsonMarshaller) {\n        this.dataSetJsonMarshaller = dataSetJsonMarshaller;\n        this.dataSetLookupJsonMarshaller = dataSetLookupJsonMarshaller;\n    }\n\n    public DisplayerSettings fromJsonString( String jsonString ) {\n        DisplayerSettings ds = new DisplayerSettings();\n\n        if (!isBlank(jsonString)) {\n\n            JsonObject parseResult = Json.parse(jsonString);\n\n            if ( parseResult != null ) {\n\n                // UUID\n                ds.setUUID(parseResult.getString(SETTINGS_UUID));\n                parseResult.put(SETTINGS_UUID, (String) null);\n\n                // First look if a dataset 'on-the-fly' has been specified\n                JsonObject data = parseResult.getObject(DATASET_PREFIX);\n                if (data != null) {\n                    DataSet dataSet = dataSetJsonMarshaller.fromJson(data);\n                    ds.setDataSet(dataSet);\n\n                    // Remove from the json input so that it doesn't end up in the settings map.\n                    parseResult.put(DATASET_PREFIX, (JsonValue) null);\n\n                // If none was found, look for a dataset lookup definition\n                } else if ((data = parseResult.getObject(DATASET_LOOKUP_PREFIX)) != null) {\n                    DataSetLookup dataSetLookup = dataSetLookupJsonMarshaller.fromJson(data);\n                    ds.setDataSetLookup(dataSetLookup);\n\n                    // Remove from the json input so that it doesn't end up in the settings map.\n                    parseResult.put(DATASET_LOOKUP_PREFIX, (JsonValue) null);\n                }\n                else {\n                    throw new RuntimeException(\"Displayer settings dataset lookup not specified\");\n                }\n\n                // Parse the columns settings\n                JsonArray columns = parseResult.getArray(COLUMNS_PREFIX);\n                if (columns != null) {\n                    List<ColumnSettings> columnSettingsList = parseColumnsFromJson(columns);\n                    ds.setColumnSettingsList(columnSettingsList);\n\n                    // Remove from the json input so that it doesn't end up in the settings map.\n                    parseResult.put(COLUMNS_PREFIX, (JsonValue) null);\n                }\n\n                // Now parse all other settings\n                ds.setSettingsFlatMap( parseSettingsFromJson(parseResult));\n            }\n        }\n        return ds;\n    }\n\n    public String toJsonString(DisplayerSettings displayerSettings) {\n        return toJsonObject(displayerSettings).toString();\n    }\n\n    public JsonObject toJsonObject( DisplayerSettings displayerSettings ) {\n        JsonObject json = Json.createObject();\n\n        // UUID\n        json.put(SETTINGS_UUID, displayerSettings.getUUID());\n\n        for (Map.Entry<String, String> entry : displayerSettings.getSettingsFlatMap().entrySet()) {\n            setNodeValue(json, entry.getKey(), entry.getValue());\n        }\n\n        // Data set\n        DataSetLookup dataSetLookup = displayerSettings.getDataSetLookup();\n        DataSet dataSet = displayerSettings.getDataSet();\n        if (dataSet != null) {\n            json.put(DATASET_PREFIX, dataSetJsonMarshaller.toJson(dataSet));\n        }\n        else if (dataSetLookup != null) {\n            json.put(DATASET_LOOKUP_PREFIX, dataSetLookupJsonMarshaller.toJson(dataSetLookup));\n        }\n        else {\n            throw new RuntimeException(\"Displayer settings data set lookup not specified or data set is empty.\");\n        }\n\n        // Column settings\n        List<ColumnSettings> columnSettingsList = displayerSettings.getColumnSettingsList();\n        if (!columnSettingsList.isEmpty()) {\n            json.put(COLUMNS_PREFIX, formatColumnSettings(columnSettingsList));\n        }\n\n        return json;\n    }\n\n    private void setNodeValue(JsonObject node, String path, String value) {\n        if (node == null || isBlank(path) || value == null) {\n            return;\n        }\n\n        int separatorIndex = path.lastIndexOf('.');\n        String nodesPath = separatorIndex > 0 ? path.substring(0, separatorIndex) : \"\";\n        String leaf = separatorIndex > 0 ? path.substring(separatorIndex + 1) : path;\n\n        JsonObject _node = findNode(node, nodesPath, true);\n        _node.put(leaf, value);\n    }\n\n    private JsonObject findNode(JsonObject parent, String path, boolean createPath) {\n        if (parent == null) {\n            return null;\n        }\n        if (isBlank(path)) {\n            return parent;\n        }\n\n        int separatorIndex = path.indexOf('.');\n        String strChildNode = separatorIndex > 0 ? path.substring(0, separatorIndex) : path;\n        String remainingNodes = separatorIndex > 0 ? path.substring(separatorIndex + 1) : \"\";\n\n        JsonObject childNode = parent.getObject(strChildNode);\n        if (childNode == null && createPath) {\n            childNode = Json.createObject();\n            parent.put(strChildNode, childNode);\n        }\n        return findNode(childNode, remainingNodes, createPath);\n    }\n\n    private JsonArray formatColumnSettings(List<ColumnSettings> columnSettingsList) {\n        JsonArray jsonArray = Json.createArray();\n        for (int i=0; i<columnSettingsList.size(); i++) {\n            ColumnSettings columnSettings = columnSettingsList.get(i);\n            String id = columnSettings.getColumnId();\n            String name = columnSettings.getColumnName();\n            String expression = columnSettings.getValueExpression();\n            String pattern = columnSettings.getValuePattern();\n            String empty = columnSettings.getEmptyTemplate();\n\n            JsonObject columnJson = Json.createObject();\n            if (!isBlank(id)) {\n                columnJson.put(COLUMN_ID, id);\n                if (!isBlank(name)) columnJson.put(COLUMN_NAME, name);\n                if (!isBlank(expression)) columnJson.put(COLUMN_EXPRESSION, expression);\n                if (!isBlank(pattern)) columnJson.put(COLUMN_PATTERN, pattern);\n                if (!isBlank(empty)) columnJson.put(COLUMN_EMPTY, empty);\n                jsonArray.set(i, columnJson);\n            }\n        }\n        return jsonArray;\n    }\n\n    private List<ColumnSettings> parseColumnsFromJson(JsonArray columnsJsonArray) {\n        List<ColumnSettings> columnSettingsList = new ArrayList<ColumnSettings>();\n        if (columnsJsonArray == null) {\n            return columnSettingsList;\n        }\n\n        for (int i = 0; i < columnsJsonArray.length(); i++) {\n            JsonObject columnJson = columnsJsonArray.getObject(i);\n            ColumnSettings columnSettings = new ColumnSettings();\n            columnSettingsList.add(columnSettings);\n\n            String columndId = columnJson.getString(COLUMN_ID);\n            if (columndId == null) {\n                throw new RuntimeException(\"Column settings null column id\");\n            }\n            columnSettings.setColumnId(columndId);\n            columnSettings.setColumnName(columnJson.getString(COLUMN_NAME));\n            columnSettings.setValueExpression(columnJson.getString(COLUMN_EXPRESSION));\n            columnSettings.setValuePattern(columnJson.getString(COLUMN_PATTERN));\n            columnSettings.setEmptyTemplate(columnJson.getString(COLUMN_EMPTY));\n        }\n        return columnSettingsList;\n    }\n\n    private Map<String, String> parseSettingsFromJson(JsonObject settingsJson) {\n        Map<String, String> flatSettingsMap = new HashMap<String, String>(30);\n\n        if (settingsJson != null && settingsJson.size() > 0) {\n            fillRecursive(\"\", settingsJson, flatSettingsMap);\n        }\n        return flatSettingsMap;\n    }\n\n    private void fillRecursive(String parentPath, JsonObject json, Map<String, String> settings) {\n        String sb = isBlank(parentPath) ? \"\" : parentPath + \".\";\n        for (String key : json.keys()) {\n            String path = sb + key;\n            JsonValue value = json.get( key );\n            if (value instanceof JsonObject) {\n                fillRecursive(path, (JsonObject) value, settings);\n            }\n            else if (value instanceof JsonString) {\n                settings.put(path, ((JsonString) value).getString());\n            }\n        }\n    }\n\n    private boolean isBlank(String str) {\n        return str == null || str.trim().isEmpty();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/java/org/dashbuilder/renderer/RendererSettings.java",
    "content": "package org.dashbuilder.renderer;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Hold Renderer Settings.\n * \n */\n@Portable\npublic class RendererSettings {\n\n    private final String defaultRenderer;\n    private final boolean offline;\n\n    public RendererSettings() {\n        this.defaultRenderer = \"\";\n        this.offline = false;\n    }\n\n\n    public RendererSettings(String defaultRenderer, boolean offline) {\n        this.defaultRenderer = defaultRenderer;\n        this.offline = offline;\n    }\n    \n\n    /**\n     * The UUID of the renderer that should be used by default. <br>\n     * It can be set using <i>org.dashbuilder.renderer.default</i>.\n     * \n     * @return The selected default renderer UUID\n     */\n    public String getDefaultRenderer() {\n        return defaultRenderer;\n    }\n\n    /**\n     * When true renderers that can't work offline are discarded. <br>\n     * It can be set <i>org.dashbuilder.renderer.offline</i>. \n     * \n     * @return The offline flag value\n     */\n    public boolean isOffline() {\n        return offline;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/main/resources/org/dashbuilder/DisplayerAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.dashbuilder.JSON\"/>\n\n  <source path='displayer'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/test/java/org/dashbuilder/displayer/external/ExternalComponentMessageHelperTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.displayer.external;\n\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport elemental2.core.JsMap;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.dashbuilder.displayer.external.ExternalComponentMessageHelper.COMPONENT_RUNTIME_ID_PROP;\nimport static org.dashbuilder.displayer.external.ExternalComponentMessageHelper.FILTER_PROP;\nimport static org.dashbuilder.displayer.external.ExternalComponentMessageType.DATASET;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ExternalComponentMessageHelperTest {\n\n    @Mock\n    JsMap<String, Object> properties;\n\n    @InjectMocks\n    ExternalComponentMessage message;\n\n    static private ExternalComponentMessageHelper helper;\n\n    @BeforeClass\n    public static void setup() {\n        helper = new ExternalComponentMessageHelper();\n    }\n\n    @Test\n    public void testWithId() {\n        String id = \"abc\";\n        helper.withId(message, id);\n        verify(properties).set(eq(COMPONENT_RUNTIME_ID_PROP), eq(id));\n    }\n\n    @Test\n    public void testFilterRequest() {\n        Optional<ExternalFilterRequest> filterRequestOp = helper.filterRequest(message);\n        assertFalse(filterRequestOp.isPresent());\n\n        ExternalFilterRequest request = mock(ExternalFilterRequest.class);\n        when(properties.get(eq(FILTER_PROP))).thenReturn(request);\n        \n        filterRequestOp = helper.filterRequest(message);\n        \n        assertEquals(request, filterRequestOp.get());\n    }\n    \n    @Test\n    public void testFunctionCallRequest() {\n        Optional<FunctionCallRequest> functionCallRequestOp = helper.functionCallRequest(message);\n        assertFalse(functionCallRequestOp.isPresent());\n        \n        FunctionCallRequest request = mock(FunctionCallRequest.class);\n        when(properties.get(eq(ExternalComponentMessageHelper.FUNCTION_CALL_PROP))).thenReturn(request);\n        \n        functionCallRequestOp = helper.functionCallRequest(message);\n        \n        assertEquals(request, functionCallRequestOp.get());\n    }\n    \n    @Test\n    public void testDataSetMessage() {\n        ExternalDataSet ds = mock(ExternalDataSet.class);\n        ExternalComponentMessage newDataSetMessage = helper.newDataSetMessage(ds, Collections.emptyMap());\n        assertEquals(DATASET.name(), newDataSetMessage.type);\n    }\n    \n    @Test\n    public void testNewInitMessage() {\n        ExternalComponentMessage initMessage = helper.newInitMessage(Collections.emptyMap());\n        assertEquals(ExternalComponentMessageType.INIT.name(), initMessage.type);\n    }\n    \n    @Test(expected = IllegalArgumentException.class)\n    public void testNullMessageType() {\n        ExternalComponentMessage message = mock(ExternalComponentMessage.class);\n        when(message.getType()).thenReturn(null);\n        helper.messageType(message);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-displayer-api/src/test/java/org/dashbuilder/displayer/json/DisplayerSettingsJsonTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.dashbuilder.displayer.json;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.json.JsonObject;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.junit.Assert.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.DESCENDING;\n\n@RunWith(Parameterized.class)\npublic class DisplayerSettingsJsonTest {\n\n    public static final DisplayerSettings OPPS_BY_PIPELINE = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-pipeline\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"PIPELINE\")\n            .column(\"PIPELINE\", \"Pipeline\")\n            .column(COUNT, \"Number of opps\")\n            .title(\"salesopps_displayers_by_pipeline_title\")\n            .titleVisible(false)\n            .width(500).height(300)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_STATUS = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-status\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"STATUS\")\n            .column(\"STATUS\", \"Status\")\n            .column(\"AMOUNT\", SUM, \"Total amount\")\n            .title(\"salesopps_displayers_by_status_title\")\n            .titleVisible(false)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_SALESMAN = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-salesman\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"SALES_PERSON\")\n            .column(\"SALES_PERSON\", \"Sales person\")\n            .column(\"AMOUNT\", SUM, \"Total amount\")\n            .title(\"salesopps_displayers_by_salesman_title\")\n            .titleVisible(false)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_EXPECTED_PIPELINE = DisplayerSettingsFactory.newAreaChartSettings()\n            .uuid(\"opps-expected-pipeline\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"CLOSING_DATE\").dynamic(24, DateIntervalType.MONTH, true)\n            .column(\"CLOSING_DATE\", \"Closing date\")\n            .column(\"EXPECTED_AMOUNT\", SUM, \"salesopps_displayers_by_exp_pipeline_column1\")\n            .title(\"salesopps_displayers_by_exp_pipeline_title\")\n            .titleVisible(false)\n            .width(500).height(300)\n            .margins(20, 50, 100, 100)\n            .filterOn(true, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_PRODUCT = DisplayerSettingsFactory.newBarChartSettings()\n            .subType_Bar()\n            .uuid(\"opps-by-product\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"PRODUCT\")\n            .column(\"PRODUCT\", \"Product\")\n            .column(\"AMOUNT\", SUM, \"salesopps_displayers_by_product_column1\")\n            .title(\"salesopps_displayers_by_product_title\")\n            .titleVisible(false)\n            .margins(10, 50, 100, 100)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_COUNTRY = DisplayerSettingsFactory.newBarChartSettings()\n            .subType_Bar()\n            .uuid(\"opps-by-country\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"COUNTRY\")\n            .column(\"COUNTRY\", \"Country\")\n            .column(\"AMOUNT\", SUM, \"alesopps_displayers_by_country_column1\")\n            .title(\"salesopps_displayers_by_country_title\")\n            .titleVisible(false)\n            .margins(10, 80, 100, 100)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_COUNTRY_SUMMARY = DisplayerSettingsFactory.newTableSettings()\n            .uuid(\"opps-country-summary\")\n            .dataset(\"SALES_OPPS\")\n            .group(\"COUNTRY\")\n            .column(\"COUNTRY\", \"salesopps_displayers_country_summary_column1\")\n            .column(\"AMOUNT\", SUM, \"salesopps_displayers_country_summary_column2\")\n            .column(COUNT, \"salesopps_displayers_country_summary_column3\")\n            .column(\"AMOUNT\", AVERAGE, \"salesopps_displayers_country_summary_column4\")\n            .column(\"AMOUNT\", MIN, \"salesopps_displayers_country_summary_column5\")\n            .column(\"AMOUNT\", MAX, \"salesopps_displayers_country_summary_column6\")\n            .title(\"salesopps_displayers_country_summary_title\")\n            .titleVisible(false)\n            .tablePageSize(20)\n            .filterOff(true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_ALLOPPS_LISTING = DisplayerSettingsFactory.newTableSettings()\n            .uuid(\"opps-allopps-listing\")\n            .dataset(\"SALES_OPPS\")\n            .title(\"salesopps_displayers_all_list_title\")\n            .titleVisible(false)\n            .tablePageSize(20)\n            .tableOrderEnabled(true)\n            .tableOrderDefault(\"AMOUNT\", DESCENDING)\n            .filterOn(true, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    @Parameterized.Parameters\n    public static Collection displayers() {\n        return Arrays.asList(new Object[][]{\n                {OPPS_ALLOPPS_LISTING},\n                {OPPS_BY_COUNTRY},\n                {OPPS_BY_PIPELINE},\n                {OPPS_BY_PRODUCT},\n                {OPPS_BY_SALESMAN},\n                {OPPS_BY_STATUS},\n                {OPPS_COUNTRY_SUMMARY},\n                {OPPS_EXPECTED_PIPELINE}\n        });\n    }\n\n    protected DisplayerSettings displayerSettings;\n\n    public DisplayerSettingsJsonTest(DisplayerSettings settings) {\n        this.displayerSettings = settings;\n    }\n\n    @Test\n    public void testSettingsMarshalling() {\n\n        DisplayerSettingsJSONMarshaller displayerJsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n        JsonObject _jsonObj = displayerJsonMarshaller.toJsonObject(displayerSettings);\n        assertNotNull(_jsonObj.toString());\n\n        DisplayerSettings unmarshalled = displayerJsonMarshaller.fromJsonString(_jsonObj.toString());\n        assertEquals(unmarshalled, displayerSettings);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- ~ Copyright 2021 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n  the Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n  except in compliance with the License. ~ You may obtain a copy of the License \n  at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n  applicable law or agreed to in writing, software ~ distributed under the \n  License is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n  OF ANY KIND, either express or implied. ~ See the License for the specific \n  language governing permissions and ~ limitations under the License. -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-shared</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-dsl</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder DSL</name>\n  <description>Dashbuilder Domain Script Language</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/AbstractComponentBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.dsl.model.Component;\nimport org.uberfire.ext.layout.editor.api.css.CssProperty;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\npublic abstract class AbstractComponentBuilder<T> {\n\n    private LayoutComponent layoutComponent;\n\n    AbstractComponentBuilder() {\n        String dragType = getDragType();\n        this.layoutComponent = new LayoutComponent(dragType);\n    }\n\n    public Component build() {\n        return Component.create(this.layoutComponent);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T property(String key, String value) {\n        this.layoutComponent.addProperty(key, value);\n        return (T) this;\n    }\n    \n    @SuppressWarnings(\"unchecked\")\n    public T cssProperty(CssProperty property, String value) {\n        this.property(property.getName(), value);\n        return (T) this;\n    }\n\n    abstract String getDragType();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/AllProcessesHeatmapBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class AllProcessesHeatmapBuilder extends ExternalDisplayerBuilder {\n\n    public static final String COMPONENT_ID = \"processes-heatmaps-provided\";\n    public static final String SERVER_TEMPLATE_PARAM = \"serverTemplate\";\n\n    public AllProcessesHeatmapBuilder(String serverTemplate, DisplayerSettings settings) {\n        super(COMPONENT_ID, settings);\n        this.componentProperty(SERVER_TEMPLATE_PARAM, serverTemplate);\n    }\n\n    public static AllProcessesHeatmapBuilder create(String serverTemplate,\n                                                    DisplayerSettings settings) {\n        return new AllProcessesHeatmapBuilder(serverTemplate, settings);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/ComponentFactory.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.dsl.model.Component;\n\npublic class ComponentFactory {\n\n    private ComponentFactory() {\n        // empty\n    }\n\n    public static Component html(String htmlCode) {\n        return HtmlComponentBuilder.create().html(htmlCode).build();\n    }\n\n    public static Component external(String componentId) {\n        return ExternalComponentBuilder.create(componentId).build();\n    }\n\n    public static Component external(String componentId, DisplayerSettings settings) {\n        return ExternalDisplayerBuilder.create(componentId, settings).build();\n    }\n\n    public static Component displayer(DisplayerSettings settings) {\n        return DisplayerBuilder.create(settings).build();\n    }\n\n    public static Component logo(String src) {\n        return LogoBuilder.create(src).build();\n    }\n\n    public static Component processHeatmap(String serverTemplate, String container, String process, DisplayerSettings settings) {\n        return ProcessHeatmapBuilder.create(serverTemplate, container, process, settings).build();\n    }\n\n    public static Component allProcessesHeatmap(String serverTemplate, DisplayerSettings settings) {\n        return AllProcessesHeatmapBuilder.create(serverTemplate, settings).build();\n    }\n\n    public static HtmlComponentBuilder newHtmlComponentBuilder() {\n        return HtmlComponentBuilder.create();\n    }\n\n    public static ExternalComponentBuilder externalBuilder(String componentId) {\n        return ExternalComponentBuilder.create(componentId);\n    }\n\n    public static LogoBuilder logoBuilder(String src) {\n        return LogoBuilder.create(src);\n    }\n\n    public static ProcessHeatmapBuilder processHeatmapBuilder(String serverTemplate, String container, String process, DisplayerSettings settings) {\n        return ProcessHeatmapBuilder.create(serverTemplate, container, process, settings);\n    }\n\n    public static AllProcessesHeatmapBuilder allProcessesHeatmapBuilder(String serverTemplate, DisplayerSettings settings) {\n        return AllProcessesHeatmapBuilder.create(serverTemplate, settings);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/DisplayerBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.dsl.model.Component;\n\npublic class DisplayerBuilder extends AbstractComponentBuilder<DisplayerBuilder> {\n\n    private static final String JSON_PROP = \"json\";\n    DisplayerSettings settings;\n\n    DisplayerBuilder(DisplayerSettings settings) {\n        this.settings = settings;\n    }\n\n    public static DisplayerBuilder create(DisplayerSettings settings) {\n\n        if (isInvalid(settings)) {\n            throw new IllegalArgumentException(\"You must provide a data set or an UUID to build a displayer component\");\n        }\n        return new DisplayerBuilder(settings);\n    }\n\n    @Override\n    public Component build() {\n        property(JSON_PROP, DisplayerSettingsJSONMarshaller.get().toJsonString(this.settings));\n        return super.build();\n    }\n\n    @Override\n    String getDragType() {\n        return \"org.dashbuilder.client.editor.DisplayerDragComponent\";\n    }\n\n    private static boolean isInvalid(DisplayerSettings settings) {\n        String dataSetUUID = settings.getDataSetLookup().getDataSetUUID();\n        return (dataSetUUID == null || dataSetUUID.trim().isEmpty()) && settings.getDataSet() == null;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/ExternalComponentBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.external.model.ExternalComponent;\n\npublic class ExternalComponentBuilder extends AbstractComponentBuilder<ExternalComponentBuilder> {\n\n    private String componentId;\n\n    ExternalComponentBuilder(String componentId) {\n        this.componentId = componentId;\n        property(ExternalComponent.COMPONENT_ID_KEY, this.componentId);\n    }\n\n    public static ExternalComponentBuilder create(String componentId) {\n        return new ExternalComponentBuilder(componentId);\n    }\n\n    public ExternalComponentBuilder componentProperty(String key, String value) {\n        property(this.componentId + \".\" + key, value);\n        return this;\n    }\n    \n    public ExternalComponentBuilder partition(String value) {\n        property(ExternalComponent.COMPONENT_PARTITION_KEY, value);\n        return this;\n    }\n\n    @Override\n    String getDragType() {\n        return \"org.dashbuilder.client.editor.external.ExternalDragComponent\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/ExternalDisplayerBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.external.model.ExternalComponent;\n\npublic class ExternalDisplayerBuilder extends DisplayerBuilder {\n\n    ExternalDisplayerBuilder(String componentId, DisplayerSettings settings) {\n        super(settings);\n        property(ExternalComponent.COMPONENT_ID_KEY, componentId);\n        settings.setComponentId(componentId);\n    }\n\n    public static ExternalDisplayerBuilder create(String id, DisplayerSettings settings) {\n        return new ExternalDisplayerBuilder(id, settings);\n    }\n\n    public ExternalDisplayerBuilder componentProperty(String key, String value) {\n        settings.setComponentProperty(key, value);\n        return this;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/HtmlComponentBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\npublic class HtmlComponentBuilder extends AbstractComponentBuilder<HtmlComponentBuilder> {\n\n    private static final String DRAG_TYPE = \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\";\n\n    public static final String HTML_CODE_PROP = \"HTML_CODE\";\n\n    public static HtmlComponentBuilder create() {\n        return new HtmlComponentBuilder();\n    }\n\n    public HtmlComponentBuilder html(String html) {\n        property(HTML_CODE_PROP, html);\n        return this;\n    }\n\n    @Override\n    String getDragType() {\n        return DRAG_TYPE;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/LogoBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\npublic class LogoBuilder extends ExternalComponentBuilder {\n\n    public static final String LOGO_ID = \"logo-provided\";\n\n    public static final String LOGO_URL_PROP = \"src\";\n    public static final String LOGO_WIDTH_PROP = \"width\";\n    public static final String LOGO_HEIGHT_PROP = \"height\";\n\n    LogoBuilder(String src) {\n        super(LOGO_ID);\n        src(src);\n    }\n\n    public static LogoBuilder create(String src) {\n        return new LogoBuilder(src);\n    }\n\n    public LogoBuilder src(String src) {\n        componentProperty(LOGO_URL_PROP, src);\n        return this;\n    }\n\n    public LogoBuilder width(String width) {\n        componentProperty(LOGO_WIDTH_PROP, width);\n        return this;\n    }\n\n    public LogoBuilder height(String height) {\n        componentProperty(LOGO_HEIGHT_PROP, height);\n        return this;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/component/ProcessHeatmapBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\n\npublic class ProcessHeatmapBuilder extends ExternalDisplayerBuilder {\n\n    public static final String COMPONENT_ID = \"process-heatmap-provided\";\n    public static final String SERVER_TEMPLATE_PARAM = \"serverTemplate\";\n    public static final String CONTAINER_ID_PARAM = \"containerId\";\n    public static final String PROCESS_ID_PARAM = \"processId\";\n\n    public ProcessHeatmapBuilder(String serverTemplate, String container, String processId, DisplayerSettings settings) {\n        super(COMPONENT_ID, settings);\n        this.componentProperty(SERVER_TEMPLATE_PARAM, serverTemplate);\n        this.componentProperty(CONTAINER_ID_PARAM, container);\n        this.componentProperty(PROCESS_ID_PARAM, processId);\n    }\n\n    public static ProcessHeatmapBuilder create(String serverTemplate,\n                                               String container,\n                                               String processId,\n                                               DisplayerSettings settings) {\n        return new ProcessHeatmapBuilder(serverTemplate, container, processId, settings);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/dashboard/DashboardBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.dashboard;\n\nimport java.nio.file.Path;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dsl.factory.navigation.NavigationFactory;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.Page;\n\npublic class DashboardBuilder {\n\n    private List<Page> pages = Collections.emptyList();\n    private List<DataSetDef> dataSets = Collections.emptyList();\n    private Navigation navigation = NavigationFactory.emptyNavigation();\n    private Path componentsPath;\n\n    DashboardBuilder(List<Page> pages) {\n        this.pages = pages;\n    }\n\n    public static DashboardBuilder newBuilder(List<Page> pages) {\n        return new DashboardBuilder(pages);\n    }\n\n    public DashboardBuilder pages(List<Page> pages) {\n        this.pages = pages;\n        return this;\n    }\n\n    public DashboardBuilder dataSets(List<DataSetDef> dataSets) {\n        this.dataSets = dataSets;\n        return this;\n    }\n\n    public DashboardBuilder navigation(Navigation navigation) {\n        this.navigation = navigation;\n        return this;\n    }\n\n    public DashboardBuilder componentsPath(Path componentsPath) {\n        this.componentsPath = componentsPath;\n        return this;\n    }\n\n    public Dashboard build() {\n        return Dashboard.of(pages, dataSets, navigation, componentsPath);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/dashboard/DashboardFactory.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.dashboard;\n\nimport java.nio.file.Path;\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.Page;\n\npublic class DashboardFactory {\n\n    private DashboardFactory() {\n        // empty\n    }\n\n    public static DashboardBuilder dashboardBuilder(List<Page> pages) {\n        return DashboardBuilder.newBuilder(pages);\n    }\n\n    public static Dashboard dashboard(List<Page> pages) {\n        return DashboardBuilder.newBuilder(pages).build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, Path componentsPath) {\n        return DashboardBuilder.newBuilder(pages).componentsPath(componentsPath).build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, Navigation navigation) {\n        return DashboardBuilder.newBuilder(pages).navigation(navigation).build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, List<DataSetDef> dataSets) {\n        return DashboardBuilder.newBuilder(pages)\n                               .dataSets(dataSets)\n                               .build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, List<DataSetDef> dataSets, Path componentsPath) {\n        return DashboardBuilder.newBuilder(pages)\n                               .dataSets(dataSets)\n                               .componentsPath(componentsPath)\n                               .build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, List<DataSetDef> dataSets, Navigation navigation) {\n        return DashboardBuilder.newBuilder(pages)\n                               .dataSets(dataSets)\n                               .navigation(navigation)\n                               .build();\n    }\n\n    public static Dashboard dashboard(List<Page> pages, List<DataSetDef> dataSets, Navigation navigation, Path componentsPath) {\n        return DashboardBuilder.newBuilder(pages)\n                               .dataSets(dataSets)\n                               .navigation(navigation)\n                               .componentsPath(componentsPath)\n                               .build();\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/navigation/NavigationBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.navigation;\n\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.NavigationGroup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeImpl;\n\npublic class NavigationBuilder {\n\n    private NavTree navTree;\n\n    private NavigationBuilder(NavTree navTree) {\n        this.navTree = navTree;\n    }\n\n    public static NavigationBuilder newBuilder(NavigationGroup... groups) {\n        NavTree tree = new NavTreeImpl(NavigationGroupBuilder.newBuilder(\"Top Group\", groups).build().getNavGroup());\n        return new NavigationBuilder(tree);\n    }\n\n    public Navigation build() {\n        return Navigation.of(this.navTree);\n    }\n\n    static NavigationBuilder newBuilder() {\n        NavTree tree = new NavTreeImpl();\n        return new NavigationBuilder(tree);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/navigation/NavigationFactory.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.navigation;\n\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.NavigationGroup;\nimport org.dashbuilder.dsl.model.NavigationItem;\nimport org.dashbuilder.dsl.model.Page;\n\npublic class NavigationFactory {\n\n    private static final Navigation EMPTY_NAVIGATION = NavigationBuilder.newBuilder().build();\n\n    private NavigationFactory() {\n        // empty\n    }\n\n    public static Navigation emptyNavigation() {\n        return EMPTY_NAVIGATION;\n    }\n\n    public static Navigation navigation(NavigationGroup... rootGroups) {\n        return NavigationBuilder.newBuilder(rootGroups).build();\n    }\n\n    public static NavigationGroup group(String name, NavigationItem... items) {\n        return NavigationGroupBuilder.newBuilder(name, items).build();\n    }\n\n    public static NavigationItem item(Page page) {\n        return NavigationItemBuilder.newBuilder(page).build();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/navigation/NavigationGroupBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.navigation;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.dashbuilder.dsl.model.NavigationGroup;\nimport org.dashbuilder.dsl.model.NavigationItem;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.impl.NavGroupImpl;\n\npublic class NavigationGroupBuilder {\n\n    private NavGroup navGroup;\n\n    private NavigationGroupBuilder(NavGroup navGroup) {\n        this.navGroup = navGroup;\n    }\n\n    public static NavigationGroupBuilder newBuilder(String name, NavigationItem... items) {\n        NavGroup group = new NavGroupImpl();\n        List<NavItem> navItems = Arrays.stream(items).map(NavigationItem::getNavItem).collect(Collectors.toList());\n        group.setName(name);\n        group.setDescription(\"Some Group\");\n        group.setId(System.currentTimeMillis() + \"\");\n        group.setChildren(navItems);\n        group.setModifiable(false);\n        return new NavigationGroupBuilder(group);\n    }\n\n    public NavigationGroupBuilder name(String name) {\n        this.navGroup.setName(name);\n        return this;\n    }\n\n    public NavigationGroupBuilder item(NavigationItem item) {\n        navGroup.getChildren().add(item.getNavItem());\n        return this;\n    }\n\n    public NavigationGroup build() {\n        return NavigationGroup.of(this.navGroup);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/navigation/NavigationItemBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.navigation;\n\nimport org.dashbuilder.dsl.model.NavigationItem;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.impl.NavItemImpl;\n\npublic class NavigationItemBuilder {\n\n    private NavItem navItem;\n\n    private NavigationItemBuilder(NavItem navItem) {\n        this.navItem = navItem;\n    }\n\n    public static NavigationItemBuilder newBuilder(Page page) {\n        NavItem item = new NavItemImpl();\n        String name = page.getLayoutTemplate().getName();\n        item.setId(System.currentTimeMillis() + \"\");\n        item.setName(name);\n        item.setModifiable(false);\n        item.setContext(\"resourceId=\" + name + \";resourceType=PERSPECTIVE;\");\n        return new NavigationItemBuilder(item);\n    }\n\n    public NavigationItemBuilder name(String name) {\n        this.navItem.setName(name);\n        return this;\n    }\n\n    public NavigationItem build() {\n        return NavigationItem.of(this.navItem);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/page/AbstractLayoutBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.uberfire.ext.layout.editor.api.css.CssProperty;\n\npublic abstract class AbstractLayoutBuilder<T> {\n\n    @SuppressWarnings(\"unchecked\")\n    public T property(String key, String value) {\n        this.addProperty(key, value);\n        return (T) this;\n    }\n    \n    @SuppressWarnings(\"unchecked\")\n    public T cssProperty(CssProperty property, String value) {\n        this.addProperty(property.getName(), value);\n        return (T) this;\n    }\n\n    protected abstract void addProperty(String key, String value);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/page/ColumnBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Component;\nimport org.dashbuilder.dsl.model.Row;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\n\npublic class ColumnBuilder extends AbstractLayoutBuilder<ColumnBuilder> {\n\n    private static final String DEFAULT_SPAN = \"0\";\n\n    LayoutColumn layoutColumn;\n\n    ColumnBuilder(String span) {\n        this.layoutColumn = new LayoutColumn(span);\n    }\n\n    public static ColumnBuilder newBuilder() {\n        return newBuilder(DEFAULT_SPAN);\n    }\n\n    public static ColumnBuilder newBuilder(String span) {\n        return new ColumnBuilder(span);\n    }\n\n    public ColumnBuilder row(Row row) {\n        this.layoutColumn.addRow(row.getLayoutRow());\n        return this;\n    }\n\n    public ColumnBuilder rows(Row... rows) {\n        for (Row row : rows) {\n            this.row(row);\n        }\n        return this;\n    }\n\n    public ColumnBuilder component(Component component) {\n        this.layoutColumn.add(component.getLayoutComponent());\n        return this;\n    }\n\n    public ColumnBuilder components(Component... components) {\n        for (Component component : components) {\n            component(component);\n        }\n        return this;\n    }\n\n    public Column build() {\n        return Column.create(this.layoutColumn);\n    }\n\n    @Override\n    protected void addProperty(String key, String value) {\n        this.layoutColumn.getProperties().put(key, value);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/page/PageBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.dsl.model.Row;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate.Style;\n\npublic class PageBuilder extends AbstractLayoutBuilder<PageBuilder> {\n\n    LayoutTemplate layoutTemplate;\n\n    private PageBuilder(String name) {\n        this.layoutTemplate = new LayoutTemplate(name);\n    }\n\n    public static PageBuilder newBuilder(String name) {\n        return new PageBuilder(name);\n    }\n\n    public PageBuilder name(String name) {\n        this.layoutTemplate.setName(name);\n        return this;\n    }\n\n    public PageBuilder style(Style style) {\n        this.layoutTemplate.setStyle(style);\n        return this;\n    }\n\n    public PageBuilder row(Row row) {\n        this.layoutTemplate.addRow(row.getLayoutRow());\n        return this;\n    }\n\n    public PageBuilder rows(Row... rows) {\n        for (Row row : rows) {\n            this.row(row);\n        }\n        return this;\n    }\n\n    public Page build() {\n        return Page.create(this.layoutTemplate);\n    }\n\n    @Override\n    protected void addProperty(String key, String value) {\n        this.layoutTemplate.addLayoutProperty(key, value);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/page/PageFactory.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Component;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.dsl.model.Row;\n\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.displayer;\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.html;\n\npublic class PageFactory {\n\n    private PageFactory() {\n        // empty\n    }\n\n    public static PageBuilder pageBuilder(String name) {\n        return PageBuilder.newBuilder(name);\n    }\n\n    public static RowBuilder rowBuilder(String height) {\n        return RowBuilder.newBuilder(height);\n    }\n\n    public static ColumnBuilder columnBuilder() {\n        return ColumnBuilder.newBuilder();\n    }\n\n    public static ColumnBuilder columnBuilder(String span) {\n        return ColumnBuilder.newBuilder(span);\n    }\n\n    public static ColumnBuilder columnBuilder(String span, Component... components) {\n        return ColumnBuilder.newBuilder(span).components(components);\n    }\n\n    public static Page page(String name, Row... rows) {\n        return PageBuilder.newBuilder(name).rows(rows).build();\n    }\n\n    public static Column column(String span, Component... components) {\n        return ColumnBuilder.newBuilder(span).components(components).build();\n    }\n\n    public static Column column(Component... components) {\n        return ColumnBuilder.newBuilder().components(components).build();\n    }\n\n    public static Column column(Component component) {\n        return ColumnBuilder.newBuilder().components(component).build();\n    }\n\n    public static Column column(DisplayerSettings settings) {\n        return ColumnBuilder.newBuilder().components(displayer(settings)).build();\n    }\n\n    public static Column column(Row row) {\n        return ColumnBuilder.newBuilder().row(row).build();\n    }\n\n    public static Column column(Row... rows) {\n        return ColumnBuilder.newBuilder().rows(rows).build();\n    }\n\n    public static Row row(Column... columns) {\n        return RowBuilder.newBuilder().columns(columns).build();\n    }\n\n    /**\n     * \n     * Creates a column with a single html component\n     * @param html\n     * @return\n     */\n    public static Column column(String html) {\n        return ColumnBuilder.newBuilder().component(html(html)).build();\n    }\n\n    /**\n     * \n     * Creates a row with a single column and a single html component\n     * @param html\n     * @return\n     */\n    public static Row row(String html) {\n        return row(html(html));\n    }\n\n    /**\n     * \n     * Creates a row with a single column with the provided component\n     * @param component\n     * @return\n     */\n    public static Row row(Component component) {\n        return row(column(component));\n    }\n\n    /**\n     * \n     * Creates a row with a single column with a displayer created with the provided settings\n     * @param settings\n     * @return\n     */\n    public static Row row(DisplayerSettings settings) {\n        return row(column(settings));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/factory/page/RowBuilder.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport java.util.HashMap;\n\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Row;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\n\npublic class RowBuilder extends AbstractLayoutBuilder<RowBuilder> {\n\n    private static final String DEFAULT_HEIGHT = \"12\";\n\n    LayoutRow layoutRow;\n\n    private RowBuilder(String height) {\n        this.layoutRow = new LayoutRow(height, new HashMap<>());\n    }\n\n    public static RowBuilder newBuilder() {\n        return newBuilder(DEFAULT_HEIGHT);\n    }\n\n    public static RowBuilder newBuilder(String height) {\n        return new RowBuilder(height);\n    }\n\n    @Override\n    public RowBuilder property(String key, String value) {\n        this.layoutRow.getProperties().put(key, value);\n        return this;\n    }\n\n    public RowBuilder columns(Column... columns) {\n        for (Column column : columns) {\n            this.column(column);\n        }\n        return this;\n    }\n\n    public RowBuilder column(Column column) {\n        this.layoutRow.add(column.getLayoutColumn());\n        return this;\n    }\n\n    public Row build() {\n        return Row.create(this.layoutRow);\n    }\n\n    @Override\n    protected void addProperty(String key, String value) {\n        this.layoutRow.getProperties().put(key, value);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/helper/ComponentsHelper.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.helper;\n\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.external.service.ComponentLoader;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\npublic class ComponentsHelper {\n\n    private static final Logger logger = LoggerFactory.getLogger(ComponentsHelper.class);\n\n    private static final Gson gson = new GsonBuilder().create();\n\n    private ComponentsHelper() {\n        // empty\n    }\n\n    public static List<String> listComponentsIds(Dashboard dashboard) {\n        Optional<Path> componentsPath = dashboard.getComponentsPath();\n        if (!componentsPath.isPresent()) {\n            return Collections.emptyList();\n        }\n        return ComponentsHelper.listComponents(componentsPath.get())\n                               .stream()\n                               .map(ExternalComponent::getId)\n                               .collect(Collectors.toList());\n    }\n\n    public static List<ExternalComponent> listComponents(Path componentsPath) {\n        try (Stream<Path> walker = Files.walk(componentsPath, 1)) {\n            return walker.filter(p -> p.toFile().isDirectory())\n                         .map(p -> Paths.get(p.toString(), ComponentLoader.DESCRIPTOR_FILE))\n                         .filter(f -> f.toFile().exists())\n                         .map(ComponentsHelper::readComponent)\n                         .filter(Objects::nonNull)\n                         .collect(Collectors.toList());\n\n        } catch (IOException e) {\n            logger.debug(\"Error loading external components.\", e);\n            throw new RuntimeException(\"Error loading components from \" + componentsPath + \". Error: \" + e.getMessage(), e);\n        }\n    }\n\n    public static List<String> listPagesComponents(List<Page> pages) {\n        return pages.stream()\n                    .map(Page::getLayoutTemplate)\n                    .map(LayoutTemplate::getRows)\n                    .flatMap(ComponentsHelper::allLayoutComponentsStream)\n                    .map(lt -> lt.getProperties().get(ExternalComponent.COMPONENT_ID_KEY))\n                    .filter(Objects::nonNull)\n                    .collect(Collectors.toList());\n    }\n\n    public static Stream<String> collectingPropertyValue(Page page, String propertyId) {\n        return allLayoutComponentsStream(page.getLayoutTemplate().getRows()).map(lc -> lc.getProperties().get(propertyId))\n                                                                            .filter(Objects::nonNull);\n    }\n\n    private static Stream<LayoutComponent> allLayoutComponentsStream(List<LayoutRow> row) {\n        return row.stream()\n                  .flatMap(r -> r.getLayoutColumns().stream())\n                  .flatMap(cl -> Stream.concat(cl.getLayoutComponents().stream(),\n                                               allLayoutComponentsStream(cl.getRows())));\n    }\n\n    private static ExternalComponent readComponent(Path file) {\n        String id = file.getParent().toFile().getName();\n        try {\n            ExternalComponent component = gson.fromJson(new FileReader(file.toFile()),\n                                                        ExternalComponent.class);\n            component.setId(id);\n            return component;\n        } catch (FileNotFoundException e) {\n            logger.error(\"Not able to read component manifest file {}. Error: {}\", file, e.getMessage());\n            logger.debug(\"Error reading component file.\", e);\n            return null;\n        }\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Column.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\n\npublic class Column {\n\n    LayoutColumn layoutColumn;\n\n    Column(LayoutColumn layoutColumn) {\n        this.layoutColumn = layoutColumn;\n    }\n\n    public static Column create(LayoutColumn layoutColumn) {\n        return new Column(layoutColumn);\n    }\n\n    public LayoutColumn getLayoutColumn() {\n        return layoutColumn;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Component.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\npublic class Component {\n\n    LayoutComponent layoutComponent;\n\n    Component(LayoutComponent layoutComponent) {\n        this.layoutComponent = layoutComponent;\n    }\n\n    public static Component create(LayoutComponent layoutComponent) {\n        return new Component(layoutComponent);\n    }\n\n    public LayoutComponent getLayoutComponent() {\n        return layoutComponent;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Dashboard.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport java.nio.file.Path;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\n\npublic class Dashboard {\n\n    private List<Page> pages;\n    private List<DataSetDef> dataSets;\n    private Navigation navigation;\n    private Path componentsPath;\n\n    private Dashboard(List<Page> pages, List<DataSetDef> dataSets, Navigation navigation, Path componentsPath) {\n        this.componentsPath = componentsPath;\n        this.pages = pages;\n        this.dataSets = dataSets;\n        this.navigation = navigation;\n    }\n\n    public static Dashboard of(List<Page> pages, List<DataSetDef> dataSets, Navigation navigation, Path componentsPath) {\n        return new Dashboard(pages, dataSets, navigation, componentsPath);\n    }\n\n    public List<Page> getPages() {\n        return pages;\n    }\n\n    public List<DataSetDef> getDataSets() {\n        return dataSets;\n    }\n\n    public Navigation getNavigation() {\n        return navigation;\n    }\n\n    public Optional<Path> getComponentsPath() {\n        return Optional.ofNullable(componentsPath);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Navigation.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.dashbuilder.navigation.NavTree;\n\npublic class Navigation {\n\n    private NavTree navTree;\n\n    private Navigation(NavTree navTree) {\n        this.navTree = navTree;\n    }\n\n    public static Navigation of(NavTree navTree) {\n        return new Navigation(navTree);\n    }\n\n    public NavTree getNavTree() {\n        return navTree;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/NavigationGroup.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.dashbuilder.navigation.NavGroup;\n\npublic class NavigationGroup extends NavigationItem {\n\n    private NavGroup navGroup;\n\n    private NavigationGroup(NavGroup group) {\n        super(group);\n        this.navGroup = group;\n    }\n\n    public static NavigationGroup of(NavGroup group) {\n        return new NavigationGroup(group);\n    }\n\n    public NavGroup getNavGroup() {\n        return navGroup;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/NavigationItem.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.dashbuilder.navigation.NavItem;\n\npublic class NavigationItem {\n\n    private NavItem navItem;\n\n    public NavigationItem(NavItem navItem) {\n        this.navItem = navItem;\n    }\n\n    public static NavigationItem of(NavItem navItem) {\n        return new NavigationItem(navItem);\n    }\n\n    public NavItem getNavItem() {\n        return navItem;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Page.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\npublic class Page {\n\n    LayoutTemplate layoutTemplate;\n\n    Page(LayoutTemplate layoutTemplate) {\n        this.layoutTemplate = layoutTemplate;\n    }\n\n    public static Page create(LayoutTemplate layoutTemplate) {\n        return new Page(layoutTemplate);\n    }\n\n    public LayoutTemplate getLayoutTemplate() {\n        return layoutTemplate;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/model/Row.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.model;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\n\npublic class Row {\n\n    LayoutRow layoutRow;\n\n    Row(LayoutRow layoutRow) {\n        this.layoutRow = layoutRow;\n    }\n\n    public static Row create(LayoutRow layoutRow) {\n        return new Row(layoutRow);\n    }\n\n    public LayoutRow getLayoutRow() {\n        return layoutRow;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/serialization/DashboardExporter.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization;\n\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\nimport java.util.List;\n\nimport io.netty.util.internal.shaded.org.jctools.queues.MessagePassingQueue.Consumer;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.serialization.impl.DashboardZipSerializer;\nimport org.dashbuilder.dsl.validation.DashboardValidator;\nimport org.dashbuilder.dsl.validation.ValidationResult;\nimport org.dashbuilder.dsl.validation.ValidationResult.ValidationResultType;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class DashboardExporter {\n\n    private static final Logger logger = LoggerFactory.getLogger(DashboardExporter.class);\n    private static final DashboardExporter INSTANCE = new DashboardExporter();\n\n    DashboardValidator validator = DashboardValidator.get();\n\n    public enum ExportType {\n        ZIP\n    }\n\n    private DashboardExporter() {\n        // empty\n    }\n\n    public static DashboardExporter get() {\n        return INSTANCE;\n    }\n\n    public void export(Dashboard dashboard, String path, ExportType type) {\n        export(dashboard, Paths.get(path), type);\n    }\n\n    public void export(Dashboard dashboard, Path path, ExportType type) {\n        DashboardSerializer serializer = serializerFor(type);\n        validate(dashboard);\n        Path temp = createTempDashboardFile();\n        try (FileOutputStream fos = new FileOutputStream(temp.toFile())) {\n            serializer.serialize(dashboard, fos);\n            Files.move(temp, path, StandardCopyOption.REPLACE_EXISTING);\n        } catch (FileNotFoundException e) {\n            throw new IllegalArgumentException(\"File not found: \" + path, e);\n        } catch (IOException e) {\n            throw new RuntimeException(\"Error writing to file \" + path, e);\n        } finally {\n            try {\n                Files.deleteIfExists(temp);\n            } catch (IOException e) {\n                logger.error(\"Error deleting temp file\", e);\n            }\n        }\n\n    }\n\n    private Path createTempDashboardFile() {\n        try {\n            return Files.createTempFile(\"dashboard\", \".zip\");\n        } catch (IOException e) {\n            throw new RuntimeException(\"Error creating temp file to export dashboard\", e);\n        }\n    }\n\n    void validate(Dashboard dashboard) {\n        List<ValidationResult> results = validator.validate(dashboard);\n\n        printResult(results, ValidationResultType.ERROR, logger::error);\n        printResult(results, ValidationResultType.WARNING, logger::warn);\n        printResult(results, ValidationResultType.SUCCESS, logger::info);\n\n        if (results.stream().anyMatch(p -> p.getType() == ValidationResultType.ERROR)) {\n            throw new IllegalArgumentException(\"There are validation errors, check logs for more details\");\n        }\n\n    }\n\n    private void printResult(List<ValidationResult> results, ValidationResultType type, Consumer<String> printer) {\n        results.stream()\n               .filter(v -> v.getType() == type)\n               .map(Object::toString)\n               .forEach(printer::accept);\n    }\n\n    private static DashboardZipSerializer serializerFor(ExportType type) {\n        // only ZIP is supported at the moment\n        switch (type) {\n            case ZIP:\n                return new DashboardZipSerializer();\n        }\n        return new DashboardZipSerializer();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/serialization/DashboardSerializer.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\n\nimport org.dashbuilder.dsl.model.Dashboard;\n\npublic interface DashboardSerializer {\n\n    /**\n     * Serialize the provided dashboard and write the result in the provided output stream\n     * @param dashboard\n     * @param os\n     * @return\n     */\n    void serialize(Dashboard dashboard, OutputStream os);\n\n    /**\n     * Deserialize the incoming input stream into a Dashboard object\n     * \n     * Support of components and files that aren't dashboard definition may not be supported.\n     * @param model\n     * @return\n     */\n    Dashboard deserialize(InputStream model);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/serialization/impl/DashboardZipSerializer.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization.impl;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.Enumeration;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.atomic.AtomicReference;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipFile;\nimport java.util.zip.ZipOutputStream;\n\nimport javax.ws.rs.NotSupportedException;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshaller;\nimport org.dashbuilder.dsl.factory.dashboard.DashboardFactory;\nimport org.dashbuilder.dsl.factory.navigation.NavigationFactory;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.dsl.serialization.DashboardSerializer;\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.dashbuilder.navigation.json.NavTreeJSONMarshaller;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static java.nio.charset.StandardCharsets.UTF_8;\nimport static org.dashbuilder.dsl.helper.ComponentsHelper.listComponents;\nimport static org.dashbuilder.dsl.helper.ComponentsHelper.listPagesComponents;\n\npublic class DashboardZipSerializer implements DashboardSerializer {\n\n    private static final String PATH_SEPARATOR = \"/\";\n\n    Logger logger = LoggerFactory.getLogger(DashboardZipSerializer.class);\n\n    private static int MAX_ENTRIES = 10_000;\n    \n    private static final String CSV_EXT = \".csv\";\n    private static final String DATASET_EXT = \".dset\";\n    private static final String PLUGIN_EXT = \".plugin\";\n    private static final String PERSPECTIVE_LAYOUT = \"perspective_layout\";\n\n    private static final String BASE_PATH = \"dashbuilder/\";\n\n    private static final String LAYOUTS_PATH = BASE_PATH + \"perspectives/\";\n    private static final String DATA_SETS_BASE = BASE_PATH + \"datasets/\";\n    private static final String COMPONENTS_BASE = BASE_PATH + \"components/\";\n    private static final String DATA_SETS_PATH = DATA_SETS_BASE + \"definitions/\";\n    private static final String NAVIGATION_PATH = BASE_PATH + \"navigation/navigation/navtree.json\";\n\n    private static final DataSetDefJSONMarshaller DATA_SET_MARSHALLER = new DataSetDefJSONMarshaller(new InternalDataSetProviderRegistry());\n\n    private static final Gson gson = new GsonBuilder().create();\n\n    @Override\n    public Dashboard deserialize(InputStream model) {\n        throw new NotSupportedException(\"Deserialize is not supported for ZIP Serializer\");\n    }\n    \n    /**\n     * Does not support: CSV files and components files\n     */\n    Dashboard internalDeserialize(InputStream model) {\n        Map<String, String> importContent = readAllEntriesContent(model);\n\n        List<Page> pages = new ArrayList<>();\n        List<DataSetDef> datasets = new ArrayList<>();\n        AtomicReference<Navigation> navigationRef = new AtomicReference<>(NavigationFactory.emptyNavigation());\n\n        importContent.forEach((path, content) -> {\n            if (path.startsWith(LAYOUTS_PATH) && path.endsWith(PERSPECTIVE_LAYOUT)) {\n                LayoutTemplate template = gson.fromJson(content, LayoutTemplate.class);\n                pages.add(Page.create(template));\n            }\n\n            if (path.startsWith(DATA_SETS_PATH) && path.endsWith(DATASET_EXT)) {\n                DataSetDef def;\n                try {\n                    def = DATA_SET_MARSHALLER.fromJson(content);\n                    datasets.add(def);\n                } catch (Exception e) {\n                    logger.warn(\"Error reading dataset content {}\", path);\n                    logger.debug(\"Error reading dataset content.\", e);\n                }\n            }\n\n            if (path.startsWith(NAVIGATION_PATH)) {\n                navigationRef.set(Navigation.of(NavTreeJSONMarshaller.get().fromJson(content)));\n            }\n        });\n        return DashboardFactory.dashboard(pages, datasets, navigationRef.get(), null);\n    }\n\n    @Override\n    public void serialize(Dashboard dashboard, OutputStream os) {\n        ZipOutputStream zos = new ZipOutputStream(os);\n\n        dashboard.getDataSets()\n                 .stream()\n                 .forEach(def -> writeDataSetDef(zos, def));\n\n        dashboard.getPages()\n                 .stream()\n                 .forEach(page -> writePage(zos, page));\n\n        dashboard.getDataSets()\n                 .stream()\n                 .filter(CSVDataSetDef.class::isInstance)\n                 .map(CSVDataSetDef.class::cast)\n                 .forEach(def -> writeCSVFile(zos, def));\n\n        writeNavigation(zos, dashboard.getNavigation());\n\n        writeContent(zos, DATA_SETS_BASE + \"readme.md\", \"\");\n\n        Optional<Path> componentsPathOp = dashboard.getComponentsPath();\n        if (componentsPathOp.isPresent()) {\n            Path componentsPath = componentsPathOp.get();\n            List<ExternalComponent> components = listComponents(componentsPath);\n            listPagesComponents(dashboard.getPages()).stream()\n                                                     .filter(c -> components.stream()\n                                                                            .anyMatch(comp -> comp.getId().equals(c)))\n                                                     .forEach(c -> writeComponent(componentsPath, c, zos));\n        }\n\n        try {\n            zos.close();\n        } catch (IOException e) {\n            throw new RuntimeException(\"Error closing ZIP\", e);\n        }\n    }\n\n    private void writeCSVFile(ZipOutputStream zos, CSVDataSetDef def) {\n        String filePath = def.getFilePath();\n        if (filePath != null) {\n            Path path = Paths.get(filePath);\n            if (path.toFile().exists()) {\n                try {\n                    writeContent(zos, DATA_SETS_PATH + def.getUUID() + CSV_EXT, Files.readAllBytes(path));\n                } catch (IOException e) {\n                    logger.warn(\"Not able to write CSV file {} to the exported ZIP\", filePath);\n                    logger.debug(\"Not able to write CSV\", e);\n                }\n            }\n\n        }\n    }\n\n    private void writeComponent(Path componentsPath, String componentId, ZipOutputStream zos) {\n        final Path componentPath = componentsPath.resolve(componentId);\n        final String componentZipPathBase = COMPONENTS_BASE + componentId + PATH_SEPARATOR;\n        try (Stream<Path> walker = Files.walk(componentPath, 1)) {\n            walker.filter(p -> !p.toFile().isDirectory())\n                  .forEach(file -> {\n                      String fileName = componentZipPathBase + file.toFile().getName();\n                      writeContent(zos, fileName, file);\n                  });\n        } catch (IOException e) {\n            logger.debug(\"Error loading external component files.\", e);\n            throw new RuntimeException(\"Error loading components from \" + componentsPath + \". Error: \" + e.getMessage());\n        }\n    }\n\n    private void writeNavigation(ZipOutputStream zos, Navigation navigation) {\n        String content = NavTreeJSONMarshaller.get().toJson(navigation.getNavTree()).toString();\n        writeContent(zos, NAVIGATION_PATH, content);\n    }\n\n    private void writePage(ZipOutputStream zos, Page page) {\n        LayoutTemplate lt = page.getLayoutTemplate();\n        String path = LAYOUTS_PATH + lt.getName() + PATH_SEPARATOR + PERSPECTIVE_LAYOUT;\n        String pluginPath = path + PLUGIN_EXT;\n        String content = gson.toJson(lt);\n        writeContent(zos, path, content);\n        writeContent(zos, pluginPath, new Date().toString());\n    }\n\n    private void writeDataSetDef(ZipOutputStream zos, DataSetDef def) {\n        String path = DATA_SETS_PATH + def.getUUID() + DATASET_EXT;\n        String content = DATA_SET_MARSHALLER.toJsonString(def);\n        writeContent(zos, path, content);\n    }\n\n    private void writeContent(ZipOutputStream zos, String path, byte[] content) {\n        try {\n            zos.putNextEntry(new ZipEntry(path));\n            zos.write(content);\n            zos.closeEntry();\n        } catch (IOException e) {\n            logger.warn(\"Error writing content on path {}\", path);\n            logger.debug(\"Error writing content. \", e);\n        }\n    }\n\n    private void writeContent(ZipOutputStream zos, String path, String content) {\n        this.writeContent(zos, path, content.getBytes());\n    }\n\n    private void writeContent(ZipOutputStream zos, String path, Path file) {\n        try {\n            this.writeContent(zos, path, Files.readAllBytes(file));\n        } catch (IOException e) {\n            logger.info(\"Error reading component file {}: {}\", file, e.getMessage());\n            logger.debug(\"Error reading component file\", e);\n        }\n    }\n\n    Map<String, String> readAllEntriesContent(InputStream model) {\n        Map<String, String> entriesContent = new HashMap<>();\n        Path zipTemp;\n        try {\n            zipTemp = Files.createTempFile(\"dashboard\", \"zip\");\n            Files.copy(model, zipTemp, StandardCopyOption.REPLACE_EXISTING);\n        } catch (IOException e) {\n            throw new RuntimeException(\"Error creating temp file\", e);\n        }\n\n        try (ZipFile zipFile = new ZipFile(zipTemp.toFile())) {\n            Enumeration<? extends ZipEntry> entries = zipFile.entries();\n            int totalEntries = 0;\n            while (entries.hasMoreElements()) {\n                if (++totalEntries > MAX_ENTRIES) {\n                    throw new IllegalArgumentException(\"ZIP file contains too many entries\");\n                }\n                ZipEntry e = entries.nextElement();\n                String content = new BufferedReader(new InputStreamReader(zipFile.getInputStream(e), UTF_8)).lines()\n                                                                                                            .collect(Collectors.joining(\"\\n\"));\n                entriesContent.put(e.getName(), content);\n\n            }\n        } catch (Exception e) {\n            throw new RuntimeException(\"Error reading input file\", e);\n        }\n\n        try {\n            Files.delete(zipTemp);\n        } catch (IOException e) {\n            logger.error(\"Temp file not deleted due an error\", e);\n        }\n        return entriesContent;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/serialization/impl/InternalDataSetProviderRegistry.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization.impl;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.dashbuilder.dataprovider.DataSetProvider;\nimport org.dashbuilder.dataprovider.DataSetProviderRegistry;\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.kieserver.RuntimeKieServerDataSetProviderType;\n\npublic class InternalDataSetProviderRegistry implements DataSetProviderRegistry {\n\n    Set<DataSetProviderType> providers;\n\n    public InternalDataSetProviderRegistry() {\n        initProviders();\n    }\n\n    @Override\n    public void registerDataProvider(DataSetProvider dataProvider) {\n        // empty\n    }\n\n    @Override\n    public DataSetProvider getDataSetProvider(DataSetProviderType type) {\n        // returning null because this registry will not be used in runtime, \n        // so this method should not be called in the scope of the API \n        return null;\n    }\n\n    @Override\n    public Set<DataSetProviderType> getAvailableTypes() {\n        return providers;\n    }\n\n    @Override\n    public DataSetProviderType getProviderTypeByName(String name) {\n        return providers.stream()\n                        .filter(p -> p.getName().equals(name)).findFirst()\n                        .orElseThrow(() -> new IllegalArgumentException(\"Provider not found: \" + name));\n    }\n\n    private void initProviders() {\n        providers = new HashSet<>();\n        providers.add(DataSetProviderType.BEAN);\n        providers.add(DataSetProviderType.CSV);\n        providers.add(DataSetProviderType.KAFKA);\n        providers.add(DataSetProviderType.PROMETHEUS);\n        providers.add(DataSetProviderType.SQL);\n        providers.add(DataSetProviderType.STATIC);\n        providers.add(DataSetProviderType.PROMETHEUS);\n        providers.add(new RuntimeKieServerDataSetProviderType());\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/validation/DashboardValidator.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.validation;\n\nimport java.util.List;\n\nimport org.dashbuilder.dsl.model.Dashboard;\n\n/**\n * Dashboard validation \n *\n */\npublic interface DashboardValidator {\n    \n    DashboardValidator instance = new DashboardValidatorImpl();\n\n    List<ValidationResult> validate(Dashboard dashboard);\n    \n    \n    public static DashboardValidator get() {\n        return instance;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/validation/DashboardValidatorImpl.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.validation;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.dsl.factory.navigation.NavigationFactory;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemVisitor;\n\nimport static java.lang.String.format;\nimport static java.util.stream.Collectors.joining;\nimport static org.dashbuilder.dsl.helper.ComponentsHelper.collectingPropertyValue;\nimport static org.dashbuilder.dsl.helper.ComponentsHelper.listComponentsIds;\nimport static org.dashbuilder.dsl.validation.ValidationResult.error;\nimport static org.dashbuilder.dsl.validation.ValidationResult.success;\nimport static org.dashbuilder.dsl.validation.ValidationResult.warning;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\n\nclass DashboardValidatorImpl implements DashboardValidator {\n\n    private static final String MISSING_NAVIGATION_ITEM = \"Navigation item %s has no corresponding page\";\n    private static final String DUPLICATED_GROUPS = \"The Navigation constains duplicate group names\";\n    private static final String VALID_NAVIGATION = \"Navigation is valid\";\n    private static final String NO_MISSING_DATA_SET = \"No missing data set dependencies for page %s\";\n    private static final String MISSING_DATA_SET = \"The following data sets definitions used in page %s were not found: %s\";\n\n    private static final String NO_MISSING_COMPONENT = \"No missing component dependencies for page %s\";\n    private static final String MISSING_COMPONENT_MESSAGE = \"The following components used in page %s were not found: %s\";\n\n    DisplayerSettingsJSONMarshaller displayerSettingsMarshaller = DisplayerSettingsJSONMarshaller.get();\n\n    DashboardValidatorImpl() {\n        // empty\n    }\n\n    @Override\n    public List<ValidationResult> validate(Dashboard dashboard) {\n        List<ValidationResult> results = new ArrayList<>();\n        results.addAll(checkDataSetsDependencies(dashboard));\n        results.addAll(checkComponentsDependencies(dashboard));\n        results.addAll(checkNavigation(dashboard));\n        return results;\n    }\n\n    private List<ValidationResult> checkNavigation(Dashboard dashboard) {\n        Navigation navigation = dashboard.getNavigation();\n        NavigationPagesVisitor visitor = new NavigationPagesVisitor();\n        List<ValidationResult> results = new ArrayList<>();\n        if (navigation == null || navigation == NavigationFactory.emptyNavigation()) {\n            return Collections.emptyList();\n        }\n\n        navigation.getNavTree().accept(visitor);\n\n        List<String> visitedPages = visitor.getVisitedPages();\n        List<String> visitedGroups = visitor.getVisitedGroups();\n        if (!visitedPages.isEmpty()) {\n            visitedPages.stream()\n                        .filter(vp -> dashboard.getPages().stream().noneMatch(p -> p.getLayoutTemplate().getName().equals(vp)))\n                        .map(vp -> error(format(MISSING_NAVIGATION_ITEM, vp)))\n                        .forEach(results::add);\n        }\n        \n        if (containDuplicates(visitedGroups)) {\n            results.add(error(DUPLICATED_GROUPS));\n        }\n        \n        if (results.isEmpty()) {\n            results.add(ValidationResult.success(VALID_NAVIGATION));\n        }\n        return results;\n    }\n\n    List<ValidationResult> checkComponentsDependencies(Dashboard dashboard) {\n        List<String> components = listComponentsIds(dashboard);\n        return dashboard.getPages().stream()\n                        .map(p -> validateComponentsUsage(p, components))\n                        .filter(Objects::nonNull)\n                        .collect(Collectors.toList());\n\n    }\n\n    List<ValidationResult> checkDataSetsDependencies(Dashboard dashboard) {\n        return dashboard.getPages().stream()\n                        .map(p -> validateDataSetsUsage(p, dashboard.getDataSets()))\n                        .filter(Objects::nonNull)\n                        .collect(Collectors.toList());\n    }\n\n    ValidationResult validateDataSetsUsage(Page page, List<DataSetDef> dataSets) {\n        List<String> dataSetsDeps = findDataSetsDependencies(page);\n        if (dataSetsDeps.isEmpty()) {\n            return null;\n        }\n        Set<String> missingDataSets = dataSetsDeps.stream()\n                                                  .filter(uuid -> noneMatch(dataSets, ds -> ds.getUUID().equals(uuid)))\n                                                  .collect(Collectors.toSet());\n        return missingDataSets.isEmpty()\n                ? success(format(NO_MISSING_DATA_SET, page.getLayoutTemplate().getName()))\n                : error(format(MISSING_DATA_SET,\n                               page.getLayoutTemplate().getName(),\n                               missingDataSets.stream()\n                                              .collect(joining(\", \"))));\n    }\n\n    ValidationResult validateComponentsUsage(Page page, List<String> components) {\n        List<String> componentsDeps = findComponentsDependencies(page);\n        if (componentsDeps.isEmpty()) {\n            return null;\n        }\n        Set<String> missingComponents = componentsDeps.stream()\n                                                      .filter(id -> noneMatch(components, cid -> cid.equals(id)))\n                                                      .collect(Collectors.toSet());\n        return missingComponents.isEmpty()\n                ? success(format(NO_MISSING_COMPONENT, page.getLayoutTemplate().getName()))\n                : warning(format(MISSING_COMPONENT_MESSAGE,\n                                 page.getLayoutTemplate().getName(),\n                                 missingComponents.stream()\n                                                  .collect(joining(\", \"))));\n    }\n\n    private <T> boolean noneMatch(List<T> list, Predicate<T> test) {\n        return list.isEmpty() || list.stream().noneMatch(test::test);\n    }\n\n    private List<String> findDataSetsDependencies(Page page) {\n        return collectingPropertyValue(page, \"json\").map(displayerSettingsMarshaller::fromJsonString)\n                                                    .map(DisplayerSettings::getDataSetLookup)\n                                                    .filter(Objects::nonNull)\n                                                    .map(DataSetLookup::getDataSetUUID)\n                                                    .filter(Objects::nonNull)\n                                                    .collect(Collectors.toList());\n    }\n\n    private List<String> findComponentsDependencies(Page page) {\n        return collectingPropertyValue(page, COMPONENT_ID_KEY).filter(c -> !c.endsWith(\"provided\"))\n                                                              .collect(Collectors.toList());\n\n    }\n    \n    private boolean containDuplicates(List<String> list) {\n        return list.size() > list.stream().distinct().count();\n    }\n\n    static class NavigationPagesVisitor implements NavItemVisitor {\n\n        private List<String> visitedPages;\n        \n        private List<String> visitedGroups;\n\n        NavigationPagesVisitor() {\n            this.visitedPages = new ArrayList<>();\n            this.visitedGroups = new ArrayList<>(); \n        }\n\n        public List<String> getVisitedPages() {\n            return visitedPages;\n        }\n\n        @Override\n        public void visitGroup(NavGroup group) {\n            visitedGroups.add(group.getName());\n\n        }\n\n        @Override\n        public void visitItem(NavItem item) {\n            visitedPages.add(item.getName());\n\n        }\n\n        @Override\n        public void visitDivider(NavDivider divider) {\n            // empty\n        }\n        \n        public List<String> getVisitedGroups() {\n            return visitedGroups;\n        }\n\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/main/java/org/dashbuilder/dsl/validation/ValidationResult.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.validation;\n\npublic class ValidationResult {\n\n    public enum ValidationResultType {\n        SUCCESS,\n        WARNING,\n        ERROR;\n    }\n\n    ValidationResultType type;\n\n    String message;\n\n    public ValidationResult(ValidationResultType type, String message) {\n        this.type = type;\n        this.message = message;\n    }\n\n    public static ValidationResult success(String message) {\n        return new ValidationResult(ValidationResultType.SUCCESS, message);\n    }\n\n    public static ValidationResult warning(String message) {\n        return new ValidationResult(ValidationResultType.WARNING, message);\n    }\n\n    public static ValidationResult error(String message) {\n        return new ValidationResult(ValidationResultType.ERROR, message);\n    }\n\n    public ValidationResultType getType() {\n        return type;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    @Override\n    public String toString() {\n        return \"ValidationResult [type=\" + type + \", message=\" + message + \"]\";\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/factory/component/ComponentFactoryTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.dsl.model.Component;\nimport org.junit.Test;\n\nimport static org.dashbuilder.dsl.factory.component.HtmlComponentBuilder.HTML_CODE_PROP;\nimport static org.dashbuilder.dsl.factory.component.LogoBuilder.LOGO_ID;\nimport static org.dashbuilder.dsl.factory.component.LogoBuilder.LOGO_URL_PROP;\nimport static org.dashbuilder.dsl.factory.component.ProcessHeatmapBuilder.COMPONENT_ID;\nimport static org.dashbuilder.dsl.factory.component.ProcessHeatmapBuilder.CONTAINER_ID_PARAM;\nimport static org.dashbuilder.dsl.factory.component.ProcessHeatmapBuilder.PROCESS_ID_PARAM;\nimport static org.dashbuilder.dsl.factory.component.ProcessHeatmapBuilder.SERVER_TEMPLATE_PARAM;\nimport static org.dashbuilder.external.model.ExternalComponent.COMPONENT_ID_KEY;\nimport static org.junit.Assert.assertEquals;\n\npublic class ComponentFactoryTest {\n\n    @Test\n    public void testExternal() {\n        Component external = ComponentFactory.external(\"test\");\n        assertEquals(\"test\", external.getLayoutComponent().getProperties().get(COMPONENT_ID_KEY));\n    }\n\n    @Test\n    public void testHtml() {\n        Component html = ComponentFactory.html(\"test\");\n        assertEquals(\"test\", html.getLayoutComponent().getProperties().get(HTML_CODE_PROP));\n    }\n\n    @Test\n    public void testLogo() {\n        Component logo = ComponentFactory.logo(\"src\");\n        assertEquals(LOGO_ID, logo.getLayoutComponent().getProperties().get(COMPONENT_ID_KEY));\n        assertEquals(\"src\", logo.getLayoutComponent().getProperties().get(LOGO_ID + \".\" + LOGO_URL_PROP));\n    }\n\n    @Test\n    public void testHeatmap() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newExternalDisplayerSettings().buildSettings();\n        Component heatmap = ComponentFactory.processHeatmap(\"server\", \"container\", \"process\", settings);\n        assertEquals(COMPONENT_ID, heatmap.getLayoutComponent().getProperties().get(COMPONENT_ID_KEY));\n        assertEquals(\"server\", settings.getComponentProperty(SERVER_TEMPLATE_PARAM));\n        assertEquals(\"container\", settings.getComponentProperty(CONTAINER_ID_PARAM));\n        assertEquals(\"process\", settings.getComponentProperty(PROCESS_ID_PARAM));\n    }\n    \n    \n    @Test\n    public void testAllProcessesHeatmap() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newExternalDisplayerSettings().buildSettings();\n        Component allProcessHeatmap = ComponentFactory.allProcessesHeatmap(\"server\", settings);\n        assertEquals(AllProcessesHeatmapBuilder.COMPONENT_ID, allProcessHeatmap.getLayoutComponent().getProperties().get(COMPONENT_ID_KEY));\n        assertEquals(\"server\", settings.getComponentProperty(AllProcessesHeatmapBuilder.SERVER_TEMPLATE_PARAM));\n    }\n    \n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/factory/component/DisplayerBuilderTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.component;\n\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.dsl.model.Component;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\npublic class DisplayerBuilderTest {\n\n    @Test\n    public void testDisplayerJson() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newAreaChartSettings()\n                                                             .subType_Area()\n                                                             .dataset(\"test\")\n                                                             .buildSettings();\n        String json = DisplayerSettingsJSONMarshaller.get().toJsonString(settings);\n        Component comp = DisplayerBuilder.create(settings).build();\n        assertEquals(json, comp.getLayoutComponent().getProperties().get(\"json\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testSettingsMissingDataSetUUID() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newAreaChartSettings()\n                                                             .subType_Area()\n                                                             .buildSettings();\n        DisplayerBuilder.create(settings).build();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testSettingsEmptyDataSetUUID() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newAreaChartSettings()\n                                                             .subType_Area()\n                                                             .dataset(\"    \")\n                                                             .buildSettings();\n        DisplayerBuilder.create(settings).build();\n    }\n\n    @Test\n    public void testWithDataSet() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newAreaChartSettings()\n                                                             .subType_Area()\n                                                             .dataset(DataSetFactory.newEmptyDataSet())\n                                                             .buildSettings();\n        assertNotNull(DisplayerBuilder.create(settings).build());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/factory/page/ComponentBuilderTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Component;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class ComponentBuilderTest {\n    \n    @Test\n    public void testColumnBuilderProperties() {\n        Column column = ColumnBuilder.newBuilder().property(\"key\", \"value\").build();\n        assertEquals(\"value\", column.getLayoutColumn().getProperties().get(\"key\"));\n    }\n    \n    \n    @Test\n    public void testColumnBuilderComponent() {\n        LayoutComponent lt = new LayoutComponent();\n        Component comp = Component.create(lt);\n        Column column = ColumnBuilder.newBuilder().component(comp).build();\n        assertEquals(lt, column.getLayoutColumn().getLayoutComponents().get(0));\n    }\n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/factory/page/PageBuilderTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Component;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.dsl.model.Row;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class PageBuilderTest {\n\n    @Test\n    public void testPageBuilderProperties() {\n        String name = \"pageName\";\n        Page page = PageBuilder.newBuilder(name).property(\"key\", \"value\").build();\n        assertEquals(name, page.getLayoutTemplate().getName());\n        assertEquals(\"value\", page.getLayoutTemplate().getLayoutProperties().get(\"key\"));\n    }\n\n    @Test\n    public void testPageBuilderComponent() {\n        LayoutComponent lt = new LayoutComponent();\n        Component comp = Component.create(lt);\n        Column column = ColumnBuilder.newBuilder().component(comp).build();\n        Row row = RowBuilder.newBuilder().column(column).build();\n        Page page = PageBuilder.newBuilder(\"test\").row(row).build();\n        assertEquals(lt, page.getLayoutTemplate()\n                             .getRows().get(0)\n                             .getLayoutColumns().get(0)\n                             .getLayoutComponents().get(0));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/factory/page/RowBuilderTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.factory.page;\n\nimport org.dashbuilder.dsl.model.Column;\nimport org.dashbuilder.dsl.model.Component;\nimport org.dashbuilder.dsl.model.Row;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class RowBuilderTest {\n    \n    @Test\n    public void testRowBuilderProperties() {\n        Row row = RowBuilder.newBuilder().property(\"key\", \"value\").build();\n        assertEquals(\"value\", row.getLayoutRow().getProperties().get(\"key\"));\n    }\n    \n    \n    @Test\n    public void testRowBuilderComponent() {\n        LayoutComponent lt = new LayoutComponent();\n        Component comp = Component.create(lt);\n        Column column = ColumnBuilder.newBuilder().component(comp).build();\n        Row row = RowBuilder.newBuilder().column(column).build();\n        assertEquals(lt, row.getLayoutRow().getLayoutColumns().get(0).getLayoutComponents().get(0));\n    }\n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/serialization/DashboardExporterTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization;\n\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.junit.Test;\n\nimport static java.util.Arrays.asList;\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.displayer;\nimport static org.dashbuilder.dsl.factory.dashboard.DashboardFactory.dashboard;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.page;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.row;\n\npublic class DashboardExporterTest {\n    \n    @Test(expected = IllegalArgumentException.class)\n    public void testBadExportShouldThrowException() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newAreaChartSettings().subType_Area().dataset(\"missing\").buildSettings();\n        DashboardExporter.get().validate(dashboard(asList(page(\"test\", row(displayer(settings))))));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/serialization/impl/DashboardZipSerializerTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.serialization.impl;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Map;\nimport java.util.UUID;\nimport java.util.stream.Collectors;\n\nimport org.dashbuilder.dataset.ColumnType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.group.AggregateFunctionType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.Position;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Navigation;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.navigation.json.NavTreeJSONMarshaller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.css.CssProperty;\n\nimport static java.util.Arrays.asList;\nimport static org.dashbuilder.dataset.def.DataSetDefFactory.newCSVDataSetDef;\nimport static org.dashbuilder.displayer.DisplayerSettingsFactory.newLineChartSettings;\nimport static org.dashbuilder.displayer.DisplayerSettingsFactory.newSelectorSettings;\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.external;\nimport static org.dashbuilder.dsl.factory.dashboard.DashboardFactory.dashboard;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.group;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.item;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.navigation;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.page;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.pageBuilder;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.row;\nimport static org.junit.Assert.assertEquals;\n\npublic class DashboardZipSerializerTest {\n\n    String csvFilePath = this.getClass().getResource(\"/data/un_world_pop_medium_variant.csv\").getFile();\n    private DashboardZipSerializer serializer;\n\n    @Before\n    public void before() {\n        serializer = new DashboardZipSerializer();\n    }\n\n    @Test\n    public void testExportedStaticFiles() throws IOException {\n        DataSetDef def = newCSVDataSetDef().uuid(\"myDs\")\n                                           .filePath(csvFilePath)\n                                           .separatorChar(',')\n                                           .quoteChar('\"')\n                                           .column(\"Year\", ColumnType.NUMBER)\n                                           .cacheOff()\n                                           .buildDef();\n\n        Page page = page(\"My Page\", row(external(\"comp1\")));\n        Path componentsPath = Paths.get(this.getClass().getResource(\"/components\").getFile());\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n        serializer.serialize(dashboard(asList(page), asList(def), componentsPath), out);\n\n        Map<String, String> content = serializer.readAllEntriesContent(new ByteArrayInputStream(out.toByteArray()));\n\n        assertEquals(read(\"/components/comp1/manifest.json\"), content.get(\"dashbuilder/components/comp1/manifest.json\"));\n        assertEquals(read(\"/components/comp1/index.html\"), content.get(\"dashbuilder/components/comp1/index.html\"));\n        assertEquals(read(\"/components/comp1/index.js\"), content.get(\"dashbuilder/components/comp1/index.js\"));\n\n        assertEquals(read(\"/data/un_world_pop_medium_variant.csv\"), content.get(\"dashbuilder/datasets/definitions/myDs.csv\"));\n\n    }\n\n    @Test\n    public void testExportedZip() throws Exception {\n        DataSetDef def = newCSVDataSetDef().uuid(UUID.randomUUID().toString())\n                                           .filePath(csvFilePath)\n                                           .separatorChar(',')\n                                           .quoteChar('\"')\n                                           .buildDef();\n\n        DisplayerSettings filterByYear = newSelectorSettings().subtype(DisplayerSubType.SELECTOR_SLIDER)\n                                                              .width(1200)\n                                                              .filterOn(false, true, false)\n                                                              .dataset(def.getUUID())\n                                                              .column(\"Year\")\n                                                              .buildSettings();\n\n        DisplayerSettings evolutionChart = newLineChartSettings().subType_SmoothLine()\n                                                                 .dataset(def.getUUID())\n                                                                 .width(1200)\n                                                                 .legendOn(Position.IN)\n                                                                 .xAxisAngle(0)\n                                                                 .margins(0, 30, 0, 0)\n                                                                 .filterOn(false, false, true)\n                                                                 .group(\"Year\")\n                                                                 .column(\"Year\")\n                                                                 .expression(\"parseInt(value)\")\n                                                                 .column(\"PopTotal\", AggregateFunctionType.SUM, \"Total\")\n                                                                 .column(\"PopFemale\", AggregateFunctionType.SUM, \"Female\")\n                                                                 .column(\"PopMale\", AggregateFunctionType.SUM, \"Male\")\n                                                                 .buildSettings();\n\n        Page page = pageBuilder(\"Population\").cssProperty(CssProperty.MARGIN_LEFT, \"10px\")\n                                             .rows(row(\"<h3>Population growth until 2100</h3>\"),\n                                                   row(filterByYear),\n                                                   row(evolutionChart))\n                                             .build();\n\n        Navigation navigation = navigation(group(\"Test Group\", item(page)));\n        Dashboard db = dashboard(asList(page), asList(def), navigation);\n\n        String navTreeString = NavTreeJSONMarshaller.get().toJson(navigation.getNavTree()).toString();\n\n        ByteArrayOutputStream out = new ByteArrayOutputStream();\n\n        serializer.serialize(db, out);\n\n        Dashboard deserialized = serializer.internalDeserialize(new ByteArrayInputStream(out.toByteArray()));\n\n        assertEquals(page.getLayoutTemplate().getName(),\n                     deserialized.getPages().get(0).getLayoutTemplate().getName());\n        assertEquals(def.getUUID(),\n                     deserialized.getDataSets().get(0).getUUID());\n        assertEquals(navTreeString,\n                     NavTreeJSONMarshaller.get().toJson(deserialized.getNavigation().getNavTree()).toString());\n    }\n\n    private String read(String path) throws IOException {\n        return Files.readAllLines(Paths.get(this.getClass().getResource(path).getFile())).stream().collect(Collectors.joining(\"\\n\"));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/java/org/dashbuilder/dsl/validation/DashboardValidatorImplTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dsl.validation;\n\nimport java.io.IOException;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.dsl.model.Dashboard;\nimport org.dashbuilder.dsl.model.Page;\nimport org.dashbuilder.dsl.validation.ValidationResult.ValidationResultType;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static java.util.Arrays.asList;\nimport static org.dashbuilder.dataset.def.DataSetDefFactory.newStaticDataSetDef;\nimport static org.dashbuilder.displayer.DisplayerSettingsFactory.newAreaChartSettings;\nimport static org.dashbuilder.displayer.DisplayerSettingsFactory.newExternalDisplayerSettings;\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.displayer;\nimport static org.dashbuilder.dsl.factory.component.ComponentFactory.external;\nimport static org.dashbuilder.dsl.factory.dashboard.DashboardFactory.dashboard;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.group;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.item;\nimport static org.dashbuilder.dsl.factory.navigation.NavigationFactory.navigation;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.page;\nimport static org.dashbuilder.dsl.factory.page.PageFactory.row;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class DashboardValidatorImplTest {\n\n    private DashboardValidatorImpl impl;\n    private Path componentsPath;\n\n    @Before\n    public void before() throws IOException {\n        impl = new DashboardValidatorImpl();\n        componentsPath = Paths.get(this.getClass().getResource(\"/components\").getFile());\n    }\n\n    @Test\n    public void testMissingDataSet() {\n        DisplayerSettings settings = newAreaChartSettings().subType_Area().dataset(\"nonExisting\").buildSettings();\n        Page page = page(\"abc\", row(displayer(settings)));\n        Dashboard dashboard = dashboard(asList(page));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"The following data sets definitions used in page abc were not found: nonExisting\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.ERROR, result.getType());\n    }\n\n    @Test\n    public void testDataSetFound() {\n        DataSetDef def = newStaticDataSetDef().uuid(\"myds\").buildDef();\n        DisplayerSettings settings = newAreaChartSettings().subType_Area().dataset(def.getUUID()).buildSettings();\n        Page page = page(\"abc\", row(displayer(settings)));\n        Dashboard dashboard = dashboard(asList(page), asList(def));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"No missing data set dependencies for page abc\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.SUCCESS, result.getType());\n    }\n\n    @Test\n    public void testMissingComponent() {\n        DisplayerSettings settings = DisplayerSettingsFactory.newExternalDisplayerSettings().buildSettings();\n        Page page = page(\"abc\", row(external(\"missingComp\", settings)));\n        Dashboard dashboard = dashboard(asList(page));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"The following components used in page abc were not found: missingComp\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.WARNING, result.getType());\n    }\n\n    @Test\n    public void testExistingComponent() {\n        DisplayerSettings settings = newExternalDisplayerSettings().buildSettings();\n        Page page = page(\"abc\", row(external(\"comp1\", settings)));\n        Dashboard dashboard = dashboard(asList(page), componentsPath);\n        List<ValidationResult> results = impl.validate(dashboard);\n        assertEquals(1, results.size());\n        assertEquals(\"No missing component dependencies for page abc\", results.get(0).getMessage());\n    }\n\n    @Test\n    public void testMissingNavigationItem() {\n        Page page = page(\"page\");\n        Page page2 = page(\"page2\");\n        Dashboard dashboard = dashboard(asList(page), navigation(group(\"test\", item(page2))));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"Navigation item page2 has no corresponding page\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.ERROR, result.getType());\n    }\n    \n    @Test\n    public void testNavigationWithMissingGroup() {\n        Page page = page(\"page\");\n        Dashboard dashboard = dashboard(asList(page), navigation(group(\"test\", item(page)), group(\"test\", item(page))));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"The Navigation constains duplicate group names\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.ERROR, result.getType());\n    }\n\n    @Test\n    public void testNavigationCorrect() {\n        Page page = page(\"page\");\n        Dashboard dashboard = dashboard(asList(page), navigation(group(\"test\", item(page))));\n        List<ValidationResult> results = impl.validate(dashboard);\n        ValidationResult result = results.get(0);\n        assertEquals(1, results.size());\n        assertEquals(\"Navigation is valid\", result.getMessage());\n        assertEquals(ValidationResult.ValidationResultType.SUCCESS, result.getType());\n    }\n\n    @Test\n    public void testSuccessfulValidation() {\n        DataSetDef def = newStaticDataSetDef().uuid(\"myds\").buildDef();\n        DisplayerSettings settings = newAreaChartSettings().subType_Area().dataset(def.getUUID()).buildSettings();\n        DisplayerSettings externalSettings = newExternalDisplayerSettings().buildSettings();\n        Page page = page(\"abc\", row(external(\"comp1\", externalSettings)), row(displayer(settings)));\n        Dashboard dashboard = dashboard(asList(page), asList(def), navigation(group(\"test\", item(page))), componentsPath);\n        List<ValidationResult> results = impl.validate(dashboard);\n        assertEquals(3, results.size());\n        assertTrue(results.stream().allMatch(r -> r.type == ValidationResultType.SUCCESS));\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/resources/components/comp1/index.html",
    "content": "<!--\n  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<h1>Comp1</h1>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/resources/components/comp1/index.js",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nfunction sayHello() {\n\talert(\"NEVER, it is just the beginning!\")\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/resources/components/comp1/manifest.json",
    "content": "{\n\t\"name\": \"My Component1\"\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-dsl/src/test/resources/data/un_world_pop_medium_variant.csv",
    "content": "\"Year\",\"PopMale\",\"PopFemale\",\"PopTotal\",\"PopDensity\"\n1950,1266259.556,1270171.462,2536431.018,19.497\n1951,1290237.638,1293796.589,2584034.227,19.863\n1952,1313854.565,1317007.125,2630861.69,20.223\n1953,1337452.786,1340156.275,2677609.061,20.582\n1954,1361313.834,1363532.92,2724846.754,20.945\n1955,1385658.299,1387361.616,2773019.915,21.316\n1956,1410643.208,1411800.046,2822443.254,21.695\n1957,1436364.62,1436941.438,2873306.058,22.086\n1958,1462864.322,1462822.358,2925686.68,22.489\n1959,1490141.399,1489434.748,2979576.147,22.903\n1960,1518186.702,1516763.013,3034949.715,23.329\n1961,1547019.353,1544824.16,3091843.513,23.766\n1962,1576718.903,1573701.858,3150420.761,24.216\n1963,1607439.247,1603561.699,3211000.946,24.682\n1964,1639369.328,1634608.944,3273978.272,25.166\n1965,1672618.879,1666964.631,3339583.51,25.671\n1966,1707237.638,1700684.993,3407922.631,26.196\n1967,1743114.222,1735655.882,3478770.104,26.74\n1968,1779990.92,1771608.516,3551599.436,27.3\n1969,1817510.8,1808170.165,3625680.965,27.87\n1970,1855390.166,1845046.876,3700437.042,28.444\n1971,1893576.318,1882183.712,3775760.03,29.023\n1972,1932065.884,1919584.704,3851650.588,29.607\n1973,1970688.779,1957091.74,3927780.519,30.192\n1974,2009259.494,1994534.684,4003794.178,30.776\n1975,2047666.026,2031814.448,4079480.474,31.358\n1976,2085824.453,2068842.374,4154666.827,31.936\n1977,2123811.87,2105694.049,4229505.919,32.511\n1978,2161887.592,2142646.007,4304533.599,33.088\n1979,2200418.504,2180087.681,4380506.185,33.672\n1980,2239689.027,2218314.439,4458003.466,34.268\n1981,2279673.275,2257323.344,4536996.619,34.875\n1982,2320329.605,2297056.921,4617386.526,35.493\n1983,2361892.584,2337676.603,4699569.187,36.124\n1984,2404645.374,2379366.143,4784011.517,36.773\n1985,2448724.603,2422197.063,4870921.666,37.442\n1986,2494279.319,2466288.681,4960568,38.131\n1987,2541075.233,2511446.765,5052521.998,38.837\n1988,2588387.929,2557038.065,5145425.994,39.552\n1989,2635233.492,2602207.942,5237441.434,40.259\n1990,2680895.262,2646335.779,5327231.041,40.949\n1991,2725113.179,2689176.204,5414289.383,41.618\n1992,2768050.729,2730869.164,5498919.893,42.269\n1993,2809940.82,2771656.778,5581597.598,42.904\n1994,2851196.996,2811953.432,5663150.428,43.531\n1995,2892141.549,2852071.381,5744212.93,44.154\n1996,2932815.962,2892075.969,5824891.931,44.774\n1997,2973160.99,2931884.657,5905045.647,45.391\n1998,3013295.709,2971498.366,5984794.075,46.004\n1999,3053349.42,3010889.613,6064239.033,46.614\n2000,3093433.858,3050059.948,6143493.806,47.223\n2001,3133601.761,3089024.77,6222626.531,47.832\n2002,3173900.449,3127872.723,6301773.172,48.44\n2003,3214422.031,3166763.11,6381185.141,49.051\n2004,3255262.626,3205896.765,6461159.391,49.665\n2005,3296485.267,3245421.689,6541906.956,50.286\n2006,3338132.929,3285384.988,6623517.917,50.913\n2007,3380183.02,3325763.623,6705946.643,51.547\n2008,3422546.382,3366542.29,6789088.672,52.186\n2009,3465089.423,3407677.565,6872766.988,52.829\n2010,3507703.635,3449119.953,6956823.588,53.475\n2011,3550332.593,3490861.575,7041194.168,54.124\n2012,3592963.006,3532864.951,7125827.957,54.774\n2013,3635575.332,3575006.709,7210582.041,55.426\n2014,3678161.837,3617128.922,7295290.759,56.077\n2015,3720696.374,3659100.593,7379796.967,56.727\n2016,3763157.221,3700864.713,7464021.934,57.374\n2017,3805469.093,3742389.807,7547858.9,58.018\n2018,3847487.861,3783603.252,7631091.113,58.658\n2019,3889034.611,3824433.594,7713468.205,59.291\n2020,3929973.953,3864824.776,7794798.729,59.917\n2021,3970238.39,3904727.342,7874965.732,60.533\n2022,4009829.762,3944122.815,7953952.577,61.14\n2023,4048771.753,3983028.585,8031800.338,61.738\n2024,4087120.942,4021484.313,8108605.255,62.329\n2025,4124919.51,4059517.943,8184437.453,62.912\n2026,4162157.763,4097118.888,8259276.651,63.487\n2027,4198812.392,4134265.926,8333078.318,64.054\n2028,4234898.159,4170965.142,8405863.301,64.614\n2029,4270434.917,4207225.806,8477660.723,65.166\n2030,4305436.923,4243050.448,8548487.371,65.71\n2031,4339910.899,4278438.555,8618349.454,66.247\n2032,4373852.542,4313375.331,8687227.873,66.777\n2033,4407252.206,4347831.306,8755083.512,67.298\n2034,4440095.078,4381767.627,8821862.705,67.811\n2035,4472370.475,4415153.754,8887524.229,68.316\n2036,4504074.999,4447973.886,8952048.885,68.812\n2037,4535212.764,4480224.852,9015437.616,69.299\n2038,4565789.971,4511903.674,9077693.645,69.778\n2039,4595815.916,4543012.646,9138828.562,70.248\n2040,4625296.608,4573550.774,9198847.382,70.709\n2041,4654233.007,4603512.476,9257745.483,71.162\n2042,4682621.46,4632886.693,9315508.153,71.606\n2043,4710457.197,4661661.05,9372118.247,72.041\n2044,4737734.143,4689821.239,9427555.382,72.467\n2045,4764446.974,4717356.298,9481803.272,72.884\n2046,4790594.206,4744260.467,9534854.673,73.292\n2047,4816175.052,4770532.697,9586707.749,73.691\n2048,4841185.259,4796172.061,9637357.32,74.08\n2049,4865620.226,4821179.92,9686800.146,74.46\n2050,4889476.137,4845557.763,9735033.9,74.831\n2051,4912753.77,4869307.988,9782061.758,75.192\n2052,4935453.691,4892431.75,9827885.441,75.544\n2053,4957572.608,4914928.954,9872501.562,75.887\n2054,4979106.4,4936798.851,9915905.251,76.221\n2055,5000054.515,4958044.231,9958098.746,76.545\n2056,5020416.864,4978668.303,9999085.167,76.86\n2057,5040200.141,4998681.121,10038881.262,77.166\n2058,5059417.113,5018100.967,10077518.08,77.463\n2059,5078085.161,5036951.199,10115036.36,77.752\n2060,5096218.399,5055251.284,10151469.683,78.032\n2061,5113824.311,5073012.898,10186837.209,78.304\n2062,5130906.26,5090242.78,10221149.04,78.567\n2063,5147469.268,5106949.736,10254419.004,78.823\n2064,5163517.276,5123141.078,10286658.354,79.071\n2065,5179054.658,5138824.657,10317879.315,79.311\n2066,5194087.269,5154010.81,10348098.079,79.543\n2067,5208621.301,5168709.529,10377330.83,79.768\n2068,5222662.003,5182928.529,10405590.532,79.985\n2069,5236214.417,5196674.719,10432889.136,80.195\n2070,5249283.714,5209955.787,10459239.501,80.398\n2071,5261875.63,5222779.228,10484654.858,80.593\n2072,5273995.495,5235154.907,10509150.402,80.781\n2073,5285647.053,5247095.808,10532742.861,80.963\n2074,5296833.337,5258616.666,10555450.003,81.137\n2075,5307558.352,5269729.843,10577288.195,81.305\n2076,5317828.46,5280445.712,10598274.172,81.466\n2077,5327650.719,5290770.19,10618420.909,81.621\n2078,5337030.84,5300705.979,10637736.819,81.77\n2079,5345975.152,5310253.081,10656228.233,81.912\n2080,5354490.414,5319414.04,10673904.454,82.048\n2081,5362581.26,5328192.075,10690773.335,82.177\n2082,5370256.1,5336596.326,10706852.426,82.301\n2083,5377530.581,5344640.794,10722171.375,82.419\n2084,5384423.298,5352342.146,10736765.444,82.531\n2085,5390949.038,5359713.315,10750662.353,82.638\n2086,5397115.414,5366758.609,10763874.023,82.739\n2087,5402924.365,5373477.654,10776402.019,82.835\n2088,5408377.091,5379871.857,10788248.948,82.927\n2089,5413472.043,5385941.323,10799413.366,83.012\n2090,5418208.072,5391684.231,10809892.303,83.093\n2091,5422585.514,5397097.129,10819682.643,83.168\n2092,5426605.849,5402175.11,10828780.959,83.238\n2093,5430270.716,5406911.361,10837182.077,83.303\n2094,5433580.881,5411297.917,10844878.798,83.362\n2095,5436535.751,5415324.394,10851860.145,83.416\n2096,5439132.293,5418979.294,10858111.587,83.464\n2097,5441365.752,5422249.024,10863614.776,83.506\n2098,5443228.989,5425118.647,10868347.636,83.542\n2099,5444712.816,5427571.318,10872284.134,83.573\n2100,5445805.463,5429588.256,10875393.719,83.596\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/.gitignore",
    "content": "node_modules/\ndist/\ncoverage/\ntarget/"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/README.md",
    "content": "Dashbuilder JS\n==\n\nThis package provides the public Dashbuilder Components API along with internal supported components.\n\nIt is packaged as a JAR and consumed by components API to expose the internal components.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\n        \"default\",\n                [\n                  \"jest-junit\",\n                   {\n                   /*\n                    * Removes spaces from test titles and makes first\n                    * letter of each word capitalized.\n                    *\n                    * unit test -> UnitTest\n                    *\n                    * See junit.xml report for resulting look.\n                    */\n                    titleTemplate: (vars) => {\n                            var str = vars.title.toLowerCase();\n                            str = str.split(' ');\n                            for (var i = 0; i < str.length; i++) {\n                                str[i] = str[i].charAt(0).toUpperCase() + str[i].slice(1);\n                            }\n                            var result = str.join('');\n                            return result.replace(',');\n                        }\n\n                    }\n                ]\n  ],\n  moduleDirectories: [\"node_modules\", \"packages/*\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/package.json",
    "content": "{\n  \"name\": \"dashbuilder-components\",\n  \"version\": \"0.0.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/dashbuilder-components.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"private\": true,\n  \"workspaces\": [\n    \"packages/*\"\n  ],\n  \"dependencies\": {\n    \"@types/react\": \"^16.8.8\",\n    \"@types/react-dom\": \"^16.8.2\",\n    \"react\": \"^16.12.0\",\n    \"react-dom\": \"^16.12.0\"\n  },\n  \"scripts\": {\n    \"init\": \"yarn install --force\",\n    \"build:fast\": \"yarn workspaces run build:fast\",\n    \"build:prod\": \"yarn workspaces run build:prod\"\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\",\n    \"suiteName\": \"org.dashbuilder.components.tests\",\n    \"suiteNameTemplate\": \"{filename}\",\n    \"classNameTemplate\": \"org.dashbuilder.components.tests.{filename}.{classname}\"\n  },\n  \"devDependencies\": {\n    \"@babel/core\": \"^7.7.2\",\n    \"@babel/preset-env\": \"^7.7.1\",\n    \"@babel/preset-react\": \"^7.7.0\",\n    \"@testing-library/jest-dom\": \"^5.3.0\",\n    \"@testing-library/react\": \"^10.0.2\",\n    \"@testing-library/react-hooks\": \"^3.2.1\",\n    \"@types/jest\": \"^25.2.3\",\n    \"@types/mocha\": \"^5.2.7\",\n    \"@types/node\": \"^12.12.5\",\n    \"@types/react\": \"^16.8.8\",\n    \"@types/react-dom\": \"^16.8.2\",\n    \"@types/react-router\": \"^5.1.1\",\n    \"@types/react-router-dom\": \"^5.1.1\",\n    \"babel-loader\": \"^8.0.6\",\n    \"circular-dependency-plugin\": \"^5.2.0\",\n    \"clean-webpack-plugin\": \"^0.1.19\",\n    \"copy-webpack-plugin\": \"^5.1.0\",\n    \"cross-var\": \"^1.1.0\",\n    \"css-loader\": \"^3.2.0\",\n    \"jest\": \"^25.2.7\",\n    \"jest-junit\": \"^9.0.0\",\n    \"jest-webextension-mock\": \"^3.5.0\",\n    \"node-sass\": \"^7.0.0\",\n    \"null-loader\": \"^3.0.0\",\n    \"prettier\": \"^1.19.1\",\n    \"style-loader\": \"^1.0.0\",\n    \"ts-jest\": \"^25.5.1\",\n    \"ts-loader\": \"^6.2.1\",\n    \"tslint\": \"^5.12.1\",\n    \"tslint-config-prettier\": \"^1.15.0\",\n    \"tslint-react\": \"^3.6.0\",\n    \"typescript\": \"^3.8.3\",\n    \"webpack\": \"^4.41.2\",\n    \"webpack-cli\": \"^3.3.10\",\n    \"webpack-dev-server\": \"^3.11.3\",\n    \"webpack-merge\": \"^5.0.9\",\n    \"webpack-node-externals\": \"^1.7.2\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/component-api\",\n  \"version\": \"0.2.0\",\n  \"description\": \"Dashbuilder API to create external visual components.\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --verbose --silent --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/ComponentApi.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n * */\n\nimport { DataSet } from \"./dataset\";\nimport { BrowserComponentBus } from \"./controller/BrowserComponentBus\";\nimport { DashbuilderComponentController } from \"./controller/DashbuilderComponentController\";\nimport { DashbuilderComponentDispatcher } from \"./controller/DashbuilderComponentDispatcher\";\nimport { ComponentBus, ComponentController } from \"./controller\";\n\nexport class ComponentApi {\n  private bus: ComponentBus;\n  private controller: DashbuilderComponentController;\n  private listener: DashbuilderComponentDispatcher;\n  constructor() {\n    this.bus = new BrowserComponentBus();\n    this.controller = new DashbuilderComponentController(this.bus);\n    this.listener = new DashbuilderComponentDispatcher(this.bus, this.controller);\n    this.listener.init();\n  }\n  public getComponentController(\n    onInit?: (params: Map<string, any>) => void,\n    onDataSet?: (dataSet: DataSet, params?: Map<string, any>) => void\n  ): ComponentController {\n    if (onInit) {\n      this.controller.setOnInit(onInit);\n    }\n    if (onDataSet) {\n      this.controller.setOnDataSet(onDataSet);\n    }\n    return this.controller;\n  }\n\n  public restart() {\n    this.destroy();\n    this.listener.init();\n  }\n\n  public destroy() {\n    this.listener.stop();\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/__tests__/api.test.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ComponentBus } from \"../controller\";\nimport { ComponentApi } from \"../ComponentApi\";\nimport { ColumnType, DataSet, FilterRequest } from \"../dataset\";\nimport { FunctionCallRequest, FunctionResponse, FunctionResultType } from \"../function\";\nimport { ComponentMessage, MessageType } from \"../message\";\nimport { MessageProperty } from \"../message/MessageProperty\";\nimport { DashbuilderComponentController } from \"../controller/DashbuilderComponentController\";\n\nconst controller = new ComponentApi().getComponentController() as DashbuilderComponentController;\n\nconst sampleDataSet: DataSet = {\n  columns: [\n    {\n      name: \"Name\",\n      type: ColumnType.LABEL,\n      settings: {\n        columnId: \"name\",\n        columnName: \"Name\",\n        valueExpression: \"value\",\n        emptyTemplate: \"---\"\n      }\n    },\n    {\n      name: \"Age\",\n      type: ColumnType.NUMBER,\n      settings: {\n        columnId: \"age\",\n        columnName: \"age\",\n        valueExpression: \"value\",\n        emptyTemplate: \"---\",\n        valuePattern: \"#,##0.00\"\n      }\n    }\n  ],\n  data: [[\"John\", \"32\"]]\n};\n\ndescribe(\"[Controller API] Callbacks\", () => {\n  it(\"INIT Callback without params\", async () => {\n    const handleInit = jest.fn();\n    controller.setOnInit(handleInit);\n    await postInitMessage(new Map());\n    expect(handleInit).toHaveBeenCalledTimes(1);\n  });\n\n  it(\"INIT Callback with params\", async () => {\n    const handleInit = jest.fn();\n    const params = new Map<string, any>();\n    params.set(\"hello\", \"world\");\n    controller.setOnInit(handleInit);\n    await postInitMessage(params);\n    expect(handleInit).toHaveBeenCalledWith(params);\n  });\n\n  it(\"DataSet Callback\", async () => {\n    const handleDataSet = jest.fn();\n    controller.setOnDataSet(handleDataSet);\n    await postDataSetMessage();\n    expect(handleDataSet).toHaveBeenCalledWith(sampleDataSet, expect.any(Map));\n  });\n});\n\ndescribe(\"[Controller API] Sending Requests\", () => {\n  const bus = mockBus();\n  const componentId = \"42\";\n  beforeAll(() => {\n    const params = new Map<string, any>();\n    params.set(MessageProperty.COMPONENT_ID, componentId);\n    controller.init(params);\n    controller.setComponentBus(bus);\n  });\n\n  it(\"Configuration Issues\", async () => {\n    const configIssue = \"some configuration issue.\";\n    const params = new Map<string, any>();\n    const expected: ComponentMessage = {\n      type: MessageType.FIX_CONFIGURATION,\n      properties: params\n    };\n    params.set(MessageProperty.CONFIGURATION_ISSUE, configIssue);\n\n    controller.requireConfigurationFix(configIssue);\n    await delay(0);\n\n    expect(bus.send).toBeCalledWith(componentId, expected);\n  });\n\n  it(\"Configuration Fixed\", async () => {\n    const message: ComponentMessage = {\n      type: MessageType.CONFIGURATION_OK,\n      properties: new Map()\n    };\n    controller.configurationOk();\n    await delay(0);\n\n    expect(bus.send).toBeCalledWith(componentId, message);\n  });\n\n  it(\"Filter\", async () => {\n    const filterRequest: FilterRequest = {\n      column: 1,\n      reset: false,\n      row: 1\n    };\n    const props = new Map<string, any>();\n    props.set(MessageProperty.FILTER, filterRequest);\n    const message: ComponentMessage = {\n      type: MessageType.FILTER,\n      properties: props\n    };\n    controller.filter(filterRequest);\n    expect(bus.send).toBeCalledWith(componentId, message);\n  });\n});\n\ndescribe(\"[Controller API] Function Calls\", () => {\n  it(\"Function Success\", async () => {\n    const functionCall = buildFunctionCallRequest();\n\n    const callPromise = controller.callFunction(functionCall);\n    await delay(0);\n\n    const result = \"SUCCESS RESULT\";\n    const response = buildFunctionResponse(functionCall, result, FunctionResultType.SUCCESS);\n\n    window.postMessage(response, window.location.origin);\n    return expect(callPromise).resolves.toBe(result);\n  });\n\n  it(\"Function Success\", async () => {\n    const functionCall = buildFunctionCallRequest();\n\n    const callPromise = controller.callFunction(functionCall);\n    await delay(0);\n\n    const result = \"SUCCESS RESULT\";\n    const response = buildFunctionResponse(functionCall, result, FunctionResultType.SUCCESS);\n\n    window.postMessage(response, window.location.origin);\n    return expect(callPromise).resolves.toBe(result);\n  });\n\n  it(\"Function Not Found\", async () => {\n    const functionCall = buildFunctionCallRequest();\n\n    const callPromise = controller.callFunction(functionCall);\n    await delay(0);\n\n    const message = \"NOT FOUND RESULT\";\n    const response = buildFunctionResponse(functionCall, \"\", FunctionResultType.NOT_FOUND, message);\n\n    window.postMessage(response, window.location.origin);\n    return expect(callPromise).rejects.toBe(message);\n  });\n\n  it(\"Function Execution Error\", async () => {\n    const functionCall = buildFunctionCallRequest();\n    const callPromise = controller.callFunction(functionCall);\n    await delay(0);\n\n    const message = \"ERROR RESULT\";\n    const response = buildFunctionResponse(functionCall, \"\", FunctionResultType.ERROR, message);\n\n    window.postMessage(response, window.location.origin);\n    return expect(callPromise).rejects.toBe(message);\n  });\n});\n\nfunction buildFunctionCallRequest(): FunctionCallRequest {\n  const functionParams = new Map();\n  functionParams.set(\"test\", \"test\");\n  return {\n    functionName: \"test function name\",\n    parameters: functionParams\n  };\n}\n\nconst delay = (ms: number) => {\n  return new Promise(res => setTimeout(res, ms));\n};\n\nasync function postDataSetMessage() {\n  const params = new Map<string, any>();\n  params.set(\"dataSet\", sampleDataSet);\n  const datasetMsg: ComponentMessage = {\n    type: MessageType.DATASET,\n    properties: params\n  };\n  await postMessage(datasetMsg);\n}\n\nasync function postInitMessage(params: Map<string, any>) {\n  const init: ComponentMessage = {\n    type: MessageType.INIT,\n    properties: params\n  };\n  await postMessage(init);\n}\n\nasync function postMessage(message: ComponentMessage) {\n  window.postMessage(message, window.location.origin);\n  await delay(0);\n}\n\nfunction mockBus(): ComponentBus {\n  return {\n    destroy: jest.fn(),\n    start: jest.fn(),\n    send: jest.fn(),\n    setListener: jest.fn()\n  };\n}\n\nfunction buildFunctionResponse(\n  _request: FunctionCallRequest,\n  _result: string,\n  _type: FunctionResultType,\n  _message?: string\n) {\n  // sends the response here\n  const functionResponse: FunctionResponse = {\n    message: _message || \"success\",\n    resultType: _type,\n    result: _result,\n    request: _request\n  };\n  const params = new Map<string, any>();\n  const functionResponseMessage: ComponentMessage = {\n    type: MessageType.FUNCTION_RESPONSE,\n    properties: params\n  };\n  params.set(MessageProperty.FUNCTION_RESPONSE, functionResponse);\n\n  return functionResponseMessage;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/BrowserComponentBus.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ComponentMessage, MessageProperty } from \"../message\";\nimport { ComponentBus } from \"./ComponentBus\";\n\nexport class BrowserComponentBus implements ComponentBus {\n\n  private listener: (message: ComponentMessage) => void;\n\n  private readonly messageListener = (e: MessageEvent) => {\n    this.listener(e.data as ComponentMessage);\n  };\n\n  public start() {\n    window.addEventListener(\"message\", this.messageListener, false);\n  }\n\n  public send(componentId: string, message: ComponentMessage): void {\n    console.debug(\"[BrowserComponentBus] Sending Message\");\n    console.debug(message);\n    message.properties.set(MessageProperty.COMPONENT_ID, componentId);\n    window.parent.postMessage(message, window.location.href);\n  }\n\n  public setListener(onMessage: (message: ComponentMessage) => void): void {\n    this.listener = onMessage;\n  }\n\n  public destroy(): void {\n    window.removeEventListener(\"message\", this.messageListener, false);\n  }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/ComponentBus.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentMessage } from \"../message\";\n\nexport interface ComponentBus {\n  start(): void;\n  send(componentId: string, message: ComponentMessage): void;\n  setListener(onMessage: (message: ComponentMessage) => void): void;\n  destroy(): void;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/ComponentController.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataSet, FilterRequest } from \"../dataset\";\nimport { FunctionCallRequest } from \"../function\";\n\n/*\n * Controls component lifecycle and allows component communicate with Dashbuilder\n */\nexport interface ComponentController {\n  /*\n   * Set on init callback\n   */\n  setOnInit(onInit: (params: Map<string, any>) => void): void;\n\n  /*\n   * Sets the method to be called when dashbuilder sends a dataset update after a filter or when using pooling.\n   * Params is optional and is basically the same params sent after onInit\n   */\n  setOnDataSet(onDataSet: (dataSet: DataSet, params?: Map<string, any>) => void): void;\n\n  /*\n   * Components must send ready their finish their setup (unless it is sent automatically by the controller implementation)\n   */\n  ready(): void;\n\n  /*\n   * Components can call this if the dataset or any other configuration is wrong. The message can detail what is wrong.\n   */\n  requireConfigurationFix(message: string): void;\n\n  /*\n   * Components must call this after the configuration is fixed by users.\n   */\n  configurationOk(): void;\n\n  /*\n   * Used to send a filter request to Dashbuilder\n   */\n  filter(filterRequest: FilterRequest): void;\n\n  /*\n   * Calls a function and returns a Promise that will be fulfilled when the response is received from DB.\n   */\n  callFunction(functionCallRequest: FunctionCallRequest): Promise<any>;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/DashbuilderComponentController.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataSet, FilterRequest } from \"../dataset\";\nimport { FunctionCallRequest, FunctionResponse, FunctionResultType } from \"../function\";\nimport { MessageType } from \"../message\";\nimport { MessageProperty } from \"../message/MessageProperty\";\nimport { ComponentBus } from \"./ComponentBus\";\nimport { ComponentController } from \"./ComponentController\";\n\ninterface FunctionCallbacks {\n  onSucess: (result: any) => void;\n\n  onError: (message: string) => void;\n}\n\nexport class DashbuilderComponentController implements ComponentController {\n  private callbacks: Map<string, FunctionCallbacks> = new Map();\n\n  constructor(private bus: ComponentBus, private componentId?: string) {\n    // no op\n  }\n\n  public onInit: (params: Map<string, any>) => void = p => {\n    console.debug(\"Received INIT.\");\n    console.debug(p);\n  };\n\n  public onDataSet: (dataSet: DataSet, params?: Map<string, any>) => void = ds => {\n    console.debug(\"Received DataSet.\");\n    console.debug(ds);\n  };\n\n  public init(params: Map<string, any>) {\n    this.componentId = params.get(MessageProperty.COMPONENT_ID);\n    this.onInit(params);\n  }\n\n  public setOnDataSet(onDataSet: (dataSet: DataSet, params?: Map<string, any>) => void) {\n    this.onDataSet = onDataSet;\n  }\n\n  public setOnInit(onInit: (params: Map<string, any>) => void) {\n    this.onInit = onInit;\n  }\n\n  public ready(): void {\n    // do nothing because it is not support ATM\n  }\n\n  public requireConfigurationFix(message: string): void {\n    const props = new Map<MessageProperty, any>();\n    props.set(MessageProperty.CONFIGURATION_ISSUE, message);\n    this.bus.send(this.componentId!, {\n      type: MessageType.FIX_CONFIGURATION,\n      properties: props\n    });\n  }\n  public configurationOk(): void {\n    this.bus.send(this.componentId!, {\n      type: MessageType.CONFIGURATION_OK,\n      properties: new Map()\n    });\n  }\n\n  public filter(filterRequest: FilterRequest): void {\n    const props = new Map<MessageProperty, any>();\n    props.set(MessageProperty.FILTER, filterRequest);\n    this.bus.send(this.componentId!, {\n      type: MessageType.FILTER,\n      properties: props\n    });\n  }\n  public callFunction(functionCallRequest: FunctionCallRequest): Promise<any> {\n    const props = new Map<MessageProperty, any>();\n    props.set(MessageProperty.FUNCTION_CALL, functionCallRequest);\n    this.bus.send(this.componentId!, {\n      type: MessageType.FUNCTION_CALL,\n      properties: props\n    });\n    return new Promise((resolve, error) => {\n      const key = this.buildFunctionKey(functionCallRequest);\n      this.callbacks.set(key, {\n        onSucess: resolve,\n        onError: error\n      });\n    });\n  }\n\n  public receiveFunctionResponse(functionResponse: FunctionResponse): void {\n    const key = this.buildFunctionKey(functionResponse.request);\n    const functionCallbacks = this.callbacks.get(key);\n    if (functionCallbacks) {\n      if (\n        functionResponse.resultType === FunctionResultType.ERROR ||\n        functionResponse.resultType === FunctionResultType.NOT_FOUND\n      ) {\n        functionCallbacks.onError(functionResponse.message);\n      } else {\n        functionCallbacks.onSucess(functionResponse.result);\n      }\n    } else {\n      console.warn(\"Callbacks for function call not found. Key: \" + key);\n    }\n    this.callbacks.delete(key);\n  }\n\n  public setComponentBus(bus: ComponentBus) {\n    this.bus = bus;\n  }\n\n  private buildFunctionKey(functionRequest: FunctionCallRequest): string {\n    return functionRequest.functionName;\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/DashbuilderComponentDispatcher.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { DataSet } from \"../dataset\";\nimport { FunctionResponse } from \"../function\";\nimport { ComponentMessage, MessageType } from \"../message\";\nimport { MessageProperty } from \"../message/MessageProperty\";\nimport { ComponentBus } from \"./ComponentBus\";\n\nimport { DashbuilderComponentController } from \"./DashbuilderComponentController\";\nimport { InternalComponentDispatcher } from \"./InternalComponentListener\";\n\nexport class DashbuilderComponentDispatcher implements InternalComponentDispatcher {\n  private componentId: string;\n\n  constructor(private readonly bus: ComponentBus, public readonly componentController: DashbuilderComponentController) {\n    // no op\n  }\n\n  private readonly messageDispatcher = (message: ComponentMessage) => {\n    if (message.type === MessageType.INIT) {\n      this.componentId = message.properties.get(MessageProperty.COMPONENT_ID);\n      this.componentController.init(message.properties);\n    }\n\n    if (message.type === MessageType.DATASET) {\n      const dataSet = message.properties.get(MessageProperty.DATASET) as DataSet;\n      this.componentController.onDataSet(dataSet, message.properties);\n    }\n\n    if (message.type === MessageType.FUNCTION_RESPONSE) {\n      const functionResponse = message.properties.get(MessageProperty.FUNCTION_RESPONSE) as FunctionResponse;\n      this.componentController.receiveFunctionResponse(functionResponse);\n    }\n  };\n\n  public isAutoReady(): boolean {\n    // READY not implemented at the moment\n    return true;\n  }\n\n  public init(): void {\n    this.bus.setListener(this.messageDispatcher);\n    this.bus.start();\n  }\n\n  public sendMessage(componentMessage: ComponentMessage): void {\n    componentMessage.properties.set(MessageProperty.COMPONENT_ID, this.componentId);\n    window.parent.postMessage(componentMessage, window.location.href);\n  }\n\n  public stop(): void {\n    this.bus.destroy();\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/InternalComponentListener.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentMessage } from \"../message\";\nimport { DashbuilderComponentController } from \"./DashbuilderComponentController\";\n\n/*\n * Listener with methods that should not be exposed to components\n */\nexport interface InternalComponentDispatcher {\n  /*\n   * The component controller responsible to be the component's entry point to interact with Dashbuilder\n   */\n  componentController: DashbuilderComponentController | undefined;\n\n  /**\n   * Starts waiting for messages to dispatch\n   */\n  init(): void;\n\n  /*\n   * Sends a message to Dashbuilder\n   */\n  sendMessage(componentMessage: ComponentMessage): void;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/controller/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from \"./ComponentController\";\nexport * from \"./ComponentBus\""
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/Column.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { ColumnType } from \"./ColumnType\";\nimport { ColumnSettings } from \"./ColumnSettings\";\n\nexport interface Column {\n  name: string;\n  type: ColumnType;\n  settings: ColumnSettings;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/ColumnSettings.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface ColumnSettings {\n  columnId: string;\n  columnName: string;\n  valueExpression: string;\n  emptyTemplate: string;\n  valuePattern?: string;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/ColumnType.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum ColumnType {\n  TEXT = \"TEXT\",\n  LABEL = \"LABEL\",\n  DATE = \"DATE\",\n  NUMBER = \"NUMBER\"\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/DataSet.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Column } from \"./Column\";\n\nexport interface DataSet {\n  columns: Column[];\n  data: string[][];\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/FilterRequest.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport interface FilterRequest {\n  reset: boolean;\n  row: number;\n  column: number;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/dataset/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from \"./ColumnSettings\";\nexport * from \"./ColumnType\";\nexport * from \"./Column\";\nexport * from \"./DataSet\";\nexport * from \"./FilterRequest\";\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/function/FunctionCallRequest.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface FunctionCallRequest {\n  functionName: string;\n\n  parameters: Map<string, any>;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/function/FunctionResponse.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FunctionCallRequest } from \"./FunctionCallRequest\";\nimport { FunctionResultType } from \"./FunctionResultType\";\n\nexport interface FunctionResponse {\n  request: FunctionCallRequest;\n\n  resultType: FunctionResultType;\n\n  message: string;\n\n  result: any;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/function/FunctionResultType.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum FunctionResultType {\n  SUCCESS = \"SUCCESS\",\n\n  ERROR = \"ERROR\",\n\n  NOT_FOUND = \"NOT_FOUND\"\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/function/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from \"./FunctionCallRequest\";\nexport * from \"./FunctionResponse\";\nexport * from \"./FunctionResultType\";\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./message\";\nexport * from \"./dataset\";\nexport * from \"./function\";\nexport * from \"./controller\";\nexport * from \"./ComponentApi\";"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/message/ComponentMessage.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { MessageProperty } from \"./MessageProperty\";\nimport { MessageType } from \"./MessageType\";\n\nexport interface ComponentMessage {\n  type: MessageType;\n  properties: Map<MessageProperty | string, any>;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/message/MessageProperty.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * Component Message Properties definition.\n */\nexport enum MessageProperty {\n  COMPONENT_ID = \"component_id\",\n  DATASET = \"dataSet\",\n  CONFIGURATION_ISSUE = \"configurationIssue\",\n  FILTER = \"filter\",\n  FUNCTION_CALL = \"functionCallRequest\",\n  FUNCTION_RESPONSE = \"functionResponse\"\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/message/MessageType.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport enum MessageType {\n  INIT = \"INIT\",\n  DATASET = \"DATASET\",\n  FUNCTION_RESPONSE = \"FUNCTION_RESPONSE\",\n  FUNCTION_CALL = \"FUNCTION_CALL\",\n  FILTER = \"FILTER\",\n  FIX_CONFIGURATION = \"FIX_CONFIGURATION\",\n  CONFIGURATION_OK = \"CONFIGURATION_OK\",\n  READY = \"READY\"\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/src/message/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport * from \"./MessageType\";\nexport * from \"./MessageProperty\"\nexport * from \"./ComponentMessage\";"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"dist\"\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-api/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  return merge(common, {\n    entry: {\n      index: \"./src/index.ts\"\n    },\n    output: {\n      libraryTarget: \"commonjs2\"\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/component-dev\",\n  \"version\": \"0.2.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --verbose --silent --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"0.1.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/src/ComponentDevPane.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\n\nexport interface DevPaneProps {\n  sendInit: () => void;\n  sendDataSet: () => void;\n}\nexport function ComponentDevPane(props: DevPaneProps) {\n  return (\n    <div style={{ position: \"absolute\", zIndex: 10, bottom: 0, width: \"100%\", height: \"30px\"}}>\n      <button onClick={props.sendInit}>INIT</button>\n      <button onClick={props.sendDataSet}>DATASET</button>\n    </div>\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ComponentDevPane } from \"./ComponentDevPane\";\nimport {\n  DataSet,\n  MessageProperty,\n  ComponentMessage,\n  MessageType,\n  FunctionResponse,\n  FunctionCallRequest,\n  FunctionResultType\n} from \"@dashbuilder-js/component-api\";\n\nconst DEV_FILE = \"/manifest.dev.json\";\nconst COMP_ID = 42;\nlet initMessage: ComponentMessage;\nlet dataSetMessage: ComponentMessage;\nlet functions: FunctionDef[];\n\ninterface Prop {\n  key: string;\n  value: string;\n}\n\ninterface FunctionDef {\n  name: string;\n  response: string;\n  params: Prop[];\n}\n\ninterface ComponentDevConfiguration {\n  init: Prop[];\n  functions: FunctionDef[];\n  dataSet: DataSet;\n}\n\nfunction handleDevConf(text: string) {\n  const devConf = JSON.parse(text) as ComponentDevConfiguration;\n  const devPane = document.createElement(\"div\");\n  document.body.prepend(devPane);\n\n  ReactDOM.render(\n    <ComponentDevPane sendDataSet={() => sendMessage(dataSetMessage)} sendInit={() => sendMessage(initMessage)} />,\n    devPane\n  );\n\n  window.addEventListener(\"message\", e => {\n    const message = e.data as ComponentMessage;\n    if (message.type === MessageType.FUNCTION_CALL) {\n      respondFunctionCall(message);\n    }\n  });\n\n  functions = devConf.functions;\n  createInit(devConf);\n  createDataSet(devConf);\n\n  setTimeout(() => {\n    sendMessage(initMessage);\n    setTimeout(() => {\n      sendMessage(dataSetMessage);\n    }, 100);\n  }, 100);\n}\n\nfunction respondFunctionCall(message: ComponentMessage) {\n  const functionCall = message.properties.get(MessageProperty.FUNCTION_CALL) as FunctionCallRequest;\n  const functionName = functionCall.functionName;\n\n  const confResponse = functions\n    ? functions.filter(f => f.name === functionName).filter(f => paramsMatch(functionCall.parameters, f.params))[0]\n    : undefined;\n  console.debug(\"[COMPONENT DEV] Function response: \");\n  console.debug(confResponse);\n  let functionResponse: FunctionResponse;\n  if (confResponse === undefined) {\n    functionResponse = {\n      message: \"Function not found\",\n      request: functionCall,\n      resultType: FunctionResultType.NOT_FOUND,\n      result: undefined\n    };\n  } else if (confResponse.response === \"ERROR\") {\n    functionResponse = {\n      message: \"Function Error!\",\n      request: functionCall,\n      resultType: FunctionResultType.ERROR,\n      result: undefined\n    };\n  } else {\n    functionResponse = {\n      message: \"Success!\",\n      request: functionCall,\n      resultType: FunctionResultType.SUCCESS,\n      result: confResponse.response\n    };\n  }\n\n  const props = new Map<string, any>();\n  props.set(MessageProperty.FUNCTION_RESPONSE, functionResponse);\n  sendMessage({\n    type: MessageType.FUNCTION_RESPONSE,\n    properties: props\n  });\n}\n\nfunction createInit(devConf: ComponentDevConfiguration) {\n  const props = new Map<string, any>();\n  devConf.init.forEach(prop => props.set(prop.key, prop.value));\n  initMessage = {\n    type: MessageType.INIT,\n    properties: props\n  };\n}\n\nfunction createDataSet(devConf: ComponentDevConfiguration) {\n  const props = new Map<string, any>();\n  devConf.init.forEach(prop => props.set(prop.key, prop.value));\n  props.set(MessageProperty.DATASET, devConf.dataSet);\n  dataSetMessage = {\n    type: MessageType.DATASET,\n    properties: props\n  };\n}\n\nfunction paramsMatch(requestParams: Map<string, any>, devParams: Prop[]): boolean {\n  const devParamsEmpty = !devParams || devParams.length === 0;\n  const requestParamsEmpty = !requestParams || requestParams.size === 0;\n  const allMatch =\n    devParams && requestParams ? !devParamsEmpty && devParams.every(p => requestParams.get(p.key) === p.value) : false;\n  return (devParamsEmpty && requestParamsEmpty) || allMatch;\n}\n\nfunction sendMessage(message: ComponentMessage) {\n  console.debug(\"[COMPONENT DEV] Sending Message\");\n  console.debug(message);\n  message.properties.set(MessageProperty.COMPONENT_ID, COMP_ID);\n  window.postMessage(message, window.location.href);\n}\n\nexport class ComponentDev {\n  public start() {\n    fetch(DEV_FILE)\n      .then(r => r.text())\n      .then(text => handleDevConf(text))\n      .catch(e => console.log(\"Not able to load manifest DEV file: \" + e));\n  }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"dist\"\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/component-dev/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  return merge(common, {\n    entry: {\n      index: \"./src/index.tsx\"\n    },\n    output: {\n      libraryTarget: \"commonjs2\"\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/heatmap-base\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"debug\": \"node --inspect-brk ../../node_modules/jest/bin/jest.js -i\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"dependencies\": {\n    \"@types/heatmap.js\": \"^2.0.36\",\n    \"heatmap.js\": \"2.0.5\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/src/SvgHeatmap.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { useCallback, useEffect, createRef, useState } from \"react\";\nimport * as heatmap from \"heatmap.js\";\n\nexport interface SvgNodeValue {\n  nodeId: string;\n  value: number;\n}\n\ninterface NodeInfo {\n  x: number;\n  y: number;\n  size: number;\n}\n\ninterface HeatData {\n  x: number;\n  y: number;\n  value: number;\n  radius?: number;\n}\n\nconst reduce = (data: HeatData[], reducer: (v1: number, v2: number) => number) =>\n  data.length > 0 ? data.map(d => d.value).reduce((d1, d2) => reducer(d1, d2)) : 0;\n\nfunction createHeatmap(parent: HTMLElement, heatData: HeatData[]) {\n  return heatmap\n    .create({\n      container: parent\n    })\n    .setData({\n      max: reduce(heatData, Math.max),\n      min: reduce(heatData, Math.min),\n      data: heatData\n    });\n}\n\nconst getNodeInfo = (el: HTMLElement): NodeInfo => {\n  const bounds = el.getBoundingClientRect();\n  const radius = Math.sqrt((bounds.width * bounds.height) / 4);\n  return {\n    x: (bounds.left + bounds.right) / 2,\n    y: (bounds.top + bounds.bottom) / 2,\n    size: radius\n  };\n};\n\nexport interface SvgHeatmapProps {\n  svgNodesValues: SvgNodeValue[];\n  svgContent: string;\n  width?: string;\n  height?: string;\n}\n\nexport function SvgHeatmap(props: SvgHeatmapProps) {\n  const parentRef = createRef<HTMLDivElement>();\n  const [svgHeatmap, setSvgHeatmap] = useState<heatmap.Heatmap<any, any, any>>();\n  const [repaint, setRepaint] = useState(false);\n\n  useEffect(() => {\n    if (props.svgContent) {\n      const heatmapContainer = parentRef.current!;\n      heatmapContainer.innerHTML = props.svgContent;\n      const svg = heatmapContainer.querySelector(\"svg\")!;\n      svg.style.width = \"100%\";\n      svg.style.height = \"auto\";\n      setSvgHeatmap(createHeatmap(heatmapContainer, []));\n    }\n  }, [props.svgContent]);\n\n  useEffect(() => {\n    if (svgHeatmap && props.svgNodesValues && props.svgNodesValues.length > 0) {\n      const values = props.svgNodesValues\n        .filter(n => document.getElementById(n.nodeId))\n        .map(nodeValue => {\n          const node = document.getElementById(nodeValue.nodeId);\n          const nodeInfo = getNodeInfo(node!);\n          return {\n            x: Math.ceil(nodeInfo.x),\n            y: Math.ceil(nodeInfo.y),\n            radius: nodeInfo.size,\n            value: nodeValue.value\n          };\n        });\n\n      if (values.length > 0) {\n        svgHeatmap.setData({\n          min: values.map(d => d.value).reduce((d1, d2) => Math.min(d1, d2)),\n          max: values.map(d => d.value).reduce((d1, d2) => Math.max(d1, d2)),\n          data: values\n        });\n      }\n      svgHeatmap.repaint();\n    }\n  }, [svgHeatmap, props.svgNodesValues, repaint]);\n\n  const onResize = useCallback(() => setRepaint(previous => !previous), [repaint]);\n\n  useEffect(() => {\n    window.addEventListener(\"resize\", onResize, false);\n    return () => window.removeEventListener(\"resize\", onResize, false);\n  }, [repaint]);\n\n  return <div style={{ width: props.width || \"100%\", height: props.height || \"100%\" }} ref={parentRef} />;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/src/__tests__/svgHeatmap.test.disabled",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport * as React from \"react\";\nimport { render } from \"@testing-library/react\";\nimport { SVGHeatmap } from \"../SVGHeatmap\";\n\nconst svg = `\n<svg height=\"5\" width=\"5\">\n  <circle id=\"c\"  cx=\"2\" cy=\"2\" r=\"2\" fill=\"gray\" />\n</svg>\n`;\n\ntest(\"svg heatmap component with node values\", () => {\n  const heatmapResult = render(\n    <SVGHeatmap svgContent={svg} svgNodesValues={[{ nodeId: \"c\", value: 1 }]} width=\"5px\" height=\"5px\" />\n  );\n  const canvas = heatmapResult.container.getElementsByTagName(\"canvas\")[0] as HTMLCanvasElement;\n  expect(canvas).toBeTruthy();\n  expect(canvas.toDataURL(\"image/jpg\")).toBe(\n    \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYAAABw4pVUAAAABmJLR0QA/wD/AP+gvaeTAAAAX0lEQVR4nO3RsQ3AIBAEwX9cgvsvFUHMOzcgzYQXnbQ5nhhRZI+sG/9ouw+wEuQwghzmG+SNvuEHAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwG0mpkMEGmNamG8AAAAASUVORK5CYII=\"\n  );\n});\n\ntest(\"svg heatmap component without values\", () => {\n  const heatmapResult = render(<SVGHeatmap svgContent={svg} svgNodesValues={[]} width=\"5px\" height=\"5px\" />);\n  const canvas = heatmapResult.container.getElementsByTagName(\"canvas\")[0] as HTMLCanvasElement;\n  expect(canvas).toBeTruthy();\n\n  expect(canvas.toDataURL(\"image/jpg\")).toBe(\n    \"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAABmJLR0QA/wD/AP+gvaeTAAAADElEQVQImWNgoBMAAABpAAFEI8ARAAAAAElFTkSuQmCC\"\n  );\n});\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from \"./SvgHeatmap\";"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"dist\"\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-base/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst nodeExternals = require(\"webpack-node-externals\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  return merge(common, {\n    entry: {\n      index: \"./src/index.tsx\"\n    },\n    output: {\n      libraryTarget: \"commonjs2\"\n    },\n    externals: [nodeExternals({ modulesDir: \"../../node_modules\" })]\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/heatmap-component\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"0.2.0\",\n    \"@dashbuilder-js/heatmap-base\": \"0.1.0\"\n  },\n  \"devDependencies\": {\n    \"@dashbuilder-js/component-dev\": \"0.2.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/src/SVGHeatmapComponent.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { useEffect, useState } from \"react\";\n\nimport { SvgHeatmap, SvgNodeValue } from \"@dashbuilder-js/heatmap-base\";\nimport { ColumnType, DataSet } from \"@dashbuilder-js/component-api\";\nimport { ComponentController } from \"@dashbuilder-js/component-api/dist/controller/ComponentController\";\n\nconst SVG_CONTENT_PARAM = \"svgContent\";\nconst SVG_URL_PARAM = \"svgUrl\";\n\nconst NOT_ENOUGH_COLUMNS_MSG = \"Heatmap expects 2 columns: Node ID (TEXT or Label) and value (NUMBER)\";\nconst INVALID_COLUMNS_TYPE_MSG = \"Wrong columns type. First column should be TEXT or LABEL and second column NUMBER.\";\nconst MISSING_PARAM_MSG = \"You must provide either a SVG URL or the SVG Content.\";\n\nconst notEmpty = (param?: string) => param !== undefined && param.trim() !== \"\";\n\nconst validateDataSet = (ds: DataSet): string | undefined => {\n  if (ds.columns.length < 2) {\n    return NOT_ENOUGH_COLUMNS_MSG;\n  }\n  if (\n    (ds.columns[0].type !== ColumnType.TEXT && ds.columns[0].type !== ColumnType.LABEL) ||\n    ds.columns[1].type !== ColumnType.NUMBER\n  ) {\n    return INVALID_COLUMNS_TYPE_MSG;\n  }\n};\n\nconst validateParams = (params: Map<string, string>) => {\n  const svgContent = params.get(SVG_CONTENT_PARAM);\n  const svgUrl = params.get(SVG_URL_PARAM) as string;\n  if (!(svgContent || svgUrl)) {\n    return MISSING_PARAM_MSG;\n  }\n};\nconst extractNodeInfo = (dataset: string[][]): SvgNodeValue[] =>\n  dataset.map(row => ({\n    nodeId: row[0],\n    value: +row[1]\n  }));\n\ninterface AppState {\n  svgContent?: string;\n  data: SvgNodeValue[];\n  errorMessage?: string;\n}\n\ninterface Props {\n  controller: ComponentController;\n}\n\nexport function SVGHeatmapComponent(props: Props) {\n  const [appState, setAppState] = useState<AppState>({ data: [] });\n\n  const onDataset = (ds: DataSet, params: Map<string, any>) => {\n    const validationMessage = validateDataSet(ds) || validateParams(params);\n    if (validationMessage) {\n      props.controller.requireConfigurationFix(validationMessage);\n      setAppState(previousState => ({\n        ...previousState,\n        errorMessage: validationMessage\n      }));\n      return;\n    }\n    props.controller.configurationOk();\n\n    const userSvgContent = params.get(SVG_CONTENT_PARAM);\n    const svgUrl = params.get(SVG_URL_PARAM);\n\n    if (notEmpty(userSvgContent)) {\n      setAppState(previousState => ({\n        ...previousState,\n        data: extractNodeInfo(ds.data),\n        svgContent: userSvgContent\n      }));\n    } else {\n      fetch(svgUrl)\n        .then(r => r.text())\n        .then(urlSvgContent =>\n          setAppState(previousState => ({\n            ...previousState,\n            data: extractNodeInfo(ds.data),\n            svgContent: urlSvgContent\n          }))\n        )\n        .catch(e =>\n          setAppState(previousState => ({\n            ...previousState,\n            data: [],\n            svgContent: undefined,\n            errorMessage: e\n          }))\n        );\n    }\n  };\n\n  useEffect(() => props.controller.setOnDataSet(onDataset), [appState.data]);\n\n  return appState?.errorMessage ? (\n    <em>{appState.errorMessage}</em>\n  ) : (\n    <SvgHeatmap svgContent={appState.svgContent!} svgNodesValues={appState.data} />\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/src/index-dev.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport { ComponentDev } from \"@dashbuilder-js/component-dev\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\nimport { SVGHeatmapComponent } from \"./SVGHeatmapComponent\";\n\nconst componentApi = new ComponentApi();\nReactDOM.render(\n  <SVGHeatmapComponent controller={componentApi.getComponentController()} />,\n  document.getElementById(\"app\")!\n);\n\nnew ComponentDev().start();\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\n\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\nimport { SVGHeatmapComponent } from \"./SVGHeatmapComponent\";\n\nconst api = new ComponentApi();\nReactDOM.render(<SVGHeatmapComponent controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/static/index.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <title>Heatmap Component</title>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  </head>\n  <body style=\"overflow: hidden; margin: 0px; border: 0px\">\n    <div id=\"app\" style=\"height: 100vh;\"></div>\n    <script src=\"index.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/static/manifest.dev.json",
    "content": "{\n  \"init\": [\n    {\n      \"key\": \"svgUrl\",\n      \"value\": \"/world.svg\"\n    }\n  ],\n  \"dataSet\": {\n    \"columns\": [\n      {\n        \"name\": \"nodeId\",\n        \"type\": \"TEXT\",\n        \"settings\": {\n          \"columnId\": \"nodeId\",\n          \"columnName\": \"Node ID\",\n          \"valueExpression\": \"value\",\n          \"emptyTemplate\": \"---\",\n          \"valuePattern\": \"#\"\n        }\n      },\n      {\n        \"name\": \"value\",\n        \"type\": \"NUMBER\",\n        \"settings\": {\n          \"columnId\": \"value\",\n          \"columnName\": \"Value\",\n          \"valueExpression\": \"value\",\n          \"emptyTemplate\": \"---\",\n          \"valuePattern\": \"#\"\n        }\n      }\n    ],\n    \"data\": [\n      [\"US\", \"1\"],\n      [\"BO\", \"1\"],\n      [\"BR\", \"1\"],\n      [\"CD\", \"1\"],\n      [\"MG\", \"1\"],\n      [\"MZ\", \"1\"],\n      [\"ZM\", \"1\"],\n\n      [\"GB\", \"1\"],\n      [\"AU\", \"1\"],\n      [\"CN\", \"1\"],\n      [\"CA\", \"0\"],\n      [\"RU\", \"2\"]\n    ]\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/static/manifest.json",
    "content": "{\n  \"name\": \"Heatmap\",\n  \"parameters\": [\n    {\n      \"name\": \"svgContent\",\n      \"label\": \"SVG Content\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\"\n    },\n    {\n      \"name\": \"svgUrl\",\n      \"type\": \"text\",\n      \"label\": \"SVG URL\",\n      \"defaultValue\": \"\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": false\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/heatmap-component/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CopyPlugin = require(\"copy-webpack-plugin\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  let entryPoint = \"./src/index.tsx\";\n  const copyResources = [\n    { from: \"./static/index.html\", to: \"./index.html\" },\n    { from: \"./static/manifest.json\", to: \"./manifest.json\" }\n  ];\n\n  if (process.env.WEBPACK_DEV_SERVER) {\n    entryPoint = \"./src/index-dev.tsx\";\n    copyResources.push({ from: \"./static/manifest.dev.json\", to: \"./manifest.dev.json\" });\n    copyResources.push({ from: \"./static/dev.svg\", to: \"./dev.svg\" });\n  }\n\n  return merge(common, {\n    entry: {\n      index: entryPoint\n    },\n    plugins: [new CopyPlugin(copyResources)],\n    devServer: {\n      historyApiFallback: false,\n      disableHostCheck: true,\n      watchContentBase: true,\n      contentBase: [path.join(__dirname, \"./dist\"), path.join(__dirname, \"./static\")],\n      compress: true,\n      port: 9001\n    }\n  });\n};"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/logo-component\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0 --env WEBPACK_DEV_SERVER=true\"\n  },\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"0.2.0\"\n  },\n  \"devDependencies\": {\n    \"@dashbuilder-js/component-dev\": \"0.2.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/src/Logo.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\n\nexport interface LogoProps {\n  src: string;\n  width?: string;\n  height?: string;\n}\n\nexport function Logo(props: LogoProps) {\n  return <img src={props.src} style={{ width: props.width, height: props.height}} />;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/src/LogoComponent.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ComponentController } from \"@dashbuilder-js/component-api\";\nimport * as React from \"react\";\nimport { useState, useEffect } from \"react\";\nimport { Logo, LogoProps } from \"./Logo\";\nconst SRC_PROP = \"src\";\nconst WIDTH_PROP = \"width\";\nconst HEIGHT_PROP = \"height\";\n\ninterface Props {\n  controller: ComponentController;\n}\nexport function LogoComponent(props: Props) {\n  const [logoProps, setLogoProps] = useState<LogoProps>({\n    src: \"\"\n  });\n\n  useEffect(() => {\n    props.controller.setOnInit(componentProps => {\n      setLogoProps({\n        src: (componentProps.get(SRC_PROP) as string) || \"\",\n        width: componentProps.get(WIDTH_PROP) as string,\n        height: componentProps.get(HEIGHT_PROP) as string\n      });\n    });\n  }, []);\n\n  return <Logo {...logoProps} />;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/src/index-dev.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { LogoComponent } from \"./LogoComponent\";\nimport { ComponentDev } from \"@dashbuilder-js/component-dev\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<LogoComponent controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n\nnew ComponentDev().start();\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { LogoComponent } from \"./LogoComponent\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<LogoComponent controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/static/index.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <title>Logo Component</title>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  </head>\n  <body style=\"overflow: hidden; margin: 0px; border: 0px\">\n    <div id=\"app\" style=\"height: 100vh;\"></div>\n    <script src=\"index.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/static/manifest.dev.json",
    "content": "{\n  \"init\": [\n    {\n      \"key\": \"src\",\n      \"value\": \"https://www.redhat.com/cms/managed-files/Logo-redhat-color-375.png\"\n    },\n    {\n      \"key\": \"width\",\n      \"value\": \"500px\"\n    }\n  ],\n  \"functions\": [\n    {\n      \"name\": \"ping\",\n      \"response\": \"pong\"\n    }\n  ],\n  \"dataSet\": {\n    \"columns\": [\n      {\n        \"name\": \"Country\",\n        \"type\": \"LABEL\",\n        \"settings\": {\n          \"columnId\": \"Country\",\n          \"columnName\": \"Country\",\n          \"valueExpression\": \"value\",\n          \"emptyTemplate\": \"---\",\n          \"valuePattern\": null\n        }\n      },\n      {\n        \"name\": \"GDP 2014\",\n        \"type\": \"NUMBER\",\n        \"settings\": {\n          \"columnId\": \"GDP 2014\",\n          \"columnName\": \"GDP 2014\",\n          \"valueExpression\": \"value\",\n          \"emptyTemplate\": \"---\",\n          \"valuePattern\": \"#,##0.00\"\n        }\n      }\n    ],\n    \"data\": [\n      [\"United States\", \"16768100\"],\n      [\"China\", \"9240270\"],\n      [\"Japan\", \"4919563\"],\n      [\"Germany\", \"3730261\"],\n      [\"United Kingdom\", \"2678455\"],\n      [\"France\", \"2806428\"],\n      [\"Brazil\", \"2245673\"]\n    ]\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/static/manifest.json",
    "content": "{\n  \"name\": \"Logo\",\n  \"noData\": true,\n  \"category\": \"Core\",\n  \"icon\": \"pficon pficon-messages\",\n  \"parameters\": [\n    {\n      \"name\": \"src\",\n      \"type\": \"text\",\n      \"defaultValue\": \"./images/dashbuilder-logo.png\",\n      \"label\": \"Logo URL\",\n      \"mandatory\": true\n    },\n    {\n      \"name\": \"width\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\",\n      \"label\": \"Width\"\n    },\n    {\n      \"name\": \"height\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\",\n      \"label\": \"Height\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": false\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/logo-component/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CopyPlugin = require(\"copy-webpack-plugin\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  let entryPoint = \"./src/index.tsx\";\n  const copyResources = [\n    { from: \"./static/images\", to: \"./images\" },\n    { from: \"./static/index.html\", to: \"./index.html\" },\n    { from: \"./static/manifest.json\", to: \"./manifest.json\" }\n  ];\n\n  if (process.env.WEBPACK_DEV_SERVER) {\n    entryPoint = \"./src/index-dev.tsx\";\n    copyResources.push({ from: \"./static/manifest.dev.json\", to: \"./manifest.dev.json\" });\n  }\n\n  return merge(common, {\n    entry: {\n      index: entryPoint\n    },\n    plugins: [new CopyPlugin(copyResources)],\n    devServer: {\n      historyApiFallback: false,\n      disableHostCheck: true,\n      watchContentBase: true,\n      contentBase: [path.join(__dirname, \"./dist\"), path.join(__dirname, \"./static\")],\n      compress: true,\n      port: 9001\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/process-heatmap-component\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"0.2.0\",\n    \"@dashbuilder-js/heatmap-base\": \"0.1.0\"\n  },\n  \"devDependencies\": {\n    \"@dashbuilder-js/component-dev\": \"0.2.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/src/ProcessHeatmapComponent.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\nimport { ColumnType, DataSet, FunctionCallRequest } from \"@dashbuilder-js/component-api\";\nimport { ComponentController } from \"@dashbuilder-js/component-api/dist/controller/ComponentController\";\nimport { SvgNodeValue, SvgHeatmap } from \"@dashbuilder-js/heatmap-base\";\n\nconst NOT_ENOUGH_COLUMNS_MSG = \"Process Heatmap expects 2 columns: Node Id(LABEL or TEXT),Value (NUMBER).\";\nconst FIRST_COLUMN_INVALID_MSG = \"Wrong type for first column, it should be either LABEL or TEXT.\";\nconst SECOND_COLUMN_INVALID_MSG = \"Wrong type for second column, it should be NUMBER.\";\n\nenum Params {\n  SERVER_TEMPLATE = \"serverTemplate\",\n  CONTAINER_ID = \"containerId\",\n  PROCESS_ID = \"processId\"\n}\n\nenum AppStateType {\n  ERROR = \"Error\",\n  INIT = \"Initializing\",\n  LOADING_SVG = \"Loading SVG\",\n  LOADED_SVG = \"Loaded SVG\",\n  FINISHED = \"Finished loading\"\n}\n\ninterface AppState {\n  state: AppStateType;\n  processesNodesValues: SvgNodeValue[];\n  svgRequest?: FunctionCallRequest;\n  processSVG?: string;\n  configurationIssue: string;\n  message?: string;\n}\n\nconst isEmpty = (param?: string) => param === undefined || param.trim() === \"\";\n\nconst validateParams = (params: Map<string, any>): string | undefined => {\n  if (isEmpty(params.get(Params.SERVER_TEMPLATE))) {\n    return \"Server template is required.\";\n  }\n  if (isEmpty(params.get(Params.CONTAINER_ID))) {\n    return \"Container ID is required.\";\n  }\n  if (isEmpty(params.get(Params.PROCESS_ID))) {\n    return \"Process ID is required.\";\n  }\n};\n\nconst validateDataSet = (ds: DataSet): string | undefined => {\n  if (ds.columns.length < 2) {\n    return NOT_ENOUGH_COLUMNS_MSG;\n  }\n  if (ds.columns[0].type !== ColumnType.LABEL && ds.columns[0].type !== ColumnType.TEXT) {\n    return FIRST_COLUMN_INVALID_MSG;\n  }\n  if (ds.columns[1].type !== ColumnType.NUMBER) {\n    return SECOND_COLUMN_INVALID_MSG;\n  }\n};\n\ninterface Props {\n  controller: ComponentController;\n}\n\nexport function ProcessHeatmapComponent(props: Props) {\n  const [appState, setAppState] = useState<AppState>({\n    state: AppStateType.INIT,\n    processesNodesValues: [],\n    configurationIssue: \"\"\n  });\n\n  const onInit = useCallback(\n    (params: Map<string, string>) => {\n      const validationMessage = validateParams(params);\n      if (validationMessage) {\n        setAppState(previousAppState => ({\n          ...previousAppState,\n          state: AppStateType.ERROR,\n          message: validationMessage,\n          configurationIssue: validationMessage\n        }));\n      } else {\n        setAppState(previousAppState => ({\n          ...previousAppState,\n          state: AppStateType.LOADING_SVG,\n          svgRequest: {\n            functionName: \"ProcessSVGFunction\",\n            parameters: params\n          },\n          configurationIssue: \"\"\n        }));\n      }\n    },\n    [appState]\n  );\n\n  const onDataset = useCallback((ds: DataSet, params: Map<string, any>) => {\n    const validationMessage = validateParams(params) || validateDataSet(ds);\n    if (validationMessage) {\n      setAppState(previousAppState => ({\n        ...previousAppState,\n        state: AppStateType.ERROR,\n        message: validationMessage,\n        configurationIssue: validationMessage\n      }));\n    } else {\n      setAppState(previousAppState => ({\n        ...previousAppState,\n        processesNodesValues: ds.data.map(d => ({ nodeId: d[0], value: +d[1] })),\n        state: AppStateType.FINISHED,\n        configurationIssue: \"\"\n      }));\n    }\n  }, []);\n\n  useEffect(() => {\n    props.controller.setOnInit(onInit);\n    props.controller.setOnDataSet(onDataset);\n  }, [appState]);\n\n  useEffect(() => {\n    if (appState.configurationIssue) {\n      props.controller.requireConfigurationFix(appState.configurationIssue);\n    } else {\n      props.controller.configurationOk();\n    }\n  }, [appState.configurationIssue]);\n\n  useEffect(() => {\n    if (appState.svgRequest) {\n      props.controller\n        .callFunction(appState.svgRequest!)\n        .then((result: any) =>\n          setAppState(previousAppState => ({ ...previousAppState, state: AppStateType.LOADED_SVG, processSVG: result }))\n        )\n        .catch((errorMsg: string) =>\n          setAppState(previousAppState => ({\n            ...previousAppState,\n            state: AppStateType.ERROR,\n            message: `There was an error retrieving process SVG: ${errorMsg}`\n          }))\n        );\n    }\n  }, [appState.svgRequest]);\n\n  return (\n    <div style={{ width: \"100%\", height: \"100%\" }}>\n      {(() => {\n        switch (appState.state) {\n          case AppStateType.ERROR:\n            return <em style={{ color: \"red\" }}>{appState.message}</em>;\n          case AppStateType.LOADED_SVG:\n          case AppStateType.FINISHED:\n            return <SvgHeatmap svgContent={appState.processSVG!} svgNodesValues={appState.processesNodesValues} />;\n          default:\n            return <em>Status: {appState.state}</em>;\n        }\n      })()}\n    </div>\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/src/index-dev.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ProcessHeatmapComponent } from \"./ProcessHeatmapComponent\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\nimport { ComponentDev } from \"@dashbuilder-js/component-dev\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<ProcessHeatmapComponent controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n\nnew ComponentDev().start();\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ProcessHeatmapComponent } from \"./ProcessHeatmapComponent\";\n\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<ProcessHeatmapComponent controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/static/index.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <title>Process Heatmap Component</title>\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  </head>\n  <body style=\"overflow: hidden; margin: 0px; border: 0px\">\n    <div id=\"app\" style=\" height: 100vh;\"></div>\n    <script src=\"index.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/static/manifest.dev.json",
    "content": "{\n  \"init\": [\n    {\n      \"key\": \"serverTemplate\",\n      \"value\": \"sample template\"\n    },\n    {\n      \"key\": \"containerId\",\n      \"value\": \"sample container id\"\n    },\n    {\n      \"key\": \"processId\",\n      \"value\": \"process id\"\n    }\n  ],\n  \"dataSet\": {\n    \"columns\": [\n      {\n        \"name\": \"nodeId\",\n        \"type\": \"TEXT\"\n      },\n      {\n        \"name\": \"value\",\n        \"type\": \"NUMBER\"\n      }\n    ],\n    \"data\": [\n      [\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\", \"1\"],\n      [\"_31FBFFDF-B095-483C-BBCE-2AA83609521E\", \"1\"],\n      [\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\", \"1\"]\n    ]\n  },\n  \"functions\": [\n    {\n      \"name\": \"ProcessSVGFunction\",\n      \"params\": [\n        {\n          \"key\": \"serverTemplate\",\n          \"value\": \"sample template\"\n        },\n        {\n          \"key\": \"containerId\",\n          \"value\": \"sample container id\"\n        },\n        {\n          \"key\": \"processId\",\n          \"value\": \"process id\"\n        }\n\n      ],\n\n      \"response\": \"<svg version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"564\\\" height=\\\"181\\\" viewBox=\\\"0 0 564 181\\\"><defs/><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g><g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 1200 0\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 0 800\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g></g><g id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\\\" bpmn2nodeid=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\\\" transform=\\\"matrix(1,0,0,1,88,52)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#e8fae6\\\" stroke=\\\"none\\\" id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(74,162,65)\\\" stroke=\\\"none\\\" id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 432 C 109.1 432 16 338.9 16 224 C 16 109.10000000000002 109.1 16 224 16 C 338.9 16 432 109.1 432 224 C 432 338.9 338.9 432 224 432 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g transform=\\\"matrix(1,0,0,1,88,52)\\\"/><g id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E\\\" bpmn2nodeid=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E\\\" transform=\\\"matrix(1,0,0,1,224,29)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#ffffff\\\" stroke=\\\"none\\\" id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"none\\\" stroke=\\\"rgb(0,136,206)\\\" id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E?shapeType=BORDER&amp;renderType=STROKE\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,30.9765625,43.5)\\\"><text fill=\\\"#000000\\\" stroke=\\\"none\\\" font-family=\\\"Open Sans\\\" font-size=\\\"12pt\\\" font-style=\\\"normal\\\" font-weight=\\\"normal\\\" text-decoration=\\\"normal\\\" x=\\\"46.0234375\\\" y=\\\"12\\\" text-anchor=\\\"middle\\\" dominant-baseline=\\\"alphabetic\\\">Sample Task</text></g></g><g id=\\\"_15041A0B-F570-4BF5-AE87-A211584DB688\\\" bpmn2nodeid=\\\"_15041A0B-F570-4BF5-AE87-A211584DB688\\\"><g><path fill=\\\"none\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 144 80 L 209 80\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,144,80)\\\"/><g transform=\\\"matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,224,75)\\\"><path fill=\\\"#000000\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 10 15 L 0 15 L 5 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,144,70)\\\"/></g><g id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\\\" bpmn2nodeid=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\\\" transform=\\\"matrix(1,0,0,1,458,52)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#fce7e7\\\" stroke=\\\"none\\\" id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(163,0,0)\\\" stroke=\\\"none\\\" id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 400 C 126.8 400 48 321.2 48 224 C 48 126.80000000000001 126.8 48 224 48 C 321.2 48 400 126.8 400 224 C 400 321.2 321.2 400 224 400 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g id=\\\"_108AA6C4-AB5E-41C8-A496-3535A671759F\\\" bpmn2nodeid=\\\"_108AA6C4-AB5E-41C8-A496-3535A671759F\\\"><g><path fill=\\\"none\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 378 80 L 443 80\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,378,80)\\\"/><g transform=\\\"matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,458,75)\\\"><path fill=\\\"#000000\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 10 15 L 0 15 L 5 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,378,70)\\\"/></g><g transform=\\\"matrix(1,0,0,1,458,52)\\\"/><g transform=\\\"matrix(1,0,0,1,224,29)\\\"/></g></g></svg>\"\n    }\n  ]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/static/manifest.json",
    "content": "{\n  \"name\": \"Process Heatmap\",\n  \"category\": \"Heatmaps\",\n  \"icon\": \"pficon pficon-blueprint\",\n  \"parameters\": [\n    {\n      \"name\": \"serverTemplate\",\n      \"label\": \"Server Template\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\",\n      \"mandatory\": true\n    },\n    {\n      \"name\": \"containerId\",\n      \"label\": \"Container ID\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\",\n      \"mandatory\": true\n    },\n    {\n      \"name\": \"processId\",\n      \"label\": \"Process Definition ID\",\n      \"type\": \"text\",\n      \"defaultValue\": \"\",\n      \"mandatory\": true\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": false\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/process-heatmap-component/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CopyPlugin = require(\"copy-webpack-plugin\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  let entryPoint = \"./src/index.tsx\";\n  const copyResources = [\n    { from: \"./static/index.html\", to: \"./index.html\" },\n    { from: \"./static/manifest.json\", to: \"./manifest.json\" }\n  ];\n\n  if (process.env.WEBPACK_DEV_SERVER) {\n    entryPoint = \"./src/index-dev.tsx\";\n    copyResources.push({ from: \"./static/manifest.dev.json\", to: \"./manifest.dev.json\" });\n  }\n\n  return merge(common, {\n    entry: {\n      index: entryPoint\n    },\n    plugins: [new CopyPlugin(copyResources)],\n    devServer: {\n      historyApiFallback: false,\n      disableHostCheck: true,\n      watchContentBase: true,\n      contentBase: [path.join(__dirname, \"./dist\"), path.join(__dirname, \"./static\")],\n      compress: true,\n      port: 9001\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/processes-heatmaps-component\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0\"\n  },\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"0.2.0\",\n    \"@dashbuilder-js/heatmap-base\": \"0.1.0\"\n  },\n  \"devDependencies\": {\n    \"@dashbuilder-js/component-dev\": \"0.2.0\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/src/ProcessSelector.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { useEffect, useCallback, useState, createRef } from \"react\";\n\nexport interface KieServerContainer {\n  id: string;\n  processes: string[];\n}\n\ninterface SelectedValue {\n  container: KieServerContainer;\n  process: string;\n}\n\nexport interface ProcessSelectorProps {\n  containers: KieServerContainer[];\n  onContainerProcessSelected: (container: string, process: string) => void;\n  selectedContainer?: string;\n  selectedProcess?: string;\n}\n\nexport function ProcessSelector(props: ProcessSelectorProps) {\n  const containerSelectRef = createRef<HTMLSelectElement>();\n  const titleRef = createRef<HTMLDivElement>();\n  const bodyRef = createRef<HTMLDivElement>();\n  const processSelectRef = createRef<HTMLSelectElement>();\n  const [selectedValue, setSelectedValue] = useState<SelectedValue>();\n\n  const onTitleClicked = useCallback((e: any) => {\n    titleRef.current?.classList.toggle(\"active\");\n    const bodyRefEl = bodyRef.current;\n    if (bodyRefEl) {\n      const bodyHidden = bodyRefEl.style.display === \"none\";\n      bodyRefEl.style.display = bodyHidden ? \"block\" : \"none\";\n    }\n  }, [titleRef, bodyRef]);\n\n  const onContainerSelected = useCallback(\n    (e: any) => {\n      const containerName = containerSelectRef.current?.value;\n      const selectedContainer = props.containers.filter(c => c.id === containerName)[0];\n      props.onContainerProcessSelected(selectedContainer.id, selectedContainer.processes[0]);\n      setSelectedValue({ container: selectedContainer, process: selectedContainer.processes[0] });\n    },\n    [selectedValue, containerSelectRef.current]\n  );\n  const onProcessSelected = useCallback(\n    (e: any) => props.onContainerProcessSelected(selectedValue?.container.id!, processSelectRef.current?.value!),\n    [selectedValue, processSelectRef.current]\n  );\n  useEffect(() => {\n    const containers = props.containers;\n    if (containers?.length > 0) {\n      const selectedContainer = props.selectedContainer\n        ? containers.filter(c => c.id === props.selectedContainer)[0]\n        : containers[0];\n      setSelectedValue({\n        container: selectedContainer,\n        process: props.selectedProcess\n          ? selectedContainer.processes.filter(p => p === props.selectedProcess)[0]\n          : selectedContainer.processes[0]\n      });\n    }\n  }, [props.containers]);\n\n  return (\n    <div className=\"processSelectorContainer\">\n      <div className=\"container\">\n        <h5 className=\"cardTitle collapsible\" onClick={onTitleClicked} ref={titleRef}>\n          <b>Process Selector</b>\n        </h5>\n        <div className=\"cardBody\" ref={bodyRef}>\n          {props.containers && props.containers.length > 0 && (\n            <fieldset>\n              <legend>Container</legend>\n              <select\n                className=\"containerSelector\"\n                onChange={onContainerSelected}\n                ref={containerSelectRef}\n                defaultValue={props.selectedContainer || props.containers[0]?.id}\n              >\n                {props.containers.map((c: KieServerContainer) => (\n                  <option key={c.id} value={c.id}>\n                    {c.id}\n                  </option>\n                ))}\n              </select>\n            </fieldset>\n          )}\n\n          {selectedValue?.container?.processes?.length! > 0 && (\n            <fieldset>\n              <legend>Process</legend>\n              <select\n                onChange={onProcessSelected}\n                ref={processSelectRef}\n                defaultValue={props.selectedProcess || selectedValue?.container?.processes[0]}\n              >\n                {selectedValue?.container?.processes.map(p => (\n                  <option key={p} value={p}>\n                    {p}\n                  </option>\n                ))}\n              </select>\n            </fieldset>\n          )}\n        </div>\n      </div>\n    </div>\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/src/ProcessesHeatmapsComponent.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { useEffect, useState, useCallback } from \"react\";\n\nimport { ColumnType, DataSet } from \"@dashbuilder-js/component-api\";\nimport { ComponentController } from \"@dashbuilder-js/component-api/dist/controller/ComponentController\";\nimport { SvgNodeValue, SvgHeatmap } from \"@dashbuilder-js/heatmap-base\";\nimport { ProcessSelector } from \"./ProcessSelector\";\n\nconst NOT_ENOUGH_COLUMNS_MSG =\n  \"All Processes Heatmaps expects 4 columns: Container Id (or External Id), Process Id, Node Id ,Value (NUMBER).\";\nconst INVALID_TEXT_COLUMN = \"Wrong type for column {0}, it should be either LABEL or TEXT.\";\nconst VALUE_COLUMN_INVALID_MSG = \"Wrong type for node value column, it should be NUMBER.\";\nconst NO_DATA_MESSAGE = \"Dataset is empty. Please provide data with container id, process id, node id and value.\";\nenum Params {\n  SERVER_TEMPLATE = \"serverTemplate\",\n  SHOW_STATUS = \"showStatus\",\n  SHOW_PROCESS_SELECTOR = \"showProcessSelector\"\n}\nenum AppStateType {\n  ERROR = \"Error\",\n  INIT = \"Initializing\",\n  WAITING_DATA = \"Waiting Data\",\n  LOADING_SVG = \"Loading SVG\",\n  LOADED_SVG = \"Loaded SVG\",\n  FINISHED = \"Finished loading\"\n}\n\ninterface NodeData {\n  nodeid: string;\n  value: number;\n}\n\ninterface ProcessData {\n  processId: string;\n  nodeValues: NodeData[];\n}\n\ninterface ContainerData {\n  containerId: string;\n  processData: ProcessData[];\n}\n\ninterface AppState {\n  state: AppStateType;\n  nodesValues: SvgNodeValue[];\n  serverTemplate?: string;\n  processSvg?: string;\n  containerData: ContainerData[];\n  message?: string;\n  selectedContainer?: string;\n  selectedProcess?: string;\n  showStatus?: boolean;\n}\n\nconst isEmpty = (param?: string) => param === undefined || param.trim() === \"\";\n\nconst validateParams = (params: Map<string, any>): string | undefined => {\n  if (isEmpty(params.get(Params.SERVER_TEMPLATE))) {\n    return \"Server template is required. (Component Properties)\";\n  }\n};\n\nconst validateDataSet = (ds: DataSet): string | undefined => {\n  if (ds.columns.length < 4) {\n    return NOT_ENOUGH_COLUMNS_MSG;\n  }\n\n  for (let i = 0; i < ds.columns.length; i++) {\n    const column = ds.columns[i];\n    const columnType = column.type;\n    if (i < 3 && columnType !== ColumnType.LABEL && columnType !== ColumnType.TEXT) {\n      return INVALID_TEXT_COLUMN.replace(\"{0}\", column.name);\n    }\n    if (i === 3 && columnType !== ColumnType.NUMBER) {\n      return VALUE_COLUMN_INVALID_MSG;\n    }\n  }\n};\n\ninterface Props {\n  controller: ComponentController;\n}\n\nexport function ProcessesHeatmapsComponent(props: Props) {\n  const [appState, setAppState] = useState<AppState>({\n    state: AppStateType.INIT,\n    nodesValues: [],\n    containerData: [],\n    showStatus: false\n  });\n\n  const onDataset = useCallback(\n    (ds: DataSet, params: Map<string, any>) => {\n      const validation = validateParams(params) || validateDataSet(ds);\n      if (validation) {\n        setAppState(previousState => ({\n          ...previousState,\n          state: AppStateType.ERROR,\n          message: validation\n        }));\n        props.controller.requireConfigurationFix(validation);\n        return;\n      }\n      if (ds.data.length === 0) {\n        setAppState(previousState => ({\n          ...previousState,\n          state: AppStateType.ERROR,\n          message: NO_DATA_MESSAGE\n        }));\n        props.controller.requireConfigurationFix(NO_DATA_MESSAGE);\n        return;\n      }\n\n      props.controller.configurationOk();\n\n      const allContainerData: ContainerData[] = [];\n      ds.data.map(d => {\n        const cid = d[0];\n        const pid = d[1];\n        const nid = d[2];\n        const nodeValue = +d[3];\n\n        let containerData = allContainerData.filter(c => c.containerId === cid)[0];\n        if (!containerData) {\n          containerData = { containerId: cid, processData: [] };\n          allContainerData.push(containerData);\n        }\n        const processData = containerData.processData.filter(p => p.processId === pid)[0];\n        if (processData) {\n          processData.nodeValues.push({ nodeid: nid, value: nodeValue });\n        } else {\n          containerData.processData.push({ processId: pid, nodeValues: [{ nodeid: nid, value: nodeValue }] });\n        }\n      });\n\n      setAppState(previousState => ({\n        ...previousState,\n        nodesValues: ds.data.map((d: string[]) => {\n          return { nodeId: d[2], value: +d[3] };\n        }),\n        state: AppStateType.LOADING_SVG,\n        containerData: allContainerData,\n        serverTemplate: params.get(Params.SERVER_TEMPLATE),\n        showStatus: params.get(Params.SHOW_STATUS) === \"true\",\n        selectedContainer: appState.selectedContainer || allContainerData[0].containerId,\n        selectedProcess: appState.selectedProcess || allContainerData[0].processData[0].processId\n      }));\n    },\n    [appState]\n  );\n\n  const onProcessSelected = useCallback(\n    (containerId: string, processId: string) => {\n      if (\n        !appState.serverTemplate ||\n        (containerId === appState.selectedContainer && processId === appState.selectedProcess)\n      ) {\n        return;\n      }\n      setAppState(previousState => ({\n        ...previousState,\n        state: AppStateType.LOADING_SVG,\n        selectedContainer: containerId,\n        selectedProcess: processId\n      }));\n    },\n    [appState.serverTemplate, appState.selectedContainer, appState.selectedProcess]\n  );\n\n  useEffect(() => props.controller.setOnDataSet(onDataset), [appState]);\n\n  useEffect(() => {\n    if (appState.serverTemplate && appState.selectedContainer && appState.selectedProcess) {\n      const params = new Map<string, string>();\n      params.set(Params.SERVER_TEMPLATE, appState.serverTemplate!);\n      params.set(\"containerId\", appState.selectedContainer!);\n      params.set(\"processId\", appState.selectedProcess!);\n      props.controller\n        .callFunction({\n          functionName: \"ProcessSVGFunction\",\n          parameters: params\n        })\n        .then((result: any) =>\n          setAppState(previousState => ({ ...previousState, state: AppStateType.LOADED_SVG, processSvg: result }))\n        )\n        .catch((errorMsg: string) =>\n          setAppState(previousState => ({\n            ...previousState,\n            state: AppStateType.ERROR,\n            processSvg: undefined,\n            message: `Error loading SVG for process \"${appState.selectedProcess}\" from container \"${appState.selectedContainer}\". \n            Please make sure the process SVG exists. Error: ${errorMsg}`\n          }))\n        );\n    }\n  }, [appState.serverTemplate, appState.selectedContainer, appState.selectedProcess]);\n\n  return (\n    <div className=\"allProcessHeatmapsComponent\">\n      {appState.state !== AppStateType.ERROR && appState.processSvg && (\n        <SvgHeatmap svgNodesValues={appState.nodesValues} svgContent={appState.processSvg!} />\n      )}\n      {appState.containerData.length > 0 && (\n        <ProcessSelector\n          containers={appState.containerData.map(c => {\n            return {\n              id: c.containerId,\n              processes: c.processData.map(p => p.processId)\n            };\n          })}\n          onContainerProcessSelected={onProcessSelected}\n          selectedContainer={appState.selectedContainer}\n          selectedProcess={appState.selectedProcess}\n        />\n      )}\n      {appState.state === AppStateType.ERROR && <p className=\"errorMessage\">{appState.message}</p>}\n      {appState.showStatus && (\n        <div className=\"statusContainer\">\n          <em className=\"statusLabel\">\n            {appState.state} {appState.message ? `: ${appState.message}` : \"\"}\n          </em>\n        </div>\n      )}\n    </div>\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/src/index-dev.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ProcessesHeatmapsComponent } from \"./ProcessesHeatmapsComponent\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\nimport { ComponentDev } from \"@dashbuilder-js/component-dev\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(\n  <ProcessesHeatmapsComponent controller={api.getComponentController()} />,\n  document.getElementById(\"app\")!\n);\n\nnew ComponentDev().start();\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/src/index.tsx",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { ProcessesHeatmapsComponent } from \"./ProcessesHeatmapsComponent\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(\n  <ProcessesHeatmapsComponent controller={api.getComponentController()} />,\n  document.getElementById(\"app\")!\n);\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/static/index.html",
    "content": "<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <title>Process Heatmap Component</title>\n    <link rel=\"stylesheet\" href=\"style.css\" />\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  </head>\n  <body style=\"overflow: hidden; margin: 0px; border: 0px\">\n    <div id=\"app\" style=\" height: 100vh;\"></div>\n    <script src=\"index.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/static/manifest.dev.json",
    "content": "{\n  \"init\": [\n    {\n      \"key\": \"serverTemplate\",\n      \"value\": \"server\"\n    },\n    {\n      \"key\": \"showStatus\",\n      \"value\": \"true\"\n    }\n  ],\n  \"dataSet\": {\n    \"columns\": [\n      {\n        \"name\": \"containerId\",\n        \"type\": \"TEXT\"\n      },\n      {\n        \"name\": \"processId\",\n        \"type\": \"TEXT\"\n      },\n      {\n        \"name\": \"nodeId\",\n        \"type\": \"TEXT\"\n      },\n      {\n        \"name\": \"value\",\n        \"type\": \"NUMBER\"\n      }\n    ],\n    \"data\": [\n      [\"container1\", \"process1\", \"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\", \"1\"],\n      [\"container1\", \"process1\", \"_31FBFFDF-B095-483C-BBCE-2AA83609521E\", \"1\"],\n      [\"container1\", \"process1\", \"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\", \"1\"],\n\n      [\"container1\", \"process2\", \"_E39122D0-55A7-464D-A209-EF468A3D9939\", \"10\"],\n      [\"container1\", \"process2\", \"_F71FB1D8-8363-4628-AF74-887C949FCD81\", \"12\"],\n      [\"container1\", \"process2\", \"_14A95F6E-2421-4623-BD7F-C8BF879F9ECE\", \"1\"],\n\n      [\"container2\", \"process1process1process1process1process1process1process1\", \"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7\", \"100\"],\n      [\"container2\", \"process1process1process1process1process1process1process1\", \"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194C\", \"101\"],\n      [\"container2\", \"process1process1process1process1process1process1process1\", \"_51C46971-52B0-4C16-8CE1-CD28956EA343\", \"102\"]\n    ]\n  },\n  \"functions\": [\n    {\n      \"name\": \"ProcessSVGFunction\",\n      \"params\": [\n        {\n          \"key\": \"serverTemplate\",\n          \"value\": \"server\"\n        },\n        {\n          \"key\": \"containerId\",\n          \"value\": \"container1\"\n        },\n        {\n          \"key\": \"processId\",\n          \"value\": \"process1\"\n        }\n      ],\n\n      \"response\": \"<svg version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"564\\\" height=\\\"181\\\" viewBox=\\\"0 0 564 181\\\"><defs/><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g><g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 1200 0\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 0 800\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g></g><g id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\\\" bpmn2nodeid=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51\\\" transform=\\\"matrix(1,0,0,1,88,52)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#e8fae6\\\" stroke=\\\"none\\\" id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(74,162,65)\\\" stroke=\\\"none\\\" id=\\\"_8DF7D18B-1357-470B-BFDF-E8F168CD2D51?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 432 C 109.1 432 16 338.9 16 224 C 16 109.10000000000002 109.1 16 224 16 C 338.9 16 432 109.1 432 224 C 432 338.9 338.9 432 224 432 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g transform=\\\"matrix(1,0,0,1,88,52)\\\"/><g id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E\\\" bpmn2nodeid=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E\\\" transform=\\\"matrix(1,0,0,1,224,29)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#ffffff\\\" stroke=\\\"none\\\" id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"none\\\" stroke=\\\"rgb(0,136,206)\\\" id=\\\"_31FBFFDF-B095-483C-BBCE-2AA83609521E?shapeType=BORDER&amp;renderType=STROKE\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,30.9765625,43.5)\\\"><text fill=\\\"#000000\\\" stroke=\\\"none\\\" font-family=\\\"Open Sans\\\" font-size=\\\"12pt\\\" font-style=\\\"normal\\\" font-weight=\\\"normal\\\" text-decoration=\\\"normal\\\" x=\\\"46.0234375\\\" y=\\\"12\\\" text-anchor=\\\"middle\\\" dominant-baseline=\\\"alphabetic\\\">Sample Task</text></g></g><g id=\\\"_15041A0B-F570-4BF5-AE87-A211584DB688\\\" bpmn2nodeid=\\\"_15041A0B-F570-4BF5-AE87-A211584DB688\\\"><g><path fill=\\\"none\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 144 80 L 209 80\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,144,80)\\\"/><g transform=\\\"matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,224,75)\\\"><path fill=\\\"#000000\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 10 15 L 0 15 L 5 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,144,70)\\\"/></g><g id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\\\" bpmn2nodeid=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F\\\" transform=\\\"matrix(1,0,0,1,458,52)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#fce7e7\\\" stroke=\\\"none\\\" id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(163,0,0)\\\" stroke=\\\"none\\\" id=\\\"_7E897E88-A5A1-49F4-ABC4-D67A42B1177F?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 400 C 126.8 400 48 321.2 48 224 C 48 126.80000000000001 126.8 48 224 48 C 321.2 48 400 126.8 400 224 C 400 321.2 321.2 400 224 400 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g id=\\\"_108AA6C4-AB5E-41C8-A496-3535A671759F\\\" bpmn2nodeid=\\\"_108AA6C4-AB5E-41C8-A496-3535A671759F\\\"><g><path fill=\\\"none\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 378 80 L 443 80\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,378,80)\\\"/><g transform=\\\"matrix(6.123233995736766e-17,1,-1,6.123233995736766e-17,458,75)\\\"><path fill=\\\"#000000\\\" stroke=\\\"#000000\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 10 15 L 0 15 L 5 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-dasharray=\\\"\\\"/></g><g transform=\\\"matrix(1,0,0,1,378,70)\\\"/></g><g transform=\\\"matrix(1,0,0,1,458,52)\\\"/><g transform=\\\"matrix(1,0,0,1,224,29)\\\"/></g></g></svg>\"\n    },\n    {\n      \"name\": \"ProcessSVGFunction\",\n      \"params\": [\n        {\n          \"key\": \"serverTemplate\",\n          \"value\": \"server\"\n        },\n        {\n          \"key\": \"containerId\",\n          \"value\": \"container1\"\n        },\n        {\n          \"key\": \"processId\",\n          \"value\": \"process2\"\n        }\n      ],\n\n      \"response\": \"<svg version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"533\\\" height=\\\"368\\\" viewBox=\\\"0 0 533 368\\\"><defs/><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g><g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 1200 0\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 0 800\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g></g><g id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939\\\" bpmn2nodeid=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939\\\" transform=\\\"matrix(1,0,0,1,79,40)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#ffffff\\\" stroke=\\\"none\\\" id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"none\\\" stroke=\\\"rgb(0,0,0)\\\" id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939?shapeType=BORDER&amp;renderType=STROKE\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"\\\"/></g><g><g transform=\\\"matrix(0.06,0,0,0.06,9.4,9.4)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 197.3 130.2 C 194.4 127.29999999999998 189.60000000000002 127.29999999999998 186.70000000000002 130.2 L 130.20000000000002 186.7 C 127.30000000000001 189.6 127.30000000000001 194.39999999999998 130.20000000000002 197.29999999999998 L 186.70000000000002 253.79999999999998 C 188.10000000000002 255.29999999999998 190.10000000000002 255.99999999999997 192.00000000000003 255.99999999999997 C 193.90000000000003 255.99999999999997 195.90000000000003 255.29999999999998 197.30000000000004 253.69999999999996 C 200.20000000000005 250.79999999999995 200.20000000000005 245.99999999999997 197.30000000000004 243.09999999999997 L 146.2 192 L 197.29999999999998 140.8 C 200.2 137.9 200.2 133.1 197.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 261.3 130.2 C 258.40000000000003 127.29999999999998 253.60000000000002 127.29999999999998 250.70000000000002 130.2 C 247.8 133.1 247.8 137.89999999999998 250.70000000000002 140.79999999999998 L 301.8 191.89999999999998 L 250.7 243 C 247.79999999999998 245.9 247.79999999999998 250.7 250.7 253.6 C 252.1 255.29999999999998 254.1 256 256 256 C 257.9 256 259.9 255.3 261.3 253.8 L 317.8 197.3 C 320.7 194.4 320.7 189.60000000000002 317.8 186.70000000000002 L 261.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_E39122D0-55A7-464D-A209-EF468A3D9939undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 400 32 C 400 32 152.8 32 128 32 C 62 32 64 96 64 96 L 64 288 L 1 288 C 1 288 -4 416 78 416 L 320 416 C 368 416 384 368 384 336 C 384 314.2 384 224.4 384 160 L 448 160 L 448 96 C 448 96 449 32 400 32 Z M 0 0 M 78 383.9 C 68.5 383.9 61.6 381.09999999999997 55.5 374.9 C 43.4 362.4 37.5 339.59999999999997 34.9 320 L 256.9 320 C 257.09999999999997 322.7 257.29999999999995 325.4 257.59999999999997 328.2 C 259.99999999999994 351.59999999999997 264.7 370.09999999999997 271.9 383.9 L 78 383.9 L 78 383.9 Z M 0 0 M 352 336 C 352 345.9 349.6 360.3 342.9 371 C 337.2 380.1 330.4 384 320 384 C 285 384 288 288 288 288 L 96 288 L 96 96 L 96 95.9 L 96 95.10000000000001 C 96 90.60000000000001 97.6 78.30000000000001 104.7 71.20000000000002 C 106.5 69.40000000000002 111.9 64.00000000000001 128 64.00000000000001 L 356.5 64.00000000000001 C 354.4 72.80000000000001 352.8 81.80000000000001 352.2 89.9 C 352.2 90.5 352.09999999999997 91.10000000000001 352.09999999999997 91.7 C 352.09999999999997 92 352.09999999999997 92.3 352.09999999999997 92.60000000000001 C 352 94.8 352 96 352 96 L 352 160 L 352 336 Z\\\"/></g></g></g><g transform=\\\"matrix(1,0,0,1,68,43.5)\\\"><text fill=\\\"#000000\\\" stroke=\\\"none\\\" font-family=\\\"Open Sans\\\" font-size=\\\"12pt\\\" font-style=\\\"normal\\\" font-weight=\\\"normal\\\" text-decoration=\\\"normal\\\" x=\\\"9\\\" y=\\\"12\\\" text-anchor=\\\"middle\\\" dominant-baseline=\\\"alphabetic\\\">T1</text></g></g><g id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECE\\\" bpmn2nodeid=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECE\\\" transform=\\\"matrix(1,0,0,1,329,40)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#ffffff\\\" stroke=\\\"none\\\" id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECE?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"none\\\" stroke=\\\"rgb(0,0,0)\\\" id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECE?shapeType=BORDER&amp;renderType=STROKE\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"\\\"/></g><g><g transform=\\\"matrix(0.06,0,0,0.06,9.4,9.4)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECEundefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 197.3 130.2 C 194.4 127.29999999999998 189.60000000000002 127.29999999999998 186.70000000000002 130.2 L 130.20000000000002 186.7 C 127.30000000000001 189.6 127.30000000000001 194.39999999999998 130.20000000000002 197.29999999999998 L 186.70000000000002 253.79999999999998 C 188.10000000000002 255.29999999999998 190.10000000000002 255.99999999999997 192.00000000000003 255.99999999999997 C 193.90000000000003 255.99999999999997 195.90000000000003 255.29999999999998 197.30000000000004 253.69999999999996 C 200.20000000000005 250.79999999999995 200.20000000000005 245.99999999999997 197.30000000000004 243.09999999999997 L 146.2 192 L 197.29999999999998 140.8 C 200.2 137.9 200.2 133.1 197.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECEundefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 261.3 130.2 C 258.40000000000003 127.29999999999998 253.60000000000002 127.29999999999998 250.70000000000002 130.2 C 247.8 133.1 247.8 137.89999999999998 250.70000000000002 140.79999999999998 L 301.8 191.89999999999998 L 250.7 243 C 247.79999999999998 245.9 247.79999999999998 250.7 250.7 253.6 C 252.1 255.29999999999998 254.1 256 256 256 C 257.9 256 259.9 255.3 261.3 253.8 L 317.8 197.3 C 320.7 194.4 320.7 189.60000000000002 317.8 186.70000000000002 L 261.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_14A95F6E-2421-4623-BD7F-C8BF879F9ECEundefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 400 32 C 400 32 152.8 32 128 32 C 62 32 64 96 64 96 L 64 288 L 1 288 C 1 288 -4 416 78 416 L 320 416 C 368 416 384 368 384 336 C 384 314.2 384 224.4 384 160 L 448 160 L 448 96 C 448 96 449 32 400 32 Z M 0 0 M 78 383.9 C 68.5 383.9 61.6 381.09999999999997 55.5 374.9 C 43.4 362.4 37.5 339.59999999999997 34.9 320 L 256.9 320 C 257.09999999999997 322.7 257.29999999999995 325.4 257.59999999999997 328.2 C 259.99999999999994 351.59999999999997 264.7 370.09999999999997 271.9 383.9 L 78 383.9 L 78 383.9 Z M 0 0 M 352 336 C 352 345.9 349.6 360.3 342.9 371 C 337.2 380.1 330.4 384 320 384 C 285 384 288 288 288 288 L 96 288 L 96 96 L 96 95.9 L 96 95.10000000000001 C 96 90.60000000000001 97.6 78.30000000000001 104.7 71.20000000000002 C 106.5 69.40000000000002 111.9 64.00000000000001 128 64.00000000000001 L 356.5 64.00000000000001 C 354.4 72.80000000000001 352.8 81.80000000000001 352.2 89.9 C 352.2 90.5 352.09999999999997 91.10000000000001 352.09999999999997 91.7 C 352.09999999999997 92 352.09999999999997 92.3 352.09999999999997 92.60000000000001 C 352 94.8 352 96 352 96 L 352 160 L 352 336 Z\\\"/></g></g></g><g transform=\\\"matrix(1,0,0,1,68,43.5)\\\"><text fill=\\\"#000000\\\" stroke=\\\"none\\\" font-family=\\\"Open Sans\\\" font-size=\\\"12pt\\\" font-style=\\\"normal\\\" font-weight=\\\"normal\\\" text-decoration=\\\"normal\\\" x=\\\"9\\\" y=\\\"12\\\" text-anchor=\\\"middle\\\" dominant-baseline=\\\"alphabetic\\\">T2</text></g></g><g id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81\\\" bpmn2nodeid=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81\\\" transform=\\\"matrix(1,0,0,1,204,216)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#ffffff\\\" stroke=\\\"none\\\" id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"none\\\" stroke=\\\"rgb(0,0,0)\\\" id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81?shapeType=BORDER&amp;renderType=STROKE\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 2 0 L 152 0 L 152 0 A 2 2 0 0 1 154 2 L 154 100 L 154 100 A 2 2 0 0 1 152 102 L 2 102 L 2 102 A 2 2 0 0 1 0 100 L 0 2 L 0 2.0000000000000004 A 2 2 0 0 1 1.9999999999999996 0 Z\\\" stroke-miterlimit=\\\"10\\\" stroke-width=\\\"1.5\\\" stroke-dasharray=\\\"\\\"/></g><g><g transform=\\\"matrix(0.06,0,0,0.06,9.4,9.4)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 197.3 130.2 C 194.4 127.29999999999998 189.60000000000002 127.29999999999998 186.70000000000002 130.2 L 130.20000000000002 186.7 C 127.30000000000001 189.6 127.30000000000001 194.39999999999998 130.20000000000002 197.29999999999998 L 186.70000000000002 253.79999999999998 C 188.10000000000002 255.29999999999998 190.10000000000002 255.99999999999997 192.00000000000003 255.99999999999997 C 193.90000000000003 255.99999999999997 195.90000000000003 255.29999999999998 197.30000000000004 253.69999999999996 C 200.20000000000005 250.79999999999995 200.20000000000005 245.99999999999997 197.30000000000004 243.09999999999997 L 146.2 192 L 197.29999999999998 140.8 C 200.2 137.9 200.2 133.1 197.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 261.3 130.2 C 258.40000000000003 127.29999999999998 253.60000000000002 127.29999999999998 250.70000000000002 130.2 C 247.8 133.1 247.8 137.89999999999998 250.70000000000002 140.79999999999998 L 301.8 191.89999999999998 L 250.7 243 C 247.79999999999998 245.9 247.79999999999998 250.7 250.7 253.6 C 252.1 255.29999999999998 254.1 256 256 256 C 257.9 256 259.9 255.3 261.3 253.8 L 317.8 197.3 C 320.7 194.4 320.7 189.60000000000002 317.8 186.70000000000002 L 261.3 130.2 Z\\\"/></g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#393f44\\\" stroke=\\\"none\\\" id=\\\"_F71FB1D8-8363-4628-AF74-887C949FCD81undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 400 32 C 400 32 152.8 32 128 32 C 62 32 64 96 64 96 L 64 288 L 1 288 C 1 288 -4 416 78 416 L 320 416 C 368 416 384 368 384 336 C 384 314.2 384 224.4 384 160 L 448 160 L 448 96 C 448 96 449 32 400 32 Z M 0 0 M 78 383.9 C 68.5 383.9 61.6 381.09999999999997 55.5 374.9 C 43.4 362.4 37.5 339.59999999999997 34.9 320 L 256.9 320 C 257.09999999999997 322.7 257.29999999999995 325.4 257.59999999999997 328.2 C 259.99999999999994 351.59999999999997 264.7 370.09999999999997 271.9 383.9 L 78 383.9 L 78 383.9 Z M 0 0 M 352 336 C 352 345.9 349.6 360.3 342.9 371 C 337.2 380.1 330.4 384 320 384 C 285 384 288 288 288 288 L 96 288 L 96 96 L 96 95.9 L 96 95.10000000000001 C 96 90.60000000000001 97.6 78.30000000000001 104.7 71.20000000000002 C 106.5 69.40000000000002 111.9 64.00000000000001 128 64.00000000000001 L 356.5 64.00000000000001 C 354.4 72.80000000000001 352.8 81.80000000000001 352.2 89.9 C 352.2 90.5 352.09999999999997 91.10000000000001 352.09999999999997 91.7 C 352.09999999999997 92 352.09999999999997 92.3 352.09999999999997 92.60000000000001 C 352 94.8 352 96 352 96 L 352 160 L 352 336 Z\\\"/></g></g></g><g transform=\\\"matrix(1,0,0,1,68,43.5)\\\"><text fill=\\\"#000000\\\" stroke=\\\"none\\\" font-family=\\\"Open Sans\\\" font-size=\\\"12pt\\\" font-style=\\\"normal\\\" font-weight=\\\"normal\\\" text-decoration=\\\"normal\\\" x=\\\"9\\\" y=\\\"12\\\" text-anchor=\\\"middle\\\" dominant-baseline=\\\"alphabetic\\\">T3</text></g></g><g transform=\\\"matrix(1,0,0,1,79,40)\\\"/><g transform=\\\"matrix(1,0,0,1,329,40)\\\"/><g transform=\\\"matrix(1,0,0,1,204,216)\\\"/></g></g></svg>\"\n    },\n    {\n      \"name\": \"ProcessSVGFunction\",\n      \"params\": [\n        {\n          \"key\": \"serverTemplate\",\n          \"value\": \"server\"\n        },\n        {\n          \"key\": \"containerId\",\n          \"value\": \"container2\"\n        },\n        {\n          \"key\": \"processId_\",\n          \"value\": \"process1process1process1process1process1process1process1\"\n        }\n      ],\n\n      \"response\": \"<svg version=\\\"1.1\\\" xmlns=\\\"http://www.w3.org/2000/svg\\\" xmlns:xlink=\\\"http://www.w3.org/1999/xlink\\\" width=\\\"320\\\" height=\\\"221\\\" viewBox=\\\"0 0 320 221\\\"><defs/><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g><g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 1200 0\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g><g><path fill=\\\"none\\\" stroke=\\\"#d3d3d3\\\" paint-order=\\\"fill stroke markers\\\" d=\\\" M 0 0 L 0 800\\\" stroke-miterlimit=\\\"10\\\" stroke-opacity=\\\"0.8\\\" stroke-dasharray=\\\"5\\\"/></g></g><g id=\\\"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7\\\" bpmn2nodeid=\\\"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7\\\" transform=\\\"matrix(1,0,0,1,114,115)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#e8fae6\\\" stroke=\\\"none\\\" id=\\\"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(74,162,65)\\\" stroke=\\\"none\\\" id=\\\"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 432 C 109.1 432 16 338.9 16 224 C 16 109.10000000000002 109.1 16 224 16 C 338.9 16 432 109.1 432 224 C 432 338.9 338.9 432 224 432 Z\\\"/></g></g></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#4aa241\\\" stroke=\\\"none\\\" id=\\\"_8FCF18E2-0158-42A4-B15B-DE7E0DB3B5D7undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224.6 124.8 L 320.5 300.7 L 128.8 300.7 L 224.6 124.8 M 224.6 108.7 C 221.7 108.7 219 109.5 216.5 110.9 C 214 112.30000000000001 212.1 114.5 210.6 117 L 114.69999999999999 293 C 111.79999999999998 298.2 111.89999999999999 303.5 114.89999999999999 308.8 C 116.3 311.2 118.19999999999999 313.2 120.69999999999999 314.6 C 123.1 316 125.79999999999998 316.70000000000005 128.7 316.70000000000005 L 320.5 316.70000000000005 C 323.4 316.70000000000005 325.9 316.00000000000006 328.4 314.6 C 330.9 313.20000000000005 332.79999999999995 311.3 334.2 308.8 C 337.3 303.6 337.3 298.3 334.4 293 L 238.49999999999997 117 C 237.09999999999997 114.4 235.19999999999996 112.4 232.69999999999996 110.9 C 230.2 109.4 227.5 108.7 224.6 108.7 L 224.6 108.7 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g id=\\\"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194C\\\" bpmn2nodeid=\\\"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194C\\\" transform=\\\"matrix(1,0,0,1,164,61)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#e8fae6\\\" stroke=\\\"none\\\" id=\\\"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194C?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(74,162,65)\\\" stroke=\\\"none\\\" id=\\\"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194C?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 432 C 109.1 432 16 338.9 16 224 C 16 109.10000000000002 109.1 16 224 16 C 338.9 16 432 109.1 432 224 C 432 338.9 338.9 432 224 432 Z\\\"/></g></g></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#4aa241\\\" stroke=\\\"none\\\" id=\\\"_DDEA4967-7EAB-4224-A5A0-EC3CE37F194Cundefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224.6 124.8 L 320.5 300.7 L 128.8 300.7 L 224.6 124.8 M 224.6 108.7 C 221.7 108.7 219 109.5 216.5 110.9 C 214 112.30000000000001 212.1 114.5 210.6 117 L 114.69999999999999 293 C 111.79999999999998 298.2 111.89999999999999 303.5 114.89999999999999 308.8 C 116.3 311.2 118.19999999999999 313.2 120.69999999999999 314.6 C 123.1 316 125.79999999999998 316.70000000000005 128.7 316.70000000000005 L 320.5 316.70000000000005 C 323.4 316.70000000000005 325.9 316.00000000000006 328.4 314.6 C 330.9 313.20000000000005 332.79999999999995 311.3 334.2 308.8 C 337.3 303.6 337.3 298.3 334.4 293 L 238.49999999999997 117 C 237.09999999999997 114.4 235.19999999999996 112.4 232.69999999999996 110.9 C 230.2 109.4 227.5 108.7 224.6 108.7 L 224.6 108.7 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g id=\\\"_51C46971-52B0-4C16-8CE1-CD28956EA343\\\" bpmn2nodeid=\\\"_51C46971-52B0-4C16-8CE1-CD28956EA343\\\" transform=\\\"matrix(1,0,0,1,214,115)\\\"><g><path fill=\\\"none\\\" stroke=\\\"none\\\"/></g><g transform=\\\"matrix(0.125,0,0,0.125,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#e8fae6\\\" stroke=\\\"none\\\" id=\\\"_51C46971-52B0-4C16-8CE1-CD28956EA343?shapeType=BACKGROUND\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 444 224 C 444 263.9 434.2 300.8 414.4 334.5 C 394.7 368.2 368 394.9 334.4 414.5 C 300.79999999999995 434.1 263.9 444 224 444 C 184.10000000000002 444 147.2 434.2 113.5 414.4 C 79.8 394.7 53.1 368 33.5 334.4 C 13.899999999999999 300.79999999999995 4 263.9 4 224 C 4 184.10000000000002 13.8 147.2 33.6 113.5 C 53.400000000000006 79.80000000000001 80.1 53.1 113.6 33.5 C 147.1 13.899999999999999 184.1 4 224 4 C 263.9 4 300.8 13.8 334.5 33.6 C 368.2 53.400000000000006 394.9 80.1 414.5 113.6 C 434.1 147.1 444 184.1 444 224 Z\\\"/></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"rgb(74,162,65)\\\" stroke=\\\"none\\\" id=\\\"_51C46971-52B0-4C16-8CE1-CD28956EA343?shapeType=BORDER&amp;renderType=FILL\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224 0 C 100.3 0 0 100.3 0 224 C 0 347.7 100.3 448 224 448 C 347.7 448 448 347.7 448 224 C 448 100.30000000000001 347.7 0 224 0 Z M 0 0 M 224 432 C 109.1 432 16 338.9 16 224 C 16 109.10000000000002 109.1 16 224 16 C 338.9 16 432 109.1 432 224 C 432 338.9 338.9 432 224 432 Z\\\"/></g></g></g><g><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><g transform=\\\"matrix(1,0,0,1,0,0)\\\"><path fill=\\\"#4aa241\\\" stroke=\\\"none\\\" id=\\\"_51C46971-52B0-4C16-8CE1-CD28956EA343undefined\\\" paint-order=\\\"stroke fill markers\\\" d=\\\" M 0 0 M 224.6 124.8 L 320.5 300.7 L 128.8 300.7 L 224.6 124.8 M 224.6 108.7 C 221.7 108.7 219 109.5 216.5 110.9 C 214 112.30000000000001 212.1 114.5 210.6 117 L 114.69999999999999 293 C 111.79999999999998 298.2 111.89999999999999 303.5 114.89999999999999 308.8 C 116.3 311.2 118.19999999999999 313.2 120.69999999999999 314.6 C 123.1 316 125.79999999999998 316.70000000000005 128.7 316.70000000000005 L 320.5 316.70000000000005 C 323.4 316.70000000000005 325.9 316.00000000000006 328.4 314.6 C 330.9 313.20000000000005 332.79999999999995 311.3 334.2 308.8 C 337.3 303.6 337.3 298.3 334.4 293 L 238.49999999999997 117 C 237.09999999999997 114.4 235.19999999999996 112.4 232.69999999999996 110.9 C 230.2 109.4 227.5 108.7 224.6 108.7 L 224.6 108.7 Z\\\"/></g></g></g></g><g transform=\\\"matrix(1,0,0,1,28,61)\\\"/></g><g transform=\\\"matrix(1,0,0,1,114,115)\\\"/><g transform=\\\"matrix(1,0,0,1,164,61)\\\"/><g transform=\\\"matrix(1,0,0,1,214,115)\\\"/></g></g></svg>\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/static/manifest.json",
    "content": "{\n  \"name\": \"All Processes Heatmaps\",\n  \"category\": \"Heatmaps\",\n  \"icon\": \"pficon pficon-blueprint\",\n  \"parameters\": [\n    {\n      \"name\": \"serverTemplate\",\n      \"label\": \"Server Template\",\n      \"type\": \"text\",\n      \"category\": \"Server Template\",\n      \"defaultValue\": \"\",\n      \"mandatory\": true\n    },\n    {\n      \"name\": \"showStatus\",\n      \"label\": \"Status\",\n      \"type\": \"boolean\",\n      \"category\": \"Display\",\n      \"defaultValue\": \"true\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/static/style.css",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.allProcessHeatmapsComponent {\n  width: 100%;\n  height: 100%;\n}\n.statusContainer {\n  position: absolute;\n  width: 100%;\n  height: 20px;\n  border: 1px;\n  bottom: 0px;\n  background-color: rgba(240, 240, 240, 0.7);\n}\n.statusLabel {\n  color: gray;\n}\n.processSelectorContainer {\n  position: absolute;\n  top: 0;\n  left: 0;\n  margin: 10px;\n  opacity: 0.6;\n  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);\n  transition: 0.3s;\n  max-width: 130px;\n  min-width: 130px;\n}\n\n.processSelectorContainer:hover {\n  opacity: 1;\n  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);\n}\n\n.errorMessage {\n  color: #9F6000;\n  background-color: #FEEFB3;\n}\n\n.cardTitle {\n  margin: 2px;\n  margin-bottom: 4px;\n}\n\n.cardBody {\n  display: flex;\n  flex-direction: column;\n}\n\n.processSelectorContainer select {\n  max-width: 100px;\n  min-width: 100px;\n  background-color: #f1f1f1;\n  color: #4d5258;\n  border-color: #bbb;\n  font-size: 12px;\n  overflow: hidden;\n}\n\n.processSelectorContainer select:hover {\n  border-color: #7dc3e8;\n}\n\n.processSelectorContainer select:focus {\n  border-color: #0088ce;\n  outline: 0 !important;\n  box-shadow: inset 0 1px 1px rgba(3, 3, 3, 0.075), 0 0 8px rgba(0, 136, 206, 0.6);\n}\n\n.processSelectorContainer select.select-items {\n  position: absolute;\n  background-color: DodgerBlue;\n  top: 100%;\n  left: 0;\n  right: 0;\n  z-index: 99;\n}\n.processSelectorContainer fieldset {  \n  border-color: #dddddd;\n  border-radius: 10px;\n  border-width: 1px;\n  border-style: dotted;\n}\n.processSelectorContainer fieldset legend {\n  font-size: 12px;\n  font-weight: bold;\n}\n\n.collapsible {\n  background-color: #eee;\n  color: #444;\n  cursor: pointer;\n  width: 100%;\n  border: none;\n  text-align: left;\n  outline: none;\n  font-size: 15px;\n}\n\n/* Add a background color to the button if it is clicked on (add the .active class with JS), and when you move the mouse over it (hover) */\n.active, .collapsible:hover {\n  background-color: #ccc;\n}\n\n/* Style the collapsible content. Note: hidden by default */\n.content {\n  padding: 0 18px;\n  display: none;\n  overflow: hidden;\n  background-color: #f1f1f1;\n}\n\n.collapsible:after {\n  content: '\\02795'; /* Unicode character for \"plus\" sign (+) */\n  font-size: 8px;\n  color: white;\n  float: right;\n  margin: 5px;\n}\n\n.active:after {\n  content: \"\\2796\"; /* Unicode character for \"minus\" sign (-) */\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": false\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/processes-heatmaps-component/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CopyPlugin = require(\"copy-webpack-plugin\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  let entryPoint = \"./src/index.tsx\";\n  const copyResources = [\n    { from: \"./static/index.html\", to: \"./index.html\" },\n    { from: \"./static/manifest.json\", to: \"./manifest.json\" },\n    { from: \"./static/style.css\", to: \"./style.css\" }\n  ];\n\n  if (process.env.WEBPACK_DEV_SERVER) {\n    entryPoint = \"./src/index-dev.tsx\";\n    copyResources.push({ from: \"./static/manifest.dev.json\", to: \"./manifest.dev.json\" });\n  }\n\n  return merge(common, {\n    entry: {\n      index: entryPoint\n    },\n    plugins: [new CopyPlugin(copyResources)],\n    devServer: {\n      historyApiFallback: false,\n      disableHostCheck: true,\n      watchContentBase: true,\n      contentBase: [path.join(__dirname, \"./dist\"), path.join(__dirname, \"./static\")],\n      compress: true,\n      port: 9001\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/jest.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  reporters: [\"default\"],\n  moduleDirectories: [\"node_modules\", \"src\"],\n  moduleFileExtensions: [\"js\", \"jsx\", \"ts\", \"tsx\"],\n  testRegex: \"/__tests__/.*\\\\.test\\\\.(jsx?|tsx?)$\",\n  transform: {\n    \"^.+\\\\.jsx?$\": \"babel-jest\",\n    \"^.+\\\\.tsx?$\": \"ts-jest\"\n  },\n  moduleNameMapper: {\n    \"\\\\.(css|less|sass|scss)$\": \"<rootDir>/__mocks__/styleMock.js\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/runtime-client\",\n  \"version\": \"0.1.0\",\n  \"description\": \"Dashbuilder Runtime client Javascript API.\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --verbose --silent --passWithNoTests\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\"\n  },\n  \"babel\": {\n    \"presets\": [\n      \"@babel/env\",\n      \"@babel/react\"\n    ]\n  },\n  \"jest-junit\": {\n    \"outputDirectory\": \"./target\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/src/DashbuilderService.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type RuntimeMode = \"MULTIPLE_IMPORT\" | \"SINGLE\" | \"STATIC\";\n\nexport interface ApiResponse {\n  mode: RuntimeMode;\n  availableModels: string[];\n  acceptingNewImports: boolean;\n}\n\nexport interface DashboardResponse {\n  runtimeModelId: string;\n  pages: string[];\n}\n\nexport interface RequestInfo {\n  url: string;\n  user: string;\n  password: string;\n}\n\nexport function embeddedRuntimeUrl(url: string, dashboardId: string, page: string) {\n  const urlBuild = new URL(url);\n  urlBuild.searchParams.set(\"standalone\", \"true\");\n  urlBuild.searchParams.set(\"perspective\", page);\n  if (dashboardId && dashboardId !== \"\") {\n    urlBuild.searchParams.set(\"import\", dashboardId);\n  }\n  return urlBuild.href;\n}\n\nexport class DashbuilderService {\n  private requestInfo: RequestInfo;\n  private authToken: string;\n\n  constructor(requestInfo: RequestInfo) {\n    this.requestInfo = requestInfo;\n    this.authToken = btoa(requestInfo.user + \":\" + requestInfo.password);\n  }\n\n  public listDashboards(): Promise<ApiResponse> {\n    const url = `${this.requestInfo.url}/rest/api`;\n    return this.request(url).then(obj => (obj as unknown) as ApiResponse);\n  }\n\n  public listPages(id: string): Promise<DashboardResponse> {\n    if (!id || id === \"\") {\n      return Promise.resolve({\n        runtimeModelId: id,\n        pages: []\n      });\n    }\n    const url = `${this.requestInfo.url}/rest/api/dashboard/${id}`;\n    return this.request(url).then(obj => (obj as unknown) as DashboardResponse);\n  }\n\n  private request(url: string): Promise<string> {\n    return fetch(url, {\n      credentials: \"include\",\n      mode: \"cors\",\n      headers: new Headers({\n        Authorization: `Basic ${this.authToken}`\n      })\n    }).then(r => r.json());\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/src/index.ts",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport * from './DashbuilderService';"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"outDir\": \"dist\"\n  },\n  \"include\": [\"src\"]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/runtime-client/webpack.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst nodeExternals = require(\"webpack-node-externals\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = merge(common, {\n  entry: {\n    index: \"./src/index.ts\"\n  },\n  output: {\n    libraryTarget: \"commonjs2\"\n  },\n  externals: [nodeExternals({ modulesDir: \"../../node_modules\" })],\n});\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/.gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# production\n/build\n\n# misc\n.DS_Store\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/jest.config.js",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n  roots: [\"<rootDir>/src\"],\n  testMatch: [\"**/__tests__/**/*.+(ts|tsx|js)\", \"**/?(*.)+(spec|test).+(ts|tsx|js)\"],\n  transform: {\n    \"^.+\\\\.(ts|tsx)$\": \"ts-jest\"\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/package.json",
    "content": "{\n  \"name\": \"@dashbuilder-js/time-series-component\",\n  \"version\": \"0.1.0\",\n  \"description\": \"\",\n  \"license\": \"Apache-2.0\",\n  \"main\": \"./dist/index.js\",\n  \"types\": \"./dist/index.d.ts\",\n  \"files\": [\n    \"dist\"\n  ],\n  \"dependencies\": {\n    \"@dashbuilder-js/component-api\": \"^0.2.0\",\n    \"@types/node\": \"^12.0.0\",\n    \"apexcharts\": \"^3.23.1\",\n    \"react-apexcharts\": \"^1.3.7\",\n    \"react-router-dom\": \"^5.2.0\"\n  },\n  \"scripts\": {\n    \"lint\": \"tslint -c ../../tslint.json 'src/**/*.{ts,tsx,js,jsx}'\",\n    \"test\": \"jest --silent --verbose --passWithNoTests --coverage\",\n    \"test:clearCache\": \"jest --clearCache\",\n    \"build:fast\": \"rm -rf dist && webpack\",\n    \"build\": \"yarn run lint && yarn test && yarn run build:fast\",\n    \"build:prod\": \"yarn run build --mode production --devtool none\",\n    \"start\": \"webpack-dev-server -d --host 0.0.0.0 --env WEBPACK_DEV_SERVER=true\"\n  },\n  \"devDependencies\": {\n    \"@dashbuilder-js/component-dev\": \"^0.2.0\",\n    \"@types/enzyme\": \"^3.10.8\",\n    \"@types/enzyme-adapter-react-16\": \"^1.0.6\",\n    \"@types/history\": \"^4.7.3\",\n    \"@types/jest\": \"^26.0.21\",\n    \"enzyme\": \"^3.11.0\",\n    \"enzyme-adapter-react-16\": \"^1.15.6\",\n    \"enzyme-to-json\": \"^3.6.1\",\n    \"jest\": \"^26.6.3\",\n    \"react-test-renderer\": \"^17.0.1\",\n    \"style-loader\": \"^2.0.0\",\n    \"ts-jest\": \"^26.5.4\",\n    \"ts-node\": \"^9.1.1\",\n    \"typescript\": \"^4.2.3\",\n    \"jest-enzyme\": \"7.1.2\",\n    \"webpack-dev-server\": \"^3.11.3\",\n    \"@testing-library/jest-dom\": \"^4.2.4\",\n    \"@testing-library/react\": \"^9.3.2\",\n    \"@testing-library/user-event\": \"^7.1.2\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/Chart.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { LineChart, ChartProps } from \"./LineChart\";\nimport { options, series } from \"./SampleData\";\nimport { ComponentController, DataSet, ColumnType } from \"@dashbuilder-js/component-api\";\nimport { useState, useEffect, useCallback } from \"react\";\nimport { Options, SingleSeries } from \"./Data\";\n\n// Default Values\nexport const NOT_ENOUGH_COLUMNS_MSG_NON_TRANSPOSED =\n  \"Time series component expects at least 2 columns: category(LABEL or TEXT or NUMBER or DATE) and one or more series(NUMBER).\";\nexport const NOT_ENOUGH_COLUMNS_MSG_TRANSPOSED =\n  \"Time series component expects 3 columns: category(LABEL or TEXT or NUMBER or DATE), series(TEXT) and values(NUMBER).\";\nexport const SECOND_COLUMN_INVALID_MSG_TRANSPOSED = \"Wrong type for second column, it should be TEXT.\";\nexport const THIRD_COLUMN_INVALID_MSG_TRANSPOSED = \"Wrong type for third column, it should be NUMBER.\";\nexport const CHARTNAME_VALIDATION = \"Please remove all special characters and spaces in Chart Name\";\n\nexport enum Params {\n  TRANSPOSED = \"transposed\",\n  CHARTNAME = \"chartName\",\n  SHOWAREA = \"showArea\",\n  XAXISTYPE = \"xaxisType\",\n  DATALABELS = \"dataLabels\",\n  ZOOMTYPE = \"type\",\n  ZOOMENABLED = \"enabled\",\n  ZOOMAUTOSCALEYAXIS = \"autoScaleYaxis\",\n  TITLETEXT = \"text\",\n  TITLEALIGN = \"align\",\n  TOOLBARSHOW = \"show\",\n  TOOLBARAUTOSELECTED = \"autoSelected\"\n}\n\nenum AppStateType {\n  ERROR = \"Error\",\n  INIT = \"Initializing\",\n  LOADING_COMPONENT = \"Loading Component\",\n  LOADED_COMPONENT = \"Loaded Component\",\n  FINISHED = \"Finished loading\"\n}\n\ninterface AppState {\n  state: AppStateType;\n  processesOptions: Options;\n  processesSeries: SingleSeries[];\n  configurationIssue: string;\n  message?: string;\n}\n\nexport const validateParams = (params: Map<string, string | number>): string | undefined => {\n  if (!params.get(Params.TRANSPOSED)) {\n    return \"Transposed is required.\";\n  }\n  if (!params.get(Params.CHARTNAME)) {\n    return \"Chart name is required.\";\n  } else {\n    return validateChartName(params.get(Params.CHARTNAME));\n  }\n};\n\nexport const validateChartName = (chartName: string | number | undefined): string | undefined => {\n  const format = /[ `!@#$%^&*()_+\\-=\\[\\]{};':\"\\\\|,.<>\\/?~]/;\n  if (typeof chartName === \"string\") {\n    return format.test(chartName) ? CHARTNAME_VALIDATION : \"\";\n  }\n};\n\nconst validateDataSet = (ds: DataSet, transposed: boolean): string | undefined => {\n  return transposed ? validateTransposedDataset(ds) : validateNonTransposedDataset(ds);\n};\n\nexport const validateNonTransposedDataset = (ds: DataSet): string | undefined => {\n  if (ds.columns.length < 2) {\n    return NOT_ENOUGH_COLUMNS_MSG_NON_TRANSPOSED;\n  }\n  for (let i = 1; i < ds.columns.length; i++) {\n    if (ds.columns[i].type !== ColumnType.NUMBER) {\n      return \"Wrong type for column \" + (i + 1) + \", it should be NUMBER\";\n    }\n  }\n};\n\nexport const validateTransposedDataset = (ds: DataSet): string | undefined => {\n  if (ds.columns.length < 3) {\n    return NOT_ENOUGH_COLUMNS_MSG_TRANSPOSED;\n  }\n  if (ds.columns[1].type !== ColumnType.TEXT && ds.columns[1].type !== ColumnType.LABEL) {\n    return SECOND_COLUMN_INVALID_MSG_TRANSPOSED;\n  }\n  if (ds.columns[2].type !== ColumnType.NUMBER) {\n    return THIRD_COLUMN_INVALID_MSG_TRANSPOSED;\n  }\n};\n\ninterface Props {\n  controller: ComponentController;\n}\n\nfunction getSeries(dataset: DataSet, transposed: boolean): SingleSeries[] {\n  return transposed ? getSeriesforTransposedDataset(dataset) : getSeriesforNonTransposedDataset(dataset);\n}\n\nexport function getSeriesforNonTransposedDataset(dataset: DataSet): SingleSeries[] {\n  const arrayseries: SingleSeries[] = [];\n  for (let i = 1; i < dataset.columns.length; i++) {\n    arrayseries.push({\n      name: dataset.columns[i].name,\n      data: dataset.data.map((d: Array<string | number>) => +d[i])\n    });\n  }\n  return arrayseries;\n}\n\nexport function getSeriesforTransposedDataset(dataset: DataSet): SingleSeries[] {\n  const arrayseries: SingleSeries[] = [];\n  const names: string[] = dataset.data.map((d: string[]) => d[1]);\n  const datum: Array<string | number> = dataset.data.map((d: Array<string | number>) => d[2]);\n  const newnames: string[] = [];\n  for (const i of names) {\n    if (newnames.indexOf(i) === -1) {\n      newnames.push(i);\n    }\n  }\n  for (const i of newnames) {\n    const newdata: Array<number | string> = [];\n    for (let j = 0; j < names.length; j++) {\n      if (i === names[j]) {\n        newdata.push(+datum[j]);\n      }\n    }\n    arrayseries.push({ name: i, data: newdata });\n  }\n  return arrayseries;\n}\n\nexport function getOptions(\n  dataset: DataSet,\n  transposed: boolean,\n  chartName: string,\n  type: string,\n  enabled: boolean,\n  autoScaleYaxis: boolean,\n  text: string,\n  align: string,\n  show: boolean,\n  autoSelected: string,\n  xaxisType: string\n): Options {\n  const newoptions: Options = {\n    chart: {\n      id: chartName,\n      zoom: { type, enabled, autoScaleYaxis },\n      toolbar: { show, autoSelected }\n    },\n    title: { text, align },\n    xaxis: { type: xaxisType, categories: dataset.data.map((d: Array<string | number>) => d[0]) },\n    dataLabels: { enabled: false }\n  };\n  if (transposed) {\n    newoptions.xaxis.categories = Array.from(new Set(newoptions.xaxis.categories));\n  }\n  return newoptions;\n}\n\nexport function Chart(props: Props) {\n  const [chartProps, setChartProps] = useState<ChartProps>({\n    options,\n    series\n  });\n  const [appState, setAppState] = useState<AppState>({\n    state: AppStateType.INIT,\n    processesOptions: {\n      chart: {\n        id: \"\",\n        zoom: { type: \"\", enabled: false, autoScaleYaxis: false },\n        toolbar: { show: false, autoSelected: \"\" }\n      },\n      xaxis: { type: \"\", categories: [] },\n      dataLabels: { enabled: false },\n      title: { text: \"\", align: \"\" }\n    },\n    processesSeries: [{ name: \"\", data: [] }],\n    configurationIssue: \"\"\n  });\n  const onDataset = useCallback((ds: DataSet, params: Map<string, any>) => {\n    const transposed = params.get(Params.TRANSPOSED) === \"true\";\n    const validationMessage = validateParams(params) || validateDataSet(ds, transposed);\n    if (validationMessage) {\n      setAppState(previousAppState => ({\n        ...previousAppState,\n        state: AppStateType.ERROR,\n        message: validationMessage,\n        configurationIssue: validationMessage\n      }));\n    } else {\n      const op = getOptions(\n        ds,\n        transposed,\n        params.get(Params.CHARTNAME),\n        params.get(Params.ZOOMTYPE),\n        params.get(Params.ZOOMENABLED),\n        params.get(Params.ZOOMAUTOSCALEYAXIS),\n        params.get(Params.TITLETEXT),\n        params.get(Params.TITLEALIGN),\n        params.get(Params.TOOLBARSHOW),\n        params.get(Params.TOOLBARAUTOSELECTED),\n        params.get(Params.XAXISTYPE),\n      );\n      op.dataLabels.enabled = params.get(Params.DATALABELS) === \"true\";\n      op.chart.zoom.enabled = params.get(Params.ZOOMENABLED) === \"true\";\n      op.chart.zoom.autoScaleYaxis = params.get(Params.ZOOMAUTOSCALEYAXIS) === \"true\";\n      op.chart.toolbar.show = params.get(Params.TOOLBARSHOW) === \"true\";\n      setAppState(previousAppState => ({\n        ...previousAppState,\n        processesOptions: op,\n        processesSeries: getSeries(ds, transposed),\n        state: AppStateType.FINISHED,\n        configurationIssue: \"\"\n      }));\n    }\n  }, []);\n  useEffect(() => {\n    props.controller.setOnInit(componentProps => {\n      setChartProps({\n        type: componentProps.get(Params.SHOWAREA) === \"true\" ? \"area\" : \"line\",\n        options: appState.processesOptions,\n        series: appState.processesSeries\n      });\n    });\n    props.controller.setOnDataSet(onDataset);\n  }, [appState]);\n\n  useEffect(() => {\n    if (appState.configurationIssue) {\n      props.controller.requireConfigurationFix(appState.configurationIssue);\n    } else {\n      props.controller.configurationOk();\n    }\n  }, [appState.configurationIssue]);\n  return (\n    <div style={{ width: \"100%\", height: \"100%\" }}>\n      {(() => {\n        switch (appState.state) {\n          case AppStateType.ERROR:\n            return <em style={{ color: \"red\" }}>{appState.message}</em>;\n          case AppStateType.LOADED_COMPONENT:\n          case AppStateType.FINISHED:\n            return <LineChart {...chartProps} options={appState.processesOptions} series={appState.processesSeries} />;\n          default:\n            return <em>Status: {appState.state}</em>;\n        }\n      })()}\n    </div>\n  );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/Data.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface Options {\n  chart: {\n    id: string;\n    zoom: {\n      type: string;\n      enabled: boolean;\n      autoScaleYaxis: boolean;\n    };\n    toolbar: {\n      show: boolean;\n      autoSelected: string;\n    };\n  };\n  title: {\n    text: string;\n    align: string;\n  };\n  xaxis: {\n    type: string;\n    categories: Array<string | number>;\n  };\n  dataLabels: {\n    enabled: boolean;\n  };\n}\n\nexport interface SingleSeries {\n  name: string;\n  data: Array<string | number>;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/LineChart.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { Options, SingleSeries } from \"./Data\";\nimport Chart from \"react-apexcharts\";\n\nexport type ChartType = \"line\" | \"area\";\n\nexport interface ChartProps {\n  type?: ChartType;\n  options: Options;\n  series: SingleSeries[];\n}\n\nexport function LineChart(props: ChartProps) {\n  return <Chart type={props.type || \"line\"} options={props.options} series={props.series} />;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/SampleData.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Options } from \"./Data\";\n\nexport const options: Options = {\n  chart: {\n    id: \"apexchart-example\",\n    zoom: {\n      type: 'x',\n      enabled: true,\n      autoScaleYaxis: true\n    },\n    toolbar:{\n      show: true,\n      autoSelected: 'zoom'\n    }\n  },\n  title:{\n    text: \"Increase of series with time\",\n    align : \"left\"\n  },\n  xaxis: {\n    type: \"category\",\n    categories: [1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999]\n  },\n  dataLabels: { enabled: false }\n};\nexport const series = [\n  {\n    name: \"series-1\",\n    data: [30, 40, 35, 50, 49, 60, 70, 91, 125]\n  }\n];\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/index-dev.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport { Chart } from \"./Chart\";\nimport { ComponentDev } from \"@dashbuilder-js/component-dev\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<Chart controller={api.getComponentController()} />, document.getElementById(\"app\")!);\n\nnew ComponentDev().start();\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/index.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport {Chart} from \"./Chart\";\nimport { ComponentApi } from \"@dashbuilder-js/component-api\";\n\nconst api = new ComponentApi();\n\nReactDOM.render(<Chart controller={api.getComponentController()} />, document.getElementById(\"app\")!);"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/tests/Chart.test.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport {\n  Chart,\n  validateNonTransposedDataset,\n  validateTransposedDataset,\n  NOT_ENOUGH_COLUMNS_MSG_TRANSPOSED,\n  NOT_ENOUGH_COLUMNS_MSG_NON_TRANSPOSED,\n  SECOND_COLUMN_INVALID_MSG_TRANSPOSED,\n  THIRD_COLUMN_INVALID_MSG_TRANSPOSED,\n  CHARTNAME_VALIDATION,\n  getSeriesforNonTransposedDataset,\n  getSeriesforTransposedDataset,\n  getOptions,\n  validateChartName\n} from \"../Chart\";\nimport { ColumnType, ComponentApi } from \"@dashbuilder-js/component-api\";\nimport { shallow } from \"enzyme\";\nimport { configure } from \"enzyme\";\nimport Adapter from \"enzyme-adapter-react-16\";\nimport \"jest-enzyme\";\n\nconfigure({ adapter: new Adapter() });\n\nconst api = new ComponentApi();\nconst settings = { columnId: \"\", columnName: \"\", valueExpression: \"\", emptyTemplate: \"\" };\n\nit(\"should test Chart component\", () => {\n  const wrapper = shallow(<Chart controller={api.getComponentController()} />);\n  expect(wrapper).toMatchSnapshot();\n});\n\ndescribe(\"should test validateTransposedDataset\", () => {\n  it(\"should return not enough columns when columns are not enough\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.LABEL,\n          settings\n        }\n      ],\n      data: [[]]\n    };\n    const result = validateTransposedDataset(ds);\n    expect(result).toBe(NOT_ENOUGH_COLUMNS_MSG_TRANSPOSED);\n  });\n\n  it(\"should test type of second column\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.NUMBER,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.NUMBER,\n          settings\n        }\n      ],\n      data: [[]]\n    };\n    const result = validateTransposedDataset(ds);\n    expect(result).toBe(SECOND_COLUMN_INVALID_MSG_TRANSPOSED);\n  });\n\n  it(\"should test type of third column\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.TEXT,\n          settings\n        }\n      ],\n      data: [[]]\n    };\n    const result = validateTransposedDataset(ds);\n    expect(result).toBe(THIRD_COLUMN_INVALID_MSG_TRANSPOSED);\n  });\n});\n\ndescribe(\"should test validateNonTransposedDataset\", () => {\n  it(\"should test number of columns of validateNonTransposedDataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        }\n      ],\n      data: [[]]\n    };\n    const result = validateNonTransposedDataset(ds);\n    expect(result).toBe(NOT_ENOUGH_COLUMNS_MSG_NON_TRANSPOSED);\n  });\n\n  it(\"should test type of second column of validateNonTransposedDataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series-1\",\n          type: ColumnType.TEXT,\n          settings\n        }\n      ],\n      data: [[]]\n    };\n    const result = validateNonTransposedDataset(ds);\n    expect(result).toBe(\"Wrong type for column 2, it should be NUMBER\");\n  });\n});\n\ndescribe(\"should test series and options for Transposed dataset\", () => {\n  it(\"should test getSeriesforTransposedDataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.LABEL,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.LABEL,\n          settings\n        },\n        {\n          name: \"values\",\n          type: ColumnType.NUMBER,\n          settings\n        }\n      ],\n      data: [\n        [\"2000\", \"series-1\", \"2\"],\n        [\"2000\", \"series-2\", \"78\"],\n        [\"2000\", \"series-3\", \"200\"],\n        [\"2001\", \"series-1\", \"89\"],\n        [\"2001\", \"series-2\", \"23\"],\n        [\"2001\", \"series-3\", \"110\"],\n        [\"2002\", \"series-1\", \"167\"],\n        [\"2002\", \"series-2\", \"110\"],\n        [\"2002\", \"series-3\", \"11\"]\n      ]\n    };\n    const expectedResult = [\n      {\n        name: \"series-1\",\n        data: [2, 89, 167]\n      },\n      {\n        name: \"series-2\",\n        data: [78, 23, 110]\n      },\n      {\n        name: \"series-3\",\n        data: [200, 110, 11]\n      }\n    ];\n    const result = getSeriesforTransposedDataset(ds);\n    expect(result).toStrictEqual(expectedResult);\n  });\n\n  it(\"should test getOptions for transposed dataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.LABEL,\n          settings\n        },\n        {\n          name: \"series\",\n          type: ColumnType.LABEL,\n          settings\n        },\n        {\n          name: \"values\",\n          type: ColumnType.NUMBER,\n          settings\n        }\n      ],\n      data: [\n        [\"2000\", \"series-1\", \"2\"],\n        [\"2000\", \"series-2\", \"78\"],\n        [\"2000\", \"series-3\", \"200\"],\n        [\"2001\", \"series-1\", \"89\"],\n        [\"2001\", \"series-2\", \"23\"],\n        [\"2001\", \"series-3\", \"110\"],\n        [\"2002\", \"series-1\", \"167\"],\n        [\"2002\", \"series-2\", \"110\"],\n        [\"2002\", \"series-3\", \"11\"]\n      ]\n    };\n    const expectedResult = {\n      chart: {\n        id: \"new\",\n        zoom: {\n          type: \"x\",\n          enabled: false,\n          autoScaleYaxis: false\n        },\n        toolbar: {\n          show: false,\n          autoSelected: \"zoom\"\n        }\n      },\n      title: {\n        text: \"new\",\n        align: \"left\"\n      },\n      xaxis: {\n        type: \"datetime\",\n        categories: [\"2000\", \"2001\", \"2002\"]\n      },\n      dataLabels: { enabled: false }\n    };\n    const result = getOptions(ds, true, \"new\", \"x\", false, false, \"new\", \"left\", false, \"zoom\", \"datetime\");\n    expect(result).toStrictEqual(expectedResult);\n  });\n});\n\ndescribe(\"should test series and options for NonTransposed dataset\", () => {\n  it(\"should test getSeriesforNonTransposedDataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series-1\",\n          type: ColumnType.TEXT,\n          settings\n        }\n      ],\n      data: [\n        [\"2000\", \"2\"],\n        [\"2001\", \"78\"],\n        [\"2002\", \"200\"]\n      ]\n    };\n    const expectedResult = [\n      {\n        name: \"series-1\",\n        data: [2, 78, 200]\n      }\n    ];\n    const result = getSeriesforNonTransposedDataset(ds);\n    expect(result).toStrictEqual(expectedResult);\n  });\n\n  it(\"should test getOptions for non-transposed dataset\", () => {\n    const ds = {\n      columns: [\n        {\n          name: \"category\",\n          type: ColumnType.TEXT,\n          settings\n        },\n        {\n          name: \"series-1\",\n          type: ColumnType.TEXT,\n          settings\n        }\n      ],\n      data: [\n        [\"2000\", \"2\"],\n        [\"2001\", \"78\"],\n        [\"2002\", \"200\"]\n      ]\n    };\n    const expectedResult = {\n      chart: {\n        id: \"new\",\n        zoom: {\n          type: \"x\",\n          enabled: false,\n          autoScaleYaxis: false\n        },\n        toolbar: {\n          show: false,\n          autoSelected: \"zoom\"\n        }\n      },\n      title: {\n        text: \"new\",\n        align: \"left\"\n      },\n      xaxis: {\n        type: \"category\",\n        categories: [\"2000\", \"2001\", \"2002\"]\n      },\n      dataLabels: { enabled: false }\n    };\n    const result = getOptions(ds, false, \"new\", \"x\", false, false, \"new\", \"left\", false, \"zoom\", \"category\");\n    expect(result).toStrictEqual(expectedResult);\n  });\n});\n\ndescribe(\"should test validateChartName\", () => {\n  it(\"should test special characters\", () => {\n    const result = validateChartName(\"foo+bar\");\n    expect(result).toBe(CHARTNAME_VALIDATION);\n  });\n  it(\"should test spaces\", () => {\n    const result = validateChartName(\"foo bar\");\n    expect(result).toBe(CHARTNAME_VALIDATION);\n  });\n  it(\"should test string without special characters\", () => {\n    const result = validateChartName(\"foobar\");\n    expect(result).toBe(\"\");\n  });\n});\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/tests/LineChart.test.tsx",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as React from \"react\";\nimport { LineChart } from \"../LineChart\";\nimport { shallow } from \"enzyme\";\nimport { options, series } from \"../SampleData\";\nimport { configure } from \"enzyme\";\nimport Adapter from \"enzyme-adapter-react-16\";\nimport \"jest-enzyme\";\n\nconfigure({ adapter: new Adapter() });\n\nit(\"Should test LineChart component with different props\", () => {\n  const wrapper = shallow(<LineChart type={\"line\"} options={options} series={series}/>);\n  expect(wrapper.html()).toMatchSnapshot();\n  wrapper.setProps({ type: \"line\", options, series });\n  expect(wrapper.html()).toMatchSnapshot();\n  wrapper.setProps({ type: \"area\", options, series });\n  expect(wrapper.html()).toMatchSnapshot();\n});\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/tests/__snapshots__/Chart.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`should test Chart component 1`] = `\n<div\n  style={\n    Object {\n      \"height\": \"100%\",\n      \"width\": \"100%\",\n    }\n  }\n>\n  <em>\n    Status: \n    Initializing\n  </em>\n</div>\n`;\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/src/tests/__snapshots__/LineChart.test.tsx.snap",
    "content": "// Jest Snapshot v1, https://goo.gl/fbAQLP\n\nexports[`Should test LineChart component with different props 1`] = `\"<div type=\\\\\"line\\\\\" options=\\\\\"[object Object]\\\\\" series=\\\\\"[object Object]\\\\\" width=\\\\\"100%\\\\\" height=\\\\\"auto\\\\\"></div>\"`;\n\nexports[`Should test LineChart component with different props 2`] = `\"<div type=\\\\\"line\\\\\" options=\\\\\"[object Object]\\\\\" series=\\\\\"[object Object]\\\\\" width=\\\\\"100%\\\\\" height=\\\\\"auto\\\\\"></div>\"`;\n\nexports[`Should test LineChart component with different props 3`] = `\"<div type=\\\\\"area\\\\\" options=\\\\\"[object Object]\\\\\" series=\\\\\"[object Object]\\\\\" width=\\\\\"100%\\\\\" height=\\\\\"auto\\\\\"></div>\"`;\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/static/index.html",
    "content": "<!--\n  ~ Copyright 2021 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE html>\n<html lang=\"en\">\n  <head>\n    <title>Time series Component</title>\n    <!-- <link rel=\"stylesheet\" href=\"../src/index.css\"/> -->\n    <meta charset=\"UTF-8\" />\n    <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n  </head>\n  <body style=\"overflow: auto; margin: 0px; border: 0px\">\n    <div id=\"app\" style=\"height: 100vh;\"></div>\n    <script src=\"index.js\"></script>\n  </body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/static/manifest.dev.json",
    "content": "{\n  \"init\": [\n    {\n      \"key\": \"transposed\",\n      \"value\": \"true\"\n    },\n    {\n      \"key\": \"showArea\",\n      \"value\": \"false\"\n    },\n    {\n      \"key\": \"chartName\",\n      \"value\": \"newChart\"\n    },\n    {\n      \"key\": \"xaxisType\",\n      \"value\": \"numeric\"\n    },\n    {\n      \"key\": \"dataLabels\",\n      \"value\": \"true\"\n    },\n    {\n      \"key\": \"type\",\n      \"value\": \"x\"\n    },\n    {\n      \"key\": \"enabled\",\n      \"value\": \"true\"\n    },\n    {\n      \"key\": \"autoScaleYaxis\",\n      \"value\": \"true\"\n    },\n    {\n      \"key\": \"text\",\n      \"value\": \"New chart\"\n    },\n    {\n      \"key\": \"align\",\n      \"value\": \"center\"\n    },\n    {\n      \"key\": \"show\",\n      \"value\": \"true\"\n    },\n    {\n      \"key\": \"autoSelected\",\n      \"value\": \"zoom\"\n    }\n  ],\n  \"dataSet\": {\n    \"columns\": [\n      {\n        \"name\": \"category\",\n        \"type\": \"TEXT\"\n      },\n      {\n        \"name\": \"series\",\n        \"type\": \"LABEL\"\n      },\n      {\n        \"name\": \"values\",\n        \"type\": \"NUMBER\"\n      }\n    ],\n    \"data\": [\n      [\"1 Feb\", \"series-1\", 2],\n      [\"1 Feb\", \"series-2\", 78],\n      [\"1 Feb\", \"series-3\", 200],\n      [\"2 Feb\", \"series-1\", 89],\n      [\"2 Feb\", \"series-2\", 23],\n      [\"2 Feb\", \"series-3\", 110],\n      [\"3 Feb\", \"series-1\", 167],\n      [\"3 Feb\", \"series-2\", 110],\n      [\"3 Feb\", \"series-3\", 11],\n      [\"4 Feb\", \"series-1\", 70],\n      [\"4 Feb\", \"series-2\", 34],\n      [\"4 Feb\", \"series-3\", 57],\n      [\"5 Feb\", \"series-1\", 110],\n      [\"5 Feb\", \"series-2\", 140],\n      [\"5 Feb\", \"series-3\", 1]\n    ]\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/static/manifest.json",
    "content": "{\n  \"name\": \"Time Series Chart\",\n  \"category\": \"Reporting\",\n  \"icon\": \"fa fa-bell-o\",\n  \"parameters\": [\n    {\n      \"name\": \"transposed\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"false\",\n      \"label\": \"Transpose dataset\"\n    },\n    {\n      \"name\": \"showArea\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"false\",\n      \"label\": \"Show Area\"\n    },\n    {\n      \"name\": \"xaxisType\",\n      \"type\": \"combo\",\n      \"defaultValue\": \"category\",\n      \"comboValues\": [\"category\", \"datetime\", \"numeric\"],\n      \"label\": \"Date Categories\"\n    },\n    {\n      \"name\": \"dataLabels\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"false\",\n      \"label\": \"Labels\"\n    },\n    {\n      \"name\": \"type\",\n      \"type\": \"combo\",\n      \"defaultValue\": \"x\",\n      \"comboValues\": [\"x\", \"y\", \"xy\"],\n      \"label\": \"Zoom type\"\n    },\n    {\n      \"name\": \"enabled\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"true\",\n      \"label\": \"Zoom enabled\"\n    },\n    {\n      \"name\": \"autoScaleYaxis\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"false\",\n      \"label\": \"Zoom autoscale Y axis\"\n    },\n    {\n      \"name\": \"autoSelected\",\n      \"type\": \"combo\",\n      \"defaultValue\": \"zoom\",\n      \"comboValues\": [\"zoom\", \"selection\", \"pan\"],\n      \"label\": \"Toolbar Auto Selected\"\n    },\n    {\n      \"name\": \"text\",\n      \"type\": \"string\",\n      \"defaultValue\": \"Comparison in series\",\n      \"label\": \"Title text\"\n    },\n    {\n      \"name\": \"align\",\n      \"type\": \"combo\",\n      \"defaultValue\": \"left\",\n      \"comboValues\": [\"left\", \"center\", \"right\"],\n      \"label\": \"Title align\"\n    },\n    {\n      \"name\": \"show\",\n      \"type\": \"boolean\",\n      \"defaultValue\": \"true\",\n      \"label\": \"Show toolbar\"\n    },\n    {\n      \"name\": \"chartName\",\n      \"type\": \"string\",\n      \"defaultValue\": \"Newchart\",\n      \"label\": \"Chart Name\"\n    }\n  ]\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/tsconfig.json",
    "content": "{\n  \"extends\": \"../../tsconfig.json\",\n  \"compilerOptions\": {\n    \"declaration\": false,\n    \"allowSyntheticDefaultImports\": true,\n    \"esModuleInterop\": true\n  },\n  \"include\": [\"src\"]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/packages/time-series-component/webpack.config.js",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\nconst CopyPlugin = require(\"copy-webpack-plugin\");\nconst { merge } = require(\"webpack-merge\");\nconst common = require(\"../../webpack.common.config\");\n\nmodule.exports = async (env, argv) => {\n  let entryPoint = \"./src/index.tsx\";\n  const copyResources = [\n    { from: \"./static/index.html\", to: \"./index.html\" },\n    { from: \"./static/manifest.json\", to: \"./manifest.json\" }\n  ];\n\n  if (process.env.WEBPACK_DEV_SERVER) {\n    entryPoint = \"./src/index-dev.tsx\";\n    copyResources.push({ from: \"./static/manifest.dev.json\", to: \"./manifest.dev.json\" });\n  }\n\n  return merge(common, {\n    entry: {\n      index: entryPoint\n    },\n    module: {\n      rules: [\n        {\n          test: /\\.css$/i,\n          use: [\"style-loader\", \"css-loader\"],\n        },\n        {\n          test: /\\.(png|jpe?g|gif|svg|eot|ttf|woff|woff2)$/i,\n          loader: \"url-loader\",\n          options: {\n            limit: 8192,\n          },\n        },\n      ],\n    },\n    plugins: [new CopyPlugin(copyResources)],\n    devServer: {\n      historyApiFallback: false,\n      disableHostCheck: true,\n      watchContentBase: true,\n      contentBase: [path.join(__dirname, \"./dist\"), path.join(__dirname, \"./static\")],\n      compress: true,\n      port: 9001\n    }\n  });\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-shared</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <packaging>jar</packaging>\n  <artifactId>dashbuilder-js</artifactId>\n  <name>Dashbuilder JS</name>\n  <description>Dashbuilder JS APIs and internal components for displaying data</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-monaco</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n\n  <properties>\n    <!-- Comma separated internal components name -->\n    <dashbuilder.internal.components.list>logo-provided,process-heatmap-provided,processes-heatmaps-provided,time-series-provided</dashbuilder.internal.components.list>\n    <!-- Components base dir -->\n    <dashbuilder.internal.components.root>web/dashbuilder/components</dashbuilder.internal.components.root>\n  </properties>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>properties-maven-plugin</artifactId>\n        <version>1.0.0</version>\n        <executions>\n          <execution>\n            <phase>generate-resources</phase>\n            <goals>\n              <goal>write-project-properties</goal>\n            </goals>\n            <configuration>\n              <outputFile>\n                ${project.build.outputDirectory}/dashbuilder-components.properties</outputFile>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>com.github.eirslett</groupId>\n        <artifactId>frontend-maven-plugin</artifactId>\n        <configuration>\n          <installDirectory>${project.build.directory}</installDirectory>\n        </configuration>\n        <executions>\n          <execution>\n            <id>install yarn</id>\n            <goals>\n              <goal>install-node-and-yarn</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>install node and npm</id>\n            <phase>initialize</phase>\n            <goals>\n              <goal>install-node-and-npm</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>yarn run init</id>\n            <goals>\n              <goal>yarn</goal>\n            </goals>\n            <configuration>\n              <arguments>run init</arguments>\n            </configuration>\n          </execution>\n          <execution>\n            <id>lock-treatment-tool execution</id>\n            <phase>initialize</phase>\n            <goals>\n              <goal>npm</goal>\n            </goals>\n            <configuration>\n              <arguments>exec @kie/lock-treatment-tool@${version.lock-treatment-tool} --</arguments>\n            </configuration>\n          </execution>\n          <execution>\n            <id>yarn run build:prod</id>\n            <goals>\n              <goal>yarn</goal>\n            </goals>\n            <configuration>\n              <arguments>run build:prod</arguments>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>copy-logo-component</id>\n            <phase>prepare-package</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>\n                ${project.build.outputDirectory}/${dashbuilder.internal.components.root}/logo-provided\n              </outputDirectory>\n              <resources>\n                <resource>\n                  <directory>packages/logo-component/dist/</directory>\n                  <filtering>false</filtering>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-process-heatmap-component</id>\n            <phase>prepare-package</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n\n              <outputDirectory>\n                ${project.build.outputDirectory}/${dashbuilder.internal.components.root}/process-heatmap-provided\n              </outputDirectory>\n              <resources>\n                <resource>\n                  <directory>packages/process-heatmap-component/dist/</directory>\n                  <filtering>false</filtering>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-processes-heatmaps-component</id>\n            <phase>prepare-package</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n\n              <outputDirectory>\n                ${project.build.outputDirectory}/${dashbuilder.internal.components.root}/processes-heatmaps-provided\n              </outputDirectory>\n              <resources>\n                <resource>\n                  <directory>packages/processes-heatmaps-component/dist/</directory>\n                  <filtering>false</filtering>\n                </resource>\n              </resources>\n            </configuration>\n          </execution> \n          <execution>\n            <id>copy-time-series-component</id>\n            <phase>prepare-package</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n\n              <outputDirectory>\n                ${project.build.outputDirectory}/${dashbuilder.internal.components.root}/time-series-provided\n              </outputDirectory>\n              <resources>\n                <resource>\n                  <directory>packages/time-series-component/dist/</directory>\n                  <filtering>false</filtering>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>          \n        </executions>\n      </plugin>\n    </plugins>\n    <pluginManagement>\n      <plugins>\n        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->\n        <plugin>\n          <groupId>org.eclipse.m2e</groupId>\n          <artifactId>lifecycle-mapping</artifactId>\n          <version>1.0.0</version>\n          <configuration>\n            <lifecycleMappingMetadata>\n              <pluginExecutions>\n                <pluginExecution>\n                  <pluginExecutionFilter>\n                    <groupId>org.apache.maven.plugins</groupId>\n                    <artifactId>maven-antrun-plugin</artifactId>\n                    <versionRange>[1.8,)</versionRange>\n                    <goals>\n                      <goal>run</goal>\n                    </goals>\n                  </pluginExecutionFilter>\n                  <action>\n                    <ignore></ignore>\n                  </action>\n                </pluginExecution>\n              </pluginExecutions>\n            </lifecycleMappingMetadata>\n          </configuration>\n        </plugin>\n      </plugins>\n    </pluginManagement>\n  </build>\n</project>"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/prettier.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nmodule.exports = {\n    printWidth: 120\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/src/main/java/org/dashbuilder/components/internal/ProvidedComponentInfo.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.components.internal;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Properties;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\nimport java.util.stream.Collectors;\n\n/**\n * Access internal component information and expose during runtime.\n *\n */\npublic class ProvidedComponentInfo {\n\n    Logger logger = Logger.getLogger(ProvidedComponentInfo.class.getName());\n\n    private static final String DASHBUILDER_COMPONENTS_PROPERTIES = \"/dashbuilder-components.properties\";\n    private static final String DASHBUILDER_COMPONENTS_LIST_PROP = \"dashbuilder.internal.components.list\";\n    private static final String DASHBUILDER_COMPONENTS_ROOT_PROP = \"dashbuilder.internal.components.root\";\n\n    private static ProvidedComponentInfo instance;\n\n    private List<String> internalComponentsList = Collections.emptyList();\n\n    private String internalComponentsRootPath = null;\n\n    ProvidedComponentInfo() {}\n\n    public static ProvidedComponentInfo get() {\n        if (instance == null) {\n            instance = new ProvidedComponentInfo();\n            instance.loadProperties(DASHBUILDER_COMPONENTS_PROPERTIES);\n        }\n        return instance;\n    }\n\n    void loadProperties(String resourcePath) {\n        InputStream is = this.getClass().getResourceAsStream(resourcePath);\n        if (is == null) {\n            logger.warning(\"Not able to find internal components properties file.\");\n            return;\n        }\n        try {\n            Properties properties = new Properties();\n            properties.load(is);\n            loadInternalComponentsList(properties);\n            loadInternalComponentsRootDir(properties);\n        } catch (IOException e) {\n            logger.warning(\"Not able to load internal components properties file.\");\n        }\n\n    }\n\n    private void loadInternalComponentsRootDir(Properties properties) {\n        internalComponentsRootPath = properties.getProperty(DASHBUILDER_COMPONENTS_ROOT_PROP);\n        if (internalComponentsRootPath == null || internalComponentsRootPath.trim().isEmpty()) {\n            logger.warning(\"Internal components root not configured.\");\n        }\n\n    }\n\n    private void loadInternalComponentsList(Properties properties) {\n        String componentsListStr = properties.getProperty(DASHBUILDER_COMPONENTS_LIST_PROP);\n        if (componentsListStr == null || componentsListStr.trim().isEmpty()) {\n            logger.warning(\"Internal components list is empty\");\n        } else {\n            this.internalComponentsList = Arrays.stream(componentsListStr.split(\"\\\\,\")).collect(Collectors.toList());\n            logger.log(Level.INFO, () -> \"Registered internal dashbuilder components: \" + internalComponentsList);\n        }\n    }\n\n    public List<String> getInternalComponentsList() {\n        return internalComponentsList;\n    }\n\n    public String getInternalComponentsRootPath() {\n        return internalComponentsRootPath;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/src/test/java/org/dashbuilder/components/internal/InternalComponentsInfoTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.components.internal;\n\nimport java.util.List;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\n/**\n * Access internal component information and expose during runtime.\n *\n */\npublic class InternalComponentsInfoTest {\n\n    @Test\n    public void testMissingPropertiesFile() {\n        ProvidedComponentInfo internalComponentsInfo = new ProvidedComponentInfo();\n        internalComponentsInfo.loadProperties(\"do not exist\");\n        List<String> components = internalComponentsInfo.getInternalComponentsList();\n        assertTrue(components.isEmpty());\n        assertNull(internalComponentsInfo.getInternalComponentsRootPath());\n    }\n\n    @Test\n    public void testFoundPropertiesFile() {\n        ProvidedComponentInfo internalComponentsInfo = ProvidedComponentInfo.get();\n        List<String> components = internalComponentsInfo.getInternalComponentsList();\n        assertTrue(components.contains(\"c1\"));\n        assertTrue(components.contains(\"c2\"));\n        assertEquals(\"path/to/components\", internalComponentsInfo.getInternalComponentsRootPath());\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/src/test/resources/dashbuilder-components.properties",
    "content": "dashbuilder.internal.components.root=path/to/components\ndashbuilder.internal.components.list=c1,c2"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/tsconfig.json",
    "content": "{\n  \"exclude\": [\"./**/node_modules\", \"./**/__tests__\"],\n  \"compilerOptions\": {\n    \"lib\": [\"es6\", \"dom\", \"es2018.promise\"],\n    \"target\": \"es5\",\n    \"declaration\": true,\n    \"sourceMap\": true,\n    \"noImplicitAny\": true,\n    \"noImplicitThis\": true,\n    \"strictNullChecks\": true,\n    \"experimentalDecorators\": true,\n    \"downlevelIteration\": true,\n    \"jsx\": \"react\"\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/tslint.json",
    "content": "{\n  \"defaultSeverity\": \"error\",\n  \"extends\": [\n    \"tslint:recommended\",\n    \"tslint-react\",\n    \"tslint-config-prettier\"\n  ],\n  \"jsRules\": {},\n  \"rules\": {\n    \"jsx-no-multiline-js\": false,\n    \"ordered-imports\": false,\n    \"object-literal-sort-keys\": false,\n    \"no-console\": false,\n    \"interface-name\": [\n      true,\n      \"never-prefix\"\n    ],\n    \"max-classes-per-file\": false,\n    \"jsx-no-lambda\": false,\n    \"member-ordering\": [\n      true,\n      {\n        \"order\": [\n          \"static-field\",\n          \"instance-field\",\n          \"constructor\",\n          \"instance-method\",\n          \"static-method\"\n        ]\n      }\n    ],\n    \"variable-name\": [\n      true,\n      \"ban-keywords\",\n      \"check-format\",\n      \"allow-snake-case\",\n      \"allow-pascal-case\",\n      \"allow-leading-underscore\"\n    ],\n    \"comment-format\": false\n  },\n  \"rulesDirectory\": []\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-js/webpack.common.config.js",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst path = require(\"path\");\n\nmodule.exports = {\n  mode: \"development\",\n  devtool: \"inline-source-map\",\n  output: {\n    path: path.resolve(\"./dist\"),\n    filename: \"[name].js\"\n  },\n  stats: {\n    excludeModules: true\n  },\n  performance: {\n    maxAssetSize: 30000000,\n    maxEntrypointSize: 30000000\n  },\n  resolve: {\n    extensions: [\".tsx\", \".ts\", \".js\", \".jsx\"],\n    modules: [path.resolve(\"../../node_modules\"), path.resolve(\"./node_modules\"), path.resolve(\"./src\")]\n  },\n  module: {\n    rules: [\n      {\n        test: /\\.tsx?$/,\n        loader: \"ts-loader\"\n      }\n    ]\n  }\n};\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!-- ~ Copyright 2014 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n\tthe Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n\texcept in compliance with the License. ~ You may obtain a copy of the License \n\tat ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n\tapplicable law or agreed to in writing, software ~ distributed under the \n\tLicense is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n\tOF ANY KIND, either express or implied. ~ See the License for the specific \n\tlanguage governing permissions and ~ limitations under the License. -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\t<modelVersion>4.0.0</modelVersion>\n\t<parent>\n\t\t<groupId>org.dashbuilder</groupId>\n\t\t<artifactId>dashbuilder-shared</artifactId>\n\t\t<version>7.75.0-SNAPSHOT</version>\n\t</parent>\n\n\t<artifactId>dashbuilder-kie-server-api</artifactId>\n\t<packaging>jar</packaging>\n\n\t<name>Dashbuilder Kie Server API</name>\n\t<description>Dashbuilder Kie Server API without BC dependencies</description>\n\n\t<dependencies>\n\t\t<dependency>\n\t\t\t<groupId>javax.validation</groupId>\n\t\t\t<artifactId>validation-api</artifactId>\n\t\t\t<scope>provided</scope>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.kie.soup</groupId>\n\t\t\t<artifactId>kie-soup-dataset-api</artifactId>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.kie.soup</groupId>\n\t\t\t<artifactId>kie-soup-dataset-sql</artifactId>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-bus</artifactId>\n\t\t</dependency>\n\t\t<dependency>\n\t\t\t<groupId>org.jboss.errai</groupId>\n\t\t\t<artifactId>errai-common</artifactId>\n\t\t</dependency>\n\t</dependencies>\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/ConsoleDataSetLookup.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetOp;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ConsoleDataSetLookup extends DataSetLookup {\n\n    private String serverTemplateId;\n\n    public static DataSetLookup fromInstance(DataSetLookup orig,\n                                             String serverTemplateId) {\n        ConsoleDataSetLookup clone = new ConsoleDataSetLookup();\n        clone.setDataSetUUID(orig.getDataSetUUID());\n        clone.setRowOffset(orig.getRowOffset());\n        clone.setNumberOfRows(orig.getNumberOfRows());\n        for (DataSetOp dataSetOp : orig.getOperationList()) {\n            clone.getOperationList().add(dataSetOp.cloneInstance());\n        }\n        clone.setServerTemplateId(serverTemplateId);\n        return clone;\n    }\n\n    public String getServerTemplateId() {\n        return serverTemplateId;\n    }\n\n    public void setServerTemplateId(String serverTemplateId) {\n        this.serverTemplateId = serverTemplateId;\n    }\n\n    @Override\n    public DataSetLookup cloneInstance() {\n        return fromInstance(super.cloneInstance(),\n                            getServerTemplateId());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/KieServerConnectionInfo.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport java.util.Optional;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Kie Server Connection information\n *\n */\n@Portable\npublic class KieServerConnectionInfo {\n\n    private Optional<String> location;\n    private Optional<String> user;\n    private Optional<String> password;\n    private Optional<String> token;\n    private boolean replaceQuery;\n\n    public KieServerConnectionInfo(@MapsTo(\"location\") Optional<String> location,\n                                   @MapsTo(\"user\") Optional<String> user,\n                                   @MapsTo(\"password\") Optional<String> password,\n                                   @MapsTo(\"token\") Optional<String> token,\n                                   @MapsTo(\"replaceQuery\") boolean replaceQuery) {\n        this.location = location;\n        this.user = user;\n        this.password = password;\n        this.token = token;\n        this.replaceQuery = replaceQuery;\n    }\n\n    public Optional<String> getLocation() {\n        return location;\n    }\n\n    public Optional<String> getUser() {\n        return user;\n    }\n\n    public Optional<String> getPassword() {\n        return password;\n    }\n\n    public Optional<String> getToken() {\n        return token;\n    }\n    \n    public boolean isReplaceQuery() {\n        return replaceQuery;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/KieServerConnectionInfoProvider.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface KieServerConnectionInfoProvider {\n\n    Optional<KieServerConnectionInfo> get(String name, String serverTemplate);\n\n    List<String> serverTemplates();\n\n    KieServerConnectionInfo verifiedConnectionInfo(RemoteDataSetDef def);\n    \n    Optional<KieServerConnectionInfo> getDefault();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/RemoteDataSetDef.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport javax.validation.constraints.NotNull;\nimport javax.validation.constraints.Size;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RemoteDataSetDef extends SQLDataSetDef {\n\n    @NotNull(groups = {RemoteDataSetDefValidation.class})\n    @Size(min = 1, groups = {RemoteDataSetDefValidation.class})\n    protected String queryTarget;\n\n    @NotNull(groups = {RemoteDataSetDefValidation.class})\n    @Size(min = 1, groups = {RemoteDataSetDefValidation.class})\n    protected String serverTemplateId;\n    \n    protected String queryName;\n\n    public RemoteDataSetDef() {\n        super.setProvider(new RuntimeKieServerDataSetProviderType());\n    }\n\n    public String getQueryTarget() {\n        return queryTarget;\n    }\n\n    public void setQueryTarget(String queryTarget) {\n        this.queryTarget = queryTarget;\n    }\n\n    public String getServerTemplateId() {\n        return serverTemplateId;\n    }\n\n    public void setServerTemplateId(String serverTemplateId) {\n        this.serverTemplateId = serverTemplateId;\n    }\n    \n    public String getQueryName() {\n        return queryName;\n    }\n    \n    public void setQueryName(String queryName) {\n        this.queryName = queryName;\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + ((queryTarget == null) ? 0 : queryTarget.hashCode());\n        result = prime * result + ((serverTemplateId == null) ? 0 : serverTemplateId.hashCode());\n        result = prime * result + ((queryName == null) ? 0 : queryName.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj)\n            return true;\n        if (!super.equals(obj))\n            return false;\n        if (getClass() != obj.getClass())\n            return false;\n        RemoteDataSetDef other = (RemoteDataSetDef) obj;\n        if (queryTarget == null) {\n            if (other.queryTarget != null)\n                return false;\n        } else if (!queryTarget.equals(other.queryTarget))\n            return false;\n        if (serverTemplateId == null) {\n            if (other.serverTemplateId != null)\n                return false;\n        } else if (!serverTemplateId.equals(other.serverTemplateId))\n            return false;\n        if (queryName == null) {\n            if (other.queryName != null)\n                return false;\n        } else if (!queryName.equals(other.queryName))\n            return false;\n        return true;\n    }\n\n    @Override\n    public DataSetDef clone() {\n        RemoteDataSetDef def = new RemoteDataSetDef();\n        clone(def);\n        def.setQueryTarget(getQueryTarget());\n        def.setServerTemplateId(getServerTemplateId());\n        def.setDbSQL(getDbSQL());\n        def.setDataSource(getDataSource());\n        def.setQueryName(getQueryName());\n        return def;\n    }\n\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        out.append(\"UUID=\").append(UUID).append(\"\\n\");\n        out.append(\"Provider=\").append(provider).append(\"\\n\");\n        out.append(\"Public=\").append(isPublic).append(\"\\n\");\n        out.append(\"Push enabled=\").append(pushEnabled).append(\"\\n\");\n        out.append(\"Push max size=\").append(pushMaxSize).append(\" Kb\\n\");\n        if (refreshTime != null) {\n            out.append(\"Refresh time=\").append(refreshTime).append(\"\\n\");\n            out.append(\"Refresh always=\").append(refreshAlways).append(\"\\n\");\n        }\n        out.append(\"Data source=\").append(dataSource).append(\"\\n\");\n        out.append(\"Query target=\").append(queryTarget).append(\"\\n\");\n        out.append(\"Query id=\").append(queryName).append(\"\\n\");\n        out.append(\"Server template id=\").append(serverTemplateId).append(\"\\n\");\n        out.append(\"DB SQL=\").append(dbSQL).append(\"\\n\");\n        out.append(\"Get all columns=\").append(allColumnsEnabled).append(\"\\n\");\n        out.append(\"Cache enabled=\").append(cacheEnabled).append(\"\\n\");\n        out.append(\"Cache max rows=\").append(cacheMaxRows).append(\" Kb\\n\");\n        return out.toString();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/RemoteDataSetDefValidation.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\npublic interface RemoteDataSetDefValidation {\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/RemoteDefJSONMarshaller.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshallerExt;\nimport org.dashbuilder.json.JsonObject;\n\nimport static org.dashbuilder.dataset.json.DataSetDefJSONMarshaller.ALL_COLUMNS;\nimport static org.dashbuilder.dataset.json.DataSetDefJSONMarshaller.isBlank;\n\npublic class RemoteDefJSONMarshaller implements DataSetDefJSONMarshallerExt<RemoteDataSetDef> {\n\n    public static RemoteDefJSONMarshaller INSTANCE = new RemoteDefJSONMarshaller();\n\n    public static final String QUERY_TARGET = \"queryTarget\";\n    public static final String SERVER_TEMPLATE_ID = \"serverTemplateId\";\n    public static final String DATA_SOURCE = \"dataSource\";\n    public static final String DB_SCHEMA = \"dbSchema\";\n    public static final String DB_SQL = \"dbSQL\";\n\n\n    @Override\n    public void fromJson(RemoteDataSetDef def, JsonObject json) {\n        String queryTarget = json.getString(QUERY_TARGET);\n        String serverTemplateId = json.getString(SERVER_TEMPLATE_ID);\n        String dataSource = json.getString(DATA_SOURCE);\n        String dbSchema = json.getString(DB_SCHEMA);\n        String dbSQL = json.getString(DB_SQL);\n\n        if (!isBlank(queryTarget)) {\n            def.setQueryTarget(queryTarget);\n        }\n        if (!isBlank(serverTemplateId)) {\n            def.setServerTemplateId(serverTemplateId);\n        }\n        if (!isBlank(dataSource)) {\n            def.setDataSource(dataSource);\n        }\n        if (!isBlank(dbSchema)) {\n            def.setDbSchema(dbSchema);\n        }\n        if (!isBlank(dbSQL)) {\n            def.setDbSQL(dbSQL);\n        }\n    }\n\n    @Override\n    public void toJson(RemoteDataSetDef dataSetDef, JsonObject json) {\n        // Data source.\n        json.put(DATA_SOURCE, dataSetDef.getDataSource());\n\n        // Schema.\n        json.put(DB_SCHEMA, dataSetDef.getDbSchema());\n\n        // Query.\n        if (dataSetDef.getDbSQL() != null) {\n            json.put(DB_SQL, dataSetDef.getDbSQL());\n        }\n\n        json.put(QUERY_TARGET, dataSetDef.getQueryTarget());\n        \n        json.put(SERVER_TEMPLATE_ID, dataSetDef.getServerTemplateId());\n        \n        // All columns flag.\n        json.put(ALL_COLUMNS, dataSetDef.isAllColumnsEnabled());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/java/org/dashbuilder/kieserver/RuntimeKieServerDataSetProviderType.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.kieserver;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.json.DataSetDefJSONMarshallerExt;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RuntimeKieServerDataSetProviderType implements DataSetProviderType<RemoteDataSetDef> {\n\n    public static final String NAME = \"REMOTE\";\n\n    public RuntimeKieServerDataSetProviderType() {\n\n    }\n\n    @Override\n    public String getName() {\n        return NAME;\n    }\n\n    @Override\n    public RemoteDataSetDef createDataSetDef() {\n        RemoteDataSetDef def = new RemoteDataSetDef();\n        def.setProvider(this);\n        def.setDataSource(\"${org.kie.server.persistence.ds}\");\n        return def;\n    }\n\n    @Override\n    public DataSetDefJSONMarshallerExt<RemoteDataSetDef> getJsonMarshaller() {\n        return RemoteDefJSONMarshaller.INSTANCE;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (!(obj instanceof RuntimeKieServerDataSetProviderType)) {\n            return false;\n        }\n        return getName().equals(((RuntimeKieServerDataSetProviderType) obj).getName());\n    }\n\n    @Override\n    public int hashCode() {\n        return getName().hashCode();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-kie-server-api/src/main/resources/org/dashbuilder/DashbuilderKieServerAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!-- ~ Copyright 2014 Red Hat, Inc. and/or its affiliates. ~ ~ Licensed under \n\tthe Apache License, Version 2.0 (the \"License\"); ~ you may not use this file \n\texcept in compliance with the License. ~ You may obtain a copy of the License \n\tat ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by \n\tapplicable law or agreed to in writing, software ~ distributed under the \n\tLicense is distributed on an \"AS IS\" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS \n\tOF ANY KIND, either express or implied. ~ See the License for the specific \n\tlanguage governing permissions and ~ limitations under the License. -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\t<inherits name=\"org.jboss.errai.common.ErraiCommon\" />\n\t<inherits name=\"org.jboss.errai.bus.ErraiBus\" />\n\t<inherits name=\"org.dashbuilder.DatasetAPI\" />\n\t<source path=\"kieserver\" />\n</module>"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-shared</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-navigation-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Navigation API</name>\n  <description>Dashbuilder Navigation API shared between client and server</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-json</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavDivider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\n/**\n * A {@link NavItem} that represents a divider\n */\npublic interface NavDivider extends NavItem {\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport org.dashbuilder.navigation.impl.NavFactoryImpl;\n\n/**\n * A factory interface for the creation of {@link NavTree} and {@link NavItem} instances.\n */\npublic interface NavFactory {\n\n    NavFactory[] _instance = new NavFactory[] {new NavFactoryImpl()};\n\n    static NavFactory get() {\n        return _instance[0];\n    }\n\n    static void set(NavFactory factory) {\n        _instance[0] = factory;\n    }\n\n    NavTree createNavTree(NavItem navItem);\n\n    NavTree createNavTree();\n\n    NavGroup createNavGroup();\n\n    NavGroup createNavGroup(NavTree navTree);\n\n    NavItem createNavItem();\n\n    NavDivider createDivider();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavGroup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport java.util.List;\n\n/**\n * A {@link NavItem} that contains a list of children.\n */\npublic interface NavGroup extends NavItem {\n\n    /**\n     * Get the children items\n     */\n    List<NavItem> getChildren();\n\n    /**\n     * Change the children list\n     */\n    void setChildren(List<NavItem> items);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavItem.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\n/**\n * A navigation item is a way to classify different assets, like for instance, perspectives. A tag can be referenced by other\n * tags, either as a parent or as a child. The links between different tags creates a {@link NavTree} structure\n * that can be used to provide navigation services across the different assets referenced by the tags in the tree.\n */\npublic interface NavItem {\n\n    enum Type {\n        ITEM,\n        GROUP,\n        DIVIDER;\n    }\n\n    /**\n     * A unique id within the same {@link NavTree}\n     */\n    String getId();\n\n    /**\n     * Change the item's id\n     */\n    void setId(String id);\n\n    /**\n     * The item's name\n     */\n    String getName();\n\n    /**\n     * Change the item's name\n     */\n    void setName(String  name);\n\n    /**\n     * A brief description of the item (optional, if not provided the name is used instead)\n     */\n    String getDescription();\n\n    /**\n     * Change the item's description\n     */\n    void setDescription(String description);\n\n    /**\n     * The item's {@link Type}\n     */\n    Type getType();\n\n    /**\n     * Get the parent of this item (if any)\n     *\n     * @return The item this one is a child of. Or null if this is a root item\n     */\n    NavGroup getParent();\n\n    /**\n     * Change the item's parent\n     */\n    void setParent(NavGroup parent);\n\n    /**\n     * Flag indicating if the item can be modified from a tree once added\n     */\n    boolean isModifiable();\n\n    /**\n     * Change the item's modifiable flag\n     */\n    void setModifiable(boolean modifiable);\n\n    /**\n     * An optional string that can be used to attach contextual information, like an external reference for instance.\n     */\n    String getContext();\n\n    /**\n     * Change the item's context attribute\n     */\n    void setContext(String ctx);\n\n    /**\n     * Entry point for visitor interfaces\n     */\n    void accept(NavItemVisitor visitor);\n\n    /**\n     * Creates a brand new copy of this item\n     */\n    NavItem cloneItem();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavItemContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport java.util.Collection;\n\nimport org.dashbuilder.navigation.impl.NavItemContextImpl;\n\n/**\n * An interface for manipulating a {@link NavItem#getContext()} as it was a collection of attribute/value pairs.\n */\npublic interface NavItemContext {\n\n    static NavItemContext create() {\n        return new NavItemContextImpl();\n    }\n\n    static NavItemContext get(String ctx) {\n        return new NavItemContextImpl(ctx);\n    }\n\n    static NavItemContext get(NavItem navItem) {\n        return new NavItemContextImpl(navItem.getContext());\n    }\n\n    void init(String ctx);\n\n    Collection<String> getPropertyIds();\n\n    String getProperty(String id);\n\n    String removeProperty(String id);\n\n    NavItemContext setProperty(String id, String value);\n\n    /**\n     * Check if this context contains all property-value pairs of some other context.\n     *\n     * @param cxt\n     * @return true iff all the properties of ctx are also present in this context and have the same value.\n     */\n    boolean includesPropertiesOf(NavItemContext cxt);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavItemVisitor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\n/**\n * {@link NavItem} visitor interface\n */\npublic interface NavItemVisitor {\n\n    /**\n     * Visit the given {@link NavGroup}.\n     *\n     * @param group The node to visit\n     */\n    void visitGroup(NavGroup group);\n\n    /**\n     * Visit the given {@link NavItem}.\n     *\n     * @param item The node to visit\n     */\n    void visitItem(NavItem item);\n\n    /**\n     * Visit the given {@link NavDivider}.\n     *\n     * @param divider The node to visit\n     */\n    void visitDivider(NavDivider divider);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/NavTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport java.util.List;\n\n/**\n * A tree like structure containing a list of parent and children nodes where every node is a {@link NavItem} instance.\n */\npublic interface NavTree {\n\n    /**\n     * The list of items belonging to the first tree level\n     *\n     * @return A list of {@link NavItem} instances\n     */\n    List<NavItem> getRootItems();\n\n    /**\n     * Get an item given its id. All the tree nodes are compared, no matter its level.\n     *\n     * @param id The unique identifier of the item\n     * @return The first instance found\n     */\n    NavItem getItemById(String id);\n\n    /**\n     * Given an existing item, it creates a brand new subtree where the item (or its children in case of groups)\n     * is taken as the root node.\n     *\n     * @param id The unique identifier of the item\n     * @return The first instance found\n     */\n    NavTree getItemAsTree(String id);\n\n    /**\n     * Get the items that match the given context\n     *\n     * @param ctx The context to search for\n     * @return The list of nav items that match the target context\n     */\n    List<NavItem> searchItems(NavItemContext ctx);\n\n    /**\n     * Creates and register a brand new {@link NavGroup} item.\n     *\n     * @param id The unique id of the item\n     * @param name The item's name\n     * @param description A brief description of the item\n     * @param groupId The identifier of an existing node in the tree where to append the newly created item as a child\n     * @param modifiable Flag indicating if the item can be modified once added\n     *\n     * @return The instance just created\n     */\n    NavGroup addGroup(String id, String name, String description, String groupId, boolean modifiable);\n\n    /**\n     * Creates and register a brand new {@link NavItem} item.\n     *\n     * @param id The unique id of the item\n     * @param name The item's name\n     * @param description A brief description of the item\n     * @param groupId The identifier of an existing node in the tree where to append the newly created item as a child\n     * @param modifiable Flag indicating if the item can be modified once added\n     * @param context An string that contains item related information, like an external reference for instance.\n     *\n     * @return The instance just created\n     */\n    NavItem addItem(String id, String name, String description, String groupId, boolean modifiable, String context);\n\n    /**\n     * Creates and register a brand new {@link NavDivider} item.\n     *\n     * @param groupId The identifier of an existing node in the tree where to append the newly created item as a child\n     * @param modifiable Flag indicating if the item can be modified once added\n     *\n     * @return The instance just created\n     */\n    NavDivider addDivider(String groupId, boolean modifiable);\n\n    /**\n     * Delete an existing item including all its children.\n     *\n     * @param id The unique identifier of the item\n     * @return The instance removed or null if the instance is not found\n     */\n    NavItem deleteItem(String id);\n\n    /**\n     * Updates the name attribute of an existing item\n     *\n     * @param id The unique id of the item\n     * @param name A brief description of the item\n     *\n     * @return The instance being updated\n     */\n    NavItem setItemName(String id, String name);\n\n    /**\n     * Updates the description attribute of an existing item\n     *\n     * @param id The unique id of the item\n     * @param description A brief description of the item\n     *\n     * @return The instance being updated\n     */\n    NavItem setItemDescription(String id, String description);\n\n    /**\n     * Updates the modifiable flag attribute of an existing item\n     *\n     * @param id The unique id of the item\n     * @param modifiable Flag indicating if the item can be modified\n     *\n     * @return The instance being updated\n     */\n    NavItem setItemModifiable(String id, boolean modifiable);\n\n    /**\n     * Updates the perspective attached to an existing perspective link\n     *\n     * @param id The unique id of the item\n     * @param context The item's context\n     *\n     * @return The item being updated\n     */\n    NavItem setItemContext(String id, String context);\n\n    /**\n     * Changes the location of an item in the tree\n     *\n     * @param id The unique id of the item\n     * @param newParentId The identifier of an existing node in the tree where to move the item\n     *\n     * @return The instance being updated\n     */\n    NavItem moveItem(String id, String newParentId);\n\n    /**\n     * Move the specified item to the first position within its parent's children list\n     *\n     * @param id The unique id of the item\n     */\n    void moveItemFirst(String id);\n\n    /**\n     * Move the specified item to the last position within its parent's children list\n     *\n     * @param id The unique id of the item\n     */\n    void moveItemLast(String id);\n\n    /**\n     * Move an item one position up in its parent's children list\n     *\n     * @param id The unique id of the item\n     */\n    void moveItemUp(String id);\n\n    /**\n     * Move an item one position down in its parent's children list\n     *\n     * @param id The unique id of the item\n     */\n    void moveItemDown(String id);\n\n    /**\n     * Entry point for visitor interfaces\n     */\n    void accept(NavItemVisitor visitor);\n\n    /**\n     * Creates a brand new copy of this tree\n     */\n    NavTree cloneTree();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/event/NavTreeChangedEvent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.event;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Event fired when the application navigation tree is changed\n */\n\n@Portable\npublic class NavTreeChangedEvent {\n\n    private NavTree navTree;\n\n    public NavTreeChangedEvent() {\n\n    }\n\n    public NavTreeChangedEvent(NavTree navTree) {\n        this.navTree = navTree;\n    }\n\n    public NavTree getNavTree() {\n        return navTree;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/event/PerspectivePluginsChangedEvent.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.event;\n\n/**\n * Event fired when a perspective plugin is either added, renamed or deleted.\n */\npublic class PerspectivePluginsChangedEvent {\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavDividerImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemVisitor;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NavDividerImpl extends NavItemImpl implements NavDivider {\n\n    public NavDividerImpl() {\n        type = Type.DIVIDER;\n    }\n\n    @Override\n    public void accept(NavItemVisitor visitor) {\n        visitor.visitDivider(this);\n    }\n\n    @Override\n    public NavItem cloneItem() {\n        NavDividerImpl clone = new NavDividerImpl();\n        clone.id = this.id;\n        clone.parent = this.parent;\n        clone.name = this.name;\n        clone.description = this.description;\n        clone.modifiable = this.modifiable;\n        clone.context = this.context;\n        return clone;\n    }\n\n    public String toString() {\n        return super.toString(\"DIVIDER\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavFactoryImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\n\npublic class NavFactoryImpl implements NavFactory {\n\n    @Override\n    public NavTree createNavTree(NavItem navItem) {\n        if (navItem instanceof NavGroup) {\n            NavGroup root = (NavGroup) navItem.cloneItem();\n            root.setParent(null);\n            root.getChildren().forEach(e -> e.setParent(null));\n            return new NavTreeImpl(root);\n        }\n        else {\n            NavItem i = navItem.cloneItem();\n            i.setParent(null);\n            NavTreeImpl tree = new NavTreeImpl();\n            tree.getRootItems().add(i);\n            return tree;\n        }\n    }\n\n    @Override\n    public NavTree createNavTree() {\n        return new NavTreeImpl();\n    }\n\n    @Override\n    public NavGroup createNavGroup() {\n        return new NavGroupImpl();\n    }\n\n    @Override\n    public NavGroup createNavGroup(NavTree navTree) {\n        NavGroup navGroup = createNavGroup();\n        navGroup.setChildren(navTree.cloneTree().getRootItems());\n        navGroup.getChildren().forEach(child -> child.setParent(navGroup));\n        return navGroup;\n    }\n\n    @Override\n    public NavItem createNavItem() {\n        return new NavItemImpl();\n    }\n\n    @Override\n    public NavDivider createDivider() {\n        return new NavDividerImpl();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavGroupImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemVisitor;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NavGroupImpl extends NavItemImpl implements NavGroup {\n\n    List<NavItem> children = new ArrayList<>();\n\n    public NavGroupImpl() {\n        type = Type.GROUP;\n    }\n\n    @Override\n    public List<NavItem> getChildren() {\n        return children;\n    }\n\n    @Override\n    public void setChildren(List<NavItem> children) {\n        this.children = children;\n    }\n\n    @Override\n    public void accept(NavItemVisitor visitor) {\n        visitor.visitGroup(this);\n        for (NavItem child : children) {\n            child.accept(visitor);\n        }\n    }\n\n    @Override\n    public NavItem cloneItem() {\n        NavGroupImpl clone = new NavGroupImpl();\n        clone.id = this.id;\n        clone.name = this.name;\n        clone.parent = this.parent;\n        clone.description = this.description;\n        clone.modifiable = this.modifiable;\n        clone.context = this.context;\n        for (NavItem child : children) {\n            NavItem childClone = child.cloneItem();\n            clone.children.add(childClone);\n            childClone.setParent(clone);\n        }\n        return clone;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder(super.toString(\"GROUP\"));\n        out.append(\"CHILDREN=[\");\n        children.forEach(i -> out.append(i.getId()).append(\" \"));\n        out.append(\"]\\n\");\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavItemContextImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.dashbuilder.navigation.NavItemContext;\n\npublic class NavItemContextImpl implements NavItemContext {\n\n    Map<String,String> ctxMap = new HashMap<>();\n\n    public NavItemContextImpl() {\n    }\n\n    public NavItemContextImpl(String ctx) {\n        init(ctx);\n    }\n\n    @Override\n    public void init(String ctx) {\n        ctxMap.clear();\n        if (ctx != null && ctx.length() > 0) {\n            // TODO: encoding\n            String[] tokens = ctx.split(\";\");\n            for(int i=0;i<tokens.length;i++) {\n                String[] pair = tokens[i].split(\"=\");\n                if (pair.length == 2) {\n                    ctxMap.put(pair[0], pair[1]);\n                }\n            }\n        }\n    }\n\n    @Override\n    public Collection<String> getPropertyIds() {\n        return ctxMap.keySet();\n    }\n\n    @Override\n    public String getProperty(String id) {\n        return ctxMap.get(id);\n    }\n\n    @Override\n    public String removeProperty(String id) {\n        return ctxMap.remove(id);\n    }\n\n    @Override\n    public NavItemContext setProperty(String id, String value) {\n        ctxMap.put(id, value);\n        return this;\n    }\n\n    @Override\n    public boolean includesPropertiesOf(NavItemContext ctx) {\n        for (String p : ctx.getPropertyIds()) {\n            String v1 = this.getProperty(p);\n            String v2 = ctx.getProperty(p);\n            if (v1 == null && v2 != null) {\n                return false;\n            }\n            if (v1 != null && !v1.equals(v2)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        ctxMap.keySet().forEach(k -> {\n            out.append(k).append(\"=\").append(ctxMap.get(k)).append(\";\");\n        });\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavItemImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemVisitor;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NavItemImpl implements NavItem {\n\n    String id = null;\n    String name = null;\n    String description = null;\n    NavGroup parent = null;\n    boolean modifiable = true;\n    String context = null;\n    Type type = Type.ITEM;\n\n    public NavItemImpl() {\n    }\n\n    public NavItemImpl(String id, String name, String description, NavGroup parent, boolean modifiable, String context) {\n        this.id = id;\n        this.name = name;\n        this.description = description;\n        this.parent = parent;\n        this.modifiable = modifiable;\n        this.context = context;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getDescription() {\n        return description;\n    }\n\n    @Override\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    @Override\n    public Type getType() {\n        return type;\n    }\n\n    @Override\n    public NavGroup getParent() {\n        return parent;\n    }\n\n    @Override\n    public void setParent(NavGroup parent) {\n        this.parent = parent;\n    }\n\n    public boolean isModifiable() {\n        return modifiable;\n    }\n\n    public void setModifiable(boolean modifiable) {\n        this.modifiable = modifiable;\n    }\n\n    @Override\n    public void accept(NavItemVisitor visitor) {\n        visitor.visitItem(this);\n    }\n\n    @Override\n    public String getContext() {\n        return context;\n    }\n\n    @Override\n    public void setContext(String context) {\n        this.context = context;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (id == null || obj == null || !(obj instanceof NavItem)) {\n            return false;\n        }\n        NavItem other = (NavItem) obj;\n        return id.equals(other.getId());\n    }\n\n    @Override\n    public NavItem cloneItem() {\n        NavItemImpl clone = new NavItemImpl();\n        clone.id = this.id;\n        clone.parent = this.parent;\n        clone.name = this.name;\n        clone.description = this.description;\n        clone.modifiable = this.modifiable;\n        clone.context = this.context;\n        return clone;\n    }\n\n    public String toString() {\n        return toString(\"ITEM\");\n    }\n\n    public String toString(String type) {\n        StringBuilder out = new StringBuilder();\n        out.append(type).append(\"=\").append(id).append(\"\\n\");\n        out.append(\"NAME=\").append(name).append(\"\\n\");\n        out.append(\"DESCRIPTION=\").append(description).append(\"\\n\");\n        out.append(\"DELETABLE=\").append(modifiable).append(\"\\n\");\n        out.append(\"PARENT=\").append(parent).append(\"\\n\");\n        out.append(\"CONTEXT=\").append(context).append(\"\\n\");\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavTreeBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport java.util.Stack;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavItemContext;\nimport org.dashbuilder.navigation.NavTree;\n\npublic class NavTreeBuilder {\n\n    NavFactory factory = NavFactory.get();\n    Stack<NavGroup> stack = new Stack<>();\n    NavGroup root = factory.createNavGroup();\n\n    public NavTreeBuilder() {\n        stack.push(root);\n    }\n\n    public NavTreeBuilder group(String id, String name, String description, boolean modifiable) {\n        NavGroup item = factory.createNavGroup();\n        item.setId(id);\n        item.setName(name);\n        item.setDescription(description);\n        item.setModifiable(modifiable);\n        stackGroup(item);\n        return this;\n    }\n\n    public NavTreeBuilder item(String id, String name, String description, boolean modifiable) {\n        return item(id, name, description, modifiable, (String) null);\n    }\n\n    public NavTreeBuilder item(String id, String name, String description, boolean modifiable, NavItemContext itemCtx) {\n        return item(id, name, description, modifiable, itemCtx != null ? itemCtx.toString() : null);\n    }\n\n    public NavTreeBuilder item(String id, String name, String description, boolean modifiable, String itemCtx) {\n        NavItem item = factory.createNavItem();\n        item.setId(id);\n        item.setName(name);\n        item.setDescription(description);\n        item.setModifiable(modifiable);\n        item.setContext(itemCtx);\n        stackItem(item);\n        return this;\n    }\n\n    public NavTreeBuilder divider() {\n        NavDivider item = factory.createDivider();\n        item.setId(Integer.toString(item.hashCode()));\n        stackItem(item);\n        return this;\n    }\n\n    public NavTreeBuilder endGroup() {\n        if (!stack.isEmpty()) {\n            stack.pop();\n        } else {\n            throw new IllegalStateException(\"Call group first\");\n        }\n        return this;\n    }\n\n    public NavTree build() {\n        return new NavTreeImpl(root);\n    }\n\n    private void stackGroup(NavGroup item) {\n        stackItem(item);\n        stack.push(item);\n    }\n\n    private void stackItem(NavItem item) {\n        NavGroup group = stack.peek();\n        item.setParent(group == root ? null : group);\n        group.getChildren().add(item);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/impl/NavTreeImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemContext;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.NavItemVisitor;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NavTreeImpl implements NavTree {\n\n    private NavGroup root;\n\n    public NavTreeImpl() {\n        root = NavFactory.get().createNavGroup();\n    }\n\n    public NavTreeImpl(NavGroup root) {\n        this.root = root;\n    }\n\n    public List<NavItem> getRootItems() {\n        return root.getChildren();\n    }\n\n    @Override\n    public NavItem getItemById(String id) {\n        return getItemById(id, root.getChildren());\n    }\n\n    private NavItem getItemById(String id, List<NavItem> navItemList) {\n        if (id == null) {\n            return null;\n        }\n        for (NavItem navItem : navItemList) {\n            if (navItem.getId() != null && navItem.getId().equals(id)) {\n                return navItem;\n            }\n            if (navItem instanceof NavGroup) {\n                NavItem child = getItemById(id, ((NavGroup) navItem).getChildren());\n                if (child != null) {\n                    return child;\n                }\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public NavTree getItemAsTree(String id) {\n        NavItem item = getItemById(id);\n        return item != null ? NavFactory.get().createNavTree(item) : null;\n    }\n\n    @Override\n    public List<NavItem> searchItems(NavItemContext ctx) {\n        return searchItems(ctx, getRootItems());\n    }\n\n    public List<NavItem> searchItems(NavItemContext ctx, List<NavItem> navItemList) {\n        List<NavItem> result = new ArrayList<>();\n        if (ctx == null) {\n            return result;\n        }\n        NavItemContext niCtx = NavItemContext.create();\n        for (NavItem navItem : navItemList) {\n            niCtx.init(navItem.getContext());\n\n            if (niCtx.includesPropertiesOf(ctx)) {\n                result.add(navItem);\n            }\n            if (navItem instanceof NavGroup) {\n                List<NavItem> children = searchItems(ctx, ((NavGroup) navItem).getChildren());\n                result.addAll(children);\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public NavGroup addGroup(String id, String name, String description, String parentId, boolean modifiable) {\n        NavGroup newNavItem = NavFactory.get().createNavGroup();\n        newNavItem.setId(id);\n        newNavItem.setName(name);\n        newNavItem.setDescription(description);\n        newNavItem.setModifiable(modifiable);\n\n        addItem(newNavItem, parentId);\n        return newNavItem;\n    }\n\n    @Override\n    public NavItem addItem(String id, String name, String description, String parentId, boolean modifiable, String context) {\n        NavItem newNavItem = NavFactory.get().createNavItem();\n        newNavItem.setId(id);\n        newNavItem.setName(name);\n        newNavItem.setDescription(description);\n        newNavItem.setModifiable(modifiable);\n        newNavItem.setContext(context);\n\n        addItem(newNavItem, parentId);\n        return newNavItem;\n    }\n\n    @Override\n    public NavDivider addDivider(String parentId, boolean modifiable) {\n        NavDivider newNavItem = NavFactory.get().createDivider();\n        newNavItem.setId(Integer.toString(newNavItem.hashCode()));\n        newNavItem.setModifiable(modifiable);\n\n        addItem(newNavItem, parentId);\n        return newNavItem;\n    }\n\n    private void addItem(NavItem item, String parentId) {\n\n        // Ensure the parent exists (if defined)\n        NavItem parent = getItemById(parentId);\n        if (parentId != null && parent == null) {\n            throw new RuntimeException(\"Parent '\" + parentId + \"' not found\");\n        }\n\n        // Ensure the parent is a group\n        if (parent != null && !(parent instanceof NavGroup)) {\n            throw new RuntimeException(\"Parent '\" + parentId + \"' is not a group\");\n        }\n\n        // Register the item\n        if (parent == null) {\n            item.setParent(null);\n            root.getChildren().add(item);\n        } else {\n            ((NavGroup) parent).getChildren().add(item);\n            item.setParent((NavGroup) parent);\n        }\n    }\n\n    @Override\n    public NavItem deleteItem(String id) {\n        NavItem navItem = getItemById(id);\n        if (navItem != null) {\n            if (navItem.getParent() == null) {\n                root.getChildren().remove(navItem);\n            } else {\n                navItem.getParent().getChildren().remove(navItem);\n                navItem.setParent(null);\n            }\n        }\n        return navItem;\n    }\n\n    @Override\n    public NavItem setItemName(String id, String name) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n        navItem.setName(name);\n        return navItem;\n    }\n\n    @Override\n    public NavItem setItemDescription(String id, String description) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n        navItem.setDescription(description);\n        return navItem;\n    }\n\n    @Override\n    public NavItem setItemModifiable(String id, boolean modifiable) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n        navItem.setModifiable(modifiable);\n        return navItem;\n    }\n\n    @Override\n    public NavItem setItemContext(String id, String context) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n        navItem.setContext(context);\n        return navItem;\n    }\n\n    @Override\n    public NavItem moveItem(String id, String newParentId) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n\n        // Ensure the new target parent exists\n        NavItem newParent = getItemById(newParentId);\n        if (newParent == null && newParentId != null) {\n            throw new RuntimeException(\"Parent not found: \" + newParentId);\n        }\n\n        // Ensure the parent is a group\n        if (newParent != null && !(newParent instanceof NavGroup)) {\n            throw new RuntimeException(\"Parent '\" + newParentId + \"' is not a group\");\n        }\n\n        // Avoid loops\n        if (newParentId != null && newParentId.equals(id)) {\n            throw new RuntimeException(\"The parent can't be the item itself: \" + newParentId);\n        }\n\n        // Do not move if nothing changes\n        String parentId = navItem.getParent() != null ? navItem.getParent().getId(): null;\n        if ((parentId == null && newParentId == null) ||\n            (parentId != null && newParentId != null && parentId.equals(newParentId))) {\n            return navItem;\n        }\n\n        // Do move\n        if (navItem.getParent() != null) {\n            navItem.getParent().getChildren().remove(navItem);\n        }\n        navItem.setParent(null);\n        if (newParent != null) {\n            ((NavGroup) newParent).getChildren().add(navItem);\n            navItem.setParent((NavGroup) newParent);\n        }\n\n        return navItem;\n    }\n\n    @Override\n    public void moveItemFirst(String id) {\n        changePosition(id, true, null);\n    }\n\n    @Override\n    public void moveItemLast(String id) {\n        changePosition(id, false, null);\n    }\n\n    @Override\n    public void moveItemUp(String id) {\n        changePosition(id, true, 1);\n    }\n\n    @Override\n    public void moveItemDown(String id) {\n        changePosition(id, false, 1);\n    }\n\n    public void changePosition(String id, boolean up, Integer npositions) {\n        NavItem navItem = getItemById(id);\n        if (navItem == null) {\n            throw new RuntimeException(\"Item not found: \" + id);\n        }\n        NavGroup parent = navItem.getParent();\n        List<NavItem> itemList = parent != null ? parent.getChildren() : getRootItems();\n        int idx = itemList.indexOf(navItem);\n        int newPos = npositions == null ? (up ? 0 : itemList.size()-1) : (up ? idx-npositions: idx+npositions);\n\n        if ((up && newPos < 0) || (!up && newPos > itemList.size()-1)) {\n            throw new RuntimeException(\"Item '\" + id + \"' position out of range (old=\" + idx + \", new=\" + newPos + \")\");\n        }\n\n        itemList.remove(idx);\n        itemList.add(newPos, navItem);\n    }\n\n    @Override\n    public void accept(NavItemVisitor visitor) {\n        for (NavItem item : root.getChildren()) {\n            item.accept(visitor);\n        }\n    }\n\n    @Override\n    public NavTree cloneTree() {\n        NavGroup rootClone = (NavGroup) this.root.cloneItem();\n        rootClone.getChildren().forEach(e -> e.setParent(null));\n        return new NavTreeImpl(rootClone);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/json/NavTreeJSONMarshaller.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.json;\n\nimport java.util.List;\n\nimport org.dashbuilder.json.Json;\nimport org.dashbuilder.json.JsonArray;\nimport org.dashbuilder.json.JsonException;\nimport org.dashbuilder.json.JsonObject;\nimport org.dashbuilder.navigation.NavFactory;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\n\npublic class NavTreeJSONMarshaller {\n\n    private static final String NAV_ITEM_ID = \"id\";\n    private static final String NAV_ITEM_TYPE = \"type\";\n    private static final String NAV_ITEM_NAME = \"name\";\n    private static final String NAV_ITEM_DESC = \"description\";\n    private static final String NAV_ITEM_MODIF = \"modifiable\";\n    private static final String NAV_ITEM_CTX = \"context\";\n    private static final String NAV_TREE_ROOT_ITEMS = \"root_items\";\n    private static final String NAV_GROUP_CHILDREN = \"children\";\n\n    private static NavTreeJSONMarshaller SINGLETON = new NavTreeJSONMarshaller();\n\n    public static NavTreeJSONMarshaller get() {\n        return SINGLETON;\n    }\n\n    // To Json\n\n    public JsonObject toJson(NavTree navTree) throws JsonException {\n        JsonObject json = Json.createObject();\n        if (navTree != null) {\n            json.put(NAV_TREE_ROOT_ITEMS, toJson(navTree.getRootItems()));\n        }\n        return json;\n    }\n\n    public JsonObject toJson(NavItem navItem) throws JsonException {\n        JsonObject json = Json.createObject();\n        if (navItem != null) {\n            json.put(NAV_ITEM_ID, navItem.getId());\n            json.put(NAV_ITEM_TYPE, navItem.getType().toString());\n\n            if (navItem.getType() != NavItem.Type.DIVIDER) {\n                json.put(NAV_ITEM_NAME, navItem.getName());\n                json.put(NAV_ITEM_DESC, navItem.getDescription());\n                json.put(NAV_ITEM_MODIF, navItem.isModifiable());\n                json.put(NAV_ITEM_CTX, navItem.getContext());\n\n                if (navItem.getType() == NavItem.Type.GROUP) {\n                    json.put(NAV_GROUP_CHILDREN, toJson(((NavGroup) navItem).getChildren()));\n\n                }\n            }\n        }\n        return json;\n    }\n\n    public JsonArray toJson(List<NavItem> navItemList) throws JsonException {\n        JsonArray json = Json.createArray();\n        if (navItemList != null) {\n            for (int i=0; i<navItemList.size(); i++) {\n                NavItem navItem = navItemList.get(i);\n                json.set(i, toJson(navItem));\n            }\n        }\n        return json;\n    }\n\n    // From Json\n\n    public NavTree fromJson(String jsonString) throws JsonException {\n        if (jsonString == null || jsonString.trim().isEmpty()) {\n            return null;\n        }\n        JsonObject json = Json.parse(jsonString);\n        return fromJson(json);\n    }\n\n    public NavTree fromJson(JsonObject json) throws JsonException {\n        if (json == null) {\n            return null;\n        }\n\n        NavTree navTree = NavFactory.get().createNavTree();\n        for (int i = 0; i < json.size(); i++) {\n            JsonArray rootItemArray = json.getArray(NAV_TREE_ROOT_ITEMS);\n            parseNavItemArray(rootItemArray, navTree.getRootItems(), null);\n        }\n        return navTree;\n    }\n\n    private void parseNavItemArray(JsonArray json, List<NavItem> targetList, NavGroup parent) throws JsonException {\n        if (json != null) {\n            for (int i = 0; i < json.length(); i++) {\n                NavItem navItem = parseNavItem(json.getObject(i));\n                if (navItem != null) {\n                    navItem.setParent(parent);\n                    targetList.add(navItem);\n                }\n            }\n        }\n    }\n\n    private NavItem parseNavItem(JsonObject json) throws JsonException {\n        if (json == null) {\n            return null;\n        }\n        NavItem navItem = null;\n        String type = json.getString(NAV_ITEM_TYPE);\n        if (type == null) {\n            throw new RuntimeException(\"Nav item type not specified\");\n        }\n\n        if (NavItem.Type.DIVIDER.toString().equals(type)) {\n            navItem = NavFactory.get().createDivider();\n        } else if (NavItem.Type.GROUP.toString().equals(type)) {\n            navItem = NavFactory.get().createNavGroup();\n        } else {\n            navItem = NavFactory.get().createNavItem();\n        }\n        String id = json.getString(NAV_ITEM_ID);\n        String name = json.getString(NAV_ITEM_NAME);\n        String desc = json.getString(NAV_ITEM_DESC);\n        String modif = json.getString(NAV_ITEM_MODIF);\n        String ctx = json.getString(NAV_ITEM_CTX);\n\n        navItem.setId(id);\n        navItem.setName(name);\n        navItem.setDescription(desc);\n        navItem.setModifiable(modif != null ? Boolean.parseBoolean(modif) : true);\n        navItem.setContext(ctx);\n\n        if (NavItem.Type.GROUP.toString().equals(type)) {\n            JsonArray childrenArray = json.getArray(NAV_GROUP_CHILDREN);\n            NavGroup navGroup = (NavGroup) navItem;\n            parseNavItemArray(childrenArray, navGroup.getChildren(), navGroup);\n        }\n        return navItem;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutNavigationRef.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LayoutNavigationRef {\n\n    LayoutNavigationRefType type;\n    String name;\n\n    public LayoutNavigationRef() {\n    }\n\n    public LayoutNavigationRef(LayoutNavigationRefType type, String name) {\n        this.type = type;\n        this.name = name;\n    }\n\n    public LayoutNavigationRefType getType() {\n        return type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutNavigationRef{\" +\n                \"type=\" + type +\n                \", name='\" + name + '\\'' +\n                '}';\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        LayoutNavigationRef that = (LayoutNavigationRef) o;\n        return type == that.type && Objects.equals(name, that.name);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(type, name);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutNavigationRefType.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum LayoutNavigationRefType {\n\n    PERSPECTIVE,\n    NAV_COMPONENT,\n    NAV_GROUP_CONTEXT,\n    NAV_GROUP_DEFINED,\n    DEFAULT_ITEM_DEFINED,\n    DEFAULT_ITEM_FOUND,\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutRecursionIssue.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n/**\n * Class containing the list of navigation references involved in an {@link LayoutTemplate} infinite recursion issue.\n */\n@Portable\npublic class LayoutRecursionIssue {\n\n    List<LayoutNavigationRef> refList = new ArrayList<>();\n\n    public LayoutRecursionIssue() {\n    }\n\n    public boolean contains(LayoutNavigationRef other) {\n        if (other != null) {\n            for (LayoutNavigationRef ref : refList) {\n                if (ref.getType() != null && ref.getType().equals(other.getType())\n                        && ref.getName() != null && ref.getName().equals(other.getName())) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    public void push(LayoutNavigationRef ref) {\n        refList.add(ref);\n    }\n\n    public LayoutNavigationRef pop() {\n        return refList.remove(refList.size()-1);\n    }\n\n    public boolean isEmpty() {\n        return refList.isEmpty();\n    }\n\n    public List<LayoutNavigationRef> getRefList() {\n        return refList;\n    }\n\n    public LayoutNavigationRef getLastDefaultItemRef() {\n        for (LayoutNavigationRef ref : refList) {\n            if (ref.getType().equals(LayoutNavigationRefType.DEFAULT_ITEM_FOUND)\n                    || ref.getType().equals(LayoutNavigationRefType.DEFAULT_ITEM_DEFINED)) {\n                return ref;\n            }\n        }\n        return null;\n    }\n\n    public String printReport(NavTree navTree, LayoutRecursionIssueI18n i18n) {\n        String msg = \"\";\n        LayoutNavigationRef previousRef = null;\n        for (int i=0; i<refList.size(); i++) {\n            LayoutNavigationRef navigationRef = refList.get(i);\n            boolean isLast = (i==refList.size()-1);\n            String name = navigationRef.getName();\n\n            switch (navigationRef.getType()) {\n\n                case PERSPECTIVE:\n                    String perspective = enclose(name);\n                    if (previousRef == null) {\n                        msg += \" \" + i18n.navRefPerspectiveI18n(perspective);\n                    }\n                    else {\n                        String lastMsg = isLast ? perspective + \" \" + i18n.navRefPerspectiveRecursionEndI18n() : perspective;\n                        switch (previousRef.getType()) {\n                            case NAV_GROUP_DEFINED:\n                                msg += \" \" + i18n.navRefPerspectiveInGroupI18n(lastMsg);\n                                break;\n                            case DEFAULT_ITEM_DEFINED:\n                                msg += \" \" + i18n.navRefPerspectiveDefaultI18n(lastMsg);\n                                msg += isLast ? \"\" : \" \" + i18n.navRefPerspectiveI18n(perspective);\n                                break;\n                            case DEFAULT_ITEM_FOUND:\n                                msg += \" \" + i18n.navRefPerspectiveFoundI18n(lastMsg);\n                                msg += isLast ? \"\" : \" \" + i18n.navRefPerspectiveI18n(perspective);\n                                break;\n                        }\n                    }\n                    break;\n\n                case NAV_GROUP_DEFINED:\n                    NavItem navGroup = navTree.getItemById(name);\n                    msg += \" \" + i18n.navRefGroupDefinedI18n(enclose(navGroup.getName()));\n                    break;\n\n                case NAV_GROUP_CONTEXT:\n                    navGroup = navTree.getItemById(name);\n                    msg += \" \" + i18n.navRefGroupContextI18n(enclose(navGroup.getName()));\n                    break;\n\n                case NAV_COMPONENT:\n                    NavDragComponentType dragType = NavDragComponentType.getByClassName(name);\n                    String dragName = dragType != null ? getNavDragTypeI18nName(dragType, i18n) : name;\n                    msg += \" \" + i18n.navRefComponentI18n(enclose(dragName));\n                    break;\n\n                case DEFAULT_ITEM_DEFINED:\n                    NavItem navItem = navTree.getItemById(name);\n                    msg += \" \" + i18n.navRefDefaultItemDefinedI18n(enclose(navItem.getName()));\n                    break;\n\n                case DEFAULT_ITEM_FOUND:\n                    navItem = navTree.getItemById(name);\n                    msg += \" \" + i18n.navRefDefaultItemFoundI18n(enclose(navItem.getName()));\n                    break;\n\n                default:\n                    msg += \" \" + navigationRef.getType() + \" \" + navigationRef.getName();\n                    break;\n            }\n            previousRef = navigationRef;\n        }\n        return msg;\n    }\n\n    private String enclose(String name) {\n        return \"\\\"\" + name + \"\\\"\";\n    }\n\n    public String getNavDragTypeI18nName(NavDragComponentType dragType, LayoutRecursionIssueI18n i18n) {\n        switch (dragType) {\n            case CAROUSEL:\n                return i18n.navCarouselDragComponentI18n();\n            case TABLIST:\n                return i18n.navTabListDragComponentI18n();\n            case TILES:\n                return i18n.navTilesDragComponentI18n();\n            case TREE:\n                return i18n.navTreeDragComponentI18n();\n            case MENUBAR:\n                return i18n.navMenubarDragComponentI18n();\n            default:\n                return null;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutRecursionIssueI18n.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\npublic interface LayoutRecursionIssueI18n {\n\n    String navRefPerspectiveI18n(String name);\n\n    String navRefPerspectiveInGroupI18n(String name);\n\n    String navRefPerspectiveDefaultI18n(String name);\n\n    String navRefPerspectiveFoundI18n(String name);\n\n    String navRefGroupDefinedI18n(String name);\n\n    String navRefGroupContextI18n(String name);\n\n    String navRefComponentI18n(String name);\n\n    String navRefDefaultItemDefinedI18n(String name);\n\n    String navRefDefaultItemFoundI18n(String name);\n\n    String navRefPerspectiveRecursionEndI18n();\n\n    String navCarouselDragComponentI18n();\n\n    String navTabListDragComponentI18n();\n\n    String navTilesDragComponentI18n();\n\n    String navTreeDragComponentI18n();\n\n    String navMenubarDragComponentI18n();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutTemplateContext.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\nimport org.dashbuilder.navigation.NavGroup;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n/**\n * A {@link LayoutTemplate}'s context contains for instance the identifier of the {@link NavGroup} to be used by\n * any of the layout's navigation components.\n */\n@Portable\npublic class LayoutTemplateContext {\n\n    String navGroupId;\n\n    public LayoutTemplateContext() {\n    }\n\n    public LayoutTemplateContext(String navGroupId) {\n        this.navGroupId = navGroupId;\n    }\n\n    public String getNavGroupId() {\n        return navGroupId;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/LayoutTemplateInfo.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n/**\n * Class containing a perspective's layout template plus additional information like if any of its components\n * is linked to another perspective causing an inifinite loop. For example, imagine a perspective A containing a tab list\n * component with a tab linked to perspective B. The issue might occur if perspective B contains\n * a component linked to perspective A.\n */\n@Portable\npublic class LayoutTemplateInfo {\n\n    LayoutTemplate layoutTemplate;\n    boolean hasNavigationComponents;\n    LayoutRecursionIssue recursionIssue;\n\n    public LayoutTemplateInfo() {\n    }\n\n    public LayoutTemplateInfo(LayoutTemplate layoutTemplate, boolean hasNavigationComponents, LayoutRecursionIssue recursionIssue) {\n        this.layoutTemplate = layoutTemplate;\n        this.hasNavigationComponents = hasNavigationComponents;\n        this.recursionIssue = recursionIssue;\n    }\n\n    public LayoutTemplate getLayoutTemplate() {\n        return layoutTemplate;\n    }\n\n    public LayoutRecursionIssue getRecursionIssue() {\n        return recursionIssue;\n    }\n\n    public boolean hasNavigationComponents() {\n        return hasNavigationComponents;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/NavDragComponentSettings.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\npublic interface NavDragComponentSettings {\n\n    String NAV_GROUP_ID = \"navGroupId\";\n    String NAV_DEFAULT_ID = \"navDefaultId\";\n    String TARGET_DIV_ID = \"targetDivId\";\n    String PERSPECTIVE_ID = \"perspectiveId\";\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/layout/NavDragComponentType.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.layout;\n\npublic enum NavDragComponentType {\n\n    CAROUSEL(\"org.dashbuilder.client.navigation.layout.editor.NavCarouselDragComponent\"),\n    MENUBAR(\"org.dashbuilder.client.navigation.layout.editor.NavMenuBarDragComponent\"),\n    TABLIST(\"org.dashbuilder.client.navigation.layout.editor.NavTabListDragComponent\"),\n    TREE(\"org.dashbuilder.client.navigation.layout.editor.NavTreeDragComponent\"),\n    TILES(\"org.dashbuilder.client.navigation.layout.editor.NavTilesDragComponent\");\n\n    private String className;\n\n    NavDragComponentType(String className) {\n        this.className = className;\n    }\n\n    public String getFQClassName() {\n        return className;\n    }\n\n    public static NavDragComponentType getByClassName(String className) {\n        for (NavDragComponentType type : values()) {\n            if (type.className.equals(className)) {\n                return type;\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/service/NavigationServices.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Navigation related services, like for instance persistent services for the application navigation tree.\n */\n@Remote\npublic interface NavigationServices {\n\n    NavTree loadNavTree();\n\n    void saveNavTree(NavTree navTree);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/service/PerspectivePluginServices.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.service;\n\nimport java.util.Collection;\n\nimport org.dashbuilder.navigation.layout.LayoutTemplateContext;\nimport org.dashbuilder.navigation.layout.LayoutTemplateInfo;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n/**\n * Runtime perspective plugins related services.\n */\n@Remote\npublic interface PerspectivePluginServices {\n\n    Collection<Plugin> listPlugins();\n\n    Plugin getPerspectivePlugin(String perspectiveName);\n\n    LayoutTemplate getLayoutTemplate(String perspectiveName);\n\n    LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin);\n\n    LayoutTemplateInfo getLayoutTemplateInfo(String perspectiveName);\n\n    LayoutTemplateInfo getLayoutTemplateInfo(Plugin perspectivePlugin, LayoutTemplateContext layoutCtx);\n\n    LayoutTemplateInfo getLayoutTemplateInfo(LayoutTemplate layoutTemplate);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/workbench/NavSecurityController.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.workbench;\n\nimport java.util.Iterator;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.navigation.NavDivider;\nimport org.dashbuilder.navigation.NavGroup;\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * A security interface for controlling access {@link NavTree} and {@link NavItem} instances.\n */\n@ApplicationScoped\npublic class NavSecurityController {\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n\n    @Inject\n    public NavSecurityController(AuthorizationManager authorizationManager, User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    public NavTree secure(NavTree navTree, boolean removeEmptyGroups) {\n        NavTree clone = navTree.cloneTree();\n        secure(clone.getRootItems(), removeEmptyGroups);\n        return clone;\n    }\n\n    public void secure(List<NavItem> itemList, boolean removeEmptyGroups) {\n        Iterator<NavItem> it = itemList.iterator();\n        while (it.hasNext()) {\n            NavItem navItem = it.next();\n            if (!canRead(navItem)) {\n                it.remove();\n            } else if (navItem instanceof NavGroup) {\n                List<NavItem> children = ((NavGroup) navItem).getChildren();\n                if (removeEmptyGroups) {\n                    removeEmptyGroups(children);\n                }\n                secure(children, removeEmptyGroups);\n            }\n        }\n        if (removeEmptyGroups) {\n            removeEmptyGroups(itemList);\n        }\n    }\n\n    private void removeEmptyGroups(List<NavItem> itemList) {\n        Iterator<NavItem> it = itemList.iterator();\n        while (it.hasNext()) {\n            NavItem navItem = it.next();\n            if (navItem instanceof NavGroup) {\n                if (isEmpty((NavGroup) navItem)) {\n                    it.remove();\n                }\n            }\n        }\n    }\n\n    private boolean isEmpty(NavGroup navGroup) {\n        for (NavItem navItem : navGroup.getChildren()) {\n\n            // Group found => non empty if subgroup non empty as well.\n            if (navItem instanceof NavGroup) {\n                if (!isEmpty((NavGroup) navItem)) {\n                    return false;\n                }\n            }\n            // Item found => non empty\n            else if (!(navItem instanceof NavDivider)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    public boolean canRead(String navItemCtx) {\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.get(navItemCtx);\n\n        // Check permissions\n        for (String p : ctx.getPermissions()) {\n            if (!authorizationManager.authorize(p, user)) {\n                return false;\n            }\n        }\n        // Check resource access\n        String resourceId = ctx.getResourceId();\n        ActivityResourceType resourceType = ctx.getResourceType();\n        if (resourceId != null && resourceType != null) {\n            ResourceRef resourceRef = new ResourceRef(resourceId, resourceType);\n            if (!authorizationManager.authorize(resourceRef, user)) {\n                return false;\n            }\n        }\n        // The item is available\n        return true;\n    }\n\n    public boolean canRead(NavItem navItem) {\n        if (navItem == null) {\n            return false;\n        }\n        return canRead(navItem.getContext());\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/java/org/dashbuilder/navigation/workbench/NavWorkbenchCtx.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation.workbench;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.navigation.NavItem;\nimport org.dashbuilder.navigation.NavItemContext;\nimport org.dashbuilder.navigation.impl.NavItemContextImpl;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * A {@link NavItemContext} which contains workbench related context like for instance:\n * <ul>\n *     <li>A list of permissions the nav item is tied to</li>\n *     <li>An identifier of a resource this item is referring to</li>\n * </ul>\n */\npublic class NavWorkbenchCtx extends NavItemContextImpl {\n\n    public static final String PERMISSIONS = \"permissions\";\n    public static final String RESOURCE_ID = \"resourceId\";\n    public static final String RESOURCE_TYPE = \"resourceType\";\n    public static final String NAV_GROUP_ID = \"navGroupId\";\n\n    public static NavWorkbenchCtx get(NavItem navItem) {\n        return navItem != null ? new NavWorkbenchCtx(navItem.getContext()): new NavWorkbenchCtx();\n    }\n\n    public static NavWorkbenchCtx get(String navItemCtx) {\n        return new NavWorkbenchCtx(navItemCtx);\n    }\n\n    public static NavWorkbenchCtx perspective(String perspectiveId) {\n        NavWorkbenchCtx ctx = new NavWorkbenchCtx();\n        ctx.setResourceId(perspectiveId);\n        ctx.setResourceType(ActivityResourceType.PERSPECTIVE);\n        return ctx;\n    }\n\n    public static NavWorkbenchCtx permission(String... permission) {\n        NavWorkbenchCtx ctx = new NavWorkbenchCtx();\n        for (String p : permission) {\n            ctx.addPermission(p);\n        }\n        return ctx;\n    }\n\n    public NavWorkbenchCtx() {\n        super();\n    }\n\n    public NavWorkbenchCtx(String ctx) {\n        super(ctx);\n    }\n\n    public String getResourceId() {\n        return super.getProperty(RESOURCE_ID);\n    }\n\n    public NavWorkbenchCtx setResourceId(String resourceId) {\n        if (resourceId == null) {\n            super.removeProperty(RESOURCE_ID);\n        } else {\n            super.setProperty(RESOURCE_ID, resourceId);\n        }\n        return this;\n    }\n\n    public ActivityResourceType getResourceType() {\n        String type = super.getProperty(RESOURCE_TYPE);\n        return type != null ? ActivityResourceType.valueOf(type.toUpperCase()) : null;\n    }\n\n    public NavWorkbenchCtx setResourceType(ActivityResourceType resourceType) {\n        super.setProperty(RESOURCE_TYPE, resourceType.getName().toUpperCase());\n        return this;\n    }\n\n    public String getNavGroupId() {\n        return super.getProperty(NAV_GROUP_ID);\n    }\n\n    public NavWorkbenchCtx setNavGroupId(String navGroupId) {\n        if (navGroupId == null) {\n            super.removeProperty(NAV_GROUP_ID);\n        } else {\n            super.setProperty(NAV_GROUP_ID, navGroupId);\n        }\n        return this;\n    }\n\n    public NavWorkbenchCtx clearPermissions() {\n        super.removeProperty(PERMISSIONS);\n        return this;\n    }\n\n    public List<String> getPermissions() {\n        List<String> permissionList = new ArrayList<>();\n        String str = super.getProperty(PERMISSIONS);\n        if (str != null) {\n            for (String p : str.split(\",\")) {\n                permissionList.add(p.trim());\n            }\n        }\n        return permissionList;\n    }\n\n    public NavWorkbenchCtx addPermission(String permission) {\n        String str = super.getProperty(PERMISSIONS);\n        str = str == null ? permission : str + \",\" + permission;\n        super.setProperty(PERMISSIONS, str);\n        return this;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/main/resources/org/dashbuilder/NavigationAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n    <source path='navigation'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/test/java/org/dashbuilder/navigation/NavItemContextInclusionTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.runners.Parameterized.Parameter;\nimport static org.junit.runners.Parameterized.Parameters;\n\n@RunWith(Parameterized.class)\npublic class NavItemContextInclusionTest {\n\n    @Parameters\n    public static Collection<Object[]> data() {\n        return Arrays.asList(new Object[][]{\n                {\"\", \"\", true},\n                {\"a=1\", \"a=1\", true}, //identical ctxts\n                {\"a=1;b=2\", \"a=1;b=2\", true},\n                {\"a=1;b=2\", \"b=2;a=1\", true}, // order should not matter\n                {\"a=1;b=2\", \"a=1\", true}, // extra property\n                {\"a=1;b=2;c=3\", \"b=2\", true}, // extra property in different place\n\n                {\"a=1;b=2\", \"c=3\", false}, // property not included\n                {\"a=1\", \"a=2\", false}, // different value of property\n                {\"a=1;b=2\", \"a=1;c=2\", false}, // same amount of props, but different names\n                {\"A=1\", \"a=1\", false}, // property names are case sensitive\n        });\n    }\n\n    @Parameter(0)\n    public String ctx1;\n\n    @Parameter(1)\n    public String ctx2;\n\n    @Parameter(2)\n    public boolean includesPropertiesOf;\n\n    @Test\n    public void testMatch() {\n        NavItemContext\n                c1 = NavItemContext.get(ctx1),\n                c2 = NavItemContext.get(ctx2);\n\n        String msg = String.format(\"NavItemContext %s should%s include properties of  %s\", ctx1, (includesPropertiesOf ? \"\" : \" not\"), ctx2);\n\n        assertEquals(msg, includesPropertiesOf, c1.includesPropertiesOf(c2));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/test/java/org/dashbuilder/navigation/NavItemContextTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.junit.Test;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\n\npublic class NavItemContextTest {\n\n    @Test\n    public void testEmpty() {\n        NavItemContext ctx = NavItemContext.get(\"\");\n        assertEquals(ctx.getPropertyIds().size(), 0);\n\n        ctx = NavItemContext.create();\n        assertEquals(ctx.getPropertyIds().size(), 0);\n    }\n\n    @Test\n    public void testParse() {\n        NavItemContext ctx = NavItemContext.get(\"a=A;b=B;\");\n        assertEquals(ctx.getPropertyIds().size(), 2);\n        assertEquals(ctx.getProperty(\"a\"), \"A\");\n        assertEquals(ctx.getProperty(\"b\"), \"B\");\n    }\n\n    @Test\n    public void testFormat() {\n        NavItemContext ctx = NavItemContext.create();\n        ctx.setProperty(\"a\", \"A\");\n        ctx.setProperty(\"b\", \"B\");\n        assertEquals(ctx.getPropertyIds().size(), 2);\n        assertEquals(ctx.getProperty(\"a\"), \"A\");\n        assertEquals(ctx.getProperty(\"b\"), \"B\");\n        assertEquals(ctx.toString(), \"a=A;b=B;\");\n    }\n\n    @Test\n    public void testPerspective() {\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(\"A\");\n        assertEquals(ctx.getPropertyIds().size(), 2);\n        assertEquals(ctx.getResourceId(), \"A\");\n        assertEquals(ctx.getResourceType(), ActivityResourceType.PERSPECTIVE);\n        assertEquals(ctx.getProperty(NavWorkbenchCtx.RESOURCE_ID), \"A\");\n        assertEquals(ctx.getProperty(NavWorkbenchCtx.RESOURCE_TYPE), \"PERSPECTIVE\");\n        assertEquals(ctx.toString(), \"resourceId=A;resourceType=PERSPECTIVE;\");\n    }\n\n    @Test\n    public void testPermissions() {\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.permission(\"p1\", \"p2\", \"p3\");\n\n        assertThat(ctx.getPermissions())\n                .hasSize(3)\n                .contains(\"p1\", \"p2\", \"p3\");\n\n        ctx.clearPermissions();\n\n        assertThat(ctx.getPermissions())\n                .isEmpty();\n    }\n\n    @Test\n    public void testRemoveProperty() {\n        NavWorkbenchCtx ctx = NavWorkbenchCtx.get(\"a=1;b=2;c=3\");\n\n        ctx.removeProperty(\"b\");\n\n        NavWorkbenchCtx expectedCtx = NavWorkbenchCtx.get(\"a=1;c=3\");\n        assertTrue(ctx.includesPropertiesOf(expectedCtx));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/test/java/org/dashbuilder/navigation/NavSecurityTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.workbench.NavSecurityController;\nimport org.dashbuilder.navigation.workbench.NavWorkbenchCtx;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NavSecurityTest {\n\n    public static final String ITEM_HOME_ID = \"home\";\n    public static final String ITEM_ADMIN_ID = \"admin\";\n    public static final String ITEM_SECURITY_ID = \"security\";\n    public static final String ITEM_DATASETS_ID = \"datasets\";\n\n    @Mock\n    AuthorizationManager authorizationManager;\n\n    @Mock\n    User user;\n\n    NavTree tree;\n    NavSecurityController controller;\n\n    @Before\n    public void setUp() {\n        tree = new NavTreeBuilder()\n                .item(ITEM_HOME_ID, \"Home\", null, false, NavWorkbenchCtx.permission(ITEM_HOME_ID))\n                .divider()\n                .group(ITEM_ADMIN_ID, \"Administration\", null, false)\n                .item(ITEM_SECURITY_ID, \"Security\", null, false, NavWorkbenchCtx.permission(ITEM_SECURITY_ID))\n                .item(ITEM_DATASETS_ID, \"Data sets\", null, false, NavWorkbenchCtx.permission(ITEM_DATASETS_ID))\n                .build();\n\n        controller = new NavSecurityController(authorizationManager, user);\n    }\n\n    @Test\n    public void testTreeStructure() {\n        when(authorizationManager.authorize(ITEM_HOME_ID, user)).thenReturn(true);\n        when(authorizationManager.authorize(ITEM_SECURITY_ID, user)).thenReturn(false);\n        when(authorizationManager.authorize(ITEM_DATASETS_ID, user)).thenReturn(true);\n\n        NavTree securedTree = controller.secure(tree, true);\n\n        List<NavItem> rootNavItems = securedTree.getRootItems();\n        assertEquals(rootNavItems.size(), 3);\n\n        NavItem admin = securedTree.getItemById(ITEM_ADMIN_ID);\n        assertTrue(admin instanceof NavGroup);\n        assertEquals(((NavGroup) admin).getChildren().size(), 1);\n    }\n\n    @Test\n    public void testHideEmptyGroups() {\n        when(authorizationManager.authorize(ITEM_HOME_ID, user)).thenReturn(true);\n        when(authorizationManager.authorize(ITEM_SECURITY_ID, user)).thenReturn(false);\n        when(authorizationManager.authorize(ITEM_DATASETS_ID, user)).thenReturn(false);\n\n        NavTree securedTree = controller.secure(tree, true);\n        NavItem admin = securedTree.getItemById(ITEM_ADMIN_ID);\n        assertEquals(securedTree.getRootItems().size(), 2);\n        assertNull(admin);\n\n        List<NavItem> navItems = new ArrayList<>(tree.getRootItems());\n        controller.secure(navItems, true);\n        assertEquals(navItems.size(), 2);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/test/java/org/dashbuilder/navigation/NavTreeJsonTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.dashbuilder.navigation;\n\nimport org.dashbuilder.json.JsonObject;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.dashbuilder.navigation.json.NavTreeJSONMarshaller;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class NavTreeJsonTest {\n\n    public static final NavTree NAV_TREE = new NavTreeBuilder()\n            .item(\"1\", \"name1\", \"desc1\", true, \"ctx1\")\n            .item(\"2\", \"name2\", \"desc2\", false, \"ctx2\")\n            .divider()\n            .group(\"3\", \"name3\", \"desc3\", true)\n            .item(\"4\", \"name4\", \"desc4\", true, \"ctx4\")\n            .build();\n\n    @Test\n    public void testNavTreeMarshalling() {\n        NavTreeJSONMarshaller jsonMarshaller = NavTreeJSONMarshaller.get();\n        JsonObject _jsonObj = jsonMarshaller.toJson(NAV_TREE);\n        assertNotNull(_jsonObj.toString());\n\n        NavTree navTree = jsonMarshaller.fromJson(_jsonObj);\n        assertEquals(navTree.getRootItems().size(), 4);\n\n        NavItem navItem = navTree.getItemById(\"1\");\n        assertNotNull(navItem);\n        assertEquals(navItem.getType(), NavItem.Type.ITEM);\n        assertEquals(navItem.getName(), \"name1\");\n        assertEquals(navItem.getDescription(), \"desc1\");\n        assertEquals(navItem.isModifiable(), true);\n        assertEquals(navItem.getContext(), \"ctx1\");\n\n        navItem = navTree.getItemById(\"2\");\n        assertNotNull(navItem);\n        assertEquals(navItem.getType(), NavItem.Type.ITEM);\n        assertEquals(navItem.getName(), \"name2\");\n        assertEquals(navItem.getDescription(), \"desc2\");\n        assertEquals(navItem.isModifiable(), false);\n        assertEquals(navItem.getContext(), \"ctx2\");\n\n        navItem = navTree.getItemById(\"3\");\n        assertNotNull(navItem);\n        assertEquals(navItem.getType(), NavItem.Type.GROUP);\n        assertEquals(navItem.getName(), \"name3\");\n        assertEquals(navItem.getDescription(), \"desc3\");\n        assertEquals(navItem.isModifiable(), true);\n\n        navItem = navTree.getItemById(\"4\");\n        assertNotNull(navItem);\n        assertEquals(navItem.getType(), NavItem.Type.ITEM);\n        assertEquals(navItem.getName(), \"name4\");\n        assertEquals(navItem.getDescription(), \"desc4\");\n        assertEquals(navItem.isModifiable(), true);\n        assertEquals(navItem.getContext(), \"ctx4\");\n        assertEquals(navItem.getParent(), navTree.getItemById(\"3\"));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-navigation-api/src/test/java/org/dashbuilder/navigation/NavTreeTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.navigation;\n\nimport org.assertj.core.api.Assertions;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport java.util.List;\n\nimport static org.junit.Assert.*;\n\npublic class NavTreeTest {\n\n    public static final String ITEM_HOME_ID = \"home\";\n    public static final String ITEM_ADMIN_ID = \"admin\";\n    public static final String ITEM_SECURITY_ID = \"security\";\n    public static final String ITEM_DATASETS_ID = \"datasets\";\n    public static final String NONEXISTENT_ITEM_ID = \"item with this id does not exist\";\n\n    NavTree tree;\n\n    @Before\n    public void setUp() {\n        tree = new NavTreeBuilder()\n                .item(ITEM_HOME_ID, \"Home\", null, false)\n                .divider()\n                .group(ITEM_ADMIN_ID, \"Administration\", null, false)\n                .item(ITEM_SECURITY_ID, \"Security\", null, false)\n                .item(ITEM_DATASETS_ID, \"Data sets\", null, false)\n                .build();\n    }\n\n    @Test\n    public void testTreeStructure() {\n        List<NavItem> rootNavItems = tree.getRootItems();\n        assertEquals(rootNavItems.size(), 3);\n\n        NavItem home = tree.getItemById(ITEM_HOME_ID);\n        assertTrue(home instanceof NavItem);\n        assertEquals(home.getId(), ITEM_HOME_ID);\n        assertEquals(home.getName(), \"Home\");\n        assertEquals(home.isModifiable(), false);\n        assertNull(home.getParent());\n\n        NavItem admin = tree.getItemById(ITEM_ADMIN_ID);\n        assertTrue(admin instanceof NavGroup);\n        assertEquals(((NavGroup) admin).getChildren().size(), 2);\n\n        NavItem security = tree.getItemById(ITEM_SECURITY_ID);\n        assertTrue(security instanceof NavItem);\n        assertEquals(security.getParent(), admin);\n    }\n\n    @Test\n    public void testDeleteItem() {\n        tree.deleteItem(ITEM_HOME_ID);\n        List<NavItem> rootNavItems = tree.getRootItems();\n        assertEquals(rootNavItems.size(), 2);\n\n        tree.deleteItem(ITEM_DATASETS_ID);\n        NavItem admin = tree.getItemById(ITEM_ADMIN_ID);\n        assertEquals(((NavGroup) admin).getChildren().size(), 1);\n    }\n\n\n    @Test(expected = RuntimeException.class)\n    public void testParentNotFound() {\n        tree.moveItem(\"none\", \"parent\");\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testAvoidLoops() {\n        tree.moveItem(ITEM_HOME_ID, \"home\");\n    }\n\n    @Test\n    public void testItemContext() {\n        tree.setItemContext(ITEM_HOME_ID, \"p1\");\n        NavItem home = tree.getItemById(ITEM_HOME_ID);\n\n        assertTrue(home instanceof NavItem);\n        assertEquals(home.getContext(), \"p1\");\n    }\n\n    @Test\n    public void testSearchItems() {\n        NavItemContext ctx1 = NavItemContext.create().setProperty(\"p1\", \"v1\").setProperty(\"p2\", \"v2\");\n        NavItemContext ctx2 = NavItemContext.create().setProperty(\"p1\", \"v1\").setProperty(\"p3\", \"v3\");\n        NavItemContext ctx3 = NavItemContext.create().setProperty(\"p1\", \"v1\").setProperty(\"p2\", \"v2\");\n\n        tree.setItemContext(ITEM_HOME_ID, ctx1.toString());\n        tree.setItemContext(ITEM_DATASETS_ID, ctx2.toString());\n\n        List<NavItem> navItems = tree.searchItems(ctx3);\n        assertEquals(navItems.size(), 1);\n        assertEquals(navItems.get(0).getId(), ITEM_HOME_ID);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testMoveUpNotAllowed() {\n        tree.moveItemUp(ITEM_SECURITY_ID);\n        tree.moveItemDown(ITEM_DATASETS_ID);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testMoveDownNotAllowed() {\n        tree.moveItemDown(ITEM_DATASETS_ID);\n    }\n\n    @Test\n    public void testMoveUpAndDown() {\n        NavGroup admin = (NavGroup) tree.getItemById(ITEM_ADMIN_ID);\n        List<NavItem> navItems = admin.getChildren();\n        assertEquals(navItems.get(0).getId(), ITEM_SECURITY_ID);\n        assertEquals(navItems.get(1).getId(), ITEM_DATASETS_ID);\n\n        tree.moveItemUp(ITEM_DATASETS_ID);\n        assertEquals(navItems.get(0).getId(), ITEM_DATASETS_ID);\n        assertEquals(navItems.get(1).getId(), ITEM_SECURITY_ID);\n\n        tree.moveItemDown(ITEM_DATASETS_ID);\n        assertEquals(navItems.get(0).getId(), ITEM_SECURITY_ID);\n        assertEquals(navItems.get(1).getId(), ITEM_DATASETS_ID);\n\n        tree.moveItemFirst(ITEM_DATASETS_ID);\n        assertEquals(navItems.get(0).getId(), ITEM_DATASETS_ID);\n        assertEquals(navItems.get(1).getId(), ITEM_SECURITY_ID);\n\n        tree.moveItemLast(ITEM_DATASETS_ID);\n        assertEquals(navItems.get(0).getId(), ITEM_SECURITY_ID);\n        assertEquals(navItems.get(1).getId(), ITEM_DATASETS_ID);\n    }\n\n    @Test\n    public void testSubtreeCreation() {\n        NavTree subtree = tree.getItemAsTree(ITEM_ADMIN_ID);\n        assertEquals(subtree.getRootItems().size(), 2);\n        subtree.getRootItems().forEach(i -> assertNull(i.getParent()));\n    }\n\n    @Test\n    public void testCloneTree() {\n        NavTree clone = tree.cloneTree();\n        clone.getRootItems().forEach(i -> assertNull(i.getParent()));\n    }\n\n    @Test\n    public void setItemName_worksWhenItemPresent() {\n        NavItem modifiedItem = tree.setItemName(ITEM_HOME_ID, \"NEW NAME!\");\n\n        assertEquals(\"NEW NAME!\", modifiedItem.getName());\n        assertEquals(\"NEW NAME!\", tree.getItemById(ITEM_HOME_ID).getName());\n    }\n\n    @Test\n    public void setItemModifiable_worksWhenItemPresent() {\n        assertFalse(tree.getItemById(ITEM_HOME_ID).isModifiable());\n\n        NavItem modifiedItem = tree.setItemModifiable(ITEM_HOME_ID, true);\n\n        assertTrue(modifiedItem.isModifiable());\n        assertTrue(tree.getItemById(ITEM_HOME_ID).isModifiable());\n    }\n\n    @Test\n    public void setItemDescription_worksWhenItemPresent() {\n        NavItem modifiedItem = tree.setItemDescription(ITEM_HOME_ID, \"new description\");\n\n        assertEquals(\"new description\", modifiedItem.getDescription());\n        assertEquals(\"new description\", tree.getItemById(ITEM_HOME_ID).getDescription());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void setItemName_throwsExceptionWhenItemNotPresent() {\n        tree.setItemName(NONEXISTENT_ITEM_ID, \"anything\");\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void setItemModifiable_throwsExceptionWhenItemNotPresent() {\n        tree.setItemModifiable(NONEXISTENT_ITEM_ID, true);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void setItemDescription_throwsExceptionWhenItemNotPresent() {\n        tree.setItemDescription(NONEXISTENT_ITEM_ID, \"doesn't matter\");\n    }\n\n    @Test\n    public void addGroupTest() {\n        final String id = \"id\", name = \"name\", description = \"desc\", parentId = ITEM_ADMIN_ID;\n        final boolean modifiable = false;\n        tree.addGroup(id, name, description, parentId, modifiable);\n\n        NavItem newGroup = tree.getItemById(id);\n        assertEquals(id, newGroup.getId());\n        assertEquals(name, newGroup.getName());\n        assertEquals(parentId, newGroup.getParent().getId());\n        assertEquals(description, newGroup.getDescription());\n        assertFalse(newGroup.isModifiable());\n    }\n\n    @Test\n    public void addGroupThrowsException_whenParentIsNotGroup() {\n        String idOfParentWhichIsNotGroup = ITEM_SECURITY_ID;\n        try {\n            tree.addGroup(null, null, null, idOfParentWhichIsNotGroup, true);\n            Assertions.fail(\"Exception should be thrown when using something else as parent than NavGroup\");\n        } catch (RuntimeException e) {\n            assertEquals(\"Parent '\" + idOfParentWhichIsNotGroup + \"' is not a group\", e.getMessage());\n        }\n    }\n\n    @Test\n    public void addItemTest() {\n        final String id = \"id\", name = \"name\", description = \"desc\", parentId = ITEM_ADMIN_ID, context = \"a=1\";\n        final boolean modifiable = false;\n        tree.addItem(id, name, description, parentId, modifiable, context);\n\n        NavItem item = tree.getItemById(id);\n        assertEquals(id, item.getId());\n        assertEquals(name, item.getName());\n        assertEquals(parentId, item.getParent().getId());\n        assertEquals(description, item.getDescription());\n        assertFalse(item.isModifiable());\n        assertEquals(context, item.getContext());\n    }\n\n    @Test\n    public void addItemShouldThrowException_whenParentDoesNotExist() {\n        try {\n            tree.addItem(null, null, null, NONEXISTENT_ITEM_ID, true, null);\n            Assertions.fail(\"Exception should be thrown when parent with given ID does not exist\");\n        } catch (RuntimeException e) {\n            assertEquals(\"Parent '\" + NONEXISTENT_ITEM_ID + \"' not found\", e.getMessage());\n        }\n    }\n\n    @Test\n    public void moveItemTest() {\n        final String newGroupId = \"ngi\";\n        tree.addGroup(newGroupId, \"name\", \"desc\", ITEM_ADMIN_ID, true);\n        tree.moveItem(ITEM_SECURITY_ID, newGroupId);\n\n        assertEquals(newGroupId, tree.getItemById(ITEM_SECURITY_ID).getParent().getId());\n    }\n\n    @Test\n    public void moveItemShouldThrowException_whenParentDoesNotExist() {\n        try {\n            tree.moveItem(ITEM_SECURITY_ID, NONEXISTENT_ITEM_ID);\n            Assertions.fail(\"Exception should be thrown when parent with given ID does not exist\");\n        } catch (RuntimeException e) {\n            assertEquals(\"Parent not found: \" + NONEXISTENT_ITEM_ID, e.getMessage());\n        }\n    }\n\n    @Test\n    public void moveItemShouldThrowException_whenParentIdSameAsItemId() {\n        final String sameId = ITEM_ADMIN_ID;\n        try {\n            tree.moveItem(sameId, sameId);\n            Assertions.fail(\"Exception should be thrown when parentId same as item Id\");\n        } catch (RuntimeException e) {\n            assertEquals(\"The parent can't be the item itself: \" + sameId, e.getMessage());\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-shared</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>dashbuilder-services-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Services API</name>\n  <description>Dashbuilder Services API shared between client and server.</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n  </dependencies>\n  \n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/dataset/service/DataSetDefServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Services for the handling of data set definitions\n */\n@Remote\npublic interface DataSetDefServices {\n\n    /**\n     * Get those public (shareable) data set definition (those with the \"public\" flag set to true)\n     */\n    List<DataSetDef> getPublicDataSetDefs();\n\n    /**\n     * Creates a brand new data set definition for the provider type specified\n     * @param type The provider type\n     * @return A data set definition instance\n     */\n    DataSetDef createDataSetDef(DataSetProviderType type);\n\n    /**\n     * Register a data set definition.\n     * @param definition The data set definition.\n     * @param message, A message top store along the registration request. If null is ignored.\n     * @return The registered data set definition UUID. If UUID not present on the definition from the argument <code>definition</code>, the UUID will be generated.\n     */\n    String registerDataSetDef(DataSetDef definition, String message);\n\n    /**\n     * Removes a data set definition from the registry.\n     * @param message, A message top store along the registration request. If null is ignored.\n     * @param uuid The data set definition identifier.\n     */\n    void removeDataSetDef(String uuid, String message);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/dataset/service/DataSetDefVfsServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport org.dashbuilder.dataset.backend.EditDataSetDef;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\n\n/**\n * Services for the handling the storage of data set definitions\n */\n@Remote\npublic interface DataSetDefVfsServices extends SupportsDelete, SupportsCopy {\n\n    Path resolve(DataSetDef dataSetDef);\n    DataSetDef get(Path path);\n    EditDataSetDef load(Path path) throws Exception;\n    Path save(DataSetDef dataSetDef, String commitMessage);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/dataset/service/DataSetExportServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Data set export (CSV & Excel) services\n */\n@Remote\npublic interface DataSetExportServices {\n\n    /**\n     * Export a dataset, specified by a DataSetLookup, to CSV format.\n     * @param dataSetLookup The dataSetLookup that defines the dataset to be exported.\n     * @return The VFS path to the export file generated\n     */\n    org.uberfire.backend.vfs.Path exportDataSetCSV(DataSetLookup dataSetLookup);\n\n    /**\n     * Export a dataset, specified by a DataSetLookup, to Excel format.\n     * @param dataSetLookup The dataSetLookup that defines the dataset to be exported.\n     * @return The VFS path to the export file generated\n     */\n    org.uberfire.backend.vfs.Path exportDataSetExcel(DataSetLookup dataSetLookup);\n\n    /**\n     * Export a dataset to CSV format.\n     * @param dataSet The dataset to export.\n     * @return The VFS path to the export file generated\n     */\n    org.uberfire.backend.vfs.Path exportDataSetCSV(DataSet dataSet);\n\n    /**\n     * Export a dataset to Excel format.\n     * @param dataSet The dataset to export.\n     * @return The VFS path to the export file generated\n     */\n    org.uberfire.backend.vfs.Path exportDataSetExcel(DataSet dataSet);\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/dataset/service/DataSetLookupServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetLookup;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Data set lookup services\n */\n@Remote\npublic interface DataSetLookupServices {\n\n    /**\n     * Apply a sequence of operations (filter, sort, group, ...) on a remote data set.\n     *\n     * @return A brand new data set with all the calculations applied.\n     */\n    DataSet lookupDataSet(DataSetLookup lookup) throws Exception;\n\n    /**\n     * Load a data set and apply several operations (filter, sort, group, ...) on top of it for a given definition.\n     * Index and cache are not used.\n     * @return null, if the data set can be retrieved.\n     */\n    DataSet lookupDataSet(DataSetDef def, DataSetLookup lookup) throws Exception;\n\n    /**\n     * Same as lookupDataSet but only retrieves the metadata of the resulting data set.\n     *\n     * @return A DataSetMetadata instance containing general information about the data set.\n     */\n    DataSetMetadata lookupDataSetMetadata(String uuid) throws Exception;\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/dataset/service/SQLProviderServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.dataset.service;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.SQLDataSourceDef;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Services around the SQL provider type.\n */\n@Remote\npublic interface SQLProviderServices {\n\n    /**\n     * Get the list of available data source references\n     */\n    List<SQLDataSourceDef> getDataSourceDefs();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/model/ComponentParameter.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.model;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ComponentParameter {\n\n    private String name;\n    private String type;\n    private String category;\n    private String defaultValue;\n    private String label;\n    private List<String> comboValues;\n    private boolean mandatory;\n\n    public ComponentParameter() {\n        // default constructor used internally\n    }\n\n    public ComponentParameter(@MapsTo(\"name\") String name,\n                              @MapsTo(\"type\") String type,\n                              @MapsTo(\"category\") String category,\n                              @MapsTo(\"defaultValue\") String defaultValue,\n                              @MapsTo(\"label\") String label,\n                              @MapsTo(\"comboValues\") List<String> comboValues) {\n        this.name = name;\n        this.type = type;\n        this.category = category;\n        this.defaultValue = defaultValue;\n        this.label = label;\n        this.comboValues = comboValues;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n\n    public void setCategory(String category) {\n        this.category = category;\n    }\n\n    public String getDefaultValue() {\n        return defaultValue;\n    }\n\n    public void setDefaultValue(String defaultValue) {\n        this.defaultValue = defaultValue;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public void setLabel(String label) {\n        this.label = label;\n    }\n\n    public List<String> getComboValues() {\n        return comboValues;\n    }\n\n    public void setComboValues(List<String> comboValues) {\n        this.comboValues = comboValues;\n    }\n\n    \n    public boolean isMandatory() {\n        return mandatory;\n    }\n\n    \n    public void setMandatory(boolean mandatory) {\n        this.mandatory = mandatory;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/model/ExternalComponent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.model;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ExternalComponent {\n\n    public static final String COMPONENT_ID_KEY = \"componentId\";\n    public static final String COMPONENT_PARTITION_KEY = \"componentPartition\";\n\n    private String id;\n    private String name;\n    private String icon;\n    private String category;\n    private boolean noData;\n    private boolean provided;\n    private List<ComponentParameter> parameters;\n\n    public ExternalComponent() {\n        // do nothing\n    }\n\n    public ExternalComponent(@MapsTo(\"id\") String id,\n                             @MapsTo(\"name\") String name,\n                             @MapsTo(\"icon\") String icon,\n                             @MapsTo(\"noData\") boolean noData,\n                             @MapsTo(\"parameters\") List<ComponentParameter> parameters) {\n        this.id = id;\n        this.name = name;\n        this.icon = icon;\n        this.noData = noData;\n        this.parameters = parameters;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getIcon() {\n        return icon;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n\n    public boolean isNoData() {\n        return noData;\n    }\n\n    public List<ComponentParameter> getParameters() {\n        return parameters;\n    }\n    \n    public boolean isProvided() {\n        return provided;\n    }\n\n    \n    public void setProvided(boolean provided) {\n        this.provided = provided;\n    }\n    \n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/service/BackendComponentFunctionService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.external.service;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * List and calls functions available on backend.\n *\n */\n@Remote\npublic interface BackendComponentFunctionService {\n\n    List<String> listFunctions();\n\n    Object callFunction(String name, Map<String, Object> params);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/service/ComponentAssetProvider.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.service;\n\nimport java.io.InputStream;\n\npublic interface ComponentAssetProvider {\n    \n    InputStream openAsset(String componentAssetPath);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/service/ComponentLoader.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.service;\n\nimport java.util.List;\n\nimport org.dashbuilder.external.model.ExternalComponent;\n\npublic interface ComponentLoader {\n    \n    public static final String DESCRIPTOR_FILE = \"manifest.json\";\n\n    /**\n     * Load the list of components externally created by users .\n     * \n     * @return\n     * The list of external components.\n     */\n    List<ExternalComponent> loadExternal();\n\n    /**\n     * Load external components that are provided (built-in) by Dashbuilder.\n     * @return\n     * The list of provided external components\n     */\n    List<ExternalComponent> loadProvided();\n\n    /**\n     * The filesystem directory for external components.\n     * \n     * @return\n     */\n    String getExternalComponentsDir();\n\n    /**\n     * The internal path for provided components.\n     * \n     * @return\n     */\n    String getProvidedComponentsPath();\n\n    boolean isExternalComponentsEnabled();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/external/service/ComponentService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.external.service;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.dashbuilder.external.model.ExternalComponent;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface ComponentService {\n\n    List<ExternalComponent> listProvidedComponents();\n\n    List<ExternalComponent> listExternalComponents();\n    \n    List<ExternalComponent> listAllComponents();\n\n    Optional<ExternalComponent> byId(String componentId);\n    \n    \n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/perspectives/PerspectiveIds.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.perspectives;\n\npublic interface PerspectiveIds {\n\n    String HOME = \"HomePerspective\";\n    String DATA_SETS = \"DataSetAuthoringPerspective\";\n    String GALLERY = \"DisplayerGalleryPerspective\";\n    String CONTENT_MANAGER = \"ContentManagerPerspective\";\n    String DATA_TRANSFER = \"DataTransferPerspective\";\n    String APPS = \"AppsPerspective\";\n    String PLUGINS = \"PlugInAuthoringPerspective\";\n    String SALES_DASHBOARD = \"SalesDashboardPerspective\";\n    String SALES_REPORTS = \"SalesReportsPerspective\";\n    String SECURITY = \"SecurityManagementPerspective\";\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/renderer/service/RendererSettingsService.java",
    "content": "package org.dashbuilder.renderer.service;\n\nimport org.dashbuilder.renderer.RendererSettings;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n *  Provide access to Renderer settings.\n *  \n */\n@Remote\npublic interface RendererSettingsService {\n    \n    final static String DEFAULT_RENDERER_PROPERTY = \"org.dashbuilder.renderer.default\";\n    \n    final static String OFFLINE_RENDERER_PROPERTY = \"org.dashbuilder.renderer.offline\";\n    \n    public RendererSettings getSettings();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/transfer/DataTransferExportModel.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * Contains the dashboard elements that should be exported\n *\n */\npublic class DataTransferExportModel {\n\n    private static final DataTransferExportModel EXPORT_ALL = new DataTransferExportModel(Collections.emptyList(), Collections.emptyList(), true, true);\n\n    private List<DataSetDef> datasetDefinitions;\n    private List<String> pages;\n    private boolean exportNavigation;\n    private boolean exportAll;\n\n    public DataTransferExportModel() {}\n\n    public DataTransferExportModel(List<DataSetDef> datasetDefinitions, List<String> pages, boolean exportNavigation) {\n        this(datasetDefinitions, pages, exportNavigation, false);\n    }\n\n    protected DataTransferExportModel(List<DataSetDef> datasetDefinitions, List<String> pages, boolean exportNavigation, boolean exportAll) {\n        this.datasetDefinitions = datasetDefinitions;\n        this.pages = pages;\n        this.exportNavigation = exportNavigation;\n        this.exportAll = exportAll;\n    }\n\n    public static DataTransferExportModel exportAll() {\n        return EXPORT_ALL;\n    }\n\n    public List<DataSetDef> getDatasetDefinitions() {\n        return datasetDefinitions;\n    }\n\n    public void setDatasetDefinitions(List<DataSetDef> datasetDefinitions) {\n        this.datasetDefinitions = datasetDefinitions;\n    }\n\n    public List<String> getPages() {\n        return pages;\n    }\n\n    public void setPages(List<String> pages) {\n        this.pages = pages;\n    }\n\n    public boolean isExportNavigation() {\n        return exportNavigation;\n    }\n\n    public void setExportNavigation(boolean exportNavigation) {\n        this.exportNavigation = exportNavigation;\n    }\n\n    public boolean isExportAll() {\n        return exportAll;\n    }\n\n    public void setExportAll(boolean exportAll) {\n        this.exportAll = exportAll;\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/transfer/DataTransferServices.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface DataTransferServices {\n\n    public static final String FILE_PATH = \"dashbuilder-data-transfer\";\n    public static final String EXPORT_FILE_NAME = \"export.zip\";\n    public static final String IMPORT_FILE_NAME = \"import.zip\";\n    public static final String COMPONENTS_EXPORT_PATH = \"dashbuilder/components/\";\n\n    public static final String EXPORT_LOCATION_PROP = \"dashbuilder.export.dir\";\n    public static final String SHARE_OPEN_MODEL_PROP = \"dashbuilder.shareOpenModel\";\n    public static final String DB_STANDALONE_LOCATION_PROP = \"dashbuilder.runtime.location\";\n\n    public String doExport(DataTransferExportModel exportsModel) throws java.io.IOException;\n\n    public List<String> doImport() throws Exception;\n\n    public String generateExportUrl(DataTransferExportModel exportsModel) throws Exception;\n\n    public ExportInfo exportInfo();\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/transfer/ExportInfo.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.transfer;\n\nimport java.util.List;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\n\npublic class ExportInfo {\n\n    private boolean externalServerAvailable;\n\n    private List<DataSetDef> datasetsDefinitions;\n\n    private List<String> pages;\n\n    public ExportInfo() {}\n\n    public ExportInfo(List<DataSetDef> datasetsDefinitions,\n                      List<String> pages,\n                      boolean externalServerAvailable) {\n        this.datasetsDefinitions = datasetsDefinitions;\n        this.pages = pages;\n        this.externalServerAvailable = externalServerAvailable;\n    }\n\n    public List<DataSetDef> getDatasetsDefinitions() {\n        return datasetsDefinitions;\n    }\n\n    public List<String> getPages() {\n        return pages;\n    }\n\n    public boolean isExternalServerAvailable() {\n        return externalServerAvailable;\n    }\n\n    @Override\n    public String toString() {\n        return \"ExportModel [externalServerAvailable=\" + externalServerAvailable + \", \" +\n               \"datasetsDefinitions=\" + datasetsDefinitions + \",\" +\n               \" pages=\" + pages + \"]\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/java/org/dashbuilder/transfer/ExportModelValidationService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.transfer;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Perform validations on an ExportModel\n *\n */\n@Remote\npublic interface ExportModelValidationService {\n\n    /**\n     * Check if there is datasets not exported for the given export model\n     * \n     * @param exportModel\n     * The export model to be validated\n     * @return\n     * A map of pages with missing dependencies and the list of dependencies for each page.\n     */\n    Map<String, List<String>> checkMissingDatasets(DataTransferExportModel exportModel);\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-services-api/src/main/resources/org/dashbuilder/ServicesAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n\n  <source path='dataset'/>\n  <source path='navigation'/>\n  <source path='perspectives'/>\n  <source path='renderer'/>\n  <source path='transfer'/>\n  <source path='external'/>\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/README.md",
    "content": "Dashbuilder validations module\n==============================\n\nIntroduction\n--------------\nDashbuilder integrates with GWT & JSR303 Bean Validation framework in order to perform both client and server side bean validations.                \n\nThis module provides both client and server side validation factories, message resolvers and other related stuff.               \n\nNotes\n-----\n* As by transitive resolution mechanism the dependency for <code>org.hibernate:hibernate-validator:jar</code> is set to version <code>4.3.X</code>, and this version is incompatible with GWT validation framework, this module is using [Dashbuilder Hibernate Validator](../dashbuilder-hibernate-validator/README.md).                \n* As GWT validation framework does not support JSR303 custom Validation Providers (see <code>com.google.gwt.validation.client.impl.Validation#byProvider(Class<U> providerType)</code>, \n    this module is built on top of all dashbuilder shared modules and provides the default provider validation factory class and the default validation messages resolver.                      \n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>dashbuilder-shared</artifactId>\n    <groupId>org.dashbuilder</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>dashbuilder-validations</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Dashbuilder Validations</name>\n  <description>Dashbuilder validation factory and messages provider.</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <!-- GWT & Errai Bean Validation (JSR303) required artifacts. -->\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-validation</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.hibernate</groupId>\n      <artifactId>hibernate-validator</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n\n  </build>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/DataSetDefValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations;\n\nimport javax.validation.ConstraintViolation;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\n\n/**\n * Validator for {@link DataSetDef}\n */\npublic interface DataSetDefValidator<T extends DataSetDef> {\n\n    /**\n     * Retrieves the supported {@link DataSetDef} type\n     */\n    DataSetProviderType getSupportedProvider();\n\n    /**\n     * Validates the {@link DataSetDef} basic attributes\n     */\n    Iterable<ConstraintViolation<?>> validateBasicAttributes( DataSetDef dataSetDef );\n\n    /**\n     * Validates the {@link DataSetDef} specific attributes\n     */\n    Iterable<ConstraintViolation<?>> validateCustomAttributes( T dataSetDef, Object... params );\n\n    /**\n     * Validates a {@link DataSetDef}\n     */\n    Iterable<ConstraintViolation<?>> validate( T dataSetDef,\n                                               boolean isCacheEnabled,\n                                               boolean isPushEnabled,\n                                               boolean isRefreshEnabled,\n                                               Object... params );\n\n    Iterable<ConstraintViolation<?>> validateProviderType( DataSetDef dataSetDef );\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/DataSetValidatorProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.jboss.errai.common.client.api.Assert;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\n\n@ApplicationScoped\npublic class DataSetValidatorProvider {\n\n    private Map<String, DataSetDefValidator> validators = new HashMap<>();\n\n    private ManagedInstance<DataSetDefValidator> validatorsInstances;\n\n    @Inject\n    public DataSetValidatorProvider( ManagedInstance<DataSetDefValidator> validatorsInstances ) {\n        this.validatorsInstances = validatorsInstances;\n    }\n\n    @PostConstruct\n    public void init() {\n        for( DataSetDefValidator validator : validatorsInstances ) {\n            registerValidator( validator );\n        }\n    }\n\n    protected void registerValidator( DataSetDefValidator validator ) {\n        validators.put( validator.getSupportedProvider().getName(), validator );\n    }\n\n    public DataSetDefValidator getValidator( DataSetDef dataSetDef ) {\n        Assert.notNull(\"DataSetDef cannot be null\", dataSetDef);\n\n        DataSetDefValidator validator = validators.get( dataSetDef.getProvider().getName() );\n\n        if ( validator == null ) {\n            throw new IllegalArgumentException( \"Cannot find validator for type '\" + dataSetDef.getClass().getName() + \"'\" );\n        }\n\n        return validator;\n    }\n\n    public Iterable<ConstraintViolation<?>> validateAttributes( DataSetDef dataSetDef, Object... params ) {\n        DataSetDefValidator validator = getValidator( dataSetDef );\n\n        return validator.validateCustomAttributes( dataSetDef, params );\n    }\n\n    public Iterable<ConstraintViolation<?>> validate( DataSetDef dataSetDef,\n                                               boolean isCacheEnabled,\n                                               boolean isPushEnabled,\n                                               boolean isRefreshEnabled,\n                                               Object... params ) {\n        DataSetDefValidator validator = getValidator( dataSetDef );\n\n        return validator.validate( dataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, params );\n    }\n\n    public <T extends DataSetDef> Iterable<ConstraintViolation<?>> validateBasicAttributes( DataSetDef dataSetDef ) {\n        DataSetDefValidator validator = getValidator( dataSetDef );\n\n        return validator.validateBasicAttributes( dataSetDef );\n    }\n\n    public Iterable<ConstraintViolation<?>> validateProviderType( DataSetDef dataSetDef ) {\n        DataSetDefValidator validator = getValidator( dataSetDef );\n\n        return validator.validateProviderType( dataSetDef );\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/AbstractDataSetDefValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefBasicAttributesGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefCacheRowsValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefProviderTypeGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefPushSizeValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefRefreshIntervalValidation;\nimport org.dashbuilder.validations.DataSetDefValidator;\n\n/**\n * <p>The base data set definition validator.</p>\n * @since 0.4.0\n */\npublic abstract class AbstractDataSetDefValidator<T extends DataSetDef> implements DataSetDefValidator<T> {\n\n    protected Validator validator;\n\n    public AbstractDataSetDefValidator( Validator validator ) {\n        this.validator = validator;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateProviderType( final DataSetDef dataSetDef ) {\n        Set<ConstraintViolation<DataSetDef>> violations = validator.validate( dataSetDef, DataSetDefProviderTypeGroup.class );\n        return (Iterable<ConstraintViolation<?>>) (Set<?>) violations;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateBasicAttributes( DataSetDef dataSetDef ) {\n        Set<ConstraintViolation<DataSetDef>> violations = validator.validate( dataSetDef,\n                                                                      DataSetDefBasicAttributesGroup.class );\n        return (Iterable<ConstraintViolation<?>>) (Set<?>) violations;\n    }\n\n    protected Class[] getValidationGroups( final boolean isCacheEnabled,\n                                           final boolean isPushEnabled,\n                                           final boolean isRefreshEnabled,\n                                           final Class... groups ) {\n        List<Class> classes = new LinkedList<Class>();\n        classes.add( DataSetDefBasicAttributesGroup.class );\n        classes.add( DataSetDefProviderTypeGroup.class );\n        if ( isCacheEnabled ) {\n            classes.add( DataSetDefCacheRowsValidation.class );\n        }\n        if ( isPushEnabled ) {\n            classes.add( DataSetDefPushSizeValidation.class );\n        }\n        if ( isRefreshEnabled ) {\n            classes.add( DataSetDefRefreshIntervalValidation.class );\n        }\n        if ( groups != null ) {\n            for ( final Class group : groups ) {\n                classes.add( group );\n            }\n        }\n\n        return classes.toArray( new Class[classes.size()] );\n    }\n\n    protected Iterable<ConstraintViolation<?>> toIterable( Set<ConstraintViolation<T>> violations ) {\n        return (Iterable<ConstraintViolation<?>>) (Set<?>) violations;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/BeanDataSetDefValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.BeanDataSetDefValidation;\n\n/**\n * <p>The singleton application BEAN data set definition validator.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class BeanDataSetDefValidator extends AbstractDataSetDefValidator<BeanDataSetDef> {\n\n    @Inject\n    public BeanDataSetDefValidator( Validator validator ) {\n        super( validator );\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return DataSetProviderType.BEAN;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes( BeanDataSetDef dataSetDef, Object... params ) {\n        Set<ConstraintViolation<BeanDataSetDef>> _violations = validator.validate( dataSetDef,\n                                                                                   BeanDataSetDefValidation.class );\n        return toIterable( _violations );\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate( BeanDataSetDef dataSetDef,\n                                                      boolean isCacheEnabled,\n                                                      boolean isPushEnabled,\n                                                      boolean isRefreshEnabled,\n                                                      Object... params ) {\n        Set<ConstraintViolation<BeanDataSetDef>> _violations = validator.validate( dataSetDef,\n                                                                                   getValidationGroups( isCacheEnabled,\n                                                                                                        isPushEnabled,\n                                                                                                        isRefreshEnabled,\n                                                                                                        BeanDataSetDefValidation.class ) );\n        return toIterable( _violations );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/CSVDataSetDefValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefFilePathValidation;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefFileURLValidation;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefValidation;\n\n/**\n * <p>The singleton application CSV data set definition validator.</p>\n *\n * @since 0.4.0\n */\n@Dependent\npublic class CSVDataSetDefValidator extends AbstractDataSetDefValidator<CSVDataSetDef> {\n\n    @Inject\n    public CSVDataSetDefValidator( Validator validator ) {\n        super( validator );\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return DataSetProviderType.CSV;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes( CSVDataSetDef dataSetDef, Object... params) {\n        assert params != null && params.length == 1;\n        final Boolean isFilePath = (Boolean) params[0];\n        Set<ConstraintViolation<CSVDataSetDef>> _violations = validator.validate( dataSetDef,\n                                                                                  CSVDataSetDefValidation.class, isFilePath ? CSVDataSetDefFilePathValidation.class : CSVDataSetDefFileURLValidation.class);\n        return toIterable(_violations);\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate(CSVDataSetDef dataSetDef, boolean isCacheEnabled, boolean isPushEnabled, boolean isRefreshEnabled, Object... params) {\n        assert params != null && params.length == 1;\n        final Boolean isFilePath = (Boolean) params[0];\n        Set<ConstraintViolation<CSVDataSetDef>> _violations = validator.validate(dataSetDef,\n                getValidationGroups(isCacheEnabled, isPushEnabled, isRefreshEnabled, CSVDataSetDefValidation.class,\n                        isFilePath ? CSVDataSetDefFilePathValidation.class : CSVDataSetDefFileURLValidation.class));\n        return toIterable(_violations);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/KafkaDataSetDefValidator.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.KafkaDataSetDefValidation;\n\n@Dependent\npublic class KafkaDataSetDefValidator extends AbstractDataSetDefValidator<KafkaDataSetDef> {\n\n    @Inject\n    public KafkaDataSetDefValidator(Validator validator) {\n        super(validator);\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return DataSetProviderType.KAFKA;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes(KafkaDataSetDef dataSetDef, Object... params) {\n        Set<ConstraintViolation<KafkaDataSetDef>> violations = validator.validate(dataSetDef,\n                                                                                  KafkaDataSetDefValidation.class);\n        return toIterable(violations);\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate(KafkaDataSetDef dataSetDef,\n                                                     boolean isCacheEnabled,\n                                                     boolean isPushEnabled,\n                                                     boolean isRefreshEnabled,\n                                                     Object... params) {\n        Set<ConstraintViolation<KafkaDataSetDef>> violations = validator.validate(dataSetDef,\n                                                                                  getValidationGroups(isCacheEnabled,\n                                                                                                      isPushEnabled,\n                                                                                                      isRefreshEnabled,\n                                                                                                      KafkaDataSetDefValidation.class));\n        return toIterable(violations);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/PrometheusDataSetDefValidator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.PrometheusDataSetDefValidation;\n\n@Dependent\npublic class PrometheusDataSetDefValidator extends AbstractDataSetDefValidator<PrometheusDataSetDef> {\n\n    @Inject\n    public PrometheusDataSetDefValidator(Validator validator) {\n        super(validator);\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return DataSetProviderType.PROMETHEUS;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes(PrometheusDataSetDef dataSetDef, Object... params) {\n        Set<ConstraintViolation<PrometheusDataSetDef>> violations = validator.validate(dataSetDef,\n                                                                                       PrometheusDataSetDefValidation.class);\n        return toIterable(violations);\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate(PrometheusDataSetDef dataSetDef, boolean isCacheEnabled, boolean isPushEnabled, boolean isRefreshEnabled, Object... params) {\n        Set<ConstraintViolation<PrometheusDataSetDef>> violations = validator.validate(dataSetDef,\n                                                                                       getValidationGroups(isCacheEnabled,\n                                                                                                           isPushEnabled,\n                                                                                                           isRefreshEnabled,\n                                                                                                           PrometheusDataSetDefValidation.class));\n        return toIterable(violations);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/java/org/dashbuilder/validations/dataset/SQLDataSetDefValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\n\nimport org.dashbuilder.dataprovider.DataSetProviderType;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefDbSQLValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefDbTableValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefValidation;\n\n/**\n * <p>The singleton application SQL data set definition validator.</p>\n * @since 0.4.0\n */\n@Dependent\npublic class SQLDataSetDefValidator extends AbstractDataSetDefValidator<SQLDataSetDef> {\n\n    @Inject\n    public SQLDataSetDefValidator( Validator validator ) {\n        super( validator );\n    }\n\n    @Override\n    public DataSetProviderType getSupportedProvider() {\n        return DataSetProviderType.SQL;\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validateCustomAttributes( SQLDataSetDef dataSetDef, Object... params ) {\n        assert params != null && params.length == 1;\n        final Boolean isQuery = (Boolean) params[0];\n        Set<ConstraintViolation<SQLDataSetDef>> _violations = validator.validate( dataSetDef,\n                                                                                  SQLDataSetDefValidation.class,\n                                                                                  isQuery ? SQLDataSetDefDbSQLValidation.class : SQLDataSetDefDbTableValidation.class );\n        return toIterable( _violations );\n    }\n\n    @Override\n    public Iterable<ConstraintViolation<?>> validate( SQLDataSetDef dataSetDef,\n                                                      boolean isCacheEnabled,\n                                                      boolean isPushEnabled,\n                                                      boolean isRefreshEnabled,\n                                                      Object... params ) {\n        assert params != null && params.length == 1;\n        final Boolean isQuery = (Boolean) params[0];\n        Set<ConstraintViolation<SQLDataSetDef>> _violations = validator.validate( dataSetDef,\n                                                                                  getValidationGroups( isCacheEnabled,\n                                                                                                       isPushEnabled,\n                                                                                                       isRefreshEnabled,\n                                                                                                       SQLDataSetDefValidation.class,\n                                                                                                       isQuery ? SQLDataSetDefDbSQLValidation.class : SQLDataSetDefDbTableValidation.class ) );\n        return toIterable( _violations );\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.dashbuilder.validations.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/main/resources/org/dashbuilder/CommonValidations.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.dashbuilder.DatasetClient\" />\n\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n\n  <inherits name=\"org.hibernate.validator.HibernateValidator\" />\n\n  <inherits name=\"org.jboss.errai.validation.Validation\" />\n\n  <source path='validations'/>\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/AbstractValidationTest.java",
    "content": "package org.dashbuilder.validations.dataset;\n\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Validator;\nimport javax.validation.metadata.BeanDescriptor;\n\nimport static org.mockito.Mockito.*;\n\npublic class AbstractValidationTest {\n\n    protected Validator validator;\n\n    public void setup() {\n        validator = spy(new ValidatorMock());\n    }\n\n    // Mockito is not able to mock javax.validation.Validator, so let's create an empty implementation and spy it.\n    class ValidatorMock implements Validator {\n\n        @Override\n        public <T> Set<ConstraintViolation<T>> validate(T object, Class<?>... groups) {\n            return null;\n        }\n\n        @Override\n        public <T> Set<ConstraintViolation<T>> validateProperty(T object, String propertyName, Class<?>... groups) {\n            return null;\n        }\n\n        @Override\n        public <T> Set<ConstraintViolation<T>> validateValue(Class<T> beanType, String propertyName, Object value, Class<?>... groups) {\n            return null;\n        }\n\n        @Override\n        public BeanDescriptor getConstraintsForClass(Class<?> clazz) {\n            return null;\n        }\n\n        @Override\n        public <T> T unwrap(Class<T> type) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/BeanDataSetDefValidatorTest.java",
    "content": "package org.dashbuilder.validations.dataset;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.BeanDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.BeanDataSetDefValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefBasicAttributesGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefCacheRowsValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefProviderTypeGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefPushSizeValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefRefreshIntervalValidation;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BeanDataSetDefValidatorTest extends AbstractValidationTest {\n\n    @Mock\n    BeanDataSetDef beanDataSetDef;\n    private BeanDataSetDefValidator tested;\n\n\n    @Before\n    public void setup() {\n        super.setup();\n        tested = spy(new BeanDataSetDefValidator( validator ));\n    }\n\n    @Test\n    public void testValidateAttributes() {\n        tested.validateCustomAttributes( beanDataSetDef);\n        verify(validator, times(1)).validate(beanDataSetDef, BeanDataSetDefValidation.class);\n    }\n\n    @Test\n    public void testValidate() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled);\n        verify(validator, times(1)).validate(beanDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                BeanDataSetDefValidation.class);\n    }\n\n    @Test\n    public void testValidateNoCache() {\n        final boolean isCacheEnabled = false;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled);\n        verify(validator, times(1)).validate(beanDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                BeanDataSetDefValidation.class);\n    }\n\n    @Test\n    public void testValidateNoPush() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = false;\n        final boolean isRefreshEnabled = true;\n        tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled);\n        verify(validator, times(1)).validate(beanDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                BeanDataSetDefValidation.class);\n    }\n\n    @Test\n    public void testValidateNoRefresh() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = false;\n        tested.validate(beanDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled);\n        verify(validator, times(1)).validate(beanDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                BeanDataSetDefValidation.class);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/CSVDataSetDefValidatorTest.java",
    "content": "package org.dashbuilder.validations.dataset;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.CSVDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefFilePathValidation;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefFileURLValidation;\nimport org.dashbuilder.dataset.validation.groups.CSVDataSetDefValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefBasicAttributesGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefCacheRowsValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefProviderTypeGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefPushSizeValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefRefreshIntervalValidation;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class CSVDataSetDefValidatorTest extends AbstractValidationTest {\n\n    @Mock\n    CSVDataSetDef csvDataSetDef;\n    private CSVDataSetDefValidator tested;\n\n\n    @Before\n    public void setup() {\n        super.setup();\n        tested = spy(new CSVDataSetDefValidator( validator));\n    }\n\n    @Test\n    public void testValidateAttributesUsingFilePath() {\n        final boolean isUsingFilePath = true;\n        tested.validateCustomAttributes( csvDataSetDef, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef, CSVDataSetDefValidation.class, CSVDataSetDefFilePathValidation.class);\n    }\n\n    @Test\n    public void testValidateAttributesUsingFileUrl() {\n        final boolean isUsingFilePath = false;\n        tested.validateCustomAttributes( csvDataSetDef, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef, CSVDataSetDefValidation.class, CSVDataSetDefFileURLValidation.class);\n    }\n\n    @Test\n    public void testValidateUsingFilePath() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingFilePath = true;\n        tested.validate(csvDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                CSVDataSetDefValidation.class,\n                CSVDataSetDefFilePathValidation.class);\n    }\n\n    @Test\n    public void testValidateUsingFileUrl() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingFilePath = false;\n        tested.validate(csvDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                CSVDataSetDefValidation.class,\n                CSVDataSetDefFileURLValidation.class);\n    }\n\n    @Test\n    public void testValidateNoCache() {\n        final boolean isCacheEnabled = false;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingFilePath = false;\n        tested.validate(csvDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                CSVDataSetDefValidation.class,\n                CSVDataSetDefFileURLValidation.class);\n    }\n\n    @Test\n    public void testValidateNoPush() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = false;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingFilePath = false;\n        tested.validate(csvDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                CSVDataSetDefValidation.class,\n                CSVDataSetDefFileURLValidation.class);\n    }\n\n    @Test\n    public void testValidateNoRefresh() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = false;\n        final boolean isUsingFilePath = false;\n        tested.validate(csvDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingFilePath);\n        verify(validator, times(1)).validate(csvDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                CSVDataSetDefValidation.class,\n                CSVDataSetDefFileURLValidation.class);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/KafkaDataSetDefValidatorTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.validations.dataset;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.KafkaDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.KafkaDataSetDefValidation;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class KafkaDataSetDefValidatorTest extends AbstractValidationTest {\n\n    @Mock\n    KafkaDataSetDef kafkaDataSetDef;\n    private KafkaDataSetDefValidator tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        tested = spy(new KafkaDataSetDefValidator(validator));\n    }\n\n    @Test\n    public void testValidate() {\n        tested.validateCustomAttributes(kafkaDataSetDef);\n        verify(validator).validate(kafkaDataSetDef, KafkaDataSetDefValidation.class);\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/PrometheusDataSetDefValidatorTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.validations.dataset;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.PrometheusDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.PrometheusDataSetDefValidation;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PrometheusDataSetDefValidatorTest extends AbstractValidationTest {\n\n    @Mock\n    PrometheusDataSetDef prometheusDataSetDef;\n    private PrometheusDataSetDefValidator tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        tested = spy(new PrometheusDataSetDefValidator(validator));\n    }\n\n    @Test\n    public void testValidate() {\n        tested.validateCustomAttributes(prometheusDataSetDef);\n        verify(validator).validate(prometheusDataSetDef, PrometheusDataSetDefValidation.class);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/dashbuilder-validations/src/test/java/org/dashbuilder/validations/dataset/SQLDataSetDefValidatorTest.java",
    "content": "package org.dashbuilder.validations.dataset;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.dashbuilder.dataset.def.SQLDataSetDef;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefBasicAttributesGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefCacheRowsValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefProviderTypeGroup;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefPushSizeValidation;\nimport org.dashbuilder.dataset.validation.groups.DataSetDefRefreshIntervalValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefDbSQLValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefDbTableValidation;\nimport org.dashbuilder.dataset.validation.groups.SQLDataSetDefValidation;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SQLDataSetDefValidatorTest extends AbstractValidationTest {\n\n    @Mock SQLDataSetDef sqlDataSetDef;\n    private SQLDataSetDefValidator tested;\n\n\n    @Before\n    public void setup() {\n        super.setup();\n        tested = spy(new SQLDataSetDefValidator( validator ));\n    }\n\n    @Test\n    public void testValidateAttributesUsingQuery() {\n        final boolean isUsingQuery = true;\n        tested.validateCustomAttributes( sqlDataSetDef, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef, SQLDataSetDefValidation.class, SQLDataSetDefDbSQLValidation.class);\n    }\n\n    @Test\n    public void testValidateAttributesUsingTable() {\n        final boolean isUsingQuery = false;\n        tested.validateCustomAttributes( sqlDataSetDef, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef, SQLDataSetDefValidation.class, SQLDataSetDefDbTableValidation.class);\n    }\n\n\n    @Test\n    public void testValidateUsingQuery() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingQuery = true;\n        tested.validate(sqlDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                SQLDataSetDefValidation.class,\n                SQLDataSetDefDbSQLValidation.class);\n    }\n\n    @Test\n    public void testValidateUsingTable() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingQuery = false;\n        tested.validate(sqlDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                SQLDataSetDefValidation.class,\n                SQLDataSetDefDbTableValidation.class);\n    }\n\n    @Test\n    public void testValidateNoCache() {\n        final boolean isCacheEnabled = false;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingQuery = false;\n        tested.validate(sqlDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefPushSizeValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                SQLDataSetDefValidation.class,\n                SQLDataSetDefDbTableValidation.class);\n    }\n\n    @Test\n    public void testValidateNoPush() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = false;\n        final boolean isRefreshEnabled = true;\n        final boolean isUsingQuery = false;\n        tested.validate(sqlDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefRefreshIntervalValidation.class,\n                SQLDataSetDefValidation.class,\n                SQLDataSetDefDbTableValidation.class);\n    }\n\n    @Test\n    public void testValidateNoRefresh() {\n        final boolean isCacheEnabled = true;\n        final boolean isPushEnabled = true;\n        final boolean isRefreshEnabled = false;\n        final boolean isUsingQuery = false;\n        tested.validate(sqlDataSetDef, isCacheEnabled, isPushEnabled, isRefreshEnabled, isUsingQuery);\n        verify(validator, times(1)).validate(sqlDataSetDef,\n                DataSetDefBasicAttributesGroup.class,\n                DataSetDefProviderTypeGroup.class,\n                DataSetDefCacheRowsValidation.class,\n                DataSetDefPushSizeValidation.class,\n                SQLDataSetDefValidation.class,\n                SQLDataSetDefDbTableValidation.class);\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-shared/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-shared</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Shared</name>\n\n  <modules>\n    <module>dashbuilder-displayer-api</module>\n    <module>dashbuilder-validations</module>\n    <module>dashbuilder-navigation-api</module>\n    <module>dashbuilder-services-api</module>\n    <module>dashbuilder-kie-server-api</module>\n    <module>dashbuilder-js</module>\n    <module>dashbuilder-dsl</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/.gitignore",
    "content": "*.deploy\n/src/main/gwt-unitCache\n/src/main/webapp/WEB-INF/classes/\n/src/main/webapp/WEB-INF/lib\n/src/main/webapp/org.dashbuilder.DashbuilderShowcase/\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/README.md",
    "content": "Dashbuilder web application\n============================\n\nSystem metrics dashboard\n------------------------\n\nThis web application provides an example dashboard for monitoring real time system metrics.            \n\nThe dashboard is called **System metrics** and can be found in the tree menu *combined* of the gallery perspective.                \n\nIn order to run this example you must enable and configure the <code>collectd</code> daemon (Unix/Linux systems) as:                     \n\n1.- Install <code>collectd</code> package         \n    \n        sudo yum install collectd\n        \n2.- Configure <code>/etc/collectd.conf</code> as the following example:\n\n        Hostname    \"host.example.com\"\n        Interval     1\n        LoadPlugin memory\n        LoadPlugin csv\n        <Plugin csv>\n            # Use a custom data dir location.\n        \tDataDir\t\"/tmp/metrics/csv\"\n        \tStoreRates false\n        </Plugin>\n        \n3.- Start the service                 \n\n    service collectd start\n\n4.- Check service is up             \n\n    service collectd status\n\n5.- Create a new data set definition or modify the <code>filePath</code> value of existing file located at [here](./src/main/webapp/datasets/metrics_csv.dset) as:            \n\n    {\n        \"uuid\": \"metrics_csv\",\n        \"provider\": \"CSV\",\n        \"isPublic\": true,\n        \"refreshTime\": \"1second\",\n        \"refreshAlways\": \"true\",\n        \"filePath\": \"/tmp/metrics/csv/host.example.com/memory/memory-used-2015-02-04\",\n        \"separatorChar\": \",\",\n        \"quoteChar\": \"\\\"\",\n        \"escapeChar\": \"\\\\\",\n        \"datePattern\": \"epoch\",\n        \"numberPattern\": \"#.##\",\n        \"columns\": [\n          {\"id\": \"epoch\", \"type\": \"date\", \"pattern\": \"epoch\"},\n          {\"id\": \"value\", \"type\": \"number\", \"pattern\": \"#.##\"}\n        ]\n    }\n\n6.- Run the web application and navigate to *System metrics* dashboard                \n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.dashbuilder</groupId>\n    <artifactId>dashbuilder-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>dashbuilder-webapp</artifactId>\n  <packaging>war</packaging>\n\n  <name>Dashbuilder WebApp</name>\n  <description>Dashbuilder WebApp</description>\n\n  <properties>\n    <!-- Add the absolute path for $JBOSS_HOME below to manage another instance -->\n    <errai.jboss.home>${project.build.directory}/wildfly-${version.org.wildfly}</errai.jboss.home>\n    <gwt.compiler.skip>false</gwt.compiler.skip>\n    <gwt.compiler.localWorkers>4</gwt.compiler.localWorkers>\n  </properties>\n\n  <!-- NOTE: GWT client deps are needed for GWT compilation purposes (scope=provided) -->\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.xnio</groupId>\n      <artifactId>xnio-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet.jsp</groupId>\n      <artifactId>jakarta.servlet.jsp-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.xml.bind</groupId>\n      <artifactId>jakarta.xml.bind-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.security.jacc</groupId>\n      <artifactId>jakarta.security.jacc-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <!-- Dashbuilder -->\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-server-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-dataset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-client-all</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-common-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-kie-server-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-external-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-screen</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-dataset-editor</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-displayer-editor</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-default</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-c3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-renderer-chartjs</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-navigation-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.dashbuilder</groupId>\n      <artifactId>dashbuilder-cms-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\t    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-bridge</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-table</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-simple-docks-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire Preferences. -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-ui-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire Security (Extension) -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-servlet-security</artifactId>\n    </dependency>\n\n    <!-- Uberfire Security Management -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-wildfly</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-security-management</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-client-wb</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire Experimentals -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Log -->\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>log4j-over-slf4j</artifactId>\n    </dependency>\n\n    <!-- Errai -->\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>de.benediktmeurer.gwt-slf4j</groupId>\n      <artifactId>gwt-slf4j</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-javax-enterprise</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-jboss-as-support</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.owasp.encoder</groupId>\n      <artifactId>encoder</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-codegen-gwt</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-validation</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n      <classifier>sources</classifier>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.hibernate</groupId>\n      <artifactId>hibernate-validator</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.hibernate</groupId>\n      <artifactId>hibernate-validator</artifactId>\n      <scope>provided</scope>\n      <classifier>sources</classifier>\n    </dependency>\n\n    <!-- Container provided dependencies -->\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-jboss</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>xml-apis</groupId>\n      <artifactId>xml-apis</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.sun.xml.bind</groupId>\n      <artifactId>jaxb-impl</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-cdi</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-jaxrs</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.servlet</groupId>\n          <artifactId>javax.servlet-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire SSH -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.inject</groupId>\n      <artifactId>guice</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-data-binding</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <finalName>${project.artifactId}</finalName>\n    <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>\n\n    <plugins>\n\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>gwt-maven-plugin</artifactId>\n        <configuration>\n          <deploy>${project.build.directory}/gwt-symbols-deploy</deploy>\n          <localWorkers>${gwt.compiler.localWorkers}</localWorkers>\n          <module>org.dashbuilder.FastCompiledDashbuilderShowcase</module>\n          <draftCompile>true</draftCompile>\n          <logLevel>INFO</logLevel>\n          <strict>true</strict>\n          <compileSourcesArtifacts>\n\n            <!-- Dashbuilder -->\n            <compileSourcesArtifact>org.kie.soup:kie-soup-json</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-widgets</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-validations</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-common-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-services-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-dataset-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-dataset-shared</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-dataset-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-screen</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-displayer-editor</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-dataset-editor</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-default</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-chartjs</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-renderer-c3</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-navigation-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-navigation-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-cms-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-kie-server-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.dashbuilder:dashbuilder-kie-server-client</compileSourcesArtifact>\n            \n            <!-- Uberfire ext -->\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-layout-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-layout-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-core-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-service-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-table</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-simple-docks-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client-backend</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-ui-client</compileSourcesArtifact>\n\n            <compileSourcesArtifact>org.kie.soup:kie-soup-commons</compileSourcesArtifact>\n\n            <!-- UberFire -->\n            <compileSourcesArtifact>org.uberfire:uberfire-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-nio2-model</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-io</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-js</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:appformer-js-bridge</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-client-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-backend</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-views-patternfly</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-backend-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-api</compileSourcesArtifact>\n\n            <!-- UberFire Security Management -->\n            <compileSourcesArtifact>org.uberfire:uberfire-security-management-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-management-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-management-client-wb</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-security-management</compileSourcesArtifact>\n\n            <!-- Uberfire Experimentals -->\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-client</compileSourcesArtifact>\n\n          </compileSourcesArtifacts>\n          <runTarget>dashbuilder.html</runTarget>\n\t  <extraJvmArgs>-Xmx4024m -XX:CompileThreshold=7000 -Derrai.jboss.home=${errai.jboss.home} -Derrai.jboss.debug.port=8787 -Ddashbuilder.components.enable=true -Ddashbuilder.export.dir=/tmp/dashbuilder/models -Ddashbuilder.runtime.location=http://localhost:8280 -Ddashbuilder.shareOpenModel=true -Ddashbuilder.kieserver.serverTemplate.default.location=http://localhost:8080/kie-server/services/rest/server -Ddashbuilder.kieserver.serverTemplate.default.user=kieserver -Ddashbuilder.kieserver.serverTemplate.default.password=kieserver1! -Ddashbuilder.kieserver.defaultServerTemplate=default -Ddashbuilder.kieserver.serverTemplates=default</extraJvmArgs>\n          <noServer>false</noServer>\n          <server>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</server>\n          <hostedWebapp>src/main/webapp</hostedWebapp>\n          <webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>\n          <disableCastChecking>true</disableCastChecking>\n        </configuration>\n        <executions>\n          <execution>\n            <id>gwt-clean</id>\n            <phase>clean</phase>\n            <goals>\n              <goal>clean</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>gwt-compile</id>\n            <goals>\n              <goal>resources</goal>\n              <goal>compile</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-war-plugin</artifactId>\n        <configuration>\n          <packagingExcludes>**/javax/**/*.*,**/client/**/*.class,**/*.symbolMap</packagingExcludes>\n          <archive>\n            <addMavenDescriptor>false</addMavenDescriptor>\n          </archive>\n        </configuration>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>src/main/webapp/org.dashbuilder.DashbuilderShowcase/</include>\n                <include>src/main/webapp/WEB-INF/classes/</include>\n                <include>src/main/webapp/WEB-INF/deploy/</include>\n                <include>src/main/webapp/WEB-INF/lib/</include>\n                <include>**/gwt-unitCache/**</include>\n                <include>.errai/</include>\n                <include>.niogit/**</include>\n                <include>.index/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.jboss.errai</groupId>\n                  <artifactId>wildfly-dist</artifactId>\n                  <version>${version.org.jboss.errai.wildfly}</version>\n                  <type>zip</type>\n                  <overWrite>false</overWrite>\n                  <outputDirectory>${project.build.directory}</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <skip>${gwt.compiler.skip}</skip>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-resources-plugin</artifactId>\n        <version>2.6</version>\n        <executions>\n          <execution>\n            <id>copy-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.directory}/wildfly-${version.org.wildfly}/standalone/deployments</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>src/test/resources/datasources</directory>\n                  <filtering>true</filtering>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n\n    </plugins>\n\n  </build>\n\n  <profiles>\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <plugin><!-- Keep in sync with soa profile -->\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <!-- Build all GWT permutations and optimize them -->\n              <module>org.dashbuilder.DashbuilderShowcase</module>\n              <draftCompile>false</draftCompile>\n              <force>true</force>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n    <!-- profile to disable GWT compilation of showcase (useful in full downstream builds) -->\n    <profile>\n      <id>no-showcase</id>\n      <build>\n        <plugins>\n          <plugin>\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <skip>true</skip>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/ApplicationScopedProducer.java",
    "content": "package org.dashbuilder.backend;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.backend.server.IOWatchServiceAllImpl;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceNio2WrapperImpl;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.RequestScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\n@Startup(value = StartupType.BOOTSTRAP)\n@ApplicationScoped\npublic class ApplicationScopedProducer {\n\n    @Inject\n    private AuthenticationService authenticationService;\n\n    @Inject\n    private IOWatchServiceAllImpl watchService;\n\n    private IOService ioService;\n\n    @PostConstruct\n    public void setup() {\n        ioService  = new IOServiceNio2WrapperImpl(\"1\", watchService);\n    }\n\n    @Produces\n    @Named(\"ioStrategy\")\n    public IOService ioService() {\n        return ioService;\n    }\n\n    @Produces\n    @RequestScoped\n    public User getIdentity() {\n        return authenticationService.getUser();\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/ClusterMetricsGenerator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.dashbuilder.dataset.*;\nimport org.dashbuilder.dataset.date.TimeAmount;\n\nimport java.util.*;\n\n/**\n * Generates metrics on an emulated cluster\n */\npublic class ClusterMetricsGenerator implements DataSetGenerator {\n\n    public static final String COLUMN_SERVER = \"server\";\n    public static final String COLUMN_TIMESTAMP = \"timestamp\";\n    public static final String COLUMN_CPU0 = \"cpu0\";\n    public static final String COLUMN_CPU1 = \"cpu1\";\n    public static final String COLUMN_MEMORY_FREE = \"mem_free\";\n    public static final String COLUMN_MEMORY_USED = \"mem_used\";\n    public static final String COLUMN_NETWORK_TX = \"tx\";\n    public static final String COLUMN_NETWORK_RX = \"rx\";\n    public static final String COLUMN_PROCESSES_RUNNING = \"p_running\";\n    public static final String COLUMN_PROCESSES_SLEEPING  = \"p_sleeping\";\n    public static final String COLUMN_DISK_FREE = \"disk_free\";\n    public static final String COLUMN_DISK_USED = \"disk_used\";\n\n    \n    DataSet dataSet = null;\n    long timeFrameMillis = 100000;\n    List<String> aliveNodes = new ArrayList<>();\n    List<String> overloadedNodes = new ArrayList<>();\n\n    public ClusterMetricsGenerator() {\n        dataSet = DataSetFactory.newDataSetBuilder()\n                .column(COLUMN_SERVER, ColumnType.LABEL)\n                .column(COLUMN_TIMESTAMP, ColumnType.DATE)\n                .column(COLUMN_CPU0, ColumnType.NUMBER)\n                .column(COLUMN_CPU1, ColumnType.NUMBER)\n                .column(COLUMN_MEMORY_FREE, ColumnType.NUMBER)\n                .column(COLUMN_MEMORY_USED, ColumnType.NUMBER)\n                .column(COLUMN_NETWORK_TX, ColumnType.NUMBER)\n                .column(COLUMN_NETWORK_RX, ColumnType.NUMBER)\n                .column(COLUMN_PROCESSES_RUNNING, ColumnType.NUMBER)\n                .column(COLUMN_PROCESSES_SLEEPING, ColumnType.NUMBER)\n                .column(COLUMN_DISK_FREE, ColumnType.NUMBER)\n                .column(COLUMN_DISK_USED, ColumnType.NUMBER)\n                .buildDataSet();\n    }\n\n    public synchronized DataSet buildDataSet(Map<String,String> params) {\n        // Check if the data set is up to date.\n        long now = System.currentTimeMillis();\n        long last = dataSet.getRowCount() > 0 ? ((Date)dataSet.getValueAt(0, 1)).getTime() : -1;\n        long diff = now-last;\n        if (last != -1 && diff < 1000) {\n            return dataSet;\n        }\n\n        if (!StringUtils.isBlank(params.get(\"timeFrame\"))) {\n            String p = params.get(\"timeFrame\");\n            if (p != null && p.trim().length() > 0) {\n                TimeAmount timeFrame = TimeAmount.parse(p);\n                timeFrameMillis = timeFrame.toMillis();\n            }\n        }\n        if (params.containsKey(\"aliveNodes\")) {\n            aliveNodes.clear();\n            aliveNodes.addAll(Arrays.asList(StringUtils.split(params.get(\"aliveNodes\"), \",\")));\n        }\n        if (params.containsKey(\"overloadedNodes\")) {\n            overloadedNodes.clear();\n            overloadedNodes.addAll(Arrays.asList(StringUtils.split(params.get(\"overloadedNodes\"), \",\")));\n        }\n        if (aliveNodes.isEmpty()) {\n            return dataSet;\n        }\n        if (diff > timeFrameMillis) {\n            diff = timeFrameMillis;\n        }\n\n        // Create a new data set containing the missing metrics since the last update.\n        if (last == -1) last = now-timeFrameMillis;\n        DataSet newDataSet = dataSet.cloneEmpty();\n        long seconds = diff / 1000;\n\n        for (long i = 1; i <=seconds; i++) {\n            long metricTime = last + i*1000;\n            for (int j = 0; j < aliveNodes.size(); j++) {\n                Double lastCpu0 = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 2) : null;\n                Double lastCpu1 = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 3) : null;\n                Double lastFreeMem = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 4) : null;\n                Double lastTx = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 6) : null;\n                Double lastRx = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 7) : null;\n                Double lastRunningProc = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 8) : null;\n                Double lastSleepingProc = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 9) : null;\n                Double lastFreeDisk = dataSet.getRowCount() > j ? (Double) dataSet.getValueAt(j, 10) : null;\n\n                String node = aliveNodes.get(j);\n                double memFree = mem(node, lastFreeMem, 16d, 12d);\n                double diskFree = disk(node, lastFreeDisk, 4000d, 3600d);\n\n                newDataSet.addValuesAt(0, node, new Date(metricTime),\n                        cpu(node, lastCpu0, 100d, 90d), cpu(node, lastCpu1, 100d, 90d),\n                        memFree, 16-memFree,\n                        net(node, lastTx, 4000d, 3000d), net(node, lastRx, 2000d, 1800d),\n                        proc(node, lastRunningProc, 1500d, 1024d), proc(node, lastSleepingProc, 500d, 400d),\n                        diskFree, 4000-diskFree);\n            }\n        }\n        // Add the remain metric history\n        boolean outOfBounds = false;\n        Date threshold = new Date(now - timeFrameMillis);\n        for (int i = 0; i < dataSet.getRowCount() && !outOfBounds; i++) {\n            Date metricTime = (Date)dataSet.getValueAt(i, 1);\n            if (metricTime.after(threshold)) {\n                newDataSet.addValues(\n                        dataSet.getValueAt(i, 0),\n                        dataSet.getValueAt(i, 1),\n                        dataSet.getValueAt(i, 2),\n                        dataSet.getValueAt(i, 3),\n                        dataSet.getValueAt(i, 4),\n                        dataSet.getValueAt(i, 5),\n                        dataSet.getValueAt(i, 6),\n                        dataSet.getValueAt(i, 7),\n                        dataSet.getValueAt(i, 8),\n                        dataSet.getValueAt(i, 9),\n                        dataSet.getValueAt(i, 10),\n                        dataSet.getValueAt(i, 11));\n            } else {\n                outOfBounds = true;\n            }\n        }\n        return dataSet = newDataSet;\n    }\n\n    /**\n     * Network (kbps)\n     */\n    public Double net(String node, Double last, Double max, Double overloaded) {\n        double r = Math.random() - 0.5;\n        if (overloadedNodes.contains(node)) {\n            if (last == null) {\n                return max + 100 * r;\n            } else {\n                double v = last + 100 * r;\n                if (v > max) return max;\n                if (v < overloaded) return overloaded;\n                return v;\n            }\n        }\n        if (last == null) {\n            return 1000 + 100 * r;\n        } else {\n            double v = last + 100 * r;\n            if (v > max) return max;\n            if (v < 0) return 0d;\n            return v;\n        }\n    }\n\n    /**\n     * Processes (count)\n     * Overloaded values : from 1024 to 1500\n     */\n    public Double proc(String node, Double last, Double max, Double overloaded) {\n        double r = Math.random() - 0.5;\n        if (overloadedNodes.contains(node)) {\n            if (last == null) {\n                return overloaded;\n            } else {\n                double v = last + 100 * r;\n                if (v > max) return max;\n                if (v < overloaded) return overloaded;\n                return v;\n            }\n        }\n        if (last == null) {\n            return 280 + 10 * r;\n        } else {\n            double v = last + 10 * r;\n            if (v > max) return max;\n            if (v < 0) return 0d;\n            return v;\n        }\n    }\n\n    /**\n     * Disk space (Gb) \n     */\n    public Double disk(String node, Double last, Double max, Double overloaded) {\n        double r = Math.random() - 0.5;\n        if (overloadedNodes.contains(node)) {\n            if (last == null) {\n                return overloaded + 400 * r;\n            } else {\n                double v = last + 400 * r;\n                if (v > max) return max;\n                if (v < overloaded) return overloaded;\n                return v;\n            }\n        }\n        if (last == null) {\n            return 500 + 400 * r;\n        } else {\n            double v = last + 400 * r;\n            if (v > max) return max;\n            if (v < 0) return 0d;\n            return v;\n        }\n    }\n\n    /**\n     * CPU (%) \n     * Overloaded values : from 90% to 100% \n     */\n    public Double cpu(String node, Double last, Double max, Double overloaded) {\n        double r = Math.random() - 0.5;\n        if (overloadedNodes.contains(node)) {\n            if (last == null) {\n                return overloaded + 10 * r;\n            } else {\n                double v = last + 10 * r;\n                if (v > max) return max;\n                if (v < overloaded) return overloaded;\n                return v;\n            }\n        }\n        if (last == null) {\n            return 20 + 20 * r;\n        } else {\n            double v = last + 10 * r;\n            if (v > max) return max;\n            if (v < 0) return 0d;\n            return v;\n        }\n    }\n\n    /**\n     * Memory (Gb) \n     * Overloaded values : from 3Gb to 4Gb \n     */\n    public Double mem(String node, Double last, Double max, Double overloaded) {\n        double r = Math.random() - 0.5;\n        if (overloadedNodes.contains(node)) {\n            if (last == null) {\n                return overloaded + r;\n            } else {\n                double v = last + r;\n                if (v > max) return max;\n                if (v < overloaded) return overloaded;\n                return v;\n            }\n        }\n        if (last == null) {\n            return 1 + r;\n        } else {\n            double v = last + r;\n            if (v > max) return max;\n            if (v < 0) return 0d;\n            return v;\n        }\n    }\n\n    public static void main(String[] args) throws Exception {\n        ClusterMetricsGenerator g = new ClusterMetricsGenerator();\n        Map<String,String> params = new HashMap<>();\n        params.put(\"aliveNodes\", \"server1\");\n        params.put(\"timeFrame\", \"10second\");\n        System.out.println(\"************* Single node not overloaded *******************************\");\n        for (int i = 0; i < 5; i++) {\n            DataSet dataSet = g.buildDataSet(params);\n            printDataSet(dataSet);\n            Thread.sleep(1000);\n        }\n\n        System.out.println(\"************* Two nodes and the second one overloaded *******************************\");\n        g = new ClusterMetricsGenerator();\n        params = new HashMap<>();\n        params.put(\"aliveNodes\", \"server1,server2\");\n        params.put(\"overloadedNodes\", \"server2\");\n        params.put(\"timeFrame\", \"10second\");\n        for (int i = 0; i < 5; i++) {\n            DataSet dataSet = g.buildDataSet(params);\n            printDataSet(dataSet);\n            Thread.sleep(1000);\n        }\n    }\n\n    /**\n     * Helper method to print to standard output the dataset values.\n     */\n    protected static void printDataSet(DataSet dataSet) {\n        final String SPACER = \"| \\t |\";\n\n        if (dataSet == null) System.out.println(\"DataSet is null\");\n        if (dataSet.getRowCount() == 0) System.out.println(\"DataSet is empty\");\n\n        List<DataColumn> dataSetColumns = dataSet.getColumns();\n        int colColunt = dataSetColumns.size();\n        int rowCount = dataSet.getRowCount();\n\n        System.out.println(\"********************************************************************************************************************************************************\");\n        for (int row = 0; row < rowCount; row++) {\n            System.out.print(SPACER);\n            for (int col= 0; col< colColunt; col++) {\n                Object value = dataSet.getValueAt(row, col);\n                String colId = dataSet.getColumnByIndex(col).getId();\n                System.out.print(colId + \": \" +  value);\n                System.out.print(SPACER);\n            }\n            System.out.println(\"\");\n        }\n        System.out.println(\"********************************************************************************************************************************************************\");\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/RepositoryServiceImpl.java",
    "content": "/*\n * Copyright 2022 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Default;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryAlreadyExistsException;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryInfo;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.spaces.Space;\n\n/**\n * This is not used with Dashbuilder WebApp, but mocks the service so dashbuilder webapp can run\n *\n */\n@Default\n@ApplicationScoped\npublic class RepositoryServiceImpl implements RepositoryService {\n\n    @Override\n    public void addGroup(Repository arg0, String arg1) {\n        // empty\n\n    }\n\n    @Override\n    public Repository createRepository(OrganizationalUnit arg0,\n                                       String arg1,\n                                       String arg2,\n                                       RepositoryEnvironmentConfigurations arg3) throws RepositoryAlreadyExistsException {\n        // empty\n        return null;\n    }\n\n    @Override\n    public Repository createRepository(OrganizationalUnit arg0,\n                                       String arg1,\n                                       String arg2,\n                                       RepositoryEnvironmentConfigurations arg3,\n                                       Collection<Contributor> arg4) throws RepositoryAlreadyExistsException {\n        // empty\n        return null;\n    }\n\n    @Override\n    public Collection<Repository> getAllDeletedRepositories(Space arg0) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositories(Space arg0) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositories(Space arg0, boolean arg1) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositoriesFromAllUserSpaces() {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Repository> getRepositories(Space arg0) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Repository getRepository(Path arg0) {\n        return null;\n    }\n\n    @Override\n    public Repository getRepository(Space arg0, Path arg1) {\n        return null;\n    }\n\n    @Override\n    public Repository getRepositoryFromSpace(Space arg0, String arg1) {\n        return null;\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistory(Space arg0, String arg1, int arg2) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistory(Space arg0, String arg1, int arg2, int arg3) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistoryAll(Space arg0, String arg1) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public RepositoryInfo getRepositoryInfo(Space arg0, String arg1) {\n        return null;\n    }\n\n    @Override\n    public String normalizeRepositoryName(String arg0) {\n        return null;\n    }\n\n    @Override\n    public void removeGroup(Repository arg0, String arg1) {\n        // empty\n    }\n\n    @Override\n    public void removeRepositories(Space arg0, Set<String> arg1) {\n        // empty\n    }\n\n    @Override\n    public void removeRepository(Space arg0, String arg1) {\n        // empty\n    }\n\n    @Override\n    public void updateContributors(Repository arg0, List<Contributor> arg1) {\n        // empty\n    }\n\n    @Override\n    public boolean validateRepositoryName(String arg0) {\n        // empty\n        return false;\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/RuntimeJaxApp.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.backend;\n\nimport javax.ws.rs.ApplicationPath;\nimport javax.ws.rs.core.Application;\n\n@ApplicationPath(\"/rest\")\npublic class RuntimeJaxApp extends Application {\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/SalesDataSetGenerator.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend;\n\nimport java.util.Calendar;\nimport java.util.Date;\nimport java.util.Map;\nimport java.util.Random;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.dataset.DataSet;\nimport org.dashbuilder.dataset.DataSetBuilder;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.dataset.DataSetGenerator;\n\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\n\n/**\n * Generates a random data set containing sales opportunity records.\n */\n@ApplicationScoped\npublic class SalesDataSetGenerator implements DataSetGenerator {\n\n    private static String[] DIC_PIPELINE = {\"EARLY\", \"STANDBY\", \"ADVANCED\"};\n\n    private static String[] DIC_STATUS = {\"CONTACTED\", \"STANDBY\", \"DEMO\", \"SHORT LISTED\",\n                                            \"LOST\", \"WIN\", \"VERBAL COMMITMENT\", \"QUALIFIED\"};\n\n    private static String[] DIC_COUNTRIES = {\"United States\", \"China\", \"Japan\", \"Germany\", \"France\", \"United Kingdom\",\n                                            \"Brazil\", \"Italy\", \"India\", \"Canada\", \"Russia\", \"Spain\", \"Australia\",\n                                            \"Mexico\", \"South Korea\", \"Netherlands\", \"Turkey\", \"Indonesia\", \"Switzerland\",\n                                            \"Poland\", \"Belgium\", \"Sweden\", \"Saudi Arabia\", \"Norway\"};\n\n    private static String[] DIC_PRODUCT = {\"PRODUCT 1\", \"PRODUCT 2\", \"PRODUCT 3\", \"PRODUCT 4\", \"PRODUCT 5\", \"PRODUCT 6\",\n                                            \"PRODUCT 7\", \"PRODUCT 8\", \"PRODUCT 8\", \"PRODUCT 10\", \"PRODUCT 11\"};\n\n    private static String[] DIC_SALES_PERSON = {\"Roxie Foraker\", \"Jamie Gilbeau\", \"Nita Marling\", \"Darryl Innes\",\n                                                \"Julio Burdge\", \"Neva Hunger\", \"Kathrine Janas\", \"Jerri Preble\"};\n\n    private static String[] DIC_CUSTOMER = {\"Company 1\", \"Company 2\", \"Company 3\", \"Company 3\", \"Company 4\",\n                                            \"Company 5\", \"Company 6\", \"Company 7\", \"Company 8\", \"Company 9\"};\n\n    private static String[] DIC_SOURCE = {\"Customer\", \"Reference\", \"Personal contact\", \"Partner\",\n                                        \"Website\", \"Lead generation\", \"Event\"};\n\n    private static double MAX_AMOUNT = 15000;\n\n    private static double MIN_AMOUNT = 8000;\n\n    private static double AVG_CLOSING_DAYS = 90;\n\n    private Random random = new Random(System.currentTimeMillis());\n\n    public DataSet buildDataSet(Map<String,String> params) {\n        int currentYear =  Calendar.getInstance().get(Calendar.YEAR);\n        int startYear = currentYear + parseParam(params.get(\"startYear\"), -2);\n        int endYear = currentYear + parseParam(params.get(\"endYear\"), 2);\n        int opportunitiesPerMonth = parseParam(params.get(\"oppsPerMonth\"), 30);\n\n        DataSetBuilder builder = DataSetFactory.newDataSetBuilder()\n                .number(AMOUNT)\n                .date(CREATION_DATE)\n                .date(CLOSING_DATE)\n                .label(PIPELINE)\n                .label(STATUS)\n                .label(CUSTOMER)\n                .label(COUNTRY)\n                .label(PRODUCT)\n                .label(SALES_PERSON)\n                .number(PROBABILITY)\n                .label(SOURCE)\n                .number(EXPECTED_AMOUNT)\n                .label(COLOR);\n\n        for (int year = startYear; year <= endYear; year++) {\n            for (int month = 0; month < 12; month++) {\n                for (int i = 0; i < opportunitiesPerMonth; i++) {\n\n                    double amount = MIN_AMOUNT + random.nextDouble() * (MAX_AMOUNT - MIN_AMOUNT);\n                    double probability = random.nextDouble() * 100.0;\n                    Date creationDate = buildDate(month, year);\n                    String color = \"GREEN\";\n                    if (probability < 25) color = \"RED\";\n                    else if (probability < 50) color = \"GREY\";\n                    else if (probability < 75) color = \"YELLOW\";\n\n                    builder.row(amount,\n                            creationDate,\n                            addDates(creationDate, (int) (AVG_CLOSING_DAYS + random.nextDouble() * AVG_CLOSING_DAYS * 0.5)),\n                            randomValue(DIC_PIPELINE),\n                            randomValue(DIC_STATUS),\n                            randomValue(DIC_CUSTOMER),\n                            randomValue(DIC_COUNTRIES),\n                            randomValue(DIC_PRODUCT),\n                            randomValue(DIC_SALES_PERSON),\n                            probability,\n                            randomValue(DIC_SOURCE),\n                            amount * (1 + (random.nextDouble() * ((month*i)%10)/10)),\n                            color);\n                }\n            }\n        }\n        return builder.buildDataSet();\n    }\n\n    protected int parseParam(String param, int defaultValue) {\n        try {\n            return Integer.parseInt(param);\n        } catch (NumberFormatException e) {\n            return defaultValue;\n        }\n    }\n\n    private Date buildDate(int month, int year) {\n        Calendar c = Calendar.getInstance();\n        c.set(Calendar.DAY_OF_MONTH, random.nextInt(28)); // No sales on 29, 30 and 31 ;-)\n        c.set(Calendar.YEAR, year);\n        c.set(Calendar.MONTH, month - 1); // Some genius thought that the first month is 0\n        c.set(Calendar.HOUR_OF_DAY, random.nextInt(24));\n        c.set(Calendar.MINUTE, random.nextInt(60));\n        return c.getTime();\n    }\n\n    private Date addDates(Date d, int days) {\n        Calendar c = Calendar.getInstance();\n        c.setTime(d);\n        c.add(Calendar.DAY_OF_MONTH, days);\n        return c.getTime();\n    }\n\n    private String randomValue(String[] dic) {\n        return dic[random.nextInt(dic.length)];\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/command/CommandEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.command;\n\npublic class CommandEvent {\n\n    protected String command;\n\n    public CommandEvent() {\n    }\n\n    public CommandEvent(String command) {\n        this.command = command;\n    }\n\n    public String getCommand() {\n        return command;\n    }\n\n    public void setCommand(String command) {\n        this.command = command;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/backend/command/CommandServer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.backend.command;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.PrintWriter;\nimport java.net.ServerSocket;\nimport java.net.Socket;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.config.Config;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\n\n/**\n * This class receives string commands from a TCP socket and transform such commend into CDI event instances\n * to be consumed by server side components/services.\n */\n@ApplicationScoped\n@Startup\npublic class CommandServer implements Runnable {\n\n    private static Logger log = LoggerFactory.getLogger(CommandServer.class);\n\n    @Inject @Config(\"10000\")\n    private int portNumber;\n\n    @Inject\n    private Event<CommandEvent> commandEvent;\n\n    private Thread serverSocketThread = new Thread(this);\n\n    @PostConstruct\n    private void init() {\n        serverSocketThread.start();\n    }\n\n    public void run() {\n        try {\n            ServerSocket serverSocket = new ServerSocket(portNumber);\n            Socket clientSocket = serverSocket.accept();\n            PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);\n            BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));\n            String commandStr;\n            while ((commandStr = in.readLine()) != null) {\n                commandEvent.fire(new CommandEvent(commandStr));\n                out.println(\">>> \" + commandStr + \" [OK]\");\n            }\n        } catch (Exception e) {\n            log.error(\"Command server error\", e);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/ShowcaseEntryPoint.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.dashbuilder.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.animation.client.Animation;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport elemental2.dom.DomGlobal;\nimport org.dashbuilder.client.cms.screen.explorer.NavigationExplorerScreen;\nimport org.dashbuilder.client.dashboard.DashboardManager;\nimport org.dashbuilder.client.navbar.AppHeader;\nimport org.dashbuilder.client.navigation.NavTreeDefinitions;\nimport org.dashbuilder.client.navigation.NavigationManager;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.security.PermissionTreeSetup;\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeImpl;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.mvp.Command;\n\n/**\n * Entry-point for the Dashbuilder showcase\n */\n@EntryPoint\npublic class ShowcaseEntryPoint {\n\n    private AppConstants constants = AppConstants.INSTANCE;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private ClientUserSystemManager userSystemManager;\n\n    @Inject\n    private DashboardManager dashboardManager;\n\n    @Inject\n    private Caller<AuthenticationService> authService;\n\n    @Inject\n    private NavigationManager navigationManager;\n    \n    @Inject\n    NavigationExplorerScreen navigationExplorerScreen;\n\n    @Inject\n    private PermissionTreeSetup permissionTreeSetup;\n\n    @Inject\n    private AppHeader appHeader;\n\n    @PostConstruct\n    public void startApp() {\n        // OPTIONAL: Rename perspectives to dashboards in CMS\n        \n        userSystemManager.waitForInitialization(() -> dashboardManager.loadDashboards(t -> navigationManager.init(() -> {\n            permissionTreeSetup.configureTree();\n            initNavBar();\n            initNavigation();\n            hideLoadingPopup();\n        })));\n    }\n\n    private void initNavBar() {\n        // Show the top menu bar\n        appHeader.setOnLogoutCommand(onLogoutCommand);\n        appHeader.setupMenu(NavTreeDefinitions.NAV_TREE_DEFAULT);\n    }\n\n    private void initNavigation() {\n        // Set the dashbuilder's default nav tree\n        navigationManager.setDefaultNavTree(NavTreeDefinitions.INITIAL_EMPTY);\n\n        // Allow links to core perspectives only under the top menu's nav group\n        navigationExplorerScreen.getNavTreeEditor()\n                                .setOnlyRuntimePerspectives(NavTreeDefinitions.DASHBOARDS_GROUP, true)\n                                .applyToAllChildren();\n\n        // Disable perspective context setup under the top menu nav's group\n        navigationExplorerScreen.getNavTreeEditor()\n                                .setPerspectiveContextEnabled(NavTreeDefinitions.DASHBOARDS_GROUP, false)\n                                .applyToAllChildren();\n    }\n\n    // Fade out the \"Loading application\" pop-up\n    private void hideLoadingPopup() {\n        final Element e = RootPanel.get(\"loading\").getElement();\n\n        new Animation() {\n\n            @Override\n            protected void onUpdate(double progress) {\n                e.getStyle().setOpacity(1.0 - progress);\n            }\n\n            @Override\n            protected void onComplete() {\n                e.getStyle().setVisibility(Style.Visibility.HIDDEN);\n            }\n        }.run(500);\n    }\n\n    private Command onLogoutCommand = () -> {\n        authService.call(r -> {\n            final String location = GWT.getModuleBaseURL().replaceFirst(\"/\" + GWT.getModuleName() + \"/\", \"/logout.jsp\");\n            DomGlobal.window.location.assign(location);\n        }).logout();\n    };\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/dashboard/DashboardManager.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.dashbuilder.client.dashboard;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.shared.dashboard.events.DashboardDeletedEvent;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n/**\n * @deprecated Since version 0.7, dashboards are created from the Content Manager perspective. This class is\n * still needed in order to deal with old dashboards created from existing installations.\n */\n@ApplicationScoped\npublic class DashboardManager {\n\n    private SyncBeanManager beanManager;\n    private PlaceManager placeManager;\n    private PerspectiveManager perspectiveManager;\n    private PerspectiveCoordinator perspectiveCoordinator;\n    private ActivityBeansCache activityBeansCache;\n    private Event<DashboardDeletedEvent> dashboardDeletedEvent;\n\n    @Inject\n    public DashboardManager(SyncBeanManager beanManager,\n                            PlaceManager placeManager,\n                            PerspectiveManager perspectiveManager,\n                            PerspectiveCoordinator perspectiveCoordinator,\n                            ActivityBeansCache activityBeansCache,\n                            Event<DashboardDeletedEvent> dashboardDeletedEvent) {\n\n        this.beanManager = beanManager;\n        this.placeManager = placeManager;\n        this.perspectiveManager = perspectiveManager;\n        this.perspectiveCoordinator = perspectiveCoordinator;\n        this.activityBeansCache = activityBeansCache;\n        this.dashboardDeletedEvent = dashboardDeletedEvent;\n    }\n\n    public void loadDashboards(ParameterizedCommand<Set<DashboardPerspectiveActivity>> callback) {\n        perspectiveManager.loadPerspectiveStates(new ParameterizedCommand<Set<PerspectiveDefinition>>() {\n            public void execute(Set<PerspectiveDefinition> list) {\n                HashSet<DashboardPerspectiveActivity> dashboards = new HashSet<>();\n                for (PerspectiveDefinition p : list) {\n                    String id = p.getName();\n                    if (id.startsWith(\"dashboard-\")) {\n                        dashboards.add(registerPerspective(id));\n                    }\n                }\n                callback.execute(dashboards);\n            }\n        });\n    }\n\n    @SuppressWarnings( \"unchecked\" )\n    protected DashboardPerspectiveActivity registerPerspective(String id) {\n        DashboardPerspectiveActivity activity = new DashboardPerspectiveActivity(id, this,\n                beanManager,\n                perspectiveManager,\n                placeManager,\n                perspectiveCoordinator);\n\n        SyncBeanManagerImpl beanManager = (SyncBeanManagerImpl) IOC.getBeanManager();\n        final SyncBeanDef<PerspectiveActivity> beanDef =\n                new SingletonBeanDefinition<>(activity,\n                                            PerspectiveActivity.class,\n                                            new HashSet<Annotation>( Arrays.asList( DEFAULT_QUALIFIERS ) ),\n                                            id,\n                                            true );\n        beanManager.registerBean( beanDef );\n        activityBeansCache.addNewPerspectiveActivity(beanManager.lookupBeans(id).iterator().next());\n        return activity;\n    }\n\n    public DashboardPerspectiveActivity getDashboardById(String id) {\n        for (DashboardPerspectiveActivity d : getDashboards()) {\n            if (d.getIdentifier().equals(id)) return d;\n        }\n        return null;\n    }\n\n    public DashboardPerspectiveActivity getDashboardByName(String name) {\n        for (DashboardPerspectiveActivity d : getDashboards()) {\n            if (d.getDisplayName().equals(name)) return d;\n        }\n        return null;\n    }\n\n    public void removeDashboard(String id) {\n        DashboardPerspectiveActivity activity = getDashboardById(id);\n        if (activity != null) {\n            activity.setPersistent(false);\n            activityBeansCache.removeActivity(id);\n            dashboardDeletedEvent.fire(new DashboardDeletedEvent(activity.getIdentifier(), activity.getDisplayName()));\n        }\n    }\n\n    public Set<DashboardPerspectiveActivity> getDashboards() {\n        Set<DashboardPerspectiveActivity> activities = new HashSet<>();\n        for (String activityId : activityBeansCache.getActivitiesById()) {\n\n            SyncBeanDef<Activity> activityDef = activityBeansCache.getActivity(activityId);\n            if (activityDef != null && activityDef.getBeanClass().equals(DashboardPerspectiveActivity.class)) {\n                activities.add((DashboardPerspectiveActivity) activityDef.getInstance());\n            }\n        }\n        return activities;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/dashboard/DashboardPerspectiveActivity.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.dashboard;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.PerspectiveCoordinator;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.displayer.client.widgets.DisplayerEditorPopup;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n/**\n * @deprecated Since version 0.7, dashboards are created from the Content Manager perspective. This class is\n * still needed in order to deal with old dashboards created from existing installations.\n */\npublic class DashboardPerspectiveActivity implements PerspectiveActivity {\n\n    private SyncBeanManager beanManager;\n    private DashboardManager dashboardManager;\n    private PerspectiveManager perspectiveManager;\n    private PlaceManager placeManager;\n    private DisplayerSettingsJSONMarshaller jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n    private PerspectiveCoordinator perspectiveCoordinator;\n\n    private PlaceRequest place;\n    private String id;\n    private boolean persistent;\n\n    public DashboardPerspectiveActivity() {\n    }\n\n    public DashboardPerspectiveActivity(String id,\n                                        DashboardManager dashboardManager,\n                                        SyncBeanManager beanManager,\n                                        PerspectiveManager perspectiveManager,\n                                        PlaceManager placeManager,\n                                        PerspectiveCoordinator perspectiveCoordinator) {\n\n        this.id = id;\n        this.beanManager = beanManager;\n        this.persistent = true;\n        this.dashboardManager = dashboardManager;\n        this.perspectiveManager = perspectiveManager;\n        this.placeManager = placeManager;\n        this.perspectiveCoordinator = perspectiveCoordinator;\n    }\n\n    public String getDisplayName() {\n        return id.substring(10);\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    @Override\n    public void onOpen() {\n    }\n\n    @Override\n    public void onClose() {\n    }\n\n    @Override\n    public void onShutdown() {\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(id);\n        return perspective;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return id;\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return false;\n    }\n\n    @Override\n    public boolean isTransient() {\n        return !persistent;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(AppConstants.INSTANCE.dashboard_new_displayer())\n                                     .respondsWith(getNewDisplayerCommand())\n                                     .endMenu()\n                                     .newTopLevelMenu(AppConstants.INSTANCE.dashboard_delete_dashboard())\n                                     .respondsWith(getShowDeletePopupCommand())\n                                     .endMenu().build());\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    // Internal stuff\n\n    public boolean isPersistent() {\n        return persistent;\n    }\n\n    public void setPersistent(boolean persistent) {\n        this.persistent = persistent;\n    }\n\n    protected YesNoCancelPopup deleteDashboardPopup;\n\n    private Command getShowDeletePopupCommand() {\n        return new Command() {\n            public void execute() {\n                deleteDashboardPopup = YesNoCancelPopup.newYesNoCancelPopup(\n                        AppConstants.INSTANCE.dashboard_delete_popup_title(),\n                        AppConstants.INSTANCE.dashboard_delete_popup_content(),\n                        getDoDeleteCommand(),\n                        getCancelDeleteCommand(),\n                        null);\n                deleteDashboardPopup.show();\n            }\n        };\n    }\n\n    private Command getCancelDeleteCommand() {\n        return new Command() {\n            public void execute() {\n                deleteDashboardPopup.hide();\n            }\n        };\n    }\n\n    private Command getDoDeleteCommand() {\n        return new Command() {\n            public void execute() {\n                perspectiveManager.removePerspectiveState(id, new Command() {\n                    public void execute() {\n                        dashboardManager.removeDashboard(id);\n                        placeManager.goTo(getDefaultPerspectiveActivity().getIdentifier());\n                    }\n                });\n            }\n        };\n    }\n\n    private Command getNewDisplayerCommand() {\n        return new Command() {\n            public void execute() {\n                /* Displayer settings == null => Create a brand new displayer */\n                perspectiveCoordinator.editOn();\n                DisplayerEditorPopup displayerEditor = beanManager.lookupBean(DisplayerEditorPopup.class).newInstance();\n                displayerEditor.init(null);\n                displayerEditor.setOnSaveCommand(getSaveDisplayerCommand(displayerEditor));\n                displayerEditor.setOnCloseCommand(getCloseDisplayerCommand(displayerEditor));\n            }\n        };\n    }\n\n    protected Command getSaveDisplayerCommand(final DisplayerEditorPopup editor) {\n        return new Command() {\n            public void execute() {\n                perspectiveCoordinator.editOff();\n                beanManager.destroyBean(editor);\n\n                placeManager.goTo(createPlaceRequest(editor.getDisplayerSettings()));\n                perspectiveManager.savePerspectiveState(new Command() {\n                    public void execute() {\n                    }\n                });\n            }\n        };\n    }\n\n    protected Command getCloseDisplayerCommand(final DisplayerEditorPopup editor) {\n        return new Command() {\n            public void execute() {\n                perspectiveCoordinator.editOff();\n                beanManager.destroyBean(editor);\n            }\n        };\n    }\n\n    private PlaceRequest createPlaceRequest(DisplayerSettings displayerSettings) {\n        String json = jsonMarshaller.toJsonString(displayerSettings);\n        Map<String,String> params = new HashMap<>();\n        params.put(\"json\", json);\n        params.put(\"edit\", \"true\");\n        params.put(\"clone\", \"true\");\n        return new DefaultPlaceRequest(\"DisplayerScreen\", params);\n    }\n\n    private PerspectiveActivity getDefaultPerspectiveActivity() {\n        PerspectiveActivity first = null;\n        SyncBeanManagerImpl beanManager = (SyncBeanManagerImpl) IOC.getBeanManager();\n        Collection<SyncBeanDef<PerspectiveActivity>> perspectives = beanManager.lookupBeans(PerspectiveActivity.class);\n        Iterator<SyncBeanDef<PerspectiveActivity>> perspectivesIterator = perspectives.iterator();\n        while (perspectivesIterator.hasNext() ) {\n\n            SyncBeanDef<PerspectiveActivity> perspective = perspectivesIterator.next();\n            PerspectiveActivity instance = perspective.getInstance();\n\n            if (instance.isDefault()) {\n                return instance;\n            }\n            if (first == null) {\n                first = instance;\n            }\n        }\n        return first;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/expenses/ExpenseConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.expenses;\n\npublic interface ExpenseConstants {\n\n    String EXPENSES = \"expenseReports\";\n    String OFFICE = \"office\";\n    String DEPARTMENT = \"department\";\n    String EMPLOYEE = \"employee\";\n    String AMOUNT = \"amount\";\n    String DATE = \"date\";\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/expenses/ExpensesDashboard.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.expenses;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\n\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.client.expenses.ExpenseConstants.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A composite widget that represents an entire dashboard sample based on a UI binder template.\n * The dashboard itself is composed by a set of Displayer instances.</p>\n * <p>The data set that feeds this dashboard is a CSV file stored into an specific server folder so\n * that is auto-deployed during server start up: <code>dashbuilder-webapp/src/main/webapp/datasets/expenseReports.csv</code></p>\n */\n@Dependent\npublic class ExpensesDashboard extends Composite implements GalleryWidget {\n\n    interface ExpensesDashboardBinder extends UiBinder<Widget, ExpensesDashboard>{}\n    private static final ExpensesDashboardBinder uiBinder = GWT.create(ExpensesDashboardBinder.class);\n\n    @UiField(provided = true)\n    Displayer pieByOffice;\n\n    @UiField(provided = true)\n    Displayer barByDepartment;\n\n    @UiField(provided = true)\n    Displayer lineByDate;\n\n    @UiField(provided = true)\n    Displayer bubbleByEmployee;\n\n    @UiField(provided = true)\n    Displayer tableAll;\n\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n\n    @Inject\n    public ExpensesDashboard(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.expensesdb_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return EXPENSES.equals(dataSetId);\n    }\n\n    @PostConstruct\n    public void init() {\n\n        // Create the chart definitions\n\n        pieByOffice = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(EXPENSES)\n                        .group(OFFICE)\n                        .column(OFFICE)\n                        .column(AMOUNT, SUM, \"sum1\")\n                        .format(AppConstants.INSTANCE.expensesdb_pie_column1(), \"$ #,##0.00\")\n                        .group(DEPARTMENT)\n                        .column(DEPARTMENT)\n                        .column(AMOUNT, SUM, \"sum2\")\n                        .format(AppConstants.INSTANCE.expensesdb_pie_column2(), \"$ #,##0.00\")\n                        .group(EMPLOYEE)\n                        .column(EMPLOYEE)\n                        .column(AMOUNT, SUM, \"sum3\")\n                        .format(AppConstants.INSTANCE.expensesdb_pie_column3(), \"$ #,##0.00\")\n                        .title(AppConstants.INSTANCE.expensesdb_pie_title())\n                        .width(250).height(250)\n                        .margins(10, 10, 10, 0)\n                        .filterOn(true, true, true)\n                        .buildSettings());\n\n        barByDepartment = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .dataset(EXPENSES)\n                        .group(DEPARTMENT)\n                        .column(DEPARTMENT)\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.expensesdb_bar_column1(), \"$ #,##0.00\")\n                        .title(AppConstants.INSTANCE.expensesdb_bar_title())\n                        .width(350).height(250)\n                        .margins(10, 50, 100, 20)\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        bubbleByEmployee = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBubbleChartSettings()\n                        .dataset(EXPENSES)\n                        .group(EMPLOYEE)\n                        .column(EMPLOYEE)\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.expensesdb_bubble_column1(), \"$ #,##0.00\")\n                        .column(AMOUNT, AVERAGE).format(AppConstants.INSTANCE.expensesdb_bubble_column2(), \"$ #,##0.00\")\n                        .column(EMPLOYEE, AppConstants.INSTANCE.expensesdb_bubble_column3())\n                        .column(COUNT, AppConstants.INSTANCE.expensesdb_bubble_column4())\n                        .title(AppConstants.INSTANCE.expensesdb_bubble_title())\n                        .titleVisible(false)\n                        .width(600).height(280)\n                        .margins(10, 50, 80, 0)\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        lineByDate = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newAreaChartSettings()\n                        .dataset(EXPENSES)\n                        .group(DATE).dynamic(8, DAY_OF_WEEK, true)\n                        .column(DATE)\n                        .column(AMOUNT, SUM)\n                        .format(AppConstants.INSTANCE.expensesdb_line_column1(), \"$ #,##0.00\")\n                        .title(AppConstants.INSTANCE.expensesdb_line_title())\n                        .titleVisible(false)\n                        .width(500).height(250)\n                        .margins(10, 50, 50, 50)\n                        .filterOn(true, true, true)\n                        .buildSettings());\n\n        tableAll = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(EXPENSES)\n                        .title(AppConstants.INSTANCE.expensesdb_table_title())\n                        .titleVisible(false)\n                        .tablePageSize(10)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(AMOUNT, DESCENDING)\n                        .tableColumnPickerEnabled(false)\n                        .column(OFFICE).format(AppConstants.INSTANCE.expensesdb_table_column1())\n                        .column(DEPARTMENT).format(AppConstants.INSTANCE.expensesdb_table_column2())\n                        .column(EMPLOYEE).format(AppConstants.INSTANCE.expensesdb_table_column3())\n                        .column(AMOUNT).format(AppConstants.INSTANCE.expensesdb_table_column4(), \"$ #,##0.00\")\n                        .column(DATE).format(AppConstants.INSTANCE.expensesdb_table_column5(), \"MMM E dd, yyyy\")\n                        .filterOn(true, true, true)\n                        .tableWidth(600)\n                        .buildSettings());\n\n        // Make that charts interact among them\n        displayerCoordinator.addDisplayer(pieByOffice);\n        displayerCoordinator.addDisplayer(barByDepartment);\n        displayerCoordinator.addDisplayer(bubbleByEmployee);\n        displayerCoordinator.addDisplayer(lineByDate);\n        displayerCoordinator.addDisplayer(tableAll);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n    }\n\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/expenses/ExpensesDashboard.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:my=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.resources.i18n.AppConstants\"/>\n\n  <g:VerticalPanel spacing=\"10\">\n    <g:HorizontalPanel spacing=\"10\">\n      <my:Displayer ui:field=\"pieByOffice\"/>\n      <my:Displayer ui:field=\"barByDepartment\"/>\n    </g:HorizontalPanel>\n    <b:TabPanel>\n      <b:NavTabs>\n        <b:TabListItem dataTarget=\"#edtab1\" text=\"{i18n.expensesdb_tab_exp_evolution}\"/>\n        <b:TabListItem dataTarget=\"#edtab2\" text=\"{i18n.expensesdb_tab_by_employee}\"/>\n        <b:TabListItem active=\"true\" dataTarget=\"#edtab3\" text=\"{i18n.expensesdb_tab_all_exp}\"/>\n      </b:NavTabs>\n      <b:TabContent>\n        <b:TabPane b:id=\"edtab1\">\n          <g:FlowPanel width=\"550px\" height=\"300px\">\n            <my:Displayer ui:field=\"lineByDate\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n        <b:TabPane b:id=\"edtab2\">\n          <g:FlowPanel width=\"650px\" height=\"300px\">\n            <my:Displayer ui:field=\"bubbleByEmployee\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n        <b:TabPane b:id=\"edtab3\" active=\"true\">\n          <g:FlowPanel>\n            <my:Displayer ui:field=\"tableAll\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n      </b:TabContent>\n    </b:TabPanel>\n\n  </g:VerticalPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryPlaceRequest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * A gallery node holding a PlaceRequest.\n */\npublic class GalleryPlaceRequest extends GalleryTreeNode {\n\n    protected PlaceRequest placeRequest = null;\n\n    public GalleryPlaceRequest(String name, PlaceRequest placeRequest) {\n        super(name);\n        this.placeRequest = placeRequest;\n    }\n\n    public PlaceRequest getPlaceRequest() {\n        return placeRequest;\n    }\n\n    public void setPlaceRequest(PlaceRequest placeRequest) {\n        this.placeRequest = placeRequest;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTree.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.filter.FilterFactory.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.date.Month.*;\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * The Gallery tree.\n */\n@Dependent\npublic class GalleryTree {\n\n    private List<GalleryTreeNode> mainNodes = new ArrayList<>();\n    private DisplayerSettingsJSONMarshaller jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n\n    public List<GalleryTreeNode> getMainNodes() {\n        return mainNodes;\n    }\n\n    @PostConstruct\n    private void init() {\n        initBarChartCategory();\n        initPieChartCategory();\n        initLineChartCategory();\n        initAreaChartCategory();\n        initBubbleChartCategory();\n        initTableReportCategory();\n        initMeterChartCategory();\n        initMetricCategory();\n        initMapChartCategory();\n        initSelectorCategory();\n        initDashboardCategory();\n    }\n\n    private PlaceRequest createPlaceRequest(DisplayerSettings displayerSettings) {\n        String json = jsonMarshaller.toJsonString(displayerSettings);\n        Map<String,String> params = new HashMap<>();\n        params.put(\"json\", json);\n        params.put(\"edit\", \"false\");\n        params.put(\"showRendererSelector\", \"true\");\n        return new DefaultPlaceRequest(\"DisplayerScreen\", params);\n    }\n\n    private PlaceRequest createPlaceRequest(String widgetId) {\n        Map<String,String> params = new HashMap<>();\n        params.put(\"widgetId\", widgetId);\n        return new DefaultPlaceRequest(\"GalleryWidgetScreen\", params);\n    }\n\n    private void initBarChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_bar());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bar_horiz(), createPlaceRequest(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .subType_Bar()\n                        .dataset(SALES_OPPS)\n                        .group(PRODUCT)\n                        .column(PRODUCT, \"Product\")\n                        .column(AMOUNT, SUM)\n                        .expression(\"value/1000\")\n                        .format(AppConstants.INSTANCE.gallerytree_bar_horiz_column1(), \"$ #,### K\")\n                        .title(AppConstants.INSTANCE.gallerytree_bar_horiz_title())\n                        .width(600).height(400)\n                        .resizableOn(1200, 800)\n                        .margins(50, 80, 120, 120)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bar_vert(), createPlaceRequest(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .subType_Column()\n                        .dataset(SALES_OPPS)\n                        .group(PRODUCT)\n                        .column(PRODUCT, \"Product\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_bar_vert_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_bar_vert_title())\n                        .set3d(true)\n                        .width(600).height(400)\n                        .resizableOn(1200, 800)\n                        .margins(50, 80, 120, 120)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bar_multi(), createPlaceRequest(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .subType_Bar()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(AMOUNT, MIN).format(AppConstants.INSTANCE.gallerytree_bar_multi_column1(), \"$ #,###\")\n                        .column(AMOUNT, MAX).format(AppConstants.INSTANCE.gallerytree_bar_multi_column2(), \"$ #,###\")\n                        .column(AMOUNT, AVERAGE).format(AppConstants.INSTANCE.gallerytree_bar_multi_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_bar_multi_title())\n                        .width(700).height(600)\n                        .resizableOn(1200, 800)\n                        .margins(50, 80, 120, 120)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bar_stacked(), createPlaceRequest(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .subType_StackedColumn()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(AMOUNT, MIN).format(AppConstants.INSTANCE.gallerytree_bar_multi_column1(), \"$ #,###\")\n                        .column(AMOUNT, MAX).format(AppConstants.INSTANCE.gallerytree_bar_multi_column2(), \"$ #,###\")\n                        .column(AMOUNT, AVERAGE).format(AppConstants.INSTANCE.gallerytree_bar_multi_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_bar_multi_title())\n                        .width(800).height(400)\n                        .margins(50, 80, 120, 120)\n                        .legendOn(\"top\")\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bar_vert_dd(), createPlaceRequest(\n                DisplayerSettingsFactory.newBarChartSettings()\n                        .subType_Column()\n                        .dataset(SALES_OPPS)\n                        .group(PIPELINE)\n                        .column(PIPELINE, \"Pipeline\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_bar_vert_dd_column1(), \"$ #,###\")\n                        .group(STATUS)\n                        .column(STATUS, \"Status\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_bar_vert_dd_column2(), \"$ #,###\")\n                        .group(SALES_PERSON)\n                        .column(SALES_PERSON, \"Sales person\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_bar_vert_dd_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_bar_vert_dd_title())\n                        .width(600).height(400)\n                        .resizableOn(1200, 800)\n                        .margins(50, 80, 120, 120)\n                        .filterOn(true, false, false)\n                        .buildSettings()\n        )));\n    }\n\n    private void initPieChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_pie());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_pie_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(STATUS)\n                        .column(STATUS)\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_basic_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_pie_basic_title())\n                        .width(500)\n                        .margins(10, 10, 10, 150)\n                        .subType_Pie()\n                        .legendOn(\"right\")\n                        .resizableOn(1200, 800)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_pie_3d(), createPlaceRequest(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(STATUS)\n                        .column(STATUS)\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_3d_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_pie_3d_title())\n                        .width(500)\n                        .margins(10, 10, 10, 150)\n                        .subType_Pie_3d()\n                        .legendOn(\"right\")\n                        .resizableOn(1200, 800)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_pie_donut(), createPlaceRequest(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(STATUS)\n                        .column(STATUS)\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_donut_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_pie_donut_title())\n                        .width(500)\n                        .margins(10, 10, 10, 150)\n                        .subType_Donut()\n                        .legendOn(\"right\")\n                        .margins(10, 10, 10, 10)\n                        .resizableOn(1200, 800)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_pie_dd(), createPlaceRequest(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(PIPELINE)\n                        .column(PIPELINE, \"Pipeline\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_dd_column1(), \"$ #,###\")\n                        .group(STATUS)\n                        .column(STATUS, \"Status\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_dd_column2(), \"$ #,###\")\n                        .group(SALES_PERSON)\n                        .column(SALES_PERSON, \"Sales person\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_pie_dd_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_pie_dd_title())\n                        .margins(10, 10, 10, 10)\n                        .resizableOn(1200, 800)\n                        .filterOn(true, false, false)\n                        .buildSettings()\n        )));\n    }\n\n    private void initLineChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_line());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_line_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newLineChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(CLOSING_DATE).dynamic(12, MONTH, true)\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_line_basic_column1(), \"MMM dd, yyyy\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_line_basic_column2(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_line_basic_title())\n                        .margins(20, 50, 100, 120)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_line_multi(), createPlaceRequest(\n                DisplayerSettingsFactory.newLineChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(AMOUNT, MIN).format(AppConstants.INSTANCE.gallerytree_line_multi_column1(), \"$ #,###\")\n                        .column(AMOUNT, MAX).format(AppConstants.INSTANCE.gallerytree_line_multi_column2(), \"$ #,###\")\n                        .column(AMOUNT, AVERAGE).format(AppConstants.INSTANCE.gallerytree_line_multi_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_line_multi_title())\n                        .margins(30, 100, 80, 80)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_line_multi_static(), createPlaceRequest(\n                DisplayerSettingsFactory.newLineChartSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_line_multi_static_title())\n                        .margins(20, 80, 50, 120)\n                        .column(\"month\", \"Month\")\n                        .column(\"2014\").format(AppConstants.INSTANCE.gallerytree_line_multi_static_column1(), \"$ #,###\")\n                        .column(\"2015\").format(AppConstants.INSTANCE.gallerytree_line_multi_static_column2(), \"$ #,###\")\n                        .column(\"2016\").format(AppConstants.INSTANCE.gallerytree_line_multi_static_column3(), \"$ #,###\")\n                        .dataset(DataSetFactory.newDataSetBuilder()\n                                .label(\"month\")\n                                .number(\"2014\")\n                                .number(\"2015\")\n                                .number(\"2016\")\n                                .row(JANUARY, 1000d, 2000d, 3000d)\n                                .row(FEBRUARY, 1400d, 2300d, 2000d)\n                                .row(MARCH, 1300d, 2000d, 1400d)\n                                .row(APRIL, 900d, 2100d, 1500d)\n                                .row(MAY, 1300d, 2300d, 1600d)\n                                .row(JUNE, 1010d, 2000d, 1500d)\n                                .row(JULY, 1050d, 2400d, 3000d)\n                                .row(AUGUST, 2300d, 2000d, 3200d)\n                                .row(SEPTEMBER, 1900d, 2700d, 3000d)\n                                .row(OCTOBER, 1200d, 2200d, 3100d)\n                                .row(NOVEMBER, 1400d, 2100d, 3100d)\n                                .row(DECEMBER, 1100d, 2100d, 4200d)\n                                .buildDataSet())\n                        .buildSettings()\n        )));\n    }\n\n    private void initAreaChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_area());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_area_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newAreaChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(CLOSING_DATE).dynamic(24, MONTH, true)\n                        .column(CLOSING_DATE, \"Closing date\")\n                        .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_area_basic_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_area_basic_title())\n                        .width(700).height(300)\n                        .margins(20, 50, 100, 120)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_area_fixed(), createPlaceRequest(\n                DisplayerSettingsFactory.newAreaChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(CLOSING_DATE).fixed(MONTH, true).firstMonth(JANUARY).asc()\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_area_fixed_column1())\n                        .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_area_fixed_column2(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_area_fixed_title())\n                        .margins(20, 80, 100, 100)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_area_dd(), createPlaceRequest(\n                DisplayerSettingsFactory.newAreaChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(CLOSING_DATE).dynamic(12, true)\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_area_dd_column1())\n                        .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_area_dd_column2(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_area_dd_title())\n                        .margins(20, 70, 100, 120)\n                        .filterOn(true, true, true)\n                        .buildSettings()\n        )));\n    }\n\n    private void initBubbleChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_bubble());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_bubble_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newBubbleChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(COUNT, \"#opps\").format(AppConstants.INSTANCE.gallerytree_bubble_basic_column1(), \"#,###\")\n                        .column(PROBABILITY, AVERAGE).format(AppConstants.INSTANCE.gallerytree_bubble_basic_column2(), \"#,###\")\n                        .column(COUNTRY, AppConstants.INSTANCE.gallerytree_bubble_basic_column4())\n                        .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_bubble_basic_column3(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_bubble_basic_title())\n                        .width(700).height(400)\n                        .margins(20, 50, 50, 0)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n    }\n\n    private void initMeterChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_meter());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_meter_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newMeterChartSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_meter_basic_title())\n                        .dataset(SALES_OPPS)\n                        .column(AMOUNT, SUM, AppConstants.INSTANCE.gallerytree_meter_basic_column1())\n                        .expression(\"value/1000\")\n                        .format(AppConstants.INSTANCE.gallerytree_meter_basic_column1(), \"$ #,### K\")\n                        .width(400).height(200)\n                        .meter(0, 15000, 25000, 35000)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_meter_multi(), createPlaceRequest(\n                DisplayerSettingsFactory.newMeterChartSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_meter_multi_title())\n                        .dataset(SALES_OPPS)\n                        .group(CREATION_DATE).dynamic(12, YEAR, true)\n                        .column(CREATION_DATE, \"Year\")\n                        .column(AMOUNT, SUM)\n                        .expression(\"value/1000\")\n                        .format(AppConstants.INSTANCE.gallerytree_meter_multi_column1(), \"$ #,###\")\n                        .width(600).height(200)\n                        .meter(0, 1000, 3000, 5000)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_meter_multi_static(), createPlaceRequest(\n                DisplayerSettingsFactory.newMeterChartSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_meter_multi_static_title())\n                        .width(500).height(200)\n                        .meter(30, 160, 190, 220)\n                        .column(\"person\").format(AppConstants.INSTANCE.gallerytree_meter_multi_static_column1())\n                        .column(\"heartRate\").format(AppConstants.INSTANCE.gallerytree_meter_multi_static_column2(), \"#,### bpm\")\n                        .dataset(DataSetFactory.newDataSetBuilder()\n                                .label(\"person\")\n                                .number(\"heartRate\")\n                                .row(\"David\", 52)\n                                .row(\"Roger\", 120)\n                                .row(\"Mark\", 74)\n                                .row(\"Michael\", 78)\n                                .row(\"Kris\", 74)\n                                .buildDataSet())\n                        .buildSettings()\n        )));\n    }\n\n    private void initMetricCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_metrics());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_metrics_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newMetricSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_metrics_basic_title())\n                        .titleVisible(true)\n                        .dataset(SALES_OPPS)\n                        .filter(CLOSING_DATE, timeFrame(\"begin[quarter February] till now\"))\n                        .column(AMOUNT, SUM).expression(\"value/1000\").format(AppConstants.INSTANCE.gallerytree_metrics_basic_column1(), \"$ #,### K\")\n                        .width(300).height(150)\n                        .margins(50, 50, 50, 50)\n                        .backgroundColor(\"FDE8D4\")\n                        .filterOn(false, false, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_metrics_basic_static(), createPlaceRequest(\n                DisplayerSettingsFactory.newMetricSettings()\n                        .title(AppConstants.INSTANCE.gallerytree_metrics_basic_static_title())\n                        .titleVisible(true)\n                        .column(\"tweets\").format(AppConstants.INSTANCE.gallerytree_metrics_basic_static_column1(), \"#,###\")\n                        .width(300).height(150)\n                        .margins(50, 50, 50, 50)\n                        .backgroundColor(\"ADE8D4\")\n                        .filterOff(true)\n                        .dataset(DataSetFactory.newDataSetBuilder()\n                        .number(\"tweets\")\n                        .row(54213d)\n                        .buildDataSet())\n                        .buildSettings()\n        )));\n    }\n\n    private void initMapChartCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_map());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_map_region(), createPlaceRequest(\n                DisplayerSettingsFactory.newMapChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_map_region_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_map_region_title())\n                        .subType_Region_Map()\n                        .width(700).height(500)\n                        .margins(10, 10, 10, 10)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_map_marker(), createPlaceRequest(\n                DisplayerSettingsFactory.newMapChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_map_marker_column1(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_map_marker_title())\n                        .subType_Marker_Map()\n                        .width(700).height(500)\n                        .margins(10, 10, 10, 10)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n    }\n\n    private void initTableReportCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_table());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_table_basic(), createPlaceRequest(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(SALES_OPPS)\n                        .column(COUNTRY, AppConstants.INSTANCE.gallerytree_table_basic_column1())\n                        .column(CUSTOMER, AppConstants.INSTANCE.gallerytree_table_basic_column2())\n                        .column(PRODUCT, AppConstants.INSTANCE.gallerytree_table_basic_column3())\n                        .column(SALES_PERSON, AppConstants.INSTANCE.gallerytree_table_basic_column4())\n                        .column(STATUS, AppConstants.INSTANCE.gallerytree_table_basic_column5())\n                        .column(SOURCE, AppConstants.INSTANCE.gallerytree_table_basic_column6())\n                        .column(CREATION_DATE, AppConstants.INSTANCE.gallerytree_table_basic_column7())\n                        .column(EXPECTED_AMOUNT, AppConstants.INSTANCE.gallerytree_table_basic_column8())\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_table_basic_column9(), \"MMM dd, yyyy\")\n                        .column(AMOUNT).format(AppConstants.INSTANCE.gallerytree_table_basic_column10(), \"$ #,##0.00\")\n                        .title(AppConstants.INSTANCE.gallerytree_table_basic_title())\n                        .tablePageSize(10)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(AMOUNT, DESCENDING)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_table_filtered(), createPlaceRequest(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(SALES_OPPS)\n                        .column(CUSTOMER, AppConstants.INSTANCE.gallerytree_table_filtered_column1())\n                        .column(PRODUCT, AppConstants.INSTANCE.gallerytree_table_filtered_column2())\n                        .column(STATUS, AppConstants.INSTANCE.gallerytree_table_filtered_column3())\n                        .column(SOURCE, AppConstants.INSTANCE.gallerytree_table_filtered_column4())\n                        .column(CREATION_DATE, AppConstants.INSTANCE.gallerytree_table_filtered_column5())\n                        .column(EXPECTED_AMOUNT).format(AppConstants.INSTANCE.gallerytree_table_filtered_column6(), \"$ #,##0.00\")\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_table_filtered_column7(), \"MMM dd, yyyy\")\n                        .column(AMOUNT).format(AppConstants.INSTANCE.gallerytree_table_filtered_column8(), \"$ #,##0.00\")\n                        .filter(COUNTRY, OR(equalsTo(\"United States\"), equalsTo(\"Brazil\")))\n                        .title(AppConstants.INSTANCE.gallerytree_table_filtered_title())\n                        .tablePageSize(10)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(AMOUNT, DESCENDING)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_table_grouped(), createPlaceRequest(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, AppConstants.INSTANCE.gallerytree_table_grouped_column1())\n                        .column(COUNT, \"#Opps\").format(AppConstants.INSTANCE.gallerytree_table_grouped_column2(), \"#,##0\")\n                        .column(AMOUNT, MIN).format(AppConstants.INSTANCE.gallerytree_table_grouped_column3(), \"$ #,###\")\n                        .column(AMOUNT, MAX).format(AppConstants.INSTANCE.gallerytree_table_grouped_column4(), \"$ #,###\")\n                        .column(AMOUNT, AVERAGE).format(AppConstants.INSTANCE.gallerytree_table_grouped_column5(), \"$ #,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.gallerytree_table_grouped_column6(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_table_grouped_title())\n                        .tablePageSize(10)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(COUNTRY, DESCENDING)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_table_default_dd(), createPlaceRequest(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(SALES_OPPS)\n                        .column(COUNTRY, AppConstants.INSTANCE.gallerytree_table_default_dd_column1())\n                        .column(CUSTOMER, AppConstants.INSTANCE.gallerytree_table_default_dd_column2())\n                        .column(PRODUCT, AppConstants.INSTANCE.gallerytree_table_default_dd_column3())\n                        .column(SALES_PERSON, AppConstants.INSTANCE.gallerytree_table_default_dd_column4())\n                        .column(STATUS, AppConstants.INSTANCE.gallerytree_table_default_dd_column5())\n                        .column(SOURCE, AppConstants.INSTANCE.gallerytree_table_default_dd_column6())\n                        .column(CREATION_DATE, AppConstants.INSTANCE.gallerytree_table_default_dd_column7())\n                        .column(EXPECTED_AMOUNT).format(AppConstants.INSTANCE.gallerytree_table_default_dd_column8(), \"$ #,###\")\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.gallerytree_table_default_dd_column9(), \"MMM dd, yyyy\")\n                        .column(AMOUNT).format(AppConstants.INSTANCE.gallerytree_table_default_dd_column10(), \"$ #,###\")\n                        .title(AppConstants.INSTANCE.gallerytree_table_default_dd_title())\n                        .tablePageSize(10)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(AMOUNT, DESCENDING)\n                        .filterOn(true, true, true)\n                        .renderer(DefaultRenderer.UUID)\n                        .buildSettings()\n        )));\n    }\n\n    private void initSelectorCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_selector());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_selector_dropdown(), createPlaceRequest(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(COUNT, \"#Opps\").format(\"#Opps\", \"#,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_selector_total(), \"$ #,##0.00\")\n                        .sort(COUNTRY, ASCENDING)\n                        .title(AppConstants.INSTANCE.gallerytree_selector_dropdown()).titleVisible(true)\n                        .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n                        .width(200)\n                        .margins(20, 0, 20, 0)\n                        .multiple(true)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_selector_labels(), createPlaceRequest(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(COUNT, \"#Opps\").format(\"#Opps\", \"#,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_selector_total(), \"$ #,##0.00\")\n                        .sort(COUNTRY, ASCENDING)\n                        .title(AppConstants.INSTANCE.gallerytree_selector_labels()).titleVisible(true)\n                        .subtype(DisplayerSubType.SELECTOR_LABELS)\n                        .width(-1)\n                        .margins(20, 0, 20, 0)\n                        .multiple(true)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_selector_slider(), createPlaceRequest(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .title(AppConstants.INSTANCE.gallerytree_selector_slider()).titleVisible(true)\n                        .subtype(DisplayerSubType.SELECTOR_SLIDER)\n                        .column(CREATION_DATE).format(\"Creation date\", \"dd MMM, yyyy\")\n                        .margins(20, 0, 20, 0)\n                        .width(-1)\n                        .filterOn(false, true, true)\n                        .buildSettings()\n        )));\n    }\n\n    private void initDashboardCategory() {\n        GalleryTreeNodeList nodeList = new GalleryTreeNodeList(AppConstants.INSTANCE.gallerytree_db());\n        mainNodes.add(nodeList);\n\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_salesgoals(), createPlaceRequest(\"salesGoal\")));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_salespipe(), createPlaceRequest(\"salesPipeline\")));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_salespcountry(), createPlaceRequest(\"salesPerCountry\")));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_salesreps(), createPlaceRequest(\"salesReports\")));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_expreps(), createPlaceRequest(\"expenseReports\")));\n        nodeList.add(new GalleryPlaceRequest(AppConstants.INSTANCE.gallerytree_db_clustermetrics(), createPlaceRequest(\"clusterMetrics\")));\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTreeNode.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport java.util.List;\n\n/**\n * Base class for all gallery nodes.\n */\npublic abstract class GalleryTreeNode {\n\n    protected String name = null;\n    protected List<GalleryTreeNode> children = null;\n\n    public GalleryTreeNode(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public List<GalleryTreeNode> getChildren() {\n        return children;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTreeNodeList.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport java.util.ArrayList;\n\n/**\n * A list of gallery nodes.\n */\npublic class GalleryTreeNodeList extends GalleryTreeNode {\n\n    public GalleryTreeNodeList(String name) {\n        super(name);\n    }\n\n    public void add(GalleryTreeNode node) {\n        if (children == null) children = new ArrayList<GalleryTreeNode>();\n        children.add(node);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTreePresenter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchScreen(identifier = \"GalleryTreeScreen\")\n@Dependent\npublic class GalleryTreePresenter {\n\n    public interface GalleryTreeView extends UberView<GalleryTreePresenter> {\n\n    }\n\n    @Inject\n    GalleryTreeView view;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return AppConstants.INSTANCE.gallerytree_title();\n    }\n\n    @WorkbenchPartView\n    public UberView<GalleryTreePresenter> getView() {\n        return view;\n    }\n\n    public void navigateToNode(GalleryTreeNode node) {\n        if (node instanceof GalleryPlaceRequest) {\n            PlaceRequest placeRequest = ((GalleryPlaceRequest) node).getPlaceRequest();\n            placeManager.goTo(placeRequest);\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTreeViewImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HasTreeItems;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Tree;\nimport com.google.gwt.user.client.ui.TreeItem;\n\npublic class GalleryTreeViewImpl extends Composite implements GalleryTreePresenter.GalleryTreeView {\n\n    GalleryTreePresenter presenter;\n\n    @Inject\n    GalleryTree galleryTree;\n\n    private final SimplePanel mainPanel = new SimplePanel();\n\n    public void init(GalleryTreePresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @PostConstruct\n    private void initUI() {\n        initWidget(mainPanel);\n\n        Tree tree = initNavigationTree();\n        tree.setWidth(\"150px\");\n        Style leftStyle = mainPanel.getElement().getStyle();\n        leftStyle.setPropertyPx(\"margin\", 5);\n        mainPanel.add(tree);\n    }\n\n    private Tree initNavigationTree() {\n        Tree navTree = new Tree();\n\n        List<GalleryTreeNode> mainNodes = galleryTree.getMainNodes();\n        populateNavigationTree(mainNodes, navTree);\n\n        navTree.addSelectionHandler(new SelectionHandler<TreeItem>() {\n            public void onSelection(SelectionEvent<TreeItem> event) {\n                TreeItem ti = event.getSelectedItem();\n                GalleryTreeNode node = (GalleryTreeNode) ti.getUserObject();\n                treeItemClicked(ti, node);\n            }\n        });\n        return navTree;\n    }\n\n    private void populateNavigationTree(List<GalleryTreeNode> nodes, HasTreeItems items) {\n        if (nodes == null) return;\n        for (GalleryTreeNode node: nodes) {\n            TreeItem ti = new TreeItem();\n            ti.setText(node.getName());\n            ti.setUserObject(node);\n            ti.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n            items.addItem(ti);\n            populateNavigationTree(node.getChildren(), ti);\n        }\n    }\n\n    private void treeItemClicked(TreeItem ti, GalleryTreeNode node) {\n        presenter.navigateToNode(node);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryWidget.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface GalleryWidget extends IsWidget {\n\n    String getTitle();\n    void onClose();\n    boolean feedsFrom(String dataSetId);\n    void redrawAll();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryWidgetPresenter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.gallery;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.client.expenses.ExpensesDashboard;\nimport org.dashbuilder.client.metrics.ClusterMetricsDashboard;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.sales.widgets.SalesDistributionByCountry;\nimport org.dashbuilder.client.sales.widgets.SalesExpectedByDate;\nimport org.dashbuilder.client.sales.widgets.SalesGoals;\nimport org.dashbuilder.client.sales.widgets.SalesTableReports;\nimport org.dashbuilder.dataset.DataSetMetadata;\nimport org.dashbuilder.dataset.date.TimeAmount;\nimport org.dashbuilder.dataset.def.DataSetDef;\nimport org.dashbuilder.dataset.events.DataSetModifiedEvent;\nimport org.dashbuilder.dataset.events.DataSetPushOkEvent;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.INFO;\n\n@WorkbenchScreen(identifier = \"GalleryWidgetScreen\")\npublic class GalleryWidgetPresenter {\n\n    private GalleryWidget widget;\n    private SalesGoals salesGoals;\n    private SalesExpectedByDate salesExpectedByDate;\n    private SalesDistributionByCountry salesDistributionByCountry;\n    private SalesTableReports salesTableReports;\n    private ExpensesDashboard expensesDashboard;\n    private ClusterMetricsDashboard clusterMetricsDashboard;\n    private Event<NotificationEvent> workbenchNotification;\n\n    @Inject\n    public GalleryWidgetPresenter(SalesGoals salesGoals,\n                                  SalesExpectedByDate salesExpectedByDate,\n                                  SalesDistributionByCountry salesDistributionByCountry,\n                                  SalesTableReports salesTableReports,\n                                  ExpensesDashboard expensesDashboard,\n                                  ClusterMetricsDashboard clusterMetricsDashboard,\n                                  Event<NotificationEvent> workbenchNotification) {\n        this.salesGoals = salesGoals;\n        this.salesExpectedByDate = salesExpectedByDate;\n        this.salesDistributionByCountry = salesDistributionByCountry;\n        this.salesTableReports = salesTableReports;\n        this.expensesDashboard = expensesDashboard;\n        this.clusterMetricsDashboard = clusterMetricsDashboard;\n        this.workbenchNotification = workbenchNotification;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return widget.getTitle();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return widget;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        String widgetId = placeRequest.getParameter(\"widgetId\",\n                                                    \"\");\n        widget = getWidget(widgetId);\n    }\n\n    @OnClose\n    public void onClose() {\n        widget.onClose();\n    }\n\n    private GalleryWidget getWidget(String widgetId) {\n        if (\"salesGoal\".equals(widgetId)) {\n            return salesGoals;\n        }\n        if (\"salesPipeline\".equals(widgetId)) {\n            return salesExpectedByDate;\n        }\n        if (\"salesPerCountry\".equals(widgetId)) {\n            return salesDistributionByCountry;\n        }\n        if (\"salesReports\".equals(widgetId)) {\n            return salesTableReports;\n        }\n        if (\"expenseReports\".equals(widgetId)) {\n            return expensesDashboard;\n        }\n        if (\"clusterMetrics\".equals(widgetId)) {\n            return clusterMetricsDashboard;\n        }\n\n        throw new IllegalArgumentException(AppConstants.INSTANCE.gallerywidget_unknown() + widgetId);\n    }\n\n    // Catch some data set related events and display workbench notifications only and only if:\n    // - The data set refresh is enabled and\n    // - It's refresh rate is greater than 60 seconds (avoid tons of notifications in \"real-time\" scenarios)\n\n    private void onDataSetModifiedEvent(@Observes DataSetModifiedEvent event) {\n        checkNotNull(\"event\",\n                     event);\n\n        DataSetDef def = event.getDataSetDef();\n        String targetUUID = event.getDataSetDef().getUUID();\n        TimeAmount timeFrame = def.getRefreshTimeAmount();\n        boolean noRealTime = timeFrame == null || timeFrame.toMillis() > 60000;\n\n        if ((!def.isRefreshAlways() || noRealTime) && widget != null && widget.feedsFrom(targetUUID)) {\n            workbenchNotification.fire(new NotificationEvent(AppConstants.INSTANCE.gallerywidget_dataset_modif(),\n                                                             INFO));\n            widget.redrawAll();\n        }\n    }\n\n    private void onDataSetPushOkEvent(@Observes DataSetPushOkEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        checkNotNull(\"event\",\n                     event.getDataSetMetadata());\n\n        DataSetMetadata metadata = event.getDataSetMetadata();\n        DataSetDef def = metadata.getDefinition();\n        TimeAmount timeFrame = def.getRefreshTimeAmount();\n        if (timeFrame == null || timeFrame.toMillis() > 60000) {\n            int estimazedSizeKbs = event.getDataSetMetadata().getEstimatedSize() / 1000;\n            workbenchNotification.fire(new NotificationEvent(\n                    AppConstants.INSTANCE.gallerywidget_dataset_loaded(def.getProvider().toString(),\n                                                                       estimazedSizeKbs),\n                    INFO));\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/metrics/ClusterMetricsDashboard.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.metrics;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.ArrayList;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Callback;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.ListBox;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.dataset.DataSetBuilder;\nimport org.dashbuilder.displayer.BarChartSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsBuilder;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerType;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.displayer.impl.BarChartSettingsBuilderImpl;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\nimport org.uberfire.mvp.Command;\n\nimport static org.dashbuilder.backend.ClusterMetricsGenerator.*;\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\nimport static org.dashbuilder.dataset.filter.FilterFactory.*;\n\n/**\n * A composite widget that represents an entire dashboard sample composed using an UI binder template.\n * <p>The dashboard itself is composed by a set of Displayer instances.</p>\n */\n@Dependent\npublic class ClusterMetricsDashboard extends Composite implements GalleryWidget {\n\n    public static final String CPU = AppConstants.INSTANCE.metrics_cluster_metricselector_cpu();\n    public static final String MEMORY = AppConstants.INSTANCE.metrics_cluster_metricselector_mem();\n    public static final String DISK = AppConstants.INSTANCE.metrics_cluster_metricselector_disk();\n    public static final String NETWORK = AppConstants.INSTANCE.metrics_cluster_metricselector_netw();\n\n    interface Binder extends UiBinder<Widget, ClusterMetricsDashboard> {}\n    private static final Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    Panel messagePanel;\n\n    @UiField\n    Panel mainPanel;\n\n    @UiField\n    Panel leftPanel;\n\n    @UiField\n    Panel rightPanel;\n\n    @UiField\n    ListBox metricSelector;\n\n    @UiField\n    ListBox chartTypeSelector;\n\n    @UiField\n    Panel metricChartPanel;\n\n    @UiField(provided = true)\n    Displayer metricsTable;\n\n    List<ClusterMetric> metricDefList = new ArrayList<>();\n    Map<String,List<Integer>> metricChartDef = new HashMap<>();\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n    Displayer currentMetricChart = null;\n\n    Timer refreshTimer = new Timer() {\n        public void run() {\n            displayerCoordinator.redrawAll(\n                    // On success\n                    new Command() {\n                        public void execute() {\n                            refreshTimer.schedule(1000);\n                        }\n                    },\n                    // On Failure\n                    new Command() {\n                        public void execute() {\n\n                        }\n                    }\n            );\n        }\n    };\n\n    @Inject\n    public ClusterMetricsDashboard(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.metrics_cluster_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n        refreshTimer.cancel();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return \"clusterMetrics\".equals(dataSetId);\n    }\n\n    @Override\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n\n    class ClusterMetric {\n        String column;\n        String title;\n        String format;\n        String expression;\n        String bgColor;\n        boolean tableVisible;\n        String units;\n\n        public ClusterMetric(String column, String title, String format, String expression, String bgColor, boolean tableVisible, String units) {\n            this.column = column;\n            this.title = title;\n            this.format = format;\n            this.expression = expression;\n            this.bgColor = bgColor;\n            this.tableVisible = tableVisible;\n            this.units = units;\n        }\n    }\n\n    @PostConstruct\n    public void init() {\n\n        // Create the metric definitions\n        metricDefList.add(new ClusterMetric(COLUMN_CPU0, AppConstants.INSTANCE.metrics_cluster_column_cpu(), \"#,##0\", null, \"84ADF4\", true, AppConstants.INSTANCE.metrics_cluster_column_cpu_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_DISK_FREE, AppConstants.INSTANCE.metrics_cluster_column_df(), \"#,##0 Gb\", null, \"BCF3EE\", false, AppConstants.INSTANCE.metrics_cluster_column_df_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_DISK_USED, AppConstants.INSTANCE.metrics_cluster_column_du(), \"#,##0 Gb\", null, \"BCF3EE\", true, AppConstants.INSTANCE.metrics_cluster_column_du_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_MEMORY_FREE, AppConstants.INSTANCE.metrics_cluster_column_memf(), \"#,##0.00 Gb\", null, \"F9AEAF\", false, AppConstants.INSTANCE.metrics_cluster_column_memf_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_MEMORY_USED, AppConstants.INSTANCE.metrics_cluster_column_memu(), \"#,##0.00 Gb\", null, \"F9AEAF\", true, AppConstants.INSTANCE.metrics_cluster_column_memu_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_PROCESSES_RUNNING, AppConstants.INSTANCE.metrics_cluster_column_procsrn(), \"#,##0\", null, \"A4EEC8\", false, AppConstants.INSTANCE.metrics_cluster_column_procsrn_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_PROCESSES_SLEEPING, AppConstants.INSTANCE.metrics_cluster_column_procssl(), \"#,##0\", null, \"A4EEC8\", true, AppConstants.INSTANCE.metrics_cluster_column_procssl_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_NETWORK_RX, AppConstants.INSTANCE.metrics_cluster_column_netrx(), \"#,##0 Kb/s\", null, \"F5AC47\", false, AppConstants.INSTANCE.metrics_cluster_column_netrx_y()));\n        metricDefList.add(new ClusterMetric(COLUMN_NETWORK_TX, AppConstants.INSTANCE.metrics_cluster_column_nettx(), \"#,##0 Kb/s\", null, \"F5AC47\", true, AppConstants.INSTANCE.metrics_cluster_column_nettx_y()));\n\n        metricChartDef.put(CPU, Arrays.asList(0));\n        metricChartDef.put(DISK, Arrays.asList(1,2));\n        metricChartDef.put(MEMORY, Arrays.asList(3,4));\n        metricChartDef.put(NETWORK, Arrays.asList(7,8));\n\n        // Init the metrics table\n        DisplayerSettingsBuilder tableBuilder = DisplayerSettingsFactory.newTableSettings()\n                .renderer(DefaultRenderer.UUID)\n                .tableWidth(700)\n                .tableOrderDefault(COLUMN_SERVER, ASCENDING)\n                .filterOn(true, true, false)\n                .dataset(\"clusterMetrics\")\n                .tableColumnPickerEnabled(false)\n                .filter(COLUMN_TIMESTAMP, timeFrame(\"now -2second till now\"))\n                .group(COLUMN_SERVER)\n                .column(COLUMN_SERVER).format(\"Server\")\n                .column(COLUMN_TIMESTAMP).format(AppConstants.INSTANCE.metrics_cluster_column_time(), \"HH:mm:ss\");\n\n        for (ClusterMetric metric : metricDefList) {\n            if (metric.tableVisible) {\n                tableBuilder.column(metric.column, AVERAGE);\n                tableBuilder.format(metric.title, metric.format);\n                tableBuilder.expression(metric.column, metric.expression);\n            }\n        }\n\n        metricsTable = displayerLocator.lookupDisplayer(tableBuilder.buildSettings());\n        displayerCoordinator.addDisplayer(metricsTable);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n        mainPanel.getElement().setAttribute(\"cellpadding\", \"5\");\n\n        // Init the box metrics\n        leftPanel.clear();\n        for (Integer metricIdx : Arrays.asList(0, 1, 3, 5, 7)) {\n            ClusterMetric metric = metricDefList.get(metricIdx);\n            Displayer metricDisplayer = displayerLocator.lookupDisplayer(\n                    DisplayerSettingsFactory.newMetricSettings()\n                            .dataset(\"clusterMetrics\")\n                            .filter(COLUMN_TIMESTAMP, timeFrame(\"now -2second till now\"))\n                            .column(metric.column, AVERAGE)\n                            .expression(metric.expression)\n                            .format(metric.title, metric.format)\n                            .title(metric.title)\n                            .titleVisible(true)\n                            .width(200).height(90)\n                            .margins(10, 10, 10, 10)\n                            .backgroundColor(metric.bgColor)\n                            .filterOff(true)\n                            .buildSettings());\n\n            displayerCoordinator.addDisplayer(metricDisplayer);\n            leftPanel.add(metricDisplayer);\n        }\n\n        // Init the metric selector\n        metricSelector.clear();\n        metricSelector.addItem(CPU);\n        metricSelector.addItem(MEMORY);\n        metricSelector.addItem(DISK);\n        metricSelector.addItem(NETWORK);\n\n        // Init the chart type selector\n        chartTypeSelector.clear();\n        chartTypeSelector.addItem(AppConstants.INSTANCE.metrics_cluster_chartselector_bar());\n        chartTypeSelector.addItem(AppConstants.INSTANCE.metrics_cluster_chartselector_line());\n        chartTypeSelector.addItem(AppConstants.INSTANCE.metrics_cluster_chartselector_area());\n\n        // Init the metric chart\n        currentMetricChart = createChartMetric(CPU);\n        metricChartPanel.clear();\n        metricChartPanel.add(currentMetricChart);\n        displayerCoordinator.addDisplayer(currentMetricChart);\n\n        // Draw the charts\n        displayerCoordinator.drawAll(\n                // On success\n                new Command() {\n                    public void execute() {\n                        messagePanel.setVisible(false);\n                        mainPanel.setVisible(true);\n                        refreshTimer.schedule(1000);\n                    }\n                },\n                // On Failure\n                new Command() {\n                    public void execute() {\n\n                    }\n                }\n        );\n    }\n\n    protected Displayer createChartMetric(String group) {\n\n        DisplayerType type = DisplayerType.BARCHART;\n        switch (chartTypeSelector.getSelectedIndex()) {\n            case 1: type = DisplayerType.LINECHART; break;\n            case 2: type = DisplayerType.AREACHART; break;\n        }\n\n        BarChartSettingsBuilder<BarChartSettingsBuilderImpl> builder = DisplayerSettingsFactory.newBarChartSettings()\n                .title(group)\n                .titleVisible(false)\n                .width(700).height(200)\n                .margins(30, 5, 60, 10)\n                .legendOff()\n                .filterOff(true)\n                .dataset(\"clusterMetrics\");\n\n        if (DisplayerType.BARCHART.equals(type)) {\n            builder.filter(COLUMN_TIMESTAMP, timeFrame(\"begin[minute] till end[minute]\"));\n            builder.group(COLUMN_TIMESTAMP).fixed(SECOND, true);\n            builder.column(COLUMN_TIMESTAMP).format(AppConstants.INSTANCE.metrics_cluster_column_time());\n            builder.subType_StackedColumn();\n        } else {\n            builder.filter(COLUMN_TIMESTAMP, timeFrame(\"-60second till now\"));\n            builder.group(COLUMN_TIMESTAMP).dynamic(60, SECOND, true);\n            builder.column(COLUMN_TIMESTAMP).format(AppConstants.INSTANCE.metrics_cluster_column_time());\n        }\n\n        List<Integer> metricIdxs = metricChartDef.get(group);\n        for (Integer metricIdx : metricIdxs) {\n            ClusterMetric metric = metricDefList.get(metricIdx);\n                builder.column(metric.column, AVERAGE);\n                builder.expression(metric.expression);\n                builder.format(metric.title, metric.format);\n                builder.yAxisTitle(metric.units);\n        }\n\n        DisplayerSettings settings = builder.buildSettings();\n        settings.setType(type);\n        return displayerLocator.lookupDisplayer(settings);\n    }\n\n    @UiHandler(\"chartTypeSelector\")\n    public void onChartTypeSelected(ChangeEvent changeEvent) {\n        onMetricSelected(changeEvent);\n    }\n\n    @UiHandler(\"metricSelector\")\n    public void onMetricSelected(ChangeEvent changeEvent) {\n\n        // Dispose the current metric chart\n        currentMetricChart.close();\n        displayerCoordinator.removeDisplayer(currentMetricChart);\n\n        // Create the metric chart\n        String title = metricSelector.getValue(metricSelector.getSelectedIndex());\n        currentMetricChart = createChartMetric(title);\n        currentMetricChart.draw();\n        displayerCoordinator.addDisplayer(currentMetricChart);\n\n        // Update the dashboard view\n        metricChartPanel.clear();\n        metricChartPanel.add(currentMetricChart);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/metrics/ClusterMetricsDashboard.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:d=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.resources.i18n.AppConstants\"/>\n\n  <ui:style>\n    .panel {\n      padding: 5px;\n    }\n    .listBox {\n      width: 150px;\n    }\n  </ui:style>\n\n  <g:FlowPanel>\n    <g:FlowPanel ui:field=\"messagePanel\">\n      <b:Jumbotron>\n        <b:Heading text=\"{i18n.metrics_cluster_messages_heading}\" size=\"H2\" />\n      </b:Jumbotron>\n    </g:FlowPanel>\n    <g:HorizontalPanel ui:field=\"mainPanel\" visible=\"false\">\n      <g:FlowPanel ui:field=\"leftPanel\" styleName=\"{style.panel}\" />\n      <g:FlowPanel styleName=\"{style.panel}\">\n        <g:HorizontalPanel>\n          <g:FlowPanel styleName=\"{style.panel}\" ui:field=\"centerPanel\" >\n            <g:Label text=\"{i18n.metrics_cluster_metricselector_label}\"/>\n            <g:ListBox ui:field=\"metricSelector\" styleName=\"{style.listBox}\"/>\n          </g:FlowPanel>\n          <g:FlowPanel styleName=\"{style.panel}\">\n            <g:Label text=\"{i18n.metrics_cluster_chartselector_label}\"/>\n            <g:ListBox ui:field=\"chartTypeSelector\" styleName=\"{style.listBox}\"/>\n          </g:FlowPanel>\n        </g:HorizontalPanel>\n        <g:FlowPanel ui:field=\"metricChartPanel\" styleName=\"{style.panel}\"/>\n        <d:Displayer ui:field=\"metricsTable\"/>\n      </g:FlowPanel>\n      <g:FlowPanel ui:field=\"rightPanel\" styleName=\"{style.panel}\" />\n    </g:HorizontalPanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/navbar/AppHeader.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n        http://www.apache.org/licenses/LICENSE-2.0\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<div id=\"header\"></div>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/navbar/AppHeader.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navbar;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport jsinterop.base.Js;\nimport org.dashbuilder.client.navigation.NavBarHelper;\nimport org.dashbuilder.client.navigation.NavTreeDefinitions;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.navigation.NavTree;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.menu.UserMenu;\nimport org.uberfire.client.workbench.Header;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.WorkbenchMegaMenuPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Templated\n@ApplicationScoped\npublic class AppHeader implements Header {\n\n    private AppConstants i18n = AppConstants.INSTANCE;\n\n    @Inject\n    @DataField\n    HTMLDivElement header;\n\n    @Inject\n    private WorkbenchMegaMenuPresenter menuBarPresenter;\n\n    @Inject\n    UserMenu userMenu;\n\n    @Inject\n    private NavBarHelper navBarHelper;\n\n    User user;\n    Command onItemSelectedCommand;\n    Command onLogoutCommand;\n    NavTree navTree;\n    String currentPerspectiveId;\n\n    private Menus userMenus;\n\n    public AppHeader() {}\n\n    @Inject\n    public AppHeader(User user) {\n        this.user = user;\n    }\n\n    @PostConstruct\n    private void init() {\n        header.appendChild(Js.cast(menuBarPresenter.getView().getElement()));\n\n        userMenu.clear();\n        userMenu.addMenus(MenuFactory.newTopLevelMenu(i18n.logOut())\n                                     .respondsWith(this::onLogoutClicked)\n                                     .endMenu()\n                                     .build());\n        userMenus = MenuFactory.newTopLevelCustomMenu(userMenu).endMenu().build();\n    }\n\n    @Override\n    public String getId() {\n        return \"AppHeader\";\n    }\n\n    @Override\n    public int getOrder() {\n        return 2;\n    }\n\n    public void setOnLogoutCommand(Command command) {\n        this.onLogoutCommand = command;\n        menuBarPresenter.addMenus(userMenus);\n    }\n\n    public void onLogoutClicked() {\n        if (onLogoutCommand != null) {\n            onLogoutCommand.execute();\n        }\n    }\n\n    public void setupMenu(NavTree navTree) {\n        Menus menus = navBarHelper.buildMenusFromNavTree(navTree).build();\n        menuBarPresenter.clear();\n        menuBarPresenter.addMenus(menus);\n        menuBarPresenter.addMenus(userMenus);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/navbar/DashbuilderNavBrand.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\n\n@ApplicationScoped\npublic class DashbuilderNavBrand implements MegaMenuBrand {\n\n    @Override\n    public String brandImageUrl() {\n        return \"./images/dashbuilder_brand.png\";\n    }\n\n    @Override\n    public String brandImageLabel() {\n        return \"Dashbuilder\";\n    }\n\n    @Override\n    public String menuAccessorLabel() {\n        return \"Menu\";\n    }\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/navigation/NavTreeDefinitions.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.navigation;\n\nimport org.dashbuilder.navigation.NavTree;\nimport org.dashbuilder.navigation.impl.NavTreeBuilder;\n\nimport static org.dashbuilder.navigation.workbench.NavWorkbenchCtx.*;\nimport static org.dashbuilder.perspectives.PerspectiveIds.*;\n\n/**\n * Navigation tree definitions such as the top menu bar\n */\npublic interface NavTreeDefinitions {\n\n    String DASHBOARDS_GROUP = \"dashboards_group\";\n    String GROUP_APP = \"app\";\n    String ENTRY_HOME = \"app_home\";\n    String ENTRY_GALLERY = \"app_gallery\";\n    String GROUP_ADMIN = \"app_admin\";\n    String ENTRY_DATASETS = \"app_datasets\";\n    String ENTRY_SECURITY = \"app_security\";\n    String ENTRY_CONTENT_MGR = \"app_contentMgr\";\n    String GROUP_DASHBOARDS = \"app_dashboards\";\n    String ENTRY_SALES_DASHBOARD = \"app_salesDashboard\";\n    String ENTRY_SALES_REPORTS = \"app_salesReports\";\n\n    NavTree NAV_TREE_DEFAULT = new NavTreeBuilder()\n            .group(GROUP_APP, \"Dashbuilder\", \"The items displayed by the application's top menu bar\", false)\n                .item(ENTRY_HOME, \"Home\", \"The home page\", true, perspective(HOME))\n                .item(ENTRY_GALLERY, \"Gallery\", \"The displayer gallery\", true, perspective(GALLERY))\n            .endGroup()\n            .group(GROUP_ADMIN, \"Administration\", \"The administration tools\", false)\n                .item(ENTRY_DATASETS, \"Datasets\", \"The dataset authoring tool\", false, perspective(DATA_SETS))\n                .item(ENTRY_SECURITY, \"Security\", \"The security configuration tool\", false, perspective(SECURITY))\n                .item(ENTRY_CONTENT_MGR, \"Content manager\", \"The content manager tool\", false, perspective(CONTENT_MANAGER))\n                .item(ENTRY_CONTENT_MGR, \"Data Transfer\", \"Allow content transference between installations\", false, perspective(DATA_TRANSFER))\n            .endGroup()\n        .build();\n    \n    \n    NavTree INITIAL_EMPTY = new NavTreeBuilder()\n                                        .group(DASHBOARDS_GROUP, \"Dashboards\", \"\", true)\n                                        .endGroup()\n                                    .build();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/perspectives/DisplayerGalleryPerspective.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n/**\n * The gallery perspective.\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"DisplayerGalleryPerspective\")\npublic class DisplayerGalleryPerspective {\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n\n        PanelDefinition west = new PanelDefinitionImpl( StaticWorkbenchPanelPresenter.class.getName() );\n        west.setWidth(200);\n        west.setMinWidth(150);\n        west.addPart(\"GalleryTreeScreen\");\n\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiTabWorkbenchPanelPresenter.class.getName());\n        perspective.setName(AppConstants.INSTANCE.menu_gallery());\n        perspective.getRoot().insertChild(CompassPosition.WEST, west);\n        perspective.getRoot().addPart(\"GalleryHomeScreen\");\n        return perspective;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/perspectives/HomePerspective.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.perspectives;\n\nimport org.dashbuilder.client.screens.HomeScreen;\nimport org.dashbuilder.perspectives.PerspectiveIds;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@WorkbenchPerspective(identifier = PerspectiveIds.HOME, isDefault = true)\npublic class HomePerspective  {\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        final PlaceRequest place = new DefaultPlaceRequest(HomeScreen.ID);\n        PartDefinitionImpl dashboardScreen = new PartDefinitionImpl(place);\n        perspective.getRoot().addPart(dashboardScreen);\n        perspective.setName(\"Dashbuilder Home\");\n        return perspective;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/perspectives/SalesDashboardPerspective.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.perspectives;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.dashbuilder.client.sales.SalesOppsDisplayers.*;\n\n/**\n * A sample dashboard perspective\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"SalesDashboardPerspective\")\npublic class SalesDashboardPerspective {\n\n    DisplayerSettingsJSONMarshaller jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiTabWorkbenchPanelPresenter.class.getName());\n        perspective.setName(AppConstants.INSTANCE.salesdbpersp_salessummary());\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_BY_STATUS)));\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_BY_SALESMAN)));\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_BY_PRODUCT)));\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_BY_COUNTRY)));\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_COUNTRY_SUMMARY)));\n        return perspective;\n    }\n\n    private PlaceRequest createPlaceRequest(DisplayerSettings displayerSettings) {\n        String json = jsonMarshaller.toJsonString(displayerSettings);\n        Map<String,String> params = new HashMap<>();\n        params.put(\"json\", json);\n        params.put(\"edit\", \"false\");\n        return new DefaultPlaceRequest(\"DisplayerScreen\", params);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/perspectives/SalesReportsPerspective.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.perspectives;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.json.DisplayerSettingsJSONMarshaller;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.dashbuilder.client.sales.SalesOppsDisplayers.*;\n\n/**\n * A sample dashboard perspective\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"SalesReportsPerspective\")\npublic class SalesReportsPerspective {\n\n    DisplayerSettingsJSONMarshaller jsonMarshaller = DisplayerSettingsJSONMarshaller.get();\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiTabWorkbenchPanelPresenter.class.getName());\n        perspective.setName(AppConstants.INSTANCE.salesreportspersp_salesreports());\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_ALLOPPS_LISTING)));\n        perspective.getRoot().addPart(new PartDefinitionImpl(createPlaceRequest(OPPS_COUNTRY_SUMMARY)));\n        return perspective;\n    }\n\n    private PlaceRequest createPlaceRequest(DisplayerSettings displayerSettings) {\n        String json = jsonMarshaller.toJsonString(displayerSettings);\n        Map<String,String> params = new HashMap<>();\n        params.put(\"json\", json);\n        params.put(\"edit\", \"false\");\n        return new DefaultPlaceRequest(\"DisplayerScreen\", params);\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/resources/AppImages.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.resources;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for Workbench\n */\npublic interface AppImages extends ClientBundle {\n\n    @Source(\"images/dashbuilder_home_pie.png\")\n    ImageResource pieChartLogo();\n\n    @Source(\"images/dashbuilder_gallery_bar.png\")\n    ImageResource barChartLogo();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/resources/AppResource.java",
    "content": "package org.dashbuilder.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface AppResource\n        extends\n        ClientBundle {\n\n    AppResource INSTANCE = GWT.create( AppResource.class );\n\n    AppImages images();\n\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/resources/i18n/AppConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface AppConstants extends Messages {\n\n    public static final AppConstants INSTANCE = GWT.create(AppConstants.class);\n\n    String logoBannerError();\n\n    String logOut();\n\n    String role();\n\n    String menu_home();\n\n    String menu_gallery();\n    \n    String menu_administration();\n\n    String menu_security();\n\n    String menu_dataset_authoring();\n\n    String menu_dashboards();\n\n    String menu_dashboards_salesdb();\n\n    String menu_dashboards_salesreports();\n\n    String menu_dashboards_new();\n\n    String menu_content_manager();\n\n    String menu_extensions_apps();\n\n    String home_intro();\n\n    String home_upcoming();\n\n    String home_feature1();\n\n    String home_feature2();\n\n    String home_feature3();\n\n    String home_feature4();\n\n    String home_feature5();\n\n    String home_feature6();\n\n    String home_feature7();\n\n    String home_feature8();\n\n    String home_feature9();\n\n    String home_feature10();\n\n    String home_feature11();\n\n    String home_feature12();\n\n    String home_feature13();\n\n    String home_arch();\n\n    String home_arch1();\n\n    String home_arch2();\n\n    String home_arch3();\n\n    String home_arch4();\n\n    String home_arch5();\n\n    String home_arch6a();\n\n    String home_arch6b();\n\n    String home_furtherinfo();\n\n    String home_license();\n\n    String notification_dashboard_created(String id);\n\n    String notification_dashboard_deleted(String id);\n\n    String dashboard_new_displayer();\n    String dashboard_delete_dashboard();\n    String dashboard_delete_popup_title();\n    String dashboard_delete_popup_content();\n\n    String salesdbpersp_salessummary();\n\n    String salesreportspersp_salesreports();\n\n    String expensesdb_title();\n\n    String expensesdb_tab_exp_evolution();\n\n    String expensesdb_tab_by_employee();\n\n    String expensesdb_tab_all_exp();\n\n    String expensesdb_pie_title();\n\n    String expensesdb_pie_column1();\n\n    String expensesdb_pie_column2();\n\n    String expensesdb_pie_column3();\n\n    String expensesdb_bar_title();\n\n    String expensesdb_bar_column1();\n\n    String expensesdb_bubble_title();\n\n    String expensesdb_bubble_column1();\n\n    String expensesdb_bubble_column2();\n\n    String expensesdb_bubble_column3();\n\n    String expensesdb_bubble_column4();\n\n    String expensesdb_line_title();\n\n    String expensesdb_line_column1();\n\n    String expensesdb_table_title();\n\n    String expensesdb_table_column1();\n\n    String expensesdb_table_column2();\n\n    String expensesdb_table_column3();\n\n    String expensesdb_table_column4();\n\n    String expensesdb_table_column5();\n\n    String gallerytree_home();\n\n    String gallerytree_home_p1();\n\n    String gallerytree_home_s2a();\n\n    String gallerytree_home_s2b();\n\n    String gallerytree_home_ghublink();\n\n    String gallerytree_title();\n\n    String gallerytree_bar();\n\n    String gallerytree_bar_horiz();\n\n    String gallerytree_bar_horiz_title();\n\n    String gallerytree_bar_horiz_column1();\n\n    String gallerytree_bar_vert();\n\n    String gallerytree_bar_vert_title();\n\n    String gallerytree_bar_vert_column1();\n\n    String gallerytree_bar_vert_dd();\n\n    String gallerytree_bar_vert_dd_title();\n\n    String gallerytree_bar_vert_dd_column1();\n\n    String gallerytree_bar_vert_dd_column2();\n\n    String gallerytree_bar_vert_dd_column3();\n\n    String gallerytree_bar_multi();\n\n    String gallerytree_bar_stacked();\n\n    String gallerytree_bar_multi_title();\n\n    String gallerytree_bar_multi_column1();\n\n    String gallerytree_bar_multi_column2();\n\n    String gallerytree_bar_multi_column3();\n\n    String gallerytree_pie();\n\n    String gallerytree_pie_basic();\n\n    String gallerytree_pie_basic_title();\n\n    String gallerytree_pie_basic_column1();\n\n    String gallerytree_pie_3d();\n\n    String gallerytree_pie_3d_title();\n\n    String gallerytree_pie_3d_column1();\n\n    String gallerytree_pie_donut();\n\n    String gallerytree_pie_donut_title();\n\n    String gallerytree_pie_donut_column1();\n\n    String gallerytree_pie_dd();\n\n    String gallerytree_pie_dd_title();\n\n    String gallerytree_pie_dd_column1();\n\n    String gallerytree_pie_dd_column2();\n\n    String gallerytree_pie_dd_column3();\n\n    String gallerytree_line();\n\n    String gallerytree_line_basic();\n\n    String gallerytree_line_basic_title();\n\n    String gallerytree_line_basic_column1();\n\n    String gallerytree_line_basic_column2();\n\n    String gallerytree_line_multi();\n\n    String gallerytree_line_multi_title();\n\n    String gallerytree_line_multi_column1();\n\n    String gallerytree_line_multi_column2();\n\n    String gallerytree_line_multi_column3();\n\n    String gallerytree_line_multi_static();\n\n    String gallerytree_line_multi_static_title();\n\n    String gallerytree_line_multi_static_column1();\n\n    String gallerytree_line_multi_static_column2();\n\n    String gallerytree_line_multi_static_column3();\n\n    String gallerytree_area();\n\n    String gallerytree_area_basic();\n\n    String gallerytree_area_basic_title();\n\n    String gallerytree_area_basic_column1();\n\n    String gallerytree_area_fixed();\n\n    String gallerytree_area_fixed_title();\n\n    String gallerytree_area_fixed_column1();\n\n    String gallerytree_area_fixed_column2();\n\n    String gallerytree_area_dd();\n\n    String gallerytree_area_dd_title();\n\n    String gallerytree_area_dd_column1();\n\n    String gallerytree_area_dd_column2();\n\n    String gallerytree_bubble();\n\n    String gallerytree_bubble_basic();\n\n    String gallerytree_bubble_basic_title();\n\n    String gallerytree_bubble_basic_column1();\n\n    String gallerytree_bubble_basic_column2();\n\n    String gallerytree_bubble_basic_column3();\n\n    String gallerytree_bubble_basic_column4();\n\n    String gallerytree_meter();\n\n    String gallerytree_meter_basic();\n\n    String gallerytree_meter_basic_title();\n\n    String gallerytree_meter_basic_column1();\n\n    String gallerytree_meter_multi();\n\n    String gallerytree_meter_multi_title();\n\n    String gallerytree_meter_multi_column1();\n\n    String gallerytree_meter_multi_static();\n\n    String gallerytree_meter_multi_static_title();\n\n    String gallerytree_meter_multi_static_column1();\n\n    String gallerytree_meter_multi_static_column2();\n\n    String gallerytree_metrics();\n\n    String gallerytree_metrics_basic();\n\n    String gallerytree_metrics_basic_title();\n\n    String gallerytree_metrics_basic_column1();\n\n    String gallerytree_metrics_basic_static();\n\n    String gallerytree_metrics_basic_static_title();\n\n    String gallerytree_metrics_basic_static_column1();\n\n    String gallerytree_map();\n\n    String gallerytree_map_region();\n\n    String gallerytree_map_region_title();\n\n    String gallerytree_map_region_column1();\n\n    String gallerytree_map_marker();\n\n    String gallerytree_map_marker_title();\n\n    String gallerytree_map_marker_column1();\n\n    String gallerytree_table();\n\n    String gallerytree_table_basic();\n\n    String gallerytree_table_basic_title();\n\n    String gallerytree_table_basic_column1();\n\n    String gallerytree_table_basic_column2();\n\n    String gallerytree_table_basic_column3();\n\n    String gallerytree_table_basic_column4();\n\n    String gallerytree_table_basic_column5();\n\n    String gallerytree_table_basic_column6();\n\n    String gallerytree_table_basic_column7();\n\n    String gallerytree_table_basic_column8();\n\n    String gallerytree_table_basic_column9();\n\n    String gallerytree_table_basic_column10();\n\n    String gallerytree_table_filtered();\n\n    String gallerytree_table_filtered_title();\n\n    String gallerytree_table_filtered_column1();\n\n    String gallerytree_table_filtered_column2();\n\n    String gallerytree_table_filtered_column3();\n\n    String gallerytree_table_filtered_column4();\n\n    String gallerytree_table_filtered_column5();\n\n    String gallerytree_table_filtered_column6();\n\n    String gallerytree_table_filtered_column7();\n\n    String gallerytree_table_filtered_column8();\n\n    String gallerytree_table_grouped();\n\n    String gallerytree_table_grouped_title();\n\n    String gallerytree_table_grouped_column1();\n\n    String gallerytree_table_grouped_column2();\n\n    String gallerytree_table_grouped_column3();\n\n    String gallerytree_table_grouped_column4();\n\n    String gallerytree_table_grouped_column5();\n\n    String gallerytree_table_grouped_column6();\n\n    String gallerytree_table_default_dd();\n\n    String gallerytree_table_default_dd_title();\n\n    String gallerytree_table_default_dd_column1();\n\n    String gallerytree_table_default_dd_column2();\n\n    String gallerytree_table_default_dd_column3();\n\n    String gallerytree_table_default_dd_column4();\n\n    String gallerytree_table_default_dd_column5();\n\n    String gallerytree_table_default_dd_column6();\n\n    String gallerytree_table_default_dd_column7();\n\n    String gallerytree_table_default_dd_column8();\n\n    String gallerytree_table_default_dd_column9();\n\n    String gallerytree_table_default_dd_column10();\n\n    String gallerytree_selector();\n\n    String gallerytree_selector_dropdown();\n\n    String gallerytree_selector_labels();\n\n    String gallerytree_selector_slider();\n\n    String gallerytree_db();\n\n    String gallerytree_db_salesgoals();\n\n    String gallerytree_db_salespipe();\n\n    String gallerytree_db_salespcountry();\n\n    String gallerytree_db_salesreps();\n\n    String gallerytree_db_expreps();\n\n    String gallerytree_db_clustermetrics();\n\n    String gallerywidget_unknown();\n\n    String gallerywidget_dataset_modif();\n\n    String gallerywidget_dataset_loaded(String type, int size);\n\n    String metrics_server_detail_title();\n\n    String metrics_server_detail_backbutton_tt();\n\n    String metrics_server_detail_modebutton_tt_viewtable();\n\n    String metrics_server_detail_modebutton_tt_viewcharts();\n\n    String metrics_server_detail_lasthour_summary();\n\n    String metrics_server_detail_cpu_usage();\n\n    String metrics_server_detail_mem_usage();\n\n    String metrics_server_detail_netw_usage();\n\n    String metrics_server_detail_disk_usage();\n\n    String metrics_server_detail_live_procs();\n\n    String metrics_server_detail_cpu1_title();\n\n    String metrics_server_detail_cpu2_title();\n\n    String metrics_server_detail_mem_title();\n\n    String metrics_server_detail_netw_title();\n\n    String metrics_server_detail_disk_title();\n\n    String metrics_server_detail_disk_column1();\n\n    String metrics_server_detail_disk_column2();\n\n    String metrics_server_detail_procs_running_title();\n\n    String metrics_server_detail_procs_running_column1();\n\n    String metrics_server_detail_procs_sleeping_title();\n\n    String metrics_server_detail_procs_sleeping_column1();\n\n    String metrics_server_detail_rt_table_title(String server);\n\n    String metrics_server_detail_rt_table_column1();\n\n    String metrics_server_detail_rt_table_column2();\n\n    String metrics_server_detail_rt_table_column3();\n\n    String metrics_server_detail_rt_table_column4();\n\n    String metrics_server_detail_rt_table_column5();\n\n    String metrics_server_detail_rt_table_column6();\n\n    String metrics_server_detail_rt_table_column7();\n\n    String metrics_server_detail_rt_table_column8();\n\n    String metrics_server_detail_rt_table_column9();\n\n    String metrics_server_detail_rt_table_column10();\n\n    String metrics_server_detail_rt_table_column11();\n\n    String metrics_server_vert_title();\n\n    String metrics_server_vert_default_tt();\n\n    String metrics_server_vert_cpu_tt();\n\n    String metrics_server_vert_usedmem_tt();\n\n    String metrics_server_vert_netbw_tt();\n\n    String metrics_server_vert_procs_tt();\n\n    String metrics_server_vert_disk_tt();\n\n    String metrics_server_vert_cpu1_title();\n\n    String metrics_server_vert_cpu2_title();\n\n    String metrics_server_vert_memconsumption_title();\n\n    String metrics_server_vert_netbw_title();\n\n    String metrics_server_vert_procs_title();\n\n    String metrics_server_vert_du_title();\n\n    String metrics_server_vert_du_free();\n\n    String metrics_server_vert_du_used();\n\n    String metrics_server_vert_serverdown(String server);\n\n    String metrics_cluster_title();\n\n    String metrics_cluster_messages_heading();\n\n    String metrics_cluster_metricselector_label();\n\n    String metrics_cluster_chartselector_label();\n\n    String metrics_cluster_metricselector_cpu();\n\n    String metrics_cluster_metricselector_mem();\n\n    String metrics_cluster_metricselector_disk();\n\n    String metrics_cluster_metricselector_netw();\n\n    String metrics_cluster_metricselector_proc();\n\n    String metrics_cluster_chartselector_bar();\n\n    String metrics_cluster_chartselector_line();\n\n    String metrics_cluster_chartselector_area();\n\n    String metrics_cluster_column_cpu();\n\n    String metrics_cluster_column_cpu_y();\n\n    String metrics_cluster_column_df();\n\n    String metrics_cluster_column_df_y();\n\n    String metrics_cluster_column_du();\n\n    String metrics_cluster_column_du_y();\n\n    String metrics_cluster_column_memf();\n\n    String metrics_cluster_column_memf_y();\n\n    String metrics_cluster_column_memu();\n\n    String metrics_cluster_column_memu_y();\n\n    String metrics_cluster_column_procsrn();\n\n    String metrics_cluster_column_procsrn_y();\n\n    String metrics_cluster_column_procssl();\n\n    String metrics_cluster_column_procssl_y();\n\n    String metrics_cluster_column_netrx();\n\n    String metrics_cluster_column_netrx_y();\n\n    String metrics_cluster_column_nettx();\n\n    String metrics_cluster_column_nettx_y();\n\n    String metrics_cluster_column_time();\n\n    String metrics_rt_title();\n\n    String metrics_rt_serverup();\n\n    String metrics_rt_serverdown();\n\n    String sales_bycountry_title();\n\n    String sales_bycountry_bubble_title();\n\n    String sales_bycountry_bubble_column1();\n\n    String sales_bycountry_bubble_column2();\n\n    String sales_bycountry_bubble_column3();\n\n    String sales_bycountry_map_title();\n\n    String sales_bycountry_map_column1();\n\n    String sales_bycountry_table_title();\n\n    String sales_bycountry_table_column1();\n\n    String sales_bycountry_table_column2();\n\n    String sales_bycountry_table_column3();\n\n    String sales_bycountry_table_column4();\n\n    String sales_bycountry_table_column5();\n\n    String sales_bycountry_table_column6();\n\n    String sales_bycountry_table_column7();\n\n    String sales_bycountry_table_column8();\n\n    String sales_bycountry_table_column9();\n\n    String sales_bydate_title();\n\n    String sales_bydate_area_title();\n\n    String sales_bydate_area_column1();\n\n    String sales_bydate_pie_years_title();\n\n    String sales_bydate_pie_years_column1();\n\n    String sales_bydate_pie_quarters_title();\n\n    String sales_bydate_pie_quarters_column1();\n\n    String sales_bydate_bar_weekday_title();\n\n    String sales_bydate_bar_weekday_column1();\n\n    String sales_bydate_pie_pipe_title();\n\n    String sales_bydate_pie_pipe_column1();\n\n    String sales_bydate_table_title();\n\n    String sales_bydate_table_column1();\n\n    String sales_bydate_table_column2();\n\n    String sales_bydate_table_column3();\n\n    String sales_bydate_table_column4();\n\n    String sales_bydate_table_column5();\n\n    String sales_bydate_table_column6();\n\n    String sales_bydate_table_column7();\n\n    String sales_bydate_table_column8();\n\n    String sales_bydate_table_column9();\n\n    String sales_bydate_selector_total();\n\n    String sales_goals_title();\n\n    String sales_goals_meter_title();\n\n    String sales_goals_meter_column1();\n\n    String sales_goals_line_title();\n\n    String sales_goals_line_column1();\n\n    String sales_goals_line_column2();\n\n    String sales_goals_line_column3();\n\n    String sales_goals_bar_byproduct_title();\n\n    String sales_goals_bar_byproduct_column1();\n\n    String sales_goals_bar_byproduct_column2();\n\n    String sales_goals_bar_byproduct_column3();\n\n    String sales_goals_bar_byempl_title();\n\n    String sales_goals_bar_byempl_column1();\n\n    String sales_goals_bar_byempl_column2();\n\n    String sales_goals_bubble_title();\n\n    String sales_goals_bubble_column1();\n\n    String sales_goals_bubble_column2();\n\n    String sales_goals_bubble_column3();\n\n    String sales_tablereports_title();\n\n    String sales_tablereports_tab_byyear();\n\n    String sales_tablereports_tab_bycountry();\n\n    String sales_tablereports_tab_byproduct();\n\n    String sales_tablereports_tab_bysalesman();\n\n    String sales_tablereports_all_title();\n\n    String sales_tablereports_all_column1();\n\n    String sales_tablereports_all_column2();\n\n    String sales_tablereports_all_column3();\n\n    String sales_tablereports_all_column4();\n\n    String sales_tablereports_all_column5();\n\n    String sales_tablereports_all_column6();\n\n    String sales_tablereports_all_column7();\n\n    String sales_tablereports_all_column8();\n\n    String sales_tablereports_all_column9();\n\n    String sales_tablereports_bycountry_title();\n\n    String sales_tablereports_bycountry_column1();\n\n    String sales_tablereports_bycountry_column2();\n\n    String sales_tablereports_bycountry_column3();\n\n    String sales_tablereports_bycountry_column4();\n\n    String sales_tablereports_bycountry_column5();\n\n    String sales_tablereports_bycountry_column6();\n\n    String sales_tablereports_byproduct_title();\n\n    String sales_tablereports_byproduct_column1();\n\n    String sales_tablereports_byproduct_column2();\n\n    String sales_tablereports_byproduct_column3();\n\n    String sales_tablereports_byproduct_column4();\n\n    String sales_tablereports_byproduct_column5();\n\n    String sales_tablereports_byproduct_column6();\n\n    String sales_tablereports_bysalesman_title();\n\n    String sales_tablereports_bysalesman_column1();\n\n    String sales_tablereports_bysalesman_column2();\n\n    String sales_tablereports_bysalesman_column3();\n\n    String sales_tablereports_bysalesman_column4();\n\n    String sales_tablereports_bysalesman_column5();\n\n    String sales_tablereports_bysalesman_column6();\n\n    String sales_tablereports_byyear_title();\n\n    String sales_tablereports_byyear_column1();\n\n    String sales_tablereports_byyear_column2();\n\n    String sales_tablereports_byyear_column3();\n\n    String sales_tablereports_byyear_column4();\n\n    String sales_tablereports_byyear_column5();\n\n    String sales_tablereports_byyear_column6();\n\n    String salesopps_displayers_by_pipeline_title();\n\n    String salesopps_displayers_by_status_title();\n\n    String salesopps_displayers_by_salesman_title();\n\n    String salesopps_displayers_by_exp_pipeline_title();\n\n    String salesopps_displayers_by_exp_pipeline_column1();\n\n    String salesopps_displayers_by_product_title();\n\n    String salesopps_displayers_by_product_column1();\n\n    String salesopps_displayers_by_country_title();\n\n    String salesopps_displayers_by_country_column1();\n\n    String salesopps_displayers_country_summary_title();\n\n    String salesopps_displayers_country_summary_column1();\n\n    String salesopps_displayers_country_summary_column2();\n\n    String salesopps_displayers_country_summary_column3();\n\n    String salesopps_displayers_country_summary_column4();\n\n    String salesopps_displayers_country_summary_column5();\n\n    String salesopps_displayers_country_summary_column6();\n\n    String salesopps_displayers_all_list_title();\n\n    String content_manager_dashboard();\n\n    String content_manager_dashboards();\n\n    String content_manager_noDashboards();\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/SalesOppsDisplayers.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.sales;\n\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\n\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A set of displayer definitions for the Sales Dashboard\n */\npublic class SalesOppsDisplayers {\n\n    public static final DisplayerSettings OPPS_BY_PIPELINE = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-pipeline\")\n            .dataset(SALES_OPPS)\n            .group(PIPELINE)\n            .column(PIPELINE, \"Pipeline\")\n            .column(COUNT, \"Number of opps\")\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_pipeline_title())\n            .titleVisible(false)\n            .width(500).height(300)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_STATUS = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-status\")\n            .dataset(SALES_OPPS)\n            .group(STATUS)\n            .column(STATUS, \"Status\")\n            .column(AMOUNT, SUM, \"Total amount\")\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_status_title())\n            .titleVisible(false)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_SALESMAN = DisplayerSettingsFactory.newPieChartSettings()\n            .uuid(\"opps-by-salesman\")\n            .dataset(SALES_OPPS)\n            .group(SALES_PERSON)\n            .column(SALES_PERSON, \"Sales person\")\n            .column(AMOUNT, SUM, \"Total amount\")\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_salesman_title())\n            .titleVisible(false)\n            .margins(10, 10, 10, 10)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_EXPECTED_PIPELINE = DisplayerSettingsFactory.newAreaChartSettings()\n            .uuid(\"opps-expected-pipeline\")\n            .dataset(SALES_OPPS)\n            .group(CLOSING_DATE).dynamic(24, DateIntervalType.MONTH, true)\n            .column(CLOSING_DATE, \"Closing date\")\n            .column(EXPECTED_AMOUNT, SUM, AppConstants.INSTANCE.salesopps_displayers_by_exp_pipeline_column1())\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_exp_pipeline_title())\n            .titleVisible(false)\n            .width(500).height(300)\n            .margins(20, 50, 100, 100)\n            .filterOn(true, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_PRODUCT = DisplayerSettingsFactory.newBarChartSettings()\n            .subType_Bar()\n            .uuid(\"opps-by-product\")\n            .dataset(SALES_OPPS)\n            .group(PRODUCT)\n            .column(PRODUCT, \"Product\")\n            .column(AMOUNT, SUM, AppConstants.INSTANCE.salesopps_displayers_by_product_column1())\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_product_title())\n            .titleVisible(false)\n            .margins(10, 50, 100, 100)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_BY_COUNTRY = DisplayerSettingsFactory.newBarChartSettings()\n            .subType_Bar()\n            .uuid(\"opps-by-country\")\n            .dataset(SALES_OPPS)\n            .group(COUNTRY)\n            .column(COUNTRY, \"Country\")\n            .column(AMOUNT, SUM, AppConstants.INSTANCE.salesopps_displayers_by_country_column1())\n            .title(AppConstants.INSTANCE.salesopps_displayers_by_country_title())\n            .titleVisible(false)\n            .margins(10, 80, 100, 100)\n            .filterOn(false, true, true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_COUNTRY_SUMMARY = DisplayerSettingsFactory.newTableSettings()\n            .uuid(\"opps-country-summary\")\n            .dataset(SALES_OPPS)\n            .group(COUNTRY)\n            .column(COUNTRY, AppConstants.INSTANCE.salesopps_displayers_country_summary_column1())\n            .column(AMOUNT, SUM, AppConstants.INSTANCE.salesopps_displayers_country_summary_column2())\n            .column(COUNT, AppConstants.INSTANCE.salesopps_displayers_country_summary_column3())\n            .column(AMOUNT, AVERAGE, AppConstants.INSTANCE.salesopps_displayers_country_summary_column4())\n            .column(AMOUNT, MIN, AppConstants.INSTANCE.salesopps_displayers_country_summary_column5())\n            .column(AMOUNT, MAX, AppConstants.INSTANCE.salesopps_displayers_country_summary_column6())\n            .title(AppConstants.INSTANCE.salesopps_displayers_country_summary_title())\n            .titleVisible(false)\n            .tablePageSize(20)\n            .tableColumnPickerEnabled(false)\n            .filterOff(true)\n            .refreshOn()\n            .buildSettings();\n\n    public static final DisplayerSettings OPPS_ALLOPPS_LISTING = DisplayerSettingsFactory.newTableSettings()\n            .uuid(\"opps-allopps-listing\")\n            .dataset(SALES_OPPS)\n            .title(AppConstants.INSTANCE.salesopps_displayers_all_list_title())\n            .titleVisible(false)\n            .tablePageSize(20)\n            .tableOrderEnabled(true)\n            .tableOrderDefault(AMOUNT, DESCENDING)\n            .tableColumnPickerEnabled(false)\n            .filterOn(true, true, true)\n            .refreshOn()\n            .buildSettings();\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesDistributionByCountry.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.sales.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\n\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A composite widget that represents an entire dashboard sample composed using an UI binder template.\n * <p>The dashboard itself is composed by a set of Displayer instances.</p>\n */\n@Dependent\npublic class SalesDistributionByCountry extends Composite implements GalleryWidget {\n\n    interface SalesDashboardBinder extends UiBinder<Widget, SalesDistributionByCountry>{}\n    private static final SalesDashboardBinder uiBinder = GWT.create(SalesDashboardBinder.class);\n\n    @UiField(provided = true)\n    Displayer bubbleByCountry;\n\n    @UiField(provided = true)\n    Displayer mapByCountry;\n\n    @UiField(provided = true)\n    Displayer tableAll;\n\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n\n    @Inject\n    public SalesDistributionByCountry(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.sales_bycountry_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return SALES_OPPS.equals(dataSetId);\n    }\n\n    @Override\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n\n    @PostConstruct\n    public void init() {\n\n        // Create the chart definitions\n\n        bubbleByCountry = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBubbleChartSettings()\n                .dataset(SALES_OPPS)\n                .group(COUNTRY)\n                .column(COUNTRY, \"Country\")\n                .column(COUNT, \"count\").format(AppConstants.INSTANCE.sales_bycountry_bubble_column1(), \"#,##0\")\n                .column(PROBABILITY, AVERAGE).format(AppConstants.INSTANCE.sales_bycountry_bubble_column2(), \"#,##0\")\n                .column(COUNTRY, \"Country\")\n                .column(EXPECTED_AMOUNT, SUM).expression(\"value/1000\").format(AppConstants.INSTANCE.sales_bycountry_bubble_column3(), \"$ #,##0 K\")\n                .title(AppConstants.INSTANCE.sales_bycountry_bubble_title())\n                .width(450).height(300)\n                .margins(20, 50, 50, 0)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        mapByCountry = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newMapChartSettings()\n                .dataset(SALES_OPPS)\n                .group(COUNTRY)\n                .column(COUNTRY, \"Country\")\n                .column(COUNT, \"Number of opportunities\")\n                .column(EXPECTED_AMOUNT, SUM).expression(\"value/1000\").format(AppConstants.INSTANCE.sales_bycountry_map_column1(), \"$ #,##0 K\")\n                .title(AppConstants.INSTANCE.sales_bycountry_map_title())\n                .width(450).height(290)\n                .margins(10, 10, 10, 10)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        tableAll = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .title(AppConstants.INSTANCE.sales_bycountry_table_title())\n                .titleVisible(true)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(AMOUNT, DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .column(COUNTRY, AppConstants.INSTANCE.sales_bycountry_table_column1())\n                .column(CUSTOMER, AppConstants.INSTANCE.sales_bycountry_table_column2())\n                .column(PRODUCT, AppConstants.INSTANCE.sales_bycountry_table_column3())\n                .column(SALES_PERSON, AppConstants.INSTANCE.sales_bycountry_table_column4())\n                .column(STATUS, AppConstants.INSTANCE.sales_bycountry_table_column5())\n                .column(CREATION_DATE, AppConstants.INSTANCE.sales_bycountry_table_column6())\n                .column(EXPECTED_AMOUNT, AppConstants.INSTANCE.sales_bycountry_table_column7())\n                .column(CLOSING_DATE, AppConstants.INSTANCE.sales_bycountry_table_column8())\n                .column(AMOUNT).expression(\"value/1000\").format(AppConstants.INSTANCE.sales_bycountry_table_column9(), \"$ #,##0 K\")\n                .filterOn(true, true, true)\n                .tableWidth(900)\n                .renderer(DefaultRenderer.UUID)\n                .buildSettings());\n\n        // Make that charts interact among them\n        displayerCoordinator.addDisplayer(bubbleByCountry);\n        displayerCoordinator.addDisplayer(mapByCountry);\n        displayerCoordinator.addDisplayer(tableAll);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesDistributionByCountry.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:my=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <g:VerticalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"bubbleByCountry\"/>\n      <my:Displayer ui:field=\"mapByCountry\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"tableAll\"/>\n    </g:HorizontalPanel>\n  </g:VerticalPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesExpectedByDate.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.sales.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSubType;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\nimport org.dashbuilder.renderer.client.DefaultRenderer;\n\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.date.DayOfWeek.*;\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A composite widget that represents an entire dashboard sample composed using an UI binder template.\n * <p>The dashboard itself is composed by a set of Displayer instances.</p>\n */\n@Dependent\npublic class SalesExpectedByDate extends Composite implements GalleryWidget {\n\n    interface SalesDashboardBinder extends UiBinder<Widget, SalesExpectedByDate>{}\n    private static final SalesDashboardBinder uiBinder = GWT.create(SalesDashboardBinder.class);\n\n    @UiField(provided = true)\n    Displayer areaChartByDate;\n\n    @UiField(provided = true)\n    Displayer pieChartYears;\n\n    @UiField(provided = true)\n    Displayer pieChartQuarters;\n\n    @UiField(provided = true)\n    Displayer barChartDayOfWeek;\n\n    @UiField(provided = true)\n    Displayer pieChartByPipeline;\n\n    @UiField(provided = true)\n    Displayer tableAll;\n\n    @UiField(provided = true)\n    Displayer countrySelector;\n\n    @UiField(provided = true)\n    Displayer customerSelector;\n\n    @UiField(provided = true)\n    Displayer salesmanSelector;\n\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n\n    @Inject\n    public SalesExpectedByDate(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.sales_bydate_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return SALES_OPPS.equals(dataSetId);\n    }\n\n    @Override\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n\n    @PostConstruct\n    public void init() {\n\n        // Create the chart definitions\n\n        areaChartByDate = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newAreaChartSettings()\n                .dataset(SALES_OPPS)\n                .group(CREATION_DATE).dynamic(30, QUARTER, true)\n                .column(CREATION_DATE, \"Creation date\")\n                .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_area_column1(), \"$ #,###\")\n                .title(AppConstants.INSTANCE.sales_bydate_area_title())\n                .titleVisible(true)\n                .width(700).height(200)\n                .margins(10, 100, 80, 50)\n                .xAxisAngle(45)\n                .filterOn(true, true, true)\n                .buildSettings());\n\n        pieChartYears = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newPieChartSettings()\n                .dataset(SALES_OPPS)\n                .group(CREATION_DATE).dynamic(YEAR, true)\n                .column(CREATION_DATE, \"Year\")\n                .column(COUNT, \"#occs\").format(AppConstants.INSTANCE.sales_bydate_pie_years_column1(), \"#,###\")\n                .title(AppConstants.INSTANCE.sales_bydate_pie_years_title())\n                .titleVisible(true)\n                .width(200).height(150)\n                .margins(0, 0, 0, 0)\n                .filterOn(false, true, false)\n                .buildSettings());\n\n        pieChartQuarters = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newPieChartSettings()\n                .dataset(SALES_OPPS)\n                .group(CREATION_DATE).fixed(QUARTER, true)\n                .column(CREATION_DATE, \"Creation date\")\n                .column(COUNT, \"#occs\").format(AppConstants.INSTANCE.sales_bydate_pie_quarters_column1(), \"#,###\")\n                .title(AppConstants.INSTANCE.sales_bydate_pie_quarters_title())\n                .titleVisible(true)\n                .width(200).height(150)\n                .margins(0, 0, 0, 0)\n                .filterOn(false, true, false)\n                .buildSettings());\n\n        barChartDayOfWeek = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBarChartSettings()\n                .subType_Bar()\n                .dataset(SALES_OPPS)\n                .group(CREATION_DATE).fixed(DAY_OF_WEEK, true).firstDay(SUNDAY)\n                .column(CREATION_DATE, \"Creation date\")\n                .column(COUNT, \"#occs\").format(AppConstants.INSTANCE.sales_bydate_bar_weekday_column1(), \"#,###\")\n                .title(AppConstants.INSTANCE.sales_bydate_bar_weekday_title())\n                .titleVisible(true)\n                .width(200).height(150)\n                .margins(0, 20, 80, 10)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n\n        pieChartByPipeline = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newPieChartSettings()\n                        .dataset(SALES_OPPS)\n                        .group(PIPELINE)\n                        .column(PIPELINE, \"Pipeline\")\n                        .column(COUNT, \"#opps\").format(AppConstants.INSTANCE.sales_bydate_pie_pipe_column1(), \"#,###\")\n                        .title(AppConstants.INSTANCE.sales_bydate_pie_pipe_title())\n                        .titleVisible(true)\n                        .width(200).height(150)\n                        .margins(0, 0, 0, 0)\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        tableAll = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                        .dataset(SALES_OPPS)\n                        .title(AppConstants.INSTANCE.sales_bydate_title())\n                        .titleVisible(false)\n                        .tablePageSize(10)\n                        .tableWidth(800)\n                        .tableOrderEnabled(true)\n                        .tableOrderDefault(AMOUNT, DESCENDING)\n                        .tableColumnPickerEnabled(false)\n                        .renderer(DefaultRenderer.UUID)\n                        .column(COUNTRY, AppConstants.INSTANCE.sales_bydate_table_column1())\n                        .column(CUSTOMER, AppConstants.INSTANCE.sales_bydate_table_column2())\n                        .column(PRODUCT, AppConstants.INSTANCE.sales_bydate_table_column3())\n                        .column(SALES_PERSON, AppConstants.INSTANCE.sales_bydate_table_column4())\n                        .column(STATUS, AppConstants.INSTANCE.sales_bydate_table_column5())\n                        .column(AMOUNT).format(AppConstants.INSTANCE.sales_bydate_table_column6(), \"$ #,###\")\n                        .column(EXPECTED_AMOUNT).format(AppConstants.INSTANCE.sales_bydate_table_column7(), \"$ #,###\")\n                        .column(CREATION_DATE).format(AppConstants.INSTANCE.sales_bydate_table_column8(), \"MMM dd, yyyy\")\n                        .column(CLOSING_DATE).format(AppConstants.INSTANCE.sales_bydate_table_column9(), \"MMM dd, yyyy\")\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        // Create the selectors\n\n        countrySelector = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .group(COUNTRY)\n                        .column(COUNTRY, \"Country\")\n                        .column(COUNT, \"#Opps\").format(\"#Opps\", \"#,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_selector_total(), \"$ #,##0.00\")\n                        .sort(COUNTRY, ASCENDING)\n                        .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n                        .width(150)\n                        .multiple(true)\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        salesmanSelector = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .group(SALES_PERSON)\n                        .column(SALES_PERSON, \"Employee\")\n                        .column(COUNT, \"#Opps\").format(\"#Opps\", \"#,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_selector_total(), \"$ #,##0.00\")\n                        .sort(SALES_PERSON, ASCENDING)\n                        .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n                        .width(150)\n                        .multiple(true)\n                        .filterOn(false, true, true)\n                        .buildSettings());\n\n        customerSelector = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newSelectorSettings()\n                        .dataset(SALES_OPPS)\n                        .group(CUSTOMER)\n                        .column(CUSTOMER, \"Customer\")\n                        .column(COUNT, \"#Opps\").format(\"#Opps\", \"#,###\")\n                        .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_bydate_selector_total(), \"$ #,##0.00\")\n                        .sort(CUSTOMER, ASCENDING)\n                        .subtype(DisplayerSubType.SELECTOR_DROPDOWN)\n                        .width(150)\n                        .multiple(true)\n                            .filterOn(false, true, true)\n                        .buildSettings());\n\n        // Make the displayers interact among them\n        displayerCoordinator.addDisplayer(areaChartByDate);\n        displayerCoordinator.addDisplayer(pieChartYears);\n        displayerCoordinator.addDisplayer(pieChartQuarters);\n        displayerCoordinator.addDisplayer(barChartDayOfWeek);\n        displayerCoordinator.addDisplayer(pieChartByPipeline);\n        displayerCoordinator.addDisplayer(tableAll);\n        displayerCoordinator.addDisplayer(countrySelector);\n        displayerCoordinator.addDisplayer(salesmanSelector);\n        displayerCoordinator.addDisplayer(customerSelector);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesExpectedByDate.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:my=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <ui:style>\n    .margin {\n      margin: 5px;\n    }\n  </ui:style>\n\n  <g:VerticalPanel>\n    <g:HorizontalPanel>\n      <g:VerticalPanel>\n        <g:FlowPanel addStyleNames=\"{style.margin}\">\n          <my:Displayer ui:field=\"countrySelector\"/>\n        </g:FlowPanel>\n        <g:FlowPanel addStyleNames=\"{style.margin}\">\n          <my:Displayer ui:field=\"salesmanSelector\"/>\n        </g:FlowPanel>\n        <g:FlowPanel addStyleNames=\"{style.margin}\">\n          <my:Displayer ui:field=\"customerSelector\"/>\n        </g:FlowPanel>\n      </g:VerticalPanel>\n      <my:Displayer ui:field=\"areaChartByDate\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"pieChartByPipeline\"/>\n      <my:Displayer ui:field=\"pieChartYears\"/>\n      <my:Displayer ui:field=\"pieChartQuarters\"/>\n      <my:Displayer ui:field=\"barChartDayOfWeek\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"tableAll\"/>\n    </g:HorizontalPanel>\n  </g:VerticalPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesGoals.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.sales.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\n\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.group.DateIntervalType.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A composite widget that represents an entire dashboard sample composed using an UI binder template.\n * <p>The dashboard itself is composed by a set of Displayer instances.</p>\n */\n@Dependent\npublic class SalesGoals extends Composite implements GalleryWidget {\n\n    interface SalesDashboardBinder extends UiBinder<Widget, SalesGoals>{}\n    private static final SalesDashboardBinder uiBinder = GWT.create(SalesDashboardBinder.class);\n\n    @UiField(provided = true)\n    Displayer meterChartAmount;\n\n    @UiField(provided = true)\n    Displayer lineChartByDate;\n\n    @UiField(provided = true)\n    Displayer barChartByProduct;\n\n    @UiField(provided = true)\n    Displayer barChartByEmployee;\n\n    @UiField(provided = true)\n    Displayer bubbleByCountry;\n\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n\n    @Inject\n    public SalesGoals(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n\n        // Create the chart definitions\n\n        meterChartAmount = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newMeterChartSettings()\n                .dataset(SALES_OPPS)\n                .column(AMOUNT, SUM, AppConstants.INSTANCE.sales_goals_meter_column1())\n                .expression(\"value/1000\")\n                .format(AppConstants.INSTANCE.sales_goals_meter_column1(), \"$ #,### K\")\n                .title(AppConstants.INSTANCE.sales_goals_meter_title())\n                .titleVisible(true)\n                .width(200).height(200)\n                .meter(0, 15000, 25000, 35000)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        lineChartByDate = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newLineChartSettings()\n                .dataset(SALES_OPPS)\n                .group(CLOSING_DATE).dynamic(60, MONTH, true)\n                .column(CLOSING_DATE).format(AppConstants.INSTANCE.sales_goals_line_column1())\n                .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_goals_line_column2(), \"$ #,### K\").expression(\"value/1000\")\n                .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.sales_goals_line_column3(), \"$ #,### K\").expression(\"value/1000\")\n                .title(AppConstants.INSTANCE.sales_goals_line_title())\n                .titleVisible(true)\n                .width(800).height(200)\n                .margins(10, 80, 80, 100)\n                .xAxisAngle(30)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        barChartByProduct = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBarChartSettings()\n                .subType_Column()\n                .dataset(SALES_OPPS)\n                .group(PRODUCT)\n                .column(PRODUCT).format(AppConstants.INSTANCE.sales_goals_bar_byproduct_column1())\n                .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_goals_bar_byproduct_column2(), \"$ #,### K\").expression(\"value/1000\")\n                .column(EXPECTED_AMOUNT, SUM).format(AppConstants.INSTANCE.sales_goals_bar_byproduct_column3(), \"$ #,### K\").expression(\"value/1000\")\n                .title(AppConstants.INSTANCE.sales_goals_bar_byproduct_title())\n                .titleVisible(true)\n                .width(400).height(150)\n                .margins(10, 80, 80, 10)\n                .xAxisAngle(30)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        barChartByEmployee = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBarChartSettings()\n                .subType_Column()\n                .dataset(SALES_OPPS)\n                .group(SALES_PERSON)\n                .column(SALES_PERSON).format(AppConstants.INSTANCE.sales_goals_bar_byempl_column1())\n                .column(AMOUNT, SUM).format(AppConstants.INSTANCE.sales_goals_bar_byempl_column2(), \"$ #,### K\").expression(\"value/1000\")\n                .sort(AMOUNT, DESCENDING)\n                .title(AppConstants.INSTANCE.sales_goals_bar_byempl_title())\n                .titleVisible(true)\n                .width(400).height(150)\n                .margins(10, 80, 80, 10)\n                .xAxisAngle(30)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        bubbleByCountry = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newBubbleChartSettings()\n                .dataset(SALES_OPPS)\n                .group(COUNTRY)\n                .column(COUNTRY, \"Country\")\n                .column(COUNT, \"#opps\").format(AppConstants.INSTANCE.sales_goals_bubble_column1(), \"#,###\")\n                .column(PROBABILITY, AVERAGE).format(AppConstants.INSTANCE.sales_goals_bubble_column2(), \"#,###\")\n                .column(COUNTRY, \"Country\")\n                .column(EXPECTED_AMOUNT, SUM).expression(\"value/1000\").format(AppConstants.INSTANCE.sales_goals_bubble_column3(), \"$ #,##0.00 K\")\n                .title(AppConstants.INSTANCE.sales_goals_bubble_title())\n                .width(550).height(250)\n                .margins(10, 30, 50, 0)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        // Make the charts interact among them\n        displayerCoordinator.addDisplayer(meterChartAmount);\n        displayerCoordinator.addDisplayer(lineChartByDate);\n        displayerCoordinator.addDisplayer(barChartByProduct);\n        displayerCoordinator.addDisplayer(barChartByEmployee);\n        displayerCoordinator.addDisplayer(bubbleByCountry);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.sales_goals_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return SALES_OPPS.equals(dataSetId);\n    }\n\n    @Override\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesGoals.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:my=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <g:VerticalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"meterChartAmount\"/>\n      <my:Displayer ui:field=\"bubbleByCountry\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"lineChartByDate\"/>\n    </g:HorizontalPanel>\n    <g:HorizontalPanel>\n      <my:Displayer ui:field=\"barChartByProduct\"/>\n      <my:Displayer ui:field=\"barChartByEmployee\"/>\n    </g:HorizontalPanel>\n  </g:VerticalPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesTableReports.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.sales.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.dashbuilder.client.gallery.GalleryWidget;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.client.Displayer;\nimport org.dashbuilder.displayer.client.DisplayerCoordinator;\nimport org.dashbuilder.dataset.group.DateIntervalType;\nimport org.dashbuilder.displayer.client.DisplayerLocator;\n\nimport static org.dashbuilder.shared.sales.SalesConstants.*;\nimport static org.dashbuilder.dataset.sort.SortOrder.*;\nimport static org.dashbuilder.dataset.group.AggregateFunctionType.*;\n\n/**\n * A composite widget that represents an entire dashboard sample composed using an UI binder template.\n * <p>The dashboard itself is composed by a set of Displayer instances.</p>\n */\n@Dependent\npublic class SalesTableReports extends Composite implements GalleryWidget {\n\n    interface SalesDashboardBinder extends UiBinder<Widget, SalesTableReports>{}\n    private static final SalesDashboardBinder uiBinder = GWT.create(SalesDashboardBinder.class);\n\n    @UiField(provided = true)\n    Displayer tableByProduct;\n\n    @UiField(provided = true)\n    Displayer tableBySalesman;\n\n    @UiField(provided = true)\n    Displayer tableByCountry;\n\n    @UiField(provided = true)\n    Displayer tableByYear;\n\n    @UiField(provided = true)\n    Displayer tableAll;\n\n    DisplayerCoordinator displayerCoordinator;\n    DisplayerLocator displayerLocator;\n\n    @Inject\n    public SalesTableReports(DisplayerCoordinator displayerCoordinator, DisplayerLocator displayerLocator) {\n        this.displayerCoordinator = displayerCoordinator;\n        this.displayerLocator = displayerLocator;\n    }\n\n    @Override\n    public String getTitle() {\n        return AppConstants.INSTANCE.sales_tablereports_title();\n    }\n\n    @Override\n    public void onClose() {\n        displayerCoordinator.closeAll();\n    }\n\n    @Override\n    public boolean feedsFrom(String dataSetId) {\n        return SALES_OPPS.equals(dataSetId);\n    }\n\n    @Override\n    public void redrawAll() {\n        displayerCoordinator.redrawAll();\n    }\n\n    @PostConstruct\n    public void init() {\n\n        // Create the chart definitions\n\n        tableAll = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .title(AppConstants.INSTANCE.sales_tablereports_all_title())\n                .titleVisible(true)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(AMOUNT, DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .column(COUNTRY, AppConstants.INSTANCE.sales_tablereports_all_column1())\n                .column(CUSTOMER, AppConstants.INSTANCE.sales_tablereports_all_column2())\n                .column(PRODUCT, AppConstants.INSTANCE.sales_tablereports_all_column3())\n                .column(SALES_PERSON, AppConstants.INSTANCE.sales_tablereports_all_column4())\n                .column(STATUS, AppConstants.INSTANCE.sales_tablereports_all_column5())\n                .column(CREATION_DATE, AppConstants.INSTANCE.sales_tablereports_all_column6())\n                .column(EXPECTED_AMOUNT, AppConstants.INSTANCE.sales_tablereports_all_column7())\n                .column(CLOSING_DATE, AppConstants.INSTANCE.sales_tablereports_all_column8())\n                .column(AMOUNT, AppConstants.INSTANCE.sales_tablereports_all_column9())\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        tableByCountry = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .group(COUNTRY)\n                .column(COUNTRY, AppConstants.INSTANCE.sales_tablereports_bycountry_column1())\n                .column(COUNT, AppConstants.INSTANCE.sales_tablereports_bycountry_column2())\n                .column(AMOUNT, MIN, AppConstants.INSTANCE.sales_tablereports_bycountry_column3())\n                .column(AMOUNT, MAX, AppConstants.INSTANCE.sales_tablereports_bycountry_column4())\n                .column(AMOUNT, AVERAGE, AppConstants.INSTANCE.sales_tablereports_bycountry_column5())\n                .column(AMOUNT, SUM, AppConstants.INSTANCE.sales_tablereports_bycountry_column6())\n                .title(AppConstants.INSTANCE.sales_tablereports_bycountry_title())\n                .titleVisible(false)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(\"Total\", DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        tableByProduct = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .group(PRODUCT)\n                .column(PRODUCT, AppConstants.INSTANCE.sales_tablereports_byproduct_column1())\n                .column(COUNT, AppConstants.INSTANCE.sales_tablereports_byproduct_column2())\n                .column(AMOUNT, MIN, AppConstants.INSTANCE.sales_tablereports_byproduct_column3())\n                .column(AMOUNT, MAX, AppConstants.INSTANCE.sales_tablereports_byproduct_column4())\n                .column(AMOUNT, AVERAGE, AppConstants.INSTANCE.sales_tablereports_byproduct_column5())\n                .column(AMOUNT, SUM, AppConstants.INSTANCE.sales_tablereports_byproduct_column6())\n                .title(AppConstants.INSTANCE.sales_tablereports_byproduct_title())\n                .titleVisible(false)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(\"Total\", DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        tableBySalesman = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .group(SALES_PERSON)\n                .column(SALES_PERSON, AppConstants.INSTANCE.sales_tablereports_bysalesman_column1())\n                .column(COUNT, AppConstants.INSTANCE.sales_tablereports_bysalesman_column2())\n                .column(AMOUNT, MIN, AppConstants.INSTANCE.sales_tablereports_bysalesman_column3())\n                .column(AMOUNT, MAX, AppConstants.INSTANCE.sales_tablereports_bysalesman_column4())\n                .column(AMOUNT, AVERAGE, AppConstants.INSTANCE.sales_tablereports_bysalesman_column5())\n                .column(AMOUNT, SUM, AppConstants.INSTANCE.sales_tablereports_bysalesman_column6())\n                .title(AppConstants.INSTANCE.sales_tablereports_bysalesman_title())\n                .titleVisible(false)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(\"Total\", DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        tableByYear = displayerLocator.lookupDisplayer(\n                DisplayerSettingsFactory.newTableSettings()\n                .dataset(SALES_OPPS)\n                .group(CREATION_DATE).dynamic(DateIntervalType.YEAR, true)\n                .column(CREATION_DATE, AppConstants.INSTANCE.sales_tablereports_byyear_column1())\n                .column(COUNT, AppConstants.INSTANCE.sales_tablereports_byyear_column2())\n                .column(AMOUNT, MIN, AppConstants.INSTANCE.sales_tablereports_byyear_column3())\n                .column(AMOUNT, MAX, AppConstants.INSTANCE.sales_tablereports_byyear_column4())\n                .column(AMOUNT, AVERAGE, AppConstants.INSTANCE.sales_tablereports_byyear_column5())\n                .column(AMOUNT, SUM, AppConstants.INSTANCE.sales_tablereports_byyear_column6())\n                .title(AppConstants.INSTANCE.sales_tablereports_byyear_title())\n                .titleVisible(false)\n                .tablePageSize(10)\n                .tableOrderEnabled(true)\n                .tableOrderDefault(\"Total\", DESCENDING)\n                .tableColumnPickerEnabled(false)\n                .filterOn(false, true, true)\n                .buildSettings());\n\n        // Make that charts interact among them\n        displayerCoordinator.addDisplayer(tableByCountry);\n        displayerCoordinator.addDisplayer(tableByProduct);\n        displayerCoordinator.addDisplayer(tableBySalesman);\n        displayerCoordinator.addDisplayer(tableByYear);\n        displayerCoordinator.addDisplayer(tableAll);\n\n        // Init the dashboard from the UI Binder template\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Draw the charts\n        displayerCoordinator.drawAll();\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/sales/widgets/SalesTableReports.ui.xml",
    "content": "<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:my=\"urn:import:org.dashbuilder.displayer.client\">\n\n  <ui:with field=\"i18n\" type=\"org.dashbuilder.client.resources.i18n.AppConstants\"/>\n\n  <g:VerticalPanel spacing=\"10\">\n    <g:HorizontalPanel spacing=\"10\">\n      <my:Displayer ui:field=\"tableAll\"/>\n    </g:HorizontalPanel>\n    <b:TabPanel>\n\n      <b:NavTabs>\n        <b:TabListItem active=\"true\" dataTarget=\"#strtab1\" text=\"{i18n.sales_tablereports_tab_byyear}\"/>\n        <b:TabListItem dataTarget=\"#strtab2\" text=\"{i18n.sales_tablereports_tab_bycountry}\"/>\n        <b:TabListItem dataTarget=\"#strtab3\" text=\"{i18n.sales_tablereports_tab_byproduct}\"/>\n        <b:TabListItem dataTarget=\"#strtab4\" text=\"{i18n.sales_tablereports_tab_bysalesman}\"/>\n      </b:NavTabs>\n      <b:TabContent>\n        <b:TabPane b:id=\"strtab1\" active=\"true\">\n          <g:FlowPanel>\n            <my:Displayer ui:field=\"tableByYear\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n        <b:TabPane b:id=\"strtab2\">\n          <g:FlowPanel>\n            <my:Displayer ui:field=\"tableByCountry\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n        <b:TabPane b:id=\"strtab3\">\n          <g:FlowPanel>\n            <my:Displayer ui:field=\"tableByProduct\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n        <b:TabPane b:id=\"strtab4\">\n          <g:FlowPanel>\n            <my:Displayer ui:field=\"tableBySalesman\"/>\n          </g:FlowPanel>\n        </b:TabPane>\n      </b:TabContent>\n    </b:TabPanel>\n  </g:VerticalPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/GalleryHomeScreen.html",
    "content": "<div>\n    <div style=\"width: 400px; padding: 20px; float: left;\">\n\n        <p id=\"paragraph1\">The gallery contains live examples of all the different displayer types supported in Dashbuilder. The node\n            \"Dashboards\" contains also a set of examples of how to combine several displayers into full featured\n            end user dashboards.</p>\n\n        <p id=\"paragraph2\">\n            <span id=\"span2a\">All the examples are built using the Dashbuilder's GWT Displayer API. If you are interested in the internals\n        or just want to see how the source code looks then take a look at the following</span>\n        <a id=\"gitHubLink\" target=\"_blank\" href=\"https://github.com/kiegroup/appformer/blob/main/dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/gallery/GalleryTree.java\">file</a>\n            <span id=\"span2b\">at GitHub.</span></p>\n    </div>\n    <div data-field=\"galleryImagePanel\" />\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/GalleryHomeScreen.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.ParagraphElement;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Image;\nimport org.dashbuilder.client.resources.AppResource;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@Templated\n@WorkbenchScreen(identifier=\"GalleryHomeScreen\")\npublic class GalleryHomeScreen extends Composite {\n\n    @Inject\n    @DataField\n    private FlowPanel galleryImagePanel;\n\n    @Inject\n    @DataField\n    private ParagraphElement paragraph1;\n\n    @Inject\n    @DataField\n    private SpanElement span2a;\n\n    @Inject\n    @DataField\n    private SpanElement span2b;\n\n    @Inject\n    @DataField\n    private AnchorElement gitHubLink;\n\n    @WorkbenchPartTitle\n    public String getScreenTitle() {\n        return AppConstants.INSTANCE.gallerytree_home();\n    }\n\n    @PostConstruct\n    void doLayout() {\n        Image image = new Image(AppResource.INSTANCE.images().barChartLogo());\n        galleryImagePanel.add(image);\n        paragraph1.setInnerText(AppConstants.INSTANCE.gallerytree_home_p1());\n        span2a.setInnerText(AppConstants.INSTANCE.gallerytree_home_s2a());\n        span2b.setInnerText(AppConstants.INSTANCE.gallerytree_home_s2b());\n        gitHubLink.setInnerText(AppConstants.INSTANCE.gallerytree_home_ghublink());\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/HomeScreen.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\n\nimport static org.dashbuilder.perspectives.PerspectiveIds.CONTENT_MANAGER;\nimport static org.dashbuilder.perspectives.PerspectiveIds.DATA_SETS;\nimport static org.dashbuilder.perspectives.PerspectiveIds.DATA_TRANSFER;\nimport static org.dashbuilder.perspectives.PerspectiveIds.GALLERY;\n\n@WorkbenchScreen(identifier = HomeScreen.ID)\npublic class HomeScreen {\n\n    public static final String ID = \"HomeScreen\";\n\n    @Inject\n    View view;\n\n    @Inject\n    PlaceManager placeManager;\n\n    public interface View extends UberElemental<HomeScreen> {\n\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @WorkbenchPartTitle\n    public String title() {\n        return \"Home Screen\";\n    }\n\n    @WorkbenchPartView\n    public View root() {\n        return view;\n    }\n\n    public void goToSample() {\n        go(GALLERY);\n    }\n\n    public void goToDataset() {\n        go(DATA_SETS);\n    }\n\n    public void goToDesign() {\n        go(CONTENT_MANAGER);\n    }\n\n    public void goToTransfer() {\n        go(DATA_TRANSFER);\n    }\n\n    public void go(String perspectiveId) {\n        placeManager.goTo(perspectiveId);\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/StaticChartScreen.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.dashbuilder.dataset.DataSetFactory;\nimport org.dashbuilder.displayer.DisplayerSettingsFactory;\nimport org.dashbuilder.displayer.DisplayerSettings;\nimport org.dashbuilder.displayer.client.widgets.DisplayerViewer;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnStartup;\n\nimport static org.dashbuilder.dataset.date.Month.*;\n\n@WorkbenchScreen(identifier = \"StaticChartScreen\")\npublic class StaticChartScreen {\n\n    public static final DisplayerSettings displayerSettings =\n            DisplayerSettingsFactory.newLineChartSettings()\n            .title(\"Sales Evolution Per Year\")\n            .column(\"month\", \"Month\")\n            .column(\"2013\", \"Sales in 2013\")\n            .column(\"2014\", \"Sales in 2014\")\n            .column(\"2015\", \"Sales in 2015\")\n            .dataset(DataSetFactory.newDataSetBuilder()\n                .label(\"month\")\n                .number(\"2013\")\n                .number(\"2014\")\n                .number(\"2015\")\n                .row(JANUARY, 1000d, 2000d, 3000d)\n                .row(FEBRUARY, 1400d, 2300d, 2000d)\n                .row(MARCH, 1300d, 2000d, 1400d)\n                .row(APRIL, 900d, 2100d, 1500d)\n                .row(MAY, 1300d, 2300d, 1600d)\n                .row(JUNE, 1010d, 2000d, 1500d)\n                .row(JULY, 1050d, 2400d, 3000d)\n                .row(AUGUST, 2300d, 2000d, 3200d)\n                .row(SEPTEMBER, 1900d, 2700d, 3000d)\n                .row(OCTOBER, 1200d, 2200d, 3100d)\n                .row(NOVEMBER, 1400d, 2100d, 3100d)\n                .row(DECEMBER, 1100d, 2100d, 4200d)\n                .buildDataSet())\n            .buildSettings();\n\n    DisplayerViewer displayerViewer;\n\n    @Inject\n    public StaticChartScreen(DisplayerViewer displayerViewer) {\n        this.displayerViewer = displayerViewer;\n    }\n\n    @OnStartup\n    public void init() {\n        displayerViewer.init(displayerSettings);\n        displayerViewer.draw();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Static Chart\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return displayerViewer;\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/view/HomeScreenView.html",
    "content": "<!--\n  Copyright 2020 Red Hat, Inc. and/or its affiliates.\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n        http://www.apache.org/licenses/LICENSE-2.0\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<div id=\"homePage\">\n    <div class=\"kie-page\">\n        <div data-field=\"container\"\n            class=\"kie-page__content kie-content--bg-image kie-blank-slate\">\n            <div\n                class=\"container-fluid kie-container-fluid--blank-slate\">\n                <div class=\"blank-slate-pf row\">\n                    <h1 data-i18n-key=\"title\">Welcome to\n                        Dashbuilder</h1>\n\n                    <p data-i18n-key=\"subTitle\">Dashbuilder offers\n                        tools to create Business Dashboards. Select a\n                        tool below to get started</p>\n                    <div class=\"blank-slate-pf-secondary-action\">\n                        <div class=\"kie-hero-card\" role=\"button\"\n                            data-field=\"card\" id=\"sampleAction\">\n                            <div\n                                class=\"kie-hero-card__icon kie-circle-icon kie-circle-icon--lg fa fa-cubes\"></div>\n                            <div class=\"kie-hero-card__text\">\n                                <h2>Samples</h2>\n\n                                <div>Explore Dashbuilder Gallery\n                                    to learn more about data displayers.</div>\n                            </div>\n                        </div>\n                        <div class=\"kie-hero-card\" role=\"button\"\n                            id=\"datasetsAction\">\n                            <div\n                                class=\"kie-hero-card__icon kie-circle-icon kie-circle-icon--lg fa fa-database\"></div>\n                            <div class=\"kie-hero-card__text\">\n                                <h2>Datasets</h2>\n\n                                <div>Create and edit source of\n                                    data that can be used to build\n                                    dashboards.</div>\n                            </div>\n                        </div>\n                        <div class=\"kie-hero-card\" role=\"button\"\n                            id=\"designAction\">\n                            <div\n                                class=\"kie-hero-card__icon kie-circle-icon kie-circle-icon--lg pficon pficon-blueprint\"></div>\n                            <div class=\"kie-hero-card__text\">\n                                <h2>Design</h2>\n\n                                <div>Build pages with charts and\n                                    metrics components.</div>\n                            </div>\n                        </div>\n                        <div class=\"kie-hero-card\" role=\"button\"\n                            id=\"transferAction\">\n                            <div data-field=\"icon\"\n                                class=\"kie-hero-card__icon kie-circle-icon kie-circle-icon--lg pficon pficon-import\"></div>\n                            <div class=\"kie-hero-card__text\">\n                                <h2>Data Transfer</h2>\n\n                                <div>Transfer content between\n                                    installations.</div>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/view/HomeScreenView.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.client.screens.view;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.dashbuilder.client.navigation.resources.i18n.NavigationConstants;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.dashbuilder.client.screens.HomeScreen;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\n@Templated\npublic class HomeScreenView implements HomeScreen.View {\n\n    private static final AppConstants i18n = AppConstants.INSTANCE;\n    \n    @Inject\n    @DataField \n    HTMLDivElement sampleAction;\n    \n    @Inject\n    @DataField \n    HTMLDivElement datasetsAction;\n    \n    @Inject\n    @DataField \n    HTMLDivElement designAction;\n    \n    @Inject\n    @DataField \n    HTMLDivElement transferAction;\n\n    @Inject\n    @DataField\n    HTMLDivElement homePage;\n    \n    private HomeScreen presenter;\n\n    @Override\n    public void init(HomeScreen presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return homePage;\n    }\n    \n    @EventHandler(\"sampleAction\")\n    public void onSampleAction(ClickEvent e) {\n        presenter.goToSample();\n    }\n    \n    @EventHandler(\"datasetsAction\")\n    public void onDatasetsAction(ClickEvent e) {\n        presenter.goToDataset();\n        \n    }\n    \n    @EventHandler(\"designAction\")\n    public void onDesignAction(ClickEvent e) {\n        presenter.goToDesign();\n    }\n    \n    @EventHandler(\"transferAction\")\n    public void onTransferAction(ClickEvent e) {\n        presenter.goToTransfer();\n    }\n\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/screens/view/HomeScreenView.less",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@import \"/org/uberfire/client/views/static/uberfire-variables.less\";\n#homePage {\n\n  height: 100%;\n\n  .kie-circle-icon--md {\n    font-size: 3em;\n  }\n\n  .kie-circle-icon--lg {\n    font-size: 4em;\n  }\n\n  .kie-page {\n    align-items: stretch;\n    display: flex;\n    justify-content: space-between;\n    flex-flow: column nowrap;\n    height: 100%;\n    max-height: 100vh;\n  }\n  .kie-page__content {\n    flex: 1 1 auto;\n  }\n  .kie-page__masthead,\n  .kie-page__footer {\n    flex: 0 0 auto;\n  }\n  .kie-content--bg-image {\n    background-image: url('./images/dashbuilder_home_bg.jpg');\n    background-color: @color-pf-black-700;\n    background-position: top center;\n    background-size: cover;\n    .blank-slate-pf {\n      background-color: transparent;\n      color: @color-pf-black-300;\n      border: 0;\n    }\n    .kie-circle-icon {\n      background-color: transparent;\n    }\n\n  }\n  .kie-container-fluid--blank-slate {\n    @media (min-width: @screen-md-min) {\n      width: 100%;\n      background-color: rgba(0, 0, 0, .2);\n    }\n  }\n  .kie-blank-slate {\n    display: flex;\n    @media (min-width: @screen-md-min) {\n      align-items: center;\n    }\n  }\n  .blank-slate-pf-secondary-action {\n    display: flex;\n    flex-direction: column;\n    flex-wrap: wrap;\n    > *:not(:last-child) {\n      margin-bottom: @pf-spacer-lg;\n    }\n    @media (min-width: @screen-md-min) {\n      flex-direction: row;\n      flex-grow: 1;\n      justify-content: center;\n      align-items: stretch;\n      flex-wrap: nowrap;\n      > *:not(:last-child) {\n        margin-bottom: 0;\n        border-right: 1px solid @color-pf-white;\n      }\n    }\n  }\n\n  .kie-hero-card {\n    height: 210px;\n    display: flex;\n    flex-direction: row;\n    flex-wrap: wrap;\n    justify-content: center;\n    align-items: center;\n    padding-top: @pf-spacer-md;\n\n    & + .kie-hero-card {\n      border-left: 0;\n    }\n    @media (min-width: @screen-md-min) {\n      flex: 0 0 24em;\n      flex-direction: column;\n      flex-wrap: nowrap;\n      justify-content: space-between;\n      align-items: center;\n      padding-left: @pf-spacer-xxxl;\n      padding-right: @pf-spacer-xxxl;\n\n    }\n    &:hover, &:focus, &:active {\n      .kie-hero-card__icon {\n        background-color: @brand-primary;\n        color: @color-pf-white;\n      }\n    }\n  }\n\n  .kie-hero-card__icon {\n    margin-right: @pf-spacer-md;\n    .kie-circle-icon--md;\n    @media (min-width: @screen-md-min) {\n      margin-right: 0;\n      .kie-circle-icon--lg;\n    }\n  }\n\n  .kie-hero-card__text {\n    flex: 3 0;\n    text-align: left;\n    width: 230px;\n    @media (min-width: @screen-md-min) {\n      flex: 1 1 ;\n      text-align: center;\n    }\n  }\n\n  .kie-hero-card__action {\n    display: flex;\n    flex: 1 1 100%;\n    align-items: center;\n    margin-bottom: @grid-gutter-width;\n    @media (min-width: @screen-xs-min) {\n      flex: 1 1;\n      align-items: flex-end;\n      width: auto;\n      margin-bottom: 0;\n\n    }\n    @media (min-width: @screen-sm-min) {\n      margin-top: @grid-gutter-width;\n    }\n  }\n\n  .kie-circle-icon {\n    background-color: @alert-info-bg;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    font-size: 1.5rem;\n    height: 1.75em;\n    width: 1.75em;\n    border-radius: 50%;\n    &:hover {\n      background-color: @color-pf-black-600;\n      color: @color-pf-white;\n    }\n  }\n\n  .kie-circle-icon--md {\n    font-size: 3em;\n  }\n\n  .kie-circle-icon--lg {\n    font-size: 4em;\n  }\n\n  .kie-hero-card__link {\n    font-weight: bold;\n  }\n\n  .kie-hero-card__link.disabled {\n    pointer-events: none;\n    font-weight: normal;\n    color: #d1d1d1;\n  }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/client/security/PermissionTreeSetup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.dashbuilder.client.security;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.dashbuilder.client.cms.resources.i18n.ContentManagerI18n;\nimport org.dashbuilder.client.resources.i18n.AppConstants;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralPerspective;\n\nimport static org.dashbuilder.perspectives.PerspectiveIds.*;\n\n/**\n * This is an example of how to customize some of the permission tree nodes.\n */\n@ApplicationScoped\npublic class PermissionTreeSetup {\n\n    private PerspectiveTreeProvider perspectiveTreeProvider;\n    private AppConstants i18n = AppConstants.INSTANCE;\n    private ContentManagerI18n cmsI18n;\n\n    public PermissionTreeSetup() {\n    }\n\n    @Inject\n    public PermissionTreeSetup(PerspectiveTreeProvider perspectiveTreeProvider, ContentManagerI18n cmsI18n) {\n        this.perspectiveTreeProvider = perspectiveTreeProvider;\n        this.cmsI18n = cmsI18n;\n    }\n\n    public void configureTree() {\n        perspectiveTreeProvider.setPerspectiveName(HOME, i18n.menu_home());\n        perspectiveTreeProvider.setPerspectiveName(DATA_SETS, i18n.menu_dataset_authoring());\n        perspectiveTreeProvider.setPerspectiveName(GALLERY, i18n.menu_gallery());\n        perspectiveTreeProvider.setPerspectiveName(CONTENT_MANAGER, i18n.menu_content_manager());\n        perspectiveTreeProvider.setPerspectiveName(SECURITY, i18n.menu_security());\n        perspectiveTreeProvider.setPerspectiveName(SALES_DASHBOARD, i18n.menu_dashboards_salesdb());\n        perspectiveTreeProvider.setPerspectiveName(SALES_REPORTS, i18n.menu_dashboards_salesreports());\n\n        // Exclude some perspectives\n        perspectiveTreeProvider.excludePerspectiveId(\"StandaloneEditorPerspective\"); /* uberfire */\n        perspectiveTreeProvider.excludePerspectiveId(APPS); /* uberfire */\n        perspectiveTreeProvider.excludePerspectiveId(PLUGINS); /* uberfire */\n        perspectiveTreeProvider.excludePerspectiveId(AdminPagePerspective.IDENTIFIER); /* uberfire */\n        perspectiveTreeProvider.excludePerspectiveId(PreferencesCentralPerspective.IDENTIFIER); /* uberfire */\n\n        // Rename perspective to dashboard in CMS\n        //perspectiveTreeProvider.setResourceName(cmsI18n.capitalizeFirst(cmsI18n.getPerspectiveResourceName()));\n    }\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/shared/dashboard/events/DashboardDeletedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.shared.dashboard.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * @deprecated Since version 0.7, dashboards are created from the Content Manager perspective. This class is\n * still needed in order to deal with old dashboards created from existing installations.\n */\n@Portable\npublic class DashboardDeletedEvent {\n\n    private String dashboardId;\n    private String dashboardName;\n\n    public DashboardDeletedEvent() {\n    }\n\n    public DashboardDeletedEvent(String dashboardId, String dashboardName) {\n        this.dashboardId = dashboardId;\n        this.dashboardName = dashboardName;\n    }\n\n    public String getDashboardId() {\n        return dashboardId;\n    }\n\n    public String getDashboardName() {\n        return dashboardName;\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/java/org/dashbuilder/shared/sales/SalesConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.shared.sales;\n\npublic interface SalesConstants {\n\n    String SALES_OPPS = \"salesOpportunities\";\n    String AMOUNT = \"amount\";\n    String CREATION_DATE = \"creationDate\";\n    String CLOSING_DATE = \"closingDate\";\n    String PIPELINE = \"pipeline\";\n    String STATUS = \"status\";\n    String CUSTOMER = \"customer\";\n    String COUNTRY = \"country\";\n    String PRODUCT = \"product\";\n    String SALES_PERSON = \"salesPerson\";\n    String PROBABILITY = \"probability\";\n    String SOURCE = \"source\";\n    String EXPECTED_AMOUNT = \"expectedAmount\";\n    String COLOR = \"color\";\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\nerrai.security.user_on_hostpage_enabled=true\nerrai.marshalling.serializableTypes=org.dashbuilder.dataprovider.StaticProviderType \\\n                                    org.dashbuilder.dataprovider.BeanProviderType \\\n                                    org.dashbuilder.dataprovider.CSVProviderType \\\n                                    org.dashbuilder.dataprovider.SQLProviderType \\\n                                    org.dashbuilder.dataprovider.PrometheusProviderType \\\n                                    org.dashbuilder.dataset.ColumnType \\\n                                    org.dashbuilder.dataset.ColumnType \\\n                                    org.dashbuilder.dataset.DataSetLookup \\\n                                    org.dashbuilder.dataset.backend.EditDataSetDef \\\n                                    org.dashbuilder.dataset.date.DayOfWeek \\\n                                    org.dashbuilder.dataset.date.Month \\\n                                    org.dashbuilder.dataset.date.Quarter \\\n                                    org.dashbuilder.dataset.date.TimeAmount \\\n                                    org.dashbuilder.dataset.date.TimeFrame \\\n                                    org.dashbuilder.dataset.date.TimeInstant \\\n                                    org.dashbuilder.dataset.def.DataSetDef \\\n                                    org.dashbuilder.dataset.def.BeanDataSetDef \\\n                                    org.dashbuilder.dataset.def.CSVDataSetDef \\\n                                    org.dashbuilder.dataset.def.SQLDataSetDef \\\n                                    org.dashbuilder.dataset.def.SQLDataSourceDef \\\n                                    org.dashbuilder.dataset.def.StaticDataSetDef \\\n                                    org.dashbuilder.dataset.def.PrometheusDataSetDef \\\n                                    org.dashbuilder.dataset.def.DataColumnDef \\\n                                    org.dashbuilder.dataset.events.DataSetDefModifiedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetDefRegisteredEvent \\\n                                    org.dashbuilder.dataset.events.DataSetDefRemovedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetModifiedEvent \\\n                                    org.dashbuilder.dataset.events.DataSetPushingEvent \\\n                                    org.dashbuilder.dataset.events.DataSetPushOkEvent \\\n                                    org.dashbuilder.dataset.events.DataSetStaleEvent \\\n                                    org.dashbuilder.dataset.exception.DataSetLookupException \\\n                                    org.dashbuilder.dataset.filter.CoreFunctionFilter \\\n                                    org.dashbuilder.dataset.filter.CoreFunctionType \\\n                                    org.dashbuilder.dataset.filter.DataSetFilter \\\n                                    org.dashbuilder.dataset.filter.LogicalExprFilter \\\n                                    org.dashbuilder.dataset.filter.LogicalExprType \\\n                                    org.dashbuilder.dataset.group.AggregateFunctionType \\\n                                    org.dashbuilder.dataset.group.ColumnGroup \\\n                                    org.dashbuilder.dataset.group.DataSetGroup \\\n                                    org.dashbuilder.dataset.group.DateIntervalType \\\n                                    org.dashbuilder.dataset.group.GroupFunction \\\n                                    org.dashbuilder.dataset.group.GroupStrategy \\\n                                    org.dashbuilder.dataset.group.Interval \\\n                                    org.dashbuilder.dataset.impl.DataColumnImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetBuilderImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetLookupBuilderImpl \\\n                                    org.dashbuilder.dataset.impl.DataSetMetadataImpl \\\n                                    org.dashbuilder.dataset.sort.ColumnSort \\\n                                    org.dashbuilder.dataset.sort.DataSetSort \\\n                                    org.dashbuilder.dataset.sort.SortedList \n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/app.html.template",
    "content": "<!DOCTYPE html>\n<html>\n<head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <title>Dashbuilder Showcase</title>\n</head>\n<body>\n<iframe id=\"__gwt_historyFrame\" style=\"width: 0; height: 0; border: 0\"></iframe>\n<script type=\"text/javascript\">\n  var current_user = { name:\"@{name}\", roles:[@{roles}] }\n</script>\n<!--add loading indicator while the app is being loaded-->\n<div id=\"loading\">\n    <div class=\"loading-indicator\">\n        <img src=\"images/loading-icon.gif\" width=\"32\" height=\"32\" style=\"margin-right: 8px; float: left; vertical-align: top;\"/>\n        Please wait<br/><span id=\"loading-msg\">Loading application...</span>\n    </div>\n</div>\n\n<!-- The GWT js file generated at run time -->\n<script type=\"text/javascript\" src='org.dashbuilder.DashbuilderShowcase.nocache.js'></script>\n\n</body>\n</html>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/application-roles.properties",
    "content": "admin=admin\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/application-users.properties",
    "content": "admin=207b6e0cc556d7084b5e2db7d822555c\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.dashbuilder\" level=\"info\"/>\n\n  <root level=\"warn\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/DashbuilderShowcase.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.ext.widgets.core.UberfireWidgetsCore\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFlyTheme\"/>\n\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginClient\"/>\n  <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementWorkbench\"/>\n  <inherits name=\"org.uberfire.ext.preferences.UberfirePreferences\"/>\n  <inherits name=\"org.uberfire.ssh.UberfireSSHClient\"/>\n\n  <!-- Experimental -->\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalAPI\"/>\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n  <inherits name=\"org.dashbuilder.DashbuilderKieServerAPI\"/>\n  <inherits name=\"org.dashbuilder.DashbuilderClientAll\"/>\n  <inherits name=\"org.dashbuilder.DashbuilderKieServerClient\"/>\n  <inherits name=\"org.dashbuilder.DisplayerEditor\"/>\n  <inherits name=\"org.dashbuilder.renderer.ChartJsRenderer\"/>\n  <inherits name=\"org.dashbuilder.renderer.C3Renderer\"/>\n  \n  <source path='client'/>\n  <source path='shared'/>\n\n  <extend-property name=\"locale\" values=\"es\"/>\n  <extend-property name=\"locale\" values=\"fr\"/>\n  <extend-property name=\"locale\" values=\"ja\"/>\n  <extend-property name=\"locale\" values=\"pt_BR\"/>\n  <extend-property name=\"locale\" values=\"zh_CN\"/>\n  <extend-property name=\"locale\" values=\"de\"/>\n  <extend-property name=\"locale\" values=\"ru\"/>\n  <extend-property name=\"locale\" values=\"it\"/>\n\n  <collapse-property name=\"locale\" values=\"*\"/>\n\n  <!-- We don't need to support IE10 or older -->\n  <!-- There is no \"ie11\" permutation. IE11 uses the Firefox one (gecko1_8) -->\n  <set-property name=\"user.agent\" value=\"gecko1_8,safari\"/>\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/FastCompiledDashbuilderShowcase.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module rename-to=\"org.dashbuilder.DashbuilderShowcase\">\n\n  <inherits name=\"org.dashbuilder.DashbuilderShowcase\"/>\n\n  <set-property name=\"user.agent\" value=\"gecko1_8,safari\"/>\n  <set-property name=\"locale\" value=\"default\"/>\n\n  <collapse-all-properties />\n\n</module>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nlogoBannerError=Failed to load banner.\nlogOut=Log Out\nrole=Role\nmenu_home=Home\nmenu_gallery=Gallery\nmenu_administration=Administration\nmenu_security=Security\nmenu_dataset_authoring=Data Sets\nmenu_content_manager=Content Manager\nmenu_extensions_apps=Apps\nmenu_dashboards=Dashboards\nmenu_dashboards_salesdb=Sales Dashboard\nmenu_dashboards_salesreports=Sales Reports\nmenu_dashboards_new=- New -\n\nhome_intro=Dashbuilder is a general purpose dashboard and reporting web app which allows for:\nhome_upcoming=Upcoming features\n\nhome_feature1=Visual configuration and personalization of dashboards\nhome_feature2=Support for different types of visualizations using several charting libraries\nhome_feature3=UI editor for the creation of data sets definitions\nhome_feature4=Full featured editor for the definition of chart visualizations\nhome_feature5=Definition of interactive report tables\nhome_feature6=Data extraction from external systems, through different protocols\nhome_feature7=Support for both analytics and real-time dashboards\nhome_feature8=New renderers based on D3 JS & Lienzo GWT\nhome_feature9=Hierarchical (nested group) displayer types: Tree & Pie\nhome_feature10=Support for multiple data series\nhome_feature11=Rich mobility support\nhome_feature12=Alerts and SLA configuration\nhome_feature13=RESTful API\n\nhome_arch=Architecture\nhome_arch1=Not tied to any chart rendering technology. Pluggable renderers.\nhome_arch2=No tied to any data storage.\nhome_arch3=Ability to read data from: CSV files, Databases or Java generators.\nhome_arch4=Decoupled client & server layers. Ability to build pure lightweight client dashboards.\nhome_arch5=Ability to push & handle data sets on client for better performance.\nhome_arch6a=Based on\nhome_arch6b=, a framework for building rich workbench styled apps on the web.\n\nhome_furtherinfo=For further information, please visit the project web site\nhome_license=Licensed under the Apache License, Version 2.0\n\nnotification_dashboard_created={0} dashboard created\nnotification_dashboard_deleted={0} dashboard deleted\n\ndashboard_new_displayer=New displayer\ndashboard_delete_popup_title=Delete dashboard\ndashboard_delete_popup_content=Are you sure you want to delete this dashboard?\ndashboard_delete_dashboard=Delete dashboard\n\nsalesdbpersp_salessummary=Sales summary\nsalesreportspersp_salesreports=Sales reports\n\nexpensesdb_title=Expense reports\n\nexpensesdb_tab_exp_evolution=Expenses evolution\nexpensesdb_tab_by_employee=By employee\nexpensesdb_tab_all_exp=All expenses\nexpensesdb_pie_title=Expenses by Office\nexpensesdb_pie_column1=Office\nexpensesdb_pie_column2=Department\nexpensesdb_pie_column3=Employee\nexpensesdb_bar_title=Expenses by Department\nexpensesdb_bar_column1=Total Amount\nexpensesdb_bubble_title=Expenses by Employee\"\nexpensesdb_bubble_column1=Total\nexpensesdb_bubble_column2=Average\nexpensesdb_bubble_column3=Employee\nexpensesdb_bubble_column4=Number of expense reports\nexpensesdb_line_title=Expenses evolution\nexpensesdb_line_column1=Total Amount\nexpensesdb_table_title=List of expense reports\nexpensesdb_table_column1=Office\nexpensesdb_table_column2=Department\nexpensesdb_table_column3=Employee\nexpensesdb_table_column4=Amount\nexpensesdb_table_column5=Date\n\ngallerytree_home=Gallery\ngallerytree_home_p1=The gallery contains live examples of all the different displayer types supported in Dashbuilder. The node \"Dashboards\" contains also a set of examples of how to combine several displayers into full featured end user dashboards.\ngallerytree_home_s2a=All the examples are built using the Dashbuilder's GWT Displayer API. If you're interested in the internals or just want to see how the source code looks then take a look at the following\ngallerytree_home_s2b=at GitHub.\ngallerytree_home_ghublink=file\ngallerytree_title=Gallery Tree\ngallerytree_bar=Bar Chart\ngallerytree_bar_horiz=Horizontal\ngallerytree_bar_horiz_title=By Product\ngallerytree_bar_horiz_column1=Total amount\ngallerytree_bar_vert=Vertical\ngallerytree_bar_vert_title=By Product\ngallerytree_bar_vert_column1=Total amount\ngallerytree_bar_vert_dd=Drill-down\ngallerytree_bar_vert_dd_title=By Pipeline/Status/Sales person\ngallerytree_bar_vert_dd_column1=Total amount\ngallerytree_bar_vert_dd_column2=Total amount\ngallerytree_bar_vert_dd_column3=Total amount\ngallerytree_bar_multi=Multiple\ngallerytree_bar_stacked=Stacked\ngallerytree_bar_multi_title=By Country (min/max/avg)\ngallerytree_bar_multi_column1=Min\ngallerytree_bar_multi_column2=Max\ngallerytree_bar_multi_column3=Avg\ngallerytree_pie=Pie Chart\ngallerytree_pie_basic=Basic\ngallerytree_pie_basic_title=By Status\ngallerytree_pie_basic_column1=Total amount\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=By Status\ngallerytree_pie_3d_column1=Total amount\ngallerytree_pie_donut=Donut\ngallerytree_pie_donut_title=By Status\ngallerytree_pie_donut_column1=Total amount\ngallerytree_pie_dd=Drill-down\ngallerytree_pie_dd_title=By Pipeline/Status/Sales person\ngallerytree_pie_dd_column1=Total amount\ngallerytree_pie_dd_column2=Total amount\ngallerytree_pie_dd_column3=Total amount\ngallerytree_line=Line Chart\ngallerytree_line_basic=Basic\ngallerytree_line_basic_title=Sales opportunities evolution\ngallerytree_line_basic_column1=Closing date\ngallerytree_line_basic_column2=Total amount\ngallerytree_line_multi=Multiple\ngallerytree_line_multi_title=By Country (min/max/avg)\ngallerytree_line_multi_column1=Min\ngallerytree_line_multi_column2=Max\ngallerytree_line_multi_column3=Avg\ngallerytree_line_multi_static=Multiple (static)\ngallerytree_line_multi_static_title=Sales Evolution Per Year\ngallerytree_line_multi_static_column1=Sales in 2014\ngallerytree_line_multi_static_column2=Sales in 2015\ngallerytree_line_multi_static_column3=Sales in 2016\ngallerytree_area=Area Chart\ngallerytree_area_basic=Basic\ngallerytree_area_basic_title=Expected Pipeline\ngallerytree_area_basic_column1=Expected amount\ngallerytree_area_fixed=Fixed (per month)\ngallerytree_area_fixed_title=Pipeline (best month)\ngallerytree_area_fixed_column1=Closing date\ngallerytree_area_fixed_column2=Expected amount per month\ngallerytree_area_dd=Drill-down\ngallerytree_area_dd_title=Expected Pipeline\ngallerytree_area_dd_column1=Closing date\ngallerytree_area_dd_column2=Expected amount\ngallerytree_bubble=Bubble Chart\ngallerytree_bubble_basic=Basic\ngallerytree_bubble_basic_title=Opportunities distribution by Country\ngallerytree_bubble_basic_column1=Number of opportunities\ngallerytree_bubble_basic_column2=Average probability\ngallerytree_bubble_basic_column3=Expected amount\ngallerytree_bubble_basic_column4=Country\ngallerytree_meter=Meter Chart\ngallerytree_meter_basic=Basic\ngallerytree_meter_basic_title=Sales goal\ngallerytree_meter_basic_column1=Total amount\ngallerytree_meter_multi=Multiple\ngallerytree_meter_multi_title=Expected amount per year\ngallerytree_meter_multi_column1=Total amount\ngallerytree_meter_multi_static=Multiple (static)\ngallerytree_meter_multi_static_title=Heart rate\ngallerytree_meter_multi_static_column1=Person\ngallerytree_meter_multi_static_column2=Heart rate\ngallerytree_metrics=Metrics\ngallerytree_metrics_basic=Basic\ngallerytree_metrics_basic_title=Sales (current quarter)\ngallerytree_metrics_basic_column1=Sales (current quarter)\ngallerytree_metrics_basic_static=Basic (static)\ngallerytree_metrics_basic_static_title=Tweets!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Map\ngallerytree_map_region=Markers\ngallerytree_map_region_title=By Country\ngallerytree_map_region_column1=Total amount\ngallerytree_map_marker=Regions\ngallerytree_map_marker_title=By Country\ngallerytree_map_marker_column1=Total amount\ngallerytree_table=Table report\ngallerytree_table_basic=Basic\ngallerytree_table_basic_title=List of Opportunities\ngallerytree_table_basic_column1=Country\ngallerytree_table_basic_column2=Customer\ngallerytree_table_basic_column3=Product\ngallerytree_table_basic_column4=Salesman\ngallerytree_table_basic_column5=Status\ngallerytree_table_basic_column6=Source\ngallerytree_table_basic_column7=Creation\ngallerytree_table_basic_column8=Expected\ngallerytree_table_basic_column9=Closing\ngallerytree_table_basic_column10=Amount\ngallerytree_table_filtered=Filtered\ngallerytree_table_filtered_title=Opportunities in USA & Brazil\ngallerytree_table_filtered_column1=Customer\ngallerytree_table_filtered_column2=Product\ngallerytree_table_filtered_column3=Status\ngallerytree_table_filtered_column4=Source\ngallerytree_table_filtered_column5=Creation\ngallerytree_table_filtered_column6=Expected\ngallerytree_table_filtered_column7=Closing\ngallerytree_table_filtered_column8=Amount\ngallerytree_table_grouped=Grouped\ngallerytree_table_grouped_title=Country Summary\ngallerytree_table_grouped_column1=Country\ngallerytree_table_grouped_column2=#Opps\ngallerytree_table_grouped_column3=Min\ngallerytree_table_grouped_column4=Max\ngallerytree_table_grouped_column5=Average\ngallerytree_table_grouped_column6=Total\ngallerytree_table_default_dd=Default (drill-down)\ngallerytree_table_default_dd_title=List of Opportunities\ngallerytree_table_default_dd_column1=Country\ngallerytree_table_default_dd_column2=Customer\ngallerytree_table_default_dd_column3=Product\ngallerytree_table_default_dd_column4=Salesman\ngallerytree_table_default_dd_column5=Status\ngallerytree_table_default_dd_column6=Source\ngallerytree_table_default_dd_column7=Creation\ngallerytree_table_default_dd_column8=Expected\ngallerytree_table_default_dd_column9=Closing\ngallerytree_table_default_dd_column10=Amount\ngallerytree_selector=Selector\ngallerytree_selector_dropdown=Drop down\ngallerytree_selector_labels=Labels\ngallerytree_selector_slider=Slider\ngallerytree_db=Dashboards\ngallerytree_db_salesgoals=Sales goals\ngallerytree_db_salespipe=Sales pipeline\ngallerytree_db_salespcountry=Sales per country\ngallerytree_db_salesreps=Sales reports\ngallerytree_db_expreps=Expense reports\ngallerytree_db_clustermetrics=Cluster metrics\ngallerywidget_unknown=Unknown gallery widget:\ngallerywidget_dataset_modif=The data set has been modified. Refreshing the view ...\ngallerywidget_dataset_loaded=Data set loaded from server [{0}, {1} Kb]\n\nmetrics_server_detail_title=Server metrics (Vertical)\nmetrics_server_detail_backbutton_tt=Go back\nmetrics_server_detail_modebutton_tt_viewtable=View as table\nmetrics_server_detail_modebutton_tt_viewcharts=View as charts\nmetrics_server_detail_lasthour_summary=Last hour summary\nmetrics_server_detail_cpu_usage=CPU usage (%)\nmetrics_server_detail_mem_usage=Memory usage (Gb)\nmetrics_server_detail_netw_usage=Network usage (kbps)\nmetrics_server_detail_disk_usage=Disk usage (Mb)\nmetrics_server_detail_live_procs=Live processes\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=Memory consumption\nmetrics_server_detail_netw_title=Network bandwidth\nmetrics_server_detail_disk_title=Disk usage\nmetrics_server_detail_disk_column1=Free disk space\nmetrics_server_detail_disk_column2=Used disk space\nmetrics_server_detail_procs_running_title=Running processes\nmetrics_server_detail_procs_running_column1=Running\nmetrics_server_detail_procs_sleeping_title=Sleeping processes\nmetrics_server_detail_procs_sleeping_column1=Sleeping\nmetrics_server_detail_rt_table_title=Real-time {0} metrics\nmetrics_server_detail_rt_table_column1=Minute\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=Used memory (Gb)\nmetrics_server_detail_rt_table_column5=Free memory (Gb)\nmetrics_server_detail_rt_table_column6=Upstream (kbps)\nmetrics_server_detail_rt_table_column7=Downstream (kbps)\nmetrics_server_detail_rt_table_column8=Running processes\nmetrics_server_detail_rt_table_column9=Sleeping processes\nmetrics_server_detail_rt_table_column10=Used disk (Mb)\nmetrics_server_detail_rt_table_column11=Free disk (Mb)\n\nmetrics_server_vert_title=Server metrics (Vertical)\nmetrics_server_vert_default_tt=Click to show server details\nmetrics_server_vert_cpu_tt=CPU usage (%)\nmetrics_server_vert_usedmem_tt=Used memory (Gb)\nmetrics_server_vert_netbw_tt=Network BW (kbps)\nmetrics_server_vert_procs_tt=Running/Sleeping processes\nmetrics_server_vert_disk_tt=Disk usage (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=Memory consumption\nmetrics_server_vert_netbw_title=Network bandwidth\nmetrics_server_vert_procs_title=Running/Sleeping processes\nmetrics_server_vert_du_title=Disk usage\nmetrics_server_vert_du_free=Free disk (Mb)\nmetrics_server_vert_du_used=Used disk (Mb)\nmetrics_server_vert_serverdown={0} is down\n\nmetrics_cluster_title=Cluster metrics\nmetrics_cluster_messages_heading=Initializing dashboard...\nmetrics_cluster_metricselector_label=Metric\nmetrics_cluster_chartselector_label=Chart type\nmetrics_cluster_metricselector_cpu=CPU %\nmetrics_cluster_metricselector_mem=Memory\nmetrics_cluster_metricselector_disk=Disk\nmetrics_cluster_metricselector_netw=Network\nmetrics_cluster_metricselector_proc=Processes\nmetrics_cluster_chartselector_bar=Bar\nmetrics_cluster_chartselector_line=Line\nmetrics_cluster_chartselector_area=Area\nmetrics_cluster_column_cpu=CPU %\nmetrics_cluster_column_cpu_y=CPU %\nmetrics_cluster_column_df=Disk free\nmetrics_cluster_column_df_y=Gigabytes\nmetrics_cluster_column_du=Disk used\nmetrics_cluster_column_du_y=Gigabytes\nmetrics_cluster_column_memf=Mem. free\nmetrics_cluster_column_memf_y=Gigabytes\nmetrics_cluster_column_memu=Mem. used\nmetrics_cluster_column_memu_y=Gigabytes\nmetrics_cluster_column_procsrn=Proc. running\nmetrics_cluster_column_procsrn_y=Processes\nmetrics_cluster_column_procssl=Proc. sleeping\nmetrics_cluster_column_procssl_y=Processes\nmetrics_cluster_column_netrx=Net. Rx\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=Net. Tx\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=Time\n\nmetrics_rt_title=System Metrics (Real-time)\nmetrics_rt_serverup= is up\nmetrics_rt_serverdown= is down\n\nsales_bycountry_title=Sales by country\nsales_bycountry_bubble_title=Opportunities distribution by Country\nsales_bycountry_bubble_column1=Number of opportunities\nsales_bycountry_bubble_column2=Average probability\nsales_bycountry_bubble_column3=Expected amount\nsales_bycountry_map_title=By Country\nsales_bycountry_map_column1=Total amount\nsales_bycountry_table_title=List of Opportunities\nsales_bycountry_table_column1=Country\nsales_bycountry_table_column2=Customer\nsales_bycountry_table_column3=Product\nsales_bycountry_table_column4=Salesman\nsales_bycountry_table_column5=Status\nsales_bycountry_table_column6=Creation\nsales_bycountry_table_column7=Expected\nsales_bycountry_table_column8=Closing\nsales_bycountry_table_column9=Amount\nsales_bydate_title=Sales pipeline\nsales_bydate_area_title=Expected pipeline\nsales_bydate_area_column1=Amount\nsales_bydate_pie_years_title=Year\nsales_bydate_pie_years_column1=Occurrences\nsales_bydate_pie_quarters_title=Quarter\nsales_bydate_pie_quarters_column1=Occurrences\nsales_bydate_bar_weekday_title=Day of week\nsales_bydate_bar_weekday_column1=Occurrences\nsales_bydate_pie_pipe_title=Pipeline\nsales_bydate_pie_pipe_column1=Number of opps\nsales_bydate_table_title=List of Opportunities\nsales_bydate_table_column1=Country\nsales_bydate_table_column2=Customer\nsales_bydate_table_column3=Product\nsales_bydate_table_column4=Salesman\nsales_bydate_table_column5=Status\nsales_bydate_table_column6=Amount\nsales_bydate_table_column7=Expected\nsales_bydate_table_column8=Creation\nsales_bydate_table_column9=Closing\nsales_bydate_selector_total=Total\nsales_goals_title=Sales goals\nsales_goals_meter_title=Sales goal\nsales_goals_meter_column1=Total amount\nsales_goals_line_title=Expected pipeline\nsales_goals_line_column1=Closing date\nsales_goals_line_column2=Total amount\nsales_goals_line_column3=Expected amount\nsales_goals_bar_byproduct_title=By product\nsales_goals_bar_byproduct_column1=Product\nsales_goals_bar_byproduct_column2=Total\nsales_goals_bar_byproduct_column3=Expected\nsales_goals_bar_byempl_title=By employee\nsales_goals_bar_byempl_column1=Employee\nsales_goals_bar_byempl_column2=Amount\nsales_goals_bubble_title=Opportunities distribution by Country\nsales_goals_bubble_column1=Number of opportunities\nsales_goals_bubble_column2=Average probability\nsales_goals_bubble_column3=Expected amount\nsales_tablereports_title=Sales reports\nsales_tablereports_tab_byyear=By year\nsales_tablereports_tab_bycountry=By country\nsales_tablereports_tab_byproduct=By product\nsales_tablereports_tab_bysalesman=By sales person\nsales_tablereports_all_title=List of Opportunities\nsales_tablereports_all_column1=Country\nsales_tablereports_all_column2=Customer\nsales_tablereports_all_column3=Product\nsales_tablereports_all_column4=Salesman\nsales_tablereports_all_column5=Status\nsales_tablereports_all_column6=Creation\nsales_tablereports_all_column7=Expected\nsales_tablereports_all_column8=Closing\nsales_tablereports_all_column9=Amount\nsales_tablereports_bycountry_title=Country summary\nsales_tablereports_bycountry_column1=Country\nsales_tablereports_bycountry_column2=#Opps\nsales_tablereports_bycountry_column3=Min\nsales_tablereports_bycountry_column4=Max\nsales_tablereports_bycountry_column5=Average\nsales_tablereports_bycountry_column6=Total\nsales_tablereports_byproduct_title=Product summary\nsales_tablereports_byproduct_column1=Product\nsales_tablereports_byproduct_column2=#Opps\nsales_tablereports_byproduct_column3=Min\nsales_tablereports_byproduct_column4=Max\nsales_tablereports_byproduct_column5=Average\nsales_tablereports_byproduct_column6=Total\nsales_tablereports_bysalesman_title=Sales by person\nsales_tablereports_bysalesman_column1=Sales person\nsales_tablereports_bysalesman_column2=#Opps\nsales_tablereports_bysalesman_column3=Min\nsales_tablereports_bysalesman_column4=Max\nsales_tablereports_bysalesman_column5=Average\nsales_tablereports_bysalesman_column6=Total\nsales_tablereports_byyear_title=Year summary\nsales_tablereports_byyear_column1=Creation date\nsales_tablereports_byyear_column2=#Opps\nsales_tablereports_byyear_column3=Min\nsales_tablereports_byyear_column4=Max\nsales_tablereports_byyear_column5=Average\nsales_tablereports_byyear_column6=Total\n\nsalesopps_displayers_by_pipeline_title=Pipeline status\nsalesopps_displayers_by_status_title=By Status\nsalesopps_displayers_by_salesman_title=By Sales Person\nsalesopps_displayers_by_exp_pipeline_title=Expected Amount\nsalesopps_displayers_by_exp_pipeline_column1=Expected amount\nsalesopps_displayers_by_product_title=By Product\nsalesopps_displayers_by_product_column1=Total amount\nsalesopps_displayers_by_country_title=By Country\nsalesopps_displayers_by_country_column1=Total amount\nsalesopps_displayers_country_summary_title=Country Summary\nsalesopps_displayers_country_summary_column1=COUNTRY\nsalesopps_displayers_country_summary_column2=TOTAL\nsalesopps_displayers_country_summary_column3=NUMBER\nsalesopps_displayers_country_summary_column4=AVERAGE\nsalesopps_displayers_country_summary_column5=MIN\nsalesopps_displayers_country_summary_column6=MAX\nsalesopps_displayers_all_list_title=List of Opportunities\n\ncontent_manager_dashboard=dashboard\ncontent_manager_dashboards=dashboards\ncontent_manager_noDashboards=No dashboards\n\nHomeScreenView.title=Welcome to Dashbuilder\nHomeScreenView.subTitle=Dashbuilder offers tools to create Business Dashboards. Select a tool below to get started"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_de.properties",
    "content": "logoBannerError=Banner konnte nicht geladen werden\nlogOut=Abmelden\nrole=Rolle\nmenu_home=Home\nmenu_gallery=Galerie\nmenu_extensions_apps=Apps\nmenu_dashboards=Dashboards\nmenu_dashboards_salesdb=Verkaufs-Dashboard\nmenu_dashboards_salesreports=Verkaufsberichte\nmenu_dashboards_new=- Neu -\nhome_intro=Der Dashbuilder ist ein Dashboard für allgemeine Zwecke und gleichzeitig eine Web-App für Berichterstattung, die Folgendes ermöglicht\\:\nhome_upcoming=Anstehende Features\nhome_feature1=Visuelle Konfiguration und persönliche Anpassung von Dashboards\nhome_feature2=Support für verschiedene Visualisierungstypen unter Verwendung verschiedener Bibliotheken zur Diagrammerstellung\nhome_feature3=UI Editor zur Erstellung von Datensatz-Definitionen\nhome_feature4=Vollfunktionaler Editor zur Definition von Diagramm-Visualisierungen\nhome_feature5=Definition interaktiver Bericht-Tabellen\nhome_feature6=Datengewinnung aus externen Systemen über verschiedene Protokolle\nhome_feature7=Support für analytische und Echtzeit-Dashboards\nhome_feature8=Neue Renderers basierend auf D3 JS & Lienzo GWT\nhome_feature9=Hierarchische (verschachtelte Gruppen) Displayer-Typen\\: Baum & Kreis\nhome_feature10=Support für mehrere Datenserien\nhome_feature11=Umfassender Mobility Support\nhome_feature12=Warnungen und SLA-Konfiguration\nhome_feature13=RESTful API\nhome_arch=Architektur\nhome_arch1=An keine Technologie zur Diagramm-Erstellung gebunden. Austauschbare Renderer.\nhome_arch2=Nicht an Datenspeicher gebunden.\nhome_arch3=Kann Daten lesen von\\: CSV-Dateien, Datenbanken oder Java-Generatoren.\nhome_arch4=Entkoppelte Client & Server Schichten. Fähig, reine Leichtgewicht-Client Dashboards zu erzeugen.\nhome_arch5=Fähigkeit Data Sets für bessere Leistung auf den Client zu pushen & zu bearbeiten.\nhome_arch6a=Basierend auf\nhome_arch6b=, ein Framework zur Erstellung umfassender Apps im Workbench-Stil im Netz.\nhome_furtherinfo=Weitere Informationen finden Sie auf der Webseite des Projekts\nhome_license=Lizensiert unter Apache License, Version 2.0\nnotification_dashboard_created={0} Dashboard erstellt\nnotification_dashboard_deleted={0} Dashboard gelöscht\ndashboard_new_displayer=Neuer Displayer\ndashboard_delete_popup_title=Dashboard löschen\ndashboard_delete_popup_content=Sind Sie sicher, dass Sie dieses Dashboard löschen möchten?\ndashboard_delete_dashboard=Dashboard löschen\nsalesdbpersp_salessummary=Verkaufsübersicht\nsalesreportspersp_salesreports=Verkaufsberichte\nexpensesdb_title=Ausgabenberichte\nexpensesdb_tab_exp_evolution=Ausgabenentwicklung\nexpensesdb_tab_by_employee=Nach Mitarbeiter\nexpensesdb_tab_all_exp=Alle Ausgaben\nexpensesdb_pie_title=Ausgaben nach Büro\nexpensesdb_pie_column1=Büro\nexpensesdb_pie_column2=Abteilung\nexpensesdb_pie_column3=Mitarbeiter\nexpensesdb_bar_title=Ausgaben nach Abteilung\nexpensesdb_bar_column1=Gesamtsumme\nexpensesdb_bubble_title=Ausgaben nach Mitarbeiter\nexpensesdb_bubble_column1=Gesamt\nexpensesdb_bubble_column2=Durchschnitt\nexpensesdb_bubble_column3=Mitarbeiter\nexpensesdb_bubble_column4=Anzahl an Ausgabenberichten\nexpensesdb_line_title=Ausgabenentwicklung\nexpensesdb_line_column1=Gesamtsumme\nexpensesdb_table_title=Liste der Ausgabenberichte\nexpensesdb_table_column1=Büro\nexpensesdb_table_column2=Abteilung\nexpensesdb_table_column3=Mitarbeiter\nexpensesdb_table_column4=Betrag\nexpensesdb_table_column5=Datum\ngallerytree_home=Galerie\ngallerytree_home_p1=Die Galerie enthält echte Beispiele für alle unterschiedlichen Displayer-Typen, die in Dashbuilder unterstützt werden. Der Knoten \"Dashboards\" enthält auch eine Reihe von Beispielen darüber, wie mehrere Displayer zu einem voll funktionstüchtigen Endbenutzer-Dashboard kombiniert werden können.\ngallerytree_home_s2a=Alle Beispiele werden mithilfe des Dashbuilder GWT Displayer API erstellt. Wenn Sie sich für die Hintergründe interessieren oder einfach wissen wollen, wie der Quellcode aussieht, dann werfen Sie einen Blick auf Folgendes\ngallerytree_home_s2b=bei GitHub.\ngallerytree_home_ghublink=Datei\ngallerytree_title=Galerie-Baum\ngallerytree_bar=Balkendiagramm\ngallerytree_bar_horiz=Horizontal\ngallerytree_bar_horiz_title=Nach Produkt\ngallerytree_bar_horiz_column1=Gesamtsumme\ngallerytree_bar_vert=Vertikal\ngallerytree_bar_vert_title=Nach Produkt\ngallerytree_bar_vert_column1=Gesamtsumme\ngallerytree_bar_vert_dd=In die Tiefe gehen\ngallerytree_bar_vert_dd_title=Nach Pipeline/Status/Vertriebsperson\ngallerytree_bar_vert_dd_column1=Gesamtsumme\ngallerytree_bar_vert_dd_column2=Gesamtsumme\ngallerytree_bar_vert_dd_column3=Gesamtsumme\ngallerytree_bar_multi=Mehrere\ngallerytree_bar_stacked=Gestapelt\ngallerytree_bar_multi_title=Nach Land (min/max/durchschn.)\ngallerytree_bar_multi_column1=Min.\ngallerytree_bar_multi_column2=Max.\ngallerytree_bar_multi_column3=Durchschn.\ngallerytree_pie=Kreisdiagramm\ngallerytree_pie_basic=Einfach\ngallerytree_pie_basic_title=Nach Status\ngallerytree_pie_basic_column1=Gesamtsumme\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=Nach Status\ngallerytree_pie_3d_column1=Gesamtsumme\ngallerytree_pie_donut=Donut\ngallerytree_pie_donut_title=Nach Status\ngallerytree_pie_donut_column1=Gesamtsumme\ngallerytree_pie_dd=In die Tiefe gehen\ngallerytree_pie_dd_title=Nach Pipeline/Status/Vertriebsperson\ngallerytree_pie_dd_column1=Gesamtsumme\ngallerytree_pie_dd_column2=Gesamtsumme\ngallerytree_pie_dd_column3=Gesamtsumme\ngallerytree_line=Liniendiagramm\ngallerytree_line_basic=Einfach\ngallerytree_line_basic_title=Entwicklung der Vertriebsmöglichkeiten\ngallerytree_line_basic_column1=Abschlussdatum\ngallerytree_line_basic_column2=Gesamtsumme\ngallerytree_line_multi=Mehrere\ngallerytree_line_multi_title=Nach Land (min/max/durchschn.)\ngallerytree_line_multi_column1=Min.\ngallerytree_line_multi_column2=Max.\ngallerytree_line_multi_column3=Durchschn.\ngallerytree_line_multi_static=Mehrere (statisch)\ngallerytree_line_multi_static_title=Vertriebsentwicklung pro Jahr\ngallerytree_line_multi_static_column1=Verkauf 2014\ngallerytree_line_multi_static_column2=Verkauf 2015\ngallerytree_line_multi_static_column3=Verkauf 2016\ngallerytree_area=Flächendiagramm\ngallerytree_area_basic=Einfach\ngallerytree_area_basic_title=Erwartete Pipeline\ngallerytree_area_basic_column1=Erwartete Summe\ngallerytree_area_fixed=Fest (pro Monat)\ngallerytree_area_fixed_title=Pipeline (bester Monat)\ngallerytree_area_fixed_column1=Abschlussdatum\ngallerytree_area_fixed_column2=Erwartete Summe pro Monat\ngallerytree_area_dd=In die Tiefe gehen\ngallerytree_area_dd_title=Erwartete Pipeline\ngallerytree_area_dd_column1=Abschlussdatum\ngallerytree_area_dd_column2=Erwartete Summe\ngallerytree_bubble=Blasendiagramm\ngallerytree_bubble_basic=Einfach\ngallerytree_bubble_basic_title=Möglichkeitenverteilung nach Land\ngallerytree_bubble_basic_column1=Anzahl von Möglichkeiten\ngallerytree_bubble_basic_column2=Durchschnittliche Wahrscheinlichkeit\ngallerytree_bubble_basic_column3=Erwartete Summe\ngallerytree_bubble_basic_column4=Land\ngallerytree_meter=Meter-Diagramm\ngallerytree_meter_basic=Einfach\ngallerytree_meter_basic_title=Vertriebsziel\ngallerytree_meter_basic_column1=Gesamtsumme\ngallerytree_meter_multi=Mehrfach\ngallerytree_meter_multi_title=Erwartete Summe pro Jahr\ngallerytree_meter_multi_column1=Gesamtsumme\ngallerytree_meter_multi_static=Mehrere (statisch)\ngallerytree_meter_multi_static_title=Heart Rate\ngallerytree_meter_multi_static_column1=Person\ngallerytree_meter_multi_static_column2=Heart Rate\ngallerytree_metrics=Metriken\ngallerytree_metrics_basic=Einfach\ngallerytree_metrics_basic_title=Verkäufe (aktuelles Quartal)\ngallerytree_metrics_basic_column1=Verkäufe (aktuelles Quartal)\ngallerytree_metrics_basic_static=Einfach (statisch)\ngallerytree_metrics_basic_static_title=Tweets\\!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Map\ngallerytree_map_region=Marker\ngallerytree_map_region_title=Nach Land \ngallerytree_map_region_column1=Gesamtsumme\ngallerytree_map_marker=Regionen\ngallerytree_map_marker_title=Nach Land \ngallerytree_map_marker_column1=Gesamtsumme\ngallerytree_table=Tabellenbericht\ngallerytree_table_basic=Einfach\ngallerytree_table_basic_title=Liste von Möglichkeiten\ngallerytree_table_basic_column1=Land\ngallerytree_table_basic_column2=Kunde\ngallerytree_table_basic_column3=Produkt\ngallerytree_table_basic_column4=Vertriebsperson\ngallerytree_table_basic_column5=Status\ngallerytree_table_basic_column6=Quelle\ngallerytree_table_basic_column7=Erstellung\ngallerytree_table_basic_column8=Erwartet\ngallerytree_table_basic_column9=Abschluss\ngallerytree_table_basic_column10=Summe\ngallerytree_table_filtered=Gefiltert\ngallerytree_table_filtered_title=Möglichkeiten in den USA & Brasilien\ngallerytree_table_filtered_column1=Kunde\ngallerytree_table_filtered_column2=Produkt\ngallerytree_table_filtered_column3=Status\ngallerytree_table_filtered_column4=Quelle\ngallerytree_table_filtered_column5=Erstellung\ngallerytree_table_filtered_column6=Erwartet\ngallerytree_table_filtered_column7=Abschluss\ngallerytree_table_filtered_column8=Summe\ngallerytree_table_grouped=Gruppiert\ngallerytree_table_grouped_title=Übersicht Land\ngallerytree_table_grouped_column1=Land\ngallerytree_table_grouped_column2=\\#Opps\ngallerytree_table_grouped_column3=Min.\ngallerytree_table_grouped_column4=Max.\ngallerytree_table_grouped_column5=Durchschnitt\ngallerytree_table_grouped_column6=Gesamt\ngallerytree_table_default_dd=Standard (in die Tiefe gehen)\ngallerytree_table_default_dd_title=Liste von Möglichkeiten\ngallerytree_table_default_dd_column1=Land\ngallerytree_table_default_dd_column2=Kunde\ngallerytree_table_default_dd_column3=Produkt\ngallerytree_table_default_dd_column4=Vertriebsperson\ngallerytree_table_default_dd_column5=Status\ngallerytree_table_default_dd_column6=Quelle\ngallerytree_table_default_dd_column7=Erstellung\ngallerytree_table_default_dd_column8=Erwartet\ngallerytree_table_default_dd_column9=Abschluss\ngallerytree_table_default_dd_column10=Summe\ngallerytree_db=Dashboards\ngallerytree_db_salesgoals=Vertriebsziele\ngallerytree_db_salespipe=Pipeline Vertrieb\ngallerytree_db_salespcountry=Vertrieb pro Land\ngallerytree_db_salesreps=Verkaufsberichte\ngallerytree_db_expreps=Ausgabenberichte\ngallerytree_db_clustermetrics=Cluster-Metriken\ngallerywidget_unknown=Unbekanntes Galerie-Widget\ngallerywidget_dataset_modif=Der Datensatz von Mitwirkenden wurde bearbeitet. Lade Ansicht neu ...\ngallerywidget_dataset_loaded=Datensatz geladen von Server [{0}, {1} Kb]\nmetrics_server_detail_title=Server-Metriken (Vertikal)\nmetrics_server_detail_backbutton_tt=Zurück\nmetrics_server_detail_modebutton_tt_viewtable=Als Tabelle anzeigen\nmetrics_server_detail_modebutton_tt_viewcharts=Als Diagramme anzeigen\nmetrics_server_detail_lasthour_summary=Übersicht letzte Stunde\nmetrics_server_detail_cpu_usage=CPU-Auslastung (%)\nmetrics_server_detail_mem_usage=Arbeitsspeicher-Auslastung (Gb)\nmetrics_server_detail_netw_usage=Netzwerk-Auslastung (kbps)\nmetrics_server_detail_disk_usage=Disk-Auslastung (Mb)\nmetrics_server_detail_live_procs=Live-Prozesse\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=Arbeitsspeicherverbrauch\nmetrics_server_detail_netw_title=Netzwerk-Bandbreite\nmetrics_server_detail_disk_title=Disk-Auslastung\nmetrics_server_detail_disk_column1=Freier Disk-Platz\nmetrics_server_detail_disk_column2=Verwendeter Disk-Platz\nmetrics_server_detail_procs_running_title=Prozesse in Betrieb\nmetrics_server_detail_procs_running_column1=Läuft\nmetrics_server_detail_procs_sleeping_title=Prozesse im Ruhezustand\nmetrics_server_detail_procs_sleeping_column1=Im Ruhezustand\nmetrics_server_detail_rt_table_title=Echtzeit {0} Metriken\nmetrics_server_detail_rt_table_column1=Minute\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=Verbrauchter Arbeitsspeicher (Gb)\nmetrics_server_detail_rt_table_column5=Freier Arbeitsspeicher (Gb)\nmetrics_server_detail_rt_table_column6=Upstream (kbps)\nmetrics_server_detail_rt_table_column7=Downstream (kbps)\nmetrics_server_detail_rt_table_column8=Prozesse in Betrieb\nmetrics_server_detail_rt_table_column9=Prozesse im Ruhezustand\nmetrics_server_detail_rt_table_column10=Verwendete Disk (Mb)\nmetrics_server_detail_rt_table_column11=Freie Disk (Mb)\nmetrics_server_vert_title=Server-Metriken (Vertikal)\nmetrics_server_vert_default_tt=Klicken, um Server-Details anzuzeigen\nmetrics_server_vert_cpu_tt=CPU-Auslastung (%)\nmetrics_server_vert_usedmem_tt=Verbrauchter Arbeitsspeicher (Gb)\nmetrics_server_vert_netbw_tt=Netzwerk BW (kbps)\nmetrics_server_vert_procs_tt=Prozesse in Betrieb/Ruhezustand\nmetrics_server_vert_disk_tt=Disk-Auslastung (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=Arbeitsspeicherverbrauch\nmetrics_server_vert_netbw_title=Netzwerk-Bandbreite\nmetrics_server_vert_procs_title=Prozesse in Betrieb/Ruhezustand\nmetrics_server_vert_du_title=Disk-Auslastung\nmetrics_server_vert_du_free=Freie Disk (Mb)\nmetrics_server_vert_du_used=Verwendete Disk (Mb)\nmetrics_server_vert_serverdown={0} ist außer Betrieb\nmetrics_cluster_title=Cluster-Metriken\nmetrics_cluster_messages_heading=Initialisiere Dashboard ...\nmetrics_cluster_metricselector_label=Metrik\nmetrics_cluster_chartselector_label=Diagrammtyp\nmetrics_cluster_metricselector_cpu=CPU %\nmetrics_cluster_metricselector_mem=Arbeitsspeicher\nmetrics_cluster_metricselector_disk=Disk\nmetrics_cluster_metricselector_netw=Netzwerk\nmetrics_cluster_metricselector_proc=Prozesse\nmetrics_cluster_chartselector_bar=Balken\nmetrics_cluster_chartselector_line=Linien\nmetrics_cluster_chartselector_area=Flächen\nmetrics_cluster_column_cpu=CPU %\nmetrics_cluster_column_cpu_y=CPU %\nmetrics_cluster_column_df=Disk frei\nmetrics_cluster_column_df_y=Gigabyte\nmetrics_cluster_column_du=Disk verwendet\nmetrics_cluster_column_du_y=Gigabyte\nmetrics_cluster_column_memf=Arbeitssp. frei\nmetrics_cluster_column_memf_y=Gigabyte\nmetrics_cluster_column_memu=Arbeitsspeicher verwendet\nmetrics_cluster_column_memu_y=Gigabyte\nmetrics_cluster_column_procsrn=Proz. in Betrieb\nmetrics_cluster_column_procsrn_y=Prozesse\nmetrics_cluster_column_procssl=Proz. in Ruhezustand\nmetrics_cluster_column_procssl_y=Prozesse\nmetrics_cluster_column_netrx=Net. Rx\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=Net. St.\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=Zeit\nmetrics_rt_title=Systemmetriken (Echtzeit)\nmetrics_rt_serverup=in Betrieb\nmetrics_rt_serverdown=außer Betrieb\nsales_bycountry_title=Vertrieb nach Land \nsales_bycountry_bubble_title=Möglichkeitenverteilung nach Land\nsales_bycountry_bubble_column1=Anzahl von Möglichkeiten\nsales_bycountry_bubble_column2=Durchschnittliche Wahrscheinlichkeit\nsales_bycountry_bubble_column3=Erwartete Summe\nsales_bycountry_map_title=Nach Land \nsales_bycountry_map_column1=Gesamtsumme\nsales_bycountry_table_title=Liste von Möglichkeiten\nsales_bycountry_table_column1=Land\nsales_bycountry_table_column2=Kunde\nsales_bycountry_table_column3=Produkt\nsales_bycountry_table_column4=Vertriebsperson\nsales_bycountry_table_column5=Status\nsales_bycountry_table_column6=Erstellung\nsales_bycountry_table_column7=Erwartet\nsales_bycountry_table_column8=Abschluss\nsales_bycountry_table_column9=Summe\nsales_bydate_title=Pipeline Vertrieb\nsales_bydate_area_title=Erwartete Pipeline\nsales_bydate_area_column1=Betrag\nsales_bydate_pie_years_title=Jahr\nsales_bydate_pie_years_column1=Vorkommen\nsales_bydate_pie_quarters_title=Quartal\nsales_bydate_pie_quarters_column1=Vorkommen\nsales_bydate_bar_weekday_title=Wochentag\nsales_bydate_bar_weekday_column1=Vorkommen\nsales_bydate_pie_pipe_title=Pipeline\nsales_bydate_pie_pipe_column1=Anzahl von Opps\nsales_bydate_table_title=Liste von Möglichkeiten\nsales_bydate_table_column1=Land\nsales_bydate_table_column2=Kunde\nsales_bydate_table_column3=Produkt\nsales_bydate_table_column4=Vertriebsperson\nsales_bydate_table_column5=Status\nsales_bydate_table_column6=Betrag\nsales_bydate_table_column7=Erwartet\nsales_bydate_table_column8=Erstellung\nsales_bydate_table_column9=Abschluss\nsales_bydate_selector_total=Gesamt\nsales_goals_title=Vertriebsziele\nsales_goals_meter_title=Vertriebsziel\nsales_goals_meter_column1=Gesamtsumme\nsales_goals_line_title=Erwartete Pipeline\nsales_goals_line_column1=Abschlussdatum\nsales_goals_line_column2=Gesamtsumme\nsales_goals_line_column3=Erwartete Summe\nsales_goals_bar_byproduct_title=Nach Produkt\nsales_goals_bar_byproduct_column1=Produkt\nsales_goals_bar_byproduct_column2=Gesamt\nsales_goals_bar_byproduct_column3=Erwartet\nsales_goals_bar_byempl_title=Nach Mitarbeiter\nsales_goals_bar_byempl_column1=Mitarbeiter\nsales_goals_bar_byempl_column2=Betrag\nsales_goals_bubble_title=Möglichkeitenverteilung nach Land\nsales_goals_bubble_column1=Anzahl von Möglichkeiten\nsales_goals_bubble_column2=Durchschnittliche Wahrscheinlichkeit\nsales_goals_bubble_column3=Erwartete Summe\nsales_tablereports_title=Verkaufsberichte\nsales_tablereports_tab_byyear=Nach Jahr\nsales_tablereports_tab_bycountry=Nach Land \nsales_tablereports_tab_byproduct=Nach Produkt\nsales_tablereports_tab_bysalesman=Nach Vertriebsperson\nsales_tablereports_all_title=Liste von Möglichkeiten\nsales_tablereports_all_column1=Land\nsales_tablereports_all_column2=Kunde\nsales_tablereports_all_column3=Produkt\nsales_tablereports_all_column4=Vertriebsperson\nsales_tablereports_all_column5=Status\nsales_tablereports_all_column6=Erstellung\nsales_tablereports_all_column7=Erwartet\nsales_tablereports_all_column8=Abschluss\nsales_tablereports_all_column9=Betrag\nsales_tablereports_bycountry_title=Übersicht Land\nsales_tablereports_bycountry_column1=Land\nsales_tablereports_bycountry_column2=\\#Opps\nsales_tablereports_bycountry_column3=Min.\nsales_tablereports_bycountry_column4=Max.\nsales_tablereports_bycountry_column5=Durchschnitt\nsales_tablereports_bycountry_column6=Gesamt\nsales_tablereports_byproduct_title=Produktübersicht\nsales_tablereports_byproduct_column1=Produkt\nsales_tablereports_byproduct_column2=\\#Opps\nsales_tablereports_byproduct_column3=Min.\nsales_tablereports_byproduct_column4=Max.\nsales_tablereports_byproduct_column5=Durchschnitt\nsales_tablereports_byproduct_column6=Gesamt\nsales_tablereports_bysalesman_title=Vertrieb nach Person\nsales_tablereports_bysalesman_column1=Vertriebsperson\nsales_tablereports_bysalesman_column2=\\#Opps\nsales_tablereports_bysalesman_column3=Min.\nsales_tablereports_bysalesman_column4=Max.\nsales_tablereports_bysalesman_column5=Durchschnitt\nsales_tablereports_bysalesman_column6=Gesamt\nsales_tablereports_byyear_title=Übersicht Jahr\nsales_tablereports_byyear_column1=Erstellungsdatum\nsales_tablereports_byyear_column2=\\#Opps\nsales_tablereports_byyear_column3=Min.\nsales_tablereports_byyear_column4=Max.\nsales_tablereports_byyear_column5=Durchschnitt\nsales_tablereports_byyear_column6=Gesamt\nsalesopps_displayers_by_pipeline_title=Pipeline-Status\nsalesopps_displayers_by_status_title=Nach Status\nsalesopps_displayers_by_salesman_title=Nach Vertriebsperson\nsalesopps_displayers_by_exp_pipeline_title=Erwarteter Betrag\nsalesopps_displayers_by_exp_pipeline_column1=Erwarteter Betrag\nsalesopps_displayers_by_product_title=Nach Produkt\nsalesopps_displayers_by_product_column1=Gesamtsumme\nsalesopps_displayers_by_country_title=Nach Land \nsalesopps_displayers_by_country_column1=Gesamtsumme\nsalesopps_displayers_country_summary_title=Übersicht Land\nsalesopps_displayers_country_summary_column1=LAND\nsalesopps_displayers_country_summary_column2=GESAMT\nsalesopps_displayers_country_summary_column3=NUMMER\nsalesopps_displayers_country_summary_column4=DURCHSCHNITT\nsalesopps_displayers_country_summary_column5=MIN\nsalesopps_displayers_country_summary_column6=MAX\nsalesopps_displayers_all_list_title=Liste von Möglichkeiten\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_es.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nlogoBannerError=Error al cargar el cartel.\nlogOut=Cerrar sesión\nrole=Función\nmenu_home=Inicio\nmenu_gallery=Galería\nmenu_administration=Administración\nmenu_security=Seguridad\nmenu_dataset_authoring=Conjuntos de datos\nmenu_content_manager=Administrador de contenido\nmenu_extensions_apps=Aplicaciones\nmenu_dashboards=Cuadros de mando\nmenu_dashboards_salesdb=Cuadro de mando de ventas\nmenu_dashboards_salesreports=Informes de ventas\nmenu_dashboards_new=- Nuevo -\n\nhome_intro=Dashbuilder es una aplicación web de informes y un cuadro de mando de propósito general que permite lo siguiente:\nhome_upcoming=Próximas funcionalidades\n\nhome_feature1=Configuración visual y personalización de los cuadros de mando\nhome_feature2=Soporte para distintos tipos de visualizaciones mediante el uso de varias bibliotecas de gráficos\nhome_feature3=Editor de la interfaz de usuario para la creación de definiciones de conjuntos de datos\nhome_feature4=Editor completo para la definición de visualizaciones de gráficos\nhome_feature5=Definición de tablas de informes interactivas\nhome_feature6=Extracción de datos de sistemas externos, a través de diferentes protocolos\nhome_feature7=Soporte tanto para análisis como para cuadros de mando en tiempo real\nhome_feature8=Nuevos renderizadores basados en D3 JS y Lienzo GWT\nhome_feature9=Tipos de visualizadores jerárquicos (grupos anidados):\nhome_feature10=Soporte para múltiples series de datos\nhome_feature11=Amplio soporte de movilidad\nhome_feature12=Alertas y configuración de SLA\nhome_feature13=API RESTful\n\nhome_arch=Arquitectura\nhome_arch1=No está atado a ninguna tecnología de representación gráfica. Renderizadores conectables.\nhome_arch2=No está vinculado a ningún almacenamiento de datos.\nhome_arch3=Archivos CSV, bases de datos o generadores Java.\nhome_arch4=Capas de cliente y servidor desacopladas. Capacidad de compilar cuadros de mando de clientes puramente ligeros.\nhome_arch5=Capacidad de enviar y manejar conjuntos de datos en el cliente para un mejor rendimiento.\nhome_arch6a=Basado en\nhome_arch6b=, un marco para compilar aplicaciones sofisticadas con estilo de mesa de trabajo en la Web.\n\nhome_furtherinfo=Para obtener más información, visite el sitio web del proyecto\nhome_license=Licenciado bajo la licencia de Apache, versión 2.0\n\nnotification_dashboard_created=Se creó el cuadro de mando {0}\nnotification_dashboard_deleted=Se eliminó el cuadro de mando {0}\n\ndashboard_new_displayer=Nuevo visualizador\ndashboard_delete_popup_title=Eliminar el cuadro de mando\ndashboard_delete_popup_content=¿Está seguro de que desea eliminar este cuadro de mando?\ndashboard_delete_dashboard=Eliminar el cuadro de mando\n\nsalesdbpersp_salessummary=Resumen de ventas\nsalesreportspersp_salesreports=Informes de ventas\n\nexpensesdb_title=Informes de gastos\n\nexpensesdb_tab_exp_evolution=Evolución de gastos\nexpensesdb_tab_by_employee=Por empleado\nexpensesdb_tab_all_exp=Todos los gastos\nexpensesdb_pie_title=Gastos por oficina\nexpensesdb_pie_column1=Oficina\nexpensesdb_pie_column2=Departamento\nexpensesdb_pie_column3=Empleado\nexpensesdb_bar_title=Gastos por departamento\nexpensesdb_bar_column1=Cantidad total\nexpensesdb_bubble_title=Gastos por empleado”\nexpensesdb_bubble_column1=Total\nexpensesdb_bubble_column2=Promedio\nexpensesdb_bubble_column3=Empleado\nexpensesdb_bubble_column4=Número de informes de gastos\nexpensesdb_line_title=Evolución de gastos\nexpensesdb_line_column1=Cantidad total\nexpensesdb_table_title=Lista de informes de gastos\nexpensesdb_table_column1=Oficina\nexpensesdb_table_column2=Departamento\nexpensesdb_table_column3=Empleado\nexpensesdb_table_column4=Cantidad\nexpensesdb_table_column5=Fecha\n\ngallerytree_home=Galería\ngallerytree_home_p1=La galería contiene ejemplos en vivo de todos los diferentes tipos de visualizadores admitidos en Dashbuilder. El nodo “Cuadros de mando” también contiene un conjunto de ejemplos de cómo combinar varios visualizadores en cuadros de mando para el usuario final con todas las funcionalidades.\ngallerytree_home_s2a=Todos los ejemplos se crearon mediante el uso de la API GWT Displayer de Dashbuilder. Si está interesado en los internos o solo desea ver cómo luce el código fuente, observe lo siguiente\ngallerytree_home_s2b=en GitHub.\ngallerytree_home_ghublink=archivo\ngallerytree_title=Árbol de la galería\ngallerytree_bar=Gráfico de barras\ngallerytree_bar_horiz=Horizontal\ngallerytree_bar_horiz_title=Por producto\ngallerytree_bar_horiz_column1=Cantidad total\ngallerytree_bar_vert=Vertical\ngallerytree_bar_vert_title=Por producto\ngallerytree_bar_vert_column1=Cantidad total\ngallerytree_bar_vert_dd=Ver detalles\ngallerytree_bar_vert_dd_title=Por tubería/estado/vendedor\ngallerytree_bar_vert_dd_column1=Cantidad total\ngallerytree_bar_vert_dd_column2=Cantidad total\ngallerytree_bar_vert_dd_column3=Cantidad total\ngallerytree_bar_multi=Múltiple\ngallerytree_bar_stacked=Apilado\ngallerytree_bar_multi_title=Por país (mín./máx./prom.)\ngallerytree_bar_multi_column1=Mín.\ngallerytree_bar_multi_column2=Máx.\ngallerytree_bar_multi_column3=Prom.\ngallerytree_pie=Gráfico circular\ngallerytree_pie_basic=Básico\ngallerytree_pie_basic_title=Por estado\ngallerytree_pie_basic_column1=Cantidad total\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=Por estado\ngallerytree_pie_3d_column1=Cantidad total\ngallerytree_pie_donut=Dona\ngallerytree_pie_donut_title=Por estado\ngallerytree_pie_donut_column1=Cantidad total\ngallerytree_pie_dd=Ver detalles\ngallerytree_pie_dd_title=Por tubería/estado/vendedor\ngallerytree_pie_dd_column1=Cantidad total\ngallerytree_pie_dd_column2=Cantidad total\ngallerytree_pie_dd_column3=Cantidad total\ngallerytree_line=Gráfico de líneas\ngallerytree_line_basic=Básico\ngallerytree_line_basic_title=Evolución de las oportunidades de venta\ngallerytree_line_basic_column1=Fecha de cierre\ngallerytree_line_basic_column2=Cantidad total\ngallerytree_line_multi=Múltiple\ngallerytree_line_multi_title=Por país (mín./máx./prom.)\ngallerytree_line_multi_column1=Mín.\ngallerytree_line_multi_column2=Máx.\ngallerytree_line_multi_column3=Prom.\ngallerytree_line_multi_static=Múltiple (estático)\ngallerytree_line_multi_static_title=Evolución de las ventas por año\ngallerytree_line_multi_static_column1=Ventas en 2014\ngallerytree_line_multi_static_column2=Ventas en 2015\ngallerytree_line_multi_static_column3=Ventas en 2016\ngallerytree_area=Gráfico de área\ngallerytree_area_basic=Básico\ngallerytree_area_basic_title=Tubería prevista\ngallerytree_area_basic_column1=Cantidad prevista\ngallerytree_area_fixed=Fijo (por mes)\ngallerytree_area_fixed_title=Tubería (mejor mes)\ngallerytree_area_fixed_column1=Fecha de cierre\ngallerytree_area_fixed_column2=Cantidad prevista por mes\ngallerytree_area_dd=Ver detalles\ngallerytree_area_dd_title=Tubería prevista\ngallerytree_area_dd_column1=Fecha de cierre\ngallerytree_area_dd_column2=Cantidad prevista\ngallerytree_bubble=Gráfico de burbujas\ngallerytree_bubble_basic=Básico\ngallerytree_bubble_basic_title=Distribución de oportunidades por país\ngallerytree_bubble_basic_column1=Cantidad de oportunidades\ngallerytree_bubble_basic_column2=Probabilidad media\ngallerytree_bubble_basic_column3=Cantidad prevista\ngallerytree_bubble_basic_column4=País\ngallerytree_meter=Gráfico de medidor\ngallerytree_meter_basic=Básico\ngallerytree_meter_basic_title=Objetivo de ventas\ngallerytree_meter_basic_column1=Cantidad total\ngallerytree_meter_multi=Múltiple\ngallerytree_meter_multi_title=Cantidad prevista por año\ngallerytree_meter_multi_column1=Cantidad total\ngallerytree_meter_multi_static=Múltiple (estático)\ngallerytree_meter_multi_static_title=Ritmo cardíaco\ngallerytree_meter_multi_static_column1=Persona\ngallerytree_meter_multi_static_column2=Ritmo cardíaco\ngallerytree_metrics=Métrica\ngallerytree_metrics_basic=Básico\ngallerytree_metrics_basic_title=Ventas (trimestre en curso)\ngallerytree_metrics_basic_column1=Ventas (trimestre en curso)\ngallerytree_metrics_basic_static=Básico (estático)\ngallerytree_metrics_basic_static_title=¡Tweets!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Mapa\ngallerytree_map_region=Marcadores\ngallerytree_map_region_title=Por país\ngallerytree_map_region_column1=Cantidad total\ngallerytree_map_marker=Regiones\ngallerytree_map_marker_title=Por país\ngallerytree_map_marker_column1=Cantidad total\ngallerytree_table=Informe de tabla\ngallerytree_table_basic=Básico\ngallerytree_table_basic_title=Lista de oportunidades\ngallerytree_table_basic_column1=País\ngallerytree_table_basic_column2=Cliente\ngallerytree_table_basic_column3=Producto\ngallerytree_table_basic_column4=Vendedor\ngallerytree_table_basic_column5=Estado\ngallerytree_table_basic_column6=Fuente\ngallerytree_table_basic_column7=Creación\ngallerytree_table_basic_column8=Previsto\ngallerytree_table_basic_column9=Cerrando\ngallerytree_table_basic_column10=Cantidad\ngallerytree_table_filtered=Filtrado\ngallerytree_table_filtered_title=Oportunidades en EE.UU. y Brasil\ngallerytree_table_filtered_column1=Cliente\ngallerytree_table_filtered_column2=Producto\ngallerytree_table_filtered_column3=Estado\ngallerytree_table_filtered_column4=Fuente\ngallerytree_table_filtered_column5=Creación\ngallerytree_table_filtered_column6=Previsto\ngallerytree_table_filtered_column7=Cerrando\ngallerytree_table_filtered_column8=Cantidad\ngallerytree_table_grouped=Agrupados\ngallerytree_table_grouped_title=Resumen de país\ngallerytree_table_grouped_column1=País\ngallerytree_table_grouped_column2=Cant. de oportunidades\ngallerytree_table_grouped_column3=Mín.\ngallerytree_table_grouped_column4=Máx.\ngallerytree_table_grouped_column5=Promedio\ngallerytree_table_grouped_column6=Total\ngallerytree_table_default_dd=Predeterminado (desglosar)\ngallerytree_table_default_dd_title=Lista de oportunidades\ngallerytree_table_default_dd_column1=País\ngallerytree_table_default_dd_column2=Cliente\ngallerytree_table_default_dd_column3=Producto\ngallerytree_table_default_dd_column4=Vendedor\ngallerytree_table_default_dd_column5=Estado\ngallerytree_table_default_dd_column6=Fuente\ngallerytree_table_default_dd_column7=Creación\ngallerytree_table_default_dd_column8=Previsto\ngallerytree_table_default_dd_column9=Cerrando\ngallerytree_table_default_dd_column10=Cantidad\ngallerytree_selector=Selector\ngallerytree_selector_dropdown=Desplegar\ngallerytree_selector_labels=Etiquetas\ngallerytree_selector_slider=Control deslizante\ngallerytree_db=Cuadros de mando\ngallerytree_db_salesgoals=Objetivos de ventas\ngallerytree_db_salespipe=Tubería de ventas\ngallerytree_db_salespcountry=Ventas por país\ngallerytree_db_salesreps=Informes de ventas\ngallerytree_db_expreps=Informes de gastos\ngallerytree_db_clustermetrics=Métricas de clúster\ngallerywidget_unknown=Asistente de galería desconocido:\ngallerywidget_dataset_modif=Se ha modificado el conjunto de datos. Actualizando la vista…\ngallerywidget_dataset_loaded=Conjunto de datos cargado desde el servidor [{0}, {1} Kb]\n\nmetrics_server_detail_title=Métricas de servidor (vertical)\nmetrics_server_detail_backbutton_tt=Volver atrás\nmetrics_server_detail_modebutton_tt_viewtable=Ver como tabla\nmetrics_server_detail_modebutton_tt_viewcharts=Ver como gráficos\nmetrics_server_detail_lasthour_summary=Resumen de la última hora\nmetrics_server_detail_cpu_usage=Uso de CPU (%)\nmetrics_server_detail_mem_usage=Uso de la memoria (Gb)\nmetrics_server_detail_netw_usage=Uso de red (kbps)\nmetrics_server_detail_disk_usage=Uso del disco (Mb)\nmetrics_server_detail_live_procs=Procesos en vivo\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=Consumo de memoria\nmetrics_server_detail_netw_title=Ancho de banda de red\nmetrics_server_detail_disk_title=Uso del disco\nmetrics_server_detail_disk_column1=Espacio libre en el disco\nmetrics_server_detail_disk_column2=Espacio de disco usado\nmetrics_server_detail_procs_running_title=Procesos en ejecución\nmetrics_server_detail_procs_running_column1=En ejecución\nmetrics_server_detail_procs_sleeping_title=Procesos suspendidos\nmetrics_server_detail_procs_sleeping_column1=Suspendido\nmetrics_server_detail_rt_table_title=Métricas de {0} en tiempo real\nmetrics_server_detail_rt_table_column1=Minuto\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=Memoria usada (Gb)\nmetrics_server_detail_rt_table_column5=Memoria libre (Gb)\nmetrics_server_detail_rt_table_column6=Ascendente (kbps)\nmetrics_server_detail_rt_table_column7=Descendente (kbps)\nmetrics_server_detail_rt_table_column8=Procesos en ejecución\nmetrics_server_detail_rt_table_column9=Procesos suspendidos\nmetrics_server_detail_rt_table_column10=Disco usado (Mb)\nmetrics_server_detail_rt_table_column11=Disco libre (Mb)\n\nmetrics_server_vert_title=Métricas de servidor (vertical)\nmetrics_server_vert_default_tt=Haga clic para mostrar los detalles del servidor\nmetrics_server_vert_cpu_tt=Uso de CPU (%)\nmetrics_server_vert_usedmem_tt=Memoria usada (Gb)\nmetrics_server_vert_netbw_tt=Ancho de banda de red (kbps)\nmetrics_server_vert_procs_tt=Procesos en ejecución/suspendidos\nmetrics_server_vert_disk_tt=Uso del disco (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=Consumo de memoria\nmetrics_server_vert_netbw_title=Ancho de banda de red\nmetrics_server_vert_procs_title=Procesos en ejecución/suspendidos\nmetrics_server_vert_du_title=Uso del disco\nmetrics_server_vert_du_free=Disco libre (Mb)\nmetrics_server_vert_du_used=Disco usado (Mb)\nmetrics_server_vert_serverdown={0} está apagado\n\nmetrics_cluster_title=Métricas de clúster\nmetrics_cluster_messages_heading=Iniciando el cuadro de mando…\nmetrics_cluster_metricselector_label=Métrica\nmetrics_cluster_chartselector_label=Tipo de gráfico\nmetrics_cluster_metricselector_cpu=% de CPU %\nmetrics_cluster_metricselector_mem=Memoria\nmetrics_cluster_metricselector_disk=Disco\nmetrics_cluster_metricselector_netw=Red\nmetrics_cluster_metricselector_proc=Procesos\nmetrics_cluster_chartselector_bar=Barra\nmetrics_cluster_chartselector_line=Línea\nmetrics_cluster_chartselector_area=Área\nmetrics_cluster_column_cpu=% de CPU %\nmetrics_cluster_column_cpu_y=% de CPU %\nmetrics_cluster_column_df=Disco libre\nmetrics_cluster_column_df_y=Gigabytes\nmetrics_cluster_column_du=Disco en uso\nmetrics_cluster_column_du_y=Gigabytes\nmetrics_cluster_column_memf=Mem. libre\nmetrics_cluster_column_memf_y=Gigabytes\nmetrics_cluster_column_memu=Mem. usada\nmetrics_cluster_column_memu_y=Gigabytes\nmetrics_cluster_column_procsrn=Proc. en ejecución\nmetrics_cluster_column_procsrn_y=Procesos\nmetrics_cluster_column_procssl=Proc. suspendido\nmetrics_cluster_column_procssl_y=Procesos\nmetrics_cluster_column_netrx=Red. Rx\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=Red. Tx\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=Tiempo\n\nmetrics_rt_title=Métricas del sistema (tiempo real)\nmetrics_rt_serverup= está encendido\nmetrics_rt_serverdown= está apagado\n\nsales_bycountry_title=Ventas por país\nsales_bycountry_bubble_title=Distribución de oportunidades por país\nsales_bycountry_bubble_column1=Cantidad de oportunidades\nsales_bycountry_bubble_column2=Probabilidad media\nsales_bycountry_bubble_column3=Cantidad prevista\nsales_bycountry_map_title=Por país\nsales_bycountry_map_column1=Cantidad total\nsales_bycountry_table_title=Lista de oportunidades\nsales_bycountry_table_column1=País\nsales_bycountry_table_column2=Cliente\nsales_bycountry_table_column3=Producto\nsales_bycountry_table_column4=Vendedor\nsales_bycountry_table_column5=Estado\nsales_bycountry_table_column6=Creación\nsales_bycountry_table_column7=Previsto\nsales_bycountry_table_column8=Cerrando\nsales_bycountry_table_column9=Cantidad\nsales_bydate_title=Tubería de ventas\nsales_bydate_area_title=Tubería prevista\nsales_bydate_area_column1=Cantidad\nsales_bydate_pie_years_title=Año\nsales_bydate_pie_years_column1=Ocurrencias\nsales_bydate_pie_quarters_title=Trimestre\nsales_bydate_pie_quarters_column1=Ocurrencias\nsales_bydate_bar_weekday_title=Día de la semana\nsales_bydate_bar_weekday_column1=Ocurrencias\nsales_bydate_pie_pipe_title=Tubería\nsales_bydate_pie_pipe_column1=Cantidad de oportunidades\nsales_bydate_table_title=Lista de oportunidades\nsales_bydate_table_column1=País\nsales_bydate_table_column2=Cliente\nsales_bydate_table_column3=Producto\nsales_bydate_table_column4=Vendedor\nsales_bydate_table_column5=Estado\nsales_bydate_table_column6=Cantidad\nsales_bydate_table_column7=Previsto\nsales_bydate_table_column8=Creación\nsales_bydate_table_column9=Cerrando\nsales_bydate_selector_total=Total\nsales_goals_title=Objetivos de ventas\nsales_goals_meter_title=Objetivo de ventas\nsales_goals_meter_column1=Cantidad total\nsales_goals_line_title=Tubería prevista\nsales_goals_line_column1=Fecha de cierre\nsales_goals_line_column2=Cantidad total\nsales_goals_line_column3=Cantidad prevista\nsales_goals_bar_byproduct_title=Por producto\nsales_goals_bar_byproduct_column1=Producto\nsales_goals_bar_byproduct_column2=Total\nsales_goals_bar_byproduct_column3=Previsto\nsales_goals_bar_byempl_title=Por empleado\nsales_goals_bar_byempl_column1=Empleado\nsales_goals_bar_byempl_column2=Cantidad\nsales_goals_bubble_title=Distribución de oportunidades por país\nsales_goals_bubble_column1=Cantidad de oportunidades\nsales_goals_bubble_column2=Probabilidad media\nsales_goals_bubble_column3=Cantidad prevista\nsales_tablereports_title=Informes de ventas\nsales_tablereports_tab_byyear=Por año\nsales_tablereports_tab_bycountry=Por país\nsales_tablereports_tab_byproduct=Por producto\nsales_tablereports_tab_bysalesman=Por vendedor\nsales_tablereports_all_title=Lista de oportunidades\nsales_tablereports_all_column1=País\nsales_tablereports_all_column2=Cliente\nsales_tablereports_all_column3=Producto\nsales_tablereports_all_column4=Vendedor\nsales_tablereports_all_column5=Estado\nsales_tablereports_all_column6=Creación\nsales_tablereports_all_column7=Previsto\nsales_tablereports_all_column8=Cerrando\nsales_tablereports_all_column9=Cantidad\nsales_tablereports_bycountry_title=Resumen de país\nsales_tablereports_bycountry_column1=País\nsales_tablereports_bycountry_column2=Cant. de oportunidades\nsales_tablereports_bycountry_column3=Mín.\nsales_tablereports_bycountry_column4=Máx.\nsales_tablereports_bycountry_column5=Promedio\nsales_tablereports_bycountry_column6=Total\nsales_tablereports_byproduct_title=Resumen del producto\nsales_tablereports_byproduct_column1=Producto\nsales_tablereports_byproduct_column2=Cant. de oportunidades\nsales_tablereports_byproduct_column3=Mín.\nsales_tablereports_byproduct_column4=Máx.\nsales_tablereports_byproduct_column5=Promedio\nsales_tablereports_byproduct_column6=Total\nsales_tablereports_bysalesman_title=Ventas por persona\nsales_tablereports_bysalesman_column1=Vendedor\nsales_tablereports_bysalesman_column2=Cant. de oportunidades\nsales_tablereports_bysalesman_column3=Mín.\nsales_tablereports_bysalesman_column4=Máx.\nsales_tablereports_bysalesman_column5=Promedio\nsales_tablereports_bysalesman_column6=Total\nsales_tablereports_byyear_title=Resumen del año\nsales_tablereports_byyear_column1=Fecha de creación\nsales_tablereports_byyear_column2=Cant. de oportunidades\nsales_tablereports_byyear_column3=Mín.\nsales_tablereports_byyear_column4=Máx.\nsales_tablereports_byyear_column5=Promedio\nsales_tablereports_byyear_column6=Total\n\nsalesopps_displayers_by_pipeline_title=Estado de la tubería\nsalesopps_displayers_by_status_title=Por estado\nsalesopps_displayers_by_salesman_title=Por vendedor\nsalesopps_displayers_by_exp_pipeline_title=Cantidad prevista\nsalesopps_displayers_by_exp_pipeline_column1=Cantidad prevista\nsalesopps_displayers_by_product_title=Por producto\nsalesopps_displayers_by_product_column1=Cantidad total\nsalesopps_displayers_by_country_title=Por país\nsalesopps_displayers_by_country_column1=Cantidad total\nsalesopps_displayers_country_summary_title=Resumen de país\nsalesopps_displayers_country_summary_column1=PAÍS\nsalesopps_displayers_country_summary_column2=TOTAL\nsalesopps_displayers_country_summary_column3=NÚMERO\nsalesopps_displayers_country_summary_column4=PROMEDIO\nsalesopps_displayers_country_summary_column5=MÍN\nsalesopps_displayers_country_summary_column6=MÁX\nsalesopps_displayers_all_list_title=Lista de oportunidades\n\ncontent_manager_dashboard=cuadro de mando\ncontent_manager_dashboards=cuadros de mando\ncontent_manager_noDashboards=No hay cuadros de mando\n\nHomeScreenView.title=¡Bienvenido a Dashbuilder!\nHomeScreenView.subTitle=Dashbuilder ofrece herramientas para crear cuadros de mando empresariales. Seleccione una herramienta a continuación para empezar."
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_fr.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nlogoBannerError=Échec de chargement de la bannière.\nlogOut=Se déconnecter\nrole=Rôle\nmenu_home=Accueil\nmenu_gallery=Galerie\nmenu_administration=Administration\nmenu_security=Sécurité\nmenu_dataset_authoring=Ensembles de données\nmenu_content_manager=Gestionnaire de contenu\nmenu_extensions_apps=Applications\nmenu_dashboards=Tableaux de bord\nmenu_dashboards_salesdb=Tableau de bord des ventes\nmenu_dashboards_salesreports=Rapports sur les ventes\nmenu_dashboards_new=- Nouveau -\n\nhome_intro=Dashbuilder est une application Web de tableau de bord et de création de rapports polyvalente qui offre les fonctionnalités suivantes :\nhome_upcoming=Fonctionnalités à venir\n\nhome_feature1=Configuration visuelle et personnalisation des tableaux de bord\nhome_feature2=Prise en charge de différents types de visualisations à l''aide de plusieurs bibliothèques de graphiques\nhome_feature3=Éditeur d''IU pour la création de définitions d''ensembles de données\nhome_feature4=Éditeur complet permettant de définir des visualisations de graphiques\nhome_feature5=Définition de tables de rapports interactives\nhome_feature6=Extraction de données à partir de systèmes externes, par le biais de différents protocoles\nhome_feature7=Pris en charge de tableaux de bord en temps réel et analytiques\nhome_feature8=Nouveaux moteurs de rendu basés sur D3 JS et Lienzo GWT\nhome_feature9=Types d''afficheurs hiérarchiques (groupes imbriqués) : Tree & Pie\nhome_feature10=Prise en charge de plusieurs séries de données\nhome_feature11=Prise en charge étendue de la mobilité\nhome_feature12=Alertes et configuration de contrats SLA\nhome_feature13=API RESTful\n\nhome_arch=Architecture\nhome_arch1=Lié à aucune technologie de rendu de graphiques. Moteurs de rendu enfichables.\nhome_arch2=Lié à aucun stockage de données.\nhome_arch3=Capacité de lire des données à partir de : fichiers CSV, bases de données, recherche élastique ou générateurs Java.\nhome_arch4=Couches client et serveur découplées. Capacité de création de tableaux de bord client légers.\nhome_arch5=Capacité d''envoi et de traitement d''ensembles de données sur le client pour de meilleures performances.\nhome_arch6a=Basé sur\nhome_arch6b=, une structure destinée à la création d''applications enrichies de type \"Tableau de référence\" sur le Web.\n\nhome_furtherinfo=Pour plus d''informations, veuillez consulter le site Web du projet\nhome_license=Sous licence Apache, version 2.0\n\nnotification_dashboard_created={0} tableau de bord créé\nnotification_dashboard_deleted={0} tableau de bord supprimé\n\ndashboard_new_displayer=Nouvel afficheur\ndashboard_delete_popup_title=Supprimer le tableau de bord\ndashboard_delete_popup_content=Voulez-vous vraiment supprimer ce tableau de bord ?\ndashboard_delete_dashboard=Supprimer le tableau de bord\n\nsalesdbpersp_salessummary=Résumé des ventes\nsalesreportspersp_salesreports=Rapports sur les ventes\n\nexpensesdb_title=Rapports sur les dépenses\n\nexpensesdb_tab_exp_evolution=Évolution des dépenses\nexpensesdb_tab_by_employee=Par employé\nexpensesdb_tab_all_exp=Toutes les dépenses\nexpensesdb_pie_title=Dépenses par bureau\nexpensesdb_pie_column1=Bureau\nexpensesdb_pie_column2=Service\nexpensesdb_pie_column3=Employé\nexpensesdb_bar_title=Dépenses par service\nexpensesdb_bar_column1=Montant total\nexpensesdb_bubble_title=Dépenses par employé\"\nexpensesdb_bubble_column1=Total\nexpensesdb_bubble_column2=Moyenne\nexpensesdb_bubble_column3=Employé\nexpensesdb_bubble_column4=Nombre de rapports sur les dépenses\nexpensesdb_line_title=Évolution des dépenses\nexpensesdb_line_column1=Montant total\nexpensesdb_table_title=Liste des rapports sur les dépenses\nexpensesdb_table_column1=Bureau\nexpensesdb_table_column2=Service\nexpensesdb_table_column3=Employé\nexpensesdb_table_column4=Montant\nexpensesdb_table_column5=Date\n\ngallerytree_home=Galerie\ngallerytree_home_p1=La galerie contient des exemples dynamiques de tous les différents types d''afficheur pris en charge dans Dashbuilder. Le nœud \"Tableaux de bord\" contient également des exemples sur la manière de combiner plusieurs afficheurs afin de disposer de tableaux de bord complets pour l''utilisateur final.\ngallerytree_home_s2a=Tous les exemples sont compilés à l''aide de l''API GWT Displayer de Dashbuilder. Si vous êtes intéressé par leur fonctionnement interne ou si vous voulez simplement voir à quoi ressemble le code source, consultez\ngallerytree_home_s2b=sur GitHub.\ngallerytree_home_ghublink=fichier\ngallerytree_title=Arborescence de la galerie\ngallerytree_bar=Graphique à barres\ngallerytree_bar_horiz=Horizontal\ngallerytree_bar_horiz_title=Par produit\ngallerytree_bar_horiz_column1=Montant total\ngallerytree_bar_vert=Vertical\ngallerytree_bar_vert_title=Par produit\ngallerytree_bar_vert_column1=Montant total\ngallerytree_bar_vert_dd=Descendre dans la hiérarchie\ngallerytree_bar_vert_dd_title=Par pipeline/état/vendeur\ngallerytree_bar_vert_dd_column1=Montant total\ngallerytree_bar_vert_dd_column2=Montant total\ngallerytree_bar_vert_dd_column3=Montant total\ngallerytree_bar_multi=Multiple\ngallerytree_bar_stacked=Empilé\ngallerytree_bar_multi_title=Par pays (min/max/moy)\ngallerytree_bar_multi_column1=Min\ngallerytree_bar_multi_column2=Max\ngallerytree_bar_multi_column3=Moy\ngallerytree_pie=Graphique en secteurs\ngallerytree_pie_basic=De base\ngallerytree_pie_basic_title=Par état\ngallerytree_pie_basic_column1=Montant total\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=Par état\ngallerytree_pie_3d_column1=Montant total\ngallerytree_pie_donut=Anneau\ngallerytree_pie_donut_title=Par état\ngallerytree_pie_donut_column1=Montant total\ngallerytree_pie_dd=Descendre dans la hiérarchie\ngallerytree_pie_dd_title=Par pipeline/état/vendeur\ngallerytree_pie_dd_column1=Montant total\ngallerytree_pie_dd_column2=Montant total\ngallerytree_pie_dd_column3=Montant total\ngallerytree_line=Graphique en courbes\ngallerytree_line_basic=De base\ngallerytree_line_basic_title=Évolution des opportunités de vente\ngallerytree_line_basic_column1=Date de clôture\ngallerytree_line_basic_column2=Montant total\ngallerytree_line_multi=Multiple\ngallerytree_line_multi_title=Par pays (min/max/moy)\ngallerytree_line_multi_column1=Min\ngallerytree_line_multi_column2=Max\ngallerytree_line_multi_column3=Moy\ngallerytree_line_multi_static=Multiple (statique)\ngallerytree_line_multi_static_title=Évolution des ventes par année\ngallerytree_line_multi_static_column1=Ventes en 2014\ngallerytree_line_multi_static_column2=Ventes en 2015\ngallerytree_line_multi_static_column3=Ventes en 2016\ngallerytree_area=Graphique en aires\ngallerytree_area_basic=De base\ngallerytree_area_basic_title=Pipeline prévu\ngallerytree_area_basic_column1=Montant prévu\ngallerytree_area_fixed=Fixe (par mois)\ngallerytree_area_fixed_title=Pipeline (meilleur mois)\ngallerytree_area_fixed_column1=Date de clôture\ngallerytree_area_fixed_column2=Montant prévu par mois\ngallerytree_area_dd=Descendre dans la hiérarchie\ngallerytree_area_dd_title=Pipeline prévu\ngallerytree_area_dd_column1=Date de clôture\ngallerytree_area_dd_column2=Montant prévu\ngallerytree_bubble=Graphique en bulles\ngallerytree_bubble_basic=De base\ngallerytree_bubble_basic_title=Répartition des opportunités par pays\ngallerytree_bubble_basic_column1=Nombre d''opportunités\ngallerytree_bubble_basic_column2=Probabilité moyenne\ngallerytree_bubble_basic_column3=Montant prévu\ngallerytree_bubble_basic_column4=Pays\ngallerytree_meter=Graphique de mesure\ngallerytree_meter_basic=De base\ngallerytree_meter_basic_title=Objectif de vente\ngallerytree_meter_basic_column1=Montant total\ngallerytree_meter_multi=Multiple\ngallerytree_meter_multi_title=Montant prévu par an\ngallerytree_meter_multi_column1=Montant total\ngallerytree_meter_multi_static=Multiple (statique)\ngallerytree_meter_multi_static_title=Fréquence cardiaque\ngallerytree_meter_multi_static_column1=Personne\ngallerytree_meter_multi_static_column2=Fréquence cardiaque\ngallerytree_metrics=Métriques\ngallerytree_metrics_basic=De base\ngallerytree_metrics_basic_title=Ventes (trimestre en cours)\ngallerytree_metrics_basic_column1=Ventes (trimestre en cours)\ngallerytree_metrics_basic_static=De base (statique)\ngallerytree_metrics_basic_static_title=Tweets !\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Carte\ngallerytree_map_region=Marqueurs\ngallerytree_map_region_title=Par pays\ngallerytree_map_region_column1=Montant total\ngallerytree_map_marker=Régions\ngallerytree_map_marker_title=Par pays\ngallerytree_map_marker_column1=Montant total\ngallerytree_table=Rapport de tableau\ngallerytree_table_basic=De base\ngallerytree_table_basic_title=Liste des opportunités\ngallerytree_table_basic_column1=Pays\ngallerytree_table_basic_column2=Client\ngallerytree_table_basic_column3=Produit\ngallerytree_table_basic_column4=Vendeur\ngallerytree_table_basic_column5=État\ngallerytree_table_basic_column6=Source\ngallerytree_table_basic_column7=Création\ngallerytree_table_basic_column8=Prévu\ngallerytree_table_basic_column9=Clôture\ngallerytree_table_basic_column10=Montant\ngallerytree_table_filtered=Filtré\ngallerytree_table_filtered_title=Opportunités aux États-Unis et au Brésil\ngallerytree_table_filtered_column1=Client\ngallerytree_table_filtered_column2=Produit\ngallerytree_table_filtered_column3=État\ngallerytree_table_filtered_column4=Source\ngallerytree_table_filtered_column5=Création\ngallerytree_table_filtered_column6=Prévu\ngallerytree_table_filtered_column7=Clôture\ngallerytree_table_filtered_column8=Montant\ngallerytree_table_grouped=Groupé\ngallerytree_table_grouped_title=Résumé par pays\ngallerytree_table_grouped_column1=Pays\ngallerytree_table_grouped_column2=#Opps\ngallerytree_table_grouped_column3=Min\ngallerytree_table_grouped_column4=Max\ngallerytree_table_grouped_column5=Moyenne\ngallerytree_table_grouped_column6=Total\ngallerytree_table_default_dd=Par défaut (descendre dans la hiérarchie)\ngallerytree_table_default_dd_title=Liste des opportunités\ngallerytree_table_default_dd_column1=Pays\ngallerytree_table_default_dd_column2=Client\ngallerytree_table_default_dd_column3=Produit\ngallerytree_table_default_dd_column4=Vendeur\ngallerytree_table_default_dd_column5=État\ngallerytree_table_default_dd_column6=Source\ngallerytree_table_default_dd_column7=Création\ngallerytree_table_default_dd_column8=Prévu\ngallerytree_table_default_dd_column9=Clôture\ngallerytree_table_default_dd_column10=Montant\ngallerytree_selector=Sélecteur\ngallerytree_selector_dropdown=Liste déroulante\ngallerytree_selector_labels=Étiquettes\ngallerytree_selector_slider=Curseur\ngallerytree_db=Tableaux de bord\ngallerytree_db_salesgoals=Objectifs de vente\ngallerytree_db_salespipe=Pipeline de ventes\ngallerytree_db_salespcountry=Ventes par pays\ngallerytree_db_salesreps=Rapports sur les ventes\ngallerytree_db_expreps=Rapports sur les dépenses\ngallerytree_db_clustermetrics=Métriques de cluster\ngallerywidget_unknown=Widget de galerie inconnu :\ngallerywidget_dataset_modif=L''ensemble de données a été modifié. Rafraîchissement de la vue…\ngallerywidget_dataset_loaded=Ensemble de données chargé à partir du serveur [{0}, {1} Ko]\n\nmetrics_server_detail_title=Métriques du serveur (vertical)\nmetrics_server_detail_backbutton_tt=Revenir en arrière\nmetrics_server_detail_modebutton_tt_viewtable=Afficher sous la forme d''un tableau\nmetrics_server_detail_modebutton_tt_viewcharts=Afficher sous forme de graphiques\nmetrics_server_detail_lasthour_summary=Résumé de la dernière heure\nmetrics_server_detail_cpu_usage=Utilisation du processeur (%)\nmetrics_server_detail_mem_usage=Utilisation de la mémoire (Go)\nmetrics_server_detail_netw_usage=Utilisation du réseau (kbit/s)\nmetrics_server_detail_disk_usage=Utilisation du disque (Mo)\nmetrics_server_detail_live_procs=Processus en direct\nmetrics_server_detail_cpu1_title=% processeur 1\nmetrics_server_detail_cpu2_title=% processeur 2\nmetrics_server_detail_mem_title=Consommation de mémoire\nmetrics_server_detail_netw_title=Bande passante du réseau\nmetrics_server_detail_disk_title=Utilisation du disque\nmetrics_server_detail_disk_column1=Espace disque libre\nmetrics_server_detail_disk_column2=Espace disque utilisé\nmetrics_server_detail_procs_running_title=Processus en cours d''exécution\nmetrics_server_detail_procs_running_column1=En cours d''exécution\nmetrics_server_detail_procs_sleeping_title=Processus en veille\nmetrics_server_detail_procs_sleeping_column1=En veille\nmetrics_server_detail_rt_table_title=Métriques {0} en temps réel\nmetrics_server_detail_rt_table_column1=Minute\nmetrics_server_detail_rt_table_column2=Processeur 0\nmetrics_server_detail_rt_table_column3=Processeur 1\nmetrics_server_detail_rt_table_column4=Mémoire utilisée (Go)\nmetrics_server_detail_rt_table_column5=Mémoire libre (Go)\nmetrics_server_detail_rt_table_column6=Montant (kbit/s)\nmetrics_server_detail_rt_table_column7=Descendant (kbit/s)\nmetrics_server_detail_rt_table_column8=Processus en cours d''exécution\nmetrics_server_detail_rt_table_column9=Processus en veille\nmetrics_server_detail_rt_table_column10=Disque utilisé (Mo)\nmetrics_server_detail_rt_table_column11=Espace disque libre (Mo)\n\nmetrics_server_vert_title=Métriques du serveur (vertical)\nmetrics_server_vert_default_tt=Cliquez pour afficher les détails du serveur\nmetrics_server_vert_cpu_tt=Utilisation du processeur (%)\nmetrics_server_vert_usedmem_tt=Mémoire utilisée (Go)\nmetrics_server_vert_netbw_tt=Bande passante du réseau (kbit/s)\nmetrics_server_vert_procs_tt=Processus en cours d''exécution/en veille\nmetrics_server_vert_disk_tt=Utilisation du disque (Mo)\nmetrics_server_vert_cpu1_title=% processeur 1\nmetrics_server_vert_cpu2_title=% processeur 2\nmetrics_server_vert_memconsumption_title=Consommation de mémoire\nmetrics_server_vert_netbw_title=Bande passante du réseau\nmetrics_server_vert_procs_title=Processus en cours d''exécution/en veille\nmetrics_server_vert_du_title=Utilisation du disque\nmetrics_server_vert_du_free=Espace disque libre (Mo)\nmetrics_server_vert_du_used=Disque utilisé (Mo)\nmetrics_server_vert_serverdown={0} hors service\n\nmetrics_cluster_title=Métriques de cluster\nmetrics_cluster_messages_heading=Initialisation du tableau de bord…\nmetrics_cluster_metricselector_label=Métrique\nmetrics_cluster_chartselector_label=Type de graphique\nmetrics_cluster_metricselector_cpu=% de processeur\nmetrics_cluster_metricselector_mem=Mémoire\nmetrics_cluster_metricselector_disk=Disque\nmetrics_cluster_metricselector_netw=Réseau\nmetrics_cluster_metricselector_proc=Processus\nmetrics_cluster_chartselector_bar=Barres\nmetrics_cluster_chartselector_line=Ligne\nmetrics_cluster_chartselector_area=Aires\nmetrics_cluster_column_cpu=% de processeur\nmetrics_cluster_column_cpu_y=% de processeur\nmetrics_cluster_column_df=Disque libre\nmetrics_cluster_column_df_y=Giga-octets\nmetrics_cluster_column_du=Disque utilisé\nmetrics_cluster_column_du_y=Giga-octets\nmetrics_cluster_column_memf=Mém. libre\nmetrics_cluster_column_memf_y=Giga-octets\nmetrics_cluster_column_memu=Mém. utilisée\nmetrics_cluster_column_memu_y=Giga-octets\nmetrics_cluster_column_procsrn=Proc. en cours\nmetrics_cluster_column_procsrn_y=Processus\nmetrics_cluster_column_procssl=Proc. en veille\nmetrics_cluster_column_procssl_y=Processus\nmetrics_cluster_column_netrx=Réseau Rx\nmetrics_cluster_column_netrx_y=Kbit/s\nmetrics_cluster_column_nettx=Réseau Tx\nmetrics_cluster_column_nettx_y=Kbit/s\nmetrics_cluster_column_time=Temps\n\nmetrics_rt_title=Métriques du système (en temps réel)\nmetrics_rt_serverup= est actif\nmetrics_rt_serverdown= est inactif\n\nsales_bycountry_title=Ventes par pays\nsales_bycountry_bubble_title=Répartition des opportunités par pays\nsales_bycountry_bubble_column1=Nombre d''opportunités\nsales_bycountry_bubble_column2=Probabilité moyenne\nsales_bycountry_bubble_column3=Montant prévu\nsales_bycountry_map_title=Par pays\nsales_bycountry_map_column1=Montant total\nsales_bycountry_table_title=Liste des opportunités\nsales_bycountry_table_column1=Pays\nsales_bycountry_table_column2=Client\nsales_bycountry_table_column3=Produit\nsales_bycountry_table_column4=Vendeur\nsales_bycountry_table_column5=État\nsales_bycountry_table_column6=Création\nsales_bycountry_table_column7=Prévu\nsales_bycountry_table_column8=Clôture\nsales_bycountry_table_column9=Montant\nsales_bydate_title=Pipeline de ventes\nsales_bydate_area_title=Pipeline prévue\nsales_bydate_area_column1=Montant\nsales_bydate_pie_years_title=Année\nsales_bydate_pie_years_column1=Occurrences\nsales_bydate_pie_quarters_title=Trimestre\nsales_bydate_pie_quarters_column1=Occurrences\nsales_bydate_bar_weekday_title=Jour de la semaine\nsales_bydate_bar_weekday_column1=Occurrences\nsales_bydate_pie_pipe_title=Pipeline\nsales_bydate_pie_pipe_column1=Nombre d''opportunités\nsales_bydate_table_title=Liste des opportunités\nsales_bydate_table_column1=Pays\nsales_bydate_table_column2=Client\nsales_bydate_table_column3=Produit\nsales_bydate_table_column4=Vendeur\nsales_bydate_table_column5=État\nsales_bydate_table_column6=Montant\nsales_bydate_table_column7=Prévu\nsales_bydate_table_column8=Création\nsales_bydate_table_column9=Clôture\nsales_bydate_selector_total=Total\nsales_goals_title=Objectifs de vente\nsales_goals_meter_title=Objectif de vente\nsales_goals_meter_column1=Montant total\nsales_goals_line_title=Pipeline prévue\nsales_goals_line_column1=Date de clôture\nsales_goals_line_column2=Montant total\nsales_goals_line_column3=Montant prévu\nsales_goals_bar_byproduct_title=Par produit\nsales_goals_bar_byproduct_column1=Produit\nsales_goals_bar_byproduct_column2=Total\nsales_goals_bar_byproduct_column3=Prévu\nsales_goals_bar_byempl_title=Par employé\nsales_goals_bar_byempl_column1=Employé\nsales_goals_bar_byempl_column2=Montant\nsales_goals_bubble_title=Répartition des opportunités par pays\nsales_goals_bubble_column1=Nombre d''opportunités\nsales_goals_bubble_column2=Probabilité moyenne\nsales_goals_bubble_column3=Montant prévu\nsales_tablereports_title=Rapports sur les ventes\nsales_tablereports_tab_byyear=Par année\nsales_tablereports_tab_bycountry=Par pays\nsales_tablereports_tab_byproduct=Par produit\nsales_tablereports_tab_bysalesman=Par vendeur\nsales_tablereports_all_title=Liste des opportunités\nsales_tablereports_all_column1=Pays\nsales_tablereports_all_column2=Client\nsales_tablereports_all_column3=Produit\nsales_tablereports_all_column4=Vendeur\nsales_tablereports_all_column5=État\nsales_tablereports_all_column6=Création\nsales_tablereports_all_column7=Prévu\nsales_tablereports_all_column8=Clôture\nsales_tablereports_all_column9=Montant\nsales_tablereports_bycountry_title=Résumé par pays\nsales_tablereports_bycountry_column1=Pays\nsales_tablereports_bycountry_column2=#Opps\nsales_tablereports_bycountry_column3=Min\nsales_tablereports_bycountry_column4=Max\nsales_tablereports_bycountry_column5=Moyenne\nsales_tablereports_bycountry_column6=Total\nsales_tablereports_byproduct_title=Résumé du produit\nsales_tablereports_byproduct_column1=Produit\nsales_tablereports_byproduct_column2=#Opps\nsales_tablereports_byproduct_column3=Min\nsales_tablereports_byproduct_column4=Max\nsales_tablereports_byproduct_column5=Moyenne\nsales_tablereports_byproduct_column6=Total\nsales_tablereports_bysalesman_title=Ventes par personne\nsales_tablereports_bysalesman_column1=Vendeur\nsales_tablereports_bysalesman_column2=#Opps\nsales_tablereports_bysalesman_column3=Min\nsales_tablereports_bysalesman_column4=Max\nsales_tablereports_bysalesman_column5=Moyenne\nsales_tablereports_bysalesman_column6=Total\nsales_tablereports_byyear_title=Résumé de l''année\nsales_tablereports_byyear_column1=Date de création\nsales_tablereports_byyear_column2=#Opps\nsales_tablereports_byyear_column3=Min\nsales_tablereports_byyear_column4=Max\nsales_tablereports_byyear_column5=Moyenne\nsales_tablereports_byyear_column6=Total\n\nsalesopps_displayers_by_pipeline_title=État des pipelines\nsalesopps_displayers_by_status_title=Par état\nsalesopps_displayers_by_salesman_title=Par vendeur\nsalesopps_displayers_by_exp_pipeline_title=Montant prévu\nsalesopps_displayers_by_exp_pipeline_column1=Montant prévu\nsalesopps_displayers_by_product_title=Par produit\nsalesopps_displayers_by_product_column1=Montant total\nsalesopps_displayers_by_country_title=Par pays\nsalesopps_displayers_by_country_column1=Montant total\nsalesopps_displayers_country_summary_title=Résumé par pays\nsalesopps_displayers_country_summary_column1=PAYS\nsalesopps_displayers_country_summary_column2=TOTAL\nsalesopps_displayers_country_summary_column3=NUMÉRO\nsalesopps_displayers_country_summary_column4=MOYENNE\nsalesopps_displayers_country_summary_column5=MIN\nsalesopps_displayers_country_summary_column6=MAX\nsalesopps_displayers_all_list_title=Liste des opportunités\n\ncontent_manager_dashboard=tableau de bord\ncontent_manager_dashboards=tableaux de bord\ncontent_manager_noDashboards=Aucun tableau de bord\n\nHomeScreenView.title=Bienvenue dans Dashbuilder !\nHomeScreenView.subTitle=Dashbuilder offre des outils pour créer des tableaux de bord d''entreprise. Sélectionnez un outil ci-dessous pour commencer."
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_it.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nlogoBannerError=Impossibile caricare il banner.\nlogOut=Esci\nrole=Ruolo\nmenu_home=Home\nmenu_gallery=Galleria\nmenu_administration=Amministrazione\nmenu_security=Sicurezza\nmenu_dataset_authoring=Set di dati\nmenu_content_manager=Gestore dei contenuti\nmenu_extensions_apps=App\nmenu_dashboards=Dashboard\nmenu_dashboards_salesdb=Dashboard delle vendite\nmenu_dashboards_salesreports=Report delle vendite\nmenu_dashboards_new=- Nuovo -\n\nhome_intro=Dashbuilder è un''applicazione web di dashboard e reporting generale che consente di:\nhome_upcoming=Prossime funzionalità\n\nhome_feature1=Configurazione visuale e personalizzazione delle dashboard\nhome_feature2=Supporto per diversi tipi di visualizzazioni utilizzando diverse librerie di grafici\nhome_feature3=Editor UI per la creazione di definizioni di set di dati\nhome_feature4=Editor completo per la definizione di visualizzazioni grafiche\nhome_feature5=Definizione di tabelle di report interattive\nhome_feature6=Estrazione di dati da sistemi esterni, attraverso diversi protocolli\nhome_feature7=Supporto sia per dashboard di analisi che in tempo reale\nhome_feature8=Nuovi render basati su D3 JS & Lienzo GWT\nhome_feature9=Tipi di visualizzatori gerarchici (gruppi nidificati): Albero e Torta\nhome_feature10=Supporto per più serie di dati\nhome_feature11=Supporto completo per la mobilità\nhome_feature12=Configurazione di avvisi e SLA\nhome_feature13=API RESTful\n\nhome_arch=Architettura\nhome_arch1=Non legato a una particolare tecnologia di rendering dei grafici. Renderizzatori plug-in.\nhome_arch2=Non legato a un particolare archivio dati.\nhome_arch3=Capacità di leggere dati da: file CSV, database o generatori Java.\nhome_arch4=Strati client e server disaccoppiati. Capacità di creare dashboard client leggere.\nhome_arch5=Capacità di spingere e gestire set di dati sul client per una migliore performance.\nhome_arch6a=Basato su\nhome_arch6b=, un framework per la creazione di app ricche di stile workbench sul web.\n\nhome_furtherinfo=Per ulteriori informazioni, visita il sito web del progetto\nhome_license=Licenza Apache, Versione 2.0\n\nnotification_dashboard_created=Dashboard {0} creata\nnotification_dashboard_deleted=Dashboard {0} eliminata\n\ndashboard_new_displayer=Nuovo visualizzatore\ndashboard_delete_popup_title=Elimina dashboard\ndashboard_delete_popup_content=Sei sicuro di voler eliminare questa dashboard?\ndashboard_delete_dashboard=Elimina dashboard\n\nsalesdbpersp_salessummary=Sommario vendite\nsalesreportspersp_salesreports=Report vendite\n\nexpensesdb_title=Report spese\n\nexpensesdb_tab_exp_evolution=Andamento spese\nexpensesdb_tab_by_employee=Per dipendente\nexpensesdb_tab_all_exp=Tutte le spese\nexpensesdb_pie_title=Spese per Ufficio\nexpensesdb_pie_column1=Ufficio\nexpensesdb_pie_column2=Dipartimento\nexpensesdb_pie_column3=Dipendente\nexpensesdb_bar_title=Spese per Dipartimento\nexpensesdb_bar_column1=Importo totale\nexpensesdb_bubble_title=Spese per Dipendente\nexpensesdb_bubble_column1=Totale\nexpensesdb_bubble_column2=Media\nexpensesdb_bubble_column3=Dipendente\nexpensesdb_bubble_column4=Numero di report spese\nexpensesdb_line_title=Andamento spese\nexpensesdb_line_column1=Importo totale\nexpensesdb_table_title=Elenco report spese\nexpensesdb_table_column1=Ufficio\nexpensesdb_table_column2=Dipartimento\nexpensesdb_table_column3=Dipendente\nexpensesdb_table_column4=Importo\nexpensesdb_table_column5=Data\n\ngallerytree_home=Galleria\ngallerytree_home_p1=La galleria contiene esempi dal vivo di tutti i diversi tipi di visualizzatori supportati in Dashbuilder. Il nodo \"Dashboard\" contiene anche una serie di esempi su come combinare diversi visualizzatori in dashboard complete per gli utenti finali.\ngallerytree_home_s2a=Tutti gli esempi sono realizzati utilizzando l''API GWT Displayer di Dashbuilder. Se sei interessato agli interni o vuoi solo vedere come appare il codice sorgente, dai un''occhiata al seguente\ngallerytree_home_s2b= su GitHub.\ngallerytree_home_ghublink=file\ngallerytree_title=Albero della galleria\ngallerytree_bar=Grafico a barre\ngallerytree_bar_horiz=Orizzontale\ngallerytree_bar_horiz_title=Per prodotto\ngallerytree_bar_horiz_column1=Importo totale\ngallerytree_bar_vert=Verticale\ngallerytree_bar_vert_title=Per prodotto\ngallerytree_bar_vert_column1=Importo totale\ngallerytree_bar_vert_dd=Drill-down\ngallerytree_bar_vert_dd_title=Per pipeline/Stato/Venditore\ngallerytree_bar_vert_dd_column1=Importo totale\ngallerytree_bar_vert_dd_column2=Importo totale\ngallerytree_bar_vert_dd_column3=Importo totale\ngallerytree_bar_multi=Multiplo\ngallerytree_bar_stacked=Impilato\ngallerytree_bar_multi_title=Per paese (min/max/avg)\ngallerytree_bar_multi_column1=Min\ngallerytree_bar_multi_column2=Max\ngallerytree_bar_multi_column3=Media\ngallerytree_pie=Grafico a torta\ngallerytree_pie_basic=Base\ngallerytree_pie_basic_title=Per stato\ngallerytree_pie_basic_column1=Importo totale\ngallerytree_pie_3d=3D\ngallerytree_pie_3d_title=Per stato\ngallerytree_pie_3d_column1=Importo totale\ngallerytree_pie_donut=Anello\ngallerytree_pie_donut_title=Per stato\ngallerytree_pie_donut_column1=Importo totale\ngallerytree_pie_dd=Drill-down\ngallerytree_pie_dd_title=Per pipeline/Stato/Venditore\ngallerytree_pie_dd_column1=Importo totale\ngallerytree_pie_dd_column2=Importo totale\ngallerytree_pie_dd_column3=Importo totale\ngallerytree_line=Grafico a linee\ngallerytree_line_basic=Base\ngallerytree_line_basic_title=Evoluzione delle opportunità di vendita\ngallerytree_line_basic_column1=Data di chiusura\ngallerytree_line_basic_column2=Importo totale\ngallerytree_line_multi=Multiplo\ngallerytree_line_multi_title=Per paese (min/max/avg)\ngallerytree_line_multi_column1=Min\ngallerytree_line_multi_column2=Max\ngallerytree_line_multi_column3=Media\ngallerytree_line_multi_static=Multiplo (statico)\ngallerytree_line_multi_static_title=Evoluzione delle vendite per anno\ngallerytree_line_multi_static_column1=Vendite nel 2014\ngallerytree_line_multi_static_column2=Vendite nel 2015\ngallerytree_line_multi_static_column3=Vendite nel 2016\ngallerytree_area=Grafico ad area\ngallerytree_area_basic=Base\ngallerytree_area_basic_title=Pipeline prevista\ngallerytree_area_basic_column1=Importo previsto\ngallerytree_area_fixed=Fisso (al mese)\ngallerytree_area_fixed_title=Pipeline (miglior mese)\ngallerytree_area_fixed_column1=Data di chiusura\ngallerytree_area_fixed_column2=Importo previsto al mese\ngallerytree_area_dd=Drill-down\ngallerytree_area_dd_title=Pipeline prevista\ngallerytree_area_dd_column1=Data di chiusura\ngallerytree_area_dd_column2=Importo previsto\ngallerytree_bubble=Grafico a bolle\ngallerytree_bubble_basic=Base\ngallerytree_bubble_basic_title=Distribuzione delle opportunità per paese\ngallerytree_bubble_basic_column1=Numero di opportunità\ngallerytree_bubble_basic_column2=Probabilità media\ngallerytree_bubble_basic_column3=Importo previsto\ngallerytree_bubble_basic_column4=Paese\ngallerytree_meter=Grafico a misuratore\ngallerytree_meter_basic=Base\ngallerytree_meter_basic_title=Obiettivo di vendita\ngallerytree_meter_basic_column1=Importo totale\ngallerytree_meter_multi=Multiplo\ngallerytree_meter_multi_title=Importo previsto per anno\ngallerytree_meter_multi_column1=Importo totale\ngallerytree_meter_multi_static=Multiplo (statico)\ngallerytree_meter_multi_static_title=Battito cardiaco\ngallerytree_meter_multi_static_column1=Persona\ngallerytree_meter_multi_static_column2=Battito cardiaco\ngallerytree_metrics=Metriche\ngallerytree_metrics_basic=Base\ngallerytree_metrics_basic_title=Vendite (trimestre corrente)\ngallerytree_metrics_basic_column1=Vendite (trimestre corrente)\ngallerytree_metrics_basic_static=Base (statico)\ngallerytree_metrics_basic_static_title=Tweets!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Mappa\ngallerytree_map_region=Marcatori\ngallerytree_map_region_title=Per paese\ngallerytree_map_region_column1=Importo totale\ngallerytree_map_marker=Regioni\ngallerytree_map_marker_title=Per paese\ngallerytree_map_marker_column1=Importo totale\ngallerytree_table=Report tabella\ngallerytree_table_basic=Base\ngallerytree_table_basic_title=Elenco delle opportunità\ngallerytree_table_basic_column1=Paese\ngallerytree_table_basic_column2=Cliente\ngallerytree_table_basic_column3=Prodotto\ngallerytree_table_basic_column4=Venditore\ngallerytree_table_basic_column5=Stato\ngallerytree_table_basic_column6=Origine\ngallerytree_table_basic_column7=Creazione\ngallerytree_table_basic_column8=Previsto\ngallerytree_table_basic_column9=Chiusura\ngallerytree_table_basic_column10=Importo\ngallerytree_table_filtered=Filtrato\ngallerytree_table_filtered_title=Opportunità negli USA e in Brasile\ngallerytree_table_filtered_column1=Cliente\ngallerytree_table_filtered_column2=Prodotto\ngallerytree_table_filtered_column3=Stato\ngallerytree_table_filtered_column4=Origine\ngallerytree_table_filtered_column5=Creazione\ngallerytree_table_filtered_column6=Previsto\ngallerytree_table_filtered_column7=Chiusura\ngallerytree_table_filtered_column8=Importo\ngallerytree_table_grouped=Raggruppato\ngallerytree_table_grouped_title=Sommario per paese\ngallerytree_table_grouped_column1=Paese\ngallerytree_table_grouped_column2=#Opps\ngallerytree_table_grouped_column3=Min\ngallerytree_table_grouped_column4=Max\ngallerytree_table_grouped_column5=Media\ngallerytree_table_grouped_column6=Totale\ngallerytree_table_default_dd=Predefinito (drill-down)\ngallerytree_table_default_dd_title=Elenco delle opportunità\ngallerytree_table_default_dd_column1=Paese\ngallerytree_table_default_dd_column2=Cliente\ngallerytree_table_default_dd_column3=Prodotto\ngallerytree_table_default_dd_column4=Venditore\ngallerytree_table_default_dd_column5=Stato\ngallerytree_table_default_dd_column6=Origine\ngallerytree_table_default_dd_column7=Creazione\ngallerytree_table_default_dd_column8=Previsto\ngallerytree_table_default_dd_column9=Chiusura\ngallerytree_table_default_dd_column10=Importo\ngallerytree_selector=Selettore\ngallerytree_selector_dropdown=A tendina\ngallerytree_selector_labels=Etichette\ngallerytree_selector_slider=Slider\ngallerytree_db=Dashboard\ngallerytree_db_salesgoals=Obiettivi di vendita\ngallerytree_db_salespipe=Pipeline di vendita\ngallerytree_db_salespcountry=Vendite per paese\ngallerytree_db_salesreps=Report di vendita\ngallerytree_db_expreps=Report spese\ngallerytree_db_clustermetrics=Metriche del cluster\ngallerywidget_unknown=Widget di galleria sconosciuto:\ngallerywidget_dataset_modif=Il set di dati è stato modificato. Aggiornamento della visualizzazione...\ngallerywidget_dataset_loaded=Set di dati caricato dal server [{0}, {1} Kb]\n\nmetrics_server_detail_title=Metriche del server (Verticale)\nmetrics_server_detail_backbutton_tt=Torna indietro\nmetrics_server_detail_modebutton_tt_viewtable=Visualizza come tabella\nmetrics_server_detail_modebutton_tt_viewcharts=Visualizza come grafici\nmetrics_server_detail_lasthour_summary=Sommario dell''ultima ora\nmetrics_server_detail_cpu_usage=Utilizzo CPU (%)\nmetrics_server_detail_mem_usage=Utilizzo memoria (Gb)\nmetrics_server_detail_netw_usage=Utilizzo rete (kbps)\nmetrics_server_detail_disk_usage=Utilizzo disco (Mb)\nmetrics_server_detail_live_procs=Processi attivi\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=Consumo memoria\nmetrics_server_detail_netw_title=Larghezza di banda di rete\nmetrics_server_detail_disk_title=Utilizzo disco\nmetrics_server_detail_disk_column1=Spazio disco libero\nmetrics_server_detail_disk_column2=Spazio disco utilizzato\nmetrics_server_detail_procs_running_title=Processi in esecuzione\nmetrics_server_detail_procs_running_column1=In esecuzione\nmetrics_server_detail_procs_sleeping_title=Processi in attesa\nmetrics_server_detail_procs_sleeping_column1=In attesa\nmetrics_server_detail_rt_table_title=Metriche {0} in tempo reale\nmetrics_server_detail_rt_table_column1=Minuto\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=Memoria utilizzata (Gb)\nmetrics_server_detail_rt_table_column5=Memoria libera (Gb)\nmetrics_server_detail_rt_table_column6=Upstream (kbps)\nmetrics_server_detail_rt_table_column7=Downstream (kbps)\nmetrics_server_detail_rt_table_column8=Processi in esecuzione\nmetrics_server_detail_rt_table_column9=Processi in attesa\nmetrics_server_detail_rt_table_column10=Disco utilizzato (Mb)\nmetrics_server_detail_rt_table_column11=Disco libero (Mb)\n\nmetrics_server_vert_title=Metriche del server (Verticale)\nmetrics_server_vert_default_tt=Fai clic per mostrare i dettagli del server\nmetrics_server_vert_cpu_tt=Utilizzo CPU (%)\nmetrics_server_vert_usedmem_tt=Memoria utilizzata (Gb)\nmetrics_server_vert_netbw_tt=Larghezza di banda di rete (kbps)\nmetrics_server_vert_procs_tt=Processi in esecuzione/in attesa\nmetrics_server_vert_disk_tt=Utilizzo disco (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=Consumo memoria\nmetrics_server_vert_netbw_title=Larghezza di banda di rete\nmetrics_server_vert_procs_title=Processi in esecuzione/in attesa\nmetrics_server_vert_du_title=Utilizzo disco\nmetrics_server_vert_du_free=Disco libero (Mb)\nmetrics_server_vert_du_used=Disco utilizzato (Mb)\nmetrics_server_vert_serverdown={0} è inattivo\n\nmetrics_cluster_title=Metriche del cluster\nmetrics_cluster_messages_heading=Inizializzazione dashboard...\nmetrics_cluster_metricselector_label=Metrica\nmetrics_cluster_chartselector_label=Tipo di grafico\nmetrics_cluster_metricselector_cpu=Utilizzo CPU (%)\nmetrics_cluster_metricselector_mem=Memoria\nmetrics_cluster_metricselector_disk=Disco\nmetrics_cluster_metricselector_netw=Rete\nmetrics_cluster_metricselector_proc=Processi\nmetrics_cluster_chartselector_bar=Barra\nmetrics_cluster_chartselector_line=Linea\nmetrics_cluster_chartselector_area=Area\nmetrics_cluster_column_cpu=Utilizzo CPU (%)\nmetrics_cluster_column_cpu_y=Utilizzo CPU (%)\nmetrics_cluster_column_df=Spazio disco libero\nmetrics_cluster_column_df_y=Gigabyte\nmetrics_cluster_column_du=Spazio disco utilizzato\nmetrics_cluster_column_du_y=Gigabyte\nmetrics_cluster_column_memf=Memoria libera\nmetrics_cluster_column_memf_y=Gigabyte\nmetrics_cluster_column_memu=Memoria utilizzata\nmetrics_cluster_column_memu_y=Gigabyte\nmetrics_cluster_column_procsrn=Processi in esecuzione\nmetrics_cluster_column_procsrn_y=Processi\nmetrics_cluster_column_procssl=Processi in attesa\nmetrics_cluster_column_procssl_y=Processi\nmetrics_cluster_column_netrx=Ricezione rete\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=Trasmissione rete\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=Tempo\n\nmetrics_rt_title=Metriche di sistema (Tempo reale)\nmetrics_rt_serverup= è attivo\nmetrics_rt_serverdown= è inattivo\n\nsales_bycountry_title=Vendite per paese\nsales_bycountry_bubble_title=Distribuzione delle opportunità per paese\nsales_bycountry_bubble_column1=Numero di opportunità\nsales_bycountry_bubble_column2=Probabilità media\nsales_bycountry_bubble_column3=Importo previsto\nsales_bycountry_map_title=Per paese\nsales_bycountry_map_column1=Importo totale\nsales_bycountry_table_title=Elenco delle opportunità\nsales_bycountry_table_column1=Paese\nsales_bycountry_table_column2=Cliente\nsales_bycountry_table_column3=Prodotto\nsales_bycountry_table_column4=Venditore\nsales_bycountry_table_column5=Stato\nsales_bycountry_table_column6=Creazione\nsales_bycountry_table_column7=Previsto\nsales_bycountry_table_column8=Chiusura\nsales_bycountry_table_column9=Importo\n\nsales_bydate_title=Pipeline di vendita\nsales_bydate_area_title=Pipeline prevista\nsales_bydate_area_column1=Importo\nsales_bydate_pie_years_title=Anno\nsales_bydate_pie_years_column1=Occorrenze\nsales_bydate_pie_quarters_title=Trimestre\nsales_bydate_pie_quarters_column1=Occorrenze\nsales_bydate_bar_weekday_title=Giorno della settimana\nsales_bydate_bar_weekday_column1=Occorrenze\nsales_bydate_pie_pipe_title=Pipeline\nsales_bydate_pie_pipe_column1=Numero di opportunità\nsales_bydate_table_title=Elenco delle opportunità\nsales_bydate_table_column1=Paese\nsales_bydate_table_column2=Cliente\nsales_bydate_table_column3=Prodotto\nsales_bydate_table_column4=Venditore\nsales_bydate_table_column5=Stato\nsales_bydate_table_column6=Importo\nsales_bydate_table_column7=Previsto\nsales_bydate_table_column8=Creazione\nsales_bydate_table_column9=Chiusura\nsales_bydate_selector_total=Totale\n\nsales_goals_title=Obiettivi di vendita\nsales_goals_meter_title=Obiettivo di vendita\nsales_goals_meter_column1=Importo totale\nsales_goals_line_title=Pipeline prevista\nsales_goals_line_column1=Data di chiusura\nsales_goals_line_column2=Importo totale\nsales_goals_line_column3=Importo previsto\nsales_goals_bar_byproduct_title=Per prodotto\nsales_goals_bar_byproduct_column1=Prodotto\nsales_goals_bar_byproduct_column2=Importo totale\nsales_goals_bar_byproduct_column3=Importo previsto\nsales_goals_bar_byempl_title=Per dipendente\nsales_goals_bar_byempl_column1=Dipendente\nsales_goals_bar_byempl_column2=Importo\nsales_goals_bubble_title=Distribuzione delle opportunità per paese\nsales_goals_bubble_column1=Numero di opportunità\nsales_goals_bubble_column2=Probabilità media\nsales_goals_bubble_column3=Importo previsto\n\nsales_tablereports_title=Report di vendita\nsales_tablereports_tab_byyear=Per anno\nsales_tablereports_tab_bycountry=Per paese\nsales_tablereports_tab_byproduct=Per prodotto\nsales_tablereports_tab_bysalesman=Per venditore\nsales_tablereports_all_title=Elenco delle opportunità\nsales_tablereports_all_column1=Paese\nsales_tablereports_all_column2=Cliente\nsales_tablereports_all_column3=Prodotto\nsales_tablereports_all_column4=Venditore\nsales_tablereports_all_column5=Stato\nsales_tablereports_all_column6=Creazione\nsales_tablereports_all_column7=Previsto\nsales_tablereports_all_column8=Chiusura\nsales_tablereports_all_column9=Importo\nsales_tablereports_bycountry_title=Sommario per paese\nsales_tablereports_bycountry_column1=Paese\nsales_tablereports_bycountry_column2=#Opportunità\nsales_tablereports_bycountry_column3=Minimo\nsales_tablereports_bycountry_column4=Massimo\nsales_tablereports_bycountry_column5=Media\nsales_tablereports_bycountry_column6=Totale\nsales_tablereports_byproduct_title=Sommario per prodotto\nsales_tablereports_byproduct_column1=Prodotto\nsales_tablereports_byproduct_column2=#Opportunità\nsales_tablereports_byproduct_column3=Minimo\nsales_tablereports_byproduct_column4=Massimo\nsales_tablereports_byproduct_column5=Media\nsales_tablereports_byproduct_column6=Totale\nsales_tablereports_bysalesman_title=Vendite per venditore\nsales_tablereports_bysalesman_column1=Venditore\nsales_tablereports_bysalesman_column2=#Opportunità\nsales_tablereports_bysalesman_column3=Minimo\nsales_tablereports_bysalesman_column4=Massimo\nsales_tablereports_bysalesman_column5=Media\nsales_tablereports_bysalesman_column6=Totale\nsales_tablereports_byyear_title=Sommario per anno\nsales_tablereports_byyear_column1=Data di creazione\nsales_tablereports_byyear_column2=#Opportunità\nsales_tablereports_byyear_column3=Minimo\nsales_tablereports_byyear_column4=Massimo\nsales_tablereports_byyear_column5=Media\nsales_tablereports_byyear_column6=Totale\n\nsalesopps_displayers_by_pipeline_title=Stato della pipeline\nsalesopps_displayers_by_status_title=Per stato\nsalesopps_displayers_by_salesman_title=Per venditore\nsalesopps_displayers_by_exp_pipeline_title=Importo previsto\nsalesopps_displayers_by_exp_pipeline_column1=Importo previsto\nsalesopps_displayers_by_product_title=Per prodotto\nsalesopps_displayers_by_product_column1=Importo totale\nsalesopps_displayers_by_country_title=Per paese\nsalesopps_displayers_by_country_column1=Importo totale\nsalesopps_displayers_country_summary_title=Sommario per paese\nsalesopps_displayers_country_summary_column1=PAESE\nsalesopps_displayers_country_summary_column2=TOTALE\nsalesopps_displayers_country_summary_column3=NUMERO\nsalesopps_displayers_country_summary_column4=MEDIA\nsalesopps_displayers_country_summary_column5=MINIMO\nsalesopps_displayers_country_summary_column6=MASSIMO\nsalesopps_displayers_all_list_title=Elenco delle opportunità\n\ncontent_manager_dashboard=dashboard\ncontent_manager_dashboards=dashboards\ncontent_manager_noDashboards=Nessuna dashboard\n\nHomeScreenView.title=Benvenuto in Dashbuilder\nHomeScreenView.subTitle=Dashbuilder offre strumenti per creare Business Dashboard. Seleziona uno strumento di seguito per iniziare\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_ja.properties",
    "content": "#\n# Copyright (C) 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nlogoBannerError=バナーをロードできませんでした。\nlogOut=ログアウト\nrole=ロール\nmenu_home=ホーム\nmenu_gallery=ギャラリー\nmenu_administration=管理\nmenu_security=セキュリティー\nmenu_dataset_authoring=データセット\nmenu_content_manager=コンテンツマネージャー\nmenu_extensions_apps=アプリケーション\nmenu_dashboards=ダッシュボード\nmenu_dashboards_salesdb=売上ダッシュボード\nmenu_dashboards_salesreports=売上レポート\nmenu_dashboards_new=- 新規 -\n\nhome_intro=Dashbuilder は汎用目的のダッシュボードおよびレポーティング web アプリケーションで、以下を可能にします。\nhome_upcoming=次回の機能\n\nhome_feature1=ダッシュボードの視覚設定およびパーソナル化\nhome_feature2=複数のグラフ作成ライブラリーを使用した異なるタイプの視覚化サポート\nhome_feature3=データセット定義作成のための UI エディター\nhome_feature4=グラフ作成視覚化の定義のための完全機能エディター\nhome_feature5=インタラクティブなレポート表の定義\nhome_feature6=異なるプロトコルによる外部システムからのデータ抽出\nhome_feature7=アナリティクスおよびリアルタイムの両ダッシュボードのサポート\nhome_feature8=D3 JS & Lienzo GWT をベースにした新規レンダラー\nhome_feature9=階層的 (入れ子グループ) ディスプレイヤータイプ: ツリー & パイ\nhome_feature10=複数のデータシリーズをサポート\nhome_feature11=豊富なモビリティーサポート\nhome_feature12=アラートおよび SLA 設定\nhome_feature13=RESTful API\n\nhome_arch=アーキテクチャー\nhome_arch1=図表レンダリング技術に関連付けられていません。プラグ可能なレンダラー。\nhome_arch2=データストレージに関連付けられていません。\nhome_arch3=CSV ファイル、データベース、または Java ジェネレーターからデータを読み取る機能。\nhome_arch4=分離されたクライアント層とサーバー層。純粋に軽量なクライアントダッシュボードを構築する機能。\nhome_arch5=パフォーマンス改善のためにクライアント上でデータセットをプッシュおよび処理する機能。\nhome_arch6a=ベースとなっているのは \nhome_arch6b=Web 上のリッチなワークベンチスタイルのアプリケーションを構築するためのフレームワーク。\n\nhome_furtherinfo=詳細情報は、プロジェクトの web ページを参照してください。\nhome_license=Licensed under the Apache License, Version 2.0\n\nnotification_dashboard_created={0} ダッシュボードが作成されました\nnotification_dashboard_deleted={0} ダッシュボードが削除されました\n\ndashboard_new_displayer=新規ディスプレイヤー\ndashboard_delete_popup_title=ダッシュボードの削除\ndashboard_delete_popup_content=このダッシュボードを削除してもよろしいですか?\ndashboard_delete_dashboard=ダッシュボードの削除\n\nsalesdbpersp_salessummary=売上サマリー\nsalesreportspersp_salesreports=売上レポート\n\nexpensesdb_title=費用レポート\n\nexpensesdb_tab_exp_evolution=費用の経過\nexpensesdb_tab_by_employee=従業員別\nexpensesdb_tab_all_exp=すべての費用\nexpensesdb_pie_title=オフィス別費用\nexpensesdb_pie_column1=オフィス\nexpensesdb_pie_column2=部門\nexpensesdb_pie_column3=従業員\nexpensesdb_bar_title=部門別費用\nexpensesdb_bar_column1=合計金額\nexpensesdb_bubble_title=従業員別費用\"\nexpensesdb_bubble_column1=合計\nexpensesdb_bubble_column2=平均\nexpensesdb_bubble_column3=従業員\nexpensesdb_bubble_column4=費用レポートの数\nexpensesdb_line_title=費用の経過\nexpensesdb_line_column1=合計金額\nexpensesdb_table_title=費用レポートのリスト\nexpensesdb_table_column1=オフィス\nexpensesdb_table_column2=部門\nexpensesdb_table_column3=従業員\nexpensesdb_table_column4=金額\nexpensesdb_table_column5=日付\n\ngallerytree_home=ギャラリー\ngallerytree_home_p1=ギャラリーには、Dashbuilder でサポートされる各種ディスプレイヤータイプがすべて実例として含まれています。「ダッシュボード」ノードには、複数のディスプレイヤーをフル機能が搭載されたエンドユーザーダッシュボードに統合する方法の例も含まれています。\ngallerytree_home_s2a=例はすべて、Dashbuilder の GWT ディスプレイヤー API を使って構築されます。内部機能やソースコードに興味がある場合は、\ngallerytree_home_s2b=GitHub で参照してください。\ngallerytree_home_ghublink=ファイル\ngallerytree_title=ギャラリーツリー\ngallerytree_bar=棒グラフ\ngallerytree_bar_horiz=水平\ngallerytree_bar_horiz_title=製品別\ngallerytree_bar_horiz_column1=合計金額\ngallerytree_bar_vert=垂直\ngallerytree_bar_vert_title=製品別\ngallerytree_bar_vert_column1=合計金額\ngallerytree_bar_vert_dd=ドリルダウン\ngallerytree_bar_vert_dd_title=パイプライン別/ステータス別/営業担当者別\ngallerytree_bar_vert_dd_column1=合計金額\ngallerytree_bar_vert_dd_column2=合計金額\ngallerytree_bar_vert_dd_column3=合計金額\ngallerytree_bar_multi=複数\ngallerytree_bar_stacked=スタック\ngallerytree_bar_multi_title=国別 (最小/最大/平均)\ngallerytree_bar_multi_column1=最小\ngallerytree_bar_multi_column2=最大\ngallerytree_bar_multi_column3=平均\ngallerytree_pie=円グラフ\ngallerytree_pie_basic=ベーシック\ngallerytree_pie_basic_title=ステータス\ngallerytree_pie_basic_column1=合計金額\ngallerytree_pie_3d=3D\ngallerytree_pie_3d_title=ステータス\ngallerytree_pie_3d_column1=合計金額\ngallerytree_pie_donut=ドーナツ\ngallerytree_pie_donut_title=ステータス\ngallerytree_pie_donut_column1=合計金額\ngallerytree_pie_dd=ドリルダウン\ngallerytree_pie_dd_title=パイプライン別/ステータス別/営業担当者別\ngallerytree_pie_dd_column1=合計金額\ngallerytree_pie_dd_column2=合計金額\ngallerytree_pie_dd_column3=合計金額\ngallerytree_line=折れ線グラフ\ngallerytree_line_basic=ベーシック\ngallerytree_line_basic_title=売上機会の経過\ngallerytree_line_basic_column1=終了日\ngallerytree_line_basic_column2=合計金額\ngallerytree_line_multi=複数\ngallerytree_line_multi_title=国別 (最小/最大/平均)\ngallerytree_line_multi_column1=最小\ngallerytree_line_multi_column2=最大\ngallerytree_line_multi_column3=平均\ngallerytree_line_multi_static=複数 (静的)\ngallerytree_line_multi_static_title=年間売上経過\ngallerytree_line_multi_static_column1=2014 年の売上\ngallerytree_line_multi_static_column2=2015 年の売上\ngallerytree_line_multi_static_column3=2016 年の売上\ngallerytree_area=エリアチャート\ngallerytree_area_basic=ベーシック\ngallerytree_area_basic_title=予測パイプライン\ngallerytree_area_basic_column1=予測金額\ngallerytree_area_fixed=固定 (月別)\ngallerytree_area_fixed_title=パイプライン (最良月)\ngallerytree_area_fixed_column1=終了日\ngallerytree_area_fixed_column2=1 か月あたりの予測金額\ngallerytree_area_dd=ドリルダウン\ngallerytree_area_dd_title=予測パイプライン\ngallerytree_area_dd_column1=終了日\ngallerytree_area_dd_column2=予測金額\ngallerytree_bubble=バブルチャート\ngallerytree_bubble_basic=ベーシック\ngallerytree_bubble_basic_title=国別の機会配分\ngallerytree_bubble_basic_column1=機会の数\ngallerytree_bubble_basic_column2=平均確率\ngallerytree_bubble_basic_column3=予測金額\ngallerytree_bubble_basic_column4=国\ngallerytree_meter=メーターチャート\ngallerytree_meter_basic=ベーシック\ngallerytree_meter_basic_title=売上目標\ngallerytree_meter_basic_column1=合計金額\ngallerytree_meter_multi=複数\ngallerytree_meter_multi_title=1 年あたりの予測金額\ngallerytree_meter_multi_column1=合計金額\ngallerytree_meter_multi_static=複数 (静的)\ngallerytree_meter_multi_static_title=心拍数\ngallerytree_meter_multi_static_column1=担当者\ngallerytree_meter_multi_static_column2=心拍数\ngallerytree_metrics=メトリックス\ngallerytree_metrics_basic=ベーシック\ngallerytree_metrics_basic_title=売上 (本四半期)\ngallerytree_metrics_basic_column1=売上 (本四半期)\ngallerytree_metrics_basic_static=基本 (静的)\ngallerytree_metrics_basic_static_title=ツイート!\ngallerytree_metrics_basic_static_column1=ツイート\ngallerytree_map=マップ\ngallerytree_map_region=マーカー\ngallerytree_map_region_title=国別\ngallerytree_map_region_column1=合計金額\ngallerytree_map_marker=リージョン\ngallerytree_map_marker_title=国別\ngallerytree_map_marker_column1=合計金額\ngallerytree_table=テーブルレポート\ngallerytree_table_basic=ベーシック\ngallerytree_table_basic_title=機会のリスト\ngallerytree_table_basic_column1=国\ngallerytree_table_basic_column2=顧客\ngallerytree_table_basic_column3=製品\ngallerytree_table_basic_column4=営業担当者\ngallerytree_table_basic_column5=状態\ngallerytree_table_basic_column6=ソース\ngallerytree_table_basic_column7=作成\ngallerytree_table_basic_column8=予測\ngallerytree_table_basic_column9=終了日\ngallerytree_table_basic_column10=金額\ngallerytree_table_filtered=フィルター\ngallerytree_table_filtered_title=米国 & ブラジルの機会\ngallerytree_table_filtered_column1=顧客\ngallerytree_table_filtered_column2=製品\ngallerytree_table_filtered_column3=状態\ngallerytree_table_filtered_column4=ソース\ngallerytree_table_filtered_column5=作成\ngallerytree_table_filtered_column6=予測\ngallerytree_table_filtered_column7=終了日\ngallerytree_table_filtered_column8=金額\ngallerytree_table_grouped=グループ化\ngallerytree_table_grouped_title=国サマリー\ngallerytree_table_grouped_column1=国\ngallerytree_table_grouped_column2=#機会\ngallerytree_table_grouped_column3=最小\ngallerytree_table_grouped_column4=最大\ngallerytree_table_grouped_column5=平均\ngallerytree_table_grouped_column6=合計\ngallerytree_table_default_dd=デフォルト (ドリルダウン)\ngallerytree_table_default_dd_title=機会のリスト\ngallerytree_table_default_dd_column1=国\ngallerytree_table_default_dd_column2=顧客\ngallerytree_table_default_dd_column3=製品\ngallerytree_table_default_dd_column4=営業担当者\ngallerytree_table_default_dd_column5=状態\ngallerytree_table_default_dd_column6=ソース\ngallerytree_table_default_dd_column7=作成\ngallerytree_table_default_dd_column8=予測\ngallerytree_table_default_dd_column9=終了日\ngallerytree_table_default_dd_column10=金額\ngallerytree_selector=セレクター\ngallerytree_selector_dropdown=ドロップダウン\ngallerytree_selector_labels=ラベル\ngallerytree_selector_slider=スライダー\ngallerytree_db=ダッシュボード\ngallerytree_db_salesgoals=売上目標\ngallerytree_db_salespipe=売上パイプライン\ngallerytree_db_salespcountry=国別売上\ngallerytree_db_salesreps=売上レポート\ngallerytree_db_expreps=費用レポート\ngallerytree_db_clustermetrics=クラスターメトリクス\ngallerywidget_unknown=未知のギャラリーウィジェット:\ngallerywidget_dataset_modif=データセットが変更されました。ビューを更新中 ...\ngallerywidget_dataset_loaded=データセットがサーバー [{0} からロードされました。{1} Kb]\n\nmetrics_server_detail_title=サーバーメトリクス (垂直)\nmetrics_server_detail_backbutton_tt=戻る\nmetrics_server_detail_modebutton_tt_viewtable=テーブルとして表示\nmetrics_server_detail_modebutton_tt_viewcharts=チャートとして表示\nmetrics_server_detail_lasthour_summary=過去 1 時間のサマリー\nmetrics_server_detail_cpu_usage=CPU 使用率 (%)\nmetrics_server_detail_mem_usage=メモリー使用量 (Gb)\nmetrics_server_detail_netw_usage=ネットワーク使用量 (kbps)\nmetrics_server_detail_disk_usage=ディスク使用量 (Mb)\nmetrics_server_detail_live_procs=ライブプロセス\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=メモリー消費\nmetrics_server_detail_netw_title=ネットワーク帯域幅\nmetrics_server_detail_disk_title=ディスク使用量\nmetrics_server_detail_disk_column1=空きディスク容量\nmetrics_server_detail_disk_column2=使用済みディスク容量\nmetrics_server_detail_procs_running_title=実行中プロセス\nmetrics_server_detail_procs_running_column1=実行中\nmetrics_server_detail_procs_sleeping_title=スリープ状態のプロセス\nmetrics_server_detail_procs_sleeping_column1=スリープ状態\nmetrics_server_detail_rt_table_title=リアルタイムの {0} メトリクス\nmetrics_server_detail_rt_table_column1=分\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=使用済みメモリー容量 (Gb)\nmetrics_server_detail_rt_table_column5=空きメモリー容量 (Gb)\nmetrics_server_detail_rt_table_column6=アップストリーム (kbps)\nmetrics_server_detail_rt_table_column7=ダウンストリーム (kbps)\nmetrics_server_detail_rt_table_column8=実行中プロセス\nmetrics_server_detail_rt_table_column9=スリープ状態のプロセス\nmetrics_server_detail_rt_table_column10=使用済みディスク容量 (Mb)\nmetrics_server_detail_rt_table_column11=空きディスク容量 (Mb)\n\nmetrics_server_vert_title=サーバーメトリクス (垂直)\nmetrics_server_vert_default_tt=サーバーの詳細を表示するためにクリック\nmetrics_server_vert_cpu_tt=CPU 使用率 (%)\nmetrics_server_vert_usedmem_tt=使用済みメモリー容量 (Gb)\nmetrics_server_vert_netbw_tt=ネットワーク BW (kbps)\nmetrics_server_vert_procs_tt=実行中/スリープ状態のプロセス\nmetrics_server_vert_disk_tt=ディスク使用量 (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=メモリー消費\nmetrics_server_vert_netbw_title=ネットワーク帯域幅\nmetrics_server_vert_procs_title=実行中/スリープ状態のプロセス\nmetrics_server_vert_du_title=ディスク使用量\nmetrics_server_vert_du_free=空きディスク容量 (Mb)\nmetrics_server_vert_du_used=使用済みディスク容量 (Mb)\nmetrics_server_vert_serverdown={0} がダウン\n\nmetrics_cluster_title=クラスターメトリクス\nmetrics_cluster_messages_heading=ダッシュボードの初期化中 ...\nmetrics_cluster_metricselector_label=メトリック\nmetrics_cluster_chartselector_label=チャートのタイプ\nmetrics_cluster_metricselector_cpu=CPU %\nmetrics_cluster_metricselector_mem=メモリー\nmetrics_cluster_metricselector_disk=ディスク\nmetrics_cluster_metricselector_netw=ネットワーク\nmetrics_cluster_metricselector_proc=プロセス\nmetrics_cluster_chartselector_bar=バー\nmetrics_cluster_chartselector_line=Line\nmetrics_cluster_chartselector_area=エリア\nmetrics_cluster_column_cpu=CPU %\nmetrics_cluster_column_cpu_y=CPU %\nmetrics_cluster_column_df=空きディスク容量\nmetrics_cluster_column_df_y=ギガバイト\nmetrics_cluster_column_du=使用済みディスク容量\nmetrics_cluster_column_du_y=ギガバイト\nmetrics_cluster_column_memf=空きメモリー容量\nmetrics_cluster_column_memf_y=ギガバイト\nmetrics_cluster_column_memu=使用済みメモリー容量\nmetrics_cluster_column_memu_y=ギガバイト\nmetrics_cluster_column_procsrn=実行中プロセス\nmetrics_cluster_column_procsrn_y=プロセス\nmetrics_cluster_column_procssl=スリープ状態のプロセス\nmetrics_cluster_column_procssl_y=プロセス\nmetrics_cluster_column_netrx=ネット。Rx\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=ネット。Tx\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=時間\n\nmetrics_rt_title=システムメトリクス (リアルタイム)\nmetrics_rt_serverup= 稼働\nmetrics_rt_serverdown= ダウン\n\nsales_bycountry_title=国別売上\nsales_bycountry_bubble_title=国別の機会配分\nsales_bycountry_bubble_column1=機会の数\nsales_bycountry_bubble_column2=平均確率\nsales_bycountry_bubble_column3=予測金額\nsales_bycountry_map_title=国別\nsales_bycountry_map_column1=合計金額\nsales_bycountry_table_title=機会のリスト\nsales_bycountry_table_column1=国\nsales_bycountry_table_column2=顧客\nsales_bycountry_table_column3=製品\nsales_bycountry_table_column4=営業担当者\nsales_bycountry_table_column5=状態\nsales_bycountry_table_column6=作成\nsales_bycountry_table_column7=予測\nsales_bycountry_table_column8=終了日\nsales_bycountry_table_column9=金額\nsales_bydate_title=売上パイプライン\nsales_bydate_area_title=予測パイプライン\nsales_bydate_area_column1=金額\nsales_bydate_pie_years_title=年\nsales_bydate_pie_years_column1=発生\nsales_bydate_pie_quarters_title=四半期\nsales_bydate_pie_quarters_column1=発生\nsales_bydate_bar_weekday_title=曜日\nsales_bydate_bar_weekday_column1=発生\nsales_bydate_pie_pipe_title=パイプライン\nsales_bydate_pie_pipe_column1=機会の数\nsales_bydate_table_title=機会のリスト\nsales_bydate_table_column1=国\nsales_bydate_table_column2=顧客\nsales_bydate_table_column3=製品\nsales_bydate_table_column4=営業担当者\nsales_bydate_table_column5=状態\nsales_bydate_table_column6=金額\nsales_bydate_table_column7=予測\nsales_bydate_table_column8=作成\nsales_bydate_table_column9=終了日\nsales_bydate_selector_total=合計\nsales_goals_title=売上目標\nsales_goals_meter_title=売上目標\nsales_goals_meter_column1=合計金額\nsales_goals_line_title=予測パイプライン\nsales_goals_line_column1=終了日\nsales_goals_line_column2=合計金額\nsales_goals_line_column3=予測金額\nsales_goals_bar_byproduct_title=製品別\nsales_goals_bar_byproduct_column1=製品\nsales_goals_bar_byproduct_column2=合計\nsales_goals_bar_byproduct_column3=予測\nsales_goals_bar_byempl_title=従業員別\nsales_goals_bar_byempl_column1=従業員\nsales_goals_bar_byempl_column2=金額\nsales_goals_bubble_title=国別の機会配分\nsales_goals_bubble_column1=機会の数\nsales_goals_bubble_column2=平均確率\nsales_goals_bubble_column3=予測金額\nsales_tablereports_title=売上レポート\nsales_tablereports_tab_byyear=年別\nsales_tablereports_tab_bycountry=国別\nsales_tablereports_tab_byproduct=製品別\nsales_tablereports_tab_bysalesman=営業担当者別\nsales_tablereports_all_title=機会のリスト\nsales_tablereports_all_column1=国\nsales_tablereports_all_column2=顧客\nsales_tablereports_all_column3=製品\nsales_tablereports_all_column4=営業担当者\nsales_tablereports_all_column5=状態\nsales_tablereports_all_column6=作成\nsales_tablereports_all_column7=予測\nsales_tablereports_all_column8=終了日\nsales_tablereports_all_column9=金額\nsales_tablereports_bycountry_title=国サマリー\nsales_tablereports_bycountry_column1=国\nsales_tablereports_bycountry_column2=#機会\nsales_tablereports_bycountry_column3=最小\nsales_tablereports_bycountry_column4=最大\nsales_tablereports_bycountry_column5=平均\nsales_tablereports_bycountry_column6=合計\nsales_tablereports_byproduct_title=製品サマリー\nsales_tablereports_byproduct_column1=製品\nsales_tablereports_byproduct_column2=#機会\nsales_tablereports_byproduct_column3=最小\nsales_tablereports_byproduct_column4=最大\nsales_tablereports_byproduct_column5=平均\nsales_tablereports_byproduct_column6=合計\nsales_tablereports_bysalesman_title=担当者別売上\nsales_tablereports_bysalesman_column1=営業担当者\nsales_tablereports_bysalesman_column2=#機会\nsales_tablereports_bysalesman_column3=最小\nsales_tablereports_bysalesman_column4=最大\nsales_tablereports_bysalesman_column5=平均\nsales_tablereports_bysalesman_column6=合計\nsales_tablereports_byyear_title=年度サマリー\nsales_tablereports_byyear_column1=作成日\nsales_tablereports_byyear_column2=#機会\nsales_tablereports_byyear_column3=最小\nsales_tablereports_byyear_column4=最大\nsales_tablereports_byyear_column5=平均\nsales_tablereports_byyear_column6=合計\n\nsalesopps_displayers_by_pipeline_title=パイプラインステータス\nsalesopps_displayers_by_status_title=ステータス\nsalesopps_displayers_by_salesman_title=営業担当者別\nsalesopps_displayers_by_exp_pipeline_title=予測金額\nsalesopps_displayers_by_exp_pipeline_column1=予測金額\nsalesopps_displayers_by_product_title=製品別\nsalesopps_displayers_by_product_column1=合計金額\nsalesopps_displayers_by_country_title=国別\nsalesopps_displayers_by_country_column1=合計金額\nsalesopps_displayers_country_summary_title=国サマリー\nsalesopps_displayers_country_summary_column1=国\nsalesopps_displayers_country_summary_column2=合計\nsalesopps_displayers_country_summary_column3=数値\nsalesopps_displayers_country_summary_column4=平均\nsalesopps_displayers_country_summary_column5=最小\nsalesopps_displayers_country_summary_column6=最大\nsalesopps_displayers_all_list_title=機会のリスト\n\ncontent_manager_dashboard=ダッシュボード\ncontent_manager_dashboards=ダッシュボード\ncontent_manager_noDashboards=ダッシュボードがありません\n\nHomeScreenView.title=Dashbuilder にようこそ\nHomeScreenView.subTitle=Dashbuilder には、Business Dashboards を作成するツールが含まれます。開始するには、以下からツールを選択します。"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_pt_BR.properties",
    "content": "logoBannerError=Falha ao carregar o banner.\nlogOut=Sair\nrole=Função\nmenu_home=Página Principal\nmenu_gallery=Galería\nmenu_extensions_apps=Aplicativos\nmenu_dashboards=Painéis\nmenu_dashboards_salesdb=Painel de vendas\nmenu_dashboards_salesreports=Relatório de Vendas\nmenu_dashboards_new=- Novo - \nhome_intro=O Dashbuilder serve como um painel de uso geral e um aplicativo web para notificações que permite\\: \nhome_upcoming=Recursos futuros\nhome_feature1=Configuração visual e personalização de paineis \nhome_feature2=Suporte para tipos diferentes de visualização usando diversas bibliotecas de gráficos \nhome_feature3=Editor da IU para a criação de definições de conjuntos de dados \nhome_feature4=Editor com todos os recursos para a definição das visualizações de gráficos \nhome_feature5=Definição das tabelas interativas de relatórios\nhome_feature6=Extração de dados com sistemas externos, através de diferentes protocolos\nhome_feature7=Suporte tanto para paineis de análise quanto de tempo real \nhome_feature8=Novos renderizadores baseados em D3 JS & Lienzo GWT\nhome_feature9=Tipos de exibidores (grupo aninhado) hierárquicos\\: Árvore & Gráfico de Setores\nhome_feature10=Suporte para múltiplas séries de dados \nhome_feature11=Suporte para mobilidade avançada\nhome_feature12=Configuração de SLA e alertas\nhome_feature13=API RESTful\nhome_arch=Arquitetura\nhome_arch1=Não associada a nenhuma tecnologia de renderização de gráficos. Renderizadores conectáveis. \nhome_arch2=Não associada a nenhum armazenamento de dados. \nhome_arch3=Abilidade de ler dados de\\: arquivos CSV, bancos de dados, pesquisa elástica ou geradores de Java.  \nhome_arch4=Camadas de servidor & cliente separadas. Abilidade de construir paineis do cliente leves e puros. \nhome_arch5=Abilidade de extrair & lidar com conjuntos de dados no painel do cliente para um melhor desempenho. \nhome_arch6a=Baseado no\nhome_arch6b=, um framework para a criação de aplicativos baseado em workbench de estilo avançado na web. \nhome_furtherinfo=Para mais informações, visite o site do projeto\nhome_license=Licenciado nos termos da Apache License, Versão 2.0\nnotification_dashboard_created={0} painéis criados\nnotification_dashboard_deleted={0} painéis removidos\ndashboard_new_displayer=Novo Exibidor\ndashboard_delete_popup_title=Remover painel\ndashboard_delete_popup_content=Você tem certeza que deseja excluir este painel?\ndashboard_delete_dashboard=Remover painel\nsalesdbpersp_salessummary=Sumário de Vendas\nsalesreportspersp_salesreports=Relatório de Vendas\nexpensesdb_title=Relatório de despesas\nexpensesdb_tab_exp_evolution=Evolução de Despesas\nexpensesdb_tab_by_employee=Por Funcionário\nexpensesdb_tab_all_exp=Todas as Despesas\nexpensesdb_pie_title=Despesas por Escritório\nexpensesdb_pie_column1=Escritório\nexpensesdb_pie_column2=Departamento\nexpensesdb_pie_column3=Funcionário\nexpensesdb_bar_title=Despesas por Departamento\nexpensesdb_bar_column1=Quantia Total\nexpensesdb_bubble_title=Despesas por Funcionário\"\nexpensesdb_bubble_column1=Total\nexpensesdb_bubble_column2=Média\nexpensesdb_bubble_column3=Funcionário\nexpensesdb_bubble_column4=Número de relatórios de despesas\nexpensesdb_line_title=Evolução de despesas\nexpensesdb_line_column1=Quantia Total\nexpensesdb_table_title=Lista de relatório de despesas\nexpensesdb_table_column1=Escritório\nexpensesdb_table_column2=Departamento\nexpensesdb_table_column3=Funcionário\nexpensesdb_table_column4=Quantia\nexpensesdb_table_column5=Data\ngallerytree_home=Galeria\ngallerytree_home_p1=A galeria contém exemplos de todos os tipos de exibidores com suporte no Dashbuilder. O nó \"Paineis\" (dashboards) também contém exemplos de como combinar vários exibidores em paineis com todos os recursos para o usuário final.\ngallerytree_home_s2a=Todos os exemplos são criados usando a API do Exibidor GWT do Dashbuilder. Caso esteja interessado no funcionamento interno ou gostaria de ver como é o código fonte, veja o seguinte \ngallerytree_home_s2b=no GitHub.\ngallerytree_home_ghublink=arquivo\ngallerytree_title=Árvore da Galeria\ngallerytree_bar=Gráfico de Barra\ngallerytree_bar_horiz=Horizontal\ngallerytree_bar_horiz_title=Pelo produto\ngallerytree_bar_horiz_column1=Quantia Total\ngallerytree_bar_vert=Vertical\ngallerytree_bar_vert_title=Pelo produto\ngallerytree_bar_vert_column1=Quantia Total\ngallerytree_bar_vert_dd=Drill-down\ngallerytree_bar_vert_dd_title=Por Pipeline/Status/Vendedor\ngallerytree_bar_vert_dd_column1=Quantia Total\ngallerytree_bar_vert_dd_column2=Quantia Total\ngallerytree_bar_vert_dd_column3=Quantia Total\ngallerytree_bar_multi=Múltiplo\ngallerytree_bar_stacked=Empilhado\ngallerytree_bar_multi_title=Por país (min/max/média)\ngallerytree_bar_multi_column1=Min\ngallerytree_bar_multi_column2=Max\ngallerytree_bar_multi_column3=Média\ngallerytree_pie=Gráfico torta\ngallerytree_pie_basic=Básico\ngallerytree_pie_basic_title=Por status\ngallerytree_pie_basic_column1=Quantia Total\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=Por status\ngallerytree_pie_3d_column1=Quantia Total\ngallerytree_pie_donut=Donut\ngallerytree_pie_donut_title=Por status\ngallerytree_pie_donut_column1=Quantia Total\ngallerytree_pie_dd=Drill-down\ngallerytree_pie_dd_title=Por Pipeline/Status/Vendedor\ngallerytree_pie_dd_column1=Quantia Total\ngallerytree_pie_dd_column2=Quantia Total\ngallerytree_pie_dd_column3=Quantia Total\ngallerytree_line=Gráfico de linha\ngallerytree_line_basic=Básico\ngallerytree_line_basic_title=Evolução das oportunidades de vendas\ngallerytree_line_basic_column1=Data de encerramento\ngallerytree_line_basic_column2=Quantia Total\ngallerytree_line_multi=Múltiplo\ngallerytree_line_multi_title=Por país (min/max/média)\ngallerytree_line_multi_column1=Min\ngallerytree_line_multi_column2=Max\ngallerytree_line_multi_column3=Média\ngallerytree_line_multi_static=Múltiplo (estático)\ngallerytree_line_multi_static_title=Evolução de vendas Por Ano\ngallerytree_line_multi_static_column1=Vendas em 2014\ngallerytree_line_multi_static_column2=Vendas em 2015\ngallerytree_line_multi_static_column3=Vendas em 2016\ngallerytree_area=Gráfico de Área\ngallerytree_area_basic=Básico\ngallerytree_area_basic_title=Pipeline Esperada\ngallerytree_area_basic_column1=Quantia esperada\ngallerytree_area_fixed=Fixo (por mês)\ngallerytree_area_fixed_title=Pipeline (melhor mês)\ngallerytree_area_fixed_column1=Data de encerramento\ngallerytree_area_fixed_column2=Quantia esperada por mês\ngallerytree_area_dd=Drill-down\ngallerytree_area_dd_title=Pipeline Esperada\ngallerytree_area_dd_column1=Data de encerramento\ngallerytree_area_dd_column2=Quantia esperada\ngallerytree_bubble=Gráfico Bubble\ngallerytree_bubble_basic=Básico\ngallerytree_bubble_basic_title=Oportunidades de distribuição por país\ngallerytree_bubble_basic_column1=número de oportunidades\ngallerytree_bubble_basic_column2=Probabilidade de média\ngallerytree_bubble_basic_column3=Quantia esperada\ngallerytree_bubble_basic_column4=País\ngallerytree_meter=Gráfico medidor\ngallerytree_meter_basic=Básico\ngallerytree_meter_basic_title=Objetivo de Vendas\ngallerytree_meter_basic_column1=Quantia Total\ngallerytree_meter_multi=Múltiplo\ngallerytree_meter_multi_title=Quantia esperada por ano\ngallerytree_meter_multi_column1=Quantia Total\ngallerytree_meter_multi_static=Múltiplo (estático)\ngallerytree_meter_multi_static_title=Rítmo cardíaco\ngallerytree_meter_multi_static_column1=Pessoa\ngallerytree_meter_multi_static_column2=Rítmo cardíaco\ngallerytree_metrics=Métricas\ngallerytree_metrics_basic=Básico\ngallerytree_metrics_basic_title=Vendas (trimestre atual)\ngallerytree_metrics_basic_column1=Vendas (trimestre atual)\ngallerytree_metrics_basic_static=Básico (estático)\ngallerytree_metrics_basic_static_title=Tweets\\!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=Mapa\ngallerytree_map_region=Marcadores\ngallerytree_map_region_title=Por país\ngallerytree_map_region_column1=Quantia Total\ngallerytree_map_marker=Regiões\ngallerytree_map_marker_title=Por país\ngallerytree_map_marker_column1=Quantia Total\ngallerytree_table=Tabela de relatório\ngallerytree_table_basic=Básico\ngallerytree_table_basic_title=Lista de oportunidades\ngallerytree_table_basic_column1=País\ngallerytree_table_basic_column2=Cliente\ngallerytree_table_basic_column3=Produto\ngallerytree_table_basic_column4=Vendedor\ngallerytree_table_basic_column5=Status\ngallerytree_table_basic_column6=Fonte\ngallerytree_table_basic_column7=Criação\ngallerytree_table_basic_column8=Esperada\ngallerytree_table_basic_column9=Encerramento\ngallerytree_table_basic_column10=Quantia\ngallerytree_table_filtered=Filtrado\ngallerytree_table_filtered_title=Oportunidades no EUA & Brasil\ngallerytree_table_filtered_column1=Cliente\ngallerytree_table_filtered_column2=Produto\ngallerytree_table_filtered_column3=Status\ngallerytree_table_filtered_column4=Fonte\ngallerytree_table_filtered_column5=Criação\ngallerytree_table_filtered_column6=Esperada\ngallerytree_table_filtered_column7=Encerramento\ngallerytree_table_filtered_column8=Quantia\ngallerytree_table_grouped=Agrupado\ngallerytree_table_grouped_title=Sumário do País\ngallerytree_table_grouped_column1=País\ngallerytree_table_grouped_column2=\\#Opps\ngallerytree_table_grouped_column3=Min\ngallerytree_table_grouped_column4=Max\ngallerytree_table_grouped_column5=Média\ngallerytree_table_grouped_column6=Total\ngallerytree_table_default_dd=Default (drill-down)\ngallerytree_table_default_dd_title=Lista de oportunidades\ngallerytree_table_default_dd_column1=País\ngallerytree_table_default_dd_column2=Cliente\ngallerytree_table_default_dd_column3=Produto\ngallerytree_table_default_dd_column4=Vendedor\ngallerytree_table_default_dd_column5=Status\ngallerytree_table_default_dd_column6=Fonte\ngallerytree_table_default_dd_column7=Criação\ngallerytree_table_default_dd_column8=Esperada\ngallerytree_table_default_dd_column9=Encerramento\ngallerytree_table_default_dd_column10=Quantia\ngallerytree_db=Painéis\ngallerytree_db_salesgoals=Objetivo de Vendas\ngallerytree_db_salespipe=Pipeline de Vendas\ngallerytree_db_salespcountry=Vendas por país\ngallerytree_db_salesreps=Relatório de Vendas\ngallerytree_db_expreps=Relatório de despesas\ngallerytree_db_clustermetrics=Métricas de cluster\ngallerywidget_unknown=Aplicativo de galeria desconhecido\ngallerywidget_dataset_modif=Os dados determinados foram modificados. Atualizando a visualização...\ngallerywidget_dataset_loaded=Data set carregado a partir do servidor [{0}, {1} Kb]\nmetrics_server_detail_title=Métricas de Servidor ( Vertical)\nmetrics_server_detail_backbutton_tt=Retornar\nmetrics_server_detail_modebutton_tt_viewtable=Visualizar como tabela\nmetrics_server_detail_modebutton_tt_viewcharts=Visualizar como gráficos\nmetrics_server_detail_lasthour_summary=Sumário da última hora \nmetrics_server_detail_cpu_usage=Uso da CPU (%)\nmetrics_server_detail_mem_usage=Uso da memória (Gb)\nmetrics_server_detail_netw_usage=Uso de rede (kbps)\nmetrics_server_detail_disk_usage=Uso de disco (Mb)\nmetrics_server_detail_live_procs=Vendedor\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=Consumo de memória\nmetrics_server_detail_netw_title=Largura de Banda da Rede\nmetrics_server_detail_disk_title=Uso de disco \nmetrics_server_detail_disk_column1=Espaço no disco livre\nmetrics_server_detail_disk_column2=Espaço usado no disco \nmetrics_server_detail_procs_running_title=Processos de execução\nmetrics_server_detail_procs_running_column1=Execução\nmetrics_server_detail_procs_sleeping_title=Processos de espera\nmetrics_server_detail_procs_sleeping_column1=Em espera\nmetrics_server_detail_rt_table_title=Métrica {0} tempo real\nmetrics_server_detail_rt_table_column1=Minuto\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=Memória usada\nmetrics_server_detail_rt_table_column5=Memória livre (Gb)\nmetrics_server_detail_rt_table_column6=Upstream (kbps)\nmetrics_server_detail_rt_table_column7=Downstream (kbps)\nmetrics_server_detail_rt_table_column8=Processos de execução\nmetrics_server_detail_rt_table_column9=Processos de espera\nmetrics_server_detail_rt_table_column10=Disco usado (Mb)\nmetrics_server_detail_rt_table_column11=Disco livre (Mb)\nmetrics_server_vert_title=Métricas de servidor (Vertical)\nmetrics_server_vert_default_tt=Clique para exibir detalhes de servidor\nmetrics_server_vert_cpu_tt=Uso de CPU (%)\nmetrics_server_vert_usedmem_tt=Memória usada (Gb)\nmetrics_server_vert_netbw_tt=Rede BW (kbps)\nmetrics_server_vert_procs_tt=Processos de Execução/Em espera\nmetrics_server_vert_disk_tt=Uso de disco (Mb)\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=Consumo de memória\nmetrics_server_vert_netbw_title=Largura de Banda da Rede\nmetrics_server_vert_procs_title=Processos de Execução/Em espera\nmetrics_server_vert_du_title=Uso de disco \nmetrics_server_vert_du_free=Disco livre (Mb)\nmetrics_server_vert_du_used=Disco usado (Mb)\nmetrics_server_vert_serverdown={0} está baixo\nmetrics_cluster_title=Métricas de cluster\nmetrics_cluster_messages_heading=Inicializando o Painel\nmetrics_cluster_metricselector_label=Métrica\nmetrics_cluster_chartselector_label=Tipo de Gráfico\nmetrics_cluster_metricselector_cpu=CPU %\nmetrics_cluster_metricselector_mem=Memória\nmetrics_cluster_metricselector_disk=Disco\nmetrics_cluster_metricselector_netw=Rede\nmetrics_cluster_metricselector_proc=Processos\nmetrics_cluster_chartselector_bar=Barra\nmetrics_cluster_chartselector_line=Linha\nmetrics_cluster_chartselector_area=Área\nmetrics_cluster_column_cpu=CPU %\nmetrics_cluster_column_cpu_y=CPU %\nmetrics_cluster_column_df=Disco livre\nmetrics_cluster_column_df_y=Gigabytes\nmetrics_cluster_column_du=Uso de disco \nmetrics_cluster_column_du_y=Gigabytes\nmetrics_cluster_column_memf=Memória livre\nmetrics_cluster_column_memf_y=Gigabytes\nmetrics_cluster_column_memu=Memória usada\nmetrics_cluster_column_memu_y=Gigabytes\nmetrics_cluster_column_procsrn=Execução de processos\nmetrics_cluster_column_procsrn_y=Processos\nmetrics_cluster_column_procssl=Processos Em espera\nmetrics_cluster_column_procssl_y=Processos\nmetrics_cluster_column_netrx=Net. Rx\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=Net. Tx\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=Tempo\nmetrics_rt_title=Métricas de Sistema (Tempo Real)\nmetrics_rt_serverup=está ativado\nmetrics_rt_serverdown=está desativado\nsales_bycountry_title=Vendas por país\nsales_bycountry_bubble_title=Oportunidades de distribuição por país\nsales_bycountry_bubble_column1=Número de oportunidades\nsales_bycountry_bubble_column2=Probabilidade de média\nsales_bycountry_bubble_column3=Quantia esperada\nsales_bycountry_map_title=Por país\nsales_bycountry_map_column1=Quantia Total\nsales_bycountry_table_title=Lista de oportunidades\nsales_bycountry_table_column1=País\nsales_bycountry_table_column2=Cliente\nsales_bycountry_table_column3=Produto\nsales_bycountry_table_column4=Vendedor\nsales_bycountry_table_column5=Status\nsales_bycountry_table_column6=Criação\nsales_bycountry_table_column7=Esperada\nsales_bycountry_table_column8=Encerramento\nsales_bycountry_table_column9=Quantia\nsales_bydate_title=Pipeline de Vendas\nsales_bydate_area_title=Pipeline esperada\nsales_bydate_area_column1=Quantia\nsales_bydate_pie_years_title=Ano\nsales_bydate_pie_years_column1=Ocorrências\nsales_bydate_pie_quarters_title=Trimestre\nsales_bydate_pie_quarters_column1=Ocorrências\nsales_bydate_bar_weekday_title=Dia da semana\nsales_bydate_bar_weekday_column1=Ocorrências\nsales_bydate_pie_pipe_title=Pipeline\nsales_bydate_pie_pipe_column1=Número de oportunidades\nsales_bydate_table_title=Lista de oportunidades\nsales_bydate_table_column1=País\nsales_bydate_table_column2=Cliente\nsales_bydate_table_column3=Produto\nsales_bydate_table_column4=Vendedor\nsales_bydate_table_column5=Status\nsales_bydate_table_column6=Quantia\nsales_bydate_table_column7=Esperada\nsales_bydate_table_column8=Criação\nsales_bydate_table_column9=Encerramento\nsales_bydate_selector_total=Total\nsales_goals_title=Objetivo de Vendas\nsales_goals_meter_title=Objetivo de Vendas\nsales_goals_meter_column1=Quantia Total\nsales_goals_line_title=Pipeline esperada\nsales_goals_line_column1=Data de encerramento\nsales_goals_line_column2=Quantia Total\nsales_goals_line_column3=Quantia esperada\nsales_goals_bar_byproduct_title=Pelo produto\nsales_goals_bar_byproduct_column1=Produto\nsales_goals_bar_byproduct_column2=Total\nsales_goals_bar_byproduct_column3=Esperada\nsales_goals_bar_byempl_title=Por Funcionário\nsales_goals_bar_byempl_column1=Funcionário\nsales_goals_bar_byempl_column2=Quantia\nsales_goals_bubble_title=Oportunidades de distribuição por país\nsales_goals_bubble_column1=número de oportunidades\nsales_goals_bubble_column2=Probabilidade de média\nsales_goals_bubble_column3=Quantia esperada\nsales_tablereports_title=Relatório de Vendas\nsales_tablereports_tab_byyear=Por ano\nsales_tablereports_tab_bycountry=Por país\nsales_tablereports_tab_byproduct=Pelo produto\nsales_tablereports_tab_bysalesman=Por pessoa de vendas\nsales_tablereports_all_title=Lista de oportunidades\nsales_tablereports_all_column1=País\nsales_tablereports_all_column2=Cliente\nsales_tablereports_all_column3=Produto\nsales_tablereports_all_column4=Vendedor\nsales_tablereports_all_column5=Status\nsales_tablereports_all_column6=Criação\nsales_tablereports_all_column7=Esperada\nsales_tablereports_all_column8=Encerramento\nsales_tablereports_all_column9=Quantia\nsales_tablereports_bycountry_title=Sumário do País\nsales_tablereports_bycountry_column1=País\nsales_tablereports_bycountry_column2=\\#Oportunidades\nsales_tablereports_bycountry_column3=Min\nsales_tablereports_bycountry_column4=Max\nsales_tablereports_bycountry_column5=Média\nsales_tablereports_bycountry_column6=Total\nsales_tablereports_byproduct_title=Sumário do Produto\nsales_tablereports_byproduct_column1=Produto\nsales_tablereports_byproduct_column2=\\#Oportunidades\nsales_tablereports_byproduct_column3=Min\nsales_tablereports_byproduct_column4=Max\nsales_tablereports_byproduct_column5=Média\nsales_tablereports_byproduct_column6=Total\nsales_tablereports_bysalesman_title=Vendas por pessoa\nsales_tablereports_bysalesman_column1=Pessoa de vendas\nsales_tablereports_bysalesman_column2=\\#Oportunidades\nsales_tablereports_bysalesman_column3=Min\nsales_tablereports_bysalesman_column4=Max\nsales_tablereports_bysalesman_column5=Média\nsales_tablereports_bysalesman_column6=Total\nsales_tablereports_byyear_title=Sumário do ano\nsales_tablereports_byyear_column1=Data de criação\nsales_tablereports_byyear_column2=\\#Oportunidades\nsales_tablereports_byyear_column3=Min\nsales_tablereports_byyear_column4=Max\nsales_tablereports_byyear_column5=Média\nsales_tablereports_byyear_column6=Total\nsalesopps_displayers_by_pipeline_title=Status do Pipeline\nsalesopps_displayers_by_status_title=Por status\nsalesopps_displayers_by_salesman_title=Por pessoa de vendas\nsalesopps_displayers_by_exp_pipeline_title=Quantia esperada\nsalesopps_displayers_by_exp_pipeline_column1=Quantia esperada\nsalesopps_displayers_by_product_title=Pelo produto\nsalesopps_displayers_by_product_column1=Quantia Total\nsalesopps_displayers_by_country_title=Por país\nsalesopps_displayers_by_country_column1=Quantia Total\nsalesopps_displayers_country_summary_title=Sumário do País\nsalesopps_displayers_country_summary_column1=PAÍS\nsalesopps_displayers_country_summary_column2=TOTAL\nsalesopps_displayers_country_summary_column3=NÚMERO\nsalesopps_displayers_country_summary_column4=MÉDIA\nsalesopps_displayers_country_summary_column5=MIN\nsalesopps_displayers_country_summary_column6=MAX\nsalesopps_displayers_all_list_title=Lista de oportunidades\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/AppConstants_zh_CN.properties",
    "content": "logoBannerError=加载标题失败。\nlogOut=退出\nrole=角色\nmenu_home=主目录\nmenu_gallery=图库\nmenu_extensions_apps=应用程序\nmenu_dashboards=仪表板\nmenu_dashboards_salesdb=销售仪表板\nmenu_dashboards_salesreports=销售报告\nmenu_dashboards_new=- 新建 -\nhome_intro=Dashbuilder 是仪表板的常规目的，同时报告允许以下功能的 web 应用程序：\nhome_upcoming=即将推出的功能\nhome_feature1=仪表板的可视化配置及个性化\nhome_feature2=支持使用几个图标库进行不同类型的可视化\nhome_feature3=用户数据集定义的 UI 编辑器\nhome_feature4=用于图表可视化的完整配置的编辑器\nhome_feature5=互动式报告表格定义\nhome_feature6=从外部系统通过不同协议进行数据提取\nhome_feature7=支持分析及实时仪表板\nhome_feature8=基于 D3 JS & Lienzo GWT 的新呈现器\nhome_feature9=分层（嵌套组）显示器类型：树状 & 饼状\nhome_feature10=支持多个数据系列\nhome_feature11=丰富的移动性支持\nhome_feature12=警告及 SLA 配置\nhome_feature13=RESTful API\nhome_arch=架构\nhome_arch1=不依赖任何图表呈现技术。可插拔呈现器。\nhome_arch2=不依赖任何数据存储。\nhome_arch3=可读取的数据格式：CSV 文件、数据库、弹性搜索或 Java 生成器。\nhome_arch4=分离的客户端 & 服务器层。构建单纯轻加权客户端仪表板的能力。\nhome_arch5=在客户端中 push & 处理数据集以获得更好性能的能力。\nhome_arch6a=基于\nhome_arch6b=在网页中构建有丰富 workbench 形式应用程序的框架。\nhome_furtherinfo=详情请查看 Apache License，版本 2.0.\nhome_license=采用 Apache License 版本 2.0 注册。\nnotification_dashboard_created=创建了 {0} 仪表板\nnotification_dashboard_deleted=删除了 {0} 仪表板\ndashboard_new_displayer=新建显示屏\ndashboard_delete_popup_title=删除仪表板\ndashboard_delete_popup_content=您确定要删除这个仪表板吗？\ndashboard_delete_dashboard=删除仪表板\nsalesdbpersp_salessummary=销售总览\nsalesreportspersp_salesreports=销售报告\nexpensesdb_title=费用报表\nexpensesdb_tab_exp_evolution=费用评估\nexpensesdb_tab_by_employee=按雇员\nexpensesdb_tab_all_exp=所有费用\nexpensesdb_pie_title=办公室费用\nexpensesdb_pie_column1=办公室\nexpensesdb_pie_column2=部门\nexpensesdb_pie_column3=雇员\nexpensesdb_bar_title=部门费用\nexpensesdb_bar_column1=总金额\nexpensesdb_bubble_title=雇员费用\nexpensesdb_bubble_column1=总计\nexpensesdb_bubble_column2=平均\nexpensesdb_bubble_column3=雇员\nexpensesdb_bubble_column4=费用报表的数量\nexpensesdb_line_title=费用评估\nexpensesdb_line_column1=总金额\nexpensesdb_table_title=费用报表列表\nexpensesdb_table_column1=办公室\nexpensesdb_table_column2=部门\nexpensesdb_table_column3=雇员\nexpensesdb_table_column4=金额\nexpensesdb_table_column5=日期\ngallerytree_home=图库\ngallerytree_home_p1=该图库中包含 Dashbuilder 支持的所有不同显示器类型的实例。节点 \"Dashboards\" 还包含一组如何将不同显示器组合为全功能终端用户仪表板的示例。\ngallerytree_home_s2a=所有示例均使用 Dashbuilder 的 GWT Displayer API 构建。如果您有兴趣或向了解源代码，请查看\ngallerytree_home_s2b=\\ GitHub。\ngallerytree_home_ghublink=文件\ngallerytree_title=图库树\ngallerytree_bar=柱状图\ngallerytree_bar_horiz=水平视图\ngallerytree_bar_horiz_title=按产品\ngallerytree_bar_horiz_column1=总金额\ngallerytree_bar_vert=垂直视图\ngallerytree_bar_vert_title=按产品\ngallerytree_bar_vert_column1=总金额\ngallerytree_bar_vert_dd=查看明细\ngallerytree_bar_vert_dd_title=按渠道/状态/销售人员\ngallerytree_bar_vert_dd_column1=总金额\ngallerytree_bar_vert_dd_column2=总金额\ngallerytree_bar_vert_dd_column3=总金额\ngallerytree_bar_multi=多重\ngallerytree_bar_stacked=堆叠图\ngallerytree_bar_multi_title=按国家（最小/最大/平均）\ngallerytree_bar_multi_column1=最小值\ngallerytree_bar_multi_column2=最大值\ngallerytree_bar_multi_column3=平均值\ngallerytree_pie=饼图\ngallerytree_pie_basic=基本视图\ngallerytree_pie_basic_title=按照状态\ngallerytree_pie_basic_column1=总金额\ngallerytree_pie_3d=3d\ngallerytree_pie_3d_title=按照状态\ngallerytree_pie_3d_column1=总金额\ngallerytree_pie_donut=圈图\ngallerytree_pie_donut_title=按照状态\ngallerytree_pie_donut_column1=总金额\ngallerytree_pie_dd=查看明细\ngallerytree_pie_dd_title=按渠道/状态/销售人员\ngallerytree_pie_dd_column1=总金额\ngallerytree_pie_dd_column2=总金额\ngallerytree_pie_dd_column3=总金额\ngallerytree_line=线型图\ngallerytree_line_basic=基本视图\ngallerytree_line_basic_title=销售机会评估\ngallerytree_line_basic_column1=结束日期\ngallerytree_line_basic_column2=总金额\ngallerytree_line_multi=多重\ngallerytree_line_multi_title=按国家（最小/最大/平均）\ngallerytree_line_multi_column1=最小值\ngallerytree_line_multi_column2=最大值\ngallerytree_line_multi_column3=平均值\ngallerytree_line_multi_static=多重（静态）\ngallerytree_line_multi_static_title=年度销售情况\ngallerytree_line_multi_static_column1=2014 年销售情况\ngallerytree_line_multi_static_column2=2015 年销售情况\ngallerytree_line_multi_static_column3=2016 年销售情况\ngallerytree_area=面积图\ngallerytree_area_basic=基本视图\ngallerytree_area_basic_title=期望的渠道\ngallerytree_area_basic_column1=期望的金额\ngallerytree_area_fixed=固定视图（每月）\ngallerytree_area_fixed_title=渠道（最好的一个月）\ngallerytree_area_fixed_column1=结束日期\ngallerytree_area_fixed_column2=每月的期望金额\ngallerytree_area_dd=查看明细\ngallerytree_area_dd_title=渠道的期望值\ngallerytree_area_dd_column1=结束日期\ngallerytree_area_dd_column2=期望的金额\ngallerytree_bubble=气泡图\ngallerytree_bubble_basic=基本视图\ngallerytree_bubble_basic_title=按国家分布的机会\ngallerytree_bubble_basic_column1=机会数量\ngallerytree_bubble_basic_column2=平均几率\ngallerytree_bubble_basic_column3=期望的金额\ngallerytree_bubble_basic_column4=国家\ngallerytree_meter=计量图表\ngallerytree_meter_basic=基本视图\ngallerytree_meter_basic_title=销售目标\ngallerytree_meter_basic_column1=总金额\ngallerytree_meter_multi=多重\ngallerytree_meter_multi_title=每年的期望金额\ngallerytree_meter_multi_column1=总金额\ngallerytree_meter_multi_static=多重（静态）\ngallerytree_meter_multi_static_title=Heart rate\ngallerytree_meter_multi_static_column1=人员\ngallerytree_meter_multi_static_column2=Heart rate\ngallerytree_metrics=度量\ngallerytree_metrics_basic=基本视图\ngallerytree_metrics_basic_title=销售额（当前季度）\ngallerytree_metrics_basic_column1=销售额（当前季度）\ngallerytree_metrics_basic_static=基本视图（静态）\ngallerytree_metrics_basic_static_title=Tweets\\!\ngallerytree_metrics_basic_static_column1=Tweets\ngallerytree_map=图表\ngallerytree_map_region=标识\ngallerytree_map_region_title=按国家\ngallerytree_map_region_column1=总金额\ngallerytree_map_marker=地区\ngallerytree_map_marker_title=按国家\ngallerytree_map_marker_column1=总金额\ngallerytree_table=报告表\ngallerytree_table_basic=基本视图\ngallerytree_table_basic_title=机会列表\ngallerytree_table_basic_column1=国家\ngallerytree_table_basic_column2=客户\ngallerytree_table_basic_column3=产品\ngallerytree_table_basic_column4=销售人员\ngallerytree_table_basic_column5=状态\ngallerytree_table_basic_column6=来源\ngallerytree_table_basic_column7=创建\ngallerytree_table_basic_column8=期望值\ngallerytree_table_basic_column9=结束日期\ngallerytree_table_basic_column10=金额\ngallerytree_table_filtered=过滤的\ngallerytree_table_filtered_title=美国和巴西的机会\ngallerytree_table_filtered_column1=客户\ngallerytree_table_filtered_column2=产品\ngallerytree_table_filtered_column3=状态\ngallerytree_table_filtered_column4=来源\ngallerytree_table_filtered_column5=创建\ngallerytree_table_filtered_column6=期望值\ngallerytree_table_filtered_column7=结束日期\ngallerytree_table_filtered_column8=金额\ngallerytree_table_grouped=分组的\ngallerytree_table_grouped_title=国家总览\ngallerytree_table_grouped_column1=国家\ngallerytree_table_grouped_column2=\\#Opps\ngallerytree_table_grouped_column3=最小值\ngallerytree_table_grouped_column4=最大值\ngallerytree_table_grouped_column5=平均值\ngallerytree_table_grouped_column6=总计\ngallerytree_table_default_dd=默认视图（明细）\ngallerytree_table_default_dd_title=机会列表\ngallerytree_table_default_dd_column1=国家\ngallerytree_table_default_dd_column2=客户\ngallerytree_table_default_dd_column3=产品\ngallerytree_table_default_dd_column4=销售人员\ngallerytree_table_default_dd_column5=状态\ngallerytree_table_default_dd_column6=来源\ngallerytree_table_default_dd_column7=创建\ngallerytree_table_default_dd_column8=期望值\ngallerytree_table_default_dd_column9=结束日期\ngallerytree_table_default_dd_column10=金额\ngallerytree_db=仪表板\ngallerytree_db_salesgoals=销售目标\ngallerytree_db_salespipe=销售渠道\ngallerytree_db_salespcountry=每个国家的销售额\ngallerytree_db_salesreps=销售报告\ngallerytree_db_expreps=费用报表\ngallerytree_db_clustermetrics=群集度量\ngallerywidget_unknown=未知的图库小工具\ngallerywidget_dataset_modif=这个数据集已被修改。刷新视图...\ngallerywidget_dataset_loaded=数据集已从服务器加载 [{0}, {1} Kb]\nmetrics_server_detail_title=服务器度量（垂直）\nmetrics_server_detail_backbutton_tt=回退\nmetrics_server_detail_modebutton_tt_viewtable=表视图\nmetrics_server_detail_modebutton_tt_viewcharts=图表视图\nmetrics_server_detail_lasthour_summary=最近一小时总览\nmetrics_server_detail_cpu_usage=CPU 利用率（%）\nmetrics_server_detail_mem_usage=内存利用率（Gb）\nmetrics_server_detail_netw_usage=网络利用率（kbps）\nmetrics_server_detail_disk_usage=磁盘利用率（Mb）\nmetrics_server_detail_live_procs=活动进程\nmetrics_server_detail_cpu1_title=CPU 1 %\nmetrics_server_detail_cpu2_title=CPU 2 %\nmetrics_server_detail_mem_title=内存消耗\nmetrics_server_detail_netw_title=网络带宽\nmetrics_server_detail_disk_title=磁盘利用率\nmetrics_server_detail_disk_column1=空闲磁盘空间\nmetrics_server_detail_disk_column2=已用磁盘空间\nmetrics_server_detail_procs_running_title=运行的进程\nmetrics_server_detail_procs_running_column1=正在运行\nmetrics_server_detail_procs_sleeping_title=休眠的进程\nmetrics_server_detail_procs_sleeping_column1=正在休眠\nmetrics_server_detail_rt_table_title=实时 {0} 度量\nmetrics_server_detail_rt_table_column1=分钟\nmetrics_server_detail_rt_table_column2=CPU0\nmetrics_server_detail_rt_table_column3=CPU1\nmetrics_server_detail_rt_table_column4=已用内存（Gb）\nmetrics_server_detail_rt_table_column5=空闲内存（Gb）\nmetrics_server_detail_rt_table_column6=上行流量（kbps）\nmetrics_server_detail_rt_table_column7=下行流量（kbps）\nmetrics_server_detail_rt_table_column8=运行的进程\nmetrics_server_detail_rt_table_column9=休眠的进程\nmetrics_server_detail_rt_table_column10=已用磁盘空间（Mb）\nmetrics_server_detail_rt_table_column11=空闲磁盘空间（Mb）\nmetrics_server_vert_title=服务器度量（垂直）\nmetrics_server_vert_default_tt=点击以显示服务器细节\nmetrics_server_vert_cpu_tt=CPU 利用率（%）\nmetrics_server_vert_usedmem_tt=已用内存（Gb）\nmetrics_server_vert_netbw_tt=网络带宽（kbps）\nmetrics_server_vert_procs_tt=运行的/休眠的进程\nmetrics_server_vert_disk_tt=磁盘利用率（Mb）\nmetrics_server_vert_cpu1_title=CPU 1 %\nmetrics_server_vert_cpu2_title=CPU 2 %\nmetrics_server_vert_memconsumption_title=内存消耗\nmetrics_server_vert_netbw_title=网络带宽\nmetrics_server_vert_procs_title=运行的/休眠的进程\nmetrics_server_vert_du_title=磁盘利用率\nmetrics_server_vert_du_free=空闲磁盘空间（Mb）\nmetrics_server_vert_du_used=已用磁盘空间（Mb）\nmetrics_server_vert_serverdown={0} 已下线\nmetrics_cluster_title=群集度量\nmetrics_cluster_messages_heading=正在初始化仪表板...\nmetrics_cluster_metricselector_label=度量\nmetrics_cluster_chartselector_label=图表类型\nmetrics_cluster_metricselector_cpu=CPU %\nmetrics_cluster_metricselector_mem=内存\nmetrics_cluster_metricselector_disk=磁盘\nmetrics_cluster_metricselector_netw=网络\nmetrics_cluster_metricselector_proc=流程\nmetrics_cluster_chartselector_bar=柱状图\nmetrics_cluster_chartselector_line=线形图\nmetrics_cluster_chartselector_area=面积图\nmetrics_cluster_column_cpu=CPU %\nmetrics_cluster_column_cpu_y=CPU %\nmetrics_cluster_column_df=空闲磁盘空间\nmetrics_cluster_column_df_y=Gigabytes\nmetrics_cluster_column_du=已用磁盘空间\nmetrics_cluster_column_du_y=Gigabytes\nmetrics_cluster_column_memf=空闲内存\nmetrics_cluster_column_memf_y=Gigabytes\nmetrics_cluster_column_memu=已用内存\nmetrics_cluster_column_memu_y=Gigabytes\nmetrics_cluster_column_procsrn=运行的进程\nmetrics_cluster_column_procsrn_y=进程\nmetrics_cluster_column_procssl=休眠的进程\nmetrics_cluster_column_procssl_y=进程\nmetrics_cluster_column_netrx=网络接收\nmetrics_cluster_column_netrx_y=Kb/s\nmetrics_cluster_column_nettx=网络传输\nmetrics_cluster_column_nettx_y=Kb/s\nmetrics_cluster_column_time=时间\nmetrics_rt_title=系统度量（实时）\nmetrics_rt_serverup=上线\nmetrics_rt_serverdown=下线\nsales_bycountry_title=每个国家的销售额\nsales_bycountry_bubble_title=按国家分布的机会\nsales_bycountry_bubble_column1=机会数量\nsales_bycountry_bubble_column2=平均几率\nsales_bycountry_bubble_column3=期望的金额\nsales_bycountry_map_title=按国家\nsales_bycountry_map_column1=总金额\nsales_bycountry_table_title=机会列表\nsales_bycountry_table_column1=国家\nsales_bycountry_table_column2=客户\nsales_bycountry_table_column3=产品\nsales_bycountry_table_column4=销售人员\nsales_bycountry_table_column5=状态\nsales_bycountry_table_column6=创建\nsales_bycountry_table_column7=期望值\nsales_bycountry_table_column8=结束日期\nsales_bycountry_table_column9=金额\nsales_bydate_title=销售渠道\nsales_bydate_area_title=渠道期望值\nsales_bydate_area_column1=金额\nsales_bydate_pie_years_title=年\nsales_bydate_pie_years_column1=出现率\nsales_bydate_pie_quarters_title=季度\nsales_bydate_pie_quarters_column1=出现率\nsales_bydate_bar_weekday_title=星期几\nsales_bydate_bar_weekday_column1=出现率\nsales_bydate_pie_pipe_title=渠道\nsales_bydate_pie_pipe_column1=机会数量\nsales_bydate_table_title=机会列表\nsales_bydate_table_column1=国家\nsales_bydate_table_column2=客户\nsales_bydate_table_column3=产品\nsales_bydate_table_column4=销售人员\nsales_bydate_table_column5=状态\nsales_bydate_table_column6=金额\nsales_bydate_table_column7=期望值\nsales_bydate_table_column8=创建\nsales_bydate_table_column9=结束\nsales_bydate_selector_total=总计\nsales_goals_title=销售目标\nsales_goals_meter_title=销售目标\nsales_goals_meter_column1=总金额\nsales_goals_line_title=渠道期望值\nsales_goals_line_column1=结束日期\nsales_goals_line_column2=总金额\nsales_goals_line_column3=期望的金额\nsales_goals_bar_byproduct_title=按产品\nsales_goals_bar_byproduct_column1=产品\nsales_goals_bar_byproduct_column2=总计\nsales_goals_bar_byproduct_column3=期望值\nsales_goals_bar_byempl_title=按雇员\nsales_goals_bar_byempl_column1=雇员\nsales_goals_bar_byempl_column2=金额\nsales_goals_bubble_title=按国家分布的机会\nsales_goals_bubble_column1=机会数量\nsales_goals_bubble_column2=平均几率\nsales_goals_bubble_column3=期望的金额\nsales_tablereports_title=销售报告\nsales_tablereports_tab_byyear=按年\nsales_tablereports_tab_bycountry=按国家\nsales_tablereports_tab_byproduct=按产品\nsales_tablereports_tab_bysalesman=按销售人员\nsales_tablereports_all_title=机会列表\nsales_tablereports_all_column1=国家\nsales_tablereports_all_column2=客户\nsales_tablereports_all_column3=产品\nsales_tablereports_all_column4=销售人员\nsales_tablereports_all_column5=状态\nsales_tablereports_all_column6=创建\nsales_tablereports_all_column7=期望值\nsales_tablereports_all_column8=结束\nsales_tablereports_all_column9=金额\nsales_tablereports_bycountry_title=国家总览\nsales_tablereports_bycountry_column1=国家\nsales_tablereports_bycountry_column2=\\#Opps\nsales_tablereports_bycountry_column3=最小值\nsales_tablereports_bycountry_column4=最大值\nsales_tablereports_bycountry_column5=平均值\nsales_tablereports_bycountry_column6=总计\nsales_tablereports_byproduct_title=产品总览\nsales_tablereports_byproduct_column1=产品\nsales_tablereports_byproduct_column2=\\#Opps\nsales_tablereports_byproduct_column3=最小值\nsales_tablereports_byproduct_column4=最大值\nsales_tablereports_byproduct_column5=平均值\nsales_tablereports_byproduct_column6=总计\nsales_tablereports_bysalesman_title=销售额（按人）\nsales_tablereports_bysalesman_column1=销售人员\nsales_tablereports_bysalesman_column2=\\#Opps\nsales_tablereports_bysalesman_column3=最小值\nsales_tablereports_bysalesman_column4=最大值\nsales_tablereports_bysalesman_column5=平均值\nsales_tablereports_bysalesman_column6=总计\nsales_tablereports_byyear_title=年度总览\nsales_tablereports_byyear_column1=创建日期\nsales_tablereports_byyear_column2=\\#Opps\nsales_tablereports_byyear_column3=最小值\nsales_tablereports_byyear_column4=最大值\nsales_tablereports_byyear_column5=平均值\nsales_tablereports_byyear_column6=总计\nsalesopps_displayers_by_pipeline_title=渠道状态\nsalesopps_displayers_by_status_title=按状态\nsalesopps_displayers_by_salesman_title=按销售人员\nsalesopps_displayers_by_exp_pipeline_title=期望的金额\nsalesopps_displayers_by_exp_pipeline_column1=期望的金额\nsalesopps_displayers_by_product_title=按产品\nsalesopps_displayers_by_product_column1=总金额\nsalesopps_displayers_by_country_title=按国家\nsalesopps_displayers_by_country_column1=总金额\nsalesopps_displayers_country_summary_title=国家总览\nsalesopps_displayers_country_summary_column1=国家\nsalesopps_displayers_country_summary_column2=总计\nsalesopps_displayers_country_summary_column3=数量\nsalesopps_displayers_country_summary_column4=平均值\nsalesopps_displayers_country_summary_column5=最小值\nsalesopps_displayers_country_summary_column6=最大值\nsalesopps_displayers_all_list_title=机会列表\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Welcome to Dashbuilder !\npowered=Powered By Dashbuilder\nuserName=Username\npassword=Password\nsignIn=Sign In\nloginFailed=Login failed: Not Authorized\nloginAsAnotherUser=Login as another user\nlogoutSuccessful=Logout successful\nloginAgain=Login again\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_de.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Willkommen bei Dashbuilder \\!\npowered=Powered By Dashbuilder\nuserName=Benutzername\npassword=Passwort\nsignIn=Anmeldung\nloginFailed=Anmeldung fehlgeschlagen\\: Nicht autorisiert\nloginAsAnotherUser=Anmeldung als anderer Benutzer\nlogoutSuccessful=Abmeldung erfolgreich\nloginAgain=Erneut anmelden\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_es.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=¡Bienvenido a Dashbuilder!\npowered=Con tecnología de Dashbuilder\nuserName=Nombre de usuario\npassword=Contraseña\nsignIn=Iniciar sesión\nloginFailed=El inicio de sesión ha fallado: No autorizado\nloginAsAnotherUser=Iniciar sesión como otro usuario\nlogoutSuccessful=Se ha cerrado sesión correctamente\nloginAgain=Volver a iniciar sesión\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_fr.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Bienvenue dans Dashbuilder\npowered=Avec la technologie Dashbuilder\nuserName=Nom d''utilisateur\npassword=Mot de passe\nsignIn=Se connecter\nloginFailed=La connexion a échoué : Non autorisée\nloginAsAnotherUser=Se connecter sous l''identité d''un autre utilisateur\nlogoutSuccessful=Déconnexion réussie\nloginAgain=Se reconnecter\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_it.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Benvenuto in Dashbuilder !\npowered=Powered By Dashbuilder\nuserName=Nome utente\npassword=Password\nsignIn=Accedi\nloginFailed=Accesso non riuscito: Non autorizzato\nloginAsAnotherUser=Accedi come un altro utente\nlogoutSuccessful=Logout effettuato con successo\nloginAgain=Accedi di nuovo\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_ja.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Dashbuilder にようこそ!\npowered=Powered By Dashbuilder\nuserName=ユーザ名\npassword=パスワード\nsignIn=サインイン\nloginFailed=ログインに失敗しました: 承認されていません\nloginAsAnotherUser=別のユーザー\nlogoutSuccessful=正常にログアウトしました\nloginAgain=再度ログイン\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_pt_BR.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=Bem-vindo ao Dashbuilder \\!\npowered=Desenvolvido por Dashbuilder \nuserName=Nome de usuário\npassword=Senha\nsignIn=Entrar\nloginFailed=Falha de login\\: Não Autorizado\nloginAsAnotherUser=Faça o login como outro usuário\nlogoutSuccessful=Saída com êxito\nloginAgain=Faça o login novamente\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/client/resources/i18n/LoginConstants_zh_CN.properties",
    "content": "loginTitle=Dashbuilder\nwelcome=欢迎使用 Dashbuilder！\npowered=Dashbuilder 为您提供更多方便\nuserName=用户名\npassword=密码\nsignIn=登录\nloginFailed=登录失败：未授权\nloginAsAnotherUser=作为其他用户登录\nlogoutSuccessful=成功退出\nloginAgain=再次登录\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/public/css/uberfire-loading.css",
    "content": "/*\n * Copyright 2010 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Loading indicator at Startup */\n#loading {\n    position: absolute;\n    left: 45%;\n    top: 40%;\n    padding: 2px;\n    z-index: 20001;\n    height: auto;\n    border: 1px solid #ccc;\n}\n\n#loading a {\n    color: #225588;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/org/dashbuilder/public/css/uberfire-showcase.css",
    "content": "html, body {\n    height: 100%;\n}\n\n/* Override PatternFly default css so border isn't duplicated */\n.navbar-pf {\n    border-top: none;\n}\n\n.navbar-pf ul.navbar-utility {\n    top: -25px;\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/security-management.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\norg.uberfire.ext.security.management.api.userManagementServices=WildflyCLIUserManagementService\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/resources/security-policy.properties",
    "content": "#\n# Authorization Policy\n#\n# The entries in this file must comply with the following format:\n#\n#  \"classifier.identifier.setting.extra=value\"\n# \n#   classifier = role|group\n#   identifier = An existing role or group identifier (depending on the classifier type)\n#   setting    = home|priority|permission\n#   extra      = Extra setting information. Mandatory, for instance, to define a permission's name\n#   value      = The setting value (depends on the setting selected). Value expected per setting type:\n#\n#   - home: An existing perspective identifier to redirect after login\n#   - priority: An integer indicating how priority is this role|group compared to others. Used for conflict resolution.\n#   - permission: A name representing a specific feature or capability over a given resource.\n#\n\n# Default settings\ndefault.home=HomePerspective\ndefault.permission.perspective.create=false\ndefault.permission.perspective.update=false\ndefault.permission.perspective.delete=false\ndefault.permission.perspective.read=false\ndefault.permission.perspective.read.HomePerspective=true\n\n# Role \"admin\"\nrole.admin.permission.perspective.create=true\nrole.admin.permission.perspective.update=true\nrole.admin.permission.perspective.delete=true\nrole.admin.permission.perspective.read=true\n\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"all\">\n    <scan>\n    <!-- These exclusions were added by Errai to avoid deploying client-side classes to the server -->\n    <!-- End of Errai exclusions -->\n\n        <exclude name=\"org.hibernate.validator.**\"/>\n        <exclude name=\"org.dashbuilder.validations.**\"/>\n        <exclude name=\"org.dashbuilder.client.**\"/>\n        <exclude name=\"org.dashbuilder.common.client.**\"/>\n        <exclude name=\"org.dashbuilder.dataset.client.**\"/>\n        <exclude name=\"org.dashbuilder.dataset.validation.**\"/>\n        <exclude name=\"org.dashbuilder.dataset.editor.client.**\"/>\n        <exclude name=\"org.dashbuilder.displayer.client.**\"/>\n        <exclude name=\"org.dashbuilder.renderer.client.**\"/>\n        <exclude name=\"org.dashbuilder.renderer.google.**\"/>\n        <exclude name=\"org.dashbuilder.renderer.chartjs.**\"/>\n        <exclude name=\"org.dashbuilder.renderer.lienzo.**\"/>\n\n        <!-- Uberfire -->\n        <exclude name=\"org.uberfire.client.**\"/>\n        <exclude name=\"org.uberfire.security.client.**\"/>\n\n        <!-- UF Extensions -->\n        <exclude name=\"org.uberfire.ext.apps.client.**\"/>\n        <exclude name=\"org.uberfire.ext.plugin.client.**\"/>\n        <exclude name=\"org.uberfire.ext.layout.editor.client.**\"/>\n        <exclude name=\"org.uberfire.ext.security.management.client.**\"/>\n        <exclude name=\"org.uberfire.ext.editor.commons.client.**\"/>\n        <exclude name=\"org.uberfire.ext.properties.editor.client.**\"/>\n        <exclude name=\"org.uberfire.ext.widgets.common.client.**\"/>\n        <exclude name=\"org.uberfire.ext.widgets.sandbox.client.**\"/>\n        <exclude name=\"org.uberfire.ext.widgets.core.client.**\"/>\n        <exclude name=\"org.uberfire.ext.widgets.table.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.bpmn.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.core.api.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.core.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.core.trees.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.core.scratchpad.client.**\"/>\n        <exclude name=\"org.uberfire.ext.wires.bayesian.network.client.**\"/>\n    </scan>\n</beans>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/README.md",
    "content": "How to deploy a data set definition\n============================\n\n* Create a \"<mydataset>.dset\" file containing the data set JSON definition.\n\n* Create an empty \"<mydataset>.dset.deploy\" file in order to launch the automatic deployment.\n\nTo undeploy/remove a data set definition\n============================\n\n* Create an empty \"<uuid>.undeploy\" file in order to force the removal of the data set from the system.\n\n* Notice that <uuid> is the identifier of the data set you want to remove. If the data set has been previously deployed\n  (using the above mechanism) then the UUID is the one defined within the \".dset\" file. If it's been defined\n  through the UI tooling then it can be read on the data set editor screen.\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/clusterMetrics.dset",
    "content": "{\n    \"uuid\": \"clusterMetrics\",\n    \"name\": \"Cluster Metrics\",\n    \"provider\": \"BEAN\",\n    \"isPublic\": true,\n    \"pushEnabled\": false,\n    \"pushMaxSize\": 1024,\n    \"refreshTime\": \"1second\",\n    \"refreshAlways\": \"true\",\n    \"generatorClass\": \"org.dashbuilder.backend.ClusterMetricsGenerator\",\n    \"generatorParams\": [\n      {\"param\": \"timeFrame\", \"value\": \"10minute\"},\n      {\"param\": \"aliveNodes\", \"value\": \"server1,server2,server3,server4,server5\"},\n      {\"param\": \"overloadedNodes\", \"value\": \"\"}\n    ]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/expenseReports.csv",
    "content": "office;department;employee;date;amount\nBarcelona;Engineering;Roxie Foraker;12-11-2012;120.35\nBarcelona;Engineering;Roxie Foraker;12-01-2012;1,100.10\nBarcelona;Engineering;Roxie Foraker;11-01-2012;900.10\nBarcelona;Services;Jamie Gilbeau;10-12-2012;340.34\nBarcelona;Services;Jamie Gilbeau;09-15-2012;300.00\nBarcelona;Services;Jamie Gilbeau;08-17-2012;152.25\nMadrid;Services;Roxie Foraker;07-01-2012;800.80\nMadrid;Services;Roxie Foraker;06-01-2012;911.11\nMadrid;Sales;Nita Marling;05-11-2012;75.75\nMadrid;Sales;Nita Marling;03-11-2012;100.00\nMadrid;Sales;Nita Marling;03-16-2012;220.80\nMadrid;Sales;Nita Marling;03-02-2012;344.90\nBrno;Support;Darryl Innes;02-09-2012;567.89\nBrno;Support;Darryl Innes;01-13-2012;400.40\nBrno;Support;Darryl Innes;01-11-2012;1,001.90\nBrno;Engineering;Julio Burdge;11-02-2011;200.20\nBrno;Engineering;Julio Burdge;09-01-2011;159.01\nBrno;Engineering;Julio Burdge;08-22-2011;300.00\nBrno;Engineering;Julio Burdge;07-23-2011;800.24\nBrno;Sales;Neva Hunger;06-11-2011;995.30\nBrno;Sales;Neva Hunger;06-11-2011;234.30\nWestford;Engineering;Kathrine Janas;05-17-2011;233.49\nWestford;Engineering;Kathrine Janas;04-12-2011;1,100.10\nWestford;Engineering;Kathrine Janas;03-13-2011;1,402.30\nWestford;Engineering;Kathrine Janas;02-13-2011;490.10\nWestford;Engineering;Kathrine Janas;02-09-2011;600.34\nWestford;Sales;Jerri Preble;12-23-2010;899.03\nWestford;Sales;Jerri Preble;11-30-2010;343.45\nWestford;Management;Donald M. Stanton;10-29-2010;983.03\nWestford;Management;Donald M. Stanton;10-11-2010;43.03\nRaleigh;Management;Hannah B. Mackey;09-01-2010;234.34\nRaleigh;Management;Hannah B. Mackey;07-02-2010;543.45\nRaleigh;Management;Hannah B. Mackey;06-02-2010;193.45\nRaleigh;Management;Loretta R. Havens;05-03-2010;992.20\nRaleigh;Management;Loretta R. Havens;04-23-2010;494.40\nRaleigh;Engineering;Tony L. Crawford;02-18-2010;233.09\nRaleigh;Engineering;Tony L. Crawford;02-22-2010;293.49\nRaleigh;Engineering;Tony L. Crawford;12-23-2009;401.40\nRaleigh;Engineering;Tony L. Crawford;07-19-2009;209.55\nRaleigh;Support;Eileen L. Pereira;06-12-2009;300.01\nRaleigh;Support;Eileen L. Pereira;06-13-2009;450.60\nRaleigh;Support;Eileen L. Pereira;06-14-2009;320.90\nRaleigh;Support;Eileen L. Pereira;06-15-2009;303.90\nLondon;Engineering;Alan P. Adamson;06-12-2009;404.30\nLondon;Engineering;Alan P. Adamson;05-12-2009;868.45\nLondon;Engineering;Alan P. Adamson;05-13-2009;333.45\nLondon;Management;Patricia J. Behr;04-14-2009;565.56\nLondon;Management;Patricia J. Behr;03-02-2009;345.45\nLondon;Management;Patricia J. Behr;02-03-2009;700.66\nLondon;Management;Patricia J. Behr;01-04-2009;921.90"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/expenseReports.dset",
    "content": "{\n    \"uuid\": \"expenseReports\",\n    \"name\": \"Expense Reports\",\n    \"provider\": \"CSV\",\n    \"isPublic\": true,\n    \"pushEnabled\": true,\n    \"pushMaxSize\": 1024,\n    \"refreshTime\": \"2 second\",\n    \"refreshAlways\": \"false\",\n    \"filePath\": \"expenseReports.csv\",\n    \"separatorChar\": \";\",\n    \"quoteChar\": \"\\\"\",\n    \"escapeChar\": \"\\\\\",\n    \"datePattern\": \"MM-dd-yyyy\",\n    \"numberPattern\": \"#,###.##\",\n    \"columns\": [\n      {\"id\": \"office\", \"type\": \"label\"},\n      {\"id\": \"department\", \"type\": \"label\"},\n      {\"id\": \"employee\", \"type\": \"label\"},\n      {\"id\": \"amount\", \"type\": \"number\", \"pattern\": \"#,###.##\"},\n      {\"id\": \"date\", \"type\": \"date\", \"pattern\": \"MM-dd-yyyy\"}\n    ]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/salesOpportunities.dset",
    "content": "{\n    \"uuid\": \"salesOpportunities\",\n    \"name\": \"Sales Opportunities\",\n    \"provider\": \"BEAN\",\n    \"pushEnabled\": false,\n    \"pushMaxSize\": 2048,\n    \"isPublic\": true,\n    \"generatorClass\": \"org.dashbuilder.backend.SalesDataSetGenerator\",\n    \"generatorParams\": [\n        {\"param\": \"startYear\", \"value\": \"-1\"},\n        {\"param\": \"endYear\", \"value\": \"3\"},\n        {\"param\": \"oppsPerMonth\", \"value\": \"30\"}\n    ]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/worldPopulation.csv",
    "content": "City / Urban area,Country,Population,Land area,Density\nTokyo/Yokohama,Japan,\"33,200,000\",\"6,993\",\"4,750\"\nNew York Metro,USA,\"17,800,000\",\"8,683\",\"2,050\"\nSao Paulo,Brazil,\"17,700,000\",\"1,968\",\"9,000\"\nSeoul/Incheon,South Korea,\"17,500,000\",\"1,049\",\"16,700\"\nMexico City,Mexico,\"17,400,000\",\"2,072\",\"8,400\"\nOsaka/Kobe/Kyoto,Japan,\"16,425,000\",\"2,564\",\"6,400\"\nManila,Philippines,\"14,750,000\",\"1,399\",\"10,550\"\nMumbai,India,\"14,350,000\",484,\"29,650\"\nDelhi,India,\"14,300,000\",\"1,295\",\"11,050\"\nJakarta,Indonesia,\"14,250,000\",\"1,360\",\"10,500\"\nLagos,Nigeria,\"13,400,000\",738,\"18,150\"\nKolkata,India,\"12,700,000\",531,\"23,900\"\nCairo,Egypt,\"12,200,000\",\"1,295\",\"9,400\"\nLos Angeles,USA,\"11,789,000\",\"4,320\",\"2,750\"\nBuenos Aires,Argentina,\"11,200,000\",\"2,266\",\"4,950\"\nRio de Janeiro,Brazil,\"10,800,000\",\"1,580\",\"6,850\"\nMoscow,Russia,\"10,500,000\",\"2,150\",\"4,900\"\nShanghai,China,\"10,000,000\",746,\"13,400\"\nKarachi,Pakistan,\"9,800,000\",518,\"18,900\"\nParis,France,\"9,645,000\",\"2,723\",\"3,550\"\nIstanbul,Turkey,\"9,000,000\",\"1,166\",\"7,700\"\nNagoya,Japan,\"9,000,000\",\"2,875\",\"3,150\"\nBeijing,China,\"8,614,000\",748,\"11,500\"\nChicago,USA,\"8,308,000\",\"5,498\",\"1,500\"\nLondon,UK,\"8,278,000\",\"1,623\",\"5,100\"\nShenzhen,China,\"8,000,000\",466,\"17,150\"\nEssen/D�sseldorf,Germany,\"7,350,000\",\"2,642\",\"2,800\"\nTehran,Iran,\"7,250,000\",686,\"10,550\"\nBogota,Colombia,\"7,000,000\",518,\"13,500\"\nLima,Peru,\"7,000,000\",596,\"11,750\"\nBangkok,Thailand,\"6,500,000\",\"1,010\",\"6,450\"\nJohannesburg/East Rand,South Africa,\"6,000,000\",\"2,396\",\"2,500\"\nChennai,India,\"5,950,000\",414,\"14,350\"\nTaipei,Taiwan,\"5,700,000\",376,\"15,200\"\nBaghdad,Iraq,\"5,500,000\",596,\"9,250\"\nSantiago,Chile,\"5,425,000\",648,\"8,400\"\nBangalore,India,\"5,400,000\",534,\"10,100\"\nHyderabad,India,\"5,300,000\",583,\"9,100\"\nSt Petersburg,Russia,\"5,300,000\",622,\"8,550\"\nPhiladelphia,USA,\"5,149,000\",\"4,661\",\"1,100\"\nLahore,Pakistan,\"5,100,000\",622,\"8,200\"\nKinshasa,Congo,\"5,000,000\",469,\"10,650\"\nMiami,USA,\"4,919,000\",\"2,891\",\"1,700\"\nHo Chi Minh City,Vietnam,\"4,900,000\",518,\"9,450\"\nMadrid,Spain,\"4,900,000\",945,\"5,200\"\nTianjin,China,\"4,750,000\",453,\"10,500\"\nKuala Lumpur,Malaysia,\"4,400,000\",\"1,606\",\"2,750\"\nToronto,Canada,\"4,367,000\",\"1,655\",\"2,650\"\nMilan,Italy,\"4,250,000\",\"1,554\",\"2,750\"\nShenyang,China,\"4,200,000\",453,\"9,250\"\nDallas/Fort Worth,USA,\"4,146,000\",\"3,644\",\"1,150\"\nBoston,USA,\"4,032,000\",\"4,497\",900\nBelo Horizonte,Brazil,\"4,000,000\",868,\"4,600\"\nKhartoum,Sudan,\"4,000,000\",583,\"6,850\"\nRiyadh,Saudi Arabia,\"4,000,000\",\"1,101\",\"3,650\"\nSingapore,Singapore,\"4,000,000\",479,\"8,350\"\nWashington,USA,\"3,934,000\",\"2,996\",\"1,300\"\nDetroit,USA,\"3,903,000\",\"3,267\",\"1,200\"\nBarcelona,Spain,\"3,900,000\",803,\"4,850\"\nHouston,USA,\"3,823,000\",\"3,355\",\"1,150\"\nAthens,Greece,\"3,685,000\",684,\"5,400\"\nBerlin,Germany,\"3,675,000\",984,\"3,750\"\nSydney,Australia,\"3,502,000\",\"1,687\",\"2,100\"\nAtlanta,USA,\"3,500,000\",\"5,083\",700\nGuadalajara,Mexico,\"3,500,000\",596,\"5,900\"\nSan Francisco/Oakland,USA,\"3,229,000\",\"1,365\",\"2,350\"\nMontreal.,Canada,\"3,216,000\",\"1,740\",\"1,850\"\nMonterey,Mexico,\"3,200,000\",479,\"6,700\"\nMelbourne,Australia,\"3,162,000\",\"2,080\",\"1,500\"\nAnkara,Turkey,\"3,100,000\",583,\"5,300\"\nRecife,Brazil,\"3,025,000\",376,\"8,050\"\nPhoenix/Mesa,USA,\"2,907,000\",\"2,069\",\"1,400\"\nDurban,South Africa,\"2,900,000\",829,\"3,500\"\nPorto Alegre,Brazil,\"2,800,000\",583,\"4,800\"\nDalian,China,\"2,750,000\",389,\"7,100\"\nJeddah,Saudi Arabia,\"2,750,000\",777,\"3,550\"\nSeattle,USA,\"2,712,000\",\"2,470\",\"1,100\"\nCape Town,South Africa,\"2,700,000\",686,\"3,950\"\nSan Diego,USA,\"2,674,000\",\"2,026\",\"1,300\"\nFortaleza,Brazil,\"2,650,000\",583,\"4,550\"\nCuritiba,Brazil,\"2,500,000\",648,\"3,850\"\nRome,Italy,\"2,500,000\",842,\"2,950\"\nNaples,Italy,\"2,400,000\",583,\"4,100\"\nMinneapolis/St. Paul,USA,\"2,389,000\",\"2,316\",\"1,050\"\nTel Aviv,Israel,\"2,300,000\",453,\"5,050\"\nBirmingham,UK,\"2,284,000\",600,\"3,800\"\nFrankfurt,Germany,\"2,260,000\",984,\"2,300\"\nLisbon,Portugal,\"2,250,000\",881,\"2,550\"\nManchester,UK,\"2,245,000\",558,\"4,000\"\nSan Juan,Puerto Rico,\"2,217,000\",\"2,309\",950\nKatowice,Poland,\"2,200,000\",544,\"4,050\"\nTashkent,Uzbekistan,\"2,200,000\",531,\"4,150\"\nFukuoka,Japan,\"2,150,000\",544,\"3,950\"\nBaku/Sumqayit,Azerbaijan,\"2,100,000\",544,\"3,850\"\nSt. Louis,USA,\"2,078,000\",\"2,147\",950\nBaltimore,USA,\"2,076,000\",\"1,768\",\"1,150\"\nSapporo,Japan,\"2,075,000\",414,\"5,000\"\nTampa/St. Petersburg,USA,\"2,062,000\",\"2,078\",\"1,000\"\nTaichung,Taiwan,\"2,000,000\",510,\"3,900\"\nWarsaw,Poland,\"2,000,000\",466,\"4,300\"\nDenver,USA,\"1,985,000\",\"1,292\",\"1,550\"\nCologne/Bonn,Germany,\"1,960,000\",816,\"2,400\"\nHamburg,Germany,\"1,925,000\",829,\"2,300\"\nDubai,UAE,\"1,900,000\",712,\"2,650\"\nPretoria,South Africa,\"1,850,000\",673,\"2,750\"\nVancouver,Canada,\"1,830,000\",\"1,120\",\"1,650\"\nBeirut,Lebanon,\"1,800,000\",648,\"2,800\"\nBudapest,Hungary,\"1,800,000\",702,\"2,550\"\nCleveland,USA,\"1,787,000\",\"1,676\",\"1,050\"\nPittsburgh,USA,\"1,753,000\",\"2,208\",800\nCampinas,Brazil,\"1,750,000\",492,\"3,550\"\nHarare,Zimbabwe,\"1,750,000\",712,\"2,450\"\nBrasilia,Brazil,\"1,625,000\",583,\"2,800\"\nKuwait,Kuwait,\"1,600,000\",544,\"2,950\"\nMunich,Germany,\"1,600,000\",518,\"3,100\"\nPortland,USA,\"1,583,000\",\"1,228\",\"1,300\"\nBrussels,Belgium,\"1,570,000\",712,\"2,200\"\nVienna,Austria,\"1,550,000\",453,\"3,400\"\nSan Jose,USA,\"1,538,000\",674,\"2,300\"\nDamman,Saudi Arabia,\"1,525,000\",673,\"2,250\"\nCopenhagen,Denmark,\"1,525,000\",816,\"1,850\"\nBrisbane,Australia,\"1,508,000\",\"1,603\",950\nRiverside/San Bernardino,USA,\"1,507,000\",\"1,136\",\"1,350\"\nCincinnati,USA,\"1,503,000\",\"1,740\",850\nAccra,Ghana,\"1,500,000\",453,\"3,300\"\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/datasets/worldPopulation.dset",
    "content": "{\n    \"uuid\": \"worldResidents\",\n    \"name\": \"World Population\",\n    \"provider\": \"CSV\",\n    \"isPublic\": true,\n    \"filePath\": \"worldPopulation.csv\",\n    \"separatorChar\": \",\",\n    \"quoteChar\": \"\\\"\",\n    \"escapeChar\": \"\\\\\",\n    \"datePattern\": \"MM-dd-yyyy\",\n    \"numberPattern\": \"#,###.##\",\n    \"columns\": [\n        {\"id\": \"City / Urban area\", \"type\": \"label\"},\n        {\"id\": \"Country\", \"type\": \"label\"},\n        {\"id\": \"Population\", \"type\": \"number\"},\n        {\"id\": \"Population\", \"type\": \"number\"},\n        {\"id\": \"Land area\", \"type\": \"number\"},\n        {\"id\": \"Density\", \"type\": \"number\"}\n    ]\n}"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/jboss-deployment-structure.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ JBoss, Home of Professional Open Source\n  ~ Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors\n  ~ as indicated by the @author tags. All rights reserved.\n  ~ See the copyright.txt in the distribution for a\n  ~ full listing of individual contributors.\n  ~\n  ~ This copyrighted material is made available to anyone wishing to use,\n  ~ modify, copy, or redistribute it subject to the terms and conditions\n  ~ of the GNU Lesser General Public License, v. 2.1.\n  ~ This program is distributed in the hope that it will be useful, but WITHOUT A\n  ~ WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\n  ~ PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.\n  ~ You should have received a copy of the GNU Lesser General Public License,\n  ~ v.2.1 along with this distribution; if not, write to the Free Software\n  ~ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,\n  ~ MA  02110-1301, USA.\n  -->\n<jboss-deployment-structure\n  xmlns=\"urn:jboss:deployment-structure:1.1\">\n  <deployment>\n    <dependencies>\n      <module name=\"javax.activation.api\" />\n      <module name=\"javax.ejb.api\" />\n      <module name=\"javax.faces.api\" />\n      <module name=\"javax.jms.api\" />\n      <module name=\"javax.persistence.api\" />\n      <module name=\"javax.servlet.api\" />\n      <module name=\"javax.transaction.api\" />\n      <module name=\"javax.validation.api\" />\n      <module name=\"javax.wsdl4j.api\" />\n      <module name=\"org.jboss.logging\" />\n      <module name=\"org.jboss.logmanager\" />\n      <module name=\"org.jboss.marshalling\" />\n      <module name=\"org.jboss.remote-naming\" />\n      <module name=\"org.jboss.remoting3\" />\n      <module name=\"org.jboss.xnio\" />\n      <module name=\"org.slf4j\" />\n      <module name=\"org.apache.xalan\" />\n\n      <!-- Module dependencies for Wildfly / EAP security management providers. -->\n      <module name=\"org.jboss.as.controller-client\" />\n      <module name=\"org.jboss.as.domain-management\" />\n      <module name=\"org.jboss.msc\" />\n      <module name=\"org.jboss.dmr\" />\n    </dependencies>\n  </deployment>\n</jboss-deployment-structure>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/jboss-web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!DOCTYPE jboss-web PUBLIC\n    \"-//JBoss//DTD Web Application 2.4//EN\"\n    \"http://www.jboss.org/j2ee/dtd/jboss-web_4_2.dtd\">\n\n<jboss-web>\n\n  <security-domain>other</security-domain>\n\n</jboss-web>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<web-app xmlns=\"http://java.sun.com/xml/ns/javaee\"\n\txmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n\txsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n\t\t  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n\tversion=\"2.5\">\n\n\t<filter>\n\t\t<filter-name>GzipFilter</filter-name>\n\t\t<filter-class>org.uberfire.backend.server.util.gzip.GzipFilter</filter-class>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>GzipFilter</filter-name>\n\t\t<url-pattern>*.js</url-pattern>\n\t</filter-mapping>\n\n\t<filter>\n\t\t<filter-name>request-capture</filter-name>\n\t\t<filter-class>org.uberfire.ext.security.server.SecurityIntegrationFilter</filter-class>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>request-capture</filter-name>\n\t\t<url-pattern>*</url-pattern>\n\t</filter-mapping>\n\n\t<filter>\n\t\t<filter-name>Avoid Host Page Cache</filter-name>\n\t\t<filter-class>org.uberfire.ext.security.server.CacheHeadersFilter</filter-class>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>Avoid Host Page Cache</filter-name>\n\t\t<url-pattern>/dashbuilder.html</url-pattern>\n\t</filter-mapping>\n\n\t<filter>\n\t\t<filter-name>Host Page Patch</filter-name>\n\t\t<filter-class>org.jboss.errai.security.server.servlet.UserHostPageFilter</filter-class>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>Host Page Patch</filter-name>\n\t\t<url-pattern>/dashbuilder.html</url-pattern>\n\t</filter-mapping>\n\n\t<filter>\n\t\t<filter-name>GWT Locale Filter</filter-name>\n\t\t<filter-class>org.uberfire.server.locale.GWTLocaleHeaderFilter</filter-class>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>GWT Locale Filter</filter-name>\n\t\t<url-pattern>/dashbuilder.html</url-pattern>\n\t</filter-mapping>\n\n\t<filter>\n\t\t<filter-name>UberFire Security Headers Filter</filter-name>\n\t\t<filter-class>org.uberfire.ext.security.server.SecureHeadersFilter</filter-class>\n\t\t<init-param>\n\t\t\t<param-name>x-frame-options</param-name>\n\t\t\t<param-value>SAMEORIGIN</param-value>\n\t\t</init-param>\n\t\t<init-param>\n\t\t\t<param-name>x-xss-protection-enable</param-name>\n\t\t\t<param-value>true</param-value>\n\t\t</init-param>\n\t\t<init-param>\n\t\t\t<param-name>x-xss-protection-block</param-name>\n\t\t\t<param-value>true</param-value>\n\t\t</init-param>\n\t</filter>\n\n\t<filter-mapping>\n\t\t<filter-name>UberFire Security Headers Filter</filter-name>\n\t\t<url-pattern>*</url-pattern>\n\t</filter-mapping>\n\n\t<servlet>\n\t\t<servlet-name>LoginRedirectServlet</servlet-name>\n\t\t<servlet-class>org.uberfire.ext.security.server.LoginRedirectServlet</servlet-class>\n\t\t<init-param>\n\t\t\t<param-name>display-after-login</param-name>\n\t\t\t<param-value>/dashbuilder.html</param-value>\n\t\t</init-param>\n\t</servlet>\n\n\t<servlet-mapping>\n\t\t<servlet-name>LoginRedirectServlet</servlet-name>\n\t\t<url-pattern>/login</url-pattern>\n\t</servlet-mapping>\n\n\t<login-config>\n\t\t<auth-method>FORM</auth-method>\n\t\t<form-login-config>\n\t\t\t<form-login-page>/login.jsp</form-login-page>\n\t\t\t<form-error-page>/login.jsp?message=Login failed. Please try again.</form-error-page>\n\t\t</form-login-config>\n\t</login-config>\n\n\t<servlet>\n\t\t<servlet-name>ErraiServlet</servlet-name>\n\t\t<servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>\n\n\t\t<init-param>\n\t\t\t<param-name>service-locator</param-name>\n\t\t\t<param-value>org.jboss.errai.cdi.server.CDIServiceLocator</param-value>\n\t\t</init-param>\n\t\t<load-on-startup>1</load-on-startup>\n\t</servlet>\n\n\t<servlet-mapping>\n\t\t<servlet-name>ErraiServlet</servlet-name>\n\t\t<url-pattern>*.erraiBus</url-pattern>\n\t</servlet-mapping>\n\n\t<servlet>\n\t\t<servlet-name>UberfireFileUploadServlet</servlet-name>\n\t\t<servlet-class>org.uberfire.server.FileUploadServlet</servlet-class>\n\t\t<init-param>\n\t\t\t<param-name>includes-path</param-name>\n\t\t\t<param-value>git://**,default://**</param-value>\n\t\t</init-param>\n\t\t<init-param>\n\t\t\t<param-name>excludes-path</param-name>\n\t\t\t<param-value>file://**</param-value>\n\t\t</init-param>\n\t</servlet>\n\t<servlet-mapping>\n\t\t<servlet-name>UberfireFileUploadServlet</servlet-name>\n\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/defaulteditor/upload/*</url-pattern>\n\t</servlet-mapping>\n\n\t<servlet>\n\t\t<servlet-name>UberfireFileDownloadServlet</servlet-name>\n\t\t<servlet-class>org.uberfire.server.FileDownloadServlet</servlet-class>\n\t\t<init-param>\n\t\t\t<param-name>includes-path</param-name>\n\t\t\t<param-value>git://**,default://**</param-value>\n\t\t</init-param>\n\t\t<init-param>\n\t\t\t<param-name>excludes-path</param-name>\n\t\t\t<param-value>file://**</param-value>\n\t\t</init-param>\n\t</servlet>\n\t<servlet-mapping>\n\t\t<servlet-name>UberfireFileDownloadServlet</servlet-name>\n\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/defaulteditor/download/*</url-pattern>\n\t</servlet-mapping>\n\n\t<!-- Custom Component assets server -->\n\n\t<servlet>\n\t\t<servlet-name>DashbuilderExternalComponentsServlet</servlet-name>\n\t\t<servlet-class>org.dashbuilder.external.ExternalComponentServlet</servlet-class>\n\t</servlet>\n\t<servlet-mapping>\n\t\t<servlet-name>DashbuilderExternalComponentsServlet</servlet-name>\n\t\t<url-pattern>/dashbuilder/component/*</url-pattern>\n\t</servlet-mapping>\n\n\t<!-- Security roles -->\n\n\t<security-role>\n\t\t<description>Administrator - Manages application configuration and creates dashboards</description>\n\t\t<role-name>admin</role-name>\n\t</security-role>\n\n\t<security-role>\n\t\t<description>User - Consumes existing dashboards</description>\n\t\t<role-name>user</role-name>\n\t</security-role>\n\n\t<!-- Open resources for login page. -->\n\t<security-constraint>\n\t\t<web-resource-collection>\n\t\t\t<web-resource-name>openResources</web-resource-name>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/patternfly/*</url-pattern>\n\t\t</web-resource-collection>\n\t</security-constraint>\n\n\t<!-- Default security constraints. -->\n\t<security-constraint>\n\t\t<web-resource-collection>\n\t\t\t<web-resource-name>default</web-resource-name>\n\t\t\t<url-pattern>/dashbuilder.html</url-pattern>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/*</url-pattern>\n\t\t\t<url-pattern>*.erraiBus</url-pattern>\n\t\t\t<url-pattern>/plugins/*</url-pattern>\n\t\t\t<url-pattern>/dashbuilder/component/*</url-pattern>\n\t\t</web-resource-collection>\n\t\t<auth-constraint>\n\t\t\t<role-name>admin</role-name>\n\t\t\t<role-name>user</role-name>\n\t\t</auth-constraint>\n\t</security-constraint>\n\n\t<!-- Upload/Download servlet security constraints. -->\n\t<security-constraint>\n\t\t<web-resource-collection>\n\t\t\t<web-resource-name>download</web-resource-name>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/archive</url-pattern>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/defaulteditor/upload/*</url-pattern>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/defaulteditor/download/*</url-pattern>\n\t\t</web-resource-collection>\n\t\t<auth-constraint>\n\t\t\t<role-name>admin</role-name>\n\t\t\t<role-name>user</role-name>\n\t\t</auth-constraint>\n\t</security-constraint>\n\n\t<!-- public resources -->\n\t<security-constraint>\n\t\t<web-resource-collection>\n\t\t\t<web-resource-name>public</web-resource-name>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/css/*</url-pattern>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/fonts/*</url-pattern>\n\t\t\t<url-pattern>/org.dashbuilder.DashbuilderShowcase/img/*</url-pattern>\n\t\t</web-resource-collection>\n\t</security-constraint>\n\n\t<error-page>\n\t\t<error-code>403</error-code>\n\t\t<location>/not_authorized.jsp</location>\n\t</error-page>\n\n\t<welcome-file-list>\n\t\t<welcome-file>index.jsp</welcome-file>\n\t</welcome-file-list>\n\n</web-app>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/banner/banner.html",
    "content": "<div class=\"navbar-header\">\n    <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse-5\">\n        <span class=\"sr-only\">Toggle navigation</span>\n        <span class=\"icon-bar\"></span>\n        <span class=\"icon-bar\"></span>\n        <span class=\"icon-bar\"></span>\n    </button>\n    <a class=\"navbar-brand\" href=\"#\">\n        <img src=\"banner/logo.png\"  alt=\"Open source dashboards and reporting\" />\n    </a>\n</div>\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/dashbuilder.html",
    "content": "<!--\n  Copyright 2012 Red Hat, Inc. and/or its affiliates.\n\n  Licensed under the Apache License, Version 2.0 (the \"License\");\n  you may not use this file except in compliance with the License.\n  You may obtain a copy of the License at\n\n        http://www.apache.org/licenses/LICENSE-2.0\n\n  Unless required by applicable law or agreed to in writing, software\n  distributed under the License is distributed on an \"AS IS\" BASIS,\n  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  See the License for the specific language governing permissions and\n  limitations under the License.\n-->\n\n<!DOCTYPE html>\n<html>\n<head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n\n    <title>Dashbuilder</title>\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly.min.css\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/uberfire-loading.css\">\n</head>\n<body>\n<iframe id=\"__gwt_historyFrame\" style=\"width: 0; height: 0; border: 0\"></iframe>\n<!--add loading indicator while the app is being loaded-->\n<div id=\"loading\" class=\"container-fluid\">\n    <div class=\"row\">\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <div class=\"spinner spinner-lg\"></div>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <h3>Please wait</h3>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <span>Loading application...</span>\n            </div>\n        </div>\n    </div>\n</div>\n\n<!-- The GWT js file generated at run time -->\n<script type=\"text/javascript\" src='org.dashbuilder.DashbuilderShowcase/org.dashbuilder.DashbuilderShowcase.nocache.js'></script>\n<!-- Highlight.js -->\n<link href=\"org.dashbuilder.DashbuilderShowcase/highlight/github.min.css\" rel=\"stylesheet\">\n<script src=\"org.dashbuilder.DashbuilderShowcase/highlight/highlight.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<!-- diff2html -->\n<link href=\"org.dashbuilder.DashbuilderShowcase/diff2html/diff2html.min.css\" rel=\"stylesheet\">\n<script src=\"org.dashbuilder.DashbuilderShowcase/diff2html/diff2html.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/diff2html/diff2html-ui.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<!-- ACE - main .js file -->\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/ace.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<!-- Get .js files for any needed ACE modes and themes -->\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/theme-chrome.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/mode-html.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/mode-css.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/mode-javascript.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/mode-text.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/mode-xml.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\n<!--  Needed for autocompletion support. -->\n<script src=\"org.dashbuilder.DashbuilderShowcase/ace/ext-language_tools.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/index.jsp",
    "content": "<%\n  String queryString = request.getQueryString();\n  String redirectURL = request.getContextPath()  +\"/login?\"+(queryString==null?\"\":queryString);\n  response.sendRedirect(redirectURL);\n%>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/login.jsp",
    "content": "<%--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n<%@ page import=\"java.util.Locale\" %>\n<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\" %>\n<%\n    Locale locale = null;\n    try {\n        locale = new Locale( request.getParameter( \"locale\" ) );\n    } catch ( Exception e ) {\n        locale = request.getLocale();\n    }\n%>\n<i18n:bundle id=\"bundle\" baseName=\"org.dashbuilder.client.resources.i18n.LoginConstants\" locale='<%= locale %>' />\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\" lang=\"en\">\n<head>\n    <title>Dashbuilder</title>\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly.min.css\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly-additions.min.css\">\n</head>\n\n<body>\n<span id=\"badge\">\n  <img src=\"images/dashbuilder-logo.png\" alt=\"Dashbuilder Logo\" title=\"<i18n:message key='powered'>Powered By Dashbuilder</i18n:message>\"/>\n</span>\n<div class=\"container\">\n    <div class=\"row\">\n        <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n            <p><strong><i18n:message key=\"welcome\">Welcome to Dashbuilder !</i18n:message></strong></p>\n            <c:if test=\"${param.message != null}\">\n                <div class=\"alert alert-danger\">\n                    <span class=\"pficon-layered\">\n                      <span class=\"pficon pficon-error-octagon\"></span>\n                      <span class=\"pficon pficon-error-exclamation\"></span>\n                    </span>\n                    <%=request.getParameter(\"message\")%>\n                </div>\n            </c:if>\n            <form class=\"form-horizontal\" role=\"form\" action=\"j_security_check\" method=\"post\">\n                <div class=\"form-group\">\n                    <label for=\"j_username\" class=\"col-sm-2 col-md-2 control-label\"><i18n:message key=\"userName\">Username</i18n:message></label>\n                    <div class=\"col-sm-10 col-md-10\">\n                        <input type=\"text\" class=\"form-control\" id=\"j_username\" name=\"j_username\" placeholder=\"admin\" tabindex=\"1\" autofocus>\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <label for=\"j_password\" class=\"col-sm-2 col-md-2 control-label\"><i18n:message key=\"password\">Password</i18n:message></label>\n                    <div class=\"col-sm-10 col-md-10\">\n                        <input type=\"password\" class=\"form-control\" id=\"j_password\" name=\"j_password\" placeholder=\"admin\" tabindex=\"2\">\n                    </div>\n                </div>\n                <div class=\"form-group\">\n                    <div class=\"col-xs-8 col-sm-offset-2 col-sm-6 col-md-offset-2 col-md-6\">\n                        <%--\n                                                <div class=\"checkbox\">\n                                                    <label>\n                                                        <input id=\"nosplash\" name=\"nosplash\" type=\"checkbox\" tabindex=\"3\"> Deactivate Splash Screen\n                                                    </label>\n                                                </div>\n                        --%>\n                    </div>\n                    <div class=\"col-xs-4 col-sm-4 col-md-4 submit\">\n                        <button type=\"submit\" class=\"btn btn-primary btn-lg\" tabindex=\"4\"><i18n:message key=\"signIn\">Sign In</i18n:message></button>\n                    </div>\n                </div>\n            </form>\n        </div>\n    </div>\n</div>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/logout.jsp",
    "content": "<%--\n~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>\n<%@ page import=\"java.util.Locale\" %>\n<%\n    request.logout();\n    javax.servlet.http.HttpSession httpSession = request.getSession(false);\n    if (httpSession != null) {\n        httpSession.invalidate();\n    }\n    Locale locale = null;\n    try {\n        locale = new Locale( request.getParameter( \"locale\" ) );\n    } catch ( Exception e ) {\n        locale = request.getLocale();\n    }\n%>\n<i18n:bundle id=\"bundle\" baseName=\"org.dashbuilder.client.resources.i18n.LoginConstants\" locale='<%= locale%>' />\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\">\n<head>\n    <title>Dashbuilder</title>\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly.min.css\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly-additions.min.css\">\n</head>\n\n<body>\n<span id=\"badge\">\n  <img src=\"images/dashbuilder-logo.png\" alt=\"Dashbuilder Logo\" title=\"<i18n:message key='powered'>Powered By Dashbuilder</i18n:message>\"/>\n</span>\n<div class=\"container\">\n    <div class=\"row\">\n        <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n            <p><strong><i18n:message key=\"logoutSuccessful\">Logout successful</i18n:message></strong></p>\n            <form class=\"form-horizontal\" role=\"form\" action=\"<%= request.getContextPath() %>/dashbuilder.html\" method=\"post\">\n                <div class=\"form-group\">\n                    <div class=\"col-xs-4 col-sm-4 col-md-4 submit\" style=\"text-align: left;\">\n                        <button type=\"submit\" class=\"btn btn-primary btn-lg\" tabindex=\"4\"><i18n:message key=\"loginAgain\">Login again</i18n:message></button>\n                    </div>\n                </div>\n            </form>\n        </div>\n    </div>\n</div>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/main/webapp/not_authorized.jsp",
    "content": "<%--\n~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n<%@ page language=\"java\" contentType=\"text/html; charset=UTF-8\" pageEncoding=\"UTF-8\"%>\n<%@ page import=\"java.util.Locale\" %>\n<%\n    request.getSession().invalidate();\n    Locale locale = null;\n    try {\n        locale = new Locale( request.getParameter( \"locale\" ) );\n    } catch ( Exception e ) {\n        locale = request.getLocale();\n    }\n%>\n<i18n:bundle id=\"bundle\" baseName=\"org.dashbuilder.client.resources.i18n.LoginConstants\" locale='<%= locale%>' />\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\">\n<head>\n    <title>Dashbuilder</title>\n    <link rel=\"icon\" href=\"favicon.ico\" type=\"image/x-icon\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly.min.css\">\n    <link rel=\"stylesheet\" href=\"org.dashbuilder.DashbuilderShowcase/css/patternfly-additions.min.css\">\n</head>\n\n<body>\n<span id=\"badge\">\n  <img src=\"images/dashbuilder-logo.png\" alt=\"Dashbuilder Logo\" title=\"<i18n:message key='powered'>Powered By Dashbuilder</i18n:message>\"/>\n</span>\n<div class=\"container\">\n    <div class=\"row\">\n        <div class=\"col-sm-6 col-md-5 col-lg-4 login\">\n            <p><strong><i18n:message key=\"loginFailed\">Login failed: Not Authorized</i18n:message></strong></p>\n            <form class=\"form-horizontal\" role=\"form\" action=\"<%= request.getContextPath() %>/dashbuilder.html\" method=\"post\">\n                <div class=\"form-group\">\n                    <div class=\"col-xs-4 col-sm-4 col-md-4 submit\">\n                        <button type=\"submit\" class=\"btn btn-primary btn-lg\" tabindex=\"4\">\n                            <i18n:message key=\"loginAsAnotherUser\">Login as another user</i18n:message>\n                        </button>\n                    </div>\n                </div>\n            </form>\n        </div>\n    </div>\n</div>\n\n</body>\n</html>"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/test/java/org/dashbuilder/security/SecurityPolicyTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.dashbuilder.security;\n\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.event.Event;\n\nimport org.dashbuilder.perspectives.PerspectiveIds;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.backend.server.authz.AuthorizationPolicyDeployer;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.security.authz.AuthorizationResult.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SecurityPolicyTest {\n\n    static final String HOME_PERSPECTIVE = PerspectiveIds.HOME;\n\n    static final List<String> DEFAULT_DENIED = Arrays.asList(\n            \"perspective.read\",\n            \"perspective.create\",\n            \"perspective.delete\",\n            \"perspective.update\");\n\n    @Mock\n    AuthorizationPolicyStorage storage;\n\n    @Mock\n    Event<AuthorizationPolicyDeployedEvent> deployedEvent;\n\n    AuthorizationPolicyDeployer deployer;\n    PermissionManager permissionManager;\n    AuthorizationPolicy policy;\n\n    @Before\n    public void setUp() throws Exception {\n        permissionManager = new DefaultPermissionManager();\n        deployer = new AuthorizationPolicyDeployer(storage, permissionManager, deployedEvent);\n\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(\"security-policy.properties\");\n        Path policyDir = Paths.get(fileURL.toURI()).getParent();\n        deployer.deployPolicy(policyDir);\n\n        ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class);\n        verify(storage).loadPolicy();\n        verify(storage).savePolicy(policyCaptor.capture());\n        policy = policyCaptor.getValue();\n    }\n\n    @Test\n    public void testPolicyDeployment() {\n        assertNotNull(policy);\n        assertEquals(policy.getRoles().size(), 1);\n\n        verify(storage).savePolicy(policy);\n        verify(deployedEvent).fire(any());\n    }\n\n    @Test\n    public void testDefaultPermissions() {\n        assertEquals(policy.getHomePerspective(), HOME_PERSPECTIVE);\n        PermissionCollection pc = policy.getPermissions();\n\n        for (String permissionName : DEFAULT_DENIED) {\n            Permission p = pc.get(permissionName);\n            assertNotNull(p);\n            assertEquals(p.getResult(), ACCESS_DENIED);\n        }\n    }\n\n    @Test\n    public void testAdminPermissions() {\n        testPermissions(new RoleImpl(\"admin\"), null, HOME_PERSPECTIVE, ACCESS_GRANTED, null);\n    }\n\n    public void testPermissions(Role role,\n                                List<String> exceptionList,\n                                String homeExpected,\n                                AuthorizationResult defaultExpected,\n                                AuthorizationResult exceptionExpected) {\n\n        assertEquals(role != null ? policy.getHomePerspective(role) : policy.getHomePerspective(), homeExpected);\n        PermissionCollection pc = policy.getPermissions(role);\n\n        for (String permissionName : DEFAULT_DENIED) {\n            if (exceptionList == null || !exceptionList.contains(permissionName)) {\n                Permission p = pc.get(permissionName);\n                assertNotNull(p);\n                assertEquals(p.getResult(), defaultExpected);\n            }\n        }\n        if (exceptionList != null) {\n            for (String permissionName : exceptionList) {\n                Permission p = pc.get(permissionName);\n                assertNotNull(p);\n                assertEquals(p.getResult(), exceptionExpected);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "dashbuilder/dashbuilder-webapp/src/test/resources/datasources/h2-test-ds.xml",
    "content": "<datasources xmlns=\"http://www.jboss.org/ironjacamar/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd\">\n  <datasource jndi-name=\"java:jboss/datasources/TestDS\" pool-name=\"TestDS\" enabled=\"true\" use-java-context=\"true\">\n    <connection-url>jdbc:h2:~/test;DATABASE_TO_UPPER=FALSE</connection-url>\n    <driver>h2</driver>\n    <security>\n      <user-name>sa</user-name>\n      <password>sa</password>\n    </security>\n  </datasource>\n</datasources>"
  },
  {
    "path": "dashbuilder/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <!-- Keep in sync with the parent version of dashbuilder-bom/pom.xml -->\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <groupId>org.dashbuilder</groupId>\n  <artifactId>dashbuilder-parent</artifactId>\n  <version>7.75.0-SNAPSHOT</version>\n  <packaging>pom</packaging>\n\n  <name>Dashbuilder Project</name>\n\n  <modules>\n    <module>dashbuilder-backend</module>\n    <module>dashbuilder-shared</module>\n    <module>dashbuilder-client</module>\n    <module>dashbuilder-packaging</module>\n    <module>dashbuilder-webapp</module>\n    <module>dashbuilder-runtime</module>\n  </modules>\n\n  <profiles>\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <modules>\n        <module>dashbuilder-distros</module>\n      </modules>\n    </profile>\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "dashbuilder/scripts/release/dashbuilder-createAndDeploy.sh",
    "content": "#!/bin/bash -e\n\n# removing dashbuilder artifacts from local maven repo (basically all possible SNAPSHOTs)\nif [ -d $MAVEN_REPO_LOCAL ]; then\n    rm -rf $MAVEN_REPO_LOCAL/org/dashbuilder/\nfi\n\n# clone the repository and branch\ngit clone git@github.com:dashbuilder/dashbuilder.git --branch $baseBranch\n\n# checkout the release branch \ncd $WORKSPACE/dashbuilder  \ngit checkout -b $releaseBranch $baseBranch\n\n# upgrades the version to the release/tag version\nsh scripts/release/update-version.sh $newVersion\n\n# update files that are not automatically changed with the update-version.sh script\nsed -i \"$!N;s/<version.org.uberfire>.*.<\\/version.org.uberfire>/<version.org.uberfire>$uberfireVersion<\\/version.org.uberfire>/;P;D\" pom.xml\nsed -i \"$!N;s/<version.org.jboss.errai>.*.<\\/version.org.jboss.errai>/<version.org.jboss.errai>$erraiVersion<\\/version.org.jboss.errai>/;P;D\" pom.xml\nsed -i \"$!N;s/<version.org.kie.soup>.*.<\\/version.org.kie.soup>/<version.org.kie.soup>$kiesoupVersion<\\/version.org.kie.soup>/;P;D\" pom.xml\n\n# git add and commit the version update changes \ngit add .\ncommitMsg=\"update to version $newVersion\"\ngit commit -m \"$commitMsg\"\n\nif [ \"$target\" == \"community\" ]; then\n   stagingProfile=15c58a1abc895b\nelse\n   stagingProfile=15c3321d12936e\nfi\n\n# build the repos & deploy into local dir (will be later copied into staging repo)\ndeployDir=$WORKSPACE/deployDir\n# (1) do a full build, but deploy only into local dir\n# we will deploy into remote staging repo only once the whole build passed (to save time and bandwith)\nmvn -B -e -U clean deploy -Dfull -Drelease -T1C -DaltDeploymentRepository=local::default::file://$deployDir -Dmaven.test.failure.ignore=true\\\n -Dgwt.memory.settings=\"-Xmx2g -Xms1g -Xss1M\" -Dgwt.compiler.localWorkers=2\n\n# (2) upload the content to remote staging repo\ncd $deployDir\nmvn -B -e org.sonatype.plugins:nexus-staging-maven-plugin:1.6.5:deploy-staged-repository -DnexusUrl=https://repository.jboss.org/nexus -DserverId=jboss-releases-repository\\\n -DrepositoryDirectory=$deployDir -DstagingProfileId=$stagingProfile -DstagingDescription=\"dashbuilder $newVersion\" -DstagingProgressTimeoutMinutes=30\n\ncd $WORKSPACE/dashbuilder\n# pushes the release-branches to rhub.com:jboss-integration or github.com:dashbuilder [IMPORTANT: \"push -n\" (--dryrun) should be replaced by \"push\" when script is finished and will be applied]\nif [ \"$target\" == \"community\" ]; then\n   git push origin $releaseBranch\nelse\n   git remote add upstream git@github.com:jboss-integration/dashbuilder.git\n   git push upstream $releaseBranch\n   git push upstream $baseBranch\nfi\n"
  },
  {
    "path": "dashbuilder/scripts/release/dashbuilder-pushTag.sh",
    "content": "#!/bin/bash -e\n\n# clone the repository and the release-branch\n\nif [ \"$target\" == \"productized\" ]; then\n   git clone git@github.com:jboss-integration/dashbuilder.git --branch $releaseBranch\nelse \n   git clone git@github.com:dashbuilder/dashbuilder.git --branch $releaseBranch\nfi\n\ncommitMsg=\"Tagging $tag\"\ncd $WORKSPACE/dashbuilder\n# pushes the TAG to ssh://jb-ip-tooling-jenkins@code.engineering.redhat.com/dashbuilder [IMPORTANT: \"push -n\" (--dryrun) should be replaced by \"push\" when script is ready]\nif [ \"$target\" == \"productized\" ]; then\n   git tag -a $TAG -m \"$commitMsg\"\n   git remote add gerrit ssh://jb-ip-tooling-jenkins@code.engineering.redhat.com/dashbuilder\n   git push gerrit $tag\nelse\n   git tag -a $TAG -m \"$commitMsg\"\n   git push origin $tag\nfi\n"
  },
  {
    "path": "dashbuilder/scripts/release/dashbuilder-updateVersion.sh",
    "content": "#!/bin/bash -e\n\ntargetUser=kiereleaseuser\nremoteUrl=git@github.com:kiereleaseuser/dashbuilder.git\nDATE=$(date \"+%Y-%m-%d\")\n\n# clone the repository and branch of dashbuilder\ngit clone git@github.com:dashbuilder/dashbuilder.git --branch $baseBranch\ncd $WORKSPACE/dashbuilder\nprBranch=dashbuilder-upgrade-version-$DATE-$baseBranch\ngit checkout -b $prBranch $baseBranch\ngit remote add $targetUser $remoteUrl\n\n# upgrades the version to next development version of dashbuilder\nsh scripts/release/update-version.sh $newVersion\n\n# change properties via sed as they don't update automatically\n\nsed -i \\\n-e \"$!N;s/<version.org.uberfire>.*.<\\/version.org.uberfire>/<version.org.uberfire>$uberfireDevelVersion<\\/version.org.uberfire>/;\" \\\n-e \"s/<version.org.jboss.errai>.*.<\\/version.org.jboss.errai>/<version.org.jboss.errai>$erraiDevelVerison<\\/version.org.jboss.errai>/;P;D\" \\\npom.xml\n\n# git add and commit the version update changes \ngit add .\ncommitMsg=\"update to next development version $newVersion\"\ngit commit -m \"$commitMsg\"\n\n# do a build of dashbuilder\nmvn -B -e -U clean install -Dfull -Dgwt.memory.settings=\"-Xmx3g -Xms1g -Xss1M\"\n\n# Raise a PR\nsource=dashbuilder\ngit push $targetUser $prBranch\nhub pull-request -m \"$commitMsg\" -b $source:$baseBranch -h $targetUser:$prBranch\n"
  },
  {
    "path": "dashbuilder/scripts/release/update-version.sh",
    "content": "#!/bin/bash\nset -e\n# Updates the version for all Dashbuilder modules\n\ninitializeWorkingDirAndScriptDir() {\n    # Set working directory and remove all symbolic links\n    workingDir=`pwd -P`\n\n    # Go the script directory\n    cd `dirname $0`\n    # If the file itself is a symbolic link (ignoring parent directory links), then follow that link recursively\n    # Note that scriptDir=`pwd -P` does not do that and cannot cope with a link directly to the file\n    scriptFileBasename=`basename $0`\n    while [ -L \"$scriptFileBasename\" ] ; do\n        scriptFileBasename=`readlink $scriptFileBasename` # Follow the link\n        cd `dirname $scriptFileBasename`\n        scriptFileBasename=`basename $scriptFileBasename`\n    done\n    # Set script directory and remove other symbolic links (parent directory links)\n    scriptDir=`pwd -P`\n}\n\nmvnVersionsSet() {\n    newVersion=$1\n    mvn -B -N -Dfull versions:set -DnewVersion=$newVersion -DallowSnapshots=true -DgenerateBackupPoms=false\n}\n\ninitializeWorkingDirAndScriptDir\ndashbuilderTopLevelDir=\"$scriptDir/../..\"\n\nif [ $# != 1 ] ; then\n    echo\n    echo \"Usage:\"\n    echo \"  $0 newVersion\"\n    echo \"For example:\"\n    echo \"  $0 0.5.0.Final\"\n    echo\n    exit 1\nfi\n\nnewVersion=$1\n\nstartDateTime=`date +%s`\n\ncd $dashbuilderTopLevelDir\nmvnVersionsSet $newVersion\n\n# fix leftovers not covered by the first run\ncd $dashbuilderTopLevelDir/dashbuilder-bom\nmvnVersionsSet $newVersion\n\nendDateTime=`date +%s`\nspentSeconds=`expr $endDateTime - $startDateTime`\n\necho\necho \"Total time: ${spentSeconds}s\"\n"
  },
  {
    "path": "drools_jbpm_eclipse_formatter_config.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n\n<profiles version=\"12\">\n<profile kind=\"CodeFormatterProfile\" name=\"Drools and jBPM: Java Conventions\" version=\"12\">\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_ellipsis\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_after_imports\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_javadoc_comments\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indentation.size\" value=\"4\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.disabling_tag\" value=\"@formatter:off\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.continuation_indentation\" value=\"2\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_enum_constants\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_imports\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_after_package\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_binary_operator\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.indent_root_tags\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.enabling_tag\" value=\"@formatter:on\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.problem.enumIdentifier\" value=\"error\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_statements_compare_to_block\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.line_length\" value=\"120\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.use_on_off_tags\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_method_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch\" value=\"16\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_binary_expression\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_block\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.compact_else_if\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.problem.assertIdentifier\" value=\"error\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_binary_operator\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_unary_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer\" value=\"82\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_ellipsis\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_line_comments\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.align_type_members_on_columns\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_assignment\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_conditional_expression\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_block_in_case\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_header\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode\" value=\"enabled\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_method_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.join_wrapped_lines\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_resources_in_try\" value=\"80\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation\" value=\"82\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.source\" value=\"1.7\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.tabulation.size\" value=\"4\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_source_code\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_field\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer\" value=\"2\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_method\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.codegen.targetPlatform\" value=\"1.7\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_switch\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_html\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_compact_if\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_empty_lines\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_unary_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation\" value=\"82\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_label\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_member_type\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_semicolon\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.format_block_comments\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration\" value=\"83\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_statements_compare_to_body\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.alignment_for_multiple_fields\" value=\"16\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_array_initializer\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.wrap_before_binary_operator\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.compiler.compliance\" value=\"1.7\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested\" value=\"false\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_enum_constant\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.brace_position_for_type_declaration\" value=\"end_of_line\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_before_package\" value=\"0\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.join_lines_in_comments\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional\" value=\"insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.comment.indent_parameter_description\" value=\"true\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.tabulation.char\" value=\"space\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.blank_lines_between_import_groups\" value=\"1\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.lineSplit\" value=\"120\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation\" value=\"do not insert\"/>\n<setting id=\"org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch\" value=\"insert\"/>\n</profile>\n</profiles>\n"
  },
  {
    "path": "pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.kie</groupId>\n    <artifactId>kie-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <!-- Keep in sync with the parent version of uberfire-bom/pom.xml -->\n  </parent>\n\n\n  <groupId>org.uberfire</groupId>\n  <artifactId>uberfire-parent</artifactId>\n  <version>7.75.0-SNAPSHOT</version>\n  <packaging>pom</packaging>\n\n  <name>UberFire parent</name>\n  <description>\n    The parent contains all metadata (including plugins) and also dependency versions. All UberFire modules\n    (except for user BOMs like 'uberfire-bom') should (transitively) inherit from this POM.\n  </description>\n  <inceptionYear>2012</inceptionYear>\n  <organization>\n    <name>JBoss by Red Hat</name>\n    <url>http://www.jboss.org/</url>\n  </organization>\n  <licenses>\n    <license>\n      <name>Apache Software License, Version 2.0</name>\n      <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>\n      <distribution>repo</distribution>\n    </license>\n  </licenses>\n\n  <properties>\n    <uberfire.version>${project.version}</uberfire.version>\n    <version.org.kie.soup>${version.org.kie}</version.org.kie.soup>\n    <version.org.webjars.bower.org.patternfly>3.18.1</version.org.webjars.bower.org.patternfly>\n    <version.org.webjars.bower.google-code-prettify>1.0.4</version.org.webjars.bower.google-code-prettify>\n    <version.org.webjars.bower.bootstrap-select>1.10.0</version.org.webjars.bower.bootstrap-select>\n    <version.org.webjars.bower.moment>2.29.4</version.org.webjars.bower.moment>\n    <version.org.webjars.bower.moment-timezone>0.5.17</version.org.webjars.bower.moment-timezone>\n    <version.org.webjars.bower.bluebird>3.1.1</version.org.webjars.bower.bluebird>\n    <version.org.webjars.npm.react>16.6.0</version.org.webjars.npm.react>\n    <version.org.webjars.npm.react-dom>16.6.0</version.org.webjars.npm.react-dom>\n    <version.org.webjars.bower.bootstrap-daterangepicker>2.1.25</version.org.webjars.bower.bootstrap-daterangepicker>\n    <version.org.webjars.bower.filesaver>1.3.3</version.org.webjars.bower.filesaver>\n    <!-- Notice actually there exists a 1.3.3 version for jsPDF, but using this one\n        produces a conflict with the UF ace js plugin once trying to create a new jsPDF\n        instance.-->\n    <version.org.webjars.bower.jspdf>1.2.61</version.org.webjars.bower.jspdf>\n    <version.org.webjars.bowergithub.gliffy.canvas2svg>0.1</version.org.webjars.bowergithub.gliffy.canvas2svg>\n    <version.org.webjars.bower.mustachejs>3.0.1</version.org.webjars.bower.mustachejs>\n    <version.org.webjars.bower.d3js>5.5.0</version.org.webjars.bower.d3js>\n    <version.org.webjars.bower.c3>0.6.6</version.org.webjars.bower.c3>\n    <version.org.webjars.bower.d3geoprojection>2.5.1</version.org.webjars.bower.d3geoprojection>\n    <version.org.webjars.bower.jqueryui>1.12.1</version.org.webjars.bower.jqueryui>\n\n    <version.org.jboss.jboss-msc>1.2.7.SP1</version.org.jboss.jboss-msc>\n\n    <version.org.apache.activemq.artemis>2.19.1</version.org.apache.activemq.artemis>\n    <netty-transport-native-epoll-classifier>linux-x86_64</netty-transport-native-epoll-classifier>\n    <netty-transport-native-kqueue-classifier>osx-x86_64</netty-transport-native-kqueue-classifier>\n\n    <version.bundle.plugin>3.3.0</version.bundle.plugin><!-- 3.2.0 sometimes fails with NPE during parallel build-->\n    <!-- Make OSGi happy -->\n    <osgi.snapshot.qualifier>${maven.build.timestamp}</osgi.snapshot.qualifier>\n    <jboss.releases.repo.url>https://repository.jboss.org/nexus/service/local/staging/deploy/maven2/</jboss.releases.repo.url>\n    <jboss.snapshots.repo.url>https://repository.jboss.org/nexus/content/repositories/snapshots/</jboss.snapshots.repo.url>\n\n    <version.org.infinispan.protostream>4.3.5.Final</version.org.infinispan.protostream>\n\n    <!-- Newer version in kie-parent causes ServiceLoader error -->\n    <version.ch.qos.logback>1.2.13</version.ch.qos.logback>\n    <version.jnuit.docker.rule>0.3</version.jnuit.docker.rule>\n    <version.com.spotify.docker>5.0.2</version.com.spotify.docker>\n    <version.org.uberfire.latestFinal.release>1.4.0.Final</version.org.uberfire.latestFinal.release>\n    <revapi.oldUberFireVersion>${version.org.uberfire.latestFinal.release}</revapi.oldUberFireVersion>\n    <revapi.newUberFireVersion>${project.version}</revapi.newUberFireVersion>\n\n    <version.com.googlecode.jsonsimple>1.1.1</version.com.googlecode.jsonsimple>\n    <version.com.googlecode.jtype>0.1.1</version.com.googlecode.jtype>\n\n    <!-- database testing -->\n    <version.org.mariadb.jdbc>1.3.6</version.org.mariadb.jdbc>\n    <version.org.mysql-driver>8.0.28</version.org.mysql-driver>\n\n    <version.org.arquillian.cube>1.15.3</version.org.arquillian.cube>\n\n    <version.org.jboss.shrinkwrap>1.2.6</version.org.jboss.shrinkwrap>\n\n    <version.org.jboss.marshalling.api>1.2.3.GA</version.org.jboss.marshalling.api>\n    <!-- Version 2.0.1.Final which is coming from kie-parent is not compatible with dashbuilder-validator module -->\n    <version.javax.validation>1.0.0.GA</version.javax.validation>\n  </properties>\n\n  <repositories>\n    <repository>\n      <id>jboss-public-repository-group</id>\n      <name>JBoss Public Repository Group</name>\n      <url>https://repository.jboss.org/nexus/content/groups/public/</url>\n      <releases>\n        <enabled>true</enabled>\n        <updatePolicy>never</updatePolicy>\n      </releases>\n      <snapshots>\n        <enabled>true</enabled>\n        <updatePolicy>daily</updatePolicy>\n      </snapshots>\n    </repository>\n  </repositories>\n  <pluginRepositories>\n    <pluginRepository>\n      <id>jboss-public-repository-group</id>\n      <name>JBoss Public Repository Group</name>\n      <url>https://repository.jboss.org/nexus/content/groups/public/</url>\n      <releases>\n        <enabled>true</enabled>\n      </releases>\n      <snapshots>\n        <enabled>true</enabled>\n      </snapshots>\n    </pluginRepository>\n  </pluginRepositories>\n\n  <scm>\n    <connection>scm:git:git@github.com:uberfire/uberfire.git</connection>\n    <developerConnection>scm:git:git@github.com:uberfire/uberfire.git</developerConnection>\n    <url>https://github.com/uberfire/uberfire</url>\n  </scm>\n  <issueManagement>\n    <system>jira</system>\n    <url>https://issues.jboss.org/browse/UF</url>\n  </issueManagement>\n\n  <build>\n    <pluginManagement>\n      <plugins>\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-resources-plugin</artifactId>\n          <configuration>\n            <encoding>UTF-8</encoding>\n          </configuration>\n        </plugin>\n        <plugin>\n          <groupId>org.codehaus.mojo</groupId>\n          <artifactId>build-helper-maven-plugin</artifactId>\n          <executions>\n            <execution>\n              <goals>\n                <goal>parse-version</goal>\n              </goals>\n            </execution>\n            <execution>\n              <id>add-source</id>\n              <phase>generate-sources</phase>\n              <goals>\n                <goal>add-source</goal>\n              </goals>\n              <configuration>\n                <sources>\n                  <source>target/generated-sources/annotations</source>\n                </sources>\n              </configuration>\n            </execution>\n          </executions>\n        </plugin>\n        <plugin>\n          <groupId>org.codehaus.mojo</groupId>\n          <artifactId>gwt-maven-plugin</artifactId>\n          <version>${version.com.google.gwt}</version>\n        </plugin>\n        <plugin>\n          <groupId>org.apache.felix</groupId>\n          <artifactId>maven-bundle-plugin</artifactId>\n          <extensions>true</extensions>\n          <configuration>\n            <!-- Split packages in combination with <Export-Package> causes bloated jars otherwise -->\n            <excludeDependencies>true</excludeDependencies>\n            <instructions>\n              <_removeheaders>Ignore-Package</_removeheaders>\n              <_nouses>true</_nouses>\n              <_snapshot>${osgi.snapshot.qualifier}</_snapshot>\n              <Bundle-Version>\n                ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}\n              </Bundle-Version>\n            </instructions>\n            <obrRepository>NONE</obrRepository>\n          </configuration>\n        </plugin>\n\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-surefire-plugin</artifactId>\n          <configuration>\n            <systemPropertyVariables>\n              <org.uberfire.nio.git.daemon.enabled>false</org.uberfire.nio.git.daemon.enabled>\n              <org.uberfire.nio.git.ssh.enabled>false</org.uberfire.nio.git.ssh.enabled>\n              <org.uberfire.sys.repo.monitor.disabled>true</org.uberfire.sys.repo.monitor.disabled>\n              <org.uberfire.nio.git.dir>${project.build.directory}</org.uberfire.nio.git.dir>\n              <apple.awt.UIElement>true</apple.awt.UIElement>\n            </systemPropertyVariables>\n            <includes>\n              <include>**/*Test.java</include>\n            </includes>\n            <excludes>\n              <exclude>**/*IntegrationTest.java</exclude>\n            </excludes>\n            <argLine>-Xmx1024m -Dfile.encoding=UTF-8</argLine>\n          </configuration>\n        </plugin>\n\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-failsafe-plugin</artifactId>\n          <executions>\n            <execution>\n              <goals>\n                <goal>integration-test</goal>\n                <goal>verify</goal>\n              </goals>\n            </execution>\n          </executions>\n          <configuration>\n            <includes>\n              <include>**/*IntegrationTest.java</include>\n            </includes>\n            <argLine>-Xmx1024m -Dfile.encoding=UTF-8</argLine>\n          </configuration>\n        </plugin>\n\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-source-plugin</artifactId>\n          <executions>\n            <execution>\n              <id>attach-sources</id>\n              <goals>\n                <goal>jar-no-fork</goal>\n              </goals>\n              <configuration>\n                <archive>\n                  <manifestEntries>\n                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>\n                    <Bundle-SymbolicName>${project.artifactId}.source</Bundle-SymbolicName>\n                    <Bundle-Version>\n                      ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}\n                    </Bundle-Version>\n                    <Bundle-Name>${project.name}</Bundle-Name>\n                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>\n                    <Eclipse-SourceBundle>\n                      ${project.artifactId};version=\"${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}\";roots:=\".\"\n                    </Eclipse-SourceBundle>\n                  </manifestEntries>\n                </archive>\n              </configuration>\n            </execution>\n            <execution>\n              <id>attach-test-sources</id>\n              <goals>\n                <goal>test-jar-no-fork</goal>\n              </goals>\n              <configuration>\n                <archive>\n                  <manifestEntries>\n                    <Bundle-ManifestVersion>2</Bundle-ManifestVersion>\n                    <Bundle-SymbolicName>${project.artifactId}.tests.source</Bundle-SymbolicName>\n                    <Bundle-Version>\n                      ${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}\n                    </Bundle-Version>\n                    <Bundle-Name>${project.name}</Bundle-Name>\n                    <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>\n                    <Eclipse-SourceBundle>\n                      ${project.artifactId}.tests;version=\"${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.${osgi.snapshot.qualifier}\";roots:=\".\"\n                    </Eclipse-SourceBundle>\n                  </manifestEntries>\n                </archive>\n              </configuration>\n            </execution>\n          </executions>\n        </plugin>\n        <plugin>\n          <groupId>org.commonjava.maven.plugins</groupId>\n          <artifactId>project-sources-maven-plugin</artifactId>\n          <version>1.0</version>\n          <executions>\n            <execution>\n              <id>project-sources-archive</id>\n              <phase>initialize</phase>\n              <goals>\n                <goal>archive</goal>\n              </goals>\n            </execution>\n          </executions>\n        </plugin>\n\n        <plugin>\n          <groupId>org.codehaus.mojo</groupId>\n          <artifactId>versions-maven-plugin</artifactId>\n          <version>2.2</version>\n        </plugin>\n\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-release-plugin</artifactId>\n          <configuration>\n            <!-- Manually push changes (including git tags) after nexus staged\n                 repo is successfully closed -->\n            <pushChanges>false</pushChanges>\n            <autoVersionSubmodules>true</autoVersionSubmodules>\n          </configuration>\n        </plugin>\n\n        <plugin>\n          <groupId>org.apache.maven.plugins</groupId>\n          <artifactId>maven-javadoc-plugin</artifactId>\n          <configuration>\n            <links>\n              <link>http://docs.oracle.com/javase/8/docs/api</link>\n            </links>\n            <minmemory>128m</minmemory>\n            <maxmemory>512m</maxmemory>\n            <author>false</author>\n            <breakiterator>true</breakiterator>\n            <quiet>true</quiet>\n          </configuration>\n        </plugin>\n\n        <plugin>\n          <groupId>org.codehaus.mojo</groupId>\n          <artifactId>jaxb2-maven-plugin</artifactId>\n          <version>1.3</version>\n        </plugin>\n\n        <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->\n        <plugin>\n          <groupId>org.eclipse.m2e</groupId>\n          <artifactId>lifecycle-mapping</artifactId>\n          <!-- Important: do not remove the lifecycle-mapping plugin version (even if already coming from parent)!\n               This is to workaround bug in Eclipse m2e: https://bugs.eclipse.org/bugs/show_bug.cgi?id=371618 -->\n          <version>1.0.0</version>\n          <configuration>\n            <lifecycleMappingMetadata>\n              <pluginExecutions>\n                <pluginExecution>\n                  <pluginExecutionFilter>\n                    <groupId>org.codehaus.mojo</groupId>\n                    <artifactId>build-helper-maven-plugin</artifactId>\n                    <versionRange>[1.7,)</versionRange>\n                    <goals>\n                      <goal>parse-version</goal>\n                    </goals>\n                  </pluginExecutionFilter>\n                  <action>\n                    <ignore/>\n                  </action>\n                </pluginExecution>\n                <pluginExecution>\n                  <pluginExecutionFilter>\n                    <groupId>org.codehaus.mojo</groupId>\n                    <artifactId>gwt-maven-plugin</artifactId>\n                    <versionRange>[2.3.0,)</versionRange>\n                    <goals>\n                      <goal>resources</goal>\n                    </goals>\n                  </pluginExecutionFilter>\n                  <action>\n                    <execute/>\n                  </action>\n                </pluginExecution>\n              </pluginExecutions>\n            </lifecycleMappingMetadata>\n          </configuration>\n        </plugin>\n      </plugins>\n\n    </pluginManagement>\n\n    <plugins>\n      <plugin>\n        <!-- Entry needed to provide parsed version properties -->\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>build-helper-maven-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <!-- Entry needed to create, install and deploy sources jars -->\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-source-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-enforcer-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>src/main/webapp/WEB-INF/deploy/</include>\n                <include>src/main/webapp/WEB-INF/classes/</include>\n                <include>src/main/webapp/WEB-INF/lib/</include>\n                <include>.errai/</include>\n                <include>.niogit/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n\n      <!--Fix translations from Zanata -->\n      <plugin>\n        <groupId>com.google.code.maven-replacer-plugin</groupId>\n        <artifactId>replacer</artifactId>\n        <version>1.5.2</version>\n        <configuration>\n          <includes>\n            <include>**/*Constants_de.properties</include>\n            <include>**/*Constants_es.properties</include>\n            <include>**/*Constants_fr.properties</include>\n            <include>**/*Constants_ja.properties</include>\n            <include>**/*Constants_pt_BR.properties</include>\n            <include>**/*Constants_zh_CN.properties</include>\n            <include>**/*Constants_ru.properties</include>\n          </includes>\n          <excludes>\n            <exclude>**/ErraiApp.properties</exclude>\n          </excludes>\n          <replacements>\n            <replacement>\n              <token>''</token>\n              <value>'</value>\n            </replacement>\n            <replacement>\n              <token>'</token>\n              <value>''</value>\n            </replacement>\n          </replacements>\n        </configuration>\n      </plugin>\n\n      <!-- Zanata - translations -->\n      <plugin>\n        <groupId>org.zanata</groupId>\n        <artifactId>zanata-maven-plugin</artifactId>\n        <version>2.3.0</version>\n        <configuration>\n          <excludes>**/ErraiApp.properties</excludes>\n          <projectConfig>${session.executionRootDirectory}/src/main/config/zanata.xml</projectConfig>\n          <srcDir>src/main/resources/</srcDir>\n          <transDir>src/main/resources/</transDir>\n          <includes>**/*Constants.properties</includes>\n        </configuration>\n      </plugin>\n\n      <plugin>\n        <!-- Entry needed to create test-jars even for packaging types war, bundle, ... -->\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-jar-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-failsafe-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-antrun-plugin</artifactId>\n        <executions>\n          <!-- Temporary workaround for https://issues.jboss.org/browse/ERRAI-1101. Needs to stay here until\n          we find a general solution (e.g. moving all localized code to Errai TranslationService. -->\n          <execution>\n            <id>create-default-i18n-resource</id>\n            <phase>process-resources</phase>\n            <configuration>\n              <target>\n                <copy todir=\"${project.build.directory}/classes\"\n                      includeemptydirs=\"false\" failonerror=\"false\" quiet=\"true\">\n                  <fileset dir=\"${project.build.directory}/classes\"/>\n                  <globmapper from=\"*Constants.properties\" to=\"*Constants_default.properties\"/>\n                </copy>\n              </target>\n            </configuration>\n            <goals>\n              <goal>run</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n  </build>\n\n  <reporting>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-checkstyle-plugin</artifactId>\n        <configuration>\n          <configLocation>org/uberfire/build/uberfire_checks.xml</configLocation>\n          <headerLocation>org/uberfire/build/uberfire_license_header.txt</headerLocation>\n        </configuration>\n      </plugin>\n    </plugins>\n  </reporting>\n\n  <profiles>\n    <profile>\n      <id>graph</id>\n      <build>\n        <plugins>\n          <!-- Important: you need to have Graphviz installed on your system to make the plugin work! -->\n          <plugin>\n            <groupId>org.fusesource.mvnplugins</groupId>\n            <artifactId>maven-graph-plugin</artifactId>\n            <version>1.38</version>\n            <executions>\n              <execution>\n                <id>dependency-graph-reactor</id>\n                <phase>install</phase>\n                <goals>\n                  <goal>reactor</goal>\n                </goals>\n              </execution>\n            </executions>\n            <configuration>\n              <hideExternal>true</hideExternal>\n            </configuration>\n          </plugin>\n          <!-- Copied from kie-parent -->\n          <plugin>\n            <groupId>org.revapi</groupId>\n            <artifactId>revapi-maven-plugin</artifactId>\n            <version>0.8.1</version>\n            <dependencies>\n              <dependency>\n                <groupId>org.revapi</groupId>\n                <artifactId>revapi-java</artifactId>\n                <version>0.13.1</version>\n              </dependency>\n            </dependencies>\n            <configuration>\n              <oldArtifacts>\n                <artifact>${project.groupId}:${project.artifactId}:${revapi.oldUberFireVersion}</artifact>\n              </oldArtifacts>\n              <newArtifacts>\n                <artifact>${project.groupId}:${project.artifactId}:${revapi.newUberFireVersion}</artifact>\n              </newArtifacts>\n              <!-- By default revapi will check the oldArtifact against the currently executed build -->\n              <analysisConfigurationFiles>\n                <configurationFile>\n                  <path>src/build/revapi-config.json</path>\n                  <roots>\n                    <root>filters</root>\n                    <root>ignores</root>\n                  </roots>\n                </configurationFile>\n              </analysisConfigurationFiles>\n              <!-- By default, revapi will only fail the build if there are potentially breaking or breaking changes. However, in the report\n                   we want even non breaking changes to be present. -->\n              <reportSeverity>nonBreaking</reportSeverity>\n              <failSeverity>potentiallyBreaking</failSeverity>\n            </configuration>\n            <!-- Running two executions is a workaround to make sure we get a HTML report in case revapi finds\n                 some incompatible changes. The \"check\" goal will simply fail the whole build before it could get\n                 to the report. To make sure we always get a HTML report, the \"report\" goal needs to be executed\n                 before the \"check\" goal.\n                 Once https://github.com/revapi/revapi/issues/11 is fixed it should be possible to use single execution. -->\n            <executions>\n              <execution>\n                <id>check</id>\n                <goals>\n                  <goal>check</goal>\n                </goals>\n                <phase>verify</phase>\n              </execution>\n              <execution>\n                <!-- report can be found in ${build.directory}/site/revapi-report.html -->\n                <id>report</id>\n                <goals>\n                  <goal>report</goal>\n                </goals>\n                <phase>package</phase>\n              </execution>\n            </executions>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n\n    <profile>\n      <id>run-code-coverage</id>\n      <properties>\n        <jacoco.excludes>*Lexer</jacoco.excludes>\n      </properties>\n\n      <dependencyManagement>\n        <dependencies>\n          <dependency>\n            <groupId>org.jacoco</groupId>\n            <artifactId>org.jacoco.agent</artifactId>\n            <classifier>runtime</classifier>\n            <version>${version.jacoco.plugin}</version>\n            <scope>test</scope>\n          </dependency>\n        </dependencies>\n      </dependencyManagement>\n      <dependencies>\n        <dependency>\n          <groupId>org.jacoco</groupId>\n          <artifactId>org.jacoco.agent</artifactId>\n          <classifier>runtime</classifier>\n          <scope>test</scope>\n        </dependency>\n      </dependencies>\n      <build>\n        <pluginManagement>\n          <plugins>\n            <plugin>\n              <groupId>org.jacoco</groupId>\n              <artifactId>jacoco-maven-plugin</artifactId>\n              <version>${version.jacoco.plugin}</version>\n              <configuration>\n                <append>true</append>\n                <dataFile>${jacoco.exec.file}</dataFile>\n                <excludes>\n                  <exclude>${jacoco.excludes}</exclude>\n                </excludes>\n              </configuration>\n              <executions>\n                <execution>\n                  <id>default-instrument</id>\n                  <goals>\n                    <goal>instrument</goal>\n                  </goals>\n                </execution>\n                <execution>\n                  <id>default-restore-instrumented-classes</id>\n                  <goals>\n                    <goal>restore-instrumented-classes</goal>\n                  </goals>\n                </execution>\n              </executions>\n            </plugin>\n            <plugin>\n              <groupId>net.ltgt.gwt.maven</groupId>\n              <artifactId>gwt-maven-plugin</artifactId>\n              <configuration>\n                <skipCompilation>true</skipCompilation>\n              </configuration>\n            </plugin>\n            <plugin>\n              <artifactId>maven-surefire-plugin</artifactId>\n              <configuration>\n                <systemPropertyVariables>\n                  <jacoco-agent.destfile>${jacoco.exec.file}</jacoco-agent.destfile>\n                </systemPropertyVariables>\n              </configuration>\n            </plugin>\n          </plugins>\n        </pluginManagement>\n        <plugins>\n          <plugin>\n            <groupId>org.jacoco</groupId>\n            <artifactId>jacoco-maven-plugin</artifactId>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n  <modules>\n    <module>uberfire-commons</module>\n    <module>uberfire-api</module>\n    <module>uberfire-client-api</module>\n    <module>uberfire-security</module>\n    <module>uberfire-nio2-backport</module>\n    <module>uberfire-io</module>\n    <module>uberfire-server</module>\n    <module>uberfire-backend</module>\n    <module>uberfire-js</module>\n    <module>uberfire-testing-utils</module>\n    <module>uberfire-experimental</module>\n    <module>uberfire-workbench</module>\n    <module>uberfire-packaging</module>\n    <module>uberfire-preferences</module>\n    <module>uberfire-extensions</module>\n    <module>uberfire-m2repo-editor</module>\n    <module>uberfire-message-console</module>\n    <module>uberfire-project</module>\n    <module>uberfire-rest</module>\n    <module>uberfire-services</module>\n    <module>uberfire-structure</module>\n    <module>uberfire-test-utils</module>\n    <module>uberfire-workingset</module>\n    <module>uberfire-ssh</module>\n    <module>uberfire-showcase</module>\n    <module>dashbuilder</module>\n    <module>appformer-js-bridge</module>\n    <module>appformer-js</module>\n    <module>appformer-client-api</module>\n    <module>appformer-js-monaco</module>\n  </modules>\n\n  <dependencyManagement>\n    <dependencies>\n      <dependency>\n        <groupId>org.uberfire</groupId>\n        <artifactId>uberfire-bom</artifactId>\n        <version>${version.org.kie}</version>\n        <type>pom</type>\n        <scope>import</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.kie</groupId>\n        <artifactId>kie-bom</artifactId>\n        <version>${version.org.kie}</version>\n        <type>pom</type>\n        <scope>import</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.kie.soup</groupId>\n        <artifactId>kie-soup-bom</artifactId>\n        <version>${version.org.kie.soup}</version>\n        <type>pom</type>\n        <scope>import</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.jboss.errai</groupId>\n        <artifactId>errai-jaxrs-client</artifactId>\n        <type>test-jar</type>\n        <version>${version.org.jboss.errai}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>jakarta.enterprise</groupId>\n        <artifactId>jakarta.enterprise.cdi-api</artifactId>\n        <version>${version.jakarta.enterprise.cdi-api}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>org.eclipse.jgit</groupId>\n        <artifactId>org.eclipse.jgit</artifactId>\n        <version>${version.org.eclipse.jgit}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>commons-logging</groupId>\n            <artifactId>commons-logging</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <dependency>\n        <groupId>org.eclipse.jgit</groupId>\n        <artifactId>org.eclipse.jgit.http.server</artifactId>\n        <version>${version.org.eclipse.jgit}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>commons-logging</groupId>\n            <artifactId>commons-logging</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>javax.servlet</groupId>\n            <artifactId>servlet-api</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <dependency>\n        <groupId>org.keycloak</groupId>\n        <artifactId>keycloak-core</artifactId>\n        <version>${version.org.keycloak}</version>\n      </dependency>\n      <dependency>\n        <groupId>org.keycloak</groupId>\n        <artifactId>keycloak-common</artifactId>\n        <version>${version.org.keycloak}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>org.keycloak</groupId>\n        <artifactId>keycloak-adapter-core</artifactId>\n        <version>${version.org.keycloak}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>com.google.jsinterop</groupId>\n        <artifactId>base</artifactId>\n        <version>${version.com.google.jsinterop.base}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>com.allen-sauer.gwt.dnd</groupId>\n        <artifactId>gwt-dnd</artifactId>\n        <version>${version.com.allen-sauer.gwt.dnd}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>javax.servlet</groupId>\n            <artifactId>javax.servlet-api</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <dependency>\n        <groupId>org.scannotation</groupId>\n        <artifactId>scannotation</artifactId>\n        <version>${version.org.scannotation}</version>\n        <exclusions>\n          <!-- Uses old javassist groupId so Maven is not able to exclude this itself. All UF modules have to use\n               org.javassist:javassist instead of this one. -->\n          <exclusion>\n            <groupId>javassist</groupId>\n            <artifactId>javassist</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <!-- Byteman -->\n      <dependency>\n        <groupId>org.jboss.byteman</groupId>\n        <artifactId>byteman</artifactId>\n        <version>${version.org.jboss.byteman}</version>\n        <scope>test</scope>\n      </dependency>\n      <dependency>\n        <groupId>org.jboss.byteman</groupId>\n        <artifactId>byteman-submit</artifactId>\n        <version>${version.org.jboss.byteman}</version>\n        <scope>test</scope>\n      </dependency>\n      <dependency>\n        <groupId>org.jboss.byteman</groupId>\n        <artifactId>byteman-install</artifactId>\n        <version>${version.org.jboss.byteman}</version>\n        <scope>test</scope>\n      </dependency>\n      <dependency>\n        <groupId>org.jboss.byteman</groupId>\n        <artifactId>byteman-bmunit</artifactId>\n        <version>${version.org.jboss.byteman}</version>\n        <scope>test</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty</artifactId>\n        <version>${version.io.netty.old}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>org.infinispan</groupId>\n        <artifactId>infinispan-client-hotrod</artifactId>\n        <version>${version.org.infinispan}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>org.jboss.spec.javax.transaction</groupId>\n            <artifactId>jboss-transaction-api_1.2_spec</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>ch.qos.logback</groupId>\n            <artifactId>logback-classic</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>org.jboss.marshalling</groupId>\n            <artifactId>jboss-marshalling-osgi</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n      <dependency>\n        <groupId>org.infinispan</groupId>\n        <artifactId>infinispan-commons</artifactId>\n        <version>${version.org.infinispan}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>org.jboss.marshalling</groupId>\n            <artifactId>jboss-marshalling-osgi</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n      <dependency>\n        <groupId>org.infinispan.protostream</groupId>\n        <artifactId>protostream</artifactId>\n        <version>${version.org.infinispan.protostream}</version>\n      </dependency>\n      <dependency>\n        <groupId>org.wildfly.security</groupId>\n        <artifactId>wildfly-elytron</artifactId>\n        <version>${version.org.wildfly.security}</version>\n      </dependency>\n      <!-- Apache ActiveMQ/Artemis -->\n      <dependency>\n        <groupId>org.apache.activemq</groupId>\n        <artifactId>artemis-jms-client</artifactId>\n        <version>${version.org.apache.activemq.artemis}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>org.jboss.spec.javax.jms</groupId>\n            <artifactId>jboss-jms-api_2.0_spec</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>org.apache.geronimo.specs</groupId>\n            <artifactId>geronimo-json_1.0_spec</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>commons-logging</groupId>\n            <artifactId>commons-logging</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-buffer</artifactId>\n        <version>${version.io.netty}</version>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-transport</artifactId>\n        <version>${version.io.netty}</version>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-handler</artifactId>\n        <version>${version.io.netty}</version>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-transport-native-epoll</artifactId>\n        <version>${version.io.netty}</version>\n        <classifier>${netty-transport-native-epoll-classifier}</classifier>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-transport-native-kqueue</artifactId>\n        <version>${version.io.netty}</version>\n        <classifier>${netty-transport-native-kqueue-classifier}</classifier>\n      </dependency>\n      <dependency>\n        <groupId>io.netty</groupId>\n        <artifactId>netty-codec-http</artifactId>\n        <version>${version.io.netty}</version>\n      </dependency>\n      <dependency>\n        <groupId>com.github.tdomzal</groupId>\n        <artifactId>junit-docker-rule</artifactId>\n        <version>${version.jnuit.docker.rule}</version>\n        <scope>test</scope>\n      </dependency>\n      <dependency>\n        <groupId>com.spotify</groupId>\n        <artifactId>docker-client</artifactId>\n        <version>${version.com.spotify.docker}</version>\n        <scope>test</scope>\n        <exclusions>\n          <exclusion>\n            <artifactId>commons-logging</artifactId>\n            <groupId>commons-logging</groupId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n      <dependency>\n        <groupId>ch.qos.logback</groupId>\n        <artifactId>logback-classic</artifactId>\n        <version>${version.ch.qos.logback}</version>\n      </dependency>\n      <dependency>\n        <groupId>ch.qos.logback</groupId>\n        <artifactId>logback-core</artifactId>\n        <version>${version.ch.qos.logback}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>org.apache.httpcomponents</groupId>\n        <artifactId>httpclient</artifactId>\n        <version>${version.org.apache.httpcomponents.httpclient}</version>\n        <exclusions>\n          <exclusion>\n            <groupId>commons-logging</groupId>\n            <artifactId>commons-logging</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <dependency>\n        <groupId>com.jcraft</groupId>\n        <artifactId>jsch</artifactId>\n        <version>${version.com.jcraft}</version>\n      </dependency>\n\n      <!-- JSON parsing. -->\n      <dependency>\n        <groupId>com.googlecode.json-simple</groupId>\n        <artifactId>json-simple</artifactId>\n        <version>${version.com.googlecode.jsonsimple}</version>\n        <type>jar</type>\n      </dependency>\n\n      <dependency>\n        <groupId>com.googlecode.jtype</groupId>\n        <artifactId>jtype</artifactId>\n        <version>${version.com.googlecode.jtype}</version>\n      </dependency>\n\n      <dependency>\n        <groupId>org.jboss.msc</groupId>\n        <artifactId>jboss-msc</artifactId>\n        <version>${version.org.jboss.jboss-msc}</version>\n      </dependency>\n\n      <!-- log4j-to-slf4j -->\n      <dependency>\n        <groupId>org.apache.logging.log4j</groupId>\n        <artifactId>log4j-to-slf4j</artifactId>\n        <version>${version.org.apache.logging.log4j}</version>\n      </dependency>\n\n      <!-- Test deps -->\n      <dependency>\n        <groupId>mysql</groupId>\n        <artifactId>mysql-connector-java</artifactId>\n        <version>${version.org.mysql-driver}</version>\n        <scope>test</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.postgresql</groupId>\n        <artifactId>postgresql</artifactId>\n        <scope>test</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.mariadb.jdbc</groupId>\n        <artifactId>mariadb-java-client</artifactId>\n        <version>${version.org.mariadb.jdbc}</version>\n        <scope>test</scope>\n      </dependency>\n\n\n      <!-- ARQUILLIAN -->\n\n      <dependency>\n        <groupId>org.arquillian.cube</groupId>\n        <artifactId>arquillian-cube-docker-junit-rule</artifactId>\n        <version>${version.org.arquillian.cube}</version>\n        <scope>test</scope>\n        <exclusions>\n          <exclusion>\n            <groupId>javax.enterprise</groupId>\n            <artifactId>cdi-api</artifactId>\n          </exclusion> \n          <exclusion>\n            <groupId>log4j</groupId>\n            <artifactId>log4j</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>com.github.docker-java</groupId>\n            <artifactId>docker-java</artifactId>\n          </exclusion>\n          <exclusion>\n            <groupId>org.arquillian.cube</groupId>\n            <artifactId>arquillian-cube-requirement-spi</artifactId>\n          </exclusion>\n        </exclusions>\n      </dependency>\n\n      <dependency>\n        <groupId>org.jboss.marshalling</groupId>\n        <artifactId>marshalling-api</artifactId>\n        <version>${version.org.jboss.marshalling.api}</version>\n        <scope>test</scope>\n      </dependency>\n\n      <dependency>\n        <groupId>org.jboss.shrinkwrap</groupId>\n        <artifactId>shrinkwrap-impl-base</artifactId>\n        <version>${version.org.jboss.shrinkwrap}</version>\n        <scope>test</scope>\n      </dependency>\n\n    <dependency>\n      <groupId>junit</groupId>\n      <artifactId>junit</artifactId>\n      <version>${version.junit}</version>\n    </dependency>\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <version>${version.org.assertj}</version>\n    </dependency>\n\n    </dependencies>\n  </dependencyManagement>\n\n  <dependencies>\n    <dependency>\n      <groupId>junit</groupId>\n      <artifactId>junit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.mockito</groupId>\n      <artifactId>mockito-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <!-- tests in guvnor -->\n    <dependency>\n      <groupId>com.google.inject</groupId>\n      <artifactId>guice</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.inject</groupId>\n          <artifactId>javax.inject</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n\n  </dependencies>\n\n  <!-- DistributionManagement is inherited from org.jboss:jboss-parent -->\n  <!-- <distributionManagement/> -->\n\n</project>\n"
  },
  {
    "path": "uberfire-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire API</name>\n  <description>UberFire API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/annotations/Customizable.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Internal annotation used to inject/produce beans in a way that the user can provide a default\n * implementation for them, otherwise a fallback implementation will be used.\n */\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface Customizable {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/annotations/FallbackImplementation.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Internal annotation used to qualify fallback implementations, that will be used when the user\n * does not provide another (default) implementation.\n */\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface FallbackImplementation {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/FileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.List;\nimport java.util.Set;\n\npublic interface FileSystem {\n\n    List<Path> getRootDirectories();\n\n    Set<String> supportedFileAttributeViews();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/IsVersioned.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\npublic interface IsVersioned {\n\n    boolean hasVersionSupport();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/ObservablePath.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.rpc.SessionInfo;\n\npublic interface ObservablePath extends Path,\n                                        Disposable {\n\n    void onRename(final Command command);\n\n    void onDelete(final Command command);\n\n    void onUpdate(final Command command);\n\n    void onCopy(final Command command);\n\n    void onConcurrentRename(final ParameterizedCommand<OnConcurrentRenameEvent> command);\n\n    void onConcurrentDelete(final ParameterizedCommand<OnConcurrentDelete> command);\n\n    void onConcurrentUpdate(final ParameterizedCommand<OnConcurrentUpdateEvent> command);\n\n    void onConcurrentCopy(final ParameterizedCommand<OnConcurrentCopyEvent> command);\n\n    ObservablePath wrap(final Path path);\n\n    Path getOriginal();\n\n    public interface OnConcurrentUpdateEvent extends SessionInfo {\n\n        Path getPath();\n    }\n\n    public interface OnConcurrentDelete extends SessionInfo {\n\n        Path getPath();\n    }\n\n    public interface OnConcurrentRenameEvent extends SessionInfo {\n\n        Path getSource();\n\n        Path getTarget();\n    }\n\n    public interface OnConcurrentCopyEvent extends SessionInfo {\n\n        Path getSource();\n\n        Path getTarget();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/Path.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport jsinterop.annotations.JsType;\n\n@JsType\npublic interface Path extends Comparable<Path> {\n\n    String getFileName();\n\n    String toURI();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/PathFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic final class PathFactory {\n\n    public static final String LOCK_FILE_EXTENSION = \".ulock\";\n    public static String VERSION_PROPERTY = \"hasVersionSupport\";\n\n    private PathFactory() {\n    }\n\n    public static Path newPath(final String fileName,\n                               final String uri) {\n        return new PathImpl(checkNotEmpty(\"fileName\",\n                                          fileName),\n                            checkNotEmpty(\"uri\",\n                                          uri));\n    }\n\n    public static Path newPathBasedOn(final String fileName,\n                                      final String uri,\n                                      final Path path) {\n        return new PathImpl(checkNotEmpty(\"fileName\",\n                                          fileName),\n                            checkNotEmpty(\"uri\",\n                                          uri),\n                            checkNotNull(\"path\",\n                                         path));\n    }\n\n    public static Path newPath(final String fileName,\n                               final String uri,\n                               final Map<String, Object> attrs) {\n        return new PathImpl(checkNotEmpty(\"fileName\",\n                                          fileName),\n                            checkNotEmpty(\"uri\",\n                                          uri),\n                            attrs);\n    }\n\n    public static Path newLock(final Path path) {\n        Path lockPath = newLockPath(path);\n        return PathFactory.newPath(path.getFileName() + LOCK_FILE_EXTENSION,\n                                   lockPath.toURI() + LOCK_FILE_EXTENSION);\n    }\n\n    /**\n     * Returns a path of a lock for the provided file.\n     * <p>\n     * Examples:\n     * <p>\n     * <pre>\n     * default://main@myteam/dora/src/main/resources/com/myteam/dora/sample.drl\n     *           branch@space/project/path/to/file.extension                      =>\n     * default://locks@system/system/myteam/main/dora/src/main/resources/com/myteam/dora/sample.drl\n     *\n     * </pre>\n     *\n     * @param path the path of a file for which a lock should be created, must not be null.\n     * @return the lock path\n     */\n    public static Path newLockPath(final Path path) {\n        checkNotNull(\"path\",\n                     path);\n\n        final String systemUri = path.toURI().replaceFirst(\"(/|\\\\\\\\)([^/&^\\\\\\\\]*)@([^/&^\\\\\\\\]*)\",\n                                                           \"$1locks@system/system$1$3$1$2\");\n\n        return PathFactory.newPath(\"/\",\n                                   systemUri);\n    }\n\n    /**\n     * Returns the path of the locked file for the provided lock.\n     * <p>\n     * Examples:\n     * <p>\n     * <pre>\n     * default://locks@system/system/myteam/main/dora/src/main/resources/com/myteam/dora/sample.drl.ulock\n     * default://main@myteam/dora/src/main/resources/com/myteam/dora/sample.drl\n     *           branch@space/project/path/to/file.extension                      =>\n     * </pre>\n     *\n     * @param lockPath the path of a lock, must not be null.\n     * @return the locked path.\n     */\n    public static Path fromLock(final Path lockPath) {\n        checkNotNull(\"path\",\n                     lockPath);\n\n        final String uri = lockPath.toURI().replaceFirst(\"locks@system/system(/|\\\\\\\\)([^/&^\\\\\\\\]*)(/|\\\\\\\\)([^/&^\\\\\\\\]*)\",\n                                                         \"$4@$2\");\n\n        return PathFactory.newPath(lockPath.getFileName().replace(LOCK_FILE_EXTENSION,\n                                                                  \"\"),\n                                   uri.replace(LOCK_FILE_EXTENSION,\n                                               \"\"));\n    }\n\n    @Portable\n    public static class PathImpl implements Path,\n                                            IsVersioned {\n\n        private String uri = null;\n        private String fileName = null;\n        private HashMap<String, Object> attributes = null;\n        private boolean hasVersionSupport = false;\n\n        public PathImpl() {\n        }\n\n        public PathImpl(final String fileName,\n                         final String uri) {\n            this(fileName,\n                 uri,\n                 (Map<String, Object>) null);\n        }\n\n        private PathImpl(final String fileName,\n                         final String uri,\n                         final Map<String, Object> attrs) {\n            this.fileName = fileName;\n            this.uri = uri;\n            if (attrs == null) {\n                this.attributes = new HashMap<String, Object>();\n            } else {\n                if (attrs.containsKey(VERSION_PROPERTY)) {\n                    hasVersionSupport = (Boolean) attrs.remove(VERSION_PROPERTY);\n                }\n                if (attrs.size() > 0) {\n                    this.attributes = new HashMap<String, Object>(attrs);\n                } else {\n                    this.attributes = new HashMap<String, Object>();\n                }\n            }\n        }\n\n        private PathImpl(final String fileName,\n                         final String uri,\n                         final Path path) {\n            this.fileName = fileName;\n            this.uri = uri;\n            if (path instanceof PathImpl) {\n                this.hasVersionSupport = ((PathImpl) path).hasVersionSupport;\n            }\n        }\n\n        @Override\n        public String getFileName() {\n            return fileName;\n        }\n\n        @Override\n        public String toURI() {\n            return uri;\n        }\n\n        public Map<String, Object> getAttributes() {\n            return attributes;\n        }\n\n        @Override\n        public int compareTo(final Path another) {\n            return this.uri.compareTo(another.toURI());\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (!(o instanceof Path)) {\n                return false;\n            }\n\n            final Path path = (Path) o;\n\n            return this.toURI().equals(path.toURI());\n        }\n\n        @Override\n        public boolean hasVersionSupport() {\n            return hasVersionSupport;\n        }\n\n        @Override\n        public int hashCode() {\n            return uri.hashCode();\n        }\n\n        @Override\n        public String toString() {\n            return \"PathImpl{\" +\n                    \"uri='\" + uri + '\\'' +\n                    \", fileName='\" + fileName + '\\'' +\n                    \", attrs=\" + attributes +\n                    '}';\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/PathSupport.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\npublic final class PathSupport {\n\n    public static boolean isVersioned(final Path path) {\n        return path instanceof IsVersioned && ((IsVersioned) path).hasVersionSupport();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/impl/ForceUnlockEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Client-local event to indicate that the specified path's lock should be\n * released. This is used in admin functionality for overriding locks. The user\n * currently holding the lock will not be notified and can potentially lose\n * data.\n */\npublic class ForceUnlockEvent {\n\n    private final Path path;\n\n    public ForceUnlockEvent(Path path) {\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/impl/LockInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Holds lock information about a {@link Path}.\n */\n@Portable\npublic class LockInfo {\n\n    private final boolean locked;\n    private final String lockedBy;\n    private final Path file;\n    private final transient Path lock;\n\n    public LockInfo(@MapsTo(\"locked\") boolean locked,\n                    @MapsTo(\"lockedBy\") String lockedBy,\n                    @MapsTo(\"file\") Path file) {\n\n        this(locked,\n             lockedBy,\n             file,\n             null);\n    }\n\n    public LockInfo(boolean locked,\n                    String lockedBy,\n                    Path file,\n                    Path lock) {\n\n        this.locked = locked;\n        this.lockedBy = lockedBy;\n        this.file = file;\n        this.lock = lock;\n    }\n\n    public static LockInfo unlocked() {\n        return new LockInfo(false,\n                            null,\n                            null);\n    }\n\n    public boolean isLocked() {\n        return locked;\n    }\n\n    public String lockedBy() {\n        return lockedBy;\n    }\n\n    public Path getFile() {\n        return file;\n    }\n\n    public Path getLock() {\n        return lock;\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + ((file == null) ? 0 : file.hashCode());\n        result = prime * result + (locked ? 1231 : 1237);\n        result = prime * result + ((lockedBy == null) ? 0 : lockedBy.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        LockInfo other = (LockInfo) obj;\n        if (file == null) {\n            if (other.file != null) {\n                return false;\n            }\n        } else if (!file.equals(other.file)) {\n            return false;\n        }\n        if (locked != other.locked) {\n            return false;\n        }\n        if (lockedBy == null) {\n            if (other.lockedBy != null) {\n                return false;\n            }\n        } else if (!lockedBy.equals(other.lockedBy)) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"[file=\" + file + \", lockedBy=\" + lockedBy + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/impl/LockResult.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Represents the result of a lock request and holds the last read\n * {@link LockInfo}.\n */\n@Portable\npublic class LockResult {\n\n    private final boolean success;\n    private final LockInfo lockInfo;\n\n    public LockResult(@MapsTo(\"success\") boolean success,\n                      @MapsTo(\"lockInfo\") LockInfo lockInfo) {\n\n        this.success = success;\n        this.lockInfo = lockInfo;\n    }\n\n    public static LockResult acquired(final Path path,\n                                      final String lockedBy) {\n\n        return new LockResult(true,\n                              new LockInfo(true,\n                                           lockedBy,\n                                           path));\n    }\n\n    public static LockResult released(final Path path) {\n\n        return new LockResult(true,\n                              new LockInfo(false,\n                                           null,\n                                           path));\n    }\n\n    public static LockResult failed(final LockInfo lockInfo) {\n\n        return new LockResult(false,\n                              lockInfo);\n    }\n\n    public static LockResult error() {\n        return new LockResult(false,\n                              null);\n    }\n\n    public boolean isSuccess() {\n        return success;\n    }\n\n    public LockInfo getLockInfo() {\n        return lockInfo;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/backend/vfs/impl/ObservablePathImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.IsVersioned;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceCopied;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamed;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n@Portable\n@Dependent\npublic class ObservablePathImpl implements ObservablePath,\n                                           IsVersioned {\n\n    private Path path;\n    private transient Path original;\n\n    @Inject\n    transient SessionInfo sessionInfo;\n\n    private transient List<Command> onRenameCommand = new ArrayList<Command>();\n    private transient List<Command> onDeleteCommand = new ArrayList<Command>();\n    private transient List<Command> onUpdateCommand = new ArrayList<Command>();\n    private transient List<Command> onCopyCommand = new ArrayList<Command>();\n    private transient List<ParameterizedCommand<OnConcurrentRenameEvent>> onConcurrentRenameCommand = new ArrayList<ParameterizedCommand<OnConcurrentRenameEvent>>();\n    private transient List<ParameterizedCommand<OnConcurrentDelete>> onConcurrentDeleteCommand = new ArrayList<ParameterizedCommand<OnConcurrentDelete>>();\n    private transient List<ParameterizedCommand<OnConcurrentUpdateEvent>> onConcurrentUpdateCommand = new ArrayList<ParameterizedCommand<OnConcurrentUpdateEvent>>();\n    private transient List<ParameterizedCommand<OnConcurrentCopyEvent>> onConcurrentCopyCommand = new ArrayList<ParameterizedCommand<OnConcurrentCopyEvent>>();\n\n    public ObservablePathImpl() {\n    }\n\n    public static String removeExtension(final String filename) {\n        if (filename == null) {\n            return null;\n        }\n        final int index = indexOfExtension(filename);\n        if (index == -1) {\n            return filename;\n        } else {\n            return filename.substring(0,\n                                      index);\n        }\n    }\n\n    public static int indexOfExtension(final String filename) {\n        if (filename == null) {\n            return -1;\n        }\n        final int extensionPos = filename.lastIndexOf(\".\");\n        return extensionPos;\n    }\n\n    @Override\n    public ObservablePath wrap(final Path path) {\n        if (path instanceof ObservablePathImpl) {\n            this.original = ((ObservablePathImpl) path).path;\n        } else {\n            this.original = path;\n        }\n        this.path = this.original;\n        return this;\n    }\n\n    // Lazy-population of \"original\" for ObservablePathImpl de-serialized from a serialized PerspectiveDefinition that circumvent the \"wrap\" feature.\n    // Renamed resources hold a reference to the old \"original\" Path which is needed to maintain an immutable hashCode used as part of the compound\n    // Key for Activity and Place Management). However re-hydration stores the PartDefinition in a HashSet using the incorrect hashCode. By not\n    // storing the \"original\" in the serialized form we can guarantee hashCodes in de-serialized PerspectiveDefinitions remain immutable.\n    // See https://bugzilla.redhat.com/show_bug.cgi?id=1200472 for the re-producer.\n    public Path getOriginal() {\n        if (this.original == null) {\n            wrap(this.path);\n        }\n        return this.original;\n    }\n\n    @Override\n    public String getFileName() {\n        return path.getFileName();\n    }\n\n    @Override\n    public String toURI() {\n        return path.toURI();\n    }\n\n    @Override\n    public boolean hasVersionSupport() {\n        return path instanceof IsVersioned && ((IsVersioned) path).hasVersionSupport();\n    }\n\n    @Override\n    public int compareTo(final Path o) {\n        return path.compareTo(o);\n    }\n\n    @Override\n    public void onRename(final Command command) {\n        this.onRenameCommand.add(command);\n    }\n\n    @Override\n    public void onDelete(final Command command) {\n        this.onDeleteCommand.add(command);\n    }\n\n    @Override\n    public void onUpdate(final Command command) {\n        this.onUpdateCommand.add(command);\n    }\n\n    @Override\n    public void onCopy(final Command command) {\n        this.onCopyCommand.add(command);\n    }\n\n    @Override\n    public void onConcurrentRename(final ParameterizedCommand<OnConcurrentRenameEvent> command) {\n        this.onConcurrentRenameCommand.add(command);\n    }\n\n    @Override\n    public void onConcurrentDelete(final ParameterizedCommand<OnConcurrentDelete> command) {\n        this.onConcurrentDeleteCommand.add(command);\n    }\n\n    @Override\n    public void onConcurrentUpdate(final ParameterizedCommand<OnConcurrentUpdateEvent> command) {\n        this.onConcurrentUpdateCommand.add(command);\n    }\n\n    @Override\n    public void onConcurrentCopy(final ParameterizedCommand<OnConcurrentCopyEvent> command) {\n        this.onConcurrentCopyCommand.add(command);\n    }\n\n    @Override\n    public void dispose() {\n        onRenameCommand.clear();\n        onDeleteCommand.clear();\n        onUpdateCommand.clear();\n        onCopyCommand.clear();\n        onConcurrentRenameCommand.clear();\n        onConcurrentDeleteCommand.clear();\n        onConcurrentUpdateCommand.clear();\n        onConcurrentCopyCommand.clear();\n        if (IOC.getBeanManager() != null) {\n            IOC.getBeanManager().destroyBean(this);\n        }\n    }\n\n    void onResourceRenamed(@Observes final ResourceRenamedEvent renamedEvent) {\n        if (path != null && path.equals(renamedEvent.getPath())) {\n            path = renamedEvent.getDestinationPath();\n            if (sessionInfo.getId().equals(renamedEvent.getSessionInfo().getId())) {\n                executeRenameCommands();\n            } else {\n                executeConcurrentRenameCommand(renamedEvent.getPath(),\n                                               renamedEvent.getDestinationPath(),\n                                               renamedEvent.getSessionInfo().getId(),\n                                               renamedEvent.getSessionInfo().getIdentity());\n            }\n        }\n    }\n\n    void onResourceDeleted(@Observes final ResourceDeletedEvent deletedEvent) {\n        if (path != null && path.equals(deletedEvent.getPath())) {\n            if (sessionInfo.getId().equals(deletedEvent.getSessionInfo().getId())) {\n                executeDeleteCommands();\n            } else {\n                executeConcurrentDeleteCommand(deletedEvent.getPath(),\n                                               deletedEvent.getSessionInfo().getId(),\n                                               deletedEvent.getSessionInfo().getIdentity());\n            }\n        }\n    }\n\n    void onResourceUpdated(@Observes final ResourceUpdatedEvent updatedEvent) {\n        if (path != null && path.equals(updatedEvent.getPath())) {\n            if (sessionInfo.getId().equals(updatedEvent.getSessionInfo().getId())) {\n                executeUpdateCommands();\n            } else {\n                executeConcurrentUpdateCommand(updatedEvent.getPath(),\n                                               updatedEvent.getSessionInfo().getId(),\n                                               updatedEvent.getSessionInfo().getIdentity());\n            }\n        }\n    }\n\n    void onResourceCopied(@Observes final ResourceCopiedEvent copiedEvent) {\n        if (path != null && path.equals(copiedEvent.getPath())) {\n            if (sessionInfo.getId().equals(copiedEvent.getSessionInfo().getId())) {\n                executeCopyCommands();\n            } else {\n                executeConcurrentCopyCommand(copiedEvent.getPath(),\n                                             copiedEvent.getDestinationPath(),\n                                             copiedEvent.getSessionInfo().getId(),\n                                             copiedEvent.getSessionInfo().getIdentity());\n            }\n        }\n    }\n\n    void onResourceBatchEvent(@Observes final ResourceBatchChangesEvent batchEvent) {\n        if (path != null && batchEvent.containPath(path)) {\n            if (sessionInfo.getId().equals(batchEvent.getSessionInfo().getId())) {\n                for (final ResourceChange change : batchEvent.getChanges(path)) {\n                    switch (change.getType()) {\n                        case COPY:\n                            executeCopyCommands();\n                            break;\n                        case DELETE:\n                            executeDeleteCommands();\n                            break;\n                        case RENAME:\n                            path = ((ResourceRenamed) change).getDestinationPath();\n                            executeRenameCommands();\n                            break;\n                        case UPDATE:\n                            executeUpdateCommands();\n                            break;\n                    }\n                }\n            } else {\n                for (final ResourceChange change : batchEvent.getChanges(path)) {\n                    switch (change.getType()) {\n                        case COPY:\n                            executeConcurrentCopyCommand(path,\n                                                         ((ResourceCopied) change).getDestinationPath(),\n                                                         batchEvent.getSessionInfo().getId(),\n                                                         batchEvent.getSessionInfo().getIdentity());\n                            break;\n                        case DELETE:\n                            executeConcurrentDeleteCommand(path,\n                                                           batchEvent.getSessionInfo().getId(),\n                                                           batchEvent.getSessionInfo().getIdentity());\n                            break;\n                        case RENAME:\n                            executeConcurrentRenameCommand(path,\n                                                           ((ResourceRenamed) change).getDestinationPath(),\n                                                           batchEvent.getSessionInfo().getId(),\n                                                           batchEvent.getSessionInfo().getIdentity());\n                            path = ((ResourceRenamed) change).getDestinationPath();\n                            break;\n                        case UPDATE:\n                            executeConcurrentUpdateCommand(path,\n                                                           batchEvent.getSessionInfo().getId(),\n                                                           batchEvent.getSessionInfo().getIdentity());\n                            break;\n                    }\n                }\n            }\n        }\n    }\n\n    private void executeRenameCommands() {\n        if (!onRenameCommand.isEmpty()) {\n            for (final Command command : onRenameCommand) {\n                command.execute();\n            }\n        }\n    }\n\n    void executeConcurrentRenameCommand(final Path path,\n                                        final Path destinationPath,\n                                        final String sessionId,\n                                        final User identity) {\n        if (!onConcurrentRenameCommand.isEmpty()) {\n            for (final ParameterizedCommand<OnConcurrentRenameEvent> command : onConcurrentRenameCommand) {\n                final OnConcurrentRenameEvent event = new OnConcurrentRenameEvent() {\n                    @Override\n                    public Path getSource() {\n                        return path;\n                    }\n\n                    @Override\n                    public Path getTarget() {\n                        return destinationPath;\n                    }\n\n                    @Override\n                    public String getId() {\n                        return sessionId;\n                    }\n\n                    @Override\n                    public User getIdentity() {\n                        return identity;\n                    }\n                };\n                command.execute(event);\n            }\n        }\n    }\n\n    private void executeCopyCommands() {\n        if (!onCopyCommand.isEmpty()) {\n            for (final Command command : onCopyCommand) {\n                command.execute();\n            }\n        }\n    }\n\n    void executeConcurrentCopyCommand(final Path path,\n                                      final Path destinationPath,\n                                      final String sessionId,\n                                      final User identity) {\n        if (!onConcurrentCopyCommand.isEmpty()) {\n            final OnConcurrentCopyEvent copyEvent = new OnConcurrentCopyEvent() {\n                @Override\n                public Path getSource() {\n                    return path;\n                }\n\n                @Override\n                public Path getTarget() {\n                    return destinationPath;\n                }\n\n                @Override\n                public String getId() {\n                    return sessionId;\n                }\n\n                @Override\n                public User getIdentity() {\n                    return identity;\n                }\n            };\n            for (final ParameterizedCommand<OnConcurrentCopyEvent> command : onConcurrentCopyCommand) {\n                command.execute(copyEvent);\n            }\n        }\n    }\n\n    private void executeUpdateCommands() {\n        if (!onUpdateCommand.isEmpty()) {\n            for (final Command command : onUpdateCommand) {\n                command.execute();\n            }\n        }\n    }\n\n    void executeConcurrentUpdateCommand(final Path path,\n                                        final String sessionId,\n                                        final User identity) {\n        if (!onConcurrentUpdateCommand.isEmpty()) {\n            final OnConcurrentUpdateEvent event = new OnConcurrentUpdateEvent() {\n                @Override\n                public Path getPath() {\n                    return path;\n                }\n\n                @Override\n                public String getId() {\n                    return sessionId;\n                }\n\n                @Override\n                public User getIdentity() {\n                    return identity;\n                }\n            };\n            for (final ParameterizedCommand<OnConcurrentUpdateEvent> command : onConcurrentUpdateCommand) {\n                command.execute(event);\n            }\n        }\n    }\n\n    private void executeDeleteCommands() {\n        if (!onDeleteCommand.isEmpty()) {\n            for (final Command command : onDeleteCommand) {\n                command.execute();\n            }\n        }\n    }\n\n    void executeConcurrentDeleteCommand(final Path path,\n                                        final String sessionId,\n                                        final User identity) {\n        if (!onConcurrentDeleteCommand.isEmpty()) {\n            final OnConcurrentDelete event = new OnConcurrentDelete() {\n                @Override\n                public Path getPath() {\n                    return path;\n                }\n\n                @Override\n                public String getId() {\n                    return sessionId;\n                }\n\n                @Override\n                public User getIdentity() {\n                    return identity;\n                }\n            };\n            for (final ParameterizedCommand<OnConcurrentDelete> command : onConcurrentDeleteCommand) {\n                command.execute(event);\n            }\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Path)) {\n            return false;\n        }\n\n        if (o instanceof ObservablePathImpl) {\n            return this.getOriginal().equals(((ObservablePathImpl) o).getOriginal());\n        }\n\n        return this.getOriginal().equals(o);\n    }\n\n    @Override\n    public int hashCode() {\n        return this.getOriginal().toURI().hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return toURI();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/debug/Debug.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.debug;\n\n/**\n * Utility methods that help with debugging.\n */\npublic class Debug {\n\n    /**\n     * The code requires this list to have 16 entries\n     */\n    private static final String[] CONSONANTS = {\"b\", \"d\", \"f\", \"h\",\n            \"j\", \"k\", \"l\", \"m\",\n            \"n\", \"p\", \"r\", \"s\",\n            \"t\", \"v\", \"w\", \"z\"};\n\n    /**\n     * The code requires this list to have 8 entries\n     */\n    private static final String[] VOWELS = {\"a\", \"e\", \"ee\", \"i\",\n            \"o\", \"oo\", \"u\", \"y\"};\n\n    /**\n     * Makes a reasonably easy-to-pronounce gibberish word from the given number. On average, the word will have about\n     * as many characters as the number would have when printed as a decimal, but (especially for large numbers) it will\n     * be easier to remember as a single word.\n     * @param num The number to convert.\n     * @return The memorable string, unique to the given number. Never null.\n     */\n    public static String toMemorableString(long num) {\n        StringBuilder memorable = new StringBuilder();\n        long hashNum = Math.abs(num);\n        for (; ; ) {\n            int chunk = (int) (hashNum & 0xf);\n            memorable.append(CONSONANTS[chunk]);\n            hashNum >>= 4;\n            if (hashNum == 0) {\n                break;\n            }\n\n            chunk = (int) (hashNum & 7);\n            memorable.append(VOWELS[chunk]);\n            hashNum >>= 3;\n            if (hashNum == 0) {\n                break;\n            }\n        }\n        return memorable.toString();\n    }\n\n    /**\n     * Composes a compact, memorable unique string for the given object instance. The name starts with the abbreviated\n     * fully-qualified class name (see {@link #abbreviatedName(Class)}), an '@' character, then a gibberish word\n     * representing the object's identity hash code (see {@link #toMemorableString(long)}).\n     * @param o\n     * @return\n     */\n    public static String objectId(Object o) {\n        if (o == null) {\n            return null;\n        }\n        return abbreviatedName(o.getClass()) + \"@\" + toMemorableString(System.identityHashCode(o));\n    }\n\n    /**\n     * Returns a compact representation of the fully-qualified name of the given class. The string is built with the following components:\n     * <ol>\n     * <li>the first letter of each component of the package name\n     * <li>a dot\n     * <li>the class name. If the class is an inner class, the name is of the form Outer$Inner\n     * <ol>\n     * <p>\n     * For classes in the default package, items 1 and 2 are omitted.\n     * @param c the class whose name to abbreviate. Can be null, but will result in a null return value.\n     * @return the abbreviated FQCN as described, or null if the input is null.\n     */\n    public static String abbreviatedName(Class<?> c) {\n        if (c == null) {\n            return null;\n        }\n        StringBuilder result = new StringBuilder();\n        String fqcn = c.getName();\n        int lastDot = -1;\n        int thisDot = -1;\n        while ((thisDot = fqcn.indexOf('.',\n                                       thisDot + 1)) != -1) {\n            result.append(fqcn.charAt(lastDot + 1));\n            lastDot = thisDot;\n        }\n        if (lastDot != -1) {\n            result.append('.');\n        }\n        result.append(fqcn.substring(lastDot + 1));\n        return result.toString();\n    }\n\n    /**\n     * Returns the short name of the given class (no package name). This is the same as java.lang.Class.shortName(),\n     * which is not implemented in the GWT version of java.lang.Class.\n     * @param c the class whose name to abbreviate. Can be null, but will result in a null return value.\n     * @return the abbreviated FQCN as described, or null if the input is null.\n     */\n    public static String shortName(Class<?> c) {\n        if (c == null) {\n            return null;\n        }\n        return c.getName().substring(c.getName().lastIndexOf('.') + 1);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/GetContent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Used in method that returns a {@code @WorkbenchClientEditor} content. \n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface GetContent {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/GetPreview.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Use in method that returns a {@code @WorkbenchClientEditor} content preview.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface GetPreview {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/IsDirty.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @deprecated The code generated by use of this annotation will never be called by the UberFire framework. Use\n * {@link OnMayClose} instead.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface IsDirty {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnClose.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this will be called by the Workbench immediately after a WorkbenchPart is closed.\n * WorkbenchParts can perform any clean-up tasks in the annotated method, but this does not include removing the view\n * widget from the DOM; this will have already been taken care of by the framework. The method must take zero\n * arguments and return void.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnClose {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnContextAttach.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnContextAttach {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnFocus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Indicates that the framework should call the target method when the activity is the current activity in the current\n * panel. Activities may choose to make their UI more prominent, or begin refreshing their data more aggressively when\n * they are focused.\n * <p>\n * This annotation only has meaning on methods declared in or inherited by {@code @WorkbenchScreen} or\n * {@code @WorkbenchEditor} classes.\n * <p>\n * The target method must take no arguments and return void.\n */\n@Inherited\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnFocus {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnLostFocus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Indicates that the framework should call the target method when the activity is no longer the current activity in the\n * current panel. Typically, methods bearing this annotation will undo whatever effects they set up on the corresponding\n * {@link OnFocus} method.\n * <p>\n * This annotation only has meaning on methods declared in or inherited by {@code @WorkbenchScreen} or\n * {@code @WorkbenchEditor} classes.\n * <p>\n * The target method must take no arguments and return void.\n */\n@Inherited\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnLostFocus {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnMayClose.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this will be called by the Workbench before the WorkbenchPart is closed. The method must be non-private,\n * take zero arguments and return a boolean indicating whether the WorkbenchPart can be closed (true, it can be closed;\n * false it cannot be closed).\n * <p>\n * This annotation only works on methods of classes annotated with {@code @WorkbenchScreen} or {@code @WorkbenchEditor}.\n */\n@Documented\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnMayClose {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnOpen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this are called by the Workbench when a WorkbenchPart\n * is displayed. OnOpen annotated methods are called after the WorkbenchPart's\n * OnStartup annotated method. The method should take zero arguments and return\n * void.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnOpen {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnSave.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * @deprecated The code generated by use of this annotation will never be called by the UberFire framework. Use an\n * application-defined mechanism (perhaps a Saveable interface or a CDI event) instead.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnSave {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnShutdown.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnShutdown {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/OnStartup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * <p>\n * Methods annotated with this are called by the Workbench before methods\n * annotated with {@code @OnOpen}. WorkbenchParts should perform any\n * initialisation activities here (for example load their content from a\n * persistent store).\n * </p>\n * <p>\n * For {@code @WorkbenchEditor}'s the method should take a single argument of\n * type {@code org.drools.guvnor.vfs.Path}. The Path specifies the URI for the\n * resource to be edited. For {@code @WorkbenchScreen} 's the method should have\n * zero arguments. The method should return void.\n * </p>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface OnStartup {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/SetContent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Use in method that sets a {@code @WorkbenchClientEditor} content.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface SetContent {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/lifecycle/Validate.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n *\n */\n\npackage org.uberfire.lifecycle;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface Validate {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/BiParameterizedCommand.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp;\n\nimport java.util.function.BiConsumer;\n\n/**\n * A command representing a future activity, with two parameters. Similar to {@link BiConsumer}\n * This was deliberately created in addition to the existing GWT Command to allow better\n * re-use of menu structures when a WorkbenchPart is embedded within Eclipse.\n * This is the two-arity specialization of {@link ParameterizedCommand}\n */\n@FunctionalInterface\npublic interface BiParameterizedCommand<T, U> {\n\n    void execute(T parameter1,\n                 U parameter2);\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/Command.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.mvp;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * A command representing a future activity. This was deliberately created in\n * addition to the existing GWT Command to allow better re-use of menu\n * structures when a WorkbenchPart is embedded within Eclipse.\n */\n@JsType\npublic interface Command {\n\n    public void execute();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/Commands.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp;\n\n/**\n * A collection of generic operations that can be used anywhere a {@link Command} is called for.\n */\npublic class Commands {\n\n    /**\n     * Has no effect when executed.\n     */\n    public static final Command DO_NOTHING = new Command() {\n        @Override\n        public void execute() {\n        }\n    };\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/ParameterizedCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.mvp;\n\n/**\n * A command representing a future activity. This was deliberately created in\n * addition to the existing GWT Command to allow better re-use of menu\n * structures when a WorkbenchPart is embedded within Eclipse.\n * In case you need two parameters, see {@link BiParameterizedCommand}.\n */\npublic interface ParameterizedCommand<T> {\n\n    public void execute(T parameter);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/PlaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp;\n\nimport java.util.Map;\nimport java.util.Set;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n/**\n * A request to navigate to a particular UberFire Workbench Place (a WorkbenchPerspective, a WorkbenchScreen, or a\n * WorkbenchEditor). Can include optional state parameters that are made available to the requested place.\n * <p>\n * Place requests can be serialized to and created from a valid URL fragment identifier (the string that goes after the\n * {@code #} in the browser's location bar).\n */\n@JsType\npublic interface PlaceRequest {\n\n    public static final PlaceRequest NOWHERE = new DefaultPlaceRequest(\"NOWHERE\");\n\n    String getIdentifier();\n\n    void setIdentifier(String identifier);\n\n    String getFullIdentifier();\n\n    String getParameter(final String key,\n                        final String defaultValue);\n\n    Set<String> getParameterNames();\n\n    Map<String, String> getParameters();\n\n    PlaceRequest addParameter(final String name,\n                              final String value);\n\n    // TODO (UF-88) when PlaceRequest is an immutable value type, cloning will no longer be a sensible operation\n    PlaceRequest clone();\n\n    /**\n     * Indicates whether or not the Workbench framework should add a browser history item when navigating to this place.\n     */\n    boolean isUpdateLocationBarAllowed();\n\n    void setUpdateLocationBar(boolean updateLocationBar);\n    /**\n     * Returns the path associated with this {@link PlaceRequest}.\n     */\n    default Path getPath() {\n        // TODO go over all UF public API and start using Optional\n        return null;\n    }\n\n    /**\n     * Invokes {@link #toString()} but exported to JavaScript so it can be invoked from different scripts.\n     */\n    default String asString() {\n        return this.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/impl/ConditionalPlaceRequest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.mvp.impl;\n\nimport java.util.Map;\nimport java.util.function.Predicate;\n\nimport org.uberfire.mvp.PlaceRequest;\n\npublic class ConditionalPlaceRequest extends DefaultPlaceRequest {\n\n    private PlaceRequest orElsePlaceRequest;\n    private Predicate<PlaceRequest> predicate;\n\n    public ConditionalPlaceRequest() {\n        super();\n    }\n\n    /**\n     * A predicate applied to determine if this place request\n     * should be used or the alternative specified by #orElse\n     * @param identifier The place ID, or an empty string for the default place.\n     */\n    public ConditionalPlaceRequest(final String identifier) {\n        super(identifier);\n    }\n\n    /**\n     * Creates a conditional place request for the given place ID with the given\n     * state parameters for that place.\n     * @param identifier The place ID, or an empty string for the default place.\n     * @param parameters Place-specific parameters to pass to the place. Must not be null.\n     */\n    public ConditionalPlaceRequest(final String identifier,\n                                   final Map<String, String> parameters) {\n        super(identifier,\n              parameters);\n    }\n\n    /**\n     * Creates a place request for the given place ID with the given\n     * state parameters for that place.\n     * @param predicate Represents if default place request should be used.\n     * If false, the place request will be orElsePlaceRequest.\n     */\n    public ConditionalPlaceRequest when(Predicate<PlaceRequest> predicate) {\n        this.predicate = predicate;\n        return this;\n    }\n\n    /**\n     * Creates a place request for the given place ID with the given\n     * state parameters for that place.\n     * @param orElsePlaceRequest alternative place request.\n     */\n    public PlaceRequest orElse(PlaceRequest orElsePlaceRequest) {\n        this.orElsePlaceRequest = orElsePlaceRequest;\n        return this;\n    }\n\n    /**\n     * Return the place request of this conditional PlaceRequest.\n     * If there is no predicate or orElsePlaceRequest returns the\n     * default place request.\n     */\n    public PlaceRequest resolveConditionalPlaceRequest() {\n        if (invalidConditionalPlaceRequest()) {\n            return this;\n        }\n        if (predicate == null || predicate.test(this)) {\n            return this;\n        } else {\n            return resolve();\n        }\n    }\n\n    private boolean invalidConditionalPlaceRequest() {\n        return predicate == null || orElsePlaceRequest == null;\n    }\n\n    protected PlaceRequest resolve() {\n        if (orElsePlaceRequest instanceof ConditionalPlaceRequest) {\n            return ((ConditionalPlaceRequest) orElsePlaceRequest).resolveConditionalPlaceRequest();\n        } else {\n            return orElsePlaceRequest;\n        }\n    }\n\n    @Override\n    public String getIdentifier() {\n        if (invalidConditionalPlaceRequest()) {\n            return identifier;\n        }\n\n        if (predicate == null || predicate.test(this)) {\n            return identifier;\n        } else {\n            return resolve().getIdentifier();\n        }\n    }\n\n    @Override\n    public Map<String, String> getParameters() {\n        if (invalidConditionalPlaceRequest()) {\n            return parameters;\n        }\n\n        if (predicate == null || predicate.test(this)) {\n            return parameters;\n        } else {\n            return resolve().getParameters();\n        }\n    }\n\n    @Override\n    public PlaceRequest clone() {\n        return new ConditionalPlaceRequest(identifier,\n                                           parameters).when(predicate).orElse(orElsePlaceRequest);\n    }\n\n    /**\n     * A conditional place request should be resolved before being compared to another default place request.\n     * @param o A default or conditional place request.\n     * @return True if the resolved conditional place request equals to the default place request or resolved\n     * conditional place request passed, and false otherwise.\n     */\n    @Override\n    public boolean equals(final Object o) {\n        if (o == null) {\n            return false;\n        }\n\n        if (!(o instanceof DefaultPlaceRequest)) {\n            return false;\n        }\n\n        if (this == o) {\n            return true;\n        }\n\n        PlaceRequest that = (PlaceRequest) o;\n        if (o instanceof ConditionalPlaceRequest) {\n            that = ((ConditionalPlaceRequest) o).resolveConditionalPlaceRequest();\n        }\n\n        if (invalidConditionalPlaceRequest()) {\n            return super.equals(that);\n        }\n\n        if (predicate == null || predicate.test(this)) {\n            return super.equals(that);\n        } else {\n            return resolve().equals(that);\n        }\n    }\n\n    @Override\n    public int hashCode() {\n        if (invalidConditionalPlaceRequest()) {\n            return super.hashCode();\n        }\n\n        if (predicate == null || predicate.test(this)) {\n            return super.hashCode();\n        } else {\n            return resolve().hashCode();\n        }\n    }\n\n    @Override\n    public String toString() {\n        if (predicate == null || predicate.test(this)) {\n            return super.toString();\n        } else {\n            return resolve().toString();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/impl/DefaultPlaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp.impl;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Portable\npublic class DefaultPlaceRequest implements PlaceRequest {\n\n    protected final Map<String, String> parameters = new HashMap<String, String>();\n    private boolean updateLocationBar;\n    protected String identifier;\n\n    public DefaultPlaceRequest() {\n        this(\"\");\n    }\n\n    /**\n     * Creates a place request for the given place ID.\n     * @param identifier The place ID, or an empty string for the default place.\n     */\n    public DefaultPlaceRequest(final String identifier) {\n        this(identifier,\n             Collections.<String, String>emptyMap(),\n             true);\n    }\n\n    /**\n     * Creates a place request for the given place ID with the given\n     * state parameters for that place.\n     * @param identifier The place ID, or an empty string for the default place.\n     * @param parameters Place-specific parameters to pass to the place. Must not be null.\n     */\n    public DefaultPlaceRequest(final String identifier,\n                               final Map<String, String> parameters) {\n        this(identifier,\n             parameters,\n             true);\n    }\n\n    /**\n     * Creates a place request for the given place ID, with the given state parameters for that place, and the given\n     * preference of whether or not the browser's location bar should be updated.\n     * @param identifier The place ID, or an empty string for the default place.\n     * @param parameters Place-specific parameters to pass to the place. Must not be null.\n     * @param updateLocationBar If true, the browser's history will be updated with this place request. If false, the location bar\n     * will not be modified as a result of this place request.\n     */\n    public DefaultPlaceRequest(final String identifier,\n                               final Map<String, String> parameters,\n                               final boolean updateLocationBar) {\n        this.identifier = identifier;\n        this.parameters.putAll(parameters);\n        this.updateLocationBar = updateLocationBar;\n    }\n\n    /**\n     * Creates a new place request from a string that encodes a place ID and optional parameters in standard URL query\n     * syntax.\n     * <p>\n     * For example, the following returns a PlaceRequest with identifier {@code MyPlaceID} and two parameters,\n     * {@code param1} and {@code param2}.\n     * <pre>\n     *   DefaultPlaceRequest.parse(\"MyPlaceID?param1=val1&amp;param2=val2\")\n     * </pre>\n     * @param partNameAndParams specification of the place ID and optional parameter map. Special characters in the identifier, key\n     * name, or key value can be escaped using URL encoding: for '%' use '%25'; for '&amp;' use '%26'; for\n     * '=' use '%3d'; for '?' use '%3f'.\n     * @return a new PlaceRequest configured according to the given string.\n     */\n    public static PlaceRequest parse(CharSequence partNameAndParams) {\n        Map<String, String> parameters = new LinkedHashMap<String, String>();\n\n        StringBuilder nextToken = new StringBuilder(50);\n        String foundPartName = null;\n        String key = null;\n        for (int i = 0; i < partNameAndParams.length(); i++) {\n            char ch = partNameAndParams.charAt(i);\n            switch (ch) {\n                case '%':\n                    StringBuilder hexVal = new StringBuilder(2);\n                    hexVal.append(partNameAndParams.charAt(i + 1));\n                    hexVal.append(partNameAndParams.charAt(i + 2));\n                    nextToken.append((char) Integer.parseInt(hexVal.toString(),\n                                                             16));\n                    i += 2;\n                    break;\n\n                case '?':\n                    if (foundPartName == null) {\n                        foundPartName = nextToken.toString();\n                        nextToken = new StringBuilder(50);\n                    } else {\n                        nextToken.append('?');\n                    }\n                    break;\n\n                case '=':\n                    if (foundPartName == null) {\n                        nextToken.append('=');\n                    } else {\n                        key = nextToken.toString();\n                        nextToken = new StringBuilder(50);\n                    }\n                    break;\n\n                case '&':\n                    parameters.put(key,\n                                   nextToken.toString());\n                    nextToken = new StringBuilder(50);\n                    key = null;\n                    break;\n\n                default:\n                    nextToken.append(ch);\n            }\n        }\n\n        if (foundPartName == null) {\n            foundPartName = nextToken.toString();\n        } else if (key != null) {\n            parameters.put(key,\n                           nextToken.toString());\n        } else if (nextToken.length() > 0) {\n            parameters.put(nextToken.toString(),\n                           \"\");\n        }\n\n        return new DefaultPlaceRequest(foundPartName,\n                                       parameters);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public void setIdentifier(String identifier) {\n        this.identifier = identifier;\n    }\n\n    @Override\n    public String getFullIdentifier() {\n        StringBuilder fullIdentifier = new StringBuilder();\n        fullIdentifier.append(this.getIdentifier());\n\n        if (!this.getParameterNames().isEmpty()) {\n            fullIdentifier.append(\"?\");\n        }\n        for (String name : this.getParameterNames()) {\n            fullIdentifier.append(name).append(\"=\").append(this.getParameter(name,\n                                                                             null).toString());\n            fullIdentifier.append(\"&\");\n        }\n\n        if (fullIdentifier.length() != 0 && fullIdentifier.lastIndexOf(\"&\") + 1 == fullIdentifier.length()) {\n            fullIdentifier.deleteCharAt(fullIdentifier.length() - 1);\n        }\n\n        return fullIdentifier.toString();\n    }\n\n    //TODO: Throw ValueFormatException if conversion to a String is not possible\n    @Override\n    public String getParameter(final String key,\n                               final String defaultValue) {\n\n        final String value = parameters.get(key);\n\n        if (value == null) {\n            return defaultValue;\n        }\n        return value;\n    }\n\n    @Override\n    public Set<String> getParameterNames() {\n        return parameters.keySet();\n    }\n\n    @Override\n    public Map<String, String> getParameters() {\n        return parameters;\n    }\n\n    @Override\n    public PlaceRequest addParameter(final String name,\n                                     final String value) {\n        this.parameters.put(name,\n                            value);\n        return this;\n    }\n\n    @Override\n    public PlaceRequest clone() {\n        return new DefaultPlaceRequest(identifier,\n                                       parameters);\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultPlaceRequest)) {\n            return false;\n        }\n\n        final DefaultPlaceRequest that = (DefaultPlaceRequest) o;\n\n        if (getIdentifier() != null ? !getIdentifier().equals(that.getIdentifier()) : that.getIdentifier() != null) {\n            return false;\n        }\n        return !(getParameters() != null ? !getParameters().equals(that.getParameters()) : that.getParameters() != null);\n    }\n\n    @Override\n    public boolean isUpdateLocationBarAllowed() {\n        return updateLocationBar;\n    }\n\n    @Override\n    public void setUpdateLocationBar(boolean updateLocationBar) {\n        this.updateLocationBar = updateLocationBar;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = identifier.hashCode();\n        result = ~~result;\n        result = 31 * result + parameters.hashCode();\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceRequest[\\\"\" + identifier + \"\\\" \" + parameters + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/impl/ExternalPathPlaceRequest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.mvp.impl;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * A {@link PathPlaceRequest} originating from an external script.\n */\n@JsType\npublic class ExternalPathPlaceRequest extends DefaultPlaceRequest {\n\n    private Path path;\n\n    public ExternalPathPlaceRequest(Path path) {\n        this.path = path;\n    }\n\n    @JsIgnore\n    public static ExternalPathPlaceRequest create(PathPlaceRequest request) {\n        return new ExternalPathPlaceRequest(request.getPath().getOriginal());\n    }\n\n    @Override\n    public Path getPath() {\n        return path;\n    }\n\n    @Override\n    public String toString() {\n        return \"ExternalPathPlaceRequest [path=\" + path + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/impl/ForcedPlaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp.impl;\n\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ForcedPlaceRequest\n        extends DefaultPlaceRequest {\n\n    public ForcedPlaceRequest() {\n        super(\"\");\n    }\n\n    public ForcedPlaceRequest(final String identifier) {\n        super(identifier);\n    }\n\n    public ForcedPlaceRequest(final String identifier,\n                              final Map<String, String> parameters) {\n        super(identifier,\n              parameters);\n    }\n\n    /**\n     * Creates a place request for the given place ID, with the given state parameters for that place, and the given\n     * preference of whether or not the browser's location bar should be updated.\n     * @param identifier The place ID, or an empty string for the default place.\n     * @param parameters Place-specific parameters to pass to the place. Must not be null.\n     * @param updateLocationBar If true, the browser's history will be updated with this place request. If false, the location bar\n     * will not be modified as a result of this place request.\n     */\n    public ForcedPlaceRequest(final String identifier,\n                              final Map<String, String> parameters,\n                              final boolean updateLocationBar) {\n        super(identifier,\n              parameters,\n              updateLocationBar);\n    }\n\n    @Override\n    public String toString() {\n        return \"ForcedPlaceRequest [identifier=\" + identifier + \", parameters=\" + parameters + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/mvp/impl/PathPlaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp.impl;\n\nimport java.util.Map;\n\nimport javax.annotation.PreDestroy;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.backend.vfs.IsVersioned;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.uberfire.util.URIUtil.encode;\n\n@Portable\npublic class PathPlaceRequest extends DefaultPlaceRequest {\n\n    public static String NULL = \"[null]\";\n\n    private ObservablePath path;\n\n    public PathPlaceRequest() {\n    }\n\n    public PathPlaceRequest(final Path path) {\n        super(NULL);\n        this.path = createObservablePath(path);\n    }\n\n    public PathPlaceRequest(final Path path,\n                            final Map<String, String> parameters) {\n        this(path);\n        this.parameters.putAll(parameters);\n    }\n\n    public PathPlaceRequest(final Path path,\n                            final String id) {\n        super(id);\n        this.path = createObservablePath(path);\n    }\n\n    public PathPlaceRequest(final Path path,\n                            final String id,\n                            final Map<String, String> parameters) {\n        this(path,\n             id);\n        this.parameters.putAll(parameters);\n    }\n\n    protected ObservablePath createObservablePath(Path path) {\n        return IOC.getBeanManager().lookupBean(ObservablePath.class).getInstance().wrap(path);\n    }\n\n    @Override\n    public ObservablePath getPath() {\n        return path;\n    }\n\n    @Override\n    public String getFullIdentifier() {\n        final StringBuilder fullIdentifier = new StringBuilder();\n        if (getIdentifier() != null) {\n            fullIdentifier.append(this.getIdentifier());\n        } else {\n            fullIdentifier.append(NULL);\n        }\n\n        fullIdentifier.append(\"?\").append(\"path_uri\").append(\"=\").append(encode(path.toURI())).append(\"&\")\n                .append(\"file_name\").append(\"=\").append(encode(path.getFileName())).append(\"&\");\n\n        if (path instanceof IsVersioned) {\n            fullIdentifier.append(\"has_version_support\").append(\"=\").append(((IsVersioned) path).hasVersionSupport()).append(\"&\");\n        }\n\n        for (String name : this.getParameterNames()) {\n            fullIdentifier.append(name).append(\"=\").append(this.getParameter(name,\n                                                                             null));\n            fullIdentifier.append(\"&\");\n        }\n\n        if (fullIdentifier.length() != 0 && fullIdentifier.lastIndexOf(\"&\") + 1 == fullIdentifier.length()) {\n            fullIdentifier.deleteCharAt(fullIdentifier.length() - 1);\n        }\n\n        return fullIdentifier.toString();\n    }\n\n    @Override\n    public PlaceRequest clone() {\n        return new PathPlaceRequest(path,\n                                    identifier,\n                                    parameters);\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PathPlaceRequest)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        final PathPlaceRequest that = (PathPlaceRequest) o;\n\n        return !(getPath() != null ? !getPath().equals(that.getPath()) : that.getPath() != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        result = 31 * result + (getPath() != null ? getPath().hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"PathPlaceRequest[\\\"\" + identifier + \"\\\" \" + parameters + \"\\\" \" + path + \"]\";\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        getPath().dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/paging/AbstractPageRow.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.paging;\n\n/**\n * A single row of a paged data\n */\npublic abstract class AbstractPageRow\n        implements Comparable<AbstractPageRow> {\n\n    public int compareTo(AbstractPageRow o) {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/paging/AbstractPathPageRow.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.paging;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * A single row of a paged data\n */\npublic abstract class AbstractPathPageRow\n        extends AbstractPageRow {\n\n    private Path path;\n\n    public AbstractPathPageRow() {\n        super();\n    }\n\n    public AbstractPathPageRow(final Path path) {\n        super();\n        this.path = path;\n    }\n\n    public int compareTo(final AbstractPathPageRow other) {\n        return path.compareTo(other.path);\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/paging/PageRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.paging;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * A generic request for paged data\n * @see PageResponse\n */\n@Portable\npublic class PageRequest {\n\n    protected int startRowIndex = 0;\n    protected Integer pageSize = null; // null returns all pages\n\n    public PageRequest(@MapsTo(\"startRowIndex\") int startRowIndex,\n                       @MapsTo(\"pageSize\") Integer pageSize) {\n        this.startRowIndex = startRowIndex;\n        this.pageSize = pageSize;\n    }\n\n    // ************************************************************************\n    // Getters and setters\n    // ************************************************************************\n\n    public Integer getPageSize() {\n        return pageSize;\n    }\n\n    public void setPageSize(Integer pageSize) {\n        this.pageSize = pageSize;\n    }\n\n    public int getStartRowIndex() {\n        return startRowIndex;\n    }\n\n    public void setStartRowIndex(int startRowIndex) {\n        this.startRowIndex = startRowIndex;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/paging/PageResponse.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.paging;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * A Page of data for display in a PagedTable\n */\n@Portable\npublic class PageResponse<T extends AbstractPageRow> {\n\n    // Is totalRowSize exact or undetermined\n    private boolean totalRowSizeExact;\n\n    // Total number of rows in whole data-set (not just page)\n    private int totalRowSize;\n\n    private int startRowIndex;\n    private List<T> pageRowList;\n    private boolean lastPage;\n\n    // ************************************************************************\n    // Getters and setters\n    // ************************************************************************\n\n    public List<T> getPageRowList() {\n        return pageRowList;\n    }\n\n    public void setPageRowList(List<T> assetPageRowList) {\n        this.pageRowList = assetPageRowList;\n    }\n\n    public int getStartRowIndex() {\n        return startRowIndex;\n    }\n\n    public void setStartRowIndex(int startRowIndex) {\n        this.startRowIndex = startRowIndex;\n    }\n\n    public int getTotalRowSize() {\n        return totalRowSize;\n    }\n\n    public void setTotalRowSize(int totalRowSize) {\n        this.totalRowSize = totalRowSize;\n    }\n\n    public boolean isFirstPage() {\n        return startRowIndex == 0L;\n    }\n\n    public boolean isLastPage() {\n        return lastPage;\n    }\n\n    public void setLastPage(boolean lastPage) {\n        this.lastPage = lastPage;\n    }\n\n    public boolean isTotalRowSizeExact() {\n        return totalRowSizeExact;\n    }\n\n    public void setTotalRowSizeExact(boolean totalRowSizeExact) {\n        this.totalRowSizeExact = totalRowSizeExact;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/plugin/PluginUtil.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.plugin;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Utilities for working with external (GWT-compiled) plugins.\n */\npublic class PluginUtil {\n\n    private PluginUtil() {\n    }\n\n    /**\n     * {@link List} is a {@link JsType} but {@link Collection#iterator()} is\n     * {@link JsIgnore}d and therefore not exported to JavaScript.\n     * <p>\n     * This method takes a list and converts it to a new list so it can be\n     * iterated over in the current script (e.g. using enhanced for loops), even\n     * if the instance was provided by an external (GWT-compiled) script.\n     *\n     * @param externalList A list, possibly provided by an external script. Must not be null.\n     * @return an immutable list containing the original elements of the\n     * provided list\n     */\n    public static <T> List<T> ensureIterable(List<T> externalList) {\n        checkNotNull(\"externalList\",\n                     externalList);\n\n        // toArray(T[]) is @JsIgnored\n        @SuppressWarnings(\"unchecked\")\n        final List<T> tmp = (List<T>) Arrays.asList(externalList.toArray());\n        return Collections.unmodifiableList(tmp);\n    }\n\n    /**\n     * {@link Set} is a {@link JsType} but {@link Collection#iterator()} is\n     * {@link JsIgnore}d and therefore not exported to JavaScript.\n     * <p>\n     * This method takes a set and converts it to a new set so it can be\n     * iterated over in the current script (e.g. using enhanced for loops), even\n     * if the instance was provided by an external (GWT-compiled) script.\n     *\n     * @param externalSet A set, possibly provided by an external script. Must not be null.\n     * @return an immutable set containing the original elements of the provided\n     * set\n     */\n    public static <T> Set<T> ensureIterable(Set<T> externalSet) {\n        checkNotNull(\"externalSet\",\n                     externalSet);\n\n        // toArray(T[]) is @JsIgnored\n        @SuppressWarnings(\"unchecked\")\n        final List<T> tmp = (List<T>) Arrays.asList(externalSet.toArray());\n        return Collections.unmodifiableSet(new HashSet<T>(tmp));\n    }\n\n    /**\n     * {@link Integer} is not a {@link JsType} and can't be shared across\n     * scripts.\n     * <p>\n     * This method converts a regular int to an {@link Integer} using -1 as a\n     * placeholder for null.\n     *\n     * @param value\n     * @return boxed {@link Integer}, null if provided value is -1.\n     */\n    public static Integer toInteger(int value) {\n        return (value != -1) ? value : null;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/rpc/SessionInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.rpc;\n\nimport org.jboss.errai.security.shared.api.identity.User;\n\npublic interface SessionInfo {\n\n    String getId();\n\n    User getIdentity();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/rpc/impl/SessionInfoImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.rpc.impl;\n\nimport javax.enterprise.inject.Alternative;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Alternative\npublic class SessionInfoImpl implements SessionInfo {\n\n    private String id;\n    private User identity;\n\n    public SessionInfoImpl() {\n    }\n\n    public SessionInfoImpl(final String id,\n                           final User identity) {\n        this.id = checkNotEmpty(\"id\",\n                                id);\n        this.identity = checkNotNull(\"identity\",\n                                     identity);\n    }\n\n    public SessionInfoImpl(final User identity) {\n        this.identity = checkNotNull(\"identity\",\n                                     identity);\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    public void setId(final String id) {\n        this.id = id;\n    }\n\n    @Override\n    public User getIdentity() {\n        return identity;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof SessionInfo)) {\n            return false;\n        }\n\n        SessionInfo that = (SessionInfo) o;\n\n        if (!getId().equals(that.getId())) {\n            return false;\n        }\n\n        return getIdentity().getIdentifier().equals(that.getIdentity().getIdentifier());\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id.hashCode();\n        result = 31 * result + identity.getIdentifier().hashCode();\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"SessionInfoImpl [id=\" + id + \", identity=\" + identity + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/rpc/impl/SessionInfoMarshalller.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.rpc.impl;\n\nimport org.jboss.errai.common.client.protocols.SerializationParts;\nimport org.jboss.errai.marshalling.client.api.MarshallingSession;\nimport org.jboss.errai.marshalling.client.api.annotations.ClientMarshaller;\nimport org.jboss.errai.marshalling.client.api.annotations.ServerMarshaller;\nimport org.jboss.errai.marshalling.client.api.json.EJValue;\nimport org.jboss.errai.marshalling.client.marshallers.AbstractNullableMarshaller;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.rpc.SessionInfo;\n\n@ClientMarshaller(SessionInfo.class)\n@ServerMarshaller(SessionInfo.class)\npublic class SessionInfoMarshalller extends AbstractNullableMarshaller<SessionInfo> {\n\n    @Override\n    public SessionInfo doNotNullDemarshall(final EJValue ejValue,\n                                           final MarshallingSession marshallingSession) {\n\n        return new SessionInfoImpl(ejValue.isObject().get(\"id\").isString().stringValue(),\n                                   new UserImpl(ejValue.isObject().get(\"identityId\").isString().stringValue()));\n    }\n\n    @Override\n    public String doNotNullMarshall(final SessionInfo sessionInfo,\n                                    final MarshallingSession marshallingSession) {\n        return \"{\\\"\" + SerializationParts.ENCODED_TYPE + \"\\\":\\\"\" + SessionInfo.class.getName() + \"\\\",\" +\n                \"\\\"\" + SerializationParts.OBJECT_ID + \"\\\":\\\"\" + sessionInfo.hashCode() + \"\\\",\" +\n                \"\\\"\" + \"id\" + \"\\\":\\\"\" + sessionInfo.getId() + \"\\\",\" +\n                \"\\\"\" + \"identityId\" + \"\\\":\\\"\" + sessionInfo.getIdentity().getIdentifier() + \"\\\"}\";\n    }\n\n    @Override\n    public SessionInfo[] getEmptyArray() {\n        return new SessionInfo[0];\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/Contributor.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.Comparator;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Contributor {\n\n    private String username;\n\n    private ContributorType type;\n\n    public Contributor() {\n    }\n\n    public Contributor(@MapsTo(\"username\") final String username,\n                       @MapsTo(\"type\") final ContributorType type) {\n        this.username = username;\n        this.type = type;\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public ContributorType getType() {\n        return type;\n    }\n\n    public void setType(ContributorType type) {\n        this.type = type;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Contributor)) {\n            return false;\n        }\n        Contributor that = (Contributor) o;\n        return Objects.equals(username,\n                              that.username) &&\n                type == that.type;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = username != null ? username.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (type != null ? type.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    public static final Comparator<Contributor> COMPARATOR = (o1, o2) -> {\n        if (o1.getType().equals(o2.getType())) {\n            return o1.getUsername().toUpperCase().compareTo(o2.getUsername().toUpperCase());\n        } else {\n            if (ContributorType.PRIORITY_ORDER.indexOf(o1.getType()) < ContributorType.PRIORITY_ORDER.indexOf(o2.getType())) {\n                return -1;\n            } else {\n                return 1;\n            }\n        }\n    };\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/ContributorResource.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.Collection;\n\npublic interface ContributorResource {\n    Collection<Contributor> getContributors();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/ContributorType.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.Arrays;\nimport java.util.List;\n\npublic enum ContributorType {\n\n    OWNER, ADMIN, CONTRIBUTOR;\n\n    public static List<ContributorType> PRIORITY_ORDER = Arrays.asList(OWNER, ADMIN, CONTRIBUTOR);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/Resource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * A generic interface for modelling resources, like UI assets: perspectives, screens or\n * editors or even backend resources like repositories, projects, data objects, etc...\n */\n@JsType\npublic interface Resource {\n\n    /**\n     * An identifier that is unique among all the resources of the same type\n     * (see {@link Resource#getResourceType()}).\n     */\n    String getIdentifier();\n\n    /**\n     * Get the resource type classifier\n     */\n    default ResourceType getResourceType() {\n        return ResourceType.UNKNOWN;\n    }\n\n    /**\n     * A list of dependent resources.\n     * <p>\n     * <p>\n     * The dependency list is used for instance to determine if a user can\n     * access a given resource. Should the access to all its dependencies is\n     * denied, it is denied for this instance as well.\n     * </p>\n     * @return A list of resources, never null.\n     */\n    default List<Resource> getDependencies() {\n        return Collections.emptyList();\n    }\n\n    /**\n     * Check if this resource is of the provided type. The type name is used\n     * here so this method can be used on instances from external (GWT-compiled)\n     * scripts (enum equals and instanceof doesn't work across script boundaries).\n     * @param typeName the resource type's name\n     * @return true if the resource has the provided type, otherwise false.\n     */\n    default boolean isType(String typeName) {\n        return getResourceType().getName().equalsIgnoreCase(typeName);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/ResourceAction.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * An action represents something that someone can do over a resource.\n * Can vary from a complex UI feature to a low-level action.\n * <p>\n * <p>This interface is intended to be extended by the different {@link Resource} types. It is up to every\n * resource type implementation to define the list of available actions.</p>\n */\n@JsType\npublic interface ResourceAction {\n\n    /**\n     * The read action is common to all resource types.\n     * <p>Basically, it refers to the ability to access (view, read, ...) a resource</p>\n     */\n    ResourceAction READ = () -> \"read\";\n\n    /**\n     * An string representation of the action.\n     */\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/ResourceRef.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n/**\n * A resource reference. Useful when a link to the real Resource object is not available.\n */\npublic class ResourceRef implements Resource {\n\n    private String identifier;\n    private ResourceType type;\n    private List<Resource> dependencies;\n\n    public ResourceRef(String identifier,\n                       ResourceType type) {\n        this(identifier,\n             type,\n             null);\n    }\n\n    public ResourceRef(String identifier,\n                       ResourceType type,\n                       List<Resource> dependencies) {\n        this.identifier = identifier;\n        this.type = type;\n        this.dependencies = new ArrayList<>();\n        this.setDependencies(dependencies);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    public void setIdentifier(String identifier) {\n        this.identifier = identifier;\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return type;\n    }\n\n    public void setResourceType(ResourceType type) {\n        this.type = type;\n    }\n\n    @Override\n    public List<Resource> getDependencies() {\n        return dependencies;\n    }\n\n    public void setDependencies(List<Resource> deps) {\n        this.dependencies.clear();\n        if (deps != null) {\n            this.dependencies.addAll(deps);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/ResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * Type interface for {@link Resource} instances\n */\n@JsType\npublic interface ResourceType {\n\n    /**\n     * Resource type declaration for those resources who do not declare a type.\n     */\n    ResourceType UNKNOWN = () -> \"unknown\";\n\n    /**\n     * An string representation of this type instance\n     */\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/WorkbenchUserManager.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport org.jboss.errai.security.shared.api.identity.User;\n\n/**\n * Basic API to interact with the user system\n */\npublic interface WorkbenchUserManager {\n\n    /**\n     * Returns the platform {@link User} identified by a given identifier\n     * @param identifier The {@link User} identifier\n     * @return The correct {@link User} if exists or null.\n     */\n    User getUser(String identifier);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/authz/ResourceActionRef.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.ResourceType;\n\n/**\n * A instance holding a resource reference plus an action\n */\n@JsType\npublic class ResourceActionRef {\n\n    private Resource resource = null;\n    private ResourceAction action = null;\n\n    @JsIgnore\n    public ResourceActionRef(Resource resource) {\n        this(resource,\n             ResourceAction.READ);\n    }\n\n    @JsIgnore\n    public ResourceActionRef(Resource resource,\n                             ResourceAction action) {\n        this.resource = resource;\n        this.action = action;\n    }\n\n    @JsIgnore\n    public ResourceActionRef(ResourceType type,\n                             ResourceAction action) {\n        this.resource = new ResourceRef(null,\n                                        type);\n        this.action = action;\n    }\n\n    @JsIgnore\n    public ResourceActionRef(ResourceType type,\n                             Resource resource,\n                             ResourceAction action) {\n        this.resource = resource != null ? resource : new ResourceRef(null,\n                                                                      type);\n        this.action = action;\n    }\n\n    public Resource getResource() {\n        return resource;\n    }\n\n    public ResourceAction getAction() {\n        return action;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/authz/RuntimeContentResource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\npublic interface RuntimeContentResource extends RuntimeResource {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/authz/RuntimeFeatureResource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\npublic interface RuntimeFeatureResource extends RuntimeResource {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/authz/RuntimeResource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.Resource;\n\n@JsType\npublic interface RuntimeResource extends Resource {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/security/authz/VotingStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\n/**\n * A voting strategy establishes what to do when different authorization results are produced during the\n * evaluation of a permission over a protected resource. This is the case when the user is assigned with\n * more than one user and/or group. In such case, different strategies can be applied in order to resolve\n * what is the winning result.\n */\npublic enum VotingStrategy {\n\n    /**\n     * It is the most lenient strategy. Only a single positive vote is required.\n     */\n    AFFIRMATIVE,\n\n    /**\n     * It is based on general agreement. It requires a majority of positive votes.\n     */\n    CONSENSUS,\n\n    /**\n     * It is the less lenient strategy. It requires a 100% of positive votes.\n     */\n    UNANIMOUS,\n\n    /**\n     * It is based on role/group priorities. The highest priority result wins.\n     */\n    PRIORITY;\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/spaces/Space.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.spaces;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Space {\n\n    private String name;\n\n    public Space() {\n        //cdi\n    }\n\n    public Space(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return name;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        return obj instanceof Space && Objects.equals(name, ((Space) obj).getName());\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hashCode(name);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/spaces/SpacesAPI.java",
    "content": "package org.uberfire.spaces;\n\nimport java.net.URI;\nimport java.util.Optional;\n\nimport com.google.gwt.core.shared.GwtIncompatible;\n\npublic interface SpacesAPI {\n\n    String DEFAULT_SPACE_NAME = \"system\";\n    Space DEFAULT_SPACE = new Space(DEFAULT_SPACE_NAME);\n\n    String DASHBUILDER_SPACE_NAME = \"dashbuilder\";\n    Space DASHBUILDER_SPACE = new Space(DASHBUILDER_SPACE_NAME);\n\n    String CONFIG_FOLDER_NAME = \".config\";\n    String CONFIG_REPOSITORY_NAME = \"config\";\n\n    static String resolveSpacePath(final Scheme scheme,\n                                   final String spaceName) {\n        return scheme + \"://\" + spaceName + \"/\";\n    }\n\n    static String resolveFileSystemPath(final Scheme scheme,\n                                        final Space space,\n                                        final String fsName) {\n        return scheme + \"://\" + space.getName() + \"/\" + fsName;\n    }\n\n    static String resolveConfigFileSystemPath(final Scheme scheme,\n                                              final String spaceName) {\n        return resolveSpacePath(scheme, spaceName) + CONFIG_FOLDER_NAME + \"/\" + CONFIG_REPOSITORY_NAME;\n    }\n\n    @GwtIncompatible\n    public URI resolveFileSystemURI(Scheme scheme,\n                                    Space space,\n                                    String fsName);\n\n    static String sanitizeFileSystemName(final String fileSystemName) {\n        // Only [A-Za-z0-9_\\-.] are valid so strip everything else out\n        return fileSystemName != null ? fileSystemName.replaceAll(\"[^A-Za-z0-9_\\\\-.]\",\n                                                                  \"\") : fileSystemName;\n    }\n\n    Space getSpace(String name);\n\n    default Space getDefaultSpace() {\n        return DEFAULT_SPACE;\n    }\n\n    Optional<Space> resolveSpace(String uri);\n\n    enum Scheme {\n        DEFAULT(\"default\"),\n        GIT(\"git\"),\n        FILE(\"file\");\n\n        private final String name;\n\n        Scheme(String name) {\n            this.name = name;\n        }\n\n        @Override\n        public String toString() {\n            return name;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/util/URIUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.util;\n\nimport java.io.UnsupportedEncodingException;\nimport java.net.URI;\nimport java.net.URLDecoder;\nimport java.net.URLEncoder;\n\n/**\n * Utilities for working with URIs that functions the same in both client and server code.\n * <p>\n * Implementation note: there is a separate GWT super-source implementation of this class for client-side use. If\n * modifying this class, be sure to go modify that one too.\n */\npublic final class URIUtil {\n\n    public static String encode(final String content) {\n        try {\n            return URLEncoder.encode(content,\n                                     \"UTF-8\");\n        } catch (UnsupportedEncodingException e) {\n        }\n        return null;\n    }\n\n    public static String decode(final String content) {\n        try {\n            return URLDecoder.decode(content,\n                                     \"UTF-8\");\n        } catch (UnsupportedEncodingException e) {\n        }\n        return null;\n    }\n\n    public static String encodeQueryString(final String content) {\n        return encode(content);\n    }\n\n    public static boolean isValid(final String uri) {\n        try {\n            URI.create(uri);\n            return true;\n        } catch (final Exception ignored) {\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/annotations/VisibleAsset.java",
    "content": "package org.uberfire.workbench.annotations;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * This annotation represents a Resource that should be visible to end users. Any other resource not annotated with it\n * should not be shown. In case you need to inject a Resource that contains @VisibleAsset in an object that doesn't need\n * this concept you can add @Default qualifier to it.\n */\n@Documented\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE, PARAMETER, FIELD, METHOD})\npublic @interface VisibleAsset {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/category/Category.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.category;\n\npublic abstract class Category {\n\n    public abstract String getName();\n\n    @Override\n    public boolean equals(Object category) {\n        if (category instanceof Category) {\n            Category cat = (Category) category;\n            return this.getName() == null ?\n                    cat.getName() == null :\n                    this.getName().equalsIgnoreCase(cat.getName());\n        } else {\n            return false;\n        }\n    }\n\n    @Override\n    public int hashCode() {\n        return getName() == null ? 0 : getName().toUpperCase().hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/category/Others.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.category;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class Others extends Category {\n\n    private static final String OTHERS = \"OTHERS\";\n\n    @Override\n    public String getName() {\n        return OTHERS;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/category/Undefined.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.category;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class Undefined extends Category {\n\n    private static final String UNDEFINED = \"UNDEFINED\";\n\n    @Override\n    public String getName() {\n        return UNDEFINED;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/diff/DiffMode.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.diff;\n\npublic enum DiffMode {\n    TEXTUAL,\n    VISUAL\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/NotificationEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An event to show a notification pop-up in the Workbench\n */\n@Portable\npublic class NotificationEvent implements UberFireEvent {\n\n    private String notification;\n    private NotificationType type;\n    private boolean isSingleton;\n    private PlaceRequest placeRequest;\n    private Integer initialTopOffset;\n    private boolean autoHide = true;\n    private String navigationText;\n    private PlaceRequest navigationPlace;\n\n    public NotificationEvent() {\n    }\n\n    public NotificationEvent(final String notification) {\n        this(notification,\n             NotificationType.DEFAULT,\n             false,\n             null);\n    }\n\n    public NotificationEvent(final String notification,\n                             final NotificationType type) {\n        this(notification,\n             type,\n             false,\n             null);\n    }\n\n    public NotificationEvent(final String notification,\n                             final boolean isSingleton) {\n        this(notification,\n             NotificationType.DEFAULT,\n             isSingleton,\n             null);\n    }\n\n    public NotificationEvent(final String notification,\n                             final NotificationType type,\n                             final boolean isSingleton) {\n        this(notification,\n             NotificationType.DEFAULT,\n             isSingleton,\n             null);\n    }\n\n    public NotificationEvent(final String notification,\n                             final NotificationType type,\n                             final boolean isSingleton,\n                             final PlaceRequest placeRequest) {\n\n        this(notification,\n             type,\n             isSingleton,\n             placeRequest,\n             null);\n    }\n\n    public NotificationEvent(final String notification,\n                             final NotificationType type,\n                             final boolean isSingleton,\n                             final PlaceRequest placeRequest,\n                             final Integer initialTopOffset) {\n\n        this.notification = notification;\n        this.type = type;\n        this.isSingleton = isSingleton;\n        this.placeRequest = placeRequest;\n        this.initialTopOffset = initialTopOffset;\n    }\n\n    public String getNotification() {\n        return this.notification;\n    }\n\n    public NotificationType getType() {\n        return type;\n    }\n\n    public boolean isSingleton() {\n        return isSingleton;\n    }\n\n    public PlaceRequest getPlaceRequest() {\n        return placeRequest;\n    }\n\n    public Integer getInitialTopOffset() {\n        return initialTopOffset;\n    }\n\n    public NotificationEvent setAutoHide(final boolean autoHide) {\n        this.autoHide = autoHide;\n        return this;\n    }\n\n    public boolean autoHide() {\n        return autoHide;\n    }\n\n    public NotificationEvent setNavigation(final String text,\n                                       final PlaceRequest place) {\n        this.navigationText = text;\n        this.navigationPlace = place;\n        return this;\n    }\n\n    public boolean hasNavigation() {\n        return navigationText != null\n            && navigationPlace != null;\n    }\n\n    public String getNavigationText() {\n        return navigationText;\n    }\n\n    public PlaceRequest getNavigationPlace() {\n        return navigationPlace;\n    }\n\n    @Override\n    public String toString() {\n        return \"NotificationEvent [notification=\" + notification + \", type=\" + type + \"]\";\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + (isSingleton ? 1231 : 1237);\n        result = prime * result + ((notification == null) ? 0 : notification.hashCode());\n        result = prime * result + ((placeRequest == null) ? 0 : placeRequest.hashCode());\n        result = prime * result + ((initialTopOffset == null) ? 0 : initialTopOffset.hashCode());\n        result = prime * result + ((type == null) ? 0 : type.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        NotificationEvent other = (NotificationEvent) obj;\n        if (isSingleton != other.isSingleton) {\n            return false;\n        }\n        if (notification == null) {\n            if (other.notification != null) {\n                return false;\n            }\n        } else if (!notification.equals(other.notification)) {\n            return false;\n        }\n        if (placeRequest == null) {\n            if (other.placeRequest != null) {\n                return false;\n            }\n        } else if (!placeRequest.equals(other.placeRequest)) {\n            return false;\n        }\n        if (initialTopOffset == null) {\n            if (other.initialTopOffset != null) {\n                return false;\n            }\n        } else if (!initialTopOffset.equals(other.initialTopOffset)) {\n            return false;\n        }\n        if (type != other.type) {\n            return false;\n        }\n        return true;\n    }\n\n    public static enum NotificationType {\n        DEFAULT,\n        ERROR,\n        SUCCESS,\n        INFO,\n        WARNING\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/PluginAddedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PluginAddedEvent extends PluginEvent {\n\n    public PluginAddedEvent(@MapsTo(\"name\") String name) {\n        super(name);\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/PluginEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.events;\n\npublic abstract class PluginEvent {\n\n    private String name;\n\n    public PluginEvent(String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/PluginReloadedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PluginReloadedEvent {\n\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/PluginUpdatedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PluginUpdatedEvent extends PluginEvent {\n\n    public PluginUpdatedEvent(@MapsTo(\"name\") String name) {\n        super(name);\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceAdded.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ResourceAdded implements UberFireEvent,\n                                      ResourceChange {\n\n    private String message;\n\n    public ResourceAdded(@MapsTo(\"message\") final String message) {\n        this.message = message;\n    }\n\n    @Override\n    public ResourceChangeType getType() {\n        return ResourceChangeType.ADD;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceAdded{\" +\n                \"message='\" + message + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceAddedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been added\n */\n@Portable\npublic class ResourceAddedEvent extends ResourceAdded implements ResourceEvent {\n\n    private Path path;\n    private SessionInfo sessionInfo;\n\n    public ResourceAddedEvent(@MapsTo(\"path\") final Path path,\n                              @MapsTo(\"message\") final String message,\n                              @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(message);\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    @Override\n    public Path getPath() {\n        return this.path;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceAddedEvent{\" +\n                \"path=\" + path +\n                \", message=\" + getMessage() +\n                \", sessionInfo=\" + sessionInfo +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceBatchChangesEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a various changes to various Resources\n */\n@Portable\npublic class ResourceBatchChangesEvent implements UberFireEvent {\n\n    private String message;\n    private SessionInfo sessionInfo;\n    private Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>();\n\n    public ResourceBatchChangesEvent(@MapsTo(\"batch\") final Map<Path, Collection<ResourceChange>> batch,\n                                     @MapsTo(\"message\") final String message,\n                                     @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        checkNotNull(\"batch\",\n                     batch);\n        this.batch.putAll(batch);\n        this.message = message;\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    public Map<Path, Collection<ResourceChange>> getBatch() {\n        return this.batch;\n    }\n\n    public boolean containPath(final Path path) {\n        return batch.containsKey(path);\n    }\n\n    public Collection<Path> getAffectedPaths() {\n        return batch.keySet();\n    }\n\n    public Collection<ResourceChange> getChanges(final Path path) {\n        return batch.get(path);\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceBatchChangesEvent [sessionInfo=\" + sessionInfo + \", batch=\" + batch + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceChange.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\npublic interface ResourceChange {\n\n    public ResourceChangeType getType();\n\n    public String getMessage();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceChangeType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Types of change that can happen to a Resource\n */\n@Portable\npublic enum ResourceChangeType {\n    ADD,\n    DELETE,\n    UPDATE,\n    COPY,\n    RENAME\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceCopied.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class ResourceCopied implements UberFireEvent,\n                                       ResourceChange {\n\n    private Path destinationPath;\n    private String message;\n\n    public ResourceCopied(@MapsTo(\"destinationPath\") final Path destinationPath,\n                          @MapsTo(\"message\") final String message) {\n        this.destinationPath = checkNotNull(\"destinationPath\",\n                                            destinationPath);\n        this.message = message;\n    }\n\n    @Override\n    public ResourceChangeType getType() {\n        return ResourceChangeType.COPY;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n\n    public Path getDestinationPath() {\n        return this.destinationPath;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceCopiedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been copied\n */\n@Portable\npublic class ResourceCopiedEvent extends ResourceCopied implements ResourceEvent {\n\n    private Path sourcePath;\n    private SessionInfo sessionInfo;\n\n    public ResourceCopiedEvent(@MapsTo(\"sourcePath\") final Path sourcePath,\n                               @MapsTo(\"destinationPath\") final Path destinationPath,\n                               @MapsTo(\"message\") final String message,\n                               @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(destinationPath,\n              message);\n        this.sourcePath = checkNotNull(\"sourcePath\",\n                                       sourcePath);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public Path getPath() {\n        return this.sourcePath;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceCopiedEvent{\" +\n                \"sourcePath=\" + sourcePath +\n                \", destinationPath=\" + getDestinationPath() +\n                \", message=\" + getMessage() +\n                \", sessionInfo=\" + sessionInfo +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceDeleted.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ResourceDeleted implements UberFireEvent,\n                                        ResourceChange {\n\n    private String message;\n\n    public ResourceDeleted(@MapsTo(\"message\") final String message) {\n        this.message = message;\n    }\n\n    @Override\n    public ResourceChangeType getType() {\n        return ResourceChangeType.DELETE;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceDeletedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been deleted\n */\n@Portable\npublic class ResourceDeletedEvent extends ResourceDeleted implements ResourceEvent {\n\n    private Path path;\n    private SessionInfo sessionInfo;\n\n    public ResourceDeletedEvent(@MapsTo(\"path\") final Path path,\n                                @MapsTo(\"message\") final String message,\n                                @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(message);\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.sessionInfo = checkNotNull(\"executedBy\",\n                                        sessionInfo);\n    }\n\n    @Override\n    public Path getPath() {\n        return this.path;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceDeletedEvent{\" +\n                \"path=\" + path +\n                \", message=\" + getMessage() +\n                \", sessionInfo=\" + sessionInfo +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface ResourceEvent extends ResourceChange {\n\n    public Path getPath();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceOpenedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been opened\n */\n@Portable\npublic class ResourceOpenedEvent implements UberFireEvent {\n\n    private Path path;\n    private SessionInfo sessionInfo;\n\n    public ResourceOpenedEvent(@MapsTo(\"path\") final Path path,\n                               @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    public Path getPath() {\n        return this.path;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceOpenedEvent [path=\" + path + \", sessionInfo=\" + sessionInfo + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceRenamed.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class ResourceRenamed implements UberFireEvent,\n                                        ResourceChange {\n\n    private Path destinationPath;\n    private String message;\n\n    public ResourceRenamed(@MapsTo(\"destinationPath\") final Path destinationPath,\n                           @MapsTo(\"message\") final String message) {\n        this.destinationPath = checkNotNull(\"destinationPath\",\n                                            destinationPath);\n        this.message = message;\n    }\n\n    @Override\n    public ResourceChangeType getType() {\n        return ResourceChangeType.RENAME;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n\n    public Path getDestinationPath() {\n        return this.destinationPath;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceRenamedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been renamed\n */\n@Portable\npublic class ResourceRenamedEvent extends ResourceRenamed implements ResourceEvent {\n\n    private Path sourcePath;\n    private SessionInfo sessionInfo;\n\n    public ResourceRenamedEvent(@MapsTo(\"sourcePath\") final Path sourcePath,\n                                @MapsTo(\"destinationPath\") final Path destinationPath,\n                                @MapsTo(\"message\") final String message,\n                                @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(destinationPath,\n              message);\n        this.sourcePath = checkNotNull(\"sourcePath\",\n                                       sourcePath);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public Path getPath() {\n        return this.sourcePath;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceRenamedEvent [sourcePath=\" + sourcePath + \", sessionInfo=\" + sessionInfo + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceUpdated.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ResourceUpdated implements UberFireEvent,\n                                        ResourceChange {\n\n    private String message;\n\n    public ResourceUpdated(@MapsTo(\"message\") final String message) {\n        this.message = message;\n    }\n\n    @Override\n    public ResourceChangeType getType() {\n        return ResourceChangeType.UPDATE;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/ResourceUpdatedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An Event indicating a Resource has been updated\n */\n@Portable\npublic class ResourceUpdatedEvent extends ResourceUpdated implements ResourceEvent {\n\n    private Path path;\n    private SessionInfo sessionInfo;\n\n    public ResourceUpdatedEvent(@MapsTo(\"path\") final Path path,\n                                @MapsTo(\"message\") final String message,\n                                @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(message);\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n    }\n\n    @Override\n    public Path getPath() {\n        return this.path;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    @Override\n    public String toString() {\n        return \"ResourceUpdatedEvent [path=\" + path + \", sessionInfo=\" + sessionInfo + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/UberFireEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\n/**\n * Marker interface that serves to group all UberFire framework events\n * together. For example, this allows you to create a single CDI observer that\n * observes all framework events.\n */\npublic interface UberFireEvent {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/events/UberfireJSAPIReadyEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UberfireJSAPIReadyEvent {\n\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/ActivityResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.ResourceType;\n\n/**\n * An extension of the {@link ResourceType} interface holding an enumeration with the\n * different activity types subject to authorization management control.\n */\n@JsType\npublic enum ActivityResourceType implements ResourceType {\n\n    PERSPECTIVE,\n    SCREEN,\n    EDITOR,\n    CLIENT_EDITOR,\n    POPUP,\n    SPLASH;\n\n    @Override\n    public String getName() {\n        return this.toString().toLowerCase();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/AppFormerActivities.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.model;\n\nimport java.util.List;\n\n/**\n * Defines the list of entities used in the workbench\n * If no backend implementation for this class exists, a default one will be provided.\n */\npublic interface AppFormerActivities {\n\n    /**\n     * Returns list of all the editors IDs used in the workbench.\n     *\n     * @return List of all editors.\n     */\n    List<String> getAllEditorIds();\n\n    /**\n     * Returns list of all the perspectives used in the workbench.\n     *\n     * @return List of all perspectives.\n     */\n    List<String> getAllPerpectivesIds();\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/AppFormerActivitiesProducer.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.model;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\n@Startup(value = StartupType.BOOTSTRAP, priority = -1)\n@ApplicationScoped\npublic class AppFormerActivitiesProducer {\n\n    @Inject\n    private Instance<AppFormerActivities> appFormerActivities;\n\n    @Inject\n    @FallbackImplementation\n    private AppFormerActivities defaultAppFormerActivities;\n\n    @Produces\n    @Customizable\n    public AppFormerActivities appFormerActivitiesProducer() {\n        if (this.appFormerActivities.isUnsatisfied()) {\n            return defaultAppFormerActivities;\n        }\n        return this.appFormerActivities.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/CompassPosition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Positions to which a WorkbenchPanel can be added to the Workbench\n */\n@Portable\n@JsType\npublic enum CompassPosition implements Position {\n\n    NONE,\n    //Don't add anywhere\n    NORTH,\n    //North internal edge of a Parent panel\n    SOUTH,\n    //South internal edge of a Parent panel\n    EAST,\n    //East internal edge of a Parent panel\n    WEST,\n    //West internal edge of a Parent panel\n    SELF,\n    //Add to the Parent panel\n    ROOT,\n    //Add to the Workbench root\n    CENTER; // Add to the panel center\n\n    @Override\n    public String getName() {\n        return name();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/ContextDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * A Part in the Workbench. Parts are added to Panels.\n */\n@JsType\npublic interface ContextDefinition {\n\n    /**\n     * Get the PlaceRequest that this Part will contain.\n     * @return the place\n     */\n    public PlaceRequest getPlace();\n\n    /**\n     * Set the PlaceRequest that this Part will contain.\n     * @param place the place to set\n     */\n    public void setPlace(final PlaceRequest place);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/ContextDisplayMode.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@JsType\n@Portable\npublic enum ContextDisplayMode {\n    SHOW,\n    HIDE\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/CustomPanelDefinition.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport java.util.Optional;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * A custom {@link PanelDefinition} that is associated with a HasWidgets\n * or HTMLElement container. See {@link PlaceManager#goTo(PlaceRequest, HasWidgets)}\n * and {@link PlaceManager#goTo(PlaceRequest, HTMLElement)}\n */\n@JsType\npublic interface CustomPanelDefinition extends PanelDefinition {\n\n    /**\n     * Returns the HTMLElement container associated with the custom panel.\n     */\n    @JsIgnore\n    Optional<HTMLElement> getHtmlElementContainer();\n\n    /**\n     * Returns the HasWidgets container associated with the custom panel.\n     */\n    @JsIgnore\n    Optional<HasWidgets> getHasWidgetsContainer();\n\n    /**\n     * Returns the elemental2.dom.HTMLElement container associated with the custom panel.\n     */\n    @JsIgnore\n    Optional<elemental2.dom.HTMLElement> getElemental2HtmlElementContainer();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/DefaultAppFormerActivities.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.model;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.annotations.FallbackImplementation;\n\n/**\n * Default implementation for {@link AppFormerActivities}. To override it, just provide a default\n * CDI bean that implements {@link AppFormerActivities}.\n */\n@ApplicationScoped\n@FallbackImplementation\npublic class DefaultAppFormerActivities implements AppFormerActivities {\n\n    protected DefaultAppFormerActivities() {\n    }\n\n    @Override\n    public List<String> getAllEditorIds() {\n        return Arrays.asList();\n    }\n\n    @Override\n    public List<String> getAllPerpectivesIds() {\n        return Arrays.asList();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/NamedPosition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Represents the position of a child panel by name. For example, within a templated perspective, panels are positioned\n * by ErraiUI DataField names.\n * <p>\n * Positions that refer to the same field name compare equal to each other.\n * <p>\n * Instances of this class are immutable.\n */\n@Portable\npublic class NamedPosition implements Position {\n\n    /**\n     * Represents the root panel of any templated perspective.\n     */\n    public static final NamedPosition ROOT = new NamedPosition(\"\");\n\n    private final String fieldName;\n\n    /**\n     * Creates a new position representing the ErraiUI {@code @DataField} with the given name.\n     * If you are trying to refer to the root of the template itself, use {@link #ROOT}.\n     *\n     * @param fieldName the name of the data field. Must be non-null.\n     */\n    public NamedPosition(@MapsTo(\"fieldName\") String fieldName) {\n        this.fieldName = checkNotNull(\"fieldName\",\n                                      fieldName);\n    }\n\n    /**\n     * Returns the data field name this Position refers to.\n     *\n     * @return a non-null string. For the special {@link #ROOT} position constant, this is the empty string.\n     */\n    @Override\n    public String getName() {\n        return fieldName;\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + ((fieldName == null) ? 0 : fieldName.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        NamedPosition other = (NamedPosition) obj;\n        if (fieldName == null) {\n            if (other.fieldName != null) {\n                return false;\n            }\n        } else if (!fieldName.equals(other.fieldName)) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"NamedPosition{\" +\n                \"fieldName='\" + fieldName + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/Notification.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model;\n\nimport java.util.Date;\n\nimport org.jboss.errai.common.client.api.Assert;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.events.NotificationEvent.NotificationType;\n\n/**\n * Represents a notification that has been displayed in the UberFire workbench.\n * <p>\n * Instances of this class are normally created by the Workbench Notification Manager in response to a\n * {@link NotificationEvent} being fired as a CDI event.\n * @see NotificationEvent\n */\n@Portable\npublic class Notification {\n\n    private NotificationType type;\n    private String message;\n    private Date timestamp;\n    private State state;\n    public Notification(@MapsTo(\"type\") NotificationType type,\n                        @MapsTo(\"message\") String message,\n                        @MapsTo(\"timestamp\") Date timestamp,\n                        @MapsTo(\"state\") State state) {\n        this.type = Assert.notNull(type);\n        this.message = Assert.notNull(message);\n        this.timestamp = Assert.notNull(timestamp);\n        this.state = Assert.notNull(state);\n    }\n\n    public NotificationType getType() {\n        return type;\n    }\n\n    public void setType(NotificationType type) {\n        this.type = type;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n\n    public Date getTimestamp() {\n        return timestamp;\n    }\n\n    public void setTimestamp(Date timestamp) {\n        this.timestamp = timestamp;\n    }\n\n    public State getState() {\n        return state;\n    }\n\n    public void setState(State state) {\n        this.state = state;\n    }\n\n    @Override\n    public String toString() {\n        return \"Notification [type=\" + type + \", message=\" + message + \", timestamp=\" + timestamp + \", state=\" + state + \"]\";\n    }\n\n    public enum State {\n        /**\n         * The notification is newly created and has not yet been acknowledged by the user.\n         */\n        NEW,\n\n        /**\n         * The notification has been acknowledged by the user.\n         */\n        ACKNOWLEDGED\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/PanelDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n/**\n * Describes a physical region within a Workbench Perspective. Panels have a set physical size that they occupy, which\n * is divided up between any panel decorations (a tab bar or dropdown list is common), one or more Parts (generally\n * Editors or Screens), one of which can be visible at a time, and also child Panel Definitions, all of which are\n * visible simultaneously.\n */\n@JsType\npublic interface PanelDefinition {\n\n    /**\n     * Special value for {@link #getPanelType()}. When adding a new child panel to a parent panel, if the child panel\n     * has this type, the parent can create any type of PanelPresenter it likes. Typically, each panel type will have\n     * some constant default child type that it uses in this scenario.\n     */\n    String PARENT_CHOOSES_TYPE = \"PARENT_CHOOSES_TYPE\";\n\n    /**\n     * Returns the DOM ID that will be given to a panel created from this definition. If null, no ID attribute will be\n     * set on a panel created from this definition.\n     */\n    public String getElementId();\n\n    /**\n     * Specifies the DOM ID that should be given to the live panel's element. Applications are responsible for ensuring\n     * the ID values are unique among all live panels.\n     * @param id the DOM ID to give the panel when it is created. If null, no ID will be set on the panel.\n     */\n    public void setElementId(final String id);\n\n    /**\n     * Specifies content that should be put in this panel's main display area when it is materialized. The content to\n     * add is specified by a PartDefinition, at the core of which is a {@link PlaceRequest} that identifies a\n     * WorkbenchActivity (either a screen or an editor).\n     * <p>\n     * If the given part already belongs to an existing panel, it will be removed from that panel by a call to\n     * removePart(part).\n     * @param part The Part to add. Must not be null. The part's place must specify a WorkbenchActivity bean.\n     */\n    public void addPart(final PartDefinition part);\n\n    /**\n     * Specifies content that should be put in this panel's main display area when it is materialized.\n     * <p>\n     * This is a convenience method equivalent to\n     * <tt>addPart(new&nbsp;PartDefinitionImpl(DefaultPlaceRequest.parse(partSpec)))</tt>.\n     * @param partSpec An PlaceRequest ID with optional parameters, encoded as specified in\n     * {@link DefaultPlaceRequest#parse(CharSequence)}. Must not be null. The place ID must specify a\n     * WorkbenchActivity bean (either a screen or an editor).\n     * @return the PartDefinition object that was created and added to this panel definition.\n     */\n    @JsMethod(name = \"addPartById\")\n    public PartDefinition addPart(final String partSpec);\n\n    /**\n     * Removes the given part definition from this panel definition.\n     * @param part The Part to be removed\n     * @return true if the part was found and removed; false if it did not belong to this panel in the first place.\n     */\n    public boolean removePart(final PartDefinition part);\n\n    /**\n     * Get the Parts contained in the Panel\n     * @return The parts\n     */\n    public Set<PartDefinition> getParts();\n\n    /**\n     * Returns this panel's immediate child panels.\n     * @return a snapshot of the current child list. The list is not modifiable, and will not change as panels are added\n     * and removed from this panel. The returned list is never null.\n     */\n    public List<PanelDefinition> getChildren();\n\n    /**\n     * Insert a Panel as an immediate child at the given Position. If this\n     * Panel already has a child at the specified position the existing Panel at\n     * that position becomes a child of the Panel being added at the same\n     * Position.\n     * @param position The Position to add the child\n     * @param panel The child Panel\n     */\n    public void insertChild(final Position position,\n                            final PanelDefinition panel);\n\n    /**\n     * Append a Panel at the first empty child position. If this Panel already\n     * has a child at the specified position the descendants are followed until\n     * an empty position is found.\n     * @param position The Position to add the child\n     * @param panel The child Panel\n     */\n    @JsMethod(name = \"appendChildAtPosition\")\n    public void appendChild(final Position position,\n                            final PanelDefinition panel);\n\n    /**\n     * Append a Panel at the first empty child position. If this Panel already\n     * has a child at the specified position the descendants are followed until\n     * an empty position is found.\n     * @param panel The child Panel\n     */\n    public void appendChild(\n            final PanelDefinition panel);\n\n    /**\n     * Return the parent panel, or null if {@link #isRoot()}} returns true.\n     * @return a parent panel definition or null if at the top of the hierarchy\n     */\n    public PanelDefinition getParent();\n\n    /**\n     * Get the Panel's immediate child Panel at the given Position\n     * @param position The child Panel's Position\n     * @return The child Panel or null, if a child does not exist at the given\n     * Position\n     */\n    public PanelDefinition getChild(final Position position);\n\n    /**\n     * Remove a child from the Panel\n     * @param position\n     */\n    public void removeChild(final Position position);\n\n    /**\n     * Is this Panel the root of the Perspective definition\n     * @return True if the Panel is the root\n     */\n    public boolean isRoot();\n\n    /**\n     * Specifies the WorkbenchPanelPresenter implementation that should be used when adding this panel to the UI. Must\n     * refer to a Dependent-scoped Errai IOC bean type.\n     * @return fully-qualified class name of the WorkbenchPanelPresenter implementation to use. Must not be null, but\n     * may be the special value {@link #PARENT_CHOOSES_TYPE}.\n     */\n    public String getPanelType();\n\n    /**\n     * Specifies the WorkbenchPanelPresenter implementation that should be used when adding this panel to the UI. Must\n     * refer to a Dependent-scoped Errai IOC bean type.\n     * @param fqcn fully-qualified class name of the WorkbenchPanelPresenter implementation to use. Must not be null, but\n     * may be the special value {@link #PARENT_CHOOSES_TYPE}.\n     */\n    public void setPanelType(String fqcn);\n\n    /**\n     * Get the height of the Panel in pixels\n     * @return The height, or null if not set\n     */\n    @JsIgnore\n    public Integer getHeight();\n\n    /**\n     * Set the height of this panel in pixels using a primitive int to make this method exportable to JS.\n     * @param width The width to set.\n     */\n    default void setHeight(int height) {\n        setHeight(Integer.valueOf(height));\n    }\n\n    /**\n     * Get the height of this panel in pixels as a primitive int to make this method exportable to JS.\n     * @return The height, or -1 if not set.\n     */\n    default int getHeightAsInt() {\n        final Integer height = getHeight();\n        return (height != null) ? height : -1;\n    }\n\n    /**\n     * Set the height of this panel in pixels.\n     * @param height The height to set. If null, the existing height value is retained.\n     */\n    @JsIgnore\n    public void setHeight(Integer height);\n\n    /**\n     * Get the width of this panel in pixels.\n     * @return The width, or null if not set.\n     */\n    @JsIgnore\n    public Integer getWidth();\n\n    /**\n     * Set the width of this panel in pixels using a primitive int to make this method exportable to JS.\n     * @param width The width to set.\n     */\n    default void setWidth(int width) {\n        setWidth(Integer.valueOf(width));\n    }\n\n    /**\n     * Get the width of this panel in pixels as a primitive int to make this method exportable to JS.\n     * @return The width, or -1 if not set.\n     */\n    default int getWidthAsInt() {\n        final Integer width = getWidth();\n        return (width != null) ? width : -1;\n    }\n\n    /**\n     * Set the width of this panel in pixels.\n     * @param width The width to set. If null, the existing width value is retained.\n     */\n    @JsIgnore\n    public void setWidth(Integer width);\n\n    /**\n     * Get the minimum height of this panel in pixels.\n     * @return The minimum height, or null if not set.\n     */\n    @JsIgnore\n    public Integer getMinHeight();\n\n    /**\n     * Set the minimum height of the Panel in pixels\n     * @param minHeight The minimum height, or null if not set\n     */\n    @JsIgnore\n    public void setMinHeight(Integer minHeight);\n\n    /**\n     * Get the minimum width of this panel in pixels as a primitive int to make this method exportable to JS.\n     * @return The height, or -1 if not set.\n     */\n    default int getMinHeightAsInt() {\n        final Integer height = getMinHeight();\n        return (height != null) ? height : -1;\n    }\n\n    /**\n     * Get the minimum width of the Panel in pixels\n     * @return The minimum width, or null if not set\n     */\n    @JsIgnore\n    public Integer getMinWidth();\n\n    /**\n     * Set the minimum width of the Panel in pixels\n     * @param minWidth The width, or null if not set\n     */\n    @JsIgnore\n    public void setMinWidth(Integer minWidth);\n\n    /**\n     * Get the minimum width of this panel in pixels as a primitive int to make this method exportable to JS.\n     * @return The width, or -1 if not set.\n     */\n    default int getMinWidthAsInt() {\n        final Integer width = getMinWidth();\n        return (width != null) ? width : -1;\n    }\n\n    /**\n     * Get the Position of the Panel relate to it's Parent\n     * <p>\n     * TODO remove this. parent panels should track the positions of their children; making it a property of the child\n     * is error-prone when moving panels around in the UI.\n     * @return The Position of the Panel\n     */\n    public Position getPosition();\n\n    /**\n     * Set the Position of the Panel relative to it's parent.\n     * <p>\n     * TODO remove this. parent panels should track the positions of their children; making it a property of the child\n     * is error-prone when moving panels around in the UI.\n     * @param position The Position of the Panel relative to it's parent\n     */\n    public void setPosition(Position position);\n\n    /**\n     * Has the Panel been expanded to a maximum size\n     * @return true If maximized\n     */\n    public boolean isMaximized();\n\n    ContextDefinition getContextDefinition();\n\n    void setContextDefinition(final ContextDefinition contextDefinition);\n\n    ContextDisplayMode getContextDisplayMode();\n\n    void setContextDisplayMode(final ContextDisplayMode contextDisplayMode);\n\n    /**\n     * Invokes {@link #toString()} but exported to JavaScript so it can be invoked from different scripts.\n     */\n    default String asString() {\n        return this.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/PartDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Describes the assignment of a {@link PlaceRequest} to a tab/card/item in a {@link PanelDefinition}. Given this\n * information, you can find out (or dictate) which panel within the current perspective will contain the GUI element\n * for the given PlaceRequest. However, the {@link PartDefinition} does not contain any information about the GUI\n * itself, presumably because PartDefinition objects can be sent to the server. The UI (Widget) information is contained\n * with UIPart. The mapping of PartDefinitions to UIParts is maintained by a PanelManager.\n */\n@JsType\npublic interface PartDefinition {\n\n    PlaceRequest getPlace();\n\n    void setPlace(final PlaceRequest place);\n\n    PanelDefinition getParentPanel();\n\n    void setParentPanel(final PanelDefinition parentPanel);\n\n    ContextDefinition getContextDefinition();\n\n    void setContextDefinition(final ContextDefinition contextDefinition);\n\n    ContextDisplayMode getContextDisplayMode();\n\n    void setContextDisplayMode(final ContextDisplayMode contextDisplayMode);\n\n    /**\n     * Invokes {@link #toString()} but exported to JavaScript so it can be invoked from different scripts.\n     */\n    default String asString() {\n        return this.toString();\n    }\n\n    boolean isSelectable();\n\n    void setSelectable(boolean selectable);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/PerspectiveDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * Meta-data defining a Perspective. A Perspective is a set of Panels and Parts arranged within the Workbench. The\n * Workbench has exactly one active Perspective at a time. The Perspective contains multiple Panels. Each Panel contains\n * multiple Parts, one of which can be visible at a time. Panels can also contain child panels which are all visible at\n * the same time are are physically located within the bounds of the parent panel. Each Part is associated with one\n * PlaceRequest.\n * <p>\n * Implementations of this interface must be marked with Errai's {@code @Portable} annotation.\n */\n@JsType\npublic interface PerspectiveDefinition {\n\n    /**\n     * Get the name of the Perspective.\n     * @return The name of the Perspective.\n     */\n    public String getName();\n\n    /**\n     * Set the name of the Perspective.\n     * @param name The name of the Perspective.\n     */\n    public void setName(final String name);\n\n    /**\n     * Get the root Panel for this Perspective. The root Panel contains all\n     * child Panels. A Perspective is based on a single root Panel.\n     * @return The root Panel.\n     */\n    public PanelDefinition getRoot();\n\n    ContextDefinition getContextDefinition();\n\n    void setContextDefinition(final ContextDefinition contextDefinition);\n\n    ContextDisplayMode getContextDisplayMode();\n\n    void setContextDisplayMode(final ContextDisplayMode contextDisplayMode);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/Position.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model;\n\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Tells a PanelManager implementation where to place a part within a panel. Each PanelManager has its own layout\n * system, and implements its own unique set of Position objects (for example, the North-South-East-West panel manager\n * uses compass directions, and the Templated panel manager uses element names).\n * <p>\n * All implementations of this interface must be marked as {@link Portable}.\n */\n@JsType\npublic interface Position {\n\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/SplashScreenFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Describes the current interception rules for a splash screen, including the user's current preference for whether\n * or not the screen should be displayed next time one of its interception points is matched.\n * <p>\n * All implementations of this interface must be marked as {@link Portable}.\n */\npublic interface SplashScreenFilter {\n\n    String getName();\n\n    void setName(final String name);\n\n    boolean displayNextTime();\n\n    void setDisplayNextTime(final boolean value);\n\n    Collection<String> getInterceptionPoints();\n\n    void setInterceptionPoints(final Collection<String> places);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/bridge/Notification.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n *\n */\n\npackage org.uberfire.workbench.model.bridge;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = \"Object\")\npublic class Notification {\n\n    @JsProperty(name = \"path\")\n    public native void setPath(String path);\n\n    @JsProperty(name = \"path\")\n    public native String getPath();\n\n    @JsProperty(name = \"message\")\n    public native void setMessage(String message);\n\n    @JsProperty(name = \"message\")\n    public native String getMessage();\n\n    @JsProperty(name = \"severity\")\n    public native void setSeverity(String notificationSeverity);\n\n    @JsProperty(name = \"severity\")\n    public native String getSeverity();\n\n    @JsProperty(name = \"type\")\n    public native void setType(String type);\n\n    @JsProperty(name = \"type\")\n    public native String getType();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/bridge/NotificationSeverity.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n *\n */\n\npackage org.uberfire.workbench.model.bridge;\n\npublic class NotificationSeverity {\n\n    public static String INFO = \"INFO\";\n    public static String SUCCESS = \"SUCCESS\";\n    public static String ERROR = \"ERROR\";\n    public static String WARNING = \"WARNING\";\n    public static String HINT = \"HINT\";\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/bridge/NotificationType.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n *\n *\n */\n\npackage org.uberfire.workbench.model.bridge;\n\npublic class NotificationType {\n\n    public static String PROBLEM = \"PROBLEM\";\n    public static String ALERT = \"ALERT\";\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/ContextDefinitionImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.ContextDefinition;\n\n@Portable\npublic class ContextDefinitionImpl implements ContextDefinition {\n\n    private PlaceRequest place;\n\n    public ContextDefinitionImpl(@MapsTo(\"place\") final PlaceRequest place) {\n        this.place = place;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public void setPlace(final PlaceRequest place) {\n        this.place = place;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/CustomPanelDefinitionImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.impl;\n\nimport java.util.Optional;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.workbench.model.CustomPanelDefinition;\n\npublic class CustomPanelDefinitionImpl extends PanelDefinitionImpl implements CustomPanelDefinition {\n\n    private HTMLElement htmlElementContainer;\n    private HasWidgets hasWidgetsContainer;\n    private elemental2.dom.HTMLElement elemental2HtmlElementContainer;\n\n    public CustomPanelDefinitionImpl(String panelType,\n                                     HasWidgets hasWidgetsContainer) {\n\n        super(panelType);\n        this.hasWidgetsContainer = hasWidgetsContainer;\n    }\n\n    public CustomPanelDefinitionImpl(String panelType,\n                                     HTMLElement htmlElementContainer) {\n        super(panelType);\n        this.htmlElementContainer = htmlElementContainer;\n    }\n\n    public CustomPanelDefinitionImpl(String panelType,\n                                     elemental2.dom.HTMLElement htmlElementContainer){\n        super(panelType);\n        this.elemental2HtmlElementContainer = htmlElementContainer;\n    }\n\n    @Override\n    public Optional<HTMLElement> getHtmlElementContainer() {\n        return Optional.ofNullable(htmlElementContainer);\n    }\n\n    @Override\n    public Optional<HasWidgets> getHasWidgetsContainer() {\n        return Optional.ofNullable(hasWidgetsContainer);\n    }\n\n    @Override\n    public Optional<elemental2.dom.HTMLElement> getElemental2HtmlElementContainer() {\n        return Optional.ofNullable(elemental2HtmlElementContainer);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PanelDefinitionImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.ContextDisplayMode;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.workbench.model.ContextDisplayMode.SHOW;\n\n/**\n * Default implementation of PanelDefinition\n */\n@Portable\n@JsType\npublic class PanelDefinitionImpl implements PanelDefinition {\n\n    private final Set<PartDefinition> parts = new LinkedHashSet<>();\n    //Ideally this should be a Set but the order of insertion is important\n    private final List<PanelDefinition> children = new ArrayList<PanelDefinition>();\n    private Integer height = null;\n    private Integer width = null;\n    private Integer minHeight = null;\n    private Integer minWidth = null;\n    private String elementId;\n    private Position position;\n    private String panelType;\n    private boolean isRoot;\n    private ContextDefinition contextDefinition;\n    private ContextDisplayMode contextDisplayMode = SHOW;\n    private PanelDefinition parent = null;\n\n    @JsIgnore\n    public PanelDefinitionImpl() {\n        this(\"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\");\n    }\n\n    @JsIgnore\n    public PanelDefinitionImpl(final String type) {\n        this.panelType = type;\n    }\n\n    @Override\n    public PanelDefinition getParent() {\n        return parent;\n    }\n\n    public void setParent(PanelDefinition parent) {\n        if (this.parent != null && parent != null) {\n            throw new IllegalStateException(\"Can't change parent: this panel still belongs to \" + this.parent);\n        }\n        this.parent = parent;\n    }\n\n    @Override\n    public String getElementId() {\n        return elementId;\n    }\n\n    @Override\n    public void setElementId(String id) {\n        elementId = id;\n    }\n\n    @Override\n    public void addPart(final PartDefinition part) {\n        if (part.getParentPanel() != null) {\n            part.getParentPanel().removePart(part);\n        }\n        this.parts.add(part);\n        part.setParentPanel(this);\n    }\n\n    @Override\n    public PartDefinition addPart(String partSpec) {\n        PartDefinition pd = new PartDefinitionImpl(DefaultPlaceRequest.parse(partSpec));\n        addPart(pd);\n        return pd;\n    }\n\n    @Override\n    public boolean removePart(PartDefinition part) {\n        if (this.parts.remove(part)) {\n            part.setParentPanel(null);\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    @JsIgnore\n    public Set<PartDefinition> getParts() {\n        return parts;\n    }\n\n    @Override\n    @JsIgnore\n    public List<PanelDefinition> getChildren() {\n        return Collections.unmodifiableList(new ArrayList<PanelDefinition>(children));\n    }\n\n    @Override\n    public void insertChild(final Position position,\n                            final PanelDefinition panel) {\n        if (panel == null) {\n            return;\n        }\n        if (children.contains(panel)) {\n            return;\n        }\n\n        // parent wiring\n        ((PanelDefinitionImpl) panel).setParent(this);\n\n        checkPosition(position);\n        panel.setPosition(position);\n        final PanelDefinition existingChild = getChild(position);\n        if (existingChild == null) {\n            children.add(panel);\n        } else {\n            removeChild(position);\n            children.add(panel);\n            panel.insertChild(position,\n                              existingChild);\n        }\n    }\n\n    @Override\n    public void appendChild(final Position position,\n                            final PanelDefinition panel) {\n\n        if (panel == null) {\n            return;\n        }\n        if (children.contains(panel)) {\n            return;\n        }\n        checkPosition(position);\n        panel.setPosition(position);\n        final PanelDefinition existingChild = getChild(position);\n        if (existingChild == null) {\n\n            // parent wiring\n            ((PanelDefinitionImpl) panel).setParent(this);\n\n            children.add(panel);\n        } else {\n            existingChild.appendChild(position,\n                                      panel);\n        }\n    }\n\n    @Override\n    public void appendChild(final PanelDefinition panel) {\n\n        if (panel == null) {\n            return;\n        }\n        if (children.contains(panel)) {\n            return;\n        }\n\n        // parent wiring\n        ((PanelDefinitionImpl) panel).setParent(this);\n\n        children.add(panel);\n    }\n\n    @Override\n    public PanelDefinition getChild(final Position position) {\n        for (PanelDefinition child : children) {\n            if (child.getPosition() == position) {\n                return child;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public void removeChild(final Position position) {\n        Iterator<PanelDefinition> itr = children.iterator();\n        while (itr.hasNext()) {\n            final PanelDefinition child = itr.next();\n            if (child.getPosition() == position) {\n                // parent wiring\n                ((PanelDefinitionImpl) child).setParent(null);\n\n                itr.remove();\n            }\n        }\n    }\n\n    @Override\n    public boolean isRoot() {\n        return isRoot;\n    }\n\n    public void setRoot(boolean isRoot) {\n        this.isRoot = isRoot;\n    }\n\n    @Override\n    public String getPanelType() {\n        return panelType;\n    }\n\n    @Override\n    public void setPanelType(String fqcn) {\n        this.panelType = checkNotNull(\"fqcn\",\n                                      fqcn);\n    }\n\n    @Override\n    @JsIgnore\n    public Integer getHeight() {\n        return height;\n    }\n\n    @Override\n    @JsIgnore\n    public void setHeight(Integer height) {\n        if (height != null) {\n            this.height = height;\n        }\n    }\n\n    @Override\n    @JsIgnore\n    public Integer getWidth() {\n        return width;\n    }\n\n    @Override\n    @JsIgnore\n    public void setWidth(Integer width) {\n        if (width != null) {\n            this.width = width;\n        }\n    }\n\n    @Override\n    @JsIgnore\n    public final Integer getMinHeight() {\n        return minHeight;\n    }\n\n    @Override\n    @JsIgnore\n    public final void setMinHeight(Integer minHeight) {\n        this.minHeight = minHeight;\n    }\n\n    @Override\n    @JsIgnore\n    public final Integer getMinWidth() {\n        return minWidth;\n    }\n\n    @Override\n    @JsIgnore\n    public final void setMinWidth(Integer minWidth) {\n        this.minWidth = minWidth;\n    }\n\n    @Override\n    public final Position getPosition() {\n        return position;\n    }\n\n    @Override\n    public void setPosition(final Position position) {\n        this.position = position;\n    }\n\n    @Override\n    public boolean isMaximized() {\n        return false;\n    }\n\n    @Override\n    public ContextDefinition getContextDefinition() {\n        return contextDefinition;\n    }\n\n    @Override\n    public void setContextDefinition(final ContextDefinition contextDefinition) {\n        this.contextDefinition = contextDefinition;\n    }\n\n    @Override\n    public ContextDisplayMode getContextDisplayMode() {\n        return contextDisplayMode;\n    }\n\n    @Override\n    public void setContextDisplayMode(final ContextDisplayMode contextDisplayMode) {\n        this.contextDisplayMode = contextDisplayMode;\n    }\n\n    private void checkPosition(final Position position) {\n        if (position == CompassPosition.ROOT || position == CompassPosition.SELF || position == CompassPosition.NONE) {\n            throw new IllegalArgumentException(\"Position must be NORTH, SOUTH, EAST or WEST\");\n        }\n    }\n\n    @Override\n    public String toString() {\n        String fullName = getClass().getName();\n        String simpleName = fullName.substring(fullName.lastIndexOf('.') + 1);\n        return simpleName + \" [id=\" + elementId + \", parts=\" + parts + \", children=\" + children + \", panelType=\" + panelType\n                + \", contextDefinition=\" + contextDefinition + \", contextDisplayMode=\" + contextDisplayMode + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PartDefinitionImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.impl;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.ContextDisplayMode;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.uberfire.workbench.model.ContextDisplayMode.SHOW;\n\n/**\n * Default implementation of PartDefinition\n */\n@Portable\npublic class PartDefinitionImpl\n        implements\n        PartDefinition {\n\n    private PlaceRequest place;\n\n    private PanelDefinition parentPanel;\n\n    private ContextDefinition contextDefinition;\n    private ContextDisplayMode contextDisplayMode = SHOW;\n\n    private boolean selectable = true;\n\n    public PartDefinitionImpl() {\n    }\n\n    public PartDefinitionImpl(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    /**\n     * @return the place\n     */\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    /**\n     * @param place the place to set\n     */\n    @Override\n    public void setPlace(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    /**\n     * @return the parentPanel\n     */\n    @Override\n    public PanelDefinition getParentPanel() {\n        return parentPanel;\n    }\n\n    /**\n     * @param parentPanel the parentPanel to set\n     */\n    @Override\n    public void setParentPanel(final PanelDefinition parentPanel) {\n        if (parentPanel != null && this.parentPanel != null) {\n            throw new IllegalStateException(\"Can't set parent: this part already belongs to \" + this.parentPanel);\n        }\n        this.parentPanel = parentPanel;\n    }\n\n    @Override\n    public ContextDefinition getContextDefinition() {\n        return contextDefinition;\n    }\n\n    @Override\n    public void setContextDefinition(final ContextDefinition contextDefinition) {\n        this.contextDefinition = contextDefinition;\n    }\n\n    @Override\n    public ContextDisplayMode getContextDisplayMode() {\n        return contextDisplayMode;\n    }\n\n    @Override\n    public void setContextDisplayMode(final ContextDisplayMode contextDisplayMode) {\n        this.contextDisplayMode = contextDisplayMode;\n    }\n\n    @Override\n    public boolean isSelectable() {\n        return this.selectable;\n    }\n\n    @Override\n    public void setSelectable(final boolean selectable) {\n        this.selectable = selectable;\n    }\n\n    @Override\n    public int hashCode() {\n        return this.place.hashCode();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null) {\n            return false;\n        }\n        if (!(o instanceof PartDefinitionImpl)) {\n            return false;\n        }\n\n        PartDefinitionImpl that = (PartDefinitionImpl) o;\n\n        return place.equals(that.place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PartDefinitionImpl [place=\" + place + \"]\";\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/PerspectiveDefinitionImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.impl;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.ContextDisplayMode;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.workbench.model.ContextDisplayMode.SHOW;\n\n/**\n * Default implementation of PerspectiveDefinition\n */\n@Portable\npublic class PerspectiveDefinitionImpl\n        implements\n        PerspectiveDefinition {\n\n    private final PanelDefinition root;\n    private String name;\n    private ContextDefinition contextDefinition;\n    private ContextDisplayMode contextDisplayMode = SHOW;\n\n    public PerspectiveDefinitionImpl() {\n        this(\"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\");\n    }\n\n    public PerspectiveDefinitionImpl(final String panelType) {\n        checkNotNull(\"type\",\n                     panelType);\n        PanelDefinitionImpl root = new PanelDefinitionImpl(panelType);\n        root.setRoot(true);\n        this.root = root;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public void setName(final String name) {\n        this.name = name;\n    }\n\n    @Override\n    public PanelDefinition getRoot() {\n        return root;\n    }\n\n    @Override\n    public ContextDefinition getContextDefinition() {\n        return contextDefinition;\n    }\n\n    @Override\n    public void setContextDefinition(final ContextDefinition contextDefinition) {\n        this.contextDefinition = contextDefinition;\n    }\n\n    @Override\n    public ContextDisplayMode getContextDisplayMode() {\n        return contextDisplayMode;\n    }\n\n    @Override\n    public void setContextDisplayMode(final ContextDisplayMode contextDisplayMode) {\n        this.contextDisplayMode = contextDisplayMode;\n    }\n\n    @Override\n    public String toString() {\n        return \"PerspectiveDefinitionImpl [name=\" + name + \", contextDefinition=\" + contextDefinition\n                + \", contextDisplayMode=\" + contextDisplayMode + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/impl/SplashScreenFilterImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n/**\n * Default implementation of SplashScreenFilter\n */\n@Portable\npublic class SplashScreenFilterImpl implements SplashScreenFilter {\n\n    private String name;\n    private boolean displayNextTime;\n    private Collection<String> interceptionPoints = new ArrayList<String>();\n\n    public SplashScreenFilterImpl(@MapsTo(\"name\") final String name,\n                                  @MapsTo(\"displayNextTime\") final boolean displayNextTime,\n                                  @MapsTo(\"interceptionPoints\") final Collection<String> interceptionPoints) {\n        this.name = name;\n        this.displayNextTime = displayNextTime;\n        this.interceptionPoints.addAll(interceptionPoints);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public void setName(final String name) {\n        this.name = name;\n    }\n\n    @Override\n    public boolean displayNextTime() {\n        return displayNextTime;\n    }\n\n    @Override\n    public void setDisplayNextTime(final boolean value) {\n        this.displayNextTime = value;\n    }\n\n    @Override\n    public Collection<String> getInterceptionPoints() {\n        return interceptionPoints;\n    }\n\n    @Override\n    public void setInterceptionPoints(final Collection<String> places) {\n        interceptionPoints.clear();\n        interceptionPoints.addAll(places);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/EnabledStateChangeListener.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsFunction;\n\n/**\n * A Listener for changes in a Widget's enabled state\n */\n@JsFunction\npublic interface EnabledStateChangeListener {\n\n    /**\n     * Called when the enabled state of a Widget changes\n     * @param enabled\n     */\n    void enabledStateChanged(final boolean enabled);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/HasEnabledStateChangeListeners.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * A source of EnabledStateChange actions.\n */\n@JsType\npublic interface HasEnabledStateChangeListeners {\n\n    /**\n     * Called when the enabled state of a Widget changes\n     * @param listener\n     */\n    void addEnabledStateChangeListener(final EnabledStateChangeListener listener);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuCustom.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * A menu item that provides its own widget.\n * @param <T> The type of widget the custom menu item provides.\n */\n@JsType\npublic interface MenuCustom<T>\n        extends MenuItem {\n\n    T build();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport java.util.List;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.menu.impl.MenuBuilderImpl;\n\nimport static org.uberfire.workbench.model.menu.impl.MenuBuilderImpl.MenuType.CONTRIBUTED;\nimport static org.uberfire.workbench.model.menu.impl.MenuBuilderImpl.MenuType.CUSTOM;\nimport static org.uberfire.workbench.model.menu.impl.MenuBuilderImpl.MenuType.REGULAR;\nimport static org.uberfire.workbench.model.menu.impl.MenuBuilderImpl.MenuType.TOP_LEVEL;\n\npublic final class MenuFactory {\n\n    private MenuFactory() {\n    }\n\n    public static MenuBuilder<TopLevelMenusBuilder<MenuBuilder>> newTopLevelMenu(final String caption) {\n        return new MenuBuilderImpl(TOP_LEVEL,\n                                   caption);\n    }\n\n    public static ContributedMenuBuilder<TopLevelMenusBuilder<MenuBuilder>> newContributedMenu(final String caption) {\n        return new MenuBuilderImpl(CONTRIBUTED,\n                                   caption);\n    }\n\n    public static MenuBuilder<Builder> newSimpleItem(final String caption) {\n        return new MenuBuilderImpl(REGULAR,\n                                   caption);\n    }\n\n    public static MenuBuilder<TopLevelMenusBuilder<MenuBuilder>> newTopLevelCustomMenu(final CustomMenuBuilder builder) {\n        return new MenuBuilderImpl(CUSTOM,\n                                   builder);\n    }\n\n    public interface TopLevelMenusBuilder<T>\n            extends Builder {\n\n        ContributedMenuBuilder<TopLevelMenusBuilder<T>> newContributedMenu(final String caption);\n\n        TerminalMenu<TopLevelMenusBuilder<T>> newTopLevelMenu(final MenuItem menu);\n\n        MenuBuilder<TopLevelMenusBuilder<T>> newTopLevelMenu(final String caption);\n\n        TerminalCustomMenu<TopLevelMenusBuilder<T>> newTopLevelCustomMenu(final CustomMenuBuilder builder);\n    }\n\n    public interface Builder {\n\n        Menus build();\n    }\n\n    public interface ContributedMenuBuilder<T> extends MenuBuilder<T> {\n\n        ContributedMenuBuilder<T> contributeTo(final String contributionPoint);\n    }\n\n    public interface MenuBuilder<T>\n            extends SimpleMenuBuilder<MenuBuilder<T>>,\n                    SecurityInfos<MenuBuilder<T>>,\n                    CommandMenu<MenuBuilder<T>>,\n                    PerspectiveMenu<MenuBuilder<T>>,\n                    OrderedMenu<MenuBuilder<T>> {\n\n        TerminalMenu<T> custom(final CustomMenuBuilder builder);\n\n        SubMenusBuilder<SubMenuBuilder<T>> submenu(final String caption);\n\n        SubMenusBuilder<SubMenuBuilder<T>> menus();\n\n        TerminalMenu<T> withItems(final List<? extends MenuItem> items);\n\n        T endMenu();\n    }\n\n    public interface SubMenuBuilder<T>\n            extends SimpleMenuBuilder<MenuBuilder<T>>,\n                    SecurityInfos<MenuBuilder<T>> {\n\n        SubMenusBuilder<SubMenuBuilder<T>> submenu(final String caption);\n\n        T endMenu();\n    }\n\n    public interface SimpleMenuBuilder<T> {\n\n        T identifier(final String id);\n\n        T order(final int order);\n\n        T position(final MenuPosition position);\n    }\n\n    public interface SubMenusBuilder<T> {\n\n        MenuBuilder<SubMenusBuilder<T>> menu(final String caption);\n\n        T endMenus();\n    }\n\n    public interface TerminalMenu<T> {\n\n        T endMenu();\n    }\n\n    public interface TerminalCustomMenu<T> {\n\n        T endMenu();\n    }\n\n    public interface SecurityInfos<T> {\n\n        T withPermission(final ResourceType resourceType);\n\n        T withPermission(final ResourceType resourceType,\n                         final ResourceAction resourceAction);\n\n        T withPermission(final ResourceType resourceType,\n                         final Resource resource,\n                         final ResourceAction resourceAction);\n\n        T withPermission(final Resource resource);\n\n        T withPermission(final Resource resource,\n                         final ResourceAction resourceAction);\n\n        T withPermission(final String resourceId,\n                         final ResourceType resourceType);\n\n        T withPermission(final String resourceId,\n                         final ResourceType resourceType,\n                         final ResourceAction resourceAction);\n\n        T withPermission(final String permission);\n    }\n\n    public interface CustomMenuBuilder {\n\n        void push(final CustomMenuBuilder element);\n\n        MenuItem build();\n    }\n\n    public interface CommandMenu<T> {\n\n        T respondsWith(final Command command);\n    }\n\n    public interface PerspectiveMenu<T> {\n\n        T perspective(final String identifier);\n\n        T place(final PlaceRequest placeRequest);\n    }\n\n    public interface OrderedMenu<T> {\n\n        T orderAll(final int order);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuGroup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport java.util.List;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * A menu item that has child items nested under it.\n */\n@JsType\npublic interface MenuGroup\n        extends MenuItem {\n\n    List<MenuItem> getItems();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.menu;\n\nimport java.util.Collections;\nimport java.util.List;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.authz.ResourceActionRef;\nimport org.uberfire.security.authz.RuntimeFeatureResource;\n\n/**\n * Meta-data for a Workbench MenuItem including permissions. The default is that\n * all users have permission to access a MenuItem and that it is enabled.\n */\n@JsType\npublic interface MenuItem extends RuntimeFeatureResource,\n                                  HasEnabledStateChangeListeners {\n\n    boolean isEnabled();\n\n    void setEnabled(boolean enabled);\n\n    String getContributionPoint();\n\n    String getCaption();\n\n    MenuPosition getPosition();\n\n    int getOrder();\n\n    /**\n     * Get the list of {@link ResourceActionRef} actions this menu item is\n     * restricted to.\n     * <p>\n     * <p>\n     * The menu item will be available provided all the given actions are\n     * authorized within the current context.\n     * </p>\n     */\n    default List<ResourceActionRef> getResourceActions() {\n        return Collections.emptyList();\n    }\n\n    /**\n     * Get the list of permission names this menu item is restricted to.\n     * <p>\n     * <p>\n     * The menu item will be available provided all the given permissions are\n     * authorized within the current context.\n     * </p>\n     */\n    default List<String> getPermissions() {\n        return Collections.emptyList();\n    }\n\n    /**\n     * Causes the given {@link MenuVisitor} to visit this menu item and its\n     * children.\n     */\n    void accept(MenuVisitor visitor);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuItemCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.Command;\n\n/**\n * A menu item that invokes a particular {@link Command} when it is clicked.\n */\n@JsType\npublic interface MenuItemCommand\n        extends MenuItem {\n\n    /**\n     * @return the command\n     */\n    public Command getCommand();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuItemPerspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * A menu item that invokes a particular {@link org.uberfire.workbench.model.PerspectiveDefinition} when it is clicked.\n */\n@JsType\npublic interface MenuItemPerspective extends MenuItem {\n\n    PlaceRequest getPlaceRequest();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuItemPlain.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.Command;\n\n/**\n * A menu item that has no children and no specific {@link Command} associated with it.\n */\n@JsType\npublic interface MenuItemPlain extends MenuItem {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuPosition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * Defines the menu position on the navbar.\n */\n@JsType\npublic enum MenuPosition {\n    LEFT,\n    RIGHT\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/MenuVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsType;\n\n/**\n * Visitor interface for implementing arbitrary operations over menus. For example, a visitor could filter a menu tree\n * for items that the current user has permission to see; it could build widgets in a particular view module; it could\n * simply dump the menu structure to a string.\n */\n@JsType\npublic interface MenuVisitor {\n\n    /**\n     * Visits the top-level menu container. This is the first method invoked when visiting a complete menu tree.\n     * @param menus the top-level container of the menus that will be visited.\n     * @return true if the visitor would like to continue down the tree and visit all children; false if it wants to\n     * skip this node. Since this is the root node, returning false from this call will result in no more calls\n     * to the visitor.\n     */\n    boolean visitEnter(Menus menus);\n\n    /**\n     * Ends the visit of the top-level menu container. This is the last method invoked when visiting a complete menu tree.\n     * <p>\n     * <i>Note that this method is not called if {@link #visitEnter(Menus)} returns false.</i>\n     * @param menus the top-level container of the menus that will be visited.\n     */\n    void visitLeave(Menus menus);\n\n    /**\n     * Visits a menu group in the tree of menus. A menu group has zero or more MenuItem children.\n     * @param menuGroup the menu group to visit.\n     * @return true if the visitor would like to visit all children of this node; false if it wants to skip this node. A\n     * visitor that returns false from this node will not receive any further calls for this node or its\n     * descendants. In particular, there will be no corresponding {@link #visitLeave(MenuGroup)} call for this\n     * node.\n     */\n    @JsMethod(name = \"visitEnterGroup\")\n    boolean visitEnter(MenuGroup menuGroup);\n\n    /**\n     * Visits a menu group in the tree of menus. All descendants of the given menu group have been visited before this method is called.\n     * <p>\n     * <i>Note that this method is not called for a MenuGroup where the {@link #visitEnter(MenuGroup)} method returned false.</i>\n     * @param menuGroup the menu group to leave.\n     */\n    @JsMethod(name = \"visitLeaveGroup\")\n    void visitLeave(MenuGroup menuGroup);\n\n    /**\n     * Visits a plain menu item in the tree.\n     * @param menuItemPlain the plain menu item to visit.\n     */\n    void visit(MenuItemPlain menuItemPlain);\n\n    /**\n     * Visits a menu item that has an associated command.\n     * @param menuItemCommand the command menu item to visit.\n     */\n    @JsMethod(name = \"visitCommand\")\n    void visit(MenuItemCommand menuItemCommand);\n\n    /**\n     * Visits a menu item that has an associated perspective.\n     * @param menuItemPerspective the command menu item to visit.\n     */\n    @JsMethod(name = \"visitPerspective\")\n    void visit(MenuItemPerspective menuItemPerspective);\n\n    /**\n     * Visits a custom menu item in the menu tree.\n     * @param menuCustom the custom (application provides the widget) menu item to visit.\n     */\n    @JsMethod(name = \"visitCustom\")\n    void visit(MenuCustom<?> menuCustom);\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/Menus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.menu;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport jsinterop.annotations.JsType;\n\n/**\n * Menus that includes permission\n */\n@JsType\npublic interface Menus {\n\n    /**\n     * Returns the items in this collection of menus, in the order they should appear in the user interface.\n     */\n    public List<MenuItem> getItems();\n\n    @Deprecated\n    public Map<Object, MenuItem> getItemsMap();\n\n    /**\n     * Causes the given {@link MenuVisitor} to visit this menu, then each item in turn (they will pass the visitor to\n     * their descendants). The menu items will be visited via an pre-order traversal (parents are visited before their\n     * children). Top-level menu items are visited in the same order as they are returned from {@link #getItems()}.\n     */\n    public void accept(MenuVisitor visitor);\n\n    /**\n     * Defines the order on what these menus will be inserted.\n     */\n    public int getOrder();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/impl/BaseMenuCustom.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\n\npublic abstract class BaseMenuCustom<T> implements MenuCustom<T> {\n\n    private final String contributionPoint;\n    private final String caption;\n    private final MenuPosition position;\n    private boolean enabled;\n\n    protected BaseMenuCustom() {\n        this(null,\n             null,\n             null,\n             true);\n    }\n\n    protected BaseMenuCustom(boolean enabled) {\n        this(null,\n             null,\n             null,\n             enabled);\n    }\n\n    protected BaseMenuCustom(final String contributionPoint) {\n        this(contributionPoint,\n             null,\n             null,\n             true);\n    }\n\n    protected BaseMenuCustom(final String contributionPoint,\n                             final String caption) {\n        this(contributionPoint,\n             caption,\n             null,\n             true);\n    }\n\n    public BaseMenuCustom(final String contributionPoint,\n                          final String caption,\n                          final MenuPosition position) {\n        this(contributionPoint,\n             caption,\n             position,\n             true);\n    }\n\n    public BaseMenuCustom(final String contributionPoint,\n                          final String caption,\n                          final MenuPosition position,\n                          final boolean enabled) {\n        this.contributionPoint = contributionPoint;\n        this.caption = caption;\n        this.position = position;\n        this.enabled = enabled;\n    }\n\n    @Override\n    public String getIdentifier() {\n        if (contributionPoint != null) {\n            return getClass().getName() + \"#\" + contributionPoint + \"#\" + caption;\n        }\n        return getClass().getName() + \"#\" + caption;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        this.enabled = enabled;\n    }\n\n    @Override\n    public String getContributionPoint() {\n        return contributionPoint;\n    }\n\n    @Override\n    public String getCaption() {\n        return caption;\n    }\n\n    @Override\n    public MenuPosition getPosition() {\n        return position;\n    }\n\n    @Override\n    public int getOrder() {\n        return 0;\n    }\n\n    @Override\n    public void accept(final MenuVisitor visitor) {\n        visitor.visit(this);\n    }\n\n    @Override\n    public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/impl/BaseMenuVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic abstract class BaseMenuVisitor implements MenuVisitor {\n\n    @Override\n    public boolean visitEnter(Menus menus) {\n        return true;\n    }\n\n    @Override\n    public void visitLeave(Menus menus) {\n\n    }\n\n    @Override\n    public boolean visitEnter(MenuGroup menuGroup) {\n        return true;\n    }\n\n    @Override\n    public void visitLeave(MenuGroup menuGroup) {\n\n    }\n\n    @Override\n    public void visit(MenuItemPlain menuItemPlain) {\n\n    }\n\n    @Override\n    public void visit(MenuItemCommand menuItemCommand) {\n\n    }\n\n    @Override\n    public void visit(MenuItemPerspective menuItemPerspective) {\n\n    }\n\n    @Override\n    public void visit(MenuCustom<?> menuCustom) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/impl/DefaultMenuGroup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.ResourceActionRef;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\n\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n@JsType\npublic class DefaultMenuGroup implements MenuGroup {\n\n    private final List<EnabledStateChangeListener> enabledStateChangeListeners = new ArrayList<EnabledStateChangeListener>();\n    private final List menuItems;\n    private final String contributionPoint;\n    private final String caption;\n    private final MenuPosition position;\n    private final int order;\n    private boolean isEnabled = true;\n    private List<ResourceActionRef> resourceActionRefs;\n    private List<String> permissionNames;\n\n    @JsIgnore\n    public DefaultMenuGroup(List<MenuItem> menuItems,\n                            List<ResourceActionRef> resourceActionRefs,\n                            List<String> permissionNames,\n                            String contributionPoint,\n                            String caption,\n                            MenuPosition position,\n                            int order) {\n        this.menuItems = menuItems;\n        this.resourceActionRefs = resourceActionRefs;\n        this.permissionNames = permissionNames;\n        this.contributionPoint = contributionPoint;\n        this.caption = caption;\n        this.position = position;\n        this.order = order;\n    }\n\n    @JsIgnore\n    @Override\n    public List<MenuItem> getItems() {\n        return menuItems;\n    }\n\n    @Override\n    public String getContributionPoint() {\n        return contributionPoint;\n    }\n\n    @Override\n    public String getCaption() {\n        return caption;\n    }\n\n    @Override\n    public MenuPosition getPosition() {\n        return position;\n    }\n\n    @Override\n    public int getOrder() {\n        return order;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return isEnabled;\n    }\n\n    @Override\n    public void setEnabled(final boolean enabled) {\n        this.isEnabled = enabled;\n        notifyListeners(enabled);\n    }\n\n    @JsIgnore\n    @Override\n    public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n        enabledStateChangeListeners.add(listener);\n    }\n\n    @Override\n    public void accept(MenuVisitor visitor) {\n        if (visitor.visitEnter(this)) {\n            for (MenuItem child : ensureIterable(getItems())) {\n                child.accept(visitor);\n            }\n            visitor.visitLeave(this);\n        }\n    }\n\n    private void notifyListeners(final boolean enabled) {\n        for (final EnabledStateChangeListener listener : enabledStateChangeListeners) {\n            listener.enabledStateChanged(enabled);\n        }\n    }\n\n    @Override\n    public String getIdentifier() {\n        if (contributionPoint != null) {\n            return getClass().getName() + \"#\" + contributionPoint + \"#\" + caption;\n        }\n        return getClass().getName() + \"#\" + caption;\n    }\n\n    @JsIgnore\n    @Override\n    public List<ResourceActionRef> getResourceActions() {\n        return resourceActionRefs;\n    }\n\n    @JsIgnore\n    @Override\n    public List<String> getPermissions() {\n        return permissionNames;\n    }\n\n    @JsIgnore\n    @Override\n    public List<Resource> getDependencies() {\n        return menuItems;\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/impl/DefaultMenus.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@JsType\npublic class DefaultMenus implements Menus {\n\n    private final List<MenuItem> menuItems;\n    private final int order;\n\n    @JsIgnore\n    public DefaultMenus(List<MenuItem> menuItems,\n                        int order) {\n        this.menuItems = menuItems;\n        this.order = order;\n    }\n\n    @JsIgnore\n    @Override\n    public List<MenuItem> getItems() {\n        return Collections.unmodifiableList(menuItems);\n    }\n\n    @Override\n    public void accept(MenuVisitor visitor) {\n        if (visitor.visitEnter(this)) {\n            for (MenuItem item : menuItems) {\n                item.accept(visitor);\n            }\n            visitor.visitLeave(this);\n        }\n    }\n\n    @JsIgnore\n    @Override\n    public Map<Object, MenuItem> getItemsMap() {\n        return new HashMap<Object, MenuItem>() {\n\n            {\n                for (final MenuItem menuItem : menuItems) {\n                    put(menuItem,\n                        menuItem);\n                }\n            }\n        };\n    }\n\n    @Override\n    public int getOrder() {\n        return order;\n    }\n}"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/menu/impl/MenuBuilderImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Stack;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.ResourceActionRef;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n *\n */\npublic final class MenuBuilderImpl\n        implements MenuFactory.MenuBuilder,\n                   MenuFactory.ContributedMenuBuilder,\n                   MenuFactory.TopLevelMenusBuilder,\n                   MenuFactory.SubMenuBuilder,\n                   MenuFactory.SubMenusBuilder,\n                   MenuFactory.TerminalMenu,\n                   MenuFactory.TerminalCustomMenu {\n\n    final List<MenuItem> menuItems = new ArrayList<MenuItem>();\n    final Stack<MenuFactory.CustomMenuBuilder> context = new Stack<MenuFactory.CustomMenuBuilder>();\n    int order = 0;\n\n    public MenuBuilderImpl(final MenuType menuType,\n                           final String caption) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.caption = checkNotEmpty(\"caption\",\n                                               caption);\n        currentContext.menuType = checkNotNull(\"menuType\",\n                                               menuType);\n        context.push(currentContext);\n    }\n\n    public MenuBuilderImpl(final MenuType menuType,\n                           final MenuFactory.CustomMenuBuilder builder) {\n        context.push(builder);\n    }\n\n    @Override\n    public MenuBuilderImpl newContributedMenu(final String caption) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.caption = checkNotEmpty(\"caption\",\n                                               caption);\n        currentContext.menuType = MenuType.CONTRIBUTED;\n        context.push(currentContext);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl newTopLevelMenu(final MenuItem menu) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.menu = checkNotNull(\"menu\",\n                                           menu);\n        context.push(currentContext);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl newTopLevelMenu(final String caption) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.caption = checkNotEmpty(\"caption\",\n                                               caption);\n        currentContext.menuType = MenuType.TOP_LEVEL;\n        context.push(currentContext);\n\n        return this;\n    }\n\n    @Override\n    public MenuFactory.TerminalCustomMenu newTopLevelCustomMenu(final MenuFactory.CustomMenuBuilder builder) {\n        context.push(builder);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl menu(final String caption) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.caption = checkNotEmpty(\"caption\",\n                                               caption);\n        currentContext.menuType = MenuType.REGULAR;\n        context.push(currentContext);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl menus() {\n        ((CurrentContext) context.peek()).menuType = MenuType.GROUP;\n        return this;\n    }\n\n    @Override\n    public MenuFactory.TerminalMenu custom(MenuFactory.CustomMenuBuilder builder) {\n        context.push(builder);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl submenu(final String caption) {\n        final CurrentContext currentContext = new CurrentContext();\n        currentContext.caption = checkNotEmpty(\"caption\",\n                                               caption);\n        currentContext.menuType = MenuType.GROUP;\n        context.push(currentContext);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl contributeTo(final String contributionPoint) {\n        ((CurrentContext) context.peek()).contributionPoint = checkNotEmpty(\"contributionPoint\",\n                                                                            contributionPoint);\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withItems(final List items) {\n        ((CurrentContext) context.peek()).menuItems = new ArrayList<MenuItem>(checkNotEmpty(\"items\",\n                                                                                            items));\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl respondsWith(final Command command) {\n        ((CurrentContext) context.peek()).command = checkNotNull(\"command\",\n                                                                 command);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl perspective(final String identifier) {\n        checkNotNull(\"perspective\",\n                     identifier);\n        ((CurrentContext) context.peek()).placeRequest = new DefaultPlaceRequest(identifier);\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl place(final PlaceRequest place) {\n        ((CurrentContext) context.peek()).placeRequest = checkNotNull(\"place\",\n                                                                      place);\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl order(final int order) {\n        ((CurrentContext) context.peek()).order = order;\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl position(final MenuPosition position) {\n        ((CurrentContext) context.peek()).position = checkNotNull(\"position\",\n                                                                  position);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl identifier(final String id) {\n        ((CurrentContext) context.peek()).identifier = checkNotEmpty(\"identifier\",\n                                                                     id);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(ResourceType resourceType) {\n        ResourceRef resource = new ResourceRef(null,\n                                               resourceType);\n        ResourceActionRef ref = new ResourceActionRef(resource);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(ResourceType resourceType,\n                                          ResourceAction resourceAction) {\n        ResourceActionRef ref = new ResourceActionRef(resourceType,\n                                                      resourceAction);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(ResourceType resourceType,\n                                          Resource resource,\n                                          ResourceAction resourceAction) {\n        if (resource == null) {\n            return withPermission(resourceType,\n                                  resourceAction);\n        } else {\n            return withPermission(resource,\n                                  resourceAction);\n        }\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(Resource resource) {\n        ResourceActionRef ref = new ResourceActionRef(resource);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public Object withPermission(String resourceId,\n                                 ResourceType resourceType) {\n        ResourceRef resource = new ResourceRef(resourceId,\n                                               resourceType);\n        ResourceActionRef ref = new ResourceActionRef(resource);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public Object withPermission(String resourceId,\n                                 ResourceType resourceType,\n                                 ResourceAction resourceAction) {\n        ResourceRef resource = new ResourceRef(resourceId,\n                                               resourceType);\n        ResourceActionRef ref = new ResourceActionRef(resource,\n                                                      resourceAction);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(Resource resource,\n                                          ResourceAction resourceAction) {\n        ResourceActionRef ref = new ResourceActionRef(resource,\n                                                      resourceAction);\n        ((CurrentContext) context.peek()).resourceActionRefs.add(ref);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl withPermission(String permission) {\n        ((CurrentContext) context.peek()).permissionNames.add(permission);\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl endMenus() {\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl endMenu() {\n        if (context.size() == 1) {\n            menuItems.add(context.pop().build());\n        } else {\n            final MenuFactory.CustomMenuBuilder active = context.pop();\n            context.peek().push(active);\n        }\n\n        return this;\n    }\n\n    @Override\n    public MenuBuilderImpl orderAll(final int order) {\n        this.order = order;\n\n        return this;\n    }\n\n    @Override\n    public Menus build() {\n        context.clear();\n\n        return new DefaultMenus(menuItems,\n                                order);\n    }\n\n    public enum MenuType {\n        TOP_LEVEL,\n        CONTRIBUTED,\n        REGULAR,\n        GROUP,\n        CUSTOM\n    }\n\n    private static class CurrentContext implements MenuFactory.CustomMenuBuilder {\n\n        MenuItem menu = null;\n\n        int order = 0;\n        MenuType menuType = MenuType.REGULAR;\n        String caption = null;\n        MenuPosition position = MenuPosition.LEFT;\n        String contributionPoint = null;\n        Command command = null;\n        PlaceRequest placeRequest = null;\n        String identifier = null;\n        List<ResourceActionRef> resourceActionRefs = new ArrayList<>();\n        List<String> permissionNames = new ArrayList<>();\n        List menuItems = new ArrayList<MenuItem>();\n        Stack<MenuFactory.CustomMenuBuilder> menuRawItems = new Stack<MenuFactory.CustomMenuBuilder>();\n\n        @Override\n        public void push(MenuFactory.CustomMenuBuilder element) {\n            menuRawItems.push(element);\n        }\n\n        @Override\n        public MenuItem build() {\n            if (menu != null) {\n                return menu;\n            }\n            if (menuItems.size() > 0 || menuRawItems.size() > 0) {\n                if (menuRawItems.size() > 0) {\n                    for (final MenuFactory.CustomMenuBuilder current : menuRawItems) {\n                        menuItems.add(current.build());\n                    }\n                }\n\n                return new DefaultMenuGroup(menuItems,\n                                            resourceActionRefs,\n                                            permissionNames,\n                                            contributionPoint,\n                                            caption,\n                                            position,\n                                            order);\n            } else if (command != null) {\n                return new MenuItemCommand() {\n\n                    private final List<EnabledStateChangeListener> enabledStateChangeListeners = new ArrayList<EnabledStateChangeListener>();\n                    private boolean isEnabled = true;\n\n                    @Override\n                    public String getIdentifier() {\n                        if (identifier != null) {\n                            return identifier;\n                        }\n                        if (contributionPoint != null) {\n                            return getClass().getName() + \"#\" + contributionPoint + \"#\" + caption;\n                        }\n                        return getClass().getName() + \"#\" + caption;\n                    }\n\n                    @Override\n                    public List<ResourceActionRef> getResourceActions() {\n                        return resourceActionRefs;\n                    }\n\n                    @Override\n                    public List<String> getPermissions() {\n                        return permissionNames;\n                    }\n\n                    @Override\n                    public Command getCommand() {\n                        return command;\n                    }\n\n                    @Override\n                    public String getContributionPoint() {\n                        return contributionPoint;\n                    }\n\n                    @Override\n                    public String getCaption() {\n                        return caption;\n                    }\n\n                    @Override\n                    public MenuPosition getPosition() {\n                        return position;\n                    }\n\n                    @Override\n                    public int getOrder() {\n                        return order;\n                    }\n\n                    @Override\n                    public boolean isEnabled() {\n                        return isEnabled;\n                    }\n\n                    @Override\n                    public void setEnabled(final boolean enabled) {\n                        this.isEnabled = enabled;\n                        notifyListeners(enabled);\n                    }\n\n                    @Override\n                    public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n                        enabledStateChangeListeners.add(listener);\n                    }\n\n                    @Override\n                    public void accept(MenuVisitor visitor) {\n                        visitor.visit(this);\n                    }\n\n                    private void notifyListeners(final boolean enabled) {\n                        for (final EnabledStateChangeListener listener : enabledStateChangeListeners) {\n                            listener.enabledStateChanged(enabled);\n                        }\n                    }\n                };\n            } else if (placeRequest != null) {\n                return new MenuItemPerspective() {\n\n                    private final List<EnabledStateChangeListener> enabledStateChangeListeners = new ArrayList<EnabledStateChangeListener>();\n                    private boolean isEnabled = true;\n\n                    @Override\n                    public PlaceRequest getPlaceRequest() {\n                        return placeRequest;\n                    }\n\n                    @Override\n                    public String getIdentifier() {\n                        if (identifier != null) {\n                            return identifier;\n                        }\n                        if (contributionPoint != null) {\n                            return getClass().getName() + \"#\" + contributionPoint + \"#\" + caption;\n                        }\n                        return getClass().getName() + \"#\" + caption;\n                    }\n\n                    @Override\n                    public List<ResourceActionRef> getResourceActions() {\n                        return resourceActionRefs;\n                    }\n\n                    @Override\n                    public List<String> getPermissions() {\n                        return permissionNames;\n                    }\n\n                    @Override\n                    public List<Resource> getDependencies() {\n                        ResourceRef ref = new ResourceRef(placeRequest.getIdentifier(),\n                                                          ActivityResourceType.PERSPECTIVE);\n                        return Collections.singletonList(ref);\n                    }\n\n                    @Override\n                    public String getContributionPoint() {\n                        return contributionPoint;\n                    }\n\n                    @Override\n                    public String getCaption() {\n                        return caption;\n                    }\n\n                    @Override\n                    public MenuPosition getPosition() {\n                        return position;\n                    }\n\n                    @Override\n                    public int getOrder() {\n                        return order;\n                    }\n\n                    @Override\n                    public boolean isEnabled() {\n                        return isEnabled;\n                    }\n\n                    @Override\n                    public void setEnabled(final boolean enabled) {\n                        this.isEnabled = enabled;\n                        notifyListeners(enabled);\n                    }\n\n                    @Override\n                    public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n                        enabledStateChangeListeners.add(listener);\n                    }\n\n                    @Override\n                    public void accept(MenuVisitor visitor) {\n                        visitor.visit(this);\n                    }\n\n                    private void notifyListeners(final boolean enabled) {\n                        for (final EnabledStateChangeListener listener : enabledStateChangeListeners) {\n                            listener.enabledStateChanged(enabled);\n                        }\n                    }\n                };\n            }\n            return new MenuItemPlain() {\n\n                private final List<EnabledStateChangeListener> enabledStateChangeListeners = new ArrayList<EnabledStateChangeListener>();\n                private boolean isEnabled = true;\n\n                @Override\n                public String getIdentifier() {\n                    if (identifier != null) {\n                        return identifier;\n                    }\n                    if (contributionPoint != null) {\n                        return getClass().getName() + \"#\" + contributionPoint + \"#\" + caption;\n                    }\n                    return getClass().getName() + \"#\" + caption;\n                }\n\n                @Override\n                public List<ResourceActionRef> getResourceActions() {\n                    return resourceActionRefs;\n                }\n\n                @Override\n                public List<String> getPermissions() {\n                    return permissionNames;\n                }\n\n                @Override\n                public String getContributionPoint() {\n                    return contributionPoint;\n                }\n\n                @Override\n                public String getCaption() {\n                    return caption;\n                }\n\n                @Override\n                public MenuPosition getPosition() {\n                    return position;\n                }\n\n                @Override\n                public int getOrder() {\n                    return order;\n                }\n\n                @Override\n                public boolean isEnabled() {\n                    return isEnabled;\n                }\n\n                @Override\n                public void setEnabled(final boolean enabled) {\n                    this.isEnabled = enabled;\n                    notifyListeners(enabled);\n                }\n\n                @Override\n                public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n                    enabledStateChangeListeners.add(listener);\n                }\n\n                @Override\n                public void accept(MenuVisitor visitor) {\n                    visitor.visit(this);\n                }\n\n                private void notifyListeners(final boolean enabled) {\n                    for (final EnabledStateChangeListener listener : enabledStateChangeListeners) {\n                        listener.enabledStateChanged(enabled);\n                    }\n                }\n            };\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/IconType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.toolbar;\n\npublic enum IconType {\n    ADJUST,\n    ALIGN_CENTER,\n    ALIGN_JUSTIFY,\n    ALIGN_LEFT,\n    ALIGN_RIGHT,\n    AMBULANCE,\n    ANGLE_DOWN,\n    ANGLE_LEFT,\n    ANGLE_RIGHT,\n    ANGLE_UP,\n    ARROW_DOWN,\n    ARROW_LEFT,\n    ARROW_RIGHT,\n    ARROW_UP,\n    ASTERISK,\n    BACKWARD,\n    BAN_CIRCLE,\n    BAR_CHART,\n    BARCODE,\n    BEAKER,\n    BEER,\n    BELL,\n    BELL_ALT,\n    BOLD,\n    BOLT,\n    BOOK,\n    BOOKMARK,\n    BOOKMARK_EMPTY,\n    BRIEFCASE,\n    BUILDING,\n    BULLHORN,\n    CALENDAR,\n    CAMERA,\n    CAMERA_RETRO,\n    CARET_DOWN,\n    CARET_LEFT,\n    CARET_RIGHT,\n    CARET_UP,\n    CERTIFICATE,\n    CHECK,\n    CHECK_EMPTY,\n    CHEVRON_DOWN,\n    CHEVRON_LEFT,\n    CHEVRON_RIGHT,\n    CHEVRON_UP,\n    CIRCLE_ARROW_DOWN,\n    CIRCLE_ARROW_LEFT,\n    CIRCLE_ARROW_RIGHT,\n    CIRCLE_ARROW_UP,\n    CIRCLE,\n    CIRCLE_BLANK,\n    CLOUD,\n    CLOUD_DOWNLOAD,\n    CLOUD_UPLOAD,\n    COFFEE,\n    COG,\n    COGS,\n    COLUMNS,\n    COMMENT,\n    COMMENT_ALT,\n    COMMENTS,\n    COMMENTS_ALT,\n    COPY,\n    CREDIT_CARD,\n    CUT,\n    DASHBOARD,\n    DESKTOP,\n    DOUBLE_ANGLE_DOWN,\n    DOUBLE_ANGLE_LEFT,\n    DOUBLE_ANGLE_RIGHT,\n    DOUBLE_ANGLE_UP,\n    DOWNLOAD,\n    DOWNLOAD_ALT,\n    EDIT,\n    EJECT,\n    ENVELOPE,\n    ENVELOPE_ALT,\n    EXCHANGE,\n    EXCLAMATION_SIGN,\n    EXTERNAL_LINK,\n    EYE_CLOSE,\n    EYE_OPEN,\n    FACEBOOK,\n    FACEBOOK_SIGN,\n    FACETIME_VIDEO,\n    FAST_BACKWARD,\n    FAST_FORWARD,\n    FIGHTER_JET,\n    FILE,\n    FILE_ALT,\n    FILM,\n    FILTER,\n    FIRE,\n    FLAG,\n    FOLDER_CLOSE,\n    FOLDER_CLOSE_ALT,\n    FOLDER_OPEN,\n    FOLDER_OPEN_ALT,\n    FONT,\n    FOOD,\n    FORWARD,\n    FULLSCREEN,\n    GIFT,\n    GITHUB,\n    GITHUB_ALT,\n    GITHUB_SIGN,\n    GLASS,\n    GLOBE,\n    GOOGLE_PLUS,\n    GOOGLE_PLUS_SIGN,\n    GROUP,\n    H_SIGN,\n    HAND_DOWN,\n    HAND_LEFT,\n    HAND_RIGHT,\n    HAND_UP,\n    HDD,\n    HEADPHONES,\n    HEART,\n    HEART_EMPTY,\n    HOME,\n    HOSPITAL,\n    INBOX,\n    INDENT_LEFT,\n    INDENT_RIGHT,\n    INFO_SIGN,\n    ITALIC,\n    KEY,\n    LAPTOP,\n    LEAF,\n    LEGAL,\n    LEMON,\n    LIGHTBULB,\n    LINK,\n    LINKEDIN,\n    LINKEDIN_SIGN,\n    LIST,\n    LIST_ALT,\n    LIST_OL,\n    LIST_UL,\n    LOCK,\n    MAGIC,\n    MAGNET,\n    MAP_MARKER,\n    MEDKIT,\n    MINUS,\n    MINUS_SIGN,\n    MOBILE_PHONE,\n    MONEY,\n    MOVE,\n    MUSIC,\n    OFF,\n    OK,\n    OK_CIRCLE,\n    OK_SIGN,\n    PAPER_CLIP,\n    PASTE,\n    PAUSE,\n    PENCIL,\n    PHONE,\n    PHONE_SIGN,\n    PICTURE,\n    PINTEREST,\n    PINTEREST_SIGN,\n    PLANE,\n    PLAY,\n    PLAY_CIRCLE,\n    PLUS,\n    PLUS_SIGN,\n    PLUS_SIGN_ALT,\n    PRINT,\n    PUSHPIN,\n    QRCODE,\n    QUESTION_SIGN,\n    QUOTE_LEFT,\n    QUOTE_RIGHT,\n    RANDOM,\n    REFRESH,\n    REMOVE,\n    REMOVE_CIRCLE,\n    REMOVE_SIGN,\n    REORDER,\n    REPEAT,\n    REPLY,\n    RESIZE_FULL,\n    RESIZE_HORIZONTAL,\n    RESIZE_SMALL,\n    RESIZE_VERTICAL,\n    RETWEET,\n    ROAD,\n    RSS,\n    SAVE,\n    SCREENSHOT,\n    SEARCH,\n    SHARE,\n    SHARE_ALT,\n    SHOPPING_CART,\n    SIGN_BLANK,\n    SIGNAL,\n    SIGNIN,\n    SIGNOUT,\n    SITEMAP,\n    SORT,\n    SORT_DOWN,\n    SORT_UP,\n    SPINNER,\n    STAR,\n    STAR_EMPTY,\n    STAR_HALF,\n    STEP_BACKWARD,\n    STEP_FORWARD,\n    STETHOSCOPE,\n    STOP,\n    STRIKETHROUGH,\n    SUITCASE,\n    TABLE,\n    TABLET,\n    TAG,\n    TAGS,\n    TASKS,\n    TEXT_HEIGHT,\n    TEXT_WIDTH,\n    TH,\n    TH_LARGE,\n    TH_LIST,\n    THUMBS_DOWN,\n    THUMBS_UP,\n    TIME,\n    TINT,\n    TRASH,\n    TROPHY,\n    TRUCK,\n    TWITTER,\n    TWITTER_SIGN,\n    UMBRELLA,\n    UNDERLINE,\n    UNDO,\n    UNLOCK,\n    UPLOAD,\n    UPLOAD_ALT,\n    USER,\n    USER_MD,\n    VOLUME_DOWN,\n    VOLUME_OFF,\n    VOLUME_UP,\n    WARNING_SIGN,\n    WRENCH,\n    ZOOM_IN,\n    ZOOM_OUT;\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/ToolBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.toolbar;\n\nimport java.util.List;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.security.authz.RuntimeFeatureResource;\n\n/**\n * Meta-data for a Workbench Tool Bar including permissions\n */\n@JsType\npublic interface ToolBar\n        extends RuntimeFeatureResource {\n\n    void addItem(final ToolBarItem item);\n\n    List<ToolBarItem> getItems();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/ToolBarIcon.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.toolbar;\n\nimport jsinterop.annotations.JsType;\n\n/**\n *\n */\n@JsType\npublic interface ToolBarIcon {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/ToolBarItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.toolbar;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.RuntimeFeatureResource;\n\n/**\n * Meta-data for a Workbench Tool Bar Item including permissions. The default is\n * that all users have permission to access a Tool BarItem Item and that it is\n * enabled.\n */\n@JsType\npublic interface ToolBarItem\n        extends RuntimeFeatureResource {\n\n    /**\n     * @return the caption\n     */\n    String getTooltip();\n\n    /**\n     * @return the toolbar icon information\n     */\n    ToolBarIcon getIcon();\n\n    /**\n     * @return is the Tool Bar Item enabled\n     */\n    boolean isEnabled();\n\n    /**\n     * @param enabled the enabled to set\n     */\n    void setEnabled(boolean enabled);\n\n    /**\n     * @return The command associated with the Tool Bar Item\n     */\n    Command getCommand();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/ToolBarTypeIcon.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.toolbar;\n\npublic interface ToolBarTypeIcon extends ToolBarIcon {\n\n    IconType getType();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/ToolBarUrlIcon.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.toolbar;\n\npublic interface ToolBarUrlIcon extends ToolBarIcon {\n\n    /**\n     * @return The relative URL for the image for the ToolBarItem. Images must\n     * be within the application WAR, i.e. not an external location.\n     */\n    String getUrl();\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/impl/DefaultToolBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.toolbar.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.workbench.model.toolbar.ToolBar;\nimport org.uberfire.workbench.model.toolbar.ToolBarItem;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Default implementation of ToolBar\n */\npublic class DefaultToolBar\n        implements ToolBar {\n\n    private final String id;\n    private final List<ToolBarItem> items;\n\n    public DefaultToolBar(final String id) {\n\n        this(id,\n             new ArrayList<ToolBarItem>());\n    }\n\n    public DefaultToolBar(final String id,\n                          final List<ToolBarItem> items) {\n        this.id = checkNotEmpty(\"id\",\n                                id);\n        this.items = checkNotNull(\"items\",\n                                  items);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return id;\n    }\n\n    @Override\n    public void addItem(final ToolBarItem item) {\n        this.items.add(checkNotNull(\"item\",\n                                    item));\n    }\n\n    @Override\n    public List<ToolBarItem> getItems() {\n        return this.items;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/model/toolbar/impl/DefaultToolBarItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.model.toolbar.impl;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.toolbar.IconType;\nimport org.uberfire.workbench.model.toolbar.ToolBarIcon;\nimport org.uberfire.workbench.model.toolbar.ToolBarItem;\nimport org.uberfire.workbench.model.toolbar.ToolBarTypeIcon;\nimport org.uberfire.workbench.model.toolbar.ToolBarUrlIcon;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Default implementation of ToolBarItem\n */\npublic class DefaultToolBarItem\n        implements\n        ToolBarItem {\n\n    private final ToolBarIcon icon;\n\n    private final String tooltip;\n\n    private final Command command;\n\n    private boolean isEnabled = true;\n\n    public DefaultToolBarItem(final String url,\n                              final String tooltip,\n                              final Command command) {\n        this.tooltip = checkNotNull(\"tooltip\",\n                                    tooltip);\n        this.command = checkNotNull(\"command\",\n                                    command);\n        checkNotNull(\"url\",\n                     url);\n        this.icon = new ToolBarUrlIcon() {\n            @Override\n            public String getUrl() {\n                return url;\n            }\n        };\n    }\n\n    public DefaultToolBarItem(final IconType iconType,\n                              final String tooltip,\n                              final Command command) {\n        this.tooltip = checkNotNull(\"tooltip\",\n                                    tooltip);\n        this.command = checkNotNull(\"command\",\n                                    command);\n        checkNotNull(\"iconType\",\n                     iconType);\n        this.icon = new ToolBarTypeIcon() {\n            @Override\n            public IconType getType() {\n                return iconType;\n            }\n        };\n    }\n\n    @Override\n    public String getIdentifier() {\n        return tooltip;\n    }\n\n    @Override\n    public String getTooltip() {\n        return this.tooltip;\n    }\n\n    @Override\n    public ToolBarIcon getIcon() {\n        return icon;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return this.isEnabled;\n    }\n\n    @Override\n    public void setEnabled(boolean isEnabled) {\n        this.isEnabled = isEnabled;\n    }\n\n    @Override\n    public Command getCommand() {\n        return this.command;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/type/AnyResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.type;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\npublic class AnyResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public AnyResourceTypeDefinition() {\n    }\n\n    public AnyResourceTypeDefinition(final Category category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"any\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Others\";\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"\";\n    }\n\n    @Override\n    public int getPriority() {\n        return Integer.MIN_VALUE;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return true;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/type/DotResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.type;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\npublic class DotResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public DotResourceTypeDefinition() {\n    }\n\n    public DotResourceTypeDefinition(final Category category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"meta data\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Dot file\";\n    }\n\n    @Override\n    public String getPrefix() {\n        return \".\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"\";\n    }\n\n    @Override\n    public int getPriority() {\n        return Integer.MAX_VALUE;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \".*\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().startsWith(getPrefix());\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/type/FileNameUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.type;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic final class FileNameUtil {\n\n    public static String removeExtension(final Path path,\n                                         final ResourceTypeDefinition type) {\n        if (path == null) {\n            return null;\n        }\n        final String fileName = path.getFileName();\n        if (type == null) {\n            return fileName;\n        }\n        return removeExtension(path,\n                               type.getSuffix());\n    }\n\n    public static String removeExtension(final Path path,\n                                         final String extension) {\n        if (path == null) {\n            return null;\n        }\n\n        final String fileName = path.getFileName();\n        return removeExtension(fileName,\n                               extension);\n    }\n\n    public static String removeExtension(final String fileName,\n                                         final String extension) {\n        if (fileName == null) {\n            return null;\n        }\n\n        if (extension == null || extension.isEmpty()) {\n            return fileName;\n        }\n\n        final int index = indexOfExtension(fileName,\n                                           extension);\n        if (index == -1) {\n            return fileName;\n        } else {\n            return fileName.substring(0,\n                                      index);\n        }\n    }\n\n    private static int indexOfExtension(final String fileName,\n                                        final String extension) {\n        if (fileName == null) {\n            return -1;\n        }\n        final String suffix = (extension == null ? \"\" : extension);\n        final int extensionPos = fileName.lastIndexOf(\".\" + suffix);\n        return extensionPos;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/type/ResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.type;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Undefined;\nimport org.uberfire.workbench.diff.DiffMode;\n\n/**\n * Definition of a Resource Type\n */\n@JsType\npublic interface ResourceTypeDefinition {\n\n    /**\n     * A short name of the resource type\n     * @return the short name\n     */\n    public String getShortName();\n\n    /**\n     * A description of the resource type\n     * @return the description\n     */\n    public String getDescription();\n\n    /**\n     * Resource prefix\n     * @return the prefix\n     */\n    public String getPrefix();\n\n    /**\n     * Resource suffix\n     * @return the prefix\n     */\n    public String getSuffix();\n\n    /**\n     * Defines the resource priority in terms of resource resolution\n     * @return the priority\n     */\n    public int getPriority();\n\n    /**\n     * A simple (and maybe not very accurate) wildcard pattern to search for\n     * this type of resource.\n     * This is only used in order to optimize index and search.\n     * @return the wildcard pattern\n     */\n    public String getSimpleWildcardPattern();\n\n    /**\n     * Indicates if the current parameter path matched the current resource type\n     * @return true if matches, otherwise false\n     */\n    boolean accept(final Path path);\n\n    /**\n     * Defines the category for each resource. If no category is defined, {@link Undefined} should be returned\n     * @return the resource category\n     */\n    Category getCategory();\n\n    /**\n     * Defines how the diff of this resource type should be presented.\n     * @return the resource diff mode\n     */\n    default DiffMode getDiffMode() {\n        return DiffMode.TEXTUAL;\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workbench/type/TextResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.type;\n\nimport javax.enterprise.inject.Default;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.annotations.VisibleAsset;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@Default\n@VisibleAsset\npublic class TextResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public TextResourceTypeDefinition() {\n    }\n\n    public TextResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"text\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Text file\";\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"txt\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.txt\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\".\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/java/org/uberfire/workspace/WorkspaceContext.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.workspace;\n\n/**\n * This context is used to store the active workspace for the thread that uses that is using it.\n */\npublic class WorkspaceContext {\n\n    private WorkspaceContext() {\n    }\n\n    private static ThreadLocal<String> workspace = new ThreadLocal<>();\n\n    public static void set(String workspace) {\n        WorkspaceContext.workspace.set(workspace);\n    }\n\n    public static String get() {\n        return workspace.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-api/src/main/resources/META-INF/beans.xml",
    "content": "<beans xmlns=\"http://java.sun.com/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\">\n\n</beans>\n"
  },
  {
    "path": "uberfire-api/src/main/resources/org/uberfire/UberfireAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.security.SecurityShared\"/>\n  <inherits name='org.jboss.errai.ioc.Container'/>\n\n  <source path='annotations'/>\n  <source path='backend'/>\n  <source path='debug'/>\n  <source path='lifecycle'/>\n  <source path='mvp'/>\n  <source path='paging'/>\n  <source path='plugin'/>\n  <source path='rpc'/>\n  <source path='spaces'/>\n  <source path='security'/>\n  <source path='workbench'/>\n\n  <super-source path=\"jre\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-api/src/main/resources/org/uberfire/jre/org/uberfire/util/URIUtil.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.util;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.ScriptInjector;\nimport com.google.gwt.http.client.URL;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\n/**\n * GWT client-side implementation of URIUtil which relies on URI.js.\n */\npublic final class URIUtil {\n\n    private static final Resources RESOURCES = GWT.create(Resources.class);\n\n    static {\n        ScriptInjector.fromString(RESOURCES.uriDotJs().getText()).inject();\n    }\n\n    public static String encode(String content) {\n        return URL.encode(content);\n    }\n\n    public static String decode(String content) {\n        return URL.decode(content);\n    }\n\n    public static String encodeQueryString(String content) {\n        return URL.encodeQueryString(content);\n    }\n\n    public native static boolean isValid(final String uri) /*-{\n        var components = URI.parse(uri);\n        if (typeof components.errors !== 'undefined' && components.errors.length > 0) {\n            return false;\n        }\n        if (components.reference != \"absolute\") {\n            return false;\n        }\n        return true;\n    }-*/;\n\n    interface Resources extends ClientBundle {\n\n        @Source(\"uri.min.js\")\n        TextResource uriDotJs();\n    }\n}"
  },
  {
    "path": "uberfire-api/src/test/java/NaughtyClassInDefaultPackage.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport org.uberfire.debug.Debug;\n\n/**\n * This class is used for testing the handling of classes in the default package for various methods in {@link Debug}.\n */\npublic class NaughtyClassInDefaultPackage {\n\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/backend/vfs/PathFactoryTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.vfs;\n\nimport java.nio.file.Paths;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PathFactoryTest {\n\n    @Test\n    public void lockTest() {\n\n        Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"default://main@myteam/dora/src/main/resources/com/myteam/dora/sample.drl\");\n\n\n        assertEquals(\"default://locks@system/system/myteam/main/dora/src/main/resources/com/myteam/dora/sample.drl.ulock\",\n                     PathFactory.newLock(path).toURI());\n\n        Path lockPath = PathFactory.newLockPath(path);\n\n        Path extractedPath = PathFactory.fromLock(lockPath);\n\n        assertEquals(path.toURI(),\n                     extractedPath.toURI());\n    }\n}"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/backend/vfs/impl/ObservablePathImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceCopied;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\nimport org.uberfire.workbench.events.ResourceDeleted;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamed;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdated;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ObservablePathImplTest {\n\n    @Spy\n    @InjectMocks\n    private ObservablePathImpl observablePathImpl;\n\n    @Mock\n    private PathPlaceRequest pathPlaceRequest;\n\n    @Mock\n    private Path destinationPath;\n\n    @Mock\n    private ParameterizedCommand<ObservablePath.OnConcurrentDelete> onDelete;\n\n    @Mock\n    private ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent> onUpdate;\n\n    @Mock\n    private ParameterizedCommand<ObservablePath.OnConcurrentRenameEvent> onRename;\n\n    @Mock\n    private ParameterizedCommand<ObservablePath.OnConcurrentCopyEvent> onCopy;\n\n    private static final User identityUser = new UserImpl(\"userName\");\n    private static final String MESSAGE = \"test message\",\n            ASSET_PATH = \"default://project/package/Asset.java\",\n            OBSERVE_SESSION_ID = \"observeSession\",\n            RESOURCE_SESSION_ID = \"resourceSession\";\n\n    @Before\n    public void setup() {\n        observablePathImpl.onConcurrentDelete(onDelete);\n        observablePathImpl.onConcurrentUpdate(onUpdate);\n        observablePathImpl.onConcurrentRename(onRename);\n        observablePathImpl.onConcurrentCopy(onCopy);\n        observablePathImpl.sessionInfo = new SessionInfoImpl(OBSERVE_SESSION_ID,\n                                                             identityUser);\n    }\n\n    @Test\n    public void testResourceDeleteEvent() {\n        doReturn(createPath()).when(pathPlaceRequest).getPath();\n        observablePathImpl.onResourceDeleted(new ResourceDeletedEvent(pathPlaceRequest.getPath(),\n                                                                      MESSAGE,\n                                                                      createSessionInfo()));\n\n        verify(onDelete).execute(any());\n        verify(observablePathImpl).executeConcurrentDeleteCommand(pathPlaceRequest.getPath(),\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n    }\n\n    @Test\n    public void testResourceUpdateEvent() {\n        doReturn(createPath()).when(pathPlaceRequest).getPath();\n        observablePathImpl.onResourceUpdated(new ResourceUpdatedEvent(pathPlaceRequest.getPath(),\n                                                                      MESSAGE,\n                                                                      createSessionInfo()));\n\n        verify(onUpdate).execute(any());\n        verify(observablePathImpl).executeConcurrentUpdateCommand(pathPlaceRequest.getPath(),\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n    }\n\n    @Test\n    public void testResourceRenameEvent() {\n        doReturn(createPath()).when(pathPlaceRequest).getPath();\n        observablePathImpl.onResourceRenamed(new ResourceRenamedEvent(pathPlaceRequest.getPath(),\n                                                                      destinationPath,\n                                                                      MESSAGE,\n                                                                      createSessionInfo()));\n\n        verify(onRename).execute(any());\n        verify(observablePathImpl).executeConcurrentRenameCommand(pathPlaceRequest.getPath(),\n                                                                  destinationPath,\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n    }\n\n    @Test\n    public void testResourceCopyEvent() {\n        doReturn(createPath()).when(pathPlaceRequest).getPath();\n        observablePathImpl.onResourceCopied(new ResourceCopiedEvent(pathPlaceRequest.getPath(),\n                                                                    destinationPath,\n                                                                    MESSAGE,\n                                                                    createSessionInfo()));\n\n        verify(onCopy).execute(any());\n        verify(observablePathImpl).executeConcurrentCopyCommand(pathPlaceRequest.getPath(),\n                                                                destinationPath,\n                                                                RESOURCE_SESSION_ID,\n                                                                identityUser);\n    }\n\n    @Test\n    public void testResourceBatchEvent() {\n        doReturn(createPath()).when(pathPlaceRequest).getPath();\n        final Path path = pathPlaceRequest.getPath();\n        final Map<Path, Collection<ResourceChange>> batchEvents = new HashMap<Path, Collection<ResourceChange>>() {\n            {\n                put(path,\n                    new ArrayList<ResourceChange>() {{\n                        add(new ResourceCopied(destinationPath, \"copied event\"));\n                        add(new ResourceDeleted(\"deleted event\"));\n                        add(new ResourceRenamed(destinationPath, \"renamed event\"));\n                        add(new ResourceUpdated(\"updated event\"));\n                    }});\n            }\n        };\n\n        observablePathImpl.onResourceBatchEvent(\n                new ResourceBatchChangesEvent(batchEvents, MESSAGE, createSessionInfo())\n        );\n\n        verify(onCopy).execute(any());\n        verify(onDelete).execute(any());\n        verify(onRename).execute(any());\n        verify(onUpdate).execute(any());\n\n        verify(observablePathImpl).executeConcurrentCopyCommand(pathPlaceRequest.getPath(),\n                                                                destinationPath,\n                                                                RESOURCE_SESSION_ID,\n                                                                identityUser);\n        verify(observablePathImpl).executeConcurrentDeleteCommand(pathPlaceRequest.getPath(),\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n        verify(observablePathImpl).executeConcurrentRenameCommand(pathPlaceRequest.getPath(),\n                                                                  destinationPath,\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n        verify(observablePathImpl).executeConcurrentUpdateCommand(destinationPath,\n                                                                  RESOURCE_SESSION_ID,\n                                                                  identityUser);\n    }\n\n    private ObservablePath createPath() {\n        final ObservablePath path = mock(ObservablePath.class);\n        observablePathImpl.wrap(path);\n        return path;\n    }\n\n    private SessionInfoImpl createSessionInfo() {\n        return new SessionInfoImpl(\"resourceSession\",\n                                   identityUser);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/debug/DebugTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.debug;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class DebugTest {\n\n    @Test\n    public void testAbbreviatedName() {\n        assertEquals(\"ju.List\",\n                     Debug.abbreviatedName(List.class));\n    }\n\n    @Test\n    public void testMemorableNumber() {\n        assertEquals(\"badodyre\",\n                     Debug.toMemorableString(56385664));\n    }\n\n    @Test\n    public void testMemorableWithNegativeNumber() {\n        assertEquals(\"d\",\n                     Debug.toMemorableString(-1));\n    }\n\n    @Test\n    public void testMemorableWithZero() {\n        assertEquals(\"b\",\n                     Debug.toMemorableString(0));\n    }\n\n    @Test\n    public void testObjectId() {\n        Map<String, String> m = new HashMap<String, String>();\n        assertEquals(Debug.abbreviatedName(m.getClass()) + \"@\" + Debug.toMemorableString(System.identityHashCode(m)),\n                     Debug.objectId(m));\n    }\n\n\n    @Test\n    public void testShortNameWithInnerClass() {\n        assertEquals(\"Map$Entry\",\n                     Debug.shortName(Map.Entry.class));\n    }\n\n    @Test\n    public void testShortNameInDefaultPackage() throws Exception {\n        assertEquals(\"NaughtyClassInDefaultPackage\",\n                     Debug.shortName(Class.forName(\"NaughtyClassInDefaultPackage\")));\n    }\n\n    @Test\n    public void testAbbreviatedNameInDefaultPackage() throws Exception {\n        assertEquals(\"NaughtyClassInDefaultPackage\",\n                     Debug.abbreviatedName(Class.forName(\"NaughtyClassInDefaultPackage\")));\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/mvp/impl/ConditionalPlaceRequestTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.mvp.impl;\n\nimport org.junit.Test;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.junit.Assert.*;\n\npublic class ConditionalPlaceRequestTest {\n\n    @Test\n    public void conditionalTestTruePredicate() {\n        DefaultPlaceRequest other = new DefaultPlaceRequest(\"other\");\n        ConditionalPlaceRequest dora = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"dora\").when(p -> true)\n                .orElse(other);\n        assertEquals(dora,\n                     dora.resolveConditionalPlaceRequest());\n    }\n\n    @Test\n    public void conditionalTestFalsePredicate() {\n        DefaultPlaceRequest other = new DefaultPlaceRequest(\"other\");\n        ConditionalPlaceRequest dora = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"dora\").when(p -> false)\n                .orElse(other);\n        assertEquals(other,\n                     dora.resolveConditionalPlaceRequest());\n    }\n\n    @Test\n    public void incompleteConditionalShouldReturnDefaultPlaceRequest() {\n        ConditionalPlaceRequest dora = new ConditionalPlaceRequest(\"dora\");\n        assertEquals(\"dora\",\n                     dora.resolveConditionalPlaceRequest().getIdentifier());\n    }\n\n    @Test\n    public void incompleteConditionalWithNullsShouldReturnDefaultPlaceRequest() {\n        ConditionalPlaceRequest dora = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"dora\").when(null).orElse(null);\n        assertEquals(\"dora\",\n                     dora.resolveConditionalPlaceRequest().getIdentifier());\n    }\n\n    @Test\n    public void conditionalTestChainingPredicate() {\n        DefaultPlaceRequest my = new DefaultPlaceRequest(\"my\");\n        ConditionalPlaceRequest bento = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"bento\").when(p -> false)\n                .orElse(my);\n        ConditionalPlaceRequest dora = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"dora\").when(p -> false)\n                .orElse(bento);\n        assertEquals(my,\n                     dora.resolveConditionalPlaceRequest());\n    }\n\n    @Test\n    public void conditionalTestChainingPredicateReturningConditional() {\n        DefaultPlaceRequest my = new DefaultPlaceRequest(\"my\");\n        ConditionalPlaceRequest bento = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"bento\").when(p -> true)\n                .orElse(my);\n        ConditionalPlaceRequest dora = (ConditionalPlaceRequest) new ConditionalPlaceRequest(\"dora\").when(p -> false)\n                .orElse(bento);\n        assertEquals(\"bento\",\n                     dora.resolveConditionalPlaceRequest().getIdentifier());\n    }\n\n    @Test\n    public void defaultPlaceRequestEqualsToConditionalPlaceRequest() {\n        final DefaultPlaceRequest defaultPlaceRequest = new DefaultPlaceRequest(\"my\");\n        final PlaceRequest conditionalPlaceRequest = new ConditionalPlaceRequest(\"my\").when(p -> true).orElse(new DefaultPlaceRequest(\"other\"));\n\n        equals(defaultPlaceRequest,\n               conditionalPlaceRequest);\n    }\n\n    @Test\n    public void defaultPlaceRequestNotEqualsToConditionalPlaceRequest() {\n        final DefaultPlaceRequest defaultPlaceRequest = new DefaultPlaceRequest(\"my\");\n        final PlaceRequest conditionalPlaceRequest = new ConditionalPlaceRequest(\"my\").when(p -> false).orElse(new DefaultPlaceRequest(\"other\"));\n\n        notEquals(defaultPlaceRequest,\n                  conditionalPlaceRequest);\n    }\n\n    @Test\n    public void defaultPlaceRequestEqualsToIncompleteConditionalPlaceRequest() {\n        final DefaultPlaceRequest defaultPlaceRequest = new DefaultPlaceRequest(\"my\");\n        final PlaceRequest conditionalPlaceRequest = new ConditionalPlaceRequest(\"my\");\n\n        equals(defaultPlaceRequest,\n               conditionalPlaceRequest);\n    }\n\n    @Test\n    public void trueEvaluatedConditionalPlaceRequestEqualsToAnotherTrueEvaluatedConditionalPlaceRequest() {\n        final PlaceRequest conditionalPlaceRequest1 = new ConditionalPlaceRequest(\"place1\").when(p -> true).orElse(new DefaultPlaceRequest(\"place2\"));\n        final PlaceRequest conditionalPlaceRequest2 = new ConditionalPlaceRequest(\"place1\").when(p -> true).orElse(new DefaultPlaceRequest(\"place3\"));\n\n        equals(conditionalPlaceRequest1,\n               conditionalPlaceRequest2);\n    }\n\n    @Test\n    public void falseEvaluatedConditionalPlaceRequestEqualsToAnotherFalseEvaluatedConditionalPlaceRequest() {\n        final PlaceRequest conditionalPlaceRequest1 = new ConditionalPlaceRequest(\"place1\").when(p -> false).orElse(new DefaultPlaceRequest(\"place2\"));\n        final PlaceRequest conditionalPlaceRequest2 = new ConditionalPlaceRequest(\"place3\").when(p -> false).orElse(new DefaultPlaceRequest(\"place2\"));\n\n        equals(conditionalPlaceRequest1,\n               conditionalPlaceRequest2);\n    }\n\n    @Test\n    public void trueEvaluatedConditionalPlaceRequestEqualsToAnotherFalseEvaluatedConditionalPlaceRequest() {\n        final PlaceRequest conditionalPlaceRequest1 = new ConditionalPlaceRequest(\"place1\").when(p -> true).orElse(new DefaultPlaceRequest(\"place2\"));\n        final PlaceRequest conditionalPlaceRequest2 = new ConditionalPlaceRequest(\"place3\").when(p -> false).orElse(new DefaultPlaceRequest(\"place1\"));\n\n        equals(conditionalPlaceRequest1,\n               conditionalPlaceRequest2);\n    }\n\n    @Test\n    public void falseEvaluatedConditionalPlaceRequestEqualsToAnotherTrueEvaluatedConditionalPlaceRequest() {\n        final PlaceRequest conditionalPlaceRequest1 = new ConditionalPlaceRequest(\"place1\").when(p -> false).orElse(new DefaultPlaceRequest(\"place2\"));\n        final PlaceRequest conditionalPlaceRequest2 = new ConditionalPlaceRequest(\"place2\").when(p -> true).orElse(new DefaultPlaceRequest(\"place3\"));\n\n        equals(conditionalPlaceRequest1,\n               conditionalPlaceRequest2);\n    }\n\n    private void equals(final PlaceRequest placeRequest1,\n                        final PlaceRequest placeRequest2) {\n        assertTrue(placeRequest1.equals(placeRequest2));\n        assertTrue(placeRequest2.equals(placeRequest1));\n        assertEquals(placeRequest1.hashCode(),\n                     placeRequest2.hashCode());\n    }\n\n    private void notEquals(final PlaceRequest placeRequest1,\n                           final PlaceRequest placeRequest2) {\n        assertFalse(placeRequest1.equals(placeRequest2));\n        assertFalse(placeRequest2.equals(placeRequest1));\n        assertNotEquals(placeRequest1.hashCode(),\n                        placeRequest2.hashCode());\n    }\n}"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/mvp/impl/PathPlaceRequestTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mvp.impl;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PathPlaceRequestTest {\n\n    @Spy\n    private PathPlaceRequest pathPlaceRequest;\n\n    @Test\n    public void testPreDestroy() {\n        final ObservablePath path = mock(ObservablePath.class);\n        doReturn(path).when(pathPlaceRequest).getPath();\n\n        pathPlaceRequest.preDestroy();\n\n        verify(path).dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/security/ResourceRefTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security;\n\nimport java.util.Arrays;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class ResourceRefTest {\n\n    @Test\n    public void testDependencies() {\n        ResourceRef dep1 = new ResourceRef(\"dep1\",\n                                           () -> \"type\");\n        ResourceRef ref = new ResourceRef(\"id\",\n                                          () -> \"type\",\n                                          Arrays.asList(dep1));\n        assertNotNull(ref.getDependencies());\n        assertEquals(ref.getDependencies().size(),\n                     1);\n        assertEquals(ref.getDependencies().get(0),\n                     dep1);\n    }\n\n    @Test\n    public void testEmptyDependencies() {\n        ResourceRef ref = new ResourceRef(\"id\",\n                                          () -> \"type\");\n        assertNotNull(ref.getIdentifier());\n        assertNotNull(ref.getResourceType());\n        assertNotNull(ref.getDependencies());\n        assertEquals(ref.getIdentifier(),\n                     \"id\");\n        assertEquals(ref.getResourceType().getName(),\n                     \"type\");\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/spaces/SpacesAPITest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.spaces;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class SpacesAPITest {\n\n    @Test\n    public void resolveSpacePathTest() {\n        final String spacePath = SpacesAPI.resolveSpacePath(SpacesAPI.Scheme.DEFAULT, \"MySpace\");\n        assertEquals(\"default://MySpace/\", spacePath);\n    }\n\n    @Test\n    public void resolveConfigFileSystemPathTest() {\n        final String configFSPath = SpacesAPI.resolveConfigFileSystemPath(SpacesAPI.Scheme.DEFAULT, \"MySpace\");\n        assertEquals(\"default://MySpace/.config/config\", configFSPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/category/CategoryTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.workbench.category;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Parameterized.class)\npublic class CategoryTest {\n\n    @Parameterized.Parameters\n    public static Collection<Object[]> data() {\n        return Arrays.asList(new Object[][]{\n                // Should be equal\n                {null, null, true},\n                {\"\", \"\", true},\n                {\"a\", \"a\", true},\n                {\"A\", \"a\", true},\n                {\"a\", \"A\", true},\n\n                // Should NOT be equal\n                {null, \"\", false},\n                {\"\", null, false},\n                {null, \"a\", false},\n                {\"a\", null, false},\n                {\"\", \"a\", false},\n                {\"a\", \"\", false},\n                {\"a\", null, false},\n                {\"a\", \"b\", false},\n                {\"a\", \"B\", false},\n        });\n    }\n\n    private String cat1Name, cat2Name;\n    private boolean shouldBeEqual;\n\n    public CategoryTest(String cat1Name,\n                        String cat2name,\n                        boolean shouldBeEqual) {\n        this.cat1Name = cat1Name;\n        this.cat2Name = cat2name;\n        this.shouldBeEqual = shouldBeEqual;\n    }\n\n    @Test\n    public void test() {\n        Category c1 = new Category() {\n            @Override\n            public String getName() {\n                return cat1Name;\n            }\n        };\n\n        Category c2 = new Category() {\n            @Override\n            public String getName() {\n                return cat2Name;\n            }\n        };\n        assertEquals(shouldBeEqual,\n                     c1.equals(c2));\n    }\n}"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/model/TestWorkbenchModel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model;\n\nimport org.junit.Test;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.junit.Assert.*;\n\n/**\n * Test panel hierarchy constraints.\n */\npublic class TestWorkbenchModel {\n\n    @Test\n    public void testPanelHierarchyInsert() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(\"what.ever.panel.PresenterClass\");\n        perspective.setName(\"perspective\");\n\n        PanelDefinition westPanel = new PanelDefinitionImpl(\"what.ever.panel.PresenterClass\");\n        PanelDefinition eastPanel = new PanelDefinitionImpl(\"what.ever.panel.PresenterClass\");\n\n        PartDefinition part1 = new PartDefinitionImpl(new DefaultPlaceRequest(\"one\"));\n        PartDefinition part2 = new PartDefinitionImpl(new DefaultPlaceRequest(\"two\"));\n\n        perspective.getRoot().insertChild(CompassPosition.WEST,\n                                          westPanel);\n        perspective.getRoot().insertChild(CompassPosition.EAST,\n                                          eastPanel);\n\n        westPanel.addPart(part1);\n        eastPanel.addPart(part2);\n\n        assertTrue(part1.getParentPanel() == westPanel);\n        assertTrue(westPanel.getParent() == perspective.getRoot()); // TODO: panel equality?\n\n        assertTrue(part2.getParentPanel() == eastPanel);\n        assertTrue(eastPanel.getParent() == perspective.getRoot());\n\n        assertTrue(perspective.getRoot().getParent() == null);\n    }\n\n    @Test\n    public void testPanelHierarchyAppend() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(\"what.ever.panel.PresenterClass\");\n        perspective.setName(\"perspective\");\n\n        PanelDefinition westPanel = new PanelDefinitionImpl(\"what.ever.panel.PresenterClass\");\n        PanelDefinition eastPanel = new PanelDefinitionImpl(\"what.ever.panel.PresenterClass\");\n\n        PartDefinition part1 = new PartDefinitionImpl(new DefaultPlaceRequest(\"one\"));\n        PartDefinition part2 = new PartDefinitionImpl(new DefaultPlaceRequest(\"two\"));\n\n        perspective.getRoot().appendChild(CompassPosition.WEST,\n                                          westPanel);\n        perspective.getRoot().appendChild(CompassPosition.EAST,\n                                          eastPanel);\n\n        westPanel.addPart(part1);\n        eastPanel.addPart(part2);\n\n        assertTrue(part1.getParentPanel() == westPanel);\n        assertTrue(westPanel.getParent() == perspective.getRoot()); // TODO: panel equality?\n\n        assertTrue(part2.getParentPanel() == eastPanel);\n        assertTrue(eastPanel.getParent() == perspective.getRoot());\n\n        assertTrue(perspective.getRoot().getParent() == null);\n    }\n\n    /**\n     * Parent traversal {@link PanelDefinition#getParent()} does yield IllegalStateException when the panel is not\n     * part of a hierarchy. There might be two reasons for this: Either the implicit parent/child wiring is broken\n     * or the explicit perspective setup is not yet completed.\n     */\n    @Test(expected = IllegalStateException.class)\n    public void testDetachedPanels() {\n        PanelDefinition westPanel = new PanelDefinitionImpl(\"what.ever.panel.PresenterClass\");\n        PartDefinition part1 = new PartDefinitionImpl(new DefaultPlaceRequest(\"one\"));\n\n        westPanel.addPart(part1);\n\n        assertTrue(part1.getParentPanel() == westPanel);\n        westPanel.getParent(); // does blow up\n    }\n}\n\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/model/impl/PanelDefinitionImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class PanelDefinitionImplTest {\n\n    private PanelDefinitionImpl panelDefinition;\n    private PanelDefinitionImpl otherPanel;\n    private PartDefinition part;\n    private PlaceRequest placeRequest;\n    private PanelDefinitionImpl parent;\n\n    @Before\n    public void setUp() throws Exception {\n        panelDefinition = new PanelDefinitionImpl();\n        otherPanel = new PanelDefinitionImpl();\n        parent = new PanelDefinitionImpl();\n        placeRequest = mock(PlaceRequest.class);\n        part = new PartDefinitionImpl(placeRequest);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void settingTwoDifferentParentsShouldThrowException() throws Exception {\n        panelDefinition.setParent(otherPanel);\n        panelDefinition.setParent(parent);\n    }\n\n    @Test\n    public void addPartTest() throws Exception {\n        assertFalse(panelDefinition.getParts().contains(part));\n        panelDefinition.addPart(part);\n        assertTrue(panelDefinition.getParts().contains(part));\n    }\n\n    @Test\n    public void addPartToADifferentPanelChangePanel() throws Exception {\n        assertFalse(panelDefinition.getParts().contains(part));\n        panelDefinition.addPart(part);\n        assertTrue(panelDefinition.getParts().contains(part));\n        otherPanel.addPart(part);\n        assertTrue(otherPanel.getParts().contains(part));\n        assertEquals(otherPanel,\n                     part.getParentPanel());\n        assertFalse(panelDefinition.getParts().contains(part));\n    }\n\n    @Test\n    public void addPartTwiceShouldWork() throws Exception {\n        assertFalse(panelDefinition.getParts().contains(part));\n        panelDefinition.addPart(part);\n        panelDefinition.addPart(part);\n        assertTrue(panelDefinition.getParts().contains(part));\n    }\n\n    @Test\n    public void partShouldNotBePresentAfterRemoval() throws Exception {\n        panelDefinition.addPart(part);\n        assertNotNull(part.getParentPanel());\n        assertTrue(panelDefinition.getParts().contains(part));\n        panelDefinition.removePart(part);\n        assertNull(part.getParentPanel());\n        assertFalse(panelDefinition.getParts().contains(part));\n    }\n\n    @Test\n    public void removeNonexistentPartShouldDoNothingAndReturnFalse() throws Exception {\n        boolean result = panelDefinition.removePart(part);\n        assertEquals(false,\n                     result);\n    }\n\n    @Test\n    public void widthShouldNotRevertOnceSet() throws Exception {\n        assertNull(panelDefinition.getWidth());\n        panelDefinition.setWidth(1234);\n        panelDefinition.setWidth(null);\n        assertEquals((Integer) 1234,\n                     panelDefinition.getWidth());\n    }\n\n    @Test\n    public void heightShouldNotRevertOnceSet() throws Exception {\n        assertNull(panelDefinition.getHeight());\n        panelDefinition.setHeight(1234);\n        panelDefinition.setHeight(null);\n        assertEquals((Integer) 1234,\n                     panelDefinition.getHeight());\n    }\n\n    @Test\n    public void appendChildShouldAddPanelToChildren() {\n        panelDefinition.appendChild(otherPanel);\n        assertTrue(panelDefinition.getChildren().contains(otherPanel));\n        assertEquals(panelDefinition,\n                     otherPanel.getParent());\n    }\n\n    @Test\n    public void appendChildToPanelTwiceShouldWork() {\n        panelDefinition.appendChild(otherPanel);\n        assertTrue(panelDefinition.getChildren().contains(otherPanel));\n        panelDefinition.appendChild(otherPanel);\n        assertTrue(panelDefinition.getChildren().contains(otherPanel));\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/model/impl/PartDefinitionImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.impl;\n\nimport java.util.HashSet;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class PartDefinitionImplTest {\n\n    private PartDefinitionImpl part;\n    private PanelDefinition parent;\n    private PanelDefinition anotherParent;\n\n    @Before\n    public void setUp() throws Exception {\n        PlaceRequest placeRequest = mock(PlaceRequest.class);\n        part = new PartDefinitionImpl(placeRequest);\n        parent = new PanelDefinitionImpl();\n        anotherParent = new PanelDefinitionImpl();\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void defineParentPanelWithOldParent() throws Exception {\n        PanelDefinitionImpl parentMock = createParentMock();\n\n        part.setParentPanel(parentMock);\n        part.setParentPanel(anotherParent);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void defineParentPanelWithOldParentWithoutPart() throws Exception {\n        parent = createParentMock();\n        part.setParentPanel(parent);\n        when(parent.getParts()).thenReturn(new HashSet<PartDefinition>());\n        PanelDefinitionImpl anotherParent = createParentMock();\n        part.setParentPanel(anotherParent);\n    }\n\n    private PanelDefinitionImpl createParentMock() {\n        PanelDefinitionImpl parentMock = mock(PanelDefinitionImpl.class);\n        HashSet<PartDefinition> mockSet = new HashSet<PartDefinition>();\n        mockSet.add(part);\n        when(parentMock.getParts()).thenReturn(mockSet);\n        return parentMock;\n    }\n\n    @Test\n    public void defineParentPanel() throws Exception {\n        PanelDefinitionImpl parentMock = createParentMock();\n        part.setParentPanel(parentMock);\n        assertEquals(parentMock,\n                     part.getParentPanel());\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/model/menu/TestMenuSyntax.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu;\n\n/**\n *\n */\npublic class TestMenuSyntax {\n\n    public static Object main(final String... args) {\n        return MenuFactory\n                .newContributedMenu(\"x\")\n                .contributeTo(\"xx\")\n                .submenu(\"xx\")\n                .menu(\"cc\")\n                .respondsWith(null)\n                .endMenu()\n                .endMenus()\n                .endMenu().\n                        newTopLevelMenu(\"\")\n                .submenu(\"\")\n                .menu(\"xx\")\n                .respondsWith(null)\n                .endMenu()\n                .menu(\"x\")\n                .submenu(\"xxx\")\n                .menu(\"xx\")\n                .respondsWith(null)\n                .endMenu()\n                .endMenus()\n                .submenu(\"xxx\")\n                .menu(\"xx\")\n                .respondsWith(null)\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .newTopLevelMenu(\"x\")\n                .respondsWith(null)\n                .endMenu()\n                .newTopLevelMenu(\"x\")\n                .submenu(\"x\")\n                .menu(\"x\")\n                .respondsWith(null)\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .newTopLevelMenu(\"xx\")\n                .respondsWith(null)\n                .endMenu()\n                .newTopLevelMenu(\"xx\")\n                .withItems(null)\n                .endMenu()\n                .newContributedMenu(\"x\")\n                .contributeTo(\"xx\")\n                .submenu(\"xx\")\n                .menu(\"cc\")\n                .respondsWith(null)\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .build();\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/model/menu/impl/TestBehavior.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.model.menu.impl;\n\nimport org.junit.Test;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.uberfire.workbench.model.menu.MenuFactory.newTopLevelMenu;\n\npublic class TestBehavior {\n\n    private static Command DUMMY = new Command() {\n        @Override\n        public void execute() {\n\n        }\n    };\n\n    @Test\n    public void testSimpleMenu() {\n        final Menus menus = newTopLevelMenu(\"File\")\n                .position(MenuPosition.RIGHT)\n                .menus()\n                .menu(\"Save\")\n                .order(2)\n                .respondsWith(DUMMY)\n                .endMenu()\n                .menu(\"Close\")\n                .respondsWith(DUMMY)\n                .endMenu()\n                .endMenus()\n                .endMenu().build();\n\n        assertThat(menus).isNotNull();\n        assertThat(menus.getItems()).isNotNull().hasSize(1);\n        assertThat(menus.getItems().get(0)).isNotNull();\n        assertThat(menus.getItems().get(0)).isInstanceOf(MenuGroup.class);\n        assertThat(menus.getItems().get(0).getPosition()).isEqualTo(MenuPosition.RIGHT);\n        assertThat(menus.getItems().get(0).getCaption()).isEqualTo(\"File\");\n        assertThat(((MenuGroup) menus.getItems().get(0)).getItems()).hasSize(2);\n\n        {\n            final MenuItem menuItem = ((MenuGroup) menus.getItems().get(0)).getItems().get(0);\n            assertThat(menuItem).isNotNull();\n            assertThat(menuItem.getCaption()).isEqualTo(\"Save\");\n            assertThat(menuItem.getOrder()).isEqualTo(2);\n        }\n        {\n            final MenuItem menuItem = ((MenuGroup) menus.getItems().get(0)).getItems().get(1);\n            assertThat(menuItem).isNotNull();\n            assertThat(menuItem.getCaption()).isEqualTo(\"Close\");\n        }\n    }\n\n    @Test\n    public void testSimpleNestedMenu() {\n        final Menus menus = newTopLevelMenu(\"File\")\n                .menus()\n                .menu(\"Operations\")\n                .menus()\n                .menu(\"Save\")\n                .respondsWith(DUMMY)\n                .endMenu()\n                .menu(\"Close\")\n                .respondsWith(DUMMY)\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .endMenus()\n                .endMenu()\n                .newTopLevelMenu(\"Explore\")\n                .respondsWith(DUMMY)\n                .endMenu()\n                .build();\n\n        assertThat(menus).isNotNull();\n        assertThat(menus.getItems()).isNotNull().hasSize(2);\n        {\n            assertThat(menus.getItems().get(0)).isNotNull();\n            assertThat(menus.getItems().get(0)).isInstanceOf(MenuGroup.class);\n            assertThat(menus.getItems().get(0).getCaption()).isEqualTo(\"File\");\n            assertThat(((MenuGroup) menus.getItems().get(0)).getItems()).hasSize(1);\n\n            {\n                final MenuItem menuItem = ((MenuGroup) menus.getItems().get(0)).getItems().get(0);\n                assertThat(menuItem).isNotNull();\n                assertThat(menuItem.getCaption()).isEqualTo(\"Operations\");\n                assertThat(menuItem).isInstanceOf(MenuGroup.class);\n\n                {\n                    final MenuItem subMenuItem = ((MenuGroup) menuItem).getItems().get(0);\n                    assertThat(subMenuItem).isNotNull();\n                    assertThat(subMenuItem.getCaption()).isEqualTo(\"Save\");\n                }\n\n                {\n                    final MenuItem subMenuItem = ((MenuGroup) menuItem).getItems().get(1);\n                    assertThat(subMenuItem).isNotNull();\n                    assertThat(subMenuItem.getCaption()).isEqualTo(\"Close\");\n                }\n            }\n\n            assertThat(menus.getItems().get(1)).isNotNull();\n            assertThat(menus.getItems().get(1)).isInstanceOf(MenuItemCommand.class);\n            assertThat(menus.getItems().get(1).getCaption()).isEqualTo(\"Explore\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-api/src/test/java/org/uberfire/workbench/type/FileNameUtilTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.workbench.type;\n\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.uberfire.workbench.type.FileNameUtil.removeExtension;\nimport static org.junit.Assert.assertEquals;\n\npublic class FileNameUtilTest {\n\n    @Test\n    public void removeExtensionFromFileNameTest() {\n        assertNull(removeExtension((String) null, \".java\"));\n        assertEquals(\"file.java\", removeExtension(\"file.java\", null));\n        assertEquals(\"file.java\", removeExtension(\"file.java\", \"\"));\n        assertEquals(\"file\", removeExtension(\"file.java\", \"java\"));\n    }\n\n    @Test\n    public void removeExtensionFromPathTest() {\n        final Path path = mock(Path.class);\n        doReturn(\"file.java\").when(path).getFileName();\n\n        assertNull(removeExtension((Path) null, \".java\"));\n        assertEquals(\"file.java\", removeExtension(path, (String) null));\n        assertEquals(\"file.java\", removeExtension(path, \"\"));\n        assertEquals(\"file\", removeExtension(path, \"java\"));\n    }\n\n    @Test\n    public void removeResourceTypeDefinitionSuffixFromPathTest() {\n        final Path path = mock(Path.class);\n        doReturn(\"file.java\").when(path).getFileName();\n\n        final ResourceTypeDefinition resourceTypeDefinition = mock(ResourceTypeDefinition.class);\n        doReturn(\"java\").when(resourceTypeDefinition).getSuffix();\n\n        assertNull(removeExtension((Path) null, \".java\"));\n        assertEquals(\"file\", removeExtension(path, resourceTypeDefinition));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-backend</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire Backend</name>\n\n  <modules>\n    <module>uberfire-backend-api</module>\n    <module>uberfire-backend-server</module>\n    <module>uberfire-backend-cdi</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-backend-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Backend API</name>\n  <description>UberFire Backend API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/authz/AuthorizationPolicyStorage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.authz;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.security.authz.AuthorizationPolicy;\n\n/**\n * Provides methods to manipulate the AuthorizationPolicy instance stored into the Uberfire's virtual file system.\n */\npublic interface AuthorizationPolicyStorage {\n\n    /**\n     * Retrieves the current {@link AuthorizationPolicy} instance from the backend storage.\n     * @return The stored {@link AuthorizationPolicy} instance or null if no policy exists.\n     */\n    AuthorizationPolicy loadPolicy();\n\n    /**\n     * Overwrites the content of the {@link AuthorizationPolicy} instance stored in the backend\n     * by the contents of the instance passed as a parameter.\n     * @param policy The authorization policy to store\n     */\n    void savePolicy(AuthorizationPolicy policy);\n\n    /**\n     * Deletes the group from  {@link AuthorizationPolicy} instance stored in the backend\n     * @param policy The authorization policy to store\n     * @param group Group instance\n     */\n    void deletePolicyByGroup(Group group, AuthorizationPolicy policy);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/authz/AuthorizationService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.authz;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.security.authz.AuthorizationPolicy;\n\n/**\n * Provides methods to manipulate the AuthorizationPolicy instance stored in the Uberfire's virtual file system.\n */\n@Remote\npublic interface AuthorizationService {\n\n    /**\n     * Retrieves the current {@link AuthorizationPolicy} instance from the backend storage.\n     * @return The stored {@link AuthorizationPolicy} instance\n     */\n    AuthorizationPolicy loadPolicy();\n\n    /**\n     * Overwrites the content of the {@link AuthorizationPolicy} instance stored in the backend\n     * by the contents of the instance passed as a parameter.\n     * @param policy The authorization policy to store\n     */\n    void savePolicy(AuthorizationPolicy policy);\n\n    /**\n     * Deletes the group from {@link AuthorizationPolicy} instance stored in the backend\n     * @param policy The authorization policy to store\n     * @param group Group instance\n     */\n    void deletePolicyByGroup(Group group , AuthorizationPolicy policy);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/authz/FileSystemResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.authz;\n\nimport org.uberfire.security.ResourceType;\n\n/**\n * The file system resource type definition.\n */\npublic class FileSystemResourceType implements ResourceType {\n\n    @Override\n    public String getName() {\n        return \"filesystem\";\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/cdi/workspace/Workspace.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.cdi.workspace;\n\n/**\n * Represents a workspace. Every WorkspaceScoped bean instance has a relationship with a workspace. Workspaces right now\n * has a one-to-one relationship with a user, so I can't exists more than a workspace per user.\n */\npublic interface Workspace {\n\n    /**\n     * Returns the workspace name. At this moment is the username.\n     * @return the workspace name.\n     */\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/events/AuthorizationPolicyDeployedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.events;\n\nimport org.uberfire.security.authz.AuthorizationPolicy;\n\n/**\n * Event fired just after the deployment of the security policy. See backend implementation\n * <i>AuthorizationPolicyDeployer</i>.\n */\npublic class AuthorizationPolicyDeployedEvent {\n\n    private AuthorizationPolicy policy;\n\n    public AuthorizationPolicyDeployedEvent() {\n    }\n\n    public AuthorizationPolicyDeployedEvent(AuthorizationPolicy policy) {\n        this.policy = policy;\n    }\n\n    public AuthorizationPolicy getPolicy() {\n        return policy;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/events/AuthorizationPolicySavedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.commons.clusterapi.Clustered;\nimport org.uberfire.security.authz.AuthorizationPolicy;\n\n/**\n * Event fired just after the security policy is saved. See\n * {@link AuthorizationPolicyStorage#savePolicy(AuthorizationPolicy)}\n */\n@Portable\n@Clustered\npublic class AuthorizationPolicySavedEvent {\n\n    private AuthorizationPolicy policy;\n\n    public AuthorizationPolicySavedEvent() {\n    }\n\n    public AuthorizationPolicySavedEvent(@MapsTo(\"policy\") AuthorizationPolicy policy) {\n        this.policy = policy;\n    }\n\n    public AuthorizationPolicy getPolicy() {\n        return policy;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/fs/FileSystemService.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.fs;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface FileSystemService {\n\n    Boolean isGitDefaultFileSystem();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/plugin/PluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.plugin;\n\n/**\n * A simple marker to keep track of all plugins processors.\n */\npublic interface PluginProcessor {\n\n    /**\n     * Checks if a plugin file has the valid extension\n     * @param fileName the file name of the plugin\n     */\n    static boolean isAValidPluginFileExtension(String fileName) {\n\n        for (PluginProcessorType type : PluginProcessorType.values()) {\n            if (fileName.endsWith(type.getExtension())) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Checks if this processor should process a given plugin\n     * @param pluginName the name of the plugin, must not be null.\n     */\n    boolean shouldProcess(String pluginName);\n\n    /**\n     * Removes all plugins from this processor.\n     */\n    void removeAll();\n\n    /**\n     * Processes a deployed plugin and optionally notifies clients\n     * @param pluginName the name of the plugin, must not be null.\n     * @param pluginDeploymentDir the directory to deploy plugin contents to, must not be null.\n     * @param notifyClients trigger a event after plugin processing\n     */\n    void process(String pluginName,\n                 String pluginDeploymentDir,\n                 boolean notifyClients);\n\n    /**\n     * Checks if a plugin with the given name is registered.\n     * @param pluginName the name of the plugin, must not be null.\n     * @return true if registered, otherwise false.\n     */\n    boolean isRegistered(String pluginName);\n\n    enum PluginProcessorType {\n        GWT(\"nocache.js\",\n            false),\n        PERSPECTIVE_EDITOR(\"layout.json\",\n                           true),\n        HTML_TEMPLATE(\".html\",\n                      true),\n        JS(\".js\",\n           true);\n\n        private String extension;\n        private boolean isRuntimePlugin;\n\n        PluginProcessorType(String extension,\n                            boolean isRuntimePlugin) {\n            this.extension = extension;\n            this.isRuntimePlugin = isRuntimePlugin;\n        }\n\n        public String getExtension() {\n            return extension;\n        }\n\n        public boolean isRuntimePlugin() {\n            return isRuntimePlugin;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/plugin/RuntimePlugin.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.plugin;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RuntimePlugin {\n\n    private PluginProcessor.PluginProcessorType type;\n    private String pluginName;\n    private String pluginContent;\n\n    public RuntimePlugin() {\n    }\n\n    public RuntimePlugin(PluginProcessor.PluginProcessorType type,\n                         String pluginName,\n                         String pluginContent) {\n\n        this.type = type;\n        this.pluginName = pluginName;\n        this.pluginContent = pluginContent;\n    }\n\n    public PluginProcessor.PluginProcessorType getType() {\n        return type;\n    }\n\n    public String getPluginContent() {\n        return pluginContent;\n    }\n\n    public String getPluginName() {\n        return pluginName;\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/plugin/RuntimePluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.plugin;\n\nimport java.util.Collection;\n\n/**\n * A simple marker to keep track of all runtime plugins processors.\n */\npublic interface RuntimePluginProcessor extends PluginProcessor {\n\n    /**\n     * Returns all available runtime plugins\n     */\n    Collection<RuntimePlugin> getAvailableRuntimePlugins();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/plugin/RuntimePluginService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.plugin;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface RuntimePluginService {\n\n    Collection<String> listFrameworksContent();\n\n    Collection<String> listPluginsContent();\n\n    String getTemplateContent(final String url);\n\n    String getRuntimePluginTemplateContent(String url);\n\n    List<RuntimePlugin> getRuntimePlugins();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/BasicFileAttributes.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.Date;\n\npublic interface BasicFileAttributes {\n\n    Date lastModifiedTime();\n\n    Date lastAccessTime();\n\n    Date creationTime();\n\n    boolean isRegularFile();\n\n    boolean isDirectory();\n\n    long size();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/DirectoryStream.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport org.uberfire.java.nio.IOException;\n\npublic interface DirectoryStream<T> extends Iterable<T> {\n\n    public static interface Filter<T> {\n\n        boolean accept(T entry) throws IOException;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/FileSystemFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.uberfire.backend.vfs.PathFactory.newPath;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n *\n */\npublic final class FileSystemFactory {\n\n    private FileSystemFactory() {\n\n    }\n\n    public static FileSystem newFS(final Map<String, String> roots,\n                                   final Set<String> supportedViews) {\n        return new FileSystemImpl(roots,\n                                  supportedViews);\n    }\n\n    @Portable\n    public static class FileSystemImpl implements FileSystem {\n\n        private List<Path> rootDirectories = null;\n        private Set<String> supportedViews = null;\n\n        public FileSystemImpl() {\n        }\n\n        public FileSystemImpl(final Map<String, String> roots,\n                              final Set<String> supportedViews) {\n            checkNotNull(\"roots\",\n                         roots);\n\n            this.rootDirectories = new ArrayList<Path>(roots.size());\n\n            for (final Map.Entry<String, String> entry : roots.entrySet()) {\n                this.rootDirectories.add(newPath(entry.getValue(),\n                                                 entry.getKey()));\n            }\n            this.supportedViews = new HashSet<String>(checkNotNull(\"supportedViews\",\n                                                                   supportedViews));\n        }\n\n        @Override\n        public List<Path> getRootDirectories() {\n            return rootDirectories;\n        }\n\n        @Override\n        public Set<String> supportedFileAttributeViews() {\n            return supportedViews;\n        }\n\n        @Override\n        public String toString() {\n            final StringBuilder sb = new StringBuilder();\n            if (rootDirectories != null) {\n                for (final Path rootDirectory : rootDirectories) {\n                    sb.append(rootDirectory.toString());\n                }\n            }\n            return sb.toString();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/VFSLockService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.java.nio.IOException;\n\n/**\n * Provides methods to manage locks in UberFire's virtual file system.\n */\n@Remote\npublic interface VFSLockService {\n\n    /**\n     * Creates a lock file for the specified {@link Path}, to be held by the\n     * currently authenticated user. If successful, this method associates the\n     * created lock with the user's HTTP session so locks can automatically be\n     * released when the session ends, expires or is destroyed.\n     * @param path the path of the file or directory to lock.\n     * @return the {@link LockResult}, indicating success or failure and\n     * containing the last read {@link LockInfo}.\n     * @throws IllegalArgumentException If the provided path is invalid or null.\n     * @throws IOException If a lock file can't be written or an existing lock can't be\n     * read.\n     */\n    LockResult acquireLock(Path path)\n            throws IllegalArgumentException, IOException;\n\n    /**\n     * Deletes the lock file for the specified {@link Path}. The requesting user\n     * needs to own the lock for this operation to succeed.\n     * @param path the path of the file or directory currently assumed locked.\n     * @return the {@link LockResult}, indicating success or failure and\n     * containing the last read {@link LockInfo}.\n     * @throws IllegalArgumentException If the provided path is invalid or null.\n     * @throws IOException If a lock file can't be deleted or an existing lock can't be\n     * read.\n     */\n    LockResult releaseLock(Path path)\n            throws IllegalArgumentException, IOException;\n\n    /**\n     * Deletes the lock file for the specified {@link Path} even if the requesting\n     * user does not own the lock.\n     * @param path the path of the file or directory currently assumed locked.\n     * @return the {@link LockResult}, indicating success or failure and\n     * containing the last read {@link LockInfo}.\n     * @throws IllegalArgumentException If the provided path is invalid or null.\n     * @throws IOException If a lock file can't be deleted or an existing lock can't be\n     * read.\n     */\n    LockResult forceReleaseLock(Path path)\n            throws IllegalArgumentException, IOException;\n\n    /**\n     * Retrieves the lock information for the specified {@link Path}.\n     * @param path the path of the file or directory.\n     * @return the {@link LockInfo} for the provided {@link Path}.\n     * @throws IllegalArgumentException If the provided path is invalid or null.\n     * @throws IOException If a lock file can't be read.\n     */\n    LockInfo retrieveLockInfo(Path path)\n            throws IllegalArgumentException, IOException;\n\n    /**\n     * Retrieves all locks for children (files or directories) of the provided\n     * path.\n     * @param path the path of the directory.\n     * @param excludeOwnedLocks filters the resulting list so it doesn't contain locks owned\n     * by the currently authenticated user.\n     * @return the list of {@link LockInfo}s for children of the provided path\n     * that are currently locked, or an empty list if no such locks\n     * exist.\n     * @throws IllegalArgumentException If the provided path is invalid or null.\n     * @throws IOException If a lock file can't be read.\n     */\n    List<LockInfo> retrieveLockInfos(Path path,\n                                     boolean excludeOwnedLocks)\n            throws IllegalArgumentException, IOException;\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/VFSService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.jboss.errai.common.client.api.interceptor.InterceptedCall;\nimport org.uberfire.backend.vfs.impl.VFSCacheInterceptor;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\n\n@Remote\npublic interface VFSService {\n\n    Path get(String uri);\n\n    DirectoryStream<Path> newDirectoryStream(final Path dir)\n            throws IllegalArgumentException, NotDirectoryException, IOException;\n\n    DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                             final DirectoryStream.Filter<Path> filter)\n            throws IllegalArgumentException, NotDirectoryException, IOException;\n\n    Path createDirectory(final Path dir)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException;\n\n    Path createDirectories(final Path dir)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException;\n\n    Path createDirectory(final Path dir,\n                         final Map<String, ?> attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException;\n\n    Path createDirectories(final Path dir,\n                           final Map<String, ?> attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException;\n\n    @InterceptedCall(VFSCacheInterceptor.class)\n    Map<String, Object> readAttributes(final Path path)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException;\n\n    void setAttributes(final Path path,\n                       final Map<String, Object> attrs)\n            throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException;\n\n    void delete(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException;\n\n    boolean deleteIfExists(final Path path)\n            throws IllegalArgumentException, DirectoryNotEmptyException, IOException;\n\n    Path copy(final Path source,\n              final Path target)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, IOException;\n\n    Path move(final Path source,\n              final Path target)\n            throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException;\n\n    String readAllString(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, IOException;\n\n    Path write(final Path path,\n               final String content)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Map<String, ?> attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    boolean isRegularFile(final String uri);\n\n    boolean isRegularFile(final Path path);\n\n    boolean isDirectory(final String uri);\n\n    boolean isDirectory(final Path path);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/impl/DirectoryStreamImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.NoSuchElementException;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.DirectoryStream;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class DirectoryStreamImpl implements DirectoryStream<Path> {\n\n    private List<Path> content;\n\n    public DirectoryStreamImpl(@MapsTo(\"content\") final List<Path> content) {\n        this.content = new ArrayList<Path>(content);\n    }\n\n    @Override\n    public Iterator<Path> iterator() {\n        return new Iterator<Path>() {\n            private int i = 0;\n\n            @Override\n            public boolean hasNext() {\n                return i < content.size();\n            }\n\n            @Override\n            public Path next() {\n                if (i < content.size()) {\n                    final Path result = content.get(i);\n                    i++;\n                    return result;\n                } else {\n                    throw new NoSuchElementException();\n                }\n            }\n\n            @Override\n            public void remove() {\n                throw new UnsupportedOperationException();\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/backend/vfs/impl/VFSCacheInterceptor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs.impl;\n\nimport org.jboss.errai.bus.client.api.interceptor.RpcInterceptor;\nimport org.jboss.errai.common.client.api.interceptor.RemoteCallContext;\nimport org.uberfire.backend.vfs.PathFactory;\n\npublic class VFSCacheInterceptor implements RpcInterceptor {\n\n    @Override\n    public void aroundInvoke(final RemoteCallContext context) {\n        final Object o = context.getParameters()[0];\n        if (o instanceof PathFactory.PathImpl && ((PathFactory.PathImpl) o).getAttributes().size() > 0) {\n            context.setResult(((PathFactory.PathImpl) o).getAttributes());\n            return;\n        }\n\n        context.proceed();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/java/org/uberfire/workbench/services/WorkbenchServices.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.workbench.services;\n\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n/**\n * Workbench services\n */\n@Remote\npublic interface WorkbenchServices {\n\n    void save(String perspectiveId,\n              final PerspectiveDefinition perspective);\n\n    void save(final SplashScreenFilter splashFilter);\n\n    Set<PerspectiveDefinition> loadPerspectives();\n\n    PerspectiveDefinition loadPerspective(final String perspectiveId);\n\n    void removePerspectiveState(final String perspectiveId);\n\n    void removePerspectiveStates();\n\n    SplashScreenFilter loadSplashScreenFilter(final String filterName);\n\n    Map<String, String> loadDefaultEditorsMap();\n\n    void saveDefaultEditors(Map<String, String> properties);\n\n    boolean isWorkbenchOnCluster();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\nerrai.marshalling.serializableTypes=org.uberfire.java.nio.IOException \\\n                                    org.uberfire.java.nio.file.AccessDeniedException \\\n                                    org.uberfire.java.nio.file.AtomicMoveNotSupportedException \\\n                                    org.uberfire.java.nio.file.ClosedWatchServiceException \\\n                                    org.uberfire.java.nio.file.DirectoryNotEmptyException \\\n                                    org.uberfire.java.nio.file.FileAlreadyExistsException \\\n                                    org.uberfire.java.nio.file.FileSystemAlreadyExistsException \\\n                                    org.uberfire.java.nio.file.FileSystemException \\\n                                    org.uberfire.java.nio.file.FileSystemNotFoundException \\\n                                    org.uberfire.java.nio.file.InvalidPathException \\\n                                    org.uberfire.java.nio.file.NoSuchFileException \\\n                                    org.uberfire.java.nio.file.NotDirectoryException \\\n                                    org.uberfire.java.nio.file.NotLinkException \\\n                                    org.uberfire.java.nio.file.PatternSyntaxException \\\n                                    org.uberfire.java.nio.file.ProviderNotFoundException\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/main/resources/org/uberfire/UberfireBackend.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name='org.uberfire.java.nio.UberfireNIO2Model'/>\n  <inherits name='org.uberfire.preferences.UberfirePreferencesAPI'/>\n  <source path='backend'>\n    <exclude name=\"server/**\"/>\n  </source>\n  <source path='workbench'/>\n\n</module>"
  },
  {
    "path": "uberfire-backend/uberfire-backend-api/src/test/java/org/uberfire/backend/vfs/PathTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.vfs;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.uberfire.backend.vfs.PathFactory.newPath;\n\npublic class PathTest {\n\n    @Test\n    public void generalState() {\n        {\n            final Path path = newPath(\"resource\",\n                                      \"scheme://path/to/some/resource\");\n            assertThat(path).isEqualTo(path);\n            assertThat(path).isEqualTo(newPath(\"resource\",\n                                               \"scheme://path/to/some/resource\"));\n            assertThat(path.hashCode()).isEqualTo(newPath(\"resource\",\n                                                          \"scheme://path/to/some/resource\").hashCode());\n            assertThat(path.hashCode()).isEqualTo(path.hashCode());\n        }\n\n        {\n            final Path path = newPath(\"resource\",\n                                      \"scheme://different/path/to/some/resource\");\n            assertThat(path.equals(newPath(\"resource\",\n                                           \"scheme://path/to/some/resource\"))).isFalse();\n            assertThat(path.hashCode()).isNotEqualTo(newPath(\"resource\",\n                                                             \"scheme://path/to/some/resource\").hashCode());\n        }\n\n        {\n            final Path path = newPath(\"resource\",\n                                      \"scheme://different/path/to/some/resource\");\n            assertThat(path.equals(\"something\")).isFalse();\n            assertThat(path.equals(null)).isFalse();\n        }\n    }\n\n    @Test\n    public void checkNPE() {\n        final Map<Path, String> hashMap = new HashMap<>();\n        final Path path = newPath(\"defaultPackage\",\n                                  \"default://guvnor-jcr2vfs-migration/defaultPackage/\");\n        hashMap.put(path,\n                    \"content\");\n        assertThat(hashMap.get(path)).isEqualTo(\"content\");\n\n        assertThat(hashMap.get(newPath(\"defaultPackage\",\n                                       \"default://guvnor-jcr2vfs-migration/defaultPackage/\"))).isEqualTo(\"content\");\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-backend-cdi</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Backend CDI Extensions</name>\n  <description>UberFire Backend CDI Extensions</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.interceptor</groupId>\n      <artifactId>jakarta.interceptor-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.annotation</groupId>\n          <artifactId>javax.annotation-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n        <groupId>xalan</groupId>\n        <artifactId>xalan</artifactId>\n    </dependency>\n\n    <dependency>\n        <groupId>xalan</groupId>\n        <artifactId>serializer</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.el</groupId>\n      <artifactId>jakarta.el-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.arquillian.junit</groupId>\n      <artifactId>arquillian-junit-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.arquillian.junit</groupId>\n      <artifactId>arquillian-junit-container</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.arquillian.container</groupId>\n      <artifactId>arquillian-container-test-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.arquillian.container</groupId>\n      <artifactId>arquillian-weld-se-embedded-1.1</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.shrinkwrap</groupId>\n      <artifactId>shrinkwrap-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>io.netty</groupId>\n          <artifactId>netty-all</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-jboss</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/AlternativeStarterBean.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport javax.annotation.PostConstruct;\nimport javax.ejb.Singleton;\nimport javax.ejb.Startup;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startable;\n\n@Singleton\n@Startup\npublic class AlternativeStarterBean {\n\n    private static final Logger logger = LoggerFactory.getLogger(AlternativeStarterBean.class);\n\n    private static final String EJB_METHOD = \"ejb\";\n    private static final String START_METHOD = System.getProperty(\"org.uberfire.start.method\",\n                                                                  \"cdi\");\n\n    @Inject\n    private Instance<Startable> startableBeans;\n\n    @PostConstruct\n    public void configure() {\n        if (EJB_METHOD.equals(START_METHOD)) {\n            logger.debug(\"Starting all beans defined as startable...\");\n            if (!startableBeans.isUnsatisfied()) {\n                for (Startable startableBean : startableBeans) {\n                    startableBean.start();\n                }\n            }\n            logger.info(\"All startable beans properly started\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/SystemConfigProducer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport java.lang.annotation.Annotation;\nimport java.lang.reflect.Type;\nimport java.net.URI;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Default;\nimport javax.enterprise.inject.spi.AfterBeanDiscovery;\nimport javax.enterprise.inject.spi.AfterDeploymentValidation;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.enterprise.inject.spi.Extension;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.enterprise.inject.spi.InjectionTarget;\nimport javax.enterprise.inject.spi.ProcessAnnotatedType;\nimport javax.enterprise.inject.spi.ProcessBean;\nimport javax.enterprise.inject.spi.ProcessProducer;\nimport javax.enterprise.inject.spi.WithAnnotations;\nimport javax.enterprise.util.AnnotationLiteral;\nimport javax.inject.Named;\nimport javax.inject.Singleton;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.commons.services.cdi.Startable;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.commons.services.cdi.Veto;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceNio2WrapperImpl;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.LockableFileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.PathMatcher;\nimport org.uberfire.java.nio.file.PatternSyntaxException;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\npublic class SystemConfigProducer implements Extension {\n\n    private static final Logger logger = LoggerFactory.getLogger(SystemConfigProducer.class);\n\n    private static final String CDI_METHOD = \"cdi\";\n\n    private static final String START_METHOD = System.getProperty(\"org.uberfire.start.method\",\n                                                                  \"cdi\");\n    protected static final String SYSTEM = \"system\";\n\n    private final List<OrderedBean> startupEagerBeans = new LinkedList<>();\n    private final List<OrderedBean> startupBootstrapBeans = new LinkedList<>();\n    private final Comparator<OrderedBean> priorityComparator = (o1, o2) -> o1.priority - o2.priority;\n    private boolean systemFSNotExists = true;\n    private boolean pluginsFSNotExists = true;\n    private boolean perspectivesFSNotExists = true;\n    private boolean datasetsFSNotExists = true;\n    private boolean navigationFSNotExists = true;\n    private boolean ioStrategyBeanNotFound = true;\n\n    public void processSystemFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"systemFS\")) {\n            systemFSNotExists = false;\n        }\n    }\n\n    public void processPluginsFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"pluginsFS\")) {\n            pluginsFSNotExists = false;\n        }\n    }\n\n    public void processPerspectivesFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"perspectivesFS\")) {\n            perspectivesFSNotExists = false;\n        }\n    }\n\n    public void processDatasetsFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"datasetsFS\")) {\n            datasetsFSNotExists = false;\n        }\n    }\n\n    public void processNavigationFSProducer(@Observes ProcessProducer<?, FileSystem> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"navigationFS\")) {\n            navigationFSNotExists = false;\n        }\n    }\n\n    public void processIOServiceProducer(@Observes ProcessProducer<?, IOService> pp) {\n        if (pp.getAnnotatedMember().getJavaMember().getName().equals(\"ioStrategy\")) {\n            ioStrategyBeanNotFound = false;\n        }\n    }\n\n    public <X> void processBean(@Observes final ProcessBean<X> event) {\n        if (event.getBean().getName() != null && event.getBean().getName().equals(\"systemFS\")) {\n            systemFSNotExists = false;\n        } else if (event.getBean().getName() != null && event.getBean().getName().equals(\"pluginsFS\")) {\n            pluginsFSNotExists = false;\n        } else if (event.getBean().getName() != null && event.getBean().getName().equals(\"perspectivesFS\")) {\n            perspectivesFSNotExists = false;\n        } else if (event.getBean().getName() != null && event.getBean().getName().equals(\"datasetsFS\")) {\n            datasetsFSNotExists = false;\n        } else if (event.getBean().getName() != null && event.getBean().getName().equals(\"navigationFS\")) {\n            navigationFSNotExists = false;\n        } else if (event.getBean().getName() != null && event.getBean().getName().equals(\"ioStrategy\")) {\n            ioStrategyBeanNotFound = false;\n        }\n        if (event.getAnnotated().isAnnotationPresent(Startup.class) && (event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)\n                || event.getAnnotated().isAnnotationPresent(Singleton.class))) {\n            final Startup startupAnnotation = event.getAnnotated().getAnnotation(Startup.class);\n            final StartupType type = startupAnnotation.value();\n            final int priority = startupAnnotation.priority();\n            final Bean<?> bean = event.getBean();\n            switch (type) {\n                case EAGER:\n                    startupEagerBeans.add(new OrderedBean(bean,\n                                                          priority));\n                    break;\n                case BOOTSTRAP:\n                    startupBootstrapBeans.add(new OrderedBean(bean,\n                                                              priority));\n                    break;\n            }\n        } else if (event.getAnnotated().isAnnotationPresent(Named.class) && (event.getAnnotated().isAnnotationPresent(ApplicationScoped.class)\n                || event.getAnnotated().isAnnotationPresent(Singleton.class))) {\n            final Named namedAnnotation = event.getAnnotated().getAnnotation(Named.class);\n\n            if (namedAnnotation.value().endsWith(\"-startable\")) {\n                final Bean<?> bean = event.getBean();\n                startupBootstrapBeans.add(new OrderedBean(bean,\n                                                          10));\n            }\n        }\n    }\n\n    public void afterDeploymentValidation(final @Observes AfterDeploymentValidation event,\n                                          final BeanManager manager) {\n        if (CDI_METHOD.equalsIgnoreCase(START_METHOD)) {\n            //Force execution of Bootstrap bean's @PostConstruct methods first\n            runPostConstruct(manager,\n                             startupBootstrapBeans);\n\n            //Followed by execution of remaining Eager bean's @PostConstruct methods\n            runPostConstruct(manager,\n                             startupEagerBeans);\n        }\n    }\n\n    private void runPostConstruct(final BeanManager manager,\n                                  final List<OrderedBean> orderedBeans) {\n        //Sort first, by priority\n        Collections.sort(orderedBeans,\n                         priorityComparator);\n        for (OrderedBean ob : orderedBeans) {\n            // the call to toString() is a cheat to force the bean to be initialized\n            final Bean<?> bean = ob.bean;\n            manager.getReference(bean,\n                                 bean.getBeanClass(),\n                                 manager.createCreationalContext(bean)).toString();\n        }\n    }\n\n    <T> void processAnnotatedType(@Observes @WithAnnotations(Veto.class) ProcessAnnotatedType<T> pat) {\n        pat.veto();\n    }\n\n    void afterBeanDiscovery(@Observes final AfterBeanDiscovery abd,\n                            final BeanManager bm) {\n\n        if (systemFSNotExists) {\n            buildSystemFS(abd,\n                          bm);\n        }\n\n        if (ioStrategyBeanNotFound) {\n            buildIOStrategy(abd,\n                            bm);\n        }\n\n        if (perspectivesFSNotExists) {\n            buildPerspectivesFS(abd,\n                                bm);\n        }\n\n        if (datasetsFSNotExists) {\n            buildDatasetsFS(abd,\n                            bm);\n        }\n\n        if (navigationFSNotExists) {\n            buildNavigationFS(abd,\n                              bm);\n        }\n\n        if (pluginsFSNotExists) {\n            buildPluginsFS(abd,\n                           bm);\n        }\n\n        if (!CDI_METHOD.equalsIgnoreCase(START_METHOD)) {\n            buildStartableBean(abd,\n                               bm);\n        }\n    }\n\n    void buildPluginsFS(final AfterBeanDiscovery abd,\n                        final BeanManager bm) {\n        final InjectionTarget<DummyFileSystem> it = bm.createInjectionTarget(bm.createAnnotatedType(DummyFileSystem.class));\n\n        abd.addBean(createFileSystemBean(bm,\n                                         it,\n                                         SpacesAPI.DEFAULT_SPACE,\n                                         \"ioStrategy\",\n                                         \"pluginsFS\",\n                                         \"plugins\"));\n    }\n\n    void buildPerspectivesFS(final AfterBeanDiscovery abd,\n                             final BeanManager bm) {\n        final InjectionTarget<DummyFileSystem> it = bm.createInjectionTarget(bm.createAnnotatedType(DummyFileSystem.class));\n\n        abd.addBean(createFileSystemBean(bm,\n                                         it,\n                                         SpacesAPI.DASHBUILDER_SPACE,\n                                         \"ioStrategy\",\n                                         \"perspectivesFS\",\n                                         \"perspectives\"));\n    }\n\n    void buildDatasetsFS(final AfterBeanDiscovery abd,\n                         final BeanManager bm) {\n        final InjectionTarget<DummyFileSystem> it = bm.createInjectionTarget(bm.createAnnotatedType(DummyFileSystem.class));\n\n        abd.addBean(createFileSystemBean(bm,\n                                         it,\n                                         SpacesAPI.DASHBUILDER_SPACE,\n                                         \"ioStrategy\",\n                                         \"datasetsFS\",\n                                         \"datasets\"));\n    }\n\n    void buildNavigationFS(final AfterBeanDiscovery abd,\n                           final BeanManager bm) {\n        final InjectionTarget<DummyFileSystem> it = bm.createInjectionTarget(bm.createAnnotatedType(DummyFileSystem.class));\n\n        abd.addBean(createFileSystemBean(bm,\n                                         it,\n                                         SpacesAPI.DASHBUILDER_SPACE,\n                                         \"ioStrategy\",\n                                         \"navigationFS\",\n                                         \"navigation\"));\n    }\n\n    void buildSystemFS(final AfterBeanDiscovery abd,\n                       final BeanManager bm) {\n        final InjectionTarget<DummyFileSystem> it = bm.createInjectionTarget(bm.createAnnotatedType(DummyFileSystem.class));\n\n        abd.addBean(createFileSystemBean(bm,\n                                         it,\n                                         SpacesAPI.DEFAULT_SPACE,\n                                         \"configIO\",\n                                         \"systemFS\",\n                                         SYSTEM));\n    }\n\n    Bean<FileSystem> createFileSystemBean(final BeanManager bm,\n                                          final InjectionTarget<DummyFileSystem> it,\n                                          final Space space,\n                                          String ioService,\n                                          String beanName,\n                                          String fsName) {\n        return new Bean<FileSystem>() {\n\n            @Override\n            public Class<?> getBeanClass() {\n                return FileSystem.class;\n            }\n\n            @Override\n            public Set<InjectionPoint> getInjectionPoints() {\n                return it.getInjectionPoints();\n            }\n\n            @Override\n            public String getName() {\n                return beanName;\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n\n                return new HashSet<Annotation>() {{\n                    add(new AnnotationLiteral<Default>() {\n                    });\n                    add(new AnnotationLiteral<Any>() {\n                    });\n                    add(new NamedLiteral(beanName));\n                }};\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return ApplicationScoped.class;\n            }\n\n            @Override\n            public Set<Class<? extends Annotation>> getStereotypes() {\n                return Collections.emptySet();\n            }\n\n            @Override\n            public Set<Type> getTypes() {\n                return new HashSet<Type>() {{\n                    add(FileSystem.class);\n                    add(LockableFileSystem.class);\n                    add(Object.class);\n                }};\n            }\n\n            @Override\n            public boolean isAlternative() {\n                return false;\n            }\n\n            @Override\n            public boolean isNullable() {\n                return false;\n            }\n\n            @Override\n            public FileSystem create(CreationalContext<FileSystem> ctx) {\n                final SpacesAPI spaces = getSpaces(bm);\n                final Bean<IOService> bean = (Bean<IOService>) bm.getBeans(ioService).iterator().next();\n                final CreationalContext<IOService> _ctx = bm.createCreationalContext(bean);\n                final IOService ioService = (IOService) bm.getReference(bean,\n                                                                        IOService.class,\n                                                                        _ctx);\n\n                FileSystem fs;\n                URI uri = resolveFSURI(spaces, space, fsName);\n                try {\n                    fs = ioService.newFileSystem(\n                            uri,\n                            new HashMap<String, Object>() {{\n                                put(\"init\", Boolean.TRUE);\n                                put(\"internal\", Boolean.TRUE);\n                            }});\n                } catch (FileSystemAlreadyExistsException e) {\n                    fs = ioService.getFileSystem(uri);\n                }\n\n                PriorityDisposableRegistry.register(beanName, fs);\n\n                return fs;\n            }\n\n            @Override\n            public void destroy(final FileSystem instance,\n                                final CreationalContext<FileSystem> ctx) {\n                try {\n                    instance.dispose();\n                    PriorityDisposableRegistry.unregister(beanName);\n                } catch (final Exception ex) {\n                    logger.warn(ex.getMessage(),\n                                ex);\n                }\n                ctx.release();\n            }\n        };\n    }\n\n    URI resolveFSURI(SpacesAPI spaces, Space space, String fsName) {\n\n        return spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                           space,\n                                           fsName);\n    }\n\n    SpacesAPI getSpaces(BeanManager bm) {\n        final Bean<SpacesAPI> spacesBean = (Bean<SpacesAPI>) bm.getBeans(SpacesAPI.class).iterator().next();\n        final CreationalContext<SpacesAPI> spacesCtx = bm.createCreationalContext(spacesBean);\n        return (SpacesAPI) bm.getReference(spacesBean,\n                                           SpacesAPI.class,\n                                           spacesCtx);\n    }\n\n    private void buildIOStrategy(final AfterBeanDiscovery abd,\n                                 final BeanManager bm) {\n\n        final InjectionTarget<IOServiceNio2WrapperImpl> it = bm.createInjectionTarget(bm.createAnnotatedType(IOServiceNio2WrapperImpl.class));\n\n        abd.addBean(new Bean<IOService>() {\n\n            @Override\n            public Class<?> getBeanClass() {\n                return IOService.class;\n            }\n\n            @Override\n            public Set<InjectionPoint> getInjectionPoints() {\n                return it.getInjectionPoints();\n            }\n\n            @Override\n            public String getName() {\n                return \"ioStrategy\";\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n\n                return new HashSet<Annotation>() {{\n                    add(new AnnotationLiteral<Default>() {\n                    });\n                    add(new AnnotationLiteral<Any>() {\n                    });\n                    add(new NamedLiteral(\"ioStrategy\"));\n                }};\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return ApplicationScoped.class;\n            }\n\n            @Override\n            public Set<Class<? extends Annotation>> getStereotypes() {\n                return Collections.emptySet();\n            }\n\n            @Override\n            public Set<Type> getTypes() {\n                return new HashSet<Type>() {{\n                    add(IOService.class);\n                    add(Object.class);\n                }};\n            }\n\n            @Override\n            public boolean isAlternative() {\n                return false;\n            }\n\n            @Override\n            public boolean isNullable() {\n                return false;\n            }\n\n            @Override\n            public IOService create(CreationalContext<IOService> ctx) {\n\n                return new IOServiceNio2WrapperImpl();\n            }\n\n            @Override\n            public void destroy(final IOService instance,\n                                final CreationalContext<IOService> ctx) {\n                ctx.release();\n            }\n        });\n    }\n\n    private <T> T getBean(BeanManager bm,\n                          Class<T> clazz) {\n        final Bean<T> bean = (Bean<T>) bm.getBeans(clazz).iterator().next();\n        return getBeanReference(bm,\n                                clazz,\n                                bean);\n    }\n\n    private <T> T getBean(BeanManager bm,\n                          Class<T> clazz,\n                          Annotation qualifier) {\n        final Bean<T> bean = (Bean<T>) bm.getBeans(clazz,\n                                                   qualifier).iterator().next();\n        return getBeanReference(bm,\n                                clazz,\n                                bean);\n    }\n\n    private <T> T getBeanReference(BeanManager bm,\n                                   Class<T> clazz,\n                                   Bean<T> bean) {\n        final CreationalContext<T> creationalContext = bm.createCreationalContext(bean);\n        return (T) bm.getReference(bean,\n                                   clazz,\n                                   creationalContext);\n    }\n\n    private void buildStartableBean(final AfterBeanDiscovery abd,\n                                    final BeanManager bm) {\n\n        abd.addBean(new Bean<Startable>() {\n\n            @Override\n            public Class<?> getBeanClass() {\n                return Startable.class;\n            }\n\n            @Override\n            public Set<InjectionPoint> getInjectionPoints() {\n                return Collections.emptySet();\n            }\n\n            @Override\n            public String getName() {\n                return \"startablebean\";\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n\n                return new HashSet<Annotation>() {{\n                    add(new AnnotationLiteral<Default>() {\n                    });\n                    add(new AnnotationLiteral<Any>() {\n                    });\n                }};\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return ApplicationScoped.class;\n            }\n\n            @Override\n            public Set<Class<? extends Annotation>> getStereotypes() {\n                return Collections.emptySet();\n            }\n\n            @Override\n            public Set<Type> getTypes() {\n                return new HashSet<Type>() {{\n                    add(Startable.class);\n                    add(Object.class);\n                }};\n            }\n\n            @Override\n            public boolean isAlternative() {\n                return false;\n            }\n\n            @Override\n            public boolean isNullable() {\n                return false;\n            }\n\n            @Override\n            public Startable create(CreationalContext<Startable> ctx) {\n\n                return new Startable() {\n                    @Override\n                    public int hashCode() {\n                        return super.hashCode();\n                    }\n\n                    @Override\n                    public void start() {\n                        //Force execution of Bootstrap bean's @PostConstruct methods first\n                        runPostConstruct(bm,\n                                         startupBootstrapBeans);\n\n                        //Followed by execution of remaining Eager bean's @PostConstruct methods\n                        runPostConstruct(bm,\n                                         startupEagerBeans);\n                    }\n                };\n            }\n\n            @Override\n            public void destroy(final Startable instance,\n                                final CreationalContext<Startable> ctx) {\n\n                ctx.release();\n            }\n        });\n    }\n\n    public static class DummyFileSystem implements FileSystem {\n\n        private FileSystemState state = FileSystemState.NORMAL;\n\n        @Override\n        public FileSystemProvider provider() {\n            return null;\n        }\n\n        @Override\n        public boolean isOpen() {\n            return false;\n        }\n\n        @Override\n        public boolean isReadOnly() {\n            return false;\n        }\n\n        @Override\n        public String getSeparator() {\n            return null;\n        }\n\n        @Override\n        public Iterable<Path> getRootDirectories() {\n            return null;\n        }\n\n        @Override\n        public Iterable<FileStore> getFileStores() {\n            return null;\n        }\n\n        @Override\n        public Set<String> supportedFileAttributeViews() {\n            return null;\n        }\n\n        @Override\n        public Path getPath(String first,\n                            String... more) throws InvalidPathException {\n            return null;\n        }\n\n        @Override\n        public PathMatcher getPathMatcher(String syntaxAndPattern) throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException {\n            return null;\n        }\n\n        @Override\n        public UserPrincipalLookupService getUserPrincipalLookupService() throws UnsupportedOperationException {\n            return null;\n        }\n\n        @Override\n        public WatchService newWatchService() throws UnsupportedOperationException, IOException {\n            return null;\n        }\n\n        @Override\n        public String getName() {\n            return \"DummyFileSystem\";\n        }\n\n        @Override\n        public void close() throws IOException {\n\n        }\n\n        @Override\n        public void dispose() {\n\n        }\n    }\n\n    private class OrderedBean {\n\n        Bean<?> bean;\n        int priority;\n\n        private OrderedBean(final Bean<?> bean,\n                            final int priority) {\n            this.bean = bean;\n            this.priority = priority;\n        }\n    }\n\n    public class NamedLiteral extends AnnotationLiteral<Named> implements Named {\n\n        private final String value;\n\n        public NamedLiteral(String value) {\n            this.value = value;\n        }\n\n        @Override\n        public String value() {\n            return value;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/model/WorkspaceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.model;\n\nimport org.uberfire.backend.cdi.workspace.Workspace;\n\npublic class WorkspaceImpl implements Workspace {\n\n    private final String name;\n\n    public WorkspaceImpl(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (obj instanceof WorkspaceImpl) {\n            return this.getName() == ((WorkspaceImpl) obj).getName() ||\n                    this.getName().equals(((WorkspaceImpl) obj).getName());\n        } else {\n            return super.equals(obj);\n        }\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? name.hashCode() : 0;\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceExecutorService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.TimeoutException;\nimport javax.enterprise.inject.Vetoed;\n\nimport org.uberfire.workspace.WorkspaceContext;\n\n@Vetoed\npublic class WorkspaceExecutorService implements ExecutorService {\n\n    private WorkspaceNameResolver workspaceNameResolver;\n    private ExecutorService executorService;\n\n    public WorkspaceExecutorService() {\n    }\n\n    public WorkspaceExecutorService(WorkspaceNameResolver workspaceNameResolver,\n                                    ExecutorService executorService) {\n        this.workspaceNameResolver = workspaceNameResolver;\n        this.executorService = executorService;\n    }\n\n    private String getWorkspaceName() {\n        return this.getWorkspaceNameResolver().getWorkspaceName();\n    }\n\n    @Override\n    public void shutdown() {\n        getExecutorService().shutdown();\n    }\n\n    @Override\n    public List<Runnable> shutdownNow() {\n        return getExecutorService().shutdownNow();\n    }\n\n    @Override\n    public boolean isShutdown() {\n        return getExecutorService().isShutdown();\n    }\n\n    @Override\n    public boolean isTerminated() {\n        return getExecutorService().isTerminated();\n    }\n\n    @Override\n    public boolean awaitTermination(final long l,\n                                    final TimeUnit timeUnit) throws InterruptedException {\n        return getExecutorService().awaitTermination(l,\n                                                     timeUnit);\n    }\n\n    @Override\n    public <T> Future<T> submit(final Callable<T> callable) {\n\n        return getExecutorService().submit(this.generateCallable(callable));\n    }\n\n    @Override\n    public <T> Future<T> submit(final Runnable runnable,\n                                final T t) {\n        return getExecutorService().submit(this.generateRunnable(runnable),\n                                           t);\n    }\n\n    @Override\n    public Future<?> submit(final Runnable runnable) {\n        return getExecutorService().submit(this.generateRunnable(runnable));\n    }\n\n    @Override\n    public <T> List<Future<T>> invokeAll(final Collection<? extends Callable<T>> collection) throws InterruptedException {\n        return getExecutorService().invokeAll(collection);\n    }\n\n    @Override\n    public <T> List<Future<T>> invokeAll(final Collection<? extends Callable<T>> collection,\n                                         final long l,\n                                         final TimeUnit timeUnit) throws InterruptedException {\n        return getExecutorService().invokeAll(collection,\n                                              l,\n                                              timeUnit);\n    }\n\n    @Override\n    public <T> T invokeAny(final Collection<? extends Callable<T>> collection) throws InterruptedException, ExecutionException {\n        return getExecutorService().invokeAny(collection);\n    }\n\n    @Override\n    public <T> T invokeAny(final Collection<? extends Callable<T>> collection,\n                           final long l,\n                           final TimeUnit timeUnit) throws InterruptedException, ExecutionException, TimeoutException {\n        return getExecutorService().invokeAny(collection,\n                                              l,\n                                              timeUnit);\n    }\n\n    @Override\n    public void execute(final Runnable runnable) {\n        getExecutorService().execute(this.generateRunnable(runnable));\n    }\n\n    private Runnable generateRunnable(final Runnable runnable) {\n\n        String workspace = getWorkspaceName();\n        return () -> {\n            WorkspaceContext.set(workspace);\n            runnable.run();\n        };\n    }\n\n    private <T> Callable<T> generateCallable(final Callable<T> callable) {\n\n        String workspace = getWorkspaceName();\n        return () -> {\n            WorkspaceContext.set(workspace);\n            return callable.call();\n        };\n    }\n\n    private ExecutorService getExecutorService() {\n        return executorService;\n    }\n\n    private WorkspaceNameResolver getWorkspaceNameResolver() {\n        return this.workspaceNameResolver;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceExecutorServiceProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.util.concurrent.ExecutorService;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.Specializes;\nimport javax.inject.Inject;\n\nimport org.uberfire.commons.concurrent.ExecutorServiceProducer;\nimport org.uberfire.commons.concurrent.Managed;\n\npublic class WorkspaceExecutorServiceProducer extends ExecutorServiceProducer {\n\n    private WorkspaceNameResolver workspaceNameResolver;\n\n    @Inject\n    public WorkspaceExecutorServiceProducer(WorkspaceNameResolver workspaceNameResolver) {\n        this.workspaceNameResolver = workspaceNameResolver;\n    }\n\n    @Produces\n    @ApplicationScoped\n    @Managed\n    @Specializes\n    @Override\n    public ExecutorService produceExecutorService() {\n        return new WorkspaceExecutorService(workspaceNameResolver,\n                                            this.getManagedExecutorService());\n    }\n\n    protected WorkspaceNameResolver getWorkspaceNameResolver() {\n        return workspaceNameResolver;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.util.NoSuchElementException;\nimport java.util.Optional;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.TimeUnit;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.common.cache.Cache;\nimport com.google.common.cache.CacheBuilder;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.cdi.workspace.Workspace;\nimport org.uberfire.backend.server.cdi.model.WorkspaceImpl;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Contains every workspace created in the application and the beans for those workspaces.\n * Beans are stored into a cache, with size and time expiration.\n */\n@ApplicationScoped\npublic class WorkspaceManager {\n\n    private Logger logger = LoggerFactory.getLogger(WorkspaceManager.class);\n    private WorkspaceManagerPreferences preferences;\n    private ConcurrentHashMap<Workspace, Cache<String, Object>> workspaces;\n\n    public WorkspaceManager() {\n    }\n\n    @Inject\n    public WorkspaceManager(WorkspaceManagerPreferences workspaceManagerPreferences) {\n        this.preferences = workspaceManagerPreferences;\n    }\n\n    @PostConstruct\n    public void initialize() {\n        this.workspaces = new ConcurrentHashMap<>();\n    }\n\n    /**\n     * Returns a workspace, but if it does not exists, it creates a new one.\n     *\n     * @param name The name of the workspace.\n     * @return The existent or the new workspace.\n     */\n    public Workspace getOrCreateWorkspace(String name) {\n        checkNotNull(\"name\",\n                     name);\n        Workspace workspace = new WorkspaceImpl(name);\n        workspaces.computeIfAbsent(new WorkspaceImpl(name),\n                                   w -> this.createCache());\n        return this.getWorkspace(name);\n    }\n\n    protected synchronized Cache<String, Object> createCache() {\n        preferences.load();\n        final Cache<String, Object> cache = CacheBuilder.newBuilder()\n                .maximumSize(preferences.getCacheMaximumSize())\n                .expireAfterAccess(preferences.getCacheExpirationTime(),\n                                   TimeUnit.valueOf(preferences.getCacheExpirationUnit()))\n                .removalListener(removalNotification -> {\n                    if (logger.isDebugEnabled()) {\n                        logger.debug(\"[{},{}] {}\",\n                                     removalNotification.getKey().toString(),\n                                     removalNotification.getValue().toString(),\n                                     removalNotification.getCause().toString());\n                    }\n                })\n                .build();\n        return cache;\n    }\n\n    /**\n     * Returns a workspace. If the workspace does ont exists it throws {@link NoSuchElementException}\n     *\n     * @param name Workspace name\n     * @return The workspace object\n     */\n    public Workspace getWorkspace(String name) {\n        checkNotNull(\"name\",\n                     name);\n        Optional<Workspace> optionalWorkspace = this.workspaces.keySet()\n                .stream()\n                .filter(w -> name.equals(w.getName()))\n                .findAny();\n        return optionalWorkspace\n                .orElseThrow(() -> new NoSuchElementException(String.format(\"Workspace <<%s>> not found\",\n                                                                            name)));\n    }\n\n    /**\n     * Returns a bean based on a workspace and a bean name. If the bean does not exist, returns null\n     *\n     * @param workspace The workspace name.\n     * @param beanName  The bean name for that workspace.\n     * @return the bean instance\n     */\n    public <T> T getBean(Workspace workspace,\n                         String beanName) {\n        checkNotNull(\"workspace\",\n                     workspace);\n        checkNotNull(\"beanName\",\n                     beanName);\n        return (T) this.workspaces.get(workspace).getIfPresent(beanName);\n    }\n\n    /**\n     * Put a bean instance into a Workspace.\n     *\n     * @param workspace The workspace to store beans\n     * @param beanName  The bean name\n     * @param instance  The bean instance\n     */\n    public <T> void putBean(Workspace workspace,\n                            String beanName,\n                            T instance) {\n        try {\n            checkNotNull(\"beanName\",\n                         beanName);\n            this.workspaces.get(workspace).get(beanName,\n                                               () -> instance);\n        } catch (ExecutionException e) {\n            logger.error(\"An error ocurred trying to store bean <<{}>>\",\n                         instance.getClass().getSimpleName(),\n                         e);\n        }\n    }\n\n    /**\n     * Deletes a workspace and its beans\n     *\n     * @param workspace the workspace to delete\n     */\n    public void delete(final Workspace workspace) {\n        this.workspaces.remove(workspace);\n    }\n\n    /**\n     * Returns the workspace count\n     *\n     * @return the number of workspaces\n     */\n    public int getWorkspaceCount() {\n        return this.workspaces.size();\n    }\n\n    /**\n     * Return the beans count for a workspace\n     *\n     * @param workspace The workspace to count beans\n     * @return The number of beans for a workspace\n     */\n    public long getBeansCount(final Workspace workspace) {\n        return this.workspaces.get(workspace).size();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceManagerPreferences.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"WorkspaceManagerPreferences\", bundleKey = \"WorkspaceManagerPreferences.Label\")\npublic class WorkspaceManagerPreferences implements BasePreference<WorkspaceManagerPreferences> {\n\n    @Property(bundleKey = \"WorkspaceManagerPreferences.CacheMaximumSize\")\n    private int cacheMaximumSize;\n\n    @Property(bundleKey = \"WorkspaceManagerPreferences.CacheExpirationTime\")\n    private int cacheExpirationTime;\n\n    @Property(bundleKey = \"WorkspaceManagerPreferences.CacheExpirationUnit\")\n    private String cacheExpirationUnit;\n\n    public WorkspaceManagerPreferences() {\n    }\n\n    @Override\n    public WorkspaceManagerPreferences defaultValue(final WorkspaceManagerPreferences defaultValue) {\n        defaultValue.cacheMaximumSize = 50;\n        defaultValue.cacheExpirationTime = 30;\n        defaultValue.cacheExpirationUnit = TimeUnit.MINUTES.toString();\n        return defaultValue;\n    }\n\n    public int getCacheMaximumSize() {\n        return cacheMaximumSize;\n    }\n\n    public void setCacheMaximumSize(final int cacheMaximumSize) {\n        this.cacheMaximumSize = cacheMaximumSize;\n    }\n\n    public int getCacheExpirationTime() {\n        return cacheExpirationTime;\n    }\n\n    public void setCacheExpirationTime(final int cacheExpirationTime) {\n        this.cacheExpirationTime = cacheExpirationTime;\n    }\n\n    public String getCacheExpirationUnit() {\n        return this.cacheExpirationUnit;\n    }\n\n    public void setCacheExpirationUnit(final String cacheExpirationUnit) {\n        this.cacheExpirationUnit = cacheExpirationUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceNameResolver.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.inject.Inject;\n\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workspace.WorkspaceContext;\n\n/**\n * Resolves Workspace name. At this moment the workspace name is based on usernames, so exists a workspace\n * per user. If there is no user session found the workspace name is called \"global\". This situation could happen during\n * some Server Side executions.\n */\n@ApplicationScoped\npublic class WorkspaceNameResolver {\n\n    public static final String GLOBAL_WORKSPACE_NAME = \"global\";\n    private BeanManager beanManager;\n\n    public WorkspaceNameResolver() {\n    }\n\n    @Inject\n    public WorkspaceNameResolver(BeanManager beanManager) {\n        this.beanManager = beanManager;\n    }\n\n    /**\n     * Resolves the workspace name based on the user session. If not session detected returns \"global\".\n     * @return the workspace name or \"global\".\n     */\n    public String getWorkspaceName() {\n        try {\n            SessionInfo sessionInfo = getSessionInfo();\n            return sessionInfo.getIdentity().getIdentifier();\n        } catch (Exception e) {\n            String name = WorkspaceContext.get();\n            if (name == null || name.isEmpty()) {\n                return GLOBAL_WORKSPACE_NAME;\n            } else {\n                return name;\n            }\n        }\n    }\n\n    protected SessionInfo getSessionInfo() {\n        final Bean<SessionInfo> bean = (Bean<SessionInfo>) this.beanManager.getBeans(SessionInfo.class).iterator().next();\n        final CreationalContext<SessionInfo> creationalContext = this.beanManager.createCreationalContext(bean);\n        return (SessionInfo) this.beanManager.getReference(bean,\n                                                           SessionInfo.class,\n                                                           creationalContext);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceScopeContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.lang.annotation.Annotation;\nimport javax.enterprise.context.spi.Context;\nimport javax.enterprise.context.spi.Contextual;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.cdi.workspace.Workspace;\n\n/**\n * Workspace context.\n * Uses {@link WorkspaceManager} to create beans. Those beans must be annotated with\n * {@link WorkspaceScoped} annotation. Every bean has only one instance per workspace.\n */\npublic class WorkspaceScopeContext implements Context {\n\n    private static Logger logger = LoggerFactory.getLogger(WorkspaceScopeContext.class);\n    private final BeanManager beanManager;\n    private WorkspaceNameResolver resolver;\n\n    public WorkspaceScopeContext(BeanManager beanManager) {\n        this.beanManager = beanManager;\n        this.resolver = new WorkspaceNameResolver(beanManager);\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope() {\n        return WorkspaceScoped.class;\n    }\n\n    @Override\n    public <T> T get(final Contextual<T> contextual,\n                     final CreationalContext<T> creationalContext) {\n\n        Bean<T> bean = getBean(contextual);\n\n        Workspace workspace = this.getWorkspaceManager().getOrCreateWorkspace(getWorkspaceName());\n        final T instance = getWorkspaceManager().getBean(workspace,\n                                                         bean.getBeanClass().getCanonicalName());\n\n        if (instance == null) {\n            if (logger.isTraceEnabled()) {\n                logger.trace(\"Creating Bean <<{}>> with creational context for workspace <<{}>>\",\n                             bean.getBeanClass(),\n                             workspace.getName());\n            }\n            final T created = bean.create(creationalContext);\n            this.getWorkspaceManager().putBean(workspace,\n                                               bean.getBeanClass().getCanonicalName(),\n                                               created);\n            return created;\n        } else {\n            if (logger.isTraceEnabled()) {\n                logger.trace(\"Bean <<{}>> found for workspace <<{}>>\",\n                             bean.getBeanClass(),\n                             workspace.getName());\n            }\n            return instance;\n        }\n    }\n\n    @Override\n    public <T> T get(final Contextual<T> contextual) {\n        Bean<T> bean = getBean(contextual);\n        Workspace workspace = this.getWorkspaceManager().getOrCreateWorkspace(getWorkspaceName());\n        if (logger.isTraceEnabled()) {\n            logger.trace(\"Getting Bean <<{}>> for workspace <<{}>>\",\n                         bean.getBeanClass(),\n                         workspace.getName());\n        }\n        return this.getWorkspaceManager().getBean(workspace,\n                                                  bean.getBeanClass().getCanonicalName());\n    }\n\n    private String getWorkspaceName() {\n        return resolver.getWorkspaceName();\n    }\n\n    @Override\n    public boolean isActive() {\n        return true;\n    }\n\n    private <T> Bean<T> getBean(final Contextual contextual) {\n        return (Bean<T>) contextual;\n    }\n\n    protected WorkspaceManager getWorkspaceManager() {\n        return this.getBean(WorkspaceManager.class);\n    }\n\n    protected <T> T getBean(Class<T> clazz) {\n        final Bean<T> bean = (Bean<T>) this.beanManager.getBeans(clazz).iterator().next();\n        final CreationalContext<T> creationalContext = this.beanManager.createCreationalContext(bean);\n        return (T) this.beanManager.getReference(bean,\n                                                 clazz,\n                                                 creationalContext);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceScoped.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.enterprise.context.NormalScope;\nimport javax.interceptor.InterceptorBinding;\n\n/**\n * Like @ApplicationScoped, this bean is going to have a single instance but\n * instead of living for the duration of the application it lives for the duration of the workspace and its cache.\n * So you can have two instances of the same bean in different workspaces at the same time. This bean is going to expire\n * depending on cache configuration. Check {@link WorkspaceManager}.\n */\n@Documented\n@NormalScope\n@InterceptorBinding\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.METHOD})\npublic @interface WorkspaceScoped {\n\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/java/org/uberfire/backend/server/cdi/workspace/WorkspaceScopedExtension.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.spi.AfterBeanDiscovery;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.enterprise.inject.spi.BeforeBeanDiscovery;\nimport javax.enterprise.inject.spi.Extension;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Workspace Scoped CDI Extension to add WorkspaceScoped behavior into Uberfire\n */\npublic class WorkspaceScopedExtension implements Extension {\n\n    private Logger logger = LoggerFactory.getLogger(WorkspaceScopedExtension.class);\n\n    public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery bbd) {\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Before bean discovery, adding WosrkspaceScoped\");\n        }\n\n        bbd.addScope(WorkspaceScoped.class,\n                     true,\n                     false);\n    }\n\n    public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd,\n                                   BeanManager beanManager) {\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"After bean discovery, adding WorkspaceScopeContext\");\n        }\n\n        abd.addContext(new WorkspaceScopeContext(beanManager));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/resources/META-INF/beans.xml",
    "content": "<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"\n       bean-discovery-mode=\"all\">\n</beans>"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension",
    "content": "org.uberfire.backend.server.cdi.SystemConfigProducer\norg.uberfire.backend.server.cdi.workspace.WorkspaceScopedExtension\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/SessionBasedBean.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport java.io.Serializable;\nimport javax.ejb.Stateless;\nimport javax.inject.Inject;\n\n@Stateless\npublic class SessionBasedBean implements Serializable {\n\n    @Inject\n    private WorkspaceBuilderService service;\n\n    public void build(String gav) {\n        service.build(gav);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/SystemConfigProducerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport java.net.URI;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.spi.AfterBeanDiscovery;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.enterprise.inject.spi.InjectionTarget;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SystemConfigProducerTest {\n\n    SystemConfigProducer producer;\n    BeanManager bm;\n    Bean<IOService> ioServiceBean;\n    Set<Bean<?>> configIOBeans = new HashSet<>();\n    IOService ioServiceMock;\n    FileSystem fs;\n\n    @Before\n    public void setUp() throws Exception {\n        producer = new SystemConfigProducer() {\n            @Override\n            SpacesAPI getSpaces(BeanManager bm) {\n                return new SpacesAPIImpl();\n            }\n        };\n        bm = mock(BeanManager.class);\n        ioServiceBean = mock(Bean.class);\n        configIOBeans.add(ioServiceBean);\n        ioServiceMock = mock(IOService.class);\n        fs = mock(FileSystem.class);\n    }\n\n    @Test\n    public void systemConfigFSShouldUseGITasScheme() {\n\n        SpacesAPI spacesAPI = mock(SpacesAPI.class);\n\n        producer.resolveFSURI(spacesAPI, SpacesAPI.DEFAULT_SPACE, SystemConfigProducer.SYSTEM);\n\n        verify(spacesAPI).resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, SystemConfigProducer.SYSTEM);\n    }\n\n    @Test\n    public void createAndDestroyFSShouldRegisterUnregisterOnPriorityDisposableRegistry() {\n\n        when(bm.getBeans(\"configIO\")).thenReturn(configIOBeans);\n        when(bm.getReference(eq(ioServiceBean),\n                             eq(IOService.class),\n                             any()))\n                .thenReturn(ioServiceMock);\n\n        when(ioServiceMock.newFileSystem(any(),\n                                         any()))\n                .thenReturn(fs);\n\n        final Bean fileSystemBean = producer.createFileSystemBean(bm,\n                                                                  mock(InjectionTarget.class),\n                                                                  mock(Space.class),\n                                                                  \"configIO\",\n                                                                  \"systemFS\",\n                                                                  SystemConfigProducer.SYSTEM);\n\n        assertNull(PriorityDisposableRegistry.get(\"systemFS\"));\n\n        fileSystemBean.create(mock(CreationalContext.class));\n\n        assertNotNull(PriorityDisposableRegistry.get(\"systemFS\"));\n\n        fileSystemBean.destroy(fs,\n                               mock(CreationalContext.class));\n\n        assertNull(PriorityDisposableRegistry.get(\"systemFS\"));\n    }\n\n    @Test\n    public void systemFSShouldUseConfigIO() {\n\n        SystemConfigProducer producerSpy = spy(producer);\n\n        when(bm.createInjectionTarget(any())).thenReturn(mock(InjectionTarget.class));\n\n        producerSpy.buildSystemFS(mock(AfterBeanDiscovery.class),\n                                  bm);\n\n        verify(producerSpy).createFileSystemBean(eq(bm),\n                                                 any(),\n                                                 any(),\n                                                 eq(\"configIO\"),\n                                                 eq(\"systemFS\"),\n                                                 eq(SystemConfigProducer.SYSTEM));\n    }\n\n    @Test\n    public void pluginFSShouldUseIOStrategy() {\n\n        SystemConfigProducer producerSpy = spy(producer);\n\n        when(bm.createInjectionTarget(any())).thenReturn(mock(InjectionTarget.class));\n\n        producerSpy.buildPluginsFS(mock(AfterBeanDiscovery.class),\n                                   bm);\n\n        verify(producerSpy).createFileSystemBean(eq(bm),\n                                                 any(),\n                                                 any(),\n                                                 eq(\"ioStrategy\"),\n                                                 eq(\"pluginsFS\"),\n                                                 eq(\"plugins\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/WorkspaceBuilderService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport java.io.Serializable;\n\n/**\n * Just for testing purposes\n */\npublic interface WorkspaceBuilderService extends Serializable {\n\n    void build(String gav);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/WorkspaceBuilderServiceImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceScoped;\n\n/**\n * Just for testing purposes\n */\n@Service\n@WorkspaceScoped\npublic class WorkspaceBuilderServiceImpl implements\n                                         WorkspaceBuilderService {\n\n    //private Logger logger = LoggerFactory.getLogger( WorkspaceBuilderServiceImpl.class );\n    private Logger logger;\n\n    public WorkspaceBuilderServiceImpl() {\n    }\n\n    @Inject\n    public WorkspaceBuilderServiceImpl(Logger logger) {\n        this.logger = logger;\n    }\n\n    @Override\n    public void build(String gav) {\n        try {\n            logger.info(\"Building {} ...\",\n                        gav);\n            logger.info(\"Thread name: \" + Thread.currentThread().getName());\n            Thread.currentThread().sleep(5000l);\n            logger.info(\"Building finished {}\",\n                        gav);\n        } catch (InterruptedException e) {\n            e.printStackTrace();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/WorkspaceBuilderServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi;\n\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.TimeUnit;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.spi.Extension;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.inject.Inject;\n\nimport org.jboss.arquillian.container.test.api.Deployment;\nimport org.jboss.arquillian.junit.Arquillian;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.shrinkwrap.api.ShrinkWrap;\nimport org.jboss.shrinkwrap.api.asset.EmptyAsset;\nimport org.jboss.shrinkwrap.api.spec.JavaArchive;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.cdi.model.WorkspaceImpl;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceManager;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceScopedExtension;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Arquillian.class)\npublic class WorkspaceBuilderServiceTest {\n\n    @Deployment\n    public static JavaArchive createDeployment() {\n\n        System.setProperty(\"errai.marshalling.force_static_marshallers\",\n                           Boolean.toString(true));\n\n        return ShrinkWrap.create(JavaArchive.class)\n                .addPackages(true,\n                             \"org.uberfire.preferences\")\n                .addPackages(true,\n                             \"org.uberfire.backend.server.spaces\")\n                .addPackages(true,\n                             \"org.uberfire.mvp\")\n                .addPackages(true,\n                             \"org.uberfire.commons\")\n                .addPackages(true,\n                             \"org.uberfire.backend.java\")\n                .addPackages(true,\n                             \"org.uberfire.backend.server.cdi\")\n                .addPackages(true,\n                             \"org.uberfire.backend.server.cluster\")\n                .addPackages(true,\n                             \"org.uberfire.backend.server.io\")\n                .addPackages(true,\n                             \"org.uberfire.java.nio.fs.jgit\")\n                .addClass(JGitFileSystemProvider.class)\n                .addAsManifestResource(EmptyAsset.INSTANCE,\n                                       \"beans.xml\")\n                .addAsResource(\"META-INF/ErraiApp.properties\",\n                               \"ErraiApp.properties\")\n                .addAsManifestResource(\"META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider\",\n                                       \"services/org.uberfire.java.nio.file.spi.FileSystemProvider\")\n                .addAsServiceProvider(Extension.class,\n                                      WorkspaceScopedExtension.class);\n    }\n\n    @Inject\n    private WorkspaceManager workspaceManager;\n\n    @Inject\n    SessionBasedBean bean;\n\n    @Inject\n    WorkspaceBuilderService workspaceBuilderService;\n\n    @Produces\n    protected Logger createLogger(InjectionPoint injectionPoint) {\n        return LoggerFactory.getLogger(injectionPoint.getMember().getDeclaringClass().getSimpleName());\n    }\n\n    @Produces\n    protected SessionInfo createSessionInfo(InjectionPoint injectionPoint) {\n        return new SessionInfoImpl(new UserImpl(Thread.currentThread().getName()));\n    }\n\n    @Before\n    public void setUp() {\n    }\n\n    @Test\n    public void testConcurrentWorkspaceBeans() {\n\n        String THREAD_NAME_2 = \"ray vaughan\";\n        String THREAD_NAME_1 = \"hendrix\";\n\n        CountDownLatch latch = new CountDownLatch(2);\n\n        Thread thread1 = createThread(bean,\n                                      \"a:b:c\",\n                                      latch);\n        Thread thread2 = createThread(bean,\n                                      \"d:e:f\",\n                                      latch);\n\n        thread1.setName(THREAD_NAME_1);\n        thread2.setName(THREAD_NAME_2);\n        thread1.start();\n        thread2.start();\n\n        try {\n            latch.await(7000,\n                        TimeUnit.SECONDS);\n            final WorkspaceImpl workspace1 = (WorkspaceImpl) workspaceManager.getWorkspace(THREAD_NAME_1);\n            assertEquals(1,\n                         workspaceManager.getBeansCount(workspace1));\n\n            final WorkspaceImpl workspace2 = (WorkspaceImpl) workspaceManager.getWorkspace(THREAD_NAME_2);\n            assertEquals(1,\n                         workspaceManager.getBeansCount(workspace2));\n\n            assertEquals(2,\n                         workspaceManager.getWorkspaceCount());\n        } catch (InterruptedException e) {\n            fail();\n        }\n    }\n\n    private Thread createThread(final SessionBasedBean bean,\n                                final String gav,\n                                final CountDownLatch latch) {\n        return new Thread(() -> {\n            bean.build(gav);\n            latch.countDown();\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/workspace/WorkspaceManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport java.util.NoSuchElementException;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.cdi.workspace.Workspace;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceManagerTest {\n\n    @Mock\n    private WorkspaceManagerPreferences preferences;\n\n    private WorkspaceManager workspaceManager;\n\n    @Before\n    public void setUp() {\n        when(preferences.getCacheExpirationTime()).thenReturn(10);\n        when(preferences.getCacheExpirationUnit()).thenReturn(\"MINUTES\");\n        when(preferences.getCacheMaximumSize()).thenReturn(3);\n\n        this.workspaceManager = new WorkspaceManager(preferences);\n        this.workspaceManager.initialize();\n    }\n\n    @Test\n    public void testWorkspaceNotFound() {\n        assertThatThrownBy(() -> workspaceManager.getWorkspace(\"none\"))\n                .isInstanceOf(NoSuchElementException.class)\n                .hasMessage(\"Workspace <<none>> not found\");\n    }\n\n    @Test\n    public void testCreateWorkspace() {\n        final Workspace workspace = this.workspaceManager.getOrCreateWorkspace(\"hendrix\");\n        assertEquals(\"hendrix\",\n                     workspace.getName());\n    }\n\n    @Test\n    public void testWorkspaceCount() {\n        this.workspaceManager.getOrCreateWorkspace(\"hendrix\");\n        assertEquals(1,\n                     this.workspaceManager.getWorkspaceCount());\n    }\n\n    @Test\n    public void testDeleteWorkspace() {\n        final Workspace workspace = this.workspaceManager.getOrCreateWorkspace(\"hendrix\");\n        assertEquals(1,\n                     this.workspaceManager.getWorkspaceCount());\n        this.workspaceManager.delete(workspace);\n        assertEquals(0,\n                     this.workspaceManager.getWorkspaceCount());\n    }\n\n    @Test\n    public void testStoreBeansWithCacheSizeEviction() {\n        final Workspace workspace = this.workspaceManager.getOrCreateWorkspace(\"hendrix\");\n\n        this.workspaceManager.putBean(workspace,\n                                      \"a\",\n                                      new Object());\n        this.workspaceManager.putBean(workspace,\n                                      \"b\",\n                                      new Object());\n        this.workspaceManager.putBean(workspace,\n                                      \"c\",\n                                      new Object());\n        this.workspaceManager.putBean(workspace,\n                                      \"d\",\n                                      new Object());\n        this.workspaceManager.putBean(workspace,\n                                      \"e\",\n                                      new Object());\n\n        assertEquals(3,\n                     this.workspaceManager.getBeansCount(workspace));\n    }\n\n    @Test\n    public void testGetBeanDoesNotExists() {\n        final Workspace workspace = this.workspaceManager.getOrCreateWorkspace(\"hendrix\");\n        assertNull(this.workspaceManager.getBean(workspace,\n                                                 \"a\"));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/java/org/uberfire/backend/server/cdi/workspace/WorkspaceNameResolverTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.backend.server.cdi.workspace;\n\nimport javax.enterprise.inject.spi.BeanManager;\n\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workspace.WorkspaceContext;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceNameResolverTest {\n\n    private WorkspaceNameResolver resolver;\n    private BeanManager beanManager;\n\n    @Before\n    public void setUp() {\n        WorkspaceContext.set(null);\n        beanManager = mock(BeanManager.class);\n        resolver = Mockito.spy(new WorkspaceNameResolver(beanManager));\n    }\n\n    @Test\n    public void testGlobalWorkspaceName() {\n        String name = this.resolver.getWorkspaceName();\n        assertEquals(WorkspaceNameResolver.GLOBAL_WORKSPACE_NAME,\n                     name);\n    }\n\n    @Test\n    public void testContextWorkspaceName() {\n        final String user = \"hendrix\";\n        WorkspaceContext.set(user);\n        String name = this.resolver.getWorkspaceName();\n        assertEquals(user,\n                     name);\n    }\n\n    @Test\n    public void testUserInfoWorkspaceName() {\n        final String user = \"clapton\";\n\n        SessionInfo sessionInfo = mock(SessionInfo.class);\n        when(sessionInfo.getIdentity()).thenReturn(new UserImpl(user));\n        doReturn(sessionInfo).when(this.resolver).getSessionInfo();\n        String name = this.resolver.getWorkspaceName();\n        assertEquals(user,\n                     name);\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider"
  },
  {
    "path": "uberfire-backend/uberfire-backend-cdi/src/test/resources/logback.xml",
    "content": "<configuration>\n  <appender name=\"STDOUT\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire.backend.server.cdi\" level=\"TRACE\"/>\n\n  <root level=\"INFO\">\n    <appender-ref ref=\"STDOUT\"/>\n  </root>\n</configuration>"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-backend</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-backend-server</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Backend Server</name>\n  <description>UberFire Backend Server</description>\n\n  <dependencies>\n    <!-- Internal dependencies -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n\n    <!-- Formatting -->\n    <dependency>\n      <groupId>org.ocpsoft.prettytime</groupId>\n      <artifactId>prettytime</artifactId>\n    </dependency>\n\n    <!-- XML parsing -->\n    <dependency>\n      <groupId>org.jdom</groupId>\n      <artifactId>jdom</artifactId>\n    </dependency>\n\n    <!-- KIE Commons IO -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.wildfly.security</groupId>\n      <artifactId>wildfly-elytron</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Workbench serialization -->\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <!-- Encryption\\Decryption service-->\n    <dependency>\n      <groupId>org.jasypt</groupId>\n      <artifactId>jasypt</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>xerces</groupId>\n      <artifactId>xercesImpl</artifactId>\n    </dependency>\n\n    <!-- EJB for AsyncDispatcher -->\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>io.netty</groupId>\n          <artifactId>netty-all</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-module-junit4</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-api-mockito2</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/IOWatchServiceAllImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.concurrent.ExecutorService;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.server.io.watch.AbstractIOWatchService;\nimport org.uberfire.commons.concurrent.Managed;\nimport org.uberfire.commons.concurrent.Unmanaged;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n@ApplicationScoped\npublic class IOWatchServiceAllImpl extends AbstractIOWatchService {\n\n    public IOWatchServiceAllImpl() {\n    }\n\n    @Inject\n    public IOWatchServiceAllImpl(Event<ResourceBatchChangesEvent> resourceBatchChanges,\n                                 Event<ResourceUpdatedEvent> resourceUpdatedEvent,\n                                 Event<ResourceRenamedEvent> resourceRenamedEvent,\n                                 Event<ResourceDeletedEvent> resourceDeletedEvent,\n                                 Event<ResourceAddedEvent> resourceAddedEvent,\n                                 @Unmanaged ExecutorService executorService) {\n\n        super(resourceBatchChanges,\n              resourceUpdatedEvent,\n              resourceRenamedEvent,\n              resourceDeletedEvent,\n              resourceAddedEvent,\n              executorService);\n    }\n\n    @Override\n    public boolean doFilter(WatchEvent<?> event) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/IOWatchServiceNonDotImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.concurrent.ExecutorService;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.server.io.watch.AbstractIOWatchService;\nimport org.uberfire.commons.concurrent.Unmanaged;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n@ApplicationScoped\npublic class IOWatchServiceNonDotImpl extends AbstractIOWatchService {\n\n    public IOWatchServiceNonDotImpl() {\n    }\n\n    @Inject\n    public IOWatchServiceNonDotImpl(Event<ResourceBatchChangesEvent> resourceBatchChanges,\n                                    Event<ResourceUpdatedEvent> resourceUpdatedEvent,\n                                    Event<ResourceRenamedEvent> resourceRenamedEvent,\n                                    Event<ResourceDeletedEvent> resourceDeletedEvent,\n                                    Event<ResourceAddedEvent> resourceAddedEvent,\n                                    @Unmanaged ExecutorService executorService) {\n\n        super(resourceBatchChanges,\n              resourceUpdatedEvent,\n              resourceRenamedEvent,\n              resourceDeletedEvent,\n              resourceAddedEvent,\n              executorService);\n    }\n\n    @Override\n    public boolean doFilter(WatchEvent<?> object) {\n        final WatchContext context = (WatchContext) object.context();\n        if (object.kind().equals(StandardWatchEventKind.ENTRY_MODIFY)) {\n            if (shouldFilter(context.getOldPath())) {\n                return true;\n            }\n        } else if (object.kind().equals(StandardWatchEventKind.ENTRY_CREATE)) {\n            if (shouldFilter(context.getPath())) {\n                return true;\n            }\n        } else if (object.kind().equals(StandardWatchEventKind.ENTRY_RENAME)) {\n            if (shouldFilter(context.getOldPath())) {\n                return true;\n            }\n        } else if (object.kind().equals(StandardWatchEventKind.ENTRY_DELETE)) {\n            if (shouldFilter(context.getOldPath())) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    boolean shouldFilter(Path path) {\n        return path != null && path.getFileName() != null && path.getFileName().toString().startsWith(\".\");\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/LockCleanupSessionListener.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.Set;\nimport javax.servlet.annotation.WebListener;\nimport javax.servlet.http.HttpSessionEvent;\nimport javax.servlet.http.HttpSessionListener;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.io.ConfigIOServiceProducer;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Releases locks on session end.\n */\n@WebListener\npublic class LockCleanupSessionListener implements HttpSessionListener {\n\n    private static final Logger logger = LoggerFactory.getLogger(LockCleanupSessionListener.class);\n\n    @Override\n    public void sessionCreated(HttpSessionEvent se) {\n    }\n\n    @Override\n    public void sessionDestroyed(HttpSessionEvent se) {\n        final ConfigIOServiceProducer ioServiceProducer = ConfigIOServiceProducer.getInstance();\n        final IOService ioService = ioServiceProducer.configIOService();\n        final FileSystem fileSystem = ioServiceProducer.configFileSystem();\n\n        @SuppressWarnings(\"unchecked\")\n        final Set<LockInfo> locks = (Set<LockInfo>) se.getSession()\n                .getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME);\n\n        if (locks != null) {\n            try {\n                ioService.startBatch(fileSystem);\n                for (LockInfo lock : locks) {\n                    try {\n                        final Path lockPath = Paths.convert(PathFactory.newLock(lock.getFile()));\n                        // Lock could have change ownership due to a forced lock release\n                        if (ioService.readAllString(lockPath).equals(lock.lockedBy())) {\n                            ioService.delete(lockPath);\n                        }\n                    } catch (NoSuchFileException e) {\n                        // Logging this with a lower level as it can happen when a user triggers \n                        // a forced lock release or when the locked file itself was deleted.\n                        logger.debug(\"Problem when releasing lock on session end (lock no longer exists): \" + lock,\n                                     e);\n                    } catch (Throwable t) {\n                        logger.warn(\"Problem when releasing lock on session end: \" + lock,\n                                    t);\n                    }\n                }\n            } finally {\n                ioService.endBatch();\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/LockClientNotifier.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.List;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\n\n/**\n * Observes the creation and deletion of locks and notifies all connected\n * clients of the corresponding lock status changes.\n */\n@ApplicationScoped\n@Startup\npublic class LockClientNotifier {\n\n    @Inject\n    @Named(\"systemFS\")\n    private FileSystem fs;\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioService;\n\n    @Inject\n    private Event<LockInfo> lockEvent;\n\n    private WatchService ws;\n\n    private ExecutorService executorService = Executors.newSingleThreadExecutor();\n\n    private volatile boolean active = true;\n\n    @PostConstruct\n    private void init() {\n\n        if (FileSystemUtils.isGitDefaultFileSystem()) {\n            ws = fs.newWatchService();\n            executorService.submit(new Runnable() {\n\n                @Override\n                public void run() {\n                    observeAndNotifyClients();\n                }\n            });\n        }\n    }\n\n    @PreDestroy\n    private void shutdown() {\n        executorService.shutdown();\n\n        active = false;\n\n        if (ws != null) {\n            ws.close();\n        }\n    }\n\n    private void observeAndNotifyClients() {\n        while (active) {\n            try {\n\n                final WatchKey wk;\n                try {\n                    wk = ws.take();\n                } catch (final Exception ex) {\n                    break;\n                }\n\n                final List<WatchEvent<?>> events = wk.pollEvents();\n                for (final WatchEvent<?> event : events) {\n                    final boolean created = event.kind().equals(StandardWatchEventKind.ENTRY_CREATE);\n                    final boolean deleted = event.kind().equals(StandardWatchEventKind.ENTRY_DELETE);\n\n                    final WatchContext context = (WatchContext) event.context();\n                    final Path path = (created) ? context.getPath() : context.getOldPath();\n\n                    if (path != null && path.getFileName().toString().endsWith(PathFactory.LOCK_FILE_EXTENSION)) {\n                        final org.uberfire.backend.vfs.Path vfsLockPath = Paths.convert(path);\n                        final org.uberfire.backend.vfs.Path vfsPath = PathFactory.fromLock(vfsLockPath);\n\n                        if (created) {\n                            final String lockedBy = ioService.readAllString(path);\n                            lockEvent.fire(new LockInfo(true,\n                                                        lockedBy,\n                                                        vfsPath,\n                                                        vfsLockPath));\n                        } else if (deleted) {\n                            lockEvent.fire(new LockInfo(false,\n                                                        null,\n                                                        vfsPath,\n                                                        vfsLockPath));\n                        }\n                    }\n                }\n\n                if (!wk.reset()) {\n                    break;\n                }\n            } catch (final Exception ignored) {\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/UserServicesBackendImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.backend.server.util.TextUtil;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\n@ApplicationScoped\npublic class UserServicesBackendImpl {\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioService;\n\n    @Inject\n    @Named(\"systemFS\")\n    private FileSystem fileSystem;\n\n    public Path buildPath(final String _userName,\n                          final String serviceType) {\n\n        final String resultUserName = TextUtil.normalizeUserName(_userName);\n\n        return fileSystem.getPath(resultUserName + \"-uf-user\",\n                                  serviceType);\n    }\n\n    public Path buildPath(final String _userName,\n                          final String serviceType,\n                          final String relativePath) {\n\n        final String resultUserName = TextUtil.normalizeUserName(_userName);\n\n        if (relativePath != null && !\"\".equals(relativePath)) {\n            return fileSystem.getPath(resultUserName + \"-uf-user\",\n                                      serviceType,\n                                      relativePath);\n        } else {\n            return fileSystem.getPath(resultUserName + \"-uf-user\",\n                                      serviceType);\n        }\n    }\n\n    public Collection<Path> getAllUsersData(final String serviceType,\n                                            final String relativePath) {\n        final Collection<Path> result = new ArrayList<Path>();\n\n        for (final Path path : fileSystem.getRootDirectories()) {\n            final Path _path;\n            if (relativePath != null && !\"\".equals(relativePath)) {\n                _path = path.resolve(serviceType).resolve(relativePath);\n            } else {\n                _path = path.resolve(serviceType);\n            }\n            if (ioService.exists(_path)) {\n                result.add(_path);\n            }\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/UserServicesImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.java.nio.file.Path;\n\n@ApplicationScoped\npublic class UserServicesImpl {\n\n    @Inject\n    private AuthenticationService authService;\n\n    @Inject\n    private UserServicesBackendImpl userServicesBackend;\n\n    public Path buildPath(final String serviceType) {\n        return userServicesBackend.buildPath(authService.getUser().getIdentifier(),\n                                             serviceType);\n    }\n\n    public Path buildPath(final String serviceType,\n                          final String relativePath) {\n        return userServicesBackend.buildPath(authService.getUser().getIdentifier(),\n                                             serviceType,\n                                             relativePath);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/VFSLockServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.servlet.http.HttpSession;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.DirectoryStream.Filter;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\n\n/**\n * Errai RPC endpoint exposing a {@link VFSLockService}.\n */\n@Service\n@ApplicationScoped\npublic class VFSLockServiceImpl implements VFSLockService {\n\n    public static final String LOCK_SESSION_ATTRIBUTE_NAME = \"uf-locks\";\n    private static final Logger logger = LoggerFactory.getLogger(VFSLockServiceImpl.class);\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioService;\n\n    @Inject\n    @Named(\"systemFS\")\n    private FileSystem fileSystem;\n\n    @Inject\n    private SessionInfo sessionInfo;\n\n    @Override\n    public LockResult acquireLock(final Path path)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n\n        try {\n            ioService.startBatch(fileSystem);\n\n            final String userId = sessionInfo.getIdentity().getIdentifier();\n            final LockInfo lockInfo = retrieveLockInfo(path);\n            final LockResult result;\n            if (lockInfo.isLocked() && !lockInfo.lockedBy().equals(userId)) {\n                result = LockResult.failed(lockInfo);\n            } else {\n                ioService.write(Paths.convert(lockInfo.getLock()),\n                                userId);\n                result = LockResult.acquired(path,\n                                             userId);\n                updateSession(result.getLockInfo());\n            }\n            return result;\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public LockResult releaseLock(final Path path)\n            throws IllegalArgumentException, IOException {\n\n        return releaseLock(path,\n                           false);\n    }\n\n    @Override\n    public LockResult forceReleaseLock(final Path path)\n            throws IllegalArgumentException, IOException {\n\n        final String userId = sessionInfo.getIdentity().getIdentifier();\n        logger.info(\"User \" + userId + \" forced a lock release of: \" + path.toURI());\n\n        return releaseLock(path,\n                           true);\n    }\n\n    private LockResult releaseLock(final Path path,\n                                   final boolean force)\n            throws IllegalArgumentException, IOException {\n\n        try {\n            ioService.startBatch(fileSystem);\n\n            final LockInfo lockInfo = retrieveLockInfo(path);\n            final LockResult result;\n            if (lockInfo.isLocked()) {\n                if (sessionInfo.getIdentity().getIdentifier().equals(lockInfo.lockedBy()) || force) {\n                    ioService.delete(Paths.convert(lockInfo.getLock()));\n                    updateSession(lockInfo,\n                                  true);\n                    result = LockResult.released(path);\n                } else {\n                    logger.error(\"Client requested to release a lock it doesn't hold: \" + path.toURI());\n                    throw new IOException(\"Not allowed\");\n                }\n            } else {\n                result = LockResult.failed(lockInfo);\n            }\n            return result;\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public LockInfo retrieveLockInfo(Path path)\n            throws IllegalArgumentException, IOException {\n\n        final Path vfsLock = PathFactory.newLock(path);\n        final org.uberfire.java.nio.file.Path realLock = Paths.convert(vfsLock);\n\n        if (ioService.exists(realLock)) {\n            try {\n                final String lockedBy = ioService.readAllString(realLock);\n                return new LockInfo(true,\n                                    lockedBy,\n                                    path,\n                                    vfsLock);\n            } catch (NoSuchFileException nsfe) {\n                // We want to avoid starting a batch (to ensure cluster-wide consistent reads) here since \n                // this method is invoked very frequently. Therefore it's possible that the lock file\n                // was deleted after the check to exists but before readAllString was invoked. There's\n                // no need for special exception handling as it simply means that file is no longer locked.\n            }\n        }\n        return new LockInfo(false,\n                            null,\n                            path,\n                            vfsLock);\n    }\n\n    @Override\n    public List<LockInfo> retrieveLockInfos(Path path,\n                                            boolean excludeOwnedLocks)\n            throws IllegalArgumentException, IOException {\n\n        if (!Files.isDirectory(Paths.convert(path))) {\n            return Collections.emptyList();\n        }\n\n        final Path lockPath = PathFactory.newLockPath(path);\n\n        final List<Path> locks = new ArrayList<Path>();\n        retrieveLocks(ioService.get(URI.create(lockPath.toURI())),\n                      locks);\n\n        final List<LockInfo> lockInfos = new LinkedList<LockInfo>();\n        for (Path lock : locks) {\n            final LockInfo lockInfo = retrieveLockInfo(PathFactory.fromLock(lock));\n\n            if (!excludeOwnedLocks || !sessionInfo.getIdentity().getIdentifier().equals(lockInfo.lockedBy())) {\n                if (Files.exists(Paths.convert(lockInfo.getFile()))) {\n                    lockInfos.add(lockInfo);\n                }\n            }\n        }\n\n        return lockInfos;\n    }\n\n    private void retrieveLocks(final org.uberfire.java.nio.file.Path path,\n                               final List<Path> accu) {\n\n        if (!Files.exists(path)) {\n            return;\n        }\n\n        Filter<org.uberfire.java.nio.file.Path> filter = new Filter<org.uberfire.java.nio.file.Path>() {\n\n            @Override\n            public boolean accept(final org.uberfire.java.nio.file.Path entry) throws org.uberfire.java.nio.IOException {\n                if (Paths.convert(entry).toURI().endsWith(PathFactory.LOCK_FILE_EXTENSION)) {\n                    accu.add(Paths.convert(entry));\n                } else if (Files.isDirectory(entry)) {\n                    retrieveLocks(ioService.get(entry.toUri()),\n                                  accu);\n                }\n                return true;\n            }\n        };\n\n        Iterator<org.uberfire.java.nio.file.Path> it = ioService.newDirectoryStream(path,\n                                                                                    filter).iterator();\n        while (it.hasNext()) {\n            it.next();\n        }\n    }\n\n    /**\n     * Updates the user's session to track all currently held locks so we can\n     * release locks on session expiry.\n     * @param lockInfo the lock to update\n     * @param remove true to remove the lock, false to add it\n     */\n    private void updateSession(final LockInfo lockInfo,\n                               boolean remove) {\n        final HttpSession session = RpcContext.getHttpSession();\n        if (session != null) {\n            @SuppressWarnings(\"unchecked\")\n            Set<LockInfo> locks = (Set<LockInfo>) session.getAttribute(LOCK_SESSION_ATTRIBUTE_NAME);\n\n            if (remove) {\n                if (locks != null) {\n                    locks.remove(lockInfo);\n                }\n            } else {\n                if (locks == null) {\n                    locks = new HashSet<LockInfo>();\n                }\n\n                locks.add(lockInfo);\n                session.setAttribute(LOCK_SESSION_ATTRIBUTE_NAME,\n                                     locks);\n            }\n        }\n    }\n\n    private void updateSession(final LockInfo lockInfo) {\n        updateSession(lockInfo,\n                      false);\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onResourceDeleted(@Observes ResourceDeletedEvent res) {\n        maybeDeleteLock(res.getPath());\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onResourceRenamed(@Observes ResourceRenamedEvent res) {\n        maybeDeleteLock(res.getPath());\n    }\n\n    private void maybeDeleteLock(final Path path) {\n        try {\n            ioService.startBatch(fileSystem);\n\n            final LockInfo lockInfo = retrieveLockInfo(path);\n            if (lockInfo.isLocked()) {\n                ioService.delete(Paths.convert(lockInfo.getLock()));\n            }\n        } finally {\n            ioService.endBatch();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/VFSServicesServerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.net.URI;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.DirectoryStream;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.backend.vfs.impl.DirectoryStreamImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\n@Service\n@ApplicationScoped\npublic class VFSServicesServerImpl implements VFSService {\n\n    private final IOService ioService;\n\n    // CDI Proxy.\n    protected VFSServicesServerImpl() {\n        this(null);\n    }\n\n    @Inject\n    public VFSServicesServerImpl(final @Named(\"ioStrategy\") IOService ioService) {\n        this.ioService = ioService;\n    }\n\n    @Override\n    public Path get(final String uri) {\n        return Paths.convert(ioService.get(URI.create(uri)));\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path dir)\n            throws IllegalArgumentException, NotDirectoryException, IOException {\n\n        final Iterator<org.uberfire.java.nio.file.Path> content = ioService.newDirectoryStream(Paths.convert(dir)).iterator();\n\n        return newDirectoryStream(content);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                                    final DirectoryStream.Filter<Path> filter)\n            throws IllegalArgumentException, NotDirectoryException, IOException {\n        final Iterator<org.uberfire.java.nio.file.Path> content = ioService.newDirectoryStream(Paths.convert(dir),\n                                                                                               path -> filter.accept(Paths.convert(path))).iterator();\n\n        return newDirectoryStream(content);\n    }\n\n    @Override\n    public Path createDirectory(final Path dir)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        return Paths.convert(ioService.createDirectory(Paths.convert(dir)));\n    }\n\n    @Override\n    public Path createDirectories(final Path dir)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return Paths.convert(ioService.createDirectories(Paths.convert(dir)));\n    }\n\n    @Override\n    public Path createDirectory(final Path dir,\n                                final Map<String, ?> attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return Paths.convert(ioService.createDirectory(Paths.convert(dir),\n                                                       attrs));\n    }\n\n    @Override\n    public Path createDirectories(final Path dir,\n                                  final Map<String, ?> attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return Paths.convert(ioService.createDirectories(Paths.convert(dir),\n                                                         attrs));\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path) throws UnsupportedOperationException, IllegalArgumentException, IOException {\n\n        final Map<String, Object> attributes = new HashMap<String, Object>(ioService.readAttributes(Paths.convert(path)));\n        final Object _lastModifiedTime = attributes.get(\"lastModifiedTime\");\n        if (_lastModifiedTime != null) {\n            attributes.put(\"lastModifiedTime\",\n                           new Date(((FileTime) _lastModifiedTime).toMillis()));\n        }\n\n        final Object _lastAccessTime = attributes.get(\"lastAccessTime\");\n        if (_lastAccessTime != null) {\n            attributes.put(\"lastAccessTime\",\n                           new Date(((FileTime) _lastAccessTime).toMillis()));\n        }\n\n        final Object _creationTime = attributes.get(\"creationTime\");\n        if (_creationTime != null) {\n            attributes.put(\"creationTime\",\n                           new Date(((FileTime) _creationTime).toMillis()));\n        }\n\n        return attributes;\n    }\n\n    @Override\n    public void setAttributes(final Path path,\n                              final Map<String, Object> attrs) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException {\n        ioService.setAttributes(Paths.convert(path),\n                                attrs);\n    }\n\n    @Override\n    public void delete(final Path path) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException {\n        ioService.delete(Paths.convert(path));\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path) throws IllegalArgumentException, DirectoryNotEmptyException, IOException {\n        return ioService.deleteIfExists(Paths.convert(path));\n    }\n\n    @Override\n    public Path copy(final Path source,\n                     final Path target) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException {\n        return Paths.convert(ioService.copy(Paths.convert(source),\n                                            Paths.convert(target)));\n    }\n\n    @Override\n    public Path move(final Path source,\n                     final Path target) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException {\n        return Paths.convert(ioService.move(Paths.convert(source),\n                                            Paths.convert(target)));\n    }\n\n    @Override\n    public String readAllString(final Path path) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return ioService.readAllString(Paths.convert(path));\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return Paths.convert(ioService.write(Paths.convert(path),\n                                             content));\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Map<String, ?> attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return Paths.convert(ioService.write(Paths.convert(path),\n                                             content,\n                                             attrs));\n    }\n\n    @Override\n    public boolean isRegularFile(final String uri) {\n        return Files.isRegularFile(ioService.get(URI.create(uri)));\n    }\n\n    @Override\n    public boolean isRegularFile(final Path path) {\n        return Files.isRegularFile(Paths.convert(path));\n    }\n\n    @Override\n    public boolean isDirectory(final String uri) {\n        return Files.isDirectory(ioService.get(URI.create(uri)));\n    }\n\n    @Override\n    public boolean isDirectory(final Path path) {\n        return Files.isDirectory(Paths.convert(path));\n    }\n\n    private DirectoryStream<Path> newDirectoryStream(final Iterator<org.uberfire.java.nio.file.Path> iterator) {\n        final List<Path> content = new LinkedList<Path>();\n        while (iterator.hasNext()) {\n            content.add(Paths.convert(iterator.next()));\n        }\n        return new DirectoryStreamImpl(content);\n    }\n\n    private DirectoryStream.Filter<org.uberfire.java.nio.file.Path> convert(final DirectoryStream.Filter<Path> filter) {\n        return new DirectoryStream.Filter<org.uberfire.java.nio.file.Path>() {\n            @Override\n            public boolean accept(final org.uberfire.java.nio.file.Path entry) throws IOException {\n                return filter.accept(Paths.convert(entry));\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/WebAppListener.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\nimport javax.servlet.annotation.WebListener;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.mvp.Command;\n\n/**\n * It captures the webapp startup/destroy events and notifies the interested parties.\n */\n@WebListener\npublic class WebAppListener implements ServletContextListener {\n\n    private static final Logger logger = LoggerFactory.getLogger(WebAppListener.class);\n\n    private static List<Command> onStartupCommandList = new ArrayList<>();\n    private static List<Command> onDestroyCommandList = new ArrayList<>();\n    private static boolean initialized = false;\n    private static boolean destroyed = false;\n\n    public synchronized static void registerOnStartupCommand(Command command) {\n        if (initialized) {\n            command.execute();\n        } else {\n            onStartupCommandList.add(command);\n        }\n    }\n\n    public synchronized static void registerOnDestroyCommand(Command command) {\n        if (destroyed) {\n            command.execute();\n        } else {\n            onDestroyCommandList.add(command);\n        }\n    }\n\n    private synchronized static void setRootDir(String rootDir) {\n        initialized = true;\n        WebAppSettings.get().setRootDir(rootDir);\n        logger.info(\"Root directory = \" + rootDir);\n        notifyCallbacks(onStartupCommandList);\n    }\n\n    private synchronized static void resetRootDir() {\n        destroyed = true;\n        WebAppSettings.get().setRootDir(null);\n        notifyCallbacks(onDestroyCommandList);\n    }\n\n    private static void notifyCallbacks(List<Command> commandList) {\n        for (Command command : commandList) {\n            command.execute();\n        }\n    }\n\n    @Override\n    public void contextInitialized(ServletContextEvent servletContextEvent) {\n        ServletContext servletContext = servletContextEvent.getServletContext();\n        String rootDir = servletContext.getRealPath(\"/\");\n        setRootDir(rootDir);\n    }\n\n    @Override\n    public void contextDestroyed(ServletContextEvent servletContextEvent) {\n        resetRootDir();\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/WebAppSettings.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.nio.file.FileSystems;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\nimport org.apache.commons.lang3.StringUtils;\n\n/**\n * It holds some settings regarding the WebApp execution context like, for instance, the home directory where the\n * webapp has been deployed.\n */\npublic class WebAppSettings {\n\n    private static WebAppSettings instance = null;\n    String separator = FileSystems.getDefault().getSeparator();\n    private String rootDir = null;\n\n    private WebAppSettings() {\n    }\n\n    public static WebAppSettings get() {\n        if (instance == null) {\n            instance = new WebAppSettings();\n        }\n        return instance;\n    }\n\n    /**\n     * Format a directory according to the file system separator\n     */\n    protected String formatDirectory(String dir) {\n        String result = StringUtils.replace(dir,\n                                            \"\\\\\",\n                                            separator);\n        result = StringUtils.replace(result,\n                                     \"/\",\n                                     separator);\n\n        // Remove the latest separator\n        if (result.endsWith(separator)) {\n            result = result.substring(0,\n                                      dir.length() - 1);\n        }\n        return result;\n    }\n\n    /**\n     * Retrieve the webapp's root directory => The directory where the container deploys the WAR content.\n     * @return An absolute path.\n     */\n    public String getRootDir() {\n        return rootDir;\n    }\n\n    /**\n     * Overwrites the webapp's root directory.\n     * <p>\n     * <p>This method is only intended to be called at bootstrap time by the\n     * {@link WebAppListener}. Changing the root directory may cause the webapp to severely fail.</p>\n     */\n    public void setRootDir(String dir) {\n        this.rootDir = dir != null ? dir.trim() : null;\n        if (rootDir != null) {\n            rootDir = formatDirectory(rootDir);\n        }\n    }\n\n    /**\n     * Calculate the absolute path of a directory placed under the the webapp's directory structure.\n     * @param relativePath The relative path\n     * @return An absolute path\n     */\n    public Path getAbsolutePath(String... relativePath) {\n        return rootDir != null ? Paths.get(rootDir,\n                                           relativePath) : null;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/WorkbenchServicesImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.kie.soup.xstream.XStreamUtils;\nimport org.uberfire.commons.cluster.ClusterParameters;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.workbench.services.WorkbenchServices;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\n@Service\n@ApplicationScoped\npublic class WorkbenchServicesImpl implements WorkbenchServices {\n\n    public static final String PERSPECTIVE_EXTENSION = \".perspective\";\n    private final XStream xs = XStreamUtils.createTrustingXStream();\n    private final ClusterParameters clusterParameters = new ClusterParameters();\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioService;\n    @Inject\n    private UserServicesImpl userServices;\n\n    @Override\n    public void save(final String perspectiveId,\n                     final PerspectiveDefinition perspective) {\n        final String xml = xs.toXML(perspective);\n        final Path perspectivePath = userServices.buildPath(\"perspectives\",\n                                                            perspectiveId + PERSPECTIVE_EXTENSION);\n        try {\n            ioService.startBatch(perspectivePath.getFileSystem());\n            ioService.write(perspectivePath,\n                            xml);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public void save(SplashScreenFilter splashFilter) {\n        final String xml = xs.toXML(splashFilter);\n        final Path splashFilterPath = userServices.buildPath(\"splash\",\n                                                             splashFilter.getName() + \".filter\");\n        try {\n            ioService.startBatch(splashFilterPath.getFileSystem());\n            ioService.write(splashFilterPath,\n                            xml);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public PerspectiveDefinition loadPerspective(final String perspectiveName) {\n        final Path perspectivePath = userServices.buildPath(\"perspectives\",\n                                                            perspectiveName + PERSPECTIVE_EXTENSION);\n        if (ioService.exists(perspectivePath)) {\n            final String xml = ioService.readAllString(perspectivePath);\n            return (PerspectiveDefinition) xs.fromXML(xml);\n        }\n\n        return null;\n    }\n\n    @Override\n    public Set<PerspectiveDefinition> loadPerspectives() {\n        final Set<PerspectiveDefinition> result = new HashSet<PerspectiveDefinition>();\n        final Path perspectivesPath = userServices.buildPath(\"perspectives\");\n        if (ioService.exists(perspectivesPath)) {\n\n            walkFileTree(perspectivesPath,\n                         new SimpleFileVisitor<Path>() {\n                             public FileVisitResult visitFile(final Path file,\n                                                              final BasicFileAttributes attrs) throws IOException {\n                                 try {\n                                     checkNotNull(\"file\",\n                                                  file);\n                                     checkNotNull(\"attrs\",\n                                                  attrs);\n                                     String fileName = file.getFileName().toString();\n                                     if (fileName.endsWith(PERSPECTIVE_EXTENSION) && attrs.isRegularFile()) {\n                                         String perspectiveName = fileName.substring(0,\n                                                                                     fileName.indexOf(PERSPECTIVE_EXTENSION));\n                                         PerspectiveDefinition def = loadPerspective(perspectiveName);\n                                         if (def != null) {\n                                             result.add(def);\n                                         }\n                                     }\n                                 } catch (final Exception ex) {\n                                     return FileVisitResult.TERMINATE;\n                                 }\n                                 return FileVisitResult.CONTINUE;\n                             }\n                         });\n        }\n        return result;\n    }\n\n    @Override\n    public void removePerspectiveState(final String perspectiveId) {\n        final Path perspectivePath = userServices.buildPath(\"perspectives\",\n                                                            perspectiveId + \".perspective\");\n        if (ioService.exists(perspectivePath)) {\n            ioService.delete(perspectivePath);\n        }\n    }\n\n    @Override\n    public void removePerspectiveStates() {\n        final Path perspectivesPath = userServices.buildPath(\"perspectives\");\n        if (ioService.exists(perspectivesPath)) {\n            try {\n                ioService.startBatch(perspectivesPath.getFileSystem());\n                ioService.delete(perspectivesPath,\n                                 StandardDeleteOption.NON_EMPTY_DIRECTORIES);\n            } finally {\n                ioService.endBatch();\n            }\n        }\n    }\n\n    @Override\n    public SplashScreenFilter loadSplashScreenFilter(String filterName) {\n        final Path splashFilterPath = userServices.buildPath(\"splash\",\n                                                             filterName + \".filter\");\n\n        if (ioService.exists(splashFilterPath)) {\n            final String xml = ioService.readAllString(splashFilterPath);\n            return (SplashScreenFilter) xs.fromXML(xml);\n        }\n\n        return null;\n    }\n\n    @Override\n    public Map<String, String> loadDefaultEditorsMap() {\n        final Map<String, String> map = new HashMap<String, String>();\n        try {\n            final Path path = getPathToDefaultEditors();\n            if (ioService.exists(path)) {\n                for (String line : ioService.readAllLines(path)) {\n                    if (!line.trim().startsWith(\"#\")) {\n                        String[] split = line.split(\"=\");\n                        map.put(split[0],\n                                split[1]);\n                    }\n                }\n            }\n\n            return map;\n        } catch (final NoSuchFileException e) {\n            e.printStackTrace();\n            return map;\n        }\n    }\n\n    @Override\n    public void saveDefaultEditors(final Map<String, String> properties) {\n        final StringBuilder text = new StringBuilder();\n        for (String key : properties.keySet()) {\n            text.append(String.format(\"%s=%s\",\n                                      key,\n                                      properties.get(key)));\n        }\n        final Path path = getPathToDefaultEditors();\n        try {\n            ioService.startBatch(path.getFileSystem());\n            ioService.write(path,\n                            text.toString());\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public boolean isWorkbenchOnCluster() {\n        return clusterParameters.isAppFormerClustered();\n    }\n\n    private Path getPathToDefaultEditors() {\n        return userServices.buildPath(\"defaultEditors\",\n                                      null);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/authz/AuthorizationPolicyDeployer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.backend.server.WebAppListener;\nimport org.uberfire.backend.server.WebAppSettings;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;\n\n/**\n * An Uberfire's startup bean that scans the classpath looking for an authorization policy to deploy (a file named\n * <i>security-policy.properties</i>).</p>\n * <p>\n * <p>If located, the policy file is loaded and passed along the {@link AuthorizationPolicyStorage}. The deployment\n * process is only executed once, so if a policy instance has been already stored then the deployment is left out.\n * The {@link AuthorizationPolicyMarshaller} class is used to read and convert the entries defined at\n * the <i>security-policy.properties</i> file into an {@link AuthorizationPolicy} instance.</p>\n * <p>\n * <p>It is also possible to split the policy into multiple files. The\n * <i>security-policy.properties</i> file is always mandatory as it serves as a marker file. Alongside that file,\n * several <i>security-module-?.properties</i> files can be created. The split mechanism allows either for the\n * provision of just a single full standalone policy file or multiple module files each of them containing different\n * entries. The way those files are defined is always up to the application developer.</p>\n */\n@Startup\n@ApplicationScoped\npublic class AuthorizationPolicyDeployer {\n\n    private Logger logger = LoggerFactory.getLogger(AuthorizationPolicyDeployer.class);\n\n    private AuthorizationPolicyStorage authzPolicyStorage;\n    private PermissionManager permissionManager;\n    private Event<AuthorizationPolicyDeployedEvent> deployedEvent;\n\n    public AuthorizationPolicyDeployer() {\n    }\n\n    @Inject\n    public AuthorizationPolicyDeployer(AuthorizationPolicyStorage authzPolicyStorage,\n                                       PermissionManager permissionManager,\n                                       Event<AuthorizationPolicyDeployedEvent> deployedEvent) {\n        this.authzPolicyStorage = authzPolicyStorage;\n        this.permissionManager = permissionManager;\n        this.deployedEvent = deployedEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        WebAppListener.registerOnStartupCommand(this::deployPolicy);\n    }\n\n    public void deployPolicy() {\n        Path policyDir = getPolicyDir();\n        deployPolicy(policyDir);\n    }\n\n    public Path getPolicyDir() {\n        String rootDir = WebAppSettings.get().getRootDir();\n        return Paths.get(rootDir,\n                         \"WEB-INF\",\n                         \"classes\");\n    }\n\n    public void deployPolicy(Path policyDir) {\n        if (policyDir != null) {\n            AuthorizationPolicy policy = authzPolicyStorage.loadPolicy();\n            if (policy == null) {\n                policy = loadPolicy(policyDir);\n                authzPolicyStorage.savePolicy(policy);\n                logger.info(\"Security policy deployed\");\n\n                // Ensure any role defined is available in the role registry\n                for (Role role : policy.getRoles()) {\n                    RoleRegistry.get().registerRole(role.getName());\n                }\n                // Notify the interested parties\n                deployedEvent.fire(new AuthorizationPolicyDeployedEvent(policy));\n            } else {\n                logger.info(\"Security policy active\");\n            }\n            // Set the active policy\n            permissionManager.setAuthorizationPolicy(policy);\n        } else {\n            logger.info(\"Security policy not defined\");\n        }\n    }\n\n    public AuthorizationPolicy loadPolicy(Path policyDir) {\n        AuthorizationPolicyBuilder builder = permissionManager.newAuthorizationPolicy();\n        AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller();\n        if (policyDir != null) {\n            try {\n                NonEscapedProperties properties = readPolicyProperties(policyDir);\n                marshaller.read(builder,\n                                properties);\n            } catch (IOException e) {\n                logger.warn(\"Error loading security policy files\",\n                            e);\n            }\n        }\n        return builder.build();\n    }\n\n    /**\n     * Put all the policy files together into a single properties instance.\n     * @param policyDir The source directory where to read the policy files from.\n     * @return An {@link NonEscapedProperties} instance containing all the properties read from the policy files found\n     * @throws IOException When an IO error occurs reading any of the policy files\n     */\n    public NonEscapedProperties readPolicyProperties(Path policyDir) throws IOException {\n        NonEscapedProperties properties = new NonEscapedProperties();\n        Files.list(policyDir)\n                .filter(this::isPolicyFile)\n                .forEach(path -> loadPolicyFile(properties,\n                                                path));\n\n        return properties;\n    }\n\n    public boolean isPolicyFile(Path p) {\n        String fileName = p.getName(p.getNameCount() - 1).toString();\n        return fileName.equals(\"security-policy.properties\") || fileName.startsWith(\"security-module-\");\n    }\n\n    public void loadPolicyFile(NonEscapedProperties properties,\n                               Path path) {\n        try {\n            properties.load(path);\n        } catch (IOException e) {\n            logger.error(\"Security policy file load error: \" + path,\n                         e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/authz/AuthorizationPolicyMarshaller.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.util.Map;\nimport java.util.Properties;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;\n\nimport static org.uberfire.backend.server.authz.AuthorizationPolicyMarshaller.ReadMode.DEFAULT_EXCLUDED;\nimport static org.uberfire.backend.server.authz.AuthorizationPolicyMarshaller.ReadMode.DEFAULT_ONLY;\nimport static org.uberfire.backend.server.authz.AuthorizationPolicyMarshaller.ReadMode.EVERYTHING;\n\n/**\n * Class used to convert an {@link AuthorizationPolicy} instance into/from a set of key/value pairs.\n * <p>\n * <p>The format of the key/value pairs is:</p><a name=\"entriesFormat\"></a>\n * <p>\n * <pre>\"classifier.identifier.setting.extra=value\"</pre>\n *\n * Where:\n * <ul>\n * <li>classifier = <i>role</i>|<i>group</i></li>\n * <li>identifier = An existing role or group identifier (depending on the classifier type)</li>\n * <li>setting    = <i>home</i>|<i>priority</i>|<i>permission</i></li>\n * <li>extra      = Extra setting information. Mandatory for instance to define the permission's name</li>\n * <li>value      = The setting value (depends on the setting selected). Value expected per setting type:\n * <ul>\n * <li>home: An existing perspective identifier to redirect after login</li>\n * <li>priority: An integer indicating how priority is this role|group compared to others. Used for conflict resolution.</li>\n * <li>permission: A name representing a specific feature or capability over a given resource.</li>\n * </ul></li>\n * </ul>\n *\n * <p>For example:\n *\n * <pre>\n * #Role \"admin\"\n * role.admin.home=Home\n * role.admin.priority=10\n * role.admin.permission.perspective.read=true\n * role.admin.permission.perspective.read.Dashboard=false\n *\n * # Role \"user\"\n * role.user.home=Dashboard\n * role.user.priority=0\n * role.user.permission.perspective.read=false\n * role.user.permission.perspective.read.Home=true\n * role.user.permission.perspective.read.Dashboard=true\n * </pre>\n */\npublic class AuthorizationPolicyMarshaller {\n\n    private static final String DEFAULT = \"default\";\n    private static final String ROLE = \"role\";\n    private static final String GROUP = \"group\";\n    private static final String PERMISSION = \"permission\";\n    private static final String PRIORITY = \"priority\";\n    private static final String HOME = \"home\";\n    private static final String DESCRIPTION = \"description\";\n\n    /**\n     * It reads all the entries from the collection of property files passed as a parameter. For every entry\n     * a call to the proper {@link AuthorizationPolicyBuilder} method is executed.\n     * <p>\n     * <p>The valid format for the entries is specified in the <a href=\"#entriesFormat\">class description</a>.</p>\n     * @param builder The {@link AuthorizationPolicyBuilder} used to register every processed entry.\n     * @param input The property objects containing the authz policy entries\n     */\n    public void read(AuthorizationPolicyBuilder builder,\n                     Map... input) {\n        for (Map m : input) {\n            // Process the global/default settings first in order to make sure the rest overwrite them and not viceversa\n            m.forEach((x, y) -> read(builder,\n                                     x.toString(),\n                                     y.toString(),\n                                     DEFAULT_ONLY));\n        }\n        for (Map m : input) {\n            // Process the rest of the settings\n            m.forEach((x, y) -> read(builder,\n                                     x.toString(),\n                                     y.toString(),\n                                     DEFAULT_EXCLUDED));\n        }\n    }\n\n    /**\n     * It reads key/value pair passed as a parameter and it calls to the right\n     * {@link AuthorizationPolicyBuilder} method .\n     * <p>\n     * <p>The valid format for an key/value pair is specified in the <a href=\"#entriesFormat\">class description</a>.</p>\n     * @param builder The {@link AuthorizationPolicyBuilder} used to register the entry.\n     * @param key The key to read\n     * @param value The value to read\n     */\n    public void read(AuthorizationPolicyBuilder builder,\n                     String key,\n                     String value) {\n        this.read(builder,\n                  key,\n                  value,\n                  EVERYTHING);\n    }\n\n    /**\n     * It reads key/value pair passed as a parameter and it calls to the right\n     * {@link AuthorizationPolicyBuilder} method .\n     * <p>\n     * <p>The valid format for an key/value pair is specified in the <a href=\"#entriesFormat\">class description</a>.</p>\n     * @param builder The {@link AuthorizationPolicyBuilder} used to register the entry.\n     * @param key The key to read\n     * @param value The value to read\n     * @param readMode The {@link ReadMode} determines if the specified key shall be included or excluded\n     */\n    public void read(AuthorizationPolicyBuilder builder,\n                     String key,\n                     String value,\n                     ReadMode readMode) {\n        Key keyObj = parse(key);\n\n        if (isReadable(keyObj,\n                       readMode)) {\n            read(builder,\n                 keyObj,\n                 value);\n        }\n    }\n\n    /**\n     * Check if a key object can be read according the given read mode.\n     */\n    private boolean isReadable(Key keyObj,\n                               ReadMode readMode) {\n        if (keyObj.isDefault() && DEFAULT_EXCLUDED.equals(readMode)) {\n            return false;\n        }\n        if (!keyObj.isDefault() && DEFAULT_ONLY.equals(readMode)) {\n            return false;\n        }\n        return true;\n    }\n\n    private void read(AuthorizationPolicyBuilder builder,\n                      Key keyObj,\n                      String value) {\n\n        if (!keyObj.isDefault()) {\n            if (keyObj.isRole()) {\n                builder.role(keyObj.getRole());\n            } else if (keyObj.isGroup()) {\n                builder.group(keyObj.getGroup());\n            } else {\n                throw new IllegalArgumentException(\"Key must start either with 'role' or 'group': \" + keyObj);\n            }\n        }\n\n        String attr = keyObj.getAttributeType();\n        switch (attr) {\n\n            case DESCRIPTION:\n                builder.description(value);\n                break;\n\n            case HOME:\n                builder.home(value);\n                break;\n\n            case PRIORITY:\n                builder.priority(Integer.parseInt(value));\n                break;\n\n            case PERMISSION:\n                String permission = keyObj.getAttributeId();\n                if (permission.length() == 0) {\n                    throw new IllegalArgumentException(\"Permission is incomplete: \" + keyObj);\n                }\n                boolean granted = Boolean.parseBoolean(value);\n                builder.permission(permission,\n                                   granted);\n                break;\n\n            default:\n                throw new IllegalArgumentException(\"Unknown key: \" + keyObj);\n        }\n    }\n\n    /**\n     * Dumps the {@link AuthorizationPolicy} instance passed as a parameter into the output {@link Properties} object\n     * specified.\n     * <p>\n     * <p>The format for an key/value pair is specified in the <a href=\"#entriesFormat\">class description</a>.</p>\n     * @param policy The {@link AuthorizationPolicy} to serialize\n     * @param out The {@link Properties} instance used as output\n     */\n    public void write(AuthorizationPolicy policy,\n                      Map out) {\n        write(policy.getHomePerspective(),\n              out);\n        write(policy.getPermissions(),\n              out);\n\n        for (Role subject : policy.getRoles()) {\n            write(subject,\n                  policy.getHomePerspective(subject),\n                  out);\n            write(subject,\n                  policy.getPriority(subject),\n                  out);\n            write(subject,\n                  policy.getPermissions(subject),\n                  out);\n        }\n        for (Group subject : policy.getGroups()) {\n            write(subject,\n                  policy.getHomePerspective(subject),\n                  out);\n            write(subject,\n                  policy.getPriority(subject),\n                  out);\n            write(subject,\n                  policy.getPermissions(subject),\n                  out);\n        }\n    }\n\n    public void write(String homePerspectiveId,\n                      Map out) {\n        String key = DEFAULT + \".\" + HOME;\n        out.remove(key);\n        if (homePerspectiveId != null) {\n            out.put(key,\n                    homePerspectiveId);\n        }\n    }\n\n    public void write(PermissionCollection permissions,\n                      Map out) {\n        for (Permission p : permissions.collection()) {\n            boolean granted = p.getResult() != null && p.getResult().equals(AuthorizationResult.ACCESS_GRANTED);\n            String key = DEFAULT + \".\" + PERMISSION + \".\" + p.getName();\n            out.put(key,\n                    Boolean.toString(granted));\n        }\n    }\n\n    public void write(Role role,\n                      String homePerspectiveId,\n                      Map out) {\n        String key = ROLE + \".\" + role.getName() + \".\" + HOME;\n        out.remove(key);\n        if (homePerspectiveId != null) {\n            out.put(key,\n                    homePerspectiveId);\n        }\n    }\n\n    public void write(Role role,\n                      int priority,\n                      Map out) {\n        String key = ROLE + \".\" + role.getName() + \".\" + PRIORITY;\n        out.put(key,\n                Integer.toString(priority));\n    }\n\n    public void write(Role role,\n                      PermissionCollection permissions,\n                      Map out) {\n        for (Permission p : permissions.collection()) {\n            boolean granted = p.getResult() != null && p.getResult().equals(AuthorizationResult.ACCESS_GRANTED);\n            String key = ROLE + \".\" + role.getName() + \".\" + PERMISSION + \".\" + p.getName();\n            out.put(key,\n                    Boolean.toString(granted));\n        }\n    }\n\n    public void write(Group group,\n                      String homePerspectiveId,\n                      Map out) {\n        String key = GROUP + \".\" + group.getName() + \".\" + HOME;\n        out.remove(key);\n        if (homePerspectiveId != null) {\n            out.put(key,\n                    homePerspectiveId);\n        }\n    }\n\n    public void write(Group group,\n                      int priority,\n                      Map out) {\n        String key = GROUP + \".\" + group.getName() + \".\" + PRIORITY;\n        out.put(key,\n                Integer.toString(priority));\n    }\n\n    public void write(Group group,\n                      PermissionCollection permissions,\n                      Map out) {\n        for (Permission p : permissions.collection()) {\n            boolean granted = p.getResult() != null && p.getResult().equals(AuthorizationResult.ACCESS_GRANTED);\n            String key = GROUP + \".\" + group.getName() + \".\" + PERMISSION + \".\" + p.getName();\n            out.put(key,\n                    Boolean.toString(granted));\n        }\n    }\n\n    public void remove(Group group, AuthorizationPolicy policy,\n                       Map out) {\n\n        write(policy, out);\n\n        for (Group subject : policy.getGroups()) {\n            if (group.getName().equals(subject.getName())) {\n                remove(subject,\n                       out);\n                remove(subject,\n                       policy.getPermissions(subject),\n                       out);\n            }\n        }\n    }\n\n    private void remove(Group group,\n                       Map out) {\n        String homePerspectiveKey = GROUP + \".\" + group.getName() + \".\" + HOME;\n        String priorityKey = GROUP + \".\" + group.getName() + \".\" + PRIORITY;\n        out.remove(priorityKey);\n        out.remove(homePerspectiveKey);\n    }\n\n    private void remove(Group group,\n                       PermissionCollection permissions,\n                       Map out) {\n        for (Permission p : permissions.collection()) {\n            String key = GROUP + \".\" + group.getName() + \".\" + PERMISSION + \".\" + p.getName();\n            out.remove(key);\n        }\n    }\n\n    public Key parse(String key) {\n        int _idx = 0;\n        String _key = key.endsWith(\".*\") ? key.substring(0,\n                                                         key.length() - 2) : key;\n        String[] tokens = _key.split(\"\\\\.\");\n        Key result = new Key(key);\n\n        // Type\n        if (_idx < tokens.length) {\n            result.setType(tokens[_idx++]);\n        }\n        // Role / Group\n        if (_idx < tokens.length) {\n            if (result.isRole()) {\n                result.setRole(tokens[_idx++]);\n            } else if (result.isGroup()) {\n                result.setGroup(tokens[_idx++]);\n            }\n        }\n        // Attribute type\n        if (_idx < tokens.length) {\n            result.setAttributeType(tokens[_idx++]);\n        }\n        // Attribute id.\n        if (_idx < tokens.length) {\n            StringBuilder attrIdStr = new StringBuilder();\n            for (int i = _idx; i < tokens.length; i++) {\n                if (i > _idx) {\n                    attrIdStr.append(\".\");\n                }\n                attrIdStr.append(tokens[i]);\n            }\n            result.setAttributeId(attrIdStr.toString());\n        }\n        // Validate & return\n        result.validate();\n        return result;\n    }\n\n    /**\n     * Different ways to specify what are the target entries to read when calling the\n     * {@link #read(AuthorizationPolicyBuilder, String, String, ReadMode)} method.\n     */\n    public enum ReadMode {\n\n        /**\n         * Read only those entries classified as \"default\"\n         */\n        DEFAULT_ONLY,\n\n        /**\n         * Read everything but the entries classified as \"default\"\n         */\n        DEFAULT_EXCLUDED,\n\n        /**\n         * Read everything\n         */\n        EVERYTHING\n    }\n\n    public class Key {\n\n        String key = null;\n        String type = null;\n        String roleGroup = null;\n        String attributeType = null;\n        String attributeId = null;\n\n        public Key(String key) {\n            this.key = key;\n        }\n\n        public boolean isDefault() {\n            return type != null && DEFAULT.equals(type);\n        }\n\n        public boolean isRole() {\n            return type != null && ROLE.equals(type);\n        }\n\n        public boolean isGroup() {\n            return type != null && GROUP.equals(type);\n        }\n\n        public String getRole() {\n            return isRole() ? roleGroup : null;\n        }\n\n        public void setRole(String role) {\n            this.roleGroup = role;\n        }\n\n        public String getGroup() {\n            return isGroup() ? roleGroup : null;\n        }\n\n        public void setGroup(String group) {\n            this.roleGroup = group;\n        }\n\n        public String getAttributeType() {\n            return attributeType;\n        }\n\n        public void setAttributeType(String attributeType) {\n            this.attributeType = attributeType;\n        }\n\n        public String getAttributeId() {\n            return attributeId;\n        }\n\n        public void setAttributeId(String attributeId) {\n            this.attributeId = attributeId;\n        }\n\n        public void setType(String type) {\n            this.type = type;\n        }\n\n        @Override\n        public String toString() {\n            return key;\n        }\n\n        public void validate() throws IllegalStateException {\n            if (type == null || (!DEFAULT.equals(type) && !ROLE.equals(type) && !GROUP.equals(type))) {\n                throw new IllegalArgumentException(\"Key must start with [default|role|group]\");\n            }\n            if (isRole() && (roleGroup == null || roleGroup.length() == 0)) {\n                throw new IllegalArgumentException(\"Role value is empty\");\n            }\n            if (isGroup() && (roleGroup == null || roleGroup.length() == 0)) {\n                throw new IllegalArgumentException(\"Group value is empty\");\n            }\n            if (attributeType == null || attributeType.length() == 0) {\n                throw new IllegalArgumentException(\"Empty attribute type not allowed: \" + attributeType);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/authz/AuthorizationPolicyVfsStorage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.io.StringReader;\nimport java.io.StringWriter;\nimport java.util.Date;\nimport java.util.HashMap;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\n/**\n * An implementation that stores the authorization policy in property files.\n */\n@ApplicationScoped\npublic class AuthorizationPolicyVfsStorage implements AuthorizationPolicyStorage {\n\n    private Logger logger = LoggerFactory.getLogger(AuthorizationPolicyVfsStorage.class);\n\n    private PermissionManager permissionManager;\n    private SpacesAPI spaces;\n    private IOService ioService;\n    private FileSystem fileSystem;\n    private Path root;\n    public static final String POLICY_FILE = \"security-policy.properties\";\n\n    public AuthorizationPolicyVfsStorage() {\n    }\n\n    @Inject\n    public AuthorizationPolicyVfsStorage(@Named(\"configIO\") IOService ioService,\n                                         PermissionManager permissionManager,\n                                         SpacesAPI spaces) {\n        this.ioService = ioService;\n        this.permissionManager = permissionManager;\n        this.spaces = spaces;\n    }\n\n    @PostConstruct\n    private synchronized void init() {\n        initFileSystem();\n    }\n\n    @Override\n    public synchronized AuthorizationPolicy loadPolicy() {\n        return loadPolicyFromVfs();\n    }\n\n    @Override\n    public synchronized void savePolicy(AuthorizationPolicy policy) {\n\n        // Dump the entire authz policy into a properties map\n        AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller();\n        NonEscapedProperties entries = new NonEscapedProperties();\n        marshaller.write(policy,\n                         entries);\n        savePolicyIntoVfs(entries,\n                          \"system\",\n                          \"Save policy\");\n    }\n\n    // VFS operations\n\n    public void initFileSystem() {\n        try {\n            fileSystem = ioService.newFileSystem(spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                                                             SpacesAPI.DEFAULT_SPACE,\n                                                                             \"security\"),\n                                                 new HashMap<String, Object>() {{\n                                                     put(\"init\",\n                                                         Boolean.TRUE);\n                                                     put(\"internal\",\n                                                         Boolean.TRUE);\n                                                 }});\n        } catch (FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                                                             SpacesAPI.DEFAULT_SPACE,\n                                                                             \"security\"));\n        }\n        this.root = fileSystem.getRootDirectories().iterator().next();\n    }\n\n    public AuthorizationPolicy loadPolicyFromVfs() {\n        Path authzPath = getAuthzPath();\n        if (!ioService.exists(authzPath)) {\n            return null;\n        }\n        AuthorizationPolicyBuilder builder = permissionManager.newAuthorizationPolicy();\n        AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller();\n\n        walkFileTree(authzPath,\n                     new SimpleFileVisitor<Path>() {\n                         @Override\n                         public FileVisitResult visitFile(final Path file,\n                                                          final BasicFileAttributes attrs) throws IOException {\n                             try {\n                                 checkNotNull(\"file\",\n                                              file);\n                                 checkNotNull(\"attrs\",\n                                              attrs);\n\n                                 if (isPolicyFile(file)) {\n                                     String content = ioService.readAllString(file);\n                                     NonEscapedProperties props = new NonEscapedProperties();\n                                     props.load(new StringReader(content));\n                                     marshaller.read(builder,\n                                                     props);\n                                 }\n                             } catch (final Exception e) {\n                                 logger.error(\"Authz policy file VFS read error: \" + file.getFileName(),\n                                              e);\n                                 return FileVisitResult.TERMINATE;\n                             }\n                             return FileVisitResult.CONTINUE;\n                         }\n                     });\n        return builder.build();\n    }\n\n    public boolean isPolicyFile(Path p) {\n        String fileName = p.getName(p.getNameCount() - 1).toString();\n        return fileName.equals(POLICY_FILE) || fileName.startsWith(\"security-module-\");\n    }\n\n    @Override\n    public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) {\n\n        AuthorizationPolicyMarshaller marshaller = new AuthorizationPolicyMarshaller();\n        NonEscapedProperties entries = new NonEscapedProperties();\n        marshaller.remove(group, policy,\n                          entries);\n        savePolicyIntoVfs(entries,\n                          \"system\",\n                          \"Delete Policy\");\n    }\n\n    public void savePolicyIntoVfs(NonEscapedProperties entries,\n                                  String subjectId,\n                                  String message) {\n        if (subjectId == null || message == null) {\n            ioService.startBatch(fileSystem);\n        } else {\n            ioService.startBatch(fileSystem,\n                                 new CommentedOption(subjectId,\n                                                     message));\n        }\n        try (StringWriter sw = new StringWriter()) {\n            // Store the entries into a properties file\n            entries.store(sw,\n                          \"Authorization Policy\",\n                          \"Last update: \" + new Date().toString());\n            String policyContent = sw.toString();\n            Path policyPath = getAuthzPath().resolve(POLICY_FILE);\n            ioService.write(policyPath,\n                            policyContent);\n        } catch (Exception e) {\n            logger.error(\"Authz policy write error.\",\n                         e);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    public Path getAuthzPath() {\n        checkNotNull(\"root\",\n                     root);\n        return root.resolve(\"authz\");\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/authz/AuthorizationServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\n@Service\n@ApplicationScoped\npublic class AuthorizationServiceImpl implements AuthorizationService {\n\n    private AuthorizationPolicyStorage storage;\n\n    private PermissionManager permissionManager;\n\n    private Event<AuthorizationPolicySavedEvent> savedEvent;\n\n    @Inject\n    public AuthorizationServiceImpl(final AuthorizationPolicyStorage storage, final PermissionManager permissionManager, final Event<AuthorizationPolicySavedEvent> savedEvent) {\n        this.storage = storage;\n        this.permissionManager = permissionManager;\n        this.savedEvent = savedEvent;\n    }\n\n    @Override\n    public AuthorizationPolicy loadPolicy() {\n        return storage.loadPolicy();\n    }\n\n    @Override\n    public void savePolicy(AuthorizationPolicy policy) {\n        storage.savePolicy(policy);\n        permissionManager.setAuthorizationPolicy(policy);\n        savedEvent.fire(new AuthorizationPolicySavedEvent(policy));\n    }\n\n    @Override\n    public void deletePolicyByGroup(Group group, AuthorizationPolicy policy) {\n        storage.deletePolicyByGroup(group, policy);\n        AuthorizationPolicy newPolicy = storage.loadPolicy();\n        permissionManager.setAuthorizationPolicy(newPolicy);\n        savedEvent.fire(new AuthorizationPolicySavedEvent(newPolicy));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/authz/NonEscapedProperties.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.Reader;\nimport java.io.Writer;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.util.Comparator;\nimport java.util.Properties;\nimport java.util.TreeMap;\n\n/**\n * A {@link TreeMap} implementation that mimics the behaviour of the JDK's {@link Properties} class\n * preventing the '/' or ':' chars from being escaped.\n */\npublic class NonEscapedProperties extends TreeMap<String, String> {\n\n    private static final long serialVersionUID = 1L;\n\n    public NonEscapedProperties() {\n    }\n\n    public NonEscapedProperties(Comparator<? super String> comparator) {\n        super(comparator);\n    }\n\n    public void load(Reader reader) throws IOException {\n        BufferedReader br = new BufferedReader(reader);\n        String line;\n        while ((line = br.readLine()) != null) {\n            putLine(line);\n        }\n    }\n\n    public void load(Path file) throws IOException {\n        for (String line : Files.readAllLines(file)) {\n            putLine(line);\n        }\n    }\n\n    public void store(Writer writer,\n                      String... comments) throws IOException {\n        StringBuilder out = new StringBuilder();\n        if (comments != null) {\n            for (String comment : comments) {\n                out.append(\"# \").append(comment).append(\"\\n\");\n            }\n            out.append(\"\\n\");\n        }\n        this.forEach((key, value) -> {\n            out.append(key).append(\"=\").append(value).append(\"\\n\");\n        });\n\n        writer.write(out.toString());\n        writer.flush();\n    }\n\n    private void putLine(String line) {\n        if (line != null) {\n            String _line = line.trim();\n            if (!_line.isEmpty() && !_line.startsWith(\"#\")) {\n                String[] tokens = _line.split(\"=\");\n                if (tokens.length == 1) {\n                    super.put(tokens[0],\n                              \"\");\n                }\n                if (tokens.length == 2) {\n                    super.put(tokens[0],\n                              tokens[1]);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/fs/FileSystemServiceImpl.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.fs;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.fs.FileSystemService;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\n\n@Service\n@ApplicationScoped\npublic class FileSystemServiceImpl implements FileSystemService {\n\n    @Override\n    public Boolean isGitDefaultFileSystem() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/ConfigIOServiceProducer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io;\n\nimport java.util.concurrent.ExecutorService;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.backend.server.security.IOSecurityAuth;\nimport org.uberfire.commons.concurrent.Unmanaged;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceNio2WrapperImpl;\nimport org.uberfire.java.nio.file.FileSystem;\n\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class ConfigIOServiceProducer {\n\n    private static ConfigIOServiceProducer instance;\n\n    private ExecutorService executorService;\n\n    private Instance<AuthenticationService> applicationProvidedConfigIOAuthService;\n\n    private IOService configIOService;\n    private FileSystem configFileSystem;\n\n    public static ConfigIOServiceProducer getInstance() {\n        if (instance == null) {\n            throw new IllegalStateException(ConfigIOServiceProducer.class.getName() + \" not initialized on startup\");\n        }\n        return instance;\n    }\n\n    public ConfigIOServiceProducer() {\n    }\n\n    @Inject\n    public ConfigIOServiceProducer(@Unmanaged ExecutorService executorService,\n                                   @IOSecurityAuth Instance<AuthenticationService> applicationProvidedConfigIOAuthService) {\n        this.executorService = executorService;\n        this.applicationProvidedConfigIOAuthService = applicationProvidedConfigIOAuthService;\n    }\n\n    @PostConstruct\n    public void setup() {\n        instance = this;\n        configIOService = new IOServiceNio2WrapperImpl(\"config\");\n        configFileSystem = (FileSystem) PriorityDisposableRegistry.get(\"systemFS\");\n    }\n\n    public void destroy() {\n        instance = null;\n    }\n\n    @Produces\n    @Named(\"configIO\")\n    public IOService configIOService() {\n        return configIOService;\n    }\n\n    public FileSystem configFileSystem() {\n        if (configFileSystem == null) {\n            configFileSystem = (FileSystem) PriorityDisposableRegistry.get(\"systemFS\");\n        }\n        return configFileSystem;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/DisposableShutdownService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.concurrent.ExecutorService;\nimport javax.inject.Inject;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\n\nimport org.uberfire.commons.concurrent.Managed;\nimport org.uberfire.commons.concurrent.Unmanaged;\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.commons.lifecycle.PriorityDisposable;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic class DisposableShutdownService implements ServletContextListener {\n\n    private ExecutorService unmanagedExecutorService;\n    private ExecutorService executorService;\n\n    public DisposableShutdownService() {\n    }\n\n    @Inject\n    public DisposableShutdownService(@Managed ExecutorService executorService,\n                                     @Unmanaged ExecutorService unmanagedExecutorService) {\n        this.executorService = executorService;\n        this.unmanagedExecutorService = unmanagedExecutorService;\n    }\n\n    @Override\n    public void contextInitialized(final ServletContextEvent sce) {\n    }\n\n    @Override\n    public void contextDestroyed(final ServletContextEvent sce) {\n\n        final List<PriorityDisposable> disposables = new ArrayList<PriorityDisposable>(PriorityDisposableRegistry.getDisposables());\n\n        sort(disposables);\n\n        for (final PriorityDisposable disposable : disposables) {\n            disposable.dispose();\n        }\n\n        executorService.shutdown();\n        unmanagedExecutorService.shutdown();\n\n        for (final FileSystemProvider fileSystemProvider : FileSystemProviders.installedProviders()) {\n            if (fileSystemProvider instanceof Disposable) {\n                ((Disposable) fileSystemProvider).dispose();\n            }\n        }\n\n        PriorityDisposableRegistry.clear();\n    }\n\n    void sort(final List<PriorityDisposable> disposables) {\n        Collections.sort(disposables,\n                         new Comparator<PriorityDisposable>() {\n                             @Override\n                             public int compare(final PriorityDisposable o1,\n                                                final PriorityDisposable o2) {\n                                 return (o2.priority() < o1.priority()) ? -1 : ((o2.priority() == o1.priority()) ? 0 : 1);\n                             }\n                         });\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/object/ObjectStorage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.object;\n\nimport java.net.URI;\n\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Object Storage definition\n */\npublic interface ObjectStorage {\n\n    /**\n     * Initialize the object storage.\n     * @param rootURI The root URI where is going to create the file system\n     */\n    void init(URI rootURI);\n\n    /**\n     * Checks if a path exists into the object storage.\n     * @param path the path to the stored object.\n     * @return true if exists that path into the storage else false.\n     */\n    boolean exists(String path);\n\n    /**\n     * Read the content of the path given\n     * @param path The path where the content is stored\n     * @return The content of the file unmarshalled\n     */\n    <T> T read(String path);\n\n    /**\n     * Write an object into the object storage. That object is marshalled into JSON. Lock will be enabled before write\n     * and disabled after it.\n     * @param path The path where the object is going to be written\n     * @param value The object itself\n     */\n    <T> void write(String path,\n                   T value);\n\n    /**\n     * Write an object into the object storage. That object is marshalled into JSON. You can avoid FS lock\n     * @param path The path where the object is going to be written\n     * @param value The object itself\n     * @param lock If the object storage should be locked while writing\n     */\n    <T> void write(String path,\n                   T value,\n                   boolean lock);\n\n    /**\n     * Delete a path from the object storage if exists. That path contains the object stored.\n     * @param path The path to delete\n     */\n    void delete(String path);\n\n    /**\n     * Return a path based on the filesystem that is implemented for storage\n     * @param first the path string or initial part of the path string\n     * @param path additional strings to be joined to form the path string\n     * @return the path object that represents the path.\n     */\n    Path getPath(String first,\n                 String... path);\n\n    void close();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/object/ObjectStorageImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.object;\n\nimport java.net.URI;\nimport java.util.HashMap;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.jboss.errai.marshalling.server.ServerMarshalling;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\n\npublic class ObjectStorageImpl implements ObjectStorage {\n\n    private IOService ioService;\n\n    private FileSystem fileSystem;\n\n    @Inject\n    public ObjectStorageImpl(@Named(\"configIO\") final IOService ioService) {\n        this.ioService = ioService;\n    }\n\n    @Override\n    public void init(URI rootURI) {\n        initializeMarshaller();\n        initializeFileSystem(rootURI);\n    }\n\n    @Override\n    public boolean exists(final String path) {\n        Path fsPath = fileSystem.getPath(path);\n\n        try {\n            return ioService.exists(fsPath);\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public <T> T read(final String path) {\n        Path fsPath = fileSystem.getPath(path);\n        try {\n            if (ioService.exists(fsPath)) {\n                String content = ioService.readAllString(fsPath);\n                return (T) ServerMarshalling.fromJSON(content);\n            }\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        return null;\n    }\n\n    @Override\n    public <T> void write(final String path,\n                          final T value) {\n        this.write(path,\n                   value,\n                   true);\n    }\n\n    @Override\n    public <T> void write(final String path,\n                          final T value,\n                          final boolean lock) {\n        try {\n            if (lock) {\n                ioService.startBatch(fileSystem);\n            }\n            Path fsPath = fileSystem.getPath(path);\n            String content = ServerMarshalling.toJSON(value);\n            ioService.write(fsPath,\n                            content);\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            if (lock) {\n                ioService.endBatch();\n            }\n        }\n    }\n\n    @Override\n    public void delete(final String path) {\n        ioService.deleteIfExists(fileSystem.getPath(path));\n    }\n\n    @Override\n    public Path getPath(String first,\n                        String... paths) {\n        return this.fileSystem.getPath(first,\n                                       paths);\n    }\n\n    @Override\n    public void close() {\n        this.fileSystem.close();\n        this.fileSystem.dispose();\n    }\n\n    private void initializeMarshaller() {\n        MappingContextSingleton.get();\n    }\n\n    private void initializeFileSystem(final URI rootURI) {\n        try {\n            fileSystem = ioService.newFileSystem(rootURI,\n                                                 new HashMap<String, Object>() {{\n                                                     put(\"init\",\n                                                         Boolean.TRUE);\n                                                     put(\"internal\",\n                                                         Boolean.TRUE);\n                                                 }});\n        } catch (FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(rootURI);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/AbstractIOWatchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.concurrent.CopyOnWriteArraySet;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.naming.InitialContext;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Filter;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.commons.concurrent.Unmanaged;\nimport org.uberfire.commons.services.cdi.ApplicationStarted;\nimport org.uberfire.io.IOWatchService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\npublic abstract class AbstractIOWatchService implements IOWatchService,\n                                                        Filter<WatchEvent<?>> {\n\n    private static final Logger LOG = LoggerFactory.getLogger(AbstractIOWatchService.class);\n\n    private static final Integer AWAIT_TERMINATION_TIMEOUT = Integer.parseInt(System.getProperty(\"org.uberfire.watcher.quitetimeout\",\n                                                                                                 \"3\"));\n\n    private final List<String> fileSystems = new ArrayList<>();\n    private final List<WatchService> watchServices = new ArrayList<>();\n    protected boolean isDisposed = false;\n\n    private boolean started;\n    private final Set<AsyncWatchService> watchThreads = new HashSet<>();\n    private Event<ResourceBatchChangesEvent> resourceBatchChanges;\n    private Event<ResourceUpdatedEvent> resourceUpdatedEvent;\n    private Event<ResourceRenamedEvent> resourceRenamedEvent;\n    private Event<ResourceDeletedEvent> resourceDeletedEvent;\n    private Event<ResourceAddedEvent> resourceAddedEvent;\n    private ExecutorService executorService;\n\n    private IOWatchServiceExecutor executor = null;\n\n    private final Set<Future<?>> jobs = new CopyOnWriteArraySet<>();\n\n    public AbstractIOWatchService() {\n    }\n\n    @Inject\n    public AbstractIOWatchService(Event<ResourceBatchChangesEvent> resourceBatchChanges,\n                                  Event<ResourceUpdatedEvent> resourceUpdatedEvent,\n                                  Event<ResourceRenamedEvent> resourceRenamedEvent,\n                                  Event<ResourceDeletedEvent> resourceDeletedEvent,\n                                  Event<ResourceAddedEvent> resourceAddedEvent,\n                                  @Unmanaged ExecutorService executorService) {\n\n        this.resourceBatchChanges = resourceBatchChanges;\n        this.resourceUpdatedEvent = resourceUpdatedEvent;\n        this.resourceRenamedEvent = resourceRenamedEvent;\n        this.resourceDeletedEvent = resourceDeletedEvent;\n        this.resourceAddedEvent = resourceAddedEvent;\n        this.executorService = executorService;\n    }\n\n    @PostConstruct\n    public void initialize() {\n        final boolean autostart = Boolean.parseBoolean(System.getProperty(\"org.uberfire.watcher.autostart\",\n                                                                          \"true\"));\n        if (autostart) {\n            start();\n        }\n    }\n\n    public synchronized void start() {\n        if (!started) {\n            this.started = true;\n            for (final AsyncWatchService watchThread : watchThreads) {\n                final IOWatchServiceExecutor watchServiceExecutor = getWatchServiceExecutor();\n                jobs.add(executorService.submit(new DescriptiveRunnable() {\n                    @Override\n                    public String getDescription() {\n                        return watchThread.getDescription();\n                    }\n\n                    @Override\n                    public void run() {\n                        watchThread.execute(watchServiceExecutor);\n                    }\n                }));\n            }\n            watchThreads.clear();\n        }\n    }\n\n    @PreDestroy\n    protected void dispose() {\n        isDisposed = true;\n        for (final WatchService watchService : watchServices) {\n            watchService.close();\n        }\n        for (final Future<?> job : jobs) {\n            if (!job.isCancelled() && !job.isDone()) {\n                job.cancel(true);\n            }\n        }\n        executorService.shutdown(); // Disable new tasks from being submitted\n        try {\n            // Wait a while for existing tasks to terminate\n            if (!executorService.awaitTermination(AWAIT_TERMINATION_TIMEOUT,\n                                                  TimeUnit.SECONDS)) {\n                executorService.shutdownNow(); // Cancel currently executing tasks\n                // Wait a while for tasks to respond to being cancelled\n                if (!executorService.awaitTermination(AWAIT_TERMINATION_TIMEOUT,\n                                                      TimeUnit.SECONDS)) {\n                    LOG.error(\"Thread pool did not terminate\");\n                }\n            }\n        } catch (InterruptedException ie) {\n            // (Re-)Cancel if current thread also interrupted\n            executorService.shutdownNow();\n            // Preserve interrupt status\n            Thread.currentThread().interrupt();\n        }\n    }\n\n    @Override\n    public boolean hasWatchService(final FileSystem fs) {\n        return fileSystems.contains(fs.getName());\n    }\n\n    @Override\n    public void addWatchService(final FileSystem fs,\n                                final WatchService ws) {\n        fileSystems.add(fs.getName());\n        watchServices.add(ws);\n\n        final AsyncWatchService asyncWatchService = new AsyncWatchService() {\n            @Override\n            public void execute(final IOWatchServiceExecutor wsExecutor) {\n                while (!isDisposed) {\n                    final WatchKey wk;\n                    try {\n                        wk = ws.take();\n                    } catch (final Exception ex) {\n                        break;\n                    }\n\n                    try {\n                        wsExecutor.execute(wk,\n                                           AbstractIOWatchService.this);\n                    } catch (final Exception ex) {\n                        LOG.error(\"Unexpected error during WatchService execution\",\n                                  ex);\n                    }\n\n                    // Reset the key -- this step is critical if you want to\n                    // receive further watch events.  If the key is no longer valid,\n                    // the directory is inaccessible so exit the loop.\n                    boolean valid = wk.reset();\n                    if (!valid) {\n                        break;\n                    }\n                }\n            }\n\n            @Override\n            public String getDescription() {\n                return AbstractIOWatchService.this.getClass().getName() + \"(\" + ws.toString() + \")\";\n            }\n        };\n\n        if (started) {\n            final IOWatchServiceExecutor watchServiceExecutor = getWatchServiceExecutor();\n            executorService.execute(new DescriptiveRunnable() {\n                @Override\n                public String getDescription() {\n                    return asyncWatchService.getDescription();\n                }\n\n                @Override\n                public void run() {\n                    asyncWatchService.execute(watchServiceExecutor);\n                }\n            });\n        } else {\n            watchThreads.add(asyncWatchService);\n        }\n    }\n\n    public void configureOnEvent(@Observes ApplicationStarted applicationStartedEvent) {\n        start();\n    }\n\n    protected IOWatchServiceExecutor getWatchServiceExecutor() {\n        if (executor == null) {\n            IOWatchServiceExecutor _executor = null;\n            try {\n                _executor = InitialContext.doLookup(\"java:module/IOWatchServiceExecutorImpl\");\n            } catch (final Exception ignored) {\n            }\n\n            if (_executor == null) {\n                _executor = new IOWatchServiceExecutorImpl();\n                ((IOWatchServiceExecutorImpl) _executor).setEvents(resourceBatchChanges,\n                                                                   resourceUpdatedEvent,\n                                                                   resourceRenamedEvent,\n                                                                   resourceDeletedEvent,\n                                                                   resourceAddedEvent);\n            }\n            executor = _executor;\n        }\n\n        return executor;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/AsyncWatchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\npublic interface AsyncWatchService {\n\n    void execute(final IOWatchServiceExecutor wsExecutor);\n\n    String getDescription();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/IOWatchServiceExecutor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\nimport org.uberfire.backend.server.util.Filter;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\n\npublic interface IOWatchServiceExecutor {\n\n    void execute(final WatchKey watchKey,\n                 final Filter<WatchEvent<?>> filter);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/io/watch/IOWatchServiceExecutorImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.ejb.AccessTimeout;\nimport javax.ejb.Singleton;\nimport javax.ejb.Startup;\nimport javax.ejb.TransactionAttribute;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.backend.server.util.Filter;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\nimport org.uberfire.workbench.events.ResourceAdded;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceDeleted;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceEvent;\nimport org.uberfire.workbench.events.ResourceRenamed;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdated;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\nimport static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;\nimport static org.uberfire.backend.server.util.Paths.convert;\n\n@Singleton\n@Startup\n@TransactionAttribute(NOT_SUPPORTED)\n@AccessTimeout(value = 30, unit = java.util.concurrent.TimeUnit.SECONDS)\npublic class IOWatchServiceExecutorImpl implements IOWatchServiceExecutor {\n\n    @Inject\n    private Event<ResourceBatchChangesEvent> resourceBatchChanges;\n\n    @Inject\n    private Event<ResourceUpdatedEvent> resourceUpdatedEvent;\n\n    @Inject\n    private Event<ResourceRenamedEvent> resourceRenamedEvent;\n\n    @Inject\n    private Event<ResourceDeletedEvent> resourceDeletedEvent;\n\n    @Inject\n    private Event<ResourceAddedEvent> resourceAddedEvent;\n\n    public void setEvents(final Event<ResourceBatchChangesEvent> resourceBatchChanges,\n                          final Event<ResourceUpdatedEvent> resourceUpdatedEvent,\n                          final Event<ResourceRenamedEvent> resourceRenamedEvent,\n                          final Event<ResourceDeletedEvent> resourceDeletedEvent,\n                          final Event<ResourceAddedEvent> resourceAddedEvent) {\n        this.resourceBatchChanges = resourceBatchChanges;\n        this.resourceUpdatedEvent = resourceUpdatedEvent;\n        this.resourceRenamedEvent = resourceRenamedEvent;\n        this.resourceDeletedEvent = resourceDeletedEvent;\n        this.resourceAddedEvent = resourceAddedEvent;\n    }\n\n    @Override\n    public void execute(final WatchKey wk,\n                        final Filter<WatchEvent<?>> filter) {\n        final List<WatchEvent<?>> events = wk.pollEvents();\n        WatchContext firstContext = null;\n\n        if (events.size() > 1) {\n            final Map<Path, Collection<ResourceChange>> changes = new HashMap<>();\n            for (final WatchEvent event : events) {\n                if (!filter.doFilter(event)) {\n                    if (firstContext == null) {\n                        firstContext = (WatchContext) event.context();\n                    }\n                    final Pair<Path, ResourceChange> result = buildChange(event);\n                    if (result != null) {\n                        if (!changes.containsKey(result.getK1())) {\n                            changes.put(result.getK1(),\n                                        new ArrayList<>());\n                        }\n                        changes.get(result.getK1()).add(result.getK2());\n                    }\n                }\n            }\n            if (changes.size() == 1 && changes.entrySet().iterator().next().getValue().size() == 1) {\n                final ResourceChange _event = changes.values().iterator().next().iterator().next();\n                if (_event instanceof ResourceUpdated) {\n                    resourceUpdatedEvent.fire((ResourceUpdatedEvent) toEvent(changes.keySet().iterator().next(),\n                                                                             _event,\n                                                                             firstContext));\n                } else if (_event instanceof ResourceAdded) {\n                    resourceAddedEvent.fire((ResourceAddedEvent) toEvent(changes.keySet().iterator().next(),\n                                                                         _event,\n                                                                         firstContext));\n                } else if (_event instanceof ResourceRenamed) {\n                    resourceRenamedEvent.fire((ResourceRenamedEvent) toEvent(changes.keySet().iterator().next(),\n                                                                             _event,\n                                                                             firstContext));\n                } else if (_event instanceof ResourceDeleted) {\n                    resourceDeletedEvent.fire((ResourceDeletedEvent) toEvent(changes.keySet().iterator().next(),\n                                                                             _event,\n                                                                             firstContext));\n                }\n            } else if (changes.size() >= 1) {\n                resourceBatchChanges.fire(new ResourceBatchChangesEvent(changes,\n                                                                        message(firstContext),\n                                                                        sessionInfo(firstContext)));\n            }\n        } else if (events.size() == 1) {\n            final WatchEvent<?> event = events.get(0);\n            if (!filter.doFilter(event)) {\n                if (event.kind().equals(StandardWatchEventKind.ENTRY_MODIFY)) {\n                    resourceUpdatedEvent.fire(buildEvent(ResourceUpdatedEvent.class,\n                                                         event).getK2());\n                } else if (event.kind().equals(StandardWatchEventKind.ENTRY_CREATE)) {\n                    resourceAddedEvent.fire(buildEvent(ResourceAddedEvent.class,\n                                                       event).getK2());\n                } else if (event.kind().equals(StandardWatchEventKind.ENTRY_RENAME)) {\n                    resourceRenamedEvent.fire(buildEvent(ResourceRenamedEvent.class,\n                                                         event).getK2());\n                } else if (event.kind().equals(StandardWatchEventKind.ENTRY_DELETE)) {\n                    resourceDeletedEvent.fire(buildEvent(ResourceDeletedEvent.class,\n                                                         event).getK2());\n                }\n            }\n        }\n    }\n\n    private String message(final WatchContext context) {\n        if (context == null) {\n            return null;\n        }\n        return context.getMessage();\n    }\n\n    private <T extends ResourceEvent> Pair<Path, T> buildEvent(final Class<T> clazz,\n                                                               final WatchEvent<?> event) {\n        final WatchContext context = (WatchContext) event.context();\n\n        final Path _affectedPath;\n        final T result;\n        if (event.kind().equals(StandardWatchEventKind.ENTRY_MODIFY)) {\n            _affectedPath = convert(context.getOldPath());\n            result = (T) new ResourceUpdatedEvent(_affectedPath,\n                                                  context.getMessage(),\n                                                  sessionInfo(context));\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_CREATE)) {\n            _affectedPath = convert(context.getPath());\n            result = (T) new ResourceAddedEvent(_affectedPath,\n                                                context.getMessage(),\n                                                sessionInfo(context));\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_RENAME)) {\n            _affectedPath = convert(context.getOldPath());\n            result = (T) new ResourceRenamedEvent(_affectedPath,\n                                                  convert(context.getPath()),\n                                                  context.getMessage(),\n                                                  sessionInfo(context));\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_DELETE)) {\n            _affectedPath = convert(context.getOldPath());\n            result = (T) new ResourceDeletedEvent(_affectedPath,\n                                                  context.getMessage(),\n                                                  sessionInfo(context));\n        } else {\n            _affectedPath = null;\n            result = null;\n        }\n        if (_affectedPath == null) {\n            return null;\n        }\n\n        return Pair.newPair(_affectedPath,\n                            result);\n    }\n\n    private Pair<Path, ResourceChange> buildChange(final WatchEvent<?> event) {\n        final WatchContext context = (WatchContext) event.context();\n\n        final Path _affectedPath;\n        final ResourceChange result;\n        if (event.kind().equals(StandardWatchEventKind.ENTRY_MODIFY)) {\n            _affectedPath = convert(context.getOldPath());\n            result = new ResourceUpdated(context.getMessage());\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_CREATE)) {\n            _affectedPath = convert(context.getPath());\n            result = new ResourceAdded(context.getMessage());\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_RENAME)) {\n            _affectedPath = convert(context.getOldPath());\n            result = new ResourceRenamed(convert(context.getPath()),\n                                         context.getMessage());\n        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_DELETE)) {\n            _affectedPath = convert(context.getOldPath());\n            result = new ResourceDeleted(context.getMessage());\n        } else {\n            _affectedPath = null;\n            result = null;\n        }\n        if (_affectedPath == null) {\n            return null;\n        }\n\n        return Pair.newPair(_affectedPath,\n                            result);\n    }\n\n    private ResourceEvent toEvent(final Path path,\n                                  final ResourceChange change,\n                                  final WatchContext context) {\n        if (change instanceof ResourceUpdated) {\n            return new ResourceUpdatedEvent(path,\n                                            context.getMessage(),\n                                            sessionInfo(context));\n        } else if (change instanceof ResourceAdded) {\n            return new ResourceAddedEvent(path,\n                                          context.getMessage(),\n                                          sessionInfo(context));\n        } else if (change instanceof ResourceRenamed) {\n            return new ResourceRenamedEvent(path,\n                                            ((ResourceRenamed) change).getDestinationPath(),\n                                            context.getMessage(),\n                                            sessionInfo(context));\n        } else if (change instanceof ResourceDeleted) {\n            return new ResourceDeletedEvent(path,\n                                            context.getMessage(),\n                                            sessionInfo(context));\n        }\n        return null;\n    }\n\n    private SessionInfo sessionInfo(final WatchContext context) {\n        final String sessionId;\n        final String user;\n        if (context.getSessionId() == null) {\n            sessionId = \"<system>\";\n        } else {\n            sessionId = context.getSessionId();\n        }\n        if (context.getUser() == null) {\n            user = \"<system>\";\n        } else {\n            user = context.getUser();\n        }\n\n        return new SessionInfoImpl(sessionId,\n                                   new UserImpl(user));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/PluginService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins;\n\nimport java.io.File;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.servlet.ServletContext;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.server.plugins.engine.PluginManager;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\n/**\n * Provides an Errai RPC endpoint to serve JavaScript runtime plugins (authored\n * in plain JS) and Perspective Layouts (authored in plain JSON via Layout Editor\n * to the client where the corresponding scripts get injected into\n * the DOM. These plugins contain logic to programmatically register themselves\n * with UberFire.\n * It also initializes the {@link PluginManager} which\n * is responsible for loading plugins authored in GWT/Errai/UberFire.\n * These plugin scripts are injected into the host page by Errai once they are\n * registered with Errai's script registry or injected in runtime (when they\n * use Uberfire JS API).\n * Scripts injected via Errai's script registry do not need any programmatic\n * registration logic on the client as all contained managed beans (i.e.\n * perspectives, editors, screens) are automatically discovered and activated by\n * Errai IOC.\n */\n@Service\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class PluginService {\n\n    private static PluginService instance;\n\n    private PluginManager pluginManager;\n\n    public PluginService() {\n    }\n\n    @Inject\n    public PluginService(PluginManager pluginManager) {\n        this.pluginManager = pluginManager;\n    }\n\n    public static PluginService getInstance() {\n        if (instance == null) {\n            throw new IllegalStateException(PluginService.class.getName() + \" was not initialized on startup\");\n        }\n        return instance;\n    }\n\n    @PostConstruct\n    private void startUp() {\n        instance = this;\n    }\n\n    public void init(final ServletContext servletContext) {\n        final String contextRootDir = getContextRootDir(servletContext);\n        final String pluginDir = getPlugins(servletContext,\n                                            \"plugins\");\n        if (contextRootDir != null && pluginDir != null) {\n            pluginManager.init(contextRootDir,\n                               pluginDir);\n        }\n    }\n\n    String getPlugins(ServletContext servletContext,\n                      String plugins) {\n        return PluginUtils.getRealPath(servletContext,\n                                       plugins);\n    }\n\n    String getContextRootDir(ServletContext servletContext) {\n        return getPlugins(servletContext,\n                          File.separator);\n    }\n}\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/PluginStartup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins;\n\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\nimport javax.servlet.annotation.WebListener;\n\n/**\n * Initializes the {@link PluginService} when the web application starts\n * up.\n */\n@WebListener\npublic class PluginStartup implements ServletContextListener {\n\n    @Override\n    public void contextInitialized(ServletContextEvent sce) {\n        PluginService.getInstance().init(sce.getServletContext());\n    }\n\n    @Override\n    public void contextDestroyed(ServletContextEvent sce) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/PluginUtils.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins;\n\nimport javax.servlet.ServletContext;\n\nimport org.jboss.errai.bus.server.api.RpcContext;\n\npublic class PluginUtils {\n\n    public static String getRealPath(final String path) {\n        return getRealPath(RpcContext.getServletRequest().getServletContext(),\n                           path);\n    }\n\n    public static String getRealPath(final ServletContext servletContext,\n                                     final String path) {\n        final String realPath = servletContext.getRealPath(path);\n        if (realPath == null) {\n            return null;\n        } else {\n            return realPath.replaceAll(\"\\\\\\\\\",\n                                       \"/\").replaceAll(\" \",\n                                                       \"%20\");\n        }\n    }\n}\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/RuntimePluginServiceImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.plugin.RuntimePlugin;\nimport org.uberfire.backend.plugin.RuntimePluginProcessor;\nimport org.uberfire.backend.plugin.RuntimePluginService;\nimport org.uberfire.backend.server.plugins.processors.HTMLPluginProcessor;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.spaces.SpacesAPI;\n\n@Service\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class RuntimePluginServiceImpl implements RuntimePluginService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(RuntimePluginServiceImpl.class);\n\n    @Inject\n    @Any\n    Instance<RuntimePluginProcessor> runtimePluginProcessors;\n\n    @Inject\n    HTMLPluginProcessor htmlPluginProcessor;\n\n    @Inject\n    SpacesAPI spaces;\n\n    @Override\n    public Collection<String> listFrameworksContent() {\n        return directoryContent(\"frameworks\",\n                                \"*.js\");\n    }\n\n    @Override\n    public Collection<String> listPluginsContent() {\n        return directoryContent(\"plugins\",\n                                \"*.js\");\n    }\n\n    @Override\n    public String getTemplateContent(String url) {\n\n        String pluginTemplateContent = getRuntimePluginTemplateContent(url);\n        if (isAJarPluginTemplate(pluginTemplateContent)) {\n            return pluginTemplateContent;\n        }\n\n        String realPath = PluginUtils.getRealPath(\"plugins\");\n        if (realPath == null) {\n            LOGGER.info(\"Not fetching template content for \" + url + \" because getRealPath() is\"\n                                + \" returning null. (This app is probably deployed in an unexploded .war)\");\n            return \"\";\n        }\n        final Path template;\n        if (url.startsWith(\"/\")) {\n            template = Paths.get(URI.create(\"file://\" + realPath + url));\n        } else {\n            template = Paths.get(URI.create(\"file://\" + realPath + \"/\" + url));\n        }\n\n        if (Files.isRegularFile(template)) {\n            return new String(Files.readAllBytes(template));\n        }\n        return \"\";\n    }\n\n    private boolean isAJarPluginTemplate(String pluginContent) {\n        return pluginContent != null && !pluginContent.isEmpty();\n    }\n\n    private Collection<String> directoryContent(final String directory,\n                                                final String glob) {\n        String realPath = PluginUtils.getRealPath(directory);\n        if (realPath == null) {\n            LOGGER.info(\"Not listing directory content for \" + directory + \"/\" + glob +\n                                \" because getRealPath() is returning null. (This app is probably deployed in an unexploded .war)\");\n            return Collections.emptyList();\n        }\n        final Collection<String> result = new ArrayList<>();\n\n        final Path pluginsRootPath = Paths.get(URI.create(\"file://\" + realPath));\n\n        if (Files.isDirectory(pluginsRootPath)) {\n            final DirectoryStream<Path> stream = Files.newDirectoryStream(pluginsRootPath,\n                                                                          glob);\n\n            for (final Path activeJS : stream) {\n                result.add(new String(Files.readAllBytes(activeJS)));\n            }\n        }\n\n        return result;\n    }\n\n    @Override\n    public String getRuntimePluginTemplateContent(String pluginName) {\n        if (htmlPluginProcessor.isRegistered(pluginName)) {\n            Optional<RuntimePlugin> runtimePlugin = htmlPluginProcessor.lookupForTemplate(pluginName);\n\n            return runtimePlugin.\n                    map(p -> p.getPluginContent()).orElse(\"\");\n        }\n        return \"\";\n    }\n\n    @Override\n    public List<RuntimePlugin> getRuntimePlugins() {\n        List<RuntimePlugin> runtimePlugins = new ArrayList<>();\n\n        runtimePluginProcessors.forEach(p -> runtimePlugins.addAll(p.getAvailableRuntimePlugins()));\n\n        return runtimePlugins;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/engine/PluginJarProcessor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.jar.JarEntry;\nimport java.util.jar.JarFile;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.lang3.StringUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.plugin.PluginProcessor;\nimport org.uberfire.workbench.events.PluginReloadedEvent;\n\nimport static org.apache.commons.lang3.StringUtils.substringAfterLast;\n\n/**\n * Processes and activates deployed plugin jars. The plugin jars can contain\n * GWT .js files, Uberfire Runtime Plugins and html templates.\n * The corresponding GWT .js files are registered with the {@link PluginProcessor}\n * and are added to the host page's &lt;head&gt; element by Errai,\n * so the plugin scripts execute before the web application's main script runs.\n * This is required to ensure plugins and their managed beans are discoverable by\n * Errai's bean manager when the main application bootstraps.\n * Uberfire Runtime Plugins are loaded after Errai and Uberfire bootstrap.\n */\n@Dependent\npublic class PluginJarProcessor {\n\n    private static final Logger LOG = LoggerFactory.getLogger(PluginJarProcessor.class);\n\n    private Instance<PluginProcessor> pluginProcessors;\n    private String pluginsDir;\n    private String pluginsDeploymentUrlPath;\n    private String pluginsDeploymentDir;\n    private Event<PluginReloadedEvent> pluginsReloadedEvent;\n\n    @Inject\n    public PluginJarProcessor(@Any Instance<PluginProcessor> pluginProcessors,\n                              final Event<PluginReloadedEvent> pluginsReloadedEvent) {\n        this.pluginProcessors = pluginProcessors;\n        this.pluginsReloadedEvent = pluginsReloadedEvent;\n    }\n\n    /**\n     * Processes and loads the currently deployed plugins.\n     * @param pluginsDir the plugin directory, must not be null.\n     * @param pluginsDeploymentDir the directory to deploy plugin contents to, must not be null.\n     */\n    public void init(final String pluginsDir,\n                     final String pluginsDeploymentDir) throws IOException {\n\n        this.pluginsDeploymentUrlPath = substringAfterLast(pluginsDeploymentDir,\n                                                           File.separator);\n        this.pluginsDeploymentDir = pluginsDeploymentDir;\n        this.pluginsDir = pluginsDir;\n        loadPlugins();\n    }\n\n    void loadPlugins() throws IOException {\n        removeAllPlugins();\n\n        final File pluginsRoot = new File(pluginsDir);\n        if (pluginsRoot.exists()) {\n            Collection<File> deployedPlugins = FileUtils.listFiles(pluginsRoot,\n                                                                   new String[]{\"jar\"},\n                                                                   false);\n\n            deployedPlugins.forEach(p -> loadPlugins(Paths.get(p.getAbsolutePath()),\n                                                     false));\n        }\n    }\n\n    void removeAllPlugins() {\n        pluginProcessors.forEach(p -> p.removeAll());\n    }\n\n    /**\n     * Clears the plugins and reloads all currently deployed plugins.\n     * Fires a {@link PluginReloadedEvent} when done.\n     */\n    public void reload() throws IOException {\n        loadPlugins();\n        pluginsReloadedEvent.fire(new PluginReloadedEvent());\n    }\n\n    /**\n     * Unpacks the provided plugin (path pointing to a JAR file), searches for\n     * the corresponding plugins files and process the plugin with the\n     * corresponding {@link PluginProcessor}.\n     * @param path path to a deployed jar file.\n     * @param notifyClients true if clients should be notified (of added and updated\n     * plugins) through CDI events, otherwise false.\n     */\n    public void loadPlugins(Path path,\n                            boolean notifyClients) {\n        final List<String> pluginsFiles = extractFilesFromPluginsJar(pluginsDir + File.separator + path.toFile().getName());\n\n        if (!pluginsFiles.isEmpty()) {\n            for (String pluginName : pluginsFiles) {\n                for (PluginProcessor pluginRegistry : pluginProcessors) {\n                    if (pluginRegistry.shouldProcess(pluginName)) {\n                        pluginRegistry.process(pluginName,\n                                               pluginsDeploymentDir,\n                                               notifyClients);\n                    }\n                }\n            }\n        } else {\n            LOG.warn(\"Deployed plugin \" + path.toFile().getName() + \" does not contain any plugins!\");\n        }\n    }\n\n    List<String> extractFilesFromPluginsJar(String jarFileName) {\n        List<String> pluginsFiles = new ArrayList<>();\n\n        try (JarFile jar = new JarFile(jarFileName)) {\n            final Enumeration<?> enumEntries = jar.entries();\n            while (enumEntries.hasMoreElements()) {\n                final JarEntry file = (JarEntry) enumEntries.nextElement();\n                String fileName = StringUtils.substringAfterLast(file.getName(),\n                                                                 File.separator);\n\n                if (PluginProcessor.isAValidPluginFileExtension(fileName)) {\n                    final File f = new File(pluginsDeploymentDir + File.separator + fileName);\n                    try (InputStream is = jar.getInputStream(file);\n                         FileOutputStream fos = new FileOutputStream(f)) {\n\n                        while (is.available() > 0) {\n                            fos.write(is.read());\n                        }\n                    }\n\n                    pluginsFiles.add(fileName);\n                }\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n\n        return pluginsFiles;\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/engine/PluginManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.UnsupportedEncodingException;\nimport java.net.URI;\nimport java.net.URLDecoder;\nimport java.util.Collection;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.FileUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.util.URIUtil;\n\n/**\n * Manages Uberfire Plugins which involves monitoring the plugins directory\n * (see {@link PluginWatcher}), and loading the deployed plugins (see\n * {@link PluginJarProcessor}).\n */\n@Dependent\npublic class PluginManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(PluginManager.class);\n\n    private PluginWatcher pluginWatcher;\n    private PluginJarProcessor pluginJarProcessor;\n    private ExecutorService executor;\n\n    @Inject\n    public PluginManager(final PluginWatcher pluginWatcher,\n                         final PluginJarProcessor pluginJarProcessor) {\n\n        this.pluginWatcher = pluginWatcher;\n        this.pluginJarProcessor = pluginJarProcessor;\n        this.executor = Executors.newSingleThreadExecutor();\n    }\n\n    @PreDestroy\n    void shutDown() {\n        pluginWatcher.stop();\n    }\n\n    /**\n     * Initializes the {@link PluginJarProcessor} and\n     * {@link PluginWatcher} based on the provided parameters.\n     * @param contextRootDir the web application's context root directory, must not be\n     * null.\n     * @param pluginDir the plugin directory, must not be null.\n     */\n    public void init(final String contextRootDir,\n                     final String pluginDir) {\n        try {\n            pluginJarProcessor.init(pluginDir,\n                                    findPluginDeploymentDir(contextRootDir));\n\n            pluginWatcher.start(pluginDir,\n                                executor,\n                                pluginJarProcessor);\n        } catch (Exception e) {\n            LOG.error(\"Failed to initialize \" + PluginManager.class.getName(),\n                      e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    /**\n     * Finds the directory to deploy plugin contents to.\n     * @param contextRootDir the web application's context root directory, must not be\n     * null.\n     * @return the directory hosting the plugin's JS files or the provided\n     * context root directory if not found.\n     */\n    String findPluginDeploymentDir(String contextRootDir) throws IOException {\n        final Collection<File> gwtFiles = FileUtils.listFiles(new File(encodePath(contextRootDir)),\n                                                              new String[]{\"nocache.js\"},\n                                                              true);\n        if (!gwtFiles.isEmpty()) {\n            final File gwtFile = gwtFiles.iterator().next();\n            return gwtFile.getParentFile().getCanonicalPath();\n        }\n        return new File(contextRootDir).getCanonicalPath();\n    }\n\n    String encodePath(String contextRootDir) {\n        return URIUtil.decode(contextRootDir);\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/engine/PluginWatcher.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.io.IOException;\nimport java.nio.file.FileSystems;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.WatchEvent;\nimport java.nio.file.WatchEvent.Kind;\nimport java.nio.file.WatchKey;\nimport java.nio.file.WatchService;\nimport java.util.List;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.TimeUnit;\nimport javax.enterprise.context.Dependent;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static java.nio.file.StandardWatchEventKinds.ENTRY_CREATE;\nimport static java.nio.file.StandardWatchEventKinds.ENTRY_DELETE;\nimport static java.nio.file.StandardWatchEventKinds.ENTRY_MODIFY;\nimport static java.nio.file.StandardWatchEventKinds.OVERFLOW;\n\n/**\n * Monitors the plugins directory for changes and loads/removes plugins using the\n * {@link PluginJarProcessor}.\n */\n@Dependent\npublic class PluginWatcher {\n\n    private static final Logger LOG = LoggerFactory.getLogger(PluginWatcher.class);\n\n    volatile boolean active;\n    private ExecutorService executor;\n    private PluginJarProcessor pluginJarProcessor;\n\n    /**\n     * Starts the plugins watcher iff the provided plugin directory exists and\n     * the watcher hasn't already been started.\n     * @param pluginDir the plugin directory to monitor\n     * @param executor the executor service to submit the watch thread to\n     * @param pluginJarProcessor the plugin loader for registering and removing plugins\n     */\n    void start(final String pluginDir,\n               final ExecutorService executor,\n               final PluginJarProcessor pluginJarProcessor) throws IOException {\n\n        final Path pluginsRootPath = Paths.get(pluginDir);\n        if (active || !Files.exists(pluginsRootPath)) {\n            return;\n        }\n\n        this.active = true;\n        this.executor = executor;\n        this.pluginJarProcessor = pluginJarProcessor;\n\n        final WatchService watchService = FileSystems.getDefault().newWatchService();\n        pluginsRootPath.register(watchService,\n                                 ENTRY_CREATE,\n                                 ENTRY_MODIFY,\n                                 ENTRY_DELETE);\n\n        startWatchService(watchService);\n    }\n\n    private void startWatchService(final WatchService watchService) {\n        executor.submit(() -> {\n            while (active) {\n                try {\n                    final WatchKey watchKey = watchService.poll(5,\n                                                                TimeUnit.SECONDS);\n\n                    if (watchKey != null && active) {\n                        final List<WatchEvent<?>> events = watchKey.pollEvents();\n                        for (WatchEvent<?> event : events) {\n                            final Kind<?> kind = event.kind();\n                            if (kind == OVERFLOW) {\n                                continue;\n                            }\n\n                            final Path file = (Path) event.context();\n                            if (kind == ENTRY_CREATE || kind == ENTRY_MODIFY) {\n                                loadPlugins(file);\n                            } else if (kind == ENTRY_DELETE) {\n                                reloadPlugins(file);\n                            }\n                        }\n                        boolean valid = watchKey.reset();\n                        if (!valid) {\n                            break;\n                        }\n                    }\n                } catch (InterruptedException e) {\n                    active = false;\n                    Thread.currentThread().interrupt();\n                }\n            }\n        });\n    }\n\n    void stop() {\n        active = false;\n\n        if (executor != null) {\n            executor.shutdown();\n        }\n    }\n\n    void loadPlugins(final Path file) {\n        if (file.getFileName().toString().endsWith(\".jar\")) {\n            try {\n                pluginJarProcessor.loadPlugins(file,\n                                               true);\n            } catch (Exception e) {\n                logPluginsWatcherError(\"Failed to process new plugin \" + file.getFileName().toString(),\n                                       e,\n                                       !active);\n            }\n        }\n    }\n\n    void reloadPlugins(final Path file) {\n        try {\n            pluginJarProcessor.reload();\n        } catch (Exception e) {\n            logPluginsWatcherError(\"Failed to delete plugin \" + file.getFileName().toString(),\n                                   e,\n                                   !active);\n        }\n    }\n\n    void logPluginsWatcherError(final String message,\n                                final Exception e,\n                                final boolean debug) {\n        if (debug) {\n            // Debug level is sufficient in case application is stopping\n            LOG.debug(message);\n        } else {\n            LOG.error(message);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/processors/AbstractRuntimePluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.processors;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.plugin.RuntimePlugin;\nimport org.uberfire.backend.plugin.RuntimePluginProcessor;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\npublic abstract class AbstractRuntimePluginProcessor implements RuntimePluginProcessor {\n\n    private static final Logger LOG = LoggerFactory.getLogger(AbstractRuntimePluginProcessor.class);\n\n    final Map<String, RuntimePlugin> availableRuntimePlugins = new HashMap<>();\n\n    private Event<PluginAddedEvent> pluginAddedEvent;\n\n    private Event<PluginUpdatedEvent> pluginUpdatedEvent;\n\n    public AbstractRuntimePluginProcessor() {\n\n    }\n\n    public AbstractRuntimePluginProcessor(Event<PluginAddedEvent> pluginAddedEvent,\n                                          Event<PluginUpdatedEvent> pluginUpdatedEvent) {\n        this.pluginAddedEvent = pluginAddedEvent;\n        this.pluginUpdatedEvent = pluginUpdatedEvent;\n    }\n\n    @Override\n    public Collection<RuntimePlugin> getAvailableRuntimePlugins() {\n        return availableRuntimePlugins.values();\n    }\n\n    @Override\n    public void removeAll() {\n        availableRuntimePlugins.clear();\n    }\n\n    @Override\n    public boolean isRegistered(String pluginName) {\n        return availableRuntimePlugins.containsKey(pluginName);\n    }\n\n    @Override\n    public boolean shouldProcess(String pluginName) {\n        return pluginName.endsWith(getType().getExtension());\n    }\n\n    @Override\n    public void process(String pluginName,\n                        String pluginDeploymentDir,\n                        boolean notifyClients) {\n\n        if (!isRegistered(pluginName)) {\n            loadPlugin(pluginName,\n                       pluginDeploymentDir);\n\n            if (notifyClients) {\n                pluginAddedEvent.fire(new PluginAddedEvent(pluginName));\n            }\n        } else {\n            if (notifyClients) {\n                pluginUpdatedEvent.fire(new PluginUpdatedEvent(pluginName));\n            }\n        }\n    }\n\n    private void loadPlugin(String pluginName,\n                            String pluginDeploymentDir) {\n        try {\n            String pluginContent = getPluginContent(pluginName,\n                                                    pluginDeploymentDir);\n            availableRuntimePlugins.put(pluginName,\n                                        new RuntimePlugin(getType(),\n                                                          pluginName,\n                                                          pluginContent));\n        } catch (IOException e) {\n            LOG.error(\"Failed to initialize \" + pluginDeploymentDir,\n                      e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    String getPluginContent(String pluginName,\n                            String pluginDeploymentDir) throws IOException {\n        Path path = Paths.get(pluginDeploymentDir + File.separator + pluginName);\n        return new String(Files.readAllBytes(path));\n    }\n\n    abstract PluginProcessorType getType();\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/processors/GWTScriptPluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.processors;\n\nimport java.io.File;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.cdi.server.scripts.ScriptRegistry;\nimport org.uberfire.backend.plugin.PluginProcessor;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\nimport static org.apache.commons.lang3.StringUtils.substringAfterLast;\n\n@ApplicationScoped\npublic class GWTScriptPluginProcessor implements PluginProcessor {\n\n    static final String SCRIPT_REGISTRY_KEY = \"UF\";\n    final Set<String> availablePlugins = new HashSet<>();\n    private ScriptRegistry scriptRegistry;\n    private Event<PluginAddedEvent> pluginAddedEvent;\n    private Event<PluginUpdatedEvent> pluginUpdatedEvent;\n\n    public GWTScriptPluginProcessor() {\n    }\n\n    @Inject\n    public GWTScriptPluginProcessor(final ScriptRegistry scriptRegistry,\n                                    final Event<PluginAddedEvent> pluginAddedEvent,\n                                    final Event<PluginUpdatedEvent> pluginUpdatedEvent) {\n        this.scriptRegistry = scriptRegistry;\n        this.pluginAddedEvent = pluginAddedEvent;\n        this.pluginUpdatedEvent = pluginUpdatedEvent;\n    }\n\n    @PreDestroy\n    void shutDown() {\n        scriptRegistry.removeScripts(SCRIPT_REGISTRY_KEY);\n    }\n\n    private void add(String pluginName,\n                     String scriptUrl) {\n        availablePlugins.add(pluginName);\n        scriptRegistry.addScript(SCRIPT_REGISTRY_KEY,\n                                 scriptUrl);\n    }\n\n    @Override\n    public void removeAll() {\n        availablePlugins.clear();\n        scriptRegistry.removeScripts(SCRIPT_REGISTRY_KEY);\n    }\n\n    @Override\n    public boolean isRegistered(String pluginName) {\n        return availablePlugins.contains(pluginName);\n    }\n\n    @Override\n    public boolean shouldProcess(String pluginName) {\n        return pluginName.endsWith(PluginProcessorType.GWT.getExtension());\n    }\n\n    @Override\n    public void process(String pluginName,\n                        String pluginDeploymentDir,\n                        boolean notifyClients) {\n\n        final String pluginDisplayName = pluginName.replace(PluginProcessorType.GWT.getExtension(),\n                                                            \"\");\n        if (!isRegistered(pluginName)) {\n            final String url = resolveScriptUrl(pluginName,\n                                                pluginDeploymentDir);\n            add(pluginName,\n                url);\n\n            if (notifyClients) {\n                pluginAddedEvent.fire(new PluginAddedEvent(pluginDisplayName));\n            }\n        } else {\n            if (notifyClients) {\n                pluginUpdatedEvent.fire(new PluginUpdatedEvent(pluginDisplayName));\n            }\n        }\n    }\n\n    String resolveScriptUrl(String pluginName,\n                            String pluginDeploymentDir) {\n        String pluginsDeploymentUrlPath = substringAfterLast(pluginDeploymentDir,\n                                                             File.separator);\n        return pluginsDeploymentUrlPath + \"/\" + pluginName + \"?nocache=\" + System.currentTimeMillis();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/processors/HTMLPluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.processors;\n\nimport java.util.Optional;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.plugin.RuntimePlugin;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\n@ApplicationScoped\npublic class HTMLPluginProcessor extends AbstractRuntimePluginProcessor {\n\n    public HTMLPluginProcessor() {\n    }\n\n    @Inject\n    public HTMLPluginProcessor(final Event<PluginAddedEvent> pluginAddedEvent,\n                               final Event<PluginUpdatedEvent> pluginUpdatedEvent) {\n        super(pluginAddedEvent,\n              pluginUpdatedEvent);\n    }\n\n    @Override\n    PluginProcessorType getType() {\n        return PluginProcessorType.HTML_TEMPLATE;\n    }\n\n    public Optional<RuntimePlugin> lookupForTemplate(String templateName) {\n        return getAvailableRuntimePlugins().\n                stream().\n                filter(p -> p.getPluginName().equalsIgnoreCase(templateName)).findAny();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/processors/PerspectiveLayoutPluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.processors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\n@ApplicationScoped\npublic class PerspectiveLayoutPluginProcessor extends AbstractRuntimePluginProcessor {\n\n    public PerspectiveLayoutPluginProcessor() {\n    }\n\n    @Inject\n    public PerspectiveLayoutPluginProcessor(final Event<PluginAddedEvent> pluginAddedEvent,\n                                            final Event<PluginUpdatedEvent> pluginUpdatedEvent) {\n        super(pluginAddedEvent,\n              pluginUpdatedEvent);\n    }\n\n    @Override\n    PluginProcessorType getType() {\n        return PluginProcessorType.PERSPECTIVE_EDITOR;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/plugins/processors/UFJSPluginProcessor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.processors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\n@ApplicationScoped\npublic class UFJSPluginProcessor extends AbstractRuntimePluginProcessor {\n\n    public UFJSPluginProcessor() {\n    }\n\n    @Inject\n    public UFJSPluginProcessor(final Event<PluginAddedEvent> pluginAddedEvent,\n                               final Event<PluginUpdatedEvent> pluginUpdatedEvent) {\n        super(pluginAddedEvent,\n              pluginUpdatedEvent);\n    }\n\n    @Override\n    public boolean shouldProcess(String pluginName) {\n        return pluginName.endsWith(PluginProcessorType.JS.getExtension())\n                && !pluginName.endsWith(PluginProcessorType.GWT.getExtension());\n    }\n\n    @Override\n    PluginProcessorType getType() {\n        return PluginProcessorType.JS;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/ElytronAuthenticationService.java",
    "content": "/*\n * Copyright 2021 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\n\n@ApplicationScoped\n@Alternative\npublic class ElytronAuthenticationService implements AuthenticationService {\n    private static final Logger logger = LoggerFactory.getLogger(ElytronAuthenticationService.class);\n\n    private final ElytronIdentityHelper elytronIdentityHelper;\n\n    private final ThreadLocal<User> userOnThisThread = new ThreadLocal<>();\n\n    @Inject\n    public ElytronAuthenticationService(final  ElytronIdentityHelper elytronIdentityHelper) {\n        this.elytronIdentityHelper = elytronIdentityHelper;\n    }\n\n    @Override\n    public User login(final String username,\n                      final String password) {\n\n        try {\n            User user = elytronIdentityHelper.getIdentity(username, password);\n\n            userOnThisThread.set(user);\n\n            return user;\n        } catch (Exception ex) {\n            logger.debug(\"Cannot login user '{}':\", username, ex);\n        }\n        throw new FailedAuthenticationException();\n    }\n\n    @Override\n    public boolean isLoggedIn() {\n        return userOnThisThread.get() != null;\n    }\n\n    @Override\n    public void logout() {\n        userOnThisThread.remove();\n    }\n\n    @Override\n    public User getUser() {\n        User user = userOnThisThread.get();\n        if (user == null) {\n            return User.ANONYMOUS;\n        }\n        return user;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/FileSystemResourceAdaptor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport org.uberfire.backend.authz.FileSystemResourceType;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.RuntimeContentResource;\n\npublic class FileSystemResourceAdaptor implements RuntimeContentResource {\n\n    public static final FileSystemResourceType RESOURCE_TYPE = new FileSystemResourceType();\n\n    private final String identifier;\n    private FileSystemMetadata fileSystemMetadata;\n\n    public FileSystemResourceAdaptor(final FileSystemMetadata fsFileSystemMetadata) {\n        this.fileSystemMetadata = fsFileSystemMetadata;\n        if (fsFileSystemMetadata.isAFileSystemID()) {\n            identifier = fsFileSystemMetadata.getId();\n        } else {\n            identifier = fsFileSystemMetadata.getUri();\n        }\n    }\n\n    @Override\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    FileSystemMetadata getFileSystemMetadata() {\n        return fileSystemMetadata;\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return RESOURCE_TYPE;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/IOSecurityAuth.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({FIELD, TYPE, METHOD, PARAMETER})\npublic @interface IOSecurityAuth {\n\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/IOSecurityAuthz.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({FIELD, TYPE, METHOD})\npublic @interface IOSecurityAuthz {\n\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/IOServiceSecuritySetup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.security.RepositoryAction;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.security.SecuredFileSystemProvider;\nimport org.uberfire.security.WorkbenchUserManager;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\nimport org.uberfire.ssh.service.backend.auth.SSHKeyAuthenticator;\n\n@ApplicationScoped\n@Startup\npublic class IOServiceSecuritySetup {\n\n    /**\n     * The system property that specifies which authentication domain the default security service should be configured\n     * for. Not used if the application provides its own {@code @IOSecurityAuth AuthenticationService}.\n     */\n    public static final String AUTH_DOMAIN_KEY = \"org.uberfire.domain\";\n    private static final Logger LOG = LoggerFactory.getLogger(IOServiceSecuritySetup.class);\n    @Inject\n    @IOSecurityAuth\n    Instance<AuthenticationService> authenticationManagers;\n\n    @Inject\n    AuthenticationService httpAuthManager;\n\n    @Inject\n    AuthorizationManager authorizationManager;\n\n    @Inject\n    RepositoryService repositoryService;\n\n    @Inject\n    SpacesAPI spacesAPI;\n\n    @Inject\n    SSHKeyAuthenticator sshKeyAuthenticator;\n\n    @Inject\n    WorkbenchUserManager workbenchUserManager;\n\n    @Inject\n    ElytronIdentityHelper elytronIdentityHelper;\n\n    @PostConstruct\n    public void setup() {\n        final AuthenticationService nonHTTPAuthenticationManager;\n\n        if (authenticationManagers.isUnsatisfied()) {\n            final String authType = System.getProperty(\"org.uberfire.io.auth\",\n                    null);\n            final String domain = System.getProperty(AUTH_DOMAIN_KEY,\n                    JAASAuthenticationService.DEFAULT_DOMAIN);\n\n            if (authType == null) {\n                nonHTTPAuthenticationManager = new ElytronAuthenticationService(elytronIdentityHelper);\n            } else if (authType.toLowerCase().equals(\"jaas\") || authType.toLowerCase().equals(\"container\")) {\n                nonHTTPAuthenticationManager = new JAASAuthenticationService(domain);\n            } else {\n                nonHTTPAuthenticationManager = loadClazz(authType,\n                                                         AuthenticationService.class);\n            }\n        } else {\n            nonHTTPAuthenticationManager = authenticationManagers.get();\n        }\n\n        for (final FileSystemProvider fp : FileSystemProviders.installedProviders()) {\n            if (fp instanceof SecuredFileSystemProvider) {\n                SecuredFileSystemProvider sfp = (SecuredFileSystemProvider) fp;\n                sfp.setJAASAuthenticator(nonHTTPAuthenticationManager);\n                sfp.setHTTPAuthenticator(httpAuthManager);\n                sfp.setAuthorizer((fs, fileSystemUser) -> {\n                            Path vfsPath = Paths.convert(fs.getPath(fs.getName()));\n                            Space space = spacesAPI.resolveSpace(vfsPath.toURI()).orElseThrow(() -> new IllegalArgumentException(\"Cannot resolve space from given path: \" + vfsPath));\n                            Repository repository = repositoryService.getRepositoryFromSpace(space, vfsPath.getFileName());\n\n                            if (repository == null) {\n                                return authorizationManager.authorize(\n                                        new FileSystemResourceAdaptor(new FileSystemMetadata(fs)),\n                                        fileSystemUser);\n                            }\n\n                            return authorizationManager.authorize(\n                                    repository,\n                                    repository.getContributors(),\n                                    RepositoryAction.READ,\n                                    fileSystemUser);\n                        }\n\n\n                );\n                sfp.setSSHAuthenticator((userName, key) -> sshKeyAuthenticator.authenticate(userName, key));\n            }\n        }\n    }\n\n    private <T> T loadClazz(final String clazzName,\n                            final Class<T> typeOf) {\n\n        if (clazzName == null || clazzName.isEmpty()) {\n            return null;\n        }\n\n        try {\n            final Class<?> clazz = Class.forName(clazzName);\n\n            if (!typeOf.isAssignableFrom(clazz)) {\n                // FIXME this could only be due to a deployment configuration error. why do we continue in this case?\n                LOG.error(\"Class '\" + clazzName + \"' is not assignable to expected type \" + typeOf + \". Continuing as if no class was specified.\");\n                return null;\n            }\n\n            return typeOf.cast(clazz.newInstance());\n        } catch (final Exception e) {\n            // FIXME this could only be due to a deployment error. why do we continue in this case?\n            LOG.error(\"Failed to load class '\" + clazzName + \"' as type \" + typeOf + \". Continuing as if none was specified.\",\n                    e);\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/JAASAuthenticationService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.io.IOException;\nimport java.lang.reflect.Method;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.security.auth.callback.Callback;\nimport javax.security.auth.callback.CallbackHandler;\nimport javax.security.auth.callback.NameCallback;\nimport javax.security.auth.callback.PasswordCallback;\nimport javax.security.auth.callback.UnsupportedCallbackException;\nimport javax.security.auth.login.LoginContext;\nimport javax.security.auth.login.LoginException;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.backend.server.security.adapter.GroupAdapterAuthorizationSource;\n\n/**\n * Implements stateful, thread-local authentication of a user via the JAAS API (\n * {@code javax.security.auth.login.LoginContext}).\n * <p>\n * <b>Do not use this module for authenticating web requests!</b> Upon login, it associates the current thread with the\n * authenticated user. This association is only undone upon a call to {@link #logout()}. This is appropriate for use\n * with the Git SSH daemon, but would cause serious security issues if used for authenticating HTTP requests.\n */\n@ApplicationScoped\n@Alternative\npublic class JAASAuthenticationService extends GroupAdapterAuthorizationSource implements AuthenticationService {\n\n    public static final String DEFAULT_DOMAIN = \"ApplicationRealm\";\n\n    static final String DEFAULT_ROLE_PRINCIPLE_NAME = \"Roles\";\n    private final String rolePrincipleName = DEFAULT_ROLE_PRINCIPLE_NAME;\n\n    private final ThreadLocal<User> userOnThisThread = new ThreadLocal<>();\n\n    private final String domain;\n\n    public JAASAuthenticationService(String domain) {\n        this.domain = PortablePreconditions.checkNotNull(\"domain\",\n                                                         domain);\n    }\n\n    @Override\n    public User login(final String username,\n                      final String password) {\n        final SecurityManager jsm = System.getSecurityManager();\n\n        if (jsm != null) {\n            final ClassLoader tccl = Thread.currentThread().getContextClassLoader();\n            final ClassLoader cl = this.getClass().getClassLoader();\n            try {\n                // RHBPMS-473 - TCCL used in javax.security.auth.login.LoginContext\n                // is not the application CL if JSM is enabled.\n                // Setting TCCL to application CL as workaround\n                Thread.currentThread().setContextClassLoader(cl);\n\n                return executeLogin(username,\n                                    password);\n            } catch (final LoginException ex) {\n                throw new FailedAuthenticationException();\n            } finally {\n                // RHBPMS-473 - Restore original TCCL\n                if (tccl != null) {\n                    Thread.currentThread().setContextClassLoader(tccl);\n                }\n            }\n        } else {\n            try {\n                return executeLogin(username,\n                                    password);\n            } catch (final LoginException ex) {\n                throw new FailedAuthenticationException();\n            }\n        }\n    }\n\n    private User executeLogin(final String username,\n                              final String password) throws LoginException {\n        final LoginContext loginContext = createLoginContext(username,\n                                                             password);\n        loginContext.login();\n        List<String> principals = loadEntitiesFromSubjectAndAdapters(username,\n                                                                     loginContext.getSubject(),\n                                                                     new String[]{rolePrincipleName});\n        Collection<Role> roles = getRoles(principals);\n        Collection<org.jboss.errai.security.shared.api.Group> groups = getGroups(principals, username);\n        UserImpl user = new UserImpl(username,\n                                     roles,\n                                     groups);\n        userOnThisThread.set(user);\n        return user;\n    }\n\n    @Override\n    public void logout() {\n        userOnThisThread.remove();\n    }\n\n    @Override\n    public User getUser() {\n        User user = userOnThisThread.get();\n        if (user == null) {\n            return User.ANONYMOUS;\n        }\n        return user;\n    }\n\n    @Override\n    public boolean isLoggedIn() {\n        return userOnThisThread.get() != null;\n    }\n\n    LoginContext createLoginContext(String username,\n                                    String password) throws LoginException {\n        return new LoginContext(domain,\n                                new UsernamePasswordCallbackHandler(username,\n                                                                    password));\n    }\n\n    class UsernamePasswordCallbackHandler implements CallbackHandler {\n\n        private final String username;\n        private final String password;\n\n        public UsernamePasswordCallbackHandler(final String username,\n                                               final String password) {\n            this.username = username;\n            this.password = password;\n        }\n\n        @Override\n        public void handle(final Callback[] callbacks) throws IOException, UnsupportedCallbackException {\n            for (final Callback callback : callbacks) {\n                if (callback instanceof NameCallback) {\n                    NameCallback nameCB = (NameCallback) callback;\n                    nameCB.setName(username);\n                } else if (callback instanceof PasswordCallback) {\n                    PasswordCallback passwordCB = (PasswordCallback) callback;\n                    passwordCB.setPassword(password.toCharArray());\n                } else {\n                    try {\n                        final Method method = callback.getClass().getMethod(\"setObject\",\n                                                                            Object.class);\n                        method.invoke(callback,\n                                      password);\n                    } catch (Exception e) {\n                    }\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/RoleLoader.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.nio.file.Path;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.jdom.Document;\nimport org.jdom.Element;\nimport org.jdom.input.SAXBuilder;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.WebAppListener;\nimport org.uberfire.backend.server.WebAppSettings;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\n/**\n * Startup class that read the roles declared in the webapp's web.xml and register them into the {@link RoleRegistry}.\n */\n@Startup(StartupType.BOOTSTRAP)\n@ApplicationScoped\npublic class RoleLoader {\n\n    Logger logger = LoggerFactory.getLogger(RoleLoader.class);\n\n    @PostConstruct\n    public void init() {\n        WebAppListener.registerOnStartupCommand(this::registerRolesFromwWebXml);\n    }\n\n    public void registerRolesFromwWebXml() {\n        try {\n            Set<String> roles = loadRolesFromwWebXml();\n            for (String role : roles) {\n                RoleRegistry.get().registerRole(role);\n            }\n            if (!roles.isEmpty()) {\n                logger.info(\"Roles registered from web.xml \\\"\" + StringUtils.join(roles.toArray(),\n                                                                                  \",\") + \"\\\"\");\n            }\n        } catch (Exception e) {\n            logger.error(\"Error reading roles from web.xml\",\n                         e);\n        }\n    }\n\n    protected Set<String> loadRolesFromwWebXml() throws Exception {\n        Path webXml = WebAppSettings.get().getAbsolutePath(\"WEB-INF\",\n                                                           \"web.xml\");\n\n        Set<String> result = new HashSet<>();\n        SAXBuilder builder = new SAXBuilder();\n        builder.setExpandEntities(false);\n        Document doc = builder.build(webXml.toFile());\n        Element root = doc.getRootElement();\n\n        // Look for <security-role> declarations.\n        List bundleNodes = root.getChildren(\"security-role\");\n        if (bundleNodes.isEmpty()) {\n            bundleNodes = root.getChildren(\"security-role\",\n                                           null);\n        }\n        for (Iterator iterator = bundleNodes.iterator(); iterator.hasNext(); ) {\n            Element el_role = (Element) iterator.next();\n            List ch_role = el_role.getChildren();\n            for (int i = 0; i < ch_role.size(); i++) {\n                Element el_child = (Element) ch_role.get(i);\n                if (el_child.getName().equals(\"role-name\")) {\n                    String name = el_child.getValue().trim();\n                    if (!StringUtils.isBlank(name)) {\n                        result.add(name);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/RoleRegistry.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\n\n/**\n * It holds the collection of Role instances that the platform security\n * services recognize as the application available roles.\n */\npublic class RoleRegistry {\n\n    private static RoleRegistry instance = null;\n    private Set<Role> roles = new HashSet<Role>();\n\n    private RoleRegistry() {\n    }\n\n    /**\n     * Returns singleton instance of the registry to be able to register roles\n     */\n    public static RoleRegistry get() {\n        if (instance == null) {\n            instance = new RoleRegistry();\n        }\n        return instance;\n    }\n\n    /**\n     * Registers given <code>role</code> into the registry\n     */\n    public void registerRole(String role) {\n        this.roles.add(new RoleImpl(role));\n    }\n\n    /**\n     * Gets a a role instance by its name or null if not found.\n     */\n    public Role getRegisteredRole(String name) {\n        for (Role role : roles) {\n            if (role.getName().equals(name)) {\n                return role;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * /**\n     * Returns unmodifiable copy of all reqistered roles\n     */\n    public Set<Role> getRegisteredRoles() {\n        return Collections.unmodifiableSet(this.roles);\n    }\n\n    /**\n     * Clears the registry.\n     */\n    public void clear() {\n        this.roles.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/adapter/GroupAdapterAuthorizationSource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.adapter;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.ServiceLoader;\nimport java.util.Set;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\n\nimport javax.security.auth.Subject;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.security.authz.adapter.GroupsAdapter;\n\nimport static java.util.Collections.emptyList;\nimport static java.util.Collections.unmodifiableList;\n\npublic class GroupAdapterAuthorizationSource {\n\n    private final String roleRegexTemplate = System.getProperty(\"org.uberfire.regex.role_mapper\",\n                                                                null);\n\n    private HashMap<String, Pattern> regexPatterns = new HashMap<>();\n\n    private List<GroupsAdapter> groupsAdapters = null;\n\n    public GroupAdapterAuthorizationSource() {\n        this.groupsAdapters = loadGroupAdapters();\n    }\n\n    private static synchronized List<GroupsAdapter> loadGroupAdapters() {\n        final ServiceLoader<GroupsAdapter> providers = ServiceLoader.load(GroupsAdapter.class);\n        if (providers == null) {\n            return emptyList();\n        }\n        final List<GroupsAdapter> result = new ArrayList<>();\n\n        for (final GroupsAdapter provider : providers) {\n            result.add(provider);\n        }\n        return unmodifiableList(result);\n    }\n\n    protected List<String> loadEntitiesFromSubjectAndAdapters(String username,\n                                                              Subject subject,\n                                                              String[] rolePrincipleNames) {\n        List<String> roles = new ArrayList<>();\n        try {\n            List<String> principals = collectEntitiesFromSubject(username,\n                                                                 subject,\n                                                                 rolePrincipleNames);\n            roles.addAll(filterValidPrincipals(principals));\n            List<String> principalsFromAdapters = collectEntitiesFromAdapters(username,\n                                                                              subject);\n            roles.addAll(filterValidPrincipals(principalsFromAdapters));\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n        return roles;\n    }\n\n    protected List<String> collectEntitiesFromAdapters(String username,\n                                                       Subject subject) {\n\n        Set<String> userGroups = new HashSet<>();\n\n        groupsAdapters.forEach(adapter -> {\n            final List<Group> groupRoles = adapter.getGroups(username,\n                                                             subject);\n            if (groupRoles != null) {\n\n                for (Group group : groupRoles) {\n                    // apply configurable regex pattern for adapters that do not return simple group names\n                    if (roleRegexTemplate == null || roleRegexTemplate.isEmpty()) {\n                        userGroups.add(group.getName());\n                    } else {\n                        userGroups.add(getSimpleName(group.getName()));\n                    }\n                }\n            }\n        });\n\n        return new LinkedList<>(userGroups);\n    }\n\n    /**\n     * Collects the principals for a given subject.\n     */\n    protected List<String> collectEntitiesFromSubject(String username,\n                                                      Subject subject,\n                                                      String[] rolePrincipleNames) {\n        if (null == subject) {\n            return null;\n        }\n\n        List<String> roles = new ArrayList<>();\n        try {\n            Set<java.security.Principal> principals = subject.getPrincipals();\n            if (principals != null) {\n                for (java.security.Principal p : principals) {\n                    if (p instanceof java.security.acl.Group) {\n                        for (final String rolePrincipleName : rolePrincipleNames) {\n                            if (rolePrincipleName.equalsIgnoreCase(p.getName())) {\n                                Enumeration<? extends java.security.Principal> groups = ((java.security.acl.Group) p).members();\n                                while (groups.hasMoreElements()) {\n                                    final java.security.Principal groupPrincipal = groups.nextElement();\n                                    roles.add(groupPrincipal.getName());\n                                }\n                            }\n                        }\n                    } else {\n                        roles.add(p.getName());\n                    }\n                }\n            }\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n        return roles;\n    }\n\n    /**\n     * For a given collection of principal names, return the Role instances for the ones\n     * that are considered roles, so the ones that exist on the RoleRegistry.\n     */\n    protected List<Role> getRoles(List<String> principals) {\n\n        if (null != principals && !principals.isEmpty()) {\n\n            Set<Role> registeredRoles = RoleRegistry.get().getRegisteredRoles();\n\n            if (null != registeredRoles && !registeredRoles.isEmpty()) {\n\n                List<Role> result = new LinkedList<Role>();\n\n                for (String role : principals) {\n\n                    if (null != RoleRegistry.get().getRegisteredRole(role)) {\n\n                        result.add(new RoleImpl(role));\n                    }\n                }\n\n                return result;\n            }\n        }\n\n        return Collections.emptyList();\n    }\n\n    /**\n     * For a given collection of principal names, return the Role instances for the ones\n     * that are considered roles, so the ones that exist on the RoleRegistry.\n     */\n    protected List<Group> getGroups(List<String> principals, String user) {\n\n        if (null != principals && !principals.isEmpty()) {\n\n            Set<Role> registeredRoles = RoleRegistry.get().getRegisteredRoles();\n\n            if (null != registeredRoles && !registeredRoles.isEmpty()) {\n\n                List<Group> result = new LinkedList<Group>();\n\n                for (String role : principals) {\n\n                    if ( role != user && null == RoleRegistry.get().getRegisteredRole(role)) {\n\n                        result.add(new GroupImpl(role));\n                    }\n                }\n\n                return result;\n            }\n        }\n\n        return Collections.emptyList();\n    }\n\n    private List<String> filterValidPrincipals(List<String> principals) {\n        if (principals == null) {\n            return new ArrayList<>();\n        }\n        return principals.stream().filter(Objects::nonNull).collect(Collectors.toList());\n    }\n\n    /*\n     * Return simple role name if name provided by adapter matches a regex pattern\n     * \n     */\n    private String getSimpleName(String name) {\n        for (Role role : RoleRegistry.get().getRegisteredRoles()) {\n            if (!regexPatterns.containsKey(role.getName())) {\n                regexPatterns.put(role.getName(),\n                                  Pattern.compile(roleRegexTemplate.replaceAll(\"role\",\n                                                                               role.getName())));\n            }\n\n            Matcher matcher = regexPatterns.get(role.getName()).matcher(name);\n            while (matcher.find()) {\n                if (matcher.group(0) != null) {\n                    return role.getName();\n                }\n            }\n        }\n        return name;\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/adapter/JettyGroupsAdapter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.adapter;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.security.authz.adapter.GroupsAdapter;\n\n@ApplicationScoped\npublic class JettyGroupsAdapter implements GroupsAdapter {\n\n    private static final String GROUPS_DEFINITION_FILE = \"/jetty-groups.properties\";\n    private static final Logger logger = LoggerFactory.getLogger(JettyGroupsAdapter.class);\n\n    private Map<String, List<Group>> groupsByUser = null;\n\n    public JettyGroupsAdapter() {\n        InputStream input = this.getClass().getResourceAsStream(GROUPS_DEFINITION_FILE);\n        if (input != null) {\n\n            try {\n                Properties properties = new Properties();\n                properties.load(input);\n\n                groupsByUser = new HashMap<String, List<Group>>();\n\n                Set<String> userNames = properties.stringPropertyNames();\n                for (String userName : userNames) {\n                    String groupsStr = properties.getProperty(userName);\n                    List<Group> userGroups = new ArrayList<Group>();\n                    if (groupsStr != null) {\n\n                        String[] groups = groupsStr.split(\",\");\n\n                        for (String group : groups) {\n                            userGroups.add(new GroupImpl(group));\n                        }\n                    }\n\n                    groupsByUser.put(userName,\n                                     userGroups);\n                }\n            } catch (IOException e) {\n                logger.warn(\"Unable to load jetty-groups.properties file due to {}\",\n                            e.getMessage());\n            }\n        }\n    }\n\n    @Override\n    public List<Group> getGroups(String principalName,\n                                 final Object subject) {\n        if (groupsByUser == null || !groupsByUser.containsKey(principalName)) {\n            return Collections.emptyList();\n        }\n\n        return groupsByUser.get(principalName);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/adapter/WebSphereGroupsAdapter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.adapter;\n\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.security.authz.adapter.GroupsAdapter;\n\n@ApplicationScoped\npublic class WebSphereGroupsAdapter implements GroupsAdapter {\n\n    private static final Logger logger = LoggerFactory.getLogger(WebSphereGroupsAdapter.class);\n    private Object registry;\n\n    public WebSphereGroupsAdapter() {\n        try {\n            this.registry = InitialContext.doLookup(\"UserRegistry\");\n        } catch (NamingException e) {\n            logger.info(\"Unable to look up UserRegistry in JNDI under key 'UserRegistry', disabling websphere adapter\");\n        }\n    }\n\n    @Override\n    public List<Group> getGroups(final String principal,\n                                 final Object subject) {\n        if (registry == null) {\n            return Collections.emptyList();\n        }\n\n        final List<Group> groups = new ArrayList<Group>();\n\n        try {\n            Method method = registry.getClass().getMethod(\"getGroupsForUser\",\n                                                          new Class[]{String.class});\n            List rolesIn = (List) method.invoke(registry,\n                                                new Object[]{principal});\n            if (rolesIn != null) {\n                for (Object o : rolesIn) {\n                    groups.add(new GroupImpl(o.toString()));\n                }\n            }\n        } catch (Exception e) {\n            logger.error(\"Unable to get groups from registry due to {}\",\n                         e.getMessage(),\n                         e);\n        }\n\n        return groups;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/adapter/WeblogicGroupsAdapter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.adapter;\n\nimport java.lang.reflect.Method;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.security.auth.Subject;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.security.authz.adapter.GroupsAdapter;\n\n@ApplicationScoped\npublic class WeblogicGroupsAdapter implements GroupsAdapter {\n\n    private static final Logger logger = LoggerFactory.getLogger(WeblogicGroupsAdapter.class);\n    private Class webLogicSecurity;\n\n    public WeblogicGroupsAdapter() {\n        try {\n            this.webLogicSecurity = Class.forName(\"weblogic.security.Security\");\n        } catch (Exception e) {\n            logger.info(\"Unable to find weblogic.security.Security, disabling weblogic adapter\");\n        }\n    }\n\n    @Override\n    public List<Group> getGroups(final String principal,\n                                 final Object subject) {\n        if (webLogicSecurity == null) {\n            return Collections.emptyList();\n        }\n\n        final List<Group> groups = new ArrayList<Group>();\n\n        try {\n            Subject wlsSubject = (Subject) subject;\n            // if no subject given try to fetch it with WLS specific api\n            if (wlsSubject == null) {\n                Method method = webLogicSecurity.getMethod(\"getCurrentSubject\",\n                                                           new Class[]{});\n                wlsSubject = (Subject) method.invoke(null,\n                                                     new Object[]{});\n            }\n            if (wlsSubject != null) {\n                for (java.security.Principal p : wlsSubject.getPrincipals()) {\n                    if (p.getClass().getName().indexOf(\"WLSGroup\") != -1) {\n                        groups.add(new GroupImpl(p.getName()));\n                    }\n                }\n            }\n        } catch (Exception e) {\n            logger.error(\"Unable to get groups from subject due to {}\",\n                         e.getMessage(),\n                         e);\n        }\n\n        return groups;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/elytron/DefaultElytronIdentityHelper.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.elytron;\n\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.wildfly.security.auth.server.RealmUnavailableException;\nimport org.wildfly.security.auth.server.SecurityDomain;\nimport org.wildfly.security.evidence.Evidence;\nimport org.wildfly.security.evidence.PasswordGuessEvidence;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Iterator;\n\n/**\n * Default implementation of {@link ElytronIdentityHelper}, it relies in the platform {@link SecurityDomain} to obtain the user credentials\n */\n@Alternative\npublic class DefaultElytronIdentityHelper implements ElytronIdentityHelper {\n\n    private static final Logger logger = LoggerFactory.getLogger(DefaultElytronIdentityHelper.class);\n\n    @Inject\n    public DefaultElytronIdentityHelper() {\n    }\n\n    @Override\n    public User getIdentity(final String userName, final String password) {\n\n        try {\n            final Evidence evidence = new PasswordGuessEvidence(password.toCharArray());\n            final Iterator<String> userRoles = login(userName, evidence);\n            final Collection<Role> roles = new ArrayList<>();\n            userRoles.forEachRemaining(role -> roles.add(new RoleImpl(role)));\n\n            return new UserImpl(userName, roles);\n        } catch (Exception ex) {\n            logger.debug(\"Identity provided for '{}' not valid\", userName);\n        }\n\n        throw new FailedAuthenticationException();\n    }\n\n    protected Iterator<String> login(final String userName, final Evidence evidence) throws RealmUnavailableException {\n        return SecurityDomain.getCurrent().authenticate(userName, evidence).getRoles().iterator();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/elytron/ElytronIdentityHelper.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.elytron;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.server.security.ElytronAuthenticationService;\n\n/**\n * Helper for {@link ElytronAuthenticationService} to obtain the identity for a given credentials\n */\npublic interface ElytronIdentityHelper {\n\n    /**\n     * Obtains a valid (and authenticated) user for the given credentials.\n     * @param userName The name of the user\n     * @param password The password\n     * @return a valid User\n     */\n    User getIdentity(String userName, String password);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/security/elytron/ElytronIdentityHelperProducer.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.elytron;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\n/**\n * Default producer for {@link ElytronIdentityHelper}\n */\n@ApplicationScoped\npublic class ElytronIdentityHelperProducer {\n\n    @Inject\n    public ElytronIdentityHelperProducer() {\n    }\n\n    @Produces\n    public ElytronIdentityHelper getDefaultElytronIdentityHelper() {\n        return new DefaultElytronIdentityHelper();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/servlet/ReleaseUserLocksServlet.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.servlet;\n\nimport java.util.Set;\n\nimport javax.inject.Inject;\nimport javax.servlet.annotation.WebServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.VFSLockServiceImpl;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.server.BaseFilteredServlet;\n\n@WebServlet(name = \"ReleaseUserLocksServlet\", urlPatterns = \"/releaseUserLocksServlet\")\npublic class ReleaseUserLocksServlet extends BaseFilteredServlet {\n\n    private static final Logger logger = LoggerFactory.getLogger(ReleaseUserLocksServlet.class);\n\n    @Inject\n    private VFSLockService vfsLockService;\n\n    @Override\n    protected void doGet(final HttpServletRequest request,\n                         final HttpServletResponse response) {\n        final HttpSession session = request.getSession();\n\n        if (session != null && session.getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME) != null) {\n            final Set<LockInfo> locks =\n                    (Set<LockInfo>) session.getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME);\n\n            try {\n                locks.forEach(lockInfo -> vfsLockService.releaseLock(lockInfo.getFile()));\n                locks.clear();\n            } catch (Exception e) {\n                logger.error(\"Error when releasing locks.\", e);\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/spaces/SpacesAPIImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.spaces;\n\nimport java.net.URI;\nimport java.util.Optional;\nimport java.util.regex.Pattern;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class SpacesAPIImpl implements SpacesAPI {\n\n    private static final String PATH_PATTERN = \"^[A-Za-z]+://[^@]+[@]([^/]+)/.*\";\n    private static final Pattern PATH_REGEX = Pattern.compile(PATH_PATTERN);\n\n    @Override\n    public Space getSpace(String name) {\n        if (SpacesAPI.DEFAULT_SPACE_NAME.equals(name)) {\n            return getDefaultSpace();\n        } else {\n            return new Space(name);\n        }\n    }\n\n    @Override\n    public Optional<Space> resolveSpace(String uri) {\n        return Optional\n                .ofNullable(PATH_REGEX.matcher(uri))\n                .filter(matcher -> matcher.matches())\n                .map(matcher -> matcher.group(1))\n                .map(name -> trimName(name))\n                .map(this::getSpace);\n    }\n\n    private String trimName(final String name) {\n\n        if (name.contains(\"@\")) {\n            return name.substring(name.indexOf(\"@\") + 1);\n        } else {\n            return name;\n        }\n    }\n\n    public URI resolveFileSystemURI(Scheme scheme,\n                                    Space space,\n                                    String fsName) {\n\n        URI uri = URI.create(SpacesAPI.resolveFileSystemPath(scheme,\n                                                             space,\n                                                             fsName));\n        return uri;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/Filter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\npublic interface Filter<T> {\n\n    boolean doFilter(final T t);\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/Guava14Workaround.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport com.google.common.collect.ImmutableSet;\nimport com.google.common.util.concurrent.Service;\n\n/**\n * Produces an empty {@code Set<Service>} in order to prevent deploy-time failure.\n * The issue is <a href=\"https://code.google.com/p/guava-libraries/issues/detail?id=1527\">described in the Guava bug\n * tracker</a>. This workaround is described in <a\n * href=\"https://code.google.com/p/guava-libraries/issues/detail?id=1433#c20\">a comment on separate issue</a>.\n */\n@ApplicationScoped\npublic class Guava14Workaround {\n\n    @Produces\n    Set<Service> dummyServices() {\n        return ImmutableSet.of();\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/Paths.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.backend.vfs.FileSystem;\nimport org.uberfire.backend.vfs.FileSystemFactory;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.java.nio.file.Files;\n\nimport static org.uberfire.backend.vfs.PathFactory.newPath;\n\npublic final class Paths {\n\n    private static Map<org.uberfire.java.nio.file.FileSystem, FileSystem> cache = new HashMap<>();\n\n    public static Path convert(final org.uberfire.java.nio.file.Path path) {\n        if (path == null) {\n            return null;\n        }\n\n        if (path.getFileName() == null) {\n            return newPath(\"/\",\n                           path.toUri().toString(),\n                           new HashMap<String, Object>(1) {{\n                               put(PathFactory.VERSION_PROPERTY,\n                                   path.getFileSystem().supportedFileAttributeViews().contains(\"version\"));\n                           }});\n        }\n\n        return newPath(path.getFileName().toString(),\n                       path.toUri().toString(),\n                       new HashMap<String, Object>(1) {{\n                           put(PathFactory.VERSION_PROPERTY,\n                               path.getFileSystem().supportedFileAttributeViews().contains(\"version\"));\n                       }});\n    }\n\n    public static org.uberfire.java.nio.file.Path convert(final Path path) {\n        if (path == null) {\n            return null;\n        }\n\n        return org.uberfire.java.nio.file.Paths.get(URI.create(path.toURI()));\n    }\n\n    public static FileSystem convert(final org.uberfire.java.nio.file.FileSystem fs) {\n        if (!cache.containsKey(fs)) {\n            final Map<String, String> roots = new HashMap<>();\n            for (final org.uberfire.java.nio.file.Path root : fs.getRootDirectories()) {\n                roots.put(root.toUri().toString(),\n                          root.getFileName() == null ? \"/\" : root.getFileName().toString());\n            }\n            cache.put(fs,\n                      FileSystemFactory.newFS(roots,\n                                              fs.supportedFileAttributeViews()));\n        }\n\n        return cache.get(fs);\n    }\n\n    public static String readLockedBy(final Path path) {\n        org.uberfire.java.nio.file.Path lock = convert(PathFactory.newLock(path));\n        if (!Files.exists(lock)) {\n            return null;\n        } else {\n            return new String(Files.readAllBytes(lock));\n        }\n    }\n\n    public static boolean isLock(final Path path) {\n        return path.toURI().endsWith(PathFactory.LOCK_FILE_EXTENSION);\n    }\n\n    /**\n     * Substring the second path from the first. This can be used to for example to substring the repository prefix from a Path.\n     * @param wholePath What we want to substring from the first Path\n     * @param prefixToRemove The Path we want to substring\n     * @return The result. For example the File URI from the Repository root or from a submodule root.\n     * @throws IllegalStateException When the the prefix is longer than the URI where it is removed from.\n     */\n    public static String removePrefix(final Path wholePath,\n                                      final Path prefixToRemove) {\n        PortablePreconditions.checkNotNull(\"prefixToRemove\", prefixToRemove);\n        PortablePreconditions.checkNotNull(\"wholePath\", wholePath);\n\n        if (prefixToRemove.toURI().length() > wholePath.toURI().length()) {\n            throw new IllegalArgumentException(\"Prefix is longer than the URI where it is being removed from.\");\n        }\n\n        final org.uberfire.java.nio.file.Path nioWholePath = convert(wholePath);\n        final org.uberfire.java.nio.file.Path nioPrefixToRemove = convert(prefixToRemove);\n\n        if (!nioWholePath.startsWith(nioPrefixToRemove)) {\n            throw new IllegalArgumentException(\"The beginning of the whole  Path \" + nioWholePath + \" does not match the prefix path \" + nioPrefixToRemove + \".\");\n        }\n\n        return nioPrefixToRemove.relativize(nioWholePath).toString();\n    }\n\n    /**\n     * git:// and default:// can point to the same location. This normalizes the Paths for easier use with length and removePrefix functions.\n     * @param path\n     * @return\n     */\n    public static org.uberfire.java.nio.file.Path normalizePath(final org.uberfire.java.nio.file.Path path) {\n        return Paths.convert(Paths.convert(path));\n    }\n\n    /**\n     * git:// and default:// can point to the same location. This normalizes the Paths for easier use with length and removePrefix functions.\n     * @param path\n     * @return\n     */\n    public static Path normalizePath(final Path path) {\n        return Paths.convert(Paths.convert(path));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/TextUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\nimport java.text.Normalizer;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class TextUtil {\n\n    private static final String EMPTY_STRING = \"\";\n\n    // Any character except unicode letters and digits 0-9\n    private static final Pattern nonASCIIp1 = Pattern.compile(\"[^\\\\p{L}\\\\p{Nd}]\");\n    private static final Matcher nonASCIIm1 = nonASCIIp1.matcher(EMPTY_STRING);\n\n    // Any ASCII character except those between code point 0 (NULL) and 127 (DEL)\n    private static final Pattern nonASCIIp2 = Pattern.compile(\"[^\\\\x00-\\\\x7f]\");\n    private static final Matcher nonASCIIm2 = nonASCIIp2.matcher(EMPTY_STRING);\n\n    // Any character except unicode letters and digits 0-9, allowing '.' and '-'\n    private static final Pattern repoP1 = Pattern.compile(\"[^\\\\p{L}\\\\p{Nd}\\\\x2D\\\\x2E]\");\n\n    // Any ASCII character except those between code point 0 (NULL) and 127 (DEL), allowing '.' and '-'\n    private static final Pattern repoP2 = Pattern.compile(\"[^\\\\x00-\\\\x7f\\\\x2D\\\\x2E]\");\n\n    // Match repetitions of '.', '-' or combinations thereof\n    private static final Pattern repoP3 = Pattern.compile(\"[\\\\x2D\\\\x2E][\\\\x2D\\\\x2E]{1,}+\");\n\n    public static String normalizeRepositoryName(String input) {\n        // Remove leading and/or trailing '.' and '-'\n        if (input.startsWith(\".\") || input.startsWith(\"-\")) {\n            input = normalizeRepositoryName(input.substring(1));\n        }\n        if (input.endsWith(\".\") || input.endsWith(\"-\")) {\n            input = normalizeRepositoryName(input.substring(0,\n                                                            input.length() - 1));\n        }\n        // Repository operations are not too frequent so instantiate corresponding matchers on demand\n        return repoP3.matcher(\n                repoP2.matcher(\n                        repoP1.matcher(Normalizer.normalize(input,\n                                                            Normalizer.Form.NFD)).replaceAll(EMPTY_STRING)\n                ).replaceAll(EMPTY_STRING)\n        ).replaceAll(EMPTY_STRING);\n    }\n\n    public static String normalizeUserName(String input) {\n        nonASCIIm1.reset(Normalizer.normalize(input,\n                                              Normalizer.Form.NFD));\n        return nonASCIIm2.reset(nonASCIIm1.replaceAll(EMPTY_STRING)).replaceAll(EMPTY_STRING);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/gzip/GzipFilter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util.gzip;\n\nimport java.io.IOException;\n\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport static javax.ws.rs.core.HttpHeaders.ACCEPT_ENCODING;\n\npublic class GzipFilter implements Filter {\n\n    static final String GZIP = \"gzip\";\n\n    static final String ORG_UBERFIRE_GZIP_ENABLE = \"org.uberfire.gzip.enable\";\n\n    public void init(final FilterConfig filterConfig) {\n        // Empty on purpose\n    }\n\n    public void doFilter(final ServletRequest req,\n                         final ServletResponse res,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        switch (getAction(req)) {\n            case HALT:\n                break;\n            case DO_NOT_ACCEPT_GZIP:\n            case DO_NOT_COMPRESS:\n                chain.doFilter(req, res);\n                break;\n            case COMPRESS:\n                compressAndContinue(req, (HttpServletResponse) res, chain);\n                break;\n        }\n    }\n\n    void compressAndContinue(final ServletRequest req,\n                             final HttpServletResponse res,\n                             final FilterChain chain) throws IOException, ServletException {\n\n        final GzipHttpServletResponseWrapper wResponse = new GzipHttpServletResponseWrapper(res);\n        chain.doFilter(req, wResponse);\n        wResponse.close();\n    }\n\n    Action getAction(final ServletRequest req) {\n\n        final String enabled = System.getProperty(ORG_UBERFIRE_GZIP_ENABLE);\n        if (enabled != null && !enabled.equals(\"true\")) {\n            return Action.DO_NOT_COMPRESS;\n        }\n\n        if (!(req instanceof HttpServletRequest)) {\n            return Action.HALT;\n        }\n\n        final String acceptEncodingHeader = ((HttpServletRequest) req).getHeader(ACCEPT_ENCODING);\n        if (acceptEncodingHeader == null || !acceptEncodingHeader.contains(GZIP)) {\n            return Action.DO_NOT_ACCEPT_GZIP;\n        }\n\n        return Action.COMPRESS;\n    }\n\n    public void destroy() {\n        // Empty on purpose\n    }\n\n    enum Action {\n        HALT,\n        DO_NOT_COMPRESS,\n        DO_NOT_ACCEPT_GZIP,\n        COMPRESS;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/gzip/GzipHttpServletResponseWrapper.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util.gzip;\n\nimport java.io.IOException;\nimport java.io.OutputStreamWriter;\nimport java.io.PrintWriter;\nimport java.nio.charset.StandardCharsets;\n\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpServletResponseWrapper;\n\nclass GzipHttpServletResponseWrapper extends HttpServletResponseWrapper {\n\n    private HttpServletResponse response;\n    private ServletOutputStream stream;\n    private PrintWriter writer;\n\n    GzipHttpServletResponseWrapper(final HttpServletResponse response) {\n        super(response);\n        this.response = response;\n        this.stream = null;\n        this.writer = null;\n    }\n\n    @Override\n    public void flushBuffer() throws IOException {\n        stream.flush();\n    }\n\n    @Override\n    public ServletOutputStream getOutputStream() throws IOException {\n        if (writer != null) {\n            throw new IllegalStateException(\"getOutputStream() was already called\");\n        }\n\n        if (stream == null) {\n            stream = createOutputStream();\n        }\n\n        return stream;\n    }\n\n    @Override\n    public PrintWriter getWriter() throws IOException {\n        if (writer != null) {\n            return writer;\n        }\n\n        if (stream != null) {\n            throw new IllegalStateException(\"getWriter() was already called\");\n        }\n\n        stream = createOutputStream();\n        writer = new PrintWriter(new OutputStreamWriter(stream, StandardCharsets.UTF_8));\n        return writer;\n    }\n\n    @Override\n    public void setContentLength(final int length) {\n        // Empty on purpose\n    }\n\n    private ServletOutputStream createOutputStream() throws IOException {\n        return new GzipResponseServletOutputStream(response);\n    }\n\n    void close() {\n        try {\n            if (writer != null) {\n                writer.close();\n            } else if (stream != null) {\n                stream.close();\n            }\n        } catch (final IOException e) {\n            // Error on closing writer or stream.\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/java/org/uberfire/backend/server/util/gzip/GzipResponseServletOutputStream.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util.gzip;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.util.zip.GZIPOutputStream;\n\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.WriteListener;\nimport javax.servlet.http.HttpServletResponse;\n\nclass GzipResponseServletOutputStream extends ServletOutputStream {\n\n    private static final String CONTENT_LENGTH_HEADER = \"Content-Length\";\n    private static final String CONTENT_ENCODING_HEADER = \"Content-Encoding\";\n\n    private ByteArrayOutputStream baos;\n    private GZIPOutputStream gzipStream;\n    private HttpServletResponse response;\n    private ServletOutputStream outputStream;\n    private boolean closed;\n\n    GzipResponseServletOutputStream(final HttpServletResponse response) throws IOException {\n        super();\n        this.closed = false;\n        this.response = response;\n        this.outputStream = response.getOutputStream();\n        this.baos = new ByteArrayOutputStream();\n        this.gzipStream = new GZIPOutputStream(baos);\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (closed) {\n            return;\n        }\n\n        gzipStream.finish();\n        final byte[] bytes = baos.toByteArray();\n\n        response.addHeader(CONTENT_LENGTH_HEADER, Integer.toString(bytes.length));\n        response.addHeader(CONTENT_ENCODING_HEADER, GzipFilter.GZIP);\n\n        outputStream.write(bytes);\n        outputStream.flush();\n        outputStream.close();\n        closed = true;\n    }\n\n    @Override\n    public void flush() throws IOException {\n        if (closed) {\n            return;\n        }\n\n        gzipStream.flush();\n    }\n\n    @Override\n    public void write(final int b) throws IOException {\n        if (closed) {\n            throw new IOException(\"Output stream already closed.\");\n        }\n\n        gzipStream.write((byte) b);\n    }\n\n    @Override\n    public void write(final byte[] data) throws IOException {\n        write(data, 0, data.length);\n    }\n\n    @Override\n    public void write(final byte[] data, final int offset, final int length) throws IOException {\n        if (closed) {\n            throw new IOException(\"Output stream already closed.\");\n        }\n\n        gzipStream.write(data, offset, length);\n    }\n\n    @Override\n    public boolean isReady() {\n        return true;\n    }\n\n    @Override\n    public void setWriteListener(final WriteListener writeListener) {\n        // Empty on purpose\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/main/resources/META-INF/services/org.uberfire.security.authz.adapter.GroupsAdapter",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.backend.server.security.adapter.JettyGroupsAdapter\norg.uberfire.backend.server.security.adapter.WeblogicGroupsAdapter\norg.uberfire.backend.server.security.adapter.WebSphereGroupsAdapter"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/IOWatchServiceNonDotImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class IOWatchServiceNonDotImplTest {\n\n    @Test\n    public void shouldFilterTest() {\n        Path path = mock(Path.class);\n\n        IOWatchServiceNonDotImpl io = new IOWatchServiceNonDotImpl();\n\n        assertFalse(io.shouldFilter(null));\n\n        when(path.getFileName()).thenReturn(null);\n        assertFalse(io.shouldFilter(path));\n\n        Path filename = mock(Path.class);\n        when(filename.toString()).thenReturn(\"dont_start_with_.\");\n        when(path.getFileName()).thenReturn(filename);\n        assertFalse(io.shouldFilter(path));\n\n        when(filename.toString()).thenReturn(\".dora\");\n        assertTrue(io.shouldFilter(path));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/LockCleanupSessionListenerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.Collections;\nimport javax.servlet.http.HttpSession;\nimport javax.servlet.http.HttpSessionEvent;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.io.ConfigIOServiceProducer;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LockCleanupSessionListenerTest {\n\n    @Mock\n    private HttpSessionEvent evt;\n\n    @Mock\n    private HttpSession session;\n\n    @Mock\n    private IOService ioService;\n\n    @Test\n    public void throwExceptionWhenIOProducerNotInitialized() {\n        final LockCleanupSessionListener listener = new LockCleanupSessionListener();\n\n        assertThatThrownBy(() -> listener.sessionDestroyed(evt))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"org.uberfire.backend.server.io.ConfigIOServiceProducer not initialized on startup\");\n    }\n\n    @Test\n    public void initWithoutInjection() {\n        final ConfigIOServiceProducer producer = spy(new ConfigIOServiceProducer());\n        final LockCleanupSessionListener listener = new LockCleanupSessionListener();\n\n        try {\n            when(evt.getSession()).thenReturn(session);\n            when(session.getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME)).thenReturn(Collections.emptySet());\n            when(producer.configIOService()).thenReturn(ioService);\n\n            producer.setup();\n            listener.sessionDestroyed(evt);\n\n            // Needs to programmatically request FS and IOService from producer instead of using @Inject (see UF-237)\n            verify(producer).configIOService();\n            verify(producer).configFileSystem();\n        } finally {\n            producer.destroy();\n        }\n    }\n\n    @Test\n    public void releaseLockAssociatedWithSession() {\n        final ConfigIOServiceProducer producer = spy(new ConfigIOServiceProducer());\n        final LockCleanupSessionListener listener = spy(new LockCleanupSessionListener());\n\n        try {\n            final String lockedBy = \"christian\";\n            final LockInfo lock = new LockInfo(true,\n                                               lockedBy,\n                                               PathFactory.newPath(\"file\",\n                                                                   \"default://file\"));\n\n            when(evt.getSession()).thenReturn(session);\n            when(session.getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME)).thenReturn(Collections.singleton(lock));\n            when(producer.configIOService()).thenReturn(ioService);\n            when(ioService.readAllString(any(Path.class))).thenReturn(lockedBy);\n\n            producer.setup();\n            listener.sessionDestroyed(evt);\n\n            verify(ioService,\n                   times(1)).delete(any(Path.class));\n        } finally {\n            producer.destroy();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/VFSLockServiceTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.util.Set;\nimport javax.servlet.http.HttpSession;\n\nimport org.jboss.errai.bus.client.api.QueueSession;\nimport org.jboss.errai.bus.client.api.base.MessageBuilder;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class VFSLockServiceTest {\n\n    @InjectMocks\n    private VFSLockServiceImpl lockService;\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private FileSystem fileSystem;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private QueueSession queueSession;\n\n    @Mock\n    private HttpSession httpSession;\n\n    private Path path = PathFactory.newPath(\"file-to-lock.txt\",\n                                            \"default://file-to-lock.txt\");\n\n    @Before\n    public void setup() {\n        setupRpcContext();\n\n        User testUser = new UserImpl(\"testUser\");\n        when(sessionInfo.getIdentity()).thenReturn(testUser);\n        when(queueSession.getAttribute(HttpSession.class,\n                                       HttpSession.class.getName())).thenReturn(httpSession);\n    }\n\n    @Test\n    public void acquireLockSucceedsIfFileUnlocked() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);\n\n        final LockResult result = lockService.acquireLock(path);\n        assertTrue(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(\"testUser\",\n                     result.getLockInfo().lockedBy());\n        assertTrue(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void acquireLockSucceedsIfLockOwned() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"testUser\");\n\n        final LockResult result = lockService.acquireLock(path);\n        assertTrue(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(\"testUser\",\n                     result.getLockInfo().lockedBy());\n        assertTrue(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void acquireLockFailsIfFileLocked() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"some-other-user\");\n\n        final LockResult result = lockService.acquireLock(path);\n        assertFalse(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(\"some-other-user\",\n                     result.getLockInfo().lockedBy());\n        assertTrue(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void acquireLockUpdatesSession() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);\n\n        lockService.acquireLock(path);\n        verify(httpSession).setAttribute(eq(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME),\n                                         any(Set.class));\n    }\n\n    @Test\n    // Unfortunately, batching is required for ensuring writes are properly \n    // replicated in the cluster. This needs to addressed in a future version \n    // of UF: https://issues.jboss.org/browse/UF-242\n    public void acquireLockUsesBatch() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);\n\n        lockService.acquireLock(path);\n\n        final InOrder inOrder = inOrder(ioService);\n        inOrder.verify(ioService).startBatch(fileSystem);\n        inOrder.verify(ioService).exists(any(org.uberfire.java.nio.file.Path.class));\n        inOrder.verify(ioService).write(any(org.uberfire.java.nio.file.Path.class),\n                                        any(String.class));\n        inOrder.verify(ioService).endBatch();\n    }\n\n    @Test\n    public void releaseLockSucceedsIfLockOwned() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"testUser\");\n\n        final LockResult result = lockService.releaseLock(path);\n        assertTrue(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(null,\n                     result.getLockInfo().lockedBy());\n        assertFalse(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void releaseLockFailsIfLockNotOwned() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"some-other-user\");\n\n        try {\n            lockService.releaseLock(path);\n            fail(\"Expected exception on attempt to release lock not owned by user\");\n        } catch (Exception ioe) {\n            // expected    \n        }\n    }\n\n    @Test\n    public void forceReleaseLockSucceedsIfLockNotOwned() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"some-other-user\");\n\n        final LockResult result = lockService.forceReleaseLock(path);\n        assertTrue(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(null,\n                     result.getLockInfo().lockedBy());\n        assertFalse(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void releaseLockFailsIfFileUnlocked() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);\n\n        final LockResult result = lockService.releaseLock(path);\n        assertFalse(result.isSuccess());\n        assertEquals(path,\n                     result.getLockInfo().getFile());\n        assertEquals(null,\n                     result.getLockInfo().lockedBy());\n        assertFalse(result.getLockInfo().isLocked());\n    }\n\n    @Test\n    public void releaseLockUpdatesSession() {\n        lockService.acquireLock(path);\n\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"testUser\");\n\n        lockService.releaseLock(path);\n        verify(httpSession).setAttribute(eq(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME),\n                                         any(Set.class));\n    }\n\n    @Test\n    // Unfortunately, batching is required for ensuring writes are properly \n    // replicated in the cluster. This needs to addressed in a future version \n    // of UF: https://issues.jboss.org/browse/UF-242\n    public void releaseLockUsesBatch() {\n        lockService.acquireLock(path);\n\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"testUser\");\n\n        lockService.releaseLock(path);\n\n        final InOrder inOrder = inOrder(ioService);\n        inOrder.verify(ioService).startBatch(fileSystem);\n        inOrder.verify(ioService).exists(any(org.uberfire.java.nio.file.Path.class));\n        inOrder.verify(ioService).readAllString(any(org.uberfire.java.nio.file.Path.class));\n        inOrder.verify(ioService).delete(any(org.uberfire.java.nio.file.Path.class));\n        inOrder.verify(ioService).endBatch();\n    }\n\n    @Test\n    public void retrieveLockInfoForLockedFile() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenReturn(\"some-user\");\n\n        final LockInfo info = lockService.retrieveLockInfo(path);\n        assertTrue(info.isLocked());\n        assertEquals(\"some-user\",\n                     info.lockedBy());\n    }\n\n    @Test\n    public void retrieveLockInfoForUnlockedFile() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(false);\n\n        final LockInfo info = lockService.retrieveLockInfo(path);\n        assertFalse(info.isLocked());\n        assertNull(info.lockedBy());\n    }\n\n    @Test\n    public void retrieveLockInfoNoSuchFileException() {\n        when(ioService.exists(any(org.uberfire.java.nio.file.Path.class))).thenReturn(true);\n        when(ioService.readAllString(any(org.uberfire.java.nio.file.Path.class))).thenThrow(new NoSuchFileException());\n\n        final LockInfo info = lockService.retrieveLockInfo(path);\n        assertFalse(info.isLocked());\n        assertNull(info.lockedBy());\n    }\n\n    private void setupRpcContext() {\n        final Message message = MessageBuilder.createMessage(\"for testing\").signalling().done().getMessage();\n        message.setResource(\"Session\",\n                            queueSession);\n        RpcContext.set(message);\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/VFSServicesServerImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server;\n\nimport java.net.URI;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.DirectoryStream;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class VFSServicesServerImplTest {\n\n    private static final Path ROOT_PATH = PathFactory.newPath(\"root\", \"file://root\");\n    private static final String ROOT_URI = ROOT_PATH.toURI();\n    private static Set<String> FS_ATTRIBUTES = new HashSet<String>() {{\n        add(\"version\");\n    }};\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private FileSystem fileSystem;\n\n    @Mock\n    private org.uberfire.java.nio.file.Path rootPath;\n\n    private VFSServicesServerImpl tested;\n    private URI rootUri;\n\n    @Before\n    public void setup() throws Exception {\n        rootUri = new URI(ROOT_URI);\n        when(fileSystem.supportedFileAttributeViews()).thenReturn(FS_ATTRIBUTES);\n        when(rootPath.toUri()).thenReturn(rootUri);\n        when(rootPath.getFileSystem()).thenReturn(fileSystem);\n        doAnswer((Answer<org.uberfire.java.nio.file.Path>) invocationOnMock -> {\n            final URI arg = (URI) invocationOnMock.getArguments()[0];\n            return arg.toURL().toString().equals(ROOT_URI) ? rootPath : null;\n        }).when(ioService).get(any(URI.class));\n        tested = new VFSServicesServerImpl(ioService);\n    }\n\n    @Test\n    public void testGet() {\n        final Path path = tested.get(ROOT_URI);\n        assertEquals(ROOT_URI, path.toURI());\n    }\n\n    @Test\n    public void testNewDirectoryStream() {\n        doAnswer((Answer<org.uberfire.java.nio.file.DirectoryStream<org.uberfire.java.nio.file.Path>>) invocationOnMock -> rootDirectoryStream)\n                .when(ioService)\n                .newDirectoryStream(any(org.uberfire.java.nio.file.Path.class));\n        final DirectoryStream<Path> paths = tested.newDirectoryStream(ROOT_PATH);\n        final Path path = paths.iterator().next();\n        assertEquals(ROOT_PATH, path);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testNewDirectoryStreamFiltered() {\n        final DirectoryStream.Filter<Path> filter = mock(DirectoryStream.Filter.class);\n        doAnswer((Answer<org.uberfire.java.nio.file.DirectoryStream<org.uberfire.java.nio.file.Path>>) invocationOnMock -> {\n            org.uberfire.java.nio.file.DirectoryStream.Filter<org.uberfire.java.nio.file.Path> argFilter =\n                    (org.uberfire.java.nio.file.DirectoryStream.Filter<org.uberfire.java.nio.file.Path>) invocationOnMock.getArguments()[1];\n            argFilter.accept(rootPath);\n            return rootDirectoryStream;\n        })\n                .when(ioService)\n                .newDirectoryStream(any(org.uberfire.java.nio.file.Path.class),\n                                    any(org.uberfire.java.nio.file.DirectoryStream.Filter.class));\n        final DirectoryStream<Path> paths = tested.newDirectoryStream(ROOT_PATH,\n                                                                      filter);\n        verify(filter, times(1)).accept(eq(ROOT_PATH));\n        final Path path = paths.iterator().next();\n        assertEquals(ROOT_PATH, path);\n    }\n\n    @Test\n    public void testCreateDirectory() {\n        tested.createDirectory(ROOT_PATH);\n        verify(ioService, times(1)).createDirectory(any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testCreateDirectoryWithAttributes() {\n        final Map attributes = mock(Map.class);\n        tested.createDirectory(ROOT_PATH,\n                               attributes);\n        verify(ioService, times(1))\n                .createDirectory(any(org.uberfire.java.nio.file.Path.class),\n                                 eq(attributes));\n    }\n\n    @Test\n    public void testCreateDirectories() {\n        tested.createDirectories(ROOT_PATH);\n        verify(ioService, times(1)).createDirectories(any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testCreateDirectoriesWithAttributes() {\n        final Map attributes = mock(Map.class);\n        tested.createDirectories(ROOT_PATH,\n                                 attributes);\n        verify(ioService, times(1))\n                .createDirectories(any(org.uberfire.java.nio.file.Path.class),\n                                   eq(attributes));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testSetAttributes() {\n        final Map attributes = mock(Map.class);\n        tested.setAttributes(ROOT_PATH,\n                             attributes);\n        verify(ioService, times(1))\n                .setAttributes(any(org.uberfire.java.nio.file.Path.class),\n                               eq(attributes));\n    }\n\n    @Test\n    public void testDelete() {\n        tested.delete(ROOT_PATH);\n        verify(ioService, times(1)).delete(any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testDeleteIfExists() {\n        tested.deleteIfExists(ROOT_PATH);\n        verify(ioService, times(1)).deleteIfExists(any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testCopy() {\n        tested.copy(ROOT_PATH,\n                    ROOT_PATH);\n        verify(ioService, times(1))\n                .copy(any(org.uberfire.java.nio.file.Path.class),\n                      any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testMove() {\n        tested.move(ROOT_PATH,\n                    ROOT_PATH);\n        verify(ioService, times(1))\n                .move(any(org.uberfire.java.nio.file.Path.class),\n                      any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testReadAllString() {\n        tested.readAllString(ROOT_PATH);\n        verify(ioService, times(1)).readAllString(any(org.uberfire.java.nio.file.Path.class));\n    }\n\n    @Test\n    public void testWrite() {\n        final String content = \"some-content-goes-here\";\n        tested.write(ROOT_PATH,\n                     content);\n        verify(ioService, times(1))\n                .write(any(org.uberfire.java.nio.file.Path.class),\n                       eq(content));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testWriteWithAttributes() {\n        final Map attributes = mock(Map.class);\n        final String content = \"some-content-goes-here\";\n        tested.write(ROOT_PATH,\n                     content,\n                     attributes);\n        verify(ioService, times(1))\n                .write(any(org.uberfire.java.nio.file.Path.class),\n                       eq(content),\n                       eq(attributes));\n    }\n\n    private final org.uberfire.java.nio.file.DirectoryStream<org.uberfire.java.nio.file.Path> rootDirectoryStream = new org.uberfire.java.nio.file.DirectoryStream<org.uberfire.java.nio.file.Path>() {\n        @Override\n        public void close() throws IOException {\n        }\n\n        @Override\n        public Iterator<org.uberfire.java.nio.file.Path> iterator() {\n            return Collections.singletonList(rootPath).iterator();\n        }\n    };\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/WebAppSettingsTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server;\n\nimport java.nio.file.FileSystems;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class WebAppSettingsTest {\n\n    String slash = FileSystems.getDefault().getSeparator();\n\n    @Test\n    public void testLastSlashIgnored() {\n        WebAppSettings.get().setRootDir(\"/test/\");\n        String homeDir = WebAppSettings.get().getRootDir();\n        assertEquals(homeDir,\n                     slash + \"test\");\n\n        WebAppSettings.get().setRootDir(\"c:\\\\test\\\\\");\n        homeDir = WebAppSettings.get().getRootDir();\n        assertEquals(homeDir,\n                     \"c:\" + slash + \"test\");\n    }\n\n    @Test\n    public void testRelativeDir() {\n        WebAppSettings.get().setRootDir(\"test\");\n        Path myFile = WebAppSettings.get().getAbsolutePath(\"mydir\",\n                                                           \"myfile\");\n        assertEquals(myFile,\n                     Paths.get(\"test\",\n                               \"mydir\",\n                               \"myfile\"));\n    }\n\n    @Test\n    public void testEmptyDir() {\n        WebAppSettings.get().setRootDir(null);\n        Path myDir = WebAppSettings.get().getAbsolutePath(\"mydir\");\n        assertNull(myDir);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/authz/AuthorizationServiceTest.java",
    "content": "/**\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AuthorizationServiceTest {\n\n    AuthorizationServiceImpl authorizationService;\n\n    AuthorizationPolicyDeployer deployer;\n\n    @Mock\n    AuthorizationPolicyStorage storage;\n\n    @Mock\n    Event<AuthorizationPolicyDeployedEvent> event;\n\n    @Mock\n    Event<AuthorizationPolicySavedEvent> policySavedEvent;\n\n    PermissionManager permissionManager;\n\n    private static final String path = \"WEB-INF/classes/security-policy.properties\";\n\n    @Before\n    public void setUp(){\n        PermissionTypeRegistry permissionTypeRegistry = new DefaultPermissionTypeRegistry();\n        permissionManager = spy(new DefaultPermissionManager(permissionTypeRegistry));\n        deployer = new AuthorizationPolicyDeployer(storage, permissionManager, event);\n        authorizationService = new AuthorizationServiceImpl(storage, permissionManager, policySavedEvent);\n    }\n\n    @Test\n    public void testPolicyLoad() throws Exception {\n        getPolicyFromPath(path);\n    }\n\n    @Test\n    public void testPolicySave() throws Exception {\n        Path policyDir = getPolicyFromPath(path);\n        deployer.deployPolicy(policyDir);\n\n        ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class);\n        verify(storage).loadPolicy();\n        verify(storage).savePolicy(policyCaptor.capture());\n        AuthorizationPolicy ap = policyCaptor.getValue();\n\n        authorizationService.savePolicy(ap);\n        verify(permissionManager, times(2)).setAuthorizationPolicy(ap);\n        verify(policySavedEvent).fire(any());\n    }\n\n    @Test\n    public void testPolicyDelete() throws Exception {\n        Path policyDir = getPolicyFromPath(path);\n        deployer.deployPolicy(policyDir);\n\n        ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class);\n        verify(storage).loadPolicy();\n        verify(storage).savePolicy(policyCaptor.capture());\n\n        AuthorizationPolicy ap = policyCaptor.getValue();\n        Group group = new GroupImpl(\"group1\");\n        authorizationService.deletePolicyByGroup(group, ap);\n        verify(storage).deletePolicyByGroup(group, ap);\n        verify(permissionManager, times(2)).setAuthorizationPolicy(any());\n        verify(policySavedEvent, times(1)).fire(any());\n    }\n\n    private Path getPolicyFromPath(String path) throws Exception {\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path);\n        Path policyDir = Paths.get(fileURL.toURI()).getParent();\n        assertNotNull(policyDir);\n        return policyDir;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/authz/AuthzPolicyDeployerTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URL;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.backend.server.WebAppSettings;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AuthzPolicyDeployerTest {\n\n    @Mock\n    protected SpacesAPI spaces;\n\n    @Mock\n    AuthorizationPolicyStorage storage;\n\n    AuthorizationPolicyVfsStorage vfsstorage;\n\n    private FileSystem fileSystem;\n\n    @Mock\n    Event<AuthorizationPolicyDeployedEvent> event;\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    AuthorizationPolicyDeployer deployer;\n\n    PermissionManager permissionManager;\n\n    IOService ioService;\n\n    @Before\n    public void setUp() throws IOException {\n        fileSystemTestingUtils.setup();\n        fileSystem = fileSystemTestingUtils.getFileSystem();\n        ioService = spy(fileSystemTestingUtils.getIoService());\n        doNothing().when(ioService).endBatch();\n        doReturn(fileSystem).when(ioService).newFileSystem(any(), anyMap());\n        PermissionTypeRegistry permissionTypeRegistry = new DefaultPermissionTypeRegistry();\n        permissionManager = spy(new DefaultPermissionManager(permissionTypeRegistry));\n\n        vfsstorage = new AuthorizationPolicyVfsStorage(ioService, permissionManager, spaces);\n        deployer = new AuthorizationPolicyDeployer(storage, permissionManager, event);\n        vfsstorage.initFileSystem();\n        RoleRegistry.get().clear();\n    }\n\n    @Test\n    public void testPolicyDir() {\n        WebAppSettings.get().setRootDir(\"/test\");\n        Path path = deployer.getPolicyDir();\n        Path expected = Paths.get(URI.create(\"file:///test/WEB-INF/classes\"));\n        assertEquals(path,\n                     expected);\n    }\n\n    @Test\n    public void testInvalidPolicy() {\n        assertThatThrownBy(() -> testPolicyLoad(\"WEB-INF/classes/invalid/security-policy.properties\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Key must start with [default|role|group]\");\n    }\n\n    @Test\n    public void testPolicyLoad() throws Exception {\n        testPolicyLoad(\"WEB-INF/classes/security-policy.properties\");\n    }\n\n    @Test\n    public void testPolicyLoad2() throws Exception {\n        testPolicyLoad(\"WEB-INF/classes/split/security-policy.properties\");\n    }\n\n    @Test\n    public void testPolicyDelete() throws Exception {\n        testPolicyDelete(\"WEB-INF/classes/security-policy.properties\");\n    }\n\n    public void testPolicyDelete(String path) throws Exception {\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path);\n        Path policyDir = Paths.get(fileURL.toURI()).getParent();\n\n        assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty());\n\n        deployer.deployPolicy(policyDir);\n\n        ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class);\n        verify(storage).loadPolicy();\n        verify(storage).savePolicy(policyCaptor.capture());\n        vfsstorage.savePolicy(policyCaptor.getValue());\n\n        AuthorizationPolicy policy = vfsstorage.loadPolicyFromVfs();\n        Set<Group> groups = policy.getGroups();\n        assertEquals(1, groups.size());\n\n        Group group = new GroupImpl(\"group1\");\n        PermissionCollection permissions = policy.getPermissions(group);\n        Permission permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult());\n\n        vfsstorage.deletePolicyByGroup(group, policyCaptor.getValue());\n        verify(event).fire(any());\n\n        policy = vfsstorage.loadPolicyFromVfs();\n        groups = policy.getGroups();\n        assertEquals(0, groups.size());\n\n    }\n\n    public void testPolicyLoad(String path) throws Exception {\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(path);\n        Path policyDir = Paths.get(fileURL.toURI()).getParent();\n\n        assertTrue(RoleRegistry.get().getRegisteredRoles().isEmpty());\n\n        deployer.deployPolicy(policyDir);\n\n        ArgumentCaptor<AuthorizationPolicy> policyCaptor = ArgumentCaptor.forClass(AuthorizationPolicy.class);\n        verify(storage).loadPolicy();\n        verify(storage).savePolicy(policyCaptor.capture());\n        verify(event).fire(any());\n\n        AuthorizationPolicy policy = policyCaptor.getValue();\n        verify(permissionManager).setAuthorizationPolicy(policy);\n        assertEquals(RoleRegistry.get().getRegisteredRoles().size(),\n                     3);\n\n        Set<Role> roles = policy.getRoles();\n        assertEquals(roles.size(),\n                     3);\n\n        Role adminRole = new RoleImpl(\"admin\");\n        PermissionCollection permissions = policy.getPermissions(adminRole);\n        assertTrue(roles.contains(adminRole));\n        assertEquals(policy.getRoleDescription(adminRole),\n                     \"Administrator\");\n        assertEquals(policy.getPriority(adminRole),\n                     1);\n        assertEquals(permissions.collection().size(),\n                     3);\n\n        Permission permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"perspective.read.SimplePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n\n        Role userRole = new RoleImpl(\"user\");\n        permissions = policy.getPermissions(userRole);\n        assertTrue(roles.contains(userRole));\n        assertEquals(policy.getRoleDescription(userRole),\n                     \"End user\");\n        assertEquals(policy.getPriority(userRole),\n                     2);\n        assertEquals(permissions.collection().size(),\n                     4);\n\n        permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n\n        permission = permissions.get(\"perspective.read.HomePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"perspective.read.SimplePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        Role managerRole = new RoleImpl(\"manager\");\n        permissions = policy.getPermissions(managerRole);\n        assertTrue(roles.contains(managerRole));\n        assertEquals(policy.getRoleDescription(managerRole),\n                     \"Manager\");\n        assertEquals(policy.getPriority(managerRole),\n                     3);\n        assertEquals(permissions.collection().size(),\n                     3);\n\n        permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"repository.read.git://repo1\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testNothingToDeploy() {\n        deployer.deployPolicy(null);\n        verify(storage,\n               never()).loadPolicy();\n        verify(storage,\n               never()).savePolicy(any());\n    }\n\n    @Test\n    public void testAlreadyDeployed() {\n        when(storage.loadPolicy()).thenReturn(mock(AuthorizationPolicy.class));\n        deployer.deployPolicy(Paths.get(\"\"));\n\n        verify(storage).loadPolicy();\n        verify(storage,\n               never()).savePolicy(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/authz/AuthzPolicyMarshallerTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.authz;\n\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.TreeMap;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingStrategy;\nimport org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class AuthzPolicyMarshallerTest {\n\n    AuthorizationPolicyBuilder builder;\n    AuthorizationPolicyMarshaller marshaller;\n    PermissionManager permissionManager;\n\n    @Before\n    public void setUp() {\n        permissionManager = new DefaultPermissionManager(new DefaultPermissionTypeRegistry());\n        builder = permissionManager.newAuthorizationPolicy();\n        marshaller = new AuthorizationPolicyMarshaller();\n    }\n\n    protected User createUserMock(String... roles) {\n        User user = mock(User.class);\n        Set<Role> roleSet = Stream.of(roles).map(RoleImpl::new).collect(Collectors.toSet());\n        when(user.getRoles()).thenReturn(roleSet);\n        when(user.getGroups()).thenReturn(null);\n        return user;\n    }\n\n    @Test\n    public void testDefaultHomeEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"default.home\");\n        assertTrue(key.isDefault());\n        assertEquals(key.getAttributeType(),\n                     \"home\");\n    }\n\n    @Test\n    public void testDefaultPermissionEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"default.permission.perspective.read\");\n        assertTrue(key.isDefault());\n        assertEquals(key.getAttributeType(),\n                     \"permission\");\n        assertEquals(key.getAttributeId(),\n                     \"perspective.read\");\n    }\n\n    @Test\n    public void testOverwriteDefault() {\n        Map<String, String> input = new HashMap<>();\n        input.put(\"default.permission.perspective.read\",\n                  \"false\");\n        input.put(\"default.permission.perspective.read.HomePerspective\",\n                  \"true\");\n        input.put(\"role.user.permission.perspective.read\",\n                  \"false\");\n        input.put(\"role.user.permission.perspective.read.HomePerspective\",\n                  \"true\");\n        input.put(\"role.user.permission.perspective.read.Sales dashboard\",\n                  \"true\");\n\n        marshaller.read(builder,\n                        input);\n        permissionManager.setAuthorizationPolicy(builder.build());\n\n        User user = createUserMock(\"user\",\n                                   \"manager\");\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       VotingStrategy.PRIORITY);\n        assertEquals(pc.collection().size(),\n                     3);\n        assertEquals(pc.get(\"perspective.read\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n        assertEquals(pc.get(\"perspective.read.HomePerspective\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(pc.get(\"perspective.read.Sales dashboard\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testDefaultPermissionsNotOverwrite() {\n        Map<String, String> input = new HashMap<>();\n        input.put(\"default.permission.perspective.read.p1\", \"false\");\n        input.put(\"default.permission.perspective.read.p2\", \"false\");\n        input.put(\"role.user.permission.perspective.read\", \"true\");\n        input.put(\"role.user.permission.perspective.read.p2\", \"false\");\n\n        marshaller.read(builder, input);\n        permissionManager.setAuthorizationPolicy(builder.build());\n\n        User user = createUserMock(\"user\");\n        PermissionCollection pc = permissionManager.resolvePermissions(user, VotingStrategy.PRIORITY);\n        assertEquals(pc.collection().size(), 2);\n        assertEquals(pc.get(\"perspective.read\").getResult(), AuthorizationResult.ACCESS_GRANTED);\n        assertNull(pc.get(\"perspective.read.p1\"));\n        assertEquals(pc.get(\"perspective.read.p2\").getResult(), AuthorizationResult.ACCESS_DENIED);\n    }\n\n    @Test\n    public void testHomeEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"role.admin.home\");\n        assertTrue(key.isRole());\n        assertEquals(key.getRole(),\n                     \"admin\");\n        assertEquals(key.getAttributeType(),\n                     \"home\");\n        assertNull(key.getAttributeId());\n    }\n\n    @Test\n    public void testGroupEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"group.IT.home\");\n        assertFalse(key.isRole());\n        assertTrue(key.isGroup());\n        assertEquals(key.getGroup(),\n                     \"IT\");\n        assertEquals(key.getAttributeType(),\n                     \"home\");\n        assertNull(key.getAttributeId());\n    }\n\n    @Test\n    public void testPriorityEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"role.admin.priority\");\n        assertTrue(key.isRole());\n        assertEquals(key.getRole(),\n                     \"admin\");\n        assertEquals(key.getAttributeType(),\n                     \"priority\");\n        assertNull(key.getAttributeId());\n    }\n\n    @Test\n    public void testPermissionEntry() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"role.admin.permission.perspective.read\");\n        assertTrue(key.isRole());\n        assertEquals(key.getRole(),\n                     \"admin\");\n        assertEquals(key.getAttributeType(),\n                     \"permission\");\n        assertEquals(key.getAttributeId(),\n                     \"perspective.read\");\n    }\n\n    @Test\n    public void testSpecialCharsAllowed() {\n        AuthorizationPolicyMarshaller.Key key = marshaller.parse(\"role.manager.permission.repository.update.git://repo1\");\n        assertTrue(key.isRole());\n        assertEquals(key.getRole(),\n                     \"manager\");\n        assertEquals(key.getAttributeType(),\n                     \"permission\");\n        assertEquals(key.getAttributeId(),\n                     \"repository.update.git://repo1\");\n    }\n\n    @Test\n    public void testRoleMissing() {\n        assertThatThrownBy(() -> marshaller.parse(\"role..priority\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Role value is empty\");\n    }\n\n    @Test\n    public void testTypeMissing() {\n        assertThatThrownBy(() -> marshaller.parse(\".admin.priority\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Key must start with [default|role|group]\");\n    }\n\n    @Test\n    public void testIncompleteEntry() {\n        assertThatThrownBy(() -> marshaller.parse(\"role\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Role value is empty\");\n    }\n\n    @Test\n    public void testReadDefaultEntries() {\n        AuthorizationPolicy policy = builder.bydefault().home(\"B\")\n                .permission(\"p1\",\n                            false)\n                .permission(\"p2\",\n                            true)\n                .role(\"admin\")\n                .permission(\"p1\",\n                            true)\n                .build();\n\n        String home = policy.getHomePerspective();\n        PermissionCollection pc = policy.getPermissions();\n\n        assertEquals(home,\n                     \"B\");\n        assertEquals(pc.collection().size(),\n                     2);\n        assertNotNull(pc.get(\"p1\"));\n        assertNotNull(pc.get(\"p2\"));\n        assertEquals(pc.get(\"p1\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n        assertEquals(pc.get(\"p2\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        Role admin = new RoleImpl(\"admin\");\n        home = policy.getHomePerspective(admin);\n        pc = policy.getPermissions(admin);\n        assertEquals(home,\n                     \"B\");\n        assertEquals(pc.collection().size(),\n                     2);\n        assertNotNull(pc.get(\"p1\"));\n        assertNotNull(pc.get(\"p2\"));\n        assertEquals(pc.get(\"p1\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(pc.get(\"p2\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testPolicyRead() throws Exception {\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(\"WEB-INF/classes/security-policy.properties\");\n        Path policyPath = Paths.get(fileURL.toURI());\n        NonEscapedProperties input = new NonEscapedProperties();\n        input.load(Files.newBufferedReader(policyPath));\n        marshaller.read(builder,\n                        input);\n\n        AuthorizationPolicy policy = builder.build();\n\n        Set<Role> roles = policy.getRoles();\n        assertEquals(roles.size(),\n                     3);\n\n        Role adminRole = new RoleImpl(\"admin\");\n        PermissionCollection permissions = policy.getPermissions(adminRole);\n        assertTrue(roles.contains(adminRole));\n        assertEquals(policy.getRoleDescription(adminRole),\n                     \"Administrator\");\n        assertEquals(policy.getPriority(adminRole),\n                     1);\n        assertEquals(permissions.collection().size(),\n                     3);\n\n        Permission permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"perspective.read.SimplePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n\n        Role userRole = new RoleImpl(\"user\");\n        permissions = policy.getPermissions(userRole);\n        assertTrue(roles.contains(userRole));\n        assertEquals(policy.getRoleDescription(userRole),\n                     \"End user\");\n        assertEquals(policy.getPriority(userRole),\n                     2);\n        assertEquals(permissions.collection().size(),\n                     4);\n\n        permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n\n        permission = permissions.get(\"perspective.read.HomePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"perspective.read.SimplePerspective\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        Role managerRole = new RoleImpl(\"manager\");\n        permissions = policy.getPermissions(managerRole);\n        assertTrue(roles.contains(managerRole));\n        assertEquals(policy.getRoleDescription(managerRole),\n                     \"Manager\");\n        assertEquals(policy.getPriority(managerRole),\n                     3);\n        assertEquals(permissions.collection().size(),\n                     3);\n\n        permission = permissions.get(\"perspective.read\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        permission = permissions.get(\"repository.read.git://repo1\");\n        assertNotNull(permission);\n        assertEquals(permission.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testPolicyWrite() {\n        builder.role(\"admin\").priority(5).home(\"A\")\n                .permission(\"p1\",\n                            true)\n                .permission(\"p2\",\n                            false)\n                .group(\"group1\").priority(3).home(\"B\")\n                .permission(\"p1\",\n                            false)\n                .permission(\"p2\",\n                            true)\n                .bydefault().home(\"B\")\n                .permission(\"p1\",\n                            false)\n                .permission(\"p2\",\n                            true);\n\n        AuthorizationPolicy policy = builder.build();\n        TreeMap<String, String> output = new TreeMap<>();\n        marshaller.write(policy,\n                         output);\n\n        assertEquals(output.size(),\n                     11);\n        assertEquals(output.get(\"role.admin.home\"),\n                     \"A\");\n        assertEquals(output.get(\"role.admin.home\"),\n                     \"A\");\n        assertEquals(output.get(\"role.admin.priority\"),\n                     \"5\");\n        assertEquals(output.get(\"role.admin.permission.p1\"),\n                     \"true\");\n        assertEquals(output.get(\"role.admin.permission.p2\"),\n                     \"false\");\n        assertEquals(output.get(\"group.group1.home\"),\n                     \"B\");\n        assertEquals(output.get(\"group.group1.priority\"),\n                     \"3\");\n        assertEquals(output.get(\"group.group1.permission.p1\"),\n                     \"false\");\n        assertEquals(output.get(\"group.group1.permission.p2\"),\n                     \"true\");\n        assertEquals(output.get(\"default.home\"),\n                     \"B\");\n        assertEquals(output.get(\"default.permission.p1\"),\n                     \"false\");\n        assertEquals(output.get(\"default.permission.p2\"),\n                     \"true\");\n    }\n\n    @Test\n    public void testPolicyRemove() {\n        builder.group(\"group2\").priority(3).home(\"B\")\n                .permission(\"p1\",\n                            false)\n                .permission(\"p2\",\n                            true);\n\n        AuthorizationPolicy policy = builder.build();\n        TreeMap<String, String> output = new TreeMap<>();\n        marshaller.write(policy,\n                         output);\n        Group g = new GroupImpl(\"group2\");\n        assertEquals(\"B\", output.get(\"group.group2.home\"));\n        assertEquals(\"3\", output.get(\"group.group2.priority\"));\n        assertEquals(\"false\", output.get(\"group.group2.permission.p1\"));\n        assertEquals(\"true\", output.get(\"group.group2.permission.p2\"));\n        marshaller.remove(g, policy, output);\n\n        assertEquals(null, output.get(\"group.group2.home\"));\n        assertEquals(null, output.get(\"group.group2.priority\"));\n        assertEquals(null, output.get(\"group.group2.permission.p1\"));\n        assertEquals(null, output.get(\"group.group2.permission.p2\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/io/JGitFileSystemLazyCacheTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.io;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProxy;\nimport org.uberfire.mocks.FileSystemTestingUtils;\n\nimport static org.junit.Assert.*;\n\npublic class JGitFileSystemLazyCacheTest {\n\n    private static FileSystemTestingUtils fsUtils = new FileSystemTestingUtils();\n\n    static {\n        System.out.println(\"Working Dir: \" + new File(\"\").getAbsoluteFile().getAbsolutePath());\n    }\n\n    @Before\n    public void setup() throws IOException {\n        System.setProperty(\"org.uberfire.nio.jgit.cache.instances\",\n                           \"2\");\n        fsUtils.setup(false);\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fsUtils.cleanup();\n        System.clearProperty(\"org.uberfire.nio.jgit.cache.instances\");\n    }\n\n    @Test\n    public void basicCache() throws IOException {\n        String repoName = \"amend-repo-test\";\n        Path firstWrite = fsUtils.getIoService().get(URI.create(\"git://\" + repoName + \"/init1.file\"));\n\n        String content = \"dora!\";\n\n        Path secondWrite = fsUtils.getIoService().get(URI.create(\"git://\" + repoName + \"/init2.file\"));\n\n        fsUtils.getIoService().write(firstWrite,\n                                     content);\n\n        String jgitcontent = fsUtils.getIoService().readAllString(firstWrite);\n        assertEquals(content,\n                     jgitcontent);\n\n        fsUtils.getIoService().write(secondWrite,\n                                     content);\n        JGitFileSystemProxy fileSystem = (JGitFileSystemProxy) firstWrite.getFileSystem();\n        JGitFileSystemProxy fileSystem1 = (JGitFileSystemProxy) secondWrite.getFileSystem();\n        assertEquals(fileSystem,\n                     fileSystem1);\n    }\n\n    @Test\n    public void regenerateFSCache() throws IOException {\n        String defaultRepo = \"git://amend-repo-test\";\n\n        Path firstWriteFS1 = fsUtils.getIoService().get(URI.create(defaultRepo + \"/init1.file\"));\n\n        FileSystem fileSystem1Instance1 = firstWriteFS1.getFileSystem();\n\n        String dora1 = \"dora1\";\n        String dora2 = \"dora2\";\n        fsUtils.getIoService().write(firstWriteFS1,\n                                     dora1);\n\n        fsUtils.setupJGitRepository(defaultRepo + \"2\",\n                                    false);\n        Path writeFS2 = fsUtils.getIoService().get(URI.create(defaultRepo + \"2\" + \"/init1.file\"));\n        fsUtils.getIoService().write(writeFS2,\n                                     dora1);\n\n        fsUtils.setupJGitRepository(defaultRepo + \"3\",\n                                    false);\n        Path writeFS3 = fsUtils.getIoService().get(URI.create(defaultRepo + \"3\" + \"/init1.file\"));\n        fsUtils.getIoService().write(writeFS3,\n                                     dora1);\n\n        //memoized cache size == 2 , so\n\n        fsUtils.setupJGitRepository(defaultRepo,\n                                    false);\n        Path secondWriteFS1 = fsUtils.getIoService().get(URI.create(defaultRepo + \"/init2.file\"));\n        fsUtils.getIoService().write(secondWriteFS1,\n                                     dora2);\n\n        FileSystem fileSystem1Instance2 = secondWriteFS1.getFileSystem();\n\n        //not equals because we have to regenerate, but still represent the same FS\n        assertTrue(System.identityHashCode(fileSystem1Instance1) != System.identityHashCode(fileSystem1Instance2));\n        assertTrue(fileSystem1Instance1.hashCode() == fileSystem1Instance2.hashCode());\n        assertEquals(fileSystem1Instance1,\n                     fileSystem1Instance2);\n\n        //let's remove fs1 again from cache\n        fsUtils.setupJGitRepository(defaultRepo + \"5\",\n                                    false);\n        fsUtils.setupJGitRepository(defaultRepo + \"6\",\n                                    false);\n\n        //read to see if all the writes are fine on fs1\n\n        String actual1 = fsUtils.getIoService().readAllString(fsUtils.getIoService().get(URI.create(defaultRepo + \"/init1.file\")));\n        String actual2 = fsUtils.getIoService().readAllString(fsUtils.getIoService().get(URI.create(defaultRepo + \"/init2.file\")));\n\n        assertEquals(dora1,\n                     actual1);\n        assertEquals(dora2,\n                     actual2);\n    }\n\n    @Test\n    public void branchingTest() throws IOException {\n\n        FileSystem fileSystem = fsUtils.setupJGitRepository(\"git://dora-repo\",\n                                                            true);\n        fsUtils.getProvider().forceAsDefault();\n\n        Path branchPath = fileSystem.getPath(\"branch\",\n                                             \"dir\");\n\n        Path pathOnBranch = branchPath.resolve(\"test.file\");\n\n        String expected = \"dora\";\n        fsUtils.getIoService().write(pathOnBranch,\n                                     expected);\n\n        String actual = fsUtils.getIoService().readAllString(branchPath.resolve(\"test.file\"));\n\n        assertEquals(expected,\n                     actual);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/io/object/ObjectStorageTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.object;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.*;\n\npublic class ObjectStorageTest {\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    static {\n        System.setProperty(\"errai.devel.nocache\",\n                           \"true\");\n        System.out.println(\"Working Dir: \" + new File(\"\").getAbsoluteFile().getAbsolutePath());\n    }\n\n    private IOService ioService;\n    private FileSystem fileSystem;\n    private SessionInfo sessionInfo;\n    private ObjectStorageImpl objectStorage;\n\n    @Before\n    public void setup() throws IOException {\n        fileSystemTestingUtils.setup();\n        sessionInfo = mockSessionInfo();\n        fileSystem = mockFileSystem();\n        ioService = mockIoService(fileSystem);\n        objectStorage = new ObjectStorageImpl(ioService);\n        objectStorage.init(URI.create(\"default://object/store\"));\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void testForAFileDoesNotExist() {\n        final String file = \"my.object.file\";\n        final boolean objectExists = objectStorage.exists(\"/forks/\" + file);\n\n        assertFalse(objectExists);\n    }\n\n    @Test\n    public void testWriteFileAndCheckThatExists() {\n        objectStorage.write(\"/forks/uberfire.txt\",\n                            \"content\");\n\n        boolean exists = objectStorage.exists(\"/forks/uberfire.txt\");\n        assertTrue(exists);\n    }\n\n    @Test\n    public void testWriteAndRead() {\n        final String fileContent = \"content\";\n        objectStorage.write(\"/forks/uberfire\",\n                            fileContent);\n\n        String content = objectStorage.read(\"/forks/uberfire\");\n        assertEquals(fileContent,\n                     content);\n    }\n\n    @Test\n    public void testWriteAndReadList() {\n        final ArrayList<String> fileContent = new ArrayList<String>();\n        fileContent.add(\"uberfire\");\n        objectStorage.write(\"/forks/uberfire\",\n                            fileContent);\n\n        List<String> content = objectStorage.read(\"/forks/uberfire\");\n        assertEquals(fileContent.size(),\n                     content.size());\n        assertEquals(fileContent.get(0),\n                     content.get(0));\n    }\n\n    @Test\n    public void testWithDoubleSlashPath() {\n\n        final String fileContent = \"content\";\n        objectStorage.write(\"/forks/uberfire\",\n                            fileContent);\n\n        String content = objectStorage.read(\"/forks/uberfire\");\n        assertEquals(fileContent,\n                     content);\n    }\n\n    @Test\n    public void testWriteTwoTimes() {\n\n        objectStorage.write(\"/forks/uberfire\",\n                            \"content a\");\n        objectStorage.write(\"/forks/uberfire\",\n                            \"content b\");\n\n        String content = objectStorage.read(\"/forks/uberfire\");\n        assertEquals(\"content b\",\n                     content);\n    }\n\n    @Test\n    public void testWriteAndDelete() {\n\n        objectStorage.write(\"/forks/uberfire\",\n                            \"content b\");\n        assertTrue(objectStorage.exists(\"/forks/uberfire\"));\n        objectStorage.delete(\"/forks/uberfire\");\n        assertFalse(objectStorage.exists(\"/forks/uberfire\"));\n    }\n\n    private SessionInfo mockSessionInfo() {\n        return new SessionInfoMock();\n    }\n\n    private FileSystem mockFileSystem() {\n        return fileSystemTestingUtils.getFileSystem();\n    }\n\n    private IOService mockIoService(final FileSystem fileSystem) {\n        final IOService ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n        doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class),\n                                                           anyMap());\n\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/io/watch/AbstractIOWatchServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\nimport java.lang.reflect.Field;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.TimeUnit;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Filter;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.InterruptedException;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.Watchable;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.mock;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AbstractIOWatchServiceTest {\n\n    @Test\n    public void testAddWatchServiceException() {\n        // BZ1323572\n        try {\n            System.setProperty(\"org.uberfire.watcher.autostart\",\n                               \"false\");\n\n            AbstractIOWatchService service = new AbstractIOWatchService(null,\n                                                                        null,\n                                                                        null,\n                                                                        null,\n                                                                        null,\n                                                                        Executors.newCachedThreadPool(new DescriptiveThreadFactory())) {\n\n                @Override\n                public boolean doFilter(WatchEvent<?> t) {\n                    return false;\n                }\n            };\n\n            WatchService ws = new WatchService() {\n\n                @Override\n                public void close() throws IOException {\n                }\n\n                @Override\n                public WatchKey poll() throws ClosedWatchServiceException {\n                    return null;\n                }\n\n                @Override\n                public WatchKey poll(long timeout,\n                                     TimeUnit unit) throws ClosedWatchServiceException, InterruptedException {\n                    return null;\n                }\n\n                @Override\n                public WatchKey take() throws ClosedWatchServiceException, InterruptedException {\n                    return new WatchKey() {\n\n                        @Override\n                        public boolean isValid() {\n                            return false;\n                        }\n\n                        @Override\n                        public List<WatchEvent<?>> pollEvents() {\n                            return null;\n                        }\n\n                        @Override\n                        public boolean reset() {\n                            return false; // exit the loop in asyncWatchService.execute()\n                        }\n\n                        @Override\n                        public void cancel() {\n                        }\n\n                        @Override\n                        public Watchable watchable() {\n                            return null;\n                        }\n                    };\n                }\n\n                @Override\n                public boolean isClose() {\n                    return false;\n                }\n            };\n\n            service.addWatchService(mock(FileSystem.class),\n                                    ws);\n\n            Set<AsyncWatchService> watchThreads = null;\n            try {\n                Field field = AbstractIOWatchService.class.getDeclaredField(\"watchThreads\");\n                field.setAccessible(true);\n                watchThreads = (Set<AsyncWatchService>) field.get(service);\n            } catch (Exception e) {\n                fail(e.getMessage());\n            }\n            AsyncWatchService asyncWatchService = watchThreads.iterator().next();\n\n            IOWatchServiceExecutor wsExecutor = (watchKey, filter) -> {\n                throw new RuntimeException(\"dummy\");\n            };\n\n            try {\n                asyncWatchService.execute(wsExecutor);\n                assertTrue(true);\n            } catch (Exception e) {\n                fail(\"Exception is thrown from asyncWatchService.execute()\");\n            }\n        } finally {\n            System.clearProperty(\"org.uberfire.watcher.autostart\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/io/watch/IOWatchServiceExecutorImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.io.watch;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Filter;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceChangeType;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class IOWatchServiceExecutorImplTest {\n\n    private static final String COMMIT_MESSAGE = \"COMMIT_MESSAGE\";\n    private static final String SESSION_ID = \"SESSION_ID\";\n    private static final String USER = \"USER\";\n\n    private static final String ORIGINAL_FILE1_URI = \"file:///originalPath/OriginalFile1.java\";\n    private static final String NEW_FILE1_URI = \"file:///newFilePath/NewFile1.java\";\n\n    private static final String ORIGINAL_FILE2_URI = \"file:///originalPath/OriginalFile2.java\";\n    private static final String NEW_FILE2_URI = \"file:///newFilePath/NewFile2.java\";\n\n    private static final String ORIGINAL_FILE3_URI = \"file:///originalPath/OriginalFile3.java\";\n    private static final String NEW_FILE3_URI = \"file:///newFilePath/NewFile3.java\";\n\n    private static final String ORIGINAL_FILE4_URI = \"file:///originalPath/OriginalFile4.java\";\n    private static final String NEW_FILE4_URI = \"file:///newFilePath/NewFile4.java\";\n\n    @Mock\n    private EventSourceMock<ResourceBatchChangesEvent> resourceBatchChanges;\n\n    @Mock\n    private EventSourceMock<ResourceUpdatedEvent> resourceUpdatedEvent;\n\n    @Mock\n    private EventSourceMock<ResourceRenamedEvent> resourceRenamedEvent;\n\n    @Mock\n    private EventSourceMock<ResourceDeletedEvent> resourceDeletedEvent;\n\n    @Mock\n    private EventSourceMock<ResourceAddedEvent> resourceAddedEvent;\n\n    @Captor\n    private ArgumentCaptor<ResourceUpdatedEvent> resourceUpdatedEventCaptor;\n\n    @Captor\n    private ArgumentCaptor<ResourceDeletedEvent> resourceDeletedEventCaptor;\n\n    @Captor\n    private ArgumentCaptor<ResourceAddedEvent> resourceAddedEventCaptor;\n\n    @Captor\n    private ArgumentCaptor<ResourceRenamedEvent> resourceRenamedEventCaptor;\n\n    @Captor\n    private ArgumentCaptor<ResourceBatchChangesEvent> resourceBatchChangesEventCaptor;\n\n    private IOWatchServiceExecutorImpl watchServiceExecutor;\n\n    @Before\n    public void setUp() {\n        watchServiceExecutor = new IOWatchServiceExecutorImpl();\n        watchServiceExecutor.setEvents(resourceBatchChanges,\n                                       resourceUpdatedEvent,\n                                       resourceRenamedEvent,\n                                       resourceDeletedEvent,\n                                       resourceAddedEvent);\n    }\n\n    @Test\n    public void testSingleEventModify() throws Exception {\n        testSingleEvent(StandardWatchEventKind.ENTRY_MODIFY,\n                        ORIGINAL_FILE1_URI,\n                        NEW_FILE1_URI,\n                        SESSION_ID,\n                        USER,\n                        COMMIT_MESSAGE);\n    }\n\n    @Test\n    public void testSingleEventDelete() throws Exception {\n        testSingleEvent(StandardWatchEventKind.ENTRY_DELETE,\n                        ORIGINAL_FILE1_URI,\n                        NEW_FILE1_URI,\n                        SESSION_ID,\n                        USER,\n                        COMMIT_MESSAGE);\n    }\n\n    @Test\n    public void testSingleEventCreate() throws Exception {\n        testSingleEvent(StandardWatchEventKind.ENTRY_CREATE,\n                        ORIGINAL_FILE1_URI,\n                        NEW_FILE1_URI,\n                        SESSION_ID,\n                        USER,\n                        COMMIT_MESSAGE);\n    }\n\n    @Test\n    public void testSingleEventRename() throws Exception {\n        testSingleEvent(StandardWatchEventKind.ENTRY_RENAME,\n                        ORIGINAL_FILE1_URI,\n                        NEW_FILE1_URI,\n                        SESSION_ID,\n                        USER,\n                        COMMIT_MESSAGE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void testMultipleEvents() throws Exception {\n        List<WatchEvent<?>> events = new ArrayList<>();\n\n        //file1 modified\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_MODIFY,\n                                  ORIGINAL_FILE1_URI,\n                                  NEW_FILE1_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file1 renamed\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_RENAME,\n                                  ORIGINAL_FILE1_URI,\n                                  NEW_FILE1_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file 2 added\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_CREATE,\n                                  ORIGINAL_FILE2_URI,\n                                  NEW_FILE2_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file 3  removed\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_DELETE,\n                                  ORIGINAL_FILE3_URI,\n                                  NEW_FILE3_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file 4  added\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_CREATE,\n                                  ORIGINAL_FILE4_URI,\n                                  NEW_FILE4_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file 4  modified\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_MODIFY,\n                                  ORIGINAL_FILE4_URI,\n                                  NEW_FILE4_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n        //file 4  deleted\n        events.add(mockWatchEvent(StandardWatchEventKind.ENTRY_DELETE,\n                                  ORIGINAL_FILE4_URI,\n                                  NEW_FILE4_URI,\n                                  SESSION_ID,\n                                  USER,\n                                  COMMIT_MESSAGE));\n\n        WatchKey watchKey = mock(WatchKey.class);\n        Filter<WatchEvent<?>> filter = mock(Filter.class);\n        when(watchKey.pollEvents()).thenReturn(events);\n        when(filter.doFilter(any(WatchEvent.class))).thenReturn(false);\n\n        watchServiceExecutor.execute(watchKey,\n                                     filter);\n\n        verify(resourceBatchChanges).fire(resourceBatchChangesEventCaptor.capture());\n\n        //verify file1 was modified\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             ORIGINAL_FILE1_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.UPDATE);\n        //verify file1 was renamed\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             ORIGINAL_FILE1_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.RENAME);\n        //verify file2 was added\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             NEW_FILE2_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.ADD);\n        //verify file3 was removed\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             ORIGINAL_FILE3_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.DELETE);\n        //verify file4 was added\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             NEW_FILE4_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.ADD);\n        //verify file4 was modified\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             ORIGINAL_FILE4_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.UPDATE);\n        //verify file4 was deleted\n        verifyResourceChange(resourceBatchChangesEventCaptor.getValue(),\n                             ORIGINAL_FILE4_URI,\n                             COMMIT_MESSAGE,\n                             ResourceChangeType.DELETE);\n    }\n\n    private void verifyResourceChange(ResourceBatchChangesEvent resourceBatchChanges,\n                                      String originalFile1Uri,\n                                      String commitMessage,\n                                      ResourceChangeType changeType) {\n        Optional<Collection<ResourceChange>> expectedResourceChanges = resourceBatchChanges.getBatch().entrySet()\n                .stream()\n                .filter(entry -> originalFile1Uri.equals(entry.getKey().toURI()))\n                .map(Map.Entry::getValue)\n                .findFirst()\n                .filter(resourceChanges -> resourceChanges.stream()\n                        .filter(resourceChange -> resourceChange.getType().equals(changeType) && resourceChange.getMessage().equals(commitMessage))\n                        .findFirst().isPresent());\n        assertTrue(\"Change \" + changeType.name() + \" was not found for resource: \" + originalFile1Uri,\n                   expectedResourceChanges.isPresent());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public void testSingleEvent(WatchEvent.Kind kind,\n                                String originalPathURI,\n                                String newPathURI,\n                                String sessionId,\n                                String userId,\n                                String commitMessage) throws Exception {\n        WatchKey watchKey = mock(WatchKey.class);\n        Filter<WatchEvent<?>> filter = mock(Filter.class);\n\n        List<WatchEvent<?>> events = new ArrayList<>();\n        events.add(mockWatchEvent(kind,\n                                  originalPathURI,\n                                  newPathURI,\n                                  sessionId,\n                                  userId,\n                                  commitMessage));\n        when(watchKey.pollEvents()).thenReturn(events);\n        when(filter.doFilter(any(WatchEvent.class))).thenReturn(false);\n\n        watchServiceExecutor.execute(watchKey,\n                                     filter);\n\n        if (kind == StandardWatchEventKind.ENTRY_MODIFY) {\n            verifyResourceUpdatedEvent(originalPathURI,\n                                       sessionId,\n                                       userId,\n                                       commitMessage);\n        } else if (kind == StandardWatchEventKind.ENTRY_DELETE) {\n            verifyResourceDeletedEvent(originalPathURI,\n                                       sessionId,\n                                       userId,\n                                       commitMessage);\n        } else if (kind == StandardWatchEventKind.ENTRY_CREATE) {\n            verifyResourceAddedEvent(newPathURI,\n                                     sessionId,\n                                     userId,\n                                     commitMessage);\n        } else {\n            verifyResourceRenamedEvent(originalPathURI,\n                                       newPathURI,\n                                       sessionId,\n                                       userId,\n                                       commitMessage);\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private WatchEvent<?> mockWatchEvent(WatchEvent.Kind kind,\n                                         String originalPathURI,\n                                         String newPathURI,\n                                         String sessionId,\n                                         String userId,\n                                         String commitMessage) throws URISyntaxException {\n        WatchEvent<?> event = mock(WatchEvent.class);\n        when(event.kind()).thenReturn(kind);\n\n        FileSystem fileSystem = mock(FileSystem.class);\n        Set<String> supportedViews = new HashSet<>();\n        when(fileSystem.supportedFileAttributeViews()).thenReturn(supportedViews);\n\n        WatchContext context = mock(WatchContext.class);\n        when(context.getSessionId()).thenReturn(sessionId);\n        when(context.getUser()).thenReturn(userId);\n        when(context.getMessage()).thenReturn(commitMessage);\n\n        Path oldPath = mock(Path.class);\n        URI oldPathUri = new URI(originalPathURI);\n        when(oldPath.toUri()).thenReturn(oldPathUri);\n        when(oldPath.getFileSystem()).thenReturn(fileSystem);\n\n        Path path = mock(Path.class);\n        URI pathUri = new URI(newPathURI);\n        when(path.toUri()).thenReturn(pathUri);\n        when(path.getFileSystem()).thenReturn(fileSystem);\n\n        when(context.getOldPath()).thenReturn(oldPath);\n        when(context.getPath()).thenReturn(path);\n        when(event.context()).thenReturn(context);\n        return event;\n    }\n\n    private void verifyResourceUpdatedEvent(String file,\n                                            String sessionId,\n                                            String userId,\n                                            String commitMessage) {\n        verify(resourceUpdatedEvent,\n               times(1)).fire(resourceUpdatedEventCaptor.capture());\n\n        assertEquals(file,\n                     resourceUpdatedEventCaptor.getValue().getPath().toURI());\n        assertEquals(sessionId,\n                     resourceUpdatedEventCaptor.getValue().getSessionInfo().getId());\n        assertEquals(userId,\n                     resourceUpdatedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier());\n        assertEquals(commitMessage,\n                     resourceUpdatedEventCaptor.getValue().getMessage());\n    }\n\n    private void verifyResourceDeletedEvent(String file,\n                                            String sessionId,\n                                            String userId,\n                                            String commitMessage) {\n        verify(resourceDeletedEvent,\n               times(1)).fire(resourceDeletedEventCaptor.capture());\n\n        assertEquals(file,\n                     resourceDeletedEventCaptor.getValue().getPath().toURI());\n        assertEquals(sessionId,\n                     resourceDeletedEventCaptor.getValue().getSessionInfo().getId());\n        assertEquals(userId,\n                     resourceDeletedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier());\n        assertEquals(commitMessage,\n                     resourceDeletedEventCaptor.getValue().getMessage());\n    }\n\n    private void verifyResourceAddedEvent(String file,\n                                          String sessionId,\n                                          String userId,\n                                          String commitMessage) {\n        verify(resourceAddedEvent,\n               times(1)).fire(resourceAddedEventCaptor.capture());\n\n        assertEquals(file,\n                     resourceAddedEventCaptor.getValue().getPath().toURI());\n        assertEquals(sessionId,\n                     resourceAddedEventCaptor.getValue().getSessionInfo().getId());\n        assertEquals(userId,\n                     resourceAddedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier());\n        assertEquals(commitMessage,\n                     resourceAddedEventCaptor.getValue().getMessage());\n    }\n\n    private void verifyResourceRenamedEvent(String file,\n                                            String destinationFile,\n                                            String sessionId,\n                                            String userId,\n                                            String commitMessage) {\n        verify(resourceRenamedEvent,\n               times(1)).fire(resourceRenamedEventCaptor.capture());\n\n        assertEquals(file,\n                     resourceRenamedEventCaptor.getValue().getPath().toURI());\n        assertEquals(destinationFile,\n                     resourceRenamedEventCaptor.getValue().getDestinationPath().toURI());\n        assertEquals(sessionId,\n                     resourceRenamedEventCaptor.getValue().getSessionInfo().getId());\n        assertEquals(userId,\n                     resourceRenamedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier());\n        assertEquals(commitMessage,\n                     resourceRenamedEventCaptor.getValue().getMessage());\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/PluginServiceTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins;\n\nimport javax.servlet.ServletContext;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.plugins.engine.PluginManager;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginServiceTest {\n\n    @Mock\n    PluginManager pluginManager;\n\n    PluginService pluginService;\n\n    @Test\n    public void initTest() {\n        String path = \"/home/dorinha/\";\n        pluginService = createPluginsService(path);\n\n        pluginService.init(mock(ServletContext.class));\n\n        verify(pluginManager).init(path,\n                                   path);\n    }\n\n    @Test\n    public void initTestNullDirs() {\n        String path = null;\n        pluginService = createPluginsService(path);\n\n        pluginService.init(mock(ServletContext.class));\n\n        verify(pluginManager,\n               never()).init(anyString(),\n                             anyString());\n    }\n\n    private PluginService createPluginsService(final String validPath) {\n        return new PluginService(pluginManager) {\n            @Override\n            String getPlugins(ServletContext servletContext,\n                              String plugins) {\n                return validPath;\n            }\n\n            @Override\n            String getContextRootDir(ServletContext servletContext) {\n                return validPath;\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/engine/AbstractPluginsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.io.File;\n\nimport org.junit.Before;\n\nimport static org.junit.Assert.*;\n\npublic abstract class AbstractPluginsTest {\n\n    protected String contextRootDir;\n    protected String pluginDir;\n    protected String pluginDeploymentDir;\n\n    @Before\n    public void setup() {\n        try {\n            contextRootDir = new File(getClass().getClassLoader().getResource(\"test-app\").getFile()).getParentFile().getAbsolutePath();\n            pluginDir = new File(getClass().getClassLoader().getResource(\"plugins\").getFile()).getAbsolutePath();\n            pluginDeploymentDir = new File(getClass().getClassLoader().getResource(\"test-app/test-app.nocache.js\").getFile()).getParentFile().getAbsolutePath();\n        } catch (Exception e) {\n            e.printStackTrace();\n            fail(\"Test files not found. Make sure the required files are on the classpath.\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/engine/PluginJarProcessorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.io.File;\nimport java.nio.file.Path;\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.plugin.PluginProcessor;\nimport org.uberfire.backend.server.plugins.processors.GWTScriptPluginProcessor;\nimport org.uberfire.backend.server.plugins.processors.HTMLPluginProcessor;\nimport org.uberfire.backend.server.plugins.processors.UFJSPluginProcessor;\nimport org.uberfire.workbench.events.PluginReloadedEvent;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginJarProcessorTest extends AbstractPluginsTest {\n\n    @Mock\n    Instance<PluginProcessor> pluginProcessors;\n    PluginJarProcessor pluginJarProcessor;\n    @Mock\n    private Event<PluginReloadedEvent> pluginsReloadedEvent;\n    @Mock\n    private GWTScriptPluginProcessor gwtScriptPluginProcessor;\n    @Mock\n    private HTMLPluginProcessor htmlPluginProcessor;\n    @Mock\n    private UFJSPluginProcessor ufjsPluginProcessor;\n\n    @Before\n    public void setup() {\n        super.setup();\n        List<PluginProcessor> pluginProcessorsList = Arrays.asList(gwtScriptPluginProcessor,\n                                                                   htmlPluginProcessor,\n                                                                   ufjsPluginProcessor);\n        when(this.pluginProcessors.iterator()).thenReturn(pluginProcessorsList.iterator());\n        pluginJarProcessor = spy(new PluginJarProcessor(pluginProcessors,\n                                                        pluginsReloadedEvent) {\n            @Override\n            List<String> extractFilesFromPluginsJar(String jarFileName) {\n                return Arrays.asList(\"dora.html\",\n                                     \"dora.txt\");\n            }\n        });\n    }\n\n    @Test\n    public void initLoadsDeployedPlugins() throws Exception {\n        pluginJarProcessor.init(pluginDir,\n                                pluginDeploymentDir);\n        verify(pluginJarProcessor).loadPlugins();\n    }\n\n    @Test\n    public void reloadClearsPluginRegistry() throws Exception {\n        pluginJarProcessor.init(pluginDir,\n                                pluginDeploymentDir);\n        pluginJarProcessor.reload();\n\n        verify(pluginJarProcessor,\n               times(2)).removeAllPlugins();\n    }\n\n    @Test\n    public void reloadFiresPluginsReloadedEvent() throws Exception {\n        pluginJarProcessor.init(pluginDir,\n                                pluginDeploymentDir);\n        pluginJarProcessor.reload();\n\n        verify(pluginsReloadedEvent).fire(any(PluginReloadedEvent.class));\n    }\n\n    @Test\n    public void loadPlugins() throws Exception {\n        Path path = mock(Path.class);\n        when(path.toFile()).thenReturn(mock(File.class));\n\n        when(htmlPluginProcessor.shouldProcess(\"dora.html\")).thenReturn(true);\n\n        pluginJarProcessor.loadPlugins(path,\n                                       true);\n\n        verify(htmlPluginProcessor,\n               times(1)).process(eq(\"dora.html\"),\n                                 any(),\n                                 eq(true));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/engine/PluginManagerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.util.concurrent.ExecutorService;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginManagerTest extends AbstractPluginsTest {\n\n    @Mock\n    private PluginWatcher pluginWatcher;\n\n    @Mock\n    private PluginJarProcessor pluginJarProcessor;\n\n    @InjectMocks\n    private PluginManager manager;\n\n    @Test\n    public void initPluginLoader() throws Exception {\n        manager.init(contextRootDir,\n                     pluginDir);\n        verify(pluginJarProcessor,\n               times(1)).init(eq(pluginDir),\n                              eq(pluginDeploymentDir));\n    }\n\n    @Test\n    public void initStartsWatcher() throws Exception {\n        manager.init(contextRootDir,\n                     pluginDir);\n        verify(pluginWatcher,\n               times(1)).start(eq(pluginDir),\n                               any(ExecutorService.class),\n                               eq(pluginJarProcessor));\n    }\n\n    @Test\n    public void shutdownStopsWatcher() throws Exception {\n        manager.shutDown();\n        verify(pluginWatcher,\n               times(1)).stop();\n    }\n\n    @Test\n    public void findPluginDeploymentDir() throws Exception {\n        PluginManager managerSpy = spy(manager);\n        final String pluginDeploymentDir = managerSpy.findPluginDeploymentDir(contextRootDir);\n        verify(managerSpy).encodePath(contextRootDir);\n        assertEquals(this.pluginDeploymentDir,\n                     pluginDeploymentDir);\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/engine/PluginWatcherTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.plugins.engine;\n\nimport java.nio.file.Path;\nimport java.util.concurrent.ExecutorService;\n\nimport org.junit.After;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginWatcherTest extends AbstractPluginsTest {\n\n    @Spy\n    private PluginWatcher pluginWatcher;\n\n    @Mock\n    private PluginJarProcessor pluginJarProcessor;\n\n    @Mock\n    private ExecutorService executor;\n\n    @Mock\n    private Path plugin;\n\n    @Mock\n    private Path fileName;\n\n    @After\n    public void tearDown() {\n        pluginWatcher.stop();\n    }\n\n    @Test\n    public void startSubmitsWatcherThread() throws Exception {\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n        verify(executor,\n               times(1)).submit(any(Runnable.class));\n    }\n\n    @Test\n    public void startDoesNotSubmitWatcherThreadIfPluginDirDoesNotExist() throws Exception {\n        pluginWatcher.start(pluginDir + \"invalid\",\n                            executor,\n                            pluginJarProcessor);\n        verify(executor,\n               never()).submit(any(Runnable.class));\n    }\n\n    @Test\n    public void startOnlyOnce() throws Exception {\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n        verify(executor,\n               times(1)).submit(any(Runnable.class));\n    }\n\n    @Test\n    public void stopEndsWatcherThread() throws Exception {\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n        assertTrue(pluginWatcher.active);\n        pluginWatcher.stop();\n        assertFalse(pluginWatcher.active);\n        verify(executor,\n               times(1)).shutdown();\n    }\n\n    @Test\n    public void loadPluginLogsError() throws Exception {\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n\n        when(fileName.toString()).thenReturn(\"fileName.jar\");\n        when(plugin.getFileName()).thenReturn(fileName);\n\n        Exception e = new RuntimeException();\n        doThrow(e).when(pluginJarProcessor).loadPlugins(any(Path.class),\n                                                        any(Boolean.class));\n        pluginWatcher.loadPlugins(plugin);\n        verify(pluginWatcher,\n               times(1)).logPluginsWatcherError(\"Failed to process new plugin fileName.jar\",\n                                                e,\n                                                false);\n\n        pluginWatcher.stop();\n        pluginWatcher.loadPlugins(plugin);\n        verify(pluginWatcher,\n               times(1)).logPluginsWatcherError(\"Failed to process new plugin fileName.jar\",\n                                                e,\n                                                true);\n    }\n\n    @Test\n    public void reloadPluginsLogsError() throws Exception {\n        pluginWatcher.start(pluginDir,\n                            executor,\n                            pluginJarProcessor);\n\n        when(fileName.toString()).thenReturn(\"fileName.js\");\n        when(plugin.getFileName()).thenReturn(fileName);\n\n        Exception e = new RuntimeException();\n        doThrow(e).when(pluginJarProcessor).reload();\n        pluginWatcher.reloadPlugins(plugin);\n        verify(pluginWatcher,\n               times(1)).logPluginsWatcherError(\"Failed to delete plugin fileName.js\",\n                                                e,\n                                                false);\n\n        pluginWatcher.stop();\n        pluginWatcher.reloadPlugins(plugin);\n        verify(pluginWatcher,\n               times(1)).logPluginsWatcherError(\"Failed to delete plugin fileName.js\",\n                                                e,\n                                                true);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/processors/GWTScriptPluginProcessorTest.java",
    "content": "package org.uberfire.backend.server.plugins.processors;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.cdi.server.scripts.ScriptRegistry;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.plugins.engine.AbstractPluginsTest;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GWTScriptPluginProcessorTest extends AbstractPluginsTest {\n\n    GWTScriptPluginProcessor processor;\n    @Mock\n    private ScriptRegistry scriptRegistry;\n    @Mock\n    private Event<PluginAddedEvent> pluginAddedEvent;\n    @Mock\n    private Event<PluginUpdatedEvent> pluginUpdatedEvent;\n\n    @Before\n    public void setup() {\n        super.setup();\n        processor = new GWTScriptPluginProcessor(scriptRegistry,\n                                                 pluginAddedEvent,\n                                                 pluginUpdatedEvent);\n    }\n\n    @Test\n    public void processTest() {\n        assertFalse(processor.isRegistered(\"test-app.nocache.js\"));\n        processor.process(\"test-app.nocache.js\",\n                          pluginDeploymentDir,\n                          true);\n\n        assertTrue(processor.isRegistered(\"test-app.nocache.js\"));\n        verify(scriptRegistry,\n               times(1)).addScript(eq(\"UF\"),\n                                   anyString());\n        verify(pluginAddedEvent,\n               times(1)).fire(any());\n\n        processor.process(\"test-app.nocache.js\",\n                          pluginDeploymentDir,\n                          true);\n        verify(pluginUpdatedEvent,\n               times(1)).fire(any());\n    }\n\n    @Test\n    public void shutDownShouldRemoveScripts() throws Exception {\n        processor.shutDown();\n        verify(scriptRegistry,\n               times(1)).removeScripts(\"UF\");\n    }\n\n    @Test\n    public void removeAllShouldClearPluginsAndScriptRegistry() throws Exception {\n        processor.availablePlugins.add(\"test\");\n        assertFalse(processor.availablePlugins.isEmpty());\n\n        processor.removeAll();\n        verify(scriptRegistry,\n               times(1)).removeScripts(\"UF\");\n\n        assertTrue(processor.availablePlugins.isEmpty());\n    }\n\n    @Test\n    public void shouldProcessTest() throws Exception {\n\n        assertFalse(processor.shouldProcess(\"pluginname.html\"));\n        assertTrue(processor.shouldProcess(\"pluginname.nocache.js\"));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/processors/HTMLPluginProcessorTest.java",
    "content": "package org.uberfire.backend.server.plugins.processors;\n\nimport java.io.IOException;\nimport javax.enterprise.event.Event;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.plugins.engine.AbstractPluginsTest;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HTMLPluginProcessorTest extends AbstractPluginsTest {\n\n    @Mock\n    private Event<PluginAddedEvent> pluginAddedEvent;\n\n    @Mock\n    private Event<PluginUpdatedEvent> pluginUpdatedEvent;\n\n    private HTMLPluginProcessor processor;\n\n    public void setup() {\n        processor = new HTMLPluginProcessor(pluginAddedEvent,\n                                            pluginUpdatedEvent) {\n            @Override\n            String getPluginContent(String pluginName,\n                                    String pluginDeploymentDir) throws IOException {\n                return \"mock\";\n            }\n        };\n    }\n\n    @Test\n    public void processTest() {\n\n        assertFalse(processor.isRegistered(\"dora.html\"));\n        processor.process(\"dora.html\",\n                          pluginDeploymentDir,\n                          true);\n\n        assertTrue(processor.isRegistered(\"dora.html\"));\n        verify(pluginAddedEvent,\n               times(1)).fire(any());\n\n        processor.process(\"dora.html\",\n                          pluginDeploymentDir,\n                          true);\n        verify(pluginUpdatedEvent,\n               times(1)).fire(any());\n\n        assertTrue(processor.lookupForTemplate(\"dora.html\").isPresent());\n    }\n\n    @Test\n    public void shouldProcessTest() throws Exception {\n\n        assertFalse(processor.shouldProcess(\"pluginname.nocache.js\"));\n        assertTrue(processor.shouldProcess(\"pluginname.html\"));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/plugins/processors/UFJSPluginProcessorTest.java",
    "content": "package org.uberfire.backend.server.plugins.processors;\n\nimport java.io.IOException;\nimport javax.enterprise.event.Event;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.plugins.engine.AbstractPluginsTest;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UFJSPluginProcessorTest extends AbstractPluginsTest {\n\n    @Mock\n    private Event<PluginAddedEvent> pluginAddedEvent;\n\n    @Mock\n    private Event<PluginUpdatedEvent> pluginUpdatedEvent;\n\n    private UFJSPluginProcessor processor;\n\n    public void setup() {\n        processor = new UFJSPluginProcessor(pluginAddedEvent,\n                                            pluginUpdatedEvent) {\n            @Override\n            String getPluginContent(String pluginName,\n                                    String pluginDeploymentDir) throws IOException {\n                return \"mock\";\n            }\n        };\n    }\n\n    @Test\n    public void shouldProcessTest() throws Exception {\n\n        assertTrue(processor.shouldProcess(\"pluginname.js\"));\n        assertFalse(processor.shouldProcess(\"pluginname.nocache.js\"));\n        assertFalse(processor.shouldProcess(\"pluginname.html\"));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/ElytronAuthenticationServiceTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\n\npublic class ElytronAuthenticationServiceTest {\n\n    private ElytronAuthenticationService tested;\n    private ElytronIdentityHelper elytronIdentityHelper;\n\n    @Before\n    public void setup() {\n        elytronIdentityHelper = mock(ElytronIdentityHelper.class);\n\n        tested = new ElytronAuthenticationService(elytronIdentityHelper);\n    }\n\n    @Test\n    public void testNoLogin() throws Exception {\n        assertEquals(User.ANONYMOUS,\n                     tested.getUser());\n    }\n\n    @Test\n    public void testGetAnonymous() throws Exception {\n        assertFalse(tested.isLoggedIn());\n    }\n\n    @Test\n    public void testLogin() throws Exception {\n        final String username = \"user1\";\n        final String password = \"password1\";\n\n        assertFalse(tested.isLoggedIn());\n\n        final User mock = mock(User.class);\n        doReturn(mock).when(elytronIdentityHelper).getIdentity(username, password);\n\n        assertEquals(mock, tested.login(username,\n                                        password));\n\n        assertEquals(mock, tested.getUser());\n\n        assertTrue(tested.isLoggedIn());\n\n        tested.logout();\n\n        assertFalse(tested.isLoggedIn());\n    }\n\n    @Test(expected = FailedAuthenticationException.class)\n    public void testLoginFailure() throws Exception {\n        tested = new ElytronAuthenticationService(elytronIdentityHelper);\n\n        final String username = \"user1\";\n        final String password = \"wrong pass\";\n\n        doThrow(new FailedAuthenticationException()).when(elytronIdentityHelper).getIdentity(username, password);\n\n        tested.login(username,\n                     password);\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/FileSystemResourceAdaptorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.net.URI;\nimport java.util.Arrays;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class FileSystemResourceAdaptorTest {\n\n    @Test\n    public void testFileSystemToCheckProxyIssuesWithExtraInterfaces() {\n        final FileSystem mockedFS = mock(FileSystem.class);\n        final FileSystem mockedFSId = mock(FileSystem.class,\n                                           withSettings().extraInterfaces(FileSystemId.class));\n\n        final Path rootPath = mock(Path.class);\n\n        when(mockedFS.getRootDirectories()).thenReturn(Arrays.asList(rootPath));\n        when(mockedFSId.getRootDirectories()).thenReturn(Arrays.asList(rootPath));\n\n        when(rootPath.getFileSystem()).thenReturn(mockedFSId);\n        when(rootPath.toUri()).thenReturn(URI.create(\"jgit://myrepo\"));\n\n        when(((FileSystemId) mockedFSId).id()).thenReturn(\"my-fsid\");\n\n        {\n            FileSystemMetadata fileSystemInfo = new FileSystemMetadata(mockedFSId);\n            final FileSystemResourceAdaptor fileSystemResourceAdaptor = new FileSystemResourceAdaptor(fileSystemInfo);\n            assertEquals(fileSystemInfo,\n                         fileSystemResourceAdaptor.getFileSystemMetadata());\n            assertEquals(\"my-fsid\",\n                         fileSystemResourceAdaptor.getIdentifier());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/IOServiceSecuritySetupTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.security.FileSystemAuthorizer;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultAuthorizationManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport javax.enterprise.inject.Instance;\nimport java.net.URI;\nimport java.util.Optional;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class IOServiceSecuritySetupTest {\n\n    @Mock\n    Instance<AuthenticationService> authenticationManagers;\n\n    AuthorizationManager authorizationManager;\n    RepositoryService repositoryService;\n    SpacesAPI spacesAPI;\n    IOServiceSecuritySetup setupBean;\n\n    @Before\n    public void setup() {\n        // this is the fallback configuration when no @IOSecurityAuth bean is found\n        System.setProperty(\"org.uberfire.io.auth\",\n                MockAuthenticationService.class.getName());\n\n        PermissionManager permissionManager = new DefaultPermissionManager(new DefaultPermissionTypeRegistry());\n        authorizationManager = spy(new DefaultAuthorizationManager(permissionManager));\n        repositoryService = mock(RepositoryService.class);\n        spacesAPI = mock(SpacesAPI.class);\n        setupBean = new IOServiceSecuritySetup();\n        setupBean.authenticationManagers = authenticationManagers;\n        setupBean.authorizationManager = authorizationManager;\n        setupBean.repositoryService = repositoryService;\n        setupBean.spacesAPI = spacesAPI;\n    }\n\n    @After\n    public void teardown() {\n        System.clearProperty(\"org.uberfire.io.auth\");\n    }\n\n    @Test\n    public void testSystemPropertyAuthConfig() throws Exception {\n        when(authenticationManagers.isUnsatisfied()).thenReturn(true);\n\n        setupBean.setup();\n\n        // setup should have initialized the authenticator and authorizer to their defaults\n        MockSecuredFilesystemProvider mockFsp = MockSecuredFilesystemProvider.LATEST_INSTANCE;\n        assertNotNull(mockFsp.authenticator);\n        assertNotNull(mockFsp.authorizer);\n\n        // and they should work :)\n        User user = mockFsp.authenticator.login(\"fake\", \"fake\");\n        assertEquals(MockAuthenticationService.FAKE_USER.getIdentifier(),\n                user.getIdentifier());\n\n        final FileSystem mockfs = mock(FileSystem.class);\n        final FileSystem mockedFSId = mock(FileSystem.class,\n                withSettings().extraInterfaces(FileSystemId.class));\n        final Path rootPath = mock(Path.class);\n        when(rootPath.toUri()).thenReturn(URI.create(\"/\"));\n\n        when(rootPath.getFileSystem()).thenReturn(mockedFSId);\n\n        when(mockfs.getPath(mockfs.getName())).thenReturn(rootPath);\n        Space space = mock(Space.class);\n        when(spacesAPI.resolveSpace(any())).thenReturn(Optional.of(space));\n\n        assertTrue(mockFsp.authorizer.authorize(mockfs,\n                user));\n    }\n\n    @Test\n    public void testCustomAuthenticatorBean() throws Exception {\n\n        // this simulates the existence of a @IOServiceAuth AuthenticationService bean\n        when(authenticationManagers.isUnsatisfied()).thenReturn(false);\n        AuthenticationService mockAuthenticationService = mock(AuthenticationService.class);\n        when(authenticationManagers.get()).thenReturn(mockAuthenticationService);\n\n        setupBean.setup();\n\n        AuthenticationService authenticator = MockSecuredFilesystemProvider.LATEST_INSTANCE.authenticator;\n        authenticator.login(\"fake\", \"fake\");\n\n        // make sure the call went to the one we provided\n        verify(mockAuthenticationService).login(\"fake\",\n                \"fake\");\n    }\n\n    @Test\n    public void testCustomAuthorizerBean() throws Exception {\n        when(authenticationManagers.isUnsatisfied()).thenReturn(true);\n\n        setupBean.setup();\n\n        FileSystemAuthorizer installedAuthorizer = MockSecuredFilesystemProvider.LATEST_INSTANCE.authorizer;\n        AuthenticationService installedAuthenticator = MockSecuredFilesystemProvider.LATEST_INSTANCE.authenticator;\n        FileSystem mockfs = mock(FileSystem.class);\n\n        final FileSystem mockedFSId = mock(FileSystem.class,\n                withSettings().extraInterfaces(FileSystemId.class));\n        final Path rootPath = mock(Path.class);\n        final Repository repository = mock(Repository.class);\n        when(rootPath.toUri()).thenReturn(URI.create(\"/\"));\n        when(rootPath.getFileSystem()).thenReturn(mockedFSId);\n\n        User fileSystemUser = installedAuthenticator.login(\"fake\", \"fake\");\n        when(mockfs.getPath(mockfs.getName())).thenReturn(rootPath);\n        Space space = mock(Space.class);\n        when(spacesAPI.resolveSpace(any())).thenReturn(Optional.of(space));\n        when(repositoryService.getRepositoryFromSpace(any(), any())).thenReturn(repository);\n        installedAuthorizer.authorize(mockfs,\n                fileSystemUser);\n        // make sure the call went to the one we provided\n        verify(authorizationManager).authorize(repository, repository.getContributors(), ResourceAction.READ, fileSystemUser);\n    }\n\n    @Test\n    public void testNonRepositoryAuthorization() throws Exception {\n        when(authenticationManagers.isUnsatisfied()).thenReturn(true);\n\n        setupBean.setup();\n\n        FileSystemAuthorizer installedAuthorizer = MockSecuredFilesystemProvider.LATEST_INSTANCE.authorizer;\n        AuthenticationService installedAuthenticator = MockSecuredFilesystemProvider.LATEST_INSTANCE.authenticator;\n        FileSystem mockfs = mock(FileSystem.class);\n\n        final FileSystem mockedFSId = mock(FileSystem.class,\n                withSettings().extraInterfaces(FileSystemId.class));\n        final Path rootPath = mock(Path.class);\n        final Repository repository = mock(Repository.class);\n        when(rootPath.toUri()).thenReturn(URI.create(\"/\"));\n        when(rootPath.getFileSystem()).thenReturn(mockedFSId);\n\n        User fileSystemUser = installedAuthenticator.login(\"fake\", \"fake\");\n        when(mockfs.getPath(mockfs.getName())).thenReturn(rootPath);\n        Space space = mock(Space.class);\n        when(spacesAPI.resolveSpace(any())).thenReturn(Optional.of(space));\n        when(repositoryService.getRepositoryFromSpace(any(), any())).thenReturn(null);\n        installedAuthorizer.authorize(mockfs,\n                fileSystemUser);\n        // make sure the call went to the one we provided\n        verify(authorizationManager).authorize(any(FileSystemResourceAdaptor.class),\n                any(User.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/JAASAuthenticationServiceTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.security.Principal;\nimport java.security.acl.Group;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport javax.security.auth.Subject;\nimport javax.security.auth.login.LoginContext;\n\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.powermock.core.classloader.annotations.PowerMockIgnore;\nimport org.powermock.core.classloader.annotations.PrepareForTest;\nimport org.powermock.modules.junit4.PowerMockRunner;\nimport org.powermock.reflect.Whitebox;\nimport org.uberfire.backend.server.security.adapter.WebSphereGroupsAdapter;\nimport org.uberfire.security.authz.adapter.GroupsAdapter;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.same;\nimport static org.mockito.Mockito.*;\nimport static org.powermock.api.mockito.PowerMockito.mockStatic;\n\n@RunWith(PowerMockRunner.class)\n@PrepareForTest({JAASAuthenticationService.class})\n@PowerMockIgnore({\"javax.security.*\", \"javax.naming.*\"})\npublic class JAASAuthenticationServiceTest {\n\n    private JAASAuthenticationService tested;\n\n    @Before\n    public void setup() {\n        RoleRegistry.get().clear();\n        RoleRegistry.get().registerRole( \"admin\" );\n        RoleRegistry.get().registerRole( \"role1\" );\n\n        tested = spy( new JAASAuthenticationService( JAASAuthenticationService.DEFAULT_DOMAIN ) );\n    }\n\n    @Test\n    public void testNoLogin() throws Exception {\n        assertEquals( User.ANONYMOUS,\n                      tested.getUser() );\n    }\n\n    @Test\n    public void testGetAnnonymous() throws Exception {\n        assertFalse( tested.isLoggedIn() );\n    }\n\n    @Test\n    public void testLogin() throws Exception {\n        String username = \"user1\";\n        String password = \"password1\";\n\n        Set<Principal> principals = mockPrincipals( \"admin\",\n                                                    \"role1\",\n                                                    \"group1\" );\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        User user = tested.login( username,\n                                  password );\n\n        assertNotNull( user );\n        assertEquals( username,\n                      user.getIdentifier() );\n        assertEquals( 2,\n                      user.getRoles().size() );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"admin\" ) ) );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"role1\" ) ) );\n        assertEquals( 1,\n                      user.getGroups().size() );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"group1\" ) ) );\n    }\n\n    @Test\n    public void testLoginSwitchesClassloaderForJsm() throws Exception {\n        mockStatic( JAASAuthenticationService.class );\n        mockStatic( Thread.class );\n        mockStatic( System.class );\n\n        final ClassLoader tccl = mock( ClassLoader.class );\n        final Thread thread = mock( Thread.class );\n\n        when( Thread.currentThread() ).thenReturn( thread );\n        when( System.getSecurityManager() ).thenReturn( mock( SecurityManager.class ) );\n        when( thread.getContextClassLoader() ).thenReturn( tccl );\n\n        String username = \"user1\";\n        String password = \"password1\";\n        Set<Principal> principals = mockPrincipals( \"admin\",\n                                                    \"role1\",\n                                                    \"group1\" );\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        tested.login( username,\n                      password );\n\n        InOrder inOrder = inOrder( thread );\n        inOrder.verify( thread ).setContextClassLoader( tested.getClass().getClassLoader() );\n        inOrder.verify( thread ).setContextClassLoader( same( tccl ) );\n    }\n\n    @Test\n    public void testLoginNoPrincipal() throws Exception {\n        String username = \"user1\";\n        String password = \"password1\";\n        Subject subject = new Subject();\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        User user = tested.login( username,\n                                  password );\n\n        assertNotNull( user );\n        assertEquals( username,\n                      user.getIdentifier() );\n        assertEquals( 0,\n                      user.getRoles().size() );\n        assertEquals( 0,\n                      user.getGroups().size() );\n    }\n\n    @Test\n    public void testLoginSubjectGroups() throws Exception {\n        String username = \"user1\";\n        String password = \"password1\";\n\n        Set<Principal> principals = mockPrincipals( \"admin\",\n                                                    \"role1\",\n                                                    \"group1\" );\n        Group aclGroup = mock( Group.class );\n        doReturn( JAASAuthenticationService.DEFAULT_ROLE_PRINCIPLE_NAME ).when( aclGroup ).getName();\n        Set<Principal> aclGroups = mockPrincipals( \"g1\",\n                                                   \"g2\" );\n        Enumeration<? extends Principal> aclGroupsEnum = Collections.enumeration( aclGroups );\n        doReturn( aclGroupsEnum ).when( aclGroup ).members();\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        subject.getPrincipals().add( aclGroup );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        User user = tested.login( username,\n                                  password );\n\n        assertNotNull( user );\n        assertEquals( username,\n                      user.getIdentifier() );\n        assertEquals( 2,\n                      user.getRoles().size() );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"admin\" ) ) );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"role1\" ) ) );\n        assertEquals( 3,\n                      user.getGroups().size() );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"group1\" ) ) );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"g1\" ) ) );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"g2\" ) ) );\n    }\n\n    /*\n     * RHBPMS-4609: When LDAP provides the authorized groups on Websphere the groups returned are not filtered to simple name (i.e, group = admin) when accessed from non-web clients such as ssh.  \n     * This test checks that the regex pattern configured as a System property will recognize these unfiltered groups as authorized roles. \n     */\n    @Test\n    public void testLoginSubjectGroupsWithRegexRoleMapper() throws Exception {\n\n        RoleRegistry.get().clear();\n        RoleRegistry.get().registerRole( \"admin\" );\n        RoleRegistry.get().registerRole( \"user\" );\n        RoleRegistry.get().registerRole( \"role1\" );\n\n        System.setProperty( \"org.uberfire.regex.role_mapper\",\n                            \"cn[\\\\ ]*=[\\\\ ]*role\" );\n        JAASAuthenticationService sshClient = spy( new JAASAuthenticationService( JAASAuthenticationService.DEFAULT_DOMAIN ) );\n\n        String username = \"user1\";\n        String password = \"password1\";\n\n        Set<Principal> principals = mockPrincipals( \"ldap\",\n                                                    \"role1\" );\n        Group aclGroup = mock( Group.class );\n        doReturn( JAASAuthenticationService.DEFAULT_ROLE_PRINCIPLE_NAME ).when( aclGroup ).getName();\n        Set<Principal> aclGroups = mockPrincipals( \"g1\",\n                                                   \"g2\" );\n        Enumeration<? extends Principal> aclGroupsEnum = Collections.enumeration( aclGroups );\n        doReturn( aclGroupsEnum ).when( aclGroup ).members();\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        subject.getPrincipals().add( aclGroup );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( sshClient ).createLoginContext( anyString(),\n                                                                       anyString() );\n\n        WebSphereGroupsAdapter wsga = mock( WebSphereGroupsAdapter.class );\n        List<org.jboss.errai.security.shared.api.Group> groups = mockGroups( \"cn=admin,ou=groups,dc=com,dc=example\",\n                                                                             \"cn=user\" );\n        doReturn( groups ).when( wsga ).getGroups( anyString(),\n                                                   anyObject() );\n\n        List<GroupsAdapter> list = new ArrayList<GroupsAdapter>();\n        list.add( wsga );\n        Whitebox.setInternalState( sshClient,\n                                   \"groupsAdapters\",\n                                   list );\n\n        User user = sshClient.login( username,\n                                     password );\n\n        assertNotNull( user );\n        assertEquals( username,\n                      user.getIdentifier() );\n        assertEquals( 3,\n                      user.getRoles().size() );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"admin\" ) ) );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"user\" ) ) );\n        assertTrue( user.getRoles().contains( new RoleImpl( \"role1\" ) ) );\n        assertEquals( 3,\n                      user.getGroups().size() );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"g1\" ) ) );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"g2\" ) ) );\n        assertTrue( user.getGroups().contains( new GroupImpl( \"ldap\" ) ) );\n    }\n\n    @Test\n    public void testLoggedIn() throws Exception {\n        String username = \"user1\";\n        String password = \"password1\";\n\n        Set<Principal> principals = mockPrincipals( \"admin\" );\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        tested.login( username,\n                      password );\n\n        assertTrue( tested.isLoggedIn() );\n    }\n\n    @Test\n    public void testGetUser() throws Exception {\n        String username = \"user1\";\n        String password = \"password1\";\n        RoleRegistry.get().registerRole( \"admin\" );\n        Set<Principal> principals = mockPrincipals( \"admin\" );\n        Subject subject = new Subject();\n        subject.getPrincipals().addAll( principals );\n        LoginContext loginContext = mock( LoginContext.class );\n        when( loginContext.getSubject() ).thenReturn( subject );\n        doReturn( loginContext ).when( tested ).createLoginContext( anyString(),\n                                                                    anyString() );\n\n        User user = tested.login( username,\n                                  password );\n        User user1 = tested.getUser();\n\n        assertEquals( user,\n                      user1 );\n    }\n\n    private Set<Principal> mockPrincipals( String... names ) {\n        Set<Principal> principals = new HashSet<Principal>();\n        for ( String name : names ) {\n            Principal p1 = mock( Principal.class );\n            when( p1.getName() ).thenReturn( name );\n            principals.add( p1 );\n        }\n        return principals;\n    }\n\n    private List<org.jboss.errai.security.shared.api.Group> mockGroups( String... names ) {\n        ArrayList<org.jboss.errai.security.shared.api.Group> groups = new ArrayList<org.jboss.errai.security.shared.api.Group>();\n        for ( String name : names ) {\n            org.jboss.errai.security.shared.api.Group g = mock( org.jboss.errai.security.shared.api.Group.class );\n            when( g.getName() ).thenReturn( name );\n            groups.add( g );\n        }\n        return groups;\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/MockAuthenticationService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\n\npublic class MockAuthenticationService implements AuthenticationService {\n\n    public static final User FAKE_USER = new UserImpl(\"fake\");\n\n    @Override\n    public User login(String username,\n                      String password) {\n        return FAKE_USER;\n    }\n\n    @Override\n    public boolean isLoggedIn() {\n        return true;\n    }\n\n    @Override\n    public void logout() {\n    }\n\n    @Override\n    public User getUser() {\n        return FAKE_USER;\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/MockSecuredFilesystemProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security;\n\nimport java.io.File;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.channels.FileChannel;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ExecutorService;\n\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.channels.AsynchronousFileChannel;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.DirectoryStream.Filter;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.NotLinkException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.PathMatcher;\nimport org.uberfire.java.nio.file.PatternSyntaxException;\nimport org.uberfire.java.nio.file.WatchEvent.Kind;\nimport org.uberfire.java.nio.file.WatchEvent.Modifier;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.security.FileSystemAuthorizer;\nimport org.uberfire.java.nio.security.SSHAuthenticator;\nimport org.uberfire.java.nio.security.SecuredFileSystemProvider;\n\n/**\n * A fake filesystem provider that's registered under\n * src/test/resources/META-INF/services.\n */\npublic class MockSecuredFilesystemProvider implements SecuredFileSystemProvider {\n\n    public static MockSecuredFilesystemProvider LATEST_INSTANCE;\n\n    public boolean isForcedDefault;\n\n    public AuthenticationService authenticator;\n\n    public FileSystemAuthorizer authorizer;\n\n    public SSHAuthenticator sshAuthenticator;\n\n    public MockSecuredFilesystemProvider() {\n        LATEST_INSTANCE = this;\n    }\n\n    @Override\n    public void forceAsDefault() {\n        isForcedDefault = true;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return false;\n    }\n\n    @Override\n    public String getScheme() {\n        return \"mocksecure\";\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri,\n                                    Map<String, ?> env) throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public Path getPath(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return new MockPath();\n    }\n\n    @Override\n    public FileSystem newFileSystem(Path path,\n                                    Map<String, ?> env) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public InputStream newInputStream(Path path,\n                                      OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, NoSuchFileException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path,\n                                        OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public FileChannel newFileChannel(Path path,\n                                      Set<? extends OpenOption> options,\n                                      FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public AsynchronousFileChannel newAsynchronousFileChannel(Path path,\n                                                              Set<? extends OpenOption> options,\n                                                              ExecutorService executor,\n                                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> options,\n                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir,\n                                                    Filter<Path> filter) throws NotDirectoryException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void createDirectory(Path dir,\n                                FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void createSymbolicLink(Path link,\n                                   Path target,\n                                   FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void createLink(Path link,\n                           Path existing) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void delete(Path path,\n                       DeleteOption... options) throws DirectoryNotEmptyException, NoSuchFileException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... options) throws DirectoryNotEmptyException, IOException, SecurityException {\n        // TODO Auto-generated method stub\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public Path readSymbolicLink(Path link) throws UnsupportedOperationException, NotLinkException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void copy(Path source,\n                     Path target,\n                     CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void move(Path source,\n                     Path target,\n                     CopyOption... options) throws DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public boolean isSameFile(Path path,\n                              Path path2) throws IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public boolean isHidden(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public FileStore getFileStore(Path path) throws IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void checkAccess(Path path,\n                            AccessMode... modes) throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                                Class<V> type,\n                                                                LinkOption... options) throws NoSuchFileException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public <A extends BasicFileAttributes> A readAttributes(Path path,\n                                                            Class<A> type,\n                                                            LinkOption... options) throws NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path,\n                                              String attributes,\n                                              LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void setAttribute(Path path,\n                             String attribute,\n                             Object value,\n                             LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void setJAASAuthenticator(AuthenticationService authenticator) {\n        this.authenticator = authenticator;\n    }\n\n    @Override\n    public void setHTTPAuthenticator(AuthenticationService authenticator) {\n\n    }\n\n    @Override\n    public void setAuthorizer(FileSystemAuthorizer authorizer) {\n        this.authorizer = authorizer;\n    }\n\n    @Override\n    public void setSSHAuthenticator(SSHAuthenticator authenticator) {\n        this.sshAuthenticator = authenticator;\n    }\n\n    private class MockPath extends AbstractPath {\n\n        public MockPath() {\n            super(new MockFileSystem(),\n                  new File(\"mock\"));\n        }\n\n        @Override\n        public File toFile() throws UnsupportedOperationException {\n            return null;\n        }\n\n        @Override\n        public WatchKey register(WatchService watcher,\n                                 Kind[] events,\n                                 Modifier... modifiers) throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException, IOException, SecurityException {\n            return null;\n        }\n\n        @Override\n        public WatchKey register(WatchService watcher,\n                                 Kind... events) throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException, IOException, SecurityException {\n            return null;\n        }\n\n        @Override\n        protected Path newPath(FileSystem fs,\n                               String substring,\n                               String host,\n                               boolean realPath,\n                               boolean isNormalized) {\n            return null;\n        }\n\n        @Override\n        protected Path newRoot(FileSystem fs,\n                               String substring,\n                               String host,\n                               boolean realPath) {\n            return null;\n        }\n\n        @Override\n        protected RootInfo setupRoot(FileSystem fs,\n                                     String path,\n                                     String host,\n                                     boolean isRoot) {\n            return new RootInfo(0,\n                                true,\n                                true,\n                                new byte[0]);\n        }\n\n        @Override\n        protected String defaultDirectory() {\n            return null;\n        }\n    }\n\n    private class MockFileSystem implements FileSystem {\n\n        @Override\n        public void close() throws IOException {\n        }\n\n        @Override\n        public void dispose() {\n        }\n\n        @Override\n        public FileSystemProvider provider() {\n            return null;\n        }\n\n        @Override\n        public boolean isOpen() {\n            return false;\n        }\n\n        @Override\n        public boolean isReadOnly() {\n            return false;\n        }\n\n        @Override\n        public String getSeparator() {\n            return null;\n        }\n\n        @Override\n        public Iterable<Path> getRootDirectories() {\n            return null;\n        }\n\n        @Override\n        public Iterable<FileStore> getFileStores() {\n            return null;\n        }\n\n        @Override\n        public Set<String> supportedFileAttributeViews() {\n            return null;\n        }\n\n        @Override\n        public Path getPath(String first,\n                            String... more) throws InvalidPathException {\n            return null;\n        }\n\n        @Override\n        public PathMatcher getPathMatcher(String syntaxAndPattern) throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException {\n            return null;\n        }\n\n        @Override\n        public UserPrincipalLookupService getUserPrincipalLookupService() throws UnsupportedOperationException {\n            return null;\n        }\n\n        @Override\n        public WatchService newWatchService() throws UnsupportedOperationException, IOException {\n            return null;\n        }\n\n        @Override\n        public String getName() {\n            return \"name\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/RoleLoaderTest.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.security;\n\nimport java.io.File;\nimport java.net.URL;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.server.WebAppSettings;\n\nimport static org.junit.Assert.*;\n\npublic class RoleLoaderTest {\n\n    @Before\n    public void setUp() {\n        URL fileURL = Thread.currentThread().getContextClassLoader().getResource(\"WEB-INF/classes/security-policy.properties\");\n        String homeDir = new File(fileURL.getPath()).getParentFile().getParentFile().getParent();\n        WebAppSettings.get().setRootDir(homeDir);\n        RoleRegistry.get().clear();\n        RoleLoader roleLoader = new RoleLoader();\n        roleLoader.registerRolesFromwWebXml();\n    }\n\n    @Test\n    public void testLoad() {\n        Set<Role> roles = RoleRegistry.get().getRegisteredRoles();\n        assertEquals(roles.size(),\n                     2);\n        assertNotNull(RoleRegistry.get().getRegisteredRole(\"role1\"));\n        assertNotNull(RoleRegistry.get().getRegisteredRole(\"role2\"));\n        assertNull(RoleRegistry.get().getRegisteredRole(\"empty\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/adapter/GroupAdapterAuthorizationSourceTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.adapter;\n\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.TimeUnit;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertTrue;\n\npublic class GroupAdapterAuthorizationSourceTest {\n\n    GroupAdapterAuthorizationSource adapter = new GroupAdapterAuthorizationSource();\n\n    @Test\n    public void testConcurrency() throws Exception {\n        final ExecutorService service = Executors.newFixedThreadPool(4);\n        final CountDownLatch latch = new CountDownLatch(12);\n        for (int i = 0; i < 12; i++) {\n            service.submit(() -> {\n                try {\n                    adapter.collectEntitiesFromAdapters(null,\n                                                        null);\n                    latch.countDown();\n                } catch (Exception ex){\n                    ex.printStackTrace();\n                }\n            });\n        }\n        service.shutdown();\n        assertTrue(latch.await(3,\n                               TimeUnit.SECONDS));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/elytron/DefaultElytronIdentityHelperTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.elytron;\n\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.wildfly.security.auth.server.RealmUnavailableException;\nimport org.wildfly.security.auth.server.SecurityIdentity;\nimport org.wildfly.security.authz.Roles;\nimport org.wildfly.security.evidence.Evidence;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultElytronIdentityHelperTest {\n\n    private static final String USERNAME = \"user\";\n    private static final String PASSWORD = \"password\";\n\n    private DefaultElytronIdentityHelper helper;\n    private ArrayList<String> roles = new ArrayList<>();\n\n    @Before\n    public void init() {\n        helper = spy(new DefaultElytronIdentityHelper() {\n            @Override\n            protected Iterator<String> login(String userName, Evidence evidence) {\n                return roles.iterator();\n            }\n        });\n    }\n\n    @After\n    public void after() {\n        roles.clear();\n    }\n\n    @Test\n    public void testSuccessfulLogin() throws RealmUnavailableException {\n        roles.add(\"admin\");\n        roles.add(\"rest-all\");\n\n        final User identity = helper.getIdentity(USERNAME, PASSWORD);\n\n        assertEquals(USERNAME, identity.getIdentifier());\n        assertTrue(identity.getRoles().contains(new RoleImpl(\"admin\")));\n        assertTrue(identity.getRoles().contains(new RoleImpl(\"rest-all\")));\n        assertEquals(2, identity.getRoles().size());\n    }\n\n    @Test\n    public void testSuccessfulLoginNoRoles() throws RealmUnavailableException {\n\n        final User identity = helper.getIdentity(USERNAME, PASSWORD);\n\n        assertTrue(identity.getRoles().isEmpty());\n    }\n\n    @Test(expected = FailedAuthenticationException.class)\n    public void testUnSuccessfulLogin() throws RealmUnavailableException {\n\n        doThrow(new RuntimeException(\"whatever error\")).when(helper).login(any(), any());\n\n        helper.getIdentity(USERNAME, PASSWORD);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/security/elytron/ElytronIdentityHelperProducerTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.security.elytron;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.WorkbenchUserManager;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ElytronIdentityHelperProducerTest {\n\n    private static final String USERNAME = \"user\";\n    private static final String PASSWORD = \"password\";\n\n    private ElytronIdentityHelperProducer producer;\n\n    @Before\n    public void init() {\n        producer = new ElytronIdentityHelperProducer();\n    }\n\n    @Test\n    public void testProduce() {\n\n        ElytronIdentityHelper helper = producer.getDefaultElytronIdentityHelper();\n\n        assertNotNull(helper);\n        assertTrue(helper instanceof DefaultElytronIdentityHelper);\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/servlet/ReleaseUserLocksServletTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.servlet;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.VFSLockServiceImpl;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ReleaseUserLocksServletTest {\n\n    @Mock\n    private VFSLockService vfsLockService;\n\n    @InjectMocks\n    private ReleaseUserLocksServlet releaseUserLocksServlet;\n\n    @Test\n    public void releaseUserLocksWhenInvalidSessionTest() {\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n\n        doReturn(null).when(request).getSession();\n\n        releaseUserLocksServlet.doGet(request,\n                                      response);\n\n        verify(vfsLockService, never()).releaseLock(any(Path.class));\n    }\n\n    @Test\n    public void releaseUserLocksWhenNoLockAttributeTest() {\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n        HttpSession session = mock(HttpSession.class);\n\n        doReturn(session).when(request).getSession();\n        doReturn(null).when(session).getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME);\n\n        releaseUserLocksServlet.doGet(request,\n                                      response);\n\n        verify(vfsLockService, never()).releaseLock(any(Path.class));\n    }\n\n    @Test\n    public void releaseUserLocksSuccessTest() {\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n        HttpSession session = mock(HttpSession.class);\n\n        Set<LockInfo> locks = new HashSet<>();\n        locks.add(mock(LockInfo.class));\n\n        doReturn(session).when(request).getSession();\n        doReturn(locks).when(session).getAttribute(VFSLockServiceImpl.LOCK_SESSION_ATTRIBUTE_NAME);\n\n        releaseUserLocksServlet.doGet(request,\n                                      response);\n\n        verify(vfsLockService).releaseLock(any());\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/spaces/SpacesAPIImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.spaces;\n\nimport java.util.Optional;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class SpacesAPIImplTest {\n\n    SpacesAPIImpl spaces;\n\n    @Before\n    public void setup() {\n        spaces = new SpacesAPIImpl();\n    }\n\n    @Test\n    public void resolveFileSystemURITest() {\n\n        assertEquals(\"default://system/system\",\n                     spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                                 SpacesAPI.DEFAULT_SPACE,\n                                                 \"system\").toString());\n    }\n\n    @Test\n    public void resolveSpaceNameTest() throws Exception {\n        Optional<Space> space = spaces.resolveSpace(\"default://main@myteam/mortgages/\");\n\n        assertTrue(space.isPresent());\n        assertEquals(\"myteam\", space.get().getName());\n    }\n\n    @Test\n    public void resolveSpaceNameWhenBranchNameHasSlashesTest() throws Exception {\n        Optional<Space> space = spaces.resolveSpace(\"default://my/main/branch@myteam/mortgages/\");\n\n        assertTrue(space.isPresent());\n        assertEquals(\"myteam\", space.get().getName());\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/util/PathsTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class PathsTest {\n\n    @Test\n    public void getFilePathFromProjectRoot() throws Exception {\n\n        final Path repositoryRoot = getPath(\"file:///spaceName/repositoryName\",\n                                            \"/\");\n        final Path pathToFile = getPath(\"file:///spaceName/repositoryName/org/test/file.txt\",\n                                        \"file.txt\");\n\n        assertEquals(\"org/test/file.txt\",\n                     Paths.removePrefix(pathToFile,\n                                        repositoryRoot));\n    }\n\n    @Test\n    public void getFilePath() throws Exception {\n        final Path repositoryRoot = getPath(\"file:///spaceName/repositoryName/org/test\",\n                                            \"test\");\n        final Path pathToFile = getPath(\"file:///spaceName/repositoryName/org/test/file.txt\",\n                                        \"file.txt\");\n\n        assertEquals(\"file.txt\",\n                     Paths.removePrefix(pathToFile,\n                                        repositoryRoot));\n    }\n\n    @Test\n    public void pathsAreEqual() throws Exception {\n        final Path repositoryRoot = getPath(\"file:///spaceName/repositoryName/org/test\",\n                                            \"test\");\n\n        assertEquals(\"\",\n                     Paths.removePrefix(repositoryRoot,\n                                        repositoryRoot));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void pathIsShorterThanPrefix() throws Exception {\n        final Path repositoryRoot = getPath(\"file:///spaceName/repositoryName/org/test\",\n                                            \"test\");\n        final Path pathToFile = getPath(\"file:///spaceName/repositoryName/org/test/file.txt\",\n                                        \"file.txt\");\n\n        Paths.removePrefix(repositoryRoot,\n                           pathToFile);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void prefixDoesNotMatch() throws Exception {\n        final Path repositoryRoot = getPath(\"file:///spaceName/repositoryName/org/test\",\n                                            \"test\");\n        final Path pathToFile = getPath(\"file:///otherSpace/repositoryName/org/test/file.txt\",\n                                        \"file.txt\");\n\n        Paths.removePrefix(pathToFile,\n                           repositoryRoot);\n    }\n\n    private Path getPath(final String uri,\n                         final String fileName) {\n        final Path path = mock(Path.class);\n\n        when(path.toURI()).thenReturn(uri);\n        when(path.getFileName()).thenReturn(fileName);\n        return path;\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/util/TestPaths.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.util;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class TestPaths {\n\n    @Test\n    public void test() {\n        {\n            final String FILENAME = \"file name.txt\";\n            final org.uberfire.java.nio.file.Path path = org.uberfire.java.nio.file.Paths.get(\"file://reponame/path/to/\").resolve(FILENAME);\n\n            assertEquals(FILENAME,\n                         path.getFileName().toString());\n            assertEquals(FILENAME,\n                         Paths.convert(path).getFileName());\n            assertEquals(FILENAME,\n                         Paths.convert(Paths.convert(path)).getFileName().toString());\n            System.out.println(path.toUri().toString());\n            System.out.println(Paths.convert(path).toURI());\n            System.out.println(Paths.normalizePath(path).toUri().toString());\n        }\n\n        {\n            final String FILENAME = \"file_name.txt\";\n            final org.uberfire.java.nio.file.Path path = org.uberfire.java.nio.file.Paths.get(\"file://reponame/path/to/\").resolve(FILENAME);\n\n            assertEquals(FILENAME,\n                         path.getFileName().toString());\n            assertEquals(FILENAME,\n                         Paths.convert(path).getFileName());\n            assertEquals(FILENAME,\n                         Paths.convert(Paths.convert(path)).getFileName().toString());\n            System.out.println(path.toUri().toString());\n            System.out.println(Paths.convert(path).toURI());\n            System.out.println(Paths.normalizePath(path).toUri().toString());\n        }\n\n        {\n            final String FILENAME = \"file+name.txt\";\n            final org.uberfire.java.nio.file.Path path = org.uberfire.java.nio.file.Paths.get(\"file://reponame/path/to/\").resolve(FILENAME);\n\n            assertEquals(FILENAME,\n                         path.getFileName().toString());\n            assertEquals(FILENAME,\n                         Paths.convert(path).getFileName());\n            assertEquals(FILENAME,\n                         Paths.convert(Paths.convert(path)).getFileName().toString());\n\n            System.out.println(path.toUri().toString());\n            System.out.println(Paths.convert(path).toURI());\n            System.out.println(Paths.normalizePath(path).toUri().toString());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/backend/server/util/gzip/GzipFilterTest.java",
    "content": "package org.uberfire.backend.server.util.gzip;\n\nimport java.io.IOException;\n\nimport javax.servlet.FilterChain;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static javax.ws.rs.core.HttpHeaders.ACCEPT_ENCODING;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.Action.COMPRESS;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.Action.DO_NOT_ACCEPT_GZIP;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.Action.DO_NOT_COMPRESS;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.Action.HALT;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.GZIP;\nimport static org.uberfire.backend.server.util.gzip.GzipFilter.ORG_UBERFIRE_GZIP_ENABLE;\n\npublic class GzipFilterTest {\n\n    @Before\n    public void before() {\n        System.clearProperty(ORG_UBERFIRE_GZIP_ENABLE);\n    }\n\n    @Test\n    public void doFilter_compress() throws IOException, ServletException {\n        final GzipFilter gzipFilter = spy(new GzipFilter());\n        when(gzipFilter.getAction(any())).thenReturn(COMPRESS);\n\n        final FilterChain chain = mock(FilterChain.class);\n        gzipFilter.doFilter(mock(HttpServletRequest.class), mock(HttpServletResponse.class), chain);\n\n        verify(gzipFilter, times(1)).compressAndContinue(any(), any(), any());\n        verify(chain, times(1)).doFilter(any(), any());\n    }\n\n    @Test\n    public void doFilter_doNotCompress() throws IOException, ServletException {\n        final GzipFilter gzipFilter = spy(new GzipFilter());\n        when(gzipFilter.getAction(any())).thenReturn(DO_NOT_COMPRESS);\n\n        final FilterChain chain = mock(FilterChain.class);\n        gzipFilter.doFilter(mock(HttpServletRequest.class), mock(HttpServletResponse.class), chain);\n\n        verify(gzipFilter, never()).compressAndContinue(any(), any(), any());\n        verify(chain, times(1)).doFilter(any(), any());\n    }\n\n    @Test\n    public void doFilter_doNotAcceptGzip() throws IOException, ServletException {\n        final GzipFilter gzipFilter = spy(new GzipFilter());\n        when(gzipFilter.getAction(any())).thenReturn(DO_NOT_ACCEPT_GZIP);\n\n        final FilterChain chain = mock(FilterChain.class);\n        gzipFilter.doFilter(mock(HttpServletRequest.class), mock(HttpServletResponse.class), chain);\n\n        verify(gzipFilter, never()).compressAndContinue(any(), any(), any());\n        verify(chain, times(1)).doFilter(any(), any());\n    }\n\n    @Test\n    public void doFilter_halt() throws IOException, ServletException {\n        final GzipFilter gzipFilter = spy(new GzipFilter());\n        when(gzipFilter.getAction(any())).thenReturn(HALT);\n\n        final FilterChain chain = mock(FilterChain.class);\n        gzipFilter.doFilter(mock(HttpServletRequest.class), mock(HttpServletResponse.class), chain);\n\n        verify(gzipFilter, never()).compressAndContinue(any(), any(), any());\n        verify(chain, never()).doFilter(any(), any());\n    }\n\n    @Test\n    public void getAction_notHttpServletRequest() {\n        final GzipFilter gzipFilter = new GzipFilter();\n        assertEquals(HALT, gzipFilter.getAction(mock(ServletRequest.class)));\n    }\n\n    @Test\n    public void getAction_disableGzipCompressionViaSystemProperty() {\n        final GzipFilter gzipFilter = new GzipFilter();\n\n        System.setProperty(ORG_UBERFIRE_GZIP_ENABLE, \"false\");\n        assertEquals(DO_NOT_COMPRESS, gzipFilter.getAction(mock(HttpServletRequest.class)));\n\n        System.setProperty(ORG_UBERFIRE_GZIP_ENABLE, \"falsy\");\n        assertEquals(DO_NOT_COMPRESS, gzipFilter.getAction(mock(HttpServletRequest.class)));\n    }\n\n    @Test\n    public void getAction_doNotAcceptEncodingGzip() {\n        final GzipFilter gzipFilter = new GzipFilter();\n        final HttpServletRequest mock = mock(HttpServletRequest.class);\n\n        assertEquals(DO_NOT_ACCEPT_GZIP, gzipFilter.getAction(mock));\n\n        when(mock.getHeader(eq(ACCEPT_ENCODING))).thenReturn(\"foo\");\n        assertEquals(DO_NOT_ACCEPT_GZIP, gzipFilter.getAction(mock));\n    }\n\n    @Test\n    public void getAction_acceptEncodingGzip() {\n        final GzipFilter gzipFilter = new GzipFilter();\n\n        final HttpServletRequest mock = mock(HttpServletRequest.class);\n        when(mock.getHeader(eq(ACCEPT_ENCODING))).thenReturn(GZIP);\n\n        assertEquals(COMPRESS, gzipFilter.getAction(mock));\n    }\n}"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/java/org/uberfire/util/TextUtilTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.util;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\nimport junit.framework.TestCase;\nimport org.uberfire.backend.server.util.TextUtil;\n\npublic class TextUtilTest extends TestCase {\n\n    private static final String BASE = \"dUMmY\";\n    String userNameIllegalChars = \"ªº\\\\!|\\\"@·#$%&¬/()=?'¿¡€^`[*+]¨´{}<>,;:_~ .-\";\n    String repoNameIllegalChars = \"ªº\\\\!|\\\"@·#$%&¬/()=?'¿¡€^`[*+]¨´{}<>,;:_~ \";\n    // key: illegal char, value: expected char after normalization\n    Map<Character, Character> additionalIllegal = new HashMap<Character, Character>();\n    private StringBuilder sb = new StringBuilder(BASE);\n\n    @Override\n    protected void setUp() throws Exception {\n        additionalIllegal.put('ñ',\n                              'n');\n        additionalIllegal.put('Ñ',\n                              'N');\n        additionalIllegal.put('ç',\n                              'c');\n        additionalIllegal.put('Ç',\n                              'C');\n        additionalIllegal.put('á',\n                              'a');\n        additionalIllegal.put('à',\n                              'a');\n        additionalIllegal.put('ä',\n                              'a');\n        additionalIllegal.put('Á',\n                              'A');\n        additionalIllegal.put('À',\n                              'A');\n        additionalIllegal.put('Ä',\n                              'A');\n    }\n\n    public void testNormalizeUserName() {\n        for (int i = 0; i < userNameIllegalChars.length(); i++) {\n            int index = 0;\n            assertEquals(BASE,\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              userNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n\n            index = BASE.length() - 3;\n            assertEquals(BASE,\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              userNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n\n            index = BASE.length() - 1;\n            assertEquals(BASE,\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              userNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n        }\n\n        StringBuilder expected = new StringBuilder(BASE);\n        for (Iterator<Map.Entry<Character, Character>> it = additionalIllegal.entrySet().iterator(); it.hasNext(); ) {\n            Map.Entry<Character, Character> entry = it.next();\n\n            int index = 0;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n\n            index = BASE.length() - 3;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n\n            index = BASE.length() - 1;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeUserName(sb.insert(index,\n                                                              entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n        }\n    }\n\n    public void testNormalizeRepositoryName() {\n        for (int i = 0; i < repoNameIllegalChars.length(); i++) {\n            int index = 0;\n            assertEquals(BASE,\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    repoNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n\n            index = BASE.length() - 3;\n            assertEquals(BASE,\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    repoNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n\n            index = BASE.length() - 1;\n            assertEquals(BASE,\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    repoNameIllegalChars.charAt(i)).toString()));\n            sb.deleteCharAt(index);\n        }\n\n        StringBuilder expected = new StringBuilder(BASE);\n        for (Iterator<Map.Entry<Character, Character>> it = additionalIllegal.entrySet().iterator(); it.hasNext(); ) {\n            Map.Entry<Character, Character> entry = it.next();\n\n            int index = 0;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n\n            index = BASE.length() - 3;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n\n            index = BASE.length() - 1;\n            assertEquals(expected.insert(index,\n                                         entry.getValue()).toString(),\n                         TextUtil.normalizeRepositoryName(sb.insert(index,\n                                                                    entry.getKey()).toString()));\n            sb.deleteCharAt(index);\n            expected.deleteCharAt(index);\n        }\n\n        String strInput = \"\";\n        String strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"_{`\";\n        strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \".\";\n        strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"-\";\n        strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"...\";\n        strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"---\";\n        strExpected = \"\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"..d.\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \".d..\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"--d-\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"-d--\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"..d..\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \".-d..\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \".d-..\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"--d--.\";\n        strExpected = \"d\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n\n        strInput = \"d---f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d...f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d----f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d-f\";\n        strExpected = \"d-f\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d.f\";\n        strExpected = \"d.f\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d.-f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d.-.f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d-.-f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d-.f\";\n        strExpected = \"df\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"d..-.-B'.--..+-_--ç-..f\";\n        strExpected = \"dBcf\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n\n        strInput = \"m\\\"y-t@ës#t'.re{p'o-n:a;m,e\";\n        strExpected = \"my-test.repo-name\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \"-m\\\"y-t@ës#t'.re{p'o-n:a;m,e-\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n        strInput = \".m\\\"y-t@ës#t'.re{p'o-n:a;m,e.\";\n        assertEquals(strExpected,\n                     TextUtil.normalizeRepositoryName(strInput));\n    }\n}\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.backend.server.security.MockSecuredFilesystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/invalid/security-policy.properties",
    "content": "# Invalid entries\n\nrole\nrole.=\nrole..home=\n.home=\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/security-policy.properties",
    "content": "# A self contained security policy\n#\n\n# Default\ndefault.home=Home\ndefault.permission.perspective.read=false\n\n# Role \"admin\"\nrole.admin.description=Administrator\nrole.admin.home=Home\nrole.admin.priority=1\nrole.admin.permission.perspective.read=true\nrole.admin.permission.perspective.read.SimplePerspective=false\nrole.admin.permission.filesystem.system.master.*=true\n\n# Role \"user\"\nrole.user.description=End user\nrole.user.home=Home\nrole.user.priority=2\nrole.user.permission.perspective.read=false\nrole.user.permission.perspective.read.HomePerspective=true\nrole.user.permission.perspective.read.SimplePerspective=true\nrole.user.permission.filesystem.system.master.*=false\n\n# Role \"manager\"\nrole.manager.description=Manager\nrole.manager.home=Home\nrole.manager.priority=3\nrole.manager.permission.perspective.read.*=true\nrole.manager.permission.filesystem.system.master.*=false\nrole.manager.permission.repository.read.git://repo1=true\n\n# Group \"group1\"\ngroup.group1.description=group1desc\ngroup.group1.home=Home\ngroup.group1.priority=3\ngroup.group1.permission.perspective.read.*=true\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-module-filesystem.properties",
    "content": "role.admin.permission.filesystem.system.master.*=true\nrole.manager.permission.filesystem.system.master.*=false\nrole.user.permission.filesystem.system.master.*=false\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-module-homes.properties",
    "content": "role.admin.home=Home\nrole.user.home=Home\nrole.manager.home=Home\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-module-perspective.properties",
    "content": "role.admin.permission.perspective.read=true\nrole.admin.permission.perspective.read.SimplePerspective=false\n\nrole.user.permission.perspective.read=false\nrole.user.permission.perspective.read.HomePerspective=true\nrole.user.permission.perspective.read.SimplePerspective=true\n\nrole.manager.permission.perspective.read.*=true\nrole.manager.permission.repository.read.git://repo1=true\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-module-priorities.properties",
    "content": "role.admin.priority=1\nrole.user.priority=2\nrole.manager.priority=3\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-module-roles.properties",
    "content": "role.admin.description=Administrator\nrole.user.description=End user\nrole.manager.description=Manager\n\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/classes/split/security-policy.properties",
    "content": "# Security policy marker file.\n#\n# All the files starting with the \"security-module\" prefix will be loaded and\n# included as part of the global authorization policy.\n#\n\ndefault.home=Home\ndefault.permission.perspective.read=false"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<web-app version=\"2.5\"\n         xmlns=\"http://java.sun.com/xml/ns/javaee\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\">\n\n    <security-role>\n        <description>Role 1</description>\n        <role-name>role1</role-name>\n    </security-role>\n\n    <security-role>\n        <description>Role 2</description>\n        <role-name>role2</role-name>\n    </security-role>\n\n    <security-role>\n        <description>Empty</description>\n        <role-name></role-name>\n    </security-role>\n\n</web-app>\n"
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/plugins/plugin.txt",
    "content": "//do not delete. needed for testing."
  },
  {
    "path": "uberfire-backend/uberfire-backend-server/src/test/resources/test-app/test-app.nocache.js",
    "content": "// do not delete. needed for testing."
  },
  {
    "path": "uberfire-client-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-client-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-client-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Client API</name>\n  <description>UberFire Client API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack-bluebird</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>bluebird</artifactId>\n                  <version>${version.org.webjars.bower.bluebird}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/bluebird</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>copy-bluebird-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/bluebird</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/bluebird/META-INF/resources/webjars/bluebird/${version.org.webjars.bower.bluebird}/js/browser</directory>\n                  <includes>\n                    <include>bluebird.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/DefaultPosition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Default position for WorkbenchParts added to the Workbench. Methods marked with this annotation should take zero\n * arguments and return a {@code Position} indicating the WorkbenchPart's default position.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface DefaultPosition {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/Intercept.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface Intercept {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/Perspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide a PerspectiveDefinition. The method should have zero arguments and return a\n * {@code org.uberfire.client.workbench.model.PerspectiveDefinition}.\n * <p>\n * This annotation should only be used in classes annotated with {@link WorkbenchPerspective}, and it cannot be used in\n * a class that has fields annotated with {@link WorkbenchPanel}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface Perspective {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/SplashBodyHeight.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface SplashBodyHeight {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/SplashFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide a PerspectiveDefinition. The method\n * should have zero arguments and return a\n * {@code org.uberfire.client.workbench.model.PerspectiveDefinition}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface SplashFilter {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchClientEditor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * \n * This annotation works like {@code @WorkbenchEditor}, and should be used for client side only editors.\n * \n * Classes annotated with this are considered WorkbenchParts that perform some\n * \"editor\" function for the specified file-type.\n * <p>\n * At its simplest form the Class should implement\n * {@code com.google.gwt.user.client.ui.IsWidget} (e.g. extend\n * {@code com.google.gwt.user.client.ui.Composite}) and provide a method\n * annotated with {@code @WorkbenchPartTitle}.\n * </p>\n * <p>\n * Developers wishing to separate view from logic (perhaps by implementing the\n * MVP pattern) can further provide a zero-argument method annotated with\n * {@code @WorkbenchPartView} with return type\n * {@code com.google.gwt.user.client.ui.IsWidget}.\n * </p>\n * <p>\n * In this latter case the {@code @WorkbenchEditor} need not implement\n * {@code com.google.gwt.user.client.ui.IsWidget}.\n * </p>\n * <p>\n * WorkbechEditors can receive the following life-cycle calls:\n * <ul>\n * <li>{@code @OnStartup(org.drools.guvnor.vfs.Path)}</li>\n * <li>{@code @OnOpen}</li>\n * <li>{@code @OnFocus}</li>\n * <li>{@code @OnLostFocus}</li>\n * <li>{@code @OnMayClose}</li>\n * <li>{@code @OnClose}</li>\n * </p>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchClientEditor {\n\n    /**\n     * Identifier that should be unique within application.\n     */\n    String identifier();\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchContext {\n\n    String identifier();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchContextId.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchContextId {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\n\n/**\n * Classes annotated with this are considered WorkbenchParts that perform some\n * \"editor\" function for the specified file-type.\n * <p>\n * At its simplest form the Class should implement\n * {@code com.google.gwt.user.client.ui.IsWidget} (e.g. extend\n * {@code com.google.gwt.user.client.ui.Composite}) and provide a method\n * annotated with {@code @WorkbenchPartTitle}.\n * </p>\n * <p>\n * Developers wishing to separate view from logic (perhaps by implementing the\n * MVP pattern) can further provide a zero-argument method annotated with\n * {@code @WorkbenchPartView} with return type\n * {@code com.google.gwt.user.client.ui.IsWidget}.\n * </p>\n * <p>\n * In this latter case the {@code @WorkbenchEditor} need not implement\n * {@code com.google.gwt.user.client.ui.IsWidget}.\n * </p>\n * <p>\n * WorkbechEditors can receive the following life-cycle calls:\n * <ul>\n * <li>{@code @OnStartup(org.drools.guvnor.vfs.Path)}</li>\n * <li>{@code @OnOpen}</li>\n * <li>{@code @OnFocus}</li>\n * <li>{@code @OnLostFocus}</li>\n * <li>{@code @OnMayClose}</li>\n * <li>{@code @OnClose}</li>\n * </p>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchEditor {\n\n    /**\n     * Identifier that should be unique within application.\n     */\n    String identifier();\n\n    /**\n     * Array that defines all supported types of this editor.\n     */\n    Class<? extends ClientResourceType>[] supportedTypes() default {};\n\n    /**\n     * Defines the priority of editor over type resolution, editors with same supported type will be resolved by priority.\n     */\n    int priority() default 0;\n\n    /**\n     * By default, a Workbench Editor will show up in the current active perspective. If this parameter is specified,\n     * this screen will only be shown on the given perspective. An attempt to navigate to this editor when\n     * a different perspective is active will first result in a switch to the owning perspective, then the editor will\n     * be shown in that perspective.\n     */\n    Class<?> owningPerspective() default void.class;\n\n    /**\n     * Defines the preferred height. Preferred means that this Height will be used only if this screen\n     * is the trigger to create a new panel, if panel already exists this information is ignored.\n     */\n    int preferredHeight() default -1;\n\n    /**\n     * Defines the preferred width. Preferred means that this Width will be used only if this screen\n     * is the trigger to create a new panel, if panel already exists this information is ignored.\n     */\n    int preferredWidth() default -1;\n\n    /**\n     * Defines how and if locks are acquired when using this editor. By default, a pessimistic locking\n     * strategy is used, allowing edits by only one user at a time.\n     */\n    LockingStrategy lockingStrategy() default LockingStrategy.FRAMEWORK_PESSIMISTIC;\n\n    /**\n     * Indicates that this screen can be discovered and loaded at runtime.\n     * This is useful when building plugins or extensions where the screen\n     * is part of an external script loaded at runtime, as opposed to being\n     * statically compiled into the main application.\n     */\n    boolean isDynamic() default false;\n\n    /**\n     * Locking strategies define how and if locks are acquired when using editors.\n     */\n    enum LockingStrategy {\n        EDITOR_PROVIDED,\n        // No locks are acquired, editor implementations need their own conflict resolution logic (if desired).\n        FRAMEWORK_PESSIMISTIC // Locks are acquired allowing edits by only one user at a time\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchMenu.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide the Menus for the WorkbenchPart. The\n * method should have zero arguments and return a\n * {@code org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchMenu {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Specifies an UberFire workbench panel within a templated perspective.\n * <p>\n * <h3>Prerequisites</h3>\n * This annotation can only be used within a class annotated with {@link WorkbenchPerspective}, and it must target a\n * field that implements the GWT HasWidgets interface. Further, the class this annotation is used in must not have a\n * method annotated with {@link Perspective}. See {@link WorkbenchPerspective} for details.\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.FIELD})\npublic @interface WorkbenchPanel {\n\n    /**\n     * The Presenter type of the panel. Must be a Dependent-scoped Errai IOC bean which implements\n     * WorkbenchPanelPresenter. The default is SimpleWorkbenchPanelPresenter.\n     */\n    Class<?/* TODO extends WorkbenchPanelPresenter */> panelType() default Void.class;\n\n    /**\n     * Specifies the PlaceRequests that should be used to populate this panel with parts when the containing perspective\n     * is first launched. For panel types that only support a single part (such as StaticWorkbenchPanelPresenter), only\n     * one item should be used here.\n     * <p>\n     * To specify a PlaceRequest with parameters, use standard URL query syntax:\n     * <p>\n     * <pre>\n     *   {@code @WorkbenchPanel(parts = \"MyPlaceID?param1=val1&amp;param2=val2\")}\n     * </pre>\n     * <p>\n     * Special characters can be escaped using URL encoding: for '%' use '%25'; for '&amp;' use '%26'; for '=' use '%3d';\n     * for '?' use '%3f'.\n     */\n    String[] parts();\n\n    /**\n     * Makes this panel the first panel in the generated PerspectiveDefinition object. Some panel presenters may treat\n     * their first child panel specially (for example, by forwarding addPanel requests to it). If no panel within a\n     * perspective is explicitly marked as the default, a randomly selected panel will be first. It is an error to\n     * define more than one default panel in a perspective.\n     */\n    boolean isDefault() default false;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPartTitle.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide a {@code java.lang.String} title for the\n * WorkbenchPart. The method should have zero arguments and return a\n * {@code java.lang.String}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchPartTitle {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPartTitleDecoration.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide a {@code java.lang.String} title for the\n * WorkbenchPart. The method should have zero arguments and return a\n * {@code com.google.gwt.user.client.ui.IsWidget}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchPartTitleDecoration {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPartView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide the view for the WorkbenchPart. The\n * method should have zero arguments and return a\n * {@code com.google.gwt.user.client.ui.IsWidget} or preferably a\n * {@code org.jboss.errai.common.client.api.IsElement}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchPartView {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPerspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n/**\n * Indicates that the target class defines a Perspective in the workbench.\n * <p>\n * There are two options for defining the arrangement of panels and parts within the perspective: either\n * programmatically build a {@link PerspectiveDefinition} object, or declare panel structure and content using Errai UI\n * templates. Note that you cannot mix the two approaches.\n * <p>\n * <h3>Programmatic Perspective Definition</h3>\n * To define the perspective layout programmatically, create a zero-argument method annotated with {@code @Perspective}\n * that returns a {@link PerspectiveDefinition}.\n * <p>\n * <h3>Templated Perspective Definition</h3>\n * To declare perspective layout using templates, make the class an Errai UI templated component, and then add the\n * {@link WorkbenchPanel} annotation to one or more of its {@code @DataField} widgets. This designates them as panel\n * containers and allows you to specify which parts should be added to them when the perspective launches.\n * <p>\n * <h3>Perspective Lifecycle</h3>\n * WorkbenchPerspectives receive the standard set of lifecycle calls for a Workbench component:\n * <ul>\n * <li>{@code @OnStartup}</li>\n * <li>{@code @OnOpen}</li>\n * <li>{@code @OnClose}</li>\n * <li>{@code @OnShutdown}</li>\n * </ul>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchPerspective {\n\n    /**\n     * The place ID to associate with this perspective.\n     * @see PlaceRequest\n     */\n    String identifier();\n\n    /**\n     * Indicates that this perspective should be opened by default when the\n     * workbench first starts. Exactly one perspective in the whole application\n     * should be marked as default.\n     */\n    boolean isDefault() default false;\n\n    /**\n     * If true (the default), every time this perspective is displayed, it\n     * should start fresh with the {@link PerspectiveDefinition} returned by the\n     * method annotated with {@code @Perspective}. If false, the framework will\n     * store the structure of the perspective (panel arrangements and part\n     * placement as modified by the user opening and closing tabs, dragging\n     * parts around, and resizing split panels) on the server individually for\n     * each user, and use that stored definition in preference to the one\n     * returned by the {@code @Perspective} method.\n     */\n    boolean isTransient() default true;\n\n    /**\n     * Indicates that this perspective can be discovered and loaded at runtime.\n     * This is useful when building plugins or extensions where the perspective\n     * is part of an external script loaded at runtime, as opposed to being\n     * statically compiled into the main application.\n     */\n    boolean isDynamic() default false;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchPopup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Classes annotated with this are considered Workbench popups.\n * <p>\n * At its simplest form the Class should extend\n * {@code com.google.gwt.user.client.ui.PopupPanel} and provide a method\n * annotated with {@code @OnOpen}.\n * </p>\n * <p>\n * Developers wishing to separate view from logic (perhaps by implementing the\n * MVP pattern) can further provide a zero-argument method annotated with\n * {@code @WorkbenchPartView} with return type\n * {@code com.google.gwt.user.client.ui.PopupPanel}.\n * </p>\n * <p>\n * In this latter case the {@code @WorkbenchPopup} need not extend\n * {@code com.google.gwt.user.client.ui.PopupPanel}.\n * </p>\n * <p>\n * WorkbechPopups can receive the following life-cycle calls:\n * <ul>\n * <li>{@code @OnOpen}</li>\n * </p>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchPopup {\n\n    String identifier();\n\n    WorkbenchPopupSize size() default WorkbenchPopupSize.MEDIUM;\n\n    enum WorkbenchPopupSize {\n        SMALL,\n        MEDIUM,\n        LARGE\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Classes annotated with this are considered WorkbenchParts that display some form of non-editable (but possibly still\n * interactive) content. If the content is associated with a VFS path, or otherwise represents some sort of document\n * that can be edited and saved, developers should consider using {@code @WorkbenchEditor}.\n * <p>\n * All classes annotated with {@code @WorkbenchScreen} must have a declared or inherited method annotated with\n * {@code @WorkbenchPartTitle}.\n * <p>\n * There are two options for providing the screen's view:\n * <ol>\n * <li>the class implements {@code com.google.gwt.user.client.ui.IsWidget} (often by extending {@code com.google.gwt.user.client.ui.Composite})\n * <li>the class declares or inherits a zero-argument method annotated with {@code @WorkbenchPartView} that returns the\n * {@code com.google.gwt.user.client.ui.IsWidget} or preferably\n * {@code org.jboss.errai.common.client.api.IsElement} that handles the view. In this case the class need not\n * implement {@code com.google.gwt.user.client.ui.IsWidget}.\n * </ol>\n * <p>\n * Developers wishing to separate view from logic via the MVP pattern will choose the second option.\n * <p>\n * WorkbechScreens can receive the following life-cycle calls:\n * <ul>\n * <li>{@code @OnStartup}</li>\n * <li>{@code @OnOpen}</li>\n * <li>{@code @OnFocus}</li>\n * <li>{@code @OnLostFocus}</li>\n * <li>{@code @OnMayClose}</li>\n * <li>{@code @OnClose}</li>\n * <li>{@code @OnShutdown}</li>\n * </ul>\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchScreen {\n\n    /**\n     * Identifier that should be unique within application.\n     */\n    String identifier();\n\n    /**\n     * By default, a Workbench Screen will show up in the current active perspective. If this parameter is specified,\n     * this screen will only be shown on the given perspective. An attempt to navigate to this screen when\n     * a different perspective is active will first result in a switch to the owning perspective, then the screen will\n     * be shown in that perspective.\n     */\n    Class<?> owningPerspective() default void.class;\n\n    /**\n     * Defines the preferred height. Preferred means that this Height will be used only if this screen\n     * is the trigger to create a new panel, if panel already exists this information is ignored.\n     */\n    int preferredHeight() default -1;\n\n    /**\n     * Defines the preferred width. Preferred means that this Width will be used only if this screen\n     * is the trigger to create a new panel, if panel already exists this information is ignored.\n     */\n    int preferredWidth() default -1;\n\n    /**\n     * Indicates that this screen can be discovered and loaded at runtime.\n     * This is useful when building plugins or extensions where the screen\n     * is part of an external script loaded at runtime, as opposed to being\n     * statically compiled into the main application.\n     */\n    boolean isDynamic() default false;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchSplashScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchSplashScreen {\n\n    String identifier();\n\n    boolean isEnabled() default true;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/annotations/WorkbenchToolBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Methods annotated with this provide the Toolbar for the WorkbenchPart. The\n * method should have zero arguments and return a\n * {@code org.uberfire.client.workbench.widgets.toolbar.ToolBar}.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.METHOD})\npublic @interface WorkbenchToolBar {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/callbacks/Callback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.callbacks;\n\n/**\n * Generic callback\n */\npublic interface Callback<T> {\n\n    void callback(T result);\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/HasPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.client.mvp;\n\n\n/**\n * Interface to inject a Presenter into a View for MVP-based Element\n * implementations. Due to limitations with CDI it is not possible to {@code @Inject}\n * the correct instance of a Presenter into a View.\n * <p>\n * Developers wishing to implement MVP-based UIs are encouraged to have\n * their View implement this interface if they require access to the appropriate\n * Presenter.\n * @param <T> The Presenter type\n */\npublic interface HasPresenter<T> {\n\n    void init(T presenter);\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/LockRequiredEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\n/**\n * Client-local event to indicate that the currently focused editor needs to request a lock.\n */\npublic class LockRequiredEvent {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/LockTarget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Holds information about the target of a lock.\n */\n@JsType\npublic class LockTarget {\n\n    private final Path path;\n    private final IsWidget isWidget;\n    private final PlaceRequest place;\n    private final TitleProvider titleProvider;\n    private final Runnable reloadRunnable;\n\n    @JsIgnore\n    public LockTarget(Path path,\n                      IsWidget isWidget,\n                      PlaceRequest place,\n                      TitleProvider titleProvider,\n                      Runnable reloadRunnable) {\n\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"isWidget\",\n                     isWidget);\n        checkNotNull(\"place\",\n                     place);\n        checkNotNull(\"titleProvider\",\n                     titleProvider);\n        checkNotNull(\"reloadRunnable\",\n                     reloadRunnable);\n\n        this.path = path;\n        this.isWidget = isWidget;\n        this.place = place;\n        this.titleProvider = titleProvider;\n        this.reloadRunnable = reloadRunnable;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    @JsIgnore\n    public IsWidget getWidget() {\n        return isWidget;\n    }\n\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    public String getTitle() {\n        return titleProvider.getTitle();\n    }\n\n    @JsIgnore\n    public Runnable getReloadRunnable() {\n        return reloadRunnable;\n    }\n\n    @JsType\n    public interface TitleProvider {\n\n        String getTitle();\n    }\n}"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/RenameInProgressEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Client-local event to indicate that a rename command has been executed\n */\npublic class RenameInProgressEvent {\n\n    private final Path path;\n\n    public RenameInProgressEvent(final Path path) {\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/SaveInProgressEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Client-local event to indicate that a save command has been executed\n */\npublic class SaveInProgressEvent {\n\n    private final Path path;\n\n    public SaveInProgressEvent(Path path) {\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/UberElement.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.jboss.errai.common.client.api.IsElement;\n\n/**\n * Interface to inject a Presenter into a View for MVP-based Element\n * implementations. Due to limitations with CDI it is not possible to {@code @Inject}\n * the correct instance of a Presenter into a View.\n * <p>\n * Developers wishing to implement MVP-based Elements are encouraged to have\n * their View implement this interface if they require access to the appropriate\n * Presenter.\n * @param <T> The Presenter type\n * @deprecated Use {@link UberElemental} and elemental2 instead.\n */\n@Deprecated\npublic interface UberElement<T> extends IsElement, HasPresenter<T> {\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/UberElemental.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.client.mvp;\n\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\n\n/**\n * Interface to inject a Presenter into a View for MVP-based Element\n * implementations. Due to limitations with CDI it is not possible to {@code @Inject}\n * the correct instance of a Presenter into a View.\n * <p>\n * Developers wishing to implement MVP-based Elements are encouraged to have\n * their View implement this interface if they require access to the appropriate\n * Presenter.\n * @param <T> The Presenter type\n */\npublic interface UberElemental<T> extends IsElement, HasPresenter<T> {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/UberView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n/**\n * Interface to inject a Presenter into a View for MVP-based Widget\n * implementations. Due to limitations with CDI it is not possible to {@code @Inject}\n * the correct instance of a Presenter into a View.\n * <p>\n * Developers wishing to implement MVP-based Widgets are encouraged to have\n * their View implement this interface if they require access to the appropriate\n * Presenter.\n * @param <T> The Presenter type\n */\npublic interface UberView<T> extends IsWidget, HasPresenter<T> {\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/mvp/UpdatedLockStatusEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Client-local event to inform UI components of a lock status change.\n */\npublic class UpdatedLockStatusEvent {\n\n    private final Path file;\n    private final boolean locked;\n    private final boolean lockedByCurrentUser;\n\n    public UpdatedLockStatusEvent(final Path file,\n                                  final boolean locked,\n                                  final boolean lockedByCurrentUser) {\n        this.file = file;\n        this.locked = locked;\n        this.lockedByCurrentUser = lockedByCurrentUser;\n    }\n\n    public Path getFile() {\n        return file;\n    }\n\n    public boolean isLocked() {\n        return locked;\n    }\n\n    public boolean isLockedByCurrentUser() {\n        return lockedByCurrentUser;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/promise/PromisePolyfillBootstrapper.java",
    "content": "/*\n * Copyright (C) 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.promise;\n\nimport com.google.gwt.core.client.ScriptInjector;\n\nclass PromisePolyfillBootstrapper {\n\n    static void ensurePromiseApiIsAvailable() {\n        if (!isPromiseApiAvailable()) {\n            ScriptInjector.fromString(PromisePolyfillClientBundle.INSTANCE.promisePolyfill().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n        }\n    }\n\n    /**\n     * Checks to see if Promise is already present.\n     * @return true is Promise is loaded, false otherwise.\n     */\n    private static native boolean isPromiseApiAvailable() /*-{\n        return (typeof $wnd['Promise'] !== 'undefined');\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/promise/PromisePolyfillClientBundle.java",
    "content": "/*\n * Copyright (C) 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.promise;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\npublic interface PromisePolyfillClientBundle extends ClientBundle {\n\n    PromisePolyfillClientBundle INSTANCE = GWT.create(PromisePolyfillClientBundle.class);\n\n    @Source(\"org/uberfire/client/views/static/bluebird/bluebird.min.js\")\n    TextResource promisePolyfill();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/promise/Promises.java",
    "content": "/*\n * Copyright (C) 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.promise;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.BiFunction;\nimport java.util.function.BinaryOperator;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\nimport java.util.function.Supplier;\n\nimport static org.uberfire.client.promise.PromisePolyfillBootstrapper.ensurePromiseApiIsAvailable;\n\n@Dependent\npublic class Promises {\n\n    @PostConstruct\n    public void init() {\n        ensurePromiseApiIsAvailable();\n    }\n\n    // Reducers\n\n    /**\n     * Returns a resolved Promise when every Promise in the list is resolved.\n     * If any Promise is rejected, the resulting Promise will be rejected.\n     */\n    @SafeVarargs\n    public final <O> Promise<O> all(final Promise<O>... promises) {\n        return Arrays.stream(promises).reduce(resolve(), (p1, p2) -> p1.then(ignore -> p2));\n    }\n\n    /**\n     * Maps the objects to Promises using the provided function then behaves just like {@link org.uberfire.client.promise.Promises#all}.\n     */\n    public <T, O> Promise<O> all(final List<T> objects, final Function<T, Promise<O>> f) {\n        return objects.stream().map(f).reduce(resolve(), (p1, p2) -> p1.then(ignore -> p2));\n    }\n\n    /**\n     * Reduces a list of promises using the accumulator passed.\n     */\n    public final <O> Promise<O> reduce(final Promise<O> identity,\n                                       final Collection<Promise<O>> promises,\n                                       final BinaryOperator<Promise<O>> accumulator) {\n        return promises.stream().reduce(identity, accumulator);\n    }\n\n    /**\n     * Maps the objects to Promises using the provided function but only execute the Promises when the\n     * previous Promise is resolved. If a rejection occurs in the middle of the chain, the remaining\n     * Promises are not executed and the resulting Promise is rejected.\n     */\n    public <T, O> Promise<O> reduceLazily(final List<T> objects,\n                                          final Function<T, Promise<O>> f) {\n        return objects.stream()\n                .<Supplier<Promise<O>>>\n                        map(o -> () -> f.apply(o))\n                .<Supplier<Promise<O>>>\n                        reduce(this::resolve,\n                               (p1, p2) -> () -> p1.get().then(ignore -> p2.get())\n                )\n                .get();\n    }\n\n    /**\n     * Behaves just like {@link org.uberfire.client.promise.Promises#reduceLazily} but exposes a reference to the Promise chain as a\n     * parameter to the mapping function.\n     */\n    public <T, O> Promise<O> reduceLazilyChaining(final List<T> objects,\n                                                  final BiFunction<Supplier<Promise<O>>, T, Promise<O>> f) {\n\n        return objects.stream()\n                .<Function<Supplier<Promise<O>>, Supplier<Promise<O>>>>\n                        map(o -> next -> () -> f.apply(next, o))\n                .<Function<Supplier<Promise<O>>, Supplier<Promise<O>>>>\n                        reduce(next -> this::resolve,\n                               (p1, p2) -> uberNext -> () -> {\n                                   final Supplier<Promise<O>> next = p2.apply(uberNext);\n                                   final Supplier<Promise<O>> chain = () -> next.get().then(ignore -> uberNext.get());\n                                   return p1.apply(chain).get().then(ignore -> next.get());\n                               }\n                )\n                .apply(this::resolve).get();\n    }\n\n    // Callers\n\n    /**\n     * Promisifies a {@link Caller} remote call. If an exception is thrown inside the call function, the\n     * resulting Promise is rejected with a {@link org.uberfire.client.promise.Promises.Error} instance.\n     */\n    public <T, S> Promise<S> promisify(final Caller<T> caller,\n                                       final Function<T, S> call) {\n\n        return create((resolve, reject) -> call.apply(caller.call(\n                (RemoteCallback<S>) resolve::onInvoke,\n                defaultRpcErrorCallback(reject))));\n    }\n\n    /**\n     * Promisifies a {@link Caller} remote call. If an exception is thrown inside the call function, the\n     * resulting Promise is rejected with a {@link org.uberfire.client.promise.Promises.Error} instance.\n     */\n    public <T, S> Promise<S> promisify(final Caller<T> caller,\n                                       final Consumer<T> call) {\n\n        return create((resolve, reject) -> call.accept(caller.call(\n                (RemoteCallback<S>) resolve::onInvoke,\n                defaultRpcErrorCallback(reject))));\n    }\n\n    private <M> ErrorCallback<M> defaultRpcErrorCallback(final Promise.PromiseExecutorCallbackFn.RejectCallbackFn reject) {\n        return (final M o, final Throwable throwable) -> {\n            reject.onInvoke(new Promises.Error<>(o, throwable));\n            return false;\n        };\n    }\n\n    /**\n     * To be used inside {@link Promise#catch_} blocks. Decides whether to process a RuntimeException that\n     * caused a prior Promise rejection or to process an expected object rejected by a prior Promise. To proceed\n     * with default error handlers, reject the untreated exception inside the catchBlock function.\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <V, T> Promise<T> catchOrExecute(final Object o,\n                                            final Function<RuntimeException, Promise<T>> catchBlock,\n                                            final Function<V, Promise<T>> expectedRejectionHandler) {\n\n        if (o instanceof JavaScriptObject) {\n            // A RuntimeException occurred inside a promise and was transformed in a JavaScriptObject\n            return resolve()\n                    .then(i -> catchBlock.apply(new RuntimeException(\"Client-side exception inside Promise: \" + o.toString())))\n                    .catch_(this::handleCatchBlockExceptions);\n        }\n\n        if (o instanceof RuntimeException) {\n            return resolve()\n                    .then(i -> catchBlock.apply((RuntimeException) o))\n                    .catch_(this::handleCatchBlockExceptions);\n        }\n\n        if (o instanceof Promises.Error) {\n            return resolve()\n                    .then(i -> catchBlock.apply((RuntimeException) ((Error) o).getThrowable()))\n                    .catch_(this::handleCatchBlockExceptions);\n        }\n\n        return expectedRejectionHandler.apply((V) o);\n    }\n\n    private <T> Promise<T> handleCatchBlockExceptions(final Object rejectedObject) {\n\n        if (rejectedObject instanceof Throwable) {\n            GWT.getUncaughtExceptionHandler().onUncaughtException((Throwable) rejectedObject);\n            return resolve();\n        }\n\n        return reject(rejectedObject);\n    }\n\n    public <T> Promise<T> resolve() {\n        return resolve(null);\n    }\n\n    public <T> Promise<T> resolve(final T object) {\n        return create((resolve, reject) -> resolve.onInvoke(object));\n    }\n\n    public <T> Promise<T> reject(final Object object) {\n        return create((resolve, reject) -> reject.onInvoke(object));\n    }\n\n    public <T> Promise<T> create(final Promise.PromiseExecutorCallbackFn<T> executor) {\n        return new Promise<>(executor);\n    }\n\n    public static class Error<T> {\n\n        private final T o;\n\n        private final Throwable throwable;\n\n        private Error(final T o, final Throwable throwable) {\n            this.o = o;\n            this.throwable = throwable;\n        }\n\n        private T getObject() {\n            return o;\n        }\n\n        private Throwable getThrowable() {\n            return throwable;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/resources/UberfireResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport org.uberfire.client.resources.images.UberfireImageResources;\n\npublic interface UberfireResources\n        extends\n        ClientBundle {\n\n    public static final UberfireResources INSTANCE = GWT.create(UberfireResources.class);\n\n    UberfireImageResources images();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/resources/i18n/UberfireConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n *\n */\npublic interface UberfireConstants extends Messages {\n\n    public static final UberfireConstants INSTANCE = GWT.create(UberfireConstants.class);\n\n    public String anyResourceTypeDescription();\n\n    public String dotResourceTypeDescription();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/resources/images/UberfireImageResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.images;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface UberfireImageResources\n        extends\n        ClientBundle {\n\n    @Source(\"BPM_FileIcons_genericfile.png\")\n    ImageResource typeGenericFile();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/util/Clipboard.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport javax.enterprise.context.Dependent;\n\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.HTMLTextAreaElement;\n\n@Dependent\npublic class Clipboard {\n\n    public boolean copy(final HTMLInputElement element) {\n        element.select();\n        return copy();\n    }\n\n    public boolean copy(final HTMLTextAreaElement element) {\n        element.select();\n        return copy();\n    }\n\n    public native boolean copy() /*-{\n        return $doc.execCommand(\"Copy\");\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/util/Cookie.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport javax.enterprise.context.Dependent;\n\nimport elemental2.dom.DomGlobal;\n\n@Dependent\npublic class Cookie {\n\n    public String get() {\n        return DomGlobal.document.cookie;\n    }\n\n    public String get(final String name) {\n        String cookie = \"; \" + get();\n        String[] parts = cookie.split(\"; \" + name + \"=\");\n        if (parts.length == 2) {\n            return parts[1].split(\";\")[0];\n        }\n        return \"\";\n    }\n\n    public void set(final String name,\n                    final String value) {\n        DomGlobal.document.cookie = name + \"=\" + value;\n    }\n\n    public void set(final String name,\n                    final String value,\n                    final int maxAge) {\n        DomGlobal.document.cookie = name + \"=\" + value + \";max-age=\" + maxAge;\n    }\n\n    public void clear(final String name) {\n        set(name, \"\");\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/events/ChangeTitleWidgetEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An event to change the Title Widget of a WorkbenchPart container, e.g. a Tab in a TabPanel\n */\npublic class ChangeTitleWidgetEvent {\n\n    private final PlaceRequest place;\n    private final String title;\n    private final IsWidget titleDecoration;\n\n    public ChangeTitleWidgetEvent(final PlaceRequest place,\n                                  final String title) {\n        this(place,\n             title,\n             null);\n    }\n\n    public ChangeTitleWidgetEvent(final PlaceRequest place,\n                                  final String title,\n                                  final IsWidget titleDecoration) {\n        this.place = place;\n        this.title = title;\n        this.titleDecoration = titleDecoration;\n    }\n\n    public PlaceRequest getPlaceRequest() {\n        return place;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public IsWidget getTitleDecoration() {\n        return titleDecoration;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/events/NewSplashScreenActiveEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\n/**\n * Fired by the framework immediately after the set of active splash screens has changed (new splash screen displayed or\n * an existing one closed). Observers of this event who call into PlaceManager will see the new state with the\n * advertised change already in effect.\n */\npublic class NewSplashScreenActiveEvent {\n\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/ouia/OuiaAttribute.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\n/**\n * Represents any attribute of OUIA specification (https://ouia.readthedocs.io/en/latest/README.html#language)\n */\npublic interface OuiaAttribute {\n\n    /**\n     * @return name of the attribute\n     */\n    String getName();\n\n    /**\n     * @return value of the attribute\n     */\n    String getValue();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/ouia/OuiaComponent.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\nimport java.util.function.Consumer;\n\n/**\n * This represents OUIA compliant components (https://ouia.readthedocs.io/en/latest/README.html#ouia-component)\n * OUIA compliant elements are leveraged by advanced UI testing tools\n */\npublic interface OuiaComponent {\n\n    /**\n     * Initializes OUIA attributes of given element\n     */\n    default void initOuiaComponentAttributes() {\n        ouiaAttributeRenderer().accept(ouiaComponentType());\n        ouiaAttributeRenderer().accept(ouiaComponentId());\n    }\n\n    /**\n     * Returns 'data-ouia-component-type' attribute for given element\n     * @return 'data-ouia-component-type' attribute value\n     */\n    OuiaComponentTypeAttribute ouiaComponentType();\n\n    /**\n     * Returns 'data-ouia-component-id' attribute for given element\n     * @return 'data-ouia-component-id' attribute value\n     */\n    OuiaComponentIdAttribute ouiaComponentId();\n\n    /**\n     * Renderer of any OUIA attribute. Invoking of this renderer should display given attribute in produced html.\n     * @return OUIA attribute renderer\n     */\n    Consumer<OuiaAttribute> ouiaAttributeRenderer();\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/ouia/OuiaComponentIdAttribute.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\nimport java.util.Objects;\n\n/**\n * Implementation of 'data-ouia-component-id' attribute\n * https://ouia.readthedocs.io/en/latest/README.html#ouia-component\n */\npublic class OuiaComponentIdAttribute implements OuiaAttribute {\n\n    public static final String COMPONENT_ID = \"data-ouia-component-id\";\n\n    private String value;\n\n    public OuiaComponentIdAttribute(final String value) {\n        this.value = value;\n    }\n\n    @Override\n    public String getName() {\n        return COMPONENT_ID;\n    }\n\n    @Override\n    public String getValue() {\n        return value;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof OuiaComponentIdAttribute)) {\n            return false;\n        }\n        OuiaComponentIdAttribute that = (OuiaComponentIdAttribute) o;\n        return Objects.equals(value, that.value);\n    }\n\n    @Override\n    public int hashCode() {\n\n        return Objects.hash(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/ouia/OuiaComponentTypeAttribute.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\nimport java.util.Objects;\n\n/**\n * Implementation of 'data-ouia-component-type' attribute\n * https://ouia.readthedocs.io/en/latest/README.html#ouia-component\n */\npublic class OuiaComponentTypeAttribute implements OuiaAttribute {\n\n    public static final String COMPONENT_TYPE = \"data-ouia-component-type\";\n\n    private String value;\n\n    public OuiaComponentTypeAttribute(final String value) {\n        this.value = value;\n    }\n\n    @Override\n    public String getName() {\n        return COMPONENT_TYPE;\n    }\n\n    @Override\n    public String getValue() {\n        return value;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof OuiaComponentTypeAttribute)) {\n            return false;\n        }\n        OuiaComponentTypeAttribute that = (OuiaComponentTypeAttribute) o;\n        return Objects.equals(value, that.value);\n    }\n\n    @Override\n    public int hashCode() {\n\n        return Objects.hash(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/type/AnyResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.resources.UberfireResources;\nimport org.uberfire.client.resources.i18n.UberfireConstants;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.AnyResourceTypeDefinition;\n\n@ApplicationScoped\npublic class AnyResourceType\n        extends AnyResourceTypeDefinition\n        implements ClientResourceType {\n\n    private static final Image IMAGE = new Image(UberfireResources.INSTANCE.images().typeGenericFile());\n\n    public AnyResourceType() {\n    }\n\n    @Inject\n    public AnyResourceType(Others others) {\n        super(others);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return IMAGE;\n    }\n\n    @Override\n    public String getDescription() {\n        String desc = UberfireConstants.INSTANCE.anyResourceTypeDescription();\n        if (desc == null || desc.isEmpty()) {\n            return super.getDescription();\n        }\n        return desc;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/type/ClientResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.type;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n/**\n *\n */\n@JsType\npublic interface ClientResourceType extends ResourceTypeDefinition {\n\n    /**\n     * An icon representing the resource type\n     * @return the icon\n     */\n    @JsIgnore\n    default IsWidget getIcon() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/type/ClientTypeRegistry.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.type;\n\nimport java.util.Collection;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface ClientTypeRegistry {\n\n    Collection<ClientResourceType> getRegisteredTypes();\n\n    boolean isEnabled(ClientResourceType resourceType);\n\n    ClientResourceType resolve(final Path path);\n\n    String resolveWildcardPattern(final String shortName);\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/type/DotResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.resources.i18n.UberfireConstants;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.DotResourceTypeDefinition;\n\n@ApplicationScoped\npublic class DotResourceType\n        extends DotResourceTypeDefinition\n        implements ClientResourceType {\n\n    public DotResourceType() {\n    }\n\n    @Inject\n    public DotResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        String desc = UberfireConstants.INSTANCE.dotResourceTypeDescription();\n        if (desc == null || desc.isEmpty()) {\n            return super.getDescription();\n        }\n        return desc;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/java/org/uberfire/client/workbench/type/impl/ClientTypeRegistryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.type.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Comparator;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.ClientTypeRegistry;\n\nimport static java.util.Collections.sort;\nimport static java.util.Collections.unmodifiableList;\n\n@ApplicationScoped\npublic class ClientTypeRegistryImpl implements ClientTypeRegistry {\n\n    protected final SyncBeanManager iocManager;\n    private List<ClientResourceType> localResourceTypes = new ArrayList<ClientResourceType>();\n\n    @Inject\n    public ClientTypeRegistryImpl(final SyncBeanManager iocManager) {\n        this.iocManager = iocManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        final Collection<SyncBeanDef<ClientResourceType>> availableTypes = iocManager.lookupBeans(ClientResourceType.class);\n\n        for (final SyncBeanDef<ClientResourceType> availableType : availableTypes) {\n            localResourceTypes.add(availableType.getInstance());\n        }\n\n        sort(localResourceTypes,\n             new Comparator<ClientResourceType>() {\n                 @Override\n                 public int compare(final ClientResourceType o1,\n                                    final ClientResourceType o2) {\n                     if (o1.getPriority() < o2.getPriority()) {\n                         return 1;\n                     } else if (o1.getPriority() > o2.getPriority()) {\n                         return -1;\n                     } else {\n                         return 0;\n                     }\n                 }\n             });\n    }\n\n    @Override\n    public Collection<ClientResourceType> getRegisteredTypes() {\n        return unmodifiableList(localResourceTypes);\n    }\n\n    @Override\n    public boolean isEnabled(ClientResourceType resourceType) {\n        return localResourceTypes.contains(resourceType);\n    }\n\n    @Override\n    public ClientResourceType resolve(final Path path) {\n        for (final ClientResourceType resourceType : localResourceTypes) {\n            if (resourceType.accept(path)) {\n                return resourceType;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public String resolveWildcardPattern(final String shortName) {\n        for (final ClientResourceType resourceType : localResourceTypes) {\n            if (resourceType.getShortName().equalsIgnoreCase(shortName)) {\n                return resourceType.getSimpleWildcardPattern();\n            }\n        }\n        return shortName;\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/UberfireClientAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nanyResourceTypeDescription=Others\ndotResourceTypeDescription=Dot file\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_de.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author nmirasch\nanyResourceTypeDescription=Andere\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author nmirasch\ndotResourceTypeDescription=Dot-Datei\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_es.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nanyResourceTypeDescription=Otros\ndotResourceTypeDescription=Archivo dot\n\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_fr.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nanyResourceTypeDescription=Autres\ndotResourceTypeDescription=Fichier Dot\n\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_it.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nanyResourceTypeDescription=Altri\ndotResourceTypeDescription=File Dot\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_ja.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nanyResourceTypeDescription=その他\ndotResourceTypeDescription=ドットファイル\n\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_pt_BR.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author ldelima@redhat.com\nanyResourceTypeDescription=Outros\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author ldelima@redhat.com\ndotResourceTypeDescription=Arquivo dot\n"
  },
  {
    "path": "uberfire-client-api/src/main/resources/org/uberfire/client/resources/i18n/UberfireConstants_zh_CN.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author xi.huang\nanyResourceTypeDescription=其他\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-client-api/org/uberfire/client/resources/i18n/UberfireConstants, author xi.huang\ndotResourceTypeDescription=Dot 文件\n"
  },
  {
    "path": "uberfire-client-api/src/test/java/org/uberfire/client/util/CookieTest.java",
    "content": "/*\n* Copyright 2019 Red Hat, Inc. and/or its affiliates.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*       http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\npackage org.uberfire.client.util;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.doReturn;\n\npublic class CookieTest {\n\n    Cookie cookie;\n\n    @Before\n    public void setup() {\n        cookie = spy(Cookie.class);\n    }\n\n    @Test\n    public void emptyCookie() {\n        doReturn(\"\").when(cookie).get();\n        String value = cookie.get(\"key1\");\n        assertEquals(\"\", value);\n    }\n\n    @Test\n    public void inexistentSingleCookie() {\n        doReturn(\"key1=val1\").when(cookie).get();\n        String value = cookie.get(\"key2\");\n        assertEquals(\"\", value);\n    }\n\n    @Test\n    public void singleCookie() {\n        doReturn(\"key1=val1\").when(cookie).get();\n        String value = cookie.get(\"key1\");\n        assertEquals(\"val1\", value);\n    }\n\n    @Test\n    public void inexistentMultipleCookies() {\n        doReturn(\"key1=val1; key2=val2; key3=val3\").when(cookie).get();\n        String value = cookie.get(\"key4\");\n        assertEquals(\"\", value);\n    }\n\n    @Test\n    public void firstMultipleCookies() {\n        doReturn(\"key1=val1; key2=val2; key3=val3\").when(cookie).get();\n        String value = cookie.get(\"key1\");\n        assertEquals(\"val1\", value);\n    }\n\n    @Test\n    public void middleMultipleCookies() {\n        doReturn(\"key1=val1; key2=val2; key3=val3\").when(cookie).get();\n        String value = cookie.get(\"key2\");\n        assertEquals(\"val2\", value);\n    }\n\n    @Test\n    public void lastMultipleCookies() {\n        doReturn(\"key1=val1; key2=val2; key3=val3\").when(cookie).get();\n        String value = cookie.get(\"key3\");\n        assertEquals(\"val3\", value);\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/test/java/org/uberfire/client/workbench/ouia/OuiaComponentIdAttributeTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\n\npublic class OuiaComponentIdAttributeTest {\n\n    @Test\n    public void testGetName() {\n        assertEquals(OuiaComponentIdAttribute.COMPONENT_ID, new OuiaComponentIdAttribute(\"xyz\").getName());\n    }\n\n    @Test\n    public void testGetValue() {\n        assertEquals(\"xyz\", new OuiaComponentIdAttribute(\"xyz\").getValue());\n    }\n\n    @Test\n    public void testEquality() {\n        assertEquals(new OuiaComponentIdAttribute(\"a\"), new OuiaComponentIdAttribute(\"a\"));\n        assertNotEquals(new OuiaComponentIdAttribute(\"a\"), new OuiaComponentIdAttribute(\"b\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-client-api/src/test/java/org/uberfire/client/workbench/ouia/OuiaComponentTypeAttributeTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.ouia;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\n\npublic class OuiaComponentTypeAttributeTest {\n\n    @Test\n    public void testGetName() {\n        assertEquals(OuiaComponentTypeAttribute.COMPONENT_TYPE, new OuiaComponentTypeAttribute(\"xyz\").getName());\n    }\n\n    @Test\n    public void testGetValue() {\n        assertEquals(\"xyz\", new OuiaComponentTypeAttribute(\"xyz\").getValue());\n    }\n\n    @Test\n    public void testEquality() {\n        assertEquals(new OuiaComponentTypeAttribute(\"a\"), new OuiaComponentTypeAttribute(\"a\"));\n        assertNotEquals(new OuiaComponentTypeAttribute(\"a\"), new OuiaComponentTypeAttribute(\"b\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-commons/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-commons</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Commons</name>\n  <description>Collection of reusable (not depending on any other UberFire module) components for Uberfire.</description>\n\n  <dependencies>\n\n    <!-- NOTE TO MAINTAINERS: This module is used by UberFire's VFS, which must remain independent of \"web\" technologies.\n         Don't add dependencies from this module to any other UberFire or Errai module! See UF-131 and UF-135 for details. -->\n\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <!-- ActiveMQ (artemis) -->\n    <dependency>\n      <groupId>org.apache.activemq</groupId>\n      <artifactId>artemis-jms-client</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.apache.geronimo.specs</groupId>\n          <artifactId>geronimo-json_1.0_spec</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.apache.geronimo.specs</groupId>\n          <artifactId>geronimo-jms_2.0_spec</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>io.netty</groupId>\n          <artifactId>netty-all</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.jms</groupId>\n      <artifactId>jakarta.jms-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-buffer</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-transport</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-handler</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-transport-native-epoll</artifactId>\n      <classifier>${netty-transport-native-epoll-classifier}</classifier>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-transport-native-kqueue</artifactId>\n      <classifier>${netty-transport-native-kqueue-classifier}</classifier>\n    </dependency>\n    <dependency>\n      <groupId>io.netty</groupId>\n      <artifactId>netty-codec-http</artifactId>\n    </dependency>\n    <!-- /ActiveMQ (artemis) -->\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/async/DescriptiveRunnable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.async;\n\npublic interface DescriptiveRunnable extends Runnable {\n\n    String getDescription();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/async/DescriptiveThreadFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.async;\n\nimport java.util.concurrent.ThreadFactory;\n\npublic class DescriptiveThreadFactory implements ThreadFactory {\n\n    @Override\n    public Thread newThread(final Runnable r) {\n        if (r instanceof DescriptiveRunnable) {\n            return new Thread(r,\n                              ((DescriptiveRunnable) r).getDescription());\n        }\n        return new Thread(r);\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/ClusterJMSService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.cluster;\n\nimport java.io.Serializable;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Consumer;\n\nimport javax.jms.Connection;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.Destination;\nimport javax.jms.ExceptionListener;\nimport javax.jms.JMSException;\nimport javax.jms.MessageConsumer;\nimport javax.jms.MessageProducer;\nimport javax.jms.ObjectMessage;\nimport javax.jms.Session;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\n\nimport org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class ClusterJMSService implements ClusterService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ClusterJMSService.class);\n\n    private Connection connection;\n    private ClusterParameters clusterParameters;\n    private Map<String, Session> consumerSessions = new ConcurrentHashMap();\n\n    public ClusterJMSService() {\n        clusterParameters = loadParameters();\n    }\n\n    @Override\n    public void connect() {\n        try {\n            final String jmsUserName = clusterParameters.getJmsUserName();\n            final String jmsPassword = clusterParameters.getJmsPassword();\n            final ConnectionFactory factory;\n            switch (clusterParameters.getConnectionMode()) {\n                case REMOTE:\n                    final String jmsURL = clusterParameters.getProviderUrl();\n                    factory = createRemoteConnectionFactory(jmsURL,\n                                                            jmsUserName,\n                                                            jmsPassword);\n                    break;\n                case JNDI:\n                    final InitialContext context = new InitialContext(clusterParameters.getInitialContextFactory());\n                    factory = createJNDIConnectionFactory(context);\n                    break;\n                default:\n                    throw new RuntimeException(\"Error setting the cluster mode (should be defined as REMOTE or JNDI\");\n            }\n            if (thereIsNoCredentials(jmsUserName, jmsPassword)) {\n                connection = factory.createConnection();\n            } else {\n                connection = factory.createConnection(jmsUserName, jmsPassword);\n            }\n            connection.setExceptionListener(new JMSExceptionListener());\n            connection.start();\n        } catch (Exception e) {\n            LOGGER.error(\"Error connecting on JMS \" + e.getMessage());\n            throw new RuntimeException(e);\n        }\n    }\n\n    private boolean thereIsNoCredentials(String jmsUserName, String jmsPassword) {\n        return jmsUserName == null && jmsPassword == null;\n    }\n\n    ConnectionFactory createJNDIConnectionFactory(final InitialContext context) throws NamingException {\n        return (ConnectionFactory) context.lookup(clusterParameters.getJmsConnectionFactoryJndiName());\n    }\n\n    ConnectionFactory createRemoteConnectionFactory(final String jmsURL,\n                                                    final String jmsUserName,\n                                                    final String jmsPassword) {\n        return new ActiveMQConnectionFactory(jmsURL,\n                                             jmsUserName,\n                                             jmsPassword);\n    }\n\n    private ClusterParameters loadParameters() {\n        return new ClusterParameters();\n    }\n\n    @Override\n    public <T> void createConsumer(DestinationType type,\n                                   String channel,\n                                   Class<T> objectMessageClass,\n                                   Consumer<T> listener) {\n\n        consumerSessions.computeIfAbsent(channel, (key) -> {\n            Session newSession = createConsumerSession();\n            try {\n                Destination topic = createDestination(type,\n                                                      key,\n                                                      newSession);\n                MessageConsumer messageConsumer = newSession.createConsumer(topic);\n\n                messageConsumer.setMessageListener(message -> {\n                    if (message instanceof ObjectMessage) {\n                        try {\n                            Serializable object = ((ObjectMessage) message).getObject();\n                            if (objectMessageClass.isInstance(object)) {\n                                if (LOGGER.isTraceEnabled()) {\n                                    LOGGER.trace(\"JSM: Consumer for channel {} - {} and session {} is accepting ObjectMessage\", type, channel, newSession);\n                                }\n                                listener.accept((T) object);\n                            }\n                        } catch (JMSException e) {\n                            LOGGER.error(\"Exception receiving JMS message: \" + e.getMessage());\n                        }\n                    }\n                });\n                return newSession;\n            } catch (Exception e) {\n                try {\n                    newSession.close();\n                } catch (Exception ex) {\n                    LOGGER.error(\"Exception on closing JMS session (this could trigger a leak) \" + e.getMessage());\n                }\n                LOGGER.error(\"Error creating JMS Watch Service: \" + e.getMessage());\n                return null;\n            }\n        });\n    }\n\n    @Override\n    public synchronized void broadcast(DestinationType type,\n                                       String channel,\n                                       Serializable object) {\n\n        Session session = null;\n        try {\n            session = connection.createSession(false,\n                                               Session.AUTO_ACKNOWLEDGE);\n            Destination destination = createDestination(type,\n                                                        channel,\n                                                        session);\n            ObjectMessage objectMessage = session.createObjectMessage(object);\n            if (clusterParameters.getJmsThrottle() > 0) {\n                objectMessage.setLongProperty(\"_AMQ_SCHED_DELIVERY\", System.currentTimeMillis() + clusterParameters.getJmsThrottle());\n            }\n            MessageProducer messageProducer = session.createProducer(destination);\n            messageProducer.send(objectMessage);\n        } catch (JMSException e) {\n            LOGGER.error(\"Exception on JMS broadcast: \" + e.getMessage());\n        } finally {\n            if (session != null) {\n                try {\n                    session.close();\n                } catch (JMSException e) {\n                    LOGGER.error(\"Exception on closing JMS session (this could trigger a leak) \" + e.getMessage());\n                }\n            }\n        }\n    }\n\n    protected Destination createDestination(DestinationType type,\n                                            String channel,\n                                            Session session) throws JMSException {\n        if (type.equals(DestinationType.LoadBalancer)) {\n            return session.createQueue(channel);\n        }\n        return session.createTopic(channel);\n    }\n\n    protected Session createConsumerSession() {\n        try {\n            Session session = connection.createSession(false,\n                                                       Session.AUTO_ACKNOWLEDGE);\n            return session;\n        } catch (JMSException e) {\n            LOGGER.error(\"Error creating session \" + e.getMessage());\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean isAppFormerClustered() {\n        return clusterParameters.isAppFormerClustered();\n    }\n\n    public static class JMSExceptionListener implements ExceptionListener {\n\n        @Override\n        public void onException(JMSException e) {\n            LOGGER.error(\"JMSException: \" + e.getMessage());\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            for (Session s : consumerSessions.values()) {\n                s.close();\n            }\n            connection.close();\n        } catch (JMSException e) {\n            LOGGER.error(\"Exception closing JMS connection and consumerSessions: \" + e.getMessage());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/ClusterParameters.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.cluster;\n\n\nimport java.util.Properties;\n\nimport javax.naming.Context;\n\npublic class ClusterParameters {\n\n    public static final String APPFORMER_JMS_CONNECTION_MODE = \"appformer-jms-connection-mode\";\n\n    public static final String APPFORMER_PROVIDER_URL = \"appformer-jms-url\";\n\n    public static final String APPFORMER_INITIAL_CONTEXT_FACTORY = \"appformer-initial-context-factory\";\n    public static final String APPFORMER_JMS_CONNECTION_FACTORY = \"appformer-jms-connection-factory\";\n\n    public static final String APPFORMER_JMS_USERNAME = \"appformer-jms-username\";\n    public static final String APPFORMER_JMS_PASSWORD = \"appformer-jms-password\";\n\n    //The specified value must be a positive long corresponding to the time the message must be delivered (in milliseconds)\n    public static final String APPFORMER_JMS_THROTTLE = \"appformer-jms-throttle\";\n\n    private final Properties initialContextFactory = new Properties();\n    private final ConnectionMode connectionMode;\n    private final String providerUrl;\n    private final String jmsConnectionFactoryJndiName;\n    private final String jmsUserName;\n    private final String jmsPassword;\n    private long jmsThrottle;\n\n    public ClusterParameters() {\n        ConnectionMode connectionMode;\n        try {\n            connectionMode = ConnectionMode.valueOf(System.getProperty(APPFORMER_JMS_CONNECTION_MODE,\n                                                                       ConnectionMode.NONE.toString()));\n        } catch (final Throwable ignore) {\n            connectionMode = ConnectionMode.NONE;\n        }\n        this.connectionMode = connectionMode;\n        this.initialContextFactory.put(Context.INITIAL_CONTEXT_FACTORY,\n                                       System.getProperty(APPFORMER_INITIAL_CONTEXT_FACTORY,\n                                                          \"org.wildfly.naming.client.WildFlyInitialContextFactory\"));\n        this.jmsConnectionFactoryJndiName = System.getProperty(APPFORMER_JMS_CONNECTION_FACTORY,\n                                                               \"java:/ConnectionFactory\");\n        this.providerUrl = System.getProperty(APPFORMER_PROVIDER_URL, \"tcp://localhost:61616\");\n        this.jmsUserName = System.getProperty(APPFORMER_JMS_USERNAME);\n        this.jmsPassword = System.getProperty(APPFORMER_JMS_PASSWORD);\n\n        String throttleParameter = System.getProperty(APPFORMER_JMS_THROTTLE, \"1000\");\n        try {\n            this.jmsThrottle = Long.valueOf(throttleParameter);\n        } catch (NumberFormatException e) {\n            this.jmsThrottle = -1;\n        }\n    }\n\n    public boolean isAppFormerClustered() {\n        return this.connectionMode != ConnectionMode.NONE;\n    }\n\n    public ConnectionMode getConnectionMode() {\n        return connectionMode;\n    }\n\n    public String getProviderUrl() {\n        return providerUrl;\n    }\n\n    public Properties getInitialContextFactory() {\n        return initialContextFactory;\n    }\n\n    public String getJmsConnectionFactoryJndiName() {\n        return jmsConnectionFactoryJndiName;\n    }\n\n    public String getJmsUserName() {\n        return jmsUserName;\n    }\n\n    public String getJmsPassword() {\n        return jmsPassword;\n    }\n\n    public long getJmsThrottle() {\n        return jmsThrottle;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/ClusterService.java",
    "content": "package org.uberfire.commons.cluster;\n\nimport java.io.Serializable;\nimport java.util.function.Consumer;\n\npublic interface ClusterService {\n\n    void connect();\n\n    <T> void createConsumer(DestinationType type,\n                        String channel,\n                        Class<T> clazz,\n                        Consumer<T> listener);\n\n\n    void broadcast(DestinationType type,\n                   String channel,\n                   Serializable object);\n\n    boolean isAppFormerClustered();\n\n    void close();\n\n    enum DestinationType {\n        PubSub,\n        LoadBalancer\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/ConnectionMode.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.commons.cluster;\n\npublic enum ConnectionMode {\n    REMOTE,\n    JNDI,\n    NONE\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/events/ClusterEventObserver.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.cluster.events;\n\nimport java.util.UUID;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.event.Reception;\nimport javax.enterprise.inject.spi.EventMetadata;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.marshalling.server.ServerMarshalling;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.cluster.ClusterJMSService;\nimport org.uberfire.commons.cluster.ClusterService;\nimport org.uberfire.commons.clusterapi.Clustered;\nimport org.uberfire.commons.services.cdi.Startup;\n\n@Startup\n@ApplicationScoped\npublic class ClusterEventObserver {\n\n    public static final String CHANNEL_NAME = \"CLUSTER_CDI_EVENTS\";\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ClusterEventObserver.class);\n\n    private String nodeId = UUID.randomUUID().toString();\n\n    private Event<Object> eventBus;\n    private ClusterService clusterService;\n\n    public ClusterEventObserver() {\n\n    }\n\n    @Inject\n    public ClusterEventObserver(Event<Object> eventBus) {\n        this.clusterService = new ClusterJMSService();\n        this.eventBus = eventBus;\n        if (this.clusterService.isAppFormerClustered()) {\n            this.clusterService.connect();\n            this.clusterService.createConsumer(ClusterJMSService.DestinationType.PubSub,\n                                               CHANNEL_NAME,\n                                               ClusterSerializedCDIMessageWrapper.class,\n                                               message -> consumeMessage(eventBus,\n                                                                         message));\n        }\n    }\n\n    @PreDestroy\n    public void shutdown(){\n        if(this.clusterService.isAppFormerClustered()){\n            this.clusterService.close();\n        }\n    }\n\n    ClusterService getClusterService() {\n        return clusterService;\n    }\n\n    void consumeMessage(Event<Object> eventBus,\n                        ClusterSerializedCDIMessageWrapper message) {\n        if (!message.getNodeId().equals(nodeId)) {\n            try {\n                Object event = fromJSON(message);\n                eventBus.fire(event);\n            } catch (Exception e) {\n                LOGGER.error(\"Error consuming cluster event:  \" + e.getMessage());\n            }\n        }\n    }\n\n    Object fromJSON(ClusterSerializedCDIMessageWrapper message) {\n        return ServerMarshalling.fromJSON(message.getJson());\n    }\n\n    public void observeAllEvents(@Observes(notifyObserver = Reception.IF_EXISTS) Object event,\n                                 EventMetadata metaData) {\n        if (shouldObserveThisEvent(event,\n                                   metaData)) {\n            broadcast(event);\n        }\n    }\n\n    public void broadcast(Object event) {\n        if (!getClusterService().isAppFormerClustered()) {\n            return;\n        }\n\n        ClusterSerializedCDIMessageWrapper wrapper = new ClusterSerializedCDIMessageWrapper(nodeId,\n                                                                                            toJSON(event),\n                                                                                            event.getClass().getName());\n\n        getClusterService().broadcast(ClusterService.DestinationType.PubSub,\n                                      CHANNEL_NAME,\n                                      wrapper);\n    }\n\n    String toJSON(Object event) {\n        return ServerMarshalling.toJSON(event);\n    }\n\n    boolean shouldObserveThisEvent(Object event,\n                                   EventMetadata metaData) {\n        return event.getClass().isAnnotationPresent(Clustered.class) && !createdOnThisClass(metaData);\n    }\n\n    private boolean createdOnThisClass(EventMetadata metaData) {\n        if (metaData == null || metaData.getInjectionPoint() == null) {\n            return false;\n        } else {\n            return metaData.getInjectionPoint().getBean().getBeanClass().equals(this.getClass());\n        }\n    }\n\n    String getNodeId() {\n        return nodeId;\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/cluster/events/ClusterSerializedCDIMessageWrapper.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.cluster.events;\n\nimport java.io.Serializable;\n\npublic class ClusterSerializedCDIMessageWrapper implements Serializable {\n\n    private String fqcn;\n    private String json;\n    private String nodeId;\n\n    public ClusterSerializedCDIMessageWrapper() {\n\n    }\n\n    public ClusterSerializedCDIMessageWrapper(String nodeId,\n                                              String json,\n                                              String fqcn) {\n\n        this.nodeId = nodeId;\n        this.json = json;\n        this.fqcn = fqcn;\n    }\n\n    public String getFqcn() {\n        return fqcn;\n    }\n\n    public String getNodeId() {\n        return nodeId;\n    }\n\n    public String getJson() {\n        return json;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/clusterapi/Clustered.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.clusterapi;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * On cluster runtime enviroments, Errai @Portable POJOS annotated\n * with this are propagated in the Cluster and retriggered (cdi fire)\n * on each cluster node.\n */\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE})\npublic @interface Clustered {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/ExecutorServiceProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\n\n/**\n * ExecutorService Producer. It produces managed and unmanaged executor services. For now the implementation is the same\n * but it could change if any other container gets under support. They are in different variables on purpose.\n */\npublic class ExecutorServiceProducer {\n\n    private Logger logger = LoggerFactory.getLogger(ExecutorServiceProducer.class);\n\n    private final ExecutorService executorService;\n    private final ExecutorService unmanagedExecutorService;\n    private final ExecutorService indexingExecutorService;\n    private final ExecutorService fsWatchExecutorService;\n    private final ExecutorService restApiExecutorService;\n\n    protected static final String MANAGED_LIMIT_PROPERTY = \"org.appformer.concurrent.managed.thread.limit\";\n    protected static final String UNMANAGED_LIMIT_PROPERTY = \"org.appformer.concurrent.unmanaged.thread.limit\";\n    protected static final String INDEXING_LIMIT_PROPERTY = \"org.appformer.concurrent.indexing.thread.limit\";\n    protected static final String FS_WATCH_LIMIT_PROPERTY = \"org.appformer.concurrent.fs.watch.thread.limit\";\n    protected static final String REST_API_LIMIT_PROPERTY = \"org.appformer.concurrent.rest.api.thread.limit\";\n\n    public ExecutorServiceProducer() {\n        this.executorService = this.buildFixedThreadPoolExecutorService(MANAGED_LIMIT_PROPERTY);\n        this.unmanagedExecutorService = this.buildFixedThreadPoolExecutorService(UNMANAGED_LIMIT_PROPERTY);\n        this.indexingExecutorService = this.buildFixedThreadPoolExecutorService(INDEXING_LIMIT_PROPERTY, 20);\n        this.fsWatchExecutorService = this.buildFixedThreadPoolExecutorService(FS_WATCH_LIMIT_PROPERTY);\n        this.restApiExecutorService = this.buildFixedThreadPoolExecutorService(REST_API_LIMIT_PROPERTY, 20);\n    }\n\n    protected ExecutorService buildFixedThreadPoolExecutorService(String key) {\n        return this.buildFixedThreadPoolExecutorService(key, 0);\n    }\n\n    protected ExecutorService buildFixedThreadPoolExecutorService(String key, int defaultLimit) {\n        String stringProperty = System.getProperty(key);\n        int threadLimit = stringProperty == null ? defaultLimit : toInteger(stringProperty);\n        if (threadLimit > 0) {\n            if (logger.isDebugEnabled()) {\n                logger.debug(\"Creating FixedThreadPool Executor Service for: {} with a limit of {}\", key, threadLimit);\n            }\n            return Executors.newFixedThreadPool(threadLimit,\n                                                new DescriptiveThreadFactory());\n        } else {\n            if (logger.isDebugEnabled()) {\n                logger.debug(\"Creating CachedThreadPool Executor Service for: {}\", key);\n            }\n            return Executors.newCachedThreadPool(new DescriptiveThreadFactory());\n        }\n    }\n\n    private Integer toInteger(String stringProperty) {\n        try {\n            return Integer.valueOf(stringProperty);\n        } catch (NumberFormatException e) {\n            if (logger.isDebugEnabled()) {\n                logger.debug(\"Property {} is invalid, defaulting to 0\",\n                             stringProperty);\n            }\n            return 0;\n        }\n    }\n\n    @Produces\n    @ApplicationScoped\n    @Managed\n    public ExecutorService produceExecutorService() {\n        return this.getManagedExecutorService();\n    }\n\n    @Produces\n    @ApplicationScoped\n    @Unmanaged\n    public ExecutorService produceUnmanagedExecutorService() {\n        return this.getUnmanagedExecutorService();\n    }\n\n    @Produces\n    @ApplicationScoped\n    @Indexing\n    public ExecutorService produceIndexingExecutorService() {\n        return this.getIndexingExecutorService();\n    }\n\n    @Produces\n    @ApplicationScoped\n    @FSWatch\n    public ExecutorService produceFsWatchExecutorService() {\n        return this.getFsWatchExecutorService();\n    }\n\n    @Produces\n    @ApplicationScoped\n    @RestApi\n    public ExecutorService produceRestAPiExecutorService() {\n        return this.getRestApiExecutorService();\n    }\n\n    protected ExecutorService getManagedExecutorService() {\n        return this.executorService;\n    }\n\n    protected ExecutorService getUnmanagedExecutorService() {\n        return this.unmanagedExecutorService;\n    }\n\n    protected ExecutorService getIndexingExecutorService() {\n        return this.indexingExecutorService;\n    }\n\n    protected ExecutorService getFsWatchExecutorService() {\n        return this.fsWatchExecutorService;\n    }\n\n    protected ExecutorService getRestApiExecutorService() {\n        return this.restApiExecutorService;\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/FSWatch.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\nimport javax.inject.Qualifier;\n\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface FSWatch {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/Indexing.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\nimport javax.inject.Qualifier;\n\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface Indexing {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/Managed.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport javax.inject.Qualifier;\n\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface Managed {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/RestApi.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\n\nimport javax.inject.Qualifier;\n\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface RestApi {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/concurrent/Unmanaged.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.commons.concurrent;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport javax.inject.Qualifier;\n\n@Documented\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface Unmanaged {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/config/ConfigProperties.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.config;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Encapsulates a collection of Java System Properties by name and value. Includes handy methods for providing and\n * identifying application-provided default values and converting from Strings to other common types.\n */\npublic class ConfigProperties {\n\n    private final Map<String, String> configuredValues;\n    private final List<ConfigProperty> configSummary = new ArrayList<ConfigProperty>();\n\n    /**\n     * Creates a new container of configured values from which specific config properties can be obtained.\n     *\n     * @param configuredValues The configured values, which may have been hardcoded in a Map, read from a config file, or whatever.\n     */\n    public ConfigProperties(Map<String, String> configuredValues) {\n        this.configuredValues = checkNotNull(\"configuredValues\",\n                                             configuredValues);\n    }\n\n    /**\n     * Creates a new container of configured values from which specific config properties can be obtained.\n     *\n     * @param configuredValues The configured values, which may have been read from a properties file, or obtained from\n     *                         {@link System#getProperties()}. If the property set contains entries whose key and value are not both\n     *                         Strings, these entries will be ignored.\n     */\n    public ConfigProperties(Properties configuredValues) {\n        Map<String, String> stringProperties = new HashMap<String, String>();\n        for (String key : configuredValues.stringPropertyNames()) {\n            stringProperties.put(key,\n                                 configuredValues.getProperty(key));\n        }\n        this.configuredValues = stringProperties;\n    }\n\n    /**\n     * Returns the ConfigProperty instance corresponding to the configured value of the given property, or the default\n     * if no configured value exists.\n     *\n     * @param name         the property name. Must not be null.\n     * @param defaultValue the value to use if no configured value exists. May be null.\n     * @return\n     */\n    public ConfigProperty get(String name,\n                              String defaultValue) {\n        String val = configuredValues.get(name);\n        ConfigProperty cp;\n        if (val == null || val.trim().length() == 0) {\n            cp = new ConfigProperty(name,\n                                    defaultValue,\n                                    true);\n        } else {\n            cp = new ConfigProperty(name,\n                                    val.trim(),\n                                    false);\n        }\n        configSummary.add(cp);\n        return cp;\n    }\n\n    /**\n     * Returns a multi-line string containing a list of all the properties that were retrieved from this instance, in\n     * the order they were retrieved. Does not list unused values from the map given in the constructor, since these may\n     * contain a lot of unrelated information (for example, when using System.getProperties()). This is useful for\n     * printing a summary of the configuration in a given subsystem. It also helps users learn about available\n     * configuration values.\n     *\n     * @param heading a line of text to print before listing the configuration values\n     */\n    public String getConfigurationSummary(String heading) {\n        final String newLine = System.getProperty(\"line.separator\");\n        StringBuilder sb = new StringBuilder(heading);\n        for (ConfigProperty cp : configSummary) {\n            sb.append(newLine).append(cp);\n        }\n        return sb.toString();\n    }\n\n    public static class ConfigProperty {\n\n        private final String name;\n        private final String value;\n        private final boolean isDefault;\n\n        ConfigProperty(String name,\n                       String value,\n                       boolean isDefault) {\n            this.name = name;\n            this.value = value;\n            this.isDefault = isDefault;\n        }\n\n        /**\n         * Returns the name (map key) of this property.\n         */\n        public String getName() {\n            return name;\n        }\n\n        /**\n         * Returns the value of this property, which may or may not have been the default value.\n         *\n         * @return the property value. Will be null if both the configured value was missing and the default was given\n         * as null.\n         * @see #isDefault()\n         */\n        public String getValue() {\n            return value;\n        }\n\n        /**\n         * Returns false if this value appeared among the user-supplied values; false if it came from the\n         * application-provided default.\n         *\n         * @return whether this value is a default\n         */\n        public boolean isDefault() {\n            return isDefault;\n        }\n\n        /**\n         * Returns the boolean value of this property, converting from string using the same rules as\n         * {@link Boolean#valueOf(String)}.\n         */\n        public boolean getBooleanValue() {\n            return Boolean.valueOf(value);\n        }\n\n        /**\n         * Returns the integer value of this property, converting from string using the same rules as\n         * {@link Integer#parseInt(String)}.\n         *\n         * @throws NumberFormatException if the value cannot be parsed as an integer.\n         */\n        public int getIntValue() {\n            return Integer.parseInt(value);\n        }\n\n        @Override\n        public String toString() {\n            return name + \" = \\\"\" + value + \"\\\"\" + (isDefault ? \" (Defaulted)\" : \"\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/data/Cacheable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.data;\n\npublic interface Cacheable {\n\n    /**\n     * Instructs any component that would like to cache the object\n     * that in case it's already cached it should be refreshed inside the cache\n     * @return\n     */\n    boolean requiresRefresh();\n\n    /**\n     * Marks the instance as cached. It should be done by the last cache in chain\n     */\n    void markAsCached();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/data/Pair.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.data;\n\n/**\n * This is a simple class to store a pair of objects.\n * @param <K1>\n * @param <K2>\n */\npublic class Pair<K1, K2> {\n\n    private final PairEqualsMode equalsMode;\n    /**\n     * First item.\n     */\n    private final K1 k1;\n    /**\n     * Second item.\n     */\n    private final K2 k2;\n\n    /**\n     * Creates a new pair using the two keys provided.\n     * @param k1\n     * @param k2\n     */\n    public Pair(\n            final K1 k1,\n            final K2 k2) {\n        this.k1 = k1;\n        this.k2 = k2;\n        this.equalsMode = PairEqualsMode.BOTH;\n    }\n\n    /**\n     * Creates a new pair using the two keys provided.\n     * @param k1\n     * @param k2\n     */\n    public Pair(\n            final K1 k1,\n            final K2 k2,\n            final PairEqualsMode equalsMode) {\n        this.k1 = k1;\n        this.k2 = k2;\n        this.equalsMode = equalsMode;\n    }\n\n    /**\n     * static factory method\n     * @param <K1>\n     * @param <K2>\n     * @param k1\n     * @param k2\n     * @return\n     */\n    public static <K1, K2> Pair<K1, K2> newPair(final K1 k1,\n                                                final K2 k2) {\n        return new Pair<K1, K2>(k1,\n                                k2,\n                                PairEqualsMode.BOTH);\n    }\n\n    /**\n     * static factory method\n     * @param <K1>\n     * @param <K2>\n     * @param k1\n     * @param k2\n     * @return\n     */\n    public static <K1, K2> Pair<K1, K2> newPair(final K1 k1,\n                                                final K2 k2,\n                                                final PairEqualsMode equalsMode) {\n        return new Pair<K1, K2>(k1,\n                                k2,\n                                equalsMode);\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        final Pair<?, ?> pair = (Pair<?, ?>) o;\n\n        if (PairEqualsMode.BOTH.equals(equalsMode) || PairEqualsMode.K1.equals(equalsMode)) {\n            if (k1 != null ? !k1.equals(pair.k1) : pair.k1 != null) {\n                return false;\n            }\n        }\n        if (PairEqualsMode.BOTH.equals(equalsMode) || PairEqualsMode.K2.equals(equalsMode)) {\n            if (k2 != null ? !k2.equals(pair.k2) : pair.k2 != null) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * @return the first key\n     */\n    public K1 getK1() {\n        return this.k1;\n    }\n\n    /**\n     * @return the second key\n     */\n    public K2 getK2() {\n        return this.k2;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = 0;\n        if (PairEqualsMode.BOTH.equals(equalsMode) || PairEqualsMode.K1.equals(equalsMode)) {\n            result = k1 != null ? k1.hashCode() : 0;\n        }\n        if (PairEqualsMode.BOTH.equals(equalsMode) || PairEqualsMode.K2.equals(equalsMode)) {\n            result = 31 * result + (k2 != null ? k2.hashCode() : 0);\n        }\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return getClass().getName() + \"{\" +\n                \"k1=\" + k1 +\n                \", k2=\" + k2 +\n                '}';\n    }\n\n    public static enum PairEqualsMode {\n        BOTH,\n        K1,\n        K2\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/data/Triple.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.data;\n\npublic class Triple<K1, K2, K3> {\n\n    /**\n     * First item.\n     */\n    private final K1 k1;\n\n    /**\n     * Second item.\n     */\n    private final K2 k2;\n\n    /**\n     * Third item.\n     */\n    private final K3 k3;\n\n    /**\n     * Creates a new triple using the keys provided.\n     * @param k1\n     * @param k2\n     */\n    public Triple(\n            final K1 k1,\n            final K2 k2,\n            final K3 k3) {\n        this.k1 = k1;\n        this.k2 = k2;\n        this.k3 = k3;\n    }\n\n    /**\n     * static factory method\n     * @param <K1>\n     * @param <K2>\n     * @param k1\n     * @param k2\n     * @return\n     */\n    public static <K1, K2, K3> Triple<K1, K2, K3> newTriple(final K1 k1,\n                                                            final K2 k2,\n                                                            final K3 k3) {\n        return new Triple<K1, K2, K3>(k1,\n                                      k2,\n                                      k3);\n    }\n\n    /**\n     * @return the first key\n     */\n    public K1 getK1() {\n        return this.k1;\n    }\n\n    /**\n     * @return the second key\n     */\n    public K2 getK2() {\n        return this.k2;\n    }\n\n    /**\n     * @return the third key\n     */\n    public K3 getK3() {\n        return this.k3;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Triple)) {\n            return false;\n        }\n\n        Triple triple = (Triple) o;\n\n        if (k1 != null ? !k1.equals(triple.k1) : triple.k1 != null) {\n            return false;\n        }\n        if (k2 != null ? !k2.equals(triple.k2) : triple.k2 != null) {\n            return false;\n        }\n        if (k3 != null ? !k3.equals(triple.k3) : triple.k3 != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = k1 != null ? k1.hashCode() : 0;\n        result = 31 * result + (k2 != null ? k2.hashCode() : 0);\n        result = 31 * result + (k3 != null ? k3.hashCode() : 0);\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return getClass().getName() + \"{\" +\n                \"k1=\" + k1 +\n                \", k2=\" + k2 +\n                \", k3=\" + k3 +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/lifecycle/Disposable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lifecycle;\n\n/**\n * The Disposable interface is used for life-cycle management of resources.\n */\npublic interface Disposable {\n\n    void dispose();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/lifecycle/PriorityDisposable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lifecycle;\n\n/**\n * The PriorityDisposable interface is used for life-cycle management\n * of resources that requires priority to be disposed.\n * <p>\n * Important Note: Due an issue related to multiple Application Server\n * support, all types that implement this interface needs to register itself on\n * PriorityDisposableRegistry (preferable on constructor).\n * @see Disposable\n * @see PriorityDisposableRegistry\n */\npublic interface PriorityDisposable extends Disposable {\n\n    int priority();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/lifecycle/PriorityDisposableRegistry.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lifecycle;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\npublic final class PriorityDisposableRegistry {\n\n    private static Set<PriorityDisposable> disposables = new HashSet<PriorityDisposable>();\n    private static Map<String, Object> registry = new HashMap<String, Object>();\n\n    private PriorityDisposableRegistry() {\n    }\n\n    public static void register(final PriorityDisposable priorityDisposable) {\n        disposables.add(priorityDisposable);\n    }\n\n    public static void register(final String refName,\n                                final Object disposable) {\n        registry.put(refName,\n                     disposable);\n    }\n\n    public static void clear() {\n        disposables.clear();\n        registry.clear();\n    }\n\n    public static Collection<PriorityDisposable> getDisposables() {\n        return disposables;\n    }\n\n    static Map<String, Object> getRegistry() {\n        return registry;\n    }\n\n    public static void unregister(final String refName) {\n        registry.remove(refName);\n    }\n\n    public static Object get(final String refName) {\n        return registry.get(refName);\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/lock/LockExecuteReleaseTemplate.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lock;\n\nimport java.util.concurrent.RunnableFuture;\n\npublic class LockExecuteReleaseTemplate<V> {\n\n    public V execute(final LockService lock,\n                     final RunnableFuture<V> task) {\n        try {\n            lock.lock();\n\n            task.run();\n\n            return task.get();\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            lock.unlock();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/lock/LockService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lock;\n\npublic interface LockService {\n\n    void lock();\n\n    void unlock();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/message/AsyncCallback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.message;\n\nimport java.util.Map;\n\npublic interface AsyncCallback {\n\n    void onTimeOut();\n\n    void onReply(final MessageType type,\n                 final Map<String, String> content);\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/message/MessageHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.message;\n\nimport java.util.Map;\n\nimport org.uberfire.commons.data.Pair;\n\npublic interface MessageHandler {\n\n    Pair<MessageType, Map<String, String>> handleMessage(final MessageType type,\n                                                         final Map<String, String> content);\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/message/MessageHandlerResolver.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.message;\n\npublic interface MessageHandlerResolver {\n\n    String getServiceId();\n\n    public MessageHandler resolveHandler(final String serviceId,\n                                         final MessageType type);\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/message/MessageService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.message;\n\nimport java.util.Map;\n\npublic interface MessageService {\n\n    void broadcastAndWait(final String serviceId,\n                          final MessageType type,\n                          final Map<String, String> content,\n                          final int timeOut);\n\n    void broadcastAndWait(final String serviceId,\n                          final MessageType type,\n                          final Map<String, String> content,\n                          final int timeOut,\n                          final AsyncCallback callback);\n\n    void broadcast(final String serviceId,\n                   final MessageType type,\n                   final Map<String, String> content);\n\n    void broadcast(final String serviceId,\n                   final MessageType type,\n                   final Map<String, String> content,\n                   final int timeOut,\n                   final AsyncCallback callback);\n\n    void sendTo(final String resourceId,\n                final String serviceId,\n                final MessageType type,\n                final Map<String, String> content);\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/message/MessageType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.message;\n\npublic interface MessageType {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/regex/util/AntPathMatcher.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.regex.util;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.StringTokenizer;\n\n/**\n * PathMatcher implementation for Ant-style path patterns.\n * <p>\n * This code has been borrowed from <a href=\"http://camel.apache.org\">Apache Camel</a>.\n * <p>\n */\npublic class AntPathMatcher {\n\n    /**\n     * Default path separator: \"/\"\n     */\n    public static final String DEFAULT_PATH_SEPARATOR = \"/\";\n\n    private String pathSeparator = DEFAULT_PATH_SEPARATOR;\n\n    /**\n     * Tokenize the given String into a String array via a StringTokenizer.\n     * Trims tokens and omits empty tokens.\n     * <p>\n     * The given delimiters string is supposed to consist of any number of\n     * delimiter characters. Each of those characters can be used to separate\n     * tokens. A delimiter is always a single character; for multi-character\n     * delimiters, consider using <code>delimitedListToStringArray</code>\n     * @param str the String to tokenize\n     * @param delimiters the delimiter characters, assembled as String (each of\n     * those characters is individually considered as delimiter).\n     * @return an array of the tokens\n     * @see java.util.StringTokenizer\n     * @see java.lang.String#trim()\n     */\n    public static String[] tokenizeToStringArray(String str,\n                                                 String delimiters) {\n        if (str == null) {\n            return new String[]{};\n        }\n        final StringTokenizer st = new StringTokenizer(str,\n                                                       delimiters);\n        final List<String> tokens = new ArrayList<String>();\n        while (st.hasMoreTokens()) {\n            final String token = st.nextToken().trim();\n            if (token.length() > 0) {\n                tokens.add(token);\n            }\n        }\n        return tokens.toArray(new String[tokens.size()]);\n    }\n\n    /**\n     * Set the path separator to use for pattern parsing. Default is \"/\", as in\n     * Ant.\n     */\n    public void setPathSeparator(final String pathSeparator) {\n        this.pathSeparator = pathSeparator != null ? pathSeparator : DEFAULT_PATH_SEPARATOR;\n    }\n\n    public boolean isPattern(final String path) {\n        return path.indexOf('*') != -1 || path.indexOf('?') != -1;\n    }\n\n    public boolean match(final String pattern,\n                         final String path) {\n        return doMatch(pattern,\n                       path,\n                       true);\n    }\n\n    public boolean matchStart(final String pattern,\n                              final String path) {\n        return doMatch(pattern,\n                       path,\n                       false);\n    }\n\n    /**\n     * Actually match the given <code>path</code> against the given\n     * <code>pattern</code>.\n     * @param pattern the pattern to match against\n     * @param path the path String to test\n     * @param fullMatch whether a full pattern match is required (else a pattern\n     * match as far as the given base path goes is sufficient)\n     * @return <code>true</code> if the supplied <code>path</code> matched,\n     * <code>false</code> if it didn't\n     */\n    protected boolean doMatch(String pattern,\n                              String path,\n                              boolean fullMatch) {\n        if (path.startsWith(this.pathSeparator) != pattern.startsWith(this.pathSeparator)) {\n            return false;\n        }\n\n        String[] pattDirs = tokenizeToStringArray(pattern,\n                                                  this.pathSeparator);\n        String[] pathDirs = tokenizeToStringArray(path,\n                                                  this.pathSeparator);\n\n        int pattIdxStart = 0;\n        int pattIdxEnd = pattDirs.length - 1;\n        int pathIdxStart = 0;\n        int pathIdxEnd = pathDirs.length - 1;\n\n        // Match all elements up to the first **\n        while (pattIdxStart <= pattIdxEnd && pathIdxStart <= pathIdxEnd) {\n            String patDir = pattDirs[pattIdxStart];\n            if (\"**\".equals(patDir)) {\n                break;\n            }\n            if (!matchStrings(patDir,\n                              pathDirs[pathIdxStart])) {\n                return false;\n            }\n            pattIdxStart++;\n            pathIdxStart++;\n        }\n\n        if (pathIdxStart > pathIdxEnd) {\n            // Path is exhausted, only match if rest of pattern is * or **'s\n            if (pattIdxStart > pattIdxEnd) {\n                return pattern.endsWith(this.pathSeparator) ? path.endsWith(this.pathSeparator) : !path\n                        .endsWith(this.pathSeparator);\n            }\n            if (!fullMatch) {\n                return true;\n            }\n            if (pattIdxStart == pattIdxEnd && \"*\".equals(pattDirs[pattIdxStart])\n                    && path.endsWith(this.pathSeparator)) {\n                return true;\n            }\n            for (int i = pattIdxStart; i <= pattIdxEnd; i++) {\n                if (!\"**\".equals(pattDirs[i])) {\n                    return false;\n                }\n            }\n            return true;\n        } else if (pattIdxStart > pattIdxEnd) {\n            // String not exhausted, but pattern is. Failure.\n            return false;\n        } else if (!fullMatch && \"**\".equals(pattDirs[pattIdxStart])) {\n            // Path start definitely matches due to \"**\" part in pattern.\n            return true;\n        }\n\n        // up to last '**'\n        while (pattIdxStart <= pattIdxEnd && pathIdxStart <= pathIdxEnd) {\n            String patDir = pattDirs[pattIdxEnd];\n            if (\"**\".equals(patDir)) {\n                break;\n            }\n            if (!matchStrings(patDir,\n                              pathDirs[pathIdxEnd])) {\n                return false;\n            }\n            pattIdxEnd--;\n            pathIdxEnd--;\n        }\n        if (pathIdxStart > pathIdxEnd) {\n            // String is exhausted\n            for (int i = pattIdxStart; i <= pattIdxEnd; i++) {\n                if (!\"**\".equals(pattDirs[i])) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        while (pattIdxStart != pattIdxEnd && pathIdxStart <= pathIdxEnd) {\n            int patIdxTmp = -1;\n            for (int i = pattIdxStart + 1; i <= pattIdxEnd; i++) {\n                if (\"**\".equals(pattDirs[i])) {\n                    patIdxTmp = i;\n                    break;\n                }\n            }\n            if (patIdxTmp == pattIdxStart + 1) {\n                // '**/**' situation, so skip one\n                pattIdxStart++;\n                continue;\n            }\n            // Find the pattern between padIdxStart & padIdxTmp in str between\n            // strIdxStart & strIdxEnd\n            int patLength = patIdxTmp - pattIdxStart - 1;\n            int strLength = pathIdxEnd - pathIdxStart + 1;\n            int foundIdx = -1;\n\n            strLoop:\n            for (int i = 0; i <= strLength - patLength; i++) {\n                for (int j = 0; j < patLength; j++) {\n                    String subPat = pattDirs[pattIdxStart + j + 1];\n                    String subStr = pathDirs[pathIdxStart + i + j];\n                    if (!matchStrings(subPat,\n                                      subStr)) {\n                        continue strLoop;\n                    }\n                }\n                foundIdx = pathIdxStart + i;\n                break;\n            }\n\n            if (foundIdx == -1) {\n                return false;\n            }\n\n            pattIdxStart = patIdxTmp;\n            pathIdxStart = foundIdx + patLength;\n        }\n\n        for (int i = pattIdxStart; i <= pattIdxEnd; i++) {\n            if (!\"**\".equals(pattDirs[i])) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * Tests whether or not a string matches against a pattern. The pattern may\n     * contain two special characters:<br>\n     * '*' means zero or more characters<br>\n     * '?' means one and only one character\n     * @param pattern pattern to match against. Must not be <code>null</code>.\n     * @param str string which must be matched against the pattern. Must not be\n     * <code>null</code>.\n     * @return <code>true</code> if the string matches against the pattern, or\n     * <code>false</code> otherwise.\n     */\n    private boolean matchStrings(String pattern,\n                                 String str) {\n        char[] patArr = pattern.toCharArray();\n        char[] strArr = str.toCharArray();\n        int patIdxStart = 0;\n        int patIdxEnd = patArr.length - 1;\n        int strIdxStart = 0;\n        int strIdxEnd = strArr.length - 1;\n        char ch;\n\n        boolean containsStar = false;\n        for (char c : patArr) {\n            if (c == '*') {\n                containsStar = true;\n                break;\n            }\n        }\n\n        if (!containsStar) {\n            // No '*'s, so we make a shortcut\n            if (patIdxEnd != strIdxEnd) {\n                return false; // Pattern and string do not have the same size\n            }\n            for (int i = 0; i <= patIdxEnd; i++) {\n                ch = patArr[i];\n                if (ch != '?') {\n                    if (ch != strArr[i]) {\n                        return false;\n                        // Character mismatch\n                    }\n                }\n            }\n            return true; // String matches against pattern\n        }\n\n        if (patIdxEnd == 0) {\n            return true; // Pattern contains only '*', which matches anything\n        }\n\n        // Process characters before first star\n        while ((ch = patArr[patIdxStart]) != '*' && strIdxStart <= strIdxEnd) {\n            if (ch != '?') {\n                if (ch != strArr[strIdxStart]) {\n                    return false;\n                    // Character mismatch\n                }\n            }\n            patIdxStart++;\n            strIdxStart++;\n        }\n        if (strIdxStart > strIdxEnd) {\n            // All characters in the string are used. Check if only '*'s are\n            // left in the pattern. If so, we succeeded. Otherwise failure.\n            for (int i = patIdxStart; i <= patIdxEnd; i++) {\n                if (patArr[i] != '*') {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        // Process characters after last star\n        while ((ch = patArr[patIdxEnd]) != '*' && strIdxStart <= strIdxEnd) {\n            if (ch != '?') {\n                if (ch != strArr[strIdxEnd]) {\n                    return false;\n                    // Character mismatch\n                }\n            }\n            patIdxEnd--;\n            strIdxEnd--;\n        }\n        if (strIdxStart > strIdxEnd) {\n            // All characters in the string are used. Check if only '*'s are\n            // left in the pattern. If so, we succeeded. Otherwise failure.\n            for (int i = patIdxStart; i <= patIdxEnd; i++) {\n                if (patArr[i] != '*') {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        // process pattern between stars. padIdxStart and patIdxEnd point\n        // always to a '*'.\n        while (patIdxStart != patIdxEnd && strIdxStart <= strIdxEnd) {\n            int patIdxTmp = -1;\n            for (int i = patIdxStart + 1; i <= patIdxEnd; i++) {\n                if (patArr[i] == '*') {\n                    patIdxTmp = i;\n                    break;\n                }\n            }\n            if (patIdxTmp == patIdxStart + 1) {\n                // Two stars next to each other, skip the first one.\n                patIdxStart++;\n                continue;\n            }\n            // Find the pattern between padIdxStart & padIdxTmp in str between\n            // strIdxStart & strIdxEnd\n            int patLength = patIdxTmp - patIdxStart - 1;\n            int strLength = strIdxEnd - strIdxStart + 1;\n            int foundIdx = -1;\n            strLoop:\n            for (int i = 0; i <= strLength - patLength; i++) {\n                for (int j = 0; j < patLength; j++) {\n                    ch = patArr[patIdxStart + j + 1];\n                    if (ch != '?') {\n                        if (ch != strArr[strIdxStart + i + j]) {\n                            continue strLoop;\n                        }\n                    }\n                }\n\n                foundIdx = strIdxStart + i;\n                break;\n            }\n\n            if (foundIdx == -1) {\n                return false;\n            }\n\n            patIdxStart = patIdxTmp;\n            strIdxStart = foundIdx + patLength;\n        }\n\n        // All characters in the string are used. Check if only '*'s are left\n        // in the pattern. If so, we succeeded. Otherwise failure.\n        for (int i = patIdxStart; i <= patIdxEnd; i++) {\n            if (patArr[i] != '*') {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * Given a pattern and a full path, determine the pattern-mapped part.\n     * <p>\n     * For example:\n     * <ul>\n     * <li>'<code>/docs/cvs/commit.html</code>' and '\n     * <code>/docs/cvs/commit.html</code> -> ''</li>\n     * <li>'<code>/docs/*</code>' and '<code>/docs/cvs/commit</code> -> '\n     * <code>cvs/commit</code>'</li>\n     * <li>'<code>/docs/cvs/*.html</code>' and '\n     * <code>/docs/cvs/commit.html</code> -> '<code>commit.html</code>'</li>\n     * <li>'<code>/docs/**</code>' and '<code>/docs/cvs/commit</code> -> '\n     * <code>cvs/commit</code>'</li>\n     * <li>'<code>/docs/**\\/*.html</code>' and '\n     * <code>/docs/cvs/commit.html</code> -> '<code>cvs/commit.html</code>'</li>\n     * <li>'<code>/*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '\n     * <code>docs/cvs/commit.html</code>'</li>\n     * <li>'<code>*.html</code>' and '<code>/docs/cvs/commit.html</code> -> '\n     * <code>/docs/cvs/commit.html</code>'</li>\n     * <li>'<code>*</code>' and '<code>/docs/cvs/commit.html</code> -> '\n     * <code>/docs/cvs/commit.html</code>'</li>\n     * </ul>\n     * <p>\n     * Assumes that {@link #match} returns <code>true</code> for '\n     * <code>pattern</code>' and '<code>path</code>', but does\n     * <strong>not</strong> enforce this.\n     */\n    public String extractPathWithinPattern(String pattern,\n                                           String path) {\n        final String[] patternParts = tokenizeToStringArray(pattern,\n                                                            this.pathSeparator);\n        final String[] pathParts = tokenizeToStringArray(path,\n                                                         this.pathSeparator);\n\n        final StringBuilder buffer = new StringBuilder();\n\n        // Add any path parts that have a wildcarded pattern part.\n        int puts = 0;\n        for (int i = 0; i < patternParts.length; i++) {\n            final String patternPart = patternParts[i];\n            if ((patternPart.indexOf('*') > -1 || patternPart.indexOf('?') > -1) && pathParts.length >= i + 1) {\n                if (puts > 0 || (i == 0 && !pattern.startsWith(this.pathSeparator))) {\n                    buffer.append(this.pathSeparator);\n                }\n                buffer.append(pathParts[i]);\n                puts++;\n            }\n        }\n\n        // Append any trailing path parts.\n        for (int i = patternParts.length; i < pathParts.length; i++) {\n            if (puts > 0 || i > 0) {\n                buffer.append(this.pathSeparator);\n            }\n            buffer.append(pathParts[i]);\n        }\n\n        return buffer.toString();\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/regex/util/GlobToRegEx.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.regex.util;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * GlobToRegEx utility class for glob patterns.\n * <p>\n * This code has been borrowed and then adapted from <a href=\"http://http://jakarta.apache.org/oro/\">Jakarta ORO</a>.\n * <p>\n */\npublic final class GlobToRegEx {\n\n    private GlobToRegEx() {\n\n    }\n\n    public static String globToRegex(final String glob) {\n        checkNotNull(\"glob\",\n                     glob);\n        boolean inCharSet = false;\n        final StringBuilder buffer = new StringBuilder(2 * glob.length());\n\n        final char[] pattern = glob.toCharArray();\n        int ch;\n\n        for (ch = 0; ch < pattern.length; ch++) {\n            switch (pattern[ch]) {\n                case '*':\n                    if (inCharSet) {\n                        buffer.append('*');\n                    } else {\n                        buffer.append(\".*\");\n                    }\n                    break;\n                case '?':\n                    if (inCharSet) {\n                        buffer.append('?');\n                    } else {\n                        buffer.append(\".?\");\n                    }\n                    break;\n                case '[':\n                    inCharSet = true;\n                    buffer.append(pattern[ch]);\n\n                    if (ch + 1 < pattern.length) {\n                        switch (pattern[ch + 1]) {\n                            case '!':\n                            case '^':\n                                buffer.append('^');\n                                ++ch;\n                                continue;\n                            case ']':\n                                buffer.append(']');\n                                ++ch;\n                                continue;\n                        }\n                    }\n                    break;\n                case ']':\n                    inCharSet = false;\n                    buffer.append(pattern[ch]);\n                    break;\n                case '\\\\':\n                    buffer.append('\\\\');\n                    if (ch == pattern.length - 1) {\n                        buffer.append('\\\\');\n                    } else if (__isGlobMetaCharacter(pattern[ch + 1])) {\n                        buffer.append(pattern[++ch]);\n                    } else {\n                        buffer.append('\\\\');\n                    }\n                    break;\n                default:\n                    if (!inCharSet && __isRegExMetaCharacter(pattern[ch])) {\n                        buffer.append('\\\\');\n                    }\n                    buffer.append(pattern[ch]);\n                    break;\n            }\n        }\n\n        return buffer.toString();\n    }\n\n    private static boolean __isRegExMetaCharacter(char ch) {\n        return (\"'*?+[]()|^$.{}\\\\\".indexOf(ch) >= 0);\n    }\n\n    private static boolean __isGlobMetaCharacter(char ch) {\n        return (\"*?[]\".indexOf(ch) >= 0);\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/services/cdi/ApplicationStarted.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.services.cdi;\n\npublic class ApplicationStarted {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/services/cdi/Startable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.services.cdi;\n\n/**\n * Interface that allows to wrap startable behavior into single bean for further triggering\n */\npublic interface Startable {\n\n    /**\n     * Start the logic defined in the implementation\n     */\n    void start();\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/services/cdi/Startup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.services.cdi;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Designates the target type as a server-side bean that should be created immediately when the application is deployed\n * within the server. Normally, CDI beans are instantiated lazily when first needed, but {@code @Startup} beans\n * have their PostConstruct methods called early in the server-side CDI application lifecycle.\n */\n@Retention(RUNTIME)\n@Documented\n@Target({TYPE})\npublic @interface Startup {\n\n    /**\n     * Specifies which cohort this {@Startup} bean is initialized in.\n     */\n    StartupType value() default StartupType.EAGER;\n\n    int priority() default 0;\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/services/cdi/StartupType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.services.cdi;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.inject.spi.AfterDeploymentValidation;\n\n/**\n * Argument type for the {@link Startup} annotation.\n */\npublic enum StartupType {\n\n    /**\n     * The target bean's {@link PostConstruct} method will be invoked immediately after the all BOOTSTRAP beans\n     * have had their PostConstruct methods called.\n     * <p>\n     * Among EAGER startup beans, the order they are called is not specified, but it is guaranteed that all BOOTSTRAP\n     * startup beans are processed before any EAGER startup beans are processed.\n     */\n    EAGER,\n\n    /**\n     * The target bean's {@link PostConstruct} method will be invoked immediately after the CDI container fires the\n     * {@code AfterDeploymentValidation} event.\n     * See {@link AfterDeploymentValidation} in the CDI documentation for details.\n     * <p>\n     * Among BOOSTRAP startup beans, the order they are called is not specified, but it is guaranteed that all BOOTSTRAP\n     * startup beans are processed before any EAGER startup beans are processed.\n     */\n    BOOTSTRAP\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/services/cdi/Veto.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.services.cdi;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\n\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Retention(RUNTIME)\n@Target({TYPE})\npublic @interface Veto {\n\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/java/org/uberfire/commons/uuid/UUID.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\n\npackage org.uberfire.commons.uuid;\n\n/**\n * Can be used to make UUID Strings.\n */\npublic class UUID {\n\n    private static final char[] CHARS = \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\".toCharArray();\n\n    /**\n     * Generate a random uuid of the specified length. Example: uuid(15) returns\n     * \"VcydxgltxrVZSTV\"\n     * @param len the desired number of characters\n     */\n    public static String uuid(int len) {\n        return uuid(len,\n                    CHARS.length);\n    }\n\n    /**\n     * Generate a random uuid of the specified length, and radix. Examples:\n     * <ul>\n     * <li>uuid(8, 2) returns \"01001010\" (8 character ID, base=2)\n     * <li>uuid(8, 10) returns \"47473046\" (8 character ID, base=10)\n     * <li>uuid(8, 16) returns \"098F4D35\" (8 character ID, base=16)\n     * </ul>\n     * @param len the desired number of characters\n     * @param radix the number of allowable values for each character (must be <=\n     * 62)\n     */\n    public static String uuid(int len,\n                              int radix) {\n        if (radix > CHARS.length) {\n            throw new IllegalArgumentException(\"Radix must be <= 62, was: \" + radix);\n        }\n        char[] uuid = new char[len];\n        // Compact form\n        for (int i = 0; i < len; i++) {\n            uuid[i] = CHARS[(int) (Math.random() * radix)];\n        }\n        return new String(uuid);\n    }\n\n    /**\n     * Generate a RFC4122, version 4 ID. Example:\n     * \"92329D39-6F5C-4520-ABFC-AAB64544E172\"\n     */\n    public static String uuid() {\n        char[] uuid = new char[36];\n        int r;\n\n        // rfc4122 requires these characters\n        uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';\n        uuid[14] = '4';\n\n        // Fill in random data.  At i==19 set the high bits of clock sequence as\n        // per rfc4122, sec. 4.1.5\n        for (int i = 0; i < 36; i++) {\n            if (uuid[i] == 0) {\n                r = (int) (Math.random() * 16);\n                uuid[i] = CHARS[(i == 19) ? (r & 0x3) | 0x8 : r & 0xf];\n            }\n        }\n        return new String(uuid);\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-commons/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"\n       bean-discovery-mode=\"all\">\n</beans>\n"
  },
  {
    "path": "uberfire-commons/src/main/resources/org/uberfire/commons/UberfireCommons.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.kie.soup.commons.KIESoupCommons'/>\n\n  <source path='data'/>\n  <source path='lifecycle'/>\n  <source path='uuid'/>\n  <source path='clusterapi'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/cluster/BaseClusterJMSServiceTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\npackage org.uberfire.commons.cluster;\n\nimport javax.jms.Connection;\nimport javax.jms.ConnectionFactory;\nimport javax.jms.JMSException;\nimport javax.jms.Session;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic abstract class BaseClusterJMSServiceTest {\n\n    ClusterService clusterService;\n    static ConnectionFactory factory;\n    Connection connection;\n    Session session1;\n    Session session2;\n\n    @Before\n    public void setup() throws JMSException {\n        factory = mock(ConnectionFactory.class);\n        connection = mock(Connection.class);\n        when(factory.createConnection(any(), any())).thenReturn(connection);\n        when(factory.createConnection()).thenReturn(connection);\n        session1 = mock(Session.class);\n        session2 = mock(Session.class);\n        when(connection.createSession(eq(false),\n                                      eq(Session.AUTO_ACKNOWLEDGE)))\n                .thenReturn(session1, session2);\n        clusterService = getClusterService(factory);\n    }\n\n    abstract ClusterService getClusterService(final ConnectionFactory factory);\n\n    @After\n    public void tearDown() {\n        System.clearProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE);\n        System.clearProperty(ClusterParameters.APPFORMER_PROVIDER_URL);\n        System.clearProperty(ClusterParameters.APPFORMER_INITIAL_CONTEXT_FACTORY);\n        System.clearProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_FACTORY);\n        System.clearProperty(ClusterParameters.APPFORMER_JMS_USERNAME);\n        System.clearProperty(ClusterParameters.APPFORMER_JMS_PASSWORD);\n    }\n\n    @Test\n    public void connectTestEmptyUserNameAndPassword() throws JMSException {\n        clusterService.connect();\n        verify(connection).setExceptionListener(any());\n        verify(connection).start();\n        verify(factory).createConnection();\n    }\n\n    @Test\n    public void connectTest() throws JMSException {\n        System.setProperty(ClusterParameters.APPFORMER_JMS_USERNAME, \"dora\");\n        System.setProperty(ClusterParameters.APPFORMER_JMS_PASSWORD, \"bento\");\n\n        clusterService = getClusterService(factory);\n\n        clusterService.connect();\n\n        verify(connection).setExceptionListener(any());\n        verify(connection).start();\n        verify(factory).createConnection(any(), any());\n    }\n\n    @Test\n    public void sessionConsumersCreatedShouldBeClosed() throws JMSException {\n        clusterService.connect();\n\n        clusterService.createConsumer(ClusterJMSService.DestinationType.PubSub,\n                                      \"dora_destination\",\n                                      Object.class,\n                                      l -> {\n                                      });\n        clusterService.createConsumer(ClusterJMSService.DestinationType.PubSub,\n                                      \"dora_destination\",\n                                      Object.class,\n                                      l -> {\n                                      });\n\n        clusterService.close();\n        verify(session1).close();\n        verify(session2).close();\n        verify(connection).close();\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/cluster/ClusterJMSJNDIServiceTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\npackage org.uberfire.commons.cluster;\n\nimport java.util.Hashtable;\n\nimport javax.jms.ConnectionFactory;\nimport javax.naming.Context;\nimport javax.naming.InitialContext;\nimport javax.naming.NamingException;\nimport javax.naming.spi.InitialContextFactory;\n\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClusterJMSJNDIServiceTest extends BaseClusterJMSServiceTest {\n\n    @Override\n    ClusterService getClusterService(ConnectionFactory factory) {\n        System.setProperty(ClusterParameters.APPFORMER_INITIAL_CONTEXT_FACTORY,\n                           this.getClass().getCanonicalName() + \"$MyContextFactory\");\n\n        System.setProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE,\n                           ConnectionMode.JNDI.toString());\n        return new ClusterJMSService();\n    }\n\n    public static class MyContextFactory implements InitialContextFactory {\n\n        @Override\n        public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {\n            final InitialContext mockCtx = mock(InitialContext.class);\n            when(mockCtx.lookup(\"java:/ConnectionFactory\")).thenReturn(factory);\n            return mockCtx;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/cluster/ClusterJMSRemoteServiceTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.cluster;\n\nimport javax.jms.ConnectionFactory;\n\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClusterJMSRemoteServiceTest extends BaseClusterJMSServiceTest {\n\n    @Override\n    ClusterService getClusterService(ConnectionFactory factory) {\n        System.setProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE,\n                           ConnectionMode.REMOTE.toString());\n\n        return new ClusterJMSService() {\n            @Override\n            ConnectionFactory createRemoteConnectionFactory(String jmsURL,\n                                                            String jmsUserName,\n                                                            String jmsPassword) {\n                return factory;\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/cluster/ClusterJMSServiceTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.cluster;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Consumer;\n\nimport javax.jms.Destination;\nimport javax.jms.JMSException;\nimport javax.jms.MessageConsumer;\nimport javax.jms.Session;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClusterJMSServiceTest {\n\n    @Spy\n    private ClusterJMSService clusterService = new ClusterJMSService();\n\n    @Mock\n    private Session session;\n\n    @Mock\n    private Destination destination;\n\n    @Mock\n    private MessageConsumer consumer;\n\n    @Before\n    public void setUp() throws JMSException {\n        doReturn(session).when(clusterService).createConsumerSession();\n        doReturn(destination).when(clusterService).createDestination(any(), any(), any());\n        doReturn(consumer).when(session).createConsumer(any());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void noConnectionModeShouldThrowException() {\n        clusterService.connect();\n    }\n\n    @Test\n    public void testSessionAlreadyCreated() throws Exception {\n\n        String channelName = \"channel\";\n\n        Consumer<Object> consumer = (Object o) -> {\n        };\n\n        clusterService.createConsumer(ClusterService.DestinationType.PubSub, channelName, Object.class, consumer);\n        clusterService.createConsumer(ClusterService.DestinationType.PubSub, channelName, Object.class, consumer);\n\n        verify(clusterService, times(1)).createConsumerSession();\n        verify(clusterService, times(1)).createDestination(eq(ClusterService.DestinationType.PubSub), eq(channelName), eq(session));\n    }\n\n    @Test\n    public void testDoNotSaveSession() throws Exception {\n\n        doReturn(null).when(session).createConsumer(any());\n\n        String channelName = \"channel\";\n\n        Consumer<Object> consumer = (Object o) -> {\n        };\n\n        clusterService.createConsumer(ClusterService.DestinationType.PubSub, channelName, Object.class, consumer);\n        clusterService.createConsumer(ClusterService.DestinationType.PubSub, channelName, Object.class, consumer);\n\n        verify(clusterService, times(2)).createConsumerSession();\n        verify(clusterService, times(2)).createDestination(eq(ClusterService.DestinationType.PubSub), eq(channelName), eq(session));\n        verify(session, times(2)).close();\n    }\n\n}"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/cluster/events/ClusterEventObserverTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.commons.cluster.events;\n\nimport java.lang.annotation.Annotation;\nimport java.util.concurrent.CompletionStage;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.EventMetadata;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.enterprise.util.TypeLiteral;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.commons.cluster.ClusterJMSService;\nimport org.uberfire.commons.clusterapi.Clustered;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClusterEventObserverTest {\n\n    ClusterJMSService clusterService;\n    ClusterEventObserver observer;\n\n    @Before\n    public void setup() {\n        clusterService = mock(ClusterJMSService.class);\n        observer = setupMock();\n    }\n\n    @Mock\n    private EventSourceMock<Object> eventBus;\n\n    @Test\n    public void consumeTestOtherSenderNode() {\n        observer.consumeMessage(eventBus,\n                                new ClusterSerializedCDIMessageWrapper(\"wrongNode\",\n                                                                       \"json\",\n                                                                       \"fqcn\"));\n        verify(eventBus).fire(any());\n    }\n\n    @Test\n    public void consumeTestMyMessages() {\n        observer.consumeMessage(eventBus,\n                                new ClusterSerializedCDIMessageWrapper(observer.getNodeId(),\n                                                                       \"json\",\n                                                                       \"fqcn\"));\n        verify(eventBus,\n               never()).fire(any());\n    }\n\n    @Test\n    public void shouldBroadCastMessagesOnlyOnCluster() {\n        when(clusterService.isAppFormerClustered()).thenReturn(false);\n\n        observer.broadcast(new Object());\n\n        verify(clusterService,\n               never()).broadcast(any(),\n                                  any(),\n                                  any());\n    }\n\n    @Test\n    public void shouldBroadCastMessages() {\n        when(clusterService.isAppFormerClustered()).thenReturn(true);\n\n        observer.broadcast(new EventTest());\n\n        verify(clusterService).broadcast(any(),\n                                         any(),\n                                         any());\n    }\n\n    @Test\n    public void shouldObserveThisEventTest() {\n        EventMetadata eventMetadataMock = mock(EventMetadata.class);\n        InjectionPoint injectionPointMock = mock(InjectionPoint.class);\n        Bean beanMock = mock(Bean.class);\n        when(eventMetadataMock.getInjectionPoint()).thenReturn(injectionPointMock);\n        when(injectionPointMock.getBean()).thenReturn(beanMock);\n\n        assertFalse(observer.shouldObserveThisEvent(new Object(),\n                                                    null));\n        assertTrue(observer.shouldObserveThisEvent(new EventTest(),\n                                                   null));\n\n        when(beanMock.getBeanClass()).thenReturn(Object.class);\n        assertTrue(observer.shouldObserveThisEvent(new EventTest(),\n                                                   eventMetadataMock));\n\n        when(beanMock.getBeanClass()).thenReturn(observer.getClass());\n        assertFalse(observer.shouldObserveThisEvent(new EventTest(),\n                                                    eventMetadataMock));\n\n        when(eventMetadataMock.getInjectionPoint()).thenReturn(null);\n        assertTrue(observer.shouldObserveThisEvent(new EventTest(),\n                                                   eventMetadataMock));\n    }\n\n    @Portable\n    @Clustered\n    public static class EventTest {\n\n    }\n\n    private ClusterEventObserver setupMock() {\n        return new ClusterEventObserver() {\n            @Override\n            ClusterJMSService getClusterService() {\n                return clusterService;\n            }\n\n            @Override\n            Object fromJSON(ClusterSerializedCDIMessageWrapper message) {\n                return new Object();\n            }\n\n            @Override\n            String toJSON(Object event) {\n                return \"Dora\";\n            }\n        };\n    }\n\n    // duplicated from uberfire test utils in order to avoid cyclic reference\n    public class EventSourceMock<T> implements Event<T> {\n\n        @Override\n        public void fire(T event) {\n            throw new UnsupportedOperationException(\"mocking testing class\");\n        }\n\n        @Override\n        public <U extends T> CompletionStage<U> fireAsync(U u) {\n            return null;\n        }\n\n        @Override\n        public <U extends T> CompletionStage<U> fireAsync(U u,\n                                                          NotificationOptions notificationOptions) {\n            return null;\n        }\n\n        @Override\n        public Event<T> select(Annotation... qualifiers) {\n            throw new UnsupportedOperationException(\"mocking testing class\");\n        }\n\n        @Override\n        public <U extends T> Event<U> select(Class<U> subtype,\n                                             Annotation... qualifiers) {\n            throw new UnsupportedOperationException(\"mocking testing class\");\n        }\n\n        @Override\n        public <U extends T> Event<U> select(TypeLiteral<U> subtype,\n                                             Annotation... qualifiers) {\n            return null;\n        }\n    }\n}\n\n"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/concurrent/ExecutorServiceProducerTest.java",
    "content": "package org.uberfire.commons.concurrent;\n\nimport java.util.concurrent.ThreadPoolExecutor;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class ExecutorServiceProducerTest {\n\n    @Before\n    public void setUp() {\n        System.clearProperty(ExecutorServiceProducer.MANAGED_LIMIT_PROPERTY);\n    }\n\n    @Test\n    public void testSystemPropertySet() {\n        System.setProperty(ExecutorServiceProducer.MANAGED_LIMIT_PROPERTY,\n                           \"1000\");\n        ExecutorServiceProducer producer = new ExecutorServiceProducer();\n        ThreadPoolExecutor executor = (ThreadPoolExecutor) producer.buildFixedThreadPoolExecutorService(ExecutorServiceProducer.MANAGED_LIMIT_PROPERTY);\n        assertEquals(1000,\n                     executor.getMaximumPoolSize());\n    }\n\n    @Test\n    public void testSystemPropertyNotSet() {\n        System.clearProperty(ExecutorServiceProducer.MANAGED_LIMIT_PROPERTY);\n        ExecutorServiceProducer producer = new ExecutorServiceProducer();\n        ThreadPoolExecutor executor = (ThreadPoolExecutor) producer.buildFixedThreadPoolExecutorService(ExecutorServiceProducer.MANAGED_LIMIT_PROPERTY);\n        assertEquals(2147483647,\n                     executor.getMaximumPoolSize());\n    }\n}"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/lifecycle/PriorityDisposableRegistryTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.lifecycle;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class PriorityDisposableRegistryTest {\n\n    @Test\n    public void testGeneralDisposableState() {\n        final PriorityDisposable mocked1 = mock(PriorityDisposable.class);\n        final PriorityDisposable mocked2 = mock(PriorityDisposable.class);\n\n        PriorityDisposableRegistry.clear();\n        assertEquals(0,\n                     PriorityDisposableRegistry.getDisposables().size());\n        PriorityDisposableRegistry.register(mocked1);\n        assertEquals(1,\n                     PriorityDisposableRegistry.getDisposables().size());\n        PriorityDisposableRegistry.register(mocked1);\n        assertEquals(1,\n                     PriorityDisposableRegistry.getDisposables().size());\n        PriorityDisposableRegistry.register(mocked2);\n        assertEquals(2,\n                     PriorityDisposableRegistry.getDisposables().size());\n        PriorityDisposableRegistry.clear();\n        assertEquals(0,\n                     PriorityDisposableRegistry.getDisposables().size());\n    }\n\n    @Test\n    public void testGeneralRegistryState() {\n        final PriorityDisposable mocked1 = mock(PriorityDisposable.class);\n        final PriorityDisposable mocked2 = mock(PriorityDisposable.class);\n\n        PriorityDisposableRegistry.clear();\n        assertEquals(0,\n                     PriorityDisposableRegistry.getRegistry().size());\n        PriorityDisposableRegistry.register(\"refName\",\n                                            mocked1);\n        assertEquals(1,\n                     PriorityDisposableRegistry.getRegistry().size());\n        PriorityDisposableRegistry.register(\"refName\",\n                                            mocked1);\n        assertEquals(1,\n                     PriorityDisposableRegistry.getRegistry().size());\n        PriorityDisposableRegistry.register(\"refName1\",\n                                            mocked2);\n        assertEquals(2,\n                     PriorityDisposableRegistry.getRegistry().size());\n        PriorityDisposableRegistry.unregister(\"refName\");\n        assertEquals(1,\n                     PriorityDisposableRegistry.getRegistry().size());\n        PriorityDisposableRegistry.clear();\n        assertEquals(0,\n                     PriorityDisposableRegistry.getRegistry().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/regex/util/GlobToRegExTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.commons.regex.util;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class GlobToRegExTest {\n\n    @Test\n    public void simpleTest() {\n        assertEquals(\".*\\\\.txt\",\n                     GlobToRegEx.globToRegex(\"*.txt\"));\n        assertEquals(\"myfile\\\\.txt\",\n                     GlobToRegEx.globToRegex(\"myfile.txt\"));\n        assertEquals(\".?at\\\\.txt\",\n                     GlobToRegEx.globToRegex(\"?at.txt\"));\n        assertEquals(\"Law.*\",\n                     GlobToRegEx.globToRegex(\"Law*\"));\n        assertEquals(\"[CB]at\\\\.txt\",\n                     GlobToRegEx.globToRegex(\"[CB]at.txt\"));\n        assertEquals(\"Law\\\\*\",\n                     GlobToRegEx.globToRegex(\"Law\\\\*\"));\n        assertEquals(\"\",\n                     GlobToRegEx.globToRegex(\"\"));\n        assertEquals(\"/\",\n                     GlobToRegEx.globToRegex(\"/\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void simpleNull() {\n        GlobToRegEx.globToRegex(null);\n    }\n}\n"
  },
  {
    "path": "uberfire-commons/src/test/java/org/uberfire/commons/uuid/UUIDTest.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage org.uberfire.commons.uuid;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class UUIDTest {\n\n    @Test\n    public void hasFiveGroups() throws\n            Exception {\n        final String uuid = UUID.uuid();\n        final String[] split = uuid.split(\"-\");\n        assertEquals(5,\n                     split.length);\n    }\n\n    @Test\n    public void generateWithGivenLength() throws\n            Exception {\n        assertEquals(12,\n                     UUID.uuid(12)\n                             .length());\n        assertEquals(6,\n                     UUID.uuid(6)\n                             .length());\n        assertEquals(100,\n                     UUID.uuid(100)\n                             .length());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void tooLongRadix() throws\n            Exception {\n        UUID.uuid(10,\n                  63);\n    }\n\n    @Test\n    public void generateWithGivenLengthAndRadix() throws\n            Exception {\n        assertOnlyContainsCharacters(UUID.uuid(10,\n                                               2),\n                                     \"0\",\n                                     \"1\");\n    }\n\n    private void assertOnlyContainsCharacters(final String uuid,\n                                              final String... chars) {\n\n        String tmp = uuid;\n        for (final String aChar : chars) {\n            tmp = tmp.replaceAll(aChar,\n                                 \"\");\n        }\n\n        assertTrue(\"Found illegal characters: \" + tmp,\n                   tmp.isEmpty());\n    }\n}"
  },
  {
    "path": "uberfire-experimental/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-experimental</artifactId>\n  <name>Uberfire Experimental</name>\n\n  <packaging>pom</packaging>\n\n  <modules>\n    <module>uberfire-experimental-api</module>\n    <module>uberfire-experimental-backend</module>\n    <module>uberfire-experimental-client</module>\n  </modules>\n\n</project>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-experimental</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-experimental-api</artifactId>\n  <name>Uberfire Experimental API</name>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/definition/annotations/ExperimentalFeature.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.definition.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Marks an element as a workbench Experimental Feature. It can be used to annotate:\n * <p>\n * <ul>\n * <li>WorkbenchPerspectives</li>\n * <li>WorkbenchScreens</li>\n * <li>WorkbenchEditors</li>\n * <li>ResourceTypes</li>\n * <li>LayoutDragComponents</li>\n * </ul>\n * </p>\n */\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface ExperimentalFeature {\n\n    /**\n     * Scope of the ExperimentalFeature. By default a feature is user\n     */\n    Scope scope() default Scope.USER;\n\n    /**\n     * Determines the a logic group of features. When no group is defined features are added into a default group.\n     */\n    String group() default \"\";\n\n    /**\n     * Determines the i18n key to get the feature name if no key is defined the class name will be used as a key\n     */\n    String nameI18nKey() default \"\";\n\n    /**\n     * Determines the i18n key to get the description of the feature. If no key is defined it won't have any description\n     */\n    String descriptionI18nKey() default \"\";\n\n    /**\n     * Determines the scope of the feature.\n     */\n    enum Scope {\n        /**\n         * Experimental features with GLOBAL scope can only be enabled/disabled by admin users.\n         */\n        GLOBAL,\n        /**\n         * Experimental features with USER scope can be enabled/disabled by each user.\n         */\n        USER\n    }\n}\n\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/ExperimentalFeaturesRegistryService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service;\n\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\n\n/**\n * Basic definition of the service that manages the ExperimentalFeaturesFramework\n */\npublic interface ExperimentalFeaturesRegistryService {\n\n    /**\n     * Retrieves the actual {@link ExperimentalFeaturesRegistry} for the user\n     * @return\n     */\n    ExperimentalFeaturesRegistry getFeaturesRegistry();\n\n    /**\n     * Determines if a given feature is enabled or not.\n     * @param featureId a String containing the identifier of an existing feature\n     * @return true if the feature is enabled, false if it is disabled\n     */\n    boolean isFeatureEnabled(String featureId);\n\n    /**\n     * Determines if the experimental framework is enabled or not\n     * @return true if it is enabled, false if not\n     */\n    Boolean isExperimentalEnabled();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/auth/ExperimentalActivitiesAuthorizationManager.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.auth;\n\nimport org.uberfire.mvp.impl.ConditionalPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * Handles authorization management for any activity marked as experimental\n */\npublic interface ExperimentalActivitiesAuthorizationManager {\n\n    /**\n     * Initializes the manager\n     */\n    void init();\n\n    /**\n     * Determines if the experimental framework enables rendering a given activity\n     * @param activity The activity to check\n     * @return true or false depending on the settings.\n     */\n    boolean authorizeActivity(Object activity);\n\n    /**\n     * Determines if the experimental framework enables rendering a given Class\n     * @param activityClass The Class to check\n     * @return true or false depending on the settings.\n     */\n    boolean authorizeActivityClass(Class<?> activityClass);\n\n    /**\n     * Determines if the experimental framework enables rendering a the activity identified by the activityId param.\n     * @param activityId the activity identifier\n     * @return true or false depending on the settings.\n     */\n    boolean authorizeActivityId(String activityId);\n\n    /**\n     * Checks if the {@link PartDefinition} place points to an experimental activity and replaces it to a {@link ConditionalPlaceRequest}\n     * @param part The {@link PartDefinition} to check\n     * @param panel The {@link PanelDefinition} that owns the plart\n     */\n    void securePart(PartDefinition part, PanelDefinition panel);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/backend/BackendExperimentalFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.backend;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\n\n@Remote\npublic interface BackendExperimentalFeatureDefRegistry extends ExperimentalFeatureDefRegistry {\n\n    Collection<ExperimentalFeatureDefinition> loadFeatureDefinitions(Collection<ExperimentalFeatureDefinition> clientDefinitions);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/backend/BackendExperimentalFeaturesRegistryService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.backend;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * Definition of the Backend Service to lookup the user {@link ExperimentalFeaturesSession}\n */\n@Remote\npublic interface BackendExperimentalFeaturesRegistryService {\n\n    /**\n     * Retrieves the current {@link ExperimentalFeaturesSession}\n     * @return the current {@link ExperimentalFeaturesSession}\n     */\n    ExperimentalFeaturesSession getExperimentalFeaturesSession();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/backend/ExperimentalFeaturesSession.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.backend;\n\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\n\n/**\n * Actual state of the Experimental Features Framework for the current user\n */\npublic interface ExperimentalFeaturesSession {\n\n    /**\n     * Retrieves the {@link ExperimentalFeaturesRegistry} based on the user settings.\n     * @return The {@link ExperimentalFeaturesRegistry} for the current user\n     */\n    ExperimentalFeaturesRegistry getFeaturesRegistry();\n\n    /**\n     * Determines if the experimental framework is enabled or not\n     * @return true if it is enabled, false if not\n     */\n    boolean isExperimentalFeaturesEnabled();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/backend/impl/ExperimentalFeaturesSessionImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.backend.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.backend.ExperimentalFeaturesSession;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\n\n@Portable\npublic class ExperimentalFeaturesSessionImpl implements ExperimentalFeaturesSession {\n\n    private boolean experimentalFeaturesEnabled;\n    private ExperimentalFeaturesRegistryImpl registry;\n\n    public ExperimentalFeaturesSessionImpl() {\n    }\n\n    public ExperimentalFeaturesSessionImpl(@MapsTo(\"experimentalFeaturesEnabled\") boolean experimentalFeaturesEnabled, @MapsTo(\"registry\") ExperimentalFeaturesRegistryImpl registry) {\n        this.experimentalFeaturesEnabled = experimentalFeaturesEnabled;\n        this.registry = registry;\n    }\n\n    @Override\n    public ExperimentalFeaturesRegistryImpl getFeaturesRegistry() {\n        return registry;\n    }\n\n    public void setRegistry(ExperimentalFeaturesRegistryImpl registry) {\n        this.registry = registry;\n    }\n\n    public void setExperimentalFeaturesEnabled(boolean experimentalFeaturesEnabled) {\n        this.experimentalFeaturesEnabled = experimentalFeaturesEnabled;\n    }\n\n    @Override\n    public boolean isExperimentalFeaturesEnabled() {\n        return experimentalFeaturesEnabled;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/definition/ExperimentalFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.definition;\n\nimport java.util.Collection;\n\n/**\n * Registry of all the {@link ExperimentalFeatureDefinition} on the platform\n */\npublic interface ExperimentalFeatureDefRegistry {\n\n    /**\n     * Returns the {@link ExperimentalFeatureDefinition} identified by the definitionId param\n     * @param definitionId the definitionId to get the {@link ExperimentalFeatureDefinition}\n     * @return the {@link ExperimentalFeatureDefinition} identified by the definitionId param or null if it doesn't exist\n     */\n    ExperimentalFeatureDefinition getFeatureById(String definitionId);\n\n    /**\n     * Lists all the {@link ExperimentalFeatureDefinition} available on the platform\n     * @return a Collection containing all the {@link ExperimentalFeatureDefinition}\n     */\n    Collection<ExperimentalFeatureDefinition> getAllFeatures();\n\n    /**\n     * Lists all the global {@link ExperimentalFeatureDefinition}\n     * @return a Collection containing all the {@link ExperimentalFeatureDefinition}\n     */\n    Collection<ExperimentalFeatureDefinition> getGlobalFeatures();\n\n    /**\n     * Lists the user-level {@link ExperimentalFeatureDefinition}\n     * @return a Collection containing {@link ExperimentalFeatureDefinition}\n     */\n    Collection<ExperimentalFeatureDefinition> getUserFeatures();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/definition/ExperimentalFeatureDefinition.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.definition;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Definition of an experimental feature\n */\n@Portable\npublic class ExperimentalFeatureDefinition {\n\n    private String id;\n    private boolean global;\n    private String group;\n    private String nameKey;\n    private String descriptionKey;\n\n    public ExperimentalFeatureDefinition(@MapsTo(\"id\") String id, @MapsTo(\"global\") boolean global, @MapsTo(\"group\") String group, @MapsTo(\"nameKey\") String nameKey, @MapsTo(\"descriptionKey\") String descriptionKey) {\n        this.id = id;\n        this.global = global;\n        this.group = group;\n        this.nameKey = nameKey;\n        this.descriptionKey = descriptionKey;\n    }\n\n    /**\n     * Unique id for the feature definition\n     * @return a String with the unique id\n     */\n    public String getId() {\n        return id;\n    }\n\n    public boolean isGlobal() {\n        return global;\n    }\n\n    public String getGroup() {\n        return group;\n    }\n\n    /**\n     * I18n key for that contains the name for the feature\n     * @return a String containing the I18n key\n     */\n    public String getNameKey() {\n        return nameKey;\n    }\n\n    /**\n     * I18n key for that contains the description for the feature\n     * @return a String containing the I18n key, can be null\n     */\n    public String getDescriptionKey() {\n        return descriptionKey;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public void setGlobal(boolean global) {\n        this.global = global;\n    }\n\n    public void setGroup(String group) {\n        this.group = group;\n    }\n\n    public void setNameKey(String nameKey) {\n        this.nameKey = nameKey;\n    }\n\n    public void setDescriptionKey(String descriptionKey) {\n        this.descriptionKey = descriptionKey;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/definition/ExperimentalFeatureDefinitionProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.definition;\n\npublic interface ExperimentalFeatureDefinitionProvider {\n\n    ExperimentalFeatureDefinition getDefinition();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/definition/impl/ExperimentalFeatureDefRegistryImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.definition.impl;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\npublic class ExperimentalFeatureDefRegistryImpl implements ExperimentalFeatureDefRegistry {\n\n    protected Map<String, ExperimentalFeatureDefinition> features = new HashMap<>();\n\n    public void register(ExperimentalFeatureDefinitionProvider definitionProvider) {\n        register(definitionProvider.getDefinition());\n    }\n\n    public void register(ExperimentalFeatureDefinition featureDefinition) {\n        features.put(featureDefinition.getId(), featureDefinition);\n    }\n\n    @Override\n    public ExperimentalFeatureDefinition getFeatureById(String definitionId) {\n        return features.get(definitionId);\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> getAllFeatures() {\n        return Collections.unmodifiableCollection(features.values());\n    }\n\n    public Collection<ExperimentalFeatureDefinition> getGlobalFeatures() {\n        return Collections.unmodifiableCollection(features.values().stream().filter(ExperimentalFeatureDefinition::isGlobal).collect(Collectors.toList()));\n    }\n\n    public Collection<ExperimentalFeatureDefinition> getUserFeatures() {\n        return Collections.unmodifiableCollection(features.values().stream().filter(feature -> !feature.isGlobal()).collect(Collectors.toList()));\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/editor/EditableExperimentalFeature.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.editor;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\n\n@Portable\npublic class EditableExperimentalFeature {\n\n    private String featureId;\n    private boolean enabled;\n\n    public EditableExperimentalFeature(@MapsTo(\"featureId\") String featureId, @MapsTo(\"enabled\") boolean enabled) {\n        this.featureId = featureId;\n        this.enabled = enabled;\n    }\n\n    public EditableExperimentalFeature(ExperimentalFeature feature) {\n        this.featureId = feature.getFeatureId();\n        this.enabled = feature.isEnabled();\n    }\n\n    public String getFeatureId() {\n        return featureId;\n    }\n\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    public void setEnabled(boolean enabled) {\n        this.enabled = enabled;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/editor/FeaturesEditorService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.editor;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface FeaturesEditorService {\n\n    void save(EditableExperimentalFeature editableFeature);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/events/ExperimentalFeatureModifiedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.events;\n\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\n\npublic abstract class ExperimentalFeatureModifiedEvent {\n\n    private ExperimentalFeature feature;\n\n    public ExperimentalFeatureModifiedEvent(ExperimentalFeature feature) {\n        this.feature = feature;\n    }\n\n    public ExperimentalFeature getFeature() {\n        return feature;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/events/NonPortableExperimentalFeatureModifiedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.events;\n\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\n\npublic class NonPortableExperimentalFeatureModifiedEvent extends ExperimentalFeatureModifiedEvent {\n\n    public NonPortableExperimentalFeatureModifiedEvent(ExperimentalFeature feature) {\n        super(feature);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/events/PortableExperimentalFeatureModifiedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.events;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\n\n@Portable\npublic class PortableExperimentalFeatureModifiedEvent extends ExperimentalFeatureModifiedEvent {\n\n    public PortableExperimentalFeatureModifiedEvent(@MapsTo(\"feature\") ExperimentalFeature feature) {\n        super(feature);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/registry/ExperimentalFeature.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.registry;\n\n/**\n * Defines the state of an experimental feature\n */\npublic interface ExperimentalFeature {\n\n    /**\n     * Returns the feature Id\n     * @return a String containing the Identifier of a given feature.\n     */\n    String getFeatureId();\n\n    /**\n     * Returns if the feature is enabled or disabled\n     * @return true if the feature is enabled or false if it is disabled\n     */\n    boolean isEnabled();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/registry/ExperimentalFeaturesRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.registry;\n\nimport java.util.Collection;\nimport java.util.Optional;\n\n/**\n * Registry of all {@link ExperimentalFeature} present on the platform\n */\npublic interface ExperimentalFeaturesRegistry {\n\n    /**\n     * Determines if a given feature is enabled or not.\n     * @param featureId a String containing the identifier of an existing feature\n     * @return true if the feature is enabled, false if it is disabled\n     */\n    boolean isFeatureEnabled(String featureId);\n\n    /**\n     * Returns the {@link ExperimentalFeature} identified by the given featureID\n     * @param featureId a String containing the identifier of an existing feature\n     * @return the {@link ExperimentalFeature} instance identified by the featureId if is present on the platform,\n     * null if it doesn't exist\n     */\n    Optional<ExperimentalFeature> getFeature(String featureId);\n\n    /**\n     * Returns all the {@link ExperimentalFeature} present on the platform\n     * @return a List containing all {@link ExperimentalFeature} present on the platform\n     */\n    Collection<ExperimentalFeature> getAllFeatures();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/registry/impl/ExperimentalFeatureImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.registry.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\n\n@Portable\npublic class ExperimentalFeatureImpl implements ExperimentalFeature {\n\n    private String featureId;\n    private boolean enabled;\n\n    public ExperimentalFeatureImpl() {\n    }\n\n    public ExperimentalFeatureImpl(@MapsTo(\"featureId\") String featureId, @MapsTo(\"enabled\") boolean enabled) {\n        this.featureId = featureId;\n        this.enabled = enabled;\n    }\n\n    @Override\n    public String getFeatureId() {\n        return featureId;\n    }\n\n    public void setFeatureId(String featureId) {\n        this.featureId = featureId;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    public void setEnabled(boolean enabled) {\n        this.enabled = enabled;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        ExperimentalFeatureImpl feature = (ExperimentalFeatureImpl) o;\n\n        if (enabled != feature.enabled) {\n            return false;\n        }\n        return featureId.equals(feature.featureId);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = featureId.hashCode();\n        result = 31 * result + (enabled ? 1 : 0);\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/registry/impl/ExperimentalFeaturesRegistryImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.registry.impl;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\n\n@Portable\npublic class ExperimentalFeaturesRegistryImpl implements ExperimentalFeaturesRegistry {\n\n    private List<ExperimentalFeatureImpl> features;\n\n    public ExperimentalFeaturesRegistryImpl(@MapsTo(\"features\") List<ExperimentalFeatureImpl> features) {\n        this.features = features;\n    }\n\n    @Override\n    public Optional<ExperimentalFeature> getFeature(String featureId) {\n        return features.stream()\n                .filter(feature -> feature.getFeatureId().equals(featureId))\n                .map(feature -> (ExperimentalFeature) feature)\n                .findAny();\n    }\n\n    @Override\n    public boolean isFeatureEnabled(String featureId) {\n\n        Optional<ExperimentalFeature> optional = getFeature(featureId);\n\n        if (optional.isPresent()) {\n            return optional.get().isEnabled();\n        }\n\n        return true;\n    }\n\n    @Override\n    public Collection<ExperimentalFeature> getAllFeatures() {\n        return Collections.unmodifiableList(features);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/security/GlobalExperimentalFeatureAction.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.security;\n\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.security.ResourceAction;\n\n/**\n * Actions for global {@link ExperimentalFeature}\n */\npublic interface GlobalExperimentalFeatureAction extends ResourceAction {\n\n    GlobalExperimentalFeatureAction EDIT = () -> \"edit\";\n}"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/java/org/uberfire/experimental/service/security/GlobalExperimentalFeatureResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.security;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.security.ResourceType;\n\n/**\n * The resource type for global scoped {@link ExperimentalFeature}.\n */\n@Portable\npublic class GlobalExperimentalFeatureResourceType implements ResourceType {\n\n    @Override\n    public String getName() {\n        return \"globalExperimentalFeatures\";\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#     http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-api/src/main/resources/org/uberfire/experimental/UberfireExperimentalAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n\n  <source path='service'/>\n\n</module>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-experimental</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-experimental-backend</artifactId>\n  <name>Uberfire Experimental Backend</name>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <!-- test -->\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/BackendExperimentalFeaturesRegistryServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.backend.ExperimentalFeaturesSession;\nimport org.uberfire.experimental.service.backend.impl.ExperimentalFeaturesSessionImpl;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.editor.FeaturesEditorService;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\nimport org.uberfire.experimental.service.storage.ExperimentalFeaturesStorage;\n\n@Service\n@ApplicationScoped\npublic class BackendExperimentalFeaturesRegistryServiceImpl implements ExperimentalFeaturesRegistryService,\n                                                                       BackendExperimentalFeaturesRegistryService,\n                                                                       FeaturesEditorService {\n\n    public static final String EXPERIMENTAL_FEATURES_PROPERTY_NAME = \"appformer.experimental.features\";\n\n    private final ExperimentalFeatureDefRegistry defRegistry;\n\n    private ExperimentalFeaturesStorage globalStorage;\n\n\n    @Inject\n    public BackendExperimentalFeaturesRegistryServiceImpl(final ExperimentalFeatureDefRegistry defRegistry, @Named(\"global\") final ExperimentalFeaturesStorage globalStorage) {\n        this.defRegistry = defRegistry;\n        this.globalStorage = globalStorage;\n    }\n\n    @Override\n    public ExperimentalFeaturesRegistryImpl getFeaturesRegistry() {\n        return loadRegistry();\n    }\n\n    @Override\n    public Boolean isExperimentalEnabled() {\n        return Boolean.parseBoolean(System.getProperty(EXPERIMENTAL_FEATURES_PROPERTY_NAME, \"false\"));\n    }\n\n    @Override\n    public boolean isFeatureEnabled(String featureId) {\n\n        ExperimentalFeaturesRegistryImpl registry = getFeaturesRegistry();\n\n        if(!registry.getFeature(featureId).isPresent()) {\n            return true;\n        }\n\n        return isExperimentalEnabled() && getFeaturesRegistry().isFeatureEnabled(featureId);\n    }\n\n    @Override\n    public void save(EditableExperimentalFeature editableFeature) {\n\n        if(!isExperimentalEnabled()) {\n            throw new IllegalStateException(\"Impossible edit feature '\" + editableFeature.getFeatureId() + \"': Experimental Framework is disabled\");\n        }\n\n        Optional<ExperimentalFeatureDefinition> optional = Optional.ofNullable(defRegistry.getFeatureById(editableFeature.getFeatureId()));\n\n        if (optional.isPresent()) {\n            ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(editableFeature.getFeatureId(), editableFeature.isEnabled());\n\n            globalStorage.store(feature);\n        } else {\n            throw new IllegalArgumentException(\"Cannot find ExperimentalFeature '\" + editableFeature.getFeatureId() + \"'\");\n        }\n    }\n\n    private ExperimentalFeaturesRegistryImpl loadRegistry() {\n        List<ExperimentalFeatureImpl> features = new ArrayList<>();\n\n        features.addAll(globalStorage.getFeatures());\n\n        return new ExperimentalFeaturesRegistryImpl(features);\n    }\n\n    @Override\n    public ExperimentalFeaturesSession getExperimentalFeaturesSession() {\n        return new ExperimentalFeaturesSessionImpl(isExperimentalEnabled(), getFeaturesRegistry());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/definition/impl/CDIBackendFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.definition.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n@Service\n@ApplicationScoped\npublic class CDIBackendFeatureDefRegistry extends ExperimentalFeatureDefRegistryImpl implements BackendExperimentalFeatureDefRegistry {\n\n    @Inject\n    public CDIBackendFeatureDefRegistry(Instance<ExperimentalFeatureDefinitionProvider> definitionProviders) {\n        for (ExperimentalFeatureDefinitionProvider definitionProvider : definitionProviders) {\n            register(definitionProvider);\n        }\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureDefinition> loadFeatureDefinitions(Collection<ExperimentalFeatureDefinition> clientDefinitions) {\n\n        if(clientDefinitions != null) {\n            clientDefinitions\n                    .stream()\n                    .filter(clientDefinition -> !features.containsKey(clientDefinition.getId()))\n                    .forEach(this::register);\n        }\n\n        return new ArrayList<>(features.values());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/ExperimentalFeaturesStorage.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage;\n\nimport java.util.Collection;\n\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\n\npublic interface ExperimentalFeaturesStorage {\n\n    Collection<ExperimentalFeatureImpl> getFeatures();\n\n    void store(ExperimentalFeatureImpl experimentalFeature);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/impl/ExperimentalFeaturesStorageImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.impl;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.ExperimentalFeaturesStorage;\nimport org.uberfire.experimental.service.storage.migration.StorageMigrationService;\nimport org.uberfire.experimental.service.storage.scoped.ExperimentalStorageScope;\nimport org.uberfire.experimental.service.storage.scoped.ScopedExperimentalFeaturesStorage;\nimport org.uberfire.experimental.service.storage.util.ExperimentalConstants;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.util.*;\n\nimport static org.uberfire.experimental.service.storage.util.ExperimentalConstants.COMMENTS;\n\n@Named(\"global\")\npublic class ExperimentalFeaturesStorageImpl implements ExperimentalFeaturesStorage {\n    private static final Logger LOGGER = LoggerFactory.getLogger(ExperimentalFeaturesStorageImpl.class);\n\n    private Properties settings;\n    private FileSystem fileSystem;\n    private Map<ExperimentalStorageScope, ScopedExperimentalFeaturesStorage> storages = new HashMap<>();\n\n    private SpacesAPI spaces;\n    private IOService ioService;\n    private ExperimentalFeatureDefRegistry defRegistry;\n    private Instance<ScopedExperimentalFeaturesStorage> instances;\n    private StorageMigrationService migrationService;\n\n    @Inject\n    public ExperimentalFeaturesStorageImpl(final SpacesAPI spaces, @Named(\"configIO\") final IOService ioService, final ExperimentalFeatureDefRegistry defRegistry, final Instance<ScopedExperimentalFeaturesStorage> instances, final StorageMigrationService migrationService) {\n        this.spaces = spaces;\n        this.ioService = ioService;\n        this.defRegistry = defRegistry;\n        this.instances = instances;\n        this.migrationService = migrationService;\n    }\n\n    @PostConstruct\n    public void init() {\n        initializeFileSystem();\n\n        for (ScopedExperimentalFeaturesStorage storage : instances) {\n            storage.init(fileSystem);\n            storages.put(storage.getScope(), storage);\n        }\n\n        readSettings();\n\n        checkVersion();\n    }\n\n    private void readSettings() {\n        Path settingsPath = fileSystem.getPath(ExperimentalConstants.EXPERIMENTAL_SETTINGS_PATH);\n        if (ioService.exists(settingsPath)) {\n            settings = new Properties();\n            try (InputStream in = ioService.newInputStream(settingsPath)){\n                settings.load(in);\n            } catch (Exception e) {\n                LOGGER.error(\"Couldn't read properties file\");\n            }\n        } else {\n            settings = new Properties();\n        }\n    }\n\n    private void checkVersion() {\n        int currentVersion = Integer.parseInt(settings.getOrDefault(ExperimentalConstants.EXPERIMENTAL_VERSION_KEY, \"1\").toString());\n\n        if (currentVersion < ExperimentalConstants.EXPERIMENTAL_VERSION) {\n            migrationService.migrate(ExperimentalConstants.EXPERIMENTAL_VERSION, fileSystem);\n\n            settings.setProperty(ExperimentalConstants.EXPERIMENTAL_VERSION_KEY, ExperimentalConstants.EXPERIMENTAL_VERSION.toString());\n\n            saveSettings();\n        }\n    }\n\n    private void saveSettings() {\n        Path settingsPath = fileSystem.getPath(ExperimentalConstants.EXPERIMENTAL_SETTINGS_PATH);\n\n        try (OutputStream out = ioService.newOutputStream(settingsPath)) {\n            ioService.startBatch(fileSystem);\n            settings.store(out, COMMENTS);\n\n        } catch (Exception ex) {\n            LOGGER.warn(\"Impossible to write experimental features registry on '{}': {}\", settingsPath, ex);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureImpl> getFeatures() {\n        List<ExperimentalFeatureImpl> features = new ArrayList<>();\n\n        storages.values().forEach(storage -> features.addAll(storage.getFeatures()));\n\n        return features;\n    }\n\n    @Override\n    public void store(ExperimentalFeatureImpl experimentalFeature) {\n        Optional<ExperimentalFeatureDefinition> optional = Optional.ofNullable(defRegistry.getFeatureById(experimentalFeature.getFeatureId()));\n        optional.ifPresent(definition -> storages.get(ExperimentalStorageScope.getScope(definition)).store(experimentalFeature));\n    }\n\n    protected void initializeFileSystem() {\n        final URI fileSystemURI = spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, \"preferences\");\n\n        try {\n            Map<String, Object> options = new HashMap<>();\n\n            options.put(\"init\", Boolean.TRUE);\n            options.put(\"internal\", Boolean.TRUE);\n\n            fileSystem = ioService.newFileSystem(fileSystemURI, options);\n        } catch (FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(fileSystemURI);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/migration/StorageMigration.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration;\n\nimport org.uberfire.java.nio.file.FileSystem;\n\npublic interface StorageMigration {\n\n    int getTargetVersion();\n\n    void migrate(FileSystem fileSystem);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/migration/StorageMigrationService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration;\n\nimport org.uberfire.java.nio.file.FileSystem;\n\npublic interface StorageMigrationService {\n\n    void migrate(Integer targetVersion, FileSystem fileSystem);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/migration/impl/StorageMigrationServiceImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration.impl;\n\nimport org.uberfire.experimental.service.storage.migration.StorageMigration;\nimport org.uberfire.experimental.service.storage.migration.StorageMigrationService;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport java.util.Comparator;\nimport java.util.Set;\nimport java.util.TreeSet;\n\n@Dependent\npublic class StorageMigrationServiceImpl implements StorageMigrationService {\n\n    private Set<StorageMigration> migrations = new TreeSet<>(Comparator.comparingInt(StorageMigration::getTargetVersion));\n\n    @Inject\n    public StorageMigrationServiceImpl(Instance<StorageMigration> instance) {\n        for (StorageMigration migration : instance) {\n            migrations.add(migration);\n        }\n    }\n\n    @Override\n    public void migrate(final Integer targetVersion, final FileSystem fileSystem) {\n        migrations.iterator().forEachRemaining(migration -> {\n            if (migration.getTargetVersion() <= targetVersion) {\n                migration.migrate(fileSystem);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/migration/impl/migrations/V2StorageMigration.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration.impl.migrations;\n\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.experimental.service.storage.migration.StorageMigration;\nimport org.uberfire.experimental.service.storage.scoped.impl.UserExperimentalFeaturesStorageImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\n@Dependent\npublic class V2StorageMigration implements StorageMigration {\n\n    private IOService ioService;\n\n    @Inject\n    public V2StorageMigration(@Named(\"configIO\") final IOService ioService) {\n        this.ioService = ioService;\n    }\n\n    @Override\n    public int getTargetVersion() {\n        return 2;\n    }\n\n    @Override\n    public void migrate(final FileSystem fileSystem) {\n        Path usersRoot = fileSystem.getPath(UserExperimentalFeaturesStorageImpl.USER_FOLDER_ROOT);\n\n        try (DirectoryStream<Path> stream = ioService.newDirectoryStream(usersRoot)) {\n            stream.forEach(folder -> {\n                String folderName = Paths.convert(folder).getFileName();\n\n                Path newFolder = usersRoot.resolve(UserExperimentalFeaturesStorageImpl.encode(folderName));\n\n                ioService.move(folder, newFolder);\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/scoped/ExperimentalStorageScope.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\n\npublic enum ExperimentalStorageScope {\n    GLOBAL, USER;\n\n    public static ExperimentalStorageScope getScope(ExperimentalFeatureDefinition featureDefinition) {\n        if (featureDefinition.isGlobal()) {\n            return GLOBAL;\n        }\n        return USER;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/scoped/ScopedExperimentalFeaturesStorage.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped;\n\nimport org.uberfire.experimental.service.storage.ExperimentalFeaturesStorage;\nimport org.uberfire.java.nio.file.FileSystem;\n\npublic interface ScopedExperimentalFeaturesStorage extends ExperimentalFeaturesStorage {\n\n    void init(FileSystem fileSystem);\n\n    ExperimentalStorageScope getScope();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/scoped/impl/AbstractScopedExperimentalFeaturesStorage.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport org.slf4j.Logger;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.scoped.ScopedExperimentalFeaturesStorage;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\nimport static org.uberfire.experimental.service.storage.util.ExperimentalConstants.COMMENTS;\n\npublic abstract class AbstractScopedExperimentalFeaturesStorage implements ScopedExperimentalFeaturesStorage {\n\n    protected final SessionInfo sessionInfo;\n    protected final ExperimentalFeatureDefRegistry defRegistry;\n    protected final IOService ioService;\n\n    protected FileSystem fileSystem;\n\n    public AbstractScopedExperimentalFeaturesStorage(final SessionInfo sessionInfo, final IOService ioService, final ExperimentalFeatureDefRegistry defRegistry) {\n        this.sessionInfo = sessionInfo;\n        this.ioService = ioService;\n        this.defRegistry = defRegistry;\n    }\n\n    @Override\n    public void init(final FileSystem fileSystem) {\n        this.fileSystem = fileSystem;\n    }\n\n    public abstract String getStoragePath();\n\n    protected abstract Collection<ExperimentalFeatureDefinition> getSupportedDefinitions();\n\n    protected abstract Logger log();\n\n    protected List<ExperimentalFeatureImpl> readFeatures() {\n\n        final Path fsPath = fileSystem.getPath(getStoragePath());\n\n        final List<ExperimentalFeatureImpl> registeredFeatures = new ArrayList<>();\n\n        boolean existsOnVFS = true;\n\n        if (ioService.exists(fsPath)) {\n            try (InputStream in = ioService.newInputStream(fsPath)) {\n                Properties properties = new Properties();\n\n                properties.load(in);\n\n                properties.entrySet().stream()\n                        .map(entry -> new ExperimentalFeatureImpl((String) entry.getKey(), Boolean.parseBoolean((String) entry.getValue())))\n                        .forEach(registeredFeatures::add);\n            } catch (Exception ex) {\n                log().warn(\"Impossible to load registry\", ex);\n            }\n        } else {\n            existsOnVFS = false;\n        }\n\n        boolean requiresVFSSync = syncLoadedFeatures(registeredFeatures);\n\n        if (!existsOnVFS || requiresVFSSync) {\n            storeFeatures(registeredFeatures);\n        }\n\n        return registeredFeatures;\n    }\n\n    private boolean syncLoadedFeatures(final List<ExperimentalFeatureImpl> registeredFeatures) {\n        final Collection<ExperimentalFeatureDefinition> expectedDefinitions = getSupportedDefinitions();\n\n        List<String> registryFeatureIds = registeredFeatures.stream().map(ExperimentalFeatureImpl::getFeatureId).collect(Collectors.toList());\n\n        List<String> expectedFeatureIds = expectedDefinitions.stream().map(ExperimentalFeatureDefinition::getId).collect(Collectors.toList());\n\n        List<String> missingFeatures = expectedFeatureIds.stream()\n                .filter(expectedFeatureId -> !registryFeatureIds.contains(expectedFeatureId))\n                .collect(Collectors.toList());\n\n        boolean requiresSync = false;\n\n        if (!missingFeatures.isEmpty()) {\n            requiresSync = true;\n            missingFeatures.stream()\n                    .forEach(expectedFeatureId -> registeredFeatures.add(new ExperimentalFeatureImpl(expectedFeatureId, false)));\n        }\n\n        List<ExperimentalFeatureImpl> extraFeatures = registryFeatureIds.stream()\n                .filter(registeredFeatureId -> !expectedFeatureIds.contains(registeredFeatureId))\n                .map(registryFeatureId -> registeredFeatures.stream().filter(experimentalFeature -> experimentalFeature.getFeatureId().equals(registryFeatureId)).findAny().orElse(null))\n                .filter(Objects::nonNull)\n                .collect(Collectors.toList());\n\n        if (!extraFeatures.isEmpty()) {\n            requiresSync = true;\n            registeredFeatures.removeAll(extraFeatures);\n        }\n\n        return requiresSync;\n    }\n\n    public void storeFeatures(Collection<ExperimentalFeatureImpl> features) {\n        doStoreFeatures(features, () -> {});\n    }\n\n    @Override\n    public void store(final ExperimentalFeatureImpl feature) {\n        List<ExperimentalFeatureImpl> registeredFeatures = (List<ExperimentalFeatureImpl>) getFeatures();\n\n        Optional<ExperimentalFeatureImpl> optional = registeredFeatures.stream()\n                .filter(registeredFeature -> registeredFeature.getFeatureId().equals(feature.getFeatureId()))\n                .findAny();\n\n        if (optional.isPresent()) {\n            ExperimentalFeatureImpl registeredFeature = optional.get();\n\n            registeredFeature.setEnabled(feature.isEnabled());\n\n            doStoreFeatures(registeredFeatures, () -> this.maybeNotifyFeatureUpdate(feature));\n        }\n    }\n\n    public void doStoreFeatures(Collection<ExperimentalFeatureImpl> features, Runnable callback) {\n        final String path = getStoragePath();\n        final Path fsPath = fileSystem.getPath(path);\n\n        Properties properties = new Properties();\n\n        features.stream()\n                .filter(experimentalFeature -> defRegistry.getFeatureById(experimentalFeature.getFeatureId()) != null)\n                .forEach(feature -> properties.put(feature.getFeatureId(), String.valueOf(feature.isEnabled())));\n\n        try (OutputStream out = ioService.newOutputStream(fsPath)) {\n            ioService.startBatch(fileSystem);\n            properties.store(out, COMMENTS);\n\n            if (callback != null) {\n                callback.run();\n            }\n        } catch (Exception ex) {\n            log().warn(\"Impossible to write experimental features registry on '{}': {}\", path, ex);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n\n    protected void maybeNotifyFeatureUpdate(ExperimentalFeatureImpl feature) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/scoped/impl/GlobalExperimentalFeaturesStorageImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.scoped.ExperimentalStorageScope;\nimport org.uberfire.experimental.service.storage.util.ExperimentalConstants;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.rpc.SessionInfo;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\n@Dependent\npublic class GlobalExperimentalFeaturesStorageImpl extends AbstractScopedExperimentalFeaturesStorage {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(GlobalExperimentalFeaturesStorageImpl.class);\n\n    public static final String GLOBAL_STORAGE_PATH = ExperimentalConstants.EXPERIMENTAL_ROOT_FOLDER + \"/global/\" + ExperimentalConstants.EXPERIMENTAL_FILENAME;\n\n    private Event<PortableExperimentalFeatureModifiedEvent> event;\n\n    private List<ExperimentalFeatureImpl> globalFeatures;\n\n    @Inject\n    public GlobalExperimentalFeaturesStorageImpl(final SessionInfo sessionInfo, @Named(\"configIO\") final IOService ioService, final ExperimentalFeatureDefRegistry defRegistry, final Event<PortableExperimentalFeatureModifiedEvent> event) {\n        super(sessionInfo, ioService, defRegistry);\n        this.event = event;\n    }\n\n    @Override\n    public void init(FileSystem fileSystem) {\n        super.init(fileSystem);\n        loadGlobalFeatures();\n    }\n\n    protected void loadGlobalFeatures() {\n        globalFeatures = Collections.unmodifiableList(new ArrayList<>(readFeatures()));\n    }\n\n    @Override\n    protected Collection<ExperimentalFeatureDefinition> getSupportedDefinitions() {\n        return defRegistry.getGlobalFeatures();\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureImpl> getFeatures() {\n        return globalFeatures;\n    }\n\n    @Override\n    public String getStoragePath() {\n        return GLOBAL_STORAGE_PATH;\n    }\n\n    @Override\n    protected Logger log() {\n        return LOGGER;\n    }\n\n    @Override\n    protected void maybeNotifyFeatureUpdate(ExperimentalFeatureImpl feature) {\n        event.fire(new PortableExperimentalFeatureModifiedEvent(feature));\n    }\n\n    @Override\n    public ExperimentalStorageScope getScope() {\n        return ExperimentalStorageScope.GLOBAL;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/scoped/impl/UserExperimentalFeaturesStorageImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.scoped.ExperimentalStorageScope;\nimport org.uberfire.experimental.service.storage.util.ExperimentalConstants;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport java.text.MessageFormat;\nimport java.util.Base64;\nimport java.util.Collection;\n\n@Dependent\npublic class UserExperimentalFeaturesStorageImpl extends AbstractScopedExperimentalFeaturesStorage {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(UserExperimentalFeaturesStorageImpl.class);\n\n    public static final String USER_FOLDER_ROOT = ExperimentalConstants.EXPERIMENTAL_ROOT_FOLDER + \"/users\";\n    public static final String USER_FOLDER = USER_FOLDER_ROOT + \"/{0}/\" + ExperimentalConstants.EXPERIMENTAL_FILENAME;\n\n    @Inject\n    public UserExperimentalFeaturesStorageImpl(final SessionInfo sessionInfo, @Named(\"configIO\") final IOService ioService, final ExperimentalFeatureDefRegistry defRegistry) {\n        super(sessionInfo, ioService, defRegistry);\n    }\n\n    @Override\n    public void init(FileSystem fileSystem) {\n        super.init(fileSystem);\n\n        checkStoragePath();\n    }\n\n    private void checkStoragePath() {\n        Path path = fileSystem.getPath(USER_FOLDER_ROOT);\n        if (!ioService.exists(path)) {\n            ioService.createDirectory(path);\n        }\n    }\n\n    @Override\n    protected Collection<ExperimentalFeatureDefinition> getSupportedDefinitions() {\n        return defRegistry.getUserFeatures();\n    }\n\n    @Override\n    public Collection<ExperimentalFeatureImpl> getFeatures() {\n        return readFeatures();\n    }\n\n    @Override\n    public String getStoragePath() {\n        return MessageFormat.format(USER_FOLDER, getUserId());\n    }\n\n    private String getUserId() {\n        return encode(sessionInfo.getIdentity().getIdentifier());\n    }\n\n    @Override\n    protected Logger log() {\n        return LOGGER;\n    }\n\n    @Override\n    public ExperimentalStorageScope getScope() {\n        return ExperimentalStorageScope.USER;\n    }\n\n    public static String encode(String folderName) {\n        return new String(Base64.getEncoder().encode(folderName.getBytes()));\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/java/org/uberfire/experimental/service/storage/util/ExperimentalConstants.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.util;\n\npublic interface ExperimentalConstants {\n\n    Integer EXPERIMENTAL_VERSION = 2;\n\n    String SEPARATOR = \"/\";\n\n    String EXPERIMENTAL_VERSION_KEY = \"version\";\n\n    String EXPERIMENTAL_ROOT_FOLDER = \"/experimental\";\n\n    String EXPERIMENTAL_SETTINGS_FILENAME = \".settings\";\n\n    String EXPERIMENTAL_SETTINGS_PATH = EXPERIMENTAL_ROOT_FOLDER + SEPARATOR + EXPERIMENTAL_SETTINGS_FILENAME;\n\n    String EXPERIMENTAL_FILENAME = \".experimental\";\n    String COMMENTS = \"Updating experimental features registry\";\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/BackendExperimentalFeaturesRegistryServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.stream.Collectors;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.experimental.service.backend.ExperimentalFeaturesSession;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.impl.ExperimentalFeaturesStorageImpl;\nimport org.uberfire.experimental.service.util.TestUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_3;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_3;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class BackendExperimentalFeaturesRegistryServiceImplTest {\n\n    protected static final String UNEXISTING_FEATURE = \"unexisting featureID\";\n\n    protected static final String USER_NAME = \"my-user\";\n\n    @Mock\n    private ExperimentalFeaturesStorageImpl storage;\n\n    private BackendExperimentalFeaturesRegistryServiceImpl service;\n    protected SessionInfo sessionInfo;\n    protected ExperimentalFeatureDefRegistryImpl defRegistry;\n\n    @Before\n    public void init() {\n        sessionInfo = new SessionInfoMock(USER_NAME);\n\n        defRegistry = TestUtils.getRegistry();\n    }\n\n    @Test\n    public void testLoadRegistryWithExistingData() {\n        init(true);\n\n        assertTrue(service.isFeatureEnabled(GLOBAL_FEATURE_1));\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2));\n        assertTrue(service.isFeatureEnabled(GLOBAL_FEATURE_3));\n\n        assertTrue(service.isFeatureEnabled(FEATURE_1));\n        assertFalse(service.isFeatureEnabled(FEATURE_2));\n        assertTrue(service.isFeatureEnabled(FEATURE_3));\n\n        assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE));\n    }\n\n    @Test\n    public void testLoadRegistryWithExistingDataExperimentalDisabled() {\n        init(false);\n\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_1));\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2));\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_3));\n\n        assertFalse(service.isFeatureEnabled(FEATURE_1));\n        assertFalse(service.isFeatureEnabled(FEATURE_2));\n        assertFalse(service.isFeatureEnabled(FEATURE_3));\n\n        assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE));\n    }\n\n    @Test\n    public void testLoadRegistryWithoutExistingDataExperimentalDisabled() {\n        init(false);\n\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_1));\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_2));\n        assertFalse(service.isFeatureEnabled(GLOBAL_FEATURE_3));\n\n        assertFalse(service.isFeatureEnabled(FEATURE_1));\n        assertFalse(service.isFeatureEnabled(FEATURE_2));\n        assertFalse(service.isFeatureEnabled(FEATURE_3));\n\n        assertTrue(service.isFeatureEnabled(UNEXISTING_FEATURE));\n    }\n\n    @Test\n    public void testStoreUserLevelFeature() {\n        testStoreFeature(FEATURE_1, false);\n    }\n\n    @Test\n    public void testStoreGlobalFeature() {\n        testStoreFeature(GLOBAL_FEATURE_1, false);\n    }\n\n    @Test\n    public void testStoreWrongFeature() {\n        init(true);\n\n        Assertions.assertThatThrownBy(() -> service.save(new EditableExperimentalFeature(UNEXISTING_FEATURE, true)))\n                .hasMessage(\"Cannot find ExperimentalFeature '\" + UNEXISTING_FEATURE + \"'\")\n                .isInstanceOf(IllegalArgumentException.class);\n    }\n\n    @Test\n    public void testStoreFeatureExperimentalDisabled() {\n        init(false);\n\n        testStoreFeatureExperimentalFeatureDisabled(GLOBAL_FEATURE_1);\n        testStoreFeatureExperimentalFeatureDisabled(FEATURE_1);\n        testStoreFeatureExperimentalFeatureDisabled(UNEXISTING_FEATURE);\n        testStoreFeatureExperimentalFeatureDisabled(UNEXISTING_FEATURE);\n    }\n\n    private void testStoreFeatureExperimentalFeatureDisabled(final String featureId) {\n        Assertions.assertThatThrownBy(() -> service.save(new EditableExperimentalFeature(featureId, true)))\n                .hasMessage(\"Impossible edit feature '\" + featureId + \"': Experimental Framework is disabled\")\n                .isInstanceOf(IllegalStateException.class);\n\n        verify(storage, never()).store(any());\n    }\n\n    private void testStoreFeature(String featureId, boolean newValue) {\n        init(true);\n\n        service.save(new EditableExperimentalFeature(featureId, newValue));\n\n        ArgumentCaptor<ExperimentalFeatureImpl> captor = ArgumentCaptor.forClass(ExperimentalFeatureImpl.class);\n\n        verify(storage).store(captor.capture());\n\n        ExperimentalFeatureImpl feature = captor.getValue();\n\n        Assertions.assertThat(feature)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"featureId\", featureId)\n                .hasFieldOrPropertyWithValue(\"enabled\", newValue);\n    }\n\n    private void init(Boolean enableExperimental) {\n\n        System.setProperty(BackendExperimentalFeaturesRegistryServiceImpl.EXPERIMENTAL_FEATURES_PROPERTY_NAME, enableExperimental.toString());\n\n        Collection<String> disableFeatures = Arrays.asList(GLOBAL_FEATURE_2, FEATURE_2);\n\n        when(storage.getFeatures()).thenAnswer((Answer<Collection<ExperimentalFeatureImpl>>) invocationOnMock -> defRegistry.getAllFeatures().stream()\n                .map(featureDefinition -> new ExperimentalFeatureImpl(featureDefinition.getId(), !disableFeatures.contains(featureDefinition.getId())))\n                .collect(Collectors.toList()));\n\n        service = new BackendExperimentalFeaturesRegistryServiceImpl(defRegistry, storage);\n\n        ExperimentalFeaturesSession session = service.getExperimentalFeaturesSession();\n\n        Assertions.assertThat(session)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"experimentalFeaturesEnabled\", enableExperimental)\n                .hasFieldOrProperty(\"registry\");\n\n        ExperimentalFeaturesRegistry registry = session.getFeaturesRegistry();\n\n        Assertions.assertThat(registry.getAllFeatures())\n                .isNotNull()\n                .hasSize(6);\n    }\n\n    @After\n    public void clear() {\n        System.clearProperty(BackendExperimentalFeaturesRegistryServiceImpl.EXPERIMENTAL_FEATURES_PROPERTY_NAME);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/impl/ExperimentalFeaturesStorageImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.impl;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.text.MessageFormat;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.apache.commons.io.IOUtils;\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.storage.ExperimentalFeaturesStorage;\nimport org.uberfire.experimental.service.storage.migration.StorageMigrationService;\nimport org.uberfire.experimental.service.storage.scoped.ScopedExperimentalFeaturesStorage;\nimport org.uberfire.experimental.service.storage.scoped.impl.GlobalExperimentalFeaturesStorageImpl;\nimport org.uberfire.experimental.service.storage.scoped.impl.UserExperimentalFeaturesStorageImpl;\nimport org.uberfire.experimental.service.storage.util.ExperimentalConstants;\nimport org.uberfire.experimental.service.util.TestUtils;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.fail;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_3;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_3;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalFeaturesStorageImplTest {\n\n    private static final String USER_NAME = \"my-user\";\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    private SessionInfo sessionInfo;\n\n    @Mock\n    protected SpacesAPI spaces;\n\n    @Mock\n    protected IOService ioService;\n\n    @Mock\n    protected ExperimentalFeatureDefRegistryImpl defRegistry;\n\n    private FileSystem fileSystem;\n\n    @Mock\n    private StorageMigrationService storageMigrationService;\n\n    @Mock\n    private EventSourceMock<PortableExperimentalFeatureModifiedEvent> event;\n\n    private ExperimentalFeaturesStorageImpl storage;\n\n    private GlobalExperimentalFeaturesStorageImpl globalStorage;\n\n    private UserExperimentalFeaturesStorageImpl userStorage;\n\n    @Before\n    public void init() throws IOException {\n        MappingContextSingleton.get();\n        fileSystemTestingUtils.setup();\n\n        sessionInfo = new SessionInfoMock(USER_NAME);\n        fileSystem = fileSystemTestingUtils.getFileSystem();\n        ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any());\n        doNothing().when(ioService).endBatch();\n        doReturn(fileSystem).when(ioService).newFileSystem(any(), anyMap());\n\n        defRegistry = TestUtils.getRegistry();\n\n        globalStorage = spy(new GlobalExperimentalFeaturesStorageImpl(sessionInfo, ioService, defRegistry, event));\n\n        userStorage = spy(new UserExperimentalFeaturesStorageImpl(sessionInfo, ioService, defRegistry));\n    }\n\n    private void initSkipMigration() {\n        // Skipping migration\n        ioService.write(fileSystem.getPath(ExperimentalConstants.EXPERIMENTAL_SETTINGS_PATH), \"version=2\");\n\n        initStorage();\n\n        verify(storageMigrationService, never()).migrate(any(), any());\n    }\n\n    private void initStorage() {\n        Instance<ScopedExperimentalFeaturesStorage> instance = mock(Instance.class);\n\n        List<ScopedExperimentalFeaturesStorage> storages = new ArrayList<>();\n\n        storages.add(userStorage);\n        storages.add(globalStorage);\n\n        when(instance.iterator()).thenReturn(storages.iterator());\n\n        storage = new ExperimentalFeaturesStorageImpl(spaces, ioService, defRegistry, instance, storageMigrationService);\n\n        storage.init();\n\n        verifyInit();\n    }\n\n    @Test\n    public void testStoreUserLevelFeature() {\n        initSkipMigration();\n\n        testStoreFeature(FEATURE_1, false, userStorage, globalStorage, 1);\n        testStoreFeature(FEATURE_2, true, userStorage, globalStorage, 2);\n        testStoreFeature(FEATURE_3, true, userStorage, globalStorage, 3);\n    }\n\n    @Test\n    public void testStoreGlobalFeature() {\n        initSkipMigration();\n\n        testStoreFeature(GLOBAL_FEATURE_1, false, globalStorage, userStorage, 1);\n        testStoreFeature(GLOBAL_FEATURE_2, true, globalStorage, userStorage, 2);\n        testStoreFeature(GLOBAL_FEATURE_3, true, globalStorage, userStorage, 3);\n    }\n\n    @Test\n    public void testMigrationWithoutSettingsFile() {\n        initStorage();\n\n        verify(storageMigrationService).migrate(ExperimentalConstants.EXPERIMENTAL_VERSION, fileSystem);\n    }\n\n    @Test\n    public void testMigrationWithSettingsFileOldVersion() {\n        ioService.write(fileSystem.getPath(ExperimentalConstants.EXPERIMENTAL_SETTINGS_PATH), \"version=1\");\n\n        initStorage();\n\n        verify(storageMigrationService).migrate(ExperimentalConstants.EXPERIMENTAL_VERSION, fileSystem);\n    }\n\n    private void testStoreFeature(String featureId, boolean newValue, ExperimentalFeaturesStorage storage, ExperimentalFeaturesStorage otherStorage, int times) {\n\n        this.storage.store(new ExperimentalFeatureImpl(featureId, newValue));\n\n        ArgumentCaptor<ExperimentalFeatureImpl> captor = ArgumentCaptor.forClass(ExperimentalFeatureImpl.class);\n\n        verify(storage, times(times)).store(captor.capture());\n        verify(otherStorage, never()).store(any());\n\n        ExperimentalFeatureImpl feature = captor.getValue();\n\n        Assertions.assertThat(feature)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"featureId\", featureId)\n                .hasFieldOrPropertyWithValue(\"enabled\", newValue);\n    }\n\n    @After\n    public void clean() {\n        ioService.delete(fileSystem.getPath(globalStorage.getStoragePath()));\n        ioService.delete(fileSystem.getPath(userStorage.getStoragePath()));\n        fileSystemTestingUtils.cleanup();\n    }\n\n    private void verifyInit() {\n        verify(spaces).resolveFileSystemURI(any(), any(), any());\n        verify(ioService).newFileSystem(any(), any());\n\n        Assertions.assertThat(storage.getFeatures())\n                .isNotNull()\n                .hasSize(6);\n    }\n}"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/migration/impl/StorageMigrationServiceImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.service.storage.migration.StorageMigration;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class StorageMigrationServiceImplTest {\n\n    @Mock\n    private StorageMigration migration1;\n\n    @Mock\n    private StorageMigration migration2;\n\n    @Mock\n    private StorageMigration migration3;\n\n    @Mock\n    private FileSystem fileSystem;\n\n    private List<StorageMigration> migrationList = new ArrayList<>();\n\n    private StorageMigrationServiceImpl migrationService;\n\n    @Before\n    public void init() {\n        when(migration1.getTargetVersion()).thenReturn(1);\n        when(migration2.getTargetVersion()).thenReturn(2);\n        when(migration3.getTargetVersion()).thenReturn(3);\n\n        Instance<StorageMigration> migrations = mock(Instance.class);\n\n        migrationList.add(migration3);\n        migrationList.add(migration1);\n        migrationList.add(migration2);\n\n        when(migrations.iterator()).thenReturn(migrationList.iterator());\n\n        migrationService = new StorageMigrationServiceImpl(migrations);\n    }\n\n    @Test\n    public void testMigrateV1() {\n        testMigrate(1);\n    }\n\n    @Test\n    public void testMigrateV2() {\n        testMigrate(2);\n    }\n\n    @Test\n    public void testMigrateV3() {\n        testMigrate(3);\n    }\n\n    private void testMigrate(int version) {\n        migrationService.migrate(version, fileSystem);\n\n        Collections.sort(migrationList, Comparator.comparingInt(StorageMigration::getTargetVersion));\n\n        for (int i = 0; i < migrationList.size(); i++) {\n            verify(migrationList.get(i), i + 1 <= version ? times(1) : never()).migrate(eq(fileSystem));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/migration/impl/migrations/V2StorageMigrationTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.migration.impl.migrations;\n\nimport java.io.IOException;\nimport java.nio.charset.Charset;\nimport java.text.MessageFormat;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.apache.commons.io.IOUtils;\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.experimental.service.storage.scoped.impl.UserExperimentalFeaturesStorageImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.mocks.FileSystemTestingUtils;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.spy;\n\npublic class V2StorageMigrationTest {\n\n    private static final List<String> usernames = Arrays.asList(\"pere\", \"eder\", \"tiago\");\n\n    protected static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    protected IOService ioService;\n    protected FileSystem fileSystem;\n\n    private V2StorageMigration migration;\n\n    private String fileContent;\n\n    @Before\n    public void init() throws IOException {\n        MappingContextSingleton.get();\n        fileSystemTestingUtils.setup();\n\n        ioService = spy(fileSystemTestingUtils.getIoService());\n        fileSystem = fileSystemTestingUtils.getFileSystem();\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n\n        fileContent = IOUtils.toString(getClass().getResourceAsStream(\"/test/global/regularFeatures.txt\"), Charset.defaultCharset());\n\n        usernames.forEach(this::createExperimentalSettings);\n\n        migration = new V2StorageMigration(ioService);\n    }\n\n    private void createExperimentalSettings(final String userName) {\n        Path path = fileSystem.getPath(MessageFormat.format(UserExperimentalFeaturesStorageImpl.USER_FOLDER, userName));\n\n        ioService.write(path, fileContent);\n\n        Assert.assertTrue(ioService.exists(path));\n    }\n\n    @Test\n    public void testMigration() {\n        migration.migrate(fileSystem);\n\n        usernames.forEach(this::validateUserSettings);\n    }\n\n    private void validateUserSettings(final String userName) {\n        Path oldPath = fileSystem.getPath(MessageFormat.format(UserExperimentalFeaturesStorageImpl.USER_FOLDER, userName));\n\n        Assert.assertFalse(ioService.exists(oldPath));\n\n        String encodedName = UserExperimentalFeaturesStorageImpl.encode(userName);\n\n        Path newPath = fileSystem.getPath(MessageFormat.format(UserExperimentalFeaturesStorageImpl.USER_FOLDER, encodedName));\n\n        Assert.assertTrue(ioService.exists(newPath));\n        Assertions.assertThat(ioService.readAllString(newPath))\n                .isNotBlank()\n                .isEqualTo(fileContent);\n    }\n\n    @After\n    public void cleanup() {\n        fileSystemTestingUtils.cleanup();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/scoped/impl/AbstractExperimentalFeaturesStorageTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Comparator;\nimport java.util.List;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.mockito.Mock;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.util.TestUtils;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\n\npublic abstract class AbstractExperimentalFeaturesStorageTest<STORAGE extends AbstractScopedExperimentalFeaturesStorage> {\n\n    protected static final String USER_NAME = \"my-user\";\n\n    protected static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    protected SessionInfo sessionInfo;\n\n    protected IOService ioService;\n\n    @Mock\n    protected ExperimentalFeatureDefRegistryImpl defRegistry;\n\n    protected FileSystem fileSystem;\n\n    protected STORAGE storage;\n\n    @Before\n    public void init() throws IOException {\n        MappingContextSingleton.get();\n        fileSystemTestingUtils.setup();\n\n        sessionInfo = new SessionInfoMock(USER_NAME);\n        fileSystem = fileSystemTestingUtils.getFileSystem();\n        ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n\n        defRegistry = TestUtils.getRegistry();\n\n        storage = getStorageInstance();\n    }\n\n    abstract STORAGE getStorageInstance();\n\n    protected void verifyLoadedFeatures(List<ExperimentalFeatureImpl> features, ExperimentalFeature feature1, ExperimentalFeature feature2, ExperimentalFeature feature3) {\n\n        features.sort(Comparator.comparing(ExperimentalFeatureImpl::getFeatureId));\n\n        Assertions.assertThat(features)\n                .isNotNull()\n                .hasSize(3);\n\n        Assertions.assertThat(features.get(0))\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"featureId\", feature1.getFeatureId())\n                .hasFieldOrPropertyWithValue(\"enabled\", feature1.isEnabled());\n\n        Assertions.assertThat(features.get(1))\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"featureId\", feature2.getFeatureId())\n                .hasFieldOrPropertyWithValue(\"enabled\", feature2.isEnabled());\n\n        Assertions.assertThat(features.get(2))\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"featureId\", feature3.getFeatureId())\n                .hasFieldOrPropertyWithValue(\"enabled\", feature3.isEnabled());\n    }\n\n    @After\n    public void clean() {\n        fileSystemTestingUtils.cleanup();\n        try {\n            ioService.delete(fileSystem.getPath(storage.getStoragePath()));\n        } catch (Exception ex) {\n\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/scoped/impl/GlobalExperimentalFeaturesStorageImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport java.io.IOException;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\n\nimport org.apache.commons.io.IOUtils;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_3;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GlobalExperimentalFeaturesStorageImplTest extends AbstractExperimentalFeaturesStorageTest<GlobalExperimentalFeaturesStorageImpl> {\n\n    @Mock\n    private EventSourceMock<PortableExperimentalFeatureModifiedEvent> event;\n\n    @Test\n    public void testFirstLoad() {\n        storage.init(fileSystem);\n\n        verify(ioService).exists(any());\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, false));\n    }\n\n    @Test\n    public void testRegularLoad() throws IOException {\n\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/global/regularFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        verify(ioService, times(2)).exists(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService, never()).newOutputStream(any());\n        verify(ioService, never()).startBatch(fileSystem);\n        verify(ioService, never()).endBatch();\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, true), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, true));\n    }\n\n    @Test\n    public void testExtraFeaturesLoad() throws IOException {\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/global/extraFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        verify(ioService, times(2)).exists(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, true), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, true));\n    }\n\n    @Test\n    public void testMissingFeaturesLoad() throws IOException {\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/global/missingFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        verify(ioService, times(2)).exists(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, true), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, true));\n    }\n\n    @Test\n    public void testStoreFeature() throws IOException {\n        testRegularLoad();\n\n        storage.store(new ExperimentalFeatureImpl(FEATURE_1, true));\n\n        verify(ioService, never()).newOutputStream(any());\n        verify(ioService, never()).startBatch(fileSystem);\n        verify(ioService, never()).endBatch();\n        verify(event, never()).fire(any());\n\n        storage.store(new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, false));\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n        verify(event).fire(any());\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_2, false), new ExperimentalFeatureImpl(GLOBAL_FEATURE_3, true));\n    }\n\n    @Override\n    protected GlobalExperimentalFeaturesStorageImpl getStorageInstance() {\n        return new GlobalExperimentalFeaturesStorageImpl(sessionInfo, ioService, defRegistry, event);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/storage/scoped/impl/UserExperimentalFeaturesStorageImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.storage.scoped.impl;\n\nimport java.io.IOException;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.commons.io.IOUtils;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_1;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_2;\nimport static org.uberfire.experimental.service.util.TestUtils.FEATURE_3;\nimport static org.uberfire.experimental.service.util.TestUtils.GLOBAL_FEATURE_1;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UserExperimentalFeaturesStorageImplTest extends AbstractExperimentalFeaturesStorageTest<UserExperimentalFeaturesStorageImpl> {\n\n    @Test\n    public void testFirstLoad() {\n        storage.init(fileSystem);\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>(storage.getFeatures());\n\n        verify(ioService, times(2)).exists(any());\n        verify(ioService, never()).newInputStream(any());\n        verify(ioService).createDirectory(any());\n\n        verify(ioService, times(2)).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(features, new ExperimentalFeatureImpl(FEATURE_1, false), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, false));\n    }\n\n    @Test\n    public void testRegularLoad() throws IOException {\n\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/user/regularFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>(storage.getFeatures());\n\n        verify(ioService, times(3)).exists(any());\n        verify(ioService, never()).createDirectory(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService, never()).newOutputStream(any());\n        verify(ioService, never()).startBatch(fileSystem);\n        verify(ioService, never()).endBatch();\n\n        verifyLoadedFeatures(features, new ExperimentalFeatureImpl(FEATURE_1, true), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, true));\n    }\n\n    @Test\n    public void testExtraFeaturesLoad() throws IOException {\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/user/extraFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>(storage.getFeatures());\n\n        verify(ioService, times(3)).exists(any());\n        verify(ioService, never()).createDirectory(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(features, new ExperimentalFeatureImpl(FEATURE_1, true), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, true));\n    }\n\n    @Test\n    public void testMissingFeaturesLoad() throws IOException {\n        Path path = fileSystem.getPath(storage.getStoragePath());\n\n        ioService.write(path, IOUtils.toString(getClass().getResourceAsStream(\"/test/user/missingFeatures.txt\"), Charset.defaultCharset()));\n\n        storage.init(fileSystem);\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>(storage.getFeatures());\n\n        verify(ioService, times(3)).exists(any());\n        verify(ioService, never()).createDirectory(any());\n        verify(ioService).newInputStream(any());\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(features, new ExperimentalFeatureImpl(FEATURE_1, true), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, true));\n    }\n\n    @Test\n    public void testStoreFeature() throws IOException {\n        testRegularLoad();\n\n        storage.store(new ExperimentalFeatureImpl(GLOBAL_FEATURE_1, true));\n\n        verify(ioService, never()).newOutputStream(any());\n        verify(ioService, never()).startBatch(fileSystem);\n        verify(ioService, never()).endBatch();\n\n        storage.store(new ExperimentalFeatureImpl(FEATURE_1, false));\n\n        verify(ioService).newOutputStream(any());\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).endBatch();\n\n        verifyLoadedFeatures(new ArrayList<>(storage.getFeatures()), new ExperimentalFeatureImpl(FEATURE_1, false), new ExperimentalFeatureImpl(FEATURE_2, false), new ExperimentalFeatureImpl(FEATURE_3, true));\n    }\n\n    @Override\n    protected UserExperimentalFeaturesStorageImpl getStorageInstance() {\n        return new UserExperimentalFeaturesStorageImpl(sessionInfo, ioService, defRegistry);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/java/org/uberfire/experimental/service/util/TestUtils.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.service.util;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\n\npublic class TestUtils {\n\n    public static final String GLOBAL_FEATURE_1 = \"globalFeature_1\";\n    public static final String GLOBAL_FEATURE_2 = \"globalFeature_2\";\n    public static final String GLOBAL_FEATURE_3 = \"globalFeature_3\";\n\n    public static final String FEATURE_1 = \"feature_1\";\n    public static final String FEATURE_2 = \"feature_2\";\n    public static final String FEATURE_3 = \"feature_3\";\n\n    public static ExperimentalFeatureDefRegistryImpl getRegistry() {\n        ExperimentalFeatureDefRegistryImpl defRegistry = new ExperimentalFeatureDefRegistryImpl();\n\n        defRegistry.register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_1, true, \"\", GLOBAL_FEATURE_1, GLOBAL_FEATURE_1));\n        defRegistry.register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_2, true, \"\", GLOBAL_FEATURE_2, GLOBAL_FEATURE_2));\n        defRegistry.register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_3, true, \"\", GLOBAL_FEATURE_3, GLOBAL_FEATURE_3));\n        defRegistry.register(new ExperimentalFeatureDefinition(FEATURE_1, false, \"\", FEATURE_1, FEATURE_1));\n        defRegistry.register(new ExperimentalFeatureDefinition(FEATURE_2, false, \"\", FEATURE_2, FEATURE_2));\n        defRegistry.register(new ExperimentalFeatureDefinition(FEATURE_3, false, \"\", FEATURE_3, FEATURE_3));\n\n        return defRegistry;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\norg.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/global/extraFeatures.txt",
    "content": "globalFeature_0=true\nglobalFeature_1=true\nglobalFeature_2=false\nglobalFeature_3=true\nglobalFeature_4=true\nglobalFeature_5=false"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/global/missingFeatures.txt",
    "content": "globalFeature_1=true\nglobalFeature_3=true"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/global/regularFeatures.txt",
    "content": "globalFeature_1=true\nglobalFeature_2=false\nglobalFeature_3=true"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/user/extraFeatures.txt",
    "content": "feature_0=true\nfeature_1=true\nfeature_2=false\nfeature_3=true\nfeature_4=true\nfeature_5=false"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/user/missingFeatures.txt",
    "content": "feature_1=true\nfeature_3=true"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-backend/src/test/resources/test/user/regularFeatures.txt",
    "content": "feature_1=true\nfeature_2=false\nfeature_3=true"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-experimental</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-experimental-client</artifactId>\n  <name>Uberfire Experimental Client</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/UberfireExperimentalEntryPoint.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesDefRegistry;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\n\n@EntryPoint\n@Bundle(\"resources/i18n/UberfireExperimentalConstants.properties\")\npublic class UberfireExperimentalEntryPoint {\n\n    private ClientExperimentalFeaturesRegistryService registryService;\n    private ClientExperimentalFeaturesDefRegistry defRegistry;\n    private ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n\n    @Inject\n    public UberfireExperimentalEntryPoint(ClientExperimentalFeaturesRegistryService registryService, ClientExperimentalFeaturesDefRegistry defRegistry, ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager) {\n        this.registryService = registryService;\n        this.defRegistry = defRegistry;\n        this.activitiesAuthorizationManager = activitiesAuthorizationManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        defRegistry.loadRegistry();\n        registryService.loadRegistry();\n        activitiesAuthorizationManager.init();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.component;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\n\n@Dependent\npublic class DisabledFeatureComponent implements IsElement {\n\n    private DisabledFeatureComponentView view;\n\n    private ExperimentalFeatureDefRegistry defRegistry;\n\n    private TranslationService translationService;\n\n    @Inject\n    public DisabledFeatureComponent(DisabledFeatureComponentView view, ExperimentalFeatureDefRegistry defRegistry, TranslationService translationService) {\n        this.view = view;\n        this.defRegistry = defRegistry;\n        this.translationService = translationService;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void show(String featureId) {\n        ExperimentalFeatureDefinition feature = defRegistry.getFeatureById(featureId);\n\n        PortablePreconditions.checkNotNull(\"experimentalFeature\", feature);\n\n        String featureName = Optional.ofNullable(translationService.getTranslation(feature.getNameKey())).orElse(featureId);\n        String text;\n\n        if (feature.isGlobal()) {\n            text = translationService.format(UberfireExperimentalConstants.disabledGlobalExperimentalFeature, featureName);\n        } else {\n            text = translationService.format(UberfireExperimentalConstants.disabledExperimentalFeature, featureName);\n        }\n\n        view.show(text);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponentView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.component;\n\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\n\npublic interface DisabledFeatureComponentView extends IsElement {\n\n    void show(String text);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponentViewImpl.css",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.appformer_experimental_disabled_feature_content {\n    padding: 20px;\n}\n\n.appformer_experimental_disabled_feature_header {\n    margin-top: 0px !important;\n}\n\n.appformer_experimental_disabled_feature_alert_size {\n    font-size: 40pt;\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponentViewImpl.html",
    "content": "<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"appformer_experimental_disabled_feature_content text-center\">\n    <span class=\"pficon pficon-warning-triangle-o appformer_experimental_disabled_feature_alert_size\"></span>\n    <h1 data-i18n-key=\"header\" class=\"appformer_experimental_disabled_feature_header\"></h1>\n    <div data-field=\"content\"></div>\n</div>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponentViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.component;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class DisabledFeatureComponentViewImpl implements DisabledFeatureComponentView,\n                                                         IsElement {\n\n    @Inject\n    @DataField\n    private HTMLDivElement content;\n\n    @Inject\n    private Elemental2DomUtil util;\n\n    @Override\n    public void show(String text) {\n        util.removeAllElementChildren(content);\n        content.innerHTML = text;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/disabled/screen/DisabledFeatureActivity.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.screen;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.experimental.client.disabled.component.DisabledFeatureComponent;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\n\n@Dependent\n@Named(DisabledFeatureActivity.ID)\npublic class DisabledFeatureActivity extends AbstractWorkbenchScreenActivity {\n\n    public static final String ID = \"appformer.experimental.disabledFeatureTitle\";\n    public static final String ID_PARAM = \"randomId\";\n    public static final String FEATURE_ID_PARAM = \"featureId\";\n\n    private DisabledFeatureComponent component;\n    private TranslationService translationService;\n\n    @Inject\n    public DisabledFeatureActivity(PlaceManager placeManager, DisabledFeatureComponent component, TranslationService translationService) {\n        super(placeManager);\n        this.component = component;\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n\n        component.show(place.getParameter(FEATURE_ID_PARAM, null));\n    }\n\n    @Override\n    public String getTitle() {\n        return translationService.getTranslation(UberfireExperimentalConstants.disabledFeatureTitle);\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget(component.getElement());\n    }\n\n    @Override\n    public String getIdentifier() {\n        return ID;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreen.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor;\n\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.TreeSet;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.experimental.client.editor.group.ExperimentalFeaturesGroup;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.editor.FeaturesEditorService;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\nimport org.uberfire.experimental.service.security.GlobalExperimentalFeatureAction;\nimport org.uberfire.experimental.service.security.GlobalExperimentalFeatureResourceType;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = ExperimentalFeaturesEditorScreen.SCREEN_ID)\npublic class ExperimentalFeaturesEditorScreen implements ExperimentalFeaturesEditorScreenView.Presenter {\n\n    public static final String SCREEN_ID = \"ExperimentalFeaturesEditor\";\n\n    private final TranslationService translationService;\n    private final ClientExperimentalFeaturesRegistryService registryService;\n    private final ExperimentalFeatureDefRegistry defRegistry;\n    private final ExperimentalFeaturesEditorScreenView view;\n    private final ManagedInstance<ExperimentalFeaturesGroup> groupsInstance;\n    private final Caller<FeaturesEditorService> editorService;\n    private final SessionInfo sessionInfo;\n    private final AuthorizationManager authorizationManager;\n\n    @Inject\n    public ExperimentalFeaturesEditorScreen(final TranslationService translationService,\n                                            final ClientExperimentalFeaturesRegistryService registryService,\n                                            final ExperimentalFeatureDefRegistry defRegistry,\n                                            final ExperimentalFeaturesEditorScreenView view,\n                                            final ManagedInstance<ExperimentalFeaturesGroup> groupsInstance,\n                                            final Caller<FeaturesEditorService> editorService,\n                                            final SessionInfo sessionInfo,\n                                            final AuthorizationManager authorizationManager) {\n        this.translationService = translationService;\n        this.registryService = registryService;\n        this.defRegistry = defRegistry;\n        this.view = view;\n        this.groupsInstance = groupsInstance;\n        this.editorService = editorService;\n        this.sessionInfo = sessionInfo;\n        this.authorizationManager = authorizationManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @OnOpen\n    public void show() {\n        clear();\n\n        ExperimentalFeaturesRegistry registry = registryService.getFeaturesRegistry();\n\n        if (registry != null) {\n            Map<String, Set<ExperimentalFeature>> groupedFeatures = registry.getAllFeatures().stream()\n                    .collect(Collectors.groupingBy(this::getFeatureGroupName, Collectors.toSet()));\n\n            TreeSet<ExperimentalFeaturesGroup> groups = groupedFeatures.entrySet()\n                    .stream()\n                    .map(this::getFeaturesGroup)\n                    .filter(Objects::nonNull)\n                    .collect(Collectors.toCollection(TreeSet::new));\n\n            if (!groups.isEmpty()) {\n                groups.first().expand();\n                groups.forEach(view::add);\n            }\n        }\n    }\n\n    private String getFeatureGroupName(ExperimentalFeature feature) {\n        ExperimentalFeatureDefinition definition = defRegistry.getFeatureById(feature.getFeatureId());\n\n        if (definition.isGlobal()) {\n            return UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey;\n        }\n\n        if (definition.getGroup().isEmpty()) {\n            return UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey;\n        }\n\n        return definition.getGroup();\n    }\n\n    private ExperimentalFeaturesGroup getFeaturesGroup(Map.Entry<String, Set<ExperimentalFeature>> entry) {\n        String groupName = entry.getKey();\n\n        if (groupName.equals(UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey)) {\n            if (!authorizationManager.authorize(new GlobalExperimentalFeatureResourceType(), GlobalExperimentalFeatureAction.EDIT, sessionInfo.getIdentity())) {\n                return null;\n            }\n        }\n\n        ExperimentalFeaturesGroup group = groupsInstance.get();\n\n        group.init(groupName, entry.getValue(), this::doSave);\n\n        return group;\n    }\n\n    protected void doSave(final EditableExperimentalFeature feature) {\n        editorService.call((RemoteCallback<Void>) aVoid -> registryService.updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled())).save(feature);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return translationService.getTranslation(UberfireExperimentalConstants.experimentalFeaturesTitle);\n    }\n\n    @WorkbenchPartView\n    public ExperimentalFeaturesEditorScreenView getView() {\n        return view;\n    }\n\n    @PreDestroy\n    public void clear() {\n        view.clear();\n        groupsInstance.destroyAll();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreenView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor;\n\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.experimental.client.editor.group.ExperimentalFeaturesGroup;\n\npublic interface ExperimentalFeaturesEditorScreenView extends UberElemental<ExperimentalFeaturesEditorScreenView.Presenter> {\n\n    void clear();\n\n    void add(ExperimentalFeaturesGroup experimentalFeaturesGroup);\n\n    interface Presenter {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreenViewImpl.css",
    "content": ".appformer_experimental_features_editor_container {\n    background-color: #f5f5f5;\n    width: 100%;\n    min-height: 100%;\n}"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreenViewImpl.html",
    "content": "<div class=\"appformer_experimental_features_editor_container\">\n    <div class=\"container\">\n        <h1 data-i18n-key=\"experimentalFeaturesTitle\"></h1>\n        <div data-i18n-key=\"experimentalFeaturesWarning\"></div>\n        <div data-field=\"container\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreenViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.experimental.client.editor.group.ExperimentalFeaturesGroup;\n\n@Templated\npublic class ExperimentalFeaturesEditorScreenViewImpl implements ExperimentalFeaturesEditorScreenView,\n                                                                 IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    private Elemental2DomUtil util;\n\n    @Inject\n    @DataField\n    private HTMLDivElement container;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        util.removeAllElementChildren(container);\n    }\n\n    @Override\n    public void add(ExperimentalFeaturesGroup experimentalFeaturesGroup) {\n        container.appendChild(experimentalFeaturesGroup.getElement());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroup.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.TreeSet;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class ExperimentalFeaturesGroup implements IsElement,\n                                                  ExperimentalFeaturesGroupView.Presenter,\n                                                  Comparable<ExperimentalFeaturesGroup> {\n\n    private final ExperimentalFeaturesGroupView view;\n    private final TranslationService translationService;\n    private final ManagedInstance<ExperimentalFeatureEditor> editorInstance;\n\n    protected String labelKey;\n    protected List<ExperimentalFeatureEditor> editors = new ArrayList<>();\n    protected ParameterizedCommand<EditableExperimentalFeature> callback;\n\n    private boolean expanded = false;\n\n    private boolean enableAllRunning = false;\n\n    @Inject\n    public ExperimentalFeaturesGroup(final ExperimentalFeaturesGroupView view, final TranslationService translationService, final ManagedInstance<ExperimentalFeatureEditor> editorInstance) {\n        this.view = view;\n        this.translationService = translationService;\n        this.editorInstance = editorInstance;\n\n        view.init(this);\n    }\n\n    public void init(final String labelKey, final Collection<ExperimentalFeature> features, final ParameterizedCommand<EditableExperimentalFeature> callback) {\n        PortablePreconditions.checkNotNull(\"labelKey\", labelKey);\n        PortablePreconditions.checkNotNull(\"features\", features);\n        PortablePreconditions.checkNotNull(\"callback\", callback);\n\n        clear();\n\n        this.labelKey = labelKey;\n\n        this.callback = feature -> {\n            callback.execute(feature);\n            setEnableAllLabel();\n        };\n\n        view.setLabel(getLabel());\n\n        features.stream()\n                .map(this::getEditor)\n                .collect(Collectors.toCollection(TreeSet::new))\n                .forEach(view::render);\n\n        setEnableAllLabel();\n    }\n\n    private void setEnableAllLabel() {\n        if (!enableAllRunning) {\n            if (isSelectAll()) {\n                view.setEnableAllLabel(translationService.getTranslation(UberfireExperimentalConstants.ExperimentalFeaturesGroupEnableAll));\n            } else {\n                view.setEnableAllLabel(translationService.getTranslation(UberfireExperimentalConstants.ExperimentalFeaturesGroupDisableAll));\n            }\n        }\n    }\n\n    private boolean isSelectAll() {\n        long enabled = editors.stream().filter(ExperimentalFeatureEditor::isEnabled).count();\n\n        return enabled != editors.size();\n    }\n\n    private ExperimentalFeatureEditor getEditor(ExperimentalFeature experimentalFeature) {\n        ExperimentalFeatureEditor editor = editorInstance.get();\n\n        editor.render(new EditableExperimentalFeature(experimentalFeature), callback);\n\n        editors.add(editor);\n\n        return editor;\n    }\n\n    @Override\n    public void doEnableAll() {\n        final boolean select = isSelectAll();\n\n        enableAllRunning = true;\n\n        editors.stream()\n                .filter(editor -> editor.isEnabled() != select)\n                .forEach(editor -> editor.enable());\n\n        enableAllRunning = false;\n\n        setEnableAllLabel();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public int compareTo(ExperimentalFeaturesGroup other) {\n        if (UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey.equals(labelKey) ||\n                UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey.equals(other.labelKey)) {\n            return Integer.MIN_VALUE;\n        }\n\n        if (UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey.equals(labelKey) ||\n                UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey.equals(other.labelKey)) {\n            return Integer.MAX_VALUE;\n        }\n\n        return getLabel().compareTo(other.getLabel());\n    }\n\n    public void expand() {\n        if (!expanded) {\n            expanded = true;\n            view.expand();\n        }\n    }\n\n    public void collapse() {\n        if (expanded) {\n            expanded = false;\n            view.collapse();\n        }\n    }\n\n    @Override\n    public boolean isExpanded() {\n        return expanded;\n    }\n\n    @Override\n    public void notifyExpand() {\n        expanded = !expanded;\n        view.arrangeCaret();\n    }\n\n    @Override\n    public String getLabel() {\n        String translation = translationService.getTranslation(labelKey);\n\n        if (translation == null) {\n            translation = labelKey;\n        }\n\n        return translation;\n    }\n\n    @PreDestroy\n    public void clear() {\n        editors.clear();\n        view.clear();\n        editorInstance.destroyAll();\n        enableAllRunning = false;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroupView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group;\n\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\n\npublic interface ExperimentalFeaturesGroupView extends UberElemental<ExperimentalFeaturesGroupView.Presenter> {\n\n    void setLabel(String label);\n\n    void setEnableAllLabel(String label);\n\n    void render(ExperimentalFeatureEditor editor);\n\n    void clear();\n\n    void expand();\n\n    void collapse();\n\n    void arrangeCaret();\n\n    interface Presenter {\n\n        void notifyExpand();\n\n        String getLabel();\n\n        void doEnableAll();\n\n        boolean isExpanded();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroupViewImpl.css",
    "content": ".appformer_experimental_features_group_collapse_panel_group {\n    margin-bottom: 0;\n}\n\n.appformer_experimental_features_group_collapse_panel_heading {\n    padding: 0;\n    margin-bottom: 15px;\n    background-image: none !important;\n}\n\n.appformer_experimental_features_group_collapse_panel {\n    background-color: transparent;\n    box-shadow: none;\n    margin-bottom: 0;\n    padding-top: 0;\n}\n\n.appformer_experimental_features_group_collapse_panel_body {\n    border: none !important;\n    padding: 0 !important;\n}\n\n.appformer_experimental_features_group_caret_margin {\n    margin-right: 5px;\n}\n\n.appformer_experimental_features_group_anchor_container {\n    margin-top: 15px;\n    padding-right: 20px;\n}\n\n.appformer_experimental_features_group_anchor {\n    cursor: pointer !important;\n}\n\n.appformer_experimental_features_group_list_group {\n    margin-bottom: 0;\n}"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroupViewImpl.html",
    "content": "<div class=\"panel-group appformer_experimental_features_group_collapse_panel_group\">\n    <div class=\"panel appformer_experimental_features_group_collapse_panel\">\n        <div class=\"panel-heading appformer_experimental_features_group_collapse_panel_heading\">\n            <div class=\"panel-title\">\n                <div class=\"row\">\n                    <div class=\"col-md-6\">\n                        <div class=\"appformer_experimental_features_group_anchor_container\">\n                            <span class=\"appformer_experimental_features_group_caret_margin\"><span data-field=\"caret\" class=\"fa fa-caret-right\"></span></span><label data-field=\"header\" data-toggle=\"collapse\" aria-expanded=\"false\" class=\"collapsed appformer_experimental_features_group_anchor\"></label>\n                        </div>\n                    </div>\n                    <div class=\"col-md-6\">\n                        <div class=\"appformer_experimental_features_group_anchor_container text-right\">\n                            <a data-field=\"enableAll\" class=\"appformer_experimental_features_group_anchor\"></a>\n                        </div>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <div data-field=\"panel\" class=\"panel-collapse collapse\" aria-expanded=\"false\">\n            <div class=\"panel-body appformer_experimental_features_group_collapse_panel_body\">\n                <ul class=\"list-group appformer_experimental_features_group_list_group\" data-field=\"featuresContainer\">\n                </ul>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroupViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.Document;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport elemental2.dom.HTMLLabelElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\nimport org.uberfire.experimental.client.util.ExperimentalUtils;\n\n@Templated\npublic class ExperimentalFeaturesGroupViewImpl implements ExperimentalFeaturesGroupView,\n                                                          IsElement {\n\n    @Inject\n    @DataField\n    private HTMLDivElement panel;\n\n    @Inject\n    @Named(\"span\")\n    @DataField\n    private HTMLElement caret;\n\n    @Inject\n    @DataField\n    private HTMLLabelElement header;\n\n    @Inject\n    @DataField\n    private HTMLUListElement featuresContainer;\n\n    @Inject\n    @DataField\n    private HTMLAnchorElement enableAll;\n\n    @Inject\n    private Elemental2DomUtil util;\n\n    @Inject\n    private Document document;\n\n    private Presenter presenter;\n\n    @PostConstruct\n    public void init() {\n        String id = ExperimentalUtils.createUniqueId();\n        header.setAttribute(\"data-target\", \"#\" + id);\n        panel.setAttribute(\"id\", id);\n    }\n\n    @Override\n    public void setLabel(String label) {\n        header.textContent = label;\n    }\n\n    @Override\n    public void setEnableAllLabel(String label) {\n        enableAll.textContent = label;\n    }\n\n    @Override\n    public void render(ExperimentalFeatureEditor editor) {\n        HTMLLIElement li = (HTMLLIElement) document.createElement(\"li\");\n        li.setAttribute(\"class\", \"list-group-item\");\n        li.appendChild(editor.getElement());\n        featuresContainer.appendChild(li);\n    }\n\n    @Override\n    public void clear() {\n        util.removeAllElementChildren(header);\n        util.removeAllElementChildren(featuresContainer);\n        collapse();\n    }\n\n    @Override\n    public void expand() {\n        header.classList.remove(\"collapsed\");\n        header.setAttribute(\"aria-expanded\", \"true\");\n        panel.classList.add(\"in\");\n        panel.setAttribute(\"aria-expanded\", \"true\");\n        arrangeCaret();\n    }\n\n    @Override\n    public void collapse() {\n        header.classList.add(\"collapsed\");\n        header.setAttribute(\"aria-expanded\", \"false\");\n        panel.classList.remove(\"in\");\n        panel.setAttribute(\"aria-expanded\", \"false\");\n        arrangeCaret();\n    }\n\n    @Override\n    public void arrangeCaret() {\n        if (presenter.isExpanded()) {\n            caret.className = \"fa fa-caret-down\";\n        } else {\n            caret.className = \"fa fa-caret-right\";\n        }\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @EventHandler(\"enableAll\")\n    public void onEnableAll(ClickEvent clickEvent) {\n        presenter.doEnableAll();\n        enableAll.blur();\n    }\n\n    @EventHandler(\"header\")\n    public void onExpand(ClickEvent clickEvent) {\n        presenter.notifyExpand();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group.feature;\n\nimport java.util.Comparator;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class ExperimentalFeatureEditor implements ExperimentalFeatureEditorView.Presenter,\n                                                  IsElement,\n                                                  Comparable<ExperimentalFeatureEditor> {\n\n    private static Comparator<String> comparator = Comparator.nullsFirst(String::compareTo);\n\n    private ExperimentalFeatureDefRegistry registry;\n    private TranslationService translationService;\n    private ExperimentalFeatureEditorView view;\n\n    private EditableExperimentalFeature feature;\n    private ParameterizedCommand<EditableExperimentalFeature> onChange;\n\n    private String name;\n\n    @Inject\n    public ExperimentalFeatureEditor(ExperimentalFeatureDefRegistry registry, TranslationService translationService, ExperimentalFeatureEditorView view) {\n        this.registry = registry;\n        this.translationService = translationService;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void render(EditableExperimentalFeature feature, ParameterizedCommand<EditableExperimentalFeature> onChange) {\n        PortablePreconditions.checkNotNull(\"feature\", feature);\n        PortablePreconditions.checkNotNull(\"onChange\", onChange);\n\n        this.feature = feature;\n        this.onChange = onChange;\n\n        ExperimentalFeatureDefinition definition = registry.getFeatureById(feature.getFeatureId());\n\n        PortablePreconditions.checkNotNull(\"definition\", definition);\n\n        name = getTranslation(definition.getNameKey(), definition.getId());\n\n        String description = getTranslation(definition.getDescriptionKey(), null);\n\n        view.render(name, description, feature.isEnabled());\n    }\n\n    private String getTranslation(String key, String defaultValue) {\n        String result = translationService.getTranslation(key);\n\n        if (result == null) {\n            return defaultValue;\n        }\n\n        return result;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public EditableExperimentalFeature getFeature() {\n        return feature;\n    }\n\n    @Override\n    public void notifyChange(boolean newEnabledValue) {\n        if (newEnabledValue != feature.isEnabled()) {\n            feature.setEnabled(newEnabledValue);\n            onChange.execute(feature);\n        }\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public int compareTo(ExperimentalFeatureEditor other) {\n        return comparator.compare(this.getName(), other.getName());\n    }\n\n    public boolean isEnabled() {\n        return feature.isEnabled();\n    }\n\n    public void enable() {\n        view.setEnabled(!feature.isEnabled());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditorView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group.feature;\n\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface ExperimentalFeatureEditorView extends UberElemental<ExperimentalFeatureEditorView.Presenter> {\n\n    void render(String name, String description, boolean enabled);\n\n    void setEnabled(boolean enabled);\n\n    interface Presenter {\n\n        void notifyChange(boolean newEnabledValue);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditorViewImpl.css",
    "content": ".appformer_experimental_features_editor_element_text {\n    text-overflow: ellipsis;\n    white-space: nowrap;\n    overflow: hidden;\n}"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditorViewImpl.html",
    "content": "<div class=\"row\">\n    <div class=\"col-md-3\">\n        <label data-field=\"name\" class=\"appformer_experimental_features_editor_element_text\"></label>\n    </div>\n    <div class=\"col-md-7\">\n        <label data-field=\"description\" class=\"appformer_experimental_features_editor_element_text text-muted\"></label>\n    </div>\n    <div class=\"col-md-2 text-right\">\n        <div data-field=\"enabled\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditorViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group.feature;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.user.client.Event;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLabelElement;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.ToggleSwitch;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants.SizeType;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class ExperimentalFeatureEditorViewImpl implements ExperimentalFeatureEditorView,\n                                                          IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLLabelElement name;\n\n    @DataField\n    @Inject\n    private HTMLLabelElement description;\n\n    @Inject\n    @DataField\n    private ToggleSwitch enabled;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @PostConstruct\n    public void init() {\n        this.enabled.setSize(SizeType.MINI);\n    }\n\n    @Override\n    public void render(String name, String description, boolean enabled) {\n\n        this.name.textContent = name;\n\n        if (description != null) {\n            this.description.textContent = description;\n        }\n\n        this.enabled.setValue(enabled);\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        this.enabled.setValue(enabled, true);\n    }\n\n    private void maybeAddTitle(HTMLElement element) {\n        if (element.offsetWidth < element.scrollWidth && element.title.isEmpty()) {\n            element.title = element.textContent;\n        }\n    }\n\n    @SinkNative(Event.ONMOUSEOVER)\n    @EventHandler(\"name\")\n    public void onLoadName(Event event) {\n        maybeAddTitle(name);\n    }\n\n    @SinkNative(Event.ONMOUSEOVER)\n    @EventHandler(\"description\")\n    public void onLoadDescription(Event event) {\n        maybeAddTitle(description);\n    }\n\n    @EventHandler(\"enabled\")\n    public void onToggleChange(ChangeEvent event) {\n        presenter.notifyChange(enabled.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/perspective/ExperimentalFeaturesPerspective.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.perspective;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.experimental.client.editor.ExperimentalFeaturesEditorScreen;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = ExperimentalFeaturesPerspective.IDENTIFIER)\npublic class ExperimentalFeaturesPerspective {\n\n    public static final String IDENTIFIER = \"ExperimentalFeaturesPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Experimental Features Editor\");\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(ExperimentalFeaturesEditorScreen.SCREEN_ID)));\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic interface UberfireExperimentalConstants {\n\n    @TranslationKey(defaultValue = \"\")\n    String experimentalFeaturesTitle = \"ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle\";\n\n    @TranslationKey(defaultValue = \"\")\n    String disabledExperimentalFeature = \"DisabledExperimentalFeature\";\n\n    @TranslationKey(defaultValue = \"\")\n    String disabledGlobalExperimentalFeature = \"DisabledGlobalExperimentalFeature\";\n\n    @TranslationKey(defaultValue = \"\")\n    String disabledFeatureTitle = \"DisabledFeatureTitle\";\n\n    @TranslationKey(defaultValue = \"\")\n    String experimentalFeaturesGeneralGroupKey = \"experimentalFeatures.generalGroup\";\n\n    @TranslationKey(defaultValue = \"\")\n    String experimentalFeaturesGlobalGroupKey = \"experimentalFeatures.globalGroup\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ExperimentalFeaturesGroupEnableAll = \"ExperimentalFeaturesGroup.enableAll\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ExperimentalFeaturesGroupDisableAll = \"ExperimentalFeaturesGroup.disableAll\";\n\n    @TranslationKey(defaultValue = \"\")\n    String GlobalExperimentalFeatures = \"experimentalFeatures.global\";\n\n    @TranslationKey(defaultValue = \"\")\n    String GlobalExperimentalFeaturesHelp = \"experimentalFeatures.globalHelp\";\n\n    @TranslationKey(defaultValue = \"\")\n    String GlobalExperimentalFeaturesEdit = \"experimentalFeatures.globalEdit\";\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/ClientExperimentalFeaturesDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\n\npublic interface ClientExperimentalFeaturesDefRegistry extends ExperimentalFeatureDefRegistry {\n\n    void loadRegistry();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/ClientExperimentalFeaturesRegistryService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service;\n\nimport org.uberfire.experimental.service.ExperimentalFeaturesRegistryService;\n\npublic interface ClientExperimentalFeaturesRegistryService extends ExperimentalFeaturesRegistryService {\n\n    void loadRegistry();\n\n    void updateExperimentalFeature(String featureId, boolean enabled);\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/auth/ExperimentalActivitiesAuthorizationManagerImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.auth;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.inject.Singleton;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.experimental.client.disabled.screen.DisabledFeatureActivity;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.client.util.ExperimentalUtils;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.experimental.service.events.NonPortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ConditionalPlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\n@Singleton\npublic class ExperimentalActivitiesAuthorizationManagerImpl implements ExperimentalActivitiesAuthorizationManager {\n\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n    private SyncBeanManager iocManager;\n    private Supplier<String> uniqueIdSupplier;\n    private Event<PerspectiveVisibiltiyChangeEvent> perspectiveVisibleEvent;\n\n    private Map<String, String> activityIdToExperimentalFeatureId = new HashMap<>();\n    private Map<String, String> activityClassToExperimentalFeatureId = new HashMap<>();\n    private List<String> perspectiveIds = new ArrayList<>();\n    private List<String> screenIds = new ArrayList<>();\n    private List<String> editorIds = new ArrayList<>();\n\n    @Inject\n    public ExperimentalActivitiesAuthorizationManagerImpl(SyncBeanManager iocManager, ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService, Event<PerspectiveVisibiltiyChangeEvent> perspectiveVisibleEvent) {\n        this(iocManager, experimentalFeaturesRegistryService, perspectiveVisibleEvent, () -> createUniqueId());\n    }\n\n    ExperimentalActivitiesAuthorizationManagerImpl(SyncBeanManager iocManager, ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService, Event<PerspectiveVisibiltiyChangeEvent> perspectiveVisibleEvent, Supplier<String> uniqueIdSupplier) {\n        this.iocManager = iocManager;\n        this.uniqueIdSupplier = uniqueIdSupplier;\n        this.perspectiveVisibleEvent = perspectiveVisibleEvent;\n        this.experimentalFeaturesRegistryService = experimentalFeaturesRegistryService;\n    }\n\n    public void init() {\n        Collection<SyncBeanDef<ExperimentalActivityReference>> activities = iocManager.lookupBeans(ExperimentalActivityReference.class);\n\n        activities.stream()\n                .map(SyncBeanDef::getInstance)\n                .forEach(activity -> {\n                    activityIdToExperimentalFeatureId.put(activity.getActivityId(), activity.getExperimentalFeatureId());\n                    activityClassToExperimentalFeatureId.put(activity.getActivityTypeName(), activity.getExperimentalFeatureId());\n                    switch (activity.getActivityType()) {\n                        case PERSPECTIVE:\n                            perspectiveIds.add(activity.getActivityId());\n                            break;\n                        case SCREEN:\n                            screenIds.add(activity.getActivityId());\n                            break;\n                        case EDITOR:\n                            editorIds.add(activity.getActivityId());\n                            break;\n                    }\n                });\n    }\n\n    @Override\n    public boolean authorizeActivity(Object activity) {\n        return authorizeActivityClass(activity.getClass());\n    }\n\n    @Override\n    public boolean authorizeActivityClass(Class activityClass) {\n        return authorizeByClassName(activityClass.getName());\n    }\n\n    @Override\n    public void securePart(PartDefinition part, PanelDefinition panel) {\n\n        final PlaceRequest request = part.getPlace();\n        final String identifier = request.getIdentifier();\n\n        if (request instanceof PathPlaceRequest) {\n            return;\n        }\n\n        Optional<String> optional = Optional.ofNullable(activityIdToExperimentalFeatureId.get(identifier));\n\n        if (optional.isPresent()) {\n            panel.removePart(part);\n\n            DefaultPlaceRequest disabledRequest = new DefaultPlaceRequest(DisabledFeatureActivity.ID);\n\n            disabledRequest.addParameter(DisabledFeatureActivity.ID_PARAM, uniqueIdSupplier.get());\n            disabledRequest.addParameter(DisabledFeatureActivity.FEATURE_ID_PARAM, optional.get());\n\n            part.setPlace(new ConditionalPlaceRequest(identifier, request.getParameters()).when(placeRequest -> authorizeActivityId(identifier)).orElse(disabledRequest));\n        }\n    }\n\n    protected boolean authorizeByClassName(final String activityClassName) {\n        return doAuthorize(() -> activityClassToExperimentalFeatureId.get(activityClassName));\n    }\n\n    @Override\n    public boolean authorizeActivityId(final String activityId) {\n        return doAuthorize(() -> activityIdToExperimentalFeatureId.get(activityId));\n    }\n\n    protected boolean doAuthorize(final Supplier<String> keySupplier) {\n        Optional<String> optional = Optional.ofNullable(keySupplier.get());\n\n        return optional.map(this::authorize).orElse(true);\n    }\n\n    protected boolean authorize(final String experimentalFeatureId) {\n        return experimentalFeaturesRegistryService.isFeatureEnabled(experimentalFeatureId);\n    }\n\n    private static String createUniqueId() {\n        return ExperimentalUtils.createUniqueId();\n    }\n\n    public void onFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) {\n        onFeatureModified(event.getFeature());\n    }\n\n    public void onFeatureModified(@Observes NonPortableExperimentalFeatureModifiedEvent event) {\n        onFeatureModified(event.getFeature());\n    }\n\n    private void onFeatureModified(ExperimentalFeature feature) {\n\n        activityIdToExperimentalFeatureId.entrySet().stream()\n                .filter(entry -> perspectiveIds.contains(entry.getKey()) && entry.getValue().equals(feature.getFeatureId()))\n                .findAny()\n                .map(Map.Entry::getKey)\n                .ifPresent(activityId -> perspectiveVisibleEvent.fire(new PerspectiveVisibiltiyChangeEvent(activityId, feature.isEnabled())));\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/auth/ExperimentalActivityReference.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.auth;\n\nimport org.uberfire.client.mvp.WorkbenchActivity;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * Helper class that links a experimental feature to a {@link WorkbenchActivity}\n */\npublic interface ExperimentalActivityReference {\n\n    /**\n     * @return The activity class name.\n     */\n    String getActivityTypeName();\n\n    /**\n     * @return The activity identifier\n     */\n    String getActivityId();\n\n    /**\n     * @return The experimental feature id\n     */\n    String getExperimentalFeatureId();\n\n    /**\n     * @return The activity type\n     */\n    ActivityResourceType getActivityType();\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/impl/CDIClientFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.impl;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesDefRegistry;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\n\n@ApplicationScoped\npublic class CDIClientFeatureDefRegistry extends ExperimentalFeatureDefRegistryImpl implements ClientExperimentalFeaturesDefRegistry {\n\n    private Caller<BackendExperimentalFeatureDefRegistry> backendRegistry;\n\n    @Inject\n    public CDIClientFeatureDefRegistry(Caller<BackendExperimentalFeatureDefRegistry> backendRegistry) {\n        this.backendRegistry = backendRegistry;\n    }\n\n    @Override\n    public void loadRegistry() {\n        Collection<SyncBeanDef<ExperimentalFeatureDefinitionProvider>> providers = IOC.getBeanManager().lookupBeans(ExperimentalFeatureDefinitionProvider.class);\n\n        List<ExperimentalFeatureDefinition> clientFeatures = providers.stream()\n                .map(SyncBeanDef::newInstance)\n                .map(ExperimentalFeatureDefinitionProvider::getDefinition)\n                .collect(Collectors.toList());\n\n        backendRegistry.call(new RemoteCallback<Collection<ExperimentalFeatureDefinition>>() {\n            @Override\n            public void callback(Collection<ExperimentalFeatureDefinition> response) {\n                response.forEach(featureDefinition -> register(featureDefinition));\n            }\n        }).loadFeatureDefinitions(clientFeatures);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/service/impl/ClientExperimentalFeaturesRegistryServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.impl;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.backend.impl.ExperimentalFeaturesSessionImpl;\nimport org.uberfire.experimental.service.events.NonPortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\n\n@ApplicationScoped\npublic class ClientExperimentalFeaturesRegistryServiceImpl implements ClientExperimentalFeaturesRegistryService {\n\n    private Caller<BackendExperimentalFeaturesRegistryService> backendService;\n    private Event<NonPortableExperimentalFeatureModifiedEvent> event;\n\n    private ExperimentalFeaturesSessionImpl session;\n\n    @Inject\n    public ClientExperimentalFeaturesRegistryServiceImpl(Caller<BackendExperimentalFeaturesRegistryService> backendService, Event<NonPortableExperimentalFeatureModifiedEvent> event) {\n        this.backendService = backendService;\n        this.event = event;\n    }\n\n    @Override\n    public void loadRegistry() {\n        backendService.call((RemoteCallback<ExperimentalFeaturesSessionImpl>) experimentalFeaturesSession -> session = experimentalFeaturesSession).getExperimentalFeaturesSession();\n    }\n\n    @Override\n    public ExperimentalFeaturesRegistry getFeaturesRegistry() {\n        return session.getFeaturesRegistry();\n    }\n\n    @Override\n    public boolean isFeatureEnabled(String featureId) {\n\n        // If framework is enabled we must check the feature state\n        if(isExperimentalEnabled()) {\n            return getFeaturesRegistry().isFeatureEnabled(featureId);\n        }\n\n        // If framework is disabled only non experimental features are enabled\n        return !getFeaturesRegistry().getFeature(featureId).isPresent();\n    }\n\n    @Override\n    public void updateExperimentalFeature(String featureId, boolean enabled) {\n        if (isExperimentalEnabled()) {\n\n            Optional<ExperimentalFeature> optional = session.getFeaturesRegistry().getFeature(featureId);\n\n            if (optional.isPresent()) {\n                ExperimentalFeatureImpl feature = (ExperimentalFeatureImpl) optional.get();\n\n                if (feature.isEnabled() != enabled) {\n\n                    feature.setEnabled(enabled);\n\n                    event.fire(new NonPortableExperimentalFeatureModifiedEvent(feature));\n                }\n            }\n        }\n    }\n\n    @Override\n    public Boolean isExperimentalEnabled() {\n        return session.isExperimentalFeaturesEnabled();\n    }\n\n    public void onGlobalFeatureModified(@Observes PortableExperimentalFeatureModifiedEvent event) {\n        updateExperimentalFeature(event.getFeature().getFeatureId(), event.getFeature().isEnabled());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/util/ExperimentalUtils.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.util;\n\nimport com.google.gwt.dom.client.Document;\n\npublic class ExperimentalUtils {\n\n    public static String createUniqueId() {\n        return Document.get().createUniqueId();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/java/org/uberfire/experimental/client/workbench/type/ExperimentalAwareClientTypeRegistryImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.inject.Specializes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.Factory;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.impl.ClientTypeRegistryImpl;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.ExperimentalFeaturesRegistry;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n@Specializes\npublic class ExperimentalAwareClientTypeRegistryImpl extends ClientTypeRegistryImpl {\n\n    private ClientExperimentalFeaturesRegistryService registryService;\n\n    private Map<Class<?>, String> resourceTypeToExperimentalFeature = new HashMap<>();\n\n    @Inject\n    public ExperimentalAwareClientTypeRegistryImpl(SyncBeanManager iocManager, ClientExperimentalFeaturesRegistryService registryService) {\n        super(iocManager);\n        this.registryService = registryService;\n    }\n\n    public void init() {\n        super.init();\n\n        Collection<SyncBeanDef<ResourceTypeDefinition>> resourceTypeDefs = iocManager.lookupBeans(ResourceTypeDefinition.class);\n\n        List<SyncBeanDef<ResourceTypeDefinition>> clientResourceTypes = resourceTypeDefs.stream()\n                .filter(def -> def.isAssignableTo(ClientResourceType.class))\n                .collect(Collectors.toList());\n\n        List<SyncBeanDef<ResourceTypeDefinition>> resourceTypes = resourceTypeDefs.stream()\n                .filter(def -> !def.isAssignableTo(ClientResourceType.class))\n                .collect(Collectors.toList());\n\n        clientResourceTypes.stream()\n                .forEach(clientResourceDef -> {\n                    for (Iterator<SyncBeanDef<ResourceTypeDefinition>> it = resourceTypes.iterator(); it.hasNext(); ) {\n                        SyncBeanDef<ResourceTypeDefinition> resourceDef = it.next();\n                        if (clientResourceDef.isAssignableTo(resourceDef.getBeanClass())) {\n                            Optional<ExperimentalFeature> optional = getFeatureForResourceType(resourceDef, clientResourceDef);\n                            if (optional.isPresent()) {\n                                ExperimentalFeature feature = optional.get();\n                                resourceTypeToExperimentalFeature.put(resourceDef.getBeanClass(), feature.getFeatureId());\n                                resourceTypeToExperimentalFeature.put(clientResourceDef.getBeanClass(), feature.getFeatureId());\n                                it.remove();\n                            }\n                        }\n                    }\n                });\n    }\n\n    private Optional<ExperimentalFeature> getFeatureForResourceType(SyncBeanDef<ResourceTypeDefinition> resourceType, SyncBeanDef<ResourceTypeDefinition> clientResourceType) {\n        ExperimentalFeaturesRegistry registry = registryService.getFeaturesRegistry();\n\n        Optional<ExperimentalFeature> optional = registry.getFeature(resourceType.getBeanClass().getName());\n\n        if(optional.isPresent()) {\n            return optional;\n        }\n\n        return registry.getFeature(clientResourceType.getBeanClass().getName());\n    }\n\n    @Override\n    public boolean isEnabled(ClientResourceType resourceType) {\n        if (super.isEnabled(resourceType)) {\n\n            resourceType = Factory.maybeUnwrapProxy(resourceType);\n\n            Optional<String> optional = Optional.ofNullable(resourceTypeToExperimentalFeature.get(resourceType.getClass()));\n\n            if (optional.isPresent()) {\n                return registryService.isFeatureEnabled(optional.get());\n            }\n\n            return true;\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.experimental.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/UberfireExperimentalClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n\n  <inherits name=\"org.gwtbootstrap3.extras.toggleswitch.ToggleSwitch\"/>\n\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalAPI\"/>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants.properties",
    "content": "ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle=Experimental Features\nExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesWarning=These are experimental features that are under development, \\\n  using them in production environment may cause instability. Please use them only for demo purposes.\n\nDisabledFeatureComponentViewImpl.header=Attention\nDisabledExperimentalFeature=Cannot display content:  the <b>{0}</b> is an experimental feature that it is currently disabled. Please try going to the Experimental Features Editor and enable it.\nDisabledGlobalExperimentalFeature=Cannot display content:  the <b>{0}</b> is an experimental feature currently disabled. If you want to see it, please contact your administrator.\nDisabledFeatureTitle=Disabled Feature\n\nexperimentalFeatures.generalGroup=General\nexperimentalFeatures.globalGroup=Administration\n\nExperimentalFeaturesGroup.enableAll=Enable all\n\nExperimentalFeaturesGroup.disableAll=Disable all\n\nexperimentalFeatures.global=Global Experimental Features\nexperimentalFeatures.globalHelp=Sets who can Update the Global Experimental Features at the Administration perspective.\nexperimentalFeatures.globalEdit=Edit"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants_es.properties",
    "content": "ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle=Funcionalidades experimentales\nExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesWarning=Estas son funcionalidades experimentales que se están desarrollando; su uso en un entorno de producción puede causar inestabilidad. Úselas solo para fines de demostración.\n\nDisabledFeatureComponentViewImpl.header=Atención\nDisabledExperimentalFeature=No puede visualizar el contenido: <b>{0}</b> es una funcionalidad experimental que está actualmente deshabilitada. Intente ir al Editor de funcionalidades experimentales y habilítela.\nDisabledGlobalExperimentalFeature=No se puede visualizar el contenido: <b>{0}</b> es una funcionalidad experimental actualmente deshabilitada. Si desea verla, póngase en contacto con el administrador.\nDisabledFeatureTitle=Funcionalidad deshabilitada\n\nexperimentalFeatures.generalGroup=General\nexperimentalFeatures.globalGroup=Administración\n\nExperimentalFeaturesGroup.enableAll=Habilitar todo\n\nExperimentalFeaturesGroup.disableAll=Deshabilitar todo\n\nexperimentalFeatures.global=Funcionalidades experimentales globales\nexperimentalFeatures.globalHelp=Establece quién puede actualizar las funcionalidades experimentales globales en la perspectiva de la administración.\nexperimentalFeatures.globalEdit=Editar"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants_fr.properties",
    "content": "ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle=Fonctionnalités expérimentales\nExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesWarning=Il s''agit de fonctionnalités expérimentales en cours de développement. Les utiliser dans un environnement de production peut entraîner une instabilité. Veuillez les utiliser uniquement à des fins de démonstration.\n\nDisabledFeatureComponentViewImpl.header=Attention\nDisabledExperimentalFeature=Impossible d’afficher le contenu : <b>{0}</b> est une fonctionnalité expérimentale qui est actuellement désactivée. Essayez d''accéder à l''éditeur de fonctionnalités expérimentales et activez-le.\nDisabledGlobalExperimentalFeature=Impossible d’afficher le contenu : <b>{0}</b> est une fonctionnalité expérimentale qui est actuellement désactivée. Si vous souhaitez l''afficher, veuillez contacter votre administrateur.\nDisabledFeatureTitle=Fonctionnalité désactivée\n\nexperimentalFeatures.generalGroup=Général\nexperimentalFeatures.globalGroup=Administration\n\nExperimentalFeaturesGroup.enableAll=Activer tout\n\nExperimentalFeaturesGroup.disableAll=Désactiver tout\n\nexperimentalFeatures.global=Fonctionnalités expérimentales globales\nexperimentalFeatures.globalHelp=Définit les personnes autorisées à mettre à jour les fonctionnalités expérimentales globales au niveau de la perspective d''administration.\nexperimentalFeatures.globalEdit=Modifier"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants_it.properties",
    "content": "ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle=Funzionalità Sperimentale\nExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesWarning=Queste funzionalità sperimentali sono sotto sviluppo, \\\n  using in produzione possono causate instabilità. Per favore usale solo per scopi dimostrativi.\n\nDisabledFeatureComponentViewImpl.header=Attenzione\nDisabledExperimentalFeature=Impossibile visualizzare il contenuto: la funzionalità sperimentale <b>{0}</b> è attualmente disabilitata. Prova ad andare all''Editor delle Funzionalità Sperimentali e abilitala.\nDisabledGlobalExperimentalFeature=Impossibile visualizzare il contenuto: la funzionalità sperimentale globale <b>{0}</b> è attualmente disabilitata. Se desideri vederla, contatta l''amministratore.\nDisabledFeatureTitle=Funzionalità Disabilitata\n\nexperimentalFeatures.generalGroup=Generale\nexperimentalFeatures.globalGroup=Amministrazione\n\nExperimentalFeaturesGroup.enableAll=Abilita tutto\n\nExperimentalFeaturesGroup.disableAll=Disabilita tutto\n\nexperimentalFeatures.global=Funzionalità Sperimentali Globali\nexperimentalFeatures.globalHelp=Imposta chi può aggiornare le Funzionalità Sperimentali Globali nella prospettiva di Amministrazione.\nexperimentalFeatures.globalEdit=Modifica\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/main/resources/org/uberfire/experimental/client/resources/i18n/UberfireExperimentalConstants_ja.properties",
    "content": "ExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesTitle=実験的機能\nExperimentalFeaturesEditorScreenViewImpl.experimentalFeaturesWarning=これらの実験的機能は開発中であり、実稼働環境で使用すると、システムが不安定になる可能性があります。使用する場合は、デモ目的のみとしてください。\n\nDisabledFeatureComponentViewImpl.header=注意\nDisabledExperimentalFeature=コンテンツを表示できません: <b>{0}</b>  は実験的機能であり、現在無効になっています。実験的機能エディターにアクセスして有効にしてください。\nDisabledGlobalExperimentalFeature=コンテンツを表示できません: <b>{0}</b>  は実験的機能であり、現在無効になっています。表示するには、管理者に連絡してください。\nDisabledFeatureTitle=無効な機能\n\nexperimentalFeatures.generalGroup=全般\nexperimentalFeatures.globalGroup=管理\n\nExperimentalFeaturesGroup.enableAll=すべて有効にする\n\nExperimentalFeaturesGroup.disableAll=すべて無効にする\n\nexperimentalFeatures.global=グローバル実験的機能\nexperimentalFeatures.globalHelp=管理パースペクティブでグローバル実験的機能を更新可能なユーザーを設定する\nexperimentalFeatures.globalEdit=編集"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/disabled/component/DisabledFeatureComponentTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.component;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisabledFeatureComponentTest {\n\n    private String EXPERIMENTAL_FEATURE_ID = \"a random id\";\n\n    @Mock\n    private DisabledFeatureComponentView view;\n\n    @Mock\n    private ExperimentalFeatureDefRegistry registry;\n\n    @Mock\n    private TranslationService translationService;\n\n    private DisabledFeatureComponent component;\n\n    @Before\n    public void init() {\n        component = new DisabledFeatureComponent(view, registry, translationService);\n    }\n\n    @Test\n    public void testShowMissingExperimentalFeature() {\n        Assertions.assertThatThrownBy(() -> component.show(EXPERIMENTAL_FEATURE_ID))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'experimentalFeature' should be not null!\");\n\n        verify(translationService, never()).getTranslation(anyString());\n        verify(translationService, never()).format(anyString(), anyString());\n        verify(view, never()).show(anyString());\n    }\n\n    @Test\n    public void testShowExperimentalFeature() {\n        testShowExperimentalFeature(false);\n    }\n\n    @Test\n    public void testShowGlobalExperimentalFeature() {\n        testShowExperimentalFeature(true);\n    }\n\n    private void testShowExperimentalFeature(boolean global) {\n        ExperimentalFeatureDefinition definition = new ExperimentalFeatureDefinition(EXPERIMENTAL_FEATURE_ID, global, \"\", EXPERIMENTAL_FEATURE_ID, EXPERIMENTAL_FEATURE_ID);\n\n        when(registry.getFeatureById(eq(EXPERIMENTAL_FEATURE_ID))).thenReturn(definition);\n\n        component.show(EXPERIMENTAL_FEATURE_ID);\n\n        verify(translationService).getTranslation(EXPERIMENTAL_FEATURE_ID);\n\n        String i18nConstant = global ? UberfireExperimentalConstants.disabledGlobalExperimentalFeature : UberfireExperimentalConstants.disabledExperimentalFeature;\n\n        verify(translationService).format(eq(i18nConstant), anyString());\n\n        verify(view).show(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/disabled/screen/DisabledFeatureActivityTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.disabled.screen;\n\nimport java.util.HashMap;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.experimental.client.disabled.component.DisabledFeatureComponent;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DisabledFeatureActivityTest {\n\n    private String EXPERIMENTAL_FEATURE_ID = \"a random id\";\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private DisabledFeatureComponent component;\n\n    @Mock\n    private TranslationService translationService;\n\n    private PlaceRequest placeRequest;\n\n    private DisabledFeatureActivity activity;\n\n    @Before\n    public void init() {\n        placeRequest = spy(new DefaultPlaceRequest(DisabledFeatureActivity.ID, new HashMap<>()));\n        placeRequest.addParameter(DisabledFeatureActivity.ID_PARAM, EXPERIMENTAL_FEATURE_ID);\n        placeRequest.addParameter(DisabledFeatureActivity.FEATURE_ID_PARAM, EXPERIMENTAL_FEATURE_ID);\n\n        activity = new DisabledFeatureActivity(placeManager, component, translationService);\n\n        activity.onStartup(placeRequest);\n    }\n\n    @Test\n    public void testFunctionality() {\n        activity.onOpen();\n\n        verify(placeRequest).getParameter(DisabledFeatureActivity.FEATURE_ID_PARAM, null);\n\n        verify(component).show(EXPERIMENTAL_FEATURE_ID);\n\n        activity.getTitle();\n\n        verify(translationService).getTranslation(UberfireExperimentalConstants.disabledFeatureTitle);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/editor/ExperimentalFeaturesEditorScreenTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.assertj.core.api.Assertions;\nimport org.assertj.core.api.MapAssert;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.experimental.client.editor.group.ExperimentalFeaturesGroup;\nimport org.uberfire.experimental.client.editor.group.ExperimentalFeaturesGroupView;\nimport org.uberfire.experimental.client.editor.group.TestExperimentalFeaturesGroup;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.editor.FeaturesEditorService;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry.FEATURE_1;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalFeaturesEditorScreenTest {\n\n    private static final String USER_NAME = \"user\";\n\n    @Mock\n    private ManagedInstance<ExperimentalFeatureEditor> editorInstance;\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private ClientExperimentalFeaturesRegistryService registryService;\n\n    private ExperimentalFeatureDefRegistry defRegistry;\n\n    private ExperimentalFeaturesRegistryImpl registry;\n\n    private List<ExperimentalFeatureImpl> features = new ArrayList<>();\n\n    @Mock\n    private ExperimentalFeaturesEditorScreenView view;\n\n    @Mock\n    private ManagedInstance<ExperimentalFeaturesGroup> instance;\n\n    @Mock\n    private FeaturesEditorService featuresEditorService;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    private SessionInfoMock sessionInfo;\n\n    private CallerMock<FeaturesEditorService> editorServiceCaller;\n\n    private ExperimentalFeaturesEditorScreen presenter;\n\n    private List<TestExperimentalFeaturesGroup> groups = new ArrayList<>();\n\n    @Before\n    public void init() {\n\n        when(editorInstance.get()).thenReturn(mock(ExperimentalFeatureEditor.class));\n\n        sessionInfo = new SessionInfoMock(USER_NAME);\n\n        defRegistry = new TestExperimentalFeatureDefRegistry();\n\n        features = defRegistry.getAllFeatures().stream()\n                .map(def -> new ExperimentalFeatureImpl(def.getId(), false))\n                .collect(Collectors.toList());\n\n        registry = new ExperimentalFeaturesRegistryImpl(features);\n\n        when(registryService.getFeaturesRegistry()).thenReturn(registry);\n\n        when(instance.get()).thenAnswer((Answer<ExperimentalFeaturesGroup>) invocationOnMock -> createGroup());\n\n        editorServiceCaller = new CallerMock<>(featuresEditorService);\n\n        presenter = new ExperimentalFeaturesEditorScreen(translationService, registryService, defRegistry, view, instance, editorServiceCaller, sessionInfo, authorizationManager);\n    }\n\n    @Test\n    public void testBasicFunctions() {\n        presenter.init();\n\n        verify(view).init(presenter);\n\n        presenter.getTitle();\n\n        verify(translationService).getTranslation(UberfireExperimentalConstants.experimentalFeaturesTitle);\n\n        presenter.clear();\n\n        verifyClear();\n\n        assertSame(view, presenter.getView());\n    }\n\n    @Test\n    public void testShowGroupsWithPermissions() {\n\n        testShowGroups(true);\n    }\n\n    @Test\n    public void testShowGroupsWithoutPermissions() {\n\n        testShowGroups(false);\n    }\n\n    private void testShowGroups(final boolean withPermissions) {\n\n        when(authorizationManager.authorize(any(ResourceType.class), any(ResourceAction.class), any(User.class))).thenReturn(withPermissions);\n\n        presenter.show();\n\n        verifyClear();\n\n        int expectedGroups = 2;\n\n        final List<String> expectedGroupNames = new ArrayList<>();\n        expectedGroupNames.add(UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey);\n        expectedGroupNames.add(TestExperimentalFeatureDefRegistry.GROUP);\n\n        if (withPermissions) {\n            expectedGroups++;\n            expectedGroupNames.add(UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey);\n        }\n\n        verify(instance, times(expectedGroups)).get();\n\n        Map<String, TestExperimentalFeaturesGroup> groupMap = groups.stream()\n                .collect(Collectors.toMap(TestExperimentalFeaturesGroup::getLabelKey, group -> group));\n\n        MapAssert<String, TestExperimentalFeaturesGroup> mapAssert = Assertions.assertThat(groupMap);\n\n        mapAssert.hasSize(expectedGroups)\n                .containsKeys(expectedGroupNames.toArray(new String[expectedGroups]));\n    }\n\n    @Test\n    public void testModificationCallback() {\n        EditableExperimentalFeature feature = new EditableExperimentalFeature(FEATURE_1, true);\n\n        presenter.doSave(feature);\n\n        verify(featuresEditorService).save(feature);\n        verify(registryService).updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled());\n    }\n\n    private ExperimentalFeaturesGroup createGroup() {\n        TestExperimentalFeaturesGroup group = new TestExperimentalFeaturesGroup(mock(ExperimentalFeaturesGroupView.class), mock(TranslationService.class), editorInstance);\n\n        groups.add(group);\n\n        return group;\n    }\n\n    private void verifyClear() {\n        verify(view).clear();\n        verify(instance).destroyAll();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/editor/group/ExperimentalFeaturesGroupTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.TreeSet;\nimport java.util.stream.Collectors;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditorView;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalFeaturesGroupTest {\n\n    private static final String GROUP_KEY = \"group\";\n\n    private static final String ANOTHER_GROUP_KEY = \"group2\";\n\n    @Mock\n    private ExperimentalFeaturesGroupView view;\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private ManagedInstance<ExperimentalFeatureEditor> editorInstance;\n\n    @Mock\n    private ParameterizedCommand<EditableExperimentalFeature> callback;\n\n    private TestExperimentalFeatureDefRegistry defRegistry;\n\n    private List<ExperimentalFeatureImpl> features;\n    private List<ExperimentalFeatureEditor> editors;\n\n    private ExperimentalFeaturesGroup group;\n\n    @Before\n    public void init() {\n\n        defRegistry = new TestExperimentalFeatureDefRegistry();\n\n        features = defRegistry.getUserFeatures().stream()\n                .map(definition -> new ExperimentalFeatureImpl(definition.getId(), false))\n                .collect(Collectors.toList());\n\n        editors = new ArrayList<>();\n\n        when(editorInstance.get()).then(invocationOnMock -> {\n            ExperimentalFeatureEditorView editorView = mock(ExperimentalFeatureEditorView.class);\n\n            ExperimentalFeatureEditor editor = spy(new ExperimentalFeatureEditor(defRegistry, translationService, editorView));\n\n            doAnswer((Answer<Void>) invocationOnMock1 -> {\n                Boolean enabled = (Boolean) invocationOnMock1.getArguments()[0];\n                editor.notifyChange(enabled);\n                return null;\n            }).when(editorView).setEnabled(anyBoolean());\n\n            editors.add(editor);\n\n            return editor;\n        });\n\n        group = new ExperimentalFeaturesGroup(view, translationService, editorInstance);\n\n        verify(view).init(group);\n\n        group.getElement();\n\n        verify(view).getElement();\n    }\n\n    @Test\n    public void testLoadWithEnableAllAnchor() {\n        testLoad(true);\n    }\n\n    @Test\n    public void testLoadWithDisableAllAnchor() {\n        testLoad(false);\n    }\n\n    @Test\n    public void testPressEnableAll() {\n\n        testLoad(true);\n\n        testAnchorPress(false);\n    }\n\n    @Test\n    public void testPressDisableAll() {\n\n        testLoad(false);\n\n        testAnchorPress(true);\n    }\n\n    @Test\n    public void testExpandAndCollapse() {\n\n        assertFalse(group.isExpanded());\n\n        group.collapse();\n\n        verify(view, never()).collapse();\n\n        group.expand();\n\n        assertTrue(group.isExpanded());\n        verify(view).expand();\n\n        group.expand();\n\n        verify(view).expand();\n\n        group.collapse();\n\n        assertFalse(group.isExpanded());\n        verify(view).collapse();\n\n        group.notifyExpand();\n        verify(view).arrangeCaret();\n    }\n\n    @Test\n    public void testGroupsSorting() {\n\n        ExperimentalFeaturesGroup generalGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance);\n        generalGroup.init(UberfireExperimentalConstants.experimentalFeaturesGeneralGroupKey, new ArrayList<>(), callback);\n\n        ExperimentalFeaturesGroup secondGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance);\n        secondGroup.init(GROUP_KEY, new ArrayList<>(), callback);\n\n        ExperimentalFeaturesGroup thirdGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance);\n        thirdGroup.init(ANOTHER_GROUP_KEY, new ArrayList<>(), callback);\n\n        ExperimentalFeaturesGroup adminGroup = new ExperimentalFeaturesGroup(view, translationService, editorInstance);\n        adminGroup.init(UberfireExperimentalConstants.experimentalFeaturesGlobalGroupKey, new ArrayList<>(), callback);\n\n        TreeSet<ExperimentalFeaturesGroup> groups = new TreeSet<>();\n        groups.add(secondGroup);\n        groups.add(adminGroup);\n        groups.add(generalGroup);\n        groups.add(thirdGroup);\n\n        Assertions.assertThat(groups)\n                .hasSize(4)\n                .containsExactly(generalGroup, secondGroup, thirdGroup, adminGroup);\n    }\n\n    private void testAnchorPress(boolean enabled) {\n        group.doEnableAll();\n\n        editors.forEach(editor -> verify(editor).enable());\n\n        verify(callback, times(3)).execute(any());\n\n        checkSetEnableAllLabel(enabled, 2);\n    }\n\n    private void testLoad(boolean enableAll) {\n\n        if (!enableAll) {\n            features.forEach(feature -> feature.setEnabled(true));\n        }\n\n        group.init(GROUP_KEY, new ArrayList<>(features), callback);\n\n        checkClear();\n\n        verify(view).setLabel(GROUP_KEY);\n\n        checkSetEnableAllLabel(enableAll, 1);\n    }\n\n    private void checkSetEnableAllLabel(boolean isEnabled, int times) {\n        verify(view, times(times)).setEnableAllLabel(any());\n\n        if (isEnabled) {\n            verify(translationService).getTranslation(UberfireExperimentalConstants.ExperimentalFeaturesGroupEnableAll);\n        } else {\n            verify(translationService).getTranslation(UberfireExperimentalConstants.ExperimentalFeaturesGroupDisableAll);\n        }\n    }\n\n    @Test\n    public void testClear() {\n        group.clear();\n\n        checkClear();\n    }\n\n    private void checkClear() {\n        verify(view).clear();\n        verify(editorInstance).destroyAll();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/editor/group/TestExperimentalFeaturesGroup.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.experimental.client.editor.group.feature.ExperimentalFeatureEditor;\n\npublic class TestExperimentalFeaturesGroup extends ExperimentalFeaturesGroup {\n\n    public TestExperimentalFeaturesGroup(ExperimentalFeaturesGroupView view, TranslationService translationService, ManagedInstance<ExperimentalFeatureEditor> editorInstance) {\n        super(view, translationService, editorInstance);\n    }\n\n    public String getLabelKey() {\n        return labelKey;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/editor/group/feature/ExperimentalFeatureEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.editor.group.feature;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry;\nimport org.uberfire.experimental.service.editor.EditableExperimentalFeature;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalFeatureEditorTest {\n\n    private TestExperimentalFeatureDefRegistry defRegistry;\n\n    @Mock\n    private ExperimentalFeatureEditorView view;\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private ParameterizedCommand<EditableExperimentalFeature> onChange;\n\n    private ExperimentalFeatureEditor editor;\n\n    @Before\n    public void init() {\n\n        defRegistry = new TestExperimentalFeatureDefRegistry();\n\n        editor = new ExperimentalFeatureEditor(defRegistry, translationService, view);\n    }\n\n    @Test\n    public void testBasicFunctionallity() {\n        editor.init();\n\n        verify(view).init(editor);\n\n        editor.getElement();\n\n        verify(view).getElement();\n\n        EditableExperimentalFeature feature = spy(new EditableExperimentalFeature(TestExperimentalFeatureDefRegistry.FEATURE_1, false));\n\n        editor.render(feature, onChange);\n\n        verify(translationService, times(2)).getTranslation(TestExperimentalFeatureDefRegistry.FEATURE_1);\n\n        verify(view).render(eq(TestExperimentalFeatureDefRegistry.FEATURE_1), eq(null), eq(false));\n\n        assertSame(feature, editor.getFeature());\n        assertEquals(TestExperimentalFeatureDefRegistry.FEATURE_1, editor.getName());\n\n        editor.notifyChange(false);\n\n        verify(feature, never()).setEnabled(false);\n        verify(onChange, never()).execute(any());\n\n        editor.notifyChange(true);\n        verify(onChange).execute(any());\n\n        verify(feature).setEnabled(true);\n        verify(onChange).execute(any());\n\n        editor.notifyChange(false);\n        verify(onChange, times(2)).execute(any());\n\n        verify(feature).setEnabled(false);\n        verify(onChange, times(2)).execute(any());\n\n        assertFalse(editor.isEnabled());\n        verify(feature, times(5)).isEnabled();\n\n        editor.enable();\n\n        verify(feature, times(6)).isEnabled();\n        verify(view).setEnabled(true);\n    }\n\n    @Test\n    public void testCompareTo() {\n\n        new ArrayList<>();\n\n        ExperimentalFeatureEditor editor4 = new ExperimentalFeatureEditor(defRegistry, translationService, mock(ExperimentalFeatureEditorView.class));\n\n        ExperimentalFeatureImpl feature3 = new ExperimentalFeatureImpl(TestExperimentalFeatureDefRegistry.FEATURE_3, false);\n        ExperimentalFeatureEditor editor3 = new ExperimentalFeatureEditor(defRegistry, translationService, mock(ExperimentalFeatureEditorView.class));\n        editor3.render(new EditableExperimentalFeature(feature3), mock(ParameterizedCommand.class));\n\n        ExperimentalFeatureImpl feature1 = new ExperimentalFeatureImpl(TestExperimentalFeatureDefRegistry.FEATURE_1, false);\n        ExperimentalFeatureEditor editor1 = new ExperimentalFeatureEditor(defRegistry, translationService, mock(ExperimentalFeatureEditorView.class));\n        editor1.render(new EditableExperimentalFeature(feature1), mock(ParameterizedCommand.class));\n\n        ExperimentalFeatureEditor editor5 = new ExperimentalFeatureEditor(defRegistry, translationService, mock(ExperimentalFeatureEditorView.class));\n\n        ExperimentalFeatureImpl feature2 = new ExperimentalFeatureImpl(TestExperimentalFeatureDefRegistry.FEATURE_2, false);\n        ExperimentalFeatureEditor editor2 = new ExperimentalFeatureEditor(defRegistry, translationService, mock(ExperimentalFeatureEditorView.class));\n        editor2.render(new EditableExperimentalFeature(feature2), mock(ParameterizedCommand.class));\n\n        List<ExperimentalFeatureEditor> editors = Arrays.asList(editor1, editor2, editor3, editor4, editor5);\n\n        List<ExperimentalFeatureEditor> sortedEditors = editors.stream().sorted().collect(Collectors.toList());\n\n        Assertions.assertThat(sortedEditors)\n                .hasSize(editors.size())\n                .containsExactly(editor4, editor5, editor1, editor2, editor3);\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/service/auth/ExperimentalActivitiesAuthorizationManagerImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.auth;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.UUID;\nimport java.util.function.BiConsumer;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.event.Event;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.client.test.TestExperimentalActivityReference;\nimport org.uberfire.experimental.client.test.model.TestExperimentalScreen1Activity;\nimport org.uberfire.experimental.client.test.model.TestExperimentalScreen2Activity;\nimport org.uberfire.experimental.client.test.model.TestNonExperimentalScreenActivity;\nimport org.uberfire.experimental.service.events.NonPortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.ExperimentalFeature;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ConditionalPlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalActivitiesAuthorizationManagerImplTest {\n\n    private static final String ACTIVITY_1_ID_TYPENAME = \"org.uberfire.experimental.client.test.model.TestExperimentalScreen1Activity\";\n    private static final String ACTIVITY_1_ID = \"TestExperimentalScreen1\";\n    private static final String FEATURE_1_ID = \"org.uberfire.experimental.client.test.model.TestExperimentalScreen1\";\n\n    private static final String ACTIVITY_2_ID_TYPENAME = \"org.uberfire.experimental.client.test.model.TestExperimentalScreen2Activity\";\n    private static final String ACTIVITY_2_ID = \"TestExperimentalScreen2\";\n    private static final String FEATURE_2_ID = \"org.uberfire.experimental.client.test.model.TestExperimentalScreen2\";\n\n    private static final String NON_EXPERIMENTAL_ACTIVITY_ID = \"TestNonExperimentalScreen\";\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private SyncBeanManager syncBeanManager;\n\n    @Mock\n    private ClientExperimentalFeaturesRegistryService registryService;\n\n    @Mock\n    private Event<PerspectiveVisibiltiyChangeEvent> perspectiveVisibleEvent;\n\n    private ExperimentalActivitiesAuthorizationManagerImpl authorizationManager;\n\n    @Before\n    public void init() {\n        when(syncBeanManager.lookupBeans(ExperimentalActivityReference.class)).thenAnswer((Answer<Collection<SyncBeanDef<ExperimentalActivityReference>>>) invocationOnMock -> getReferences());\n\n        authorizationManager = spy(new ExperimentalActivitiesAuthorizationManagerImpl(syncBeanManager, registryService, perspectiveVisibleEvent, () -> UUID.randomUUID().toString()));\n\n        authorizationManager.init();\n\n        when(registryService.isFeatureEnabled(FEATURE_1_ID)).thenReturn(true);\n        when(registryService.isFeatureEnabled(FEATURE_2_ID)).thenReturn(false);\n    }\n\n    @Test\n    public void testAuthorizeActivities() {\n        assertTrue(authorizationManager.authorizeActivity(new TestExperimentalScreen1Activity(placeManager)));\n\n        verify(registryService).isFeatureEnabled(FEATURE_1_ID);\n\n        assertFalse(authorizationManager.authorizeActivity(new TestExperimentalScreen2Activity(placeManager)));\n\n        verify(registryService).isFeatureEnabled(FEATURE_2_ID);\n\n        assertTrue(authorizationManager.authorizeActivity(new TestNonExperimentalScreenActivity(placeManager)));\n\n        verify(registryService, times(2)).isFeatureEnabled(anyString());\n    }\n\n    @Test\n    public void testSecurePartWithPathPlaceRequest() {\n        testSecure(ACTIVITY_1_ID, PathPlaceRequest.class, this::validateDoNothingSecure);\n    }\n\n    @Test\n    public void testSecurePartWithExperimentalPlaceRequest() {\n        testSecure(ACTIVITY_1_ID, DefaultPlaceRequest.class, this::validateSecure);\n    }\n\n    @Test\n    public void testSecurePartWithOUTExperimentalPlaceRequest() {\n        testSecure(NON_EXPERIMENTAL_ACTIVITY_ID, DefaultPlaceRequest.class, this::validateDoNothingSecure);\n    }\n\n    @Test\n    public void testOnFeatureModifiedEvent() {\n        testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new NonPortableExperimentalFeatureModifiedEvent(feature)));\n    }\n\n    @Test\n    public void testOnFeatureModifiedGlobalEvent() {\n        testOnFeatureModified(feature -> authorizationManager.onFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature)));\n    }\n\n    private void testOnFeatureModified(Consumer<ExperimentalFeature> authorizationEventConsumer) {\n\n        authorizationEventConsumer.accept(new ExperimentalFeatureImpl(FEATURE_2_ID, true));\n\n        verify(perspectiveVisibleEvent, never()).fire(any());\n\n        authorizationEventConsumer.accept(new ExperimentalFeatureImpl(FEATURE_1_ID, true));\n\n        ArgumentCaptor<PerspectiveVisibiltiyChangeEvent> captor = ArgumentCaptor.forClass(PerspectiveVisibiltiyChangeEvent.class);\n\n        verify(perspectiveVisibleEvent).fire(captor.capture());\n\n        Assertions.assertThat(captor.getValue())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"perspectiveId\", ACTIVITY_1_ID)\n                .hasFieldOrPropertyWithValue(\"visible\", true);\n\n        authorizationEventConsumer.accept(new ExperimentalFeatureImpl(FEATURE_1_ID, false));\n\n        captor = ArgumentCaptor.forClass(PerspectiveVisibiltiyChangeEvent.class);\n\n        verify(perspectiveVisibleEvent, times(2)).fire(captor.capture());\n\n        Assertions.assertThat(captor.getValue())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"perspectiveId\", ACTIVITY_1_ID)\n                .hasFieldOrPropertyWithValue(\"visible\", false);\n    }\n\n    private void testSecure(String activityId, Class<? extends PlaceRequest> requestType, BiConsumer<PanelDefinition, PartDefinition> validation) {\n        PlaceRequest request = mock(requestType);\n\n        when(request.getIdentifier()).thenReturn(activityId);\n\n        PanelDefinition panel = mock(PanelDefinition.class);\n\n        PartDefinition part = mock(PartDefinition.class);\n\n        when(part.getPlace()).thenReturn(request);\n\n        authorizationManager.securePart(part, panel);\n\n        validation.accept(panel, part);\n    }\n\n    private void validateDoNothingSecure(PanelDefinition panel, PartDefinition part) {\n        verify(panel, never()).removePart(part);\n        verify(part, never()).setPlace(any());\n    }\n\n    private void validateSecure(PanelDefinition panel, PartDefinition part) {\n        verify(panel).removePart(part);\n        verify(part).setPlace(any(ConditionalPlaceRequest.class));\n    }\n\n    private Collection<SyncBeanDef<ExperimentalActivityReference>> getReferences() {\n        return Arrays.asList(createReference(new TestExperimentalActivityReference(ACTIVITY_1_ID_TYPENAME, ACTIVITY_1_ID, FEATURE_1_ID, ActivityResourceType.PERSPECTIVE)),\n                             createReference(new TestExperimentalActivityReference(ACTIVITY_2_ID_TYPENAME, ACTIVITY_2_ID, FEATURE_2_ID, ActivityResourceType.SCREEN)));\n    }\n\n    private SyncBeanDef<ExperimentalActivityReference> createReference(ExperimentalActivityReference activityReference) {\n        SyncBeanDef<ExperimentalActivityReference> def = mock(SyncBeanDef.class);\n        when(def.getInstance()).thenReturn(activityReference);\n        return def;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/service/impl/ClientExperimentalFeaturesRegistryServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.service.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.service.backend.BackendExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.service.backend.impl.ExperimentalFeaturesSessionImpl;\nimport org.uberfire.experimental.service.events.NonPortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.events.PortableExperimentalFeatureModifiedEvent;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry.FEATURE_1;\nimport static org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry.FEATURE_2;\nimport static org.uberfire.experimental.client.test.TestExperimentalFeatureDefRegistry.FEATURE_3;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClientExperimentalFeaturesRegistryServiceImplTest {\n\n    private static final String WRONG_FEATURE_ID = \"this feature shouldn't exist\";\n\n    @Mock\n    private BackendExperimentalFeaturesRegistryService backendService;\n\n    @Mock\n    private Event<NonPortableExperimentalFeatureModifiedEvent> event;\n\n    private CallerMock<BackendExperimentalFeaturesRegistryService> callerMock;\n\n    private ExperimentalFeaturesRegistryImpl registry;\n\n    private ClientExperimentalFeaturesRegistryServiceImpl service;\n\n    @Before\n    public void init() {\n        callerMock = new CallerMock<>(backendService);\n\n        service = new ClientExperimentalFeaturesRegistryServiceImpl(callerMock, event);\n    }\n\n    @Test\n    public void tesBasicTestExperimentalEnabled() {\n\n        doBasicTest(true);\n    }\n\n    @Test\n    public void tesBasicTestExperimentalDisabled() {\n\n        doBasicTest(false);\n    }\n\n    @Test\n    public void testNotifyFeatureUpdate() {\n\n        initService(true);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false);\n\n        service.updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled());\n\n        checkNotifyFeatureUpdate(feature);\n    }\n\n    @Test\n    public void testNotifyFeatureUpdateViaEvent() {\n\n        initService(true);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false);\n\n        service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature));\n\n        checkNotifyFeatureUpdate(feature);\n    }\n\n    private void checkNotifyFeatureUpdate(ExperimentalFeatureImpl feature) {\n\n        ArgumentCaptor<NonPortableExperimentalFeatureModifiedEvent> eventCaptor = ArgumentCaptor.forClass(NonPortableExperimentalFeatureModifiedEvent.class);\n\n        verify(event).fire(eventCaptor.capture());\n\n        assertEquals(feature, eventCaptor.getValue().getFeature());\n    }\n\n    @Test\n    public void testWrongNotifyFeatureUpdate() {\n\n        initService(true);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, true);\n\n        service.updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled());\n\n        verify(event, never()).fire(any());\n\n        feature = new ExperimentalFeatureImpl(WRONG_FEATURE_ID, true);\n\n        service.updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled());\n\n        verify(event, never()).fire(any());\n    }\n\n    @Test\n    public void testWrongNotifyFeatureUpdateViaEvent() {\n\n        initService(true);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, true);\n\n        service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature));\n\n        verify(event, never()).fire(any());\n\n        feature = new ExperimentalFeatureImpl(WRONG_FEATURE_ID, true);\n\n        service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature));\n\n        verify(event, never()).fire(any());\n    }\n\n    @Test\n    public void testNotifyFeatureUpdateWhenExperimentalDisabled() {\n\n        initService(false);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false);\n\n        service.updateExperimentalFeature(feature.getFeatureId(), feature.isEnabled());\n\n        verify(event, never()).fire(any());\n    }\n\n    @Test\n    public void testNotifyFeatureUpdateWhenExperimentalDisabledViaEvent() {\n\n        initService(false);\n\n        ExperimentalFeatureImpl feature = new ExperimentalFeatureImpl(FEATURE_1, false);\n\n        service.onGlobalFeatureModified(new PortableExperimentalFeatureModifiedEvent(feature));\n\n        verify(event, never()).fire(any());\n    }\n\n    private void doBasicTest(boolean experimentalEnabled) {\n\n        initService(experimentalEnabled);\n\n        assertEquals(experimentalEnabled, service.isExperimentalEnabled());\n\n        /*\n         FEATURE_1 & FEATURE_2 are enabled by default BUT when experimental is disabled\n         the experimental service makes them disabled\n        */\n        assertEquals(experimentalEnabled, service.isFeatureEnabled(FEATURE_1));\n        assertEquals(experimentalEnabled, service.isFeatureEnabled(FEATURE_2));\n\n        assertFalse(service.isFeatureEnabled(FEATURE_3));\n\n        // WRONG_FEATURE_ID isn't an experimental feature, so when asking the framework it should be always enabled.\n        assertTrue(service.isFeatureEnabled(WRONG_FEATURE_ID));\n\n        assertEquals(registry, service.getFeaturesRegistry());\n    }\n\n    private void initService(boolean experimentalEnabled) {\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>();\n\n        features.add(new ExperimentalFeatureImpl(FEATURE_1, true));\n        features.add(new ExperimentalFeatureImpl(FEATURE_2, true));\n        features.add(new ExperimentalFeatureImpl(FEATURE_3, false));\n\n        registry = spy(new ExperimentalFeaturesRegistryImpl(features));\n\n        when(backendService.getExperimentalFeaturesSession()).thenReturn(new ExperimentalFeaturesSessionImpl(experimentalEnabled, registry));\n\n        service.loadRegistry();\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/test/TestExperimentalActivityReference.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.test;\n\nimport org.uberfire.experimental.client.service.auth.ExperimentalActivityReference;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\npublic class TestExperimentalActivityReference implements ExperimentalActivityReference {\n\n    private String activityTypeName;\n    private String activityId;\n    private String experimentalFeatureId;\n    private ActivityResourceType activityType;\n\n    public TestExperimentalActivityReference(String activityTypeName, String activityId, String experimentalFeatureId, ActivityResourceType activityType) {\n        this.activityTypeName = activityTypeName;\n        this.activityId = activityId;\n        this.experimentalFeatureId = experimentalFeatureId;\n        this.activityType = activityType;\n    }\n\n    @Override\n    public String getActivityTypeName() {\n        return activityTypeName;\n    }\n\n    @Override\n    public String getActivityId() {\n        return activityId;\n    }\n\n    @Override\n    public String getExperimentalFeatureId() {\n        return experimentalFeatureId;\n    }\n\n    @Override\n    public ActivityResourceType getActivityType() {\n        return activityType;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/test/TestExperimentalFeatureDefRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.test;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.impl.ExperimentalFeatureDefRegistryImpl;\n\npublic class TestExperimentalFeatureDefRegistry extends ExperimentalFeatureDefRegistryImpl {\n\n    public static final String FEATURE_1 = \"feature_1\";\n    public static final String FEATURE_2 = \"feature_2\";\n    public static final String FEATURE_3 = \"feature_3\";\n\n    public static final String GLOBAL_FEATURE_1 = \"globalFeature_1\";\n    public static final String GLOBAL_FEATURE_2 = \"globalFeature_2\";\n    public static final String GLOBAL_FEATURE_3 = \"globalFeature_3\";\n\n    public static final String GROUP = \"group\";\n\n    public TestExperimentalFeatureDefRegistry() {\n        register(new ExperimentalFeatureDefinition(FEATURE_1, false, \"\", FEATURE_1, FEATURE_1));\n        register(new ExperimentalFeatureDefinition(FEATURE_2, false, GROUP, FEATURE_2, FEATURE_2));\n        register(new ExperimentalFeatureDefinition(FEATURE_3, false, \"\", FEATURE_3, FEATURE_3));\n\n        register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_1, true, \"\", GLOBAL_FEATURE_1, GLOBAL_FEATURE_1));\n        register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_2, true, \"\", GLOBAL_FEATURE_2, GLOBAL_FEATURE_2));\n        register(new ExperimentalFeatureDefinition(GLOBAL_FEATURE_3, true, \"\", GLOBAL_FEATURE_3, GLOBAL_FEATURE_3));\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/test/model/TestExperimentalScreen1Activity.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.test.model;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\npublic class TestExperimentalScreen1Activity extends AbstractWorkbenchScreenActivity {\n\n    public TestExperimentalScreen1Activity(PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public String getTitle() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return null;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/test/model/TestExperimentalScreen2Activity.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.test.model;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\npublic class TestExperimentalScreen2Activity extends AbstractWorkbenchScreenActivity {\n\n    public TestExperimentalScreen2Activity(PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public String getTitle() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return null;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/test/model/TestNonExperimentalScreenActivity.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.test.model;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\npublic class TestNonExperimentalScreenActivity extends AbstractWorkbenchScreenActivity {\n\n    public TestNonExperimentalScreenActivity(PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public String getTitle() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return null;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/ExperimentalAwareClientTypeRegistryImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.client.workbench.type.test.client.*;\nimport org.uberfire.experimental.client.workbench.type.test.api.DiagramResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.FormResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.JavaResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.TextFileResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.WrongClientResourceType;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeatureImpl;\nimport org.uberfire.experimental.service.registry.impl.ExperimentalFeaturesRegistryImpl;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ExperimentalAwareClientTypeRegistryImplTest {\n\n    private ExperimentalAwareClientTypeRegistryImpl clientTypeRegistry;\n\n    @Mock\n    private SyncBeanManager manager;\n\n    @Mock\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n\n    private ClientJavaResourceType clientJavaResourceType = new ClientJavaResourceType();\n    private ClientFormResourceType clientFormResourceType = new ClientFormResourceType();\n    private ClientDiagramResourceType clientDiagramResourceType = new ClientDiagramResourceType();\n    private ClientTextFileResourceType clientTextFileResourceType = new ClientTextFileResourceType();\n    private ClientSpreadSheetResourceType clientSpreadSheetResourceType = new ClientSpreadSheetResourceType();\n\n    private List<SyncBeanDef<ClientResourceType>> clientTypes = new ArrayList<>();\n    private List<SyncBeanDef<ResourceTypeDefinition>> allResourceTypes = new ArrayList<>();\n\n    @Before\n    public void init() {\n\n        List<ExperimentalFeatureImpl> features = new ArrayList<>();\n        features.add(new ExperimentalFeatureImpl(JavaResourceType.class.getName(), true));\n        features.add(new ExperimentalFeatureImpl(ClientFormResourceType.class.getName(), false));\n        features.add(new ExperimentalFeatureImpl(TextFileResourceType.class.getName(), false));\n        features.add(new ExperimentalFeatureImpl(ClientSpreadSheetResourceType.class.getName(), true));\n\n        ExperimentalFeaturesRegistryImpl experimentalFeaturesRegistry = new ExperimentalFeaturesRegistryImpl(features);\n\n        when(experimentalFeaturesRegistryService.getFeaturesRegistry()).thenReturn(experimentalFeaturesRegistry);\n        when(experimentalFeaturesRegistryService.isFeatureEnabled(anyString())).thenAnswer((Answer<Boolean>) invocationOnMock -> experimentalFeaturesRegistry.isFeatureEnabled(invocationOnMock.getArguments()[0].toString()));\n\n        clientTypes.add((SyncBeanDef<ClientResourceType>) createBeanDef(ClientJavaResourceType.class, clientJavaResourceType));\n        clientTypes.add((SyncBeanDef<ClientResourceType>) createBeanDef(ClientFormResourceType.class, clientFormResourceType));\n        clientTypes.add((SyncBeanDef<ClientResourceType>) createBeanDef(ClientDiagramResourceType.class, clientDiagramResourceType));\n        clientTypes.add((SyncBeanDef<ClientResourceType>) createBeanDef(ClientTextFileResourceType.class, clientTextFileResourceType));\n        clientTypes.add((SyncBeanDef<ClientResourceType>) createBeanDef(ClientSpreadSheetResourceType.class, clientSpreadSheetResourceType));\n\n        when(manager.lookupBeans(ClientResourceType.class)).thenReturn(clientTypes);\n\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(ClientJavaResourceType.class, clientJavaResourceType));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(ClientFormResourceType.class, clientFormResourceType));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(ClientDiagramResourceType.class, clientDiagramResourceType));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(ClientTextFileResourceType.class, clientTextFileResourceType));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(ClientSpreadSheetResourceType.class, clientSpreadSheetResourceType));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(JavaResourceType.class, null));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(FormResourceType.class, null));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(DiagramResourceType.class, null));\n        allResourceTypes.add((SyncBeanDef<ResourceTypeDefinition>) createBeanDef(TextFileResourceType.class, null));\n\n        when(manager.lookupBeans(ResourceTypeDefinition.class)).thenReturn(allResourceTypes);\n\n        clientTypeRegistry = new ExperimentalAwareClientTypeRegistryImpl(manager, experimentalFeaturesRegistryService);\n\n        clientTypeRegistry.init();\n    }\n\n    @Test\n    public void testResourceTypes() {\n        Assertions.assertThat(clientTypeRegistry.getRegisteredTypes())\n                .hasSize(clientTypes.size());\n    }\n\n    @Test\n    public void testIsEnabled() {\n        assertTrue(clientTypeRegistry.isEnabled(clientJavaResourceType));\n        assertFalse(clientTypeRegistry.isEnabled(clientFormResourceType));\n        assertTrue(clientTypeRegistry.isEnabled(clientDiagramResourceType));\n        assertFalse(clientTypeRegistry.isEnabled(clientTextFileResourceType));\n        assertTrue(clientTypeRegistry.isEnabled(clientSpreadSheetResourceType));\n        assertFalse(clientTypeRegistry.isEnabled(new WrongClientResourceType()));\n    }\n\n    private SyncBeanDef<?> createBeanDef(final Class resourceType, Object instance) {\n\n        SyncBeanDef def = mock(SyncBeanDef.class);\n        when(def.getBeanClass()).thenReturn(resourceType);\n        when(def.getInstance()).thenReturn(instance);\n        when(def.isAssignableTo(any())).thenAnswer((Answer<Boolean>) invocationOnMock -> {\n            Class parentType = (Class) invocationOnMock.getArguments()[0];\n            return parentType.isAssignableFrom(resourceType);\n        });\n\n        return def;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/DiagramResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class DiagramResourceType implements ResourceTypeDefinition {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/FormResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class FormResourceType implements ResourceTypeDefinition {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/JavaResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class JavaResourceType implements ResourceTypeDefinition {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/SpreadSheetResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class SpreadSheetResourceType implements ResourceTypeDefinition {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/TextFileResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class TextFileResourceType implements ResourceTypeDefinition {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/api/WrongClientResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.api;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\n\npublic class WrongClientResourceType implements ClientResourceType {\n\n    @Override\n    public String getShortName() {\n        return null;\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return null;\n    }\n\n    @Override\n    public String getSuffix() {\n        return null;\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return null;\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return false;\n    }\n\n    @Override\n    public Category getCategory() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/client/ClientDiagramResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.client;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.DiagramResourceType;\n\npublic class ClientDiagramResourceType extends DiagramResourceType implements ClientResourceType {\n\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/client/ClientFormResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.client;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.FormResourceType;\n\npublic class ClientFormResourceType extends FormResourceType implements ClientResourceType {\n\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/client/ClientJavaResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.client;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.JavaResourceType;\n\npublic class ClientJavaResourceType extends JavaResourceType implements ClientResourceType {\n\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/client/ClientSpreadSheetResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.client;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.SpreadSheetResourceType;\n\npublic class ClientSpreadSheetResourceType extends SpreadSheetResourceType implements ClientResourceType {\n\n}\n"
  },
  {
    "path": "uberfire-experimental/uberfire-experimental-client/src/test/java/org/uberfire/experimental/client/workbench/type/test/client/ClientTextFileResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.experimental.client.workbench.type.test.client;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.client.workbench.type.test.api.TextFileResourceType;\n\npublic class ClientTextFileResourceType extends TextFileResourceType implements ClientResourceType {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-extensions</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Extensions to UberFire</name>\n\n  <modules>\n    <module>uberfire-security</module>\n    <module>uberfire-metadata</module>\n    <module>uberfire-widgets</module>\n    <module>uberfire-commons-editor</module>\n    <module>uberfire-preferences-ui-client</module>\n    <module>uberfire-runtime-plugins</module>\n    <module>uberfire-wires</module>\n    <module>uberfire-apps</module>\n    <module>uberfire-layout-editor</module>\n    <module>uberfire-simple-docks</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-apps</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Apps</name>\n\n  <modules>\n    <module>uberfire-apps-api</module>\n    <module>uberfire-apps-backend</module>\n    <module>uberfire-apps-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-apps</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-apps-api</artifactId>\n\n  <name>Uberfire Apps API</name>\n  <description>Uberfire Apps API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/main/java/org/uberfire/ext/apps/api/AppsPersistenceAPI.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.api;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface AppsPersistenceAPI {\n\n    public Directory getRootDirectory();\n\n    Directory createDirectory(Directory parentDirectory,\n                              String parameter);\n\n    Boolean deleteDirectory(String uri);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/main/java/org/uberfire/ext/apps/api/Directory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.api;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Directory {\n\n    private String name;\n    private Map<String, List<String>> tagMap;\n\n    private String fullPath;\n    private Directory parent;\n    private String URI;\n\n    private List<Directory> childsDirectories = new ArrayList<Directory>();\n    private List<String> childComponents = new ArrayList<String>();\n\n    public Directory() {\n    }\n\n    public Directory(String name,\n                     String fullPath,\n                     String URI,\n                     Directory parent) {\n        this.name = name;\n        this.fullPath = fullPath;\n        this.parent = parent;\n        this.URI = URI;\n        this.tagMap = parent.getTagMap();\n        setupChildComponents();\n    }\n\n    public Directory(String name,\n                     String fullPath,\n                     String URI,\n                     Map<String, List<String>> tagMap) {\n        this.fullPath = fullPath;\n        this.name = name;\n        this.URI = URI;\n        this.tagMap = tagMap;\n        setupChildComponents();\n    }\n\n    private void setupChildComponents() {\n        final List<String> components = tagMap.get(name.toUpperCase());\n        if (components != null) {\n            childComponents.addAll(components);\n        }\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public List<Directory> getChildsDirectories() {\n        return childsDirectories;\n    }\n\n    public void addChildDirectory(Directory directory) {\n        childsDirectories.add(directory);\n    }\n\n    public void addChildDirectories(List<Directory> directories) {\n        childsDirectories.addAll(directories);\n    }\n\n    public Directory getParent() {\n        return parent;\n    }\n\n    public String getURI() {\n        return URI;\n    }\n\n    public Map<String, List<String>> getTagMap() {\n        return tagMap;\n    }\n\n    public List<String> getChildComponents() {\n        return childComponents;\n    }\n\n    public void removeChildDirectoryByURI(String uri) {\n        Directory candidate = null;\n        for (Directory child : childsDirectories) {\n            if (child.getURI().equalsIgnoreCase(uri)) {\n                candidate = child;\n                break;\n            }\n        }\n        if (candidate != null) {\n            childsDirectories.remove(candidate);\n        }\n    }\n\n    public String getFullPath() {\n        return fullPath;\n    }\n\n    public boolean alreadyHasChild(String dirName) {\n        for (Directory child : childsDirectories) {\n            if (child.getName().equalsIgnoreCase(dirName)) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/main/java/org/uberfire/ext/apps/api/DirectoryBreadcrumb.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.api;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DirectoryBreadcrumb {\n\n    private String name;\n    private String uri;\n\n    private DirectoryBreadcrumb(@MapsTo(\"name\") String name,\n                                @MapsTo(\"uri\") String uri) {\n\n        this.name = name;\n        this.uri = uri;\n    }\n\n    public static List<DirectoryBreadcrumb> getBreadcrumbs(Directory directory) {\n        List<DirectoryBreadcrumb> breadcrumbs = new ArrayList<DirectoryBreadcrumb>();\n        breadcrumbs.add(new DirectoryBreadcrumb(directory.getName(),\n                                                directory.getURI()));\n        Directory tempParent = directory.getParent();\n        while (tempParent != null) {\n            breadcrumbs.add(new DirectoryBreadcrumb(tempParent.getName(),\n                                                    tempParent.getURI()));\n            tempParent = tempParent.getParent();\n        }\n        Collections.reverse(breadcrumbs);\n        return breadcrumbs;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getUri() {\n        return uri;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/main/resources/org/uberfire/ext/apps/UberfireAppsAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n\n  <source path='api'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-api/src/test/java/org/uberfire/ext/apps/api/DirectoryBreadcrumbTest.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.api;\n\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class DirectoryBreadcrumbTest {\n\n    private static final String TOP_DIR_NAME = \"top\";\n    private static final String MIDDLE_DIR_NAME = \"middle\";\n    private static final String LOW_DIR_NAME = \"low\";\n    private static final String OTHER_DIR_NAME = \"other\";\n\n    @Test\n    public void breadcrumbsOrderTest() {\n        Directory topDir = new Directory(TOP_DIR_NAME,\n                                         \"\",\n                                         \"\",\n                                         new HashMap<String, List<String>>());\n        Directory middleDir = new Directory(MIDDLE_DIR_NAME,\n                                            \"\",\n                                            \"\",\n                                            topDir);\n        Directory lowDir = new Directory(LOW_DIR_NAME,\n                                         \"\",\n                                         \"\",\n                                         middleDir);\n        Directory otherDir = new Directory(OTHER_DIR_NAME,\n                                           \"\",\n                                           \"\",\n                                           topDir);\n\n        assertDirectoryBreadcrumbs(topDir,\n                                   TOP_DIR_NAME);\n        assertDirectoryBreadcrumbs(middleDir,\n                                   TOP_DIR_NAME,\n                                   MIDDLE_DIR_NAME);\n        assertDirectoryBreadcrumbs(lowDir,\n                                   TOP_DIR_NAME,\n                                   MIDDLE_DIR_NAME,\n                                   LOW_DIR_NAME);\n        assertDirectoryBreadcrumbs(otherDir,\n                                   TOP_DIR_NAME,\n                                   OTHER_DIR_NAME);\n    }\n\n    private void assertDirectoryBreadcrumbs(Directory workingDir,\n                                            String... expectedNames) {\n        List<DirectoryBreadcrumb> breadcrumbs = DirectoryBreadcrumb.getBreadcrumbs(workingDir);\n        int breadcrumbsSize = breadcrumbs.size();\n\n        assertEquals(expectedNames.length,\n                     breadcrumbsSize);\n\n        for (int i = 0; i < breadcrumbsSize; i++) {\n            assertEquals(expectedNames[i],\n                         breadcrumbs.get(i).getName());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-apps</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-apps-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Apps Backend</name>\n  <description>Uberfire Apps Backend</description>\n \n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-backend</artifactId>\n    </dependency>\n\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-apps-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-backend/src/main/java/org/uberfire/ext/apps/impl/AppsPersistenceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.ext.apps.api.AppsPersistenceAPI;\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.type.TagsConverterUtil;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\n\n@Service\n@ApplicationScoped\npublic class AppsPersistenceImpl implements AppsPersistenceAPI {\n\n    public static final String HOME_DIR = \".app_dir/home\";\n    @Inject\n    PerspectiveServices perspectiveServices;\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    @Named(\"pluginsFS\")\n    private FileSystem fileSystem;\n\n    private Path root;\n\n    @PostConstruct\n    public void setup() {\n        this.root = fileSystem.getRootDirectories().iterator().next();\n    }\n\n    @Override\n    public Directory getRootDirectory() {\n\n        final Map<String, List<String>> tagMap = generateTagMap();\n\n        final Directory root = buildDirectories(tagMap);\n\n        return root;\n    }\n\n    private Map<String, List<String>> generateTagMap() {\n        Map<String, List<String>> tagsMap = new HashMap<>();\n        final Collection<LayoutTemplate> layoutTemplates = perspectiveServices.listLayoutTemplates();\n        for (LayoutTemplate layoutTemplate : layoutTemplates) {\n            List<String> tags = TagsConverterUtil.extractTags(layoutTemplate.getLayoutProperties());\n            for (String tag : tags) {\n                List<String> perspectives = tagsMap.get(tag.toUpperCase());\n                if (perspectives == null) {\n                    perspectives = new ArrayList<>();\n                }\n                perspectives.add(layoutTemplate.getName());\n                tagsMap.put(tag.toUpperCase(),\n                            perspectives);\n            }\n        }\n\n        return tagsMap;\n    }\n\n    private Directory buildDirectories(Map<String, List<String>> tagMap) {\n        Path homeDir = getHomeDir();\n\n        Directory root = new Directory(homeDir.getFileName().toString(),\n                                       homeDir.toString(),\n                                       homeDir.toUri().toString(),\n                                       tagMap);\n\n        root.addChildDirectories(extractAllChildDirectories(root,\n                                                            homeDir));\n\n        return root;\n    }\n\n    private List<Directory> extractAllChildDirectories(Directory parent,\n                                                       Path dir) {\n\n        List<Directory> childs = new ArrayList<Directory>();\n\n        if (ioService.exists(dir) && Files.isDirectory(dir)) {\n            final DirectoryStream<Path> paths = ioService.newDirectoryStream(dir);\n            for (Path childPath : paths) {\n                if (Files.isDirectory(childPath)) {\n                    final Directory child = getDirectory(childPath.getFileName().toString(),\n                                                         childPath.toString(),\n                                                         childPath.toUri().toString(),\n                                                         parent);\n                    final List<Directory> childsOfChilds = extractAllChildDirectories(child,\n                                                                                      childPath);\n                    child.addChildDirectories(childsOfChilds);\n                    childs.add(child);\n                }\n            }\n        }\n        return childs;\n    }\n\n    private Directory getDirectory(String name,\n                                   String fullpath,\n                                   String uri,\n                                   Directory parent) {\n        return new Directory(name,\n                             fullpath,\n                             uri,\n                             parent);\n    }\n\n    @Override\n    public Directory createDirectory(Directory parentDirectory,\n                                     String name) {\n        final Path parentDir = recursiveSearchForDir(getHomeDir(),\n                                                     parentDirectory);\n        Path newDir = parentDir.resolve(name);\n        if (!ioService.exists(newDir)) {\n            createDir(newDir);\n        }\n        newDir = ioService.get(newDir.toUri());\n        return getDirectory(name,\n                            newDir.toString(),\n                            newDir.toUri().toString(),\n                            parentDirectory);\n    }\n\n    @Override\n    public Boolean deleteDirectory(String uri) {\n        Path dir = ioService.get(uri);\n        return ioService.deleteIfExists(dir,\n                                        StandardDeleteOption.NON_EMPTY_DIRECTORIES);\n    }\n\n    private Path recursiveSearchForDir(Path dir,\n                                       Directory parentDirectory) {\n        if (ioService.exists(dir) && Files.isDirectory(dir)) {\n            if (isThisPathRelativeToThisDir(dir,\n                                            parentDirectory)) {\n                return dir;\n            } else {\n                Path desiredPath = null;\n                final DirectoryStream<Path> paths = ioService.newDirectoryStream(dir);\n                for (Path path : paths) {\n                    if (Files.isDirectory(path)) {\n                        desiredPath = recursiveSearchForDir(path,\n                                                            parentDirectory);\n                    }\n                    if (desiredPath != null) {\n                        break;\n                    }\n                }\n                return desiredPath;\n            }\n        }\n        return null;\n    }\n\n    private boolean isThisPathRelativeToThisDir(Path dir,\n                                                Directory parentDirectory) {\n        return dir.getFileName().toString().equals(parentDirectory.getName());\n    }\n\n    private Path getHomeDir() {\n        final Path homeDir = root.resolve(HOME_DIR);\n\n        if (!ioService.exists(homeDir)) {\n            createDir(homeDir);\n        }\n        return homeDir;\n    }\n\n    private void createDir(Path dir) {\n        final Path dummy_file = dir.resolve(\"dummy_file\");\n        ioService.write(dummy_file,\n                        \".\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-apps</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-apps-client</artifactId>\n\n  <name>Uberfire Apps Client</name>\n  <description>Uberfire Apps Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-apps-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/AppsEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.ext.apps.client.resources.WebAppResource;\n\n@EntryPoint\npublic class AppsEntryPoint {\n\n    @PostConstruct\n    public void init() {\n        WebAppResource.INSTANCE.CSS().ensureInjected();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/AppsPerspective.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.uberfire.ext.apps.client.AppsPerspective.IDENTIFIER;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = IDENTIFIER)\npublic class AppsPerspective {\n    public static final String IDENTIFIER = \"AppsPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl(\"org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter\");\n        p.setName(\"Apps Perspective\");\n        p.getRoot().addPart(\n                new PartDefinitionImpl(\n                        new DefaultPlaceRequest(\"AppsHomePresenter\")));\n\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/AppsHomePresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.home;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.apps.api.AppsPersistenceAPI;\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.apps.api.DirectoryBreadcrumb;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = \"AppsHomePresenter\")\npublic class AppsHomePresenter {\n\n    @Inject\n    private View view;\n    @Inject\n    private PlaceManager placeManager;\n    @Inject\n    private Caller<AppsPersistenceAPI> appService;\n    private Directory currentDirectory;\n    private Directory root;\n\n    @PostConstruct\n    public void init() {\n    }\n\n    @OnOpen\n    public void loadContent() {\n        view.clear();\n\n        appService.call(new RemoteCallback<Directory>() {\n                            public void callback(Directory root_) {\n                                root = root_;\n                                currentDirectory = root_;\n                                setupView();\n                            }\n                        },\n                        new ErrorCallback<Object>() {\n                            @Override\n                            public boolean error(Object o,\n                                                 Throwable throwable) {\n                                return false;\n                            }\n                        }).getRootDirectory();\n    }\n\n    private ParameterizedCommand<String> generateBreadCrumbViewCommand() {\n        return new ParameterizedCommand<String>() {\n            @Override\n            public void execute(String parameter) {\n                currentDirectory = searchForDirectory(parameter,\n                                                      root);\n                setupView();\n            }\n        };\n    }\n\n    private Directory searchForDirectory(String parameter,\n                                         Directory candidate) {\n        if (candidate.getURI().equalsIgnoreCase(parameter)) {\n            return candidate;\n        }\n        Directory target = null;\n        for (Directory directory : candidate.getChildsDirectories()) {\n            target = searchForDirectory(parameter,\n                                        directory);\n            if (target != null) {\n                break;\n            }\n        }\n        return target;\n    }\n\n    private ParameterizedCommand<String> generateDeleteDirectoryViewCommand() {\n        return new ParameterizedCommand<String>() {\n            @Override\n            public void execute(final String uri) {\n                appService.call(new RemoteCallback<Boolean>() {\n                                    public void callback(Boolean deleted) {\n                                        currentDirectory.removeChildDirectoryByURI(uri);\n                                        view.clear();\n                                        view.setupChildsDirectories(currentDirectory.getChildsDirectories(),\n                                                                    generateDirectoryViewCommand(),\n                                                                    generateDeleteDirectoryViewCommand());\n                                        view.setupChildComponents(currentDirectory.getChildComponents(),\n                                                                  generateComponentViewCommand());\n                                        view.setupAddDir(generateAddDirCommand(),\n                                                         currentDirectory);\n                                    }\n                                },\n                                new ErrorCallback<Object>() {\n                                    @Override\n                                    public boolean error(Object o,\n                                                         Throwable throwable) {\n                                        return false;\n                                    }\n                                }).deleteDirectory(uri);\n            }\n        };\n    }\n\n    private ParameterizedCommand<String> generateDirectoryViewCommand() {\n        return new ParameterizedCommand<String>() {\n            @Override\n            public void execute(String parameter) {\n                for (Directory candidate : currentDirectory.getChildsDirectories()) {\n                    if (candidate.getURI().equalsIgnoreCase(parameter)) {\n                        currentDirectory = candidate;\n                        setupView();\n                    }\n                }\n            }\n        };\n    }\n\n    private void setupView() {\n        view.clear();\n        view.setupBreadcrumbs(DirectoryBreadcrumb.getBreadcrumbs(currentDirectory),\n                              generateBreadCrumbViewCommand());\n        view.setupChildsDirectories(currentDirectory.getChildsDirectories(),\n                                    generateDirectoryViewCommand(),\n                                    generateDeleteDirectoryViewCommand());\n        view.setupChildComponents(currentDirectory.getChildComponents(),\n                                  generateComponentViewCommand());\n        view.setupAddDir(generateAddDirCommand(),\n                         currentDirectory);\n    }\n\n    private ParameterizedCommand<String> generateComponentViewCommand() {\n\n        return new ParameterizedCommand<String>() {\n            @Override\n            public void execute(String parameter) {\n                placeManager.goTo(parameter);\n            }\n        };\n    }\n\n    private ParameterizedCommand<String> generateAddDirCommand() {\n        return new ParameterizedCommand<String>() {\n\n            @Override\n            public void execute(final String directoryName) {\n                appService.call(new RemoteCallback<Directory>() {\n                                    public void callback(Directory\n                                                                 newDir) {\n\n                                        currentDirectory.addChildDirectory(newDir);\n                                        view.clear();\n                                        view.setupChildsDirectories(currentDirectory.getChildsDirectories(),\n                                                                    generateDirectoryViewCommand(),\n                                                                    generateDeleteDirectoryViewCommand());\n                                        view.setupChildComponents(currentDirectory.getChildComponents(),\n                                                                  generateComponentViewCommand());\n                                        view.setupAddDir(generateAddDirCommand(),\n                                                         currentDirectory);\n                                    }\n                                },\n                                new ErrorCallback<Object>() {\n                                    @Override\n                                    public boolean error(Object o,\n                                                         Throwable throwable) {\n                                        return false;\n                                    }\n                                }).createDirectory(currentDirectory,\n                                                   directoryName);\n            }\n        };\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Apps Home\";\n    }\n\n    @WorkbenchPartView\n    public UberView<AppsHomePresenter> getView() {\n        return view;\n    }\n\n    public interface View extends UberView<AppsHomePresenter> {\n\n        void setupBreadcrumbs(List<DirectoryBreadcrumb> breadcrumbs,\n                              ParameterizedCommand<String> breadCrumbAction);\n\n        void setupAddDir(final ParameterizedCommand<String> clickCommand,\n                         Directory currentDirectory);\n\n        void setupChildsDirectories(List<Directory> childsDirectories,\n                                    ParameterizedCommand<String> clickCommand,\n                                    ParameterizedCommand<String> deleteCommand);\n\n        void clear();\n\n        void setupChildComponents(List<String> childComponents,\n                                  ParameterizedCommand<String> stringParameterizedCommand);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/AppsHomeView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.home;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Breadcrumbs;\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.apps.api.DirectoryBreadcrumb;\nimport org.uberfire.ext.apps.client.home.components.TilesApp;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n@Dependent\npublic class AppsHomeView extends Composite implements AppsHomePresenter.View {\n\n    private static AppsHomeViewBinder uiBinder = GWT.create(AppsHomeViewBinder.class);\n    @UiField\n    FlowPanel mainPanel;\n\n    @UiField\n    Breadcrumbs dirs;\n\n    @UiField\n    FlowPanel dirContent;\n    private AppsHomePresenter presenter;\n\n    @PostConstruct\n    public void initialize() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final AppsHomePresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setupBreadcrumbs(List<DirectoryBreadcrumb> breadcrumbs,\n                                 final ParameterizedCommand<String> breadcrumbAction) {\n        dirs.clear();\n        for (final DirectoryBreadcrumb breadCrumb : breadcrumbs) {\n            final AnchorListItem bread = new AnchorListItem(breadCrumb.getName());\n            bread.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    breadcrumbAction.execute(breadCrumb.getUri());\n                }\n            });\n            dirs.add(bread);\n        }\n    }\n\n    @Override\n    public void setupAddDir(final ParameterizedCommand<String> clickCommand,\n                            Directory currentDirectory) {\n        generateCreateDirThumbNail(clickCommand,\n                                   currentDirectory);\n    }\n\n    @Override\n    public void setupChildsDirectories(List<Directory> childsDirectories,\n                                       ParameterizedCommand<String> clickCommand,\n                                       ParameterizedCommand<String> deleteCommand) {\n        for (Directory childsDirectory : childsDirectories) {\n            final TilesApp link = TilesApp.directoryTiles(childsDirectory.getName(),\n                                                          childsDirectory.getURI(),\n                                                          TilesApp.TYPE.DIR,\n                                                          clickCommand,\n                                                          deleteCommand);\n            dirContent.add(link);\n        }\n    }\n\n    @Override\n    public void clear() {\n        dirContent.clear();\n    }\n\n    @Override\n    public void setupChildComponents(List<String> childComponents,\n                                     ParameterizedCommand<String> clickCommand) {\n        for (String childComponent : childComponents) {\n            final TilesApp link = TilesApp.componentTiles(childComponent,\n                                                          TilesApp.TYPE.COMPONENT,\n                                                          clickCommand);\n            dirContent.add(link);\n        }\n    }\n\n    private void generateCreateDirThumbNail(final ParameterizedCommand<String> clickCommand,\n                                            Directory currentDirectory) {\n        final TilesApp link = TilesApp.createDirTiles(TilesApp.TYPE.ADD,\n                                                      clickCommand,\n                                                      currentDirectory);\n        dirContent.add(link);\n    }\n\n    interface AppsHomeViewBinder\n            extends\n            UiBinder<Widget, AppsHomeView> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/AppsHomeView.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" >\n\n  <ui:with field='res' type='org.uberfire.ext.apps.client.resources.WebAppResource'/>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{res.CSS.breadcrumbs}\">\n    <b:Breadcrumbs ui:field=\"dirs\"/>\n    <g:FlowPanel ui:field=\"dirContent\"/>\n  </g:FlowPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/components/TilesApp.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.home.components;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.MouseOutEvent;\nimport com.google.gwt.event.dom.client.MouseOutHandler;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.event.dom.client.MouseOverHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.apps.client.home.components.popup.NewDirectoryPopup;\nimport org.uberfire.ext.apps.client.resources.WebAppResource;\nimport org.uberfire.ext.apps.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class TilesApp extends Composite {\n\n    private static WebAppResource APP_CSS = GWT.create(WebAppResource.class);\n    private static TilesBinder uiBinder = GWT.create(TilesBinder.class);\n    @UiField\n    Icon icon;\n    @UiField\n    Label label;\n    @UiField\n    FlowPanel outerPanel;\n    @UiField\n    FlowPanel tilePanel;\n    @UiField\n    FlowPanel deletePanel;\n    private NewDirectoryPopup newDirectoryPopup;\n    private Icon deleteIcon;\n\n    private TilesApp(TYPE type,\n                     final ParameterizedCommand<String> clickCommand,\n                     Directory currentDirectory) {\n        initWidget(uiBinder.createAndBindUi(this));\n        defineTileColor(type);\n        createIcon(type,\n                   CommonConstants.INSTANCE.CreateDir());\n        displayNoneOnLabel();\n        addClickPopUpHandler(clickCommand,\n                             currentDirectory);\n    }\n\n    private TilesApp(String componentName,\n                     TYPE type,\n                     final ParameterizedCommand<String> clickCommand) {\n        initWidget(uiBinder.createAndBindUi(this));\n        defineTileColor(type);\n        createIcon(type,\n                   CommonConstants.INSTANCE.GotoComponent());\n        createLabel(componentName);\n        addClickCommandHandler(clickCommand,\n                               componentName);\n    }\n\n    private TilesApp(String dirName,\n                     String dirURI,\n                     TYPE type,\n                     final ParameterizedCommand<String> clickCommand,\n                     final ParameterizedCommand<String> deleteCommand) {\n        initWidget(uiBinder.createAndBindUi(this));\n        defineTileColor(type);\n        createIcon(type,\n                   CommonConstants.INSTANCE.OpenDir());\n        createLabel(dirName);\n        addClickCommandHandler(clickCommand,\n                               dirURI);\n        createDeleteIcon(deleteCommand,\n                         dirURI);\n    }\n\n    public static TilesApp createDirTiles(TYPE type,\n                                          final ParameterizedCommand<String> clickCommand,\n                                          Directory currentDirectory) {\n        return new TilesApp(type,\n                            clickCommand,\n                            currentDirectory);\n    }\n\n    public static TilesApp componentTiles(String componentName,\n                                          TYPE type,\n                                          final ParameterizedCommand<String> clickCommand) {\n        return new TilesApp(componentName,\n                            type,\n                            clickCommand);\n    }\n\n    public static TilesApp directoryTiles(String dirName,\n                                          String dirURI,\n                                          TYPE type,\n                                          final ParameterizedCommand<String> clickCommand,\n                                          ParameterizedCommand<String> deleteCommand) {\n        return new TilesApp(dirName,\n                            dirURI,\n                            type,\n                            clickCommand,\n                            deleteCommand);\n    }\n\n    private void createDeleteIcon(final ParameterizedCommand<String> deleteCommand,\n                                  final String dirURI) {\n        deleteIcon = new Icon(IconType.REMOVE);\n        deleteIcon.setTitle(CommonConstants.INSTANCE.DeleteDir());\n        deleteIcon.addStyleName(APP_CSS.CSS().deleteIcon());\n        deleteIcon.addStyleName(\"fa\");\n        deleteIcon.addDomHandler(new ClickHandler() {\n                                     @Override\n                                     public void onClick(ClickEvent event) {\n                                         if (Window.confirm(CommonConstants.INSTANCE.DeleteAppPrompt())) {\n                                             deleteCommand.execute(dirURI);\n                                         }\n                                     }\n                                 },\n                                 ClickEvent.getType());\n        outerPanel.addDomHandler(new MouseOverHandler() {\n                                     @Override\n                                     public void onMouseOver(MouseOverEvent event) {\n                                         deletePanel.add(deleteIcon);\n                                     }\n                                 },\n                                 MouseOverEvent.getType());\n        outerPanel.addDomHandler(new MouseOutHandler() {\n                                     @Override\n                                     public void onMouseOut(MouseOutEvent event) {\n                                         deletePanel.remove(deleteIcon);\n                                     }\n                                 },\n                                 MouseOutEvent.getType());\n    }\n\n    private void defineTileColor(TYPE type) {\n        tilePanel.addStyleName(type.tileColor());\n        deletePanel.addStyleName(type.tileColor());\n    }\n\n    private void displayNoneOnLabel() {\n        label.getElement().getStyle().setProperty(\"display\",\n                                                  \"none\");\n    }\n\n    private void addClickCommandHandler(final ParameterizedCommand<String> clickCommand,\n                                        final String parameter) {\n        tilePanel.addDomHandler(new ClickHandler() {\n                                    @Override\n                                    public void onClick(ClickEvent event) {\n                                        clickCommand.execute(parameter);\n                                    }\n                                },\n                                ClickEvent.getType());\n    }\n\n    private void addClickPopUpHandler(final ParameterizedCommand<String> clickCommand,\n                                      final Directory currentDirectory) {\n        tilePanel.addDomHandler(new ClickHandler() {\n                                    @Override\n                                    public void onClick(ClickEvent event) {\n                                        newDirectoryPopup = new NewDirectoryPopup(currentDirectory);\n                                        newDirectoryPopup.show(clickCommand);\n                                    }\n                                },\n                                ClickEvent.getType());\n    }\n\n    private void createLabel(String name) {\n        label.setText(name);\n    }\n\n    private void createIcon(TYPE type,\n                            String tooltip) {\n        icon.setTitle(tooltip);\n        icon.setType(type.icon());\n    }\n\n    public enum TYPE {\n\n        DIR(IconType.FOLDER_OPEN,\n            APP_CSS.CSS().blueTile()),\n        ADD(IconType.PLUS,\n            APP_CSS.CSS().redTile()),\n        COMPONENT(IconType.FILE,\n                  APP_CSS.CSS().greenTile());\n\n        private IconType iconType;\n        private String tile;\n\n        TYPE(IconType iconType,\n             String tile) {\n            this.iconType = iconType;\n            this.tile = tile;\n        }\n\n        IconType icon() {\n            return iconType;\n        }\n\n        String tileColor() {\n            return tile;\n        }\n\n    }\n\n    interface TilesBinder\n            extends\n            UiBinder<Widget, TilesApp> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/components/TilesApp.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field='res' type='org.uberfire.ext.apps.client.resources.WebAppResource'/>\n  <g:FlowPanel ui:field=\"outerPanel\" styleName=\"{res.CSS.tile}\">\n    <g:FlowPanel ui:field=\"deletePanel\" styleName=\"{res.CSS.deletePanel}\"/>\n    <g:FlowPanel ui:field=\"tilePanel\" styleName=\"{res.CSS.tileContent}\">\n      <g:FlowPanel styleName=\"{res.CSS.iconPanel}\">\n        <b:Icon type=\"FILE\" ui:field=\"icon\" styleName=\"fa {res.CSS.tileIcon}\"/>\n      </g:FlowPanel>\n    </g:FlowPanel>\n    <g:FlowPanel styleName=\"{res.CSS.tileStatus}\">\n      <b:Label styleName=\"{res.CSS.tileName}\" ui:field=\"label\"/>\n    </g:FlowPanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/components/popup/DirectoryNameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.home.components.popup;\n\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.apps.client.resources.i18n.CommonConstants;\n\npublic class DirectoryNameValidator {\n\n    public static final String VALID_DIR_REGEX = \"^([^*\\\"\\\\/><?\\\\\\\\\\\\!|;:]*)$\";\n    private final Directory currentDirectory;\n\n    public DirectoryNameValidator(Directory currentDirectory) {\n        this.currentDirectory = currentDirectory;\n    }\n\n    public String getValidationError() {\n        return CommonConstants.INSTANCE.InvalidDirName();\n    }\n\n    public boolean isValid(String dirName) {\n        if (dirName == null || dirName.trim().isEmpty()) {\n            return Boolean.FALSE;\n        }\n        if (!dirName.matches(VALID_DIR_REGEX)) {\n            return Boolean.FALSE;\n        }\n        if (currentDirectory.alreadyHasChild(dirName)) {\n            return Boolean.FALSE;\n        }\n        return Boolean.TRUE;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/components/popup/NewDirectoryPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.apps.client.home.components.popup;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.apps.api.Directory;\nimport org.uberfire.ext.apps.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class NewDirectoryPopup\n        extends BaseModal {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField\n    FormGroup directoryNameControlGroup;\n    @UiField\n    TextBox directoryName;\n    @UiField\n    HelpBlock directoryNameInline;\n    private ParameterizedCommand clickCommand;\n    private DirectoryNameValidator directoryNameValidator;\n\n    public NewDirectoryPopup(final Directory currentDirectory) {\n        setTitle(CommonConstants.INSTANCE.CreateDir());\n        setBody(uiBinder.createAndBindUi(NewDirectoryPopup.this));\n\n        add(new ModalFooterOKCancelButtons(\n                new Command() {\n                    @Override\n                    public void execute() {\n                        okButton();\n                    }\n                },\n                new Command() {\n                    @Override\n                    public void execute() {\n                        cancelButton();\n                    }\n                })\n        );\n        directoryNameValidator = new DirectoryNameValidator(currentDirectory);\n    }\n\n    public void show(ParameterizedCommand clickCommand) {\n        this.clickCommand = clickCommand;\n        show();\n    }\n\n    private void cancelButton() {\n        closePopup();\n    }\n\n    private void okButton() {\n        if (directoryNameValidator.isValid(directoryName.getText())) {\n            this.clickCommand.execute(directoryName.getText());\n            closePopup();\n        } else {\n            directoryNameControlGroup.setValidationState(ValidationState.ERROR);\n            directoryNameInline.setText(directoryNameValidator.getValidationError());\n        }\n    }\n\n    private void closePopup() {\n        this.directoryName.setText(\"\");\n        hide();\n        super.hide();\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, NewDirectoryPopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/home/components/popup/NewDirectoryPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n    >\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.apps.client.resources.i18n.CommonConstants\"/>\n\n  <g:HTMLPanel>\n    <b:Form type=\"HORIZONTAL\">\n      <b:FormGroup ui:field=\"directoryNameControlGroup\">\n        <b:Column size=\"MD_3\">\n          <b:FormLabel for=\"directoryName\" text=\"{i18n.DirName}\" showRequiredIndicator=\"true\"/>\n        </b:Column>\n        <b:Column size=\"MD_9\">\n          <b:TextBox ui:field=\"directoryName\" placeholder=\"{i18n.DirNameHolder}\"/>\n          <b:HelpBlock ui:field=\"directoryNameInline\"/>\n        </b:Column>\n      </b:FormGroup>\n    </b:Form>\n  </g:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/resources/AppsCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface AppsCss extends CssResource {\n\n    @ClassName(\"tile\")\n    String tile();\n\n    @ClassName(\"iconPanel\")\n    String iconPanel();\n\n    @ClassName(\"deleteIcon\")\n    String deleteIcon();\n\n    @ClassName(\"deletePanel\")\n    String deletePanel();\n\n    @ClassName(\"blueTile\")\n    String blueTile();\n\n    @ClassName(\"redTile\")\n    String redTile();\n\n    @ClassName(\"greenTile\")\n    String greenTile();\n\n    @ClassName(\"tileContent\")\n    String tileContent();\n\n    @ClassName(\"tileIcon\")\n    String tileIcon();\n\n    @ClassName(\"tileStatus\")\n    String tileStatus();\n\n    @ClassName(\"tileName\")\n    String tileName();\n\n    @ClassName(\"breadcrumbs\")\n    String breadcrumbs();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/resources/WebAppResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface WebAppResource\n        extends\n        ClientBundle {\n\n    WebAppResource INSTANCE = GWT.create(WebAppResource.class);\n\n    @Source(\"css/apps.css\")\n    AppsCss CSS();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/java/org/uberfire/ext/apps/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String CreateDir();\n\n    String DeleteDir();\n\n    String OpenDir();\n\n    String DirName();\n\n    String DirNameHolder();\n\n    String InvalidDirName();\n\n    String OK();\n\n    String Cancel();\n\n    String DuplicateDirName();\n\n    String DeleteAppPrompt();\n\n    String GotoComponent();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.apps.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/UberfireAppsClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <source path='client'/>\n\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n\n  <inherits name=\"org.uberfire.ext.apps.UberfireAppsAPI\"/>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/css/apps.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.breadcrumbs{\n    margin-left:20px;\n}\n\n.tile {\n    cursor: pointer;\n    float: left;\n    height: 160px;\n    position: relative;\n    width: 160px;\n    font-size: 16px;\n    margin: 0 10px 10px 0;\n    overflow: hidden;\n}\n\n.blueTile {\n    background: rgba(76, 98, 154, 0.52);\n}\n\n.redTile {\n    background: rgba(154, 11, 8, 0.60);\n}\n\n.greenTile {\n    background: rgba(67, 154, 99, 0.60);\n}\n\n.tileContent {\n    text-align: center;\n    margin-top: 20px;\n    cursor: pointer;\n    height: 140px;\n    left: 0;\n    right: 2px;\n    position: absolute;\n    top: 0;\n    width: 160px;\n    overflow: hidden;\n}\n\n.deletePanel {\n    text-align: right;\n    height: 20px;\n    position: relative;\n    width: 160px;\n}\n\n.deleteIcon {\n    margin-right: 2px;\n    font-size: 15px;\n    color: rgb(255, 255, 255);\n}\n\n.iconPanel {\n    margin-top: 25px;\n}\n\n.tileIcon {\n    font-size: 46px;\n    color: rgb(255, 255, 255);\n    margin-top:10px;\n}\n\n.tileIcon:before {\n    cursor: pointer;\n}\n\n.tileStatus {\n    bottom: 15px;\n    cursor: pointer;\n    height: 29px;\n    justify-self: stretch;\n    left: 6px;\n    min-height: 29px;\n    position: absolute;\n    right: 0px;\n    text-align: center;\n    width: 149px;\n}\n\n.tileName {\n    color: rgb(255, 255, 255);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCreateDir=Create Directory\nDeleteDir=Delete Directory\nOpenDir=Open Directory\nDirName=Directory Name\nDirNameHolder=directory name\nDuplicateDirName=There is already a directory with this name\nInvalidDirName=Invalid Directory Name\nOK=OK\nCancel=Cancel\nDeleteAppPrompt=Are you sure you want to delete this Directory?\nGotoComponent=Go to component"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_de.properties",
    "content": "CreateDir=Verzeichnis erstellen\nDeleteDir=Verzeichnis löschen\nOpenDir=Verzeichnis öffnen\nDirName=Verzeichnisname\nDirNameHolder=Verzeichnisname\nDuplicateDirName=Ein Verzeichnis mit diesem Namen ist bereits vorhanden\nInvalidDirName=Ungültiger Verzeichnisname\nOK=OK\nCancel=Abbrechen\nDeleteAppPrompt=Sind Sie sicher, dass Sie diese Anwendung löschen wollen?\nGotoComponent=Zur Komponente \n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCreateDir=Crear directorio\nDeleteDir=Eliminar directorio\nOpenDir=Abrir directorio\nDirName=Nombre del directorio\nDirNameHolder=nombre del directorio\nDuplicateDirName=Ya hay un directorio con este nombre\nInvalidDirName=Nombre de directorio no válido\nOK=Aceptar\nCancel=Cancelar\nDeleteAppPrompt=¿Está seguro de que desea eliminar este directorio?\nGotoComponent=Ir al componente"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCreateDir=Créer un répertoire\nDeleteDir=Supprimer le répertoire\nOpenDir=Ouvrir le répertoire\nDirName=Nom du répertoire\nDirNameHolder=nom du répertoire\nDuplicateDirName=Il existe déjà un répertoire portant ce nom\nInvalidDirName=Nom du répertoire non valide\nOK=OK\nCancel=Annuler\nDeleteAppPrompt=Voulez-vous vraiment supprimer ce répertoire ?\nGotoComponent=Aller au composant"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCreateDir=Crea Cartella\nDeleteDir=Elimina Cartella\nOpenDir=Apri Cartella\nDirName=Nome Cartella\nDirNameHolder=nome cartella\nDuplicateDirName=Esiste già una cartella con questo nome\nInvalidDirName=Nome Cartella non valido\nOK=OK\nCancel=Annulla\nDeleteAppPrompt=Sei sicuro di voler eliminare questa Cartella?\nGotoComponent=Vai al componente\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nCreateDir=ディレクトリーの作成\nDeleteDir=ディレクトリーの削除\nOpenDir=ディレクトリーを開く\nDirName=ディレクトリー名\nDirNameHolder=ディレクトリー名\nDuplicateDirName=すでにこの名前のディレクトリーが存在します\nInvalidDirName=無効なディレクトリー名\nOK=OK\nCancel=キャンセル\nDeleteAppPrompt=このアプリケーションを削除してもよろしいですか?\nGotoComponent=コンポーネントへ移動"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "CreateDir=Crie o Diretório\nDeleteDir=Excluir Diretório\nOpenDir=Abrir Diretório\nDirName=Nome do Diretório\nDirNameHolder=nome do diretório\nDuplicateDirName=Já existe um diretório com este nome\nInvalidDirName=Nome de Diretório Inválido\nOK=OK\nCancel=Cancelar\nDeleteAppPrompt=Você tem certeza que deseja excluir este Diretório?\nGotoComponent=Ir ao componente\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/main/resources/org/uberfire/ext/apps/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "CreateDir=创建目录\nDeleteDir=删除目录\nOpenDir=打开目录\nDirName=目录名称\nDirNameHolder=目录名称\nDuplicateDirName=已经存在以该名称命名的目录\nInvalidDirName=无效的目录名称\nOK=确定\nCancel=取消\nDeleteAppPrompt=您确定要删除这个目录吗？\nGotoComponent=打开组件\n"
  },
  {
    "path": "uberfire-extensions/uberfire-apps/uberfire-apps-client/src/test/java/org/uberfire/ext/apps/client/home/components/popup/DirectoryNameValidatorTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.apps.client.home.components.popup;\n\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.apps.api.Directory;\n\nimport static org.junit.Assert.*;\n\npublic class DirectoryNameValidatorTest {\n\n    private DirectoryNameValidator directoryNameValidator;\n\n    @Before\n    public void setUp() throws Exception {\n        directoryNameValidator = new DirectoryNameValidator(new Directory());\n    }\n\n    @Test\n    public void isValidTest() throws Exception {\n        assertTrue(directoryNameValidator.isValid(\"app\"));\n        assertTrue(directoryNameValidator.isValid(\"my app\"));\n        assertTrue(directoryNameValidator.isValid(\"日本国\"));\n        assertFalse(directoryNameValidator.isValid(\"\"));\n        assertFalse(directoryNameValidator.isValid(\" \"));\n        assertFalse(directoryNameValidator.isValid(\"app\\\\\"));\n        assertFalse(directoryNameValidator.isValid(\"app/\"));\n        assertFalse(directoryNameValidator.isValid(\"app:\"));\n        assertFalse(directoryNameValidator.isValid(\"*app\"));\n        assertFalse(directoryNameValidator.isValid(\"a<pp\"));\n        assertFalse(directoryNameValidator.isValid(\"app>\"));\n        assertFalse(directoryNameValidator.isValid(\"ap|p\"));\n        assertFalse(directoryNameValidator.isValid(\"ap*p\"));\n        assertFalse(directoryNameValidator.isValid(\"ap?p\"));\n    }\n\n    @Test\n    public void isValidTestDuplicatedDir() throws Exception {\n\n        final Directory currentDirectory = new Directory(\"parent\",\n                                                         \"\",\n                                                         \"\",\n                                                         new HashMap<String, List<String>>());\n        directoryNameValidator = new DirectoryNameValidator(currentDirectory);\n        assertTrue(directoryNameValidator.isValid(\"app\"));\n        currentDirectory.addChildDirectory(new Directory(\"app\",\n                                                         \"\",\n                                                         \"\",\n                                                         currentDirectory));\n        assertFalse(directoryNameValidator.isValid(\"app\"));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-commons-editor</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Commons Editor</name>\n\n  <modules>\n    <module>uberfire-commons-editor-api</module>\n    <module>uberfire-commons-editor-backend</module>\n    <module>uberfire-commons-editor-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-commons-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-commons-editor-api</artifactId>\n\n  <name>Uberfire Commons Editor API</name>\n  <description>Uberfire Commons Editor API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/backend/version/PathResolver.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic interface PathResolver {\n\n    boolean isDotFile(Path convert);\n\n    public Path resolveMainFilePath(Path path) throws URISyntaxException;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/backend/version/VersionRecordService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\nimport java.util.List;\n\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.Path;\n\npublic interface VersionRecordService {\n\n    public List<VersionRecord> load(Path path);\n\n    public List<VersionRecord> loadVersionRecords(Path path);\n\n    public VersionRecord loadRecord(Path path) throws URISyntaxException;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/DefaultMetadata.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.file;\n\n/*\n * This is the default metadata interface for Editors that extend `BaseEditor`\n * but don't depend on any metadata to persist an asset.\n */\npublic interface DefaultMetadata {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/exports/FileExportsPreferences.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.impl.validation.EnumValuePropertyValidator;\n\n@WorkbenchPreference(identifier = \"FileExport\",\n        bundleKey = \"FileExport.Label\",\n        parents = \"LibraryPreferences\")\npublic class FileExportsPreferences implements BasePreference<FileExportsPreferences> {\n\n    @Property(bundleKey = \"FileExport.PdfOrientation.Text\",\n            helpBundleKey = \"FileExport.PdfOrientation.Help\",\n            validators = PdfOrientationValidator.class)\n    String pdfOrientation;\n\n    @Property(bundleKey = \"FileExport.PdfUnit.Text\",\n            helpBundleKey = \"FileExport.PdfUnit.Help\",\n            validators = PdfUnitValidator.class)\n    String pdfUnit;\n\n    @Property(bundleKey = \"FileExport.PdfFormat.Text\",\n            helpBundleKey = \"FileExport.PdfFormat.Help\",\n            validators = PdfFormatValidator.class)\n    String pdfFormat;\n\n    @Override\n    public FileExportsPreferences defaultValue(final FileExportsPreferences defaultValue) {\n        defaultValue.pdfOrientation = format(PdfExportPreferences.Orientation.PORTRAIT);\n        defaultValue.pdfUnit = format(PdfExportPreferences.Unit.MM);\n        defaultValue.pdfFormat = format(PdfExportPreferences.Format.A4);\n        return defaultValue;\n    }\n\n    public PdfExportPreferences getPdfPreferences() {\n        return PdfExportPreferences.create(pdfOrientation,\n                                           pdfUnit,\n                                           pdfFormat);\n    }\n\n    private static <T extends Enum<?>> String format(final T value) {\n        return EnumValuePropertyValidator.format(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/exports/PdfExportPreferences.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.uberfire.preferences.shared.impl.validation.EnumValuePropertyValidator.parseString;\n\n/**\n * The pdf document's settings.\n */\n@Portable\npublic final class PdfExportPreferences {\n\n    public static PdfExportPreferences create(final String orientation,\n                                              final String unit,\n                                              final String format) {\n        return create(Orientation.valueOf(parseString(orientation)),\n                      Unit.valueOf(parseString(unit)),\n                      Format.valueOf(parseString(format)));\n    }\n\n    public static PdfExportPreferences create(final Orientation orientation,\n                                              final Unit unit,\n                                              final Format format) {\n        return new PdfExportPreferences(orientation,\n                                        unit,\n                                        format);\n    }\n\n    public enum Orientation {\n        PORTRAIT,\n        LANDSCAPE\n    }\n\n    public enum Unit {\n        PT,\n        MM,\n        CM,\n        IN\n    }\n\n    public enum Format {\n        A0,\n        A1,\n        A2,\n        A3,\n        A4,\n        A5,\n        A6,\n        A7,\n        A8,\n        A9,\n        A10,\n        B0,\n        B1,\n        B2,\n        B3,\n        B4,\n        B5,\n        B6,\n        B7,\n        B8,\n        B9,\n        B10,\n        C0,\n        C1,\n        C2,\n        C3,\n        C4,\n        C5,\n        C6,\n        C7,\n        C8,\n        C9,\n        C10,\n    }\n\n    private Orientation orientation;\n    private Unit unit;\n    private Format format;\n\n    private PdfExportPreferences(final @MapsTo(\"orientation\") Orientation orientation,\n                                 final @MapsTo(\"unit\") Unit unit,\n                                 final @MapsTo(\"format\") Format format) {\n        this.orientation = orientation;\n        this.unit = unit;\n        this.format = format;\n    }\n\n    public Orientation getOrientation() {\n        return orientation;\n    }\n\n    public void setOrientation(final Orientation orientation) {\n        this.orientation = orientation;\n    }\n\n    public Unit getUnit() {\n        return unit;\n    }\n\n    public void setUnit(final Unit unit) {\n        this.unit = unit;\n    }\n\n    public Format getFormat() {\n        return format;\n    }\n\n    public void setFormat(final Format format) {\n        this.format = format;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/exports/PdfFormatValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.EnumValuePropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.ValidationResult;\n\npublic class PdfFormatValidator implements PropertyValidator {\n\n    private static final PdfExportPreferences.Format[] VALUES = PdfExportPreferences.Format.values();\n\n    private final EnumValuePropertyValidator<PdfExportPreferences.Format> validator;\n\n    public PdfFormatValidator() {\n        this.validator = new EnumValuePropertyValidator<>(VALUES);\n    }\n\n    @Override\n    public ValidationResult validate(Object value) {\n        return validator.validate(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/exports/PdfOrientationValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.EnumValuePropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.ValidationResult;\n\npublic class PdfOrientationValidator implements PropertyValidator {\n\n    private static final PdfExportPreferences.Orientation[] VALUES = PdfExportPreferences.Orientation.values();\n\n    private final EnumValuePropertyValidator<PdfExportPreferences.Orientation> validator;\n\n    public PdfOrientationValidator() {\n        this.validator = new EnumValuePropertyValidator<>(VALUES);\n    }\n\n    @Override\n    public ValidationResult validate(Object value) {\n        return validator.validate(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/file/exports/PdfUnitValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.EnumValuePropertyValidator;\nimport org.uberfire.preferences.shared.impl.validation.ValidationResult;\n\npublic class PdfUnitValidator implements PropertyValidator {\n\n    private static final PdfExportPreferences.Unit[] VALUES = PdfExportPreferences.Unit.values();\n\n    private final EnumValuePropertyValidator<PdfExportPreferences.Unit> validator;\n\n    public PdfUnitValidator() {\n        this.validator = new EnumValuePropertyValidator<>(VALUES);\n    }\n\n    @Override\n    public ValidationResult validate(Object value) {\n        return validator.validate(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/readonly/ReadOnlyPathPlaceRequest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.readonly;\n\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@Portable\npublic class ReadOnlyPathPlaceRequest\n        extends PathPlaceRequest {\n\n    public ReadOnlyPathPlaceRequest() {\n        addParameter(\"readOnly\",\n                     \"yes\");\n    }\n\n    public ReadOnlyPathPlaceRequest(Path path) {\n        super(path);\n        addParameter(\"readOnly\",\n                     \"yes\");\n    }\n\n    public ReadOnlyPathPlaceRequest(Path path,\n                                    Map<String, String> parameters) {\n        super(path,\n              parameters);\n        addParameter(\"readOnly\",\n                     \"yes\");\n    }\n\n    public ReadOnlyPathPlaceRequest(Path path,\n                                    String id) {\n        super(path,\n              id);\n        addParameter(\"readOnly\",\n                     \"yes\");\n    }\n\n    public ReadOnlyPathPlaceRequest(Path path,\n                                    String id,\n                                    Map<String, String> parameters) {\n        super(path,\n              id,\n              parameters);\n        addParameter(\"readOnly\",\n                     \"yes\");\n    }\n\n    @Override\n    public String toString() {\n        return \"ReadOnlyPathPlaceRequest [identifier=\" + identifier +\n                \", parameters=\" + parameters + \", path=\" + getPath() + \"]\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/CopyService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\n\n/**\n * Responsible for paths copy.\n */\n@Remote\npublic interface CopyService extends SupportsCopy {\n\n    /**\n     * Copies (in batch) the paths passed in {@param paths}, if they exist.\n     * @param paths Paths that will be removed.\n     * @param newName New path's name.\n     * @param comment Comment about the renaming.\n     */\n    void copyIfExists(final Collection<Path> paths,\n                      final String newName,\n                      final String comment);\n\n    /**\n     * Verifies if a path can be copied.\n     * @param path Path to be verified.\n     * @return true if there is a restriction and the path cannot be copied, and false otherwise.\n     */\n    boolean hasRestriction(Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/DeleteService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\n\n/**\n * Responsible for paths removal.\n */\n@Remote\npublic interface DeleteService extends SupportsDelete {\n\n    /**\n     * Deletes (in batch) the paths passed in {@param paths}, if they exist.\n     * @param paths Paths that will be removed.\n     */\n    void deleteIfExists(final Collection<Path> paths,\n                        final String comment);\n\n    /**\n     * Verifies if a path can be deleted.\n     * @param path Path to be verified.\n     * @return true if there is a restriction and the path cannot be deleted, and false otherwise.\n     */\n    boolean hasRestriction(Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/PathNamingService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Utilities service for directories and files naming methods.\n */\npublic interface PathNamingService {\n\n    /**\n     * Creates a path by renaming a file or directory, keeping the original file extension (if applicable).\n     * @param originalPath Original file path\n     * @param targetFileName New file name\n     * @return Path for the new file\n     */\n    Path buildTargetPath(Path originalPath,\n                         String targetFileName);\n\n    /**\n     * Creates a path to a file or directory in another parent directory, keeping the original file extension (if applicable).\n     * @param originalPath Original file path\n     * @param targetParentDirectory Parent directory of the created file/directory path\n     * @param targetFileName New file name\n     * @return Path for the new file\n     */\n    Path buildTargetPath(Path originalPath,\n                         Path targetParentDirectory,\n                         String targetFileName);\n\n    /**\n     * Returns the extension of the passed file name.\n     * @param fileName File name with extension\n     * @return The file name extension\n     */\n    String getExtension(final String fileName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/RenameService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\n\n/**\n * Responsible for paths renaming.\n */\n@Remote\npublic interface RenameService extends SupportsRename {\n\n    /**\n     * Renames (in batch) the paths passed in {@param paths}, if they exist.\n     * @param paths Paths that will be renamed.\n     * @param newName Path's new name.\n     * @param comment Comment about the renaming.\n     */\n    void renameIfExists(final Collection<Path> paths,\n                        final String newName,\n                        final String comment);\n\n    /**\n     * Verifies if a path can be renamed.\n     * @param path Path to be verified.\n     * @return true if there is a restriction and the path cannot be renamed, and false otherwise.\n     */\n    boolean hasRestriction(Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/ValidationService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * This service is responsible for doing general validation on files and paths.\n */\n@Remote\npublic interface ValidationService {\n\n    /**\n     * Checks if the path and file name is valid.\n     */\n    boolean isFileNameValid(final Path path,\n                            final String fileName);\n\n    /**\n     * Checks if the file name is valid.\n     */\n    boolean isFileNameValid(final String fileName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/htmleditor/HtmlEditorService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.htmleditor;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRead;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\n\n@Remote\npublic interface HtmlEditorService extends SupportsCopy,\n                                           SupportsDelete,\n                                           SupportsRead<String>,\n                                           SupportsSaveAndRename<String, DefaultMetadata> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/restriction/PathOperationRestriction.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.restriction;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Represents a restriction to a path operation (copy, delete or rename).\n */\npublic interface PathOperationRestriction {\n\n    /**\n     * Returns the message which describes the restriction.\n     * @param path Path related to the restriction.\n     * @return Message related to the restriction.\n     */\n    String getMessage(Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/restrictor/CopyRestrictor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.restrictor;\n\n/**\n * Represents a restrictor to a copy operation.\n */\npublic interface CopyRestrictor extends PathOperationRestrictor {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/restrictor/DeleteRestrictor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.restrictor;\n\n/**\n * Represents a restrictor to a delete operation.\n */\npublic interface DeleteRestrictor extends PathOperationRestrictor {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/restrictor/PathOperationRestrictor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.restrictor;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\n\n/**\n * Represents a restrictor to a path operation (copy, delete or rename).\n */\npublic interface PathOperationRestrictor {\n\n    /**\n     * Checks if there is a restriction to execute a operation on this path.\n     * @param path Path to be checked.\n     * @return The restriction to execute the operation, or null if there is not one.\n     */\n    PathOperationRestriction hasRestriction(Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/restrictor/RenameRestrictor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.restrictor;\n\n/**\n * Represents a restrictor to a rename operation.\n */\npublic interface RenameRestrictor extends PathOperationRestrictor {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsCopy.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Describes a service that supports the copy operation.\n */\npublic interface SupportsCopy {\n\n    /**\n     * Copies a file or directory to the same parent directory, with a new name.\n     * @param path Original file or directory\n     * @param newName Name of the new file or directory\n     * @param comment Comment for the copy operation\n     * @return The path to the new file.\n     */\n    Path copy(final Path path,\n              final String newName,\n              final String comment);\n\n    /**\n     * Copies a file or directory to a specific target directory, with a new name.\n     * @param path Original file or directory\n     * @param newName Name of the new file or directory\n     * @param targetDirectory Directory in which the new file will be written\n     * @param comment Comment for the copy operation\n     * @return The path to the new file.\n     */\n    Path copy(final Path path,\n              final String newName,\n              final Path targetDirectory,\n              final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsCreate.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsCreate<T> {\n\n    Path create(final Path context,\n                final String fileName,\n                final T content,\n                final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsDelete.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsDelete {\n\n    void delete(final Path path,\n                final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsRead.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsRead<T> {\n\n    T load(final Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsRename.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsRename {\n\n    Path rename(final Path path,\n                final String newName,\n                final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsSaveAndRename.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsSaveAndRename<T, M> extends SupportsRename,\n                                                     SupportsUpdate<T, M> {\n\n    Path saveAndRename(final Path path,\n                       final String newFileName,\n                       final M metadata,\n                       final T content,\n                       final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/service/support/SupportsUpdate.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.service.support;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsUpdate<T, M> {\n\n    Path save(final Path path,\n              final T content,\n              final M metadata,\n              final String comment);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/template/TemplateRenderer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.template;\n\n/**\n * Represents a template engine rendering.\n * @param <D> is the model to rendered on the template.\n */\npublic interface TemplateRenderer<D> {\n\n    String render(String template, D data);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/template/mustache/MustacheTemplateRenderer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.template.mustache;\n\nimport org.uberfire.ext.editor.commons.template.TemplateRenderer;\n\n/**\n * Represents a {@link TemplateRenderer} based on Mustache engine.\n * May have implementations for Client and Backend.\n * <p>\n * See {@linktourl https://mustache.github.io/}\n * See {@linktourl https://github.com/janl/mustache.js}\n * See {@linktourl https://github.com/spullara/mustache.java}\n * @param <D> data model to be rendered on the template.\n */\npublic interface MustacheTemplateRenderer<D> extends TemplateRenderer<D> {\n\n    String render(String template, D data);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/version/CurrentBranch.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.version;\n\npublic interface CurrentBranch {\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/version/VersionService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.version;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\n/**\n *\n */\n@Remote\npublic interface VersionService {\n\n    List<VersionRecord> getVersions(final Path path);\n\n    Path getPathToPreviousVersion(String uri);\n\n    Path restore(final Path path,\n                 final String comment,\n                 final String branchName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/version/events/RestoreEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.version.events;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\npublic class RestoreEvent {\n\n    private ObservablePath path;\n\n    public RestoreEvent(final ObservablePath path) {\n        this.path = path;\n    }\n\n    public ObservablePath getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/java/org/uberfire/ext/editor/commons/version/impl/PortableVersionRecord.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.version.impl;\n\nimport java.util.Date;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\n@Portable\npublic class PortableVersionRecord implements VersionRecord {\n\n    private String id;\n    private String author;\n    private String email;\n    private String comment;\n    private Date date;\n    private String uri;\n\n    public PortableVersionRecord(@MapsTo(\"id\") final String id,\n                                 @MapsTo(\"author\") final String author,\n                                 @MapsTo(\"email\") final String email,\n                                 @MapsTo(\"comment\") final String comment,\n                                 @MapsTo(\"date\") final Date date,\n                                 @MapsTo(\"uri\") final String uri) {\n        this.id = id;\n        this.author = author;\n        this.email = email;\n        this.comment = comment;\n        this.date = date;\n        this.uri = uri;\n    }\n\n    @Override\n    public String id() {\n        return id;\n    }\n\n    @Override\n    public String author() {\n        return author;\n    }\n\n    @Override\n    public String email() {\n        return null;\n    }\n\n    @Override\n    public String comment() {\n        return comment;\n    }\n\n    @Override\n    public Date date() {\n        return date;\n    }\n\n    @Override\n    public String uri() {\n        return uri;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        PortableVersionRecord that = (PortableVersionRecord) o;\n\n        if (author != null ? !author.equals(that.author) : that.author != null) {\n            return false;\n        }\n        if (comment != null ? !comment.equals(that.comment) : that.comment != null) {\n            return false;\n        }\n        if (date != null ? !date.equals(that.date) : that.date != null) {\n            return false;\n        }\n        if (email != null ? !email.equals(that.email) : that.email != null) {\n            return false;\n        }\n        if (id != null ? !id.equals(that.id) : that.id != null) {\n            return false;\n        }\n        if (uri != null ? !uri.equals(that.uri) : that.uri != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id != null ? id.hashCode() : 0;\n        result = 31 * result + (author != null ? author.hashCode() : 0);\n        result = 31 * result + (email != null ? email.hashCode() : 0);\n        result = 31 * result + (comment != null ? comment.hashCode() : 0);\n        result = 31 * result + (date != null ? date.hashCode() : 0);\n        result = 31 * result + (uri != null ? uri.hashCode() : 0);\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/resources/META-INF/beans.xml",
    "content": "<beans xmlns=\"http://java.sun.com/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd\">\n\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/main/resources/org/uberfire/ext/editor/commons/UberfireCommonsEditorAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<module>\n\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.java.nio.UberfireNIO2Model\"/>\n\n  <source path='file'/>\n  <source path='readonly'/>\n  <source path='version'/>\n  <source path='service'/>\n  <source path='template'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/test/java/org/uberfire/ext/editor/commons/file/exports/FileExportsPreferencesTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class FileExportsPreferencesTest {\n\n    @Test\n    public void testDefaultValues() {\n        FileExportsPreferences fileExportsPreferences = new FileExportsPreferences();\n        fileExportsPreferences = fileExportsPreferences.defaultValue(fileExportsPreferences);\n        final PdfExportPreferences pdfPreferences = fileExportsPreferences.getPdfPreferences();\n        assertEquals(PdfExportPreferences.Orientation.PORTRAIT,\n                     pdfPreferences.getOrientation());\n        assertEquals(PdfExportPreferences.Unit.MM,\n                     pdfPreferences.getUnit());\n        assertEquals(PdfExportPreferences.Format.A4,\n                     pdfPreferences.getFormat());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-api/src/test/java/org/uberfire/ext/editor/commons/file/exports/PdfValidatorsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.file.exports;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class PdfValidatorsTest {\n\n    private static final PdfOrientationValidator ORIENTATION_VALIDATOR = new PdfOrientationValidator();\n    private static final PdfFormatValidator FORMAT_VALIDATOR = new PdfFormatValidator();\n    private static final PdfUnitValidator UNIT_VALIDATOR = new PdfUnitValidator();\n\n    @Test\n    public void testOrientation() {\n        assertTrue(ORIENTATION_VALIDATOR.validate(PdfExportPreferences.Orientation.PORTRAIT.name()).isValid());\n        assertTrue(ORIENTATION_VALIDATOR.validate(PdfExportPreferences.Orientation.LANDSCAPE.name()).isValid());\n        assertFalse(ORIENTATION_VALIDATOR.validate(\"someOrientation\").isValid());\n    }\n\n    @Test\n    public void testFormat() {\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.A0.name()).isValid());\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.A10.name()).isValid());\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.B0.name()).isValid());\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.B10.name()).isValid());\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.C0.name()).isValid());\n        assertTrue(FORMAT_VALIDATOR.validate(PdfExportPreferences.Format.C10.name()).isValid());\n        assertFalse(FORMAT_VALIDATOR.validate(\"A11\").isValid());\n    }\n\n    @Test\n    public void testUnit() {\n        assertTrue(UNIT_VALIDATOR.validate(PdfExportPreferences.Unit.MM.name()).isValid());\n        assertTrue(UNIT_VALIDATOR.validate(PdfExportPreferences.Unit.CM.name()).isValid());\n        assertTrue(UNIT_VALIDATOR.validate(PdfExportPreferences.Unit.IN.name()).isValid());\n        assertTrue(UNIT_VALIDATOR.validate(PdfExportPreferences.Unit.PT.name()).isValid());\n        assertFalse(UNIT_VALIDATOR.validate(\"xs\").isValid());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-commons-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-commons-editor-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Commons Editor Backend</name>\n  <description>Uberfire Commons Editor Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/CopyServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.helper.CopyHelper;\nimport org.uberfire.ext.editor.commons.service.CopyService;\nimport org.uberfire.ext.editor.commons.service.PathNamingService;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\nimport org.uberfire.ext.editor.commons.service.restrictor.CopyRestrictor;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\n\n@Service\n@ApplicationScoped\npublic class CopyServiceImpl implements CopyService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(CopyServiceImpl.class);\n\n    private IOService ioService;\n\n    private User identity;\n\n    private SessionInfo sessionInfo;\n\n    private Instance<CopyHelper> helpers;\n\n    private Event<ResourceCopiedEvent> resourceCopiedEvent;\n\n    private Instance<CopyRestrictor> copyRestrictorBeans;\n\n    private PathNamingService pathNamingService;\n\n    public CopyServiceImpl() {\n    }\n\n    @Inject\n    public CopyServiceImpl(@Named(\"ioStrategy\") IOService ioService,\n                           User identity,\n                           SessionInfo sessionInfo,\n                           Instance<CopyHelper> helpers,\n                           Event<ResourceCopiedEvent> resourceCopiedEvent,\n                           Instance<CopyRestrictor> copyRestrictorBeans,\n                           PathNamingService pathNamingService) {\n        this.ioService = ioService;\n        this.identity = identity;\n        this.sessionInfo = sessionInfo;\n        this.helpers = helpers;\n        this.resourceCopiedEvent = resourceCopiedEvent;\n        this.copyRestrictorBeans = copyRestrictorBeans;\n        this.pathNamingService = pathNamingService;\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final String comment) {\n        LOGGER.info(\"User:\" + identity.getIdentifier() + \" copying file [\" + path.getFileName() + \"] to [\" + newName + \"]\");\n\n        checkRestrictions(path);\n\n        try {\n            final Path targetPath = pathNamingService.buildTargetPath(path,\n                                                                      newName);\n            return copyPath(path,\n                            newName,\n                            targetPath,\n                            comment);\n        } catch (final RuntimeException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final Path targetDirectory,\n                     final String comment) {\n        if (targetDirectory == null) {\n            return copy(path,\n                        newName,\n                        comment);\n        }\n\n        LOGGER.info(\"User:\" + identity.getIdentifier() + \" copying file [\" + path.getFileName() + \"] to [\" + newName + \"]\");\n\n        checkRestrictions(path);\n\n        try {\n            final Path targetPath = pathNamingService.buildTargetPath(path,\n                                                                      targetDirectory,\n                                                                      newName);\n            return copyPath(path,\n                            newName,\n                            targetPath,\n                            comment);\n        } catch (final RuntimeException e) {\n            throw e;\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void copyIfExists(final Collection<Path> paths,\n                             final String newName,\n                             final String comment) {\n        try {\n            //Always use a batch as CopyHelpers may be involved with the rename operation\n            startBatch(paths);\n\n            for (final Path path : paths) {\n                LOGGER.info(\"User:\" + identity.getIdentifier() + \" copying file (if exists) [\" + path.getFileName() + \"] to [\" + newName + \"]\");\n\n                checkRestrictions(path);\n                copyPathIfExists(path,\n                                 newName,\n                                 comment);\n            }\n        } catch (final RuntimeException e) {\n            throw e;\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            endBatch();\n        }\n    }\n\n    @Override\n    public boolean hasRestriction(final Path path) {\n        for (CopyRestrictor copyRestrictor : getCopyRestrictors()) {\n            final PathOperationRestriction copyRestriction = copyRestrictor.hasRestriction(path);\n            if (copyRestriction != null) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private void checkRestrictions(final Path path) {\n        for (CopyRestrictor copyRestrictor : getCopyRestrictors()) {\n            final PathOperationRestriction copyRestriction = copyRestrictor.hasRestriction(path);\n            if (copyRestriction != null) {\n                throw new RuntimeException(copyRestriction.getMessage(path));\n            }\n        }\n    }\n\n    Path copyPath(final Path path,\n                  final String newName,\n                  final Path targetPath,\n                  final String comment) {\n        final org.uberfire.java.nio.file.Path _path = Paths.convert(path);\n        final org.uberfire.java.nio.file.Path _target = Paths.convert(targetPath);\n\n        try {\n            ioService.startBatch(_target.getFileSystem());\n\n            ioService.copy(_path,\n                           _target,\n                           new CommentedOption(sessionInfo != null ? sessionInfo.getId() : \"--\",\n                                               identity.getIdentifier(),\n                                               null,\n                                               comment));\n\n            //Delegate additional changes required for a copy to applicable Helpers\n            if (helpers != null) {\n                for (CopyHelper helper : helpers) {\n                    if (helper.supports(targetPath)) {\n                        helper.postProcess(path,\n                                           targetPath);\n                    }\n                }\n            }\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            endBatch();\n        }\n\n        resourceCopiedEvent.fire(new ResourceCopiedEvent(path,\n                                                         targetPath,\n                                                         comment,\n                                                         sessionInfo != null ? sessionInfo : new SessionInfoImpl(\"--\",\n                                                                                                                 identity)));\n\n        return targetPath;\n    }\n\n    void copyPathIfExists(final Path path,\n                          final String newName,\n                          final String comment) {\n        final org.uberfire.java.nio.file.Path _path = Paths.convert(path);\n\n        if (Files.exists(_path)) {\n            final org.uberfire.java.nio.file.Path _target = Paths.convert(pathNamingService.buildTargetPath(path,\n                                                                                                            newName));\n\n            ioService.copy(_path,\n                           _target,\n                           new CommentedOption(sessionInfo.getId(),\n                                               identity.getIdentifier(),\n                                               null,\n                                               comment)\n            );\n\n            //Delegate additional changes required for a copy to applicable Helpers\n            if (_target != null && helpers != null) {\n                final Path targetPath = Paths.convert(_target);\n                for (CopyHelper helper : helpers) {\n                    if (helper.supports(targetPath)) {\n                        helper.postProcess(path,\n                                           targetPath);\n                    }\n                }\n            }\n        }\n    }\n\n    void startBatch(final Collection<Path> paths) {\n        ioService.startBatch(Paths.convert(paths.iterator().next()).getFileSystem());\n    }\n\n    void endBatch() {\n        ioService.endBatch();\n    }\n\n    Iterable<CopyRestrictor> getCopyRestrictors() {\n        return copyRestrictorBeans;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/DeleteServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.helper.DeleteHelper;\nimport org.uberfire.ext.editor.commons.service.DeleteService;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\nimport org.uberfire.ext.editor.commons.service.restrictor.DeleteRestrictor;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.rpc.SessionInfo;\n\n@Service\n@ApplicationScoped\npublic class DeleteServiceImpl implements DeleteService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(DeleteServiceImpl.class);\n\n    private IOService ioService;\n    private User identity;\n    private SessionInfo sessionInfo;\n    private Instance<DeleteHelper> helpers;\n    private Instance<DeleteRestrictor> deleteRestrictorBeans;\n\n    public DeleteServiceImpl() {\n        //CDI proxies\n    }\n\n    @Inject\n    public DeleteServiceImpl(final @Named(\"ioStrategy\") IOService ioService,\n                             final User identity,\n                             final SessionInfo sessionInfo,\n                             final Instance<DeleteHelper> helpers,\n                             final Instance<DeleteRestrictor> deleteRestrictorBeans) {\n        this.ioService = ioService;\n        this.identity = identity;\n        this.sessionInfo = sessionInfo;\n        this.helpers = helpers;\n        this.deleteRestrictorBeans = deleteRestrictorBeans;\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final String comment) {\n\n        LOGGER.info(\"User:\" + identity.getIdentifier() + \" deleting file [\" + path.getFileName() + \"]\");\n\n        checkRestrictions(path);\n\n        try {\n            deletePath(path,\n                       comment);\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void deleteIfExists(final Collection<Path> paths,\n                               final String comment) {\n        try {\n            startBatch(paths);\n\n            for (final Path path : paths) {\n                LOGGER.info(\"User:\" + identity.getIdentifier() + \" deleting file (if exists) [\" + path.getFileName() + \"]\");\n\n                checkRestrictions(path);\n                deletePathIfExists(path,\n                                   comment);\n            }\n        } catch (final RuntimeException e) {\n            throw e;\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            endBatch(paths);\n        }\n    }\n\n    @Override\n    public boolean hasRestriction(final Path path) {\n        for (DeleteRestrictor deleteRestrictor : getDeleteRestrictors()) {\n            final PathOperationRestriction deleteRestriction = deleteRestrictor.hasRestriction(path);\n            if (deleteRestriction != null) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private void checkRestrictions(final Path path) {\n        for (DeleteRestrictor deleteRestrictor : getDeleteRestrictors()) {\n            final PathOperationRestriction deleteRestriction = deleteRestrictor.hasRestriction(path);\n            if (deleteRestriction != null) {\n                throw new RuntimeException(deleteRestriction.getMessage(path));\n            }\n        }\n    }\n\n    void deletePath(final Path path,\n                    final String comment) {\n        final org.uberfire.java.nio.file.Path _path = Paths.convert(path);\n\n        try {\n            ioService.startBatch(_path.getFileSystem());\n\n            // Delegate additional changes required for a deletion to applicable Helpers. Helpers are invoked before\n            // the deletion as Helpers may depend on the presence of the file; in particular when it is necessary to\n            // resolve a Package from a file name.\n            notifyDeleteHelpers(path);\n\n            ioService.delete(Paths.convert(path),\n                             new CommentedOption(sessionInfo != null ? sessionInfo.getId() : \"--\",\n                                                 identity.getIdentifier(),\n                                                 null,\n                                                 comment));\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    void deletePathIfExists(final Path path,\n                            final String comment) {\n        // Delegate additional changes required for a deletion to applicable Helpers. Helpers are invoked before\n        // the deletion as Helpers may depend on the presence of the file; in particular when it is necessary to\n        // resolve a Package from a file name.\n        notifyDeleteHelpers(path);\n\n        ioService.deleteIfExists(Paths.convert(path),\n                                 new CommentedOption(sessionInfo.getId(),\n                                                     identity.getIdentifier(),\n                                                     null,\n                                                     comment),\n                                 StandardDeleteOption.NON_EMPTY_DIRECTORIES\n        );\n    }\n\n    void notifyDeleteHelpers(final Path path) {\n        final Iterable<DeleteHelper> helpers = getDeleteHelpers();\n        if (helpers != null) {\n            for (DeleteHelper helper : helpers) {\n                if (helper.supports(path)) {\n                    helper.postProcess(path);\n                }\n            }\n        }\n    }\n\n    void startBatch(final Collection<Path> paths) {\n        if (paths.size() > 1) {\n            ioService.startBatch(Paths.convert(paths.iterator().next()).getFileSystem());\n        }\n    }\n\n    void endBatch(final Collection<Path> paths) {\n        if (paths.size() > 1) {\n            ioService.endBatch();\n        }\n    }\n\n    Iterable<DeleteRestrictor> getDeleteRestrictors() {\n        return deleteRestrictorBeans;\n    }\n\n    Iterable<DeleteHelper> getDeleteHelpers() {\n        return helpers;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/RenameServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.helper.RenameHelper;\nimport org.uberfire.ext.editor.commons.service.PathNamingService;\nimport org.uberfire.ext.editor.commons.service.RenameService;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\nimport org.uberfire.ext.editor.commons.service.restrictor.RenameRestrictor;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.rpc.SessionInfo;\n\n@Service\n@ApplicationScoped\npublic class RenameServiceImpl implements RenameService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(RenameServiceImpl.class);\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    private User identity;\n\n    @Inject\n    private SessionInfo sessionInfo;\n\n    @Inject\n    private Instance<RenameHelper> helpers;\n\n    @Inject\n    private Instance<RenameRestrictor> renameRestrictorBeans;\n\n    @Inject\n    private PathNamingService pathNamingService;\n\n    @Override\n    public Path rename(final Path path,\n                       final String newName,\n                       final String comment) {\n        LOGGER.info(\"User:\" + identity.getIdentifier() + \" renaming file [\" + path.getFileName() + \"] to [\" + newName + \"]\");\n\n        checkRestrictions(path);\n\n        try {\n            return renamePath(path,\n                              newName,\n                              comment);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void renameIfExists(final Collection<Path> paths,\n                               final String newName,\n                               final String comment) {\n\n        try {\n            //Always use a batch as RenameHelpers may be involved with the rename operation\n            startBatch(paths);\n\n            for (final Path path : paths) {\n                LOGGER.info(\"User:\" + identity.getIdentifier() + \" renaming file (if exists) [\" + path.getFileName() + \"] to [\" + newName + \"]\");\n\n                checkRestrictions(path);\n                renamePathIfExists(path,\n                                   newName,\n                                   comment);\n            }\n        } catch (final RuntimeException e) {\n            throw e;\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            endBatch();\n        }\n    }\n\n    @Override\n    public boolean hasRestriction(final Path path) {\n        for (RenameRestrictor renameRestrictor : getRenameRestrictors()) {\n            final PathOperationRestriction renameRestriction = renameRestrictor.hasRestriction(path);\n            if (renameRestriction != null) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private void checkRestrictions(Path path) {\n        for (RenameRestrictor renameRestrictor : getRenameRestrictors()) {\n            final PathOperationRestriction renameRestriction = renameRestrictor.hasRestriction(path);\n            if (renameRestriction != null) {\n                throw new RuntimeException(renameRestriction.getMessage(path));\n            }\n        }\n    }\n\n    Path renamePath(final Path path,\n                    final String newName,\n                    final String comment) {\n        final org.uberfire.java.nio.file.Path _path = Paths.convert(path);\n        final org.uberfire.java.nio.file.Path _target = Paths.convert(pathNamingService.buildTargetPath(path,\n                                                                                                        newName));\n\n        final Path targetPath = Paths.convert(_target);\n\n        try {\n            ioService.startBatch(_target.getFileSystem());\n\n            ioService.move(_path,\n                           _target,\n                           new CommentedOption(sessionInfo != null ? sessionInfo.getId() : \"--\",\n                                               identity.getIdentifier(),\n                                               null,\n                                               comment));\n\n            //Delegate additional changes required for a rename to applicable Helpers\n            for (RenameHelper helper : helpers) {\n                if (helper.supports(targetPath)) {\n                    helper.postProcess(path,\n                                       targetPath);\n                }\n            }\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            endBatch();\n        }\n\n        return Paths.convert(_target);\n    }\n\n    void renamePathIfExists(final Path path,\n                            final String newName,\n                            final String comment) {\n        final org.uberfire.java.nio.file.Path _path = Paths.convert(path);\n\n        if (Files.exists(_path)) {\n            final org.uberfire.java.nio.file.Path _target = Paths.convert(pathNamingService.buildTargetPath(path,\n                                                                                                            newName));\n\n            ioService.move(_path,\n                           _target,\n                           new CommentedOption(sessionInfo.getId(),\n                                               identity.getIdentifier(),\n                                               null,\n                                               comment)\n            );\n\n            //Delegate additional changes required for a rename to applicable Helpers\n            if (_target != null) {\n                final Path targetPath = Paths.convert(_target);\n                for (RenameHelper helper : helpers) {\n                    if (helper.supports(targetPath)) {\n                        helper.postProcess(path,\n                                           targetPath);\n                    }\n                }\n            }\n        }\n    }\n\n    void startBatch(final Collection<Path> paths) {\n        ioService.startBatch(Paths.convert(paths.iterator().next()).getFileSystem());\n    }\n\n    void endBatch() {\n        ioService.endBatch();\n    }\n\n    Iterable<RenameRestrictor> getRenameRestrictors() {\n        return renameRestrictorBeans;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/SaveAndRenameServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\n\npublic class SaveAndRenameServiceImpl<T, M> implements SupportsSaveAndRename<T, M> {\n\n    private SupportsSaveAndRename<T, M> updateService;\n\n    public void init(final SupportsSaveAndRename<T, M> updateService) {\n        this.updateService = updateService;\n    }\n\n    @Override\n    public Path rename(final Path path,\n                       final String newFileName,\n                       final String comment) {\n        return updateService.rename(path, newFileName, comment);\n    }\n\n    @Override\n    public Path save(final Path path,\n                     final T content,\n                     final M metadata,\n                     final String comment) {\n        return updateService.save(path, content, metadata, comment);\n    }\n\n    @Override\n    public Path saveAndRename(final Path path,\n                              final String newFileName,\n                              final M metadata,\n                              final T content,\n                              final String comment) {\n\n        final Path savedPath = save(path, content, metadata, comment);\n        final Path renamedPath = rename(savedPath, newFileName, comment);\n\n        return renamedPath;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/ValidationServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.validation.FileNameValidator;\nimport org.uberfire.ext.editor.commons.service.ValidationService;\n\nimport static java.util.Collections.sort;\n\n@Service\n@ApplicationScoped\npublic class ValidationServiceImpl implements ValidationService {\n\n    @Any\n    @Inject\n    private Instance<FileNameValidator> fileNameValidatorBeans;\n    private List<FileNameValidator> sortedValidators = new ArrayList<FileNameValidator>();\n\n    @PostConstruct\n    public void configureValidators() {\n        for (FileNameValidator fileNameValidator : fileNameValidatorBeans) {\n            sortedValidators.add(fileNameValidator);\n        }\n\n        //Sort ascending, so we can check which validator supports a particular case by priority\n        sort(sortedValidators,\n             new Comparator<FileNameValidator>() {\n                 @Override\n                 public int compare(final FileNameValidator o1,\n                                    final FileNameValidator o2) {\n                     return o2.getPriority() - o1.getPriority();\n                 }\n             });\n    }\n\n    @Override\n    public boolean isFileNameValid(final String fileName) {\n        for (final FileNameValidator fileNameValidator : sortedValidators) {\n            if (fileNameValidator.accept(fileName)) {\n                return fileNameValidator.isValid(fileName);\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public boolean isFileNameValid(final Path path,\n                                   final String fileName) {\n        for (final FileNameValidator fileNameValidator : sortedValidators) {\n            if (fileNameValidator.accept(path)) {\n                return fileNameValidator.isValid(fileName);\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/helper/CopyHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.service.helper;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Helper for when a file is copied. Helpers are always invoked after the copy occurred.\n */\npublic interface CopyHelper {\n\n    /**\n     * This is invoked by parent code to provide the means for a Helper to signal whether it supports the given Path\n     * @param destination Path\n     * @return\n     */\n    boolean supports(final Path destination);\n\n    /**\n     * Perform post processing following the copy operation. This is always within a IOService batch operation.\n     * @param source Path Source before copy\n     * @param destination Path Destination after copy\n     */\n    void postProcess(final Path source,\n                     final Path destination);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/helper/DeleteHelper.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.service.helper;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Helper for when a file is deleted. Helpers are always invoked before the deletion occurs.\n */\npublic interface DeleteHelper {\n\n    /**\n     * Helpers signal whether it supports the given Path\n     * @param path The Path that was deleted.\n     * @return\n     */\n    boolean supports(final Path path);\n\n    /**\n     * Performs post processing following the delete operation. This is always within a IOService batch operation.\n     * @param path The Path that was deleted.\n     */\n    void postProcess(final Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/helper/RenameHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.service.helper;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Helper for when a file is renamed. Helpers are always invoked after the rename occurs.\n */\npublic interface RenameHelper {\n\n    /**\n     * This is invoked by parent code to provide the means for a Helper to signal whether it supports the given Path\n     * @param destination Path\n     * @return\n     */\n    boolean supports(final Path destination);\n\n    /**\n     * Perform post processing following the rename operation. This is always within a IOService batch operation.\n     * @param source Path Source before copy\n     * @param destination Path Destination after copy\n     */\n    void postProcess(final Path source,\n                     final Path destination);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/htmleditor/HtmlEditorServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.htmleditor;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.CopyService;\nimport org.uberfire.ext.editor.commons.service.DeleteService;\nimport org.uberfire.ext.editor.commons.service.RenameService;\nimport org.uberfire.ext.editor.commons.service.htmleditor.HtmlEditorService;\n\npublic class HtmlEditorServiceImpl implements HtmlEditorService {\n\n    private VFSService vfsServices;\n\n    private DeleteService deleteService;\n\n    private RenameService renameService;\n\n    private CopyService copyService;\n\n    private SaveAndRenameServiceImpl<String, DefaultMetadata> saveAndRenameService;\n\n    @Inject\n    public HtmlEditorServiceImpl(final VFSService vfsServices,\n                                 final DeleteService deleteService,\n                                 final RenameService renameService,\n                                 final CopyService copyService,\n                                 final SaveAndRenameServiceImpl<String, DefaultMetadata> saveAndRenameService) {\n        this.vfsServices = vfsServices;\n        this.deleteService = deleteService;\n        this.renameService = renameService;\n        this.copyService = copyService;\n        this.saveAndRenameService = saveAndRenameService;\n    }\n\n    @PostConstruct\n    public void init() {\n        saveAndRenameService.init(this);\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final String comment) {\n        deleteService.delete(path, comment);\n    }\n\n    @Override\n    public Path rename(final Path path,\n                       final String newName,\n                       final String comment) {\n        return renameService.rename(path, newName, comment);\n    }\n\n    @Override\n    public Path save(final Path path,\n                     final String content,\n                     final DefaultMetadata _metadata,\n                     final String _comment) {\n        return vfsServices.write(path, content);\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final String comment) {\n        return copyService.copy(path, newName, comment);\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final Path targetDirectory,\n                     final String comment) {\n        return copyService.copy(path, newName, targetDirectory, comment);\n    }\n\n    @Override\n    public String load(final Path path) {\n        return vfsServices.readAllString(path);\n    }\n\n    @Override\n    public Path saveAndRename(final Path path,\n                              final String newFileName,\n                              final DefaultMetadata metadata,\n                              final String content,\n                              final String comment) {\n        return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/naming/PathNamingServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.naming;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.PathNamingService;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n@ApplicationScoped\npublic class PathNamingServiceImpl implements PathNamingService {\n\n    @Inject\n    private Instance<ResourceTypeDefinition> resourceTypeDefinitions;\n\n    public Path buildTargetPath(Path originalPath,\n                                String targetFileName) {\n        final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath);\n        String extension = \"\";\n\n        if (!Files.isDirectory(_originalPath)) {\n            extension = getExtension(originalPath.getFileName());\n        }\n\n        return Paths.convert(_originalPath.resolveSibling(targetFileName + extension));\n    }\n\n    public Path buildTargetPath(Path originalPath,\n                                Path targetParentDirectory,\n                                String targetFileName) {\n        final org.uberfire.java.nio.file.Path _originalPath = Paths.convert(originalPath);\n        final org.uberfire.java.nio.file.Path _targetParentDirectory = Paths.convert(targetParentDirectory);\n        String extension = \"\";\n\n        if (!Files.isDirectory(_originalPath)) {\n            extension = getExtension(originalPath.getFileName());\n        }\n\n        return Paths.convert(_targetParentDirectory.resolve(targetFileName + extension));\n    }\n\n    public String getExtension(final String fileName) {\n        String extension = getResourceTypeExtension(fileName);\n\n        if (extension == null) {\n            extension = \"\";\n            final int extensionIndex = fileName.lastIndexOf(\".\");\n\n            if (extensionIndex >= 0) {\n                extension = fileName.substring(extensionIndex);\n            }\n        }\n\n        return extension;\n    }\n\n    private String getResourceTypeExtension(String fileName) {\n        String extension = null;\n\n        for (ResourceTypeDefinition resourceTypeDefinition : getResourceTypeDefinitions()) {\n            if (resourceTypeDefinition.getSuffix() != null) {\n                String resourceTypeExtension = \".\" + resourceTypeDefinition.getSuffix();\n                if (fileName.endsWith(resourceTypeExtension)) {\n                    if (extension == null || resourceTypeExtension.length() > extension.length()) {\n                        extension = resourceTypeExtension;\n                    }\n                }\n            }\n        }\n\n        return extension;\n    }\n\n    public Iterable<ResourceTypeDefinition> getResourceTypeDefinitions() {\n        return resourceTypeDefinitions;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/service/restriction/LockRestrictor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.restriction;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\nimport org.uberfire.ext.editor.commons.service.restrictor.DeleteRestrictor;\nimport org.uberfire.ext.editor.commons.service.restrictor.RenameRestrictor;\n\n@ApplicationScoped\npublic class LockRestrictor implements DeleteRestrictor,\n                                       RenameRestrictor {\n\n    @Inject\n    private VFSLockService lockService;\n\n    @Inject\n    private User identity;\n\n    @Override\n    public PathOperationRestriction hasRestriction(final Path path) {\n        final LockInfo lockInfo = lockService.retrieveLockInfo(path);\n        if (lockInfo != null && lockInfo.isLocked() && !identity.getIdentifier().equals(lockInfo.lockedBy())) {\n            return new PathOperationRestriction() {\n                @Override\n                public String getMessage(final Path path) {\n                    return path.toURI() + \" cannot be deleted, moved or renamed. It is locked by: \" + lockInfo.lockedBy();\n                }\n            };\n        }\n\n        final List<LockInfo> lockInfos = lockService.retrieveLockInfos(path,\n                                                                       true);\n        if (lockInfos != null && !lockInfos.isEmpty()) {\n            return new PathOperationRestriction() {\n                @Override\n                public String getMessage(final Path path) {\n                    return path.toURI() + \" cannot be deleted, moved or renamed. It contains the following locked files: \" + lockInfos;\n                }\n            };\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/validation/DefaultFileNameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Default validation of resource file names\n */\n@ApplicationScoped\npublic class DefaultFileNameValidator implements FileNameValidator {\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public boolean accept(final String fileName) {\n        return true;\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return true;\n    }\n\n    @Override\n    public boolean isValid(final String value) {\n        return ValidationUtils.isFileName(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/validation/FileNameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Generic validator for Path based resources\n */\npublic interface FileNameValidator {\n\n    /**\n     * Defines the validator priority in terms of validator resolution. Lower is lower priority.\n     * @return the priority\n     */\n    public int getPriority();\n\n    /**\n     * Indicates if the current parameter path matched the current validator\n     * @param fileName File name to validate (including extension)\n     * @return true if matches, otherwise false\n     */\n    public boolean accept(final String fileName);\n\n    /**\n     * Indicates if the current parameter path matched the current validator\n     * @param path Path to validate\n     * @return true if matches, otherwise false\n     */\n    public boolean accept(final Path path);\n\n    /**\n     * Validate the value\n     * @param value Value to be validated\n     */\n    public boolean isValid(final String value);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/validation/ValidationUtils.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport java.io.File;\nimport java.io.IOException;\nimport javax.lang.model.SourceVersion;\n\nimport org.apache.commons.lang3.StringUtils;\n\npublic class ValidationUtils {\n\n    private static final char[] ILLEGAL_CHARACTERS = {'/', '\\n', '\\r', '\\t', '\\0', '\\f', '`', '?', '*', '\\\\', '<', '>', '|', '\\\"', ':'};\n\n    public static boolean isFileName(final String value) {\n        //Null check\n        if (StringUtils.isBlank(value)) {\n            return false;\n        }\n\n        //Prefix and suffix \".\" causes issues\n        if (value.startsWith(\".\") || value.endsWith(\".\")) {\n            return false;\n        }\n\n        //Illegal character check\n        for (Character c : ILLEGAL_CHARACTERS) {\n            if (value.contains(c.toString())) {\n                return false;\n            }\n        }\n\n        final File f = new File(value);\n        try {\n            f.getCanonicalPath();\n            return true;\n        } catch (IOException e) {\n            return false;\n        }\n    }\n\n    public static boolean isJavaIdentifier(final String value) {\n        if (StringUtils.isBlank(value)) {\n            return false;\n        }\n        if (!SourceVersion.isIdentifier(value) || SourceVersion.isKeyword(value)) {\n            return false;\n        }\n        return true;\n    }\n\n    public static boolean isArtifactIdentifier(final String value) {\n        // See org.apache.maven.model.validation.DefaultModelValidator.java::ID_REGEX\n        return value != null && value.matches(\"[A-Za-z0-9_\\\\-.]+\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/version/PathResolverImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\nimport java.util.List;\nimport javax.inject.Inject;\n\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.Path;\n\npublic class PathResolverImpl\n        implements PathResolver {\n\n    private VersionRecordService versionLoader;\n    private VersionUtil util;\n\n    public PathResolverImpl() {\n    }\n\n    @Inject\n    public PathResolverImpl(VersionRecordService versionLoader,\n                            VersionUtil util) {\n        this.util = util;\n        this.versionLoader = versionLoader;\n    }\n\n    @Override\n    public Path resolveMainFilePath(Path path) throws URISyntaxException {\n\n        if (isDotFile(path)) {\n            Path mainPath = getMainPath(path);\n\n            VersionRecord currentMainRecord = versionLoader.loadRecord(path);\n            List<VersionRecord> versionRecords = versionLoader.loadVersionRecords(mainPath);\n\n            for (VersionRecord versionRecord : versionRecords) {\n                if (versionRecord.date().compareTo(currentMainRecord.date()) >= 0) {\n                    return util.getPath(mainPath,\n                                        versionRecord.id());\n                }\n            }\n\n            return mainPath;\n        } else {\n\n            return path;\n        }\n    }\n\n    private Path getMainPath(Path path) {\n        return path.resolveSibling(util.getFileName(path).substring(1));\n    }\n\n    public boolean isDotFile(Path path) {\n        return util.getFileName(path).startsWith(\".\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/version/VersionRecordServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Iterator;\nimport java.util.List;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.ext.editor.commons.version.impl.PortableVersionRecord;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.Path;\n\npublic class VersionRecordServiceImpl\n        implements VersionRecordService {\n\n    private IOService ioService;\n    private VersionUtil util;\n\n    public VersionRecordServiceImpl() {\n    }\n\n    @Inject\n    public VersionRecordServiceImpl(@Named(\"ioStrategy\") IOService ioService,\n                                    VersionUtil util) {\n        this.ioService = ioService;\n        this.util = util;\n    }\n\n    @Override\n    public List<VersionRecord> load(Path path) {\n\n        final List<VersionRecord> records = loadVersionRecords(path);\n\n        final List<VersionRecord> result = loadVersionRecords(util.getDotFilePath(path));\n\n        for (final VersionRecord record : records) {\n            if (doesNotContainID(record.id(),\n                                 result)) {\n                result.add(record);\n            }\n        }\n\n        Collections.sort(\n                result,\n                new VersionRecordComparator());\n\n        return result;\n    }\n\n    @Override\n    public List<VersionRecord> loadVersionRecords(Path path) {\n        if (ioService.exists(path)) {\n            ArrayList<VersionRecord> portableRecords = new ArrayList<VersionRecord>();\n            for (VersionRecord versionRecord : ioService.getFileAttributeView(path,\n                                                                              VersionAttributeView.class).readAttributes().history().records()) {\n                portableRecords.add(makePortable(versionRecord));\n            }\n            return portableRecords;\n        } else {\n            return new ArrayList<VersionRecord>();\n        }\n    }\n\n    private PortableVersionRecord makePortable(VersionRecord record) {\n        return new PortableVersionRecord(record.id(),\n                                         record.author(),\n                                         record.email(),\n                                         record.comment(),\n                                         record.date(),\n                                         record.uri());\n    }\n\n    private boolean doesNotContainID(String id,\n                                     List<VersionRecord> records) {\n        for (VersionRecord record : records) {\n            if (record.id().equals(id)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    @Override\n    public VersionRecord loadRecord(Path path) throws URISyntaxException {\n\n        for (VersionRecord record : loadVersionRecords(util.getPath(path,\n                                                                    \"master\"))) {\n            String version = util.getVersion(path);\n            if (\"master\".equals(version)) {\n                // Return first record when looking for master\n                return record;\n            } else if (record.id().equals(version)) {\n                return record;\n            }\n        }\n\n        return null;\n    }\n\n    private class VersionRecordComparator\n            implements Comparator<VersionRecord> {\n\n        @Override\n        public int compare(VersionRecord left,\n                           VersionRecord right) {\n            int compareTo = left.date().compareTo(right.date());\n\n            if (compareTo == 0) {\n                return compareUri(right.uri(),\n                                  left.uri());\n            } else {\n                return compareTo;\n            }\n        }\n\n        private int compareUri(String rightUri,\n                               String leftUri) {\n            Iterator<Character> right = getReversedIterator(rightUri);\n            Iterator<Character> left = getReversedIterator(leftUri);\n\n            while (left.hasNext() && right.hasNext()) {\n                Character l = left.next();\n                Character r = right.next();\n                if (l.equals('.') && !r.equals('.')) {\n                    return 1;\n                } else if (!l.equals('.') && r.equals('.')) {\n                    return -1;\n                }\n            }\n\n            return 0;\n        }\n\n        private Iterator<Character> getReversedIterator(String uri) {\n            List<Character> chars = new ArrayList<Character>();\n            for (char c : uri.toCharArray()) {\n                chars.add(c);\n            }\n            Collections.reverse(chars);\n            return chars.iterator();\n        }\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/version/VersionServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URI;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.uberfire.backend.server.util.Paths.convert;\nimport static org.uberfire.java.nio.file.StandardCopyOption.REPLACE_EXISTING;\n\n@Service\n@ApplicationScoped\npublic class VersionServiceImpl\n        implements VersionService {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    private SessionInfo sessionInfo;\n\n    @Inject\n    private VersionRecordService versionRecordService;\n\n    @Inject\n    private PathResolver pathResolver;\n\n    @Inject\n    private VersionUtil versionUtil;\n\n    @Override\n    public List<VersionRecord> getVersions(final Path path) {\n\n        try {\n            return versionRecordService.load(Paths.convert(path));\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Path getPathToPreviousVersion(String uri) {\n        return convert(ioService.get(URI.create(uri)));\n    }\n\n    @Override\n    public Path restore(final Path _path,\n                        final String comment,\n                        final String branchName) {\n        try {\n            ioService.startBatch(Paths.convert(_path).getFileSystem());\n\n            final org.uberfire.java.nio.file.Path path = pathResolver.resolveMainFilePath(convert(_path));\n            final org.uberfire.java.nio.file.Path target = versionUtil.getPath(path, branchName);\n\n            return convert(ioService.copy(path,\n                                          target,\n                                          REPLACE_EXISTING,\n                                          new CommentedOption(\n                                                  sessionInfo != null ? sessionInfo.getId() : \"--\",\n                                                  sessionInfo != null ? sessionInfo.getIdentity().getIdentifier() : \"system\",\n                                                  null,\n                                                  comment)));\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/java/org/uberfire/ext/editor/commons/backend/version/VersionUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.file.Path;\n\npublic class VersionUtil {\n\n    @Inject\n    private\n    @Named(\"ioStrategy\")\n    IOService ioService;\n\n    public Path getDotFilePath(Path path) {\n        return path.resolveSibling(\".\" + path.getFileName());\n    }\n\n    public String getVersion(Path path) {\n        if (path instanceof AbstractPath) {\n            String host = ((AbstractPath) path).getHost();\n            return host.substring(0,\n                                  host.indexOf(\"@\"));\n        } else {\n            return \"master\";\n        }\n    }\n\n    public Path getPath(Path path,\n                        String version) throws URISyntaxException {\n\n        String authority = path.toUri().getAuthority(); // master@uf-playground\n        authority = version + authority.substring(authority.indexOf(\"@\"));\n\n        String scheme = path.getFileSystem().provider().getScheme(); // git\n\n        String rawPath = path.toUri().getRawPath(); // projectname/org/something/file.txt\n\n        String uri = scheme + \"://\" + authority + rawPath;\n\n        return ioService.get(new URI(uri));\n    }\n\n    public String getFileName(Path path) {\n        return path.getFileName().toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/CopyServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.ext.editor.commons.backend.service.naming.PathNamingServiceImpl;\nimport org.uberfire.ext.editor.commons.backend.service.restriction.LockRestrictor;\nimport org.uberfire.ext.editor.commons.service.ValidationService;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\nimport org.uberfire.ext.editor.commons.service.restrictor.CopyRestrictor;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CopyServiceImplTest {\n\n    private static final String PATH_PREFIX = \"git://amend-repo-test/\";\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n    private final List<String> restrictedFileNames = new ArrayList<String>();\n    @Spy\n    private Event<ResourceCopiedEvent> resourceCopiedEvent = new EventSourceMock<>();\n    @Mock\n    private Instance<CopyRestrictor> copyRestrictorBeans;\n    @Mock\n    private User identity;\n    @Mock\n    private SessionInfo sessionInfo;\n    @Mock\n    private VFSLockService lockService;\n    @Mock\n    private ValidationService validationService;\n    @Spy\n    private PathNamingServiceImpl pathNamingService = new PathNamingServiceImpl();\n    private CopyServiceImpl copyService;\n    @Spy\n    @InjectMocks\n    private LockRestrictor lockRestrictor;\n\n    @Before\n    public void setup() throws IOException {\n        fileSystemTestingUtils.setup();\n\n        this.copyService = spy(new CopyServiceImpl(fileSystemTestingUtils.getIoService(),\n                                                   identity,\n                                                   sessionInfo,\n                                                   null,\n                                                   resourceCopiedEvent,\n                                                   copyRestrictorBeans,\n                                                   pathNamingService));\n\n        when(identity.getIdentifier()).thenReturn(\"user\");\n\n        doReturn(Collections.EMPTY_LIST).when(pathNamingService).getResourceTypeDefinitions();\n\n        mockCopyRestrictors();\n\n        doNothing().when(resourceCopiedEvent).fire(any(ResourceCopiedEvent.class));\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void copyRestrictedPathTest() {\n        final Path path = createFile(\"restricted-file.txt\");\n\n        givenThatPathIsRestricted(path);\n\n        try {\n            whenPathIsCopied(path);\n        } catch (RuntimeException e) {\n            thenPathWasNotCopied(path,\n                                 e);\n        }\n\n        thenPathWasNotCopied(path);\n    }\n\n    @Test\n    public void copyUnrestrictedPathTest() {\n        final Path path = createFile();\n\n        givenThatPathIsUnrestricted(path);\n        whenPathIsCopied(path);\n        thenPathWasCopied(path);\n    }\n\n    @Test\n    public void copyRestrictedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(createFile(\"file0.txt\"));\n        paths.add(createFile(\"file1.txt\"));\n        paths.add(createFile(\"file2.txt\"));\n\n        givenThatPathIsUnrestricted(paths.get(0));\n        givenThatPathIsRestricted(paths.get(1));\n        givenThatPathIsUnrestricted(paths.get(2));\n\n        try {\n            whenPathsAreCopiedIfExists(paths);\n        } catch (RuntimeException e) {\n            thenPathWasNotCopiedIfExists(paths.get(1),\n                                         e);\n        }\n\n        thenPathWasCopiedIfExists(paths.get(0));\n        thenPathWasNotCopiedIfExists(paths.get(1));\n\n        // This will not be copied because the process stops when some exception is raised.\n        thenPathWasNotCopiedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void copyUnrestrictedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(createFile(\"dir1/file1.txt\"));\n        paths.add(createFile(\"dir2/file2.txt\"));\n        paths.add(createFile(\"dir3/file3.txt\"));\n\n        givenThatPathIsUnrestricted(paths.get(0));\n        givenThatPathIsUnrestricted(paths.get(1));\n        givenThatPathIsUnrestricted(paths.get(2));\n\n        whenPathsAreCopiedIfExists(paths);\n\n        thenPathWasCopiedIfExists(paths.get(0));\n        thenPathWasCopiedIfExists(paths.get(1));\n        thenPathWasCopiedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void pathHasNoCopyRestrictionTest() {\n        final Path path = createFile();\n\n        givenThatPathIsUnrestricted(path);\n        boolean hasRestriction = whenPathIsCheckedForCopyRestrictions(path);\n        thenPathHasNoCopyRestrictions(hasRestriction);\n    }\n\n    @Test\n    public void pathHasCopyRestrictionTest() {\n        final Path path = createFile();\n\n        givenThatPathIsRestricted(path);\n        boolean hasRestriction = whenPathIsCheckedForCopyRestrictions(path);\n        thenPathHasCopyRestrictions(hasRestriction);\n    }\n\n    @Test\n    public void copyFileToAnotherDirectory() {\n        final Path path = createFile();\n        final String newName = \"new-name\";\n        final Path targetDirectory = getAnotherDirectory();\n\n        givenThatPathIsUnrestricted(path);\n        whenPathIsCopiedToAnotherDirectory(path,\n                                           newName,\n                                           targetDirectory);\n        thenPathWasCopiedToAnotherDirectory(path,\n                                            newName,\n                                            targetDirectory);\n    }\n\n    @Test\n    public void copyFileToNullDirectory() {\n        final Path path = createFile();\n        final String newName = \"new-name\";\n\n        givenThatPathIsUnrestricted(path);\n        whenPathIsCopiedToAnotherDirectory(path,\n                                           newName,\n                                           null);\n        thenPathWasCopiedToSameDirectory(path,\n                                         newName);\n    }\n\n    private void givenThatPathIsRestricted(final Path path) {\n        restrictedFileNames.add(path.getFileName());\n    }\n\n    private void givenThatPathIsUnrestricted(final Path path) {\n        restrictedFileNames.remove(path.getFileName());\n    }\n\n    private void whenPathIsCopied(final Path path) {\n        copyService.copy(path,\n                         \"newName\",\n                         \"comment\");\n    }\n\n    private void whenPathIsCopiedToAnotherDirectory(final Path path,\n                                                    final String newName,\n                                                    final Path targetDirectory) {\n        copyService.copy(path,\n                         newName,\n                         targetDirectory,\n                         \"comment\");\n    }\n\n    private void whenPathsAreCopiedIfExists(final Collection<Path> paths) {\n        copyService.copyIfExists(paths,\n                                 \"newName\",\n                                 \"comment\");\n    }\n\n    private boolean whenPathIsCheckedForCopyRestrictions(final Path path) {\n        return copyService.hasRestriction(path);\n    }\n\n    private void thenPathWasCopied(final Path path) {\n        verify(copyService).copyPath(eq(path),\n                                     any(String.class),\n                                     any(Path.class),\n                                     any(String.class));\n        verify(resourceCopiedEvent).fire(any(ResourceCopiedEvent.class));\n    }\n\n    private void thenPathWasCopiedToAnotherDirectory(final Path path,\n                                                     final String newName,\n                                                     final Path targetDirectory) {\n        Path targetPath = Paths.convert(Paths.convert(targetDirectory).resolve(newName + \".txt\"));\n        verify(copyService).copyPath(eq(path),\n                                     any(String.class),\n                                     eq(targetPath),\n                                     any(String.class));\n    }\n\n    private void thenPathWasCopiedToSameDirectory(final Path path,\n                                                  final String newName) {\n        Path targetPath = Paths.convert(Paths.convert(path).getParent().resolve(newName + \".txt\"));\n        verify(copyService).copyPath(eq(path),\n                                     any(String.class),\n                                     eq(targetPath),\n                                     any(String.class));\n    }\n\n    private void thenPathWasNotCopied(final Path path) {\n        verify(copyService,\n               never()).copyPath(eq(path),\n                                 any(String.class),\n                                 any(Path.class),\n                                 any(String.class));\n    }\n\n    private void thenPathWasNotCopied(final Path path,\n                                      final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be copied.\",\n                     e.getMessage());\n    }\n\n    private void thenPathWasCopiedIfExists(final Path path) {\n        verify(copyService).copyPathIfExists(eq(path),\n                                             any(String.class),\n                                             any(String.class));\n    }\n\n    private void thenPathWasNotCopiedIfExists(final Path path) {\n        verify(copyService,\n               never()).copyPathIfExists(eq(path),\n                                         any(String.class),\n                                         any(String.class));\n    }\n\n    private void thenPathWasNotCopiedIfExists(final Path path,\n                                              final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be copied.\",\n                     e.getMessage());\n    }\n\n    private void thenPathHasNoCopyRestrictions(final boolean hasRestriction) {\n        assertFalse(hasRestriction);\n    }\n\n    private void thenPathHasCopyRestrictions(final boolean hasRestriction) {\n        assertTrue(hasRestriction);\n    }\n\n    private Path createFile() {\n        return createFile(\"file.txt\");\n    }\n\n    private Path createFile(String fileName) {\n        final Path path = PathFactory.newPath(fileName,\n                                              PATH_PREFIX + \"parent/\" + fileName);\n        fileSystemTestingUtils.getIoService().write(Paths.convert(path),\n                                                    \"content\");\n        return path;\n    }\n\n    private Path getAnotherDirectory() {\n        return PathFactory.newPath(\"/\",\n                                   PATH_PREFIX + \"new-parent/\");\n    }\n\n    private void mockCopyRestrictors() {\n        List<CopyRestrictor> copyRestrictors = new ArrayList<CopyRestrictor>();\n        copyRestrictors.add(new CopyRestrictor() {\n            @Override\n            public PathOperationRestriction hasRestriction(final Path path) {\n                if (restrictedFileNames.contains(path.getFileName())) {\n                    return new PathOperationRestriction() {\n                        @Override\n                        public String getMessage(final Path path) {\n                            return path.toURI() + \" cannot be copied.\";\n                        }\n                    };\n                }\n\n                return null;\n            }\n        });\n        when(copyService.getCopyRestrictors()).thenReturn(copyRestrictors);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/DeleteServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.ext.editor.commons.backend.service.helper.DeleteHelper;\nimport org.uberfire.ext.editor.commons.backend.service.restriction.LockRestrictor;\nimport org.uberfire.ext.editor.commons.service.ValidationService;\nimport org.uberfire.ext.editor.commons.service.restrictor.DeleteRestrictor;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DeleteServiceImplTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private VFSLockService lockService;\n\n    @Mock\n    private ValidationService validationService;\n\n    @Spy\n    @InjectMocks\n    private DeleteServiceImpl deleteService;\n\n    @Spy\n    @InjectMocks\n    private LockRestrictor lockRestrictor;\n\n    @Mock\n    private DeleteHelper deleteHelper;\n\n    @Before\n    public void setup() {\n        when(identity.getIdentifier()).thenReturn(\"user\");\n\n        List<DeleteRestrictor> deleteRestrictors = new ArrayList<>();\n        deleteRestrictors.add(lockRestrictor);\n        when(deleteService.getDeleteRestrictors()).thenReturn(deleteRestrictors);\n\n        List<DeleteHelper> deleteHelpers = new ArrayList<>();\n        deleteHelpers.add(deleteHelper);\n        when(deleteService.getDeleteHelpers()).thenReturn(deleteHelpers);\n        when(deleteHelper.supports(any(Path.class))).thenReturn(true);\n    }\n\n    @Test\n    public void deleteLockedPathTest() {\n        final Path path = getPath();\n\n        givenThatPathIsLocked(path);\n\n        try {\n            whenPathIsDeleted(path);\n        } catch (RuntimeException e) {\n            thenPathWasNotDeleted(path,\n                                  e);\n        }\n\n        thenPathWasNotDeleted(path);\n    }\n\n    @Test\n    public void deleteUnlockedPathTest() {\n        final Path path = getPath();\n\n        givenThatPathIsUnlocked(path);\n        whenPathIsDeleted(path);\n        thenPathWasDeleted(path);\n    }\n\n    @Test\n    public void deleteLockedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(getPath(\"file0.txt\"));\n        paths.add(getPath(\"file1.txt\"));\n        paths.add(getPath(\"file2.txt\"));\n\n        givenThatPathIsUnlocked(paths.get(0));\n        givenThatPathIsLocked(paths.get(1));\n        givenThatPathIsUnlocked(paths.get(2));\n\n        try {\n            whenPathsAreDeletedIfExists(paths);\n        } catch (RuntimeException e) {\n            thenPathWasNotDeletedIfExists(paths.get(1),\n                                          e);\n        }\n\n        thenPathWasDeletedIfExists(paths.get(0));\n        thenPathWasNotDeletedIfExists(paths.get(1));\n\n        // This will not be deleted because the process stops when some exception is raised.\n        thenPathWasNotDeletedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void deleteUnlockedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(getPath(\"file0.txt\"));\n        paths.add(getPath(\"file1.txt\"));\n        paths.add(getPath(\"file2.txt\"));\n\n        givenThatPathIsUnlocked(paths.get(0));\n        givenThatPathIsUnlocked(paths.get(1));\n        givenThatPathIsUnlocked(paths.get(2));\n\n        whenPathsAreDeletedIfExists(paths);\n\n        thenPathWasDeletedIfExists(paths.get(0));\n        thenPathWasDeletedIfExists(paths.get(1));\n        thenPathWasDeletedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void pathHasNoDeleteRestrictionTest() {\n        final Path path = getPath();\n\n        givenThatPathIsUnlocked(path);\n        boolean hasRestriction = whenPathIsCheckedForDeleteRestrictions(path);\n        thenPathHasNoDeleteRestrictions(hasRestriction);\n    }\n\n    @Test\n    public void pathHasDeleteRestrictionTest() {\n        final Path path = getPath();\n\n        givenThatPathIsLocked(path);\n        boolean hasRestriction = whenPathIsCheckedForDeleteRestrictions(path);\n        thenPathHasDeleteRestrictions(hasRestriction);\n    }\n\n    @Test\n    public void deletePathInvokesDeleteHelpers() {\n        final Path path = getPath();\n\n        whenPathIsDeleted(path);\n\n        thenIOServiceBatchStarted();\n        thenDeleteHelperWasInvoked(path);\n        thenIOServiceBatchEnded();\n    }\n\n    @Test\n    public void deletePathsIfExistsInvokesDeleteHelpers() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(getPath(\"file0.txt\"));\n        paths.add(getPath(\"file1.txt\"));\n        paths.add(getPath(\"file2.txt\"));\n\n        whenPathsAreDeletedIfExists(paths);\n\n        thenIOServiceBatchStarted();\n        thenDeleteHelperWasInvoked(paths.get(0));\n        thenDeleteHelperWasInvoked(paths.get(1));\n        thenDeleteHelperWasInvoked(paths.get(2));\n        thenIOServiceBatchEnded();\n    }\n\n    @Test\n    public void deletePathInvokesDeleteHelpersInCorrectOrder() {\n        final Path path = getPath();\n\n        final InOrder order = inOrder(ioService,\n                                      deleteHelper,\n                                      ioService,\n                                      ioService);\n\n        whenPathIsDeleted(path);\n\n        order.verify(ioService).startBatch(any(FileSystem.class));\n        order.verify(deleteHelper).postProcess(eq(path));\n        order.verify(ioService).delete(any(org.uberfire.java.nio.file.Path.class),\n                                       any(CommentedOption.class));\n        order.verify(ioService).endBatch();\n    }\n\n    private void givenThatPathIsLocked(final Path path) {\n        changeLockInfo(path,\n                       true);\n    }\n\n    private void givenThatPathIsUnlocked(final Path path) {\n        changeLockInfo(path,\n                       false);\n    }\n\n    private void whenPathIsDeleted(final Path path) {\n        deleteService.delete(path,\n                             \"comment\");\n    }\n\n    private void whenPathsAreDeletedIfExists(final Collection<Path> paths) {\n        deleteService.deleteIfExists(paths,\n                                     \"comment\");\n    }\n\n    private boolean whenPathIsCheckedForDeleteRestrictions(final Path path) {\n        return deleteService.hasRestriction(path);\n    }\n\n    private void thenPathWasDeleted(final Path path) {\n        verify(deleteService).deletePath(eq(path),\n                                         any(String.class));\n    }\n\n    private void thenPathWasNotDeleted(final Path path) {\n        verify(deleteService,\n               never()).deletePath(eq(path),\n                                   any(String.class));\n    }\n\n    private void thenPathWasNotDeleted(final Path path,\n                                       final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be deleted, moved or renamed. It is locked by: lockedBy\",\n                     e.getMessage());\n    }\n\n    private void thenPathWasDeletedIfExists(final Path path) {\n        verify(deleteService).deletePathIfExists(eq(path),\n                                                 any(String.class));\n    }\n\n    private void thenPathWasNotDeletedIfExists(final Path path) {\n        verify(deleteService,\n               never()).deletePathIfExists(eq(path),\n                                           any(String.class));\n    }\n\n    private void thenPathWasNotDeletedIfExists(final Path path,\n                                               final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be deleted, moved or renamed. It is locked by: lockedBy\",\n                     e.getMessage());\n    }\n\n    private void thenPathHasNoDeleteRestrictions(final boolean hasRestriction) {\n        assertFalse(hasRestriction);\n    }\n\n    private void thenPathHasDeleteRestrictions(final boolean hasRestriction) {\n        assertTrue(hasRestriction);\n    }\n\n    private void thenIOServiceBatchStarted() {\n        verify(ioService).startBatch(any(FileSystem.class));\n    }\n\n    private void thenIOServiceBatchEnded() {\n        verify(ioService).endBatch();\n    }\n\n    private void thenDeleteHelperWasInvoked(final Path path) {\n        verify(deleteHelper).postProcess(eq(path));\n    }\n\n    private Path getPath() {\n        return getPath(\"file.txt\");\n    }\n\n    private Path getPath(String fileName) {\n        return PathFactory.newPath(fileName,\n                                   \"file://tmp/\" + fileName);\n    }\n\n    private void changeLockInfo(Path path,\n                                boolean locked) {\n        when(lockService.retrieveLockInfo(path)).thenReturn(new LockInfo(locked,\n                                                                         \"lockedBy\",\n                                                                         path));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/RenameServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.ArgumentMatchers;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.ext.editor.commons.backend.service.restriction.LockRestrictor;\nimport org.uberfire.ext.editor.commons.service.ValidationService;\nimport org.uberfire.ext.editor.commons.service.restrictor.RenameRestrictor;\nimport org.uberfire.io.IOService;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RenameServiceImplTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private VFSLockService lockService;\n\n    @Mock\n    private ValidationService validationService;\n\n    @Spy\n    @InjectMocks\n    private RenameServiceImpl renameService;\n\n    @Spy\n    @InjectMocks\n    private LockRestrictor lockRestrictor;\n\n    @Before\n    public void setup() throws Exception {\n        when(identity.getIdentifier()).thenReturn(\"user\");\n\n        doReturn(getPath()).when(renameService).renamePath(any(Path.class),\n                                                           any(String.class),\n                                                           any(String.class));\n        doNothing().when(renameService).renamePathIfExists(any(Path.class),\n                                                           any(String.class),\n                                                           any(String.class));\n        doNothing().when(renameService).startBatch(ArgumentMatchers.<Collection<Path>>any());\n        doNothing().when(renameService).endBatch();\n\n        List<RenameRestrictor> renameRestrictors = new ArrayList<RenameRestrictor>();\n        renameRestrictors.add(lockRestrictor);\n        when(renameService.getRenameRestrictors()).thenReturn(renameRestrictors);\n    }\n\n    @Test\n    public void renameLockedPathTest() {\n        final Path path = getPath();\n\n        givenThatPathIsLocked(path);\n\n        try {\n            whenPathIsRenamed(path);\n        } catch (RuntimeException e) {\n            thenPathWasNotRenamed(path,\n                                  e);\n        }\n\n        thenPathWasNotRenamed(path);\n    }\n\n    @Test\n    public void renameUnlockedPathTest() {\n        final Path path = getPath();\n\n        givenThatPathIsUnlocked(path);\n        whenPathIsRenamed(path);\n        thenPathWasRenamed(path);\n    }\n\n    @Test\n    public void renameLockedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(getPath(\"file0.txt\"));\n        paths.add(getPath(\"file1.txt\"));\n        paths.add(getPath(\"file2.txt\"));\n\n        givenThatPathIsUnlocked(paths.get(0));\n        givenThatPathIsLocked(paths.get(1));\n        givenThatPathIsUnlocked(paths.get(2));\n\n        try {\n            whenPathsAreRenamedIfExists(paths);\n        } catch (RuntimeException e) {\n            thenPathWasNotRenamedIfExists(paths.get(1),\n                                          e);\n        }\n\n        thenPathWasRenamedIfExists(paths.get(0));\n        thenPathWasNotRenamedIfExists(paths.get(1));\n\n        // This will not be renamed because the process stops when some exception is raised.\n        thenPathWasNotRenamedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void renameUnlockedPathIfExistsTest() {\n        final List<Path> paths = new ArrayList<Path>();\n        paths.add(getPath(\"file0.txt\"));\n        paths.add(getPath(\"file1.txt\"));\n        paths.add(getPath(\"file2.txt\"));\n\n        givenThatPathIsUnlocked(paths.get(0));\n        givenThatPathIsUnlocked(paths.get(1));\n        givenThatPathIsUnlocked(paths.get(2));\n\n        whenPathsAreRenamedIfExists(paths);\n\n        thenPathWasRenamedIfExists(paths.get(0));\n        thenPathWasRenamedIfExists(paths.get(1));\n        thenPathWasRenamedIfExists(paths.get(2));\n    }\n\n    @Test\n    public void pathHasNoRenameRestrictionTest() {\n        final Path path = getPath();\n\n        givenThatPathIsUnlocked(path);\n        boolean hasRestriction = whenPathIsCheckedForRenameRestrictions(path);\n        thenPathHasNoRenameRestrictions(hasRestriction);\n    }\n\n    @Test\n    public void pathHasRenameRestrictionTest() {\n        final Path path = getPath();\n\n        givenThatPathIsLocked(path);\n        boolean hasRestriction = whenPathIsCheckedForRenameRestrictions(path);\n        thenPathHasRenameRestrictions(hasRestriction);\n    }\n\n    private void givenThatPathIsLocked(final Path path) {\n        changeLockInfo(path,\n                       true);\n    }\n\n    private void givenThatPathIsUnlocked(final Path path) {\n        changeLockInfo(path,\n                       false);\n    }\n\n    private void whenPathIsRenamed(final Path path) {\n        renameService.rename(path,\n                             \"newname\",\n                             \"comment\");\n    }\n\n    private void whenPathsAreRenamedIfExists(final Collection<Path> paths) {\n        renameService.renameIfExists(paths,\n                                     \"newname\",\n                                     \"comment\");\n    }\n\n    private boolean whenPathIsCheckedForRenameRestrictions(final Path path) {\n        return renameService.hasRestriction(path);\n    }\n\n    private void thenPathWasRenamed(final Path path) {\n        verify(renameService).renamePath(eq(path),\n                                         any(String.class),\n                                         any(String.class));\n    }\n\n    private void thenPathWasNotRenamed(final Path path) {\n        verify(renameService,\n               never()).renamePath(eq(path),\n                                   any(String.class),\n                                   any(String.class));\n    }\n\n    private void thenPathWasNotRenamed(final Path path,\n                                       final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be deleted, moved or renamed. It is locked by: lockedBy\",\n                     e.getMessage());\n    }\n\n    private void thenPathWasRenamedIfExists(final Path path) {\n        verify(renameService).renamePathIfExists(eq(path),\n                                                 any(String.class),\n                                                 any(String.class));\n    }\n\n    private void thenPathWasNotRenamedIfExists(final Path path) {\n        verify(renameService,\n               never()).renamePathIfExists(eq(path),\n                                           any(String.class),\n                                           any(String.class));\n    }\n\n    private void thenPathWasNotRenamedIfExists(final Path path,\n                                               final RuntimeException e) {\n        assertEquals(path.toURI() + \" cannot be deleted, moved or renamed. It is locked by: lockedBy\",\n                     e.getMessage());\n    }\n\n    private void thenPathHasNoRenameRestrictions(final boolean hasRestriction) {\n        assertFalse(hasRestriction);\n    }\n\n    private void thenPathHasRenameRestrictions(final boolean hasRestriction) {\n        assertTrue(hasRestriction);\n    }\n\n    private Path getPath() {\n        return getPath(\"file.txt\");\n    }\n\n    private Path getPath(String fileName) {\n        return PathFactory.newPath(fileName,\n                                   \"file://tmp/\" + fileName);\n    }\n\n    private void changeLockInfo(Path path,\n                                boolean locked) {\n        when(lockService.retrieveLockInfo(path)).thenReturn(new LockInfo(locked,\n                                                                         \"lockedBy\",\n                                                                         path));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/SaveAndRenameServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SaveAndRenameServiceImplTest {\n\n    @Mock\n    private SupportsSaveAndRename<String, DefaultMetadata> supportsSaveAndRename;\n\n    private SaveAndRenameServiceImpl<String, DefaultMetadata> service;\n\n    @Before\n    public void setup() throws Exception {\n        service = spy(new SaveAndRenameServiceImpl<String, DefaultMetadata>() {{\n            init(supportsSaveAndRename);\n        }});\n    }\n\n    @Test\n    public void testRename() throws Exception {\n\n        final Path path = mock(Path.class);\n        final String newFileName = \"newFileName\";\n        final String comment = \"comment\";\n\n        service.rename(path, newFileName, comment);\n\n        verify(supportsSaveAndRename).rename(path, newFileName, comment);\n    }\n\n    @Test\n    public void testSave() throws Exception {\n\n        final Path path = mock(Path.class);\n        final String content = \"content\";\n        final DefaultMetadata metadata = mock(DefaultMetadata.class);\n        final String comment = \"comment\";\n\n        service.save(path, content, metadata, comment);\n\n        verify(supportsSaveAndRename).save(path, content, metadata, comment);\n    }\n\n    @Test\n    public void testSaveAndRename() throws Exception {\n\n        final Path path = mock(Path.class);\n        final String newFileName = \"newFileName\";\n        final DefaultMetadata metadata = mock(DefaultMetadata.class);\n        final String content = \"content\";\n        final String comment = \"comment\";\n\n        doReturn(path).when(service).save(path, content, metadata, comment);\n\n        service.saveAndRename(path, newFileName, metadata, content, comment);\n\n        verify(service).save(path, content, metadata, comment);\n        verify(service).rename(path, newFileName, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/htmleditor/HtmlEditorServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.htmleditor;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.CopyService;\nimport org.uberfire.ext.editor.commons.service.DeleteService;\nimport org.uberfire.ext.editor.commons.service.RenameService;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HtmlEditorServiceImplTest {\n\n    @Mock\n    private VFSService vfsServices;\n\n    @Mock\n    private DeleteService deleteService;\n\n    @Mock\n    private RenameService renameService;\n\n    @Mock\n    private CopyService copyService;\n\n    @Mock\n    private SaveAndRenameServiceImpl<String, DefaultMetadata> saveAndRenameService;\n\n    @Mock\n    private Path path;\n\n    @Mock\n    private DefaultMetadata metadata;\n\n    private String content = \"content\";\n\n    private String comment = \"comment\";\n\n    private String newFileName = \"newFileName\";\n\n    @Spy\n    @InjectMocks\n    private HtmlEditorServiceImpl htmlEditorService;\n\n    @Test\n    public void testInit() throws Exception {\n\n        htmlEditorService.init();\n\n        verify(saveAndRenameService).init(htmlEditorService);\n    }\n\n    @Test\n    public void testDelete() throws Exception {\n\n        htmlEditorService.delete(path, comment);\n\n        verify(deleteService).delete(path, comment);\n    }\n\n    @Test\n    public void testRename() throws Exception {\n\n        final Path expectedPath = mock(Path.class);\n        doReturn(expectedPath).when(renameService).rename(path, newFileName, comment);\n\n        final Path actualPath = htmlEditorService.rename(path, newFileName, comment);\n\n        verify(renameService).rename(path, newFileName, comment);\n        assertEquals(expectedPath, actualPath);\n    }\n\n    @Test\n    public void testSave() throws Exception {\n\n        final Path expectedPath = mock(Path.class);\n        doReturn(expectedPath).when(vfsServices).write(path, content);\n\n        final Path actualPath = htmlEditorService.save(path, content, metadata, comment);\n\n        verify(vfsServices).write(path, content);\n        assertEquals(expectedPath, actualPath);\n    }\n\n    @Test\n    public void testCopyWithoutTargetDirectory() throws Exception {\n\n        final Path expectedPath = mock(Path.class);\n        doReturn(expectedPath).when(copyService).copy(path, newFileName, comment);\n\n        final Path actualPath = htmlEditorService.copy(path, newFileName, comment);\n\n        verify(copyService).copy(path, newFileName, comment);\n        assertEquals(expectedPath, actualPath);\n    }\n\n    @Test\n    public void testCopyWithTargetDirectory() throws Exception {\n\n        final Path targetDirectory = mock(Path.class);\n        final Path expectedPath = mock(Path.class);\n\n        doReturn(expectedPath).when(copyService).copy(path, newFileName, targetDirectory, comment);\n\n        final Path actualPath = htmlEditorService.copy(path, newFileName, targetDirectory, comment);\n\n        verify(copyService).copy(path, newFileName, targetDirectory, comment);\n        assertEquals(expectedPath, actualPath);\n    }\n\n    @Test\n    public void testLoad() throws Exception {\n\n        final String expectedString = \"string\";\n\n        doReturn(expectedString).when(vfsServices).readAllString(path);\n\n        final String actualString = htmlEditorService.load(path);\n\n        verify(vfsServices).readAllString(path);\n        assertEquals(expectedString, actualString);\n    }\n\n    @Test\n    public void testSaveAndRename() throws Exception {\n\n        final Path expectedPath = mock(Path.class);\n        doReturn(expectedPath).when(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);\n\n        final Path actualPath = htmlEditorService.saveAndRename(path, newFileName, metadata, content, comment);\n\n        verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);\n        assertEquals(expectedPath, actualPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/naming/PathNamingServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.naming;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.ext.editor.commons.service.PathNamingService;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport static org.junit.Assert.*;\n\npublic class PathNamingServiceImplTest {\n\n    private static final String PATH_PREFIX = \"git://amend-repo-test/\";\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    private PathNamingService pathNamingService;\n\n    private Collection<ResourceTypeDefinition> resourceTypeDefinitions;\n\n    @Before\n    public void setup() throws IOException {\n        fileSystemTestingUtils.setup();\n        resourceTypeDefinitions = createResourceTypeDefinitions();\n        pathNamingService = createPathNamingService();\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void buildTargetPathForFolderInTheSameDirectoryTest() {\n        assertEquals(\"newFolderName\",\n                     targetFolderName(\"originalFolderName\",\n                                      \"newFolderName\"));\n        assertEquals(\"newFolderName\",\n                     targetFolderName(\"original.folder.name\",\n                                      \"newFolderName\"));\n        assertEquals(\"newFolderName\",\n                     targetFolderName(\"originalFolder.name\",\n                                      \"newFolderName\"));\n        assertEquals(\"new.folder.name\",\n                     targetFolderName(\"originalFolderName\",\n                                      \"new.folder.name\"));\n        assertEquals(\"new.folder.name\",\n                     targetFolderName(\"original.folder.name\",\n                                      \"new.folder.name\"));\n        assertEquals(\"new.folder.name\",\n                     targetFolderName(\"originalFolder.name\",\n                                      \"new.folder.name\"));\n        assertEquals(\"newFolder.name\",\n                     targetFolderName(\"originalFolderName\",\n                                      \"newFolder.name\"));\n        assertEquals(\"newFolder.name\",\n                     targetFolderName(\"original.folder.name\",\n                                      \"newFolder.name\"));\n        assertEquals(\"newFolder.name\",\n                     targetFolderName(\"originalFolder.name\",\n                                      \"newFolder.name\"));\n    }\n\n    @Test\n    public void buildTargetPathForFileInTheSameDirectoryTest() {\n        assertEquals(\"newFileName\",\n                     targetFileName(\"originalFileName\",\n                                    \"newFileName\"));\n        assertEquals(\"newFileName.extension2\",\n                     targetFileName(\"originalFileName.extension1.extension2\",\n                                    \"newFileName\"));\n        assertEquals(\"newFileName.extension\",\n                     targetFileName(\"originalFileName.extension\",\n                                    \"newFileName\"));\n        assertEquals(\"newFileName.extension1.extension2\",\n                     targetFileName(\"originalFileName\",\n                                    \"newFileName.extension1.extension2\"));\n        assertEquals(\"newFileName.extension1.extension2.extension2\",\n                     targetFileName(\"originalFileName.extension1.extension2\",\n                                    \"newFileName.extension1.extension2\"));\n        assertEquals(\"newFileName.extension1.extension2.extension\",\n                     targetFileName(\"originalFileName.extension\",\n                                    \"newFileName.extension1.extension2\"));\n        assertEquals(\"newFileName.extension\",\n                     targetFileName(\"originalFileName\",\n                                    \"newFileName.extension\"));\n        assertEquals(\"newFileName.extension.extension2\",\n                     targetFileName(\"originalFileName.extension1.extension2\",\n                                    \"newFileName.extension\"));\n        assertEquals(\"newFileName.extension.extension\",\n                     targetFileName(\"originalFileName.extension\",\n                                    \"newFileName.extension\"));\n    }\n\n    @Test\n    public void buildTargetPathForResourceTypeFileInTheSameDirectoryTest() {\n        assertEquals(\"newFileName.resource\",\n                     targetFileName(\"originalFileName.resource\",\n                                    \"newFileName\"));\n        assertEquals(\"newFileName.resource.xml\",\n                     targetFileName(\"originalFileName.resource.xml\",\n                                    \"newFileName\"));\n        assertEquals(\"newFileName.resource.xml.txt\",\n                     targetFileName(\"originalFileName.resource.xml.txt\",\n                                    \"newFileName\"));\n    }\n\n    @Test\n    public void buildTargetPathForFolderInAnotherDirectoryTest() {\n        Path originalPath = createFolder(\"parent/folder\");\n        Path targetParentDirectory = createFolder(\"new-parent\");\n        String targetFileName = \"new-folder\";\n\n        Path targetPath = pathNamingService.buildTargetPath(originalPath,\n                                                            targetParentDirectory,\n                                                            targetFileName);\n\n        assertEquals(targetParentDirectory.toURI() + \"/\" + targetFileName,\n                     targetPath.toURI());\n    }\n\n    @Test\n    public void buildTargetPathForFileInAnotherDirectoryTest() {\n        String extension = \".txt\";\n\n        Path originalPath = createFile(\"parent/file\" + extension);\n        Path targetParentDirectory = createFolder(\"new-parent\");\n        String targetFileName = \"new-file\";\n\n        Path targetPath = pathNamingService.buildTargetPath(originalPath,\n                                                            targetParentDirectory,\n                                                            targetFileName);\n\n        assertEquals(targetParentDirectory.toURI() + \"/\" + targetFileName + extension,\n                     targetPath.toURI());\n    }\n\n    @Test\n    public void buildTargetPathForResourceTypeFileInAnotherDirectoryTest() {\n        String extension = \".resource.xml.txt\";\n\n        Path originalPath = createFile(\"parent/resource-file\" + extension);\n        Path targetParentDirectory = createFolder(\"new-parent\");\n        String targetFileName = \"new-resource-file\";\n\n        Path targetPath = pathNamingService.buildTargetPath(originalPath,\n                                                            targetParentDirectory,\n                                                            targetFileName);\n\n        assertEquals(targetParentDirectory.toURI() + \"/\" + targetFileName + extension,\n                     targetPath.toURI());\n    }\n\n    private Path createFolder(final String folderName) {\n        return Paths.convert(Paths.convert(PathFactory.newPath(\"file\",\n                                                               PATH_PREFIX + folderName + \"/file\")).getParent());\n    }\n\n    private Path createFile(final String fileName) {\n        return PathFactory.newPath(fileName,\n                                   PATH_PREFIX + fileName);\n    }\n\n    private String targetFolderName(final String originalFolderName,\n                                    final String newFolderName) {\n        final Path path = PathFactory.newPath(\"file\",\n                                              PATH_PREFIX + originalFolderName + \"/file\");\n        fileSystemTestingUtils.getIoService().write(Paths.convert(path),\n                                                    \"content\");\n        return pathNamingService.buildTargetPath(Paths.convert(Paths.convert(path).getParent()),\n                                                 newFolderName).getFileName();\n    }\n\n    private String targetFileName(final String originalFileName,\n                                  final String newFileName) {\n        final Path path = PathFactory.newPath(originalFileName,\n                                              PATH_PREFIX + originalFileName);\n        fileSystemTestingUtils.getIoService().write(Paths.convert(path),\n                                                    \"content\");\n        return pathNamingService.buildTargetPath(path,\n                                                 newFileName).getFileName();\n    }\n\n    private PathNamingService createPathNamingService() {\n        return new PathNamingServiceImpl() {\n\n            @Override\n            public Iterable<ResourceTypeDefinition> getResourceTypeDefinitions() {\n                return resourceTypeDefinitions;\n            }\n        };\n    }\n\n    private Collection<ResourceTypeDefinition> createResourceTypeDefinitions() {\n        List<ResourceTypeDefinition> resourceTypeDefinitions = new ArrayList<>();\n\n        resourceTypeDefinitions.add(createResourceTypeDefinition(\"resource\"));\n        resourceTypeDefinitions.add(createResourceTypeDefinition(\"resource.xml\"));\n        resourceTypeDefinitions.add(createResourceTypeDefinition(\"resource.xml.txt\"));\n\n        return resourceTypeDefinitions;\n    }\n\n    private ResourceTypeDefinition createResourceTypeDefinition(String suffix) {\n        return new ResourceTypeDefinition() {\n            @Override\n            public String getShortName() {\n                return null;\n            }\n\n            @Override\n            public String getDescription() {\n                return null;\n            }\n\n            @Override\n            public String getPrefix() {\n                return null;\n            }\n\n            @Override\n            public String getSuffix() {\n                return suffix;\n            }\n\n            @Override\n            public int getPriority() {\n                return 0;\n            }\n\n            @Override\n            public String getSimpleWildcardPattern() {\n                return null;\n            }\n\n            @Override\n            public boolean accept(final org.uberfire.backend.vfs.Path path) {\n                return false;\n            }\n\n            @Override\n            public Category getCategory() {\n                return new Others();\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/service/restriction/LockRestrictorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.backend.service.restriction;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.ext.editor.commons.service.restriction.PathOperationRestriction;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LockRestrictorTest {\n\n    @Mock\n    private VFSLockService lockService;\n\n    @Mock\n    private User identity;\n\n    @InjectMocks\n    private LockRestrictor lockRestrictor;\n\n    @Mock\n    private Path path;\n\n    @Mock\n    private PathOperationRestriction pathOperationRestriction;\n\n    @Mock\n    private LockInfo lockInfo;\n\n    @Mock\n    private List<LockInfo> lockInfos;\n\n    @Before\n    public void setup() {\n    }\n\n    @Test\n    public void lockFromAnotherUserShouldCauseRestriction() {\n        when(lockInfo.isLocked()).thenReturn(true);\n        when(lockService.retrieveLockInfo(any())).thenReturn(lockInfo);\n        when(identity.getIdentifier()).thenReturn(\"456\");\n        when(lockInfo.lockedBy()).thenReturn(\"123\");\n\n        PathOperationRestriction result = lockRestrictor.hasRestriction(path);\n        assertNotNull(result);\n        assertTrue(result instanceof PathOperationRestriction);\n    }\n\n    @Test\n    public void lockedFilesShouldCauseRestriction() {\n        when(lockInfo.isLocked()).thenReturn(false);\n        when(lockService.retrieveLockInfo(any())).thenReturn(lockInfo);\n        when(lockService.retrieveLockInfos(path,\n                                           true)).thenReturn(lockInfos);\n        when(lockInfos.isEmpty()).thenReturn(false);\n\n        PathOperationRestriction result = lockRestrictor.hasRestriction(path);\n        assertNotNull(result);\n        assertTrue(result instanceof PathOperationRestriction);\n    }\n\n    @Test\n    public void noLockShouldNotCauseRestriction() {\n        when(lockInfo.isLocked()).thenReturn(false);\n        when(lockService.retrieveLockInfo(any())).thenReturn(lockInfo);\n        when(lockService.retrieveLockInfos(path,\n                                           true)).thenReturn(lockInfos);\n        when(lockInfos.isEmpty()).thenReturn(true);\n\n        PathOperationRestriction result = lockRestrictor.hasRestriction(path);\n        assertNull(result);\n    }\n\n    @Test\n    public void lockBySameUserShouldNotCauseRestriction() {\n        when(lockInfo.isLocked()).thenReturn(true);\n        when(lockService.retrieveLockInfo(any())).thenReturn(lockInfo);\n        when(identity.getIdentifier()).thenReturn(\"123\");\n        when(lockInfo.lockedBy()).thenReturn(\"123\");\n        when(lockService.retrieveLockInfos(path,\n                                           true)).thenReturn(lockInfos);\n        when(lockInfos.isEmpty()).thenReturn(true);\n\n        PathOperationRestriction result = lockRestrictor.hasRestriction(path);\n        assertNull(result);\n    }\n\n    @Test\n    public void emptyRestrictionListShouldNotCauseRestriction() {\n        when(lockInfo.isLocked()).thenReturn(false);\n        when(lockService.retrieveLockInfo(any())).thenReturn(lockInfo);\n        when(lockInfos.isEmpty()).thenReturn(true);\n        when(lockService.retrieveLockInfos(path,\n                                           true)).thenReturn(lockInfos);\n\n        PathOperationRestriction result = lockRestrictor.hasRestriction(path);\n        assertNull(result);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/validation/ValidationUtils_ParameterizedArtifactIdTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\nimport org.junit.runners.Parameterized.Parameter;\nimport org.junit.runners.Parameterized.Parameters;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Parameterized.class)\npublic class ValidationUtils_ParameterizedArtifactIdTest {\n\n    @Parameter(0)\n    public String input;\n    @Parameter(1)\n    public boolean valid;\n\n    @Parameters\n    public static Object[][] data() {\n        return new Object[][]{{null, false},\n                {\"\", false},\n                {\" \", false},\n                {\"\\n\", false},\n                {\"\\\\\", false},\n                {\"/\", false},\n                {\"\\r\", false},\n                {\"\\t\", false},\n                {\"\\\"\", false},\n                {\"`\", false},\n                {\"?\", false},\n                {\"*\", false},\n                {\"<\", false},\n                {\">\", false},\n                {\"|\", false},\n                {\":\", false},\n\n                {\". \", false},\n                {\" .\", false},\n                {\"a \", false},\n                {\" z\", false},\n                {\"tchao salut\", false},\n\n                {\"a\\nz\", false},\n                {\"a\\\\z\", false},\n                {\"a/z\", false},\n                {\"a\\rz\", false},\n                {\"a\\tz\", false},\n                {\"a\\\"z\", false},\n                {\"a`z\", false},\n                {\"a?z\", false},\n                {\"a*z\", false},\n                {\"a<z\", false},\n                {\"a>z\", false},\n                {\"a|z\", false},\n                {\"a:z\", false},\n\n                {\"Füür.füür.hilfe\", false},\n\n                {\".\", true},\n                {\"..\", true},\n                {\".-.\", true},\n\n                {\"a\", true},\n                {\"a.z\", true},\n                {\"under_score\", true},\n                {\"0123456789\", true},\n                {\"UPPERCASE\", true}};\n    }\n\n    @Test\n    public void isArtifactIdentifier() {\n        assertEquals(valid,\n                     ValidationUtils.isArtifactIdentifier(input));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/validation/ValidationUtils_ParameterizedFilenameTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\nimport org.junit.runners.Parameterized.Parameter;\nimport org.junit.runners.Parameterized.Parameters;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Parameterized.class)\npublic class ValidationUtils_ParameterizedFilenameTest {\n\n    @Parameter(0)\n    public String input;\n    @Parameter(1)\n    public boolean valid;\n\n    @Parameters\n    public static Object[][] data() {\n        return new Object[][]{{null, false},\n                {\"\", false},\n                {\" \", false},\n                {\"\\n\", false},\n                {\"\\\\\", false},\n                {\"/\", false},\n                {\"\\r\", false},\n                {\"\\t\", false},\n                {\"\\\"\", false},\n                {\"`\", false},\n                {\"?\", false},\n                {\"*\", false},\n                {\"<\", false},\n                {\">\", false},\n                {\"|\", false},\n                {\":\", false},\n\n                {\".\", false},\n                {\"..\", false},\n                {\". \", false},\n                {\" .\", false},\n                {\".-.\", false},\n\n                {\"a\\nz\", false},\n                {\"a\\\\z\", false},\n                {\"a/z\", false},\n                {\"a\\rz\", false},\n                {\"a\\tz\", false},\n                {\"a\\\"z\", false},\n                {\"a`z\", false},\n                {\"a?z\", false},\n                {\"a*z\", false},\n                {\"a<z\", false},\n                {\"a>z\", false},\n                {\"a|z\", false},\n                {\"a:z\", false},\n\n                {\"a\", true},\n                {\"a \", true},\n                {\" z\", true},\n                {\"a.z\", true},\n                {\"Füür!füür!hilfe\", true},\n                {\"tchao salut\", true},\n                {\"under_score\", true}};\n    }\n\n    @Test\n    public void isValidFileName() {\n        assertEquals(valid,\n                     ValidationUtils.isFileName(input));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/validation/ValidationUtils_ParameterizedJavaIdTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.validation;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\nimport org.junit.runners.Parameterized.Parameter;\nimport org.junit.runners.Parameterized.Parameters;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Parameterized.class)\npublic class ValidationUtils_ParameterizedJavaIdTest {\n\n    @Parameter(0)\n    public String input;\n    @Parameter(1)\n    public boolean valid;\n\n    @Parameters\n    public static Object[][] data() {\n        return new Object[][]{{null, false},\n                {\"\", false},\n                {\" \", false},\n                {\"\\n\", false},\n                {\"\\\\\", false},\n                {\"/\", false},\n                {\"\\r\", false},\n                {\"\\t\", false},\n                {\"\\\"\", false},\n                {\"`\", false},\n                {\"?\", false},\n                {\"*\", false},\n                {\"<\", false},\n                {\">\", false},\n                {\"|\", false},\n                {\":\", false},\n\n                {\".\", false},\n                {\"..\", false},\n                {\". \", false},\n                {\" .\", false},\n                {\".-.\", false},\n                {\"a.z\", false},\n\n                {\"a\\nz\", false},\n                {\"a\\\\z\", false},\n                {\"a/z\", false},\n                {\"a\\rz\", false},\n                {\"a\\tz\", false},\n                {\"a\\\"z\", false},\n                {\"a`z\", false},\n                {\"a?z\", false},\n                {\"a*z\", false},\n                {\"a<z\", false},\n                {\"a>z\", false},\n                {\"a|z\", false},\n                {\"a:z\", false},\n\n                {\"a \", false},\n                {\" z\", false},\n                {\"tchao salut\", false},\n\n                {\"0one\", false},\n                {\"dash-y\", false},\n                {\"Fire!fire!help\", false},\n                {\"Fire,help\", false},\n                {\"füür\", true},\n                {\"anyone()questionmark\", false},\n\n                {\"true\", false},\n                {\"==\", false},\n                {\"null\", false},\n                {\"class\", false},\n\n                {String.valueOf((char) 7), false},\n                {String.valueOf((char) 127), false},\n\n                {\"a\", true},\n                {\"classyAndSuperShinyNewCustomThing\", true},\n                {\"Misc2\", true},\n                {\"under_score\", true},\n                {\"背景色\", true}};\n    }\n\n    @Test\n    public void isJavaIdentifier() {\n        assertEquals(valid,\n                     ValidationUtils.isJavaIdentifier(input));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/version/MockIOService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.InterruptedException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class MockIOService\n        implements IOService {\n\n    private ArrayList<Path> paths = new ArrayList<Path>();\n\n    public void setExistingPaths(Path... paths) {\n        for (Path path : paths) {\n            this.paths.add(path);\n        }\n    }\n\n    @Override\n    public void dispose() {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fileSystem) throws org.uberfire.java.nio.file.InterruptedException {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fileSystem,\n                           Option... options) throws InterruptedException {\n\n    }\n\n    @Override\n    public void endBatch() {\n\n    }\n\n    @Override\n    public FileAttribute<?>[] convert(Map<String, ?> stringMap) {\n        return new FileAttribute<?>[0];\n    }\n\n    @Override\n    public Path get(String s,\n                    String... strings) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Path get(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Iterable<FileSystemMetadata> getFileSystemMetadata() {\n        return null;\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, ProviderNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri,\n                                    Map<String, ?> stringMap) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void onNewFileSystem(NewFileSystemListener newFileSystemListener) {\n\n    }\n\n    @Override\n    public InputStream newInputStream(Path path,\n                                      OpenOption... openOptions) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path,\n                                        OpenOption... openOptions) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              OpenOption... openOptions) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> openOptions,\n                                              FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path path) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path path,\n                                                    DirectoryStream.Filter<Path> pathFilter) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createFile(Path path,\n                           FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path path,\n                                FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path path,\n                                  FileAttribute<?>... fileAttributes) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path path,\n                                Map<String, ?> stringMap) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path path,\n                                  Map<String, ?> stringMap) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void delete(Path path,\n                       DeleteOption... deleteOptions) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... deleteOptions) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public Path createTempFile(String s,\n                               String s2,\n                               FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempFile(Path path,\n                               String s,\n                               String s2,\n                               FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(String s,\n                                    FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(Path path,\n                                    String s,\n                                    FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path copy(Path path,\n                     Path path2,\n                     CopyOption... copyOptions) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path move(Path path,\n                     Path path2,\n                     CopyOption... copyOptions) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                                Class<V> vClass) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path,\n                                              String s) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              FileAttribute<?>... fileAttributes) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              Map<String, Object> stringObjectMap) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttribute(Path path,\n                             String s,\n                             Object o) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(Path path,\n                               String s) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileTime getLastModifiedTime(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long size(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public boolean exists(Path path) throws IllegalArgumentException, SecurityException {\n        return paths.contains(path);\n    }\n\n    @Override\n    public boolean notExists(Path path) throws IllegalArgumentException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public boolean isSameFile(Path path,\n                              Path path2) throws IllegalArgumentException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public BufferedReader newBufferedReader(Path path,\n                                            Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public BufferedWriter newBufferedWriter(Path path,\n                                            Charset charset,\n                                            OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long copy(InputStream inputStream,\n                     Path path,\n                     CopyOption... copyOptions) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public long copy(Path path,\n                     OutputStream outputStream) throws IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public byte[] readAllBytes(Path path) throws IOException, OutOfMemoryError, SecurityException {\n        return new byte[0];\n    }\n\n    @Override\n    public List<String> readAllLines(Path path) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public List<String> readAllLines(Path path,\n                                     Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path,\n                                Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      OpenOption... openOptions) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      Iterable<? extends CharSequence> charSequences,\n                      Charset charset,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public int priority() {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/version/VersionRecordServiceImplTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class VersionRecordServiceImplTest {\n\n    private MockIOService ioService;\n    private Path pathToFile;\n    private Path pathToDotFile;\n    private ArrayList<VersionRecord> dotFileVersionRecords = new ArrayList<VersionRecord>();\n    private ArrayList<VersionRecord> mainFileVersionRecords = new ArrayList<VersionRecord>();\n\n    @Before\n    public void setUp() throws Exception {\n\n        pathToFile = mock(Path.class);\n        pathToDotFile = mock(Path.class);\n\n        when(pathToFile.resolveSibling(anyString())).thenReturn(pathToDotFile);\n\n        ioService = new MockIOService() {\n            @Override\n            public <V extends FileAttributeView> V getFileAttributeView(org.uberfire.java.nio.file.Path path,\n                                                                        Class<V> vClass) throws IllegalArgumentException {\n                return (V) new MockVersionAttributeView(path);\n            }\n        };\n\n        mainFileVersionRecords.add(makeVersionRecord(\"id1\",\n                                                     \"file.txt\",\n                                                     new Date(1)));\n        mainFileVersionRecords.add(makeVersionRecord(\"id3\",\n                                                     \"file.txt\",\n                                                     new Date(3)));\n        mainFileVersionRecords.add(makeVersionRecord(\"id4\",\n                                                     \"file.txt\",\n                                                     new Date(4)));\n\n        dotFileVersionRecords.add(makeVersionRecord(\"id1\",\n                                                    \".file.txt\",\n                                                    new Date(1)));\n        dotFileVersionRecords.add(makeVersionRecord(\"id2\",\n                                                    \".file.txt\",\n                                                    new Date(2)));\n        dotFileVersionRecords.add(makeVersionRecord(\"id5\",\n                                                    \".file.txt\",\n                                                    new Date(5)));\n    }\n\n    @Test\n    public void testSimple() throws Exception {\n\n        ioService.setExistingPaths(pathToFile,\n                                   pathToDotFile);\n\n        VersionRecordServiceImpl versionRecordServiceImpl = new VersionRecordServiceImpl(\n                ioService,\n                new VersionUtil()\n        );\n\n        List<VersionRecord> versions = versionRecordServiceImpl.load(pathToFile);\n\n        assertEquals(5,\n                     versions.size());\n        assertEquals(\"id1\",\n                     versions.get(0).id());\n        assertEquals(\"id2\",\n                     versions.get(1).id());\n        assertEquals(\"id3\",\n                     versions.get(2).id());\n        assertEquals(\"id4\",\n                     versions.get(3).id());\n        assertEquals(\"id5\",\n                     versions.get(4).id());\n    }\n\n    @Test\n    public void testMainFileHasHigherPriorityWhenCommitTimeIsEqual() throws Exception {\n\n        ioService.setExistingPaths(pathToFile,\n                                   pathToDotFile);\n\n        mainFileVersionRecords.clear();\n        dotFileVersionRecords.clear();\n        mainFileVersionRecords.add(makeVersionRecord(\"main file\",\n                                                     \"default://f6d48ce4c00a915185668c8df33bb500b3889c95@uf-playground/mortgages/src/main/resources/org/mortgages/Bankruptcy%20history.rdrl\",\n                                                     new Date(1)));\n        dotFileVersionRecords.add(makeVersionRecord(\"dot1 file\",\n                                                    \"default://f6d48ce4c00a915185668c8df33bb500b3889c95@uf-playground/mortgages/src/main/resources/org/mortgages/.Bankruptcy%20history.rdrl\",\n                                                    new Date(1)));\n\n        VersionRecordServiceImpl versionRecordServiceImpl = new VersionRecordServiceImpl(\n                ioService,\n                new VersionUtil()\n        );\n\n        List<VersionRecord> versions = versionRecordServiceImpl.load(pathToFile);\n\n        assertEquals(2,\n                     versions.size());\n        assertEquals(\"main file\",\n                     versions.get(0).id());\n        assertEquals(\"dot1 file\",\n                     versions.get(1).id());\n    }\n\n    @Test\n    public void testNoDotFile() throws Exception {\n\n        ioService.setExistingPaths(pathToFile);\n\n        VersionRecordServiceImpl versionRecordServiceImpl = new VersionRecordServiceImpl(\n                ioService,\n                new VersionUtil()\n        );\n\n        List<VersionRecord> versions = versionRecordServiceImpl.load(pathToFile);\n\n        assertEquals(3,\n                     versions.size());\n        assertEquals(\"id1\",\n                     versions.get(0).id());\n        assertEquals(\"id3\",\n                     versions.get(1).id());\n        assertEquals(\"id4\",\n                     versions.get(2).id());\n    }\n\n    @Test\n    public void testLoadRecord() throws Exception {\n\n        ioService.setExistingPaths(pathToFile);\n\n        VersionRecordServiceImpl versionRecordServiceImpl = new VersionRecordServiceImpl(\n                ioService,\n                new VersionUtil() {\n                    @Override\n                    public Path getPath(Path path,\n                                        String version) throws URISyntaxException {\n                        return path;\n                    }\n\n                    @Override\n                    public String getVersion(Path path) {\n                        return \"id3\";\n                    }\n                }\n        );\n\n        VersionRecord record = versionRecordServiceImpl.loadRecord(pathToFile);\n\n        assertEquals(record.id(),\n                     \"id3\");\n    }\n\n    @Test\n    public void testLoadRecordMain() throws Exception {\n\n        ioService.setExistingPaths(pathToFile);\n\n        VersionRecordServiceImpl versionRecordServiceImpl = new VersionRecordServiceImpl(\n                ioService,\n                new VersionUtil() {\n                    @Override\n                    public Path getPath(Path path,\n                                        String version) throws URISyntaxException {\n                        return path;\n                    }\n\n                    @Override\n                    public String getVersion(Path path) {\n                        return \"master\";\n                    }\n                }\n        );\n\n        VersionRecord record = versionRecordServiceImpl.loadRecord(pathToFile);\n\n        assertEquals(record.id(),\n                     \"id1\");\n    }\n\n    private VersionRecord makeVersionRecord(final String id,\n                                            final String uri,\n                                            final Date date) {\n        return new VersionRecord() {\n            @Override\n            public String id() {\n                return id;\n            }\n\n            @Override\n            public String author() {\n                return null;\n            }\n\n            @Override\n            public String email() {\n                return null;\n            }\n\n            @Override\n            public String comment() {\n                return null;\n            }\n\n            @Override\n            public Date date() {\n                return date;\n            }\n\n            @Override\n            public String uri() {\n                return uri;\n            }\n        };\n    }\n\n    private class MockVersionAttributeView\n            extends VersionAttributeView<org.uberfire.java.nio.file.Path> {\n\n        List<VersionRecord> records;\n\n        public MockVersionAttributeView(org.uberfire.java.nio.file.Path path) {\n            super(path);\n            if (pathToFile.equals(path)) {\n                records = mainFileVersionRecords;\n            } else {\n                records = dotFileVersionRecords;\n            }\n        }\n\n        @Override\n        public VersionAttributes readAttributes() throws IOException {\n            return new VersionAttributes() {\n                @Override\n                public VersionHistory history() {\n                    return new VersionHistory() {\n                        @Override\n                        public List<VersionRecord> records() {\n                            return records;\n                        }\n                    };\n                }\n\n                @Override\n                public FileTime lastModifiedTime() {\n                    return null;\n                }\n\n                @Override\n                public FileTime lastAccessTime() {\n                    return null;\n                }\n\n                @Override\n                public FileTime creationTime() {\n                    return null;\n                }\n\n                @Override\n                public boolean isRegularFile() {\n                    return false;\n                }\n\n                @Override\n                public boolean isDirectory() {\n                    return false;\n                }\n\n                @Override\n                public boolean isSymbolicLink() {\n                    return false;\n                }\n\n                @Override\n                public boolean isOther() {\n                    return false;\n                }\n\n                @Override\n                public long size() {\n                    return 0;\n                }\n\n                @Override\n                public Object fileKey() {\n                    return null;\n                }\n            };\n        }\n\n        @Override\n        public Class[] viewTypes() {\n            return new Class[0];\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/java/org/uberfire/ext/editor/commons/backend/version/VersionServiceImplTest.java",
    "content": "/*\n * Copyright 2019 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.backend.version;\n\nimport java.net.URISyntaxException;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.inOrder;\nimport static org.mockito.Mockito.mock;\nimport static org.uberfire.java.nio.file.StandardCopyOption.REPLACE_EXISTING;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class VersionServiceImplTest {\n\n    @Mock\n    private IOService ioService;\n    @Mock\n    private SessionInfo sessionInfo;\n    @Mock\n    private PathResolver pathResolver;\n    @Mock\n    private VersionUtil versionUtil;\n    @InjectMocks\n    private VersionServiceImpl versionService;\n\n    @Before\n    public void setUp() throws Exception {\n        final User user = mock(User.class);\n        doReturn(\"user id\").when(user).getIdentifier();\n        doReturn(\"session id\").when(sessionInfo).getId();\n        doReturn(user).when(sessionInfo).getIdentity();\n    }\n\n    @Test\n    public void restore() throws URISyntaxException {\n        final Path path = new PathFactory.PathImpl(\"foo.txt\", \"default://foo.txt\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n\n        doReturn(nioPath).when(pathResolver).resolveMainFilePath(any());\n\n        final InOrder order = inOrder(ioService);\n\n        versionService.restore(path,\n                               \"Restore comment\",\n                               \"main\");\n\n        order.verify(ioService).startBatch(nioPath.getFileSystem());\n\n        order.verify(ioService).copy(eq(nioPath),\n                                     any(),\n                                     eq(REPLACE_EXISTING),\n                                     any(CommentedOption.class));\n\n        order.verify(ioService).endBatch();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-commons-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-commons-editor-client</artifactId>\n\n  <name>Uberfire Commons Editor Client</name>\n  <description>Uberfire Commons Editor Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-core</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <plugins>\n      <!-- WebJars Dependencies -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <!-- File Saver -->\n          <execution>\n            <id>unpack-filesaver</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>filesaver</artifactId>\n                  <version>${version.org.webjars.bower.filesaver}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/filesaver</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <!-- JsPDF -->\n          <execution>\n            <id>unpack-jspdf</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>jspdf</artifactId>\n                  <version>${version.org.webjars.bower.jspdf}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/jspdf</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <!-- Canvas2svg -->\n          <execution>\n            <id>unpack-canvas2svg</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bowergithub.gliffy</groupId>\n                  <artifactId>canvas2svg</artifactId>\n                  <version>${version.org.webjars.bowergithub.gliffy.canvas2svg}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/canvas2svg</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <!-- MustacheJS -->\n          <execution>\n            <id>unpack-mustachejs</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>mustache.js</artifactId>\n                  <version>${version.org.webjars.bower.mustachejs}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/mustachejs</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n\n      <!-- Copy JS from WebJars to resources Path, where it should be injected on the application with JsInterop -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <!-- File Saver -->\n          <execution>\n            <id>copy-filesaver-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/ext/editor/commons/client/file/exports/js</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/filesaver/META-INF/resources/webjars/filesaver/${version.org.webjars.bower.filesaver}/</directory>\n                  <includes>\n                    <include>FileSaver.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <!-- JsPDF -->\n          <execution>\n            <id>copy-jspdf-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/ext/editor/commons/client/file/exports/js</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/jspdf/META-INF/resources/webjars/jspdf/${version.org.webjars.bower.jspdf}/dist/</directory>\n                  <includes>\n                    <include>jspdf.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <!-- Canvas2svg -->\n          <execution>\n            <id>copy-canvas2svg-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/ext/editor/commons/client/file/exports/js</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/canvas2svg/META-INF/resources/webjars/canvas2svg/</directory>\n                  <includes>\n                    <include>canvas2svg.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <!-- MustacheJS -->\n          <execution>\n            <id>copy-mustachejs-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>\n                ${project.build.outputDirectory}/org/uberfire/ext/editor/commons/client/template/mustache/\n              </outputDirectory>\n              <resources>\n                <resource>\n                  <directory>\n                    ${project.build.directory}/mustachejs/META-INF/resources/webjars/mustache.js/${version.org.webjars.bower.mustachejs}/\n                  </directory>\n                  <includes>\n                    <include>mustache.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/BaseEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentDeleteAcceptedEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentDeleteIgnoredEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentRenameAcceptedEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentRenameIgnoredEvent;\nimport org.uberfire.ext.editor.commons.client.file.popups.DeletePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.BasicFileMenuBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.DownloadMenuItemBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.MenuItems;\nimport org.uberfire.ext.editor.commons.client.menu.common.SaveAndRenameCommandBuilder;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopup;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport java.util.*;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.*;\nimport static org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopup.*;\n\npublic abstract class BaseEditor<T, M> {\n\n    protected boolean isReadOnly;\n\n    protected BaseEditorView baseView;\n\n    protected ObservablePath.OnConcurrentUpdateEvent concurrentUpdateSessionInfo = null;\n\n    protected Menus menus;\n\n    protected Promise<Void> makeMenuBarPromise;\n    \n    protected boolean saveWithComments = true;\n\n    @Inject\n    protected PlaceManager placeManager;\n\n    @Inject\n    protected Event<ChangeTitleWidgetEvent> changeTitleNotification;\n\n    @Inject\n    protected Event<NotificationEvent> notification;\n\n    @Inject\n    protected VersionRecordManager versionRecordManager;\n\n    @Inject\n    protected ManagedInstance<BasicFileMenuBuilder> menuBuilderManagedInstance;\n\n    @Inject\n    protected BasicFileMenuBuilder menuBuilder;\n\n    @Inject\n    protected DefaultFileNameValidator fileNameValidator;\n\n    @Inject\n    protected SaveAndRenameCommandBuilder<T, M> saveAndRenameCommandBuilder;\n\n    @Inject\n    protected Event<ConcurrentDeleteAcceptedEvent> concurrentDeleteAcceptedEvent;\n\n    @Inject\n    protected Event<ConcurrentDeleteIgnoredEvent> concurrentDeleteIgnoredEvent;\n\n    @Inject\n    protected Event<ConcurrentRenameAcceptedEvent> concurrentRenameAcceptedEvent;\n\n    @Inject\n    protected Event<ConcurrentRenameIgnoredEvent> concurrentRenameIgnoredEvent;\n\n    @Inject\n    private DownloadMenuItemBuilder downloadMenuItemBuilder;\n\n    @Inject\n    protected Promises promises;\n\n    @Inject\n    protected DeletePopUpPresenter deletePopUpPresenter;\n\n    protected ConcurrentChangePopup concurrentChangePopup;\n\n    protected Set<MenuItems> menuItems = new HashSet<>();\n\n    protected PlaceRequest place;\n    protected ClientResourceType type;\n    protected Integer originalHash;\n    protected Integer metadataOriginalHash;\n    protected boolean isValidationRunning = false;\n    private boolean displayShowMoreVersions;\n    private ObservablePath path;\n\n    //for test purposes only\n    BaseEditor(VersionRecordManager versionRecordManager,\n               BaseEditorView baseView,\n               BasicFileMenuBuilder menuBuilder,\n               Event<ChangeTitleWidgetEvent> changeTitleNotification) {\n        this.versionRecordManager = versionRecordManager;\n        this.baseView = baseView;\n        this.menuBuilder = menuBuilder;\n        this.changeTitleNotification = changeTitleNotification;\n    }\n\n    protected BaseEditor() {\n    }\n\n    protected BaseEditor(final BaseEditorView baseView) {\n        this.baseView = baseView;\n    }\n\n    protected void init(final ObservablePath path,\n                        final PlaceRequest place,\n                        final ClientResourceType type,\n                        final MenuItems... menuItems) {\n        init(path,\n             place,\n             type,\n             true,\n             false,\n             menuItems);\n    }\n\n    protected void init(final ObservablePath path,\n                        final PlaceRequest place,\n                        final ClientResourceType type,\n                        final boolean addFileChangeListeners,\n                        final boolean displayShowMoreVersions,\n                        final MenuItems... menuItems) {\n\n        init(path,\n             place,\n             type,\n             addFileChangeListeners,\n             displayShowMoreVersions,\n             Arrays.asList(menuItems));\n    }\n\n    protected void init(final ObservablePath path,\n                        final PlaceRequest place,\n                        final ClientResourceType type,\n                        final boolean addFileChangeListeners,\n                        final boolean displayShowMoreVersions,\n                        final Collection<MenuItems> menuItems) {\n        this.path = path;\n        this.place = place;\n        this.type = type;\n        this.menuItems.addAll(menuItems);\n        this.displayShowMoreVersions = displayShowMoreVersions;\n\n        baseView.showLoading();\n\n        this.isReadOnly = this.place.getParameter(\"readOnly\",\n                                                  null) == null ? false : true;\n\n        versionRecordManager.init(\n                this.place.getParameter(\"version\",\n                                        null),\n                path,\n                this::selectVersion);\n\n        if (displayShowMoreVersions) {\n            versionRecordManager.setShowMoreCommand(\n                    new Command() {\n                        @Override\n                        public void execute() {\n                            showVersions();\n                        }\n                    });\n        }\n\n        if (addFileChangeListeners) {\n            addFileChangeListeners(path);\n        }\n\n        getMenus(menus -> loadContent());\n\n        concurrentUpdateSessionInfo = null;\n    }\n\n    protected void showVersions() {\n\n    }\n\n    /**\n     * If you want to customize the menu content override this method.\n     */\n    protected Promise<Void> makeMenuBar() {\n        if (menuItems.contains(SAVE)) {\n            menuBuilder.addSave(getOnSave());\n        }\n\n        if (menuItems.contains(COPY)) {\n            menuBuilder.addCopy(versionRecordManager.getCurrentPath(),\n                                getCopyValidator(),\n                                getCopyServiceCaller());\n        }\n        if (menuItems.contains(RENAME)) {\n            menuBuilder.addRename(getSaveAndRename());\n        }\n        if (menuItems.contains(DELETE)) {\n            menuBuilder.addDelete(versionRecordManager.getCurrentPath(),\n                                  getDeleteServiceCaller());\n        }\n        if (menuItems.contains(VALIDATE)) {\n            menuBuilder.addValidate(getValidateCommand());\n        }\n        if (menuItems.contains(HISTORY)) {\n            menuBuilder.addNewTopLevelMenu(versionRecordManager.buildMenu());\n        }\n        if (menuItems.contains(DOWNLOAD)) {\n            addDownloadMenuItem(menuBuilder);\n        }\n\n        return promises.resolve();\n    }\n\n    protected void addDownloadMenuItem(final BasicFileMenuBuilder menuBuilder) {\n        menuBuilder.addNewTopLevelMenu(downloadMenuItem());\n    }\n\n    protected MenuItem downloadMenuItem() {\n        return downloadMenuItemBuilder.build(getPathSupplier());\n    }\n\n    Command getOnSave() {\n        return this::onSave;\n    }\n\n    protected Command getSaveAndRename() {\n\n        return getSaveAndRenameCommandBuilder()\n                .addPathSupplier(getPathSupplier())\n                .addValidator(getRenameValidator())\n                .addValidator(getSaveValidator())\n                .addRenameService(getSaveAndRenameServiceCaller())\n                .addMetadataSupplier(getMetadataSupplier())\n                .addContentSupplier(getContentSupplier())\n                .addIsDirtySupplier(isDirtySupplier())\n                .addSuccessCallback(onSuccess())\n                .addBeforeSaveAndRenameCommand(getBeforeSaveAndRenameCommand())\n                .build();\n    }\n\n    protected Command getBeforeSaveAndRenameCommand() {\n        return () -> {\n        };\n    }\n\n    protected Supplier<Boolean> getSaveValidator() {\n\n        return () -> {\n\n            if (isReadOnly && versionRecordManager.isCurrentLatest()) {\n                baseView.alertReadOnly();\n                return false;\n            } else if (isReadOnly && !versionRecordManager.isCurrentLatest()) {\n                versionRecordManager.restoreToCurrentVersion(saveWithComments);\n                return false;\n            }\n\n            if (concurrentUpdateSessionInfo != null) {\n                showConcurrentUpdatePopup();\n                return false;\n            } else {\n                return true;\n            }\n        };\n    }\n\n    protected ParameterizedCommand<Path> onSuccess() {\n\n        return (path) -> {\n\n            final T content = getContentSupplier().get();\n            final M metadata = getMetadataSupplier().get();\n\n            setOriginalHash(content.hashCode());\n\n            Optional<M> optionalMetadata = Optional.ofNullable(getMetadataSupplier().get());\n\n            if (optionalMetadata.isPresent()) {\n                setMetadataOriginalHash(metadata.hashCode());\n            }\n        };\n    }\n\n    protected SaveAndRenameCommandBuilder<T, M> getSaveAndRenameCommandBuilder() {\n        return saveAndRenameCommandBuilder;\n    }\n\n    protected Supplier<Path> getPathSupplier() {\n        return () -> versionRecordManager.getPathToLatest();\n    }\n\n    /**\n     * If you want to customize the menu construction override this method. {@link BaseEditor#makeMenuBar()}\n     * should be used to add items to the {@link BasicFileMenuBuilder}. This method then instructs\n     * {@link BasicFileMenuBuilder#build()} to create the {@link Menus}\n     */\n    protected void buildMenuBar() {\n        if (menuBuilder != null && menus == null) {\n            menus = menuBuilder.build();\n        }\n    }\n\n    public Validator getRenameValidator() {\n        return fileNameValidator;\n    }\n\n    public Validator getCopyValidator() {\n        return fileNameValidator;\n    }\n\n    private void selectVersion(VersionRecord versionRecord) {\n        baseView.showBusyIndicator(CommonConstants.INSTANCE.Loading());\n\n        isReadOnly = !versionRecordManager.isLatest(versionRecord);\n\n        versionRecordManager.setVersion(versionRecord.id());\n\n        loadContent();\n    }\n\n    public void setOriginalHash(Integer originalHash) {\n        this.originalHash = originalHash;\n    }\n\n    private void addFileChangeListeners(final ObservablePath path) {\n        path.onRename(new Command() {\n            @Override\n            public void execute() {\n                onRename();\n            }\n        });\n        path.onDelete(new Command() {\n            @Override\n            public void execute() {\n                onDelete();\n            }\n        });\n\n        path.onConcurrentUpdate(new ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent>() {\n            @Override\n            public void execute(final ObservablePath.OnConcurrentUpdateEvent eventInfo) {\n                concurrentUpdateSessionInfo = eventInfo;\n                showConcurrentUpdatePopup();\n            }\n        });\n\n        path.onConcurrentRename(this::onConcurrentRename);\n\n        path.onConcurrentDelete(this::onConcurrentDelete);\n    }\n\n    void onConcurrentRename(final ObservablePath.OnConcurrentRenameEvent info) {\n        baseView.hideBusyIndicator();\n        if (concurrentChangePopup == null) {\n            concurrentChangePopup = newConcurrentRename(info.getSource(),\n                                                        info.getTarget(),\n                                                        info.getIdentity(),\n                                                        onConcurrentRenameIgnoreCommand(path),\n                                                        onConcurrentRenameCloseCommand(path));\n        }\n        concurrentChangePopup.show();\n    }\n\n    Command onConcurrentRenameIgnoreCommand(final ObservablePath path) {\n        return () -> {\n            concurrentChangePopup = null;\n            disableMenus();\n            concurrentRenameIgnoredEvent.fire(new ConcurrentRenameIgnoredEvent(path));\n        };\n    }\n\n    Command onConcurrentRenameCloseCommand(final ObservablePath path) {\n        return () -> {\n            concurrentChangePopup = null;\n            reload();\n            concurrentRenameAcceptedEvent.fire(new ConcurrentRenameAcceptedEvent(path));\n        };\n    }\n\n    void onConcurrentDelete(final ObservablePath.OnConcurrentDelete info) {\n        baseView.hideBusyIndicator();\n        if (concurrentChangePopup == null) {\n            concurrentChangePopup = newConcurrentDelete(info.getPath(),\n                                                        info.getIdentity(),\n                                                        onConcurrentDeleteIgnoreCommand(path),\n                                                        onConcurrentDeleteCloseCommand(path));\n        }\n        concurrentChangePopup.show();\n    }\n\n    Command onConcurrentDeleteIgnoreCommand(final ObservablePath path) {\n        return () -> {\n            concurrentChangePopup = null;\n            disableMenus();\n            disableDeletePopup();\n            concurrentDeleteIgnoredEvent.fire(new ConcurrentDeleteIgnoredEvent(path));\n        };\n    }\n\n    Command onConcurrentDeleteCloseCommand(final ObservablePath path) {\n        return () -> {\n            concurrentChangePopup = null;\n            disableDeletePopup();\n            placeManager.closePlace(place);\n            concurrentDeleteAcceptedEvent.fire(new ConcurrentDeleteAcceptedEvent(path));\n        };\n    }\n\n    private void disableDeletePopup() {\n        if (deletePopUpPresenter.isOpened()) {\n            deletePopUpPresenter.cancel();\n        }\n    }\n\n    private void onDelete() {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            @Override\n            public void execute() {\n                placeManager.forceClosePlace(place);\n            }\n        });\n    }\n\n    protected void onRename() {\n        reload(path);\n    }\n\n    /**\n     * Override this method and use @WorkbenchPartTitleDecoration\n     * @return The widget for the title\n     */\n    protected IsWidget getTitle() {\n        refreshTitle(versionRecordManager.getCurrentPath());\n        return getTitleWidget();\n    }\n\n    EditorTitle getTitleWidget() {\n        return baseView.getTitleWidget();\n    }\n\n    public String getTitleText() {\n        return getTitleText(versionRecordManager.getCurrentPath());\n    }\n\n    String getTitleText(final ObservablePath observablePath) {\n        return observablePath.getFileName() + \" - \" + getType().getDescription();\n    }\n\n    ClientResourceType getType() {\n        return type;\n    }\n\n    protected void onSave() {\n\n        final boolean isValid = getSaveValidator().get();\n\n        if (isValid) {\n            save();\n        }\n    }\n\n    protected void showConcurrentUpdatePopup() {\n        baseView.hideBusyIndicator();\n        if (concurrentChangePopup == null) {\n            concurrentChangePopup = getConcurrentUpdatePopup();\n        }\n        concurrentChangePopup.show();\n    }\n\n    ConcurrentChangePopup getConcurrentUpdatePopup() {\n        return newConcurrentUpdate(concurrentUpdateSessionInfo.getPath(),\n                                                    concurrentUpdateSessionInfo.getIdentity(),\n                                                    new Command() {\n                                                        @Override\n                                                        public void execute() {\n                                                            save();\n                                                            concurrentChangePopup = null;\n                                                        }\n                                                    },\n                                                    new Command() {\n                                                        @Override\n                                                        public void execute() {\n                                                            concurrentChangePopup = null;\n                                                        }\n                                                    },\n                                                    new Command() {\n                                                        @Override\n                                                        public void execute() {\n                                                            reload();\n                                                            concurrentChangePopup = null;\n                                                        }\n                                                    });\n    }\n\n    public RemoteCallback<Path> getSaveSuccessCallback(final int newHash) {\n        return new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path path) {\n                baseView.hideBusyIndicator();\n                versionRecordManager.reloadVersions(path);\n                notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemSavedSuccessfully()));\n                setOriginalHash(newHash);\n            }\n        };\n    }\n\n    public void onRestore(@Observes RestoreEvent restore) {\n        if (versionRecordManager.getCurrentPath() == null || restore == null || restore.getPath() == null) {\n            return;\n        }\n        if (versionRecordManager.getCurrentPath().equals(restore.getPath())) {\n            //when a version is restored we don't want to add the concurrency listeners again -> false\n            init(versionRecordManager.getPathToLatest(),\n                 place,\n                 type,\n                 false,\n                 displayShowMoreVersions);\n            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRestored()));\n        }\n    }\n\n    public void reload() {\n        concurrentUpdateSessionInfo = null;\n        reload(versionRecordManager.getCurrentPath());\n    }\n\n    void reload(final ObservablePath path) {\n        refreshTitle(path);\n        showBusyIndicator();\n        loadContent();\n        notifyChangeTitle(path);\n        initVersionRecordManager();\n    }\n\n    void refreshTitle(final ObservablePath observablePath) {\n        baseView.refreshTitle(getTitleText(observablePath));\n    }\n\n    void showBusyIndicator() {\n        baseView.showBusyIndicator(makeLoading());\n    }\n\n    String makeLoading() {\n        return CommonConstants.INSTANCE.Loading();\n    }\n\n    void notifyChangeTitle(final ObservablePath path) {\n        changeTitleNotification.fire(makeChangeTitleWidgetEvent(path));\n    }\n\n    ChangeTitleWidgetEvent makeChangeTitleWidgetEvent(final ObservablePath path) {\n\n        final String titleText = getTitleText(path);\n        final EditorTitle titleWidget = getTitleWidget();\n\n        return new ChangeTitleWidgetEvent(getPlace(), titleText, titleWidget);\n    }\n\n    void initVersionRecordManager() {\n\n        final String version = getPlace().getParameter(\"version\", null);\n        final Callback<VersionRecord> selectVersion = getSelectVersion();\n\n        versionRecordManager.init(version, versionRecordManager.getCurrentPath(), selectVersion);\n    }\n\n    Callback<VersionRecord> getSelectVersion() {\n        return this::selectVersion;\n    }\n\n    PlaceRequest getPlace() {\n        return place;\n    }\n\n    void disableMenus() {\n        disableMenuItem(COPY);\n        disableMenuItem(MenuItems.RENAME);\n        disableMenuItem(MenuItems.DELETE);\n        disableMenuItem(MenuItems.VALIDATE);\n    }\n\n    public void disableMenuItem(final MenuItems menuItem) {\n        setEnableMenuItem(menuItem, false);\n    }\n\n    public void enableMenuItem(final MenuItems menuItem) {\n        setEnableMenuItem(menuItem, true);\n    }\n\n    private void setEnableMenuItem(final MenuItems menuItem,\n                                   final boolean isEnabled) {\n        getMenus(menus -> {\n            if (menus.getItemsMap().containsKey(menuItem)) {\n                menus.getItemsMap().get(menuItem).setEnabled(isEnabled);\n            }\n        });\n    }\n\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        if (menus != null) {\n            menusConsumer.accept(menus);\n            return;\n        }\n\n        if (makeMenuBarPromise == null) {\n            makeMenuBarPromise = makeMenuBar().then(v -> {\n                buildMenuBar();\n                menusConsumer.accept(menus);\n                return promises.resolve();\n            });\n        } else {\n            makeMenuBarPromise.then(v -> {\n                menusConsumer.accept(menus);\n                return promises.resolve();\n            });\n        }\n    }\n\n    public Command getValidateCommand() {\n\n        return new Command() {\n            @Override\n            public void execute() {\n                if (!isValidationRunning) {\n\n                    onBeforeValidate();\n\n                    onValidate(new Command() {\n                        @Override\n                        public void execute() {\n                            onAfterValidate();\n                        }\n                    });\n                }\n            }\n        };\n    }\n\n    protected void onBeforeValidate() {\n        baseView.showBusyIndicator(CommonConstants.INSTANCE.Validating());\n        isValidationRunning = true;\n    }\n\n    protected void onAfterValidate() {\n        baseView.hideBusyIndicator();\n        isValidationRunning = false;\n    }\n\n    /**\n     * If your editor has validation, overwrite this.\n     * @param finished Called when validation is finished.\n     */\n    protected void onValidate(final Command finished) {\n\n    }\n\n    protected abstract void loadContent();\n\n    protected Supplier<T> getContentSupplier() {\n        return () -> null;\n    }\n\n    protected Supplier<Boolean> isDirtySupplier() {\n        return () -> isContentDirty() || isMetadataDirty();\n    }\n\n    boolean isMetadataDirty() {\n\n        final Optional<M> optionalMetadata = Optional.ofNullable(getMetadataSupplier().get());\n\n        if (optionalMetadata.isPresent()) {\n            return isMetadataDirty(optionalMetadata.get());\n        } else {\n            return false;\n        }\n    }\n\n    private boolean isMetadataDirty(final M metadata) {\n        final Integer metadataCurrentHash = metadata.hashCode();\n        return !metadataCurrentHash.equals(metadataOriginalHash);\n    }\n\n    boolean isContentDirty() {\n        return isDirty(getCurrentContentHash());\n    }\n\n    protected Integer getCurrentContentHash() {\n        try {\n            return getContentSupplier().get().hashCode();\n        } catch (final Exception e) {\n            return null;\n        }\n    }\n\n    protected Supplier<M> getMetadataSupplier() {\n        return () -> null;\n    }\n\n    /**\n     * Needs to be overwritten for save to work\n     */\n    protected void save() {\n\n    }\n\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return null;\n    }\n\n    protected Caller<? extends SupportsRename> getRenameServiceCaller() {\n        return null;\n    }\n\n    protected Caller<? extends SupportsSaveAndRename<T, M>> getSaveAndRenameServiceCaller() {\n        return null;\n    }\n\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return null;\n    }\n\n    public boolean mayClose(Integer currentHash) {\n        if (isDirty(currentHash)) {\n            return baseView.confirmClose();\n        } else {\n            return true;\n        }\n    }\n\n    public boolean isDirty(Integer currentHash) {\n        if (originalHash == null) {\n            return currentHash != null;\n        } else {\n            return !originalHash.equals(currentHash);\n        }\n    }\n\n    public VersionRecordManager getVersionRecordManager() {\n        return this.versionRecordManager;\n    }\n\n    public void setMetadataOriginalHash(final Integer metadataOriginalHash) {\n        this.metadataOriginalHash = metadataOriginalHash;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/BaseEditorEntryPoint.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@Bundle(\"resources/i18n/Constants.properties\")\n@EntryPoint\npublic class BaseEditorEntryPoint {\n\n    @PostConstruct\n    public void init() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/BaseEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.widgets.common.client.common.HasBusyIndicator;\n\npublic interface BaseEditorView\n        extends HasBusyIndicator,\n                IsWidget {\n\n    void showLoading();\n\n    void showSaving();\n\n    void alertReadOnly();\n\n    EditorTitle getTitleWidget();\n\n    void refreshTitle(final String value);\n\n    boolean confirmClose();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/BaseEditorViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\n\npublic abstract class BaseEditorViewImpl\n        extends Composite\n        implements BaseEditorView {\n\n    protected EditorTitle title = new EditorTitle();\n\n    @Override\n    public void alertReadOnly() {\n        Window.alert(CommonConstants.INSTANCE.CantSaveReadOnly());\n    }\n\n    @Override\n    public void showLoading() {\n        showBusyIndicator(CommonConstants.INSTANCE.Loading());\n    }\n\n    @Override\n    public void showSaving() {\n        showBusyIndicator(CommonConstants.INSTANCE.Saving());\n    }\n\n    @Override\n    public EditorTitle getTitleWidget() {\n        return title;\n    }\n\n    @Override\n    public void refreshTitle(final String value) {\n        title.setText(value);\n    }\n\n    @Override\n    public void showBusyIndicator(String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public boolean confirmClose() {\n        return Window.confirm(CommonConstants.INSTANCE.DiscardUnsavedData());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/EditorTitle.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class EditorTitle\n        implements IsWidget {\n\n    private Label layout = new Label();\n\n    public void setText(final String value) {\n        layout.setText(value);\n    }\n\n    public void setText(String fileName,\n                        String fileType) {\n        layout.setText(fileName + \" - \" + fileType);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return layout;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/event/AbstractConcurrentOperationEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.event;\n\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class AbstractConcurrentOperationEvent implements UberFireEvent {\n\n    private ObservablePath path;\n\n    public AbstractConcurrentOperationEvent(final ObservablePath path) {\n        this.path = path;\n    }\n\n    public ObservablePath getPath() {\n        return path;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof AbstractConcurrentOperationEvent)) {\n            return false;\n        }\n\n        final AbstractConcurrentOperationEvent that = (AbstractConcurrentOperationEvent) o;\n\n        return !(getPath() != null ? !getPath().equals(that.getPath()) : that.getPath() != null);\n    }\n\n    @Override\n    public int hashCode() {\n        return getPath() != null ? getPath().hashCode() : 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/event/ConcurrentDeleteAcceptedEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.event;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\npublic class ConcurrentDeleteAcceptedEvent extends AbstractConcurrentOperationEvent {\n\n    public ConcurrentDeleteAcceptedEvent(final ObservablePath path) {\n        super(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/event/ConcurrentDeleteIgnoredEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.event;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\npublic class ConcurrentDeleteIgnoredEvent extends AbstractConcurrentOperationEvent {\n\n    public ConcurrentDeleteIgnoredEvent(final ObservablePath path) {\n        super(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/event/ConcurrentRenameAcceptedEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.event;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\npublic class ConcurrentRenameAcceptedEvent extends AbstractConcurrentOperationEvent {\n\n    public ConcurrentRenameAcceptedEvent(final ObservablePath path) {\n        super(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/event/ConcurrentRenameIgnoredEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.event;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\npublic class ConcurrentRenameIgnoredEvent extends AbstractConcurrentOperationEvent {\n\n    public ConcurrentRenameIgnoredEvent(final ObservablePath path) {\n        super(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/CommandWithFileNameAndCommitMessage.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file;\n\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * A command that has a file name and commit message\n */\npublic interface CommandWithFileNameAndCommitMessage extends ParameterizedCommand<FileNameAndCommitMessage> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/CopyPopUpViewProducer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.ext.editor.commons.client.file.popups.CopyPopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.CopyPopUpView;\n\n@Dependent\npublic class CopyPopUpViewProducer {\n\n    @Inject\n    private ManagedInstance<CopyPopUpPresenter.View> copyPopUpViewInstance;\n\n    @Inject\n    @FallbackImplementation\n    private ManagedInstance<CopyPopUpView> fallbackCopyPopUpViewInstance;\n\n    @Produces\n    @Customizable\n    public CopyPopUpPresenter.View copyPopUpViewProducer() {\n        if (this.copyPopUpViewInstance.isUnsatisfied()) {\n            return fallbackCopyPopUpViewInstance.get();\n        }\n\n        return this.copyPopUpViewInstance.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/Customizable.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Target({ElementType.TYPE, ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})\n@Retention(RetentionPolicy.RUNTIME)\n@Qualifier\npublic @interface Customizable {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/FileNameAndCommitMessage.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file;\n\n/**\n * ValueObject for details needed to copy or rename files\n */\npublic class FileNameAndCommitMessage {\n\n    private final String newFileName;\n    private final String commitMessage;\n\n    public FileNameAndCommitMessage(final String newFileName,\n                                    final String commitMessage) {\n        this.newFileName = newFileName;\n        this.commitMessage = commitMessage;\n    }\n\n    public String getNewFileName() {\n        return newFileName;\n    }\n\n    public String getCommitMessage() {\n        return commitMessage;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/RestoreUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file;\n\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\n\npublic class RestoreUtil {\n\n    public ObservablePath createObservablePath(Path path,\n                                               String uri) {\n        return IOC.getBeanManager().lookupBean(ObservablePath.class).getInstance().wrap(\n                PathFactory.newPathBasedOn(path.getFileName(),\n                                           uri,\n                                           path));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/AbstractFileExport.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\n\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.JsFileSaver;\n\npublic abstract class AbstractFileExport<T> implements FileExport<T> {\n\n    private final BiConsumer<Blob, String> fileSaver;\n\n    public AbstractFileExport() {\n        this((blob, name) -> {\n            JsFileSaver.saveAs(blob,\n                               name,\n                               Boolean.TRUE);\n        });\n    }\n\n    protected AbstractFileExport(final BiConsumer<Blob, String> saveAs) {\n        this.fileSaver = saveAs;\n    }\n\n    protected abstract Optional<Blob> getContent(final T entity);\n\n    @Override\n    public void export(final T entity,\n                       final String fileName) {\n        getContent(entity)\n                .ifPresent(blob -> fileSaver.accept(blob,\n                                                    fileName));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/FileExport.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\n/**\n * Provides client-side exporting features.\n * <p>\n * It saves raw data into a file by producing\n * a file download dialog to appear.\n * <p>\n * Builtin content export types supported :\n * - <code>@Inject FileExport<TextContent></code>\n * - <code>@Inject FileExport<ImageDataUriContent></code>\n * - <code>@Inject FileExport<PdfDocument></code>\n * @@param T The supported content type.\n */\npublic interface FileExport<T> {\n\n    /**\n     * Export the <code>content</code>\n     * into a file  with the name given by <code>fileName</code>\n     * @param content The data to be exported\n     * @param fileName The resulting file name.\n     */\n    public void export(T content,\n                       String fileName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/FileExportProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.FileExportScriptInjector;\nimport org.uberfire.ext.editor.commons.client.file.exports.svg.SvgFileExport;\n\n/**\n * The FileExport bean factory.\n * Also ensures the sources are injected on demand.\n */\n@ApplicationScoped\npublic class FileExportProducer {\n\n    private final FileExportScriptInjector fsScriptInjector;\n\n    protected FileExportProducer() {\n        this(null);\n    }\n\n    @Inject\n    public FileExportProducer(final FileExportScriptInjector fsScriptInjector) {\n        this.fsScriptInjector = fsScriptInjector;\n    }\n\n    @PostConstruct\n    public void init() {\n        fsScriptInjector.inject();\n    }\n\n    @Produces\n    public TextFileExport forText() {\n        return new TextFileExport();\n    }\n\n    @Produces\n    public PdfFileExport forPDF() {\n        return new PdfFileExport();\n    }\n\n    @Produces\n    public ImageFileExport forImage() {\n        return new ImageFileExport();\n    }\n\n    @Produces\n    public SvgFileExport forSvg() {\n        return new SvgFileExport();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/FileExportResources.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\n/**\n * Static resources related to the file export.\n */\npublic interface FileExportResources extends ClientBundle {\n\n    FileExportResources INSTANCE = GWT.create(FileExportResources.class);\n\n    // The File Saver js.\n    @Source(\"js/FileSaver.min.js\")\n    TextResource fileSaver();\n\n    // The jsPDF js.\n    @Source(\"js/jspdf.min.js\")\n    TextResource jsPdf();\n\n    @Source(\"js/canvas2svg.js\")\n    TextResource canvas2svg();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/ImageDataUriContent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic final class ImageDataUriContent {\n\n    private final String uri;\n    private final String mimeType;\n    private final String data;\n\n    public static ImageDataUriContent create(final String uri) {\n        checkNotNull(\"uri\",\n                     uri);\n        final String[] uriParts = uri.split(\",\");\n        return new ImageDataUriContent(uri,\n                                       parseMimeType(uriParts[0]),\n                                       uriParts[1]);\n    }\n\n    private ImageDataUriContent(final String uri,\n                                final String mimeType,\n                                final String data) {\n        this.uri = uri;\n        this.mimeType = mimeType;\n        this.data = data;\n    }\n\n    public String getUri() {\n        return uri;\n    }\n\n    public String getData() {\n        return data;\n    }\n\n    public String getMimeType() {\n        return mimeType;\n    }\n\n    private static String parseMimeType(final String uriDataType) {\n        final String mimeType = uriDataType.split(\":\")[1];\n        final int encIndex = mimeType.indexOf(\";\");\n        return encIndex > -1 ? mimeType.substring(0,\n                                                  encIndex) : mimeType;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/ImageFileExport.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\n\nimport com.google.gwt.typedarrays.client.ArrayBufferNative;\nimport com.google.gwt.typedarrays.client.Uint8ArrayNative;\nimport com.google.gwt.typedarrays.shared.ArrayBuffer;\nimport com.google.gwt.typedarrays.shared.Uint8Array;\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.jboss.errai.common.client.dom.BlobImpl;\nimport org.jboss.errai.common.client.dom.BlobPropertyBag;\nimport org.jboss.errai.common.client.dom.Window;\n\npublic class ImageFileExport extends AbstractFileExport<ImageDataUriContent> {\n\n    public ImageFileExport() {\n    }\n\n    ImageFileExport(final BiConsumer<Blob, String> saveAs) {\n        super(saveAs);\n    }\n\n    @Override\n    protected Optional<Blob> getContent(final ImageDataUriContent entity) {\n        final Blob blob = dataImageAsBlob(entity.getData(),\n                                          entity.getMimeType());\n        return Optional.of(blob);\n    }\n\n    /**\n     * Creates a Blob instance for the raw image data-uri value.\n     * @param data The image uri data.\n     * @param mimeType The media type for the generated blob.\n     */\n    public static Blob dataImageAsBlob(final String data,\n                                       final String mimeType) {\n        final String byteString = Window.atob(data);\n        final ArrayBuffer buffer = ArrayBufferNative.create(byteString.length());\n        final Uint8Array ia = Uint8ArrayNative.create(buffer);\n        for (int i = 0; i < byteString.length(); i++) {\n            ia.set(i,\n                   byteString.charAt(i));\n        }\n        return new BlobImpl(new Object[]{ia},\n                            BlobPropertyBag.create(mimeType));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/PdfDocument.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.uberfire.ext.editor.commons.file.exports.PdfExportPreferences;\n\n/**\n * The pdf document's content model.\n */\npublic final class PdfDocument {\n\n    private final List<PdfEntry> entries = new LinkedList<>();\n    private final PdfExportPreferences settings;\n\n    /**\n     * Factory method that allows custom PDF document's settings.\n     * It creates a new PDF document instance using the specified settings.\n     * @return A new PDF document instance.\n     */\n    public static PdfDocument create(final PdfExportPreferences settings) {\n        return new PdfDocument(settings);\n    }\n\n    private PdfDocument(PdfExportPreferences settings) {\n        this.settings = settings;\n    }\n\n    /**\n     * Adds text to the document.\n     * @param text The text to add.\n     * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page.\n     * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page.\n     */\n    public void addText(final String text,\n                        final int x,\n                        final int y) {\n        entries.add(new Text(text,\n                             x,\n                             y));\n    }\n\n    /**\n     * Adds an image  to the document.\n     * @param urlData The url data for the image.\n     * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page.\n     * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page.\n     * @param width The image's width.\n     * @param height The image's height.\n     */\n    public void addImage(final String urlData,\n                         final String imgType,\n                         final int x,\n                         final int y,\n                         final int width,\n                         final int height) {\n        entries.add(new Image(urlData,\n                              imgType,\n                              x,\n                              y,\n                              width,\n                              height));\n    }\n\n    public PdfExportPreferences getSettings() {\n        return settings;\n    }\n\n    List<PdfEntry> getPdfEntries() {\n        return entries;\n    }\n\n    interface PdfEntry {\n\n    }\n\n    static final class Text implements PdfEntry {\n\n        private final String text;\n        private final int x;\n        private final int y;\n\n        private Text(final String text,\n                     final int x,\n                     final int y) {\n            this.text = text;\n            this.x = x;\n            this.y = y;\n        }\n\n        public String getText() {\n            return text;\n        }\n\n        public int getX() {\n            return x;\n        }\n\n        public int getY() {\n            return y;\n        }\n    }\n\n    static final class Image implements PdfEntry {\n\n        private final String toDataURL;\n        private final String imgType;\n        private final int x;\n        private final int y;\n        private final int width;\n        private final int height;\n\n        private Image(final String toDataURL,\n                      final String imgType,\n                      final int x,\n                      final int y,\n                      final int width,\n                      final int height) {\n            this.toDataURL = toDataURL;\n            this.imgType = imgType;\n            this.x = x;\n            this.y = y;\n            this.width = width;\n            this.height = height;\n        }\n\n        public String getToDataURL() {\n            return toDataURL;\n        }\n\n        public String getImgType() {\n            return imgType;\n        }\n\n        public int getX() {\n            return x;\n        }\n\n        public int getY() {\n            return y;\n        }\n\n        public int getWidth() {\n            return width;\n        }\n\n        public int getHeight() {\n            return height;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/PdfFileExport.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.JsPdf;\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.JsPdfSettings;\nimport org.uberfire.ext.editor.commons.file.exports.PdfExportPreferences;\n\npublic class PdfFileExport implements FileExport<PdfDocument> {\n\n    @Override\n    public void export(final PdfDocument content,\n                       final String fileName) {\n        export(content,\n               fileName,\n               createNewDocument(content));\n    }\n\n    void export(final PdfDocument content,\n                final String fileName,\n                final JsPdf jsFileExport) {\n        content.getPdfEntries()\n                .forEach(entry -> processEntry(jsFileExport,\n                                               entry));\n        jsFileExport.save(fileName);\n    }\n\n    private void processEntry(final JsPdf jsFileExport,\n                              final PdfDocument.PdfEntry entry) {\n        if (entry instanceof PdfDocument.Text) {\n            final PdfDocument.Text text = (PdfDocument.Text) entry;\n            jsFileExport.text(text.getText(),\n                              text.getX(),\n                              text.getY());\n        } else if (entry instanceof PdfDocument.Image) {\n            final PdfDocument.Image image = (PdfDocument.Image) entry;\n            jsFileExport.addImage(image.getToDataURL(),\n                                  image.getImgType(),\n                                  image.getX(),\n                                  image.getY(),\n                                  image.getWidth(),\n                                  image.getHeight());\n        }\n    }\n\n    private static JsPdf createNewDocument(final PdfDocument content) {\n        final PdfExportPreferences settings = content.getSettings();\n        final String orientation = settings.getOrientation().name().toLowerCase();\n        final String unit = settings.getUnit().name().toLowerCase();\n        final String format = settings.getFormat().name().toLowerCase();\n        final JsPdfSettings jsPdfSettings = JsPdfSettings.create(orientation,\n                                                                 unit,\n                                                                 format);\n        return JsPdf.create(jsPdfSettings);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/TextContent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\npublic final class TextContent {\n\n    private final String text;\n\n    public static TextContent create(final String text) {\n        return new TextContent(text);\n    }\n\n    private TextContent(final String text) {\n        this.text = text;\n    }\n\n    public String getText() {\n        return text;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/TextFileExport.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\n\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.jboss.errai.common.client.dom.BlobImpl;\n\npublic class TextFileExport extends AbstractFileExport<TextContent> {\n\n    public TextFileExport() {\n    }\n\n    TextFileExport(final BiConsumer<Blob, String> saveAs) {\n        super(saveAs);\n    }\n\n    @Override\n    protected Optional<Blob> getContent(final TextContent entity) {\n        final Blob blob = BlobImpl.create(entity.getText());\n        return Optional.of(blob);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/FileExportScriptInjector.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso;\n\nimport java.util.Arrays;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport org.uberfire.ext.editor.commons.client.file.exports.FileExportResources;\n\n/**\n * This bean wraps third party libraries related to file exporting\n * into javascript objects, by following the namespace pattern.\n * This bean allows:\n * - avoiding namespaces collisions within any other libraries\n * - no need to manually apply changes into third party js source files\n * - no conflicts during third party libraries version updates\n */\n@ApplicationScoped\npublic class FileExportScriptInjector {\n\n    public static final String NS_SEPARATOR = \".\";\n    public static final String NS = \"window\" + NS_SEPARATOR;\n    public static final String JS_OBJ_SUFFIX = \" || {};\";\n\n    private final Consumer<String> scriptInjector;\n\n    public FileExportScriptInjector() {\n        this.scriptInjector = FileExportScriptInjector::inject;\n    }\n\n    FileExportScriptInjector(final Consumer<String> scriptInjector) {\n        this.scriptInjector = scriptInjector;\n    }\n\n    public void inject() {\n        final String fileSaver = getFileSaverSource();\n        final String jsPdf = getJsPdfSource();\n        final String c2sSource = getC2SSource();\n        scriptInjector.accept(\"var \" + fileSaver + \"\\n\" +\n                                      jsPdf + \"\\n\" +\n                                      c2sSource + \"\\n\");\n    }\n\n    private String getFileSaverSource() {\n        final String fsScript = FileExportResources.INSTANCE.fileSaver().getText();\n        final String fsNsObject = buildNamespaceObject(NS + \"JsFileSaver.saveAs\");\n        return fsNsObject + \" = function(blob, fileName, disableAutoBOM) {\" + \"\\n\" +\n                fsScript + \"\\n\" +\n                \"return saveAs(blob, fileName, disableAutoBOM);};\";\n    }\n\n    private String getJsPdfSource() {\n        final String jsPdfScript = FileExportResources.INSTANCE.jsPdf().getText();\n        final String jsPdfNsObject = buildNamespaceObject(NS + \"JsPdf\");\n        return jsPdfNsObject + \" = function(settings) {\" + \"\\n\" +\n                jsPdfScript + \"\\n\" +\n                \"var saveAs = \" + NS + \"JsFileSaver.saveAs; \" +\n                \"return new jsPDF(settings);};\";\n    }\n\n    private String getC2SSource() {\n        return FileExportResources.INSTANCE.canvas2svg().getText();\n    }\n\n    private static void inject(final String raw) {\n        final ScriptInjector.FromString jsPdfScript = ScriptInjector.fromString(raw);\n        jsPdfScript.setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(false).inject();\n    }\n\n    static String buildNamespaceObject(final String namespace) {\n        final int pkgSepIndex = namespace.lastIndexOf(NS_SEPARATOR);\n        String raw = \"\";\n        if (pkgSepIndex > 0) {\n            final String nsPkg = namespace.substring(0,\n                                                     pkgSepIndex);\n            final String[] nsPkgObject = {\"\", \"\"};\n            Arrays.asList(nsPkg.split(\"\\\\.\"))\n                    .forEach(p -> {\n                        nsPkgObject[0] += p;\n                        nsPkgObject[1] += nsPkgObject[0] + \" = \" + nsPkgObject[0] + JS_OBJ_SUFFIX + \"\\n\";\n                        nsPkgObject[0] += NS_SEPARATOR;\n                    });\n            raw = nsPkgObject[1];\n        }\n        raw += namespace;\n        return raw;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/JsFileSaver.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.dom.Blob;\n\n/**\n * Provides the JsInterop API for FileSaver js.\n * Provided by the webjar <code>org.webjars.bower.filesaver</code>.\n * @see <a href=\"https://github.com/eligrey/FileSaver.js\">FileSaver.js</a>\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic class JsFileSaver {\n\n    /**\n     * Saves the given blob's content into a file.\n     * @param blob The blob data.\n     * @param fileName The file name.\n     * @param disableAutoBOM true if you don't want FileSaver.js to automatically provide Unicode text encoding hints.\n     */\n    @JsMethod\n    public static native void saveAs(Blob blob,\n                                     String fileName,\n                                     boolean disableAutoBOM);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/JsPdf.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso;\n\nimport jsinterop.annotations.JsConstructor;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n/**\n * Provides the JsInterop API for jsPdf.\n * Provided by the webjar <code>org.webjars.bower.jspdf</code>.\n * @see <a href=\"https://github.com/MrRio/jsPDF\">jsPDF.js</a>\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic class JsPdf {\n\n    /**\n     * Factory method for JsPdf.\n     * @param settings The settings for the new document's.\n     * @return A new JsPdf instance.\n     */\n    @JsOverlay\n    public static final JsPdf create(JsPdfSettings settings) {\n        return new JsPdf(settings);\n    }\n\n    @JsConstructor\n    public JsPdf(JsPdfSettings settings) {\n    }\n\n    /**\n     * Adds text to the document.\n     * @param text The text to add.\n     * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page.\n     * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page.\n     */\n    public native void text(String text,\n                            int x,\n                            int y);\n\n    /**\n     * Adds an image  to the document.\n     * @param imgData The url data for the image.\n     * @param x Coordinate (in units declared at inception of PDF document) against left edge of the page.\n     * @param y Coordinate (in units declared at inception of PDF document) against upper edge of the page.\n     * @param width The image's width.\n     * @param height The image's height.\n     */\n    public native void addImage(String imgData,\n                                String imgType,\n                                int x,\n                                int y,\n                                int width,\n                                int height);\n\n    /**\n     * Saves the document into a PDF file.\n     * @param fileName The name for the generated file.\n     */\n    public native void save(String fileName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/JsPdfSettings.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * The jsPDF' settings,\n * It's being exported just as an Object with the following properties:\n * - <code>orientation</code>\n * - <code>unit</code>\n * - <code>format</code>\n */\n@JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\npublic class JsPdfSettings {\n\n    /**\n     * Factory method for the jsPdf' settings.\n     * @param orientation The document's orientation. It can be <code>portrait</code> or <ocde>landscape</ocde>.\n     * @param unit Values are <code>pm</code>, <code>mm</code>, <code>cm</code> or <code>in</code>.\n     * @param format Any of the allowed PDF page formats. See PdfSettings.Format.\n     * @return A new jsPdf' settings instance.\n     */\n    @JsOverlay\n    public static JsPdfSettings create(String orientation,\n                                       String unit,\n                                       String format) {\n        final JsPdfSettings instance = new JsPdfSettings();\n        instance.setOrientation(orientation);\n        instance.setUnit(unit);\n        instance.setFormat(format);\n        return instance;\n    }\n\n    @JsProperty\n    public native String getOrientation();\n\n    @JsProperty\n    public native void setOrientation(String orientation);\n\n    @JsProperty\n    public native String getUnit();\n\n    @JsProperty\n    public native void setUnit(String unit);\n\n    @JsProperty\n    public native String getFormat();\n\n    @JsProperty\n    public native void setFormat(String format);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/svg/C2S.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso.svg;\n\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\n\nimport elemental2.core.JsArray;\nimport elemental2.dom.CanvasGradient;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLCanvasElement;\nimport elemental2.dom.ImageData;\nimport elemental2.dom.TextMetrics;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * This is a JsInterop class responsible to make the interface to the <b>canvas2svg</b> library,\n * and the overlay operations to export canvas to SVG.\n * @see <a href=\"https://github.com/gliffy/canvas2svg\">https://github.com/gliffy/canvas2svg</a>\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\nclass C2S {\n\n    @JsOverlay\n    protected static final C2S create(double width, double height, Object nativeContext) {\n        C2SSettings settings = new C2SSettings();\n        settings.setWidth(width);\n        settings.setHeight(height);\n        settings.setEnableMirroring(true);\n        settings.setCtx(nativeContext);\n        C2S c2S = new C2S(settings);\n        c2S.setImageSmoothingEnabled(false);\n        //setting the viewBox on the svg root, this is necessary to scaling th svg on html\n        c2S.setViewBox(width, height);\n        return c2S;\n    }\n\n    @JsOverlay\n    protected final void setViewBox(double width, double height) {\n        final String viewBox = \"0 0 \" + width + \" \" + height;\n        Optional.ofNullable(this.__root)\n                .ifPresent(root -> root.setAttribute(\"viewBox\", viewBox));\n    }\n\n    protected C2S(C2SSettings options) {\n    }\n\n    //----------------------------- C2S Methods  -----------------------------\n\n    @JsProperty\n    private final native void setOptions(C2SSettings settings);\n\n    public final native String getSerializedSvg();\n\n    public final native Element getSvg();\n\n    //----------------------------- Native Context Methods -----------------------------\n    @JsProperty\n    public final native void setFillStyle(String fillStyleColor);\n\n    @JsProperty\n    public final native void setStrokeStyle(String fillStyleColor);\n\n    @JsProperty\n    public final native void setLineWidth(double var1);\n\n    @JsProperty\n    public final native void setLineCap(String lineCap);\n\n    @JsProperty\n    public final native void setLineJoin(String lineJoin);\n\n    @JsProperty\n    public final native void setImageSmoothingEnabled(boolean enabled);\n\n    @JsProperty\n    public final native void setFont(String font);\n\n    @JsProperty\n    public final native void setTextBaseline(String baseline);\n\n    @JsProperty\n    public final native void setTextAlign(String align);\n\n    @JsProperty\n    public final native void setGlobalAlpha(double alpha);\n\n    @JsProperty\n    public final native void setShadowColor(String color);\n\n    @JsProperty\n    public final native void setShadowOffsetX(double color);\n\n    @JsProperty\n    public final native void setShadowOffsetY(double color);\n\n    @JsProperty\n    public final native void setShadowBlur(int color);\n\n    @JsProperty\n    public final native void setMiterLimit(double limit);\n\n    @JsProperty\n    public final native void setLineDashOffset(double offset);\n\n    public final native void save();\n\n    public final native void restore();\n\n    public final native void beginPath();\n\n    public final native void closePath();\n\n    public final native void moveTo(double x, double y);\n\n    public final native void lineTo(double x, double y);\n\n    public final native void setGlobalCompositeOperation(String operation);\n\n    public final native void quadraticCurveTo(double cpx, double cpy, double x, double y);\n\n    public final native void arc(double x, double y, double radius, double startAngle, double endAngle);\n\n    public final native void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise);\n\n    public final native void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac);\n\n    public final native void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea);\n\n    public final native void arcTo(double x1, double y1, double x2, double y2, double radius);\n\n    public final native void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);\n\n    public final native void clearRect(double x, double y, double w, double h);\n\n    public final native void clip();\n\n    public final native void fill();\n\n    public final native void stroke();\n\n    public final native void fillRect(double x, double y, double w, double h);\n\n    public final native void fillText(String text, double x, double y);\n\n    public final native CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);\n\n    public final native CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);\n\n    public final native void rect(double x, double y, double w, double h);\n\n    public final native void rotate(double angle);\n\n    public final native void scale(double sx, double sy);\n\n    public final native void transform(double d0, double d1, double d2, double d3, double d4, double d5);\n\n    public final native void setTransform(double d0, double d1, double d2, double d3, double d4, double d5);\n\n    public final native void strokeText(String text, double x, double y);\n\n    public final native void translate(double x, double y);\n\n    public final native boolean isPointInPath(double x, double y);\n\n    public final native void putImageData(ImageData imageData, double x, double y);\n\n    public final native void putImageData(ImageData imageData, double x, double y, double dx, double dy, double dw, double dh);\n\n    public final native void resetClip();\n\n    public final native void setLineDash(double[] dashes);\n\n    public final native TextMetrics measureText(String text);\n\n    public final native HTMLCanvasElement createImageData(ImageData data);\n\n    public final native ImageData getImageData(double x, double y, double width, double height);\n\n    public final native ImageData createImageData(double width, double height);\n\n    public final native void drawImage(Element image, double x, double y);\n\n    public final native void drawImage(Element image, double x, double y, double w, double h);\n\n    public final native void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h);\n\n    // -----------------------------JS overlay save/restore group -----------------------------\n    @JsOverlay\n    public final void saveGroup(Map<String, String> attributes) {\n        Element group = this.__createElement(\"g\");\n        Element parent = this.__closestGroupOrSvg(null);\n        this.__groupStack.push(parent);\n        parent.appendChild(group);\n        this.__currentElement = group;\n        //setting the group attributes\n        addAttributes(attributes);\n    }\n\n    @JsOverlay\n    public final void restoreGroup() {\n        this.__currentElement = (Element) this.__groupStack.pop();\n        //Clearing canvas will make the poped group invalid, currentElement is set to the root group node.\n        if (this.__currentElement == null) {\n            this.__currentElement = (Element) this.__root.childNodes.item(1);\n        }\n    }\n\n    @JsOverlay\n    public final void saveStyle() {\n        this.__stack.push(this.__getStyleState());\n    }\n\n    @JsOverlay\n    public final void restoreStyle() {\n        this.__currentElementsToStyle = null;\n        Object state = this.__stack.pop();\n        this.__applyStyleState(state);\n    }\n\n    @JsOverlay\n    public final void addAttributes(Map<String, String> attributes) {\n        Optional.ofNullable(attributes).ifPresent(attr -> attr.entrySet()\n                .stream()\n                .filter(entry -> Objects.nonNull(entry.getValue()))\n                .forEach(entry -> this.__currentElement.setAttribute(entry.getKey(), entry.getValue())));\n    }\n\n    public final native Element __createElement(String elementName);\n\n    public final native Element __closestGroupOrSvg(Object node);\n\n    public final native Object __getStyleState();\n\n    public final native void __applyStyleState(Object styleState);\n\n    @JsProperty\n    public JsArray __groupStack;\n\n    @JsProperty\n    public JsArray __stack;\n\n    @JsProperty\n    public Element __currentElement;\n\n    @JsProperty\n    public Element __root;\n\n    @JsProperty\n    public Object __currentElementsToStyle;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/svg/C2SContext2D.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso.svg;\n\nimport java.util.Map;\nimport java.util.Optional;\n\nimport elemental2.dom.CanvasGradient;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLCanvasElement;\nimport elemental2.dom.ImageData;\nimport elemental2.dom.TextMetrics;\nimport jsinterop.annotations.JsOverlay;\nimport org.uberfire.ext.editor.commons.client.file.exports.svg.IContext2D;\n\n/**\n * Delegation class to allow the abstraction of {@link IContext2D}, since the JsInterop classes does not allow\n * methods override with {@link JsOverlay} annotation.\n */\npublic class C2SContext2D implements IContext2D {\n\n    private final C2S delegate;\n\n    public C2SContext2D(double width, double height, Object nativeContext) {\n        delegate = C2S.create(width, height, nativeContext);\n    }\n\n    protected C2SContext2D(C2S delegate) {\n        this.delegate = delegate;\n    }\n\n    public String getSerializedSvg() {\n        return delegate.getSerializedSvg();\n    }\n\n    public void setFillStyle(String fillStyleColor) {\n        delegate.setFillStyle(fillStyleColor);\n    }\n\n    public void setStrokeStyle(String fillStyleColor) {\n        delegate.setStrokeStyle(fillStyleColor);\n    }\n\n    public void setLineWidth(double var1) {\n        delegate.setLineWidth(var1);\n    }\n\n    public void setLineCap(String lineCap) {\n        delegate.setLineCap(lineCap);\n    }\n\n    public void setLineJoin(String lineJoin) {\n        delegate.setLineJoin(lineJoin);\n    }\n\n    public void setImageSmoothingEnabled(boolean enabled) {\n        delegate.setImageSmoothingEnabled(enabled);\n    }\n\n    public void setFont(String font) {\n        delegate.setFont(font);\n    }\n\n    public void setTextBaseline(String baseline) {\n        delegate.setTextBaseline(baseline);\n    }\n\n    public void setTextAlign(String align) {\n        delegate.setTextAlign(align);\n    }\n\n    public void setGlobalAlpha(double alpha) {\n        delegate.setGlobalAlpha(alpha);\n    }\n\n    public void setShadowColor(String color) {\n        delegate.setShadowColor(color);\n    }\n\n    public void setShadowOffsetX(double color) {\n        delegate.setShadowOffsetX(color);\n    }\n\n    public void setShadowOffsetY(double color) {\n        delegate.setShadowOffsetY(color);\n    }\n\n    public void setShadowBlur(int color) {\n        delegate.setShadowBlur(color);\n    }\n\n    public void setMiterLimit(double limit) {\n        delegate.setMiterLimit(limit);\n    }\n\n    public void setLineDashOffset(double offset) {\n        delegate.setLineDashOffset(offset);\n    }\n\n    public void addAttributes(Map<String, String> attributes) {\n        delegate.addAttributes(attributes);\n    }\n\n    public void saveGroup(Map<String, String> attributes) {\n        delegate.saveGroup(attributes);\n    }\n\n    public void restoreGroup() {\n        delegate.restoreGroup();\n    }\n\n    public void saveStyle() {\n        delegate.saveStyle();\n    }\n\n    public void restoreStyle() {\n        delegate.restoreStyle();\n    }\n\n    public void save() {\n        delegate.save();\n    }\n\n    public void restore() {\n        delegate.restore();\n    }\n\n    public void beginPath() {\n        delegate.beginPath();\n    }\n\n    public void closePath() {\n        delegate.closePath();\n    }\n\n    public void moveTo(double x, double y) {\n        delegate.moveTo(x, y);\n    }\n\n    public void lineTo(double x, double y) {\n        delegate.lineTo(x, y);\n    }\n\n    public void setGlobalCompositeOperation(String operation) {\n        delegate.setGlobalCompositeOperation(operation);\n    }\n\n    public void quadraticCurveTo(double cpx, double cpy, double x, double y) {\n        delegate.quadraticCurveTo(cpx, cpy, x, y);\n    }\n\n    public void arc(double x, double y, double radius, double startAngle, double endAngle) {\n        delegate.arc(x, y, radius, startAngle, endAngle);\n    }\n\n    public void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise) {\n        delegate.arc(x, y, radius, startAngle, endAngle, antiClockwise);\n    }\n\n    public void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac) {\n        delegate.ellipse(x, y, rx, ry, ro, sa, ea, ac);\n    }\n\n    public void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea) {\n        delegate.ellipse(x, y, rx, ry, ro, sa, ea);\n    }\n\n    public void arcTo(double x1, double y1, double x2, double y2, double radius) {\n        delegate.arcTo(x1, y1, x2, y2, radius);\n    }\n\n    public void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y) {\n        delegate.bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);\n    }\n\n    public void clearRect(double x, double y, double w, double h) {\n        delegate.clearRect(x, y, w, h);\n    }\n\n    public void clip() {\n        delegate.clip();\n    }\n\n    public void fill() {\n        delegate.fill();\n    }\n\n    public void stroke() {\n        delegate.stroke();\n    }\n\n    public void fillRect(double x, double y, double w, double h) {\n        delegate.fillRect(x, y, w, h);\n    }\n\n    public void fillText(String text, double x, double y) {\n        delegate.fillText(text, x, y);\n    }\n\n    public CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1) {\n        return delegate.createLinearGradient(x0, y0, x1, y1);\n    }\n\n    public CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1) {\n        return delegate.createRadialGradient(x0, y0, r0, x1, y1, r1);\n    }\n\n    public void rect(double x, double y, double w, double h) {\n        delegate.rect(x, y, w, h);\n    }\n\n    public void rotate(double angle) {\n        delegate.rotate(angle);\n    }\n\n    public void scale(double sx, double sy) {\n        delegate.scale(sx, sy);\n    }\n\n    public void transform(double d0, double d1, double d2, double d3, double d4, double d5) {\n        delegate.transform(d0, d1, d2, d3, d4, d5);\n    }\n\n    public void setTransform(double d0, double d1, double d2, double d3, double d4, double d5) {\n        delegate.setTransform(d0, d1, d2, d3, d4, d5);\n    }\n\n    public void strokeText(String text, double x, double y) {\n        delegate.strokeText(text, x, y);\n    }\n\n    public void translate(double x, double y) {\n        delegate.translate(x, y);\n    }\n\n    public boolean isPointInPath(double x, double y) {\n        return delegate.isPointInPath(x, y);\n    }\n\n    public void putImageData(ImageData imageData, double x, double y) {\n        delegate.putImageData(imageData, x, y);\n    }\n\n    public void putImageData(ImageData imageData, double x, double y, double dx, double dy, double dw, double dh) {\n        delegate.putImageData(imageData, x, y, dx, dy, dw, dh);\n    }\n\n    public void resetClip() {\n        delegate.resetClip();\n    }\n\n    public void setLineDash(double[] dashes) {\n        delegate.setLineDash(dashes);\n    }\n\n    public TextMetrics measureText(String text) {\n        return delegate.measureText(text);\n    }\n\n    public HTMLCanvasElement createImageData(ImageData data) {\n        return delegate.createImageData(data);\n    }\n\n    public ImageData getImageData(double x, double y, double width, double height) {\n        return delegate.getImageData(x, y, width, height);\n    }\n\n    public ImageData createImageData(double width, double height) {\n        return delegate.createImageData(width, height);\n    }\n\n    public void drawImage(Element image, double x, double y) {\n        delegate.drawImage(image, x, y);\n    }\n\n    public void drawImage(Element image, double x, double y, double w, double h) {\n        delegate.drawImage(image, x, y, w, h);\n    }\n\n    public void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h) {\n        delegate.drawImage(image, sx, sy, sw, sh, x, y, w, h);\n    }\n\n    protected C2S getDelegate() {\n        return delegate;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/jso/svg/C2SSettings.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso.svg;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * Represents the constructor parameter to be used on the {@link C2S}.\n */\n@JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\nclass C2SSettings {\n\n    @JsOverlay\n    protected static C2SSettings create(double width, double height, Object ctx) {\n        final C2SSettings instance = new C2SSettings();\n        instance.setWidth(width);\n        instance.setHeight(height);\n        instance.setCtx(ctx);\n        instance.setEnableMirroring(true);\n        return instance;\n    }\n\n    @JsProperty\n    public native void setWidth(double width);\n\n    @JsProperty\n    public native void setHeight(double height);\n\n    @JsProperty\n    public native void setCtx(Object ctx);\n\n    @JsProperty\n    public native void setEnableMirroring(boolean enableMirroring);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/svg/Context2DFactory.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.svg.C2SContext2D;\n\n/**\n * Create {@link IContext2D} concrete instances to be used on the SVG exporting,\n * abstracting which library implementation is used, allowing to change or use multiple implementations if necessary.\n */\npublic class Context2DFactory {\n\n    public static IContext2D create(SvgExportSettings settings){\n        //choose the implementation, for now just the canvas2svg.\n        return new C2SContext2D(settings.getWidth(), settings.getHeight(), settings.getContext());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/svg/IContext2D.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\nimport java.util.Map;\nimport java.util.Optional;\n\nimport elemental2.dom.CanvasGradient;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLCanvasElement;\nimport elemental2.dom.ImageData;\nimport elemental2.dom.TextMetrics;\n\n/**\n * Represents a canvas context 2D that is used to wrap calls to canvas used to generate SVG files based on canvas.\n */\npublic interface IContext2D {\n\n    String getSerializedSvg();\n\n    void setFillStyle(String fillStyleColor);\n\n    void setStrokeStyle(String fillStyleColor);\n\n    void setLineWidth(double var1);\n\n    void setLineCap(String lineCap);\n\n    void setLineJoin(String lineJoin);\n\n    void setImageSmoothingEnabled(boolean enabled);\n\n    void setFont(String font);\n\n    void setTextBaseline(String baseline);\n\n    void setTextAlign(String align);\n\n    void setGlobalAlpha(double alpha);\n\n    void setShadowColor(String color);\n\n    void setShadowOffsetX(double color);\n\n    void setShadowOffsetY(double color);\n\n    void setShadowBlur(int color);\n\n    void setMiterLimit(double limit);\n\n    void setLineDashOffset(double offset);\n\n    void addAttributes(Map<String, String> attributes);\n\n    void saveGroup(Map<String, String> attributes);\n\n    void saveStyle();\n\n    void restoreGroup();\n\n    void restoreStyle();\n\n    void save();\n\n    void restore();\n\n    void beginPath();\n\n    void closePath();\n\n    void moveTo(double x, double y);\n\n    void lineTo(double x, double y);\n\n    void setGlobalCompositeOperation(String operation);\n\n    void quadraticCurveTo(double cpx, double cpy, double x, double y);\n\n    void arc(double x, double y, double radius, double startAngle, double endAngle);\n\n    void arc(double x, double y, double radius, double startAngle, double endAngle, boolean antiClockwise);\n\n    void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea, boolean ac);\n\n    void ellipse(double x, double y, double rx, double ry, double ro, double sa, double ea);\n\n    void arcTo(double x1, double y1, double x2, double y2, double radius);\n\n    void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);\n\n    void clearRect(double x, double y, double w, double h);\n\n    void clip();\n\n    void fill();\n\n    void stroke();\n\n    void fillRect(double x, double y, double w, double h);\n\n    void fillText(String text, double x, double y);\n\n    void rect(double x, double y, double w, double h);\n\n    void rotate(double angle);\n\n    void scale(double sx, double sy);\n\n    void transform(double d0, double d1, double d2, double d3, double d4, double d5);\n\n    void setTransform(double d0, double d1, double d2, double d3, double d4, double d5);\n\n    void strokeText(String text, double x, double y);\n\n    void translate(double x, double y);\n\n    boolean isPointInPath(double x, double y);\n\n    void putImageData(ImageData imageData, double x, double y);\n\n    void putImageData(ImageData imageData, double x, double y, double dx, double dy, double dw, double dh);\n\n    void resetClip();\n\n    void setLineDash(double[] dashes);\n\n    TextMetrics measureText(String text);\n\n    HTMLCanvasElement createImageData(ImageData data);\n\n    ImageData getImageData(double x, double y, double width, double height);\n\n    ImageData createImageData(double width, double height);\n\n    void drawImage(Element image, double x, double y);\n\n    void drawImage(Element image, double x, double y, double w, double h);\n\n    void drawImage(Element image, double sx, double sy, double sw, double sh, double x, double y, double w, double h);\n\n    CanvasGradient createLinearGradient(double x0, double y0, double x1, double y1);\n\n    CanvasGradient createRadialGradient(double x0, double y0, double r0, double x1, double y1, double r1);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/svg/SvgExportSettings.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\n/**\n * Contains all attributes used on the SVG Export process.\n */\npublic class SvgExportSettings {\n\n    private final double width;\n    private final double height;\n    private final Object context;\n\n    public SvgExportSettings(final double width, final double height, final Object context) {\n        this.width = width;\n        this.height = height;\n        this.context = context;\n    }\n\n    public double getWidth() {\n        return width;\n    }\n\n    public double getHeight() {\n        return height;\n    }\n\n    public Object getContext() {\n        return context;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/exports/svg/SvgFileExport.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\n\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.jboss.errai.common.client.dom.BlobImpl;\nimport org.uberfire.ext.editor.commons.client.file.exports.AbstractFileExport;\n\n/**\n * Exports an {@link IContext2D} to a serialized SVG file.\n */\npublic class SvgFileExport extends AbstractFileExport<IContext2D> {\n\n    public SvgFileExport() {\n    }\n\n    protected SvgFileExport(BiConsumer<Blob, String> saveAs) {\n        super(saveAs);\n    }\n\n    @Override\n    protected Optional<Blob> getContent(IContext2D entity) {\n        return Optional.of(BlobImpl.create(entity.getSerializedSvg()));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/CommonModalBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.gwt.FlowPanel;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.shared.TemplateUtil;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\npublic class CommonModalBuilder {\n\n    private final BaseModal modal;\n\n    public CommonModalBuilder() {\n        modal = new BaseModal();\n    }\n\n    public CommonModalBuilder addHeader(String title) {\n        this.getModal().setTitle(title);\n        return this;\n    }\n\n    public CommonModalBuilder addBody(HTMLElement element) {\n        this.getModal().add(buildPanel(element,\n                             makeModalBody()));\n        return this;\n    }\n\n    public CommonModalBuilder addBody(elemental2.dom.HTMLElement element) {\n        this.getModal().add(buildPanel(element,\n                             makeModalBody()));\n        return this;\n    }\n\n    public CommonModalBuilder addFooter(ModalFooter footer) {\n        this.getModal().add(footer);\n        return this;\n    }\n\n    public CommonModalBuilder addFooter(HTMLElement element) {\n        this.getModal().add(buildPanel(element,\n                             makeModalFooter()));\n        return this;\n    }\n\n    public CommonModalBuilder addFooter(final elemental2.dom.HTMLElement htmlElement) {\n\n        final FlowPanel flowPanel = buildPanel(htmlElement,\n                                               makeModalFooter());\n        getModal().add(flowPanel);\n        return this;\n    }\n\n    public BaseModal build() {\n        return getModal();\n    }\n\n    protected BaseModal getModal() {\n        return modal;\n    }\n\n    ModalBody makeModalBody() {\n        return new ModalBody();\n    }\n\n    ModalFooter makeModalFooter() {\n        return new ModalFooter();\n    }\n\n    protected FlowPanel buildPanel(final HTMLElement element,\n                                 final FlowPanel panel) {\n\n        final HTMLElement htmlElement = TemplateUtil.asErraiElement(element);\n        panel.add(build(htmlElement));\n        return panel;\n    }\n\n    protected FlowPanel buildPanel(elemental2.dom.HTMLElement element,\n                                 FlowPanel panel) {\n        panel.add(build(element));\n        return panel;\n    }\n\n    private Widget build(HTMLElement element) {\n        return ElementWrapperWidget.getWidget(element);\n    }\n\n    private Widget build(elemental2.dom.HTMLElement element) {\n        return ElementWrapperWidget.getWidget(element);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/CopyPopUpPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.Customizable;\nimport org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorCallback;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class CopyPopUpPresenter {\n\n    private Path path;\n    private Validator validator;\n    private CommandWithFileNameAndCommitMessage command;\n    private ToggleCommentPresenter toggleCommentPresenter;\n    private View view;\n\n    @Inject\n    public CopyPopUpPresenter(@Customizable View view,\n                              ToggleCommentPresenter toggleCommentPresenter) {\n        this.view = view;\n        this.toggleCommentPresenter = toggleCommentPresenter;\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    public void show(Path path,\n                     Validator validator,\n                     CommandWithFileNameAndCommitMessage command) {\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.validator = checkNotNull(\"validator\",\n                                      validator);\n        this.command = checkNotNull(\"command\",\n                                    command);\n\n        view.show();\n    }\n\n    public void show(final Path path,\n                     final CommandWithFileNameAndCommitMessage copyPopupCommand) {\n        show(path,\n             defaultValidator(),\n             copyPopupCommand);\n    }\n\n    public void cancel() {\n        view.hide();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public void copy(String newName) {\n        final String newFileName = newName + extension(path.getFileName());\n\n        validator.validate(newFileName,\n                           validatorCallback(toggleCommentPresenter.getComment(),\n                                             newName));\n    }\n\n    public ToggleCommentPresenter getToggleCommentPresenter() {\n        return toggleCommentPresenter;\n    }\n\n    private String extension(final String fileName) {\n        return fileName.lastIndexOf(\".\") > 0 ? fileName.substring(fileName.lastIndexOf(\".\")) : \"\";\n    }\n\n    private Validator defaultValidator() {\n        return new Validator() {\n            @Override\n            public void validate(final String value,\n                                 final ValidatorCallback callback) {\n                callback.onSuccess();\n            }\n        };\n    }\n\n    private ValidatorWithReasonCallback validatorCallback(final String commemt,\n                                                          final String baseFileName) {\n        return new ValidatorWithReasonCallback() {\n            @Override\n            public void onFailure(final String reason) {\n                if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {\n                    view.handleDuplicatedFileName();\n                } else if (ValidationErrorReason.NOT_ALLOWED.name().equals(reason)) {\n                    view.handleCopyNotAllowed();\n                } else {\n                    view.handleInvalidFileName();\n                }\n            }\n\n            @Override\n            public void onSuccess() {\n                command.execute(new FileNameAndCommitMessage(baseFileName,\n                                                             commemt));\n            }\n\n            @Override\n            public void onFailure() {\n                view.handleInvalidFileName();\n            }\n        };\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    Validator getValidator() {\n        return validator;\n    }\n\n    CommandWithFileNameAndCommitMessage getCommand() {\n        return command;\n    }\n\n    public interface View extends UberElement<CopyPopUpPresenter> {\n\n        void show();\n\n        void hide();\n\n        void handleDuplicatedFileName();\n\n        void handleInvalidFileName();\n\n        Path getTargetPath();\n\n        String getPackageName();\n\n        void handleCopyNotAllowed();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/CopyPopUpView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"body\">\n    <div data-field=\"error\" class=\"alert alert-danger alert-dismissable\">\n        <span class=\"pficon pficon-error-circle-o\"></span>\n        <span data-field=\"errorMessage\"></span>\n    </div>\n    <div>\n        <label class=\"col-sm-3 form-control-label\" data-i18n-key=\"NewName\"></label>\n        <div class=\"col-sm-9\">\n            <input type=\"text\" class=\"form-control\" data-field=\"newNameTextBox\"/>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/CopyPopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\n@FallbackImplementation\npublic class CopyPopUpView implements CopyPopUpPresenter.View,\n                                      IsElement {\n\n    @Inject\n    @DataField(\"body\")\n    Div body;\n\n    @Inject\n    @DataField(\"newNameTextBox\")\n    TextBox newNameTextBox;\n\n    @Inject\n    @DataField(\"error\")\n    Div error;\n\n    @Inject\n    @DataField(\"errorMessage\")\n    Span errorMessage;\n\n    @Inject\n    private TranslationService translationService;\n\n    private CopyPopUpPresenter presenter;\n\n    private BaseModal modal;\n\n    @Override\n    public void init(CopyPopUpPresenter presenter) {\n        this.presenter = presenter;\n        modalSetup();\n        setupComment();\n    }\n\n    @Override\n    public void show() {\n        errorSetup();\n        newNameTextBoxSetup();\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public void handleDuplicatedFileName() {\n        showError(translate(Constants.CopyPopUpView_FileAlreadyExists,\n                            newNameTextBox.getValue()));\n    }\n\n    @Override\n    public void handleInvalidFileName() {\n        showError(translate(Constants.CopyPopUpView_InvalidFileName,\n                            newNameTextBox.getValue()));\n    }\n\n    @Override\n    public Path getTargetPath() {\n        return null;\n    }\n\n    @Override\n    public String getPackageName() {\n        return null;\n    }\n\n    @Override\n    public void handleCopyNotAllowed() {\n        showError(translate(Constants.CopyPopUpView_CopyNotAllowed));\n    }\n\n    private void modalSetup() {\n        this.modal = new CommonModalBuilder()\n                .addHeader(translate(Constants.CopyPopUpView_MakeACopy))\n                .addBody(body)\n                .addFooter(footer())\n                .build();\n    }\n\n    private ModalFooter footer() {\n        GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(translate(Constants.CopyPopUpView_Cancel),\n                         cancelCommand(),\n                         ButtonType.DEFAULT);\n        footer.addButton(translate(Constants.CopyPopUpView_MakeACopy),\n                         copyCommand(),\n                         ButtonType.PRIMARY);\n        return footer;\n    }\n\n    private String translate(final String key,\n                             final Object... args) {\n        return translationService.format(key,\n                                         args);\n    }\n\n    private Command copyCommand() {\n        return () -> presenter.copy(newNameTextBox.getValue());\n    }\n\n    private void newNameTextBoxSetup() {\n        newNameTextBox.setValue(\"\");\n    }\n\n    private void errorSetup() {\n        this.error.setHidden(true);\n    }\n\n    private void showError(String errorMessage) {\n        this.errorMessage.setTextContent(errorMessage);\n        this.error.setHidden(false);\n    }\n\n    private Command cancelCommand() {\n        return () -> presenter.cancel();\n    }\n\n    private void setupComment() {\n        body.appendChild(toggleCommentPresenter().getViewElement());\n    }\n\n    private ToggleCommentPresenter toggleCommentPresenter() {\n        return presenter.getToggleCommentPresenter();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/DeletePopUpPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@ApplicationScoped\npublic class DeletePopUpPresenter {\n\n    private Validator validator;\n    private ParameterizedCommand<String> command;\n    private View view;\n    private ToggleCommentPresenter toggleCommentPresenter;\n    private boolean opened = false;\n\n    @Inject\n    public DeletePopUpPresenter(View view,\n                                ToggleCommentPresenter toggleCommentPresenter) {\n        this.view = view;\n        this.toggleCommentPresenter = toggleCommentPresenter;\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    public void show(final ParameterizedCommand<String> command) {\n        show(null,\n             command);\n    }\n\n    public void show(final Validator validator,\n                     final ParameterizedCommand<String> command) {\n        this.validator = validator == null ? defaultValidator() : validator;\n        this.command = command;\n        this.opened = true;\n        view.show();\n    }\n\n    public void cancel() {\n        this.opened = false;\n        view.hide();\n    }\n\n    Validator getValidator() {\n        return validator;\n    }\n\n    public ParameterizedCommand<String> getCommand() {\n        return command;\n    }\n\n    public boolean isOpened() {\n        return opened;\n    }\n\n    public void delete() {\n        checkNotNull(\"command\",\n                     command);\n\n        validator.validate(null,\n                           validatorCallback(toggleCommentPresenter.getComment()));\n    }\n\n    private ValidatorWithReasonCallback validatorCallback(final String comment) {\n        return new ValidatorWithReasonCallback() {\n            @Override\n            public void onFailure(final String reason) {\n                if (ValidationErrorReason.NOT_ALLOWED.name().equals(reason)) {\n                    view.handleDeleteNotAllowed();\n                } else {\n                    view.handleUnexpectedError();\n                }\n            }\n\n            @Override\n            public void onSuccess() {\n                command.execute(comment);\n                view.hide();\n                opened = false;\n            }\n\n            @Override\n            public void onFailure() {\n                view.handleUnexpectedError();\n            }\n        };\n    }\n\n    private Validator defaultValidator() {\n        return (value, callback) -> callback.onSuccess();\n    }\n\n    public void setPrompt(final String prompt) {\n        view.setPrompt(prompt);\n    }\n\n    public void setCommentIsHidden(final boolean hidden) {\n        toggleCommentPresenter.setHidden(hidden);\n    }\n\n    public ToggleCommentPresenter getToggleCommentPresenter() {\n        return toggleCommentPresenter;\n    }\n\n    public interface View extends UberElement<DeletePopUpPresenter> {\n\n        void show();\n\n        void hide();\n\n        void setPrompt(final String prompt);\n\n        void handleDeleteNotAllowed();\n\n        void handleUnexpectedError();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/DeletePopUpView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"body\">\n    <div data-field=\"error\" class=\"alert alert-danger alert-dismissable\">\n        <span class=\"pficon pficon-error-circle-o\"></span>\n        <span data-field=\"errorMessage\"></span>\n    </div>\n    <div class=\"col-sm-12\">\n        <form>\n            <p data-field=\"bodyText\" data-i18n-key=\"AreYouSure\"></p>\n        </form>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/DeletePopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Paragraph;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class DeletePopUpView implements DeletePopUpPresenter.View,\n                                        IsElement {\n\n    @Inject\n    @DataField(\"body\")\n    Div body;\n\n    @Inject\n    @DataField(\"bodyText\")\n    Paragraph bodyText;\n\n    @Inject\n    @DataField(\"error\")\n    Div error;\n\n    @Inject\n    @DataField(\"errorMessage\")\n    Span errorMessage;\n\n    @Inject\n    private TranslationService translationService;\n\n    private DeletePopUpPresenter presenter;\n\n    private BaseModal modal;\n\n    @Override\n    public void init(DeletePopUpPresenter presenter) {\n        this.presenter = presenter;\n        modalSetup();\n        setupComment();\n    }\n\n    @Override\n    public void show() {\n        errorSetup();\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public void setPrompt(final String prompt) {\n        bodyText.setTextContent(prompt);\n    }\n\n    @Override\n    public void handleDeleteNotAllowed() {\n        showError(translate(Constants.DeletePopUpView_DeleteNotAllowed));\n    }\n\n    @Override\n    public void handleUnexpectedError() {\n        showError(translate(Constants.DeletePopUpView_UnexpectedError));\n    }\n\n    private void modalSetup() {\n        this.modal = new CommonModalBuilder()\n                .addHeader(translate(Constants.DeletePopUpView_ConfirmDelete))\n                .addBody(body)\n                .addFooter(footer())\n                .build();\n    }\n\n    private ModalFooter footer() {\n        GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(translate(Constants.DeletePopUpView_Cancel),\n                         cancelCommand(),\n                         ButtonType.DEFAULT);\n        footer.addButton(translate(Constants.DeletePopUpView_Delete),\n                         deleteCommand(),\n                         IconType.REMOVE,\n                         ButtonType.DANGER);\n        return footer;\n    }\n\n    private String translate(final String key) {\n        return translationService.format(key);\n    }\n\n    private Command deleteCommand() {\n        return () -> presenter.delete();\n    }\n\n    private Command cancelCommand() {\n        return () -> presenter.cancel();\n    }\n\n    private void setupComment() {\n        body.appendChild(toggleCommentPresenter().getViewElement());\n    }\n\n    private ToggleCommentPresenter toggleCommentPresenter() {\n        return presenter.getToggleCommentPresenter();\n    }\n\n    private void showError(final String errorMessage) {\n        this.errorMessage.setTextContent(errorMessage);\n        this.error.setHidden(false);\n    }\n\n    private void errorSetup() {\n        this.error.setHidden(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RenamePopUpPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class RenamePopUpPresenter {\n\n    private static final boolean DEFAULT_DIRTY_STATUS = false;\n\n    private static final String DEFAULT_FILE_NAME = \"\";\n\n    private static final CommandWithFileNameAndCommitMessage DEFAULT_COMMAND = (c) -> {\n    };\n\n    private final View view;\n\n    private final ToggleCommentPresenter toggleCommentPresenter;\n\n    private Path path;\n\n    private Validator validator;\n\n    private CommandWithFileNameAndCommitMessage renameCommand;\n\n    private CommandWithFileNameAndCommitMessage saveAndRenameCommand;\n\n    private String originalFileName;\n\n    private boolean isDirty;\n\n    @Inject\n    public RenamePopUpPresenter(final View view,\n                                final ToggleCommentPresenter toggleCommentPresenter) {\n        this.view = view;\n        this.toggleCommentPresenter = toggleCommentPresenter;\n    }\n\n    public void show(final Path path,\n                     final Validator validator,\n                     final CommandWithFileNameAndCommitMessage renameCommand,\n                     final CommandWithFileNameAndCommitMessage saveAndRenameCommand,\n                     final boolean isDirty,\n                     final String originalFileName) {\n\n        this.validator = checkNotNull(\"validator\", validator);\n        this.path = checkNotNull(\"path\", path);\n        this.renameCommand = checkNotNull(\"renameCommand\", renameCommand);\n        this.saveAndRenameCommand = checkNotNull(\"saveAndRenameCommand\", saveAndRenameCommand);\n        this.originalFileName = checkNotNull(\"originalFileName\", originalFileName);\n        this.isDirty = checkNotNull(\"isDirty\", isDirty);\n\n        setupView();\n        showView();\n    }\n\n    void setupView() {\n        enablePrimaryButton();\n        hideSaveAndRenameIfAssetIsNotDirty();\n    }\n\n    void showView() {\n        view.setOriginalFileName(getOriginalFileName());\n        view.show();\n    }\n\n    public void show(final Path path,\n                     final CommandWithFileNameAndCommitMessage renameCommand,\n                     final String originalFileName) {\n\n        final Validator validator = defaultValidator();\n\n        show(path, validator, renameCommand, DEFAULT_COMMAND, DEFAULT_DIRTY_STATUS, originalFileName);\n    }\n\n    public void show(final Path path,\n                     final Validator validator,\n                     final CommandWithFileNameAndCommitMessage renameCommand) {\n\n        show(path, validator, renameCommand, DEFAULT_COMMAND, DEFAULT_DIRTY_STATUS, DEFAULT_FILE_NAME);\n    }\n\n    public void show(final Path path,\n                     final Validator validator,\n                     final boolean isDirty,\n                     final CommandWithFileNameAndCommitMessage renameCommand,\n                     final CommandWithFileNameAndCommitMessage saveAndRenameCommand) {\n\n        show(path, validator, renameCommand, saveAndRenameCommand, isDirty, DEFAULT_FILE_NAME);\n    }\n\n    public void show(final Path path,\n                     final CommandWithFileNameAndCommitMessage renameCommand) {\n\n        final Validator validator = defaultValidator();\n\n        show(path, validator, renameCommand, DEFAULT_COMMAND, DEFAULT_DIRTY_STATUS, DEFAULT_FILE_NAME);\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    public void rename(final String newName) {\n\n        final String fileName = newFileName(newName);\n        final String comment = toggleCommentPresenter.getComment();\n        final ValidatorWithReasonCallback callback = validatorCallback(comment, newName, renameCommand);\n\n        validator.validate(fileName, callback);\n    }\n\n    public void saveAndRename(final String newName) {\n\n        final String fileName = newFileName(newName);\n        final String comment = toggleCommentPresenter.getComment();\n        final ValidatorWithReasonCallback callback = validatorCallback(comment, newName, saveAndRenameCommand);\n\n        validator.validate(fileName, callback);\n    }\n\n    private String newFileName(final String newName) {\n\n        final String extension = extension(path.getFileName());\n\n        return newName + extension;\n    }\n\n    private String extension(final String fileName) {\n        return fileName.lastIndexOf(\".\") > 0 ? fileName.substring(fileName.lastIndexOf(\".\")) : \"\";\n    }\n\n    private ValidatorWithReasonCallback validatorCallback(final String comment,\n                                                          final String baseFileName,\n                                                          final CommandWithFileNameAndCommitMessage onSuccess) {\n\n        return new ValidatorWithReasonCallback() {\n\n            @Override\n            public void onFailure(final String reason) {\n                if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {\n                    view.handleDuplicatedFileName();\n                } else if (ValidationErrorReason.NOT_ALLOWED.name().equals(reason)) {\n                    view.handleRenameNotAllowed();\n                } else {\n                    view.handleInvalidFileName();\n                }\n            }\n\n            public void onSuccess() {\n                onSuccess.execute(new FileNameAndCommitMessage(baseFileName, comment));\n            }\n\n            public void onFailure() {\n                view.handleInvalidFileName();\n            }\n        };\n    }\n\n    boolean isDirty() {\n        return isDirty;\n    }\n\n    public void cancel() {\n        view.hide();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public ToggleCommentPresenter getToggleCommentPresenter() {\n        return toggleCommentPresenter;\n    }\n\n    private Validator defaultValidator() {\n        return (value, callback) -> callback.onSuccess();\n    }\n\n    Path getPath() {\n        return path;\n    }\n\n    Validator getValidator() {\n        return validator;\n    }\n\n    CommandWithFileNameAndCommitMessage getRenameCommand() {\n        return renameCommand;\n    }\n\n    String getOriginalFileName() {\n        return originalFileName;\n    }\n\n    void hideSaveAndRenameIfAssetIsNotDirty() {\n        view.hideSaveAndRename(!isDirty());\n    }\n\n    void enablePrimaryButton() {\n        if (isDirty()) {\n            view.saveAndRenameAsPrimary();\n        } else {\n            view.renameAsPrimary();\n        }\n    }\n\n    public interface View extends UberElemental<RenamePopUpPresenter> {\n\n        void show();\n\n        void hide();\n\n        void handleDuplicatedFileName();\n\n        void handleInvalidFileName();\n\n        void setOriginalFileName(final String fileName);\n\n        void handleRenameNotAllowed();\n\n        void renameAsPrimary();\n\n        void saveAndRenameAsPrimary();\n\n        void hideSaveAndRename(final boolean hidden);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RenamePopUpView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div>\n    <div data-field=\"modal-view\">\n        <div data-field=\"modal-body\">\n            <div data-field=\"error\" class=\"alert alert-danger alert-dismissable\">\n                <span class=\"pficon pficon-error-circle-o\"></span>\n                <span data-field=\"errorMessage\"></span>\n            </div>\n            <div>\n                <label class=\"col-sm-3 form-control-label\" data-i18n-key=\"AssetName\"></label>\n                <div class=\"col-sm-9\">\n                    <input type=\"text\" class=\"form-control\" data-field=\"newNameTextBox\"/>\n                </div>\n            </div>\n        </div>\n\n        <div data-field=\"modal-footer\">\n            <button class=\"kie-btn btn btn-default\" data-field=\"cancel\" data-i18n-key=\"Cancel\"></button>\n            <button class=\"kie-btn btn btn-default\" data-field=\"rename\" data-i18n-key=\"Rename\"></button>\n            <button class=\"kie-btn btn btn-default\" data-field=\"saveAndRename\" data-i18n-key=\"SaveAndRename\"></button>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RenamePopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.Node;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\n@Dependent\n@Templated\npublic class RenamePopUpView implements RenamePopUpPresenter.View {\n\n    @DataField(\"modal-view\")\n    private HTMLDivElement view;\n\n    @DataField(\"modal-body\")\n    private HTMLDivElement body;\n\n    @DataField(\"modal-footer\")\n    private HTMLDivElement footer;\n\n    @DataField(\"cancel\")\n    private HTMLButtonElement cancel;\n\n    @DataField(\"rename\")\n    private HTMLButtonElement rename;\n\n    @DataField(\"saveAndRename\")\n    private HTMLButtonElement saveAndRename;\n\n    @DataField(\"newNameTextBox\")\n    private HTMLInputElement newNameTextBox;\n\n    @DataField(\"error\")\n    private HTMLDivElement error;\n\n    @DataField(\"errorMessage\")\n    private HTMLElement errorMessage;\n\n    private TranslationService translationService;\n\n    private RenamePopUpPresenter presenter;\n\n    private BaseModal modal;\n\n    private String originalFileName;\n\n    @Inject\n    public RenamePopUpView(final HTMLDivElement body,\n                           final HTMLDivElement view,\n                           final HTMLButtonElement cancel,\n                           final HTMLButtonElement rename,\n                           final HTMLButtonElement saveAndRename,\n                           final HTMLDivElement footer,\n                           final HTMLInputElement newNameTextBox,\n                           final HTMLDivElement error,\n                           final @Named(\"span\") HTMLElement errorMessage,\n                           final TranslationService translationService) {\n        this.body = body;\n        this.view = view;\n        this.cancel = cancel;\n        this.footer = footer;\n        this.rename = rename;\n        this.saveAndRename = saveAndRename;\n        this.newNameTextBox = newNameTextBox;\n        this.error = error;\n        this.errorMessage = errorMessage;\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(RenamePopUpPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void show() {\n        setup();\n        modal.show();\n    }\n\n    private void setup() {\n        modalSetup();\n        errorSetup();\n        setupComment();\n        newNameTextBoxSetup();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public void handleDuplicatedFileName() {\n        showError(translate(Constants.RenamePopUpView_FileAlreadyExists, newNameTextBox.value));\n    }\n\n    @Override\n    public void handleInvalidFileName() {\n        showError(translate(Constants.RenamePopUpView_InvalidFileName, newNameTextBox.value));\n    }\n\n    @Override\n    public void setOriginalFileName(String fileName) {\n        originalFileName = fileName;\n    }\n\n    @Override\n    public void handleRenameNotAllowed() {\n        showError(translate(Constants.RenamePopUpView_RenameNotAllowed));\n    }\n\n    @EventHandler(\"newNameTextBox\")\n    public void onNewFileNameChange(final KeyUpEvent event) {\n        disableRenameButtonsIfNewNameIsNotNew();\n    }\n\n    @EventHandler(\"cancel\")\n    private void cancelCommand(final ClickEvent event) {\n        presenter.cancel();\n    }\n\n    @EventHandler(\"rename\")\n    private void onRename(final ClickEvent event) {\n        presenter.rename(newNameTextBox.value);\n    }\n\n    @EventHandler(\"saveAndRename\")\n    private void onSaveAndRename(final ClickEvent event) {\n        presenter.saveAndRename(newNameTextBox.value);\n    }\n\n    @Override\n    public void renameAsPrimary() {\n        addPrimaryClass(rename);\n        removePrimaryClass(saveAndRename);\n    }\n\n    @Override\n    public void saveAndRenameAsPrimary() {\n        addPrimaryClass(saveAndRename);\n        removePrimaryClass(rename);\n    }\n\n    @Override\n    public void hideSaveAndRename(final boolean hidden) {\n        saveAndRename.hidden = hidden;\n    }\n\n    private void modalSetup() {\n        this.modal = new CommonModalBuilder()\n                .addHeader(translate(Constants.RenamePopUpView_RenameAsset))\n                .addBody(body)\n                .addFooter(footer)\n                .build();\n    }\n\n    private void addPrimaryClass(final HTMLButtonElement buttonElement) {\n        buttonElement.classList.add(ButtonType.PRIMARY.getCssName());\n    }\n\n    private void removePrimaryClass(final HTMLButtonElement buttonElement) {\n        buttonElement.classList.remove(ButtonType.PRIMARY.getCssName());\n    }\n\n    private String translate(final String key,\n                             final Object... args) {\n        return translationService.format(key, args);\n    }\n\n    private void newNameTextBoxSetup() {\n\n        newNameTextBox.value = originalFileName;\n        disableRenameButtonsIfNewNameIsNotNew();\n    }\n\n    private void errorSetup() {\n        this.error.hidden = true;\n    }\n\n    private void disableRenameButtonsIfNewNameIsNotNew() {\n\n        final boolean disabled = newNameTextBox.value.equals(originalFileName);\n\n        rename.disabled = disabled;\n        saveAndRename.disabled = disabled;\n    }\n\n    private void showError(final String errorMessage) {\n        this.errorMessage.textContent = errorMessage;\n        this.error.hidden = false;\n    }\n\n    private void setupComment() {\n        body.appendChild(getToggleCommentElement());\n    }\n\n    private Node getToggleCommentElement() {\n\n        final ToggleCommentPresenter toggleCommentPresenter = presenter.getToggleCommentPresenter();\n        final ToggleCommentPresenter.View view = toggleCommentPresenter.getView();\n\n        return view.getElement();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RenamePopUpView.less",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.modal-dialog {\n  .kie-btn[hidden] {\n    display: none;\n  }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RestorePopUpPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class RestorePopUpPresenter {\n\n    protected ParameterizedCommand<String> command;\n    private BusyIndicatorView busyIndicatorView;\n\n    private Caller<VersionService> versionService;\n\n    private Event<RestoreEvent> restoreEvent;\n\n    private RestoreUtil restoreUtil;\n\n    private View view;\n\n    @Inject\n    public RestorePopUpPresenter(View view,\n                                 BusyIndicatorView busyIndicatorView,\n                                 Caller<VersionService> versionService,\n                                 Event<RestoreEvent> restoreEvent,\n                                 RestoreUtil restoreUtil) {\n        this.view = view;\n        this.busyIndicatorView = busyIndicatorView;\n        this.versionService = versionService;\n        this.restoreEvent = restoreEvent;\n        this.restoreUtil = restoreUtil;\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    public void restore() {\n        command.execute(view.getComment());\n        view.hide();\n    }\n\n    public void show(final ObservablePath currentPath,\n                     final String currentVersionRecordUri,\n                     final String branchName) {\n        command = restoreCommand(currentPath,\n                                 currentVersionRecordUri,\n                                 branchName);\n        view.show();\n    }\n\n    public void cancel() {\n        view.hide();\n    }\n\n    private HasBusyIndicatorDefaultErrorCallback errorCallback() {\n        return new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView);\n    }\n\n    private RemoteCallback<Path> successCallback(final String currentVersionRecordUri) {\n        return restored -> {\n            busyIndicatorView.hideBusyIndicator();\n            restoreEvent.fire(new RestoreEvent(restoreUtil.createObservablePath(\n                    restored,\n                    currentVersionRecordUri)));\n        };\n    }\n\n    public ParameterizedCommand<String> restoreCommand(final ObservablePath currentPath,\n                                                       final String currentVersionRecordUri,\n                                                       final String branchName) {\n        return comment -> {\n            busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Restoring());\n            versionService.call(successCallback(currentVersionRecordUri),\n                                errorCallback()).restore(currentPath,\n                                                         comment, branchName);\n        };\n    }\n\n    public interface View extends UberElement<RestorePopUpPresenter> {\n        void show();\n        void hide();\n        String getComment();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RestorePopUpView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"body\">\n    <div class=\"col-sm-12\">\n        <input type=\"text\" class=\"form-control\" data-field=\"commentTextBox\"/>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/RestorePopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class RestorePopUpView implements RestorePopUpPresenter.View,\n                                         IsElement {\n\n    @Inject\n    @DataField(\"body\")\n    Div body;\n    \n    @Inject\n    @DataField(\"commentTextBox\")\n    TextBox commentTextBox;\n\n    @Inject\n    private TranslationService translationService;\n\n    private RestorePopUpPresenter presenter;\n\n    private BaseModal modal;\n\n    @Override\n    public void init(RestorePopUpPresenter presenter) {\n        this.presenter = presenter;\n        modalSetup();\n    }\n\n    @Override\n    public void show() {\n        commentTextBox.setValue(\"\");\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n    \n    @Override\n    public String getComment() {\n        return commentTextBox.getValue();\n    }\n\n    private void modalSetup() {\n        this.modal = new CommonModalBuilder()\n                .addHeader(translate(Constants.RestorePopUpView_RestoreWithComments))\n                .addBody(body)\n                .addFooter(footer())\n                .build();\n        commentTextBox.setPlaceholder(translate(Constants.ToggleCommentView_EnterComment));\n    }\n\n    private ModalFooter footer() {\n        GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(translate(Constants.RestorePopUpView_Cancel),\n                         cancelCommand(),\n                         ButtonType.DEFAULT);\n        footer.addButton(translate(Constants.RestorePopUpView_Restore),\n                         restoreCommand(),\n                         ButtonType.PRIMARY);\n        return footer;\n    }\n\n    private String translate(final String key) {\n        return translationService.format(key);\n    }\n\n    private Command restoreCommand() {\n        return () -> presenter.restore();\n    }\n\n    private Command cancelCommand() {\n        return () -> presenter.cancel();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/SavePopUpPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.SaveInProgressEvent;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.uberfire.backend.vfs.PathSupport.isVersioned;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class SavePopUpPresenter {\n\n    private ParameterizedCommand<String> command;\n    private View view;\n    private Event<SaveInProgressEvent> saveInProgressEvent;\n\n    @Inject\n    public SavePopUpPresenter(View view,\n                              Event<SaveInProgressEvent> saveInProgressEvent) {\n\n        this.saveInProgressEvent = saveInProgressEvent;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    public void show(final ParameterizedCommand<String> command) {\n        this.command = command;\n        view.show();\n    }\n\n    public void show(final Path path,\n                     final ParameterizedCommand<String> command) {\n        final ParameterizedCommand<String> wrappedCommand = wrapWithSaveInProgressEvent(path,\n                                                                                        command);\n\n        if (isVersioned(path)) {\n            show(wrappedCommand);\n        } else {\n            wrappedCommand.execute(\"\");\n        }\n    }\n\n    public ParameterizedCommand<String> getCommand() {\n        return command;\n    }\n\n    public void save() {\n        checkNotNull(\"command\",\n                     command);\n        command.execute(view.getComment());\n        view.hide();\n    }\n\n    public void cancel() {\n        view.hide();\n    }\n\n    private ParameterizedCommand<String> wrapWithSaveInProgressEvent(\n            final Path path,\n            final ParameterizedCommand<String> command) {\n\n        return parameter -> {\n            command.execute(parameter);\n            saveInProgressEvent.fire(new SaveInProgressEvent(path));\n        };\n    }\n\n    public interface View extends UberElement<SavePopUpPresenter> {\n        String getComment();\n        void show();\n        void hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/SavePopUpView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"body\">\n    <div class=\"col-sm-12\">\n        <input type=\"text\" class=\"form-control\" data-field=\"commentTextBox\"/>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/SavePopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class SavePopUpView implements SavePopUpPresenter.View,\n                                      IsElement {\n\n    @Inject\n    @DataField(\"body\")\n    Div body;\n    \n    @Inject\n    @DataField(\"commentTextBox\")\n    TextBox commentTextBox;\n\n    @Inject\n    private TranslationService translationService;\n\n    private SavePopUpPresenter presenter;\n\n    private BaseModal modal;\n\n    @Override\n    public void init(SavePopUpPresenter presenter) {\n        this.presenter = presenter;\n        modalSetup();\n    }\n    \n    @Override\n    public String getComment() {\n        return commentTextBox.getValue();\n    }\n\n    @Override\n    public void show() {\n        commentTextBox.setValue(\"\");\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    private void modalSetup() {\n        this.modal = new CommonModalBuilder()\n                .addHeader(translate(Constants.SavePopUpView_SaveWithComments))\n                .addBody(body)\n                .addFooter(footer())\n                .build();\n        commentTextBox.setPlaceholder(translate(Constants.ToggleCommentView_EnterComment));\n    }\n\n    private ModalFooter footer() {\n        GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(translate(Constants.SavePopUpView_Cancel),\n                         cancelCommand(),\n                         ButtonType.DEFAULT);\n        footer.addButton(translate(Constants.SavePopUpView_Save),\n                         saveCommand(),\n                         IconType.SAVE,\n                         ButtonType.PRIMARY);\n        return footer;\n    }\n\n    private String translate(final String key) {\n        return translationService.format(key);\n    }\n\n    private Command saveCommand() {\n        return () -> presenter.save();\n    }\n\n    private Command cancelCommand() {\n        return () -> presenter.cancel();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/commons/ToggleCommentPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups.commons;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.ui.shared.TemplateUtil;\nimport org.uberfire.client.mvp.UberElemental;\n\n@Dependent\npublic class ToggleCommentPresenter {\n\n    private View view;\n\n    @Inject\n    public ToggleCommentPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    @Deprecated\n    public Element getViewElement() {\n        return TemplateUtil.asErraiElement(view.getElement());\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public String getComment() {\n        return view.getComment();\n    }\n\n    public void setHidden(final boolean hidden) {\n        view.getElement().hidden = hidden;\n    }\n\n    public interface View extends UberElemental<ToggleCommentPresenter> {\n\n        String getComment();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/commons/ToggleCommentView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div data-field=\"view\" class=\"col-sm-12\">\n    <form>\n        <div class=\"form-group\">\n            <a href=\"#\" data-field=\"addComment\" data-i18n-key=\"AddAComment\"></a>\n            <input type=\"text\" class=\"form-control\" data-field=\"commentTextBox\"/>\n        </div>\n    </form>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/commons/ToggleCommentView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups.commons;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\n\n@Dependent\n@Templated\npublic class ToggleCommentView implements ToggleCommentPresenter.View {\n\n    @DataField(\"view\")\n    private HTMLDivElement view;\n\n    @DataField(\"addComment\")\n    private HTMLAnchorElement addComment;\n\n    @DataField(\"commentTextBox\")\n    private TextBox commentTextBox;\n\n    private TranslationService translationService;\n\n    private ToggleCommentPresenter presenter;\n\n    @Inject\n    public ToggleCommentView(final HTMLDivElement view,\n                             final HTMLAnchorElement addComment,\n                             final TextBox commentTextBox,\n                             final TranslationService translationService) {\n        this.view = view;\n        this.addComment = addComment;\n        this.commentTextBox = commentTextBox;\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(final ToggleCommentPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public String getComment() {\n        return commentTextBox.getValue();\n    }\n\n    @PostConstruct\n    public void setup() {\n        commentTextBox.setText(\"\");\n        commentTextBox.setVisible(false);\n        commentTextBox.setPlaceholder(translationService.format(Constants.ToggleCommentView_EnterComment));\n    }\n\n    @EventHandler(\"addComment\")\n    public void addComment(ClickEvent event) {\n        toggleCommentTextBox();\n        event.preventDefault();\n    }\n\n    private void toggleCommentTextBox() {\n        commentTextBox.setVisible(!commentTextBox.isVisible());\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/file/popups/elemental2/Elemental2Modal.java",
    "content": "/*\n * Copyright (C) 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups.elemental2;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.TemplateUtil;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\npublic abstract class Elemental2Modal<V extends Elemental2Modal.View> {\n\n    public interface View<P extends Elemental2Modal<? extends View>> extends UberElemental<P>,\n                                                                             IsElement {\n\n        String getHeader();\n\n        HTMLElement getBody();\n\n        HTMLElement getFooter();\n    }\n\n    private final V view;\n\n    private BaseModal modal;\n\n    private boolean isShowing;\n\n    public Elemental2Modal(final V view) {\n        this.view = view;\n    }\n\n    public void setup() {\n        superSetup();\n    }\n\n    public void superSetup() {\n\n        view.init(this);\n\n        modal = new CommonModalBuilder()\n                .addHeader(getHeader())\n                .addBody(getBody())\n                .addFooter(getFooter())\n                .build();\n\n        modal.addHideHandler(i -> isShowing = false);\n    }\n\n    private String getHeader() {\n        return view.getHeader();\n    }\n\n    private org.jboss.errai.common.client.dom.HTMLElement getFooter() {\n        return TemplateUtil.asErraiElement(view.getFooter());\n    }\n\n    private org.jboss.errai.common.client.dom.HTMLElement getBody() {\n        return TemplateUtil.asErraiElement(view.getBody());\n    }\n\n    public void show() {\n        if (!isShowing) {\n            modal.show();\n            isShowing = true;\n        }\n    }\n\n    protected void setWidth(final String width) {\n        modal.setWidth(width);\n    }\n\n    public void hide() {\n        modal.hide();\n        isShowing = false;\n    }\n\n    public boolean isShowing() {\n        return isShowing;\n    }\n\n    public V getView() {\n        return view;\n    }\n\n    public BaseModal getModal() {\n        return modal;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/SaveButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\n\npublic class SaveButton\n        implements MenuCustom<Widget> {\n\n    private ButtonGroup buttonGroup = GWT.create(ButtonGroup.class);\n    private Button saveButton = GWT.create(Button.class);\n    private DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n    private Button caretButton = GWT.create(Button.class);\n    private AnchorListItem saveWithCommentsButton = GWT.create(AnchorListItem.class);\n\n    private HandlerRegistration saveButtonClickHandler;\n    private HandlerRegistration saveWithCommentsButtonClickHandler;\n\n    public SaveButton() {\n        buttonGroup.add(saveButton);\n\n        saveButton.setSize(ButtonSize.SMALL);\n        saveButton.setText(CommonConstants.INSTANCE.Save());\n\n        buttonGroup.add(caretButton);\n\n        caretButton.setToggleCaret(true);\n        caretButton.setDataToggle(Toggle.DROPDOWN);\n        caretButton.setSize(ButtonSize.SMALL);\n        caretButton.setMarginRight(10);\n\n        buttonGroup.add(dropDownMenu);\n\n        dropDownMenu.add(saveWithCommentsButton);\n\n        saveWithCommentsButton.setText(CommonConstants.INSTANCE.SaveWithComments());\n    }\n\n    @Override\n    public Widget build() {\n        return buttonGroup;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return saveButton.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        saveButton.setEnabled(enabled);\n        caretButton.setEnabled(enabled);\n    }\n\n    @Override\n    public String getContributionPoint() {\n        return null;\n    }\n\n    @Override\n    public String getCaption() {\n        return null;\n    }\n\n    @Override\n    public MenuPosition getPosition() {\n        return null;\n    }\n\n    @Override\n    public int getOrder() {\n        return 0;\n    }\n\n    @Override\n    public void accept(final MenuVisitor visitor) {\n        visitor.visit(this);\n    }\n\n    @Override\n    public void addEnabledStateChangeListener(EnabledStateChangeListener listener) {\n\n    }\n\n    @Override\n    public String getIdentifier() {\n        return null;\n    }\n\n    public void setTextToSave() {\n        saveButton.setText(CommonConstants.INSTANCE.Save());\n        saveWithCommentsButton.setText(CommonConstants.INSTANCE.SaveWithComments());\n    }\n\n    public void setTextToRestore() {\n        saveButton.setText(CommonConstants.INSTANCE.Restore());\n        saveWithCommentsButton.setText(CommonConstants.INSTANCE.RestoreWithComments());\n    }\n\n    public void setCommand(Command command) {\n        if (saveButtonClickHandler != null) {\n            saveButtonClickHandler.removeHandler();\n        }\n        saveButtonClickHandler = saveButton.addClickHandler(e -> command.execute());\n\n        if (saveWithCommentsButtonClickHandler != null) {\n            saveWithCommentsButtonClickHandler.removeHandler();\n        }\n        caretButton.setVisible(false);\n    }\n\n    public void setCommand(ParameterizedCommand<Boolean> command) {\n        if (saveButtonClickHandler != null) {\n            saveButtonClickHandler.removeHandler();\n        }\n        saveButtonClickHandler = saveButton.addClickHandler(e -> command.execute(false));\n\n        if (saveWithCommentsButtonClickHandler != null) {\n            saveWithCommentsButtonClickHandler.removeHandler();\n        }\n        saveWithCommentsButtonClickHandler = saveWithCommentsButton.addClickHandler(e -> command.execute(true));\n        caretButton.setVisible(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionHistoryPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport com.google.gwt.view.client.HasData;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class VersionHistoryPresenter\n        implements VersionHistoryPresenterView.Presenter,\n                   IsWidget {\n\n    private VersionHistoryPresenterView view;\n    private Caller<VersionService> versionService;\n\n    private AsyncDataProvider<VersionRecord> dataProvider;\n\n    private Event<VersionSelectedEvent> versionSelectedEvent;\n\n    private Path path;\n    private String version;\n    private List<VersionRecord> records;\n    private ParameterizedCommand<VersionRecord> onCurrentVersionRefreshed;\n\n    @Inject\n    public VersionHistoryPresenter(\n            final VersionHistoryPresenterView view,\n            Caller<VersionService> versionService,\n            Event<VersionSelectedEvent> versionSelectedEvent) {\n        this.view = view;\n        this.versionService = versionService;\n        this.versionSelectedEvent = versionSelectedEvent;\n\n        view.setPresenter(this);\n        dataProvider = new AsyncDataProvider<VersionRecord>() {\n            @Override\n            protected void onRangeChanged(HasData<VersionRecord> display) {\n                if (records != null) {\n                    updateRowCount(records.size(),\n                                   true);\n                    updateRowData(0,\n                                  records);\n                }\n            }\n        };\n    }\n\n    public void init(final Path path) {\n        this.path = path;\n    }\n\n    private void loadContent() {\n        versionService.call(getRemoteCallback()).getVersions(path);\n    }\n\n    private RemoteCallback<List<VersionRecord>> getRemoteCallback() {\n        return new RemoteCallback<List<VersionRecord>>() {\n            @Override\n            public void callback(List<VersionRecord> records) {\n                view.setup(version,\n                           dataProvider);\n                Collections.reverse(records);\n                VersionHistoryPresenter.this.records = records;\n                view.refreshGrid();\n                doOnCurrentVersionRefreshed(version);\n            }\n        };\n    }\n\n    @Override\n    public void onSelect(VersionRecord record) {\n        if (!record.id().equals(version)) {\n            view.showLoading();\n            versionSelectedEvent.fire(\n                    new VersionSelectedEvent(\n                            path,\n                            record\n                    ));\n        }\n    }\n\n    public void onVersionChange(@Observes VersionSelectedEvent event) {\n        if (path != null) {\n            if (path.toURI().equals(event.getPathToFile().toURI())) {\n                version = event.getVersionRecord().id();\n                loadContent();\n            }\n        }\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void refresh(String version) {\n        this.version = version;\n        loadContent();\n    }\n\n    public void setOnCurrentVersionRefreshed(ParameterizedCommand<VersionRecord> onCurrentVersionRefreshed) {\n        this.onCurrentVersionRefreshed = onCurrentVersionRefreshed;\n    }\n\n    private void doOnCurrentVersionRefreshed(String version) {\n        if (onCurrentVersionRefreshed != null && records != null && version != null) {\n            for (VersionRecord record : records) {\n                if (version.equals(record.id())) {\n                    onCurrentVersionRefreshed.execute(record);\n                    break;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionHistoryPresenterView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\npublic interface VersionHistoryPresenterView\n        extends IsWidget {\n\n    void refreshGrid();\n\n    void setup(String version,\n               AsyncDataProvider<VersionRecord> dataProvider);\n\n    void setPresenter(Presenter presenter);\n\n    void showLoading();\n\n    interface Presenter {\n\n        void onSelect(VersionRecord record);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionHistoryPresenterViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.Date;\n\nimport com.google.gwt.cell.client.DateCell;\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\npublic class VersionHistoryPresenterViewImpl\n        extends Composite\n        implements VersionHistoryPresenterView {\n\n    private PagedTable table = new PagedTable();\n\n    private Presenter presenter;\n    private String version;\n\n    public VersionHistoryPresenterViewImpl() {\n        initWidget(table);\n        table.getElement().setAttribute(\"data-uf-lock\",\n                                        \"false\");\n        Column<VersionRecord, String> column = new Column<VersionRecord, String>(new ButtonCell()) {\n\n            @Override\n            public String getValue(VersionRecord object) {\n                if (version.equals(object.id())) {\n                    return CommonConstants.INSTANCE.Current();\n                } else {\n                    return CommonConstants.INSTANCE.Select();\n                }\n            }\n        };\n        table.addColumn(column,\n                        \"\");\n        column.setFieldUpdater(new FieldUpdater<VersionRecord, String>() {\n            @Override\n            public void update(int index,\n                               VersionRecord record,\n                               String value) {\n                presenter.onSelect(record);\n            }\n        });\n        table.addColumn(new Column<VersionRecord, Date>(new DateCell()) {\n\n                            @Override\n                            public Date getValue(VersionRecord object) {\n                                return object.date();\n                            }\n                        },\n                        CommonConstants.INSTANCE.Date());\n        table.addColumn(new Column<VersionRecord, String>(new TextCell()) {\n\n                            @Override\n                            public String getValue(VersionRecord object) {\n                                return object.comment();\n                            }\n                        },\n                        CommonConstants.INSTANCE.CommitMessage());\n        table.addColumn(new Column<VersionRecord, String>(new TextCell()) {\n\n                            @Override\n                            public String getValue(VersionRecord object) {\n                                return object.author();\n                            }\n                        },\n                        CommonConstants.INSTANCE.Author());\n    }\n\n    @Override\n    public void setup(String version,\n                      AsyncDataProvider<VersionRecord> dataProvider) {\n        this.version = version;\n        if (!dataProvider.getDataDisplays().contains(table)) {\n            dataProvider.addDataDisplay(table);\n        }\n    }\n\n    @Override\n    public void refreshGrid() {\n        table.refresh();\n    }\n\n    @Override\n    public void setPresenter(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showLoading() {\n        BusyPopup.showMessage(CommonConstants.INSTANCE.Loading());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionHistoryScreenPlace.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\npublic class VersionHistoryScreenPlace\n        extends DefaultPlaceRequest {\n\n    public final static String URI = \"uri\";\n    public final static String FILENAME = \"filename\";\n    public final static String VERSION = \"version\";\n\n    public VersionHistoryScreenPlace(ObservablePath pathToFile,\n                                     String filename,\n                                     String version) {\n        super(\"versionHistoryScreen\");\n\n        addParameter(URI,\n                     pathToFile.toURI());\n        addParameter(FILENAME,\n                     filename);\n        addParameter(VERSION,\n                     version);\n    }\n\n    @Override\n    public String toString() {\n        return \"VersionHistoryScreenPlace [identifier=\" + identifier + \", parameters=\" + parameters + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuDropDownButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.HasEnabled;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\n\npublic class VersionMenuDropDownButton\n        implements VersionMenuDropDownButtonView.Presenter,\n                   HasEnabled,\n                   IsWidget {\n\n    private List<VersionRecord> versions;\n    private Callback<VersionRecord> selectionCallback;\n    private Command showMore;\n    private String version;\n    private VersionMenuDropDownButtonView view;\n\n    public VersionMenuDropDownButton() {\n    }\n\n    @Inject\n    public VersionMenuDropDownButton(VersionMenuDropDownButtonView view) {\n        this.view = view;\n        view.setPresenter(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void setItems(List<VersionRecord> versions) {\n        if (this.versions == null || (versions.size() > this.versions.size())) {\n            this.versions = versions;\n        }\n        updateTitle();\n    }\n\n    @Override\n    public void onMenuOpening() {\n\n        PortablePreconditions.checkNotNull(\"version\",\n                                           version);\n        PortablePreconditions.checkNotNull(\"versions\",\n                                           versions);\n\n        view.clear();\n\n        boolean currentHasBeenAdded = false;\n        int versionIndex = versions.size();\n\n        ArrayList<VersionRecord> reversedList = new ArrayList<VersionRecord>(versions);\n        Collections.reverse(reversedList);\n        int versionsDisplayed = 0;\n\n        for (final VersionRecord versionRecord : reversedList) {\n\n            boolean isSelected = isSelected(versionRecord);\n\n            if (isSelected) {\n                currentHasBeenAdded = true;\n            }\n\n            if (versionIndex > (versions.size() - 7) || versions.size() <= 7) {\n\n                view.addLabel(versionRecord,\n                              isSelected,\n                              versionIndex);\n            } else {\n\n                if (!currentHasBeenAdded) {\n                    view.addLabel(getCurrentVersionRecord(),\n                                  true,\n                                  getCurrentVersionIndex());\n                    versionsDisplayed++;\n                }\n\n                addShowMoreLabel(versionsDisplayed);\n\n                break;\n            }\n\n            versionIndex--;\n            versionsDisplayed++;\n        }\n    }\n\n    @Override\n    public void resetVersions() {\n        versions = null;\n        version = null;\n    }\n\n    private void updateTitle() {\n        if (versions != null && version != null) {\n            if (!versions.isEmpty() && version.equals(versions.get(versions.size() - 1).id())) {\n                view.setTextToLatest();\n            } else {\n                view.setTextToVersion(getCurrentVersionIndex());\n            }\n        }\n    }\n\n    private VersionRecord getCurrentVersionRecord() {\n        for (VersionRecord versionRecord : versions) {\n            if (versionRecord.id().equals(version)) {\n                return versionRecord;\n            }\n        }\n        return null;\n    }\n\n    private int getCurrentVersionIndex() {\n        for (int i = 0; i < versions.size(); i++) {\n            if (versions.get(i).id().equals(version)) {\n                return i + 1;\n            }\n        }\n        return -1;\n    }\n\n    private boolean isSelected(VersionRecord versionRecord) {\n        return versionRecord.id().equals(version);\n    }\n\n    private void addShowMoreLabel(int versionIndex) {\n        view.addViewAllLabel(\n                versions.size() - versionIndex,\n                new Command() {\n                    @Override\n                    public void execute() {\n                        showMore.execute();\n                    }\n                });\n    }\n\n    public void addSelectionCallback(Callback<VersionRecord> selectionCallback) {\n        this.selectionCallback = selectionCallback;\n    }\n\n    public void setShowMoreCommand(Command showMore) {\n        this.showMore = showMore;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n        updateTitle();\n    }\n\n    @Override\n    public void onVersionRecordSelected(VersionRecord result) {\n        if (selectionCallback != null) {\n            selectionCallback.callback(result);\n        }\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return view.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        view.setEnabled(enabled);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuDropDownButtonView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.user.client.ui.HasEnabled;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\n\npublic interface VersionMenuDropDownButtonView\n        extends IsWidget,\n                HasEnabled {\n\n    void setPresenter(final Presenter presenter);\n\n    void clear();\n\n    void setTextToLatest();\n\n    void setTextToVersion(final int versionIndex);\n\n    void addLabel(final VersionRecord versionRecord,\n                  final boolean isSelected,\n                  final int versionIndex);\n\n    void addViewAllLabel(final int index,\n                         final Command command);\n\n    interface Presenter {\n\n        void onVersionRecordSelected(VersionRecord result);\n\n        void onMenuOpening();\n\n        /**\n         * Clears the version and versions from the Presenter's internal state. This is required if\n         * you want to reinitialise the VersionRecordManager with history for a different Path to\n         * which it was originally initialised for.\n         */\n        void resetVersions();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuDropDownButtonViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\n\npublic class VersionMenuDropDownButtonViewImpl\n        extends Composite\n        implements VersionMenuDropDownButtonView {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField\n    Button button;\n    @UiField\n    DropDownMenu menuItems;\n    private Presenter presenter;\n\n    public VersionMenuDropDownButtonViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        button.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n            }\n        });\n    }\n\n    @Override\n    public void setPresenter(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        menuItems.clear();\n    }\n\n    @Override\n    public void addViewAllLabel(final int index,\n                                final Command command) {\n        menuItems.add(new ViewAllLabel(index,\n                                       command));\n    }\n\n    @Override\n    public void setTextToVersion(int versionIndex) {\n        button.setText(CommonConstants.INSTANCE.Version(versionIndex));\n    }\n\n    @Override\n    public void setTextToLatest() {\n        button.setText(CommonConstants.INSTANCE.LatestVersion());\n    }\n\n    @Override\n    public void addLabel(VersionRecord versionRecord,\n                         boolean isSelected,\n                         int versionIndex) {\n        VersionMenuItemLabel widget = new VersionMenuItemLabel(\n                versionRecord,\n                versionIndex,\n                isSelected,\n                new Callback<VersionRecord>() {\n                    @Override\n                    public void callback(VersionRecord result) {\n                        presenter.onVersionRecordSelected(result);\n                    }\n                });\n        widget.setWidth(\"400px\");\n        menuItems.add(widget);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return button.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        button.setEnabled(enabled);\n    }\n\n    @UiHandler(\"button\")\n    public void handleClick(ClickEvent event) {\n        presenter.onMenuOpening();\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, VersionMenuDropDownButtonViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuDropDownButtonViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants\"/>\n\n  <b:ButtonGroup>\n    <b:Button ui:field=\"button\" dataToggle=\"DROPDOWN\" text=\"{i18n.LatestVersion}\" toggleCaret=\"true\" size=\"SMALL\"/>\n    <b:DropDownMenu ui:field=\"menuItems\" addStyleNames=\"dropdown-menu-right\"/>\n  </b:ButtonGroup>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\n\npublic class VersionMenuItem\n        implements MenuCustom<Widget> {\n\n    private VersionMenuDropDownButton button;\n\n    public VersionMenuItem(VersionMenuDropDownButton button) {\n        this.button = button;\n    }\n\n    @Override\n    public Widget build() {\n        return button.asWidget();\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return button.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        button.setEnabled(enabled);\n    }\n\n    @Override\n    public String getContributionPoint() {\n        return null;\n    }\n\n    @Override\n    public String getCaption() {\n        return null;\n    }\n\n    @Override\n    public MenuPosition getPosition() {\n        return null;\n    }\n\n    @Override\n    public int getOrder() {\n        return 0;\n    }\n\n    @Override\n    public void accept(final MenuVisitor visitor) {\n        visitor.visit(this);\n    }\n\n    @Override\n    public void addEnabledStateChangeListener(EnabledStateChangeListener listener) {\n\n    }\n\n    @Override\n    public String getIdentifier() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuItemLabel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.InlineLabel;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\npublic class VersionMenuItemLabel\n        extends Composite {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final Callback<VersionRecord> selectionCallback;\n    @UiField\n    VersionMenuItemStyle style;\n    @UiField\n    FocusPanel base;\n    @UiField\n    InlineLabel author;\n    @UiField\n    InlineLabel date;\n    @UiField\n    Label comment;\n    @UiField\n    HTMLPanel panel;\n    @UiField\n    InlineLabel number;\n    @UiField\n    DivElement authorContainer;\n    private VersionRecord versionRecord;\n\n    public VersionMenuItemLabel(\n            VersionRecord versionRecord,\n            Integer number,\n            boolean isSelected,\n            Callback<VersionRecord> selectionCallback) {\n\n        this.versionRecord = versionRecord;\n        initWidget(uiBinder.createAndBindUi(this));\n\n        if (isSelected) {\n            setSelected();\n        }\n\n        this.selectionCallback = selectionCallback;\n        this.number.setText(number.toString());\n        author.setText(versionRecord.author());\n        date.setText(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_SHORT).format(versionRecord.date()));\n        comment.setText(snip(versionRecord.comment()));\n        base.setTitle(versionRecord.comment());\n    }\n\n    private void setSelected() {\n        panel.addStyleName(style.selected());\n        panel.removeStyleName(style.normal());\n        authorContainer.addClassName(style.authorSelected());\n        authorContainer.removeClassName(style.author());\n    }\n\n    private String snip(String comment) {\n        if (comment != null && comment.length() >= 60) {\n            return comment.substring(0,\n                                     58) + \" ...\";\n        } else {\n            return comment;\n        }\n    }\n\n    @UiHandler(\"base\")\n    public void handleClick(ClickEvent event) {\n        if (selectionCallback != null) {\n            selectionCallback.callback(versionRecord);\n        }\n    }\n\n    public interface VersionMenuItemStyle\n            extends CssResource {\n\n        String normal();\n\n        String selected();\n\n        String comment();\n\n        String version();\n\n        String author();\n\n        String authorSelected();\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, VersionMenuItemLabel> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionMenuItemLabel.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'\n    >\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style type=\"org.uberfire.ext.editor.commons.client.history.VersionMenuItemLabel.VersionMenuItemStyle\">\n    .normal {\n      width: 95%;\n      height: 40px;\n      font-size: 10px;\n      padding: 3px 10px 3px 10px;\n      margin: 3px 3px 3px 3px;\n    }\n\n    .selected {\n      width: 95%;\n      height: 40px;\n      font-size: 10px;\n      padding: 3px 10px 3px 10px;\n      margin: 3px 3px 3px 3px;\n      background-color: lightblue;\n    }\n\n    .comment {\n      clear: both;\n      height: 20px;\n      font-size: 12px;\n      padding-left: 10px;\n    }\n\n    .version {\n      font-weight: bold;\n      font-size: 12px;\n    }\n\n    .author {\n      color: lightgray;\n    }\n\n    .authorSelected {\n      color: white;\n    }\n\n  </ui:style>\n\n  <gwt:FocusPanel ui:field=\"base\">\n\n    <gwt:HTMLPanel ui:field=\"panel\" addStyleNames='{style.normal}'>\n      <div style=\"clear:both;\">\n        <div style=\"float:left\">\n          <gwt:InlineLabel text='{i18n.Version}' addStyleNames='{style.version}'/>\n          <gwt:InlineLabel ui:field=\"number\"  addStyleNames='{style.version}'/>\n        </div>\n        <div ui:field=\"authorContainer\" class='{style.author}' style=\"float:right\">\n          <gwt:InlineLabel text='{i18n.by}'/>\n          <gwt:InlineLabel ui:field=\"author\"/>\n          <gwt:InlineLabel text='{i18n.on}'/>\n          <gwt:InlineLabel ui:field=\"date\"/>\n        </div>\n      </div>\n      <div class='{style.comment}'>\n        <gwt:Label ui:field=\"comment\"/>\n      </div>\n    </gwt:HTMLPanel>\n\n  </gwt:FocusPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/VersionRecordManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.client.file.popups.RestorePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\npublic class VersionRecordManager {\n\n    private VersionMenuDropDownButton versionMenuDropDownButton;\n    private Event<VersionSelectedEvent> versionSelectedEvent;\n\n    private RestorePopUpPresenter restorePopUpPresenter;\n    private RestoreUtil restoreUtil;\n    private Caller<VersionService> versionService;\n\n    private Callback<VersionRecord> selectionCallback;\n    private List<VersionRecord> versions;\n    private ObservablePath pathToLatest;\n    private String version;\n    private SaveButton saveButton;\n    private CurrentBranch currentBranch;\n\n    @Inject\n    public VersionRecordManager(final VersionMenuDropDownButton versionMenuDropDownButton,\n                                final SaveButton saveButton,\n                                final RestorePopUpPresenter restorePopUpPresenter,\n                                final RestoreUtil restoreUtil,\n                                final Event<VersionSelectedEvent> versionSelectedEvent,\n                                final Caller<VersionService> versionService,\n                                @Customizable final CurrentBranch currentBranch) {\n        this.restorePopUpPresenter = restorePopUpPresenter;\n        this.versionMenuDropDownButton = versionMenuDropDownButton;\n        this.saveButton = saveButton;\n        this.versionSelectedEvent = versionSelectedEvent;\n\n        versionMenuDropDownButton.addSelectionCallback(new Callback<VersionRecord>() {\n            @Override\n            public void callback(VersionRecord versionRecord) {\n                fireVersionSelected(versionRecord);\n            }\n        });\n\n        this.restoreUtil = restoreUtil;\n        this.versionService = versionService;\n        this.currentBranch = currentBranch;\n    }\n\n    private void fireVersionSelected(final VersionRecord versionRecord) {\n        versionSelectedEvent.fire(new VersionSelectedEvent(getPathToLatest(),\n                                                           versionRecord));\n    }\n\n    public void init(final String version,\n                     final ObservablePath path,\n                     final Callback<VersionRecord> selectionCallback) {\n\n        clear();\n\n        PortablePreconditions.checkNotNull(\"path\",\n                                           path);\n        this.selectionCallback = PortablePreconditions.checkNotNull(\"selectionCallback\",\n                                                                    selectionCallback);\n\n        this.version = version;\n\n        if (version == null) {\n            setPathToLatest(path);\n        }\n\n        loadVersions(path);\n    }\n\n    public MenuItem buildMenu() {\n        return new VersionMenuItem(versionMenuDropDownButton);\n    }\n\n    public void setVersions(final List<VersionRecord> versions) {\n        if (version == null) {\n            version = versions.get(versions.size() - 1).id();\n        }\n\n        setVersions(versions,\n                    version);\n    }\n\n    private void setVersions(final List<VersionRecord> versions,\n                             final String version) {\n        PortablePreconditions.checkNotNull(\"versions\",\n                                           versions);\n\n        resolveVersions(versions);\n\n        updateSaveButtonText();\n\n        versionMenuDropDownButton.setItems(versions);\n        versionMenuDropDownButton.setVersion(version);\n    }\n\n    public void setShowMoreCommand(final Command showMore) {\n        versionMenuDropDownButton.setShowMoreCommand(showMore);\n    }\n\n    private void resolveVersions(final List<VersionRecord> versions) {\n        if (this.versions == null || versions.size() > this.versions.size()) {\n            this.versions = versions;\n        }\n    }\n\n    public MenuItem newSaveMenuItem(final Command command) {\n        saveButton.setCommand(command);\n        return saveButton;\n    }\n\n    public MenuItem newSaveMenuItem(final ParameterizedCommand<Boolean> command) {\n        saveButton.setCommand(command);\n        return saveButton;\n    }\n\n    public boolean isLatest(final VersionRecord versionRecord) {\n        return versions.get(versions.size() - 1).id().equals(versionRecord.id());\n    }\n\n    public ObservablePath getPathToLatest() {\n        return pathToLatest;\n    }\n\n    private void setPathToLatest(final ObservablePath pathToLatest) {\n        this.pathToLatest = PortablePreconditions.checkNotNull(\"pathToLatest\",\n                                                               pathToLatest);\n    }\n\n    public void onVersionSelectedEvent(final @Observes VersionSelectedEvent event) {\n        if (event.getPathToFile().equals(getPathToLatest()) && selectionCallback != null) {\n            selectionCallback.callback(event.getVersionRecord());\n        }\n    }\n\n    void updateSaveButtonText() {\n        if (saveButton != null) {\n            if (isCurrentLatest()) {\n                saveButton.setTextToSave();\n            } else if (versions != null) {\n                saveButton.setTextToRestore();\n            }\n        }\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public void setVersion(final String version) {\n        this.version = PortablePreconditions.checkNotNull(\"version\",\n                                                          version);\n\n        versionMenuDropDownButton.setVersion(version);\n        updateSaveButtonText();\n    }\n\n    public ObservablePath getCurrentPath() {\n        if (isCurrentLatest()) {\n            return getPathToLatest();\n        } else {\n            return restoreUtil.createObservablePath(getPathToLatest(),\n                                                    getCurrentVersionRecordUri());\n        }\n    }\n\n    public boolean isCurrentLatest() {\n        return versions == null || getLatestVersionRecord().id().equals(version);\n    }\n\n    private VersionRecord getLatestVersionRecord() {\n        return versions.get(versions.size() - 1);\n    }\n\n    private String getCurrentVersionRecordUri() {\n        VersionRecord record = getCurrentVersionRecord();\n        if (record == null) {\n            return getPathToLatest().toURI();\n        } else {\n            return record.uri();\n        }\n    }\n\n    private VersionRecord getCurrentVersionRecord() {\n        for (VersionRecord versionRecord : versions) {\n            if (versionRecord.id().equals(version)) {\n                return versionRecord;\n            }\n        }\n        return null;\n    }\n\n    public void restoreToCurrentVersion(boolean withComments) {\n        if (withComments)\n            restorePopUpPresenter.show(getCurrentPath(),\n                                       getCurrentVersionRecordUri(),\n                                       this.currentBranch.getName());\n        else {\n            restorePopUpPresenter.restoreCommand(getCurrentPath(),\n                                                 getCurrentVersionRecordUri(),\n                                                 this.currentBranch.getName())\n                                 .execute(\"\");\n        }\n    }\n\n    private void loadVersions(final ObservablePath path) {\n        loadVersions(path,\n                     new Callback<List<VersionRecord>>() {\n                         @Override\n                         public void callback(final List<VersionRecord> records) {\n                             doesTheVersionExist(records);\n                         }\n                     });\n    }\n\n    private void doesTheVersionExist(final List<VersionRecord> records) {\n        boolean found = false;\n        for (VersionRecord versionRecord : records) {\n            if (versionRecord.id().equals(version)) {\n                found = true;\n                break;\n            }\n        }\n        if (!found) {\n            throw new IllegalArgumentException(\"Unknown version\");\n        }\n    }\n\n    public void reloadVersions(final Path path) {\n        loadVersions(path,\n                     new Callback<List<VersionRecord>>() {\n                         @Override\n                         public void callback(final List<VersionRecord> records) {\n                             setVersion(records.get(records.size() - 1).id());\n                         }\n                     });\n    }\n\n    private void loadVersions(final Path path,\n                              final Callback<List<VersionRecord>> callback) {\n        versionService.call(new RemoteCallback<List<VersionRecord>>() {\n            @Override\n            public void callback(final List<VersionRecord> records) {\n                String uri = path.toURI();\n\n                // We should not recreate the path to latest,\n                // since the new path instance will not have version support\n                if (!path.equals(pathToLatest)) {\n                    setPathToLatest(restoreUtil.createObservablePath(path,\n                                                                     uri));\n                }\n                if (!records.isEmpty()) {\n                    setVersions(records);\n                    callback.callback(records);\n                }\n            }\n        }).getVersions(path);\n    }\n\n    private void onRestore(final @Observes RestoreEvent restore) {\n        if (getCurrentPath() != null &&\n                getCurrentPath().equals(restore.getPath()) &&\n                saveButton != null) {\n            saveButton.setTextToSave();\n        }\n    }\n\n    public void clear() {\n        selectionCallback = null;\n        versions = null;\n        pathToLatest = null;\n        version = null;\n        versionMenuDropDownButton.resetVersions();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/ViewAllLabel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.mvp.Command;\n\npublic class ViewAllLabel\n        extends Composite {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField\n    Label amount;\n    @UiField\n    Label link;\n    private Command showAllCommand;\n    public ViewAllLabel(Integer amount,\n                        Command showAllCommand) {\n        this.showAllCommand = showAllCommand;\n\n        initWidget(uiBinder.createAndBindUi(this));\n\n        this.amount.setText(amount.toString());\n    }\n\n    @UiHandler(\"link\")\n    public void handleClick(ClickEvent event) {\n        showAllCommand.execute();\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, ViewAllLabel> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/ViewAllLabel.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'\n    >\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .general {\n      width: 400px;\n      height: 10px;\n      font-size: 10px;\n      padding: 20px 10px 15px 10px;\n      margin: 3px 3px 3px 3px;\n    }\n\n    .comment {\n      height: 20px;\n      font-size: 12px;\n    }\n\n    .link {\n      color: blue;\n    }\n  </ui:style>\n\n  <gwt:FocusPanel ui:field=\"base\">\n    <gwt:HTMLPanel addStyleNames='{style.general}'>\n      <gwt:InlineLabel ui:field=\"amount\"/>\n      <gwt:InlineLabel text='{i18n.More}'/>\n      <gwt:InlineLabel text=\"(\"/>\n      <gwt:InlineLabel ui:field=\"link\" addStyleNames='{style.link}' text='{i18n.ShowAll}'/>\n      <gwt:InlineLabel text=\")\"/>\n    </gwt:HTMLPanel>\n\n  </gwt:FocusPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/history/event/VersionSelectedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history.event;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\npublic class VersionSelectedEvent {\n\n    private VersionRecord versionRecord;\n    private Path pathToFile;\n\n    public VersionSelectedEvent(Path pathToFile,\n                                VersionRecord versionRecord) {\n        this.pathToFile = PortablePreconditions.checkNotNull(\"pathToFile\",\n                                                             pathToFile);\n        this.versionRecord = PortablePreconditions.checkNotNull(\"versionRecord\",\n                                                                versionRecord);\n    }\n\n    public VersionRecord getVersionRecord() {\n        return versionRecord;\n    }\n\n    public Path getPathToFile() {\n        return pathToFile;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.htmleditor.HtmlEditorService;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\n@Dependent\n@WorkbenchEditor(identifier = \"HtmlEditor\", supportedTypes = HtmlResourceType.class)\npublic class HtmlEditor extends BaseEditor<String, DefaultMetadata> {\n\n    private HtmlResourceType htmlResourceType;\n\n    private HtmlEditorPresenter editor;\n\n    private Caller<HtmlEditorService> htmlEditorService;\n\n    @Inject\n    public HtmlEditor(final HtmlResourceType htmlResourceType,\n                      final HtmlEditorPresenter editor,\n                      final Caller<HtmlEditorService> htmlEditorService) {\n        super(editor.getView());\n        this.htmlResourceType = htmlResourceType;\n        this.editor = editor;\n        this.htmlEditorService = htmlEditorService;\n    }\n\n    @PostConstruct\n    public void init() {\n        editor.load();\n    }\n\n    @Override\n    protected Supplier<String> getContentSupplier() {\n        return editor::getContent;\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        init(path,\n             place,\n             htmlResourceType,\n             SAVE,\n             COPY,\n             RENAME,\n             DELETE);\n    }\n\n    @Override\n    protected void loadContent() {\n        baseView.hideBusyIndicator();\n        htmlEditorService.call((String htmlContent) -> {\n            editor.setContent(htmlContent);\n        }).load(versionRecordManager.getCurrentPath());\n    }\n\n    @Override\n    protected void save() {\n        final String htmlContent = editor.getContent();\n        htmlEditorService.call(getSaveSuccessCallback(htmlContent.hashCode())).save(versionRecordManager.getCurrentPath(),\n                                                                                    htmlContent,\n                                                                                    null,\n                                                                                    null);\n        concurrentUpdateSessionInfo = null;\n    }\n\n    @Override\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return htmlEditorService;\n    }\n\n    @Override\n    protected Caller<? extends SupportsSaveAndRename<String, DefaultMetadata>> getSaveAndRenameServiceCaller() {\n        return htmlEditorService;\n    }\n\n    @Override\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return htmlEditorService;\n    }\n\n    @Override\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @Override\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return CommonConstants.INSTANCE.HtmlEditor() + \" [\" + versionRecordManager.getCurrentPath().getFileName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return editor.getView();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorLibraryLoader.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.ext.widgets.common.client.resources.HtmlEditorResources;\n\nimport static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW;\n\n@ApplicationScoped\npublic class HtmlEditorLibraryLoader {\n\n    private boolean scriptsAreLoaded = false;\n\n    public void ensureLibrariesAreAvailable() {\n        if (!scriptsAreLoaded) {\n            injectScripts();\n            scriptsAreLoaded = true;\n        }\n    }\n\n    void injectScripts() {\n        ScriptInjector.fromString(HtmlEditorResources.INSTANCE.wysihtml().getText()).setWindow(TOP_WINDOW).inject();\n        ScriptInjector.fromString(HtmlEditorResources.INSTANCE.wysihtmlAllCommands().getText()).setWindow(TOP_WINDOW).inject();\n        ScriptInjector.fromString(HtmlEditorResources.INSTANCE.wysihtmlTableEditing().getText()).setWindow(TOP_WINDOW).inject();\n        ScriptInjector.fromString(HtmlEditorResources.INSTANCE.wysihtmlToolbar().getText()).setWindow(TOP_WINDOW).inject();\n        ScriptInjector.fromString(HtmlEditorResources.INSTANCE.parserRules().getText()).setWindow(TOP_WINDOW).inject();\n        PatternFlyBootstrapper.ensurejQueryIsAvailable();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\n\n@Dependent\npublic class HtmlEditorPresenter {\n\n    private final View view;\n\n    @Inject\n    public HtmlEditorPresenter(final View view) {\n        this.view = view;\n    }\n\n    public void load() {\n        view.load();\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public String getContent() {\n        return view.getContent();\n    }\n\n    public void setContent(final String content) {\n        view.setContent(content);\n    }\n\n    public void destroy() {\n        view.destroy();\n    }\n\n    public interface View extends UberElement<HtmlEditorPresenter>,\n                                  BaseEditorView {\n\n        String getContent();\n\n        void setContent(String content);\n\n        void load();\n\n        void destroy();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorView.css",
    "content": ".wysiwyg-font-size-smaller {\n    font-size: smaller;\n}\n\n.wysiwyg-font-size-larger {\n    font-size: larger;\n}\n\n.wysiwyg-font-size-xx-large {\n    font-size: xx-large;\n}\n\n.wysiwyg-font-size-x-large {\n    font-size: x-large;\n}\n\n.wysiwyg-font-size-large {\n    font-size: large;\n}\n\n.wysiwyg-font-size-medium {\n    font-size: medium;\n}\n\n.wysiwyg-font-size-small {\n    font-size: small;\n}\n\n.wysiwyg-font-size-x-small {\n    font-size: x-small;\n}\n\n.wysiwyg-font-size-xx-small {\n    font-size: xx-small;\n}\n\n.wysiwyg-color-black {\n    color: black;\n}\n\n.wysiwyg-color-silver {\n    color: silver;\n}\n\n.wysiwyg-color-gray {\n    color: gray;\n}\n\n.wysiwyg-color-white {\n    color: white;\n}\n\n.wysiwyg-color-maroon {\n    color: maroon;\n}\n\n.wysiwyg-color-red {\n    color: red;\n}\n\n.wysiwyg-color-purple {\n    color: purple;\n}\n\n.wysiwyg-color-fuchsia {\n    color: fuchsia;\n}\n\n.wysiwyg-color-green {\n    color: green;\n}\n\n.wysiwyg-color-lime {\n    color: lime;\n}\n\n.wysiwyg-color-olive {\n    color: olive;\n}\n\n.wysiwyg-color-yellow {\n    color: yellow;\n}\n\n.wysiwyg-color-navy {\n    color: navy;\n}\n\n.wysiwyg-color-blue {\n    color: blue;\n}\n\n.wysiwyg-color-teal {\n    color: teal;\n}\n\n.wysiwyg-color-aqua {\n    color: aqua;\n}\n\n.wysiwyg-text-align-right {\n    text-align: right;\n}\n\n.wysiwyg-text-align-center {\n    text-align: center;\n}\n\n.wysiwyg-text-align-left {\n    text-align: left;\n}\n\n.wysiwyg-float-left {\n    float: left;\n    margin: 0 8px 8px 0;\n}\n\n.wysiwyg-float-right {\n    float: right;\n    margin: 0 0 8px 8px;\n}\n\n.wysiwyg-clear-right {\n    clear: right;\n}\n\n.wysiwyg-clear-left {\n    clear: left;\n}\n\n.editable h2 {\n    margin-bottom: 0;\n}\n\n.editable small {\n    display: block;\n    margin-top: 40px;\n    font-size: 9px;\n}\n\n.editable small,\n.editable small a {\n    color: #666;\n}\n\n.editable a {\n    color: #000;\n    cursor: pointer;\n}\n\n.editable .toolbar,\n.editable textarea {\n    width: 100%;\n    -webkit-box-sizing: border-box;\n    -ms-box-sizing: border-box;\n    -moz-box-sizing: border-box;\n    box-sizing: border-box;\n    margin: 0 7px;\n}\n\n.editable textarea {\n    border: 2px solid;\n    font-family: monospace;\n}\n\n.editable textarea:focus {\n    color: black;\n    border: 2px solid black;\n}\n\n.editable .wysihtml-command-active {\n    font-weight: bold;\n}\n\n.editable [data-wysihtml-dialog],\n.editable [data-wysihtml-hiddentools] {\n    margin: 5px 0 0;\n    padding: 5px;\n    border: 1px solid #666;\n}\n\n.editable a[data-wysihtml-command-value=\"red\"] {\n    color: red;\n}\n\n.editable a[data-wysihtml-command-value=\"green\"] {\n    color: green;\n}\n\n.editable a[data-wysihtml-command-value=\"blue\"] {\n    color: blue;\n}\n\n.editable .wysihtml-editor,\n.editable .wysihtml-editor table td,\n.editable .wysihtml-editor table th {\n    outline: 1px dotted #abc;\n    padding: 5px;\n}\n\n.editable code {\n    background: #ddd;\n    padding: 10px;\n    white-space: pre;\n    display: block;\n    margin: 1em 0;\n}\n\n.editable .toolbar {\n    display: block;\n    border-radius: 3px;\n    border: 1px solid #fff;\n    margin-bottom: 9px;\n    line-height: 1em;\n}\n\n.editable .toolbar a {\n    display: inline-block;\n    height: 1.5em;\n    border-radius: 3px;\n    font-size: 14px;\n    line-height: 1.5em;\n    text-decoration: none;\n    background: #e1e1e1;\n    border: 1px solid #ddd;\n    padding: 0 0.2em;\n    margin: 1px 0;\n}\n\n.editable .toolbar a[data-wysihtml-command] {\n    width: 26px;\n}\n\n.editable .toolbar a[data-wysihtml-command],\n.editable .toolbar a[data-wysihtml-action]{\n    text-align: center;\n    height: 26px;\n    font-size: 16px;\n}\n\n.editable .toolbar .table-actions a[data-wysihtml-command] {\n    width: auto;\n    font-size: 12px;\n    padding: 2px 7px;\n}\n\n.editable .toolbar a[data-wysihtml-command]:hover,\n.editable .toolbar a[data-wysihtml-action]:hover{\n    background: #c1c1c1;\n}\n\n.editable .toolbar a.wysihtml-command-active {\n    background: #222;\n    color: white;\n}\n.editable .toolbar .block {\n    padding: 1px 1px;\n    display: inline-block;\n    background: #eee;\n    border-radius: 3px;\n    margin: 0px 1px 1px 0;\n}\n\n.editable .wysihtml-editor table td.wysiwyg-tmp-selected-cell,\n.editable .wysihtml-editor table th.wysiwyg-tmp-selected-cell {\n    outline: 2px solid green;\n}\n\n.editable .editor-container-tag {\n    padding: 5px 10px;\n    position: absolute;\n    color: white;\n    background: rgba(0,0,0,0.8);\n    width: 100px;\n    margin-left: -50px;\n    -webkit-transition: 0.1s left, 0.1s top;\n}\n\n.editable .wrap {\n    max-width: 700px;\n    margin: 40px;\n}\n\n.editable .editable .wysihtml-uneditable-container {\n    outline: 1px dotted gray;\n    position: relative;\n}\n\n.editable .editable .wysihtml-uneditable-container-right {\n    float: right;\n    width: 50%;\n    margin-left: 2em;\n    margin-bottom: 1em;\n}\n\n.editable .editable .wysihtml-uneditable-container-left {\n    float: left;\n    width: 50%;\n    margin-right: 2em;\n    margin-bottom: 1em;\n}\n\n.editable .wysihtml-editor {\n    height: 500px;\n    overflow-y: auto;\n    width: 100%;\n}\n\n.editable {\n    height: 100%;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div class=\"editable\" data-field=\"container\">\n    <div data-field=\"html-editor-toolbar\">\n        <!-- toolbar -->\n        <div class=\"btn-toolbar\" role=\"toolbar\">\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"bold-action\" data-wysihtml-command=\"bold\" unselectable=\"on\"><i class=\"fa fa-bold\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"italic-action\" data-wysihtml-command=\"italic\" unselectable=\"on\"><i class=\"fa fa-italic\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"underline-action\" data-wysihtml-command=\"underline\" unselectable=\"on\"><i class=\"fa fa-underline\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"create-link-action\" data-wysihtml-command=\"createLink\" unselectable=\"on\"><i class=\"fa fa-link\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"remove-link-action\" data-wysihtml-command=\"removeLink\" unselectable=\"on\"><i class=\"fa fa-chain-broken\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"insert-image-action\" data-wysihtml-command=\"insertImage\" unselectable=\"on\"><i class=\"fa fa-picture-o\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"insert-table-action\" data-wysihtml-command=\"createTable\" unselectable=\"on\" class=\"\"><i class=\"fa fa-table\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"big-title-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-value=\"h1\" unselectable=\"on\"><b>h1</b></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"medium-title-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-value=\"h2\" unselectable=\"on\"><b>h2</b></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"small-title-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-value=\"h3\" unselectable=\"on\"><b>h3</b></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"paragraph-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-value=\"p\" unselectable=\"on\"><i class=\"fa fa-paragraph\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"pre-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-value=\"pre\" unselectable=\"on\"><i class=\"fa fa-file-code-o\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"plain-text-action\" data-wysihtml-command=\"formatBlock\" data-wysihtml-command-blank-value=\"true\" unselectable=\"on\" class=\"wysihtml-command-active\"><i class=\"fa fa-bars\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"quote-action\" data-wysihtml-command=\"insertBlockQuote\" unselectable=\"on\"><i class=\"fa fa-quote-left\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"code-action\" data-wysihtml-command=\"formatCode\" data-wysihtml-command-value=\"language-html\" unselectable=\"on\"><i class=\"fa fa-code\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <div class=\"btn-group\">\n                    <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-field=\"font-size-action\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n                        <i class=\"fa fa-text-height\" aria-hidden=\"true\"></i><span class=\"caret\"></span>\n                    </button>\n                    <ul class=\"dropdown-menu\">\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-xx-small\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"xx-small\" unselectable=\"on\"\n                               data-field=\"font-size-action-xx-small\" data-i18n-key=\"xx-small\"></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-x-small\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"x-small\" unselectable=\"on\"\n                               data-field=\"font-size-action-x-small\" data-i18n-key=\"x-small\"></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-small\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"small\" unselectable=\"on\"\n                               data-field=\"font-size-action-small\" data-i18n-key=\"small\"></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-medium\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"medium\" unselectable=\"on\"\n                               data-field=\"font-size-action-medium\" data-i18n-key=\"medium\" ></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-large\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"large\" unselectable=\"on\"\n                               data-field=\"font-size-action-large\" data-i18n-key=\"large\"></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-x-large\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"x-large\" unselectable=\"on\"\n                               data-field=\"font-size-action-x-large\" data-i18n-key=\"x-large\"></a>\n                        </li>\n                        <li>\n                            <a href=\"javascript:;\" class=\"wysiwyg-font-size-xx-large\"\n                               data-wysihtml-command=\"fontSizeStyle\" data-wysihtml-command-value=\"xx-large\" unselectable=\"on\"\n                               data-field=\"font-size-action-xx-large\" data-i18n-key=\"xx-large\"></a>\n                        </li>\n                    </ul>\n                </div>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"font-color-action\" data-wysihtml-command=\"foreColorStyle\" unselectable=\"on\"><i class=\"fa fa-font\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"background-color-action\" data-wysihtml-command=\"bgColorStyle\" unselectable=\"on\"><i class=\"fa fa-pencil-square\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"unordered-list-action\" data-wysihtml-command=\"insertUnorderedList\" unselectable=\"on\"><i class=\"fa fa-list-ul\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"ordered-list-action\" data-wysihtml-command=\"insertOrderedList\" unselectable=\"on\"><i class=\"fa fa-list-ol\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"outdent-list-action\" data-wysihtml-command=\"outdentList\" unselectable=\"on\"><i class=\"fa fa-outdent\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"indent-list-action\" data-wysihtml-command=\"indentList\" unselectable=\"on\"><i class=\"fa fa-indent\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"align-left-action\" data-wysihtml-command=\"alignLeftStyle\" unselectable=\"on\"><i class=\"fa fa-align-left\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"align-right-action\" data-wysihtml-command=\"alignRightStyle\" unselectable=\"on\"><i class=\"fa fa-align-right\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"align-center-action\"data-wysihtml-command=\"alignCenterStyle\" unselectable=\"on\"><i class=\"fa fa-align-center\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"undo-action\" data-wysihtml-command=\"undo\" unselectable=\"on\"><i class=\"fa fa-undo\" aria-hidden=\"true\"></i></button>\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"redo-action\" data-wysihtml-command=\"redo\" unselectable=\"on\"><i class=\"fa fa-repeat\" aria-hidden=\"true\"></i></button>\n            </div>\n\n            <div class=\"btn-group\" role=\"group\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"switch-to-html-action\" data-wysihtml-action=\"change_view\" unselectable=\"on\" data-i18n-key=\"SwitchView\"></button>\n            </div>\n        </div>\n        <!-- toolbar actions -->\n        <div>\n            <div class=\"panel panel-default\" data-wysihtml-hiddentools=\"table\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <label data-i18n-key=\"TableOptions\"></label>\n                    <a data-wysihtml-command=\"mergeTableCells\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableMergeCells\"></a>,\n                    <a data-wysihtml-command=\"addTableCells\" data-wysihtml-command-value=\"above\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableAddRowBefore\"></a>,\n                    <a data-wysihtml-command=\"addTableCells\" data-wysihtml-command-value=\"below\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableAddRowAfter\"></a>,\n                    <a data-wysihtml-command=\"addTableCells\" data-wysihtml-command-value=\"before\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableAddColumnBefore\"></a>,\n                    <a data-wysihtml-command=\"addTableCells\" data-wysihtml-command-value=\"after\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableAddColumnAfter\"></a>,\n                    <a data-wysihtml-command=\"deleteTableCells\" data-wysihtml-command-value=\"row\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableRemoveRow\"></a>,\n                    <a data-wysihtml-command=\"deleteTableCells\" data-wysihtml-command-value=\"column\" href=\"javascript:;\" unselectable=\"on\" data-i18n-key=\"TableRemoveColumn\"></a>\n                </div>\n            </div>\n\n            <div class=\"panel panel-default\" data-wysihtml-dialog=\"bgColorStyle\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <div class=\"form-group\">\n                        <label for=\"background-color-input\" data-i18n-key=\"BackgroundColorDialog\"></label>\n                        <div class=\"input-group\">\n                            <span class=\"input-group-btn\">\n                                <button class=\"btn btn-default\" type=\"button\" data-field=\"background-color-button\">\n                                    <i class=\"fa fa-edit\"></i>\n                                </button>\n                            </span>\n                            <input type=\"text\" class=\"form-control\" data-field=\"background-color-input\" id=\"background-color-input\" data-wysihtml-dialog-field=\"color\" readOnly>\n                        </div>\n                    </div>\n                    <div>\n                        <button type=\"button\" class=\"btn btn-primary\" data-wysihtml-dialog-action=\"save\" data-i18n-key=\"Ok\"></button>\n                        <button type=\"button\" class=\"btn btn-default\" data-wysihtml-dialog-action=\"cancel\" data-i18n-key=\"Cancel\"></button>\n                    </div>\n                </div>\n            </div>\n\n            <div class=\"panel panel-default\" data-wysihtml-dialog=\"foreColorStyle\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <div class=\"form-group\">\n                        <label for=\"background-color-input\" data-i18n-key=\"FontColorDialog\"></label>\n                        <div class=\"input-group\">\n                            <span class=\"input-group-btn\">\n                                <button class=\"btn btn-default\" type=\"button\" data-field=\"font-color-button\">\n                                    <i class=\"fa fa-edit\"></i>\n                                </button>\n                            </span>\n                            <input type=\"text\" class=\"form-control\" data-field=\"font-color-input\" id=\"font-color-input\" data-wysihtml-dialog-field=\"color\" readOnly>\n                        </div>\n                    </div>\n                    <div>\n                        <button type=\"button\" class=\"btn btn-primary\" data-wysihtml-dialog-action=\"save\" data-i18n-key=\"Ok\"></button>\n                        <button type=\"button\" class=\"btn btn-default\" data-wysihtml-dialog-action=\"cancel\" data-i18n-key=\"Cancel\"></button>\n                    </div>\n                </div>\n            </div>\n\n            <div class=\"panel panel-default\" data-wysihtml-dialog=\"createLink\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <div class=\"form-group\">\n                        <label for=\"link-input\" data-i18n-key=\"LinkDialog\"></label>\n                        <input type=\"text\" class=\"form-control\" id=\"link-input\" data-wysihtml-dialog-field=\"href\" placeholder=\"http://www.exampleURL.com\">\n                    </div>\n                    <div>\n                        <button type=\"button\" class=\"btn btn-primary\" data-wysihtml-dialog-action=\"save\" data-i18n-key=\"Ok\"></button>\n                        <button type=\"button\" class=\"btn btn-default\" data-wysihtml-dialog-action=\"cancel\" data-i18n-key=\"Cancel\"></button>\n                    </div>\n                </div>\n            </div>\n\n            <div class=\"panel panel-default\" data-wysihtml-dialog=\"insertImage\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <div class=\"form-group\">\n                        <label for=\"imageSrc\" data-i18n-key=\"ImageDialog\"></label>\n                        <input type=\"text\" class=\"form-control\" id=\"imageSrc\" data-wysihtml-dialog-field=\"src\" placeholder=\"http://exampleURL.com/exampleImage.jpg\">\n                    </div>\n                    <div class=\"form-group\">\n                        <label for=\"imageAlignment\" data-i18n-key=\"ImageAlignment\"></label>\n                        <select class=\"form-control\" id=\"imageAlignment\" data-wysihtml-dialog-field=\"className\">\n                            <option value=\"\" data-i18n-key=\"ImageAlignmentDefault\"></option>\n                            <option value=\"wysiwyg-float-left\" data-i18n-key=\"ImageAlignmentLeft\"></option>\n                            <option value=\"wysiwyg-float-right\" data-i18n-key=\"ImageAlignmentRight\"></option>\n                        </select>\n                    </div>\n                    <div>\n                        <button type=\"button\" class=\"btn btn-primary\" data-wysihtml-dialog-action=\"save\" data-i18n-key=\"Ok\"></button>\n                        <button type=\"button\" class=\"btn btn-default\" data-wysihtml-dialog-action=\"cancel\" data-i18n-key=\"Cancel\"></button>\n                    </div>\n                </div>\n            </div>\n\n            <div class=\"panel panel-default\" data-wysihtml-dialog=\"createTable\" style=\"display: none;\">\n                <div class=\"panel-body\">\n                    <div class=\"form-group\">\n                        <label for=\"tableRows\" data-i18n-key=\"TableRows\"></label>\n                        <input type=\"text\" class=\"form-control\" id=\"tableRows\" data-wysihtml-dialog-field=\"rows\">\n                    </div>\n                    <div class=\"form-group\">\n                        <label for=\"tableColumns\" data-i18n-key=\"TableColumns\"></label>\n                        <input type=\"text\" class=\"form-control\" id=\"tableColumns\" data-wysihtml-dialog-field=\"cols\">\n                    </div>\n                    <div>\n                        <button type=\"button\" class=\"btn btn-primary\" data-wysihtml-dialog-action=\"save\" data-i18n-key=\"Ok\"></button>\n                        <button type=\"button\" class=\"btn btn-default\" data-wysihtml-dialog-action=\"cancel\" data-i18n-key=\"Cancel\"></button>\n                    </div>\n                </div>\n            </div>\n        </div>\n    </div>\n    <!-- canvas -->\n    <div data-field=\"html-editor\" class=\"wysihtml-sandbox wysihtml-editor\" contenteditable=\"true\">\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.MouseEvent;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.ext.editor.commons.client.EditorTitle;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.colorpicker.ColorPickerDialog;\nimport org.uberfire.ext.widgets.common.client.colorpicker.ColorUtils;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\n\n@Dependent\n@Templated\npublic class HtmlEditorView implements HtmlEditorPresenter.View,\n                                       IsElement {\n\n    public static final int HTML_EDITOR_MARGIN = 14;\n    @Inject\n    @DataField(\"container\")\n    Div container;\n    @Inject\n    @DataField(\"html-editor\")\n    Div htmlEditor;\n    @Inject\n    @DataField(\"html-editor-toolbar\")\n    Div toolbar;\n    @Inject\n    @DataField(\"bold-action\")\n    Button boldAction;\n    @Inject\n    @DataField(\"italic-action\")\n    Button italicAction;\n    @Inject\n    @DataField(\"underline-action\")\n    Button underlineAction;\n    @Inject\n    @DataField(\"create-link-action\")\n    Button createLinkAction;\n    @Inject\n    @DataField(\"remove-link-action\")\n    Button removeLinkAction;\n    @Inject\n    @DataField(\"insert-image-action\")\n    Button insertImageAction;\n    @Inject\n    @DataField(\"insert-table-action\")\n    Button insertTableAction;\n    @Inject\n    @DataField(\"big-title-action\")\n    Button bigTitleAction;\n    @Inject\n    @DataField(\"medium-title-action\")\n    Button mediumTitleAction;\n    @Inject\n    @DataField(\"small-title-action\")\n    Button smallTitleAction;\n    @Inject\n    @DataField(\"paragraph-action\")\n    Button paragraphAction;\n    @Inject\n    @DataField(\"pre-action\")\n    Button preAction;\n    @Inject\n    @DataField(\"plain-text-action\")\n    Button plainTextAction;\n    @Inject\n    @DataField(\"quote-action\")\n    Button quoteAction;\n    @Inject\n    @DataField(\"code-action\")\n    Button codeAction;\n    @Inject\n    @DataField(\"font-size-action\")\n    Button fontSizeAction;\n    @Inject\n    @DataField(\"font-size-action-x-small\")\n    Anchor fontSizeActionXSmall;\n    @Inject\n    @DataField(\"font-size-action-small\")\n    Anchor fontSizeActionSmall;\n    @Inject\n    @DataField(\"font-size-action-medium\")\n    Anchor fontSizeActionMedium;\n    @Inject\n    @DataField(\"font-size-action-large\")\n    Anchor fontSizeActionLarge;\n    @Inject\n    @DataField(\"font-size-action-x-large\")\n    Anchor fontSizeActionXLarge;\n    @Inject\n    @DataField(\"font-size-action-xx-large\")\n    Anchor fontSizeActionXXLarge;\n    @Inject\n    @DataField(\"font-color-action\")\n    Button fontColorAction;\n    @Inject\n    @DataField(\"background-color-action\")\n    Button backgroundColorAction;\n    @Inject\n    @DataField(\"unordered-list-action\")\n    Button unorderedListAction;\n    @Inject\n    @DataField(\"ordered-list-action\")\n    Button orderedListAction;\n    @Inject\n    @DataField(\"outdent-list-action\")\n    Button outdentListAction;\n    @Inject\n    @DataField(\"indent-list-action\")\n    Button indentListAction;\n    @Inject\n    @DataField(\"align-left-action\")\n    Button alignLeftAction;\n    @Inject\n    @DataField(\"align-right-action\")\n    Button alignRightAction;\n    @Inject\n    @DataField(\"align-center-action\")\n    Button alignCenterAction;\n    @Inject\n    @DataField(\"undo-action\")\n    Button undoAction;\n    @Inject\n    @DataField(\"redo-action\")\n    Button redoAction;\n    @Inject\n    @DataField(\"switch-to-html-action\")\n    Button switchToHtmlAction;\n    @Inject\n    @DataField(\"background-color-button\")\n    Button backgroundColorButton;\n    @Inject\n    @DataField(\"background-color-input\")\n    Input backgroundColorInput;\n    @Inject\n    @DataField(\"font-color-button\")\n    Button fontColorButton;\n    @Inject\n    @DataField(\"font-color-input\")\n    Input fontColorInput;\n\n    private TranslationService translationService;\n    private HtmlEditorPresenter presenter;\n    private HtmlEditorLibraryLoader libraryLoader;\n    private EditorTitle title;\n    private boolean loaded = false;\n    private JavaScriptObject jsEditor;\n    private String identifier;\n\n    @Inject\n    public HtmlEditorView(final TranslationService translationService,\n                          final HtmlEditorLibraryLoader libraryLoader) {\n        super();\n        this.translationService = translationService;\n        this.libraryLoader = libraryLoader;\n        this.title = new EditorTitle();\n    }\n\n    @Override\n    public void init(final HtmlEditorPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @PostConstruct\n    public void postConstruct() {\n        libraryLoader.ensureLibrariesAreAvailable();\n        configureToolbarTitles();\n        setUpColorEditor(backgroundColorButton, backgroundColorInput);\n        setUpColorEditor(fontColorButton, fontColorInput);\n    }\n\n    private void setUpColorEditor(final Button button,\n                                  final Input input) {\n        button.setOnclick(event -> handleColorSelection(event, button, input));\n        input.setOnclick(event -> handleColorSelection(event, button, input));\n    }\n\n    private void handleColorSelection(MouseEvent event, Button button, Input input) {\n        final ColorPickerDialog dlg = new ColorPickerDialog();\n        dlg.getElement().getStyle().setZIndex(9999);\n        dlg.addDialogClosedHandler(closedEvent -> {\n            if (!closedEvent.isCanceled()) {\n                int[] rgb = ColorUtils.getRGB(dlg.getColor());\n                String color = \"#\" + dlg.getColor();\n                input.setValue(\"rgb(\"+rgb[0]+\",\"+rgb[1]+\",\"+rgb[2]+\");\");\n            }\n        });\n\n        dlg.showRelativeTo(ElementWrapperWidget.getWidget(button));\n        dlg.getElement().getStyle().setBackgroundColor(\"white\");\n    }\n\n\n\n    @Override\n    public void load() {\n        if (!loaded) {\n\n            identifier = String.valueOf(System.currentTimeMillis());\n            loaded = true;\n\n            configureScreenComponents(getEditorId(), getToolbarId());\n            loadEditor(getEditorId(), getToolbarId());\n        }\n    }\n\n    private String getToolbarId() {\n        return \"html-editor-toolbar-\" + identifier;\n    }\n\n    private String getEditorId() {\n        return \"html-editor-\" + identifier;\n    }\n\n    @Override\n    public void destroy() {\n        destroyEditor();\n\n        loaded = false;\n    }\n\n    @Override\n    public String getContent() {\n        synchronizeView();\n        return htmlEditor.getInnerHTML();\n    }\n\n    @Override\n    public void setContent(final String content) {\n        htmlEditor.setInnerHTML(content);\n    }\n\n    public final native void synchronizeView() /*-{\n\n        var editor = this.@org.uberfire.ext.editor.commons.client.htmleditor.HtmlEditorView::jsEditor;\n\n        try {\n            if (editor.currentView == \"source\") {\n                editor.fire(\"change_view\", \"composer\");\n            }\n        } catch (e) {\n            // Ignore.\n            // `wysihtml` (0.6.0-beta1) introduced new checks to the `editor.fire`.\n            // These asserts don't work as expected in some scenarios. See (RHDM-219).\n            // If this library was updated, consider to remove it.\n        }\n    }-*/;\n\n    protected void configureScreenComponents(final String editorId,\n                                             final String toolbarId) {\n        htmlEditor.setId(editorId);\n        toolbar.setId(toolbarId);\n    }\n\n    protected void loadEditor(String editorId,\n                              String toolbarId) {\n        Scheduler.get().scheduleDeferred(() -> {\n            initEditor(editorId,\n                       toolbarId);\n            onResize();\n        });\n    }\n\n    protected native void initEditor(String editorId,\n                                     String toolbarId) /*-{\n        var editor = new $wnd.wysihtml.Editor(editorId, {\n            toolbar: $wnd.document.getElementById(toolbarId),\n            parserRules: $wnd.wysihtmlParserRules\n        });\n\n        this.@org.uberfire.ext.editor.commons.client.htmleditor.HtmlEditorView::jsEditor = editor;\n    }-*/;\n\n    protected native void destroyEditor() /*-{\n\n        var editor = this.@org.uberfire.ext.editor.commons.client.htmleditor.HtmlEditorView::jsEditor;\n\n        editor.destroy();\n    }-*/;\n\n    public void docksInteractionEvent(@Observes UberfireDocksInteractionEvent event) {\n        Scheduler.get().scheduleDeferred(() -> onResize());\n    }\n\n    private void onResize() {\n        final String toolbarHeightCss = getOffsetHeight(toolbar);\n        final int toolbarHeight = Integer.parseInt(toolbarHeightCss) + HTML_EDITOR_MARGIN;\n        container.getStyle().setProperty(\"width\",\n                                         \"calc(100% - \" + HTML_EDITOR_MARGIN + \"px)\");\n    }\n\n    protected native String getOffsetHeight(HTMLElement el) /*-{\n        return el.offsetHeight;\n    }-*/;\n\n    @Override\n    public void alertReadOnly() {\n        final String message = translationService.format(Constants.HtmlEditorView_CantSaveReadOnly);\n        Window.alert(message);\n    }\n\n    @Override\n    public void showLoading() {\n        final String message = translationService.format(Constants.HtmlEditorView_Loading);\n        showBusyIndicator(message);\n    }\n\n    @Override\n    public void showSaving() {\n        final String message = translationService.format(Constants.HtmlEditorView_Saving);\n        showBusyIndicator(message);\n    }\n\n    @Override\n    public EditorTitle getTitleWidget() {\n        return title;\n    }\n\n    @Override\n    public void refreshTitle(final String value) {\n        title.setText(value);\n    }\n\n    @Override\n    public void showBusyIndicator(String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public boolean confirmClose() {\n        final String message = translationService.format(Constants.HtmlEditorView_DiscardUnsavedData);\n        return Window.confirm(message);\n    }\n\n    // Still necessary, in order to be used as an editor view.\n    @Override\n    public Widget asWidget() {\n        return ElementWrapperWidget.getWidget(getElement());\n    }\n\n    private void configureToolbarTitles() {\n        boldAction.setTitle(translationService.format(Constants.HtmlEditorView_Bold));\n        italicAction.setTitle(translationService.format(Constants.HtmlEditorView_Italic));\n        underlineAction.setTitle(translationService.format(Constants.HtmlEditorView_Underline));\n        createLinkAction.setTitle(translationService.format(Constants.HtmlEditorView_CreateLink));\n        removeLinkAction.setTitle(translationService.format(Constants.HtmlEditorView_RemoveLink));\n        insertImageAction.setTitle(translationService.format(Constants.HtmlEditorView_InsertImage));\n        insertTableAction.setTitle(translationService.format(Constants.HtmlEditorView_InsertTable));\n        bigTitleAction.setTitle(translationService.format(Constants.HtmlEditorView_BigTitle));\n        mediumTitleAction.setTitle(translationService.format(Constants.HtmlEditorView_MediumTitle));\n        smallTitleAction.setTitle(translationService.format(Constants.HtmlEditorView_SmallTitle));\n        paragraphAction.setTitle(translationService.format(Constants.HtmlEditorView_Paragraph));\n        preAction.setTitle(translationService.format(Constants.HtmlEditorView_Pre));\n        plainTextAction.setTitle(translationService.format(Constants.HtmlEditorView_PlainText));\n        quoteAction.setTitle(translationService.format(Constants.HtmlEditorView_Quote));\n        codeAction.setTitle(translationService.format(Constants.HtmlEditorView_Code));\n        fontSizeAction.setTitle(translationService.format(Constants.HtmlEditorView_FontSize));\n        fontColorAction.setTitle(translationService.format(Constants.HtmlEditorView_FontColor));\n        backgroundColorAction.setTitle(translationService.format(Constants.HtmlEditorView_BackgroundColor));\n        unorderedListAction.setTitle(translationService.format(Constants.HtmlEditorView_UnorderedList));\n        orderedListAction.setTitle(translationService.format(Constants.HtmlEditorView_OrderedList));\n        outdentListAction.setTitle(translationService.format(Constants.HtmlEditorView_OutdentList));\n        indentListAction.setTitle(translationService.format(Constants.HtmlEditorView_IndentList));\n        alignLeftAction.setTitle(translationService.format(Constants.HtmlEditorView_AlignLeft));\n        alignRightAction.setTitle(translationService.format(Constants.HtmlEditorView_AlignRight));\n        alignCenterAction.setTitle(translationService.format(Constants.HtmlEditorView_AlignCenter));\n        undoAction.setTitle(translationService.format(Constants.HtmlEditorView_Undo));\n        redoAction.setTitle(translationService.format(Constants.HtmlEditorView_Redo));\n        switchToHtmlAction.setTitle(translationService.format(Constants.HtmlEditorView_SwitchToHtmlView));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class HtmlResourceType implements ClientResourceType {\n\n    private Category category;\n\n    public HtmlResourceType() {\n    }\n\n    @Inject\n    public HtmlResourceType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"html\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"HTML file\";\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"html\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.html\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\"\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/BasicFileMenuBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic interface BasicFileMenuBuilder extends HasLockSyncMenuStateHelper {\n\n    Menus build();\n\n    BasicFileMenuBuilder addSave(final MenuItem menuItem);\n\n    BasicFileMenuBuilder addSave(final Command command);\n\n    BasicFileMenuBuilder addDelete(final Path path,\n                                   final Caller<? extends SupportsDelete> deleteCaller);\n\n    BasicFileMenuBuilder addDelete(final Path path,\n                                   final Caller<? extends SupportsDelete> deleteCaller,\n                                   final Validator validator);\n\n    BasicFileMenuBuilder addDelete(final PathProvider provider,\n                                   final Caller<? extends SupportsDelete> deleteCaller);\n\n    BasicFileMenuBuilder addDelete(final PathProvider provider,\n                                   final Caller<? extends SupportsDelete> deleteCaller,\n                                   final Validator validator);\n\n    BasicFileMenuBuilder addDelete(final Command command);\n\n    BasicFileMenuBuilder addRename(final Command command);\n\n    BasicFileMenuBuilder addRename(final Path path,\n                                   final Caller<? extends SupportsRename> renameCaller);\n\n    BasicFileMenuBuilder addRename(final Path path,\n                                   final Validator validator,\n                                   final Caller<? extends SupportsRename> renameCaller);\n\n    BasicFileMenuBuilder addRename(final PathProvider provider,\n                                   final Validator validator,\n                                   final Caller<? extends SupportsRename> renameCaller);\n\n    BasicFileMenuBuilder addCopy(final Command command);\n\n    BasicFileMenuBuilder addCopy(final Path path,\n                                 final Caller<? extends SupportsCopy> copyCaller);\n\n    BasicFileMenuBuilder addCopy(final Path path,\n                                 final Validator validator,\n                                 final Caller<? extends SupportsCopy> copyCaller);\n\n    BasicFileMenuBuilder addCopy(final PathProvider provider,\n                                 final Validator validator,\n                                 final Caller<? extends SupportsCopy> copyCaller);\n\n    BasicFileMenuBuilder addValidate(final Command command);\n\n    BasicFileMenuBuilder addRestoreVersion(final Path path,\n                                           final CurrentBranch currentBranch);\n\n    BasicFileMenuBuilder addCommand(final String caption,\n                                    final Command command);\n\n    BasicFileMenuBuilder addNewTopLevelMenu(final MenuItem menu);\n\n    /**\n     * A provider of Paths, when the {@link Path} needs to be ascertained at runtime at the point of execution.\n     * Normally {@link MenuItem} are associated with a static path that is determined at development time.\n     * However there are occasions when the {@link Path} cannot be determined until the {@link MenuItem}\n     * is invoked for example when multiple paths can be represented by a single menu.\n     */\n    interface PathProvider {\n\n        /**\n         * Gets a {@link Path} for which the {@link MenuItem} corresponds.\n         * @return A {@link Path} corresponding to the {@link MenuItem}\n         */\n        Path getPath();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/BasicFileMenuBuilderImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport java.util.ArrayList;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UpdatedLockStatusEvent;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.CopyPopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.DeletePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.RenamePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.menu.HasLockSyncMenuStateHelper.LockSyncMenuStateHelper.Operation;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.workbench.model.menu.MenuFactory.newSimpleItem;\n\npublic class BasicFileMenuBuilderImpl implements BasicFileMenuBuilder {\n\n    private RestoreVersionCommandProvider restoreVersionCommandProvider;\n    private Event<NotificationEvent> notification;\n    private BusyIndicatorView busyIndicatorView;\n    private DeletePopUpPresenter deletePopUpPresenter;\n    private CopyPopUpPresenter copyPopUpPresenter;\n    private RenamePopUpPresenter renamePopUpPresenter;\n    private Command saveCommand = null;\n    private MenuItem saveMenuItem;\n    private Command deleteCommand = null;\n    private MenuItem deleteMenuItem;\n    private Command renameCommand = null;\n    private MenuItem renameMenuItem;\n    private Command copyCommand = null;\n    private Command validateCommand = null;\n    private Command restoreCommand = null;\n    private MenuItem restoreMenuItem;\n    private List<Pair<String, Command>> otherCommands = new ArrayList<Pair<String, Command>>();\n    private List<MenuItem> topLevelMenus = new ArrayList<MenuItem>();\n    private List<MenuItem> menuItemsSyncedWithLockState = new ArrayList<MenuItem>();\n    private LockSyncMenuStateHelper lockSyncMenuStateHelper = new BasicFileMenuBuilder.BasicLockSyncMenuStateHelper();\n\n    @Inject\n    public BasicFileMenuBuilderImpl(final DeletePopUpPresenter deletePopUpPresenter,\n                                    final CopyPopUpPresenter copyPopUpPresenter,\n                                    final RenamePopUpPresenter renamePopUpPresenter,\n                                    final BusyIndicatorView busyIndicatorView,\n                                    final Event<NotificationEvent> notification,\n                                    final RestoreVersionCommandProvider restoreVersionCommandProvider) {\n        this.deletePopUpPresenter = deletePopUpPresenter;\n        this.copyPopUpPresenter = copyPopUpPresenter;\n        this.renamePopUpPresenter = renamePopUpPresenter;\n        this.busyIndicatorView = busyIndicatorView;\n        this.notification = notification;\n        this.restoreVersionCommandProvider = restoreVersionCommandProvider;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addSave(final MenuItem menuItem) {\n        saveMenuItem = menuItem;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addSave(final Command command) {\n        this.saveCommand = command;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addDelete(final Path path,\n                                          final Caller<? extends SupportsDelete> deleteCaller) {\n        return addDelete(path,\n                         deleteCaller,\n                         null);\n    }\n\n    @Override\n    public BasicFileMenuBuilder addDelete(final Path path,\n                                          final Caller<? extends SupportsDelete> deleteCaller,\n                                          final Validator validator) {\n        return addDelete(() -> {\n            deletePopUpPresenter.show(validator,\n                                      (String comment) -> {\n                                          busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Deleting());\n                                          deleteCaller.call(getDeleteSuccessCallback(),\n                                                            new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).delete(path,\n                                                                                                                                comment);\n                                      });\n        });\n    }\n\n    @Override\n    public BasicFileMenuBuilder addDelete(final PathProvider provider,\n                                          final Caller<? extends SupportsDelete> deleteCaller) {\n        return addDelete(provider,\n                         deleteCaller,\n                         null);\n    }\n\n    @Override\n    public BasicFileMenuBuilder addDelete(final PathProvider provider,\n                                          final Caller<? extends SupportsDelete> deleteCaller,\n                                          final Validator validator) {\n        return addDelete(() -> {\n            final Path path = provider.getPath();\n            deletePopUpPresenter.show(validator,\n                                      (String comment) -> {\n                                          busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Deleting());\n                                          deleteCaller.call(getDeleteSuccessCallback(),\n                                                            new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView)).delete(path,\n                                                                                                                                comment);\n                                      });\n        });\n    }\n\n    private RemoteCallback<Void> getDeleteSuccessCallback() {\n        return (Void v) -> {\n            busyIndicatorView.hideBusyIndicator();\n            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemDeletedSuccessfully()));\n        };\n    }\n\n    @Override\n    public BasicFileMenuBuilder addDelete(final Command command) {\n        this.deleteCommand = command;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addRename(final Command command) {\n        this.renameCommand = command;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addRename(final Path path,\n                                          final Caller<? extends SupportsRename> renameCaller) {\n        return addRename(() -> {\n            CommandWithFileNameAndCommitMessage command = getRenamePopupCommand(renameCaller,\n                                                                                path,\n                                                                                renamePopUpPresenter.getView());\n            renamePopUpPresenter.show(path,\n                                      command);\n        });\n    }\n\n    @Override\n    public BasicFileMenuBuilder addRename(final Path path,\n                                          final Validator validator,\n                                          final Caller<? extends SupportsRename> renameCaller) {\n        return addRename(() -> {\n            CommandWithFileNameAndCommitMessage command = getRenamePopupCommand(renameCaller,\n                                                                                path,\n                                                                                renamePopUpPresenter.getView());\n            renamePopUpPresenter.show(path,\n                                      validator,\n                                      command);\n        });\n    }\n\n    @Override\n    public BasicFileMenuBuilder addRename(final PathProvider provider,\n                                          final Validator validator,\n                                          final Caller<? extends SupportsRename> renameCaller) {\n        return addRename(() -> {\n            final Path path = provider.getPath();\n            final CommandWithFileNameAndCommitMessage command = getRenamePopupCommand(renameCaller,\n                                                                                      path,\n                                                                                      renamePopUpPresenter.getView());\n            renamePopUpPresenter.show(path,\n                                      validator,\n                                      command);\n        });\n    }\n\n    private CommandWithFileNameAndCommitMessage getRenamePopupCommand(final Caller<? extends SupportsRename> renameCaller,\n                                                                      final Path path,\n                                                                      final RenamePopUpPresenter.View renamePopupView) {\n        return (FileNameAndCommitMessage details) -> {\n            busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Renaming());\n            renameCaller.call(getRenameSuccessCallback(renamePopupView),\n                              getRenameErrorCallback(renamePopupView,\n                                                     busyIndicatorView)).rename(path,\n                                                                                details.getNewFileName(),\n                                                                                details.getCommitMessage());\n        };\n    }\n\n    private RemoteCallback<Path> getRenameSuccessCallback(final RenamePopUpPresenter.View renamePopupView) {\n        return (Path path) -> {\n            renamePopupView.hide();\n            busyIndicatorView.hideBusyIndicator();\n            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemRenamedSuccessfully()));\n        };\n    }\n\n    private HasBusyIndicatorDefaultErrorCallback getRenameErrorCallback(final RenamePopUpPresenter.View renamePopupView,\n                                                                        BusyIndicatorView busyIndicatorView) {\n        return new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView) {\n\n            @Override\n            public boolean error(final Message message,\n                                 final Throwable throwable) {\n                if (fileAlreadyExists(throwable)) {\n                    hideBusyIndicator();\n                    renamePopupView.handleDuplicatedFileName();\n                    return false;\n                }\n\n                renamePopupView.hide();\n                return super.error(message,\n                                   throwable);\n            }\n        };\n    }\n\n    @Override\n    public BasicFileMenuBuilder addCopy(final Command command) {\n        this.copyCommand = command;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addCopy(final Path path,\n                                        final Caller<? extends SupportsCopy> copyCaller) {\n        return addCopy(() -> copyPopUpPresenter.show(path,\n                                                     getCopyPopupCommand(copyCaller,\n                                                                         path,\n                                                                         copyPopUpPresenter.getView())));\n    }\n\n    @Override\n    public BasicFileMenuBuilder addCopy(final Path path,\n                                        final Validator validator,\n                                        final Caller<? extends SupportsCopy> copyCaller) {\n        return addCopy(() -> copyPopUpPresenter.show(path,\n                                                     validator,\n                                                     getCopyPopupCommand(copyCaller,\n                                                                         path,\n                                                                         copyPopUpPresenter.getView())));\n    }\n\n    public BasicFileMenuBuilder addCopy(final PathProvider provider,\n                                        final Validator validator,\n                                        final Caller<? extends SupportsCopy> copyCaller) {\n        return addCopy(() -> {\n            final Path path = provider.getPath();\n            copyPopUpPresenter.show(path,\n                                    validator,\n                                    getCopyPopupCommand(copyCaller,\n                                                        path,\n                                                        copyPopUpPresenter.getView()));\n        });\n    }\n\n    private CommandWithFileNameAndCommitMessage getCopyPopupCommand(final Caller<? extends SupportsCopy> copyCaller,\n                                                                    final Path path,\n                                                                    final CopyPopUpPresenter.View copyPopupView) {\n        return (FileNameAndCommitMessage details) -> {\n            busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Copying());\n            copyCaller.call(getCopySuccessCallback(copyPopupView),\n                            getCopyErrorCallback(copyPopupView,\n                                                 busyIndicatorView)).copy(path,\n                                                                          details.getNewFileName(),\n                                                                          copyPopupView.getTargetPath(),\n                                                                          details.getCommitMessage());\n        };\n    }\n\n    private RemoteCallback<Path> getCopySuccessCallback(final CopyPopUpPresenter.View copyPopupView) {\n        return (final Path path) -> {\n            copyPopupView.hide();\n            busyIndicatorView.hideBusyIndicator();\n            notification.fire(new NotificationEvent(CommonConstants.INSTANCE.ItemCopiedSuccessfully()));\n        };\n    }\n\n    public HasBusyIndicatorDefaultErrorCallback getCopyErrorCallback(final CopyPopUpPresenter.View copyPopupView,\n                                                                     BusyIndicatorView busyIndicatorView) {\n        return new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView) {\n\n            @Override\n            public boolean error(final Message message,\n                                 final Throwable throwable) {\n                if (fileAlreadyExists(throwable)) {\n                    hideBusyIndicator();\n                    copyPopupView.handleDuplicatedFileName();\n                    return false;\n                }\n\n                copyPopupView.hide();\n                return super.error(message,\n                                   throwable);\n            }\n        };\n    }\n\n    private boolean fileAlreadyExists(final Throwable throwable) {\n        return throwable != null && throwable.getMessage() != null && throwable.getMessage().contains(\"FileAlreadyExistsException\");\n    }\n\n    @Override\n    public BasicFileMenuBuilder addValidate(final Command validateCommand) {\n        this.validateCommand = validateCommand;\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addRestoreVersion(final Path path,\n                                                  final CurrentBranch currentBranch) {\n        this.restoreCommand = restoreVersionCommandProvider.getCommand(path,\n                                                                       currentBranch);\n        return this;\n    }\n\n    @Override\n    public BasicFileMenuBuilder addCommand(final String caption,\n                                           final Command command) {\n        this.otherCommands.add(new Pair<String, Command>(caption,\n                                                         command));\n        return this;\n    }\n\n    @Override\n    public Menus build() {\n        final Map<Object, MenuItem> menuItems = new LinkedHashMap<Object, MenuItem>();\n        if (saveCommand != null) {\n            menuItems.put(MenuItems.SAVE,\n                          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Save())\n                                  .respondsWith(saveCommand)\n                                  .endMenu()\n                                  .build().getItems().get(0));\n        } else if (saveMenuItem != null) {\n            menuItems.put(MenuItems.SAVE,\n                          saveMenuItem);\n            menuItemsSyncedWithLockState.add(saveMenuItem);\n        }\n\n        if (deleteCommand != null) {\n            if (deleteMenuItem == null) {\n                deleteMenuItem = MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Delete())\n                        .respondsWith(deleteCommand)\n                        .endMenu()\n                        .build().getItems().get(0);\n            }\n            menuItems.put(MenuItems.DELETE,\n                          deleteMenuItem);\n            menuItemsSyncedWithLockState.add(deleteMenuItem);\n        }\n\n        if (renameCommand != null) {\n            if (renameMenuItem == null) {\n                renameMenuItem = MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Rename())\n                        .respondsWith(renameCommand)\n                        .endMenu()\n                        .build().getItems().get(0);\n            }\n            menuItems.put(MenuItems.RENAME,\n                          renameMenuItem);\n            menuItemsSyncedWithLockState.add(renameMenuItem);\n        }\n\n        if (copyCommand != null) {\n            menuItems.put(MenuItems.COPY,\n                          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Copy())\n                                  .respondsWith(copyCommand)\n                                  .endMenu()\n                                  .build().getItems().get(0));\n        }\n\n        if (validateCommand != null) {\n            menuItems.put(MenuItems.VALIDATE,\n                          MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Validate())\n                                  .respondsWith(validateCommand)\n                                  .endMenu()\n                                  .build().getItems().get(0));\n        }\n\n        if (restoreCommand != null) {\n            if (restoreMenuItem == null) {\n                restoreMenuItem = MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Restore())\n                        .respondsWith(restoreCommand)\n                        .endMenu()\n                        .build().getItems().get(0);\n            }\n            menuItemsSyncedWithLockState.add(restoreMenuItem);\n        }\n\n        if (!(otherCommands == null || otherCommands.isEmpty())) {\n            final List<MenuItem> otherMenuItems = new ArrayList<MenuItem>();\n            for (Pair<String, Command> other : otherCommands) {\n                otherMenuItems.add(newSimpleItem(other.getK1())\n                                           .respondsWith(other.getK2())\n                                           .endMenu().build().getItems().get(0));\n            }\n            final MenuItem item = MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Other())\n                    .withItems(otherMenuItems)\n                    .endMenu()\n                    .build().getItems().get(0);\n            menuItems.put(item,\n                          item);\n        }\n\n        for (MenuItem menuItem : topLevelMenus) {\n            menuItems.put(menuItem,\n                          menuItem);\n        }\n\n        return new Menus() {\n\n            @Override\n            public List<MenuItem> getItems() {\n                return new ArrayList<MenuItem>() {{\n                    for (final MenuItem menuItem : menuItems.values()) {\n                        add(menuItem);\n                    }\n                }};\n            }\n\n            @Override\n            public Map<Object, MenuItem> getItemsMap() {\n                return menuItems;\n            }\n\n            @Override\n            public void accept(MenuVisitor visitor) {\n                if (visitor.visitEnter(this)) {\n                    for (final MenuItem item : menuItems.values()) {\n                        item.accept(visitor);\n                    }\n                    visitor.visitLeave(this);\n                }\n            }\n\n            @Override\n            public int getOrder() {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public BasicFileMenuBuilder addNewTopLevelMenu(MenuItem menu) {\n        topLevelMenus.add(menu);\n        return this;\n    }\n\n    @Override\n    public void setLockSyncMenuStateHelper(final LockSyncMenuStateHelper lockSyncMenuStateHelper) {\n        this.lockSyncMenuStateHelper = PortablePreconditions.checkNotNull(\"lockSyncMenuStateHelper\",\n                                                                          lockSyncMenuStateHelper);\n    }\n\n    void onEditorLockInfo(@Observes UpdatedLockStatusEvent lockInfo) {\n        final Operation op = lockSyncMenuStateHelper.enable(lockInfo.getFile(),\n                                                            lockInfo.isLocked(),\n                                                            lockInfo.isLockedByCurrentUser());\n        switch (op) {\n            case ENABLE:\n            case DISABLE:\n                for (MenuItem menuItem : menuItemsSyncedWithLockState) {\n                    menuItem.setEnabled(op == Operation.ENABLE);\n                }\n                break;\n            case VETO:\n                //Do nothing\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/DownloadMenuItemBuilder.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport elemental2.dom.DomGlobal;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.util.URIUtil;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n@Dependent\npublic class DownloadMenuItemBuilder {\n\n    private TranslationService translationService;\n\n    private static final String DEFAULT_EDITOR = \"defaulteditor/download?path=\";\n\n    @Inject\n    public DownloadMenuItemBuilder(final TranslationService translationService) {\n        this.translationService = translationService;\n    }\n\n    public MenuItem build(final Supplier<Path> pathSupplier) {\n\n        final String download = translationService.format(Constants.DownloadMenuItem_Download);\n\n        return makeMenuItem(download, makeMenuItemCommand(pathSupplier));\n    }\n\n    Command makeMenuItemCommand(final Supplier<Path> pathSupplier) {\n        return () -> download(pathSupplier);\n    }\n\n    void download(final Supplier<Path> pathSupplier) {\n\n        final String downloadURL = getFileDownloadURL(pathSupplier);\n\n        open(downloadURL);\n    }\n\n    void open(final String downloadURL) {\n        DomGlobal.window.open(downloadURL);\n    }\n\n    MenuItem makeMenuItem(final String caption,\n                          final Command command) {\n        return MenuFactory\n                .newTopLevelMenu(caption)\n                .respondsWith(command)\n                .endMenu()\n                .build()\n                .getItems()\n                .get(0);\n    }\n\n    private String getFileDownloadURL(final Supplier<Path> pathSupplier) {\n        return GWT.getModuleBaseURL() + DEFAULT_EDITOR + URIUtil.encodeQueryString(URIUtil.decode(pathSupplier.get().toURI()));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/HasLockSyncMenuStateHelper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n/**\n * Marker interface for Menu Builders that have lock-sync helpers.\n */\npublic interface HasLockSyncMenuStateHelper {\n\n    /**\n     * Sets a helper for {@link MenuItem}s synchronized with locks state (see {@link LockInfo}. {@link MenuItem}s\n     * considered to be synchronized with lock state are 'Save', 'Delete', 'Rename' and 'Restore'.\n     * @param lockSyncMenuStateHelper Cannot be null.\n     */\n    void setLockSyncMenuStateHelper(final LockSyncMenuStateHelper lockSyncMenuStateHelper);\n\n    /**\n     * Helper to ascertain the enabled state of {@link MenuItem}s synchronized with lock state.\n     */\n    interface LockSyncMenuStateHelper {\n\n        /**\n         * Returns whether {@link MenuItem}s should be enabled or disabled based on the provide lock information.\n         * @param file {@link Path} to which the lock relates.\n         * @param isLocked true if the file is locked.\n         * @param isLockedByCurrentUser true if the file is locked by the current User.\n         * @return\n         */\n        Operation enable(final Path file,\n                         final boolean isLocked,\n                         final boolean isLockedByCurrentUser);\n\n        /**\n         * Possible operations; enable/disable MenuItem or veto any change all together.\n         */\n        enum Operation {\n            ENABLE,\n            DISABLE,\n            VETO\n        }\n    }\n\n    /**\n     * Basic implementation that enables {@link MenuItem}s if the file is either not locked; or locked by the current User.\n     */\n    class BasicLockSyncMenuStateHelper implements LockSyncMenuStateHelper {\n\n        @Override\n        public Operation enable(final Path file,\n                                final boolean isLocked,\n                                final boolean isLockedByCurrentUser) {\n            if (!isLocked) {\n                return Operation.ENABLE;\n            } else if (isLockedByCurrentUser) {\n                return Operation.ENABLE;\n            }\n            return Operation.DISABLE;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/MenuItems.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\npublic enum MenuItems {\n    SAVE,\n    DELETE,\n    RENAME,\n    COPY,\n    VALIDATE,\n    RESTORE,\n    CUSTOM,\n    HISTORY,\n    DOWNLOAD\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/RestoreVersionCommandProvider.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class RestoreVersionCommandProvider {\n\n    @Inject\n    private Caller<VersionService> versionService;\n\n    @Inject\n    private Event<RestoreEvent> restoreEvent;\n\n    @Inject\n    private BusyIndicatorView busyIndicatorView;\n\n    @Inject\n    private SavePopUpPresenter savePopUpPresenter;\n\n    public Command getCommand(final Path path, final CurrentBranch currentBranch) {\n        return new Command() {\n\n            @Override\n            public void execute() {\n                savePopUpPresenter.show(path,\n                                        new ParameterizedCommand<String>() {\n\n                                            @Override\n                                            public void execute(final String comment) {\n                                                busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Restoring());\n                                                versionService.call(\n                                                        getRestorationSuccessCallback(),\n                                                        new HasBusyIndicatorDefaultErrorCallback(busyIndicatorView))\n                                                        .restore(path,\n                                                                 comment, currentBranch.getName());\n                                            }\n                                        });\n            }\n        };\n    }\n\n    private RemoteCallback<Path> getRestorationSuccessCallback() {\n        return new RemoteCallback<Path>() {\n\n            @Override\n            public void callback(final Path restored) {\n                //TODO {porcelli} close current?\n//                busyIndicatorView.hideBusyIndicator();\n//                restoreEvent.fire( new RestoreEvent( restored ) );\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/common/CurrentBranchProducer.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\n\npublic class CurrentBranchProducer {\n\n    @Inject\n    private Instance<CurrentBranch> currentBranch;\n\n    @Produces\n    @Customizable\n    public CurrentBranch currentBranchProducer() {\n        if (this.currentBranch.isUnsatisfied()) {\n            return new DefaultCurrentBranch();\n        }\n        return this.currentBranch.get();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/common/DefaultCurrentBranch.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\n\n@FallbackImplementation\npublic class DefaultCurrentBranch implements CurrentBranch {\n\n    private static final String DEFAULT_BRANCH = \"master\";\n\n    public DefaultCurrentBranch() {\n    }\n\n    @Override\n    public String getName() {\n        return DEFAULT_BRANCH;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/menu/common/SaveAndRenameCommandBuilder.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.RenameInProgressEvent;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.RenamePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.ext.widgets.common.client.common.HasBusyIndicator;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class SaveAndRenameCommandBuilder<T, M> {\n\n    private final RenamePopUpPresenter renamePopUpPresenter;\n    private final BusyIndicatorView busyIndicatorView;\n    private final Event<NotificationEvent> notification;\n    private final Event<RenameInProgressEvent> renameInProgressEvent;\n\n    private Supplier<Path> pathSupplier;\n    private Validator renameValidator;\n    private Caller<? extends SupportsSaveAndRename<T, M>> renameCaller;\n\n    private Supplier<M> metadataSupplier = () -> null;\n    private Supplier<T> contentSupplier = () -> null;\n    private Supplier<Boolean> isDirtySupplier = () -> Boolean.FALSE;\n    private Supplier<Boolean> saveValidator = () -> Boolean.TRUE;\n    private ParameterizedCommand<Path> onSuccess = (path) -> {\n    };\n    private Command onError = () -> {\n    };\n    private Command beforeSaveAndRenameCommand = () -> {\n    };\n\n    @Inject\n    public SaveAndRenameCommandBuilder(final RenamePopUpPresenter renamePopUpPresenter,\n                                       final BusyIndicatorView busyIndicatorView,\n                                       final Event<NotificationEvent> notification,\n                                       final Event<RenameInProgressEvent> renameInProgressEvent) {\n\n        this.renamePopUpPresenter = renamePopUpPresenter;\n        this.busyIndicatorView = busyIndicatorView;\n        this.notification = notification;\n        this.renameInProgressEvent = renameInProgressEvent;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addValidator(final Validator validator) {\n        this.renameValidator = validator;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addValidator(final Supplier<Boolean> validator) {\n        this.saveValidator = validator;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addRenameService(final Caller<? extends SupportsSaveAndRename<T, M>> renameCaller) {\n        this.renameCaller = renameCaller;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addPathSupplier(final Supplier<Path> pathSupplier) {\n        this.pathSupplier = pathSupplier;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addMetadataSupplier(final Supplier<M> metadataSupplier) {\n        this.metadataSupplier = metadataSupplier;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addContentSupplier(final Supplier<T> contentSupplier) {\n        this.contentSupplier = contentSupplier;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addIsDirtySupplier(final Supplier<Boolean> isDirtySupplier) {\n        this.isDirtySupplier = isDirtySupplier;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addSuccessCallback(final ParameterizedCommand<Path> onSuccess) {\n        this.onSuccess = onSuccess;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addErrorCallback(final Command onError) {\n        this.onError = onError;\n        return this;\n    }\n\n    public SaveAndRenameCommandBuilder<T, M> addBeforeSaveAndRenameCommand(final Command beforeSaveAndRenameCommand) {\n        this.beforeSaveAndRenameCommand = beforeSaveAndRenameCommand;\n        return this;\n    }\n\n    public Command build() {\n\n        checkNotNull(\"pathSupplier\", pathSupplier);\n        checkNotNull(\"renameValidator\", renameValidator);\n        checkNotNull(\"renameCaller\", renameCaller);\n\n        return () -> {\n\n            final CommandWithFileNameAndCommitMessage renameCommand = makeRenameCommand();\n            final CommandWithFileNameAndCommitMessage saveAndRenameCommand = makeSaveAndRenameCommand();\n            final Boolean isValid = saveValidator.get();\n\n            if (!isValid) {\n                return;\n            }\n\n            renamePopUpPresenter.show(getPath(), renameValidator, isDirty(), renameCommand, saveAndRenameCommand);\n        };\n    }\n\n    protected CommandWithFileNameAndCommitMessage makeSaveAndRenameCommand() {\n        return (details) -> {\n            showBusyIndicator();\n            callSaveAndRename(details);\n        };\n    }\n\n    protected CommandWithFileNameAndCommitMessage makeRenameCommand() {\n        return (details) -> {\n            showBusyIndicator();\n            callRename(details);\n        };\n    }\n\n    protected void callSaveAndRename(final FileNameAndCommitMessage details) {\n\n        final String newFileName = details.getNewFileName();\n        final String commitMessage = details.getCommitMessage();\n\n        beforeSaveAndRenameCommand.execute();\n\n        renameCaller.call(onSuccess(), onError()).saveAndRename(getPath(),\n                                                                newFileName,\n                                                                getMetadata(),\n                                                                getContent(),\n                                                                commitMessage);\n    }\n\n    protected void callRename(final FileNameAndCommitMessage details) {\n\n        final String newFileName = details.getNewFileName();\n        final String commitMessage = details.getCommitMessage();\n\n        renameCaller.call(onSuccess(), onError()).rename(getPath(),\n                                                         newFileName,\n                                                         commitMessage);\n    }\n\n    RemoteCallback<Path> onSuccess() {\n        return (Path path) -> {\n            notifyRenameInProgress();\n            onSuccess.execute(path);\n            hideRenamePopup();\n            hideBusyIndicator();\n            notifyItemRenamedSuccessfully();\n        };\n    }\n\n    void notifyRenameInProgress() {\n        renameInProgressEvent.fire(makeRenameInProgressEvent());\n    }\n\n    RenameInProgressEvent makeRenameInProgressEvent() {\n        return new RenameInProgressEvent(getPath());\n    }\n\n    SaveAndRenameErrorCallback onError() {\n        return new SaveAndRenameErrorCallback(busyIndicatorView);\n    }\n\n    void notifyItemRenamedSuccessfully() {\n        notification.fire(makeItemRenamedSuccessfullyEvent());\n    }\n\n    NotificationEvent makeItemRenamedSuccessfullyEvent() {\n        return new NotificationEvent(CommonConstants.INSTANCE.ItemRenamedSuccessfully());\n    }\n\n    void hideRenamePopup() {\n        renamePopUpView().hide();\n    }\n\n    void hideBusyIndicator() {\n        busyIndicatorView.hideBusyIndicator();\n    }\n\n    void showBusyIndicator() {\n        busyIndicatorView.showBusyIndicator(CommonConstants.INSTANCE.Renaming());\n    }\n\n    private RenamePopUpPresenter.View renamePopUpView() {\n        return renamePopUpPresenter.getView();\n    }\n\n    void handleDuplicatedFileName() {\n        renamePopUpView().handleDuplicatedFileName();\n    }\n\n    private boolean fileAlreadyExists(final Throwable throwable) {\n        return throwable != null && throwable.getMessage() != null && throwable.getMessage().contains(\"FileAlreadyExistsException\");\n    }\n\n    Path getPath() {\n        return pathSupplier.get();\n    }\n\n    private Boolean isDirty() {\n        return isDirtySupplier.get();\n    }\n\n    private M getMetadata() {\n        return metadataSupplier.get();\n    }\n\n    private T getContent() {\n        return contentSupplier.get();\n    }\n\n    class SaveAndRenameErrorCallback extends HasBusyIndicatorDefaultErrorCallback {\n\n        public SaveAndRenameErrorCallback(final HasBusyIndicator view) {\n            super(view);\n        }\n\n        @Override\n        public boolean error(final Message message,\n                             final Throwable throwable) {\n\n            if (fileAlreadyExists(throwable)) {\n                hideBusyIndicator();\n                handleDuplicatedFileName();\n\n                return false;\n            }\n\n            onError.execute();\n            hideRenamePopup();\n\n            return callSuper(message, throwable);\n        }\n\n        boolean callSuper(final Message message,\n                          final Throwable throwable) {\n            return super.error(message, throwable);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/resources/CommonImages.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface CommonImages\n        extends\n        ClientBundle {\n\n    CommonImages INSTANCE = GWT.create(CommonImages.class);\n\n    @Source(\"images/edit.gif\")\n    ImageResource edit();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String SavePopupTitle();\n\n    String CheckInComment();\n\n    String CheckInCommentColon();\n\n    String Save();\n\n    String SaveWithComments();\n\n    String Tags();\n\n    String Cancel();\n\n    String CopyPopupTitle();\n\n    String NewName();\n\n    String NewNameColon();\n\n    String CopyPopupCreateACopy();\n\n    String InvalidFileName0(String baseFileName);\n\n    String DeletePopupTitle();\n\n    String DeletePopupDelete();\n\n    String DeletePopupRenameNamePrompt();\n\n    String RenamePopupTitle();\n\n    String RenamePopupRenameItem();\n\n    String Restoring();\n\n    String Delete();\n\n    String Rename();\n\n    String Copy();\n\n    String Validate();\n\n    String Restore();\n\n    String RestoreWithComments();\n\n    String Other();\n\n    String Loading();\n\n    String ItemRestored();\n\n    String ItemSavedSuccessfully();\n\n    String CantSaveReadOnly();\n\n    String Saving();\n\n    String DiscardUnsavedData();\n\n    String LatestVersion();\n\n    String Version(int versionIndex);\n\n    String Date();\n\n    String CommitMessage();\n\n    String Author();\n\n    String More();\n\n    String ShowAll();\n\n    String Deleting();\n\n    String ItemDeletedSuccessfully();\n\n    String ItemRenamedSuccessfully();\n\n    String Renaming();\n\n    String Copying();\n\n    String ItemCopiedSuccessfully();\n\n    String ExceptionFileAlreadyExists0(final String uri);\n\n    String Current();\n\n    String Select();\n\n    String PackageColon();\n\n    String HtmlEditor();\n\n    String Validating();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic class Constants {\n    \n    @TranslationKey(defaultValue = \"\")\n    public static final String SavePopUpView_SaveWithComments = \"SavePopUpView.SaveWithComments\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String SavePopUpView_Save = \"SavePopUpView.Save\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String SavePopUpView_Cancel = \"SavePopUpView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DeletePopUpView_ConfirmDelete = \"DeletePopUpView.ConfirmDelete\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DeletePopUpView_Delete = \"DeletePopUpView.Delete\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DeletePopUpView_Cancel = \"DeletePopUpView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DeletePopUpView_DeleteNotAllowed = \"DeletePopUpView.DeleteNotAllowed\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DeletePopUpView_UnexpectedError = \"DeletePopUpView.UnexpectedError\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RestorePopUpView_RestoreWithComments = \"RestorePopUpView.RestoreWithComments\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RestorePopUpView_Restore = \"RestorePopUpView.Restore\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RestorePopUpView_Cancel = \"RestorePopUpView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_MakeACopy = \"CopyPopUpView.MakeACopy\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_Cancel = \"CopyPopUpView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_InvalidFileName = \"CopyPopUpView.InvalidFileName\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_FileAlreadyExists = \"CopyPopUpView.FileAlreadyExists\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_NewName = \"CopyPopUpView.NewName\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String CopyPopUpView_CopyNotAllowed = \"CopyPopUpView.CopyNotAllowed\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_RenameAsset = \"RenamePopUpView.RenameAsset\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_Rename = \"RenamePopUpView.Rename\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_SaveAndRename = \"RenamePopUpView.SaveAndRename\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_Cancel = \"RenamePopUpView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_InvalidFileName = \"RenamePopUpView.InvalidFileName\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_FileAlreadyExists = \"RenamePopUpView.FileAlreadyExists\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String RenamePopUpView_RenameNotAllowed = \"RenamePopUpView.RenameNotAllowed\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String ToggleCommentView_EnterComment = \"ToggleCommentView.EnterComment\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_CantSaveReadOnly = \"HtmlEditorView.CantSaveReadOnly\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Loading = \"HtmlEditorView.Loading\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Saving = \"HtmlEditorView.Saving\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_DiscardUnsavedData = \"HtmlEditorView.DiscardUnsavedData\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Ok = \"HtmlEditorView.Ok\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Cancel = \"HtmlEditorView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Bold = \"HtmlEditorView.Bold\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Italic = \"HtmlEditorView.Italic\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Underline = \"HtmlEditorView.Underline\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_CreateLink = \"HtmlEditorView.CreateLink\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_RemoveLink = \"HtmlEditorView.RemoveLink\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_InsertImage = \"HtmlEditorView.InsertImage\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_InsertTable = \"HtmlEditorView.InsertTable\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_BigTitle = \"HtmlEditorView.BigTitle\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_MediumTitle = \"HtmlEditorView.MediumTitle\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_SmallTitle = \"HtmlEditorView.SmallTitle\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Paragraph = \"HtmlEditorView.Paragraph\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Pre = \"HtmlEditorView.Pre\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_PlainText = \"HtmlEditorView.PlainText\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Quote = \"HtmlEditorView.Quote\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Code = \"HtmlEditorView.Code\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_FontSize = \"HtmlEditorView.FontSize\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_FontColor = \"HtmlEditorView.FontColor\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_BackgroundColor = \"HtmlEditorView.BackgroundColor\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_UnorderedList = \"HtmlEditorView.UnorderedList\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_OrderedList = \"HtmlEditorView.OrderedList\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_OutdentList = \"HtmlEditorView.OutdentList\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_IndentList = \"HtmlEditorView.IndentList\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_AlignLeft = \"HtmlEditorView.AlignLeft\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_AlignRight = \"HtmlEditorView.AlignRight\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_AlignCenter = \"HtmlEditorView.AlignCenter\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Undo = \"HtmlEditorView.Undo\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_Redo = \"HtmlEditorView.Redo\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_SwitchToHtmlView = \"HtmlEditorView.SwitchToHtmlView\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_SwitchView = \"HtmlEditorView.SwitchView\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableOptions = \"HtmlEditorView.TableOptions\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableMergeCells = \"HtmlEditorView.TableMergeCells\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableAddRowBefore = \"HtmlEditorView.TableAddRowBefore\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableAddRowAfter = \"HtmlEditorView.TableAddRowAfter\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableAddColumnBefore = \"HtmlEditorView.TableAddColumnBefore\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableAddColumnAfter = \"HtmlEditorView.TableAddColumnAfter\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableRemoveRow = \"HtmlEditorView.TableRemoveRow\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableRemoveColumn = \"HtmlEditorView.TableRemoveColumn\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_FontSizeDialog = \"HtmlEditorView.FontSizeDialog\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_BackgroundColorDialog = \"HtmlEditorView.BackgroundColorDialog\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_FontColorDialog = \"HtmlEditorView.FontColorDialog\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_LinkDialog = \"HtmlEditorView.LinkDialog\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_ImageDialog = \"HtmlEditorView.ImageDialog\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_ImageAlignment = \"HtmlEditorView.ImageAlignment\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_ImageAlignmentDefault = \"HtmlEditorView.ImageAlignmentDefault\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_ImageAlignmentLeft = \"HtmlEditorView.ImageAlignmentLeft\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_ImageAlignmentRight = \"HtmlEditorView.ImageAlignmentRight\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableRows = \"HtmlEditorView.TableRows\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HtmlEditorView_TableColumns = \"HtmlEditorView.TableColumns\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String DownloadMenuItem_Download = \"DownloadMenuItem.Download\";\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/template/mustache/ClientMustacheTemplateRenderer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.template.mustache;\n\nimport java.util.function.Function;\nimport java.util.function.Supplier;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.ScriptInjector;\nimport org.uberfire.ext.editor.commons.template.TemplateRenderer;\nimport org.uberfire.ext.editor.commons.template.mustache.MustacheTemplateRenderer;\n\n/**\n * Client implementation for {@link TemplateRenderer} based on MustacheJS engine.\n * See {@linktourl https://github.com/janl/mustache.js}\n */\n@ApplicationScoped\npublic class ClientMustacheTemplateRenderer implements MustacheTemplateRenderer<Object> {\n\n    private final Function<String, ScriptInjector.FromString> scriptInjector;\n    private final Supplier<MustacheSource> sourceSupplier;\n\n    @Inject\n    public ClientMustacheTemplateRenderer() {\n        this(() -> GWT.create(MustacheSource.class), ScriptInjector::fromString);\n    }\n\n    protected ClientMustacheTemplateRenderer(final Supplier<MustacheSource> sourceSupplier, final Function<String,\n            ScriptInjector.FromString> scriptInjector) {\n        this.sourceSupplier = sourceSupplier;\n        this.scriptInjector = scriptInjector;\n    }\n\n    @PostConstruct\n    protected void init() {\n        //Injecting the JS native script\n        final MustacheSource source = sourceSupplier.get();\n        inject(source.mustache().getText());\n    }\n\n    private void inject(final String raw) {\n        final ScriptInjector.FromString js = scriptInjector.apply(raw);\n        js.setWindow(ScriptInjector.TOP_WINDOW).setRemoveTag(false).inject();\n    }\n\n    public String render(final String template, final Object data) {\n        return Mustache.to_html(template, data);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/template/mustache/Mustache.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.template.mustache;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n/**\n * JSInterop for MustacheJS native library.\n * See {@linktourl https://github.com/janl/mustache.js/blob/master/mustache.js}\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic final class Mustache {\n\n    @JsMethod\n    public static final native String to_html(String template, Object bean);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/template/mustache/MustacheSource.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.template.mustache;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\n/**\n * Holds the source for the unpacked MustacheJS.\n */\npublic interface MustacheSource extends ClientBundle {\n\n    @Source(\"mustache.js\")\n    TextResource mustache();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/validation/DefaultFileNameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.client.validation;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.ext.editor.commons.service.ValidationService;\n\n/**\n * Default validation of resource file names\n */\n@ApplicationScoped\npublic class DefaultFileNameValidator implements Validator {\n\n    @Inject\n    private Caller<ValidationService> validationService;\n\n    @Override\n    public void validate(final String value,\n                         final ValidatorCallback callback) {\n        validationService.call(new RemoteCallback<Boolean>() {\n            @Override\n            public void callback(final Boolean response) {\n                if (Boolean.TRUE.equals(response)) {\n                    callback.onSuccess();\n                } else {\n                    callback.onFailure();\n                }\n            }\n        }).isFileNameValid(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/validation/ValidationErrorReason.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.validation;\n\npublic enum ValidationErrorReason {\n    EMPTY_NAME,\n    INVALID_NAME,\n    DUPLICATED_NAME,\n    NOT_ALLOWED;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/validation/Validator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.editor.commons.client.validation;\n\n/**\n * Validator\n */\npublic interface Validator {\n\n    void validate(final String value,\n                  final ValidatorCallback callback);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/validation/ValidatorCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.validation;\n\n/**\n * Callback to invoke one of two actions depending on whether validation was successful or failed.\n */\npublic interface ValidatorCallback {\n\n    void onSuccess();\n\n    void onFailure();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/java/org/uberfire/ext/editor/commons/client/validation/ValidatorWithReasonCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.validation;\n\n/**\n * Callback to pass a reason for validation failure\n */\npublic interface ValidatorWithReasonCallback extends ValidatorCallback {\n\n    public void onFailure(final String reason);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.editor.commons.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/UberfireCommonsEditorClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<module>\n\n  <inherits name=\"com.google.gwt.typedarrays.TypedArrays\"/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.editor.commons.UberfireCommonsEditorAPI\"/>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJanuary=January\nFebruary=February\nMarch=March\nApril=April\nMay=May\nJune=June\nJuly=July\nAugust=August\nOctober=October\nSeptember=September\nNovember=November\nDecember=December\nOK=OK\nEdit=Edit\nInvalidDateFormatMessage=Date format is invalid. Please follow the correct date format: dd-MMM-yyyy\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Sorry, an item of that name already exists in the repository. Please choose another.\nError=Error\nShowDetail=Show detail\nChoose=Choose...\nWaitWhileValidating=Wait while validating...\nWait=Please wait...\nFile=File\nOther=Other\nSave=Save\nValidate=Validate\nValidationErrors=Validation errors\nRestore=Restore\nRestoreWithComments=Restore with Comments\nCopy=Copy\nDelete=Delete\nRename=Rename\nRestoring=Restoring...\nCopying=Copying...\nDeleting=Deleting...\nRenaming=Renaming...\nMove=Move\nEditTabTitle=Editor\nSourceTabTitle=Source\nMetadataTabTitle=Metadata\nConfigTabTitle=Config\nDiscardUnsavedData=Are you sure you want to discard unsaved data?\nCantSaveReadOnly=Can''t save, it''s on read only mode.\nItemCreatedSuccessfully=Item successfully created.\nItemSavedSuccessfully=Item successfully saved.\nItemDeletedSuccessfully=Item successfully deleted.\nItemRenamedSuccessfully=Item successfully renamed.\nItemCopiedSuccessfully=Item successfully copied.\nItemMovedSuccessfully=Item successfully moved.\nItemValidatedSuccessfully=Item successfully validated.\nItemPathSubheading=Path:\nItemUndefinedPath=<No Path selected>\nMissingPath=Path in which to create new resource is missing. Please enter.\nItemRestored=Item reloaded due a restore operation.\nAddAnOptionalCheckInComment=Add an optional check in comment\nCheckIn=Check in\nRefreshingList=Refreshing list...\nUnableToLoadList=Unable to load list...\nCancel=Cancel\nName=Name\nWholeNumberInteger=Whole number (integer)\nTrueOrFalse=True or False\nDate=Date\nText=Text\nDecimalNumber=Decimal number\nDeleteItem=Delete item\nRuleAsset=Rule Asset\nNewItem=New Item\nNew=New\nAElementToDelInCollectionList=A element to delete in collection list\nAddElementBelow=Add element below\nMoveDownListMove=Move down\nMoveUpList=Move Up\nNewItemBelow=New item below\nMoveDown=Move down\nMoveUp=Move up\nPleaseSetAName=Please set a name\nLoading=Loading...\nSaving=Saving...\nUploadSuccess=Uploaded successfully\nInvalidFileName0=Resource name \"{0}\" is invalid.\nNewName=New name\nNewNameColon=New name:\nCheckInComment=Check in comment\nCheckInCommentColon=Check in comment:\nCopyPopupTitle=Copy this item\nCopyPopupCreateACopy=Create copy\nCopyPopupCreateACopyNamePrompt=Please enter the name you would like to copy this asset to\nRenamePopupTitle=Rename this item\nRenamePopupRenameItem=Rename item\nRenamePopupRenameNamePrompt=Please enter the name you would like to change this asset to\nSavePopupTitle=Save this item\nDeletePopupTitle=Delete this item\nDeletePopupDelete=Delete item\nDeletePopupRenameNamePrompt=Are you sure you want to delete this asset?\nNoneSelected=None selected\nLineNoneLine=- None -\nUploadSelectAFile=Please select a file to upload.\nUploadFileTypeNotSupported=The file type is not supported.\nUploadGenericError=An error occurred opening the workbook. It is possible that the encoding of the document did not match the encoding of the reader or the content is not XLS97 format.\nNoSuchFileTabTitle=Not found.\nNoSuchFileMessage=No such file. Please check the file exists at the version selected.\nOverview=Overview\nComments=Comments\nVersion=Version\nMore=more\nShowAll=show all\nAuthor=Author\nCommitMessage=Commit Message\nIndexClonedRepositoryWarning=The Repository will be indexed. Some workbench features may be unavailable until indexing has completed.\nLatestVersion=Latest Version\nVersion=Version {0}\nTags=Tags\nExceptionFileAlreadyExists0=File \"{0}\" already exists.\nCurrent=Current\nSelect=Select\nPackageColon=Package:\nHtmlEditor=HTML Editor\nValidating=Validating\nSaveWithComments=Save with Comments\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_de.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJanuary=Januar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nFebruary=Februar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMarch=März\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nApril=April\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMay=Mai\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJune=Juni\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJuly=Juli\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nAugust=August\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nOctober=Oktober\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSeptember=September\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNovember=November\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDecember=Dezember\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nOK=OK\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nEdit=Bearbeiten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nInvalidDateFormatMessage=Datumsformat ist ungültig. Bitte beachten Sie das korrekte Datumsformat\\: tt-MMM-jjjj\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Ein Element mit diesem Namen ist im Repository bereits vorhanden. Bitte wählen Sie ein anderes.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nError=Fehler\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nShowDetail=Details anzeigen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nChoose=Wählen...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nWaitWhileValidating=Warten während Validierung...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nWait=Bitte warten...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nFile=Datei\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nOther=Andere\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSave=Speichern\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nValidate=Validieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nValidationErrors=Validierungsfehler\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRestore=Wiederherstellen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCopy=Kopieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDelete=Löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRename=Umbenennen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRestoring=Stelle wieder her...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCopying=Kopiere...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDeleting=Lösche...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRenaming=Benenne um...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMove=Verschieben\nEditTabTitle=Editor\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSourceTabTitle=Quelle\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMetadataTabTitle=Metadaten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nConfigTabTitle=Config\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDiscardUnsavedData=Sind Sie sicher, dass Sie nicht gespeicherte Daten verwerfen möchten?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCantSaveReadOnly=Kann nicht speichern, schreibgeschützter Modus.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemCreatedSuccessfully=Element erfolgreich erstellt.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemSavedSuccessfully=Element erfolgreich gespeichert.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemDeletedSuccessfully=Element erfolgreich gelöscht.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemRenamedSuccessfully=Element erfolgreich umbenannt.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemCopiedSuccessfully=Element erfolgreich kopiert.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemMovedSuccessfully=Element erfolgreich verschoben.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemValidatedSuccessfully=Element erfolgreich validiert.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemPathSubheading=Pfad\\:\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemUndefinedPath=<No Path selected>\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMissingPath=Pfad, in dem neue Ressource erstellt werden soll, fehlt. Bitte eingeben.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nItemRestored=Element aufgrund von Wiederherstellungsvorgang neu geladen.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nAddAnOptionalCheckInComment=Einen optionalen check in Kommentar hinzufügen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCheckIn=Check in\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRefreshingList=Aktualisiere Liste...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nUnableToLoadList=Kann Liste nicht laden...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCancel=Abbrechen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nName=Name\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nWholeNumberInteger=Ganze Zahl (Integer)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nTrueOrFalse=True oder False\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDate=Datum\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nText=Text\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDecimalNumber=Dezimalzahl\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDeleteItem=Element löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRuleAsset=Regel-Asset\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNewItem=Neues Element\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNew=New\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nAElementToDelInCollectionList=Ein aus der Liste zu löschendes Element\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nAddElementBelow=Unten Element hinzufügen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveDownListMove=Nach unten verschieben\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveUpList=Nach oben verschieben\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNewItemBelow=Neuer Posten unten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveDown=Nach unten verschieben\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveUp=Nach oben verschieben\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nPleaseSetAName=Bitte einen Namen einstellen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nLoading=Lade...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSaving=Speichere...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nUploadSuccess=Erfolgreich hochgeladen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nInvalidFileName0=Ressourcenname \"{0}\" ist ungültig.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNewName=Neuer Name\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNewNameColon=Neuer Name\\:\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCheckInComment=Check in Kommentar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCheckInCommentColon=Check in Kommentar\\:\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCopyPopupTitle=Diesen Posten kopieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCopyPopupCreateACopy=Kopie erstellen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nCopyPopupCreateACopyNamePrompt=Bitte geben Sie den Namen, zu dem Sie dieses Asset kopieren möchten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRenamePopupTitle=Diesen Posten umbenennen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRenamePopupRenameItem=Posten umbenennen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRenamePopupRenameNamePrompt=Bitte geben Sie den Namen, zu dem Sie dieses Asset ändern möchten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSavePopupTitle=Dieses Element speichern\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDeletePopupTitle=Dieses Element löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDeletePopupDelete=Element löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDeletePopupRenameNamePrompt=Sind Sie sicher, dass Sie dieses Asset löschen möchten?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNoneSelected=Keine ausgewählt\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nLineNoneLine=- Keine - \n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nUploadSelectAFile=Bitte wählen Sie die hochzuladende Datei aus.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nUploadFileTypeNotSupported=Der Dateityp wird nicht unterstützt.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nUploadGenericError=Bei Öffnen des Workbooks ist ein Fehler aufgetreten. Es ist möglich, dass die Verschlüsselung des Dokuments nicht mit der Verschlüsselung des Readers übereinstimmte oder das Format nicht XLS97 ist.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author nmirasch\nNoSuchFileTabTitle=nicht gefunden\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNoSuchFileMessage=Keine solche Datei vorhanden. Bitte überprüfen Sie, ob die Datei an der gewählten Version existiert.\nOverview=Übersicht\nComments=Kommentare\nVersion=Version {0}\nMore=mehr\nShowAll=Alle anzeigen\nAuthor=Autor\nCommitMessage=Nachricht festschreiben\nIndexClonedRepositoryWarning=Das Repository wird indexiert. Einige Workbench-Features sind möglicherweise nicht verfügbar, bis die Indexierung abgeschlossen ist.\nLatestVersion=Aktuelle Version\nTags=Tags\nExceptionFileAlreadyExists0=Datei \"{0}\" existiert bereits.\nCurrent=Aktuell\nSelect=Auswählen\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJanuary=Enero\nFebruary=Febrero\nMarch=Marzo\nApril=Abril\nMay=Mayo\nJune=Junio\nJuly=Julio\nAugust=Agosto\nOctober=Octubre\nSeptember=Septiembre\nNovember=Noviembre\nDecember=Diciembre\nOK=Aceptar\nEdit=Editar\nInvalidDateFormatMessage=El formato de fecha no es válido. Siga el formato de fecha correcto: dd-MMM-aaaa\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Lo sentimos, ya existe un ítem con ese nombre en el repositorio. Elija otro.\nError=Error\nShowDetail=Mostrar detalle\nChoose=Elegir...\nWaitWhileValidating=Espere mientras está en curso la validación...\nWait=Espere...\nFile=Archivo\nOther=Otros\nSave=Guardar\nValidate=Validar\nValidationErrors=Errores de validación\nRestore=Restaurar\nRestoreWithComments=Restaurar con comentarios\nCopy=Copiar\nDelete=Eliminar\nRename=Cambiar nombre\nRestoring=Restaurando...\nCopying=Copiando...\nDeleting=Eliminando...\nRenaming=Cambiando el nombre...\nMove=Mover\nEditTabTitle=Editor\nSourceTabTitle=Fuente\nMetadataTabTitle=Metadatos\nConfigTabTitle=Config\nDiscardUnsavedData=¿Está seguro de que desea descartar los datos no guardados?\nCantSaveReadOnly=No se puede guardar; está en modo de solo lectura.\nItemCreatedSuccessfully=El ítem se creó correctamente.\nItemSavedSuccessfully=El ítem se guardó correctamente.\nItemDeletedSuccessfully=El ítem se eliminó correctamente.\nItemRenamedSuccessfully=El nombre del ítem se cambió correctamente.\nItemCopiedSuccessfully=El ítem se copió correctamente.\nItemMovedSuccessfully=El ítem se movió correctamente.\nItemValidatedSuccessfully=El ítem se validó correctamente.\nItemPathSubheading=Ruta:\nItemUndefinedPath=<No hay ruta seleccionada>\nMissingPath=Falta la ruta para crear nuevos recursos. Introdúzcala.\nItemRestored=El ítem se volvió a cargar debido a una operación de restauración.\nAddAnOptionalCheckInComment=Agregar un comentario de inserción opcional\nCheckIn=Entrar\nRefreshingList=Actualizando lista...\nUnableToLoadList=No se puede cargar la lista...\nCancel=Cancelar\nName=Nombre\nWholeNumberInteger=Número entero\nTrueOrFalse=Verdadero o falso\nDate=Fecha\nText=Texto\nDecimalNumber=Número decimal\nDeleteItem=Eliminar ítem\nRuleAsset=Activo de regla\nNewItem=Nuevo ítem\nNew=Nuevo\nAElementToDelInCollectionList=Un elemento por eliminar en la lista de colecciones\nAddElementBelow=Agregar el elemento a continuación\nMoveDownListMove=Mover hacia abajo\nMoveUpList=Mover hacia arriba\nNewItemBelow=Nuevo ítem a continuación\nMoveDown=Mover hacia abajo\nMoveUp=Mover hacia arriba\nPleaseSetAName=Establezca un nombre\nLoading=Cargando…\nSaving=Guardando…\nUploadSuccess=La carga se completó correctamente\nInvalidFileName0=El nombre del recurso \"{0}\" no es válido.\nNewName=Nuevo nombre\nNewNameColon=Nuevo nombre:\nCheckInComment=Comentario de inserción\nCheckInCommentColon=Comentario de inserción:\nCopyPopupTitle=Copiar este ítem\nCopyPopupCreateACopy=Crear copia\nCopyPopupCreateACopyNamePrompt=Introduzca el nombre que desea copiar para este activo\nRenamePopupTitle=Cambiar el nombre de este ítem\nRenamePopupRenameItem=Cambiar el nombre del ítem\nRenamePopupRenameNamePrompt=Introduzca el nombre que desea asignarle a este activo\nSavePopupTitle=Guardar este ítem\nDeletePopupTitle=Eliminar este ítem\nDeletePopupDelete=Eliminar ítem\nDeletePopupRenameNamePrompt=¿Está seguro de que desea eliminar este activo?\nNoneSelected=Ninguno seleccionado\nLineNoneLine=- Ninguno -\nUploadSelectAFile=Seleccione un archivo para cargar.\nUploadFileTypeNotSupported=No se admite el tipo de archivo.\nUploadGenericError=Se produjo un error al abrir el libro de trabajo. Es posible que la codificación del documento no coincida con la del lector o que el contenido no sea de formato XLS97.\nNoSuchFileTabTitle=No se encuentra.\nNoSuchFileMessage=No existe este archivo. Compruebe que el archivo existe en la versión seleccionada.\nOverview=Descripción general\nComments=Comentarios\nVersion=Versión\nMore=más\nShowAll=mostrar todo\nAuthor=Autor\nCommitMessage=Confirmar mensaje\nIndexClonedRepositoryWarning=El repositorio se indexará. Algunas de las funcionalidades de la mesa de trabajo podrían no estar disponibles hasta que se haya completado la indexación.\nLatestVersion=Última versión\nVersion=Versión {0}\nTags=Etiquetas\nExceptionFileAlreadyExists0=El archivo \"{0}\" ya existe.\nCurrent=Actual\nSelect=Seleccionar\nPackageColon=Paquete:\nHtmlEditor=Editor HTML\nValidating=Validación\nSaveWithComments=Guardar con comentarios\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJanuary=Janvier\nFebruary=Février\nMarch=Mars\nApril=Avril\nMay=Mai\nJune=Juin\nJuly=Juillet\nAugust=Août\nOctober=Octobre\nSeptember=Septembre\nNovember=Novembre\nDecember=Décembre\nOK=OK\nEdit=Modifier\nInvalidDateFormatMessage=Le format de la date n''est pas valide. Veuillez utiliser le format de date correct : jj-MMM-aaaa\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Désolé, il existe déjà un élément portant ce nom dans le référentiel. Veuillez en choisir un autre.\nError=Erreur\nShowDetail=Afficher les détails\nChoose=Choisir…\nWaitWhileValidating=Veuillez patienter pendant la validation…\nWait=Veuillez patienter…\nFile=Fichier\nOther=Autres\nSave=Enregistrer\nValidate=Valider\nValidationErrors=Erreurs de validation\nRestore=Restaurer\nRestoreWithComments=Restaurer avec les commentaires\nCopy=Copier\nDelete=Supprimer\nRename=Renommer\nRestoring=Restauration…\nCopying=Copie…\nDeleting=Suppression…\nRenaming=Modification du nom…\nMove=Déplacer\nEditTabTitle=Éditeur\nSourceTabTitle=Source\nMetadataTabTitle=Métadonnées\nConfigTabTitle=Config\nDiscardUnsavedData=Voulez-vous vraiment supprimer les données non enregistrées ?\nCantSaveReadOnly=Enregistrement impossible. L''élément est en lecture seule.\nItemCreatedSuccessfully=L''élément a été créé.\nItemSavedSuccessfully=L''élément a été enregistré.\nItemDeletedSuccessfully=L''élément a été supprimé.\nItemRenamedSuccessfully=L''élément a été renommé.\nItemCopiedSuccessfully=L''élément a été copié.\nItemMovedSuccessfully=L''élément a été déplacé.\nItemValidatedSuccessfully=L''élément a été validé.\nItemPathSubheading=Chemin d''accès :\nItemUndefinedPath=<Aucun chemin d’accès sélectionné>\nMissingPath=Le chemin d''accès à utiliser pour la création d''une ressource n''est pas indiqué. Veuillez le spécifier.\nItemRestored=Élément rechargé en raison d''une opération de restauration.\nAddAnOptionalCheckInComment=Ajouter un commentaire d''archivage facultatif\nCheckIn=Archiver\nRefreshingList=Rafraîchissement de la liste…\nUnableToLoadList=Impossible de charger la liste…\nCancel=Annuler\nName=Nom\nWholeNumberInteger=Nombre entier\nTrueOrFalse=Vrai ou faux\nDate=Date\nText=Texte\nDecimalNumber=Nombre décimal\nDeleteItem=Supprimer l''élément\nRuleAsset=Actif de règle\nNewItem=Nouvel élément\nNew=Nouveau\nAElementToDelInCollectionList=Élément à supprimer dans la liste de collecte\nAddElementBelow=Ajouter un élément en dessous\nMoveDownListMove=Déplacer vers le bas\nMoveUpList=Déplacer vers le haut\nNewItemBelow=Nouvel élément en dessous\nMoveDown=Déplacer vers le bas\nMoveUp=Déplacer vers le haut\nPleaseSetAName=Veuillez indiquer un nom\nLoading=Chargement…\nSaving=Enregistrement…\nUploadSuccess=Envoyé avec succès\nInvalidFileName0=Le nom de la ressource \"{0}\" n''est pas valide.\nNewName=Nouveau nom\nNewNameColon=Nouveau nom :\nCheckInComment=Commentaire d''archivage\nCheckInCommentColon=Commentaire d''archivage :\nCopyPopupTitle=Copier cet élément\nCopyPopupCreateACopy=Créer une copie\nCopyPopupCreateACopyNamePrompt=Veuillez indiquer le nom à utiliser pour la copie de cet actif\nRenamePopupTitle=Renommer cet élément\nRenamePopupRenameItem=Renommer l''élément\nRenamePopupRenameNamePrompt=Veuillez indiquer le nouveau nom que vous souhaitez attribuer à cet actif\nSavePopupTitle=Enregistrer cet élément\nDeletePopupTitle=Supprimer cet élément\nDeletePopupDelete=Supprimer l''élément\nDeletePopupRenameNamePrompt=Voulez-vous vraiment supprimer cet actif ?\nNoneSelected=Aucune sélection\nLineNoneLine=- Aucune -\nUploadSelectAFile=Veuillez sélectionner un fichier à envoyer.\nUploadFileTypeNotSupported=Le type de fichier n''est pas pris en charge.\nUploadGenericError=Une erreur s''est produite lors de l''ouverture du classeur. Il est possible que l''encodage du document ne corresponde pas à celui du lecteur ou que le contenu ne soit pas au format XLS97.\nNoSuchFileTabTitle=Non trouvé.\nNoSuchFileMessage=Aucun fichier de ce type. Veuillez vérifier que le fichier existe dans la version choisie.\nOverview=Aperçu\nComments=Commentaires\nVersion=Version\nMore=plus\nShowAll=afficher tout\nAuthor=Auteur\nCommitMessage=Valider le message\nIndexClonedRepositoryWarning=Le référentiel sera indexé. Il se peut que certaines fonctionnalités du tableau de référence soient indisponibles tant que l''indexation n''est pas terminée.\nLatestVersion=Dernière version\nVersion=Version {0}\nTags=Balises\nExceptionFileAlreadyExists0=Le fichier \"{0}\" existe déjà.\nCurrent=En cours\nSelect=Sélectionner\nPackageColon=Package :\nHtmlEditor=Éditeur HTML\nValidating=Validation\nSaveWithComments=Enregistrer avec les commentaires\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJanuary=Gennaio\nFebruary=Febbraio\nMarch=Marzo\nApril=Aprile\nMay=Maggio\nJune=Giugno\nJuly=Luglio\nAugust=Agosto\nOctober=Ottobre\nSeptember=Settembre\nNovember=Novembre\nDecember=Dicembre\nOK=OK\nEdit=Modifica\nInvalidDateFormatMessage=Il formato della data non è valido. Seguire il formato corretto della data: dd-MMM-yyyy\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Spiacenti, esiste già un elemento con questo nome nel repository. Scegliere un altro nome.\nError=Errore\nShowDetail=Mostra dettaglio\nChoose=Scegli...\nWaitWhileValidating=Attendere la convalida...\nWait=Attendere...\nFile=File\nOther=Altro\nSave=Salva\nValidate=Convalida\nValidationErrors=Errori di convalida\nRestore=Ripristina\nRestoreWithComments=Ripristina con commenti\nCopy=Copia\nDelete=Elimina\nRename=Rinomina\nRestoring=Ripristino...\nCopying=Copia...\nDeleting=Eliminazione...\nRenaming=Rinomina...\nMove=Sposta\nEditTabTitle=Editor\nSourceTabTitle=Origine\nMetadataTabTitle=Metadati\nConfigTabTitle=Configurazione\nDiscardUnsavedData=Sei sicuro di voler eliminare i dati non salvati?\nCantSaveReadOnly=Impossibile salvare, la modalità di sola lettura è attiva.\nItemCreatedSuccessfully=Elemento creato con successo.\nItemSavedSuccessfully=Elemento salvato con successo.\nItemDeletedSuccessfully=Elemento eliminato con successo.\nItemRenamedSuccessfully=Elemento rinominato con successo.\nItemCopiedSuccessfully=Elemento copiato con successo.\nItemMovedSuccessfully=Elemento spostato con successo.\nItemValidatedSuccessfully=Elemento convalidato con successo.\nItemPathSubheading=Percorso:\nItemUndefinedPath=<Nessun percorso selezionato>\nMissingPath=Manca il percorso in cui creare la nuova risorsa. Inserire il percorso.\nItemRestored=Elemento ricaricato a causa di un''operazione di ripristino.\nAddAnOptionalCheckInComment=Aggiungi un commento facoltativo per il check-in\nCheckIn=Check-in\nRefreshingList=Aggiornamento della lista...\nUnableToLoadList=Impossibile caricare la lista...\nCancel=Annulla\nName=Nome\nWholeNumberInteger=Numero intero\nTrueOrFalse=Vero o falso\nDate=Data\nText=Testo\nDecimalNumber=Numero decimale\nDeleteItem=Elimina elemento\nRuleAsset=Asset di regola\nNewItem=Nuovo elemento\nNew=Nuovo\nAElementToDelInCollectionList=Un elemento da eliminare nella lista di raccolta\nAddElementBelow=Aggiungi elemento sotto\nMoveDownListMove=Sposta in basso\nMoveUpList=Sposta in alto\nNewItemBelow=Nuovo elemento sotto\nMoveDown=Sposta in basso\nMoveUp=Sposta in alto\nPleaseSetAName=Impostare un nome\nLoading=Caricamento...\nSaving=Salvataggio...\nUploadSuccess=Caricamento completato con successo\nInvalidFileName0=Il nome della risorsa \"{0}\" non è valido.\nNewName=Nuovo nome\nNewNameColon=Nuovo nome:\nCheckInComment=Commento per il check-in\nCheckInCommentColon=Commento per il check-in:\nCopyPopupTitle=Copia questo elemento\nCopyPopupCreateACopy=Crea una copia\nCopyPopupCreateACopyNamePrompt=Inserisci il nome con cui desideri copiare questa risorsa\nRenamePopupTitle=Rinomina questo elemento\nRenamePopupRenameItem=Rinomina elemento\nRenamePopupRenameNamePrompt=Inserisci il nome con cui desideri rinominare questa risorsa\nSavePopupTitle=Salva questo elemento\nDeletePopupTitle=Elimina questo elemento\nDeletePopupDelete=Elimina elemento\nDeletePopupRenameNamePrompt=Sei sicuro di voler eliminare questa risorsa?\nNoneSelected=Nessuna selezione\nLineNoneLine=- Nessuno -\nUploadSelectAFile=Seleziona un file da caricare.\nUploadFileTypeNotSupported=Il tipo di file non è supportato.\nUploadGenericError=Si è verificato un errore nell''apertura del foglio di lavoro. È possibile che la codifica del documento non corrisponda alla codifica del lettore o che il contenuto non sia nel formato XLS97.\nNoSuchFileTabTitle=Non trovato.\nNoSuchFileMessage=File non trovato. Verificare che il file esista nella versione selezionata.\nOverview=Panoramica\nComments=Commenti\nVersion=Versione\nMore=altro\nShowAll=mostra tutto\nAuthor=Autore\nCommitMessage=Messaggio di commit\nIndexClonedRepositoryWarning=Il repository verrà indicizzato. Alcune funzionalità del workbench potrebbero non essere disponibili fino al completamento dell''indicizzazione.\nLatestVersion=Ultima versione\nVersion=Versione {0}\nTags=Tag\nExceptionFileAlreadyExists0=Il file \"{0}\" esiste già.\nCurrent=Corrente\nSelect=Seleziona\nPackageColon=Pacchetto:\nHtmlEditor=Editor HTML\nValidating=Convalida in corso\nSaveWithComments=Salva con commenti\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nJanuary=1月\nFebruary=2月\nMarch=3月\nApril=4月\nMay=5月\nJune=6月\nJuly=7月\nAugust=8月\nOctober=10月\nSeptember=9月\nNovember=11月\nDecember=12月\nOK=OK\nEdit=編集\nInvalidDateFormatMessage=日付の形式が無効です。正しい日付形式 dd-MMM-yyyy に合わせてください。\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=その名前のアイテムはすでにリポジトリーに存在します。他の名前を選択してください。\nError=エラー\nShowDetail=詳細を表示\nChoose=選択…\nWaitWhileValidating=検証中お待ちください…\nWait=お待ちください...\nFile=ファイル\nOther=その他\nSave=保存\nValidate=検証\nValidationErrors=検証エラー\nRestore=復元\nRestoreWithComments=コメント付きで復元\nCopy=コピー\nDelete=削除\nRename=名前を変更\nRestoring=復元中...\nCopying=コピー中...\nDeleting=削除中...\nRenaming=名前の変更中...\nMove=移動\nEditTabTitle=エディター\nSourceTabTitle=ソース\nMetadataTabTitle=メタデータ\nConfigTabTitle=設定\nDiscardUnsavedData=保存していないデータを破棄してもよろしいですか?\nCantSaveReadOnly=読み取り専用モードのため保存できません。\nItemCreatedSuccessfully=アイテムが作成されました。\nItemSavedSuccessfully=アイテムが保存されました。\nItemDeletedSuccessfully=アイテムが削除されました。\nItemRenamedSuccessfully=アイテムの名前が変更されました。\nItemCopiedSuccessfully=アイテムがコピーされました。\nItemMovedSuccessfully=アイテムが正常に移動されました。\nItemValidatedSuccessfully=アイテムが正常に検証されました。\nItemPathSubheading=パス:\nItemUndefinedPath=<No Path selected>\nMissingPath=新しいリソースを作成するパスがありません。入力してください。\nItemRestored=復元操作によってアイテムが再ロードされました。\nAddAnOptionalCheckInComment=オプションのチェックインコメントを追加\nCheckIn=チェックイン\nRefreshingList=一覧のリフレッシュ中...\nUnableToLoadList=一覧をロードできません...\nCancel=キャンセル\nName=名前\nWholeNumberInteger=数字全体 (整数)\nTrueOrFalse=True か False\nDate=日付\nText=テキスト\nDecimalNumber=10 進数\nDeleteItem=アイテムを削除\nRuleAsset=ルールアセット\nNewItem=新しいアイテム\nNew=新規\nAElementToDelInCollectionList=コレクションリストで削除する要素\nAddElementBelow=下に要素を追加\nMoveDownListMove=下に移動\nMoveUpList=上に移動\nNewItemBelow=以下の新しいアイテム\nMoveDown=下に移動\nMoveUp=上に移動\nPleaseSetAName=名前をセットしてください\nLoading=ロード中...\nSaving=保存中...\nUploadSuccess=正常にアップロードされました\nInvalidFileName0=リソース名 \"{0}\" が無効です。\nNewName=新しい名前\nNewNameColon=新しい名前:\nCheckInComment=チェックインコメント\nCheckInCommentColon=チェックインコメント:\nCopyPopupTitle=このアイテムをコピー\nCopyPopupCreateACopy=コピーを作成\nCopyPopupCreateACopyNamePrompt=このアセットのコピー先の名前を入力してください\nRenamePopupTitle=このアイテムの名前を変更\nRenamePopupRenameItem=アイテムの名前を変更\nRenamePopupRenameNamePrompt=このアセットの変更後の名前を入力してください\nSavePopupTitle=このアイテムを保存\nDeletePopupTitle=このアイテムの削除\nDeletePopupDelete=アイテムを削除\nDeletePopupRenameNamePrompt=このアセットを削除してもよろしいですか?\nNoneSelected=何も選択されていません\nLineNoneLine=- なし -\nUploadSelectAFile=アップロードするファイルを選択してください。\nUploadFileTypeNotSupported=ファイルタイプがサポートされていません。\nUploadGenericError=ワークブックを開くときにエラーが発生しました。ドキュメントのエンコーディングが、リーダーのエンコーディングに一致しませんでした。または、内容が XLS97 形式ではありません。\nNoSuchFileTabTitle=見つかりません。\nNoSuchFileMessage=そのようなファイルはありません。選択したバージョンにファイルが存在するか確認してください。\nOverview=概要\nComments=コメント\nVersion=バージョン\nMore=詳細情報\nShowAll=すべて表示\nAuthor=作者\nCommitMessage=メッセージのコミット\nIndexClonedRepositoryWarning=リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。\nLatestVersion=最新バージョン\nVersion=バージョン {0}\nTags=タグ\nExceptionFileAlreadyExists0=ファイル \"{0}\" はすでに存在します。\nCurrent=現在\nSelect=選択\nPackageColon=パッケージ:\nHtmlEditor=HTML エディター\nValidating=検証中\nSaveWithComments=コメント付きで保存\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "January=Janeiro\nFebruary=Fevereiro\nMarch=Março\nApril=Abril\nMay=Maio\nJune=Junho\nJuly=Julho\nAugust=Agosto\nOctober=Outubro\nSeptember=Setembro\nNovember=Novembro\nDecember=Dezembro\nOK=OK\nEdit=Editar\nInvalidDateFormatMessage=O formato de data é inválido. Por favor siga o formato de data correto\\: dd-MMM-yyyy (dia-mês-ano)\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=Desculpe, mas um item deste nome já existe no repositório. Por favor escolha outro.\nError=Error\nShowDetail=Apresentar detalhe\nChoose=Escolha...\nWaitWhileValidating=Validando item, por favor aguarde...\nWait=Por favor espere...\nFile=Arquivo\nOther=Outro\nSave=Salvar\nValidate=Validar\nValidationErrors=Erros de Validação\nRestore=Restaurar\nCopy=Cópia\nDelete=Excluir\nRename=Renomear\nRestoring=Restaurando...\nCopying=Copiando...\nDeleting=Excluindo...\nRenaming=Renomeando...\nMove=Mover\nEditTabTitle=Editor\nSourceTabTitle=Fonte\nMetadataTabTitle=Metadados\nConfigTabTitle=Config\nDiscardUnsavedData=Você tem certeza que deseja descartar os dados que não foram salvos?\nCantSaveReadOnly=Não foi possível salvar. Isto está no modo de leitura apenas.\nItemCreatedSuccessfully=Item criado com sucesso.\nItemSavedSuccessfully=Item salvo com sucesso.\nItemDeletedSuccessfully=Item excluído com sucesso.\nItemRenamedSuccessfully=Item renomeado com sucesso.\nItemCopiedSuccessfully=Item copiado com sucesso.\nItemMovedSuccessfully=Item movido com sucesso.\nItemValidatedSuccessfully=Item validado com sucesso.\nItemPathSubheading=Caminho\\:\nItemUndefinedPath=<No Path selected>\nMissingPath=Falta do caminho que cria novo recurso. Por favor insira-o.\nItemRestored=Item recarregado devido à operação restaurar.\nAddAnOptionalCheckInComment=Adiciona uma verificação opcional no comentário\nCheckIn=Registrar\nRefreshingList=Restaurando lista...\nUnableToLoadList=Não foi possível carregar lista... \nCancel=Cancelar\nName=Nome\nWholeNumberInteger=Número inteiro (integer)\nTrueOrFalse=Verdadeiro ou falso\nDate=Data\nText=Texto\nDecimalNumber=Número decimal\nDeleteItem=Excluir item\nRuleAsset=Regra do Ativo\nNewItem=Novo Item\nNew=Novo\nAElementToDelInCollectionList=O elemento a ser excluído na lista de coleção\nAddElementBelow=Adicionar o elemento abaixo\nMoveDownListMove=Mover para baixo\nMoveUpList=Mover para cima\nNewItemBelow=Segue abaixo novo item\nMoveDown=Mover para baixo\nMoveUp=Mover para cima\nPleaseSetAName=Por favor determine um nome\nLoading=Carregando...\nSaving=Salvando...\nUploadSuccess=Carregando com êxito\nInvalidFileName0=O nome do recurso \"{0}\" está inválido.\nNewName=Novo nome\nNewNameColon=Novo nome\\:\nCheckInComment=Registrar comentário\nCheckInCommentColon=Registrar comentário\\:\nCopyPopupTitle=Copiar este item\nCopyPopupCreateACopy=Criar cópia\nCopyPopupCreateACopyNamePrompt=Por favor insira o nome que você gostaria de mudar deste ativo\nRenamePopupTitle=Renomear este item\nRenamePopupRenameItem=Renomear item\nRenamePopupRenameNamePrompt=Por favor insira o nome que você gostaria de mudar deste ativo\nSavePopupTitle=Salve este item\nDeletePopupTitle=Excluir este item\nDeletePopupDelete=Excluir item\nDeletePopupRenameNamePrompt=Você tem certeza que deseja excluir este ativo\\:\nNoneSelected=Nada foi selecionado\nLineNoneLine=- Nenhum -\nUploadSelectAFile=Por favor selecione um arquivo para carregar.\nUploadFileTypeNotSupported=O tipo de arquivo não é suportado.\nUploadGenericError=Ocorreu um erro abrindo a pasta de trabalho. É possível que a codificação do documento não coincida com a codificação do leitor ou o conteúdo não está no formato XLS87.\nNoSuchFileTabTitle=Não foi encontrado.\nNoSuchFileMessage=Nenhum arquivo. Por favor verifique se o arquivo existe na versão selecionada.\nOverview=Visão Geral\nComments=Comentários\nVersion=Versão {0}\nMore=mais\nShowAll=apresente tudo\nAuthor=Autor\nCommitMessage=Mensagem de Confirmação\nIndexClonedRepositoryWarning=O Repositório será indexado. Alguns recursos de bancada podem estar indisponíveis até que a indexação seja concluída.\nLatestVersion=Última Versão\nTags=Tags\nExceptionFileAlreadyExists0=O arquivo \"{0}\" já existe. \nCurrent=Atual\nSelect=Selecionar\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJanuary=一月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nFebruary=二月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMarch=三月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nApril=四月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMay=五月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJune=六月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJuly=七月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nAugust=八月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nOctober=十月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSeptember=九月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNovember=十一月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDecember=十二月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nOK=确定\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nEdit=编辑\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nInvalidDateFormatMessage=日期格式不正确。请使用格式：dd-MMM-yyyy\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSorryAnItemOfThatNameAlreadyExistsInTheRepositoryPleaseChooseAnother=对不起,同名的条目已经存在。请选择另一个。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nError=错误\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nShowDetail=显示细节\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nChoose=选择...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nWaitWhileValidating=验证中，请稍候...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nWait=请等待...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nFile=文件\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nOther=其他\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSave=保存\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nValidate=检验\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nValidationErrors=检验错误\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRestore=恢复\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCopy=复制\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDelete=删除\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRename=重命名\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRestoring=正在恢复...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCopying=正在复制...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDeleting=正在删除...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRenaming=正在重命名...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMove=移动\\t\nEditTabTitle=编辑器\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSourceTabTitle=源代码\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMetadataTabTitle=元数据\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nConfigTabTitle=配置\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDiscardUnsavedData=确认要放弃未保存的数据吗?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCantSaveReadOnly=无法保存，它处于只读模式。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemCreatedSuccessfully=成功创建了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemSavedSuccessfully=成功保存了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemDeletedSuccessfully=成功删除了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemRenamedSuccessfully=成功重命名了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemCopiedSuccessfully=成功复制了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemMovedSuccessfully=成功移动了条目。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemValidatedSuccessfully=条目被成功验证。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemPathSubheading=路径：\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemUndefinedPath=<未选择路径>\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMissingPath=缺失了创建新资源的路径。请输入这个路径。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nItemRestored=由于恢复操作导致条目被重载。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nAddAnOptionalCheckInComment=添加可选的检入注释\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCheckIn=检入\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRefreshingList=正在刷新列表...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nUnableToLoadList=不能加载列表...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCancel=取消\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nName=名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nWholeNumberInteger=整数\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nTrueOrFalse=正确 或 错误\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDate=日期\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nText=文本\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDecimalNumber=十进制数\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDeleteItem=删除条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRuleAsset=规则资产\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNewItem=新建条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNew=新建\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nAElementToDelInCollectionList=集合列表里要删除的元素\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nAddElementBelow=在下面添加元素\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveDownListMove=下移\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveUpList=上移\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNewItemBelow=在下面新建条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveDown=下移\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveUp=上移\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nPleaseSetAName=请设置名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nLoading=正在加载...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSaving=正在保存...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nUploadSuccess=成功上传\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nInvalidFileName0=资源名 \"{0}\" 是无效的。 \n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNewName=新建名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNewNameColon=新建名称\\:\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCheckInComment=检入注释\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCheckInCommentColon=检入注释：\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCopyPopupTitle=复制该条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCopyPopupCreateACopy=创建拷贝\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nCopyPopupCreateACopyNamePrompt=请输入修改后的资产名\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRenamePopupTitle=重命名这个条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRenamePopupRenameItem=重命名条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRenamePopupRenameNamePrompt=请输入修改后的资产名\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSavePopupTitle=保存这个条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDeletePopupTitle=删除这个条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDeletePopupDelete=删除条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDeletePopupRenameNamePrompt=你确定要删除这个资产？\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNoneSelected=未选择条目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nLineNoneLine=- 无 -\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nUploadSelectAFile=请选择要上传的文件。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nUploadFileTypeNotSupported=该文件类型不被支持。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nUploadGenericError=打开工作薄时出错。这个文档的编码可能和阅读器的编码不一致，或者内容格式不是 XLS97。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNoSuchFileTabTitle=未找到。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNoSuchFileMessage=没有这个文件。请检查是否存在选定版本的文件。\nOverview=概览\nComments=评论\nVersion=版本 {0}\nMore=更多\nShowAll=全部显示\nAuthor=作者\nCommitMessage=提交消息\nIndexClonedRepositoryWarning=资料库将编制索引。在索引完成至前，某些工作区的功能可能不可用。\nLatestVersion=最新版本\nTags=标签\nExceptionFileAlreadyExists0=文件 \"{0}\" 已存在。\nCurrent=当前\nSelect=选择\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/Constants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nSavePopUpView.SaveWithComments=Save with Comments\nSavePopUpView.Save=Save\nSavePopUpView.Cancel=Cancel\nDeletePopUpView.ConfirmDelete=Confirm Delete\nDeletePopUpView.AreYouSure=Are you sure you want to delete this Asset?\nDeletePopUpView.Delete=Delete\nDeletePopUpView.Cancel=Cancel\nDeletePopUpView.DeleteNotAllowed=You don't have permission to delete this file.\nDeletePopUpView.UnexpectedError=An unexpected error occurred while trying to delete the file.\nRestorePopUpView.RestoreWithComments=Restore with Comments\nRestorePopUpView.Restore=Restore\nRestorePopUpView.Cancel=Cancel\nCopyPopUpView.MakeACopy=Make a Copy\nCopyPopUpView.NewName=New Name\nCopyPopUpView.Cancel=Cancel\nCopyPopUpView.InvalidFileName=Resource name \"{0}\" is invalid.\nCopyPopUpView.FileAlreadyExists=File \"{0}\" already exists.\nCopyPopUpView.CopyNotAllowed=You don't have permission to copy this file.\nRenamePopUpView.RenameAsset=Rename Asset\nRenamePopUpView.AssetName=Asset Name\nRenamePopUpView.Rename=Rename\nRenamePopUpView.SaveAndRename=Save and Rename\nRenamePopUpView.Cancel=Cancel\nRenamePopUpView.InvalidFileName=Resource name \"{0}\" is invalid.\nRenamePopUpView.FileAlreadyExists=File \"{0}\" already exists.\nRenamePopUpView.RenameNotAllowed=You don't have permission to rename this file.\nToggleCommentView.AddAComment=add a comment\nToggleCommentView.EnterComment=Enter Comment\nHtmlEditorView.CantSaveReadOnly=Can''t save, it''s on read only mode.\nHtmlEditorView.Loading=Loading...\nHtmlEditorView.Saving=Saving...\nHtmlEditorView.DiscardUnsavedData=Are you sure you want to discard unsaved data?\nHtmlEditorView.Ok=OK\nHtmlEditorView.Cancel=Cancel\nHtmlEditorView.Bold=Bold (Ctrl+B)\nHtmlEditorView.Italic=Italic (Ctrl+I)\nHtmlEditorView.Underline=Underline (Ctrl+U)\nHtmlEditorView.CreateLink=Create link\nHtmlEditorView.RemoveLink=Remove link\nHtmlEditorView.InsertImage=Insert image\nHtmlEditorView.InsertTable=Insert table\nHtmlEditorView.BigTitle=Big title\nHtmlEditorView.MediumTitle=Medium title\nHtmlEditorView.SmallTitle=Small title\nHtmlEditorView.Paragraph=Paragraph\nHtmlEditorView.Pre=Pre\nHtmlEditorView.PlainText=Plain text\nHtmlEditorView.Quote=Quote\nHtmlEditorView.Code=Code\nHtmlEditorView.FontSize=Font size\nHtmlEditorView.FontColor=Font color\nHtmlEditorView.BackgroundColor=Background color\nHtmlEditorView.UnorderedList=Unordered list\nHtmlEditorView.OrderedList=Ordered list\nHtmlEditorView.OutdentList=Outdent list\nHtmlEditorView.IndentList=Indent list\nHtmlEditorView.AlignLeft=Align left\nHtmlEditorView.AlignRight=Align right\nHtmlEditorView.AlignCenter=Align center\nHtmlEditorView.Undo=Undo\nHtmlEditorView.Redo=Redo\nHtmlEditorView.SwitchToHtmlView=Switch to HTML view\nHtmlEditorView.SwitchView=Switch view\nHtmlEditorView.TableOptions=Table options:\nHtmlEditorView.TableMergeCells=Merge cells\nHtmlEditorView.TableAddRowBefore=Add row before\nHtmlEditorView.TableAddRowAfter=Add row after\nHtmlEditorView.TableAddColumnBefore=Add column before\nHtmlEditorView.TableAddColumnAfter=Add column after\nHtmlEditorView.TableRemoveRow=Remove row\nHtmlEditorView.TableRemoveColumn=Remove column\nHtmlEditorView.FontSizeDialog=Font size:\nHtmlEditorView.BackgroundColorDialog=Background color:\nHtmlEditorView.FontColorDialog=Font color:\nHtmlEditorView.LinkDialog=Link:\nHtmlEditorView.ImageDialog=Image:\nHtmlEditorView.ImageAlignment=Alignment:\nHtmlEditorView.ImageAlignmentDefault=Default\nHtmlEditorView.ImageAlignmentLeft=Left\nHtmlEditorView.ImageAlignmentRight=Right\nHtmlEditorView.TableRows=Rows:\nHtmlEditorView.TableColumns=Columns:\nHtmlEditorView.xx-small=xx-small\nHtmlEditorView.x-small=x-small\nHtmlEditorView.small=small\nHtmlEditorView.medium=medium\nHtmlEditorView.large=large\nHtmlEditorView.x-large=x-large\nHtmlEditorView.xx-large=xx-large\nFileExport.Label=File exporting\nFileExport.PdfOrientation.Text=PDF orientation\nFileExport.PdfOrientation.Help=The PDF file orientation. Allowed values are PORTRAIT, LANDSCAPE\nFileExport.PdfUnit.Text=PDF units\nFileExport.PdfUnit.Help=The PDF file units. Allowed values are PT, MM, CM, IN\nFileExport.PdfFormat.Text=PDF page format\nFileExport.PdfFormat.Help=The PDF file page format. Allowed values are A[0-10], B[0-10], C[0-10]\nDownloadMenuItem.Download=Download\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nSavePopUpView.SaveWithComments=Guardar con comentarios\nSavePopUpView.Save=Guardar\nSavePopUpView.Cancel=Cancelar\nDeletePopUpView.ConfirmDelete=Confirmar eliminación\nDeletePopUpView.AreYouSure=¿Está seguro de que desea eliminar este activo?\nDeletePopUpView.Delete=Eliminar\nDeletePopUpView.Cancel=Cancelar\nDeletePopUpView.DeleteNotAllowed=No tiene permiso para eliminar este archivo.\nDeletePopUpView.UnexpectedError=Se produjo un error inesperado al intentar eliminar el archivo.\nRestorePopUpView.RestoreWithComments=Restaurar con comentarios\nRestorePopUpView.Restore=Restaurar\nRestorePopUpView.Cancel=Cancelar\nCopyPopUpView.MakeACopy=Hacer una copia\nCopyPopUpView.NewName=Nuevo nombre\nCopyPopUpView.Cancel=Cancelar\nCopyPopUpView.InvalidFileName=El nombre del recurso \"{0}\" no es válido.\nCopyPopUpView.FileAlreadyExists=El archivo \"{0}\" ya existe.\nCopyPopUpView.CopyNotAllowed=No tiene permiso para copiar este archivo.\nRenamePopUpView.RenameAsset=Cambiar el nombre del activo\nRenamePopUpView.AssetName=Nombre del activo\nRenamePopUpView.Rename=Cambiar nombre\nRenamePopUpView.SaveAndRename=Guardar y cambiar nombre\nRenamePopUpView.Cancel=Cancelar\nRenamePopUpView.InvalidFileName=El nombre del recurso \"{0}\" no es válido.\nRenamePopUpView.FileAlreadyExists=El archivo \"{0}\" ya existe.\nRenamePopUpView.RenameNotAllowed=No tiene permiso para cambiar el nombre de este archivo.\nToggleCommentView.AddAComment=agregar un comentario\nToggleCommentView.EnterComment=Introducir comentario\nHtmlEditorView.CantSaveReadOnly=No se puede guardar; está en modo de solo lectura.\nHtmlEditorView.Loading=Cargando…\nHtmlEditorView.Saving=Guardando…\nHtmlEditorView.DiscardUnsavedData=¿Está seguro de que desea descartar los datos no guardados?\nHtmlEditorView.Ok=Aceptar\nHtmlEditorView.Cancel=Cancelar\nHtmlEditorView.Bold=Negrita (Ctrl+B)\nHtmlEditorView.Italic=Cursiva (Ctrl+I)\nHtmlEditorView.Underline=Subrayado (Ctrl+U)\nHtmlEditorView.CreateLink=Crear enlace\nHtmlEditorView.RemoveLink=Quitar enlace\nHtmlEditorView.InsertImage=Insertar imagen\nHtmlEditorView.InsertTable=Insertar tabla\nHtmlEditorView.BigTitle=Titulo grande\nHtmlEditorView.MediumTitle=Título mediano\nHtmlEditorView.SmallTitle=Título pequeño\nHtmlEditorView.Paragraph=Párrafo\nHtmlEditorView.Pre=Pre\nHtmlEditorView.PlainText=Texto simple\nHtmlEditorView.Quote=Cuota\nHtmlEditorView.Code=Código\nHtmlEditorView.FontSize=Tamaño de fuente\nHtmlEditorView.FontColor=Color de fuente\nHtmlEditorView.BackgroundColor=Color de fondo\nHtmlEditorView.UnorderedList=Lista no ordenada\nHtmlEditorView.OrderedList=Lista ordenada\nHtmlEditorView.OutdentList=Lista sin sangría\nHtmlEditorView.IndentList=Lista en sangría\nHtmlEditorView.AlignLeft=Alinear a la izquierda\nHtmlEditorView.AlignRight=Alinear a la derecha\nHtmlEditorView.AlignCenter=Alinear al centro\nHtmlEditorView.Undo=Deshacer\nHtmlEditorView.Redo=Rehacer\nHtmlEditorView.SwitchToHtmlView=Cambiar a la vista HTML\nHtmlEditorView.SwitchView=Cambiar la vista\nHtmlEditorView.TableOptions=Opciones de tabla:\nHtmlEditorView.TableMergeCells=Fusionar celdas\nHtmlEditorView.TableAddRowBefore=Agregar la fila antes de\nHtmlEditorView.TableAddRowAfter=Agregar la fila después de\nHtmlEditorView.TableAddColumnBefore=Agregar la columna antes de\nHtmlEditorView.TableAddColumnAfter=Agregar la columna después de\nHtmlEditorView.TableRemoveRow=Quitar fila\nHtmlEditorView.TableRemoveColumn=Quitar columna\nHtmlEditorView.FontSizeDialog=Tamaño de fuente:\nHtmlEditorView.BackgroundColorDialog=Color de fondo:\nHtmlEditorView.FontColorDialog=Color de fuente:\nHtmlEditorView.LinkDialog=Enlace:\nHtmlEditorView.ImageDialog=Imagen:\nHtmlEditorView.ImageAlignment=Alineación:\nHtmlEditorView.ImageAlignmentDefault=Predeterminado\nHtmlEditorView.ImageAlignmentLeft=Izquierda\nHtmlEditorView.ImageAlignmentRight=Derecha\nHtmlEditorView.TableRows=Filas:\nHtmlEditorView.TableColumns=Columnas:\nHtmlEditorView.xx-small=xx-pequeño\nHtmlEditorView.x-small=x-pequeño\nHtmlEditorView.small=pequeño\nHtmlEditorView.medium=mediano\nHtmlEditorView.large=grande\nHtmlEditorView.x-large=x-grande\nHtmlEditorView.xx-large=xx-grande\nFileExport.Label=Exportación de archivos\nFileExport.PdfOrientation.Text=Orientación del PDF\nFileExport.PdfOrientation.Help=La orientación del archivo PDF. Los valores permitidos son PORTRAIT, LANDSCAPE\nFileExport.PdfUnit.Text=Unidades PDF\nFileExport.PdfUnit.Help=Las unidades de archivo PDF. Los valores permitidos son PT, MM, CM, IN\nFileExport.PdfFormat.Text=Formato de página PDF\nFileExport.PdfFormat.Help=El formato de página de archivo PDF. Los valores permitidos son A[0-10], B[0-10], C[0-10]\nDownloadMenuItem.Download=Descargar\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nSavePopUpView.SaveWithComments=Enregistrer avec les commentaires\nSavePopUpView.Save=Enregistrer\nSavePopUpView.Cancel=Annuler\nDeletePopUpView.ConfirmDelete=Confirmer la suppression\nDeletePopUpView.AreYouSure=Voulez-vous vraiment supprimer cet actif ?\nDeletePopUpView.Delete=Supprimer\nDeletePopUpView.Cancel=Annuler\nDeletePopUpView.DeleteNotAllowed=Vous n''êtes pas autorisé à supprimer ce fichier.\nDeletePopUpView.UnexpectedError=Une erreur inattendue s''est produite lors de la tentative de suppression du fichier.\nRestorePopUpView.RestoreWithComments=Restaurer avec les commentaires\nRestorePopUpView.Restore=Restaurer\nRestorePopUpView.Cancel=Annuler\nCopyPopUpView.MakeACopy=Faire une copie\nCopyPopUpView.NewName=Nouveau nom\nCopyPopUpView.Cancel=Annuler\nCopyPopUpView.InvalidFileName=Le nom de la ressource \"{0}\" n''est pas valide.\nCopyPopUpView.FileAlreadyExists=Le fichier \"{0}\" existe déjà.\nCopyPopUpView.CopyNotAllowed=Vous n''êtes pas autorisé à copier ce fichier.\nRenamePopUpView.RenameAsset=Renommer l''actif\nRenamePopUpView.AssetName=Nom de l''actif\nRenamePopUpView.Rename=Renommer\nRenamePopUpView.SaveAndRename=Enregistrer et renommer\nRenamePopUpView.Cancel=Annuler\nRenamePopUpView.InvalidFileName=Le nom de la ressource \"{0}\" n''est pas valide.\nRenamePopUpView.FileAlreadyExists=Le fichier \"{0}\" existe déjà.\nRenamePopUpView.RenameNotAllowed=Vous n''êtes pas autorisé à renommer ce fichier.\nToggleCommentView.AddAComment=ajouter un commentaire\nToggleCommentView.EnterComment=Entrer un commentaire\nHtmlEditorView.CantSaveReadOnly=Enregistrement impossible. L''élément est en lecture seule.\nHtmlEditorView.Loading=Chargement…\nHtmlEditorView.Saving=Enregistrement…\nHtmlEditorView.DiscardUnsavedData=Voulez-vous vraiment supprimer les données non enregistrées ?\nHtmlEditorView.Ok=OK\nHtmlEditorView.Cancel=Annuler\nHtmlEditorView.Bold=Gras (Ctrl+B)\nHtmlEditorView.Italic=Italique (Ctrl+I)\nHtmlEditorView.Underline=Souligner (Ctrl+U)\nHtmlEditorView.CreateLink=Créer un lien\nHtmlEditorView.RemoveLink=Supprimer le lien\nHtmlEditorView.InsertImage=Insérer une image\nHtmlEditorView.InsertTable=Insérer un tableau\nHtmlEditorView.BigTitle=Grand titre\nHtmlEditorView.MediumTitle=Titre moyen\nHtmlEditorView.SmallTitle=Petit titre\nHtmlEditorView.Paragraph=Paragraphe\nHtmlEditorView.Pre=Aperçu\nHtmlEditorView.PlainText=Texte brut\nHtmlEditorView.Quote=Guillemet\nHtmlEditorView.Code=Code\nHtmlEditorView.FontSize=Taille de police\nHtmlEditorView.FontColor=Couleur de police\nHtmlEditorView.BackgroundColor=Couleur d''arrière-plan\nHtmlEditorView.UnorderedList=Liste non triée\nHtmlEditorView.OrderedList=Liste triée\nHtmlEditorView.OutdentList=Décaler la liste vers la gauche\nHtmlEditorView.IndentList=Décaler la liste vers la droite\nHtmlEditorView.AlignLeft=Aligner à gauche\nHtmlEditorView.AlignRight=Aligner à droite\nHtmlEditorView.AlignCenter=Aligner au centre\nHtmlEditorView.Undo=Annuler\nHtmlEditorView.Redo=Rétablir\nHtmlEditorView.SwitchToHtmlView=Basculer vers la vue HTML\nHtmlEditorView.SwitchView=Changer de vue\nHtmlEditorView.TableOptions=Options de table :\nHtmlEditorView.TableMergeCells=Fusionner les cellules\nHtmlEditorView.TableAddRowBefore=Ajouter une ligne avant\nHtmlEditorView.TableAddRowAfter=Ajouter une ligne après\nHtmlEditorView.TableAddColumnBefore=Ajouter une colonne avant\nHtmlEditorView.TableAddColumnAfter=Ajouter une colonne après\nHtmlEditorView.TableRemoveRow=Supprimer la ligne\nHtmlEditorView.TableRemoveColumn=Supprimer la colonne\nHtmlEditorView.FontSizeDialog=Taille de police :\nHtmlEditorView.BackgroundColorDialog=Couleur d''arrière-plan :\nHtmlEditorView.FontColorDialog=Couleur de police :\nHtmlEditorView.LinkDialog=Lien :\nHtmlEditorView.ImageDialog=Image :\nHtmlEditorView.ImageAlignment=Alignement :\nHtmlEditorView.ImageAlignmentDefault=Par défaut\nHtmlEditorView.ImageAlignmentLeft=Gauche\nHtmlEditorView.ImageAlignmentRight=Droite\nHtmlEditorView.TableRows=Lignes :\nHtmlEditorView.TableColumns=Colonnes :\nHtmlEditorView.xx-small=très très petit\nHtmlEditorView.x-small=très petit\nHtmlEditorView.small=petit\nHtmlEditorView.medium=moyen\nHtmlEditorView.large=grand\nHtmlEditorView.x-large=très grand\nHtmlEditorView.xx-large=très très grand\nFileExport.Label=Exportation de fichiers\nFileExport.PdfOrientation.Text=Orientation PDF\nFileExport.PdfOrientation.Help=Orientation du fichier PDF. Les valeurs autorisées sont PORTRAIT, PAYSAGE\nFileExport.PdfUnit.Text=Unités PDF\nFileExport.PdfUnit.Help=Unités des fichiers PDF. Les valeurs autorisées sont PT, MM, CM, IN\nFileExport.PdfFormat.Text=Format de page PDF\nFileExport.PdfFormat.Help=Format de page du fichier PDF. Les valeurs autorisées sont A[0-10], B[0-10], C[0-10]\nDownloadMenuItem.Download=Télécharger\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nSavePopUpView.SaveWithComments=Salva con Commenti\nSavePopUpView.Save=Salva\nSavePopUpView.Cancel=Annulla\nDeletePopUpView.ConfirmDelete=Conferma Eliminazione\nDeletePopUpView.AreYouSure=Sei sicuro di voler eliminare questa Risorsa?\nDeletePopUpView.Delete=Elimina\nDeletePopUpView.Cancel=Annulla\nDeletePopUpView.DeleteNotAllowed=Non hai il permesso di eliminare questo file.\nDeletePopUpView.UnexpectedError=Si è verificato un errore imprevisto durante l''eliminazione del file.\nRestorePopUpView.RestoreWithComments=Ripristina con Commenti\nRestorePopUpView.Restore=Ripristina\nRestorePopUpView.Cancel=Annulla\nCopyPopUpView.MakeACopy=Crea una Copia\nCopyPopUpView.NewName=Nuovo Nome\nCopyPopUpView.Cancel=Annulla\nCopyPopUpView.InvalidFileName=Il nome della risorsa \"{0}\" non è valido.\nCopyPopUpView.FileAlreadyExists=Il file \"{0}\" esiste già.\nCopyPopUpView.CopyNotAllowed=Non hai il permesso di copiare questo file.\nRenamePopUpView.RenameAsset=Rinomina Risorsa\nRenamePopUpView.AssetName=Nome Risorsa\nRenamePopUpView.Rename=Rinomina\nRenamePopUpView.SaveAndRename=Salva e Rinomina\nRenamePopUpView.Cancel=Annulla\nRenamePopUpView.InvalidFileName=Il nome della risorsa \"{0}\" non è valido.\nRenamePopUpView.FileAlreadyExists=Il file \"{0}\" esiste già.\nRenamePopUpView.RenameNotAllowed=Non hai il permesso di rinominare questo file.\nToggleCommentView.AddAComment=aggiungi un commento\nToggleCommentView.EnterComment=Inserisci un Commento\nHtmlEditorView.CantSaveReadOnly=Impossibile salvare, è in modalità di sola lettura.\nHtmlEditorView.Loading=Caricamento...\nHtmlEditorView.Saving=Salvataggio...\nHtmlEditorView.DiscardUnsavedData=Sei sicuro di voler eliminare i dati non salvati?\nHtmlEditorView.Ok=OK\nHtmlEditorView.Cancel=Annulla\nHtmlEditorView.Bold=Grassetto (Ctrl+B)\nHtmlEditorView.Italic=Corsivo (Ctrl+I)\nHtmlEditorView.Underline=Sottolineato (Ctrl+U)\nHtmlEditorView.CreateLink=Crea link\nHtmlEditorView.RemoveLink=Rimuovi link\nHtmlEditorView.InsertImage=Inserisci immagine\nHtmlEditorView.InsertTable=Inserisci tabella\nHtmlEditorView.BigTitle=Titolo grande\nHtmlEditorView.MediumTitle=Titolo medio\nHtmlEditorView.SmallTitle=Titolo piccolo\nHtmlEditorView.Paragraph=Paragrafo\nHtmlEditorView.Pre=Pre\nHtmlEditorView.PlainText=Testo normale\nHtmlEditorView.Quote=Citazione\nHtmlEditorView.Code=Codice\nHtmlEditorView.FontSize=Dimensione carattere\nHtmlEditorView.FontColor=Colore carattere\nHtmlEditorView.BackgroundColor=Colore sfondo\nHtmlEditorView.UnorderedList=Elenco puntato\nHtmlEditorView.OrderedList=Elenco numerato\nHtmlEditorView.OutdentList=Riduci rientro elenco\nHtmlEditorView.IndentList=Aumenta rientro elenco\nHtmlEditorView.AlignLeft=Allinea a sinistra\nHtmlEditorView.AlignRight=Allinea a destra\nHtmlEditorView.AlignCenter=Allinea al centro\nHtmlEditorView.Undo=Annulla\nHtmlEditorView.Redo=Ripeti\nHtmlEditorView.SwitchToHtmlView=Passa alla visualizzazione HTML\nHtmlEditorView.SwitchView=Cambia visualizzazione\nHtmlEditorView.TableOptions=Opzioni tabella:\nHtmlEditorView.TableMergeCells=Unisci celle\nHtmlEditorView.TableAddRowBefore=Aggiungi riga prima\nHtmlEditorView.TableAddRowAfter=Aggiungi riga dopo\nHtmlEditorView.TableAddColumnBefore=Aggiungi colonna prima\nHtmlEditorView.TableAddColumnAfter=Aggiungi colonna dopo\nHtmlEditorView.TableRemoveRow=Rimuovi riga\nHtmlEditorView.TableRemoveColumn=Rimuovi colonna\nHtmlEditorView.FontSizeDialog=Dimensione carattere:\nHtmlEditorView.BackgroundColorDialog=Colore sfondo:\nHtmlEditorView.FontColorDialog=Colore carattere:\nHtmlEditorView.LinkDialog=Link:\nHtmlEditorView.ImageDialog=Immagine:\nHtmlEditorView.ImageAlignment=Allineamento:\nHtmlEditorView.ImageAlignmentDefault=Predefinito\nHtmlEditorView.ImageAlignmentLeft=Sinistra\nHtmlEditorView.ImageAlignmentRight=Destra\nHtmlEditorView.TableRows=Righe:\nHtmlEditorView.TableColumns=Colonne:\nHtmlEditorView.xx-small=xx-small\nHtmlEditorView.x-small=x-small\nHtmlEditorView.small=small\nHtmlEditorView.medium=medium\nHtmlEditorView.large=large\nHtmlEditorView.x-large=x-large\nHtmlEditorView.xx-large=xx-large\nFileExport.Label=Esportazione file\nFileExport.PdfOrientation.Text=Orientamento PDF\nFileExport.PdfOrientation.Help=L''orientamento del file PDF. I valori consentiti sono PORTRAIT, LANDSCAPE\nFileExport.PdfUnit.Text=Unità PDF\nFileExport.PdfUnit.Help=Le unità del file PDF. I valori consentiti sono PT, MM, CM, IN\nFileExport.PdfFormat.Text=Formato pagina PDF\nFileExport.PdfFormat.Help=Il formato della pagina del file PDF. I valori consentiti sono A[0-10], B[0-10], C[0-10]\nDownloadMenuItem.Download=Scarica\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/main/resources/org/uberfire/ext/editor/commons/client/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nSavePopUpView.SaveWithComments=コメント付きで保存\nSavePopUpView.Save=保存\nSavePopUpView.Cancel=キャンセル\nDeletePopUpView.ConfirmDelete=削除の確認\nDeletePopUpView.AreYouSure=このアセットを削除してもよろしいですか?\nDeletePopUpView.Delete=削除\nDeletePopUpView.Cancel=キャンセル\nDeletePopUpView.DeleteNotAllowed=このファイルを削除するパーミッションがありません。\nDeletePopUpView.UnexpectedError=このファイルの削除時に予期せぬエラーが発生しました。\nRestorePopUpView.RestoreWithComments=コメント付きで復元\nRestorePopUpView.Restore=復元\nRestorePopUpView.Cancel=キャンセル\nCopyPopUpView.MakeACopy=コピーの作成\nCopyPopUpView.NewName=新しい名前\nCopyPopUpView.Cancel=キャンセル\nCopyPopUpView.InvalidFileName=リソース名 \"{0}\" が無効です。\nCopyPopUpView.FileAlreadyExists=ファイル \"{0}\" はすでに存在します。\nCopyPopUpView.CopyNotAllowed=このファイルをコピーするパーミッションがありません。\nRenamePopUpView.RenameAsset=アセットの名前を変更\nRenamePopUpView.AssetName=アセット名\nRenamePopUpView.Rename=名前を変更\nRenamePopUpView.SaveAndRename=保存して名前を変更\nRenamePopUpView.Cancel=キャンセル\nRenamePopUpView.InvalidFileName=リソース名 \"{0}\" が無効です。\nRenamePopUpView.FileAlreadyExists=ファイル \"{0}\" はすでに存在します。\nRenamePopUpView.RenameNotAllowed=このファイルの名前を変更するパーミッションがありません。\nToggleCommentView.AddAComment=コメントの追加\nToggleCommentView.EnterComment=コメントの入力\nHtmlEditorView.CantSaveReadOnly=読み取り専用モードのため保存できません。\nHtmlEditorView.Loading=ロード中...\nHtmlEditorView.Saving=保存中...\nHtmlEditorView.DiscardUnsavedData=保存していないデータを破棄してもよろしいですか?\nHtmlEditorView.Ok=OK\nHtmlEditorView.Cancel=キャンセル\nHtmlEditorView.Bold=太字 (Ctrl+B)\nHtmlEditorView.Italic=斜体 (Ctrl+I)\nHtmlEditorView.Underline=下線 (Ctrl+U)\nHtmlEditorView.CreateLink=リンクの作成\nHtmlEditorView.RemoveLink=リンクの削除\nHtmlEditorView.InsertImage=イメージの挿入\nHtmlEditorView.InsertTable=テーブルの挿入\nHtmlEditorView.BigTitle=大きなタイトル\nHtmlEditorView.MediumTitle=中ぐらいのタイトル\nHtmlEditorView.SmallTitle=小さいタイトル\nHtmlEditorView.Paragraph=段落\nHtmlEditorView.Pre=前\nHtmlEditorView.PlainText=プレーンテキスト\nHtmlEditorView.Quote=引用符\nHtmlEditorView.Code=コード\nHtmlEditorView.FontSize=フォントのサイズ\nHtmlEditorView.FontColor=フォントの色\nHtmlEditorView.BackgroundColor=背景色\nHtmlEditorView.UnorderedList=順序なしリスト\nHtmlEditorView.OrderedList=順序付きリスト\nHtmlEditorView.OutdentList=リストのインデントを戻す\nHtmlEditorView.IndentList=リストのインデント\nHtmlEditorView.AlignLeft=左に揃える\nHtmlEditorView.AlignRight=右に揃える\nHtmlEditorView.AlignCenter=中央に揃える\nHtmlEditorView.Undo=元に戻す\nHtmlEditorView.Redo=やり直す\nHtmlEditorView.SwitchToHtmlView=HTML 表示に切り替える\nHtmlEditorView.SwitchView=表示の切り替え\nHtmlEditorView.TableOptions=テーブルオプション:\nHtmlEditorView.TableMergeCells=セルのマージ\nHtmlEditorView.TableAddRowBefore=前に行を追加\nHtmlEditorView.TableAddRowAfter=後に行を追加\nHtmlEditorView.TableAddColumnBefore=前に列を追加\nHtmlEditorView.TableAddColumnAfter=後に列を追加\nHtmlEditorView.TableRemoveRow=行を削除\nHtmlEditorView.TableRemoveColumn=列を削除\nHtmlEditorView.FontSizeDialog=フォントのサイズ\nHtmlEditorView.BackgroundColorDialog=背景色:\nHtmlEditorView.FontColorDialog=フォントの色:\nHtmlEditorView.LinkDialog=リンク:\nHtmlEditorView.ImageDialog=イメージ:\nHtmlEditorView.ImageAlignment=アラインメント:\nHtmlEditorView.ImageAlignmentDefault=デフォルト\nHtmlEditorView.ImageAlignmentLeft=左揃え\nHtmlEditorView.ImageAlignmentRight=右揃え\nHtmlEditorView.TableRows=行:\nHtmlEditorView.TableColumns=列:\nHtmlEditorView.xx-small=xx-small\nHtmlEditorView.x-small=x-small\nHtmlEditorView.small=small\nHtmlEditorView.medium=medium\nHtmlEditorView.large=large\nHtmlEditorView.x-large=x-large\nHtmlEditorView.xx-large=xx-large\nFileExport.Label=ファイルのエクスポート\nFileExport.PdfOrientation.Text=PDF の向き\nFileExport.PdfOrientation.Help=PDF ファイルの向き。許容値は PORTRAIT、LANDSCAPE です\nFileExport.PdfUnit.Text=PDF の単位\nFileExport.PdfUnit.Help=PDF ファイルの単位。許容値は PT、MM、CM、IN です。\nFileExport.PdfFormat.Text=PDF ページ形式\nFileExport.PdfFormat.Help=PDF ファイルのページ形式。許容値は A[0-10]、B[0-10]、C[0-10] です。\nDownloadMenuItem.Download=ダウンロード\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/BaseEditorRenameTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.client.history.VersionMenuDropDownButton;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.BasicFileMenuBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.MenuItems;\nimport org.uberfire.ext.editor.commons.client.menu.common.SaveAndRenameCommandBuilder;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.promise.SyncPromises;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BaseEditorRenameTest {\n\n    private static VersionMenuDropDownButton versionMenuDropDownButton;\n\n    private CallerMock<VersionService> versionServiceCaller;\n\n    private static BaseEditor baseEditor;\n\n    @Mock\n    private static VersionRecordManager versionRecordManager;\n    @Mock\n    private RestoreUtil restoreUtil;\n    @Mock\n    private PlaceRequest placeRequest;\n    @Mock\n    private ClientResourceType clientResourceType;\n    @Mock\n    private BaseEditorView baseView;\n    @Mock\n    private VersionService versionService;\n    @Mock\n    private BasicFileMenuBuilder menuBuilder;\n    @Mock\n    private EventSourceMock<ChangeTitleWidgetEvent> changeTitleNotification = new EventSourceMock<>();\n    @Mock\n    private ObservablePath observablePath;\n    private Promises promises;\n\n    @Before\n    public void setup() {\n        promises = new SyncPromises();\n        versionMenuDropDownButton = new VersionMenuDropDownButton();\n\n        versionServiceCaller = new CallerMock<>(versionService);\n\n        baseEditor = new BaseEditor(versionRecordManager,\n                                    baseView,\n                                    menuBuilder,\n                                    changeTitleNotification) {\n            {\n                promises = BaseEditorRenameTest.this.promises;\n            }\n\n            @Override\n            protected void loadContent() {\n            }\n\n            @Override\n            protected SaveAndRenameCommandBuilder getSaveAndRenameCommandBuilder() {\n                return new SaveAndRenameCommandBuilder<>(null, null, null, null);\n            }\n\n            @Override\n            public Validator getRenameValidator() {\n                return mock(Validator.class);\n            }\n\n            @Override\n            protected Caller<? extends SupportsSaveAndRename> getSaveAndRenameServiceCaller() {\n                return mock(Caller.class);\n            }\n        };\n        when(restoreUtil.createObservablePath(any(),\n                                              any())).thenReturn(observablePath);\n        baseEditor.init(observablePath,\n                        placeRequest,\n                        clientResourceType,\n                        true,\n                        true,\n                        MenuItems.SAVE,\n                        MenuItems.DELETE,\n                        MenuItems.RENAME,\n                        MenuItems.COPY,\n                        MenuItems.HISTORY);\n    }\n\n    //a reproducer for AF-497\n    @Test\n    public void testVersionRecordManagerIsInitializedOnRename() {\n        //clear the interaction on versionRecordManager from the baseEditor init method\n        Mockito.reset(versionRecordManager);\n\n        when(versionRecordManager.getCurrentPath()).thenReturn(observablePath);\n        baseEditor.onRename();\n\n        verify(versionRecordManager).init(any(),\n                                          eq(observablePath),\n                                          any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/BaseEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.BasicFileMenuBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.DownloadMenuItemBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.common.SaveAndRenameCommandBuilder;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.widgets.common.client.common.ConcurrentChangePopup;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.promise.SyncPromises;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DOWNLOAD;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.HISTORY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.VALIDATE;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BaseEditorTest {\n\n    private String fakeContent = \"fakeContent\";\n\n    @Mock\n    private VersionRecordManager versionRecordManager;\n\n    @Mock\n    private BaseEditorView baseView;\n\n    @Mock\n    private BasicFileMenuBuilder menuBuilder;\n\n    @Mock\n    private EventSourceMock<ChangeTitleWidgetEvent> changeTitleNotification;\n\n    @Mock\n    private DownloadMenuItemBuilder downloadMenuItem;\n\n    private SaveAndRenameCommandBuilder<String, DefaultMetadata> builder = spy(makeBuilder());\n\n    private Promises promises;\n\n    @InjectMocks\n    private BaseEditor<String, DefaultMetadata> editor = spy(makeBaseEditor());\n\n    @Test\n    public void testSaveAndRename() {\n        final Supplier pathSupplier = mock(Supplier.class);\n        final Validator renameValidator = mock(Validator.class);\n        final Supplier saveValidator = mock(Supplier.class);\n        final Caller supportsSaveAndRename = mock(Caller.class);\n        final Supplier metadataSupplier = mock(Supplier.class);\n        final Supplier contentSupplier = mock(Supplier.class);\n        final Supplier isDirtySupplier = mock(Supplier.class);\n        final ParameterizedCommand parameterizedCommand = mock(ParameterizedCommand.class);\n        final Command command = mock(Command.class);\n        final Command beforeSaveCommand = mock(Command.class);\n\n\n        doReturn(pathSupplier).when(editor).getPathSupplier();\n        doReturn(renameValidator).when(editor).getRenameValidator();\n        doReturn(saveValidator).when(editor).getSaveValidator();\n        doReturn(supportsSaveAndRename).when(editor).getSaveAndRenameServiceCaller();\n        doReturn(metadataSupplier).when(editor).getMetadataSupplier();\n        doReturn(contentSupplier).when(editor).getContentSupplier();\n        doReturn(isDirtySupplier).when(editor).isDirtySupplier();\n        doReturn(parameterizedCommand).when(editor).onSuccess();\n        doReturn(beforeSaveCommand).when(editor).getBeforeSaveAndRenameCommand();\n        doReturn(command).when(builder).build();\n\n        final Command saveAndRenameCommand = editor.getSaveAndRename();\n\n        assertEquals(command, saveAndRenameCommand);\n\n        verify(builder).addPathSupplier(pathSupplier);\n        verify(builder).addValidator(renameValidator);\n        verify(builder).addValidator(saveValidator);\n        verify(builder).addRenameService(supportsSaveAndRename);\n        verify(builder).addMetadataSupplier(metadataSupplier);\n        verify(builder).addContentSupplier(contentSupplier);\n        verify(builder).addIsDirtySupplier(isDirtySupplier);\n        verify(builder).addSuccessCallback(parameterizedCommand);\n        verify(builder).addBeforeSaveAndRenameCommand(beforeSaveCommand);\n    }\n\n    @Test\n    public void testGetPathSupplier() {\n\n        final ObservablePath observablePath = mock(ObservablePath.class);\n\n        doReturn(observablePath).when(versionRecordManager).getPathToLatest();\n\n        final Supplier<Path> pathSupplier = editor.getPathSupplier();\n\n        assertEquals(observablePath, pathSupplier.get());\n    }\n\n    @Test\n    public void testGetContentSupplier() {\n\n        final Supplier<String> contentSupplier = editor.getContentSupplier();\n        final String content = contentSupplier.get();\n\n        assertEquals(fakeContent, content);\n    }\n\n    @Test\n    public void testGetMetadataSupplier() {\n        assertNull(editor.getMetadataSupplier().get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n        assertNull(editor.getSaveAndRenameServiceCaller());\n    }\n\n    @Test\n    public void testIsContentDirtyWhenEditorIsDirty() {\n\n        doReturn(true).when(editor).isDirty(fakeContent.hashCode());\n\n        assertTrue(editor.isContentDirty());\n    }\n\n    @Test\n    public void testIsContentDirtyWhenEditorIsNotDirty() {\n\n        doReturn(false).when(editor).isDirty(fakeContent.hashCode());\n\n        assertFalse(editor.isContentDirty());\n    }\n\n    @Test\n    public void testIsContentDirtyWhenGetContentRaisesAnException() {\n\n        doReturn(null).when(editor).getContentSupplier();\n\n        assertFalse(editor.isContentDirty());\n    }\n\n    @Test\n    public void testIsMetadataDirtyWhenMetadataIsDirty() {\n\n        final DefaultMetadata metadata = fakeMetadata(123);\n        final Supplier<DefaultMetadata> metadataSupplier = () -> metadata;\n\n        doReturn(metadataSupplier).when(editor).getMetadataSupplier();\n\n        editor.metadataOriginalHash = 456;\n\n        assertTrue(editor.isMetadataDirty());\n    }\n\n    @Test\n    public void testIsMetadataDirtyWhenMetadataIsNotDirty() {\n\n        final DefaultMetadata metadata = fakeMetadata(123);\n        final Supplier<DefaultMetadata> metadataSupplier = () -> metadata;\n\n        doReturn(metadataSupplier).when(editor).getMetadataSupplier();\n\n        editor.metadataOriginalHash = 123;\n\n        assertFalse(editor.isMetadataDirty());\n    }\n\n    @Test\n    public void testIsMetadataDirtyWhenMetadataIsNull() {\n        assertFalse(editor.isMetadataDirty());\n    }\n\n    @Test\n    public void testIsDirtySupplierWhenContentIsDirty() {\n\n        doReturn(true).when(editor).isContentDirty();\n        doReturn(false).when(editor).isMetadataDirty();\n\n        assertTrue(editor.isDirtySupplier().get());\n    }\n\n    @Test\n    public void testIsDirtySupplierWhenMetadataIsDirty() {\n\n        doReturn(false).when(editor).isContentDirty();\n        doReturn(true).when(editor).isMetadataDirty();\n\n        assertTrue(editor.isDirtySupplier().get());\n    }\n\n    @Test\n    public void testIsDirtySupplierWhenContentAndMetdataAreDirty() {\n\n        doReturn(true).when(editor).isContentDirty();\n        doReturn(true).when(editor).isMetadataDirty();\n\n        assertTrue(editor.isDirtySupplier().get());\n    }\n\n    @Test\n    public void testIsDirtySupplierWhenContentAndMetdataAreNotDirty() {\n\n        doReturn(false).when(editor).isContentDirty();\n        doReturn(false).when(editor).isMetadataDirty();\n\n        assertFalse(editor.isDirtySupplier().get());\n    }\n\n    @Test\n    public void testGetSaveValidatorWhenItIsReadOnlyAndItIsCurrentLatest() {\n\n        editor.isReadOnly = true;\n        doReturn(true).when(versionRecordManager).isCurrentLatest();\n\n        final boolean success = editor.getSaveValidator().get();\n\n        verify(baseView).alertReadOnly();\n        assertFalse(success);\n    }\n\n    @Test\n    public void testGetSaveValidatorWhenItIsReadOnlyAndItIsNotCurrentLatest() {\n\n        editor.isReadOnly = true;\n        doReturn(false).when(versionRecordManager).isCurrentLatest();\n\n        final boolean success = editor.getSaveValidator().get();\n\n        verify(versionRecordManager).restoreToCurrentVersion(true);\n        assertFalse(success);\n    }\n\n    @Test\n    public void testGetSaveValidatorWhenConcurrentUpdateSessionInfoIsNotNull() {\n\n        editor.isReadOnly = false;\n        editor.concurrentUpdateSessionInfo = mock(ObservablePath.OnConcurrentUpdateEvent.class);\n        doNothing().when(editor).showConcurrentUpdatePopup();\n\n        final boolean success = editor.getSaveValidator().get();\n\n        verify(editor).showConcurrentUpdatePopup();\n        assertFalse(success);\n    }\n\n    @Test\n    public void testGetSaveValidatorWhenConcurrentUpdateSessionInfoIsNull() {\n\n        editor.isReadOnly = false;\n        editor.concurrentUpdateSessionInfo = null;\n\n        final boolean success = editor.getSaveValidator().get();\n\n        assertTrue(success);\n    }\n\n    @Test\n    public void testOnSuccess() {\n\n        final Path path = mock(Path.class);\n        final String content = \"content\";\n        final int contentHash = content.hashCode();\n        final int metadataHash = 456;\n        final Supplier<String> contentSupplier = () -> content;\n        final Supplier<DefaultMetadata> metadataSupplier = () -> fakeMetadata(metadataHash);\n\n        doReturn(contentSupplier).when(editor).getContentSupplier();\n        doReturn(metadataSupplier).when(editor).getMetadataSupplier();\n\n        editor.onSuccess().execute(path);\n\n        verify(editor).setOriginalHash(contentHash);\n        verify(editor).setMetadataOriginalHash(metadataHash);\n    }\n\n    @Test\n    public void testOnSuccessShouldNotCallMetadataHashIfNotAvailable() {\n\n        final Path path = mock(Path.class);\n        final String content = \"dora\";\n        final int contentHash = content.hashCode();\n        final int metadataHash = 456;\n        final Supplier<String> contentSupplier = () -> content;\n        final Supplier<DefaultMetadata> metadataSupplier = () -> null;\n\n        doReturn(contentSupplier).when(editor).getContentSupplier();\n        doReturn(metadataSupplier).when(editor).getMetadataSupplier();\n\n        editor.onSuccess().execute(path);\n\n        verify(editor).setOriginalHash(contentHash);\n        verify(editor, never()).setMetadataOriginalHash(metadataHash);\n    }\n\n    @Test\n    public void testMakeMenuBarWhenItContainsAllMenuItems() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final MenuItem menuItem = mock(MenuItem.class);\n        final Command onValidate = mock(Command.class);\n        final Command onSave = mock(Command.class);\n        final Command saveAndRename = mock(Command.class);\n        final Validator validator = mock(Validator.class);\n        final Validator copyValidator = mock(Validator.class);\n        final Caller copyServiceCaller = mock(Caller.class);\n        final Caller deleteServiceCaller = mock(Caller.class);\n        final MenuItem downloadMenuItemButton = mock(MenuItem.class);\n\n        when(downloadMenuItem.build(any())).thenReturn(downloadMenuItemButton);\n\n        editor.menuItems = new HashSet<>(Arrays.asList(SAVE, COPY, RENAME, DELETE, VALIDATE, HISTORY, DOWNLOAD));\n\n        doReturn(path).when(versionRecordManager).getCurrentPath();\n        doReturn(menuItem).when(versionRecordManager).buildMenu();\n        doReturn(onValidate).when(editor).getValidateCommand();\n        doReturn(onSave).when(editor).getOnSave();\n        doReturn(saveAndRename).when(editor).getSaveAndRename();\n        doReturn(validator).when(editor).getCopyValidator();\n        doReturn(copyValidator).when(editor).getCopyValidator();\n        doReturn(copyServiceCaller).when(editor).getCopyServiceCaller();\n        doReturn(deleteServiceCaller).when(editor).getDeleteServiceCaller();\n\n        editor.makeMenuBar();\n\n        verify(menuBuilder).addSave(onSave);\n        verify(menuBuilder).addCopy(path, copyValidator, copyServiceCaller);\n        verify(menuBuilder).addRename(saveAndRename);\n        verify(menuBuilder).addDelete(path, deleteServiceCaller);\n        verify(menuBuilder).addValidate(onValidate);\n        verify(menuBuilder).addNewTopLevelMenu(menuItem);\n        verify(menuBuilder).addNewTopLevelMenu(downloadMenuItemButton);\n    }\n\n    @Test\n    public void testMakeMenuBarWhenItDoesNotContainAllMenuItems() {\n\n        editor.menuItems = new HashSet<>();\n\n        editor.makeMenuBar();\n\n        verify(menuBuilder, never()).addSave(any(Command.class));\n        verify(menuBuilder, never()).addCopy(any(ObservablePath.class), any(Validator.class), any(Caller.class));\n        verify(menuBuilder, never()).addRename(any());\n        verify(menuBuilder, never()).addDelete(any(ObservablePath.class), any(Caller.class));\n        verify(menuBuilder, never()).addValidate(any());\n        verify(menuBuilder, never()).addNewTopLevelMenu(any());\n    }\n\n    @Test\n    public void testReloadWithObservablePath() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n\n        doNothing().when(editor).refreshTitle(path);\n        doNothing().when(editor).showBusyIndicator();\n        doNothing().when(editor).loadContent();\n        doNothing().when(editor).notifyChangeTitle(path);\n        doNothing().when(editor).initVersionRecordManager();\n\n        editor.reload(path);\n\n        verify(editor).refreshTitle(path);\n        verify(editor).showBusyIndicator();\n        verify(editor).loadContent();\n        verify(editor).notifyChangeTitle(path);\n        verify(editor).initVersionRecordManager();\n    }\n\n    @Test\n    public void testRefreshTitleWithObservablePath() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final String title = \"title\";\n\n        doReturn(title).when(editor).getTitleText(path);\n\n        editor.refreshTitle(path);\n\n        verify(baseView).refreshTitle(title);\n    }\n\n    @Test\n    public void testShowBusyIndicator() {\n\n        final String loading = \"Loading...\";\n\n        doReturn(loading).when(editor).makeLoading();\n\n        editor.showBusyIndicator();\n\n        verify(baseView).showBusyIndicator(loading);\n    }\n\n    @Test\n    public void testNotifyChangeTitle() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final ChangeTitleWidgetEvent widgetEvent = mock(ChangeTitleWidgetEvent.class);\n\n        doReturn(widgetEvent).when(editor).makeChangeTitleWidgetEvent(path);\n\n        editor.notifyChangeTitle(path);\n\n        verify(changeTitleNotification).fire(widgetEvent);\n    }\n\n    @Test\n    public void testMakeChangeTitleWidgetEvent() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        final String title = \"title\";\n        final EditorTitle editorTitle = mock(EditorTitle.class);\n\n        doReturn(placeRequest).when(editor).getPlace();\n        doReturn(title).when(editor).getTitleText(path);\n        doReturn(editorTitle).when(editor).getTitleWidget();\n\n        final ChangeTitleWidgetEvent event = editor.makeChangeTitleWidgetEvent(path);\n\n        assertEquals(placeRequest, event.getPlaceRequest());\n        assertEquals(title, event.getTitle());\n        assertEquals(editorTitle, event.getTitleDecoration());\n    }\n\n    @Test\n    public void testInitVersionRecordManager() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        final String version = \"version\";\n        final Callback<VersionRecord> selectionCallback = (v) -> {\n        };\n\n        when(versionRecordManager.getCurrentPath()).thenReturn(path);\n        when(placeRequest.getParameter(anyString(), any())).thenReturn(version);\n        doReturn(selectionCallback).when(editor).getSelectVersion();\n        doReturn(placeRequest).when(editor).getPlace();\n\n        editor.initVersionRecordManager();\n\n        verify(versionRecordManager).init(version, path, selectionCallback);\n    }\n\n    @Test\n    public void testGetTitleText() {\n\n        final String expectedTitle = \"file.drl - DRL\";\n        final ObservablePath path = mock(ObservablePath.class);\n        final ClientResourceType type = mock(ClientResourceType.class);\n\n        doReturn(type).when(editor).getType();\n        when(path.getFileName()).thenReturn(\"file.drl\");\n        when(type.getDescription()).thenReturn(\"DRL\");\n\n        final String actualTitle = editor.getTitleText(path);\n\n        assertEquals(expectedTitle, actualTitle);\n    }\n\n    @Test\n    public void testGetTitle() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final EditorTitle expectedTitle = mock(EditorTitle.class);\n\n        doNothing().when(editor).refreshTitle(path);\n        doReturn(expectedTitle).when(editor).getTitleWidget();\n        when(versionRecordManager.getCurrentPath()).thenReturn(path);\n\n        final IsWidget actualWidget = editor.getTitle();\n\n        verify(editor).refreshTitle(path);\n        assertEquals(expectedTitle, actualWidget);\n    }\n\n    @Test\n    public void testGetCurrentContentHashWhenContentSupplierRaisesAnException() {\n\n        // The `null` content causes an exception in the `getCurrentContentHash` method,\n        // since a `NullPointerException` is raised here: `getContentSupplier().get().hashCode()`.\n        fakeContent = null;\n\n        final Integer actualHash = editor.getCurrentContentHash();\n        final Integer expectedHash = null;\n\n        assertEquals(expectedHash, actualHash);\n    }\n\n    @Test\n    public void testGetCurrentContentHash() {\n\n        final Integer actualHash = editor.getCurrentContentHash();\n        final Integer expectedHash = fakeContent.hashCode();\n\n        assertEquals(expectedHash, actualHash);\n    }\n\n    @Test\n    public void testDisableMenuItem() {\n\n        final Menus menus = mock(Menus.class);\n        final MenuItem menuItem = mock(MenuItem.class);\n        final Map<Object, MenuItem> itemMap = new HashMap<>();\n\n        itemMap.put(SAVE, menuItem);\n        when(menus.getItemsMap()).thenReturn(itemMap);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(menus);\n            return null;\n        }).when(editor).getMenus(any());\n\n        editor.disableMenuItem(SAVE);\n\n        verify(menuItem).setEnabled(false);\n    }\n\n    @Test\n    public void testEnableMenuItem() {\n\n        final Menus menus = mock(Menus.class);\n        final MenuItem menuItem = mock(MenuItem.class);\n        final Map<Object, MenuItem> itemMap = new HashMap<>();\n\n        itemMap.put(SAVE, menuItem);\n        when(menus.getItemsMap()).thenReturn(itemMap);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(menus);\n            return null;\n        }).when(editor).getMenus(any());\n\n        editor.enableMenuItem(SAVE);\n\n        verify(menuItem).setEnabled(true);\n    }\n\n    @Test\n    public void testShowConcurrentUpdatePopupTwice() {\n        final ConcurrentChangePopup concurrentChangePopup = mock(ConcurrentChangePopup.class);\n        doReturn(concurrentChangePopup).when(editor).getConcurrentUpdatePopup();\n\n        editor.showConcurrentUpdatePopup();\n        editor.showConcurrentUpdatePopup();\n\n        verify(editor, times(1)).getConcurrentUpdatePopup();\n        verify(concurrentChangePopup, times(2)).show();\n    }\n\n    private DefaultMetadata fakeMetadata(final int hashCode) {\n        return new DefaultMetadata() {\n            @Override\n            public int hashCode() {\n                return hashCode;\n            }\n        };\n    }\n\n    private SaveAndRenameCommandBuilder<String, DefaultMetadata> makeBuilder() {\n        return new SaveAndRenameCommandBuilder<>(null, null, null, null);\n    }\n\n    private BaseEditor<String, DefaultMetadata> makeBaseEditor() {\n        promises = new SyncPromises();\n        return new BaseEditor<String, DefaultMetadata>() {\n            {\n                promises = BaseEditorTest.this.promises;\n            }\n\n            @Override\n            protected SaveAndRenameCommandBuilder<String, DefaultMetadata> getSaveAndRenameCommandBuilder() {\n                return builder;\n            }\n\n            @Override\n            protected void loadContent() {\n            }\n\n            @Override\n            protected Supplier<String> getContentSupplier() {\n                return () -> fakeContent;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/BaseEditorValidationTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BaseEditorValidationTest {\n\n    @Mock\n    protected BaseEditorView baseView;\n\n    private BaseEditor baseEditor;\n\n    @Test\n    public void showAndHide() throws Exception {\n        baseEditor = new BaseEditor() {\n            @Override\n            protected void loadContent() {\n\n            }\n\n            @Override\n            protected void onValidate(final Command finished) {\n                finished.execute();\n            }\n        };\n        baseEditor.baseView = baseView;\n\n        baseEditor.getValidateCommand().execute();\n\n        verify(baseView).showBusyIndicator(\"Validating\");\n        verify(baseView).hideBusyIndicator();\n    }\n\n    @Test\n    public void preventRerun() throws Exception {\n        baseEditor = new BaseEditor() {\n            @Override\n            protected void loadContent() {\n\n            }\n\n            @Override\n            protected void onValidate(final Command finished) {\n                //finished.execute(); Let's not run this.\n            }\n        };\n        baseEditor.baseView = baseView;\n\n        baseEditor.getValidateCommand().execute();\n\n        verify(baseView).showBusyIndicator(\"Validating\");\n        verify(baseView, never()).hideBusyIndicator();\n\n        reset(baseView);\n\n        baseEditor.getValidateCommand().execute();\n\n        verify(baseView, never()).showBusyIndicator(\"Validating\");\n        verify(baseView, never()).hideBusyIndicator();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/KieEditorTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client;\n\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.ObservablePathImpl;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentDeleteAcceptedEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentDeleteIgnoredEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentRenameAcceptedEvent;\nimport org.uberfire.ext.editor.commons.client.event.ConcurrentRenameIgnoredEvent;\nimport org.uberfire.ext.editor.commons.client.file.popups.DeletePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.MenuItems;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.promise.SyncPromises;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class KieEditorTest {\n\n    private BaseEditor kieEditor;\n    private BaseEditorView view;\n    private RestoreEvent restoreEvent;\n    private ObservablePath observablePath;\n    private Promises promises;\n    private DeletePopUpPresenter deletePopUpPresenter;\n\n    @Before\n    public void setUp() throws Exception {\n        view = mock(BaseEditorView.class);\n        restoreEvent = mock(RestoreEvent.class);\n        promises = new SyncPromises();\n        deletePopUpPresenter = mock(DeletePopUpPresenter.class);\n\n        kieEditor = spy(new BaseEditor<String, DefaultMetadata>(view) {\n\n            @Override\n            protected void loadContent() {\n            }\n\n            @Override\n            protected void showVersions() {\n\n            }\n\n            @Override\n            protected Promise<Void> makeMenuBar() {\n                return promises.resolve();\n            }\n\n            @Override\n            protected void showConcurrentUpdatePopup() {\n                // Overriding for testing.\n            }\n\n            @Override\n            void disableMenus() {\n\n            }\n\n            @Override\n            public void reload() {\n\n            }\n        });\n\n        kieEditor.placeManager = mock(PlaceManager.class);\n        kieEditor.concurrentRenameIgnoredEvent = spy(new EventMock<>());\n        kieEditor.concurrentRenameAcceptedEvent = spy(new EventMock<>());\n        kieEditor.concurrentDeleteIgnoredEvent = spy(new EventMock<>());\n        kieEditor.concurrentDeleteAcceptedEvent = spy(new EventMock<>());\n        kieEditor.versionRecordManager = mock(VersionRecordManager.class);\n        kieEditor.notification = new EventMock<>();\n        kieEditor.promises = promises;\n        kieEditor.deletePopUpPresenter = deletePopUpPresenter;\n        observablePath = mock(ObservablePath.class);\n        PlaceRequest placeRequest = mock(PlaceRequest.class);\n        ClientResourceType resourceType = mock(ClientResourceType.class);\n        kieEditor.init(observablePath,\n                       placeRequest,\n                       resourceType);\n    }\n\n    @Test\n    public void testLoad() throws Exception {\n        verify(kieEditor).loadContent();\n    }\n\n    @Test\n    public void testSimpleSave() throws Exception {\n\n        kieEditor.onSave();\n\n        verify(kieEditor).save();\n    }\n\n    @Test\n    public void testComplicatedSave() throws Exception {\n        kieEditor.isReadOnly = false;\n\n        when(kieEditor.versionRecordManager.isCurrentLatest()).thenReturn(true);\n\n        kieEditor.onSave();\n\n        verify(kieEditor).save();\n    }\n\n    @Test\n    public void testSaveReadOnly() throws Exception {\n\n        kieEditor.isReadOnly = true;\n\n        when(kieEditor.versionRecordManager.isCurrentLatest()).thenReturn(true);\n\n        kieEditor.onSave();\n\n        verify(kieEditor,\n               never()).save();\n        verify(view).alertReadOnly();\n    }\n\n    @Test\n    public void testRestore() throws Exception {\n\n        kieEditor.isReadOnly = true;\n\n        when(kieEditor.versionRecordManager.isCurrentLatest()).thenReturn(false);\n\n        kieEditor.onSave();\n\n        verify(kieEditor,\n               never()).save();\n        verify(kieEditor.versionRecordManager).restoreToCurrentVersion(true);\n    }\n\n    @Test\n    public void testConcurrentSave() throws Exception {\n        kieEditor.isReadOnly = false;\n\n        when(kieEditor.versionRecordManager.isCurrentLatest()).thenReturn(true);\n\n        kieEditor.concurrentUpdateSessionInfo = new ObservablePath.OnConcurrentUpdateEvent() {\n            @Override\n            public Path getPath() {\n                return null;\n            }\n\n            @Override\n            public String getId() {\n                return null;\n            }\n\n            @Override\n            public User getIdentity() {\n                return null;\n            }\n        };\n\n        kieEditor.onSave();\n\n        verify(kieEditor,\n               never()).save();\n        verify(kieEditor).showConcurrentUpdatePopup();\n    }\n\n    // Calling init reloads the latest version of the content. Therefore save\n    // shouldn't cause a concurrent modification popup if no update happened\n    // after init.\n    @Test\n    public void testInitResetsConcurrentSessionInfo() throws Exception {\n        kieEditor.isReadOnly = false;\n\n        when(kieEditor.versionRecordManager.isCurrentLatest()).thenReturn(true);\n\n        kieEditor.concurrentUpdateSessionInfo = new ObservablePath.OnConcurrentUpdateEvent() {\n            @Override\n            public Path getPath() {\n                return null;\n            }\n\n            @Override\n            public String getId() {\n                return null;\n            }\n\n            @Override\n            public User getIdentity() {\n                return null;\n            }\n        };\n\n        final Set<MenuItems> menuItems = kieEditor.menuItems;\n\n        kieEditor.init(new ObservablePathImpl(),\n                       kieEditor.place,\n                       kieEditor.type,\n                       menuItems.toArray(new MenuItems[0]));\n\n        kieEditor.onSave();\n\n        verify(kieEditor,\n               never()).showConcurrentUpdatePopup();\n    }\n\n    @Test\n    public void onRestoreShouldInitBaseEditorSuccessfully() throws Exception {\n        when(kieEditor.versionRecordManager.getCurrentPath()).thenReturn(observablePath);\n        when(restoreEvent.getPath()).thenReturn(observablePath);\n        kieEditor.onRestore(restoreEvent);\n        verify(kieEditor).onRestore(restoreEvent);\n        verify(kieEditor.versionRecordManager).getPathToLatest();\n    }\n\n    @Test\n    public void onRestoreWithNullCurrentPathShouldNotInitEditor() throws Exception {\n        when(kieEditor.versionRecordManager.getCurrentPath()).thenReturn(null);\n        kieEditor.onRestore(restoreEvent);\n        verify(kieEditor).onRestore(restoreEvent);\n        verify(kieEditor.versionRecordManager,\n               never()).getPathToLatest();\n    }\n\n    @Test\n    public void onRestoreWithNullRestoreEventPathShouldNotInitEditor() throws Exception {\n        when(restoreEvent.getPath()).thenReturn(null);\n        kieEditor.onRestore(restoreEvent);\n        verify(kieEditor).onRestore(restoreEvent);\n        verify(kieEditor.versionRecordManager,\n               never()).getPathToLatest();\n    }\n\n    @Test\n    public void onRestoreWithNullRestoreEventShouldNotInitEditor() throws Exception {\n        kieEditor.onRestore(null);\n        when(kieEditor.versionRecordManager.getPathToLatest()).thenReturn(new ObservablePathImpl());\n        verify(kieEditor).onRestore(any());\n        verify(kieEditor.versionRecordManager,\n               never()).getPathToLatest();\n    }\n\n    @Test\n    public void testOnValidateMethodIsCalled() throws Exception {\n        kieEditor.onValidate(mock(Command.class));\n        verify(kieEditor).onValidate(any(Command.class));\n    }\n\n    @Test\n    public void testOnConcurrentRenameIgnoreCommand() {\n        final Command onConcurrentRenameIgnoreCommand = kieEditor.onConcurrentRenameIgnoreCommand(observablePath);\n\n        onConcurrentRenameIgnoreCommand.execute();\n\n        verify(kieEditor).disableMenus();\n        verify(kieEditor.concurrentRenameIgnoredEvent).fire(eq(new ConcurrentRenameIgnoredEvent(observablePath)));\n    }\n\n    @Test\n    public void testOnConcurrentRenameAcceptedCommand() {\n        final Command onConcurrentRenameCloseCommand = kieEditor.onConcurrentRenameCloseCommand(observablePath);\n\n        onConcurrentRenameCloseCommand.execute();\n\n        verify(kieEditor).reload();\n        verify(kieEditor.concurrentRenameAcceptedEvent).fire(eq(new ConcurrentRenameAcceptedEvent(observablePath)));\n    }\n\n    @Test\n    public void testOnConcurrentDeleteIgnoreCommand() {\n        testOnConcurrentDeleteIgnoreCommand(false);\n    }\n\n    @Test\n    public void testOnConcurrentDeleteIgnoreCommandDeletePopupOpened() {\n        testOnConcurrentDeleteIgnoreCommand(true);\n    }\n\n    private void testOnConcurrentDeleteIgnoreCommand(final boolean isDeletePopupOpened) {\n\n        when(deletePopUpPresenter.isOpened()).thenReturn(isDeletePopupOpened);\n\n        final Command onConcurrentDeleteIgnoreCommand = kieEditor.onConcurrentDeleteIgnoreCommand(observablePath);\n\n        onConcurrentDeleteIgnoreCommand.execute();\n\n        verify(kieEditor).disableMenus();\n        verify(kieEditor.concurrentDeleteIgnoredEvent).fire(eq(new ConcurrentDeleteIgnoredEvent(observablePath)));\n\n        verify(deletePopUpPresenter, isDeletePopupOpened ? times(1) : never()).cancel();\n    }\n\n    @Test\n    public void testOnConcurrentDeleteAcceptedCommand() {\n        testOnConcurrentDeleteAcceptedCommand(false);\n    }\n\n    @Test\n    public void testOnConcurrentDeleteAcceptedCommandDeletePopupOpened() {\n        testOnConcurrentDeleteAcceptedCommand(true);\n    }\n\n    private void testOnConcurrentDeleteAcceptedCommand(final boolean isDeletePopupOpened) {\n\n        when(deletePopUpPresenter.isOpened()).thenReturn(isDeletePopupOpened);\n\n        final Command onConcurrentDeleteCloseCommand = kieEditor.onConcurrentDeleteCloseCommand(observablePath);\n\n        onConcurrentDeleteCloseCommand.execute();\n\n        verify(kieEditor.placeManager).closePlace(any(PlaceRequest.class));\n        verify(kieEditor.concurrentDeleteAcceptedEvent).fire(eq(new ConcurrentDeleteAcceptedEvent(observablePath)));\n\n        verify(deletePopUpPresenter, isDeletePopupOpened ? times(1) : never()).cancel();\n    }\n    public static class EventMock<T> extends EventSourceMock<T> {\n\n        @Override\n        public void fire(T event) {\n            // Overriding for testing.\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/AbstractFileExportTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.function.BiConsumer;\n\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.mockito.Mock;\n\npublic abstract class AbstractFileExportTest {\n\n    protected static final String FILE_NAME = \"file1\";\n\n    @Mock\n    protected BiConsumer<Blob, String> fileSaver;\n\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/FileExportProducerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.FileExportScriptInjector;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FileExportProducerTest {\n\n    private FileExportProducer fs;\n\n    @Mock\n    private FileExportScriptInjector scriptInjector;\n\n    @Before\n    public void setup() {\n        fs = new FileExportProducer(scriptInjector);\n    }\n\n    @Test\n    public void testInit() {\n        fs.init();\n        verify(scriptInjector,\n               times(1)).inject();\n    }\n\n    @Test\n    public void ProduceTextFileSaverTest() {\n        TextFileExport textFileSaver = fs.forText();\n        assertNotNull(textFileSaver);\n    }\n\n    @Test\n    public void producePDFFileSaverTest() {\n        PdfFileExport pdfFileSaver = fs.forPDF();\n        assertNotNull(pdfFileSaver);\n    }\n\n    @Test\n    public void produceImageFileSaver() {\n        ImageFileExport imageFileSaver = fs.forImage();\n        assertNotNull(imageFileSaver);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/ImageDataUriContentTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class ImageDataUriContentTest {\n\n    private ImageDataUriContent imageContent;\n\n    @Before\n    public void setup() {\n    }\n\n    @Test\n    public void testPng() {\n        this.imageContent = ImageDataUriContent.create(\"data:image/png;base64,9j/4AAQSkZJRgABAQEASABIAAD\");\n        assertEquals(\"data:image/png;base64,9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getUri());\n        assertEquals(\"image/png\",\n                     imageContent.getMimeType());\n        assertEquals(\"9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getData());\n    }\n\n    @Test\n    public void testJpg() {\n        this.imageContent = ImageDataUriContent.create(\"data:image/jpg;base64,9j/4AAQSkZJRgABAQEASABIAAD\");\n        assertEquals(\"data:image/jpg;base64,9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getUri());\n        assertEquals(\"image/jpg\",\n                     imageContent.getMimeType());\n        assertEquals(\"9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getData());\n    }\n\n    @Test\n    public void testOtherTypes() {\n        this.imageContent = ImageDataUriContent.create(\"data:image/svg;base64,9j/4AAQSkZJRgABAQEASABIAAD\");\n        assertEquals(\"data:image/svg;base64,9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getUri());\n        assertEquals(\"image/svg\",\n                     imageContent.getMimeType());\n        assertEquals(\"9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getData());\n        this.imageContent = ImageDataUriContent.create(\"data:image/svg,9j/4AAQSkZJRgABAQEASABIAAD\");\n        assertEquals(\"data:image/svg,9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getUri());\n        assertEquals(\"image/svg\",\n                     imageContent.getMimeType());\n        assertEquals(\"9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getData());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/ImageFileExportTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ImageFileExportTest extends AbstractFileExportTest {\n\n    private ImageFileExport tested;\n\n    @Before\n    public void setup() {\n        tested = new ImageFileExport(fileSaver);\n    }\n\n    @Test\n    public void testExport() {\n        ImageDataUriContent imageContent = ImageDataUriContent.create(\"data:image/jpeg;base64,9j/4AAQSkZJRgABAQEASABIAAD\");\n        assertEquals(\"data:image/jpeg;base64,9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getUri());\n        assertEquals(\"image/jpeg\",\n                     imageContent.getMimeType());\n        assertEquals(\"9j/4AAQSkZJRgABAQEASABIAAD\",\n                     imageContent.getData());\n        tested.export(imageContent,\n                      FILE_NAME);\n        verify(fileSaver,\n               times(1)).accept(any(Blob.class),\n                                eq(FILE_NAME));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/PdfDocumentTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.editor.commons.file.exports.PdfExportPreferences;\n\nimport static org.junit.Assert.*;\n\npublic class PdfDocumentTest {\n\n    @Test\n    public void testText() {\n        PdfDocument document = PdfDocument.create(PdfExportPreferences.create(PdfExportPreferences.Orientation.PORTRAIT,\n                                                                              PdfExportPreferences.Unit.MM,\n                                                                              PdfExportPreferences.Format.A4));\n        document.addText(\"text1\",\n                         13,\n                         453);\n        // Assert settings.\n        assertEquals(PdfExportPreferences.Orientation.PORTRAIT,\n                     document.getSettings().getOrientation());\n        assertEquals(PdfExportPreferences.Unit.MM,\n                     document.getSettings().getUnit());\n        assertEquals(PdfExportPreferences.Format.A4,\n                     document.getSettings().getFormat());\n        // Assert entries.\n        final List<PdfDocument.PdfEntry> pdfEntries = document.getPdfEntries();\n        assertNotNull(pdfEntries);\n        assertEquals(1,\n                     pdfEntries.size());\n        assertTrue(pdfEntries.get(0) instanceof PdfDocument.Text);\n        final PdfDocument.Text entry = (PdfDocument.Text) pdfEntries.get(0);\n        assertEquals(\"text1\",\n                     entry.getText());\n        assertEquals(13,\n                     entry.getX());\n        assertEquals(453,\n                     entry.getY());\n    }\n\n    @Test\n    public void testImage() {\n        PdfDocument document = PdfDocument.create(PdfExportPreferences.create(PdfExportPreferences.Orientation.LANDSCAPE,\n                                                                              PdfExportPreferences.Unit.MM,\n                                                                              PdfExportPreferences.Format.A4));\n        document.addImage(\"data-url1\",\n                          \"jpeg\",\n                          13,\n                          453,\n                          345,\n                          234);\n        // Assert settings.\n        assertEquals(PdfExportPreferences.Orientation.LANDSCAPE,\n                     document.getSettings().getOrientation());\n        assertEquals(PdfExportPreferences.Unit.MM,\n                     document.getSettings().getUnit());\n        assertEquals(PdfExportPreferences.Format.A4,\n                     document.getSettings().getFormat());\n        // Assert entries.\n        final List<PdfDocument.PdfEntry> pdfEntries = document.getPdfEntries();\n        assertNotNull(pdfEntries);\n        assertEquals(1,\n                     pdfEntries.size());\n        assertTrue(pdfEntries.get(0) instanceof PdfDocument.Image);\n        final PdfDocument.Image entry = (PdfDocument.Image) pdfEntries.get(0);\n        assertEquals(\"data-url1\",\n                     entry.getToDataURL());\n        assertEquals(\"jpeg\",\n                     entry.getImgType());\n        assertEquals(13,\n                     entry.getX());\n        assertEquals(453,\n                     entry.getY());\n        assertEquals(345,\n                     entry.getWidth());\n        assertEquals(234,\n                     entry.getHeight());\n    }\n\n    @Test\n    public void testCustomSettings() {\n        PdfDocument document = PdfDocument.create(PdfExportPreferences.create(PdfExportPreferences.Orientation.LANDSCAPE,\n                                                                              PdfExportPreferences.Unit.IN,\n                                                                              PdfExportPreferences.Format.B6));\n        // Assert settings.\n        assertEquals(PdfExportPreferences.Orientation.LANDSCAPE,\n                     document.getSettings().getOrientation());\n        assertEquals(PdfExportPreferences.Unit.IN,\n                     document.getSettings().getUnit());\n        assertEquals(PdfExportPreferences.Format.B6,\n                     document.getSettings().getFormat());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/PdfFileExportTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.JsPdf;\nimport org.uberfire.ext.editor.commons.file.exports.PdfExportPreferences;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PdfFileExportTest {\n\n    private PdfFileExport tested;\n    private PdfDocument content;\n\n    @Mock\n    private JsPdf fileExport;\n\n    @Before\n    public void setup() {\n        content = PdfDocument.create(PdfExportPreferences.create(PdfExportPreferences.Orientation.PORTRAIT,\n                                                                 PdfExportPreferences.Unit.MM,\n                                                                 PdfExportPreferences.Format.A4));\n        tested = new PdfFileExport();\n    }\n\n    @Test\n    public void saveAsTextTest() {\n        content.addText(\"test\",\n                        10,\n                        20);\n        tested.export(content,\n                      \"file1\",\n                      fileExport);\n        verify(fileExport,\n               times(1)).text(eq(\"test\"),\n                              eq(10),\n                              eq(20));\n        verify(fileExport).save(eq(\"file1\"));\n    }\n\n    @Test\n    public void saveAsImageTest() {\n        final String dataUrl = \"data:image/jpeg;base64,9j/4AAQSkZJRgABAQEASABIAAD\";\n        content.addImage(dataUrl,\n                         \"jpeg\",\n                         10,\n                         20,\n                         100,\n                         200);\n        tested.export(content,\n                      \"file2\",\n                      fileExport);\n        verify(fileExport,\n               times(1)).addImage(eq(dataUrl),\n                                  eq(\"jpeg\"),\n                                  eq(10),\n                                  eq(20),\n                                  eq(100),\n                                  eq(200));\n        verify(fileExport).save(eq(\"file2\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/TextContentTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class TextContentTest {\n\n    @Test\n    public void testTheRightText() {\n        final String text = \"text1\";\n        final TextContent content = TextContent.create(text);\n        assertEquals(text,\n                     content.getText());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/TextFileExportTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class TextFileExportTest extends AbstractFileExportTest {\n\n    private TextFileExport tested;\n\n    @Before\n    public void setup() {\n        tested = new TextFileExport(fileSaver);\n    }\n\n    @Test\n    public void testExport() {\n        final TextContent content = TextContent.create(\"testing\");\n        tested.export(content, FILE_NAME);\n        verify(fileSaver,\n               times(1)).accept(any(Blob.class),\n                                eq(FILE_NAME));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/jso/FileExportScriptInjectorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.editor.commons.client.file.exports.FileExportResources;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.ext.editor.commons.client.file.exports.jso.FileExportScriptInjector.buildNamespaceObject;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FileExportScriptInjectorTest {\n\n    public static final String NS = \"window.\";\n    private FileExportScriptInjector tested;\n\n    @Mock\n    private Consumer<String> scriptInjector;\n\n    @Before\n    public void setup() {\n        tested = new FileExportScriptInjector(scriptInjector);\n    }\n\n    @Test\n    public void testInject() {\n        tested.inject();\n        final ArgumentCaptor<String> scriptCaptor = ArgumentCaptor.forClass(String.class);\n        verify(scriptInjector,\n               times(1)).accept(scriptCaptor.capture());\n        final String script = scriptCaptor.getValue();\n        final String fsNsObject = buildNamespaceObject(NS + JsFileSaver.class.getSimpleName() + \".saveAs\");\n        final String jsPdfNsObject = buildNamespaceObject(NS + JsPdf.class.getSimpleName());\n        final String c2sNsObject = FileExportResources.INSTANCE.canvas2svg().getText();\n        assertEquals(\"var \" +\n                             fsNsObject +\n                             \" = function(blob, fileName, disableAutoBOM) {\\n\" +\n                             \"fileSaver\\n\" +\n                             \"return saveAs(blob, fileName, disableAutoBOM);};\\n\" +\n                             jsPdfNsObject +\n                             \" = function(settings) {\\n\" +\n                             \"jsPdf\\n\" +\n                             \"var saveAs = \" + NS + \"JsFileSaver.saveAs; \" +\n                             \"return new jsPDF(settings);};\" + \"\\n\" +\n                             c2sNsObject + \"\\n\",\n                     script);\n    }\n\n    @Test\n    public void testNamespaces() {\n        assertEquals(\"window = window || {};\\n\" + NS + \"JsFileSaver\",\n                     buildNamespaceObject(NS + JsFileSaver.class.getSimpleName()));\n        assertEquals(\"window = window || {};\\n\" + NS + \"JsPdf\",\n                     buildNamespaceObject(NS + JsPdf.class.getSimpleName()));\n        assertEquals(\"nonamespace\", buildNamespaceObject(\"nonamespace\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/jso/svg/C2SContext2DTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.jso.svg;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport elemental2.core.JsArray;\nimport elemental2.dom.CanvasRenderingContext2D;\nimport elemental2.dom.Element;\nimport elemental2.dom.ImageData;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(JsArray.class)\npublic class C2SContext2DTest {\n\n    private C2SContext2D c2SContext2D;\n\n    @Mock\n    private Element element;\n\n    @Mock\n    private JsArray groupStack;\n\n    @Mock\n    private JsArray stack;\n\n    @Mock\n    private CanvasRenderingContext2D nativeContext;\n\n    private C2S c2S;\n\n    @Mock\n    private Element root;\n\n    @Before\n    public void setUp() throws Exception {\n        c2S = spy(C2S.create(100, 100, nativeContext));\n        c2SContext2D = new C2SContext2D(c2S);\n        c2S.__groupStack = groupStack;\n        when(groupStack.pop()).thenReturn(element);\n        c2S.__stack = stack;\n        c2S.__root = root;\n    }\n\n    @Test\n    public void testSetViewBox() {\n        final double width = 100;\n        final double height = 100;\n        c2S.setViewBox(width, height);\n        verify(root).setAttribute(\"viewBox\", \"0 0 \" + width + \" \" + height);\n    }\n\n    @Test\n    public void getSerializedSvg() {\n        c2SContext2D.getSerializedSvg();\n        verify(c2S).getSerializedSvg();\n    }\n\n    @Test\n    public void setFillStyle() {\n        c2SContext2D.setFillStyle(\"black\");\n        verify(c2S).setFillStyle(\"black\");\n    }\n\n    @Test\n    public void setStrokeStyle() {\n        c2SContext2D.setStrokeStyle(\"black\");\n        verify(c2S).setStrokeStyle(\"black\");\n    }\n\n    @Test\n    public void setLineWidth() {\n        c2SContext2D.setLineWidth(1);\n        verify(c2S).setLineWidth(1);\n    }\n\n    @Test\n    public void setLineCap() {\n        c2SContext2D.setLineCap(\"line\");\n        verify(c2S).setLineCap(\"line\");\n    }\n\n    @Test\n    public void setLineJoin() {\n        c2SContext2D.setLineCap(\"line\");\n        verify(c2S).setLineCap(\"line\");\n    }\n\n    @Test\n    public void setImageSmoothingEnabled() {\n        c2SContext2D.setImageSmoothingEnabled(true);\n        verify(c2S).setImageSmoothingEnabled(true);\n    }\n\n    @Test\n    public void setFont() {\n        c2SContext2D.setFont(\"font\");\n        verify(c2S).setFont(\"font\");\n    }\n\n    @Test\n    public void setTextBaseline() {\n        c2SContext2D.setTextBaseline(\"text\");\n        verify(c2S).setTextBaseline(\"text\");\n    }\n\n    @Test\n    public void setTextAlign() {\n        c2SContext2D.setTextAlign(\"left\");\n        verify(c2S).setTextAlign(\"left\");\n    }\n\n    @Test\n    public void setGlobalAlpha() {\n        c2SContext2D.setGlobalAlpha(1);\n        verify(c2S).setGlobalAlpha(1);\n    }\n\n    @Test\n    public void setShadowColor() {\n        c2SContext2D.setShadowColor(\"blue\");\n        verify(c2S).setShadowColor(\"blue\");\n    }\n\n    @Test\n    public void setShadowOffsetX() {\n        c2SContext2D.setShadowOffsetX(1);\n        verify(c2S).setShadowOffsetX(1);\n    }\n\n    @Test\n    public void setShadowOffsetY() {\n        c2SContext2D.setShadowOffsetY(1);\n        verify(c2S).setShadowOffsetY(1);\n    }\n\n    @Test\n    public void setShadowBlur() {\n        c2SContext2D.setShadowBlur(1);\n        verify(c2S).setShadowBlur(1);\n    }\n\n    @Test\n    public void setMiterLimit() {\n        c2SContext2D.setMiterLimit(1);\n        verify(c2S).setMiterLimit(1);\n    }\n\n    @Test\n    public void setLineDashOffset() {\n        c2SContext2D.setLineDashOffset(1);\n        verify(c2S).setLineDashOffset(1);\n    }\n\n    @Test\n    public void saveGroup() {\n        final String key = \"id\";\n        final String value = \"value\";\n        final Map<String, String> id = new HashMap<String, String>() {{\n            put(key, value);\n        }};\n        c2SContext2D.saveGroup(id);\n        verify(c2S).saveGroup(id);\n    }\n\n    @Test\n    public void restoreGroup() {\n        c2SContext2D.restoreGroup();\n        verify(c2S).restoreGroup();\n    }\n\n    @Test\n    public void saveStyle() {\n        c2SContext2D.saveStyle();\n        verify(c2S).saveStyle();\n    }\n\n    @Test\n    public void restoreStyle() {\n        c2SContext2D.restoreStyle();\n        verify(c2S).restoreStyle();\n    }\n\n    @Test\n    public void save() {\n        c2SContext2D.save();\n        verify(c2S).save();\n    }\n\n    @Test\n    public void restore() {\n        c2SContext2D.restore();\n        verify(c2S).restore();\n    }\n\n    @Test\n    public void beginPath() {\n        c2SContext2D.beginPath();\n        verify(c2S).beginPath();\n    }\n\n    @Test\n    public void closePath() {\n        c2SContext2D.closePath();\n        verify(c2S).closePath();\n    }\n\n    @Test\n    public void moveTo() {\n        c2SContext2D.moveTo(1, 1);\n        verify(c2S).moveTo(1, 1);\n    }\n\n    @Test\n    public void lineTo() {\n        c2SContext2D.lineTo(1, 1);\n        verify(c2S).lineTo(1, 1);\n    }\n\n    @Test\n    public void setGlobalCompositeOperation() {\n        c2SContext2D.setGlobalCompositeOperation(\"op\");\n        verify(c2S).setGlobalCompositeOperation(\"op\");\n    }\n\n    @Test\n    public void quadraticCurveTo() {\n        c2SContext2D.quadraticCurveTo(1, 1, 1, 1);\n        verify(c2S).quadraticCurveTo(1, 1, 1, 1);\n    }\n\n    @Test\n    public void arc() {\n        c2SContext2D.arc(1, 1, 1, 1, 1);\n        verify(c2S).arc(1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void arc1() {\n        c2SContext2D.arc(1, 1, 1, 1, 1, true);\n        verify(c2S).arc(1, 1, 1, 1, 1, true);\n    }\n\n    @Test\n    public void ellipse() {\n        c2SContext2D.ellipse(1, 1, 1, 1, 1, 1, 1);\n        verify(c2S).ellipse(1, 1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void ellipse1() {\n        c2SContext2D.ellipse(1, 1, 1, 1, 1, 1, 1, true);\n        verify(c2S).ellipse(1, 1, 1, 1, 1, 1, 1, true);\n    }\n\n    @Test\n    public void arcTo() {\n        c2SContext2D.arcTo(1, 1, 1, 1, 1);\n        verify(c2S).arcTo(1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void bezierCurveTo() {\n        c2SContext2D.bezierCurveTo(1, 1, 1, 1, 1, 1);\n        verify(c2S).bezierCurveTo(1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void clearRect() {\n        c2SContext2D.clearRect(1, 1, 1, 1);\n        verify(c2S).clearRect(1, 1, 1, 1);\n    }\n\n    @Test\n    public void clip() {\n        c2SContext2D.clip();\n        verify(c2S).clip();\n    }\n\n    @Test\n    public void fill() {\n        c2SContext2D.fill();\n        verify(c2S).fill();\n    }\n\n    @Test\n    public void stroke() {\n        c2SContext2D.stroke();\n        verify(c2S).stroke();\n    }\n\n    @Test\n    public void fillRect() {\n        c2SContext2D.fillRect(1, 1, 1, 1);\n        verify(c2S).fillRect(1, 1, 1, 1);\n    }\n\n    @Test\n    public void fillText() {\n        c2SContext2D.fillText(\"text\", 1, 1);\n        verify(c2S).fillText(\"text\", 1, 1);\n    }\n\n    @Test\n    public void createLinearGradient() {\n        c2SContext2D.createLinearGradient(1, 1, 1, 1);\n        verify(c2S).createLinearGradient(1, 1, 1, 1);\n    }\n\n    @Test\n    public void createRadialGradient() {\n        c2SContext2D.createRadialGradient(1, 1, 1, 1, 1, 1);\n        verify(c2S).createRadialGradient(1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void rect() {\n        c2SContext2D.rect(1, 1, 1, 1);\n        verify(c2S).rect(1, 1, 1, 1);\n    }\n\n    @Test\n    public void rotate() {\n        c2SContext2D.rotate(1);\n        verify(c2S).rotate(1);\n    }\n\n    @Test\n    public void scale() {\n        c2SContext2D.scale(1, 1);\n        verify(c2S).scale(1, 1);\n    }\n\n    @Test\n    public void transform() {\n        c2SContext2D.transform(1, 1, 1, 1, 1, 1);\n        verify(c2S).transform(1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void setTransform() {\n        c2SContext2D.setTransform(1, 1, 1, 1, 1, 1);\n        verify(c2S).setTransform(1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void strokeText() {\n        c2SContext2D.setTransform(1, 1, 1, 1, 1, 1);\n        verify(c2S).setTransform(1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void translate() {\n        c2SContext2D.translate(1, 1);\n        verify(c2S).translate(1, 1);\n    }\n\n    @Test\n    public void isPointInPath() {\n        c2SContext2D.isPointInPath(1, 1);\n        verify(c2S).isPointInPath(1, 1);\n    }\n\n    @Test\n    public void putImageData() {\n        ImageData imageData = mock(ImageData.class);\n        c2SContext2D.putImageData(imageData, 1, 1);\n        verify(c2S).putImageData(imageData, 1, 1);\n    }\n\n    @Test\n    public void putImageData1() {\n        ImageData imageData = mock(ImageData.class);\n        c2SContext2D.putImageData(imageData, 1, 1, 1, 1, 1, 1);\n        verify(c2S).putImageData(imageData, 1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void resetClip() {\n        c2SContext2D.resetClip();\n        verify(c2S).resetClip();\n    }\n\n    @Test\n    public void setLineDash() {\n        double[] dashes = {1, 1};\n        c2SContext2D.setLineDash(dashes);\n        verify(c2S).setLineDash(dashes);\n    }\n\n    @Test\n    public void measureText() {\n        c2SContext2D.measureText(\"text\");\n        verify(c2S).measureText(\"text\");\n    }\n\n    @Test\n    public void createImageData() {\n        ImageData imageData = mock(ImageData.class);\n        c2SContext2D.createImageData(imageData);\n        verify(c2S).createImageData(imageData);\n    }\n\n    @Test\n    public void getImageData() {\n        c2SContext2D.getImageData(1, 1, 1, 1);\n        verify(c2S).getImageData(1, 1, 1, 1);\n    }\n\n    @Test\n    public void createImageData1() {\n        c2SContext2D.createImageData(1, 1);\n        verify(c2S).createImageData(1, 1);\n    }\n\n    @Test\n    public void drawImage() {\n        Element image = mock(Element.class);\n        c2SContext2D.drawImage(image, 1, 1, 1, 1, 1, 1, 1, 1);\n        verify(c2S).drawImage(image, 1, 1, 1, 1, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void drawImage1() {\n        Element image = mock(Element.class);\n        c2SContext2D.drawImage(image, 1, 1);\n        verify(c2S).drawImage(image, 1, 1);\n    }\n\n    @Test\n    public void drawImage2() {\n        Element image = mock(Element.class);\n        c2SContext2D.drawImage(image, 1, 1, 1, 1);\n        verify(c2S).drawImage(image, 1, 1, 1, 1);\n    }\n\n    @Test\n    public void testGetDelegate() {\n        Assert.assertTrue(C2S.class.isInstance(c2SContext2D.getDelegate()));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/svg/Context2DFactoryTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport elemental2.dom.CanvasRenderingContext2D;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.editor.commons.client.file.exports.jso.svg.C2SContext2D;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.mock;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class Context2DFactoryTest {\n\n    private Context2DFactory context2DFactory;\n\n    @Before\n    public void setUp() throws Exception {\n        context2DFactory = new Context2DFactory();\n    }\n\n    @Test\n    public void testCreate() {\n        final CanvasRenderingContext2D nativeContext = mock(CanvasRenderingContext2D.class);\n        final SvgExportSettings settings = new SvgExportSettings(100, 100, nativeContext);\n        final IContext2D context2D = context2DFactory.create(settings);\n        assertTrue(C2SContext2D.class.isInstance(context2D));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/exports/svg/SvgFileExportTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.exports.svg;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Blob;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.ext.editor.commons.client.file.exports.AbstractFileExportTest;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SvgFileExportTest extends AbstractFileExportTest{\n\n    private static final String SVG = \"svg content\";\n    private SvgFileExport svgFileExport;\n\n    @Mock\n    private IContext2D context;\n\n    @Before\n    public void setUp() throws Exception {\n        Mockito.when(context.getSerializedSvg()).thenReturn(SVG);\n        this.svgFileExport = new SvgFileExport(fileSaver);\n    }\n\n    @Test\n    public void testExport() {\n        svgFileExport.export(context,FILE_NAME);\n        verify(context).getSerializedSvg();\n        verify(fileSaver).accept(any(Blob.class), eq(FILE_NAME));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/CommonModalBuilderTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport com.google.gwt.user.client.ui.RootPanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport elemental2.dom.HTMLElement;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.gwt.FlowPanel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Modal.class, RootPanel.class})\npublic class CommonModalBuilderTest {\n\n    @Mock\n    private BaseModal modalMock;\n\n    private CommonModalBuilder builder;\n\n    @Before\n    public void setup() {\n        builder = spy(new CommonModalBuilder());\n    }\n\n    @Test\n    public void testAddBody() {\n\n        final HTMLElement htmlElement = mock(HTMLElement.class);\n        final FlowPanel flowPanel = mock(FlowPanel.class);\n        final ModalBody modalBody = mock(ModalBody.class);\n\n        doReturn(modalMock).when(builder).getModal();\n        doReturn(modalBody).when(builder).makeModalBody();\n        doReturn(flowPanel).when(builder).buildPanel(htmlElement, modalBody);\n\n        builder.addBody(htmlElement);\n\n        verify(modalMock).add(flowPanel);\n    }\n\n    @Test\n    public void testAddFooter() {\n\n        final HTMLElement htmlElement = mock(HTMLElement.class);\n        final FlowPanel flowPanel = mock(FlowPanel.class);\n        final ModalFooter modalFooter = mock(ModalFooter.class);\n\n        doReturn(modalMock).when(builder).getModal();\n        doReturn(modalFooter).when(builder).makeModalFooter();\n        doReturn(flowPanel).when(builder).buildPanel(htmlElement, modalFooter);\n\n        builder.addFooter(htmlElement);\n\n        verify(modalMock).add(flowPanel);\n    }\n\n    @Test\n    public void testBuild() {\n\n        doReturn(modalMock).when(builder).getModal();\n\n        final BaseModal modal = builder.build();\n\n        assertEquals(modalMock, modal);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/CopyPopUpPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CopyPopUpPresenterTest {\n\n    @Mock\n    Path path;\n\n    @Mock\n    Validator validator;\n\n    @Mock\n    CommandWithFileNameAndCommitMessage command;\n\n    @Mock\n    ToggleCommentPresenter toggleCommentPresenter;\n\n    @Mock\n    CopyPopUpPresenter.View view;\n\n    CopyPopUpPresenter presenter;\n\n    @Before\n    public void init() throws Exception {\n        presenter = new CopyPopUpPresenter(view,\n                                           toggleCommentPresenter);\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        presenter.setup();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show(path,\n                       validator,\n                       command);\n\n        assertNotNull(presenter.getPath());\n        assertNotNull(presenter.getValidator());\n        assertNotNull(presenter.getCommand());\n        verify(view).show();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingPath() throws Exception {\n        presenter.show(null,\n                       validator,\n                       command);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingValidator() throws Exception {\n        presenter.show(path,\n                       null,\n                       command);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingCommand() throws Exception {\n        presenter.show(path,\n                       validator,\n                       null);\n    }\n\n    @Test\n    public void testShowWithDefaultValidator() throws Exception {\n        presenter.show(path,\n                       command);\n\n        assertNotNull(presenter.getPath());\n        assertNotNull(presenter.getValidator());\n        assertNotNull(presenter.getCommand());\n        verify(view).show();\n    }\n\n    @Test\n    public void testCancel() throws Exception {\n        presenter.cancel();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testCopy() throws Exception {\n        when(path.getFileName()).thenReturn(\"file.plugin\");\n        when(toggleCommentPresenter.getComment()).thenReturn(\"comment\");\n\n        presenter.show(path,\n                       validator,\n                       command);\n        presenter.copy(\"newFile\");\n\n        verify(validator).validate(eq(\"newFile.plugin\"),\n                                   any(ValidatorWithReasonCallback.class));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/DeletePopUpPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DeletePopUpPresenterTest {\n\n    @Mock\n    DeletePopUpPresenter.View view;\n\n    @Mock\n    Validator validator;\n\n    @Mock\n    ParameterizedCommand<String> command;\n\n    @Mock\n    ToggleCommentPresenter toggleCommentPresenter;\n\n    DeletePopUpPresenter presenter;\n\n    @Before\n    public void init() throws Exception {\n        presenter = new DeletePopUpPresenter(view,\n                                             toggleCommentPresenter);\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        presenter.setup();\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show(validator,\n                       command);\n\n        verify(view).show();\n        assertEquals(validator,\n                     presenter.getValidator());\n        assertEquals(command,\n                     presenter.getCommand());\n    }\n\n    @Test\n    public void testDeleteWithCommand() throws Exception {\n        when(toggleCommentPresenter.getComment()).thenReturn(\"test\");\n\n        presenter.show((value, callback) -> callback.onSuccess(),\n                       command);\n        presenter.delete();\n\n        verify(command).execute(\"test\");\n        verify(view).hide();\n    }\n\n    @Test\n    public void testDeleteWithValidationFailed() throws Exception {\n        when(toggleCommentPresenter.getComment()).thenReturn(\"test\");\n\n        presenter.show((value, callback) -> callback.onFailure(),\n                       command);\n        presenter.delete();\n\n        verify(command,\n               never()).execute(\"test\");\n        verify(view).handleUnexpectedError();\n    }\n\n    @Test\n    public void testNotAllowedDelete() throws Exception {\n        when(toggleCommentPresenter.getComment()).thenReturn(\"test\");\n\n        presenter.show((value, callback) -> ((ValidatorWithReasonCallback) callback).onFailure(ValidationErrorReason.NOT_ALLOWED.name()),\n                       command);\n        presenter.delete();\n\n        verify(command,\n               never()).execute(\"test\");\n        verify(view).handleDeleteNotAllowed();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testDeleteWithoutCommand() throws Exception {\n        presenter.show(null,\n                       null);\n        presenter.delete();\n    }\n\n    @Test\n    public void cancel() throws Exception {\n        presenter.cancel();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testPrompt() throws Exception {\n        final String prompt = \"any text\";\n        presenter.setPrompt(prompt);\n\n        verify(view).setPrompt(prompt);\n    }\n\n    @Test\n    public void testHiddenComment() throws Exception {\n        presenter.setCommentIsHidden(true);\n        verify(toggleCommentPresenter).setHidden(true);\n    }\n\n    @Test\n    public void testVisibleComment() throws Exception {\n        presenter.setCommentIsHidden(false);\n        verify(toggleCommentPresenter).setHidden(false);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/RenamePopUpPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.commons.ToggleCommentPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RenamePopUpPresenterTest {\n\n    @Mock\n    Path path;\n\n    @Mock\n    Validator validator;\n\n    @Mock\n    CommandWithFileNameAndCommitMessage renameCommand;\n\n    @Mock\n    CommandWithFileNameAndCommitMessage saveAndRenameCommand;\n\n    @Mock\n    ToggleCommentPresenter toggleCommentPresenter;\n\n    @Mock\n    RenamePopUpPresenter.View view;\n\n    RenamePopUpPresenter presenter;\n\n    @Before\n    public void init() throws Exception {\n        presenter = spy(new RenamePopUpPresenter(view, toggleCommentPresenter));\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        presenter.setup();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show(path,\n                       validator,\n                       renameCommand);\n\n        assertNotNull(presenter.getPath());\n        assertNotNull(presenter.getValidator());\n        assertNotNull(presenter.getRenameCommand());\n\n        verify(presenter).setupView();\n        verify(presenter).showView();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingPath() throws Exception {\n        presenter.show(null,\n                       validator,\n                       renameCommand);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingValidator() throws Exception {\n        presenter.show(path,\n                       null,\n                       renameCommand);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingRenameCommand() throws Exception {\n\n        final boolean isDirty = true;\n        final String fileName = \"file.plugin\";\n\n        presenter.show(path,\n                       validator,\n                       null,\n                       saveAndRenameCommand,\n                       isDirty,\n                       fileName);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingSaveAndRenameCommand() throws Exception {\n\n        final boolean isDirty = true;\n        final String fileName = \"file.plugin\";\n\n        presenter.show(path,\n                       validator,\n                       renameCommand,\n                       null,\n                       isDirty,\n                       fileName);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testShowMissingCommand() throws Exception {\n        presenter.show(path,\n                       validator,\n                       null);\n    }\n\n    @Test\n    public void testShowWithDefaultValidator() throws Exception {\n        presenter.show(path,\n                       renameCommand);\n\n        assertNotNull(presenter.getPath());\n        assertNotNull(presenter.getValidator());\n        assertNotNull(presenter.getRenameCommand());\n\n        verify(presenter).setupView();\n        verify(presenter).showView();\n    }\n\n    @Test\n    public void testCancel() throws Exception {\n        presenter.cancel();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testRename() throws Exception {\n\n        when(path.getFileName()).thenReturn(\"file.plugin\");\n\n        presenter.show(path, validator, renameCommand);\n        presenter.rename(\"newFile\");\n\n        verify(validator).validate(eq(\"newFile.plugin\"), any(ValidatorWithReasonCallback.class));\n    }\n\n    @Test\n    public void testSaveAndRename() throws Exception {\n\n        final boolean isDirty = true;\n\n        when(path.getFileName()).thenReturn(\"file.plugin\");\n\n        presenter.show(path, validator, isDirty, renameCommand, saveAndRenameCommand);\n        presenter.saveAndRename(\"newFile\");\n\n        verify(validator).validate(eq(\"newFile.plugin\"), any(ValidatorWithReasonCallback.class));\n    }\n\n    @Test\n    public void testEnablePrimaryButtonWhenAssetIsDirty() {\n\n        final boolean isDirty = true;\n\n        doReturn(isDirty).when(presenter).isDirty();\n\n        presenter.enablePrimaryButton();\n\n        verify(view).saveAndRenameAsPrimary();\n    }\n\n    @Test\n    public void testEnablePrimaryButtonWhenAssetIsNotDirty() {\n\n        final boolean isDirty = false;\n\n        doReturn(isDirty).when(presenter).isDirty();\n\n        presenter.enablePrimaryButton();\n\n        verify(view).renameAsPrimary();\n    }\n\n    @Test\n    public void testHideSaveAndRenameIfAssetIsNotDirtyWhenAssetIsDirty() {\n\n        final boolean isDirty = true;\n        final boolean hidden = false;\n\n        doReturn(isDirty).when(presenter).isDirty();\n\n        presenter.hideSaveAndRenameIfAssetIsNotDirty();\n\n        verify(view).hideSaveAndRename(hidden);\n    }\n\n    @Test\n    public void testHideSaveAndRenameIfAssetIsNotDirtyWhenAssetIsNotDirty() {\n\n        final boolean isDirty = false;\n        final boolean hidden = true;\n\n        doReturn(isDirty).when(presenter).isDirty();\n\n        presenter.hideSaveAndRenameIfAssetIsNotDirty();\n\n        verify(view).hideSaveAndRename(hidden);\n    }\n\n    @Test\n    public void testSetupView() {\n\n        presenter.setupView();\n\n        verify(presenter).enablePrimaryButton();\n        verify(presenter).hideSaveAndRenameIfAssetIsNotDirty();\n    }\n\n    @Test\n    public void testShowView() {\n\n        final String originalFileName = \"originalFileName\";\n\n        doReturn(originalFileName).when(presenter).getOriginalFileName();\n\n        presenter.showView();\n\n        verify(view).setOriginalFileName(originalFileName);\n        verify(view).show();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/RestorePopUpPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.ext.editor.commons.version.events.RestoreEvent;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\n@WithClassesToStub({CommonConstants.class, ObservablePath.class})\npublic class RestorePopUpPresenterTest {\n\n    @Mock\n    BusyIndicatorView busyIndicatorView;\n\n    @Mock\n    Caller<VersionService> versionService;\n\n    @Mock\n    EventSourceMock<RestoreEvent> restoreEvent;\n\n    @Mock\n    RestoreUtil restoreUtil;\n\n    @Mock\n    RestorePopUpPresenter.View view;\n\n    @Mock\n    ObservablePath path;\n\n    @Mock\n    ParameterizedCommand<String> commandMock;\n\n    @Mock\n    CurrentBranch currentBranch;\n\n    RestorePopUpPresenter presenter;\n\n    @Before\n    public void init() throws Exception {\n        presenter = new RestorePopUpPresenter(view,\n                                              busyIndicatorView,\n                                              versionService,\n                                              restoreEvent,\n                                              restoreUtil) {\n        };\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        presenter.setup();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testRestore() throws Exception {\n        when(view.getComment()).thenReturn(\"test\");\n        presenter.command = commandMock;\n\n        presenter.restore();\n\n        verify(commandMock).execute(\"test\");\n        verify(view).hide();\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter = spy(presenter);\n\n        presenter.show(path,\n                       \"uri\",\n                       currentBranch.getName());\n\n        verify(view).show();\n        verify(presenter).restoreCommand(path,\n                                         \"uri\",\n                                         currentBranch.getName());\n    }\n\n    @Test\n    public void testCancel() throws Exception {\n        presenter.cancel();\n\n        verify(view).hide();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/file/popups/SavePopUpPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.file.popups;\n\nimport java.util.HashMap;\nimport javax.enterprise.event.Event;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.client.mvp.SaveInProgressEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SavePopUpPresenterTest {\n\n    @Mock\n    Event<SaveInProgressEvent> saveInProgressEvent;\n\n    @Mock\n    SavePopUpPresenter.View view;\n\n    @Mock\n    ParameterizedCommand<String> command;\n\n    @Mock\n    Path path;\n\n    SavePopUpPresenter presenter;\n\n    @Before\n    public void init() throws Exception {\n        presenter = new SavePopUpPresenter(view, saveInProgressEvent);\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        presenter.setup();\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testShowWithoutPath() throws Exception {\n        presenter.show(command);\n\n        verify(view).show();\n        assertEquals(command,\n                     presenter.getCommand());\n    }\n\n    @Test\n    public void testShowWithAPathThatIsVersioned() throws Exception {\n        final Path versionedPath = getVersionedPath();\n\n        presenter.show(versionedPath,\n                       command);\n\n        verify(view).show();\n        verifyNoMoreInteractions(saveInProgressEvent);\n    }\n\n    @Test\n    public void testShowWithAPathThatIsNotVersioned() throws Exception {\n        presenter.show(path,\n                       command);\n\n        verifyNoMoreInteractions(view);\n        verify(command).execute(\"\");\n        verify(saveInProgressEvent).fire(new SaveInProgressEvent(any()));\n    }\n\n    @Test\n    public void testSaveWithCommand() throws Exception {\n        when(view.getComment()).thenReturn(\"test\");\n\n        presenter.show(command);\n        presenter.save();\n\n        verify(command).execute(\"test\");\n        verify(view).hide();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testSaveWithoutCommand() throws Exception {\n        presenter.show(null);\n        presenter.save();\n    }\n\n    private Path getVersionedPath() {\n        return PathFactory.newPath(\"fileName\",\n                                   \"uri\",\n                                   new HashMap<String, Object>() {\n                                       {\n                                           put(PathFactory.VERSION_PROPERTY,\n                                               true);\n                                       }\n                                   });\n    }\n\n    @Test\n    public void cancel() throws Exception {\n        presenter.cancel();\n\n        verify(view).hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/Helper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\nimport static org.mockito.Mockito.*;\n\npublic class Helper {\n\n    public static VersionRecord getVersionRecord(String version) {\n        VersionRecord versionRecord = mock(VersionRecord.class);\n        when(versionRecord.id()).thenReturn(version);\n        when(versionRecord.uri()).thenReturn(\"hehe//\" + version);\n        return versionRecord;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionHistoryPresenterTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class VersionHistoryPresenterTest {\n\n    private VersionHistoryPresenterView view;\n    private VersionHistoryPresenterView.Presenter presenter;\n    private VersionService service;\n    private VersionHistoryPresenter screen;\n    private List<VersionRecord> records = new ArrayList<VersionRecord>();\n    private VersionHistoryPresenterTest.VersionSelectedEventMock event;\n    private Path path111;\n    private Path path222;\n    private Path path333;\n\n    @Before\n    public void setUp() throws Exception {\n        view = mock(VersionHistoryPresenterView.class);\n\n        path111 = mock(Path.class);\n        when(path111.toURI()).thenReturn(\"hehe//test.file\");\n        path222 = mock(Path.class);\n        when(path222.toURI()).thenReturn(\"hehe//test.file\");\n        path333 = mock(Path.class);\n        when(path333.toURI()).thenReturn(\"hehe//test.file\");\n        event = mock(VersionSelectedEventMock.class);\n\n        screen = new VersionHistoryPresenter(\n                view,\n                new VersionServiceMock(),\n                event);\n\n        presenter = screen;\n    }\n\n    @Test\n    public void testSetPresenter() throws Exception {\n        verify(view).setPresenter(presenter);\n    }\n\n    @Test\n    public void testLoadHistory() throws Exception {\n\n        VersionRecord versionRecord1 = getVersionRecord(\"111\");\n        records.add(versionRecord1);\n        VersionRecord versionRecord2 = getVersionRecord(\"222\");\n        records.add(versionRecord2);\n        VersionRecord versionRecord3 = getVersionRecord(\"333\");\n        records.add(versionRecord3);\n\n        screen.init(path333);\n\n        screen.refresh(\"333\");\n\n        verify(view).setup(eq(\"333\"),\n                           any(AsyncDataProvider.class));\n    }\n\n    @Test\n    public void testSelectVersion() throws Exception {\n        VersionRecord versionRecord1 = getVersionRecord(\"111\");\n        records.add(versionRecord1);\n        VersionRecord versionRecord2 = getVersionRecord(\"222\");\n        records.add(versionRecord2);\n\n        screen.init(path222);\n\n        screen.onSelect(versionRecord1);\n\n        ArgumentCaptor<VersionSelectedEvent> argumentCaptor = ArgumentCaptor.forClass(VersionSelectedEvent.class);\n        verify(event).fire(argumentCaptor.capture());\n\n        assertEquals(versionRecord1,\n                     argumentCaptor.getValue().getVersionRecord());\n    }\n\n    @Test\n    public void testVersionChanges() throws Exception {\n        VersionRecord versionRecord1 = getVersionRecord(\"111\");\n        records.add(versionRecord1);\n        VersionRecord versionRecord2 = getVersionRecord(\"222\");\n        records.add(versionRecord2);\n\n        screen.init(path222);\n\n        screen.refresh(\"222\");\n\n        verify(view).setup(eq(\"222\"),\n                           any(AsyncDataProvider.class));\n\n        Path pathToFile = mock(Path.class);\n        when(pathToFile.toURI()).thenReturn(\"hehe//test.file\");\n        screen.onVersionChange(new VersionSelectedEvent(pathToFile,\n                                                        versionRecord1));\n\n        verify(view).setup(eq(\"111\"),\n                           any(AsyncDataProvider.class));\n    }\n\n    @Test\n    public void testVersionChangeForSomeOtherFile() throws Exception {\n        VersionRecord versionRecord1 = getVersionRecord(\"111\");\n        records.add(versionRecord1);\n        VersionRecord versionRecord2 = getVersionRecord(\"222\");\n        records.add(versionRecord2);\n\n        screen.init(path222);\n\n        screen.refresh(\"222\");\n\n        verify(view).setup(eq(\"222\"),\n                           any(AsyncDataProvider.class));\n\n        Path pathToFile = mock(Path.class);\n        when(pathToFile.toURI()).thenReturn(\"hehe//another.file\");\n        screen.onVersionChange(new VersionSelectedEvent(pathToFile,\n                                                        getVersionRecord(\"111\")));\n\n        verify(view).setup(eq(\"222\"),\n                           any(AsyncDataProvider.class));\n    }\n\n    private VersionRecord getVersionRecord(String version) {\n        VersionRecord versionRecord = mock(VersionRecord.class);\n        when(versionRecord.id()).thenReturn(version);\n        when(versionRecord.uri()).thenReturn(\"hehe//test.file\");\n        return versionRecord;\n    }\n\n    private class VersionServiceMock\n            implements Caller<VersionService> {\n\n        RemoteCallback callback;\n\n        private VersionServiceMock() {\n\n            service = new VersionService() {\n                public List<VersionRecord> getVersions(final Path path) {\n                    callback.callback(records);\n                    return null;\n                }\n\n                public Path getPathToPreviousVersion(String uri) {\n                    return null;\n                }\n\n                public Path restore(final Path path,\n                                    final String comment,\n                                    final String currentBranch) {\n                    return null;\n                }\n            };\n        }\n\n        @Override\n        public VersionService call() {\n            return service;\n        }\n\n        @Override\n        public VersionService call(RemoteCallback<?> remoteCallback) {\n            callback = remoteCallback;\n            return service;\n        }\n\n        @Override\n        public VersionService call(RemoteCallback<?> remoteCallback,\n                                   ErrorCallback<?> errorCallback) {\n            callback = remoteCallback;\n            return service;\n        }\n    }\n\n    private class VersionSelectedEventMock extends EventSourceMock<VersionSelectedEvent> {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionMenuDropDownButtonTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.ext.editor.commons.client.history.Helper.getVersionRecord;\n\npublic class VersionMenuDropDownButtonTest {\n\n    private VersionMenuDropDownButtonView view;\n    private VersionMenuDropDownButton button;\n\n    @Before\n    public void setUp() throws Exception {\n        view = mock(VersionMenuDropDownButtonView.class);\n\n        button = new VersionMenuDropDownButton(view);\n    }\n\n    @Test\n    public void testPresenterSet() throws Exception {\n        verify(view).setPresenter(button);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testNoVersion() throws Exception {\n        button.setItems(new ArrayList<VersionRecord>());\n\n        button.onMenuOpening();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testNoVersionRecords() throws Exception {\n        button.setVersion(\"111\");\n\n        button.onMenuOpening();\n    }\n\n    @Test\n    public void testVersionChange() throws Exception {\n        ArrayList<VersionRecord> versionRecords = new ArrayList<VersionRecord>();\n\n        versionRecords.add(getVersionRecord(\"1111\"));\n        versionRecords.add(getVersionRecord(\"2222\"));\n        versionRecords.add(getVersionRecord(\"3333\"));\n\n        button.setItems(versionRecords);\n        button.setVersion(\"3333\");\n\n        button.onMenuOpening();\n\n        verify(view).addLabel(eq(versionRecords.get(2)),\n                              eq(true),\n                              eq(3));\n        verify(view).addLabel(eq(versionRecords.get(1)),\n                              eq(false),\n                              eq(2));\n        verify(view).addLabel(eq(versionRecords.get(0)),\n                              eq(false),\n                              eq(1));\n\n        button.setVersion(\"2222\");\n\n        button.onMenuOpening();\n\n        verify(view).addLabel(eq(versionRecords.get(2)),\n                              eq(false),\n                              eq(3));\n        verify(view).addLabel(eq(versionRecords.get(1)),\n                              eq(true),\n                              eq(2));\n        verify(view,\n               times(2)).addLabel(eq(versionRecords.get(0)),\n                                  eq(false),\n                                  eq(1));\n    }\n\n    @Test\n    public void testItemsCanNotBeSetToLessThanBefore() throws Exception {\n        ArrayList<VersionRecord> versions = new ArrayList<VersionRecord>();\n        versions.add(getVersionRecord(\"1111\"));\n        versions.add(getVersionRecord(\"2222\"));\n\n        button.setItems(versions);\n        button.setVersion(\"1111\");\n\n        button.onMenuOpening();\n        verify(view,\n               times(2)).addLabel(any(VersionRecord.class),\n                                  anyBoolean(),\n                                  anyInt());\n\n        ArrayList<VersionRecord> versions2 = new ArrayList<VersionRecord>();\n        versions2.add(getVersionRecord(\"1111\"));\n\n        button.setItems(versions2);\n\n        button.onMenuOpening();\n        verify(view,\n               times(4)).addLabel(any(VersionRecord.class),\n                                  anyBoolean(),\n                                  anyInt());\n    }\n\n    @Test\n    public void testNewVersionAdded() throws Exception {\n        ArrayList<VersionRecord> versionRecords = new ArrayList<VersionRecord>();\n\n        versionRecords.add(getVersionRecord(\"1111\"));\n        versionRecords.add(getVersionRecord(\"2222\"));\n        versionRecords.add(getVersionRecord(\"3333\"));\n\n        button.setItems(versionRecords);\n        button.setVersion(\"3333\");\n\n        button.onMenuOpening();\n\n        verify(view).addLabel(eq(versionRecords.get(2)),\n                              eq(true),\n                              eq(3));\n        verify(view).addLabel(eq(versionRecords.get(1)),\n                              eq(false),\n                              eq(2));\n        verify(view).addLabel(eq(versionRecords.get(0)),\n                              eq(false),\n                              eq(1));\n\n        ArrayList<VersionRecord> versionRecords2 = new ArrayList<VersionRecord>();\n\n        versionRecords2.add(getVersionRecord(\"1111\"));\n        versionRecords2.add(getVersionRecord(\"2222\"));\n        versionRecords2.add(getVersionRecord(\"3333\"));\n        versionRecords2.add(getVersionRecord(\"4444\"));\n\n        button.setItems(versionRecords2);\n        button.setVersion(\"4444\");\n\n        button.onMenuOpening();\n\n        verify(view).addLabel(eq(versionRecords2.get(3)),\n                              eq(true),\n                              eq(4));\n        verify(view).addLabel(eq(versionRecords2.get(2)),\n                              eq(false),\n                              eq(3));\n        verify(view).addLabel(eq(versionRecords2.get(1)),\n                              eq(false),\n                              eq(2));\n        verify(view).addLabel(eq(versionRecords2.get(0)),\n                              eq(false),\n                              eq(1));\n    }\n\n    @Test\n    public void testShowMoreCount() {\n\n        ArrayList<VersionRecord> versionRecords = new ArrayList<VersionRecord>();\n\n        versionRecords.add(getVersionRecord(\"1111\"));\n        versionRecords.add(getVersionRecord(\"2222\"));\n        versionRecords.add(getVersionRecord(\"3333\"));\n        versionRecords.add(getVersionRecord(\"4444\"));\n        versionRecords.add(getVersionRecord(\"5555\"));\n        versionRecords.add(getVersionRecord(\"6666\"));\n        versionRecords.add(getVersionRecord(\"7777\"));\n        versionRecords.add(getVersionRecord(\"8888\"));\n        versionRecords.add(getVersionRecord(\"9999\"));\n\n        button.setItems(versionRecords);\n        button.setVersion(\"3333\");\n\n        button.onMenuOpening();\n\n        //the last 7 elements are shown in the UI\n        verify(view).addLabel(eq(versionRecords.get(8)),\n                              eq(false),\n                              eq(9));\n        verify(view).addLabel(eq(versionRecords.get(7)),\n                              eq(false),\n                              eq(8));\n        verify(view).addLabel(eq(versionRecords.get(6)),\n                              eq(false),\n                              eq(7));\n        verify(view).addLabel(eq(versionRecords.get(5)),\n                              eq(false),\n                              eq(6));\n        verify(view).addLabel(eq(versionRecords.get(4)),\n                              eq(false),\n                              eq(5));\n        verify(view).addLabel(eq(versionRecords.get(3)),\n                              eq(false),\n                              eq(4));\n        verify(view).addLabel(eq(versionRecords.get(2)),\n                              eq(true),\n                              eq(3));\n\n        //so a count of 9 - 7 = 2 should be shown in the show more label\n        verify(view).addViewAllLabel(eq(2),\n                                     any(Command.class));\n    }\n\n    @Test\n    public void testResetVersions() {\n        final ArrayList<VersionRecord> versions = new ArrayList<VersionRecord>();\n        versions.add(getVersionRecord(\"1111\"));\n        versions.add(getVersionRecord(\"2222\"));\n\n        button.setItems(versions);\n        button.setVersion(\"1111\");\n\n        button.onMenuOpening();\n\n        //Button was originally initialised with 2 versions, so we expect 2 labels to be added\n        verify(view,\n               times(2)).addLabel(any(VersionRecord.class),\n                                  anyBoolean(),\n                                  anyInt());\n\n        final ArrayList<VersionRecord> versions2 = new ArrayList<VersionRecord>();\n        versions2.add(getVersionRecord(\"1111\"));\n\n        //Reset Mock view so we can check the *real* number of times a label was added\n        reset(view);\n\n        button.resetVersions();\n        button.setItems(versions2);\n        button.setVersion(\"1111\");\n\n        button.onMenuOpening();\n\n        //Button was re-initialised with 1 version, so we expect 1 label to be added\n        verify(view,\n               times(1)).addLabel(any(VersionRecord.class),\n                                  anyBoolean(),\n                                  anyInt());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionRecordManagerOpenOlderVersionTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.client.file.popups.RestorePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\nimport org.uberfire.ext.editor.commons.client.menu.common.DefaultCurrentBranch;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n/**\n * This happens when an editor is opened and the path has the version parameter pointing to an older version.\n * This should open and older version of the file.\n */\npublic class VersionRecordManagerOpenOlderVersionTest {\n\n    private VersionRecordManager manager;\n    private ArrayList<VersionRecord> versions = new ArrayList<VersionRecord>();\n    private RestorePopUpPresenter restorePopup;\n    private RestoreUtil util;\n    private VersionMenuDropDownButton dropDownButton;\n    private SaveButton saveButton;\n    private ObservablePath pathTo111;\n    private ObservablePath pathTo222;\n    private ObservablePath pathTo333;\n\n    @Before\n    public void setUp() throws Exception {\n        dropDownButton = mock(VersionMenuDropDownButton.class);\n        saveButton = mock(SaveButton.class);\n        restorePopup = mock(RestorePopUpPresenter.class);\n\n        setUpUtil();\n        setUpVersions();\n\n        manager = new VersionRecordManager(\n                dropDownButton,\n                saveButton,\n                restorePopup,\n                util,\n                new VersionSelectedEventMock(\n                        new Callback<VersionSelectedEvent>() {\n                            @Override\n                            public void callback(VersionSelectedEvent result) {\n                                manager.onVersionSelectedEvent(result);\n                            }\n                        }),\n                new VersionServiceCallerMock(versions),\n                mock(DefaultCurrentBranch.class));\n    }\n\n    private void setUpVersions() {\n        versions.add(getVersionRecord(\"111\"));\n        versions.add(getVersionRecord(\"222\"));\n        versions.add(getVersionRecord(\"333\"));\n    }\n\n    private void setUpUtil() {\n        util = mock(RestoreUtil.class);\n        pathTo111 = mock(ObservablePath.class);\n        pathTo222 = mock(ObservablePath.class);\n        pathTo333 = mock(ObservablePath.class);\n        when(pathTo111.toURI()).thenReturn(\"hehe//111\");\n        when(pathTo222.toURI()).thenReturn(\"hehe//222\");\n        when(pathTo333.toURI()).thenReturn(\"hehe//333\");\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//111\")).thenReturn(pathTo111);\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//222\")).thenReturn(pathTo222);\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//333\")).thenReturn(pathTo333);\n    }\n\n    @Test\n    public void testOpenOlder() throws Exception {\n\n        manager.init(\n                \"222\",\n                pathTo333,\n                new Callback<VersionRecord>() {\n                    @Override\n                    public void callback(VersionRecord result) {\n                        manager.setVersion(result.id());\n                    }\n                });\n\n        assertEquals(pathTo222,\n                     manager.getCurrentPath());\n        assertEquals(pathTo333,\n                     manager.getPathToLatest());\n        assertEquals(\"222\",\n                     manager.getVersion());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testOpenUnknownVersion() throws Exception {\n\n        manager.init(\n                \"xxx\",\n                pathTo333,\n                new Callback<VersionRecord>() {\n                    @Override\n                    public void callback(VersionRecord result) {\n                        manager.setVersion(result.id());\n                    }\n                });\n    }\n\n    private VersionRecord getVersionRecord(String version) {\n        VersionRecord versionRecord = mock(VersionRecord.class);\n        when(versionRecord.id()).thenReturn(version);\n        when(versionRecord.uri()).thenReturn(\"hehe//\" + version);\n        return versionRecord;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionRecordManagerTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.editor.commons.client.file.RestoreUtil;\nimport org.uberfire.ext.editor.commons.client.file.popups.RestorePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.ext.editor.commons.client.history.Helper.getVersionRecord;\n\npublic class VersionRecordManagerTest {\n\n    private VersionRecordManager manager;\n    private ArrayList<VersionRecord> versions = new ArrayList<VersionRecord>();\n    private RestorePopUpPresenter restorePopup;\n    private RestoreUtil util;\n    private VersionMenuDropDownButton dropDownButton;\n    private SaveButton saveButton;\n    private ObservablePath pathTo111;\n    private ObservablePath pathTo222;\n    private ObservablePath pathTo333;\n    private VersionSelectedEventMock versionSelectedEvent;\n    private CurrentBranch currentBranch;\n\n    @Before\n    public void setUp() throws Exception {\n        dropDownButton = mock(VersionMenuDropDownButton.class);\n        saveButton = mock(SaveButton.class);\n        restorePopup = mock(RestorePopUpPresenter.class);\n        currentBranch = mock(CurrentBranch.class);\n\n        setUpUtil();\n        setUpVersions();\n\n        versionSelectedEvent = spy(new VersionSelectedEventMock(new Callback<VersionSelectedEvent>() {\n            @Override\n            public void callback(VersionSelectedEvent result) {\n                manager.onVersionSelectedEvent(result);\n            }\n        }));\n        manager = spy(new VersionRecordManager(dropDownButton,\n                                               saveButton,\n                                               restorePopup,\n                                               util,\n                                               versionSelectedEvent,\n                                               new VersionServiceCallerMock(versions),\n                                               currentBranch));\n\n        manager.init(null,\n                     pathTo333,\n                     new Callback<VersionRecord>() {\n                         @Override\n                         public void callback(VersionRecord result) {\n                             manager.setVersion(result.id());\n                         }\n                     });\n    }\n\n    private void setUpVersions() {\n        versions.add(getVersionRecord(\"111\"));\n        versions.add(getVersionRecord(\"222\"));\n        versions.add(getVersionRecord(\"333\"));\n    }\n\n    private void setUpUtil() {\n        util = mock(RestoreUtil.class);\n        pathTo111 = mock(ObservablePath.class);\n        pathTo222 = mock(ObservablePath.class);\n        pathTo333 = mock(ObservablePath.class);\n        when(pathTo111.toURI()).thenReturn(\"hehe//111\");\n        when(pathTo222.toURI()).thenReturn(\"hehe//222\");\n        when(pathTo333.toURI()).thenReturn(\"hehe//333\");\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//111\")).thenReturn(pathTo111);\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//222\")).thenReturn(pathTo222);\n        when(util.createObservablePath(pathTo333,\n                                       \"hehe//333\")).thenReturn(pathTo333);\n    }\n\n    @Test\n    public void testSimple() throws Exception {\n        verify(dropDownButton).setItems(versions);\n        assertEquals(pathTo333,\n                     manager.getCurrentPath());\n        assertEquals(pathTo333,\n                     manager.getPathToLatest());\n        assertEquals(\"333\",\n                     manager.getVersion());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testVersionToNull() throws Exception {\n        manager.setVersion(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testVersionsNull() throws Exception {\n        manager.setVersions(null);\n    }\n\n    @Test\n    public void testVersionChange() throws Exception {\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"111\")));\n\n        assertEquals(pathTo111,\n                     manager.getCurrentPath());\n        assertEquals(\"111\",\n                     manager.getVersion());\n    }\n\n    @Test\n    public void testReset() throws Exception {\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"111\")));\n\n        manager.restoreToCurrentVersion(true);\n\n        verify(restorePopup).show(pathTo111,\n                                  \"hehe//111\",\n                                  currentBranch.getName());\n    }\n\n    @Test\n    public void testRestoreToCurrentVersionWithNoComment() {\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"111\")));\n        when(restorePopup.restoreCommand(pathTo111,\n                                         \"hehe//111\",\n                                         currentBranch.getName())).thenReturn(mock(ParameterizedCommand.class));\n        manager.restoreToCurrentVersion(false);\n        verify(restorePopup).restoreCommand(pathTo111,\n                                            \"hehe//111\",\n                                            currentBranch.getName());\n    }\n\n    @Test\n    public void testReload() throws Exception {\n        versions.add(getVersionRecord(\"444\"));\n\n        ObservablePath pathTo444 = mock(ObservablePath.class);\n\n        when(pathTo444.toURI()).thenReturn(\"hehe//444\");\n        when(util.createObservablePath(pathTo444,\n                                       \"hehe//444\")).thenReturn(pathTo444);\n\n        manager.reloadVersions(pathTo444);\n\n        assertEquals(pathTo444,\n                     manager.getPathToLatest());\n        assertEquals(pathTo444,\n                     manager.getCurrentPath());\n        assertEquals(\"444\",\n                     manager.getVersion());\n    }\n\n    @Test\n    public void saveButtonLabelChangeTest() throws Exception {\n        //This is called by setUp()'s call to manager.init(..)\n        verify(saveButton,\n               times(1)).setTextToSave();\n\n        //when an older version is selected the label should be \"Restore\"\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"111\")));\n        verify(saveButton,\n               times(1)).setTextToRestore();\n\n        //if last version is selected the label should be \"Save\"\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"333\")));\n        verify(saveButton,\n               times(2)).setTextToSave();\n\n        //if we go back to an older version again the label should be \"Restore\" again\n        manager.onVersionSelectedEvent(new VersionSelectedEvent(pathTo333,\n                                                                getVersionRecord(\"222\")));\n        verify(saveButton,\n               times(2)).setTextToRestore();\n    }\n\n    @Test\n    public void testInitNeedsToClearTheState() throws Exception {\n        // clear the state before to init. This will cover the cases where the init method is invoked multiple\n        // times. for example if KieEditor.init(...) method is invoked multiple times, or KieMultipleDocumentEditor\n        // re-initialises VersionRecordManager for different document.\n\n        verify(manager).clear();\n        verify(dropDownButton).resetVersions();\n    }\n\n    @Test\n    public void testReinitialise_WithLatestVersion() {\n        //Reset Mocks so we can check the *real* interactions expected by this test, excluding those in setUp()\n        reset(saveButton);\n        reset(dropDownButton);\n\n        //Emulate reinitialisation with history consisting of a single entry\n        versions.clear();\n        versions.add(getVersionRecord(\"111\"));\n\n        manager.init(null,\n                     pathTo111,\n                     (VersionRecord result) -> manager.setVersion(result.id()));\n\n        verify(dropDownButton).setItems(versions);\n        verify(saveButton,\n               times(1)).setTextToSave();\n\n        assertEquals(pathTo111,\n                     manager.getCurrentPath());\n        assertEquals(pathTo111,\n                     manager.getPathToLatest());\n        assertEquals(\"111\",\n                     manager.getVersion());\n    }\n\n    @Test\n    public void testReinitialise_WithOlderVersion() {\n        //This is called by setUp()'s call to manager.init(..)\n        verify(saveButton,\n               times(1)).setTextToSave();\n\n        //Reset Mocks so we can check the *real* interactions expected by this test, excluding those in setUp()\n        reset(saveButton);\n        reset(dropDownButton);\n\n        //Emulate reinitialisation with history consisting of a single entry\n        versions.clear();\n        versions.add(getVersionRecord(\"333\"));\n        versions.add(getVersionRecord(\"111\"));\n\n        manager.init(\"333\",\n                     pathTo333,\n                     (VersionRecord result) -> manager.setVersion(result.id()));\n\n        verify(dropDownButton).setItems(versions);\n        verify(saveButton,\n               times(1)).setTextToRestore();\n\n        assertEquals(pathTo333,\n                     manager.getCurrentPath());\n        assertEquals(pathTo333,\n                     manager.getPathToLatest());\n        assertEquals(\"333\",\n                     manager.getVersion());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void zeroVersionRecordsForDeletedFile() {\n        reset(saveButton);\n        reset(dropDownButton);\n\n        versions.clear();\n\n        manager.init(null,\n                     pathTo111,\n                     (VersionRecord result) -> manager.setVersion(result.id()));\n\n        verify(dropDownButton,\n               never()).setItems(any(List.class));\n        verify(dropDownButton,\n               never()).setVersion(any(String.class));\n\n        assertEquals(pathTo111,\n                     manager.getCurrentPath());\n        assertEquals(pathTo111,\n                     manager.getPathToLatest());\n        assertNull(manager.getVersion());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionSelectedEventMock.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.lang.annotation.Annotation;\nimport java.util.concurrent.CompletionStage;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.util.TypeLiteral;\n\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.editor.commons.client.history.event.VersionSelectedEvent;\n\npublic class VersionSelectedEventMock\n        implements Event<VersionSelectedEvent> {\n\n    private Callback<VersionSelectedEvent> callback;\n\n    public VersionSelectedEventMock(Callback<VersionSelectedEvent> callback) {\n        this.callback = callback;\n    }\n\n    @Override\n    public void fire(VersionSelectedEvent event) {\n        callback.callback(event);\n    }\n\n    @Override\n    public <U extends VersionSelectedEvent> CompletionStage<U> fireAsync(U u) {\n        return null;\n    }\n\n    @Override\n    public <U extends VersionSelectedEvent> CompletionStage<U> fireAsync(U u,\n                                                                         NotificationOptions notificationOptions) {\n        return null;\n    }\n\n    @Override\n    public Event<VersionSelectedEvent> select(Annotation... annotations) {\n        return null;\n    }\n\n    @Override\n    public <U extends VersionSelectedEvent> Event<U> select(Class<U> uClass,\n                                                            Annotation... annotations) {\n        return null;\n    }\n\n    @Override\n    public <U extends VersionSelectedEvent> Event<U> select(TypeLiteral<U> subtype,\n                                                            Annotation... qualifiers) {\n        return null;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionServiceCallerMock.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\nclass VersionServiceCallerMock\n        implements Caller<VersionService> {\n\n    private VersionServiceMock service;\n\n    VersionServiceCallerMock(ArrayList<VersionRecord> versions) {\n        service = new VersionServiceMock(versions);\n    }\n\n    @Override\n    public VersionService call() {\n        return service;\n    }\n\n    @Override\n    public VersionService call(RemoteCallback<?> remoteCallback) {\n        service.setCallback(remoteCallback);\n        return service;\n    }\n\n    @Override\n    public VersionService call(RemoteCallback<?> remoteCallback,\n                               ErrorCallback<?> errorCallback) {\n        service.setCallback(remoteCallback);\n        return service;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/history/VersionServiceMock.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.history;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.version.VersionService;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\nclass VersionServiceMock\n        implements VersionService {\n\n    private ArrayList<VersionRecord> versions = new ArrayList<VersionRecord>();\n\n    private RemoteCallback callback;\n\n    public VersionServiceMock(ArrayList<VersionRecord> versions) {\n        this.versions = versions;\n    }\n\n    @Override\n    public List<VersionRecord> getVersions(Path path) {\n        callback.callback(versions);\n        return null;\n    }\n\n    @Override\n    public Path getPathToPreviousVersion(String uri) {\n        return null;\n    }\n\n    @Override\n    public Path restore(Path path,\n                        String comment,\n                        String currentBranch) {\n        return null;\n    }\n\n    public void setCallback(RemoteCallback<?> remoteCallback) {\n        callback = remoteCallback;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorLibraryLoaderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.mockito.Mockito.*;\n\npublic class HtmlEditorLibraryLoaderTest {\n\n    private HtmlEditorLibraryLoader loader;\n\n    @Before\n    public void setup() {\n        loader = spy(new HtmlEditorLibraryLoader());\n        doNothing().when(loader).injectScripts();\n    }\n\n    @Test\n    public void librariesAreOnlyInjectOnceTest() {\n        loader.ensureLibrariesAreAvailable();\n        loader.ensureLibrariesAreAvailable();\n\n        verify(loader,\n               times(1)).injectScripts();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class HtmlEditorPresenterTest {\n\n    private HtmlEditorPresenter.View view;\n\n    private HtmlEditorPresenter presenter;\n\n    @Before\n    public void setup() {\n        view = mock(HtmlEditorPresenter.View.class);\n        doReturn(\"content\").when(view).getContent();\n        doNothing().when(view).setContent(anyString());\n        doNothing().when(view).load();\n\n        presenter = new HtmlEditorPresenter(view);\n    }\n\n    @Test\n    public void loadTest() {\n        presenter.load();\n\n        verify(view).load();\n    }\n\n    @Test\n    public void getContentTest() {\n        String content = presenter.getContent();\n\n        assertEquals(\"content\",\n                     content);\n        verify(view).getContent();\n    }\n\n    @Test\n    public void setContentTest() {\n        String content = \"content\";\n        presenter.setContent(content);\n\n        verify(view).setContent(content);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport java.util.function.Supplier;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.service.htmleditor.HtmlEditorService;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class HtmlEditorTest {\n\n    @Mock\n    private HtmlResourceType htmlResourceType;\n\n    @Mock\n    private HtmlEditorPresenter presenter;\n\n    @Mock\n    private HtmlEditorService htmlEditorService;\n\n    @Mock\n    private VersionRecordManager versionRecordManagerMock;\n\n    @Mock\n    private BaseEditorView baseViewMock;\n\n    private Caller<HtmlEditorService> htmlEditorServiceCaller;\n\n    private HtmlEditor htmlEditor;\n\n    @Before\n    public void setup() {\n        htmlEditorServiceCaller = new CallerMock<>(htmlEditorService);\n        htmlEditor = spy(new HtmlEditor(htmlResourceType, presenter, htmlEditorServiceCaller) {{\n            baseView = baseViewMock;\n            versionRecordManager = versionRecordManagerMock;\n        }});\n    }\n\n    @Test\n    public void testGetContentSupplier() {\n\n        final String content = \"content\";\n\n        doReturn(content).when(presenter).getContent();\n\n        final Supplier<String> contentSupplier = htmlEditor.getContentSupplier();\n\n        assertEquals(content, contentSupplier.get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n        assertEquals(htmlEditorServiceCaller, htmlEditor.getSaveAndRenameServiceCaller());\n    }\n\n    @Test\n    public void testLoadContent() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n\n        doReturn(path).when(versionRecordManagerMock).getCurrentPath();\n\n        htmlEditor.loadContent();\n\n        verify(baseViewMock).hideBusyIndicator();\n        verify(htmlEditorService).load(path);\n        verify(presenter).setContent(any());\n    }\n\n    @Test\n    public void testSave() {\n\n        final ObservablePath path = mock(ObservablePath.class);\n        final RemoteCallback successCallback = mock(RemoteCallback.class);\n        final String content = \"content\";\n\n        doReturn(content).when(presenter).getContent();\n        doReturn(path).when(versionRecordManagerMock).getCurrentPath();\n        doReturn(successCallback).when(htmlEditor).getSaveSuccessCallback(anyInt());\n\n        htmlEditor.save();\n\n        verify(htmlEditorService).save(path, content, null, null);\n        verify(successCallback).callback(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/htmleditor/HtmlEditorViewTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.htmleditor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class HtmlEditorViewTest {\n\n    private HtmlEditorLibraryLoader libraryLoader;\n\n    private HtmlEditorPresenter presenter;\n\n    private HtmlEditorView view;\n\n    @Before\n    public void setup() {\n        final TranslationService translationService = mock(TranslationService.class);\n\n        libraryLoader = mock(HtmlEditorLibraryLoader.class);\n        view = spy(new HtmlEditorView(translationService,\n                                      libraryLoader));\n        doNothing().when(view).configureScreenComponents(anyString(),\n                                                         anyString());\n        view.htmlEditor = mock(Div.class);\n        doReturn(\"content\").when(view.htmlEditor).getInnerHTML();\n        presenter = spy(new HtmlEditorPresenter(view));\n\n        doNothing().when(view).loadEditor(anyString(),\n                                          anyString());\n    }\n\n    @Test\n    public void editorIsNotLoadedTwice() {\n        presenter.load();\n        presenter.load();\n\n        verify(view,\n               times(1)).loadEditor(anyString(),\n                                    anyString());\n    }\n\n    @Test\n    public void synchronizeViewWhenReturningContent() {\n        presenter.getContent();\n\n        verify(view,\n               times(1)).synchronizeView();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/menu/BasicFileMenuBuilderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UpdatedLockStatusEvent;\nimport org.uberfire.ext.editor.commons.client.file.popups.CopyPopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.DeletePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.file.popups.RenamePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.history.SaveButton;\nimport org.uberfire.ext.editor.commons.client.menu.HasLockSyncMenuStateHelper.LockSyncMenuStateHelper.Operation;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.ext.editor.commons.client.menu.common.DefaultCurrentBranch;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BasicFileMenuBuilderTest {\n\n    @Mock\n    private Path mockPath;\n\n    @Mock\n    private BasicFileMenuBuilder.PathProvider provider;\n\n    @Mock\n    private Validator validator;\n\n    @Mock\n    private RestoreVersionCommandProvider restoreVersionCommandProvider;\n\n    @Mock\n    private EventSourceMock<NotificationEvent> notification;\n\n    @Mock\n    private BusyIndicatorView busyIndicatorView;\n\n    @Mock\n    private DeletePopUpPresenter deletePopUpPresenter;\n\n    @Mock\n    private CopyPopUpPresenter copyPopUpPresenter;\n\n    @Mock\n    private RenamePopUpPresenter renamePopUpPresenter;\n\n    @Mock\n    private SupportsDelete deleteService;\n    private CallerMock<SupportsDelete> deleteCaller;\n\n    @Mock\n    private SupportsRename renameService;\n\n    private CallerMock<SupportsRename> renameCaller;\n\n    @Mock\n    private SupportsCopy copyService;\n    private CallerMock<SupportsCopy> copyCaller;\n\n    private BasicFileMenuBuilderImpl builder;\n\n    @Before\n    public void setup() {\n        builder = new BasicFileMenuBuilderImpl(deletePopUpPresenter,\n                                               copyPopUpPresenter,\n                                               renamePopUpPresenter,\n                                               busyIndicatorView,\n                                               notification,\n                                               restoreVersionCommandProvider);\n        deleteCaller = new CallerMock<>(deleteService);\n        renameCaller = new CallerMock<>(renameService);\n        when(provider.getPath()).thenReturn(mockPath);\n    }\n\n    @Test\n    public void testDelete() {\n        builder.addDelete(mockPath,\n                          deleteCaller);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        mic.getCommand().execute();\n\n        verify(deletePopUpPresenter).show(eq(null),\n                                          any());\n    }\n\n    @Test\n    public void testDeleteWithValidator() {\n        builder.addDelete(mockPath,\n                          deleteCaller,\n                          validator);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        mic.getCommand().execute();\n\n        verify(deletePopUpPresenter).show(eq(validator),\n                                          any());\n    }\n\n    @Test\n    public void testDeleteWithProvider() {\n        builder.addDelete(provider,\n                          deleteCaller);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        verify(provider,\n               never()).getPath();\n\n        mic.getCommand().execute();\n\n        verify(provider,\n               times(1)).getPath();\n        verify(deletePopUpPresenter).show(eq(null),\n                                          any());\n    }\n\n    @Test\n    public void testDeleteWithProviderAndValidator() {\n        builder.addDelete(provider,\n                          deleteCaller,\n                          validator);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        verify(provider,\n               never()).getPath();\n\n        mic.getCommand().execute();\n\n        verify(provider,\n               times(1)).getPath();\n        verify(deletePopUpPresenter).show(eq(validator),\n                                          any());\n    }\n\n    @Test\n    public void testRename() {\n        builder.addRename(provider,\n                          validator,\n                          renameCaller);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        verify(provider,\n               never()).getPath();\n\n        mic.getCommand().execute();\n\n        verify(provider,\n               times(1)).getPath();\n    }\n\n    @Test\n    public void testCopy() {\n        builder.addCopy(provider,\n                        validator,\n                        copyCaller);\n\n        final Menus menus = builder.build();\n        final MenuItem mi = menus.getItems().get(0);\n        final MenuItemCommand mic = (MenuItemCommand) mi;\n\n        verify(provider,\n               never()).getPath();\n\n        mic.getCommand().execute();\n\n        verify(provider,\n               times(1)).getPath();\n    }\n\n    @Test\n    public void testAddRestoreVersion() {\n        CurrentBranch currentBranch = new DefaultCurrentBranch();\n        ArgumentCaptor<CurrentBranch> currentBranchCaptor = ArgumentCaptor.forClass(CurrentBranch.class);\n        builder.addRestoreVersion(mock(Path.class),\n                                  currentBranch);\n        verify(restoreVersionCommandProvider).getCommand(any(Path.class),\n                                                         currentBranchCaptor.capture());\n        assertEquals(currentBranch,\n                     currentBranchCaptor.getValue());\n    };\n\n    @Test\n    public void menuItemsDisabledWhenLockedByDifferentUser() {\n        builder.addSave(new MockSaveButton());\n        builder.addRename(mock(Command.class));\n        builder.addDelete(mock(Command.class));\n\n        final Menus menus = builder.build();\n\n        final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(mock(Path.class),\n                                                                        true,\n                                                                        false);\n\n        builder.onEditorLockInfo(event);\n\n        assertMenuItemEnabled(menus.getItems().get(0),\n                              false);\n        assertMenuItemEnabled(menus.getItems().get(1),\n                              false);\n        assertMenuItemEnabled(menus.getItems().get(2),\n                              false);\n    }\n\n    @Test\n    public void menuItemsEnabledWhenNotLocked() {\n        builder.addSave(new MockSaveButton());\n        builder.addRename(mock(Command.class));\n        builder.addDelete(mock(Command.class));\n\n        final Menus menus = builder.build();\n\n        final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(mock(Path.class),\n                                                                        false,\n                                                                        false);\n\n        builder.onEditorLockInfo(event);\n\n        assertMenuItemEnabled(menus.getItems().get(0),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(1),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(2),\n                              true);\n    }\n\n    @Test\n    public void menuItemsEnabledWhenLockedByCurrentUser() {\n        builder.addSave(new MockSaveButton());\n        builder.addRename(mock(Command.class));\n        builder.addDelete(mock(Command.class));\n\n        final Menus menus = builder.build();\n\n        final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(mock(Path.class),\n                                                                        true,\n                                                                        true);\n\n        builder.onEditorLockInfo(event);\n\n        assertMenuItemEnabled(menus.getItems().get(0),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(1),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(2),\n                              true);\n    }\n\n    @Test\n    public void menuItemsDisabledWhenNotLockedWithCustomStateHelper() {\n        builder.addSave(new MockSaveButton());\n        builder.addRename(mock(Command.class));\n        builder.addDelete(mock(Command.class));\n        builder.setLockSyncMenuStateHelper((final Path file,\n                                            final boolean isLocked,\n                                            final boolean isLockedByCurrentUser) -> Operation.DISABLE);\n\n        final Menus menus = builder.build();\n\n        //Not locked, MenuItems should normally be enabled however our custom helper forces disable\n        final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(mock(Path.class),\n                                                                        false,\n                                                                        false);\n\n        builder.onEditorLockInfo(event);\n\n        assertMenuItemEnabled(menus.getItems().get(0),\n                              false);\n        assertMenuItemEnabled(menus.getItems().get(1),\n                              false);\n        assertMenuItemEnabled(menus.getItems().get(2),\n                              false);\n    }\n\n    @Test\n    public void menuItemsStateChangeVetoedWhenLockedWithCustomStateHelper() {\n        builder.addSave(new MockSaveButton());\n        builder.addRename(mock(Command.class));\n        builder.addDelete(mock(Command.class));\n        builder.setLockSyncMenuStateHelper((final Path file,\n                                            final boolean isLocked,\n                                            final boolean isLockedByCurrentUser) -> Operation.VETO);\n\n        final Menus menus = builder.build();\n        menus.getItems().get(0).setEnabled(true);\n        menus.getItems().get(1).setEnabled(true);\n        menus.getItems().get(2).setEnabled(true);\n\n        //Locked, MenuItems should normally be disabled however our custom helper vetos changes\n        final UpdatedLockStatusEvent event = new UpdatedLockStatusEvent(mock(Path.class),\n                                                                        true,\n                                                                        false);\n\n        builder.onEditorLockInfo(event);\n\n        assertMenuItemEnabled(menus.getItems().get(0),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(1),\n                              true);\n        assertMenuItemEnabled(menus.getItems().get(2),\n                              true);\n    }\n\n    private void assertMenuItemEnabled(final MenuItem menuItem,\n                                       final boolean enabled) {\n        assertEquals(enabled,\n                     menuItem.isEnabled());\n    }\n\n    //The real SaveButton keeps state in the GWT Widget.. override to keep in the Presenter\n    private class MockSaveButton extends SaveButton {\n\n        private boolean enabled;\n\n        @Override\n        public boolean isEnabled() {\n            return this.enabled;\n        }\n\n        @Override\n        public void setEnabled(final boolean enabled) {\n            this.enabled = enabled;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/menu/DownloadMenuItemBuilderTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu;\n\nimport java.net.URL;\nimport java.util.function.Supplier;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.Constants;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@WithClassesToStub({URL.class})\n@RunWith(GwtMockitoTestRunner.class)\npublic class DownloadMenuItemBuilderTest {\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private Path path;\n\n    private Supplier<Path> pathSupplier = () -> path;\n\n    private DownloadMenuItemBuilder downloadMenuItemBuilder;\n\n    @Before\n    public void setup() {\n        downloadMenuItemBuilder = spy(new DownloadMenuItemBuilder(translationService));\n    }\n\n    @Test\n    public void testBuild() {\n\n        final String caption = \"Download\";\n        final Command menuItemCommand = () -> {/* Nothing */};\n\n        when(translationService.format(Constants.DownloadMenuItem_Download)).thenReturn(caption);\n        doReturn(menuItemCommand).when(downloadMenuItemBuilder).makeMenuItemCommand(pathSupplier);\n\n        downloadMenuItemBuilder.build(pathSupplier);\n\n        verify(downloadMenuItemBuilder).makeMenuItem(eq(caption), eq(menuItemCommand));\n    }\n\n    @Test\n    public void testMenuItemCommand() {\n\n        final Command command = downloadMenuItemBuilder.makeMenuItemCommand(pathSupplier);\n\n        when(path.toURI()).thenReturn(\"default://main@MySpace/Mortgages/src/main/resources/rule.drl\");\n        doNothing().when(downloadMenuItemBuilder).open(any());\n\n        command.execute();\n\n        verify(downloadMenuItemBuilder).download(pathSupplier);\n    }\n\n    @Test\n    public void testDownload() {\n\n        final String expectedDownloadURL = \"defaulteditor/download?path=default%3A%2F%2Fmain%40MySpace%2FMortgages%2Fsrc%2Fmain%2Fresources%2Frule.drl\";\n\n        when(path.toURI()).thenReturn(\"default://main@MySpace/Mortgages/src/main/resources/rule.drl\");\n        doNothing().when(downloadMenuItemBuilder).open(any());\n\n        downloadMenuItemBuilder.download(pathSupplier);\n\n        verify(downloadMenuItemBuilder).open(eq(expectedDownloadURL));\n    }\n\n    @Test\n    public void testDownloadSpaceAndAmpersand() {\n\n        final String expectedDownloadURL = \"defaulteditor/download?path=default%3A%2F%2Fmain%40MySpace%2FMortgages%2Fsrc%2Fmain%2Fresources%2Fa+%26+b.drl\";\n\n        when(path.toURI()).thenReturn(\"default://main@MySpace/Mortgages/src/main/resources/a & b.drl\");\n        doNothing().when(downloadMenuItemBuilder).open(any());\n\n        downloadMenuItemBuilder.download(pathSupplier);\n\n        verify(downloadMenuItemBuilder).open(eq(expectedDownloadURL));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/menu/common/CurrentBranchProducerTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.editor.commons.version.CurrentBranch;\nimport org.uberfire.mocks.MockInstanceImpl;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CurrentBranchProducerTest {\n\n    @Mock\n    private Instance<CurrentBranch> currentBranch = new MockInstanceImpl<>();\n    @InjectMocks\n    private CurrentBranchProducer currentBranchProducer = new CurrentBranchProducer();\n\n    @Test\n    public void testCurrentBranchProducerWhenUnsatisfied() {\n        Mockito.when(currentBranch.isUnsatisfied()).thenReturn(true);\n        CurrentBranch currentBranch = currentBranchProducer.currentBranchProducer();\n        Assert.assertNotNull(currentBranch);\n        Assert.assertEquals(new DefaultCurrentBranch().getName(),\n                            currentBranch.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/menu/common/DefaultCurrentBranchTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultCurrentBranchTest {\n\n    private DefaultCurrentBranch currentBranch;\n\n    @Before\n    public void setup() {\n        currentBranch = Mockito.spy(new DefaultCurrentBranch());\n    }\n\n    @Test\n    public void testGetName() {\n        Assert.assertEquals(\"master\", currentBranch.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/menu/common/SaveAndRenameCommandBuilderTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.menu.common;\n\nimport java.util.function.Supplier;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.RenameInProgressEvent;\nimport org.uberfire.ext.editor.commons.client.file.CommandWithFileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.FileNameAndCommitMessage;\nimport org.uberfire.ext.editor.commons.client.file.popups.RenamePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.widgets.common.client.common.BusyIndicatorView;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isA;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.inOrder;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.only;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SaveAndRenameCommandBuilderTest {\n\n    @Mock\n    public SupportsSaveAndRename<String, DefaultMetadata> service;\n\n    @Mock\n    private RenamePopUpPresenter renamePopUpPresenter;\n\n    @Mock\n    private RenamePopUpPresenter.View renamePopUpPresenterView;\n\n    @Mock\n    private BusyIndicatorView busyIndicatorView;\n\n    @Mock\n    private Event<NotificationEvent> notification;\n\n    @Mock\n    private Path path;\n\n    @Mock\n    private DefaultMetadata metadata;\n\n    @Mock\n    private Validator validator;\n\n    @Mock\n    private ParameterizedCommand<Path> onSuccess;\n\n    @Mock\n    private Command onError;\n\n    @Mock\n    private NotificationEvent notificationEvent;\n\n    @Mock\n    private EventSourceMock<RenameInProgressEvent> renameInProgressEvent;\n\n    @Mock\n    private Command beforeSaveAndRenameCommand;\n\n    private SaveAndRenameCommandBuilder<String, DefaultMetadata> builder;\n\n    private Caller<SupportsSaveAndRename<String, DefaultMetadata>> renameCaller;\n\n    private boolean isDirty = true;\n\n    private String content = \"content\";\n\n    private Supplier<Path> pathSupplierFake = () -> path;\n\n    private Supplier<DefaultMetadata> metadataSupplierFake = () -> metadata;\n\n    private Supplier<String> contentSupplierFake = () -> content;\n\n    private Supplier<Boolean> isDirtySupplierFake = () -> isDirty;\n\n    @Before\n    public void setup() {\n        builder = spy(new SaveAndRenameCommandBuilder<>(renamePopUpPresenter, busyIndicatorView, notification, renameInProgressEvent));\n        renameCaller = spy(new CallerMock<>(service));\n\n        doReturn(renamePopUpPresenterView).when(renamePopUpPresenter).getView();\n        doReturn(notificationEvent).when(builder).makeItemRenamedSuccessfullyEvent();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testBuildWhenPathSupplierIsNull() throws Exception {\n\n        builder\n                .addValidator(validator)\n                .addRenameService(renameCaller)\n                .build();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testBuildWhenValidatorIsNull() throws Exception {\n\n        builder\n                .addPathSupplier(pathSupplierFake)\n                .addRenameService(renameCaller)\n                .build();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testBuildWhenRenameCallerIsNull() throws Exception {\n\n        builder\n                .addPathSupplier(pathSupplierFake)\n                .addValidator(validator)\n                .build();\n    }\n\n    @Test\n    public void testBuildWhenRequiredParametersArePresent() throws Exception {\n\n        final CommandWithFileNameAndCommitMessage renameCommand = mock(CommandWithFileNameAndCommitMessage.class);\n        final CommandWithFileNameAndCommitMessage saveAndRenameCommand = mock(CommandWithFileNameAndCommitMessage.class);\n\n        doReturn(renameCommand).when(builder).makeRenameCommand();\n        doReturn(saveAndRenameCommand).when(builder).makeSaveAndRenameCommand();\n\n        final Command command = builder\n                .addPathSupplier(pathSupplierFake)\n                .addValidator(validator)\n                .addRenameService(renameCaller)\n                .addMetadataSupplier(metadataSupplierFake)\n                .addContentSupplier(contentSupplierFake)\n                .addIsDirtySupplier(isDirtySupplierFake)\n                .build();\n\n        command.execute();\n\n        verify(renamePopUpPresenter).show(path, validator, isDirty, renameCommand, saveAndRenameCommand);\n    }\n\n    @Test\n    public void testMakeSaveAndRenameCommand() throws Exception {\n\n        final String newFileName = \"newFileName\";\n        final String commitMessage = \"commitMessage\";\n        final FileNameAndCommitMessage message = new FileNameAndCommitMessage(newFileName, commitMessage);\n\n        doNothing().when(builder).showBusyIndicator();\n\n        builder\n                .addRenameService(renameCaller)\n                .addPathSupplier(pathSupplierFake)\n                .makeSaveAndRenameCommand()\n                .execute(message);\n\n        final InOrder inOrder = inOrder(builder);\n\n        inOrder.verify(builder).showBusyIndicator();\n        inOrder.verify(builder).callSaveAndRename(message);\n        inOrder.verify(builder).hideRenamePopup();\n        inOrder.verify(builder).hideBusyIndicator();\n        inOrder.verify(builder).notifyItemRenamedSuccessfully();\n    }\n\n    @Test\n    public void testMakeRenameCommand() throws Exception {\n\n        final String newFileName = \"newFileName\";\n        final String commitMessage = \"commitMessage\";\n        final FileNameAndCommitMessage message = new FileNameAndCommitMessage(newFileName, commitMessage);\n\n        doNothing().when(builder).showBusyIndicator();\n        doReturn(path).when(service).rename(path, newFileName, commitMessage);\n\n        builder\n                .addRenameService(renameCaller)\n                .addPathSupplier(pathSupplierFake)\n                .makeRenameCommand()\n                .execute(message);\n\n        final InOrder inOrder = inOrder(builder);\n\n        inOrder.verify(builder).showBusyIndicator();\n        inOrder.verify(builder).callRename(message);\n        inOrder.verify(builder).hideRenamePopup();\n        inOrder.verify(builder).hideBusyIndicator();\n        inOrder.verify(builder).notifyItemRenamedSuccessfully();\n    }\n\n    @Test\n    public void callSaveAndRename() {\n        final String newFileName = \"newFileName\";\n        final String commitMessage = \"commitMessage\";\n        final FileNameAndCommitMessage message = new FileNameAndCommitMessage(newFileName, commitMessage);\n\n        builder\n                .addRenameService(renameCaller)\n                .addPathSupplier(pathSupplierFake)\n                .addMetadataSupplier(metadataSupplierFake)\n                .addContentSupplier(contentSupplierFake)\n                .addSuccessCallback(onSuccess)\n                .addBeforeSaveAndRenameCommand(beforeSaveAndRenameCommand)\n                .callSaveAndRename(message);\n\n        verify(beforeSaveAndRenameCommand, only()).execute();\n        verify(renameCaller, only()).call(isA(RemoteCallback.class),\n                                          isA(SaveAndRenameCommandBuilder.SaveAndRenameErrorCallback.class));\n        verify(service, only()).saveAndRename(eq(path),\n                                              eq(newFileName),\n                                              eq(metadata),\n                                              eq(content),\n                                              eq(commitMessage));\n    }\n\n    @Test\n    public void testOnSuccess() throws Exception {\n\n        final RenameInProgressEvent renameInProgressEvent = mock(RenameInProgressEvent.class);\n\n        doReturn(renameInProgressEvent).when(builder).makeRenameInProgressEvent();\n\n        builder\n                .addSuccessCallback(onSuccess)\n                .onSuccess()\n                .callback(path);\n\n        final InOrder inOrder = inOrder(onSuccess, builder);\n\n        inOrder.verify(builder).notifyRenameInProgress();\n        inOrder.verify(onSuccess).execute(path);\n        inOrder.verify(builder).hideRenamePopup();\n        inOrder.verify(builder).hideBusyIndicator();\n        inOrder.verify(builder).notifyItemRenamedSuccessfully();\n    }\n\n    @Test\n    public void testNotifyRenameInProgress() {\n\n        final RenameInProgressEvent event = mock(RenameInProgressEvent.class);\n\n        doReturn(event).when(builder).makeRenameInProgressEvent();\n\n        builder.notifyRenameInProgress();\n\n        verify(renameInProgressEvent).fire(event);\n    }\n\n    @Test\n    public void testMakeRenameInProgressEvent() {\n\n        final Path path = mock(Path.class);\n\n        doReturn(path).when(builder).getPath();\n\n        final RenameInProgressEvent event = builder.makeRenameInProgressEvent();\n\n        assertEquals(path, event.getPath());\n    }\n\n    @Test\n    public void testOnErrorWhenFileAlreadyExists() throws Exception {\n\n        final Message message = mock(Message.class);\n        final Throwable throwable = mock(Throwable.class);\n\n        doReturn(\"FileAlreadyExistsException\").when(throwable).getMessage();\n\n        final boolean error = builder\n                .addErrorCallback(onError)\n                .onError()\n                .error(message, throwable);\n\n        verify(busyIndicatorView).hideBusyIndicator();\n        verify(builder).handleDuplicatedFileName();\n        verify(onError, never()).execute();\n        verify(builder, never()).hideRenamePopup();\n\n        assertFalse(error);\n    }\n\n    @Test\n    public void testOnErrorWhenFileDoesNotExist() throws Exception {\n\n        final Message message = mock(Message.class);\n        final Throwable throwable = mock(Throwable.class);\n        final SaveAndRenameCommandBuilder.SaveAndRenameErrorCallback onSaveAndRenameError = builder.addErrorCallback(onError).onError();\n        final SaveAndRenameCommandBuilder.SaveAndRenameErrorCallback onErrorSpy = spy(onSaveAndRenameError);\n\n        doReturn(\"\").when(throwable).getMessage();\n        doReturn(true).when(onErrorSpy).callSuper(message, throwable);\n\n        final boolean error = onErrorSpy.error(message, throwable);\n\n        verify(onError).execute();\n        verify(builder).hideRenamePopup();\n        verify(busyIndicatorView, never()).hideBusyIndicator();\n        verify(builder, never()).handleDuplicatedFileName();\n\n        assertTrue(error);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-commons-editor/uberfire-commons-editor-client/src/test/java/org/uberfire/ext/editor/commons/client/template/mustache/ClientMustacheTemplateRendererTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.editor.commons.client.template.mustache;\n\nimport java.util.function.Function;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport com.google.gwt.resources.client.TextResource;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ClientMustacheTemplateRendererTest {\n\n    private ClientMustacheTemplateRenderer tested;\n\n    @Mock\n    private MustacheSource mustacheSource;\n\n    @Mock\n    private ScriptInjector.FromString script;\n\n    @Mock\n    private TextResource source;\n\n    private final String SOURCE_TXT = \"source\";\n\n    @Mock\n    private Function<String, ScriptInjector.FromString> injector;\n\n    @Before\n    public void setUp() throws Exception {\n        tested = new ClientMustacheTemplateRenderer(() -> mustacheSource, injector);\n        when(mustacheSource.mustache()).thenReturn(source);\n        when(source.getText()).thenReturn(SOURCE_TXT);\n        when(injector.apply(SOURCE_TXT)).thenReturn(script);\n        when(script.setWindow(any())).thenReturn(script);\n        when(script.setRemoveTag(anyBoolean())).thenReturn(script);\n    }\n\n    @Test\n    public void init() {\n        tested.init();\n        verify(source).getText();\n        verify(injector).apply(SOURCE_TXT);\n        verify(script).setWindow(ScriptInjector.TOP_WINDOW);\n        verify(script).setRemoveTag(false);\n        verify(script).inject();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-layout-editor</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Layout Editor</name>\n\n  <modules>\n    <module>uberfire-layout-editor-api</module>\n    <module>uberfire-layout-editor-backend</module>\n    <module>uberfire-layout-editor-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-layout-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-layout-editor-api</artifactId>\n\n  <name>Uberfire Layout Editor API</name>\n  <description>Uberfire Layout Editor API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n  </build>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/LayoutServices.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n@Remote\npublic interface LayoutServices {\n\n    String convertLayoutToString(LayoutTemplate layoutTemplate);\n\n    LayoutTemplate convertLayoutFromString(String layoutEditorModel);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/PerspectiveServices.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.model.Plugin;\n\n@Remote\npublic interface PerspectiveServices extends SupportsCopy,\n                                             SupportsDelete,\n                                             SupportsSaveAndRename<LayoutTemplate, DefaultMetadata> {\n\n    Plugin createNewPerspective(String name, LayoutTemplate.Style style);\n\n    Collection<LayoutTemplate> listLayoutTemplates();\n\n    LayoutTemplate getLayoutTemplate(String perspectiveName);\n\n    LayoutTemplate getLayoutTemplate(Path perspectivePath);\n\n    LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin);\n\n    LayoutTemplate convertToLayoutTemplate(String layoutModel);\n\n    Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssAlignment.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS alignment codes\n */\npublic enum CssAlignment implements CssAllowedValue {\n\n    LEFT,\n    CENTER,\n    RIGHT;\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssAllowedValue.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS alignment codes\n */\npublic interface CssAllowedValue {\n\n    default String getName() {\n        return this.toString().toLowerCase().replace('_', '-');\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssColour.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS colours available\n */\npublic enum CssColour {\n\n    blue,\n    red;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssFloat.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS float codes\n */\npublic enum CssFloat implements CssAllowedValue {\n\n    NONE,\n    LEFT,\n    RIGHT,\n    INITIAL,\n    INHERIT\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssFontSize.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS \"font-size\" codes\n */\npublic enum CssFontSize implements CssAllowedValue {\n\n    XX_SMALL,\n    X_SMALL,\n    SMALL,\n    MEDIUM,\n    LARGE,\n    X_LARGE,\n    XX_LARGE;\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssFontWeight.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS \"font-weight\" codes\n */\npublic enum CssFontWeight implements CssAllowedValue {\n\n    NORMAL,\n    BOLD,\n    BOLDER,\n    LIGHTER,\n    WEIGHT_100,\n    WEIGHT_200,\n    WEIGHT_300,\n    WEIGHT_400,\n    WEIGHT_500,\n    WEIGHT_600,\n    WEIGHT_700,\n    WEIGHT_800,\n    WEIGHT_900;\n\n    @Override\n    public String getName() {\n        if (name().startsWith(\"WEIGHT_\")) {\n            return name().substring(7).toLowerCase();\n        }\n        return this.toString().toLowerCase();\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssProperty.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport static org.uberfire.ext.layout.editor.api.css.CssValueType.*;\nimport static org.uberfire.ext.layout.editor.api.css.CssAlignment.*;\nimport static org.uberfire.ext.layout.editor.api.css.CssFloat.INHERIT;\nimport static org.uberfire.ext.layout.editor.api.css.CssFloat.INITIAL;\nimport static org.uberfire.ext.layout.editor.api.css.CssTextDecoration.*;\nimport static org.uberfire.ext.layout.editor.api.css.CssFontWeight.*;\nimport static org.uberfire.ext.layout.editor.api.css.CssFontSize.*;\n\n/**\n * A CSS property definition including what value types are supported and what is the list of allowed values available\n * by default (if any).\n *\n * <p>For example, the \"color\" property {@link #supportedValueTypes} is {@link CssValueType#COLOR}\n * and its {@link #allowedValues} is the entire list of {@link CssColour} entries.</p>\n *\n * <p>On the other hand, the \"width\" property {@link #supportedValueTypes} are {@link CssValueType#LENGTH} and {@link CssValueType#PERCENTAGE}\n * and its {@link #allowedValues} are \"auto\" or \"inherit\". That means the following values are all considered valid:\n * \"100px\", \"auto\", \"50%\".\n */\npublic enum CssProperty {\n\n    WIDTH(LENGTH, PERCENTAGE),\n    HEIGHT(LENGTH, PERCENTAGE),\n\n    BACKGROUND_COLOR(CssValueType.COLOR),\n\n    MARGIN_TOP(LENGTH),\n    MARGIN_BOTTOM(LENGTH),\n    MARGIN_LEFT(LENGTH),\n    MARGIN_RIGHT(LENGTH),\n\n    PADDING_TOP(LENGTH),\n    PADDING_BOTTOM(LENGTH),\n    PADDING_LEFT(LENGTH),\n    PADDING_RIGHT(LENGTH),\n\n    FLOAT(NONE, LEFT, RIGHT, INITIAL, INHERIT),\n    TEXT_ALIGN(LEFT, CENTER, RIGHT),\n    TEXT_DECORATION(NONE, UNDERLINE, OVERLINE, LINE_THROUGH),\n    COLOR(CssValueType.COLOR),\n\n    FONT_SIZE(XX_SMALL, X_SMALL, SMALL, MEDIUM, LARGE, X_LARGE, XX_LARGE),\n    FONT_WEIGHT(NORMAL, BOLDER, LIGHTER);\n\n    private List<CssAllowedValue> allowedValues = new ArrayList<>();\n    private List<CssValueType> supportedValueTypes = new ArrayList<>();\n\n    private static List<String> ALL_NAMES = Arrays.stream(CssProperty.values())\n                                                  .map(CssProperty::getName)\n                                                  .collect(Collectors.toList());\n\n    CssProperty(CssValueType... supportedTypes) {\n        for (CssValueType supportedValueType : supportedTypes) {\n            supportedValueTypes.add(supportedValueType);\n        }\n    }\n\n    CssProperty(CssAllowedValue... allowedValues) {\n        for (CssAllowedValue value : allowedValues) {\n            this.allowedValues.add(value);\n        }\n    }\n\n    CssProperty(List<CssAllowedValue> allowedValues, CssValueType... supportedValueTypes) {\n        this(supportedValueTypes);\n        this.allowedValues = allowedValues;\n    }\n\n    public String getName() {\n        return this.toString().toLowerCase().replace('_', '-');\n    }\n\n    public static CssProperty get(String property) {\n        if (ALL_NAMES.contains(property)) {\n            return valueOf(property.toUpperCase().replace('-', '_'));\n        }\n        return null;\n    }\n\n    public List<CssAllowedValue> getAllowedValues() {\n        return allowedValues;\n    }\n\n    public boolean supportsValueType(CssValueType type) {\n        return supportedValueTypes.contains(type);\n    }\n\n    public List<CssValueType> getSupportedValueTypes() {\n        return supportedValueTypes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssRule.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\nimport java.util.ArrayList;\n\n/**\n * A CSS rule\n */\npublic class CssRule extends ArrayList<CssValue> {\n\n    private String selector;\n\n    public CssRule(String selector) {\n        super();\n        this.selector = selector;\n    }\n\n    public String getSelector() {\n        return selector;\n    }\n\n    public CssValue setValue(CssProperty property, String value) {\n        CssValue cssValue = getValue(property);\n        if (cssValue == null) {\n            if (value != null && value.length() > 0) {\n                cssValue = new CssValue(property.getName(), value);\n                this.add(cssValue);\n                return cssValue;\n            }\n            return null;\n        }\n        else {\n            if (value != null && value.length() > 0) {\n                cssValue.setValue(value);\n                return cssValue;\n            } else {\n                this.remove(cssValue);\n                return null;\n            }\n        }\n    }\n\n    public CssValue getValue(CssProperty property) {\n        for (CssValue cssValue : this) {\n            if (cssValue.getProperty().equals(property.getName())) {\n                return cssValue;\n            }\n        }\n        return null;\n    }\n\n    public CssRule readValues(String ruleString) {\n        this.clear();\n        if (ruleString != null && ruleString.length() > 0) {\n            for (String valuePair : ruleString.split(\";\")) {\n                CssValue cssValue = new CssValue().readPair(valuePair);\n                this.add(cssValue);\n            }\n        }\n        return this;\n    }\n\n    public String formatValues() {\n        StringBuilder out = new StringBuilder();\n        forEach(item -> out.append(item.getProperty()).append(\":\").append(item.getValue()).append(\";\"));\n        return out.toString();\n    }\n\n    public String toString() {\n        StringBuffer out = new StringBuffer(selector);\n        out.append(\" {\\n\");\n        this.forEach(v -> out.append(\"  \").append(v.getProperty()).append(\":\").append(v.getValue()).append(\";\\n\"));\n        out.append(\"}\");\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssRuleList.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\nimport java.util.ArrayList;\nimport java.util.stream.Collectors;\n\n/**\n * A list of CSS rules\n */\npublic class CssRuleList extends ArrayList<CssRule> {\n\n    public CssRule addValue(String selector, CssValue value) {\n        CssRule rule = getRule(selector);\n\n        if (rule == null) {\n            rule = new CssRule(selector);\n            this.add(rule);\n        }\n        rule.add(value);\n        return rule;\n    }\n\n    public CssRule getRule(String selector) {\n        for (CssRule rule : this) {\n            if (rule.getSelector().equals(selector)) {\n                return rule;\n            }\n        }\n        return null;\n    }\n\n    public String toString() {\n        StringBuffer out = new StringBuffer();\n        forEach(rule -> out.append(rule.toString()).append(\"\\n\"));\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssTextDecoration.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * An enumeration of the CSS \"text-decoration\" allowed values\n */\npublic enum CssTextDecoration implements CssAllowedValue {\n\n    NONE,\n    UNDERLINE,\n    OVERLINE,\n    LINE_THROUGH,\n    BLINK;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssValue.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\npublic class CssValue {\n\n    private String property;\n    private String value;\n\n    public CssValue() {\n    }\n\n    public CssValue(String property, String value) {\n        this.property = property;\n        this.value = value;\n    }\n\n    public String getProperty() {\n        return property;\n    }\n\n    public String getPropertyInCamelCase() {\n        StringBuilder out = new StringBuilder();\n        int i = 0;\n        while (i<property.length()) {\n            String ch = property.substring(i, i+1);\n            if (ch.equals(\"-\") && i<property.length()-1) {\n                ch = property.substring(++i, i+1);\n                out.append(ch.toUpperCase());\n            } else {\n                out.append(ch);\n            }\n            i++;\n        }\n        return out.toString();\n    }\n\n    public String getValue() {\n        return value;\n    }\n\n    public void setValue(String value) {\n        this.value = value;\n    }\n\n    public CssValue readPair(String valuePair) {\n        int idx = valuePair.indexOf(\":\");\n        if (idx > 0) {\n            property = valuePair.substring(0, idx).trim();\n            value = valuePair.substring(idx+1).trim();\n        }\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/css/CssValueType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\n/**\n * Enumeration of the different value types supported by a {@link org.uberfire.ext.layout.editor.api.css.CssProperty}.\n */\npublic enum CssValueType {\n\n    TEXT,\n    LENGTH,     // e.g: \"100px\", \"50em\", \"30in\"\n    PERCENTAGE, // e.g: \"50%\" ,\n    NUMBER,     // e.g: \"1.2\"\n    COLOR,     // e.g: \"#FFFFFF\", \"white\"\n    URI;        // e.g: \"http://host/image.png\"\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutColumn.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LayoutColumn {\n\n    public static final String DEFAULT_COLUMN_HEIGHT = \"12\";\n    private String span;\n    private String height;\n    private Map<String,String> properties = new HashMap<>();\n    private List<LayoutRow> rows = new ArrayList<>();\n    private List<LayoutComponent> layoutComponents = new ArrayList<>();\n\n    public LayoutColumn(String span) {\n        this.span = span;\n        this.height = DEFAULT_COLUMN_HEIGHT;\n    }\n\n    public LayoutColumn(@MapsTo(\"span\") String span,\n                        @MapsTo(\"height\") String height,\n                        @MapsTo(\"properties\") Map<String,String> properties) {\n        this.span = span;\n        this.height = height;\n        this.properties = properties;\n    }\n\n    public void addRow(LayoutRow layoutRow) {\n        rows.add(layoutRow);\n    }\n\n    public void add(LayoutComponent layoutComponent) {\n        layoutComponents.add(layoutComponent);\n    }\n\n    public String getSpan() {\n        return span;\n    }\n\n    public List<LayoutRow> getRows() {\n        return rows;\n    }\n\n    public String getHeight() {\n        return height;\n    }\n\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    public List<LayoutComponent> getLayoutComponents() {\n        return layoutComponents;\n    }\n\n    public boolean hasElements() {\n        return !rows.isEmpty() || !layoutComponents.isEmpty();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof LayoutColumn)) {\n            return false;\n        }\n\n        LayoutColumn that = (LayoutColumn) o;\n\n        if (span != null ? !span.equals(that.span) : that.span != null) {\n            return false;\n        }\n        if (rows != null ? !rows.equals(that.rows) : that.rows != null) {\n            return false;\n        }\n        return !(layoutComponents != null ? !layoutComponents.equals(that.layoutComponents) : that.layoutComponents != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = span != null ? span.hashCode() : 0;\n        result = 31 * result + (rows != null ? rows.hashCode() : 0);\n        result = 31 * result + (layoutComponents != null ? layoutComponents.hashCode() : 0);\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutColumn{\" +\n                \"span='\" + span + '\\'' +\n                \", rows=\" + rows +\n                \", layoutComponents=\" + layoutComponents +\n                '}';\n    }\n\n    public boolean hasRows() {\n        return !rows.isEmpty();\n    }\n\n    public boolean contains(LayoutComponent component) {\n        return layoutComponents.contains(component);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Predicate;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LayoutComponent {\n\n    private String dragTypeName;\n\n    private Map<String, String> properties = new HashMap<>();\n    \n    private List<LayoutComponentPart> parts = new ArrayList<>();\n    \n    public LayoutComponent() {\n    }\n\n    public LayoutComponent(String dragType) {\n        this.dragTypeName = dragType;\n    }\n\n    public String getDragTypeName() {\n        return dragTypeName;\n    }\n\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n    \n    public void addProperty(String key,\n                            String value) {\n        properties.put(key,\n                       value);\n    }\n    \n    public void addPartProperty(String partId, \n                                String key,\n                                String value) {\n        parts.stream().filter(p -> p.getPartId().equals(partId))\n                      .findFirst()\n                      .ifPresent(part -> part.addCssProperty(key, value));\n    }\n\n    public void addProperties(Map<String, String> properties) {\n        properties.forEach(this.properties::put);\n    }\n    \n    public void addPartProperties(String partId, Map<String, String> properties) {\n        parts.stream().filter(p -> p.getPartId().equals(partId))\n                      .findFirst()\n                      .ifPresent(part -> properties.forEach(part::addCssProperty));\n    }\n    \n    public void addPartIfAbsent(String partId) {\n        Optional<LayoutComponentPart> containsPart = parts.stream().filter(p -> p.getPartId()\n                                                                   .equals(partId)).findFirst();\n        if (!containsPart.isPresent()) {\n            parts.add(new LayoutComponentPart(partId));\n        }\n    }\n    \n    public void removePartIf(Predicate<String> condition) {\n        parts.removeIf(p -> condition.test(p.getPartId()));\n    }\n    \n    public List<LayoutComponentPart> getParts() {\n        return Collections.unmodifiableList(parts);\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = ~~result;\n        result = prime * result + ((dragTypeName == null) ? 0 : dragTypeName.hashCode());\n        result = ~~result;\n        result = prime * result + ((parts == null) ? 0 : parts.hashCode());\n        result = ~~result;\n        result = prime * result + ((properties == null) ? 0 : properties.hashCode());\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        LayoutComponent other = (LayoutComponent) obj;\n        if (dragTypeName == null) {\n            if (other.dragTypeName != null) {\n                return false;\n            }\n        } else if (!dragTypeName.equals(other.dragTypeName))\n            return false;\n        if (parts == null) {\n            if (other.parts != null) {\n                return false;\n            }\n        } else if (!parts.equals(other.parts)) {\n            return false;\n        }\n        if (properties == null) {\n            if (other.properties != null) {\n                return false;\n            }\n        } else if (!properties.equals(other.properties)) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutComponent [dragTypeName=\" + dragTypeName \n                                + \", properties=\" + properties \n                                + \", parts=\" + parts + \"]\";\n    }\n\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutComponentPart.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LayoutComponentPart {\n    \n    private String partId;\n    \n    private Map<String, String> cssProperties = new HashMap<>();\n\n    public LayoutComponentPart() {\n    }\n    \n    public LayoutComponentPart(String partId) {\n        this.partId = partId;\n    }\n    \n    public LayoutComponentPart(String partId, Map<String, String> properties) {\n        this.partId = partId;\n        this.cssProperties = properties;\n    }\n\n    public String getPartId() {\n        return partId;\n    }\n\n    public Map<String, String> getCssProperties() {\n        return cssProperties;\n    }\n    \n    public void clearCssProperties() {\n        cssProperties.clear();\n    }\n    \n    public void addCssProperty(String key, String value) {\n        cssProperties.put(key, value);\n    }\n\n    \n    public void removeCssProperty(String property) {\n        cssProperties.remove(property);\n        \n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = ~~result;\n        result = prime * result + ((partId == null) ? 0 : partId.hashCode());\n        result = ~~result;\n        result = prime * result + ((cssProperties == null) ? 0 : cssProperties.hashCode());\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        }\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        LayoutComponentPart other = (LayoutComponentPart) obj;\n        if (partId == null) {\n            if (other.partId != null) {\n                return false;\n            }\n        } else if (!partId.equals(other.partId)) {\n            return false;\n        }\n        if (cssProperties == null) {\n            if (other.cssProperties != null) {\n                return false;\n            }\n        } else if (!cssProperties.equals(other.cssProperties)) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutComponentPart [partId=\" + partId + \", properties=\" + cssProperties + \"]\";\n    }\n    \n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutInstance.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\n\npublic class LayoutInstance implements IsElement {\n\n    HTMLElement htmlElement;\n\n    public LayoutInstance(HTMLElement htmlElement) {\n        this.htmlElement = htmlElement;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return htmlElement;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutRow.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LayoutRow {\n\n    private String height;\n    private Map<String,String> properties = new HashMap<>();\n    private List<LayoutColumn> layoutColumns = new ArrayList<>();\n\n    public LayoutRow() {\n\n    }\n\n    public LayoutRow(@MapsTo(\"height\") String height,\n            @MapsTo(\"properties\") Map<String,String> properties) {\n        this.height = height;\n        this.properties = properties;\n    }\n\n    public List<LayoutColumn> getLayoutColumns() {\n        return layoutColumns;\n    }\n\n    public void add(List<LayoutColumn> layoutColumn) {\n        layoutColumns.addAll(layoutColumn);\n    }\n\n    public void add(LayoutColumn layoutColumn) {\n        layoutColumns.add(layoutColumn);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof LayoutRow)) {\n            return false;\n        }\n\n        LayoutRow layoutRow = (LayoutRow) o;\n\n        if (layoutColumns != null ? !layoutColumns.equals(layoutRow.layoutColumns) : layoutRow.layoutColumns != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    public String getHeight() {\n        return height;\n    }\n\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public int hashCode() {\n        return layoutColumns != null ? layoutColumns.hashCode() : 0;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutRow{\" +\n                \"layoutColumns=\" + layoutColumns +\n                '}';\n    }\n\n    public boolean contains(LayoutComponent component) {\n        for (LayoutColumn column : layoutColumns) {\n            if (column.contains(component)) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/java/org/uberfire/ext/layout/editor/api/editor/LayoutTemplate.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic final class LayoutTemplate {\n\n    private int version = 3;\n\n    private String name;\n\n    private Style style = Style.FLUID;\n\n    private Map<String, String> layoutProperties = new HashMap<>();\n\n    private List<LayoutRow> rows = new ArrayList<>();\n\n    public LayoutTemplate() {\n\n    }\n\n    public LayoutTemplate(String name) {\n        this.name = name;\n    }\n\n    public LayoutTemplate(String name, Style style) {\n        this.name = name;\n        this.style = style;\n    }\n\n    public LayoutTemplate(String layoutName,\n                          Map<String, String> properties,\n                          Style pageStyle) {\n        this.name = layoutName;\n        this.layoutProperties = properties;\n        this.style = pageStyle;\n    }\n\n    public int getVersion() {\n        return version;\n    }\n\n    public void addRow(LayoutRow layoutRow) {\n        rows.add(layoutRow);\n    }\n\n    public List<LayoutRow> getRows() {\n        return rows;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Map<String, String> getLayoutProperties() {\n        return layoutProperties;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof LayoutTemplate)) {\n            return false;\n        }\n\n        LayoutTemplate that = (LayoutTemplate) o;\n\n        if (name != null ? !name.equals(that.name) : that.name != null) {\n            return false;\n        }\n        if (layoutProperties != null ? !layoutProperties\n                .equals(that.layoutProperties) : that.layoutProperties != null) {\n            return false;\n        }\n        return !(rows != null ? !rows.equals(that.rows) : that.rows != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? name.hashCode() : 0;\n        result = 31 * result + (layoutProperties != null ? layoutProperties.hashCode() : 0);\n        result = 31 * result + (rows != null ? rows.hashCode() : 0);\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"LayoutTemplate{\" +\n                \"version=\" + version +\n                \", name='\" + name + '\\'' +\n                \", layoutProperties=\" + layoutProperties +\n                \", rows=\" + rows +\n                '}';\n    }\n\n    public void addLayoutProperty(String key,\n                                  String value) {\n        layoutProperties.put(key,\n                             value);\n    }\n\n    public boolean isEmpty() {\n        return rows.isEmpty();\n    }\n    \n    public boolean contains(LayoutComponent component) {\n        for (LayoutRow row : rows) {\n            if (row.contains(component)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public Style getStyle() {\n        return style;\n    }\n\n    public void setStyle(Style style) {\n        this.style = style;\n    }\n\n    public boolean isPageStyle() {\n        return Style.PAGE.equals(style);\n    }\n\n    @Portable\n    public enum Style {\n        PAGE,\n        FLUID;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/main/resources/org/uberfire/ext/layout/editor/UberfireLayoutEditorAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginAPI\"/>\n\n  <source path='api'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/test/org/uberfire/ext/layout/editor/api/css/CssRuleTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.css;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class CssRuleTest {\n\n    @Test\n    public void cssRuleTest() {\n        CssRule cssRule = new CssRule(\"#myId\");\n        cssRule.add(new CssValue(\"width\", \"100%\"));\n        cssRule.add(new CssValue(\"height\", \"50%\"));\n        String toString = cssRule.toString();\n\n        assertEquals(cssRule.getSelector(), \"#myId\");\n        assertEquals(cssRule.size(), 2);\n        assertEquals(cssRule.get(0).getProperty(), \"width\");\n        assertEquals(cssRule.get(0).getValue(), \"100%\");\n        assertEquals(cssRule.get(1).getProperty(), \"height\");\n        assertEquals(cssRule.get(1).getValue(), \"50%\");\n        assertEquals(toString, \"#myId {\\n  width:100%;\\n  height:50%;\\n}\");\n    }\n\n    @Test\n    public void cssPropertyCamelCase() {\n        CssValue cssValue = new CssValue(\"margin-top\", \"100px\");\n        assertEquals(\"marginTop\", cssValue.getPropertyInCamelCase());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-api/src/test/org/uberfire/ext/layout/editor/api/editor/LayoutTemplateTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.api.editor;\n\nimport static org.junit.Assert.assertTrue;\n\nimport org.junit.Test;\n\npublic class LayoutTemplateTest {\n    \n    @Test\n    public void layoutTemplateContainsTest() {\n        LayoutTemplate template = new LayoutTemplate();\n        \n        LayoutRow row = new LayoutRow();\n        \n        LayoutColumn column = new LayoutColumn(\"\");\n        \n        LayoutComponent component = new LayoutComponent(\"drag1\");\n        \n        LayoutComponent otherComponent = new LayoutComponent(\"drag2\");\n        \n        template.addRow(row);\n        row.add(column);\n        column.add(component);\n        \n        assertTrue(template.contains(component));\n        \n        assertTrue(!template.contains(otherComponent));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-layout-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-layout-editor-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Layout Editor Backend</name>\n  <description>Uberfire Layout Editor Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/LayoutServicesImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.ext.layout.editor.api.LayoutServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n@Service\n@ApplicationScoped\npublic class LayoutServicesImpl implements LayoutServices {\n\n    private Gson gson;\n\n    @PostConstruct\n    public void init() {\n        this.gson = new GsonBuilder().setPrettyPrinting().create();\n    }\n\n    @Override\n    public String convertLayoutToString(LayoutTemplate layoutTemplate) {\n        String layoutContent = gson.toJson(layoutTemplate);\n        return layoutContent;\n    }\n\n    @Override\n    public LayoutTemplate convertLayoutFromString(String layoutEditorModel) {\n        try {\n            if (needsUpgrade(layoutEditorModel)) {\n                throw new RuntimeException(\"not yet supported\");\n//                return LayoutUpgradeTool.convert( layoutEditorModel );\n            } else {\n                LayoutTemplate layoutTemplate = gson.fromJson(layoutEditorModel,\n                                                              LayoutTemplate.class);\n                return layoutTemplate;\n            }\n        } catch (Exception e) {\n            return new LayoutTemplate();\n        }\n    }\n\n    private boolean needsUpgrade(String layoutEditorModel) {\n        //return !version1( layoutEditorModel );\n        return false;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/PerspectiveServicesImpl.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl;\n\nimport java.util.Collection;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.backend.PluginServicesImpl;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.spaces.SpacesAPI;\n\n@Service\n@ApplicationScoped\npublic class PerspectiveServicesImpl implements PerspectiveServices {\n\n    private PluginServicesImpl pluginServices;\n    private LayoutServicesImpl layoutServices;\n    private SaveAndRenameServiceImpl<LayoutTemplate, DefaultMetadata> saveAndRenameService;\n\n    @Inject\n    public PerspectiveServicesImpl(final PluginServicesImpl pluginServices,\n                                   final LayoutServicesImpl layoutServices,\n                                   final SaveAndRenameServiceImpl<LayoutTemplate, DefaultMetadata> saveAndRenameService) {\n        this.pluginServices = pluginServices;\n        this.layoutServices = layoutServices;\n        this.saveAndRenameService = saveAndRenameService;\n    }\n\n    @PostConstruct\n    public void init() {\n        saveAndRenameService.init(this);\n    }\n\n    @Override\n    public Plugin createNewPerspective(String name, LayoutTemplate.Style style) {\n        Plugin perspectivePlugin = pluginServices.createNewPlugin(name, PluginType.PERSPECTIVE_LAYOUT);\n        LayoutTemplate layoutTemplate = new LayoutTemplate(name, style);\n        saveLayoutTemplate(perspectivePlugin.getPath(), layoutTemplate, \"Perspective '\" + name + \"' check-in\");\n        return perspectivePlugin;\n    }\n\n    @Override\n    public Collection<LayoutTemplate> listLayoutTemplates() {\n        return pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).stream()\n                .map(this::getLayoutTemplate)\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(String perspectiveName) {\n        Plugin perspectivePlugin = getLayoutTemplatePlugin(perspectiveName);\n        return perspectivePlugin != null ? getLayoutTemplate(perspectivePlugin) : null;\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(Path perspectivePath) {\n        LayoutEditorModel layoutEditorModel = pluginServices.getLayoutEditor(perspectivePath, PluginType.PERSPECTIVE_LAYOUT);\n        if (layoutEditorModel.isEmptyLayout()) {\n            return new LayoutTemplate(layoutEditorModel.getName(), LayoutTemplate.Style.PAGE);\n        }\n        return layoutServices.convertLayoutFromString(layoutEditorModel.getLayoutEditorModel());\n    }\n\n    @Override\n    public LayoutTemplate getLayoutTemplate(Plugin perspectivePlugin) {\n        return getLayoutTemplate(perspectivePlugin.getPath());\n    }\n\n    public Plugin getLayoutTemplatePlugin(String perspectiveName) {\n        if (perspectiveName == null) {\n            return null;\n        }\n        for (Plugin plugin : pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT)) {\n            if (PluginType.PERSPECTIVE_LAYOUT.equals(plugin.getType()) && plugin.getName().equals(perspectiveName)) {\n                return plugin;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public Path saveLayoutTemplate(Path perspectivePath, LayoutTemplate layoutTemplate, String commitMessage) {\n        String layoutModel = layoutServices.convertLayoutToString(layoutTemplate);\n        LayoutEditorModel plugin = new LayoutEditorModel(layoutTemplate.getName(), PluginType.PERSPECTIVE_LAYOUT, perspectivePath, layoutModel);\n        pluginServices.saveLayout(plugin, commitMessage);\n        return perspectivePath;\n    }\n\n    @Override\n    public LayoutTemplate convertToLayoutTemplate(String layoutModel) {\n        return layoutServices.convertLayoutFromString(layoutModel);\n    }\n\n    @Override\n    public Path copy(Path path, String newName, String comment) {\n        Path pathCopy = pluginServices.copy(path, newName, comment);\n        this.setLayoutTemplateName(pathCopy, newName, comment);\n        return pathCopy;\n    }\n\n    @Override\n    public Path copy(Path path, String newName, Path targetDirectory, String comment) {\n        Path pathCopy = pluginServices.copy(path, newName, targetDirectory, comment);\n        this.setLayoutTemplateName(pathCopy, newName, comment);\n        return pathCopy;\n    }\n\n    @Override\n    public Path rename(Path path, String newName, String comment) {\n        Path pathRenamed = pluginServices.rename(path, newName, comment);\n        this.setLayoutTemplateName(pathRenamed, newName, comment);\n        return pathRenamed;\n    }\n\n    @Override\n    public void delete(Path path, String comment) {\n        pluginServices.delete(path, comment);\n    }\n\n    private void setLayoutTemplateName(Path path, String newName, String comment) {\n        LayoutTemplate layoutTemplate = getLayoutTemplate(path);\n        layoutTemplate.setName(newName);\n\n        String layoutModel = layoutServices.convertLayoutToString(layoutTemplate);\n        LayoutEditorModel pluginCopy = new LayoutEditorModel(newName, PluginType.PERSPECTIVE_LAYOUT, path, layoutModel);\n        pluginServices.saveLayout(pluginCopy, comment);\n    }\n\n    @Override\n    public Path save(final Path path,\n                     final LayoutTemplate content,\n                     final DefaultMetadata metadata,\n                     final String comment) {\n        return saveLayoutTemplate(path, content, comment);\n    }\n\n    @Override\n    public Path saveAndRename(final Path path,\n                              final String newFileName,\n                              final DefaultMetadata metadata,\n                              final LayoutTemplate content,\n                              final String comment) {\n        return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/old/perspective/editor/ColumnEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl.old.perspective.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Deprecated\npublic class ColumnEditor {\n\n    private String span;\n\n    private List<RowEditor> rows = new ArrayList<RowEditor>();\n\n    private List<ScreenEditor> screens = new ArrayList<ScreenEditor>();\n\n    private List<HTMLEditor> htmls = new ArrayList<HTMLEditor>();\n\n    public ColumnEditor() {\n    }\n\n    public ColumnEditor(String span) {\n        this.span = span;\n    }\n\n    public void addRow(RowEditor rowEditor) {\n        rows.add(rowEditor);\n    }\n\n    public void addScreen(ScreenEditor screenEditor) {\n        screens.add(screenEditor);\n    }\n\n    public void addHTML(HTMLEditor htmlEditor) {\n        htmls.add(htmlEditor);\n    }\n\n    public String getSpan() {\n        return span;\n    }\n\n    public List<RowEditor> getRows() {\n        return rows;\n    }\n\n    public List<ScreenEditor> getScreens() {\n        return screens;\n    }\n\n    public List<HTMLEditor> getHtmls() {\n        return htmls;\n    }\n\n    public boolean hasElements() {\n        return !rows.isEmpty() || !screens.isEmpty() || !htmls.isEmpty();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof ColumnEditor)) {\n            return false;\n        }\n\n        ColumnEditor that = (ColumnEditor) o;\n\n        if (htmls != null ? !htmls.equals(that.htmls) : that.htmls != null) {\n            return false;\n        }\n        if (rows != null ? !rows.equals(that.rows) : that.rows != null) {\n            return false;\n        }\n        if (screens != null ? !screens.equals(that.screens) : that.screens != null) {\n            return false;\n        }\n        if (span != null ? !span.equals(that.span) : that.span != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = span != null ? span.hashCode() : 0;\n        result = 31 * result + (rows != null ? rows.hashCode() : 0);\n        result = 31 * result + (screens != null ? screens.hashCode() : 0);\n        result = 31 * result + (htmls != null ? htmls.hashCode() : 0);\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/old/perspective/editor/HTMLEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl.old.perspective.editor;\n\n@Deprecated\npublic class HTMLEditor {\n\n    private String htmlCode;\n\n    public HTMLEditor() {\n    }\n\n    public HTMLEditor(String htmlCode) {\n\n        this.htmlCode = htmlCode;\n    }\n\n    public String getHtmlCode() {\n        return htmlCode;\n    }\n\n    public void setHtmlCode(String htmlCode) {\n        this.htmlCode = htmlCode;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof HTMLEditor)) {\n            return false;\n        }\n\n        HTMLEditor that = (HTMLEditor) o;\n\n        if (htmlCode != null ? !htmlCode.equals(that.htmlCode) : that.htmlCode != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return htmlCode != null ? htmlCode.hashCode() : 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/old/perspective/editor/PerspectiveEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl.old.perspective.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Deprecated\npublic class PerspectiveEditor {\n\n    private String name;\n\n    private List<String> tags = new ArrayList<String>();\n\n    private List<RowEditor> rows = new ArrayList<RowEditor>();\n\n    public PerspectiveEditor(String name,\n                             List<String> tags) {\n\n        this.name = name;\n        this.tags = tags;\n    }\n\n    public PerspectiveEditor() {\n    }\n\n    public void addRow(RowEditor rowEditor) {\n        rows.add(rowEditor);\n    }\n\n    public List<RowEditor> getRows() {\n        return rows;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<String> getTags() {\n        return tags;\n    }\n\n    public boolean isAValidPerspective() {\n        return name != null;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? name.hashCode() : 0;\n        result = 31 * result + (tags != null ? tags.hashCode() : 0);\n        for (RowEditor row : rows) {\n            result = 31 * result + (row != null ? row.hashCode() : 0);\n        }\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PerspectiveEditor)) {\n            return false;\n        }\n\n        PerspectiveEditor that = (PerspectiveEditor) o;\n\n        if (name != null ? !name.equals(that.name) : that.name != null) {\n            return false;\n        }\n        if (rows != null ? !rows.equals(that.rows) : that.rows != null) {\n            return false;\n        }\n        if (tags != null ? !tags.equals(that.tags) : that.tags != null) {\n            return false;\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/old/perspective/editor/RowEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl.old.perspective.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Deprecated\npublic class RowEditor {\n\n    private List<String> rowSpam = new ArrayList<String>();\n\n    private List<ColumnEditor> columnEditors = new ArrayList<ColumnEditor>();\n\n    public RowEditor() {\n\n    }\n\n    public RowEditor(List<String> rowSpam) {\n        this.rowSpam = rowSpam;\n    }\n\n    public List<ColumnEditor> getColumnEditors() {\n        return columnEditors;\n    }\n\n    public void add(ColumnEditor columnEditor) {\n        columnEditors.add(columnEditor);\n    }\n\n    public List<String> getRowSpam() {\n        return rowSpam;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof RowEditor)) {\n            return false;\n        }\n\n        RowEditor rowEditor = (RowEditor) o;\n\n        if (columnEditors != null ? !columnEditors.equals(rowEditor.columnEditors) : rowEditor.columnEditors != null) {\n            return false;\n        }\n        if (rowSpam != null ? !rowSpam.equals(rowEditor.rowSpam) : rowEditor.rowSpam != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = rowSpam != null ? rowSpam.hashCode() : 0;\n        result = 31 * result + (columnEditors != null ? columnEditors.hashCode() : 0);\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/java/org/uberfire/ext/layout/editor/impl/old/perspective/editor/ScreenEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl.old.perspective.editor;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Deprecated\npublic class ScreenEditor {\n\n    public static final String PLACE_NAME_KEY = \"Place Name\";\n\n    private SCREEN_TYPE type = SCREEN_TYPE.DEFAULT;\n\n    private String externalComponentFQCN;\n\n    private Map<String, String> parameters = new HashMap<String, String>();\n\n    private Map<String, String> lastParametersSaved = new HashMap<String, String>();\n\n    public ScreenEditor() {\n    }\n\n    public Map<String, String> getParameters() {\n        return parameters;\n    }\n\n    public void addParameters(String key,\n                              String value) {\n        parameters.put(key,\n                       value);\n    }\n\n    public void removeParameter(final String key) {\n        parameters.remove(key);\n    }\n\n    public void setParameterValue(final String key,\n                                  final String value) {\n        parameters.put(key,\n                       value);\n    }\n\n    public String getPlaceName() {\n        return parameters.get(PLACE_NAME_KEY);\n    }\n\n    public void setPlaceName(String placeName) {\n        parameters.put(PLACE_NAME_KEY,\n                       placeName);\n    }\n\n    public void setType(SCREEN_TYPE type) {\n        this.type = type;\n    }\n\n    public boolean isAExternalComponent() {\n        return type == SCREEN_TYPE.EXTERNAL;\n    }\n\n    public void saveOriginalState() {\n        lastParametersSaved = new HashMap<String, String>();\n        for (String key : parameters.keySet()) {\n            lastParametersSaved.put(key,\n                                    parameters.get(key));\n        }\n    }\n\n    public void loadOriginalState() {\n        if (!lastParametersSaved.isEmpty()) {\n            parameters = new HashMap<String, String>();\n            for (String key : lastParametersSaved.keySet()) {\n                parameters.put(key,\n                               lastParametersSaved.get(key));\n            }\n        }\n    }\n\n    public String getExternalComponentFQCN() {\n        return externalComponentFQCN;\n    }\n\n    public void setExternalComponentFQCN(String externalComponentFQCN) {\n        this.externalComponentFQCN = externalComponentFQCN;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof ScreenEditor)) {\n            return false;\n        }\n\n        ScreenEditor that = (ScreenEditor) o;\n\n        if (externalComponentFQCN != null ? !externalComponentFQCN.equals(that.externalComponentFQCN) : that.externalComponentFQCN != null) {\n            return false;\n        }\n        if (parameters != null ? !parameters.equals(that.parameters) : that.parameters != null) {\n            return false;\n        }\n\n        if (type != that.type) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = type != null ? type.hashCode() : 0;\n        result = 31 * result + (externalComponentFQCN != null ? externalComponentFQCN.hashCode() : 0);\n        result = 31 * result + (parameters != null ? parameters.hashCode() : 0);\n        return result;\n    }\n\n    public enum SCREEN_TYPE {\n        DEFAULT,\n        EXTERNAL\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/java/org/uberfire/ext/layout/editor/impl/LayoutServicesImplTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl;\n\nimport java.io.IOException;\n\nimport org.apache.commons.io.IOUtils;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.junit.Assert.*;\n\npublic class LayoutServicesImplTest {\n\n    private LayoutServicesImpl layoutServices;\n\n    private static String loadSample(String file) {\n        try {\n            return IOUtils.toString(new LayoutServicesImplTest().getClass().getResourceAsStream(file),\n                                    \"UTF-8\");\n        } catch (IOException e) {\n            return \"\";\n        }\n    }\n\n    @Before\n    public void setup() {\n        layoutServices = new LayoutServicesImpl();\n        layoutServices.init();\n    }\n\n    @Test\n    public void layoutMarshaller12withHTMLComponent() {\n        String expected = loadSample(\"12withHTMLComponent.txt\");\n        LayoutTemplate template = layoutServices.convertLayoutFromString(expected);\n        String actual = layoutServices.convertLayoutToString(template);\n        assertEquals(expected,\n                     actual);\n    }\n\n    @Test\n    public void layoutMarshallerBigLayout() {\n        String expected = loadSample(\"BigLayout.txt\");\n        LayoutTemplate template = layoutServices.convertLayoutFromString(expected);\n        String actual = layoutServices.convertLayoutToString(template);\n        assertEquals(expected,\n                     actual);\n    }\n\n    @Test\n    public void layoutMarshallerSubColumns() {\n        String expected = loadSample(\"SubColumnsLayout.txt\");\n        LayoutTemplate template = layoutServices.convertLayoutFromString(expected);\n        String actual = layoutServices.convertLayoutToString(template);\n        assertEquals(expected,\n                     actual);\n    }\n    \n    @Test\n    public void layoutMarshallerComponentWithParts() {\n        String expected = loadSample(\"LayoutWithComponentWithParts.txt\");\n        LayoutTemplate template = layoutServices.convertLayoutFromString(expected);\n        String actual = layoutServices.convertLayoutToString(template);\n        assertEquals(expected,\n                     actual);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/java/org/uberfire/ext/layout/editor/impl/PerspectiveServicesImplTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.impl;\n\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.plugin.backend.PluginServicesImpl;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectiveServicesImplTest {\n\n    @Mock\n    PluginServicesImpl pluginServices;\n\n    @Mock\n    LayoutServicesImpl layoutServices;\n\n    @Mock\n    SaveAndRenameServiceImpl<LayoutTemplate, DefaultMetadata> saveAndRenameService;\n\n    @Mock\n    Path path;\n\n    @Mock\n    Path path2;\n\n    @Mock\n    DefaultMetadata metadata;\n\n    @Mock\n    Plugin plugin;\n\n    PerspectiveServicesImpl perspectiveServices;\n\n    @Before\n    public void setup() {\n        LayoutEditorModel layoutEditorModel = new LayoutEditorModel(\"layout\", PluginType.PERSPECTIVE_LAYOUT, path2, \"\").emptyLayout();\n\n        when(pluginServices.createNewPlugin(anyString(), any())).thenReturn(plugin);\n        when(plugin.getPath()).thenReturn(path);\n        when(plugin.getName()).thenReturn(\"plugin1\");\n        when(pluginServices.copy(any(), anyString(), anyString())).thenReturn(path2);\n        when(pluginServices.copy(any(), anyString(), any(), anyString())).thenReturn(path2);\n        when(pluginServices.rename(any(), anyString(), anyString())).thenReturn(path2);\n        when(pluginServices.getLayoutEditor(eq(path2), eq(PluginType.PERSPECTIVE_LAYOUT))).thenReturn(layoutEditorModel);\n\n        perspectiveServices = spy(new PerspectiveServicesImpl(pluginServices, layoutServices, saveAndRenameService));\n    }\n\n    @Test\n    public void testCreate() {\n        perspectiveServices.createNewPerspective(\"test\", LayoutTemplate.Style.FLUID);\n        ArgumentCaptor<LayoutEditorModel> arg1 = ArgumentCaptor.forClass(LayoutEditorModel.class);\n        verify(pluginServices).createNewPlugin(\"test\", PluginType.PERSPECTIVE_LAYOUT);\n        verify(pluginServices).saveLayout(arg1.capture(), eq(\"Perspective 'test' check-in\"));\n        LayoutEditorModel layoutEditorModel = arg1.getValue();\n        assertEquals(layoutEditorModel.getName(), \"test\");\n    }\n\n    @Test\n    public void testList() {\n        Plugin layoutPlugin = new Plugin(\"layout\", PluginType.PERSPECTIVE_LAYOUT, path2);\n        when(pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT))\n            .thenReturn(Collections.singletonList(layoutPlugin));\n\n        Collection<LayoutTemplate> layouts = perspectiveServices.listLayoutTemplates();\n        assertEquals(layouts.size(), 1);\n        LayoutTemplate layoutTemplate = layouts.iterator().next();\n        assertEquals(layoutTemplate.getName(), \"layout\");\n        verify(pluginServices).listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n    }\n\n    @Test\n    public void testSave() {\n        LayoutTemplate layoutTemplate = new LayoutTemplate(\"newName\");\n        Path savedPath = perspectiveServices.saveLayoutTemplate(path, layoutTemplate, \"save\");\n        assertEquals(savedPath, path);\n        ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class);\n        ArgumentCaptor<String> commitArg = ArgumentCaptor.forClass(String.class);\n        verify(pluginServices).saveLayout(layoutModelArg.capture(), commitArg.capture());\n\n        LayoutEditorModel layoutModelCopy = layoutModelArg.getValue();\n        assertEquals(layoutModelCopy.getName(), \"newName\");\n        assertEquals(commitArg.getValue(), \"save\");\n    }\n\n    @Test\n    public void testCopy() {\n        Path result = perspectiveServices.copy(path, \"newName\", \"\");\n        ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class);\n        verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString());\n        LayoutEditorModel layoutModelCopy = layoutModelArg.getValue();\n\n        assertEquals(layoutModelCopy.getName(), \"newName\");\n        assertEquals(layoutModelCopy.getPath(), result);\n    }\n\n    @Test\n    public void testCopyToTarget() {\n        Path result = perspectiveServices.copy(path, \"newName\", path2, \"\");\n        ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class);\n        verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString());\n        LayoutEditorModel layoutModelCopy = layoutModelArg.getValue();\n\n        assertEquals(layoutModelCopy.getName(), \"newName\");\n        assertEquals(layoutModelCopy.getPath(), result);\n        assertEquals(result, path2);\n    }\n\n    @Test\n    public void testRename() {\n        Path result = perspectiveServices.rename(path, \"newName\", \"\");\n        ArgumentCaptor<LayoutEditorModel> layoutModelArg = ArgumentCaptor.forClass(LayoutEditorModel.class);\n        verify(pluginServices).saveLayout(layoutModelArg.capture(), anyString());\n        LayoutEditorModel layoutModelCopy = layoutModelArg.getValue();\n\n        assertEquals(layoutModelCopy.getName(), \"newName\");\n        assertEquals(layoutModelCopy.getPath(), result);\n    }\n\n    @Test\n    public void testDelete() {\n        perspectiveServices.delete(path, \"\");\n        verify(pluginServices).delete(path, \"\");\n    }\n\n    @Test\n    public void testInit() {\n        perspectiveServices.init();\n\n        verify(saveAndRenameService).init(perspectiveServices);\n    }\n\n    @Test\n    public void testSaveFromSupportsUpdate() {\n\n        final String comment = \"comment\";\n        final LayoutTemplate content = new LayoutTemplate(\"name\");\n\n        perspectiveServices.save(path, content, metadata, comment);\n\n        verify(perspectiveServices).saveLayoutTemplate(path, content, comment);\n    }\n\n    @Test\n    public void testSaveAndRename() {\n\n        final String comment = \"comment\";\n        final String newFileName = \"newFileName\";\n        final LayoutTemplate content = new LayoutTemplate(\"name\");\n\n        perspectiveServices.saveAndRename(path, newFileName, metadata, content, comment);\n\n        verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);\n    }\n\n    @Test\n    public void testGetLayoutTemplate() {\n        LayoutTemplate layoutTemplate = perspectiveServices.getLayoutTemplate(path2);\n        verify(pluginServices).getLayoutEditor(path2, PluginType.PERSPECTIVE_LAYOUT);\n        assertTrue(layoutTemplate.getName().equals(\"layout\"));\n    }\n\n    @Test\n    public void testGetLayoutTemplatePlugin() {\n        Plugin retPlugin = perspectiveServices.getLayoutTemplatePlugin(plugin.getName());\n        verify(pluginServices).listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/12withHTMLComponent.txt",
    "content": "{\n  \"version\": 2,\n  \"name\": \"12withHTMLComponent\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"teste|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eyo\\u003c/h1\\u003e\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/BigLayout.txt",
    "content": "{\n  \"version\": 2,\n  \"name\": \"gsgdf\",\n  \"style\": \"FLUID\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"teste|\"\n  },\n  \"rows\": [\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eEder Tester\\u003c/h1\\u003e\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"WiresPaletteScreen\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"6\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eO\\u003c/h1\\u003e\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"6\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"welcome\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.dashbuilder.client.editor.DisplayerDragComponent\",\n              \"properties\": {\n                \"json\": \"{\\\"uuid\\\":\\\"gwt-uid-116\\\", \\\"type\\\":\\\"BARCHART\\\", \\\"subtype\\\":\\\"BAR\\\", \\\"general\\\":{\\\"title\\\":\\\"- New Displayer -\\\", \\\"visible\\\":\\\"false\\\"}, \\\"chart\\\":{\\\"width\\\":\\\"500\\\", \\\"height\\\":\\\"250\\\", \\\"margin\\\":{\\\"top\\\":\\\"10\\\", \\\"bottom\\\":\\\"40\\\", \\\"left\\\":\\\"100\\\", \\\"right\\\":\\\"50\\\"}, \\\"legend\\\":{\\\"show\\\":\\\"true\\\", \\\"position\\\":\\\"RIGHT\\\"}}, \\\"filter\\\":{\\\"enabled\\\":\\\"true\\\", \\\"selfapply\\\":\\\"false\\\", \\\"notification\\\":\\\"true\\\", \\\"listening\\\":\\\"true\\\"}, \\\"dataSet\\\":{\\\"column.0\\\":{\\\"id\\\":\\\"Country\\\", \\\"type\\\":\\\"LABEL\\\", \\\"values\\\":[\\\"United States\\\",\\\"China\\\",\\\"Japan\\\",\\\"Germany\\\",\\\"United Kingdom\\\",\\\"France\\\",\\\"Brazil\\\"]}, \\\"column.1\\\":{\\\"id\\\":\\\"GDP 2013\\\", \\\"type\\\":\\\"NUMBER\\\", \\\"values\\\":[\\\"16768100\\\",\\\"9240270\\\",\\\"4919563\\\",\\\"3730261\\\",\\\"2678455\\\",\\\"2806428\\\",\\\"2245673\\\"]}, \\\"column.2\\\":{\\\"id\\\":\\\"GDP 2014\\\", \\\"type\\\":\\\"NUMBER\\\", \\\"values\\\":[\\\"17418925\\\",\\\"1038080\\\",\\\"4616335\\\",\\\"3859547\\\",\\\"2945146\\\",\\\"2846889\\\",\\\"2353025\\\"]}}, \\\"columns\\\":[{\\\"id\\\":\\\"Country\\\", \\\"name\\\":\\\"Country\\\"},{\\\"id\\\":\\\"GDP 2013\\\", \\\"name\\\":\\\"2013\\\", \\\"pattern\\\":\\\"$ #,### M\\\"},{\\\"id\\\":\\\"GDP 2014\\\", \\\"name\\\":\\\"2014\\\", \\\"pattern\\\":\\\"$ #,### M\\\"}]}\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/DeprecatedComplexPerspectiveEditor.txt",
    "content": "{\n   \"name\": \"Complex\",\n   \"tags\": [\n            \"tg1\",\n            \"tg2\",\n            \"tg3\"\n          ],\n   \"rows\": [\n     {\n       \"rowSpam\": [\n         \"4\",\n         \"4\",\n         \"4\"\n       ],\n       \"columnEditors\": [\n         {\n           \"span\": \"4\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": [\n             {\n               \"htmlCode\": \"\\u003ch1\\u003eeder\\u003c/h1\\u003e\"\n             }\n           ]\n         },\n         {\n           \"span\": \"4\",\n           \"rows\": [],\n           \"screens\": [\n             {\n               \"type\": \"DEFAULT\",\n               \"parameters\": {\n                 \"Place Name\": \"screen1\"\n               },\n               \"lastParametersSaved\": {\n                 \"Place Name\": \"screen1\"\n               }\n             }\n           ],\n           \"htmls\": []\n         },\n         {\n                    \"span\": \"4\",\n                    \"rows\": [],\n                    \"screens\": [\n                      {\n                        \"type\": \"EXTERNAL\",\n                        \"parameters\": {\n                          \"Place Name\": \"screen2\"\n                        },\n                        \"lastParametersSaved\": {\n                          \"Place Name\": \"screen2\"\n                        }\n                      }\n                    ],\n                    \"htmls\": []\n          }\n       ]\n     }\n   ]\n }"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/DeprecatedEmptyPerspectiveEditor.txt",
    "content": " {\n   \"name\": \"Empty\",\n   \"tags\": [],\n   \"rows\": [\n     {\n       \"rowSpam\": [\n         \"12\"\n       ],\n       \"columnEditors\": [\n         {\n           \"span\": \"12\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         }\n       ]\n     }\n   ]\n }"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/DeprecatedMoreColumnsPerspectiveEditor.txt",
    "content": "{\n   \"name\": \"23\",\n   \"tags\": [],\n   \"rows\": [\n     {\n       \"rowSpam\": [\n         \"12\"\n       ],\n       \"columnEditors\": [\n         {\n           \"span\": \"12\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         }\n       ]\n     },\n     {\n       \"rowSpam\": [\n         \"6\",\n         \"6\"\n       ],\n       \"columnEditors\": [\n         {\n           \"span\": \"6\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         },\n         {\n           \"span\": \"6\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         }\n       ]\n     },\n     {\n       \"rowSpam\": [\n         \"4\",\n         \"4\",\n         \"4\"\n       ],\n       \"columnEditors\": [\n         {\n           \"span\": \"4\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         },\n         {\n           \"span\": \"4\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         },\n         {\n           \"span\": \"4\",\n           \"rows\": [],\n           \"screens\": [],\n           \"htmls\": []\n         }\n       ]\n     }\n   ]\n }"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/LayoutWithComponentWithParts.txt",
    "content": "{\n  \"version\": 3,\n  \"name\": \"LayoutWithComponentWithParts\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"teste|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eyo\\u003c/h1\\u003e\"\n              },\n              \"parts\": [\n                {\n                  \"partId\": \"TEST\",\n                  \"cssProperties\": {\n                    \"prop1\": \"val1\"\n                  }\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-backend/src/test/resources/org/uberfire/ext/layout/editor/impl/SubColumnsLayout.txt",
    "content": "{\n  \"version\": 1,\n  \"name\": \"gsgdf\",\n  \"style\": \"FLUID\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"teste|\"\n  },\n  \"rows\": [\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eEder Tester\\u003c/h1\\u003e\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"WiresPaletteScreen\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"6\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"\\u003ch1\\u003eO\\u003c/h1\\u003e\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"6\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"welcome\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.dashbuilder.client.editor.DisplayerDragComponent\",\n              \"properties\": {\n                \"json\": \"{\\\"uuid\\\":\\\"gwt-uid-116\\\", \\\"type\\\":\\\"BARCHART\\\", \\\"subtype\\\":\\\"BAR\\\", \\\"general\\\":{\\\"title\\\":\\\"- New Displayer -\\\", \\\"visible\\\":\\\"false\\\"}, \\\"chart\\\":{\\\"width\\\":\\\"500\\\", \\\"height\\\":\\\"250\\\", \\\"margin\\\":{\\\"top\\\":\\\"10\\\", \\\"bottom\\\":\\\"40\\\", \\\"left\\\":\\\"100\\\", \\\"right\\\":\\\"50\\\"}, \\\"legend\\\":{\\\"show\\\":\\\"true\\\", \\\"position\\\":\\\"RIGHT\\\"}}, \\\"filter\\\":{\\\"enabled\\\":\\\"true\\\", \\\"selfapply\\\":\\\"false\\\", \\\"notification\\\":\\\"true\\\", \\\"listening\\\":\\\"true\\\"}, \\\"dataSet\\\":{\\\"column.0\\\":{\\\"id\\\":\\\"Country\\\", \\\"type\\\":\\\"LABEL\\\", \\\"values\\\":[\\\"United States\\\",\\\"China\\\",\\\"Japan\\\",\\\"Germany\\\",\\\"United Kingdom\\\",\\\"France\\\",\\\"Brazil\\\"]}, \\\"column.1\\\":{\\\"id\\\":\\\"GDP 2013\\\", \\\"type\\\":\\\"NUMBER\\\", \\\"values\\\":[\\\"16768100\\\",\\\"9240270\\\",\\\"4919563\\\",\\\"3730261\\\",\\\"2678455\\\",\\\"2806428\\\",\\\"2245673\\\"]}, \\\"column.2\\\":{\\\"id\\\":\\\"GDP 2014\\\", \\\"type\\\":\\\"NUMBER\\\", \\\"values\\\":[\\\"17418925\\\",\\\"1038080\\\",\\\"4616335\\\",\\\"3859547\\\",\\\"2945146\\\",\\\"2846889\\\",\\\"2353025\\\"]}}, \\\"columns\\\":[{\\\"id\\\":\\\"Country\\\", \\\"name\\\":\\\"Country\\\"},{\\\"id\\\":\\\"GDP 2013\\\", \\\"name\\\":\\\"2013\\\", \\\"pattern\\\":\\\"$ #,### M\\\"},{\\\"id\\\":\\\"GDP 2014\\\", \\\"name\\\":\\\"2014\\\", \\\"pattern\\\":\\\"$ #,### M\\\"}]}\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-layout-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-layout-editor-client</artifactId>\n\n  <name>Uberfire Layout Editor Client</name>\n  <description>Uberfire Layout Editor Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <!-- test -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n  </build>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutComponentPaletteScreen.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPalettePresenter;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = LayoutComponentPaletteScreen.SCREEN_ID)\npublic class LayoutComponentPaletteScreen {\n\n    public static final String SCREEN_ID = \"LavoutComponentPaletteScreen\";\n\n    private LayoutComponentPalettePresenter componentPalette;\n\n    public LayoutComponentPaletteScreen() {\n    }\n\n    @Inject\n    public LayoutComponentPaletteScreen(LayoutComponentPalettePresenter componentPalette) {\n        this.componentPalette = componentPalette;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CommonConstants.INSTANCE.Components();\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return componentPalette.getView();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.ext.layout.editor.client.resources.WebAppResource;\n\n@EntryPoint\npublic class LayoutEditorEntryPoint {\n\n    @PostConstruct\n    public void init() {\n        WebAppResource.INSTANCE.CSS().ensureInjected();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorPluginImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorPlugin;\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementVisitor;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class LayoutEditorPluginImpl implements LayoutEditorPlugin {\n\n    @Inject\n    private LayoutEditorPresenter layoutEditorPresenter;\n\n    @Inject\n    private Caller<PerspectiveServices> perspectiveServices;\n\n    @Inject\n    private SavePopUpPresenter savePopUpPresenter;\n\n    private String pluginName;\n    private String emptyTitleText;\n    private String emptySubTitleText;\n\n    private boolean locked = false;\n\n    @PostConstruct\n    public void setup() {\n        layoutEditorPresenter.setup(this::isLocked);\n    }\n\n    @Override\n    public void init(String layoutName,\n                     String emptyTitleText,\n                     String emptySubTitleText,\n                     LayoutTemplate.Style style) {\n        this.pluginName = layoutName;\n        this.emptyTitleText = emptyTitleText;\n        this.emptySubTitleText = emptySubTitleText;\n        layoutEditorPresenter.setPageStyle(style);\n    }\n\n    @Override\n    public void clear() {\n        layoutEditorPresenter.clear();\n    }\n\n    @Override\n    public Widget asWidget() {\n        final UberElement<LayoutEditorPresenter> view = layoutEditorPresenter.getView();\n        return ElementWrapperWidget.getWidget(view.getElement());\n    }\n\n    @Override\n    public void loadLayout(LayoutTemplate layoutTemplate) {\n        layoutEditorPresenter.loadLayout(layoutTemplate,\n                                         emptyTitleText,\n                                         emptySubTitleText);\n    }\n\n    @Override\n    public void loadDefaultLayout(String layoutName) {\n        layoutEditorPresenter.loadEmptyLayout(layoutName,\n                                              emptyTitleText,\n                                              emptySubTitleText);\n    }\n\n    @Override\n    public LayoutTemplate getLayout() {\n        return layoutEditorPresenter.getLayout();\n    }\n\n    @Override\n    public void addLayoutProperty(String key,\n                                  String value) {\n        layoutEditorPresenter.addLayoutProperty(key,\n                                                value);\n    }\n\n    @Override\n    public String getLayoutProperty(String key) {\n        return layoutEditorPresenter.getLayoutProperty(key);\n    }\n\n    @Override\n    public void setPreviewEnabled(boolean enabled) {\n        layoutEditorPresenter.setPreviewEnabled(enabled);\n    }\n\n    @Override\n    public void setElementSelectionEnabled(boolean enabled) {\n        layoutEditorPresenter.setElementSelectionEnabled(enabled);\n    }\n\n    @Override\n    public void load(Path currentPath,\n                     Command loadCallBack) {\n\n        perspectiveServices.call((LayoutTemplate layoutTemplate) -> {\n            if (layoutTemplate != null) {\n                layoutEditorPresenter.loadLayout(layoutTemplate,\n                        emptyTitleText,\n                        emptySubTitleText);\n                loadCallBack.execute();\n            } else {\n                layoutEditorPresenter\n                        .loadEmptyLayout(pluginName,\n                                emptyTitleText,\n                                emptySubTitleText);\n            }\n\n        }).getLayoutTemplate(currentPath);\n    }\n\n    @Override\n    public void save(final Path path,\n                     final RemoteCallback<Path> saveSuccessCallback) {\n\n        savePopUpPresenter.show(path, commitMessage -> {\n            LayoutTemplate layoutTemplate = getLayout();\n            perspectiveServices.call(saveSuccessCallback)\n                    .saveLayoutTemplate(path, layoutTemplate, commitMessage);\n        });\n    }\n\n    @Override\n    public List<LayoutEditorElement> getLayoutElements() {\n        return layoutEditorPresenter.getLayoutElements();\n    }\n\n    @Override\n    public void visit(LayoutElementVisitor visitor) {\n        layoutEditorPresenter.visit(visitor);\n    }\n\n    public boolean isLocked() {\n        return locked;\n    }\n\n    @Override\n    public void lock() {\n        locked = true;\n    }\n\n    @Override\n    public void unlock() {\n        locked = false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementVisitor;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementClearAllPropertiesEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementPropertyChangedEvent;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Supplier;\n\n@Dependent\npublic class LayoutEditorPresenter {\n\n    private final View view;\n    private LayoutTemplate.Style pageStyle = LayoutTemplate.Style.FLUID;\n    private Container container;\n    private LayoutGenerator layoutGenerator;\n    private boolean preview = false;\n\n    @Inject\n    public LayoutEditorPresenter(final View view,\n                                 Container container,\n                                 LayoutGenerator layoutGenerator) {\n        this.view = view;\n        this.container = container;\n        this.layoutGenerator = layoutGenerator;\n        view.init(this);\n    }\n\n    public void setup(Supplier<Boolean> lockSupplier) {\n        container.setLockSupplier(lockSupplier);\n    }\n\n    @PostConstruct\n    public void initNew() {\n        view.setupDesign(container.getView());\n        view.setPreviewEnabled(false);\n    }\n\n    public void setPreviewEnabled(boolean previewEnabled) {\n        view.setPreviewEnabled(previewEnabled);\n    }\n\n    public void setElementSelectionEnabled(boolean enabled) {\n        container.setSelectable(enabled);\n        container.visit(element -> element.setSelectable(enabled));\n    }\n\n    public void clear() {\n        container.reset();\n    }\n\n    public UberElement<LayoutEditorPresenter> getView() {\n        return view;\n    }\n\n    public LayoutTemplate getLayout() {\n        return container.toLayoutTemplate();\n    }\n\n    public void loadLayout(LayoutTemplate layoutTemplate,\n                           String emptyTitleText,\n                           String emptySubTitleText) {\n\n        view.setDesignStyle(layoutTemplate.getStyle());\n\n        container.load(layoutTemplate,\n                       emptyTitleText,\n                       emptySubTitleText);\n    }\n\n    public void loadEmptyLayout(String layoutName,\n                                String emptyTitleText,\n                                String emptySubTitleText) {\n        view.setDesignStyle(pageStyle);\n        container.loadEmptyLayout(layoutName,\n                                  pageStyle,\n                                  emptyTitleText,\n                                  emptySubTitleText);\n    }\n\n    public void addLayoutProperty(String key,\n                                  String value) {\n        container.addProperty(key,\n                              value);\n    }\n\n    public String getLayoutProperty(String key) {\n        return container.getProperty(key);\n    }\n\n\n    public void setPageStyle(LayoutTemplate.Style pageStyle) {\n        this.pageStyle = pageStyle;\n    }\n\n    public void switchToDesignMode() {\n        preview = false;\n        view.setupDesign(container.getView());\n    }\n\n    public void switchToPreviewMode() {\n        preview = true;\n        LayoutTemplate layoutTemplate = container.toLayoutTemplate();\n        LayoutInstance layoutInstance = layoutGenerator.build(layoutTemplate);\n        view.setupPreview(layoutInstance.getElement());\n    }\n\n    public List<LayoutEditorElement> getLayoutElements() {\n        List<LayoutEditorElement> result = new ArrayList<>();\n        container.visit(result::add);\n        return result;\n    }\n\n    public void visit(LayoutElementVisitor visitor) {\n        container.visit(visitor);\n    }\n\n    // Refresh the layout preview when the properties of a layout element change\n\n    protected void onLayoutPropertyChangedEvent(@Observes LayoutElementPropertyChangedEvent event) {\n        if (preview) {\n            switchToPreviewMode();\n        }\n    }\n\n    protected void onClearAllPropertiesEvent(@Observes LayoutElementClearAllPropertiesEvent event) {\n        if (preview) {\n            switchToPreviewMode();\n        }\n    }\n\n    public interface View extends UberElement<LayoutEditorPresenter> {\n\n        void setupDesign(UberElement<Container> container);\n\n        void setDesignStyle(LayoutTemplate.Style pageStyle);\n\n        void setPreviewEnabled(boolean previewEnabled);\n\n        void setupPreview(HTMLElement previewPanel);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorPropertiesScreen.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutEditorPropertiesPresenter;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = LayoutEditorPropertiesScreen.SCREEN_ID)\npublic class LayoutEditorPropertiesScreen {\n\n    public static final String SCREEN_ID = \"LayoutEditorPropertiesScreen\";\n\n    private LayoutEditorPropertiesPresenter propertiesPresenter;\n\n\n    public LayoutEditorPropertiesScreen() {\n    }\n\n    @Inject\n    public LayoutEditorPropertiesScreen(LayoutEditorPropertiesPresenter propertiesPresenter) {\n        this.propertiesPresenter = propertiesPresenter;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CommonConstants.INSTANCE.LayoutEditorProperties();\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return propertiesPresenter.getView();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorView.css",
    "content": ".el-container{\n    height: 100%;\n    padding: 0px 5px 0px 0px;\n}\n\n.le-component {\n    padding-top: 10px;\n    padding-left: 10px;\n    padding-right: 10px;\n    padding-bottom: 3px;\n\n    border: 0px !important;\n}\n\n.le-heading {\n    border: 1px !important;\n    border-style: solid !important;\n    border-color: #dddddd !important;\n\n    /*remove gradient*/\n    background: white !important;\n\n    -webkit-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    -moz-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;;\n    box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;;\n}\n\n.le-title {\n    font-family: \"Open Sans\";\n    font-size: 12px;\n}\n\n.le-icon {\n    font-size: 16px;\n    margin-left: 10px;\n    margin-right: 10px;\n}\n\n.le-dndcomponent {\n\n    background-color: rgba(204, 204, 204, 0.1);\n\n    height: 35px;\n\n    margin-left: 10px;\n    margin-top: 5px;\n    margin-bottom: 5px;\n\n    border: 1px solid #dddddd !important;\n\n    -webkit-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    -moz-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n\n    cursor: move;\n}\n.le-dndcomponent-selected{\n    box-shadow: 0 0 5px #b1caf2 !important;\n    border: 1px solid #b1caf2 !important;\n}\n\n.le-dndcomponent-inner {\n    /* align middle without need for table */\n    position: relative;\n    top: 50%;\n    -webkit-transform: translateY(-50%);\n    -ms-transform: translateY(-50%);\n    transform: translateY(-50%);\n}\n\n.le-design-fluid {\n    min-height: 100%;\n}\n\n.le-design-page {\n    height: 100%;\n}\n\n.le-design-container {\n    padding: 16px;\n    background: linear-gradient(#f6f6f6 18px, transparent 18px) 0 -2px, linear-gradient(90deg, #f6f6f6 18px, transparent 0px) -2px 0;\n    background-color: #bbbbbb;\n    background-size: 20px 20px;\n}\n\n.le-preview-container {\n    padding: 16px;\n    height: 100%;\n}\n\n.le-empty {\n    text-align: center;\n    background-color: rgba(244, 244, 244, 1);\n\n    padding-top: 75px;\n    padding-bottom: 100px;\n    padding-left: 100px;\n    padding-right: 100px;\n    height: 100%;\n}\n\n.le-empty-border {\n    border: 1px solid rgba(244, 244, 244, 1);\n}\n\n.le-empty-preview-drop {\n    border: 1px solid #b1caf2 !important;\n\n}\n.le-empty-inner-preview-drop{\n    opacity: 0.1;\n}\n\n.le-empty-icon {\n    font-size: 57.6px;\n    color: #9c9c9c;\n    line-height: 57.6px;\n}\n\n\n.le-kebab {\n    width: 10px;\n    float: right;\n    z-index: 10;\n}\n\n.le-kebab-dropdown {\n}\n\n.le-kebab-button {\n    color: #878787 !important;\n}\n\n.le-widget {\n    cursor: default;\n}\n\n.le-full-height{\n    height:100%;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorView.html",
    "content": "<div data-field=\"mainDiv\">\n    <div data-field=\"tabsDiv\">\n        <ul class=\"nav nav-tabs nav-tabs-pf\">\n            <li data-field=\"designTab\" class=\"active\" style=\"margin-left: 10px\"><a href=\"#\" data-field=\"designAnchor\">Editor!</a></li>\n            <li data-field=\"previewTab\"><a href=\"#\" data-field=\"previewAnchor\">Preview!</a></li>\n        </ul>\n    </div>\n    <div data-field=\"designDiv\" class=\"le-design-container\">\n        <div class=\"container-fluid el-container\">\n            <div class=\"row le-full-height\">\n                <div data-field=\"container\" class=\"col-md-12 le-full-height\">\n\n                </div>\n            </div>\n        </div>\n    </div>\n    <div data-field=\"previewDiv\" class=\"le-preview-container\">\n\n    </div>\n</div>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/LayoutEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\n\n@Templated\n@Dependent\npublic class LayoutEditorView\n        implements UberElement<LayoutEditorPresenter>,\n                   LayoutEditorPresenter.View,\n                   IsElement {\n\n    @Inject\n    @DataField\n    Div mainDiv;\n\n    @Inject\n    @DataField\n    Div container;\n\n    @Inject\n    @DataField\n    Div tabsDiv;\n\n    @Inject\n    @DataField\n    ListItem designTab;\n\n    @Inject\n    @DataField\n    ListItem previewTab;\n\n    @Inject\n    @DataField\n    Div designDiv;\n\n    @Inject\n    @DataField\n    Div previewDiv;\n\n    @Inject\n    @DataField\n    Anchor designAnchor;\n\n    @Inject\n    @DataField\n    Anchor previewAnchor;\n\n    private LayoutEditorPresenter presenter;\n\n    @Override\n    public void init(LayoutEditorPresenter presenter) {\n        this.presenter = presenter;\n        designAnchor.setTextContent(CommonConstants.INSTANCE.Editor());\n        previewAnchor.setTextContent(CommonConstants.INSTANCE.Preview());\n    }\n\n    @Override\n    public void setPreviewEnabled(boolean previewEnabled) {\n        tabsDiv.setHidden(!previewEnabled);\n        mainDiv.getStyle().setProperty(\"height\", previewEnabled ? \"95%\" : \"100%\");\n    }\n\n    @Override\n    public void setupDesign(UberElement<Container> container) {\n        designDiv.setHidden(false);\n        previewDiv.setHidden(true);\n        designTab.setClassName(\"active\");\n        previewTab.setClassName(\"\");\n        this.container.appendChild(container.getElement());\n    }\n\n    @Override\n    public void setDesignStyle(LayoutTemplate.Style pageStyle) {\n        designDiv.setClassName(\"le-design-container le-design-\" + pageStyle.toString().toLowerCase());\n    }\n\n    @Override\n    public void setupPreview(HTMLElement previewPanel) {\n        designDiv.setHidden(true);\n        previewDiv.setHidden(false);\n        designTab.setClassName(\"\");\n        previewTab.setClassName(\"active\");\n        DOMUtil.removeAllChildren(this.previewDiv);\n        this.previewDiv.appendChild(previewPanel);\n    }\n\n    @EventHandler(\"designTab\")\n    private void designTabClicked(ClickEvent event) {\n        if (!designTab.getClassName().equals(\"active\")) {\n            presenter.switchToDesignMode();\n        }\n    }\n\n    @EventHandler(\"previewTab\")\n    private void previewTabClicked(ClickEvent event) {\n        if (!previewTab.getClassName().equals(\"active\")) {\n            presenter.switchToPreviewMode();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/ComponentDropEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\npublic class ComponentDropEvent {\n\n    private LayoutComponent component;\n    private Boolean fromMove;\n\n    public ComponentDropEvent(LayoutComponent component) {\n        this.component = component;\n    }\n\n    public ComponentDropEvent(LayoutComponent component, Boolean fromMove) {\n\n        this.component = component;\n        this.fromMove = fromMove;\n    }\n\n    public LayoutComponent getComponent() {\n        return component;\n    }\n\n    public Boolean getFromMove() {\n        return fromMove;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/ComponentDropType.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\npublic enum ComponentDropType {\n    NEW,\n    FROM_MOVE\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/ComponentRemovedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\npublic class ComponentRemovedEvent {\n\n    private LayoutComponent layoutComponent;\n    private Boolean fromMove;\n\n    public ComponentRemovedEvent(LayoutComponent layoutComponent) {\n        this.layoutComponent = layoutComponent;\n    }\n\n    public ComponentRemovedEvent(LayoutComponent layoutComponent,\n                                 Boolean fromMove) {\n\n        this.layoutComponent = layoutComponent;\n        this.fromMove = fromMove;\n    }\n\n    public LayoutComponent getLayoutComponent() {\n        return layoutComponent;\n    }\n\n    public Boolean getFromMove() {\n        return fromMove;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/EditorWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.ComplexPanel;\n\npublic interface EditorWidget {\n\n    ComplexPanel getWidget();\n\n    EditorWidget getParent();\n\n    List<EditorWidget> getChildren();\n\n    void addChild(EditorWidget editorWidget);\n\n    void removeChild(EditorWidget editorWidget);\n\n    LayoutDragComponent getType();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/HasConfiguration.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\n/**\n * Configuration interface for layout drag components providing any type of configuration screen.\n * @see HasModalConfiguration\n */\npublic interface HasConfiguration {\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/HasDragAndDropSettings.java",
    "content": "/*\n* Copyright 2015 JBoss Inc\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*       http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.Map;\n\n/**\n * Interface to allow Drag & Drop Elements to have Default Setting that are going to be shared on the Drag & Drop\n * events\n */\npublic interface HasDragAndDropSettings {\n\n    String[] getSettingsKeys();\n\n    String getSettingValue(String key);\n\n    void setSettingValue(String key,\n                         String value);\n\n    Map<String, String> getMapSettings();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/HasModalConfiguration.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport org.gwtbootstrap3.client.ui.Modal;\n\n/**\n * Configuration interface for layout drag components providing a modal configuration screen\n */\npublic interface HasModalConfiguration extends HasConfiguration {\n\n    /**\n     * Get the modal window holding the component's configuration panel.\n     * @param ctx The configuration context\n     * @return A modal window in charge of the component's configuration.\n     */\n    Modal getConfigurationModal(ModalConfigurationContext ctx);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/InternalDragComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\n\n/**\n * Super class of the layout editor's internal components\n */\npublic abstract class InternalDragComponent implements LayoutDragComponent {\n\n    public static final String INTERNAL_DRAG_COMPONENT = \"INTERNAL_DRAG_COMPONENT\";\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext container) {\n        return new FlowPanel();\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext container) {\n        // Internal components does not have show widgets as\n        // they are only intended for layout control & behaviour.\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutDragComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.infra.DndDataJSONConverter;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\n/**\n * This interface defines the main contract between the Layout Editor's module and components implementations.\n */\npublic interface LayoutDragComponent {\n\n    public static final String FORMAT = \"text\";\n    static DndDataJSONConverter converter = new DndDataJSONConverter();\n\n    /**\n     * The CSS classes used to display the component's icon on the drag palette.\n     *\n     * @return A CSS class reference\n     */\n    default String getDragComponentIconClass() {\n        return \"fa fa-arrows\";\n    }\n\n    /**\n     * Get the list of properties (grouped into categories) supported by this drag component. These properties\n     * will be edited into the layout editor's properties panel and their values will be stored in the\n     * {@link org.uberfire.ext.layout.editor.api.editor.LayoutComponent} instance passed as a parameter.\n     *\n     * <p>This drag component can use this property edition/storage features to customize its display and/or behaviour.</p>\n     *\n     * @return A list of supported properties classified into several categories.\n     */\n    default List<PropertyEditorCategory> getPropertyCategories(LayoutComponent layoutComponent) {\n        return new ArrayList<>();\n    }\n\n    /**\n     * The title displayed in the component drag palette.\n     */\n    String getDragComponentTitle();\n\n    /**\n     * Widget shown during the layout edition.\n     * <p>\n     * Notice this is just a widget preview, so not all the component features need to be available at\n     * preview time. Just a widget that gives the user an idea of how the final component might look like.\n     * </p>\n     * @param ctx The context for the component being rendered\n     */\n    IsWidget getPreviewWidget(RenderingContext ctx);\n\n    /**\n     * The widget that display and provides all the component features.\n     * This is the widget during the layout rendering process.\n     * @param ctx The context for the component being rendered\n     */\n    IsWidget getShowWidget(RenderingContext ctx);\n\n    /**\n     * A command called before the widget was removed from layout.\n     * This is usually used for cleanup tasks.\n     * @param ctx The context for the component being rendered\n     */\n    default void removeCurrentWidget(RenderingContext ctx){\n    }\n\n    /**\n     * Get a specific part of this widget.\n     * \n     * @param partId\n     * @param componentContext\n     * @return\n     */\n    default Optional<IsWidget> getContentPart(String partId, RenderingContext componentContext) {\n        return Optional.empty();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutDragComponentGroup.java",
    "content": "/*\n* Copyright 2015 JBoss Inc\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*       http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\npublic class LayoutDragComponentGroup {\n\n    private String name;\n\n    private Map<String, LayoutDragComponent> components = new HashMap<String, LayoutDragComponent>();\n\n    private boolean expandeByDefault = false;\n\n    public LayoutDragComponentGroup(String name) {\n        this.name = name;\n    }\n\n    public LayoutDragComponentGroup(String name, boolean expandeByDefault) {\n        this.name = name;\n        this.expandeByDefault = expandeByDefault;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public boolean isExpandeByDefault() {\n        return expandeByDefault;\n    }\n\n    public void addLayoutDragComponent(String id,\n                                       LayoutDragComponent component) {\n        components.put(id,\n                       component);\n    }\n\n    public Set<String> getLayoutDragComponentIds() {\n        return components.keySet();\n    }\n\n    public LayoutDragComponent getLayoutDragComponent(String id) {\n        return components.get(id);\n    }\n\n    public Map<String, LayoutDragComponent> getComponents() {\n        return components;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutDragComponentPalette.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.Collection;\n\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\n\npublic interface LayoutDragComponentPalette {\n\n    void clear();\n\n    void addDraggableGroups(Collection<LayoutComponentPaletteGroupProvider> groupProviders);\n\n    void addDraggableGroup(LayoutComponentPaletteGroupProvider groupProvider);\n\n    void removeDraggableGroup(String groupId);\n\n    boolean hasDraggableGroup(String groupId);\n\n    void addDraggableComponent(String groupId,\n                               String componentId,\n                               LayoutDragComponent component);\n\n    void removeDraggableComponent(String groupId,\n                                  String componentId);\n\n    boolean hasDraggableComponent(String groupId,\n                                  String componentId);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\npublic interface LayoutEditor {\n\n    void init(String layoutName,\n              String emptyTitleText,\n              String emptySubTitleText,\n              LayoutTemplate.Style style);\n\n    void clear();\n\n    Widget asWidget();\n\n    void loadLayout(LayoutTemplate layoutTemplate);\n\n    void loadDefaultLayout(String layoutName);\n\n    LayoutTemplate getLayout();\n\n    void addLayoutProperty(String key,\n                           String value);\n\n    String getLayoutProperty(String key);\n\n    void setPreviewEnabled(boolean enabled);\n\n    void setElementSelectionEnabled(boolean enabled);\n\n    List<LayoutEditorElement> getLayoutElements();\n\n    void visit(LayoutElementVisitor visitor);\n\n    void lock();\n\n    void unlock();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutEditorElement.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\n/**\n * Layout editor's element interface\n */\npublic interface LayoutEditorElement extends LayoutElementWithProperties {\n\n    LayoutEditorElementType geElementType();\n\n    void setSelectable(boolean selectable);\n\n    boolean isSelected();\n\n    LayoutEditorElement getParentElement();\n\n    default List<? extends LayoutEditorElement> getChildElements() {\n        return new ArrayList<>();\n    }\n\n    default void visit(LayoutElementVisitor visitor) {\n        visitor.accept(this);\n        getChildElements().stream().forEach(child -> child.visit(visitor));\n    }\n    \n    default List<LayoutEditorElementPart> getLayoutEditorElementParts() {\n        return Collections.emptyList();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutEditorElementPart.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\npublic interface LayoutEditorElementPart extends LayoutElementWithProperties {\n    \n    LayoutEditorElement getParent();\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutEditorElementType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\n/**\n * Layout editor's element type enumeration\n */\npublic enum LayoutEditorElementType {\n\n    CONTAINER,\n    ROW,\n    COLUMN,\n    COLUMN_WITH_COMPONENTS;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutEditorPlugin.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.Command;\n\npublic interface LayoutEditorPlugin extends LayoutEditor {\n\n    void load(Path currentPath,\n              Command loadCallBack);\n\n    void save(Path path,\n              RemoteCallback<Path> saveSuccessCallback);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutElementVisitor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\npublic interface LayoutElementVisitor {\n\n    void accept(LayoutEditorElement element);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/LayoutElementWithProperties.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\npublic interface LayoutElementWithProperties {\n\n    String getId();\n\n    Map<String, String> getProperties();\n\n    void clearProperties();\n\n    void setProperty(String property, String value);\n\n    void removeProperty(String property);\n\n    List<PropertyEditorCategory> getPropertyCategories();\n    \n    void setSelected(boolean status);\n    \n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/ModalConfigurationContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.function.Supplier;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.infra.ConfigurationContext;\nimport org.uberfire.mvp.Command;\n\n/**\n * This class provides the context required during to configure a layout component using a modal screen\n */\npublic class ModalConfigurationContext extends ConfigurationContext {\n\n    public ModalConfigurationContext(LayoutComponent component,\n                                     Command configurationFinish,\n                                     Command configurationCanceled,\n                                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier) {\n        super(component,\n              configurationFinish,\n              configurationCanceled,\n              currentLayoutTemplateSupplier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/PanelConfigurationContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport java.util.function.Supplier;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.infra.ConfigurationContext;\nimport org.uberfire.mvp.Command;\n\n/**\n * This class provides the context required during to configure a layout component using a modal screen\n */\npublic class PanelConfigurationContext extends ConfigurationContext {\n\n    public PanelConfigurationContext(LayoutComponent component,\n                                     Command configurationFinish,\n                                     Command configurationCanceled,\n                                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier) {\n        super(component,\n              configurationFinish,\n              configurationCanceled,\n              currentLayoutTemplateSupplier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/api/RenderingContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.api;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\n\n/**\n * This class provides the context required to render drag components within the layout.\n */\npublic class RenderingContext {\n\n    private LayoutComponent component;\n    private Widget container;\n\n    public RenderingContext(LayoutComponent component,\n                            Widget container) {\n        this.component = component;\n        this.container = container;\n    }\n\n    public RenderingContext(LayoutComponent component) {\n        this.component = component;\n    }\n\n    public LayoutComponent getComponent() {\n        return component;\n    }\n\n    public Widget getContainer() {\n        return container;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/Column.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType;\n\npublic interface Column<T> extends LayoutEditorElement {\n\n    Integer DEFAULT_COLUMN_HEIGHT = 12;\n    Integer DEFAULT_COLUMN_WIDTH = 12;\n\n    UberElement<T> getView();\n\n    Integer getColumnWidth();\n\n    void setColumnWidth(Integer size);\n\n    void incrementWidth();\n\n    void reduceWidth();\n\n    void setupResize(boolean canResizeLeft,\n                     boolean canResizeRight);\n\n    LayoutComponent getLayoutComponent();\n\n    boolean hasInnerRows();\n\n    void calculateWidth();\n\n    Integer getColumnHeight();\n\n    default boolean isInnerColumn() {\n        return false;\n    }\n\n    void setColumnHeight(Integer columnHeight);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ColumnWithComponents.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDrop;\nimport org.uberfire.ext.layout.editor.client.infra.BeanHelper;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnResizeEvent;\nimport org.uberfire.ext.layout.editor.client.infra.DnDManager;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutDragComponentHelper;\nimport org.uberfire.ext.layout.editor.client.infra.UniqueIDGenerator;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class ColumnWithComponents implements Column {\n\n    private final View view;\n    private String id;\n    private LayoutEditorElement parentElement;\n    private Map<String,String> properties = new HashMap<>();\n    private ParameterizedCommand<ColumnDrop> dropCommand;\n    private ParameterizedCommand<ColumnDrop> removeComponentCommand;\n    private ParameterizedCommand<Column> removeColumnCommand;\n    private Row row;\n    private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n    private Instance<Row> rowInstance;\n    private DnDManager dndManager;\n    private LayoutDragComponentHelper layoutDragComponentHelper;\n    private boolean canResizeLeft;\n    private boolean canResizeRight;\n    private Event<ColumnResizeEvent> columnResizeEvent;\n    private Event<LockRequiredEvent> lockRequiredEvent;\n    private LayoutTemplate.Style pageStyle;\n    private Supplier<LayoutTemplate> currentLayoutTemplateSupplier;\n    private Supplier<Boolean> lockSupplier;\n    private Integer columnHeight = DEFAULT_COLUMN_HEIGHT;\n    private Integer columnWidth;\n    private boolean selected = false;\n    private boolean selectable = true;\n\n    @Inject\n    public ColumnWithComponents(final View view,\n                                Instance<Row> rowInstance,\n                                DnDManager dndManager,\n                                LayoutDragComponentHelper layoutDragComponentHelper,\n                                Event<ColumnResizeEvent> columnResizeEvent,\n                                Event<LockRequiredEvent> lockRequiredEvent) {\n        this.view = view;\n        this.rowInstance = rowInstance;\n        this.dndManager = dndManager;\n        this.layoutDragComponentHelper = layoutDragComponentHelper;\n        this.columnResizeEvent = columnResizeEvent;\n        this.lockRequiredEvent = lockRequiredEvent;\n    }\n\n    @PostConstruct\n    public void post() {\n        view.init(this);\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        destroy(row);\n    }\n\n    public void init(LayoutEditorElement parent,\n                     Integer columnWidth,\n                     LayoutTemplate.Style pageStyle,\n                     ParameterizedCommand<ColumnDrop> dropCommand,\n                     ParameterizedCommand<ColumnDrop> removeComponentCommand,\n                     ParameterizedCommand<Column> removeCommand,\n                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,\n                     Supplier<Boolean> lockSupplier,\n                     Integer columnHeight) {\n        this.columnWidth = columnWidth;\n        this.parentElement = parent;\n        this.dropCommand = dropCommand;\n        this.removeComponentCommand = removeComponentCommand;\n        this.removeColumnCommand = removeCommand;\n        this.pageStyle = pageStyle;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n        this.lockSupplier = lockSupplier;\n        this.columnHeight = columnHeight;\n        view.setWidth(columnWidth);\n        setupPageLayout();\n        row = createInstanceRow();\n        row.disableDrop();\n        row.setup(this, idGenerator.createRowID(id),\n                  pageStyle);\n        row.init(createDropCommand(),\n                 createRowRemoveCommand(),\n                 createComponentRemoveCommand(),\n                 this,\n                 currentLayoutTemplateSupplier,\n                 lockSupplier,\n                 Row.ROW_DEFAULT_HEIGHT);\n    }\n\n    @Override\n    public LayoutEditorElementType geElementType() {\n        return LayoutEditorElementType.COLUMN_WITH_COMPONENTS;\n    }\n\n    @Override\n    public LayoutEditorElement getParentElement() {\n        return parentElement;\n    }\n\n    @Override\n    public List<? extends LayoutEditorElement> getChildElements() {\n        return Collections.singletonList(row);\n    }\n\n    @Override\n    public void setSelectable(boolean selectable) {\n        this.selectable = selectable;\n    }\n\n    @Override\n    public boolean isSelected() {\n        return selected;\n    }\n\n    @Override\n    public void setSelected(boolean status) {\n        selected = status;\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public void setProperty(String property, String value) {\n        properties.put(property, value);\n    }\n\n    @Override\n    public void removeProperty(String property) {\n        properties.remove(property);\n    }\n\n    @Override\n    public void clearProperties() {\n        properties.clear();\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return null;\n    }\n\n    private void setupPageLayout() {\n        if (pageStyle == LayoutTemplate.Style.PAGE) {\n            view.setupPageLayout();\n        }\n    }\n\n    public void onDrop(ColumnDrop.Orientation orientation,\n                       String dndData) {\n        if (dndManager.isOnComponentMove()) {\n            dropCommand.execute(new ColumnDrop(dndManager.getLayoutComponentMove(),\n                                               id,\n                                               orientation)\n                                        .fromMove(dndManager.getDraggedColumn()));\n        } else {\n            dropCommand.execute(\n                    new ColumnDrop(layoutDragComponentHelper.getLayoutComponentFromDrop(dndData),\n                                   id,\n                                   orientation));\n        }\n        lockRequiredEvent.fire(new LockRequiredEvent());\n    }\n\n    public boolean hasComponent(Column targetColumn) {\n        return row.hasComponent(targetColumn) != null;\n    }\n\n    public void remove(Column targetColumn) {\n        row.removeColumn(targetColumn);\n    }\n\n    public boolean canResizeLeft() {\n        return canResizeLeft;\n    }\n\n    public void resizeLeft() {\n        columnResizeEvent.fire(new ColumnResizeEvent(hashCode(),\n                                                     parentElement.hashCode()).left());\n    }\n\n    public boolean canResizeRight() {\n        return canResizeRight;\n    }\n\n    public void resizeRight() {\n        columnResizeEvent.fire(new ColumnResizeEvent(hashCode(),\n                                                     parentElement.hashCode()).right());\n    }\n\n    protected Row createInstanceRow() {\n        Row row = rowInstance.get();\n        row.setSelectable(selectable);\n        row.setup(this, idGenerator.createRowID(id),\n                  pageStyle);\n        return row;\n    }\n\n    private ParameterizedCommand<ColumnDrop> createComponentRemoveCommand() {\n        return drop -> removeComponentCommand.execute(drop);\n    }\n\n    private ParameterizedCommand<Row> createRowRemoveCommand() {\n        return row -> removeColumnCommand.execute(this);\n    }\n\n    public void withComponents(ComponentColumn... _columns) {\n        row.addColumns(_columns);\n    }\n\n    ParameterizedCommand<RowDrop> createDropCommand() {\n        return rowDrop -> {\n        };\n    }\n\n    public void setColumnHeight(Integer columnHeight) {\n        this.columnHeight = columnHeight;\n    }\n\n    @Override\n    public UberElement<ColumnWithComponents> getView() {\n        view.clear();\n        if (hasInnerRows()) {\n            view.addRow(row.getView());\n        }\n        view.calculateWidth();\n        return view;\n    }\n\n    public Integer getColumnWidth() {\n        return columnWidth;\n    }\n\n    public void setColumnWidth(Integer columnWidth) {\n        this.columnWidth = columnWidth;\n        view.setWidth(columnWidth);\n    }\n\n    @Override\n    public void reduceWidth() {\n        final int newSize = this.columnWidth - 1;\n        setColumnWidth(newSize);\n    }\n\n    @Override\n    public void incrementWidth() {\n        final int newSize = this.columnWidth + 1;\n        setColumnWidth(newSize);\n    }\n\n    public ParameterizedCommand<Column> getRemoveColumnCommand() {\n        return removeColumnCommand;\n    }\n\n    @Override\n    public LayoutComponent getLayoutComponent() {\n        return null;\n    }\n\n    @Override\n    public boolean hasInnerRows() {\n        return row != null;\n    }\n\n    @Override\n    public void calculateWidth() {\n        view.calculateWidth();\n    }\n\n    public Row getRow() {\n        return row;\n    }\n\n    protected void destroy(Object o) {\n        BeanHelper.destroy(o);\n    }\n\n    public void calculateSizeChilds() {\n        row.calculateSizeChilds();\n    }\n\n    @Override\n    public void setupResize(boolean canResizeLeft,\n                            boolean canResizeRight) {\n        this.canResizeLeft = canResizeLeft;\n        this.canResizeRight = canResizeRight;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    public Integer getColumnHeight() {\n        return columnHeight;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public boolean shouldPreviewDrop() {\n        return !dndManager.isOnRowMove();\n    }\n\n    public interface View extends UberElement<ColumnWithComponents> {\n\n        void setWidth(Integer size);\n\n        void addRow(UberElement<Row> view);\n\n        void calculateWidth();\n\n        void clear();\n\n        void setupPageLayout();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ColumnWithComponentsView.css",
    "content": ".no-padding{\n}\n\n.innerColumnPadding{\n}\n\n.left{\n    float: left;\n    z-index: 1;\n}\n\n.right{\n    float: right;\n    z-index: 1;\n}\n.colUp{\n    height:5px;\n}\n\n.colPreview{\n    height: 15px;\n    margin-left:5px;\n    margin-right:5px;\n}\n.colDown{\n    height:5px;\n}\n.center{\n    display: inline-block;\n    width: 90%;\n    border: 1px solid lightgray;\n\n}\n.centerPreview{\n    width: 50% !important;\n}\n.dropPreview{\n    width: 50% !important;\n}\n.colWithComponents{\n    padding-left: 0px;\n    padding-right: 0px;\n}\n.colResizeLeft {\n    cursor: w-resize;\n}\n.colResizeRight {\n    cursor: e-resize;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ColumnWithComponentsView.html",
    "content": "<div data-field=\"colWithComponents\" class=\"colWithComponents\">\n    <div data-field=\"inner-col-colwithComponents\" class=\"col-md-12\">\n        <div data-field=\"row\" class=\"row eq-height\">\n            <div data-field=\"left\" class=\"left\">\n            </div>\n            <div data-field=\"content\" class=\"center\">\n            </div>\n            <div data-field=\"right\" class=\"right\">\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ColumnWithComponentsView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ContainerResizeEvent;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.hasCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeAllChildren;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\nimport static org.uberfire.ext.layout.editor.client.infra.HTML5DnDHelper.extractDndData;\n\n@Dependent\n@Templated\npublic class ColumnWithComponentsView\n        implements UberElement<ColumnWithComponents>,\n                   ColumnWithComponents.View,\n                   IsElement {\n\n    private static final String COL_CSS_CLASS = \"col-md-\";\n    private final int originalLeftRightWidth = 15;\n    @Inject\n    @DataField\n    Div colWithComponents;\n    @Inject\n    @DataField\n    Div row;\n    String cssSize = \"\";\n    private ColumnWithComponents presenter;\n    @Inject\n    @DataField\n    private Div content;\n    @Inject\n    @DataField\n    private Div left;\n    @Inject\n    @DataField\n    private Div right;\n    @Inject\n    private Document document;\n    @Inject\n    @DataField(\"inner-col-colwithComponents\")\n    Div innerCol;\n\n    @Override\n    public void init(ColumnWithComponents presenter) {\n        this.presenter = presenter;\n        setupEvents();\n    }\n\n    private void setupEvents() {\n        setupLeftEvents();\n        setupRightEvents();\n        setupOnResize();\n    }\n\n    @Override\n    public void setupPageLayout() {\n        addCSSClass(colWithComponents,\n                    \"page-col\");\n        addCSSClass(innerCol,\n                    \"page-col\");\n        addCSSClass(row,\n                    \"page-col\");\n    }\n\n    private void setupOnResize() {\n        document.getBody().setOnresize(event -> calculateWidth());\n    }\n\n    public void dockSelectEvent(@Observes UberfireDocksInteractionEvent event) {\n        calculateWidth();\n    }\n\n    private void setupRightEvents() {\n        right.setOndragenter(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                addCSSClass(right,\n                            \"columnDropPreview\");\n                addCSSClass(right,\n                            \"dropPreview\");\n                addCSSClass(content,\n                            \"centerPreview\");\n            }\n        });\n        right.setOndragleave(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                removeCSSClass(right,\n                               \"columnDropPreview\");\n                removeCSSClass(right,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n            }\n        });\n        right.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                removeCSSClass(right,\n                               \"columnDropPreview\");\n                removeCSSClass(right,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n                presenter.onDrop(ColumnDrop.Orientation.RIGHT,\n                                 extractDndData(e));\n            }\n        });\n        right.setOndragover(e -> {\n            e.preventDefault();\n        });\n        right.setOnmouseover(e -> {\n            e.preventDefault();\n            if (presenter.canResizeRight()) {\n                addCSSClass(right,\n                            \"colResizeRight\");\n            } else {\n                removeCSSClass(right,\n                               \"colResizeRight\");\n            }\n        });\n        right.setOnmouseout(e -> {\n            e.preventDefault();\n            if (!presenter.canResizeRight()) {\n                removeCSSClass(right,\n                               \"colResizeRight\");\n            }\n        });\n        right.setOnclick(e -> {\n            e.preventDefault();\n            if (presenter.canResizeRight()) {\n                presenter.resizeRight();\n            }\n        });\n    }\n\n    private void setupLeftEvents() {\n        left.setOndragenter(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                addCSSClass(left,\n                            \"columnDropPreview\");\n                addCSSClass(left,\n                            \"dropPreview\");\n                addCSSClass(content,\n                            \"centerPreview\");\n            }\n        });\n        left.setOndragover(e -> e.preventDefault());\n        left.setOndragleave(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                removeCSSClass(left,\n                               \"columnDropPreview\");\n                removeCSSClass(left,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n            }\n        });\n        left.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                removeCSSClass(left,\n                               \"columnDropPreview\");\n                removeCSSClass(left,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n                presenter.onDrop(ColumnDrop.Orientation.LEFT,\n                                 extractDndData(e));\n            }\n        });\n        left.setOnmouseover(e -> {\n            e.preventDefault();\n            if (presenter.canResizeLeft()) {\n                addCSSClass(left,\n                            \"colResizeLeft\");\n            } else {\n                removeCSSClass(left,\n                               \"colResizeLeft\");\n            }\n        });\n        left.setOnmouseout(e -> {\n            e.preventDefault();\n            if (!presenter.canResizeLeft()) {\n                removeCSSClass(left,\n                               \"colResizeLeft\");\n            }\n        });\n        left.setOnclick(e -> {\n            e.preventDefault();\n            if (presenter.canResizeLeft()) {\n                presenter.resizeLeft();\n            }\n        });\n    }\n\n    @Override\n    public void setWidth(Integer size) {\n        if (hasCssSizeClass()) {\n            removeCSSClass(colWithComponents,\n                           cssSize);\n        }\n        cssSize = COL_CSS_CLASS + size;\n        addCSSClass(colWithComponents,\n                    cssSize);\n        addCSSClass(colWithComponents,\n                    \"container\");\n    }\n\n    private boolean hasCssSizeClass() {\n        return !cssSize.isEmpty() && hasCSSClass(colWithComponents,\n                                                 cssSize);\n    }\n\n    @Override\n    public void addRow(UberElement<Row> view) {\n        content.appendChild(view.getElement());\n    }\n\n    @Override\n    public void clear() {\n        removeAllChildren(content);\n    }\n\n    public void resizeEventObserver(@Observes ContainerResizeEvent event) {\n        calculateWidth();\n    }\n\n    @Override\n    public void calculateWidth() {\n\n        Scheduler.get().scheduleDeferred(() -> {\n\n            final int colWidth = row.getBoundingClientRect().getWidth().intValue();\n\n            int padding = 2;\n            final int contentWidth = colWidth - (originalLeftRightWidth * 2) - padding;\n\n            left.getStyle().setProperty(\"width\",\n                                        originalLeftRightWidth + \"px\");\n            right.getStyle().setProperty(\"width\",\n                                         originalLeftRightWidth + \"px\");\n\n            content.getStyle().setProperty(\"width\",\n                                           contentWidth + \"px\");\n            presenter.calculateSizeChilds();\n        });\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumn.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementPart;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementSelectEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementUnselectEvent;\nimport org.uberfire.ext.layout.editor.client.infra.*;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class ComponentColumn implements Column {\n\n    private final View view;\n    private String id;\n    private LayoutEditorElement parentElement;\n    private Map<String,String> properties = new HashMap<>();\n    private DnDManager dndManager;\n    private Integer columnWidth;\n    private Integer columnHeight = DEFAULT_COLUMN_HEIGHT;\n    private Integer innerColumnMinimumHeight = 3;\n    private ParameterizedCommand<ColumnDrop> dropCommand;\n    private boolean innerColumn = false;\n    private LayoutComponent layoutComponent;\n    private Supplier<LayoutTemplate> currentLayoutTemplateSupplier;\n    private Supplier<Boolean> lockSupplier;\n    private boolean componentReady;\n    private ParameterizedCommand<Column> removeCommand;\n    private LayoutDragComponentHelper layoutDragComponentHelper;\n    private Event<ColumnResizeEvent> columnResizeEvent;\n    private boolean canResizeLeft;\n    private boolean canResizeRight;\n    private LayoutTemplate.Style pageStyle;\n    private boolean selected = false;\n    private boolean selectable = true;\n    private Event<LayoutEditorElementSelectEvent> columnSelectEvent;\n    private Event<LayoutEditorElementUnselectEvent> columnUnselectEvent;\n    private Event<LockRequiredEvent> lockRequiredEvent;\n    private ManagedInstance<ComponentColumnPart> componentColumnManagedInstance;\n    private List<LayoutEditorElementPart> parts = new ArrayList<>();\n\n    @Inject\n    public ComponentColumn(final View view,\n                           DnDManager dndManager,\n                           LayoutDragComponentHelper layoutDragComponentHelper,\n                           Event<ColumnResizeEvent> columnResizeEvent,\n                           Event<LayoutEditorElementSelectEvent> columnSelectEvent,\n                           Event<LayoutEditorElementUnselectEvent> columnUnselectEvent,\n                           Event<LockRequiredEvent> lockRequiredEvent,\n                           ManagedInstance<ComponentColumnPart> componentColumnManagedInstance) {\n        this.view = view;\n        this.dndManager = dndManager;\n        this.layoutDragComponentHelper = layoutDragComponentHelper;\n        this.columnResizeEvent = columnResizeEvent;\n        this.columnSelectEvent = columnSelectEvent;\n        this.columnUnselectEvent = columnUnselectEvent;\n        this.lockRequiredEvent = lockRequiredEvent;\n        this.componentColumnManagedInstance = componentColumnManagedInstance;\n    }\n\n    @PostConstruct\n    public void post() {\n        view.init(this);\n    }\n\n    public void init(LayoutEditorElement parent,\n                     Integer columnWidth,\n                     LayoutComponent layoutComponent,\n                     ParameterizedCommand<ColumnDrop> dropCommand,\n                     ParameterizedCommand<Column> removeCommand,\n                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,\n                     Supplier<Boolean> lockSupplier,\n                     boolean newComponent) {\n        this.layoutComponent = layoutComponent;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n        this.lockSupplier = lockSupplier;\n        view.setup(layoutComponent, pageStyle);\n        this.parentElement = parent;\n        this.columnWidth = columnWidth;\n        this.dropCommand = dropCommand;\n        this.removeCommand = removeCommand;\n        view.setWidth(columnWidth.toString());\n        setupPageLayout();\n        if (newComponent && hasConfiguration()) {\n            configComponent(newComponent);\n        } else {\n            componentReady = true;\n        }\n        view.setupWidget();\n        setupParts();\n    }\n\n    @Override\n    public LayoutEditorElementType geElementType() {\n        return LayoutEditorElementType.COLUMN;\n    }\n\n    @Override\n    public LayoutEditorElement getParentElement() {\n        return parentElement;\n    }\n\n    public void setParentElement(LayoutEditorElement parentElement) {\n        this.parentElement = parentElement;\n    }\n\n    public boolean isSelectable() {\n        return selectable;\n    }\n\n    public void setSelectable(boolean selectable) {\n        this.selectable = selectable;\n    }\n\n    @Override\n    public boolean isSelected() {\n        return selected;\n    }\n\n    @Override\n    public void setSelected(boolean selected) {\n        if (isSelectable()) {\n            if (selected) {\n                this.selected = true;\n                view.setSelected(true);\n            } else {\n                this.selected = false;\n                view.setSelected(false);\n            }\n        }\n    }\n\n    private void setupPageLayout() {\n        view.setupPageLayout();\n    }\n    \n    public void setupParts() {\n        parts.clear();\n        layoutComponent.getParts().forEach(part -> {\n            ComponentColumnPart componentColumnPart = componentColumnManagedInstance.get();\n            componentColumnPart.init(this, part);\n            parts.add(componentColumnPart);\n        });\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public void setProperty(String property, String value) {\n        properties.put(property, value);\n        layoutComponent.getProperties().put(property, value);\n        this.updateView();\n    }\n\n    @Override\n    public void removeProperty(String property) {\n        properties.remove(property);\n        layoutComponent.getProperties().remove(property);\n        this.updateView();\n    }\n\n    @Override\n    public void clearProperties() {\n        properties.clear();\n        layoutComponent.getProperties().clear();\n        this.updateView();\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return view.getPropertyCategories();\n    }\n\n    protected boolean hasConfiguration() {\n        return view.hasModalConfiguration();\n    }\n\n    public void setDropCommand(\n            ParameterizedCommand<ColumnDrop> dropCommand) {\n        this.dropCommand = dropCommand;\n    }\n\n    void configComponent(boolean newComponent) {\n        if (lockSupplier.get()) {\n            return;\n        }\n        if (hasModalConfiguration(newComponent)) {\n            view.showConfigComponentModal(this::configurationFinish,\n                                          this::configurationCanceled,\n                                          currentLayoutTemplateSupplier);\n        } else {\n            configurationFinish();\n        }\n    }\n\n    private boolean hasModalConfiguration(boolean newComponent) {\n        return newComponent && view.hasModalConfiguration();\n    }\n\n    private void configurationFinish() {\n        this.componentReady = true;\n        setupParts();\n        updateView();\n    }\n\n    private void configurationCanceled() {\n        if (!componentReady) {\n            remove();\n        }\n    }\n\n    public void remove() {\n        removeCommand.execute(this);\n    }\n\n    public void edit() {\n        configComponent(true);\n    }\n\n    public boolean shouldPreviewDrop() {\n        return !dndManager.isOnRowMove() && canISplitMyHeight();\n    }\n\n    private boolean canISplitMyHeight() {\n        if (isInnerColumn()) {\n            return getColumnHeight() > innerColumnMinimumHeight;\n        }\n        return true;\n    }\n\n    public void dragStartComponent() {\n        dndManager.dragComponent(layoutComponent,\n                                 parentElement.getId(),\n                                 this);\n    }\n\n    public void dragEndComponent() {\n        dndManager.dragEndComponent();\n    }\n\n    @Override\n    public LayoutComponent getLayoutComponent() {\n        return layoutComponent;\n    }\n\n    @Override\n    public boolean hasInnerRows() {\n        return false;\n    }\n\n    @Override\n    public void calculateWidth() {\n        view.calculateWidth();\n    }\n\n    @Override\n    public void reduceWidth() {\n        final int newSize = this.columnWidth - 1;\n        setColumnWidth(newSize);\n    }\n\n    @Override\n    public void incrementWidth() {\n        final int newSize = this.columnWidth + 1;\n        setColumnWidth(newSize);\n    }\n\n    @Override\n    public void setupResize(boolean canResizeLeft,\n                            boolean canResizeRight) {\n        this.canResizeLeft = canResizeLeft;\n        this.canResizeRight = canResizeRight;\n    }\n\n    public boolean canResizeLeft() {\n        if (innerColumn) {\n            return false;\n        }\n        return canResizeLeft;\n    }\n\n    public void resizeLeft() {\n        columnResizeEvent.fire(new ColumnResizeEvent(hashCode(),\n                                                     parentElement.hashCode()).left());\n    }\n\n    public boolean canResizeRight() {\n        if (innerColumn) {\n            return false;\n        }\n        return canResizeRight;\n    }\n\n    public void resizeRight() {\n        columnResizeEvent.fire(new ColumnResizeEvent(hashCode(),\n                                                     parentElement.hashCode()).right());\n    }\n\n    public void recalculateWidth() {\n        view.calculateWidth();\n    }\n\n    public Integer getColumnWidth() {\n        return columnWidth;\n    }\n\n    public void setColumnWidth(Integer size) {\n        this.columnWidth = size;\n        view.setWidth(size.toString());\n    }\n\n    public void onDrop(ColumnDrop.Orientation orientation,\n                       String dndData) {\n        if (dndManager.isOnComponentMove()) {\n            moveDrop(orientation);\n        } else {\n            newComponentDrop(orientation,\n                             dndData);\n        }\n        requiredLock();\n    }\n\n    public void requiredLock() {\n        lockRequiredEvent.fire(new LockRequiredEvent());\n    }\n\n    private void newComponentDrop(ColumnDrop.Orientation orientation,\n                                  String dndData) {\n        dropCommand.execute(\n                new ColumnDrop(layoutDragComponentHelper.getLayoutComponentFromDrop(dndData),\n                               id,\n                               orientation));\n    }\n\n    private void moveDrop(ColumnDrop.Orientation orientation) {\n        if (!dropInTheSameColumn()) {\n            dropCommand.execute(new ColumnDrop(dndManager.getLayoutComponentMove(),\n                                               id,\n                                               orientation)\n                                        .fromMove(\n                                                dndManager.getDraggedColumn()));\n        }\n    }\n\n    private boolean dropInTheSameColumn() {\n        return dndManager.getDraggedColumn() == this;\n    }\n\n    @Override\n    public boolean isInnerColumn() {\n        return innerColumn;\n    }\n\n    public void setColumnHeight(Integer columnHeight) {\n        this.columnHeight = columnHeight;\n        this.innerColumn = true;\n        view.setColumnHeight(columnHeight);\n    }\n\n    public void updateView() {\n        if (componentReady) {\n            view.clearContent();\n            view.setContent();\n            view.calculateWidth();\n        }\n    }\n\n    public UberElement<ComponentColumn> getView() {\n        updateView();\n        return view;\n    }\n\n\n    public LayoutDragComponentHelper getLayoutDragComponentHelper() {\n        return layoutDragComponentHelper;\n    }\n\n    public boolean enableSideDnD() {\n        return !isInnerColumn();\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public void setup(String id,\n                      LayoutTemplate.Style pageStyle) {\n        this.id = id;\n        this.pageStyle = pageStyle;\n    }\n\n    public Integer getColumnHeight() {\n        return columnHeight;\n    }\n\n    public void onSelected() {\n        if (isSelectable()) {\n            if (selected) {\n                selected = false;\n                columnUnselectEvent.fire(new LayoutEditorElementUnselectEvent(this));\n            } else {\n                selected = true;\n                columnSelectEvent.fire(new LayoutEditorElementSelectEvent(this));\n            }\n        }\n    }\n\n    public void onDragEnd(@Observes DragComponentEndEvent dragComponentEndEvent) {\n        view.notifyDragEnd();\n        requiredLock();\n    }\n    \n    @Override\n    public List<LayoutEditorElementPart> getLayoutEditorElementParts() {\n        return parts;\n    }\n    \n    public LayoutDragComponent getLayoutDragComponent() {\n        return view.getLayoutDragComponent();\n    }\n\n    public interface View extends UberElement<ComponentColumn> {\n\n        void setWidth(String size);\n\n        LayoutDragComponent getLayoutDragComponent();\n\n        void calculateWidth();\n\n        void clearContent();\n\n        void setContent();\n\n        void showConfigComponentModal(Command configurationFinish,\n                                      Command configurationCanceled,\n                                      Supplier<LayoutTemplate> createCurrentLayoutTemplateSupplier);\n\n        boolean hasModalConfiguration();\n\n        void setup(LayoutComponent layoutComponent,\n                   LayoutTemplate.Style pageStyle);\n\n        void setupWidget();\n\n        void setupPageLayout();\n\n        void setColumnHeight(Integer columnHeight);\n\n        void setSelected(boolean selected);\n\n        void notifyDragEnd();\n\n        List<PropertyEditorCategory> getPropertyCategories();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnPart.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponentPart;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementPart;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorCssHelper;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\n@Dependent\npublic class ComponentColumnPart implements LayoutEditorElementPart {\n    \n    @Inject\n    public LayoutEditorCssHelper cssHelper;\n    \n    \n    private LayoutComponentPart part;\n    private ComponentColumn componentColumnElement;\n\n    public void init(ComponentColumn layoutEditorElement, LayoutComponentPart part) {\n        this.componentColumnElement = layoutEditorElement;\n        this.part = part;\n    }\n\n    @Override\n    public String getId() {\n        return part.getPartId();\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return part.getCssProperties();\n    }\n\n    @Override\n    public void clearProperties() {\n        part.clearCssProperties();\n        componentColumnElement.updateView();\n    }\n\n    @Override\n    public void setProperty(String property, String value) {\n        part.addCssProperty(property, value);\n        componentColumnElement.updateView();\n    }\n\n    @Override\n    public void removeProperty(String property) {\n        part.removeCssProperty(property);\n        componentColumnElement.updateView();\n\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return cssHelper.allCategories(part.getCssProperties());\n    }\n\n    @Override\n    public LayoutEditorElement getParent() {\n        return componentColumnElement;\n    }\n    \n    @Override\n    public void setSelected(boolean status) {\n        getParent().setSelected(status);\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnView.css",
    "content": ".no-padding {\n    padding-right: 0px;\n    padding-left: 3px;\n}\n\n.eq-height {\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -ms-flexbox;\n    display: flex;\n}\n\n.innerColumnPadding {\n}\n\n.page-col{\n\n    height: 100%;\n}\n.page-col-inner{\n    padding-bottom: 7px !important;\n    padding-top: 7px !important;\n}\n\n.left {\n    float: left;\n}\n\n.right {\n    float: right;\n}\n\n.el-resize-button {\n    padding: 0px;\n}\n\n.colUp {\n    height: 5px;\n}\n\n.componentDropInColumnPreview {\n    height: 15px;\n    margin-left: 15px;\n    margin-right: 20px;\n\n    background: #dde0e2; /* Old browsers */\n    background: -moz-linear-gradient(top, #eeeeee 0%, #dde0e2 100%); /* FF3.6-15 */\n    background: -webkit-linear-gradient(top, #eeeeee 0%, #dde0e2 100%); /* Chrome10-25,Safari5.1-6 */\n    background: linear-gradient(to bottom, #eeeeee 0%, #dde0e2 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dde0e2', GradientType=0); /* IE6-9 */\n\n}\n\n.colDown {\n    height: 5px;\n}\n\n.center {\n    display: inline-block;\n    width: 90%;\n    position: relative;\n\n}\n\n.centerPreview {\n    width: 50% !important;\n}\n\n.dropPreview {\n    width: 50% !important;\n    /* column drop gradient*/\n    background: #dde0e2; /* Old browsers */\n    background: -moz-linear-gradient(top, #eeeeee 0%, #dde0e2 100%); /* FF3.6-15 */\n    background: -webkit-linear-gradient(top, #eeeeee 0%, #dde0e2 100%); /* Chrome10-25,Safari5.1-6 */\n    background: linear-gradient(to bottom, #eeeeee 0%, #dde0e2 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */\n    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#eeeeee', endColorstr='#dde0e2', GradientType=0); /* IE6-9 */\n}\n\n.columnDropPreview {\n    /*border: 1px dashed lightgray;*/\n    z-index: 1;\n}\n\n.buttonsPanel {\n    text-align: right;\n}\n\n.el-content {\n    border: 1px solid #b1caf2;\n    /*selected 97B4E2 */\n    -webkit-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    -moz-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;;\n    box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    padding-right: 7px;\n    padding-left: 15px;\n    padding-top: 10px;\n    padding-bottom: 10px;\n}\n\n.el-content-area {\n    padding: 0px;\n}\n\n.el-component-row {\n    margin-left: -3px !important;\n    margin-right: -3px !important;\n}\n\n.componentMovePreview {\n    border-color: #33a6cc !important;\n    cursor: move;\n}\n.colResizeLeft {\n    cursor: w-resize;\n}\n.colResizeRight {\n    cursor: e-resize;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnView.html",
    "content": "<div data-field=\"col\">\n    <div data-field=\"row\" class=\"row el-component-row\">\n        <div class=\"col-md-12 el-content-area\">\n            <div data-field=\"colUp\">\n            </div>\n        </div>\n        <div data-field=\"content-area\" class=\"col-md-12 eq-height el-content-area\">\n            <div data-field=\"left\" class=\"left\">\n            </div>\n            <div draggable=\"true\" data-field=\"content\" class=\"center el-content\"></div>\n            <div data-field=\"right\" class=\"right\">\n            </div>\n        </div>\n        <div class=\"col-md-12 el-content-area\">\n            <div data-field=\"colDown\">\n\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport java.util.List;\nimport java.util.function.Supplier;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.Window;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.MouseEvent;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ContainerResizeEvent;\nimport org.uberfire.ext.layout.editor.client.infra.DragHelperComponentColumn;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorFocusController;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.layout.editor.client.widgets.KebabWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.Command;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.hasCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeAllChildren;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\nimport static org.uberfire.ext.layout.editor.client.infra.HTML5DnDHelper.extractDndData;\n\n@Dependent\n@Templated\npublic class ComponentColumnView\n        implements UberElement<ComponentColumn>,\n                   ComponentColumn.View,\n                   IsElement {\n\n    public static final String PAGE_ROW_CSS_CLASS = \"uf-perspective-row-\";\n    public static final String COL_CSS_CLASS = \"col-md-\";\n    private final int originalLeftRightWidth = 15;\n    String widthSize = \"\";\n    String heightSize = \"\";\n    private ComponentColumn presenter;\n    @Inject\n    @DataField\n    private Div col;\n    @Inject\n    @DataField\n    private Div colUp;\n    @Inject\n    @DataField\n    private Div row;\n    @Inject\n    @DataField\n    private Div colDown;\n    @Inject\n    @DataField\n    private Div left;\n    @Inject\n    @DataField\n    private Div right;\n    @Inject\n    @DataField(\"content-area\")\n    private Div contentArea;\n    @Inject\n    KebabWidget kebabWidget;\n    @Inject\n    @DataField\n    Div content;\n    @Inject\n    private Document document;\n    private ColumnDrop.Orientation contentDropOrientation;\n    @Inject\n    LayoutEditorFocusController layoutEditorFocusController;\n\n    @Inject\n    private DragHelperComponentColumn helper;\n\n    @Override\n    public void init(ComponentColumn presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return helper.getLayoutDragComponentProperties();\n    }\n\n    @Override\n    public void setupWidget() {\n        String txt = presenter.isSelectable() ? CommonConstants.INSTANCE.SelectColumnHint() : CommonConstants.INSTANCE.DragColumnHint();\n        content.setTitle(txt);\n        setupEvents();\n        setupKebabWidget();\n        setupOnResize();\n    }\n\n    @Override\n    public void setupPageLayout() {\n\n        addCSSClass(col,\n                    \"page-col\");\n        addCSSClass(row,\n                    \"page-col\");\n        addCSSClass(contentArea,\n                    \"page-col\");\n        addCSSClass(content,\n                    \"page-col\");\n    }\n\n    @Override\n    public void setColumnHeight(Integer innerColumnHeight) {\n\n        addCSSClass(contentArea,\n                    \"page-col-inner\");\n\n        if (!heightSize.isEmpty()) {\n            removeCSSClass(col,\n                           heightSize);\n        }\n        this.heightSize = PAGE_ROW_CSS_CLASS + innerColumnHeight;\n        removeCSSClass(col,\n                       \"page-col\");\n        addCSSClass(col,\n                    heightSize);\n    }\n\n    void setupOnResize() {\n        Window.addResizeHandler(event -> {\n            calculateWidth();\n        });\n    }\n\n    public void dockSelectEvent(@Observes UberfireDocksInteractionEvent event) {\n        calculateWidth();\n    }\n\n    private void setupKebabWidget() {\n        kebabWidget.init(() -> {\n                             removeCurrentWidget();\n                             presenter.remove();\n                         },\n                         () -> presenter.edit());\n    }\n\n    void removeCurrentWidget() {\n        helper.getLayoutDragComponent().removeCurrentWidget(new RenderingContext(presenter.getLayoutComponent()));\n    }\n\n    void setupEvents() {\n        setupLeftEvents();\n        setupRightEvents();\n        setupColUpEvents();\n        setupColDownEvents();\n        setupContentEvents();\n        setupColEvents();\n        setupRowEvents();\n    }\n\n    private void setupRowEvents() {\n        row.setOnmouseout(event -> {\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n        });\n    }\n\n    private void setupColEvents() {\n        col.setOnmouseup(e -> {\n            e.preventDefault();\n            if (hasCSSClass(col,\n                            \"rowDndPreview\")) {\n                removeCSSClass(col,\n                               \"rowDndPreview\");\n            }\n        });\n        col.setOnmouseover(e -> {\n            e.preventDefault();\n        });\n        col.setOnmouseout(event -> {\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n        });\n    }\n\n    private void setupColUpEvents() {\n\n        colUp.setOndragleave(event -> {\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n        });\n        colUp.setOndragexit(event -> {\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n        });\n\n        colUp.setOndragover(event -> {\n            event.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                contentDropOrientation = ColumnDrop.Orientation.UP;\n                addCSSClass(colUp,\n                            \"componentDropInColumnPreview\");\n            }\n        });\n        colUp.setOndrop(e -> {\n            e.preventDefault();\n            if (contentDropOrientation != null) {\n                presenter.onDrop(contentDropOrientation,\n                                 extractDndData(e));\n            }\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n        });\n        colUp.setOnmouseout(event -> {\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n        });\n    }\n\n    private void setupColDownEvents() {\n        colDown.setOndrop(e -> {\n            e.preventDefault();\n            if (contentDropOrientation != null) {\n                presenter.onDrop(contentDropOrientation,\n                                 extractDndData(e));\n            }\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n        });\n    }\n\n    private void setupRightEvents() {\n        right.setOndragenter(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop() && presenter.enableSideDnD()) {\n                addCSSClass(right,\n                            \"columnDropPreview\");\n                addCSSClass(right,\n                            \"dropPreview\");\n                addCSSClass(content,\n                            \"centerPreview\");\n                removeCSSClass(colUp,\n                               \"componentDropInColumnPreview\");\n            }\n        });\n        right.setOndragleave(e -> {\n            e.preventDefault();\n            removeCSSClass(right,\n                           \"columnDropPreview\");\n            removeCSSClass(right,\n                           \"dropPreview\");\n            removeCSSClass(content,\n                           \"centerPreview\");\n        });\n        right.setOndragover(event -> event.preventDefault());\n        right.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.enableSideDnD() && presenter.shouldPreviewDrop()) {\n                removeCSSClass(right,\n                               \"columnDropPreview\");\n                removeCSSClass(right,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n                presenter.onDrop(ColumnDrop.Orientation.RIGHT,\n                                 extractDndData(e));\n            }\n        });\n        right.setOnmouseover(e -> {\n            e.preventDefault();\n            if (presenter.canResizeRight()) {\n                addCSSClass(right,\n                            \"colResizeRight\");\n            } else {\n                removeCSSClass(right,\n                               \"colResizeRight\");\n            }\n        });\n        right.setOnmouseout(e -> {\n            e.preventDefault();\n            if (!presenter.canResizeRight()) {\n                removeCSSClass(right,\n                               \"colResizeRight\");\n            }\n        });\n        right.setOnclick(e -> {\n            e.preventDefault();\n            if (presenter.canResizeRight()) {\n                presenter.resizeRight();\n            }\n        });\n    }\n\n    private void setupContentEvents() {\n        content.setOndragover(e -> {\n            e.preventDefault();\n            if (presenter.shouldPreviewDrop()) {\n                if (dragOverUp(content,\n                               (MouseEvent) e)) {\n                    addCSSClass(colUp,\n                                \"componentDropInColumnPreview\");\n                    removeCSSClass(colDown,\n                                   \"componentDropInColumnPreview\");\n                    contentDropOrientation = ColumnDrop.Orientation.UP;\n                } else {\n                    addCSSClass(colDown,\n                                \"componentDropInColumnPreview\");\n                    removeCSSClass(colUp,\n                                   \"componentDropInColumnPreview\");\n                    contentDropOrientation = ColumnDrop.Orientation.DOWN;\n                }\n            }\n        });\n        content.setOndragleave(e -> {\n            e.preventDefault();\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n            contentDropOrientation = null;\n        });\n        content.setOndrop(e -> {\n            e.preventDefault();\n            if (contentDropOrientation != null) {\n                presenter.onDrop(contentDropOrientation,\n                                 extractDndData(e));\n            }\n            removeCSSClass(colUp,\n                           \"componentDropInColumnPreview\");\n            removeCSSClass(colDown,\n                           \"componentDropInColumnPreview\");\n        });\n        content.setOnclick(e -> {\n            e.preventDefault();\n            presenter.onSelected();\n        });\n        content.setOnmouseout(e -> {\n            removeCSSClass(content,\n                           \"componentMovePreview\");\n        });\n        content.setOnmouseover(e -> {\n            e.preventDefault();\n            addCSSClass(content,\n                        \"componentMovePreview\");\n        });\n        content.setOndragend(e -> {\n            e.stopPropagation();\n            removeCSSClass(row,\n                           \"rowDndPreview\");\n            presenter.dragEndComponent();\n        });\n        content.setOndragstart(e -> {\n            e.stopPropagation();\n            e.getDataTransfer().setData(\"text/plain\",\n                                        \"this-is-a-requirement-to-firefox-html5dnd\");\n            addCSSClass(row,\n                        \"rowDndPreview\");\n            presenter.dragStartComponent();\n        });\n    }\n\n    private void setupLeftEvents() {\n        left.setOndragleave(e -> {\n            e.preventDefault();\n            removeCSSClass(left,\n                           \"columnDropPreview\");\n            removeCSSClass(left,\n                           \"dropPreview\");\n            removeCSSClass(content,\n                           \"centerPreview\");\n        });\n        left.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.enableSideDnD() && presenter.shouldPreviewDrop()) {\n                removeCSSClass(left,\n                               \"columnDropPreview\");\n                removeCSSClass(left,\n                               \"dropPreview\");\n                removeCSSClass(content,\n                               \"centerPreview\");\n                presenter.onDrop(ColumnDrop.Orientation.LEFT,\n                                 extractDndData(e));\n            }\n        });\n\n        left.setOndragover(event -> {\n            if (presenter.enableSideDnD() && presenter.shouldPreviewDrop()) {\n                event.preventDefault();\n            }\n        });\n        left.setOndragexit(event -> {\n            event.preventDefault();\n            removeCSSClass(left,\n                           \"columnDropPreview\");\n            removeCSSClass(left,\n                           \"dropPreview\");\n            removeCSSClass(content,\n                           \"centerPreview\");\n        });\n        left.setOndragenter(e -> {\n            e.preventDefault();\n            if (presenter.enableSideDnD() && presenter.shouldPreviewDrop()) {\n                addCSSClass(left,\n                            \"columnDropPreview\");\n                addCSSClass(left,\n                            \"dropPreview\");\n                addCSSClass(content,\n                            \"centerPreview\");\n                removeCSSClass(colUp,\n                               \"componentDropInColumnPreview\");\n            }\n        });\n        left.setOnmouseover(e -> {\n            e.preventDefault();\n            if (presenter.canResizeLeft()) {\n                addCSSClass(left,\n                            \"colResizeLeft\");\n            } else {\n                removeCSSClass(left,\n                               \"colResizeLeft\");\n            }\n        });\n        left.setOnmouseout(e -> {\n            e.preventDefault();\n            if (!presenter.canResizeLeft()) {\n                removeCSSClass(left,\n                               \"colResizeLeft\");\n            }\n        });\n        left.setOnclick(e -> {\n            e.preventDefault();\n            if (presenter.canResizeLeft()) {\n                presenter.resizeLeft();\n            }\n        });\n    }\n\n    public void resizeEventObserver(@Observes ContainerResizeEvent event) {\n        calculateWidth();\n    }\n\n    @Override\n    public void calculateWidth() {\n        Scheduler.get().scheduleDeferred(() -> {\n            controlPadding();\n            calculateLeftRightWidth();\n            calculateContentWidth();\n            addCSSClass(col,\n                        \"container\");\n        });\n    }\n\n    private void controlPadding() {\n        if (!presenter.isInnerColumn()) {\n            addCSSClass(col,\n                        \"no-padding\");\n        } else {\n            if (hasCSSClass(col,\n                            \"no-padding\")) {\n                removeCSSClass(col,\n                               \"no-padding\");\n            }\n        }\n    }\n\n    private void calculateLeftRightWidth() {\n        if (originalLeftRightWidth >= 0) {\n            left.getStyle().setProperty(\"width\",\n                                        originalLeftRightWidth + \"px\");\n            right.getStyle().setProperty(\"width\",\n                                         originalLeftRightWidth + \"px\");\n        }\n    }\n\n    private void calculateContentWidth() {\n        int smallSpace = 2;\n        final int colWidth = col.getBoundingClientRect().getWidth().intValue();\n        final int contentWidth = colWidth - (originalLeftRightWidth * 2) - smallSpace;\n        if (contentWidth >= 0) {\n            content.getStyle().setProperty(\"width\",\n                                           contentWidth + \"px\");\n        }\n    }\n\n    @Override\n    public void setWidth(String size) {\n        if (!col.getClassName().isEmpty()) {\n            removeCSSClass(col,\n                           widthSize);\n        }\n        widthSize = COL_CSS_CLASS + size;\n        addCSSClass(col,\n                    widthSize);\n    }\n\n    @Override\n    public void clearContent() {\n        removeAllChildren(content);\n        removeCurrentWidget();\n    }\n\n    @Override\n    public void setContent() {\n        Scheduler.get().scheduleDeferred(() -> {\n            removeAllChildren(content);\n            HTMLElement previewWidget = getPreviewElement();\n            content.appendChild(kebabWidget.getElement());\n            content.appendChild(previewWidget);\n            layoutEditorFocusController.restoreFocus();\n        });\n    }\n\n    @Override\n    public void showConfigComponentModal(Command configurationFinish,\n                                         Command configurationCanceled,\n                                         Supplier<LayoutTemplate> currentLayoutTemplateSupplier) {\n        helper.showConfigModal(configurationFinish,\n                               configurationCanceled,\n                               currentLayoutTemplateSupplier);\n    }\n\n    @Override\n    public boolean hasModalConfiguration() {\n        return helper.hasModalConfiguration();\n    }\n\n    @Override\n    public void setup(LayoutComponent layoutComponent,\n                      LayoutTemplate.Style pageStyle) {\n        helper.setup(layoutComponent, pageStyle);\n    }\n\n    @Override\n    public void setSelected(boolean selected) {\n        removeCSSClass(content, \"componentMovePreview\");\n        String txt = presenter.isSelectable() ? CommonConstants.INSTANCE.SelectColumnHint() : CommonConstants.INSTANCE.DragColumnHint();\n        content.setTitle(txt);\n        if (selected) {\n            addCSSClass(content, \"componentMovePreview\");\n            content.setTitle(CommonConstants.INSTANCE.UnselectColumnHint());\n        }\n    }\n\n    private HTMLElement getPreviewElement() {\n        HTMLElement previewElement = helper.getPreviewElement(ElementWrapperWidget.getWidget(content));\n        previewElement.getStyle().setProperty(\"cursor\",\n                                              \"default\");\n\n        addCSSClass(previewElement,\n                    \"le-widget\");\n        addCSSClass(previewElement,\n                    \"uf-perspective-col\");\n        return previewElement;\n    }\n\n    private boolean hasColPreview(HTMLElement element) {\n        return hasCSSClass(element,\n                           \"componentDropInColumnPreview\");\n    }\n\n    private boolean dragOverUp(Div div,\n                               MouseEvent e) {\n\n        final int top = div.getBoundingClientRect().getTop().intValue();\n        final int bottom = div.getBoundingClientRect().getBottom().intValue();\n\n        int dragOverY = e.getClientY();\n\n        return (dragOverY - top) < (bottom - dragOverY);\n    }\n\n    @Override\n    public void notifyDragEnd() {\n        removeCSSClass(colUp,\n                       \"componentDropInColumnPreview\");\n    }\n\n    @Override\n    public LayoutDragComponent getLayoutDragComponent() {\n        return helper.getLayoutDragComponent();\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/container/Container.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.container;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Supplier;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropEvent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropType;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.rows.EmptyDropRow;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDnDEvent;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDrop;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementSelectEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementUnselectEvent;\nimport org.uberfire.ext.layout.editor.client.infra.*;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class Container implements LayoutEditorElement {\n\n    private final Instance<Row> rowInstance;\n    private final Instance<EmptyDropRow> emptyDropRowInstance;\n    private final View view;\n    private LayoutTemplate layoutTemplate;\n    private String id;\n    private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n    private LayoutEditorCssHelper layoutCssHelper;\n    private List<Row> rows = new ArrayList<>();\n    private EmptyDropRow emptyDropRow;\n    private String layoutName;\n    private String emptyTitleText;\n    private String emptySubTitleText;\n    private Map<String, String> properties = new HashMap<>();\n    private Event<ComponentDropEvent> componentDropEvent;\n    private LayoutTemplate.Style pageStyle = LayoutTemplate.Style.FLUID;\n    private Event<LayoutEditorElementSelectEvent> containerSelectEvent;\n    private Event<LayoutEditorElementUnselectEvent> containerUnselectEvent;\n    private Event<LockRequiredEvent> lockRequiredEvent;\n    private DnDManager dndManager;\n    private boolean selectable = false;\n    private boolean selected = false;\n    private Supplier<Boolean> lockSupplier = () -> false;\n\n    LayoutEditorFocusController layoutEditorFocusController;\n\n    @Inject\n    public Container(final View view,\n                     LayoutEditorCssHelper layoutCssHelper,\n                     Instance<Row> rowInstance,\n                     Instance<EmptyDropRow> emptyDropRowInstance,\n                     Event<ComponentDropEvent> componentDropEvent,\n                     Event<LayoutEditorElementSelectEvent> containerSelectEvent,\n                     Event<LayoutEditorElementUnselectEvent> containerUnselectEvent,\n                     Event<LockRequiredEvent> lockRequiredEvent,\n                     DnDManager dndManager,\n                     LayoutEditorFocusController layoutEditorFocusController) {\n        this.layoutCssHelper = layoutCssHelper;\n        this.rowInstance = rowInstance;\n        this.emptyDropRowInstance = emptyDropRowInstance;\n        this.view = view;\n        this.componentDropEvent = componentDropEvent;\n        this.containerSelectEvent = containerSelectEvent;\n        this.containerUnselectEvent = containerUnselectEvent;\n        this.lockRequiredEvent = lockRequiredEvent;\n        this.dndManager = dndManager;\n        this.layoutEditorFocusController = layoutEditorFocusController;\n        this.id = idGenerator.createContainerID();\n    }\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n        init();\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        for (Row row : rows) {\n            destroy(row);\n        }\n        destroy(emptyDropRow);\n    }\n\n    private void init() {\n        view.clear();\n        for (Row row : rows) {\n            destroy(row);\n        }\n        rows = new ArrayList<>();\n    }\n\n    public void setLockSupplier(Supplier<Boolean> lockSupplier) {\n        this.lockSupplier = lockSupplier;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public LayoutEditorElementType geElementType() {\n        return LayoutEditorElementType.CONTAINER;\n    }\n\n    @Override\n    public LayoutEditorElement getParentElement() {\n        return null;\n    }\n\n    @Override\n    public void setSelectable(boolean selectable) {\n        this.selectable = selectable;\n        view.setSelectEnabled(selectable);\n    }\n\n    public boolean isSelectable() {\n        return selectable;\n    }\n\n    @Override\n    public boolean isSelected() {\n        return selected;\n    }\n\n    @Override\n    public void setSelected(boolean status) {\n        if (isSelectable()) {\n            if (status) {\n                selected = true;\n                view.setSelected(true);\n            } else {\n                selected = false;\n                view.setSelected(false);\n            }\n        }\n    }\n\n    private void createEmptyDropRow() {\n        emptyDropRow = createEmptyRow();\n        view.addEmptyRow(emptyDropRow.getView());\n    }\n\n    public void loadEmptyLayout(String layoutName,\n                                LayoutTemplate.Style pageStyle,\n                                String emptyTitleText,\n                                String emptySubTitleText) {\n        this.layoutName = layoutName;\n        this.pageStyle = pageStyle;\n        this.emptyTitleText = emptyTitleText;\n        this.emptySubTitleText = emptySubTitleText;\n        clearView();\n        createEmptyDropRow();\n        setupResizeRows();\n    }\n\n    public void load(LayoutTemplate layoutTemplate,\n                     String emptyTitleText,\n                     String emptySubTitleText) {\n        this.layoutTemplate = layoutTemplate;\n        this.layoutName = layoutTemplate.getName();\n        this.pageStyle = layoutTemplate.getStyle();\n        this.emptyTitleText = emptyTitleText;\n        this.emptySubTitleText = emptySubTitleText;\n        this.rows.forEach(this::destroy);\n        this.rows.clear();\n        if (!layoutTemplate.isEmpty()) {\n            this.properties = layoutTemplate.getLayoutProperties();\n            for (LayoutRow layoutRow : layoutTemplate.getRows()) {\n                rows.add(load(layoutRow));\n            }\n            updateView();\n        } else {\n            clearView();\n            createEmptyDropRow();\n        }\n        setupResizeRows();\n        setupCssProperties();\n        layoutEditorFocusController.setTargetContainerView(view);\n    }\n\n    public void reset() {\n        init();\n        layoutTemplate = null;\n        emptyTitleText = null;\n        emptySubTitleText = null;\n        layoutName = null;\n        properties.clear();;\n        emptyDropRow = null;\n        pageStyle = LayoutTemplate.Style.FLUID;\n    }\n\n    private EmptyDropRow createEmptyRow() {\n        emptyDropRow = createInstanceEmptyDropRow();\n        emptyDropRow.init(createEmptyDropCommand(),\n                          emptyTitleText,\n                          emptySubTitleText);\n        return emptyDropRow;\n    }\n\n    protected EmptyDropRow createInstanceEmptyDropRow() {\n        EmptyDropRow emptyDropRow = emptyDropRowInstance.get();\n        emptyDropRow.setId(idGenerator.createRowID(id));\n        return emptyDropRow;\n    }\n\n    public ParameterizedCommand<RowDrop> createEmptyDropCommand() {\n        return (drop) -> {\n            destroy(emptyDropRow);\n            notifyDrop(drop);\n            rows.add(createRow(drop,\n                               Row.ROW_DEFAULT_HEIGHT));\n            updateView();\n        };\n    }\n\n    private void notifyDrop(RowDrop rowDrop) {\n        componentDropEvent.fire(new ComponentDropEvent(rowDrop.getComponent(),\n                                                       rowDrop.getType().equals(ComponentDropType.FROM_MOVE)));\n    }\n\n    private Row createRow(RowDrop drop,\n                          Integer height) {\n        final Row row = createInstanceRow();\n        row.init(createRowDropCommand(),\n                 createRemoveRowCommand(),\n                 createRemoveComponentCommand(),\n                 createCurrentLayoutTemplateSupplier(),\n                 getLockSupplier(),\n                 height);\n        row.withOneColumn(drop.getComponent(),\n                          drop.newComponent());\n        view.addRow(row.getView());\n        return row;\n    }\n\n    public Supplier<Boolean> getLockSupplier() {\n        return () -> lockSupplier.get();\n    }\n\n    Supplier<LayoutTemplate> createCurrentLayoutTemplateSupplier() {\n        return () -> toLayoutTemplate();\n    }\n\n    private ParameterizedCommand<Row> createRemoveRowCommand() {\n        return (row) -> {\n            removeRow(row);\n        };\n    }\n\n    private void removeRow(Row row) {\n        if (needToUpdateSizeOfMySiblings(row)) {\n            updateHeightOfSiblingRow(row);\n        }\n        this.rows.remove(row);\n        destroy(row);\n        if (layoutIsEmpty()) {\n            init();\n            createEmptyDropRow();\n        } else {\n            updateView();\n        }\n    }\n\n    private void updateHeightOfSiblingRow(Row rowToRemove) {\n        final int removeIndex = getRowIndex(rowToRemove);\n        if (firstRow(removeIndex)) {\n            if (hasDownSibling(removeIndex,\n                               rows)) {\n                final Row sibling = rows.get(removeIndex + 1);\n                Integer newSize = (sibling.getHeight() + rowToRemove.getHeight());\n                sibling.setHeight(newSize);\n            }\n        } else {\n            final Row sibling = rows.get(removeIndex - 1);\n            Integer newSize = sibling.getHeight() + rowToRemove.getHeight();\n            sibling.setHeight(newSize);\n        }\n    }\n\n    private boolean needToUpdateSizeOfMySiblings(Row row) {\n        return !row.getHeight().equals(Row.ROW_DEFAULT_HEIGHT);\n    }\n\n    private ParameterizedCommand<ColumnDrop> createRemoveComponentCommand() {\n        return drop -> removeOldComponent(drop.getOldColumn());\n    }\n\n    private boolean layoutIsEmpty() {\n        return rows.isEmpty();\n    }\n\n    public ParameterizedCommand<RowDrop> createRowDropCommand() {\n        return (dropRow) -> {\n            List<Row> updatedRows = new ArrayList<>();\n            for (Row row : rows) {\n                handleDrop(dropRow,\n                           updatedRows,\n                           row);\n            }\n            rows = updatedRows;\n            getView();\n            lockRequiredEvent.fire(new LockRequiredEvent());\n        };\n    }\n\n    private void handleDrop(RowDrop dropRow,\n                            List<Row> updatedRows,\n                            Row row) {\n        if (dropIsInthisRow(row,\n                            dropRow)) {\n            if (dropRow.newComponent()) {\n                addNewRow(row,\n                          dropRow,\n                          updatedRows);\n            } else {\n                handleMoveComponent(dropRow,\n                                    updatedRows,\n                                    row);\n            }\n        } else {\n            updatedRows.add(row);\n        }\n    }\n\n    private void handleMoveComponent(RowDrop dropRow,\n                                     List<Row> updatedRows,\n                                     Row row) {\n        removeOldComponent(dropRow.getOldColumn());\n        addNewRow(row,\n                  dropRow,\n                  updatedRows);\n        // notifying dndManager that the move has finished!\n        dndManager.endComponentMove();\n    }\n\n    private void removeOldComponent(Column column) {\n\n        // Search the row that contains the column\n        Optional<Row> rowOptional = rows.stream()\n                .filter(row -> row.cointainsColumn(column))\n                .findAny();\n\n        // If the row is present remove it!\n        if (rowOptional.isPresent()) {\n            rowOptional.get().removeChildColumn(column);\n        }\n    }\n\n    private void addNewRow(Row currentRow,\n                           RowDrop dropRow,\n                           List<Row> newRows) {\n        Integer newRowHeight;\n        if (pageStyle == LayoutTemplate.Style.PAGE) {\n            newRowHeight = currentRow.getHeight() / 2;\n        } else {\n            newRowHeight = currentRow.getHeight();\n        }\n        if (newRowIsBeforeThisRow(dropRow)) {\n            newRows.add(createRow(dropRow,\n                                  newRowHeight));\n            if (pageStyle == LayoutTemplate.Style.PAGE) {\n                setupRowSize(currentRow);\n            }\n            if (!currentRow.rowIsEmpty()) {\n                newRows.add(currentRow);\n            }\n        } else {\n            if (!currentRow.rowIsEmpty()) {\n                newRows.add(currentRow);\n            }\n            newRows.add(createRow(dropRow,\n                                  newRowHeight));\n            if (pageStyle == LayoutTemplate.Style.PAGE) {\n                setupRowSize(currentRow);\n            }\n        }\n        notifyDrop(dropRow);\n    }\n\n    private void setupRowSize(Row currentRow) {\n        Integer originalSize = currentRow.getHeight();\n        Integer newColumnSize = originalSize / 2;\n        if (originalSize % 2 == 0) {\n            currentRow.setHeight(newColumnSize);\n        } else {\n            newColumnSize = newColumnSize + 1;\n            currentRow.setHeight(newColumnSize);\n        }\n    }\n\n    private boolean newRowIsBeforeThisRow(RowDrop dropRow) {\n        return dropRow.getOrientation() == RowDrop.Orientation.BEFORE;\n    }\n\n    private boolean dropIsInthisRow(Row row,\n                                    RowDrop dropRow) {\n        return dropRow.getRowId() == row.getId();\n    }\n\n    private void clearView() {\n        view.clear();\n    }\n\n    protected void swapRows(@Observes RowDnDEvent rowDndEvent) {\n        List<Row> newRows = new ArrayList<>();\n        Row beginRow = lookForBeginningRow(rowDndEvent);\n\n        if (beginRow != null) {\n            for (Row row : rows) {\n                if (row.getId() == rowDndEvent.getRowIdEnd()) {\n                    if (rowDndEvent.getOrientation() == RowDrop.Orientation.AFTER) {\n                        newRows.add(row);\n                        newRows.add(beginRow);\n                    } else {\n                        newRows.add(beginRow);\n                        newRows.add(row);\n                    }\n                } else {\n                    if (row.getId() != beginRow.getId()) {\n                        newRows.add(row);\n                    }\n                }\n            }\n            this.rows = newRows;\n        }\n\n        updateView();\n    }\n\n    private Row lookForBeginningRow(@Observes RowDnDEvent rowDndEvent) {\n        Row beginRow = null;\n\n        for (Row row : rows) {\n            if (row.getId() == rowDndEvent.getRowIdBegin()) {\n                beginRow = row;\n            }\n        }\n        return beginRow;\n    }\n\n    public String getLayoutName() {\n        return layoutName;\n    }\n\n    private Row load(LayoutRow layoutRow) {\n        final Row row = createInstanceRow();\n        row.load(createRowDropCommand(),\n                 layoutRow,\n                 createRemoveRowCommand(),\n                 createRemoveComponentCommand(),\n                 createCurrentLayoutTemplateSupplier(),\n                 getLockSupplier());\n        return row;\n    }\n\n    protected Row createInstanceRow() {\n        Row row = rowInstance.get();\n        row.setSelectable(selectable);\n        row.setup(this, idGenerator.createRowID(id),\n                  pageStyle);\n        return row;\n    }\n\n    public void addProperty(String key,\n                            String value) {\n        properties.put(key,\n                       value);\n    }\n\n    public String getProperty(String key) {\n        return properties.get(key);\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public void setProperty(String property, String value) {\n        properties.put(property, value);\n        setupCssProperties();\n    }\n\n    @Override\n    public void removeProperty(String property) {\n        properties.remove(property);\n        setupCssProperties();\n    }\n\n    @Override\n    public void clearProperties() {\n        properties.clear();\n        setupCssProperties();\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return layoutCssHelper.getContainerPropertyCategories(this);\n    }\n\n    public LayoutTemplate toLayoutTemplate() {\n        LayoutTemplate convert = LayoutTemplateAdapter.convert(this);\n        return convert;\n    }\n\n    public List<Row> getRows() {\n        return rows;\n    }\n\n    void updateView() {\n        layoutEditorFocusController.recordFocus();\n        cleanupEmptyRows();\n        setupPageStyle();\n        setupResizeRows();\n        if (!rows.isEmpty()) {\n            clearView();\n            for (Row row : rows) {\n                view.addRow(row.getView());\n            }\n        }\n    }\n\n    private void cleanupEmptyRows() {\n        List<Row> rowsToRemove = new ArrayList<>();\n        for (Row row : rows) {\n            if (row.rowIsEmpty()) {\n                rowsToRemove.add(row);\n            }\n        }\n        for (Row row : rowsToRemove) {\n            removeRow(row);\n        }\n    }\n\n    private void setupResizeRows() {\n        for (int i = 0; i < rows.size(); i++) {\n            Row row = rows.get(i);\n            setupRowResizeActions(rows,\n                                  row,\n                                  i);\n        }\n    }\n\n    private void setupRowResizeActions(List<Row> rows,\n                                       Row row,\n                                       int index) {\n        if (pageStyle == LayoutTemplate.Style.FLUID) {\n            row.setupResize(false,\n                            false);\n        } else {\n            if (firstRow(index)) {\n                boolean canResizeDown = canResizeDown(index,\n                                                      rows);\n                row.setupResize(false,\n                                canResizeDown);\n            } else {\n                row.setupResize(canResizeUp(index,\n                                            rows),\n                                canResizeDown(index,\n                                              rows));\n            }\n        }\n    }\n\n    private boolean canResizeDown(int index,\n                                  List<Row> rows) {\n        if (hasDownSibling(index,\n                           rows)) {\n            Row downSibling = rows.get(index + 1);\n            return downSibling.getHeight() > 1;\n        }\n        return false;\n    }\n\n    private boolean hasDownSibling(int index,\n                                   List<Row> rows) {\n        return rows.size() > index + 1;\n    }\n\n    private boolean canResizeUp(int index,\n                                List<Row> rows) {\n        return (rows.get(index - 1).getHeight() > 1);\n    }\n\n    private boolean firstRow(int index) {\n        return index == 0;\n    }\n\n    private void setupPageStyle() {\n        if (pageStyle == LayoutTemplate.Style.PAGE) {\n            view.pageMode();\n        }\n    }\n\n    private void setupCssProperties() {\n        List<CssValue> cssValueList = layoutCssHelper.readCssValues(properties);\n        view.applyCssValues(cssValueList);\n    }\n\n    public View getView() {\n        updateView();\n        return view;\n    }\n\n    public void resizeRows(@Observes RowResizeEvent resize) {\n        if (resizeEventIsinThisContainer(resize)) {\n\n            Row resizedRow = getRow(resize);\n            if (resizedRow != null) {\n                Row affectedRow = null;\n                if (resize.isUP()) {\n                    affectedRow = lookUpForUpperNeighbor(resizedRow);\n                } else {\n                    affectedRow = lookUpForBottomNeighbor(resizedRow);\n                }\n                if (affectedRow != null) {\n                    resizedRow.incrementHeight();\n                    affectedRow.reduceHeight();\n                }\n            }\n            setupResizeRows();\n        }\n    }\n\n    private boolean resizeEventIsinThisContainer(@Observes RowResizeEvent resize) {\n        return resize.getContainerHash() == hashCode();\n    }\n\n    private Row lookUpForUpperNeighbor(Row resizedRow) {\n        return rows\n                .get(getRowIndex(resizedRow) - 1);\n    }\n\n    private Row lookUpForBottomNeighbor(Row resizedRow) {\n        return rows\n                .get(getRowIndex(resizedRow) + 1);\n    }\n\n    private int getRowIndex(Row row) {\n        return rows.indexOf(row);\n    }\n\n    private Row getRow(RowResizeEvent resize) {\n        for (Row row : getRows()) {\n            if (resize.getRowHash() == row.hashCode()) {\n                return row;\n            }\n        }\n        return null;\n    }\n\n    EmptyDropRow getEmptyDropRow() {\n        return emptyDropRow;\n    }\n\n    protected void destroy(Object o) {\n        BeanHelper.destroy(o);\n    }\n\n    public LayoutTemplate.Style getPageStyle() {\n        return pageStyle;\n    }\n\n    public void onSelected() {\n        if (isSelectable()) {\n            if (selected) {\n                containerUnselectEvent.fire(new LayoutEditorElementUnselectEvent(this));\n            } else {\n                containerSelectEvent.fire(new LayoutEditorElementSelectEvent(this));\n            }\n        }\n    }\n    \n    public List<Row> getChildElements() {\n        return rows;\n    }\n\n    public interface View extends UberElement<Container> {\n\n        void addRow(UberElement<Row> view);\n\n        void clear();\n\n        void addEmptyRow(UberElement<EmptyDropRow> emptyDropRow);\n\n        void pageMode();\n\n        void setSelectEnabled(boolean enabled);\n\n        void setSelected(boolean selected);\n\n        void applyCssValues(List<CssValue> cssValues);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/container/ContainerView.css",
    "content": ".container-canvas {\n    background-color: white;\n    /*border*/\n    border: 1px solid #b1caf2;\n    -webkit-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n    -moz-box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;;\n    box-shadow: 2px 4px 6px 1px rgba(211, 211, 211, 0.25) !important;\n\n    padding-left: 25px;\n    padding-right: 25px;\n    padding-top: 7px;\n    padding-bottom: 7px;\n}\n\n.page-container{\n    height:100%;\n}\n\n.container-empty {\n    padding: 0px;\n    height:100%;\n}\n\n.container-header {\n    height: 15px;\n    cursor: pointer;\n    margin-top: -15px;\n}\n\n.container-selected {\n    border-color: #33a6cc !important;\n}\n\n.resolution {\n    text-align: center;\n    font-size: 20px;\n}\n\n.simulate-xs .col-md-1 {\n    width: 100%\n}\n\n.simulate-xs .col-md-2 {\n    width: 100%\n}\n\n.simulate-xs .col-md-3 {\n    width: 100%\n}\n\n.simulate-xs .col-md-4 {\n    width: 100%\n}\n\n.simulate-xs .col-md-5 {\n    width: 100%\n}\n\n.simulate-xs .col-md-6 {\n    width: 100%\n}\n\n.simulate-xs .col-md-7 {\n    width: 100%\n}\n\n.simulate-xs .col-md-8 {\n    width: 100%\n}\n\n.simulate-xs .col-md-9 {\n    width: 100%\n}\n\n.simulate-xs .col-md-10 {\n    width: 100%\n}\n\n.simulate-xs .col-md-11 {\n    width: 100%\n}\n\n.simulate-xs .col-md-12 {\n    width: 100%\n}\n\n.simulate-sm .col-md-2 {\n    width: 20%\n}\n\n.simulate-sm .col-md-4 {\n    width: 50%\n}\n\n.simulate-sm .col-md-6 {\n    width: 100%\n}\n\n\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/container/ContainerView.html",
    "content": "<div id=\"container\" class=\"le-full-height\">\n    <div id=\"layout\" class=\"container-fluid container-canvas\">\n        <div id=\"header\" class=\"container-header\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/container/ContainerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.container;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\nimport org.uberfire.ext.layout.editor.client.components.rows.EmptyDropRow;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.infra.ContainerResizeEvent;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\n\nimport java.util.List;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.hasCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeAllChildren;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\n\n@Dependent\n@Templated\npublic class ContainerView\n        implements UberElement<Container>,\n                   Container.View,\n                   IsElement {\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    @DataField\n    Div container;\n\n    @Inject\n    @DataField\n    Div header;\n\n    @Inject\n    @DataField\n    Div layout;\n\n    private Container presenter;\n\n    @Inject\n    private Event<ContainerResizeEvent> resizeEvent;\n\n    @Override\n    public void init(Container presenter) {\n        this.presenter = presenter;\n        this.setupEvents();\n    }\n\n    private void setupEvents() {\n        header.setOnclick(e -> {\n            e.preventDefault();\n            presenter.onSelected();\n        });\n        header.setOnmouseover(e -> {\n            e.preventDefault();\n            if (!presenter.isSelected()) {\n                addCSSClass(layout, \"container-selected\");\n            }\n        });\n        header.setOnmouseout(e -> {\n            e.preventDefault();\n            if (!presenter.isSelected()) {\n                removeCSSClass(layout, \"container-selected\");\n            }\n        });\n    }\n    @Override\n    public void addRow(UberElement<Row> view) {\n        if (!hasCSSClass(layout,\n                         \"container-canvas\")) {\n            addCSSClass(layout,\n                        \"container-canvas\");\n        }\n        removeCSSClass(layout,\n                       \"container-empty\");\n        layout.appendChild(view.getElement());\n    }\n\n    @Override\n    public void clear() {\n        removeAllChildren(layout);\n        layout.appendChild(header);\n    }\n\n    @Override\n    public void addEmptyRow(UberElement<EmptyDropRow> emptyDropRow) {\n        removeCSSClass(layout,\n                       \"container-canvas\");\n        addCSSClass(layout,\n                    \"container-empty\");\n        layout.appendChild(emptyDropRow.getElement());\n    }\n\n    @Override\n    public void pageMode() {\n        addCSSClass(layout,\n                    \"page-container\");\n    }\n\n    @Override\n    public void setSelectEnabled(boolean enabled) {\n        header.setTitle(enabled ? CommonConstants.INSTANCE.SelectContainerHint() : \"\");\n    }\n\n    @Override\n    public void setSelected(boolean selected) {\n        removeCSSClass(layout, \"container-selected\");\n        header.setTitle(CommonConstants.INSTANCE.SelectContainerHint());\n        if (selected) {\n            addCSSClass(layout, \"container-selected\");\n            header.setTitle(CommonConstants.INSTANCE.UnselectContainerHint());\n        }\n    }\n\n    @Override\n    public void applyCssValues(List<CssValue> cssValues) {\n        layout.getStyle().setCssText(\"\");\n        cssValues.forEach(cssValue -> {\n            String prop = cssValue.getProperty();\n            String val = cssValue.getValue();\n            layout.getStyle().setProperty(prop, val);\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/EmptyDropRow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.infra.DndDataJSONConverter;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutDragComponentHelper;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class EmptyDropRow {\n\n    private final View view;\n    private String id;\n    private DndDataJSONConverter converter = new DndDataJSONConverter();\n    private ParameterizedCommand<RowDrop> dropCommand;\n    private LayoutDragComponentHelper layoutDragComponentHelper;\n    @Inject\n    public EmptyDropRow(final View view,\n                        LayoutDragComponentHelper layoutDragComponentHelper) {\n        this.view = view;\n        this.layoutDragComponentHelper = layoutDragComponentHelper;\n    }\n\n    @PostConstruct\n    public void post() {\n        view.init(this);\n    }\n\n    public void init(ParameterizedCommand<RowDrop> dropCommand,\n                     String titleText,\n                     String subTitleText) {\n        this.dropCommand = dropCommand;\n        view.setupText(titleText,\n                       subTitleText);\n    }\n\n    public void drop(String dropData) {\n        LayoutDragComponent component = extractComponent(dropData);\n        if (thereIsAComponent(component)) {\n            dropCommand.execute(new RowDrop(layoutDragComponentHelper.getLayoutComponent(component),\n                                            id,\n                                            RowDrop.Orientation.AFTER));\n        }\n    }\n\n    private LayoutDragComponent extractComponent(String dropData) {\n        return converter\n                .readJSONDragComponent(dropData);\n    }\n\n    private boolean thereIsAComponent(LayoutDragComponent component) {\n        return component != null;\n    }\n\n    public UberElement<EmptyDropRow> getView() {\n        return view;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public interface View extends UberElement<EmptyDropRow> {\n\n        void setupText(String titleText,\n                       String subTitleText);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/EmptyDropRowView.css",
    "content": ".rowDropPreview{\n    height: 20px;\n\n}\n.emptyRow{\n    text-align: center;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/EmptyDropRowView.html",
    "content": "<div data-field=\"row\" class=\"le-empty le-empty-border\">\n    <div data-field=\"inner-row\">\n        <i class=\"fa fa-arrows le-empty-icon\" aria-hidden=\"true\"></i>\n        <h1 data-field=\"title\"></h1>\n        <span data-field=\"subtitle\"></span>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/EmptyDropRowView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Heading;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.hasCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\nimport static org.uberfire.ext.layout.editor.client.infra.HTML5DnDHelper.extractDndData;\n\n@Dependent\n@Templated\npublic class EmptyDropRowView\n        implements UberElement<EmptyDropRow>,\n                   EmptyDropRow.View,\n                   IsElement {\n\n    private EmptyDropRow presenter;\n\n    @Inject\n    @DataField\n    private Div row;\n\n    @Inject\n    @DataField(\"inner-row\")\n    private Div innerRow;\n\n    @Inject\n    @Named(\"h1\")\n    @DataField\n    private Heading title;\n\n    @Inject\n    @DataField\n    private Span subtitle;\n\n    @Override\n    public void init(EmptyDropRow presenter) {\n        this.presenter = presenter;\n        row.setOndragover(event -> {\n            event.preventDefault();\n            addSelectEmptyBorder();\n        });\n        row.setOndragenter(event -> {\n            addSelectEmptyBorder();\n        });\n        row.setOndragleave(event -> {\n            removeSelectedBorder();\n        });\n\n        row.setOndrop(e -> {\n            e.preventDefault();\n            presenter.drop(extractDndData(e));\n        });\n    }\n\n    @Override\n    public void setupText(String titleText,\n                          String subTitleText) {\n        title.setTextContent(titleText);\n        subtitle.setTextContent(subTitleText);\n    }\n\n    private void removeSelectedBorder() {\n        if (hasCSSClass(row,\n                        \"le-empty-preview-drop\")) {\n            removeCSSClass(row,\n                           \"le-empty-preview-drop\");\n            removeCSSClass(innerRow,\n                           \"le-empty-inner-preview-drop\");\n        }\n    }\n\n    private void addSelectEmptyBorder() {\n        if (!hasCSSClass(row,\n                         \"le-empty-preview-drop\")) {\n            addCSSClass(row,\n                        \"le-empty-preview-drop\");\n            addCSSClass(innerRow,\n                        \"le-empty-inner-preview-drop\");\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/Row.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport java.util.*;\nimport java.util.function.Supplier;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.*;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ColumnWithComponents;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumn;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementSelectEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementUnselectEvent;\nimport org.uberfire.ext.layout.editor.client.infra.*;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class Row implements LayoutEditorElement {\n\n    public static final Integer ROW_DEFAULT_HEIGHT = 12;\n    public static final int ROW_MIN_HEIGHT = 2;\n\n    private final LayoutDragComponentHelper layoutDragComponentHelper;\n    private LayoutEditorCssHelper layoutCssHelper;\n    private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n\n    private LayoutEditorElement parentElement;\n    private String id;\n    private Map<String,String> properties = new HashMap<>();\n    private LayoutTemplate.Style pageStyle;\n\n    private View view;\n\n    private List<Column> columns = new ArrayList<>();\n\n    private Instance<ComponentColumn> columnInstance;\n\n    private Instance<ColumnWithComponents> columnWithComponentsInstance;\n\n    private ParameterizedCommand<RowDrop> dropOnRowCommand;\n\n    private ParameterizedCommand<Row> removeRowCommand;\n\n    private ParameterizedCommand<ColumnDrop> removeComponentCommand;\n    private Supplier<LayoutTemplate> currentLayoutTemplateSupplier;\n    private Supplier<Boolean> lockSupplier;\n\n    private ColumnWithComponents parentColumnWithComponents;\n\n    private DnDManager dndManager;\n\n    private boolean dropEnable = true;\n    private boolean selectable = false;\n    private boolean selected = false;\n    private Event<ComponentDropEvent> componentDropEvent;\n    private Event<ComponentRemovedEvent> componentRemovedEvent;\n    private Event<RowResizeEvent> rowResizeEvent;\n    private Event<LayoutEditorElementSelectEvent> rowSelectEvent;\n    private Event<LayoutEditorElementUnselectEvent> rowUnselectEvent;\n\n    private Integer height;\n    private boolean canResizeUp;\n    private boolean canResizeDown;\n\n    LayoutEditorFocusController layoutEditorFocusController;\n\n    @Inject\n    public Row(View view,\n               Instance<ComponentColumn> columnInstance,\n               Instance<ColumnWithComponents> columnWithComponentsInstance,\n               DnDManager dndManager,\n               LayoutDragComponentHelper layoutDragComponentHelper,\n               LayoutEditorCssHelper layoutCssHelper,\n               Event<ComponentDropEvent> componentDropEvent,\n               Event<ComponentRemovedEvent> componentRemovedEvent,\n               Event<RowResizeEvent> rowResizeEvent,\n               Event<LayoutEditorElementSelectEvent> rowSelectEvent,\n               Event<LayoutEditorElementUnselectEvent> rowUnselectEvent,\n               LayoutEditorFocusController layoutEditorFocusController) {\n\n        this.view = view;\n        this.columnInstance = columnInstance;\n        this.columnWithComponentsInstance = columnWithComponentsInstance;\n        this.dndManager = dndManager;\n        this.layoutDragComponentHelper = layoutDragComponentHelper;\n        this.layoutCssHelper = layoutCssHelper;\n        this.componentDropEvent = componentDropEvent;\n        this.componentRemovedEvent = componentRemovedEvent;\n        this.rowResizeEvent = rowResizeEvent;\n        this.rowSelectEvent = rowSelectEvent;\n        this.rowUnselectEvent = rowUnselectEvent;\n        this.layoutEditorFocusController = layoutEditorFocusController;\n    }\n\n    public void init(ParameterizedCommand<RowDrop> dropOnRowCommand,\n                     ParameterizedCommand<Row> removeCommand,\n                     ParameterizedCommand<ColumnDrop> removeComponentCommand,\n                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,\n                     Supplier<Boolean> lockSupplier,\n                     Integer height) {\n        this.dropOnRowCommand = dropOnRowCommand;\n        this.removeRowCommand = removeCommand;\n        this.removeComponentCommand = removeComponentCommand;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n        this.lockSupplier = lockSupplier;\n        this.parentColumnWithComponents = null;\n        this.height = height;\n        setupPageLayout(height);\n    }\n\n    public void init(ParameterizedCommand<RowDrop> dropOnRowCommand,\n                     ParameterizedCommand<Row> removeCommand,\n                     ParameterizedCommand<ColumnDrop> removeComponentCommand,\n                     ColumnWithComponents parentColumnWithComponents,\n                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,\n                     Supplier<Boolean> lockSupplier,\n                     Integer height) {\n        this.dropOnRowCommand = dropOnRowCommand;\n        this.removeRowCommand = removeCommand;\n        this.removeComponentCommand = removeComponentCommand;\n        this.parentColumnWithComponents = parentColumnWithComponents;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n        this.lockSupplier = lockSupplier;\n        this.height = height;\n        setupPageLayout(height);\n    }\n\n    public void load(ParameterizedCommand<RowDrop> dropOnRowCommand,\n                     LayoutRow layoutRow,\n                     ParameterizedCommand<Row> removeCommand,\n                     ParameterizedCommand<ColumnDrop> removeComponentCommand,\n                     Supplier<LayoutTemplate> currentLayoutTemplateSupplier,\n                     Supplier<Boolean> lockSupplier) {\n        this.dropOnRowCommand = dropOnRowCommand;\n        this.removeRowCommand = removeCommand;\n        this.removeComponentCommand = removeComponentCommand;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n        this.lockSupplier = lockSupplier;\n        this.height = getHeight(layoutRow.getHeight());\n        this.properties = layoutRow.getProperties();\n        setupPageLayout(height);\n        extractColumns(layoutRow);\n        setupColumnResizeActions();\n        setupCssProperties();\n    }\n\n    private int getHeight(String layoutRow) {\n        if (shouldILoadDefaultHeight(layoutRow)) {\n            return Row.ROW_DEFAULT_HEIGHT;\n        }\n        return Integer.parseInt(layoutRow);\n    }\n\n    private boolean shouldILoadDefaultHeight(String layoutRow) {\n        return layoutRow == null || layoutRow.isEmpty();\n    }\n\n    private void setupPageLayout(Integer height) {\n        if (pageStyle == LayoutTemplate.Style.PAGE) {\n            view.setupPageLayout(height);\n        }\n    }\n\n    private void extractColumns(LayoutRow layoutRow) {\n        for (LayoutColumn layoutColumn : layoutRow.getLayoutColumns()) {\n            if (isColumnWithComponents(layoutColumn)) {\n                extractColumnWithComponents(layoutColumn);\n            } else {\n                extractComponentColumn(layoutColumn);\n            }\n        }\n    }\n\n    private void extractComponentColumn(LayoutColumn layoutColumn) {\n        ComponentColumn newComponentColumn = getComponentColumn(layoutColumn);\n        this.columns.add(newComponentColumn);\n    }\n\n    private void extractColumnWithComponents(LayoutColumn layoutColumn) {\n        for (LayoutRow row : layoutColumn.getRows()) {\n            Integer columnWidth = new Integer(layoutColumn.getSpan());\n            final ColumnWithComponents columnWithComponents = createColumnWithComponentsInstance();\n\n            columnWithComponents\n                    .init(this,\n                          columnWidth,\n                          pageStyle,\n                          dropCommand(),\n                          removeComponentCommand,\n                          removeColumnCommand(),\n                          currentLayoutTemplateSupplier,\n                          lockSupplier,\n                          getHeight(layoutColumn.getHeight()));\n\n            for (LayoutColumn column : row.getLayoutColumns()) {\n                ComponentColumn newComponentColumn = getComponentColumn(column);\n                newComponentColumn.setColumnHeight(getHeight(column.getHeight()));\n                columnWithComponents.withComponents(newComponentColumn);\n            }\n\n            this.columns.add(columnWithComponents);\n        }\n    }\n\n    public Column hasComponent(Column targetColumn) {\n        for (Column column : columns) {\n            if (targetColumn.hashCode() == column.hashCode()) {\n                return column;\n            }\n        }\n        return null;\n    }\n\n    public void dragStart() {\n        dndManager.beginRowMove(id);\n    }\n\n    public boolean canDrag() {\n        return dndManager.canMoveRow();\n    }\n\n    public void dragEndMove() {\n        dndManager.dragEndMove();\n    }\n\n    private boolean isColumnWithComponents(LayoutColumn layoutColumn) {\n        return layoutColumn.hasRows();\n    }\n\n    private ComponentColumn getComponentColumn(LayoutColumn column) {\n        LayoutComponent layoutComponent = column.getLayoutComponents().get(0);\n        return createNewComponentColumn(layoutComponent,\n                                        new Integer(\n                                                column.getSpan()),\n                                        false);\n    }\n\n    public void addColumns(ComponentColumn... _columns) {\n        for (ComponentColumn column : _columns) {\n            column.setParentElement(this);\n            column.setId(idGenerator.createColumnID(id));\n            column.setDropCommand(dropCommand());\n            columns.add(column);\n        }\n    }\n\n    public void withOneColumn(LayoutComponent layoutComponent,\n                              boolean newComponent) {\n        final ComponentColumn column = createComponentColumnInstance();\n\n        column.init(this,\n                    Column.DEFAULT_COLUMN_WIDTH,\n                    layoutComponent,\n                    dropCommand(),\n                    removeColumnCommand(),\n                    currentLayoutTemplateSupplier,\n                    lockSupplier,\n                    newComponent);\n        columns.add(column);\n        setupColumnResizeActions();\n    }\n\n    protected ComponentColumn createComponentColumnInstance() {\n        final ComponentColumn column = columnInstance.get();\n        column.setSelectable(selectable);\n        column.setup(idGenerator.createColumnID(id),\n                     pageStyle);\n        return column;\n    }\n\n    public ParameterizedCommand<ColumnDrop> dropCommand() {\n        return (drop) -> {\n            ColumnDropContext.setActiveDrop(drop);\n            if (dropFromMoveComponent(drop)) {\n                removeOldComponent(drop);\n                // notifying dndManager that the move has finished!\n                dndManager.endComponentMove();\n            }\n            notifyDrop(drop);\n            Row.this.columns = updateColumns(drop,\n                                             Row.this.columns);\n            updateView();\n            ColumnDropContext.clear();\n        };\n    }\n\n    private void notifyDrop(ColumnDrop columnDrop) {\n        componentDropEvent.fire(new ComponentDropEvent(columnDrop.getComponent(),\n                                                       columnDrop.getType().equals(ComponentDropType.FROM_MOVE)));\n    }\n\n    private void removeOldComponent(ColumnDrop drop) {\n        removeComponentCommand.execute(drop);\n    }\n\n    private boolean dropFromMoveComponent(ColumnDrop drop) {\n        return !drop.newComponent();\n    }\n\n    ParameterizedCommand<Column> removeColumnCommand() {\n        if (parentColumnWithComponents != null) {\n            return parentColumnWithComponents.getRemoveColumnCommand();\n        }\n        return (targetCol) -> {\n            removeColumn(targetCol);\n        };\n    }\n\n    public void removeColumn(Column targetColumn) {\n        removeChildColumn(targetColumn);\n    }\n\n    public void removeChildColumn(Column targetColumn) {\n        if (isAChildColumn(targetColumn)) {\n            // Removing a child Column\n            removeChildComponentColumn(targetColumn);\n        } else {\n            // Removing a column inside a ColumnWithComponents\n            lookupAndRemoveFromColumnsWithComponents(targetColumn);\n        }\n\n        // If the current row is empty we must remove it from the layout\n        if (rowIsEmpty()) {\n            removeRowCommand.execute(this);\n        }\n    }\n\n    private void removeChildComponentColumn(Column targetColumn) {\n        if (needToUpdateWidthOfMySiblings(targetColumn)) {\n            updateWidthOfMySiblings(targetColumn);\n        }\n        if (needToUpdateHeightOfMySiblings(targetColumn)) {\n            updateHeightOfSiblingColumn(targetColumn);\n        }\n        columns.remove(targetColumn);\n        destroy(targetColumn);\n        notifyRemoval(targetColumn.getLayoutComponent());\n        updateView();\n    }\n\n    private boolean needToUpdateHeightOfMySiblings(Column targetColumn) {\n        return targetColumn.getColumnHeight() != ComponentColumn.DEFAULT_COLUMN_HEIGHT;\n    }\n\n    private void updateHeightOfSiblingColumn(Column columnToRemove) {\n        final int removeIndex = getColumnIndex(columnToRemove);\n        if (isFirstColumn(removeIndex)) {\n            final Column sibling = columns.get(1);\n            Integer remove = columnToRemove.getColumnHeight();\n            Integer add = sibling.getColumnHeight();\n            Integer newHeight = remove + add;\n            sibling.setColumnHeight(newHeight);\n        } else {\n            final Column sibling = columns.get(removeIndex - 1);\n            Integer remove = columnToRemove.getColumnHeight();\n            Integer add = sibling.getColumnHeight();\n            Integer newHeight = remove + add;\n            sibling.setColumnHeight(newHeight);\n        }\n    }\n\n    private void notifyRemoval(LayoutComponent layoutComponent) {\n        componentRemovedEvent.fire(new ComponentRemovedEvent(layoutComponent,\n                                                             dndManager.isOnComponentMove()));\n    }\n\n    public boolean cointainsColumn(Column targetColumn) {\n        return isAChildColumn(targetColumn) || checkIfColumnExistsInChildColumnWithComponents(targetColumn).isPresent();\n    }\n\n    private boolean isAChildColumn(Column targetColumn) {\n        return columns.contains(targetColumn);\n    }\n\n    private Optional<Column> checkIfColumnExistsInChildColumnWithComponents(Column targetColumn) {\n        return columns.stream()\n                .filter(column -> column instanceof ColumnWithComponents && ((ColumnWithComponents) column).hasComponent(targetColumn))\n                .findAny();\n    }\n\n    public boolean rowIsEmpty() {\n        return columns.isEmpty();\n    }\n\n    private void lookupAndRemoveFromColumnsWithComponents(Column targetColumn) {\n        // find the ColumnWithComponents that contains the targetColumn\n        Optional<Column> optional = checkIfColumnExistsInChildColumnWithComponents(targetColumn);\n\n        // If present let's remove it!\n        optional.ifPresent(column -> removeComponentFromColumnWithComponents((ColumnWithComponents) column,\n                                                                             targetColumn));\n    }\n\n    private void removeComponentFromColumnWithComponents(ColumnWithComponents parent,\n                                                         Column targetColumn) {\n        PortablePreconditions.checkNotNull(\"parent\",\n                                           parent);\n        PortablePreconditions.checkNotNull(\"targetColumn\",\n                                           targetColumn);\n\n        // if parent contains targetColumn remove & destroy targetColumn\n        if (parent.hasComponent(targetColumn)) {\n            parent.remove(targetColumn);\n            destroy(targetColumn);\n        }\n\n        // if parent has only one child remaining we'll remove parent and promote the remaining child on the layout.\n        if (parent.getRow().getColumns().size() == 1 && !isDropInSameColumnWithComponent(ColumnDropContext.getActiveDrop())) {\n            replaceColumnWithComponents(parent);\n        }\n    }\n\n    protected boolean isDropInSameColumnWithComponent(ColumnDrop drop) {\n        if (drop != null) {\n            int indexOfRowIdOfColumn = drop.getOldColumn().getId().lastIndexOf(\"column\");\n            int indexOfEndIdOfColumn = drop.getEndId().lastIndexOf(\"column\");\n            if (indexOfRowIdOfColumn > 0 && indexOfEndIdOfColumn > 0) {\n                String rowIdOfColumn = drop.getOldColumn().getId().substring(0, indexOfRowIdOfColumn);\n                String rowEndIdOfColumn = drop.getEndId().substring(0, indexOfEndIdOfColumn);\n                return rowIdOfColumn.equals(rowEndIdOfColumn);\n            }\n        }\n        return false;\n    }\n\n    private void replaceColumnWithComponents(ColumnWithComponents columnToReplace) {\n        PortablePreconditions.checkNotNull(\"columnToReplace\",\n                                           columnToReplace);\n\n        // check again if parent has only one child remaining\n        if (columnToReplace.getRow().getColumns().size() == 1) {\n\n            // getting the remaining column\n            ComponentColumn originalColumn = (ComponentColumn) columnToReplace.getRow().getColumns().remove(0);\n            ComponentColumn column = createNewComponentColumn(originalColumn.getLayoutComponent(),\n                                              columnToReplace.getColumnWidth(),\n                                              false);\n\n            column.setId(columnToReplace.getId());\n\n            int index = columns.indexOf(columnToReplace);\n\n            // promoting the remaining child on the actual row\n            columns.set(index, column);\n\n            // destroy current column & update view\n            columnToReplace.preDestroy();\n\n            updateView();\n        }\n    }\n\n    private boolean needToUpdateWidthOfMySiblings(Column targetColumn) {\n        return targetColumn.getColumnWidth() != Column.DEFAULT_COLUMN_WIDTH && !targetColumn.isInnerColumn();\n    }\n\n    private void updateWidthOfMySiblings(Column columnToRemove) {\n        final int removeIndex = getColumnIndex(columnToRemove);\n        if (isFirstColumn(removeIndex)) {\n            if (firstColumnHasRightSibling()) {\n                final Column sibling = columns.get(1);\n                sibling.setColumnWidth(sibling.getColumnWidth() + columnToRemove.getColumnWidth());\n            }\n        } else {\n            final Column sibling = columns.get(removeIndex - 1);\n            sibling.setColumnWidth(sibling.getColumnWidth() + columnToRemove.getColumnWidth());\n        }\n    }\n\n    private boolean firstColumnHasRightSibling() {\n        return columns.size() >= 2;\n    }\n\n    private int getColumnIndex(Column columnToRemove) {\n        return columns.indexOf(columnToRemove);\n    }\n\n    private boolean isFirstColumn(int columnIndex) {\n        return columnIndex == 0;\n    }\n\n    public void disableDrop() {\n        this.dropEnable = false;\n    }\n\n    protected ColumnWithComponents createColumnWithComponentsInstance() {\n        final ColumnWithComponents column = columnWithComponentsInstance.get();\n        column.setId(idGenerator.createColumnID(id));\n        return column;\n    }\n\n    public void drop(String dropData,\n                     RowDrop.Orientation orientation) {\n        if (dndManager.isOnRowMove()) {\n            dndManager.endRowMove(id,\n                                  orientation);\n        } else if (dndManager.isOnComponentMove()) {\n            dropOnRowCommand\n                    .execute(new RowDrop(dndManager.getLayoutComponentMove(),\n                                         id,\n                                         orientation)\n                                     .fromMove(dndManager.getRowId(),\n                                               dndManager.getDraggedColumn()));\n        } else {\n            dropOnRowCommand\n                    .execute(\n                            new RowDrop(layoutDragComponentHelper.getLayoutComponentFromDrop(dropData),\n                                        id,\n                                        orientation));\n        }\n    }\n\n    @PostConstruct\n    public void post() {\n        view.init(this);\n    }\n\n    @PreDestroy\n    public void preDestroy() {\n        for (Column column : columns) {\n            destroy(column);\n        }\n    }\n\n    private List<Column> updateColumns(ColumnDrop drop,\n                                       List<Column> originalColumns) {\n        List<Column> columns = new ArrayList<>();\n        for (int i = 0; i < originalColumns.size(); i++) {\n            final Column currentColumn = originalColumns.get(i);\n            if (dropIsOn(drop,\n                         currentColumn) && columnCanBeSplitted(currentColumn)) {\n                if (isComponentColumn(currentColumn)) {\n                    handleDropOnComponentColumn(drop,\n                                                columns,\n                                                i,\n                                                currentColumn);\n                } else {\n                    handleDropOnColumnWithComponents(drop,\n                                                     columns,\n                                                     i\n                            ,\n                                                     currentColumn);\n                }\n            } else {\n                columns.add(currentColumn);\n            }\n        }\n        return columns;\n    }\n\n    private void handleDropOnColumnWithComponents(ColumnDrop drop,\n                                                  List<Column> columns,\n                                                  int columnIndex,\n                                                  Column currentColumn) {\n        ColumnWithComponents column = (ColumnWithComponents) currentColumn;\n        if (drop.isASideDrop()) {\n            handleSideDrop(drop,\n                           columns,\n                           columnIndex,\n                           currentColumn);\n        } else {\n            if (column.hasInnerRows()) {\n                Row innerRow = column.getRow();\n                innerRow.columns = updateInnerColumns(drop,\n                                                      innerRow.getColumns());\n            }\n            columns.add(column);\n        }\n    }\n\n    private List<Column> updateInnerColumns(ColumnDrop drop,\n                                            List<Column> originalColumns) {\n        List<Column> columns = new ArrayList<>();\n\n        for (int i = 0; i < originalColumns.size(); i++) {\n            final Column currentColumn = originalColumns.get(i);\n            if (isComponentColumn(currentColumn)) {\n                handleDropInnerColumn(drop,\n                                      columns,\n                                      i,\n                                      currentColumn);\n            }\n        }\n        return columns;\n    }\n\n    private void handleDropInnerColumn(ColumnDrop drop,\n                                       List<Column> columns,\n                                       int columnIndex,\n                                       Column column) {\n        ComponentColumn currentColumn = (ComponentColumn) column;\n        if (dropIsOn(drop,\n                     currentColumn) && columnCanBeSplitted(currentColumn)) {\n            if (drop.isASideDrop()) {\n                handleSideDrop(drop,\n                               columns,\n                               columnIndex,\n                               currentColumn);\n            } else {\n                handleInnerDrop(drop,\n                                columns,\n                                currentColumn);\n            }\n        } else {\n            columns.add(currentColumn);\n        }\n    }\n\n    private void handleInnerDrop(ColumnDrop drop,\n                                 List<Column> columns,\n                                 ComponentColumn currentColumn) {\n        Integer newInnerColumnHeight = currentColumn.getColumnHeight() / 2;\n        final ComponentColumn newColumn = createNewInnerColumn(drop,\n                                                               currentColumn,\n                                                               newInnerColumnHeight);\n        currentColumn.setColumnHeight(calculateColumnHeight(currentColumn));\n        addColumnsInTheRightPosition(drop,\n                                     columns,\n                                     currentColumn,\n                                     newColumn);\n    }\n\n    private Integer calculateColumnHeight(ComponentColumn column) {\n        Integer originalHeight = column.getColumnHeight();\n        Integer newColumnHeight = originalHeight / 2;\n        if (originalHeight % 2 == 0) {\n            return newColumnHeight;\n        } else {\n            newColumnHeight = newColumnHeight + 1;\n            return newColumnHeight;\n        }\n    }\n\n    private void addColumnsInTheRightPosition(ColumnDrop drop,\n                                              List<Column> columns,\n                                              ComponentColumn currentColumn,\n                                              ComponentColumn newColumn) {\n        if (drop.isADownDrop()) {\n            columns.add(currentColumn);\n            columns.add(newColumn);\n        } else {\n            columns.add(newColumn);\n            columns.add(currentColumn);\n        }\n    }\n\n    private ComponentColumn createNewInnerColumn(ColumnDrop drop,\n                                                 ComponentColumn currentColumn,\n                                                 Integer innerColumnHeight) {\n        final ComponentColumn newColumn = createComponentColumnInstance();\n\n        newColumn.init(currentColumn.getParentElement(),\n                       Column.DEFAULT_COLUMN_WIDTH,\n                       drop.getComponent(),\n                       dropCommand(),\n                       removeColumnCommand(),\n                       currentLayoutTemplateSupplier,\n                       lockSupplier,\n                       drop.newComponent());\n        newColumn.setColumnHeight(innerColumnHeight);\n        return newColumn;\n    }\n\n    private void handleInnerComponentDrop(ColumnDrop drop,\n                                          int columnIndex,\n                                          List<Column> columns,\n                                          ComponentColumn currentColumn) {\n        Integer innerColumnHeight = (currentColumn.getColumnHeight() / 2);\n        if (parentColumnWithComponents == null) {\n            Integer width = currentColumn.getColumnWidth();\n            final ColumnWithComponents columnWithComponents = createColumnWithComponentsInstance();\n            columnWithComponents\n                    .init(this,\n                          width,\n                          pageStyle,\n                          dropCommand(),\n                          removeComponentCommand,\n                          removeColumnCommand(),\n                          currentLayoutTemplateSupplier,\n                          lockSupplier,\n                          currentColumn.getColumnHeight());\n\n            final ComponentColumn newColumn = createComponentColumn(\n                    drop.getComponent(),\n                    drop.newComponent());\n            newColumn.setColumnHeight(innerColumnHeight);\n            currentColumn = updateCurrentColumn(currentColumn);\n\n            if (drop.isADownDrop()) {\n                columnWithComponents.withComponents(currentColumn,\n                                                    newColumn);\n            } else {\n                columnWithComponents.withComponents(newColumn,\n                                                    currentColumn);\n            }\n\n            columns.add(columnWithComponents);\n        } else {\n            final ComponentColumn newColumn = createComponentColumn(\n                    drop.getComponent(),\n                    drop.newComponent());\n            newColumn.setColumnHeight(innerColumnHeight);\n            currentColumn.setColumnHeight(calculateColumnHeight(currentColumn));\n            addColumnsInTheRightPosition(drop,\n                                         columns,\n                                         currentColumn,\n                                         newColumn);\n        }\n    }\n\n    private ComponentColumn updateCurrentColumn(ComponentColumn currentColumn) {\n        currentColumn.setColumnWidth(Column.DEFAULT_COLUMN_WIDTH);\n        currentColumn.recalculateWidth();\n        currentColumn.setColumnHeight(calculateColumnHeight(currentColumn));\n        return currentColumn;\n    }\n\n    private ComponentColumn createComponentColumn(LayoutComponent layoutComponent,\n                                                  boolean newComponent) {\n        return createNewComponentColumn(layoutComponent,\n                                        12,\n                                        newComponent);\n    }\n\n    private ComponentColumn createNewComponentColumn(LayoutComponent layoutComponent,\n                                                     Integer columnSize,\n                                                     boolean newComponent) {\n        final ComponentColumn newColumn = createComponentColumnInstance();\n\n        newColumn.init(this,\n                       columnSize,\n                       layoutComponent,\n                       dropCommand(),\n                       removeColumnCommand(),\n                       currentLayoutTemplateSupplier,\n                       lockSupplier,\n                       newComponent);\n        return newColumn;\n    }\n\n    private void handleDropOnComponentColumn(ColumnDrop drop,\n                                             List<Column> columns,\n                                             int columnIndex,\n                                             Column column) {\n        ComponentColumn componentColumn = (ComponentColumn) column;\n        if (drop.isASideDrop()) {\n            handleSideDrop(drop,\n                           columns,\n                           columnIndex,\n                           componentColumn);\n        } else {\n            handleInnerComponentDrop(drop,\n                                     columnIndex,\n                                     columns,\n                                     componentColumn);\n        }\n    }\n\n    private boolean columnCanBeSplitted(Column column) {\n        return column.getColumnWidth() != 1;\n    }\n\n    private boolean isComponentColumn(Column currentColumn) {\n        return currentColumn instanceof ComponentColumn;\n    }\n\n    private void handleSideDrop(ColumnDrop drop,\n                                List<Column> columns,\n                                int columnIndex,\n                                Column currentColumn) {\n\n        if (drop.isALeftDrop()) {\n            final ComponentColumn newColumn = createNewComponentColumn(drop.getComponent(),\n                                                                       currentColumn.getColumnWidth() / 2,\n                                                                       drop.newComponent());\n            setupColumnWidth(currentColumn);\n\n            columns.add(newColumn);\n            columns.add(currentColumn);\n        } else {\n            final ComponentColumn newColumn = createNewComponentColumn(drop.getComponent(),\n                                                                       currentColumn.getColumnWidth() / 2,\n                                                                       drop.newComponent());\n            setupColumnWidth(currentColumn);\n\n            columns.add(currentColumn);\n            columns.add(newColumn);\n        }\n    }\n\n    private Integer setupColumnWidth(Column column) {\n        Integer originalSize = column.getColumnWidth();\n        Integer newColumnSize = originalSize / 2;\n        if (originalSize % 2 == 0) {\n            column.setColumnWidth(newColumnSize);\n        } else {\n            column.setColumnWidth(newColumnSize + 1);\n        }\n        return newColumnSize;\n    }\n\n    private boolean dropIsOn(ColumnDrop drop,\n                             Column column) {\n        return drop.getEndId().equalsIgnoreCase(column.getId());\n    }\n\n    public void resizeColumns(@Observes ColumnResizeEvent resize) {\n        if (resizeEventIsinThisRow(resize)) {\n\n            Column resizedColumn = getColumn(resize);\n\n            if (resizedColumn != null) {\n                Column affectedColumn = null;\n                if (resize.isLeft()) {\n                    affectedColumn = lookUpForLeftNeighbor(resizedColumn);\n                } else {\n                    affectedColumn = lookUpForRightNeighbor(resizedColumn);\n                }\n                if (affectedColumn != null) {\n                    resizedColumn.incrementWidth();\n                    affectedColumn.reduceWidth();\n                }\n            }\n            updateView();\n        }\n    }\n\n    private Column lookUpForLeftNeighbor(Column resizedColumn) {\n        int idx = getColumnIndex(resizedColumn) - 1;\n        return idx < 0 ? null : columns.get(idx);\n    }\n\n    private Column lookUpForRightNeighbor(Column resizedColumn) {\n        int idx = getColumnIndex(resizedColumn) + 1;\n        return idx < columns.size() ? columns.get(idx) : null;\n    }\n\n    private boolean resizeEventIsinThisRow(@Observes ColumnResizeEvent resize) {\n        return resize.getRowHash() == hashCode();\n    }\n\n    private Column getColumn(ColumnResizeEvent resize) {\n        for (Column column : columns) {\n            if (resize.getColumnHash() == column.hashCode()) {\n                return column;\n            }\n        }\n        return null;\n    }\n\n    public void updateView() {\n        layoutEditorFocusController.recordFocus();\n        view.clear();\n        setupColumnResizeActions();\n        for (Column column : columns) {\n            view.addColumn(column.getView());\n        }\n    }\n\n    private void setupColumnResizeActions() {\n        for (int i = 0; i < columns.size(); i++) {\n            Column column = columns.get(i);\n            setupColumnResizeActions(columns,\n                                     column,\n                                     i);\n        }\n    }\n\n    private void setupCssProperties() {\n        List<CssValue> cssValueList = layoutCssHelper.readCssValues(properties);\n        view.applyCssValues(cssValueList);\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public void setProperty(String property, String value) {\n        properties.put(property, value);\n        setupCssProperties();\n    }\n\n    @Override\n    public void removeProperty(String property) {\n        properties.remove(property);\n        setupCssProperties();\n    }\n\n    @Override\n    public void clearProperties() {\n        properties.clear();\n        setupCssProperties();\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories() {\n        return layoutCssHelper.getRowPropertyCategories(this);\n    }\n\n    private void setupColumnResizeActions(List<Column> columns,\n                                          Column currentColumn,\n                                          int index) {\n        if (firstColumn(index)) {\n            boolean canResizeRight = canResizeRight(index,\n                                                    columns);\n            currentColumn.setupResize(false,\n                                      canResizeRight);\n        } else {\n            currentColumn.setupResize(canResizeLeft(index,\n                                                    columns),\n                                      canResizeRight(index,\n                                                     columns));\n        }\n    }\n\n    private boolean canResizeLeft(int index,\n                                  List<Column> columns) {\n        Column rightSibling = columns.get(index - 1);\n        return rightSibling.getColumnWidth() > 1;\n    }\n\n    private boolean canResizeRight(int index,\n                                   List<Column> columns) {\n        if (hasRightSibling(index,\n                            columns)) {\n            Column rightSibling = columns.get(index + 1);\n            return rightSibling.getColumnWidth() > 1;\n        }\n        return false;\n    }\n\n    private boolean hasRightSibling(int index,\n                                    List<Column> columns) {\n        return columns.size() > (index + 1);\n    }\n\n    private boolean firstColumn(int index) {\n        return index == 0;\n    }\n\n    public UberElement<Row> getView() {\n        updateView();\n        return view;\n    }\n\n    public List<Column> getColumns() {\n        return columns;\n    }\n\n    public boolean isDropEnable() {\n        return dropEnable && canISplitMySize();\n    }\n\n    @Override\n    public void setSelectable(boolean selectable) {\n        this.selectable = selectable;\n        view.setSelectEnabled(selectable);\n    }\n\n    public boolean isSelectable() {\n        return selectable;\n    }\n\n    public boolean isSelected() {\n        return selected;\n    }\n\n    public void setSelected(boolean selected) {\n        if (isSelectable()) {\n            if (selected) {\n                this.selected = true;\n                view.setSelected(true);\n            } else {\n                this.selected = false;\n                view.setSelected(false);\n            }\n        }\n    }\n\n    private boolean canISplitMySize() {\n        if (pageStyle == LayoutTemplate.Style.PAGE) {\n            Integer size = Integer.valueOf(getHeight());\n            return size > (ROW_MIN_HEIGHT * 2);\n        }\n        return true;\n    }\n\n    protected void destroy(Object o) {\n        BeanHelper.destroy(o);\n    }\n\n    public void calculateSizeChilds() {\n        for (Column column : columns) {\n            column.calculateWidth();\n        }\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public LayoutEditorElementType geElementType() {\n        return LayoutEditorElementType.ROW;\n    }\n\n    @Override\n    public LayoutEditorElement getParentElement() {\n        return parentElement;\n    }\n\n    public void setup(LayoutEditorElement parent,\n                      String id,\n                      LayoutTemplate.Style pageStyle) {\n        this.parentElement = parent;\n        this.id = id;\n        this.pageStyle = pageStyle;\n    }\n\n    public Integer getHeight() {\n        return height;\n    }\n\n    public void setHeight(Integer height) {\n        this.height = height;\n        view.setHeight(height);\n    }\n\n    public boolean canResizeUp() {\n        return canResizeUp;\n    }\n\n    public boolean canResizeDown() {\n        return canResizeDown;\n    }\n\n    public void resizeUp() {\n        rowResizeEvent.fire(new RowResizeEvent(parentElement.hashCode(),\n                hashCode()).up());\n    }\n\n    public void resizeDown() {\n        rowResizeEvent.fire(new RowResizeEvent(parentElement.hashCode(),\n                hashCode()).down());\n    }\n\n    public void incrementHeight() {\n        Integer newSize = height + 1;\n        this.height = newSize;\n        view.setHeight(newSize);\n    }\n\n    public void reduceHeight() {\n        Integer newSize = height - 1;\n        this.height = newSize;\n        view.setHeight(newSize);\n    }\n\n    public void setupResize(boolean canResizeUp,\n                            boolean canResizeDown) {\n\n        this.canResizeUp = canResizeUp;\n        this.canResizeDown = canResizeDown;\n        view.setupResize();\n    }\n\n    public ColumnWithComponents getParentColumnWithComponents() {\n        return parentColumnWithComponents;\n    }\n\n    public void onSelected() {\n        if (isSelectable()) {\n            if (selected) {\n                rowUnselectEvent.fire(new LayoutEditorElementUnselectEvent(this));\n            } else {\n                rowSelectEvent.fire(new LayoutEditorElementSelectEvent(this));\n            }\n        }\n    }\n\n    public List<Column> getChildElements() {\n        return columns;\n    }\n\n    public interface View extends UberElement<Row> {\n\n        void addColumn(UberElement<ComponentColumn> view);\n\n        void clear();\n\n        void setupPageLayout(Integer height);\n\n        void setHeight(Integer height);\n\n        void setupResize();\n\n        void setSelectEnabled(boolean enabled);\n\n        void setSelected(boolean selected);\n\n        void applyCssValues(List<CssValue> cssValues);\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/RowDnDEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\npublic class RowDnDEvent {\n\n    private final String rowIdBegin;\n    private final String rowIdEnd;\n    private final RowDrop.Orientation orientation;\n\n    public RowDnDEvent(String rowIdBegin,\n                       String rowIdEnd,\n                       RowDrop.Orientation orientation) {\n        this.rowIdBegin = rowIdBegin;\n        this.rowIdEnd = rowIdEnd;\n        this.orientation = orientation;\n    }\n\n    public RowDrop.Orientation getOrientation() {\n        return orientation;\n    }\n\n    public String getRowIdBegin() {\n        return rowIdBegin;\n    }\n\n    public String getRowIdEnd() {\n        return rowIdEnd;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/RowDrop.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropType;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\n\npublic class RowDrop {\n\n    private final LayoutComponent component;\n    private final String rowId;\n    private final Orientation orientation;\n    private String originRowOldColumnId;\n    private ComponentDropType type;\n    private Column oldColumn;\n\n    public RowDrop(LayoutComponent component,\n                   String rowId,\n                   Orientation orientation) {\n        this.component = component;\n        this.rowId = rowId;\n        this.orientation = orientation;\n        this.type = ComponentDropType.NEW;\n    }\n\n    public String getRowId() {\n        return rowId;\n    }\n\n    public Orientation getOrientation() {\n        return orientation;\n    }\n\n    public LayoutComponent getComponent() {\n        return component;\n    }\n\n    public Column getOldColumn() {\n        return oldColumn;\n    }\n\n    public ComponentDropType getType() {\n        return type;\n    }\n\n    public boolean newComponent() {\n        return type == ComponentDropType.NEW;\n    }\n\n    public RowDrop fromMove(String originRowOldColumnId,\n                            Column oldColumn) {\n        this.oldColumn = oldColumn;\n        this.type = ComponentDropType.FROM_MOVE;\n        this.originRowOldColumnId = originRowOldColumnId;\n        return this;\n    }\n\n    public enum Orientation {\n        BEFORE,\n        AFTER\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/RowView.css",
    "content": ".rowDropPreview {\n    background-color: rgba(204, 204, 204, 0.5);\n    height: 20px !important;\n}\n\n.rowCss {\n    padding-left: 0px !important;\n    padding-right: 0px !important;\n    padding-top: 1px !important;\n    padding-bottom: 1px !important;\n}\n\n.rowCssMove {\n\n}\n\n.rowDndPreview {\n    opacity: 0.1;\n}\n\n.rowMovePreview {\n    background-color: rgba(204, 204, 204, 0.5);\n    cursor: move;\n}\n\n.uf-page-row {\n    height: -moz-calc(100% - 15px);\n    height: -webkit-calc(100% - 15px);\n    height: calc(100% - 15px);\n}\n\n.uf-row-bottom {\n    height: 10px;\n    display: flex;\n}\n\n.uf-row-bottom-left {\n    height: 100%;\n    width: 40%;\n}\n\n.uf-row-bottom-center {\n    height: 100%;\n    width: 20%;\n}\n\n.uf-row-bottom-right {\n    height: 100%;\n    width: 40%;\n}\n\n.uf-row-upper {\n    height: 10px;\n    display: flex;\n}\n\n.uf-row-upper-left {\n    height: 100%;\n    width: 40%;\n}\n\n.uf-row-upper-center {\n    height: 100%;\n    width: 20%;\n}\n\n.uf-row-upper-right {\n    height: 100%;\n    width: 40%;\n}\n.rowResizeUp {\n    cursor: n-resize;\n}\n.rowResizeDown {\n    cursor: s-resize;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/RowView.html",
    "content": "<div data-field=\"mainrow\">\n    <div data-field=\"upper\" class=\"row rowCss uf-row-upper rowCssMove\">\n        <div data-field=\"upper-left\" class=\"uf-row-upper-left\">\n\n        </div>\n        <div data-field=\"upper-center\" class=\"uf-row-upper-center\">\n\n        </div>\n        <div data-field=\"upper-right\" class=\"uf-row-upper-right\">\n\n        </div>\n    </div>\n    <div data-field=\"row\"  class=\"row rowCss\">\n    </div>\n    <div data-field=\"bottom\" class=\"row rowCss uf-row-bottom rowCssMove\">\n        <div data-field=\"bottom-left\" class=\"uf-row-bottom-left\">\n\n        </div>\n        <div data-field=\"bottom-center\" class=\"uf-row-bottom-center\">\n\n        </div>\n        <div data-field=\"bottom-right\" class=\"uf-row-bottom-right\">\n\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/components/rows/RowView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumn;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\n\nimport java.util.List;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.*;\nimport static org.uberfire.ext.layout.editor.client.infra.HTML5DnDHelper.extractDndData;\n\n@Dependent\n@Templated\npublic class RowView\n        implements UberElement<Row>,\n                   Row.View,\n                   IsElement {\n\n    public static final String PAGE_ROW_CSS_CLASS = \"uf-perspective-row-\";\n    String cssSize = \"\";\n    @Inject\n    @DataField\n    Div upper;\n    @Inject\n    @DataField\n    Div bottom;\n    @Inject\n    @DataField\n    Div row;\n    @Inject\n    @DataField(\"mainrow\")\n    Div mainRow;\n    @Inject\n    @DataField(\"upper-center\")\n    Div upperCenter;\n    @Inject\n    @DataField(\"bottom-center\")\n    Div bottomCenter;\n    private Row presenter;\n\n    @Override\n    public void init(Row presenter) {\n        this.presenter = presenter;\n        upper.setTitle(CommonConstants.INSTANCE.DragRowHint());\n        setupEvents();\n    }\n\n    private void setupEvents() {\n        setupUpperEvents();\n        setupBottomEvents();\n    }\n\n    private void setupBottomEvents() {\n        setupBottomCenter();\n        bottom.setOndragover(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                addCSSClass(bottom,\n                            \"rowDropPreview\");\n            }\n        });\n        bottom.setOnmouseout(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                removeCSSClass(bottom,\n                               \"rowDropPreview\");\n            }\n        });\n        bottom.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.isDropEnable()) {\n                removeCSSClass(bottom,\n                               \"rowDropPreview\");\n                presenter.drop(extractDndData(e),\n                               RowDrop.Orientation.AFTER);\n            }\n        });\n\n        bottom.setOndragleave(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                removeCSSClass(bottom,\n                               \"rowDropPreview\");\n            }\n        });\n    }\n\n    private void setupBottomCenter() {\n        bottomCenter.setOnclick(e -> {\n                                    if (presenter.canResizeDown()) {\n                                        e.preventDefault();\n                                        presenter.resizeDown();\n                                    }\n                                }\n        );\n        bottomCenter.setOnmouseover(e -> {\n            if (presenter.canResizeDown()) {\n                e.preventDefault();\n                addCSSClass(bottomCenter,\n                            \"rowResizeDown\");\n            } else {\n                removeCSSClass(bottomCenter,\n                               \"rowResizeDown\");\n            }\n        });\n        bottomCenter.setOnmouseout(e -> {\n            if (presenter.canResizeDown()) {\n                e.preventDefault();\n                removeCSSClass(bottomCenter,\n                               \"rowResizeDown\");\n            }\n        });\n    }\n\n    private void setupUpperEvents() {\n        setupUpperCenter();\n        if (presenter.isDropEnable()) {\n            upper.setAttribute(\"draggable\",\n                               \"true\");\n        }\n        upper.setOndragstart(e -> {\n            if (presenter.isDropEnable()) {\n                presenter.dragStart();\n                e.getDataTransfer().setData(\"text/plain\",\n                                            \"this-is-a-requirement-to-firefox-html5dnd\");\n                addCSSClass(row,\n                            \"rowDndPreview\");\n                removeCSSClass(upper,\n                               \"rowMovePreview\");\n                removeCSSClass(bottom,\n                               \"rowMovePreview\");\n            }\n        });\n        upper.setOndragend(event -> {\n            event.preventDefault();\n            if (presenter.isDropEnable()) {\n                if (hasCSSClass(row,\n                                \"rowDndPreview\")) {\n                    removeCSSClass(row,\n                                   \"rowDndPreview\");\n                }\n                presenter.dragEndMove();\n            }\n        });\n        upper.setOndragover(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                addCSSClass(upper,\n                            \"rowDropPreview\");\n            }\n        });\n        upper.setOnmouseout(e -> {\n            if (presenter.isDropEnable() && !presenter.isSelected()) {\n                removeCSSClass(upper,\n                               \"rowMovePreview\");\n                removeCSSClass(row,\n                               \"rowMovePreview\");\n                removeCSSClass(bottom,\n                               \"rowMovePreview\");\n\n                e.preventDefault();\n                removeCSSClass(upper,\n                               \"rowDropPreview\");\n            }\n        });\n        upper.setOnclick(e -> {\n            e.preventDefault();\n            presenter.onSelected();\n        });\n        upper.setOnmouseover(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                addCSSClass(upper,\n                            \"rowMovePreview\");\n                addCSSClass(row,\n                            \"rowMovePreview\");\n                addCSSClass(bottom,\n                            \"rowMovePreview\");\n            }\n        });\n        upper.setOndragleave(e -> {\n            if (presenter.isDropEnable()) {\n                e.preventDefault();\n                removeCSSClass(upper,\n                               \"rowDropPreview\");\n            }\n        });\n        upper.setOndrop(e -> {\n            e.preventDefault();\n            if (presenter.isDropEnable()) {\n                removeCSSClass(upper,\n                               \"rowDropPreview\");\n                presenter.drop(extractDndData(e),\n                               RowDrop.Orientation.BEFORE);\n            }\n        });\n    }\n\n    private void setupUpperCenter() {\n        upperCenter.setOnclick(e -> {\n                                   e.preventDefault();\n                                   if (presenter.canResizeUp()) {\n                                       presenter.resizeUp();\n                                   }\n                               }\n        );\n        upperCenter.setOnmouseover(e -> {\n            if (presenter.canResizeUp()) {\n                e.preventDefault();\n                addCSSClass(upperCenter,\n                            \"rowResizeUp\");\n            } else {\n                removeCSSClass(upperCenter,\n                               \"rowResizeUp\");\n            }\n        });\n        upperCenter.setOnmouseout(e -> {\n            if (presenter.canResizeUp()) {\n                e.preventDefault();\n                removeCSSClass(upperCenter,\n                               \"rowResizeUp\");\n            }\n        });\n    }\n\n    @Override\n    public void addColumn(UberElement<ComponentColumn> view) {\n        row.appendChild(view.getElement());\n    }\n\n    @Override\n    public void clear() {\n        removeAllChildren(row);\n    }\n\n    @Override\n    public void setupPageLayout(Integer height) {\n        setupMainRowSize(height.toString());\n        row.getStyle().setProperty(\"height\",\n                                   \"calc(100% - 20px)\");\n        addCSSClass(row,\n                    \"uf-page-row\");\n    }\n\n    @Override\n    public void setHeight(Integer size) {\n        setupMainRowSize(size.toString());\n    }\n\n    @Override\n    public void setupResize() {\n        setupUpperCenter();\n        setupBottomCenter();\n    }\n\n    @Override\n    public void setSelectEnabled(boolean enabled) {\n        upper.setTitle(enabled ? CommonConstants.INSTANCE.SelectRowHint() : CommonConstants.INSTANCE.DragRowHint());\n    }\n\n    @Override\n    public void setSelected(boolean selected) {\n        removeCSSClass(upper, \"rowMovePreview\");\n        removeCSSClass(row, \"rowMovePreview\");\n        removeCSSClass(bottom, \"rowMovePreview\");\n        upper.setTitle(CommonConstants.INSTANCE.SelectRowHint());\n        if (selected) {\n            addCSSClass(upper, \"rowMovePreview\");\n            addCSSClass(row, \"rowMovePreview\");\n            addCSSClass(bottom, \"rowMovePreview\");\n            upper.setTitle(CommonConstants.INSTANCE.UnselectRowHint());\n        }\n    }\n\n    @Override\n    public void applyCssValues(List<CssValue> cssValues) {\n        mainRow.getStyle().setCssText(\"\");\n        cssValues.forEach(cssValue -> {\n            String prop = cssValue.getProperty();\n            String val = cssValue.getValue();\n            mainRow.getStyle().setProperty(prop, val);\n        });\n    }\n\n    private void setupMainRowSize(String span) {\n        if (!mainRow.getClassName().isEmpty()) {\n            removeCSSClass(mainRow,\n                           cssSize);\n        }\n        cssSize = PAGE_ROW_CSS_CLASS + span;\n        addCSSClass(mainRow,\n                    cssSize);\n    }\n}\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/event/LayoutEditorElementSelectEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.event;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\n\npublic class LayoutEditorElementSelectEvent {\n\n    private LayoutEditorElement element;\n\n    public LayoutEditorElementSelectEvent(LayoutEditorElement element) {\n        this.element = element;\n    }\n\n    public LayoutEditorElement getElement() {\n        return element;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/event/LayoutEditorElementUnselectEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.event;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementWithProperties;\n\npublic class LayoutEditorElementUnselectEvent {\n\n    private LayoutElementWithProperties element;\n\n    public LayoutEditorElementUnselectEvent(LayoutElementWithProperties element) {\n        this.element = element;\n    }\n\n    public LayoutElementWithProperties getElement() {\n        return element;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/event/LayoutElementClearAllPropertiesEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.event;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementWithProperties;\n\npublic class LayoutElementClearAllPropertiesEvent {\n\n    private LayoutElementWithProperties layoutEditorElement;\n\n    public LayoutElementClearAllPropertiesEvent(LayoutElementWithProperties layoutEditorElement) {\n        this.layoutEditorElement = layoutEditorElement;\n    }\n\n    public LayoutElementWithProperties getElement() {\n        return layoutEditorElement;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/event/LayoutElementPropertyChangedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.event;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementWithProperties;\n\npublic class LayoutElementPropertyChangedEvent {\n\n    private LayoutElementWithProperties layoutEditorElement;\n    private String property;\n    private String oldValue;\n    private String newValue;\n\n    public LayoutElementPropertyChangedEvent(LayoutElementWithProperties layoutEditorElement, String property, String oldValue, String newValue) {\n        this.layoutEditorElement = layoutEditorElement;\n        this.property = property;\n        this.oldValue = oldValue;\n        this.newValue = newValue;\n    }\n\n    public LayoutElementWithProperties getElement() {\n        return layoutEditorElement;\n    }\n\n    public String getProperty() {\n        return property;\n    }\n\n    public String getOldValue() {\n        return oldValue;\n    }\n\n    public String getNewValue() {\n        return newValue;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/generator/AbstractLayoutGenerator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.CSSStyleDeclaration;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorCssHelper;\nimport org.uberfire.ext.layout.editor.client.infra.RowSizeBuilder;\n\nimport javax.inject.Inject;\n\npublic abstract class AbstractLayoutGenerator implements LayoutGenerator {\n\n    public static final String CONTAINER_ID = \"mainContainer\";\n\n    @Inject\n    private LayoutEditorCssHelper cssPropertiesHelper;\n\n    @Override\n    public LayoutInstance build(LayoutTemplate layoutTemplate, LayoutGeneratorDriver driver) {\n        HTMLElement container = driver.createContainer();\n        container.setId(CONTAINER_ID);\n        container.getClassList().add(\"uf-perspective-container\");\n        container.getClassList().add(\"uf-perspective-rendered-container\");\n        applyCssToElement(layoutTemplate.getLayoutProperties(), container);\n\n        LayoutInstance layoutInstance = new LayoutInstance(container);\n        List<LayoutRow> rows = layoutTemplate.getRows();\n        generateRows(layoutTemplate, layoutInstance, driver, rows, container);\n        return layoutInstance;\n    }\n\n    protected void generateRows(LayoutTemplate layoutTemplate,\n                              LayoutInstance layoutInstance,\n                              LayoutGeneratorDriver driver,\n                              List<LayoutRow> rows,\n                              HTMLElement parentWidget) {\n        for (LayoutRow layoutRow : rows) {\n            HTMLElement row = driver.createRow(layoutRow);\n            applyCssToElement(layoutRow.getProperties(), row);\n\n            if (layoutTemplate.isPageStyle()) {\n                row.getClassList().add(RowSizeBuilder.buildRowSize(layoutRow.getHeight()));\n                row.getClassList().add(\"uf-le-overflow\");\n            }\n            for (LayoutColumn layoutColumn : layoutRow.getLayoutColumns()) {\n                HTMLElement column = driver.createColumn(layoutColumn);\n                applyCssToElement(layoutColumn.getProperties(), column);\n\n                if (layoutTemplate.isPageStyle() && layoutColumn.getHeight().isEmpty()) {\n                    column.getClassList().add(\"uf-perspective-col\");\n                }\n                if (columnHasNestedRows(layoutColumn)) {\n                    if (layoutTemplate.isPageStyle() && layoutColumn.getHeight().isEmpty()) {\n                        column.getClassList().add(\"uf-perspective-col\");\n                    } else if (!layoutColumn.getHeight().isEmpty()) {\n                        column.getClassList().add(\"uf-perspective-row-\" + layoutColumn.getHeight());\n                    }\n                    generateRows(layoutTemplate,\n                                 layoutInstance,\n                                 driver,\n                                 layoutColumn.getRows(),\n                                 column);\n                } else {\n                    generateComponents(layoutTemplate,\n                                       layoutInstance,\n                                       driver,\n                                       layoutColumn,\n                                       column);\n                }\n                column.getClassList().add(\"uf-perspective-rendered-col\");\n                row.appendChild(column);\n            }\n            row.getClassList().add(\"uf-perspective-rendered-row\");\n            parentWidget.appendChild(row);\n        }\n    }\n\n    protected void generateComponents(LayoutTemplate layoutTemplate,\n                                    final LayoutInstance layoutInstance,\n                                    final LayoutGeneratorDriver driver,\n                                    final LayoutColumn layoutColumn,\n                                    final HTMLElement column) {\n        for (final LayoutComponent layoutComponent : layoutColumn.getLayoutComponents()) {\n            final IsWidget componentWidget = driver.createComponent(column, layoutComponent);\n            if (componentWidget != null) {\n                if (layoutTemplate.isPageStyle() && layoutColumn.getHeight().isEmpty()) {\n                    componentWidget.asWidget().getElement().addClassName(\"uf-perspective-col\");\n                }\n                else if (!layoutColumn.getHeight().isEmpty()) {\n                    column.getClassList().add(\"uf-perspective-row-\" + layoutColumn.getHeight());\n                }\n                DOMUtil.appendWidgetToElement(column, componentWidget);\n                applyCssToElement(layoutComponent.getProperties(), componentWidget);\n                layoutComponent.getParts().forEach(p -> {\n                    final Optional<IsWidget> partWidget = driver.getComponentPart(column, layoutComponent, p.getPartId());\n                    partWidget.ifPresent(widget -> applyCssToElement(p.getCssProperties(), widget));\n                });\n            }\n        }\n    }\n\n    protected boolean columnHasNestedRows(LayoutColumn layoutColumn) {\n        return layoutColumn.getRows() != null && !layoutColumn.getRows().isEmpty();\n    }\n\n    protected void applyCssToElement(Map<String,String> properties, HTMLElement element) {\n        if (properties != null && !properties.isEmpty()) {\n            CSSStyleDeclaration style = element.getStyle();\n            cssPropertiesHelper.readCssValues(properties)\n                    .stream().forEach(cssValue -> {\n                String prop = cssValue.getProperty();\n                String val = cssValue.getValue();\n                style.setProperty(prop, val);\n            });\n        }\n    }\n\n    protected void applyCssToElement(Map<String,String> properties, IsWidget element) {\n        if (properties != null && !properties.isEmpty()) {\n            final Style style = element.asWidget().getElement().getStyle();\n            cssPropertiesHelper.readCssValues(properties)\n                    .stream().forEach(cssValue -> {\n                String prop = cssValue.getPropertyInCamelCase();\n                String val = cssValue.getValue();\n                style.setProperty(prop, val);\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/generator/BootstrapLayoutGenerator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport javax.enterprise.inject.Default;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\n\n\n/**\n * A bootstrap based layout generator\n */\n@Default\n@Dependent\npublic class BootstrapLayoutGenerator extends AbstractLayoutGenerator {\n\n    @Inject\n    private BootstrapLayoutGeneratorDriver bootstrapDriver;\n\n    @Override\n    public LayoutInstance build(LayoutTemplate layoutTemplate) {\n        return super.build(layoutTemplate, bootstrapDriver);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/generator/BootstrapLayoutGeneratorDriver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnSizeBuilder;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutDragComponentHelper;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Default;\nimport javax.inject.Inject;\n\n/**\n * The layout generator driver used in the {@link BootstrapLayoutGenerator}\n */\n@Default\n@Dependent\npublic class BootstrapLayoutGeneratorDriver implements LayoutGeneratorDriver {\n\n    @Inject\n    private LayoutDragComponentHelper dragTypeHelper;\n\n    @Override\n    public HTMLElement createContainer() {\n        Div div = (Div) Window.getDocument().createElement(\"div\");\n        return div;\n    }\n\n    @Override\n    public HTMLElement createRow(LayoutRow layoutRow) {\n        Div div = (Div) Window.getDocument().createElement(\"div\");\n        div.setClassName(\"row\");\n        return div;\n    }\n\n    @Override\n    public HTMLElement createColumn(LayoutColumn layoutColumn) {\n        Div div = (Div) Window.getDocument().createElement(\"div\");\n        String colSize = ColumnSizeBuilder.buildColumnSize(new Integer(layoutColumn.getSpan()));\n        div.setClassName(colSize);\n        return div;\n    }\n\n    @Override\n    public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) {\n        final LayoutDragComponent dragComponent = lookupComponent(layoutComponent);\n        if (dragComponent != null) {\n            Widget columnWidget = ElementWrapperWidget.getWidget(column);\n            RenderingContext componentContext = new RenderingContext(layoutComponent, columnWidget);\n            return dragComponent.getShowWidget(componentContext);\n        }\n        return null;\n    }\n\n    protected LayoutDragComponent lookupComponent(LayoutComponent layoutComponent) {\n        return dragTypeHelper.lookupDragTypeBean(layoutComponent.getDragTypeName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/generator/LayoutGenerator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\npublic interface LayoutGenerator {\n\n    LayoutInstance build(LayoutTemplate layoutTemplate);\n\n    LayoutInstance build(LayoutTemplate layoutTemplate, LayoutGeneratorDriver driver);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/generator/LayoutGeneratorDriver.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport java.util.Optional;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\n\npublic interface LayoutGeneratorDriver {\n\n    HTMLElement createContainer();\n\n    HTMLElement createRow(LayoutRow layoutRow);\n\n    HTMLElement createColumn(LayoutColumn layoutColumn);\n\n    IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent);\n\n    default Optional<IsWidget> getComponentPart(HTMLElement column, LayoutComponent layoutComponent, String partId) {\n        return Optional.empty();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/BeanHelper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.jboss.errai.ioc.client.container.IOC;\n\npublic class BeanHelper {\n\n    public static void destroy(Object o) {\n        IOC.getBeanManager().destroyBean(o);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ColumnDrop.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropType;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\n\npublic class ColumnDrop {\n\n    private final String endId;\n    private final Orientation orientation;\n    private LayoutComponent component;\n    private ComponentDropType type;\n    private Column oldColumn;\n\n    public ColumnDrop(LayoutComponent component,\n                      String endId,\n                      Orientation orientation) {\n        this.component = component;\n        this.endId = endId;\n        this.orientation = orientation;\n        this.type = ComponentDropType.NEW;\n    }\n\n    public Orientation getOrientation() {\n        return orientation;\n    }\n\n    public String getEndId() {\n        return endId;\n    }\n\n    public LayoutComponent getComponent() {\n        return component;\n    }\n\n    public boolean isASideDrop() {\n        return getOrientation() == ColumnDrop.Orientation.LEFT ||\n                getOrientation() == ColumnDrop.Orientation.RIGHT;\n    }\n\n    public boolean isALeftDrop() {\n        return getOrientation() == ColumnDrop.Orientation.LEFT;\n    }\n\n    public boolean isADownDrop() {\n        return getOrientation() == ColumnDrop.Orientation.DOWN;\n    }\n\n    public Column getOldColumn() {\n        return oldColumn;\n    }\n\n    public boolean newComponent() {\n        return type == ComponentDropType.NEW;\n    }\n\n    public ColumnDrop fromMove(Column oldColumn) {\n        this.oldColumn = oldColumn;\n        this.type = ComponentDropType.FROM_MOVE;\n        return this;\n    }\n\n    public ComponentDropType getType() {\n        return type;\n    }\n\n    public enum Orientation {\n        LEFT,\n        RIGHT,\n        UP,\n        DOWN\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ColumnDropContext.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class ColumnDropContext {\n\n    private static ColumnDrop activeDrop;\n\n    public static void setActiveDrop(ColumnDrop columnDrop) {\n        activeDrop = columnDrop;\n    }\n\n    public static ColumnDrop getActiveDrop() {\n        return activeDrop;\n    }\n\n    public static void clear() {\n        activeDrop = null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ColumnResizeEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class ColumnResizeEvent {\n\n    private int columnHash;\n    private int rowHash;\n    private Direction direction = Direction.LEFT;\n\n    public ColumnResizeEvent(int columnHash,\n                             int rowHash) {\n\n        this.columnHash = columnHash;\n        this.rowHash = rowHash;\n    }\n\n    public int getRowHash() {\n        return rowHash;\n    }\n\n    public int getColumnHash() {\n        return columnHash;\n    }\n\n    public ColumnResizeEvent left() {\n        this.direction = Direction.LEFT;\n        return this;\n    }\n\n    public ColumnResizeEvent right() {\n        this.direction = Direction.RIGHT;\n        return this;\n    }\n\n    public boolean isLeft() {\n        return direction == Direction.LEFT;\n    }\n\n    public Direction getDirection() {\n        return direction;\n    }\n\n    private enum Direction {\n        LEFT,\n        RIGHT;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ColumnSizeBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.gwtbootstrap3.client.ui.constants.ColumnSize;\n\npublic class ColumnSizeBuilder {\n\n    public static String buildColumnSize(final int value) {\n        switch (value) {\n            case 1:\n                return buildSize(ColumnSize.MD_1);\n            case 2:\n                return buildSize(ColumnSize.MD_2);\n            case 3:\n                return buildSize(ColumnSize.MD_3);\n            case 4:\n                return buildSize(ColumnSize.MD_4);\n            case 5:\n                return buildSize(ColumnSize.MD_5);\n            case 6:\n                return buildSize(ColumnSize.MD_6);\n            case 7:\n                return buildSize(ColumnSize.MD_7);\n            case 8:\n                return buildSize(ColumnSize.MD_8);\n            case 9:\n                return buildSize(ColumnSize.MD_9);\n            case 10:\n                return buildSize(ColumnSize.MD_10);\n            case 11:\n                return buildSize(ColumnSize.MD_11);\n            case 12:\n                return buildSize(ColumnSize.MD_12);\n            default:\n                return buildSize(ColumnSize.MD_12);\n        }\n    }\n\n    private static String buildSize(ColumnSize mdSize) {\n        String size = mdSize.getCssName() + \" \" + ColumnSize.XS_12.getCssName();\n        if (mdSize == ColumnSize.MD_4) {\n            size += \" \" + ColumnSize.SM_6.getCssName();\n        } else if (mdSize == ColumnSize.MD_5) {\n            size += \" \" + ColumnSize.SM_6.getCssName();\n        } else if (mdSize == ColumnSize.MD_6) {\n            size += \" \" + ColumnSize.SM_6.getCssName();\n        } else {\n            size += \" \" + ColumnSize.SM_12.getCssName();\n        }\n        return size;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ConfigurationContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.mvp.Command;\n\n/**\n * This class provides the context required during a layout component configuration\n */\npublic class ConfigurationContext {\n\n    private LayoutComponent component;\n    private Command configurationFinish;\n    private Command configurationCanceled;\n    private Supplier<LayoutTemplate> currentLayoutTemplateSupplier;\n\n    public ConfigurationContext(LayoutComponent component,\n                                Command configurationFinish,\n                                Command configurationCanceled,\n                                Supplier<LayoutTemplate> currentLayoutTemplateSupplier) {\n        this.component = component;\n        this.configurationFinish = configurationFinish;\n        this.configurationCanceled = configurationCanceled;\n        this.currentLayoutTemplateSupplier = currentLayoutTemplateSupplier;\n    }\n\n    public void setComponentProperty(String key,\n                                     String property) {\n        component.addProperty(key,\n                              property);\n    }\n\n    public void removeComponentProperty(String key) {\n        component.getProperties().remove(key);\n    }\n\n    public String getComponentProperty(String key) {\n        return component.getProperties().get(key);\n    }\n\n    public Map<String, String> getComponentProperties() {\n        return component.getProperties();\n    }\n\n    public void resetComponentProperties() {\n        component.getProperties().clear();\n    }\n\n    public void configurationFinished() {\n        configurationFinish.execute();\n    }\n\n    public void configurationCancelled() {\n        configurationCanceled.execute();\n    }\n\n    public LayoutTemplate getCurrentLayoutTemplate() {\n        return currentLayoutTemplateSupplier.get();\n    }\n\n    public Command getConfigurationCanceled() {\n        return configurationCanceled;\n    }\n\n    public void setConfigurationCanceled(final Command configurationCanceled) {\n        this.configurationCanceled = configurationCanceled;\n    }\n\n    public Command getConfigurationFinish() {\n        return configurationFinish;\n    }\n\n    public void setConfigurationFinish(final Command configurationFinish) {\n        this.configurationFinish = configurationFinish;\n    }\n    \n    public LayoutComponent getLayoutComponent() {\n        return this.component;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/ContainerResizeEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class ContainerResizeEvent {\n\n    private int columnHashCode;\n    private int rowHashCode;\n    private Direction direction = Direction.LEFT;\n\n    public ContainerResizeEvent(int columnHashCode,\n                                int rowHashCode) {\n\n        this.columnHashCode = columnHashCode;\n        this.rowHashCode = rowHashCode;\n    }\n\n    public ContainerResizeEvent() {\n    }\n\n    public int getRowHashCode() {\n        return rowHashCode;\n    }\n\n    public int getColumnHashCode() {\n        return columnHashCode;\n    }\n\n    public ContainerResizeEvent left() {\n        this.direction = Direction.LEFT;\n        return this;\n    }\n\n    public ContainerResizeEvent right() {\n        this.direction = Direction.RIGHT;\n        return this;\n    }\n\n    public boolean isLeft() {\n        return direction == Direction.LEFT;\n    }\n\n    public Direction getDirection() {\n        return direction;\n    }\n\n    private enum Direction {\n        LEFT,\n        RIGHT;\n    }\n\n    ;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/DnDManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDnDEvent;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDrop;\n\n@ApplicationScoped\npublic class DnDManager {\n\n    @Inject\n    Event<RowDnDEvent> rowDnDEvent;\n\n    private boolean isOnRowMove;\n    private String rowIdBegin;\n\n    private boolean isOnComponentMove;\n    private LayoutComponent layoutComponentMove;\n    private String rowId;\n    private Column draggedColumn;\n\n    public void beginRowMove(String rowIdBegin) {\n        this.rowIdBegin = rowIdBegin;\n        this.isOnRowMove = true;\n    }\n\n    public void endRowMove(String rowIdEnd,\n                           RowDrop.Orientation orientation) {\n        if (isOnRowMove) {\n            rowDnDEvent.fire(new RowDnDEvent(rowIdBegin,\n                                             rowIdEnd,\n                                             orientation));\n            isOnRowMove = false;\n        }\n    }\n\n    public void dragEndMove() {\n        this.isOnRowMove = false;\n    }\n\n    public Column getDraggedColumn() {\n        return draggedColumn;\n    }\n\n    public void endComponentMove() {\n        if (isOnComponentMove) {\n            isOnComponentMove = false;\n        }\n    }\n\n    public boolean isOnRowMove() {\n        return isOnRowMove;\n    }\n\n    public boolean isOnComponentMove() {\n        return isOnComponentMove;\n    }\n\n    public boolean canMoveRow() {\n        return !isOnComponentMove();\n    }\n\n    public void dragComponent(LayoutComponent layoutComponentMove,\n                              String rowId,\n                              Column draggedColumn) {\n        this.layoutComponentMove = layoutComponentMove;\n        this.rowId = rowId;\n        this.draggedColumn = draggedColumn;\n        this.isOnComponentMove = true;\n    }\n\n    public String getRowId() {\n        return rowId;\n    }\n\n    public void dragEndComponent() {\n        this.isOnComponentMove = false;\n    }\n\n    public LayoutComponent getLayoutComponentMove() {\n        return layoutComponentMove;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/DndDataJSONConverter.java",
    "content": "/*\n* Copyright 2015 JBoss Inc\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*       http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport com.google.gwt.json.client.JSONObject;\nimport com.google.gwt.json.client.JSONParser;\nimport com.google.gwt.json.client.JSONString;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.ext.layout.editor.client.api.HasDragAndDropSettings;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\n\npublic class DndDataJSONConverter {\n\n    public static final String COMPONENT_TYPE = \"type\";\n    public static final String COMPONENT_PARAMS = \"params\";\n\n    public String generateDragComponentJSON(LayoutDragComponent dragComponent) {\n        JSONObject jsonComponent = new JSONObject();\n        extractBeanClass(dragComponent,\n                         jsonComponent);\n        if (dragComponent instanceof HasDragAndDropSettings) {\n            JSONObject params = new JSONObject();\n\n            HasDragAndDropSettings sComponent = (HasDragAndDropSettings) dragComponent;\n\n            for (String key : sComponent.getSettingsKeys()) {\n                String value = sComponent.getSettingValue(key);\n                params.put(key,\n                           new JSONString(value));\n            }\n\n            jsonComponent.put(COMPONENT_PARAMS,\n                              params);\n        }\n\n        return jsonComponent.toString();\n    }\n\n    private void extractBeanClass(LayoutDragComponent dragComponent,\n                                  JSONObject jsonComponent) {\n        LayoutDragComponentHelper layoutDragComponentHelper = getDragHelper();\n        jsonComponent.put(COMPONENT_TYPE,\n                          new JSONString(layoutDragComponentHelper.getRealBeanClass(dragComponent)));\n    }\n\n    private LayoutDragComponentHelper getDragHelper() {\n        return IOC.getBeanManager().lookupBean(LayoutDragComponentHelper.class).getInstance();\n    }\n\n    public LayoutDragComponent readJSONDragComponent(String json) {\n        JSONObject jsonObject = JSONParser.parseStrict(json).isObject();\n\n        JSONString typeValue = jsonObject.get(COMPONENT_TYPE).isString();\n        if (typeValue != null) {\n            String type = typeValue.stringValue();\n\n            return getLayoutDragComponent(jsonObject,\n                                          type);\n        }\n\n        return null;\n    }\n\n    private LayoutDragComponent getLayoutDragComponent(JSONObject jsonObject,\n                                                       String type) {\n        LayoutDragComponent dragComponent = getLayoutDragComponent(type);\n\n        if (dragComponent instanceof HasDragAndDropSettings) {\n            HasDragAndDropSettings sComponent = (HasDragAndDropSettings) dragComponent;\n\n            JSONObject params = jsonObject.get(COMPONENT_PARAMS).isObject();\n\n            if (params != null) {\n                for (String key : params.keySet()) {\n                    JSONString value = params.get(key).isString();\n                    if (value != null) {\n                        sComponent.setSettingValue(key,\n                                                   value.stringValue());\n                    }\n                }\n            }\n        }\n\n        return dragComponent;\n    }\n\n    private LayoutDragComponent getLayoutDragComponent(String type) {\n        LayoutDragComponentHelper layoutDragComponentHelper = getDragHelper();\n        LayoutDragComponent layoutDragComponent = layoutDragComponentHelper.lookupDragTypeBean(type);\n        return layoutDragComponent;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/DragComponentEndEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class DragComponentEndEvent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/DragHelperComponentColumn.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Supplier;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.mvp.Command;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\n\n@Dependent\npublic class DragHelperComponentColumn {\n\n    @Inject\n    LayoutDragComponentHelper dragHelper;\n\n    @Inject\n    LayoutEditorCssHelper layoutCssHelper;\n\n    @Inject\n    Document document;\n\n    private LayoutDragComponent layoutDragComponent;\n\n    private LayoutComponent layoutComponent;\n\n    private LayoutTemplate.Style pageStyle;\n\n    public LayoutDragComponent getLayoutDragComponent() {\n        if (layoutDragComponent == null) {\n            layoutDragComponent =\n                    dragHelper.lookupDragTypeBean(layoutComponent.getDragTypeName());\n        }\n        return layoutDragComponent;\n    }\n\n    public List<PropertyEditorCategory> getLayoutDragComponentProperties() {\n        List<PropertyEditorCategory> result = layoutCssHelper.getComponentPropertyCategories(layoutComponent);\n        result.addAll(getLayoutDragComponent().getPropertyCategories(layoutComponent));\n        return result;\n    }\n\n    public boolean hasModalConfiguration() {\n        return getLayoutDragComponent() instanceof HasModalConfiguration;\n    }\n\n    public void setup(LayoutComponent layoutComponent,\n                      LayoutTemplate.Style pageStyle) {\n        this.layoutComponent = layoutComponent;\n        this.pageStyle = pageStyle;\n    }\n\n    public HTMLElement getPreviewElement(Widget context) {\n        HTMLElement div = document.createElement(\"div\");\n        applyCssPropertiesToLayoutComponent(div);\n        addCSSClass(div,\n                    \"uf-perspective-col\");\n\n        if (LayoutTemplate.Style.PAGE == pageStyle) {\n            addCSSClass(div,\n                    \"uf-le-overflow\");\n        }\n        FlowPanel gwtDivWrapper = GWT.create(FlowPanel.class);\n        LayoutDragComponent layoutDragComponent = getLayoutDragComponent();\n        RenderingContext ctx = new RenderingContext(layoutComponent,context);\n        gwtDivWrapper.add(getLayoutDragComponent().getPreviewWidget(ctx).asWidget());\n        \n        layoutComponent.getParts().forEach(part -> {\n            layoutDragComponent.getContentPart(part.getPartId(), ctx).ifPresent(contentPart -> {\n                applyCssProperties(contentPart.asWidget(), part.getCssProperties());\n            });\n        });\n        \n        DOMUtil.appendWidgetToElement(div,\n                                      gwtDivWrapper);\n        return div;\n    }\n\n    public void showConfigModal(Command configurationFinish,\n                                Command configurationCanceled,\n                                Supplier<LayoutTemplate> currentLayoutTemplateSupplier) {\n        ModalConfigurationContext ctx = new ModalConfigurationContext(layoutComponent,\n                                                                      configurationFinish,\n                                                                      configurationCanceled,\n                                                                      currentLayoutTemplateSupplier);\n        Modal configModal = ((HasModalConfiguration)\n                getLayoutDragComponent()).getConfigurationModal(ctx);\n        configModal.show();\n    }\n    \n    protected void applyCssPropertiesToLayoutComponent(HTMLElement widget) {\n        applyCssProperties(ElementWrapperWidget.getWidget(widget), layoutComponent.getProperties());\n    }\n    \n    protected void applyCssProperties(Widget widget, Map<String, String> properties) {\n        List<CssValue> cssValues = layoutCssHelper.readCssValues(properties);\n        cssValues.forEach(cssValue -> {\n            String prop = cssValue.getPropertyInCamelCase();\n            String val = cssValue.getValue();\n            widget.getElement().getStyle().setProperty(prop, val);\n        });\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/HTML5DnDHelper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.jboss.errai.common.client.dom.Event;\n\npublic class HTML5DnDHelper {\n\n    public static native String extractDndData(Event e) /*-{\n        return e.dataTransfer.getData(\"text\");\n    }-*/;\n\n    public static native String setDndData(Event e,\n                                           String content) /*-{\n        return e.dataTransfer.setData(\"text\", content);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/LayoutDragComponentHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Predicate;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.Factory;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.HasDragAndDropSettings;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.infra.experimental.DisabledExperimentalLayoutComponent;\n\n@Dependent\npublic class LayoutDragComponentHelper {\n\n    private SyncBeanManager beanManager;\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n\n    private DndDataJSONConverter converter = new DndDataJSONConverter();\n    private List<Object> instances = new ArrayList<>();\n\n    @Inject\n    public LayoutDragComponentHelper(SyncBeanManager beanManager, ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService) {\n        this.beanManager = beanManager;\n        this.experimentalFeaturesRegistryService = experimentalFeaturesRegistryService;\n    }\n\n    @PreDestroy\n    public void destroy() {\n        for (Object instance : instances) {\n            destroy(instance);\n        }\n    }\n\n    public LayoutDragComponent lookupDragTypeBean(String dragTypeClassName) {\n        return lookupBean(dragTypeClassName);\n    }\n\n    private LayoutDragComponent lookupBean(String dragTypeClassName) {\n        Collection<SyncBeanDef<LayoutDragComponent>> iocBeanDefs = beanManager.lookupBeans(LayoutDragComponent.class);\n\n        Optional<SyncBeanDef<LayoutDragComponent>> optional = iocBeanDefs.stream()\n                .filter(syncBeanDefBeanClassNamePredicate(dragTypeClassName))\n                .findAny();\n\n        if (optional.isPresent()) {\n            SyncBeanDef<LayoutDragComponent> beanDef = optional.get();\n\n            LayoutDragComponent instance;\n\n            if (isAnEnabledExperimentalFeature(beanDef)) {\n                instance = beanDef.getInstance();\n            } else {\n                DisabledExperimentalLayoutComponent disabled = beanManager.lookupBean(DisabledExperimentalLayoutComponent.class).newInstance();\n                disabled.setFeatureId(beanDef.getBeanClass().getName());\n\n                instance = disabled;\n            }\n            instances.add(instance);\n            return instance;\n        }\n\n        return null;\n    }\n\n    boolean isAnEnabledExperimentalFeature(SyncBeanDef<LayoutDragComponent> beanDef) {\n        return experimentalFeaturesRegistryService.isFeatureEnabled(beanDef.getBeanClass().getName());\n    }\n\n    Predicate<SyncBeanDef<LayoutDragComponent>> syncBeanDefBeanClassNamePredicate(String dragTypeClassName) {\n        return beanDef -> beanDef.getBeanClass().getName().equals(dragTypeClassName);\n    }\n\n    public String getRealBeanClass(LayoutDragComponent instance) {\n        return Factory.maybeUnwrapProxy(instance).getClass().getName();\n    }\n\n    public LayoutComponent getLayoutComponentFromDrop(String dropData) {\n        LayoutDragComponent component = extractComponent(dropData);\n        LayoutComponent layoutComponent = getLayoutComponent(component);\n        return layoutComponent;\n    }\n\n    public LayoutComponent getLayoutComponent(LayoutDragComponent dragComponent) {\n\n        LayoutComponent layoutComponent = new LayoutComponent(getRealBeanClass(dragComponent));\n\n        if (dragComponent instanceof HasDragAndDropSettings) {\n            Map<String, String> properties = ((HasDragAndDropSettings) dragComponent).getMapSettings();\n\n            if (properties != null) {\n                layoutComponent.addProperties(properties);\n            }\n        }\n\n        return layoutComponent;\n    }\n\n    private LayoutDragComponent extractComponent(String dropData) {\n        return converter\n                .readJSONDragComponent(dropData);\n    }\n\n    private boolean hasComponent(LayoutComponent component) {\n        return component != null;\n    }\n\n    protected void destroy(Object o) {\n        BeanHelper.destroy(o);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/LayoutEditorCssHelper.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.uberfire.ext.layout.editor.api.css.*;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementWithProperties;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CssAllowedValueConstants;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.PropertiesConstants;\nimport org.uberfire.ext.layout.editor.client.validator.LayoutEditorPropertyLengthValidator;\nimport org.uberfire.ext.layout.editor.client.validator.LayoutEditorPropertyNumberValidator;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport java.util.*;\nimport java.util.stream.Collectors;\n\n@ApplicationScoped\npublic class LayoutEditorCssHelper {\n\n    private Map<CssValueType,PropertyFieldValidator> valueTypeValidatorMap = new HashMap<>();\n    private Map<String,String> propertyCategoryMapI18n = new HashMap<>();\n    private Map<CssProperty,String> propertyNameMapI18n = new HashMap<>();\n    private Map<CssProperty,String> propertyHelpMapI18n = new HashMap<>();\n\n    public static final String CSS_CATEGORY_PANEL = \"panel\";\n    public static final String CSS_CATEGORY_TEXT = \"text\";\n    public static final String CSS_CATEGORY_MARGIN = \"margin\";\n    public static final String CSS_CATEGORY_PADDING = \"padding\";\n\n    public LayoutEditorCssHelper() {\n        valueTypeValidatorMap.put(CssValueType.LENGTH, new LayoutEditorPropertyLengthValidator());\n        valueTypeValidatorMap.put(CssValueType.NUMBER, new LayoutEditorPropertyNumberValidator());\n\n        propertyCategoryMapI18n.put(CSS_CATEGORY_PANEL, PropertiesConstants.INSTANCE.panel());\n        propertyCategoryMapI18n.put(CSS_CATEGORY_TEXT, PropertiesConstants.INSTANCE.text());\n        propertyCategoryMapI18n.put(CSS_CATEGORY_MARGIN, PropertiesConstants.INSTANCE.margin());\n        propertyCategoryMapI18n.put(CSS_CATEGORY_PADDING, PropertiesConstants.INSTANCE.padding());\n\n        propertyNameMapI18n.put(CssProperty.WIDTH, PropertiesConstants.INSTANCE.width());\n        propertyNameMapI18n.put(CssProperty.HEIGHT, PropertiesConstants.INSTANCE.height());\n        propertyNameMapI18n.put(CssProperty.FLOAT, PropertiesConstants.INSTANCE.float_property());\n        propertyNameMapI18n.put(CssProperty.BACKGROUND_COLOR, PropertiesConstants.INSTANCE.background_color());\n        propertyNameMapI18n.put(CssProperty.MARGIN_TOP, PropertiesConstants.INSTANCE.margin_top());\n        propertyNameMapI18n.put(CssProperty.MARGIN_BOTTOM, PropertiesConstants.INSTANCE.margin_bottom());\n        propertyNameMapI18n.put(CssProperty.MARGIN_LEFT, PropertiesConstants.INSTANCE.margin_left());\n        propertyNameMapI18n.put(CssProperty.MARGIN_RIGHT, PropertiesConstants.INSTANCE.margin_right());\n        propertyNameMapI18n.put(CssProperty.PADDING_TOP, PropertiesConstants.INSTANCE.padding_top());\n        propertyNameMapI18n.put(CssProperty.PADDING_BOTTOM, PropertiesConstants.INSTANCE.padding_bottom());\n        propertyNameMapI18n.put(CssProperty.PADDING_LEFT, PropertiesConstants.INSTANCE.padding_left());\n        propertyNameMapI18n.put(CssProperty.PADDING_RIGHT, PropertiesConstants.INSTANCE.padding_right());\n        propertyNameMapI18n.put(CssProperty.TEXT_ALIGN, PropertiesConstants.INSTANCE.text_align());\n        propertyNameMapI18n.put(CssProperty.TEXT_DECORATION, PropertiesConstants.INSTANCE.text_decoration());\n        propertyNameMapI18n.put(CssProperty.COLOR, PropertiesConstants.INSTANCE.color());\n        propertyNameMapI18n.put(CssProperty.FONT_SIZE, PropertiesConstants.INSTANCE.font_size());\n        propertyNameMapI18n.put(CssProperty.FONT_WEIGHT, PropertiesConstants.INSTANCE.font_weight());\n\n        propertyHelpMapI18n.put(CssProperty.WIDTH, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.HEIGHT, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.MARGIN_TOP, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.MARGIN_BOTTOM, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.MARGIN_LEFT, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.MARGIN_RIGHT, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.PADDING_TOP, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.PADDING_BOTTOM, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.PADDING_LEFT, PropertiesConstants.INSTANCE.length_help());\n        propertyHelpMapI18n.put(CssProperty.PADDING_RIGHT, PropertiesConstants.INSTANCE.length_help());\n    }\n\n    public String formatCssAllowedValue(CssProperty cssProperty) {\n        return propertyNameMapI18n.get(cssProperty);\n    }\n\n    public String getHelpText(CssProperty cssProperty) {\n        return propertyHelpMapI18n.get(cssProperty);\n    }\n\n    public List<PropertyFieldValidator> getValidators(CssProperty property) {\n        List<PropertyFieldValidator> result = new ArrayList<>();\n        for (CssValueType cssValueType : property.getSupportedValueTypes()) {\n            PropertyFieldValidator validator = valueTypeValidatorMap.get(cssValueType);\n            if (validator != null) {\n                result.add(validator);\n            }\n        }\n        return result;\n    }\n\n    public PropertyEditorType resolveFieldType(CssProperty cssProperty) {\n        if (cssProperty.supportsValueType(CssValueType.COLOR)) {\n            return PropertyEditorType.COLOR;\n        }\n        if (!cssProperty.getAllowedValues().isEmpty()) {\n            return PropertyEditorType.COMBO;\n        }\n        return PropertyEditorType.TEXT;\n    }\n\n    public PropertyEditorCategory createCategory(String categoryCode) {\n        String name = propertyCategoryMapI18n.get(categoryCode);\n        return new PropertyEditorCategory(name);\n    }\n\n    public PropertyEditorFieldInfo createField(LayoutElementWithProperties element, CssProperty property) {\n        return createField(element.getProperties(), property);\n    }\n\n    public PropertyEditorFieldInfo createField(Map<String,String> propertyMap, CssProperty property) {\n        String propValue = propertyMap.get(property.getName());\n        return createPropertyField(property, propValue == null ? \"\" : propValue);\n    }\n\n    public PropertyEditorFieldInfo createPropertyField(CssProperty property, String value) {\n        String displayName = propertyNameMapI18n.get(property);\n        String helpText = propertyHelpMapI18n.get(property);\n        PropertyEditorType propType = resolveFieldType(property);\n        List<PropertyFieldValidator> validators = getValidators(property);\n        List<CssAllowedValue> allowedValues = property.getAllowedValues();\n        CssAllowedValue allowedValue = parseCssAllowedValue(property, value);\n        String currentValue = allowedValue != null ? formatCssAllowedValue(property, allowedValue) : value;\n\n        PropertyEditorFieldInfo field = new PropertyEditorFieldInfo(displayName, currentValue, propType)\n                .withKey(property.getName());\n\n        if (helpText != null) {\n            field.withHelpInfo(\"\", helpText);\n        }\n        if (validators != null && !validators.isEmpty()) {\n            field.withValidators(validators);\n        }\n        if (allowedValues != null && !allowedValues.isEmpty()) {\n            field.withComboValues(allowedValues.stream()\n                    .map(v -> formatCssAllowedValue(property, v))\n                    .collect(Collectors.toList()));\n        }\n\n        return field;\n    }\n\n    public String formatCssAllowedValue(CssProperty property, CssAllowedValue value) {\n        String i18nKey = property.toString() + \"__\" + value.toString();\n        return CssAllowedValueConstants.INSTANCE.getString(i18nKey);\n    }\n\n    public CssAllowedValue parseCssAllowedValue(String property, String value) {\n        CssProperty cssProperty = CssProperty.get(property);\n        if (cssProperty != null) {\n            return parseCssAllowedValue(cssProperty, value);\n        }\n        return null;\n    }\n\n    public CssAllowedValue parseCssAllowedValue(CssProperty property, String value) {\n        for (CssAllowedValue cssAllowedValue : property.getAllowedValues()) {\n            String targetValue = formatCssAllowedValue(property, cssAllowedValue);\n            if (value.equals(targetValue)) {\n                return cssAllowedValue;\n            }\n        }\n        return null;\n    }\n\n    public List<CssValue> readCssValues(Map<String,String> propertyMap) {\n        if (propertyMap == null || propertyMap.isEmpty()) {\n            return new ArrayList<>();\n        }\n\n        return propertyMap.entrySet().stream()\n            .filter(entry -> CssProperty.get(entry.getKey()) != null)\n            .map(entry -> new CssValue(entry.getKey(), entry.getValue()))\n            .collect(Collectors.toList());\n    }\n\n    // Layout element properties\n\n    public List<PropertyEditorCategory> getContainerPropertyCategories(Container container) {\n        List<PropertyEditorCategory> result = new ArrayList<>();\n\n        PropertyEditorCategory category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL);\n        category.withField(createField(container, CssProperty.WIDTH));\n        category.withField(createField(container, CssProperty.HEIGHT));\n        category.withField(createField(container, CssProperty.FLOAT));\n        category.withField(createField(container, CssProperty.BACKGROUND_COLOR));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN);\n        category.withField(createField(container, CssProperty.MARGIN_TOP));\n        category.withField(createField(container, CssProperty.MARGIN_BOTTOM));\n        category.withField(createField(container, CssProperty.MARGIN_LEFT));\n        category.withField(createField(container, CssProperty.MARGIN_RIGHT));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PADDING);\n        category.withField(createField(container, CssProperty.PADDING_TOP));\n        category.withField(createField(container, CssProperty.PADDING_BOTTOM));\n        category.withField(createField(container, CssProperty.PADDING_LEFT));\n        category.withField(createField(container, CssProperty.PADDING_RIGHT));\n        result.add(category);\n\n        return result;\n    }\n\n    public List<PropertyEditorCategory> getRowPropertyCategories(Row row) {\n        List<PropertyEditorCategory> result = new ArrayList<>();\n\n        PropertyEditorCategory category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL);\n        category.withField(createField(row, CssProperty.WIDTH));\n        category.withField(createField(row, CssProperty.HEIGHT));\n        category.withField(createField(row, CssProperty.FLOAT));\n        category.withField(createField(row, CssProperty.BACKGROUND_COLOR));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN);\n        category.withField(createField(row, CssProperty.MARGIN_TOP));\n        category.withField(createField(row, CssProperty.MARGIN_BOTTOM));\n        category.withField(createField(row, CssProperty.MARGIN_LEFT));\n        category.withField(createField(row, CssProperty.MARGIN_RIGHT));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL);\n        category.withField(createField(row, CssProperty.PADDING_TOP));\n        category.withField(createField(row, CssProperty.PADDING_BOTTOM));\n        category.withField(createField(row, CssProperty.PADDING_LEFT));\n        category.withField(createField(row, CssProperty.PADDING_RIGHT));\n        result.add(category);\n\n        return result;\n    }\n\n    public List<PropertyEditorCategory> getComponentPropertyCategories(LayoutComponent layoutComponent) {\n        List<PropertyEditorCategory> result = new ArrayList<>();\n        Map<String,String> propertyMap = layoutComponent.getProperties();\n\n        PropertyEditorCategory category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL);\n        category.withField(createField(propertyMap, CssProperty.WIDTH));\n        category.withField(createField(propertyMap, CssProperty.HEIGHT));\n        category.withField(createField(propertyMap, CssProperty.BACKGROUND_COLOR));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN);\n        category.withField(createField(propertyMap, CssProperty.MARGIN_TOP));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_BOTTOM));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_LEFT));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_RIGHT));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PADDING);\n        category.withField(createField(propertyMap, CssProperty.PADDING_TOP));\n        category.withField(createField(propertyMap, CssProperty.PADDING_BOTTOM));\n        category.withField(createField(propertyMap, CssProperty.PADDING_LEFT));\n        category.withField(createField(propertyMap, CssProperty.PADDING_RIGHT));\n        result.add(category);\n\n        return result;\n    }\n    \n    public List<PropertyEditorCategory> allCategories(Map<String,String> propertyMap) {\n        List<PropertyEditorCategory> result = new ArrayList<>();\n\n        PropertyEditorCategory category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PANEL);\n        category.withField(createField(propertyMap, CssProperty.WIDTH));\n        category.withField(createField(propertyMap, CssProperty.HEIGHT));\n        category.withField(createField(propertyMap, CssProperty.BACKGROUND_COLOR));\n        category.withField(createField(propertyMap, CssProperty.FLOAT));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_MARGIN);\n        category.withField(createField(propertyMap, CssProperty.MARGIN_TOP));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_BOTTOM));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_LEFT));\n        category.withField(createField(propertyMap, CssProperty.MARGIN_RIGHT));\n        result.add(category);\n\n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_PADDING);\n        category.withField(createField(propertyMap, CssProperty.PADDING_TOP));\n        category.withField(createField(propertyMap, CssProperty.PADDING_BOTTOM));\n        category.withField(createField(propertyMap, CssProperty.PADDING_LEFT));\n        category.withField(createField(propertyMap, CssProperty.PADDING_RIGHT));\n        result.add(category);\n        \n        category = createCategory(LayoutEditorCssHelper.CSS_CATEGORY_TEXT);\n        category.withField(createField(propertyMap, CssProperty.FONT_SIZE));\n        category.withField(createField(propertyMap, CssProperty.FONT_WEIGHT));\n        category.withField(createField(propertyMap, CssProperty.TEXT_ALIGN));\n        category.withField(createField(propertyMap, CssProperty.TEXT_DECORATION));\n        category.withField(createField(propertyMap, CssProperty.COLOR));\n        result.add(category);\n\n        return result;\n    }    \n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/LayoutEditorFocusController.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Overflow;\n\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\n\n@ApplicationScoped\npublic class LayoutEditorFocusController {\n\n    private HTMLElement scrollElement;\n    private boolean dirty = false;\n    private double recordedScrollLeft;\n    private double recordedScrollTop;\n    \n\n    public void setTargetContainerView(Container.View view) {\n        HTMLElement element = Js.cast(view.getElement());\n        Scheduler.get().scheduleDeferred(() -> {\n            scrollElement = findScrollableParent(element);\n        });\n    }\n\n    public void recordFocus() {\n        if (scrollElement != null && !dirty) {\n            recordedScrollLeft = scrollElement.scrollLeft;\n            recordedScrollTop = scrollElement.scrollTop;\n            dirty = true;\n        }\n    }\n    \n    public void restoreFocus() {\n        if (scrollElement != null) {\n            scrollElement.scrollLeft = recordedScrollLeft;\n            scrollElement.scrollTop = recordedScrollTop;\n        }\n        dirty = false;\n    }\n    \n    public boolean isDirty() {\n        return dirty;\n    }\n    \n    protected HTMLElement findScrollableParent(HTMLElement element) {\n        HTMLElement scrollElement = null;\n        while (element != null) {\n            if (isScrollable(element)) {\n                scrollElement = element;\n                break;\n            }\n            else if (element.parentNode instanceof HTMLElement) {\n                element = Js.cast(element.parentNode);\n            } else {\n                break;\n            }\n        }\n        return scrollElement;\n    }\n\n    protected void setScrollableElement(HTMLElement element) {\n        this.scrollElement = element;\n    }\n\n    private boolean isScrollable(HTMLElement element) {\n        return \"auto\".equals(element.style.overflow);\n    }\n    \n    \n    \n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/LayoutTemplateAdapter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.List;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ColumnWithComponents;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\n\npublic class LayoutTemplateAdapter {\n\n    public static LayoutTemplate convert(Container container) {\n        return convertToLayoutEditor(container);\n    }\n\n    private static LayoutTemplate convertToLayoutEditor(Container container) {\n        LayoutTemplate layoutTemplate = new LayoutTemplate(container.getLayoutName(),\n                                                           container.getProperties(),\n                                                           container.getPageStyle());\n        extractRows(container.getRows(),\n                    layoutTemplate);\n        return layoutTemplate;\n    }\n\n    private static void extractRows(List<Row> rows,\n                                    LayoutTemplate layoutTemplate) {\n        for (Row row : rows) {\n            LayoutRow layoutRow = new LayoutRow(row.getHeight().toString(), row.getProperties());\n            extractColumns(row.getColumns(),\n                           layoutRow);\n            layoutTemplate.addRow(layoutRow);\n        }\n    }\n\n    private static void extractColumns(List<Column> columns,\n                                       LayoutRow layoutRow) {\n        for (Column col : columns) {\n            LayoutColumn layoutColumn = new LayoutColumn(col.getColumnWidth().toString(),\n                                                         col.getColumnHeight().toString(),\n                                                         col.getProperties());\n            if (col.hasInnerRows()) {\n                extractColumnWithComponents(col,\n                                            layoutColumn);\n            } else {\n                extractComponents(col,\n                                  layoutColumn);\n            }\n            layoutRow.add(layoutColumn);\n        }\n    }\n\n    private static void extractColumnWithComponents(Column col,\n                                                    LayoutColumn layoutColumn) {\n        if (col instanceof ColumnWithComponents) {\n            ColumnWithComponents columnWithComponents = (ColumnWithComponents) col;\n            Row row = columnWithComponents.getRow();\n            LayoutRow layoutRow = new LayoutRow(Row.ROW_DEFAULT_HEIGHT.toString(), row.getProperties());\n            extractColumns(columnWithComponents.getRow().getColumns(),\n                           layoutRow);\n            layoutColumn.addRow(layoutRow);\n        }\n    }\n\n    private static void extractComponents(Column col,\n                                          LayoutColumn layoutColumn) {\n        extractLayoutEditorComponent(col,\n                                     layoutColumn);\n    }\n\n    private static void extractLayoutEditorComponent(Column col,\n                                                     LayoutColumn layoutColumn) {\n        layoutColumn.add(col.getLayoutComponent());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/NameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.uberfire.ext.layout.editor.client.resources.i18n.CommonConstants;\n\npublic class NameValidator {\n\n    public static final String VALID_DIR_REGEX = \"^([^*\\\"\\\\/><?\\\\\\\\\\\\!|;:]*)$\";\n\n    private String error;\n\n    private NameValidator(String error) {\n        this.error = error;\n    }\n\n    public static NameValidator layoutNameValidador() {\n        return new NameValidator(CommonConstants.INSTANCE.InvalidLayoutName());\n    }\n\n    public static NameValidator tagNameValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.InvalidTagName());\n    }\n\n    public static NameValidator parameterNameValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.InvalidParameterName());\n    }\n\n    public static NameValidator activityIdValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.InvalidActivityID());\n    }\n\n    public static NameValidator menuLabelValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.InvalidMenuLabel());\n    }\n\n    public String getValidationError() {\n        return error;\n    }\n\n    public boolean isValid(String dirName) {\n        if (dirName == null || dirName.isEmpty()) {\n            return Boolean.FALSE;\n        }\n        if (!dirName.matches(VALID_DIR_REGEX)) {\n            return Boolean.FALSE;\n        }\n        return Boolean.TRUE;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/RowResizeEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class RowResizeEvent {\n\n    private int containerHash;\n    private int rowHash;\n    private Direction direction = Direction.UP;\n\n    public RowResizeEvent(int containerHash, int rowHash) {\n        this.containerHash = containerHash;\n        this.rowHash = rowHash;\n    }\n\n    public int getContainerHash() {\n        return containerHash;\n    }\n\n    public int getRowHash() {\n        return rowHash;\n    }\n\n    public RowResizeEvent up() {\n        this.direction = Direction.UP;\n        return this;\n    }\n\n    public RowResizeEvent down() {\n        this.direction = Direction.DOWN;\n        return this;\n    }\n\n    public boolean isUP() {\n        return direction == Direction.UP;\n    }\n\n    public Direction getDirection() {\n        return direction;\n    }\n\n    private enum Direction {\n        UP,\n        DOWN\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/RowSizeBuilder.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\npublic class RowSizeBuilder {\n\n    public static String buildRowSize(final String value) {\n        return \"uf-perspective-row-\" + value;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/UniqueIDGenerator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.Random;\nimport java.util.concurrent.atomic.AtomicLong;\n\npublic class UniqueIDGenerator {\n\n    private AtomicLong counter = new AtomicLong();\n\n    public String createContainerID() {\n        return \"container: \" + String.valueOf(counter.getAndIncrement());\n    }\n\n    public String createRowID(String containerID) {\n        return containerID + \"|row: \" + String.valueOf(counter.getAndIncrement());\n    }\n\n    public String createColumnID(String rowID) {\n        return rowID + \"|column: \" + String.valueOf(counter.getAndIncrement());\n    }\n\n    public String createAccordionID(String name) {\n        StringBuilder randomString = new StringBuilder();\n        Random random = new Random();\n        for (int i = 0; i < 5; i++) {\n            randomString.append(random.nextInt(26));\n        }\n        return name.replaceAll(\"\\\\s\",\n                               \"\") + randomString.toString();\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/infra/experimental/DisabledExperimentalLayoutComponent.java",
    "content": "package org.uberfire.ext.layout.editor.client.infra.experimental;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.experimental.client.disabled.component.DisabledFeatureComponent;\nimport org.uberfire.experimental.client.resources.i18n.UberfireExperimentalConstants;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\n\n@Dependent\npublic class DisabledExperimentalLayoutComponent implements LayoutDragComponent {\n\n    private String featureId;\n\n    private DisabledFeatureComponent component;\n    private TranslationService translationService;\n\n    @Inject\n    public DisabledExperimentalLayoutComponent(DisabledFeatureComponent component, TranslationService translationService) {\n        this.component = component;\n        this.translationService = translationService;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return translationService.getTranslation(UberfireExperimentalConstants.disabledExperimentalFeature);\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return render();\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        return render();\n    }\n\n    private IsWidget render() {\n        component.show(featureId);\n        return ElementWrapperWidget.getWidget(component.getElement());\n    }\n\n    public String getFeatureId() {\n        return featureId;\n    }\n\n    public void setFeatureId(String featureId) {\n        this.featureId = featureId;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/resources/LayoutEditorCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface LayoutEditorCss extends CssResource {\n\n    @ClassName(\"dropBorder\")\n    String dropBorder();\n\n    @ClassName(\"dropInactive\")\n    String dropInactive();\n\n    @ClassName(\"rowContainer\")\n    String rowContainer();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/resources/WebAppResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface WebAppResource\n        extends\n        ClientBundle {\n\n    WebAppResource INSTANCE = GWT.create(WebAppResource.class);\n\n    @Source(\"css/layout-editor.css\")\n    LayoutEditorCss CSS();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String DragAndDrop();\n\n    String InvalidGridConfiguration();\n\n    String InvalidTagName();\n\n    String InvalidParameterName();\n\n    String InvalidActivityID();\n\n    String InvalidMenuLabel();\n\n    String DuplicateParameterName();\n\n    String GridSystem();\n\n    String Components();\n\n    String InvalidLayoutName();\n\n    String Container();\n\n    String NewRow();\n\n    String Column();\n\n    String Editor();\n\n    String Preview();\n\n    String LayoutEditorProperties();\n\n    String SelectContainerHint();\n\n    String SelectRowHint();\n\n    String DragRowHint();\n\n    String SelectColumnHint();\n\n    String DragColumnHint();\n\n    String UnselectContainerHint();\n\n    String UnselectRowHint();\n\n    String UnselectColumnHint();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\npublic interface CssAllowedValueConstants extends ConstantsWithLookup {\n\n    public static final CssAllowedValueConstants INSTANCE = GWT.create(CssAllowedValueConstants.class);\n\n    String TEXT_ALIGN__LEFT();\n\n    String TEXT_ALIGN__CENTER();\n\n    String TEXT_ALIGN__RIGHT();\n\n    String FONT_SIZE__XX_SMALL();\n\n    String FONT_SIZE__X_SMALL();\n\n    String FONT_SIZE__SMALL();\n\n    String FONT_SIZE__MEDIUM();\n\n    String FONT_SIZE__LARGE();\n\n    String FONT_SIZE__X_LARGE();\n\n    String FONT_SIZE__XX_LARGE();\n\n    String FONT_WEIGHT__NORMAL();\n\n    String FONT_WEIGHT__BOLD();\n\n    String FONT_WEIGHT__BOLDER();\n\n    String FONT_WEIGHT__LIGHTER();\n\n    String TEXT_DECORATION__NONE();\n\n    String TEXT_DECORATION__UNDERLINE();\n\n    String TEXT_DECORATION__OVERLINE();\n\n    String TEXT_DECORATION__LINE_THROUGH();\n    \n    String FLOAT__NONE();\n    \n    String FLOAT__LEFT();\n    \n    String FLOAT__RIGHT();\n    \n    String FLOAT__INITIAL();\n    \n    String FLOAT__INHERIT();\n    \n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface PropertiesConstants\n        extends\n        Messages {\n\n    public static final PropertiesConstants INSTANCE = GWT.create(PropertiesConstants.class);\n\n    String elementLabel();\n\n    String propertiesLabel();\n\n    String clearAll();\n\n    String layoutElementPosition(String parentDisplay, String name, String index);\n\n    String layoutElementName(String name, String index);\n\n    String layoutElementTypePage();\n\n    String layoutElementTypeRow();\n\n    String layoutElementTypeColumn();\n\n    String layoutElementTypeComponent();\n\n    String panel();\n\n    String text();\n\n    String width();\n\n    String height();\n\n    String background_color();\n\n    String margin();\n\n    String margin_top();\n\n    String margin_bottom();\n\n    String margin_left();\n\n    String margin_right();\n\n    String padding();\n\n    String padding_top();\n\n    String padding_bottom();\n\n    String padding_left();\n\n    String padding_right();\n\n    String text_align();\n\n    String text_decoration();\n\n    String color();\n\n    String font_size();\n\n    String font_weight();\n\n    String length_help();\n\n    String float_property();\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/validator/LayoutEditorPropertyLengthValidator.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.validator;\n\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\nimport java.util.Arrays;\nimport java.util.List;\n\npublic class LayoutEditorPropertyLengthValidator implements PropertyFieldValidator {\n\n    List<String> SUFFIX_LIST = Arrays.asList(\"pt\", \"pc\", \"cm\", \"mm\", \"in\", \"px\", \"%\");\n\n    @Override\n    public boolean validate(Object value) {\n        String str = value.toString().toLowerCase();\n        if (str.length() == 0) {\n            return true;\n        }\n        for (String suffix : SUFFIX_LIST) {\n            if (str.endsWith(suffix)) {\n                String n = str.substring(0, str.length()-suffix.length());\n                return validateNumber(n);\n            }\n        }\n        return false;\n    }\n\n    public boolean validateNumber(String str) {\n        if (str.length() == 0) {\n            return true;\n        }\n        try {\n            Double.parseDouble(str);\n            return true;\n        } catch ( Exception e ) {\n            return false;\n        }\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/validator/LayoutEditorPropertyNumberValidator.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.validator;\n\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\npublic class LayoutEditorPropertyNumberValidator implements PropertyFieldValidator {\n\n    @Override\n    public boolean validate( Object value ) {\n        String str = value.toString();\n        if (str.length() == 0) {\n            return true;\n        }\n        try {\n            Double.parseDouble(str);\n            return true;\n        } catch ( Exception e ) {\n            return false;\n        }\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/KebabWidget.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"kebab\" class=\"dropdown  dropdown-kebab-pf le-kebab\">\n    <button class=\"btn btn-link dropdown-toggle le-kebab-button\" type=\"button\" id=\"dropdownKebab\"\n            data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n        <span class=\"fa fa-ellipsis-v\"></span>\n    </button>\n    <ul class=\"dropdown-menu le-kebab-dropdown\" aria-labelledby=\"dropdownKebab\">\n        <li><a data-field=\"edit\">Edit</a></li>\n        <li><a data-field=\"remove\">Remove</a></li>\n    </ul>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/KebabWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Event;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class KebabWidget implements IsElement {\n\n    @Inject\n    @DataField\n    private Anchor remove;\n\n    @Inject\n    @DataField\n    private Anchor edit;\n\n    @Inject\n    @DataField(\"le-kebab\")\n    private Div leKebab;\n\n    private Command editCommand;\n    private Command removeCommand;\n\n    public void init(Command remove,\n                     Command edit) {\n\n        this.removeCommand = remove;\n        this.editCommand = edit;\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"remove\")\n    public void removeClick(Event e) {\n        removeCommand.execute();\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"edit\")\n    public void editClick(Event e) {\n        editCommand.execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutComponentPaletteGroupProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentPalette;\n\n/**\n * Provides the {@link LayoutDragComponentGroup} to be displayed on the {@link LayoutDragComponentPalette}\n */\npublic interface LayoutComponentPaletteGroupProvider {\n\n    /**\n     * Return the name of the component group displayed in the component palette.\n     */\n    String getName();\n\n    /**\n     * Get the {@link LayoutDragComponentGroup} containing the {@link LayoutDragComponent} instances\n     * listed under the group's category in the component palette.\n     */\n    LayoutDragComponentGroup getComponentGroup();\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutComponentPalettePresenter.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ioc.client.container.Factory;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentPalette;\n\n@ApplicationScoped\npublic class LayoutComponentPalettePresenter implements LayoutDragComponentPalette {\n\n    public interface View extends UberElement<LayoutComponentPalettePresenter> {\n\n        void addDraggableComponentGroup(UberElement<LayoutDragComponentGroupPresenter> group);\n\n        void removeDraggableComponentGroup(UberElement<LayoutDragComponentGroupPresenter> id);\n    }\n\n    private View view;\n    private ManagedInstance<LayoutDragComponentGroupPresenter> layoutDragComponentGroupInstance;\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n\n    private Map<String, LayoutDragComponentGroupPresenter> layoutDragComponentGroups = new HashMap<>();\n\n    public LayoutComponentPalettePresenter() {\n    }\n\n    @Inject\n    public LayoutComponentPalettePresenter(View view, ManagedInstance<LayoutDragComponentGroupPresenter> layoutDragComponentGroupInstance, ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService) {\n        this.view = view;\n        this.layoutDragComponentGroupInstance = layoutDragComponentGroupInstance;\n        this.experimentalFeaturesRegistryService = experimentalFeaturesRegistryService;\n        view.init(this);\n    }\n\n    public UberElement<LayoutComponentPalettePresenter> getView() {\n        return view;\n    }\n\n    public Map<String, LayoutDragComponentGroupPresenter> getLayoutDragComponentGroups() {\n        return layoutDragComponentGroups;\n    }\n\n    @Override\n    public void clear() {\n        List<String> groupNames = new ArrayList<>(layoutDragComponentGroups.keySet());\n        groupNames.forEach(this::removeDraggableGroup);\n    }\n\n    @Override\n    public void addDraggableGroups(Collection<LayoutComponentPaletteGroupProvider> groupProviders) {\n        PortablePreconditions.checkNotNull(\"groupDefinitions\", groupProviders);\n\n        groupProviders.stream()\n                .filter(this::isEnabled)\n                .forEach(this::addDraggableGroup);\n    }\n\n    @Override\n    public void addDraggableGroup(LayoutComponentPaletteGroupProvider groupProvider) {\n        PortablePreconditions.checkNotNull(\"groupProvider\", groupProvider);\n\n        LayoutDragComponentGroup group = groupProvider.getComponentGroup();\n\n        Map<String, LayoutDragComponent> components = group.getComponents();\n\n        List<String> disabledGroups =  group.getComponents().entrySet().stream()\n                .filter(entry -> !isEnabled(entry.getValue()))\n                .map(entry -> entry.getKey())\n                .collect(Collectors.toList());\n\n        disabledGroups.stream()\n                .forEach(components::remove);\n\n        LayoutDragComponentGroupPresenter layoutDragComponentGroupPresenter = layoutDragComponentGroupInstance.get();\n        layoutDragComponentGroups.put(group.getName(), layoutDragComponentGroupPresenter);\n        layoutDragComponentGroupPresenter.init(group);\n        view.addDraggableComponentGroup(layoutDragComponentGroupPresenter.getView());\n    }\n\n    private boolean isEnabled(Object object) {\n        object = Factory.maybeUnwrapProxy(object);\n\n        return experimentalFeaturesRegistryService.isFeatureEnabled(object.getClass().getName());\n    }\n\n    @Override\n    public void removeDraggableGroup(String groupName) {\n        LayoutDragComponentGroupPresenter layoutDragComponentGroupPresenter = layoutDragComponentGroups\n                .remove(groupName);\n        if (layoutDragComponentGroupPresenter != null) {\n            view.removeDraggableComponentGroup(layoutDragComponentGroupPresenter.getView());\n        }\n    }\n\n    @Override\n    public boolean hasDraggableGroup(String groupName) {\n        return layoutDragComponentGroups.containsKey(groupName);\n    }\n\n    @Override\n    public void addDraggableComponent(String groupName,\n                                      String componentId,\n                                      LayoutDragComponent component) {\n        LayoutDragComponentGroupPresenter layoutDragComponentGroupPresenter = layoutDragComponentGroups\n                .get(groupName);\n        layoutDragComponentGroupPresenter.addComponent(componentId,\n                                                       component);\n    }\n\n    @Override\n    public void removeDraggableComponent(String groupName,\n                                         String componentId) {\n        LayoutDragComponentGroupPresenter layoutDragComponentGroupPresenter = layoutDragComponentGroups\n                .get(groupName);\n        if (layoutDragComponentGroupPresenter != null) {\n            layoutDragComponentGroupPresenter.removeComponent(componentId);\n        }\n    }\n\n    @Override\n    public boolean hasDraggableComponent(String groupName,\n                                         String componentId) {\n        return hasDraggableGroup(groupName) && layoutDragComponentGroups.get(groupName).hasComponent(componentId);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutComponentPaletteView.css",
    "content": ".le-component-container {\n  padding: 5px 10px 0px 5px;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutComponentPaletteView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div class=\"panel-body le-component-container\">\n    <div class=\"panel-group\" data-field=\"components\">\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutComponentPaletteView.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport org.jboss.errai.common.client.dom.*;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Templated\n@Dependent\npublic class LayoutComponentPaletteView\n        implements UberElement<LayoutComponentPalettePresenter>,\n                    LayoutComponentPalettePresenter.View, IsElement {\n\n    @Inject\n    @DataField\n    Div components;\n\n    private LayoutComponentPalettePresenter presenter;\n\n    @Override\n    public void init(LayoutComponentPalettePresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void addDraggableComponentGroup(UberElement<LayoutDragComponentGroupPresenter> group) {\n        components.appendChild(group.getElement());\n    }\n\n    @Override\n    public void removeDraggableComponentGroup(UberElement<LayoutDragComponentGroupPresenter> group) {\n        components.removeChild(group.getElement());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentGroupPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport java.util.Map;\nimport java.util.Random;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.infra.UniqueIDGenerator;\n\n@Dependent\npublic class LayoutDragComponentGroupPresenter {\n\n    private final View view;\n    private LayoutDragComponentGroup group;\n    private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n\n    @Inject\n    public LayoutDragComponentGroupPresenter(final View view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    public void init(LayoutDragComponentGroup group) {\n        this.group = group;\n        view.setTitle(idGenerator.createAccordionID(group.getName()), group.getName());\n        view.setExpanded(group.isExpandeByDefault());\n        view.addComponents(group.getComponents());\n    }\n\n    public void setExpanded(boolean expanded) {\n        view.setExpanded(expanded);\n    }\n\n    public void addComponent(String componentId,\n                             LayoutDragComponent component) {\n        if (view.hasComponent(componentId)) {\n            view.setComponentVisible(componentId, true);\n        } else {\n            view.addComponent(componentId, component);\n        }\n    }\n\n    public void removeComponent(String componentId) {\n        if (view.hasComponent(componentId)) {\n            view.setComponentVisible(componentId, false);\n        }\n    }\n\n    public boolean hasComponent(String componentId) {\n        return view.hasComponent(componentId);\n    }\n\n    public LayoutDragComponentGroupPresenter.View getView() {\n        return view;\n    }\n\n    public interface View extends UberElement<LayoutDragComponentGroupPresenter> {\n\n        void setTitle(String id,\n                      String name);\n\n        void addComponents(Map<String, LayoutDragComponent> components);\n\n        void addComponent(String componentId,\n                          LayoutDragComponent component);\n\n        void removeComponent(String componentId);\n\n        void setComponentVisible(String componentId, boolean visible);\n\n        boolean hasComponent(String componentId);\n\n        void setExpanded(boolean expanded);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentGroupView.css",
    "content": ".le-components-panel {\n    padding: 0px 10px 0px 10px;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentGroupView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"panel panel-default le-component\">\n    <div class=\"panel-heading le-heading\">\n        <h4 class=\"panel-title le-title\">\n            <a data-field=\"group-title\" data-toggle=\"collapse\">\n            </a>\n        </h4>\n    </div>\n    <div data-field=\"collapse\" class=\"panel-collapse collapse in\">\n        <div data-field=\"components\" class=\"panel-body le-components-panel\">\n\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentGroupView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\n\n@Dependent\n@Templated\npublic class LayoutDragComponentGroupView implements UberElement<LayoutDragComponentGroupPresenter>,\n                                                     LayoutDragComponentGroupPresenter.View,\n                                                     IsElement {\n\n    @Inject\n    @DataField(\"group-title\")\n    Anchor groupTitle;\n\n    @Inject\n    @DataField\n    Div components;\n\n    @Inject\n    @DataField\n    Div collapse;\n\n    @Inject\n    ManagedInstance<LayoutDragComponentWidget> layoutDragComponentWidgets;\n\n    private LayoutDragComponentGroupPresenter presenter;\n\n    private Map<String, LayoutDragComponentWidget> componentsMap = new HashMap<>();\n\n    @Override\n    public void init(LayoutDragComponentGroupPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setTitle(String id,\n                         String name) {\n        groupTitle.setTextContent(name);\n        collapse.setId(id);\n        groupTitle.setAttribute(\"href\",\n                                \"#\" + id);\n    }\n\n    @Override\n    public void addComponents(Map<String, LayoutDragComponent> dragComponents) {\n        for (String key : dragComponents.keySet()) {\n            LayoutDragComponentWidget widget = createDragComponentWidget(dragComponents.get(key));\n            componentsMap.put(key,\n                              widget);\n            components.appendChild(widget.getElement());\n        }\n    }\n\n    @Override\n    public void addComponent(String componentId,\n                             LayoutDragComponent component) {\n        LayoutDragComponentWidget widget = createDragComponentWidget(component);\n        componentsMap.put(componentId,\n                          widget);\n        components.appendChild(widget.getElement());\n    }\n\n    @Override\n    public void removeComponent(String componentId) {\n        if (hasComponent(componentId)) {\n            LayoutDragComponentWidget layoutDragComponentWidget = componentsMap.get(componentId);\n            components.removeChild(layoutDragComponentWidget.getElement());\n            componentsMap.remove(componentId);\n        }\n    }\n\n    @Override\n    public boolean hasComponent(String componentId) {\n        return componentsMap.containsKey(componentId);\n    }\n\n    @Override\n    public void setComponentVisible(String componentId, boolean visible) {\n        LayoutDragComponentWidget widget = componentsMap.get(componentId);\n        if (widget != null) {\n            widget.getElement().setHidden(!visible);\n        }\n    }\n\n    @Override\n    public void setExpanded(boolean expanded) {\n        groupTitle.setClassName(expanded ? \"\" : \"collapsed\");\n        groupTitle.setAttribute(\"aria-expanded\", Boolean.toString(expanded));\n        collapse.setClassName(\"panel-collapse collapse\"  + (expanded ? \" in\" : \"\"));\n    }\n\n    private LayoutDragComponentWidget createDragComponentWidget(LayoutDragComponent dragComponent) {\n        LayoutDragComponentWidget widget = layoutDragComponentWidgets.get();\n        widget.init(dragComponent);\n        return widget;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentWidget.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div data-field=\"dndcomponent\" class=\"le-dndcomponent\" draggable=\"true\">\n    <div class=\"le-dndcomponent-inner\">\n        <span data-field=\"icon\" class=\"fa fa-arrows le-icon\" aria-hidden=\"true\"></span>\n        <span data-field=\"title\" class=\"le-title\"> </span>\n    </div>\n</div>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutDragComponentWidget.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.infra.DndDataJSONConverter;\nimport org.uberfire.ext.layout.editor.client.infra.DragComponentEndEvent;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\nimport static org.uberfire.ext.layout.editor.client.infra.HTML5DnDHelper.setDndData;\n\n@Dependent\n@Templated\npublic class LayoutDragComponentWidget implements IsElement {\n\n    @Inject\n    @DataField\n    Span title;\n\n    @Inject\n    @DataField\n    private Span icon;\n\n    @Inject\n    @DataField\n    private Div dndcomponent;\n    private DndDataJSONConverter converter = new DndDataJSONConverter();\n\n    @Inject\n    private Event<DragComponentEndEvent> dragComponentEnd;\n\n    public void init(LayoutDragComponent dragComponent) {\n        title.setTextContent(dragComponent.getDragComponentTitle());\n        icon.setClassName(dragComponent.getDragComponentIconClass() + \" le-icon\");\n        dndcomponent.setOnmousedown(e -> addCSSClass(dndcomponent,\n                                                     \"le-dndcomponent-selected\"));\n        dndcomponent.setOnmouseup(e -> {\n            removeCSSClass(dndcomponent,\n                           \"le-dndcomponent-selected\");\n            dragComponentEnd.fire(new DragComponentEndEvent());\n        });\n        dndcomponent.setOndragend(e -> {\n            removeCSSClass(dndcomponent,\n                           \"le-dndcomponent-selected\");\n            dragComponentEnd.fire(new DragComponentEndEvent());\n        });\n        dndcomponent.setOndragstart(\n                event -> {\n                    setDndData(event,\n                               converter.generateDragComponentJSON(dragComponent));\n                });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutEditorPropertiesPresenter.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.layout.editor.client.api.*;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDnDEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementSelectEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementClearAllPropertiesEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementPropertyChangedEvent;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchResults;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchService;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType.*;\n\n@ApplicationScoped\npublic class LayoutEditorPropertiesPresenter {\n\n    public static final String PART_ROOT = \"Root\";\n\n    public interface View extends UberElement<LayoutEditorPropertiesPresenter> {\n\n        void dispose();\n\n        void showSelector(IsWidget selectorView);\n\n        void showElement(IsWidget elementView);\n\n        String getDisplayPosition(String parentPosition, String elementName, String elementIndex);\n\n        String getDisplayName(String elementName, String elementIndex);\n\n        String getLayoutElementTypePage();\n\n        String getLayoutElementTypeRow();\n\n        String getLayoutElementTypeColumn();\n\n        String getLayoutElementTypeComponent();\n\n        void setClearPropertiesEnabled(boolean enabled);\n\n        void noParts();\n\n        void showParts(List<String> parts);\n    }\n\n    private View view;\n    private ManagedInstance<LayoutElementPropertiesPresenter> layoutElementPropertiesPresenterInstance;\n    private LiveSearchDropDown<String> elementSelector;\n    private LayoutEditor layoutEditor;\n    private LayoutElementPropertiesPresenter propertiesPresenter;\n    private Map<String,LayoutElementPropertiesPresenter> presenterMap = new HashMap<>();\n\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n    LiveSearchService<String> searchService = new LiveSearchService<String>() {\n        @Override\n        public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n            LiveSearchResults result = new LiveSearchResults(maxResults);\n            layoutEditor.getLayoutElements().stream()\n                    .filter(LayoutEditorPropertiesPresenter::isSupported)\n                    .forEach(element -> {\n                        String elementId = element.getId();\n                        String elementPosition = getDisplayPosition(element);\n                        if (elementPosition.toLowerCase().contains(pattern.toLowerCase())) {\n                            result.add(elementId, elementPosition);\n                        }\n                    });\n            callback.afterSearch(result);\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n            LiveSearchResults result = new LiveSearchResults(1);\n            layoutEditor.getLayoutElements().stream()\n                    .filter(element -> LayoutEditorPropertiesPresenter.isSupported(element) && element.getId().equals(key))\n                    .findAny()\n                    .ifPresent(element -> {\n                        String elementId = element.getId();\n                        String elementPosition = getDisplayPosition(element);\n                        result.add(elementId, elementPosition);\n                    });\n\n            callback.afterSearch(result);\n        }\n    };\n\n    static boolean isSupported(LayoutEditorElement element) {\n        if (element == null) {\n            return false;\n        }\n        switch (element.geElementType()) {\n            case ROW:\n                LayoutEditorElement parent = element.getParentElement();\n                return parent == null || !COLUMN_WITH_COMPONENTS.equals(parent.geElementType());\n            case COLUMN_WITH_COMPONENTS:\n                return false;\n            default:\n                return true;\n        }\n    }\n\n    public LayoutEditorPropertiesPresenter() {\n    }\n\n    @Inject\n    public LayoutEditorPropertiesPresenter(final View view,\n            ManagedInstance<LayoutElementPropertiesPresenter> layoutElementPropertiesPresenterInstance,\n            LiveSearchDropDown elementSelector) {\n        this.view = view;\n        this.layoutElementPropertiesPresenterInstance = layoutElementPropertiesPresenterInstance;\n        this.elementSelector = elementSelector;\n        view.init(this);\n    }\n\n    @PostConstruct\n    private void init() {\n        this.elementSelector.setSearchEnabled(false);\n        this.elementSelector.setClearSelectionEnabled(false);\n        this.elementSelector.setWidth(275);\n        this.elementSelector.setOnChange(this::onElementSelected);\n        this.elementSelector.init(searchService, selectionHandler);\n    }\n\n    public UberElement<LayoutEditorPropertiesPresenter> getView() {\n        return view;\n    }\n\n    public LayoutEditor getLayoutEditor() {\n        return layoutEditor;\n    }\n\n    public LiveSearchService<String> getSearchService() {\n        return searchService;\n    }\n    \n    public void setSelectionHandler(SingleLiveSearchSelectionHandler<String> selectionHandler) {\n        this.selectionHandler = selectionHandler;\n    }\n\n    public void edit(LayoutEditor layoutEditor) {\n        if (layoutEditor != null) {\n            this.dispose();\n            this.layoutEditor = layoutEditor;\n            view.showSelector(elementSelector);\n\n            // Edit the first element available\n            LayoutEditorElement firstElement = layoutEditor.getLayoutElements().get(0);\n            edit(firstElement);\n        }\n    }\n\n    public void edit(LayoutEditorElement layoutElement) {\n        if (layoutEditor != null) {\n            String elementId = layoutElement.getId();\n            elementSelector.setSelectedItem(elementId);\n            fillElementParts(layoutElement);\n            updateCurrentPropertiesPresenter(elementId, layoutElement);\n            view.showElement(propertiesPresenter.getView());\n            updateClearElementStatus();\n        }\n    }\n    \n    public void edit(LayoutEditorElementPart layoutElementPart) {\n        if (layoutEditor != null) {\n            String elementPartId = layoutElementPart.getParent().getId() + \".\" + layoutElementPart.getId();\n            updateCurrentPropertiesPresenter(elementPartId, layoutElementPart);\n            view.showElement(propertiesPresenter.getView());\n            updateClearElementStatus();\n        }\n    }\n\n    public void dispose() {\n        this.propertiesPresenter = null;\n        elementSelector.clear();\n        presenterMap.clear();\n        view.dispose();\n    }\n\n    public String getDisplayPosition(LayoutEditorElement element) {\n        LayoutEditorElement parent = element.getParentElement();\n        String name = getElementName(element);\n        if (parent == null) {\n            return name;\n        }\n\n        int position = parent.getChildElements().indexOf(element) + 1;\n        LayoutEditorElement granpa = parent.getParentElement();\n        if (granpa == null) {\n            return view.getDisplayName(name, Integer.toString(position));\n        }\n\n        boolean nestedRow = ROW.equals(parent.geElementType()) && COLUMN_WITH_COMPONENTS.equals(granpa.geElementType());\n        String parentDisplay = nestedRow ? getDisplayPosition(granpa) : getDisplayPosition(parent);\n        String elementDisplay = view.getDisplayPosition(parentDisplay, name, Integer.toString(position));\n        String componentName = view.getLayoutElementTypeComponent();\n\n        if (COLUMN.equals(element.geElementType())) {\n            if (nestedRow) {\n                return view.getDisplayPosition(parentDisplay, componentName, Integer.toString(position));\n            } else {\n                return view.getDisplayPosition(elementDisplay, componentName, \"1\");\n            }\n        } else {\n            return elementDisplay;\n        }\n    }\n\n    public String getElementName(LayoutEditorElement element) {\n        switch (element.geElementType()) {\n            case CONTAINER:\n                return view.getLayoutElementTypePage();\n            case ROW:\n                return view.getLayoutElementTypeRow();\n            case COLUMN:\n                return view.getLayoutElementTypeColumn();\n            case COLUMN_WITH_COMPONENTS:\n                return view.getLayoutElementTypeColumn();\n            default:\n                return \"Unknown element type: \" + element.geElementType();\n        }\n    }\n\n    public void clearElementProperties() {\n        if (propertiesPresenter != null) {\n            propertiesPresenter.reset();\n        }\n    }\n\n    public void reset() {\n        this.dispose();\n        this.edit(layoutEditor);\n    }\n\n    private void updateClearElementStatus() {\n        if (propertiesPresenter != null) {\n            boolean hasValues = propertiesPresenter.hasValues();\n            view.setClearPropertiesEnabled(hasValues);\n        }\n    }\n\n    // View actions\n\n    void onElementSelected() {\n        LayoutEditorElement selectedElement = getSelectedElement();\n        this.edit(selectedElement);\n    }\n    \n    // LayoutElementPropertiesPresenter events\n\n    void onLayoutPropertyChangedEvent(@Observes LayoutElementPropertyChangedEvent event) {\n        updateClearElementStatus();\n    }\n\n    void onClearAllPropertiesEvent(@Observes LayoutElementClearAllPropertiesEvent event) {\n        updateClearElementStatus();\n    }\n\n    // Layout editor events\n\n    void onLayoutElementSelected(@Observes LayoutEditorElementSelectEvent event) {\n        LayoutEditorElement element = event.getElement();\n        this.edit(element);\n    }\n\n    public void onPartSelected(String partId) {\n        LayoutEditorElement selectedElement = getSelectedElement();\n        if (PART_ROOT.equals(partId)) {\n            this.edit(selectedElement);\n        } else {\n            selectedElement.getLayoutEditorElementParts().stream()\n                                                         .filter(p -> p.getId().equals(partId))\n                                                         .findFirst().ifPresent(this::edit);\n        }\n    }\n\n    void onComponentDropped(@Observes ComponentDropEvent event) {\n        this.reset();\n    }\n\n    void onComponentRemoved(@Observes ComponentRemovedEvent event) {\n        this.reset();\n    }\n\n    void onRowsSwap(@Observes RowDnDEvent rowDndEvent) {\n        this.reset();\n    }\n    \n    protected void fillElementParts(LayoutEditorElement element) {\n        List<LayoutEditorElementPart> currentLayoutElementParts = element.getLayoutEditorElementParts();\n        if (currentLayoutElementParts.isEmpty()) {\n            view.noParts();\n        } else {\n            List<String> parts = new ArrayList<>();\n            parts.add(PART_ROOT);\n            currentLayoutElementParts.stream().map(LayoutEditorElementPart::getId)\n                                             .forEach(parts::add);\n            view.showParts(parts);\n        }\n    }\n    \n    private void updateCurrentPropertiesPresenter(String elementId, LayoutElementWithProperties layoutElement) {\n        LayoutElementPropertiesPresenter presenter = presenterMap.get(elementId);\n        if (presenter == null) {\n            propertiesPresenter = layoutElementPropertiesPresenterInstance.get();\n            propertiesPresenter.edit(layoutElement);\n            presenterMap.put(elementId, propertiesPresenter);\n        } else if (presenter != propertiesPresenter) {\n            propertiesPresenter.getLayoutElement().setSelected(false);\n            propertiesPresenter = presenter;\n        }\n    }\n    \n    private LayoutEditorElement getSelectedElement() {\n        String elementId = selectionHandler.getSelectedKey();\n        for (LayoutEditorElement element : layoutEditor.getLayoutElements()) {\n            if (element.getId().equals(elementId)) {\n                return element;\n            }\n        }\n        return null;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutEditorPropertiesView.css",
    "content": ".af-lep-main-panel {\n    padding: 0px 10px 0px 10px;\n    overflow: auto;\n    height: 100%;\n}\n\n.af-lep-clear-anchor {\n    margin-top: -27px;\n    margin-right: 10px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutEditorPropertiesView.html",
    "content": "<div class=\"af-lep-main-panel\">\n    <h4><span data-field=\"selectorLabel\">Element:</span></h4>\n    <div data-field=\"selectorDiv\">\n    </div>\n    <div data-field=\"partsFieldContainer\">\n        <h4><span>Element Parts:</span></h4>\n        <select class=\"form-control\" data-field=\"partsSelect\">\n            <option data-field=\"partOption\"></option>\n        </select>\n    </div>\n    <div>\n        <h4><span data-field=\"propertiesLabel\">Properties:</span></h4>\n        <a data-field=\"clearAllAnchor\" href=\"#\" class=\"pull-right af-lep-clear-anchor\"> Clear All</a>\n    </div>\n    <div data-field=\"elementDiv\">\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutEditorPropertiesView.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport elemental2.dom.HTMLOptionElement;\nimport elemental2.dom.HTMLSelectElement;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.layout.editor.client.resources.i18n.PropertiesConstants;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Templated\n@Dependent\npublic class LayoutEditorPropertiesView implements LayoutEditorPropertiesPresenter.View, IsElement {\n\n    private LayoutEditorPropertiesPresenter presenter;\n\n    @Inject\n    @DataField\n    Div selectorDiv;\n\n    @Inject\n    @DataField\n    Div elementDiv;\n\n    @Inject\n    @DataField\n    Span selectorLabel;\n\n    @Inject\n    @DataField\n    Span propertiesLabel;\n\n    @Inject\n    @DataField\n    Anchor clearAllAnchor;\n    \n    @Inject\n    @DataField\n    HTMLOptionElement partOption;\n    \n    @Inject\n    @DataField\n    HTMLSelectElement partsSelect;\n    \n    @Inject\n    @DataField\n    Div partsFieldContainer;\n\n    private IsWidget selectorView;\n    private IsWidget elementView;\n\n    @Override\n    public void init(LayoutEditorPropertiesPresenter presenter) {\n        this.presenter = presenter;\n        selectorLabel.setTextContent(PropertiesConstants.INSTANCE.elementLabel());\n        propertiesLabel.setTextContent(PropertiesConstants.INSTANCE.propertiesLabel());\n        clearAllAnchor.setTextContent(PropertiesConstants.INSTANCE.clearAll());\n        partsSelect.onchange = this::onPartsSelectChange;\n    }\n\n    @Override\n    public void dispose() {\n        disposeSelectorWidget();\n        disposeElementWidget();\n    }\n\n    private void disposeSelectorWidget() {\n        DOMUtil.removeAllChildren(selectorDiv);\n        if (selectorView != null) {\n            DOMUtil.removeFromParent(selectorView);\n            selectorView = null;\n        }\n    }\n\n    private void disposeElementWidget() {\n        DOMUtil.removeAllChildren(elementDiv);\n        if (elementView != null) {\n            DOMUtil.removeFromParent(elementView);\n            elementView = null;\n        }\n    }\n    \n    @Override\n    public void showSelector(IsWidget selector) {\n        disposeSelectorWidget();\n        this.selectorView = selector;\n        DOMUtil.appendWidgetToElement(selectorDiv, selectorView);\n\n    }\n\n    @Override\n    public void showElement(IsWidget elementView) {\n        disposeElementWidget();\n        this.elementView = elementView;\n        DOMUtil.appendWidgetToElement(elementDiv, elementView);\n    }\n\n    @Override\n    public String getDisplayPosition(String parentPosition, String elementName, String elementIndex) {\n        return PropertiesConstants.INSTANCE.layoutElementPosition(parentPosition, elementName, elementIndex);\n    }\n\n    @Override\n    public String getDisplayName(String elementName, String elementIndex) {\n        return PropertiesConstants.INSTANCE.layoutElementName(elementName, elementIndex);\n    }\n\n    @Override\n    public String getLayoutElementTypePage() {\n        return PropertiesConstants.INSTANCE.layoutElementTypePage();\n    }\n\n    @Override\n    public String getLayoutElementTypeRow() {\n        return PropertiesConstants.INSTANCE.layoutElementTypeRow();\n    }\n\n    @Override\n    public String getLayoutElementTypeColumn() {\n        return PropertiesConstants.INSTANCE.layoutElementTypeColumn();\n    }\n\n    @Override\n    public String getLayoutElementTypeComponent() {\n        return PropertiesConstants.INSTANCE.layoutElementTypeComponent();\n    }\n\n    @Override\n    public void setClearPropertiesEnabled(boolean enabled) {\n        if (enabled) {\n            clearAllAnchor.getStyle().removeProperty(\"display\");\n        } else {\n            clearAllAnchor.getStyle().setProperty(\"display\", \"none\");\n        }\n    }\n\n    @EventHandler(\"clearAllAnchor\")\n    private void onClearAll(ClickEvent event) {\n        presenter.clearElementProperties();\n    }\n\n    @Override\n    public void noParts() {\n        partsFieldContainer.setHidden(true);\n        partsSelect.innerHTML = \"\";\n        \n    }\n\n    @Override\n    public void showParts(List<String> parts) {\n        partsFieldContainer.setHidden(false);\n        partsSelect.innerHTML = \"\";\n        parts.stream().map(this::itemToOption).forEach(partsSelect::appendChild);\n        \n    }\n    \n    private Object onPartsSelectChange(Object event) {\n        presenter.onPartSelected(partsSelect.value); \n        return null; \n    }\n    \n    private HTMLOptionElement itemToOption(String item) {\n        HTMLOptionElement option = (HTMLOptionElement) partOption.cloneNode(false);\n        option.text = item;\n        option.value = item;\n        return option;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutElementPropertiesPresenter.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.layout.editor.api.css.CssAllowedValue;\nimport org.uberfire.ext.layout.editor.client.api.LayoutElementWithProperties;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementClearAllPropertiesEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementPropertyChangedEvent;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorCssHelper;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.HashMap;\nimport java.util.Map;\n\n@Dependent\npublic class LayoutElementPropertiesPresenter {\n\n    public interface View extends UberView<LayoutElementPropertiesPresenter> {\n\n        void clear();\n\n        void addCategory(PropertyEditorCategory category);\n\n        void show();\n    }\n\n    private View view;\n    private LayoutElementWithProperties layoutElement;\n    private LayoutEditorCssHelper cssHelper;\n    Event<LayoutElementPropertyChangedEvent> propertyChangedEvent;\n    Event<LayoutElementClearAllPropertiesEvent> propertyClearAllEvent;\n    Map<String,String> currentValues = new HashMap<>();\n\n    public LayoutElementPropertiesPresenter() {\n    }\n\n    @Inject\n    public LayoutElementPropertiesPresenter(final View view,\n            final LayoutEditorCssHelper cssHelper,\n            final Event<LayoutElementPropertyChangedEvent> propertyChangedEvent,\n            final Event<LayoutElementClearAllPropertiesEvent> propertyClearAllEvent) {\n        this.view = view;\n        this.cssHelper = cssHelper;\n        this.propertyChangedEvent = propertyChangedEvent;\n        this.propertyClearAllEvent = propertyClearAllEvent;\n        view.init(this);\n    }\n\n    public UberView<LayoutElementPropertiesPresenter> getView() {\n        return view;\n    }\n\n    public LayoutElementWithProperties getLayoutElement() {\n        return layoutElement;\n    }\n\n    public boolean hasValues() {\n        return !currentValues.isEmpty();\n    }\n\n    public Map<String, String> getCurrentValues() {\n        return currentValues;\n    }\n\n    public void edit(LayoutElementWithProperties element) {\n        this.layoutElement = element;\n\n        view.clear();\n\n        layoutElement.getPropertyCategories().forEach(category -> {\n            view.addCategory(category);\n\n            category.getFields().forEach(field -> {\n                String prop = field.getKey();\n                String val = field.getCurrentStringValue();\n                if (val != null && !val.isEmpty()) {\n                    currentValues.put(prop, val);\n                }\n            });\n        });\n        view.show();\n    }\n\n    public void reset() {\n        if (layoutElement != null) {\n            currentValues.clear();\n\n            layoutElement.getPropertyCategories()\n                    .forEach(category -> category.getFields()\n                            .forEach(field -> {\n                                String property = field.getKey();\n                                layoutElement.removeProperty(property);\n                                field.setCurrentStringValue(\"\");\n                            }));\n\n            this.edit(layoutElement);\n\n            propertyClearAllEvent.fire(new LayoutElementClearAllPropertiesEvent(layoutElement));\n        }\n    }\n\n    // View callbacks\n\n    public void onPropertyChanged(String property, String value) {\n        if (layoutElement != null) {\n            String oldValue = layoutElement.getProperties().get(property);\n\n            if (value == null || value.isEmpty()) {\n                layoutElement.removeProperty(property);\n                currentValues.remove(property);\n            }\n            else {\n                // CSS allowed values requires parsing\n                CssAllowedValue cssAllowedValue = cssHelper.parseCssAllowedValue(property, value);\n                if (cssAllowedValue != null) {\n                    layoutElement.setProperty(property, cssAllowedValue.getName());\n                    currentValues.put(property, cssAllowedValue.getName());\n                } else {\n                    layoutElement.setProperty(property, value);\n                    currentValues.put(property, value);\n                }\n            }\n            propertyChangedEvent.fire(new LayoutElementPropertyChangedEvent(layoutElement, property, oldValue, value));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/java/org/uberfire/ext/layout/editor/client/widgets/LayoutElementPropertiesView.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.widgets;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport java.util.ArrayList;\nimport java.util.List;\n\n@Dependent\npublic class LayoutElementPropertiesView implements LayoutElementPropertiesPresenter.View {\n\n    private LayoutElementPropertiesPresenter presenter;\n    private PropertyEditorWidget propertyEditor;\n    private List<PropertyEditorCategory> categories = new ArrayList<>();\n\n    private final String PROPERTY_EDITOR_ID = Document.get().createUniqueId();\n\n    @Override\n    public void init(LayoutElementPropertiesPresenter presenter) {\n        this.presenter = presenter;\n        this.propertyEditor = new PropertyEditorWidget();\n\n    }\n\n    @Override\n    public Widget asWidget() {\n        return propertyEditor;\n    }\n\n    @Override\n    public void clear() {\n        categories.clear();\n    }\n\n    @Override\n    public void addCategory(PropertyEditorCategory category) {\n        categories.add(category);\n    }\n\n    @Override\n    public void show() {\n        propertyEditor.handle(new PropertyEditorEvent(PROPERTY_EDITOR_ID, categories));\n    }\n\n    /**\n     * Capture & process the modification events sent by the property editor\n     */\n    protected void onPropertyEditorChange(@Observes PropertyEditorChangeEvent event) {\n        PropertyEditorFieldInfo property = event.getProperty();\n        if (property.getEventId().equalsIgnoreCase(PROPERTY_EDITOR_ID)) {\n            String attrKey = property.getKey();\n            String attrValue = event.getNewValue();\n            presenter.onPropertyChanged(attrKey, attrValue);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/UberfireLayoutEditorClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <source path='client'/>\n\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n\n  <inherits name=\"org.uberfire.ext.layout.editor.UberfireLayoutEditorAPI\"/>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.layout.editor.UberfireLayoutEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorAPI\"/>\n  <inherits name=\"org.uberfire.ext.editor.commons.UberfireCommonsEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginAPI\"/>\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/css/layout-editor.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.dropBorder {\n    border: 1px solid dodgerblue;\n    margin: 10px 10px 15px 10px;\n    padding: 10px;\n    height: 50px;\n}\n\n.dropInactive {\n    border: 1px solid lightgray;\n    margin: 10px 10px 15px 10px;\n    padding: 10px;\n    height: 50px;\n}\n\n.rowContainer {\n    border: 1px solid lightgray;\n    margin: 10px;\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nDragAndDrop=Drag and Drop Element\nInvalidGridConfiguration=A Row is built on 12-column grids. Grid columns are created by specifying the number of 12 available columns you wish to span.\nEditHtml=Edit HTML Component\nEditComponent=Edit Component\nInvalidLayoutName=Invalid Layout Name\nInvalidTagName=Invalid Tag Name\nInvalidParameterName=Invalid Parameter Name\nInvalidActivityID=Invalid Activity ID\nInvalidMenuLabel=Invalid Menu Label\nDuplicateParameterName=Duplicate Parameter Name\nGridSystem=Grid System\nComponents=Components\nContainer=Container\nNewRow=New row ...\nColumn=Column\nEditor=Editor\nPreview=Preview\nLayoutEditorProperties=Properties\nSelectContainerHint=Click to select\nSelectRowHint=Click to select or click & hold to move\nDragRowHint=Click & hold to move\nSelectColumnHint=Click to select or click & hold to move\nDragColumnHint=Click & hold to move\nUnselectContainerHint=Click to deselect\nUnselectRowHint=Click to deselect or click & hold to move\nUnselectColumnHint=Click to deselect or click & hold to move\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_de.properties",
    "content": "DragAndDrop=Element ziehen und ablegen\nInvalidGridConfiguration=Eine Reihe wird auf 12-Spalten Grids aufgebaut. Grid-Spalten werden erstellt, indem die Anzahl von 12 verfügbaren Spalten angegeben wird, die Sie umfassen möchten.\nEditHtml=HTML Komponente bearbeiten\nEditComponent=Komponente bearbeiten\nInvalidLayoutName=Ungültiger Layoutname\nInvalidTagName=Ungültiger Tagname\nInvalidParameterName=Ungültiger Parametername\nInvalidActivityID=Ungültige Aktivitäts-ID\nInvalidMenuLabel=Ungültige Menübezeichnung\nDuplicateParameterName=Parametername duplizieren\nGridSystem=Gridsystem\nComponents=Komponenten\nContainer=Container\nNewRow=Neue Reihe...\nColumn=Spalte\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author jdimanos\nPreview=Vorschau\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nDragAndDrop=Elemento de arrastrar y soltar\nInvalidGridConfiguration=Una fila se construye sobre una cuadrícula de 12 columnas. Las columnas de la cuadrícula se crean especificando la cantidad de las 12 columnas disponibles que desea abarcar.\nEditHtml=Editar componente HTML\nEditComponent=Editar componente\nInvalidLayoutName=Nombre de diseño no válido\nInvalidTagName=Nombre de etiqueta no válido\nInvalidParameterName=Nombre de parámetro no válido\nInvalidActivityID=ID de actividad no válida\nInvalidMenuLabel=Etiqueta de menú no válida\nDuplicateParameterName=Duplicar el nombre del parámetro\nGridSystem=Sistema de cuadrícula\nComponents=Componentes\nContainer=Contenedor\nNewRow=Nueva fila…\nColumn=Columna\nEditor=Editor\nPreview=Vista previa\nLayoutEditorProperties=Propiedades\nSelectContainerHint=Haga clic para seleccionar\nSelectRowHint=Haga clic para seleccionar o haga clic y mantenga presionado para moverse\nDragRowHint=Haga clic y mantenga presionado para moverse\nSelectColumnHint=Haga clic para seleccionar o haga clic y mantenga presionado para moverse\nDragColumnHint=Haga clic y mantenga presionado para moverse\nUnselectContainerHint=Haga clic para anular la selección\nUnselectRowHint=Haga clic para anular la selección o haga clic y mantenga presionado para moverse\nUnselectColumnHint=Haga clic para anular la selección o haga clic y mantenga presionado para moverse\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nDragAndDrop=Faire glisser l''élément\nInvalidGridConfiguration=Une ligne est construite sur des grilles de 12 colonnes. Pour créer les colonnes de la grille, indiquez le nombre de 12 colonnes disponibles que vous souhaitez couvrir.\nEditHtml=Modifier le composant HTML\nEditComponent=Modifier le composant\nInvalidLayoutName=Nom de mise en page non valide\nInvalidTagName=Nom d''étiquette non valide\nInvalidParameterName=Nom de paramètre non valide\nInvalidActivityID=ID d''activité non valide\nInvalidMenuLabel=Étiquette de menu non valide\nDuplicateParameterName=Nom de paramètre en double\nGridSystem=Système de grille\nComponents=Composants\nContainer=Conteneur\nNewRow=Nouvelle ligne…\nColumn=Colonne\nEditor=Éditeur\nPreview=Aperçu\nLayoutEditorProperties=Propriétés\nSelectContainerHint=Cliquer pour sélectionner\nSelectRowHint=Cliquer pour sélectionner ou cliquer et maintenir le bouton enfoncé pour déplacer\nDragRowHint=Cliquer et maintenir le bouton enfoncé pour déplacer\nSelectColumnHint=Cliquer pour sélectionner ou cliquer et maintenir le bouton enfoncé pour déplacer\nDragColumnHint=Cliquer et maintenir le bouton enfoncé pour déplacer\nUnselectContainerHint=Cliquer pour désélectionner\nUnselectRowHint=Cliquer pour désélectionner ou cliquer et maintenir le bouton enfoncé pour déplacer\nUnselectColumnHint=Cliquer pour désélectionner ou cliquer et maintenir le bouton enfoncé pour déplacer\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nDragAndDrop=Trascina e rilascia elemento\nInvalidGridConfiguration=Una riga è costruita su griglie a 12 colonne. Le colonne della griglia vengono create specificando il numero di 12 colonne disponibili che si desidera occupare.\nEditHtml=Modifica componente HTML\nEditComponent=Modifica componente\nInvalidLayoutName=Nome layout non valido\nInvalidTagName=Nome tag non valido\nInvalidParameterName=Nome parametro non valido\nInvalidActivityID=ID attività non valido\nInvalidMenuLabel=Etichetta menu non valida\nDuplicateParameterName=Duplica nome parametro\nGridSystem=Sistema di griglia\nComponents=Componenti\nContainer=Contenitore\nNewRow=Nuova riga ...\nColumn=Colonna\nEditor=Editor\nPreview=Anteprima\nLayoutEditorProperties=Proprietà\nSelectContainerHint=Fai clic per selezionare\nSelectRowHint=Fai clic per selezionare o fai clic e tieni premuto per spostare\nDragRowHint=Fai clic e tieni premuto per spostare\nSelectColumnHint=Fai clic per selezionare o fai clic e tieni premuto per spostare\nDragColumnHint=Fai clic e tieni premuto per spostare\nUnselectContainerHint=Fai clic per deselezionare\nUnselectRowHint=Fai clic per deselezionare o fai clic e tieni premuto per spostare\nUnselectColumnHint=Fai clic per deselezionare o fai clic e tieni premuto per spostare\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nDragAndDrop=ドラグアンドドロップ要素\nInvalidGridConfiguration=行が 12 個あるグリッド上に行が構築されます。グリッド行は、使用できる 12 個の行の番号を指定して作成されます。\nEditHtml=HTML コンポーネントの編集\nEditComponent=コンポーネントの編集\nInvalidLayoutName=無効なレイアウト名\nInvalidTagName=無効なタグ名\nInvalidParameterName=無効なパラメーター名\nInvalidActivityID=無効なアクティビティー名\nInvalidMenuLabel=無効なメニューラベル\nDuplicateParameterName=重複したパラメーター名\nGridSystem=グリッドシステム\nComponents=コンポーネント\nContainer=コンテナ\nNewRow=新規の行\nColumn=カラム\nEditor=エディター\nPreview=プレビュー\nLayoutEditorProperties=プロパティー\nSelectContainerHint=クリックして選択\nSelectRowHint=クリックして選択するか、クリックしたまま移動\nDragRowHint=クリックしたまま移動\nSelectColumnHint=クリックして選択するか、クリックしたまま移動\nDragColumnHint=クリックしたまま移動\nUnselectContainerHint=クリックして選択を解除\nUnselectRowHint=クリックして選択を解除するか、クリックしたまま移動\nUnselectColumnHint=クリックして選択を解除するか、クリックしたまま移動\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "DragAndDrop=Arrastar e Soltar o Elemento\nInvalidGridConfiguration=Uma linha é construída em grades de 12 colunas. As colunas de grade são criadas especificando o número de 12 colunas disponíveis que você deseja abarcar. \nEditHtml=Editar o Componente HTML\nEditComponent=Editar o Componente\nInvalidLayoutName=Nome de Layout Inválido\nInvalidTagName=Nome de Tag Inválido\nInvalidParameterName=Nome de Parâmetro Inválido\nInvalidActivityID=ID de Atividade Inválida\nInvalidMenuLabel=Rótulo do Menu Inválido\nDuplicateParameterName=Nome de Parâmetro Duplicado \nGridSystem=Sistema de Grade\nComponents=Componentes\nContainer=Contêiner\nNewRow=Nova linha...\nColumn=Coluna\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author ldelima@redhat.com\nPreview=Visualização\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "DragAndDrop=拖放元素\nInvalidGridConfiguration=一行由 12 列的网格组成。通过指定要跨越 12 个可用列的数量来创建网格列。\nEditHtml=编辑 HTML 组件\nEditComponent=编辑组件\nInvalidLayoutName=无效的格式名称\nInvalidTagName=无效的标签名称\nInvalidParameterName=无效的参数名称\nInvalidActivityID=无效的活动 ID\nInvalidMenuLabel=无效的菜单标签\nDuplicateParameterName=重复的参数名称\nGridSystem=网格系统\nComponents=组件\nContainer=容器\nNewRow=新行......\nColumn=列\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author xi.huang\nPreview=预览\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants.properties",
    "content": "TEXT_ALIGN__LEFT=Left\nTEXT_ALIGN__CENTER=Center\nTEXT_ALIGN__RIGHT=Right\nFONT_SIZE__XX_SMALL=Extra Small\nFONT_SIZE__X_SMALL=Super Small\nFONT_SIZE__SMALL=Small\nFONT_SIZE__MEDIUM=Medium\nFONT_SIZE__LARGE=Large\nFONT_SIZE__X_LARGE=Super Large\nFONT_SIZE__XX_LARGE=Extra Large\nFONT_WEIGHT__NORMAL=Normal\nFONT_WEIGHT__BOLD=Bold\nFONT_WEIGHT__BOLDER=Bolder\nFONT_WEIGHT__LIGHTER=Lighter\nTEXT_DECORATION__NONE=None\nTEXT_DECORATION__UNDERLINE=Underline\nTEXT_DECORATION__OVERLINE=Overline\nTEXT_DECORATION__LINE_THROUGH=Line through\nFLOAT__NONE=None\nFLOAT__LEFT=Left\nFLOAT__RIGHT=Right\nFLOAT__INITIAL=Initial\nFLOAT__INHERIT=Inherit"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants_es.properties",
    "content": "TEXT_ALIGN__LEFT=Izquierda\nTEXT_ALIGN__CENTER=Centro\nTEXT_ALIGN__RIGHT=Derecha\nFONT_SIZE__XX_SMALL=Extrapequeño\nFONT_SIZE__X_SMALL=Superpequeño\nFONT_SIZE__SMALL=Pequeño\nFONT_SIZE__MEDIUM=Mediano\nFONT_SIZE__LARGE=Grande\nFONT_SIZE__X_LARGE=Supergrande\nFONT_SIZE__XX_LARGE=Extragrande\nFONT_WEIGHT__NORMAL=Normal\nFONT_WEIGHT__BOLD=Negrita\nFONT_WEIGHT__BOLDER=Más negrita\nFONT_WEIGHT__LIGHTER=Más claro\nTEXT_DECORATION__NONE=Ninguno\nTEXT_DECORATION__UNDERLINE=Subrayado\nTEXT_DECORATION__OVERLINE=Suprarrayado\nTEXT_DECORATION__LINE_THROUGH=Tachado\nFLOAT__NONE=Ninguno\nFLOAT__LEFT=Izquierda\nFLOAT__RIGHT=Derecha\nFLOAT__INITIAL=Inicialmente\nFLOAT__INHERIT=Heredar"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants_fr.properties",
    "content": "TEXT_ALIGN__LEFT=Gauche\nTEXT_ALIGN__CENTER=Centre\nTEXT_ALIGN__RIGHT=Droite\nFONT_SIZE__XX_SMALL=Très très petite\nFONT_SIZE__X_SMALL=Très petite\nFONT_SIZE__SMALL=Petite\nFONT_SIZE__MEDIUM=Moyenne\nFONT_SIZE__LARGE=Grande\nFONT_SIZE__X_LARGE=Très grande\nFONT_SIZE__XX_LARGE=Très très grande\nFONT_WEIGHT__NORMAL=Normale\nFONT_WEIGHT__BOLD=Gras\nFONT_WEIGHT__BOLDER=Plus gras\nFONT_WEIGHT__LIGHTER=Plus clair\nTEXT_DECORATION__NONE=Aucun\nTEXT_DECORATION__UNDERLINE=Souligné\nTEXT_DECORATION__OVERLINE=Surligné\nTEXT_DECORATION__LINE_THROUGH=Barré\nFLOAT__NONE=Aucun\nFLOAT__LEFT=Gauche\nFLOAT__RIGHT=Droite\nFLOAT__INITIAL=Initial\nFLOAT__INHERIT=Hériter"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants_it.properties",
    "content": "TEXT_ALIGN__LEFT=Sinistra\nTEXT_ALIGN__CENTER=Centro\nTEXT_ALIGN__RIGHT=Destra\nFONT_SIZE__XX_SMALL=Molto piccolo\nFONT_SIZE__X_SMALL=Super piccolo\nFONT_SIZE__SMALL=Piccolo\nFONT_SIZE__MEDIUM=Medio\nFONT_SIZE__LARGE=Grande\nFONT_SIZE__X_LARGE=Super grande\nFONT_SIZE__XX_LARGE=Molto grande\nFONT_WEIGHT__NORMAL=Normale\nFONT_WEIGHT__BOLD=Grassetto\nFONT_WEIGHT__BOLDER=Più grassetto\nFONT_WEIGHT__LIGHTER=Più leggero\nTEXT_DECORATION__NONE=Nessuno\nTEXT_DECORATION__UNDERLINE=Sottolineato\nTEXT_DECORATION__OVERLINE=Sovrapposto\nTEXT_DECORATION__LINE_THROUGH=Attraversato\nFLOAT__NONE=Nessuno\nFLOAT__LEFT=Sinistra\nFLOAT__RIGHT=Destra\nFLOAT__INITIAL=Iniziale\nFLOAT__INHERIT=Ereditato\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/CssAllowedValueConstants_ja.properties",
    "content": "TEXT_ALIGN__LEFT=左揃え\nTEXT_ALIGN__CENTER=左右中央揃え\nTEXT_ALIGN__RIGHT=右揃え\nFONT_SIZE__XX_SMALL=超特小\nFONT_SIZE__X_SMALL=特小\nFONT_SIZE__SMALL=小\nFONT_SIZE__MEDIUM=中\nFONT_SIZE__LARGE=大\nFONT_SIZE__X_LARGE=特大\nFONT_SIZE__XX_LARGE=超特大\nFONT_WEIGHT__NORMAL=普通\nFONT_WEIGHT__BOLD=太字\nFONT_WEIGHT__BOLDER=より太く\nFONT_WEIGHT__LIGHTER=より細く\nTEXT_DECORATION__NONE=なし\nTEXT_DECORATION__UNDERLINE=下線\nTEXT_DECORATION__OVERLINE=上線\nTEXT_DECORATION__LINE_THROUGH=取り消し線\nFLOAT__NONE=なし\nFLOAT__LEFT=左揃え\nFLOAT__RIGHT=右揃え\nFLOAT__INITIAL=イニシャル\nFLOAT__INHERIT=継承"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants.properties",
    "content": "elementLabel=Element\npropertiesLabel=Properties\nclearAll=Clear All\nlayoutElementPosition={0} > {1} {2}\nlayoutElementName={0} {1}\nlayoutElementTypePage=Page\nlayoutElementTypeRow=Row\nlayoutElementTypeColumn=Column\nlayoutElementTypeComponent=Component\npanel=Panel\ntext=Text\nwidth=Width\nheight=Height\nbackground_color=Background Color\nmargin=Margin\nmargin_top=Top\nmargin_bottom=Bottom\nmargin_left=Left\nmargin_right=Right\npadding=Padding\npadding_top=Top\npadding_bottom=Bottom\npadding_left=Left\npadding_right=Right\ntext_align=Alignment\ntext_decoration=Decoration\ncolor=Color\nfont_size=Size\nfont_weight=Weight\nlength_help=A number followed by a valid CSS length suffix (e.g: %, px, cm, mm, in, em, pc, pt)\nfloat_property=Float\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_de.properties",
    "content": "clearAll=Alle löschen\ntext=Text\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_es.properties",
    "content": "elementLabel=Elemento\npropertiesLabel=Propiedades\nclearAll=Borrar todo\nlayoutElementPosition={0} > {1} {2}\nlayoutElementName={0} {1}\nlayoutElementTypePage=Página\nlayoutElementTypeRow=Fila\nlayoutElementTypeColumn=Columna\nlayoutElementTypeComponent=Componente\npanel=Panel\ntext=Texto\nwidth=Ancho\nheight=Altura\nbackground_color=Color de fondo\nmargin=Margen\nmargin_top=Superior\nmargin_bottom=Inferior\nmargin_left=Izquierda\nmargin_right=Derecha\npadding=Relleno\npadding_top=Superior\npadding_bottom=Inferior\npadding_left=Izquierda\npadding_right=Derecha\ntext_align=Alineación\ntext_decoration=Decoración\ncolor=Color\nfont_size=Tamaño\nfont_weight=Peso\nlength_help=Un número seguido de un sufijo válido de longitud de CSS (p. ej.: %, px, cm, mm, in, em, pc, pt)\nfloat_property=Flotador\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_fr.properties",
    "content": "elementLabel=Élément\npropertiesLabel=Propriétés\nclearAll=Effacer tout\nlayoutElementPosition={0} > {1} {2}\nlayoutElementName={0} {1}\nlayoutElementTypePage=Page\nlayoutElementTypeRow=Ligne\nlayoutElementTypeColumn=Colonne\nlayoutElementTypeComponent=Composant\npanel=Panneau\ntext=Texte\nwidth=Largeur\nheight=Hauteur\nbackground_color=Couleur d''arrière-plan\nmargin=Marge\nmargin_top=Haut\nmargin_bottom=Bas\nmargin_left=Gauche\nmargin_right=Droite\npadding=Marges intérieures\npadding_top=Haut\npadding_bottom=Bas\npadding_left=Gauche\npadding_right=Droite\ntext_align=Alignement\ntext_decoration=Décoration\ncolor=Couleur\nfont_size=Taille\nfont_weight=Épaisseur\nlength_help=Nombre suivi d''un suffixe de longueur CSS valide (par exemple : %, px, cm, mm, in, em, pc, pt)\nfloat_property=Flottant\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_it.properties",
    "content": "elementLabel=Elemento\npropertiesLabel=Proprietà\nclearAll=Cancella tutto\nlayoutElementPosition={0} > {1} {2}\nlayoutElementName={0} {1}\nlayoutElementTypePage=Pagina\nlayoutElementTypeRow=Riga\nlayoutElementTypeColumn=Colonna\nlayoutElementTypeComponent=Componente\npanel=Pannello\ntext=Testo\nwidth=Larghezza\nheight=Altezza\nbackground_color=Colore di sfondo\nmargin=Margine\nmargin_top=Superiore\nmargin_bottom=Inferiore\nmargin_left=Sinistra\nmargin_right=Destra\npadding=Padding\npadding_top=Superiore\npadding_bottom=Inferiore\npadding_left=Sinistra\npadding_right=Destra\ntext_align=Allineamento\ntext_decoration=Decorazione\ncolor=Colore\nfont_size=Dimensione del font\nfont_weight=Grassetto\nlength_help=Un numero seguito da un suffisso di lunghezza CSS valido (ad esempio: %, px, cm, mm, in, em, pc, pt)\nfloat_property=Float\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_ja.properties",
    "content": "elementLabel=要素\npropertiesLabel=プロパティー\nclearAll=すべて消去\nlayoutElementPosition={0} > {1} {2}\nlayoutElementName={0} {1}\nlayoutElementTypePage=ページ\nlayoutElementTypeRow=行\nlayoutElementTypeColumn=カラム\nlayoutElementTypeComponent=コンポーネント\npanel=パネル\ntext=テキスト\nwidth=幅\nheight=高さ\nbackground_color=背景色\nmargin=余白\nmargin_top=上揃え\nmargin_bottom=下揃え\nmargin_left=左揃え\nmargin_right=右揃え\npadding=パディング\npadding_top=上揃え\npadding_bottom=下揃え\npadding_left=左揃え\npadding_right=右揃え\ntext_align=調整\ntext_decoration=装飾\ncolor=色\nfont_size=サイズ\nfont_weight=幅\nlength_help=数字に追加する有効な CSS 長さ接尾辞 (例: %、px、cm、mm、in、em、pc、pt)\nfloat_property=浮動\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_pt_BR.properties",
    "content": "clearAll=Limpar tudo\ntext=Texto\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/main/resources/org/uberfire/ext/layout/editor/client/resources/i18n/PropertiesConstants_zh_CN.properties",
    "content": "clearAll=清除所有\ntext=文本\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/AbstractLayoutEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.List;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropEvent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ColumnWithComponents;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumn;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumnPart;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.components.rows.EmptyDropRow;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementSelectEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutEditorElementUnselectEvent;\nimport org.uberfire.ext.layout.editor.client.infra.*;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic abstract class AbstractLayoutEditorTest {\n\n    public static final String SAMPLE_FULL_FLUID_LAYOUT = \"org/uberfire/ext/layout/editor/client/sampleFullFluidLayout.txt\";\n    public static final String SAMPLE_FULL_PAGE_LAYOUT = \"org/uberfire/ext/layout/editor/client/sampleFullPageLayout.txt\";\n    public static final String SINGLE_ROW_COMPONENT_LAYOUT = \"org/uberfire/ext/layout/editor/client/singleRowComponentLayout.txt\";\n    public static final String SINGLE_ROW_COMPONENT_LAYOUT_WITH_PARTS = \"org/uberfire/ext/layout/editor/client/singleRowComponentLayoutWithParts.txt\";\n    public static final String SINGLE_ROW_TWO_COMPONENTS_LAYOUT = \"org/uberfire/ext/layout/editor/client/singleRowTwoComponentsLayout.txt\";\n    public static final String FULL_LAYOUT_FLUID = \"org/uberfire/ext/layout/editor/client/fullLayoutFluid.txt\";\n    public static final String FULL_LAYOUT_PAGE = \"org/uberfire/ext/layout/editor/client/fullLayoutPage.txt\";\n    public static final String SAMPLE_COLUMN_WITH_COMPONENTS_LAYOUT = \"org/uberfire/ext/layout/editor/client/columnWithComponentsLayout.txt\";\n    public static final int EMPTY_ROW = 0;\n    public static final int FIRST_ROW = 0;\n    public static final int SECOND_ROW = 1;\n    public static final int FIRST_COLUMN = 0;\n    public static final int SECOND_COLUMN = 1;\n\n    @Mock\n    protected Instance<Row> rowInstance;\n\n    @Mock\n    protected Instance<EmptyDropRow> emptyDropRowInstance;\n\n    @Mock\n    protected Container.View view;\n\n    @Mock\n    protected LayoutDragComponentHelper dragHelper;\n\n    @Mock\n    protected LayoutEditorCssHelper cssHelper;\n\n    @Mock\n    protected EventSourceMock<ComponentDropEvent> componentDropEventMock;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementSelectEvent> layoutElementSelectEventMock;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementUnselectEvent> layoutElementUnselectEventMock;\n    @Mock\n    protected EventSourceMock<ComponentRemovedEvent> componentRemoveEventMock;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementSelectEvent> rowSelectedEvent;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementUnselectEvent> rowUnselectedEvent;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementSelectEvent> columnSelectedEvent;\n    @Mock\n    protected EventSourceMock<LayoutEditorElementUnselectEvent> columnUnselectedEvent;\n    @Mock\n    protected EventSourceMock<LockRequiredEvent> lockRequiredEventMock;\n    @Mock\n    protected LayoutEditorFocusController layoutEditorFocusController;\n\n    protected EmptyDropRow emptyDropRow = new EmptyDropRow(mock(EmptyDropRow.View.class),\n            dragHelper);\n\n    @Spy\n    protected DnDManager dnDManager;\n    protected Container container;\n    private Gson gson = new GsonBuilder().setPrettyPrinting().create();\n\n    public Container createContainer() {\n        return new Container(view,\n                             cssHelper,\n                             rowInstance,\n                             emptyDropRowInstance,\n                             componentDropEventMock,\n                             layoutElementSelectEventMock,\n                             layoutElementUnselectEventMock,\n                             lockRequiredEventMock,\n                             dnDManager,\n                             layoutEditorFocusController) {\n            private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n\n            @Override\n            protected EmptyDropRow createInstanceEmptyDropRow() {\n                emptyDropRow.setId(idGenerator.createRowID(\"container\"));\n                return emptyDropRow;\n            }\n\n            @Override\n            protected Row createInstanceRow() {\n                Row row = rowProducer();\n                row.setup(null, idGenerator.createRowID(\"container\"),\n                          LayoutTemplate.Style.PAGE);\n                return row;\n            }\n\n            @Override\n            protected void destroy(Object o) {\n            }\n        };\n    }\n\n    private Row rowProducer() {\n        return new Row(mock(Row.View.class),\n                       null,\n                       null,\n                       dnDManager,\n                       dragHelper,\n                       cssHelper,\n                       componentDropEventMock,\n                       componentRemoveEventMock,\n                       null,\n                       rowSelectedEvent,\n                       rowUnselectedEvent,\n                       layoutEditorFocusController) {\n            private UniqueIDGenerator idGenerator = new UniqueIDGenerator();\n\n            @Override\n            protected ComponentColumn createComponentColumnInstance() {\n\n                ManagedInstance managedInstanceMock = mock(ManagedInstance.class);\n                when(managedInstanceMock.get()).thenReturn(new ComponentColumnPart());\n                ComponentColumn componentColumn = new ComponentColumn(mock(ComponentColumn.View.class),\n                                                                      dnDManager,\n                                                                      dragHelper,\n                                                                      mock(Event.class),\n                                                                      columnSelectedEvent,\n                                                                      columnUnselectedEvent,\n                                                                      mock(Event.class),\n                                                                      managedInstanceMock) {\n                    @Override\n                    protected boolean hasConfiguration() {\n                        return false;\n                    }\n                };\n                componentColumn.setId(idGenerator.createColumnID(getId()));\n                return componentColumn;\n            }\n\n            @Override\n            protected ColumnWithComponents createColumnWithComponentsInstance() {\n                ColumnWithComponents columnWithComponents = new ColumnWithComponents(\n                        mock(ColumnWithComponents.View.class),\n                        null,\n                        dnDManager,\n                        dragHelper,\n                        mock(Event.class),\n                        mock(Event.class)) {\n                    @Override\n                    protected Row createInstanceRow() {\n                        return rowProducer();\n                    }\n\n                    @Override\n                    protected void destroy(Object o) {\n                    }\n                };\n                columnWithComponents.setId(idGenerator.createColumnID(getId()));\n                return columnWithComponents;\n            }\n\n            @Override\n            protected void destroy(Object o) {\n            }\n        };\n    }\n\n    public LayoutTemplate getLayoutFromFileTemplate(String templateURL) throws Exception {\n        URL resource = getClass().getClassLoader()\n                .getResource(templateURL);\n        String layoutEditorModel = new String(Files.readAllBytes(Paths.get(resource.toURI())));\n\n        LayoutTemplate layoutTemplate = gson.fromJson(layoutEditorModel,\n                                                      LayoutTemplate.class);\n\n        return layoutTemplate;\n    }\n\n    public String convertLayoutToString(LayoutTemplate layoutTemplate) {\n        String layoutContent = gson.toJson(layoutTemplate);\n        return layoutContent;\n    }\n\n    protected int getRowsSizeFromContainer() {\n        return container.getRows().size();\n    }\n\n    protected List<Column> getColumns(Row row) {\n        return row.getColumns();\n    }\n\n    protected Column getColumnByIndex(Row row,\n                                      int index) {\n        return row.getColumns().get(index);\n    }\n\n    protected Row getRowByIndex(int index) {\n        return container.getRows().get(index);\n    }\n\n    @Before\n    public void setup() {\n        container = createContainer();\n        container.setup();\n        when(dragHelper.getLayoutComponentFromDrop(any())).thenReturn(new LayoutComponent());\n    }\n\n    protected LayoutTemplate loadLayout(String singleRowComponentLayout) throws Exception {\n        LayoutTemplate layoutTemplate = getLayoutFromFileTemplate(singleRowComponentLayout);\n        container.load(layoutTemplate,\n                       \"title\",\n                       \"subtitle\");\n        return layoutTemplate;\n    }\n\n    protected List<Column> extractColumnsFrom(ColumnWithComponents columnWithComponents) {\n        return columnWithComponents.getRow().getColumns();\n    }\n\n//    public static class ComponentDropEventMock extends EventSourceMock<ComponentDropEvent> {\n//\n//    }\n//\n//    public static class ComponentRemovedEventMock extends EventSourceMock<ComponentRemovedEvent> {\n//\n//    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/LayoutComponentPalettePresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.test.group1.Group1LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.group1.Group1LayoutDragComponent1;\nimport org.uberfire.ext.layout.editor.client.test.group1.Group1LayoutDragComponent2;\nimport org.uberfire.ext.layout.editor.client.test.group1.Group1LayoutDragComponent3;\nimport org.uberfire.ext.layout.editor.client.test.group2.Group2LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.group2.Group2LayoutDragComponent1;\nimport org.uberfire.ext.layout.editor.client.test.group2.Group2LayoutDragComponent2;\nimport org.uberfire.ext.layout.editor.client.test.group3.Group3LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.group3.Group3LayoutDragComponent1;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPalettePresenter;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutDragComponentGroupPresenter;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutComponentPalettePresenterTest {\n\n    public static final String DRAGGABLE_COMPONENT_NAME = \"Draggable component name\";\n\n    @Mock\n    private LayoutComponentPalettePresenter.View view;\n\n    @Mock\n    private LayoutDragComponentGroupPresenter.View dragComponentGroupView;\n\n    @Mock\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n\n    private LayoutDragComponentGroupPresenter dragComponentGroupPresenter;\n\n    private LayoutComponentPalettePresenter presenter;\n\n    private List<String> disabledExperimentalFeatures = new ArrayList<>();\n\n    private List<String> currentDragComponents = new ArrayList<>();\n\n    @Before\n    public void initialize() {\n\n        when(experimentalFeaturesRegistryService.isFeatureEnabled(anyString())).thenAnswer((Answer<Boolean>) invocationOnMock -> !disabledExperimentalFeatures.contains(invocationOnMock.getArguments()[0]));\n\n        ManagedInstance<LayoutDragComponentGroupPresenter> instance = mock(ManagedInstance.class);\n\n        dragComponentGroupPresenter = spy(new LayoutDragComponentGroupPresenter(dragComponentGroupView));\n        when(instance.get()).thenReturn(dragComponentGroupPresenter);\n\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.callRealMethod();\n\n            LayoutDragComponentGroup group = (LayoutDragComponentGroup) invocationOnMock.getArguments()[0];\n\n            currentDragComponents.addAll(group.getComponents().keySet());\n\n            return null;\n        }).when(dragComponentGroupPresenter).init(any());\n\n        when(dragComponentGroupView.hasComponent(anyString())).then(new Answer<Boolean>() {\n            @Override\n            public Boolean answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return currentDragComponents.contains(invocationOnMock.getArguments()[0]);\n            }\n        });\n\n        presenter = new LayoutComponentPalettePresenter(view, instance, experimentalFeaturesRegistryService);\n    }\n\n    @Test\n    public void testInitialization() {\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testAddAllDraggableGroups() {\n\n        presenter.addDraggableGroups(Arrays.asList(new Group1LayoutComponentPaletteGroupProvider(true), new Group2LayoutComponentPaletteGroupProvider(), new Group3LayoutComponentPaletteGroupProvider()));\n\n        verify(dragComponentGroupPresenter, times(3)).init(any());\n        verify(dragComponentGroupPresenter, times(3)).getView();\n        verify(dragComponentGroupView).setExpanded(true);\n        verify(dragComponentGroupView, times(2)).setExpanded(false);\n        verify(view, times(3)).addDraggableComponentGroup(any());\n\n        assertEquals(3, presenter.getLayoutDragComponentGroups().size());\n\n        assertNotNull(presenter.getLayoutDragComponentGroups().get(Group1LayoutComponentPaletteGroupProvider.ID));\n        assertTrue(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent1.ID));\n        assertTrue(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent2.ID));\n        assertTrue(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent3.ID));\n\n        assertNotNull(presenter.getLayoutDragComponentGroups().get(Group2LayoutComponentPaletteGroupProvider.ID));\n        assertTrue(presenter.hasDraggableComponent(Group2LayoutComponentPaletteGroupProvider.ID, Group2LayoutDragComponent1.ID));\n        assertTrue(presenter.hasDraggableComponent(Group2LayoutComponentPaletteGroupProvider.ID, Group2LayoutDragComponent2.ID));\n\n        assertNotNull(presenter.getLayoutDragComponentGroups().get(Group3LayoutComponentPaletteGroupProvider.ID));\n        assertTrue(presenter.hasDraggableComponent(Group3LayoutComponentPaletteGroupProvider.ID, Group3LayoutDragComponent1.ID));\n\n        LayoutDragComponent dragComponent = mock(LayoutDragComponent.class);\n\n        presenter.addDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, DRAGGABLE_COMPONENT_NAME, dragComponent);\n        verify(dragComponentGroupPresenter).addComponent(DRAGGABLE_COMPONENT_NAME, dragComponent);\n\n        presenter.removeDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, DRAGGABLE_COMPONENT_NAME);\n        verify(dragComponentGroupPresenter).removeComponent(DRAGGABLE_COMPONENT_NAME);\n    }\n\n    @Test\n    public void testAddDraggableGroupsWithExperimental() {\n        disabledExperimentalFeatures.add(Group1LayoutDragComponent1.class.getName());\n        disabledExperimentalFeatures.add(Group1LayoutDragComponent3.class.getName());\n        disabledExperimentalFeatures.add(Group2LayoutComponentPaletteGroupProvider.class.getName());\n        disabledExperimentalFeatures.add(Group3LayoutDragComponent1.class.getName());\n\n        presenter.addDraggableGroups(Arrays.asList(new Group1LayoutComponentPaletteGroupProvider(true), new Group2LayoutComponentPaletteGroupProvider(), new Group3LayoutComponentPaletteGroupProvider()));\n\n        verify(dragComponentGroupPresenter, times(2)).init(any());\n        verify(dragComponentGroupPresenter, times(2)).getView();\n        verify(dragComponentGroupView).setExpanded(true);\n        verify(dragComponentGroupView).setExpanded(false);\n        verify(view, times(2)).addDraggableComponentGroup(any());\n\n        assertEquals(2, presenter.getLayoutDragComponentGroups().size());\n\n        assertNotNull(presenter.getLayoutDragComponentGroups().get(Group1LayoutComponentPaletteGroupProvider.ID));\n        assertFalse(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent1.ID));\n        assertTrue(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent2.ID));\n        assertFalse(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent3.ID));\n\n        assertNull(presenter.getLayoutDragComponentGroups().get(Group2LayoutComponentPaletteGroupProvider.ID));\n        assertFalse(presenter.hasDraggableComponent(Group2LayoutComponentPaletteGroupProvider.ID, Group2LayoutDragComponent1.ID));\n        assertFalse(presenter.hasDraggableComponent(Group2LayoutComponentPaletteGroupProvider.ID, Group2LayoutDragComponent2.ID));\n\n        assertNotNull(presenter.getLayoutDragComponentGroups().get(Group3LayoutComponentPaletteGroupProvider.ID));\n        assertFalse(presenter.hasDraggableComponent(Group3LayoutComponentPaletteGroupProvider.ID, Group3LayoutDragComponent1.ID));\n    }\n\n    @Test\n    public void testAddAndRemoveDraggableGroups() {\n        testAddAllDraggableGroups();\n\n        presenter.removeDraggableGroup(Group1LayoutComponentPaletteGroupProvider.ID);\n\n        verify(dragComponentGroupPresenter, times(4)).getView();\n\n        verify(view).removeDraggableComponentGroup(any());\n\n        assertEquals(2, presenter.getLayoutDragComponentGroups().size());\n\n        assertNull(presenter.getLayoutDragComponentGroups().get(Group1LayoutComponentPaletteGroupProvider.ID));\n    }\n\n    @Test\n    public void testClearPalette() {\n        testAddAllDraggableGroups();\n\n        presenter.clear();\n\n        verify(dragComponentGroupPresenter, times(6)).getView();\n\n        verify(view, times(3)).removeDraggableComponentGroup(any());\n\n        assertEquals(0, presenter.getLayoutDragComponentGroups().size());\n\n        assertNull(presenter.getLayoutDragComponentGroups().get(Group1LayoutComponentPaletteGroupProvider.ID));\n    }\n\n    @Test\n    public void testHasDraggableGroup() {\n        assertFalse(presenter.hasDraggableGroup(Group1LayoutComponentPaletteGroupProvider.ID));\n\n        testAddAllDraggableGroups();\n\n        assertTrue(presenter.hasDraggableGroup(Group1LayoutComponentPaletteGroupProvider.ID));\n    }\n\n    @Test\n    public void testHasDraggableComponent() {\n        assertFalse(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent1.ID));\n\n        testAddAllDraggableGroups();\n\n        assertTrue(presenter.hasDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent1.ID));\n    }\n\n    @Test\n    public void testRemoveComponent() {\n        testAddAllDraggableGroups();\n\n        presenter.removeDraggableComponent(Group1LayoutComponentPaletteGroupProvider.ID, Group1LayoutDragComponent1.ID);\n        verify(dragComponentGroupView).setComponentVisible(Group1LayoutDragComponent1.ID, false);\n        verify(dragComponentGroupView, never()).removeComponent(Group1LayoutDragComponent1.ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/LayoutEditorPluginImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport java.util.function.Supplier;\n\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.internal.verification.VerificationModeFactory.times;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutEditorPluginImplTest {\n\n    @Mock\n    private LayoutEditorPresenter layoutEditorPresenter;\n\n    @Spy\n    @InjectMocks\n    private LayoutEditorPluginImpl layoutEditorPlugin;\n\n    @Captor\n    private ArgumentCaptor<Supplier<Boolean>> lockSupplierCaptor;\n\n    @Test\n    public void testLock() {\n        layoutEditorPlugin.lock();\n        Assert.assertTrue(layoutEditorPlugin.isLocked());\n    }\n\n    @Test\n    public void testUnlock() {\n        layoutEditorPlugin.unlock();\n        Assert.assertFalse(layoutEditorPlugin.isLocked());\n    }\n\n    @Test\n    public void testSetup() {\n        layoutEditorPlugin.setup();\n        verify(layoutEditorPresenter, times(1)).setup(lockSupplierCaptor.capture());\n        Assert.assertFalse(lockSupplierCaptor.getValue().get());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/LayoutEditorPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport java.util.function.Supplier;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutDragComponentGroupPresenter;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutEditorPresenterTest {\n\n    public static final String LAYOUT_NAME = \"test layout\";\n    public static final String EMPTY_TITLE_TEXT = \"Empty title text\";\n    public static final String EMPTY_SUB_TITLE_TEXT = \"Empty SubTitle text\";\n\n    @Mock\n    private Container container;\n\n    @Mock\n    private LayoutGenerator layoutGenerator;\n\n    @Mock\n    private LayoutEditorPresenter.View view;\n\n    @Mock\n    private LayoutDragComponentGroupPresenter.View dragComponentGroupView;\n\n    private LayoutTemplate testTemplate = new LayoutTemplate(LAYOUT_NAME);\n\n\n    private LayoutEditorPresenter presenter;\n\n    @Before\n    public void initialize() {\n        presenter = new LayoutEditorPresenter(view, container, layoutGenerator);\n    }\n\n    @Test\n    public void testInitialization() {\n\n        verify(view).init(presenter);\n\n        presenter.initNew();\n\n        verify(container).getView();\n        verify(view).setupDesign(any());\n    }\n\n    @Test\n    public void testLoadLayout() {\n        presenter.loadLayout(testTemplate,\n                             EMPTY_TITLE_TEXT,\n                             EMPTY_SUB_TITLE_TEXT);\n        verify(container).load(testTemplate,\n                               EMPTY_TITLE_TEXT,\n                               EMPTY_SUB_TITLE_TEXT);\n    }\n\n    @Test\n    public void testLoadEmptyLayout() {\n        presenter.loadEmptyLayout(LAYOUT_NAME,\n                                  EMPTY_TITLE_TEXT,\n                                  EMPTY_SUB_TITLE_TEXT);\n        verify(container).loadEmptyLayout(LAYOUT_NAME,\n                                          LayoutTemplate.Style.FLUID,\n                                          EMPTY_TITLE_TEXT,\n                                          EMPTY_SUB_TITLE_TEXT);\n    }\n\n    @Test\n    public void testSetup() {\n        Supplier<Boolean> lockSupplier = () -> false;\n        presenter.setup(lockSupplier);\n        verify(container).setLockSupplier(lockSupplier);\n    }\n\n    public void testLayoutEditorClear() {\n        presenter.clear();\n\n        verify(container).reset();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/LayoutEditorPropertiesPresenterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditor;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementPart;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElementType;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutEditorPropertiesPresenter;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutElementPropertiesPresenter;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutEditorPropertiesPresenterTest {\n\n    private class LayoutElementPartTest implements LayoutEditorElementPart {\n\n        private String id;\n        private LayoutEditorElement parent;\n\n        \n        public LayoutElementPartTest(String id) {\n            this.id = id;\n        }\n\n        @Override\n        public String getId() {\n            return id;\n        }\n\n        @Override\n        public Map<String, String> getProperties() {\n            return null;\n        }\n\n        @Override\n        public void clearProperties() {\n        }\n\n        @Override\n        public void setProperty(String property, String value) {\n        }\n\n        @Override\n        public void removeProperty(String property) {\n            \n        }\n\n        @Override\n        public List<PropertyEditorCategory> getPropertyCategories() {\n            return null;\n        }\n\n        @Override\n        public void setSelected(boolean status) {\n        }\n\n        @Override\n        public LayoutEditorElement getParent() {\n            return this.parent;\n        }\n        \n        public void setParent(LayoutEditorElement parent) {\n            this.parent = parent;\n        }\n    }\n    \n    private class LayoutElementTest implements LayoutEditorElement {\n\n        private String id;\n        private LayoutEditorElementType type;\n        private LayoutEditorElement parent;\n        private List<LayoutElementTest> children;\n        private List<LayoutElementPartTest> parts;\n\n        public LayoutElementTest(String id, LayoutEditorElementType type, List<LayoutElementTest> children) {\n            this(id, type, children, new ArrayList<>());\n        }\n        \n        public LayoutElementTest(String id, \n                                 LayoutEditorElementType type, \n                                 List<LayoutElementTest> children, \n                                 List<LayoutElementPartTest> parts) {\n            this.id = id;\n            this.type = type;\n            this.children = children;\n            this.parts = parts;\n            this.children.forEach(child -> child.parent = this);\n            this.parts.forEach(p -> p.setParent(this));\n        }\n\n        @Override public LayoutEditorElementType geElementType() {\n            return type;\n        }\n\n        @Override public String getId() {\n            return id;\n        }\n\n        @Override public void setSelectable(boolean selectable) {\n\n        }\n\n        @Override public boolean isSelected() {\n            return false;\n        }\n\n        @Override public void setSelected(boolean status) {\n\n        }\n\n        @Override public Map<String, String> getProperties() {\n            return null;\n        }\n\n        @Override public void clearProperties() {\n\n        }\n\n        @Override public void setProperty(String property, String value) {\n\n        }\n\n        @Override public void removeProperty(String property) {\n\n        }\n\n        @Override public List<PropertyEditorCategory> getPropertyCategories() {\n            return null;\n        }\n\n        @Override public LayoutEditorElement getParentElement() {\n            return parent;\n        }\n\n        @Override public List<? extends LayoutEditorElement> getChildElements() {\n            return children;\n        }\n        \n        @Override public List<LayoutEditorElementPart> getLayoutEditorElementParts() {\n            return parts.stream().map(p -> (LayoutEditorElementPart) p).collect(Collectors.toList());\n        }\n    }\n\n    private LayoutEditorPropertiesPresenter.View view = spy(new LayoutEditorPropertiesPresenter.View() {\n\n        @Override public void dispose() {\n        }\n\n        @Override public void showSelector(IsWidget selectorView) {\n        }\n\n        @Override public void showElement(IsWidget elementView) {\n        }\n\n        @Override public String getDisplayPosition(String parentPosition, String elementName, String elementIndex) {\n            return parentPosition + \" > \" + elementName + \" \" + elementIndex;\n        }\n\n        @Override public String getDisplayName(String elementName, String elementIndex) {\n            return elementName + \" \" + elementIndex;\n        }\n\n        @Override public String getLayoutElementTypePage() {\n            return \"page\";\n        }\n\n        @Override public String getLayoutElementTypeRow() {\n            return \"row\";\n        }\n\n        @Override public String getLayoutElementTypeColumn() {\n            return \"column\";\n        }\n\n        @Override public String getLayoutElementTypeComponent() {\n            return \"component\";\n        }\n\n        @Override public void setClearPropertiesEnabled(boolean enabled) {\n\n        }\n\n        @Override public void init(LayoutEditorPropertiesPresenter presenter) {\n\n        }\n\n        @Override public HTMLElement getElement() {\n            return null;\n        }\n\n        @Override\n        public void noParts() {\n        }\n\n        @Override\n        public void showParts(List<String> parts) {\n        }\n    });\n\n    @Mock\n    private ManagedInstance<LayoutElementPropertiesPresenter> layoutElementPropertiesPresenterInstance;\n\n    @Mock\n    private LayoutEditor layoutEditor;\n\n    @Mock\n    private LiveSearchDropDown<String> elementSelector;\n\n    @Mock\n    private LayoutElementPropertiesPresenter elementPropertiesPresenter;\n    \n    LayoutElementPartTest PART_1 = new LayoutElementPartTest(\"P1\");\n    LayoutElementPartTest PART_2 = new LayoutElementPartTest(\"P2\");\n    List<LayoutElementPartTest> columnParts = Arrays.asList(PART_1, PART_2);\n\n    LayoutElementTest column1 = new LayoutElementTest(\"1\", LayoutEditorElementType.COLUMN, new ArrayList<>());\n    LayoutElementTest column2 = new LayoutElementTest(\"2\", LayoutEditorElementType.COLUMN, new ArrayList<>());\n    LayoutElementTest column4 = new LayoutElementTest(\"1\", LayoutEditorElementType.COLUMN, new ArrayList<>());\n    LayoutElementTest column5 = new LayoutElementTest(\"2\", LayoutEditorElementType.COLUMN, new ArrayList<>());\n    LayoutElementTest columnWithParts = new LayoutElementTest(\"CPARTS\", LayoutEditorElementType.COLUMN, new ArrayList<>(), columnParts);\n    LayoutElementTest rowcol3 = new LayoutElementTest(\"1\", LayoutEditorElementType.ROW, Arrays.asList(column4, column5, columnWithParts));\n    LayoutElementTest column3 = new LayoutElementTest(\"2\", LayoutEditorElementType.COLUMN_WITH_COMPONENTS, Arrays.asList(rowcol3));\n    LayoutElementTest row1 = new LayoutElementTest(\"1\", LayoutEditorElementType.ROW, Arrays.asList(column1, column2));\n    LayoutElementTest row2 = new LayoutElementTest(\"2\", LayoutEditorElementType.ROW, Arrays.asList(column3));\n    LayoutElementTest container = new LayoutElementTest(\"container\", LayoutEditorElementType.CONTAINER, Arrays.asList(row1, row2));\n    private LayoutEditorPropertiesPresenter presenter;\n\n    @Before\n    public void initialize() {\n        when(layoutElementPropertiesPresenterInstance.get()).thenReturn(elementPropertiesPresenter);\n        when(layoutEditor.getLayoutElements()).thenReturn(Arrays.asList(container, \n                                                                        row1, column1, column2, \n                                                                        row2, column3, rowcol3, column4, column5, columnWithParts));\n\n        presenter = new LayoutEditorPropertiesPresenter(view, layoutElementPropertiesPresenterInstance, elementSelector);\n    }\n\n    @Test\n    public void testInit() {\n        this.elementSelector.setSearchEnabled(false);\n        this.elementSelector.setClearSelectionEnabled(false);\n        this.elementSelector.setWidth(275);\n        this.elementSelector.init(eq(presenter.getSearchService()), any());\n    }\n\n    @Test\n    public void testEditLayout() {\n        presenter.edit(layoutEditor);\n\n        verify(view).dispose();\n        verify(view).showSelector(elementSelector);\n        verify(view, never()).setClearPropertiesEnabled(true);\n        verify(elementSelector).clear();\n        verify(elementSelector).setSelectedItem(\"container\");\n        verify(elementPropertiesPresenter).edit(container);\n    }\n\n    @Test\n    public void testSelectorEntries() {\n        presenter.edit(layoutEditor);\n        presenter.getSearchService().search(\"\", -1, results -> {\n            assertEquals(results.size(), 8);\n            assertEquals(results.get(0).getKey(), \"container\");\n            assertEquals(results.get(0).getValue(), \"page\");\n            assertEquals(results.get(1).getKey(), \"1\");\n            assertEquals(results.get(1).getValue(), \"row 1\");\n            assertEquals(results.get(2).getKey(), \"1\");\n            assertEquals(results.get(2).getValue(), \"row 1 > column 1 > component 1\");\n            assertEquals(results.get(3).getKey(), \"2\");\n            assertEquals(results.get(3).getValue(), \"row 1 > column 2 > component 1\");\n            assertEquals(results.get(4).getKey(), \"2\");\n            assertEquals(results.get(4).getValue(), \"row 2\");\n            assertEquals(results.get(5).getKey(), \"1\");\n            assertEquals(results.get(5).getValue(), \"row 2 > column 1 > component 1\");\n            assertEquals(results.get(6).getKey(), \"2\");\n            assertEquals(results.get(6).getValue(), \"row 2 > column 1 > component 2\");\n            assertEquals(results.get(7).getKey(), \"CPARTS\");\n            assertEquals(results.get(7).getValue(), \"row 2 > column 1 > component 3\");\n        });\n    }\n    \n    @Test\n    public void columnWithPartsTest() {\n        presenter.edit(layoutEditor);\n        presenter.edit(columnWithParts);\n        verify(view).showParts(Arrays.asList(LayoutEditorPropertiesPresenter.PART_ROOT, \n                                             PART_1.id, \n                                             PART_2.id));\n    }\n    \n    @Test\n    public void columnWithoutPartsTest() {\n        presenter.edit(layoutEditor);\n        verify(view).noParts();\n    }\n    \n    @Test\n    public void partEditTest() {\n        mockSelectedElement(columnWithParts.id);\n        presenter.edit(layoutEditor);\n        presenter.edit(columnWithParts);\n        presenter.onPartSelected(PART_1.id);\n        verify(elementPropertiesPresenter).edit(PART_1);\n    }\n\n    @Test\n    public void rootPartTest() {\n        mockSelectedElement(columnWithParts.id);\n        presenter.edit(layoutEditor);\n        presenter.edit(columnWithParts);\n        presenter.onPartSelected(LayoutEditorPropertiesPresenter.PART_ROOT);\n        verify(elementPropertiesPresenter).edit(columnWithParts);\n    }\n    \n    private void mockSelectedElement(String id) {\n        SingleLiveSearchSelectionHandler<String> selectionHandler = mock(SingleLiveSearchSelectionHandler.class);\n        when(selectionHandler.getSelectedKey()).thenReturn(id);\n        presenter.setSelectionHandler(selectionHandler);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/LayoutElementPropertiesPresenterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementClearAllPropertiesEvent;\nimport org.uberfire.ext.layout.editor.client.event.LayoutElementPropertyChangedEvent;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorCssHelper;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutElementPropertiesPresenter;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutElementPropertiesPresenterTest {\n\n    @Mock\n    LayoutEditorCssHelper cssHelper;\n\n    @Mock\n    EventSourceMock<LayoutElementPropertyChangedEvent> propertyChangedEvent;\n\n    @Mock\n    EventSourceMock<LayoutElementClearAllPropertiesEvent> propertyClearAllEvent;\n\n    @Mock\n    LayoutElementPropertiesPresenter.View view;\n\n    @Mock\n    LayoutEditorElement layoutElement;\n\n    Map<String,String> elementProps = new HashMap<>();\n    PropertyEditorCategory category1 = new PropertyEditorCategory(\"c1\");\n    PropertyEditorCategory category2 = new PropertyEditorCategory(\"c2\");\n    LayoutElementPropertiesPresenter presenter;\n\n    @Before\n    public void initialize() {\n        List<PropertyEditorCategory> categories = new ArrayList<>();\n        category1 = new PropertyEditorCategory(\"c1\");\n        category1.withField(new PropertyEditorFieldInfo(\"f1\", \"v1\", PropertyEditorType.TEXT).withKey(\"f1\"));\n        categories.add(category1);\n        category2 = new PropertyEditorCategory(\"c2\");\n        category2.withField(new PropertyEditorFieldInfo(\"f2\", \"v2\", PropertyEditorType.TEXT).withKey(\"f2\"));\n        categories.add(category2);\n\n        when(layoutElement.getProperties()).thenReturn(elementProps);\n        when(layoutElement.getPropertyCategories()).thenReturn(categories);\n        presenter = new LayoutElementPropertiesPresenter(view, cssHelper, propertyChangedEvent, propertyClearAllEvent);\n        presenter.edit(layoutElement);\n    }\n\n    @Test\n    public void testInit() {\n        verify(view).clear();\n        verify(view).addCategory(category1);\n        verify(view).addCategory(category2);\n        verify(view).show();\n\n        assertEquals(presenter.getCurrentValues().get(\"f1\"), \"v1\");\n        assertEquals(presenter.getCurrentValues().get(\"f2\"), \"v2\");\n    }\n\n    @Test\n    public void testReset() {\n        presenter.reset();\n\n        assertTrue(presenter.getCurrentValues().isEmpty());\n        verify(layoutElement).removeProperty(\"f1\");\n        verify(layoutElement).removeProperty(\"f2\");\n        verify(propertyClearAllEvent).fire(any());\n    }\n\n    @Test\n    public void testChangeValue() {\n        assertEquals(presenter.getCurrentValues().get(\"f1\"), \"v1\");\n\n        presenter.onPropertyChanged(\"f1\", \"v2\");\n        verify(layoutElement).setProperty(\"f1\", \"v2\");\n        verify(propertyChangedEvent).fire(any());\n        assertEquals(presenter.getCurrentValues().get(\"f1\"), \"v2\");\n    }\n\n    @Test\n    public void testRemoveValue() {\n        assertEquals(presenter.getCurrentValues().get(\"f1\"), \"v1\");\n\n        presenter.onPropertyChanged(\"f1\", \"\");\n        verify(layoutElement).removeProperty(\"f1\");\n        verify(propertyChangedEvent).fire(any());\n        assertFalse(presenter.getCurrentValues().containsKey(\"f1\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/FullLayoutTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.AbstractLayoutEditorTest;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ColumnWithComponents;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnResizeEvent;\nimport org.uberfire.ext.layout.editor.client.infra.RowResizeEvent;\nimport org.uberfire.ext.plugin.type.TagsConverterUtil;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class FullLayoutTest extends AbstractLayoutEditorTest {\n\n    @Test\n    public void testFullLayoutFluid() throws Exception {\n\n        container.loadEmptyLayout(\"A\",\n                                  LayoutTemplate.Style.FLUID,\n                                  \"title\",\n                                  \"subtitle\");\n        container.addProperty(TagsConverterUtil.LAYOUT_PROPERTY,\n                              \"a|\");\n\n        createFirstRow();\n        createSecondRow();\n\n        LayoutTemplate layoutTemplate = container.toLayoutTemplate();\n        assertEquals(convertLayoutToString(loadLayout(FULL_LAYOUT_FLUID)),\n                     convertLayoutToString(layoutTemplate));\n    }\n\n    @Test\n    public void testFullLayoutPage() throws Exception {\n\n        container.loadEmptyLayout(\"A\",\n                                  LayoutTemplate.Style.PAGE,\n                                  \"title\",\n                                  \"subtitle\");\n        container.addProperty(TagsConverterUtil.LAYOUT_PROPERTY,\n                              \"a|\");\n\n        createFirstRow();\n        createSecondRow();\n\n        resizeSecondRow();\n        resizeSecondRow();\n\n        LayoutTemplate layoutTemplate = container.toLayoutTemplate();\n        assertEquals(convertLayoutToString(loadLayout(FULL_LAYOUT_PAGE)),\n                     convertLayoutToString(layoutTemplate));\n    }\n\n    private void resizeSecondRow() {\n        Row firstRow = getRowByIndex(0);\n\n        RowResizeEvent resize = new RowResizeEvent(container.hashCode(),\n                firstRow.hashCode()).down();\n        container.resizeRows(resize);\n    }\n\n    private void createSecondRow() {\n        Row firstRow = getRowByIndex(0);\n        container.createRowDropCommand().execute(new RowDrop(new LayoutComponent(\n                \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\"),\n                                                             firstRow.getId(),\n                                                             RowDrop.Orientation.AFTER));\n        Column column = getColumnByIndex(getRowByIndex(1),\n                                         FIRST_COLUMN);\n        column.getLayoutComponent().addProperty(\"Place Name\",\n                                                \"DoraScreen\");\n    }\n\n    private void createFirstRow() {\n        Column firstRowFirstColumn = createFirstRowFirstColumn();\n        createFirstRowSecondColumn(firstRowFirstColumn);\n    }\n\n    private void dropTwoInnerColumnsInSecondRow() {\n        Row row = getRowByIndex(FIRST_ROW);\n        Column secondColumn = getColumnByIndex(row,\n                                               1);\n\n        row.dropCommand().execute(new ColumnDrop(new LayoutComponent(\n                \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\"),\n                                                 secondColumn.getId(),\n                                                 ColumnDrop.Orientation.DOWN));\n\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) getColumnByIndex(row,\n                                                                                            SECOND_COLUMN);\n\n        assertNotNull(columnWithComponents.getRow().getParentColumnWithComponents());\n        Column newColumn = getColumnByIndex(columnWithComponents.getRow(),\n                                            1);\n        newColumn.getLayoutComponent().addProperty(\"c\",\n                                                   \"c\");\n        newColumn.getLayoutComponent().addProperty(\"Place Name\",\n                                                   \"AnotherScreen\");\n    }\n\n    private void resizeColumnsFor_8_4() {\n        Row row = getRowByIndex(FIRST_ROW);\n\n        row.resizeColumns(new ColumnResizeEvent(getColumnByIndex(row,\n                                                                 0).hashCode(),\n                                                row.hashCode()).right());\n        row.resizeColumns(new ColumnResizeEvent(getColumnByIndex(row,\n                                                                 0).hashCode(),\n                                                row.hashCode()).right());\n    }\n\n    private void createFirstRowSecondColumn(Column firstRowFirstColumn) {\n        Row row = getRowByIndex(FIRST_ROW);\n\n        row.dropCommand().execute(new ColumnDrop(\n                new LayoutComponent(\"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTML\"),\n                firstRowFirstColumn.getId(),\n                ColumnDrop.Orientation.RIGHT));\n        Column htmlColumn = getColumnByIndex(row,\n                                             SECOND_COLUMN);\n        htmlColumn.getLayoutComponent().addProperty(\"HTML_CODE\",\n                                                    \"c\");\n\n        resizeColumnsFor_8_4();\n        dropTwoInnerColumnsInSecondRow();\n    }\n\n    private Column createFirstRowFirstColumn() {\n        container.createEmptyDropCommand()\n                .execute(new RowDrop(new LayoutComponent(\n                        \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\"),\n                                     emptyDropRow.getId(),\n                                     RowDrop.Orientation.BEFORE));\n\n        Column appHomePresenter = getColumnByIndex(getRowByIndex(FIRST_COLUMN),\n                                                   FIRST_COLUMN);\n        appHomePresenter.getLayoutComponent().addProperty(\"Place Name\",\n                                                          \"AppsHomePresenter\");\n        return appHomePresenter;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/columns/ColumnWithComponentsTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport javax.enterprise.event.Event;\n\nimport org.junit.Test;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.ext.layout.editor.client.AbstractLayoutEditorTest;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.DnDManager;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class ColumnWithComponentsTest extends AbstractLayoutEditorTest {\n\n    @Mock\n    private Event<LockRequiredEvent> lockRequiredEvent;\n\n    @Mock\n    private DnDManager dndManager;\n\n    @Spy\n    @InjectMocks\n    private ColumnWithComponents columnWithComponents;\n\n    @Mock\n    private ParameterizedCommand<ColumnDrop> dropCommand;\n\n    @Test\n    public void testOnDropComponentMove() {\n        when(dndManager.isOnComponentMove()).thenReturn(true);\n        columnWithComponents.onDrop(ColumnDrop.Orientation.UP, \"this-is-a-requirement-to-firefox-html5dnd\");\n        verify(lockRequiredEvent,\n               times(1)).fire(any(LockRequiredEvent.class));\n    }\n\n    @Test\n    public void testOnDropNewComponent() {\n        when(dndManager.isOnComponentMove()).thenReturn(false);\n        columnWithComponents.onDrop(ColumnDrop.Orientation.UP, \"this-is-a-requirement-to-firefox-html5dnd\");\n        verify(lockRequiredEvent,\n               times(1)).fire(any(LockRequiredEvent.class));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.event.Event;\n\nimport org.junit.Test;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponentPart;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.AbstractLayoutEditorTest;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorElement;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.DragComponentEndEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class ComponentColumnTest extends AbstractLayoutEditorTest {\n\n    @Mock\n    private Event<LockRequiredEvent> lockRequiredEvent;\n\n    @Spy\n    @InjectMocks\n    private ComponentColumn componentColumn;\n\n    @Mock\n    private LayoutEditorElement parent;\n\n    @Mock\n    private LayoutComponent layoutComponent;\n\n    @Mock\n    private ParameterizedCommand<ColumnDrop> dropCommand;\n\n    @Mock\n    private ParameterizedCommand<Column> removeCommand;\n\n    @Mock\n    private Supplier<LayoutTemplate> currentLayoutTemplateSupplier;\n\n    @Mock\n    private Supplier<Boolean> lockSupplier;\n\n    @Mock\n    private ComponentColumn.View view;\n\n    @Test\n    public void assertThereIsNoGWTDepInComponentColumn() throws Exception {\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n    }\n    \n    @Test\n    public void emptyPartsWontBreakTest() throws Exception {\n        LayoutTemplate layout = loadLayout(SINGLE_ROW_COMPONENT_LAYOUT);\n        List<LayoutComponentPart> parts = layout.getRows().get(0)\n                                               .getLayoutColumns().get(0)\n                                               .getLayoutComponents().get(0)\n                                               .getParts();\n        assertTrue(parts.isEmpty());\n    }\n    \n    @Test\n    public void partsLoadingTest() throws Exception {\n        LayoutTemplate layout = loadLayout(SINGLE_ROW_COMPONENT_LAYOUT_WITH_PARTS);\n        List<LayoutComponentPart> parts = layout.getRows().get(0)\n                                               .getLayoutColumns().get(0)\n                                               .getLayoutComponents().get(0)\n                                               .getParts();\n        assertEquals(2, parts.size());\n        Optional<LayoutComponentPart> part1Op = parts.stream()\n                                                     .filter(p -> p.getPartId().equals(\"PART1\"))\n                                                     .findFirst();\n        assertTrue(part1Op.isPresent());\n        LayoutComponentPart part1 = part1Op.get();\n        assertTrue(part1.getCssProperties().containsKey(\"PROP1\"));\n        assertEquals(\"PROP1_VAL\", part1.getCssProperties().get(\"PROP1\"));\n        part1.clearCssProperties();\n        assertTrue(part1.getCssProperties().isEmpty());\n        part1.addCssProperty(\"NEW_PROP\", \"NEW_VALUE\");\n        assertEquals(\"NEW_VALUE\", part1.getCssProperties().get(\"NEW_PROP\"));\n    }\n\n    @Test\n    public void testOnDrop() {\n        componentColumn.onDrop(ColumnDrop.Orientation.UP,\"this-is-a-requirement-to-firefox-html5dnd\");\n        verify(lockRequiredEvent,\n               times(1)).fire(any(LockRequiredEvent.class));\n    }\n\n    @Test\n    public void testRequiredLock() {\n        componentColumn.requiredLock();\n        verify(lockRequiredEvent,\n               times(1)).fire(any(LockRequiredEvent.class));\n    }\n\n    @Test\n    public void onDragEnd() {\n        componentColumn.onDragEnd(new DragComponentEndEvent());\n        verify(view, times(1)).notifyDragEnd();\n        verify(lockRequiredEvent,\n               times(1)).fire(any(LockRequiredEvent.class));\n    }\n\n    @Test\n    public void testConfigComponentSupplier() {\n        when(lockSupplier.get()).thenReturn(true);\n        componentColumn.configComponent(true);\n        verify(view, times(0)).hasModalConfiguration();\n    }\n\n    @Test\n    public void testConfigComponent() {\n        when(lockSupplier.get()).thenReturn(false);\n        when(view.hasModalConfiguration()).thenReturn(true);\n        componentColumn.configComponent(true);\n        verify(view,times(1)).hasModalConfiguration();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/columns/ComponentColumnViewTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.components.columns;\n\nimport com.google.gwt.user.client.Event;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.layout.editor.client.widgets.KebabWidget;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ComponentColumnViewTest {\n\n    ComponentColumnView componentColumnView;\n    private KebabWidget kebabWidget;\n    private ComponentColumn presenter;\n\n    @Before\n    public void setup() {\n        componentColumnView = spy(new ComponentColumnView());\n        componentColumnView.content = mock(Div.class);\n        kebabWidget = spy(new KebabWidget());\n        componentColumnView.kebabWidget = kebabWidget;\n        presenter = mock(ComponentColumn.class);\n    }\n\n    @Test\n    public void setupKebabWidgetTest() {\n        componentColumnView.init(presenter);\n\n        doNothing().when(componentColumnView).setupEvents();\n        doNothing().when(componentColumnView).setupOnResize();\n        doNothing().when(componentColumnView).removeCurrentWidget();\n        componentColumnView.setupWidget();\n\n        verify(kebabWidget).init(any(),\n                                 any());\n\n        kebabWidget.removeClick(mock(Event.class));\n\n        verify(componentColumnView).removeCurrentWidget();\n        verify(presenter).remove();\n\n        kebabWidget.editClick(mock(Event.class));\n\n        verify(presenter).edit();\n    }\n\n    @Test\n    public void clearContentTest() {\n        doNothing().when(componentColumnView).removeCurrentWidget();\n        componentColumnView.init(presenter);\n\n        componentColumnView.clearContent();\n\n        verify(componentColumnView).removeCurrentWidget();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/container/ContainerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.container;\n\nimport java.util.function.Supplier;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.LockRequiredEvent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.AbstractLayoutEditorTest;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropEvent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumn;\nimport org.uberfire.ext.layout.editor.client.components.rows.Row;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDnDEvent;\nimport org.uberfire.ext.layout.editor.client.components.rows.RowDrop;\nimport org.uberfire.ext.layout.editor.client.infra.RowResizeEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class ContainerTest extends AbstractLayoutEditorTest {\n\n    @Test\n    public void assertEmptyContainerHasEmptyDropRow() {\n        container.loadEmptyLayout(\"layout\",\n                                  LayoutTemplate.Style.FLUID,\n                                  \"\",\n                                  \"\");\n        assertTrue(container.getRows().isEmpty());\n        assertNotNull(container.getEmptyDropRow());\n        verify(view).addEmptyRow(emptyDropRow.getView());\n    }\n\n    @Test\n    public void createFirstRowFluid() {\n        container.loadEmptyLayout(\"layout\",\n                                  LayoutTemplate.Style.FLUID,\n                                  \"\",\n                                  \"\");\n        assertEquals(0,\n                     getRowsSizeFromContainer());\n        assertNotNull(container.getEmptyDropRow());\n        verify(view).addEmptyRow(emptyDropRow.getView());\n\n        container.createEmptyDropCommand()\n                .execute(new RowDrop(new LayoutComponent(\"dragType\"),\n                                     emptyDropRow.getId(),\n                                     RowDrop.Orientation.BEFORE));\n        assertEquals(1,\n                     getRowsSizeFromContainer());\n        verify(componentDropEventMock,\n               times(1)).fire(any(ComponentDropEvent.class));\n    }\n\n    @Test\n    public void createRowsPage() {\n        container.loadEmptyLayout(\"layout\",\n                                  LayoutTemplate.Style.PAGE,\n                                  \"\",\n                                  \"\");\n        assertEquals(0,\n                     getRowsSizeFromContainer());\n        assertNotNull(container.getEmptyDropRow());\n        verify(view).addEmptyRow(emptyDropRow.getView());\n\n        container.createEmptyDropCommand()\n                .execute(new RowDrop(new LayoutComponent(\"dragType\"),\n                                     emptyDropRow.getId(),\n                                     RowDrop.Orientation.BEFORE));\n        assertEquals(1,\n                     getRowsSizeFromContainer());\n        assertEquals(Row.ROW_DEFAULT_HEIGHT,\n                     getRowByIndex(0).getHeight());\n        verify(componentDropEventMock,\n               times(1)).fire(any(ComponentDropEvent.class));\n\n        Row row0 = getRowByIndex(0);\n\n        row0.drop(\"dragType\",\n                  RowDrop.Orientation.AFTER);\n\n        assertEquals(Row.ROW_DEFAULT_HEIGHT / 2,\n                     getRowByIndex(0).getHeight());\n        assertEquals(Row.ROW_DEFAULT_HEIGHT / 2,\n                     getRowByIndex(1).getHeight());\n\n        container.resizeRows(new RowResizeEvent(container.hashCode(),\n                row0.hashCode()).down());\n\n        assertEquals(Row.ROW_DEFAULT_HEIGHT / 2 + 1,\n                     getRowByIndex(0).getHeight());\n        assertEquals(Row.ROW_DEFAULT_HEIGHT / 2 - 1,\n                     getRowByIndex(1).getHeight());\n\n        ComponentColumn col = (ComponentColumn) getColumnByIndex(getRowByIndex(1),\n                                                                 0);\n        col.remove();\n\n        assertEquals(Row.ROW_DEFAULT_HEIGHT,\n                     getRowByIndex(0).getHeight());\n    }\n\n    @Test\n    public void loadEmptyTemplateClearEmptyRow() throws Exception {\n        reset(container.getView());\n        LayoutTemplate layoutTemplate = new LayoutTemplate(\"layout\");\n        container.load(layoutTemplate, \"title\", \"subtitle\");\n        assertEquals(container.getLayoutName(), \"layout\");\n        assertEquals(container.getRows().size(), 0);\n        assertNotNull(container.getEmptyDropRow());\n        verify(container.getView()).clear();\n        verify(container.getView()).addEmptyRow(container.getEmptyDropRow().getView());\n\n        reset(container.getView());\n        container.load(layoutTemplate, \"\", \"\");\n        assertEquals(container.getRows().size(), 0);\n        assertNotNull(container.getEmptyDropRow());\n        verify(container.getView()).clear();\n        verify(container.getView()).addEmptyRow(container.getEmptyDropRow().getView());\n    }\n\n    @Test\n    public void loadEmptyLayoutClearEmptyRow() throws Exception {\n        reset(container.getView());\n        container.loadEmptyLayout(\"layout\", LayoutTemplate.Style.FLUID, \"title\", \"subtitle\");\n        assertEquals(container.getLayoutName(), \"layout\");\n        assertEquals(container.getRows().size(), 0);\n        assertNotNull(container.getEmptyDropRow());\n        verify(container.getView()).clear();\n        verify(container.getView()).addEmptyRow(container.getEmptyDropRow().getView());\n\n        reset(container.getView());\n        container.loadEmptyLayout(\"layout\", LayoutTemplate.Style.FLUID, \"title\", \"subtitle\");\n        assertEquals(container.getRows().size(), 0);\n        assertNotNull(container.getEmptyDropRow());\n        verify(container.getView()).clear();\n        verify(container.getView()).addEmptyRow(container.getEmptyDropRow().getView());\n    }\n\n    @Test\n    public void loadNonEmptyTemplateClearExistingRows() throws Exception {\n        LayoutTemplate layoutTemplate = getLayoutFromFileTemplate(SAMPLE_FULL_FLUID_LAYOUT);\n        container.load(layoutTemplate, \"title\", \"subtitle\");\n        assertEquals(container.getRows().size(), 4);\n\n        container.load(layoutTemplate, \"\", \"\");\n        assertEquals(container.getRows().size(), 4);\n    }\n\n    @Test\n    public void loadAndExportFluidLayout() throws Exception {\n\n        LayoutTemplate expected = loadLayout(SAMPLE_FULL_FLUID_LAYOUT);\n\n        LayoutTemplate actual = container.toLayoutTemplate();\n        assertEquals(expected,\n                     actual);\n        assertEquals(convertLayoutToString(expected),\n                     convertLayoutToString(actual));\n    }\n\n    @Test\n    public void loadAndExportPageLayout() throws Exception {\n\n        LayoutTemplate expected = loadLayout(SAMPLE_FULL_PAGE_LAYOUT);\n\n        LayoutTemplate actual = container.toLayoutTemplate();\n\n        assertEquals(expected,\n                     actual);\n        assertEquals(convertLayoutToString(expected),\n                     convertLayoutToString(actual));\n    }\n\n    @Test\n    public void dropBeforeComponentShouldCreateANewRow() throws Exception {\n\n        loadLayout(SINGLE_ROW_COMPONENT_LAYOUT);\n\n        Row dropRow = getRowByIndex(FIRST_ROW);\n\n        RowDrop dropNewComponentOnFirstRow = new RowDrop(new LayoutComponent(\"dragType\"),\n                                                         dropRow.getId(),\n                                                         RowDrop.Orientation.BEFORE);\n        dropNewComponentOnFirstRow.newComponent();\n\n        container.createRowDropCommand().execute(dropNewComponentOnFirstRow);\n\n        assertEquals(2,\n                     getRowsSizeFromContainer());\n\n        Column droppedColumn = getColumnByIndex(getRowByIndex(FIRST_ROW),\n                                                FIRST_COLUMN);\n        assertEquals(\"dragType\",\n                     droppedColumn.getLayoutComponent()\n                             .getDragTypeName());\n\n        assertEquals(dropRow,\n                     getRowByIndex(SECOND_ROW));\n\n        verify(componentDropEventMock,\n               times(1)).fire(any(ComponentDropEvent.class));\n    }\n\n    @Test\n    public void moveComponentShouldRemoveComponentFromCurrentRow() throws Exception {\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row dropRow = getRowByIndex(FIRST_ROW);\n\n        RowDrop moveComponentAndDropInFirstRow = new RowDrop(new LayoutComponent(\"dragType\"),\n                                                             dropRow.getId(),\n                                                             RowDrop.Orientation.BEFORE);\n        moveComponentAndDropInFirstRow.fromMove(dropRow.getId(),\n                                                getColumns(dropRow).get(0));\n\n        container.createRowDropCommand().execute(moveComponentAndDropInFirstRow);\n\n        assertEquals(2,\n                     getRowsSizeFromContainer());\n        assertEquals(1,\n                     getColumns(getRowByIndex(FIRST_ROW)).size());\n        assertEquals(1,\n                     getColumns(getRowByIndex(SECOND_ROW)).size());\n\n        verify(componentDropEventMock,\n               times(1)).fire(any(ComponentDropEvent.class));\n        verify(componentRemoveEventMock,\n               times(1)).fire(any(ComponentRemovedEvent.class));\n    }\n\n    @Test\n    public void swapRows() throws Exception {\n        loadLayout(SAMPLE_FULL_FLUID_LAYOUT);\n\n        Row row1 = getRowByIndex(FIRST_ROW);\n        Row row2 = getRowByIndex(SECOND_ROW);\n\n        container.swapRows(new RowDnDEvent(row1.getId(),\n                                           row2.getId(),\n                                           RowDrop.Orientation.AFTER));\n\n        assertEquals(row2,\n                     getRowByIndex(FIRST_ROW));\n        assertEquals(row1,\n                     getRowByIndex(SECOND_ROW));\n    }\n\n    @Test\n    public void dropAfterComponentShouldCreateANewRow() throws Exception {\n        loadLayout(SINGLE_ROW_COMPONENT_LAYOUT);\n\n        Row dropRow = getRowByIndex(0);\n\n        ParameterizedCommand<RowDrop> rowDropCommand = container.createRowDropCommand();\n        RowDrop drop = new RowDrop(new LayoutComponent(\"dragType\"),\n                                   dropRow.getId(),\n                                   RowDrop.Orientation.AFTER);\n        drop.newComponent();\n        rowDropCommand.execute(drop);\n\n        assertEquals(2,\n                     getRowsSizeFromContainer());\n        assertEquals(dropRow,\n                     getRowByIndex(FIRST_ROW));\n        verify(lockRequiredEventMock, times(1)).fire(any(LockRequiredEvent.class));\n        verify(componentDropEventMock,\n               times(1)).fire(any(ComponentDropEvent.class));\n    }\n\n    @Test\n    public void removeSingleComponentFromRowShouldRemoveRow() throws Exception {\n\n        loadLayout(SINGLE_ROW_COMPONENT_LAYOUT);\n\n        assertFalse(container.getRows().isEmpty());\n\n        Row row = getRowByIndex(FIRST_ROW);\n        ComponentColumn column = (ComponentColumn) getColumns(row).get(0);\n\n        column.remove();\n\n        assertTrue(container.getRows().isEmpty());\n    }\n\n    @Test\n    public void addGetPropertyTest() throws Exception {\n        assertNull(container.getProperty(\"key\"));\n        container.addProperty(\"key\",\n                              \"value\");\n        assertNotNull(container.getProperty(\"key\"));\n        assertTrue(container.getProperties().containsKey(\"key\"));\n    }\n\n    @Test\n    public void createCurrentLayoutTemplateSupplierTest() throws Exception {\n        LayoutTemplate expected = loadLayout(SAMPLE_FULL_FLUID_LAYOUT);\n\n        LayoutTemplate toLayoutTemplate = container.toLayoutTemplate();\n        Supplier<LayoutTemplate> currentLayoutTemplateSupplier = container.createCurrentLayoutTemplateSupplier();\n\n        assertEquals(expected,\n                     toLayoutTemplate);\n        assertEquals(expected,\n                     currentLayoutTemplateSupplier.get());\n    }\n\n    @Test\n    public void testLockSupplier() {\n        container.setLockSupplier(() -> false);\n        assertEquals(Boolean.FALSE, container.getLockSupplier().get());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/components/rows/RowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.components.rows;\n\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.AbstractLayoutEditorTest;\nimport org.uberfire.ext.layout.editor.client.api.ComponentDropEvent;\nimport org.uberfire.ext.layout.editor.client.api.ComponentRemovedEvent;\nimport org.uberfire.ext.layout.editor.client.components.columns.Column;\nimport org.uberfire.ext.layout.editor.client.components.columns.ColumnWithComponents;\nimport org.uberfire.ext.layout.editor.client.components.columns.ComponentColumn;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnDrop;\nimport org.uberfire.ext.layout.editor.client.infra.ColumnResizeEvent;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class RowTest extends AbstractLayoutEditorTest {\n\n    @Test\n    public void dropOnLeftColumn() throws Exception {\n\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        Column dropColumn = getColumnByIndex(row,\n                                             FIRST_COLUMN);\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        row.dropCommand().execute(new ColumnDrop(new LayoutComponent(\"dragType\"),\n                                                 dropColumn.getId(),\n                                                 ColumnDrop.Orientation.LEFT));\n\n        Column newColumn = getColumnByIndex(row,\n                                            FIRST_COLUMN);\n\n        assertEquals(3,\n                     row.getColumns().size());\n        assertEquals(\"dragType\",\n                     newColumn.getLayoutComponent().getDragTypeName());\n        assertEquals(dropColumn,\n                     getColumnByIndex(row,\n                                      SECOND_COLUMN));\n    }\n\n    @Test\n    public void dropOnRightColumn() throws Exception {\n\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        Column dropColumn = getColumnByIndex(row,\n                                             FIRST_COLUMN);\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        row.dropCommand().execute(new ColumnDrop(new LayoutComponent(\"dragType\"),\n                                                 dropColumn.getId(),\n                                                 ColumnDrop.Orientation.RIGHT));\n\n        Column newColumn = getColumnByIndex(row,\n                                            SECOND_COLUMN);\n\n        assertEquals(3,\n                     row.getColumns().size());\n        assertEquals(\"dragType\",\n                     newColumn.getLayoutComponent().getDragTypeName());\n        assertEquals(dropColumn,\n                     getColumnByIndex(row,\n                                      FIRST_COLUMN));\n    }\n\n    @Test\n    public void dropAboveColumnShouldCreateColumnWithComponents() throws Exception {\n\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        Column dropColumn = getColumnByIndex(row,\n                                             FIRST_COLUMN);\n        LayoutComponent originalColumnLayoutComponent = dropColumn.getLayoutComponent();\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        row.dropCommand().execute(new ColumnDrop(new LayoutComponent(\"dragType\"),\n                                                 dropColumn.getId(),\n                                                 ColumnDrop.Orientation.DOWN));\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) getColumnByIndex(row,\n                                                                                            FIRST_COLUMN);\n\n        List<Column> childs = extractColumnsFrom(columnWithComponents);\n\n        assertEquals(2,\n                     childs.size());\n        assertEquals(originalColumnLayoutComponent,\n                     childs.get(FIRST_COLUMN).getLayoutComponent());\n        LayoutComponent newColumnLayoutComponent = childs.get(SECOND_COLUMN).getLayoutComponent();\n        assertEquals(\"dragType\",\n                     newColumnLayoutComponent.getDragTypeName());\n    }\n\n    @Test\n    public void dropUpperColumnShouldCreateColumnWithComponents() throws Exception {\n\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        Column dropColumn = getColumnByIndex(row,\n                                             SECOND_COLUMN);\n        LayoutComponent originalColumnLayoutComponent = dropColumn.getLayoutComponent();\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        row.dropCommand().execute(new ColumnDrop(new LayoutComponent(\"dragType\"),\n                                                 dropColumn.getId(),\n                                                 ColumnDrop.Orientation.UP));\n\n        assertEquals(2,\n                     row.getColumns().size());\n\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) getColumnByIndex(row,\n                                                                                            SECOND_COLUMN);\n\n        List<Column> childs = extractColumnsFrom(columnWithComponents);\n\n        assertEquals(2,\n                     childs.size());\n        LayoutComponent newColumnLayoutComponent = childs.get(FIRST_COLUMN).getLayoutComponent();\n        assertEquals(\"dragType\",\n                     newColumnLayoutComponent.getDragTypeName());\n        assertEquals(originalColumnLayoutComponent,\n                     childs.get(SECOND_COLUMN).getLayoutComponent());\n    }\n\n    @Test\n    public void resizeEventTest() throws Exception {\n\n        loadLayout(SINGLE_ROW_TWO_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        Column first = getColumnByIndex(row,\n                                        FIRST_COLUMN);\n        Column second = getColumnByIndex(getRowByIndex(FIRST_ROW),\n                                         SECOND_COLUMN);\n\n        Integer originalFirstSize = first.getColumnWidth();\n        Integer originalSecondSize = second.getColumnWidth();\n\n        row.resizeColumns(new ColumnResizeEvent(second.hashCode(),\n                                                row.hashCode()).left());\n\n        assertEquals(originalFirstSize - 1,\n                     first.getColumnWidth());\n        assertEquals(originalSecondSize + 1,\n                     second.getColumnWidth());\n\n        row.resizeColumns(new ColumnResizeEvent(second.hashCode(),\n                                                row.hashCode()).left());\n\n        assertEquals(originalFirstSize - 2,\n                     first.getColumnWidth());\n        assertEquals(originalSecondSize + 2,\n                     second.getColumnWidth());\n\n        row.resizeColumns(new ColumnResizeEvent(first.hashCode(),\n                                                row.hashCode()).right());\n\n        assertEquals(originalFirstSize - 1,\n                     first.getColumnWidth());\n        assertEquals(originalSecondSize + 1,\n                     second.getColumnWidth());\n    }\n\n    @Test\n    public void testRemoveElementInColumnWithComponents() throws Exception {\n\n        ArgumentCaptor<ComponentRemovedEvent> removeEventCaptor = ArgumentCaptor.forClass(ComponentRemovedEvent.class);\n\n        loadLayout(SAMPLE_COLUMN_WITH_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        assertThat(row.getColumns()).hasSize(1);\n\n        Column rowColumn = row.getColumns().get(0);\n        assertThat(rowColumn).isNotNull().isInstanceOf(ColumnWithComponents.class);\n\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) rowColumn;\n        assertThat(columnWithComponents.getRow().getColumns()).hasSize(3);\n\n        Column firstColumn = columnWithComponents.getRow().getColumns().get(0);\n        assertThat(firstColumn).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        Column secondColumn = columnWithComponents.getRow().getColumns().get(1);\n        assertThat(secondColumn).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        Column thirdColumn = columnWithComponents.getRow().getColumns().get(2);\n        assertThat(thirdColumn).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        // Remove thirdColumn -> the expected result is that rowColumn will be a ColumnWithComponents with two columns (firstColumn & secondColumn)\n        row.removeColumn(thirdColumn);\n        rowColumn = row.getColumns().get(0);\n        assertThat(rowColumn).isNotNull().isInstanceOf(ColumnWithComponents.class);\n\n        verify(componentRemoveEventMock,\n               times(1)).fire(removeEventCaptor.capture());\n        assertFalse(removeEventCaptor.getValue().getFromMove());\n\n        columnWithComponents = (ColumnWithComponents) rowColumn;\n        assertThat(columnWithComponents.getRow().getColumns()).hasSize(2).contains(firstColumn,\n                                                                                   secondColumn);\n\n        // Remove firstColumn -> since rowColumn will have onlye one ComponentColumn the expected result is that\n        // rowColumn will be a ComponentColumn copy of secondColumn\n        row.removeColumn(firstColumn);\n\n        verify(componentRemoveEventMock,\n               times(2)).fire(removeEventCaptor.capture());\n        assertFalse(removeEventCaptor.getValue().getFromMove());\n\n        assertThat(row.getColumns()).hasSize(1);\n\n        rowColumn = row.getColumns().get(0);\n\n        assertThat(rowColumn).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        assertThat(rowColumn).isEqualToComparingOnlyGivenFields(secondColumn,\n                                                                \"columnWidth\",\n                                                                \"columnHeight\",\n                                                                \"layoutComponent\");\n    }\n\n    @Test\n    public void testIsDropInSameColumnWithComponent() throws Exception {\n\n        loadLayout(SAMPLE_COLUMN_WITH_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n\n        assertThat(row.getColumns()).hasSize(1);\n\n        Column rowColumn = row.getColumns().get(0);\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) rowColumn;\n        Column firstColumn = columnWithComponents.getRow().getColumns().get(0);\n\n        // when drop is not in the same column\n        ColumnDrop columnDrop = mock(ColumnDrop.class);\n        when(columnDrop.getOldColumn()).thenReturn(firstColumn);\n        when(columnDrop.getEndId()).thenReturn(\"container: | row:1\");\n        assertFalse(row.isDropInSameColumnWithComponent(columnDrop));\n\n        // when drop is in the same column\n        when(columnDrop.getOldColumn()).thenReturn(firstColumn);\n        when(columnDrop.getEndId()).thenReturn(firstColumn.getId());\n        assertTrue(row.isDropInSameColumnWithComponent(columnDrop));\n    }\n\n    @Test\n    public void moveElementInRow() throws Exception {\n\n        loadLayout(SAMPLE_COLUMN_WITH_COMPONENTS_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        assertThat(row.getColumns()).hasSize(1);\n\n        Column rowColumn = row.getColumns().get(0);\n        assertThat(rowColumn).isNotNull().isInstanceOf(ColumnWithComponents.class);\n\n        ColumnWithComponents columnWithComponents = (ColumnWithComponents) rowColumn;\n        assertThat(columnWithComponents.getRow().getColumns()).hasSize(3);\n\n        Column column = columnWithComponents.getRow().getColumns().get(0);\n        assertThat(column).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        // Dragging thirdColumn\n        dnDManager.dragComponent(column.getLayoutComponent(),\n                                 columnWithComponents.getRow().getId(),\n                                 column);\n        row.removeColumn(column);\n        rowColumn = row.getColumns().get(0);\n        assertThat(rowColumn).isNotNull().isInstanceOf(ColumnWithComponents.class);\n\n        ArgumentCaptor<ComponentRemovedEvent> removeEventCaptor = ArgumentCaptor.forClass(ComponentRemovedEvent.class);\n        verify(componentRemoveEventMock,\n               times(1)).fire(removeEventCaptor.capture());\n\n        assertTrue(removeEventCaptor.getValue().getFromMove());\n        assertTrue(dnDManager.isOnComponentMove());\n\n        // Dropping (we don't need any dropData for this test)\n        row.drop(\"\", RowDrop.Orientation.BEFORE);\n        ArgumentCaptor<ComponentDropEvent> dropEventCaptor = ArgumentCaptor.forClass(ComponentDropEvent.class);\n\n        verify(componentDropEventMock).fire(dropEventCaptor.capture());\n        assertTrue(dropEventCaptor.getValue().getFromMove());\n        // after drop dnDManager is no longer on move state\n        assertFalse(dnDManager.isOnComponentMove());\n    }\n\n    @Test\n    public void testMoveElement() throws Exception {\n        loadLayout(SAMPLE_FULL_FLUID_LAYOUT);\n\n        Row row = getRowByIndex(FIRST_ROW);\n        assertThat(row.getColumns()).hasSize(4);\n\n        Column rowColumn = row.getColumns().get(0);\n        assertThat(rowColumn).isNotNull().isInstanceOf(ComponentColumn.class);\n\n        ComponentColumn column = (ComponentColumn) rowColumn;\n\n        dnDManager.dragComponent(column.getLayoutComponent(),\n                                 row.getId(),\n                                 column);\n        row.removeColumn(column);\n\n        assertThat(row.getColumns()).hasSize(3);\n\n        ArgumentCaptor<ComponentRemovedEvent> removeEventCaptor = ArgumentCaptor.forClass(ComponentRemovedEvent.class);\n        verify(componentRemoveEventMock,\n               times(1)).fire(removeEventCaptor.capture());\n\n        assertTrue(removeEventCaptor.getValue().getFromMove());\n        assertTrue(dnDManager.isOnComponentMove());\n\n        // Dropping (we don't need any dropData for this test)\n        row.drop(\"\", RowDrop.Orientation.BEFORE);\n        ArgumentCaptor<ComponentDropEvent> dropEventCaptor = ArgumentCaptor.forClass(ComponentDropEvent.class);\n\n        verify(componentDropEventMock).fire(dropEventCaptor.capture());\n        assertTrue(dropEventCaptor.getValue().getFromMove());\n        // after drop dnDManager is no longer on move state\n        assertFalse(dnDManager.isOnComponentMove());\n    }\n\n    @Test\n    public void moveLastElementInRow() throws Exception {\n        loadLayout(FULL_LAYOUT_PAGE);\n\n        Row firstRow = getRowByIndex(FIRST_ROW);\n\n        Row secondRow = getRowByIndex(SECOND_ROW);\n\n        assertThat(container.getRows())\n                .hasSize(2)\n                .containsOnly(firstRow, secondRow);\n\n        assertThat(secondRow.getColumns())\n                .hasSize(1);\n\n        Column droppedColumn = secondRow.getColumns().get(0);\n        assertThat(droppedColumn)\n                .isNotNull();\n\n        dnDManager.dragComponent(droppedColumn.getLayoutComponent(),\n                                 droppedColumn.getId(),\n                                 droppedColumn);\n\n        // Dropping secondRow BEFORE firstRow\n        firstRow.drop(\"\", RowDrop.Orientation.BEFORE);\n\n        assertThat(container.getRows())\n                .hasSize(2);\n\n        // after the drop firstRowAfterMove must be a new row containing droppedColumn\n        Row firstRowAfterMove = getRowByIndex(FIRST_ROW);\n\n        // after the drop secondRowAfterMove must be firstRow\n        Row secondRowAfterMove = getRowByIndex(SECOND_ROW);\n\n        assertNotEquals(firstRow, firstRowAfterMove);\n\n        assertNotEquals(secondRow, secondRowAfterMove);\n\n        assertThat(firstRowAfterMove.getColumns())\n                .hasSize(1);\n\n        assertThat(firstRowAfterMove.getColumns().get(0).getLayoutComponent())\n                .isNotNull()\n                .isEqualTo(droppedColumn.getLayoutComponent());\n\n        assertEquals(firstRow, secondRowAfterMove);\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/generator/LayoutGeneratorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.generator;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.DOMTokenList;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.layout.editor.api.editor.*;\n\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutGeneratorTest {\n\n    @Mock\n    private HTMLElement containerElement;\n\n    @Mock\n    private DOMTokenList containerClassList;\n\n    @Mock\n    private HTMLElement rowElement;\n\n    @Mock\n    private DOMTokenList rowClassList;\n\n    @Mock\n    private HTMLElement columnElement;\n\n    @Mock\n    private DOMTokenList columnClassList;\n\n    @Mock\n    private IsWidget componentWidget;\n\n    private LayoutGeneratorDriver driver = new LayoutGeneratorDriver() {\n\n        @Override\n        public HTMLElement createContainer() {\n            return containerElement;\n        }\n\n        @Override\n        public HTMLElement createRow(LayoutRow layoutRow) {\n            return rowElement;\n        }\n\n        @Override\n        public HTMLElement createColumn(LayoutColumn layoutColumn) {\n            return columnElement;\n        }\n\n        @Override\n        public IsWidget createComponent(HTMLElement column, LayoutComponent layoutComponent) {\n            return componentWidget;\n        }\n    };\n\n    private LayoutGenerator generator = new AbstractLayoutGenerator() {\n\n        @Override\n        protected void generateComponents(LayoutTemplate layoutTemplate,\n                LayoutInstance layoutInstance,\n                LayoutGeneratorDriver driver,\n                LayoutColumn layoutColumn,\n                HTMLElement column) {\n        }\n\n        @Override\n        public LayoutInstance build(LayoutTemplate layoutTemplate) {\n            return super.build(layoutTemplate, driver);\n        }\n    };\n\n    private LayoutTemplate template = new LayoutTemplate(\"layout\");\n    private LayoutRow row1 = new LayoutRow();\n    private LayoutColumn column1 = new LayoutColumn(\"12\");\n    private LayoutComponent component1 = new LayoutComponent(\"\");\n\n    @Before\n    public void initialize() {\n        component1.addPartIfAbsent(\"PART\");\n        component1.addPartProperty(\"PART\", \"PROP\", \"PROP_VALUE\");\n        column1.add(component1);\n        row1.add(column1);\n        template.addRow(row1);\n\n        when(containerElement.getClassList()).thenReturn(containerClassList);\n        when(rowElement.getClassList()).thenReturn(rowClassList);\n        when(columnElement.getClassList()).thenReturn(columnClassList);\n    }\n\n    @Test\n    public void testContainerGeneration() {\n        generator.build(template);\n\n        verify(containerElement).setId(AbstractLayoutGenerator.CONTAINER_ID);\n        \n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/infra/LayoutDragComponentHelperTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.function.Predicate;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.ext.layout.editor.client.LayoutEditorPresenter;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.layout.editor.client.components.container.Container;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutDragComponentHelperTest {\n\n    @Mock\n    private SyncBeanManager beanManager;\n\n    @Mock\n    private ClientExperimentalFeaturesRegistryService experimentalFeaturesRegistryService;\n\n    private LayoutDragComponentHelper helper;\n    private SyncBeanDef<LayoutDragComponent> beanDefMock;\n\n    @Before\n    public void initialize() {\n        helper = createLayoutDragMock();\n\n        beanDefMock = mock(SyncBeanDef.class);\n        Collection<SyncBeanDef<LayoutDragComponent>> beanDefs = Arrays.asList(beanDefMock);\n        when(beanManager.lookupBeans(LayoutDragComponent.class)).thenReturn(beanDefs);\n    }\n\n    @Test\n    public void lookupBeanShouldRespectBeanScope() {\n        helper.lookupDragTypeBean(LayoutDragComponentMock.class.getName());\n        verify(beanDefMock).getInstance();\n        verify(beanDefMock, never()).newInstance();\n    }\n\n    private LayoutDragComponentHelper createLayoutDragMock() {\n        return new LayoutDragComponentHelper(beanManager, experimentalFeaturesRegistryService) {\n            @Override\n            Predicate<SyncBeanDef<LayoutDragComponent>> syncBeanDefBeanClassNamePredicate(String dragTypeClassName) {\n                return s -> true;\n            }\n\n            @Override\n            boolean isAnEnabledExperimentalFeature(SyncBeanDef<LayoutDragComponent> beanDef) {\n                return true;\n            }\n        };\n    }\n\n    public static class LayoutDragComponentMock implements LayoutDragComponent {\n\n        @Override\n        public String getDragComponentTitle() {\n            return null;\n        }\n\n        @Override\n        public IsWidget getPreviewWidget(RenderingContext ctx) {\n            return null;\n        }\n\n        @Override\n        public IsWidget getShowWidget(RenderingContext ctx) {\n            return null;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/infra/LayoutEditorCssHelperTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.layout.editor.api.css.CssAllowedValue;\nimport org.uberfire.ext.layout.editor.api.css.CssFontSize;\nimport org.uberfire.ext.layout.editor.api.css.CssProperty;\nimport org.uberfire.ext.layout.editor.api.css.CssValue;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport static org.mockito.Mockito.*;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class LayoutEditorCssHelperTest {\n\n    private LayoutEditorCssHelper cssHelper;\n\n    @Before\n    public void setup() {\n        cssHelper = spy(new LayoutEditorCssHelper());\n    }\n\n    @Test\n    public void testReadFromMap() {\n        Map<String,String> properties = new HashMap<>();\n        properties.put(CssProperty.MARGIN_TOP.getName(), \"100px\");\n        properties.put(\"prop1\", \"v1\");\n        List<CssValue> cssValueList = cssHelper.readCssValues(properties);\n\n        assertEquals(cssValueList.size(), 1);\n        assertEquals(cssValueList.get(0).getProperty(), \"margin-top\");\n        assertEquals(cssValueList.get(0).getValue(), \"100px\");\n    }\n\n    @Test\n    public void testParseAllowedValue() {\n        when(cssHelper.formatCssAllowedValue(CssProperty.FONT_SIZE, CssFontSize.XX_LARGE)).thenReturn(\"Extra Large\");\n        CssAllowedValue cssAllowedValue = cssHelper.parseCssAllowedValue(CssProperty.FONT_SIZE, \"Extra Large\");\n        assertEquals(cssAllowedValue.getName(), \"xx-large\");\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/infra/LayoutEditorFocusControllerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport elemental2.dom.CSSStyleDeclaration;\nimport elemental2.dom.HTMLElement;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LayoutEditorFocusControllerTest {\n    \n    LayoutEditorFocusController controller = new LayoutEditorFocusController();\n\n    @Test\n    public void noScrollableParentTest() {\n        HTMLElement element = mock(HTMLElement.class);\n        element.style = mock(CSSStyleDeclaration.class);\n        \n        HTMLElement foundScrollParent = controller.findScrollableParent(element);\n        assertNull(foundScrollParent);\n    }\n    \n    @Test\n    public void withScrollableParentTest() {\n        HTMLElement scrollParent = mock(HTMLElement.class);\n        HTMLElement element = mock(HTMLElement.class);\n        CSSStyleDeclaration style = mock(CSSStyleDeclaration.class);\n        \n        style.overflow = \"auto\";\n        scrollParent.style = style;\n        element.parentNode = scrollParent;\n        element.style = mock(CSSStyleDeclaration.class);\n        \n        HTMLElement foundScrollParent = controller.findScrollableParent(element);\n        assertEquals(scrollParent, foundScrollParent);\n    }\n    \n    @Test\n    public void scrollRecoveryTest() {\n        final int initialScrollLeft = -1;\n        final int initialScrollTop = -5;\n        HTMLElement element = mock(HTMLElement.class);\n        \n        controller.setScrollableElement(element);\n        element.scrollLeft = initialScrollLeft;\n        element.scrollTop = initialScrollTop;\n        \n        controller.recordFocus();\n        assertTrue(controller.isDirty());\n        \n        element.scrollLeft = 0;\n        element.scrollTop = 0;\n\n        controller.restoreFocus();\n        assertFalse(controller.isDirty());\n        assertEquals(initialScrollLeft, element.scrollLeft, 0.001);\n        assertEquals(initialScrollTop, element.scrollTop, 0.001);\n    }\n    \n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/infra/UniqueIDGeneratorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.layout.editor.client.infra;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class UniqueIDGeneratorTest {\n\n    private UniqueIDGenerator idGenerator;\n\n    @Before\n    public void setup() {\n        idGenerator = new UniqueIDGenerator();\n    }\n\n    @Test\n    public void testCreateAccordionID() {\n        String accordionID = \"accordionID\";\n        String accordionID1 = idGenerator.createAccordionID(accordionID);\n        String accordionID2 = idGenerator.createAccordionID(accordionID);\n        assertNotEquals(accordionID,\n                        accordionID2);\n        assertNotEquals(accordionID1,\n                        accordionID2);\n    }\n\n    @Test\n    public void testCreateAccordionIDShouldRemoveSpaces() {\n        String accordionID = \"accordionID\";\n        String accordionID1 = idGenerator.createAccordionID(accordionID);\n        assertTrue(accordionID1.contains(accordionID));\n\n        accordionID = \"accordion ID\";\n        accordionID1 = idGenerator.createAccordionID(accordionID);\n        assertTrue(!accordionID1.contains(accordionID));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/TestLayoutComponentPaletteGroupProvider.java",
    "content": "package org.uberfire.ext.layout.editor.client.test;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\n\npublic abstract class TestLayoutComponentPaletteGroupProvider implements LayoutComponentPaletteGroupProvider {\n\n    private String name;\n    private boolean defaultExpanded;\n\n    private Map<String, LayoutDragComponent> components = new HashMap<>();\n\n    public TestLayoutComponentPaletteGroupProvider(String name) {\n        this(name, false);\n    }\n\n    public TestLayoutComponentPaletteGroupProvider(String name, boolean defaultExpanded) {\n        this.name = name;\n        this.defaultExpanded = defaultExpanded;\n\n        getTestComponents().stream().forEach(component -> components.put(component.getIdentifier(), component));\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public LayoutDragComponentGroup getComponentGroup() {\n\n        LayoutDragComponentGroup group = new LayoutDragComponentGroup(name, defaultExpanded);\n        group.getComponents().putAll(components);\n\n        return group;\n    }\n\n    protected abstract Collection<TestLayoutDragComponent> getTestComponents();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/TestLayoutDragComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\npublic abstract class TestLayoutDragComponent implements LayoutDragComponent {\n\n    private String identifier;\n\n    public TestLayoutDragComponent(String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return null;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories(LayoutComponent layoutComponent) {\n        return null;\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return null;\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        return null;\n    }\n\n    @Override\n    public void removeCurrentWidget(RenderingContext ctx) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group1/Group1LayoutComponentPaletteGroupProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group1;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group1LayoutComponentPaletteGroupProvider extends TestLayoutComponentPaletteGroupProvider {\n\n    public static final String ID = \"Group1\";\n\n    public Group1LayoutComponentPaletteGroupProvider() {\n        super(ID);\n    }\n\n    public Group1LayoutComponentPaletteGroupProvider(boolean defaultExpanded) {\n        super(ID, defaultExpanded);\n    }\n\n    @Override\n    protected Collection<TestLayoutDragComponent> getTestComponents() {\n        return Arrays.asList(new Group1LayoutDragComponent1(), new Group1LayoutDragComponent2(), new Group1LayoutDragComponent3());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group1/Group1LayoutDragComponent1.java",
    "content": "package org.uberfire.ext.layout.editor.client.test.group1;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group1LayoutDragComponent1 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group1Component1\";\n\n    public Group1LayoutDragComponent1() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group1/Group1LayoutDragComponent2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group1;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group1LayoutDragComponent2 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group1Component2\";\n\n    public Group1LayoutDragComponent2() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group1/Group1LayoutDragComponent3.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group1;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group1LayoutDragComponent3 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group1Component3\";\n\n    public Group1LayoutDragComponent3() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group2/Group2LayoutComponentPaletteGroupProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group2;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group2LayoutComponentPaletteGroupProvider extends TestLayoutComponentPaletteGroupProvider {\n\n    public static final String ID = \"Group2\";\n\n    public Group2LayoutComponentPaletteGroupProvider() {\n        super(ID);\n    }\n\n    public Group2LayoutComponentPaletteGroupProvider(boolean defaultExpanded) {\n        super(ID, defaultExpanded);\n    }\n\n    @Override\n    protected Collection<TestLayoutDragComponent> getTestComponents() {\n        return Arrays.asList(new Group2LayoutDragComponent1(), new Group2LayoutDragComponent2());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group2/Group2LayoutDragComponent1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group2;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group2LayoutDragComponent1 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group2Component1\";\n\n    public Group2LayoutDragComponent1() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group2/Group2LayoutDragComponent2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group2;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group2LayoutDragComponent2 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group2Component2\";\n\n    public Group2LayoutDragComponent2() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group3/Group3LayoutComponentPaletteGroupProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group3;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group3LayoutComponentPaletteGroupProvider extends TestLayoutComponentPaletteGroupProvider {\n\n    public static final String ID = \"Group3\";\n\n    public Group3LayoutComponentPaletteGroupProvider() {\n        super(ID);\n    }\n\n    public Group3LayoutComponentPaletteGroupProvider(boolean defaultExpanded) {\n        super(ID, defaultExpanded);\n    }\n\n    @Override\n    protected Collection<TestLayoutDragComponent> getTestComponents() {\n        return Arrays.asList(new Group3LayoutDragComponent1());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/java/org/uberfire/ext/layout/editor/client/test/group3/Group3LayoutDragComponent1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.layout.editor.client.test.group3;\n\nimport org.uberfire.ext.layout.editor.client.test.TestLayoutDragComponent;\n\npublic class Group3LayoutDragComponent1 extends TestLayoutDragComponent {\n\n    public static final String ID = \"Group3Component1\";\n\n    public Group3LayoutDragComponent1() {\n        super(ID);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/columnWithComponentsLayout.txt",
    "content": "{\n  \"version\": 2,\n  \"name\": \"test2\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {},\n  \"rows\": [\n    {\n      \"height\": \"6\",\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"4\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"Add your HTML here...\"\n                      }\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"4\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"Add your HTML here...\"\n                      }\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"4\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"Add your HTML here...\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    },\n    {\n      \"height\": \"6\",\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/fullLayoutFluid.txt",
    "content": "{\n  \"version\": 3,\n  \"name\": \"A\",\n  \"style\": \"FLUID\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"a|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"8\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"AppsHomePresenter\"\n              }\n            }\n          ]\n        },\n        {\n          \"span\": \"4\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"properties\": {},\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTML\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"c\"\n                      }\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n                      \"properties\": {\n                        \"c\": \"c\",\n                        \"Place Name\": \"AnotherScreen\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    },\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"DoraScreen\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/fullLayoutPage.txt",
    "content": "{\n  \"version\": 3,\n  \"name\": \"A\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"a|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"8\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"8\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"AppsHomePresenter\"\n              }\n            }\n          ]\n        },\n        {\n          \"span\": \"4\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"properties\": {},\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTML\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"c\"\n                      }\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n                      \"properties\": {\n                        \"c\": \"c\",\n                        \"Place Name\": \"AnotherScreen\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    },\n    {\n      \"height\": \"4\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"DoraScreen\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/sampleFullFluidLayout.txt",
    "content": "{\n  \"version\": 3,\n  \"name\": \"A\",\n  \"style\": \"FLUID\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"A|B|C|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"4\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"1\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"2\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"HelloWorldScreen\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"3\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"2\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"3\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"HomeScreen3\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"3\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"3\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"3\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"4\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"6\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"properties\": {},\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"12\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"5\"\n                      },\n                      \"parts\": []\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"12\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"6\"\n                      },\n                      \"parts\": []\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    },\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"7\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"height\": \"12\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n              \"properties\": {\n                \"Place Name\": \"BPMN Explorer\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/sampleFullPageLayout.txt",
    "content": "{\n  \"version\": 3,\n  \"name\": \"CV\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"a|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"2\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              },\n              \"parts\": []\n            }\n          ]\n        }\n      ]\n    },\n    {\n      \"height\": \"10\",\n      \"properties\": {},\n      \"layoutColumns\": [\n        {\n          \"span\": \"4\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              },\n              \"parts\": []\n            }\n          ]\n        },\n        {\n          \"span\": \"8\",\n          \"height\": \"12\",\n          \"properties\": {},\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"properties\": {},\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"3\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivDragComponent\",\n                      \"properties\": {\n                        \"ID_PARAMETER\": \"-110184430\"\n                      },\n                      \"parts\": []\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"3\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"Add your HTML here...\"\n                      },\n                      \"parts\": []\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"properties\": {},\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n                      \"properties\": {\n                        \"Place Name\": \"AppsHomePresenter\"\n                      },\n                      \"parts\": []\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/singleRowComponentLayout.txt",
    "content": "{\n  \"version\": 1,\n  \"name\": \"AA\",\n  \"layoutProperties\": {},\n  \"rows\": [\n    {\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/singleRowComponentLayoutWithParts.txt",
    "content": "{\n  \"version\": 1,\n  \"name\": \"AA\",\n  \"layoutProperties\": {},\n  \"rows\": [\n    {\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              },\n              \"parts\": [\n                  {\n                    \"partId\": \"PART1\",\n                    \"cssProperties\": {\n                      \"PROP1\": \"PROP1_VAL\",\n                      \"PROP2\": \"PROP2_VAL\"\n                    }\n                  },\n                  {\n                    \"partId\": \"PART2\",\n                    \"cssProperties\": {\n                        \"PROP1\": \"PROP1_VAL\"\n                    }\n                  }\n                ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-layout-editor/uberfire-layout-editor-client/src/test/resources/org/uberfire/ext/layout/editor/client/singleRowTwoComponentsLayout.txt",
    "content": "{\n  \"version\": 1,\n  \"name\": \"AA\",\n  \"layoutProperties\": {},\n  \"rows\": [\n    {\n      \"layoutColumns\": [\n        {\n          \"span\": \"6\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n              \"properties\": {\n                \"HTML_CODE\": \"Add your HTML here...\"\n              }\n            }\n          ]\n        },\n        {\n                  \"span\": \"6\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent\",\n                      \"properties\": {\n                        \"HTML_CODE\": \"Add your HTML here...\"\n                      }\n                    }\n                  ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-metadata</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Metadata</name>\n\n  <modules>\n    <module>uberfire-metadata-api</module>\n    <module>uberfire-metadata-backends</module>\n    <module>uberfire-metadata-commons-io</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-metadata</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-metadata-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Metadata API</name>\n  <description>Uberfire Metadata API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-core</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/MetadataConfig.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata;\n\nimport org.uberfire.commons.lifecycle.PriorityDisposable;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.ext.metadata.search.SearchIndex;\n\npublic interface MetadataConfig extends PriorityDisposable {\n\n    IndexProvider getIndexProvider();\n\n    SearchIndex getSearchIndex();\n\n    MetaIndexEngine getIndexEngine();\n\n    MetaModelStore getMetaModelStore();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/BatchIndexListener.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.engine;\n\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Listener that will be notified when the indexing of a project starts or finishes\n */\npublic interface BatchIndexListener {\n\n    /**\n     * Method that will be called to notify that the indexing has started.\n     * @param kCluster the KCluster that's going to be indexed\n     * @param path the path of the project to be indexed\n     */\n    void notifyIndexIngStarted(KCluster kCluster, Path path);\n\n    /**\n     * Method that will be called to notify that the indexing has finished.\n     * @param kCluster the KCluster that's been indexed\n     * @param path the path of the indexed project\n     */\n    void notifyIndexIngFinished(KCluster kCluster, Path path);\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/Index.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.engine;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.model.KCluster;\n\npublic interface Index extends Disposable {\n\n    KCluster getCluster();\n\n    boolean freshIndex();\n\n    void commit();\n\n    void delete();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/IndexManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.engine;\n\nimport java.util.List;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObjectKey;\n\npublic interface IndexManager extends Disposable {\n\n    boolean contains(final KCluster cluster);\n\n    Index indexOf(final KObjectKey object);\n\n    KCluster kcluster(final KObjectKey object);\n\n    void delete(final KCluster cluster);\n\n    Index get(final KCluster cluster);\n\n    List<String> getIndices();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/Indexer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.engine;\n\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.java.nio.file.Path;\n\npublic interface Indexer {\n\n    /**\n     * Different Indexers can handle different file-types\n     * @param path\n     * @return\n     */\n    boolean supportsPath(final Path path);\n\n    /**\n     * Index file represented by Path into an index object\n     * @param path\n     * @return\n     */\n    KObject toKObject(final Path path);\n\n    /**\n     * Index file represented by Path into an index key object\n     * @param path\n     * @return\n     */\n    KObjectKey toKObjectKey(final Path path);\n\n    /**\n     * @return An unique identifier for this indexer. Must not be null.\n     */\n    default String getIndexerId() {\n        return this.getClass().getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/IndexerScheduler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.engine;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutorService;\nimport java.util.function.Supplier;\nimport java.util.stream.Stream;\n\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.metadata.event.IndexEvent;\n\n/**\n * Schedule {@link Indexer} jobs, typically in a multi-threaded way using an {@link ExecutorService}.\n */\npublic interface IndexerScheduler {\n    interface Factory {\n        /**\n         * @param jobsByIndexerId A map of jobs to run by their {@link Indexer} id. Must not be null.\n         * @return An {@link IndexerScheduler} for scheduling execution of the given jobs. Never null.\n         */\n        IndexerScheduler create(Map<String, ? extends Supplier<List<IndexEvent>>> jobsByIndexerId);\n    }\n\n    /**\n     * @param executor An {@link ExecutorService} used for scheduling any asynchronous jobs. Must not be null.\n     * @return A stream of {@link CompletableFuture CompletableFutures} for all jobs scheduled. Never null.\n     *          Note that just because a {@link CompletableFuture} is returned for a job, that does not mean\n     *          the job has been scheduled yet. The scheduler is free to start jobs or terminate them with exceptions\n     *          as it deems appropriate.\n     */\n    Stream<CompletableFuture<Pair<String, List<IndexEvent>>>> schedule(ExecutorService executor);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/MetaIndexEngine.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.engine;\n\nimport org.uberfire.commons.lifecycle.PriorityDisposable;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\n\npublic interface MetaIndexEngine extends PriorityDisposable {\n\n    String FULL_TEXT_FIELD = \"fullText\";\n\n    boolean freshIndex(final KCluster cluster);\n\n    boolean isIndexReady(final KCluster cluster, final String indexerId);\n\n    void prepareBatch(final KCluster cluster);\n\n    void startBatch(final KCluster cluster);\n\n    void index(final KObject object);\n\n    void rename(final KObjectKey from,\n                final KObject to);\n\n    void delete(final KCluster cluster);\n\n    void delete(final KObjectKey objectKey);\n\n    void commit(final KCluster cluster, final String indexerId);\n\n    void abort(final KCluster cluster);\n\n    void beforeDispose(final Runnable callback);\n\n    boolean isAlive();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/MetaModelStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.engine;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\n\n/**\n *\n */\npublic interface MetaModelStore extends Disposable {\n\n    void add(MetaObject metaObject);\n\n    void update(final MetaObject metaObject);\n\n    MetaObject getMetaObject(final String type);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/engine/Observer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.engine;\n\n/**\n * Observers are notified by the Index Engine of activity\n */\npublic interface Observer {\n\n    /**\n     * Information message\n     * @param message\n     */\n    void information(final String message);\n\n    /**\n     * Warning message\n     * @param message\n     */\n    void warning(final String message);\n\n    /**\n     * Error message\n     * @param message\n     */\n    void error(final String message);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/event/BatchIndexEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.event;\n\nimport java.util.List;\n\nimport org.uberfire.ext.metadata.model.KObject;\n\n/**\n * <p>\n * An event fired when a batch of {@link KObject KObjects} has been indexed by an indexer.\n *\n * <p>\n * Items should be available for lookup when this item is observed.\n */\npublic class BatchIndexEvent {\n\n    private final List<IndexEvent> events;\n    private final String indexerId;\n\n    public BatchIndexEvent(String indexerId, List<IndexEvent> events) {\n        this.indexerId = indexerId;\n        this.events = events;\n    }\n\n    public List<IndexEvent> getIndexEvents() {\n        return events;\n    }\n\n    public String getIndexerId() {\n        return indexerId;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/event/IndexEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.event;\n\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\n\npublic abstract class IndexEvent {\n\n    private final Kind kind;\n\n    private IndexEvent(Kind kind) {\n        this.kind = kind;\n    }\n\n    public Kind getKind() {\n        return kind;\n    }\n\n    public static enum Kind {\n        NewlyIndexed, Renamed, Deleted\n    }\n\n    public static class NewlyIndexedEvent extends IndexEvent {\n        private final KObject kObject;\n\n        public NewlyIndexedEvent(KObject kObject) {\n            super(Kind.NewlyIndexed);\n            this.kObject = kObject;\n        }\n\n        public KObject getKObject() {\n            return kObject;\n        }\n    }\n\n    public static class RenamedEvent extends IndexEvent {\n        private final KObjectKey source;\n        private final KObject target;\n\n        public RenamedEvent(KObjectKey source, KObject target) {\n            super(Kind.Renamed);\n            this.source = source;\n            this.target = target;\n        }\n\n        public KObjectKey getSource() {\n            return source;\n        }\n\n        public KObject getTarget() {\n            return target;\n        }\n    }\n\n    public static class DeletedEvent extends IndexEvent {\n        private final KObjectKey deleted;\n\n        public DeletedEvent(KObjectKey deleted) {\n            super(Kind.Deleted);\n            this.deleted = deleted;\n        }\n\n        public KObjectKey getDeleted() {\n            return deleted;\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/metamodel/InMemoryMetaModelStore.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.metamodel;\n\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\n\n/**\n *\n */\npublic class InMemoryMetaModelStore implements MetaModelStore {\n\n    private final ConcurrentHashMap<String, MetaObject> metaModel = new ConcurrentHashMap<String, MetaObject>();\n\n    @Override\n    public void add(final MetaObject metaObject) {\n        metaModel.put(metaObject.getType().getName(),\n                      metaObject);\n    }\n\n    @Override\n    public void update(final MetaObject metaObject) {\n        metaModel.put(metaObject.getType().getName(),\n                      metaObject);\n    }\n\n    @Override\n    public MetaObject getMetaObject(final String type) {\n        return metaModel.get(type);\n    }\n\n    @Override\n    public void dispose() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/metamodel/MetaModelBuilder.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.metamodel;\n\nimport java.util.HashSet;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.concurrent.CopyOnWriteArraySet;\nimport java.util.stream.StreamSupport;\n\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.impl.MetaObjectImpl;\nimport org.uberfire.ext.metadata.model.impl.MetaPropertyImpl;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.model.schema.MetaProperty;\n\npublic class MetaModelBuilder {\n\n    private final MetaModelStore metaModelStore;\n\n    public MetaModelBuilder(MetaModelStore metaModelStore) {\n        this.metaModelStore = metaModelStore;\n    }\n\n    public void updateMetaModel(final KObject object) {\n        final MetaObject metaObject = metaModelStore.getMetaObject(object.getType().getName());\n        if (metaObject == null) {\n            metaModelStore.add(newMetaObject(object));\n        } else {\n            Optional.ofNullable(object.getProperties())\n                    .ifPresent(kProperties -> {\n                        for (final KProperty property : object.getProperties()) {\n                            final Optional<MetaProperty> metaProperty = metaObject.getProperty(property.getName());\n                            if (!metaProperty.isPresent()) {\n                                metaObject.addProperty(newMetaProperty(property));\n                            } else {\n                                metaProperty.get().addType(property.getValue().getClass());\n                                if (property.isSearchable()) {\n                                    metaProperty.get().setAsSearchable();\n                                }\n                            }\n                        }\n                        metaModelStore.update(metaObject);\n                    });\n        }\n    }\n\n    public MetaObject newMetaObject(final KObject object) {\n        final Set<MetaProperty> properties = new HashSet<>();\n\n        Optional.ofNullable(object.getProperties()).ifPresent(kProperties ->\n                                                                      StreamSupport.stream(kProperties.spliterator(),\n                                                                                           false).forEach(property ->\n                                                                                                                  properties.add(newMetaProperty(property))));\n        return new MetaObjectImpl(object.getType(),\n                                  properties);\n    }\n\n    private MetaProperty newMetaProperty(final KProperty<?> property) {\n\n        Set<Class<?>> types = new CopyOnWriteArraySet<Class<?>>() {{\n            add(property.getValue().getClass());\n        }};\n\n        return new MetaPropertyImpl(property.getName(),\n                                    property.isSearchable(),\n                                    property.isSortable(),\n                                    types);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/metamodel/NullMetaModelStore.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.metamodel;\n\nimport java.util.Collections;\n\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.model.impl.MetaObjectImpl;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\n\npublic class NullMetaModelStore implements MetaModelStore {\n\n    private static MetaObject EMPTY = new MetaObjectImpl(() -> \"\",\n                                                         Collections.EMPTY_SET);\n\n    @Override\n    public void add(final MetaObject metaObject) {\n    }\n\n    @Override\n    public void update(final MetaObject metaObject) {\n    }\n\n    @Override\n    public MetaObject getMetaObject(final String type) {\n        return EMPTY;\n    }\n\n    @Override\n    public void dispose() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KCluster.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\npublic interface KCluster {\n\n    String getClusterId();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KObject.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\nimport java.io.Serializable;\n\npublic interface KObject extends KObjectKey,\n                                 PropertyBag,\n                                 Serializable {\n\n    /**\n     * Flag indicating whether a \"full text\" entry should be created for the KObject.\n     * This should be true for \"default indexing\", i.e. that supported out of the box; however\n     * additional indexers should not create additional \"full text\" entries.\n     * @return\n     * @see org.uberfire.ext.metadata.engine.MetaIndexEngine#FULL_TEXT_FIELD\n     * @see org.uberfire.ext.metadata.engine.Indexer\n     */\n    boolean fullText();\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KObjectId.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\npublic interface KObjectId {\n\n    String getId();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KObjectKey.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\nimport org.uberfire.ext.metadata.model.schema.MetaType;\n\npublic interface KObjectKey extends KObjectSimpleKey,\n                                    KObjectId {\n\n    MetaType getType();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KObjectSimpleKey.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\npublic interface KObjectSimpleKey {\n\n    String getClusterId();\n\n    String getSegmentId();\n\n    String getKey();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/KProperty.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\npublic interface KProperty<T extends Object> {\n\n    String getName();\n\n    T getValue();\n\n    boolean isSearchable();\n\n    default boolean isSortable() {\n        return false;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/PropertyBag.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model;\n\ninterface PropertyBag {\n\n    Iterable<KProperty<?>> getProperties();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/impl/KObjectImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.impl;\n\nimport java.util.List;\n\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\n\npublic class KObjectImpl implements KObject {\n\n    private String id;\n    private String type;\n    private String clusterId;\n    private String segmentId;\n    private String key;\n    private List<KProperty<?>> properties;\n    private boolean fullText;\n\n    public KObjectImpl(String id,\n                       String type,\n                       String clusterId,\n                       String segmentId,\n                       String key,\n                       List<KProperty<?>> properties,\n                       boolean fullText) {\n        this.id = id;\n        this.type = type;\n        this.clusterId = clusterId;\n        this.segmentId = segmentId;\n        this.key = key;\n        this.properties = properties;\n        this.fullText = fullText;\n    }\n\n    @Override\n    public boolean fullText() {\n        return this.fullText;\n    }\n\n    @Override\n    public String getId() {\n        return this.id;\n    }\n\n    @Override\n    public MetaType getType() {\n        return () -> this.type;\n    }\n\n    @Override\n    public String getClusterId() {\n        return this.clusterId;\n    }\n\n    @Override\n    public String getSegmentId() {\n        return this.segmentId;\n    }\n\n    @Override\n    public String getKey() {\n        return this.key;\n    }\n\n    @Override\n    public Iterable<KProperty<?>> getProperties() {\n        return this.properties;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/impl/KObjectKeyImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.impl;\n\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\n\npublic class KObjectKeyImpl implements KObjectKey {\n\n    private String key;\n    private String id;\n    private MetaType type;\n    private String clusterId;\n    private String segmentId;\n\n    public KObjectKeyImpl(String key,\n                          String id,\n                          String type,\n                          String clusterId,\n                          String segmentId) {\n        this.key = key;\n        this.id = id;\n        this.type = () -> type;\n        this.clusterId = clusterId;\n        this.segmentId = segmentId;\n    }\n\n    @Override\n    public String getId() {\n        return this.id;\n    }\n\n    @Override\n    public MetaType getType() {\n        return this.type;\n    }\n\n    @Override\n    public String getClusterId() {\n        return this.clusterId;\n    }\n\n    @Override\n    public String getSegmentId() {\n        return this.segmentId;\n    }\n\n    @Override\n    public String getKey() {\n        return this.key;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/impl/KPropertyImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.impl;\n\nimport org.uberfire.ext.metadata.model.KProperty;\n\npublic class KPropertyImpl<T> implements KProperty<T> {\n\n    private String name;\n    private T value;\n    private boolean searchable;\n\n    public KPropertyImpl(String name,\n                         T value,\n                         boolean searchable) {\n        this.name = name;\n        this.value = value;\n        this.searchable = searchable;\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n\n    @Override\n    public T getValue() {\n        return this.value;\n    }\n\n    @Override\n    public boolean isSearchable() {\n        return this.searchable;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/impl/MetaObjectImpl.java",
    "content": "package org.uberfire.ext.metadata.model.impl;\n\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.model.schema.MetaProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\n\npublic class MetaObjectImpl implements MetaObject {\n\n    private final MetaType metaType;\n    private final ConcurrentHashMap<String, MetaProperty> properties;\n\n    public MetaObjectImpl(MetaType metaType,\n                          Set<MetaProperty> properties) {\n        this.metaType = metaType;\n\n        if (properties == null) {\n            this.properties = new ConcurrentHashMap<>();\n        } else {\n            this.properties = toHashMap(properties);\n        }\n    }\n\n    private ConcurrentHashMap<String, MetaProperty> toHashMap(Set<MetaProperty> properties) {\n        ConcurrentHashMap<String, MetaProperty> map = new ConcurrentHashMap<>();\n        if (properties != null) {\n            properties.forEach(metaProperty -> map.put(metaProperty.getName(),\n                                                       metaProperty));\n        }\n        return map;\n    }\n\n    @Override\n    public MetaType getType() {\n        return this.metaType;\n    }\n\n    @Override\n    public Collection<MetaProperty> getProperties() {\n        return this.properties.values();\n    }\n\n    @Override\n    public Optional<MetaProperty> getProperty(String name) {\n        return Optional.ofNullable(this.properties.get(name));\n    }\n\n    @Override\n    public void addProperty(MetaProperty metaProperty) {\n        this.properties.put(metaProperty.getName(),\n                            metaProperty);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/impl/MetaPropertyImpl.java",
    "content": "package org.uberfire.ext.metadata.model.impl;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.uberfire.ext.metadata.model.schema.MetaProperty;\n\npublic class MetaPropertyImpl implements MetaProperty {\n\n    private final String name;\n    private boolean searchable;\n    private boolean sortable;\n    private final Set<Class<?>> types;\n\n    public MetaPropertyImpl(String name,\n                            boolean searchable,\n                            boolean sortable,\n                            Set<Class<?>> types) {\n\n        this.name = name;\n        this.searchable = searchable;\n        this.sortable = sortable;\n        if (types == null) {\n            this.types = new HashSet<>();\n        } else {\n            this.types = types;\n        }\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n\n    @Override\n    public Set<Class<?>> getTypes() {\n        return types;\n    }\n\n    @Override\n    public boolean isSearchable() {\n        return this.searchable;\n    }\n\n    @Override\n    public void setAsSearchable() {\n        this.searchable = true;\n    }\n\n    @Override\n    public boolean isSortable() {\n        return this.sortable;\n    }\n\n    @Override\n    public void setAsSortable() {\n        this.sortable = true;\n    }\n\n    @Override\n    public void addType(final Class<?> type) {\n        types.add(type);\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (obj == null) {\n            return false;\n        }\n        if (!(obj instanceof MetaProperty)) {\n            return false;\n        }\n        return ((MetaProperty) obj).getName().equals(getName());\n    }\n\n    @Override\n    public int hashCode() {\n        return getName().hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/schema/MetaObject.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.schema;\n\nimport java.util.Collection;\nimport java.util.Optional;\n\n/**\n *\n */\npublic interface MetaObject {\n\n    String META_OBJECT_ID = \"id\";\n    String META_OBJECT_CLUSTER_ID = \"cluster.id\";\n    String META_OBJECT_TYPE = \"type\";\n    String META_OBJECT_KEY = \"key\";\n    String META_OBJECT_SEGMENT_ID = \"segment.id\";\n    String META_OBJECT_FULL_TEXT = \"fullText\";\n\n    MetaType getType();\n\n    Collection<MetaProperty> getProperties();\n\n    Optional<MetaProperty> getProperty(final String name);\n\n    void addProperty(final MetaProperty metaProperty);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/schema/MetaProperty.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.schema;\n\nimport java.util.Set;\n\n/**\n *\n */\npublic interface MetaProperty {\n\n    String getName();\n\n    Set<Class<?>> getTypes();\n\n    boolean isSearchable();\n\n    void setAsSearchable();\n\n    boolean isSortable();\n\n    void setAsSortable();\n\n    void addType(final Class<?> aClass);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/model/schema/MetaType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.model.schema;\n\npublic interface MetaType {\n\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/provider/IndexProvider.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.provider;\n\nimport java.io.IOException;\nimport java.util.List;\n\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.Sort;\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\n\npublic interface IndexProvider extends Disposable {\n\n    boolean isFreshIndex(final KCluster cluster);\n\n    void index(KObject object);\n\n    void index(List<KObject> elements);\n\n    boolean exists(String index,\n                   String id);\n\n    void delete(String index);\n\n    void delete(String index,\n                String id);\n\n    List<KObject> findById(String index,\n                           String id) throws IOException;\n\n    void rename(String index,\n                String id,\n                KObject to);\n\n    long getIndexSize(String index);\n\n    List<KObject> findByQuery(List<String> indices,\n                              Query query,\n                              int limit);\n\n    List<KObject> findByQuery(List<String> indices,\n                              Query query,\n                              Sort sort,\n                              int limit);\n\n    long findHitsByQuery(List<String> indices,\n                         Query query);\n\n    List<String> getIndices();\n\n    void observerInitialization(Runnable runnable);\n\n    boolean isAlive();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/search/ClusterSegment.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.search;\n\n/**\n *\n */\npublic interface ClusterSegment {\n\n    String getClusterId();\n\n    String[] segmentIds();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/search/DateRange.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.search;\n\nimport java.util.Date;\n\n/**\n *\n */\npublic interface DateRange {\n\n    Date before();\n\n    Date after();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/search/IOSearchService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.search;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.java.nio.file.Path;\n\npublic interface IOSearchService {\n\n    List<Path> searchByAttrs(final Map<String, ?> attrs,\n                             final Filter filter,\n                             final Path... roots);\n\n    List<Path> fullTextSearch(final String term,\n                              final Filter filter,\n                              final Path... roots);\n\n    int searchByAttrsHits(final Map<String, ?> attrs,\n                          final Path... roots);\n\n    int fullTextSearchHits(final String term,\n                           final Path... roots);\n\n    interface Filter {\n\n        boolean accept(final KObject kObject);\n    }\n\n    class NoOpFilter implements Filter {\n\n        @Override\n        public boolean accept(final KObject kObject) {\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-api/src/main/java/org/uberfire/ext/metadata/search/SearchIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.search;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.ext.metadata.model.KObject;\n\n/**\n *\n */\npublic interface SearchIndex {\n\n    List<KObject> searchByAttrs(final Map<String, ?> attrs,\n                                final IOSearchService.Filter filter,\n                                final ClusterSegment... clusterSegments);\n\n    List<KObject> fullTextSearch(final String term,\n                                 final IOSearchService.Filter filter,\n                                 final ClusterSegment... clusterSegments);\n\n    int searchByAttrsHits(final Map<String, ?> attrs,\n                          final ClusterSegment... clusterSegments);\n\n    int fullTextSearchHits(final String term,\n                           final ClusterSegment... clusterSegments);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-metadata</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-metadata-backends</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Metadata Backends</name>\n\n  <modules>\n    <module>uberfire-metadata-backend-lucene</module>\n    <module>uberfire-metadata-backend-infinispan</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-metadata-backends</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <modelVersion>4.0.0</modelVersion>\n  <packaging>jar</packaging>\n\n  <artifactId>uberfire-metadata-backend-infinispan</artifactId>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-core</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-analyzers-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-backward-codecs</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-queryparser</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-misc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan</groupId>\n      <artifactId>infinispan-query-dsl</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan</groupId>\n      <artifactId>infinispan-remote-query-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan</groupId>\n      <artifactId>infinispan-client-hotrod</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan</groupId>\n      <artifactId>infinispan-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan.protostream</groupId>\n      <artifactId>protostream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-api-mockito2</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-module-junit4</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.arquillian.cube</groupId>\n      <artifactId>arquillian-cube-docker-junit-rule</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.shrinkwrap</groupId>\n      <artifactId>shrinkwrap-impl-base</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/InfinispanSearchConfig.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.uberfire.ext.metadata.MetadataConfig;\nimport org.uberfire.ext.metadata.backend.infinispan.provider.InfinispanIndexProvider;\nimport org.uberfire.ext.metadata.backend.infinispan.search.InfinispanSearchIndex;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.ext.metadata.search.SearchIndex;\n\npublic class InfinispanSearchConfig implements MetadataConfig {\n\n    private final InfinispanIndexProvider indexProvider;\n    private final InfinispanSearchIndex searchIndex;\n    private MetaModelStore metaModelStore;\n    private MetaIndexEngine metaIndexEngine;\n\n    public InfinispanSearchConfig(MetaIndexEngine metaIndexEngine,\n                                  InfinispanIndexProvider infinispanIndexProvider,\n                                  MetaModelStore metaModelStore,\n                                  Analyzer analyzer) {\n        this.metaIndexEngine = metaIndexEngine;\n        this.indexProvider = infinispanIndexProvider;\n        this.searchIndex = new InfinispanSearchIndex(infinispanIndexProvider,\n                                                     analyzer);\n        this.metaModelStore = metaModelStore;\n    }\n\n    @Override\n    public IndexProvider getIndexProvider() {\n        return this.indexProvider;\n    }\n\n    @Override\n    public SearchIndex getSearchIndex() {\n        return this.searchIndex;\n    }\n\n    @Override\n    public MetaIndexEngine getIndexEngine() {\n        return this.metaIndexEngine;\n    }\n\n    @Override\n    public MetaModelStore getMetaModelStore() {\n        return metaModelStore;\n    }\n\n    @Override\n    public int priority() {\n        return -20;\n    }\n\n    @Override\n    public void dispose() {\n        this.indexProvider.dispose();\n        this.metaIndexEngine.dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/exceptions/InfinispanException.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.exceptions;\n\npublic class InfinispanException extends RuntimeException {\n\n    public InfinispanException(String message,\n                               Throwable t) {\n        super(message,\n              t);\n    }\n\n    public InfinispanException(String message) {\n        super(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/exceptions/RetryException.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.exceptions;\n\npublic class RetryException extends RuntimeException {\n\n    public RetryException(String message, Throwable t) {\n        super(message, t);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/FieldConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl;\n\npublic interface FieldConverter {\n\n    String convertKey(String key);\n\n    String convertValue(String value);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/FieldConverterImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl;\n\nimport org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil;\n\npublic class FieldConverterImpl implements FieldConverter {\n\n    @Override\n    public String convertKey(String key) {\n        return AttributesUtil.toProtobufFormat(key);\n    }\n\n    @Override\n    public String convertValue(String value) {\n        return value;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/IckleConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.apache.lucene.search.BooleanQuery;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.RegexpQuery;\nimport org.apache.lucene.search.Sort;\nimport org.apache.lucene.search.SortField;\nimport org.apache.lucene.search.TermQuery;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.converters.BooleanQueryConverter;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.converters.RegexpQueryConverter;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.converters.TermQueryConverter;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.converters.WildcardQueryConverter;\n\npublic class IckleConverter {\n\n    private static final String ORDER_BY = \"order by \";\n    private static final String WHERE = \"where \";\n    private static final String ASC = \"ASC\";\n    private static final String DESC = \"DESC\";\n    private Logger logger = LoggerFactory.getLogger(IckleConverter.class);\n\n    private final FieldConverterImpl converterImpl;\n\n    public IckleConverter() {\n        converterImpl = new FieldConverterImpl();\n    }\n\n    public String convert(Query query) {\n        Class<? extends Query> queryClass = query.getClass();\n\n        if (TermQuery.class.isAssignableFrom(queryClass)) {\n            return new TermQueryConverter((TermQuery) query, converterImpl).convert();\n\n        } else if (WildcardQuery.class.isAssignableFrom(queryClass)) {\n            return new WildcardQueryConverter((WildcardQuery) query, converterImpl).convert();\n\n        } else if (BooleanQuery.class.isAssignableFrom(queryClass)) {\n            return new BooleanQueryConverter((BooleanQuery) query, this).convert();\n\n        } else if (RegexpQuery.class.isAssignableFrom(queryClass)) {\n            return new RegexpQueryConverter((RegexpQuery) query).convert();\n        }\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Converter not found, MatchAllDocsQuery will be used\");\n        }\n\n        return \"\";\n    }\n\n    public String convert(Sort sort) {\n\n        if (sort == null || sort.getSort() == null) {\n            return \"\";\n        }\n\n        List<SortField> fields = Arrays.asList(sort.getSort());\n\n        String sortString = fields.stream()\n                .filter(sortField -> sortField.getField() != null)\n                .map(sortField -> {\n                    String key = this.converterImpl.convertKey(sortField.getField());\n                    String sortDirection = ASC;\n                    if (sortField.getReverse()) {\n                        sortDirection = DESC;\n                    }\n                    return key + \" \" + sortDirection;\n                }).collect(Collectors.joining(\",\"));\n\n        return sortString;\n    }\n\n    public String where(Query query) {\n        String queryString = this.convert(query);\n\n        if (queryString.isEmpty()) {\n            return \"\";\n        } else {\n            return WHERE + queryString;\n        }\n    }\n\n    public String sort(Sort sort) {\n\n        String sortString = this.convert(sort);\n\n        if (sortString.isEmpty()) {\n            return \"\";\n        } else {\n            return ORDER_BY + sortString;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/BooleanQueryConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport java.util.Iterator;\n\nimport org.apache.lucene.search.BooleanClause;\nimport org.apache.lucene.search.BooleanQuery;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.IckleConverter;\n\npublic class BooleanQueryConverter implements QueryConverter {\n\n    private BooleanQuery booleanQuery;\n    private IckleConverter icklConverter;\n\n    public BooleanQueryConverter(BooleanQuery booleanQuery,\n                                 IckleConverter icklConverter) {\n        this.booleanQuery = booleanQuery;\n        this.icklConverter = icklConverter;\n    }\n\n    @Override\n    public String convert() {\n        Iterator<BooleanClause> clauses = this.booleanQuery.clauses().iterator();\n\n        StringBuilder queryString = new StringBuilder();\n\n        while (clauses.hasNext()) {\n            BooleanClause clause = clauses.next();\n\n            String queryResult = icklConverter.convert(clause.getQuery());\n\n            if (BooleanQuery.class.isAssignableFrom(clause.getQuery().getClass())) {\n                queryResult = \"(\" + queryResult + \")\";\n            }\n\n            if (clause.isProhibited()) {\n                queryResult = \"NOT \" + queryResult;\n            }\n\n            if (clauses.hasNext()) {\n                String operator = this.getBooleanOperator(clause);\n                queryResult = queryResult + \" \" + operator + \" \";\n            }\n\n            queryString.append(queryResult);\n        }\n\n        return queryString.toString().trim();\n    }\n\n    private String getBooleanOperator(BooleanClause booleanClause) {\n        return booleanClause.isRequired() ? \"AND\" : \"OR\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/QueryConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\npublic interface QueryConverter {\n\n    String convert();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/RegexpQueryConverter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport org.apache.lucene.search.RegexpQuery;\n\npublic class RegexpQueryConverter implements QueryConverter {\n\n    private RegexpQuery regexpQuery;\n\n    public RegexpQueryConverter(RegexpQuery regexpQuery) {\n        this.regexpQuery = regexpQuery;\n    }\n\n    @Override\n    public String convert() {\n        return String.format(\"%s:/%s/\",\n                             regexpQuery.getRegexp().field(),\n                             regexpQuery.getRegexp().text());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/TermQueryConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.apache.commons.lang3.BooleanUtils;\nimport org.apache.commons.lang3.math.NumberUtils;\nimport org.apache.lucene.search.TermQuery;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.FieldConverter;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\n\npublic class TermQueryConverter implements QueryConverter {\n\n    private final TermQuery query;\n    private final FieldConverter fieldConverter;\n    private final List<String> basicAttrs = Arrays.asList(MetaObject.META_OBJECT_ID,\n                                                          MetaObject.META_OBJECT_TYPE,\n                                                          MetaObject.META_OBJECT_CLUSTER_ID,\n                                                          MetaObject.META_OBJECT_SEGMENT_ID,\n                                                          MetaObject.META_OBJECT_KEY);\n\n    public TermQueryConverter(TermQuery query,\n                              FieldConverter fieldConverter) {\n        this.query = query;\n        this.fieldConverter = fieldConverter;\n    }\n\n    @Override\n    public String convert() {\n        String key = this.fieldConverter.convertKey(this.query.getTerm().field());\n        String value = this.fieldConverter.convertValue(this.query.getTerm().text());\n        return key + this.getOperator(this.query.getTerm().field()) + this.convertValue(value);\n    }\n\n    private String getOperator(String key) {\n        return this.basicAttrs.contains(key) ? \"=\" : \":\";\n    }\n\n    private String convertValue(String value) {\n        if (NumberUtils.isNumber(value) || BooleanUtils.toBooleanObject(value) != null) {\n            return value;\n        } else {\n            return \"'\" + value + \"'\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/WildcardQueryConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport org.apache.lucene.search.WildcardQuery;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.FieldConverter;\n\npublic class WildcardQueryConverter implements QueryConverter {\n\n    private final WildcardQuery query;\n    private final FieldConverter fieldConverter;\n\n    public WildcardQueryConverter(WildcardQuery query,\n                                  FieldConverter fieldConverter) {\n        this.query = query;\n        this.fieldConverter = fieldConverter;\n    }\n\n    @Override\n    public String convert() {\n        String key = this.fieldConverter.convertKey(this.query.getTerm().field());\n        String value = this.fieldConverter.convertValue(this.query.getTerm().text());\n        return key + \":\" + \"'\" + value + \"'\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/KObjectMarshaller.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.TreeMap;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.infinispan.protostream.MessageMarshaller;\nimport org.infinispan.protostream.descriptors.Descriptor;\nimport org.infinispan.protostream.descriptors.FieldDescriptor;\nimport org.infinispan.protostream.descriptors.JavaType;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.impl.KObjectImpl;\nimport org.uberfire.ext.metadata.model.impl.KPropertyImpl;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static java.util.stream.Collectors.joining;\nimport static java.util.stream.Collectors.toList;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toKPropertyFormat;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CHECKIN_COMMENT;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CREATED_BY;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CREATED_DATE;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.LAST_MODIFIED_BY;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.LAST_MODIFIED_DATE;\n\npublic class KObjectMarshaller implements MessageMarshaller<KObject> {\n\n    private Logger logger = LoggerFactory.getLogger(KObjectMarshaller.class);\n\n    private static final String CLUSTER_ID = toProtobufFormat(MetaObject.META_OBJECT_CLUSTER_ID);\n    private static final String SEGMENT_ID = toProtobufFormat(MetaObject.META_OBJECT_SEGMENT_ID);\n\n    private String typeName;\n    private final List<String> mainAttributes = Arrays.asList(MetaObject.META_OBJECT_ID,\n                                                              MetaObject.META_OBJECT_TYPE,\n                                                              CLUSTER_ID,\n                                                              SEGMENT_ID,\n                                                              MetaObject.META_OBJECT_KEY,\n                                                              MetaObject.META_OBJECT_FULL_TEXT);\n\n    public KObjectMarshaller(String typeName) {\n\n        this.typeName = typeName;\n    }\n\n    @Override\n    public KObjectImpl readFrom(ProtoStreamReader protoStreamReader) throws IOException {\n\n        Descriptor descriptor = protoStreamReader.getSerializationContext().getMessageDescriptor(this.getTypeName());\n\n        List<KProperty<?>> properties = descriptor.getFields()\n                .stream()\n                .filter(fieldDescriptor ->\n                                isExtension(descriptor.getName())\n                )\n                .map(field -> (KProperty<?>) new KPropertyImpl(toKPropertyFormat(field.getName()),\n                                                               this.read(field,\n                                                                         protoStreamReader),\n                                                               false)\n                )\n                .collect(toList());\n\n        String id = getAndRemove(properties,\n                                 MetaObject.META_OBJECT_ID);\n        String type = getAndRemove(properties,\n                                   MetaObject.META_OBJECT_TYPE);\n        String clusterId = getAndRemove(properties,\n                                        MetaObject.META_OBJECT_CLUSTER_ID);\n        String segmentId = getAndRemove(properties,\n                                        MetaObject.META_OBJECT_SEGMENT_ID);\n        String key = getAndRemove(properties,\n                                  MetaObject.META_OBJECT_KEY);\n        String fullText = getAndRemove(properties,\n                                       MetaObject.META_OBJECT_FULL_TEXT);\n\n        return new KObjectImpl(id,\n                               type,\n                               clusterId,\n                               segmentId,\n                               key,\n                               properties,\n                               !StringUtils.isEmpty(fullText));\n    }\n\n    private String getAndRemove(final List<KProperty<?>> properties,\n                                final String key) {\n        KProperty<?> value = properties.stream().filter(kProperty -> kProperty.getName().equals(key)).findFirst().get();\n        properties.remove(value);\n        return (String) value.getValue();\n    }\n\n    @Override\n    public void writeTo(ProtoStreamWriter protoStreamWriter,\n                        KObject kObject) throws IOException {\n\n        Descriptor descriptor = protoStreamWriter.getSerializationContext().getMessageDescriptor(this.getTypeName());\n\n        TreeMap<Integer, KProperty<?>> props = new TreeMap<>();\n\n        this.addKProperty(props,\n                          descriptor,\n                          MetaObject.META_OBJECT_ID,\n                          kObject.getId());\n        this.addKProperty(props,\n                          descriptor,\n                          MetaObject.META_OBJECT_TYPE,\n                          kObject.getType().getName());\n        this.addKProperty(props,\n                          descriptor,\n                          CLUSTER_ID,\n                          kObject.getClusterId());\n        this.addKProperty(props,\n                          descriptor,\n                          SEGMENT_ID,\n                          kObject.getSegmentId());\n        this.addKProperty(props,\n                          descriptor,\n                          MetaObject.META_OBJECT_KEY,\n                          kObject.getKey());\n\n        kObject.getProperties()\n                .iterator()\n                .forEachRemaining(kprop ->\n                                          Optional.ofNullable(descriptor.findFieldByName(toProtobufFormat(kprop.getName())))\n                                                  .ifPresent(field -> props\n                                                          .putIfAbsent(field.getNumber(),\n                                                                       kprop)));\n\n        if (kObject.fullText()) {\n            this.addKProperty(props,\n                              descriptor,\n                              MetaObject.META_OBJECT_FULL_TEXT,\n                              props.values().stream()\n                                      .filter(kProperty -> kProperty.isSearchable() && !(kProperty.getValue() instanceof Boolean))\n                                      .map(kProperty -> String.valueOf(kProperty.getValue()).toLowerCase())\n                                      .collect(joining(\"\\n\")));\n        }\n\n        props.keySet().forEach((number) -> {\n            try {\n                KProperty<?> kProperty = props.get(number);\n                this.writeField(toProtobufFormat(kProperty.getName()),\n                                kProperty.getValue(),\n                                protoStreamWriter);\n            } catch (IOException e) {\n                logger.error(\"error\",\n                             e);\n            }\n        });\n    }\n\n    @Override\n    public Class<? extends KObjectImpl> getJavaClass() {\n        return KObjectImpl.class;\n    }\n\n    @Override\n    public String getTypeName() {\n        return this.typeName;\n    }\n\n    private void writeField(String name,\n                            Object value,\n                            ProtoStreamWriter writer) throws IOException {\n\n        Class<?> aClass = value.getClass();\n\n        if (Enum.class.isAssignableFrom(aClass)) {\n            writer.writeString(name,\n                               value.toString());\n        }\n        if (aClass == String.class) {\n            writer.writeString(name,\n                               value.toString());\n        }\n        if (aClass == Boolean.class) {\n            writer.writeBoolean(name,\n                                (Boolean) value);\n        }\n\n        if (aClass == Integer.class) {\n            writer.writeInt(name,\n                            (Integer) value);\n        }\n\n        if (aClass == Double.class) {\n            writer.writeDouble(name,\n                               (Double) value);\n        }\n\n        if (aClass == Long.class) {\n            writer.writeLong(name,\n                             (Long) value);\n        }\n\n        if (aClass == Float.class) {\n            writer.writeFloat(name,\n                              (Float) value);\n        }\n\n        if (FileTime.class.isAssignableFrom(aClass)) {\n            writer.writeLong(name,\n                             ((FileTime) value).toMillis());\n        }\n\n        if (Date.class.isAssignableFrom(aClass)) {\n            writer.writeLong(name,\n                             ((Date) value).getTime());\n        }\n\n        if (VersionHistory.class.isAssignableFrom(aClass)) {\n            this.writeField((VersionHistory) value,\n                            writer);\n        }\n\n        if (Collection.class.isAssignableFrom(aClass)) {\n            final StringBuilder sb = new StringBuilder();\n            for (final java.lang.Object oValue : (Collection) value) {\n                sb.append(oValue).append(' ');\n            }\n\n            writer.writeString(name,\n                               sb.toString());\n        }\n    }\n\n    private void writeField(VersionHistory versionHistory,\n                            ProtoStreamWriter writer) throws IOException {\n\n        if (versionHistory.records().size() != 0) {\n\n            final int lastIndex = versionHistory.records().size() - 1;\n\n            this.writeField(CHECKIN_COMMENT,\n                            versionHistory.records().get(lastIndex).comment(),\n                            writer);\n\n            this.writeField(CREATED_BY,\n                            versionHistory.records().get(0).author(),\n                            writer);\n\n            this.writeField(CREATED_DATE,\n                            versionHistory.records().get(0).date(),\n                            writer);\n\n            this.writeField(LAST_MODIFIED_BY,\n                            versionHistory.records().get(lastIndex).author(),\n                            writer);\n\n            this.writeField(LAST_MODIFIED_DATE,\n                            versionHistory.records().get(lastIndex).date(),\n                            writer);\n        }\n    }\n\n    private Object read(FieldDescriptor field,\n                        ProtoStreamReader protoStreamReader) {\n        JavaType javaType = field.getJavaType();\n\n        try {\n            if (JavaType.INT.equals(javaType)) {\n                return protoStreamReader.readInt(field.getName());\n            } else if (JavaType.BOOLEAN.equals(javaType)) {\n                return protoStreamReader.readBoolean(field.getName());\n            } else if (JavaType.DOUBLE.equals(javaType)) {\n                return protoStreamReader.readDouble(field.getName());\n            } else if (JavaType.FLOAT.equals(javaType)) {\n                return protoStreamReader.readFloat(field.getName());\n            } else if (JavaType.LONG.equals(javaType)) {\n                return protoStreamReader.readLong(field.getName());\n            } else {\n                return protoStreamReader.readString(field.getName());\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private KProperty<?> addKProperty(Map<Integer, KProperty<?>> props,\n                                      Descriptor descriptor,\n                                      String key,\n                                      String value) {\n        return props.put(descriptor.findFieldByName(toProtobufFormat(key)).getNumber(),\n                         new KPropertyImpl<>(key,\n                                             value,\n                                             false));\n    }\n\n    private boolean isExtension(final String name) {\n        return !this.getMainAttributes().contains(name);\n    }\n\n    private List<String> getMainAttributes() {\n        return this.mainAttributes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/Field.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport org.infinispan.protostream.annotations.ProtoField;\nimport org.infinispan.protostream.annotations.ProtoMessage;\n\n@ProtoMessage\npublic class Field {\n\n    private ProtobufScope scope;\n    private String type;\n    private String name;\n    private Integer index;\n    private Boolean sortable;\n    private Boolean searchable;\n    private String analyzer;\n\n    public Field() {\n    }\n\n    public Field(ProtobufScope scope,\n                 String type,\n                 String name,\n                 int index) {\n        this(scope,\n             type,\n             name,\n             index,\n             false,\n             false,\n             \"\");\n    }\n\n    public Field(ProtobufScope scope,\n                 ProtobufType type,\n                 String name,\n                 String analyzer) {\n        this(scope,\n             type,\n             name,\n             0,\n             false,\n             false,\n             analyzer);\n    }\n\n    public Field(ProtobufScope scope,\n                 ProtobufType type,\n                 String name,\n                 boolean sortable,\n                 boolean searchable,\n                 String analyzer) {\n        this(scope,\n             type,\n             name,\n             0,\n             sortable,\n             searchable,\n             analyzer);\n    }\n\n    public Field(ProtobufScope scope,\n                 ProtobufType type,\n                 String name,\n                 int index) {\n        this(scope,\n             type,\n             name,\n             index,\n             false,\n             false,\n             \"\");\n    }\n\n    public Field(ProtobufScope scope,\n                 ProtobufType type,\n                 String name,\n                 int index,\n                 boolean sortable,\n                 boolean searchable,\n                 String analyzer) {\n        this(scope,\n             type.toString(),\n             name,\n             index,\n             sortable,\n             searchable,\n             analyzer);\n    }\n\n    public Field(ProtobufScope scope,\n                 String type,\n                 String name,\n                 int index,\n                 boolean sortable,\n                 boolean searchable,\n                 String analyzer) {\n        this.scope = scope;\n        this.type = type;\n        this.name = name;\n        this.index = index;\n        this.sortable = sortable;\n        this.searchable = searchable;\n        this.analyzer = analyzer;\n    }\n\n    public ProtobufScope getScope() {\n        return scope;\n    }\n\n    @ProtoField(number = 1)\n    public void setScope(ProtobufScope scope) {\n        this.scope = scope;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    @ProtoField(number = 2)\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @ProtoField(number = 3)\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Integer getIndex() {\n        return index;\n    }\n\n    @ProtoField(number = 4)\n    public void setIndex(Integer index) {\n        this.index = index;\n    }\n\n    public Boolean isSortable() {\n        return sortable;\n    }\n\n    @ProtoField(number = 5)\n    public void setSortable(Boolean sortable) {\n        this.sortable = sortable;\n    }\n\n    public Boolean isSearchable() {\n        return searchable;\n    }\n\n    @ProtoField(number = 6)\n    public void setSearchable(Boolean searchable) {\n        this.searchable = searchable;\n    }\n\n    public String getAnalyzer() {\n        return analyzer;\n    }\n\n    @ProtoField(number = 7)\n    public void setAnalyzer(String analyzer) {\n        this.analyzer = analyzer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/Message.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.infinispan.protostream.annotations.ProtoField;\nimport org.infinispan.protostream.annotations.ProtoMessage;\n\n@ProtoMessage\npublic class Message {\n\n    private String name;\n    private Set<Field> fields;\n\n    public Message() {\n        this.fields = new HashSet<>();\n    }\n\n    public Message(String name,\n                   Set<Field> fields) {\n\n        this.name = name;\n        this.fields = fields;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @ProtoField(number = 1)\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Set<Field> getFields() {\n        return fields;\n    }\n\n    @ProtoField(number = 2, javaType = Field.class, collectionImplementation = HashSet.class)\n    public void setFields(Set<Field> fields) {\n        this.fields = fields;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/ProtobufScope.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport org.infinispan.protostream.annotations.ProtoEnumValue;\n\npublic enum ProtobufScope {\n\n    @ProtoEnumValue(number = 1)\n    OPTIONAL,\n\n    @ProtoEnumValue(number = 2)\n    REQUIRED,\n\n    @ProtoEnumValue(number = 3)\n    REPEATED\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/ProtobufType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\npublic enum ProtobufType {\n    STRING,\n    INT32,\n    BOOL,\n    DOUBLE,\n    FLOAT,\n    INT64;\n\n    @Override\n    public String toString() {\n        return this.name().toLowerCase();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/Schema.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.infinispan.protostream.annotations.ProtoField;\nimport org.infinispan.protostream.annotations.ProtoMessage;\n\n@ProtoMessage\npublic class Schema {\n\n    private String name;\n    private String pkg;\n    private Set<Message> messages;\n\n    public Schema() {\n        this.messages = new HashSet<>();\n    }\n\n    public Schema(String name,\n                  String pkg,\n                  Set<Message> messages) {\n\n        this.name = name;\n        this.pkg = pkg;\n        this.messages = messages;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @ProtoField(number = 1)\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getPkg() {\n        return pkg;\n    }\n\n    @ProtoField(number = 2)\n    public void setPkg(String pkg) {\n        this.pkg = pkg;\n    }\n\n    public Set<Message> getMessages() {\n        return messages;\n    }\n\n    @ProtoField(number = 3, javaType = Message.class, collectionImplementation = HashSet.class)\n    public void setMessages(Set<Message> messages) {\n        this.messages = messages;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/SchemaGenerator.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport java.text.MessageFormat;\nimport java.util.Comparator;\nimport java.util.Set;\n\nimport org.apache.commons.lang3.StringUtils;\n\npublic class SchemaGenerator {\n\n    private static final char NEW_LINE = '\\n';\n\n    public String generate(Schema schema) {\n        StringBuilder stringBuilder = new StringBuilder();\n\n        stringBuilder.append(\"package \")\n                .append(schema.getPkg())\n                .append(\";\\n\");\n\n        stringBuilder.append(this.buildMessages(schema.getMessages()));\n\n        return stringBuilder.toString();\n    }\n\n    private String buildMessages(Set<Message> messages) {\n        StringBuilder stringBuilder = new StringBuilder();\n\n        if (messages == null) {\n            return \"\";\n        }\n\n        messages.stream()\n                .map(this::buildMessage)\n                .sorted()\n                .forEachOrdered(message -> {\n                    stringBuilder.append(message);\n                    stringBuilder.append(NEW_LINE);\n                });\n\n        return stringBuilder.toString();\n    }\n\n    protected String buildMessage(Message message) {\n        StringBuilder stringBuilder = new StringBuilder();\n\n        stringBuilder.append(\"/**\\n\" +\n                                     \"  * @Indexed\\n\" +\n                                     \"  */\\n\");\n        stringBuilder.append(\"message\");\n        stringBuilder.append(\" \");\n        stringBuilder.append(message.getName());\n        stringBuilder.append(\" {\");\n        stringBuilder.append(NEW_LINE);\n\n        message.getFields().stream()\n                .sorted(Comparator.comparingInt(Field::getIndex))\n                .map(this::buildField)\n                .forEachOrdered(field -> {\n                    stringBuilder.append(field);\n                    stringBuilder.append(NEW_LINE);\n                });\n\n        stringBuilder.append(\"}\");\n\n        return stringBuilder.toString();\n    }\n\n    protected String buildField(Field field) {\n\n        StringBuilder stringBuilder = new StringBuilder();\n\n        stringBuilder.append(this.buildIndex(field));\n        stringBuilder.append(field.getScope().toString().toLowerCase());\n        stringBuilder.append(\" \");\n        stringBuilder.append(field.getType());\n        stringBuilder.append(\" \");\n        stringBuilder.append(field.getName());\n        stringBuilder.append(\" = \");\n        stringBuilder.append(field.getIndex());\n        stringBuilder.append(\";\");\n\n        return stringBuilder.toString();\n    }\n\n    private String buildIndex(Field field) {\n        return MessageFormat.format(\"/* @Field(index=Index.YES, analyze = Analyze.{0}, store = Store.YES) {1} {2}*/\",\n                                    this.getYesNo(field.isSearchable()),\n                                    this.getSortable(field),\n                                    this.getAnalyzer(field));\n    }\n\n    private String getSortable(Field field) {\n        if (field.isSortable()) {\n            return \"@SortableField\";\n        } else {\n            return \"\";\n        }\n    }\n\n    private String getYesNo(boolean bool) {\n        return bool ? \"YES\" : \"NO\";\n    }\n\n    private String getAnalyzer(Field field) {\n\n        if (!field.isSearchable()) {\n            return \"\";\n        }\n\n        if (StringUtils.isEmpty(field.getAnalyzer())) {\n            return \"@Analyzer(definition=\\\"standard\\\")\";\n        } else {\n            return MessageFormat.format(\"@Analyzer(definition=\\\"{0}\\\")\",\n                                        field.getAnalyzer());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanConfiguration.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.io.InputStream;\nimport java.util.Scanner;\n\nimport org.infinispan.commons.configuration.XMLStringConfiguration;\n\npublic class InfinispanConfiguration {\n\n    public static final String INFINISPAN_INDEXED_TEMPLATE = \"infinispan-indexed-template.xml\";\n    public static final String INFINISPAN_NON_INDEXED_TEMPLATE = \"infinispan-non-indexed-template.xml\";\n\n    private final String template;\n    private final String nonIdexedTemplate;\n\n    public InfinispanConfiguration() {\n        this.template = this.loadTemplate(INFINISPAN_INDEXED_TEMPLATE);\n        this.nonIdexedTemplate = this.loadTemplate(INFINISPAN_NON_INDEXED_TEMPLATE);\n    }\n\n    private String loadTemplate(String temp) {\n        InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(temp);\n        Scanner s = new Scanner(inputStream).useDelimiter(\"\\\\A\");\n        return s.hasNext() ? s.next() : \"\";\n    }\n\n    public XMLStringConfiguration getIndexedConfiguration(String value) {\n        return new XMLStringConfiguration(this.template.replaceAll(\"%value%\",\n                                                                   value));\n    }\n\n    public XMLStringConfiguration getConfiguration(String value) {\n        return new XMLStringConfiguration(this.nonIdexedTemplate.replaceAll(\"%value%\",\n                                                                            value));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanContext.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.io.IOException;\nimport java.text.MessageFormat;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.infinispan.client.hotrod.RemoteCache;\nimport org.infinispan.client.hotrod.RemoteCacheManager;\nimport org.infinispan.client.hotrod.configuration.AuthenticationConfigurationBuilder;\nimport org.infinispan.client.hotrod.configuration.ConfigurationBuilder;\nimport org.infinispan.client.hotrod.configuration.SaslQop;\nimport org.infinispan.client.hotrod.exceptions.HotRodClientException;\nimport org.infinispan.client.hotrod.impl.RemoteCacheImpl;\nimport org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller;\nimport org.infinispan.commons.CacheConfigurationException;\nimport org.infinispan.protostream.BaseMarshaller;\nimport org.infinispan.protostream.SerializationContext;\nimport org.infinispan.protostream.annotations.ProtoSchemaBuilder;\nimport org.infinispan.query.remote.client.ProtobufMetadataManagerConstants;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.backend.infinispan.exceptions.InfinispanException;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.KObjectMarshaller;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Schema;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.SchemaGenerator;\nimport org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil;\nimport org.uberfire.ext.metadata.backend.infinispan.utils.Retry;\nimport org.uberfire.ext.metadata.model.KObject;\n\nimport static java.util.stream.Collectors.toList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\npublic class InfinispanContext implements Disposable {\n\n    private static final String PORT = \"org.appformer.ext.metadata.infinispan.port\";\n    private static final String HOST = \"org.appformer.ext.metadata.infinispan.host\";\n    private static final String TIMEOUT = \"org.appformer.ext.metadata.infinispan.timeout\";\n    private static final String RETRIES = \"org.appformer.ext.metadata.infinispan.retries\";\n    private static final String USERNAME = \"org.appformer.ext.metadata.infinispan.username\";\n    private static final String PASSWORD = \"org.appformer.ext.metadata.infinispan.password\";\n    private static final String REALM = \"org.appformer.ext.metadata.infinispan.realm\";\n    private static final String SERVER_NAME = \"org.appformer.ext.metadata.infinispan.server.name\";\n    private static final String SASL_QOP = \"org.appformer.ext.metadata.infinispan.sasl.qop\";\n\n    private static final String TYPES_CACHE = \"types\";\n    private static final String SCHEMAS_CACHE = \"schemas\";\n    private static final String PROTO_EXTENSION = \".proto\";\n    private static final String SCHEMA_PROTO = \"schema.proto\";\n    private static final String ORG_KIE = \"org.kie.\";\n    public static final String SASL_MECHANISM = \"DIGEST-MD5\";\n    private static final String CACHE_PREFIX = \"appformer_\";\n    private final InfinispanPingService pingService;\n    private RemoteCacheManager cacheManager;\n    private KieProtostreamMarshaller marshaller = new KieProtostreamMarshaller();\n    private SchemaGenerator schemaGenerator;\n\n    private InfinispanConfiguration infinispanConfiguration;\n\n    private Logger logger = LoggerFactory.getLogger(InfinispanContext.class);\n    private Optional<Runnable> initializationObserver = Optional.empty();\n\n    private static final class LazyHolder {\n\n        static final Map<String, String> PROPERTIES = new HashMap<String, String>() {{\n            put(HOST,\n                System.getProperty(HOST,\n                                   \"127.0.0.1\"));\n            put(PORT,\n                System.getProperty(PORT,\n                                   \"11222\"));\n            put(TIMEOUT,\n                System.getProperty(TIMEOUT,\n                                   \"30000\"));\n            put(RETRIES,\n                System.getProperty(RETRIES,\n                                   \"5\"));\n            put(USERNAME,\n                System.getProperty(USERNAME,\n                                   \"\"));\n            put(PASSWORD,\n                System.getProperty(PASSWORD,\n                                   \"\"));\n            put(REALM,\n                System.getProperty(REALM,\n                                   \"ApplicationRealm\"));\n            put(SERVER_NAME,\n                System.getProperty(SERVER_NAME,\n                                   \"\"));\n            put(SASL_QOP,\n                System.getProperty(SASL_QOP,\n                                   \"\"));\n        }};\n        static final InfinispanContext INSTANCE = new InfinispanContext(PROPERTIES);\n    }\n\n    public static InfinispanContext getInstance() {\n        return LazyHolder.INSTANCE;\n    }\n\n    private InfinispanContext(Map<String, String> properties) {\n\n        this.infinispanConfiguration = new InfinispanConfiguration();\n        schemaGenerator = new SchemaGenerator();\n\n        cacheManager = this.createRemoteCache(properties);\n\n        this.pingService = new InfinispanPingService((RemoteCacheImpl) this.cacheManager.getCache());\n\n        createBaseIndex();\n\n        marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<KObject>() {\n            @Override\n            public String extractTypeFromEntity(KObject entity) {\n                return ORG_KIE + AttributesUtil.toProtobufFormat(entity.getClusterId() + \"_\" + entity.getType().getName());\n            }\n\n            @Override\n            public Class<KObject> getJavaClass() {\n                return KObject.class;\n            }\n\n            @Override\n            public BaseMarshaller<KObject> getMarshallerForType(String typeName) {\n                return new KObjectMarshaller(typeName);\n            }\n        });\n\n        SerializationContext serializationContext = ProtoStreamMarshaller.getSerializationContext(cacheManager);\n\n        addProtobufClass(serializationContext,\n                         addCachePrefix(SCHEMA_PROTO),\n                         Schema.class);\n\n        retrieveProbufSchemas();\n    }\n\n    private void createBaseIndex() {\n        if (!this.getIndices().contains(SCHEMAS_CACHE)) {\n            this.initializationObserver.orElse(() -> {\n            }).run();\n            cacheManager.administration().createCache(getSchemaCacheName(),\n                                                      this.infinispanConfiguration.getConfiguration(getSchemaCacheName()));\n        }\n    }\n\n    public void retrieveProbufSchemas() {\n        this.loadProtobufSchema(getProtobufCache());\n    }\n\n    private String getSchemaCacheName() {\n        return addCachePrefix(SCHEMAS_CACHE);\n    }\n\n    private String getTypesCacheName() {\n        return addCachePrefix(TYPES_CACHE);\n    }\n\n    private RemoteCacheManager createRemoteCache(Map<String, String> properties) {\n\n        String host = properties.get(HOST);\n        String port = properties.get(PORT);\n        String timeout = properties.get(TIMEOUT);\n        String retries = properties.get(RETRIES);\n\n        try {\n            ConfigurationBuilder builder = getMaybeSecurityBuilder(properties)\n                    .addServer()\n                    .host(host)\n                    .port(Integer.parseInt(port))\n                    .connectionTimeout(Integer.parseInt(timeout))\n                    .maxRetries(Integer.parseInt(retries))\n                    .marshaller(new ProtoStreamMarshaller())\n                    .marshaller(marshaller);\n            return new RemoteCacheManager(builder.build());\n        } catch (Exception e) {\n            throw new InfinispanException(MessageFormat.format(\"Error trying to connect to server <{0}:{1}>\",\n                                                               host,\n                                                               port),\n                                          e);\n        }\n    }\n\n    private AuthenticationConfigurationBuilder getMaybeSecurityBuilder(Map<String, String> properties) {\n\n        String username = properties.get(USERNAME);\n        String password = properties.get(PASSWORD);\n        String realm = properties.get(REALM);\n        String saslQop = properties.get(SASL_QOP);\n        String serverName = properties.get(SERVER_NAME);\n\n        ConfigurationBuilder b = new ConfigurationBuilder();\n\n        if (StringUtils.isNotEmpty(username)) {\n            checkNotEmpty(\"password\",\n                          password);\n            checkNotEmpty(\"realm\",\n                          realm);\n            checkNotEmpty(\"qop\",\n                          saslQop);\n            checkNotEmpty(\"serverName\",\n                          serverName);\n            return b.security().authentication()\n                    .enable()\n                    .saslMechanism(SASL_MECHANISM)\n                    .saslQop(buildSaslQop(saslQop))\n                    .serverName(serverName)\n                    .callbackHandler(new LoginHandler(username,\n                                                      password.toCharArray(),\n                                                      realm));\n        } else {\n            return b.security().authentication().disable();\n        }\n    }\n\n    protected static SaslQop[] buildSaslQop(String saslQop) {\n        return Arrays.asList(saslQop.split(\",\")).stream()\n                .map(InfinispanContext::toSaslQop)\n                .toArray(size -> new SaslQop[size]);\n    }\n\n    protected static SaslQop toSaslQop(String value) {\n        try {\n            return SaslQop.valueOf(value.trim()\n                                           .replace('-',\n                                                    '_')\n                                           .toUpperCase());\n        } catch (IllegalArgumentException e) {\n            List<String> values = Arrays.asList(SaslQop.values()).stream().map(SaslQop::toString).collect(toList());\n            throw new InfinispanException(MessageFormat.format(\"SaslQoP option <{0}> is not present in one of this possible values {1}\",\n                                                               value,\n                                                               values),\n                                          e);\n        }\n    }\n\n    private void addProtobufClass(SerializationContext serializationContext,\n                                  String protoName,\n                                  Class<?> clazz) {\n        try {\n            ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();\n            protoSchemaBuilder.fileName(protoName);\n            protoSchemaBuilder.addClass(clazz);\n            String schemaString = protoSchemaBuilder.build(serializationContext);\n            this.getProtobufCache().put(protoName,\n                                        schemaString);\n        } catch (IOException e) {\n            throw new InfinispanException(\"Can't add protobuf class <\" + protoName + \"> to cache\",\n                                          e);\n        }\n    }\n\n    private RemoteCache<String, String> getProtobufCache() {\n        return this.cacheManager.getCache(ProtobufMetadataManagerConstants.PROTOBUF_METADATA_CACHE_NAME);\n    }\n\n    private static String addCachePrefix(String content) {\n        return CACHE_PREFIX + content;\n    }\n\n    public RemoteCache<String, KObject> getCache(String index) {\n        String cacheName = AttributesUtil.toProtobufFormat(index).toLowerCase();\n\n        if (!this.getIndices().contains(cacheName)) {\n\n            String appformerCacheName = addCachePrefix(cacheName);\n\n            try {\n                cacheManager\n                        .administration()\n                        .createCache(appformerCacheName,\n                                     this.infinispanConfiguration.getIndexedConfiguration(appformerCacheName));\n            } catch (HotRodClientException | CacheConfigurationException ex) {\n                logger.warn(\"Can't create cache with name <{}>\",\n                            appformerCacheName);\n                logger.warn(\"Cause:\",\n                            ex);\n            }\n        }\n\n        return this.cacheManager.getCache(addCachePrefix(cacheName));\n    }\n\n    public List<String> getTypes(String index) {\n        return this.getSchema(index)\n                .map(schema -> schema.getMessages().stream().map(x -> x.getName()).collect(toList()))\n                .orElse(Collections.emptyList());\n    }\n\n    public void addProtobufSchema(String clusterId,\n                                  Schema schema) {\n\n        try {\n            String protoTypeName = AttributesUtil.toProtobufFormat(clusterId);\n            RemoteCache<String, String> metadataCache = getProtobufCache();\n            String proto = this.schemaGenerator.generate(schema);\n\n            marshaller.registerSchema(protoTypeName,\n                                      proto,\n                                      KObject.class);\n            metadataCache.put(protoTypeName + PROTO_EXTENSION,\n                              proto);\n        } catch (IOException e) {\n            throw new InfinispanException(\"Can't add protobuf schema <\" + schema.getName() + \"> to cache\",\n                                          e);\n        }\n    }\n\n    public void loadProtobufSchema(RemoteCache<String, String> metadataCache) {\n\n        new Retry(5, () -> {\n            metadataCache.entrySet()\n                    .stream()\n                    .filter(entry -> !entry.getKey().equals(addCachePrefix(SCHEMA_PROTO)))\n                    .forEach((entry) -> {\n                        int index = entry.getKey().lastIndexOf('.');\n                        String protoTypeName = entry.getKey().substring(0,\n                                                                        index);\n                        String proto = entry.getValue();\n\n                        try {\n                            marshaller.registerSchema(protoTypeName,\n                                                      proto,\n                                                      KObject.class);\n                        } catch (IOException e) {\n                            throw new InfinispanException(\"Can't add protobuf schema <\" + protoTypeName + \"> to cache\",\n                                                          e);\n                        }\n                    });\n        }).run();\n    }\n\n    @Override\n    public void dispose() {\n        if (this.cacheManager.isStarted()) {\n            this.cacheManager.stop();\n            this.pingService.stop();\n        }\n    }\n\n    public List<String> getIndices() {\n        return new ArrayList<>(this.cacheManager.getCacheNames())\n                .stream()\n                .filter(s -> s.startsWith(CACHE_PREFIX))\n                .map(s -> s.substring(CACHE_PREFIX.length()))\n                .collect(toList());\n    }\n\n    public Optional<Schema> getSchema(String clusterId) {\n        Schema schema = (Schema) getSchemaCache().get(clusterId.toLowerCase());\n        return Optional.ofNullable(schema);\n    }\n\n    public void addSchema(Schema schema) {\n        getSchemaCache().put(AttributesUtil.toProtobufFormat(schema.getName()).toLowerCase(),\n                             schema);\n    }\n\n    private RemoteCache<Object, Object> getSchemaCache() {\n        this.createBaseIndex();\n        return this.cacheManager.getCache(getSchemaCacheName());\n    }\n\n    public boolean isAlive() {\n\n        RemoteCacheImpl remoteCache = (RemoteCacheImpl) this.cacheManager.getCache();\n\n        try {\n            boolean isStarted = remoteCache.ping().isSuccess();\n            if (logger.isDebugEnabled()) {\n                logger.debug(\"Infinispan server is not started\");\n            }\n            return isStarted;\n        } catch (Exception e) {\n            if (logger.isDebugEnabled()) {\n                logger.error(\"Infinispan server is not started\");\n            }\n            if (logger.isTraceEnabled()) {\n                logger.error(\"Infinispan server is not started\", e);\n            }\n            return false;\n        }\n    }\n\n    public void deleteCache(String index){\n        String cacheName = AttributesUtil.toProtobufFormat(index).toLowerCase();\n        this.cacheManager.administration().removeCache(cacheName);\n    }\n\n    public void observeInitialization(Runnable runnable) {\n        this.initializationObserver = Optional.of(runnable);\n    }\n}\n\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanIndexProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.io.IOException;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.Supplier;\nimport java.util.stream.Stream;\n\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.Sort;\nimport org.infinispan.client.hotrod.Search;\nimport org.infinispan.query.dsl.QueryFactory;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.IckleConverter;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\n\nimport static java.util.stream.Collectors.toList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class InfinispanIndexProvider implements IndexProvider {\n\n    private final InfinispanContext infinispanContext;\n    private final InfinispanSchemaStore schemaStore;\n    private final IckleConverter ickleConverter;\n\n    private Logger logger = LoggerFactory.getLogger(InfinispanIndexProvider.class);\n\n    public InfinispanIndexProvider(InfinispanContext infinispanContext,\n                                   MappingProvider mappingProvider) {\n        this.infinispanContext = infinispanContext;\n        this.schemaStore = new InfinispanSchemaStore(this.infinispanContext,\n                                                     mappingProvider);\n        this.ickleConverter = new IckleConverter();\n    }\n\n    @Override\n    public boolean isFreshIndex(KCluster cluster) {\n        return this.getIndexSize(cluster.getClusterId()) == 0;\n    }\n\n    @Override\n    public void index(KObject kObject) {\n\n        this.schemaStore.updateSchema(kObject);\n\n        this.infinispanContext.getCache(kObject.getClusterId()).put(kObject.getId(),\n                                                                    kObject);\n    }\n\n    @Override\n    public void index(List<KObject> elements) {\n        elements.forEach(ko -> this.index(ko));\n    }\n\n    @Override\n    public boolean exists(String index,\n                          String id) {\n        return Optional.ofNullable(this.infinispanContext.getCache(index))\n                .map(i -> i.containsKey(id))\n                .orElse(false);\n    }\n\n    @Override\n    public void delete(String index) {\n        this.infinispanContext.deleteCache(index);\n    }\n\n    @Override\n    public void delete(String index,\n                       String id) {\n        if (this.exists(index,\n                        id)) {\n            this.infinispanContext.getCache(index).remove(id);\n        }\n    }\n\n    @Override\n    public List<KObject> findById(String index,\n                                  String id) throws IOException {\n\n        checkNotEmpty(\"index\",\n                      index);\n        checkNotEmpty(\"id\",\n                      id);\n\n        List<String> types = this.infinispanContext.getTypes(index);\n\n        return types\n                .stream()\n                .map(type -> this.getQueryFactory(index)\n                        .from(type)\n                        .having(MetaObject.META_OBJECT_ID)\n                        .eq(id)\n                        .build()\n                        .list())\n                .flatMap(x -> x.stream())\n                .map(x -> (KObject) x)\n                .collect(toList());\n    }\n\n    @Override\n    public void rename(String index,\n                       String id,\n                       KObject to) {\n\n        checkNotEmpty(\"from\",\n                      index);\n        checkNotEmpty(\"id\",\n                      id);\n        checkNotNull(\"to\",\n                     to);\n        checkNotEmpty(\"clusterId\",\n                      to.getClusterId());\n\n        checkCondition(\"renames are allowed only from same cluster\",\n                       to.getClusterId().equals(index));\n\n        if (this.exists(index,\n                        id)) {\n            this.delete(index,\n                        id);\n            this.index(to);\n        }\n    }\n\n    @Override\n    public long getIndexSize(String index) {\n        return this.infinispanContext.getCache(index).size();\n    }\n\n    @Override\n    public List<KObject> findByQuery(List<String> indices,\n                                     Query query,\n                                     int limit) {\n\n        Stream<KObject> stream = this.findByQueryRaw(indices,\n                                                     query,\n                                                     null)\n                .stream()\n                .map(this::checkQuery)\n                .flatMap(x -> x.stream())\n                .map(this::toKObject);\n        if (limit > 0) {\n            stream = stream.limit(limit);\n        }\n        return stream.collect(toList());\n    }\n\n    @Override\n    public List<KObject> findByQuery(List<String> indices,\n                                     Query query,\n                                     Sort sort,\n                                     int limit) {\n\n        Stream<KObject> stream = this.findByQueryRaw(indices,\n                                                     query,\n                                                     sort)\n                .stream()\n                .map(this::checkQuery)\n                .flatMap(x -> x.stream())\n                .map(this::toKObject);\n        if (limit > 0) {\n            stream = stream.limit(limit);\n        }\n        return stream\n                .collect(toList());\n    }\n    \n    private List<KObject> checkQuery(org.infinispan.query.dsl.Query q) {\n        return this.checkQuery(() -> q.execute().list());\n    }\n\n    private List<KObject> checkQuery(Supplier<List<KObject>> supplier) {\n        try {\n            return supplier.get();\n        } catch (Exception e) {\n            if (logger.isDebugEnabled()) {\n                logger.error(\"Error executing query\",\n                             e);\n            }\n            return Collections.emptyList();\n        }\n    }\n\n    private Integer checkHitsQuery(Supplier<Integer> supplier) {\n        try {\n            return supplier.get();\n        } catch (Exception e) {\n            if (logger.isDebugEnabled()) {\n                logger.error(\"Error executing query\",\n                             e);\n            }\n            return 0;\n        }\n    }\n\n    @Override\n    public long findHitsByQuery(List<String> indices,\n                                Query query) {\n\n        return this.findByQueryRaw(indices,\n                                   query,\n                                   null)\n                .stream()\n                .mapToInt(q -> this.checkHitsQuery(() -> new Long(q.execute().hitCount().orElse(0)).intValue()))\n                .sum();\n    }\n\n    @Override\n    public List<String> getIndices() {\n        return this.infinispanContext.getIndices();\n    }\n\n    @Override\n    public void observerInitialization(Runnable runnable) {\n        this.infinispanContext.observeInitialization(runnable);\n    }\n\n    @Override\n    public boolean isAlive() {\n        return this.infinispanContext.isAlive();\n    }\n\n    protected QueryFactory getQueryFactory(String index) {\n        return Search\n                .getQueryFactory(this.infinispanContext.getCache(index.toLowerCase()));\n    }\n\n    @Override\n    public void dispose() {\n        this.infinispanContext.dispose();\n    }\n\n    private List<org.infinispan.query.dsl.Query> findByQueryRaw(List<String> indices,\n                                                                Query query,\n                                                                Sort sort) {\n\n        this.infinispanContext.retrieveProbufSchemas();\n\n        String whereClause = this.ickleConverter.where(query);\n        String sortClause = this.ickleConverter.sort(sort);\n\n        List<String> ind = indices;\n        if (indices == null || indices.isEmpty()) {\n            ind = this.getIndices();\n        }\n\n        return ind.stream().map(index -> {\n\n            QueryFactory qf = this.getQueryFactory(index);\n\n            return this.infinispanContext.getTypes(index)\n                    .stream()\n                    .map(type -> this.buildQuery(type,\n                                                 whereClause,\n                                                 sortClause))\n                    .map(q -> {\n                        if (logger.isDebugEnabled()) {\n                            logger.debug(\"Ickle Query: \" + q);\n                        }\n                        return qf.create(q);\n                    })\n                    .collect(toList());\n        })\n                .flatMap(x -> x.stream())\n                .collect(toList());\n    }\n\n    private KObject toKObject(Object o) {\n        return (KObject) o;\n    }\n\n    private String buildQuery(String type,\n                              String whereClause,\n                              String sortClause) {\n\n        StringBuilder sb = new StringBuilder();\n\n        sb\n                .append(\"from org.kie.\")\n                .append(type.trim())\n                .append(\" \")\n                .append(whereClause.trim())\n                .append(\" \")\n                .append(sortClause.trim());\n\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanPingService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\n\nimport org.infinispan.client.hotrod.RemoteCacheManager;\nimport org.infinispan.client.hotrod.impl.RemoteCacheImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class InfinispanPingService {\n\n    private Logger logger = LoggerFactory.getLogger(InfinispanPingService.class);\n    protected static final String PING = \"org.appformer.ext.metadata.infinispan.ping\";\n\n    private final ExecutorService executor;\n    private long sleep;\n    private boolean alive = false;\n\n    private RemoteCacheManager cacheManager;\n    private boolean stop = false;\n\n    public InfinispanPingService(RemoteCacheImpl remoteCache) {\n\n        sleep = this.getTimeoutOrElse(PING, 5);\n\n        this.executor = Executors.newSingleThreadExecutor();\n        this.executor.submit(() -> {\n            while (!stop) {\n                try {\n                    this.alive = remoteCache.ping().isSuccess();\n                } catch (Exception e) {\n                    if (logger.isDebugEnabled()) {\n                        logger.error(\"Infinispan server is not started\");\n                    }\n                    if (logger.isTraceEnabled()) {\n                        logger.error(\"Infinispan server is not started\", e);\n                    }\n                    this.alive = false;\n                }\n                try {\n                    Thread.sleep(this.sleep * 1000);\n                } catch (InterruptedException e) {\n                    // Do Nothings\n                }\n            }\n        });\n    }\n\n    protected int getTimeoutOrElse(String timeout, int defaultValue) {\n        String t = System.getProperty(timeout);\n        return t != null && !t.isEmpty() ? Integer.parseInt(t) : defaultValue;\n    }\n\n    public boolean ping() {\n        return this.alive;\n    }\n\n    public void stop() {\n        this.stop = true;\n        this.executor.shutdownNow();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanSchemaStore.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Field;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Message;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Schema;\nimport org.uberfire.ext.metadata.model.KObject;\n\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\n\npublic class InfinispanSchemaStore {\n\n    private InfinispanContext infinispanContext;\n    private final MappingProvider mappingProvider;\n\n    public InfinispanSchemaStore(InfinispanContext infinispanContext,\n                                 MappingProvider mappingProvider) {\n        this.infinispanContext = infinispanContext;\n        this.mappingProvider = mappingProvider;\n    }\n\n    public void updateSchema(KObject kObject) {\n\n        String clustedId = toProtobufFormat(kObject.getClusterId());\n        Optional<Schema> storedSchema = this.infinispanContext.getSchema(clustedId);\n\n        if (!storedSchema.isPresent()) {\n            Schema newSchema = this.mappingProvider.getMapping(kObject);\n\n            newSchema.getMessages().forEach(message -> {\n                message.setFields(this.reorderFields(new ArrayList<>(message.getFields())));\n            });\n\n            this.infinispanContext.addSchema(newSchema);\n            this.infinispanContext.addProtobufSchema(kObject.getClusterId(),\n                                                     newSchema);\n        } else {\n            String type = toProtobufFormat(kObject.getClusterId() + \"_\" + kObject.getType().getName());\n            Optional<Message> storedMessage = this.getMessage(storedSchema.get(),\n                                                              type);\n\n            Set<Message> messages = new HashSet<>();\n            if (storedMessage.isPresent()) {\n                Message newMessages = this.merge(storedMessage.get(),\n                                                 this.getMessage(kObject));\n                messages.addAll(storedSchema.get().getMessages());\n                messages.remove(storedMessage.get());\n                messages.add(newMessages);\n            } else {\n                Set<Message> newMessages = this.mappingProvider.buildMessages(kObject);\n                messages.addAll(newMessages);\n                messages.addAll(storedSchema.get().getMessages());\n            }\n            Schema newSchema = this.mappingProvider.buildSchema(kObject,\n                                                                messages);\n            this.infinispanContext.addSchema(newSchema);\n            this.infinispanContext.addProtobufSchema(kObject.getClusterId(),\n                                                     newSchema);\n        }\n    }\n\n    private Message getMessage(KObject kObject) {\n        return this.mappingProvider.buildMessages(kObject)\n                .iterator()\n                .next();\n    }\n\n    protected Message merge(Message storedMessage,\n                            Message newMessage) {\n\n        List<Field> fields = new ArrayList<>(storedMessage.getFields());\n\n        newMessage.getFields().forEach(field -> {\n            if (!containsField(fields,\n                               field) &&\n                    !containsField(new ArrayList<>(storedMessage.getFields()),\n                                   field)) {\n                fields.add(field);\n            }\n        });\n\n        Set<Field> reorderedFields = reorderFields(fields);\n\n        return new Message(storedMessage.getName(),\n                           reorderedFields);\n    }\n\n    public boolean containsField(List<Field> fields,\n                                 Field field) {\n        return fields.stream().anyMatch(f -> field.getName().equals(f.getName()));\n    }\n\n    private Set<Field> reorderFields(List<Field> fields) {\n\n        int maxIndex = this.getMaxIndexNumber(fields);\n\n        List<Field> unsavedFields = fields.stream()\n                .filter(field -> field.getIndex() == 0)\n                .collect(Collectors.toList());\n\n        for (Field field : unsavedFields) {\n            maxIndex++;\n            field.setIndex(maxIndex);\n        }\n\n        return new HashSet<>(fields);\n    }\n\n    protected int getMaxIndexNumber(List<Field> fields) {\n        return fields.stream()\n                .sorted(Comparator.comparingInt(Field::getIndex).reversed())\n                .mapToInt(Field::getIndex)\n                .findFirst()\n                .orElse(0);\n    }\n\n    private Optional<Message> getMessage(Schema schema,\n                                         String type) {\n        return schema.getMessages().stream()\n                .filter(message -> message.getName().equals(type))\n                .findAny();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/KieProtostreamMarshaller.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.io.IOException;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.infinispan.client.hotrod.marshall.ProtoStreamMarshaller;\nimport org.infinispan.commons.io.ByteBuffer;\nimport org.infinispan.protostream.BaseMarshaller;\nimport org.infinispan.protostream.FileDescriptorSource;\nimport org.infinispan.protostream.SerializationContext;\nimport org.infinispan.protostream.impl.AnnotatedDescriptorImpl;\n\n/**\n * A thread safe protostream marshaller supporting dynamic entities. Workaround until dynamic entities are supported on\n * protostream - https://issues.jboss.org/browse/IPROTO-56\n */\npublic final class KieProtostreamMarshaller extends ProtoStreamMarshaller {\n\n    /**\n     * Stores the type being written in the context\n     */\n    private final InheritableThreadLocal<String> type = new InheritableThreadLocal<>();\n\n    /**\n     * Stores the types a certain dynamic marshaller class\n     */\n    private final ConcurrentHashMap<String, Class<?>> classByType = new ConcurrentHashMap<>(4);\n    private final ConcurrentHashMap<Class<?>, KieMarshallerSupplier<?>> supplierByClass = new ConcurrentHashMap<>(2);\n\n    /**\n     * Registers a protobuf file\n     * @param fileName The name of the file.\n     * @param contents The contents of the file.\n     * @param dynamicEntityClass The dynamic entity class.\n     * the types in the protobuf.\n     * @throws IOException in case the registration fails.\n     */\n    void registerSchema(String fileName,\n                        String contents,\n                        Class<?> dynamicEntityClass) throws IOException {\n\n        getSerializationContext().registerProtoFiles(FileDescriptorSource.fromString(fileName,\n                                                                                     contents));\n        getSerializationContext().getFileDescriptors().entrySet().stream()\n                .filter(p -> p.getKey().equals(fileName))\n                .flatMap(fd -> fd.getValue().getMessageTypes().stream())\n                .map(AnnotatedDescriptorImpl::getFullName)\n                .forEach(t -> classByType.put(t,\n                                              dynamicEntityClass));\n    }\n\n    /**\n     * Registers a marshaller from a dynamic entity.\n     * @param kieMarshallerSupplier The {@link KieMarshallerSupplier for the entity}\n     */\n    void registerMarshaller(final KieMarshallerSupplier kieMarshallerSupplier) {\n        supplierByClass.put(kieMarshallerSupplier.getJavaClass(),\n                            kieMarshallerSupplier);\n        getSerializationContext().registerMarshallerProvider(new SerializationContext.MarshallerProvider() {\n\n            @Override\n            public BaseMarshaller<?> getMarshaller(String typeName) {\n                Class<?> classForType = classByType.get(typeName);\n                if (classForType != null && classForType.equals(kieMarshallerSupplier.getJavaClass())) {\n                    return kieMarshallerSupplier.getMarshallerForType(typeName);\n                }\n                return null;\n            }\n\n            @Override\n            public BaseMarshaller<?> getMarshaller(Class<?> javaClass) {\n                if (kieMarshallerSupplier.getJavaClass().isAssignableFrom(javaClass)) {\n                    return kieMarshallerSupplier.getMarshallerForType(type.get());\n                } else {\n                    return null;\n                }\n            }\n        });\n    }\n\n    @Override\n    protected ByteBuffer objectToBuffer(Object o,\n                                        int estimatedSize) throws IOException {\n        try {\n            String value = extractType(o);\n            if (value != null) {\n                type.set(value);\n            }\n            return super.objectToBuffer(o,\n                                        estimatedSize);\n        } finally {\n            type.set(null);\n        }\n    }\n\n    private String extractType(Object o) {\n        KieMarshallerSupplier<Object> marshallerSupplier = (KieMarshallerSupplier<Object>) lookupSupplier(o.getClass());\n        if (marshallerSupplier != null) {\n            return marshallerSupplier.extractTypeFromEntity(o);\n        }\n        return null;\n    }\n\n    private KieMarshallerSupplier<?> lookupSupplier(Class<?> clazz) {\n        KieMarshallerSupplier<?> supplier = supplierByClass.get(clazz);\n        if (supplier != null) {\n            return supplier;\n        }\n        for (Class<?> superInterface : clazz.getInterfaces()) {\n            KieMarshallerSupplier<?> altSupplier = supplierByClass.get(superInterface);\n            if (altSupplier != null) {\n                return altSupplier;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * A marshaller supplier for Dynamic Entities\n     */\n    interface KieMarshallerSupplier<E> {\n\n        /**\n         * Extract the type for an entity.\n         * @param entity The entity being marshalled\n         * @return the fully qualified type for the entity\n         */\n        String extractTypeFromEntity(E entity);\n\n        /**\n         * @return the {@link Class} of the dynamic entity.\n         */\n        Class<E> getJavaClass();\n\n        /**\n         * @param typeName The typr name being unmarshalled\n         * @return An instance of marshaller to unmarshall the supplied type.\n         */\n        BaseMarshaller<E> getMarshallerForType(String typeName);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/LoginHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.io.IOException;\nimport javax.security.auth.callback.Callback;\nimport javax.security.auth.callback.CallbackHandler;\nimport javax.security.auth.callback.NameCallback;\nimport javax.security.auth.callback.PasswordCallback;\nimport javax.security.auth.callback.UnsupportedCallbackException;\nimport javax.security.sasl.RealmCallback;\n\npublic class LoginHandler implements CallbackHandler {\n\n    final private String login;\n    final private char[] password;\n    final private String realm;\n\n    public LoginHandler(String login,\n                        char[] password,\n                        String realm) {\n        this.login = login;\n        this.password = password;\n        this.realm = realm;\n    }\n\n    @Override\n    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {\n        for (Callback callback : callbacks) {\n            if (callback instanceof NameCallback) {\n                ((NameCallback) callback).setName(login);\n            } else if (callback instanceof PasswordCallback) {\n                ((PasswordCallback) callback).setPassword(password);\n            } else if (callback instanceof RealmCallback) {\n                ((RealmCallback) callback).setText(realm);\n            } else {\n                throw new UnsupportedCallbackException(callback);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/provider/MappingProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Field;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Message;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.ProtobufScope;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.ProtobufType;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Schema;\nimport org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.impl.KPropertyImpl;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CHECKIN_COMMENT;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CREATED_BY;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.CREATED_DATE;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.LAST_MODIFIED_BY;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.InfinispanFieldNames.LAST_MODIFIED_DATE;\n\npublic class MappingProvider {\n\n    public static final String ORG_KIE = \"org.kie\";\n    private Analyzer analyzer;\n\n    public MappingProvider(Analyzer analyzer) {\n\n        this.analyzer = analyzer;\n    }\n\n    public Schema getMapping(KObject kObject) {\n        return this.buildSchema(kObject);\n    }\n\n    private Schema buildSchema(KObject kObject) {\n        return new Schema(kObject.getClusterId(),\n                          ORG_KIE,\n                          this.buildMessages(kObject));\n    }\n\n    public Schema buildSchema(KObject kObject,\n                              Set<Message> messages) {\n        return new Schema(kObject.getClusterId(),\n                          ORG_KIE,\n                          messages);\n    }\n\n    public Set<Message> buildMessages(KObject kObject) {\n\n        List<Field> fields = new ArrayList<>();\n        fields.add(this.createField(ProtobufScope.OPTIONAL,\n                                    ProtobufType.STRING,\n                                    \"id\"));\n        fields.add(this.createField(ProtobufScope.REQUIRED,\n                                    ProtobufType.STRING,\n                                    \"type\"));\n        fields.add(this.createField(ProtobufScope.REQUIRED,\n                                    ProtobufType.STRING,\n                                    \"cluster__id\"));\n        fields.add(this.createField(ProtobufScope.REQUIRED,\n                                    ProtobufType.STRING,\n                                    \"segment__id\"));\n        fields.add(this.createField(ProtobufScope.REQUIRED,\n                                    ProtobufType.STRING,\n                                    \"key\"));\n        fields.add(createField(ProtobufScope.OPTIONAL,\n                               ProtobufType.STRING,\n                               \"fullText\",\n                               true,\n                               true));\n\n        Iterator<KProperty<?>> iterator = kObject.getProperties().iterator();\n        while (iterator.hasNext()) {\n            KProperty<?> prop = iterator.next();\n            fields.addAll(this.build(prop));\n        }\n\n        Message message = new Message(sanitize(kObject.getClusterId() + \"_\" + kObject.getType().getName()),\n                                      new HashSet<>(fields));\n\n        return Collections.singleton(message);\n    }\n\n    private String sanitize(String name) {\n        return AttributesUtil.toProtobufFormat(name);\n    }\n\n    private Set<Field> build(KProperty<?> prop) {\n\n        Class<?> aClass = prop.getValue().getClass();\n\n        if (Enum.class.isAssignableFrom(aClass)) {\n            return buildDefaultField(prop,\n                                     ProtobufType.STRING);\n        } else if (aClass == String.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.STRING);\n        } else if (aClass == Boolean.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.BOOL);\n        } else if (aClass == Integer.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.INT32);\n        } else if (aClass == Double.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.DOUBLE);\n        } else if (aClass == Long.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.INT64);\n        } else if (aClass == Float.class) {\n            return buildDefaultField(prop,\n                                     ProtobufType.FLOAT);\n        } else if (FileTime.class.isAssignableFrom(aClass)) {\n            return buildDefaultField(prop,\n                                     ProtobufType.INT64);\n        } else if (Date.class.isAssignableFrom(aClass)) {\n            return buildDefaultField(prop,\n                                     ProtobufType.INT64);\n        } else if (VersionHistory.class.isAssignableFrom(aClass)) {\n            return this.build((VersionHistory) prop.getValue());\n        } else if (Collection.class.isAssignableFrom(aClass)) {\n            return buildDefaultField(prop,\n                                     ProtobufType.STRING);\n        } else {\n            return buildDefaultField(prop,\n                                     ProtobufType.STRING);\n        }\n    }\n\n    private Set<Field> buildDefaultField(KProperty<?> prop,\n                                         ProtobufType int32) {\n        return Collections.singleton(this.createField(ProtobufScope.OPTIONAL,\n                                                      int32,\n                                                      this.sanitize(prop.getName()),\n                                                      prop.isSortable(),\n                                                      prop.isSearchable()));\n    }\n\n    private Set<Field> build(VersionHistory versionHistory) {\n\n        Set<Field> fields = new HashSet<>();\n\n        if (versionHistory.records().size() != 0) {\n\n            final int lastIndex = versionHistory.records().size() - 1;\n\n            fields.addAll(this.build(new KPropertyImpl<>(CHECKIN_COMMENT,\n                                                         versionHistory.records().get(lastIndex).comment(),\n                                                         true)));\n\n            fields.addAll(this.build(new KPropertyImpl<>(CREATED_BY,\n                                                         versionHistory.records().get(0).author(),\n                                                         true)));\n\n            fields.addAll(this.build(new KPropertyImpl<>(CREATED_DATE,\n                                                         versionHistory.records().get(0).date(),\n                                                         true)));\n\n            fields.addAll(this.build(new KPropertyImpl<>(LAST_MODIFIED_BY,\n                                                         versionHistory.records().get(lastIndex).author(),\n                                                         true)));\n\n            fields.addAll(this.build(new KPropertyImpl<>(LAST_MODIFIED_DATE,\n                                                         versionHistory.records().get(lastIndex).date(),\n                                                         true)));\n        }\n\n        return fields;\n    }\n\n    private String createAnalyzerField(Field field) {\n\n        return this.createAnalyzerField(field.getName(),\n                                        field.getType(),\n                                        field.isSearchable());\n    }\n\n    private String createAnalyzerField(String name,\n                                       String type,\n                                       boolean isSearchable) {\n        return \"\";\n    }\n\n    private Field createField(ProtobufScope scope,\n                              ProtobufType type,\n                              String name) {\n        return new Field(scope,\n                         type,\n                         name,\n                         this.createAnalyzerField(name,\n                                                  type.toString(),\n                                                  false));\n    }\n\n    private Field createField(ProtobufScope scope,\n                              ProtobufType type,\n                              String name,\n                              boolean sortable,\n                              boolean searchable) {\n        return new Field(scope,\n                         type,\n                         name,\n                         sortable,\n                         searchable,\n                         this.createAnalyzerField(name,\n                                                  type.toString(),\n                                                  searchable));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/search/InfinispanSearchIndex.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.search;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.queryparser.classic.ParseException;\nimport org.apache.lucene.queryparser.classic.QueryParser;\nimport org.apache.lucene.search.BooleanClause;\nimport org.apache.lucene.search.BooleanQuery;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.TermQuery;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\nimport org.uberfire.ext.metadata.search.DateRange;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.ext.metadata.search.SearchIndex;\n\nimport static com.google.common.base.Preconditions.checkNotNull;\nimport static java.util.Collections.emptyList;\nimport static org.apache.lucene.search.BooleanClause.Occur.MUST;\nimport static org.apache.lucene.search.BooleanClause.Occur.SHOULD;\nimport static org.apache.lucene.search.LegacyNumericRangeQuery.newLongRange;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.engine.MetaIndexEngine.FULL_TEXT_FIELD;\n\npublic class InfinispanSearchIndex implements SearchIndex {\n\n    private final IndexProvider indexProvider;\n    private final Analyzer analyzer;\n\n    public InfinispanSearchIndex(IndexProvider indexProvider,\n                                 Analyzer analyzer) {\n        this.indexProvider = checkNotNull(indexProvider,\n                                          \"indexProvider\");\n        this.analyzer = checkNotNull(analyzer,\n                                     \"analyzer\");\n    }\n\n    @Override\n    public List<KObject> searchByAttrs(final Map<String, ?> attrs,\n                                       final IOSearchService.Filter filter,\n                                       final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return emptyList();\n        }\n        if (attrs == null || attrs.size() == 0) {\n            return emptyList();\n        }\n        final int totalNumHitsEstimate = searchByAttrsHits(attrs,\n                                                           clusterSegments);\n        return search(buildQuery(attrs,\n                                 clusterSegments),\n                      totalNumHitsEstimate,\n                      filter,\n                      clusterSegments);\n    }\n\n    @Override\n    public List<KObject> fullTextSearch(final String term,\n                                        final IOSearchService.Filter filter,\n                                        final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return emptyList();\n        }\n        final int totalNumHitsEstimate = fullTextSearchHits(term,\n                                                            clusterSegments);\n        return search(buildQuery(term,\n                                 clusterSegments),\n                      totalNumHitsEstimate,\n                      filter,\n                      clusterSegments);\n    }\n\n    @Override\n    public int searchByAttrsHits(final Map<String, ?> attrs,\n                                 final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return 0;\n        }\n        if (attrs == null || attrs.size() == 0) {\n            return 0;\n        }\n        return searchHits(buildQuery(attrs,\n                                     clusterSegments),\n                          clusterSegments);\n    }\n\n    @Override\n    public int fullTextSearchHits(final String term,\n                                  final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return 0;\n        }\n        return searchHits(buildQuery(term,\n                                     clusterSegments),\n                          clusterSegments);\n    }\n\n    private int searchHits(final Query query,\n                           final ClusterSegment... clusterSegments) {\n        return Math.toIntExact(this.indexProvider.findHitsByQuery(getIndices(clusterSegments),\n                                                                  query));\n    }\n\n    private List<String> getIndices(ClusterSegment[] clusterSegments) {\n        return Arrays.asList(clusterSegments)\n                .stream()\n                .map(clusterSegment -> format(clusterSegment.getClusterId()))\n                .collect(Collectors.toList());\n    }\n\n    private List<KObject> search(final Query query,\n                                 final int totalNumHitsEstimate,\n                                 final IOSearchService.Filter filter,\n                                 final ClusterSegment... clusterSegments) {\n        List<KObject> hits = this.indexProvider.findByQuery(this.getIndices(clusterSegments),\n                                                            query,\n                                                            totalNumHitsEstimate);\n        return hits.stream().filter(kObject -> filter.accept(kObject)).collect(Collectors.toList());\n    }\n\n    private Query buildQuery(final Map<String, ?> attrs,\n                             final ClusterSegment... clusterSegments) {\n        final BooleanQuery.Builder query = new BooleanQuery.Builder();\n        for (final Map.Entry<String, ?> entry : attrs.entrySet()) {\n            if (entry.getValue() instanceof DateRange) {\n                final Long from = ((DateRange) entry.getValue()).after().getTime();\n                final Long to = ((DateRange) entry.getValue()).before().getTime();\n                query.add(newLongRange(entry.getKey(),\n                                       from,\n                                       to,\n                                       true,\n                                       true),\n                          MUST);\n            } else if (entry.getValue() instanceof String) {\n                query.add(new WildcardQuery(new Term(entry.getKey(),\n                                                     entry.getValue().toString())),\n                          MUST);\n            } else if (entry.getValue() instanceof Boolean) {\n                query.add(new TermQuery(new Term(entry.getKey(),\n                                                 ((Boolean) entry.getValue()) ? \"0\" : \"1\")),\n                          MUST);\n            }\n        }\n        return composeQuery(query.build(),\n                            clusterSegments);\n    }\n\n    private Query buildQuery(final String term,\n                             final ClusterSegment... clusterSegments) {\n\n        Query fullText;\n        try {\n            fullText = new QueryParser(FULL_TEXT_FIELD,\n                                       this.analyzer).parse(term);\n            if (fullText.toString().isEmpty()) {\n                fullText = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                      format(term) + \"*\"));\n            }\n        } catch (ParseException ex) {\n            fullText = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                  format(term) + \"*\"));\n        }\n\n        return composeQuery(fullText,\n                            clusterSegments);\n    }\n\n    private Query composeQuery(final Query query,\n                               final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return query;\n        }\n\n        final BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();\n        booleanQuery.add(query,\n                         MUST);\n\n        final BooleanClause.Occur occur = (clusterSegments.length == 1 ? MUST : SHOULD);\n        for (ClusterSegment clusterSegment : clusterSegments) {\n            final BooleanQuery.Builder clusterSegmentQuery = new BooleanQuery.Builder();\n            addClusterIdTerms(clusterSegmentQuery,\n                              clusterSegment);\n            addSegmentIdTerms(clusterSegmentQuery,\n                              clusterSegment);\n            booleanQuery.add(clusterSegmentQuery.build(),\n                             occur);\n        }\n\n        return booleanQuery.build();\n    }\n\n    private void addClusterIdTerms(final BooleanQuery.Builder query,\n                                   final ClusterSegment clusterSegment) {\n        if (clusterSegment.getClusterId() != null) {\n            final Query cluster = new TermQuery(new Term(MetaObject.META_OBJECT_CLUSTER_ID,\n                                                         clusterSegment.getClusterId()));\n            query.add(cluster,\n                      MUST);\n        }\n    }\n\n    private void addSegmentIdTerms(final BooleanQuery.Builder query,\n                                   final ClusterSegment clusterSegment) {\n        if (clusterSegment.segmentIds() == null || clusterSegment.segmentIds().length == 0) {\n            return;\n        }\n        if (clusterSegment.segmentIds().length == 1) {\n            final Query segment = new TermQuery(new Term(MetaObject.META_OBJECT_SEGMENT_ID,\n                                                         clusterSegment.segmentIds()[0]));\n            query.add(segment,\n                      MUST);\n        } else {\n            final BooleanQuery.Builder segments = new BooleanQuery.Builder();\n            for (final String segmentId : clusterSegment.segmentIds()) {\n                final Query segment = new TermQuery(new Term(MetaObject.META_OBJECT_SEGMENT_ID,\n                                                             segmentId));\n                segments.add(segment,\n                             SHOULD);\n            }\n            query.add(segments.build(),\n                      MUST);\n        }\n    }\n\n    private String format(final String term) {\n        return toProtobufFormat(term.toLowerCase());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/utils/AttributesUtil.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.utils;\n\nimport java.util.regex.Pattern;\n\npublic class AttributesUtil {\n\n    private static final Pattern INVALID_CHAR = Pattern.compile(\"[./:\\\\[\\\\]]\");\n    private static final Pattern DOUBLE_UNDERSCORE = Pattern.compile(\"__\");\n\n    public static String toProtobufFormat(String value) {\n        return INVALID_CHAR.matcher(value).replaceAll(\"__\")\n                //If '-' should be replaced with underscore, include it into the pattern ^\n                .replaceAll(\"-\",\n                            \"_\");\n    }\n\n    public static String toKPropertyFormat(String value) {\n        return DOUBLE_UNDERSCORE.matcher(value).replaceAll(\"\\\\.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/utils/InfinispanFieldNames.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.utils;\n\npublic class InfinispanFieldNames {\n\n    public static final String CHECKIN_COMMENT = \"checkinComment\";\n    public static final String LAST_MODIFIED_BY = \"lastModifiedBy\";\n    public static final String CREATED_BY = \"createdBy\";\n    public static final String CREATED_DATE = \"createdDate\";\n    public static final String LAST_MODIFIED_DATE = \"lastModifiedDate\";\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/java/org/uberfire/ext/metadata/backend/infinispan/utils/Retry.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.utils;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.backend.infinispan.exceptions.RetryException;\n\npublic class Retry {\n\n    private int retries;\n    private Runnable runnable;\n    private boolean finished = false;\n    private Logger logger = LoggerFactory.getLogger(Retry.class);\n\n    public Retry(int retries, Runnable runnable) {\n\n        this.retries = retries;\n        this.runnable = runnable;\n    }\n\n    public Retry run() {\n        int maxRetries = retries;\n        while (retries > 0 && !finished) {\n            try {\n                runnable.run();\n                finished = true;\n            } catch (Exception e) {\n                retries--;\n                logger.error(\"Error found. Retrying\", e);\n                if (retries <= 0) {\n                    throw new RetryException(\"Retried \" + maxRetries + \" times but exception found\", e);\n                }\n            }\n        }\n\n        return this;\n    }\n\n    public boolean isFinished() {\n        return this.finished;\n    }\n\n    public int getRemainingRetries() {\n        return this.retries;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/resources/clustered.xml",
    "content": "<?xml version='1.0' encoding='UTF-8'?>\n\n<server xmlns=\"urn:jboss:domain:7.0\">\n    <extensions>\n        <extension module=\"org.infinispan.extension\"/>\n        <extension module=\"org.infinispan.server.endpoint\"/>\n        <extension module=\"org.jboss.as.connector\"/>\n        <extension module=\"org.jboss.as.deployment-scanner\"/>\n        <extension module=\"org.jboss.as.jdr\"/>\n        <extension module=\"org.jboss.as.jmx\"/>\n        <extension module=\"org.jboss.as.logging\"/>\n        <extension module=\"org.jboss.as.naming\"/>\n        <extension module=\"org.jboss.as.remoting\"/>\n        <extension module=\"org.jboss.as.security\"/>\n        <extension module=\"org.jboss.as.transactions\"/>\n        <extension module=\"org.jgroups.extension\"/>\n        <extension module=\"org.wildfly.extension.elytron\"/>\n        <extension module=\"org.wildfly.extension.io\"/>\n    </extensions>\n    <management>\n        <security-realms>\n            <security-realm name=\"ManagementRealm\">\n                <authentication>\n                    <local default-user=\"$local\"/>\n                    <properties path=\"mgmt-users.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </authentication>\n                <authorization map-groups-to-roles=\"false\">\n                    <properties path=\"mgmt-groups.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </authorization>\n            </security-realm>\n            <security-realm name=\"ApplicationRealm\">\n                <server-identities>\n                    <ssl>\n                        <keystore path=\"application.keystore\" relative-to=\"jboss.server.config.dir\" keystore-password=\"password\" alias=\"server\" key-password=\"password\" generate-self-signed-certificate-host=\"localhost\"/>\n                    </ssl>\n                </server-identities>\n                <authentication>\n                    <local default-user=\"$local\" allowed-users=\"*\"/>\n                    <properties path=\"application-users.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </authentication>\n                <authorization>\n                    <properties path=\"application-roles.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </authorization>\n            </security-realm>\n        </security-realms>\n        <audit-log>\n            <formatters>\n                <json-formatter name=\"json-formatter\"/>\n            </formatters>\n            <handlers>\n                <file-handler name=\"file\" formatter=\"json-formatter\" relative-to=\"jboss.server.data.dir\" path=\"audit-log.log\"/>\n            </handlers>\n            <logger log-boot=\"true\" enabled=\"false\">\n                <handlers>\n                    <handler name=\"file\"/>\n                </handlers>\n            </logger>\n        </audit-log>\n        <management-interfaces>\n            <http-interface security-realm=\"ManagementRealm\">\n                <http-upgrade enabled=\"true\"/>\n                <socket-binding http=\"management-http\"/>\n            </http-interface>\n        </management-interfaces>\n        <access-control>\n            <role-mapping>\n                <role name=\"SuperUser\">\n                    <include>\n                        <user name=\"$local\"/>\n                    </include>\n                </role>\n            </role-mapping>\n        </access-control>\n    </management>\n    <profile>\n        <subsystem xmlns=\"urn:jboss:domain:logging:3.0\">\n            <console-handler name=\"CONSOLE\">\n                <level name=\"INFO\"/>\n                <formatter>\n                    <named-formatter name=\"COLOR-PATTERN\"/>\n                </formatter>\n            </console-handler>\n            <periodic-rotating-file-handler name=\"FILE\" autoflush=\"true\">\n                <formatter>\n                    <named-formatter name=\"PATTERN\"/>\n                </formatter>\n                <file relative-to=\"jboss.server.log.dir\" path=\"server.log\"/>\n                <suffix value=\".yyyy-MM-dd\"/>\n                <append value=\"true\"/>\n            </periodic-rotating-file-handler>\n            <size-rotating-file-handler name=\"HR-ACCESS-FILE\" autoflush=\"true\">\n                <formatter>\n                    <named-formatter name=\"ACCESS-LOG\"/>\n                </formatter>\n                <file relative-to=\"jboss.server.log.dir\" path=\"hotrod-access.log\"/>\n                <append value=\"true\"/>\n                <rotate-size value=\"10M\"/>\n                <max-backup-index value=\"10\"/>\n            </size-rotating-file-handler>\n            <size-rotating-file-handler name=\"REST-ACCESS-FILE\" autoflush=\"true\">\n                <formatter>\n                    <named-formatter name=\"ACCESS-LOG\"/>\n                </formatter>\n                <file relative-to=\"jboss.server.log.dir\" path=\"rest-access.log\"/>\n                <append value=\"true\"/>\n                <rotate-size value=\"10M\"/>\n                <max-backup-index value=\"10\"/>\n            </size-rotating-file-handler>\n            <logger category=\"com.arjuna\">\n                <level name=\"WARN\"/>\n            </logger>\n            <logger category=\"org.jboss.as.config\">\n                <level name=\"DEBUG\"/>\n            </logger>\n            <logger category=\"sun.rmi\">\n                <level name=\"WARN\"/>\n            </logger>\n            <logger category=\"org.infinispan.HOTROD_ACCESS_LOG\" use-parent-handlers=\"false\">\n                <!-- Set to TRACE to enable access logging for hot rod or use DMR -->\n                <level name=\"INFO\"/>\n                <handlers>\n                    <handler name=\"HR-ACCESS-FILE\"/>\n                </handlers>\n            </logger>\n            <logger category=\"org.infinispan.REST_ACCESS_LOG\" use-parent-handlers=\"false\">\n                <!-- Set to TRACE to enable access logging for rest or use DMR -->\n                <level name=\"INFO\"/>\n                <handlers>\n                    <handler name=\"REST-ACCESS-FILE\"/>\n                </handlers>\n            </logger>\n            <root-logger>\n                <level name=\"INFO\"/>\n                <handlers>\n                    <handler name=\"CONSOLE\"/>\n                    <handler name=\"FILE\"/>\n                </handlers>\n            </root-logger>\n            <formatter name=\"PATTERN\">\n                <pattern-formatter pattern=\"%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n\"/>\n            </formatter>\n            <formatter name=\"COLOR-PATTERN\">\n                <pattern-formatter pattern=\"%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %s%e%n\"/>\n            </formatter>\n            <formatter name=\"ACCESS-LOG\">\n                <pattern-formatter pattern=\"%X{address} %X{user} [%d{dd/MMM/yyyy:HH:mm:ss z}] &quot;%X{method} %m %X{protocol}&quot; %X{status} %X{requestSize} %X{responseSize} %X{duration}%n\"/>\n            </formatter>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:deployment-scanner:2.0\">\n            <deployment-scanner path=\"deployments\" relative-to=\"jboss.server.base.dir\" scan-interval=\"5000\" runtime-failure-causes-rollback=\"${jboss.deployment.scanner.rollback.on.failure:false}\"/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:datasources:5.0\">\n            <datasources>\n                <datasource jndi-name=\"java:jboss/datasources/ExampleDS\" pool-name=\"ExampleDS\" enabled=\"true\" use-java-context=\"true\">\n                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>\n                    <driver>h2</driver>\n                    <security>\n                        <user-name>sa</user-name>\n                        <password>sa</password>\n                    </security>\n                </datasource>\n                <drivers>\n                    <driver name=\"h2\" module=\"com.h2database.h2\">\n                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>\n                    </driver>\n                </drivers>\n            </datasources>\n        </subsystem>\n        <subsystem xmlns=\"urn:wildfly:elytron:3.0\" final-providers=\"combined-providers\" disallowed-providers=\"OracleUcrypto\">\n            <providers>\n                <aggregate-providers name=\"combined-providers\">\n                    <providers name=\"elytron\"/>\n                    <providers name=\"openssl\"/>\n                </aggregate-providers>\n                <provider-loader name=\"elytron\" module=\"org.wildfly.security.elytron\"/>\n                <provider-loader name=\"openssl\" module=\"org.wildfly.openssl\"/>\n            </providers>\n            <audit-logging>\n                <file-audit-log name=\"local-audit\" path=\"audit.log\" relative-to=\"jboss.server.log.dir\" format=\"JSON\"/>\n            </audit-logging>\n            <security-domains>\n                <security-domain name=\"ApplicationDomain\" default-realm=\"ApplicationRealm\" permission-mapper=\"default-permission-mapper\">\n                    <realm name=\"ApplicationRealm\" role-decoder=\"groups-to-roles\"/>\n                    <realm name=\"local\"/>\n                </security-domain>\n                <security-domain name=\"ManagementDomain\" default-realm=\"ManagementRealm\" permission-mapper=\"default-permission-mapper\">\n                    <realm name=\"ManagementRealm\" role-decoder=\"groups-to-roles\"/>\n                    <realm name=\"local\" role-mapper=\"super-user-mapper\"/>\n                </security-domain>\n            </security-domains>\n            <security-realms>\n                <identity-realm name=\"local\" identity=\"$local\"/>\n                <properties-realm name=\"ApplicationRealm\">\n                    <users-properties path=\"application-users.properties\" relative-to=\"jboss.server.config.dir\" digest-realm-name=\"ApplicationRealm\"/>\n                    <groups-properties path=\"application-roles.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </properties-realm>\n                <properties-realm name=\"ManagementRealm\">\n                    <users-properties path=\"mgmt-users.properties\" relative-to=\"jboss.server.config.dir\" digest-realm-name=\"ManagementRealm\"/>\n                    <groups-properties path=\"mgmt-groups.properties\" relative-to=\"jboss.server.config.dir\"/>\n                </properties-realm>\n            </security-realms>\n            <mappers>\n                <simple-permission-mapper name=\"default-permission-mapper\" mapping-mode=\"first\">\n                    <permission-mapping>\n                        <principal name=\"anonymous\"/>\n                        <permission-set name=\"default-permissions\"/>\n                    </permission-mapping>\n                    <permission-mapping match-all=\"true\">\n                        <permission-set name=\"login-permission\"/>\n                        <permission-set name=\"default-permissions\"/>\n                    </permission-mapping>\n                </simple-permission-mapper>\n                <constant-realm-mapper name=\"local\" realm-name=\"local\"/>\n                <simple-role-decoder name=\"groups-to-roles\" attribute=\"groups\"/>\n                <constant-role-mapper name=\"super-user-mapper\">\n                    <role name=\"SuperUser\"/>\n                </constant-role-mapper>\n            </mappers>\n            <permission-sets>\n                <permission-set name=\"login-permission\">\n                    <permission class-name=\"org.wildfly.security.auth.permission.LoginPermission\"/>\n                </permission-set>\n                <permission-set name=\"default-permissions\"/>\n            </permission-sets>\n            <http>\n                <http-authentication-factory name=\"application-http-authentication\" security-domain=\"ApplicationDomain\" http-server-mechanism-factory=\"global\">\n                    <mechanism-configuration>\n                        <mechanism mechanism-name=\"BASIC\">\n                            <mechanism-realm realm-name=\"Application Realm\"/>\n                        </mechanism>\n                        <mechanism mechanism-name=\"FORM\"/>\n                    </mechanism-configuration>\n                </http-authentication-factory>\n                <http-authentication-factory name=\"management-http-authentication\" security-domain=\"ManagementDomain\" http-server-mechanism-factory=\"global\">\n                    <mechanism-configuration>\n                        <mechanism mechanism-name=\"DIGEST\">\n                            <mechanism-realm realm-name=\"ManagementRealm\"/>\n                        </mechanism>\n                    </mechanism-configuration>\n                </http-authentication-factory>\n                <provider-http-server-mechanism-factory name=\"global\"/>\n            </http>\n            <sasl>\n                <sasl-authentication-factory name=\"application-sasl-authentication\" sasl-server-factory=\"configured\" security-domain=\"ApplicationDomain\">\n                    <mechanism-configuration>\n                        <mechanism mechanism-name=\"JBOSS-LOCAL-USER\" realm-mapper=\"local\"/>\n                        <mechanism mechanism-name=\"DIGEST-MD5\">\n                            <mechanism-realm realm-name=\"ApplicationRealm\"/>\n                        </mechanism>\n                    </mechanism-configuration>\n                </sasl-authentication-factory>\n                <sasl-authentication-factory name=\"management-sasl-authentication\" sasl-server-factory=\"configured\" security-domain=\"ManagementDomain\">\n                    <mechanism-configuration>\n                        <mechanism mechanism-name=\"JBOSS-LOCAL-USER\" realm-mapper=\"local\"/>\n                        <mechanism mechanism-name=\"DIGEST-MD5\">\n                            <mechanism-realm realm-name=\"ManagementRealm\"/>\n                        </mechanism>\n                    </mechanism-configuration>\n                </sasl-authentication-factory>\n                <configurable-sasl-server-factory name=\"configured\" sasl-server-factory=\"elytron\">\n                    <properties>\n                        <property name=\"wildfly.sasl.local-user.default-user\" value=\"$local\"/>\n                    </properties>\n                </configurable-sasl-server-factory>\n                <mechanism-provider-filtering-sasl-server-factory name=\"elytron\" sasl-server-factory=\"global\">\n                    <filters>\n                        <filter provider-name=\"WildFlyElytron\"/>\n                    </filters>\n                </mechanism-provider-filtering-sasl-server-factory>\n                <provider-sasl-server-factory name=\"global\"/>\n            </sasl>\n        </subsystem>\n        <subsystem xmlns=\"urn:infinispan:server:core:9.3\" default-cache-container=\"clustered\">\n            <cache-container name=\"clustered\" default-cache=\"default\" statistics=\"true\">\n                <modules>\n                  <module name=\"deployment.analyzers.jar\"/>\n                </modules>\n                <transport lock-timeout=\"60000\"/>\n                <global-state/>\n                <distributed-cache-configuration name=\"transactional\">\n                    <transaction mode=\"NON_XA\" locking=\"PESSIMISTIC\"/>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"async\" mode=\"ASYNC\"/>\n                <replicated-cache-configuration name=\"replicated\"/>\n                <distributed-cache-configuration name=\"persistent-file-store\">\n                    <file-store shared=\"false\" fetch-state=\"true\" passivation=\"false\"/>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"indexed\">\n                    <indexing index=\"LOCAL\" auto-config=\"true\"/>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"memory-bounded\">\n                    <memory>\n                        <binary size=\"10000000\" eviction=\"MEMORY\"/>\n                    </memory>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"persistent-file-store-passivation\">\n                    <memory>\n                        <object size=\"10000\"/>\n                    </memory>\n                    <file-store shared=\"false\" fetch-state=\"true\" passivation=\"true\">\n                        <write-behind modification-queue-size=\"1024\" thread-pool-size=\"1\"/>\n                    </file-store>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"persistent-file-store-write-behind\">\n                    <file-store shared=\"false\" fetch-state=\"true\" passivation=\"false\">\n                        <write-behind modification-queue-size=\"1024\" thread-pool-size=\"1\"/>\n                    </file-store>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"persistent-rocksdb-store\">\n                    <rocksdb-store shared=\"false\" fetch-state=\"true\" passivation=\"false\"/>\n                </distributed-cache-configuration>\n                <distributed-cache-configuration name=\"persistent-jdbc-string-keyed\">\n                    <string-keyed-jdbc-store datasource=\"java:jboss/datasources/ExampleDS\" fetch-state=\"true\" preload=\"false\" purge=\"false\" shared=\"false\" passivation=\"false\">\n                        <string-keyed-table prefix=\"ISPN\">\n                            <id-column name=\"id\" type=\"VARCHAR\"/>\n                            <data-column name=\"datum\" type=\"BINARY\"/>\n                            <timestamp-column name=\"version\" type=\"BIGINT\"/>\n                        </string-keyed-table>\n                        <write-behind modification-queue-size=\"1024\" thread-pool-size=\"1\"/>\n                    </string-keyed-jdbc-store>\n                </distributed-cache-configuration>\n                <distributed-cache name=\"default\"/>\n                <replicated-cache name=\"repl\" configuration=\"replicated\"/>\n            </cache-container>\n        </subsystem>\n        <subsystem xmlns=\"urn:infinispan:server:endpoint:9.3\">\n            <hotrod-connector socket-binding=\"hotrod\" cache-container=\"clustered\">\n                <topology-state-transfer lazy-retrieval=\"false\" lock-timeout=\"1000\" replication-timeout=\"5000\"/>\n            </hotrod-connector>\n            <rest-connector socket-binding=\"rest\" cache-container=\"clustered\">\n                <authentication security-realm=\"ApplicationRealm\" auth-method=\"BASIC\"/>\n            </rest-connector>\n        </subsystem>\n        <subsystem xmlns=\"urn:infinispan:server:jgroups:9.3\">\n            <channels default=\"cluster\">\n                <channel name=\"cluster\"/>\n            </channels>\n            <stacks default=\"${jboss.default.jgroups.stack:udp}\">\n                <stack name=\"udp\">\n                    <transport type=\"UDP\" socket-binding=\"jgroups-udp\"/>\n                    <protocol type=\"PING\"/>\n                    <protocol type=\"MERGE3\"/>\n                    <protocol type=\"FD_SOCK\" socket-binding=\"jgroups-udp-fd\"/>\n                    <protocol type=\"FD_ALL\"/>\n                    <protocol type=\"VERIFY_SUSPECT\"/>\n                    <protocol type=\"pbcast.NAKACK2\"/>\n                    <protocol type=\"UNICAST3\"/>\n                    <protocol type=\"pbcast.STABLE\"/>\n                    <protocol type=\"pbcast.GMS\"/>\n                    <protocol type=\"UFC_NB\"/>\n                    <protocol type=\"MFC_NB\"/>\n                    <protocol type=\"FRAG3\"/>\n                </stack>\n                <stack name=\"tcp\">\n                    <transport type=\"TCP\" socket-binding=\"jgroups-tcp\"/>\n                    <protocol type=\"MPING\" socket-binding=\"jgroups-mping\"/>\n                    <protocol type=\"MERGE3\"/>\n                    <protocol type=\"FD_SOCK\" socket-binding=\"jgroups-tcp-fd\"/>\n                    <protocol type=\"FD_ALL\"/>\n                    <protocol type=\"VERIFY_SUSPECT\"/>\n                    <protocol type=\"pbcast.NAKACK2\">\n                        <property name=\"use_mcast_xmit\">false</property>\n                    </protocol>\n                    <protocol type=\"UNICAST3\"/>\n                    <protocol type=\"pbcast.STABLE\"/>\n                    <protocol type=\"pbcast.GMS\"/>\n                    <protocol type=\"MFC_NB\"/>\n                    <protocol type=\"FRAG3\"/>\n                </stack>\n                <stack name=\"tcp-gossip\">\n                    <transport type=\"TCP\" socket-binding=\"jgroups-tcp\"/>\n                    <protocol type=\"TCPGOSSIP\">\n                        <property name=\"initial_hosts\">${jgroups.gossip.initial_hosts:}</property>\n                    </protocol>\n                    <protocol type=\"MERGE3\"/>\n                    <protocol type=\"FD_SOCK\" socket-binding=\"jgroups-tcp-fd\"/>\n                    <protocol type=\"FD_ALL\"/>\n                    <protocol type=\"VERIFY_SUSPECT\"/>\n                    <protocol type=\"pbcast.NAKACK2\">\n                        <property name=\"use_mcast_xmit\">false</property>\n                    </protocol>\n                    <protocol type=\"UNICAST3\"/>\n                    <protocol type=\"pbcast.STABLE\"/>\n                    <protocol type=\"pbcast.GMS\"/>\n                    <protocol type=\"MFC_NB\"/>\n                    <protocol type=\"FRAG3\"/>\n                </stack>\n            </stacks>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:io:3.0\">\n            <worker name=\"default\"/>\n            <buffer-pool name=\"default\"/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:jca:5.0\">\n            <archive-validation enabled=\"true\" fail-on-error=\"true\" fail-on-warn=\"false\"/>\n            <bean-validation enabled=\"true\"/>\n            <default-workmanager>\n                <short-running-threads>\n                    <core-threads count=\"50\"/>\n                    <queue-length count=\"50\"/>\n                    <max-threads count=\"50\"/>\n                    <keepalive-time time=\"10\" unit=\"seconds\"/>\n                </short-running-threads>\n                <long-running-threads>\n                    <core-threads count=\"50\"/>\n                    <queue-length count=\"50\"/>\n                    <max-threads count=\"50\"/>\n                    <keepalive-time time=\"10\" unit=\"seconds\"/>\n                </long-running-threads>\n            </default-workmanager>\n            <cached-connection-manager/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:jdr:1.0\"/>\n        <subsystem xmlns=\"urn:jboss:domain:jmx:1.3\">\n            <expose-resolved-model/>\n            <expose-expression-model/>\n            <remoting-connector/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:naming:2.0\">\n            <remote-naming/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:remoting:4.0\">\n            <http-connector name=\"http-remoting-connector\" connector-ref=\"default\" security-realm=\"ApplicationRealm\"/>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:security:2.0\">\n            <security-domains>\n                <security-domain name=\"other\" cache-type=\"default\">\n                    <authentication>\n                        <login-module code=\"Remoting\" flag=\"optional\">\n                            <module-option name=\"password-stacking\" value=\"useFirstPass\"/>\n                        </login-module>\n                        <login-module code=\"RealmDirect\" flag=\"required\">\n                            <module-option name=\"password-stacking\" value=\"useFirstPass\"/>\n                        </login-module>\n                    </authentication>\n                </security-domain>\n                <security-domain name=\"jboss-web-policy\" cache-type=\"default\">\n                    <authorization>\n                        <policy-module code=\"Delegating\" flag=\"required\"/>\n                    </authorization>\n                </security-domain>\n                <security-domain name=\"jboss-ejb-policy\" cache-type=\"default\">\n                    <authorization>\n                        <policy-module code=\"Delegating\" flag=\"required\"/>\n                    </authorization>\n                </security-domain>\n                <security-domain name=\"jaspitest\" cache-type=\"default\">\n                    <authentication-jaspi>\n                        <login-module-stack name=\"dummy\">\n                            <login-module code=\"Dummy\" flag=\"optional\"/>\n                        </login-module-stack>\n                        <auth-module code=\"Dummy\"/>\n                    </authentication-jaspi>\n                </security-domain>\n            </security-domains>\n        </subsystem>\n        <subsystem xmlns=\"urn:jboss:domain:transactions:4.0\">\n            <core-environment>\n                <process-id>\n                    <uuid/>\n                </process-id>\n            </core-environment>\n            <recovery-environment socket-binding=\"txn-recovery-environment\" status-socket-binding=\"txn-status-manager\"/>\n            <object-store path=\"tx-object-store\" relative-to=\"jboss.server.data.dir\"/>\n        </subsystem>\n    </profile>\n    <interfaces>\n        <interface name=\"management\">\n            <inet-address value=\"${jboss.bind.address.management:127.0.0.1}\"/>\n        </interface>\n        <interface name=\"public\">\n            <inet-address value=\"${jboss.bind.address:127.0.0.1}\"/>\n        </interface>\n    </interfaces>\n    <socket-binding-group name=\"standard-sockets\" default-interface=\"public\" port-offset=\"${jboss.socket.binding.port-offset:0}\">\n        <socket-binding name=\"management-http\" interface=\"management\" port=\"${jboss.management.http.port:9990}\"/>\n        <socket-binding name=\"management-https\" interface=\"management\" port=\"${jboss.management.https.port:9993}\"/>\n        <socket-binding name=\"hotrod\" port=\"11222\"/>\n        <socket-binding name=\"hotrod-internal\" port=\"11223\"/>\n        <socket-binding name=\"hotrod-multi-tenancy\" port=\"11224\"/>\n        <socket-binding name=\"jgroups-mping\" port=\"0\" multicast-address=\"${jboss.default.multicast.address:234.99.54.14}\" multicast-port=\"45700\"/>\n        <socket-binding name=\"jgroups-tcp\" port=\"7600\"/>\n        <socket-binding name=\"jgroups-tcp-fd\" port=\"57600\"/>\n        <socket-binding name=\"jgroups-udp\" port=\"55200\" multicast-address=\"${jboss.default.multicast.address:234.99.54.14}\" multicast-port=\"45688\"/>\n        <socket-binding name=\"jgroups-udp-fd\" port=\"54200\"/>\n        <socket-binding name=\"memcached\" port=\"11211\"/>\n        <socket-binding name=\"rest\" port=\"8080\"/>\n        <socket-binding name=\"rest-multi-tenancy\" port=\"8081\"/>\n        <socket-binding name=\"rest-ssl\" port=\"8443\"/>\n        <socket-binding name=\"txn-recovery-environment\" port=\"4712\"/>\n        <socket-binding name=\"txn-status-manager\" port=\"4713\"/>\n        <outbound-socket-binding name=\"remote-store-hotrod-server\">\n            <remote-destination host=\"remote-host\" port=\"11222\"/>\n        </outbound-socket-binding>\n        <outbound-socket-binding name=\"remote-store-rest-server\">\n            <remote-destination host=\"remote-host\" port=\"8080\"/>\n        </outbound-socket-binding>\n    </socket-binding-group>\n</server>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/resources/infinispan-indexed-template.xml",
    "content": "<infinispan>\n  <cache-container>\n    <replicated-cache name=\"%value%\">\n      <indexing index=\"ALL\" auto-config=\"true\"/>\n    </replicated-cache>\n  </cache-container>\n</infinispan>"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/main/resources/infinispan-non-indexed-template.xml",
    "content": "<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<infinispan>\n  <cache-container>\n    <replicated-cache name=\"%value%\"/>\n  </cache-container>\n</infinispan>"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/ickl/IcklConverterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.RegexpQuery;\nimport org.apache.lucene.search.Sort;\nimport org.apache.lucene.search.SortField;\nimport org.apache.lucene.search.TermQuery;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class IcklConverterTest {\n\n    private IckleConverter ickleConverter;\n\n    @Before\n    public void setUp() {\n        this.ickleConverter = new IckleConverter();\n    }\n\n    @Test\n    public void testTermQueryConversion() {\n\n        Query query = new TermQuery(new Term(\"a.term\",\n                                             \"theResult\"));\n\n        String queryString = this.ickleConverter.convert(query);\n        assertThat(queryString).isEqualTo(\"a__term:'theResult'\");\n    }\n\n    @Test\n    public void testWildcardQueryConversion() {\n\n        Query query = new WildcardQuery(new Term(\"a.term\",\n                                                 \"123*\"));\n\n        String queryString = this.ickleConverter.convert(query);\n        assertThat(queryString).isEqualTo(\"a__term:'123*'\");\n    }\n\n    @Test\n    public void testMatchAllDocsQueryQueryConversion() {\n\n        MatchAllDocsQuery query = new MatchAllDocsQuery();\n\n        String queryString = this.ickleConverter.convert(query);\n        assertThat(queryString).isEqualTo(\"\");\n    }\n\n    @Test\n    public void testWhereClause() {\n\n        {\n            Query query = new WildcardQuery(new Term(\"a.term\",\n                                                     \"123*\"));\n\n            String queryString = this.ickleConverter.where(query);\n            assertThat(queryString).isEqualTo(\"where a__term:'123*'\");\n        }\n\n        {\n            MatchAllDocsQuery query = new MatchAllDocsQuery();\n\n            String queryString = this.ickleConverter.where(query);\n            assertThat(queryString).isEqualTo(\"\");\n        }\n    }\n\n    @Test\n    public void testSortConvert() {\n        {\n            Sort sort = new Sort();\n            String sortString = this.ickleConverter.convert(sort);\n            assertThat(sortString).isEqualTo(\"\");\n        }\n\n        {\n            Sort sort = new Sort(new SortField(\"a.sort.field\",\n                                               SortField.Type.STRING));\n\n            String sortString = this.ickleConverter.convert(sort);\n            assertThat(sortString).isEqualTo(\"a__sort__field ASC\");\n        }\n\n        {\n            Sort sort = new Sort(new SortField(\"a.sort.field\",\n                                               SortField.Type.STRING,\n                                               true));\n\n            String sortString = this.ickleConverter.convert(sort);\n            assertThat(sortString).isEqualTo(\"a__sort__field DESC\");\n        }\n\n        {\n            Sort sort = new Sort(new SortField(\"a.sort.field\",\n                                               SortField.Type.STRING,\n                                               true),\n                                 new SortField(\"another.sort.field\",\n                                               SortField.Type.STRING));\n\n            String sortString = this.ickleConverter.convert(sort);\n            assertThat(sortString).isEqualTo(\"a__sort__field DESC,another__sort__field ASC\");\n        }\n    }\n\n    @Test\n    public void testSort() {\n        {\n            Sort sort = new Sort();\n            String sortString = this.ickleConverter.sort(sort);\n            assertThat(sortString).isEqualTo(\"\");\n        }\n\n        {\n            Sort sort = new Sort(new SortField(\"a.sort.field\",\n                                               SortField.Type.STRING,\n                                               true),\n                                 new SortField(\"another.sort.field\",\n                                               SortField.Type.STRING));\n\n            String sortString = this.ickleConverter.sort(sort);\n            assertThat(sortString).isEqualTo(\"order by a__sort__field DESC,another__sort__field ASC\");\n        }\n    }\n\n    @Test\n    public void testRegexpQuery() {\n        Query query = new RegexpQuery(new Term(\"libraryFileName\", \".*(cmmn|bpmn|bpmn2|bpmn-cm)\"));\n\n        String queryString = this.ickleConverter.convert(query);\n\n        assertThat(queryString).isEqualTo(\"libraryFileName:/.*(cmmn|bpmn|bpmn2|bpmn-cm)/\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/BooleanQueryConverterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.BooleanClause;\nimport org.apache.lucene.search.BooleanQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.junit.Test;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.IckleConverter;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class BooleanQueryConverterTest {\n\n    @Test\n    public void testSingleBooleanTermQuery() {\n\n        TermQuery query = new TermQuery(new Term(\"a.term\",\n                                                 \"theResult\"));\n\n        BooleanQuery booleanQuery = new BooleanQuery.Builder()\n                .add(query,\n                     BooleanClause.Occur.MUST)\n                .build();\n\n        BooleanQueryConverter converter = new BooleanQueryConverter(booleanQuery,\n                                                                    new IckleConverter());\n\n        String queryString = converter.convert();\n\n        assertThat(queryString).isEqualTo(\"a__term:'theResult'\");\n    }\n\n    @Test\n    public void testSingleClauseBooleanTermQuery() {\n\n        TermQuery query = new TermQuery(new Term(\"a.term\",\n                                                 \"theResult\"));\n\n        BooleanQuery booleanQuery = new BooleanQuery.Builder()\n                .add(query,\n                     BooleanClause.Occur.MUST)\n                .build();\n\n        BooleanQueryConverter converter = new BooleanQueryConverter(booleanQuery,\n                                                                    new IckleConverter());\n\n        String queryString = converter.convert();\n\n        assertThat(queryString).isEqualTo(\"a__term:'theResult'\");\n    }\n\n    @Test\n    public void testNotBooleanQuery() {\n\n        TermQuery query = new TermQuery(new Term(\"a.term\",\n                                                 \"theResult\"));\n\n        BooleanQuery booleanQuery = new BooleanQuery.Builder()\n                .add(query,\n                     BooleanClause.Occur.MUST_NOT)\n                .build();\n\n        BooleanQueryConverter converter = new BooleanQueryConverter(booleanQuery,\n                                                                    new IckleConverter());\n\n        String queryString = converter.convert();\n\n        assertThat(queryString).isEqualTo(\"NOT a__term:'theResult'\");\n    }\n\n    @Test\n    public void testMultipleBooleanTermQuery() {\n\n        TermQuery query = new TermQuery(new Term(\"a.term\",\n                                                 \"theResult\"));\n\n        TermQuery query2 = new TermQuery(new Term(\"a.term.other\",\n                                                  \"123\"));\n\n        BooleanQuery orBooleanQuery = new BooleanQuery.Builder()\n                .add(query,\n                     BooleanClause.Occur.SHOULD)\n                .add(query2,\n                     BooleanClause.Occur.MUST_NOT).build();\n\n        BooleanQuery booleanQuery = new BooleanQuery.Builder()\n                .add(query,\n                     BooleanClause.Occur.MUST)\n                .add(query2,\n                     BooleanClause.Occur.MUST)\n                .add(orBooleanQuery,\n                     BooleanClause.Occur.MUST)\n                .build();\n\n        BooleanQueryConverter converter = new BooleanQueryConverter(booleanQuery,\n                                                                    new IckleConverter());\n\n        String queryString = converter.convert();\n\n        assertThat(queryString).isEqualTo(\"a__term:'theResult' AND a__term__other:123 AND (a__term:'theResult' OR NOT a__term__other:123)\");\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/TermQueryConverterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport java.util.Arrays;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.FieldConverterImpl;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\n@RunWith(Parameterized.class)\npublic class TermQueryConverterTest {\n\n    @Parameterized.Parameters\n    public static Iterable<Object[]> data() {\n        return Arrays.asList(new Object[][]{\n                {\"aString\", \"a__term:'aString'\"},\n                {\"123\", \"a__term:123\"}, // Int\n                {\"0.3\", \"a__term:0.3\"}, // Float\n                {\"true\", \"a__term:true\"} // Boolean\n        });\n    }\n\n    @Parameterized.Parameter()\n    public String termText;\n    @Parameterized.Parameter(1)\n    public String expectedConversionResult;\n\n    @Test\n    public void test() {\n        TermQuery query = new TermQuery(new Term(\"a.term\",\n                                                 termText));\n        QueryConverter converter = new TermQueryConverter(query,\n                                                          new FieldConverterImpl());\n        String queryString = converter.convert();\n        assertThat(queryString).isEqualTo(expectedConversionResult);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/ickl/converters/WildcardQueryConverterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.ickl.converters;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.junit.Test;\nimport org.uberfire.ext.metadata.backend.infinispan.ickl.FieldConverterImpl;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class WildcardQueryConverterTest {\n\n    @Test\n    public void testWildcardTermQuery() {\n\n        WildcardQuery query = new WildcardQuery(new Term(\"a.term\",\n                                                         \"theResult*\"));\n\n        QueryConverter converter = new WildcardQueryConverter(query,\n                                                              new FieldConverterImpl());\n\n        String queryString = converter.convert();\n\n        assertThat(queryString).isEqualTo(\"a__term:'theResult*'\");\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/proto/schema/SchemaGeneratorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.proto.schema;\n\nimport java.io.IOException;\nimport java.net.URL;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\n\nimport com.google.common.base.Charsets;\nimport com.google.common.io.Resources;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class SchemaGeneratorTest {\n\n    private Logger logger = LoggerFactory.getLogger(SchemaGeneratorTest.class);\n\n    private SchemaGenerator schemaGenerator;\n\n    @Before\n    public void setUp() {\n        this.schemaGenerator = new SchemaGenerator();\n    }\n\n    @Test\n    public void testBuildField() {\n        {\n            String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.REQUIRED,\n                                                                              \"int32\",\n                                                                              \"aField\",\n                                                                              1));\n\n            String expected = \"/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */required int32 aField = 1;\";\n            assertThat(generatedField).isEqualToIgnoringWhitespace(expected);\n        }\n\n        {\n            String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.OPTIONAL,\n                                                                              \"int32\",\n                                                                              \"aField\",\n                                                                              1));\n\n            String expected = \"/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */optional int32 aField = 1;\";\n            assertThat(generatedField).isEqualToIgnoringWhitespace(expected);\n        }\n\n        {\n            String generatedField = this.schemaGenerator.buildField(new Field(ProtobufScope.REPEATED,\n                                                                              \"int32\",\n                                                                              \"aField\",\n                                                                              1));\n            String expected = \"/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */repeated int32 aField = 1;\";\n            assertThat(generatedField).isEqualToIgnoringWhitespace(expected);\n        }\n    }\n\n    @Test\n    public void testBuildMessageWithSingleField() {\n        Message message = new Message(\"KObject\",\n                                      Collections.singleton(new Field(ProtobufScope.REQUIRED,\n                                                                      \"int32\",\n                                                                      \"aField\",\n                                                                      1)));\n        String generatedMessage = this.schemaGenerator.buildMessage(message);\n        logger.debug(generatedMessage);\n\n        assertThat(this.sanitize(generatedMessage))\n                .isEqualToIgnoringWhitespace(this.read(\"proto/single-field-message.proto\"));\n    }\n\n    @Test\n    public void testBuildMessageWithMultipleFields() {\n        Message message = new Message(\"KObject\",\n                                      new HashSet<>(Arrays.asList(new Field(ProtobufScope.REQUIRED,\n                                                                            \"int32\",\n                                                                            \"aField\",\n                                                                            1),\n                                                                  new Field(ProtobufScope.REQUIRED,\n                                                                            \"string\",\n                                                                            \"anotherField\",\n                                                                            2))));\n        String generatedMessage = this.schemaGenerator.buildMessage(message);\n\n        assertThat(this.sanitize(generatedMessage))\n                .isEqualToIgnoringWhitespace(this.read(\"proto/multi-field-message.proto\"));\n    }\n\n    @Test\n    public void testBuildSchema() {\n\n        Message message = new Message(\"KObject\",\n                                      new HashSet<>(Arrays.asList(new Field(ProtobufScope.REQUIRED,\n                                                                            \"int32\",\n                                                                            \"embedded\",\n                                                                            1),\n                                                                  new Field(ProtobufScope.REQUIRED,\n                                                                            \"string\",\n                                                                            \"anotherEmbedded\",\n                                                                            2))\n                                      ));\n\n        Schema schema = new Schema(\"KObjectSchema\",\n                                   \"org.appformer\",\n                                   Collections.singleton(message));\n\n        String generatedMessage = this.schemaGenerator.generate(schema);\n        logger.debug(generatedMessage);\n\n        assertThat(this.sanitize(generatedMessage))\n                .isEqualToIgnoringWhitespace(this.read(\"proto/schema.proto\"));\n    }\n\n    private String read(String file) {\n        URL url = Resources.getResource(file);\n        try {\n            return sanitize(Resources.toString(url,\n                                               Charsets.UTF_8));\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private String sanitize(String value) {\n        return value.replaceAll(\"\\t\",\n                                \"\").replace(\"\\n\",\n                                            \"\");\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanContextTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport org.infinispan.client.hotrod.configuration.SaslQop;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.backend.infinispan.exceptions.InfinispanException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\npublic class InfinispanContextTest {\n\n    private Logger logger = LoggerFactory.getLogger(InfinispanContextTest.class);\n\n    @Test\n    public void testToSaslQoP() {\n        SaslQop sqsl = InfinispanContext.toSaslQop(\"auth\");\n        assertEquals(sqsl,\n                     SaslQop.AUTH);\n\n        sqsl = InfinispanContext.toSaslQop(\"auth-int\");\n        assertEquals(sqsl,\n                     SaslQop.AUTH_INT);\n\n        sqsl = InfinispanContext.toSaslQop(\"auth-conf\");\n        assertEquals(sqsl,\n                     SaslQop.AUTH_CONF);\n    }\n\n    @Test\n    public void testWrongToSaslQoP() {\n        try {\n            SaslQop sqsl = InfinispanContext.toSaslQop(\"auths\");\n            assertEquals(sqsl,\n                         SaslQop.AUTH);\n            fail(\"auths is an invalid option\");\n        } catch (InfinispanException e) {\n            logger.info(e.getMessage());\n        }\n    }\n\n    @Test\n    public void testBiuildSaslQop() {\n        {\n            SaslQop[] sasl = InfinispanContext.buildSaslQop(\"auth\");\n\n            assertThat(sasl).extracting(SaslQop::toString).contains(\"auth\");\n        }\n\n        {\n            SaslQop[] sasl = InfinispanContext.buildSaslQop(\"   AUTH  , auth-int,\");\n\n            assertThat(sasl).extracting(SaslQop::toString).contains(\"auth\",\n                                                                    \"auth-int\");\n        }\n\n        {\n            try {\n                SaslQop[] sasl = InfinispanContext.buildSaslQop(\"auths\");\n                fail(\"auths is an invalid option\");\n            } catch (InfinispanException e) {\n                logger.info(e.getMessage());\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanPingServiceTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport org.infinispan.client.hotrod.impl.RemoteCacheImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Answers;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class InfinispanPingServiceTest {\n\n    @Mock(answer = Answers.RETURNS_DEEP_STUBS)\n    private RemoteCacheImpl remoteCache;\n\n    @Before\n    public void setUp() {\n        when(remoteCache.ping().isSuccess()).thenReturn(true);\n    }\n\n    @Test\n    public void testPingSuccess() {\n        {\n            InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n            assertTrue(service.ping());\n            service.stop();\n        }\n\n        {\n            when(remoteCache.ping().isSuccess()).thenReturn(false);\n            InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n            assertFalse(service.ping());\n            service.stop();\n        }\n    }\n\n    @Test\n    public void testPingFailure() {\n        InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n        assertFalse(service.ping());\n        service.stop();\n    }\n\n    @Test\n    public void testExternalTimeoutVariable() {\n        {\n            InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n            int result = service.getTimeoutOrElse(InfinispanPingService.PING, 5);\n            assertEquals(5, result);\n        }\n\n        {\n            System.setProperty(InfinispanPingService.PING, String.valueOf(4));\n            InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n            int result = service.getTimeoutOrElse(InfinispanPingService.PING, 5);\n            assertEquals(4, result);\n        }\n\n        {\n            System.setProperty(InfinispanPingService.PING, \"\");\n            InfinispanPingService service = spy(new InfinispanPingService(remoteCache));\n            int result = service.getTimeoutOrElse(InfinispanPingService.PING, 5);\n            assertEquals(5, result);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/provider/InfinispanSchemaStoreTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Field;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.Message;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.ProtobufScope;\nimport org.uberfire.ext.metadata.backend.infinispan.proto.schema.ProtobufType;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class InfinispanSchemaStoreTest {\n\n    @Mock\n    private InfinispanContext infinispanContext;\n    private InfinispanSchemaStore infinispanSchemaStore;\n\n    @Mock\n    private MappingProvider mappingProvider;\n\n    @Before\n    public void setUp() {\n        this.infinispanSchemaStore = new InfinispanSchemaStore(this.infinispanContext,\n                                                               this.mappingProvider);\n    }\n\n    @Test\n    public void testMerge() {\n        String oldFieldName = \"oldField\";\n        String newFieldName = \"newField\";\n        Message oldMessage = new Message();\n        Field oldField = new Field(ProtobufScope.OPTIONAL,\n                                   ProtobufType.STRING,\n                                   oldFieldName,\n                                   1);\n        oldMessage.setFields(Collections.singleton(oldField));\n\n        Message newMessage = new Message();\n        Field newField = new Field(ProtobufScope.OPTIONAL,\n                                   ProtobufType.STRING,\n                                   newFieldName,\n                                   2);\n\n        newMessage.setFields(new HashSet<>(Arrays.asList(oldField,\n                                                         newField)));\n\n        Message mergedMessage = this.infinispanSchemaStore.merge(oldMessage,\n                                                                 newMessage);\n\n        assertThat(mergedMessage.getFields().size()).isEqualTo(2);\n        assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(oldFieldName));\n        assertThat(mergedMessage.getFields()).anySatisfy(field -> field.getName().equals(newFieldName));\n    }\n\n    @Test\n    public void testMaxIndexNumbert() {\n\n        List<Field> fields = Arrays.asList(new Field(ProtobufScope.OPTIONAL,\n                                                     ProtobufType.STRING,\n                                                     \"field1\",\n                                                     1),\n                                           new Field(ProtobufScope.OPTIONAL,\n                                                     ProtobufType.STRING,\n                                                     \"field2\",\n                                                     2));\n        int max = this.infinispanSchemaStore.getMaxIndexNumber(fields);\n        assertThat(max).isEqualTo(2);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/provider/KieProtostreamMarshallerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.provider;\n\nimport org.infinispan.protostream.BaseMarshaller;\nimport org.infinispan.protostream.MessageMarshaller;\nimport org.infinispan.protostream.SerializationContext;\nimport org.junit.Test;\n\nimport java.io.IOException;\nimport java.util.*;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.stream.Collectors;\n\nimport static java.util.stream.IntStream.range;\nimport static org.infinispan.protostream.FileDescriptorSource.fromString;\nimport static org.junit.Assert.assertEquals;\n\npublic class KieProtostreamMarshallerTest {\n\n    @Test\n    public void testMultipleMarshallers() throws IOException, InterruptedException, ClassNotFoundException {\n        KieProtostreamMarshaller marshaller = new KieProtostreamMarshaller();\n\n        // Create a few dynamic entities with the same class, but different types.\n        DynamicEntity1 entity1a = new DynamicEntity1(42,\n                                                     \"value1\");\n        DynamicEntity1 entity1b = new DynamicEntity1(23,\n                                                     \"other value\");\n        DynamicEntity1 entity1c = new DynamicEntity1(23,\n                                                     \"yet value\");\n\n        // Create another dynamic entity (different class)\n        DynamicEntity2 entity2 = new DynamicEntity2(\"org_infinispan_test\",\n                                                    1);\n\n        // Register the protobuf files auto-generated from the dynamic entities\n        marshaller.registerSchema(\"entity1a.proto\",\n                                  entity1a.getProto(),\n                                  DynamicEntity1.class);\n        marshaller.registerSchema(\"entity1b.proto\",\n                                  entity1b.getProto(),\n                                  DynamicEntity1.class);\n        // No need to generate for 'entity1c' since it shares the same type\n\n        // Register protobuf schema for entity2\n        marshaller.registerSchema(\"entity2.proto\",\n                                  entity2.getProto(),\n                                  DynamicEntity2.class);\n\n        // Register a marshaller provider for each dynamic entity class\n        marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<DynamicEntity1>() {\n            @Override\n            public String extractTypeFromEntity(DynamicEntity1 entity) {\n                return entity.getFullyQualifiedType();\n            }\n\n            @Override\n            public Class<DynamicEntity1> getJavaClass() {\n                return DynamicEntity1.class;\n            }\n\n            @Override\n            public BaseMarshaller<DynamicEntity1> getMarshallerForType(String typeName) {\n                return new DynamicEntity1Marshaller(typeName);\n            }\n        });\n\n        marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<DynamicEntity2>() {\n            @Override\n            public String extractTypeFromEntity(DynamicEntity2 entity) {\n                return entity.getType();\n            }\n\n            @Override\n            public Class<DynamicEntity2> getJavaClass() {\n                return DynamicEntity2.class;\n            }\n\n            @Override\n            public BaseMarshaller<DynamicEntity2> getMarshallerForType(String typeName) {\n                return new DynamicEntity2Marshaller(typeName);\n            }\n        });\n\n        // Registers a marshaller based on a static entity (java.util.UUID)\n        SerializationContext serCtx = marshaller.getSerializationContext();\n        serCtx.registerProtoFiles(fromString(\"uuid.proto\",\n                                             \"message unique_id { required string uuid=1; }\"));\n        serCtx.registerMarshaller(new UUIDMarshaller());\n\n        // Marshall all dynamic entities\n        byte[] bytes1a = marshaller.objectToByteBuffer(entity1a);\n        byte[] bytes1b = marshaller.objectToByteBuffer(entity1b);\n        byte[] bytes1c = marshaller.objectToByteBuffer(entity1c);\n        byte[] bytes2 = marshaller.objectToByteBuffer(entity2);\n        // Marshall a built-in type\n        byte[] stringBytes = marshaller.objectToByteBuffer(\"Sample String\");\n        // Marshall a custom static object\n        UUID uuid = UUID.randomUUID();\n        byte[] uuidBytes = marshaller.objectToByteBuffer(uuid);\n\n        // Unmarshalls all objects above\n        DynamicEntity1 fromBytes1a = (DynamicEntity1) marshaller.objectFromByteBuffer(bytes1a);\n        DynamicEntity1 fromBytes1b = (DynamicEntity1) marshaller.objectFromByteBuffer(bytes1b);\n        DynamicEntity1 fromBytes1c = (DynamicEntity1) marshaller.objectFromByteBuffer(bytes1c);\n        DynamicEntity2 fromBytes2 = (DynamicEntity2) marshaller.objectFromByteBuffer(bytes2);\n        String stringFromBytes = (String) marshaller.objectFromByteBuffer(stringBytes);\n        UUID uuidFromBytes = (UUID) marshaller.objectFromByteBuffer(uuidBytes);\n\n        // Check everything is unmarshalled correctly\n        assertEquals(entity1a,\n                     fromBytes1a);\n        assertEquals(entity1b,\n                     fromBytes1b);\n        assertEquals(entity1c,\n                     fromBytes1c);\n        assertEquals(entity2,\n                     fromBytes2);\n        assertEquals(stringFromBytes,\n                     \"Sample String\");\n        assertEquals(uuidFromBytes,\n                     uuid);\n\n        // Test in multi-threaded scenario\n        List<Object> mixedEntities = new ArrayList<>(30);\n\n        range(0,\n              50).boxed().forEach(i -> mixedEntities.add(new DynamicEntity1(42,\n                                                                            \"value\" + i)));\n        range(0,\n              70).boxed().forEach(i -> mixedEntities.add(new DynamicEntity1(23,\n                                                                            \"value\" + i)));\n        range(0,\n              80).boxed().forEach(i -> mixedEntities.add(new DynamicEntity2(\"org_infinispan_test\",\n                                                                            i)));\n\n        ExecutorService executorService = Executors.newFixedThreadPool(3);\n\n        AtomicInteger failures = new AtomicInteger(0);\n        for (int i = 0; i < 10; i++) {\n            Set<Callable<Void>> tasks = mixedEntities.stream().map(o -> (Callable<Void>) () -> {\n                try {\n                    byte[] toBytes = marshaller.objectToByteBuffer(o);\n                    Object back = marshaller.objectFromByteBuffer(toBytes);\n                    if (!o.equals(back)) {\n                        failures.incrementAndGet();\n                    }\n                    return null;\n                } catch (IOException | InterruptedException | ClassNotFoundException e) {\n                    failures.incrementAndGet();\n                }\n                return null;\n            }).collect(Collectors.toSet());\n\n            executorService.invokeAll(tasks);\n\n            assertEquals(0,\n                         failures.get());\n        }\n    }\n\n    @Test\n    public void testSingleProviderForClassHierarchy() throws Exception {\n        KieProtostreamMarshaller marshaller = new KieProtostreamMarshaller();\n\n        // Create some dynamic entities from the implementation class\n        EntityInterface entity1a = new EntityImpl(10,\n                                                  \"FieldValue-1a\");\n        EntityInterface entity1b = new EntityImpl(20,\n                                                  \"FieldValue-1b\");\n\n        // Create some dynamic entities from an anonymous class\n        EntityInterface entity2a = createEntityFromAnonymousClass(2,\n                                                                  \"FieldValue-2a\");\n        EntityInterface entity2b = createEntityFromAnonymousClass(2,\n                                                                  \"FieldValue-2b\");\n\n        // Register the protobuf files auto-generated from the dynamic entities\n        marshaller.registerSchema(\"entity1a.proto\",\n                                  entity1a.getProto(),\n                                  EntityInterface.class);\n        marshaller.registerSchema(\"entity1b.proto\",\n                                  entity1b.getProto(),\n                                  EntityInterface.class);\n        marshaller.registerSchema(\"entity2.proto\",\n                                  entity2a.getProto(),\n                                  EntityInterface.class);\n        // No need to register 'entity2b' since the type is the same\n\n        // Register a single marshaller supplier for all the dynamic entities instances.\n        marshaller.registerMarshaller(new KieProtostreamMarshaller.KieMarshallerSupplier<EntityInterface>() {\n            @Override\n            public String extractTypeFromEntity(EntityInterface entity) {\n                return entity.getType();\n            }\n\n            @Override\n            public Class<EntityInterface> getJavaClass() {\n                return EntityInterface.class;\n            }\n\n            @Override\n            public BaseMarshaller<EntityInterface> getMarshallerForType(String typeName) {\n                return new EntityMarshaller(typeName);\n            }\n        });\n\n        // Marshall all dynamic entities\n        byte[] bytes1a = marshaller.objectToByteBuffer(entity1a);\n        byte[] bytes1b = marshaller.objectToByteBuffer(entity1b);\n        byte[] bytes2a = marshaller.objectToByteBuffer(entity2a);\n        byte[] bytes2b = marshaller.objectToByteBuffer(entity2b);\n\n        // Unmarshalls all objects above\n        EntityInterface fromBytes1a = (EntityInterface) marshaller.objectFromByteBuffer(bytes1a);\n        EntityInterface fromBytes1b = (EntityInterface) marshaller.objectFromByteBuffer(bytes1b);\n        EntityInterface fromBytes2a = (EntityInterface) marshaller.objectFromByteBuffer(bytes2a);\n        EntityInterface fromBytes2b = (EntityInterface) marshaller.objectFromByteBuffer(bytes2b);\n\n        // Check everything is unmarshalled correctly\n        assertEquals(entity1a.getId(),\n                     fromBytes1a.getId());\n        assertEquals(entity1a.getFieldValue(),\n                     fromBytes1a.getFieldValue());\n        assertEquals(entity1b.getId(),\n                     fromBytes1b.getId());\n        assertEquals(entity1b.getFieldValue(),\n                     fromBytes1b.getFieldValue());\n        assertEquals(entity2a.getId(),\n                     fromBytes2a.getId());\n        assertEquals(entity2a.getFieldValue(),\n                     fromBytes2a.getFieldValue());\n        assertEquals(entity2b.getId(),\n                     fromBytes2b.getId());\n        assertEquals(entity2b.getFieldValue(),\n                     fromBytes2b.getFieldValue());\n    }\n\n    private EntityInterface createEntityFromAnonymousClass(Integer id,\n                                                           String fieldValue) {\n        return new EntityInterface() {\n\n            @Override\n            public String getFieldValue() {\n                return fieldValue;\n            }\n\n            @Override\n            public Integer getId() {\n                return id;\n            }\n        };\n    }\n\n    interface EntityInterface {\n\n        default String getType() {\n            return \"Type\" + getId();\n        }\n\n        String getFieldValue();\n\n        Integer getId();\n\n        default String getProto() {\n            return String.format(\"message %s { required int32 id=1; required string fieldValue=2; }\",\n                                 getType());\n        }\n    }\n\n    class EntityImpl implements EntityInterface {\n\n        private final Integer id;\n        private final String fieldValue;\n\n        EntityImpl(Integer id,\n                   String fieldValue) {\n            this.id = id;\n            this.fieldValue = fieldValue;\n        }\n\n        @Override\n        public String getFieldValue() {\n            return fieldValue;\n        }\n\n        @Override\n        public Integer getId() {\n            return id;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            EntityImpl entity = (EntityImpl) o;\n            return Objects.equals(id,\n                                  entity.id) &&\n                    Objects.equals(fieldValue,\n                                   entity.fieldValue);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(id,\n                                fieldValue);\n        }\n\n        @Override\n        public String toString() {\n            return \"EntityImpl{\" +\n                    \"id=\" + id +\n                    \", fieldValue='\" + fieldValue + '\\'' +\n                    '}';\n        }\n    }\n\n    class EntityMarshaller implements MessageMarshaller<EntityInterface> {\n\n        private final String type;\n\n        EntityMarshaller(String type) {\n            this.type = type;\n        }\n\n        @Override\n        public EntityInterface readFrom(ProtoStreamReader reader) throws IOException {\n            Integer id = reader.readInt(\"id\");\n            String fieldValue = reader.readString(\"fieldValue\");\n            return new EntityImpl(id,\n                                  fieldValue);\n        }\n\n        @Override\n        public void writeTo(ProtoStreamWriter writer,\n                            EntityInterface obj) throws IOException {\n            writer.writeInt(\"id\",\n                            obj.getId());\n            writer.writeString(\"fieldValue\",\n                               obj.getFieldValue());\n        }\n\n        @Override\n        public Class<? extends EntityInterface> getJavaClass() {\n            return EntityInterface.class;\n        }\n\n        @Override\n        public String getTypeName() {\n            return type;\n        }\n    }\n\n    class UUIDMarshaller implements MessageMarshaller<UUID> {\n\n        @Override\n        public UUID readFrom(ProtoStreamReader reader) throws IOException {\n            return UUID.fromString(reader.readString(\"uuid\"));\n        }\n\n        @Override\n        public void writeTo(ProtoStreamWriter writer,\n                            UUID uuid) throws IOException {\n            writer.writeString(\"uuid\",\n                               uuid.toString());\n        }\n\n        @Override\n        public Class<? extends UUID> getJavaClass() {\n            return UUID.class;\n        }\n\n        @Override\n        public String getTypeName() {\n            return \"unique_id\";\n        }\n    }\n\n    class DynamicEntity1 {\n\n        private int seed;\n        private String value;\n\n        DynamicEntity1(int seed,\n                       String value) {\n            this.seed = seed;\n            this.value = value;\n        }\n\n        String getFullyQualifiedType() {\n            return \"type_\" + seed;\n        }\n\n        String getProto() {\n            return String.format(\"message %s { required int32 seed=1; required string value=2; }\",\n                                 getFullyQualifiedType());\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            DynamicEntity1 that = (DynamicEntity1) o;\n            return seed == that.seed &&\n                    Objects.equals(value,\n                                   that.value);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(seed,\n                                value);\n        }\n\n        @Override\n        public String toString() {\n            return \"DynamicEntity1{\" +\n                    \"seed=\" + seed +\n                    \", value='\" + value + '\\'' +\n                    '}';\n        }\n    }\n\n    class DynamicEntity2 {\n\n        private String theType;\n        private Integer rank;\n\n        DynamicEntity2(String theType,\n                       Integer rank) {\n            this.theType = theType;\n            this.rank = rank;\n        }\n\n        String getType() {\n            return theType;\n        }\n\n        String getProto() {\n            return String.format(\"message %s { required string theType=1; required int32 rank=2; }\",\n                                 getType());\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n            DynamicEntity2 that = (DynamicEntity2) o;\n            return Objects.equals(theType,\n                                  that.theType) &&\n                    Objects.equals(rank,\n                                   that.rank);\n        }\n\n        @Override\n        public int hashCode() {\n            return Objects.hash(theType,\n                                rank);\n        }\n\n        @Override\n        public String toString() {\n            return \"DynamicEntity2{\" +\n                    \"theType='\" + theType + '\\'' +\n                    \", rank=\" + rank +\n                    '}';\n        }\n    }\n\n    class DynamicEntity1Marshaller implements MessageMarshaller<DynamicEntity1> {\n\n        private final String type;\n\n        DynamicEntity1Marshaller(String type) {\n            this.type = type;\n        }\n\n        @Override\n        public DynamicEntity1 readFrom(ProtoStreamReader reader) throws IOException {\n            Integer seed = reader.readInt(\"seed\");\n            String value = reader.readString(\"value\");\n            return new DynamicEntity1(seed,\n                                      value);\n        }\n\n        @Override\n        public void writeTo(ProtoStreamWriter writer,\n                            DynamicEntity1 obj) throws IOException {\n            writer.writeInt(\"seed\",\n                            obj.seed);\n            writer.writeString(\"value\",\n                               obj.value);\n        }\n\n        @Override\n        public Class<? extends DynamicEntity1> getJavaClass() {\n            return DynamicEntity1.class;\n        }\n\n        @Override\n        public String getTypeName() {\n            return type;\n        }\n    }\n\n    class DynamicEntity2Marshaller implements MessageMarshaller<DynamicEntity2> {\n\n        private final String type;\n\n        DynamicEntity2Marshaller(String type) {\n            this.type = type;\n        }\n\n        @Override\n        public DynamicEntity2 readFrom(ProtoStreamReader reader) throws IOException {\n            String type = reader.readString(\"theType\");\n            Integer rank = reader.readInt(\"rank\");\n            return new DynamicEntity2(type,\n                                      rank);\n        }\n\n        @Override\n        public void writeTo(ProtoStreamWriter writer,\n                            DynamicEntity2 obj) throws IOException {\n            writer.writeString(\"theType\",\n                               obj.theType);\n            writer.writeInt(\"rank\",\n                            obj.rank);\n        }\n\n        @Override\n        public Class<? extends DynamicEntity2> getJavaClass() {\n            return DynamicEntity2.class;\n        }\n\n        @Override\n        public String getTypeName() {\n            return type;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/utils/AttributesUtilTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.utils;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class AttributesUtilTest {\n\n    @Test\n    public void toProtobufFormat_replaceInvalidCharactersWithTwoUnderscores() {\n        assertThat(AttributesUtil.toProtobufFormat(\"abcdEFGH\")).isEqualTo(\"abcdEFGH\");\n        assertThat(AttributesUtil.toProtobufFormat(\"a.b\")).isEqualTo(\"a__b\");\n        assertThat(AttributesUtil.toProtobufFormat(\"c/d\")).isEqualTo(\"c__d\");\n        assertThat(AttributesUtil.toProtobufFormat(\"e:f\")).isEqualTo(\"e__f\");\n        assertThat(AttributesUtil.toProtobufFormat(\"g[h]\")).isEqualTo(\"g__h__\");\n        assertThat(AttributesUtil.toProtobufFormat(\"i-j\")).isEqualTo(\"i_j\");\n        assertThat(AttributesUtil.toProtobufFormat(\"./:[]-\")).isEqualTo(\"___________\");\n    }\n\n    @Test\n    public void toKPropertyFormat_replacesDoubleUnderscoreWithSlashDot() {\n        assertThat(AttributesUtil.toKPropertyFormat(\"a__b_c__d\")).isEqualTo(\"a.b_c.d\");\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/java/org/uberfire/ext/metadata/backend/infinispan/utils/RetryTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.infinispan.utils;\n\nimport org.junit.Test;\nimport org.uberfire.ext.metadata.backend.infinispan.exceptions.RetryException;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class RetryTest {\n\n    @Test\n    public void testRetry() {\n\n        {\n            Retry retry = new Retry(5, () -> {\n            });\n\n            retry.run();\n\n            assertEquals(5, retry.getRemainingRetries());\n            assertTrue(retry.isFinished());\n        }\n\n        {\n            Retry retry = new Retry(5, () -> {\n                throw new RuntimeException(\"This should fail right here\");\n            });\n\n            try {\n                retry.run();\n            } catch (Exception e) {\n                assertTrue(e instanceof RetryException);\n            }\n\n            assertEquals(0, retry.getRemainingRetries());\n            assertFalse(retry.isFinished());\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/infinispan.xml",
    "content": "<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<infinispan>\n  <cache-container>\n    <replicated-cache name=\"cache\">\n      <indexing index=\"ALL\" auto-config=\"true\"/>\n    </replicated-cache>\n  </cache-container>\n</infinispan>"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/log4j.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">\n<!-- ===================================================================== -->\n<!--                                                                       -->\n<!--  Log4j Configuration                                                  -->\n<!--                                                                       -->\n<!-- ===================================================================== -->\n<!-- $Id: log4j.xml,v 1.8 2006/04/26 17:29:10 gavin Exp $ -->\n<!--\n   | For more configuration infromation and examples see the Jakarta Log4j\n   | owebsite: http://jakarta.apache.org/log4j\n -->\n<log4j:configuration xmlns:log4j=\"http://jakarta.apache.org/log4j/\" debug=\"false\">\n  <appender name=\"CONSOLE\" class=\"org.apache.log4j.ConsoleAppender\">\n    <param name=\"Target\" value=\"System.out\"/>\n    <layout class=\"org.apache.log4j.PatternLayout\">\n      <param name=\"ConversionPattern\" value=\"%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) \\t %m%n\"/>\n    </layout>\n  </appender>\n  <logger name=\"org.uberfire.ext.metadata.backend.infinispan\">\n    <level value=\"DEBUG\"/>\n  </logger>\n  <root>\n    <priority value=\"ERROR\"/>\n    <appender-ref ref=\"CONSOLE\"/>\n  </root>\n</log4j:configuration>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire.ext.metadata.backend.infinispan\" level=\"DEBUG\"/>\n\n  <root level=\"ERROR\">\n    <appender-ref ref=\"consoleAppender\"/>\n  </root>\n\n</configuration>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/proto/multi-field-message.proto",
    "content": "/**\n* @Indexed\n*/\nmessage KObject {\n\t/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */\n\trequired int32 aField = 1;\n\t/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */\n\trequired string anotherField = 2;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/proto/schema.proto",
    "content": "package org.appformer;\n\n/**\n* @Indexed\n*/\nmessage KObject {\n\n\t/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */\n\trequired int32 embedded = 1;\n\n\t/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */\n\trequired string anotherEmbedded = 2;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-infinispan/src/test/resources/proto/single-field-message.proto",
    "content": "/**\n* @Indexed\n*/\nmessage KObject {\n\t/* @Field(index=Index.YES, analyze = Analyze.NO, store = Store.YES) */\n\trequired int32 aField = 1;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-metadata-backends</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-metadata-backend-lucene</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Metadata Lucene Backend</name>\n  <description>Uberfire Metadata Lucene Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-core</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-analyzers-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-codecs</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-queryparser</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-misc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-sandbox</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/LuceneConfig.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.ext.metadata.MetadataConfig;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndexManager;\nimport org.uberfire.ext.metadata.backend.lucene.provider.LuceneIndexProvider;\nimport org.uberfire.ext.metadata.backend.lucene.search.LuceneSearchIndex;\nimport org.uberfire.ext.metadata.engine.IndexManager;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.ext.metadata.search.SearchIndex;\n\npublic class LuceneConfig implements MetadataConfig {\n\n    private final MetaModelStore metaModelStore;\n    private final FieldFactory fieldFactory;\n    private final LuceneIndexManager indexManager;\n    private final Analyzer analyzer;\n    private final LuceneSearchIndex searchIndex;\n    private final MetaIndexEngine indexEngine;\n    private final LuceneIndexProvider indexProvider;\n\n    public LuceneConfig(final MetaModelStore metaModelStore,\n                        final FieldFactory fieldFactory,\n                        final LuceneIndexManager indexManager,\n                        final MetaIndexEngine metaIndexEngine,\n                        final Analyzer analyzer) {\n        this.metaModelStore = metaModelStore;\n        this.fieldFactory = fieldFactory;\n        this.analyzer = analyzer;\n        this.indexManager = indexManager;\n        this.searchIndex = new LuceneSearchIndex(this.indexManager,\n                                                 this.analyzer);\n        this.indexEngine = metaIndexEngine;\n        this.indexProvider = new LuceneIndexProvider(indexManager,\n                                                     fieldFactory);\n        PriorityDisposableRegistry.register(this);\n    }\n\n    @Override\n    public IndexProvider getIndexProvider() {\n        return this.indexProvider;\n    }\n\n    @Override\n    public SearchIndex getSearchIndex() {\n        return searchIndex;\n    }\n\n    @Override\n    public MetaIndexEngine getIndexEngine() {\n        return indexEngine;\n    }\n\n    public IndexManager getIndexManager() {\n        return indexManager;\n    }\n\n    @Override\n    public MetaModelStore getMetaModelStore() {\n        return metaModelStore;\n    }\n\n    @Override\n    public void dispose() {\n        indexEngine.dispose();\n        indexManager.dispose();\n        metaModelStore.dispose();\n        analyzer.close();\n    }\n\n    @Override\n    public int priority() {\n        return -20;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/analyzer/FilenameAnalyzer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.analyzer;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.analysis.TokenStream;\nimport org.apache.lucene.analysis.core.LowerCaseFilter;\n\npublic class FilenameAnalyzer extends Analyzer {\n\n    public FilenameAnalyzer() {\n        super();\n    }\n\n    @Override\n    protected TokenStreamComponents createComponents(String fieldName) {\n        final LowerCaseTokenizer src = new LowerCaseTokenizer();\n        final TokenStream tok = new LowerCaseFilter(src);\n\n        return new TokenStreamComponents(src,\n                                         tok);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/analyzer/LowerCaseTokenizer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.analyzer;\n\nimport org.apache.lucene.analysis.util.CharTokenizer;\nimport org.apache.lucene.util.AttributeFactory;\n\npublic class LowerCaseTokenizer extends CharTokenizer {\n\n    public LowerCaseTokenizer() {\n        super();\n    }\n\n    public LowerCaseTokenizer(AttributeFactory factory) {\n        super(factory);\n    }\n\n    @Override\n    protected boolean isTokenChar(int c) {\n        return true;\n    }\n\n    /**\n     * Converts char to lower case\n     * {@link Character#toLowerCase(int)}.\n     */\n    @Override\n    protected int normalize(int c) {\n        try {\n            return Character.toLowerCase(c);\n        } catch (Exception ex) {\n            return c;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/fields/FieldFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.fields;\n\nimport org.apache.lucene.index.IndexableField;\nimport org.uberfire.ext.metadata.model.KProperty;\n\n/**\n *\n */\npublic interface FieldFactory {\n\n    String FILE_NAME_FIELD_SORTED = \"filenamesorted\";\n\n    IndexableField[] build(final KProperty<?> property);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/fields/SimpleFieldFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.fields;\n\nimport java.util.Collection;\nimport java.util.Date;\n\nimport org.apache.lucene.document.Field;\nimport org.apache.lucene.document.LegacyDoubleField;\nimport org.apache.lucene.document.LegacyFloatField;\nimport org.apache.lucene.document.LegacyIntField;\nimport org.apache.lucene.document.LegacyLongField;\nimport org.apache.lucene.document.SortedDocValuesField;\nimport org.apache.lucene.document.StoredField;\nimport org.apache.lucene.document.StringField;\nimport org.apache.lucene.document.TextField;\nimport org.apache.lucene.index.IndexableField;\nimport org.apache.lucene.util.BytesRef;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.ext.metadata.backend.lucene.util.Serializer.toByteArray;\n\npublic class SimpleFieldFactory implements FieldFactory {\n\n    @Override\n    public IndexableField[] build(final KProperty<?> property) {\n\n        if (Enum.class.isAssignableFrom(property.getValue().getClass())) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new TextField(property.getName(),\n                                                          property.getValue().toString().toLowerCase(),\n                                                          Field.Store.YES)};\n            }\n            return new IndexableField[]{new StringField(property.getName(),\n                                                        property.getValue().toString().toLowerCase(),\n                                                        Field.Store.YES)};\n        }\n\n        if (property.getValue().getClass() == String.class) {\n            if (property.isSortable()) {\n                return new IndexableField[]{new SortedDocValuesField(property.getName(),\n                                                                     new BytesRef(property.getValue().toString()))};\n            }\n            if (property.isSearchable()) {\n                return new IndexableField[]{new TextField(property.getName(),\n                                                          property.getValue().toString(),\n                                                          Field.Store.YES)};\n            }\n            return new IndexableField[]{new StringField(property.getName(),\n                                                        property.getValue().toString(),\n                                                        Field.Store.YES)};\n        }\n\n        if (property.getValue().getClass() == Boolean.class) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new TextField(property.getName(),\n                                                          ((Boolean) property.getValue()) ? \"0\" : \"1\",\n                                                          Field.Store.YES)};\n            }\n            return new IndexableField[]{new StringField(property.getName(),\n                                                        ((Boolean) property.getValue()) ? \"0\" : \"1\",\n                                                        Field.Store.YES)};\n        }\n\n        if (property.getValue().getClass() == Integer.class) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyIntField(property.getName(),\n                                                               (Integer) property.getValue(),\n                                                               Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        (Integer) property.getValue())};\n        }\n\n        if (property.getValue().getClass() == Long.class) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyLongField(property.getName(),\n                                                                (Long) property.getValue(),\n                                                                Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        (Long) property.getValue())};\n        }\n\n        if (property.getValue().getClass() == Double.class) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyDoubleField(property.getName(),\n                                                                  (Double) property.getValue(),\n                                                                  Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        (Double) property.getValue())};\n        }\n\n        if (property.getValue().getClass() == Float.class) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyFloatField(property.getName(),\n                                                                 (Float) property.getValue(),\n                                                                 Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        (Float) property.getValue())};\n        }\n\n        if (FileTime.class.isAssignableFrom(property.getValue().getClass())) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyLongField(property.getName(),\n                                                                ((FileTime) property.getValue()).toMillis(),\n                                                                Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        ((FileTime) property.getValue()).toMillis())};\n        }\n\n        if (Date.class.isAssignableFrom(property.getValue().getClass())) {\n            if (property.isSearchable()) {\n                return new IndexableField[]{new LegacyLongField(property.getName(),\n                                                                ((Date) property.getValue()).getTime(),\n                                                                Field.Store.YES)};\n            }\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        ((Date) property.getValue()).getTime())};\n        }\n\n        if (VersionHistory.class.isAssignableFrom(property.getValue().getClass())) {\n            final VersionHistory versionHistory = (VersionHistory) property.getValue();\n            return build(versionHistory);\n        }\n\n        if (Collection.class.isAssignableFrom(property.getValue().getClass())) {\n            final StringBuilder sb = new StringBuilder();\n            for (final java.lang.Object ovalue : (Collection) property.getValue()) {\n                sb.append(ovalue).append(' ');\n            }\n\n            if (property.isSearchable()) {\n                return new IndexableField[]{new TextField(property.getName(),\n                                                          sb.toString(),\n                                                          Field.Store.YES)};\n            }\n            return new IndexableField[]{new StringField(property.getName(),\n                                                        sb.toString(),\n                                                        Field.Store.YES)};\n        }\n\n        try {\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        toByteArray(property.getValue()))};\n        } catch (final Exception ex) {\n            return new IndexableField[]{new StoredField(property.getName(),\n                                                        property.getValue().toString())};\n        }\n    }\n\n    private IndexableField[] build(final VersionHistory versionHistory) {\n        if (versionHistory.records().size() == 0) {\n            return new IndexableField[]{};\n        }\n\n        final int lastIndex = versionHistory.records().size() - 1;\n        final IndexableField checkinComment = build(new KProperty<String>() {\n            @Override\n            public String getName() {\n                return \"checkinComment\";\n            }\n\n            @Override\n            public String getValue() {\n                return versionHistory.records().get(lastIndex).comment();\n            }\n\n            @Override\n            public boolean isSearchable() {\n                return true;\n            }\n        })[0];\n\n        final IndexableField lastModifiedBy = build(new KProperty<String>() {\n            @Override\n            public String getName() {\n                return \"lastModifiedBy\";\n            }\n\n            @Override\n            public String getValue() {\n                return versionHistory.records().get(lastIndex).author();\n            }\n\n            @Override\n            public boolean isSearchable() {\n                return true;\n            }\n        })[0];\n\n        final IndexableField createdBy = build(new KProperty<String>() {\n            @Override\n            public String getName() {\n                return \"createdBy\";\n            }\n\n            @Override\n            public String getValue() {\n                return versionHistory.records().get(0).author();\n            }\n\n            @Override\n            public boolean isSearchable() {\n                return true;\n            }\n        })[0];\n\n        final IndexableField createdDate = build(new KProperty<Date>() {\n            @Override\n            public String getName() {\n                return \"createdDate\";\n            }\n\n            @Override\n            public Date getValue() {\n                return versionHistory.records().get(0).date();\n            }\n\n            @Override\n            public boolean isSearchable() {\n                return true;\n            }\n        })[0];\n\n        final IndexableField lastModifiedDate = build(new KProperty<Date>() {\n            @Override\n            public String getName() {\n                return \"lastModifiedDate\";\n            }\n\n            @Override\n            public Date getValue() {\n                return versionHistory.records().get(lastIndex).date();\n            }\n\n            @Override\n            public boolean isSearchable() {\n                return true;\n            }\n        })[0];\n\n        return new IndexableField[]{checkinComment, lastModifiedBy, createdBy, createdDate, lastModifiedDate};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/BaseLuceneIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index;\n\nimport java.io.IOException;\nimport java.util.List;\n\nimport org.apache.lucene.document.Document;\nimport org.apache.lucene.index.IndexWriter;\nimport org.apache.lucene.index.LeafReader;\nimport org.apache.lucene.index.LeafReaderContext;\nimport org.apache.lucene.index.PostingsEnum;\nimport org.apache.lucene.index.TermsEnum;\nimport org.apache.lucene.search.DocIdSetIterator;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.apache.lucene.util.Bits;\nimport org.apache.lucene.util.BytesRef;\n\npublic abstract class BaseLuceneIndex implements LuceneIndex {\n\n    @Override\n    public void indexDocument(final String id,\n                              final Document doc) {\n        try {\n            deleteIfExists(id);\n            writer().addDocument(doc);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean deleteIfExists(final String... docIds) {\n        boolean deletedSomething = false;\n        final IndexSearcher searcher = nrtSearcher();\n        try {\n            final int[] answers = lookupDocIdByPK(searcher,\n                                                  docIds);\n            for (final int docId : answers) {\n                if (docId != -1) {\n                    long result = writer().tryDeleteDocument(searcher.getIndexReader(),\n                                                             docId);\n                    if (result >= 0) {\n                        deletedSomething = true;\n                    }\n                }\n            }\n        } catch (Exception ex) {\n        } finally {\n            nrtRelease(searcher);\n        }\n        return deletedSomething;\n    }\n\n    @Override\n    public void rename(final String sourceId,\n                       final Document doc) {\n        final IndexSearcher searcher = nrtSearcher();\n        try {\n            int docId = lookupDocIdByPK(searcher,\n                                        sourceId)[0];\n            if (docId != -1) {\n                writer().tryDeleteDocument(searcher.getIndexReader(),\n                                           docId);\n            }\n            indexDocument(sourceId,\n                          doc);\n        } catch (IOException ex) {\n        } finally {\n            nrtRelease(searcher);\n        }\n    }\n\n    protected int[] lookupDocIdByPK(final IndexSearcher searcher,\n                                    final String... ids) throws IOException {\n        final List<LeafReaderContext> subReaders = searcher.getIndexReader().leaves();\n        final TermsEnum[] termsEnums = new TermsEnum[subReaders.size()];\n        final PostingsEnum[] docsEnums = new PostingsEnum[subReaders.size()];\n        for (int subIDX = 0; subIDX < subReaders.size(); subIDX++) {\n            termsEnums[subIDX] = subReaders.get(subIDX).reader().fields().terms(\"id\").iterator();\n        }\n\n        int[] results = new int[ids.length];\n\n        for (int i = 0; i < results.length; i++) {\n            results[i] = -1;\n        }\n\n        // for each id given\n        for (int idx = 0; idx < ids.length; idx++) {\n            int base = 0;\n            final BytesRef id = new BytesRef(ids[idx]);\n            // for each leaf reader..\n            for (int subIDX = 0; subIDX < subReaders.size(); subIDX++) {\n                final LeafReader subReader = subReaders.get(subIDX).reader();\n                final TermsEnum termsEnum = termsEnums[subIDX];\n                // does the enumeration of (\"id\") terms from our reader contain the \"id\" field we're looking for?\n                if (termsEnum.seekExact(id)) {\n                    final PostingsEnum docs = docsEnums[subIDX] = termsEnum.postings(docsEnums[subIDX],\n                                                                                     0);\n                    // okay, the reader contains it, get the postings (\"docs+\") for and check that they're there (NP check)\n                    if (docs != null) {\n                        final int docID = docs.nextDoc();\n                        Bits liveDocs = subReader.getLiveDocs();\n                        // But wait, maybe some of the docs have been deleted! Check that too..\n                        if ((liveDocs == null || liveDocs.get(docID)) && docID != DocIdSetIterator.NO_MORE_DOCS) {\n                            results[idx] = base + docID;\n                            break;\n                        }\n                    }\n                }\n                base += subReader.maxDoc();\n            }\n        }\n\n        return results;\n    }\n\n    public abstract IndexWriter writer();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/CustomAnalyzerWrapperFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.backend.lucene.index;\n\nimport java.util.Map;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.uberfire.ext.metadata.backend.lucene.analyzer.FilenameAnalyzer;\n\n/**\n * This factory allows us to extend the granularity used when configuring {@link Analyzer} instances.\n * </p>\n * For example, with normal configuration, {@link Analyzer}s can only be applied to fields that start with a pre-defined prefix.\n * <ul>\n * <li>For example: use the {@link FilenameAnalyzer} for all fields with the key \"projectRoot\"\n * </ul>\n * However, you can not use regular expressions when configuring {@link Analyzer}s normally, which means that it is impossible\n * to configure an analyzer if you have a set of fields that have a pre-defined <em>prefix</em> but a dynamically-determined\n * suffix (and we have that for change impact).\n * </p>\n * This factory allows us to define our own {@link Analyzer} which can have its own logic to deal with this problem.\n * </p>\n * This is then the primary {@link Analyzer} defined for the Lucene engine. If the logic in this (wrapper) {@link Analyzer}\n * does not match a field, it then delegates the field to the {@link Analyzer}s defined in the <code>fieldAnalyzer</code> parameter.\n * </p>\n * (At least, that's an example of what it can and should do, but that's up to the implementation details).\n * @see LuceneConfigBuilder#withDefaultAnalyzer()\n * @see LuceneConfigBuilder#usingAnalyzerWrapperFactory(CustomAnalyzerWrapperFactory)\n */\npublic interface CustomAnalyzerWrapperFactory {\n\n    public Analyzer getAnalyzerWrapper(Analyzer defaultAnalyzer,\n                                       Map<String, Analyzer> fieldAnalyzers);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/LuceneIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index;\n\nimport org.apache.lucene.document.Document;\nimport org.apache.lucene.index.IndexReader;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.uberfire.ext.metadata.engine.Index;\n\n/**\n *\n */\npublic interface LuceneIndex extends Index {\n\n    public static final String CUSTOM_FIELD_FILENAME = \"filename\";\n\n    void indexDocument(final String id,\n                       final Document doc);\n\n    boolean deleteIfExists(final String... ids);\n\n    void rename(final String sourceId,\n                final Document doc);\n\n    IndexReader nrtReader();\n\n    void nrtRelease(final IndexReader searcher);\n\n    IndexSearcher nrtSearcher();\n\n    void nrtRelease(final IndexSearcher searcher);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/LuceneIndexFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index;\n\nimport java.util.Map;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.ext.metadata.model.KCluster;\n\npublic interface LuceneIndexFactory extends Disposable {\n\n    LuceneIndex newCluster(KCluster kcluster);\n\n    void remove(KCluster cluster);\n\n    Map<? extends KCluster, ? extends LuceneIndex> getIndexes();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/LuceneIndexManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.stream.Collectors;\n\nimport org.apache.lucene.index.IndexReader;\nimport org.apache.lucene.index.MultiReader;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.apache.lucene.search.SearcherFactory;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.engine.Index;\nimport org.uberfire.ext.metadata.engine.IndexManager;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class LuceneIndexManager implements IndexManager {\n\n    private final LuceneIndexFactory factory;\n    private final Map<KCluster, LuceneIndex> indexes = new ConcurrentHashMap<KCluster, LuceneIndex>();\n\n    public LuceneIndexManager(final LuceneIndexFactory factory) {\n        this.factory = checkNotNull(\"factory\",\n                                    factory);\n        this.indexes.putAll(factory.getIndexes());\n    }\n\n    @Override\n    public boolean contains(final KCluster cluster) {\n        return indexes.containsKey(cluster);\n    }\n\n    @Override\n    public synchronized LuceneIndex indexOf(final KObjectKey object) {\n        final KCluster kcluster = kcluster(object);\n        final LuceneIndex currentSetup = indexes.get(kcluster);\n        if (currentSetup != null) {\n            return currentSetup;\n        }\n\n        final LuceneIndex index = factory.newCluster(kcluster);\n        indexes.put(kcluster,\n                    index);\n        return index;\n    }\n\n    @Override\n    public KCluster kcluster(final KObjectKey object) {\n        return new KClusterImpl(object.getClusterId());\n    }\n\n    @Override\n    public void delete(KCluster cluster) {\n        final LuceneIndex setup = indexes.remove(cluster);\n        factory.remove(cluster);\n        if (setup != null) {\n            setup.delete();\n        } else {\n            deleteProjectIndexes(cluster);\n        }\n    }\n\n    protected void deleteProjectIndexes(KCluster cluster) {\n        final List<KCluster> clusters = indexes.keySet().stream().parallel()\n                .filter(s -> s.getClusterId().startsWith(cluster.getClusterId()))\n                .collect(Collectors.toList());\n        clusters.forEach(cl -> {\n            final LuceneIndex setup = indexes.remove(cl);\n            factory.remove(cl);\n            if (setup != null) {\n                setup.delete();\n            }\n        });\n    }\n\n    @Override\n    public void dispose() {\n        for (final LuceneIndex index : indexes.values()) {\n            index.dispose();\n        }\n        factory.dispose();\n    }\n\n    @Override\n    public Index get(KCluster cluster) {\n        return indexes.get(cluster);\n    }\n\n    public IndexSearcher getIndexSearcher(final ClusterSegment... clusterSegments) {\n        final Set<KCluster> clusters;\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            clusters = new HashSet<KCluster>(indexes.keySet());\n        } else {\n            clusters = new HashSet<KCluster>(clusterSegments.length);\n            for (final ClusterSegment clusterSegment : clusterSegments) {\n                clusters.add(new KClusterImpl(clusterSegment.getClusterId()));\n            }\n        }\n\n        final Collection<IndexReader> readers = new ArrayList<IndexReader>(clusters.size());\n        for (final KCluster cluster : clusters) {\n            final LuceneIndex index = indexes.get(cluster);\n            readers.add(index.nrtReader());\n        }\n\n        try {\n            return new SearcherFactory().newSearcher(new MultiReader(readers.toArray(new IndexReader[readers.size()])),\n                                                     null);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public void release(final IndexSearcher index) {\n        try {\n            index.getIndexReader().close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public List<String> getIndices() {\n        return indexes.keySet().stream().map(kCluster -> kCluster.getClusterId()).collect(Collectors.toList());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/directory/DeleteCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\npublic interface DeleteCommand {\n\n    public void execute(org.apache.lucene.store.Directory directory);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/directory/Directory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\nimport java.io.IOException;\n\npublic class Directory {\n\n    private final boolean fresh;\n    private final DeleteCommand command;\n\n    private org.apache.lucene.store.Directory directory;\n\n    public Directory(final org.apache.lucene.store.Directory directory,\n                     final DeleteCommand command,\n                     final boolean fresh) {\n        this.directory = directory;\n        this.command = command;\n        this.fresh = fresh;\n    }\n\n    public org.apache.lucene.store.Directory getDirectory() {\n        return directory;\n    }\n\n    public void close() {\n        try {\n            directory.close();\n        } catch (final IOException e) {\n            throw new org.uberfire.java.nio.IOException(e);\n        }\n    }\n\n    public boolean freshIndex() {\n        return fresh;\n    }\n\n    public void delete() {\n        command.execute(directory);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/directory/DirectoryFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\nimport java.io.File;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.stream.Stream;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.codecs.Codec;\nimport org.apache.lucene.codecs.PostingsFormat;\nimport org.apache.lucene.codecs.lucene62.Lucene62Codec;\nimport org.apache.lucene.index.IndexWriterConfig;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndex;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndexFactory;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.model.KCluster;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class DirectoryFactory implements LuceneIndexFactory {\n\n    private static final String REPOSITORIES_ROOT_DIR = \".index\";\n    public static final String CLUSTER_ID_SEGMENT_SEPARATOR = \"/\";\n\n    private final Map<KCluster, LuceneIndex> clusters = new ConcurrentHashMap<>();\n    private final DirectoryType type;\n    private final Analyzer analyzer;\n\n    public DirectoryFactory(final DirectoryType type,\n                            final Analyzer analyzer) {\n        this(type,\n             analyzer,\n             defaultHostingDir());\n    }\n\n    public DirectoryFactory(final DirectoryType type,\n                            final Analyzer analyzer,\n                            final File hostingDir) {\n        this.analyzer = analyzer;\n        this.type = type;\n        this.loadIndexes(type,\n                         analyzer,\n                         hostingDir);\n    }\n\n    protected void loadIndexes(DirectoryType type,\n                               Analyzer analyzer,\n                               File hostingDir) {\n        listFiles(hostingDir)\n                .filter(File::isDirectory)\n                .flatMap(file -> listFiles(file))\n                .filter(File::isDirectory)\n                .flatMap(file -> listFiles(file))\n                .map(file -> new KClusterImpl(clusterIdOf(file)))\n                .forEach(cluster -> clusters.put(cluster,\n                                                 type.newIndex(cluster,\n                                                               newConfig(analyzer))));\n    }\n\n    protected static String clusterIdOf(File file) {\n        return file.getParentFile().getParentFile().getName() + CLUSTER_ID_SEGMENT_SEPARATOR +\n                file.getParentFile().getName() + CLUSTER_ID_SEGMENT_SEPARATOR +\n                file.getName();\n    }\n\n    private Stream<File> listFiles(final File hostingDir) {\n        final File[] files = hostingDir.listFiles();\n        return (files == null) ? Stream.empty() : Arrays.stream(files);\n    }\n\n    public static File defaultHostingDir() {\n        final String value = System.getProperty(\"org.uberfire.metadata.index.dir\");\n        if (value == null || value.trim().isEmpty()) {\n            return new File(REPOSITORIES_ROOT_DIR);\n        } else {\n            return new File(value.trim(),\n                            REPOSITORIES_ROOT_DIR);\n        }\n    }\n\n    private IndexWriterConfig newConfig(final Analyzer analyzer) {\n        final IndexWriterConfig config = new IndexWriterConfig(analyzer);\n        final Codec codec = new Lucene62Codec() {\n            @Override\n            public PostingsFormat getPostingsFormatForField(String field) {\n                if (field.equals(\"id\")) {\n                    return PostingsFormat.forName(\"Memory\");\n                } else {\n                    return PostingsFormat.forName(\"Lucene50\");\n                }\n            }\n        };\n        config.setCodec(codec);\n\n        return config;\n    }\n\n    @Override\n    public LuceneIndex newCluster(final KCluster kcluster) {\n        checkCondition(\"Cluster already exists\",\n                       !clusters.containsKey(checkNotNull(\"kcluster\",\n                                                          kcluster)));\n\n        final LuceneIndex newIndex = type.newIndex(kcluster,\n                                                   newConfig(analyzer));\n        clusters.put(kcluster,\n                     newIndex);\n\n        return newIndex;\n    }\n\n    @Override\n    public void remove(KCluster cluster) {\n        clusters.remove(cluster);\n    }\n\n    @Override\n    public Map<? extends KCluster, ? extends LuceneIndex> getIndexes() {\n        return Collections.unmodifiableMap(clusters);\n    }\n\n    @Override\n    public synchronized void dispose() {\n        for (final LuceneIndex luceneIndex : clusters.values()) {\n            luceneIndex.dispose();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/directory/DirectoryLuceneIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\nimport java.io.IOException;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport org.apache.lucene.index.DirectoryReader;\nimport org.apache.lucene.index.IndexReader;\nimport org.apache.lucene.index.IndexWriter;\nimport org.apache.lucene.index.IndexWriterConfig;\nimport org.apache.lucene.index.SerialMergeScheduler;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.apache.lucene.search.SearcherFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.BaseLuceneIndex;\nimport org.uberfire.ext.metadata.model.KCluster;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n *\n */\npublic class DirectoryLuceneIndex extends BaseLuceneIndex {\n\n    private final KCluster cluster;\n    private final IndexWriter writer;\n    private final Directory directory;\n    private AtomicBoolean freshIndex;\n    private AtomicBoolean isDisposed = new AtomicBoolean(false);\n\n    public DirectoryLuceneIndex(final KCluster cluster,\n                                final Directory directory,\n                                final IndexWriterConfig config) {\n        try {\n\n            config.setMergeScheduler(new SerialMergeScheduler());\n\n            this.cluster = checkNotNull(\"cluster\",\n                                        cluster);\n            this.directory = checkNotNull(\"directory\",\n                                          directory);\n            this.writer = new IndexWriter(directory.getDirectory(),\n                                          config);\n            this.freshIndex = new AtomicBoolean(directory.freshIndex());\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    @Override\n    public IndexWriter writer() {\n        return writer;\n    }\n\n    @Override\n    public KCluster getCluster() {\n        return cluster;\n    }\n\n    @Override\n    public IndexReader nrtReader() {\n        try {\n            return DirectoryReader.open(writer);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void nrtRelease(final IndexReader reader) {\n        try {\n            reader.close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public IndexSearcher nrtSearcher() {\n        try {\n            return new SearcherFactory().newSearcher(nrtReader(),\n                                                     null);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void nrtRelease(final IndexSearcher searcher) {\n        try {\n            searcher.getIndexReader().close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void dispose() {\n        if (isDisposed.get()) {\n            return;\n        }\n        closeWriter();\n        directory.close();\n        isDisposed.set(true);\n    }\n\n    private void closeWriter() {\n        try {\n            writer.commit();\n            writer.close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean freshIndex() {\n        return freshIndex.get();\n    }\n\n    @Override\n    public void commit() {\n        try {\n            writer.commit();\n            freshIndex.set(false);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void delete() {\n        closeWriter();\n        directory.delete();\n        isDisposed.set(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/index/directory/DirectoryType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\nimport java.io.File;\nimport java.io.IOException;\n\nimport org.apache.commons.io.FileDeleteStrategy;\nimport org.apache.lucene.index.IndexWriterConfig;\nimport org.apache.lucene.store.FSDirectory;\nimport org.apache.lucene.store.MMapDirectory;\nimport org.apache.lucene.store.NIOFSDirectory;\nimport org.apache.lucene.store.RAMDirectory;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndex;\nimport org.uberfire.ext.metadata.model.KCluster;\n\npublic enum DirectoryType {\n\n    INMEMORY {\n        @Override\n        public LuceneIndex newIndex(final KCluster cluster,\n                                    final IndexWriterConfig config) {\n            final Directory directory = new Directory(new RAMDirectory(),\n                                                      new DeleteCommand() {\n                                                          @Override\n                                                          public void execute(org.apache.lucene.store.Directory directory) {\n                                                          }\n                                                      },\n                                                      true);\n            return new DirectoryLuceneIndex(cluster,\n                                            directory,\n                                            config);\n        }\n    },\n    NIO {\n        @Override\n        public LuceneIndex newIndex(final KCluster cluster,\n                                    final IndexWriterConfig config) {\n\n            final File clusterDir = clusterDir(cluster.getClusterId());\n            final NIOFSDirectory luceneDir;\n            try {\n                luceneDir = new NIOFSDirectory(clusterDir.toPath());\n            } catch (IOException e) {\n                throw new org.uberfire.java.nio.IOException(e);\n            }\n\n            final Directory directory = new Directory(luceneDir,\n                                                      new DeleteCommand() {\n                                                          @Override\n                                                          public void execute(org.apache.lucene.store.Directory directory) {\n                                                              close((NIOFSDirectory) directory);\n                                                              FileDeleteStrategy.FORCE.deleteQuietly(clusterDir);\n                                                          }\n                                                      },\n                                                      freshIndex(clusterDir));\n\n            return new DirectoryLuceneIndex(cluster,\n                                            directory,\n                                            config);\n        }\n    },\n    MMAP {\n        @Override\n        public LuceneIndex newIndex(final KCluster cluster,\n                                    final IndexWriterConfig config) {\n            final File clusterDir = clusterDir(cluster.getClusterId());\n            final MMapDirectory luceneDir;\n            try {\n                luceneDir = new MMapDirectory(clusterDir.toPath());\n            } catch (IOException e) {\n                throw new org.uberfire.java.nio.IOException(e);\n            }\n            final Directory directory = new Directory(luceneDir,\n                                                      new DeleteCommand() {\n                                                          @Override\n                                                          public void execute(org.apache.lucene.store.Directory directory) {\n                                                              close((MMapDirectory) directory);\n                                                              FileDeleteStrategy.FORCE.deleteQuietly(clusterDir);\n                                                          }\n                                                      },\n                                                      freshIndex(clusterDir));\n\n            return new DirectoryLuceneIndex(cluster,\n                                            directory,\n                                            config);\n        }\n    };\n\n    private static void close(FSDirectory directory) {\n        try {\n            directory.close();\n        } catch (IOException e) {\n            logger.warn(\"Can't close directory\",\n                        e);\n        }\n    }\n\n    private static File clusterDir(final String clusterId) {\n        return new File(DirectoryFactory.defaultHostingDir(),\n                        clusterId);\n    }\n\n    private static Logger logger = LoggerFactory.getLogger(DirectoryType.class);\n\n    private static boolean freshIndex(final File clusterDir) {\n        return !clusterDir.exists();\n    }\n\n    public abstract LuceneIndex newIndex(final KCluster cluster,\n                                         final IndexWriterConfig config);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/model/KClusterImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.model;\n\nimport org.uberfire.ext.metadata.model.KCluster;\n\npublic class KClusterImpl implements KCluster {\n\n    private final String clusterId;\n\n    public KClusterImpl(final String clusterId) {\n        this.clusterId = clusterId;\n    }\n\n    @Override\n    public String getClusterId() {\n        return clusterId;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof KClusterImpl)) {\n            return false;\n        }\n\n        KClusterImpl kCluster = (KClusterImpl) o;\n\n        if (!clusterId.equals(kCluster.clusterId)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return clusterId.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return \"KClusterImpl [clusterId=\" + clusterId + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/provider/LuceneIndexProvider.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.provider;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.apache.lucene.document.Document;\nimport org.apache.lucene.document.Field;\nimport org.apache.lucene.document.StringField;\nimport org.apache.lucene.document.TextField;\nimport org.apache.lucene.index.IndexableField;\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.ScoreDoc;\nimport org.apache.lucene.search.Sort;\nimport org.apache.lucene.search.TermQuery;\nimport org.apache.lucene.search.TopDocs;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndex;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndexManager;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.engine.Index;\nimport org.uberfire.ext.metadata.engine.IndexManager;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.ext.metadata.backend.lucene.util.KObjectUtil.toKObject;\nimport static org.uberfire.ext.metadata.engine.MetaIndexEngine.FULL_TEXT_FIELD;\n\npublic class LuceneIndexProvider implements IndexProvider {\n\n    private final FieldFactory fieldFactory;\n    private IndexManager indexManager;\n\n    public LuceneIndexProvider(IndexManager indexManager,\n                               FieldFactory fieldFactory) {\n        this.indexManager = indexManager;\n        this.fieldFactory = fieldFactory;\n    }\n\n    @Override\n    public boolean isFreshIndex(final KCluster cluster) {\n        final Index index = indexManager.get(cluster);\n        return index == null || index.freshIndex();\n    }\n\n    @Override\n    public void index(KObject object) {\n        final LuceneIndex index = (LuceneIndex) indexManager.indexOf(object);\n        index.indexDocument(object.getId(),\n                            newDocument(object));\n        index.commit();\n    }\n\n    @Override\n    public void index(List<KObject> elements) {\n        elements.forEach(ko -> {\n            final LuceneIndex index = (LuceneIndex) indexManager.indexOf(ko);\n            index.indexDocument(ko.getId(),\n                                newDocument(ko));\n        });\n        elements.stream()\n                .map(ko -> (LuceneIndex) indexManager.indexOf(ko))\n                .collect(Collectors.toSet())\n                .forEach(luceneIndex -> luceneIndex.commit());\n    }\n\n    @Override\n    public boolean exists(String index,\n                          String id) {\n        return this.findById(index,\n                             id).size() > 0;\n    }\n\n    @Override\n    public void delete(String index) {\n        indexManager.delete(new KClusterImpl(index));\n    }\n\n\n    @Override\n    public void delete(String index,\n                       String id) {\n        final LuceneIndex luceneIndex = (LuceneIndex) indexManager.get(new KClusterImpl(index));\n        luceneIndex.deleteIfExists(id);\n        luceneIndex.commit();\n    }\n\n    @Override\n    public List<KObject> findById(String index,\n                                  String id) {\n        List<String> indices = Arrays.asList(index);\n        ScoreDoc[] docs = this.findRawByQuery(indices,\n                                              new TermQuery(new Term(\"id\",\n                                                                     id)),\n                                              null,\n                                              0);\n\n        return Arrays.stream(docs)\n                .map(scoreDoc -> createKObject(indices,\n                                               scoreDoc))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public void rename(String index,\n                       String id,\n                       KObject to) {\n        checkNotNull(\"from\",\n                     index);\n        checkNotNull(\"to\",\n                     to);\n        checkCondition(\"renames are allowed only from same cluster\",\n                       index.equals(to.getClusterId()));\n        LuceneIndex luceneIndex = ((LuceneIndex) indexManager.get(new KClusterImpl(index)));\n        luceneIndex.rename(id,\n                           newDocument(to));\n    }\n\n    @Override\n    public long getIndexSize(String index) {\n        LuceneIndex luceneIndex = ((LuceneIndex) indexManager.get(new KClusterImpl(index)));\n        return luceneIndex.nrtReader().numDocs();\n    }\n\n    @Override\n    public List<KObject> findByQuery(List<String> indices,\n                                     Query query,\n                                     int limit) {\n\n        ScoreDoc[] docs = this.findRawByQuery(indices,\n                                              query,\n                                              null,\n                                              0);\n\n        return Arrays.stream(docs)\n                .map(scoreDoc -> createKObject(indices,\n                                               scoreDoc))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public List<KObject> findByQuery(List<String> indices,\n                                     Query query,\n                                     Sort sort,\n                                     int limit) {\n        ScoreDoc[] docs = this.findRawByQuery(indices,\n                                              query,\n                                              sort,\n                                              0);\n\n        return Arrays.stream(docs)\n                .map(scoreDoc -> createKObject(indices,\n                                               scoreDoc))\n                .collect(Collectors.toList());\n    }\n\n    private KObject createKObject(List<String> indices,\n                                  ScoreDoc scoreDoc) {\n        try {\n            IndexSearcher searcher = ((LuceneIndexManager) indexManager)\n                    .getIndexSearcher(toClusterSegments(indices));\n            return toKObject(searcher.doc(scoreDoc.doc));\n        } catch (IOException e) {\n            throw new RuntimeException(\"Can't convert document to KObject\");\n        }\n    }\n\n    @Override\n    public long findHitsByQuery(List<String> indices,\n                                Query query) {\n\n        return this.findRawByQuery(indices,\n                                   query,\n                                   null,\n                                   0).length;\n    }\n\n    @Override\n    public List<String> getIndices() {\n        return this.indexManager.getIndices();\n    }\n\n    @Override\n    public void observerInitialization(Runnable runnable) {\n        // Do nothing\n    }\n\n    @Override\n    public boolean isAlive() {\n        return true;\n    }\n\n    public ScoreDoc[] findRawByQuery(List<String> indices,\n                                     Query query,\n                                     Sort sort,\n                                     int limit) {\n\n        try {\n            ClusterSegment[] clusterSegments = toClusterSegments(indices);\n            IndexSearcher searcher = ((LuceneIndexManager) indexManager).getIndexSearcher(clusterSegments);\n            int n = Integer.MAX_VALUE;\n            if (limit > 0) {\n                n = limit;\n            }\n            TopDocs topDocs;\n            if (sort != null) {\n                topDocs = searcher.search(query,\n                                          n,\n                                          sort);\n            } else {\n                topDocs = searcher.search(query,\n                                          n);\n            }\n            return topDocs.scoreDocs;\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n\n        return new ScoreDoc[0];\n    }\n\n    private ClusterSegment[] toClusterSegments(List<String> indices) {\n        return indices.stream().map(index -> new ClusterSegment() {\n\n            @Override\n            public String getClusterId() {\n                return index;\n            }\n\n            @Override\n            public String[] segmentIds() {\n                return new String[0];\n            }\n        }).toArray(size -> new ClusterSegment[size]);\n    }\n\n    @Override\n    public void dispose() {\n\n    }\n\n    private Document newDocument(final KObject object) {\n        final Document doc = new Document();\n\n        doc.add(new StringField(MetaObject.META_OBJECT_ID,\n                                object.getId(),\n                                Field.Store.YES));\n        doc.add(new StringField(MetaObject.META_OBJECT_TYPE,\n                                object.getType().getName(),\n                                Field.Store.YES));\n        doc.add(new TextField(MetaObject.META_OBJECT_KEY,\n                              object.getKey(),\n                              Field.Store.YES));\n        doc.add(new StringField(MetaObject.META_OBJECT_CLUSTER_ID,\n                                object.getClusterId(),\n                                Field.Store.YES));\n        doc.add(new StringField(MetaObject.META_OBJECT_SEGMENT_ID,\n                                object.getSegmentId(),\n                                Field.Store.YES));\n\n        final StringBuilder allText = new StringBuilder(object.getKey()).append('\\n');\n\n        for (final KProperty<?> property : object.getProperties()) {\n            final IndexableField[] fields = fieldFactory.build(property);\n            for (final IndexableField field : fields) {\n                doc.add(field);\n                if (field instanceof TextField && !(property.getValue() instanceof Boolean)) {\n                    allText.append(field.stringValue()).append('\\n');\n                }\n            }\n        }\n\n        //Only create a \"full text\" entry if required\n        if (object.fullText()) {\n            doc.add(new TextField(FULL_TEXT_FIELD,\n                                  allText.toString().toLowerCase(),\n                                  Field.Store.NO));\n        }\n\n        return doc;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/search/LuceneSearchIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.search;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.queryparser.classic.ParseException;\nimport org.apache.lucene.queryparser.classic.QueryParser;\nimport org.apache.lucene.search.BooleanClause;\nimport org.apache.lucene.search.BooleanQuery;\nimport org.apache.lucene.search.IndexSearcher;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.ScoreDoc;\nimport org.apache.lucene.search.TermQuery;\nimport org.apache.lucene.search.TopScoreDocCollector;\nimport org.apache.lucene.search.TotalHitCountCollector;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndexManager;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\nimport org.uberfire.ext.metadata.search.DateRange;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.ext.metadata.search.SearchIndex;\n\nimport static java.util.Collections.emptyList;\nimport static org.apache.lucene.search.BooleanClause.Occur.MUST;\nimport static org.apache.lucene.search.BooleanClause.Occur.SHOULD;\nimport static org.apache.lucene.search.LegacyNumericRangeQuery.newLongRange;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.ext.metadata.backend.lucene.util.KObjectUtil.toKObject;\nimport static org.uberfire.ext.metadata.engine.MetaIndexEngine.FULL_TEXT_FIELD;\n\n/**\n *\n */\npublic class LuceneSearchIndex implements SearchIndex {\n\n    private final LuceneIndexManager indexManager;\n    private final QueryParser queryParser;\n\n    public LuceneSearchIndex(final LuceneIndexManager indexManager,\n                             final Analyzer analyzer) {\n        this.indexManager = checkNotNull(\"lucene\",\n                                         indexManager);\n        this.queryParser = new QueryParser(FULL_TEXT_FIELD,\n                                           analyzer);\n        this.queryParser.setAllowLeadingWildcard(true);\n    }\n\n    @Override\n    public List<KObject> searchByAttrs(final Map<String, ?> attrs,\n                                       final IOSearchService.Filter filter,\n                                       final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return emptyList();\n        }\n        if (attrs == null || attrs.size() == 0) {\n            return emptyList();\n        }\n        final int totalNumHitsEstimate = searchByAttrsHits(attrs,\n                                                           clusterSegments);\n        return search(buildQuery(attrs,\n                                 clusterSegments),\n                      totalNumHitsEstimate,\n                      filter,\n                      clusterSegments);\n    }\n\n    @Override\n    public List<KObject> fullTextSearch(final String term,\n                                        final IOSearchService.Filter filter,\n                                        final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return emptyList();\n        }\n        final int totalNumHitsEstimate = fullTextSearchHits(term,\n                                                            clusterSegments);\n        return search(buildQuery(term,\n                                 clusterSegments),\n                      totalNumHitsEstimate,\n                      filter,\n                      clusterSegments);\n    }\n\n    @Override\n    public int searchByAttrsHits(final Map<String, ?> attrs,\n                                 final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return 0;\n        }\n        if (attrs == null || attrs.size() == 0) {\n            return 0;\n        }\n        return searchHits(buildQuery(attrs,\n                                     clusterSegments),\n                          clusterSegments);\n    }\n\n    @Override\n    public int fullTextSearchHits(final String term,\n                                  final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return 0;\n        }\n        return searchHits(buildQuery(term,\n                                     clusterSegments),\n                          clusterSegments);\n    }\n\n    private int searchHits(final Query query,\n                           final ClusterSegment... clusterSegments) {\n        final IndexSearcher index = indexManager.getIndexSearcher(clusterSegments);\n        try {\n            final TotalHitCountCollector collector = new TotalHitCountCollector();\n            index.search(query,\n                         collector);\n            return collector.getTotalHits();\n        } catch (final Exception ex) {\n            throw new RuntimeException(\"Error during Query!\",\n                                       ex);\n        } finally {\n            indexManager.release(index);\n        }\n    }\n\n    private List<KObject> search(final Query query,\n                                 final int totalNumHitsEstimate,\n                                 final IOSearchService.Filter filter,\n                                 final ClusterSegment... clusterSegments) {\n        final TopScoreDocCollector collector = TopScoreDocCollector.create(totalNumHitsEstimate);\n        final IndexSearcher index = indexManager.getIndexSearcher(clusterSegments);\n        final List<KObject> result = new ArrayList<KObject>();\n        try {\n            index.search(query,\n                         collector);\n            final ScoreDoc[] hits = collector.topDocs(0).scoreDocs;\n            for (int i = 0; i < hits.length; i++) {\n                final KObject kObject = toKObject(index.doc(hits[i].doc));\n                if (filter.accept(kObject)) {\n                    result.add(kObject);\n                }\n            }\n        } catch (final Exception ex) {\n            throw new RuntimeException(\"Error during Query!\",\n                                       ex);\n        } finally {\n            indexManager.release(index);\n        }\n\n        return result;\n    }\n\n    private Query buildQuery(final Map<String, ?> attrs,\n                             final ClusterSegment... clusterSegments) {\n        final BooleanQuery.Builder query = new BooleanQuery.Builder();\n        for (final Map.Entry<String, ?> entry : attrs.entrySet()) {\n            if (entry.getValue() instanceof DateRange) {\n                final Long from = ((DateRange) entry.getValue()).after().getTime();\n                final Long to = ((DateRange) entry.getValue()).before().getTime();\n                query.add(newLongRange(entry.getKey(),\n                                       from,\n                                       to,\n                                       true,\n                                       true),\n                          MUST);\n            } else if (entry.getValue() instanceof String) {\n                query.add(new WildcardQuery(new Term(entry.getKey(),\n                                                     entry.getValue().toString())),\n                          MUST);\n            } else if (entry.getValue() instanceof Boolean) {\n                query.add(new TermQuery(new Term(entry.getKey(),\n                                                 ((Boolean) entry.getValue()) ? \"0\" : \"1\")),\n                          MUST);\n            }\n        }\n        return composeQuery(query.build(),\n                            clusterSegments);\n    }\n\n    private Query buildQuery(final String term,\n                             final ClusterSegment... clusterSegments) {\n\n        Query fullText;\n        try {\n            fullText = queryParser.parse(term);\n            if (fullText.toString().isEmpty()) {\n                fullText = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                      format(term) + \"*\"));\n            }\n        } catch (ParseException ex) {\n            fullText = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                  format(term)));\n        }\n\n        return composeQuery(fullText,\n                            clusterSegments);\n    }\n\n    private Query composeQuery(final Query query,\n                               final ClusterSegment... clusterSegments) {\n        if (clusterSegments == null || clusterSegments.length == 0) {\n            return query;\n        }\n\n        final BooleanQuery.Builder booleanQuery = new BooleanQuery.Builder();\n        booleanQuery.add(query,\n                         MUST);\n\n        final BooleanClause.Occur occur = (clusterSegments.length == 1 ? MUST : SHOULD);\n        for (ClusterSegment clusterSegment : clusterSegments) {\n            final BooleanQuery.Builder clusterSegmentQuery = new BooleanQuery.Builder();\n            addClusterIdTerms(clusterSegmentQuery,\n                              clusterSegment);\n            addSegmentIdTerms(clusterSegmentQuery,\n                              clusterSegment);\n            booleanQuery.add(clusterSegmentQuery.build(),\n                             occur);\n        }\n\n        return booleanQuery.build();\n    }\n\n    private void addClusterIdTerms(final BooleanQuery.Builder query,\n                                   final ClusterSegment clusterSegment) {\n        if (clusterSegment.getClusterId() != null) {\n            final Query cluster = new TermQuery(new Term(MetaObject.META_OBJECT_CLUSTER_ID,\n                                                         clusterSegment.getClusterId()));\n            query.add(cluster,\n                      MUST);\n        }\n    }\n\n    private void addSegmentIdTerms(final BooleanQuery.Builder query,\n                                   final ClusterSegment clusterSegment) {\n        if (clusterSegment.segmentIds() == null || clusterSegment.segmentIds().length == 0) {\n            return;\n        }\n        if (clusterSegment.segmentIds().length == 1) {\n            final Query segment = new TermQuery(new Term(MetaObject.META_OBJECT_SEGMENT_ID,\n                                                         clusterSegment.segmentIds()[0]));\n            query.add(segment,\n                      MUST);\n        } else {\n            final BooleanQuery.Builder segments = new BooleanQuery.Builder();\n            for (final String segmentId : clusterSegment.segmentIds()) {\n                final Query segment = new TermQuery(new Term(MetaObject.META_OBJECT_SEGMENT_ID,\n                                                             segmentId));\n                segments.add(segment,\n                             SHOULD);\n            }\n            query.add(segments.build(),\n                      MUST);\n        }\n    }\n\n    private String format(final String term) {\n        return term.toLowerCase();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/util/KObjectUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.util;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.lucene.document.Document;\nimport org.apache.lucene.index.IndexableField;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\n\n/**\n *\n */\npublic final class KObjectUtil {\n\n    public static KObject toKObject(final Document document) {\n        return new KObject() {\n\n            @Override\n            public String getId() {\n                return document.get(MetaObject.META_OBJECT_ID);\n            }\n\n            @Override\n            public MetaType getType() {\n                return () -> document.get(MetaObject.META_OBJECT_TYPE);\n            }\n\n            @Override\n            public String getClusterId() {\n                return document.get(MetaObject.META_OBJECT_CLUSTER_ID);\n            }\n\n            @Override\n            public String getSegmentId() {\n                return document.get(MetaObject.META_OBJECT_SEGMENT_ID);\n            }\n\n            @Override\n            public String getKey() {\n                return document.get(MetaObject.META_OBJECT_KEY);\n            }\n\n            @Override\n            public boolean equals(final Object obj) {\n                if (obj == null) {\n                    return false;\n                }\n                if (!(obj instanceof KObject)) {\n                    return false;\n                }\n                final KObject kobj = (KObject) obj;\n                return getClusterId().equals(kobj.getClusterId()) &&\n                        getId().equals(kobj.getId()) &&\n                        getKey().equals(kobj.getKey()) &&\n                        getType().getName().equals(kobj.getType().getName());\n            }\n\n            @Override\n            public int hashCode() {\n                int result = getId().hashCode();\n                result = 31 * result + getClusterId().hashCode();\n                result = 31 * result + getKey().hashCode();\n                result = 31 * result + getType().getName().hashCode();\n                return result;\n            }\n\n            @Override\n            public Iterable<KProperty<?>> getProperties() {\n                final List<KProperty<?>> kProperties = new ArrayList<KProperty<?>>();\n                for (final IndexableField indexableField : document) {\n                    if (isExtension(indexableField.name())) {\n                        kProperties.add(new KProperty<Object>() {\n                            @Override\n                            public String getName() {\n                                return indexableField.name();\n                            }\n\n                            @Override\n                            public Object getValue() {\n                                return indexableField.stringValue();\n                            }\n\n                            @Override\n                            public boolean isSearchable() {\n                                return true;\n                            }\n                        });\n                    }\n                }\n\n                return kProperties;\n            }\n\n            @Override\n            public boolean fullText() {\n                return true;\n            }\n\n            private boolean isExtension(final String name) {\n                return !(name.equals(MetaObject.META_OBJECT_ID) ||\n                        name.equals(MetaObject.META_OBJECT_TYPE) ||\n                        name.equals(MetaObject.META_OBJECT_CLUSTER_ID) ||\n                        name.equals(MetaObject.META_OBJECT_SEGMENT_ID) ||\n                        name.equals(MetaObject.META_OBJECT_KEY));\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/main/java/org/uberfire/ext/metadata/backend/lucene/util/Serializer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.util;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.ObjectInputStream;\nimport java.io.ObjectOutputStream;\n\n/**\n *\n */\npublic final class Serializer {\n\n    private Serializer() {\n    }\n\n    public static byte[] toByteArray(final Object obj)\n            throws IOException {\n        final ByteArrayOutputStream b = new ByteArrayOutputStream();\n        final ObjectOutputStream o = new ObjectOutputStream(b);\n        o.writeObject(obj);\n        return b.toByteArray();\n    }\n\n    public static Object fromByteArray(byte[] bytes)\n            throws IOException, ClassNotFoundException {\n        final ByteArrayInputStream b = new ByteArrayInputStream(bytes);\n        final ObjectInputStream o = new ObjectInputStream(b);\n        return o.readObject();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/test/java/org/uberfire/ext/metadata/backend/lucene/index/LuceneIndexManagerTest.java",
    "content": "package org.uberfire.ext.metadata.backend.lucene.index;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.metadata.model.KCluster;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LuceneIndexManagerTest {\n\n    @Mock\n    LuceneIndexFactory factory;\n\n    LuceneIndexManager luceneIndexManager;\n\n    @Before\n    public void setup() {\n        luceneIndexManager = Mockito.spy(new LuceneIndexManager(factory));\n    }\n\n    @Test\n    public void testDelete() {\n        Map<KCluster, LuceneIndex> mockMap = Mockito.mock(ConcurrentHashMap.class);\n        LuceneIndex index = Mockito.mock(LuceneIndex.class);\n        luceneIndexManager.delete(Mockito.mock(KCluster.class));\n        Mockito.verify(factory).remove(Mockito.any(KCluster.class));\n    }\n\n    @Test\n    public void testProjectDelete() {\n        Map<KCluster, LuceneIndex> mockMap = Mockito.mock(ConcurrentHashMap.class);\n        luceneIndexManager.delete(Mockito.mock(KCluster.class));\n        Mockito.verify(factory).remove(Mockito.any(KCluster.class));\n        Mockito.verify(luceneIndexManager).deleteProjectIndexes(Mockito.any(KCluster.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-backends/uberfire-metadata-backend-lucene/src/test/java/org/uberfire/ext/metadata/backend/lucene/index/directory/DirectoryFactoryTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.backend.lucene.index.directory;\n\nimport java.io.File;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndex;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.model.KCluster;\n\nimport static org.assertj.core.api.Java6Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DirectoryFactoryTest {\n\n    DirectoryFactory factory;\n\n    @Mock\n    DirectoryType type;\n    @Mock\n    Analyzer analyzer;\n    @Mock\n    File hostingDir;\n    @Mock\n    File spaceDir;\n    @Mock\n    File projectDir;\n    @Mock\n    File mainBranchDir;\n    @Mock\n    File developBranchDir;\n\n    @Before\n    public void setup() {\n        when(hostingDir.listFiles()).thenReturn(new File[]{spaceDir});\n\n        when(spaceDir.isDirectory()).thenReturn(true);\n        when(spaceDir.listFiles()).thenReturn(new File[]{projectDir});\n        when(spaceDir.getName()).thenReturn(\"myteam\");\n\n        when(projectDir.isDirectory()).thenReturn(true);\n        when(projectDir.listFiles()).thenReturn(new File[]{mainBranchDir, developBranchDir});\n        when(projectDir.getName()).thenReturn(\"myproject\");\n        when(projectDir.getParentFile()).thenReturn(spaceDir);\n\n        when(mainBranchDir.getName()).thenReturn(\"main\");\n        when(mainBranchDir.getParentFile()).thenReturn(projectDir);\n\n        when(developBranchDir.getName()).thenReturn(\"develop\");\n        when(developBranchDir.getParentFile()).thenReturn(projectDir);\n\n        when(type.newIndex(any(),\n                           any())).thenReturn(mock(LuceneIndex.class));\n\n        factory = new DirectoryFactory(type,\n                                       analyzer,\n                                       hostingDir);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void loadsExistingIndicesOnStartup() throws Exception {\n        KCluster kcluster = new KClusterImpl(\"myteam/myproject/main\");\n        // Should throw error from index existing already.\n        factory.newCluster(kcluster);\n    }\n\n    @Test\n    public void testClusterIdOf() {\n        String clusterId = DirectoryFactory.clusterIdOf(mainBranchDir);\n        assertThat(clusterId).isEqualTo(\"myteam/myproject/main\");\n    }\n\n    @Test\n    public void testLoadIndexes() {\n        this.factory.loadIndexes(type,\n                                 analyzer,\n                                 hostingDir);\n        List<String> indexes = this.factory.getIndexes().keySet().stream().map(KCluster::getClusterId).collect(Collectors.toList());\n        assertThat(indexes).containsExactly(\"myteam/myproject/main\",\n                                            \"myteam/myproject/develop\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-metadata</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-metadata-commons-io</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Metadata Commons IO</name>\n  <description>Uberfire Metadata Commons IO</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>commons-codec</groupId>\n      <artifactId>commons-codec</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-backend-lucene</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-backend-infinispan</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.lucene</groupId>\n      <artifactId>lucene-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-submit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-install</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-bmunit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.arquillian.cube</groupId>\n      <artifactId>arquillian-cube-docker-junit-rule</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.marshalling</groupId>\n      <artifactId>marshalling-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.spotify</groupId>\n      <artifactId>docker-client</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.annotation</groupId>\n          <artifactId>javax.annotation-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.glassfish.hk2.external</groupId>\n          <artifactId>aopalliance-repackaged</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.glassfish.hk2.external</groupId>\n          <artifactId>javax.inject</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>javax.ws.rs</groupId>\n          <artifactId>javax.ws.rs-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.infinispan</groupId>\n      <artifactId>infinispan-client-hotrod</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.spec.javax.transaction</groupId>\n          <artifactId>jboss-transaction-api_1.2_spec</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <testResources>\n      <testResource>\n        <directory>src/test/resources</directory>\n        <filtering>true</filtering>\n      </testResource>\n    </testResources>\n    <plugins>\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>.niogit/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-plugin</artifactId>\n        <configuration>\n          <includes>\n            <include>org.uberfire.ext.metadata.io.common.*</include>\n            <include>org.uberfire.ext.metadata.io.infinispan.suite.*</include>\n            <include>org.uberfire.ext.metadata.io.lucene.*</include>\n          </includes>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/BatchIndex.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Objects;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.ext.metadata.engine.BatchIndexListener;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.Observer;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher.IndexerDispatcherFactory;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.Files.newDirectoryStream;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\npublic final class BatchIndex {\n\n    private static final Logger LOG = LoggerFactory.getLogger(BatchIndex.class);\n\n    private final MetaIndexEngine indexEngine;\n    private final Class<? extends FileAttributeView>[] views;\n    private final AtomicBoolean indexDisposed = new AtomicBoolean(false);\n    private final Observer observer;\n    private final ExecutorService executorService;\n    private final IndexersFactory indexersFactory;\n    private final IndexerDispatcherFactory dispatcherFactory;\n    private final BatchIndexListener batchIndexListener;\n\n    @SafeVarargs\n    public BatchIndex(final MetaIndexEngine indexEngine,\n                      final Observer observer,\n                      final ExecutorService executorService,\n                      final IndexersFactory indexersFactory,\n                      final IndexerDispatcherFactory dispatcherFactory,\n                      final BatchIndexListener batchIndexListener,\n                      final Class<? extends FileAttributeView>... views) {\n        this.indexersFactory = indexersFactory;\n        this.dispatcherFactory = dispatcherFactory;\n        this.indexEngine = checkNotNull(\"indexEngine\",\n                                        indexEngine);\n        this.observer = checkNotNull(\"observer\",\n                                     observer);\n        this.views = views;\n\n        this.batchIndexListener = batchIndexListener;\n\n        this.executorService = executorService;\n    }\n\n    public void runAsync(final FileSystem fs) {\n\n        if (!this.indexEngine.isAlive()) {\n            return;\n        }\n\n        if (fs != null && fs.getRootDirectories().iterator().hasNext()) {\n            executorService.execute(new DescriptiveRunnable() {\n                @Override\n                public String getDescription() {\n                    return \"FS BatchIndex [\" + ((FileSystemId) fs).id() + \"]\";\n                }\n\n                @Override\n                public void run() {\n                    final AtomicBoolean indexFinished = new AtomicBoolean(false);\n                    indexEngine.beforeDispose(() -> {\n                        indexDisposed.set(true);\n\n                        if (!indexFinished.get()) {\n                            fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath)));\n                        }\n                    });\n\n                    try {\n                        BatchIndex.this.run(fs, null);\n                        indexFinished.set(true);\n                    } catch (Exception ex) {\n                        if (!indexDisposed.get()) {\n                            logError(\"FileSystem Index fails. [@\" + fs.toString() + \"]\", ex);\n                        }\n                    }\n                }\n            });\n        }\n    }\n\n    private boolean hasContent(Path dir) {\n        // TODO remove this filter when AF-1073 is resolved\n        try (DirectoryStream<Path> children = newDirectoryStream(dir, path -> !path.endsWith(\"readme.md\"))) {\n            return children.iterator().hasNext();\n        }\n    }\n\n    public void run(final FileSystem fs, final Runnable callback) {\n        if (fs == null) {\n            return;\n        }\n\n        final Collection<Runnable> exceptionCleanup = new ArrayList<>(1);\n        for (Path rootPath : fs.getRootDirectories()) {\n            final KCluster cluster = KObjectUtil.toKCluster(rootPath);\n\n            if (indexEngine.freshIndex(cluster) && hasContent(rootPath)) {\n                indexEngine.prepareBatch(cluster);\n\n                try {\n                    final IndexerDispatcher dispatcher = dispatcherFactory.create(indexersFactory.getIndexers(), cluster);\n\n                    if (indexDisposed.get()) {\n                        break;\n                    }\n                    exceptionCleanup.add(() -> dispatcher.dispose());\n\n                    queueIndexingEvents(rootPath, dispatcher);\n\n                    if (!indexDisposed.get()) {\n                        logInformation(\"Starting indexing of \" + cluster.getClusterId() + \" ...\");\n\n                        if (batchIndexListener != null) {\n                            batchIndexListener.notifyIndexIngStarted(cluster, rootPath);\n                        }\n\n                        dispatcher.schedule(executorService)\n                                .thenRun(() -> {\n                                    logInformation(\"Completed indexing of \" + cluster.getClusterId());\n\n                                    if (batchIndexListener != null) {\n                                        batchIndexListener.notifyIndexIngFinished(cluster, rootPath);\n                                    }\n\n                                    if (callback != null) {\n                                        callback.run();\n                                    }\n                                })\n                                .exceptionally(ex -> {\n                                    try {\n                                        throw ex;\n                                    } catch (DisposedException de) {\n                                        logWarning(\"Batch index couldn't finish. [@\" + cluster.getClusterId() + \"]\");\n                                    } catch (IllegalStateException ise) {\n                                        logError(\"Index fails - Index has an invalid state. [@\" + cluster.getClusterId() + \"]\", ex);\n                                    } catch (Throwable t) {\n                                        logError(\"Index fails. [@\" + cluster.getClusterId() + \"]\", ex);\n                                    }\n                                    return null;\n                                });\n                    } else {\n                        logWarning(\"Batch index couldn't finish. [@\" + cluster.getClusterId() + \"]\");\n                    }\n                } catch (final Exception ex) {\n                    if (indexDisposed.get()) {\n                        logWarning(\"Batch index couldn't finish. [@\" + cluster.getClusterId() + \"]\");\n                    } else {\n                        logError(\"Index fails. [@\" + cluster.getClusterId() + \"]\", ex);\n                        exceptionCleanup.forEach(action -> action.run());\n                    }\n                }\n            }\n        }\n    }\n\n    private void queueIndexingEvents(Path root, final IndexerDispatcher dispatcher) {\n        walkFileTree(checkNotNull(\"root\",\n                                  root),\n                     new SimpleFileVisitor<Path>() {\n\n                         @Override\n                         public FileVisitResult visitFile(final Path file,\n                                                          final BasicFileAttributes attrs) throws IOException {\n                             if (indexDisposed.get()) {\n                                 return FileVisitResult.TERMINATE;\n                             }\n                             try {\n                                 checkNotNull(\"file\",\n                                              file);\n                                 checkNotNull(\"attrs\",\n                                              attrs);\n\n                                 if (!file.getFileName().toString().startsWith(\".\")\n                                         || Objects.equals(file.getFileName().toString(), \".gitkeep\")) {\n\n                                     if (!indexDisposed.get()) {\n                                         dispatcher.offer(new IndexableIOEvent.NewFileEvent(file));\n                                     } else {\n                                         return FileVisitResult.TERMINATE;\n                                     }\n                                 }\n                             } catch (final Exception ex) {\n                                 if (indexDisposed.get()) {\n                                     logWarning(\"Batch index couldn't finish. [@\" + root.toUri().toString() + \"]\");\n                                     return FileVisitResult.TERMINATE;\n                                 } else {\n                                     logError(\"Index fails. [@\" + file.toString() + \"]\",\n                                              ex);\n                                 }\n                             }\n                             if (indexDisposed.get()) {\n                                 return FileVisitResult.TERMINATE;\n                             }\n                             return FileVisitResult.CONTINUE;\n                         }\n                     });\n    }\n\n    private void logInformation(final String message) {\n        observer.information(message);\n        LOG.info(message);\n    }\n\n    private void logWarning(final String message) {\n        observer.warning(message);\n        LOG.warn(message);\n    }\n\n    private void logError(final String message,\n                          final Throwable throwable) {\n        observer.error(message);\n        LOG.error(message,\n                  throwable);\n    }\n\n    public void dispose() {\n        indexEngine.dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/ConstrainedIndexerScheduler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutorService;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler;\nimport org.uberfire.ext.metadata.event.IndexEvent;\n\nimport static java.util.Comparator.comparingInt;\nimport static java.util.concurrent.CompletableFuture.allOf;\nimport static java.util.concurrent.CompletableFuture.supplyAsync;\nimport static java.util.stream.Collectors.toCollection;\nimport static org.uberfire.commons.data.Pair.newPair;\n\n/**\n * Schedules {@link Indexer} jobs asynchronously based on assigned priorites and dependency\n * relations given for indexer IDs.\n *\n * @see ConstraintBuilder#addConstraint(String, String)\n * @see ConstraintBuilder#addPriority(String, int)\n */\npublic class ConstrainedIndexerScheduler implements IndexerScheduler {\n\n    private static final Logger logger = LoggerFactory.getLogger(ConstrainedIndexerScheduler.class);\n\n    private final OrderingGraph<JobNode> graph;\n\n    private ConstrainedIndexerScheduler(OrderingGraph<JobNode> graph) {\n        this.graph = graph;\n    }\n\n    @Override\n    public Stream<CompletableFuture<Pair<String, List<IndexEvent>>>> schedule(ExecutorService executor) {\n        Map<String, CompletableFuture<Pair<String, List<IndexEvent>>>> createdJobs = new HashMap<>();\n\n        return graph.nodesById.values()\n                              .stream()\n                              .sorted(comparingInt(node -> node.priority))\n                              .map(node -> node.id)\n                              .map(id -> schedule(executor, createdJobs, id));\n    }\n\n    private CompletableFuture<Pair<String, List<IndexEvent>>> schedule(ExecutorService executor,\n                                                                       Map<String, CompletableFuture<Pair<String, List<IndexEvent>>>> createdJobs,\n                                                                       String id) {\n        if (createdJobs.containsKey(id)) {\n            logger.debug(\"Job [{}] already scheduled. Returning future.\", id);\n            return createdJobs.get(id);\n        } else {\n            logger.debug(\"Job [{}] not yet scheduled.\", id);\n            final JobNode jobNode = graph.nodesById.get(id);\n            final CompletableFuture<?>[] dependencies =\n                    graph.edgesById.get(id)\n                                   .stream()\n                                   .filter(constraint -> constraint.isFrom(id))\n                                   .map(constraint -> constraint.to)\n                                   .map(dependencyId -> schedule(executor, createdJobs, dependencyId))\n                                   .toArray(n -> new CompletableFuture[n]);\n            logger.debug(\"Dependencies scheduled. Scheduling job for [{}].\", id);\n            final CompletableFuture<Pair<String, List<IndexEvent>>> jobFuture =\n                    allOf(dependencies).thenCompose(ignore -> supplyAsync(jobNode.job, executor).thenApply(events -> newPair(jobNode.id, events)));\n            createdJobs.put(id, jobFuture);\n\n            return jobFuture;\n        }\n    }\n\n    private static class OrderingNode {\n\n        final String id;\n        final int priority;\n\n        OrderingNode(String id, int priority) {\n            this.id = id;\n            this.priority = priority;\n        }\n    }\n\n    private static class JobNode extends OrderingNode {\n\n        final Supplier<List<IndexEvent>> job;\n\n        JobNode(String id, int priority, Supplier<List<IndexEvent>> job) {\n            super(id, priority);\n            this.job = job;\n        }\n    }\n\n    private static class OrderingGraph<T> {\n\n        final Map<String, List<Constraint>> edgesById = new HashMap<>();\n        final Map<String, T> nodesById = new HashMap<>();\n    }\n\n    private static class Constraint {\n        private final String from;\n        private final String to;\n\n        Constraint(String from, String to) {\n            this.from = from;\n            this.to = to;\n        }\n\n        boolean isFrom(String id) {\n            return from.equals(id);\n        }\n    }\n\n    /**\n     * Builder for defining priorities and dependencies of {@link Indexer} jobs.\n     */\n    public static class ConstraintBuilder {\n\n        Map<String, Integer> priorities = new HashMap<>();\n        Map<String, List<Constraint>> constraints = new HashMap<>();\n\n        /**\n         * Assigns a priority to the indexer with the given ID. Lower numbers mean that the\n         * indexer will be scheduled to run earlier (but always after indexers it depends on via {@link #addConstraint(String, String)}).\n         *\n         * @param indexerId The ID of an indexer. Must not be null.\n         * @param priority The priority assigned to this indexer. Lower numbers mean earlier scheduling.\n         * @return This builder. Never null.\n         *\n         * @see #addConstraint(String, String)\n         */\n        public ConstraintBuilder addPriority(String indexerId, int priority) {\n            priorities.put(indexerId, priority);\n            constraints.computeIfAbsent(indexerId, id -> new ArrayList<>());\n            return this;\n        }\n\n        /**\n         * Assigns a constraint where one indexer must run after another indexer.\n         *\n         * @param fromIndexerId The indexer that must complete first. Must not be null.\n         * @param toIndexerId The indexer that must start after the former completes. Must not be null.\n         * @return This builder. Never null.\n         */\n        public ConstraintBuilder addConstraint(String fromIndexerId, String toIndexerId) {\n            Constraint constraint = new Constraint(fromIndexerId, toIndexerId);\n            constraints.computeIfAbsent(fromIndexerId, id -> new ArrayList<>()).add(constraint);\n            constraints.computeIfAbsent(toIndexerId, id -> new ArrayList<>()).add(constraint);\n            return this;\n        }\n\n        public IndexerScheduler.Factory createFactory() {\n            final Set<String> visited = new HashSet<>();\n            final Set<String> visiting = new LinkedHashSet<>();\n            final OrderingGraph<OrderingNode> graph = new OrderingGraph<>();\n\n            populateAndValidateGraph(graph, visited, visiting);\n\n            return new SchedulerFactory(graph);\n        }\n\n        private void populateAndValidateGraph(OrderingGraph<OrderingNode> graph,\n                                              Set<String> visited,\n                                              Set<String> visiting) {\n            for (final String id : constraints.keySet()) {\n                populateAndValidateGraph(graph, visited, visiting, id);\n            }\n        }\n\n        private void populateAndValidateGraph(OrderingGraph<OrderingNode> graph,\n                                              Set<String> visited,\n                                              Set<String> visiting,\n                                              String id) {\n            if (visiting.contains(id)) {\n                throw new IllegalArgumentException(\"Cannot have cycles in constraints: \" + visiting);\n            } else if (!visited.contains(id)) {\n                visiting.add(id);\n                graph.nodesById.put(id, new OrderingNode(id, priorities.getOrDefault(id, 0)));\n                constraints.get(id)\n                           .stream()\n                           .filter(constraint -> constraint.isFrom(id))\n                           .forEach(constraint -> {\n                               graph.edgesById.computeIfAbsent(id, ignore -> new ArrayList<>())\n                                              .add(constraint);\n                               populateAndValidateGraph(graph, visited, visiting, constraint.to);\n                           });\n                visiting.remove(id);\n                visited.add(id);\n            }\n        }\n    }\n\n    private static class SchedulerFactory implements IndexerScheduler.Factory {\n\n        private final OrderingGraph<OrderingNode> graph;\n\n        SchedulerFactory(OrderingGraph<OrderingNode> graph) {\n            this.graph = graph;\n        }\n\n        @Override\n        public IndexerScheduler create(Map<String, ? extends Supplier<List<IndexEvent>>> jobsByIndexerId) {\n            final OrderingGraph<JobNode> jobGraph = new OrderingGraph<>();\n            final Set<String> missingJobs = new HashSet<>();\n            jobsByIndexerId.forEach((id, job) -> {\n                final int priority = Optional.ofNullable(graph.nodesById.get(id)).map(node -> node.priority).orElse(0);\n                jobGraph.nodesById.put(id, new JobNode(id, priority, job));\n                List<Constraint> constraints = graph.edgesById.getOrDefault(id, Collections.emptyList());\n                findMissingDependencies(jobsByIndexerId, missingJobs, id, constraints);\n                copyValidConstraints(jobsByIndexerId, jobGraph, id, constraints);\n            });\n\n            if (missingJobs.isEmpty()) {\n                return new ConstrainedIndexerScheduler(jobGraph);\n            } else {\n                throw new IllegalArgumentException(\"Cannot schedule jobs without missing dependencies: \" + missingJobs);\n            }\n\n        }\n\n        private void copyValidConstraints(Map<String, ? extends Supplier<List<IndexEvent>>> jobsByIndexerId,\n                                          final OrderingGraph<JobNode> jobGraph,\n                                          String id,\n                                          List<Constraint> constraints) {\n            constraints.stream()\n                       .filter(c -> jobsByIndexerId.containsKey(c.from) && jobsByIndexerId.containsKey(c.to))\n                       .collect(toCollection(() -> jobGraph.edgesById.computeIfAbsent(id, ignore -> new ArrayList<>())));\n        }\n\n        private void findMissingDependencies(Map<String, ? extends Supplier<List<IndexEvent>>> jobsByIndexerId,\n                                             Set<String> missingJobs,\n                                             String id,\n                                             List<Constraint> constraints) {\n            constraints.stream()\n                       .filter(c -> c.isFrom(id) && !jobsByIndexerId.containsKey(c.to))\n                       .map(c -> c.to)\n                       .collect(Collectors.toCollection(() -> missingJobs));\n        }\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/CoreIndexer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\npublic class CoreIndexer implements Indexer {\n\n    private final IOService ioService;\n    private final Class<? extends FileAttributeView>[] views;\n\n    @SafeVarargs\n    public CoreIndexer(IOService ioService, Class<? extends FileAttributeView>... views) {\n        this.ioService = ioService;\n        this.views = views;\n    }\n\n    @Override\n    public boolean supportsPath(Path path) {\n        return true;\n    }\n\n    @Override\n    public KObject toKObject(Path path) {\n        if (!ioService.exists(path)) {\n            return null;\n        }\n        //Default indexing\n        for (Class<? extends FileAttributeView> view : views) {\n            ioService.getFileAttributeView(path, view);\n        }\n        final FileAttribute<?>[] attrs = ioService.convert(ioService.readAttributes(path));\n        return KObjectUtil.toKObject(path, attrs);\n    }\n\n    @Override\n    public KObjectKey toKObjectKey(Path path) {\n        return KObjectUtil.toKObjectKey(path);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/DisposedException.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\npublic class DisposedException extends RuntimeException {\n    private static final long serialVersionUID = 1L;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IOSearchServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.ext.metadata.search.SearchIndex;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.SegmentedPath;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.ext.metadata.backend.lucene.index.directory.DirectoryFactory.*;\n\n/**\n *\n */\npublic class IOSearchServiceImpl implements IOSearchService {\n\n    private final SearchIndex searchIndex;\n    private final IOService ioService;\n\n    public IOSearchServiceImpl(final SearchIndex searchIndex,\n                               final IOService ioService) {\n        this.searchIndex = checkNotNull(\"searchIndex\",\n                                        searchIndex);\n        this.ioService = checkNotNull(\"ioService\",\n                                      ioService);\n    }\n\n    @Override\n    public List<Path> searchByAttrs(final Map<String, ?> attrs,\n                                    final Filter filter,\n                                    final Path... roots) {\n        final List<KObject> kObjects = searchIndex.searchByAttrs(attrs,\n                                                                 filter,\n                                                                 buildClusterSegments(roots));\n        return new ArrayList<Path>() {{\n            for (KObject kObject : kObjects) {\n                add(ioService.get(URI.create(kObject.getKey())));\n            }\n        }};\n    }\n\n    @Override\n    public List<Path> fullTextSearch(final String _term,\n                                     final Filter filter,\n                                     final Path... roots) {\n        final String term = checkNotNull(\"term\",\n                                         _term).trim();\n        if (term.isEmpty()) {\n            return Collections.emptyList();\n        }\n        final List<KObject> kObjects = searchIndex.fullTextSearch(term,\n                                                                  filter,\n                                                                  buildClusterSegments(roots));\n        return new ArrayList<Path>() {{\n            for (KObject kObject : kObjects) {\n                add(ioService.get(URI.create(kObject.getKey())));\n            }\n        }};\n    }\n\n    @Override\n    public int searchByAttrsHits(final Map<String, ?> attrs,\n                                 final Path... roots) {\n        return searchIndex.searchByAttrsHits(attrs,\n                                             buildClusterSegments(roots));\n    }\n\n    @Override\n    public int fullTextSearchHits(final String term,\n                                  final Path... roots) {\n        return searchIndex.fullTextSearchHits(term,\n                                              buildClusterSegments(roots));\n    }\n\n    private ClusterSegment[] buildClusterSegments(final Path[] roots) {\n        if (roots == null || roots.length == 0) {\n            return new ClusterSegment[0];\n        }\n        final ClusterSegment[] clusterSegments = new ClusterSegment[roots.length];\n        for (int i = 0; i < roots.length; i++) {\n            final Path root = roots[i];\n            final SegmentedPath segmentedPath = (SegmentedPath) root;\n            final FileSystemId fsId = (FileSystemId) root.getFileSystem();\n            clusterSegments[i] = new ClusterSegment() {\n                @Override\n                public String getClusterId() {\n                    return fsId.id() + CLUSTER_ID_SEGMENT_SEPARATOR + segmentedPath.getSegmentId();\n                }\n\n                @Override\n                public String[] segmentIds() {\n                    return new String[]{segmentedPath.getSegmentId()};\n                }\n            };\n        }\n        return clusterSegments;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IOServiceIndexedImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.net.URI;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ExecutorService;\nimport java.util.stream.Stream;\nimport java.util.stream.StreamSupport;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.ext.metadata.engine.BatchIndexListener;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.Observer;\nimport org.uberfire.ext.metadata.io.IndexableIOEvent.DeletedFileEvent;\nimport org.uberfire.ext.metadata.io.IndexableIOEvent.RenamedFileEvent;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher.IndexerDispatcherFactory;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.io.IOWatchService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FSPath;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.base.dotfiles.DotFileUtils;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.StandardWatchEventKind.ENTRY_CREATE;\nimport static org.uberfire.java.nio.file.StandardWatchEventKind.ENTRY_MODIFY;\n\npublic class IOServiceIndexedImpl extends IOServiceDotFileImpl {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(IOServiceIndexedImpl.class);\n\n    private final MetaIndexEngine indexEngine;\n\n    private final Class<? extends FileAttributeView>[] views;\n    private final Map<String, WatchService> watchServicesByFS = new HashMap<>();\n    private final BatchIndex batchIndex;\n    private final IndexersFactory indexersFactory;\n    private final Collection<IndexerDispatcher> activeIndexerDispatchers = Collections.newSetFromMap(new ConcurrentHashMap<>());\n    private final IndexerDispatcherFactory dispatcherFactory;\n\n    private final ExecutorService fsWatchIndexingExecutorService;\n    private final ExecutorService indexingExecutorService;\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final MetaIndexEngine indexEngine,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final Class<? extends FileAttributeView>... views) {\n        this(indexEngine,\n             new NOPObserver(),\n             indexingExecutorService,\n             fsWatchExecutorService,\n             indexersFactory,\n             dispatcherFactory,\n             new NOPBatchIndexListener(),\n             views);\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final String id,\n                                final MetaIndexEngine indexEngine,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final Class<? extends FileAttributeView>... views) {\n        this(id,\n             indexEngine,\n             new NOPObserver(),\n             indexingExecutorService,\n             fsWatchExecutorService,\n             indexersFactory,\n             dispatcherFactory,\n             new NOPBatchIndexListener(),\n             views);\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final IOWatchService watchService,\n                                final MetaIndexEngine indexEngine,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final Class<? extends FileAttributeView>... views) {\n        this(watchService,\n             indexEngine,\n             new NOPObserver(),\n             indexingExecutorService,\n             fsWatchExecutorService,\n             indexersFactory,\n             dispatcherFactory,\n             new NOPBatchIndexListener(),\n             views);\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final String id,\n                                final IOWatchService watchService,\n                                final MetaIndexEngine indexEngine,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final Class<? extends FileAttributeView>... views) {\n        this(id,\n             watchService,\n             indexEngine,\n             new NOPObserver(),\n             indexingExecutorService,\n             fsWatchExecutorService,\n             indexersFactory,\n             dispatcherFactory,\n             new NOPBatchIndexListener(),\n             views);\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final MetaIndexEngine indexEngine,\n                                final Observer observer,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final BatchIndexListener batchIndexListener,\n                                final Class<? extends FileAttributeView>... views) {\n        super();\n        this.indexEngine = checkNotNull(\"indexEngine\",\n                                        indexEngine);\n        this.views = views;\n\n        this.indexingExecutorService = indexingExecutorService;\n        this.fsWatchIndexingExecutorService = fsWatchExecutorService;\n        this.indexersFactory = indexersFactory;\n        this.dispatcherFactory = dispatcherFactory;\n        this.batchIndex = new BatchIndex(indexEngine,\n                                         observer,\n                                         indexingExecutorService,\n                                         indexersFactory,\n                                         dispatcherFactory,\n                                         batchIndexListener,\n                                         views);\n        ensureCoreIndexerExists();\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final String id,\n                                final MetaIndexEngine indexEngine,\n                                final Observer observer,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final BatchIndexListener batchIndexListener,\n                                final Class<? extends FileAttributeView>... views) {\n        super(id);\n        this.indexEngine = checkNotNull(\"indexEngine\",\n                                        indexEngine);\n        this.views = views;\n        this.indexingExecutorService = indexingExecutorService;\n        this.fsWatchIndexingExecutorService = fsWatchExecutorService;\n        this.indexersFactory = indexersFactory;\n        this.dispatcherFactory = dispatcherFactory;\n        this.batchIndex = new BatchIndex(indexEngine,\n                                         observer,\n                                         indexingExecutorService,\n                                         indexersFactory,\n                                         dispatcherFactory,\n                                         batchIndexListener,\n                                         views);\n        ensureCoreIndexerExists();\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final IOWatchService watchService,\n                                final MetaIndexEngine indexEngine,\n                                final Observer observer,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final BatchIndexListener batchIndexListener,\n                                final Class<? extends FileAttributeView>... views) {\n        super(watchService);\n        this.indexEngine = checkNotNull(\"indexEngine\",\n                                        indexEngine);\n        this.views = views;\n\n        this.indexingExecutorService = indexingExecutorService;\n        this.fsWatchIndexingExecutorService = fsWatchExecutorService;\n        this.indexersFactory = indexersFactory;\n        this.dispatcherFactory = dispatcherFactory;\n        this.batchIndex = new BatchIndex(indexEngine,\n                                         observer,\n                                         indexingExecutorService,\n                                         indexersFactory,\n                                         dispatcherFactory,\n                                         batchIndexListener,\n                                         views);\n        ensureCoreIndexerExists();\n    }\n\n    @SafeVarargs\n    public IOServiceIndexedImpl(final String id,\n                                final IOWatchService watchService,\n                                final MetaIndexEngine indexEngine,\n                                final Observer observer,\n                                final ExecutorService indexingExecutorService,\n                                final ExecutorService fsWatchExecutorService,\n                                final IndexersFactory indexersFactory,\n                                final IndexerDispatcherFactory dispatcherFactory,\n                                final BatchIndexListener batchIndexListener,\n                                final Class<? extends FileAttributeView>... views) {\n        super(id,\n              watchService);\n        this.indexEngine = checkNotNull(\"indexEngine\",\n                                        indexEngine);\n        this.views = views;\n\n        this.indexingExecutorService = indexingExecutorService;\n        this.fsWatchIndexingExecutorService = fsWatchExecutorService;\n        this.indexersFactory = indexersFactory;\n        this.dispatcherFactory = dispatcherFactory;\n        this.batchIndex = new BatchIndex(indexEngine,\n                                         observer,\n                                         indexingExecutorService,\n                                         indexersFactory,\n                                         dispatcherFactory,\n                                         batchIndexListener,\n                                         views);\n        ensureCoreIndexerExists();\n    }\n\n    private void ensureCoreIndexerExists() {\n        boolean containsCoreIndexer = indexersFactory.getIndexers()\n                .stream()\n                .anyMatch(indexer -> indexer.getClass().equals(CoreIndexer.class));\n\n        if (!containsCoreIndexer) {\n            indexersFactory.addIndexer(new CoreIndexer(this,\n                                                       views));\n        }\n    }\n\n    @Override\n    public FileSystem getFileSystem(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException,\n            ProviderNotFoundException, SecurityException {\n        final FileSystem fs = super.getFileSystem(uri);\n        setupBatchIndex(fs);\n        setupWatchService(fs);\n        return fs;\n    }\n\n    @Override\n    public FileSystem newFileSystem(final URI uri,\n                                    final Map<String, ?> env)\n            throws IllegalArgumentException, FileSystemAlreadyExistsException,\n            ProviderNotFoundException, IOException, SecurityException {\n        final FileSystem fs = super.newFileSystem(uri,\n                                                  env);\n        setupBatchIndex(fs);\n        setupWatchService(fs);\n        return fs;\n    }\n\n    private Stream<Path> rootDirStream(FileSystem fs) {\n        return StreamSupport.stream(fs.getRootDirectories().spliterator(),\n                                    false);\n    }\n\n    @Override\n    public int priority() {\n        return 60;\n    }\n\n    @Override\n    public void dispose() {\n        watchServicesByFS.values()\n                .forEach(ws -> ws.close());\n        activeIndexerDispatchers.forEach(d -> d.dispose());\n\n        super.dispose();\n    }\n\n    private void setupBatchIndex(FileSystem fs) {\n        batchIndex.runAsync(fs);\n    }\n\n    protected void setupWatchService(final FileSystem fs) {\n        if (watchServicesByFS.containsKey(fs.getName())) {\n            return;\n        }\n        final WatchService ws = fs.newWatchService();\n        watchServicesByFS.put(fs.getName(),\n                              ws);\n\n        this.fsWatchIndexingExecutorService.execute(new DescriptiveRunnable() {\n            @Override\n            public String getDescription() {\n                return \"IOServiceIndexedImpl(\" + ws.toString() + \")\";\n            }\n\n            @Override\n            public void run() {\n                while (!isDisposed && !ws.isClose()) {\n                    final WatchKey wk;\n                    try {\n                        wk = ws.take();\n                    } catch (final Exception ex) {\n                        break;\n                    }\n\n                    final List<WatchEvent<?>> events = wk.pollEvents();\n                    DescriptiveRunnable job = new DescriptiveRunnable() {\n                        @Override\n                        public String getDescription() {\n                            return \"IOServiceIndexedImpl(IndexOnEvent - \" + ws.toString() + \")\";\n                        }\n\n                        @Override\n                        public void run() {\n                            fs.getRootDirectories().forEach(rootPath -> {\n                                final KCluster kCluster = KObjectUtil.toKCluster(rootPath);\n                                IndexerDispatcher dispatcher = dispatcherFactory.create(indexersFactory.getIndexers(),\n                                                                                        kCluster);\n                                final Set<Path> eventRealPaths = getRealCreatedPaths(events);\n                                try {\n                                    queueEvents(events,\n                                                eventRealPaths,\n                                                dispatcher);\n                                    scheduleIndexing(dispatcher,\n                                                     events,\n                                                     kCluster);\n                                } catch (DisposedException e) {\n                                    return;\n                                }\n                            });\n                        }\n\n                        private void scheduleIndexing(IndexerDispatcher dispatcher,\n                                                      List<WatchEvent<?>> events,\n                                                      KCluster kCluster) {\n                            activeIndexerDispatchers.add(dispatcher);\n                            dispatcher.schedule(indexingExecutorService)\n                                    .thenRun(() -> LOGGER.info(\"Completed indexing {} events in cluster [{}].\",\n                                                               events.size(),\n                                                               kCluster))\n                                    .whenComplete((result, exception) -> activeIndexerDispatchers.remove(dispatcher));\n                        }\n\n                        private void queueEvents(final List<WatchEvent<?>> events,\n                                                 final Set<Path> eventRealPaths,\n                                                 final IndexerDispatcher dispatcher) throws DisposedException {\n                            for (WatchEvent event : events) {\n                                if (isDisposed()) {\n                                    throw new DisposedException();\n                                }\n                                try {\n                                    final WatchContext context = ((WatchContext) event.context());\n                                    queueEvent(eventRealPaths,\n                                               event,\n                                               context,\n                                               dispatcher);\n                                } catch (final Exception ex) {\n                                    LOGGER.error(\"Error during indexing. { \" + event.toString() + \" }\",\n                                                 ex);\n                                }\n                            }\n                        }\n\n                        private void queueEvent(final Set<Path> eventRealPaths,\n                                                WatchEvent event,\n                                                final WatchContext context,\n                                                final IndexerDispatcher dispatcher) throws DisposedException {\n                            if (event.kind() == ENTRY_MODIFY || event.kind() == ENTRY_CREATE) {\n                                queueCreationAndModificationEvent(eventRealPaths,\n                                                                  context,\n                                                                  dispatcher);\n                            }\n\n                            if (event.kind() == StandardWatchEventKind.ENTRY_RENAME) {\n                                queueRenameEvent(context,\n                                                 dispatcher);\n                            }\n\n                            if (event.kind() == StandardWatchEventKind.ENTRY_DELETE) {\n                                queueDeleteEvent(context,\n                                                 dispatcher);\n                            }\n                        }\n\n                        private boolean isDisposed() {\n                            return isDisposed || ws.isClose();\n                        }\n                    };\n                    fsWatchIndexingExecutorService.execute(job);\n                }\n            }\n        });\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n        cleanupIfDeletedFileSystem(path);\n        cleanupIfDeletedBranch(path);\n        deleteRepositoryFiles(path,\n                              options);\n    }\n\n    void cleanupIfDeletedFileSystem(Path path) {\n        if (path instanceof FSPath) {\n            FileSystem fileSystem = path.getFileSystem();\n            cleanupDeletedFS(fileSystem);\n        }\n    }\n\n    void cleanupIfDeletedBranch(Path path) {\n        if (path.equals(path.getRoot())) {\n            indexEngine.delete(KObjectUtil.toKCluster(path));\n        }\n    }\n\n    void deleteRepositoryFiles(Path path,\n                               DeleteOption[] options) {\n        super.delete(path,\n                     options);\n    }\n\n    void queueDeleteEvent(final WatchContext context,\n                          final IndexerDispatcher dispatcher) throws DisposedException {\n        final Path oldPath = context.getOldPath();\n        // ignore delete events for dot files, because dot files are not indexed\n        if (!isIgnored(oldPath)) {\n            dispatcher.offer(new DeletedFileEvent(oldPath));\n        }\n    }\n\n    void queueRenameEvent(final WatchContext context,\n                          final IndexerDispatcher dispatcher) throws DisposedException {\n        final Path sourcePath = context.getOldPath();\n        final Path destinationPath = context.getPath();\n\n        if (!isIgnored(destinationPath)) {\n            dispatcher.offer(new RenamedFileEvent(sourcePath,\n                                                  destinationPath));\n        }\n    }\n\n    void queueCreationAndModificationEvent(final Set<Path> eventRealPaths,\n                                           final WatchContext context,\n                                           final IndexerDispatcher dispatcher) throws DisposedException {\n        // If the path to be indexed is a \"dot path\" but does not have an associated\n        // \"real path\" index the \"real path\" instead. This ensures when only a\n        // \"dot path\" is updated the FileAttributeView(s) are re-indexed.\n        Path path = context.getPath();\n        if (isIgnored(path)) {\n            if (!IOServiceIndexedUtil.isInDenyList(path)) {\n                final Path realPath = DotFileUtils.undot(path);\n                if (!eventRealPaths.contains(realPath)) {\n                    path = realPath;\n                }\n            }\n        }\n\n        if (!isIgnored(path)) {\n            dispatcher.offer(new IndexableIOEvent.NewFileEvent(path));\n        }\n    }\n\n    protected Set<Path> getRealCreatedPaths(final List<WatchEvent<?>> events) {\n        // Get a set of \"real paths\" to be indexed. The \"dot path\" associated with the \"real path\"\n        // is automatically indexed because the \"dot path\" contains content for FileAttributeView(s)\n        // linked to the \"real path\".\n        final Set<Path> eventRealPaths = new HashSet<>();\n        for (WatchEvent event : events) {\n            final WatchContext context = ((WatchContext) event.context());\n            if (event.kind() == ENTRY_MODIFY || event.kind() == ENTRY_CREATE) {\n                final Path path = context.getPath();\n                if (!isIgnored(path)) {\n                    eventRealPaths.add(path);\n                }\n            }\n        }\n        return eventRealPaths;\n    }\n\n    boolean isIgnored(Path path) {\n        if (path == null || path.getFileName() == null) {\n            return true;\n        } else if (path.getFileName() != null\n                && Objects.equals(\".gitkeep\", path.getFileName().toString())) {\n            return false;\n        } else {\n            return path.getFileName().toString().startsWith(\".\");\n        }\n    }\n\n    private void cleanupDeletedFS(FileSystem fs) {\n        WatchService ws = watchServicesByFS.remove(fs.getName());\n        if (ws != null && !ws.isClose()) {\n            ws.close();\n        }\n        fs.getRootDirectories().forEach(rootPath -> indexEngine.delete(KObjectUtil.toKCluster(rootPath)));\n    }\n\n    protected void cleanupDeletedFS(String fsName,\n                                    Path rootDirectory) {\n        WatchService ws = watchServicesByFS.remove(fsName);\n        if (ws != null && !ws.isClose()) {\n            ws.close();\n        }\n        indexEngine.delete(KObjectUtil.toRootKCluster(rootDirectory));\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... options) throws IllegalArgumentException, IOException, SecurityException {\n\n        Iterable<Path> rootDirectories = path.getFileSystem().getRootDirectories();\n        Path root = null;\n        if (rootDirectories.iterator().hasNext()) {\n            root = rootDirectories.iterator().next();\n        }\n        String fsName = path.getFileSystem().getName();\n\n        final boolean result = this.delIfExists(path,\n                                                options);\n        if (result && path instanceof FSPath && root != null) {\n            cleanupDeletedFS(fsName,\n                             root);\n        }\n        return result;\n    }\n\n    protected boolean delIfExists(Path path,\n                                  DeleteOption... options) throws IllegalArgumentException, IOException, SecurityException {\n        return super.deleteIfExists(path, options);\n    }\n\n    public MetaIndexEngine getIndexEngine() {\n        return indexEngine;\n    }\n\n    /**\n     * A \"No Operation\" Observer, used by default\n     */\n    private static class NOPObserver implements Observer {\n\n        @Override\n        public void information(final String message) {\n            //Do nothing.\n        }\n\n        @Override\n        public void warning(final String message) {\n            //Do nothing.\n        }\n\n        @Override\n        public void error(final String message) {\n            //Do nothing.\n        }\n    }\n\n    private static class NOPBatchIndexListener implements BatchIndexListener {\n\n        @Override\n        public void notifyIndexIngStarted(KCluster kCluster, Path path) {\n            //Do nothing.\n        }\n\n        @Override\n        public void notifyIndexIngFinished(KCluster kCluster, Path path) {\n            //Do nothing.\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IOServiceIndexedUtil.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic final class IOServiceIndexedUtil {\n\n    private static Set<String> denyList = new HashSet<String>() {{\n        add(\".gitignore\");\n        add(\".gitkeep\");\n    }};\n\n    public static boolean isInDenyList(final Path path) {\n        final boolean isGitInternalFile = denyList.contains(path.getFileName().toString());\n        return isGitInternalFile;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IndexableIOEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic abstract class IndexableIOEvent {\n\n    private final Kind kind;\n\n    private IndexableIOEvent(Kind kind) {\n        this.kind = kind;\n    }\n\n    public Kind getKind() {\n        return kind;\n    }\n\n    public abstract void consume(Consumer<NewFileEvent> newFileConsumer,\n                                 Consumer<RenamedFileEvent> renameConsumer,\n                                 Consumer<DeletedFileEvent> deleteConsumer);\n\n    public abstract <T> T apply(Function<NewFileEvent, T> newHandler,\n                                Function<RenamedFileEvent, T> renameHandler,\n                                Function<DeletedFileEvent, T> deleteHandler);\n\n    public static class NewFileEvent extends IndexableIOEvent {\n        private final Path file;\n\n        public NewFileEvent(Path file) {\n            super(Kind.NewFile);\n            this.file = file;\n        }\n\n        public Path getFile() {\n            return file;\n        }\n\n        @Override\n        public void consume(Consumer<NewFileEvent> newFileConsumer, Consumer<RenamedFileEvent> renameConsumer, Consumer<DeletedFileEvent> deleteConsumer) {\n            newFileConsumer.accept(this);\n        }\n\n        @Override\n        public <T> T apply(Function<NewFileEvent, T> newHandler, Function<RenamedFileEvent, T> renameHandler, Function<DeletedFileEvent, T> deleteHandler) {\n            return newHandler.apply(this);\n        }\n\n        @Override\n        public String toString() {\n            return \"NewFileEvent [file=\" + file + \"]\";\n        }\n    }\n\n    public static class RenamedFileEvent extends IndexableIOEvent {\n        private final Path newPath;\n\n        public RenamedFileEvent(Path oldPath, Path newPath) {\n            super(Kind.RenamedFile);\n            this.oldPath = oldPath;\n            this.newPath = newPath;\n        }\n\n        private final Path oldPath;\n\n        public Path getOldPath() {\n            return oldPath;\n        }\n\n        public Path getNewPath() {\n            return newPath;\n        }\n\n        @Override\n        public void consume(Consumer<NewFileEvent> newFileConsumer, Consumer<RenamedFileEvent> renameConsumer, Consumer<DeletedFileEvent> deleteConsumer) {\n            renameConsumer.accept(this);\n        }\n\n        @Override\n        public <T> T apply(Function<NewFileEvent, T> newHandler, Function<RenamedFileEvent, T> renameHandler, Function<DeletedFileEvent, T> deleteHandler) {\n            return renameHandler.apply(this);\n        }\n\n        @Override\n        public String toString() {\n            return \"RenamedFileEvent [newPath=\" + newPath + \", oldPath=\" + oldPath + \"]\";\n        }\n    }\n\n    public static class DeletedFileEvent extends IndexableIOEvent {\n        private final Path file;\n\n        public DeletedFileEvent(Path file) {\n            super(Kind.DeletedFile);\n            this.file = file;\n        }\n\n        public Path getFile() {\n            return file;\n        }\n\n        @Override\n        public void consume(Consumer<NewFileEvent> newFileConsumer, Consumer<RenamedFileEvent> renameConsumer, Consumer<DeletedFileEvent> deleteConsumer) {\n            deleteConsumer.accept(this);\n        }\n\n        @Override\n        public <T> T apply(Function<NewFileEvent, T> newHandler, Function<RenamedFileEvent, T> renameHandler, Function<DeletedFileEvent, T> deleteHandler) {\n            return deleteHandler.apply(this);\n        }\n\n        @Override\n        public String toString() {\n            return \"DeletedFileEvent [file=\" + file + \"]\";\n        }\n    }\n\n    public static enum Kind {\n        NewFile, RenamedFile, DeletedFile\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IndexerDispatcher.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Deque;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.function.Function;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Named;\n\nimport org.slf4j.Logger;\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler.Factory;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.event.BatchIndexEvent;\nimport org.uberfire.ext.metadata.event.IndexEvent;\nimport org.uberfire.ext.metadata.io.IndexableIOEvent.DeletedFileEvent;\nimport org.uberfire.ext.metadata.io.IndexableIOEvent.NewFileEvent;\nimport org.uberfire.ext.metadata.io.IndexableIOEvent.RenamedFileEvent;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\n\nimport static java.lang.String.format;\n\n/**\n * Allows you to queue and then later asynchronously execute indexing for individual indexers. Fires\n * CDI events when an indexer finishes processing a batch.\n */\npublic class IndexerDispatcher {\n\n    @FunctionalInterface\n    public static interface IndexerDispatcherFactory {\n        IndexerDispatcher create(Collection<? extends Indexer> indexers, KCluster cluster);\n    }\n\n    public static IndexerDispatcherFactory createFactory(MetaIndexEngine indexEngine,\n                                                         IndexerScheduler.Factory schedulerFactory,\n                                                         Event<BatchIndexEvent> batchIndexEvent,\n                                                         Logger logger) {\n        return (indexers, cluster) -> new IndexerDispatcher(indexEngine, indexers, cluster, schedulerFactory, batchIndexEvent, logger);\n    }\n\n    private final Collection<IndexerJob> jobs;\n    private final Logger logger;\n    private final Event<BatchIndexEvent> batchIndexEvent;\n    private final Factory schedulerFactory;\n\n    public IndexerDispatcher(MetaIndexEngine indexEngine,\n                             Collection<? extends Indexer> indexers,\n                             KCluster cluster,\n                             IndexerScheduler.Factory schedulerFactory,\n                             Event<BatchIndexEvent> batchIndexEvent,\n                             Logger logger) {\n        this.schedulerFactory = schedulerFactory;\n        this.batchIndexEvent = batchIndexEvent;\n        this.logger = logger;\n        jobs = indexers.stream()\n                       .map(indexer -> new IndexerJob(indexEngine, indexer, cluster, logger))\n                       .collect(Collectors.toList());\n    }\n\n    /**\n     * @param event An indexing event to be queued. Must not be null. The event will\n     *              be dispatched to all {@link Indexer Indexers} for which the underlying path\n     *              is supported (see {@link Indexer#supportsPath(Path)}).\n     */\n    public void offer(IndexableIOEvent event) {\n\n        if (!FileSystemUtils.isGitDefaultFileSystem()) {\n            return;\n        }\n\n        jobs.stream()\n            .filter(job -> supportsUnderlyingPath(job.indexer, event))\n            .forEach(job -> {\n                logger.debug(\"Queuing event [{}] for indexer [id={}].\", event, job.indexer.getIndexerId());\n                job.offer(event);\n            });\n    }\n\n    /**\n     * Note that a CDI {@link BatchIndexEvent} is fired for each individual indexer job that finishes.\n     *\n     * @param executor The {@link ExecutorService} used for asynchronous scheduling.\n     * @return A {@link CompletableFuture} that completes when all indexing jobs have finished. If\n     *          any job completes execptionally, this future completes exceptionally. Must not be null.\n     */\n    public CompletableFuture<Void> schedule(ExecutorService executor) {\n        logger.info(\"Preparing {} indexers to analyze indexing jobs for cluster [{}].\", jobs.size(), jobs.stream().findAny().map(job -> job.cluster.toString()).orElse(\"null\"));\n        final Map<String, ? extends Supplier<List<IndexEvent>>> jobsById =\n                jobs.stream()\n                    .collect(Collectors.toMap(job -> job.indexer.getIndexerId(), Function.identity()));\n        final IndexerScheduler scheduler = schedulerFactory.create(jobsById);\n\n        CompletableFuture<?>[] allFutures = scheduler.schedule(executor)\n                                                     .map(future -> future.thenAccept(pair -> {\n                                                         logger.debug(\"Job finished for indexer [id={}]. Firing batch event.\", pair.getK1());\n                                                         fireBatchIndexEvent(pair.getK1(), pair.getK2());\n                                                     }))\n                                                     .toArray(n -> new CompletableFuture[n]);\n        return CompletableFuture.allOf(allFutures);\n    }\n\n    private void fireBatchIndexEvent(String indexerId, List<IndexEvent> events) {\n        batchIndexEvent.select(namedQualifierFor(indexerId))\n                       .fire(new BatchIndexEvent(indexerId, events));\n    }\n\n    private Named namedQualifierFor(String indexerId) {\n        return new Named() {\n            @Override\n            public Class<? extends Annotation> annotationType() {\n                return Named.class;\n            }\n\n            @Override\n            public String value() {\n                return indexerId;\n            }\n        };\n    }\n\n    public void dispose() {\n        logger.debug(\"Disposing {} indexing jobs.\", jobs.size());\n        jobs.forEach(job -> job.dispose());\n    }\n\n    private boolean supportsUnderlyingPath(Indexer indexer, IndexableIOEvent event) {\n        final Path path = event.apply(evt -> evt.getFile(),\n                                      evt -> evt.getNewPath(),\n                                      evt -> evt.getFile());\n        return indexer.supportsPath(path);\n    }\n\n    private static class IndexerJob implements Supplier<List<IndexEvent>> {\n        private final Indexer indexer;\n        private final Deque<IndexableIOEvent> inputEvents = new ArrayDeque<>();\n        private final MetaIndexEngine indexEngine;\n        private final AtomicBoolean disposed = new AtomicBoolean(false);\n        private final Logger logger;\n        private final KCluster cluster;\n\n        IndexerJob(MetaIndexEngine indexEngine, Indexer indexer, KCluster cluster, Logger logger) {\n            this.indexEngine = indexEngine;\n            this.indexer = indexer;\n            this.cluster = cluster;\n            this.logger = logger;\n        }\n\n        void offer(IndexableIOEvent event) {\n            inputEvents.add(event);\n        }\n\n        void dispose() {\n            logger.debug(\"Disposing job for indexer [id={}].\", indexer.getIndexerId());\n            disposed.set(true);\n        }\n\n        @Override\n        public List<IndexEvent> get() {\n            logger.debug(\"Starting to process events for indexer [id={}].\", indexer.getIndexerId());\n            indexEngine.startBatch(cluster);\n            try {\n                List<IndexEvent> output = processEvents();\n                indexEngine.commit(cluster, indexer.getIndexerId());\n                logger.info(\"Completed indexing {} events for indexer [id={}] in cluster [{}].\", output.size(), indexer.getIndexerId(), cluster);\n                return output;\n            } catch (DisposedException de) {\n                logger.info(\"Indexing for indexer [id={}] was terminated before completion.\", indexer.getIndexerId());\n                indexEngine.abort(cluster);\n                throw de;\n            } catch (Throwable t) {\n                logger.error(format(\"Indexing error for indexer [id=%s]\", indexer.getIndexerId()), t);\n                indexEngine.abort(cluster);\n                throw t;\n            }\n        }\n\n        private List<IndexEvent> processEvents() {\n            List<IndexEvent> outputEvents = new ArrayList<>(inputEvents.size());\n            IndexableIOEvent event;\n            while (!inputEvents.isEmpty()) {\n                event = inputEvents.poll();\n                if (disposed.get()) {\n                    throw new DisposedException();\n                } else if (isFileSystemOpen(event)) {\n                    processEvent(event).ifPresent(outputEvents::add);\n                } else {\n                    logger.debug(\"Skipping indexing of [{}] for indexer [id={}], because the filesystem [{}] is closed.\",\n                                 event,\n                                 indexer.getIndexerId(),\n                                 fileSystemOf(event));\n                }\n            }\n\n            return outputEvents;\n        }\n\n        private static boolean isFileSystemOpen(IndexableIOEvent event) {\n            return fileSystemOf(event).isOpen();\n        }\n\n        private static FileSystem fileSystemOf(IndexableIOEvent event) {\n            return event.apply(evt -> evt.getFile().getFileSystem(),\n                               evt -> evt.getNewPath().getFileSystem(),\n                               evt -> evt.getFile().getFileSystem());\n        }\n\n        private Optional<IndexEvent> processEvent(IndexableIOEvent event) {\n            logger.debug(\"Processing event [{}] for indexer [id={}].\", event, indexer.getIndexerId());\n            return event.apply(this::processNew,\n                               this::processRenamed,\n                               this::processDeleted);\n        }\n\n        private Optional<IndexEvent> processRenamed(RenamedFileEvent event) {\n            final Path sourcePath = event.getOldPath();\n            final Path destinationPath = event.getNewPath();\n            final KObjectKey kObjectSource = indexer.toKObjectKey(sourcePath );\n            final KObject kObjectDestination = indexer.toKObject(destinationPath);\n            if (kObjectSource != null && kObjectDestination != null) {\n                indexEngine.rename(kObjectSource, kObjectDestination);\n                return Optional.of(new IndexEvent.RenamedEvent(kObjectSource, kObjectDestination));\n            } else {\n                return Optional.empty();\n            }\n        }\n\n        private Optional<IndexEvent> processNew(NewFileEvent event) {\n            Path path = event.getFile();\n            final KObject kObject = indexer.toKObject(path);\n            if (kObject != null) {\n                indexEngine.index(kObject);\n                return Optional.of(new IndexEvent.NewlyIndexedEvent(kObject));\n            } else {\n                return Optional.empty();\n            }\n        }\n\n        private Optional<IndexEvent> processDeleted(DeletedFileEvent event) {\n            final Path oldPath = event.getFile();\n            final KObjectKey kObject = indexer.toKObjectKey(oldPath);\n            if (kObject != null) {\n                indexEngine.delete(kObject);\n                return Optional.of(new IndexEvent.DeletedEvent(kObject));\n            } else {\n                return Optional.empty();\n            }\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/IndexersFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.enterprise.inject.Alternative;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.metadata.engine.Indexer;\n\n/**\n * Container for Indexers setup by CDI after IOServiceIndexedImpl has been created\n */\n@Alternative\npublic class IndexersFactory {\n\n    private final List<Indexer> indexers = new ArrayList<>();\n\n    public void addIndexer(final Indexer indexer) {\n        indexers.add(PortablePreconditions.checkNotNull(\"indexer\",\n                                                        indexer));\n    }\n\n    public List<Indexer> getIndexers() {\n        return Collections.unmodifiableList(indexers);\n    }\n\n    public void clear() {\n        indexers.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/KObjectUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport org.apache.commons.codec.digest.DigestUtils;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.SegmentedPath;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport java.util.ArrayList;\n\nimport static org.apache.commons.codec.binary.Base64.encodeBase64String;\nimport static org.apache.commons.io.FilenameUtils.getBaseName;\nimport static org.apache.commons.io.FilenameUtils.getExtension;\nimport static org.uberfire.ext.metadata.backend.lucene.index.directory.DirectoryFactory.CLUSTER_ID_SEGMENT_SEPARATOR;\n\n/**\n *\n */\npublic final class KObjectUtil {\n\n    private static final MetaType META_TYPE = () -> Path.class.getName();\n\n    private KObjectUtil() {\n\n    }\n\n    public static KObjectKey toKObjectKey(final Path path) {\n        return new KObjectKey() {\n            @Override\n            public String getId() {\n                return sha1(getType().getName() + \"|\" + getKey());\n            }\n\n            @Override\n            public MetaType getType() {\n                return META_TYPE;\n            }\n\n            @Override\n            public String getClusterId() {\n                final String fsId = ((FileSystemId) path.getFileSystem()).id();\n                final String segmentId = ((SegmentedPath) path).getSegmentId();\n                return fsId + CLUSTER_ID_SEGMENT_SEPARATOR + segmentId;\n            }\n\n            @Override\n            public String getSegmentId() {\n                return ((SegmentedPath) path).getSegmentId();\n            }\n\n            @Override\n            public String getKey() {\n                return path.toUri().toString();\n            }\n        };\n    }\n\n    public static KObject toKObject(final Path path,\n                                    final FileAttribute<?>... attrs) {\n        return new KObject() {\n\n            @Override\n            public String getId() {\n                return sha1(getType().getName() + \"|\" + getKey());\n            }\n\n            @Override\n            public MetaType getType() {\n                return META_TYPE;\n            }\n\n            @Override\n            public String getClusterId() {\n                final String fsId = ((FileSystemId) path.getFileSystem()).id();\n                final String segmentId = ((SegmentedPath) path).getSegmentId();\n                return fsId + CLUSTER_ID_SEGMENT_SEPARATOR + segmentId;\n            }\n\n            @Override\n            public String getSegmentId() {\n                return ((SegmentedPath) path).getSegmentId();\n            }\n\n            @Override\n            public String getKey() {\n                return path.toUri().toString();\n            }\n\n            @Override\n            public Iterable<KProperty<?>> getProperties() {\n                return new ArrayList<KProperty<?>>(attrs.length) {{\n                    for (final FileAttribute<?> attr : attrs) {\n                        add(new KProperty<Object>() {\n                            @Override\n                            public String getName() {\n                                return attr.name();\n                            }\n\n                            @Override\n                            public Object getValue() {\n                                return attr.value();\n                            }\n\n                            @Override\n                            public boolean isSearchable() {\n                                return true;\n                            }\n                        });\n                    }\n                    add(new KProperty<String>() {\n                        @Override\n                        public String getName() {\n                            return \"filename\";\n                        }\n\n                        @Override\n                        public String getValue() {\n                            if (path.getFileName() == null) {\n                                return \"/\";\n                            }\n                            return path.getFileName().toString();\n                        }\n\n                        @Override\n                        public boolean isSearchable() {\n                            return true;\n                        }\n                    });\n                    add(new KProperty<String>() {\n                        @Override\n                        public String getName() {\n                            return FieldFactory.FILE_NAME_FIELD_SORTED;\n                        }\n\n                        @Override\n                        public String getValue() {\n                            if (path.getFileName() == null) {\n                                return \"\";\n                            }\n                            return getBaseName(path.getFileName().toString()).toLowerCase();\n                        }\n\n                        @Override\n                        public boolean isSearchable() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isSortable() {\n                            return true;\n                        }\n                    });\n                    add(new KProperty<String>() {\n                        @Override\n                        public String getName() {\n                            return \"extension\";\n                        }\n\n                        @Override\n                        public String getValue() {\n                            if (path.getFileName() == null) {\n                                return \"\";\n                            }\n                            return getExtension(path.getFileName().toString());\n                        }\n\n                        @Override\n                        public boolean isSearchable() {\n                            return true;\n                        }\n                    });\n                    add(new KProperty<String>() {\n                        @Override\n                        public String getName() {\n                            return \"basename\";\n                        }\n\n                        @Override\n                        public String getValue() {\n                            if (path.getFileName() == null) {\n                                return \"\";\n                            }\n                            return getBaseName(path.getFileName().toString());\n                        }\n\n                        @Override\n                        public boolean isSearchable() {\n                            return true;\n                        }\n                    });\n                }};\n            }\n\n            @Override\n            public boolean fullText() {\n                return true;\n            }\n\n            @Override\n            public String toString() {\n                StringBuilder sb = new StringBuilder(\"KObject{\" +\n                                                             \", key='\" + getKey() + '\\'' +\n                                                             \", id='\" + getId() + '\\'' +\n                                                             \", type=\" + getType() +\n                                                             \", clusterId='\" + getClusterId() + '\\'' +\n                                                             \", segmentId='\" + getSegmentId() + '\\'');\n\n                for (KProperty<?> xproperty : getProperties()) {\n                    sb.append(\", \" + xproperty.getName() + \"='\" + xproperty.getValue() + '\\'');\n                }\n\n                sb.append('}');\n\n                return sb.toString();\n            }\n        };\n    }\n\n    public static KCluster toKCluster(final Path fsPath) {\n        final String fsId = ((FileSystemId) fsPath.getFileSystem()).id();\n        final String segmentId = ((SegmentedPath) fsPath).getSegmentId();\n        return new KClusterImpl(fsId + CLUSTER_ID_SEGMENT_SEPARATOR + segmentId);\n    }\n\n    public static KCluster toRootKCluster(final Path fsPath) {\n        return new KClusterImpl(((FileSystemId) fsPath.getFileSystem()).id() + CLUSTER_ID_SEGMENT_SEPARATOR);\n    }\n\n    private static String sha1(final String input) {\n        if (input == null || input.trim().length() == 0) {\n            return \"--\";\n        }\n        return encodeBase64String(DigestUtils.sha1(input));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/MetadataConfigBuilder.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.analysis.CharArraySet;\nimport org.apache.lucene.analysis.standard.StandardAnalyzer;\nimport org.uberfire.ext.metadata.MetadataConfig;\nimport org.uberfire.ext.metadata.backend.infinispan.InfinispanSearchConfig;\nimport org.uberfire.ext.metadata.backend.infinispan.provider.InfinispanContext;\nimport org.uberfire.ext.metadata.backend.infinispan.provider.InfinispanIndexProvider;\nimport org.uberfire.ext.metadata.backend.infinispan.provider.MappingProvider;\nimport org.uberfire.ext.metadata.backend.lucene.LuceneConfig;\nimport org.uberfire.ext.metadata.backend.lucene.analyzer.FilenameAnalyzer;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.backend.lucene.fields.SimpleFieldFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.CustomAnalyzerWrapperFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndex;\nimport org.uberfire.ext.metadata.backend.lucene.index.LuceneIndexManager;\nimport org.uberfire.ext.metadata.backend.lucene.index.directory.DirectoryFactory;\nimport org.uberfire.ext.metadata.backend.lucene.index.directory.DirectoryType;\nimport org.uberfire.ext.metadata.backend.lucene.provider.LuceneIndexProvider;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.event.IndexEvent;\nimport org.uberfire.ext.metadata.io.index.MetadataIndexEngine;\nimport org.uberfire.ext.metadata.metamodel.InMemoryMetaModelStore;\nimport org.uberfire.ext.metadata.metamodel.NullMetaModelStore;\n\npublic class MetadataConfigBuilder {\n\n    private static final String LUCENE = \"lucene\";\n    private static final String ISPN = \"infinispan\";\n\n    public static final String ORG_UBERFIRE_EXT_METADATA_INDEX = \"org.appformer.ext.metadata.index\";\n    private static final Consumer<List<IndexEvent>> NOP_OBSERVER = o -> {\n    };\n\n    private MetaModelStore metaModelStore;\n    private FieldFactory fieldFactory;\n    private DirectoryType type;\n    private Analyzer analyzer;\n    private CustomAnalyzerWrapperFactory customAnalyzerWrapperFactory;\n    private Map<String, Analyzer> analyzers;\n    private final String metadataIndex;\n\n    public MetadataConfigBuilder() {\n        this(System.getProperty(ORG_UBERFIRE_EXT_METADATA_INDEX,\n                                LUCENE));\n    }\n\n    public MetadataConfigBuilder(String metadataIndex) {\n        this.metadataIndex = metadataIndex;\n    }\n\n    public MetadataConfigBuilder withInMemoryMetaModelStore() {\n        this.metaModelStore = new InMemoryMetaModelStore();\n        return this;\n    }\n\n    public MetadataConfigBuilder withoutMemoryMetaModel() {\n        this.metaModelStore = new NullMetaModelStore();\n        return this;\n    }\n\n    public MetadataConfigBuilder withDefaultFieldFactory() {\n        this.fieldFactory = new SimpleFieldFactory();\n        return this;\n    }\n\n    public MetadataConfigBuilder usingAnalyzers(final Map<String, Analyzer> analyzers) {\n        this.analyzers = analyzers;\n        return this;\n    }\n\n    public MetadataConfigBuilder usingAnalyzerWrapperFactory(CustomAnalyzerWrapperFactory analyzerWrapper) {\n        this.customAnalyzerWrapperFactory = analyzerWrapper;\n        return this;\n    }\n\n    public MetadataConfigBuilder usingFieldFactory(final FieldFactory fieldFactory) {\n        this.fieldFactory = fieldFactory;\n        return this;\n    }\n\n    public MetadataConfigBuilder useDirectoryBasedIndex() {\n        return this;\n    }\n\n    public MetadataConfigBuilder useInMemoryDirectory() {\n        this.type = DirectoryType.INMEMORY;\n        return this;\n    }\n\n    public MetadataConfigBuilder useMMapDirectory() {\n        this.type = DirectoryType.MMAP;\n        return this;\n    }\n\n    public MetadataConfigBuilder useNIODirectory() {\n        this.type = DirectoryType.NIO;\n        return this;\n    }\n\n    public MetadataConfig build() {\n        if (metaModelStore == null) {\n            withoutMemoryMetaModel();\n        }\n        if (fieldFactory == null) {\n            withDefaultFieldFactory();\n        }\n        if (type == null) {\n            withDefaultDirectory();\n        }\n        if (analyzers == null) {\n            withDefaultAnalyzers();\n        }\n        if (analyzer == null) {\n            withDefaultAnalyzer();\n        }\n\n        if (this.metadataIndex.toLowerCase().equals(ISPN)) {\n            InfinispanContext context = InfinispanContext.getInstance();\n            MappingProvider mappingProvider = new MappingProvider(this.analyzer);\n            InfinispanIndexProvider infinispanIndexProvider = new InfinispanIndexProvider(context,\n                                                                                          mappingProvider);\n            return new InfinispanSearchConfig(new MetadataIndexEngine(infinispanIndexProvider,\n                                                                      this.metaModelStore),\n                                              infinispanIndexProvider,\n                                              this.metaModelStore,\n                                              this.analyzer);\n        } else {\n            DirectoryFactory indexFactory = new DirectoryFactory(type,\n                                                                 analyzer);\n            LuceneIndexManager indexManager = new LuceneIndexManager(indexFactory);\n            LuceneIndexProvider indexProvider = new LuceneIndexProvider(indexManager,\n                                                                        fieldFactory);\n            return new LuceneConfig(metaModelStore,\n                                    fieldFactory,\n                                    indexManager,\n                                    new MetadataIndexEngine(indexProvider,\n                                                            metaModelStore),\n                                    analyzer);\n        }\n    }\n\n    public void withDefaultDirectory() {\n        useNIODirectory();\n    }\n\n    public void withDefaultAnalyzers() {\n        this.analyzers = new HashMap<>();\n        analyzers.put(LuceneIndex.CUSTOM_FIELD_FILENAME,\n                      new FilenameAnalyzer());\n    }\n\n    public void withDefaultAnalyzer() {\n        this.analyzer = this.customAnalyzerWrapperFactory.getAnalyzerWrapper(new StandardAnalyzer(CharArraySet.EMPTY_SET),\n                                                                                analyzers);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/SimpleIndexerScheduler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutorService;\nimport java.util.function.Supplier;\nimport java.util.stream.Stream;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler;\nimport org.uberfire.ext.metadata.event.IndexEvent;\n\npublic class SimpleIndexerScheduler implements IndexerScheduler {\n\n    private static final Logger logger = LoggerFactory.getLogger(SimpleIndexerScheduler.class);\n\n    private final Map<String, ? extends Supplier<List<IndexEvent>>> jobsById;\n\n    public static IndexerScheduler.Factory factory() {\n        return (jobsById) -> new SimpleIndexerScheduler(jobsById);\n    }\n\n    public SimpleIndexerScheduler(Map<String, ? extends Supplier<List<IndexEvent>>> jobsById) {\n        this.jobsById = jobsById;\n    }\n\n    @Override\n    public Stream<CompletableFuture<Pair<String, List<IndexEvent>>>> schedule(ExecutorService executor) {\n        return jobsById.entrySet()\n                       .stream()\n                       .map(entry -> {\n                           String indexerId = entry.getKey();\n                           Supplier<List<IndexEvent>> job = entry.getValue();\n                           logger.debug(\"Scheduling job for indexer [id={}].\", indexerId);\n                           return CompletableFuture.supplyAsync(job, executor)\n                                                   .thenApply(events -> new Pair<>(indexerId, events));\n                       });\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/index/MetadataIndexEngine.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.index;\n\nimport java.text.MessageFormat;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.locks.ReentrantLock;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.event.IndexEvent;\nimport org.uberfire.ext.metadata.event.IndexEvent.DeletedEvent;\nimport org.uberfire.ext.metadata.event.IndexEvent.NewlyIndexedEvent;\nimport org.uberfire.ext.metadata.event.IndexEvent.RenamedEvent;\nimport org.uberfire.ext.metadata.io.util.MultiIndexerLock;\nimport org.uberfire.ext.metadata.metamodel.MetaModelBuilder;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class MetadataIndexEngine implements MetaIndexEngine {\n\n    private Map<KCluster, MultiIndexerLock> batchLocks = new ConcurrentHashMap<>();\n    private final MetaModelBuilder metaModelBuilder;\n    private final Logger logger = LoggerFactory.getLogger(MetadataIndexEngine.class);\n    private final IndexProvider provider;\n    private final ThreadLocal<Map<KCluster, List<IndexEvent>>> batchSets = ThreadLocal.withInitial(() -> new HashMap<>());\n    private final Collection<Runnable> beforeDispose = new ArrayList<>();\n    private final Supplier<MultiIndexerLock> lockSupplier;\n\n    public MetadataIndexEngine(IndexProvider provider,\n                               MetaModelStore metaModelStore,\n                               Supplier<MultiIndexerLock> lockSupplier) {\n        this.provider = provider;\n        this.metaModelBuilder = new MetaModelBuilder(metaModelStore);\n        this.lockSupplier = lockSupplier;\n        PriorityDisposableRegistry.register(this);\n        this.provider.observerInitialization(this::cleanBatchLocks);\n    }\n\n    public MetadataIndexEngine(IndexProvider provider,\n                               MetaModelStore metaModelStore) {\n        this(provider,\n             metaModelStore,\n             () -> new MultiIndexerLock(new ReentrantLock()));\n    }\n\n    @Override\n    public synchronized boolean freshIndex(KCluster cluster) {\n        boolean containsKey = batchLocks.containsKey(cluster);\n        boolean isFreshIndex = this.provider.isFreshIndex(cluster) && !containsKey;\n        if (logger.isDebugEnabled()) {\n            logger.debug(MessageFormat.format(\"Cluster: {0} | Batch Locks contains key? {1} | Is Fresh Index? {2}\",\n                                              cluster.getClusterId(),\n                                              containsKey,\n                                              isFreshIndex));\n        }\n        return isFreshIndex;\n    }\n\n    @Override\n    public boolean isIndexReady(KCluster cluster,\n                                String indexerId) {\n        final MultiIndexerLock lock;\n        return !provider.isFreshIndex(cluster) && ((lock = batchLocks.get(cluster)) == null || !lock.isLockedBy(indexerId));\n    }\n\n    @Override\n    public void prepareBatch(KCluster cluster) {\n        batchLocks.computeIfAbsent(cluster,\n                                   ignore -> lockSupplier.get());\n    }\n\n    @Override\n    public void startBatch(KCluster cluster) {\n        prepareBatch(cluster);\n        Map<KCluster, List<IndexEvent>> batchSet = batchSets.get();\n        if (batchSet.containsKey(cluster)) {\n            throw new IllegalStateException(String.format(\"Cannot start a batch for cluster [id=%s] when there is already a batch started on this thread [%s]\",\n                                                          cluster.getClusterId(),\n                                                          Thread.currentThread().getName()));\n        } else {\n            batchSet.put(cluster,\n                         new ArrayList<>());\n        }\n    }\n\n    private void doOrDeferAction(KCluster index,\n                                 IndexEvent event) {\n        if (this.isBatch(index)) {\n            List<IndexEvent> store = this.batchSets.get().get(index);\n            store.add(event);\n        } else {\n            doAction(event);\n        }\n    }\n\n    @Override\n    public void index(KObject kObject) {\n        KCluster index = new KClusterImpl(kObject.getClusterId());\n        doOrDeferAction(index,\n                        new NewlyIndexedEvent(kObject));\n    }\n\n    private void doAction(IndexEvent event) {\n        switch (event.getKind()) {\n            case NewlyIndexed: {\n                NewlyIndexedEvent newlyIndexedEvent = (NewlyIndexedEvent) event;\n                doIndex(newlyIndexedEvent.getKObject());\n                break;\n            }\n            case Renamed: {\n                RenamedEvent renamedEvent = (RenamedEvent) event;\n                doRename(renamedEvent.getSource(),\n                         renamedEvent.getTarget());\n                break;\n            }\n            case Deleted: {\n                DeletedEvent deletedEvent = (DeletedEvent) event;\n                doDelete(deletedEvent.getDeleted());\n                break;\n            }\n            default:\n                throw new UnsupportedOperationException(\"Unrecognized index event kind: \" + event.getKind());\n        }\n    }\n\n    private void doIndex(KObject kObject) {\n        this.metaModelBuilder.updateMetaModel(kObject);\n        this.provider.index(kObject);\n    }\n\n    private boolean isBatch(KCluster cluster) {\n        Map<KCluster, List<IndexEvent>> batchSet = batchSets.get();\n        if (batchSet.isEmpty()) {\n            // Don't hold reference to this map if there are no batches in the thread.\n            batchSets.remove();\n        }\n        return batchSet.containsKey(cluster);\n    }\n\n    @Override\n    public void rename(KObjectKey from,\n                       KObject to) {\n\n        checkNotNull(\"from\",\n                     from);\n        checkNotNull(\"to\",\n                     to);\n        checkCondition(\"renames are allowed only from same cluster\",\n                       from.getClusterId().equals(to.getClusterId()));\n\n        KCluster index = new KClusterImpl(from.getClusterId());\n        doOrDeferAction(index,\n                        new RenamedEvent(from,\n                                         to));\n    }\n\n    private void doRename(KObjectKey from,\n                          KObject to) {\n        this.provider.rename(from.getClusterId(),\n                             from.getId(),\n                             to);\n    }\n\n    protected boolean exists(KObjectKey from) {\n        return this.provider.exists(from.getClusterId(),\n                                    from.getId());\n    }\n\n    @Override\n    public void delete(KCluster cluster) {\n        if (batchLocks.containsKey(cluster)) {\n            this.batchLocks.remove(cluster);\n            this.provider.delete(cluster.getClusterId());\n        } else {\n            deleteAllProjectsLocks(cluster);\n        }\n    }\n\n    private void deleteAllProjectsLocks(KCluster cluster) {\n        final List<KCluster> clusters = this.batchLocks.keySet().stream().parallel()\n                .filter(s -> s.getClusterId().startsWith(cluster.getClusterId()))\n                .collect(Collectors.toList());\n        clusters.forEach(cl -> {\n            this.batchLocks.remove(cl);\n            this.provider.delete(cl.getClusterId());\n        });\n    }\n\n    @Override\n    public void delete(KObjectKey objectKey) {\n        KCluster index = new KClusterImpl(objectKey.getClusterId());\n        doOrDeferAction(index,\n                        new DeletedEvent(objectKey));\n    }\n\n    private void doDelete(KObjectKey objectKey) {\n        this.provider.delete(objectKey.getClusterId(),\n                             objectKey.getId());\n    }\n\n    @Override\n    public void commit(KCluster cluster,\n                       String indexerId) {\n        final MultiIndexerLock lock = batchLocks.get(cluster);\n        final List<IndexEvent> batchSet = batchSets.get().get(cluster);\n        final boolean clusterDeleted = lock == null && batchSet != null;\n\n        if (clusterDeleted) {\n            logger.info(\"Cluster [{}] was deleted. Aborting commit for indexer [{}].\",\n                        cluster.getClusterId(),\n                        indexerId);\n            abort(cluster);\n            return;\n        }\n\n        try {\n            if (batchSet == null) {\n                throw new IllegalStateException(String.format(\"Cannot commit batch for cluster [id=%s] when no batch has been started in thread [%s].\",\n                                                              cluster.getClusterId(),\n                                                              Thread.currentThread().getName()));\n            } else if (batchSet.isEmpty()) {\n                removeThreadLocalBatchState(cluster);\n            } else {\n                doCommit(cluster,\n                         batchSet,\n                         lock,\n                         indexerId);\n            }\n        } catch (Throwable t) {\n            abort(cluster);\n            throw t;\n        }\n    }\n\n    private void doCommit(KCluster cluster,\n                          List<IndexEvent> batchSet,\n                          MultiIndexerLock lock,\n                          String indexerId) {\n        try {\n            lock.lock(indexerId);\n            batchSet.forEach(this::doAction);\n            removeThreadLocalBatchState(cluster);\n        } finally {\n            lock.unlock(indexerId);\n        }\n    }\n\n    @Override\n    public void abort(KCluster cluster) {\n        removeThreadLocalBatchState(cluster);\n    }\n\n    private void removeThreadLocalBatchState(KCluster cluster) {\n        Map<KCluster, List<IndexEvent>> batchSet = batchSets.get();\n        batchSet.remove(cluster);\n        if (batchSet.isEmpty()) {\n            batchSets.remove();\n        }\n    }\n\n    @Override\n    public void beforeDispose(Runnable callback) {\n        this.beforeDispose.add(checkNotNull(\"callback\",\n                                            callback));\n    }\n\n    @Override\n    public boolean isAlive() {\n        return this.provider.isAlive();\n    }\n\n    @Override\n    public int priority() {\n        return 50;\n    }\n\n    @Override\n    public void dispose() {\n        if (!beforeDispose.isEmpty()) {\n            for (final Runnable activeDispose : beforeDispose) {\n                activeDispose.run();\n            }\n        }\n    }\n\n    public void cleanBatchLocks() {\n        this.batchLocks = new ConcurrentHashMap<>();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/main/java/org/uberfire/ext/metadata/io/util/MultiIndexerLock.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io.util;\n\nimport java.util.Objects;\nimport java.util.concurrent.atomic.AtomicReference;\nimport java.util.concurrent.locks.ReentrantLock;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * <p>\n * A re-entrant lock that allows callers to query whether the lock is held by a particular indexer.\n */\npublic class MultiIndexerLock {\n\n    /*\n     * Overview:\n     *\n     * The implementation is a bit complex because we want the following properties:\n     * - Locking to acquire a lock and set a String id value in a way that is atomic to external callers\n     * - Minimal blocking when checking if an indexer holds a lock.\n     *\n     * To achieve this, we need two locks. One lock for the actual resource, and one lock for the internal state of this class.\n     * When a caller invokes `lock` we must acquire the resource lock first so that we do not block calls to `isLockedBy` while `lock` is blocked\n     * on the resource lock. This leaves the possibility that `isLockedBy` can be called concurrently with `lock`. To handle this we use the object monitor\n     * for this instance so that `isLockedBy` can wait for a `lock` call to complete.\n     */\n\n    private final ReentrantLock resourceLock;\n    private final AtomicReference<String> indexerId = new AtomicReference<>();\n    private static final Logger logger = LoggerFactory.getLogger(MultiIndexerLock.class);\n\n    public MultiIndexerLock(ReentrantLock globalLock) {\n        this.resourceLock = globalLock;\n    }\n\n    public void lock(String indexerId) {\n        // First acquire resource lock so that we don't hold `this` intrinsic lock while blocked.\n        logger.debug(\"Attempting to get lock for indexer [{}].\", indexerId);\n        resourceLock.lock();\n\n        // Now acquire intrinsic lock so we can finish the locking process by updating the indexer id.\n        logger.trace(\"Acquired global lock. Attempting to acquire internal lock to update locked indexer id.\");\n        synchronized (this) {\n            logger.trace(\"Acquired internal lock. Updating locked indexer id to [{}].\", indexerId);\n            this.indexerId.set(indexerId);\n            /*\n             *  We notify in case an `isLockedBy` call is waiting on another thread.\n             *  This would happen if `isLockedBy` started running in another thread before we\n             *  entered this synchronized block.\n             */\n            this.notifyAll();\n            logger.debug(\"Finished acquiring lock for indexer [{}].\", indexerId);\n        }\n    }\n\n    /*\n     * This method is synchronized on this objects intrinsic lock to coordinate with `lock` and `unlock`.\n     * As a side-effect, `isLockedBy` calls block eachother. We could fix this with a `ReadWriteLock`, but it is probably not worth\n     * the effort.\n     */\n    public synchronized boolean isLockedBy(String indexerId) {\n        logger.debug(\"Checking if locked by indexer [{}].\", indexerId);\n\n        /*\n         * If we hit this loop, a `lock` call is in progress in another thread.\n         * We will need to `wait` (to relinquish the intrisic lock and allow `lock` to finish.\n         * We check if the resource lock is still held in the off chance that we waited so long\n         * that `unlock` has also been called already by the thread we were waiting for.\n         */\n        String lockedIndexerId = null;\n        boolean isGloballyLocked;\n        while ((isGloballyLocked = resourceLock.isLocked()) && (lockedIndexerId = this.indexerId.get()) == null) {\n            try {\n                logger.trace(\"Lock acquisition in progress. Waiting to be notified.\");\n                wait();\n            } catch (InterruptedException ignore) {\n                logger.trace(\"InterruptedException while waiting to be notified.\");\n            }\n        }\n\n        /*\n         * Now we can return a result. The following cases are covered here:\n         * - The loop above never executed, either because the resource lock was not held, or it was and the id was set.\n         * - The loop above executed because a `lock` call was in progress, and now the lock is held be some indexer.\n         * - The loop above executed because a `lock` call was in progress, but this thread was not woken until after `unlock` happened.\n         */\n        if (logger.isTraceEnabled()) {\n            final String logMessageVerb = isGloballyLocked ? \"is\" : \"is not\";\n            logger.trace(\"Finished waiting for notification. Global lock {} held. Locked indexer id is [{}].\",\n                         logMessageVerb,\n                         lockedIndexerId);\n        }\n        boolean result = isGloballyLocked && Objects.equals(lockedIndexerId, indexerId);\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Lock {} held by indexer [{}].\", result ? \"is\" : \"is not\", indexerId);\n        }\n        return result;\n    }\n\n    /*\n     * Synchronized on this objects intrinsic lock to coordinate with `lock` and `isLockedBy`.\n     */\n    public synchronized void unlock(String indexerId) {\n        logger.debug(\"Attempting to relinquish lock for indexer [{}].\", indexerId);\n        String lockedId = this.indexerId.get();\n        if (lockedId == null || !lockedId.equals(indexerId)) {\n            throw new IllegalArgumentException(String.format(\"Cannot unlock for indexer [%s] because that indexer does not hold the lock.\" +\n                                                             \" This thread holds the lock for indexer [%s].\",\n                                                             indexerId,\n                                                             lockedId));\n        } else if (!resourceLock.isHeldByCurrentThread()) {\n            /*\n             * We check this case and throw an error ourselves so that we are certain not to leave\n             * the internal state of our multiple locks in disarray.\n             */\n            throw new IllegalArgumentException(\"This thread does not hold the lock.\");\n        } else {\n            this.indexerId.set(null);\n            resourceLock.unlock();\n            logger.debug(\"Successfully relinquished lock for indexer [{}].\", indexerId);\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/BatchIndexKeepFileTest.java",
    "content": "/*\n * Copyright 2020 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.io;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.junit.Test;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.BatchIndexListener;\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.engine.Observer;\nimport org.uberfire.ext.metadata.io.lucene.BaseIndexTest;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\npublic class BatchIndexKeepFileTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"temp-repo-test\"};\n    }\n\n    @Test\n    public void testIndex() {\n\n        {\n            final Path file = ioService().get(\"git://temp-repo-test/xxx/.keep\");\n            ioService().write(file,\n                              \"\");\n        }\n\n        final IndexersFactory indexersFactory = indexersFactory();\n        final MockIndexer indexer = new MockIndexer();\n        indexersFactory.addIndexer(indexer);\n\n        new BatchIndex(config.getIndexEngine(),\n                       new Observer() {\n                           @Override\n                           public void information(final String message) {\n\n                           }\n\n                           @Override\n                           public void warning(final String message) {\n\n                           }\n\n                           @Override\n                           public void error(final String message) {\n\n                           }\n                       },\n                       Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                       indexersFactory,\n                       indexerDispatcherFactory(config.getIndexEngine()),\n                       new BatchIndexListener() {\n                           @Override\n                           public void notifyIndexIngStarted(KCluster kCluster, Path path) {\n\n                           }\n\n                           @Override\n                           public void notifyIndexIngFinished(KCluster kCluster, Path path) {\n\n                           }\n                       },\n                       DublinCoreView.class).run(ioService().get(\"git://temp-repo-test/\").getFileSystem(),\n                                                 () -> {\n                                                     try {\n                                                         final String index = toKCluster(ioService().get(\"git://temp-repo-test/\")).getClusterId();\n\n                                                         {\n\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   new MatchAllDocsQuery());\n\n                                                             assertEquals(4,\n                                                                          hits);\n                                                         }\n\n                                                         {\n\n                                                             TermQuery query = new TermQuery(new Term(\"dcore.author\",\n                                                                                                      \"name\"));\n\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   query);\n                                                             assertEquals(2,\n                                                                          hits);\n                                                         }\n\n                                                         {\n\n                                                             TermQuery query = new TermQuery(new Term(\"dcore.author\",\n                                                                                                      \"second\"));\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   query);\n\n                                                             assertEquals(1,\n                                                                          hits);\n                                                         }\n\n                                                         config.dispose();\n                                                     } catch (Exception ex) {\n                                                         ex.printStackTrace();\n                                                         fail();\n                                                     }\n                                                 });\n\n        assertEquals(1, indexer.getFoundPaths().size());\n        assertEquals(\"/xxx/keep\", indexer.getFoundPaths().iterator().next().toString());\n    }\n\n    class MockIndexer implements Indexer {\n\n        private Set<Path> foundPaths = new HashSet<>();\n\n        @Override\n        public boolean supportsPath(final Path path) {\n            foundPaths.add(path);\n            return false;\n        }\n\n        @Override\n        public KObject toKObject(final Path path) {\n            return null;\n        }\n\n        @Override\n        public KObjectKey toKObjectKey(final Path path) {\n            return null;\n        }\n\n        private Set<Path> getFoundPaths() {\n            return foundPaths;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/IOServiceIndexedTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ExecutorService;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher.IndexerDispatcherFactory;\nimport org.uberfire.ext.metadata.io.common.util.TestFileSystemProvider;\nimport org.uberfire.ext.metadata.io.common.util.TestFileSystemProvider.MockFileSystem;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.java.nio.base.AttrsStorage;\nimport org.uberfire.java.nio.base.FSPath;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.refEq;\nimport static org.mockito.Mockito.RETURNS_DEEP_STUBS;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.java.nio.file.StandardWatchEventKind.ENTRY_MODIFY;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class IOServiceIndexedTest {\n\n    IOServiceIndexedImpl ioService;\n\n    @Mock\n    MetaIndexEngine indexEngine;\n    @Mock\n    ExecutorService indexingExecutorService;\n    @Mock\n    ExecutorService fsWatchExecutorService;\n    @Mock\n    IndexersFactory indexersFactory;\n    @Mock\n    IndexerDispatcherFactory dispatcherFactory;\n\n    FileSystemProvider mockProvider;\n\n    @Before\n    public void setup() throws URISyntaxException {\n        TestFileSystemProvider testProvider = FileSystemProviders.installedProviders()\n                .stream()\n                .filter(provider -> provider instanceof TestFileSystemProvider)\n                .map(provider -> (TestFileSystemProvider) provider)\n                .findAny()\n                .orElseThrow(() -> new RuntimeException(\"Failed to setup mock provider for test.\"));\n        testProvider.resetMock();\n        mockProvider = testProvider.getMock();\n\n        when(mockProvider.newFileSystem(any(URI.class), any())).thenReturn(mock(MockFileSystem.class, RETURNS_DEEP_STUBS));\n        when(mockProvider.newFileSystem(any(Path.class), any())).thenReturn(mock(MockFileSystem.class, RETURNS_DEEP_STUBS));\n        when(mockProvider.getFileSystem(any(URI.class))).thenReturn(mock(MockFileSystem.class, RETURNS_DEEP_STUBS));\n\n        ioService = spy(new IOServiceIndexedImpl(indexEngine, indexingExecutorService, fsWatchExecutorService, indexersFactory, dispatcherFactory));\n    }\n\n    @Test\n    public void recreatingFileSystemMakesNewWatchService() throws Exception {\n        URI uri = new URI(\"test:///some/path\");\n        Map<String, ?> env = Collections.emptyMap();\n\n        FileSystem fs1 = ioService.newFileSystem(uri, env);\n\n        verify(fs1).newWatchService();\n\n        FSPath fsPath = mock(FSPath.class);\n        when(fsPath.getFileSystem()).thenReturn(fs1);\n\n        ioService.delete(fsPath);\n        verify(fs1.newWatchService()).close();\n\n        FileSystem fs2 = ioService.newFileSystem(uri, env);\n        // Stubs are reused so this will have been invoked one above in IOService, and once in this test in a verify method.\n        verify(fs2, times(3)).newWatchService();\n    }\n\n    @Test\n    public void deleteFSTest() throws Exception {\n        final FileSystem fileSystem = getFileSystem();\n\n        FSPath fsPath = mock(FSPath.class);\n        when(fsPath.getFileSystem()).thenReturn(fileSystem);\n\n        ioService.delete(fsPath);\n\n        InOrder inOrder = Mockito.inOrder(ioService, indexEngine, fileSystem);\n        inOrder.verify(indexEngine).delete(any(KCluster.class));\n        inOrder.verify(ioService).deleteRepositoryFiles(eq(fsPath), any());\n    }\n\n    @Test\n    public void deleteBranchTest() throws Exception {\n        final FileSystem fileSystem = getFileSystem();\n\n        final Path branchPath = fileSystem.getRootDirectories().iterator().next();\n\n        ioService.delete(branchPath);\n\n        InOrder inOrder = Mockito.inOrder(ioService, indexEngine, fileSystem);\n        inOrder.verify(indexEngine).delete(any(KCluster.class));\n        inOrder.verify(ioService).deleteRepositoryFiles(eq(branchPath), any());\n    }\n\n    @Test\n    public void deleteFileTest() throws Exception {\n        final FileSystem fileSystem = getFileSystem();\n\n        final Path file = mock(Path.class);\n        when(file.getFileSystem()).thenReturn(fileSystem);\n\n        ioService.delete(file);\n\n        verify(indexEngine, never()).delete(any(KCluster.class));\n        verify(ioService).deleteRepositoryFiles(eq(file), any());\n    }\n\n    @Test\n    public void dotFileShouldBeIgnored() {\n        Path path = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(fileName);\n        when(path.getFileName().toString()).thenReturn(\".sample.drl\");\n\n        assertTrue(ioService.isIgnored(path));\n    }\n\n    @Test\n    public void queueRenameShouldDispatchIndexEventTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path oldPath = mock(Path.class);\n        Path newPath = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(newPath.getFileName()).thenReturn(fileName);\n        when(newPath.getFileName().toString()).thenReturn(\"sample.drl\");\n\n        when(context.getOldPath()).thenReturn(oldPath);\n        when(context.getPath()).thenReturn(newPath);\n\n        ioService.queueRenameEvent(context, dispatcher);\n\n        verify(dispatcher, times(1)).offer(\n                refEq(new IndexableIOEvent.RenamedFileEvent(oldPath, newPath)));\n    }\n\n    @Test\n    public void queueRenameShouldNotDispatchIndexEventTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path oldPath = mock(Path.class);\n        Path newPath = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(newPath.getFileName()).thenReturn(fileName);\n        when(newPath.getFileName().toString()).thenReturn(\".sample.drl\");\n\n        when(context.getOldPath()).thenReturn(oldPath);\n        when(context.getPath()).thenReturn(newPath);\n\n        ioService.queueRenameEvent(context, dispatcher);\n\n        verify(dispatcher, times(0)).offer(\n                refEq(new IndexableIOEvent.RenamedFileEvent(oldPath, newPath)));\n    }\n\n    @Test\n    public void queueDeleteShouldDispatchIndexEventTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path oldPath = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(oldPath.getFileName()).thenReturn(fileName);\n        when(oldPath.getFileName().toString()).thenReturn(\"sample.drl\");\n\n        when(context.getOldPath()).thenReturn(oldPath);\n\n        ioService.queueDeleteEvent(context, dispatcher);\n\n        verify(dispatcher, times(1)).offer(\n                refEq(new IndexableIOEvent.DeletedFileEvent(oldPath)));\n    }\n\n    @Test\n    public void queueDeleteShouldNotDispatchIndexEventTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path oldPath = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(oldPath.getFileName()).thenReturn(fileName);\n        when(oldPath.getFileName().toString()).thenReturn(\".sample.drl\");\n\n        when(context.getOldPath()).thenReturn(oldPath);\n\n        ioService.queueDeleteEvent(context, dispatcher);\n\n        verify(dispatcher, times(0)).offer(\n                refEq(new IndexableIOEvent.DeletedFileEvent(oldPath)));\n    }\n\n    @Test\n    public void queueCreationAndModificationEventShouldUndotAndDispatchTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path path = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(fileName);\n        when(path.getFileName().toString()).thenReturn(\".sample.drl\");\n\n        when(context.getPath()).thenReturn(path);\n\n        Path realPath = mock(Path.class);\n        Path realFileName = mock(Path.class);\n\n        when(realPath.getFileName()).thenReturn(realFileName);\n        when(realPath.getFileName().toString()).thenReturn(\"sample.drl\");\n\n        Set<Path> eventRealPaths = new HashSet();\n\n        when(path.resolveSibling(\"sample.drl\")).thenReturn(realPath);\n\n        ioService.queueCreationAndModificationEvent(eventRealPaths, context, dispatcher);\n\n        verify(dispatcher, times(1)).offer(\n                refEq(new IndexableIOEvent.NewFileEvent(realPath)));\n    }\n\n    @Test\n    public void shouldNotAddBlankFilesToEventRealPathsTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        when(context.getPath()).thenReturn(null);\n\n        WatchEvent watchEvent = mock(WatchEvent.class);\n        when(watchEvent.context()).thenReturn(context);\n        when(watchEvent.kind()).thenReturn(ENTRY_MODIFY);\n\n        List<WatchEvent<?>> watchEvents = Arrays.asList(watchEvent);\n\n        Set<Path> eventRealPaths = ioService.getRealCreatedPaths(watchEvents);\n        assertEquals(0, eventRealPaths.size());\n    }\n\n    @Test\n    public void shouldNotAddDotFilesToEventRealPathsTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path path = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(fileName);\n        when(path.getFileName().toString()).thenReturn(\".sample.drl\");\n\n        when(context.getPath()).thenReturn(path);\n\n        WatchEvent watchEvent = mock(WatchEvent.class);\n        when(watchEvent.context()).thenReturn(context);\n        when(watchEvent.kind()).thenReturn(ENTRY_MODIFY);\n\n        List<WatchEvent<?>> watchEvents = Arrays.asList(watchEvent);\n\n        Set<Path> eventRealPaths = ioService.getRealCreatedPaths(watchEvents);\n        assertEquals(0, eventRealPaths.size());\n    }\n\n    @Test\n    public void shouldAddRealFilesToEventRealPathsTest() throws Exception {\n        WatchContext context = mock(WatchContext.class);\n        IndexerDispatcher dispatcher = mock(IndexerDispatcher.class);\n\n        Path path = mock(Path.class);\n        Path fileName = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(fileName);\n        when(path.getFileName().toString()).thenReturn(\"sample.drl\");\n\n        when(context.getPath()).thenReturn(path);\n\n        WatchEvent watchEvent = mock(WatchEvent.class);\n        when(watchEvent.context()).thenReturn(context);\n        when(watchEvent.kind()).thenReturn(ENTRY_MODIFY);\n\n        List<WatchEvent<?>> watchEvents = Arrays.asList(watchEvent);\n\n        Set<Path> eventRealPaths = ioService.getRealCreatedPaths(watchEvents);\n        assertEquals(1, eventRealPaths.size());\n    }\n\n    private FileSystem getFileSystem() throws URISyntaxException {\n        URI uri = new URI(\"test:///some/path\");\n        Map<String, ?> env = Collections.emptyMap();\n\n        final FileSystem fileSystem = ioService.newFileSystem(uri, env);\n\n        final Path fsRootDirectory1 = mock(JGitPathImpl.class);\n        when(fsRootDirectory1.getFileSystem()).thenReturn(fileSystem);\n        when(fsRootDirectory1.getRoot()).thenReturn(fsRootDirectory1);\n        when(((JGitPathImpl) fsRootDirectory1).getAttrStorage()).thenReturn(mock(AttrsStorage.class));\n\n        final Path fsRootDirectory2 = mock(JGitPathImpl.class);\n        when(fsRootDirectory2.getFileSystem()).thenReturn(fileSystem);\n        when(fsRootDirectory2.getRoot()).thenReturn(fsRootDirectory2);\n        when(((JGitPathImpl) fsRootDirectory2).getAttrStorage()).thenReturn(mock(AttrsStorage.class));\n\n        final Collection<Path> fsRootDirectories = Arrays.asList(fsRootDirectory1, fsRootDirectory2);\n        doReturn(fsRootDirectories).when(fileSystem).getRootDirectories();\n\n        return fileSystem;\n    }\n\n    @Test\n    public void deleteIfExists() throws URISyntaxException {\n\n        final FileSystem fileSystem = getFileSystem();\n        String fsName = \"fsName\";\n        FSPath fsPath = mock(FSPath.class);\n        when(fsPath.getFileSystem()).thenReturn(fileSystem);\n        when(fileSystem.getName()).thenReturn(\"fsName\");\n        doReturn(true).when(ioService).delIfExists(any());\n\n        ioService.deleteIfExists(fsPath);\n\n        InOrder inOrder = Mockito.inOrder(ioService, indexEngine, fileSystem);\n        inOrder.verify(ioService).cleanupDeletedFS(eq(fsName), any());\n        inOrder.verify(indexEngine).delete(any(KCluster.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/common/ConstrainedIndexerSchedulerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io.common;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.AbstractExecutorService;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.function.Supplier;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler.Factory;\nimport org.uberfire.ext.metadata.event.IndexEvent;\nimport org.uberfire.ext.metadata.io.ConstrainedIndexerScheduler.ConstraintBuilder;\n\nimport static java.util.stream.Collectors.toList;\nimport static org.junit.Assert.assertArrayEquals;\nimport static org.junit.Assert.assertEquals;\n\npublic class ConstrainedIndexerSchedulerTest {\n\n    private Map<String, TestJob> testJobs;\n    private CurrentThreadExecutorService executor;\n\n    @Before\n    public void setup() {\n        AtomicInteger counter = new AtomicInteger(0);\n        testJobs = new LinkedHashMap<>();\n        testJobs.put(\"f\", new TestJob(counter));\n        testJobs.put(\"e\", new TestJob(counter));\n        testJobs.put(\"d\", new TestJob(counter));\n        testJobs.put(\"c\", new TestJob(counter));\n        testJobs.put(\"b\", new TestJob(counter));\n        testJobs.put(\"a\", new TestJob(counter));\n\n        executor = new CurrentThreadExecutorService();\n    }\n\n    @Test\n    public void allScheduledWithNoConstraints() throws Exception {\n        final Factory factory = new ConstraintBuilder().createFactory();\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n\n    }\n\n    @Test\n    public void lowerPriorityNumberRunFirst() throws Exception {\n        final Factory factory = new ConstraintBuilder().addPriority(\"a\", -4)\n                                                       .addPriority(\"b\", -3)\n                                                       .addPriority(\"c\", -2)\n                                                       .addPriority(\"d\", -1)\n                                                       .addPriority(\"e\", 0)\n                                                       .addPriority(\"f\", 1)\n                                                       .createFactory();\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n        assertExecutionOrder(\"a\", \"b\", \"c\", \"d\", \"e\", \"f\");\n\n    }\n\n    @Test\n    public void dependencyOrderIsFollowed() throws Exception {\n        final Factory factory = new ConstraintBuilder().addConstraint(\"c\", \"a\")\n                                                       .addConstraint(\"c\", \"b\")\n                                                       .addConstraint(\"d\", \"c\")\n                                                       .addConstraint(\"e\", \"c\")\n                                                       .createFactory();\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n        assertExecutionOrder(\"a\", \"c\", \"d\");\n        assertExecutionOrder(\"b\", \"c\", \"e\");\n    }\n\n    @Test\n    public void dependencyOrderAndPrioritiesAreFollowed() throws Exception {\n        final Factory factory = new ConstraintBuilder().addConstraint(\"c\", \"a\")\n                                                       .addConstraint(\"c\", \"b\")\n                                                       .addConstraint(\"d\", \"c\")\n                                                       .addConstraint(\"e\", \"c\")\n                                                       .addPriority(\"e\", -1)\n                                                       .createFactory();\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n\n        // Dependency order should still be respected\n        assertExecutionOrder(\"a\", \"c\", \"d\");\n        assertExecutionOrder(\"b\", \"c\", \"e\");\n\n        // No dependencies between these two, so priorities should be respected\n        assertExecutionOrder(\"e\", \"d\");\n    }\n\n    @Test\n    public void transitivePrioritiesRespected() throws Exception {\n        final Factory factory = new ConstraintBuilder().addConstraint(\"b\", \"a\")\n                                                       .addPriority(\"a\", 1)\n                                                       .addPriority(\"b\", -1)\n                                                       .createFactory();\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n\n        // Depenency order should still be respected\n        assertExecutionOrder(\"a\", \"b\");\n\n        // a and b should run before all others even though a it is priority=1\n        assertExecutionOrder(\"a\", \"c\");\n        assertExecutionOrder(\"a\", \"d\");\n        assertExecutionOrder(\"a\", \"e\");\n        assertExecutionOrder(\"a\", \"f\");\n        assertExecutionOrder(\"b\", \"c\");\n        assertExecutionOrder(\"b\", \"d\");\n        assertExecutionOrder(\"b\", \"e\");\n        assertExecutionOrder(\"b\", \"f\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void illegalArgumentExceptionWhenMissingJobForDependency() throws Exception {\n        final Factory factory = new ConstraintBuilder().addConstraint(\"b\", \"a\")\n                                                       .createFactory();\n        testJobs.remove(\"a\");\n        factory.create(testJobs);\n    }\n\n    @Test\n    public void canBeMissingJobsWithoutDependencies() throws Exception {\n        final Factory factory = new ConstraintBuilder().addConstraint(\"b\", \"a\")\n                                                       .createFactory();\n        testJobs.remove(\"b\");\n        testJobs.remove(\"c\");\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n    }\n\n    @Test\n    public void usesExecutorService() throws Exception {\n        final Factory factory = new ConstraintBuilder().createFactory();\n        testJobs.keySet().retainAll(Collections.singleton(\"a\"));\n        final IndexerScheduler scheduler = factory.create(testJobs);\n        final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled = scheduler.schedule(executor)\n                                                                                           .collect(toList());\n\n        assertNumberOfFutures(scheduled);\n        assertFuturesCompleted(scheduled);\n        assertCorrectResults(scheduled);\n\n        assertEquals(\"The given executor was not used.\", 1, executor.executeCalls);\n    }\n\n    private void assertExecutionOrder(String... idsInExpectedOrder) {\n        final String[] observedOrder = Arrays.stream(idsInExpectedOrder)\n                                             .map(id -> Pair.newPair(id, testJobs.get(id).getExecutionCounter()))\n                                             .sorted(Comparator.comparingInt(pair -> pair.getK2()))\n                                             .map(pair -> pair.getK1())\n                                             .toArray(n -> new String[n]);\n        assertArrayEquals(\"Execution of jobs was not in the expected order: Observed: \" + Arrays.toString(observedOrder),\n                          idsInExpectedOrder,\n                          observedOrder);\n    }\n\n    private void assertCorrectResults(final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled) {\n        final List<Pair<String, List<IndexEvent>>> results = getResults(scheduled);\n        List<Pair<String, List<IndexEvent>>> expectedResults = testJobs.entrySet()\n                                                                       .stream()\n                                                                       .map(entry -> new Pair<>(entry.getKey(), entry.getValue()\n                                                                                                                     .getWithoutIncrement()))\n                                                                       .collect(toList());\n        assertEquals(\"Should be results for each submitted job.\", expectedResults.size(), results.size());\n    }\n\n    private List<Pair<String, List<IndexEvent>>> getResults(final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled) {\n        final List<Pair<String, List<IndexEvent>>> results = scheduled.stream()\n                                                                      .map(future -> getValue(future))\n                                                                      .collect(toList());\n        return results;\n    }\n\n    private void assertFuturesCompleted(final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled) {\n        assertEquals(\"All futures should be complete because of the executor service used.\",\n                     testJobs.size(),\n                     scheduled.stream()\n                              .filter(future -> future.isDone() && !future.isCompletedExceptionally())\n                              .count());\n    }\n\n    private void assertNumberOfFutures(final List<CompletableFuture<Pair<String, List<IndexEvent>>>> scheduled) {\n        assertEquals(\"Should return as many futures as jobs.\", testJobs.size(), scheduled.size());\n    }\n\n    private Pair<String, List<IndexEvent>> getValue(final CompletableFuture<Pair<String, List<IndexEvent>>> future) {\n        try {\n            return future.get();\n        } catch (InterruptedException | ExecutionException e) {\n            throw new AssertionError(\"Should not be any exceptions extracting values from futures in this test.\", e);\n        }\n    }\n\n    private static class TestJob implements Supplier<List<IndexEvent>> {\n        private final List<IndexEvent> retVal;\n        private Integer executionIndex = null;\n        private AtomicInteger executionCounter;\n\n        TestJob(AtomicInteger executionCounter) {\n            /*\n             * Do not change this to Collections.emptyList(). We want a unique object per TestJob for comparing results..\n             */\n            this.retVal = new ArrayList<>();\n            this.executionCounter = executionCounter;\n        }\n\n        @Override\n        public List<IndexEvent> get() {\n            executionIndex = executionCounter.incrementAndGet();\n            return getWithoutIncrement();\n        }\n\n        public List<IndexEvent> getWithoutIncrement() {\n            return retVal;\n        }\n\n        public int getExecutionCounter() {\n            if (executionIndex == null) {\n                throw new AssertionError(\"TestJob was never executed.\");\n            }\n\n            return executionIndex;\n        }\n\n    }\n\n    private static class CurrentThreadExecutorService extends AbstractExecutorService {\n\n        public int executeCalls = 0;\n\n        @Override\n        public void shutdown() {\n            throw new AssertionError(\"Should not be invoked during test.\");\n        }\n\n        @Override\n        public List<Runnable> shutdownNow() {\n            throw new AssertionError(\"Should not be invoked during test.\");\n        }\n\n        @Override\n        public boolean isShutdown() {\n            return false;\n        }\n\n        @Override\n        public boolean isTerminated() {\n            return false;\n        }\n\n        @Override\n        public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {\n            throw new AssertionError(\"Should not be invoked during test.\");\n        }\n\n        @Override\n        public void execute(Runnable command) {\n            executeCalls++;\n            command.run();\n        }\n\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/common/MetadataIndexEngineBatchTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io.common;\n\nimport java.util.Collections;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.metadata.backend.lucene.model.KClusterImpl;\nimport org.uberfire.ext.metadata.engine.MetaModelStore;\nimport org.uberfire.ext.metadata.io.index.MetadataIndexEngine;\nimport org.uberfire.ext.metadata.io.util.MultiIndexerLock;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.model.impl.KObjectImpl;\nimport org.uberfire.ext.metadata.model.impl.KObjectKeyImpl;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.same;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MetadataIndexEngineBatchTest {\n\n    private static final String TEST_INDEXER = \"test-indexer\";\n\n    private MetadataIndexEngine indexEngine;\n\n    @Mock\n    private IndexProvider provider;\n\n    @Mock\n    private MetaModelStore metaModelStore;\n\n    @Mock\n    private MultiIndexerLock lock;\n\n    private KCluster cluster;\n\n    private KObject kObject;\n\n    private KObjectKey kObjectKey;\n\n    @Before\n    public void setup() {\n        cluster = new KClusterImpl(\"test-cluster\");\n        kObject = new KObjectImpl(\"1\",\n                                  \"java\",\n                                  cluster.getClusterId(),\n                                  \"segment\",\n                                  \"key\",\n                                  Collections.emptyList(),\n                                  true);\n        kObjectKey = new KObjectKeyImpl(\"key\",\n                                        \"2\",\n                                        \"java\",\n                                        cluster.getClusterId(),\n                                        \"segment\");\n        indexEngine = new MetadataIndexEngine(provider, metaModelStore, () -> lock);\n    }\n\n\n    @Test\n    public void indexDeferredInBatchMode() throws Exception {\n        indexEngine.startBatch(cluster);\n        indexEngine.index(kObject);\n\n        verify(provider, never()).index(same(kObject));\n    }\n\n    @Test\n    public void indexCalledWhenBatchCommitted() throws Exception {\n        indexDeferredInBatchMode();\n\n        indexEngine.commit(cluster, TEST_INDEXER);\n        verify(provider).index(same(kObject));\n    }\n\n    @Test\n    public void indexNeverCalledWhenBatchAborted() throws Exception {\n        indexDeferredInBatchMode();\n\n        indexEngine.abort(cluster);\n        verify(provider, never()).index(any(KObject.class));\n    }\n\n    @Test\n    public void renameDeferredInBatchMode() throws Exception {\n        indexEngine.startBatch(cluster);\n        indexEngine.rename(kObjectKey, kObject);\n\n        verify(provider, never()).rename(any(), any(), same(kObject));\n    }\n\n    @Test\n    public void renameCalledWhenBatchCommitted() throws Exception {\n        renameDeferredInBatchMode();\n\n        indexEngine.commit(cluster, TEST_INDEXER);\n        verify(provider).rename(any(), any(), same(kObject));\n    }\n\n    @Test\n    public void renameNeverCalledWhenBatchAborted() throws Exception {\n        renameDeferredInBatchMode();\n\n        indexEngine.abort(cluster);\n        verify(provider, never()).rename(any(), any(), same(kObject));\n    }\n\n    @Test\n    public void deleteDeferredInBatchMode() throws Exception {\n        indexEngine.startBatch(cluster);\n        indexEngine.delete(kObjectKey);\n\n        verify(provider, never()).delete(kObjectKey.getClusterId(), kObjectKey.getId());\n    }\n\n    @Test\n    public void deleteCalledWhenBatchCommitted() throws Exception {\n        deleteDeferredInBatchMode();\n\n        indexEngine.commit(cluster, TEST_INDEXER);\n        verify(provider).delete(kObjectKey.getClusterId(), kObjectKey.getId());\n    }\n\n    @Test\n    public void deleteNeverCalledWhenBatchAborted() throws Exception {\n        deleteDeferredInBatchMode();\n\n        indexEngine.abort(cluster);\n        verify(provider, never()).delete(kObjectKey.getClusterId(), kObjectKey.getId());\n    }\n\n    @Test\n    public void indexIsReadyForClusterIndexedInPreviousServerExecution() throws Exception {\n        when(provider.isFreshIndex(cluster)).thenReturn(false);\n\n        assertTrue(indexEngine.isIndexReady(cluster, TEST_INDEXER));\n    }\n\n    @Test\n    public void indexIsReadyAfterCommit() throws Exception {\n        when(provider.isFreshIndex(cluster)).thenReturn(false);\n\n        indexEngine.startBatch(cluster);\n        indexEngine.index(kObject);\n        indexEngine.commit(cluster, TEST_INDEXER);\n\n        assertTrue(indexEngine.isIndexReady(cluster, TEST_INDEXER));\n    }\n\n    @Test\n    public void indexIsNotReadyForIndexerDuringCommit() throws Exception {\n        when(provider.isFreshIndex(cluster)).thenReturn(false);\n        // Simulate commit in progress by making lock appear held.\n        when(lock.isLockedBy(TEST_INDEXER)).thenReturn(true);\n\n        indexEngine.startBatch(cluster);\n\n        assertFalse(indexEngine.isIndexReady(cluster, TEST_INDEXER));\n    }\n\n    @Test\n    public void indexIsReadyForOtherIndexerDuringCommit() throws Exception {\n        when(provider.isFreshIndex(cluster)).thenReturn(false);\n        // Simulate commit in progress by making lock appear held.\n        when(lock.isLockedBy(any())).then(inv -> TEST_INDEXER.equals(inv.getArgument(0, String.class)));\n\n        indexEngine.startBatch(cluster);\n\n        assertTrue(indexEngine.isIndexReady(cluster, \"other-indexer\"));\n    }\n\n    @Test\n    public void commitAbortedWhenClusterIsDeleted() throws Exception {\n        indexEngine.startBatch(cluster);\n        indexEngine.index(kObject);\n        indexEngine.delete(cluster);\n        indexEngine.commit(cluster, \"test-indexer\");\n\n        verify(provider, never()).index(any(KObject.class));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/common/MultiIndexerLockTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io.common;\n\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.TimeoutException;\nimport java.util.concurrent.locks.ReentrantLock;\nimport java.util.function.Supplier;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.metadata.io.util.MultiIndexerLock;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class MultiIndexerLockTest {\n\n    MultiIndexerLock multiIndexerLock;\n\n    TestThreadWrapper<Boolean> writer1;\n    TestThreadWrapper<Boolean> writer2;\n    TestThreadWrapper<Boolean> reader1;\n    TestThreadWrapper<Boolean> reader2;\n\n    ReentrantLock underlyingLock;\n\n    @Before\n    public void setup() {\n        underlyingLock = new ReentrantLock();\n        multiIndexerLock = new MultiIndexerLock(underlyingLock);\n\n        writer1 = new TestThreadWrapper<>(() -> {\n            multiIndexerLock.lock(\"1\");\n            return true;\n        }, \"writer1\");\n        writer2 = new TestThreadWrapper<>(() -> {\n            multiIndexerLock.lock(\"2\");\n            return true;\n        }, \"writer2\");\n        reader1 = new TestThreadWrapper<>(() -> multiIndexerLock.isLockedBy(\"1\"), \"reader1\");\n        reader2 = new TestThreadWrapper<>(() -> multiIndexerLock.isLockedBy(\"2\"), \"reader2\");\n    }\n\n    @After\n    public void cleanup() {\n        writer1.stop();\n        writer2.stop();\n        reader1.stop();\n        reader2.stop();\n    }\n\n    @Test\n    public void acquiringUncontestedLock() throws Exception {\n        CompletableFuture<Boolean> writer1Result = writer1.start();\n        assertCompletedNormally(1, TimeUnit.SECONDS, writer1Result);\n    }\n\n    @Test\n    public void cannotAcquireOwnedLock() throws Exception {\n        CompletableFuture<Boolean> first = writer1.start();\n        CompletableFuture<Boolean> second = first.thenCompose(ignore -> writer2.start());\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, first);\n        assertIncomplete(1, TimeUnit.SECONDS, second);\n    }\n\n    @Test\n    public void readingReturnsCorrectResultWhileUnlocked() throws Exception {\n        CompletableFuture<Boolean> reader1Result = reader1.start();\n        CompletableFuture<Boolean> reader2Result = reader2.start();\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, reader1Result, reader2Result);\n        assertFalse(reader1Result.get());\n        assertFalse(reader2Result.get());\n    }\n\n    @Test\n    public void readingReturnsCorrectResultWhileLocked() throws Exception {\n        CompletableFuture<Boolean> lockAcquired = writer1.start();\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, lockAcquired);\n        CompletableFuture<Boolean> reader1Result = reader1.start();\n        CompletableFuture<Boolean> reader2Result = reader2.start();\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, reader1Result, reader2Result);\n        assertTrue(reader1Result.get());\n        assertFalse(reader2Result.get());\n    }\n\n    @Test\n    public void writingNotifiesSingleWaitingRead() throws Exception {\n        /*\n         * Simulates lock acquisition starting but not complete.\n         */\n        underlyingLock.lock();\n        writer1.start();\n\n        CompletableFuture<Boolean> readerResult = reader1.start();\n        assertIncomplete(1, TimeUnit.SECONDS, readerResult);\n\n        /*\n         * Now we let the writer finish acquiring the lock.\n         */\n        underlyingLock.unlock();\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, readerResult);\n        assertTrue(readerResult.get());\n    }\n\n    @Test\n    public void writingNotifiesMultipleWaitingReads() throws Exception {\n        /*\n         * Simulates lock acquisition starting but not complete.\n         */\n        underlyingLock.lock();\n        writer1.start();\n\n        CompletableFuture<Boolean> reader1Result = reader1.start();\n        CompletableFuture<Boolean> reader2Result = reader2.start();\n        assertIncomplete(1, TimeUnit.SECONDS, reader1Result, reader2Result);\n\n        /*\n         * Now we let the writer finish acquiring the lock.\n         */\n        underlyingLock.unlock();\n\n        assertCompletedNormally(1, TimeUnit.SECONDS, reader1Result, reader2Result);\n        assertTrue(reader1Result.get());\n        assertFalse(reader2Result.get());\n    }\n\n    private void assertCompletedNormally(long duration, TimeUnit unit, CompletableFuture<?>... futures) {\n        try {\n            CompletableFuture.allOf(futures).get(duration, unit);\n        } catch (InterruptedException | ExecutionException | TimeoutException e) {\n            throw new AssertionError(\"Future did not complete normally.\", e);\n        }\n    }\n\n    private void assertIncomplete(long duration, TimeUnit unit, CompletableFuture<?>... futures) {\n        try {\n            CompletableFuture.allOf(futures).get(duration, unit);\n            throw new AssertionError(\"Futures completed normally.\");\n        } catch (InterruptedException | ExecutionException e) {\n            throw new AssertionError(\"Future completed exceptionally.\", e);\n        } catch (TimeoutException e) {\n            // ignore\n        }\n    }\n\n    private static class TestThreadWrapper<T> {\n        final Thread thread;\n        final CompletableFuture<T> future;\n\n        TestThreadWrapper(Supplier<T> action, String name) {\n            future = new CompletableFuture<>();\n            thread = new Thread(() -> {\n                try {\n                    T t = action.get();\n                    future.complete(t);\n                } catch (Throwable t) {\n                    future.completeExceptionally(t);\n                }\n            }, name);\n        }\n\n        CompletableFuture<T> start() {\n            thread.start();\n\n            return future;\n\n        }\n\n        @SuppressWarnings(\"deprecation\")\n        void stop() {\n            try {\n                thread.stop();\n            } catch (Throwable ignore) {}\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/common/util/TestFileSystemProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.ext.metadata.io.common.util;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.channels.FileChannel;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ExecutorService;\n\nimport org.mockito.Mockito;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.channels.AsynchronousFileChannel;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.DirectoryStream.Filter;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.NotLinkException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic class TestFileSystemProvider implements FileSystemProvider {\n\n    public static abstract class MockFileSystem implements FileSystem, FileSystemId {\n\n    }\n\n    public static String SCHEME = \"test\";\n\n    private boolean isDefault = false;\n\n    private FileSystemProvider internalMock;\n\n    public void resetMock() {\n        internalMock = Mockito.mock(FileSystemProvider.class, Mockito.RETURNS_DEEP_STUBS);\n    }\n\n    public FileSystemProvider getMock() {\n        return internalMock;\n    }\n\n    @Override\n    public void forceAsDefault() {\n        isDefault = true;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return isDefault;\n    }\n\n    @Override\n    public String getScheme() {\n        return SCHEME;\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri, Map<String, ?> env) throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException {\n        return internalMock.newFileSystem(uri, env);\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return internalMock.getFileSystem(uri);\n    }\n\n    @Override\n    public Path getPath(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return internalMock.getPath(uri);\n    }\n\n    @Override\n    public FileSystem newFileSystem(Path path, Map<String, ?> env) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return internalMock.newFileSystem(path, env);\n    }\n\n    @Override\n    public InputStream newInputStream(Path path, OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, NoSuchFileException, IOException, SecurityException {\n        return internalMock.newInputStream(path, options);\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path, OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return internalMock.newOutputStream(path, options);\n    }\n\n    @Override\n    public FileChannel newFileChannel(Path path, Set<? extends OpenOption> options, FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return internalMock.newFileChannel(path, options, attrs);\n    }\n\n    @Override\n    public AsynchronousFileChannel newAsynchronousFileChannel(Path path,\n                                                              Set<? extends OpenOption> options,\n                                                              ExecutorService executor,\n                                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return internalMock.newAsynchronousFileChannel(path, options, executor, attrs);\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> options,\n                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return internalMock.newByteChannel(path, options, attrs);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir, Filter<Path> filter) throws NotDirectoryException, IOException, SecurityException {\n        return internalMock.newDirectoryStream(dir, filter);\n    }\n\n    @Override\n    public void createDirectory(Path dir, FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        internalMock.createDirectory(dir, attrs);\n    }\n\n    @Override\n    public void createSymbolicLink(Path link, Path target, FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        internalMock.createSymbolicLink(link, target, attrs);\n    }\n\n    @Override\n    public void createLink(Path link, Path existing) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        internalMock.createLink(link, existing);\n    }\n\n    @Override\n    public void delete(Path path, DeleteOption... options) throws DirectoryNotEmptyException, NoSuchFileException, IOException, SecurityException {\n        internalMock.delete(path, options);\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path, DeleteOption... options) throws DirectoryNotEmptyException, IOException, SecurityException {\n        return internalMock.deleteIfExists(path, options);\n    }\n\n    @Override\n    public Path readSymbolicLink(Path link) throws UnsupportedOperationException, NotLinkException, IOException, SecurityException {\n        return internalMock.readSymbolicLink(link);\n    }\n\n    @Override\n    public void copy(Path source, Path target, CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        internalMock.copy(source, target, options);\n    }\n\n    @Override\n    public void move(Path source, Path target, CopyOption... options) throws DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        internalMock.move(source, target, options);\n    }\n\n    @Override\n    public boolean isSameFile(Path path, Path path2) throws IOException, SecurityException {\n        return internalMock.isSameFile(path, path2);\n    }\n\n    @Override\n    public boolean isHidden(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return internalMock.isHidden(path);\n    }\n\n    @Override\n    public FileStore getFileStore(Path path) throws IOException, SecurityException {\n        return internalMock.getFileStore(path);\n    }\n\n    @Override\n    public void checkAccess(Path path, AccessMode... modes) throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException {\n        internalMock.checkAccess(path, modes);\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path, Class<V> type, LinkOption... options) throws NoSuchFileException {\n        return internalMock.getFileAttributeView(path, type, options);\n    }\n\n    @Override\n    public <A extends BasicFileAttributes> A readAttributes(Path path, Class<A> type, LinkOption... options) throws NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        return internalMock.readAttributes(path, type, options);\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path, String attributes, LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        return internalMock.readAttributes(path, attributes, options);\n    }\n\n    @Override\n    public void setAttribute(Path path, String attribute, Object value, LinkOption... options) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        internalMock.setAttribute(path, attribute, value, options);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/BaseIndexTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.lang.annotation.Annotation;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Random;\nimport java.util.concurrent.CompletionStage;\nimport java.util.concurrent.Executors;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.util.TypeLiteral;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.MetadataConfig;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler.Factory;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.io.ConstrainedIndexerScheduler.ConstraintBuilder;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher.IndexerDispatcherFactory;\nimport org.uberfire.ext.metadata.io.IndexersFactory;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\n\npublic abstract class BaseIndexTest {\n\n    protected static final Map<String, Path> basePaths = new HashMap<>();\n    protected static final List<File> tempFiles = new ArrayList<>();\n    protected boolean created = false;\n    protected MetadataConfig config;\n    protected IOService ioService = null;\n    private int seed = new Random(10L).nextInt();\n    private IndexersFactory indexersFactory;\n    private IndexerDispatcherFactory indexerDispatcherFactory;\n\n    @BeforeClass\n    public static void beforeClass() throws Throwable {\n        cleanup();\n    }\n\n    @AfterClass\n    public static void afterClass() {\n        cleanup();\n    }\n\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n\n    protected static File createTempDirectory() throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n        tempFiles.add(temp);\n        return temp;\n    }\n\n    protected IOService ioService() {\n\n        if (ioService == null) {\n            config = new MetadataConfigBuilder(\"infinispan\")\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            ioService = new IOServiceIndexedImpl(config.getIndexEngine(),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class);\n        }\n        return ioService;\n    }\n\n    protected IndexersFactory indexersFactory() {\n        if (indexersFactory == null) {\n            indexersFactory = new IndexersFactory();\n        }\n\n        return indexersFactory;\n    }\n\n    protected IndexerDispatcherFactory indexerDispatcherFactory(MetaIndexEngine indexEngine) {\n        if (indexerDispatcherFactory == null) {\n            Factory schedulerFactory = new ConstraintBuilder().createFactory();\n            indexerDispatcherFactory = IndexerDispatcher.createFactory(indexEngine,\n                                                                       schedulerFactory,\n                                                                       testEvent(),\n                                                                       LoggerFactory.getLogger(IndexerDispatcher.class));\n        }\n\n        return indexerDispatcherFactory;\n    }\n\n    private <T> Event<T> testEvent() {\n        return new Event<T>() {\n\n            @Override\n            public void fire(T event) {\n            }\n\n            @Override\n            public <U extends T> CompletionStage<U> fireAsync(U u) {\n                return null;\n            }\n\n            @Override\n            public <U extends T> CompletionStage<U> fireAsync(U u,\n                                                              NotificationOptions notificationOptions) {\n                return null;\n            }\n\n            @Override\n            public Event<T> select(Annotation... qualifiers) {\n                return this;\n            }\n\n            @Override\n            public <U extends T> Event<U> select(Class<U> subtype,\n                                                 Annotation... qualifiers) {\n                return (Event<U>) this;\n            }\n\n            @Override\n            public <U extends T> Event<U> select(TypeLiteral<U> subtype,\n                                                 Annotation... qualifiers) {\n                return (Event<U>) this;\n            }\n        };\n    }\n\n    protected String getSimpleName() {\n        return \"indexable\" + this.getClass().getSimpleName();\n    }\n\n    @Before\n    public void setup() throws IOException {\n        indexersFactory().clear();\n        if (!created) {\n            final String path = createTempDirectory().getAbsolutePath();\n            System.setProperty(\"org.uberfire.nio.git.dir\",\n                               path);\n            System.out.println(\".niogit: \" + path);\n\n            for (String repositoryName : getRepositoryNames()) {\n                final URI newRepo = URI.create(\"git://\" + repositoryName);\n\n                try {\n                    ioService().newFileSystem(newRepo,\n                                              new HashMap<>());\n\n                    final Path basePath = getDirectoryPath(repositoryName).resolveSibling(\"root\");\n                    basePaths.put(repositoryName,\n                                  basePath);\n                } catch (final FileSystemAlreadyExistsException ex) {\n                    // ignored\n                } finally {\n                    created = true;\n                }\n            }\n        }\n    }\n\n    @After\n    public void tearDown() {\n        this.ioService.dispose();\n    }\n\n    protected abstract String[] getRepositoryNames();\n\n    protected Path getBasePath(final String repositoryName) {\n        return basePaths.get(repositoryName);\n    }\n\n    private Path getDirectoryPath(final String repositoryName) {\n        final Path dir = ioService().get(URI.create(\"git://\" + repositoryName + \"/_someDir\" + seed));\n        ioService().deleteIfExists(dir);\n        return dir;\n    }\n\n    public void setupCountDown(final int i) {\n        // do nothing -- Byteman will inject code here\n    }\n\n    public void waitForCountDown(final int timout) {\n        // do nothing -- Byteman will inject code here\n    }\n\n    public int getStartBatchCount() {\n        // do nothing -- Byteman will inject code here\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/BatchIndexConcurrencyTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.Executors;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class BatchIndexConcurrencyTest extends BaseIndexTest {\n\n    private MetaIndexEngine metaIndexEngine;\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"indexable-\" + this.getClass().getSimpleName()};\n    }\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder(\"infinispan\")\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            metaIndexEngine = spy(config.getIndexEngine());\n\n            ioService = new IOServiceIndexedImpl(metaIndexEngine,\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class) {\n                @Override\n                protected void setupWatchService(final FileSystem fs) {\n                    //No WatchService for this test\n                }\n            };\n        }\n        return ioService;\n    }\n\n    @Test\n    //See https://bugzilla.redhat.com/show_bug.cgi?id=1288132\n    public void testSingleConcurrentBatchIndexExecution() throws IOException, InterruptedException {\n        //Write a file to ensure the FileSystem has a Root Directory\n        final Path path1 = getBasePath(\"indexable-\" + this.getClass().getSimpleName()).resolve(\"xxx\");\n        ioService().write(path1,\n                          \"xxx!\");\n\n        setupCountDown(1);\n\n        final URI fsURI = URI.create(\"git://indexable-\" + this.getClass().getSimpleName() + \"/file1\");\n\n        //Make multiple requests for the FileSystem. We should only have one batch index operation\n        final CountDownLatch startSignal = new CountDownLatch(1);\n        for (int i = 0; i < 3; i++) {\n            Runnable r = () -> {\n                try {\n                    startSignal.await();\n                    ioService().getFileSystem(fsURI);\n                } catch (InterruptedException e) {\n                    fail(e.getMessage());\n                }\n            };\n            new Thread(r).start();\n        }\n        startSignal.countDown();\n\n        waitForCountDown(1000);\n\n        assertEquals(1,\n                     getStartBatchCount());\n        verify(metaIndexEngine,\n               times(3)).freshIndex(any(KCluster.class));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/BatchIndexSingleThreadTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.net.URI;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMUnitConfig(debug = true)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class BatchIndexSingleThreadTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"infinispan/\" + this.getClass().getSimpleName()};\n    }\n\n    @Test\n    //See https://bugzilla.redhat.com/show_bug.cgi?id=1288132\n    public void testSingleBatchIndexExecution() throws InterruptedException {\n        final Path path1 = getBasePath(\"infinispan/\" + this.getClass().getSimpleName()).resolve(\"xxx\");\n        ioService().write(path1,\n                          \"xxx!\");\n\n        setupCountDown(3);\n        //Make multiple requests for the FileSystem. We should only have one batch index operation\n        final URI fsURI = URI.create(\"git://infinispan/\" + this.getClass().getSimpleName() + \"/file1\");\n\n        final FileSystem fs1 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs1);\n\n        final FileSystem fs2 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs2);\n\n        final FileSystem fs3 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs3);\n\n        waitForCountDown(1000);\n\n        assertEquals(1,\n                     getStartBatchCount());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/BatchIndexTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.junit.Test;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.BatchIndexListener;\nimport org.uberfire.ext.metadata.engine.Observer;\nimport org.uberfire.ext.metadata.io.BatchIndex;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\npublic class BatchIndexTest extends BaseIndexTest {\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder(\"infinispan\")\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n            ioService = new IOServiceDotFileImpl();\n        }\n        return ioService;\n    }\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"elastic-temp-repo-test\"};\n    }\n\n    @Test\n    public void testIndex() throws IOException, InterruptedException {\n        {\n            final Path file = ioService().get(\"git://elastic-temp-repo-test/path/to/file.txt\");\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My User Name Here\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"initial document version, should be revised later.\";\n                                  }\n                              }\n            );\n        }\n        {\n            final Path file = ioService().get(\"git://elastic-temp-repo-test/path/to/some/complex/file.txt\");\n            ioService().write(file,\n                              \"some other content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My Second User Name\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"important document, should be used right now.\";\n                                  }\n                              }\n            );\n        }\n        {\n            final Path file = ioService().get(\"git://elastic-temp-repo-test/simple.doc\");\n            ioService().write(file,\n                              \"some doc content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My Original User\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"unlock document updated, should be checked by boss.\";\n                                  }\n                              }\n            );\n        }\n\n        {\n            final Path file = ioService().get(\"git://elastic-temp-repo-test/xxx/simple.xls\");\n            ioService().write(file,\n                              \"plans!?\");\n        }\n\n        new BatchIndex(config.getIndexEngine(),\n                       new Observer() {\n                           @Override\n                           public void information(final String message) {\n\n                           }\n\n                           @Override\n                           public void warning(final String message) {\n\n                           }\n\n                           @Override\n                           public void error(final String message) {\n\n                           }\n                       },\n                       Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                       indexersFactory(),\n                       indexerDispatcherFactory(config.getIndexEngine()),\n                       new BatchIndexListener() {\n                           @Override\n                           public void notifyIndexIngStarted(KCluster kCluster, Path path) {\n\n                           }\n\n                           @Override\n                           public void notifyIndexIngFinished(KCluster kCluster, Path path) {\n\n                           }\n                       },\n                       DublinCoreView.class).run(ioService().get(\"git://elastic-temp-repo-test/\").getFileSystem(),\n                                                 () -> {\n                                                     try {\n\n                                                         Thread.sleep(2000l);\n\n                                                         KCluster kcluster = toKCluster(ioService().get(\"git://elastic-temp-repo-test/\"));\n                                                         List<String> indices = Arrays.asList(kcluster.getClusterId());\n                                                         IndexProvider provider = this.config.getIndexProvider();\n\n                                                         {\n\n                                                             long hits = provider.findHitsByQuery(indices,\n                                                                                                  new MatchAllDocsQuery());\n\n                                                             assertEquals(4,\n                                                                          hits);\n                                                         }\n\n                                                         {\n\n                                                             long hits = provider.findHitsByQuery(indices,\n                                                                                                  new TermQuery(new Term(\"dcore.author\",\n                                                                                                                         \"name\")));\n\n                                                             assertEquals(2,\n                                                                          hits);\n                                                         }\n\n                                                         {\n                                                             long hits = provider.findHitsByQuery(indices,\n                                                                                                  new TermQuery(new Term(\"dcore.author\",\n                                                                                                                         \"second\")));\n                                                             assertEquals(1,\n                                                                          hits);\n                                                         }\n                                                     } catch (Exception ex) {\n                                                         ex.printStackTrace();\n                                                         fail();\n                                                     }\n                                                 });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/ComplexFieldsTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.analysis.Analyzer;\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.backend.lucene.analyzer.FilenameAnalyzer;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class ComplexFieldsTest extends BaseIndexTest {\n\n    @Override\n    protected IOService ioService() {\n\n        if (ioService == null) {\n            config = new MetadataConfigBuilder(\"infinispan\")\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .usingAnalyzers(new HashMap<String, Analyzer>() {{\n                        put(\"file\",\n                            new FilenameAnalyzer());\n                    }})\n                    .build();\n\n            ioService = new IOServiceIndexedImpl(config.getIndexEngine(),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class);\n        }\n        return ioService;\n    }\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"elastic_complex_fields_test\"};\n    }\n\n    @Test\n    public void testIndex() throws IOException, InterruptedException {\n        setupCountDown(1);\n        {\n            final Path file = ioService().get(\"git://elastic_complex_fields_test/path/to/file.txt\");\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"file\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"default://main@file/kie\";\n                                  }\n                              });\n        }\n        waitForCountDown(5000);\n        setupCountDown(1);\n        {\n            final Path file = ioService().get(\"git://elastic_complex_fields_test/path/to/files.txt\");\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"file\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"default://main@files/kie\";\n                                  }\n                              });\n        }\n        waitForCountDown(5000);\n\n        {\n            List<KObject> result = config.getIndexProvider().findByQuery(Arrays.asList(\"elastic_complex_fields_test__main\"),\n                                                                         new WildcardQuery(new Term(\"file\",\n                                                                                                    \"default://main@files/kie\")),\n                                                                         null,\n                                                                         0);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            List<KObject> result = config.getIndexProvider().findByQuery(Arrays.asList(\"elastic_complex_fields_test__main\"),\n                                                                         new WildcardQuery(new Term(\"file\",\n                                                                                                    \"default://main@file/kie\")),\n                                                                         null,\n                                                                         0);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            List<KObject> result = config.getIndexProvider().findByQuery(Arrays.asList(\"elastic_complex_fields_test__main\"),\n                                                                         new WildcardQuery(new Term(\"file\",\n                                                                                                    \"default://main@notFound\")),\n                                                                         null,\n                                                                         0);\n\n            assertEquals(0,\n                         result.size());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/FullTextSearchIndexTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.KObjectUtil;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.engine.MetaIndexEngine.FULL_TEXT_FIELD;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class FullTextSearchIndexTest extends BaseIndexTest {\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder(\"infinispan\")\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            ioService = new IOServiceIndexedImpl(config.getIndexEngine(),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class);\n\n            indexersFactory().addIndexer(new MockIndexer());\n        }\n        return ioService;\n    }\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"indexable_\" + this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testFullTextIndexedFile() throws IOException, InterruptedException {\n        setupCountDown(2);\n        final Path path1 = getBasePath(\"indexable_\" + this.getClass().getSimpleName()).resolve(\"mydrlfile1.drl\");\n        ioService().write(path1,\n                          \"Some cheese\");\n\n        waitForCountDown(10000);\n\n        List<String> indices = Arrays.asList(toProtobufFormat(toKCluster(path1).getClusterId()));\n        IndexProvider provider = this.config.getIndexProvider();\n\n        {\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"*file*\"));\n\n            long hits = provider.findHitsByQuery(indices,\n                                                 query);\n\n            assertEquals(1,\n                         hits);\n        }\n\n        {\n\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"*mydrlfile1*\"));\n\n            long hits = provider.findHitsByQuery(indices,\n                                                 query);\n\n            assertEquals(1,\n                         hits);\n        }\n\n        setupCountDown(2);\n\n        final Path path2 = getBasePath(\"indexable_\" + this.getClass().getSimpleName()).resolve(\"a.drl\");\n        ioService().write(path2,\n                          \"Some cheese\");\n\n        waitForCountDown(10000);\n\n        {\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"a.d*\"));\n            long hits = provider.findHitsByQuery(indices,\n                                                 query);\n\n            assertEquals(1,\n                         hits);\n        }\n    }\n\n    private static class MockIndexer implements Indexer {\n\n        @Override\n        public boolean supportsPath(final Path path) {\n            return true;\n        }\n\n        @Override\n        public KObject toKObject(final Path path) {\n            return new TestKObjectWrapper(KObjectUtil.toKObject(path));\n        }\n\n        @Override\n        public KObjectKey toKObjectKey(final Path path) {\n            return new TestKObjectKeyWrapper(KObjectUtil.toKObjectKey(path));\n        }\n    }\n\n    private static class TestKObjectKeyWrapper implements KObjectKey {\n\n        protected KObjectKey delegate;\n\n        private TestKObjectKeyWrapper(final KObjectKey delegate) {\n            this.delegate = delegate;\n        }\n\n        @Override\n        public String getId() {\n            return delegate.getId() + \"-refactoring\";\n        }\n\n        @Override\n        public MetaType getType() {\n            return delegate.getType();\n        }\n\n        @Override\n        public String getClusterId() {\n            return delegate.getClusterId();\n        }\n\n        @Override\n        public String getSegmentId() {\n            return delegate.getSegmentId();\n        }\n\n        @Override\n        public String getKey() {\n            return delegate.getKey();\n        }\n    }\n\n    private static class TestKObjectWrapper extends TestKObjectKeyWrapper implements KObject {\n\n        private TestKObjectWrapper(final KObject delegate) {\n            super(delegate);\n        }\n\n        @Override\n        public Iterable<KProperty<?>> getProperties() {\n            return ((KObject) delegate).getProperties();\n        }\n\n        @Override\n        public boolean fullText() {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOSearchServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.List;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.io.IOSearchServiceImpl;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOSearchServiceImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testFullTextSearch() throws IOException, InterruptedException {\n        setupCountDown(3);\n\n        final IOSearchServiceImpl searchIndex = new IOSearchServiceImpl(config.getSearchIndex(),\n                                                                        ioService());\n\n        final Path path1 = getBasePath(getSimpleName()).resolve(\"g.txt\");\n        ioService().write(path1,\n                          \"ooooo!\");\n\n        final Path path2 = getBasePath(getSimpleName()).resolve(\"a.txt\");\n        ioService().write(path2,\n                          \"ooooo!\");\n\n        final Path path3 = getBasePath(getSimpleName()).resolve(\"the.txt\");\n        ioService().write(path3,\n                          \"ooooo!\");\n\n        final Path root = path1.getRoot();\n\n        waitForCountDown(10000);\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"g\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"a\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"the\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(0,\n                         result.size());\n        }\n\n        {\n            try {\n                searchIndex.fullTextSearch(null,\n                                           new IOSearchService.NoOpFilter(),\n                                           root);\n                fail();\n            } catch (final IllegalArgumentException ignored) {\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOServiceIndexedDeleteFileTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.jboss.byteman.contrib.bmunit.BMUnitRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(BMUnitRunner.class)\n@BMUnitConfig(debug = true)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOServiceIndexedDeleteFileTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testDeleteFile() {\n        setupCountDown(1);\n        final Path path = getBasePath(getSimpleName()).resolve(\"delete-me.txt\");\n        ioService().write(path,\n                          \"content\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"delete\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"me\";\n                              }\n                          });\n\n        waitForCountDown(1000);\n\n        List<String> indices = Arrays.asList(toProtobufFormat(toKCluster(path).getClusterId()));\n        IndexProvider provider = this.config.getIndexProvider();\n\n        //Check the file has been indexed\n        long hits = provider.findHitsByQuery(indices,\n                                             new TermQuery(new Term(\"delete\",\n                                                                    \"me\")));\n\n        assertEquals(1,\n                     hits);\n\n        setupCountDown(2);\n\n        //Delete and re-check the index\n        ioService().delete(path);\n\n        waitForCountDown(1000);\n\n        hits = provider.findHitsByQuery(indices,\n                                        new TermQuery(new Term(\"delete\",\n                                                               \"me\")));\n\n        assertEquals(0,\n                     hits);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOServiceIndexedDotFileGitImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOServiceIndexedDotFileGitImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedDotFile() throws IOException, InterruptedException {\n        setupCountDown(1);\n        final Path path = getBasePath(getSimpleName()).resolve(\"dotFile.txt\");\n        //Write the \"real path\" with no attributes and hence no \"dot file\"\n        ioService().write(path,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet());\n\n        waitForCountDown(1000);\n        setupCountDown(1);\n        //Write an unmodified \"real path\" with attributes. This leads to only the \"dot path\" being indexed.\n        ioService().write(path,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        waitForCountDown(1000);\n\n        final MetaObject mo = config.getMetaModelStore().getMetaObject(Path.class.getName());\n\n        assertNotNull(mo);\n        assertNotNull(mo.getProperty(\"name\").get());\n        assertEquals(1,\n                     mo.getProperty(\"name\").get().getTypes().size());\n        assertTrue(mo.getProperty(\"name\").get().getTypes().contains(String.class));\n\n        List<String> indices = Arrays.asList(toProtobufFormat(toKCluster(path).getClusterId()));\n        IndexProvider provider = this.config.getIndexProvider();\n\n        //Check the file has been indexed\n        long hits = provider.findHitsByQuery(indices,\n                                             new TermQuery(new Term(\"name\",\n                                                                    \"value\")));\n\n        assertEquals(1,\n                     hits);\n    }\n\n    private FileAttribute<?>[] getFileAttributes() {\n        return new FileAttribute<?>[]{\n                new FileAttribute<String>() {\n                    @Override\n                    public String name() {\n                        return \"name\";\n                    }\n\n                    @Override\n                    public String value() {\n                        return \"value\";\n                    }\n                }};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOServiceIndexedDotFileGitInternalImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOServiceIndexedDotFileGitInternalImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedGitInternalDotFile() {\n        setupCountDown(1);\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\".gitkeep\");\n        ioService().write(path1,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        final Path path2 = getBasePath(this.getClass().getSimpleName()).resolve(\"afile\");\n        ioService().write(path2,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        waitForCountDown(5000);\n\n        final String index = toProtobufFormat(toKCluster(path1).getClusterId());\n\n        TermQuery query = new TermQuery(new Term(\"name\",\n                                                 \"value\"));\n\n        List<KObject> hits = config.getIndexProvider().findByQuery(Arrays.asList(index),\n                                                                   query,\n                                                                   10);\n\n        assertEquals(1,\n                     hits.size());\n\n        assertEquals(hits.get(0).getKey(),\n                     path2.toUri().toString());\n    }\n\n    private FileAttribute<?>[] getFileAttributes() {\n        return new FileAttribute<?>[]{\n                new FileAttribute<String>() {\n                    @Override\n                    public String name() {\n                        return \"name\";\n                    }\n\n                    @Override\n                    public String value() {\n                        return \"value\";\n                    }\n                }};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOServiceIndexedGitImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOServiceIndexedGitImplTest extends BaseIndexTest {\n\n    protected final Date dateValue = new Date();\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedFile() throws IOException, InterruptedException {\n        setupCountDown(2);\n        final Path path1 = getBasePath(getSimpleName()).resolve(\"myIndexedFile.txt\");\n        ioService().write(path1,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          },\n                          new FileAttribute<String>() {\n                              @Override\n                              public String name() {\n                                  return \"int.hello\";\n                              }\n\n                              @Override\n                              public String value() {\n                                  return \"hello some world jhere\";\n                              }\n                          });\n\n        final Path path2 = getBasePath(getSimpleName()).resolve(\"myOtherIndexedFile.txt\");\n        ioService().write(path2,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<String>() {\n                              @Override\n                              public String name() {\n                                  return \"int.hello\";\n                              }\n\n                              @Override\n                              public String value() {\n                                  return \"jhere\";\n                              }\n                          });\n\n        waitForCountDown(1000);\n\n        Thread.sleep(2000);\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()));\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get());\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get());\n\n        assertEquals(1,\n                     config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get().getTypes().size());\n        assertEquals(1,\n                     config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get().getTypes().size());\n\n        assertTrue(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get().getTypes().contains(String.class));\n        assertTrue(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get().getTypes().contains(Date.class));\n\n        List<String> indices = Arrays.asList(toProtobufFormat(toKCluster(path2).getClusterId()));\n        IndexProvider provider = this.config.getIndexProvider();\n\n        {\n            long hits = provider.findHitsByQuery(indices,\n                                                 new TermQuery(new Term(\"int.hello\",\n                                                                        \"world\")));\n            assertEquals(1,\n                         hits);\n        }\n\n        {\n            long hits = provider.findHitsByQuery(indices,\n                                                 new TermQuery(new Term(\"int.hello\",\n                                                                        \"jhere\")));\n            assertEquals(2,\n                         hits);\n        }\n\n        {\n\n            long hits = provider.findHitsByQuery(indices,\n                                                 new MatchAllDocsQuery());\n            assertEquals(2,\n                         hits);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IOServiceIndexedSortingTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.stream.StreamSupport;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.Sort;\nimport org.apache.lucene.search.SortField;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.provider.IndexProvider;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IOServiceIndexedSortingTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testSortedFiles() {\n\n        //Write files in reverse order so natural Lucene order would be c, b, a\n        final Path base = writeFile(\"cFile1.txt\");\n        writeFile(\"CFile2.txt\");\n        writeFile(\"bFile.txt\");\n        writeFile(\"aFile.txt\");\n\n        List<String> indices = Arrays.asList(toProtobufFormat(toKCluster(base).getClusterId()));\n        IndexProvider provider = this.config.getIndexProvider();\n\n        {\n            final Sort sort = new Sort(new SortField(FieldFactory.FILE_NAME_FIELD_SORTED,\n                                                     SortField.Type.STRING));\n            final Query query = new WildcardQuery(new Term(\"filename\",\n                                                           \"*txt\"));\n\n            List<KObject> documents = provider.findByQuery(indices,\n                                                           query,\n                                                           sort,\n                                                           10);\n\n            assertEquals(4,\n                         documents.size());\n            assertEquals(\"aFile.txt\",\n                         getProperty(documents.get(0),\n                                     \"filename\").getValue());\n            assertEquals(\"bFile.txt\",\n                         getProperty(documents.get(1),\n                                     \"filename\").getValue());\n            assertEquals(\"cFile1.txt\",\n                         getProperty(documents.get(2),\n                                     \"filename\").getValue());\n            assertEquals(\"CFile2.txt\",\n                         getProperty(documents.get(3),\n                                     \"filename\").getValue());\n        }\n    }\n\n    private KProperty<?> getProperty(KObject document,\n                                     String name) {\n        return StreamSupport\n                .stream(document.getProperties().spliterator(),\n                        false)\n                .filter(kProperty -> kProperty.getName().equals(name))\n                .findAny().get();\n    }\n\n    private Path writeFile(final String fileName) {\n        setupCountDown(1);\n        final Path path = getBasePath(getSimpleName()).resolve(fileName);\n        ioService().write(path,\n                          \"content\",\n                          Collections.<OpenOption>emptySet());\n        waitForCountDown(1000);\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/IndexTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.SegmentedPath;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class IndexTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName() + \"_1\", getSimpleName() + \"_2\"};\n    }\n\n    @Test\n    public void testClusterSegments() throws IOException, InterruptedException {\n        setupCountDown(2);\n        //Add test files\n        final Path path1 = getBasePath(getSimpleName() + \"_1\").resolve(\"indexedFile1.txt\");\n        ioService().write(path1,\n                          \"content1\");\n        final Path path2 = getBasePath(getSimpleName() + \"_2\").resolve(\"indexedFile2.txt\");\n        ioService().write(path2,\n                          \"content2\");\n\n        //Setup ClusterSegments\n        final ClusterSegment cs1 = new ClusterSegment() {\n            @Override\n            public String getClusterId() {\n                return (((FileSystemId) getBasePath(getSimpleName() + \"_1\").getFileSystem()).id() + \"/main\");\n            }\n\n            @Override\n            public String[] segmentIds() {\n                return new String[]{((SegmentedPath) getBasePath(getSimpleName() + \"_1\")).getSegmentId()};\n            }\n        };\n        final ClusterSegment cs2 = new ClusterSegment() {\n            @Override\n            public String getClusterId() {\n                return ((FileSystemId) getBasePath(getSimpleName() + \"_2\").getFileSystem()).id() + \"/main\";\n            }\n\n            @Override\n            public String[] segmentIds() {\n                return new String[]{((SegmentedPath) getBasePath(getSimpleName() + \"_2\")).getSegmentId()};\n            }\n        };\n\n        waitForCountDown(10000);\n\n        final Map<String, Object> attributes = new HashMap<String, Object>() {{\n            put(\"filename\",\n                \"*txt\");\n        }};\n\n        //Attribute Search\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter());\n            assertEquals(0,\n                         hits);\n            assertEquals(0,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs1);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs1);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs2);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs2);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs1,\n                                                                       cs2);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs1,\n                                                                                cs2);\n            assertEquals(2,\n                         hits);\n            assertEquals(2,\n                         results.size());\n        }\n\n        //Full Text Search\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\");\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter());\n            assertEquals(0,\n                         hits);\n            assertEquals(0,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs1);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs1);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs2);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs2);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs1,\n                                                                        cs2);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs1,\n                                                                                 cs2);\n            assertEquals(2,\n                         hits);\n            assertEquals(2,\n                         results.size());\n        }\n    }\n\n    protected String getSimpleName() {\n        return \"indexable_\" + IndexTest.this.getClass().getSimpleName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/ReplaceIndexedObjectTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.backend.infinispan.utils.AttributesUtil.toProtobufFormat;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"infinispan.btm\")\npublic class ReplaceIndexedObjectTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{getSimpleName()};\n    }\n\n    @Test\n    public void testIndexSameFileTwice() {\n\n        final Path file = ioService().get(\"git://\" + getSimpleName() + \"/path/to/file.txt\");\n        {\n            setupCountDown(1);\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"file\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"default://main@file/kie\";\n                                  }\n                              });\n\n            waitForCountDown(1000);\n            setupCountDown(2);\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"file\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"default://main@file/kies\";\n                                  }\n                              });\n            waitForCountDown(1000);\n        }\n\n        List<KObject> result = config.getIndexProvider().findByQuery(Arrays.asList(toProtobufFormat(getSimpleName()+\"/main\")),\n                                                                     new MatchAllDocsQuery(),\n                                                                     null,\n                                                                     0);\n\n        assertEquals(1,\n                     result.size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/suite/InfinispanTestProperties.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan.suite;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Properties;\n\nimport org.apache.commons.lang3.StringUtils;\n\npublic class InfinispanTestProperties {\n\n    public static final String VERSION = \"version\";\n    public static final String IMAGE = \"image\";\n    public static final String USER = \"user\";\n    public static final String PASSWORD = \"password\";\n    public static final String ISPN_PROPERTIES = \"ispn.properties\";\n    private final Properties props;\n\n    private static class LazyHolder {\n\n        static final InfinispanTestProperties INSTANCE = new InfinispanTestProperties();\n    }\n\n    public static InfinispanTestProperties getInstance() {\n        return LazyHolder.INSTANCE;\n    }\n\n    InfinispanTestProperties() {\n\n        InputStream resource = this.getClass().getClassLoader().getResourceAsStream(ISPN_PROPERTIES);\n        props = new Properties();\n        try {\n            props.load(resource);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n\n    private String getProp(String key,\n                           Properties props) {\n        Properties systemProps = System.getProperties();\n        String prop = systemProps.getProperty(key);\n        if (StringUtils.isEmpty(prop)) {\n            prop = props.getProperty(key);\n        }\n        return prop;\n    }\n\n    public String getVersion() {\n        return this.getProp(VERSION,\n                            props);\n    }\n\n    public String getImage() {\n        return this.getProp(IMAGE,\n                            props);\n    }\n\n    public String getUser() {\n        return this.getProp(USER,\n                            props);\n    }\n\n    public String getPassword() {\n        return this.getProp(PASSWORD,\n                            props);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/infinispan/suite/InfinispanTestSuite.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.metadata.io.infinispan.suite;\n\nimport org.arquillian.cube.docker.junit.rule.ContainerDslRule;\nimport org.junit.ClassRule;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.uberfire.ext.metadata.io.infinispan.BatchIndexConcurrencyTest;\nimport org.uberfire.ext.metadata.io.infinispan.BatchIndexSingleThreadTest;\nimport org.uberfire.ext.metadata.io.infinispan.BatchIndexTest;\nimport org.uberfire.ext.metadata.io.infinispan.ComplexFieldsTest;\nimport org.uberfire.ext.metadata.io.infinispan.FullTextSearchIndexTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOSearchServiceImplTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOServiceIndexedDeleteFileTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOServiceIndexedDotFileGitImplTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOServiceIndexedDotFileGitInternalImplTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOServiceIndexedGitImplTest;\nimport org.uberfire.ext.metadata.io.infinispan.IOServiceIndexedSortingTest;\nimport org.uberfire.ext.metadata.io.infinispan.IndexTest;\nimport org.uberfire.ext.metadata.io.infinispan.ReplaceIndexedObjectTest;\n\n@RunWith(Suite.class)\n@Suite.SuiteClasses({\n        IndexTest.class,\n        BatchIndexConcurrencyTest.class,\n        BatchIndexSingleThreadTest.class,\n        BatchIndexTest.class,\n        ComplexFieldsTest.class,\n        FullTextSearchIndexTest.class,\n        IOSearchServiceImplTest.class,\n        IOServiceIndexedDeleteFileTest.class,\n        IOServiceIndexedDotFileGitImplTest.class,\n        IOServiceIndexedDotFileGitInternalImplTest.class,\n        IOServiceIndexedGitImplTest.class,\n        IOServiceIndexedSortingTest.class,\n        ReplaceIndexedObjectTest.class\n})\npublic class InfinispanTestSuite {\n\n    private static InfinispanTestProperties props = InfinispanTestProperties.getInstance();\n\n    private static String imageName = props.getImage()\n            + \":\"\n            + props.getVersion();\n\n//    @ClassRule\n//    public static ContainerDslRule infinispan = new ContainerDslRule(imageName)\n//            .withEnvironment(\"APP_USER\",\n//                             props.getUser())\n//            .withEnvironment(\"APP_PASS\",\n//                             props.getPassword())\n//            .withPortBinding(8080,\n//                             11222);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/BaseIndexTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.lang.annotation.Annotation;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Random;\nimport java.util.concurrent.CompletionStage;\nimport java.util.concurrent.Executors;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.util.TypeLiteral;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.MetadataConfig;\nimport org.uberfire.ext.metadata.engine.IndexerScheduler.Factory;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.io.ConstrainedIndexerScheduler.ConstraintBuilder;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher;\nimport org.uberfire.ext.metadata.io.IndexerDispatcher.IndexerDispatcherFactory;\nimport org.uberfire.ext.metadata.io.IndexersFactory;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.Path;\n\npublic abstract class BaseIndexTest {\n\n    protected static final Map<String, Path> basePaths = new HashMap<>();\n    protected static final List<File> tempFiles = new ArrayList<>();\n    protected boolean created = false;\n    protected MetadataConfig config;\n    protected IOService ioService = null;\n    private int seed = new Random(10L).nextInt();\n    private Logger logger = LoggerFactory.getLogger(BaseIndexTest.class);\n    private IndexersFactory indexersFactory;\n    private IndexerDispatcherFactory indexerDispatcherFactory;\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n\n    protected static File createTempDirectory() throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n        tempFiles.add(temp);\n        return temp;\n    }\n\n    protected IOService ioService() {\n\n        if (ioService == null) {\n            config = new MetadataConfigBuilder()\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            ioService = new IOServiceIndexedImpl(config.getIndexEngine(),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class);\n        }\n        return ioService;\n    }\n\n    protected IndexerDispatcherFactory indexerDispatcherFactory(MetaIndexEngine indexEngine) {\n        if (indexerDispatcherFactory == null) {\n            Factory schedulerFactory = new ConstraintBuilder().createFactory();\n            indexerDispatcherFactory = IndexerDispatcher.createFactory(indexEngine, schedulerFactory, testEvent(), LoggerFactory.getLogger(IndexerDispatcher.class));\n        }\n\n        return indexerDispatcherFactory;\n    }\n\n    protected IndexersFactory indexersFactory() {\n        if (indexersFactory == null) {\n            indexersFactory = new IndexersFactory();\n        }\n\n        return indexersFactory;\n    }\n\n    private <T> Event<T> testEvent() {\n        return new Event<T>() {\n\n            @Override\n            public void fire(T event) {\n            }\n\n            @Override\n            public <U extends T> CompletionStage<U> fireAsync(U u) {\n                return null;\n            }\n\n            @Override\n            public <U extends T> CompletionStage<U> fireAsync(U u,\n                                                              NotificationOptions notificationOptions) {\n                return null;\n            }\n\n            @Override\n            public Event<T> select(Annotation... qualifiers) {\n                return this;\n            }\n\n            @Override\n            public <U extends T> Event<U> select(Class<U> subtype, Annotation... qualifiers) {\n                return (Event<U>) this;\n            }\n\n            @Override\n            public <U extends T> Event<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {\n                return (Event<U>) this;\n            }\n        };\n    }\n\n    @Before\n    public void setup() throws IOException {\n        indexersFactory().clear();\n        if (!created) {\n            final String path = createTempDirectory().getAbsolutePath();\n            System.setProperty(\"org.uberfire.nio.git.dir\",\n                               path);\n            System.out.println(\".niogit: \" + path);\n\n            for (String repositoryName : getRepositoryNames()) {\n\n                final URI newRepo = URI.create(\"git://\" + repositoryName);\n\n                try {\n                    ioService().newFileSystem(newRepo,\n                                              new HashMap<String, Object>());\n\n                    final Path basePath = getDirectoryPath(repositoryName).resolveSibling(\"root\");\n                    basePaths.put(repositoryName,\n                                  basePath);\n                } catch (final Exception ex) {\n                    logger.error(\"error\",\n                                 ex);\n                    // ignored\n                } finally {\n                    created = true;\n                }\n            }\n        }\n    }\n\n    protected abstract String[] getRepositoryNames();\n\n    protected Path getBasePath(final String repositoryName) {\n        return basePaths.get(repositoryName);\n    }\n\n    private Path getDirectoryPath(final String repositoryName) {\n        final Path dir = ioService().get(URI.create(\"git://\" + repositoryName + \"/_someDir\" + seed));\n        ioService().deleteIfExists(dir);\n        return dir;\n    }\n\n    public void setupCountDown(final int i) {\n        // do nothing -- Byteman will inject code here\n    }\n\n    public void waitForCountDown(final int timout) {\n        // do nothing -- Byteman will inject code here\n    }\n\n    public int getStartBatchCount() {\n        // do nothing -- Byteman will inject code here\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/BatchIndexConcurrencyTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.concurrent.CountDownLatch;\nimport java.util.concurrent.Executors;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.MetaIndexEngine;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class BatchIndexConcurrencyTest extends BaseIndexTest {\n\n    private MetaIndexEngine metaIndexEngine;\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder()\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            metaIndexEngine = spy(config.getIndexEngine());\n\n            ioService = new IOServiceIndexedImpl(metaIndexEngine,\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class) {\n                @Override\n                protected void setupWatchService(final FileSystem fs) {\n                    //No WatchService for this test\n                }\n            };\n        }\n        return ioService;\n    }\n\n    @Test\n    //See https://bugzilla.redhat.com/show_bug.cgi?id=1288132\n    public void testSingleConcurrentBatchIndexExecution() throws IOException, InterruptedException {\n        //Write a file to ensure the FileSystem has a Root Directory\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\"xxx\");\n        ioService().write(path1,\n                          \"xxx!\");\n\n        setupCountDown(1);\n\n        final URI fsURI = URI.create(\"git://\" + this.getClass().getSimpleName() + \"/file1\");\n\n        //Make multiple requests for the FileSystem. We should only have one batch index operation\n        final CountDownLatch startSignal = new CountDownLatch(1);\n        for (int i = 0; i < 3; i++) {\n            Runnable r = () -> {\n                try {\n                    startSignal.await();\n                    ioService().getFileSystem(fsURI);\n                } catch (InterruptedException e) {\n                    fail(e.getMessage());\n                }\n            };\n            new Thread(r).start();\n        }\n        startSignal.countDown();\n\n        waitForCountDown(5000);\n\n        assertEquals(1,\n                     getStartBatchCount());\n        verify(metaIndexEngine,\n               times(3)).freshIndex(any(KCluster.class));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/BatchIndexSingleThreadTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.net.URI;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMUnitConfig(debug = true)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class BatchIndexSingleThreadTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    //See https://bugzilla.redhat.com/show_bug.cgi?id=1288132\n    public void testSingleBatchIndexExecution() throws InterruptedException {\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\"xxx\");\n        ioService().write(path1,\n                          \"xxx!\");\n\n        setupCountDown(3);\n        //Make multiple requests for the FileSystem. We should only have one batch index operation\n        final URI fsURI = URI.create(\"git://\" + this.getClass().getSimpleName() + \"/file1\");\n\n        final FileSystem fs1 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs1);\n\n        final FileSystem fs2 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs2);\n\n        final FileSystem fs3 = ioService().getFileSystem(fsURI);\n        assertNotNull(fs3);\n\n        waitForCountDown(5000);\n\n        assertEquals(1,\n                     getStartBatchCount());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/BatchIndexTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.junit.Test;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.BatchIndexListener;\nimport org.uberfire.ext.metadata.engine.Observer;\nimport org.uberfire.ext.metadata.io.BatchIndex;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KCluster;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\npublic class BatchIndexTest extends BaseIndexTest {\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder()\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n            ioService = new IOServiceDotFileImpl();\n        }\n        return ioService;\n    }\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{\"temp-repo-test\"};\n    }\n\n    @Test\n    public void testIndex() throws IOException, InterruptedException {\n        {\n            final Path file = ioService().get(\"git://temp-repo-test/path/to/file.txt\");\n            ioService().write(file,\n                              \"some content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My User Name Here\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"initial document version, should be revised later.\";\n                                  }\n                              }\n            );\n        }\n        {\n            final Path file = ioService().get(\"git://temp-repo-test/path/to/some/complex/file.txt\");\n            ioService().write(file,\n                              \"some other content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My Second User Name\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"important document, should be used right now.\";\n                                  }\n                              }\n            );\n        }\n        {\n            final Path file = ioService().get(\"git://temp-repo-test/simple.doc\");\n            ioService().write(file,\n                              \"some doc content here\",\n                              Collections.<OpenOption>emptySet(),\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.author\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"My Original User\";\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.lastModification\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return new Date();\n                                  }\n                              },\n                              new FileAttribute<Object>() {\n                                  @Override\n                                  public String name() {\n                                      return \"dcore.comment\";\n                                  }\n\n                                  @Override\n                                  public Object value() {\n                                      return \"unlock document updated, should be checked by boss.\";\n                                  }\n                              }\n            );\n        }\n\n        {\n            final Path file = ioService().get(\"git://temp-repo-test/xxx/simple.xls\");\n            ioService().write(file,\n                              \"plans!?\");\n        }\n\n        new BatchIndex(config.getIndexEngine(),\n                       new Observer() {\n                           @Override\n                           public void information(final String message) {\n\n                           }\n\n                           @Override\n                           public void warning(final String message) {\n\n                           }\n\n                           @Override\n                           public void error(final String message) {\n\n                           }\n                       },\n                       Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                       indexersFactory(),\n                       indexerDispatcherFactory(config.getIndexEngine()),\n                       new BatchIndexListener() {\n                           @Override\n                           public void notifyIndexIngStarted(KCluster kCluster, Path path) {\n\n                           }\n\n                           @Override\n                           public void notifyIndexIngFinished(KCluster kCluster, Path path) {\n\n                           }\n                       },\n                       DublinCoreView.class).run(ioService().get(\"git://temp-repo-test/\").getFileSystem(),\n                                                 () -> {\n                                                     try {\n                                                         final String index = toKCluster(ioService().get(\"git://temp-repo-test/\")).getClusterId();\n\n                                                         {\n\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   new MatchAllDocsQuery());\n\n                                                             assertEquals(4,\n                                                                          hits);\n                                                         }\n\n                                                         {\n\n                                                             TermQuery query = new TermQuery(new Term(\"dcore.author\",\n                                                                                                      \"name\"));\n\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   query);\n                                                             assertEquals(2,\n                                                                          hits);\n                                                         }\n\n                                                         {\n\n                                                             TermQuery query = new TermQuery(new Term(\"dcore.author\",\n                                                                                                      \"second\"));\n                                                             long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                                                                   query);\n\n                                                             assertEquals(1,\n                                                                          hits);\n                                                         }\n\n                                                         config.dispose();\n                                                     } catch (Exception ex) {\n                                                         ex.printStackTrace();\n                                                         fail();\n                                                     }\n                                                 });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOSearchServiceImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.List;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.io.IOSearchServiceImpl;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOSearchServiceImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testFullTextSearch() throws IOException, InterruptedException {\n        setupCountDown(3);\n\n        final IOSearchServiceImpl searchIndex = new IOSearchServiceImpl(config.getSearchIndex(),\n                                                                        ioService());\n\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\"g.txt\");\n        ioService().write(path1,\n                          \"ooooo!\");\n\n        final Path path2 = getBasePath(this.getClass().getSimpleName()).resolve(\"a.txt\");\n        ioService().write(path2,\n                          \"ooooo!\");\n\n        final Path path3 = getBasePath(this.getClass().getSimpleName()).resolve(\"the.txt\");\n        ioService().write(path3,\n                          \"ooooo!\");\n\n        final Path root = path1.getRoot();\n\n        waitForCountDown(5000);\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"g\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"a\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"the\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(1,\n                         result.size());\n        }\n\n        {\n            final List<Path> result = searchIndex.fullTextSearch(\"\",\n                                                                 new IOSearchService.NoOpFilter(),\n                                                                 root);\n\n            assertEquals(0,\n                         result.size());\n        }\n\n        {\n            try {\n                searchIndex.fullTextSearch(null,\n                                           new IOSearchService.NoOpFilter(),\n                                           root);\n                fail();\n            } catch (final IllegalArgumentException ignored) {\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOServiceIndexedDeleteFileTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.jboss.byteman.contrib.bmunit.BMUnitRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(BMUnitRunner.class)\n@BMUnitConfig(debug = true)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOServiceIndexedDeleteFileTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testDeleteFile() throws IOException, InterruptedException {\n        setupCountDown(1);\n        final Path path = getBasePath(this.getClass().getSimpleName()).resolve(\"delete-me.txt\");\n        ioService().write(path,\n                          \"content\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"delete\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"me\";\n                              }\n                          });\n\n        waitForCountDown(5000);\n\n        String index = toKCluster(path).getClusterId();\n\n        //Check the file has been indexed\n        TermQuery query = new TermQuery(new Term(\"delete\",\n                                                 \"me\"));\n\n        long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                              query);\n\n        assertEquals(1,\n                     hits);\n\n        setupCountDown(2);\n\n        //Delete and re-check the index\n        ioService().delete(path);\n\n        waitForCountDown(5000);\n\n        hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                         query);\n\n        assertEquals(0,\n                     hits);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOServiceIndexedDotFileGitImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.schema.MetaObject;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOServiceIndexedDotFileGitImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedDotFile() throws IOException, InterruptedException {\n        setupCountDown(2);\n        final Path path = getBasePath(this.getClass().getSimpleName()).resolve(\"dotFile.txt\");\n        //Write the \"real path\" with no attributes and hence no \"dot file\"\n        ioService().write(path,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet());\n\n        //Write an unmodified \"real path\" with attributes. This leads to only the \"dot path\" being indexed.\n        ioService().write(path,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        waitForCountDown(5000);\n\n        final MetaObject mo = config.getMetaModelStore().getMetaObject(Path.class.getName());\n\n        assertNotNull(mo);\n        assertNotNull(mo.getProperty(\"name\").get());\n        assertEquals(1,\n                     mo.getProperty(\"name\").get().getTypes().size());\n        assertTrue(mo.getProperty(\"name\").get().getTypes().contains(String.class));\n\n        final String index = toKCluster(path).getClusterId();\n\n        TermQuery query = new TermQuery(new Term(\"name\",\n                                                 \"value\"));\n\n        long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                              query);\n\n        assertEquals(1,\n                     hits);\n\n        config.dispose();\n    }\n\n    private FileAttribute<?>[] getFileAttributes() {\n        return new FileAttribute<?>[]{\n                new FileAttribute<String>() {\n                    @Override\n                    public String name() {\n                        return \"name\";\n                    }\n\n                    @Override\n                    public String value() {\n                        return \"value\";\n                    }\n                }};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOServiceIndexedDotFileGitInternalImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOServiceIndexedDotFileGitInternalImplTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedGitInternalDotFile() throws IOException, InterruptedException {\n        setupCountDown(1);\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\".gitkeep\");\n        ioService().write(path1,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        final Path path2 = getBasePath(this.getClass().getSimpleName()).resolve(\"afile\");\n        ioService().write(path2,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          getFileAttributes());\n\n        waitForCountDown(5000);\n\n        final String index = toKCluster(path1).getClusterId();\n\n        TermQuery query = new TermQuery(new Term(\"name\",\n                                                 \"value\"));\n\n        List<KObject> hits = config.getIndexProvider().findByQuery(Arrays.asList(index),\n                                                                   query,\n                                                                   10);\n\n        assertEquals(1,\n                     hits.size());\n\n        assertEquals(hits.get(0).getKey(),\n                     path2.toUri().toString());\n    }\n\n    private FileAttribute<?>[] getFileAttributes() {\n        return new FileAttribute<?>[]{\n                new FileAttribute<String>() {\n                    @Override\n                    public String name() {\n                        return \"name\";\n                    }\n\n                    @Override\n                    public String value() {\n                        return \"value\";\n                    }\n                }};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOServiceIndexedGitImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.MatchAllDocsQuery;\nimport org.apache.lucene.search.TermQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOServiceIndexedGitImplTest extends BaseIndexTest {\n\n    protected final Date dateValue = new Date();\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testIndexedFile() throws IOException, InterruptedException {\n        setupCountDown(2);\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\"myIndexedFile.txt\");\n        ioService().write(path1,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          },\n                          new FileAttribute<String>() {\n                              @Override\n                              public String name() {\n                                  return \"int.hello\";\n                              }\n\n                              @Override\n                              public String value() {\n                                  return \"hello some world jhere\";\n                              }\n                          },\n                          new FileAttribute<Integer>() {\n                              @Override\n                              public String name() {\n                                  return \"int\";\n                              }\n\n                              @Override\n                              public Integer value() {\n                                  return 10;\n                              }\n                          }\n        );\n\n        final Path path2 = getBasePath(this.getClass().getSimpleName()).resolve(\"myOtherIndexedFile.txt\");\n        ioService().write(path2,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<String>() {\n                              @Override\n                              public String name() {\n                                  return \"int.hello\";\n                              }\n\n                              @Override\n                              public String value() {\n                                  return \"jhere\";\n                              }\n                          });\n\n        waitForCountDown(5000);\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()));\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get());\n\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get());\n        assertNotNull(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get());\n\n        assertEquals(1,\n                     config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int\").get().getTypes().size());\n        assertEquals(1,\n                     config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get().getTypes().size());\n        assertEquals(1,\n                     config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get().getTypes().size());\n\n        assertTrue(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int\").get().getTypes().contains(Integer.class));\n        assertTrue(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"int.hello\").get().getTypes().contains(String.class));\n        assertTrue(config.getMetaModelStore().getMetaObject(Path.class.getName()).getProperty(\"custom\").get().getTypes().contains(Date.class));\n\n        final String index = toKCluster(path2).getClusterId();\n\n        {\n            TermQuery query = new TermQuery(new Term(\"int.hello\",\n                                                     \"world\"));\n\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  query);\n\n            assertEquals(1,\n                         hits);\n        }\n\n        {\n\n            TermQuery query = new TermQuery(new Term(\"int.hello\",\n                                                     \"jhere\"));\n\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  query);\n\n            assertEquals(2,\n                         hits);\n        }\n\n        {\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  new MatchAllDocsQuery());\n\n            assertEquals(2,\n                         hits);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/IOServiceIndexedSortingTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.stream.StreamSupport;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.Query;\nimport org.apache.lucene.search.Sort;\nimport org.apache.lucene.search.SortField;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.backend.lucene.fields.FieldFactory;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class IOServiceIndexedSortingTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testSortedFiles() throws IOException, InterruptedException {\n\n        setupCountDown(4);\n\n        //Write files in reverse order so natural Lucene order would be c, b, a\n        final Path base = writeFile(\"cFile1.txt\");\n        writeFile(\"CFile2.txt\");\n        writeFile(\"bFile.txt\");\n        writeFile(\"aFile.txt\");\n\n        waitForCountDown(5000);\n\n        final String index = toKCluster(base).getClusterId();\n\n        {\n            final Sort sort = new Sort(new SortField(FieldFactory.FILE_NAME_FIELD_SORTED,\n                                                     SortField.Type.STRING));\n            final Query query = new WildcardQuery(new Term(\"filename\",\n                                                           \"*.txt\"));\n\n            List<KObject> hits = config.getIndexProvider().findByQuery(Arrays.asList(index),\n                                                                       query,\n                                                                       sort,\n                                                                       Integer.MAX_VALUE);\n\n            assertEquals(4,\n                         hits.size());\n            assertEquals(\"aFile.txt\",\n                         getProperty(hits.get(0),\n                                     \"filename\"));\n            assertEquals(\"bFile.txt\",\n                         getProperty(hits.get(1),\n                                     \"filename\"));\n            assertEquals(\"cFile1.txt\",\n                         getProperty(hits.get(2),\n                                     \"filename\"));\n            assertEquals(\"CFile2.txt\",\n                         getProperty(hits.get(3),\n                                     \"filename\"));\n        }\n\n        config.dispose();\n    }\n\n    public String getProperty(KObject ko,\n                              String name) {\n        return (String) StreamSupport.stream(ko.getProperties().spliterator(),\n                                             false).filter(kProperty -> kProperty.getName().equals(name)).findAny().get().getValue();\n    }\n\n    private Path writeFile(final String fileName) {\n        final Path path = getBasePath(this.getClass().getSimpleName()).resolve(fileName);\n        ioService().write(path,\n                          \"content\",\n                          Collections.<OpenOption>emptySet());\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/LuceneFullTextSearchIndexTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.concurrent.Executors;\n\nimport org.apache.lucene.index.Term;\nimport org.apache.lucene.search.WildcardQuery;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.ext.metadata.engine.Indexer;\nimport org.uberfire.ext.metadata.io.IOServiceIndexedImpl;\nimport org.uberfire.ext.metadata.io.IndexersFactory;\nimport org.uberfire.ext.metadata.io.KObjectUtil;\nimport org.uberfire.ext.metadata.io.MetadataConfigBuilder;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.model.KObjectKey;\nimport org.uberfire.ext.metadata.model.KProperty;\nimport org.uberfire.ext.metadata.model.schema.MetaType;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.metadata.engine.MetaIndexEngine.FULL_TEXT_FIELD;\nimport static org.uberfire.ext.metadata.io.KObjectUtil.toKCluster;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class LuceneFullTextSearchIndexTest extends BaseIndexTest {\n\n    @Override\n    protected IOService ioService() {\n        if (ioService == null) {\n            config = new MetadataConfigBuilder()\n                    .withInMemoryMetaModelStore()\n                    .useDirectoryBasedIndex()\n                    .useInMemoryDirectory()\n                    .build();\n\n            ioService = new IOServiceIndexedImpl(config.getIndexEngine(),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 Executors.newCachedThreadPool(new DescriptiveThreadFactory()),\n                                                 indexersFactory(),\n                                                 indexerDispatcherFactory(config.getIndexEngine()),\n                                                 DublinCoreView.class,\n                                                 VersionAttributeView.class);\n\n            indexersFactory().addIndexer(new MockIndexer());\n        }\n        return ioService;\n    }\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName()};\n    }\n\n    @Test\n    public void testFullTextIndexedFile() throws IOException, InterruptedException {\n        setupCountDown(1);\n        final Path path1 = getBasePath(this.getClass().getSimpleName()).resolve(\"mydrlfile1.drl\");\n        ioService().write(path1,\n                          \"Some cheese\");\n\n        waitForCountDown(10000);\n\n        final String index = toKCluster(path1).getClusterId();\n\n        {\n\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"*file*\"));\n\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  query);\n\n            assertEquals(1,\n                         hits);\n        }\n\n        {\n\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"*mydrlfile1*\"));\n\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  query);\n\n            assertEquals(1,\n                         hits);\n        }\n\n        setupCountDown(1);\n\n        final Path path2 = getBasePath(this.getClass().getSimpleName()).resolve(\"a.drl\");\n        ioService().write(path2,\n                          \"Some cheese\");\n\n        waitForCountDown(10000);\n\n        {\n            WildcardQuery query = new WildcardQuery(new Term(FULL_TEXT_FIELD,\n                                                             \"a.dr*\"));\n            long hits = config.getIndexProvider().findHitsByQuery(Arrays.asList(index),\n                                                                  query);\n            assertEquals(1,\n                         hits);\n        }\n\n        config.getIndexProvider().dispose();\n    }\n\n    private static class MockIndexer implements Indexer {\n\n        @Override\n        public boolean supportsPath(final Path path) {\n            return true;\n        }\n\n        @Override\n        public KObject toKObject(final Path path) {\n            return new TestKObjectWrapper(KObjectUtil.toKObject(path));\n        }\n\n        @Override\n        public KObjectKey toKObjectKey(final Path path) {\n            return new TestKObjectKeyWrapper(KObjectUtil.toKObjectKey(path));\n        }\n    }\n\n    private static class TestKObjectKeyWrapper implements KObjectKey {\n\n        protected KObjectKey delegate;\n\n        private TestKObjectKeyWrapper(final KObjectKey delegate) {\n            this.delegate = delegate;\n        }\n\n        @Override\n        public String getId() {\n            return delegate.getId() + \"-refactoring\";\n        }\n\n        @Override\n        public MetaType getType() {\n            return delegate.getType();\n        }\n\n        @Override\n        public String getClusterId() {\n            return delegate.getClusterId();\n        }\n\n        @Override\n        public String getSegmentId() {\n            return delegate.getSegmentId();\n        }\n\n        @Override\n        public String getKey() {\n            return delegate.getKey();\n        }\n    }\n\n    private static class TestKObjectWrapper extends TestKObjectKeyWrapper implements KObject {\n\n        private TestKObjectWrapper(final KObject delegate) {\n            super(delegate);\n        }\n\n        @Override\n        public Iterable<KProperty<?>> getProperties() {\n            return ((KObject) delegate).getProperties();\n        }\n\n        @Override\n        public boolean fullText() {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/java/org/uberfire/ext/metadata/io/lucene/LuceneSearchIndexTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.metadata.io.lucene;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.metadata.model.KObject;\nimport org.uberfire.ext.metadata.search.ClusterSegment;\nimport org.uberfire.ext.metadata.search.IOSearchService;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.SegmentedPath;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMScript(dir = \"byteman\", value = \"lucene.btm\")\npublic class LuceneSearchIndexTest extends BaseIndexTest {\n\n    @Override\n    protected String[] getRepositoryNames() {\n        return new String[]{this.getClass().getSimpleName() + \"_1\", this.getClass().getSimpleName() + \"_2\"};\n    }\n\n    @Test\n    public void testClusterSegments() throws IOException, InterruptedException {\n        setupCountDown(2);\n        //Add test files\n        final Path path1 = getBasePath(this.getClass().getSimpleName() + \"_1\").resolve(\"indexedFile1.txt\");\n        ioService().write(path1,\n                          \"content1\");\n        final Path path2 = getBasePath(this.getClass().getSimpleName() + \"_2\").resolve(\"indexedFile2.txt\");\n        ioService().write(path2,\n                          \"content2\");\n\n        //Setup ClusterSegments\n        final ClusterSegment cs1 = new ClusterSegment() {\n            @Override\n            public String getClusterId() {\n                return ((FileSystemId) getBasePath(LuceneSearchIndexTest.this.getClass().getSimpleName() + \"_1\").getFileSystem()).id();\n            }\n\n            @Override\n            public String[] segmentIds() {\n                return new String[]{((SegmentedPath) getBasePath(LuceneSearchIndexTest.this.getClass().getSimpleName() + \"_1\")).getSegmentId()};\n            }\n        };\n        final ClusterSegment cs2 = new ClusterSegment() {\n            @Override\n            public String getClusterId() {\n                return ((FileSystemId) getBasePath(LuceneSearchIndexTest.this.getClass().getSimpleName() + \"_2\").getFileSystem()).id();\n            }\n\n            @Override\n            public String[] segmentIds() {\n                return new String[]{((SegmentedPath) getBasePath(LuceneSearchIndexTest.this.getClass().getSimpleName() + \"_2\")).getSegmentId()};\n            }\n        };\n\n        waitForCountDown(5000);\n\n        final Map<String, Object> attributes = new HashMap<String, Object>() {{\n            put(\"filename\",\n                \"*.txt\");\n        }};\n\n        //Attribute Search\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter());\n            assertEquals(0,\n                         hits);\n            assertEquals(0,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs1);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs1);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs2);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs2);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().searchByAttrsHits(attributes,\n                                                                       cs1,\n                                                                       cs2);\n            final List<KObject> results = config.getSearchIndex().searchByAttrs(attributes,\n                                                                                new IOSearchService.NoOpFilter(),\n                                                                                cs1,\n                                                                                cs2);\n            assertEquals(2,\n                         hits);\n            assertEquals(2,\n                         results.size());\n        }\n\n        //Full Text Search\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\");\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter());\n            assertEquals(0,\n                         hits);\n            assertEquals(0,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs1);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs1);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs2);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs2);\n            assertEquals(1,\n                         hits);\n            assertEquals(1,\n                         results.size());\n        }\n\n        {\n            final int hits = config.getSearchIndex().fullTextSearchHits(\"*indexed*\",\n                                                                        cs1,\n                                                                        cs2);\n            final List<KObject> results = config.getSearchIndex().fullTextSearch(\"*indexed*\",\n                                                                                 new IOSearchService.NoOpFilter(),\n                                                                                 cs1,\n                                                                                 cs2);\n            assertEquals(2,\n                         hits);\n            assertEquals(2,\n                         results.size());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# Copyright 2014 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.ext.metadata.io.common.util.TestFileSystemProvider # A mock provider for unit tests\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/byteman/elastic.btm",
    "content": "RULE reset state lucene\nCLASS org.uberfire.ext.metadata.io.index.MetadataIndexEngine\nMETHOD <init>(IndexProvider,MetaModelStore)\nAT ENTRY\nIF TRUE\nDO deleteCounter(\"freshIndex\");\n   deleteCounter(\"startBatch\");\n   deleteCounter(\"index kobject\");\n   deleteCounter(\"index kobject[]\");\n   deleteCounter(\"rename\");\n   deleteCounter(\"delete kcluster\");\n   deleteCounter(\"delete kobjectkey\");\n   deleteCounter(\"delete kobjectkey[]\");\n   deleteCounter(\"commit kcluster\");\n   deleteCounter(\"beforeDispose\");\n   deleteCounter(\"dispose\");\nENDRULE\n\nRULE count freshIndex\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD freshIndex(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"freshIndex\");\n   traceln(\"-> freshIndex\");\nENDRULE\n\nRULE count startBatch\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD startBatch(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"startBatch\");\n   traceln(\"-> startBatch\");\nENDRULE\n\nRULE count index kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject\");\n   traceln(\"-> index kobject\");\nENDRULE\n\nRULE count index kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject[])\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject[]\");\n   traceln(\"-> index kobject[]\");\nENDRULE\n\nRULE count rename kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD rename(org.uberfire.ext.metadata.model.KObjectKey,org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"rename\");\n   traceln(\"-> rename\");\nENDRULE\n\nRULE count delete kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kcluster\");\n   traceln(\"-> delete kcluster\");\nENDRULE\n\nRULE count delete kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey\");\n   traceln(\"-> delete kobjectkey\");\nENDRULE\n\nRULE count delete kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey[])\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey[]\");\n   traceln(\"-> delete kobjectkey[]\");\nENDRULE\n\nRULE count commit kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD commit(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"commit kcluster\");\n   traceln(\"-> commit kcluster\");\nENDRULE\n\nRULE count beforeDispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD beforeDispose(java.lang.Runnable)\nAT ENTRY\nIF true\nDO incrementCounter(\"beforeDispose\");\n   traceln(\"-> beforeDispose\");\nENDRULE\n\nRULE count dispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD dispose()\nAT ENTRY\nIF true\nDO incrementCounter(\"dispose\");\n   traceln(\"-> dispose\");\nENDRULE\n\nRULE countdown\nINTERFACE org.uberfire.ext.metadata.provider.IndexProvider\nMETHOD index(org.uberfire.ext.metadata.model.KObject)\nAT EXIT\nIF countDown(\"indexCountdown\")\nDO traceln(\"countdown active\");\n   signalWake(\"testReady\", true);\nENDRULE\n\nRULE countdown batch\nINTERFACE org.uberfire.ext.metadata.provider.IndexProvider\nMETHOD index(List<KObject>)\nAT EXIT\nIF countDown(\"indexCountdown\")\nDO traceln(\"countdown active\");\n   signalWake(\"testReady\", true);\nENDRULE\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/byteman/infinispan.btm",
    "content": "RULE reset state lucene\nCLASS org.uberfire.ext.metadata.io.index.MetadataIndexEngine\nMETHOD <init>(IndexProvider,MetaModelStore)\nAT ENTRY\nIF TRUE\nDO deleteCounter(\"freshIndex\");\n   deleteCounter(\"startBatch\");\n   deleteCounter(\"index kobject\");\n   deleteCounter(\"index kobject[]\");\n   deleteCounter(\"rename\");\n   deleteCounter(\"delete kcluster\");\n   deleteCounter(\"delete kobjectkey\");\n   deleteCounter(\"delete kobjectkey[]\");\n   deleteCounter(\"commit kcluster\");\n   deleteCounter(\"beforeDispose\");\n   deleteCounter(\"dispose\");\nENDRULE\n\nRULE count freshIndex\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD freshIndex(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"freshIndex\");\n   traceln(\"-> freshIndex\");\nENDRULE\n\nRULE count startBatch\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD startBatch(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"startBatch\");\n   traceln(\"-> startBatch\");\nENDRULE\n\nRULE count index kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject\");\n   traceln(\"-> index kobject\");\nENDRULE\n\nRULE count index kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject[])\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject[]\");\n   traceln(\"-> index kobject[]\");\nENDRULE\n\nRULE count rename kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD rename(org.uberfire.ext.metadata.model.KObjectKey,org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"rename\");\n   traceln(\"-> rename\");\nENDRULE\n\nRULE count delete kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kcluster\");\n   traceln(\"-> delete kcluster\");\nENDRULE\n\nRULE count delete kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey\");\n   traceln(\"-> delete kobjectkey\");\nENDRULE\n\nRULE count delete kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey[])\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey[]\");\n   traceln(\"-> delete kobjectkey[]\");\nENDRULE\n\nRULE count commit kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD commit(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"commit kcluster\");\n   traceln(\"-> commit kcluster\");\nENDRULE\n\nRULE count beforeDispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD beforeDispose(java.lang.Runnable)\nAT ENTRY\nIF true\nDO incrementCounter(\"beforeDispose\");\n   traceln(\"-> beforeDispose\");\nENDRULE\n\nRULE count dispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD dispose()\nAT ENTRY\nIF true\nDO incrementCounter(\"dispose\");\n   traceln(\"-> dispose\");\nENDRULE\n\nRULE countdown\nINTERFACE org.uberfire.ext.metadata.provider.IndexProvider\nMETHOD index(org.uberfire.ext.metadata.model.KObject)\nAT EXIT\nIF countDown(\"indexCountdown\")\nDO traceln(\"countdown active\");\n   signalWake(\"testReady\", true);\nENDRULE\n\nRULE countdown batch\nINTERFACE org.uberfire.ext.metadata.provider.IndexProvider\nMETHOD index(List<KObject>)\nAT EXIT\nIF countDown(\"indexCountdown\")\nDO traceln(\"countdown active\");\n   signalWake(\"testReady\", true);\nENDRULE\n\nRULE create count down\nCLASS org.uberfire.ext.metadata.io.infinispan.BaseIndexTest\nMETHOD setupCountDown(int)\nAT ENTRY\nIF true\nDO createCountDown(\"indexCountdown\", $1);\n   countDown(\"indexCountdown\");\nENDRULE\n\nRULE wait for count down\nCLASS org.uberfire.ext.metadata.io.infinispan.BaseIndexTest\nMETHOD waitForCountDown(int)\nAT ENTRY\nIF TRUE\nDO waitFor(\"testReady\", $1);\nENDRULE\n\nRULE return startBatch value\nCLASS org.uberfire.ext.metadata.io.infinispan.BaseIndexTest\nMETHOD getStartBatchCount()\nAT EXIT\nIF TRUE\nDO return readCounter(\"startBatch\");\nENDRULE\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/byteman/lucene.btm",
    "content": "RULE reset state lucene\nCLASS org.uberfire.ext.metadata.io.index.MetadataIndexEngine\nMETHOD <init>(IndexProvider,MetaModelStore)\nAT ENTRY\nIF TRUE\nDO deleteCounter(\"freshIndex\");\n   deleteCounter(\"startBatch\");\n   deleteCounter(\"index kobject\");\n   deleteCounter(\"index kobject[]\");\n   deleteCounter(\"rename\");\n   deleteCounter(\"delete kcluster\");\n   deleteCounter(\"delete kobjectkey\");\n   deleteCounter(\"delete kobjectkey[]\");\n   deleteCounter(\"commit kcluster\");\n   deleteCounter(\"beforeDispose\");\n   deleteCounter(\"dispose\");\nENDRULE\n\nRULE count freshIndex\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD freshIndex(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"freshIndex\");\n   traceln(\"-> freshIndex\");\nENDRULE\n\nRULE count startBatch\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD startBatch(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"startBatch\");\n   traceln(\"-> startBatch\");\nENDRULE\n\nRULE count index kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject\");\n   traceln(\"-> index kobject\");\nENDRULE\n\nRULE count index kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD index(org.uberfire.ext.metadata.model.KObject[])\nAT ENTRY\nIF true\nDO incrementCounter(\"index kobject[]\");\n   traceln(\"-> index kobject[]\");\nENDRULE\n\nRULE count rename kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD rename(org.uberfire.ext.metadata.model.KObjectKey,org.uberfire.ext.metadata.model.KObject)\nAT ENTRY\nIF true\nDO incrementCounter(\"rename\");\n   traceln(\"-> rename\");\nENDRULE\n\nRULE count delete kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kcluster\");\n   traceln(\"-> delete kcluster\");\nENDRULE\n\nRULE count delete kobject\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey)\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey\");\n   traceln(\"-> delete kobjectkey\");\nENDRULE\n\nRULE count delete kobject[]\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD delete(org.uberfire.ext.metadata.model.KObjectKey[])\nAT ENTRY\nIF true\nDO incrementCounter(\"delete kobjectkey[]\");\n   traceln(\"-> delete kobjectkey[]\");\nENDRULE\n\nRULE count commit kcluster\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD commit(org.uberfire.ext.metadata.model.KCluster)\nAT ENTRY\nIF true\nDO incrementCounter(\"commit kcluster\");\n   traceln(\"-> commit kcluster\");\nENDRULE\n\nRULE count beforeDispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD beforeDispose(java.lang.Runnable)\nAT ENTRY\nIF true\nDO incrementCounter(\"beforeDispose\");\n   traceln(\"-> beforeDispose\");\nENDRULE\n\nRULE count dispose\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD dispose()\nAT ENTRY\nIF true\nDO incrementCounter(\"dispose\");\n   traceln(\"-> dispose\");\nENDRULE\n\nRULE countdown\nINTERFACE org.uberfire.ext.metadata.engine.MetaIndexEngine\nMETHOD commit(org.uberfire.ext.metadata.model.KCluster)\nAT EXIT\nIF countDown(\"indexCountdown\")\nDO traceln(\"countdown active\");\n   signalWake(\"testReady\", true);\nENDRULE\n\nRULE create count down\nCLASS org.uberfire.ext.metadata.io.lucene.BaseIndexTest\nMETHOD setupCountDown(int)\nAT ENTRY\nIF true\nDO createCountDown(\"indexCountdown\", $1);\n   countDown(\"indexCountdown\");\nENDRULE\n\nRULE wait for count down\nCLASS org.uberfire.ext.metadata.io.lucene.BaseIndexTest\nMETHOD waitForCountDown(int)\nAT ENTRY\nIF TRUE\nDO waitFor(\"testReady\", $1);\nENDRULE\n\nRULE return startBatch value\nCLASS org.uberfire.ext.metadata.io.lucene.BaseIndexTest\nMETHOD getStartBatchCount()\nAT EXIT\nIF TRUE\nDO return readCounter(\"startBatch\");\nENDRULE\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/ispn.properties",
    "content": "#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nimage=jboss/infinispan-server\nversion=${version.org.infinispan}\nuser=user\npassword=user\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/log4j.properties",
    "content": "\n#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n\nlog4j.rootLogger=INFO, mainlogger\nlog4j.appender.mainlogger=org.apache.log4j.ConsoleAppender\nlog4j.appender.mainlogger.target=System.err\nlog4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout\nlog4j.appender.mainlogger.layout.ConversionPattern=%p [%c{1}] %m%n\n\n#log4j.logger.org.jboss.errai.ioc.IOCBootstrapGenerator=DEBUG\n\nlog4j.logger.org.uberfire.ext.metadata.backend.infinispan.provider=DEBUG\n#log4j.logger.com.gargoylesoftware.htmlunit=DEBUG\n"
  },
  {
    "path": "uberfire-extensions/uberfire-metadata/uberfire-metadata-commons-io/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire.ext.metadata.backend.infinispan.provider\" level=\"debug\"/>\n\n  <root level=\"info\">\n    <appender-ref ref=\"consoleAppender\"/>\n  </root>\n\n</configuration>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-preferences-ui-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Preferences UI Client</name>\n  <description>Uberfire Preferences UI Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/PreferencesEntryPoint.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/Constants.properties\")\npublic class PreferencesEntryPoint {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/AdminPagePerspective.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin;\n\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.ext.preferences.client.resources.i18n.Constants;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = AdminPagePerspective.IDENTIFIER)\npublic class AdminPagePerspective {\n\n    public static final String IDENTIFIER = \"AdminPagePerspective\";\n\n    @Inject\n    private TranslationService translationService;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    private PerspectiveDefinition perspective;\n\n    private String perspectiveIdentifierToGoBackTo = null;\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        if (perspective == null) {\n            perspective = createPerspectiveDefinition();\n            configurePerspective(Collections.emptyMap());\n        }\n\n        return perspective;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        perspectiveIdentifierToGoBackTo = placeRequest.getParameter(\"perspectiveIdentifierToGoBackTo\",\n                                                                    null);\n        perspective = createPerspectiveDefinition();\n        configurePerspective(placeRequest.getParameters());\n    }\n\n    PerspectiveDefinition createPerspectiveDefinition() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Admin\");\n\n        return perspective;\n    }\n\n    void configurePerspective(final Map<String, String> parameters) {\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(AdminPagePresenter.IDENTIFIER,\n                                                                                     parameters)));\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        if (perspectiveIdentifierToGoBackTo != null) {\n            menusConsumer.accept(MenuFactory\n                    .newTopLevelMenu(translationService.format(Constants.AdminPagePerspective_GoBackToThePreviousPage))\n                    .respondsWith(() -> placeManager.goTo(perspectiveIdentifierToGoBackTo))\n                    .endMenu()\n                    .build()\n            );\n        }\n\n        menusConsumer.accept(null);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/AdminPagePresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin;\n\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.admin.category.AdminPageCategoryPresenter;\nimport org.uberfire.ext.preferences.client.admin.page.AdminPage;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@WorkbenchScreen(identifier = AdminPagePresenter.IDENTIFIER)\npublic class AdminPagePresenter {\n\n    public static final String IDENTIFIER = \"AdminPagePresenter\";\n    private final View view;\n    private final AdminPage adminPage;\n    private final ManagedInstance<AdminPageCategoryPresenter> categoryPresenterProvider;\n    private final Event<NotificationEvent> notification;\n    private String screen;\n    private String perspectiveIdentifierToGoBackTo;\n\n    @Inject\n    public AdminPagePresenter(final View view,\n                              final AdminPage adminPage,\n                              final ManagedInstance<AdminPageCategoryPresenter> categoryPresenterProvider,\n                              final Event<NotificationEvent> notification) {\n        this.view = view;\n        this.adminPage = adminPage;\n        this.categoryPresenterProvider = categoryPresenterProvider;\n        this.notification = notification;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        screen = placeRequest.getParameter(\"screen\",\n                                           adminPage.getDefaultScreen());\n        perspectiveIdentifierToGoBackTo = placeRequest.getParameter(\"perspectiveIdentifierToGoBackTo\",\n                                                                    null);\n\n        view.init(this);\n\n        if (screen == null) {\n            notification.fire(new NotificationEvent(view.getNoScreenParameterError(),\n                                                    NotificationEvent.NotificationType.ERROR));\n        } else {\n            init(screen);\n        }\n    }\n\n    public void init(final String screen) {\n        this.screen = screen;\n\n        final Map<String, List<AdminTool>> toolsByCategory = adminPage.getToolsByCategory(screen);\n\n        if (toolsByCategory != null) {\n            toolsByCategory.forEach((category, adminTools) -> {\n                AdminPageCategoryPresenter categoryPresenter = categoryPresenterProvider.get();\n                categoryPresenter.setup(adminTools,\n                                        screen,\n                                        perspectiveIdentifierToGoBackTo);\n                view.add(categoryPresenter.getView());\n            });\n        } else {\n            notification.fire(new NotificationEvent(view.getNoScreenFoundError(screen),\n                                                    NotificationEvent.NotificationType.ERROR));\n        }\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return view.getTitle();\n    }\n\n    @WorkbenchPartView\n    public View getView() {\n        return view;\n    }\n\n    public AdminPage getAdminPage() {\n        return adminPage;\n    }\n\n    public String getScreen() {\n        return screen;\n    }\n\n    public interface View extends UberElement<AdminPagePresenter> {\n\n        void add(final AdminPageCategoryPresenter.View categoryView);\n\n        String getTitle();\n\n        String getNoScreenParameterError();\n\n        String getNoScreenFoundError(String screen);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/AdminPageView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.admin-page {\n    background-color: #F5F5F5;\n    text-align: center;\n    padding: 15px 50px;\n}\n\n.admin-page .admin-page-title-container {\n    text-align: left;\n    padding: 11px;\n}\n\n.admin-page .admin-page-content {\n    display: table;\n    margin: auto;\n}\n\n.full-min-height {\n    min-height: 100%;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/AdminPageView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"admin-page full-min-height\">\n    <div id=\"admin-page-content\" class=\"admin-page-content\">\n        <div class=\"admin-page-title-container\">\n            <h1 id=\"admin-page-title\"></h1>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/AdminPageView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Heading;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.preferences.client.admin.category.AdminPageCategoryPresenter;\nimport org.uberfire.ext.preferences.client.resources.i18n.Constants;\n\n@Dependent\n@Templated\npublic class AdminPageView implements IsElement,\n                                      AdminPagePresenter.View {\n\n    @Inject\n    @DataField(\"admin-page-content\")\n    Div content;\n\n    @Inject\n    @Named(\"h1\")\n    @DataField(\"admin-page-title\")\n    Heading title;\n\n    private AdminPagePresenter presenter;\n\n    @Inject\n    private TranslationService translationService;\n\n    @Override\n    public void init(final AdminPagePresenter presenter) {\n        this.presenter = presenter;\n        title.setTextContent(getTitle());\n    }\n\n    @Override\n    public void add(final AdminPageCategoryPresenter.View categoryView) {\n        content.appendChild(categoryView.getElement());\n    }\n\n    @Override\n    public String getTitle() {\n        final String screen = presenter.getScreen();\n        final String title = presenter.getAdminPage().getScreenTitle(screen);\n\n        return title;\n    }\n\n    @Override\n    public String getNoScreenParameterError() {\n        return translationService.format(Constants.AdminPagePresenter_NoScreenParameterError);\n    }\n\n    @Override\n    public String getNoScreenFoundError(final String screen) {\n        return translationService.format(Constants.AdminPagePresenter_NoScreenFoundError,\n                                         screen);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/category/AdminPageCategoryPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.category;\n\nimport java.util.List;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.admin.item.AdminPageItemPresenter;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\n\npublic class AdminPageCategoryPresenter {\n\n    private final View view;\n    private final ManagedInstance<AdminPageItemPresenter> adminPageItemPresenterProvider;\n\n    @Inject\n    public AdminPageCategoryPresenter(final View view,\n                                      final ManagedInstance<AdminPageItemPresenter> adminPageItemPresenterProvider) {\n        this.view = view;\n        this.adminPageItemPresenterProvider = adminPageItemPresenterProvider;\n    }\n\n    public void setup(final List<AdminTool> adminTools,\n                      final String screen,\n                      final String perspectiveIdentifierToGoBackTo) {\n        adminTools.forEach(adminTool -> {\n            final AdminPageItemPresenter itemPresenter = adminPageItemPresenterProvider.get();\n            itemPresenter.setup(adminTool,\n                                screen,\n                                perspectiveIdentifierToGoBackTo);\n            view.add(itemPresenter.getView());\n        });\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public interface View extends UberElement<AdminPageCategoryPresenter> {\n\n        void add(AdminPageItemPresenter.View rootItemView);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/category/AdminPageCategoryView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.admin-page-category {\n    list-style: none;\n    vertical-align: top;\n    text-align: left;\n    padding: 0;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/category/AdminPageCategoryView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"content\" class=\"admin-page-category\">\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/category/AdminPageCategoryView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.category;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.preferences.client.admin.item.AdminPageItemPresenter;\n\n@Dependent\n@Templated\npublic class AdminPageCategoryView implements IsElement,\n                                              AdminPageCategoryPresenter.View {\n\n    private AdminPageCategoryPresenter presenter;\n\n    @Inject\n    @DataField(\"content\")\n    private Div content;\n\n    @Override\n    public void init(final AdminPageCategoryPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void add(final AdminPageItemPresenter.View rootItemView) {\n        content.appendChild(rootItemView.getElement());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/item/AdminPageItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.item;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralActionsConfigurationEvent;\n\npublic class AdminPageItemPresenter {\n\n    private final View view;\n    private final PlaceManager placeManager;\n    private final Event<PreferencesCentralActionsConfigurationEvent> adminPageConfigurationEvent;\n    private AdminTool adminTool;\n    private PreferencesCentralActionsConfigurationEvent preferencesCentralActionsConfigurationEventToFire;\n\n    @Inject\n    public AdminPageItemPresenter(final View view,\n                                  final PlaceManager placeManager,\n                                  final Event<PreferencesCentralActionsConfigurationEvent> adminPageConfigurationEvent) {\n        this.view = view;\n        this.placeManager = placeManager;\n        this.adminPageConfigurationEvent = adminPageConfigurationEvent;\n    }\n\n    public void setup(final AdminTool adminTool,\n                      final String screen,\n                      final String perspectiveIdentifierToGoBackTo) {\n        this.adminTool = adminTool;\n        this.preferencesCentralActionsConfigurationEventToFire = new PreferencesCentralActionsConfigurationEvent(screen,\n                                                                                                                 perspectiveIdentifierToGoBackTo);\n\n        view.init(this);\n    }\n\n    public void enter() {\n        adminTool.getOnClickCommand().execute();\n        adminPageConfigurationEvent.fire(preferencesCentralActionsConfigurationEventToFire);\n    }\n\n    public AdminTool getAdminTool() {\n        return adminTool;\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public interface View extends UberElement<AdminPageItemPresenter> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/item/AdminPageItemView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.admin-page-item {\n    display: inline-block;\n    text-align: center;\n    padding: 30px;\n    vertical-align: top;\n    width: 290px;\n    height: 285px;\n    margin: 11px;\n    background-color: #FFFFFF;\n    cursor: pointer;\n}\n\n.admin-page-item > span {\n    font-size: 72px;\n}\n\n.admin-page-item > div {\n    font-size: 18px;\n}\n\n.admin-page-item .admin-page-item-counter {\n    text-align: center;\n    vertical-align: middle;\n    margin: 20px;\n}\n\n.admin-page-item .admin-page-item-counter div {\n    width: 39px;\n    height: 39px;\n    line-height: 39px;\n    border-radius: 50%;\n    background-color: #D8D8D8;\n    font-weight: bold;\n    display: table;\n    margin: auto;\n}\n\n.admin-page-item .admin-page-item-counter div p {\n    display: table-cell;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/item/AdminPageItemView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div data-field=\"item\" class=\"admin-page-item\">\n    <span><i data-field=\"item-icon\" aria-hidden=\"true\"></i></span>\n    <div data-field=\"item-text\"></div>\n    <div class=\"admin-page-item-counter\" data-field=\"item-counter-container\">\n        <div>\n            <p data-field=\"item-counter\"></p>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/item/AdminPageItemView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.item;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.DOM;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Paragraph;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\n\n@Dependent\n@Templated\npublic class AdminPageItemView implements IsElement,\n                                          AdminPageItemPresenter.View {\n\n    private final TranslationService translationService;\n    @Inject\n    @DataField(\"item\")\n    Div item;\n    @DataField(\"item-icon\")\n    Element icon = DOM.createElement(\"i\");\n    @Inject\n    @DataField(\"item-text\")\n    Div text;\n    @Inject\n    @DataField(\"item-counter-container\")\n    Div counterContainer;\n    @Inject\n    @DataField(\"item-counter\")\n    Paragraph counterText;\n    private AdminPageItemPresenter presenter;\n\n    @Inject\n    public AdminPageItemView(final TranslationService translationService) {\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(final AdminPageItemPresenter presenter) {\n        this.presenter = presenter;\n        final AdminTool adminTool = presenter.getAdminTool();\n\n        if (adminTool.getIconCss() != null) {\n            adminTool.getIconCss().forEach(css -> icon.addClassName(css));\n        }\n\n        text.setTextContent(adminTool.getTitle());\n\n        if (adminTool.hasCounter()) {\n            adminTool.fetchCounter(counter -> counterText.setTextContent(String.valueOf(counter)));\n        } else {\n            counterContainer.setHidden(true);\n        }\n    }\n\n    @EventHandler(\"item\")\n    public void enter(ClickEvent event) {\n        presenter.enter();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/page/AdminPage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.page;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Supplier;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Used to customize the admin page perspective.\n */\npublic interface AdminPage {\n\n    /**\n     * Adds a new admin screen context to be configured and opened.\n     * @param identifier Admin screen identifier.\n     * @param title Admin screen title.\n     */\n    void addScreen(String identifier,\n                   String title);\n\n    /**\n     * Adds a new admin tool to the admin page (with a counter).\n     * @param screen Identifier for the admin screen where the tool will be inserted.\n     * @param title Title that will be displayed on the tool accessor.\n     * @param iconCss CSS class(es) responsible to stylize the icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param command Command to be executed when the shortcut is accessed.\n     * @param counterCommand {@link ParameterizedCommand} that calls its {@link ParameterizedCommand} parameter\n     * passing the counter.\n     */\n    void addTool(String screen,\n                 String title,\n                 Set<String> iconCss,\n                 String category,\n                 Command command,\n                 ParameterizedCommand<ParameterizedCommand<Integer>> counterCommand);\n\n    /**\n     * Adds a new admin tool to the admin page.\n     * @param screen Identifier for the admin screen where the tool will be inserted.\n     * @param title Title that will be displayed on the tool accessor.\n     * @param iconCss CSS class(es) responsible to stylize the icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param command Command to be executed when the shortcut is accessed.\n     */\n    void addTool(String screen,\n                 String title,\n                 Set<String> iconCss,\n                 String category,\n                 Command command);\n\n    /**\n     * Adds a new admin tool that links to a preference to the admin page.\n     * @param screen Identifier for the admin screen where the preference will be inserted.\n     * @param identifier Preference identifier.\n     * @param title Preference title that will be displayed on the tool accessor.\n     * @param iconCss CSS class related to the shortcut icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param options Defines options to customize the preference accessor.\n     */\n    void addPreference(String screen,\n                       String identifier,\n                       String title,\n                       Set<String> iconCss,\n                       String category,\n                       AdminPageOptions... options);\n\n    /**\n     * Adds a new admin tool that links to a preference to the admin page.\n     * @param screen Identifier for the admin screen where the preference will be inserted.\n     * @param identifier Preference identifier.\n     * @param title Preference title that will be displayed on the tool accessor.\n     * @param iconCss CSS class related to the shortcut icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param customScopeResolutionStrategySupplier Supplier for a custom preference scope resolution strategy.\n     * It will be used when the tool is selected.\n     * @param options Defines options to customize the preference accessor.\n     */\n    void addPreference(String screen,\n                       String identifier,\n                       String title,\n                       Set<String> iconCss,\n                       String category,\n                       Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,\n                       AdminPageOptions... options);\n\n    /**\n     * Adds a new admin tool that links to a preference to the admin page.\n     * @param screen Identifier for the admin screen where the preference will be inserted.\n     * @param identifier Preference identifier.\n     * @param title Preference title that will be displayed on the tool accessor.\n     * @param iconCss CSS class related to the shortcut icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param preferenceScope Scope where the preferences will be saved when edited.\n     * It will be used when the tool is selected.\n     * @param options Defines options to customize the preference accessor.\n     */\n    void addPreference(String screen,\n                       String identifier,\n                       String title,\n                       Set<String> iconCss,\n                       String category,\n                       PreferenceScope preferenceScope,\n                       AdminPageOptions... options);\n\n    /**\n     * Adds a new admin tool that links to a preference to the admin page.\n     * @param screen Identifier for the admin screen where the preference will be inserted.\n     * @param identifier Preference identifier.\n     * @param title Preference title that will be displayed on the tool accessor.\n     * @param iconCss CSS class related to the shortcut icon.\n     * @param category Defines the group inside which the shortcut will be.\n     * @param customScopeResolutionStrategySupplier Supplier for a custom preference scope resolution strategy.\n     * @param preferenceScope Scope where the preferences will be saved when edited.\n     * It will be used when the tool is selected.\n     * @param options Defines options to customize the preference accessor.\n     */\n    void addPreference(String screen,\n                       String identifier,\n                       String title,\n                       Set<String> iconCss,\n                       String category,\n                       Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,\n                       PreferenceScope preferenceScope,\n                       AdminPageOptions... options);\n\n    /**\n     * Returns all added admin tools, grouped by their category.\n     * @param screen Identifier for the admin screen from where the tools will be returned.\n     * @return A map containing a list of admin tools by each category of that screen.\n     */\n    Map<String, List<AdminTool>> getToolsByCategory(String screen);\n\n    /**\n     * Returns the screen title to be exhibit in the admin page.\n     * @param screen Screen identifier.\n     * @return Screen title, as passed when the screen was added.\n     */\n    String getScreenTitle(String screen);\n\n    /**\n     * Returns the default screen to be opened when navigating to the Admin Page perspective.\n     * @return Default screen identifier.\n     */\n    String getDefaultScreen();\n\n    /**\n     * Defines the default screen to be opened when navigating to the Admin Page perspective.\n     * @param defaultScreen Default screen identifier. Must not be null or empty.\n     */\n    void setDefaultScreen(String defaultScreen);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/page/AdminPageImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.page;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Supplier;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralPerspective;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent;\nimport org.uberfire.ext.preferences.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.UberfireBreadcrumbs;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n@ApplicationScoped\npublic class AdminPageImpl implements AdminPage {\n\n    private PlaceManager placeManager;\n\n    private Event<PreferencesCentralInitializationEvent> preferencesCentralInitializationEvent;\n\n    private PreferenceScopeResolutionStrategy resolutionStrategy;\n\n    private UberfireBreadcrumbs breadcrumbs;\n\n    private TranslationService translationService;\n\n    private Map<String, String> screenTitleByIdentifier;\n\n    private Map<String, Map<String, List<AdminTool>>> toolsByCategoryByScreen;\n\n    private String defaultScreen;\n\n    public AdminPageImpl() {\n        this(null,\n             null,\n             null,\n             null,\n             null);\n    }\n\n    @Inject\n    public AdminPageImpl(final PlaceManager placeManager,\n                         final Event<PreferencesCentralInitializationEvent> preferencesCentralInitializationEvent,\n                         @Customizable final PreferenceScopeResolutionStrategy resolutionStrategy,\n                         final UberfireBreadcrumbs breadcrumbs,\n                         final TranslationService translationService) {\n        this.placeManager = placeManager;\n        this.preferencesCentralInitializationEvent = preferencesCentralInitializationEvent;\n        this.resolutionStrategy = resolutionStrategy;\n        this.breadcrumbs = breadcrumbs;\n        this.translationService = translationService;\n        this.toolsByCategoryByScreen = new HashMap<>();\n        this.screenTitleByIdentifier = new HashMap<>();\n    }\n\n    @Override\n    public void addScreen(final String identifier,\n                          final String title) {\n        if (identifier == null || identifier.isEmpty()) {\n            throw new RuntimeException(\"The screen identifier must be not empty.\");\n        }\n\n        screenTitleByIdentifier.put(identifier,\n                                    title);\n        toolsByCategoryByScreen.put(identifier,\n                                    new LinkedHashMap<>());\n    }\n\n    @Override\n    public void addTool(final String screen,\n                        final String title,\n                        final Set<String> iconCss,\n                        final String category,\n                        final Command command,\n                        final ParameterizedCommand<ParameterizedCommand<Integer>> counterCommand) {\n        if (screen == null || screen.isEmpty()) {\n            throw new RuntimeException(\"The screen identifier must be not empty.\");\n        }\n\n        if (screenTitleByIdentifier.get(screen) == null) {\n            throw new RuntimeException(\"The screen must be added before it is used.\");\n        }\n\n        if (category == null || category.isEmpty()) {\n            throw new RuntimeException(\"The category identifier must be not empty.\");\n        }\n\n        Map<String, List<AdminTool>> toolsByCategory = toolsByCategoryByScreen.get(screen);\n        List<AdminTool> tools = toolsByCategory.get(category);\n\n        if (tools == null) {\n            tools = new ArrayList<>();\n            toolsByCategory.put(category,\n                                tools);\n        }\n\n        AdminTool tool = new AdminTool(title,\n                                       iconCss,\n                                       category,\n                                       command,\n                                       counterCommand);\n        tools.add(tool);\n    }\n\n    @Override\n    public void addTool(final String screen,\n                        final String title,\n                        final Set<String> iconCss,\n                        final String category,\n                        final Command command) {\n        addTool(screen,\n                title,\n                iconCss,\n                category,\n                command,\n                null);\n    }\n\n    @Override\n    public void addPreference(final String screen,\n                              final String identifier,\n                              final String title,\n                              final Set<String> iconCss,\n                              final String category,\n                              final AdminPageOptions... options) {\n        addPreference(screen,\n                      identifier,\n                      title,\n                      iconCss,\n                      category,\n                      (Supplier<PreferenceScopeResolutionStrategyInfo>) null,\n                      options);\n    }\n\n    @Override\n    public void addPreference(final String screen,\n                              final String identifier,\n                              final String title,\n                              final Set<String> iconCss,\n                              final String category,\n                              final Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,\n                              final AdminPageOptions... options) {\n        addPreference(screen,\n                      identifier,\n                      title,\n                      iconCss,\n                      category,\n                      customScopeResolutionStrategySupplier,\n                      null,\n                      options);\n    }\n\n    @Override\n    public void addPreference(final String screen,\n                              final String identifier,\n                              final String title,\n                              final Set<String> iconCss,\n                              final String category,\n                              final PreferenceScope preferenceScope,\n                              final AdminPageOptions... options) {\n        addPreference(screen,\n                      identifier,\n                      title,\n                      iconCss,\n                      category,\n                      null,\n                      preferenceScope,\n                      options);\n    }\n\n    @Override\n    public void addPreference(final String screen,\n                              final String identifier,\n                              final String title,\n                              final Set<String> iconCss,\n                              final String category,\n                              final Supplier<PreferenceScopeResolutionStrategyInfo> customScopeResolutionStrategySupplier,\n                              final PreferenceScope preferenceScope,\n                              final AdminPageOptions... options) {\n\n        addTool(screen,\n                title,\n                iconCss,\n                category,\n                () -> {\n                    final Command accessCommand = () -> {\n                        final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy = customScopeResolutionStrategySupplier != null ? customScopeResolutionStrategySupplier.get() : null;\n                        final PreferencesCentralInitializationEvent initEvent = new PreferencesCentralInitializationEvent(identifier,\n                                                                                                                          customScopeResolutionStrategy,\n                                                                                                                          preferenceScope);\n                        placeManager.goTo(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER));\n                        preferencesCentralInitializationEvent.fire(initEvent);\n                    };\n\n                    accessCommand.execute();\n\n                    if (hasOption(options,\n                                  AdminPageOptions.WITH_BREADCRUMBS)) {\n                        breadcrumbs.clearBreadcrumbs(PreferencesCentralPerspective.IDENTIFIER);\n                        breadcrumbs.addBreadCrumb(PreferencesCentralPerspective.IDENTIFIER,\n                                                  translationService.format(Constants.Admin),\n                                                  new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER),\n                                                  () -> placeManager.goTo(AdminPagePerspective.IDENTIFIER));\n                        breadcrumbs.addBreadCrumb(PreferencesCentralPerspective.IDENTIFIER,\n                                                  title,\n                                                  accessCommand);\n                    }\n                });\n    }\n\n    @Override\n    public Map<String, List<AdminTool>> getToolsByCategory(final String screen) {\n        return toolsByCategoryByScreen.get(screen);\n    }\n\n    @Override\n    public String getScreenTitle(final String screen) {\n        return screenTitleByIdentifier.get(screen);\n    }\n\n    @Override\n    public String getDefaultScreen() {\n        return defaultScreen;\n    }\n\n    @Override\n    public void setDefaultScreen(final String defaultScreen) {\n        this.defaultScreen = defaultScreen;\n    }\n\n    private boolean hasOption(final AdminPageOptions[] options,\n                              final AdminPageOptions option) {\n        if (options != null) {\n            for (final AdminPageOptions o : options) {\n                if (o.equals(option)) {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/page/AdminPageOptions.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.page;\n\npublic enum AdminPageOptions {\n\n    WITH_BREADCRUMBS\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/admin/page/AdminTool.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.page;\n\nimport java.util.Set;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class AdminTool {\n\n    private String title;\n\n    private Set<String> iconCss;\n\n    private String category;\n\n    private Command onClickCommand;\n\n    private ParameterizedCommand<ParameterizedCommand<Integer>> counterCommand;\n\n    public AdminTool() {\n    }\n\n    public AdminTool(final String title,\n                     final Set<String> iconCss,\n                     final String category,\n                     final Command onClickCommand) {\n        this(title,\n             iconCss,\n             category,\n             onClickCommand,\n             null);\n    }\n\n    public AdminTool(final String title,\n                     final Set<String> iconCss,\n                     final String category,\n                     final Command onClickCommand,\n                     final ParameterizedCommand<ParameterizedCommand<Integer>> counterCommand) {\n        this.title = title;\n        this.iconCss = iconCss;\n        this.category = category;\n        this.onClickCommand = onClickCommand;\n        this.counterCommand = counterCommand;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public Set<String> getIconCss() {\n        return iconCss;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n\n    public Command getOnClickCommand() {\n        return onClickCommand;\n    }\n\n    public boolean hasCounter() {\n        return this.counterCommand != null;\n    }\n\n    public void fetchCounter(ParameterizedCommand<Integer> callback) {\n        counterCommand.execute(callback);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/annotations/PreferenceForm.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n/**\n * Used to qualify {@link WorkbenchScreen} that represents a customized preference form.\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface PreferenceForm {\n\n    /**\n     * Identifier of the preference bean that the form edits.\n     * @return Preference bean identifier (required).\n     */\n    String value();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/base/BasePreferenceForm.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.base;\n\nimport javax.enterprise.event.Observes;\n\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralPreSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Class that all preference forms (defined by a {@link WorkbenchScreen} annotated with {@link PreferenceForm})\n * must inherit, to be able to be initialized in a proper manner, which is receiving its preference object.\n * @param <T> Preference bean type the can be edited by this form.\n */\npublic abstract class BasePreferenceForm<T> {\n\n    private String id;\n\n    private T preference;\n\n    /**\n     * Method called when the form is opened, so it can receive the current persisted preference value.\n     * @param preference\n     */\n    public abstract void init(T preference);\n\n    /**\n     * Method called just before the preferences saving.\n     */\n    public abstract void beforeSave();\n\n    /**\n     * Method called when the \"Undo\" action is fired by the user. It is expected that the form undo any\n     * unsaved changes in this method implementation.\n     */\n    public abstract void onUndo();\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        id = placeRequest.getParameter(\"id\",\n                                       null);\n    }\n\n    public void hierarchyItemFormInitializationEvent(@Observes HierarchyItemFormInitializationEvent event) {\n        if (preference == null && event.getItemId().equals(id)) {\n            preference = event.getPreference();\n            init(preference);\n        }\n    }\n\n    public void preSaveEvent(@Observes PreferencesCentralPreSaveEvent event) {\n        beforeSave();\n    }\n\n    public void undoChangesEvent(@Observes PreferencesCentralUndoChangesEvent event) {\n        onUndo();\n    }\n\n    public T getPreference() {\n        return preference;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/PreferencesCentralNavBarScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central;\n\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyStructurePresenter;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyStructureView;\nimport org.uberfire.ext.preferences.client.central.tree.TreeView;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.workbench.model.CompassPosition;\n\n@WorkbenchScreen(identifier = PreferencesCentralNavBarScreen.IDENTIFIER)\npublic class PreferencesCentralNavBarScreen {\n\n    public static final String IDENTIFIER = \"PreferencesCentralNavBarScreen\";\n\n    private final HierarchyStructurePresenter hierarchyStructurePresenter;\n\n    @Inject\n    public PreferencesCentralNavBarScreen(@TreeView final HierarchyStructurePresenter treePresenter) {\n        this.hierarchyStructurePresenter = treePresenter;\n    }\n\n    public void init(@Observes final PreferencesCentralInitializationEvent initEvent) {\n        final String preferenceIdentifier = initEvent.getPreferenceIdentifier();\n        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = initEvent.getCustomScopeResolutionStrategy();\n        final PreferenceScope scope = initEvent.getPreferenceScope();\n\n        hierarchyStructurePresenter.init(preferenceIdentifier,\n                                         scopeResolutionStrategyInfo,\n                                         scope);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Preferences Central\";\n    }\n\n    @WorkbenchPartView\n    public HierarchyStructureView getView() {\n        return hierarchyStructurePresenter.getView();\n    }\n\n    @DefaultPosition\n    public CompassPosition getDefaultPosition() {\n        return CompassPosition.WEST;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/PreferencesCentralPerspective.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.ext.preferences.client.central.screen.PreferencesRootScreen;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = PreferencesCentralPerspective.IDENTIFIER)\npublic class PreferencesCentralPerspective {\n\n    public static final String IDENTIFIER = \"PreferencesCentralPerspective\";\n\n    @Inject\n    private TranslationService translationService;\n\n    private PerspectiveDefinition perspective;\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return buildPerspective();\n    }\n\n    PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Preferences\");\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(PreferencesRootScreen.IDENTIFIER)));\n\n        return perspective;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/actions/PreferencesCentralActionsScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.actions;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyStructureView;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralActionsConfigurationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralPreSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.CompassPosition;\n\n@WorkbenchScreen(identifier = PreferencesCentralActionsScreen.IDENTIFIER)\npublic class PreferencesCentralActionsScreen {\n\n    public static final String IDENTIFIER = \"PreferencesCentralActionsScreen\";\n    private final View view;\n    private final PlaceManager placeManager;\n    private final Event<PreferencesCentralPreSaveEvent> preSaveEvent;\n    private final Event<PreferencesCentralSaveEvent> saveEvent;\n    private final Event<PreferencesCentralUndoChangesEvent> undoChangesEvent;\n    private final Event<NotificationEvent> notification;\n    private String adminPageScreenToGoBack;\n    private String perspectiveIdentifierToGoBackTo;\n\n    @Inject\n    public PreferencesCentralActionsScreen(final View view,\n                                           final PlaceManager placeManager,\n                                           final Event<PreferencesCentralPreSaveEvent> preSaveEvent,\n                                           final Event<PreferencesCentralSaveEvent> saveEvent,\n                                           final Event<PreferencesCentralUndoChangesEvent> undoChangesEvent,\n                                           final Event<NotificationEvent> notification) {\n        this.view = view;\n        this.placeManager = placeManager;\n        this.preSaveEvent = preSaveEvent;\n        this.saveEvent = saveEvent;\n        this.undoChangesEvent = undoChangesEvent;\n        this.notification = notification;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void initEvent(@Observes final PreferencesCentralActionsConfigurationEvent event) {\n        adminPageScreenToGoBack = event.getAdminPageScreenToGoBack();\n        perspectiveIdentifierToGoBackTo = event.getPerspectiveIdentifierToGoBackTo();\n    }\n\n    public void fireSaveEvent() {\n        preSaveEvent.fire(new PreferencesCentralPreSaveEvent());\n        saveEvent.fire(new PreferencesCentralSaveEvent());\n        goBackToAdminPage();\n    }\n\n    public void fireCancelEvent() {\n        undoChangesEvent.fire(new PreferencesCentralUndoChangesEvent());\n        notification.fire(new NotificationEvent(view.getChangesUndoneMessage(),\n                                                NotificationEvent.NotificationType.DEFAULT));\n        goBackToAdminPage();\n    }\n\n    void goBackToAdminPage() {\n        if (adminPageScreenToGoBack != null) {\n            Map<String, String> params = new HashMap<>();\n            params.put(\"screen\",\n                       adminPageScreenToGoBack);\n            if (perspectiveIdentifierToGoBackTo != null) {\n                params.put(\"perspectiveIdentifierToGoBackTo\",\n                           perspectiveIdentifierToGoBackTo);\n            }\n            placeManager.goTo(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER,\n                                                      params));\n        }\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"\";\n    }\n\n    @WorkbenchPartView\n    public HierarchyStructureView getView() {\n        return view;\n    }\n\n    @DefaultPosition\n    public CompassPosition getDefaultPosition() {\n        return CompassPosition.SOUTH;\n    }\n\n    public interface View extends HierarchyStructureView,\n                                  UberElement<PreferencesCentralActionsScreen> {\n\n        String getChangesUndoneMessage();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/actions/PreferencesCentralActionsView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.preference-actions {\n    text-align: right;\n    padding: 20px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/actions/PreferencesCentralActionsView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"preference-actions full-height\">\n    <button data-field=\"preference-actions-save\" class=\"btn btn-primary btn-lg\" data-i18n-key=\"Save\"></button>\n    <button data-field=\"preference-actions-cancel\" class=\"btn btn-lg\" data-i18n-key=\"Cancel\"></button>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/actions/PreferencesCentralActionsView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.actions;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.preferences.client.resources.i18n.Constants;\n\n@Dependent\n@Templated\npublic class PreferencesCentralActionsView implements IsElement,\n                                                      PreferencesCentralActionsScreen.View {\n\n    @Inject\n    @DataField(\"preference-actions-save\")\n    Button saveButton;\n    @Inject\n    @DataField(\"preference-actions-cancel\")\n    Button cancelButton;\n    private TranslationService translationService;\n    private PreferencesCentralActionsScreen presenter;\n\n    @Inject\n    public PreferencesCentralActionsView(final TranslationService translationService) {\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(final PreferencesCentralActionsScreen presenter) {\n        this.presenter = presenter;\n    }\n\n    @EventHandler(\"preference-actions-save\")\n    public void save(ClickEvent event) {\n        presenter.fireSaveEvent();\n    }\n\n    @EventHandler(\"preference-actions-cancel\")\n    public void undo(ClickEvent event) {\n        presenter.fireCancelEvent();\n    }\n\n    @Override\n    public String getChangesUndoneMessage() {\n        return translationService.format(Constants.PreferencesCentralActionsView_ChangesUndone);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/form/DefaultPreferenceForm.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.form;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldOption;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.preferences.shared.PropertyFormOptions;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\nimport org.uberfire.preferences.shared.impl.validation.ValidationResult;\n\nimport com.google.gwt.core.client.GWT;\n\n@WorkbenchScreen(identifier = DefaultPreferenceForm.IDENTIFIER)\npublic class DefaultPreferenceForm {\n\n    public static final String IDENTIFIER = \"org.uberfire.ext.preferences.client.central.form.DefaultPreferenceForm\";\n    private final View view;\n    private TranslationService translationService;\n    private String id;\n    private String title;\n    private BasePreferencePortable<?> preference;\n    private PropertyEditorCategory category;\n    private PreferenceHierarchyElement<?> hierarchyElement;\n\n    @Inject\n    public DefaultPreferenceForm(final View view,\n                                 final TranslationService translationService) {\n        this.view = view;\n        this.translationService = translationService;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        id = placeRequest.getParameter(\"id\",\n                                       null);\n        title = placeRequest.getParameter(\"title\",\n                                          null);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return view;\n    }\n\n    public void hierarchyItemFormInitializationEvent(@Observes HierarchyItemFormInitializationEvent event) {\n        if (preference == null && event.getItemId().equals(id)) {\n            preference = event.getPreference();\n            hierarchyElement = event.getHierarchyElement();\n            view.init(this);\n        }\n    }\n\n    public PropertyEditorEvent generatePropertyEditorEvent() {\n        if (category == null) {\n            createPropertiesEditorCategory();\n        }\n\n        PropertyEditorEvent event = new PropertyEditorEvent(id,\n                                                            category);\n        return event;\n    }\n\n    private void createPropertiesEditorCategory() {\n        category = new PropertyEditorCategory(\"Properties\");\n        category.setIdEvent(id);\n\n        for (Map.Entry<String, PropertyFormType> property : preference.getPropertiesTypes().entrySet()) {\n            final String propertyName = property.getKey();\n            final PropertyEditorType propertyType = getPropertyEditorType(property.getValue());\n            final Object propertyValue = preference.get(propertyName);\n\n            final PropertyEditorFieldInfo fieldInfo = createFieldInfo(propertyName,\n                                                                      propertyType,\n                                                                      propertyValue);\n            category.withField(fieldInfo);\n        }\n    }\n\n    private void fillEnumValues(final Object propertyValue, final PropertyEditorFieldInfo fieldInfo) {\n        if (propertyValue instanceof Enum) {\n            Enum<?>[] enumConstants = ((Enum<?>) propertyValue).getDeclaringClass().getEnumConstants();\n            List<String> enumValues = Arrays.stream(enumConstants).map(Object::toString).collect(Collectors.toList());\n            fieldInfo.withComboValues(enumValues);\n        }\n    }\n\n    PropertyEditorFieldInfo createFieldInfo(final String propertyName,\n                                            final PropertyEditorType propertyType,\n                                            final Object propertyValue) {\n        final PropertyEditorFieldInfo fieldInfo = new PropertyEditorFieldInfo(translationService.format(hierarchyElement.getBundleKeyByProperty().get(propertyName)),\n                                                                              propertyValue != null ? propertyValue.toString() : \"\",\n                                                                              propertyType);\n\n        setupFieldValidators(propertyName,\n                             fieldInfo);\n        setupFieldHelpText(propertyName,\n                           fieldInfo);\n        setupFieldOptions(propertyName,\n                          fieldInfo);\n        setupFieldKey(propertyName,\n                      fieldInfo);\n        \n        if (propertyType == PropertyEditorType.COMBO) {\n            fillEnumValues(propertyValue, fieldInfo);\n        }\n\n        return fieldInfo;\n    }\n\n    private void setupFieldOptions(final String propertyName,\n                                   final PropertyEditorFieldInfo fieldInfo) {\n        for (PropertyFormOptions option : hierarchyElement.getFormOptionsByProperty().get(propertyName)) {\n            fieldInfo.withOptions(PropertyEditorFieldOption.valueOf(option.name()));\n        }\n    }\n\n    private void setupFieldHelpText(final String propertyName,\n                                    final PropertyEditorFieldInfo fieldInfo) {\n        final String helpText = hierarchyElement.getHelpBundleKeyByProperty().get(propertyName);\n        if (helpText != null && !helpText.isEmpty()) {\n            fieldInfo.withHelpInfo(\"\", translationService.format(helpText));\n        }\n    }\n\n    private void setupFieldValidators(final String propertyName,\n                                      final PropertyEditorFieldInfo fieldInfo) {\n        final List<PropertyFieldValidator> propertyFieldValidators = new ArrayList<>();\n\n        preference.getPropertyValidators(propertyName).stream()\n                .forEach(validator -> propertyFieldValidators.add(new PropertyFieldValidator() {\n                    private ValidationResult validationResult;\n\n                    @Override\n                    public boolean validate(Object value) {\n                        validationResult = validator.validate(value);\n                        return validationResult.isValid();\n                    }\n\n                    @Override\n                    public String getValidatorErrorMessage() {\n                        final List<String> validationMessages = validationResult.getMessagesBundleKeys();\n                        if (!validationResult.isValid() && !validationMessages.isEmpty()) {\n                            return translationService.format(validationMessages.get(0));\n                        }\n\n                        return \"\";\n                    }\n                }));\n\n        final int validatorsSize = propertyFieldValidators.size();\n        final PropertyFieldValidator[] emptyValidatorsArray = new PropertyFieldValidator[validatorsSize];\n        final PropertyFieldValidator[] validators = propertyFieldValidators.toArray(emptyValidatorsArray);\n\n        fieldInfo.withValidators(validators);\n    }\n\n    private void setupFieldKey(final String propertyName,\n                               final PropertyEditorFieldInfo fieldInfo) {\n        fieldInfo.withKey(propertyName);\n    }\n\n    public void propertyChanged(@Observes PropertyEditorChangeEvent event) {\n        if (event.getProperty().getEventId().equals(id)) {\n            final String propertyName = event.getProperty().getKey();\n            final PropertyFormType propertyType = preference.getPropertyType(propertyName);\n            Object newValue = propertyType.fromString(event.getNewValue());\n            Object currentValue = preference.get(propertyName);\n            if (currentValue instanceof Enum) {\n                newValue = getEnumValue(event, currentValue);\n            } \n            preference.set(propertyName,\n                           newValue);\n            \n        }\n    }\n\n    private Enum<?> getEnumValue(PropertyEditorChangeEvent event, Object currentValue) {\n        String selectedValue = event.getProperty().getCurrentStringValue();\n        Object[] enumConstants = ((Enum<?>) currentValue).getDeclaringClass().getEnumConstants();\n        Enum<?> enumValue = Arrays.stream(enumConstants)\n            .filter(e -> e.toString().equals(selectedValue))\n            .map(e -> (Enum<?>) e)\n            .findFirst().orElseThrow(RuntimeException::new);\n        return enumValue;\n    }\n\n    public void saveEvent(@Observes PreferencesCentralSaveEvent event) {\n        createPropertiesEditorCategory();\n        view.init(this);\n    }\n\n    public void undoEvent(@Observes PreferencesCentralUndoChangesEvent event) {\n        category.undo();\n        view.init(this);\n    }\n\n    public BasePreferencePortable<?> getPreference() {\n        return preference;\n    }\n\n    public PropertyEditorType getPropertyEditorType(PropertyFormType propertyFormType) {\n        return PropertyEditorType.valueOf(propertyFormType.name());\n    }\n\n    public interface View extends UberElement<DefaultPreferenceForm>,\n                                  IsElement {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/form/DefaultPreferenceFormView.html",
    "content": "<div data-field=\"properties-editor\"></div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/form/DefaultPreferenceFormView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.form;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\n\n@Templated\n@Dependent\npublic class DefaultPreferenceFormView implements DefaultPreferenceForm.View,\n                                                  IsElement {\n    private DefaultPreferenceForm presenter;\n\n    @Inject\n    @DataField(\"properties-editor\")\n    PropertyEditorWidget propertiesEditorWidget;\n\n    @Override\n    public void init(final DefaultPreferenceForm presenter) {\n        this.presenter = presenter;\n        propertiesEditorWidget.setLastOpenAccordionGroupTitle(\"Properties\");\n        propertiesEditorWidget.handle(presenter.generatePropertyEditorEvent());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyInternalItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\npublic interface HierarchyInternalItemPresenter extends HierarchyItemPresenter {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\npublic interface HierarchyItemPresenter {\n\n    <T> void init(PreferenceHierarchyElement<T> preference,\n                  int level,\n                  boolean tryToSelectChild);\n\n    void fireSelect();\n\n    HierarchyItemView getView();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyItemView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\npublic interface HierarchyItemView {\n\n    void deselect();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyLeafItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\npublic interface HierarchyLeafItemPresenter extends HierarchyItemPresenter {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyStructurePresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\npublic interface HierarchyStructurePresenter {\n\n    void init(String rootIdentifier,\n              PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategyInfo,\n              PreferenceScope scope);\n\n    HierarchyStructureView getView();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/hierarchy/HierarchyStructureView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.hierarchy;\n\nimport org.jboss.errai.ui.client.local.api.IsElement;\n\npublic interface HierarchyStructureView extends IsElement {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/screen/PreferencesRootScreen.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.screen;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralNavBarScreen;\nimport org.uberfire.ext.preferences.client.central.actions.PreferencesCentralActionsScreen;\nimport org.uberfire.ext.preferences.client.central.form.DefaultPreferenceForm;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemSelectedEvent;\nimport org.uberfire.ext.preferences.client.utils.PreferenceFormBeansInfo;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n@WorkbenchScreen(identifier = PreferencesRootScreen.IDENTIFIER)\npublic class PreferencesRootScreen {\n\n    public static final String IDENTIFIER = \"PreferencesRootScreen\";\n\n    public interface View extends UberElement<PreferencesRootScreen> {\n\n        HTMLElement getNavbarContainer();\n\n        HTMLElement getEditorContainer();\n\n        HTMLElement getActionsContainer();\n\n        String getTranslation(String key);\n    }\n\n    private final View view;\n\n    private final PlaceManager placeManager;\n\n    private final PreferenceFormBeansInfo preferenceFormBeansInfo;\n\n    private final Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent;\n\n    private PlaceRequest openedPreferencePlaceRequest;\n\n    @Inject\n    public PreferencesRootScreen(final View view,\n                                 final PlaceManager placeManager,\n                                 final PreferenceFormBeansInfo preferenceFormBeansInfo,\n                                 final Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent) {\n        this.view = view;\n        this.placeManager = placeManager;\n        this.preferenceFormBeansInfo = preferenceFormBeansInfo;\n        this.hierarchyItemFormInitializationEvent = hierarchyItemFormInitializationEvent;\n    }\n\n    @OnStartup\n    public void setup() {\n        placeManager.goTo(new DefaultPlaceRequest(PreferencesCentralNavBarScreen.IDENTIFIER),\n                          view.getNavbarContainer());\n        placeManager.goTo(new DefaultPlaceRequest(PreferencesCentralActionsScreen.IDENTIFIER),\n                          view.getActionsContainer());\n    }\n\n    @OnClose\n    public void onClose() {\n        placeManager.closePlace(PreferencesCentralNavBarScreen.IDENTIFIER);\n        placeManager.closePlace(PreferencesCentralActionsScreen.IDENTIFIER);\n    }\n\n    public void hierarchyItemSelectedEvent(@Observes HierarchyItemSelectedEvent hierarchyItemSelectedEvent) {\n        Map<String, String> parameters = new HashMap<>();\n        parameters.put(\"id\",\n                       hierarchyItemSelectedEvent.getItemId());\n        parameters.put(\"title\",\n                       view.getTranslation(hierarchyItemSelectedEvent.getPreference().bundleKey()));\n\n        final HTMLElement editorContainer = view.getEditorContainer();\n\n        if (openedPreferencePlaceRequest != null) {\n            placeManager.closePlace(openedPreferencePlaceRequest);\n        }\n        openedPreferencePlaceRequest = new DefaultPlaceRequest(getPreferenceFormIdentifier(hierarchyItemSelectedEvent.getPreferenceIdentifier()),\n                                                               parameters);\n        placeManager.goTo(openedPreferencePlaceRequest,\n                          editorContainer);\n\n        final HierarchyItemFormInitializationEvent event = new HierarchyItemFormInitializationEvent(hierarchyItemSelectedEvent.getHierarchyElement());\n        hierarchyItemFormInitializationEvent.fire(event);\n    }\n\n    public String getPreferenceFormIdentifier(final String preferenceIdentifier) {\n        final String customForm = preferenceFormBeansInfo.getPreferenceFormFor(preferenceIdentifier);\n        return customForm != null ? customForm : DefaultPreferenceForm.IDENTIFIER;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Preferences Root Screen\";\n    }\n\n    @WorkbenchPartView\n    public View getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/screen/PreferencesRootView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"preferences-root\">\n    <div id=\"preferences-navbar\" class=\"preferences-col preferences-navbar col-md-4\">\n    </div>\n    <div class=\"preferences-col col-md-8\">\n        <div id=\"preferences-editor\" class=\"preferences-editor\"></div>\n        <div id=\"preferences-actions\" class=\"preferences-actions\"></div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/screen/PreferencesRootView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.screen;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class PreferencesRootView implements IsElement,\n                                            PreferencesRootScreen.View {\n\n    private final TranslationService translationService;\n\n    @Inject\n    @DataField(\"preferences-navbar\")\n    private Div navbar;\n\n    @Inject\n    @DataField(\"preferences-editor\")\n    private Div editor;\n\n    @Inject\n    @DataField(\"preferences-actions\")\n    private Div actions;\n\n    @Inject\n    public PreferencesRootView(TranslationService translationService) {\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(PreferencesRootScreen presenter) {\n    }\n\n    @Override\n    public HTMLElement getNavbarContainer() {\n        return navbar;\n    }\n\n    @Override\n    public HTMLElement getEditorContainer() {\n        return editor;\n    }\n\n    @Override\n    public HTMLElement getActionsContainer() {\n        return actions;\n    }\n\n    @Override\n    public String getTranslation(String key) {\n        return translationService.format(key);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/screen/PreferencesRootView.less",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.preferences-root {\n\n    height: 100%;\n\n    .preferences-col {\n        padding: 0;\n        height: 100%;\n    }\n\n    .preferences-navbar {\n        overflow: auto;\n    }\n\n    .preferences-editor {\n        height: calc(~'100% - 80px');\n        overflow: auto;\n    }\n\n    .preferences-actions {\n        height: 80px;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyInternalItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyInternalItemPresenter;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyItemPresenter;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyItemView;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemSelectedEvent;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\npublic class TreeHierarchyInternalItemPresenter implements HierarchyInternalItemPresenter {\n\n    private final View view;\n    private final ManagedInstance<TreeHierarchyInternalItemPresenter> treeHierarchyInternalItemPresenterProvider;\n    private final ManagedInstance<TreeHierarchyLeafItemPresenter> treeHierarchyLeafItemPresenterProvider;\n    private final Event<HierarchyItemSelectedEvent> hierarchyItemSelectedEvent;\n    private List<HierarchyItemPresenter> hierarchyItems;\n    private PreferenceHierarchyElement<?> hierarchyElement;\n    private int level;\n\n    @Inject\n    public TreeHierarchyInternalItemPresenter(final View view,\n                                              final ManagedInstance<TreeHierarchyInternalItemPresenter> treeHierarchyInternalItemPresenterProvider,\n                                              final ManagedInstance<TreeHierarchyLeafItemPresenter> treeHierarchyLeafItemPresenterProvider,\n                                              final Event<HierarchyItemSelectedEvent> hierarchyItemSelectedEvent) {\n        this.view = view;\n        this.treeHierarchyInternalItemPresenterProvider = treeHierarchyInternalItemPresenterProvider;\n        this.treeHierarchyLeafItemPresenterProvider = treeHierarchyLeafItemPresenterProvider;\n        this.hierarchyItemSelectedEvent = hierarchyItemSelectedEvent;\n    }\n\n    @Override\n    public <T> void init(final PreferenceHierarchyElement<T> preference,\n                         final int level,\n                         boolean tryToSelectChild) {\n        hierarchyElement = preference;\n        this.level = level;\n\n        hierarchyItems = new ArrayList<>();\n\n        for (PreferenceHierarchyElement<?> child : preference.getChildren()) {\n            HierarchyItemPresenter hierarchyItem;\n\n            if (child.hasChildren()) {\n                hierarchyItem = treeHierarchyInternalItemPresenterProvider.get();\n            } else {\n                hierarchyItem = treeHierarchyLeafItemPresenterProvider.get();\n            }\n\n            hierarchyItem.init(child,\n                               level + 1,\n                               tryToSelectChild && !child.isSelectable());\n            if (child.isSelectable()) {\n                hierarchyItem.fireSelect();\n                tryToSelectChild = false;\n            }\n\n            hierarchyItems.add(hierarchyItem);\n        }\n\n        view.init(this);\n    }\n\n    @Override\n    public void fireSelect() {\n        view.select();\n    }\n\n    public void select() {\n        if (hierarchyElement.isSelectable()) {\n            final HierarchyItemSelectedEvent event = new HierarchyItemSelectedEvent(hierarchyElement);\n            hierarchyItemSelectedEvent.fire(event);\n            view.selectElement();\n        }\n    }\n\n    public void hierarchyItemSelectedEvent(@Observes HierarchyItemSelectedEvent hierarchyItemSelectedEvent) {\n        if (!hierarchyElement.getId().equals(hierarchyItemSelectedEvent.getHierarchyElement().getId())) {\n            view.deselect();\n        }\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public PreferenceHierarchyElement<?> getHierarchyElement() {\n        return hierarchyElement;\n    }\n\n    public List<HierarchyItemPresenter> getHierarchyItems() {\n        return hierarchyItems;\n    }\n\n    public int getLevel() {\n        return level;\n    }\n\n    public interface View extends HierarchyItemView,\n                                  UberElement<TreeHierarchyInternalItemPresenter> {\n\n        void select();\n\n        void selectElement();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyInternalItemView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.preference-tree-internal-item i[data-field=\"preference-tree-internal-item-expand-icon\"] {\n    padding-left: 3px;\n}\n\n.preference-tree-internal-item label {\n    padding: 4px;\n    margin: 0;\n    cursor: pointer;\n}\n\n.preference-tree-internal-item-node {\n    margin-right: 1px;\n}\n\n.preference-tree-internal-item .selected {\n    background-color: #1699d3;\n    color: #ffffff;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyInternalItemView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"preference-tree-internal-item\">\n    <div class=\"preference-tree-internal-item-node\">\n        <i class=\"fa fa-chevron-right hidden\" aria-hidden=\"true\" data-field=\"preference-tree-internal-item-expand-icon\"></i>\n        <i class=\"fa fa-chevron-down\" aria-hidden=\"true\" data-field=\"preference-tree-internal-item-contract-icon\"></i>\n        <label data-field=\"preference-tree-internal-item-label\"></label>\n    </div>\n    <div class=\"preference-tree-internal-item-children\" data-field=\"preference-tree-internal-item-children\"></div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyInternalItemView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.DoubleClickEvent;\nimport com.google.gwt.user.client.DOM;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class TreeHierarchyInternalItemView implements IsElement,\n                                                      TreeHierarchyInternalItemPresenter.View {\n\n    @DataField(\"preference-tree-internal-item-label\")\n    Element label = DOM.createLabel();\n    @Inject\n    @DataField(\"preference-tree-internal-item-node\")\n    Div treeNode;\n    @Inject\n    @DataField(\"preference-tree-internal-item-children\")\n    Div children;\n    @DataField(\"preference-tree-internal-item-expand-icon\")\n    Element expandIcon = DOM.createElement(\"i\");\n    @DataField(\"preference-tree-internal-item-contract-icon\")\n    Element contractIcon = DOM.createElement(\"i\");\n    private TreeHierarchyInternalItemPresenter presenter;\n    @Inject\n    private TranslationService translationService;\n\n    @Override\n    public void init(final TreeHierarchyInternalItemPresenter presenter) {\n        this.presenter = presenter;\n\n        final String preferenceLabel = getPreferenceLabel(presenter.getHierarchyElement().getBundleKey());\n        label.setInnerHTML(preferenceLabel);\n\n        treeNode.getStyle().setProperty(\"padding-left\",\n                                        presenter.getLevel() * 27 + 8 + \"px\");\n\n        presenter.getHierarchyItems().forEach(hierarchyItem -> {\n            children.appendChild(((IsElement) hierarchyItem.getView()).getElement());\n        });\n    }\n\n    @Override\n    public void deselect() {\n        treeNode.getClassList().remove(\"selected\");\n    }\n\n    @EventHandler(\"preference-tree-internal-item-expand-icon\")\n    public void expand(final ClickEvent event) {\n        expand();\n    }\n\n    @EventHandler(\"preference-tree-internal-item-contract-icon\")\n    public void contract(final ClickEvent event) {\n        contract();\n    }\n\n    @EventHandler(\"preference-tree-internal-item-label\")\n    public void select(final ClickEvent event) {\n        select();\n    }\n\n    @EventHandler(\"preference-tree-internal-item-label\")\n    public void contractExpand(final DoubleClickEvent event) {\n        if (!children.getHidden()) {\n            contract();\n        } else {\n            expand();\n        }\n    }\n\n    private void expand() {\n        expandIcon.addClassName(\"hidden\");\n        contractIcon.removeClassName(\"hidden\");\n        children.setHidden(false);\n    }\n\n    private void contract() {\n        expandIcon.removeClassName(\"hidden\");\n        contractIcon.addClassName(\"hidden\");\n        children.setHidden(true);\n    }\n\n    @Override\n    public void select() {\n        if (!label.hasClassName(\"selected\")) {\n            presenter.select();\n        }\n    }\n\n    @Override\n    public void selectElement() {\n        treeNode.getClassList().add(\"selected\");\n    }\n\n    private String getPreferenceLabel(String bundleKey) {\n        return translationService.format(bundleKey);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyLeafItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyItemView;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyLeafItemPresenter;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemSelectedEvent;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\npublic class TreeHierarchyLeafItemPresenter implements HierarchyLeafItemPresenter {\n\n    private final View view;\n    private final Event<HierarchyItemSelectedEvent> hierarchyItemSelectedEvent;\n    private PreferenceHierarchyElement<?> hierarchyElement;\n    private int level;\n\n    @Inject\n    public TreeHierarchyLeafItemPresenter(final View view,\n                                          final Event<HierarchyItemSelectedEvent> hierarchyItemSelectedEvent) {\n        this.view = view;\n        this.hierarchyItemSelectedEvent = hierarchyItemSelectedEvent;\n    }\n\n    @Override\n    public <T> void init(final PreferenceHierarchyElement<T> preference,\n                         final int level,\n                         final boolean tryToSelectChild) {\n        hierarchyElement = preference;\n        this.level = level;\n        view.init(this);\n    }\n\n    @Override\n    public void fireSelect() {\n        view.select();\n    }\n\n    public void select() {\n        if (hierarchyElement.isSelectable()) {\n            final HierarchyItemSelectedEvent event = new HierarchyItemSelectedEvent(hierarchyElement);\n            hierarchyItemSelectedEvent.fire(event);\n            view.selectElement();\n        }\n    }\n\n    public void itemSelectedEvent(@Observes HierarchyItemSelectedEvent event) {\n        if (!hierarchyElement.getId().equals(event.getItemId())) {\n            view.deselect();\n        }\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public PreferenceHierarchyElement<?> getHierarchyElement() {\n        return hierarchyElement;\n    }\n\n    public int getLevel() {\n        return level;\n    }\n\n    public interface View extends HierarchyItemView,\n                                  UberElement<TreeHierarchyLeafItemPresenter> {\n\n        void select();\n\n        void selectElement();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyLeafItemView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.preference-tree-leaf-item label {\n    padding: 4px;\n    margin: 0;\n    cursor: pointer;\n}\n\n.preference-tree-leaf-item-node {\n    margin-right: 1px;\n}\n\n.preference-tree-leaf-item .selected {\n    background-color: #1699d3;\n    color: #ffffff;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyLeafItemView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"preference-tree-leaf-item\">\n    <div class=\"preference-tree-leaf-item-node\">\n        <label data-field=\"preference-tree-leaf-item-label\"></label>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyLeafItemView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.DOM;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class TreeHierarchyLeafItemView implements IsElement,\n                                                  TreeHierarchyLeafItemPresenter.View {\n\n    @Inject\n    @DataField(\"preference-tree-leaf-item-node\")\n    Div treeNode;\n    @DataField(\"preference-tree-leaf-item-label\")\n    Element label = DOM.createLabel();\n    private TreeHierarchyLeafItemPresenter presenter;\n    @Inject\n    private TranslationService translationService;\n\n    @Override\n    public void init(final TreeHierarchyLeafItemPresenter presenter) {\n        this.presenter = presenter;\n\n        treeNode.getStyle().setProperty(\"padding-left\",\n                                        presenter.getLevel() * 27 + 24 + \"px\");\n\n        final String preferenceLabel = getPreferenceLabel(presenter.getHierarchyElement().getBundleKey());\n        label.setInnerHTML(preferenceLabel);\n    }\n\n    private String getPreferenceLabel(String bundleKey) {\n        return translationService.format(bundleKey);\n    }\n\n    @Override\n    public void deselect() {\n        treeNode.getClassList().remove(\"selected\");\n    }\n\n    @EventHandler(\"preference-tree-leaf-item-label\")\n    public void select(final ClickEvent event) {\n        select();\n    }\n\n    @Override\n    public void select() {\n        if (!label.hasClassName(\"selected\")) {\n            presenter.select();\n        }\n    }\n\n    @Override\n    public void selectElement() {\n        treeNode.getClassList().add(\"selected\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyStructurePresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyItemPresenter;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyStructurePresenter;\nimport org.uberfire.ext.preferences.client.central.hierarchy.HierarchyStructureView;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent;\nimport org.uberfire.ext.preferences.client.utils.PreferenceFormBeansInfo;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanServerStore;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@TreeView\n@Dependent\npublic class TreeHierarchyStructurePresenter implements HierarchyStructurePresenter {\n\n    private final View view;\n    private final Caller<PreferenceBeanServerStore> preferenceBeanServerStoreCaller;\n    private final ManagedInstance<TreeHierarchyInternalItemPresenter> treeHierarchyInternalItemPresenterProvider;\n    private final ManagedInstance<TreeHierarchyLeafItemPresenter> treeHierarchyLeafItemPresenterProvider;\n    private final Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent;\n    private final PlaceManager placeManager;\n    private final PreferenceBeanStore store;\n    private final Event<NotificationEvent> notification;\n    private final PreferenceFormBeansInfo preferenceFormBeansInfo;\n    private HierarchyItemPresenter hierarchyItem;\n    private PreferenceHierarchyElement<?> preferenceElement;\n    private PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategyInfo;\n    private PreferenceScope scope;\n\n    @Inject\n    public TreeHierarchyStructurePresenter(final View view,\n                                           final Caller<PreferenceBeanServerStore> preferenceBeanServerStoreCaller,\n                                           final ManagedInstance<TreeHierarchyInternalItemPresenter> treeHierarchyInternalItemPresenterProvider,\n                                           final ManagedInstance<TreeHierarchyLeafItemPresenter> treeHierarchyLeafItemPresenterProvider,\n                                           final Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent,\n                                           final PlaceManager placeManager,\n                                           final PreferenceBeanStore store,\n                                           final Event<NotificationEvent> notification,\n                                           final PreferenceFormBeansInfo preferenceFormBeansInfo) {\n        this.view = view;\n        this.preferenceBeanServerStoreCaller = preferenceBeanServerStoreCaller;\n        this.treeHierarchyInternalItemPresenterProvider = treeHierarchyInternalItemPresenterProvider;\n        this.treeHierarchyLeafItemPresenterProvider = treeHierarchyLeafItemPresenterProvider;\n        this.hierarchyItemFormInitializationEvent = hierarchyItemFormInitializationEvent;\n        this.placeManager = placeManager;\n        this.store = store;\n        this.notification = notification;\n        this.preferenceFormBeansInfo = preferenceFormBeansInfo;\n    }\n\n    @Override\n    public void init(final String rootIdentifier,\n                     final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategyInfo,\n                     final PreferenceScope scope) {\n        final TreeHierarchyStructurePresenter presenter = this;\n\n        this.customScopeResolutionStrategyInfo = customScopeResolutionStrategyInfo;\n        this.scope = scope;\n\n        final RemoteCallback<PreferenceHierarchyElement<?>> successCallback = rootPreference -> {\n            preferenceElement = rootPreference;\n            setupHierarchyItem(rootPreference);\n            view.init(presenter);\n        };\n\n        final ErrorCallback<Object> errorCallback = (message, throwable) -> {\n            throw new RuntimeException(throwable);\n        };\n\n        if (customScopeResolutionStrategyInfo != null) {\n            preferenceBeanServerStoreCaller.call(successCallback,\n                                                 errorCallback).buildHierarchyStructureForPreference(rootIdentifier,\n                                                                                                     customScopeResolutionStrategyInfo);\n        } else {\n            preferenceBeanServerStoreCaller.call(successCallback,\n                                                 errorCallback).buildHierarchyStructureForPreference(rootIdentifier);\n        }\n    }\n\n    public void saveEvent(@Observes PreferencesCentralSaveEvent event) {\n        final Collection<BasePreferencePortable<? extends BasePreference<?>>> preferencesToSave = getPreferencesToSave(preferenceElement);\n        final Command successCallback = () -> notification.fire(new NotificationEvent(view.getSaveSuccessMessage(),\n                                                                                      NotificationEvent.NotificationType.SUCCESS));\n        final ParameterizedCommand<Throwable> errorCallback = parameter -> notification.fire(new NotificationEvent(view.getSaveErrorMessage(parameter.getMessage()),\n                                                                                                                   NotificationEvent.NotificationType.ERROR));\n        if (scope != null) {\n            store.save(preferencesToSave,\n                       scope,\n                       successCallback,\n                       errorCallback);\n        } else if (customScopeResolutionStrategyInfo != null) {\n            store.save(preferencesToSave,\n                       customScopeResolutionStrategyInfo,\n                       successCallback,\n                       errorCallback);\n        } else {\n            store.save(preferencesToSave,\n                       successCallback,\n                       errorCallback);\n        }\n    }\n\n    void setupHierarchyItem(final PreferenceHierarchyElement<?> rootPreference) {\n        if (rootPreference.hasChildren()) {\n            hierarchyItem = treeHierarchyInternalItemPresenterProvider.get();\n        } else {\n            hierarchyItem = treeHierarchyLeafItemPresenterProvider.get();\n        }\n\n        hierarchyItem.init(rootPreference,\n                           0,\n                           !rootPreference.isSelectable());\n        if (rootPreference.isSelectable()) {\n            hierarchyItem.fireSelect();\n        }\n    }\n\n    Collection<BasePreferencePortable<? extends BasePreference<?>>> getPreferencesToSave(final PreferenceHierarchyElement<?> preferenceElement) {\n        Collection<BasePreferencePortable<? extends BasePreference<?>>> preferencesToSave = new ArrayList<>();\n\n        if (preferenceElement.isRoot()) {\n            preferencesToSave.add((BasePreferencePortable<? extends BasePreference<?>>) preferenceElement.getPortablePreference());\n        }\n\n        preferenceElement.getChildren().forEach(childElement -> {\n            preferencesToSave.addAll(getPreferencesToSave(childElement));\n        });\n\n        return preferencesToSave;\n    }\n\n    public HierarchyItemPresenter getHierarchyItem() {\n        return hierarchyItem;\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public interface View extends HierarchyStructureView,\n                                  UberElement<TreeHierarchyStructurePresenter> {\n\n        String getTranslation(String key);\n\n        String getSaveSuccessMessage();\n\n        String getSaveErrorMessage(String message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyStructureView.css",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.full-height {\n    height: 100%;\n}\n\n.preference-tree-root .preference-tree-root-children {\n    -webkit-touch-callout: none;\n    -webkit-user-select: none;\n    -khtml-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyStructureView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"preference-tree-root full-height\">\n    <div class=\"full-height\">\n        <div class=\"preference-tree-root-children\" data-field=\"preference-tree\">\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyStructureView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.preferences.client.resources.i18n.Constants;\n\n@Dependent\n@Templated\npublic class TreeHierarchyStructureView implements IsElement,\n                                                   TreeHierarchyStructurePresenter.View {\n\n    private final TranslationService translationService;\n\n    @Inject\n    @DataField(\"preference-tree\")\n    Div tree;\n\n    @Inject\n    public TreeHierarchyStructureView(final TranslationService translationService) {\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(final TreeHierarchyStructurePresenter presenter) {\n        tree.setInnerHTML(\"\");\n        tree.appendChild(((IsElement) presenter.getHierarchyItem().getView()).getElement());\n    }\n\n    @Override\n    public String getTranslation(final String key) {\n        return translationService.format(key);\n    }\n\n    @Override\n    public String getSaveSuccessMessage() {\n        return translationService.format(Constants.TreeHierarchyStructureView_SaveSuccess);\n    }\n\n    @Override\n    public String getSaveErrorMessage(String message) {\n        return translationService.format(Constants.UnexpectedErrorWhileSaving,\n                                         message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/central/tree/TreeView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface TreeView {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/AbstractHierarchyItemEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\npublic abstract class AbstractHierarchyItemEvent {\n\n    private final String itemId;\n\n    public AbstractHierarchyItemEvent(final String itemId) {\n        this.itemId = itemId;\n    }\n\n    public String getItemId() {\n        return itemId;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/HierarchyItemFormInitializationEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\n/**\n * Event fired when the item that corresponds to a preference form is selected at the preferences\n * central perspective. Its objective is to provide a form with its necessary initialization information.\n */\npublic class HierarchyItemFormInitializationEvent extends AbstractHierarchyItemEvent {\n\n    private PreferenceHierarchyElement<?> hierarchyElement;\n\n    public HierarchyItemFormInitializationEvent(final PreferenceHierarchyElement<?> hierarchyElement) {\n        super(hierarchyElement.getId());\n        this.hierarchyElement = hierarchyElement;\n    }\n\n    public <T extends BasePreferencePortable<?>> T getPreference() {\n        Class<T> preferenceClass = (Class<T>) hierarchyElement.getPortablePreference().getPojoClass();\n        return (T) hierarchyElement.getPortablePreference();\n    }\n\n    public PreferenceHierarchyElement<?> getHierarchyElement() {\n        return hierarchyElement;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/HierarchyItemSelectedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\n/**\n * Event fired when an preference hierarchy item is selected at the preferences central perspective.\n */\npublic class HierarchyItemSelectedEvent extends AbstractHierarchyItemEvent {\n\n    private PreferenceHierarchyElement<?> hierarchyElement;\n\n    public HierarchyItemSelectedEvent(final PreferenceHierarchyElement<?> hierarchyElement) {\n        super(hierarchyElement.getId());\n        this.hierarchyElement = hierarchyElement;\n    }\n\n    public <T extends BasePreferencePortable<?>> T getPreference() {\n        Class<T> preferenceClass = (Class<T>) hierarchyElement.getPortablePreference().getPojoClass();\n        return (T) hierarchyElement.getPortablePreference();\n    }\n\n    public String getPreferenceIdentifier() {\n        return hierarchyElement.getPortablePreference().identifier();\n    }\n\n    public PreferenceHierarchyElement<?> getHierarchyElement() {\n        return hierarchyElement;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/PreferencesCentralActionsConfigurationEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\npublic class PreferencesCentralActionsConfigurationEvent {\n\n    private String adminPageScreenToGoBack;\n\n    private String perspectiveIdentifierToGoBackTo;\n\n    public PreferencesCentralActionsConfigurationEvent(final String adminPageScreenToGoBack,\n                                                       final String perspectiveIdentifierToGoBackTo) {\n        this.adminPageScreenToGoBack = adminPageScreenToGoBack;\n        this.perspectiveIdentifierToGoBackTo = perspectiveIdentifierToGoBackTo;\n    }\n\n    public String getAdminPageScreenToGoBack() {\n        return adminPageScreenToGoBack;\n    }\n\n    public String getPerspectiveIdentifierToGoBackTo() {\n        return perspectiveIdentifierToGoBackTo;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/PreferencesCentralInitializationEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\npublic class PreferencesCentralInitializationEvent {\n\n    private String preferenceIdentifier;\n\n    private PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy;\n\n    private PreferenceScope preferenceScope;\n\n    public PreferencesCentralInitializationEvent(final String preferenceIdentifier,\n                                                 final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                                                 final PreferenceScope preferenceScope) {\n        this.preferenceIdentifier = preferenceIdentifier;\n        this.customScopeResolutionStrategy = customScopeResolutionStrategy;\n        this.preferenceScope = preferenceScope;\n    }\n\n    public String getPreferenceIdentifier() {\n        return preferenceIdentifier;\n    }\n\n    public boolean isUseCustomScopeResolutionStrategy() {\n        return customScopeResolutionStrategy != null;\n    }\n\n    public PreferenceScopeResolutionStrategyInfo getCustomScopeResolutionStrategy() {\n        return customScopeResolutionStrategy;\n    }\n\n    public PreferenceScope getPreferenceScope() {\n        return preferenceScope;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PreferencesCentralInitializationEvent)) {\n            return false;\n        }\n\n        PreferencesCentralInitializationEvent that = (PreferencesCentralInitializationEvent) o;\n\n        if (preferenceIdentifier != null ? !preferenceIdentifier.equals(that.preferenceIdentifier) : that.preferenceIdentifier != null) {\n            return false;\n        }\n        if (customScopeResolutionStrategy != null ? !customScopeResolutionStrategy.equals(that.customScopeResolutionStrategy) : that.customScopeResolutionStrategy != null) {\n            return false;\n        }\n        return !(preferenceScope != null ? !preferenceScope.equals(that.preferenceScope) : that.preferenceScope != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = preferenceIdentifier != null ? preferenceIdentifier.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (customScopeResolutionStrategy != null ? customScopeResolutionStrategy.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (preferenceScope != null ? preferenceScope.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/PreferencesCentralPreSaveEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\n/**\n * Event fired when the save button is pressed at the preferences central perspective.\n * This event will be treated/observed before the {@link PreferencesCentralSaveEvent}\n */\npublic class PreferencesCentralPreSaveEvent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/PreferencesCentralSaveEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\n/**\n * Event fired when the save button is pressed at the preferences central perspective.\n */\npublic class PreferencesCentralSaveEvent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/event/PreferencesCentralUndoChangesEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.event;\n\n/**\n * Event fired when the undo button is pressed at the preferences central perspective.\n */\npublic class PreferencesCentralUndoChangesEvent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic class Constants {\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String PreferencesCentralActionsView_ChangesUndone = \"PreferencesCentralActionsView.ChangesUndone\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String TreeHierarchyStructureView_SaveSuccess = \"TreeHierarchyStructureView.SaveSuccess\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String AdminPagePresenter_NoScreenParameterError = \"AdminPagePresenter.NoScreenParameterError\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String AdminPagePresenter_NoScreenFoundError = \"AdminPagePresenter.NoScreenFoundError\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String AdminPagePerspective_GoBackToThePreviousPage = \"AdminPagePerspective.GoBackToThePreviousPage\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String PreferencesCentralPerspective_Preferences = \"PreferencesCentralPerspective.Preferences\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String UnexpectedErrorWhileSaving = \"UnexpectedErrorWhileSaving\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String Admin = \"Admin\";\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/java/org/uberfire/ext/preferences/client/utils/PreferenceFormBeansInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.utils;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.ext.preferences.client.annotations.PreferenceForm;\n\n/**\n * Service that provides preferences beans information.\n */\n@ApplicationScoped\npublic class PreferenceFormBeansInfo {\n\n    private ActivityBeansInfo activityBeansInfo;\n\n    @Inject\n    public PreferenceFormBeansInfo(final ActivityBeansInfo activityBeansInfo) {\n        this.activityBeansInfo = activityBeansInfo;\n    }\n\n    /**\n     * Searches for a {@link WorkbenchScreenActivity} that is qualified with {@link PreferenceForm} with the passed\n     * preference bean identifier as its value.\n     * @param preferenceIdentifier The {@link PreferenceForm} value to be searched.\n     * @return The screen bean identifier.\n     */\n    public String getPreferenceFormFor(final String preferenceIdentifier) {\n        final Collection<? extends IOCBeanDef<?>> screenBeans = activityBeansInfo.lookupBeans(WorkbenchScreenActivity.class);\n\n        for (final IOCBeanDef<?> beanDef : screenBeans) {\n            for (final Annotation annotation : beanDef.getQualifiers()) {\n                if (annotation instanceof PreferenceForm) {\n                    PreferenceForm preferenceFormQualifier = (PreferenceForm) annotation;\n                    if (preferenceIdentifier.equals(preferenceFormQualifier.value())) {\n                        return activityBeansInfo.getId(beanDef);\n                    }\n                }\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/UberfirePreferences.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <!--<inherits name=\"org.uberfire.UberfireClientAll\"/>-->\n  <!--<inherits name=\"com.google.gwt.i18n.I18N\"/>-->\n  <!--<inherits name=\"com.google.gwt.http.HTTP\"/>-->\n  <!--<inherits name=\"com.google.gwt.user.User\"/>-->\n  <!---->\n  <!--<inherits name='org.jboss.errai.bus.ErraiBus'/>-->\n  <!---->\n  <!--<inherits name=\"org.uberfire.UberfireWorkbench\"/>-->\n  <!---->\n  <!--<inherits name=\"org.uberfire.UberfireClientAPI\"/>-->\n  <!---->\n  <inherits name=\"org.uberfire.preferences.UberfirePreferencesClientBackend\"/>\n\n  <!--<inherits name=\"org.uberfire.ext.preferences.UberfirePreferencesAPI\"/>-->\n\n  <source path='client'/>\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nPreferencesCentralActionsView.Save=Save\nPreferencesCentralActionsView.Cancel=Cancel\nPreferencesCentralActionsView.ChangesUndone=Changes undone.\nTreeHierarchyStructureView.SaveSuccess=Changes saved successfully!\nAdminPagePresenter.NoScreenParameterError=A parameter named screen containing the screen name is expected in the place request.\nAdminPagePresenter.NoScreenFoundError=No screen named {0} was added to the admin page.\nAdminPagePerspective.GoBackToThePreviousPage=Go to the previous page\nPreferencesCentralPerspective.Preferences=Preferences\nPropertyValidator.NotEmptyValidator.IsEmpty=Must not be empty.\nPropertyValidator.ConstrainedValuesValidator.NotAllowed=Value is not allowed\nPropertyValidator.NumberPropertyValidator.NotAllowed=Value must be a positive integer\nUnexpectedErrorWhileSaving=Unexpected error while saving: {0}\nAdmin=Admin\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_de.properties",
    "content": "# translation auto-copied from project Drools Workbench, version 6.0.0, document org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants, author jdimanos\nAdmin=Admin\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nPreferencesCentralActionsView.Save=Guardar\nPreferencesCentralActionsView.Cancel=Cancelar\nPreferencesCentralActionsView.ChangesUndone=Cambios anulados.\nTreeHierarchyStructureView.SaveSuccess=Los cambios se guardaron correctamente.\nAdminPagePresenter.NoScreenParameterError=En la solicitud de lugar, se espera una pantalla con el nombre del parámetro que contiene el nombre de la pantalla.\nAdminPagePresenter.NoScreenFoundError=No se agregó ninguna pantalla con el nombre {0} a la página de administración.\nAdminPagePerspective.GoBackToThePreviousPage=Ir a la página anterior\nPreferencesCentralPerspective.Preferences=Preferencias\nPropertyValidator.NotEmptyValidator.IsEmpty=No debe estar vacío.\nPropertyValidator.ConstrainedValuesValidator.NotAllowed=El valor no está permitido\nPropertyValidator.NumberPropertyValidator.NotAllowed=El valor debe ser un número entero positivo\nUnexpectedErrorWhileSaving=Se produjo un error inesperado al guardar: {0}\nAdmin=Admin\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nPreferencesCentralActionsView.Save=Enregistrer\nPreferencesCentralActionsView.Cancel=Annuler\nPreferencesCentralActionsView.ChangesUndone=Modifications annulées.\nTreeHierarchyStructureView.SaveSuccess=Les modifications ont été enregistrées.\nAdminPagePresenter.NoScreenParameterError=Un écran nommé avec un paramètre contenant son nom est attendu dans la demande d''emplacement.\nAdminPagePresenter.NoScreenFoundError=Aucun écran nommé {0} n''a été ajouté à la page d''administration.\nAdminPagePerspective.GoBackToThePreviousPage=Revenir à la page précédente\nPreferencesCentralPerspective.Preferences=Préférences\nPropertyValidator.NotEmptyValidator.IsEmpty=Ne doit pas être vide.\nPropertyValidator.ConstrainedValuesValidator.NotAllowed=La valeur n''est pas autorisée\nPropertyValidator.NumberPropertyValidator.NotAllowed=La valeur doit être un nombre entier positif\nUnexpectedErrorWhileSaving=Erreur inattendue lors de l''enregistrement : {0}\nAdmin=Administrateur\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nPreferencesCentralActionsView.Save=Salva\nPreferencesCentralActionsView.Cancel=Annulla\nPreferencesCentralActionsView.ChangesUndone=Cambiamenti annullati.\nTreeHierarchyStructureView.SaveSuccess=Cambiamenti salvati con successo!\nAdminPagePresenter.NoScreenParameterError=È previsto un parametro chiamato screen contenente il nome dello schermo nella richiesta di posizione.\nAdminPagePresenter.NoScreenFoundError=Nessuno schermo chiamato {0} è stato aggiunto alla pagina di amministrazione.\nAdminPagePerspective.GoBackToThePreviousPage=Torna alla pagina precedente\nPreferencesCentralPerspective.Preferences=Preferenze\nPropertyValidator.NotEmptyValidator.IsEmpty=Non deve essere vuoto.\nPropertyValidator.ConstrainedValuesValidator.NotAllowed=Il valore non è consentito\nPropertyValidator.NumberPropertyValidator.NotAllowed=Il valore deve essere un numero intero positivo\nUnexpectedErrorWhileSaving=Errore imprevisto durante il salvataggio: {0}\nAdmin=Amministratore\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nPreferencesCentralActionsView.Save=保存\nPreferencesCentralActionsView.Cancel=キャンセル\nPreferencesCentralActionsView.ChangesUndone=変更を元に戻しました。\nTreeHierarchyStructureView.SaveSuccess=変更が保存されました!\nAdminPagePresenter.NoScreenParameterError=スクリーン名を保持する screen というパラメータがプレースリクエストに必要です。\nAdminPagePresenter.NoScreenFoundError={0} という名前のスクリーンは管理ページに追加されませんでした。\nAdminPagePerspective.GoBackToThePreviousPage=前のページに移動\nPreferencesCentralPerspective.Preferences=設定\nPropertyValidator.NotEmptyValidator.IsEmpty=空欄にはできません\nPropertyValidator.ConstrainedValuesValidator.NotAllowed=値は許可されていません\nPropertyValidator.NumberPropertyValidator.NotAllowed=値は正の整数でなければなりません\nUnexpectedErrorWhileSaving=保存中に予期しないエラー: {0}\nAdmin=管理者\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_pt_BR.properties",
    "content": "# translation auto-copied from project Drools Workbench, version 6.0.0, document org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants, author ldelima@redhat.com\nAdmin=Admin\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/main/resources/org/uberfire/ext/preferences/client/resources/i18n/Constants_zh_CN.properties",
    "content": "# translation auto-copied from project Drools Workbench, version 6.0.0, document org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants, author xi.huang\nAdmin=管理员\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/admin/AdminPagePerspectiveTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin;\n\nimport java.util.Collections;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\npublic class AdminPagePerspectiveTest {\n\n    private AdminPagePerspective perspective;\n\n    @Before\n    public void setup() {\n        perspective = spy(new AdminPagePerspective());\n        doNothing().when(perspective).configurePerspective(anyMap());\n    }\n\n    @Test\n    public void getPerspectiveWithoutStartupTest() {\n        final PerspectiveDefinition perspectiveDefinition = perspective.getPerspective();\n\n        verify(perspective).createPerspectiveDefinition();\n        verify(perspective).configurePerspective(Collections.emptyMap());\n\n        assertNotNull(perspectiveDefinition);\n        assertNotNull(perspectiveDefinition.getName());\n    }\n\n    @Test\n    public void getPerspectiveWithStartupTest() {\n        this.perspective.onStartup(mock(PlaceRequest.class));\n\n        verify(perspective,\n               times(1)).createPerspectiveDefinition();\n        verify(perspective,\n               times(1)).configurePerspective(anyMap());\n\n        final PerspectiveDefinition perspectiveDefinition = perspective.getPerspective();\n\n        verify(perspective,\n               times(1)).createPerspectiveDefinition();\n        verify(perspective,\n               times(1)).configurePerspective(anyMap());\n\n        assertNotNull(perspectiveDefinition);\n        assertNotNull(perspectiveDefinition.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/admin/AdminPagePresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.preferences.client.admin.category.AdminPageCategoryPresenter;\nimport org.uberfire.ext.preferences.client.admin.page.AdminPage;\nimport org.uberfire.ext.preferences.client.admin.page.AdminPageImpl;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\npublic class AdminPagePresenterTest {\n\n    private AdminPagePresenter.View view;\n\n    private AdminPage adminPage;\n\n    private ManagedInstance<AdminPageCategoryPresenter> categoryPresenterProvider;\n\n    private Event<NotificationEvent> notification;\n\n    private AdminPagePresenter presenter;\n\n    @Before\n    public void setup() {\n        view = mock(AdminPagePresenter.View.class);\n        adminPage = new AdminPageImpl();\n        categoryPresenterProvider = mock(ManagedInstance.class);\n        notification = mock(EventSourceMock.class);\n\n        presenter = spy(new AdminPagePresenter(view,\n                                               adminPage,\n                                               categoryPresenterProvider,\n                                               notification));\n    }\n\n    @Test\n    public void onStartupWithScreenTest() {\n        doNothing().when(presenter).init(anyString());\n\n        Map<String, String> params = new HashMap<>();\n        params.put(\"screen\",\n                   \"my-screen\");\n        PlaceRequest placeRequest = new DefaultPlaceRequest(\"AdminPagePresenter\",\n                                                            params);\n\n        presenter.onStartup(placeRequest);\n\n        verify(view).init(presenter);\n        verify(notification,\n               never()).fire(any(NotificationEvent.class));\n        verify(presenter).init(\"my-screen\");\n    }\n\n    @Test\n    public void onStartupWithoutScreenTest() {\n        PlaceRequest placeRequest = new DefaultPlaceRequest(\"AdminPagePresenter\");\n\n        presenter.onStartup(placeRequest);\n\n        verify(view).init(presenter);\n        verify(notification).fire(any(NotificationEvent.class));\n        verify(presenter,\n               never()).init(anyString());\n    }\n\n    @Test\n    public void initWithNotAddedScreenTest() {\n        presenter.init(\"not-added-screen\");\n\n        verify(notification).fire(any(NotificationEvent.class));\n    }\n\n    @Test\n    public void initWithAddedScreenTest() {\n        adminPage.addScreen(\"added-screen\",\n                            \"Screen title\");\n\n        presenter.init(\"added-screen\");\n\n        verify(notification,\n               never()).fire(any(NotificationEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/admin/category/AdminPageCategoryPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.category;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.preferences.client.admin.item.AdminPageItemPresenter;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\n\nimport static org.mockito.Mockito.*;\n\npublic class AdminPageCategoryPresenterTest {\n\n    private ManagedInstance<AdminPageItemPresenter> adminPageItemPresenterProvider;\n\n    private AdminPageCategoryPresenter.View view;\n\n    private AdminPageCategoryPresenter presenter;\n\n    @Before\n    public void setup() {\n        view = mock(AdminPageCategoryPresenter.View.class);\n        adminPageItemPresenterProvider = mock(ManagedInstance.class);\n        doReturn(mock(AdminPageItemPresenter.class)).when(adminPageItemPresenterProvider).get();\n\n        presenter = new AdminPageCategoryPresenter(view,\n                                                   adminPageItemPresenterProvider);\n    }\n\n    @Test\n    public void setupTest() {\n        List<AdminTool> adminTools = new ArrayList<>();\n        adminTools.add(mock(AdminTool.class));\n        adminTools.add(mock(AdminTool.class));\n\n        presenter.setup(adminTools,\n                        \"screen\",\n                        null);\n\n        verify(adminPageItemPresenterProvider,\n               times(2)).get();\n        verify(view,\n               times(2)).add(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/admin/item/AdminPageItemPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.item;\n\nimport java.util.Collections;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.admin.page.AdminTool;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralActionsConfigurationEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AdminPageItemPresenterTest {\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private EventSourceMock<PreferencesCentralActionsConfigurationEvent> adminPageConfigurationEvent;\n\n    @Mock\n    private AdminPageItemPresenter.View view;\n\n    private AdminPageItemPresenter presenter;\n\n    @Before\n    public void setup() {\n        presenter = new AdminPageItemPresenter(view,\n                                               placeManager,\n                                               adminPageConfigurationEvent);\n    }\n\n    @Test\n    public void enterTest() {\n        final Command command = spy(new Command() {\n            @Override\n            public void execute() {\n            }\n        });\n\n        AdminTool adminTool = new AdminTool(\"title1\",\n                                            Collections.singleton(\"iconCss1\"),\n                                            \"category1\",\n                                            command);\n\n        presenter.setup(adminTool,\n                        \"screen\",\n                        null);\n        presenter.enter();\n\n        verify(view).init(presenter);\n        verify(command).execute();\n        verify(adminPageConfigurationEvent).fire(any(PreferencesCentralActionsConfigurationEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/admin/page/AdminPageImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.admin.page;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\nimport javax.enterprise.event.Event;\n\nimport com.google.common.collect.Sets;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralPerspective;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralInitializationEvent;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.UberfireBreadcrumbs;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeFactoryImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static java.util.Collections.singleton;\nimport static org.hamcrest.CoreMatchers.hasItem;\nimport static org.hamcrest.CoreMatchers.hasItems;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AdminPageImplTest {\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private Event<PreferencesCentralInitializationEvent> preferencesCentralInitializationEvent;\n\n    @Mock\n    private UberfireBreadcrumbs uberfireBreadcrumbs;\n\n    @Mock\n    private TranslationService translationService;\n\n    private PreferenceScopeResolutionStrategy resolutionStrategy;\n\n    private AdminPageImpl adminPage;\n\n    @Before\n    public void setup() {\n        final UsernameProvider usernameProvider = mock(UsernameProvider.class);\n        final DefaultPreferenceScopeTypes scopeTypes = new DefaultPreferenceScopeTypes(usernameProvider);\n        final PreferenceScopeFactoryImpl scopeFactory = new PreferenceScopeFactoryImpl(scopeTypes);\n        resolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                          null);\n        adminPage = new AdminPageImpl(placeManager,\n                                      preferencesCentralInitializationEvent,\n                                      resolutionStrategy,\n                                      uberfireBreadcrumbs,\n                                      translationService);\n    }\n\n    @Test\n    public void addValidScreen() {\n        adminPage.addScreen(\"screen\",\n                            \"title\");\n        assertEquals(\"title\",\n                     adminPage.getScreenTitle(\"screen\"));\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void addScreenWithNullIdentifierTest() {\n        adminPage.addScreen(null,\n                            \"title\");\n    }\n\n    @Test\n    public void addToolTest() {\n        adminPage.addScreen(\"screen1\",\n                            \"Screen 1\");\n        adminPage.addScreen(\"screen2\",\n                            \"Screen 2\");\n\n        adminPage.addTool(\"screen1\",\n                          \"title1\",\n                          singleton(\"iconCss1\"),\n                          \"category1\",\n                          () -> {\n                          });\n        adminPage.addTool(\"screen1\",\n                          \"title2\",\n                          singleton(\"iconCss2\"),\n                          \"category1\",\n                          () -> {\n                          });\n        adminPage.addTool(\"screen1\",\n                          \"title3\",\n                          singleton(\"iconCss3\"),\n                          \"category2\",\n                          () -> {\n                          });\n        adminPage.addTool(\"screen2\",\n                          \"title4\",\n                          singleton(\"iconCss4\"),\n                          \"category3\",\n                          () -> {\n                          });\n\n        final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory(\"screen1\");\n\n        assertNotNull(toolsByCategory1);\n        assertEquals(2,\n                     toolsByCategory1.size());\n\n        final List<AdminTool> category1Tools = toolsByCategory1.get(\"category1\");\n        assertEquals(2,\n                     category1Tools.size());\n        assertEquals(\"title1\",\n                     category1Tools.get(0).getTitle());\n        assertEquals(1,\n                     category1Tools.get(0).getIconCss().size());\n        assertThat(category1Tools.get(0).getIconCss(),\n                   hasItem(\"iconCss1\"));\n        assertEquals(\"title2\",\n                     category1Tools.get(1).getTitle());\n        assertEquals(1,\n                     category1Tools.get(1).getIconCss().size());\n        assertThat(category1Tools.get(1).getIconCss(),\n                   hasItem(\"iconCss2\"));\n\n        final List<AdminTool> category2Tools = toolsByCategory1.get(\"category2\");\n        assertEquals(1,\n                     category2Tools.size());\n        assertEquals(\"title3\",\n                     category2Tools.get(0).getTitle());\n        assertThat(category2Tools.get(0).getIconCss(),\n                   hasItem(\"iconCss3\"));\n\n        final Map<String, List<AdminTool>> toolsByCategory2 = adminPage.getToolsByCategory(\"screen2\");\n\n        assertNotNull(toolsByCategory2);\n        assertEquals(1,\n                     toolsByCategory2.size());\n\n        final List<AdminTool> category3Tools = toolsByCategory2.get(\"category3\");\n        assertEquals(1,\n                     category3Tools.size());\n        assertEquals(\"title4\",\n                     category3Tools.get(0).getTitle());\n        assertThat(category3Tools.get(0).getIconCss(),\n                   hasItem(\"iconCss4\"));\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void addToolWithNullScreenTest() {\n        adminPage.addTool(null,\n                          \"title\",\n                          singleton(\"iconCss\"),\n                          null,\n                          () -> {\n                          });\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void addToolWithNullCategoryTest() {\n        adminPage.addTool(\"screen\",\n                          \"title\",\n                          singleton(\"iconCss\"),\n                          null,\n                          () -> {\n                          });\n    }\n\n    @Test\n    public void addPreferenceTest() {\n        adminPage.addScreen(\"screen1\",\n                            \"Screen 1\");\n        adminPage.addPreference(\"screen1\",\n                                \"MyPreference\",\n                                \"My Preference\",\n                                Sets.newHashSet(\"fa\",\n                                                \"fa-map\"),\n                                \"category1\");\n\n        final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory(\"screen1\");\n\n        assertNotNull(toolsByCategory1);\n        assertEquals(1,\n                     toolsByCategory1.size());\n\n        final List<AdminTool> category1Tools = toolsByCategory1.get(\"category1\");\n        assertEquals(1,\n                     category1Tools.size());\n        assertEquals(\"My Preference\",\n                     category1Tools.get(0).getTitle());\n        assertEquals(2,\n                     category1Tools.get(0).getIconCss().size());\n        assertThat(category1Tools.get(0).getIconCss(),\n                   hasItems(\"fa\",\n                            \"fa-map\"));\n\n        category1Tools.get(0).getOnClickCommand().execute();\n\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER)));\n        verify(preferencesCentralInitializationEvent).fire(eq(new PreferencesCentralInitializationEvent(\"MyPreference\",\n                                                                                                        null,\n                                                                                                        null)));\n    }\n\n    @Test\n    public void addPreferenceWithCustomScopeResolutionStrategyParameterTest() {\n        Supplier<PreferenceScopeResolutionStrategyInfo> scopeResolutionStrategyInfoSupplier = new Supplier<PreferenceScopeResolutionStrategyInfo>() {\n            PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = null;\n\n            @Override\n            public PreferenceScopeResolutionStrategyInfo get() {\n                if (scopeResolutionStrategyInfo == null) {\n                    scopeResolutionStrategyInfo = mock(PreferenceScopeResolutionStrategyInfo.class);\n                }\n\n                return scopeResolutionStrategyInfo;\n            }\n        };\n\n        adminPage.addScreen(\"screen1\",\n                            \"Screen 1\");\n        adminPage.addPreference(\"screen1\",\n                                \"MyPreference\",\n                                \"My Preference\",\n                                Sets.newHashSet(\"fa\",\n                                                \"fa-map\"),\n                                \"category1\",\n                                scopeResolutionStrategyInfoSupplier);\n\n        final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory(\"screen1\");\n\n        assertNotNull(toolsByCategory1);\n        assertEquals(1,\n                     toolsByCategory1.size());\n\n        final List<AdminTool> category1Tools = toolsByCategory1.get(\"category1\");\n        assertEquals(1,\n                     category1Tools.size());\n        assertEquals(\"My Preference\",\n                     category1Tools.get(0).getTitle());\n        assertThat(category1Tools.get(0).getIconCss(),\n                   hasItems(\"fa\",\n                            \"fa-map\"));\n\n        category1Tools.get(0).getOnClickCommand().execute();\n\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER)));\n        verify(preferencesCentralInitializationEvent).fire(eq(new PreferencesCentralInitializationEvent(\"MyPreference\",\n                                                                                                        scopeResolutionStrategyInfoSupplier.get(),\n                                                                                                        null)));\n    }\n\n    @Test\n    public void addPreferenceWithCustomScopeParameterTest() {\n        final PreferenceScopeImpl preferenceScope = new PreferenceScopeImpl(\"all-users\",\n                                                                            \"all-users\",\n                                                                            new PreferenceScopeImpl(\"entire-application\",\n                                                                                                    \"entire-application\",\n                                                                                                    null));\n\n        adminPage.addScreen(\"screen1\",\n                            \"Screen 1\");\n        adminPage.addPreference(\"screen1\",\n                                \"MyPreference\",\n                                \"My Preference\",\n                                Sets.newHashSet(\"fa\",\n                                                \"fa-map\"),\n                                \"category1\",\n                                preferenceScope);\n\n        final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory(\"screen1\");\n\n        assertNotNull(toolsByCategory1);\n        assertEquals(1,\n                     toolsByCategory1.size());\n\n        final List<AdminTool> category1Tools = toolsByCategory1.get(\"category1\");\n        assertEquals(1,\n                     category1Tools.size());\n        assertEquals(\"My Preference\",\n                     category1Tools.get(0).getTitle());\n        assertThat(category1Tools.get(0).getIconCss(),\n                   hasItems(\"fa\",\n                            \"fa-map\"));\n\n        category1Tools.get(0).getOnClickCommand().execute();\n\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER)));\n        verify(preferencesCentralInitializationEvent).fire(eq(new PreferencesCentralInitializationEvent(\"MyPreference\",\n                                                                                                        null,\n                                                                                                        preferenceScope)));\n    }\n\n    @Test\n    public void addPreferenceWithBreadcrumbsTest() {\n        adminPage.addScreen(\"screen1\",\n                            \"Screen 1\");\n        adminPage.addPreference(\"screen1\",\n                                \"MyPreference\",\n                                \"My Preference\",\n                                Sets.newHashSet(\"fa\",\n                                                \"fa-map\"),\n                                \"category1\",\n                                AdminPageOptions.WITH_BREADCRUMBS);\n\n        final Map<String, List<AdminTool>> toolsByCategory1 = adminPage.getToolsByCategory(\"screen1\");\n\n        assertNotNull(toolsByCategory1);\n        assertEquals(1,\n                     toolsByCategory1.size());\n\n        final List<AdminTool> category1Tools = toolsByCategory1.get(\"category1\");\n        assertEquals(1,\n                     category1Tools.size());\n        assertEquals(\"My Preference\",\n                     category1Tools.get(0).getTitle());\n        assertThat(category1Tools.get(0).getIconCss(),\n                   hasItems(\"fa\",\n                            \"fa-map\"));\n\n        category1Tools.get(0).getOnClickCommand().execute();\n\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(PreferencesCentralPerspective.IDENTIFIER)));\n        verify(preferencesCentralInitializationEvent).fire(eq(new PreferencesCentralInitializationEvent(\"MyPreference\",\n                                                                                                        null,\n                                                                                                        null)));\n        verify(uberfireBreadcrumbs).clearBreadcrumbs(PreferencesCentralPerspective.IDENTIFIER);\n        verify(uberfireBreadcrumbs).addBreadCrumb(eq(PreferencesCentralPerspective.IDENTIFIER),\n                                                  any(),\n                                                  eq(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER)),\n                                                  any(Command.class));\n        verify(uberfireBreadcrumbs).addBreadCrumb(eq(PreferencesCentralPerspective.IDENTIFIER),\n                                                  anyString(),\n                                                  any(Command.class));\n    }\n\n    @Test\n    public void setDefaultScreen() {\n        adminPage.setDefaultScreen(\"screen1\");\n        assertEquals(\"screen1\",\n                     adminPage.getDefaultScreen());\n\n        adminPage.setDefaultScreen(\"screen2\");\n        assertEquals(\"screen2\",\n                     adminPage.getDefaultScreen());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/base/BasePreferenceFormTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.base;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralPreSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\nimport static org.mockito.Mockito.*;\n\npublic class BasePreferenceFormTest {\n\n    private BasePreferenceForm<Object> basePreferenceForm;\n\n    @Before\n    public void setup() {\n        basePreferenceForm = spy(getBasePreferenceForm());\n        Map<String, String> params = new HashMap<>();\n        params.put(\"id\",\n                   \"preference-id\");\n        basePreferenceForm.onStartup(new DefaultPlaceRequest(\"preferenceForm\",\n                                                             params));\n    }\n\n    @Test\n    public void initIsCalledWhenFormIdIsRequested() {\n        final BasePreferencePortable preference = mock(BasePreferencePortable.class);\n        final PreferenceHierarchyElement hierarchyElement = new PreferenceHierarchyElement();\n        hierarchyElement.setId(\"preference-id\");\n        hierarchyElement.setPortablePreference(preference);\n\n        HierarchyItemFormInitializationEvent event = new HierarchyItemFormInitializationEvent(hierarchyElement);\n        basePreferenceForm.hierarchyItemFormInitializationEvent(event);\n\n        verify(basePreferenceForm).init(preference);\n    }\n\n    @Test\n    public void initIsNotCalledWhenDifferentFormIdIsRequested() {\n        final BasePreferencePortable preference = mock(BasePreferencePortable.class);\n        final PreferenceHierarchyElement hierarchyElement = new PreferenceHierarchyElement();\n        hierarchyElement.setId(\"another-preference-id\");\n        hierarchyElement.setPortablePreference(preference);\n\n        HierarchyItemFormInitializationEvent event = new HierarchyItemFormInitializationEvent(hierarchyElement);\n        basePreferenceForm.hierarchyItemFormInitializationEvent(event);\n\n        verify(basePreferenceForm,\n               never()).init(any(BasePreferencePortable.class));\n    }\n\n    @Test\n    public void beforeSaveIsCalledWhenPreSaveEventIsObserved() {\n        PreferencesCentralPreSaveEvent event = new PreferencesCentralPreSaveEvent();\n        basePreferenceForm.preSaveEvent(event);\n\n        verify(basePreferenceForm).beforeSave();\n    }\n\n    @Test\n    public void onUndoIsCalledWhenUndoEventIsObserved() {\n        PreferencesCentralUndoChangesEvent event = new PreferencesCentralUndoChangesEvent();\n        basePreferenceForm.undoChangesEvent(event);\n\n        verify(basePreferenceForm).onUndo();\n    }\n\n    private BasePreferenceForm<Object> getBasePreferenceForm() {\n        return new BasePreferenceForm<Object>() {\n            @Override\n            public void init(final Object preference) {\n            }\n\n            @Override\n            public void beforeSave() {\n            }\n\n            @Override\n            public void onUndo() {\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/central/actions/PreferencesCentralActionsScreenTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.actions;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralActionsConfigurationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralPreSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralUndoChangesEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\npublic class PreferencesCentralActionsScreenTest {\n\n    @Mock\n    private PreferencesCentralActionsScreen.View view;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private Event<PreferencesCentralPreSaveEvent> preSaveEvent;\n\n    @Mock\n    private Event<PreferencesCentralSaveEvent> saveEvent;\n\n    @Mock\n    private Event<PreferencesCentralUndoChangesEvent> undoChangesEvent;\n\n    @Mock\n    private Event<NotificationEvent> notification;\n\n    private PreferencesCentralActionsScreen actionsScreen;\n\n    private Map<String, String> params;\n\n    @Before\n    public void setup() {\n        MockitoAnnotations.initMocks(this);\n\n        actionsScreen = new PreferencesCentralActionsScreen(view,\n                                                            placeManager,\n                                                            preSaveEvent,\n                                                            saveEvent,\n                                                            undoChangesEvent,\n                                                            notification);\n\n        params = new HashMap<>();\n        params.put(\"screen\",\n                   \"screen\");\n    }\n\n    @Test\n    public void fireSaveEventTest() {\n        actionsScreen.initEvent(new PreferencesCentralActionsConfigurationEvent(\"screen\",\n                                                                                null));\n\n        actionsScreen.fireSaveEvent();\n\n        verify(preSaveEvent).fire(any(PreferencesCentralPreSaveEvent.class));\n        verify(saveEvent).fire(any(PreferencesCentralSaveEvent.class));\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER,\n                                                             params)));\n    }\n\n    @Test\n    public void fireSaveEventWithoutAdminScreenToGoBackToTest() {\n        actionsScreen.fireSaveEvent();\n\n        verify(preSaveEvent).fire(any(PreferencesCentralPreSaveEvent.class));\n        verify(saveEvent).fire(any(PreferencesCentralSaveEvent.class));\n        verify(placeManager,\n               never()).goTo(any(PlaceRequest.class));\n    }\n\n    @Test\n    public void fireUndoEventTest() {\n        actionsScreen.initEvent(new PreferencesCentralActionsConfigurationEvent(\"screen\",\n                                                                                null));\n\n        actionsScreen.fireCancelEvent();\n\n        verify(undoChangesEvent).fire(any(PreferencesCentralUndoChangesEvent.class));\n        verify(notification).fire(any(NotificationEvent.class));\n        verify(placeManager).goTo(eq(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER,\n                                                             params)));\n    }\n\n    @Test\n    public void fireUndoEventWithoutAdminScreenToGoBackToTest() {\n        actionsScreen.fireCancelEvent();\n\n        verify(undoChangesEvent).fire(any(PreferencesCentralUndoChangesEvent.class));\n        verify(notification).fire(any(NotificationEvent.class));\n        verify(placeManager,\n               never()).goTo(any(PlaceRequest.class));\n    }\n\n    @Test\n    public void goBackToAdminPageWithPerspectiveIdentifierToGoBackToTest() {\n        actionsScreen.initEvent(new PreferencesCentralActionsConfigurationEvent(\"adminPage\",\n                                                                                \"perspective\"));\n        actionsScreen.goBackToAdminPage();\n\n        Map<String, String> params = new HashMap<>();\n        params.put(\"screen\",\n                   \"adminPage\");\n        params.put(\"perspectiveIdentifierToGoBackTo\",\n                   \"perspective\");\n        verify(placeManager).goTo(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER,\n                                                          params));\n    }\n\n    @Test\n    public void goBackToAdminPageWithoutPerspectiveIdentifierToGoBackToTest() {\n        actionsScreen.initEvent(new PreferencesCentralActionsConfigurationEvent(\"adminPage\",\n                                                                                null));\n        actionsScreen.goBackToAdminPage();\n\n        Map<String, String> params = new HashMap<>();\n        params.put(\"screen\",\n                   \"adminPage\");\n        verify(placeManager).goTo(new DefaultPlaceRequest(AdminPagePerspective.IDENTIFIER,\n                                                          params));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/central/form/DefaultPreferenceFormTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.form;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldOption;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.preferences.shared.PropertyFormOptions;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\nimport org.uberfire.preferences.shared.bean.mock.PortablePreferenceMock;\nimport org.uberfire.preferences.shared.bean.mock.PortablePreferenceMockPortableGeneratedImpl;\nimport org.uberfire.preferences.shared.impl.validation.NotEmptyValidator;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.*;\n\npublic class DefaultPreferenceFormTest {\n\n    private BasePreferencePortable<PortablePreferenceMock> preference;\n\n    private DefaultPreferenceForm.View formView;\n\n    private DefaultPreferenceForm formPresenter;\n\n    @Before\n    public void setup() {\n        final TranslationService translationService = mock(TranslationService.class);\n        doAnswer(invocationOnMock -> invocationOnMock.getArguments()[0])\n                .when(translationService).format(any(), anyVararg());\n\n        preference = spy(new PortablePreferenceMockPortableGeneratedImpl());\n        formView = mock(DefaultPreferenceForm.View.class);\n        formPresenter = new DefaultPreferenceForm(formView,\n                                                  translationService);\n\n        Map<String, String> params = new HashMap<>();\n        params.put(\"id\",\n                   \"preference-id\");\n        formPresenter.onStartup(new DefaultPlaceRequest(\"preferenceForm\",\n                                                        params));\n    }\n\n    @Test\n    public void testFormShouldBeInitializedWhenEventWithSameIdIsObserved() {\n        fireInitializationEvent(\"preference-id\");\n        verify(formView).init(formPresenter);\n    }\n\n    @Test\n    public void testFormShouldNotBeInitializedWhenEventWithDifferentIdIsObserved() {\n        fireInitializationEvent(\"another-preference-id\");\n        verify(formView,\n               never()).init(formPresenter);\n    }\n\n    @Test\n    public void testPropertyChangedInThisFormShouldSetThePreferenceProperty() {\n        fireInitializationEvent(\"preference-id\");\n        firePropertyChangedEvent(\"preference-id\");\n\n        verify(preference).set(\"property\",\n                               \"newValue\");\n    }\n\n    @Test\n    public void testPropertyChangedInAnotherFormShouldNotSetThePreferenceProperty() {\n        fireInitializationEvent(\"preference-id\");\n        firePropertyChangedEvent(\"another-preference-id\");\n\n        verify(preference,\n               never()).set(\"property\",\n                            \"newValue\");\n    }\n\n    @Test\n    public void testCreateFieldInfo() {\n        fireInitializationEvent(\"preference-id\");\n\n        final PropertyEditorFieldInfo fieldInfo = formPresenter.createFieldInfo(\"property\",\n                                                                                PropertyEditorType.TEXT,\n                                                                                \"some-text\");\n\n        assertEquals(\"property\",\n                     fieldInfo.getKey());\n        assertEquals(1,\n                     fieldInfo.getValidators().size());\n        assertEquals(\"propertyBundleKey\",\n                     fieldInfo.getLabel());\n        assertEquals(\"propertyHelpBundleKey\",\n                     fieldInfo.getHelpText());\n        assertEquals(1,\n                     fieldInfo.getOptions().size());\n        assertEquals(PropertyEditorFieldOption.DISABLED,\n                     fieldInfo.getOptions().get(0));\n    }\n    \n    @Test\n    public void testCreateFieldInfoCombo() {\n        fireInitializationEvent(\"preference-id\");\n\n        final PropertyEditorFieldInfo fieldInfo = formPresenter.createFieldInfo(\"property\",\n                                                                                PropertyEditorType.COMBO,\n                                                                                EnumForComboTest.val1);\n\n        assertEquals(\"property\",\n                     fieldInfo.getKey());\n        assertEquals(1,\n                     fieldInfo.getValidators().size());\n        assertEquals(\"propertyBundleKey\",\n                     fieldInfo.getLabel());\n        assertEquals(\"propertyHelpBundleKey\",\n                     fieldInfo.getHelpText());\n        assertEquals(1,\n                     fieldInfo.getOptions().size());\n        assertEquals(PropertyEditorFieldOption.DISABLED,\n                     fieldInfo.getOptions().get(0));\n        \n        assertEquals(EnumForComboTest.val1.name(),\n                fieldInfo.getCurrentStringValue());\n        \n        assertEquals(EnumForComboTest.values().length, \n               fieldInfo.getComboValues().size());\n        \n        assertTrue(fieldInfo.getComboValues()\n                .contains(EnumForComboTest.val1.name()));\n        assertTrue(fieldInfo.getComboValues()\n                .contains(EnumForComboTest.val2.name()));\n      \n    }\n\n    private void firePropertyChangedEvent(final String eventId) {\n        final PropertyEditorFieldInfo propertyInfo = mock(PropertyEditorFieldInfo.class);\n        doReturn(eventId).when(propertyInfo).getEventId();\n        doReturn(\"property\").when(propertyInfo).getKey();\n\n        formPresenter.propertyChanged(new PropertyEditorChangeEvent(propertyInfo,\n                                                                    \"newValue\"));\n    }\n\n    private void fireInitializationEvent(final String eventId) {\n        PreferenceHierarchyElement<PortablePreferenceMock> preferenceHierarchyElement = new PreferenceHierarchyElement();\n        preferenceHierarchyElement.setId(eventId);\n        preferenceHierarchyElement.setPortablePreference(preference);\n        preferenceHierarchyElement.setBundleKey(\"bundleKey\");\n        preferenceHierarchyElement.addPropertyBundleKey(\"property\",\n                                                        \"propertyBundleKey\");\n        preferenceHierarchyElement.addPropertyHelpBundleKey(\"property\",\n                                                            \"propertyHelpBundleKey\");\n        final PropertyFormOptions[] propertyFormOptions = new PropertyFormOptions[1];\n        propertyFormOptions[0] = PropertyFormOptions.DISABLED;\n        preferenceHierarchyElement.addPropertyFormOptions(\"property\",\n                                                          propertyFormOptions);\n\n        HierarchyItemFormInitializationEvent event = new HierarchyItemFormInitializationEvent(preferenceHierarchyElement);\n\n        formPresenter.hierarchyItemFormInitializationEvent(event);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/central/form/EnumForComboTest.java",
    "content": "package org.uberfire.ext.preferences.client.central.form;\n\npublic enum EnumForComboTest {\n    val1, val2;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/central/screen/PreferencesRootScreenTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.screen;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralNavBarScreen;\nimport org.uberfire.ext.preferences.client.central.actions.PreferencesCentralActionsScreen;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemSelectedEvent;\nimport org.uberfire.ext.preferences.client.utils.PreferenceFormBeansInfo;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PreferencesRootScreenTest {\n\n    @Mock\n    private PreferencesRootScreen.View view;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private PreferenceFormBeansInfo preferenceFormBeansInfo;\n\n    @Mock\n    private Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent;\n\n    @InjectMocks\n    private PreferencesRootScreen screen;\n\n    @Before\n    public void setup() {\n        doReturn(mock(HTMLElement.class)).when(view).getNavbarContainer();\n        doReturn(mock(HTMLElement.class)).when(view).getActionsContainer();\n    }\n\n    @Test\n    public void setupTest() {\n        screen.setup();\n\n        verify(placeManager).goTo(new DefaultPlaceRequest(PreferencesCentralNavBarScreen.IDENTIFIER),\n                                  view.getNavbarContainer());\n        verify(placeManager).goTo(new DefaultPlaceRequest(PreferencesCentralActionsScreen.IDENTIFIER),\n                                  view.getActionsContainer());\n    }\n\n    @Test\n    public void onCloseTest() {\n        screen.onClose();\n\n        verify(placeManager).closePlace(PreferencesCentralNavBarScreen.IDENTIFIER);\n        verify(placeManager).closePlace(PreferencesCentralActionsScreen.IDENTIFIER);\n    }\n\n    @Test\n    public void hierarchyItemSelectedEventWithoutPreviouslyOpenedPreference() {\n        final HierarchyItemSelectedEvent event = mock(HierarchyItemSelectedEvent.class);\n        doReturn(mock(BasePreferencePortable.class)).when(event).getPreference();\n        doReturn(mock(PreferenceHierarchyElement.class)).when(event).getHierarchyElement();\n\n        screen.hierarchyItemSelectedEvent(event);\n\n        verify(placeManager,\n               never()).closePlace(any(PlaceRequest.class));\n        verify(placeManager).goTo(any(PlaceRequest.class),\n                                  Mockito.<HTMLElement>any());\n        verify(hierarchyItemFormInitializationEvent).fire(any());\n    }\n\n    @Test\n    public void hierarchyItemSelectedEventWithPreviouslyOpenedPreference() {\n        hierarchyItemSelectedEventWithoutPreviouslyOpenedPreference();\n        Mockito.reset(placeManager,\n                      hierarchyItemFormInitializationEvent);\n\n        final HierarchyItemSelectedEvent event = mock(HierarchyItemSelectedEvent.class);\n        doReturn(mock(BasePreferencePortable.class)).when(event).getPreference();\n        doReturn(mock(PreferenceHierarchyElement.class)).when(event).getHierarchyElement();\n\n        screen.hierarchyItemSelectedEvent(event);\n\n        verify(placeManager).closePlace(any(PlaceRequest.class));\n        verify(placeManager).goTo(any(PlaceRequest.class),\n                                  Mockito.<HTMLElement>any());\n        verify(hierarchyItemFormInitializationEvent).fire(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/central/tree/TreeHierarchyStructurePresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.central.tree;\n\nimport java.util.ArrayList;\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.preferences.client.event.HierarchyItemFormInitializationEvent;\nimport org.uberfire.ext.preferences.client.event.PreferencesCentralSaveEvent;\nimport org.uberfire.ext.preferences.client.utils.PreferenceFormBeansInfo;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanServerStore;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyCollection;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TreeHierarchyStructurePresenterTest {\n\n    @Mock\n    private TreeHierarchyStructurePresenter.View view;\n\n    @Mock\n    private PreferenceBeanServerStore preferenceBeanServerStore;\n    private Caller<PreferenceBeanServerStore> preferenceBeanServerStoreCaller;\n\n    @Mock\n    private ManagedInstance<TreeHierarchyInternalItemPresenter> treeHierarchyInternalItemPresenterProvider;\n\n    @Mock\n    private ManagedInstance<TreeHierarchyLeafItemPresenter> treeHierarchyLeafItemPresenterProvider;\n\n    @Mock\n    private Event<HierarchyItemFormInitializationEvent> hierarchyItemFormInitializationEvent;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private PreferenceBeanStore store;\n\n    @Mock\n    private Event<NotificationEvent> notification;\n\n    @Mock\n    private PreferenceFormBeansInfo preferenceFormBeansInfo;\n\n    private TreeHierarchyStructurePresenter presenter;\n\n    @Before\n    public void setup() {\n        preferenceBeanServerStoreCaller = new CallerMock<>(preferenceBeanServerStore);\n\n        presenter = spy(new TreeHierarchyStructurePresenter(view,\n                                                            preferenceBeanServerStoreCaller,\n                                                            treeHierarchyInternalItemPresenterProvider,\n                                                            treeHierarchyLeafItemPresenterProvider,\n                                                            hierarchyItemFormInitializationEvent,\n                                                            placeManager,\n                                                            store,\n                                                            notification,\n                                                            preferenceFormBeansInfo));\n\n        doNothing().when(presenter).setupHierarchyItem(any());\n        doReturn(new ArrayList<>()).when(presenter).getPreferencesToSave(any());\n    }\n\n    @Test\n    public void initWithCustomScopeTest() {\n        final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategyInfo = mock(PreferenceScopeResolutionStrategyInfo.class);\n\n        presenter.init(\"identifier\",\n                       customScopeResolutionStrategyInfo,\n                       null);\n\n        verify(preferenceBeanServerStore).buildHierarchyStructureForPreference(\"identifier\",\n                                                                               customScopeResolutionStrategyInfo);\n        verify(presenter).setupHierarchyItem(any());\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void initWithDefaultScopeResolutionStrategyTest() {\n        presenter.init(\"identifier\",\n                       null,\n                       null);\n\n        verify(preferenceBeanServerStore).buildHierarchyStructureForPreference(\"identifier\");\n        verify(presenter).setupHierarchyItem(any());\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void saveWithCustomScopeTest() {\n        final PreferenceScope scope = mock(PreferenceScope.class);\n        final PreferencesCentralSaveEvent saveEvent = mock(PreferencesCentralSaveEvent.class);\n\n        presenter.init(\"identifier\",\n                       null,\n                       scope);\n\n        presenter.saveEvent(saveEvent);\n\n        verify(store).save(anyCollection(),\n                           eq(scope),\n                           any(),\n                           any());\n    }\n\n    @Test\n    public void saveWithCustomScopeResolutionStrategyTest() {\n        final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategyInfo = mock(PreferenceScopeResolutionStrategyInfo.class);\n        final PreferencesCentralSaveEvent saveEvent = mock(PreferencesCentralSaveEvent.class);\n\n        presenter.init(\"identifier\",\n                       customScopeResolutionStrategyInfo,\n                       null);\n\n        presenter.saveEvent(saveEvent);\n\n        verify(store).save(anyCollection(),\n                           eq(customScopeResolutionStrategyInfo),\n                           any(),\n                           any());\n    }\n\n    @Test\n    public void saveWithDefaultScopeResolutionStrategyTest() {\n        final PreferencesCentralSaveEvent saveEvent = mock(PreferencesCentralSaveEvent.class);\n\n        presenter.init(\"identifier\",\n                       null,\n                       null);\n\n        presenter.saveEvent(saveEvent);\n\n        verify(store).save(anyCollection(),\n                           any(),\n                           any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-preferences-ui-client/src/test/java/org/uberfire/ext/preferences/client/utils/PreferenceFormBeansInfoTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.client.utils;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.inject.Named;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.ext.preferences.client.annotations.PreferenceForm;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PreferenceFormBeansInfoTest {\n\n    @Mock\n    private SyncBeanManager syncBeanManager;\n\n    @Mock\n    private ActivityBeansCache activityBeansCache;\n\n    private ActivityBeansInfo activityBeansInfo;\n\n    private PreferenceFormBeansInfo preferenceFormBeansInfo;\n\n    @Before\n    public void setup() {\n        activityBeansInfo = new ActivityBeansInfo(syncBeanManager, activityBeansCache);\n        preferenceFormBeansInfo = new PreferenceFormBeansInfo(activityBeansInfo);\n        when(syncBeanManager.lookupBeans(WorkbenchScreenActivity.class))\n                .thenReturn(generateBeansList());\n    }\n\n    @Test\n    public void getPreferenceFormForTest() {\n        assertEquals(\"MyPreference1Form\",\n                     preferenceFormBeansInfo.getPreferenceFormFor(\"MyPreference1\"));\n        assertEquals(\"MyPreference2Form\",\n                     preferenceFormBeansInfo.getPreferenceFormFor(\"MyPreference2\"));\n        assertEquals(\"MyPreference3Form\",\n                     preferenceFormBeansInfo.getPreferenceFormFor(\"MyPreference3\"));\n    }\n\n    private Collection<SyncBeanDef<WorkbenchScreenActivity>> generateBeansList() {\n        Collection<SyncBeanDef<WorkbenchScreenActivity>> beans = new ArrayList<SyncBeanDef<WorkbenchScreenActivity>>();\n\n        beans.add(generateBeanDef(null));\n        beans.add(generateBeanDef(\"MyPreference1\"));\n        beans.add(generateBeanDef(\"MyPreference2\"));\n        beans.add(generateBeanDef(\"MyPreference3\"));\n\n        return beans;\n    }\n\n    private SyncBeanDef<WorkbenchScreenActivity> generateBeanDef(final String preferenceIdentifier) {\n        return new SyncBeanDef<WorkbenchScreenActivity>() {\n            @Override\n            public Class<WorkbenchScreenActivity> getType() {\n                return null;\n            }\n\n            @Override\n            public Class<?> getBeanClass() {\n                return null;\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return null;\n            }\n\n            @Override\n            public WorkbenchScreenActivity getInstance() {\n                return null;\n            }\n\n            @Override\n            public WorkbenchScreenActivity newInstance() {\n                return null;\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n                final HashSet<Annotation> annotations = new HashSet<Annotation>();\n\n                if (preferenceIdentifier != null) {\n                    annotations.add(new PreferenceForm() {\n                        @Override\n                        public Class<? extends Annotation> annotationType() {\n                            return PreferenceForm.class;\n                        }\n\n                        @Override\n                        public String value() {\n                            return preferenceIdentifier;\n                        }\n                    });\n\n                    annotations.add(new Named() {\n                        @Override\n                        public Class<? extends Annotation> annotationType() {\n                            return Named.class;\n                        }\n\n                        @Override\n                        public String value() {\n                            return preferenceIdentifier + \"Form\";\n                        }\n                    });\n                }\n\n                return annotations;\n            }\n\n            @Override\n            public boolean matches(Set<Annotation> annotations) {\n                return false;\n            }\n\n            @Override\n            public String getName() {\n                if (preferenceIdentifier != null) {\n                    return preferenceIdentifier + \"Form\";\n                } else {\n                    return null;\n                }\n            }\n\n            @Override\n            public boolean isActivated() {\n                return false;\n            }\n\n            @Override\n            public boolean isAssignableTo(Class<?> type) {\n                return WorkbenchScreenActivity.class.equals(type);\n            }\n        };\n    }\n\n    class MyPreference1 implements BasePreference<MyPreference1> {\n\n    }\n\n    class MyPreference2 implements BasePreference<MyPreference2> {\n\n    }\n\n    class MyPreference3 implements BasePreference<MyPreference3> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-runtime-plugins</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Runtime Plugins</name>\n\n  <modules>\n    <module>uberfire-runtime-plugins-api</module>\n    <module>uberfire-runtime-plugins-backend</module>\n    <module>uberfire-runtime-plugins-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-runtime-plugins</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-runtime-plugins-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Runtime PlugIns API</name>\n  <description>Uberfire Runtime PlugIns API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/BasePluginEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.rpc.SessionInfo;\n\npublic abstract class BasePluginEvent {\n\n    private Plugin plugin;\n    private SessionInfo sessionInfo;\n\n    public BasePluginEvent(@MapsTo(\"plugin\") final Plugin plugin,\n                           @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        this.plugin = plugin;\n        this.sessionInfo = sessionInfo;\n    }\n\n    public Plugin getPlugin() {\n        return plugin;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/MediaAdded.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Media;\n\n@Portable\npublic class MediaAdded {\n\n    private String pluginName;\n    private Media media;\n\n    public MediaAdded(@MapsTo(\"pluginName\") final String pluginName,\n                      @MapsTo(\"media\") final Media media) {\n        this.pluginName = pluginName;\n        this.media = media;\n    }\n\n    public String getPluginName() {\n        return pluginName;\n    }\n\n    public Media getMedia() {\n        return media;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/MediaDeleted.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Media;\n\n@Portable\npublic class MediaDeleted {\n\n    private String pluginName;\n    private Media media;\n\n    public MediaDeleted(@MapsTo(\"pluginName\") final String pluginName,\n                        @MapsTo(\"media\") final Media media) {\n        this.pluginName = pluginName;\n        this.media = media;\n    }\n\n    public String getPluginName() {\n        return pluginName;\n    }\n\n    public Media getMedia() {\n        return media;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/NewPluginRegistered.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.PluginType;\n\n@Portable\npublic class NewPluginRegistered {\n\n    private final String name;\n\n    private final PluginType type;\n\n    public NewPluginRegistered(@MapsTo(\"name\") final String name,\n                               @MapsTo(\"type\") final PluginType type) {\n        this.name = name;\n        this.type = type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public PluginType getType() {\n        return type;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/PluginAdded.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.rpc.SessionInfo;\n\n@Portable\npublic class PluginAdded extends BasePluginEvent {\n\n    public PluginAdded(@MapsTo(\"plugin\") final Plugin plugin,\n                       @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(plugin,\n              sessionInfo);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/PluginDeleted.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.rpc.SessionInfo;\n\n@Portable\npublic class PluginDeleted extends BasePluginEvent {\n\n    public PluginDeleted(@MapsTo(\"plugin\") Plugin plugin,\n                         @MapsTo(\"sessionInfo\") SessionInfo sessionInfo) {\n        super(plugin,\n              sessionInfo);\n    }\n\n    public String getPluginName() {\n        return getPlugin().getName();\n    }\n\n    public PluginType getPluginType() {\n        return getPlugin().getType();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/PluginRenamed.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\n@Portable\npublic class PluginRenamed extends BasePluginEvent {\n\n    private String oldPluginName;\n\n    public PluginRenamed(@MapsTo(\"oldPluginName\") final String oldPluginName,\n                         @MapsTo(\"plugin\") final Plugin plugin,\n                         @MapsTo(\"sessionInfo\") final SessionInfo sessionInfo) {\n        super(plugin,\n              sessionInfo);\n        this.oldPluginName = checkNotEmpty(\"oldPluginName\",\n                                           oldPluginName);\n    }\n\n    public String getOldPluginName() {\n        return oldPluginName;\n    }\n\n    public PluginType getOldPluginType() {\n        return getPlugin().getType();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/PluginSaved.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.rpc.SessionInfo;\n\n@Portable\npublic class PluginSaved extends BasePluginEvent {\n\n    public PluginSaved(@MapsTo(\"plugin\") Plugin plugin,\n                       @MapsTo(\"sessionInfo\") SessionInfo sessionInfo) {\n        super(plugin,\n              sessionInfo);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/event/PluginUnregistered.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.plugin.model.PluginType;\n\n@Portable\npublic class PluginUnregistered {\n\n    private final String name;\n\n    private final PluginType type;\n\n    public PluginUnregistered(@MapsTo(\"name\") final String name,\n                              @MapsTo(\"type\") final PluginType type) {\n        this.name = name;\n        this.type = type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public PluginType getType() {\n        return type;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/exception/PluginAlreadyExists.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.exception;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PluginAlreadyExists extends RuntimeException {\n\n    public PluginAlreadyExists() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/Activity.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Activity {\n\n    private String name;\n    private PluginType type;\n\n    public Activity() {\n    }\n\n    public Activity(final String name,\n                    final PluginType type) {\n        this.name = name;\n        this.type = type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public PluginType getType() {\n        return type;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Activity)) {\n            return false;\n        }\n\n        return name.equals(((Activity) o).name);\n    }\n\n    @Override\n    public int hashCode() {\n        return ~~name.hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/CodeType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum CodeType {\n    MAIN,\n    ON_OPEN,\n    ON_FOCUS,\n    ON_LOST_FOCUS,\n    ON_MAY_CLOSE,\n    ON_CLOSE,\n    ON_STARTUP,\n    ON_SHUTDOWN,\n    ON_RENAME,\n    ON_DELETE,\n    ON_COPY,\n    ON_UPDATE,\n    ON_CONCURRENT_UPDATE,\n    ON_CONCURRENT_DELETE,\n    ON_CONCURRENT_RENAME,\n    ON_CONCURRENT_COPY,\n    TITLE,\n    RESOURCE_TYPE,\n    PRIORITY,\n    BODY_HEIGHT,\n    INTERCEPTION_POINTS,\n    PANEL_TYPE;\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/DynamicMenu.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class DynamicMenu extends Plugin {\n\n    private Collection<DynamicMenuItem> menuItems;\n\n    public DynamicMenu(@MapsTo(\"name\") final String name,\n                       @MapsTo(\"type\") final PluginType type,\n                       @MapsTo(\"path\") final Path path,\n                       @MapsTo(\"menuItems\") final Collection<DynamicMenuItem> menuItems) {\n        super(name,\n              type,\n              path);\n        this.menuItems = menuItems;\n    }\n\n    public Collection<DynamicMenuItem> getMenuItems() {\n        return menuItems;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DynamicMenu)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        DynamicMenu that = (DynamicMenu) o;\n\n        if (menuItems != null ? !menuItems.equals(that.menuItems) : that.menuItems != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        result = 31 * result + (menuItems != null ? menuItems.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/DynamicMenuItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DynamicMenuItem {\n\n    private String activityId;\n    private String menuLabel;\n\n    public DynamicMenuItem() {\n    }\n\n    public DynamicMenuItem(String activityId,\n                           String menuLabel) {\n        this.activityId = activityId;\n        this.menuLabel = menuLabel;\n    }\n\n    public String getActivityId() {\n        return activityId;\n    }\n\n    public void setActivityId(String activityId) {\n        this.activityId = activityId;\n    }\n\n    public String getMenuLabel() {\n        return menuLabel;\n    }\n\n    public void setMenuLabel(String menuLabel) {\n        this.menuLabel = menuLabel;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DynamicMenuItem)) {\n            return false;\n        }\n\n        DynamicMenuItem that = (DynamicMenuItem) o;\n\n        if (activityId != null ? !activityId.equals(that.activityId) : that.activityId != null) {\n            return false;\n        }\n        if (menuLabel != null ? !menuLabel.equals(that.menuLabel) : that.menuLabel != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = activityId != null ? activityId.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (menuLabel != null ? menuLabel.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/Framework.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum Framework {\n    NONE(\"\"),\n    ANGULAR(\"angularjs\"),\n    KNOCKOUT(\"ko\");\n\n    private final String type;\n\n    Framework(String type) {\n        this.type = type;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/Language.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum Language {\n    JAVASCRIPT,\n    COFFEESCRIPT\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/LayoutEditorModel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class LayoutEditorModel extends Plugin {\n\n    private String layoutEditorModel;\n    private boolean emptyLayout;\n\n    public LayoutEditorModel() {\n    }\n\n    public LayoutEditorModel(final String name,\n                             final PluginType type,\n                             final Path path,\n                             final String layoutEditorModel) {\n        super(name,\n              type,\n              path);\n        this.layoutEditorModel = layoutEditorModel;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof LayoutEditorModel)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        LayoutEditorModel that = (LayoutEditorModel) o;\n\n        if (layoutEditorModel != null ? !layoutEditorModel.equals(that.layoutEditorModel) : that.layoutEditorModel != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        if (layoutEditorModel != null) {\n            result = 31 * result + layoutEditorModel.hashCode();\n        }\n        return result;\n    }\n\n    public String getLayoutEditorModel() {\n        return layoutEditorModel;\n    }\n\n    public LayoutEditorModel emptyLayout() {\n        this.emptyLayout = true;\n        return this;\n    }\n\n    public boolean isEmptyLayout() {\n        return emptyLayout;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/Media.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class Media {\n\n    private String externalURI;\n    private Path path;\n\n    public Media() {\n    }\n\n    public Media(final String externalURI,\n                 final Path path) {\n        this.externalURI = externalURI;\n        this.path = path;\n    }\n\n    public String getPreviewURI() {\n        return externalURI + \"?preview\";\n    }\n\n    public String getExternalURI() {\n        return externalURI;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Media)) {\n            return false;\n        }\n\n        Media media = (Media) o;\n\n        if (externalURI != null ? !externalURI.equals(media.externalURI) : media.externalURI != null) {\n            return false;\n        }\n        if (path != null ? !path.equals(media.path) : media.path != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = externalURI != null ? externalURI.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (path != null ? path.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/Plugin.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class Plugin extends Activity {\n\n    public static final String FILE_EXT = \".plugin\";\n    private Path path;\n\n    public Plugin() {\n    }\n\n    public Plugin(final String name,\n                  final PluginType type,\n                  final Path path) {\n        super(name,\n              type);\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Plugin)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        Plugin plugin = (Plugin) o;\n\n        if (path != null ? !path.equals(plugin.path) : plugin.path != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        result = 31 * result + (path != null ? path.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/PluginContent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class PluginContent extends PluginSimpleContent {\n\n    private Set<Media> mediaLibrary;\n\n    public PluginContent() {\n    }\n\n    public PluginContent(final String name,\n                         final PluginType type,\n                         final Path path,\n                         final String template,\n                         final String css,\n                         final Map<CodeType, String> codeMap,\n                         final Set<Framework> frameworks,\n                         final Language language,\n                         final Set<Media> mediaLibrary) {\n        super(name,\n              type,\n              path,\n              template,\n              css,\n              codeMap,\n              frameworks,\n              language);\n        this.mediaLibrary = mediaLibrary;\n    }\n\n    public Set<Media> getMediaLibrary() {\n        return mediaLibrary;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PluginContent)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        PluginContent that = (PluginContent) o;\n\n        if (mediaLibrary != null ? !mediaLibrary.equals(that.mediaLibrary) : that.mediaLibrary != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        result = 31 * result + (mediaLibrary != null ? mediaLibrary.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/PluginSimpleContent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class PluginSimpleContent extends Plugin {\n\n    private String template;\n    private String css;\n    private Map<CodeType, String> codeMap;\n    private Set<Framework> frameworks = new HashSet<Framework>();\n    private Language language;\n\n    public PluginSimpleContent() {\n    }\n\n    public PluginSimpleContent(final String name,\n                               final PluginType type,\n                               final Path path,\n                               final String template,\n                               final String css,\n                               final Map<CodeType, String> codeMap,\n                               final Set<Framework> frameworks,\n                               final Language language) {\n        super(name,\n              type,\n              path);\n        this.template = template;\n        this.css = css;\n        this.codeMap = codeMap;\n        this.frameworks = frameworks;\n        this.language = language;\n    }\n\n    public PluginSimpleContent(final PluginSimpleContent pluginContent,\n                               final String template,\n                               final String css,\n                               final Map<CodeType, String> codeMap,\n                               final Collection<Framework> frameworks,\n                               final Language language) {\n        super(pluginContent.getName(),\n              pluginContent.getType(),\n              pluginContent.getPath());\n        this.codeMap = new HashMap<CodeType, String>(pluginContent.getCodeMap() != null ? pluginContent.getCodeMap() : Collections.<CodeType, String>emptyMap());\n        if (codeMap != null && !codeMap.isEmpty()) {\n            for (final Map.Entry<CodeType, String> codeTypeStringEntry : codeMap.entrySet()) {\n                this.codeMap.put(codeTypeStringEntry.getKey(),\n                                 codeTypeStringEntry.getValue());\n            }\n        }\n\n        if (frameworks != null) {\n            this.frameworks.clear();\n            this.frameworks.addAll(frameworks);\n        }\n\n        this.language = pluginContent.getLanguage();\n        if (language != null) {\n            this.language = language;\n        }\n\n        this.template = pluginContent.getTemplate();\n        if (template != null) {\n            this.template = template;\n        }\n\n        this.css = pluginContent.getCss();\n        if (css != null) {\n            this.css = css;\n        }\n    }\n\n    public PluginSimpleContent(final PluginSimpleContent pluginContent,\n                               final String template,\n                               final Map<CodeType, String> codeMap) {\n        super(pluginContent.getName(),\n              pluginContent.getType(),\n              pluginContent.getPath());\n        this.codeMap = new HashMap<CodeType, String>(pluginContent.getCodeMap() != null ? pluginContent.getCodeMap() : Collections.<CodeType, String>emptyMap());\n        if (codeMap != null && !codeMap.isEmpty()) {\n            for (final Map.Entry<CodeType, String> codeTypeStringEntry : codeMap.entrySet()) {\n                this.codeMap.put(codeTypeStringEntry.getKey(),\n                                 codeTypeStringEntry.getValue());\n            }\n        }\n        this.template = pluginContent.getTemplate();\n        if (template != null) {\n            this.template = template;\n        }\n        this.css = pluginContent.getCss();\n        this.frameworks = new HashSet<Framework>(pluginContent.getFrameworks() != null ? pluginContent.getFrameworks() : Collections.<Framework>emptyList());\n        this.language = pluginContent.getLanguage();\n    }\n\n    public String getTemplate() {\n        return template;\n    }\n\n    public String getCss() {\n        return css;\n    }\n\n    public Map<CodeType, String> getCodeMap() {\n        return codeMap;\n    }\n\n    public Collection<Framework> getFrameworks() {\n        return frameworks;\n    }\n\n    public Language getLanguage() {\n        return language;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PluginSimpleContent)) {\n            return false;\n        }\n        if (!super.equals(o)) {\n            return false;\n        }\n\n        PluginSimpleContent that = (PluginSimpleContent) o;\n\n        if (codeMap != null ? !codeMap.equals(that.codeMap) : that.codeMap != null) {\n            return false;\n        }\n        if (css != null ? !css.equals(that.css) : that.css != null) {\n            return false;\n        }\n        if (frameworks != null ? !frameworks.equals(that.frameworks) : that.frameworks != null) {\n            return false;\n        }\n        if (language != that.language) {\n            return false;\n        }\n        if (template != null ? !template.equals(that.template) : that.template != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = super.hashCode();\n        result = ~~result;\n        result = 31 * result + (template != null ? template.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (css != null ? css.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (codeMap != null ? codeMap.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (frameworks != null ? frameworks.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (language != null ? language.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/PluginType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum PluginType {\n    DEFAULT,\n    PERSPECTIVE,\n    PERSPECTIVE_LAYOUT,\n    SCREEN,\n    EDITOR,\n    SPLASH,\n    DYNAMIC_MENU\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/model/RuntimePlugin.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.model;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RuntimePlugin {\n\n    private String style;\n    private String script;\n\n    public RuntimePlugin(@MapsTo(\"style\") final String style,\n                         @MapsTo(\"script\") final String script) {\n        this.style = style;\n        this.script = script;\n    }\n\n    public String getStyle() {\n        return style;\n    }\n\n    public String getScript() {\n        return script;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof RuntimePlugin)) {\n            return false;\n        }\n\n        RuntimePlugin that = (RuntimePlugin) o;\n\n        if (script != null ? !script.equals(that.script) : that.script != null) {\n            return false;\n        }\n        if (style != null ? !style.equals(that.style) : that.style != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = style != null ? style.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (script != null ? script.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/service/PluginServices.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.service;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\n\n@Remote\npublic interface PluginServices extends SupportsDelete,\n                                        SupportsCopy,\n                                        SupportsSaveAndRename<Plugin, DefaultMetadata> {\n\n    String getMediaServletURI();\n\n    Collection<RuntimePlugin> listRuntimePlugins();\n\n    Collection<RuntimePlugin> listPluginRuntimePlugins(final org.uberfire.backend.vfs.Path pluginPath);\n\n    Collection<Plugin> listPlugins();\n\n    Collection<Plugin> listPlugins(final PluginType type);\n\n    Plugin createNewPlugin(final String name,\n                           final PluginType type);\n\n    PluginContent getPluginContent(final Path path);\n\n    void deleteMedia(final Media media);\n\n    DynamicMenu getDynamicMenuContent(final Path path);\n\n    Path save(final Plugin plugin,\n              final String commitMessage);\n\n    LayoutEditorModel getLayoutEditor(Path path,\n                                      PluginType pluginType);\n\n    Path saveMenu(final DynamicMenu menu,\n                  final String commitMessage);\n\n    Path saveLayout(LayoutEditorModel layoutContent,\n                    String commitMessage);\n\n    Collection<DynamicMenu> listDynamicMenus();\n\n    Collection<LayoutEditorModel> listLayoutEditor(PluginType pluginType);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/BasePluginResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic abstract class BasePluginResourceTypeDefinition implements ResourceTypeDefinition {\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public int getPriority() {\n        return Integer.MAX_VALUE;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*/\" + getSuffix();\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.toURI().endsWith(getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/DynamicMenuResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class DynamicMenuResourceTypeDefinition extends BasePluginResourceTypeDefinition {\n\n    private Category category;\n\n    public DynamicMenuResourceTypeDefinition() {\n    }\n\n    @Inject\n    public DynamicMenuResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"dynamic menu\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Dynamic Menu\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"/\" + PluginType.DYNAMIC_MENU.toString().toLowerCase() + \".plugin\";\n    }\n\n    @Override\n    public Category getCategory() {\n        return category;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/EditorPluginResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class EditorPluginResourceTypeDefinition extends BasePluginResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public EditorPluginResourceTypeDefinition() {\n    }\n\n    public EditorPluginResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"editor plugin\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Editor plugin\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"/\" + PluginType.EDITOR.toString().toLowerCase() + \".plugin\";\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/PerspectiveLayoutPluginResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class PerspectiveLayoutPluginResourceTypeDefinition extends BasePluginResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public PerspectiveLayoutPluginResourceTypeDefinition() {\n    }\n\n    public PerspectiveLayoutPluginResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"perspective plugin\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Perspective plugin\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"/\" + PluginType.PERSPECTIVE_LAYOUT.toString().toLowerCase() + \".plugin\";\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/ScreenPluginResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class ScreenPluginResourceTypeDefinition extends BasePluginResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public ScreenPluginResourceTypeDefinition() {\n    }\n\n    public ScreenPluginResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"screen plugin\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Screen plugin\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"/\" + PluginType.SCREEN.toString().toLowerCase() + \".plugin\";\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/SplashPluginResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic class SplashPluginResourceTypeDefinition extends BasePluginResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public SplashPluginResourceTypeDefinition() {\n    }\n\n    public SplashPluginResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"splash plugin\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"SplashScreen plugin\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"/\" + PluginType.SPLASH.toString().toLowerCase() + \".plugin\";\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/TagsConverterUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\n\npublic class TagsConverterUtil {\n\n    public static final String LAYOUT_PROPERTY = \"LAYOUT_TAGS\";\n    private static final String SEPARATOR = \"|\";\n\n    public static String convertTagsToString(List<String> tagsList) {\n        String tags = \"\";\n        for (String tag : tagsList) {\n            tags = tags + tag + SEPARATOR;\n        }\n        return tags;\n    }\n\n    public static List<String> convertTagStringToTag(String strTags) {\n        List<String> tags = new ArrayList<String>();\n        if (strTags != null && !strTags.isEmpty()) {\n            tags.addAll(Arrays.asList(strTags.split(\"\\\\s*\\\\|\\\\s*\")));\n        }\n        return tags;\n    }\n\n    public static List<String> extractTags(Map<String, String> layoutProperties) {\n        String tagsStr = layoutProperties.get(LAYOUT_PROPERTY);\n        return convertTagStringToTag(tagsStr);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/java/org/uberfire/ext/plugin/type/TypeConverterUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.type;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\npublic final class TypeConverterUtil {\n\n    private static final ScreenPluginResourceTypeDefinition screenDefinition = new ScreenPluginResourceTypeDefinition(new Others());\n    private static final EditorPluginResourceTypeDefinition editorDefinition = new EditorPluginResourceTypeDefinition(new Others());\n    private static final SplashPluginResourceTypeDefinition splashDefinition = new SplashPluginResourceTypeDefinition(new Others());\n    private static final DynamicMenuResourceTypeDefinition dynamicMenuDefinition = new DynamicMenuResourceTypeDefinition(new Others());\n    private static final PerspectiveLayoutPluginResourceTypeDefinition perspectiveLayoutPluginResourceTypeDefinition = new PerspectiveLayoutPluginResourceTypeDefinition(new Others());\n\n    public static PluginType fromPath(final Path path) {\n        if (screenDefinition.accept(path)) {\n            return PluginType.SCREEN;\n        }\n        if (editorDefinition.accept(path)) {\n            return PluginType.EDITOR;\n        }\n        if (splashDefinition.accept(path)) {\n            return PluginType.SPLASH;\n        }\n        if (dynamicMenuDefinition.accept(path)) {\n            return PluginType.DYNAMIC_MENU;\n        }\n\n        if (dynamicMenuDefinition.accept(path)) {\n            return PluginType.DYNAMIC_MENU;\n        }\n        if (perspectiveLayoutPluginResourceTypeDefinition.accept(path)) {\n            return PluginType.PERSPECTIVE_LAYOUT;\n        }\n\n        return null;\n    }\n\n    public static PluginType fromResourceType(final ResourceTypeDefinition resource) {\n        if (resource instanceof PerspectiveLayoutPluginResourceTypeDefinition) {\n            return PluginType.PERSPECTIVE_LAYOUT;\n        }\n        if (resource instanceof ScreenPluginResourceTypeDefinition) {\n            return PluginType.SCREEN;\n        }\n        if (resource instanceof EditorPluginResourceTypeDefinition) {\n            return PluginType.EDITOR;\n        }\n        if (resource instanceof SplashPluginResourceTypeDefinition) {\n            return PluginType.SPLASH;\n        }\n        if (resource instanceof DynamicMenuResourceTypeDefinition) {\n            return PluginType.DYNAMIC_MENU;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-api/src/main/resources/org/uberfire/ext/plugin/RuntimePluginAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n\n  <source path='event'/>\n  <source path='exception'/>\n  <source path='model'/>\n  <source path='service'/>\n  <source path='editor'/>\n  <source path='type'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-runtime-plugins</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-runtime-plugins-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Runtime PlugIns Backend</name>\n  <description>Uberfire Runtime PlugIns Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <!-- as javax.inject is excluded in parent pom's errai-bus dep. It had to be declared here -->\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-fileupload</groupId>\n      <artifactId>commons-fileupload</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/java/org/uberfire/ext/plugin/backend/JSRegistry.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.Framework;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.ext.plugin.model.PluginType;\n\npublic class JSRegistry {\n\n    public static String convertToJSRegistry(PluginSimpleContent plugin) {\n        Gson gson = new GsonBuilder().setPrettyPrinting().create();\n\n        final StringBuilder sb = new StringBuilder();\n\n        if (plugin.getCodeMap().containsKey(CodeType.MAIN)) {\n            sb.append(plugin.getCodeMap().get(CodeType.MAIN));\n        }\n\n        if (plugin.getType().equals(PluginType.SCREEN)) {\n            sb.append(\"$registerPlugin({\");\n        } else if (plugin.getType().equals(PluginType.SPLASH)) {\n            sb.append(\"$registerSplashScreen({\");\n        } else if (plugin.getType().equals(PluginType.EDITOR)) {\n            sb.append(\"$registerEditor({\");\n        } else if (plugin.getType().equals(PluginType.PERSPECTIVE)) {\n            sb.append(\"$registerPerspective({\");\n        }\n\n        sb.append(\"id:\").append('\"').append(plugin.getName()).append('\"').append(\",\");\n\n        if (plugin.getCodeMap().size() > 1) {\n            //Order Code fragments in the same sequence as defined in the CodeType enum, to aid repeatable testing\n            for (CodeType ct : CodeType.values()) {\n                if (ct.equals(CodeType.MAIN)) {\n                    continue;\n                }\n                if (plugin.getCodeMap().containsKey(ct)) {\n                    sb.append(ct.toString().toLowerCase()).append(\": \");\n                    sb.append(prepareEntryValue(ct,\n                                                plugin.getCodeMap().get(ct))).append(\",\");\n                }\n            }\n        }\n\n        if (plugin.getFrameworks() != null && !plugin.getFrameworks().isEmpty()) {\n            final Framework fm = plugin.getFrameworks().iterator().next();\n            sb.append(\"type: \").append('\"').append(fm.getType()).append('\"').append(',');\n        }\n\n        if (!plugin.getType().equals(PluginType.PERSPECTIVE)) {\n            sb.append(\"template: \");\n\n            gson.toJson(plugin.getTemplate(),\n                        sb);\n        } else {\n            sb.append(\"view: {\").append(plugin.getTemplate()).append(\"}\");\n        }\n\n        sb.append(\"});\");\n        return sb.toString();\n    }\n\n    protected static String prepareEntryValue(CodeType key,\n                                              String value) {\n        if (isAFunction(value)) {\n            return value;\n        } else {\n            return prepareStringValue(key,\n                                      value);\n        }\n    }\n\n    private static boolean isAFunction(String value) {\n        return value != null && value.contains(\"function\");\n    }\n\n    private static String prepareStringValue(CodeType key,\n                                             String value) {\n\n        return wrapWithFunctionDeclaration(key,\n                                           value);\n    }\n\n    private static String wrapWithFunctionDeclaration(CodeType key,\n                                                      String value) {\n        StringBuilder sb = new StringBuilder();\n        sb.append(\"function (){\");\n        sb.append(createFunctionBody(key,\n                                     value));\n        sb.append(\";}\");\n        return sb.toString();\n    }\n\n    private static String createFunctionBody(CodeType key,\n                                             String value) {\n        StringBuilder sb = new StringBuilder();\n        if (JSFunctionNeedsToReturnValue(key)) {\n            sb.append(\"return \");\n            sb.append(wrapValueWithCommas(value));\n        } else {\n            sb.append(value);\n        }\n        return sb.toString();\n    }\n\n    private static String wrapValueWithCommas(String value) {\n        StringBuilder sb = new StringBuilder();\n        if (value == null || value.isEmpty()) {\n            sb.append(\"\\\"\\\"\");\n        } else {\n            if (value.charAt(0) != '\"') {\n                sb.append(\"\\\"\");\n            }\n            sb.append(value);\n            if (value.charAt(value.length() - 1) != '\"') {\n                sb.append(\"\\\"\");\n            }\n        }\n        return sb.toString();\n    }\n\n    public static boolean JSFunctionNeedsToReturnValue(CodeType codeType) {\n        return codeType.equals(CodeType.TITLE) ||\n                codeType.equals(CodeType.RESOURCE_TYPE) ||\n                codeType.equals(CodeType.PRIORITY) ||\n                codeType.equals(CodeType.BODY_HEIGHT) ||\n                codeType.equals(CodeType.INTERCEPTION_POINTS) ||\n                codeType.equals(CodeType.PANEL_TYPE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/java/org/uberfire/ext/plugin/backend/MediaServletURI.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\npublic class MediaServletURI {\n\n    private String uri;\n\n    public MediaServletURI() {\n    }\n\n    public MediaServletURI(final String uri) {\n        setURI(uri);\n    }\n\n    public String getURI() {\n        return uri;\n    }\n\n    public void setURI(final String uri) {\n        this.uri = checkNotEmpty(\"uri\",\n                                 uri);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/java/org/uberfire/ext/plugin/backend/MediaServletURIProducer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Named;\n\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\n\n@ApplicationScoped\n@Startup(StartupType.BOOTSTRAP)\npublic class MediaServletURIProducer {\n\n    private MediaServletURI mediaServletURI;\n\n    @PostConstruct\n    public void setup() {\n        mediaServletURI = new MediaServletURI(\"plugins/\");\n    }\n\n    @Produces\n    @Named(\"MediaServletURI\")\n    public MediaServletURI produceMediaServletURI() {\n        return mediaServletURI;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/java/org/uberfire/ext/plugin/backend/PluginMediaServlet.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.io.FilenameUtils;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.ext.plugin.event.MediaAdded;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.EncodingUtil;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.server.BaseUploadServlet;\nimport org.uberfire.server.MimeType;\n\npublic class PluginMediaServlet\n        extends BaseUploadServlet {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    private Event<MediaAdded> newMediaEvent;\n\n    private String pattern = \"/plugins/\";\n\n    @Inject\n    @Named(\"MediaServletURI\")\n    private MediaServletURI mediaServletURI;\n\n    @Inject\n    @Named(\"pluginsFS\")\n    private FileSystem fileSystem;\n\n    private Path root;\n\n    @Override\n    public void init(final ServletConfig config) throws ServletException {\n        final String pattern = config.getInitParameter(\"url-pattern\");\n        if (pattern != null && !pattern.trim().isEmpty()) {\n            if (pattern.endsWith(\"/\")) {\n                this.pattern = pattern;\n            } else {\n                this.pattern = pattern + \"/\";\n            }\n            if (this.pattern.startsWith(\"/\")) {\n                mediaServletURI.setURI(this.pattern.substring(1));\n            } else {\n                mediaServletURI.setURI(this.pattern);\n            }\n        }\n        this.root = fileSystem.getRootDirectories().iterator().next();\n    }\n\n    @Override\n    public void doGet(final HttpServletRequest req,\n                      final HttpServletResponse resp) throws IOException {\n        String mime = null;\n        InputStream in;\n\n        boolean isPreview = req.getParameterMap().containsKey(\"preview\");\n\n        final String _filename = EncodingUtil.decode(req.getRequestURI().substring(req.getContextPath().length()));\n        final String filename;\n        if (_filename.toLowerCase().endsWith(\"?preview\")) {\n            filename = _filename.substring(0,\n                                           _filename.toLowerCase().indexOf(\"?preview\"));\n            isPreview = true;\n        } else {\n            filename = _filename;\n        }\n\n        final Path mediaPath = resolve(filename.replace(pattern,\n                                                        \"/\"));\n        if (!ioService.exists(mediaPath)) {\n            mime = \"image/png\";\n            in = getClass().getResourceAsStream(\"/nofound.png\");\n        } else {\n            mime = MimeType.fromExtension(\".\" + FilenameUtils.getExtension(mediaPath.getFileName().toString())).getType();\n            if (isPreview) {\n                if (mime != null && !mime.startsWith(\"image/\")) {\n                    mime = \"image/png\";\n                    in = getClass().getResourceAsStream(\"/placeholder.png\");\n                } else {\n                    in = ioService.newInputStream(mediaPath);\n                }\n            } else {\n                in = ioService.newInputStream(mediaPath);\n            }\n        }\n\n        if (mime == null) {\n            resp.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);\n            return;\n        }\n\n        resp.setContentType(mime);\n\n        final OutputStream out = resp.getOutputStream();\n\n        byte[] buf = new byte[1024];\n        int count = 0;\n        while ((count = in.read(buf)) >= 0) {\n            out.write(buf,\n                      0,\n                      count);\n        }\n        out.close();\n        in.close();\n    }\n\n    @Override\n    protected void doPost(HttpServletRequest req,\n                          HttpServletResponse response) throws ServletException, IOException {\n\n        try {\n            final String filename = req.getRequestURI().substring(req.getContextPath().length());\n            final String pluginName = filename.replace(pattern,\n                                                       \"/\");\n\n            if (pluginName != null) {\n                final FileItem fileItem = getFileItem(req);\n                final String fileName = FilenameUtils.getName(fileItem.getName());\n\n                final Path path = resolve(pluginName + \"/media/\" + fileName);\n\n                if (ioService.exists(path)) {\n                    writeResponse(response,\n                                  \"FAIL - ALREADY EXISTS\");\n                    return;\n                }\n\n                try {\n                    ioService.startBatch(path.getFileSystem());\n                    writeFile(ioService,\n                              path,\n                              fileItem);\n                } finally {\n                    ioService.endBatch();\n                }\n\n                newMediaEvent.fire(new MediaAdded(pluginName.substring(1),\n                                                  new Media(pattern.substring(1) + pluginName.substring(1) + \"/media/\" + path.getFileName(),\n                                                            Paths.convert(path))));\n\n                writeResponse(response,\n                              \"OK\");\n            }\n        } catch (final Exception e) {\n            logError(e);\n            writeResponse(response,\n                          \"FAIL\");\n        }\n    }\n\n    Path resolve(final String other) {\n        return root.resolve(other);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/java/org/uberfire/ext/plugin/backend/PluginServicesImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport java.io.InputStream;\nimport java.io.StringWriter;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.Optional;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.apache.commons.io.IOUtils;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.backend.validation.DefaultFileNameValidator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.plugin.event.MediaDeleted;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.exception.PluginAlreadyExists;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\nimport org.uberfire.ext.plugin.model.Framework;\nimport org.uberfire.ext.plugin.model.Language;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.ext.plugin.type.TypeConverterUtil;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.backend.server.util.Paths.convert;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\n@Service\n@ApplicationScoped\npublic class PluginServicesImpl implements PluginServices {\n\n    private static final Logger logger = LoggerFactory.getLogger(PluginServicesImpl.class);\n\n    private static final String MENU_ITEM_DELIMITER = \" / \";\n    protected Gson gson;\n    private IOService ioService;\n    private Instance<MediaServletURI> mediaServletURI;\n    private transient SessionInfo sessionInfo;\n    private Event<PluginAdded> pluginAddedEvent;\n    private Event<PluginDeleted> pluginDeletedEvent;\n    private Event<PluginSaved> pluginSavedEvent;\n    private Event<PluginRenamed> pluginRenamedEvent;\n    private Event<MediaDeleted> mediaDeletedEvent;\n    private DefaultFileNameValidator defaultFileNameValidator;\n    private User identity;\n    private SaveAndRenameServiceImpl<Plugin, DefaultMetadata> saveAndRenameService;\n    private FileSystem pluginsFileSystem;\n    private FileSystem perspectivesFileSystem;\n    private Path pluginsRoot;\n    private Path perspectivesRoot;\n    private SpacesAPI spacesAPI;\n\n    public PluginServicesImpl() {\n    }\n\n    @Inject\n    public PluginServicesImpl(final @Named(\"ioStrategy\") IOService ioService,\n                              final @Named(\"MediaServletURI\") Instance<MediaServletURI> mediaServletURI,\n                              final SessionInfo sessionInfo,\n                              final Event<PluginAdded> pluginAddedEvent,\n                              final Event<PluginDeleted> pluginDeletedEvent,\n                              final Event<PluginSaved> pluginSavedEvent,\n                              final Event<PluginRenamed> pluginRenamedEvent,\n                              final Event<MediaDeleted> mediaDeletedEvent,\n                              final DefaultFileNameValidator defaultFileNameValidator,\n                              final User identity,\n                              final @Named(\"pluginsFS\") FileSystem pluginsFileSystem,\n                              final @Named(\"perspectivesFS\") FileSystem perspectivesFileSystem,\n                              final SaveAndRenameServiceImpl<Plugin, DefaultMetadata> saveAndRenameService,\n                              final SpacesAPI spacesAPI) {\n        this.ioService = ioService;\n        this.mediaServletURI = mediaServletURI;\n        this.sessionInfo = sessionInfo;\n        this.pluginAddedEvent = pluginAddedEvent;\n        this.pluginDeletedEvent = pluginDeletedEvent;\n        this.pluginSavedEvent = pluginSavedEvent;\n        this.pluginRenamedEvent = pluginRenamedEvent;\n        this.mediaDeletedEvent = mediaDeletedEvent;\n        this.defaultFileNameValidator = defaultFileNameValidator;\n        this.identity = identity;\n        this.pluginsFileSystem = pluginsFileSystem;\n        this.perspectivesFileSystem = perspectivesFileSystem;\n        this.saveAndRenameService = saveAndRenameService;\n        this.spacesAPI = spacesAPI;\n    }\n\n    @PostConstruct\n    public void init() {\n        this.gson = new GsonBuilder().setPrettyPrinting().create();\n\n        this.pluginsRoot = resolveRoot(pluginsFileSystem);\n        this.perspectivesRoot = resolveRoot(perspectivesFileSystem);\n\n        saveAndRenameService.init(this);\n    }\n\n    Path resolveRoot(FileSystem fileSystem) {\n        return fileSystem.getRootDirectories().iterator().next();\n    }\n\n    FileSystem getFileSystem(final PluginType type) {\n        return getRoot(type).getFileSystem();\n    }\n\n    FileSystem getFileSystem(final Plugin plugin) {\n        return getFileSystem(plugin.getType());\n    }\n\n    FileSystem getFileSystem() {\n        return getFileSystem(PluginType.DEFAULT);\n    }\n\n    Path getRoot(final PluginType type) {\n        switch (Optional.ofNullable(type).orElse(PluginType.DEFAULT)) {\n            case PERSPECTIVE_LAYOUT:\n                return perspectivesRoot;\n\n            default:\n                return pluginsRoot;\n        }\n    }\n\n    Path getRoot() {\n        return getRoot(PluginType.DEFAULT);\n    }\n\n    @Override\n    public String getMediaServletURI() {\n        return mediaServletURI.get().getURI();\n    }\n\n    @Override\n    public Collection<RuntimePlugin> listRuntimePlugins() {\n        return listRuntimePlugins(getRoot());\n    }\n\n    @Override\n    public Collection<RuntimePlugin> listPluginRuntimePlugins(final org.uberfire.backend.vfs.Path pluginPath) {\n        return listRuntimePlugins(convert(pluginPath).getParent());\n    }\n\n    private Collection<RuntimePlugin> listRuntimePlugins(Path path) {\n        final Collection<RuntimePlugin> result = new ArrayList<RuntimePlugin>();\n\n        if (getIoService().exists(path)) {\n            walkFileTree(checkNotNull(\"path\",\n                                      path),\n                         new SimpleFileVisitor<Path>() {\n                             @Override\n                             public FileVisitResult visitFile(final Path file,\n                                                              final BasicFileAttributes attrs) throws IOException {\n                                 try {\n                                     checkNotNull(\"file\",\n                                                  file);\n                                     checkNotNull(\"attrs\",\n                                                  attrs);\n\n                                     if (attrs.isRegularFile()) {\n                                         result.addAll(buildPluginRuntimePlugins(file));\n                                     }\n                                 } catch (final Exception ex) {\n                                     logger.error(\"An unexpected exception was thrown: \",\n                                                  ex);\n                                     return FileVisitResult.TERMINATE;\n                                 }\n                                 return FileVisitResult.CONTINUE;\n                             }\n                         });\n        }\n\n        return result;\n    }\n\n    private Collection<RuntimePlugin> buildPluginRuntimePlugins(final Path pluginPath) {\n        final Collection<RuntimePlugin> result = new ArrayList<RuntimePlugin>();\n\n        if (pluginPath.getFileName().toString().endsWith(\".registry.js\")) {\n            final String pluginName = pluginPath.getParent().getFileName().toString();\n            result.addAll(buildRuntimePluginsFromFrameworks(loadFramework(pluginName)));\n            result.add(new RuntimePlugin(loadCss(pluginName),\n                                         getIoService().readAllString(pluginPath)));\n        }\n\n        return result;\n    }\n\n    private Collection<RuntimePlugin> buildRuntimePluginsFromFrameworks(Collection<Framework> frameworks) {\n        final Collection<RuntimePlugin> result = new ArrayList<RuntimePlugin>();\n\n        try {\n            for (Framework framework : frameworks) {\n                result.add(new RuntimePlugin(\"\",\n                                             getFrameworkScript(framework)));\n            }\n        } catch (java.io.IOException e) {\n            logger.error(\"An unexpected exception was thrown: \",\n                         e);\n        }\n\n        return result;\n    }\n\n    String getFrameworkScript(final Framework framework) throws java.io.IOException {\n        final StringWriter writer = new StringWriter();\n        final InputStream frameworkStream = getClass().getClassLoader().getResourceAsStream(\"/frameworks/\" + framework.toString().toLowerCase() + \".dependency\");\n\n        IOUtils.copy(frameworkStream,\n                     writer);\n\n        return writer.toString();\n    }\n\n    @Override\n    public Collection<Plugin> listPlugins() {\n        return listPlugins(PluginType.DEFAULT);\n    }\n\n    @Override\n    public Collection<Plugin> listPlugins(final PluginType type) {\n        final Collection<Plugin> result = new ArrayList<>();\n        final Path root = getRoot(type);\n\n        if (getIoService().exists(root)) {\n            walkFileTree(checkNotNull(\"root\", root),\n                         new SimpleFileVisitor<Path>() {\n                             @Override\n                             public FileVisitResult visitFile(final Path file,\n                                                              final BasicFileAttributes attrs) throws IOException {\n                                 try {\n                                     checkNotNull(\"file\",\n                                                  file);\n                                     checkNotNull(\"attrs\",\n                                                  attrs);\n\n                                     if (file.getFileName().toString().endsWith(\".plugin\") && attrs.isRegularFile()) {\n                                         final org.uberfire.backend.vfs.Path path = convert(file);\n                                         result.add(new Plugin(file.getParent().getFileName().toString(),\n                                                               TypeConverterUtil.fromPath(path),\n                                                               path));\n                                     }\n                                 } catch (final Exception ex) {\n                                     return FileVisitResult.TERMINATE;\n                                 }\n                                 return FileVisitResult.CONTINUE;\n                             }\n                         });\n        }\n\n        return result;\n    }\n\n    @Override\n    public Plugin createNewPlugin(final String pluginName,\n                                  final PluginType type) {\n        checkNotEmpty(\"pluginName\",\n                      pluginName);\n        checkCondition(\"valid plugin name\",\n                       defaultFileNameValidator.isValid(pluginName));\n\n        final Path pluginRoot = getPluginPath(pluginName, type);\n        if (getIoService().exists(pluginRoot)) {\n            throw new PluginAlreadyExists();\n        }\n\n        final Path pluginPath = pluginRoot.resolve(type.toString().toLowerCase() + \".plugin\");\n        final Plugin plugin = new Plugin(pluginName,\n                                         type,\n                                         convert(pluginPath));\n        updatePlugin(pluginPath,\n                     plugin,\n                     true);\n\n        return plugin;\n    }\n\n    private void updatePlugin(final Path pluginPath,\n                              final Plugin plugin,\n                              final boolean isNewPlugIn) {\n        updatePlugin(pluginPath,\n                     plugin,\n                     isNewPlugIn,\n                     null);\n    }\n\n    private void updatePlugin(final Path pluginPath,\n                              final Plugin plugin,\n                              final boolean isNewPlugIn,\n                              final String registry) {\n        try {\n            getIoService().startBatch(getFileSystem(plugin));\n            getIoService().write(pluginPath,\n                                 new Date().toString());\n        } finally {\n            getIoService().endBatch();\n        }\n\n        if (isNewPlugIn) {\n            pluginAddedEvent.fire(new PluginAdded(plugin,\n                                                  sessionInfo));\n        } else {\n            pluginSavedEvent.fire(new PluginSaved(plugin,\n                                                  sessionInfo));\n        }\n    }\n\n    @Override\n    public PluginContent getPluginContent(final org.uberfire.backend.vfs.Path path) {\n        final String pluginName = convert(path).getParent().getFileName().toString();\n        return new PluginContent(pluginName,\n                                 TypeConverterUtil.fromPath(path),\n                                 path,\n                                 loadTemplate(pluginName),\n                                 loadCss(pluginName),\n                                 loadCodeMap(pluginName),\n                                 loadFramework(pluginName),\n                                 Language.JAVASCRIPT,\n                                 loadMediaLibrary(pluginName));\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path save(final Plugin plugin,\n                                              final String commitMessage) {\n\n        if (plugin instanceof PluginSimpleContent) {\n            return save((PluginSimpleContent) plugin, commitMessage);\n        }\n\n        return null;\n    }\n\n    public org.uberfire.backend.vfs.Path save(final PluginSimpleContent plugin,\n                                              final String commitMessage) {\n\n        final Path pluginPath = getPluginPath(plugin);\n        final boolean isNewPlugin = !getIoService().exists(pluginPath);\n\n        try {\n            getIoService().startBatch(getFileSystem(plugin),\n                                      commentedOption(commitMessage));\n\n            saveCodeMap(plugin.getName(),\n                        plugin.getCodeMap());\n\n            if (plugin.getTemplate() != null) {\n                getIoService().write(getTemplatePath(pluginPath), plugin.getTemplate());\n            }\n\n            if (plugin.getCss() != null) {\n                getIoService().write(getCssPath(pluginPath), plugin.getCss());\n            }\n\n            clearDirectory(pluginPath.resolve(\"dependencies\"));\n\n            if (plugin.getFrameworks() != null && !plugin.getFrameworks().isEmpty()) {\n                final Framework framework = plugin.getFrameworks().iterator().next();\n                getIoService().write(getDependencyPath(pluginPath, framework),\n                                     \"--\");\n            }\n\n            createRegistry(plugin);\n\n            updatePlugin(convert(plugin.getPath()),\n                         plugin,\n                         isNewPlugin);\n        } finally {\n            getIoService().endBatch();\n        }\n\n        return plugin.getPath();\n    }\n\n    private void clearDirectory(Path directory) {\n        if (getIoService().exists(directory)) {\n            for (Path path : getIoService().newDirectoryStream(directory)) {\n                boolean b = getIoService().deleteIfExists(path);\n            }\n        }\n    }\n\n    private Path getDependencyPath(final Path pluginPath,\n                                   final Framework framework) {\n        return pluginPath.resolve(\"dependencies\").resolve(framework.toString() + \".dependency\");\n    }\n\n    private String createRegistry(final PluginSimpleContent plugin) {\n        final Path path = getPluginPath(plugin);\n\n        final String registry = new JSRegistry().convertToJSRegistry(plugin);\n\n        getIoService().write(path.resolve(plugin.getName() + \".registry.js\"),\n                             registry);\n\n        return registry;\n    }\n\n    private void saveCodeMap(final String pluginName,\n                             final Map<CodeType, String> codeMap) {\n        final Path rootPlugin = getPluginPath(pluginName);\n        for (final Map.Entry<CodeType, String> entry : codeMap.entrySet()) {\n            final Path codePath = getCodePath(rootPlugin,\n                                              entry.getKey());\n            getIoService().write(codePath,\n                                 entry.getValue());\n        }\n    }\n\n    private Map<CodeType, String> loadCodeMap(final String pluginName) {\n        try {\n            final Path rootPlugin = getPluginPath(pluginName);\n            final DirectoryStream<Path> stream = getIoService().newDirectoryStream(getCodeRoot(rootPlugin),\n                                                                                   new DirectoryStream.Filter<Path>() {\n                                                                                       @Override\n                                                                                       public boolean accept(final Path entry) throws IOException {\n                                                                                           return entry.getFileName().toString().endsWith(\".code\");\n                                                                                       }\n                                                                                   });\n\n            final Map<CodeType, String> result = new HashMap<CodeType, String>();\n\n            for (final Path path : stream) {\n                final CodeType type = getCodeType(path);\n                if (type != null) {\n                    result.put(type,\n                               getIoService().readAllString(path));\n                }\n            }\n\n            return result;\n        } catch (final NotDirectoryException exception) {\n            return Collections.emptyMap();\n        }\n    }\n\n    private Set<Media> loadMediaLibrary(final String pluginName) {\n        try {\n            final Path rootPlugin = getPluginPath(pluginName);\n            final DirectoryStream<Path> stream = getIoService().newDirectoryStream(getMediaRoot(rootPlugin));\n\n            final Set<Media> result = new HashSet<Media>();\n\n            for (final Path path : stream) {\n                result.add(new Media(getMediaServletURI() + pluginName + \"/media/\" + path.getFileName(),\n                                     convert(path)));\n            }\n\n            return result;\n        } catch (final NotDirectoryException exception) {\n            return Collections.emptySet();\n        }\n    }\n\n    private String loadTemplate(final String pluginName) {\n        final Path template = getTemplatePath(getPluginPath(pluginName));\n        if (getIoService().exists(template)) {\n            return getIoService().readAllString(template);\n        }\n        return \"\";\n    }\n\n    private String loadCss(final String pluginName) {\n        final Path css = getCssPath(getPluginPath(pluginName));\n        if (getIoService().exists(css)) {\n            return getIoService().readAllString(css);\n        }\n        return \"\";\n    }\n\n    private Set<Framework> loadFramework(final String pluginName) {\n        try {\n            final Set<Framework> result = new HashSet<Framework>();\n            final DirectoryStream<Path> stream = getIoService().newDirectoryStream(getPluginPath(pluginName).resolve(\"dependencies\"));\n\n            for (final Path path : stream) {\n                try {\n                    result.add(Framework.valueOf(path.getFileName().toString().replace(\".dependency\",\n                                                                                       \"\").toUpperCase()));\n                } catch (final Exception ignored) {\n                }\n            }\n\n            return result;\n        } catch (final NotDirectoryException exception) {\n            return Collections.emptySet();\n        }\n    }\n\n    private Path getTemplatePath(final Path rootPlugin) {\n        return rootPlugin.resolve(\"template.html\");\n    }\n\n    private Path getCssPath(final Path rootPlugin) {\n        return rootPlugin.resolve(\"css\").resolve(\"style.css\");\n    }\n\n    private Path getCodePath(final Path rootPlugin,\n                             final CodeType codeType) {\n        return getCodeRoot(rootPlugin).resolve(codeType.toString().toLowerCase() + \".code\");\n    }\n\n    private CodeType getCodeType(final Path path) {\n        try {\n            return CodeType.valueOf(path.getFileName().toString().replace(\".code\",\n                                                                          \"\").toUpperCase());\n        } catch (final Exception ignored) {\n        }\n        return null;\n    }\n\n    private Path getCodeRoot(final Path rootPlugin) {\n        return rootPlugin.resolve(\"code\");\n    }\n\n    private Path getMediaRoot(final Path rootPlugin) {\n        return rootPlugin.resolve(\"media\");\n    }\n\n    private Path getPluginPath(final String name) {\n        return getPluginPath(name, null);\n    }\n\n    private Path getPluginPath(final Plugin plugin) {\n        return getPluginPath(plugin.getName(), plugin.getType());\n    }\n\n    private Path getPluginPath(final String name,\n                               final PluginType type) {\n        return getRoot(type).resolve(name);\n    }\n\n    @Override\n    public void delete(final org.uberfire.backend.vfs.Path path,\n                       final String comment) {\n        final Plugin plugin = getPluginContent(path);\n        final Path pluginPath = convert(plugin.getPath());\n        if (getIoService().exists(pluginPath)) {\n\n            try {\n                getIoService().startBatch(getFileSystem(plugin),\n                                          commentedOption(comment));\n                getIoService().deleteIfExists(pluginPath.getParent(),\n                                              StandardDeleteOption.NON_EMPTY_DIRECTORIES);\n            } finally {\n                getIoService().endBatch();\n            }\n\n            pluginDeletedEvent.fire(new PluginDeleted(plugin,\n                                                      sessionInfo));\n        }\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path copy(final org.uberfire.backend.vfs.Path path,\n                                              final String newName,\n                                              final String comment) {\n\n        return copy(path,\n                    newName,\n                    null,\n                    comment);\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path copy(org.uberfire.backend.vfs.Path path,\n                                              String newName,\n                                              org.uberfire.backend.vfs.Path targetDirectory,\n                                              String comment) {\n        Plugin plugin = getPluginContent(path);\n        Path newPath = targetDirectory == null\n            ? convert(path).getParent().getParent().resolve(newName)\n            : convert(targetDirectory);\n\n        if (getIoService().exists(newPath)) {\n            throw new FileAlreadyExistsException(newPath.toString());\n        }\n\n        try {\n            getIoService().startBatch(getFileSystem(plugin),\n                                      commentedOption(comment));\n            getIoService().copy(convert(path).getParent(),\n                                newPath);\n        } finally {\n            getIoService().endBatch();\n        }\n\n        final org.uberfire.backend.vfs.Path result = convert(newPath.resolve(path.getFileName()));\n        final PluginContent pluginContent = getPluginContent(result);\n        removeRegistry(newPath);\n        String registry = createRegistry(pluginContent);\n\n        pluginAddedEvent.fire(new PluginAdded(pluginContent,\n                                              sessionInfo));\n\n        return result;\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path rename(final org.uberfire.backend.vfs.Path path,\n                                                final String newName,\n                                                final String comment) {\n        final Plugin plugin = getPluginContent(path);\n        final Path newPath = convert(path).getParent().getParent().resolve(newName);\n\n        if (getIoService().exists(newPath)) {\n            throw new FileAlreadyExistsException(newPath.toString());\n        }\n\n        try {\n            getIoService().startBatch(getFileSystem(plugin),\n                                      commentedOption(comment));\n\n            removeRegistry(convert(path).getParent());\n\n            getIoService().move(convert(path).getParent(),\n                                newPath);\n        } finally {\n            getIoService().endBatch();\n        }\n\n        final String oldPluginName = convert(path).getParent().getFileName().toString();\n\n        final org.uberfire.backend.vfs.Path result = convert(newPath.resolve(path.getFileName()));\n        final PluginContent pluginContent = getPluginContent(result);\n        String registry = createRegistry(pluginContent);\n\n        pluginRenamedEvent.fire(new PluginRenamed(oldPluginName,\n                                                  pluginContent,\n                                                  sessionInfo));\n\n        return result;\n    }\n\n    private void removeRegistry(final Path path) {\n        walkFileTree(path,\n                     new SimpleFileVisitor<Path>() {\n                         @Override\n                         public FileVisitResult visitFile(final Path file,\n                                                          final BasicFileAttributes attrs) throws IOException {\n                             try {\n                                 checkNotNull(\"file\",\n                                              file);\n                                 checkNotNull(\"attrs\",\n                                              attrs);\n\n                                 if (file.getFileName().toString().endsWith(\".registry.js\") && attrs.isRegularFile()) {\n                                     final org.uberfire.backend.vfs.Path path = convert(file);\n                                     getIoService().delete(file);\n                                 }\n                             } catch (final Exception ex) {\n                                 return FileVisitResult.TERMINATE;\n                             }\n                             return FileVisitResult.CONTINUE;\n                         }\n                     });\n    }\n\n    private CommentedOption commentedOption(final String comment) {\n        return new CommentedOption(sessionInfo != null ? sessionInfo.getId() : \"--\",\n                                   identity.getIdentifier(),\n                                   null,\n                                   comment);\n    }\n\n    @Override\n    public void deleteMedia(final Media media) {\n        final Path mediaPath = convert(media.getPath());\n\n        try {\n            getIoService().startBatch(getFileSystem());\n            getIoService().delete(mediaPath);\n        } finally {\n            getIoService().endBatch();\n        }\n\n        mediaDeletedEvent.fire(new MediaDeleted(mediaPath.getParent().getParent().getFileName().toString(),\n                                                media));\n    }\n\n    @Override\n    public DynamicMenu getDynamicMenuContent(org.uberfire.backend.vfs.Path path) {\n        final String pluginName = convert(path).getParent().getFileName().toString();\n        return new DynamicMenu(pluginName,\n                               TypeConverterUtil.fromPath(path),\n                               path,\n                               loadMenuItems(pluginName));\n    }\n\n    @Override\n    public LayoutEditorModel getLayoutEditor(org.uberfire.backend.vfs.Path path,\n                                             PluginType pluginType) {\n        final String pluginName = convert(path).getParent().getFileName().toString();\n\n        return loadLayoutEditor(pluginName,\n                                path,\n                                pluginType);\n    }\n\n    private LayoutEditorModel loadLayoutEditor(String pluginName,\n                                               org.uberfire.backend.vfs.Path path,\n                                               PluginType type) {\n        final Path path1 = getLayoutEditorPath(getPluginPath(pluginName, type),\n                                               type.toString().toLowerCase());\n        if (getIoService().exists(path1)) {\n            String fileContent = getIoService().readAllString(path1);\n\n            return new LayoutEditorModel(pluginName,\n                                         PluginType.PERSPECTIVE_LAYOUT,\n                                         path,\n                                         fileContent);\n        }\n        return new LayoutEditorModel(pluginName,\n                                     PluginType.PERSPECTIVE_LAYOUT,\n                                     path,\n                                     null).emptyLayout();\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path saveMenu(final DynamicMenu plugin,\n                                                  final String commitMessage) {\n        final Path pluginPath = convert(plugin.getPath());\n        final boolean isNewPlugin = !getIoService().exists(pluginPath);\n\n        try {\n            getIoService().startBatch(getFileSystem(plugin),\n                                      commentedOption(commitMessage));\n\n            final Path menuItemsPath = getMenuItemsPath(getPluginPath(plugin));\n            final StringBuilder sb = new StringBuilder();\n            for (DynamicMenuItem item : plugin.getMenuItems()) {\n                sb.append(item.getActivityId()).append(MENU_ITEM_DELIMITER).append(item.getMenuLabel()).append(\"\\n\");\n            }\n            getIoService().write(menuItemsPath,\n                                 sb.toString());\n\n            updatePlugin(pluginPath,\n                         plugin,\n                         isNewPlugin);\n        } finally {\n            getIoService().endBatch();\n        }\n\n        return plugin.getPath();\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path saveLayout(LayoutEditorModel plugin,\n                                                    String commitMessage) {\n        final Path pluginPath = convert(plugin.getPath());\n        final boolean isNewPlugin = !getIoService().exists(pluginPath);\n\n        try {\n            getIoService().startBatch(getFileSystem(plugin),\n                                      commentedOption(commitMessage));\n\n            final Path itemsPath = getLayoutEditorPath(getPluginPath(plugin),\n                                                       plugin.getType().toString().toLowerCase());\n\n            getIoService().write(itemsPath,\n                                 plugin.getLayoutEditorModel());\n\n            updatePlugin(pluginPath,\n                         plugin,\n                         isNewPlugin);\n        } finally {\n            getIoService().endBatch();\n        }\n        return plugin.getPath();\n    }\n\n    private Path getLayoutEditorPath(final Path rootPlugin,\n                                     final String type) {\n        return rootPlugin.resolve(type);\n    }\n\n    @Override\n    public Collection<DynamicMenu> listDynamicMenus() {\n        final Collection<DynamicMenu> result = new ArrayList<DynamicMenu>();\n        Path root = getRoot();\n\n        if (!getIoService().exists(root)) {\n            return result;\n        }\n\n        walkFileTree(checkNotNull(\"root\", root),\n                     new SimpleFileVisitor<Path>() {\n                         @Override\n                         public FileVisitResult visitFile(final Path file,\n                                                          final BasicFileAttributes attrs) throws IOException {\n                             try {\n                                 checkNotNull(\"file\", file);\n                                 checkNotNull(\"attrs\", attrs);\n\n                                 if (file.getFileName().toString().equalsIgnoreCase(\"info.dynamic\") && attrs.isRegularFile()) {\n                                     final String pluginName = file.getParent().getFileName().toString();\n                                     result.add(new DynamicMenu(pluginName,\n                                                                PluginType.DYNAMIC_MENU,\n                                                                convert(file.getParent()),\n                                                                loadMenuItems(pluginName)));\n                                 }\n\n                             } catch (final Exception ex) {\n                                 return FileVisitResult.TERMINATE;\n                             }\n\n                             return FileVisitResult.CONTINUE;\n                         }\n                     });\n\n        return result;\n    }\n\n    @Override\n    public Collection<LayoutEditorModel> listLayoutEditor(final PluginType pluginType) {\n        final Collection<LayoutEditorModel> result = new ArrayList<LayoutEditorModel>();\n        final Path root = getRoot(pluginType);\n\n        if (!getIoService().exists(root)) {\n            return result;\n        }\n\n        walkFileTree(checkNotNull(\"root\", root),\n                     new SimpleFileVisitor<Path>() {\n                         @Override\n                         public FileVisitResult visitFile(final Path file,\n                                                          final BasicFileAttributes attrs) throws IOException {\n                             try {\n                                 checkNotNull(\"file\", file);\n                                 checkNotNull(\"attrs\", attrs);\n\n                                 if (file.getFileName().toString().equalsIgnoreCase(pluginType.toString().toLowerCase()) && attrs.isRegularFile()) {\n                                     final LayoutEditorModel layoutEditorModel = getLayoutEditor(convert(file), pluginType);\n                                     result.add(layoutEditorModel);\n                                 }\n\n                             } catch (final Exception ex) {\n                                 return FileVisitResult.TERMINATE;\n                             }\n\n                             return FileVisitResult.CONTINUE;\n                         }\n                     });\n\n        return result;\n    }\n\n    private Collection<DynamicMenuItem> loadMenuItems(String pluginName) {\n        final Collection<DynamicMenuItem> result = new ArrayList<DynamicMenuItem>();\n        final Path menuItemsPath = getMenuItemsPath(getPluginPath(pluginName));\n        if (getIoService().exists(menuItemsPath)) {\n            final List<String> value = getIoService().readAllLines(menuItemsPath);\n            for (final String s : value) {\n                final String[] items = s.split(MENU_ITEM_DELIMITER);\n                if (items.length == 2) {\n                    result.add(new DynamicMenuItem(items[0],\n                                                   items[1]));\n                }\n            }\n        }\n        return result;\n    }\n\n    IOService getIoService() {\n        return ioService;\n    }\n\n    private Path getMenuItemsPath(final Path rootPlugin) {\n        return rootPlugin.resolve(\"info.dynamic\");\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path save(final org.uberfire.backend.vfs.Path _path,\n                                              final Plugin content,\n                                              final DefaultMetadata _metadata,\n                                              final String comment) {\n        return save(content, comment);\n    }\n\n    @Override\n    public org.uberfire.backend.vfs.Path saveAndRename(final org.uberfire.backend.vfs.Path path,\n                                                       final String newFileName,\n                                                       final DefaultMetadata metadata,\n                                                       final Plugin content,\n                                                       final String comment) {\n        return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/resources/frameworks/angular.dependency",
    "content": "/*\n AngularJS v1.5.0\n (c) 2010-2016 Google, Inc. http://angularjs.org\n License: MIT\n*/\n(function(O,W,v){'use strict';function H(a){return function(){var b=arguments[0],d;d=\"[\"+(a?a+\":\":\"\")+b+\"] http://errors.angularjs.org/1.5.0/\"+(a?a+\"/\":\"\")+b;for(b=1;b<arguments.length;b++){d=d+(1==b?\"?\":\"&\")+\"p\"+(b-1)+\"=\";var c=encodeURIComponent,e;e=arguments[b];e=\"function\"==typeof e?e.toString().replace(/ \\{[\\s\\S]*$/,\"\"):\"undefined\"==typeof e?\"undefined\":\"string\"!=typeof e?JSON.stringify(e):e;d+=c(e)}return Error(d)}}function Ca(a){if(null==a||Za(a))return!1;if(L(a)||F(a)||C&&a instanceof C)return!0;\nvar b=\"length\"in Object(a)&&a.length;return N(b)&&(0<=b&&(b-1 in a||a instanceof Array)||\"function\"==typeof a.item)}function n(a,b,d){var c,e;if(a)if(D(a))for(c in a)\"prototype\"==c||\"length\"==c||\"name\"==c||a.hasOwnProperty&&!a.hasOwnProperty(c)||b.call(d,a[c],c,a);else if(L(a)||Ca(a)){var f=\"object\"!==typeof a;c=0;for(e=a.length;c<e;c++)(f||c in a)&&b.call(d,a[c],c,a)}else if(a.forEach&&a.forEach!==n)a.forEach(b,d,a);else if(qc(a))for(c in a)b.call(d,a[c],c,a);else if(\"function\"===typeof a.hasOwnProperty)for(c in a)a.hasOwnProperty(c)&&\nb.call(d,a[c],c,a);else for(c in a)sa.call(a,c)&&b.call(d,a[c],c,a);return a}function rc(a,b,d){for(var c=Object.keys(a).sort(),e=0;e<c.length;e++)b.call(d,a[c[e]],c[e]);return c}function sc(a){return function(b,d){a(d,b)}}function Yd(){return++pb}function Qb(a,b,d){for(var c=a.$$hashKey,e=0,f=b.length;e<f;++e){var g=b[e];if(E(g)||D(g))for(var h=Object.keys(g),k=0,l=h.length;k<l;k++){var m=h[k],r=g[m];d&&E(r)?V(r)?a[m]=new Date(r.valueOf()):$a(r)?a[m]=new RegExp(r):r.nodeName?a[m]=r.cloneNode(!0):\nRb(r)?a[m]=r.clone():(E(a[m])||(a[m]=L(r)?[]:{}),Qb(a[m],[r],!0)):a[m]=r}}c?a.$$hashKey=c:delete a.$$hashKey;return a}function T(a){return Qb(a,wa.call(arguments,1),!1)}function Zd(a){return Qb(a,wa.call(arguments,1),!0)}function ca(a){return parseInt(a,10)}function Sb(a,b){return T(Object.create(a),b)}function B(){}function ab(a){return a}function ba(a){return function(){return a}}function tc(a){return D(a.toString)&&a.toString!==ga}function x(a){return\"undefined\"===typeof a}function y(a){return\"undefined\"!==\ntypeof a}function E(a){return null!==a&&\"object\"===typeof a}function qc(a){return null!==a&&\"object\"===typeof a&&!uc(a)}function F(a){return\"string\"===typeof a}function N(a){return\"number\"===typeof a}function V(a){return\"[object Date]\"===ga.call(a)}function D(a){return\"function\"===typeof a}function $a(a){return\"[object RegExp]\"===ga.call(a)}function Za(a){return a&&a.window===a}function bb(a){return a&&a.$evalAsync&&a.$watch}function Na(a){return\"boolean\"===typeof a}function $d(a){return a&&N(a.length)&&\nae.test(ga.call(a))}function Rb(a){return!(!a||!(a.nodeName||a.prop&&a.attr&&a.find))}function be(a){var b={};a=a.split(\",\");var d;for(d=0;d<a.length;d++)b[a[d]]=!0;return b}function ra(a){return G(a.nodeName||a[0]&&a[0].nodeName)}function cb(a,b){var d=a.indexOf(b);0<=d&&a.splice(d,1);return d}function Oa(a,b){function d(a,b){var d=b.$$hashKey,e;if(L(a)){e=0;for(var f=a.length;e<f;e++)b.push(c(a[e]))}else if(qc(a))for(e in a)b[e]=c(a[e]);else if(a&&\"function\"===typeof a.hasOwnProperty)for(e in a)a.hasOwnProperty(e)&&\n(b[e]=c(a[e]));else for(e in a)sa.call(a,e)&&(b[e]=c(a[e]));d?b.$$hashKey=d:delete b.$$hashKey;return b}function c(a){if(!E(a))return a;var b=f.indexOf(a);if(-1!==b)return g[b];if(Za(a)||bb(a))throw Da(\"cpws\");var b=!1,c=e(a);c===v&&(c=L(a)?[]:Object.create(uc(a)),b=!0);f.push(a);g.push(c);return b?d(a,c):c}function e(a){switch(ga.call(a)){case \"[object Int8Array]\":case \"[object Int16Array]\":case \"[object Int32Array]\":case \"[object Float32Array]\":case \"[object Float64Array]\":case \"[object Uint8Array]\":case \"[object Uint8ClampedArray]\":case \"[object Uint16Array]\":case \"[object Uint32Array]\":return new a.constructor(c(a.buffer));\ncase \"[object ArrayBuffer]\":if(!a.slice){var b=new ArrayBuffer(a.byteLength);(new Uint8Array(b)).set(new Uint8Array(a));return b}return a.slice(0);case \"[object Boolean]\":case \"[object Number]\":case \"[object String]\":case \"[object Date]\":return new a.constructor(a.valueOf());case \"[object RegExp]\":return b=new RegExp(a.source,a.toString().match(/[^\\/]*$/)[0]),b.lastIndex=a.lastIndex,b}if(D(a.cloneNode))return a.cloneNode(!0)}var f=[],g=[];if(b){if($d(b)||\"[object ArrayBuffer]\"===ga.call(b))throw Da(\"cpta\");\nif(a===b)throw Da(\"cpi\");L(b)?b.length=0:n(b,function(a,c){\"$$hashKey\"!==c&&delete b[c]});f.push(a);g.push(b);return d(a,b)}return c(a)}function na(a,b){if(L(a)){b=b||[];for(var d=0,c=a.length;d<c;d++)b[d]=a[d]}else if(E(a))for(d in b=b||{},a)if(\"$\"!==d.charAt(0)||\"$\"!==d.charAt(1))b[d]=a[d];return b||a}function oa(a,b){if(a===b)return!0;if(null===a||null===b)return!1;if(a!==a&&b!==b)return!0;var d=typeof a,c;if(d==typeof b&&\"object\"==d)if(L(a)){if(!L(b))return!1;if((d=a.length)==b.length){for(c=\n0;c<d;c++)if(!oa(a[c],b[c]))return!1;return!0}}else{if(V(a))return V(b)?oa(a.getTime(),b.getTime()):!1;if($a(a))return $a(b)?a.toString()==b.toString():!1;if(bb(a)||bb(b)||Za(a)||Za(b)||L(b)||V(b)||$a(b))return!1;d=Z();for(c in a)if(\"$\"!==c.charAt(0)&&!D(a[c])){if(!oa(a[c],b[c]))return!1;d[c]=!0}for(c in b)if(!(c in d)&&\"$\"!==c.charAt(0)&&y(b[c])&&!D(b[c]))return!1;return!0}return!1}function db(a,b,d){return a.concat(wa.call(b,d))}function vc(a,b){var d=2<arguments.length?wa.call(arguments,2):[];\nreturn!D(b)||b instanceof RegExp?b:d.length?function(){return arguments.length?b.apply(a,db(d,arguments,0)):b.apply(a,d)}:function(){return arguments.length?b.apply(a,arguments):b.call(a)}}function ce(a,b){var d=b;\"string\"===typeof a&&\"$\"===a.charAt(0)&&\"$\"===a.charAt(1)?d=v:Za(b)?d=\"$WINDOW\":b&&W===b?d=\"$DOCUMENT\":bb(b)&&(d=\"$SCOPE\");return d}function eb(a,b){if(x(a))return v;N(b)||(b=b?2:null);return JSON.stringify(a,ce,b)}function wc(a){return F(a)?JSON.parse(a):a}function xc(a,b){a=a.replace(de,\n\"\");var d=Date.parse(\"Jan 01, 1970 00:00:00 \"+a)/6E4;return isNaN(d)?b:d}function Tb(a,b,d){d=d?-1:1;var c=a.getTimezoneOffset();b=xc(b,c);d*=b-c;a=new Date(a.getTime());a.setMinutes(a.getMinutes()+d);return a}function ta(a){a=C(a).clone();try{a.empty()}catch(b){}var d=C(\"<div>\").append(a).html();try{return a[0].nodeType===Pa?G(d):d.match(/^(<[^>]+>)/)[1].replace(/^<([\\w\\-]+)/,function(a,b){return\"<\"+G(b)})}catch(c){return G(d)}}function yc(a){try{return decodeURIComponent(a)}catch(b){}}function zc(a){var b=\n{};n((a||\"\").split(\"&\"),function(a){var c,e,f;a&&(e=a=a.replace(/\\+/g,\"%20\"),c=a.indexOf(\"=\"),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=yc(e),y(e)&&(f=y(f)?yc(f):!0,sa.call(b,e)?L(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Ub(a){var b=[];n(a,function(a,c){L(a)?n(a,function(a){b.push(ha(c,!0)+(!0===a?\"\":\"=\"+ha(a,!0)))}):b.push(ha(c,!0)+(!0===a?\"\":\"=\"+ha(a,!0)))});return b.length?b.join(\"&\"):\"\"}function qb(a){return ha(a,!0).replace(/%26/gi,\"&\").replace(/%3D/gi,\"=\").replace(/%2B/gi,\n\"+\")}function ha(a,b){return encodeURIComponent(a).replace(/%40/gi,\"@\").replace(/%3A/gi,\":\").replace(/%24/g,\"$\").replace(/%2C/gi,\",\").replace(/%3B/gi,\";\").replace(/%20/g,b?\"%20\":\"+\")}function ee(a,b){var d,c,e=Qa.length;for(c=0;c<e;++c)if(d=Qa[c]+b,F(d=a.getAttribute(d)))return d;return null}function fe(a,b){var d,c,e={};n(Qa,function(b){b+=\"app\";!d&&a.hasAttribute&&a.hasAttribute(b)&&(d=a,c=a.getAttribute(b))});n(Qa,function(b){b+=\"app\";var e;!d&&(e=a.querySelector(\"[\"+b.replace(\":\",\"\\\\:\")+\"]\"))&&\n(d=e,c=e.getAttribute(b))});d&&(e.strictDi=null!==ee(d,\"strict-di\"),b(d,c?[c]:[],e))}function Ac(a,b,d){E(d)||(d={});d=T({strictDi:!1},d);var c=function(){a=C(a);if(a.injector()){var c=a[0]===W?\"document\":ta(a);throw Da(\"btstrpd\",c.replace(/</,\"&lt;\").replace(/>/,\"&gt;\"));}b=b||[];b.unshift([\"$provide\",function(b){b.value(\"$rootElement\",a)}]);d.debugInfoEnabled&&b.push([\"$compileProvider\",function(a){a.debugInfoEnabled(!0)}]);b.unshift(\"ng\");c=fb(b,d.strictDi);c.invoke([\"$rootScope\",\"$rootElement\",\n\"$compile\",\"$injector\",function(a,b,c,d){a.$apply(function(){b.data(\"$injector\",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;O&&e.test(O.name)&&(d.debugInfoEnabled=!0,O.name=O.name.replace(e,\"\"));if(O&&!f.test(O.name))return c();O.name=O.name.replace(f,\"\");ia.resumeBootstrap=function(a){n(a,function(a){b.push(a)});return c()};D(ia.resumeDeferredBootstrap)&&ia.resumeDeferredBootstrap()}function ge(){O.name=\"NG_ENABLE_DEBUG_INFO!\"+O.name;O.location.reload()}function he(a){a=\nia.element(a).injector();if(!a)throw Da(\"test\");return a.get(\"$$testability\")}function Bc(a,b){b=b||\"_\";return a.replace(ie,function(a,c){return(c?b:\"\")+a.toLowerCase()})}function je(){var a;if(!Cc){var b=rb();(ua=x(b)?O.jQuery:b?O[b]:v)&&ua.fn.on?(C=ua,T(ua.fn,{scope:Ra.scope,isolateScope:Ra.isolateScope,controller:Ra.controller,injector:Ra.injector,inheritedData:Ra.inheritedData}),a=ua.cleanData,ua.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=ua._data(f,\"events\"))&&c.$destroy&&ua(f).triggerHandler(\"$destroy\");\na(b)}):C=U;ia.element=C;Cc=!0}}function sb(a,b,d){if(!a)throw Da(\"areq\",b||\"?\",d||\"required\");return a}function Sa(a,b,d){d&&L(a)&&(a=a[a.length-1]);sb(D(a),b,\"not a function, got \"+(a&&\"object\"===typeof a?a.constructor.name||\"Object\":typeof a));return a}function Ta(a,b){if(\"hasOwnProperty\"===a)throw Da(\"badname\",b);}function Dc(a,b,d){if(!b)return a;b=b.split(\".\");for(var c,e=a,f=b.length,g=0;g<f;g++)c=b[g],a&&(a=(e=a)[c]);return!d&&D(a)?vc(e,a):a}function tb(a){for(var b=a[0],d=a[a.length-1],c,\ne=1;b!==d&&(b=b.nextSibling);e++)if(c||a[e]!==b)c||(c=C(wa.call(a,0,e))),c.push(b);return c||a}function Z(){return Object.create(null)}function ke(a){function b(a,b,c){return a[b]||(a[b]=c())}var d=H(\"$injector\"),c=H(\"ng\");a=b(a,\"angular\",Object);a.$$minErr=a.$$minErr||H;return b(a,\"module\",function(){var a={};return function(f,g,h){if(\"hasOwnProperty\"===f)throw c(\"badname\",\"module\");g&&a.hasOwnProperty(f)&&(a[f]=null);return b(a,f,function(){function a(b,d,e,f){f||(f=c);return function(){f[e||\"push\"]([b,\nd,arguments]);return K}}function b(a,d){return function(b,e){e&&D(e)&&(e.$$moduleName=f);c.push([a,d,arguments]);return K}}if(!g)throw d(\"nomod\",f);var c=[],e=[],s=[],I=a(\"$injector\",\"invoke\",\"push\",e),K={_invokeQueue:c,_configBlocks:e,_runBlocks:s,requires:g,name:f,provider:b(\"$provide\",\"provider\"),factory:b(\"$provide\",\"factory\"),service:b(\"$provide\",\"service\"),value:a(\"$provide\",\"value\"),constant:a(\"$provide\",\"constant\",\"unshift\"),decorator:b(\"$provide\",\"decorator\"),animation:b(\"$animateProvider\",\n\"register\"),filter:b(\"$filterProvider\",\"register\"),controller:b(\"$controllerProvider\",\"register\"),directive:b(\"$compileProvider\",\"directive\"),component:b(\"$compileProvider\",\"component\"),config:I,run:function(a){s.push(a);return this}};h&&I(h);return K})}})}function le(a){T(a,{bootstrap:Ac,copy:Oa,extend:T,merge:Zd,equals:oa,element:C,forEach:n,injector:fb,noop:B,bind:vc,toJson:eb,fromJson:wc,identity:ab,isUndefined:x,isDefined:y,isString:F,isFunction:D,isObject:E,isNumber:N,isElement:Rb,isArray:L,\nversion:me,isDate:V,lowercase:G,uppercase:ub,callbacks:{counter:0},getTestability:he,$$minErr:H,$$csp:Ea,reloadWithDebugInfo:ge});Vb=ke(O);Vb(\"ng\",[\"ngLocale\"],[\"$provide\",function(a){a.provider({$$sanitizeUri:ne});a.provider(\"$compile\",Ec).directive({a:oe,input:Fc,textarea:Fc,form:pe,script:qe,select:re,style:se,option:te,ngBind:ue,ngBindHtml:ve,ngBindTemplate:we,ngClass:xe,ngClassEven:ye,ngClassOdd:ze,ngCloak:Ae,ngController:Be,ngForm:Ce,ngHide:De,ngIf:Ee,ngInclude:Fe,ngInit:Ge,ngNonBindable:He,\nngPluralize:Ie,ngRepeat:Je,ngShow:Ke,ngStyle:Le,ngSwitch:Me,ngSwitchWhen:Ne,ngSwitchDefault:Oe,ngOptions:Pe,ngTransclude:Qe,ngModel:Re,ngList:Se,ngChange:Te,pattern:Gc,ngPattern:Gc,required:Hc,ngRequired:Hc,minlength:Ic,ngMinlength:Ic,maxlength:Jc,ngMaxlength:Jc,ngValue:Ue,ngModelOptions:Ve}).directive({ngInclude:We}).directive(vb).directive(Kc);a.provider({$anchorScroll:Xe,$animate:Ye,$animateCss:Ze,$$animateJs:$e,$$animateQueue:af,$$AnimateRunner:bf,$$animateAsyncRun:cf,$browser:df,$cacheFactory:ef,\n$controller:ff,$document:gf,$exceptionHandler:hf,$filter:Lc,$$forceReflow:jf,$interpolate:kf,$interval:lf,$http:mf,$httpParamSerializer:nf,$httpParamSerializerJQLike:of,$httpBackend:pf,$xhrFactory:qf,$location:rf,$log:sf,$parse:tf,$rootScope:uf,$q:vf,$$q:wf,$sce:xf,$sceDelegate:yf,$sniffer:zf,$templateCache:Af,$templateRequest:Bf,$$testability:Cf,$timeout:Df,$window:Ef,$$rAF:Ff,$$jqLite:Gf,$$HashMap:Hf,$$cookieReader:If})}])}function gb(a){return a.replace(Jf,function(a,d,c,e){return e?c.toUpperCase():\nc}).replace(Kf,\"Moz$1\")}function Mc(a){a=a.nodeType;return 1===a||!a||9===a}function Nc(a,b){var d,c,e=b.createDocumentFragment(),f=[];if(Wb.test(a)){d=d||e.appendChild(b.createElement(\"div\"));c=(Lf.exec(a)||[\"\",\"\"])[1].toLowerCase();c=da[c]||da._default;d.innerHTML=c[1]+a.replace(Mf,\"<$1></$2>\")+c[2];for(c=c[0];c--;)d=d.lastChild;f=db(f,d.childNodes);d=e.firstChild;d.textContent=\"\"}else f.push(b.createTextNode(a));e.textContent=\"\";e.innerHTML=\"\";n(f,function(a){e.appendChild(a)});return e}function Oc(a,\nb){var d=a.parentNode;d&&d.replaceChild(b,a);b.appendChild(a)}function U(a){if(a instanceof U)return a;var b;F(a)&&(a=X(a),b=!0);if(!(this instanceof U)){if(b&&\"<\"!=a.charAt(0))throw Xb(\"nosel\");return new U(a)}if(b){b=W;var d;a=(d=Nf.exec(a))?[b.createElement(d[1])]:(d=Nc(a,b))?d.childNodes:[]}Pc(this,a)}function Yb(a){return a.cloneNode(!0)}function wb(a,b){b||hb(a);if(a.querySelectorAll)for(var d=a.querySelectorAll(\"*\"),c=0,e=d.length;c<e;c++)hb(d[c])}function Qc(a,b,d,c){if(y(c))throw Xb(\"offargs\");\nvar e=(c=xb(a))&&c.events,f=c&&c.handle;if(f)if(b){var g=function(b){var c=e[b];y(d)&&cb(c||[],d);y(d)&&c&&0<c.length||(a.removeEventListener(b,f,!1),delete e[b])};n(b.split(\" \"),function(a){g(a);yb[a]&&g(yb[a])})}else for(b in e)\"$destroy\"!==b&&a.removeEventListener(b,f,!1),delete e[b]}function hb(a,b){var d=a.ng339,c=d&&ib[d];c&&(b?delete c.data[b]:(c.handle&&(c.events.$destroy&&c.handle({},\"$destroy\"),Qc(a)),delete ib[d],a.ng339=v))}function xb(a,b){var d=a.ng339,d=d&&ib[d];b&&!d&&(a.ng339=d=++Of,\nd=ib[d]={events:{},data:{},handle:v});return d}function Zb(a,b,d){if(Mc(a)){var c=y(d),e=!c&&b&&!E(b),f=!b;a=(a=xb(a,!e))&&a.data;if(c)a[b]=d;else{if(f)return a;if(e)return a&&a[b];T(a,b)}}}function zb(a,b){return a.getAttribute?-1<(\" \"+(a.getAttribute(\"class\")||\"\")+\" \").replace(/[\\n\\t]/g,\" \").indexOf(\" \"+b+\" \"):!1}function Ab(a,b){b&&a.setAttribute&&n(b.split(\" \"),function(b){a.setAttribute(\"class\",X((\" \"+(a.getAttribute(\"class\")||\"\")+\" \").replace(/[\\n\\t]/g,\" \").replace(\" \"+X(b)+\" \",\" \")))})}function Bb(a,\nb){if(b&&a.setAttribute){var d=(\" \"+(a.getAttribute(\"class\")||\"\")+\" \").replace(/[\\n\\t]/g,\" \");n(b.split(\" \"),function(a){a=X(a);-1===d.indexOf(\" \"+a+\" \")&&(d+=a+\" \")});a.setAttribute(\"class\",X(d))}}function Pc(a,b){if(b)if(b.nodeType)a[a.length++]=b;else{var d=b.length;if(\"number\"===typeof d&&b.window!==b){if(d)for(var c=0;c<d;c++)a[a.length++]=b[c]}else a[a.length++]=b}}function Rc(a,b){return Cb(a,\"$\"+(b||\"ngController\")+\"Controller\")}function Cb(a,b,d){9==a.nodeType&&(a=a.documentElement);for(b=\nL(b)?b:[b];a;){for(var c=0,e=b.length;c<e;c++)if(y(d=C.data(a,b[c])))return d;a=a.parentNode||11===a.nodeType&&a.host}}function Sc(a){for(wb(a,!0);a.firstChild;)a.removeChild(a.firstChild)}function $b(a,b){b||wb(a);var d=a.parentNode;d&&d.removeChild(a)}function Pf(a,b){b=b||O;if(\"complete\"===b.document.readyState)b.setTimeout(a);else C(b).on(\"load\",a)}function Tc(a,b){var d=Db[b.toLowerCase()];return d&&Uc[ra(a)]&&d}function Qf(a,b){var d=function(c,d){c.isDefaultPrevented=function(){return c.defaultPrevented};\nvar f=b[d||c.type],g=f?f.length:0;if(g){if(x(c.immediatePropagationStopped)){var h=c.stopImmediatePropagation;c.stopImmediatePropagation=function(){c.immediatePropagationStopped=!0;c.stopPropagation&&c.stopPropagation();h&&h.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};var k=f.specialHandlerWrapper||Rf;1<g&&(f=na(f));for(var l=0;l<g;l++)c.isImmediatePropagationStopped()||k(a,c,f[l])}};d.elem=a;return d}function Rf(a,b,d){d.call(a,b)}function Sf(a,b,\nd){var c=b.relatedTarget;c&&(c===a||Tf.call(a,c))||d.call(a,b)}function Gf(){this.$get=function(){return T(U,{hasClass:function(a,b){a.attr&&(a=a[0]);return zb(a,b)},addClass:function(a,b){a.attr&&(a=a[0]);return Bb(a,b)},removeClass:function(a,b){a.attr&&(a=a[0]);return Ab(a,b)}})}}function Fa(a,b){var d=a&&a.$$hashKey;if(d)return\"function\"===typeof d&&(d=a.$$hashKey()),d;d=typeof a;return d=\"function\"==d||\"object\"==d&&null!==a?a.$$hashKey=d+\":\"+(b||Yd)():d+\":\"+a}function Ua(a,b){if(b){var d=0;this.nextUid=\nfunction(){return++d}}n(a,this.put,this)}function Vc(a){a=a.toString().replace(Uf,\"\");return a.match(Vf)||a.match(Wf)}function Xf(a){return(a=Vc(a))?\"function(\"+(a[1]||\"\").replace(/[\\s\\r\\n]+/,\" \")+\")\":\"fn\"}function fb(a,b){function d(a){return function(b,c){if(E(b))n(b,sc(a));else return a(b,c)}}function c(a,b){Ta(a,\"service\");if(D(b)||L(b))b=s.instantiate(b);if(!b.$get)throw Ga(\"pget\",a);return r[a+\"Provider\"]=b}function e(a,b){return function(){var c=t.invoke(b,this);if(x(c))throw Ga(\"undef\",a);\nreturn c}}function f(a,b,d){return c(a,{$get:!1!==d?e(a,b):b})}function g(a){sb(x(a)||L(a),\"modulesToLoad\",\"not an array\");var b=[],c;n(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=s.get(e[0]);f[e[1]].apply(f,e[2])}}if(!m.get(a)){m.put(a,!0);try{F(a)?(c=Vb(a),b=b.concat(g(c.requires)).concat(c._runBlocks),d(c._invokeQueue),d(c._configBlocks)):D(a)?b.push(s.invoke(a)):L(a)?b.push(s.invoke(a)):Sa(a,\"module\")}catch(e){throw L(a)&&(a=a[a.length-1]),e.message&&e.stack&&\n-1==e.stack.indexOf(e.message)&&(e=e.message+\"\\n\"+e.stack),Ga(\"modulerr\",a,e.stack||e.message||e);}}});return b}function h(a,c){function d(b,e){if(a.hasOwnProperty(b)){if(a[b]===k)throw Ga(\"cdep\",b+\" <- \"+l.join(\" <- \"));return a[b]}try{return l.unshift(b),a[b]=k,a[b]=c(b,e)}catch(f){throw a[b]===k&&delete a[b],f;}finally{l.shift()}}function e(a,c,f){var g=[];a=fb.$$annotate(a,b,f);for(var h=0,k=a.length;h<k;h++){var l=a[h];if(\"string\"!==typeof l)throw Ga(\"itkn\",l);g.push(c&&c.hasOwnProperty(l)?c[l]:\nd(l,f))}return g}return{invoke:function(a,b,c,d){\"string\"===typeof c&&(d=c,c=null);c=e(a,c,d);L(a)&&(a=a[a.length-1]);d=11>=xa?!1:\"function\"===typeof a&&/^(?:class\\s|constructor\\()/.test(Function.prototype.toString.call(a));return d?(c.unshift(null),new (Function.prototype.bind.apply(a,c))):a.apply(b,c)},instantiate:function(a,b,c){var d=L(a)?a[a.length-1]:a;a=e(a,b,c);a.unshift(null);return new (Function.prototype.bind.apply(d,a))},get:d,annotate:fb.$$annotate,has:function(b){return r.hasOwnProperty(b+\n\"Provider\")||a.hasOwnProperty(b)}}}b=!0===b;var k={},l=[],m=new Ua([],!0),r={$provide:{provider:d(c),factory:d(f),service:d(function(a,b){return f(a,[\"$injector\",function(a){return a.instantiate(b)}])}),value:d(function(a,b){return f(a,ba(b),!1)}),constant:d(function(a,b){Ta(a,\"constant\");r[a]=b;I[a]=b}),decorator:function(a,b){var c=s.get(a+\"Provider\"),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},s=r.$injector=h(r,function(a,b){ia.isString(b)&&l.push(b);\nthrow Ga(\"unpr\",l.join(\" <- \"));}),I={},K=h(I,function(a,b){var c=s.get(a+\"Provider\",b);return t.invoke(c.$get,c,v,a)}),t=K;r.$injectorProvider={$get:ba(K)};var p=g(a),t=K.get(\"$injector\");t.strictDi=b;n(p,function(a){a&&t.invoke(a)});return t}function Xe(){var a=!0;this.disableAutoScrolling=function(){a=!1};this.$get=[\"$window\",\"$location\",\"$rootScope\",function(b,d,c){function e(a){var b=null;Array.prototype.some.call(a,function(a){if(\"a\"===ra(a))return b=a,!0});return b}function f(a){if(a){a.scrollIntoView();\nvar c;c=g.yOffset;D(c)?c=c():Rb(c)?(c=c[0],c=\"fixed\"!==b.getComputedStyle(c).position?0:c.getBoundingClientRect().bottom):N(c)||(c=0);c&&(a=a.getBoundingClientRect().top,b.scrollBy(0,a-c))}else b.scrollTo(0,0)}function g(a){a=F(a)?a:d.hash();var b;a?(b=h.getElementById(a))?f(b):(b=e(h.getElementsByName(a)))?f(b):\"top\"===a&&f(null):f(null)}var h=b.document;a&&c.$watch(function(){return d.hash()},function(a,b){a===b&&\"\"===a||Pf(function(){c.$evalAsync(g)})});return g}]}function jb(a,b){if(!a&&!b)return\"\";\nif(!a)return b;if(!b)return a;L(a)&&(a=a.join(\" \"));L(b)&&(b=b.join(\" \"));return a+\" \"+b}function Yf(a){F(a)&&(a=a.split(\" \"));var b=Z();n(a,function(a){a.length&&(b[a]=!0)});return b}function Ha(a){return E(a)?a:{}}function Zf(a,b,d,c){function e(a){try{a.apply(null,wa.call(arguments,1))}finally{if(K--,0===K)for(;t.length;)try{t.pop()()}catch(b){d.error(b)}}}function f(){z=null;g();h()}function g(){a:{try{p=m.state;break a}catch(a){}p=void 0}p=x(p)?null:p;oa(p,$)&&(p=$);$=p}function h(){if(u!==k.url()||\nw!==p)u=k.url(),w=p,n(A,function(a){a(k.url(),p)})}var k=this,l=a.location,m=a.history,r=a.setTimeout,s=a.clearTimeout,I={};k.isMock=!1;var K=0,t=[];k.$$completeOutstandingRequest=e;k.$$incOutstandingRequestCount=function(){K++};k.notifyWhenNoOutstandingRequests=function(a){0===K?a():t.push(a)};var p,w,u=l.href,la=b.find(\"base\"),z=null;g();w=p;k.url=function(b,d,e){x(e)&&(e=null);l!==a.location&&(l=a.location);m!==a.history&&(m=a.history);if(b){var f=w===e;if(u===b&&(!c.history||f))return k;var h=\nu&&Ia(u)===Ia(b);u=b;w=e;if(!c.history||h&&f){if(!h||z)z=b;d?l.replace(b):h?(d=l,e=b.indexOf(\"#\"),e=-1===e?\"\":b.substr(e),d.hash=e):l.href=b;l.href!==b&&(z=b)}else m[d?\"replaceState\":\"pushState\"](e,\"\",b),g(),w=p;return k}return z||l.href.replace(/%27/g,\"'\")};k.state=function(){return p};var A=[],Q=!1,$=null;k.onUrlChange=function(b){if(!Q){if(c.history)C(a).on(\"popstate\",f);C(a).on(\"hashchange\",f);Q=!0}A.push(b);return b};k.$$applicationDestroyed=function(){C(a).off(\"hashchange popstate\",f)};k.$$checkUrlChange=\nh;k.baseHref=function(){var a=la.attr(\"href\");return a?a.replace(/^(https?\\:)?\\/\\/[^\\/]*/,\"\"):\"\"};k.defer=function(a,b){var c;K++;c=r(function(){delete I[c];e(a)},b||0);I[c]=!0;return c};k.defer.cancel=function(a){return I[a]?(delete I[a],s(a),e(B),!0):!1}}function df(){this.$get=[\"$window\",\"$log\",\"$sniffer\",\"$document\",function(a,b,d,c){return new Zf(a,c,b,d)}]}function ef(){this.$get=function(){function a(a,c){function e(a){a!=r&&(s?s==a&&(s=a.n):s=a,f(a.n,a.p),f(a,r),r=a,r.n=null)}function f(a,\nb){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(a in b)throw H(\"$cacheFactory\")(\"iid\",a);var g=0,h=T({},c,{id:a}),k=Z(),l=c&&c.capacity||Number.MAX_VALUE,m=Z(),r=null,s=null;return b[a]={put:function(a,b){if(!x(b)){if(l<Number.MAX_VALUE){var c=m[a]||(m[a]={key:a});e(c)}a in k||g++;k[a]=b;g>l&&this.remove(s.key);return b}},get:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;e(b)}return k[a]},remove:function(a){if(l<Number.MAX_VALUE){var b=m[a];if(!b)return;b==r&&(r=b.p);b==s&&(s=b.n);f(b.n,b.p);delete m[a]}a in\nk&&(delete k[a],g--)},removeAll:function(){k=Z();g=0;m=Z();r=s=null},destroy:function(){m=h=k=null;delete b[a]},info:function(){return T({},h,{size:g})}}}var b={};a.info=function(){var a={};n(b,function(b,e){a[e]=b.info()});return a};a.get=function(a){return b[a]};return a}}function Af(){this.$get=[\"$cacheFactory\",function(a){return a(\"templates\")}]}function Ec(a,b){function d(a,b,c){var d=/^\\s*([@&<]|=(\\*?))(\\??)\\s*(\\w*)\\s*$/,e={};n(a,function(a,f){var g=a.match(d);if(!g)throw ja(\"iscp\",b,f,a,c?\n\"controller bindings definition\":\"isolate scope definition\");e[f]={mode:g[1][0],collection:\"*\"===g[2],optional:\"?\"===g[3],attrName:g[4]||f}});return e}function c(a){var b=a.charAt(0);if(!b||b!==G(b))throw ja(\"baddir\",a);if(a!==a.trim())throw ja(\"baddir\",a);}var e={},f=/^\\s*directive\\:\\s*([\\w\\-]+)\\s+(.*)$/,g=/(([\\w\\-]+)(?:\\:([^;]+))?;?)/,h=be(\"ngSrc,ngSrcset,src,srcset\"),k=/^(?:(\\^\\^?)?(\\?)?(\\^\\^?)?)?/,l=/^(on[a-z]+|formaction)$/;this.directive=function s(b,f){Ta(b,\"directive\");F(b)?(c(b),sb(f,\"directiveFactory\"),\ne.hasOwnProperty(b)||(e[b]=[],a.factory(b+\"Directive\",[\"$injector\",\"$exceptionHandler\",function(a,c){var f=[];n(e[b],function(e,g){try{var h=a.invoke(e);D(h)?h={compile:ba(h)}:!h.compile&&h.link&&(h.compile=ba(h.link));h.priority=h.priority||0;h.index=g;h.name=h.name||b;h.require=h.require||h.controller&&h.name;h.restrict=h.restrict||\"EA\";var k=h,l=h,m=h.name,s={isolateScope:null,bindToController:null};E(l.scope)&&(!0===l.bindToController?(s.bindToController=d(l.scope,m,!0),s.isolateScope={}):s.isolateScope=\nd(l.scope,m,!1));E(l.bindToController)&&(s.bindToController=d(l.bindToController,m,!0));if(E(s.bindToController)){var P=l.controller,S=l.controllerAs;if(!P)throw ja(\"noctrl\",m);if(!Wc(P,S))throw ja(\"noident\",m);}var ma=k.$$bindings=s;E(ma.isolateScope)&&(h.$$isolateBindings=ma.isolateScope);h.$$moduleName=e.$$moduleName;f.push(h)}catch(K){c(K)}});return f}])),e[b].push(f)):n(b,sc(s));return this};this.component=function(a,b){function c(a){function e(b){return D(b)||L(b)?function(c,d){return a.invoke(b,\nthis,{$element:c,$attrs:d})}:b}var f=b.template||b.templateUrl?b.template:\"\";return{controller:d,controllerAs:Wc(b.controller)||b.controllerAs||\"$ctrl\",template:e(f),templateUrl:e(b.templateUrl),transclude:b.transclude,scope:{},bindToController:b.bindings||{},restrict:\"E\",require:b.require}}var d=b.controller||function(){};n(b,function(a,b){\"$\"===b.charAt(0)&&(c[b]=a)});c.$inject=[\"$injector\"];return this.directive(a,c)};this.aHrefSanitizationWhitelist=function(a){return y(a)?(b.aHrefSanitizationWhitelist(a),\nthis):b.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(a){return y(a)?(b.imgSrcSanitizationWhitelist(a),this):b.imgSrcSanitizationWhitelist()};var m=!0;this.debugInfoEnabled=function(a){return y(a)?(m=a,this):m};this.$get=[\"$injector\",\"$interpolate\",\"$exceptionHandler\",\"$templateRequest\",\"$parse\",\"$controller\",\"$rootScope\",\"$sce\",\"$animate\",\"$$sanitizeUri\",function(a,b,c,d,p,w,u,la,z,A){function Q(a,b,c){ba.innerHTML=\"<span \"+b+\">\";b=ba.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);\nd.value=c;a.attributes.setNamedItem(d)}function $(a,b){try{a.addClass(b)}catch(c){}}function M(a,b,c,d,e){a instanceof C||(a=C(a));for(var f=/\\S+/,g=0,h=a.length;g<h;g++){var k=a[g];k.nodeType===Pa&&k.nodeValue.match(f)&&Oc(k,a[g]=W.createElement(\"span\"))}var l=P(a,b,a,c,d,e);M.$$addScopeClass(a);var m=null;return function(b,c,d){sb(b,\"scope\");e&&e.needsNewScope&&(b=b.$parent.$new());d=d||{};var f=d.parentBoundTranscludeFn,g=d.transcludeControllers;d=d.futureParentElement;f&&f.$$boundTransclude&&\n(f=f.$$boundTransclude);m||(m=(d=d&&d[0])?\"foreignobject\"!==ra(d)&&ga.call(d).match(/SVG/)?\"svg\":\"html\":\"html\");d=\"html\"!==m?C(U(m,C(\"<div>\").append(a).html())):c?Ra.clone.call(a):a;if(g)for(var h in g)d.data(\"$\"+h+\"Controller\",g[h].instance);M.$$addScopeInfo(d,b);c&&c(d,b);l&&l(b,d,d,f);return d}}function P(a,b,c,d,e,f){function g(a,c,d,e){var f,k,l,m,p,s,u;if(A)for(u=Array(c.length),m=0;m<h.length;m+=3)f=h[m],u[f]=c[f];else u=c;m=0;for(p=h.length;m<p;)k=u[h[m++]],c=h[m++],f=h[m++],c?(c.scope?(l=\na.$new(),M.$$addScopeInfo(C(k),l)):l=a,s=c.transcludeOnThisElement?S(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?S(a,b):null,c(f,l,k,d,s)):f&&f(a,k.childNodes,v,e)}for(var h=[],k,l,m,p,A,s=0;s<a.length;s++){k=new na;l=ma(a[s],[],k,0===s?d:v,e);(f=l.length?y(l,a[s],k,b,c,null,[],[],f):null)&&f.scope&&M.$$addScopeClass(k.$$element);k=f&&f.terminal||!(m=a[s].childNodes)||!m.length?null:P(m,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||k)h.push(s,f,k),p=!0,A=\nA||f;f=null}return p?g:null}function S(a,b,c){var d=function(d,e,f,g,h){d||(d=a.$new(!1,h),d.$$transcluded=!0);return b(d,e,{parentBoundTranscludeFn:c,transcludeControllers:f,futureParentElement:g})},e=d.$$slots=Z(),f;for(f in b.$$slots)e[f]=b.$$slots[f]?S(a,b.$$slots[f],c):null;return d}function ma(a,b,c,d,e){var h=c.$attr,k;switch(a.nodeType){case 1:H(b,va(ra(a)),\"E\",d,e);for(var l,m,p,s=a.attributes,A=0,u=s&&s.length;A<u;A++){var t=!1,w=!1;l=s[A];k=l.name;m=X(l.value);l=va(k);if(p=pa.test(l))k=\nk.replace(Xc,\"\").substr(8).replace(/_(.)/g,function(a,b){return b.toUpperCase()});(l=l.match(ua))&&O(l[1])&&(t=k,w=k.substr(0,k.length-5)+\"end\",k=k.substr(0,k.length-6));l=va(k.toLowerCase());h[l]=k;if(p||!c.hasOwnProperty(l))c[l]=m,Tc(a,l)&&(c[l]=!0);Y(a,b,m,l,p);H(b,l,\"A\",d,e,t,w)}a=a.className;E(a)&&(a=a.animVal);if(F(a)&&\"\"!==a)for(;k=g.exec(a);)l=va(k[2]),H(b,l,\"C\",d,e)&&(c[l]=X(k[3])),a=a.substr(k.index+k[0].length);break;case Pa:if(11===xa)for(;a.parentNode&&a.nextSibling&&a.nextSibling.nodeType===\nPa;)a.nodeValue+=a.nextSibling.nodeValue,a.parentNode.removeChild(a.nextSibling);N(b,a.nodeValue);break;case 8:try{if(k=f.exec(a.nodeValue))l=va(k[1]),H(b,l,\"M\",d,e)&&(c[l]=X(k[2]))}catch(M){}}b.sort(ya);return b}function q(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ja(\"uterdir\",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return C(d)}function Yc(a,b,c){return function(d,e,f,g,h){e=q(e[0],b,\nc);return a(d,e,f,g,h)}}function ac(a,b,c,d,e,f){if(a)return M(b,c,d,e,f);var g;return function(){g||(g=M(b,c,d,e,f),b=c=f=null);return g.apply(this,arguments)}}function y(a,b,d,e,f,g,h,l,m){function p(a,b,c,d){if(a){c&&(a=Yc(a,c,d));a.require=J.require;a.directiveName=H;if(P===J||J.$$isolateScope)a=ca(a,{isolateScope:!0});h.push(a)}if(b){c&&(b=Yc(b,c,d));b.require=J.require;b.directiveName=H;if(P===J||J.$$isolateScope)b=ca(b,{isolateScope:!0});l.push(b)}}function s(a,b,c,d){var e;if(F(b)){var f=\nb.match(k);b=b.substring(f[0].length);var g=f[1]||f[3],f=\"?\"===f[2];\"^^\"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h=\"$\"+b+\"Controller\";e=g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw ja(\"ctreq\",b,a);}else if(L(b))for(e=[],g=0,f=b.length;g<f;g++)e[g]=s(a,b[g],c,d);else E(b)&&(e={},n(b,function(b,f){e[f]=s(a,b,c,d)}));return e||null}function A(a,b,c,d,e,f){var g=Z(),h;for(h in d){var k=d[h],l={$scope:k===P||k.$$isolateScope?e:f,$element:a,$attrs:b,$transclude:c},m=k.controller;\"@\"==m&&\n(m=b[k.name]);l=w(m,l,!0,k.controllerAs);g[k.name]=l;B||a.data(\"$\"+k.name+\"Controller\",l.instance)}return g}function u(a,c,e,f,g){function k(a,b,c,d){var e;bb(a)||(d=c,c=b,b=a,a=v);B&&(e=ma);c||(c=B?z.parent():z);if(d){var f=g.$$slots[d];if(f)return f(a,b,e,c,Eb);if(x(f))throw ja(\"noslot\",d,ta(z));}else return g(a,b,e,c,Eb)}var m,p,t,w,ma,S,z,Ja;b===e?(f=d,z=d.$$element):(z=C(e),f=new na(z,d));t=c;P?w=c.$new(!0):Q&&(t=c.$parent);g&&(S=k,S.$$boundTransclude=g,S.isSlotFilled=function(a){return!!g.$$slots[a]});\nI&&(ma=A(z,f,S,I,w,c));P&&(M.$$addScopeInfo(z,w,!0,!($&&($===P||$===P.$$originalDirective))),M.$$addScopeClass(z,!0),w.$$isolateBindings=P.$$isolateBindings,(Ja=ia(c,f,w,w.$$isolateBindings,P))&&w.$on(\"$destroy\",Ja));for(p in ma){Ja=I[p];var K=ma[p],la=Ja.$$bindings.bindToController;K.identifier&&la&&(m=ia(t,f,K.instance,la,Ja));var q=K();q!==K.instance&&(K.instance=q,z.data(\"$\"+Ja.name+\"Controller\",q),m&&m(),m=ia(t,f,K.instance,la,Ja))}n(I,function(a,b){var c=a.require;a.bindToController&&!L(c)&&\nE(c)&&T(ma[b].instance,s(b,c,z,ma))});n(ma,function(a){D(a.instance.$onInit)&&a.instance.$onInit()});m=0;for(p=h.length;m<p;m++)t=h[m],ka(t,t.isolateScope?w:c,z,f,t.require&&s(t.directiveName,t.require,z,ma),S);var Eb=c;P&&(P.template||null===P.templateUrl)&&(Eb=w);a&&a(Eb,e.childNodes,v,g);for(m=l.length-1;0<=m;m--)t=l[m],ka(t,t.isolateScope?w:c,z,f,t.require&&s(t.directiveName,t.require,z,ma),S)}m=m||{};for(var t=-Number.MAX_VALUE,Q=m.newScopeDirective,I=m.controllerDirectives,P=m.newIsolateScopeDirective,\n$=m.templateDirective,S=m.nonTlbTranscludeDirective,z=!1,la=!1,B=m.hasElementTranscludeDirective,ea=d.$$element=C(b),J,H,G,ya=e,O,N=!1,Fb=!1,fa,R=0,Va=a.length;R<Va;R++){J=a[R];var Y=J.$$start,ba=J.$$end;Y&&(ea=q(b,Y,ba));G=v;if(t>J.priority)break;if(fa=J.scope)J.templateUrl||(E(fa)?(Wa(\"new/isolated scope\",P||Q,J,ea),P=J):Wa(\"new/isolated scope\",P,J,ea)),Q=Q||J;H=J.name;if(!N&&(J.replace&&(J.templateUrl||J.template)||J.transclude&&!J.$$tlb)){for(fa=R+1;N=a[fa++];)if(N.transclude&&!N.$$tlb||N.replace&&\n(N.templateUrl||N.template)){Fb=!0;break}N=!0}!J.templateUrl&&J.controller&&(fa=J.controller,I=I||Z(),Wa(\"'\"+H+\"' controller\",I[H],J,ea),I[H]=J);if(fa=J.transclude)if(z=!0,J.$$tlb||(Wa(\"transclusion\",S,J,ea),S=J),\"element\"==fa)B=!0,t=J.priority,G=ea,ea=d.$$element=C(W.createComment(\" \"+H+\": \"+d[H]+\" \")),b=ea[0],aa(f,wa.call(G,0),b),ya=ac(Fb,G,e,t,g&&g.name,{nonTlbTranscludeDirective:S});else{var V=Z();G=C(Yb(b)).contents();if(E(fa)){G=[];var ha=Z(),da=Z();n(fa,function(a,b){var c=\"?\"===a.charAt(0);\na=c?a.substring(1):a;ha[a]=b;V[b]=null;da[b]=c});n(ea.contents(),function(a){var b=ha[va(ra(a))];b?(da[b]=!0,V[b]=V[b]||[],V[b].push(a)):G.push(a)});n(da,function(a,b){if(!a)throw ja(\"reqslot\",b);});for(var ga in V)V[ga]&&(V[ga]=ac(Fb,V[ga],e))}ea.empty();ya=ac(Fb,G,e,v,v,{needsNewScope:J.$$isolateScope||J.$$newScope});ya.$$slots=V}if(J.template)if(la=!0,Wa(\"template\",$,J,ea),$=J,fa=D(J.template)?J.template(ea,d):J.template,fa=qa(fa),J.replace){g=J;G=Wb.test(fa)?Zc(U(J.templateNamespace,X(fa))):[];\nb=G[0];if(1!=G.length||1!==b.nodeType)throw ja(\"tplrt\",H,\"\");aa(f,ea,b);Va={$attr:{}};fa=ma(b,[],Va);var oa=a.splice(R+1,a.length-(R+1));(P||Q)&&$c(fa,P,Q);a=a.concat(fa).concat(oa);ad(d,Va);Va=a.length}else ea.html(fa);if(J.templateUrl)la=!0,Wa(\"template\",$,J,ea),$=J,J.replace&&(g=J),u=$f(a.splice(R,a.length-R),ea,d,f,z&&ya,h,l,{controllerDirectives:I,newScopeDirective:Q!==J&&Q,newIsolateScopeDirective:P,templateDirective:$,nonTlbTranscludeDirective:S}),Va=a.length;else if(J.compile)try{O=J.compile(ea,\nd,ya),D(O)?p(null,O,Y,ba):O&&p(O.pre,O.post,Y,ba)}catch(pa){c(pa,ta(ea))}J.terminal&&(u.terminal=!0,t=Math.max(t,J.priority))}u.scope=Q&&!0===Q.scope;u.transcludeOnThisElement=z;u.templateOnThisElement=la;u.transclude=ya;m.hasElementTranscludeDirective=B;return u}function $c(a,b,c){for(var d=0,e=a.length;d<e;d++)a[d]=Sb(a[d],{$$isolateScope:b,$$newScope:c})}function H(b,d,f,g,h,k,l){if(d===h)return null;h=null;if(e.hasOwnProperty(d)){var m;d=a.get(d+\"Directive\");for(var p=0,A=d.length;p<A;p++)try{m=\nd[p],(x(g)||g>m.priority)&&-1!=m.restrict.indexOf(f)&&(k&&(m=Sb(m,{$$start:k,$$end:l})),b.push(m),h=m)}catch(t){c(t)}}return h}function O(b){if(e.hasOwnProperty(b))for(var c=a.get(b+\"Directive\"),d=0,f=c.length;d<f;d++)if(b=c[d],b.multiElement)return!0;return!1}function ad(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;n(a,function(d,e){\"$\"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=(\"style\"===e?\";\":\" \")+b[e]),a.$set(e,d,!0,c[e]))});n(b,function(b,f){\"class\"==f?($(e,b),a[\"class\"]=(a[\"class\"]?a[\"class\"]+\" \":\"\")+\nb):\"style\"==f?(e.attr(\"style\",e.attr(\"style\")+\";\"+b),a.style=(a.style?a.style+\";\":\"\")+b):\"$\"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function $f(a,b,c,e,f,g,h,k){var l=[],m,p,s=b[0],A=a.shift(),u=Sb(A,{templateUrl:null,transclude:null,replace:null,$$originalDirective:A}),w=D(A.templateUrl)?A.templateUrl(b,c):A.templateUrl,Q=A.templateNamespace;b.empty();d(w).then(function(d){var t,I;d=qa(d);if(A.replace){d=Wb.test(d)?Zc(U(Q,X(d))):[];t=d[0];if(1!=d.length||1!==t.nodeType)throw ja(\"tplrt\",\nA.name,w);d={$attr:{}};aa(e,b,t);var M=ma(t,[],d);E(A.scope)&&$c(M,!0);a=M.concat(a);ad(c,d)}else t=s,b.html(d);a.unshift(u);m=y(a,t,c,f,b,A,g,h,k);n(e,function(a,c){a==t&&(e[c]=b[0])});for(p=P(b[0].childNodes,f);l.length;){d=l.shift();I=l.shift();var z=l.shift(),K=l.shift(),M=b[0];if(!d.$$destroyed){if(I!==s){var la=I.className;k.hasElementTranscludeDirective&&A.replace||(M=Yb(t));aa(z,C(I),M);$(C(M),la)}I=m.transcludeOnThisElement?S(d,m.transclude,K):K;m(p,d,M,e,I)}}l=null});return function(a,b,\nc,d,e){a=e;b.$$destroyed||(l?l.push(b,c,d,a):(m.transcludeOnThisElement&&(a=S(b,m.transclude,e)),m(p,b,c,d,a)))}}function ya(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function Wa(a,b,c,d){function e(a){return a?\" (module: \"+a+\")\":\"\"}if(b)throw ja(\"multidir\",b.name,e(b.$$moduleName),c.name,e(c.$$moduleName),a,ta(d));}function N(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a=a.parent();var b=!!a.length;b&&M.$$addBindingClass(a);\nreturn function(a,c){var e=c.parent();b||M.$$addBindingClass(e);M.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function U(a,b){a=G(a||\"html\");switch(a){case \"svg\":case \"math\":var c=W.createElement(\"div\");c.innerHTML=\"<\"+a+\">\"+b+\"</\"+a+\">\";return c.childNodes[0].childNodes;default:return b}}function R(a,b){if(\"srcdoc\"==b)return la.HTML;var c=ra(a);if(\"xlinkHref\"==b||\"form\"==c&&\"action\"==b||\"img\"!=c&&(\"src\"==b||\"ngSrc\"==b))return la.RESOURCE_URL}function Y(a,c,d,e,\nf){var g=R(a,e);f=h[e]||f;var k=b(d,!0,g,f);if(k){if(\"multiple\"===e&&\"select\"===ra(a))throw ja(\"selmulti\",ta(a));c.push({priority:100,compile:function(){return{pre:function(a,c,h){c=h.$$observers||(h.$$observers=Z());if(l.test(e))throw ja(\"nodomevents\");var m=h[e];m!==d&&(k=m&&b(m,!0,g,f),d=m);k&&(h[e]=k(a),(c[e]||(c[e]=[])).$$inter=!0,(h.$$observers&&h.$$observers[e].$$scope||a).$watch(k,function(a,b){\"class\"===e&&a!=b?h.$updateClass(a,b):h.$set(e,a)}))}}}})}}function aa(a,b,c){var d=b[0],e=b.length,\nf=d.parentNode,g,h;if(a)for(g=0,h=a.length;g<h;g++)if(a[g]==d){a[g++]=c;h=g+e-1;for(var k=a.length;g<k;g++,h++)h<k?a[g]=a[h]:delete a[g];a.length-=e-1;a.context===d&&(a.context=c);break}f&&f.replaceChild(c,d);a=W.createDocumentFragment();for(g=0;g<e;g++)a.appendChild(b[g]);C.hasData(d)&&(C.data(c,C.data(d)),C(d).off(\"$destroy\"));C.cleanData(a.querySelectorAll(\"*\"));for(g=1;g<e;g++)delete b[g];b[0]=c;b.length=1}function ca(a,b){return T(function(){return a.apply(null,arguments)},a,b)}function ka(a,\nb,d,e,f,g){try{a(b,d,e,f,g)}catch(h){c(h,ta(d))}}function ia(a,c,d,e,f){var g=[];n(e,function(e,h){var k=e.attrName,l=e.optional,m,A,s,t;switch(e.mode){case \"@\":l||sa.call(c,k)||(d[h]=c[k]=void 0);c.$observe(k,function(a){F(a)&&(d[h]=a)});c.$$observers[k].$$scope=a;m=c[k];F(m)?d[h]=b(m)(a):Na(m)&&(d[h]=m);break;case \"=\":if(!sa.call(c,k)){if(l)break;c[k]=void 0}if(l&&!c[k])break;A=p(c[k]);t=A.literal?oa:function(a,b){return a===b||a!==a&&b!==b};s=A.assign||function(){m=d[h]=A(a);throw ja(\"nonassign\",\nc[k],k,f.name);};m=d[h]=A(a);l=function(b){t(b,d[h])||(t(b,m)?s(a,b=d[h]):d[h]=b);return m=b};l.$stateful=!0;l=e.collection?a.$watchCollection(c[k],l):a.$watch(p(c[k],l),null,A.literal);g.push(l);break;case \"<\":if(!sa.call(c,k)){if(l)break;c[k]=void 0}if(l&&!c[k])break;A=p(c[k]);d[h]=A(a);l=a.$watch(A,function(a){d[h]=a},A.literal);g.push(l);break;case \"&\":A=c.hasOwnProperty(k)?p(c[k]):B;if(A===B&&l)break;d[h]=function(b){return A(a,b)}}});return g.length&&function(){for(var a=0,b=g.length;a<b;++a)g[a]()}}\nvar V=/^\\w/,ba=W.createElement(\"div\"),na=function(a,b){if(b){var c=Object.keys(b),d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr={};this.$$element=a};na.prototype={$normalize:va,$addClass:function(a){a&&0<a.length&&z.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&z.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=bd(a,b);c&&c.length&&z.addClass(this.$$element,c);(c=bd(b,a))&&c.length&&z.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=\nTc(this.$$element[0],a),g=cd[a],h=a;f?(this.$$element.prop(a,b),e=f):g&&(this[g]=b,h=g);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=Bc(a,\"-\"));f=ra(this.$$element);if(\"a\"===f&&(\"href\"===a||\"xlinkHref\"===a)||\"img\"===f&&\"src\"===a)this[a]=b=A(b,\"src\"===a);else if(\"img\"===f&&\"srcset\"===a){for(var f=\"\",g=X(b),k=/(\\s+\\d+x\\s*,|\\s+\\d+w\\s*,|\\s+,|,\\s+)/,k=/\\s/.test(g)?k:/(,)/,g=g.split(k),k=Math.floor(g.length/2),l=0;l<k;l++)var m=2*l,f=f+A(X(g[m]),!0),f=f+(\" \"+X(g[m+1]));g=X(g[2*l]).split(/\\s/);\nf+=A(X(g[0]),!0);2===g.length&&(f+=\" \"+X(g[1]));this[a]=b=f}!1!==d&&(null===b||x(b)?this.$$element.removeAttr(e):V.test(e)?this.$$element.attr(e,b):Q(this.$$element[0],e,b));(a=this.$$observers)&&n(a[h],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers=Z()),e=d[a]||(d[a]=[]);e.push(b);u.$evalAsync(function(){e.$$inter||!c.hasOwnProperty(a)||x(c[a])||b(c[a])});return function(){cb(e,b)}}};var ha=b.startSymbol(),da=b.endSymbol(),qa=\"{{\"==ha&&\"}}\"==\nda?ab:function(a){return a.replace(/\\{\\{/g,ha).replace(/}}/g,da)},pa=/^ngAttr[A-Z]/,ua=/^(.+)Start$/;M.$$addBindingInfo=m?function(a,b){var c=a.data(\"$binding\")||[];L(b)?c=c.concat(b):c.push(b);a.data(\"$binding\",c)}:B;M.$$addBindingClass=m?function(a){$(a,\"ng-binding\")}:B;M.$$addScopeInfo=m?function(a,b,c,d){a.data(c?d?\"$isolateScopeNoTemplate\":\"$isolateScope\":\"$scope\",b)}:B;M.$$addScopeClass=m?function(a,b){$(a,b?\"ng-isolate-scope\":\"ng-scope\")}:B;return M}]}function va(a){return gb(a.replace(Xc,\n\"\"))}function bd(a,b){var d=\"\",c=a.split(/\\s+/),e=b.split(/\\s+/),f=0;a:for(;f<c.length;f++){for(var g=c[f],h=0;h<e.length;h++)if(g==e[h])continue a;d+=(0<d.length?\" \":\"\")+g}return d}function Zc(a){a=C(a);var b=a.length;if(1>=b)return a;for(;b--;)8===a[b].nodeType&&ag.call(a,b,1);return a}function Wc(a,b){if(b&&F(b))return b;if(F(a)){var d=dd.exec(a);if(d)return d[3]}}function ff(){var a={},b=!1;this.register=function(b,c){Ta(b,\"controller\");E(b)?T(a,b):a[b]=c};this.allowGlobals=function(){b=!0};this.$get=\n[\"$injector\",\"$window\",function(d,c){function e(a,b,c,d){if(!a||!E(a.$scope))throw H(\"$controller\")(\"noscp\",d,b);a.$scope[b]=c}return function(f,g,h,k){var l,m,r;h=!0===h;k&&F(k)&&(r=k);if(F(f)){k=f.match(dd);if(!k)throw bg(\"ctrlfmt\",f);m=k[1];r=r||k[3];f=a.hasOwnProperty(m)?a[m]:Dc(g.$scope,m,!0)||(b?Dc(c,m,!0):v);Sa(f,m,!0)}if(h)return h=(L(f)?f[f.length-1]:f).prototype,l=Object.create(h||null),r&&e(g,r,l,m||f.name),T(function(){var a=d.invoke(f,l,g,m);a!==l&&(E(a)||D(a))&&(l=a,r&&e(g,r,l,m||f.name));\nreturn l},{instance:l,identifier:r});l=d.instantiate(f,g,m);r&&e(g,r,l,m||f.name);return l}}]}function gf(){this.$get=[\"$window\",function(a){return C(a.document)}]}function hf(){this.$get=[\"$log\",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function bc(a){return E(a)?V(a)?a.toISOString():eb(a):a}function nf(){this.$get=function(){return function(a){if(!a)return\"\";var b=[];rc(a,function(a,c){null===a||x(a)||(L(a)?n(a,function(a,d){b.push(ha(c)+\"=\"+ha(bc(a)))}):b.push(ha(c)+\"=\"+ha(bc(a))))});\nreturn b.join(\"&\")}}}function of(){this.$get=function(){return function(a){function b(a,e,f){null===a||x(a)||(L(a)?n(a,function(a,c){b(a,e+\"[\"+(E(a)?c:\"\")+\"]\")}):E(a)&&!V(a)?rc(a,function(a,c){b(a,e+(f?\"\":\"[\")+c+(f?\"\":\"]\"))}):d.push(ha(e)+\"=\"+ha(bc(a))))}if(!a)return\"\";var d=[];b(a,\"\",!0);return d.join(\"&\")}}}function cc(a,b){if(F(a)){var d=a.replace(cg,\"\").trim();if(d){var c=b(\"Content-Type\");(c=c&&0===c.indexOf(ed))||(c=(c=d.match(dg))&&eg[c[0]].test(d));c&&(a=wc(d))}}return a}function fd(a){var b=\nZ(),d;F(a)?n(a.split(\"\\n\"),function(a){d=a.indexOf(\":\");var e=G(X(a.substr(0,d)));a=X(a.substr(d+1));e&&(b[e]=b[e]?b[e]+\", \"+a:a)}):E(a)&&n(a,function(a,d){var f=G(d),g=X(a);f&&(b[f]=b[f]?b[f]+\", \"+g:g)});return b}function gd(a){var b;return function(d){b||(b=fd(a));return d?(d=b[G(d)],void 0===d&&(d=null),d):b}}function hd(a,b,d,c){if(D(c))return c(a,b,d);n(c,function(c){a=c(a,b,d)});return a}function mf(){var a=this.defaults={transformResponse:[cc],transformRequest:[function(a){return E(a)&&\"[object File]\"!==\nga.call(a)&&\"[object Blob]\"!==ga.call(a)&&\"[object FormData]\"!==ga.call(a)?eb(a):a}],headers:{common:{Accept:\"application/json, text/plain, */*\"},post:na(dc),put:na(dc),patch:na(dc)},xsrfCookieName:\"XSRF-TOKEN\",xsrfHeaderName:\"X-XSRF-TOKEN\",paramSerializer:\"$httpParamSerializer\"},b=!1;this.useApplyAsync=function(a){return y(a)?(b=!!a,this):b};var d=!0;this.useLegacyPromiseExtensions=function(a){return y(a)?(d=!!a,this):d};var c=this.interceptors=[];this.$get=[\"$httpBackend\",\"$$cookieReader\",\"$cacheFactory\",\n\"$rootScope\",\"$q\",\"$injector\",function(e,f,g,h,k,l){function m(b){function c(a){var b=T({},a);b.data=hd(a.data,a.headers,a.status,f.transformResponse);a=a.status;return 200<=a&&300>a?b:k.reject(b)}function e(a,b){var c,d={};n(a,function(a,e){D(a)?(c=a(b),null!=c&&(d[e]=c)):d[e]=a});return d}if(!E(b))throw H(\"$http\")(\"badreq\",b);if(!F(b.url))throw H(\"$http\")(\"badreq\",b.url);var f=T({method:\"get\",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer},\nb);f.headers=function(b){var c=a.headers,d=T({},b.headers),f,g,h,c=T({},c.common,c[G(b.method)]);a:for(f in c){g=G(f);for(h in d)if(G(h)===g)continue a;d[f]=c[f]}return e(d,na(b))}(b);f.method=ub(f.method);f.paramSerializer=F(f.paramSerializer)?l.get(f.paramSerializer):f.paramSerializer;var g=[function(b){var d=b.headers,e=hd(b.data,gd(d),v,b.transformRequest);x(e)&&n(d,function(a,b){\"content-type\"===G(b)&&delete d[b]});x(b.withCredentials)&&!x(a.withCredentials)&&(b.withCredentials=a.withCredentials);\nreturn r(b,e).then(c,c)},v],h=k.when(f);for(n(K,function(a){(a.request||a.requestError)&&g.unshift(a.request,a.requestError);(a.response||a.responseError)&&g.push(a.response,a.responseError)});g.length;){b=g.shift();var m=g.shift(),h=h.then(b,m)}d?(h.success=function(a){Sa(a,\"fn\");h.then(function(b){a(b.data,b.status,b.headers,f)});return h},h.error=function(a){Sa(a,\"fn\");h.then(null,function(b){a(b.data,b.status,b.headers,f)});return h}):(h.success=id(\"success\"),h.error=id(\"error\"));return h}function r(c,\nd){function g(a,c,d,e){function f(){l(c,a,d,e)}K&&(200<=a&&300>a?K.put(S,[a,c,fd(d),e]):K.remove(S));b?h.$applyAsync(f):(f(),h.$$phase||h.$apply())}function l(a,b,d,e){b=-1<=b?b:0;(200<=b&&300>b?A.resolve:A.reject)({data:a,status:b,headers:gd(d),config:c,statusText:e})}function r(a){l(a.data,a.status,na(a.headers()),a.statusText)}function z(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var A=k.defer(),Q=A.promise,K,M,P=c.headers,S=s(c.url,c.paramSerializer(c.params));\nm.pendingRequests.push(c);Q.then(z,z);!c.cache&&!a.cache||!1===c.cache||\"GET\"!==c.method&&\"JSONP\"!==c.method||(K=E(c.cache)?c.cache:E(a.cache)?a.cache:I);K&&(M=K.get(S),y(M)?M&&D(M.then)?M.then(r,r):L(M)?l(M[1],M[0],na(M[2]),M[3]):l(M,200,{},\"OK\"):K.put(S,Q));x(M)&&((M=jd(c.url)?f()[c.xsrfCookieName||a.xsrfCookieName]:v)&&(P[c.xsrfHeaderName||a.xsrfHeaderName]=M),e(c.method,S,d,g,P,c.timeout,c.withCredentials,c.responseType));return Q}function s(a,b){0<b.length&&(a+=(-1==a.indexOf(\"?\")?\"?\":\"&\")+b);\nreturn a}var I=g(\"$http\");a.paramSerializer=F(a.paramSerializer)?l.get(a.paramSerializer):a.paramSerializer;var K=[];n(c,function(a){K.unshift(F(a)?l.get(a):l.invoke(a))});m.pendingRequests=[];(function(a){n(arguments,function(a){m[a]=function(b,c){return m(T({},c||{},{method:a,url:b}))}})})(\"get\",\"delete\",\"head\",\"jsonp\");(function(a){n(arguments,function(a){m[a]=function(b,c,d){return m(T({},d||{},{method:a,url:b,data:c}))}})})(\"post\",\"put\",\"patch\");m.defaults=a;return m}]}function qf(){this.$get=\nfunction(){return function(){return new O.XMLHttpRequest}}}function pf(){this.$get=[\"$browser\",\"$window\",\"$document\",\"$xhrFactory\",function(a,b,d,c){return fg(a,c,a.defer,b.angular.callbacks,d[0])}]}function fg(a,b,d,c,e){function f(a,b,d){var f=e.createElement(\"script\"),m=null;f.type=\"text/javascript\";f.src=a;f.async=!0;m=function(a){f.removeEventListener(\"load\",m,!1);f.removeEventListener(\"error\",m,!1);e.body.removeChild(f);f=null;var g=-1,I=\"unknown\";a&&(\"load\"!==a.type||c[b].called||(a={type:\"error\"}),\nI=a.type,g=\"error\"===a.type?404:200);d&&d(g,I)};f.addEventListener(\"load\",m,!1);f.addEventListener(\"error\",m,!1);e.body.appendChild(f);return m}return function(e,h,k,l,m,r,s,I){function K(){w&&w();u&&u.abort()}function t(b,c,e,f,g){y(z)&&d.cancel(z);w=u=null;b(c,e,f,g);a.$$completeOutstandingRequest(B)}a.$$incOutstandingRequestCount();h=h||a.url();if(\"jsonp\"==G(e)){var p=\"_\"+(c.counter++).toString(36);c[p]=function(a){c[p].data=a;c[p].called=!0};var w=f(h.replace(\"JSON_CALLBACK\",\"angular.callbacks.\"+\np),p,function(a,b){t(l,a,c[p].data,\"\",b);c[p]=B})}else{var u=b(e,h);u.open(e,h,!0);n(m,function(a,b){y(a)&&u.setRequestHeader(b,a)});u.onload=function(){var a=u.statusText||\"\",b=\"response\"in u?u.response:u.responseText,c=1223===u.status?204:u.status;0===c&&(c=b?200:\"file\"==za(h).protocol?404:0);t(l,c,b,u.getAllResponseHeaders(),a)};e=function(){t(l,-1,null,null,\"\")};u.onerror=e;u.onabort=e;s&&(u.withCredentials=!0);if(I)try{u.responseType=I}catch(la){if(\"json\"!==I)throw la;}u.send(x(k)?null:k)}if(0<\nr)var z=d(K,r);else r&&D(r.then)&&r.then(K)}}function kf(){var a=\"{{\",b=\"}}\";this.startSymbol=function(b){return b?(a=b,this):a};this.endSymbol=function(a){return a?(b=a,this):b};this.$get=[\"$parse\",\"$exceptionHandler\",\"$sce\",function(d,c,e){function f(a){return\"\\\\\\\\\\\\\"+a}function g(c){return c.replace(r,a).replace(s,b)}function h(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function k(f,k,r,p){function s(a){try{var b=a;a=r?e.getTrusted(r,b):e.valueOf(b);var d;if(p&&!y(a))d=\na;else if(null==a)d=\"\";else{switch(typeof a){case \"string\":break;case \"number\":a=\"\"+a;break;default:a=eb(a)}d=a}return d}catch(g){c(Ka.interr(f,g))}}if(!f.length||-1===f.indexOf(a)){var u;k||(k=g(f),u=ba(k),u.exp=f,u.expressions=[],u.$$watchDelegate=h);return u}p=!!p;var n,z,A=0,Q=[],$=[];u=f.length;for(var M=[],P=[];A<u;)if(-1!=(n=f.indexOf(a,A))&&-1!=(z=f.indexOf(b,n+l)))A!==n&&M.push(g(f.substring(A,n))),A=f.substring(n+l,z),Q.push(A),$.push(d(A,s)),A=z+m,P.push(M.length),M.push(\"\");else{A!==u&&\nM.push(g(f.substring(A)));break}r&&1<M.length&&Ka.throwNoconcat(f);if(!k||Q.length){var S=function(a){for(var b=0,c=Q.length;b<c;b++){if(p&&x(a[b]))return;M[P[b]]=a[b]}return M.join(\"\")};return T(function(a){var b=0,d=Q.length,e=Array(d);try{for(;b<d;b++)e[b]=$[b](a);return S(e)}catch(g){c(Ka.interr(f,g))}},{exp:f,expressions:Q,$$watchDelegate:function(a,b){var c;return a.$watchGroup($,function(d,e){var f=S(d);D(b)&&b.call(this,f,d!==e?c:f,a);c=f})}})}}var l=a.length,m=b.length,r=new RegExp(a.replace(/./g,\nf),\"g\"),s=new RegExp(b.replace(/./g,f),\"g\");k.startSymbol=function(){return a};k.endSymbol=function(){return b};return k}]}function lf(){this.$get=[\"$rootScope\",\"$window\",\"$q\",\"$$q\",\"$browser\",function(a,b,d,c,e){function f(f,k,l,m){function r(){s?f.apply(null,I):f(p)}var s=4<arguments.length,I=s?wa.call(arguments,4):[],K=b.setInterval,t=b.clearInterval,p=0,w=y(m)&&!m,u=(w?c:d).defer(),n=u.promise;l=y(l)?l:0;n.$$intervalId=K(function(){w?e.defer(r):a.$evalAsync(r);u.notify(p++);0<l&&p>=l&&(u.resolve(p),\nt(n.$$intervalId),delete g[n.$$intervalId]);w||a.$apply()},k);g[n.$$intervalId]=u;return n}var g={};f.cancel=function(a){return a&&a.$$intervalId in g?(g[a.$$intervalId].reject(\"canceled\"),b.clearInterval(a.$$intervalId),delete g[a.$$intervalId],!0):!1};return f}]}function ec(a){a=a.split(\"/\");for(var b=a.length;b--;)a[b]=qb(a[b]);return a.join(\"/\")}function kd(a,b){var d=za(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=ca(d.port)||gg[d.protocol]||null}function ld(a,b){var d=\"/\"!==a.charAt(0);\nd&&(a=\"/\"+a);var c=za(a);b.$$path=decodeURIComponent(d&&\"/\"===c.pathname.charAt(0)?c.pathname.substring(1):c.pathname);b.$$search=zc(c.search);b.$$hash=decodeURIComponent(c.hash);b.$$path&&\"/\"!=b.$$path.charAt(0)&&(b.$$path=\"/\"+b.$$path)}function pa(a,b){if(0===b.indexOf(a))return b.substr(a.length)}function Ia(a){var b=a.indexOf(\"#\");return-1==b?a:a.substr(0,b)}function kb(a){return a.replace(/(#.+)|#$/,\"$1\")}function fc(a,b,d){this.$$html5=!0;d=d||\"\";kd(a,this);this.$$parse=function(a){var d=pa(b,\na);if(!F(d))throw Gb(\"ipthprfx\",a,b);ld(d,this);this.$$path||(this.$$path=\"/\");this.$$compose()};this.$$compose=function(){var a=Ub(this.$$search),d=this.$$hash?\"#\"+qb(this.$$hash):\"\";this.$$url=ec(this.$$path)+(a?\"?\"+a:\"\")+d;this.$$absUrl=b+this.$$url.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&\"#\"===e[0])return this.hash(e.slice(1)),!0;var f,g;y(f=pa(a,c))?(g=f,g=y(f=pa(d,f))?b+(pa(\"/\",f)||f):a+g):y(f=pa(b,c))?g=b+f:b==c+\"/\"&&(g=b);g&&this.$$parse(g);return!!g}}function gc(a,b,d){kd(a,this);\nthis.$$parse=function(c){var e=pa(a,c)||pa(b,c),f;x(e)||\"#\"!==e.charAt(0)?this.$$html5?f=e:(f=\"\",x(e)&&(a=c,this.replace())):(f=pa(d,e),x(f)&&(f=e));ld(f,this);c=this.$$path;var e=a,g=/^\\/[A-Z]:(\\/.*)/;0===f.indexOf(e)&&(f=f.replace(e,\"\"));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$compose=function(){var b=Ub(this.$$search),e=this.$$hash?\"#\"+qb(this.$$hash):\"\";this.$$url=ec(this.$$path)+(b?\"?\"+b:\"\")+e;this.$$absUrl=a+(this.$$url?d+this.$$url:\"\")};this.$$parseLinkUrl=\nfunction(b,d){return Ia(a)==Ia(b)?(this.$$parse(b),!0):!1}}function md(a,b,d){this.$$html5=!0;gc.apply(this,arguments);this.$$parseLinkUrl=function(c,e){if(e&&\"#\"===e[0])return this.hash(e.slice(1)),!0;var f,g;a==Ia(c)?f=c:(g=pa(b,c))?f=a+d+g:b===c+\"/\"&&(f=b);f&&this.$$parse(f);return!!f};this.$$compose=function(){var b=Ub(this.$$search),e=this.$$hash?\"#\"+qb(this.$$hash):\"\";this.$$url=ec(this.$$path)+(b?\"?\"+b:\"\")+e;this.$$absUrl=a+d+this.$$url}}function Hb(a){return function(){return this[a]}}function nd(a,\nb){return function(d){if(x(d))return this[a];this[a]=b(d);this.$$compose();return this}}function rf(){var a=\"\",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return y(b)?(a=b,this):a};this.html5Mode=function(a){return Na(a)?(b.enabled=a,this):E(a)?(Na(a.enabled)&&(b.enabled=a.enabled),Na(a.requireBase)&&(b.requireBase=a.requireBase),Na(a.rewriteLinks)&&(b.rewriteLinks=a.rewriteLinks),this):b};this.$get=[\"$rootScope\",\"$browser\",\"$sniffer\",\"$rootElement\",\"$window\",function(d,\nc,e,f,g){function h(a,b,d){var e=l.url(),f=l.$$state;try{c.url(a,b,d),l.$$state=c.state()}catch(g){throw l.url(e),l.$$state=f,g;}}function k(a,b){d.$broadcast(\"$locationChangeSuccess\",l.absUrl(),a,l.$$state,b)}var l,m;m=c.baseHref();var r=c.url(),s;if(b.enabled){if(!m&&b.requireBase)throw Gb(\"nobase\");s=r.substring(0,r.indexOf(\"/\",r.indexOf(\"//\")+2))+(m||\"/\");m=e.history?fc:md}else s=Ia(r),m=gc;var I=s.substr(0,Ia(s).lastIndexOf(\"/\")+1);l=new m(s,I,\"#\"+a);l.$$parseLinkUrl(r,r);l.$$state=c.state();\nvar n=/^\\s*(javascript|mailto):/i;f.on(\"click\",function(a){if(b.rewriteLinks&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!=a.which&&2!=a.button){for(var e=C(a.target);\"a\"!==ra(e[0]);)if(e[0]===f[0]||!(e=e.parent())[0])return;var h=e.prop(\"href\"),k=e.attr(\"href\")||e.attr(\"xlink:href\");E(h)&&\"[object SVGAnimatedString]\"===h.toString()&&(h=za(h.animVal).href);n.test(h)||!h||e.attr(\"target\")||a.isDefaultPrevented()||!l.$$parseLinkUrl(h,k)||(a.preventDefault(),l.absUrl()!=c.url()&&(d.$apply(),g.angular[\"ff-684208-preventDefault\"]=\n!0))}});kb(l.absUrl())!=kb(r)&&c.url(l.absUrl(),!0);var t=!0;c.onUrlChange(function(a,b){x(pa(I,a))?g.location.href=a:(d.$evalAsync(function(){var c=l.absUrl(),e=l.$$state,f;a=kb(a);l.$$parse(a);l.$$state=b;f=d.$broadcast(\"$locationChangeStart\",a,c,b,e).defaultPrevented;l.absUrl()===a&&(f?(l.$$parse(c),l.$$state=e,h(c,!1,e)):(t=!1,k(c,e)))}),d.$$phase||d.$digest())});d.$watch(function(){var a=kb(c.url()),b=kb(l.absUrl()),f=c.state(),g=l.$$replace,m=a!==b||l.$$html5&&e.history&&f!==l.$$state;if(t||\nm)t=!1,d.$evalAsync(function(){var b=l.absUrl(),c=d.$broadcast(\"$locationChangeStart\",b,a,l.$$state,f).defaultPrevented;l.absUrl()===b&&(c?(l.$$parse(a),l.$$state=f):(m&&h(b,g,f===l.$$state?null:l.$$state),k(a,f)))});l.$$replace=!1});return l}]}function sf(){var a=!0,b=this;this.debugEnabled=function(b){return y(b)?(a=b,this):a};this.$get=[\"$window\",function(d){function c(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?\"Error: \"+a.message+\"\\n\"+a.stack:a.stack:a.sourceURL&&\n(a=a.message+\"\\n\"+a.sourceURL+\":\"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||B;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];n(arguments,function(b){a.push(c(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?\"\":b)}}return{log:e(\"log\"),info:e(\"info\"),warn:e(\"warn\"),error:e(\"error\"),debug:function(){var c=e(\"debug\");return function(){a&&c.apply(b,arguments)}}()}}]}function Xa(a,b){if(\"__defineGetter__\"===a||\"__defineSetter__\"===a||\"__lookupGetter__\"===a||\"__lookupSetter__\"===\na||\"__proto__\"===a)throw ka(\"isecfld\",b);return a}function hg(a){return a+\"\"}function Aa(a,b){if(a){if(a.constructor===a)throw ka(\"isecfn\",b);if(a.window===a)throw ka(\"isecwindow\",b);if(a.children&&(a.nodeName||a.prop&&a.attr&&a.find))throw ka(\"isecdom\",b);if(a===Object)throw ka(\"isecobj\",b);}return a}function od(a,b){if(a){if(a.constructor===a)throw ka(\"isecfn\",b);if(a===ig||a===jg||a===kg)throw ka(\"isecff\",b);}}function Ib(a,b){if(a&&(a===(0).constructor||a===(!1).constructor||a===\"\".constructor||\na==={}.constructor||a===[].constructor||a===Function.constructor))throw ka(\"isecaf\",b);}function lg(a,b){return\"undefined\"!==typeof a?a:b}function pd(a,b){return\"undefined\"===typeof a?b:\"undefined\"===typeof b?a:a+b}function R(a,b){var d,c;switch(a.type){case q.Program:d=!0;n(a.body,function(a){R(a.expression,b);d=d&&a.expression.constant});a.constant=d;break;case q.Literal:a.constant=!0;a.toWatch=[];break;case q.UnaryExpression:R(a.argument,b);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;\nbreak;case q.BinaryExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.left.toWatch.concat(a.right.toWatch);break;case q.LogicalExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case q.ConditionalExpression:R(a.test,b);R(a.alternate,b);R(a.consequent,b);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case q.Identifier:a.constant=!1;a.toWatch=\n[a];break;case q.MemberExpression:R(a.object,b);a.computed&&R(a.property,b);a.constant=a.object.constant&&(!a.computed||a.property.constant);a.toWatch=[a];break;case q.CallExpression:d=a.filter?!b(a.callee.name).$stateful:!1;c=[];n(a.arguments,function(a){R(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=a.filter&&!b(a.callee.name).$stateful?c:[a];break;case q.AssignmentExpression:R(a.left,b);R(a.right,b);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];\nbreak;case q.ArrayExpression:d=!0;c=[];n(a.elements,function(a){R(a,b);d=d&&a.constant;a.constant||c.push.apply(c,a.toWatch)});a.constant=d;a.toWatch=c;break;case q.ObjectExpression:d=!0;c=[];n(a.properties,function(a){R(a.value,b);d=d&&a.value.constant;a.value.constant||c.push.apply(c,a.value.toWatch)});a.constant=d;a.toWatch=c;break;case q.ThisExpression:a.constant=!1;a.toWatch=[];break;case q.LocalsExpression:a.constant=!1,a.toWatch=[]}}function qd(a){if(1==a.length){a=a[0].expression;var b=a.toWatch;\nreturn 1!==b.length?b:b[0]!==a?b:v}}function rd(a){return a.type===q.Identifier||a.type===q.MemberExpression}function sd(a){if(1===a.body.length&&rd(a.body[0].expression))return{type:q.AssignmentExpression,left:a.body[0].expression,right:{type:q.NGValueParameter},operator:\"=\"}}function td(a){return 0===a.body.length||1===a.body.length&&(a.body[0].expression.type===q.Literal||a.body[0].expression.type===q.ArrayExpression||a.body[0].expression.type===q.ObjectExpression)}function ud(a,b){this.astBuilder=\na;this.$filter=b}function vd(a,b){this.astBuilder=a;this.$filter=b}function Jb(a){return\"constructor\"==a}function hc(a){return D(a.valueOf)?a.valueOf():mg.call(a)}function tf(){var a=Z(),b=Z();this.$get=[\"$filter\",function(d){function c(c,f,r){var u,n,z;r=r||K;switch(typeof c){case \"string\":z=c=c.trim();var A=r?b:a;u=A[z];if(!u){\":\"===c.charAt(0)&&\":\"===c.charAt(1)&&(n=!0,c=c.substring(2));u=r?I:s;var Q=new ic(u);u=(new jc(Q,d,u)).parse(c);u.constant?u.$$watchDelegate=l:n?u.$$watchDelegate=u.literal?\nk:h:u.inputs&&(u.$$watchDelegate=g);r&&(u=e(u));A[z]=u}return m(u,f);case \"function\":return m(c,f);default:return m(B,f)}}function e(a){function b(c,d,e,f){var g=K;K=!0;try{return a(c,d,e,f)}finally{K=g}}if(!a)return a;b.$$watchDelegate=a.$$watchDelegate;b.assign=e(a.assign);b.constant=a.constant;b.literal=a.literal;for(var c=0;a.inputs&&c<a.inputs.length;++c)a.inputs[c]=e(a.inputs[c]);b.inputs=a.inputs;return b}function f(a,b){return null==a||null==b?a===b:\"object\"===typeof a&&(a=hc(a),\"object\"===\ntypeof a)?!1:a===b||a!==a&&b!==b}function g(a,b,c,d,e){var g=d.inputs,h;if(1===g.length){var k=f,g=g[0];return a.$watch(function(a){var b=g(a);f(b,k)||(h=d(a,v,v,[b]),k=b&&hc(b));return h},b,c,e)}for(var l=[],m=[],r=0,s=g.length;r<s;r++)l[r]=f,m[r]=null;return a.$watch(function(a){for(var b=!1,c=0,e=g.length;c<e;c++){var k=g[c](a);if(b||(b=!f(k,l[c])))m[c]=k,l[c]=k&&hc(k)}b&&(h=d(a,v,v,m));return h},b,c,e)}function h(a,b,c,d){var e,f;return e=a.$watch(function(a){return d(a)},function(a,c,d){f=a;\nD(b)&&b.apply(this,arguments);y(a)&&d.$$postDigest(function(){y(f)&&e()})},c)}function k(a,b,c,d){function e(a){var b=!0;n(a,function(a){y(a)||(b=!1)});return b}var f,g;return f=a.$watch(function(a){return d(a)},function(a,c,d){g=a;D(b)&&b.call(this,a,c,d);e(a)&&d.$$postDigest(function(){e(g)&&f()})},c)}function l(a,b,c,d){var e;return e=a.$watch(function(a){e();return d(a)},b,c)}function m(a,b){if(!b)return a;var c=a.$$watchDelegate,d=!1,c=c!==k&&c!==h?function(c,e,f,g){f=d&&g?g[0]:a(c,e,f,g);return b(f,\nc,e)}:function(c,d,e,f){e=a(c,d,e,f);c=b(e,c,d);return y(e)?c:e};a.$$watchDelegate&&a.$$watchDelegate!==g?c.$$watchDelegate=a.$$watchDelegate:b.$stateful||(c.$$watchDelegate=g,d=!a.inputs,c.inputs=a.inputs?a.inputs:[a]);return c}var r=Ea().noUnsafeEval,s={csp:r,expensiveChecks:!1},I={csp:r,expensiveChecks:!0},K=!1;c.$$runningExpensiveChecks=function(){return K};return c}]}function vf(){this.$get=[\"$rootScope\",\"$exceptionHandler\",function(a,b){return wd(function(b){a.$evalAsync(b)},b)}]}function wf(){this.$get=\n[\"$browser\",\"$exceptionHandler\",function(a,b){return wd(function(b){a.defer(b)},b)}]}function wd(a,b){function d(){this.$$state={status:0}}function c(a,b){return function(c){b.call(a,c)}}function e(c){!c.processScheduled&&c.pending&&(c.processScheduled=!0,a(function(){var a,d,e;e=c.pending;c.processScheduled=!1;c.pending=v;for(var f=0,g=e.length;f<g;++f){d=e[f][0];a=e[f][c.status];try{D(a)?d.resolve(a(c.value)):1===c.status?d.resolve(c.value):d.reject(c.value)}catch(h){d.reject(h),b(h)}}}))}function f(){this.promise=\nnew d}var g=H(\"$q\",TypeError);T(d.prototype,{then:function(a,b,c){if(x(a)&&x(b)&&x(c))return this;var d=new f;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&e(this.$$state);return d.promise},\"catch\":function(a){return this.then(null,a)},\"finally\":function(a,b){return this.then(function(b){return k(b,!0,a)},function(b){return k(b,!1,a)},b)}});T(f.prototype,{resolve:function(a){this.promise.$$state.status||(a===this.promise?this.$$reject(g(\"qcycle\",\na)):this.$$resolve(a))},$$resolve:function(a){function d(a){k||(k=!0,h.$$resolve(a))}function f(a){k||(k=!0,h.$$reject(a))}var g,h=this,k=!1;try{if(E(a)||D(a))g=a&&a.then;D(g)?(this.promise.$$state.status=-1,g.call(a,d,f,c(this,this.notify))):(this.promise.$$state.value=a,this.promise.$$state.status=1,e(this.promise.$$state))}catch(l){f(l),b(l)}},reject:function(a){this.promise.$$state.status||this.$$reject(a)},$$reject:function(a){this.promise.$$state.value=a;this.promise.$$state.status=2;e(this.promise.$$state)},\nnotify:function(c){var d=this.promise.$$state.pending;0>=this.promise.$$state.status&&d&&d.length&&a(function(){for(var a,e,f=0,g=d.length;f<g;f++){e=d[f][0];a=d[f][3];try{e.notify(D(a)?a(c):c)}catch(h){b(h)}}})}});var h=function(a,b){var c=new f;b?c.resolve(a):c.reject(a);return c.promise},k=function(a,b,c){var d=null;try{D(c)&&(d=c())}catch(e){return h(e,!1)}return d&&D(d.then)?d.then(function(){return h(a,b)},function(a){return h(a,!1)}):h(a,b)},l=function(a,b,c,d){var e=new f;e.resolve(a);return e.promise.then(b,\nc,d)},m=function(a){if(!D(a))throw g(\"norslvr\",a);var b=new f;a(function(a){b.resolve(a)},function(a){b.reject(a)});return b.promise};m.prototype=d.prototype;m.defer=function(){var a=new f;a.resolve=c(a,a.resolve);a.reject=c(a,a.reject);a.notify=c(a,a.notify);return a};m.reject=function(a){var b=new f;b.reject(a);return b.promise};m.when=l;m.resolve=l;m.all=function(a){var b=new f,c=0,d=L(a)?[]:{};n(a,function(a,e){c++;l(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||\nb.reject(a)})});0===c&&b.resolve(d);return b.promise};return m}function Ff(){this.$get=[\"$window\",\"$timeout\",function(a,b){var d=a.requestAnimationFrame||a.webkitRequestAnimationFrame,c=a.cancelAnimationFrame||a.webkitCancelAnimationFrame||a.webkitCancelRequestAnimationFrame,e=!!d,f=e?function(a){var b=d(a);return function(){c(b)}}:function(a){var c=b(a,16.66,!1);return function(){b.cancel(c)}};f.supported=e;return f}]}function uf(){function a(a){function b(){this.$$watchers=this.$$nextSibling=this.$$childHead=\nthis.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$id=++pb;this.$$ChildScope=null}b.prototype=a;return b}var b=10,d=H(\"$rootScope\"),c=null,e=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=[\"$exceptionHandler\",\"$parse\",\"$browser\",function(f,g,h){function k(a){a.currentScope.$$destroyed=!0}function l(a){9===xa&&(a.$$childHead&&l(a.$$childHead),a.$$nextSibling&&l(a.$$nextSibling));a.$parent=a.$$nextSibling=a.$$prevSibling=a.$$childHead=\na.$$childTail=a.$root=a.$$watchers=null}function m(){this.$id=++pb;this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this.$root=this;this.$$destroyed=!1;this.$$listeners={};this.$$listenerCount={};this.$$watchersCount=0;this.$$isolateBindings=null}function r(a){if(w.$$phase)throw d(\"inprog\",w.$$phase);w.$$phase=a}function s(a,b){do a.$$watchersCount+=b;while(a=a.$parent)}function I(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&\ndelete a.$$listenerCount[c];while(a=a.$parent)}function q(){}function t(){for(;z.length;)try{z.shift()()}catch(a){f(a)}e=null}function p(){null===e&&(e=h.defer(function(){w.$apply(t)}))}m.prototype={constructor:m,$new:function(b,c){var d;c=c||this;b?(d=new m,d.$root=this.$root):(this.$$ChildScope||(this.$$ChildScope=a(this)),d=new this.$$ChildScope);d.$parent=c;d.$$prevSibling=c.$$childTail;c.$$childHead?(c.$$childTail.$$nextSibling=d,c.$$childTail=d):c.$$childHead=c.$$childTail=d;(b||c!=this)&&d.$on(\"$destroy\",\nk);return d},$watch:function(a,b,d,e){var f=g(a);if(f.$$watchDelegate)return f.$$watchDelegate(this,b,d,f,a);var h=this,k=h.$$watchers,l={fn:b,last:q,get:f,exp:e||a,eq:!!d};c=null;D(b)||(l.fn=B);k||(k=h.$$watchers=[]);k.unshift(l);s(this,1);return function(){0<=cb(k,l)&&s(h,-1);c=null}},$watchGroup:function(a,b){function c(){h=!1;k?(k=!1,b(e,e,g)):b(e,d,g)}var d=Array(a.length),e=Array(a.length),f=[],g=this,h=!1,k=!0;if(!a.length){var l=!0;g.$evalAsync(function(){l&&b(e,e,g)});return function(){l=\n!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});n(a,function(a,b){var k=g.$watch(a,function(a,f){e[b]=a;d[b]=f;h||(h=!0,g.$evalAsync(c))});f.push(k)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,g,h;if(!x(e)){if(E(e))if(Ca(e))for(f!==r&&(f=r,u=f.length=0,l++),a=e.length,u!==a&&(l++,f.length=u=a),b=0;b<a;b++)h=f[b],g=e[b],d=h!==h&&g!==g,d||h===g||(l++,f[b]=g);else{f!==s&&(f=s={},u=0,l++);a=0;for(b in e)sa.call(e,\nb)&&(a++,g=e[b],h=f[b],b in f?(d=h!==h&&g!==g,d||h===g||(l++,f[b]=g)):(u++,f[b]=g,l++));if(u>a)for(b in l++,f)sa.call(e,b)||(u--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$stateful=!0;var d=this,e,f,h,k=1<b.length,l=0,m=g(a,c),r=[],s={},p=!0,u=0;return this.$watch(m,function(){p?(p=!1,b(e,e,d)):b(e,h,d);if(k)if(E(e))if(Ca(e)){h=Array(e.length);for(var a=0;a<e.length;a++)h[a]=e[a]}else for(a in h={},e)sa.call(e,a)&&(h[a]=e[a]);else h=e})},$digest:function(){var a,g,k,l,m,s,p,n,I=b,z,y=[],x,C;\nr(\"$digest\");h.$$checkUrlChange();this===w&&null!==e&&(h.defer.cancel(e),t());c=null;do{n=!1;for(z=this;u.length;){try{C=u.shift(),C.scope.$eval(C.expression,C.locals)}catch(B){f(B)}c=null}a:do{if(s=z.$$watchers)for(p=s.length;p--;)try{if(a=s[p])if(m=a.get,(g=m(z))!==(k=a.last)&&!(a.eq?oa(g,k):\"number\"===typeof g&&\"number\"===typeof k&&isNaN(g)&&isNaN(k)))n=!0,c=a,a.last=a.eq?Oa(g,null):g,l=a.fn,l(g,k===q?g:k,z),5>I&&(x=4-I,y[x]||(y[x]=[]),y[x].push({msg:D(a.exp)?\"fn: \"+(a.exp.name||a.exp.toString()):\na.exp,newVal:g,oldVal:k}));else if(a===c){n=!1;break a}}catch(E){f(E)}if(!(s=z.$$watchersCount&&z.$$childHead||z!==this&&z.$$nextSibling))for(;z!==this&&!(s=z.$$nextSibling);)z=z.$parent}while(z=s);if((n||u.length)&&!I--)throw w.$$phase=null,d(\"infdig\",b,y);}while(n||u.length);for(w.$$phase=null;v.length;)try{v.shift()()}catch(H){f(H)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast(\"$destroy\");this.$$destroyed=!0;this===w&&h.$$applicationDestroyed();s(this,-this.$$watchersCount);\nfor(var b in this.$$listenerCount)I(this,this.$$listenerCount[b],b);a&&a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a&&a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$destroy=this.$digest=this.$apply=this.$evalAsync=this.$applyAsync=B;this.$on=this.$watch=this.$watchGroup=function(){return B};this.$$listeners={};this.$$nextSibling=\nnull;l(this)}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a,b){w.$$phase||u.length||h.defer(function(){u.length&&w.$digest()});u.push({scope:this,expression:g(a),locals:b})},$$postDigest:function(a){v.push(a)},$apply:function(a){try{r(\"$apply\");try{return this.$eval(a)}finally{w.$$phase=null}}catch(b){f(b)}finally{try{w.$digest()}catch(c){throw f(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&z.push(b);a=g(a);p()},$on:function(a,b){var c=this.$$listeners[a];\nc||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=c.indexOf(b);-1!==d&&(c[d]=null,I(e,1,a))}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=db([h],arguments,1),l,m;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(m=d.length;l<m;l++)if(d[l])try{d[l].apply(null,\nk)}catch(r){f(r)}else d.splice(l,1),l--,m--;if(g)return h.currentScope=null,h;e=e.$parent}while(e);h.currentScope=null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var g=db([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){f(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&\nc.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}e.currentScope=null;return e}};var w=new m,u=w.$$asyncQueue=[],v=w.$$postDigestQueue=[],z=w.$$applyAsyncQueue=[];return w}]}function ne(){var a=/^\\s*(https?|ftp|mailto|tel|file):/,b=/^\\s*((https?|ftp|file|blob):|data:image\\/)/;this.aHrefSanitizationWhitelist=function(b){return y(b)?(a=b,this):a};this.imgSrcSanitizationWhitelist=function(a){return y(a)?(b=a,this):b};this.$get=function(){return function(d,c){var e=\nc?b:a,f;f=za(d).href;return\"\"===f||f.match(e)?d:\"unsafe:\"+f}}}function ng(a){if(\"self\"===a)return a;if(F(a)){if(-1<a.indexOf(\"***\"))throw Ba(\"iwcard\",a);a=xd(a).replace(\"\\\\*\\\\*\",\".*\").replace(\"\\\\*\",\"[^:/.?&;]*\");return new RegExp(\"^\"+a+\"$\")}if($a(a))return new RegExp(\"^\"+a.source+\"$\");throw Ba(\"imatcher\");}function yd(a){var b=[];y(a)&&n(a,function(a){b.push(ng(a))});return b}function yf(){this.SCE_CONTEXTS=qa;var a=[\"self\"],b=[];this.resourceUrlWhitelist=function(b){arguments.length&&(a=yd(b));return a};\nthis.resourceUrlBlacklist=function(a){arguments.length&&(b=yd(a));return b};this.$get=[\"$injector\",function(d){function c(a,b){return\"self\"===a?jd(b):!!a.exec(b.href)}function e(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var f=function(a){throw Ba(\"unsafe\");};d.has(\"$sanitize\")&&(f=d.get(\"$sanitize\"));\nvar g=e(),h={};h[qa.HTML]=e(g);h[qa.CSS]=e(g);h[qa.URL]=e(g);h[qa.JS]=e(g);h[qa.RESOURCE_URL]=e(h[qa.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw Ba(\"icontext\",a,b);if(null===b||x(b)||\"\"===b)return b;if(\"string\"!==typeof b)throw Ba(\"itype\",a);return new c(b)},getTrusted:function(d,e){if(null===e||x(e)||\"\"===e)return e;var g=h.hasOwnProperty(d)?h[d]:null;if(g&&e instanceof g)return e.$$unwrapTrustedValue();if(d===qa.RESOURCE_URL){var g=za(e.toString()),r,s,n=!1;\nr=0;for(s=a.length;r<s;r++)if(c(a[r],g)){n=!0;break}if(n)for(r=0,s=b.length;r<s;r++)if(c(b[r],g)){n=!1;break}if(n)return e;throw Ba(\"insecurl\",e.toString());}if(d===qa.HTML)return f(e);throw Ba(\"unsafe\");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function xf(){var a=!0;this.enabled=function(b){arguments.length&&(a=!!b);return a};this.$get=[\"$parse\",\"$sceDelegate\",function(b,d){if(a&&8>xa)throw Ba(\"iequirks\");var c=na(qa);c.isEnabled=function(){return a};c.trustAs=d.trustAs;\nc.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=ab);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;n(qa,function(a,b){var d=G(b);c[gb(\"parse_as_\"+d)]=function(b){return e(a,b)};c[gb(\"get_trusted_\"+d)]=function(b){return f(a,b)};c[gb(\"trust_as_\"+d)]=function(b){return g(a,b)}});return c}]}function zf(){this.$get=[\"$window\",\"$document\",\nfunction(a,b){var d={},c=ca((/android (\\d+)/.exec(G((a.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((a.navigator||{}).userAgent),f=b[0]||{},g,h=/^(Moz|webkit|ms)(?=[A-Z])/,k=f.body&&f.body.style,l=!1,m=!1;if(k){for(var r in k)if(l=h.exec(r)){g=l[0];g=g.substr(0,1).toUpperCase()+g.substr(1);break}g||(g=\"WebkitOpacity\"in k&&\"webkit\");l=!!(\"transition\"in k||g+\"Transition\"in k);m=!!(\"animation\"in k||g+\"Animation\"in k);!c||l&&m||(l=F(k.webkitTransition),m=F(k.webkitAnimation))}return{history:!(!a.history||\n!a.history.pushState||4>c||e),hasEvent:function(a){if(\"input\"===a&&11>=xa)return!1;if(x(d[a])){var b=f.createElement(\"div\");d[a]=\"on\"+a in b}return d[a]},csp:Ea(),vendorPrefix:g,transitions:l,animations:m,android:c}}]}function Bf(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=[\"$templateCache\",\"$http\",\"$q\",\"$sce\",function(b,d,c,e){function f(g,h){f.totalPendingRequests++;F(g)&&b.get(g)||(g=e.getTrustedResourceUrl(g));var k=d.defaults&&d.defaults.transformResponse;L(k)?k=k.filter(function(a){return a!==\ncc}):k===cc&&(k=null);return d.get(g,T({cache:b,transformResponse:k},a))[\"finally\"](function(){f.totalPendingRequests--}).then(function(a){b.put(g,a.data);return a.data},function(a){if(!h)throw ja(\"tpload\",g,a.status,a.statusText);return c.reject(a)})}f.totalPendingRequests=0;return f}]}function Cf(){this.$get=[\"$rootScope\",\"$browser\",\"$location\",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName(\"ng-binding\");var g=[];n(a,function(a){var c=ia.element(a).data(\"$binding\");\nc&&n(c,function(c){d?(new RegExp(\"(^|\\\\s)\"+xd(b)+\"(\\\\s|\\\\||$)\")).test(c)&&g.push(a):-1!=c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=[\"ng-\",\"data-ng-\",\"ng\\\\:\"],h=0;h<g.length;++h){var k=a.querySelectorAll(\"[\"+g[h]+\"model\"+(d?\"=\":\"*=\")+'\"'+b+'\"]');if(k.length)return k}},getLocation:function(){return d.url()},setLocation:function(b){b!==d.url()&&(d.url(b),a.$digest())},whenStable:function(a){b.notifyWhenNoOutstandingRequests(a)}}}]}function Df(){this.$get=[\"$rootScope\",\n\"$browser\",\"$q\",\"$$q\",\"$exceptionHandler\",function(a,b,d,c,e){function f(f,k,l){D(f)||(l=k,k=f,f=B);var m=wa.call(arguments,3),r=y(l)&&!l,s=(r?c:d).defer(),n=s.promise,q;q=b.defer(function(){try{s.resolve(f.apply(null,m))}catch(b){s.reject(b),e(b)}finally{delete g[n.$$timeoutId]}r||a.$apply()},k);n.$$timeoutId=q;g[q]=s;return n}var g={};f.cancel=function(a){return a&&a.$$timeoutId in g?(g[a.$$timeoutId].reject(\"canceled\"),delete g[a.$$timeoutId],b.defer.cancel(a.$$timeoutId)):!1};return f}]}function za(a){xa&&\n(Y.setAttribute(\"href\",a),a=Y.href);Y.setAttribute(\"href\",a);return{href:Y.href,protocol:Y.protocol?Y.protocol.replace(/:$/,\"\"):\"\",host:Y.host,search:Y.search?Y.search.replace(/^\\?/,\"\"):\"\",hash:Y.hash?Y.hash.replace(/^#/,\"\"):\"\",hostname:Y.hostname,port:Y.port,pathname:\"/\"===Y.pathname.charAt(0)?Y.pathname:\"/\"+Y.pathname}}function jd(a){a=F(a)?za(a):a;return a.protocol===zd.protocol&&a.host===zd.host}function Ef(){this.$get=ba(O)}function Ad(a){function b(a){try{return decodeURIComponent(a)}catch(b){return a}}\nvar d=a[0]||{},c={},e=\"\";return function(){var a,g,h,k,l;a=d.cookie||\"\";if(a!==e)for(e=a,a=e.split(\"; \"),c={},h=0;h<a.length;h++)g=a[h],k=g.indexOf(\"=\"),0<k&&(l=b(g.substring(0,k)),x(c[l])&&(c[l]=b(g.substring(k+1))));return c}}function If(){this.$get=Ad}function Lc(a){function b(d,c){if(E(d)){var e={};n(d,function(a,c){e[c]=b(c,a)});return e}return a.factory(d+\"Filter\",c)}this.register=b;this.$get=[\"$injector\",function(a){return function(b){return a.get(b+\"Filter\")}}];b(\"currency\",Bd);b(\"date\",Cd);\nb(\"filter\",og);b(\"json\",pg);b(\"limitTo\",qg);b(\"lowercase\",rg);b(\"number\",Dd);b(\"orderBy\",Ed);b(\"uppercase\",sg)}function og(){return function(a,b,d){if(!Ca(a)){if(null==a)return a;throw H(\"filter\")(\"notarray\",a);}var c;switch(kc(b)){case \"function\":break;case \"boolean\":case \"null\":case \"number\":case \"string\":c=!0;case \"object\":b=tg(b,d,c);break;default:return a}return Array.prototype.filter.call(a,b)}}function tg(a,b,d){var c=E(a)&&\"$\"in a;!0===b?b=oa:D(b)||(b=function(a,b){if(x(a))return!1;if(null===\na||null===b)return a===b;if(E(b)||E(a)&&!tc(a))return!1;a=G(\"\"+a);b=G(\"\"+b);return-1!==a.indexOf(b)});return function(e){return c&&!E(e)?La(e,a.$,b,!1):La(e,a,b,d)}}function La(a,b,d,c,e){var f=kc(a),g=kc(b);if(\"string\"===g&&\"!\"===b.charAt(0))return!La(a,b.substring(1),d,c);if(L(a))return a.some(function(a){return La(a,b,d,c)});switch(f){case \"object\":var h;if(c){for(h in a)if(\"$\"!==h.charAt(0)&&La(a[h],b,d,!0))return!0;return e?!1:La(a,b,d,!1)}if(\"object\"===g){for(h in b)if(e=b[h],!D(e)&&!x(e)&&\n(f=\"$\"===h,!La(f?a:a[h],e,d,f,f)))return!1;return!0}return d(a,b);case \"function\":return!1;default:return d(a,b)}}function kc(a){return null===a?\"null\":typeof a}function Bd(a){var b=a.NUMBER_FORMATS;return function(a,c,e){x(c)&&(c=b.CURRENCY_SYM);x(e)&&(e=b.PATTERNS[1].maxFrac);return null==a?a:Fd(a,b.PATTERNS[1],b.GROUP_SEP,b.DECIMAL_SEP,e).replace(/\\u00A4/g,c)}}function Dd(a){var b=a.NUMBER_FORMATS;return function(a,c){return null==a?a:Fd(a,b.PATTERNS[0],b.GROUP_SEP,b.DECIMAL_SEP,c)}}function ug(a){var b=\n0,d,c,e,f,g;-1<(c=a.indexOf(Gd))&&(a=a.replace(Gd,\"\"));0<(e=a.search(/e/i))?(0>c&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)==lc;e++);if(e==(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)==lc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Hd&&(d=d.splice(0,Hd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function vg(a,b,d,c){var e=a.d,f=e.length-a.i;b=x(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0<d)e.splice(d);else{a.i=1;e.length=d=b+1;for(var g=0;g<d;g++)e[g]=\n0}for(5<=c&&e[d-1]++;f<b;f++)e.push(0);if(b=e.reduceRight(function(a,b,c,d){b+=a;d[c]=b%10;return Math.floor(b/10)},0))e.unshift(b),a.i++}function Fd(a,b,d,c,e){if(!F(a)&&!N(a)||isNaN(a))return\"\";var f=!isFinite(a),g=!1,h=Math.abs(a)+\"\",k=\"\";if(f)k=\"\\u221e\";else{g=ug(h);vg(g,e,b.minFrac,b.maxFrac);k=g.d;h=g.i;e=g.e;f=[];for(g=k.reduce(function(a,b){return a&&!b},!0);0>h;)k.unshift(0),h++;0<h?f=k.splice(h):(f=k,k=[0]);h=[];for(k.length>b.lgSize&&h.unshift(k.splice(-b.lgSize).join(\"\"));k.length>b.gSize;)h.unshift(k.splice(-b.gSize).join(\"\"));\nk.length&&h.unshift(k.join(\"\"));k=h.join(d);f.length&&(k+=c+f.join(\"\"));e&&(k+=\"e+\"+e)}return 0>a&&!g?b.negPre+k+b.negSuf:b.posPre+k+b.posSuf}function Kb(a,b,d){var c=\"\";0>a&&(c=\"-\",a=-a);for(a=\"\"+a;a.length<b;)a=lc+a;d&&(a=a.substr(a.length-b));return c+a}function aa(a,b,d,c){d=d||0;return function(e){e=e[\"get\"+a]();if(0<d||e>-d)e+=d;0===e&&-12==d&&(e=12);return Kb(e,b,c)}}function Lb(a,b){return function(d,c){var e=d[\"get\"+a](),f=ub(b?\"SHORT\"+a:a);return c[f][e]}}function Id(a){var b=(new Date(a,\n0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function Jd(a){return function(b){var d=Id(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Kb(b,a)}}function mc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Cd(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=ca(b[9]+b[10]),g=ca(b[9]+b[11]));h.call(a,ca(b[1]),ca(b[2])-\n1,ca(b[3]));f=ca(b[4]||0)-f;g=ca(b[5]||0)-g;h=ca(b[6]||0);b=Math.round(1E3*parseFloat(\"0.\"+(b[7]||0)));k.call(a,f,g,h,b)}return a}var d=/^(\\d{4})-?(\\d\\d)-?(\\d\\d)(?:T(\\d\\d)(?::?(\\d\\d)(?::?(\\d\\d)(?:\\.(\\d+))?)?)?(Z|([+-])(\\d\\d):?(\\d\\d))?)?$/;return function(c,d,f){var g=\"\",h=[],k,l;d=d||\"mediumDate\";d=a.DATETIME_FORMATS[d]||d;F(c)&&(c=wg.test(c)?ca(c):b(c));N(c)&&(c=new Date(c));if(!V(c)||!isFinite(c.getTime()))return c;for(;d;)(l=xg.exec(d))?(h=db(h,l,1),d=h.pop()):(h.push(d),d=null);var m=c.getTimezoneOffset();\nf&&(m=xc(f,m),c=Tb(c,f,!0));n(h,function(b){k=yg[b];g+=k?k(c,a.DATETIME_FORMATS,m):\"''\"===b?\"'\":b.replace(/(^'|'$)/g,\"\").replace(/''/g,\"'\")});return g}}function pg(){return function(a,b){x(b)&&(b=2);return eb(a,b)}}function qg(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):ca(b);if(isNaN(b))return a;N(a)&&(a=a.toString());if(!L(a)&&!F(a))return a;d=!d||isNaN(d)?0:ca(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?a.slice(d,d+b):0===d?a.slice(b,a.length):a.slice(Math.max(0,d+b),\nd)}}function Ed(a){function b(b,d){d=d?-1:1;return b.map(function(b){var c=1,h=ab;if(D(b))h=b;else if(F(b)){if(\"+\"==b.charAt(0)||\"-\"==b.charAt(0))c=\"-\"==b.charAt(0)?-1:1,b=b.substring(1);if(\"\"!==b&&(h=a(b),h.constant))var k=h(),h=function(a){return a[k]}}return{get:h,descending:c*d}})}function d(a){switch(typeof a){case \"number\":case \"boolean\":case \"string\":return!0;default:return!1}}return function(a,e,f){if(null==a)return a;if(!Ca(a))throw H(\"orderBy\")(\"notarray\",a);L(e)||(e=[e]);0===e.length&&\n(e=[\"+\"]);var g=b(e,f);g.push({get:function(){return{}},descending:f?-1:1});a=Array.prototype.map.call(a,function(a,b){return{value:a,predicateValues:g.map(function(c){var e=c.get(a);c=typeof e;if(null===e)c=\"string\",e=\"null\";else if(\"string\"===c)e=e.toLowerCase();else if(\"object\"===c)a:{if(\"function\"===typeof e.valueOf&&(e=e.valueOf(),d(e)))break a;if(tc(e)&&(e=e.toString(),d(e)))break a;e=b}return{value:e,type:c}})}});a.sort(function(a,b){for(var c=0,d=0,e=g.length;d<e;++d){var c=a.predicateValues[d],\nf=b.predicateValues[d],n=0;c.type===f.type?c.value!==f.value&&(n=c.value<f.value?-1:1):n=c.type<f.type?-1:1;if(c=n*g[d].descending)break}return c});return a=a.map(function(a){return a.value})}}function Ma(a){D(a)&&(a={link:a});a.restrict=a.restrict||\"AC\";return ba(a)}function Kd(a,b,d,c,e){var f=this,g=[];f.$error={};f.$$success={};f.$pending=v;f.$name=e(b.name||b.ngForm||\"\")(d);f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;f.$submitted=!1;f.$$parentForm=Mb;f.$rollbackViewValue=function(){n(g,\nfunction(a){a.$rollbackViewValue()})};f.$commitViewValue=function(){n(g,function(a){a.$commitViewValue()})};f.$addControl=function(a){Ta(a.$name,\"input\");g.push(a);a.$name&&(f[a.$name]=a);a.$$parentForm=f};f.$$renameControl=function(a,b){var c=a.$name;f[c]===a&&delete f[c];f[b]=a;a.$name=b};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];n(f.$pending,function(b,c){f.$setValidity(c,null,a)});n(f.$error,function(b,c){f.$setValidity(c,null,a)});n(f.$$success,function(b,c){f.$setValidity(c,\nnull,a)});cb(g,a);a.$$parentForm=Mb};Ld({ctrl:this,$element:a,set:function(a,b,c){var d=a[b];d?-1===d.indexOf(c)&&d.push(c):a[b]=[c]},unset:function(a,b,c){var d=a[b];d&&(cb(d,c),0===d.length&&delete a[b])},$animate:c});f.$setDirty=function(){c.removeClass(a,Ya);c.addClass(a,Nb);f.$dirty=!0;f.$pristine=!1;f.$$parentForm.$setDirty()};f.$setPristine=function(){c.setClass(a,Ya,Nb+\" ng-submitted\");f.$dirty=!1;f.$pristine=!0;f.$submitted=!1;n(g,function(a){a.$setPristine()})};f.$setUntouched=function(){n(g,\nfunction(a){a.$setUntouched()})};f.$setSubmitted=function(){c.addClass(a,\"ng-submitted\");f.$submitted=!0;f.$$parentForm.$setSubmitted()}}function nc(a){a.$formatters.push(function(b){return a.$isEmpty(b)?b:b.toString()})}function lb(a,b,d,c,e,f){var g=G(b[0].type);if(!e.android){var h=!1;b.on(\"compositionstart\",function(a){h=!0});b.on(\"compositionend\",function(){h=!1;k()})}var k=function(a){l&&(f.defer.cancel(l),l=null);if(!h){var e=b.val();a=a&&a.type;\"password\"===g||d.ngTrim&&\"false\"===d.ngTrim||\n(e=X(e));(c.$viewValue!==e||\"\"===e&&c.$$hasNativeValidators)&&c.$setViewValue(e,a)}};if(e.hasEvent(\"input\"))b.on(\"input\",k);else{var l,m=function(a,b,c){l||(l=f.defer(function(){l=null;b&&b.value===c||k(a)}))};b.on(\"keydown\",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||m(a,this,this.value)});if(e.hasEvent(\"paste\"))b.on(\"paste cut\",m)}b.on(\"change\",k);c.$render=function(){var a=c.$isEmpty(c.$viewValue)?\"\":c.$viewValue;b.val()!==a&&b.val(a)}}function Ob(a,b){return function(d,c){var e,\nf;if(V(d))return d;if(F(d)){'\"'==d.charAt(0)&&'\"'==d.charAt(d.length-1)&&(d=d.substring(1,d.length-1));if(zg.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},n(e,function(a,c){c<b.length&&(f[b[c]]=+a)}),new Date(f.yyyy,f.MM-1,f.dd,f.HH,f.mm,f.ss||0,1E3*f.sss||0)}return NaN}}function mb(a,b,d,c){return function(e,\nf,g,h,k,l,m){function r(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function s(a){return y(a)&&!V(a)?d(a)||v:a}Md(e,f,g,h);lb(e,f,g,h,k,l);var n=h&&h.$options&&h.$options.timezone,q;h.$$parserName=a;h.$parsers.push(function(a){return h.$isEmpty(a)?null:b.test(a)?(a=d(a,q),n&&(a=Tb(a,n)),a):v});h.$formatters.push(function(a){if(a&&!V(a))throw nb(\"datefmt\",a);if(r(a))return(q=a)&&n&&(q=Tb(q,n,!0)),m(\"date\")(a,c,n);q=null;return\"\"});if(y(g.min)||g.ngMin){var t;h.$validators.min=function(a){return!r(a)||\nx(t)||d(a)>=t};g.$observe(\"min\",function(a){t=s(a);h.$validate()})}if(y(g.max)||g.ngMax){var p;h.$validators.max=function(a){return!r(a)||x(p)||d(a)<=p};g.$observe(\"max\",function(a){p=s(a);h.$validate()})}}}function Md(a,b,d,c){(c.$$hasNativeValidators=E(b[0].validity))&&c.$parsers.push(function(a){var c=b.prop(\"validity\")||{};return c.badInput||c.typeMismatch?v:a})}function Nd(a,b,d,c,e){if(y(c)){a=a(c);if(!a.constant)throw nb(\"constexpr\",d,c);return a(b)}return e}function oc(a,b){a=\"ngClass\"+a;\nreturn[\"$animate\",function(d){function c(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],m=0;m<b.length;m++)if(e==b[m])continue a;c.push(e)}return c}function e(a){var b=[];return L(a)?(n(a,function(a){b=b.concat(e(a))}),b):F(a)?a.split(\" \"):E(a)?(n(a,function(a,c){a&&(b=b.concat(c.split(\" \")))}),b):a}return{restrict:\"AC\",link:function(f,g,h){function k(a,b){var c=g.data(\"$classCounts\")||Z(),d=[];n(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data(\"$classCounts\",\nc);return d.join(\" \")}function l(a){if(!0===b||f.$index%2===b){var l=e(a||[]);if(!m){var n=k(l,1);h.$addClass(n)}else if(!oa(a,m)){var q=e(m),n=c(l,q),l=c(q,l),n=k(n,1),l=k(l,-1);n&&n.length&&d.addClass(g,n);l&&l.length&&d.removeClass(g,l)}}m=na(a)}var m;f.$watch(h[a],l,!0);h.$observe(\"class\",function(b){l(f.$eval(h[a]))});\"ngClass\"!==a&&f.$watch(\"$index\",function(c,d){var g=c&1;if(g!==(d&1)){var l=e(f.$eval(h[a]));g===b?(g=k(l,1),h.$addClass(g)):(g=k(l,-1),h.$removeClass(g))}})}}}]}function Ld(a){function b(a,\nb){b&&!f[a]?(k.addClass(e,a),f[a]=!0):!b&&f[a]&&(k.removeClass(e,a),f[a]=!1)}function d(a,c){a=a?\"-\"+Bc(a,\"-\"):\"\";b(ob+a,!0===c);b(Od+a,!1===c)}var c=a.ctrl,e=a.$element,f={},g=a.set,h=a.unset,k=a.$animate;f[Od]=!(f[ob]=e.hasClass(ob));c.$setValidity=function(a,e,f){x(e)?(c.$pending||(c.$pending={}),g(c.$pending,a,f)):(c.$pending&&h(c.$pending,a,f),Pd(c.$pending)&&(c.$pending=v));Na(e)?e?(h(c.$error,a,f),g(c.$$success,a,f)):(g(c.$error,a,f),h(c.$$success,a,f)):(h(c.$error,a,f),h(c.$$success,a,f));\nc.$pending?(b(Qd,!0),c.$valid=c.$invalid=v,d(\"\",null)):(b(Qd,!1),c.$valid=Pd(c.$error),c.$invalid=!c.$valid,d(\"\",c.$valid));e=c.$pending&&c.$pending[a]?v:c.$error[a]?!1:c.$$success[a]?!0:null;d(a,e);c.$$parentForm.$setValidity(a,e,c)}}function Pd(a){if(a)for(var b in a)if(a.hasOwnProperty(b))return!1;return!0}var Ag=/^\\/(.+)\\/([a-z]*)$/,sa=Object.prototype.hasOwnProperty,G=function(a){return F(a)?a.toLowerCase():a},ub=function(a){return F(a)?a.toUpperCase():a},xa,C,ua,wa=[].slice,ag=[].splice,Bg=\n[].push,ga=Object.prototype.toString,uc=Object.getPrototypeOf,Da=H(\"ng\"),ia=O.angular||(O.angular={}),Vb,pb=0;xa=W.documentMode;B.$inject=[];ab.$inject=[];var L=Array.isArray,ae=/^\\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\\]$/,X=function(a){return F(a)?a.trim():a},xd=function(a){return a.replace(/([-()\\[\\]{}+?*.$\\^|,:#<!\\\\])/g,\"\\\\$1\").replace(/\\x08/g,\"\\\\x08\")},Ea=function(){if(!y(Ea.rules)){var a=W.querySelector(\"[ng-csp]\")||W.querySelector(\"[data-ng-csp]\");\nif(a){var b=a.getAttribute(\"ng-csp\")||a.getAttribute(\"data-ng-csp\");Ea.rules={noUnsafeEval:!b||-1!==b.indexOf(\"no-unsafe-eval\"),noInlineStyle:!b||-1!==b.indexOf(\"no-inline-style\")}}else{a=Ea;try{new Function(\"\"),b=!1}catch(d){b=!0}a.rules={noUnsafeEval:b,noInlineStyle:!1}}}return Ea.rules},rb=function(){if(y(rb.name_))return rb.name_;var a,b,d=Qa.length,c,e;for(b=0;b<d;++b)if(c=Qa[b],a=W.querySelector(\"[\"+c.replace(\":\",\"\\\\:\")+\"jq]\")){e=a.getAttribute(c+\"jq\");break}return rb.name_=e},de=/:/g,Qa=[\"ng-\",\n\"data-ng-\",\"ng:\",\"x-ng-\"],ie=/[A-Z]/g,Cc=!1,Pa=3,me={full:\"1.5.0\",major:1,minor:5,dot:0,codeName:\"ennoblement-facilitation\"};U.expando=\"ng339\";var ib=U.cache={},Of=1;U._data=function(a){return this.cache[a[this.expando]]||{}};var Jf=/([\\:\\-\\_]+(.))/g,Kf=/^moz([A-Z])/,yb={mouseleave:\"mouseout\",mouseenter:\"mouseover\"},Xb=H(\"jqLite\"),Nf=/^<([\\w-]+)\\s*\\/?>(?:<\\/\\1>|)$/,Wb=/<|&#?\\w+;/,Lf=/<([\\w:-]+)/,Mf=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\\w:-]+)[^>]*)\\/>/gi,da={option:[1,'<select multiple=\"multiple\">',\n\"</select>\"],thead:[1,\"<table>\",\"</table>\"],col:[2,\"<table><colgroup>\",\"</colgroup></table>\"],tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],_default:[0,\"\",\"\"]};da.optgroup=da.option;da.tbody=da.tfoot=da.colgroup=da.caption=da.thead;da.th=da.td;var Tf=Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Ra=U.prototype={ready:function(a){function b(){d||(d=!0,a())}var d=!1;\"complete\"===W.readyState?setTimeout(b):(this.on(\"DOMContentLoaded\",\nb),U(O).on(\"load\",b))},toString:function(){var a=[];n(this,function(b){a.push(\"\"+b)});return\"[\"+a.join(\", \")+\"]\"},eq:function(a){return 0<=a?C(this[a]):C(this[this.length+a])},length:0,push:Bg,sort:[].sort,splice:[].splice},Db={};n(\"multiple selected checked disabled readOnly required open\".split(\" \"),function(a){Db[G(a)]=a});var Uc={};n(\"input select option textarea button form details\".split(\" \"),function(a){Uc[a]=!0});var cd={ngMinlength:\"minlength\",ngMaxlength:\"maxlength\",ngMin:\"min\",ngMax:\"max\",\nngPattern:\"pattern\"};n({data:Zb,removeData:hb,hasData:function(a){for(var b in ib[a.ng339])return!0;return!1},cleanData:function(a){for(var b=0,d=a.length;b<d;b++)hb(a[b])}},function(a,b){U[b]=a});n({data:Zb,inheritedData:Cb,scope:function(a){return C.data(a,\"$scope\")||Cb(a.parentNode||a,[\"$isolateScope\",\"$scope\"])},isolateScope:function(a){return C.data(a,\"$isolateScope\")||C.data(a,\"$isolateScopeNoTemplate\")},controller:Rc,injector:function(a){return Cb(a,\"$injector\")},removeAttr:function(a,b){a.removeAttribute(b)},\nhasClass:zb,css:function(a,b,d){b=gb(b);if(y(d))a.style[b]=d;else return a.style[b]},attr:function(a,b,d){var c=a.nodeType;if(c!==Pa&&2!==c&&8!==c)if(c=G(b),Db[c])if(y(d))d?(a[b]=!0,a.setAttribute(b,c)):(a[b]=!1,a.removeAttribute(c));else return a[b]||(a.attributes.getNamedItem(b)||B).specified?c:v;else if(y(d))a.setAttribute(b,d);else if(a.getAttribute)return a=a.getAttribute(b,2),null===a?v:a},prop:function(a,b,d){if(y(d))a[b]=d;else return a[b]},text:function(){function a(a,d){if(x(d)){var c=a.nodeType;\nreturn 1===c||c===Pa?a.textContent:\"\"}a.textContent=d}a.$dv=\"\";return a}(),val:function(a,b){if(x(b)){if(a.multiple&&\"select\"===ra(a)){var d=[];n(a.options,function(a){a.selected&&d.push(a.value||a.text)});return 0===d.length?null:d}return a.value}a.value=b},html:function(a,b){if(x(b))return a.innerHTML;wb(a,!0);a.innerHTML=b},empty:Sc},function(a,b){U.prototype[b]=function(b,c){var e,f,g=this.length;if(a!==Sc&&x(2==a.length&&a!==zb&&a!==Rc?b:c)){if(E(b)){for(e=0;e<g;e++)if(a===Zb)a(this[e],b);else for(f in b)a(this[e],\nf,b[f]);return this}e=a.$dv;g=x(e)?Math.min(g,1):g;for(f=0;f<g;f++){var h=a(this[f],b,c);e=e?e+h:h}return e}for(e=0;e<g;e++)a(this[e],b,c);return this}});n({removeData:hb,on:function(a,b,d,c){if(y(c))throw Xb(\"onargs\");if(Mc(a)){c=xb(a,!0);var e=c.events,f=c.handle;f||(f=c.handle=Qf(a,e));c=0<=b.indexOf(\" \")?b.split(\" \"):[b];for(var g=c.length,h=function(b,c,g){var h=e[b];h||(h=e[b]=[],h.specialHandlerWrapper=c,\"$destroy\"===b||g||a.addEventListener(b,f,!1));h.push(d)};g--;)b=c[g],yb[b]?(h(yb[b],Sf),\nh(b,v,!0)):h(b)}},off:Qc,one:function(a,b,d){a=C(a);a.on(b,function e(){a.off(b,d);a.off(b,e)});a.on(b,d)},replaceWith:function(a,b){var d,c=a.parentNode;wb(a);n(new U(b),function(b){d?c.insertBefore(b,d.nextSibling):c.replaceChild(b,a);d=b})},children:function(a){var b=[];n(a.childNodes,function(a){1===a.nodeType&&b.push(a)});return b},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,b){var d=a.nodeType;if(1===d||11===d){b=new U(b);for(var d=0,c=b.length;d<c;d++)a.appendChild(b[d])}},\nprepend:function(a,b){if(1===a.nodeType){var d=a.firstChild;n(new U(b),function(b){a.insertBefore(b,d)})}},wrap:function(a,b){Oc(a,C(b).eq(0).clone()[0])},remove:$b,detach:function(a){$b(a,!0)},after:function(a,b){var d=a,c=a.parentNode;b=new U(b);for(var e=0,f=b.length;e<f;e++){var g=b[e];c.insertBefore(g,d.nextSibling);d=g}},addClass:Bb,removeClass:Ab,toggleClass:function(a,b,d){b&&n(b.split(\" \"),function(b){var e=d;x(e)&&(e=!zb(a,b));(e?Bb:Ab)(a,b)})},parent:function(a){return(a=a.parentNode)&&\n11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},find:function(a,b){return a.getElementsByTagName?a.getElementsByTagName(b):[]},clone:Yb,triggerHandler:function(a,b,d){var c,e,f=b.type||b,g=xb(a);if(g=(g=g&&g.events)&&g[f])c={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},\nstopPropagation:B,type:f,target:a},b.type&&(c=T(c,b)),b=na(g),e=d?[c].concat(d):[c],n(b,function(b){c.isImmediatePropagationStopped()||b.apply(a,e)})}},function(a,b){U.prototype[b]=function(b,c,e){for(var f,g=0,h=this.length;g<h;g++)x(f)?(f=a(this[g],b,c,e),y(f)&&(f=C(f))):Pc(f,a(this[g],b,c,e));return y(f)?f:this};U.prototype.bind=U.prototype.on;U.prototype.unbind=U.prototype.off});Ua.prototype={put:function(a,b){this[Fa(a,this.nextUid)]=b},get:function(a){return this[Fa(a,this.nextUid)]},remove:function(a){var b=\nthis[a=Fa(a,this.nextUid)];delete this[a];return b}};var Hf=[function(){this.$get=[function(){return Ua}]}],Vf=/^([^\\(]+?)=>/,Wf=/^[^\\(]*\\(\\s*([^\\)]*)\\)/m,Cg=/,/,Dg=/^\\s*(_?)(\\S+?)\\1\\s*$/,Uf=/((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg,Ga=H(\"$injector\");fb.$$annotate=function(a,b,d){var c;if(\"function\"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw F(d)&&d||(d=a.name||Xf(a)),Ga(\"strictdi\",d);b=Vc(a);n(b[1].split(Cg),function(a){a.replace(Dg,function(a,b,d){c.push(d)})})}a.$inject=c}}else L(a)?\n(b=a.length-1,Sa(a[b],\"fn\"),c=a.slice(0,b)):Sa(a,\"fn\",!0);return c};var Rd=H(\"$animate\"),$e=function(){this.$get=function(){}},af=function(){var a=new Ua,b=[];this.$get=[\"$$AnimateRunner\",\"$rootScope\",function(d,c){function e(a,b,c){var d=!1;b&&(b=F(b)?b.split(\" \"):L(b)?b:[],n(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){n(b,function(b){var c=a.get(b);if(c){var d=Yf(b.attr(\"class\")),e=\"\",f=\"\";n(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?\" \":\"\")+b:f+=(f.length?\" \":\"\")+b)});n(b,function(a){e&&\nBb(a,e);f&&Ab(a,f)});a.remove(b)}});b.length=0}return{enabled:B,on:B,off:B,pin:B,push:function(g,h,k,l){l&&l();k=k||{};k.from&&g.css(k.from);k.to&&g.css(k.to);if(k.addClass||k.removeClass)if(h=k.addClass,l=k.removeClass,k=a.get(g)||{},h=e(k,h,!0),l=e(k,l,!1),h||l)a.put(g,k),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},Ye=[\"$provide\",function(a){var b=this;this.$$registeredAnimations=Object.create(null);this.register=function(d,c){if(d&&\".\"!==d.charAt(0))throw Rd(\"notcsel\",\nd);var e=d+\"-animation\";b.$$registeredAnimations[d.substr(1)]=e;a.factory(e,c)};this.classNameFilter=function(a){if(1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null)&&/(\\s+|\\/)ng-animate(\\s+|\\/)/.test(this.$$classNameFilter.toString()))throw Rd(\"nongcls\",\"ng-animate\");return this.$$classNameFilter};this.$get=[\"$$animateQueue\",function(a){function b(a,c,d){if(d){var h;a:{for(h=0;h<d.length;h++){var k=d[h];if(1===k.nodeType){h=k;break a}}h=void 0}!h||h.parentNode||h.previousElementSibling||\n(d=null)}d?d.after(a):c.prepend(a)}return{on:a.on,off:a.off,pin:a.pin,enabled:a.enabled,cancel:function(a){a.end&&a.end()},enter:function(e,f,g,h){f=f&&C(f);g=g&&C(g);f=f||g.parent();b(e,f,g);return a.push(e,\"enter\",Ha(h))},move:function(e,f,g,h){f=f&&C(f);g=g&&C(g);f=f||g.parent();b(e,f,g);return a.push(e,\"move\",Ha(h))},leave:function(b,c){return a.push(b,\"leave\",Ha(c),function(){b.remove()})},addClass:function(b,c,g){g=Ha(g);g.addClass=jb(g.addclass,c);return a.push(b,\"addClass\",g)},removeClass:function(b,\nc,g){g=Ha(g);g.removeClass=jb(g.removeClass,c);return a.push(b,\"removeClass\",g)},setClass:function(b,c,g,h){h=Ha(h);h.addClass=jb(h.addClass,c);h.removeClass=jb(h.removeClass,g);return a.push(b,\"setClass\",h)},animate:function(b,c,g,h,k){k=Ha(k);k.from=k.from?T(k.from,c):c;k.to=k.to?T(k.to,g):g;k.tempClasses=jb(k.tempClasses,h||\"ng-inline-animate\");return a.push(b,\"animate\",k)}}}]}],cf=function(){this.$get=[\"$$rAF\",function(a){function b(b){d.push(b);1<d.length||a(function(){for(var a=0;a<d.length;a++)d[a]();\nd=[]})}var d=[];return function(){var a=!1;b(function(){a=!0});return function(d){a?d():b(d)}}}]},bf=function(){this.$get=[\"$q\",\"$sniffer\",\"$$animateAsyncRun\",\"$document\",\"$timeout\",function(a,b,d,c,e){function f(a){this.setHost(a);var b=d();this._doneCallbacks=[];this._tick=function(a){var d=c[0];d&&d.hidden?e(a,0,!1):b(a)};this._state=0}f.chain=function(a,b){function c(){if(d===a.length)b(!0);else a[d](function(a){!1===a?b(!1):(d++,c())})}var d=0;c()};f.all=function(a,b){function c(f){e=e&&f;++d===\na.length&&b(e)}var d=0,e=!0;n(a,function(a){a.done(c)})};f.prototype={setHost:function(a){this.host=a||{}},done:function(a){2===this._state?a():this._doneCallbacks.push(a)},progress:B,getPromise:function(){if(!this.promise){var b=this;this.promise=a(function(a,c){b.done(function(b){!1===b?c():a()})})}return this.promise},then:function(a,b){return this.getPromise().then(a,b)},\"catch\":function(a){return this.getPromise()[\"catch\"](a)},\"finally\":function(a){return this.getPromise()[\"finally\"](a)},pause:function(){this.host.pause&&\nthis.host.pause()},resume:function(){this.host.resume&&this.host.resume()},end:function(){this.host.end&&this.host.end();this._resolve(!0)},cancel:function(){this.host.cancel&&this.host.cancel();this._resolve(!1)},complete:function(a){var b=this;0===b._state&&(b._state=1,b._tick(function(){b._resolve(a)}))},_resolve:function(a){2!==this._state&&(n(this._doneCallbacks,function(b){b(a)}),this._doneCallbacks.length=0,this._state=2)}};return f}]},Ze=function(){this.$get=[\"$$rAF\",\"$q\",\"$$AnimateRunner\",\nfunction(a,b,d){return function(b,e){function f(){a(function(){g.addClass&&(b.addClass(g.addClass),g.addClass=null);g.removeClass&&(b.removeClass(g.removeClass),g.removeClass=null);g.to&&(b.css(g.to),g.to=null);h||k.complete();h=!0});return k}var g=e||{};g.$$prepared||(g=Oa(g));g.cleanupStyles&&(g.from=g.to=null);g.from&&(b.css(g.from),g.from=null);var h,k=new d;return{start:f,end:f}}}]},ja=H(\"$compile\");Ec.$inject=[\"$provide\",\"$$sanitizeUriProvider\"];var Xc=/^((?:x|data)[\\:\\-_])/i,bg=H(\"$controller\"),\ndd=/^(\\S+)(\\s+as\\s+([\\w$]+))?$/,jf=function(){this.$get=[\"$document\",function(a){return function(b){b?!b.nodeType&&b instanceof C&&(b=b[0]):b=a[0].body;return b.offsetWidth+1}}]},ed=\"application/json\",dc={\"Content-Type\":ed+\";charset=utf-8\"},dg=/^\\[|^\\{(?!\\{)/,eg={\"[\":/]$/,\"{\":/}$/},cg=/^\\)\\]\\}',?\\n/,Eg=H(\"$http\"),id=function(a){return function(){throw Eg(\"legacy\",a);}},Ka=ia.$interpolateMinErr=H(\"$interpolate\");Ka.throwNoconcat=function(a){throw Ka(\"noconcat\",a);};Ka.interr=function(a,b){return Ka(\"interr\",\na,b.toString())};var Fg=/^([^\\?#]*)(\\?([^#]*))?(#(.*))?$/,gg={http:80,https:443,ftp:21},Gb=H(\"$location\"),Gg={$$html5:!1,$$replace:!1,absUrl:Hb(\"$$absUrl\"),url:function(a){if(x(a))return this.$$url;var b=Fg.exec(a);(b[1]||\"\"===a)&&this.path(decodeURIComponent(b[1]));(b[2]||b[1]||\"\"===a)&&this.search(b[3]||\"\");this.hash(b[5]||\"\");return this},protocol:Hb(\"$$protocol\"),host:Hb(\"$$host\"),port:Hb(\"$$port\"),path:nd(\"$$path\",function(a){a=null!==a?a.toString():\"\";return\"/\"==a.charAt(0)?a:\"/\"+a}),search:function(a,\nb){switch(arguments.length){case 0:return this.$$search;case 1:if(F(a)||N(a))a=a.toString(),this.$$search=zc(a);else if(E(a))a=Oa(a,{}),n(a,function(b,c){null==b&&delete a[c]}),this.$$search=a;else throw Gb(\"isrcharg\");break;default:x(b)||null===b?delete this.$$search[a]:this.$$search[a]=b}this.$$compose();return this},hash:nd(\"$$hash\",function(a){return null!==a?a.toString():\"\"}),replace:function(){this.$$replace=!0;return this}};n([md,gc,fc],function(a){a.prototype=Object.create(Gg);a.prototype.state=\nfunction(b){if(!arguments.length)return this.$$state;if(a!==fc||!this.$$html5)throw Gb(\"nostate\");this.$$state=x(b)?null:b;return this}});var ka=H(\"$parse\"),ig=Function.prototype.call,jg=Function.prototype.apply,kg=Function.prototype.bind,Pb=Z();n(\"+ - * / % === !== == != < > <= >= && || ! = |\".split(\" \"),function(a){Pb[a]=!0});var Hg={n:\"\\n\",f:\"\\f\",r:\"\\r\",t:\"\\t\",v:\"\\v\",\"'\":\"'\",'\"':'\"'},ic=function(a){this.options=a};ic.prototype={constructor:ic,lex:function(a){this.text=a;this.index=0;for(this.tokens=\n[];this.index<this.text.length;)if(a=this.text.charAt(this.index),'\"'===a||\"'\"===a)this.readString(a);else if(this.isNumber(a)||\".\"===a&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(a))this.readIdent();else if(this.is(a,\"(){}[].,;:?\"))this.tokens.push({index:this.index,text:a}),this.index++;else if(this.isWhitespace(a))this.index++;else{var b=a+this.peek(),d=b+this.peek(2),c=Pb[b],e=Pb[d];Pb[a]||c||e?(a=e?d:c?b:a,this.tokens.push({index:this.index,text:a,operator:!0}),this.index+=\na.length):this.throwError(\"Unexpected next character \",this.index,this.index+1)}return this.tokens},is:function(a,b){return-1!==b.indexOf(a)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return\"0\"<=a&&\"9\">=a&&\"string\"===typeof a},isWhitespace:function(a){return\" \"===a||\"\\r\"===a||\"\\t\"===a||\"\\n\"===a||\"\\v\"===a||\"\\u00a0\"===a},isIdent:function(a){return\"a\"<=a&&\"z\">=a||\"A\"<=a&&\"Z\">=a||\"_\"===a||\"$\"===a},isExpOperator:function(a){return\"-\"===\na||\"+\"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b=y(b)?\"s \"+b+\"-\"+this.index+\" [\"+this.text.substring(b,d)+\"]\":\" \"+d;throw ka(\"lexerr\",a,b,this.text);},readNumber:function(){for(var a=\"\",b=this.index;this.index<this.text.length;){var d=G(this.text.charAt(this.index));if(\".\"==d||this.isNumber(d))a+=d;else{var c=this.peek();if(\"e\"==d&&this.isExpOperator(c))a+=d;else if(this.isExpOperator(d)&&c&&this.isNumber(c)&&\"e\"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||\nc&&this.isNumber(c)||\"e\"!=a.charAt(a.length-1))break;else this.throwError(\"Invalid exponent\")}this.index++}this.tokens.push({index:b,text:a,constant:!0,value:Number(a)})},readIdent:function(){for(var a=this.index;this.index<this.text.length;){var b=this.text.charAt(this.index);if(!this.isIdent(b)&&!this.isNumber(b))break;this.index++}this.tokens.push({index:a,text:this.text.slice(a,this.index),identifier:!0})},readString:function(a){var b=this.index;this.index++;for(var d=\"\",c=a,e=!1;this.index<this.text.length;){var f=\nthis.text.charAt(this.index),c=c+f;if(e)\"u\"===f?(e=this.text.substring(this.index+1,this.index+5),e.match(/[\\da-f]{4}/i)||this.throwError(\"Invalid unicode escape [\\\\u\"+e+\"]\"),this.index+=4,d+=String.fromCharCode(parseInt(e,16))):d+=Hg[f]||f,e=!1;else if(\"\\\\\"===f)e=!0;else{if(f===a){this.index++;this.tokens.push({index:b,text:c,constant:!0,value:d});return}d+=f}this.index++}this.throwError(\"Unterminated quote\",b)}};var q=function(a,b){this.lexer=a;this.options=b};q.Program=\"Program\";q.ExpressionStatement=\n\"ExpressionStatement\";q.AssignmentExpression=\"AssignmentExpression\";q.ConditionalExpression=\"ConditionalExpression\";q.LogicalExpression=\"LogicalExpression\";q.BinaryExpression=\"BinaryExpression\";q.UnaryExpression=\"UnaryExpression\";q.CallExpression=\"CallExpression\";q.MemberExpression=\"MemberExpression\";q.Identifier=\"Identifier\";q.Literal=\"Literal\";q.ArrayExpression=\"ArrayExpression\";q.Property=\"Property\";q.ObjectExpression=\"ObjectExpression\";q.ThisExpression=\"ThisExpression\";q.LocalsExpression=\"LocalsExpression\";\nq.NGValueParameter=\"NGValueParameter\";q.prototype={ast:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.program();0!==this.tokens.length&&this.throwError(\"is an unexpected token\",this.tokens[0]);return a},program:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek(\"}\",\")\",\";\",\"]\")&&a.push(this.expressionStatement()),!this.expect(\";\"))return{type:q.Program,body:a}},expressionStatement:function(){return{type:q.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var a=\nthis.expression();this.expect(\"|\");)a=this.filter(a);return a},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary();this.expect(\"=\")&&(a={type:q.AssignmentExpression,left:a,right:this.assignment(),operator:\"=\"});return a},ternary:function(){var a=this.logicalOR(),b,d;return this.expect(\"?\")&&(b=this.expression(),this.consume(\":\"))?(d=this.expression(),{type:q.ConditionalExpression,test:a,alternate:b,consequent:d}):a},logicalOR:function(){for(var a=this.logicalAND();this.expect(\"||\");)a=\n{type:q.LogicalExpression,operator:\"||\",left:a,right:this.logicalAND()};return a},logicalAND:function(){for(var a=this.equality();this.expect(\"&&\");)a={type:q.LogicalExpression,operator:\"&&\",left:a,right:this.equality()};return a},equality:function(){for(var a=this.relational(),b;b=this.expect(\"==\",\"!=\",\"===\",\"!==\");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.relational()};return a},relational:function(){for(var a=this.additive(),b;b=this.expect(\"<\",\">\",\"<=\",\">=\");)a={type:q.BinaryExpression,\noperator:b.text,left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect(\"+\",\"-\");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect(\"*\",\"/\",\"%\");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect(\"+\",\"-\",\"!\"))?{type:q.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:\nthis.primary()},primary:function(){var a;this.expect(\"(\")?(a=this.filterChain(),this.consume(\")\")):this.expect(\"[\")?a=this.arrayDeclaration():this.expect(\"{\")?a=this.object():this.constants.hasOwnProperty(this.peek().text)?a=Oa(this.constants[this.consume().text]):this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError(\"not a primary expression\",this.peek());for(var b;b=this.expect(\"(\",\"[\",\".\");)\"(\"===b.text?(a={type:q.CallExpression,callee:a,arguments:this.parseArguments()},\nthis.consume(\")\")):\"[\"===b.text?(a={type:q.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume(\"]\")):\".\"===b.text?a={type:q.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError(\"IMPOSSIBLE\");return a},filter:function(a){a=[a];for(var b={type:q.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(\":\");)a.push(this.expression());return b},parseArguments:function(){var a=[];if(\")\"!==this.peekToken().text){do a.push(this.expression());\nwhile(this.expect(\",\"))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError(\"is not a valid identifier\",a);return{type:q.Identifier,name:a.text}},constant:function(){return{type:q.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if(\"]\"!==this.peekToken().text){do{if(this.peek(\"]\"))break;a.push(this.expression())}while(this.expect(\",\"))}this.consume(\"]\");return{type:q.ArrayExpression,elements:a}},object:function(){var a=[],b;if(\"}\"!==this.peekToken().text){do{if(this.peek(\"}\"))break;\nb={type:q.Property,kind:\"init\"};this.peek().constant?b.key=this.constant():this.peek().identifier?b.key=this.identifier():this.throwError(\"invalid key\",this.peek());this.consume(\":\");b.value=this.expression();a.push(b)}while(this.expect(\",\"))}this.consume(\"}\");return{type:q.ObjectExpression,properties:a}},throwError:function(a,b){throw ka(\"syntax\",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw ka(\"ueoe\",this.text);var b=this.expect(a);\nb||this.throwError(\"is unexpected, expecting [\"+a+\"]\",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw ka(\"ueoe\",this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},constants:{\"true\":{type:q.Literal,value:!0},\n\"false\":{type:q.Literal,value:!1},\"null\":{type:q.Literal,value:null},undefined:{type:q.Literal,value:v},\"this\":{type:q.ThisExpression},$locals:{type:q.LocalsExpression}}};ud.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.state={nextId:0,filters:{},expensiveChecks:b,fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};R(c,d.$filter);var e=\"\",f;this.stage=\"assign\";if(f=sd(c))this.state.computing=\"assign\",e=this.nextId(),this.recurse(f,e),this.return_(e),\ne=\"fn.assign=\"+this.generateFunction(\"assign\",\"s,v,l\");f=qd(c.body);d.stage=\"inputs\";n(f,function(a,b){var c=\"fn\"+b;d.state[c]={vars:[],body:[],own:{}};d.state.computing=c;var e=d.nextId();d.recurse(a,e);d.return_(e);d.state.inputs.push(c);a.watchId=b});this.state.computing=\"fn\";this.stage=\"main\";this.recurse(c);e='\"'+this.USE+\" \"+this.STRICT+'\";\\n'+this.filterPrefix()+\"var fn=\"+this.generateFunction(\"fn\",\"s,l,a,i\")+e+this.watchFns()+\"return fn;\";e=(new Function(\"$filter\",\"ensureSafeMemberName\",\"ensureSafeObject\",\n\"ensureSafeFunction\",\"getStringValue\",\"ensureSafeAssignContext\",\"ifDefined\",\"plus\",\"text\",e))(this.$filter,Xa,Aa,od,hg,Ib,lg,pd,a);this.state=this.stage=v;e.literal=td(c);e.constant=c.constant;return e},USE:\"use\",STRICT:\"strict\",watchFns:function(){var a=[],b=this.state.inputs,d=this;n(b,function(b){a.push(\"var \"+b+\"=\"+d.generateFunction(b,\"s\"))});b.length&&a.push(\"fn.inputs=[\"+b.join(\",\")+\"];\");return a.join(\"\")},generateFunction:function(a,b){return\"function(\"+b+\"){\"+this.varsPrefix(a)+this.body(a)+\n\"};\"},filterPrefix:function(){var a=[],b=this;n(this.state.filters,function(d,c){a.push(d+\"=$filter(\"+b.escape(c)+\")\")});return a.length?\"var \"+a.join(\",\")+\";\":\"\"},varsPrefix:function(a){return this.state[a].vars.length?\"var \"+this.state[a].vars.join(\",\")+\";\":\"\"},body:function(a){return this.state[a].body.join(\"\")},recurse:function(a,b,d,c,e,f){var g,h,k=this,l,m;c=c||B;if(!f&&y(a.watchId))b=b||this.nextId(),this.if_(\"i\",this.lazyAssign(b,this.computedMember(\"i\",a.watchId)),this.lazyRecurse(a,b,d,\nc,e,!0));else switch(a.type){case q.Program:n(a.body,function(b,c){k.recurse(b.expression,v,v,function(a){h=a});c!==a.body.length-1?k.current().body.push(h,\";\"):k.return_(h)});break;case q.Literal:m=this.escape(a.value);this.assign(b,m);c(m);break;case q.UnaryExpression:this.recurse(a.argument,v,v,function(a){h=a});m=a.operator+\"(\"+this.ifDefined(h,0)+\")\";this.assign(b,m);c(m);break;case q.BinaryExpression:this.recurse(a.left,v,v,function(a){g=a});this.recurse(a.right,v,v,function(a){h=a});m=\"+\"===\na.operator?this.plus(g,h):\"-\"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(h,0):\"(\"+g+\")\"+a.operator+\"(\"+h+\")\";this.assign(b,m);c(m);break;case q.LogicalExpression:b=b||this.nextId();k.recurse(a.left,b);k.if_(\"&&\"===a.operator?b:k.not(b),k.lazyRecurse(a.right,b));c(b);break;case q.ConditionalExpression:b=b||this.nextId();k.recurse(a.test,b);k.if_(b,k.lazyRecurse(a.alternate,b),k.lazyRecurse(a.consequent,b));c(b);break;case q.Identifier:b=b||this.nextId();d&&(d.context=\"inputs\"===k.stage?\n\"s\":this.assign(this.nextId(),this.getHasOwnProperty(\"l\",a.name)+\"?l:s\"),d.computed=!1,d.name=a.name);Xa(a.name);k.if_(\"inputs\"===k.stage||k.not(k.getHasOwnProperty(\"l\",a.name)),function(){k.if_(\"inputs\"===k.stage||\"s\",function(){e&&1!==e&&k.if_(k.not(k.nonComputedMember(\"s\",a.name)),k.lazyAssign(k.nonComputedMember(\"s\",a.name),\"{}\"));k.assign(b,k.nonComputedMember(\"s\",a.name))})},b&&k.lazyAssign(b,k.nonComputedMember(\"l\",a.name)));(k.state.expensiveChecks||Jb(a.name))&&k.addEnsureSafeObject(b);c(b);\nbreak;case q.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();k.recurse(a.object,g,v,function(){k.if_(k.notNull(g),function(){e&&1!==e&&k.addEnsureSafeAssignContext(g);if(a.computed)h=k.nextId(),k.recurse(a.property,h),k.getStringValue(h),k.addEnsureSafeMemberName(h),e&&1!==e&&k.if_(k.not(k.computedMember(g,h)),k.lazyAssign(k.computedMember(g,h),\"{}\")),m=k.ensureSafeObject(k.computedMember(g,h)),k.assign(b,m),d&&(d.computed=!0,d.name=h);else{Xa(a.property.name);e&&\n1!==e&&k.if_(k.not(k.nonComputedMember(g,a.property.name)),k.lazyAssign(k.nonComputedMember(g,a.property.name),\"{}\"));m=k.nonComputedMember(g,a.property.name);if(k.state.expensiveChecks||Jb(a.property.name))m=k.ensureSafeObject(m);k.assign(b,m);d&&(d.computed=!1,d.name=a.property.name)}},function(){k.assign(b,\"undefined\")});c(b)},!!e);break;case q.CallExpression:b=b||this.nextId();a.filter?(h=k.filter(a.callee.name),l=[],n(a.arguments,function(a){var b=k.nextId();k.recurse(a,b);l.push(b)}),m=h+\"(\"+\nl.join(\",\")+\")\",k.assign(b,m),c(b)):(h=k.nextId(),g={},l=[],k.recurse(a.callee,h,g,function(){k.if_(k.notNull(h),function(){k.addEnsureSafeFunction(h);n(a.arguments,function(a){k.recurse(a,k.nextId(),v,function(a){l.push(k.ensureSafeObject(a))})});g.name?(k.state.expensiveChecks||k.addEnsureSafeObject(g.context),m=k.member(g.context,g.name,g.computed)+\"(\"+l.join(\",\")+\")\"):m=h+\"(\"+l.join(\",\")+\")\";m=k.ensureSafeObject(m);k.assign(b,m)},function(){k.assign(b,\"undefined\")});c(b)}));break;case q.AssignmentExpression:h=\nthis.nextId();g={};if(!rd(a.left))throw ka(\"lval\");this.recurse(a.left,v,g,function(){k.if_(k.notNull(g.context),function(){k.recurse(a.right,h);k.addEnsureSafeObject(k.member(g.context,g.name,g.computed));k.addEnsureSafeAssignContext(g.context);m=k.member(g.context,g.name,g.computed)+a.operator+h;k.assign(b,m);c(b||m)})},1);break;case q.ArrayExpression:l=[];n(a.elements,function(a){k.recurse(a,k.nextId(),v,function(a){l.push(a)})});m=\"[\"+l.join(\",\")+\"]\";this.assign(b,m);c(m);break;case q.ObjectExpression:l=\n[];n(a.properties,function(a){k.recurse(a.value,k.nextId(),v,function(b){l.push(k.escape(a.key.type===q.Identifier?a.key.name:\"\"+a.key.value)+\":\"+b)})});m=\"{\"+l.join(\",\")+\"}\";this.assign(b,m);c(m);break;case q.ThisExpression:this.assign(b,\"s\");c(\"s\");break;case q.LocalsExpression:this.assign(b,\"l\");c(\"l\");break;case q.NGValueParameter:this.assign(b,\"v\"),c(\"v\")}},getHasOwnProperty:function(a,b){var d=a+\".\"+b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+\"&&(\"+this.escape(b)+\" in \"+\na+\")\"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,\"=\",b,\";\"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return\"ifDefined(\"+a+\",\"+this.escape(b)+\")\"},plus:function(a,b){return\"plus(\"+a+\",\"+b+\")\"},return_:function(a){this.current().body.push(\"return \",a,\";\")},if_:function(a,b,d){if(!0===a)b();else{var c=this.current().body;c.push(\"if(\",a,\"){\");b();c.push(\"}\");\nd&&(c.push(\"else{\"),d(),c.push(\"}\"))}},not:function(a){return\"!(\"+a+\")\"},notNull:function(a){return a+\"!=null\"},nonComputedMember:function(a,b){return a+\".\"+b},computedMember:function(a,b){return a+\"[\"+b+\"]\"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a,b)},addEnsureSafeObject:function(a){this.current().body.push(this.ensureSafeObject(a),\";\")},addEnsureSafeMemberName:function(a){this.current().body.push(this.ensureSafeMemberName(a),\";\")},addEnsureSafeFunction:function(a){this.current().body.push(this.ensureSafeFunction(a),\n\";\")},addEnsureSafeAssignContext:function(a){this.current().body.push(this.ensureSafeAssignContext(a),\";\")},ensureSafeObject:function(a){return\"ensureSafeObject(\"+a+\",text)\"},ensureSafeMemberName:function(a){return\"ensureSafeMemberName(\"+a+\",text)\"},ensureSafeFunction:function(a){return\"ensureSafeFunction(\"+a+\",text)\"},getStringValue:function(a){this.assign(a,\"getStringValue(\"+a+\")\")},ensureSafeAssignContext:function(a){return\"ensureSafeAssignContext(\"+a+\",text)\"},lazyRecurse:function(a,b,d,c,e,f){var g=\nthis;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return\"\\\\u\"+(\"0000\"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(F(a))return\"'\"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+\"'\";if(N(a))return a.toString();if(!0===a)return\"true\";if(!1===a)return\"false\";if(null===a)return\"null\";if(\"undefined\"===typeof a)return\"undefined\";throw ka(\"esc\");},nextId:function(a,\nb){var d=\"v\"+this.state.nextId++;a||this.current().vars.push(d+(b?\"=\"+b:\"\"));return d},current:function(){return this.state[this.state.computing]}};vd.prototype={compile:function(a,b){var d=this,c=this.astBuilder.ast(a);this.expression=a;this.expensiveChecks=b;R(c,d.$filter);var e,f;if(e=sd(c))f=this.recurse(e);e=qd(c.body);var g;e&&(g=[],n(e,function(a,b){var c=d.recurse(a);a.input=c;g.push(c);a.watchId=b}));var h=[];n(c.body,function(a){h.push(d.recurse(a.expression))});e=0===c.body.length?function(){}:\n1===c.body.length?h[0]:function(a,b){var c;n(h,function(d){c=d(a,b)});return c};f&&(e.assign=function(a,b,c){return f(a,c,b)});g&&(e.inputs=g);e.literal=td(c);e.constant=c.constant;return e},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case q.Literal:return this.value(a.value,b);case q.UnaryExpression:return e=this.recurse(a.argument),this[\"unary\"+a.operator](e,b);case q.BinaryExpression:return c=this.recurse(a.left),e=this.recurse(a.right),\nthis[\"binary\"+a.operator](c,e,b);case q.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this[\"binary\"+a.operator](c,e,b);case q.ConditionalExpression:return this[\"ternary?:\"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case q.Identifier:return Xa(a.name,f.expression),f.identifier(a.name,f.expensiveChecks||Jb(a.name),b,d,f.expression);case q.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(Xa(a.property.name,f.expression),\ne=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c,e,b,d,f.expression):this.nonComputedMember(c,e,f.expensiveChecks,b,d,f.expression);case q.CallExpression:return g=[],n(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var r=[],n=0;n<g.length;++n)r.push(g[n](a,c,d,f));a=e.apply(v,r,f);return b?{context:v,name:v,value:a}:a}:function(a,c,d,m){var r=\ne(a,c,d,m),n;if(null!=r.value){Aa(r.context,f.expression);od(r.value,f.expression);n=[];for(var q=0;q<g.length;++q)n.push(Aa(g[q](a,c,d,m),f.expression));n=Aa(r.value.apply(r.context,n),f.expression)}return b?{value:n}:n};case q.AssignmentExpression:return c=this.recurse(a.left,!0,1),e=this.recurse(a.right),function(a,d,g,m){var r=c(a,d,g,m);a=e(a,d,g,m);Aa(r.value,f.expression);Ib(r.context);r.context[r.name]=a;return b?{value:a}:a};case q.ArrayExpression:return g=[],n(a.elements,function(a){g.push(f.recurse(a))}),\nfunction(a,c,d,e){for(var f=[],n=0;n<g.length;++n)f.push(g[n](a,c,d,e));return b?{value:f}:f};case q.ObjectExpression:return g=[],n(a.properties,function(a){g.push({key:a.key.type===q.Identifier?a.key.name:\"\"+a.key.value,value:f.recurse(a.value)})}),function(a,c,d,e){for(var f={},n=0;n<g.length;++n)f[g[n].key]=g[n].value(a,c,d,e);return b?{value:f}:f};case q.ThisExpression:return function(a){return b?{value:a}:a};case q.LocalsExpression:return function(a,c){return b?{value:c}:c};case q.NGValueParameter:return function(a,\nc,d,e){return b?{value:d}:d}}},\"unary+\":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=y(d)?+d:0;return b?{value:d}:d}},\"unary-\":function(a,b){return function(d,c,e,f){d=a(d,c,e,f);d=y(d)?-d:0;return b?{value:d}:d}},\"unary!\":function(a,b){return function(d,c,e,f){d=!a(d,c,e,f);return b?{value:d}:d}},\"binary+\":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);h=pd(h,c);return d?{value:h}:h}},\"binary-\":function(a,b,d){return function(c,e,f,g){var h=a(c,e,f,g);c=b(c,e,f,g);\nh=(y(h)?h:0)-(y(c)?c:0);return d?{value:h}:h}},\"binary*\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)*b(c,e,f,g);return d?{value:c}:c}},\"binary/\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)/b(c,e,f,g);return d?{value:c}:c}},\"binary%\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)%b(c,e,f,g);return d?{value:c}:c}},\"binary===\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)===b(c,e,f,g);return d?{value:c}:c}},\"binary!==\":function(a,b,d){return function(c,e,f,g){c=a(c,\ne,f,g)!==b(c,e,f,g);return d?{value:c}:c}},\"binary==\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)==b(c,e,f,g);return d?{value:c}:c}},\"binary!=\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)!=b(c,e,f,g);return d?{value:c}:c}},\"binary<\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<b(c,e,f,g);return d?{value:c}:c}},\"binary>\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},\"binary<=\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,\ng)<=b(c,e,f,g);return d?{value:c}:c}},\"binary>=\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},\"binary&&\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},\"binary||\":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},\"ternary?:\":function(a,b,d,c){return function(e,f,g,h){e=a(e,f,g,h)?b(e,f,g,h):d(e,f,g,h);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:v,\nname:v,value:a}:a}},identifier:function(a,b,d,c,e){return function(f,g,h,k){f=g&&a in g?g:f;c&&1!==c&&f&&!f[a]&&(f[a]={});g=f?f[a]:v;b&&Aa(g,e);return d?{context:f,name:a,value:g}:g}},computedMember:function(a,b,d,c,e){return function(f,g,h,k){var l=a(f,g,h,k),m,n;null!=l&&(m=b(f,g,h,k),m+=\"\",Xa(m,e),c&&1!==c&&(Ib(l),l&&!l[m]&&(l[m]={})),n=l[m],Aa(n,e));return d?{context:l,name:m,value:n}:n}},nonComputedMember:function(a,b,d,c,e,f){return function(g,h,k,l){g=a(g,h,k,l);e&&1!==e&&(Ib(g),g&&!g[b]&&\n(g[b]={}));h=null!=g?g[b]:v;(d||Jb(b))&&Aa(h,f);return c?{context:g,name:b,value:h}:h}},inputs:function(a,b){return function(d,c,e,f){return f?f[b]:a(d,c,e)}}};var jc=function(a,b,d){this.lexer=a;this.$filter=b;this.options=d;this.ast=new q(this.lexer);this.astCompiler=d.csp?new vd(this.ast,b):new ud(this.ast,b)};jc.prototype={constructor:jc,parse:function(a){return this.astCompiler.compile(a,this.options.expensiveChecks)}};var mg=Object.prototype.valueOf,Ba=H(\"$sce\"),qa={HTML:\"html\",CSS:\"css\",URL:\"url\",\nRESOURCE_URL:\"resourceUrl\",JS:\"js\"},ja=H(\"$compile\"),Y=W.createElement(\"a\"),zd=za(O.location.href);Ad.$inject=[\"$document\"];Lc.$inject=[\"$provide\"];var Hd=22,Gd=\".\",lc=\"0\";Bd.$inject=[\"$locale\"];Dd.$inject=[\"$locale\"];var yg={yyyy:aa(\"FullYear\",4),yy:aa(\"FullYear\",2,0,!0),y:aa(\"FullYear\",1),MMMM:Lb(\"Month\"),MMM:Lb(\"Month\",!0),MM:aa(\"Month\",2,1),M:aa(\"Month\",1,1),dd:aa(\"Date\",2),d:aa(\"Date\",1),HH:aa(\"Hours\",2),H:aa(\"Hours\",1),hh:aa(\"Hours\",2,-12),h:aa(\"Hours\",1,-12),mm:aa(\"Minutes\",2),m:aa(\"Minutes\",\n1),ss:aa(\"Seconds\",2),s:aa(\"Seconds\",1),sss:aa(\"Milliseconds\",3),EEEE:Lb(\"Day\"),EEE:Lb(\"Day\",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?\"+\":\"\")+(Kb(Math[0<a?\"floor\":\"ceil\"](a/60),2)+Kb(Math.abs(a%60),2))},ww:Jd(2),w:Jd(1),G:mc,GG:mc,GGG:mc,GGGG:function(a,b){return 0>=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},xg=/((?:[^yMdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,wg=/^\\-?\\d+$/;Cd.$inject=[\"$locale\"];\nvar rg=ba(G),sg=ba(ub);Ed.$inject=[\"$parse\"];var oe=ba({restrict:\"E\",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if(\"a\"===b[0].nodeName.toLowerCase()){var e=\"[object SVGAnimatedString]\"===ga.call(b.prop(\"href\"))?\"xlink:href\":\"href\";b.on(\"click\",function(a){b.attr(e)||a.preventDefault()})}}}}),vb={};n(Db,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if(\"multiple\"!=a){var c=va(\"ng-\"+b),e=d;\"checked\"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,\ne)});vb[c]=function(){return{restrict:\"A\",priority:100,link:e}}}});n(cd,function(a,b){vb[b]=function(){return{priority:100,link:function(a,c,e){if(\"ngPattern\"===b&&\"/\"==e.ngPattern.charAt(0)&&(c=e.ngPattern.match(Ag))){e.$set(\"ngPattern\",new RegExp(c[1],c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});n([\"src\",\"srcset\",\"href\"],function(a){var b=va(\"ng-\"+a);vb[b]=function(){return{priority:99,link:function(d,c,e){var f=a,g=a;\"href\"===a&&\"[object SVGAnimatedString]\"===ga.call(c.prop(\"href\"))&&\n(g=\"xlinkHref\",e.$attr[g]=\"xlink:href\",f=null);e.$observe(b,function(b){b?(e.$set(g,b),xa&&f&&c.prop(f,e[g])):\"href\"===a&&e.$set(g,null)})}}}});var Mb={$addControl:B,$$renameControl:function(a,b){a.$name=b},$removeControl:B,$setValidity:B,$setDirty:B,$setPristine:B,$setSubmitted:B};Kd.$inject=[\"$element\",\"$attrs\",\"$scope\",\"$animate\",\"$interpolate\"];var Sd=function(a){return[\"$timeout\",\"$parse\",function(b,d){function c(a){return\"\"===a?d('this[\"\"]').assign:d(a).assign||B}return{name:\"form\",restrict:a?\n\"EAC\":\"E\",require:[\"form\",\"^^?form\"],controller:Kd,compile:function(d,f){d.addClass(Ya).addClass(ob);var g=f.name?\"name\":a&&f.ngForm?\"ngForm\":!1;return{pre:function(a,d,e,f){var n=f[0];if(!(\"action\"in e)){var s=function(b){a.$apply(function(){n.$commitViewValue();n.$setSubmitted()});b.preventDefault()};d[0].addEventListener(\"submit\",s,!1);d.on(\"$destroy\",function(){b(function(){d[0].removeEventListener(\"submit\",s,!1)},0,!1)})}(f[1]||n.$$parentForm).$addControl(n);var q=g?c(n.$name):B;g&&(q(a,n),e.$observe(g,\nfunction(b){n.$name!==b&&(q(a,v),n.$$parentForm.$$renameControl(n,b),q=c(n.$name),q(a,n))}));d.on(\"$destroy\",function(){n.$$parentForm.$removeControl(n);q(a,v);T(n,Mb)})}}}}}]},pe=Sd(),Ce=Sd(!0),zg=/\\d{4}-[01]\\d-[0-3]\\dT[0-2]\\d:[0-5]\\d:[0-5]\\d\\.\\d+([+-][0-2]\\d:[0-5]\\d|Z)/,Ig=/^[a-z][a-z\\d.+-]*:\\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\\s:/?#]+|\\[[a-f\\d:]+\\])(?::\\d+)?(?:\\/[^?#]*)?(?:\\?[^#]*)?(?:#.*)?$/i,Jg=/^[a-z0-9!#$%&'*+\\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,Kg=\n/^\\s*(\\-|\\+)?(\\d+|(\\d*(\\.\\d*)))([eE][+-]?\\d+)?\\s*$/,Td=/^(\\d{4})-(\\d{2})-(\\d{2})$/,Ud=/^(\\d{4})-(\\d\\d)-(\\d\\d)T(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/,pc=/^(\\d{4})-W(\\d\\d)$/,Vd=/^(\\d{4})-(\\d\\d)$/,Wd=/^(\\d\\d):(\\d\\d)(?::(\\d\\d)(\\.\\d{1,3})?)?$/,Xd={text:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c)},date:mb(\"date\",Td,Ob(Td,[\"yyyy\",\"MM\",\"dd\"]),\"yyyy-MM-dd\"),\"datetime-local\":mb(\"datetimelocal\",Ud,Ob(Ud,\"yyyy MM dd HH mm ss sss\".split(\" \")),\"yyyy-MM-ddTHH:mm:ss.sss\"),time:mb(\"time\",Wd,Ob(Wd,[\"HH\",\"mm\",\"ss\",\n\"sss\"]),\"HH:mm:ss.sss\"),week:mb(\"week\",pc,function(a,b){if(V(a))return a;if(F(a)){pc.lastIndex=0;var d=pc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,h=0,k=Id(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),h=b.getMilliseconds());return new Date(c,0,k.getDate()+e,d,f,g,h)}}return NaN},\"yyyy-Www\"),month:mb(\"month\",Vd,Ob(Vd,[\"yyyy\",\"MM\"]),\"yyyy-MM\"),number:function(a,b,d,c,e,f){Md(a,b,d,c);lb(a,b,d,c,e,f);c.$$parserName=\"number\";c.$parsers.push(function(a){return c.$isEmpty(a)?null:\nKg.test(a)?parseFloat(a):v});c.$formatters.push(function(a){if(!c.$isEmpty(a)){if(!N(a))throw nb(\"numfmt\",a);a=a.toString()}return a});if(y(d.min)||d.ngMin){var g;c.$validators.min=function(a){return c.$isEmpty(a)||x(g)||a>=g};d.$observe(\"min\",function(a){y(a)&&!N(a)&&(a=parseFloat(a,10));g=N(a)&&!isNaN(a)?a:v;c.$validate()})}if(y(d.max)||d.ngMax){var h;c.$validators.max=function(a){return c.$isEmpty(a)||x(h)||a<=h};d.$observe(\"max\",function(a){y(a)&&!N(a)&&(a=parseFloat(a,10));h=N(a)&&!isNaN(a)?\na:v;c.$validate()})}},url:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c);c.$$parserName=\"url\";c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||Ig.test(d)}},email:function(a,b,d,c,e,f){lb(a,b,d,c,e,f);nc(c);c.$$parserName=\"email\";c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||Jg.test(d)}},radio:function(a,b,d,c){x(d.name)&&b.attr(\"name\",++pb);b.on(\"click\",function(a){b[0].checked&&c.$setViewValue(d.value,a&&a.type)});c.$render=function(){b[0].checked=d.value==c.$viewValue};\nd.$observe(\"value\",c.$render)},checkbox:function(a,b,d,c,e,f,g,h){var k=Nd(h,a,\"ngTrueValue\",d.ngTrueValue,!0),l=Nd(h,a,\"ngFalseValue\",d.ngFalseValue,!1);b.on(\"click\",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty=function(a){return!1===a};c.$formatters.push(function(a){return oa(a,k)});c.$parsers.push(function(a){return a?k:l})},hidden:B,button:B,submit:B,reset:B,file:B},Fc=[\"$browser\",\"$sniffer\",\"$filter\",\"$parse\",function(a,b,d,\nc){return{restrict:\"E\",require:[\"?ngModel\"],link:{pre:function(e,f,g,h){h[0]&&(Xd[G(g.type)]||Xd.text)(e,f,g,h[0],b,a,d,c)}}}}],Lg=/^(true|false|\\d+)$/,Ue=function(){return{restrict:\"A\",priority:100,compile:function(a,b){return Lg.test(b.ngValue)?function(a,b,e){e.$set(\"value\",a.$eval(e.ngValue))}:function(a,b,e){a.$watch(e.ngValue,function(a){e.$set(\"value\",a)})}}}},ue=[\"$compile\",function(a){return{restrict:\"AC\",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,\ne.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=x(a)?\"\":a})}}}}],we=[\"$interpolate\",\"$compile\",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe(\"ngBindTemplate\",function(a){d.textContent=x(a)?\"\":a})}}}}],ve=[\"$sce\",\"$parse\",\"$compile\",function(a,b,d){return{restrict:\"A\",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(a){return(a||\"\").toString()});\nd.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){c.html(a.getTrustedHtml(f(b))||\"\")})}}}}],Te=ba({restrict:\"A\",require:\"ngModel\",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),xe=oc(\"\",!0),ze=oc(\"Odd\",0),ye=oc(\"Even\",1),Ae=Ma({compile:function(a,b){b.$set(\"ngCloak\",v);a.removeClass(\"ng-cloak\")}}),Be=[function(){return{restrict:\"A\",scope:!0,controller:\"@\",priority:500}}],Kc={},Mg={blur:!0,focus:!0};n(\"click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste\".split(\" \"),\nfunction(a){var b=va(\"ng-\"+a);Kc[b]=[\"$parse\",\"$rootScope\",function(d,c){return{restrict:\"A\",compile:function(e,f){var g=d(f[b],null,!0);return function(b,d){d.on(a,function(d){var e=function(){g(b,{$event:d})};Mg[a]&&c.$$phase?b.$evalAsync(e):b.$apply(e)})}}}}]});var Ee=[\"$animate\",function(a){return{multiElement:!0,transclude:\"element\",priority:600,terminal:!0,restrict:\"A\",$$tlb:!0,link:function(b,d,c,e,f){var g,h,k;b.$watch(c.ngIf,function(b){b?h||f(function(b,e){h=e;b[b.length++]=W.createComment(\" end ngIf: \"+\nc.ngIf+\" \");g={clone:b};a.enter(b,d.parent(),d)}):(k&&(k.remove(),k=null),h&&(h.$destroy(),h=null),g&&(k=tb(g.clone),a.leave(k).then(function(){k=null}),g=null))})}}}],Fe=[\"$templateRequest\",\"$anchorScroll\",\"$animate\",function(a,b,d){return{restrict:\"ECA\",priority:400,terminal:!0,transclude:\"element\",controller:ia.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||\"\",h=e.autoscroll;return function(c,e,m,n,s){var q=0,v,t,p,w=function(){t&&(t.remove(),t=null);v&&(v.$destroy(),v=null);p&&\n(d.leave(p).then(function(){t=null}),t=p,p=null)};c.$watch(f,function(f){var m=function(){!y(h)||h&&!c.$eval(h)||b()},z=++q;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&z===q){var b=c.$new();n.template=a;a=s(b,function(a){w();d.enter(a,null,e).then(m)});v=b;p=a;v.$emit(\"$includeContentLoaded\",f);c.$eval(g)}},function(){c.$$destroyed||z!==q||(w(),c.$emit(\"$includeContentError\",f))}),c.$emit(\"$includeContentRequested\",f)):(w(),n.template=null)})}}}}],We=[\"$compile\",function(a){return{restrict:\"ECA\",\npriority:-400,require:\"ngInclude\",link:function(b,d,c,e){ga.call(d[0]).match(/SVG/)?(d.empty(),a(Nc(e.template,W).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],Ge=Ma({priority:450,compile:function(){return{pre:function(a,b,d){a.$eval(d.ngInit)}}}}),Se=function(){return{restrict:\"A\",priority:100,require:\"ngModel\",link:function(a,b,d,c){var e=b.attr(d.$attr.ngList)||\", \",f=\"false\"!==d.ngTrim,g=f?X(e):e;c.$parsers.push(function(a){if(!x(a)){var b=\n[];a&&n(a.split(g),function(a){a&&b.push(f?X(a):a)});return b}});c.$formatters.push(function(a){return L(a)?a.join(e):v});c.$isEmpty=function(a){return!a||!a.length}}}},ob=\"ng-valid\",Od=\"ng-invalid\",Ya=\"ng-pristine\",Nb=\"ng-dirty\",Qd=\"ng-pending\",nb=H(\"ngModel\"),Ng=[\"$scope\",\"$exceptionHandler\",\"$attrs\",\"$element\",\"$parse\",\"$animate\",\"$timeout\",\"$rootScope\",\"$q\",\"$interpolate\",function(a,b,d,c,e,f,g,h,k,l){this.$modelValue=this.$viewValue=Number.NaN;this.$$rawModelValue=v;this.$validators={};this.$asyncValidators=\n{};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=v;this.$name=l(d.name||\"\",!1)(a);this.$$parentForm=Mb;var m=e(d.ngModel),r=m.assign,q=m,I=r,K=null,t,p=this;this.$$setOptions=function(a){if((p.$options=a)&&a.getterSetter){var b=e(d.ngModel+\"()\"),f=e(d.ngModel+\"($$$p)\");q=function(a){var c=m(a);D(c)&&(c=b(a));return c};I=function(a,\nb){D(m(a))?f(a,{$$$p:p.$modelValue}):r(a,p.$modelValue)}}else if(!m.assign)throw nb(\"nonassign\",d.ngModel,ta(c));};this.$render=B;this.$isEmpty=function(a){return x(a)||\"\"===a||null===a||a!==a};this.$$updateEmptyClasses=function(a){p.$isEmpty(a)?(f.removeClass(c,\"ng-not-empty\"),f.addClass(c,\"ng-empty\")):(f.removeClass(c,\"ng-empty\"),f.addClass(c,\"ng-not-empty\"))};var w=0;Ld({ctrl:this,$element:c,set:function(a,b){a[b]=!0},unset:function(a,b){delete a[b]},$animate:f});this.$setPristine=function(){p.$dirty=\n!1;p.$pristine=!0;f.removeClass(c,Nb);f.addClass(c,Ya)};this.$setDirty=function(){p.$dirty=!0;p.$pristine=!1;f.removeClass(c,Ya);f.addClass(c,Nb);p.$$parentForm.$setDirty()};this.$setUntouched=function(){p.$touched=!1;p.$untouched=!0;f.setClass(c,\"ng-untouched\",\"ng-touched\")};this.$setTouched=function(){p.$touched=!0;p.$untouched=!1;f.setClass(c,\"ng-touched\",\"ng-untouched\")};this.$rollbackViewValue=function(){g.cancel(K);p.$viewValue=p.$$lastCommittedViewValue;p.$render()};this.$validate=function(){if(!N(p.$modelValue)||\n!isNaN(p.$modelValue)){var a=p.$$rawModelValue,b=p.$valid,c=p.$modelValue,d=p.$options&&p.$options.allowInvalid;p.$$runValidators(a,p.$$lastCommittedViewValue,function(e){d||b===e||(p.$modelValue=e?a:v,p.$modelValue!==c&&p.$$writeModelToScope())})}};this.$$runValidators=function(a,b,c){function d(){var c=!0;n(p.$validators,function(d,e){var g=d(a,b);c=c&&g;f(e,g)});return c?!0:(n(p.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;n(p.$asyncValidators,function(e,g){var h=e(a,\nb);if(!h||!D(h.then))throw nb(\"nopromise\",h);f(g,v);c.push(h.then(function(){f(g,!0)},function(a){d=!1;f(g,!1)}))});c.length?k.all(c).then(function(){g(d)},B):g(!0)}function f(a,b){h===w&&p.$setValidity(a,b)}function g(a){h===w&&c(a)}w++;var h=w;(function(){var a=p.$$parserName||\"parse\";if(x(t))f(a,null);else return t||(n(p.$validators,function(a,b){f(b,null)}),n(p.$asyncValidators,function(a,b){f(b,null)})),f(a,t),t;return!0})()?d()?e():g(!1):g(!1)};this.$commitViewValue=function(){var a=p.$viewValue;\ng.cancel(K);if(p.$$lastCommittedViewValue!==a||\"\"===a&&p.$$hasNativeValidators)p.$$updateEmptyClasses(a),p.$$lastCommittedViewValue=a,p.$pristine&&this.$setDirty(),this.$$parseAndValidate()};this.$$parseAndValidate=function(){var b=p.$$lastCommittedViewValue;if(t=x(b)?v:!0)for(var c=0;c<p.$parsers.length;c++)if(b=p.$parsers[c](b),x(b)){t=!1;break}N(p.$modelValue)&&isNaN(p.$modelValue)&&(p.$modelValue=q(a));var d=p.$modelValue,e=p.$options&&p.$options.allowInvalid;p.$$rawModelValue=b;e&&(p.$modelValue=\nb,p.$modelValue!==d&&p.$$writeModelToScope());p.$$runValidators(b,p.$$lastCommittedViewValue,function(a){e||(p.$modelValue=a?b:v,p.$modelValue!==d&&p.$$writeModelToScope())})};this.$$writeModelToScope=function(){I(a,p.$modelValue);n(p.$viewChangeListeners,function(a){try{a()}catch(c){b(c)}})};this.$setViewValue=function(a,b){p.$viewValue=a;p.$options&&!p.$options.updateOnDefault||p.$$debounceViewValueCommit(b)};this.$$debounceViewValueCommit=function(b){var c=0,d=p.$options;d&&y(d.debounce)&&(d=d.debounce,\nN(d)?c=d:N(d[b])?c=d[b]:N(d[\"default\"])&&(c=d[\"default\"]));g.cancel(K);c?K=g(function(){p.$commitViewValue()},c):h.$$phase?p.$commitViewValue():a.$apply(function(){p.$commitViewValue()})};a.$watch(function(){var b=q(a);if(b!==p.$modelValue&&(p.$modelValue===p.$modelValue||b===b)){p.$modelValue=p.$$rawModelValue=b;t=v;for(var c=p.$formatters,d=c.length,e=b;d--;)e=c[d](e);p.$viewValue!==e&&(p.$$updateEmptyClasses(e),p.$viewValue=p.$$lastCommittedViewValue=e,p.$render(),p.$$runValidators(b,e,B))}return b})}],\nRe=[\"$rootScope\",function(a){return{restrict:\"A\",require:[\"ngModel\",\"^?form\",\"^?ngModelOptions\"],controller:Ng,priority:1,compile:function(b){b.addClass(Ya).addClass(\"ng-untouched\").addClass(ob);return{pre:function(a,b,e,f){var g=f[0];b=f[1]||g.$$parentForm;g.$$setOptions(f[2]&&f[2].$options);b.$addControl(g);e.$observe(\"name\",function(a){g.$name!==a&&g.$$parentForm.$$renameControl(g,a)});a.$on(\"$destroy\",function(){g.$$parentForm.$removeControl(g)})},post:function(b,c,e,f){var g=f[0];if(g.$options&&\ng.$options.updateOn)c.on(g.$options.updateOn,function(a){g.$$debounceViewValueCommit(a&&a.type)});c.on(\"blur\",function(c){g.$touched||(a.$$phase?b.$evalAsync(g.$setTouched):b.$apply(g.$setTouched))})}}}}}],Og=/(\\s+|^)default(\\s+|$)/,Ve=function(){return{restrict:\"A\",controller:[\"$scope\",\"$attrs\",function(a,b){var d=this;this.$options=Oa(a.$eval(b.ngModelOptions));y(this.$options.updateOn)?(this.$options.updateOnDefault=!1,this.$options.updateOn=X(this.$options.updateOn.replace(Og,function(){d.$options.updateOnDefault=\n!0;return\" \"}))):this.$options.updateOnDefault=!0}]}},He=Ma({terminal:!0,priority:1E3}),Pg=H(\"ngOptions\"),Qg=/^\\s*([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+group\\s+by\\s+([\\s\\S]+?))?(?:\\s+disable\\s+when\\s+([\\s\\S]+?))?\\s+for\\s+(?:([\\$\\w][\\$\\w]*)|(?:\\(\\s*([\\$\\w][\\$\\w]*)\\s*,\\s*([\\$\\w][\\$\\w]*)\\s*\\)))\\s+in\\s+([\\s\\S]+?)(?:\\s+track\\s+by\\s+([\\s\\S]+?))?$/,Pe=[\"$compile\",\"$parse\",function(a,b){function d(a,c,d){function e(a,b,c,d,f){this.selectValue=a;this.viewValue=b;this.label=c;this.group=d;this.disabled=f}\nfunction l(a){var b;if(!q&&Ca(a))b=a;else{b=[];for(var c in a)a.hasOwnProperty(c)&&\"$\"!==c.charAt(0)&&b.push(c)}return b}var m=a.match(Qg);if(!m)throw Pg(\"iexp\",a,ta(c));var n=m[5]||m[7],q=m[6];a=/ as /.test(m[0])&&m[1];var v=m[9];c=b(m[2]?m[1]:n);var y=a&&b(a)||c,t=v&&b(v),p=v?function(a,b){return t(d,b)}:function(a){return Fa(a)},w=function(a,b){return p(a,B(a,b))},u=b(m[2]||m[1]),x=b(m[3]||\"\"),z=b(m[4]||\"\"),A=b(m[8]),C={},B=q?function(a,b){C[q]=b;C[n]=a;return C}:function(a){C[n]=a;return C};return{trackBy:v,\ngetTrackByValue:w,getWatchables:b(A,function(a){var b=[];a=a||[];for(var c=l(a),e=c.length,f=0;f<e;f++){var g=a===c?f:c[f],k=B(a[g],g),g=p(a[g],k);b.push(g);if(m[2]||m[1])g=u(d,k),b.push(g);m[4]&&(k=z(d,k),b.push(k))}return b}),getOptions:function(){for(var a=[],b={},c=A(d)||[],f=l(c),g=f.length,m=0;m<g;m++){var n=c===f?m:f[m],r=B(c[n],n),q=y(d,r),n=p(q,r),s=u(d,r),t=x(d,r),r=z(d,r),q=new e(n,q,s,t,r);a.push(q);b[n]=q}return{items:a,selectValueMap:b,getOptionFromViewValue:function(a){return b[w(a)]},\ngetViewValueFromOption:function(a){return v?ia.copy(a.viewValue):a.viewValue}}}}}var c=W.createElement(\"option\"),e=W.createElement(\"optgroup\");return{restrict:\"A\",terminal:!0,require:[\"select\",\"ngModel\"],link:{pre:function(a,b,c,d){d[0].registerOption=B},post:function(b,g,h,k){function l(a,b){a.element=b;b.disabled=a.disabled;a.label!==b.label&&(b.label=a.label,b.textContent=a.label);a.value!==b.value&&(b.value=a.selectValue)}function m(a,b,c,d){b&&G(b.nodeName)===c?c=b:(c=d.cloneNode(!1),b?a.insertBefore(c,\nb):a.appendChild(c));return c}function r(a){for(var b;a;)b=a.nextSibling,$b(a),a=b}function q(a){var b=w&&w[0],c=A&&A[0];if(b||c)for(;a&&(a===b||a===c||8===a.nodeType||\"option\"===ra(a)&&\"\"===a.value);)a=a.nextSibling;return a}function v(){var a=D&&x.readValue();D=E.getOptions();var b={},d=g[0].firstChild;z&&g.prepend(w);d=q(d);D.items.forEach(function(a){var f,h;y(a.group)?(f=b[a.group],f||(f=m(g[0],d,\"optgroup\",e),d=f.nextSibling,f.label=a.group,f=b[a.group]={groupElement:f,currentOptionElement:f.firstChild}),\nh=m(f.groupElement,f.currentOptionElement,\"option\",c),l(a,h),f.currentOptionElement=h.nextSibling):(h=m(g[0],d,\"option\",c),l(a,h),d=h.nextSibling)});Object.keys(b).forEach(function(a){r(b[a].currentOptionElement)});r(d);t.$render();if(!t.$isEmpty(a)){var f=x.readValue();(E.trackBy||p?oa(a,f):a===f)||(t.$setViewValue(f),t.$render())}}var x=k[0],t=k[1],p=h.multiple,w;k=0;for(var u=g.children(),B=u.length;k<B;k++)if(\"\"===u[k].value){w=u.eq(k);break}var z=!!w,A=C(c.cloneNode(!1));A.val(\"?\");var D,E=d(h.ngOptions,\ng,b);p?(t.$isEmpty=function(a){return!a||0===a.length},x.writeValue=function(a){D.items.forEach(function(a){a.element.selected=!1});a&&a.forEach(function(a){(a=D.getOptionFromViewValue(a))&&!a.disabled&&(a.element.selected=!0)})},x.readValue=function(){var a=g.val()||[],b=[];n(a,function(a){(a=D.selectValueMap[a])&&!a.disabled&&b.push(D.getViewValueFromOption(a))});return b},E.trackBy&&b.$watchCollection(function(){if(L(t.$viewValue))return t.$viewValue.map(function(a){return E.getTrackByValue(a)})},\nfunction(){t.$render()})):(x.writeValue=function(a){var b=D.getOptionFromViewValue(a);b&&!b.disabled?g[0].value!==b.selectValue&&(A.remove(),z||w.remove(),g[0].value=b.selectValue,b.element.selected=!0,b.element.setAttribute(\"selected\",\"selected\")):null===a||z?(A.remove(),z||g.prepend(w),g.val(\"\"),w.prop(\"selected\",!0),w.attr(\"selected\",!0)):(z||w.remove(),g.prepend(A),g.val(\"?\"),A.prop(\"selected\",!0),A.attr(\"selected\",!0))},x.readValue=function(){var a=D.selectValueMap[g.val()];return a&&!a.disabled?\n(z||w.remove(),A.remove(),D.getViewValueFromOption(a)):null},E.trackBy&&b.$watch(function(){return E.getTrackByValue(t.$viewValue)},function(){t.$render()}));z?(w.remove(),a(w)(b),w.removeClass(\"ng-scope\")):w=C(c.cloneNode(!1));v();b.$watchCollection(E.getWatchables,v)}}}}],Ie=[\"$locale\",\"$interpolate\",\"$log\",function(a,b,d){var c=/{}/g,e=/^when(Minus)?(.+)$/;return{link:function(f,g,h){function k(a){g.text(a||\"\")}var l=h.count,m=h.$attr.when&&g.attr(h.$attr.when),r=h.offset||0,q=f.$eval(m)||{},v=\n{},y=b.startSymbol(),t=b.endSymbol(),p=y+l+\"-\"+r+t,w=ia.noop,u;n(h,function(a,b){var c=e.exec(b);c&&(c=(c[1]?\"-\":\"\")+G(c[2]),q[c]=g.attr(h.$attr[b]))});n(q,function(a,d){v[d]=b(a.replace(c,p))});f.$watch(l,function(b){var c=parseFloat(b),e=isNaN(c);e||c in q||(c=a.pluralCat(c-r));c===u||e&&N(u)&&isNaN(u)||(w(),e=v[c],x(e)?(null!=b&&d.debug(\"ngPluralize: no rule defined for '\"+c+\"' in \"+m),w=B,k()):w=f.$watch(e,k),u=c)})}}}],Je=[\"$parse\",\"$animate\",function(a,b){var d=H(\"ngRepeat\"),c=function(a,b,\nc,d,k,l,m){a[c]=d;k&&(a[k]=l);a.$index=b;a.$first=0===b;a.$last=b===m-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(b&1))};return{restrict:\"A\",multiElement:!0,transclude:\"element\",priority:1E3,terminal:!0,$$tlb:!0,compile:function(e,f){var g=f.ngRepeat,h=W.createComment(\" end ngRepeat: \"+g+\" \"),k=g.match(/^\\s*([\\s\\S]+?)\\s+in\\s+([\\s\\S]+?)(?:\\s+as\\s+([\\s\\S]+?))?(?:\\s+track\\s+by\\s+([\\s\\S]+?))?\\s*$/);if(!k)throw d(\"iexp\",g);var l=k[1],m=k[2],r=k[3],q=k[4],k=l.match(/^(?:(\\s*[\\$\\w]+)|\\(\\s*([\\$\\w]+)\\s*,\\s*([\\$\\w]+)\\s*\\))$/);\nif(!k)throw d(\"iidexp\",l);var x=k[3]||k[1],y=k[2];if(r&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(r)||/^(null|undefined|this|\\$index|\\$first|\\$middle|\\$last|\\$even|\\$odd|\\$parent|\\$root|\\$id)$/.test(r)))throw d(\"badident\",r);var t,p,w,u,B={$id:Fa};q?t=a(q):(w=function(a,b){return Fa(b)},u=function(a){return a});return function(a,e,f,k,l){t&&(p=function(b,c,d){y&&(B[y]=b);B[x]=c;B.$index=d;return t(a,B)});var q=Z();a.$watchCollection(m,function(f){var k,m,s=e[0],t,B=Z(),D,E,H,F,L,G,N;r&&(a[r]=f);if(Ca(f))L=\nf,m=p||w;else for(N in m=p||u,L=[],f)sa.call(f,N)&&\"$\"!==N.charAt(0)&&L.push(N);D=L.length;N=Array(D);for(k=0;k<D;k++)if(E=f===L?k:L[k],H=f[E],F=m(E,H,k),q[F])G=q[F],delete q[F],B[F]=G,N[k]=G;else{if(B[F])throw n(N,function(a){a&&a.scope&&(q[a.id]=a)}),d(\"dupes\",g,F,H);N[k]={id:F,scope:v,clone:v};B[F]=!0}for(t in q){G=q[t];F=tb(G.clone);b.leave(F);if(F[0].parentNode)for(k=0,m=F.length;k<m;k++)F[k].$$NG_REMOVED=!0;G.scope.$destroy()}for(k=0;k<D;k++)if(E=f===L?k:L[k],H=f[E],G=N[k],G.scope){t=s;do t=\nt.nextSibling;while(t&&t.$$NG_REMOVED);G.clone[0]!=t&&b.move(tb(G.clone),null,C(s));s=G.clone[G.clone.length-1];c(G.scope,k,x,H,y,E,D)}else l(function(a,d){G.scope=d;var e=h.cloneNode(!1);a[a.length++]=e;b.enter(a,null,C(s));s=e;G.clone=a;B[G.id]=G;c(G.scope,k,x,H,y,E,D)});q=B})}}}}],Ke=[\"$animate\",function(a){return{restrict:\"A\",multiElement:!0,link:function(b,d,c){b.$watch(c.ngShow,function(b){a[b?\"removeClass\":\"addClass\"](d,\"ng-hide\",{tempClasses:\"ng-hide-animate\"})})}}}],De=[\"$animate\",function(a){return{restrict:\"A\",\nmultiElement:!0,link:function(b,d,c){b.$watch(c.ngHide,function(b){a[b?\"addClass\":\"removeClass\"](d,\"ng-hide\",{tempClasses:\"ng-hide-animate\"})})}}}],Le=Ma(function(a,b,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&n(d,function(a,c){b.css(c,\"\")});a&&b.css(a)},!0)}),Me=[\"$animate\",function(a){return{require:\"ngSwitch\",controller:[\"$scope\",function(){this.cases={}}],link:function(b,d,c,e){var f=[],g=[],h=[],k=[],l=function(a,b){return function(){a.splice(b,1)}};b.$watch(c.ngSwitch||c.on,function(b){var c,\nd;c=0;for(d=h.length;c<d;++c)a.cancel(h[c]);c=h.length=0;for(d=k.length;c<d;++c){var q=tb(g[c].clone);k[c].$destroy();(h[c]=a.leave(q)).then(l(h,c))}g.length=0;k.length=0;(f=e.cases[\"!\"+b]||e.cases[\"?\"])&&n(f,function(b){b.transclude(function(c,d){k.push(d);var e=b.element;c[c.length++]=W.createComment(\" end ngSwitchWhen: \");g.push({clone:c});a.enter(c,e.parent(),e)})})})}}}],Ne=Ma({transclude:\"element\",priority:1200,require:\"^ngSwitch\",multiElement:!0,link:function(a,b,d,c,e){c.cases[\"!\"+d.ngSwitchWhen]=\nc.cases[\"!\"+d.ngSwitchWhen]||[];c.cases[\"!\"+d.ngSwitchWhen].push({transclude:e,element:b})}}),Oe=Ma({transclude:\"element\",priority:1200,require:\"^ngSwitch\",multiElement:!0,link:function(a,b,d,c,e){c.cases[\"?\"]=c.cases[\"?\"]||[];c.cases[\"?\"].push({transclude:e,element:b})}}),Rg=H(\"ngTransclude\"),Qe=Ma({restrict:\"EAC\",link:function(a,b,d,c,e){d.ngTransclude===d.$attr.ngTransclude&&(d.ngTransclude=\"\");if(!e)throw Rg(\"orphan\",ta(b));e(function(a){a.length&&(b.empty(),b.append(a))},null,d.ngTransclude||\nd.ngTranscludeSlot)}}),qe=[\"$templateCache\",function(a){return{restrict:\"E\",terminal:!0,compile:function(b,d){\"text/ng-template\"==d.type&&a.put(d.id,b[0].text)}}}],Sg={$setViewValue:B,$render:B},Tg=[\"$element\",\"$scope\",\"$attrs\",function(a,b,d){var c=this,e=new Ua;c.ngModelCtrl=Sg;c.unknownOption=C(W.createElement(\"option\"));c.renderUnknownOption=function(b){b=\"? \"+Fa(b)+\" ?\";c.unknownOption.val(b);a.prepend(c.unknownOption);a.val(b)};b.$on(\"$destroy\",function(){c.renderUnknownOption=B});c.removeUnknownOption=\nfunction(){c.unknownOption.parent()&&c.unknownOption.remove()};c.readValue=function(){c.removeUnknownOption();return a.val()};c.writeValue=function(b){c.hasOption(b)?(c.removeUnknownOption(),a.val(b),\"\"===b&&c.emptyOption.prop(\"selected\",!0)):null==b&&c.emptyOption?(c.removeUnknownOption(),a.val(\"\")):c.renderUnknownOption(b)};c.addOption=function(a,b){if(8!==b[0].nodeType){Ta(a,'\"option value\"');\"\"===a&&(c.emptyOption=b);var d=e.get(a)||0;e.put(a,d+1);c.ngModelCtrl.$render();b[0].hasAttribute(\"selected\")&&\n(b[0].selected=!0)}};c.removeOption=function(a){var b=e.get(a);b&&(1===b?(e.remove(a),\"\"===a&&(c.emptyOption=v)):e.put(a,b-1))};c.hasOption=function(a){return!!e.get(a)};c.registerOption=function(a,b,d,e,l){if(e){var m;d.$observe(\"value\",function(a){y(m)&&c.removeOption(m);m=a;c.addOption(a,b)})}else l?a.$watch(l,function(a,e){d.$set(\"value\",a);e!==a&&c.removeOption(e);c.addOption(a,b)}):c.addOption(d.value,b);b.on(\"$destroy\",function(){c.removeOption(d.value);c.ngModelCtrl.$render()})}}],re=function(){return{restrict:\"E\",\nrequire:[\"select\",\"?ngModel\"],controller:Tg,priority:1,link:{pre:function(a,b,d,c){var e=c[1];if(e){var f=c[0];f.ngModelCtrl=e;b.on(\"change\",function(){a.$apply(function(){e.$setViewValue(f.readValue())})});if(d.multiple){f.readValue=function(){var a=[];n(b.find(\"option\"),function(b){b.selected&&a.push(b.value)});return a};f.writeValue=function(a){var c=new Ua(a);n(b.find(\"option\"),function(a){a.selected=y(c.get(a.value))})};var g,h=NaN;a.$watch(function(){h!==e.$viewValue||oa(g,e.$viewValue)||(g=\nna(e.$viewValue),e.$render());h=e.$viewValue});e.$isEmpty=function(a){return!a||0===a.length}}}},post:function(a,b,d,c){var e=c[1];if(e){var f=c[0];e.$render=function(){f.writeValue(e.$viewValue)}}}}}},te=[\"$interpolate\",function(a){return{restrict:\"E\",priority:100,compile:function(b,d){if(y(d.value))var c=a(d.value,!0);else{var e=a(b.text(),!0);e||d.$set(\"value\",b.text())}return function(a,b,d){var k=b.parent();(k=k.data(\"$selectController\")||k.parent().data(\"$selectController\"))&&k.registerOption(a,\nb,d,c,e)}}}}],se=ba({restrict:\"E\",terminal:!1}),Hc=function(){return{restrict:\"A\",require:\"?ngModel\",link:function(a,b,d,c){c&&(d.required=!0,c.$validators.required=function(a,b){return!d.required||!c.$isEmpty(b)},d.$observe(\"required\",function(){c.$validate()}))}}},Gc=function(){return{restrict:\"A\",require:\"?ngModel\",link:function(a,b,d,c){if(c){var e,f=d.ngPattern||d.pattern;d.$observe(\"pattern\",function(a){F(a)&&0<a.length&&(a=new RegExp(\"^\"+a+\"$\"));if(a&&!a.test)throw H(\"ngPattern\")(\"noregexp\",\nf,a,ta(b));e=a||v;c.$validate()});c.$validators.pattern=function(a,b){return c.$isEmpty(b)||x(e)||e.test(b)}}}}},Jc=function(){return{restrict:\"A\",require:\"?ngModel\",link:function(a,b,d,c){if(c){var e=-1;d.$observe(\"maxlength\",function(a){a=ca(a);e=isNaN(a)?-1:a;c.$validate()});c.$validators.maxlength=function(a,b){return 0>e||c.$isEmpty(b)||b.length<=e}}}}},Ic=function(){return{restrict:\"A\",require:\"?ngModel\",link:function(a,b,d,c){if(c){var e=0;d.$observe(\"minlength\",function(a){e=ca(a)||0;c.$validate()});\nc.$validators.minlength=function(a,b){return c.$isEmpty(b)||b.length>=e}}}}};O.angular.bootstrap?console.log(\"WARNING: Tried to load angular more than once.\"):(je(),le(ia),ia.module(\"ngLocale\",[],[\"$provide\",function(a){function b(a){a+=\"\";var b=a.indexOf(\".\");return-1==b?0:a.length-b-1}a.value(\"$locale\",{DATETIME_FORMATS:{AMPMS:[\"AM\",\"PM\"],DAY:\"Sunday Monday Tuesday Wednesday Thursday Friday Saturday\".split(\" \"),ERANAMES:[\"Before Christ\",\"Anno Domini\"],ERAS:[\"BC\",\"AD\"],FIRSTDAYOFWEEK:6,MONTH:\"January February March April May June July August September October November December\".split(\" \"),\nSHORTDAY:\"Sun Mon Tue Wed Thu Fri Sat\".split(\" \"),SHORTMONTH:\"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec\".split(\" \"),STANDALONEMONTH:\"January February March April May June July August September October November December\".split(\" \"),WEEKENDRANGE:[5,6],fullDate:\"EEEE, MMMM d, y\",longDate:\"MMMM d, y\",medium:\"MMM d, y h:mm:ss a\",mediumDate:\"MMM d, y\",mediumTime:\"h:mm:ss a\",\"short\":\"M/d/yy h:mm a\",shortDate:\"M/d/yy\",shortTime:\"h:mm a\"},NUMBER_FORMATS:{CURRENCY_SYM:\"$\",DECIMAL_SEP:\".\",GROUP_SEP:\",\",\nPATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:\"-\",negSuf:\"\",posPre:\"\",posSuf:\"\"},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:\"-\\u00a4\",negSuf:\"\",posPre:\"\\u00a4\",posSuf:\"\"}]},id:\"en-us\",localeID:\"en_US\",pluralCat:function(a,c){var e=a|0,f=c;v===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?\"one\":\"other\"}})}]),C(W).ready(function(){fe(W,Ac)}))})(window,document);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend('<style type=\"text/css\">@charset \"UTF-8\";[ng\\\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');\n//# sourceMappingURL=angular.min.js.map\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/main/resources/frameworks/knockout.dependency",
    "content": "/*!\n * Knockout JavaScript library v3.4.0\n * (c) Steven Sanderson - http://knockoutjs.com/\n * License: MIT (http://www.opensource.org/licenses/mit-license.php)\n */\n\n(function() {(function(n){var x=this||(0,eval)(\"this\"),u=x.document,M=x.navigator,v=x.jQuery,F=x.JSON;(function(n){\"function\"===typeof define&&define.amd?define([\"exports\",\"require\"],n):\"object\"===typeof exports&&\"object\"===typeof module?n(module.exports||exports):n(x.ko={})})(function(N,O){function J(a,c){return null===a||typeof a in T?a===c:!1}function U(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b()},c))}}function V(b,c){var d;return function(){clearTimeout(d);d=a.a.setTimeout(b,c)}}function W(a,\nc){c&&c!==I?\"beforeChange\"===c?this.Kb(a):this.Ha(a,c):this.Lb(a)}function X(a,c){null!==c&&c.k&&c.k()}function Y(a,c){var d=this.Hc,e=d[s];e.R||(this.lb&&this.Ma[c]?(d.Pb(c,a,this.Ma[c]),this.Ma[c]=null,--this.lb):e.r[c]||d.Pb(c,a,e.s?{ia:a}:d.uc(a)))}function K(b,c,d,e){a.d[b]={init:function(b,g,k,l,m){var h,r;a.m(function(){var q=a.a.c(g()),p=!d!==!q,A=!r;if(A||c||p!==h)A&&a.va.Aa()&&(r=a.a.ua(a.f.childNodes(b),!0)),p?(A||a.f.da(b,a.a.ua(r)),a.eb(e?e(m,q):m,b)):a.f.xa(b),h=p},null,{i:b});return{controlsDescendantBindings:!0}}};\na.h.ta[b]=!1;a.f.Z[b]=!0}var a=\"undefined\"!==typeof N?N:{};a.b=function(b,c){for(var d=b.split(\".\"),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.G=function(a,c,d){a[c]=d};a.version=\"3.4.0\";a.b(\"version\",a.version);a.options={deferUpdates:!1,useOnlyNativeEvents:!1};a.a=function(){function b(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function c(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a,b){a.__proto__=b;return a}function e(b,c,d,e){var h=b[c].match(r)||\n[];a.a.q(d.match(r),function(b){a.a.pa(h,b,e)});b[c]=h.join(\" \")}var f={__proto__:[]}instanceof Array,g=\"function\"===typeof Symbol,k={},l={};k[M&&/Firefox\\/2/i.test(M.userAgent)?\"KeyboardEvent\":\"UIEvents\"]=[\"keyup\",\"keydown\",\"keypress\"];k.MouseEvents=\"click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\".split(\" \");b(k,function(a,b){if(b.length)for(var c=0,d=b.length;c<d;c++)l[b[c]]=a});var m={propertychange:!0},h=u&&function(){for(var a=3,b=u.createElement(\"div\"),c=\nb.getElementsByTagName(\"i\");b.innerHTML=\"\\x3c!--[if gt IE \"+ ++a+\"]><i></i><![endif]--\\x3e\",c[0];);return 4<a?a:n}(),r=/\\S+/g;return{cc:[\"authenticity_token\",/^__RequestVerificationToken(_.*)?$/],q:function(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c],c)},o:function(a,b){if(\"function\"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},Sb:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d))return a[d];\nreturn null},La:function(b,c){var d=a.a.o(b,c);0<d?b.splice(d,1):0===d&&b.shift()},Tb:function(b){b=b||[];for(var c=[],d=0,e=b.length;d<e;d++)0>a.a.o(c,b[d])&&c.push(b[d]);return c},fb:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)c.push(b(a[d],d));return c},Ka:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)b(a[d],d)&&c.push(a[d]);return c},ra:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<d;c++)a.push(b[c]);return a},pa:function(b,c,d){var e=\na.a.o(a.a.zb(b),c);0>e?d&&b.push(c):d||b.splice(e,1)},ka:f,extend:c,Xa:d,Ya:f?d:c,D:b,Ca:function(a,b){if(!a)return a;var c={},d;for(d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d],d,a));return c},ob:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},jc:function(b){b=a.a.V(b);for(var c=(b[0]&&b[0].ownerDocument||u).createElement(\"div\"),d=0,e=b.length;d<e;d++)c.appendChild(a.$(b[d]));return c},ua:function(b,c){for(var d=0,e=b.length,h=[];d<e;d++){var m=b[d].cloneNode(!0);h.push(c?a.$(m):m)}return h},\nda:function(b,c){a.a.ob(b);if(c)for(var d=0,e=c.length;d<e;d++)b.appendChild(c[d])},qc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){for(var e=d[0],h=e.parentNode,m=0,l=c.length;m<l;m++)h.insertBefore(c[m],e);m=0;for(l=d.length;m<l;m++)a.removeNode(d[m])}},za:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),\nc=c.nextSibling;a.push(d)}}return a},sc:function(a,b){7>h?a.setAttribute(\"selected\",b):a.selected=b},$a:function(a){return null===a||a===n?\"\":a.trim?a.trim():a.toString().replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\")},nd:function(a,b){a=a||\"\";return b.length>a.length?!1:a.substring(0,b.length)===b},Mc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=\nb;)a=a.parentNode;return!!a},nb:function(b){return a.a.Mc(b,b.ownerDocument.documentElement)},Qb:function(b){return!!a.a.Sb(b,a.a.nb)},A:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},Wb:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Wb(b),c)},$b:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},p:function(b,c,d){var e=a.a.Wb(d);d=h&&m[c];if(a.options.useOnlyNativeEvents||\nd||!v)if(d||\"function\"!=typeof b.addEventListener)if(\"undefined\"!=typeof b.attachEvent){var l=function(a){e.call(b,a)},f=\"on\"+c;b.attachEvent(f,l);a.a.F.oa(b,function(){b.detachEvent(f,l)})}else throw Error(\"Browser doesn't support addEventListener or attachEvent\");else b.addEventListener(c,e,!1);else v(b).bind(c,e)},Da:function(b,c){if(!b||!b.nodeType)throw Error(\"element must be a DOM node when calling triggerEvent\");var d;\"input\"===a.a.A(b)&&b.type&&\"click\"==c.toLowerCase()?(d=b.type,d=\"checkbox\"==\nd||\"radio\"==d):d=!1;if(a.options.useOnlyNativeEvents||!v||d)if(\"function\"==typeof u.createEvent)if(\"function\"==typeof b.dispatchEvent)d=u.createEvent(l[c]||\"HTMLEvents\"),d.initEvent(c,!0,!0,x,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error(\"The supplied element doesn't support dispatchEvent\");else if(d&&b.click)b.click();else if(\"undefined\"!=typeof b.fireEvent)b.fireEvent(\"on\"+c);else throw Error(\"Browser doesn't support triggering events\");else v(b).trigger(c)},c:function(b){return a.H(b)?\nb():b},zb:function(b){return a.H(b)?b.t():b},bb:function(b,c,d){var h;c&&(\"object\"===typeof b.classList?(h=b.classList[d?\"add\":\"remove\"],a.a.q(c.match(r),function(a){h.call(b.classList,a)})):\"string\"===typeof b.className.baseVal?e(b.className,\"baseVal\",c,d):e(b,\"className\",c,d))},Za:function(b,c){var d=a.a.c(c);if(null===d||d===n)d=\"\";var e=a.f.firstChild(b);!e||3!=e.nodeType||a.f.nextSibling(e)?a.f.da(b,[b.ownerDocument.createTextNode(d)]):e.data=d;a.a.Rc(b)},rc:function(a,b){a.name=b;if(7>=h)try{a.mergeAttributes(u.createElement(\"<input name='\"+\na.name+\"'/>\"),!1)}catch(c){}},Rc:function(a){9<=h&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},Nc:function(a){if(h){var b=a.style.width;a.style.width=0;a.style.width=b}},hd:function(b,c){b=a.a.c(b);c=a.a.c(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},V:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b},Yb:function(a){return g?Symbol(a):a},rd:6===h,sd:7===h,C:h,ec:function(b,c){for(var d=a.a.V(b.getElementsByTagName(\"input\")).concat(a.a.V(b.getElementsByTagName(\"textarea\"))),\ne=\"string\"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},h=[],m=d.length-1;0<=m;m--)e(d[m])&&h.push(d[m]);return h},ed:function(b){return\"string\"==typeof b&&(b=a.a.$a(b))?F&&F.parse?F.parse(b):(new Function(\"return \"+b))():null},Eb:function(b,c,d){if(!F||!F.stringify)throw Error(\"Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js\");\nreturn F.stringify(a.a.c(b),c,d)},fd:function(c,d,e){e=e||{};var h=e.params||{},m=e.includeFields||this.cc,l=c;if(\"object\"==typeof c&&\"form\"===a.a.A(c))for(var l=c.action,f=m.length-1;0<=f;f--)for(var g=a.a.ec(c,m[f]),k=g.length-1;0<=k;k--)h[g[k].name]=g[k].value;d=a.a.c(d);var r=u.createElement(\"form\");r.style.display=\"none\";r.action=l;r.method=\"post\";for(var n in d)c=u.createElement(\"input\"),c.type=\"hidden\",c.name=n,c.value=a.a.Eb(a.a.c(d[n])),r.appendChild(c);b(h,function(a,b){var c=u.createElement(\"input\");\nc.type=\"hidden\";c.name=a;c.value=b;r.appendChild(c)});u.body.appendChild(r);e.submitter?e.submitter(r):r.submit();setTimeout(function(){r.parentNode.removeChild(r)},0)}}}();a.b(\"utils\",a.a);a.b(\"utils.arrayForEach\",a.a.q);a.b(\"utils.arrayFirst\",a.a.Sb);a.b(\"utils.arrayFilter\",a.a.Ka);a.b(\"utils.arrayGetDistinctValues\",a.a.Tb);a.b(\"utils.arrayIndexOf\",a.a.o);a.b(\"utils.arrayMap\",a.a.fb);a.b(\"utils.arrayPushAll\",a.a.ra);a.b(\"utils.arrayRemoveItem\",a.a.La);a.b(\"utils.extend\",a.a.extend);a.b(\"utils.fieldsIncludedWithJsonPost\",\na.a.cc);a.b(\"utils.getFormFields\",a.a.ec);a.b(\"utils.peekObservable\",a.a.zb);a.b(\"utils.postJson\",a.a.fd);a.b(\"utils.parseJson\",a.a.ed);a.b(\"utils.registerEventHandler\",a.a.p);a.b(\"utils.stringifyJson\",a.a.Eb);a.b(\"utils.range\",a.a.hd);a.b(\"utils.toggleDomNodeCssClass\",a.a.bb);a.b(\"utils.triggerEvent\",a.a.Da);a.b(\"utils.unwrapObservable\",a.a.c);a.b(\"utils.objectForEach\",a.a.D);a.b(\"utils.addOrRemoveItem\",a.a.pa);a.b(\"utils.setTextContent\",a.a.Za);a.b(\"unwrap\",a.a.c);Function.prototype.bind||(Function.prototype.bind=\nfunction(a){var c=this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.e=new function(){function a(b,g){var k=b[d];if(!k||\"null\"===k||!e[k]){if(!g)return n;k=b[d]=\"ko\"+c++;e[k]={}}return e[k]}var c=0,d=\"__ko__\"+(new Date).getTime(),e={};return{get:function(c,d){var e=a(c,!1);return e===n?n:e[d]},set:function(c,d,e){if(e!==n||a(c,!1)!==n)a(c,!0)[d]=\ne},clear:function(a){var b=a[d];return b?(delete e[b],a[d]=null,!0):!1},I:function(){return c++ +d}}};a.b(\"utils.domData\",a.a.e);a.b(\"utils.domData.clear\",a.a.e.clear);a.a.F=new function(){function b(b,c){var e=a.a.e.get(b,d);e===n&&c&&(e=[],a.a.e.set(b,d,e));return e}function c(d){var e=b(d,!1);if(e)for(var e=e.slice(0),l=0;l<e.length;l++)e[l](d);a.a.e.clear(d);a.a.F.cleanExternalData(d);if(f[d.nodeType])for(e=d.firstChild;d=e;)e=d.nextSibling,8===d.nodeType&&c(d)}var d=a.a.e.I(),e={1:!0,8:!0,9:!0},\nf={1:!0,9:!0};return{oa:function(a,c){if(\"function\"!=typeof c)throw Error(\"Callback must be a function\");b(a,!0).push(c)},pc:function(c,e){var l=b(c,!1);l&&(a.a.La(l,e),0==l.length&&a.a.e.set(c,d,n))},$:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.ra(d,b.getElementsByTagName(\"*\"));for(var l=0,m=d.length;l<m;l++)c(d[l])}return b},removeNode:function(b){a.$(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){v&&\"function\"==typeof v.cleanData&&v.cleanData([a])}}};\na.$=a.a.F.$;a.removeNode=a.a.F.removeNode;a.b(\"cleanNode\",a.$);a.b(\"removeNode\",a.removeNode);a.b(\"utils.domNodeDisposal\",a.a.F);a.b(\"utils.domNodeDisposal.addDisposeCallback\",a.a.F.oa);a.b(\"utils.domNodeDisposal.removeDisposeCallback\",a.a.F.pc);(function(){var b=[0,\"\",\"\"],c=[1,\"<table>\",\"</table>\"],d=[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],e=[1,\"<select multiple='multiple'>\",\"</select>\"],f={thead:c,tbody:c,tfoot:c,tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:d,th:d,option:e,optgroup:e},\ng=8>=a.a.C;a.a.ma=function(c,d){var e;if(v)if(v.parseHTML)e=v.parseHTML(c,d)||[];else{if((e=v.clean([c],d))&&e[0]){for(var h=e[0];h.parentNode&&11!==h.parentNode.nodeType;)h=h.parentNode;h.parentNode&&h.parentNode.removeChild(h)}}else{(e=d)||(e=u);var h=e.parentWindow||e.defaultView||x,r=a.a.$a(c).toLowerCase(),q=e.createElement(\"div\"),p;p=(r=r.match(/^<([a-z]+)[ >]/))&&f[r[1]]||b;r=p[0];p=\"ignored<div>\"+p[1]+c+p[2]+\"</div>\";\"function\"==typeof h.innerShiv?q.appendChild(h.innerShiv(p)):(g&&e.appendChild(q),\nq.innerHTML=p,g&&q.parentNode.removeChild(q));for(;r--;)q=q.lastChild;e=a.a.V(q.lastChild.childNodes)}return e};a.a.Cb=function(b,c){a.a.ob(b);c=a.a.c(c);if(null!==c&&c!==n)if(\"string\"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ma(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b(\"utils.parseHtmlFragment\",a.a.ma);a.b(\"utils.setHtml\",a.a.Cb);a.M=function(){function b(c,e){if(c)if(8==c.nodeType){var f=a.M.lc(c.nodeValue);null!=f&&e.push({Lc:c,cd:f})}else if(1==c.nodeType)for(var f=\n0,g=c.childNodes,k=g.length;f<k;f++)b(g[f],e)}var c={};return{wb:function(a){if(\"function\"!=typeof a)throw Error(\"You can only pass a function to ko.memoization.memoize()\");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return\"\\x3c!--[ko_memo:\"+b+\"]--\\x3e\"},xc:function(a,b){var f=c[a];if(f===n)throw Error(\"Couldn't find any memo with ID \"+a+\". Perhaps it's already been unmemoized.\");try{return f.apply(null,b||[]),\n!0}finally{delete c[a]}},yc:function(c,e){var f=[];b(c,f);for(var g=0,k=f.length;g<k;g++){var l=f[g].Lc,m=[l];e&&a.a.ra(m,e);a.M.xc(f[g].cd,m);l.nodeValue=\"\";l.parentNode&&l.parentNode.removeChild(l)}},lc:function(a){return(a=a.match(/^\\[ko_memo\\:(.*?)\\]$/))?a[1]:null}}}();a.b(\"memoization\",a.M);a.b(\"memoization.memoize\",a.M.wb);a.b(\"memoization.unmemoize\",a.M.xc);a.b(\"memoization.parseMemoText\",a.M.lc);a.b(\"memoization.unmemoizeDomNodeAndDescendants\",a.M.yc);a.Y=function(){function b(){if(e)for(var b=\ne,c=0,m;g<e;)if(m=d[g++]){if(g>b){if(5E3<=++c){g=e;a.a.$b(Error(\"'Too much recursion' after processing \"+c+\" task groups.\"));break}b=e}try{m()}catch(h){a.a.$b(h)}}}function c(){b();g=e=d.length=0}var d=[],e=0,f=1,g=0;return{scheduler:x.MutationObserver?function(a){var b=u.createElement(\"div\");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle(\"foo\")}}(c):u&&\"onreadystatechange\"in u.createElement(\"script\")?function(a){var b=u.createElement(\"script\");b.onreadystatechange=\nfunction(){b.onreadystatechange=null;u.documentElement.removeChild(b);b=null;a()};u.documentElement.appendChild(b)}:function(a){setTimeout(a,0)},Wa:function(b){e||a.Y.scheduler(c);d[e++]=b;return f++},cancel:function(a){a-=f-e;a>=g&&a<e&&(d[a]=null)},resetForTesting:function(){var a=e-g;g=e=d.length=0;return a},md:b}}();a.b(\"tasks\",a.Y);a.b(\"tasks.schedule\",a.Y.Wa);a.b(\"tasks.runEarly\",a.Y.md);a.ya={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.B({read:b,write:function(e){clearTimeout(d);\nd=a.a.setTimeout(function(){b(e)},c)}})},rateLimit:function(a,c){var d,e,f;\"number\"==typeof c?d=c:(d=c.timeout,e=c.method);a.cb=!1;f=\"notifyWhenChangesStop\"==e?V:U;a.Ta(function(a){return f(a,d)})},deferred:function(b,c){if(!0!==c)throw Error(\"The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.\");b.cb||(b.cb=!0,b.Ta(function(c){var e;return function(){a.Y.cancel(e);e=a.Y.Wa(c);b.notifySubscribers(n,\"dirty\")}}))},notify:function(a,c){a.equalityComparer=\n\"always\"==c?null:J}};var T={undefined:1,\"boolean\":1,number:1,string:1};a.b(\"extenders\",a.ya);a.vc=function(b,c,d){this.ia=b;this.gb=c;this.Kc=d;this.R=!1;a.G(this,\"dispose\",this.k)};a.vc.prototype.k=function(){this.R=!0;this.Kc()};a.J=function(){a.a.Ya(this,D);D.rb(this)};var I=\"change\",D={rb:function(a){a.K={};a.Nb=1},X:function(b,c,d){var e=this;d=d||I;var f=new a.vc(e,c?b.bind(c):b,function(){a.a.La(e.K[d],f);e.Ia&&e.Ia(d)});e.sa&&e.sa(d);e.K[d]||(e.K[d]=[]);e.K[d].push(f);return f},notifySubscribers:function(b,\nc){c=c||I;c===I&&this.zc();if(this.Pa(c))try{a.l.Ub();for(var d=this.K[c].slice(0),e=0,f;f=d[e];++e)f.R||f.gb(b)}finally{a.l.end()}},Na:function(){return this.Nb},Uc:function(a){return this.Na()!==a},zc:function(){++this.Nb},Ta:function(b){var c=this,d=a.H(c),e,f,g;c.Ha||(c.Ha=c.notifySubscribers,c.notifySubscribers=W);var k=b(function(){c.Mb=!1;d&&g===c&&(g=c());e=!1;c.tb(f,g)&&c.Ha(f=g)});c.Lb=function(a){c.Mb=e=!0;g=a;k()};c.Kb=function(a){e||(f=a,c.Ha(a,\"beforeChange\"))}},Pa:function(a){return this.K[a]&&\nthis.K[a].length},Sc:function(b){if(b)return this.K[b]&&this.K[b].length||0;var c=0;a.a.D(this.K,function(a,b){\"dirty\"!==a&&(c+=b.length)});return c},tb:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},extend:function(b){var c=this;b&&a.a.D(b,function(b,e){var f=a.ya[b];\"function\"==typeof f&&(c=f(c,e)||c)});return c}};a.G(D,\"subscribe\",D.X);a.G(D,\"extend\",D.extend);a.G(D,\"getSubscriptionsCount\",D.Sc);a.a.ka&&a.a.Xa(D,Function.prototype);a.J.fn=D;a.hc=function(a){return null!=\na&&\"function\"==typeof a.X&&\"function\"==typeof a.notifySubscribers};a.b(\"subscribable\",a.J);a.b(\"isSubscribable\",a.hc);a.va=a.l=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{Ub:b,end:c,oc:function(b){if(e){if(!a.hc(b))throw Error(\"Only subscribable things can act as dependencies\");e.gb.call(e.Gc,b,b.Cc||(b.Cc=++f))}},w:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},Aa:function(){if(e)return e.m.Aa()},Sa:function(){if(e)return e.Sa}}}();a.b(\"computedContext\",\na.va);a.b(\"computedContext.getDependenciesCount\",a.va.Aa);a.b(\"computedContext.isInitial\",a.va.Sa);a.b(\"ignoreDependencies\",a.qd=a.l.w);var E=a.a.Yb(\"_latestValue\");a.N=function(b){function c(){if(0<arguments.length)return c.tb(c[E],arguments[0])&&(c.ga(),c[E]=arguments[0],c.fa()),this;a.l.oc(c);return c[E]}c[E]=b;a.a.ka||a.a.extend(c,a.J.fn);a.J.fn.rb(c);a.a.Ya(c,B);a.options.deferUpdates&&a.ya.deferred(c,!0);return c};var B={equalityComparer:J,t:function(){return this[E]},fa:function(){this.notifySubscribers(this[E])},\nga:function(){this.notifySubscribers(this[E],\"beforeChange\")}};a.a.ka&&a.a.Xa(B,a.J.fn);var H=a.N.gd=\"__ko_proto__\";B[H]=a.N;a.Oa=function(b,c){return null===b||b===n||b[H]===n?!1:b[H]===c?!0:a.Oa(b[H],c)};a.H=function(b){return a.Oa(b,a.N)};a.Ba=function(b){return\"function\"==typeof b&&b[H]===a.N||\"function\"==typeof b&&b[H]===a.B&&b.Vc?!0:!1};a.b(\"observable\",a.N);a.b(\"isObservable\",a.H);a.b(\"isWriteableObservable\",a.Ba);a.b(\"isWritableObservable\",a.Ba);a.b(\"observable.fn\",B);a.G(B,\"peek\",B.t);a.G(B,\n\"valueHasMutated\",B.fa);a.G(B,\"valueWillMutate\",B.ga);a.la=function(b){b=b||[];if(\"object\"!=typeof b||!(\"length\"in b))throw Error(\"The argument passed when initializing an observable array must be an array, or null, or undefined.\");b=a.N(b);a.a.Ya(b,a.la.fn);return b.extend({trackArrayChanges:!0})};a.la.fn={remove:function(b){for(var c=this.t(),d=[],e=\"function\"!=typeof b||a.H(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];e(g)&&(0===d.length&&this.ga(),d.push(g),c.splice(f,1),f--)}d.length&&\nthis.fa();return d},removeAll:function(b){if(b===n){var c=this.t(),d=c.slice(0);this.ga();c.splice(0,c.length);this.fa();return d}return b?this.remove(function(c){return 0<=a.a.o(b,c)}):[]},destroy:function(b){var c=this.t(),d=\"function\"!=typeof b||a.H(b)?function(a){return a===b}:b;this.ga();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=!0);this.fa()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.o(b,c)}):[]},indexOf:function(b){var c=\nthis();return a.a.o(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.ga(),this.t()[d]=c,this.fa())}};a.a.ka&&a.a.Xa(a.la.fn,a.N.fn);a.a.q(\"pop push reverse shift sort splice unshift\".split(\" \"),function(b){a.la.fn[b]=function(){var a=this.t();this.ga();this.Vb(a,b,arguments);var d=a[b].apply(a,arguments);this.fa();return d===a?this:d}});a.a.q([\"slice\"],function(b){a.la.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b(\"observableArray\",a.la);a.ya.trackArrayChanges=function(b,\nc){function d(){if(!e){e=!0;var c=b.notifySubscribers;b.notifySubscribers=function(a,b){b&&b!==I||++k;return c.apply(this,arguments)};var d=[].concat(b.t()||[]);f=null;g=b.X(function(c){c=[].concat(c||[]);if(b.Pa(\"arrayChange\")){var e;if(!f||1<k)f=a.a.ib(d,c,b.hb);e=f}d=c;f=null;k=0;e&&e.length&&b.notifySubscribers(e,\"arrayChange\")})}}b.hb={};c&&\"object\"==typeof c&&a.a.extend(b.hb,c);b.hb.sparse=!0;if(!b.Vb){var e=!1,f=null,g,k=0,l=b.sa,m=b.Ia;b.sa=function(a){l&&l.call(b,a);\"arrayChange\"===a&&d()};\nb.Ia=function(a){m&&m.call(b,a);\"arrayChange\"!==a||b.Pa(\"arrayChange\")||(g.k(),e=!1)};b.Vb=function(b,c,d){function m(a,b,c){return l[l.length]={status:a,value:b,index:c}}if(e&&!k){var l=[],g=b.length,t=d.length,G=0;switch(c){case \"push\":G=g;case \"unshift\":for(c=0;c<t;c++)m(\"added\",d[c],G+c);break;case \"pop\":G=g-1;case \"shift\":g&&m(\"deleted\",b[G],G);break;case \"splice\":c=Math.min(Math.max(0,0>d[0]?g+d[0]:d[0]),g);for(var g=1===t?g:Math.min(c+(d[1]||0),g),t=c+t-2,G=Math.max(g,t),P=[],n=[],Q=2;c<G;++c,\n++Q)c<g&&n.push(m(\"deleted\",b[c],c)),c<t&&P.push(m(\"added\",d[Q],c));a.a.dc(n,P);break;default:return}f=l}}}};var s=a.a.Yb(\"_state\");a.m=a.B=function(b,c,d){function e(){if(0<arguments.length){if(\"function\"===typeof f)f.apply(g.pb,arguments);else throw Error(\"Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.\");return this}a.l.oc(e);(g.S||g.s&&e.Qa())&&e.aa();return g.T}\"object\"===typeof b?d=b:(d=d||{},b&&(d.read=\nb));if(\"function\"!=typeof d.read)throw Error(\"Pass a function that returns the value of the ko.computed\");var f=d.write,g={T:n,S:!0,Ra:!1,Fb:!1,R:!1,Va:!1,s:!1,jd:d.read,pb:c||d.owner,i:d.disposeWhenNodeIsRemoved||d.i||null,wa:d.disposeWhen||d.wa,mb:null,r:{},L:0,bc:null};e[s]=g;e.Vc=\"function\"===typeof f;a.a.ka||a.a.extend(e,a.J.fn);a.J.fn.rb(e);a.a.Ya(e,z);d.pure?(g.Va=!0,g.s=!0,a.a.extend(e,$)):d.deferEvaluation&&a.a.extend(e,aa);a.options.deferUpdates&&a.ya.deferred(e,!0);g.i&&(g.Fb=!0,g.i.nodeType||\n(g.i=null));g.s||d.deferEvaluation||e.aa();g.i&&e.ba()&&a.a.F.oa(g.i,g.mb=function(){e.k()});return e};var z={equalityComparer:J,Aa:function(){return this[s].L},Pb:function(a,c,d){if(this[s].Va&&c===this)throw Error(\"A 'pure' computed must not be called recursively\");this[s].r[a]=d;d.Ga=this[s].L++;d.na=c.Na()},Qa:function(){var a,c,d=this[s].r;for(a in d)if(d.hasOwnProperty(a)&&(c=d[a],c.ia.Uc(c.na)))return!0},bd:function(){this.Fa&&!this[s].Ra&&this.Fa()},ba:function(){return this[s].S||0<this[s].L},\nld:function(){this.Mb||this.ac()},uc:function(a){if(a.cb&&!this[s].i){var c=a.X(this.bd,this,\"dirty\"),d=a.X(this.ld,this);return{ia:a,k:function(){c.k();d.k()}}}return a.X(this.ac,this)},ac:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[s].bc),this[s].bc=a.a.setTimeout(function(){b.aa(!0)},c)):b.Fa?b.Fa():b.aa(!0)},aa:function(b){var c=this[s],d=c.wa;if(!c.Ra&&!c.R){if(c.i&&!a.a.nb(c.i)||d&&d()){if(!c.Fb){this.k();return}}else c.Fb=!1;c.Ra=!0;try{this.Qc(b)}finally{c.Ra=!1}c.L||\nthis.k()}},Qc:function(b){var c=this[s],d=c.Va?n:!c.L,e={Hc:this,Ma:c.r,lb:c.L};a.l.Ub({Gc:e,gb:Y,m:this,Sa:d});c.r={};c.L=0;e=this.Pc(c,e);this.tb(c.T,e)&&(c.s||this.notifySubscribers(c.T,\"beforeChange\"),c.T=e,c.s?this.zc():b&&this.notifySubscribers(c.T));d&&this.notifySubscribers(c.T,\"awake\")},Pc:function(b,c){try{var d=b.jd;return b.pb?d.call(b.pb):d()}finally{a.l.end(),c.lb&&!b.s&&a.a.D(c.Ma,X),b.S=!1}},t:function(){var a=this[s];(a.S&&!a.L||a.s&&this.Qa())&&this.aa();return a.T},Ta:function(b){a.J.fn.Ta.call(this,\nb);this.Fa=function(){this.Kb(this[s].T);this[s].S=!0;this.Lb(this)}},k:function(){var b=this[s];!b.s&&b.r&&a.a.D(b.r,function(a,b){b.k&&b.k()});b.i&&b.mb&&a.a.F.pc(b.i,b.mb);b.r=null;b.L=0;b.R=!0;b.S=!1;b.s=!1;b.i=null}},$={sa:function(b){var c=this,d=c[s];if(!d.R&&d.s&&\"change\"==b){d.s=!1;if(d.S||c.Qa())d.r=null,d.L=0,d.S=!0,c.aa();else{var e=[];a.a.D(d.r,function(a,b){e[b.Ga]=a});a.a.q(e,function(a,b){var e=d.r[a],l=c.uc(e.ia);l.Ga=b;l.na=e.na;d.r[a]=l})}d.R||c.notifySubscribers(d.T,\"awake\")}},\nIa:function(b){var c=this[s];c.R||\"change\"!=b||this.Pa(\"change\")||(a.a.D(c.r,function(a,b){b.k&&(c.r[a]={ia:b.ia,Ga:b.Ga,na:b.na},b.k())}),c.s=!0,this.notifySubscribers(n,\"asleep\"))},Na:function(){var b=this[s];b.s&&(b.S||this.Qa())&&this.aa();return a.J.fn.Na.call(this)}},aa={sa:function(a){\"change\"!=a&&\"beforeChange\"!=a||this.t()}};a.a.ka&&a.a.Xa(z,a.J.fn);var R=a.N.gd;a.m[R]=a.N;z[R]=a.m;a.Xc=function(b){return a.Oa(b,a.m)};a.Yc=function(b){return a.Oa(b,a.m)&&b[s]&&b[s].Va};a.b(\"computed\",a.m);\na.b(\"dependentObservable\",a.m);a.b(\"isComputed\",a.Xc);a.b(\"isPureComputed\",a.Yc);a.b(\"computed.fn\",z);a.G(z,\"peek\",z.t);a.G(z,\"dispose\",z.k);a.G(z,\"isActive\",z.ba);a.G(z,\"getDependenciesCount\",z.Aa);a.nc=function(b,c){if(\"function\"===typeof b)return a.m(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.m(b,c)};a.b(\"pureComputed\",a.nc);(function(){function b(a,f,g){g=g||new d;a=f(a);if(\"object\"!=typeof a||null===a||a===n||a instanceof RegExp||a instanceof Date||a instanceof String||a instanceof\nNumber||a instanceof Boolean)return a;var k=a instanceof Array?[]:{};g.save(a,k);c(a,function(c){var d=f(a[c]);switch(typeof d){case \"boolean\":case \"number\":case \"string\":case \"function\":k[c]=d;break;case \"object\":case \"undefined\":var h=g.get(d);k[c]=h!==n?h:b(d,f,g)}});return k}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);\"function\"==typeof a.toJSON&&b(\"toJSON\")}else for(c in a)b(c)}function d(){this.keys=[];this.Ib=[]}a.wc=function(c){if(0==arguments.length)throw Error(\"When calling ko.toJS, pass the object you want to convert.\");\nreturn b(c,function(b){for(var c=0;a.H(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.wc(b);return a.a.Eb(b,c,d)};d.prototype={save:function(b,c){var d=a.a.o(this.keys,b);0<=d?this.Ib[d]=c:(this.keys.push(b),this.Ib.push(c))},get:function(b){b=a.a.o(this.keys,b);return 0<=b?this.Ib[b]:n}}})();a.b(\"toJS\",a.wc);a.b(\"toJSON\",a.toJSON);(function(){a.j={u:function(b){switch(a.a.A(b)){case \"option\":return!0===b.__ko__hasDomDataOptionValue__?a.a.e.get(b,a.d.options.xb):7>=a.a.C?b.getAttributeNode(\"value\")&&\nb.getAttributeNode(\"value\").specified?b.value:b.text:b.value;case \"select\":return 0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex]):n;default:return b.value}},ha:function(b,c,d){switch(a.a.A(b)){case \"option\":switch(typeof c){case \"string\":a.a.e.set(b,a.d.options.xb,n);\"__ko__hasDomDataOptionValue__\"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,a.d.options.xb,c),b.__ko__hasDomDataOptionValue__=!0,b.value=\"number\"===typeof c?c:\"\"}break;case \"select\":if(\"\"===c||\nnull===c)c=n;for(var e=-1,f=0,g=b.options.length,k;f<g;++f)if(k=a.j.u(b.options[f]),k==c||\"\"==k&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e;break;default:if(null===c||c===n)c=\"\";b.value=c}}}})();a.b(\"selectExtensions\",a.j);a.b(\"selectExtensions.readValue\",a.j.u);a.b(\"selectExtensions.writeValue\",a.j.ha);a.h=function(){function b(b){b=a.a.$a(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var c=[],d=b.match(e),r,k=[],p=0;if(d){d.push(\",\");for(var A=0,y;y=d[A];++A){var t=y.charCodeAt(0);\nif(44===t){if(0>=p){c.push(r&&k.length?{key:r,value:k.join(\"\")}:{unknown:r||k.join(\"\")});r=p=0;k=[];continue}}else if(58===t){if(!p&&!r&&1===k.length){r=k.pop();continue}}else 47===t&&A&&1<y.length?(t=d[A-1].match(f))&&!g[t[0]]&&(b=b.substr(b.indexOf(y)+1),d=b.match(e),d.push(\",\"),A=-1,y=\"/\"):40===t||123===t||91===t?++p:41===t||125===t||93===t?--p:r||k.length||34!==t&&39!==t||(y=y.slice(1,-1));k.push(y)}}return c}var c=[\"true\",\"false\",\"null\",\"undefined\"],d=/^(?:[$_a-z][$\\w]*|(.+)(\\.\\s*[$_a-z][$\\w]*|\\[.+\\]))$/i,\ne=RegExp(\"\\\"(?:[^\\\"\\\\\\\\]|\\\\\\\\.)*\\\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*'|/(?:[^/\\\\\\\\]|\\\\\\\\.)*/w*|[^\\\\s:,/][^,\\\"'{}()/:[\\\\]]*[^\\\\s,\\\"'{}()/:[\\\\]]|[^\\\\s]\",\"g\"),f=/[\\])\"'A-Za-z0-9_$]+$/,g={\"in\":1,\"return\":1,\"typeof\":1},k={};return{ta:[],ea:k,yb:b,Ua:function(e,m){function h(b,e){var m;if(!A){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(e=l.preprocess(e,b,h)))return;if(l=k[b])m=e,0<=a.a.o(c,m)?m=!1:(l=m.match(d),m=null===l?!1:l[1]?\"Object(\"+l[1]+\")\"+l[2]:m),l=m;l&&g.push(\"'\"+b+\"':function(_z){\"+m+\"=_z}\")}p&&(e=\n\"function(){return \"+e+\" }\");f.push(\"'\"+b+\"':\"+e)}m=m||{};var f=[],g=[],p=m.valueAccessors,A=m.bindingParams,y=\"string\"===typeof e?b(e):e;a.a.q(y,function(a){h(a.key||a.unknown,a.value)});g.length&&h(\"_ko_property_writers\",\"{\"+g.join(\",\")+\" }\");return f.join(\",\")},ad:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},Ea:function(b,c,d,e,f){if(b&&a.H(b))!a.Ba(b)||f&&b.t()===e||b(e);else if((b=c.get(\"_ko_property_writers\"))&&b[d])b[d](e)}}}();a.b(\"expressionRewriting\",a.h);a.b(\"expressionRewriting.bindingRewriteValidators\",\na.h.ta);a.b(\"expressionRewriting.parseObjectLiteral\",a.h.yb);a.b(\"expressionRewriting.preProcessBindings\",a.h.Ua);a.b(\"expressionRewriting._twoWayBindings\",a.h.ea);a.b(\"jsonExpressionRewriting\",a.h);a.b(\"jsonExpressionRewriting.insertPropertyAccessorsIntoJson\",a.h.Ua);(function(){function b(a){return 8==a.nodeType&&g.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&k.test(f?a.text:a.nodeValue)}function d(a,d){for(var e=a,f=1,l=[];e=e.nextSibling;){if(c(e)&&(f--,0===f))return l;l.push(e);\nb(e)&&f++}if(!d)throw Error(\"Cannot find closing comment tag to match: \"+a.nodeValue);return null}function e(a,b){var c=d(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}var f=u&&\"\\x3c!--test--\\x3e\"===u.createComment(\"test\").text,g=f?/^\\x3c!--\\s*ko(?:\\s+([\\s\\S]+))?\\s*--\\x3e$/:/^\\s*ko(?:\\s+([\\s\\S]+))?\\s*$/,k=f?/^\\x3c!--\\s*\\/ko\\s*--\\x3e$/:/^\\s*\\/ko\\s*$/,l={ul:!0,ol:!0};a.f={Z:{},childNodes:function(a){return b(a)?d(a):a.childNodes},xa:function(c){if(b(c)){c=a.f.childNodes(c);for(var d=\n0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.ob(c)},da:function(c,d){if(b(c)){a.f.xa(c);for(var e=c.nextSibling,f=0,l=d.length;f<l;f++)e.parentNode.insertBefore(d[f],e)}else a.a.da(c,d)},mc:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},gc:function(c,d,e){e?b(c)?c.parentNode.insertBefore(d,e.nextSibling):e.nextSibling?c.insertBefore(d,e.nextSibling):c.appendChild(d):a.f.mc(c,d)},firstChild:function(a){return b(a)?!a.nextSibling||\nc(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},Tc:b,pd:function(a){return(a=(f?a.text:a.nodeValue).match(g))?a[1]:null},kc:function(d){if(l[a.a.A(d)]){var h=d.firstChild;if(h){do if(1===h.nodeType){var f;f=h.firstChild;var g=null;if(f){do if(g)g.push(f);else if(b(f)){var k=e(f,!0);k?f=k:g=[f]}else c(f)&&(g=[f]);while(f=f.nextSibling)}if(f=g)for(g=h.nextSibling,k=0;k<f.length;k++)g?d.insertBefore(f[k],\ng):d.appendChild(f[k])}while(h=h.nextSibling)}}}}})();a.b(\"virtualElements\",a.f);a.b(\"virtualElements.allowedBindings\",a.f.Z);a.b(\"virtualElements.emptyNode\",a.f.xa);a.b(\"virtualElements.insertAfter\",a.f.gc);a.b(\"virtualElements.prepend\",a.f.mc);a.b(\"virtualElements.setDomNodeChildren\",a.f.da);(function(){a.Q=function(){this.Fc={}};a.a.extend(a.Q.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute(\"data-bind\")||a.g.getComponentNameForNode(b);case 8:return a.f.Tc(b);\ndefault:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.g.Ob(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.g.Ob(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute(\"data-bind\");case 8:return a.f.pd(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Fc,g=b+(e&&e.valueAccessors||\n\"\"),k;if(!(k=f[g])){var l,m=\"with($context){with($data||{}){return{\"+a.h.Ua(b,e)+\"}}}\";l=new Function(\"$context\",\"$element\",m);k=f[g]=l}return k(c,d)}catch(h){throw h.message=\"Unable to parse bindings.\\nBindings value: \"+b+\"\\nMessage: \"+h.message,h;}}});a.Q.instance=new a.Q})();a.b(\"bindingProvider\",a.Q);(function(){function b(a){return function(){return a}}function c(a){return a()}function d(b){return a.a.Ca(a.l.w(b),function(a,c){return function(){return b()[c]}})}function e(c,e,h){return\"function\"===\ntypeof c?d(c.bind(null,e,h)):a.a.Ca(c,b)}function f(a,b){return d(this.getBindings.bind(this,a,b))}function g(b,c,d){var e,h=a.f.firstChild(c),f=a.Q.instance,m=f.preprocessNode;if(m){for(;e=h;)h=a.f.nextSibling(e),m.call(f,e);h=a.f.firstChild(c)}for(;e=h;)h=a.f.nextSibling(e),k(b,e,d)}function k(b,c,d){var e=!0,h=1===c.nodeType;h&&a.f.kc(c);if(h&&d||a.Q.instance.nodeHasBindings(c))e=m(c,null,b,d).shouldBindDescendants;e&&!r[a.a.A(c)]&&g(b,c,!h)}function l(b){var c=[],d={},e=[];a.a.D(b,function Z(h){if(!d[h]){var f=\na.getBindingHandler(h);f&&(f.after&&(e.push(h),a.a.q(f.after,function(c){if(b[c]){if(-1!==a.a.o(e,c))throw Error(\"Cannot combine the following bindings, because they have a cyclic dependency: \"+e.join(\", \"));Z(c)}}),e.length--),c.push({key:h,fc:f}));d[h]=!0}});return c}function m(b,d,e,h){var m=a.a.e.get(b,q);if(!d){if(m)throw Error(\"You cannot apply bindings multiple times to the same element.\");a.a.e.set(b,q,!0)}!m&&h&&a.tc(b,e);var g;if(d&&\"function\"!==typeof d)g=d;else{var k=a.Q.instance,r=k.getBindingAccessors||\nf,p=a.B(function(){(g=d?d(e,b):r.call(k,b,e))&&e.P&&e.P();return g},null,{i:b});g&&p.ba()||(p=null)}var u;if(g){var v=p?function(a){return function(){return c(p()[a])}}:function(a){return g[a]},s=function(){return a.a.Ca(p?p():g,c)};s.get=function(a){return g[a]&&c(v(a))};s.has=function(a){return a in g};h=l(g);a.a.q(h,function(c){var d=c.fc.init,h=c.fc.update,f=c.key;if(8===b.nodeType&&!a.f.Z[f])throw Error(\"The binding '\"+f+\"' cannot be used with virtual elements\");try{\"function\"==typeof d&&a.l.w(function(){var a=\nd(b,v(f),s,e.$data,e);if(a&&a.controlsDescendantBindings){if(u!==n)throw Error(\"Multiple bindings (\"+u+\" and \"+f+\") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.\");u=f}}),\"function\"==typeof h&&a.B(function(){h(b,v(f),s,e.$data,e)},null,{i:b})}catch(m){throw m.message='Unable to process binding \"'+f+\": \"+g[f]+'\"\\nMessage: '+m.message,m;}})}return{shouldBindDescendants:u===n}}function h(b){return b&&b instanceof a.U?b:new a.U(b)}\na.d={};var r={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.d[b]};a.U=function(b,c,d,e){var h=this,f=\"function\"==typeof b&&!a.H(b),m,g=a.B(function(){var m=f?b():b,l=a.a.c(m);c?(c.P&&c.P(),a.a.extend(h,c),g&&(h.P=g)):(h.$parents=[],h.$root=l,h.ko=a);h.$rawData=m;h.$data=l;d&&(h[d]=l);e&&e(h,c,l);return h.$data},null,{wa:function(){return m&&!a.a.Qb(m)},i:!0});g.ba()&&(h.P=g,g.equalityComparer=null,m=[],g.Ac=function(b){m.push(b);a.a.F.oa(b,function(b){a.a.La(m,b);m.length||\n(g.k(),h.P=g=n)})})};a.U.prototype.createChildContext=function(b,c,d){return new a.U(b,this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)})};a.U.prototype.extend=function(b){return new a.U(this.P||this.$data,this,null,function(c,d){c.$rawData=d.$rawData;a.a.extend(c,\"function\"==typeof b?b():b)})};var q=a.a.e.I(),p=a.a.e.I();a.tc=function(b,c){if(2==arguments.length)a.a.e.set(b,p,c),c.P&&c.P.Ac(b);else return a.a.e.get(b,\np)};a.Ja=function(b,c,d){1===b.nodeType&&a.f.kc(b);return m(b,c,h(d),!0)};a.Dc=function(b,c,d){d=h(d);return a.Ja(b,e(c,d,b),d)};a.eb=function(a,b){1!==b.nodeType&&8!==b.nodeType||g(h(a),b,!0)};a.Rb=function(a,b){!v&&x.jQuery&&(v=x.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error(\"ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node\");b=b||x.document.body;k(h(a),b,!0)};a.kb=function(b){switch(b.nodeType){case 1:case 8:var c=a.tc(b);if(c)return c;\nif(b.parentNode)return a.kb(b.parentNode)}return n};a.Jc=function(b){return(b=a.kb(b))?b.$data:n};a.b(\"bindingHandlers\",a.d);a.b(\"applyBindings\",a.Rb);a.b(\"applyBindingsToDescendants\",a.eb);a.b(\"applyBindingAccessorsToNode\",a.Ja);a.b(\"applyBindingsToNode\",a.Dc);a.b(\"contextFor\",a.kb);a.b(\"dataFor\",a.Jc)})();(function(b){function c(c,e){var m=f.hasOwnProperty(c)?f[c]:b,h;m?m.X(e):(m=f[c]=new a.J,m.X(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,Zc:e};delete f[c];h||e?m.notifySubscribers(b):\na.Y.Wa(function(){m.notifySubscribers(b)})}),h=!0)}function d(a,b){e(\"getConfig\",[a],function(c){c?e(\"loadComponent\",[a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,f,h){h||(h=a.g.loaders.slice(0));var g=h.shift();if(g){var q=g[c];if(q){var p=!1;if(q.apply(g,d.concat(function(a){p?f(null):null!==a?f(a):e(c,d,f,h)}))!==b&&(p=!0,!g.suppressLoaderExceptions))throw Error(\"Component loaders must supply values by invoking the callback, not by returning values synchronously.\");}else e(c,d,f,h)}else f(null)}\nvar f={},g={};a.g={get:function(d,e){var f=g.hasOwnProperty(d)?g[d]:b;f?f.Zc?a.l.w(function(){e(f.definition)}):a.Y.Wa(function(){e(f.definition)}):c(d,e)},Xb:function(a){delete g[a]},Jb:e};a.g.loaders=[];a.b(\"components\",a.g);a.b(\"components.get\",a.g.get);a.b(\"components.clearCachedDefinition\",a.g.Xb)})();(function(){function b(b,c,d,e){function g(){0===--y&&e(k)}var k={},y=2,t=d.template;d=d.viewModel;t?f(c,t,function(c){a.g.Jb(\"loadTemplate\",[b,c],function(a){k.template=a;g()})}):g();d?f(c,d,function(c){a.g.Jb(\"loadViewModel\",\n[b,c],function(a){k[l]=a;g()})}):g()}function c(a,b,d){if(\"function\"===typeof b)d(function(a){return new b(a)});else if(\"function\"===typeof b[l])d(b[l]);else if(\"instance\"in b){var e=b.instance;d(function(){return e})}else\"viewModel\"in b?c(a,b.viewModel,d):a(\"Unknown viewModel value: \"+b)}function d(b){switch(a.a.A(b)){case \"script\":return a.a.ma(b.text);case \"textarea\":return a.a.ma(b.value);case \"template\":if(e(b.content))return a.a.ua(b.content.childNodes)}return a.a.ua(b.childNodes)}function e(a){return x.DocumentFragment?\na instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){\"string\"===typeof b.require?O||x.require?(O||x.require)([b.require],c):a(\"Uses require, but no AMD loader is present\"):c(b)}function g(a){return function(b){throw Error(\"Component '\"+a+\"': \"+b);}}var k={};a.g.register=function(b,c){if(!c)throw Error(\"Invalid configuration for \"+b);if(a.g.ub(b))throw Error(\"Component \"+b+\" is already registered\");k[b]=c};a.g.ub=function(a){return k.hasOwnProperty(a)};a.g.od=function(b){delete k[b];\na.g.Xb(b)};a.g.Zb={getConfig:function(a,b){b(k.hasOwnProperty(a)?k[a]:null)},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if(\"string\"===typeof c)f(a.a.ma(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.V(c.childNodes));else if(c.element)if(c=c.element,x.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if(\"string\"===typeof c){var l=u.getElementById(c);l?f(d(l)):b(\"Cannot find element with ID \"+c)}else b(\"Unknown element type: \"+\nc);else b(\"Unknown template value: \"+c)},loadViewModel:function(a,b,d){c(g(a),b,d)}};var l=\"createViewModel\";a.b(\"components.register\",a.g.register);a.b(\"components.isRegistered\",a.g.ub);a.b(\"components.unregister\",a.g.od);a.b(\"components.defaultLoader\",a.g.Zb);a.g.loaders.push(a.g.Zb);a.g.Bc=k})();(function(){function b(b,e){var f=b.getAttribute(\"params\");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ca(f,function(c){return a.m(c,null,{i:b})}),g=a.a.Ca(f,function(c){var e=\nc.t();return c.ba()?a.m({read:function(){return a.a.c(c())},write:a.Ba(e)&&function(a){c()(a)},i:b}):e});g.hasOwnProperty(\"$raw\")||(g.$raw=f);return g}return{$raw:{}}}a.g.getComponentNameForNode=function(b){var c=a.a.A(b);if(a.g.ub(c)&&(-1!=c.indexOf(\"-\")||\"[object HTMLUnknownElement]\"==\"\"+b||8>=a.a.C&&b.tagName===c))return c};a.g.Ob=function(c,e,f,g){if(1===e.nodeType){var k=a.g.getComponentNameForNode(e);if(k){c=c||{};if(c.component)throw Error('Cannot use the \"component\" binding on a custom element matching a component');\nvar l={name:k,params:b(e,f)};c.component=g?function(){return l}:l}}return c};var c=new a.Q;9>a.a.C&&(a.g.register=function(a){return function(b){u.createElement(b);return a.apply(this,arguments)}}(a.g.register),u.createDocumentFragment=function(b){return function(){var c=b(),f=a.g.Bc,g;for(g in f)f.hasOwnProperty(g)&&c.createElement(g);return c}}(u.createDocumentFragment))})();(function(b){function c(b,c,d){c=c.template;if(!c)throw Error(\"Component '\"+b+\"' has no template\");b=a.a.ua(c);a.f.da(d,b)}\nfunction d(a,b,c,d){var e=a.createViewModel;return e?e.call(a,d,{element:b,templateNodes:c}):d}var e=0;a.d.component={init:function(f,g,k,l,m){function h(){var a=r&&r.dispose;\"function\"===typeof a&&a.call(r);q=r=null}var r,q,p=a.a.V(a.f.childNodes(f));a.a.F.oa(f,h);a.m(function(){var l=a.a.c(g()),k,t;\"string\"===typeof l?k=l:(k=a.a.c(l.name),t=a.a.c(l.params));if(!k)throw Error(\"No component name specified\");var n=q=++e;a.g.get(k,function(e){if(q===n){h();if(!e)throw Error(\"Unknown component '\"+k+\n\"'\");c(k,e,f);var g=d(e,f,p,t);e=m.createChildContext(g,b,function(a){a.$component=g;a.$componentTemplateNodes=p});r=g;a.eb(e,f)}})},null,{i:f});return{controlsDescendantBindings:!0}}};a.f.Z.component=!0})();var S={\"class\":\"className\",\"for\":\"htmlFor\"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.D(d,function(c,d){d=a.a.c(d);var g=!1===d||null===d||d===n;g&&b.removeAttribute(c);8>=a.a.C&&c in S?(c=S[c],g?b.removeAttribute(c):b[c]=d):g||b.setAttribute(c,d.toString());\"name\"===c&&a.a.rc(b,\ng?\"\":d.toString())})}};(function(){a.d.checked={after:[\"value\",\"attr\"],init:function(b,c,d){function e(){var e=b.checked,f=p?g():e;if(!a.va.Sa()&&(!l||e)){var m=a.l.w(c);if(h){var k=r?m.t():m;q!==f?(e&&(a.a.pa(k,f,!0),a.a.pa(k,q,!1)),q=f):a.a.pa(k,f,e);r&&a.Ba(m)&&m(k)}else a.h.Ea(m,d,\"checked\",f,!0)}}function f(){var d=a.a.c(c());b.checked=h?0<=a.a.o(d,g()):k?d:g()===d}var g=a.nc(function(){return d.has(\"checkedValue\")?a.a.c(d.get(\"checkedValue\")):d.has(\"value\")?a.a.c(d.get(\"value\")):b.value}),k=\n\"checkbox\"==b.type,l=\"radio\"==b.type;if(k||l){var m=c(),h=k&&a.a.c(m)instanceof Array,r=!(h&&m.push&&m.splice),q=h?g():n,p=l||h;l&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.m(e,null,{i:b});a.a.p(b,\"click\",e);a.m(f,null,{i:b});m=n}}};a.h.ea.checked=!0;a.d.checkedValue={update:function(b,c){b.value=a.a.c(c())}}})();a.d.css={update:function(b,c){var d=a.a.c(c());null!==d&&\"object\"==typeof d?a.a.D(d,function(c,d){d=a.a.c(d);a.a.bb(b,c,d)}):(d=a.a.$a(String(d||\"\")),a.a.bb(b,b.__ko__cssValue,\n!1),b.__ko__cssValue=d,a.a.bb(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());d&&b.disabled?b.removeAttribute(\"disabled\"):d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,e,f){var g=c()||{};a.a.D(g,function(g){\"string\"==typeof g&&a.a.p(b,g,function(b){var m,h=c()[g];if(h){try{var r=a.a.V(arguments);e=f.$data;r.unshift(e);m=h.apply(e,r)}finally{!0!==m&&(b.preventDefault?b.preventDefault():\nb.returnValue=!1)}!1===d.get(g+\"Bubble\")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={ic:function(b){return function(){var c=b(),d=a.a.zb(c);if(!d||\"number\"==typeof d.length)return{foreach:c,templateEngine:a.W.sb};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.W.sb}}},init:function(b,c){return a.d.template.init(b,\na.d.foreach.ic(c))},update:function(b,c,d,e,f){return a.d.template.update(b,a.d.foreach.ic(c),d,e,f)}};a.h.ta.foreach=!1;a.f.Z.foreach=!0;a.d.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if(\"activeElement\"in f){var g;try{g=f.activeElement}catch(h){g=f.body}e=g===b}f=c();a.h.Ea(f,d,\"hasfocus\",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.p(b,\"focus\",f);a.a.p(b,\"focusin\",f);a.a.p(b,\"blur\",g);a.a.p(b,\n\"focusout\",g)},update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.l.w(a.a.Da,null,[b,d?\"focusin\":\"focusout\"]))}};a.h.ea.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.ea.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Cb(b,c())}};K(\"if\");K(\"ifnot\",!1,!0);K(\"with\",!0,!1,function(a,c){return a.createChildContext(c)});var L={};\na.d.options={init:function(b){if(\"select\"!==a.a.A(b))throw Error(\"options binding applies only to SELECT elements\");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.Ka(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return\"function\"==d?b(a):\"string\"==d?a[b]:c}function g(c,e){if(A&&h)a.j.ha(b,a.a.c(d.get(\"value\")),!0);else if(p.length){var f=0<=a.a.o(p,a.j.u(e[0]));a.a.sc(e[0],f);A&&!f&&a.l.w(a.a.Da,null,[b,\n\"change\"])}}var k=b.multiple,l=0!=b.length&&k?b.scrollTop:null,m=a.a.c(c()),h=d.get(\"valueAllowUnset\")&&d.has(\"value\"),r=d.get(\"optionsIncludeDestroyed\");c={};var q,p=[];h||(k?p=a.a.fb(e(),a.j.u):0<=b.selectedIndex&&p.push(a.j.u(b.options[b.selectedIndex])));m&&(\"undefined\"==typeof m.length&&(m=[m]),q=a.a.Ka(m,function(b){return r||b===n||null===b||!a.a.c(b._destroy)}),d.has(\"optionsCaption\")&&(m=a.a.c(d.get(\"optionsCaption\")),null!==m&&m!==n&&q.unshift(L)));var A=!1;c.beforeRemove=function(a){b.removeChild(a)};\nm=g;d.has(\"optionsAfterRender\")&&\"function\"==typeof d.get(\"optionsAfterRender\")&&(m=function(b,c){g(0,c);a.l.w(d.get(\"optionsAfterRender\"),null,[c[0],b!==L?b:n])});a.a.Bb(b,q,function(c,e,g){g.length&&(p=!h&&g[0].selected?[a.j.u(g[0])]:[],A=!0);e=b.ownerDocument.createElement(\"option\");c===L?(a.a.Za(e,d.get(\"optionsCaption\")),a.j.ha(e,n)):(g=f(c,d.get(\"optionsValue\"),c),a.j.ha(e,a.a.c(g)),c=f(c,d.get(\"optionsText\"),g),a.a.Za(e,c));return[e]},c,m);a.l.w(function(){h?a.j.ha(b,a.a.c(d.get(\"value\")),\n!0):(k?p.length&&e().length<p.length:p.length&&0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex])!==p[0]:p.length||0<=b.selectedIndex)&&a.a.Da(b,\"change\")});a.a.Nc(b);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.d.options.xb=a.a.e.I();a.d.selectedOptions={after:[\"options\",\"foreach\"],init:function(b,c,d){a.a.p(b,\"change\",function(){var e=c(),f=[];a.a.q(b.getElementsByTagName(\"option\"),function(b){b.selected&&f.push(a.j.u(b))});a.h.Ea(e,d,\"selectedOptions\",f)})},update:function(b,c){if(\"select\"!=\na.a.A(b))throw Error(\"values binding applies only to SELECT elements\");var d=a.a.c(c()),e=b.scrollTop;d&&\"number\"==typeof d.length&&a.a.q(b.getElementsByTagName(\"option\"),function(b){var c=0<=a.a.o(d,a.j.u(b));b.selected!=c&&a.a.sc(b,c)});b.scrollTop=e}};a.h.ea.selectedOptions=!0;a.d.style={update:function(b,c){var d=a.a.c(c()||{});a.a.D(d,function(c,d){d=a.a.c(d);if(null===d||d===n||!1===d)d=\"\";b.style[c]=d})}};a.d.submit={init:function(b,c,d,e,f){if(\"function\"!=typeof c())throw Error(\"The value for a submit binding must be a function\");\na.a.p(b,\"submit\",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Za(b,c())}};a.f.Z.text=!0;(function(){if(x&&x.navigator)var b=function(a){if(a)return parseFloat(a[1])},c=x.opera&&x.opera.version&&parseInt(x.opera.version()),d=x.navigator.userAgent,e=b(d.match(/^(?:(?!chrome).)*version\\/([^ ]*) safari/i)),f=b(d.match(/Firefox\\/([^ ]*)/));\nif(10>a.a.C)var g=a.a.e.I(),k=a.a.e.I(),l=function(b){var c=this.activeElement;(c=c&&a.a.e.get(c,k))&&c(b)},m=function(b,c){var d=b.ownerDocument;a.a.e.get(d,g)||(a.a.e.set(d,g,!0),a.a.p(d,\"selectionchange\",l));a.a.e.set(b,k,c)};a.d.textInput={init:function(b,d,g){function l(c,d){a.a.p(b,c,d)}function k(){var c=a.a.c(d());if(null===c||c===n)c=\"\";v!==n&&c===v?a.a.setTimeout(k,4):b.value!==c&&(u=c,b.value=c)}function y(){s||(v=b.value,s=a.a.setTimeout(t,4))}function t(){clearTimeout(s);v=s=n;var c=\nb.value;u!==c&&(u=c,a.h.Ea(d(),g,\"textInput\",c))}var u=b.value,s,v,x=9==a.a.C?y:t;10>a.a.C?(l(\"propertychange\",function(a){\"value\"===a.propertyName&&x(a)}),8==a.a.C&&(l(\"keyup\",t),l(\"keydown\",t)),8<=a.a.C&&(m(b,x),l(\"dragend\",y))):(l(\"input\",t),5>e&&\"textarea\"===a.a.A(b)?(l(\"keydown\",y),l(\"paste\",y),l(\"cut\",y)):11>c?l(\"keydown\",y):4>f&&(l(\"DOMAutoComplete\",t),l(\"dragdrop\",t),l(\"drop\",t)));l(\"change\",t);a.m(k,null,{i:b})}};a.h.ea.textInput=!0;a.d.textinput={preprocess:function(a,b,c){c(\"textInput\",\na)}}})();a.d.uniqueName={init:function(b,c){if(c()){var d=\"ko_unique_\"+ ++a.d.uniqueName.Ic;a.a.rc(b,d)}}};a.d.uniqueName.Ic=0;a.d.value={after:[\"options\",\"foreach\"],init:function(b,c,d){if(\"input\"!=b.tagName.toLowerCase()||\"checkbox\"!=b.type&&\"radio\"!=b.type){var e=[\"change\"],f=d.get(\"valueUpdate\"),g=!1,k=null;f&&(\"string\"==typeof f&&(f=[f]),a.a.ra(e,f),e=a.a.Tb(e));var l=function(){k=null;g=!1;var e=c(),f=a.j.u(b);a.h.Ea(e,d,\"value\",f)};!a.a.C||\"input\"!=b.tagName.toLowerCase()||\"text\"!=b.type||\n\"off\"==b.autocomplete||b.form&&\"off\"==b.form.autocomplete||-1!=a.a.o(e,\"propertychange\")||(a.a.p(b,\"propertychange\",function(){g=!0}),a.a.p(b,\"focus\",function(){g=!1}),a.a.p(b,\"blur\",function(){g&&l()}));a.a.q(e,function(c){var d=l;a.a.nd(c,\"after\")&&(d=function(){k=a.j.u(b);a.a.setTimeout(l,0)},c=c.substring(5));a.a.p(b,c,d)});var m=function(){var e=a.a.c(c()),f=a.j.u(b);if(null!==k&&e===k)a.a.setTimeout(m,0);else if(e!==f)if(\"select\"===a.a.A(b)){var g=d.get(\"valueAllowUnset\"),f=function(){a.j.ha(b,\ne,g)};f();g||e===a.j.u(b)?a.a.setTimeout(f,0):a.l.w(a.a.Da,null,[b,\"change\"])}else a.j.ha(b,e)};a.m(m,null,{i:b})}else a.Ja(b,{checkedValue:c})},update:function(){}};a.h.ea.value=!0;a.d.visible={update:function(b,c){var d=a.a.c(c()),e=\"none\"!=b.style.display;d&&!e?b.style.display=\"\":!d&&e&&(b.style.display=\"none\")}};(function(b){a.d[b]={init:function(c,d,e,f,g){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})(\"click\");a.O=function(){};a.O.prototype.renderTemplateSource=\nfunction(){throw Error(\"Override renderTemplateSource\");};a.O.prototype.createJavaScriptEvaluatorBlock=function(){throw Error(\"Override createJavaScriptEvaluatorBlock\");};a.O.prototype.makeTemplateSource=function(b,c){if(\"string\"==typeof b){c=c||u;var d=c.getElementById(b);if(!d)throw Error(\"Cannot find template with ID \"+b);return new a.v.n(d)}if(1==b.nodeType||8==b.nodeType)return new a.v.qa(b);throw Error(\"Unknown template type: \"+b);};a.O.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,\ne);return this.renderTemplateSource(a,c,d,e)};a.O.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data(\"isRewritten\")};a.O.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data(\"isRewritten\",!0)};a.b(\"templateEngine\",a.O);a.Gb=function(){function b(b,c,d,k){b=a.h.yb(b);for(var l=a.h.ta,m=0;m<b.length;m++){var h=b[m].key;if(l.hasOwnProperty(h)){var r=l[h];if(\"function\"===typeof r){if(h=\nr(b[m].value))throw Error(h);}else if(!r)throw Error(\"This template engine does not support the '\"+h+\"' binding within its templates\");}}d=\"ko.__tr_ambtns(function($context,$element){return(function(){return{ \"+a.h.Ua(b,{valueAccessors:!0})+\" } })()},'\"+d.toLowerCase()+\"')\";return k.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\\d*)(?:\\s+(?!data-bind\\s*=\\s*)[a-z0-9\\-]+(?:=(?:\\\"[^\\\"]*\\\"|\\'[^\\']*\\'|[^>]*))?)*\\s+)data-bind\\s*=\\s*([\"'])([\\s\\S]*?)\\3/gi,d=/\\x3c!--\\s*ko\\b\\s*([\\s\\S]*?)\\s*--\\x3e/g;return{Oc:function(b,\nc,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.Gb.dd(b,c)},d)},dd:function(a,f){return a.replace(c,function(a,c,d,e,h){return b(h,c,d,f)}).replace(d,function(a,c){return b(c,\"\\x3c!-- ko --\\x3e\",\"#comment\",f)})},Ec:function(b,c){return a.M.wb(function(d,k){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.Ja(l,b,k)})}}}();a.b(\"__tr_ambtns\",a.Gb.Ec);(function(){a.v={};a.v.n=function(b){if(this.n=b){var c=a.a.A(b);this.ab=\"script\"===c?1:\"textarea\"===c?2:\"template\"==c&&\nb.content&&11===b.content.nodeType?3:4}};a.v.n.prototype.text=function(){var b=1===this.ab?\"text\":2===this.ab?\"value\":\"innerHTML\";if(0==arguments.length)return this.n[b];var c=arguments[0];\"innerHTML\"===b?a.a.Cb(this.n,c):this.n[b]=c};var b=a.a.e.I()+\"_\";a.v.n.prototype.data=function(c){if(1===arguments.length)return a.a.e.get(this.n,b+c);a.a.e.set(this.n,b+c,arguments[1])};var c=a.a.e.I();a.v.n.prototype.nodes=function(){var b=this.n;if(0==arguments.length)return(a.a.e.get(b,c)||{}).jb||(3===this.ab?\nb.content:4===this.ab?b:n);a.a.e.set(b,c,{jb:arguments[0]})};a.v.qa=function(a){this.n=a};a.v.qa.prototype=new a.v.n;a.v.qa.prototype.text=function(){if(0==arguments.length){var b=a.a.e.get(this.n,c)||{};b.Hb===n&&b.jb&&(b.Hb=b.jb.innerHTML);return b.Hb}a.a.e.set(this.n,c,{Hb:arguments[0]})};a.b(\"templateSources\",a.v);a.b(\"templateSources.domElement\",a.v.n);a.b(\"templateSources.anonymousTemplate\",a.v.qa)})();(function(){function b(b,c,d){var e;for(c=a.f.nextSibling(c);b&&(e=b)!==c;)b=a.f.nextSibling(e),\nd(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,k=a.Q.instance,n=k.preprocessNode;if(n){b(e,f,function(a,b){var c=a.previousSibling,d=n.call(k,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.za(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.Rb(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.M.yc(b,[d])});a.a.za(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,\ne,f,k,q){q=q||{};var p=(b&&d(b)||f||{}).ownerDocument,n=q.templateEngine||g;a.Gb.Oc(f,n,p);f=n.renderTemplate(f,k,q,p);if(\"number\"!=typeof f.length||0<f.length&&\"number\"!=typeof f[0].nodeType)throw Error(\"Template engine must return an array of DOM nodes\");p=!1;switch(e){case \"replaceChildren\":a.f.da(b,f);p=!0;break;case \"replaceNode\":a.a.qc(b,f);p=!0;break;case \"ignoreTargetNode\":break;default:throw Error(\"Unknown renderMode: \"+e);}p&&(c(f,k),q.afterRender&&a.l.w(q.afterRender,null,[f,k.$data]));\nreturn f}function f(b,c,d){return a.H(b)?b():\"function\"===typeof b?b(c,d):b}var g;a.Db=function(b){if(b!=n&&!(b instanceof a.O))throw Error(\"templateEngine must inherit from ko.templateEngine\");g=b};a.Ab=function(b,c,h,k,q){h=h||{};if((h.templateEngine||g)==n)throw Error(\"Set a template engine before calling renderTemplate\");q=q||\"replaceChildren\";if(k){var p=d(k);return a.B(function(){var g=c&&c instanceof a.U?c:new a.U(a.a.c(c)),n=f(b,g.$data,g),g=e(k,q,n,g,h);\"replaceNode\"==q&&(k=g,p=d(k))},null,\n{wa:function(){return!p||!a.a.nb(p)},i:p&&\"replaceNode\"==q?p.parentNode:p})}return a.M.wb(function(d){a.Ab(b,c,h,d,\"replaceNode\")})};a.kd=function(b,d,g,k,q){function p(a,b){c(b,s);g.afterRender&&g.afterRender(b,a);s=null}function u(a,c){s=q.createChildContext(a,g.as,function(a){a.$index=c});var d=f(b,a,s);return e(null,\"ignoreTargetNode\",d,s,g)}var s;return a.B(function(){var b=a.a.c(d)||[];\"undefined\"==typeof b.length&&(b=[b]);b=a.a.Ka(b,function(b){return g.includeDestroyed||b===n||null===b||!a.a.c(b._destroy)});\na.l.w(a.a.Bb,null,[k,b,u,g,p])},null,{i:k})};var k=a.a.e.I();a.d.template={init:function(b,c){var d=a.a.c(c());if(\"string\"==typeof d||d.name)a.f.xa(b);else{if(\"nodes\"in d){if(d=d.nodes||[],a.H(d))throw Error('The \"nodes\" option must be a plain, non-observable array.');}else d=a.f.childNodes(b);d=a.a.jc(d);(new a.v.qa(b)).nodes(d)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c(),s;c=a.a.c(g);d=!0;e=null;\"string\"==typeof c?c={}:(g=c.name,\"if\"in c&&(d=a.a.c(c[\"if\"])),d&&\"ifnot\"in\nc&&(d=!a.a.c(c.ifnot)),s=a.a.c(c.data));\"foreach\"in c?e=a.kd(g||b,d&&c.foreach||[],c,b,f):d?(f=\"data\"in c?f.createChildContext(s,c.as):f,e=a.Ab(g||b,f,c,b)):a.f.xa(b);f=e;(s=a.a.e.get(b,k))&&\"function\"==typeof s.k&&s.k();a.a.e.set(b,k,f&&f.ba()?f:n)}};a.h.ta.template=function(b){b=a.h.yb(b);return 1==b.length&&b[0].unknown||a.h.ad(b,\"name\")?null:\"This template engine does not support anonymous templates nested within its templates\"};a.f.Z.template=!0})();a.b(\"setTemplateEngine\",a.Db);a.b(\"renderTemplate\",\na.Ab);a.a.dc=function(a,c,d){if(a.length&&c.length){var e,f,g,k,l;for(e=f=0;(!d||e<d)&&(k=a[f]);++f){for(g=0;l=c[g];++g)if(k.value===l.value){k.moved=l.index;l.moved=k.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.ib=function(){function b(b,d,e,f,g){var k=Math.min,l=Math.max,m=[],h,n=b.length,q,p=d.length,s=p-n||1,u=n+p+1,t,v,x;for(h=0;h<=n;h++)for(v=t,m.push(t=[]),x=k(p,h+s),q=l(0,h-1);q<=x;q++)t[q]=q?h?b[h-1]===d[q-1]?v[q-1]:k(v[q]||u,t[q-1]||u)+1:q+1:h+1;k=[];l=[];s=[];h=n;for(q=p;h||q;)p=m[h][q]-\n1,q&&p===m[h][q-1]?l.push(k[k.length]={status:e,value:d[--q],index:q}):h&&p===m[h-1][q]?s.push(k[k.length]={status:f,value:b[--h],index:h}):(--q,--h,g.sparse||k.push({status:\"retained\",value:d[q]}));a.a.dc(s,l,!g.dontLimitMoves&&10*n);return k.reverse()}return function(a,d,e){e=\"boolean\"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,\"added\",\"deleted\",e):b(d,a,\"deleted\",\"added\",e)}}();a.b(\"utils.compareArrays\",a.a.ib);(function(){function b(b,c,d,k,l){var m=[],\nh=a.B(function(){var h=c(d,l,a.a.za(m,b))||[];0<m.length&&(a.a.qc(m,h),k&&a.l.w(k,null,[d,h,l]));m.length=0;a.a.ra(m,h)},null,{i:b,wa:function(){return!a.a.Qb(m)}});return{ca:m,B:h.ba()?h:n}}var c=a.a.e.I(),d=a.a.e.I();a.a.Bb=function(e,f,g,k,l){function m(b,c){w=q[c];v!==c&&(D[b]=w);w.qb(v++);a.a.za(w.ca,e);u.push(w);z.push(w)}function h(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.q(c[d].ca,function(a){b(a,d,c[d].ja)})}f=f||[];k=k||{};var r=a.a.e.get(e,c)===n,q=a.a.e.get(e,c)||[],p=a.a.fb(q,\nfunction(a){return a.ja}),s=a.a.ib(p,f,k.dontLimitMoves),u=[],t=0,v=0,x=[],z=[];f=[];for(var D=[],p=[],w,C=0,B,E;B=s[C];C++)switch(E=B.moved,B.status){case \"deleted\":E===n&&(w=q[t],w.B&&(w.B.k(),w.B=n),a.a.za(w.ca,e).length&&(k.beforeRemove&&(u.push(w),z.push(w),w.ja===d?w=null:f[C]=w),w&&x.push.apply(x,w.ca)));t++;break;case \"retained\":m(C,t++);break;case \"added\":E!==n?m(C,E):(w={ja:B.value,qb:a.N(v++)},u.push(w),z.push(w),r||(p[C]=w))}a.a.e.set(e,c,u);h(k.beforeMove,D);a.a.q(x,k.beforeRemove?a.$:\na.removeNode);for(var C=0,r=a.f.firstChild(e),F;w=z[C];C++){w.ca||a.a.extend(w,b(e,g,w.ja,l,w.qb));for(t=0;s=w.ca[t];r=s.nextSibling,F=s,t++)s!==r&&a.f.gc(e,s,F);!w.Wc&&l&&(l(w.ja,w.ca,w.qb),w.Wc=!0)}h(k.beforeRemove,f);for(C=0;C<f.length;++C)f[C]&&(f[C].ja=d);h(k.afterMove,D);h(k.afterAdd,p)}})();a.b(\"utils.setDomNodeChildrenFromArrayMapping\",a.a.Bb);a.W=function(){this.allowTemplateRewriting=!1};a.W.prototype=new a.O;a.W.prototype.renderTemplateSource=function(b,c,d,e){if(c=(9>a.a.C?0:b.nodes)?\nb.nodes():null)return a.a.V(c.cloneNode(!0).childNodes);b=b.text();return a.a.ma(b,e)};a.W.sb=new a.W;a.Db(a.W.sb);a.b(\"nativeTemplateEngine\",a.W);(function(){a.vb=function(){var a=this.$c=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf(\"__\"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,e,f,g){g=g||u;f=f||{};if(2>a)throw Error(\"Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.\");var k=b.data(\"precompiled\");\nk||(k=b.text()||\"\",k=v.template(null,\"{{ko_with $item.koBindingContext}}\"+k+\"{{/ko_with}}\"),b.data(\"precompiled\",k));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(k,b,e);e.appendTo(g.createElement(\"div\"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return\"{{ko_code ((function() { return \"+a+\" })()) }}\"};this.addTemplate=function(a,b){u.write(\"<script type='text/html' id='\"+a+\"'>\"+b+\"\\x3c/script>\")};0<a&&(v.tmpl.tag.ko_code={open:\"__.push($1 || '');\"},\nv.tmpl.tag.ko_with={open:\"with($1) {\",close:\"} \"})};a.vb.prototype=new a.O;var b=new a.vb;0<b.$c&&a.Db(b);a.b(\"jqueryTmplTemplateEngine\",a.vb)})()})})();})();\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/java/org/uberfire/ext/plugin/backend/JSRegistryTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport org.junit.Test;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.ANGULAR_TODO_REGISTRY;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.EMPTY_SCREEN_REGISTRY;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.SCREEN_WITH_TITLE_AND_NAME_REGISTRY;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.SCREEN_WITH_TITLE_REGISTRY;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.SPLASH_SCREEN_REGISTRY;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.getEmptyScreen;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.getScreenWithMainAndTitle;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.getScreenWithTitle;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.getSplashScreen;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.getTodoAngularPluginSimpleContent;\nimport static org.uberfire.ext.plugin.backend.PluginSamples.loadSample;\n\npublic class JSRegistryTest {\n\n    @Test\n    public void createEmptyScreenRegistry() {\n        PluginSimpleContent pluginContent = getEmptyScreen();\n        assertEquals(loadSample(EMPTY_SCREEN_REGISTRY),\n                     JSRegistry.convertToJSRegistry(pluginContent));\n    }\n\n    @Test\n    public void createScreenWithTitleRegistry() {\n        PluginSimpleContent pluginContent = getScreenWithTitle();\n        assertEquals(loadSample(SCREEN_WITH_TITLE_REGISTRY),\n                     JSRegistry.convertToJSRegistry(pluginContent));\n    }\n\n    @Test\n    public void createScreenWithTitleAndMainRegistry() {\n        PluginSimpleContent pluginContent = getScreenWithMainAndTitle();\n        assertEquals(loadSample(SCREEN_WITH_TITLE_AND_NAME_REGISTRY),\n                     JSRegistry.convertToJSRegistry(pluginContent));\n    }\n\n    @Test\n    public void createAngularScreenRegistry() {\n        PluginSimpleContent pluginContent = getTodoAngularPluginSimpleContent();\n        assertEquals(loadSample(ANGULAR_TODO_REGISTRY),\n                     JSRegistry.convertToJSRegistry(pluginContent));\n    }\n\n    @Test\n    public void createSplashScreenRegistry() {\n        PluginSimpleContent pluginContent = getSplashScreen();\n        assertEquals(loadSample(SPLASH_SCREEN_REGISTRY),\n                     JSRegistry.convertToJSRegistry(pluginContent));\n    }\n\n    @Test\n    public void prepareTextualEntry() {\n        assertEquals(\"function (){return \\\"\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  null));\n        assertEquals(\"function (){return \\\"\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \"\"));\n        assertEquals(\"function (){return \\\" \\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \" \"));\n        assertEquals(\"function (){return \\\"Title\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \"Title\"));\n        assertEquals(\"function (){return \\\"Title\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \"\\\"Title\\\"\"));\n        assertEquals(\"function (){return \\\"Long Title\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \"\\\"Long Title\\\"\"));\n    }\n\n    @Test\n    public void prepareJSEntry() {\n        assertEquals(\"function () { return \\\"ko\\\";}\",\n                     JSRegistry.prepareEntryValue(CodeType.TITLE,\n                                                  \"function () { return \\\"ko\\\";}\"));\n        assertEquals(\"function (){alert('hi');;}\",\n                     JSRegistry.prepareEntryValue(CodeType.ON_CLOSE,\n                                                  \"alert('hi');\"));\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/java/org/uberfire/ext/plugin/backend/MediaServletURIProducerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class MediaServletURIProducerTest {\n\n    private MediaServletURIProducer mediaServletURIProducer = new MediaServletURIProducer();\n\n    @Test\n    public void testSetup() throws Exception {\n        mediaServletURIProducer.setup();\n\n        assertEquals(\"plugins/\",\n                     getMediaServletURI().getURI());\n    }\n\n    private MediaServletURI getMediaServletURI() {\n        return mediaServletURIProducer.produceMediaServletURI();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/java/org/uberfire/ext/plugin/backend/PluginMediaServletTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Iterator;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginMediaServletTest {\n\n    @Mock\n    FileSystem fileSystem;\n\n    @Mock\n    Iterable<Path> iterable;\n\n    @Mock\n    Iterator<Path> iterator;\n\n    @Mock\n    ServletConfig config;\n\n    @Mock\n    IOService ioService;\n\n    @Mock\n    MediaServletURI mediaServletURI;\n\n    @InjectMocks\n    PluginMediaServlet servlet = fakeServlet();\n\n    @Test\n    public void testInit() throws Exception {\n        when(iterable.iterator()).thenReturn(iterator);\n        when(fileSystem.getRootDirectories()).thenReturn(iterable);\n        when(config.getInitParameter(anyString())).thenReturn(\"/fake\");\n\n        servlet.init(config);\n\n        verify(mediaServletURI).setURI(eq(\"fake/\"));\n    }\n\n    @Test\n    public void testDoPost() throws Exception {\n        final FileItem fileItem = fileMock(\"C:\\\\Users\\\\user\\\\Desktop\\\\image.jpg\");\n        final PluginMediaServlet servlet = spy(fakeServlet(fileItem));\n\n        final HttpServletRequest request = requestMock(\"/plugins/screen\");\n        final HttpServletResponse response = responseMock();\n\n        servlet.doPost(request,\n                       response);\n\n        verify(servlet).resolve(\"/screen/media/image.jpg\");\n    }\n\n    private HttpServletResponse responseMock() {\n        return mock(HttpServletResponse.class);\n    }\n\n    private HttpServletRequest requestMock(final String requestURI) {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n\n        when(request.getRequestURI()).thenReturn(requestURI);\n        when(request.getContextPath()).thenReturn(\"\");\n\n        return request;\n    }\n\n    private FileItem fileMock(final String fileName) {\n        final FileItem fileItem = mock(FileItem.class);\n\n        when(fileItem.getName()).thenReturn(fileName);\n\n        return fileItem;\n    }\n\n    private PluginMediaServlet fakeServlet() {\n        return fakeServlet(null);\n    }\n\n    private PluginMediaServlet fakeServlet(final FileItem fileItem) {\n        return new PluginMediaServlet() {\n\n            @Override\n            protected FileItem getFileItem(HttpServletRequest request) throws FileUploadException {\n\n                return fileItem;\n            }\n\n            @Override\n            protected void writeResponse(HttpServletResponse response,\n                                         String ok) throws IOException {\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/java/org/uberfire/ext/plugin/backend/PluginSamples.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.apache.commons.io.IOUtils;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.Framework;\nimport org.uberfire.ext.plugin.model.Language;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.ext.plugin.model.PluginType;\n\npublic class PluginSamples {\n\n    public static final String ANGULAR_TODO_REGISTRY = \"angular_todo_registry.txt\";\n    public static final String EMPTY_SCREEN_REGISTRY = \"empty_screen_registry.txt\";\n    public static final String SCREEN_WITH_TITLE_REGISTRY = \"screen_with_title_registry.txt\";\n    public static final String SCREEN_WITH_TITLE_AND_NAME_REGISTRY = \"screen_with_title_and_name_registry.txt\";\n    public static final String SPLASH_SCREEN_REGISTRY = \"splash_screen_registry.txt\";\n    private static final String ANGULAR_MAIN = \"angular_main.txt\";\n    private static final String ANGULAR_TEMPLATE = \"angular_template.txt\";\n    private static final String ANGULAR_CSS = \"angular_css.txt\";\n    private static final String SPLASH_TEMPLATE = \"splash_template.txt\";\n    private static final String SPLASH_MAIN = \"splash_main.txt\";\n\n    public static PluginSimpleContent getTodoAngularPluginSimpleContent() {\n        Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n        codeMap.put(CodeType.MAIN,\n                    loadSample(ANGULAR_MAIN));\n        Path path = null;\n        Set<Framework> frameworks = new HashSet<Framework>();\n        frameworks.add(Framework.ANGULAR);\n        PluginSimpleContent plugin = new PluginSimpleContent(\"Yo\",\n                                                             PluginType.SCREEN,\n                                                             path,\n                                                             loadSample(ANGULAR_TEMPLATE),\n                                                             loadSample(ANGULAR_CSS),\n                                                             codeMap,\n                                                             frameworks,\n                                                             Language.JAVASCRIPT);\n        return plugin;\n    }\n\n    public static PluginSimpleContent getSplashScreen() {\n        Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n        codeMap.put(CodeType.MAIN,\n                    loadSample(SPLASH_MAIN));\n        codeMap.put(CodeType.ON_CLOSE,\n                    loadSample(SPLASH_MAIN));\n        codeMap.put(CodeType.ON_CONCURRENT_COPY,\n                    loadSample(SPLASH_MAIN));\n        codeMap.put(CodeType.TITLE,\n                    \"Title\");\n        Path path = null;\n        Set<Framework> frameworks = new HashSet<Framework>();\n        PluginSimpleContent plugin = new PluginSimpleContent(\"Splash\",\n                                                             PluginType.SPLASH,\n                                                             path,\n                                                             loadSample(SPLASH_TEMPLATE),\n                                                             \"\",\n                                                             codeMap,\n                                                             frameworks,\n                                                             Language.JAVASCRIPT);\n        return plugin;\n    }\n\n    public static PluginSimpleContent getEmptyScreen() {\n        Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n        codeMap.put(CodeType.MAIN,\n                    \"\");\n        Path path = null;\n        Set<Framework> frameworks = new HashSet<Framework>();\n        PluginSimpleContent plugin = new PluginSimpleContent(\"Yo\",\n                                                             PluginType.SCREEN,\n                                                             path,\n                                                             \"\",\n                                                             \"\",\n                                                             codeMap,\n                                                             frameworks,\n                                                             Language.JAVASCRIPT);\n        return plugin;\n    }\n\n    public static PluginSimpleContent getScreenWithTitle() {\n        Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n        codeMap.put(CodeType.MAIN,\n                    \"\");\n        codeMap.put(CodeType.TITLE,\n                    \"My Title\");\n        Path path = null;\n        Set<Framework> frameworks = new HashSet<Framework>();\n        PluginSimpleContent plugin = new PluginSimpleContent(\"ScreenWithTitle\",\n                                                             PluginType.SCREEN,\n                                                             path,\n                                                             \"\",\n                                                             \"\",\n                                                             codeMap,\n                                                             frameworks,\n                                                             Language.JAVASCRIPT);\n        return plugin;\n    }\n\n    public static PluginSimpleContent getScreenWithMainAndTitle() {\n        Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n        codeMap.put(CodeType.MAIN,\n                    \"alert('main');\");\n        codeMap.put(CodeType.TITLE,\n                    \"My Title\");\n        Path path = null;\n        Set<Framework> frameworks = new HashSet<Framework>();\n        PluginSimpleContent plugin = new PluginSimpleContent(\"ScreenWithTitle\",\n                                                             PluginType.SCREEN,\n                                                             path,\n                                                             \"\",\n                                                             \"\",\n                                                             codeMap,\n                                                             frameworks,\n                                                             Language.JAVASCRIPT);\n        return plugin;\n    }\n\n    public static String loadSample(String file) {\n        try {\n            return IOUtils.toString(new PluginSamples().getClass().getResourceAsStream(file),\n                                    \"UTF-8\");\n        } catch (IOException e) {\n            return \"\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/java/org/uberfire/ext/plugin/backend/PluginServicesImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.backend;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.mockito.Spy;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.backend.validation.DefaultFileNameValidator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.plugin.event.MediaDeleted;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.exception.PluginAlreadyExists;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.Framework;\nimport org.uberfire.ext.plugin.model.LayoutEditorModel;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\npublic class PluginServicesImplTest {\n\n    private static FileSystemTestingUtils pluginsFSUtils = new FileSystemTestingUtils();\n    private static FileSystemTestingUtils perspectivesFSUtils = new FileSystemTestingUtils();\n\n    @Mock(name = \"MediaServletURI\")\n    private Instance<MediaServletURI> mediaServletURI;\n\n    @Mock\n    private transient SessionInfo sessionInfo;\n\n    @Mock\n    private Event<PluginAdded> pluginAddedEvent;\n\n    @Mock\n    private Event<PluginDeleted> pluginDeletedEvent;\n\n    @Mock\n    private Event<PluginSaved> pluginSavedEvent;\n\n    @Mock\n    private Event<PluginRenamed> pluginRenamedEvent;\n\n    @Mock\n    private Event<MediaDeleted> mediaDeletedEvent;\n\n    @Mock(name = \"pluginsFS\")\n    private FileSystem pluginsFS;\n\n    @Mock(name = \"perspectivesFS\")\n    private FileSystem perspectivesFS;\n\n    @Spy\n    private DefaultFileNameValidator defaultFileNameValidator;\n\n    @Mock\n    private SaveAndRenameServiceImpl<Plugin, DefaultMetadata> saveAndRenameService;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private SpacesAPI spacesAPI;\n\n    private IOServiceDotFileImpl ioService;\n\n    private PluginServicesImpl pluginServices;\n\n    private String PLUGINS_PATH = \"git://plugins\";\n    private String PLUGINS_REPO_PATH = \"git://master@plugins\";\n    private String PERSPECTIVES_PATH = \"git://perspectives\";\n    private String PERSPECTIVES_REPO_PATH = \"git://master@perspectives\";\n\n    @After\n    public void cleanupFileSystem() {\n        pluginsFSUtils.cleanup();\n        perspectivesFSUtils.cleanup();\n    }\n\n    @Before\n    public void setup() throws IOException {\n        pluginsFSUtils.setup(PLUGINS_PATH);\n        perspectivesFSUtils.setup(PERSPECTIVES_PATH);\n\n        MockitoAnnotations.initMocks(this);\n        ioService = spy((IOServiceDotFileImpl) pluginsFSUtils.getIoService());\n\n        doReturn(\"plugins\").when(pluginsFS).getName();\n        doReturn(\"perspectives\").when(perspectivesFS).getName();\n\n        pluginServices = spy(new PluginServicesImpl(ioService,\n                                                    mediaServletURI,\n                                                    sessionInfo,\n                                                    pluginAddedEvent,\n                                                    pluginDeletedEvent,\n                                                    pluginSavedEvent,\n                                                    pluginRenamedEvent,\n                                                    mediaDeletedEvent,\n                                                    defaultFileNameValidator,\n                                                    identity,\n                                                    pluginsFSUtils.getFileSystem(),\n                                                    perspectivesFSUtils.getFileSystem(),\n                                                    saveAndRenameService,\n                                                    spacesAPI) {\n            @Override\n            String getFrameworkScript(Framework framework) throws IOException {\n                return \"script\";\n            }\n\n            @Override\n            IOService getIoService() {\n                return ioService;\n            }\n        });\n\n        pluginServices.init();\n    }\n\n    @Test(expected = PluginAlreadyExists.class)\n    public void testCreateTwoPluginsWithTheSameName() {\n        createPlugin(\"pluginName\",\n                     PluginType.SCREEN,\n                     null);\n        createPlugin(\"pluginName\",\n                     PluginType.EDITOR,\n                     null);\n    }\n\n    @Test\n    public void testListRuntimePluginsOfEmptyScreen() {\n        createPlugin(\"emptyScreen\",\n                     PluginType.SCREEN,\n                     null);\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(1,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"emptyScreen\"));\n    }\n\n    @Test\n    public void testListRuntimePluginsOfScreenWithFramework() {\n        createPlugin(\"angularScreen\",\n                     PluginType.SCREEN,\n                     Framework.ANGULAR);\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(2,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"angularScreen\"));\n    }\n\n    @Test\n    public void testListRuntimePluginsOfMultipleScreens() {\n        createPlugin(\"emptyScreen\",\n                     PluginType.SCREEN,\n                     null);\n        createPlugin(\"angularScreen\",\n                     PluginType.SCREEN,\n                     Framework.ANGULAR);\n        createPlugin(\"knockoutScreen\",\n                     PluginType.SCREEN,\n                     Framework.KNOCKOUT);\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(5,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"emptyScreen\"));\n        assertTrue(contains(runtimePlugins,\n                            \"angularScreen\"));\n        assertTrue(contains(runtimePlugins,\n                            \"knockoutScreen\"));\n    }\n\n    @Test\n    public void testCopyPlugin() {\n        Path pluginPath = createPlugin(\"emptyScreen\",\n                                       PluginType.SCREEN,\n                                       null);\n\n        pluginServices.copy(pluginPath,\n                            \"newEmptyScreen\",\n                            \"\");\n        verify(pluginAddedEvent,\n               times(1)).fire(any(PluginAdded.class));\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(2,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"emptyScreen\"));\n        assertTrue(contains(runtimePlugins,\n                            \"newEmptyScreen\"));\n    }\n\n    @Test\n    public void testCopyPluginToAnotherDirectory() {\n        Path pluginPath = createPlugin(\"emptyScreen\",\n                                       PluginType.SCREEN,\n                                       null);\n\n        Plugin targetPlugin = buildPlugin(\"newEmptyScreen\",\n                                          PluginType.SCREEN,\n                                          null);\n\n        Path targetDir = Paths.convert(Paths.convert(targetPlugin.getPath()).getParent());\n        Path resultPath = pluginServices.copy(pluginPath,\n                                              \"newEmptyScreen\",\n                                              targetDir,\n                                              \"\");\n\n        assertEquals(Paths.convert(resultPath),\n                     Paths.convert(targetPlugin.getPath()));\n        verify(pluginAddedEvent,\n               times(1)).fire(any(PluginAdded.class));\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(2,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"emptyScreen\"));\n        assertTrue(contains(runtimePlugins,\n                            \"newEmptyScreen\"));\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void testCopyPluginAlreadyExists() {\n        Path pluginPath = createPlugin(\"emptyScreen\",\n                                       PluginType.SCREEN,\n                                       null);\n\n        pluginServices.copy(pluginPath,\n                            \"emptyScreen\",\n                            pluginPath,\n                            \"\");\n    }\n\n    @Test\n    public void testRenamePlugin() {\n        Path pluginPath = createPlugin(\"emptyScreen\",\n                                       PluginType.SCREEN,\n                                       null);\n\n        pluginServices.rename(pluginPath,\n                              \"newEmptyScreen\",\n                              \"\");\n        verify(pluginRenamedEvent,\n               times(1)).fire(any(PluginRenamed.class));\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n\n        assertEquals(1,\n                     runtimePlugins.size());\n        assertTrue(contains(runtimePlugins,\n                            \"newEmptyScreen\"));\n    }\n\n    @Test\n    public void testDeletePlugin() {\n        Path pluginPath = createPlugin(\"emptyScreen\",\n                                       PluginType.SCREEN,\n                                       null);\n\n        pluginServices.delete(pluginPath,\n                              \"\");\n        verify(pluginDeletedEvent,\n               times(1)).fire(any(PluginDeleted.class));\n\n        Collection<RuntimePlugin> runtimePlugins = pluginServices.listRuntimePlugins();\n        assertEquals(0,\n                     runtimePlugins.size());\n    }\n\n    @Test\n    public void testLoadEmptyLayout() {\n        Path pluginPath = createPlugin(\"emptyLayout\",\n                                       PluginType.PERSPECTIVE_LAYOUT,\n                                       null);\n\n        LayoutEditorModel layoutEditorModel = pluginServices.getLayoutEditor(pluginPath,\n                                                                             PluginType.PERSPECTIVE_LAYOUT);\n        assertEquals(layoutEditorModel.getName(),\n                     \"emptyLayout\");\n        assertEquals(layoutEditorModel.getPath(),\n                     pluginPath);\n        assertTrue(layoutEditorModel.isEmptyLayout());\n    }\n\n    @Test\n    public void testSimpleSaveWithPluginSimpleContent() {\n\n        final org.uberfire.backend.vfs.Path expected = mock(org.uberfire.backend.vfs.Path.class);\n        final PluginSimpleContent content = mock(PluginSimpleContent.class);\n        final String comment = \"comment\";\n\n        doReturn(expected).when(pluginServices).save(content, comment);\n\n        final Path actual = pluginServices.save((Plugin) content, comment);\n\n        assertEquals(expected, actual);\n    }\n\n    @Test\n    public void testSimpleSaveWithoutPluginSimpleContent() {\n\n        final DynamicMenu content = mock(DynamicMenu.class);\n        final String comment = \"comment\";\n\n        final Path actual = pluginServices.save(content, comment);\n\n        assertNull(actual);\n    }\n\n    @Test\n    public void testSave() {\n\n        final org.uberfire.backend.vfs.Path expected = mock(org.uberfire.backend.vfs.Path.class);\n        final org.uberfire.backend.vfs.Path path = mock(org.uberfire.backend.vfs.Path.class);\n        final DefaultMetadata metadata = mock(DefaultMetadata.class);\n        final PluginSimpleContent content = mock(PluginSimpleContent.class);\n        final String comment = \"comment\";\n\n        doReturn(expected).when(pluginServices).save(content, comment);\n\n        final Path actual = pluginServices.save(path, content, metadata, comment);\n\n        assertEquals(expected, actual);\n    }\n\n    @Test\n    public void testSaveAndRename() {\n\n        final org.uberfire.backend.vfs.Path expected = mock(org.uberfire.backend.vfs.Path.class);\n        final org.uberfire.backend.vfs.Path path = mock(org.uberfire.backend.vfs.Path.class);\n        final String newFileName = \"newFileName\";\n        final DefaultMetadata metadata = mock(DefaultMetadata.class);\n        final PluginSimpleContent content = mock(PluginSimpleContent.class);\n        final String comment = \"comment\";\n\n        doReturn(expected).when(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);\n\n        final Path actual = pluginServices.saveAndRename(path, newFileName, metadata, content, comment);\n\n        assertEquals(expected, actual);\n    }\n\n    @Test\n    public void testGetRootAndGetFileSystem() {\n        assertTrue(pluginServices.getRoot().getFileSystem().getName().equals(pluginsFS.getName()));\n        assertTrue(pluginServices.getFileSystem().getName().equals(pluginsFS.getName()));\n        for (PluginType type : PluginType.values()) {\n            String expected = type == PluginType.PERSPECTIVE_LAYOUT\n                              ? perspectivesFS.getName()\n                              : pluginsFS.getName();\n            assertTrue(pluginServices.getRoot(type).getFileSystem().getName().equals(expected));\n            assertTrue(pluginServices.getFileSystem(type).getName().equals(expected));\n        }\n    }\n\n    @Test\n    public void testCreatePluginsDifferentTypes() {\n        Collection<Plugin> listOfDefaultPlugins = pluginServices.listPlugins();\n        Collection<Plugin> listOfPerspectivesPlugins = pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n        assertEquals(0, listOfDefaultPlugins.size());\n        assertEquals(0, listOfPerspectivesPlugins.size());\n\n        pluginServices.createNewPlugin(\"test\", PluginType.DEFAULT);\n        listOfDefaultPlugins = pluginServices.listPlugins();\n        listOfPerspectivesPlugins = pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n        assertEquals(1, listOfDefaultPlugins.size());\n        assertEquals(0, listOfPerspectivesPlugins.size());\n        assertTrue(listOfDefaultPlugins.iterator().next().getPath().toURI().startsWith(PLUGINS_REPO_PATH));\n\n        pluginServices.createNewPlugin(\"test\", PluginType.PERSPECTIVE_LAYOUT);\n        listOfDefaultPlugins = pluginServices.listPlugins();\n        listOfPerspectivesPlugins = pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT);\n        assertEquals(1, listOfDefaultPlugins.size());\n        assertEquals(1, listOfPerspectivesPlugins.size());\n        assertTrue(listOfDefaultPlugins.iterator().next().getPath().toURI().startsWith(PLUGINS_REPO_PATH));\n        assertTrue(listOfPerspectivesPlugins.iterator().next().getPath().toURI().startsWith(PERSPECTIVES_REPO_PATH));\n    }\n\n    @Test\n    public void testDeletePluginsDifferentTypes() {\n        Plugin defaultPlugin = pluginServices.createNewPlugin(\"test\", PluginType.DEFAULT);\n        assertEquals(1, pluginServices.listPlugins().size());\n        assertEquals(0, pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).size());\n\n        Plugin perspectivePlugin = pluginServices.createNewPlugin(\"test\", PluginType.PERSPECTIVE_LAYOUT);\n        assertEquals(1, pluginServices.listPlugins().size());\n        assertEquals(1, pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).size());\n\n        pluginServices.delete(defaultPlugin.getPath(), \"delete plugin\");\n        assertEquals(0, pluginServices.listPlugins().size());\n        assertEquals(1, pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).size());\n\n        pluginServices.delete(perspectivePlugin.getPath(), \"delete plugin\");\n        assertEquals(0, pluginServices.listPlugins().size());\n        assertEquals(0, pluginServices.listPlugins(PluginType.PERSPECTIVE_LAYOUT).size());\n    }\n\n    private Path createPlugin(String name,\n                              PluginType type,\n                              Framework framework) {\n        pluginServices.createNewPlugin(name,\n                                       type);\n        verify(pluginAddedEvent,\n               times(1)).fire(any(PluginAdded.class));\n        reset(pluginAddedEvent);\n\n        final PluginSimpleContent pluginSimpleContent = buildPlugin(name,\n                                                                    type,\n                                                                    framework);\n        pluginServices.save(pluginSimpleContent,\n                            \"\");\n        verify(pluginSavedEvent,\n               times(1)).fire(any(PluginSaved.class));\n        reset(pluginSavedEvent);\n\n        return pluginSimpleContent.getPath();\n    }\n\n    private PluginSimpleContent buildPlugin(String name,\n                                            PluginType type,\n                                            Framework framework) {\n        Set<Framework> frameworks = new HashSet<Framework>();\n\n        if (framework != null) {\n            frameworks.add(framework);\n        }\n\n        String basePath = type == PluginType.PERSPECTIVE_LAYOUT\n                          ? PERSPECTIVES_PATH\n                          : PLUGINS_PATH;\n\n        String fileName = type.name().toLowerCase() + \".plugin\";\n\n        String fullPath = basePath\n                          + \"/\"\n                          + name\n                          + \"/\"\n                          + fileName;\n\n        return new PluginSimpleContent(name,\n                                       type,\n                                       PathFactory.newPath(fileName, fullPath),\n                                       null,\n                                       null,\n                                       new HashMap<CodeType, String>(),\n                                       frameworks,\n                                       null);\n    }\n\n    private boolean contains(Collection<RuntimePlugin> runtimePlugins,\n                             String pluginName) {\n        for (RuntimePlugin runtimePlugin : runtimePlugins) {\n            if (runtimePlugin.getScript().contains(\"$registerPlugin({id:\\\"\" + pluginName)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/angular_css.txt",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/angular_main.txt",
    "content": "function TodoCtrl($scope) {\n\n    $scope.placeText = \"MiscellaneousFeatures\";\n\n    $scope.todos = [\n        {text: 'learn angular', done: true},\n        {text: 'build an angular app', done: false}\n    ];\n\n    $scope.addTodo = function () {\n        $scope.todos.push({text: $scope.todoText, done: false});\n        $scope.todoText = '';\n    };\n\n    $scope.remaining = function () {\n        var count = 0;\n        angular.forEach($scope.todos, function (todo) {\n            count += todo.done ? 0 : 1;\n        });\n        return count;\n    };\n\n    $scope.archive = function () {\n        var oldTodos = $scope.todos;\n        $scope.todos = [];\n        angular.forEach(oldTodos, function (todo) {\n            if (!todo.done) {\n                $scope.todos.push(todo);\n            }\n        });\n    };\n\n    $scope.goto = function () {\n        $goToPlace($scope.placeText);\n    };\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/angular_template.txt",
    "content": "<div ng-controller=\"TodoCtrl\">\n    <span>{{remaining()}} of {{todos.length}} remaining</span>\n    [ <a href=\"\" ng-click=\"archive()\">archive</a> ]\n    <ul class=\"unstyled\">\n        <li ng-repeat=\"todo in todos\">\n            <input type=\"checkbox\" ng-model=\"todo.done\">\n            <span class=\"done-{{todo.done}}\">{{todo.text}}</span>\n        </li>\n    </ul>\n    <form ng-submit=\"addTodo()\">\n        <input type=\"text\" ng-model=\"todoText\" size=\"30\" placeholder=\"add new todo here\">\n        <input class=\"btn-primary\" type=\"submit\" value=\"add\">\n    </form>\n    <form ng-submit=\"goto()\">\n        <input type=\"text\" ng-model=\"placeText\" size=\"30\" placeholder=\"place to go\">\n        <input class=\"btn-primary\" type=\"submit\" value=\"goTo\">\n    </form>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/angular_todo_registry.txt",
    "content": "function TodoCtrl($scope) {\n\n    $scope.placeText = \"MiscellaneousFeatures\";\n\n    $scope.todos = [\n        {text: 'learn angular', done: true},\n        {text: 'build an angular app', done: false}\n    ];\n\n    $scope.addTodo = function () {\n        $scope.todos.push({text: $scope.todoText, done: false});\n        $scope.todoText = '';\n    };\n\n    $scope.remaining = function () {\n        var count = 0;\n        angular.forEach($scope.todos, function (todo) {\n            count += todo.done ? 0 : 1;\n        });\n        return count;\n    };\n\n    $scope.archive = function () {\n        var oldTodos = $scope.todos;\n        $scope.todos = [];\n        angular.forEach(oldTodos, function (todo) {\n            if (!todo.done) {\n                $scope.todos.push(todo);\n            }\n        });\n    };\n\n    $scope.goto = function () {\n        $goToPlace($scope.placeText);\n    };\n}$registerPlugin({id:\"Yo\",type: \"angularjs\",template: \"\\u003cdiv ng-controller\\u003d\\\"TodoCtrl\\\"\\u003e\\n    \\u003cspan\\u003e{{remaining()}} of {{todos.length}} remaining\\u003c/span\\u003e\\n    [ \\u003ca href\\u003d\\\"\\\" ng-click\\u003d\\\"archive()\\\"\\u003earchive\\u003c/a\\u003e ]\\n    \\u003cul class\\u003d\\\"unstyled\\\"\\u003e\\n        \\u003cli ng-repeat\\u003d\\\"todo in todos\\\"\\u003e\\n            \\u003cinput type\\u003d\\\"checkbox\\\" ng-model\\u003d\\\"todo.done\\\"\\u003e\\n            \\u003cspan class\\u003d\\\"done-{{todo.done}}\\\"\\u003e{{todo.text}}\\u003c/span\\u003e\\n        \\u003c/li\\u003e\\n    \\u003c/ul\\u003e\\n    \\u003cform ng-submit\\u003d\\\"addTodo()\\\"\\u003e\\n        \\u003cinput type\\u003d\\\"text\\\" ng-model\\u003d\\\"todoText\\\" size\\u003d\\\"30\\\" placeholder\\u003d\\\"add new todo here\\\"\\u003e\\n        \\u003cinput class\\u003d\\\"btn-primary\\\" type\\u003d\\\"submit\\\" value\\u003d\\\"add\\\"\\u003e\\n    \\u003c/form\\u003e\\n    \\u003cform ng-submit\\u003d\\\"goto()\\\"\\u003e\\n        \\u003cinput type\\u003d\\\"text\\\" ng-model\\u003d\\\"placeText\\\" size\\u003d\\\"30\\\" placeholder\\u003d\\\"place to go\\\"\\u003e\\n        \\u003cinput class\\u003d\\\"btn-primary\\\" type\\u003d\\\"submit\\\" value\\u003d\\\"goTo\\\"\\u003e\\n    \\u003c/form\\u003e\\n\\u003c/div\\u003e\"});"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/empty_screen_registry.txt",
    "content": "$registerPlugin({id:\"Yo\",template: \"\"});"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/screen_with_title_and_name_registry.txt",
    "content": "alert('main');$registerPlugin({id:\"ScreenWithTitle\",title: function (){return \"My Title\";},template: \"\"});"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/screen_with_title_registry.txt",
    "content": "$registerPlugin({id:\"ScreenWithTitle\",title: function (){return \"My Title\";},template: \"\"});"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/splash_main.txt",
    "content": "alert('main');"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/splash_screen_registry.txt",
    "content": "alert('main');$registerSplashScreen({id:\"Splash\",on_close: function (){alert('main');;},on_concurrent_copy: function (){alert('main');;},title: function (){return \"Title\";},template: \"\\u003ch1\\u003eSplash Screen\\u003c/h1\\u003e\"});"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-backend/src/test/resources/org/uberfire/ext/plugin/backend/splash_template.txt",
    "content": "<h1>Splash Screen</h1>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-runtime-plugins</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-runtime-plugins-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Runtime PlugIns Client</name>\n  <description>Uberfire Runtime PlugIns Client</description>\n\n  <dependencies>\n    <!-- dependencies added because of new illegal transitive dependency check -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-simple-docks-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-bridge</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <!-- Project Dependencies -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-ace</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/RuntimePluginsEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client;\n\nimport java.util.Collection;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport com.google.gwt.dom.client.StyleInjector;\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.PopupActivity;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar;\nimport org.uberfire.ext.plugin.client.resources.WebAppResource;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\n\nimport static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW;\nimport static org.uberfire.workbench.model.ActivityResourceType.EDITOR;\nimport static org.uberfire.workbench.model.ActivityResourceType.PERSPECTIVE;\nimport static org.uberfire.workbench.model.ActivityResourceType.POPUP;\nimport static org.uberfire.workbench.model.ActivityResourceType.SCREEN;\n\n@EntryPoint\n@Bundle(\"resources/i18n/Constants.properties\")\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class RuntimePluginsEntryPoint {\n\n    @Inject\n    private Workbench workbench;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    private WorkbenchMenuBar menubar;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private ActivityManager activityManager;\n\n    @PostConstruct\n    public void init() {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        WebAppResource.INSTANCE.CSS().ensureInjected();\n\n        workbench.addStartupBlocker(RuntimePluginsEntryPoint.class);\n        pluginServices.call(new RemoteCallback<Collection<RuntimePlugin>>() {\n            @Override\n            public void callback(Collection<RuntimePlugin> response) {\n                for (final RuntimePlugin plugin : response) {\n                    ScriptInjector.fromString(plugin.getScript()).setWindow(TOP_WINDOW).inject();\n                    StyleInjector.inject(plugin.getStyle(),\n                                         true);\n                }\n                pluginServices.call(new RemoteCallback<Collection<DynamicMenu>>() {\n                    @Override\n                    public void callback(Collection<DynamicMenu> response) {\n                        for (final DynamicMenu menu : response) {\n                            if (!menu.getMenuItems().isEmpty()) {\n                                MenuFactory.SubMenusBuilder<MenuFactory.SubMenuBuilder<MenuFactory.TopLevelMenusBuilder<MenuFactory.MenuBuilder>>> dynamicMenu = MenuFactory.newTopLevelMenu(menu.getName()).orderAll(100).menus();\n                                for (final DynamicMenuItem dynamicMenuItem : menu.getMenuItems()) {\n\n                                    String activityId = dynamicMenuItem.getActivityId();\n                                    ResourceType resourceType = getResourceType(activityId);\n\n                                    dynamicMenu.menu(dynamicMenuItem.getMenuLabel())\n                                            .withPermission(activityId,\n                                                            resourceType)\n                                            .respondsWith(() -> placeManager.goTo(activityId))\n                                            .endMenu();\n                                }\n                                menubar.addMenus(dynamicMenu.endMenus().endMenu().build());\n                            }\n                        }\n                        workbench.removeStartupBlocker(RuntimePluginsEntryPoint.class);\n                    }\n                }).listDynamicMenus();\n            }\n        }).listRuntimePlugins();\n    }\n\n    public ResourceType getResourceType(String activityId) {\n\n        Activity activity = activityManager.getActivity(new DefaultPlaceRequest(activityId),\n                                                        false);\n        if (activity != null) {\n            if (activity instanceof PerspectiveActivity) {\n                return PERSPECTIVE;\n            }\n            if (activity instanceof WorkbenchScreenActivity) {\n                return SCREEN;\n            }\n            if (activity instanceof WorkbenchEditorActivity) {\n                return EDITOR;\n            }\n            if (activity instanceof SplashScreenActivity) {\n                return EDITOR;\n            }\n            if (activity instanceof PopupActivity) {\n                return POPUP;\n            }\n        }\n        return ResourceType.UNKNOWN;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/code/CodeElement.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.code;\n\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface CodeElement {\n\n    void addNav(final DropDownMenu parent,\n                final Button dropdownButton,\n                final ParameterizedCommand<CodeType> onChange);\n\n    IconType getIcon();\n\n    CodeType getType();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/code/CodeList.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.code;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Divider;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic enum CodeList implements CodeElement {\n\n    MAIN {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(MAIN.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.COGS;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.MAIN;\n        }\n\n        @Override\n        public String toString() {\n            return \"main\";\n        }\n    },\n    ON_OPEN {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_OPEN.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_OPEN;\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_open\";\n        }\n    },\n    ON_FOCUS {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_FOCUS.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_FOCUS;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_focus\";\n        }\n    },\n    ON_LOST_FOCUS {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_LOST_FOCUS.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_LOST_FOCUS;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_lost_focus\";\n        }\n    },\n    ON_MAY_CLOSE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_MAY_CLOSE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_MAY_CLOSE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_may_close\";\n        }\n    },\n    ON_CLOSE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_CLOSE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_CLOSE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_close\";\n        }\n    },\n    ON_STARTUP {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_STARTUP.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_STARTUP;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_startup\";\n        }\n    },\n    ON_SHUTDOWN {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_SHUTDOWN.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_SHUTDOWN;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_shutdown\";\n        }\n    },\n    ON_CONCURRENT_UPDATE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_CONCURRENT_UPDATE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_CONCURRENT_UPDATE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_concurrent_update\";\n        }\n    },\n    ON_CONCURRENT_DELETE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_CONCURRENT_DELETE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_CONCURRENT_DELETE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_concurrent_delete\";\n        }\n    },\n    ON_CONCURRENT_RENAME {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_CONCURRENT_RENAME.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_CONCURRENT_RENAME;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_concurrent_rename\";\n        }\n    },\n    ON_CONCURRENT_COPY {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_CONCURRENT_COPY.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_CONCURRENT_COPY;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_concurrent_copy\";\n        }\n    },\n    ON_RENAME {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_RENAME.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_RENAME;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_rename\";\n        }\n    },\n    ON_DELETE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_DELETE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_DELETE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_delete\";\n        }\n    },\n    ON_COPY {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_COPY.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_COPY;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_copy\";\n        }\n    },\n    ON_UPDATE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(ON_UPDATE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.BOLT;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.ON_UPDATE;\n        }\n\n        @Override\n        public String toString() {\n            return \"on_update\";\n        }\n    },\n    TITLE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(TITLE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.TH_LIST;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.TITLE;\n        }\n\n        @Override\n        public String toString() {\n            return \"title\";\n        }\n    },\n    RESOURCE_TYPE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(RESOURCE_TYPE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.TH_LIST;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.RESOURCE_TYPE;\n        }\n\n        @Override\n        public String toString() {\n            return \"resource_type\";\n        }\n    },\n    BODY_HEIGHT {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(BODY_HEIGHT.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.TH_LIST;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.BODY_HEIGHT;\n        }\n\n        @Override\n        public String toString() {\n            return \"body_height\";\n        }\n    },\n    INTERCEPTION_POINTS {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(INTERCEPTION_POINTS.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.TH_LIST;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.INTERCEPTION_POINTS;\n        }\n\n        @Override\n        public String toString() {\n            return \"interception_points\";\n        }\n    },\n    PANEL_TYPE {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new AnchorListItem(toString()) {{\n                setIcon(getIcon());\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        onChange.execute(getType());\n                        dropdownButton.setText(PANEL_TYPE.toString());\n                        dropdownButton.setIcon(getIcon());\n                    }\n                });\n            }});\n        }\n\n        @Override\n        public IconType getIcon() {\n            return IconType.TH_LIST;\n        }\n\n        @Override\n        public CodeType getType() {\n            return CodeType.PANEL_TYPE;\n        }\n\n        @Override\n        public String toString() {\n            return \"panel_type\";\n        }\n    },\n    DIVIDER {\n        @Override\n        public void addNav(final DropDownMenu parent,\n                           final Button dropdownButton,\n                           final ParameterizedCommand<CodeType> onChange) {\n            parent.add(new Divider());\n        }\n\n        @Override\n        public IconType getIcon() {\n            return null;\n        }\n\n        @Override\n        public CodeType getType() {\n            return null;\n        }\n    };\n\n    public static CodeList convert(final CodeType codeType) {\n        return CodeList.valueOf(codeType.toString().toUpperCase());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/config/PluginConfigService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.config;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.ext.plugin.service.PluginServices;\n\n@EntryPoint\npublic class PluginConfigService {\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    private String mediaServletURI;\n\n    @PostConstruct\n    public void init() {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        pluginServices.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(final String response) {\n                mediaServletURI = response;\n            }\n        }).getMediaServletURI();\n    }\n\n    public String getMediaServletURI() {\n        return mediaServletURI;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/DynamicMenuEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.ListDataProvider;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.type.DynamicMenuResourceType;\nimport org.uberfire.ext.plugin.client.validation.NameValidator;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.client.validation.RuleValidator;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\n@Dependent\n@WorkbenchEditor(identifier = \"Dynamic Menu Editor\", supportedTypes = {DynamicMenuResourceType.class}, priority = Integer.MAX_VALUE)\npublic class DynamicMenuEditorPresenter\n        extends BaseEditor<Plugin, DefaultMetadata> {\n\n    @Inject\n    private DynamicMenuResourceType resourceType;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    private Event<NotificationEvent> notification;\n\n    @Inject\n    private ActivityBeansCache activityBeansCache;\n\n    @Inject\n    private PluginNameValidator pluginNameValidator;\n\n    @Inject\n    private SavePopUpPresenter savePopUpPresenter;\n\n    private ListDataProvider<DynamicMenuItem> dataProvider = new ListDataProvider<>();\n\n    private DynamicMenu menuItem;\n\n    private Plugin plugin;\n\n    @Inject\n    public DynamicMenuEditorPresenter(final View baseView) {\n        super(baseView);\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        init(path,\n             place,\n             resourceType,\n             true,\n             false,\n             SAVE,\n             COPY,\n             RENAME,\n             DELETE);\n\n        // This is only used to define the \"name\" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup\n        // but before the async call in \"loadContent()\" has returned. When the *real* plugin is loaded this is overwritten\n        this.plugin = new Plugin(place.getParameter(\"name\",\n                                                    \"\"),\n                                 PluginType.DYNAMIC_MENU,\n                                 path);\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return CommonConstants.INSTANCE.DynamicMenuEditor() + \" [\" + plugin.getName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) {\n        if (pluginRenamed.getOldPluginName().equals(plugin.getName()) &&\n                pluginRenamed.getPlugin().getType().equals(plugin.getType())) {\n            plugin = new Plugin(pluginRenamed.getPlugin().getName(),\n                                PluginType.DYNAMIC_MENU,\n                                pluginRenamed.getPlugin().getPath());\n            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place,\n                                                                    getTitleText(),\n                                                                    getTitle()));\n        }\n    }\n\n    public RuleValidator getMenuItemActivityIdValidator() {\n        return NameValidator.createNameValidator(getView().emptyActivityID(),\n                                                 getView().invalidActivityID());\n    }\n\n    public RuleValidator getMenuItemLabelValidator(final DynamicMenuItem menuItem,\n                                                   final DynamicMenuItem editedMenuItem) {\n        return new RuleValidator() {\n\n            private String error;\n\n            private NameValidator menuLabelValidator = NameValidator.createNameValidator(getView().emptyMenuLabel(),\n                                                                                         getView().invalidMenuLabel());\n\n            @Override\n            public boolean isValid(final String value) {\n                if (!menuLabelValidator.isValid(value)) {\n                    this.error = menuLabelValidator.getValidationError();\n                    return false;\n                }\n\n                DynamicMenuItem existingItem = getExistingMenuItem(menuItem,\n                                                                   editedMenuItem);\n\n                if (existingItem != null) {\n                    this.error = getView().duplicatedMenuLabel();\n                    return false;\n                }\n\n                this.error = null;\n                return true;\n            }\n\n            @Override\n            public String getValidationError() {\n                return this.error;\n            }\n        };\n    }\n\n    public void addMenuItem(final DynamicMenuItem menuItem) {\n        DynamicMenuItem existingItem = getExistingMenuItem(menuItem,\n                                                           null);\n        if (existingItem == null) {\n            getDynamicMenuItems().add(menuItem);\n        } else {\n            //No need to re-select edited item as DynamicMenuEditorView resets itself after *any* edit\n            dataProvider.refresh();\n        }\n\n        dataProvider.flush();\n    }\n\n    public DynamicMenuItem getExistingMenuItem(final DynamicMenuItem currentMenuItem,\n                                               final DynamicMenuItem editedMenuItem) {\n        DynamicMenuItem existingItem = null;\n\n        for (final DynamicMenuItem item : getDynamicMenuItems()) {\n            if (editedMenuItem != item && currentMenuItem.getMenuLabel().equals(item.getMenuLabel())) {\n                existingItem = item;\n                break;\n            }\n        }\n\n        return existingItem;\n    }\n\n    public void removeObject(DynamicMenuItem object) {\n        getDynamicMenuItems().remove(object);\n    }\n\n    public void updateIndex(final DynamicMenuItem object,\n                            final int index,\n                            final UpdateIndexOperation operation) {\n        if (index < 0) {\n            return;\n        }\n\n        final int newIndex = operation.equals(UpdateIndexOperation.UP) ? index - 1 : index + 1;\n\n        if (newIndex < 0 || newIndex >= getDynamicMenuItems().size()) {\n            return;\n        }\n\n        final DynamicMenuItem oldItem = getDynamicMenuItems().set(newIndex,\n                                                                  object);\n        if (oldItem != null) {\n            getDynamicMenuItems().set(index,\n                                      oldItem);\n        }\n    }\n\n    public void setDataDisplay(final HasData<DynamicMenuItem> display) {\n        dataProvider.addDataDisplay(display);\n    }\n\n    @Override\n    protected void loadContent() {\n        getPluginServices().call(new RemoteCallback<DynamicMenu>() {\n\n            @Override\n            public void callback(final DynamicMenu response) {\n                setOriginalHash(response.hashCode());\n                menuItem = response;\n                getDynamicMenuItems().clear();\n                for (final DynamicMenuItem menuItem : response.getMenuItems()) {\n                    getDynamicMenuItems().add(menuItem);\n                }\n                baseView.hideBusyIndicator();\n            }\n        }).getDynamicMenuContent(getVersionRecordManager().getCurrentPath());\n    }\n\n    @Override\n    protected Supplier<Plugin> getContentSupplier() {\n        return this::getContent;\n    }\n\n    Caller<PluginServices> getPluginServices() {\n        return pluginServices;\n    }\n\n    protected Command onValidate() {\n        return new Command() {\n\n            @Override\n            public void execute() {\n                final Collection<String> invalidActivities = new HashSet<String>();\n                for (final DynamicMenuItem dynamicMenuItem : getDynamicMenuItems()) {\n                    if (activityBeansCache.getActivity(dynamicMenuItem.getActivityId()) == null) {\n                        invalidActivities.add(dynamicMenuItem.getActivityId());\n                    }\n                }\n                if (invalidActivities.isEmpty()) {\n                    notification.fire(new NotificationEvent(\"Item Validated Successfully\",\n                                                            NotificationEvent.NotificationType.SUCCESS));\n                } else {\n                    notification.fire(new NotificationEvent(\"Activity(ies) not found: '\" + DynamicMenuEditorPresenter.this.toString(invalidActivities) + \"'\",\n                                                            NotificationEvent.NotificationType.ERROR));\n                }\n            }\n        };\n    }\n\n    private String toString(final Collection<String> invalidActivities) {\n        StringBuilder result = new StringBuilder();\n        for (final String string : invalidActivities) {\n            result.append(string).append(\",\");\n        }\n        return result.length() > 0 ? result.substring(\n                0,\n                result.length() - 1) : \"\";\n    }\n\n    protected void save() {\n        savePopUpPresenter.show(versionRecordManager.getCurrentPath(),\n                                new ParameterizedCommand<String>() {\n\n                                    @Override\n                                    public void execute(final String commitMessage) {\n                                        getPluginServices().call(getSaveSuccessCallback(getContent().hashCode())).saveMenu(\n                                                getContent(),\n                                                commitMessage);\n                                    }\n                                }\n        );\n        concurrentUpdateSessionInfo = null;\n    }\n\n    @WorkbenchPartView\n    public UberView<DynamicMenuEditorPresenter> getWidget() {\n        return (UberView<DynamicMenuEditorPresenter>) super.baseView;\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose(getContent().hashCode());\n    }\n\n    public DynamicMenu getContent() {\n        return new DynamicMenu(menuItem.getName(),\n                               PluginType.DYNAMIC_MENU,\n                               versionRecordManager.getCurrentPath(),\n                               new ArrayList<>(getDynamicMenuItems()));\n    }\n\n    @Override\n    public Validator getRenameValidator() {\n        return pluginNameValidator;\n    }\n\n    @Override\n    public Validator getCopyValidator() {\n        return pluginNameValidator;\n    }\n\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return getPluginServices();\n    }\n\n    protected Caller<? extends SupportsSaveAndRename<Plugin, DefaultMetadata>> getSaveAndRenameServiceCaller() {\n        return getPluginServices();\n    }\n\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return getPluginServices();\n    }\n\n    public View getView() {\n        return (View) super.baseView;\n    }\n\n    protected List<DynamicMenuItem> getDynamicMenuItems() {\n        return dataProvider.getList();\n    }\n\n    enum UpdateIndexOperation {\n        UP,\n        DOWN;\n    }\n\n    public interface View extends UberView<DynamicMenuEditorPresenter>,\n                                  BaseEditorView {\n\n        String emptyActivityID();\n\n        String invalidActivityID();\n\n        String emptyMenuLabel();\n\n        String invalidMenuLabel();\n\n        String duplicatedMenuLabel();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/DynamicMenuEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.SimpleBeanEditorDriver;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.cellview.client.AbstractCellTable;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.HasKeyboardSelectionPolicy;\nimport com.google.gwt.user.cellview.client.TextColumn;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.DefaultSelectionEventManager;\nimport com.google.gwt.view.client.ProvidesKey;\nimport com.google.gwt.view.client.SelectionChangeEvent;\nimport com.google.gwt.view.client.SelectionChangeEvent.Handler;\nimport com.google.gwt.view.client.SingleSelectionModel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.gwtbootstrap3.client.ui.gwt.CellTable;\nimport org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.widget.cell.IconCell;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\n\n@Dependent\npublic class DynamicMenuEditorView\n        extends BaseEditorViewImpl\n        implements DynamicMenuEditorPresenter.View,\n                   Editor<DynamicMenuItem> {\n\n    private static final ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    private final Driver driver = GWT.create(Driver.class);\n    //SelectionModel works better with a KeyProvider\n    private final ProvidesKey<DynamicMenuItem> keyProvider = new ProvidesKey<DynamicMenuItem>() {\n        @Override\n        public Object getKey(final DynamicMenuItem item) {\n            return item.getActivityId() + item.getMenuLabel();\n        }\n    };\n    private final SingleSelectionModel<DynamicMenuItem> selectionModel = new SingleSelectionModel<DynamicMenuItem>(keyProvider);\n    @UiField\n    TextBox activityId;\n\n    @UiField\n    FormGroup activityIdControlGroup;\n\n    @UiField\n    @Ignore\n    HelpBlock activityIdHelpInline;\n\n    @UiField\n    TextBox menuLabel;\n\n    @UiField\n    FormGroup menuLabelControlGroup;\n\n    @UiField\n    @Ignore\n    HelpBlock menuLabelHelpInline;\n    @UiField(provided = true)\n    CellTable<DynamicMenuItem> menuItems = new CellTable<DynamicMenuItem>(500,\n                                                                          GWT.<CellTable.Resources>create(CellTable.Resources.class),\n                                                                          keyProvider,\n                                                                          null);\n    @UiField\n    Button okButton;\n    @UiField\n    Button cancelButton;\n    private DynamicMenuEditorPresenter presenter;\n    private DynamicMenuItem editedItem;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n        this.editedItem = null;\n    }\n\n    @Override\n    public void init(final DynamicMenuEditorPresenter presenter) {\n        this.presenter = presenter;\n\n        driver.initialize(this);\n\n        setMenuItem(new DynamicMenuItem());\n\n        initTable(menuItems);\n    }\n\n    private void initTable(final AbstractCellTable<DynamicMenuItem> dynamicMenuTable) {\n        dynamicMenuTable.setEmptyTableWidget(new Label(CommonConstants.INSTANCE.MenusNoMenuItems()));\n\n        //We need to inform the SelectionModel that the ButtonCell (i.e. Delete) column is excluded from selecting a row\n        final DefaultSelectionEventManager<DynamicMenuItem> manager = DefaultSelectionEventManager.createBlacklistManager(4);\n        dynamicMenuTable.setSelectionModel(selectionModel,\n                                           manager);\n\n        //Furthermore we cannot have a KeyboardSelectionPolicy with a ButtonCell and a SelectionModel\n        dynamicMenuTable.setKeyboardSelectionPolicy(HasKeyboardSelectionPolicy.KeyboardSelectionPolicy.DISABLED);\n\n        {\n            final IconCell iCell = new IconCell(IconType.ARROW_UP);\n            iCell.setTooltip(CommonConstants.INSTANCE.MenusMoveUpHint());\n\n            final Column<DynamicMenuItem, String> iconColumn = new Column<DynamicMenuItem, String>(iCell) {\n                public String getValue(DynamicMenuItem object) {\n                    return \"\";\n                }\n            };\n\n            iconColumn.setFieldUpdater(new FieldUpdater<DynamicMenuItem, String>() {\n                @Override\n                public void update(final int index,\n                                   final DynamicMenuItem object,\n                                   final String value) {\n                    presenter.updateIndex(object,\n                                          index,\n                                          DynamicMenuEditorPresenter.UpdateIndexOperation.UP);\n                }\n            });\n\n            dynamicMenuTable.addColumn(iconColumn);\n            dynamicMenuTable.setColumnWidth(iconColumn,\n                                            \"25px\");\n        }\n\n        {\n            final IconCell iCell = new IconCell(IconType.ARROW_DOWN);\n            iCell.setTooltip(CommonConstants.INSTANCE.MenusMoveDownHint());\n\n            final Column<DynamicMenuItem, String> iconColumn = new Column<DynamicMenuItem, String>(iCell) {\n                public String getValue(DynamicMenuItem object) {\n                    return \"\";\n                }\n            };\n\n            iconColumn.setFieldUpdater(new FieldUpdater<DynamicMenuItem, String>() {\n                @Override\n                public void update(final int index,\n                                   final DynamicMenuItem object,\n                                   final String value) {\n                    presenter.updateIndex(object,\n                                          index,\n                                          DynamicMenuEditorPresenter.UpdateIndexOperation.DOWN);\n                }\n            });\n\n            dynamicMenuTable.addColumn(iconColumn);\n            dynamicMenuTable.setColumnWidth(iconColumn,\n                                            \"25px\");\n        }\n\n        {\n            final TextColumn<DynamicMenuItem> activityCol = new TextColumn<DynamicMenuItem>() {\n\n                @Override\n                public String getValue(DynamicMenuItem object) {\n                    return String.valueOf(object.getActivityId());\n                }\n            };\n\n            dynamicMenuTable.addColumn(activityCol,\n                                       CommonConstants.INSTANCE.MenusActivityID());\n        }\n\n        {\n            final TextColumn<DynamicMenuItem> labelCol = new TextColumn<DynamicMenuItem>() {\n\n                @Override\n                public String getValue(DynamicMenuItem object) {\n                    return object.getMenuLabel();\n                }\n            };\n\n            dynamicMenuTable.addColumn(labelCol,\n                                       CommonConstants.INSTANCE.MenusLabel());\n        }\n\n        {\n            final ButtonCell buttonCell = new ButtonCell(IconType.REMOVE,\n                                                         ButtonType.DANGER,\n                                                         ButtonSize.EXTRA_SMALL);\n\n            final Column<DynamicMenuItem, String> buttonCol = new Column<DynamicMenuItem, String>(buttonCell) {\n                @Override\n                public String getValue(DynamicMenuItem object) {\n                    return CommonConstants.INSTANCE.MenusDelete();\n                }\n            };\n\n            buttonCol.setFieldUpdater(new FieldUpdater<DynamicMenuItem, String>() {\n                @Override\n                public void update(final int index,\n                                   final DynamicMenuItem object,\n                                   final String value) {\n                    if (selectionModel.isSelected(object)) {\n                        selectionModel.clear();\n                    }\n                    presenter.removeObject(object);\n                }\n            });\n\n            dynamicMenuTable.addColumn(buttonCol);\n            dynamicMenuTable.setColumnWidth(buttonCol,\n                                            \"80px\");\n        }\n\n        selectionModel.addSelectionChangeHandler(new Handler() {\n\n            @Override\n            public void onSelectionChange(SelectionChangeEvent event) {\n                //ListDataProvider raises this event with a null item when a item is removed\n                if (selectionModel.getSelectedObject() == null) {\n                    editedItem = null;\n                    setMenuItem(new DynamicMenuItem());\n                } else {\n                    editedItem = selectionModel.getSelectedObject();\n                    setMenuItem(new DynamicMenuItem(selectionModel.getSelectedObject().getActivityId(),\n                                                    selectionModel.getSelectedObject().getMenuLabel()));\n                }\n            }\n        });\n\n        presenter.setDataDisplay(dynamicMenuTable);\n    }\n\n    @UiHandler(\"okButton\")\n    public void onClick(ClickEvent e) {\n        DynamicMenuItem menuItem = driver.flush();\n\n        if (isMenuItemValid(menuItem)) {\n            if (editedItem != null) {\n                editedItem.setActivityId(menuItem.getActivityId());\n                editedItem.setMenuLabel(menuItem.getMenuLabel());\n                menuItem = editedItem;\n            }\n            presenter.addMenuItem(menuItem);\n            setMenuItem(new DynamicMenuItem());\n            selectionModel.clear();\n        }\n    }\n\n    @UiHandler(\"cancelButton\")\n    public void onCancel(ClickEvent e) {\n        setMenuItem(new DynamicMenuItem());\n        selectionModel.clear();\n    }\n\n    private boolean isMenuItemValid(final DynamicMenuItem menuItem) {\n        boolean activityIdValidatorResult = presenter.getMenuItemActivityIdValidator().validateFieldInline(menuItem.getActivityId(),\n                                                                                                           activityIdControlGroup,\n                                                                                                           activityIdHelpInline);\n        boolean menuLabelValidatorResult = presenter.getMenuItemLabelValidator(menuItem,\n                                                                               editedItem).validateFieldInline(menuItem.getMenuLabel(),\n                                                                                                               menuLabelControlGroup,\n                                                                                                               menuLabelHelpInline);\n\n        return activityIdValidatorResult && menuLabelValidatorResult;\n    }\n\n    public void setMenuItem(final DynamicMenuItem menuItem) {\n        driver.edit(menuItem);\n\n        activityIdControlGroup.setValidationState(ValidationState.NONE);\n        activityIdHelpInline.setText(\"\");\n\n        menuLabelControlGroup.setValidationState(ValidationState.NONE);\n        menuLabelHelpInline.setText(\"\");\n    }\n\n    public String emptyActivityID() {\n        return CommonConstants.INSTANCE.EmptyActivityID();\n    }\n\n    public String invalidActivityID() {\n        return CommonConstants.INSTANCE.InvalidActivityID();\n    }\n\n    public String emptyMenuLabel() {\n        return CommonConstants.INSTANCE.EmptyMenuLabel();\n    }\n\n    public String invalidMenuLabel() {\n        return CommonConstants.INSTANCE.InvalidMenuLabel();\n    }\n\n    public String duplicatedMenuLabel() {\n        return CommonConstants.INSTANCE.DuplicatedMenuLabel();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, DynamicMenuEditorView> {\n\n    }\n\n    interface Driver extends SimpleBeanEditorDriver<DynamicMenuItem, DynamicMenuEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/DynamicMenuEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .content {\n      margin: 20px 20px;\n    }\n\n    .small {\n      font-size: 12px;\n    }\n\n    .required {\n      color: red;\n      margin-right: 3px;\n    }\n  </ui:style>\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.plugin.client.resources.i18n.CommonConstants\"/>\n\n  <g:HTMLPanel addStyleNames=\"{style.content}\">\n    <b:Row>\n      <b:Column size=\"MD_6\">\n        <b:FieldSet>\n          <b:Legend text=\"{i18n.MenuItem}\" />\n          <b:FormGroup ui:field=\"activityIdControlGroup\">\n            <g:InlineLabel addStyleNames=\"{style.required}\">*</g:InlineLabel>\n            <b:FormLabel for=\"activityId\" text=\"{i18n.ActivityId}\" />\n            <b:TextBox b:id=\"activityId\"\n                       ui:field=\"activityId\" placeholder=\"{i18n.ActivityId}\"/>\n            <b:HelpBlock ui:field=\"activityIdHelpInline\"/>\n          </b:FormGroup>\n          <b:FormGroup ui:field=\"menuLabelControlGroup\">\n            <g:InlineLabel addStyleNames=\"{style.required}\">*</g:InlineLabel>\n            <b:FormLabel for=\"menuLabel\" text=\"{i18n.MenuLabel}\" />\n            <b:TextBox b:id=\"menuLabel\"\n                       ui:field=\"menuLabel\" placeholder=\"{i18n.MenuLabel}\"/>\n            <b:HelpBlock ui:field=\"menuLabelHelpInline\"/>\n          </b:FormGroup>\n          <b:FormGroup>\n            <b:Button ui:field=\"okButton\" text=\"{i18n.Ok}\" />\n            <b:Button ui:field=\"cancelButton\" text=\"{i18n.Cancel}\" />\n          </b:FormGroup>\n        </b:FieldSet>\n      </b:Column>\n      <b:Column size=\"MD_6\">\n        <bg:CellTable ui:field=\"menuItems\"\n                      bordered=\"true\" condensed=\"true\"/>\n      </b:Column>\n    </b:Row>\n  </g:HTMLPanel>\n</ui:UiBinder>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/EditorPlugInEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.type.EditorPluginResourceType;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchEditor(identifier = \"Editor PlugIn Editor\", supportedTypes = {EditorPluginResourceType.class}, priority = Integer.MAX_VALUE)\npublic class EditorPlugInEditorPresenter\n        extends RuntimePluginBaseEditor {\n\n    @Inject\n    private EditorPluginResourceType resourceType;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    public EditorPlugInEditorPresenter(final EditorPlugInEditorView baseView) {\n        super(baseView);\n    }\n\n    protected ClientResourceType getResourceType() {\n        return resourceType;\n    }\n\n    protected PluginType getPluginType() {\n        return PluginType.EDITOR;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return CommonConstants.INSTANCE.EditorPluginEditor() + \" [\" + this.plugin.getName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return super.baseView;\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose();\n    }\n\n    @Override\n    EditorPlugInEditorView view() {\n        return (EditorPlugInEditorView) baseView;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/EditorPlugInEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.ext.plugin.model.Framework;\n\nimport static org.uberfire.ext.plugin.client.code.CodeList.DIVIDER;\nimport static org.uberfire.ext.plugin.client.code.CodeList.MAIN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CLOSE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CONCURRENT_COPY;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CONCURRENT_DELETE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CONCURRENT_RENAME;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CONCURRENT_UPDATE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_COPY;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_DELETE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_FOCUS;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_LOST_FOCUS;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_MAY_CLOSE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_OPEN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_RENAME;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_SHUTDOWN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_STARTUP;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_UPDATE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.RESOURCE_TYPE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.TITLE;\n\n@Dependent\npublic class EditorPlugInEditorView\n        extends RuntimePluginBaseView\n        implements RequiresResize {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel htmlPanel;\n    @UiField\n    FlowPanel formArea;\n    @UiField\n    ListBox framework;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        editor.setup(MAIN,\n                     DIVIDER,\n                     ON_OPEN,\n                     ON_CLOSE,\n                     ON_FOCUS,\n                     ON_LOST_FOCUS,\n                     ON_MAY_CLOSE,\n                     ON_STARTUP,\n                     ON_SHUTDOWN,\n                     ON_CONCURRENT_UPDATE,\n                     ON_CONCURRENT_DELETE,\n                     ON_CONCURRENT_RENAME,\n                     ON_CONCURRENT_COPY,\n                     ON_UPDATE,\n                     ON_DELETE,\n                     ON_RENAME,\n                     ON_COPY\n                ,\n                     DIVIDER,\n                     TITLE,\n                     RESOURCE_TYPE);\n        htmlPanel.add(editor);\n    }\n\n    @Override\n    protected void setFramework(final Collection<Framework> frameworks) {\n        if (frameworks != null && !frameworks.isEmpty()) {\n            final Framework framework = frameworks.iterator().next();\n            for (int i = 0; i < this.framework.getItemCount(); i++) {\n                if (this.framework.getItemText(i).equalsIgnoreCase(framework.toString())) {\n                    this.framework.setSelectedIndex(i);\n                    return;\n                }\n            }\n        }\n        framework.setSelectedIndex(0);\n    }\n\n    @Override\n    protected Collection<Framework> getFrameworks() {\n        if (framework.getSelectedValue().equalsIgnoreCase(\"(Framework)\")) {\n            return Collections.emptyList();\n        }\n        return new ArrayList<Framework>() {{\n            add(Framework.valueOf(framework.getSelectedValue().toUpperCase()));\n        }};\n    }\n\n    @Override\n    public void onResize() {\n        htmlPanel.setHeight(getParent().getParent().getOffsetHeight() + \"px\");\n        editor.onResize();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, EditorPlugInEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/EditorPlugInEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:style>\n    .block {\n      padding-top: 20px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"htmlPanel\">\n    <g:FlowPanel addStyleNames=\"{style.block}\" ui:field=\"formArea\">\n      <b:FieldSet>\n        <b:Container fluid=\"true\">\n          <b:Row>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"frameworkGroup\">\n                <b:ListBox ui:field=\"framework\" selectedIndex=\"0\">\n                  <g:item>(Framework)</g:item>\n                  <g:item>Angular</g:item>\n                  <g:item>Knockout</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"languageGroup\">\n                <b:ListBox ui:field=\"language\" selectedIndex=\"0\">\n                  <g:item>JavaScript</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n          </b:Row>\n        </b:Container>\n      </b:FieldSet>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/RuntimePluginBaseEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.Collection;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport com.google.gwt.dom.client.StyleInjector;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\nimport org.uberfire.ext.editor.commons.client.file.popups.SavePopUpPresenter;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.event.NewPluginRegistered;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.event.PluginUnregistered;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.model.RuntimePlugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\npublic abstract class RuntimePluginBaseEditor extends BaseEditor<Plugin, DefaultMetadata> {\n\n    protected Plugin plugin;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    private PluginNameValidator pluginNameValidator;\n\n    @Inject\n    private Event<NewPluginRegistered> newPluginRegisteredEvent;\n\n    @Inject\n    private Event<PluginUnregistered> pluginUnregisteredEvent;\n\n    @Inject\n    private SavePopUpPresenter savePopUpPresenter;\n\n    public RuntimePluginBaseEditor() {\n        // Zero-parameter constructor for CDI proxies\n    }\n\n    protected RuntimePluginBaseEditor(final BaseEditorView baseView) {\n        super(baseView);\n    }\n\n    protected abstract PluginType getPluginType();\n\n    protected abstract ClientResourceType getResourceType();\n\n    @Override\n    protected Supplier<Plugin> getContentSupplier() {\n        return this::getContent;\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        init(path,\n             place,\n             getResourceType(),\n             true,\n             false,\n             SAVE,\n             COPY,\n             RENAME,\n             DELETE);\n\n        // This is only used to define the \"name\" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup\n        // but before the async call in \"loadContent()\" has returned. When the *real* plugin is loaded this is overwritten\n        this.plugin = new Plugin(place.getParameter(\"name\",\n                                                    \"\"),\n                                 getPluginType(),\n                                 path);\n\n        this.place = place;\n    }\n\n    protected void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) {\n        if (pluginRenamed.getOldPluginName().equals(plugin.getName()) &&\n                pluginRenamed.getPlugin().getType().equals(plugin.getType())) {\n            this.plugin = new Plugin(pluginRenamed.getPlugin().getName(),\n                                     getPluginType(),\n                                     pluginRenamed.getPlugin().getPath());\n            changeTitleNotification.fire(new ChangeTitleWidgetEvent(place,\n                                                                    getTitleText(),\n                                                                    getTitle()));\n        }\n    }\n\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return pluginServices;\n    }\n\n    protected Caller<? extends SupportsSaveAndRename<Plugin, DefaultMetadata>> getSaveAndRenameServiceCaller() {\n        return getPluginServices();\n    }\n\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return pluginServices;\n    }\n\n    @Override\n    protected void loadContent() {\n        getPluginServices().call(new RemoteCallback<PluginContent>() {\n\n            @Override\n            public void callback(final PluginContent response) {\n                view().setFramework(response.getFrameworks());\n                view().setupContent(response,\n                                    new ParameterizedCommand<Media>() {\n\n                                        @Override\n                                        public void execute(final Media media) {\n                                            getPluginServices().call().deleteMedia(media);\n                                        }\n                                    });\n                view().hideBusyIndicator();\n                setOriginalHash(getContent().hashCode());\n            }\n        }).getPluginContent(getCurrentPath());\n    }\n\n    ObservablePath getCurrentPath() {\n        return versionRecordManager.getCurrentPath();\n    }\n\n    public Plugin getContent() {\n        return new PluginSimpleContent(view().getContent(),\n                                       view().getTemplate(),\n                                       view().getCss(),\n                                       view().getCodeMap(),\n                                       view().getFrameworks(),\n                                       view().getContent().getLanguage());\n    }\n\n    protected void save() {\n        savePopUpPresenter.show(getCurrentPath(),\n                                getSaveCommand());\n        concurrentUpdateSessionInfo = null;\n    }\n\n    ParameterizedCommand<String> getSaveCommand() {\n        return new ParameterizedCommand<String>() {\n            @Override\n            public void execute(final String commitMessage) {\n                getPluginServices().call(getSaveSuccessCallback(getContent().hashCode())).save(\n                        getContent(),\n                        commitMessage);\n                view().onSave();\n            }\n        };\n    }\n\n    public boolean mayClose() {\n        view().onClose();\n        return super.mayClose(getContent().hashCode());\n    }\n\n    abstract RuntimePluginBaseView view();\n\n    Caller<PluginServices> getPluginServices() {\n        return pluginServices;\n    }\n\n    Integer getOriginalHash() {\n        return originalHash;\n    }\n\n    @Override\n    public Validator getRenameValidator() {\n        return pluginNameValidator;\n    }\n\n    @Override\n    public Validator getCopyValidator() {\n        return pluginNameValidator;\n    }\n\n    public void onPluginSaved(@Observes PluginSaved pluginSaved) {\n        registerPlugin(pluginSaved.getPlugin());\n    }\n\n    public void onPluginAdded(@Observes PluginAdded pluginAdded) {\n        registerPlugin(pluginAdded.getPlugin());\n    }\n\n    public void onPluginDeleted(@Observes PluginDeleted pluginDeleted) {\n        unregisterPlugin(pluginDeleted.getPluginName(),\n                         pluginDeleted.getPluginType());\n    }\n\n    public void onPluginRenamed(@Observes PluginRenamed pluginRenamed) {\n        unregisterPlugin(pluginRenamed.getOldPluginName(),\n                         pluginRenamed.getOldPluginType());\n        registerPlugin(pluginRenamed.getPlugin());\n    }\n\n    void unregisterPlugin(String name,\n                          PluginType type) {\n        pluginUnregisteredEvent.fire(new PluginUnregistered(name,\n                                                            type));\n    }\n\n    void registerPlugin(Plugin plugin) {\n\n        pluginServices.call(new RemoteCallback<Collection<RuntimePlugin>>() {\n\n            @Override\n            public void callback(final Collection<RuntimePlugin> runtimePlugins) {\n                for (final RuntimePlugin plugin : runtimePlugins) {\n                    ScriptInjector.fromString(plugin.getScript()).setWindow(TOP_WINDOW).inject();\n                    StyleInjector.inject(plugin.getStyle(),\n                                         true);\n                }\n                newPluginRegisteredEvent.fire(new NewPluginRegistered(plugin.getName(),\n                                                                      plugin.getType()));\n            }\n        }).listPluginRuntimePlugins(plugin.getPath());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/RuntimePluginBaseView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.Collection;\nimport java.util.Map;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;\nimport org.uberfire.ext.plugin.client.widget.plugin.GeneralPluginEditor;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.Framework;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginSimpleContent;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic abstract class RuntimePluginBaseView extends BaseEditorViewImpl {\n\n    @Inject\n    protected GeneralPluginEditor editor;\n\n    public void setupContent(final PluginContent response,\n                             final ParameterizedCommand<Media> parameterizedCommand) {\n        editor.setupContent(response,\n                            parameterizedCommand);\n    }\n\n    public PluginSimpleContent getContent() {\n        return editor.getContent();\n    }\n\n    public String getTemplate() {\n        return editor.getTemplate();\n    }\n\n    public String getCss() {\n        return editor.getCss();\n    }\n\n    public Map<CodeType, String> getCodeMap() {\n        return editor.getCodeMap();\n    }\n\n    protected abstract void setFramework(Collection<Framework> frameworks);\n\n    protected abstract Collection<Framework> getFrameworks();\n\n    public void onSave() {\n        editor.onSave();\n    }\n\n    public void onClose() {\n        editor.onClose();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/ScreenEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.type.ScreenPluginResourceType;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchEditor(identifier = \"Screen PlugIn Editor\", supportedTypes = {ScreenPluginResourceType.class}, priority = Integer.MAX_VALUE)\npublic class ScreenEditorPresenter\n        extends RuntimePluginBaseEditor {\n\n    @Inject\n    private ScreenPluginResourceType resourceType;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    public ScreenEditorPresenter(final ScreenEditorView baseView) {\n        super(baseView);\n    }\n\n    protected ClientResourceType getResourceType() {\n        return resourceType;\n    }\n\n    protected PluginType getPluginType() {\n        return PluginType.SCREEN;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return CommonConstants.INSTANCE.ScreenPluginEditor() + \" [\" + this.plugin.getName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return super.baseView;\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose();\n    }\n\n    @Override\n    ScreenEditorView view() {\n        return (ScreenEditorView) baseView;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/ScreenEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.ext.plugin.model.Framework;\n\nimport static org.uberfire.ext.plugin.client.code.CodeList.DIVIDER;\nimport static org.uberfire.ext.plugin.client.code.CodeList.MAIN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CLOSE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_FOCUS;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_LOST_FOCUS;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_MAY_CLOSE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_OPEN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_SHUTDOWN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_STARTUP;\nimport static org.uberfire.ext.plugin.client.code.CodeList.TITLE;\n\n@Dependent\npublic class ScreenEditorView\n        extends RuntimePluginBaseView\n        implements RequiresResize {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel htmlPanel;\n    @UiField\n    FlowPanel formArea;\n    @UiField\n    ListBox framework;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        editor.setup(MAIN,\n                     DIVIDER,\n                     ON_OPEN,\n                     ON_CLOSE,\n                     ON_FOCUS,\n                     ON_LOST_FOCUS,\n                     ON_MAY_CLOSE,\n                     ON_STARTUP,\n                     ON_SHUTDOWN,\n                     DIVIDER,\n                     TITLE);\n        htmlPanel.add(editor);\n    }\n\n    @Override\n    protected void setFramework(final Collection<Framework> frameworks) {\n        if (frameworks != null && !frameworks.isEmpty()) {\n            final Framework framework = frameworks.iterator().next();\n            for (int i = 0; i < this.framework.getItemCount(); i++) {\n                if (this.framework.getItemText(i).equalsIgnoreCase(framework.toString())) {\n                    this.framework.setSelectedIndex(i);\n                    return;\n                }\n            }\n        }\n        this.framework.setSelectedIndex(0);\n    }\n\n    @Override\n    protected Collection<Framework> getFrameworks() {\n        if (framework.getSelectedValue().equalsIgnoreCase(\"(Framework)\")) {\n            return Collections.emptyList();\n        }\n        return new ArrayList<Framework>() {{\n            add(Framework.valueOf(framework.getSelectedValue().toUpperCase()));\n        }};\n    }\n\n    @Override\n    public void onResize() {\n        htmlPanel.setHeight(getParent().getParent().getOffsetHeight() + \"px\");\n        editor.onResize();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, ScreenEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/ScreenEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:style>\n    .block {\n      padding-top: 20px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"htmlPanel\">\n    <g:FlowPanel addStyleNames=\"{style.block}\" ui:field=\"formArea\">\n      <b:FieldSet>\n        <b:Container fluid=\"true\">\n          <b:Row>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"frameworkGroup\">\n                <b:ListBox ui:field=\"framework\" selectedIndex=\"0\">\n                  <g:item>(Framework)</g:item>\n                  <g:item>Angular</g:item>\n                  <g:item>Knockout</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"languageGroup\">\n                <b:ListBox ui:field=\"language\" selectedIndex=\"0\">\n                  <g:item>JavaScript</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n          </b:Row>\n        </b:Container>\n      </b:FieldSet>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/SplashEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.type.SplashPluginResourceType;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchEditor(identifier = \"Splash PlugIn Editor\", supportedTypes = {SplashPluginResourceType.class}, priority = Integer.MAX_VALUE)\npublic class SplashEditorPresenter\n        extends RuntimePluginBaseEditor {\n\n    @Inject\n    private SplashPluginResourceType resourceType;\n\n    @Inject\n    private Caller<PluginServices> pluginServices;\n\n    @Inject\n    public SplashEditorPresenter(final SplashEditorView baseView) {\n        super(baseView);\n    }\n\n    protected ClientResourceType getResourceType() {\n        return resourceType;\n    }\n\n    protected PluginType getPluginType() {\n        return PluginType.SPLASH;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return CommonConstants.INSTANCE.SplashScreenPluginEditor() + \" [\" + this.plugin.getName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return super.baseView;\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose();\n    }\n\n    @Override\n    SplashEditorView view() {\n        return (SplashEditorView) baseView;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/SplashEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.ext.plugin.model.Framework;\n\nimport static org.uberfire.ext.plugin.client.code.CodeList.BODY_HEIGHT;\nimport static org.uberfire.ext.plugin.client.code.CodeList.DIVIDER;\nimport static org.uberfire.ext.plugin.client.code.CodeList.INTERCEPTION_POINTS;\nimport static org.uberfire.ext.plugin.client.code.CodeList.MAIN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_CLOSE;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_OPEN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_SHUTDOWN;\nimport static org.uberfire.ext.plugin.client.code.CodeList.ON_STARTUP;\nimport static org.uberfire.ext.plugin.client.code.CodeList.TITLE;\n\n@Dependent\npublic class SplashEditorView\n        extends RuntimePluginBaseView\n        implements RequiresResize {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel htmlPanel;\n    @UiField\n    FlowPanel formArea;\n    @UiField\n    ListBox framework;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        editor.setup(MAIN,\n                     DIVIDER,\n                     ON_OPEN,\n                     ON_CLOSE,\n                     ON_STARTUP,\n                     ON_SHUTDOWN,\n                     DIVIDER,\n                     TITLE,\n                     BODY_HEIGHT,\n                     INTERCEPTION_POINTS);\n        htmlPanel.add(editor);\n    }\n\n    @Override\n    protected void setFramework(final Collection<Framework> frameworks) {\n        if (frameworks != null && !frameworks.isEmpty()) {\n            final Framework framework = frameworks.iterator().next();\n            for (int i = 0; i < this.framework.getItemCount(); i++) {\n                if (this.framework.getItemText(i).equalsIgnoreCase(framework.toString())) {\n                    this.framework.setSelectedIndex(i);\n                    return;\n                }\n            }\n        }\n        this.framework.setSelectedIndex(0);\n    }\n\n    @Override\n    protected Collection<Framework> getFrameworks() {\n        if (framework.getSelectedValue().equalsIgnoreCase(\"(Framework)\")) {\n            return Collections.emptyList();\n        }\n        return new ArrayList<Framework>() {{\n            add(Framework.valueOf(framework.getSelectedValue().toUpperCase()));\n        }};\n    }\n\n    @Override\n    public void onResize() {\n        htmlPanel.setHeight(getParent().getParent().getOffsetHeight() + \"px\");\n        editor.onResize();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, SplashEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/editor/SplashEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:style>\n    .block {\n      padding-top: 20px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"htmlPanel\">\n    <g:FlowPanel addStyleNames=\"{style.block}\" ui:field=\"formArea\">\n      <b:FieldSet>\n        <b:Container fluid=\"true\">\n          <b:Row>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"frameworkGroup\">\n                <b:ListBox ui:field=\"framework\" selectedIndex=\"0\">\n                  <g:item>(Framework)</g:item>\n                  <g:item>Angular</g:item>\n                  <g:item>Knockout</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n            <b:Column size=\"MD_4\">\n              <b:FormGroup ui:field=\"languageGroup\">\n                <b:ListBox ui:field=\"language\" selectedIndex=\"0\">\n                  <g:item>JavaScript</g:item>\n                </b:ListBox>\n              </b:FormGroup>\n            </b:Column>\n          </b:Row>\n        </b:Container>\n      </b:FieldSet>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/explorer/PluginExplorerScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.explorer;\n\nimport java.util.Collection;\nimport java.util.function.Consumer;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.ext.plugin.client.widget.navigator.PluginNavList;\nimport org.uberfire.ext.plugin.client.widget.popup.NewPluginPopUp;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@Dependent\n@WorkbenchScreen(identifier = \"Plugins Explorer\")\npublic class PluginExplorerScreen\n        extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel htmlPanel;\n    private CommonConstants constants = CommonConstants.INSTANCE;\n    @Inject\n    private NewPluginPopUp newPluginPopUp;\n    @Inject\n    private PluginNavList pluginNavList;\n    @Inject\n    private Caller<PluginServices> pluginServices;\n    @Inject\n    private PluginController pluginController;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n        pluginServices.call(new RemoteCallback<Collection<Plugin>>() {\n            @Override\n            public void callback(final Collection<Plugin> plugins) {\n                pluginNavList.setup(plugins);\n            }\n        }).listPlugins();\n        htmlPanel.add(pluginNavList);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return constants.PluginsExplorer();\n    }\n\n    @WorkbenchMenu\n    public void buildMenu(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {\n                                         @Override\n                                         public void push(MenuFactory.CustomMenuBuilder element) {\n                                         }\n\n                                         @Override\n                                         public MenuItem build() {\n                                             return new BaseMenuCustom<IsWidget>() {\n                                                 @Override\n                                                 public void accept(MenuVisitor visitor) {\n                                                     visitor.visit(this);\n                                                 }\n\n                                                 @Override\n                                                 public IsWidget build() {\n                                                     return getNewButton();\n                                                 }\n                                             };\n                                         }\n                                     }).endMenu().build());\n    }\n\n    public IsWidget getNewButton() {\n        ButtonGroup buttonGroup = new ButtonGroup();\n        buttonGroup.addStyleName(\"pull-right\");\n        buttonGroup.add(new Button() {{\n            setSize(ButtonSize.SMALL);\n            setDataToggle(Toggle.DROPDOWN);\n        }});\n        DropDownMenu dropDownMenu = new DropDownMenu();\n        addNewAnchorLink(dropDownMenu,\n                         CommonConstants.INSTANCE.NewPerspective(),\n                         PluginType.PERSPECTIVE_LAYOUT,\n                         pluginController.canCreatePerspectives());\n        addNewAnchorLink(dropDownMenu,\n                         CommonConstants.INSTANCE.NewScreen(),\n                         PluginType.SCREEN,\n                         true);\n        addNewAnchorLink(dropDownMenu,\n                         CommonConstants.INSTANCE.NewEditor(),\n                         PluginType.EDITOR,\n                         true);\n        addNewAnchorLink(dropDownMenu,\n                         CommonConstants.INSTANCE.NewSplashScreen(),\n                         PluginType.SPLASH,\n                         true);\n        addNewAnchorLink(dropDownMenu,\n                         CommonConstants.INSTANCE.NewDynamicMenu(),\n                         PluginType.DYNAMIC_MENU,\n                         true);\n        buttonGroup.add(dropDownMenu);\n        return buttonGroup;\n    }\n\n    private void addNewAnchorLink(DropDownMenu dropDownMenu,\n                                  String text,\n                                  PluginType pluginType,\n                                  boolean available) {\n        if (available) {\n            AnchorListItem anchor = new AnchorListItem(text);\n            anchor.addClickHandler(event -> newPluginPopUp.show(pluginType));\n            dropDownMenu.add(anchor);\n        }\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, PluginExplorerScreen> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/explorer/PluginExplorerScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <g:FlowPanel ui:field=\"htmlPanel\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/info/PluginsInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.info;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.editor.JSEditorActivity;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.perspective.JSWorkbenchPerspectiveActivity;\nimport org.uberfire.client.screen.JSWorkbenchScreenActivity;\nimport org.uberfire.client.splash.JSSplashScreenActivity;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.ClientTypeRegistry;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.type.DynamicMenuResourceType;\nimport org.uberfire.ext.plugin.client.type.EditorPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.PerspectiveLayoutPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.ScreenPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.SplashPluginResourceType;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\n\n@ApplicationScoped\npublic class PluginsInfo {\n\n    private EditorPluginResourceType editorPluginResourceType;\n\n    private PerspectiveLayoutPluginResourceType perspectiveLayoutPluginResourceType;\n\n    private ScreenPluginResourceType screenPluginResourceType;\n\n    private SplashPluginResourceType splashPluginResourceType;\n\n    private DynamicMenuResourceType dynamicMenuResourceType;\n\n    private ActivityBeansInfo activityBeansInfo;\n\n    private ClientTypeRegistry clientTypeRegistry;\n\n    public PluginsInfo() {\n    }\n\n    @Inject\n    public PluginsInfo(EditorPluginResourceType editorPluginResourceType,\n                       PerspectiveLayoutPluginResourceType perspectiveLayoutPluginResourceType,\n                       ScreenPluginResourceType screenPluginResourceType,\n                       SplashPluginResourceType splashPluginResourceType,\n                       DynamicMenuResourceType dynamicMenuResourceType,\n                       ActivityBeansInfo activityBeansInfo,\n                       ClientTypeRegistry clientTypeRegistry) {\n        this.editorPluginResourceType = editorPluginResourceType;\n        this.perspectiveLayoutPluginResourceType = perspectiveLayoutPluginResourceType;\n        this.screenPluginResourceType = screenPluginResourceType;\n        this.splashPluginResourceType = splashPluginResourceType;\n        this.dynamicMenuResourceType = dynamicMenuResourceType;\n        this.activityBeansInfo = activityBeansInfo;\n        this.clientTypeRegistry = clientTypeRegistry;\n    }\n\n    public Set<Activity> getAllPlugins(final Collection<Plugin> plugins) {\n        Set<Activity> activities = new HashSet<Activity>();\n        Collection<Set<Activity>> groupedActivities = getClassifiedPlugins(plugins).values();\n\n        for (Set<Activity> groupOfActivities : groupedActivities) {\n            activities.addAll(groupOfActivities);\n        }\n\n        return activities;\n    }\n\n    public Map<ClientResourceType, Set<Activity>> getClassifiedPlugins(final Collection<Plugin> plugins) {\n\n        final Map<ClientResourceType, Set<Activity>> classified = new LinkedHashMap<ClientResourceType, Set<Activity>>();\n\n        classified.put(perspectiveLayoutPluginResourceType,\n                       new HashSet<Activity>());\n        classified.put(screenPluginResourceType,\n                       new HashSet<Activity>());\n        classified.put(editorPluginResourceType,\n                       new HashSet<Activity>());\n        classified.put(splashPluginResourceType,\n                       new HashSet<Activity>());\n        classified.put(dynamicMenuResourceType,\n                       new HashSet<Activity>());\n\n        for (final String screenId : activityBeansInfo.getAvailableWorkbenchScreensIds()) {\n            classified.get(screenPluginResourceType).add(new Activity(screenId,\n                                                                      PluginType.SCREEN));\n        }\n\n        for (final String perspectiveId : activityBeansInfo.getAvailablePerspectivesIds()) {\n            classified.get(perspectiveLayoutPluginResourceType).add(new Activity(perspectiveId,\n                                                                                 PluginType.PERSPECTIVE));\n        }\n\n        for (final String editorId : activityBeansInfo.getAvailableWorkbenchEditorsIds()) {\n            classified.get(editorPluginResourceType).add(new Activity(editorId,\n                                                                      PluginType.EDITOR));\n        }\n\n        for (final String splashId : activityBeansInfo.getAvailableSplashScreensIds()) {\n            classified.get(splashPluginResourceType).add(new Activity(splashId,\n                                                                      PluginType.SPLASH));\n        }\n\n        for (final Plugin plugin : plugins) {\n            final ClientResourceType type = clientTypeRegistry.resolve(plugin.getPath());\n            if (type != null) {\n                classified.get(type).add(plugin);\n            }\n        }\n\n        final Collection<SyncBeanDef<JSWorkbenchScreenActivity>> jsscreens = lookupBeans(JSWorkbenchScreenActivity.class);\n        for (final SyncBeanDef<JSWorkbenchScreenActivity> beanDef : jsscreens) {\n            classified.get(screenPluginResourceType).add(new Activity(beanDef.getName(),\n                                                                      PluginType.SCREEN));\n        }\n\n        final Collection<SyncBeanDef<JSWorkbenchPerspectiveActivity>> jsperspectives = lookupBeans(JSWorkbenchPerspectiveActivity.class);\n        for (final SyncBeanDef<JSWorkbenchPerspectiveActivity> beanDef : jsperspectives) {\n            classified.get(perspectiveLayoutPluginResourceType).add(new Activity(beanDef.getName(),\n                                                                                 PluginType.PERSPECTIVE));\n        }\n\n        final Collection<SyncBeanDef<JSEditorActivity>> jseditors = lookupBeans(JSEditorActivity.class);\n        for (final SyncBeanDef<JSEditorActivity> beanDef : jseditors) {\n            classified.get(editorPluginResourceType).add(new Activity(beanDef.getName(),\n                                                                      PluginType.EDITOR));\n        }\n\n        final Collection<SyncBeanDef<JSSplashScreenActivity>> jssplashes = lookupBeans(JSSplashScreenActivity.class);\n        for (final SyncBeanDef<JSSplashScreenActivity> beanDef : jssplashes) {\n            classified.get(splashPluginResourceType).add(new Activity(beanDef.getName(),\n                                                                      PluginType.SPLASH));\n        }\n\n        return classified;\n    }\n\n    <T> Collection<SyncBeanDef<T>> lookupBeans(Class<T> clazz) {\n        return IOC.getBeanManager().lookupBeans(clazz);\n    }\n\n    public Map<ClientResourceType, String> getPluginsTypeLabels() {\n\n        final Map<ClientResourceType, String> labelsByResourceType = new HashMap<ClientResourceType, String>();\n\n        labelsByResourceType.put(perspectiveLayoutPluginResourceType,\n                                 CommonConstants.INSTANCE.PerspectivePlugin());\n        labelsByResourceType.put(screenPluginResourceType,\n                                 CommonConstants.INSTANCE.ScreenPlugin());\n        labelsByResourceType.put(editorPluginResourceType,\n                                 CommonConstants.INSTANCE.EditorPlugin());\n        labelsByResourceType.put(splashPluginResourceType,\n                                 CommonConstants.INSTANCE.SplashScreenPlugin());\n        labelsByResourceType.put(dynamicMenuResourceType,\n                                 CommonConstants.INSTANCE.DynamicMenu());\n\n        return labelsByResourceType;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/PlugInAuthoringPerspective.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocks;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = PlugInAuthoringPerspective.IDENTIFIER)\npublic class PlugInAuthoringPerspective {\n\n    public static final String IDENTIFIER = \"PlugInAuthoringPerspective\";\n\n    @Inject\n    UberfireDocks uberfireDocks;\n    private UberfireDock dock;\n\n    @PostConstruct\n    public void setupDocks() {\n        dock = new UberfireDock(UberfireDockPosition.WEST,\n                                \"ADJUST\",\n                                new DefaultPlaceRequest(\"Plugins Explorer\"),\n                                \"PlugInAuthoringPerspective\").withSize(400)\n                .withLabel(\"Plugin Explorer\");\n        uberfireDocks.add(dock);\n    }\n\n    @OnOpen\n    public void onOpen() {\n        uberfireDocks.open(dock);\n    }\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return buildPerspective();\n    }\n\n    private PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinitionImpl perspective = new PerspectiveDefinitionImpl(\n                MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Plugin Authoring\");\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/PerspectiveEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\nimport org.uberfire.ext.editor.commons.client.menu.MenuItems;\nimport org.uberfire.ext.editor.commons.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentPalette;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorPlugin;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorComponentGroupProvider;\nimport org.uberfire.ext.plugin.client.perspective.editor.components.popup.AddTag;\nimport org.uberfire.ext.plugin.client.perspective.editor.events.PerspectiveEditorFocusEvent;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.PerspectiveEditorSettings;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivList;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.ext.plugin.client.type.PerspectiveLayoutPluginResourceType;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnFocus;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\n@Dependent\n@WorkbenchEditor(identifier = PerspectiveEditorPresenter.ID, supportedTypes = {PerspectiveLayoutPluginResourceType.class}, priority = Integer.MAX_VALUE)\npublic class PerspectiveEditorPresenter extends BaseEditor<LayoutTemplate, DefaultMetadata> {\n\n    public static final String ID = \"Perspective Editor\";\n\n    @Inject\n    private View perspectiveEditorView;\n\n    @Inject\n    private LayoutEditorPlugin layoutEditorPlugin;\n\n    @Inject\n    private Event<NotificationEvent> ufNotification;\n\n    @Inject\n    private PerspectiveLayoutPluginResourceType resourceType;\n\n    @Inject\n    private Caller<PerspectiveServices> perspectiveServices;\n\n    @Inject\n    private PluginNameValidator pluginNameValidator;\n\n    @Inject\n    private PluginController pluginController;\n\n    @Inject\n    private PerspectiveEditorSettings perspectiveEditorSettings;\n\n    @Inject\n    private SyncBeanManager beanManager;\n    @Inject\n    private LayoutDragComponentPalette layoutDragComponentPalette;\n    @Inject\n    Event<PerspectiveEditorFocusEvent> perspectiveEditorFocusEvent;\n\n    private Plugin plugin;\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n\n        super.baseView = perspectiveEditorView;\n\n        // This is only used to define the \"name\" used by @WorkbenchPartTitle which is called by Uberfire after @OnStartup\n        // but before the async call in \"loadContent()\" has returned. When the *real* plugin is loaded this is overwritten\n        final String name = place.getParameter(\"name\",\n                                               \"\");\n        plugin = new Plugin(name,\n                            PluginType.PERSPECTIVE_LAYOUT,\n                            path);\n\n        // Show the available menu options according to the permissions set\n        List<MenuItems> menuItems = new ArrayList<>();\n        addMenuItem(menuItems,\n                    SAVE,\n                    pluginController.canUpdate(plugin));\n        addMenuItem(menuItems,\n                    COPY,\n                    pluginController.canCreatePerspectives());\n        addMenuItem(menuItems,\n                    RENAME,\n                    pluginController.canUpdate(plugin));\n        addMenuItem(menuItems,\n                    DELETE,\n                    pluginController.canDelete(plugin));\n\n        // Init the editor\n        init(path,\n             place,\n             resourceType,\n             true,\n             false,\n             menuItems);\n\n        // Init the drag component palette\n        initLayoutDragComponentGroups();\n\n        // Init the layout editor\n        this.layoutEditorPlugin.init(name,\n                org.uberfire.ext.plugin.client.resources.i18n.CommonConstants.INSTANCE.EmptyTitleText(),\n                org.uberfire.ext.plugin.client.resources.i18n.CommonConstants.INSTANCE.EmptySubTitleText(),\n                LayoutTemplate.Style.PAGE);\n\n        // Enable the preview feature in the perspective editor\n        this.layoutEditorPlugin.setPreviewEnabled(true);\n        this.layoutEditorPlugin.setElementSelectionEnabled(true);\n        this.perspectiveEditorView.setupLayoutEditor(layoutEditorPlugin.asWidget());\n    }\n\n    @OnFocus\n    public void onFocus() {\n        perspectiveEditorFocusEvent.fire(new PerspectiveEditorFocusEvent(layoutEditorPlugin));\n    }\n\n    @OnClose\n    public void onClose() {\n        layoutEditorPlugin.clear();\n    }\n\n    protected void addMenuItem(List<MenuItems> menuItems,\n                               MenuItems item,\n                               boolean add) {\n        if (add) {\n            menuItems.add(item);\n        }\n    }\n\n    public void initLayoutDragComponentGroups() {\n        layoutDragComponentPalette.clear();\n        layoutDragComponentPalette.addDraggableGroups(scanPerspectiveDragGroups());\n    }\n\n    private Collection<LayoutComponentPaletteGroupProvider> scanPerspectiveDragGroups() {\n        List<PerspectiveEditorComponentGroupProvider> result = beanManager.lookupBeans(PerspectiveEditorComponentGroupProvider.class).stream()\n                .map(SyncBeanDef::getInstance)\n                .filter(this::shouldRemoveGroup)\n                .collect(Collectors.toList());\n\n        // Sort the results\n        Collections.sort(result);\n\n        return result.stream().collect(Collectors.toList());\n    }\n\n    @Override\n    protected Promise<Void> makeMenuBar() {\n        return super.makeMenuBar().then(v -> {\n            if (perspectiveEditorSettings.isTagsEnabled()) {\n                menuBuilder.addNewTopLevelMenu(MenuFactory.newTopLevelMenu(CommonConstants.INSTANCE.Tags())\n                                                       .respondsWith(() -> {\n                                                           AddTag addTag = new AddTag(PerspectiveEditorPresenter.this);\n                                                           addTag.show();\n                                                       })\n                                                       .endMenu()\n                                                       .build().getItems().get(0));\n            }\n\n            return promises.resolve();\n        });\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose(getCurrentModelHash());\n    }\n\n    @Override\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @Override\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return org.uberfire.ext.plugin.client.resources.i18n.CommonConstants.INSTANCE.PerspectiveEditor() + \" [\" + plugin.getName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public UberView<PerspectiveEditorPresenter> getWidget() {\n        return perspectiveEditorView;\n    }\n\n    @Override\n    protected void loadContent() {\n        baseView.hideBusyIndicator();\n        layoutEditorPlugin.load(versionRecordManager.getCurrentPath(), this::afterLoad);\n    }\n\n    @Override\n    protected Supplier<LayoutTemplate> getContentSupplier() {\n        return layoutEditorPlugin::getLayout;\n    }\n\n    protected void afterLoad() {\n        setOriginalHash(getCurrentModelHash());\n        plugin = new Plugin(layoutEditorPlugin.getLayout().getName(),\n                            PluginType.PERSPECTIVE_LAYOUT,\n                            versionRecordManager.getCurrentPath());\n    }\n\n    @Override\n    protected void save() {\n        layoutEditorPlugin.save(versionRecordManager.getCurrentPath(),\n                                getSaveSuccessCallback(getCurrentModelHash()));\n        concurrentUpdateSessionInfo = null;\n    }\n\n    public int getCurrentModelHash() {\n        return layoutEditorPlugin.getLayout().hashCode();\n    }\n\n    @Override\n    protected void onRename() {\n        Path currentPath = versionRecordManager.getCurrentPath();\n        layoutEditorPlugin.load(currentPath, this::afterRename);\n    }\n\n    protected void afterRename() {\n        this.afterLoad();\n        changeTitleNotification.fire(new ChangeTitleWidgetEvent(place,\n                                                                getTitleText(),\n                                                                getTitle()));\n    }\n\n    @Override\n    public Validator getRenameValidator() {\n        return pluginNameValidator;\n    }\n\n    @Override\n    public Validator getCopyValidator() {\n        return pluginNameValidator;\n    }\n\n    @Override\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return perspectiveServices;\n    }\n\n    @Override\n    protected Caller<? extends SupportsSaveAndRename<LayoutTemplate, DefaultMetadata>> getSaveAndRenameServiceCaller() {\n        return perspectiveServices;\n    }\n\n    @Override\n    protected Caller<? extends SupportsCopy> getCopyServiceCaller() {\n        return perspectiveServices;\n    }\n    \n    protected boolean shouldRemoveGroup(PerspectiveEditorComponentGroupProvider group) {\n        if (group != null) {\n            LayoutDragComponentGroup componentGroup = group.getComponentGroup();\n            if (componentGroup != null) {\n                Map<String, LayoutDragComponent> components = componentGroup.getComponents();\n                return components != null && !components.isEmpty();\n            }\n        }\n        return true;\n    }\n\n    public void saveProperty(String key,\n                             String value) {\n        layoutEditorPlugin.addLayoutProperty(key,\n                                             value);\n    }\n\n    public String getLayoutProperty(String key) {\n        return layoutEditorPlugin.getLayoutProperty(key);\n    }\n\n    public List<String> getAllTargetDivs() {\n        return TargetDivList.list(layoutEditorPlugin.getLayout());\n    }\n    \n    public interface View extends BaseEditorView,\n                                  UberView<PerspectiveEditorPresenter> {\n\n        void setupLayoutEditor(Widget widget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/PerspectiveEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;\n\n@Dependent\npublic class PerspectiveEditorView\n        extends BaseEditorViewImpl implements PerspectiveEditorPresenter.View {\n\n    private static PerspectiveEditorViewBinder uiBinder = GWT.create(PerspectiveEditorViewBinder.class);\n    @UiField\n    FlowPanel layoutEditor;\n    private PerspectiveEditorPresenter presenter;\n\n    @PostConstruct\n    public void setup() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final PerspectiveEditorPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setupLayoutEditor(Widget widget) {\n        this.layoutEditor.add(widget);\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, PerspectiveEditorView> {\n\n    }\n\n    interface PerspectiveEditorViewBinder\n            extends\n            UiBinder<Widget, PerspectiveEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/PerspectiveEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .content {\n      height: 100%;\n    }\n    .layout{\n      height: 100%;\n    }\n  </ui:style>\n\n  <g:HTMLPanel addStyleNames=\"{style.content}\">\n    <g:FlowPanel ui:field=\"layoutEditor\" addStyleNames=\"{style.layout}\" />\n  </g:HTMLPanel>\n</ui:UiBinder>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/api/PerspectiveEditorComponentGroupProvider.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.api;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\n\n/**\n * Any class implementing this interface class is used to add an instance of {@link LayoutDragComponentGroup} to\n * the Perspective Editor's component palette.\n */\npublic interface PerspectiveEditorComponentGroupProvider extends LayoutComponentPaletteGroupProvider,\n                                                                 Comparable {\n\n    /**\n     * How important is this group in relation to other groups available. For example, more relevant groups\n     * are displayed first in the component palette.\n     */\n    default Integer getOrder() {\n        return 0;\n    }\n\n    @Override\n    default int compareTo(Object o) {\n        if (this == o) {\n            return 0;\n        }\n        if (o == null) {\n            return -1;\n        }\n        try {\n            PerspectiveEditorComponentGroupProvider other = (PerspectiveEditorComponentGroupProvider) o;\n            if (other.getOrder() == this.getOrder()) {\n                return this.getName().compareTo(other.getName());\n            }\n            return this.getOrder().compareTo(other.getOrder()) * -1;\n        } catch (ClassCastException e) {\n            return -1;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/api/PerspectiveEditorCoreComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.api;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\n\n/**\n * Main interface for those {@link LayoutDragComponent} implementations who want to be listed under the \"Core\"\n * group in the perspective editor's component palette.\n */\npublic interface PerspectiveEditorCoreComponent extends LayoutDragComponent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/api/PerspectiveEditorCoreGroupProvider.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.api;\n\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.plugin.client.resources.i18n.PerspectiveEditorPaletteI18n;\n\n/**\n * {@link PerspectiveEditorComponentGroupProvider} holding all the available {@link PerspectiveEditorCoreComponent} instances\n */\n@ApplicationScoped\npublic class PerspectiveEditorCoreGroupProvider implements PerspectiveEditorComponentGroupProvider {\n\n    private SyncBeanManager beanManager;\n    private PerspectiveEditorPaletteI18n i18n;\n\n    @Inject\n    public PerspectiveEditorCoreGroupProvider(SyncBeanManager beanManager, PerspectiveEditorPaletteI18n i18n) {\n        this.beanManager = beanManager;\n        this.i18n = i18n;\n    }\n\n    @Override\n    public String getName() {\n        return i18n.coreComponentGroupName();\n    }\n\n    @Override\n    public Integer getOrder() {\n        return Integer.MAX_VALUE;\n    }\n\n    @Override\n    public LayoutDragComponentGroup getComponentGroup() {\n        LayoutDragComponentGroup group = new LayoutDragComponentGroup(getName(), true);\n        Collection<SyncBeanDef<PerspectiveEditorCoreComponent>> beanDefs = beanManager.lookupBeans(PerspectiveEditorCoreComponent.class);\n        for (SyncBeanDef<PerspectiveEditorCoreComponent> beanDef : beanDefs) {\n            PerspectiveEditorCoreComponent dragComponent = beanDef.getInstance();\n            group.addLayoutDragComponent(dragComponent.getDragComponentTitle(), dragComponent);\n        }\n        return group;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/api/PerspectiveEditorNavComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.api;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\n\n/**\n * Main interface for those {@link LayoutDragComponent} implementations who want to be listed under the \"Navigation\"\n * group in the perspective editor's component palette.\n */\npublic interface PerspectiveEditorNavComponent extends LayoutDragComponent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/api/PerspectiveEditorNavGroupProvider.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.api;\n\nimport java.util.Collection;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.plugin.client.resources.i18n.PerspectiveEditorPaletteI18n;\n\n/**\n * {@link PerspectiveEditorComponentGroupProvider} holding all the available {@link PerspectiveEditorNavComponent} instances\n */\n@ApplicationScoped\npublic class PerspectiveEditorNavGroupProvider implements PerspectiveEditorComponentGroupProvider {\n\n    private SyncBeanManager beanManager;\n    private PerspectiveEditorPaletteI18n i18n;\n\n    @Inject\n    public PerspectiveEditorNavGroupProvider(SyncBeanManager beanManager, PerspectiveEditorPaletteI18n i18n) {\n        this.beanManager = beanManager;\n        this.i18n = i18n;\n    }\n\n    @Override\n    public String getName() {\n        return i18n.navComponentGroupName();\n    }\n\n    @Override\n    public LayoutDragComponentGroup getComponentGroup() {\n        LayoutDragComponentGroup group = new LayoutDragComponentGroup(getName());\n        Collection<SyncBeanDef<PerspectiveEditorNavComponent>> beanDefs = beanManager.lookupBeans(PerspectiveEditorNavComponent.class);\n        for (SyncBeanDef<PerspectiveEditorNavComponent> beanDef : beanDefs) {\n            PerspectiveEditorNavComponent dragComponent = beanDef.getInstance();\n            group.addLayoutDragComponent(dragComponent.getDragComponentTitle(), dragComponent);\n        }\n        return group;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/components/popup/AddTag.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.components.popup;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.plugin.client.perspective.editor.PerspectiveEditorPresenter;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.validation.NameValidator;\nimport org.uberfire.ext.plugin.type.TagsConverterUtil;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\n\npublic class AddTag\n        extends BaseModal {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final PerspectiveEditorPresenter perspectivePresenter;\n    @UiField\n    FormGroup tagControlGroup;\n    @UiField\n    TextBox tag;\n    @UiField\n    HelpBlock tagInline;\n    @UiField\n    HorizontalPanel tags;\n    private List<String> tagsList = new ArrayList<String>();\n\n    public AddTag(PerspectiveEditorPresenter perspectivePresenter) {\n        this.perspectivePresenter = perspectivePresenter;\n        setTitle(CommonConstants.INSTANCE.AddTag());\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(AddTag.this));\n        }});\n        add(new ModalFooterOKCancelButtons(\n                new Command() {\n                    @Override\n                    public void execute() {\n                        okButton();\n                    }\n                },\n                new Command() {\n                    @Override\n                    public void execute() {\n                        cancelButton();\n                    }\n                }\n        ));\n    }\n\n    private void cancelButton() {\n        this.tagsList.clear();\n        closePopup();\n    }\n\n    private void closePopup() {\n        hide();\n        super.hide();\n    }\n\n    public void show() {\n        loadTags();\n        super.show();\n    }\n\n    private void loadTags() {\n        String tagsString = perspectivePresenter.getLayoutProperty(TagsConverterUtil.LAYOUT_PROPERTY);\n        this.tagsList = TagsConverterUtil.convertTagStringToTag(tagsString);\n        generateTags();\n    }\n\n    private void generateTags() {\n        this.tags.clear();\n        for (String tag : tagsList) {\n            tags.add(new Label(tag));\n            tags.add(generateRemoveIcon(tag));\n        }\n    }\n\n    private void okButton() {\n        String tags = TagsConverterUtil.convertTagsToString(tagsList);\n        perspectivePresenter.saveProperty(TagsConverterUtil.LAYOUT_PROPERTY,\n                                          tags);\n        hide();\n    }\n\n    @UiHandler(\"addTag\")\n    void addTag(final ClickEvent event) {\n        NameValidator validator = NameValidator.tagNameValidator();\n        if (validator.isValid(tag.getText())) {\n            tagsList.add(tag.getText());\n            tags.add(new Label(tag.getText()));\n            tags.add(generateRemoveIcon(tag.getText()));\n            tag.setText(\"\");\n            tagControlGroup.setValidationState(ValidationState.NONE);\n            tagInline.setText(\"\");\n        } else {\n            tagControlGroup.setValidationState(ValidationState.ERROR);\n            tagInline.setText(validator.getValidationError());\n        }\n    }\n\n    private Icon generateRemoveIcon(final String value) {\n        final Icon icon = new Icon(IconType.REMOVE);\n        icon.addDomHandler(new ClickHandler() {\n                               @Override\n                               public void onClick(ClickEvent event) {\n                                   tagsList.remove(value);\n                                   generateTags();\n                               }\n                           },\n                           ClickEvent.getType());\n        icon.getElement().getStyle().setColor(\"rgb(153, 153, 153)\");\n        icon.getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        return icon;\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, AddTag> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/components/popup/AddTag.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.plugin.client.resources.i18n.CommonConstants\"/>\n  <ui:with field='res' type='org.uberfire.ext.plugin.client.resources.WebAppResource'/>\n\n\n  <b:Form>\n    <b:FormGroup ui:field=\"tagControlGroup\">\n      <g:FlowPanel addStyleNames=\"col-sm-3\">\n        <b:FormLabel for=\"tag\">\n          <ui:text from=\"{i18n.TagName}\"/>\n        </b:FormLabel>\n        <b:HelpBlock ui:field=\"tagInline\"/>\n      </g:FlowPanel>\n      <g:FlowPanel addStyleNames=\"col-sm-6\">\n        <b:TextBox ui:field=\"tag\" placeholder=\"{i18n.TagNameHolder}\"/>\n      </g:FlowPanel>\n      <g:FlowPanel addStyleNames=\"col-sm-3\">\n        <b:Button icon=\"PLUS\" type=\"PRIMARY\" ui:field=\"addTag\" text=\"{i18n.AddTag}\"/>\n      </g:FlowPanel>\n\n    </b:FormGroup>\n    <b:FormGroup>\n      <b:FormLabel addStyleNames=\"col-sm-12\">\n        <ui:text from=\"{i18n.TagLabel}\"/>\n      </b:FormLabel>\n      <g:FlowPanel addStyleNames=\"col-sm-12\">\n        <g:HorizontalPanel ui:field=\"tags\"/>\n      </g:FlowPanel>\n    </b:FormGroup>\n  </b:Form>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/events/PerspectiveEditorFocusEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.events;\n\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditor;\n\npublic class PerspectiveEditorFocusEvent {\n\n    private LayoutEditor layoutEditor;\n\n    public PerspectiveEditorFocusEvent(LayoutEditor layoutEditor) {\n        this.layoutEditor = layoutEditor;\n    }\n\n    public LayoutEditor getLayoutEditor() {\n        return layoutEditor;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/generator/PerspectiveEditorActivity.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.generator;\n\nimport java.util.function.Consumer;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class PerspectiveEditorActivity implements PerspectiveActivity {\n\n    private LayoutTemplate editor;\n    private PerspectiveEditorScreenActivity screen;\n    private PlaceRequest place;\n\n    public PerspectiveEditorActivity(final LayoutTemplate editor,\n                                     PerspectiveEditorScreenActivity screen) {\n        this.editor = editor;\n        this.screen = screen;\n    }\n\n    public void update(final LayoutTemplate editor,\n                       PerspectiveEditorScreenActivity screen) {\n        this.editor = editor;\n        this.screen = screen;\n    }\n\n    public PerspectiveEditorScreenActivity getScreen() {\n        return screen;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    @Override\n    public void onOpen() {\n\n    }\n\n    @Override\n    public void onClose() {\n    }\n\n    @Override\n    public void onShutdown() {\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return buildPerspective();\n    }\n\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition perspectiveDefinition = new PerspectiveDefinitionImpl(getDefaultPanelType());\n        perspectiveDefinition.setName(editor.getName());\n\n        final PanelDefinition root = perspectiveDefinition.getRoot();\n\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(screen.getIdentifier());\n        final PartDefinition partDefinition = new PartDefinitionImpl(placeRequest);\n        root.addPart(partDefinition);\n\n        return perspectiveDefinition;\n    }\n\n    protected String getDefaultPanelType() {\n        return SimpleWorkbenchPanelPresenter.class.getName();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return editor.getName();\n    }\n\n    @Override\n    public boolean isDefault() {\n        return false;\n    }\n\n    @Override\n    public boolean isTransient() {\n        return false;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    @Override\n    public ActivityResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/generator/PerspectiveEditorGenerator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.generator;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@EntryPoint\n@ApplicationScoped\npublic class PerspectiveEditorGenerator {\n\n    private SyncBeanManager beanManager;\n    private ActivityBeansCache activityBeansCache;\n    private LayoutGenerator layoutGenerator;\n    private Caller<PerspectiveServices> perspectiveServices;\n\n    @Inject\n    public PerspectiveEditorGenerator(SyncBeanManager beanManager,\n                                      ActivityBeansCache activityBeansCache,\n                                      LayoutGenerator layoutGenerator,\n                                      Caller<PerspectiveServices> perspectiveServices) {\n        this.beanManager = beanManager;\n        this.activityBeansCache = activityBeansCache;\n        this.layoutGenerator = layoutGenerator;\n        this.perspectiveServices = perspectiveServices;\n    }\n\n    @PostConstruct\n    public void loadPerspectives() {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        perspectiveServices.call((Collection<LayoutTemplate> response) -> {\n            response.forEach(this::generatePerspective);\n        }).listLayoutTemplates();\n    }\n\n    public void generatePerspective(String layoutEditorModel) {\n        perspectiveServices.call((LayoutTemplate perspective) -> {\n            if (perspective != null) {\n                generatePerspective(perspective);\n            }\n        }).convertToLayoutTemplate(layoutEditorModel);\n    }\n\n    public PerspectiveEditorActivity generatePerspective(LayoutTemplate layoutTemplate) {\n        if (isANewPerspective(layoutTemplate)) {\n            PerspectiveEditorScreenActivity screen = createNewScreen(layoutTemplate);\n            return createNewPerspective(layoutTemplate,\n                                 screen);\n        } else {\n            PerspectiveEditorScreenActivity screen = updateScreen(layoutTemplate);\n            return updatePerspective(layoutTemplate,\n                              screen);\n        }\n    }\n\n    private PerspectiveEditorActivity updatePerspective(LayoutTemplate layoutTemplate,\n                                   PerspectiveEditorScreenActivity screen) {\n        final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(layoutTemplate.getName());\n        final PerspectiveEditorActivity perspectiveEditorActivity = (PerspectiveEditorActivity) activity.getInstance();\n        perspectiveEditorActivity.update(layoutTemplate,\n                                         screen);\n        return perspectiveEditorActivity;\n    }\n\n    public void removePerspective(String perspectiveName) {\n        String perspectiveScreenId = PerspectiveEditorScreenActivity.buildScreenId(perspectiveName);\n        activityBeansCache.removeActivity(perspectiveName);\n        activityBeansCache.removeActivity(perspectiveScreenId);\n    }\n\n    private PerspectiveEditorScreenActivity updateScreen(LayoutTemplate layoutTemplate) {\n        final String perspectiveScreenId = PerspectiveEditorScreenActivity.buildScreenId(layoutTemplate.getName());\n        final SyncBeanDef<Activity> activity = activityBeansCache.getActivity(perspectiveScreenId);\n        final PerspectiveEditorScreenActivity screenActivity = (PerspectiveEditorScreenActivity) activity.getInstance();\n        screenActivity.setLayoutTemplate(layoutTemplate);\n        return screenActivity;\n    }\n\n    private PerspectiveEditorActivity createNewPerspective(LayoutTemplate perspective,\n                                      PerspectiveEditorScreenActivity screen) {\n        final PerspectiveEditorActivity activity = new PerspectiveEditorActivity(perspective,\n                                                                                 screen);\n\n        beanManager.registerBean(new SingletonBeanDefinition<>(activity,\n                                                             PerspectiveActivity.class,\n                                                             new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                                                             perspective.getName(),\n                                                             true));\n\n        activityBeansCache.addNewPerspectiveActivity(beanManager.lookupBeans(perspective.getName()).iterator().next());\n        return activity;\n    }\n\n    private PerspectiveEditorScreenActivity createNewScreen(LayoutTemplate perspective) {\n        PerspectiveEditorScreenActivity activity = new PerspectiveEditorScreenActivity(perspective,\n                                                                                       layoutGenerator);\n\n        final Set<Annotation> qualifiers = new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS));\n        final SingletonBeanDefinition<PerspectiveEditorScreenActivity, PerspectiveEditorScreenActivity> beanDef =\n                new SingletonBeanDefinition<>(\n                        activity,\n                        PerspectiveEditorScreenActivity.class,\n                        qualifiers,\n                        activity.getIdentifier(),\n                        true,\n                        WorkbenchScreenActivity.class,\n                        Activity.class);\n\n        beanManager.registerBean(beanDef);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          Activity.class);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          WorkbenchScreenActivity.class);\n\n        activityBeansCache.addNewScreenActivity(beanManager.lookupBeans(activity.getIdentifier()).iterator().next());\n        return activity;\n    }\n\n    private boolean isANewPerspective(LayoutTemplate layoutTemplate) {\n        final IOCBeanDef<Activity> activity = activityBeansCache.getActivity(layoutTemplate.getName());\n        return activity == null;\n    }\n\n    // Sync up with changes in backend\n\n    private void onPlugInAdded(@Observes final PluginAdded event) {\n        PortablePreconditions.checkNotNull(\"PluginAdded event\", event);\n        Plugin plugin = event.getPlugin();\n        perspectiveServices.call((RemoteCallback<LayoutTemplate>) this::generatePerspective)\n                .getLayoutTemplate(plugin);\n    }\n\n    private void onPlugInSaved(@Observes final PluginSaved event) {\n        PortablePreconditions.checkNotNull(\"PluginSaved event\", event);\n        Plugin plugin = event.getPlugin();\n        perspectiveServices.call((RemoteCallback<LayoutTemplate>) this::generatePerspective)\n                .getLayoutTemplate(plugin);\n    }\n\n    private void onPlugInRenamed(@Observes final PluginRenamed event) {\n        PortablePreconditions.checkNotNull(\"PluginRenamed event\", event);\n        Plugin plugin = event.getPlugin();\n        removePerspective(event.getOldPluginName());\n\n        perspectiveServices.call((RemoteCallback<LayoutTemplate>) this::generatePerspective)\n                .getLayoutTemplate(plugin);\n    }\n\n    private void onPlugInDeleted(@Observes final PluginDeleted event) {\n        PortablePreconditions.checkNotNull(\"PluginDeleted event\", event);\n        if (PluginType.PERSPECTIVE_LAYOUT.equals(event.getPluginType())) {\n            String pluginName = event.getPluginName();\n            removePerspective(pluginName);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/generator/PerspectiveEditorScreenActivity.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.generator;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Panel;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutInstance;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\npublic class PerspectiveEditorScreenActivity implements WorkbenchScreenActivity {\n\n    private final LayoutGenerator layoutGenerator;\n    private LayoutTemplate layoutTemplate;\n    private PlaceRequest place;\n    private String identifier;\n\n    private Panel mainPanel = new FlowPanel();\n\n    public PerspectiveEditorScreenActivity(LayoutTemplate layoutTemplate,\n                                           final LayoutGenerator layoutGenerator) {\n        this.layoutTemplate = layoutTemplate;\n        this.layoutGenerator = layoutGenerator;\n        this.identifier = buildScreenId(layoutTemplate.getName());\n    }\n\n    public static String buildScreenId(String perspectiveId) {\n        // AF-905: [Layout Editor] Errors while creating a page with the name of an existing screen\n        // Make sure the generated id. doesn't clash with any existing screen\n        return perspectiveId + \" [Screen]\";\n    }\n\n    public LayoutTemplate getLayoutTemplate() {\n        return layoutTemplate;\n    }\n\n    public void setLayoutTemplate(LayoutTemplate layoutTemplate) {\n        this.layoutTemplate = layoutTemplate;\n    }\n\n    @Override\n    public void onStartup(PlaceRequest place) {\n        this.place = place;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return true;\n    }\n\n    @Override\n    public void onClose() {\n    }\n\n    @Override\n    public void onShutdown() {\n    }\n\n    @Override\n    public Position getDefaultPosition() {\n        return new NamedPosition(\"mainContainer\");\n    }\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return null;\n    }\n\n    @Override\n    public void onFocus() {\n    }\n\n    @Override\n    public void onLostFocus() {\n    }\n\n    @Override\n    public String getTitle() {\n        return \"\";\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return mainPanel;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    @Override\n    public void onOpen() {\n        LayoutInstance layoutInstance = layoutGenerator.build(layoutTemplate);\n        mainPanel.clear();\n        mainPanel.getElement().addClassName(\"uf-perspective-component\");\n        mainPanel.add(ElementWrapperWidget.getWidget(layoutInstance.getElement()));\n    }\n\n    @Override\n    public String contextId() {\n        return getIdentifier();\n    }\n\n    @Override\n    public ActivityResourceType getResourceType() {\n        return ActivityResourceType.SCREEN;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/HTMLLayoutDragComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.ext.layout.editor.api.css.CssProperty;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.layout.editor.client.infra.LayoutEditorCssHelper;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorCoreComponent;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups.EditHTMLPresenter;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\n@Dependent\npublic class HTMLLayoutDragComponent implements PerspectiveEditorCoreComponent,\n                                                HasModalConfiguration {\n\n    public static final String HTML_CODE_PARAMETER = \"HTML_CODE\";\n\n    @Inject\n    private LayoutEditorCssHelper layoutCssHelper;\n\n    @Inject\n    private EditHTMLPresenter htmlEditor;\n\n    @Override\n    public String getDragComponentTitle() {\n        return CommonConstants.INSTANCE.HTMLComponent();\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-html5\";\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getPropertyCategories(LayoutComponent layoutComponent) {\n        Map<String, String> propertyMap = layoutComponent.getProperties();\n        List<PropertyEditorCategory> result = new ArrayList<>();\n\n        PropertyEditorCategory category = layoutCssHelper.createCategory(LayoutEditorCssHelper.CSS_CATEGORY_TEXT);\n        category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_ALIGN));\n        category.withField(layoutCssHelper.createField(propertyMap, CssProperty.TEXT_DECORATION));\n        category.withField(layoutCssHelper.createField(propertyMap, CssProperty.COLOR));\n        category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_SIZE));\n        category.withField(layoutCssHelper.createField(propertyMap, CssProperty.FONT_WEIGHT));\n        result.add(category);\n        return result;\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext container) {\n        return getShowWidget(container);\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext context) {\n        Map<String, String> properties = context.getComponent().getProperties();\n        String html = properties.get(HTMLLayoutDragComponent.HTML_CODE_PARAMETER);\n        if (html == null) {\n            return null;\n        }\n        return new HTMLPanel(html);\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        htmlEditor.init(ctx);\n        return htmlEditor.getView().getModal();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/PerspectiveEditorSettings.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class PerspectiveEditorSettings {\n\n    /**\n     * The tags feature is disabled by default. In order to enabled it a explicit call to\n     * {@link PerspectiveEditorSettings#setTagsEnabled(boolean)} is required.\n     *\n     * @since 2.0.0\n     */\n    private boolean tagsEnabled = false;\n\n    public boolean isTagsEnabled() {\n        return tagsEnabled;\n    }\n\n    public void setTagsEnabled(boolean tagsEnabled) {\n        this.tagsEnabled = tagsEnabled;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/ScreenLayoutDragComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorCoreComponent;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups.EditScreen;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.event.NewPluginRegistered;\nimport org.uberfire.ext.plugin.event.PluginUnregistered;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n/**\n * Disable for the time being => More details at https://issues.jboss.org/browse/AF-904\n */\n@ApplicationScoped\npublic class ScreenLayoutDragComponent implements /*PerspectiveEditorCoreComponent*/ LayoutDragComponent,\n                                                  HasModalConfiguration {\n\n    public static final String PLACE_NAME_PARAMETER = \"Place Name\";\n    protected List<String> availableWorkbenchScreensIds = new ArrayList<String>();\n    private PlaceManager placeManager;\n    private ModalConfigurationContext configContext;\n\n    @Inject\n    public ScreenLayoutDragComponent(PlaceManager placeManager) {\n        this.placeManager = placeManager;\n    }\n\n    @PostConstruct\n    public void setup() {\n        updateScreensList();\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return CommonConstants.INSTANCE.ScreenComponent();\n    }\n\n    @Override\n    public String getDragComponentIconClass() {\n        return \"fa fa-desktop\";\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        return getShowWidget(ctx);\n    }\n\n    @Override\n    public void removeCurrentWidget(RenderingContext ctx) {\n        DefaultPlaceRequest place = buildPlaceRequest(ctx.getComponent().getProperties());\n        if (place != null) {\n            placeManager.closePlace(place);\n        }\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n\n        FlowPanel panel = GWT.create(FlowPanel.class);\n        panel.asWidget().getElement().addClassName(\"uf-perspective-col\");\n        panel.asWidget().getElement().addClassName(\"screen dnd component\");\n        DefaultPlaceRequest place = buildPlaceRequest(ctx.getComponent().getProperties());\n        if (place == null) {\n            return null;\n        }\n        placeManager.goTo(place,\n                          panel);\n        return panel;\n    }\n\n    DefaultPlaceRequest buildPlaceRequest(Map<String, String> properties) {\n\n        String placeName = properties.get(PLACE_NAME_PARAMETER);\n        if (placeName == null) {\n            return null;\n        }\n\n        DefaultPlaceRequest place = new DefaultPlaceRequest(placeName,\n                                                            properties,\n                                                            false);\n        return place;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        this.configContext = ctx;\n        return new EditScreen(ctx,\n                              availableWorkbenchScreensIds,\n                              createCleanupPlaceRequest(buildPlaceRequest(ctx.getComponentProperties())));\n    }\n\n    Command createCleanupPlaceRequest(DefaultPlaceRequest placeToClose) {\n        return () -> {\n            placeManager.closePlace(placeToClose);\n        };\n    }\n\n    public void observeEditComponentEventFromPropertyEditor(@Observes PropertyEditorChangeEvent event) {\n\n        PropertyEditorFieldInfo property = event.getProperty();\n        if (property.getEventId().equalsIgnoreCase(EditScreen.PROPERTY_EDITOR_KEY)) {\n            configContext.setComponentProperty(property.getLabel(),\n                                               property.getCurrentStringValue());\n        }\n    }\n\n    public void onNewPluginRegistered(@Observes NewPluginRegistered newPluginRegistered) {\n        if (newPluginRegistered.getType().equals(PluginType.SCREEN) &&\n                !availableWorkbenchScreensIds.contains(newPluginRegistered.getName())) {\n            getActivityBeansInfo().addActivityBean(availableWorkbenchScreensIds,\n                                                   newPluginRegistered.getName());\n        }\n    }\n\n    public void onPluginUnregistered(@Observes PluginUnregistered pluginUnregistered) {\n        if (pluginUnregistered.getType().equals(PluginType.SCREEN)) {\n            availableWorkbenchScreensIds.remove(pluginUnregistered.getName());\n        }\n    }\n\n    protected void updateScreensList() {\n        final ActivityBeansInfo activityBeansInfo = getActivityBeansInfo();\n        availableWorkbenchScreensIds = activityBeansInfo.getAvailableWorkbenchScreensIds();\n    }\n\n    ActivityBeansInfo getActivityBeansInfo() {\n        final SyncBeanDef<ActivityBeansInfo> activityBeansInfoIOCBeanDef = IOC.getBeanManager()\n                .lookupBean(ActivityBeansInfo.class);\n        return activityBeansInfoIOCBeanDef.getInstance();\n    }\n\n    List<String> getAvailableWorkbenchScreensIds() {\n        return availableWorkbenchScreensIds;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/TargetDivDragComponent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.client.api.HasModalConfiguration;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorNavComponent;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups.EditTargetDiv;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@ApplicationScoped\npublic class TargetDivDragComponent implements PerspectiveEditorNavComponent,\n                                               HasModalConfiguration {\n\n    public static final String ID_PARAMETER = \"ID_PARAMETER\";\n    @Inject\n    private PlaceManager placeManager;\n    private ModalConfigurationContext configContext;\n\n    @PostConstruct\n    public void setup() {\n    }\n\n    @Override\n    public String getDragComponentTitle() {\n        return CommonConstants.INSTANCE.TargetDivComponent();\n    }\n\n    @Override\n    public IsWidget getPreviewWidget(RenderingContext ctx) {\n        String id = ctx.getComponent().getProperties().get(ID_PARAMETER);\n        FlowPanel panel = createDiv(id);\n        Label l = GWT.create(Label.class);\n        l.setText(CommonConstants.INSTANCE.TargetDivPlaceHolder() + \" \" + id);\n        panel.add(l);\n        return panel;\n    }\n\n    @Override\n    public IsWidget getShowWidget(RenderingContext ctx) {\n        String id = ctx.getComponent().getProperties().get(ID_PARAMETER);\n        return createDiv(id);\n    }\n\n    private FlowPanel createDiv(String id) {\n        FlowPanel panel = GWT.create(FlowPanel.class);\n        panel.asWidget().getElement().addClassName(\"uf-perspective-col\");\n        panel.asWidget().getElement().addClassName(\"screen dnd component\");\n        panel.getElement().setId(id);\n        return panel;\n    }\n\n    @Override\n    public Modal getConfigurationModal(ModalConfigurationContext ctx) {\n        this.configContext = ctx;\n        return new EditTargetDiv(ctx);\n    }\n\n    public void observeEditComponentEventFromPropertyEditor(@Observes PropertyEditorChangeEvent event) {\n        PropertyEditorFieldInfo property = event.getProperty();\n        if (property.getEventId().equalsIgnoreCase(EditTargetDiv.PROPERTY_EDITOR_KEY)) {\n            configContext.setComponentProperty(ID_PARAMETER,\n                                               property.getCurrentStringValue());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/TargetDivList.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.layout.editor.api.editor.LayoutColumn;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutRow;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\npublic class TargetDivList {\n\n    public static List<String> list(LayoutTemplate layout) {\n        List<String> ids = new ArrayList<>();\n        List<LayoutRow> rows = layout.getRows();\n        searchForComponents(rows,\n                            ids);\n        return ids;\n    }\n\n    private static void searchForComponents(List<LayoutRow> rows,\n                                            List<String> ids) {\n        for (LayoutRow layoutRow : rows) {\n            for (LayoutColumn layoutColumn : layoutRow.getLayoutColumns()) {\n                if (columnHasNestedRows(layoutColumn)) {\n                    searchForComponents(layoutColumn.getRows(),\n                                        ids);\n                } else {\n                    extractTargetDiv(layoutColumn.getLayoutComponents(),\n                                     ids);\n                }\n            }\n        }\n    }\n\n    private static void extractTargetDiv(List<LayoutComponent> layoutComponents,\n                                         List<String> ids) {\n        for (LayoutComponent layoutComponent : layoutComponents) {\n            if (isATargetDiv(layoutComponent)) {\n                ids.add(layoutComponent.getProperties().get(TargetDivDragComponent.ID_PARAMETER));\n            }\n        }\n    }\n\n    private static boolean isATargetDiv(LayoutComponent layoutComponent) {\n        return layoutComponent.getDragTypeName().equalsIgnoreCase(TargetDivDragComponent.class.getName());\n    }\n\n    private static boolean columnHasNestedRows(LayoutColumn layoutColumn) {\n        return layoutColumn.getRows() != null && !layoutColumn.getRows().isEmpty();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditHTMLPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.ext.editor.commons.client.htmleditor.HtmlEditorPresenter;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent;\n\n@Dependent\npublic class EditHTMLPresenter {\n\n    private View view;\n    private ModalConfigurationContext modalConfigurationContext;\n    private HtmlEditorPresenter htmlEditor;\n\n    @Inject\n    public EditHTMLPresenter(final View view,\n                             final HtmlEditorPresenter htmlEditor) {\n        this.view = view;\n        this.htmlEditor = htmlEditor;\n    }\n\n    public void init(final ModalConfigurationContext modalConfigurationContext) {\n        this.modalConfigurationContext = modalConfigurationContext;\n        setupHTMLEditor();\n        view.init(this);\n    }\n\n    public void show() {\n        view.show();\n    }\n\n    void setupHTMLEditor() {\n        String html = modalConfigurationContext.getComponentProperty(HTMLLayoutDragComponent.HTML_CODE_PARAMETER);\n\n        if (html == null || html.isEmpty()) {\n            html = view.getHtmlEditorPlaceHolder();\n        }\n\n        htmlEditor.setContent(html);\n        htmlEditor.load();\n    }\n\n    void closeClick() {\n        modalConfigurationContext.configurationCancelled();\n    }\n\n    void cancelClick() {\n        view.hide();\n        destroyHtmlEditor();\n        modalConfigurationContext.configurationCancelled();\n    }\n\n    void okClick() {\n        view.hide();\n        modalConfigurationContext.setComponentProperty(HTMLLayoutDragComponent.HTML_CODE_PARAMETER,\n                                                       htmlEditor.getContent());\n        destroyHtmlEditor();\n        modalConfigurationContext.configurationFinished();\n    }\n\n    public void destroyHtmlEditor() {\n        htmlEditor.destroy();\n    }\n\n    public HtmlEditorPresenter.View getHtmlEditorView() {\n        return htmlEditor.getView();\n    }\n\n    public ModalConfigurationContext getModalConfigurationContext() {\n        return this.modalConfigurationContext;\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public interface View extends UberElement<EditHTMLPresenter> {\n\n        void show();\n\n        void hide();\n\n        String getHtmlEditorPlaceHolder();\n\n        Modal getModal();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditHTMLView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div>\n    <div data-field=\"body\">\n    </div>\n    <div data-field=\"footer\">\n        <button data-field=\"okButton\" type=\"button\" class=\"btn btn-primary\" data-i18n-key=\"Ok\"></button>\n        <button data-field=\"cancelButton\" type=\"button\" class=\"btn btn-default\" data-i18n-key=\"Cancel\"></button>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditHTMLView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Event;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.TemplateWidgetMapper;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.SinkNative;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.file.popups.CommonModalBuilder;\nimport org.uberfire.ext.plugin.client.resources.i18n.Constants;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\n\n@Dependent\n@Templated\npublic class EditHTMLView implements EditHTMLPresenter.View {\n\n    private final TranslationService translationService;\n    @Inject\n    @DataField(\"body\")\n    Div body;\n    @Inject\n    @DataField(\"footer\")\n    Div footer;\n    private EditHTMLPresenter presenter;\n    private BaseModal modal;\n    private ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n\n    @Inject\n    public EditHTMLView(final TranslationService translationService) {\n        super();\n        this.translationService = translationService;\n    }\n\n    @Override\n    public void init(final EditHTMLPresenter presenter) {\n        this.presenter = presenter;\n        modalSetup();\n    }\n\n    private void modalSetup() {\n        body.appendChild(presenter.getHtmlEditorView().getElement());\n\n        modal = new CommonModalBuilder()\n                .addHeader(translationService.format(Constants.EditHTMLView_Title))\n                .addBody(body)\n                .addFooter(footer)\n                .build();\n\n        modal.addHiddenHandler(hiddenEvent -> {\n            if (ButtonPressed.CLOSE.equals(buttonPressed)) {\n                presenter.closeClick();\n            }\n            presenter.destroyHtmlEditor();\n        });\n\n        modal.setWidth(\"960px\");\n    }\n\n    @Override\n    public void show() {\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public String getHtmlEditorPlaceHolder() {\n        return translationService.format(Constants.EditHTMLView_HtmlPlaceHolder);\n    }\n\n    @Override\n    public Modal getModal() {\n        return modal;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return (HTMLElement) TemplateWidgetMapper.get(modal).getElement().cast();\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"okButton\")\n    public void okClick(final Event event) {\n        buttonPressed = ButtonPressed.OK;\n        presenter.okClick();\n    }\n\n    @SinkNative(Event.ONCLICK)\n    @EventHandler(\"cancelButton\")\n    public void cancelClick(final Event event) {\n        buttonPressed = ButtonPressed.CANCEL;\n        presenter.cancelClick();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.client.validation.NameValidator;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\n\nimport static org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent.PLACE_NAME_PARAMETER;\n\npublic class EditScreen\n        extends BaseModal {\n\n    public static String PROPERTY_EDITOR_KEY = \"EditScreen\";\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final ModalConfigurationContext configContext;\n    private Command cleanupPlaceRequest;\n    protected List<String> availableWorkbenchScreensIds = new ArrayList<String>();\n    @UiField\n    TextBox key;\n    @UiField\n    FormGroup paramKeyControlGroup;\n    @UiField\n    HelpBlock paramKeyInline;\n    @UiField\n    TextBox value;\n    @UiField\n    PropertyEditorWidget propertyEditor;\n    private ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n    private Map<String, String> lastParametersSaved = new HashMap<String, String>();\n\n    public EditScreen(ModalConfigurationContext configContext,\n                      List<String> availableWorkbenchScreensIds,\n                      Command cleanupPlaceRequest) {\n        this.availableWorkbenchScreensIds = availableWorkbenchScreensIds;\n        this.configContext = configContext;\n        this.cleanupPlaceRequest = cleanupPlaceRequest;\n        setTitle(CommonConstants.INSTANCE.EditComponent());\n        setBody(uiBinder.createAndBindUi(EditScreen.this));\n        propertyEditor.handle(generateEvent(generateScreenSettingsCategory()));\n        saveOriginalState();\n        add(new ModalFooterOKCancelButtons(\n                    new Command() {\n                        @Override\n                        public void execute() {\n                            okButton();\n                        }\n                    },\n                    new Command() {\n                        @Override\n                        public void execute() {\n                            cancelButton();\n                        }\n                    }\n            )\n        );\n        addHiddenHandler();\n    }\n\n    private void cleanupPlaceRequest() {\n        if (shouldICleanupPlaceRequest()) {\n            cleanupPlaceRequest.execute();\n        }\n    }\n\n    boolean shouldICleanupPlaceRequest() {\n        return oldPlaceName() != null && oldPlaceName() != currentPlaceName();\n    }\n\n    String currentPlaceName() {\n        return configContext.getComponentProperty(PLACE_NAME_PARAMETER);\n    }\n\n    String oldPlaceName() {\n        return lastParametersSaved.get(PLACE_NAME_PARAMETER);\n    }\n\n    private void saveOriginalState() {\n        lastParametersSaved = new HashMap<String, String>();\n        Map<String, String> layoutComponentProperties = configContext.getComponentProperties();\n        for (String key : layoutComponentProperties.keySet()) {\n            lastParametersSaved.put(key,\n                                    layoutComponentProperties.get(key));\n        }\n    }\n\n    protected void addHiddenHandler() {\n        addHiddenHandler(new ModalHiddenHandler() {\n            @Override\n            public void onHidden(ModalHiddenEvent hiddenEvent) {\n                if (userPressedCloseOrCancel()) {\n                    revertChanges();\n                    configContext.configurationCancelled();\n                }\n            }\n        });\n    }\n\n    private boolean userPressedCloseOrCancel() {\n        return ButtonPressed.CANCEL.equals(buttonPressed) || ButtonPressed.CLOSE.equals(buttonPressed);\n    }\n\n    private void revertChanges() {\n        configContext.resetComponentProperties();\n        for (String key : lastParametersSaved.keySet()) {\n            configContext.setComponentProperty(key,\n                                               lastParametersSaved.get(key));\n        }\n    }\n\n    public void show() {\n        super.show();\n    }\n\n    void okButton() {\n        buttonPressed = ButtonPressed.OK;\n\n        // Make sure a default screen is set before finish\n        if (currentPlaceName() == null) {\n            if (!availableWorkbenchScreensIds.isEmpty()) {\n                configContext.setComponentProperty(PLACE_NAME_PARAMETER,\n                                                   availableWorkbenchScreensIds.get(0));\n                configContext.configurationFinished();\n            } else {\n                // If no screens are available then cancel\n                configContext.configurationCancelled();\n            }\n        } else {\n\n            configContext.configurationFinished();\n        }\n\n        cleanupPlaceRequest();\n        hide();\n    }\n\n    void cancelButton() {\n        buttonPressed = ButtonPressed.CANCEL;\n        hide();\n    }\n\n    @Override\n    public void hide() {\n        super.hide();\n    }\n\n    @UiHandler(\"add\")\n    void add(final ClickEvent event) {\n        final PropertyEditorCategory property = addProperty();\n        if (property == null) {\n            return;\n        }\n        propertyEditor.handle(generateEvent(property));\n        key.setText(\"\");\n        value.setText(\"\");\n    }\n\n    private PropertyEditorCategory addProperty() {\n        paramKeyInline.setText(\"\");\n        paramKeyControlGroup.setValidationState(ValidationState.NONE);\n\n        //Check the Key is valid\n        final NameValidator validator = NameValidator.parameterNameValidator();\n        if (!validator.isValid(key.getText())) {\n            paramKeyControlGroup.setValidationState(ValidationState.ERROR);\n            paramKeyInline.setText(validator.getValidationError());\n            return null;\n        }\n\n        //Check the Key is unique\n        Map<String, String> properties = configContext.getComponentProperties();\n        for (String parameterKey : properties.keySet()) {\n            if (key.getText().equals(parameterKey)) {\n                paramKeyControlGroup.setValidationState(ValidationState.ERROR);\n                paramKeyInline.setText(CommonConstants.INSTANCE.DuplicateParameterName());\n                return null;\n            }\n        }\n\n        configContext.setComponentProperty(key.getText(),\n                                           value.getText());\n        return generateScreenSettingsCategory();\n    }\n\n    private PropertyEditorCategory generateScreenSettingsCategory() {\n\n        //Override getFields() so we can remove Parameter from ScreenEditor when collection is modified by PropertiesWidget\n        PropertyEditorCategory category = new PropertyEditorCategory(CommonConstants.INSTANCE.ScreenConfiguration()) {\n\n            @Override\n            public List<PropertyEditorFieldInfo> getFields() {\n                return new ArrayList<PropertyEditorFieldInfo>(super.getFields()) {\n\n                    @Override\n                    public boolean remove(Object o) {\n                        if (o instanceof PropertyEditorFieldInfo) {\n                            final PropertyEditorFieldInfo info = (PropertyEditorFieldInfo) o;\n                            configContext.removeComponentProperty(info.getLabel());\n                        }\n                        return super.remove(o);\n                    }\n                };\n            }\n        };\n\n        // Add the screen selector property\n        final Map<String, String> parameters = configContext.getComponentProperties();\n        String selectedScreenId = parameters.get(PLACE_NAME_PARAMETER);\n\n        category.withField(new PropertyEditorFieldInfo(CommonConstants.INSTANCE.PlaceName(),\n                                                       selectedScreenId == null ? \"\" : selectedScreenId,\n                                                       PropertyEditorType.COMBO)\n                                   .withComboValues(availableWorkbenchScreensIds)\n                                   .withKey(configContext.hashCode() + PLACE_NAME_PARAMETER));\n\n        // Add the rest of the screen's properties\n        for (final String key : parameters.keySet()) {\n            if (!PLACE_NAME_PARAMETER.equals(key)) {\n                category.withField(new PropertyEditorFieldInfo(key,\n                                                               parameters.get(key),\n                                                               PropertyEditorType.TEXT)\n                                           .withKey(configContext.hashCode() + key)\n                                           .withRemovalSupported(true));\n            }\n        }\n\n        // Ensure the screen category is always expanded after loadEmptyLayout\n        propertyEditor.setLastOpenAccordionGroupTitle(category.getName());\n        return category;\n    }\n\n    private PropertyEditorEvent generateEvent(PropertyEditorCategory category) {\n        PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY,\n                                                            category);\n        return event;\n    }\n\n    protected ModalConfigurationContext getConfigContext() {\n        return this.configContext;\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, EditScreen> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditScreen.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:uf='urn:import:org.uberfire.ext.properties.editor.client'>\n\n\n  <ui:with field='res' type='org.uberfire.ext.plugin.client.resources.WebAppResource'/>\n\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.plugin.client.resources.i18n.CommonConstants\"/>\n\n  <b:Panel>\n\n    <b:PanelGroup>\n      <b:Panel>\n        <b:PanelHeader>\n          <b:Heading size=\"H4\" >\n            <b:Anchor text=\"{i18n.AddNewParameter}\" addStyleNames=\"collapsed\" dataToggle=\"COLLAPSE\" dataTarget=\"#collapsePersistence\" />\n          </b:Heading>\n        </b:PanelHeader>\n        <b:PanelCollapse b:id=\"collapsePersistence\">\n          <b:PanelBody>\n\n            <b:FormGroup ui:field=\"paramKeyControlGroup\">\n              <b:HelpBlock ui:field=\"paramKeyInline\"/>\n              <b:FormLabel for=\"key\" addStyleNames=\"col-lg-3\" text=\"{i18n.ParamKey}\"/>\n              <g:FlowPanel addStyleNames=\"col-lg-9\">\n                <b:TextBox ui:field=\"key\" placeholder=\"{i18n.ParamKeyPlaceHolder}\"/>\n              </g:FlowPanel>\n            </b:FormGroup>\n\n            <b:FormGroup>\n              <b:FormLabel for=\"value\" addStyleNames=\"col-lg-3\" text=\"{i18n.ParamValue}\"/>\n              <g:FlowPanel addStyleNames=\"col-lg-9\">\n                <b:TextBox ui:field=\"value\" placeholder=\"{i18n.ParamValuePlaceHolder}\" addStyleNames=\"col-sm-9\"/>\n              </g:FlowPanel>\n            </b:FormGroup>\n\n            <b:Button type=\"PRIMARY\" ui:field=\"add\" addStyleNames=\"{res.CSS.buttonAddParameter}\">\n              <ui:text from=\"{i18n.Add}\"/>\n            </b:Button>\n\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n\n\n    <uf:PropertyEditorWidget ui:field=\"propertyEditor\"/>\n\n  </b:Panel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditTargetDiv.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.i18n.client.TimeZone;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.ButtonPressed;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\n\nimport static org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivDragComponent.ID_PARAMETER;\n\npublic class EditTargetDiv\n        extends BaseModal {\n\n    public static String PROPERTY_EDITOR_KEY = \"EditTargetDiv\";\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final ModalConfigurationContext configContext;\n    @UiField\n    PropertyEditorWidget propertyEditor;\n    private ButtonPressed buttonPressed = ButtonPressed.CLOSE;\n    private Map<String, String> lastParametersSaved = new HashMap<String, String>();\n\n    public EditTargetDiv(ModalConfigurationContext configContext) {\n        this.configContext = configContext;\n        setTitle(CommonConstants.INSTANCE.EditComponent());\n        setBody(uiBinder.createAndBindUi(EditTargetDiv.this));\n        propertyEditor.handle(generateEvent(generatedPropertyEditor()));\n        saveOriginalState();\n        add(new ModalFooterOKCancelButtons(\n                    () -> okButton(),\n                    () -> cancelButton()\n            )\n        );\n        addHiddenHandler();\n    }\n\n    private void saveOriginalState() {\n        lastParametersSaved = new HashMap<>();\n        Map<String, String> layoutComponentProperties = configContext.getComponentProperties();\n        for (String key : layoutComponentProperties.keySet()) {\n            lastParametersSaved.put(key,\n                                    layoutComponentProperties.get(key));\n        }\n    }\n\n    protected void addHiddenHandler() {\n        addHiddenHandler(hiddenEvent -> {\n            if (userPressedCloseOrCancel()) {\n                revertChanges();\n                configContext.configurationCancelled();\n            }\n        });\n    }\n\n    private boolean userPressedCloseOrCancel() {\n        return ButtonPressed.CANCEL.equals(buttonPressed) || ButtonPressed.CLOSE.equals(buttonPressed);\n    }\n\n    private void revertChanges() {\n        configContext.resetComponentProperties();\n        for (String key : lastParametersSaved.keySet()) {\n            configContext.setComponentProperty(key,\n                                               lastParametersSaved.get(key));\n        }\n    }\n\n    public void show() {\n        super.show();\n    }\n\n    void okButton() {\n        buttonPressed = ButtonPressed.OK;\n\n        if (configContext.getComponentProperty(ID_PARAMETER) == null) {\n            configContext.setComponentProperty(ID_PARAMETER,\n                                               generateRandomID());\n            configContext.configurationFinished();\n        } else {\n            configContext.configurationFinished();\n        }\n\n        hide();\n    }\n\n    private String generateRandomID() {\n        Date date = new Date();\n        DateTimeFormat dtf = DateTimeFormat.getFormat(\"yyyyMMddHHmmss\");\n        String randomID = \"id-\" + dtf.format(date,\n                                             TimeZone.createTimeZone(0));\n        return randomID;\n    }\n\n    void cancelButton() {\n        buttonPressed = ButtonPressed.CANCEL;\n        hide();\n    }\n\n    @Override\n    public void hide() {\n        super.hide();\n    }\n\n    private PropertyEditorCategory generatedPropertyEditor() {\n\n        PropertyEditorCategory category = new PropertyEditorCategory(CommonConstants.INSTANCE.TargetDivConfiguration());\n\n        final Map<String, String> parameters = configContext.getComponentProperties();\n        String selectedID = parameters.get(ID_PARAMETER);\n\n        category.withField(new PropertyEditorFieldInfo(CommonConstants.INSTANCE.TargetDivPlaceHolder(),\n                                                       selectedID == null ? \"\" : selectedID,\n                                                       PropertyEditorType.TEXT)\n                                   .withKey(configContext.hashCode() + ID_PARAMETER));\n\n        propertyEditor.addExpandedCategory(category.getName());\n        return category;\n    }\n\n    private PropertyEditorEvent generateEvent(PropertyEditorCategory category) {\n        PropertyEditorEvent event = new PropertyEditorEvent(PROPERTY_EDITOR_KEY,\n                                                            category);\n        return event;\n    }\n\n    protected ModalConfigurationContext getConfigContext() {\n        return this.configContext;\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, EditTargetDiv> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditTargetDiv.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2017 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:uf='urn:import:org.uberfire.ext.properties.editor.client'>\n\n\n  <ui:with field='res' type='org.uberfire.ext.plugin.client.resources.WebAppResource'/>\n\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.plugin.client.resources.i18n.CommonConstants\"/>\n\n  <b:Panel>\n\n    <uf:PropertyEditorWidget ui:field=\"propertyEditor\"/>\n\n  </b:Panel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/plugins/RuntimePluginStartup.java",
    "content": "package org.uberfire.ext.plugin.client.plugins;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.backend.plugin.PluginProcessor;\nimport org.uberfire.backend.plugin.RuntimePlugin;\nimport org.uberfire.backend.plugin.RuntimePluginService;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorGenerator;\nimport org.uberfire.workbench.events.UberfireJSAPIReadyEvent;\n\n@EntryPoint\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class RuntimePluginStartup {\n\n    @Inject\n    PerspectiveEditorGenerator perspectiveEditorGenerator;\n    @Inject\n    private Workbench workbench;\n    @Inject\n    private Caller<RuntimePluginService> runtimePlugins;\n\n    @PostConstruct\n    public void init() {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        workbench.addStartupBlocker(RuntimePluginStartup.class);\n    }\n\n    void startPlugins(@Observes UberfireJSAPIReadyEvent event) {\n        if (!BusToolsCli.isRemoteCommunicationEnabled()) {\n            return;\n        }\n\n        runtimePlugins.call(new RemoteCallback<List<RuntimePlugin>>() {\n            @Override\n            public void callback(List<RuntimePlugin> plugins) {\n                try {\n                    for (final RuntimePlugin p : plugins) {\n                        if (isJSPlugin(p)) {\n                            ScriptInjector.fromString(p.getPluginContent()).setWindow(ScriptInjector.TOP_WINDOW).inject();\n                        } else if (isPerspectivePlugin(p)) {\n                            perspectiveEditorGenerator.generatePerspective(p.getPluginContent());\n                        }\n                    }\n                } finally {\n                    workbench.removeStartupBlocker(RuntimePluginStartup.class);\n                }\n            }\n        }).getRuntimePlugins();\n    }\n\n    private boolean isPerspectivePlugin(RuntimePlugin p) {\n        return p.getType().name() == PluginProcessor.PluginProcessorType.PERSPECTIVE_EDITOR.name();\n    }\n\n    private boolean isJSPlugin(RuntimePlugin p) {\n        return p.getType().name() == PluginProcessor.PluginProcessorType.JS.name();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/PluginCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface PluginCss extends CssResource {\n\n    String content();\n\n    @ClassName(\"editor-wrapping\")\n    String editorWrapping();\n\n    String window();\n\n    String column();\n\n    String bottom();\n\n    String left();\n\n    String right();\n\n    @ClassName(\"handler-vertical\")\n    String handlerVertical();\n\n    @ClassName(\"handler-horizontal\")\n    String handlerHorizontal();\n\n    String top();\n\n    String buttonAddParameter();\n\n    @ClassName(\"window-label\")\n    String windowLabel();\n\n    @ClassName(\"bottom-inverted\")\n    String bottomInverted();\n\n    @ClassName(\"top-inverted\")\n    String topInverted();\n\n    @ClassName(\"media-lib\")\n    String mediaLib();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/WebAppResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.DataResource;\n\npublic interface WebAppResource\n        extends\n        ClientBundle {\n\n    WebAppResource INSTANCE = GWT.create(WebAppResource.class);\n\n    @Source(\"css/plugin.css\")\n    PluginCss CSS();\n\n    @Source(\"images/handle-v.png\")\n    DataResource handleVertical();\n\n    @Source(\"images/handle-h.png\")\n    DataResource handleHorizontal();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/css/plugin.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.content {\n    position: absolute;\n    height: auto;\n    bottom: 0;\n    top: 0;\n    left: 0;\n    right: 0;\n    margin: 14px 15px;\n    min-height: 300px;\n}\n\n.column {\n    display: block;\n    height: 100%;\n    width: 50%;\n}\n\n.buttonAddParameter {\n    float:right;\n    margin-top:5px;\n    margin-right:20px;\n}\n\n.window {\n    width: 100%;\n    border: 1px solid #C0C0C0;\n    box-shadow: inset 0 1px 2px #e4e4e4;\n}\n\n.top {\n    height: 25%;\n    position: absolute;\n    top: -6px;\n}\n\n.bottom {\n    height: 75%;\n    position: absolute;\n    bottom: -6px;\n}\n\n.top-inverted {\n    height: 75%;\n    position: absolute;\n    top: -6px;\n}\n\n.bottom-inverted {\n    height: 25%;\n    position: absolute;\n    bottom: -6px;\n}\n\n.right {\n    position: absolute;\n    right: -5px;\n}\n\n.left {\n    position: absolute;\n    left: -5px;\n}\n\n@url handleVertical handleVertical;\n\n.handler-vertical {\n    width: 8px;\n    height: 100%;\n    padding: 5px 0;\n    cursor: col-resize;\n    position: absolute;\n    top: -5px;\n    left: 0;\n    background: handleVertical 3px 50% no-repeat;\n}\n\n@url handleHorizontal handleHorizontal;\n\n.handler-horizontal {\n    width: 100%;\n    height: 8px;\n    padding: 0 1px;\n    cursor: row-resize;\n    position: absolute;\n    top: 0;\n    left: 0;\n    background: handleHorizontal 50% 3px no-repeat;\n}\n\n.window-label {\n    border: solid 1px #F1F1F1;\n    background: #fff;\n    display: inline-block;\n    height: 22px;\n    padding: 0 6px;\n    line-height: 22px;\n    position: absolute;\n    top: 7px;\n    right: 6px;\n    text-align: center;\n    font-size: 12px;\n    color: #777;\n    border-radius: 1px;\n    z-index: 30;\n}\n\n.editor-wrapping {\n    width: 100%;\n    height: 100%;\n}\n\n.media-lib {\n    overflow-y: scroll !important;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String SavePerspective();\n\n    String PerspectiveName();\n\n    String PerspectiveNameHolder();\n\n    String TagName();\n\n    String AddTag();\n\n    String TagLabel();\n\n    String TagNameHolder();\n\n    String InvalidPerspectiveName();\n\n    String InvalidTagName();\n\n    String InvalidParameterName();\n\n    String InvalidActivityID();\n\n    String InvalidMenuLabel();\n\n    String EmptyTagName();\n\n    String EmptyParameterName();\n\n    String EmptyActivityID();\n\n    String EmptyMenuLabel();\n\n    String DuplicatedMenuLabel();\n\n    String DuplicateParameterName();\n\n    String LoadPerspective();\n\n    String EditHtml();\n\n    String EditComponent();\n\n    String Add();\n\n    String AddNewParameter();\n\n    String ParamKey();\n\n    String ParamKeyPlaceHolder();\n\n    String ParamValue();\n\n    String ParamValuePlaceHolder();\n\n    String InvalidGridConfiguration();\n\n    String MenusNoMenuItems();\n\n    String MenusMoveUpHint();\n\n    String MenusMoveDownHint();\n\n    String MenusActivityID();\n\n    String MenusLabel();\n\n    String MenusDeleteHint();\n\n    String MenusDelete();\n\n    String DragAndDrop();\n\n    String NewPerspective();\n\n    String NewPerspectivePopUpTitle();\n\n    String NewPerspectiveLayoutPopUpTitle();\n\n    String NewScreen();\n\n    String NewScreenPopUpTitle();\n\n    String NewEditor();\n\n    String NewEditorPopUpTitle();\n\n    String NewSplashScreen();\n\n    String NewSplashScreenPopUpTitle();\n\n    String NewDynamicMenu();\n\n    String NewDynamicMenuPopUpTitle();\n\n    String HTMLComponent();\n\n    String HTMLplaceHolder();\n\n    String ScreenComponent();\n\n    String TargetDivComponent();\n\n    String TargetDivPlaceHolder();\n\n    String TargetDivConfiguration();\n\n    String ScreenConfiguration();\n\n    String PlaceName();\n\n    String EmptyTitleText();\n\n    String EmptySubTitleText();\n\n    String PluginsExplorer();\n\n    String PerspectivePlugin();\n\n    String ScreenPlugin();\n\n    String EditorPlugin();\n\n    String SplashScreenPlugin();\n\n    String DynamicMenu();\n\n    String PerspectiveEditor();\n\n    String ScreenPluginEditor();\n\n    String EditorPluginEditor();\n\n    String SplashScreenPluginEditor();\n\n    String DynamicMenuEditor();\n\n    String MenuItem();\n\n    String ActivityId();\n\n    String MenuLabel();\n\n    String Ok();\n\n    String Cancel();\n\n    String Name();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic class Constants {\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String EditHTMLView_Title = \"EditHTMLView.Title\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String EditHTMLView_Ok = \"EditHTMLView.Ok\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String EditHTMLView_Cancel = \"EditHTMLView.Cancel\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String EditHTMLView_HtmlPlaceHolder = \"EditHTMLView.HtmlPlaceHolder\";\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface PerspectiveEditorPaletteConstants extends Messages, PerspectiveEditorPaletteI18n {\n\n    PerspectiveEditorPaletteConstants INSTANCE = GWT.create(PerspectiveEditorPaletteConstants.class);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteI18n.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources.i18n;\n\n/**\n * Perspective Editor's component palette i18n literals\n */\npublic interface PerspectiveEditorPaletteI18n {\n\n    String coreComponentGroupName();\n\n    String navComponentGroupName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteI18nImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.resources.i18n;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class PerspectiveEditorPaletteI18nImpl implements PerspectiveEditorPaletteI18n {\n\n    @Override\n    public String coreComponentGroupName() {\n        return PerspectiveEditorPaletteConstants.INSTANCE.coreComponentGroupName();\n    }\n\n    @Override\n    public String navComponentGroupName() {\n        return PerspectiveEditorPaletteConstants.INSTANCE.navComponentGroupName();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/security/PluginController.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.security;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n@ApplicationScoped\npublic class PluginController {\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n\n    @Inject\n    public PluginController(AuthorizationManager authorizationManager,\n                            User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    public boolean canCreatePerspectives() {\n        return authorizationManager.authorize(ActivityResourceType.PERSPECTIVE,\n                                              PerspectiveAction.CREATE,\n                                              user);\n    }\n\n    public boolean canRead(Activity activity) {\n        if (PluginType.PERSPECTIVE.equals(activity.getType())\n                || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) {\n\n            Resource ref = new ResourceRef(activity.getName(),\n                                           ActivityResourceType.PERSPECTIVE);\n            return authorizationManager.authorize(ref,\n                                                  PerspectiveAction.READ,\n                                                  user);\n        }\n        return true;\n    }\n\n    public boolean canUpdate(Activity activity) {\n        if (PluginType.PERSPECTIVE.equals(activity.getType())\n                || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) {\n\n            Resource ref = new ResourceRef(activity.getName(),\n                                           ActivityResourceType.PERSPECTIVE);\n            return authorizationManager.authorize(ref,\n                                                  PerspectiveAction.UPDATE,\n                                                  user);\n        }\n        return true;\n    }\n\n    public boolean canDelete(Activity activity) {\n        if (PluginType.PERSPECTIVE.equals(activity.getType())\n                || PluginType.PERSPECTIVE_LAYOUT.equals(activity.getType())) {\n\n            Resource ref = new ResourceRef(activity.getName(),\n                                           ActivityResourceType.PERSPECTIVE);\n            return authorizationManager.authorize(ref,\n                                                  PerspectiveAction.DELETE,\n                                                  user);\n        }\n        return true;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/type/DynamicMenuResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.type.DynamicMenuResourceTypeDefinition;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class DynamicMenuResourceType\n        extends DynamicMenuResourceTypeDefinition\n        implements ClientResourceType {\n\n    public DynamicMenuResourceType() {\n    }\n\n    @Inject\n    public DynamicMenuResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return new Icon(IconType.SHARE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/type/EditorPluginResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.type.EditorPluginResourceTypeDefinition;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class EditorPluginResourceType\n        extends EditorPluginResourceTypeDefinition\n        implements ClientResourceType {\n\n    public EditorPluginResourceType() {\n    }\n\n    @Inject\n    public EditorPluginResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return new Icon(IconType.FILE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/type/PerspectiveLayoutPluginResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.type.PerspectiveLayoutPluginResourceTypeDefinition;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class PerspectiveLayoutPluginResourceType\n        extends PerspectiveLayoutPluginResourceTypeDefinition\n        implements ClientResourceType {\n\n    public PerspectiveLayoutPluginResourceType() {\n    }\n\n    @Inject\n    public PerspectiveLayoutPluginResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return new Icon(IconType.PENCIL);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/type/ScreenPluginResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.type.ScreenPluginResourceTypeDefinition;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class ScreenPluginResourceType\n        extends ScreenPluginResourceTypeDefinition\n        implements ClientResourceType {\n\n    public ScreenPluginResourceType() {\n    }\n\n    @Inject\n    public ScreenPluginResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return new Icon(IconType.DESKTOP);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/type/SplashPluginResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.type.SplashPluginResourceTypeDefinition;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class SplashPluginResourceType\n        extends SplashPluginResourceTypeDefinition\n        implements ClientResourceType {\n\n    public SplashPluginResourceType() {\n    }\n\n    @Inject\n    public SplashPluginResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return new Icon(IconType.CERTIFICATE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/validation/NameValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.validation;\n\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\n\npublic class NameValidator extends RuleValidator {\n\n    public static final String VALID_DIR_REGEX = \"^([^*\\\"\\\\/><?\\\\\\\\\\\\!|;:]*)$\";\n\n    private String emptyError;\n\n    private String invalidError;\n\n    private String error;\n\n    private NameValidator(String emptyError,\n                          String invalidError) {\n        this.emptyError = emptyError;\n        this.invalidError = invalidError;\n    }\n\n    public static NameValidator createNameValidator(String emptyError,\n                                                    String invalidError) {\n        return new NameValidator(emptyError,\n                                 invalidError);\n    }\n\n    public static NameValidator tagNameValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.EmptyTagName(),\n                                 CommonConstants.INSTANCE.InvalidTagName());\n    }\n\n    public static NameValidator parameterNameValidator() {\n        return new NameValidator(CommonConstants.INSTANCE.EmptyParameterName(),\n                                 CommonConstants.INSTANCE.InvalidParameterName());\n    }\n\n    public String getValidationError() {\n        return error;\n    }\n\n    public boolean isValid(String dirName) {\n        if (dirName == null || dirName.trim().isEmpty()) {\n            this.error = this.emptyError;\n            return Boolean.FALSE;\n        }\n\n        if (!dirName.matches(VALID_DIR_REGEX)) {\n            this.error = this.invalidError;\n            return Boolean.FALSE;\n        }\n\n        this.error = null;\n        return Boolean.TRUE;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/validation/PluginNameValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.validation;\n\nimport java.util.Collection;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.ext.editor.commons.client.validation.DefaultFileNameValidator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorCallback;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.ext.plugin.client.info.PluginsInfo;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\n\n@ApplicationScoped\npublic class PluginNameValidator implements Validator {\n\n    @Inject\n    Caller<PluginServices> pluginServices;\n    @Inject\n    private PluginsInfo pluginsInfo;\n    @Inject\n    private DefaultFileNameValidator defaultFileNameValidator;\n\n    @Override\n    public void validate(final String name,\n                         final ValidatorCallback callback) {\n        validateName(name,\n                     new ValidatorWithReasonCallback() {\n\n                         @Override\n                         public void onFailure(final String reason) {\n                             if (shouldGiveReasonOfValidationError(callback)) {\n                                 ((ValidatorWithReasonCallback) callback).onFailure(reason);\n                             } else {\n                                 callback.onFailure();\n                             }\n                         }\n\n                         @Override\n                         public void onSuccess() {\n                             defaultFileNameValidator.validate(name,\n                                                               callback);\n                         }\n\n                         @Override\n                         public void onFailure() {\n                             callback.onFailure();\n                         }\n                     });\n    }\n\n    private boolean shouldGiveReasonOfValidationError(final ValidatorCallback callback) {\n        return callback instanceof ValidatorWithReasonCallback;\n    }\n\n    protected void validateName(final String name,\n                                final ValidatorWithReasonCallback callback) {\n        final String nameWithoutExtension = (name.lastIndexOf(\".\") >= 0\n                ? name.substring(0,\n                                 name.lastIndexOf(\".\")) : name);\n        final RuleValidator nameValidator = getNameValidator();\n\n        if (!nameValidator.isValid(nameWithoutExtension)) {\n            callback.onFailure(nameValidator.getValidationError());\n            return;\n        }\n\n        pluginServices.call(new RemoteCallback<Collection<Plugin>>() {\n            @Override\n            public void callback(final Collection<Plugin> plugins) {\n                Set<Activity> activities = pluginsInfo.getAllPlugins(plugins);\n\n                for (Activity activity : activities) {\n                    if (activity.getName().equalsIgnoreCase(nameWithoutExtension)) {\n                        callback.onFailure(ValidationErrorReason.DUPLICATED_NAME.name());\n                        return;\n                    }\n                }\n\n                callback.onSuccess();\n            }\n        }).listPlugins();\n    }\n\n    private RuleValidator getNameValidator() {\n        return NameValidator.createNameValidator(ValidationErrorReason.EMPTY_NAME.name(),\n                                                 ValidationErrorReason.INVALID_NAME.name());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/validation/RuleValidator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.validation;\n\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\npublic abstract class RuleValidator {\n\n    public abstract boolean isValid(String value);\n\n    public abstract String getValidationError();\n\n    public boolean validateFieldInline(String value,\n                                       FormGroup field,\n                                       HelpBlock help) {\n        if (!isValid(value)) {\n            field.setValidationState(ValidationState.ERROR);\n            help.setText(getValidationError());\n            return false;\n        } else {\n            field.setValidationState(ValidationState.NONE);\n            help.setText(\"\");\n            return true;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/cell/IconCell.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.cell;\n\nimport com.google.gwt.cell.client.AbstractSafeHtmlCell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.EventTarget;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.text.shared.SimpleSafeHtmlRenderer;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\nimport static com.google.gwt.dom.client.BrowserEvents.CLICK;\nimport static com.google.gwt.dom.client.BrowserEvents.KEYDOWN;\n\npublic class IconCell extends AbstractSafeHtmlCell<String> {\n\n    private IconType iconType;\n    private IconSize iconSize;\n    private String tooltip;\n\n    /**\n     * Construct a new {@link IconCell} with the specified icon type\n     * @param iconType\n     */\n    public IconCell(IconType iconType) {\n        this(iconType,\n             IconSize.NONE);\n    }\n\n    /**\n     * Construct a new {@link IconCell} with the specified icon type and icon size\n     * @param iconType\n     * @param iconSize\n     */\n    public IconCell(IconType iconType,\n                    IconSize iconSize) {\n        super(SimpleSafeHtmlRenderer.getInstance(),\n              CLICK,\n              KEYDOWN);\n        this.iconType = iconType;\n        this.iconSize = iconSize;\n    }\n\n    public IconType getIconType() {\n        return iconType;\n    }\n\n    public void setIconType(IconType iconType) {\n        this.iconType = iconType;\n    }\n\n    public IconSize getIconSize() {\n        return iconSize;\n    }\n\n    public void setIconSize(IconSize iconSize) {\n        this.iconSize = iconSize;\n    }\n\n    public String getTooltip() {\n        return tooltip;\n    }\n\n    public void setTooltip(String tooltip) {\n        this.tooltip = tooltip;\n    }\n\n    @Override\n    protected void render(Context context,\n                          SafeHtml data,\n                          SafeHtmlBuilder sb) {\n        Icon icon = GWT.create(Icon.class);\n        if (tooltip != null) {\n            icon.setTitle(tooltip);\n        }\n        icon.setSize(iconSize);\n        icon.setType(iconType);\n        sb.appendHtmlConstant(icon.getElement().getString());\n    }\n\n    @Override\n    public void onBrowserEvent(final Context context,\n                               final Element parent,\n                               final String value,\n                               final NativeEvent event,\n                               final ValueUpdater<String> valueUpdater) {\n        super.onBrowserEvent(context,\n                             parent,\n                             value,\n                             event,\n                             valueUpdater);\n        if (CLICK.equals(event.getType())) {\n            EventTarget eventTarget = event.getEventTarget();\n            if (!Element.is(eventTarget)) {\n                return;\n            }\n            if (parent.getFirstChildElement().isOrHasChild(Element.as(eventTarget))) {\n                // Ignore clicks that occur outside of the main element.\n                onEnterKeyDown(context,\n                               parent,\n                               value,\n                               event,\n                               valueUpdater);\n            }\n        }\n    }\n\n    @Override\n    protected void onEnterKeyDown(final Context context,\n                                  final Element parent,\n                                  final String value,\n                                  final NativeEvent event,\n                                  final ValueUpdater<String> valueUpdater) {\n        if (valueUpdater != null) {\n            valueUpdater.update(value);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/media/MediaLibraryWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.media;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.FormPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Caption;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.ThumbnailPanel;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.gwtbootstrap3.client.ui.constants.ColumnSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.ImageType;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.plugin.client.config.PluginConfigService;\nimport org.uberfire.ext.plugin.event.MediaAdded;\nimport org.uberfire.ext.plugin.event.MediaDeleted;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.widgets.common.client.common.FileUpload;\nimport org.uberfire.ext.widgets.common.client.common.FileUploadFormEncoder;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class MediaLibraryWidget extends Composite implements RequiresResize {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel content;\n    @UiField\n    Form form;\n    @UiField(provided = true)\n    FileUpload fileUpload;\n    @UiField\n    Row library;\n    private FileUploadFormEncoder formEncoder = new FileUploadFormEncoder();\n    @Inject\n    private PluginConfigService pluginConfigService;\n    private String pluginName;\n    private ParameterizedCommand<Media> onMediaDelete;\n    private Map<Path, IsWidget> mediaRef = new HashMap<Path, IsWidget>();\n    private List<Command> updateMediaOnSaveCommands = new ArrayList<>();\n    private List<Command> updateMediaOnCloseCommands = new ArrayList<>();\n\n    @PostConstruct\n    public void init() {\n        fileUpload = createFileUpload();\n\n        initWidget(uiBinder.createAndBindUi(this));\n\n        form.setEncoding(FormPanel.ENCODING_MULTIPART);\n        form.setMethod(FormPanel.METHOD_POST);\n\n        formEncoder.addUtf8Charset(form);\n\n        form.addSubmitHandler(new AbstractForm.SubmitHandler() {\n            @Override\n            public void onSubmit(final AbstractForm.SubmitEvent event) {\n                final String fileName = fileUpload.getFilename();\n                if (isNullOrEmpty(fileName)) {\n                    event.cancel();\n                }\n            }\n\n            private boolean isNullOrEmpty(final String fileName) {\n                return fileName == null || \"\".equals(fileName);\n            }\n        });\n\n        form.addSubmitCompleteHandler(new AbstractForm.SubmitCompleteHandler() {\n            @Override\n            public void onSubmitComplete(final AbstractForm.SubmitCompleteEvent event) {\n                if (\"OK\".equalsIgnoreCase(event.getResults())) {\n                    Window.alert(\"Upload Success\");\n                } else if (\"FAIL\".equalsIgnoreCase(event.getResults())) {\n                    Window.alert(\"Upload Failed\");\n                } else if (\"FAIL - ALREADY EXISTS\".equalsIgnoreCase(event.getResults())) {\n                    Window.alert(\"File already exists\");\n                }\n            }\n        });\n    }\n\n    public void setup(final String pluginName,\n                      final Collection<Media> mediaLibrary,\n                      final ParameterizedCommand<Media> onMediaDelete) {\n        this.pluginName = pluginName;\n        this.onMediaDelete = onMediaDelete;\n\n        this.mediaRef.clear();\n        this.library.clear();\n\n        for (final Media media : mediaLibrary) {\n            addMedia(media);\n        }\n    }\n\n    private FileUpload createFileUpload() {\n        return new FileUpload(new Command() {\n            @Override\n            public void execute() {\n                form.setAction(GWT.getHostPageBaseURL().replaceAll(\"/\" + GWT.getModuleName(),\n                                                                   \"\") + pluginConfigService.getMediaServletURI() + pluginName);\n                form.submit();\n            }\n        },\n                              true);\n    }\n\n    @Override\n    public void onResize() {\n        getParent().getElement().getStyle().setBackgroundColor(\"#F6F6F6\");\n        content.getElement().getStyle().setTop(60,\n                                               Style.Unit.PX);\n    }\n\n    public void onNewMedia(@Observes final MediaAdded mediaAddedEvent) {\n        if (mediaAddedEvent.getPluginName().equals(pluginName)) {\n            final Media media = mediaAddedEvent.getMedia();\n\n            addMedia(media);\n\n            updateMediaOnCloseCommands.add(new Command() {\n                @Override\n                public void execute() {\n                    onMediaDelete.execute(media);\n                }\n            });\n        }\n    }\n\n    public void onMediaDelete(@Observes final MediaDeleted mediaDeleted) {\n        if (mediaDeleted.getPluginName().equals(pluginName)) {\n            final IsWidget thumb = mediaRef.get(mediaDeleted.getMedia().getPath());\n            if (thumb != null) {\n                library.remove(thumb);\n            }\n        }\n    }\n\n    public void addMedia(final Media media) {\n\n        final Column column = new Column(ColumnSize.XS_4);\n\n        final Button trash = new Button();\n        trash.setIcon(IconType.TRASH);\n\n        final ThumbnailPanel thumbnail = new ThumbnailPanel() {{\n            add(new Image(media.getPreviewURI()) {{\n                setType(ImageType.CIRCLE);\n                setHeight(\"140px\");\n                setWidth(\"140px\");\n            }});\n            add(new Caption() {{\n                add(new Paragraph(media.getExternalURI()) {{\n                    getElement().getStyle().setProperty(\"maxWidth\",\n                                                        \"180px\");\n                }});\n                add(new Paragraph() {{\n                    add(trash);\n                }});\n            }});\n        }};\n\n        trash.addClickHandler(getTrashClickHandler(media,\n                                                   column));\n\n        column.add(thumbnail);\n        library.add(column);\n\n        mediaRef.put(media.getPath(),\n                     column);\n    }\n\n    private ClickHandler getTrashClickHandler(final Media media,\n                                              final Column column) {\n        return event -> {\n            mediaRef.remove(media.getPath());\n            updateMediaOnSaveCommands.add(new Command() {\n                @Override\n                public void execute() {\n                    onMediaDelete.execute(media);\n                }\n            });\n            library.remove(column);\n        };\n    }\n\n    public void updateMediaOnClose() {\n        for (Command command : updateMediaOnCloseCommands) {\n            command.execute();\n        }\n    }\n\n    public void updateMediaOnSave() {\n        for (Command command : updateMediaOnSaveCommands) {\n            command.execute();\n        }\n        updateMediaOnCloseCommands = new ArrayList<>();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, MediaLibraryWidget> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/media/MediaLibraryWidget.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:c=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n  <ui:style>\n    .reset-thumbs {\n      margin-left: 0 !important;\n    }\n\n    .top-margin {\n      margin: 10px 60px !important;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"content\">\n    <b:Form ui:field=\"form\" addStyleNames=\"{style.top-margin}\">\n      <c:FileUpload ui:field=\"fileUpload\" name=\"fileUpload\"/>\n    </b:Form>\n    <b:Container>\n      <b:Row ui:field=\"library\"/>\n    </b:Container>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/navigator/PluginNavList.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.navigator;\n\nimport java.util.Collection;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.TreeMap;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.LinkedGroup;\nimport org.gwtbootstrap3.client.ui.LinkedGroupItem;\nimport org.gwtbootstrap3.client.ui.ListGroupItem;\nimport org.gwtbootstrap3.client.ui.Panel;\nimport org.gwtbootstrap3.client.ui.PanelBody;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.client.info.PluginsInfo;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.ext.plugin.event.BasePluginEvent;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.widgets.common.client.accordion.TriggerWidget;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.uberfire.ext.plugin.type.TypeConverterUtil.fromResourceType;\n\n@Dependent\npublic class PluginNavList extends Composite {\n\n    private static final Comparator<String> PLUGIN_NAME_COMPARATOR = new Comparator<String>() {\n        @Override\n        public int compare(final String o1,\n                           final String o2) {\n            return o1.compareToIgnoreCase(o2);\n        }\n    };\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    private final Map<PluginType, LinkedGroup> listGroups = new HashMap<PluginType, LinkedGroup>();\n    @UiField\n    PanelGroup pluginsList;\n\n    @Inject\n    private ActivityManager activityManager;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private PluginsInfo pluginsInfo;\n\n    @Inject\n    private PluginController pluginController;\n\n    private Map<String, Widget> pluginRef = new HashMap<String, Widget>();\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n        pluginsList.setId(DOM.createUniqueId());\n    }\n\n    public void setup(final Collection<Plugin> plugins) {\n        final Map<ClientResourceType, Set<Activity>> classified = pluginsInfo.getClassifiedPlugins(plugins);\n        final Map<ClientResourceType, String> labelsByResourceType = pluginsInfo.getPluginsTypeLabels();\n\n        pluginsList.clear();\n\n        for (final Map.Entry<ClientResourceType, Set<Activity>> entry : classified.entrySet()) {\n            final LinkedGroup itemsNavList = new LinkedGroup();\n            final PluginType type = fromResourceType(entry.getKey());\n\n            final PanelCollapse collapse = new PanelCollapse();\n\n            listGroups.put(type,\n                           itemsNavList);\n\n            //Sort Activities by Name. A TreeMap supports sorting on insertion by natural ordering of its keys\n            final Map<String, Activity> activities = new TreeMap<String, Activity>(PLUGIN_NAME_COMPARATOR);\n            for (final Activity item : entry.getValue()) {\n                if (!thereIsAlreadyAPluginWithSameName(item,\n                                                       activities)) {\n                    activities.put(item.getName(),\n                                   item);\n                }\n            }\n            for (final Activity item : activities.values()) {\n                Widget itemNavLink = makeItemNavLink(item);\n                if (itemNavLink != null) {\n                    itemsNavList.add(itemNavLink);\n                }\n            }\n\n            final PanelBody body = new PanelBody();\n\n            body.add(itemsNavList);\n            collapse.add(body);\n\n            pluginsList.add(new Panel() {{\n                add(new TriggerWidget(entry.getKey().getIcon(),\n                                      labelsByResourceType.get(entry.getKey())) {{\n                    setDataToggle(Toggle.COLLAPSE);\n                    setDataParent(pluginsList.getId());\n                    setDataTargetWidget(collapse);\n                }});\n                add(collapse);\n            }});\n        }\n    }\n\n    private boolean thereIsAlreadyAPluginWithSameName(Activity item,\n                                                      Map<String, Activity> activities) {\n        final Activity activity = activities.get(item.getName());\n        return activity != null && activity instanceof Plugin;\n    }\n\n    private Widget makeItemNavLink(final Activity activity) {\n        if (!pluginController.canRead(activity)) {\n            return null;\n        }\n        final Widget nav;\n        if (activity instanceof Plugin) {\n            nav = new LinkedGroupItem() {{\n                setText(activity.getName());\n                getElement().getStyle().setProperty(\"textDecoration\",\n                                                    \"underline\");\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent event) {\n                        placeManager.goTo(new PathPlaceRequest(((Plugin) activity).getPath()).addParameter(\"name\",\n                                                                                                           activity.getName()));\n                    }\n                });\n            }};\n        } else {\n            nav = new ListGroupItem() {{\n                setText(activity.getName());\n            }};\n        }\n        pluginRef.put(activity.getName(),\n                      nav);\n\n        return pluginRef.get(activity.getName());\n    }\n\n    public void onPlugInAdded(@Observes final PluginAdded pluginAdded) {\n        addNewPlugin(pluginAdded);\n    }\n\n    public void addNewPlugin(final BasePluginEvent newPlugin) {\n        //Sort Widgets by Plugin Name. A TreeMap supports sorting on insertion by natural ordering of its keys\n        final Map<String, Widget> sortedNavList = new TreeMap<String, Widget>(PLUGIN_NAME_COMPARATOR);\n        final LinkedGroup navList = listGroups.get(newPlugin.getPlugin().getType());\n        for (int i = 0; i < navList.getWidgetCount(); i++) {\n            final Widget w = navList.getWidget(i);\n            for (Map.Entry<String, Widget> e : pluginRef.entrySet()) {\n                if (e.getValue().equals(w)) {\n                    sortedNavList.put(e.getKey(),\n                                      e.getValue());\n                }\n            }\n        }\n        Widget itemNavLink = makeItemNavLink(newPlugin.getPlugin());\n        if (itemNavLink != null) {\n            sortedNavList.put(newPlugin.getPlugin().getName(),\n                              itemNavLink);\n        }\n\n        navList.clear();\n        for (Widget w : sortedNavList.values()) {\n            navList.add(w);\n        }\n    }\n\n    public void onPlugInRenamed(@Observes final PluginRenamed pluginRenamed) {\n        final Widget nav = pluginRef.get(pluginRenamed.getOldPluginName());\n        if (nav != null) {\n            nav.removeFromParent();\n        }\n        addNewPlugin(pluginRenamed);\n    }\n\n    public void onPlugInDeleted(@Observes final PluginDeleted pluginDeleted) {\n        final Widget nav = pluginRef.get(pluginDeleted.getPlugin().getName());\n        if (nav != null) {\n            nav.removeFromParent();\n        }\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, PluginNavList> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/navigator/PluginNavList.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Well>\n    <b:PanelGroup ui:field=\"pluginsList\"/>\n  </b:Well>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/plugin/GeneralPluginEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.plugin;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.NavPills;\nimport org.uberfire.ext.plugin.client.code.CodeElement;\nimport org.uberfire.ext.plugin.client.widget.media.MediaLibraryWidget;\nimport org.uberfire.ext.plugin.client.widget.split.HorizontalSplit;\nimport org.uberfire.ext.plugin.client.widget.split.VerticalSplit;\nimport org.uberfire.ext.plugin.model.CodeType;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditor;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorMode;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorTheme;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class GeneralPluginEditor extends Composite implements RequiresResize {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel content;\n    @UiField\n    VerticalSplit verticalSplit;\n    @UiField\n    HorizontalSplit leftHorizontalSplit;\n    @UiField\n    HorizontalSplit rightHorizontalSplit;\n    @UiField\n    FlowPanel leftArea;\n    @UiField\n    FlowPanel leftTopArea;\n    @UiField\n    FlowPanel leftTopContent;\n    @UiField\n    FlowPanel leftBottomArea;\n    @UiField\n    FlowPanel leftBottomContent;\n    @UiField\n    FlowPanel rightArea;\n    @UiField\n    FlowPanel rightTopArea;\n    @UiField\n    FlowPanel rightTopContent;\n    @UiField\n    FlowPanel rightBottomArea;\n    @UiField\n    NavPills lifecycleHolder;\n    @UiField\n    Button lifecycle;\n    @UiField\n    DropDownMenu lifecycles;\n    @UiField\n    FlowPanel rightBottomContent;\n    @Inject\n    private MediaLibraryWidget mediaLibraryWidget;\n    @Inject\n    private AceEditor templateEditor;\n    @Inject\n    private AceEditor cssEditor;\n    @Inject\n    private AceEditor jsEditor;\n    final Command editorResizing = new Command() {\n        @Override\n        public void execute() {\n            templateEditor.redisplay();\n            cssEditor.redisplay();\n\n            Double editorHeight = 100 - (((double) lifecycleHolder.getOffsetHeight() / leftBottomArea.getOffsetHeight()) * 100);\n            if (Double.isNaN(editorHeight) || editorHeight.doubleValue() <= 0d) {\n                return;\n            }\n            jsEditor.setHeight(editorHeight + \"%\");\n            jsEditor.redisplay();\n        }\n    };\n    private Map<CodeType, String> codeMap = new HashMap<CodeType, String>();\n    private CodeType currentElement = null;\n    final ParameterizedCommand<CodeType> codeChange = new ParameterizedCommand<CodeType>() {\n        @Override\n        public void execute(final CodeType parameter) {\n            codeMap.put(currentElement,\n                        jsEditor.getText());\n            currentElement = parameter;\n            final String content = codeMap.get(currentElement);\n            if (content != null) {\n                jsEditor.setText(content);\n            } else {\n                jsEditor.setText(\"\");\n            }\n            jsEditor.setFocus();\n        }\n    };\n    private PluginContent pluginContent;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        rightBottomContent.add(mediaLibraryWidget);\n\n        verticalSplit.init(leftArea,\n                           rightArea,\n                           content,\n                           editorResizing);\n        leftHorizontalSplit.init(leftTopArea,\n                                 leftBottomArea,\n                                 content,\n                                 editorResizing);\n        rightHorizontalSplit.init(rightTopArea,\n                                  rightBottomArea,\n                                  content,\n                                  editorResizing);\n\n        setupEditor(templateEditor,\n                    leftTopContent);\n        setupEditor(cssEditor,\n                    rightTopContent);\n        setupEditor(jsEditor,\n                    leftBottomContent);\n\n        templateEditor.startEditor();\n        templateEditor.setMode(AceEditorMode.HTML);\n        templateEditor.setTheme(AceEditorTheme.CHROME);\n\n        cssEditor.startEditor();\n        cssEditor.setMode(AceEditorMode.CSS);\n        cssEditor.setTheme(AceEditorTheme.CHROME);\n\n        jsEditor.startEditor();\n        jsEditor.setMode(AceEditorMode.JAVASCRIPT);\n        jsEditor.setTheme(AceEditorTheme.CHROME);\n    }\n\n    public void setup(final CodeElement... elements) {\n        lifecycle.setIcon(elements[0].getIcon());\n        lifecycle.setText(elements[0].toString());\n        currentElement = elements[0].getType();\n\n        for (final CodeElement element : elements) {\n            element.addNav(lifecycles,\n                           lifecycle,\n                           codeChange);\n        }\n    }\n\n    public void setupContent(final PluginContent pluginContent,\n                             final ParameterizedCommand<Media> onMediaDelete) {\n\n        codeMap.clear();\n\n        for (final Map.Entry<CodeType, String> entry : pluginContent.getCodeMap().entrySet()) {\n            codeMap.put(entry.getKey(),\n                        entry.getValue());\n        }\n\n        jsEditor.setText(codeMap.get(currentElement));\n        templateEditor.setText(pluginContent.getTemplate());\n        cssEditor.setText(pluginContent.getCss());\n\n        mediaLibraryWidget.setup(pluginContent.getName(),\n                                 pluginContent.getMediaLibrary(),\n                                 onMediaDelete);\n\n        this.pluginContent = pluginContent;\n    }\n\n    private void setupEditor(final AceEditor editor,\n                             final FlowPanel content) {\n        editor.setWidth(\"100%\");\n        editor.setHeight(\"100%\");\n\n        content.add(editor);\n    }\n\n    public PluginContent getContent() {\n        return pluginContent;\n    }\n\n    public boolean isDirty() {\n        return false;\n    }\n\n    public Map<CodeType, String> getCodeMap() {\n        codeMap.put(currentElement,\n                    jsEditor.getText());\n        return codeMap;\n    }\n\n    public String getTemplate() {\n        return templateEditor.getText();\n    }\n\n    public String getCss() {\n        return cssEditor.getText();\n    }\n\n    @Override\n    public void onResize() {\n        getParent().getElement().getStyle().setBackgroundColor(\"#F6F6F6\");\n        content.getElement().getStyle().setTop(60,\n                                               Style.Unit.PX);\n        verticalSplit.getElement().getStyle().setLeft(leftArea.getOffsetWidth() - 3,\n                                                      Style.Unit.PX);\n        leftHorizontalSplit.getElement().getStyle().setTop(leftTopArea.getOffsetHeight() - 6,\n                                                           Style.Unit.PX);\n        rightHorizontalSplit.getElement().getStyle().setTop(rightTopArea.getOffsetHeight() - 6,\n                                                            Style.Unit.PX);\n        editorResizing.execute();\n    }\n\n    public void onSave() {\n        mediaLibraryWidget.updateMediaOnSave();\n    }\n\n    public void onClose() {\n        mediaLibraryWidget.updateMediaOnClose();\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, GeneralPluginEditor> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/plugin/GeneralPluginEditor.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:c=\"urn:import:org.uberfire.ext.plugin.client.widget.split\">\n\n  <ui:with field='res' type='org.uberfire.ext.plugin.client.resources.WebAppResource'/>\n\n  <ui:style>\n    .lifecycle {\n      width: 100%;\n      margin-bottom: 0 !important;\n      padding-bottom: 0 !important;\n    }\n  </ui:style>\n\n\n  <g:FlowPanel addStyleNames=\"{res.CSS.content}\" ui:field=\"content\">\n    <g:FlowPanel addStyleNames=\"{res.CSS.column} {res.CSS.left}\" ui:field=\"leftArea\">\n      <g:FlowPanel addStyleNames=\"{res.CSS.window} {res.CSS.top}\" ui:field=\"leftTopArea\">\n        <g:InlineLabel addStyleNames=\"{res.CSS.windowLabel}\">Template</g:InlineLabel>\n        <g:FlowPanel addStyleNames=\"{res.CSS.editorWrapping}\" ui:field=\"leftTopContent\"/>\n      </g:FlowPanel>\n      <c:HorizontalSplit addStyleNames=\"{res.CSS.handlerHorizontal}\" ui:field=\"leftHorizontalSplit\"/>\n      <g:FlowPanel addStyleNames=\"{res.CSS.window} {res.CSS.bottom}\" ui:field=\"leftBottomArea\">\n        <g:InlineLabel addStyleNames=\"{res.CSS.windowLabel}\">JavaScript</g:InlineLabel>\n        <b:NavPills addStyleNames=\"{style.lifecycle}\" ui:field=\"lifecycleHolder\">\n          <b:ButtonGroup>\n            <b:Button ui:field=\"lifecycle\" dataToggle=\"DROPDOWN\" toggleCaret=\"true\" icon=\"BOLT\" width=\"100%\"/>\n            <b:DropDownMenu ui:field=\"lifecycles\"/>\n          </b:ButtonGroup>\n        </b:NavPills>\n        <g:FlowPanel addStyleNames=\"{res.CSS.editorWrapping}\" ui:field=\"leftBottomContent\"/>\n      </g:FlowPanel>\n    </g:FlowPanel>\n\n    <c:VerticalSplit addStyleNames=\"{res.CSS.handlerVertical}\" ui:field=\"verticalSplit\"/>\n    <g:FlowPanel addStyleNames=\"{res.CSS.column} {res.CSS.right}\" ui:field=\"rightArea\">\n      <g:FlowPanel addStyleNames=\"{res.CSS.window} {res.CSS.top}\" ui:field=\"rightTopArea\">\n        <g:InlineLabel addStyleNames=\"{res.CSS.windowLabel}\">CSS</g:InlineLabel>\n        <g:FlowPanel addStyleNames=\"{res.CSS.editorWrapping}\" ui:field=\"rightTopContent\"/>\n      </g:FlowPanel>\n      <c:HorizontalSplit addStyleNames=\"{res.CSS.handlerHorizontal}\" ui:field=\"rightHorizontalSplit\"/>\n      <g:FlowPanel addStyleNames=\"{res.CSS.window} {res.CSS.bottom}\" ui:field=\"rightBottomArea\">\n        <g:InlineLabel addStyleNames=\"{res.CSS.windowLabel}\">Media</g:InlineLabel>\n        <g:FlowPanel addStyleNames=\"{res.CSS.editorWrapping} {res.CSS.mediaLib}\" ui:field=\"rightBottomContent\"/>\n      </g:FlowPanel>\n    </g:FlowPanel>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/popup/NewPluginPopUp.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.popup;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.ext.plugin.client.validation.NameValidator;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.client.validation.RuleValidator;\nimport org.uberfire.ext.plugin.exception.PluginAlreadyExists;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@ApplicationScoped\npublic class NewPluginPopUp implements NewPluginPopUpView.Presenter {\n\n    @Inject\n    Caller<PluginServices> pluginServices;\n    @Inject\n    PlaceManager placeManager;\n    @Inject\n    PluginNameValidator pluginNameValidator;\n    private NewPluginPopUpView view;\n\n    // For proxying\n    protected NewPluginPopUp() {\n    }\n\n    @Inject\n    public NewPluginPopUp(final NewPluginPopUpView view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public RuleValidator getNameValidator() {\n        return NameValidator.createNameValidator(view.emptyName(),\n                                                 view.invalidName());\n    }\n\n    @Override\n    public void onOK(final String name,\n                     final PluginType type) {\n\n        pluginNameValidator.validate(name + \".plugin\",\n                                     new ValidatorWithReasonCallback() {\n                                         @Override\n                                         public void onFailure(final String reason) {\n                                             if (ValidationErrorReason.EMPTY_NAME.name().equals(reason)) {\n                                                 view.handleNameValidationError(view.emptyName());\n                                             } else if (ValidationErrorReason.DUPLICATED_NAME.name().equals(reason)) {\n                                                 view.handleNameValidationError(view.duplicatedName());\n                                             } else {\n                                                 view.handleNameValidationError(view.invalidName());\n                                             }\n                                         }\n\n                                         @Override\n                                         public void onSuccess() {\n                                             pluginServices.call(new RemoteCallback<Plugin>() {\n                                                                     @Override\n                                                                     public void callback(final Plugin response) {\n                                                                         placeManager.goTo(getPathPlaceRequest(response));\n                                                                         hide();\n                                                                     }\n                                                                 },\n                                                                 new ErrorCallback<Object>() {\n                                                                     @Override\n                                                                     public boolean error(final Object message,\n                                                                                          final Throwable throwable) {\n                                                                         if (throwable instanceof PluginAlreadyExists) {\n                                                                             view.handleNameValidationError(view.duplicatedName());\n                                                                         } else {\n                                                                             view.handleNameValidationError(view.invalidName());\n                                                                         }\n                                                                         return false;\n                                                                     }\n                                                                 }).createNewPlugin(name,\n                                                                                    type);\n                                         }\n\n                                         @Override\n                                         public void onFailure() {\n                                             view.handleNameValidationError(view.invalidName());\n                                         }\n                                     });\n    }\n\n    protected PlaceRequest getPathPlaceRequest(Plugin response) {\n        return new PathPlaceRequest(response.getPath()).addParameter(\"name\",\n                                                                     response.getName());\n    }\n\n    @Override\n    public void onCancel() {\n        hide();\n    }\n\n    public void show(final PluginType type) {\n        view.show(type);\n    }\n\n    private void hide() {\n        view.hide();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/popup/NewPluginPopUpView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.popup;\n\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.plugin.client.validation.RuleValidator;\nimport org.uberfire.ext.plugin.model.PluginType;\n\npublic interface NewPluginPopUpView extends UberView<NewPluginPopUpView.Presenter> {\n\n    void show(final PluginType type);\n\n    void hide();\n\n    String emptyName();\n\n    String invalidName();\n\n    String duplicatedName();\n\n    void handleNameValidationError(String errorMessage);\n\n    interface Presenter {\n\n        void onOK(String name,\n                  PluginType type);\n\n        void onCancel();\n\n        RuleValidator getNameValidator();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/popup/NewPluginPopUpViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.popup;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.plugin.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKCancelButtons;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class NewPluginPopUpViewImpl extends BaseModal implements NewPluginPopUpView {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    TextBox name;\n    @UiField\n    HelpBlock nameHelpInline;\n    @UiField\n    FormGroup nameGroup;\n    private NewPluginPopUpView.Presenter presenter;\n    private final Command cancelCommand = new Command() {\n        @Override\n        public void execute() {\n            presenter.onCancel();\n        }\n    };\n    private PluginType type;\n    private final Command okCommand = new Command() {\n        @Override\n        public void execute() {\n            onOKButtonClick();\n        }\n    };\n\n    private final ModalFooterOKCancelButtons footer = new ModalFooterOKCancelButtons(okCommand,\n                                                                                     cancelCommand);\n\n    public void init(NewPluginPopUpView.Presenter presenter) {\n        this.presenter = presenter;\n\n        footer.enableOkButton(true);\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(NewPluginPopUpViewImpl.this));\n        }});\n        add(footer);\n    }\n\n    public void show(final PluginType type) {\n        this.type = checkNotNull(\"type\",\n                                 type);\n\n        name.setText(\"\");\n        nameHelpInline.setText(\"\");\n        nameGroup.setValidationState(ValidationState.NONE);\n\n        switch (this.type) {\n            case PERSPECTIVE:\n                setTitle(CommonConstants.INSTANCE.NewPerspectivePopUpTitle());\n                break;\n            case PERSPECTIVE_LAYOUT:\n                setTitle(CommonConstants.INSTANCE.NewPerspectiveLayoutPopUpTitle());\n                break;\n            case SCREEN:\n                setTitle(CommonConstants.INSTANCE.NewScreenPopUpTitle());\n                break;\n            case EDITOR:\n                setTitle(CommonConstants.INSTANCE.NewEditorPopUpTitle());\n                break;\n            case SPLASH:\n                setTitle(CommonConstants.INSTANCE.NewSplashScreenPopUpTitle());\n                break;\n            case DYNAMIC_MENU:\n                setTitle(CommonConstants.INSTANCE.NewDynamicMenuPopUpTitle());\n                break;\n        }\n        super.show();\n    }\n\n    private void onOKButtonClick() {\n        presenter.onOK(name.getText(),\n                       type);\n    }\n\n    @Override\n    public void handleNameValidationError(String errorMessage) {\n        nameGroup.setValidationState(ValidationState.ERROR);\n        nameHelpInline.setText(errorMessage);\n    }\n\n    public String emptyName() {\n        return \"Name is mandatory.\";\n    }\n\n    public String invalidName() {\n        return \"Invalid plugin name.\";\n    }\n\n    public String duplicatedName() {\n        return \"Plugin name already exists.\";\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, NewPluginPopUpViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/popup/NewPluginPopUpViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .required {\n      color: red;\n      margin-right: 3px;\n    }\n    .right {\n      text-align: right;\n    }\n  </ui:style>\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.plugin.client.resources.i18n.CommonConstants\"/>\n\n  <b:Form type=\"HORIZONTAL\">\n    <b:FormGroup ui:field=\"nameGroup\">\n      <g:FlowPanel addStyleNames=\"{style.right} col-sm-3\">\n        <g:InlineLabel addStyleNames=\"{style.required}\">*</g:InlineLabel>\n        <b:FormLabel text=\"{i18n.Name}\"/>\n      </g:FlowPanel>\n      <g:FlowPanel addStyleNames=\"col-sm-9\">\n        <b:TextBox ui:field=\"name\"/>\n        <b:HelpBlock ui:field=\"nameHelpInline\"/>\n      </g:FlowPanel>\n    </b:FormGroup>\n  </b:Form>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/split/HorizontalSplit.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.split;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.mvp.Command;\n\npublic class HorizontalSplit extends Splitter {\n\n    private double offset;\n    private Widget topArea;\n    private Widget bottomArea;\n    private Widget contentArea;\n    private Command onResize;\n\n    public HorizontalSplit() {\n        super();\n        addDomHandler(new MouseMoveHandler() {\n                          @Override\n                          public void onMouseMove(MouseMoveEvent event) {\n                              if (mouseDown) {\n                                  double topHeightPct = ((event.getClientY() - getContentAbsoluteTop() - offset) / getContentHeight()) * 100;\n                                  double bottomHeightPct = 100 - topHeightPct;\n                                  setTopAreaHeight(topHeightPct);\n                                  setBottomHeight(bottomHeightPct);\n                                  getElement().getStyle().setTop(topArea.getOffsetHeight() - 6,\n                                                                 Style.Unit.PX);\n                                  onResize.execute();\n                                  event.preventDefault();\n                              }\n                          }\n                      },\n                      MouseMoveEvent.getType());\n    }\n\n    @Override\n    protected void buildOffset(MouseDownEvent event) {\n        offset = event.getClientY() - getAbsoluteTop();\n    }\n\n    public void init(final Widget topArea,\n                     final Widget bottomArea,\n                     final Widget contentArea,\n                     final Command onResize) {\n        this.topArea = topArea;\n        this.bottomArea = bottomArea;\n        this.contentArea = contentArea;\n        this.onResize = onResize;\n    }\n\n    private void setBottomHeight(double height) {\n        bottomArea.setHeight(height + \"%\");\n    }\n\n    private void setTopAreaHeight(double height) {\n        topArea.setHeight(height + \"%\");\n    }\n\n    private int getContentHeight() {\n        return contentArea.getOffsetHeight();\n    }\n\n    private int getContentAbsoluteTop() {\n        return contentArea.getAbsoluteTop();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/split/Splitter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.split;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.FlowPanel;\n\npublic abstract class Splitter extends FlowPanel {\n\n    protected static Element glassElem = null;\n\n    protected boolean mouseDown;\n\n    public Splitter() {\n        if (glassElem == null) {\n            glassElem = Document.get().createDivElement();\n            glassElem.getStyle().setPosition(Style.Position.ABSOLUTE);\n            glassElem.getStyle().setTop(0,\n                                        Style.Unit.PX);\n            glassElem.getStyle().setLeft(0,\n                                         Style.Unit.PX);\n            glassElem.getStyle().setMargin(0,\n                                           Style.Unit.PX);\n            glassElem.getStyle().setPadding(0,\n                                            Style.Unit.PX);\n            glassElem.getStyle().setBorderWidth(0,\n                                                Style.Unit.PX);\n\n            // We need to set the background color or mouse events will go right\n            // through the glassElem. If the SplitPanel contains an iframe, the\n            // iframe will capture the event and the slider will stop moving.\n            glassElem.getStyle().setProperty(\"background\",\n                                             \"white\");\n            glassElem.getStyle().setOpacity(0.0);\n        }\n\n        sinkEvents(Event.ONMOUSEDOWN | Event.ONMOUSEUP | Event.ONMOUSEMOVE | Event.ONDBLCLICK);\n        addDomHandler(new MouseDownHandler() {\n                          @Override\n                          public void onMouseDown(final MouseDownEvent event) {\n                              mouseDown = true;\n                              int width = Math.max(Window.getClientWidth(),\n                                                   Document.get().getScrollWidth());\n                              int height = Math.max(Window.getClientHeight(),\n                                                    Document.get().getScrollHeight());\n                              glassElem.getStyle().setHeight(height,\n                                                             Style.Unit.PX);\n                              glassElem.getStyle().setWidth(width,\n                                                            Style.Unit.PX);\n                              Document.get().getBody().appendChild(glassElem);\n\n                              buildOffset(event);\n                              Event.setCapture(getElement());\n                              event.preventDefault();\n                          }\n                      },\n                      MouseDownEvent.getType());\n\n        addDomHandler(new MouseUpHandler() {\n                          @Override\n                          public void onMouseUp(final MouseUpEvent event) {\n                              mouseDown = false;\n\n                              glassElem.removeFromParent();\n\n                              Event.releaseCapture(getElement());\n                          }\n                      },\n                      MouseUpEvent.getType());\n    }\n\n    protected abstract void buildOffset(MouseDownEvent event);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/java/org/uberfire/ext/plugin/client/widget/split/VerticalSplit.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.split;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.mvp.Command;\n\npublic class VerticalSplit extends Splitter {\n\n    private double offset;\n    private Widget rightArea;\n    private Widget leftArea;\n    private Widget contentArea;\n    private Command onResize;\n\n    public VerticalSplit() {\n        super();\n        addDomHandler(new MouseMoveHandler() {\n                          @Override\n                          public void onMouseMove(MouseMoveEvent event) {\n                              if (mouseDown) {\n                                  double leftWidthPct = ((event.getClientX() - getContentAbsoluteLeft() - offset) / getContentWidth()) * 100;\n                                  double rightWidthPct = 100 - leftWidthPct;\n                                  setLeftAreaWidth(leftWidthPct);\n                                  setRightAreaWidth(rightWidthPct);\n                                  getElement().getStyle().setLeft(leftArea.getOffsetWidth() - 3,\n                                                                  Style.Unit.PX);\n                                  onResize.execute();\n                                  event.preventDefault();\n                              }\n                          }\n                      },\n                      MouseMoveEvent.getType());\n    }\n\n    @Override\n    protected void buildOffset(MouseDownEvent event) {\n        offset = event.getClientX() - getAbsoluteLeft();\n    }\n\n    public void init(final Widget leftArea,\n                     final Widget rightArea,\n                     final Widget contentArea,\n                     final Command onResize) {\n        this.leftArea = leftArea;\n        this.rightArea = rightArea;\n        this.contentArea = contentArea;\n        this.onResize = onResize;\n    }\n\n    private void setRightAreaWidth(double width) {\n        rightArea.setWidth(width + \"%\");\n    }\n\n    private void setLeftAreaWidth(double width) {\n        leftArea.setWidth(width + \"%\");\n    }\n\n    private int getContentWidth() {\n        return contentArea.getOffsetWidth();\n    }\n\n    private int getContentAbsoluteLeft() {\n        return contentArea.getAbsoluteLeft();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.plugin.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/RuntimePluginClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"com.google.gwt.editor.Editor\" />\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.layout.editor.UberfireLayoutEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorAPI\"/>\n  <inherits name=\"org.uberfire.ext.editor.commons.UberfireCommonsEditorClient\"/>\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginAPI\"/>\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n  <source path='client'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSavePerspective=Save Page\nPerspectiveName=Page Name\nPerspectiveNameHolder=pagename\nTagName=Tag Name\nTagNameHolder=tag name\nAddTag= Add Tag\nTagLabel=Tags\nInvalidPerspectiveName=Invalid Page Name\nInvalidTagName=Invalid Tag Name\nInvalidParameterName=Invalid Parameter Name\nInvalidActivityID=Invalid Activity ID\nInvalidMenuLabel=Invalid Menu Label\nEmptyTagName=Invalid Tag Name\nEmptyParameterName=Invalid Parameter Name\nEmptyActivityID=An Activity ID is mandatory and cannot be empty.\nEmptyMenuLabel=A Label is mandatory and cannot be empty.\nDuplicatedMenuLabel=A Menu Item with this Label already exists.\nDuplicateParameterName=Duplicate Parameter Name\nLoadPerspective=Load Page\nEditHtml=Edit HTML Component\nEditComponent=Edit Component\nAdd=Add\nAddNewParameter=Add New Parameter\nParamKey=Key\nParamKeyPlaceHolder=param key\nParamValue=Value\nParamValuePlaceHolder=param value\nInvalidGridConfiguration=A Row is built on 12-column grids. Grid columns are created by specifying the number of 12 available columns you wish to span.\nMenusNoMenuItems=No menu items.\nMenusMoveUpHint=Move up\nMenusMoveDownHint=Move down\nMenusActivityID=Activity ID\nMenusLabel=Label\nMenusDeleteHint=Delete row.\nMenusDelete=Delete\nDragAndDrop=Drag and drop\nClickToDisplay=Click to show/hide plugins\nNewPerspective=New Page\nNewPerspectivePopUpTitle=New Page ...\nNewPerspectiveLayoutPopUpTitle=New Page Layout ...\nNewScreen=New Screen\nNewScreenPopUpTitle=New Screen Plugin...\nNewEditor=New Editor\nNewEditorPopUpTitle=New Editor Plugin...\nNewSplashScreen=New SplashScreen\nNewSplashScreenPopUpTitle=New Splash Plugin...\nNewDynamicMenu=New DynamicMenu\nNewDynamicMenuPopUpTitle=New Dynamic Menu...\nHTMLComponent=HTML\nHTMLplaceHolder=Add your HTML here...\nScreenComponent=Screen\nScreenConfiguration=Screen Configuration\nTargetDivComponent=Target Div\nTargetDivPlaceHolder=Div ID:\nTargetDivConfiguration=Target Div Configuration\nPlaceName=Place Name\nEmptyTitleText=Create a new Page\nEmptySubTitleText=Drag a Component here to start building a new page.\nPluginsExplorer=Plugins Explorer\nPerspectivePlugin=Page plugin\nScreenPlugin=Screen plugin\nEditorPlugin=Editor plugin\nSplashScreenPlugin=SplashScreen plugin\nDynamicMenu=Dynamic Menu\nPerspectiveEditor=Page Editor\nScreenPluginEditor=Screen Plugin Editor\nEditorPluginEditor=Editor Plugin Editor\nSplashScreenPluginEditor=SplashScreen Plugin Editor\nDynamicMenuEditor=Dynamic Menu Editor\nMenuItem=Menu Item\nActivityId=Activity Id\nMenuLabel=Menu Label\nOk=Ok\nCancel=Cancel\nName=Name\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_de.properties",
    "content": "TagName=Tagname\nTagNameHolder=Tagname\nAddTag=Tag hinzufüen\nTagLabel=Tags\nInvalidTagName=Ungültiger Tagname\nInvalidParameterName=Ungültiger Parametername\nInvalidActivityID=Ungültige Aktivitäts-ID\nInvalidMenuLabel=Ungültige Menübezeichnung\nEmptyTagName=Ungültiger Tagname\nEmptyParameterName=Ungültiger Parametername\nEmptyActivityID=Eine Aktivitäts-ID ist obligatorisch und kann nicht leer gelassen werden.\nEmptyMenuLabel=Eine Bezeichnung ist obligatorisch und kann nicht leer gelassen werden.\nDuplicatedMenuLabel=Ein Menüelement mit dieser Bezeichnung existiert bereits.\nDuplicateParameterName=Parameternamen duplizieren\nEditHtml=HTML Komponente bearbeiten\nEditComponent=Komponente bearbeiten\nAdd=Hinzufügen\nAddNewParameter=Neuen Parameter hinzufügen\nParamKey=Schlüssel\nParamKeyPlaceHolder=param Schlüssel\nParamValue=Wert\nParamValuePlaceHolder=param Wert\nInvalidGridConfiguration=Eine Reihe wird auf 12-Spalten Grids aufgebaut. Grid-Spalten werden erstellt, indem die Anzahl von 12 verfügbaren Spalten angegeben wird, die Sie umfassen möchten.\nMenusNoMenuItems=Keine Menüelemente.\nMenusMoveUpHint=Nach oben verschieben\nMenusMoveDownHint=Nach unten verschieben\nMenusActivityID=Aktivitäts-ID\nMenusLabel=Bezeichnung\nMenusDeleteHint=Reihe löschen\nMenusDelete=Löschen\nDragAndDrop=Ziehen und ablegen\nClickToDisplay=Zum Einblenden/Ausblenden der Plugins hier klicken\nNewScreen=Neuer Bildschirm\nNewScreenPopUpTitle=Neues Bildschirm-Plugin...\nNewEditor=Neuer Editor\nNewEditorPopUpTitle=Neues Editor-Plugin...\nNewSplashScreen=Neuer Begrüßungsblidschirm\nNewSplashScreenPopUpTitle=Neues Begrüßungsblidschirm-Plugin...\nNewDynamicMenu=Neues dynamisches Menü\nNewDynamicMenuPopUpTitle=Neues dynamisches Menü...\nHTMLplaceHolder=Geben Sie Ihre HTML hier ein...\nScreenConfiguration=Bildschirm-Konfiguration\nPlaceName=Name des Speicherorts\nPluginsExplorer=Plugins-Explorer\nScreenPlugin=Bildschirm-Plugin\nEditorPlugin=Editor-Plugin\nSplashScreenPlugin=Begrüßungsbildschirm-Plugin\nDynamicMenu=Dynamisches Menü\nScreenPluginEditor=Bildschirm-Plugin-Editor\nEditorPluginEditor=Editor-Plugin-Editor\nSplashScreenPluginEditor=Begrüßungsbildschirm-Plugin-Editor\nDynamicMenuEditor=Dynamisches-Menü-Editor\nMenuItem=Menüelement\nActivityId=Aktivitäts-ID\nMenuLabel=Menübezeichnung\nOk=OK\nCancel=Abbrechen\nName=Name\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSavePerspective=Guardar página\nPerspectiveName=Nombre de página\nPerspectiveNameHolder=nombre de página\nTagName=Nombre de etiqueta\nTagNameHolder=nombre de etiqueta\nAddTag= Agregar etiqueta\nTagLabel=Etiquetas\nInvalidPerspectiveName=Nombre de página no válido\nInvalidTagName=Nombre de etiqueta no válido\nInvalidParameterName=Nombre de parámetro no válido\nInvalidActivityID=ID de actividad no válida\nInvalidMenuLabel=Etiqueta de menú no válida\nEmptyTagName=Nombre de etiqueta no válido\nEmptyParameterName=Nombre de parámetro no válido\nEmptyActivityID=ID de actividad es un campo obligatorio y no puede estar vacío.\nEmptyMenuLabel=Etiqueta es un campo obligatorio y no puede estar vacío.\nDuplicatedMenuLabel=Ya existe un ítem de menú con esta etiqueta.\nDuplicateParameterName=Duplicar el nombre del parámetro\nLoadPerspective=Cargar página\nEditHtml=Editar componente HTML\nEditComponent=Editar componente\nAdd=Agregar\nAddNewParameter=Agregar nuevo parámetro\nParamKey=Clave\nParamKeyPlaceHolder=clave de parámetro\nParamValue=Valor\nParamValuePlaceHolder=valor de parámetro\nInvalidGridConfiguration=Una fila se construye sobre una cuadrícula de 12 columnas. Las columnas de la cuadrícula se crean especificando la cantidad de las 12 columnas disponibles que desea abarcar.\nMenusNoMenuItems=No hay ítems de menú.\nMenusMoveUpHint=Mover hacia arriba\nMenusMoveDownHint=Mover hacia abajo\nMenusActivityID=ID de actividad\nMenusLabel=Etiqueta\nMenusDeleteHint=Eliminar fila.\nMenusDelete=Eliminar\nDragAndDrop=Arrastrar y soltar\nClickToDisplay=Hacer clic para mostrar/ocultar complementos\nNewPerspective=Nueva página\nNewPerspectivePopUpTitle=Nueva página…\nNewPerspectiveLayoutPopUpTitle=Nueva disposición de página…\nNewScreen=Nueva pantalla\nNewScreenPopUpTitle=Nuevo complemento de pantalla…\nNewEditor=Nuevo editor\nNewEditorPopUpTitle=Nuevo complemento de editor…\nNewSplashScreen=Nueva pantalla de presentación\nNewSplashScreenPopUpTitle=Nuevo complemento de presentación\nNewDynamicMenu=Nuevo menú dinámico\nNewDynamicMenuPopUpTitle=Nuevo menú dinámico…\nHTMLComponent=HTML\nHTMLplaceHolder=Agregue su HTML aquí…\nScreenComponent=Pantalla\nScreenConfiguration=Configuración de pantalla\nTargetDivComponent=Div. objetivo\nTargetDivPlaceHolder=ID de div.:\nTargetDivConfiguration=Configuración de div. objetivo\nPlaceName=Nombre de lugar\nEmptyTitleText=Crear una nueva página\nEmptySubTitleText=Arrastrar un componente aquí para empezar a construir una nueva página.\nPluginsExplorer=Explorador de complementos\nPerspectivePlugin=Complemento de página\nScreenPlugin=Complemento de pantalla\nEditorPlugin=Complemento de editor\nSplashScreenPlugin=Complemento de pantalla de presentación\nDynamicMenu=Menú dinámico\nPerspectiveEditor=Editor de página\nScreenPluginEditor=Editor de complemento de pantalla\nEditorPluginEditor=Editor de complemento de editor\nSplashScreenPluginEditor=Editor de complemento de pantalla de presentación\nDynamicMenuEditor=Editor de menús dinámicos\nMenuItem=Ítem de menú\nActivityId=ID de actividad\nMenuLabel=Etiqueta de menú\nOk=Aceptar\nCancel=Cancelar\nName=Nombre\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSavePerspective=Enregistrer la page\nPerspectiveName=Nom de la page\nPerspectiveNameHolder=pagename\nTagName=Nom de la balise\nTagNameHolder=nom balise\nAddTag= Ajouter une balise\nTagLabel=Balises\nInvalidPerspectiveName=Nom de page non valide\nInvalidTagName=Nom d''étiquette non valide\nInvalidParameterName=Nom de paramètre non valide\nInvalidActivityID=ID d''activité non valide\nInvalidMenuLabel=Étiquette de menu non valide\nEmptyTagName=Nom d''étiquette non valide\nEmptyParameterName=Nom de paramètre non valide\nEmptyActivityID=L''ID d''activité est obligatoire et ne peut pas être vide.\nEmptyMenuLabel=L''étiquette est obligatoire et ne peut pas être vide.\nDuplicatedMenuLabel=Il existe déjà un élément de menu avec cette étiquette.\nDuplicateParameterName=Nom de paramètre en double\nLoadPerspective=Charger la page\nEditHtml=Modifier le composant HTML\nEditComponent=Modifier le composant\nAdd=Ajouter\nAddNewParameter=Ajouter un nouveau paramètre\nParamKey=Clé\nParamKeyPlaceHolder=clé paramètre\nParamValue=Valeur\nParamValuePlaceHolder=valeur paramètre\nInvalidGridConfiguration=Une ligne est construite sur des grilles de 12 colonnes. Pour créer les colonnes de la grille, indiquez le nombre de 12 colonnes disponibles que vous souhaitez couvrir.\nMenusNoMenuItems=Aucun élément de menu.\nMenusMoveUpHint=Déplacer vers le haut\nMenusMoveDownHint=Déplacer vers le bas\nMenusActivityID=ID d''activité\nMenusLabel=Étiquette\nMenusDeleteHint=Supprimez la ligne.\nMenusDelete=Supprimer\nDragAndDrop=Glisser-déposer\nClickToDisplay=Cliquez pour afficher/masquer les plug-ins\nNewPerspective=Nouvelle page\nNewPerspectivePopUpTitle=Nouvelle page…\nNewPerspectiveLayoutPopUpTitle=Nouvelle mise en page…\nNewScreen=Nouvel écran\nNewScreenPopUpTitle=Nouveau plug-in d''écran…\nNewEditor=Nouvel éditeur\nNewEditorPopUpTitle=Nouveau plug-in d''éditeur…\nNewSplashScreen=Nouvel écran de démarrage\nNewSplashScreenPopUpTitle=Nouveau plug-in d''écran de démarrage…\nNewDynamicMenu=Nouveau menu dynamique\nNewDynamicMenuPopUpTitle=Nouveau menu dynamique…\nHTMLComponent=HTML\nHTMLplaceHolder=Ajoutez votre contenu HTML ici…\nScreenComponent=Écran\nScreenConfiguration=Configuration de l''écran\nTargetDivComponent=Div cible\nTargetDivPlaceHolder=ID div :\nTargetDivConfiguration=Configuration de div cible\nPlaceName=Nom du lieu\nEmptyTitleText=Créer une page\nEmptySubTitleText=Faites glisser un composant ici pour commencer à compiler une nouvelle page.\nPluginsExplorer=Explorateur de plug-ins\nPerspectivePlugin=Plug-in de page\nScreenPlugin=Plug-in d''écran\nEditorPlugin=Plug-in d''éditeur\nSplashScreenPlugin=Plug-in d''écran de démarrage\nDynamicMenu=Menu dynamique\nPerspectiveEditor=Éditeur de page\nScreenPluginEditor=Éditeur de plug-in d''écran\nEditorPluginEditor=Éditeur de plug-in d''éditeur\nSplashScreenPluginEditor=Éditeur de plug-in d''écran de démarrage\nDynamicMenuEditor=Éditeur de menu dynamique\nMenuItem=Élément de menu\nActivityId=ID d''activité\nMenuLabel=Étiquette de menu\nOk=OK\nCancel=Annuler\nName=Nom\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSavePerspective=Salva Pagina\nPerspectiveName=Nome Pagina\nPerspectiveNameHolder=nomepagina\nTagName=Nome Etichetta\nTagNameHolder=nome etichetta\nAddTag=Aggiungi Etichetta\nTagLabel=Etichetta\nInvalidPerspectiveName=Nome Pagina Non Valido\nInvalidTagName=Nome Etichetta Non Valido\nInvalidParameterName=Nome Parametro Non Valido\nInvalidActivityID=ID Attività Non Valido\nInvalidMenuLabel=Etichetta Menu Non Valida\nEmptyTagName=Nome Etichetta Non Valido\nEmptyParameterName=Nome Parametro Non Valido\nEmptyActivityID=L''ID Attività è obbligatorio e non può essere vuoto.\nEmptyMenuLabel=Un''etichetta è obbligatoria e non può essere vuota.\nDuplicatedMenuLabel=Un elemento di menu con questa etichetta esiste già.\nDuplicateParameterName=Duplica Nome Parametro\nLoadPerspective=Carica Pagina\nEditHtml=Modifica Componente HTML\nEditComponent=Modifica Componente\nAdd=Aggiungi\nAddNewParameter=Aggiungi Nuovo Parametro\nParamKey=Chiave\nParamKeyPlaceHolder=chiaveparam\nParamValue=Valore\nParamValuePlaceHolder=valoreparam\nInvalidGridConfiguration=Una riga è costruita su griglie a 12 colonne. Le colonne della griglia vengono create specificando il numero di 12 colonne disponibili che si desidera occupare.\nMenusNoMenuItems=Nessun elemento di menu.\nMenusMoveUpHint=Sposta su\nMenusMoveDownHint=Sposta giù\nMenusActivityID=ID Attività\nMenusLabel=Etichetta\nMenusDeleteHint=Elimina riga.\nMenusDelete=Elimina\nDragAndDrop=Trascina e rilascia\nClickToDisplay=Clicca per mostrare/nascondere i plugin\nNewPerspective=Nuova Pagina\nNewPerspectivePopUpTitle=Nuova Pagina ...\nNewPerspectiveLayoutPopUpTitle=Nuovo Layout Pagina ...\nNewScreen=Nuova Schermata\nNewScreenPopUpTitle=Plugin Nuova Schermata...\nNewEditor=Nuovo Editor\nNewEditorPopUpTitle=Plugin Nuovo Editor...\nNewSplashScreen=Nuova SplashScreen\nNewSplashScreenPopUpTitle=Plugin Nuova SplashScreen...\nNewDynamicMenu=Nuovo Menu Dinamico\nNewDynamicMenuPopUpTitle=Plugin Nuovo Menu Dinamico...\nHTMLComponent=HTML\nHTMLplaceHolder=Aggiungi il tuo HTML qui...\nScreenComponent=Schermata\nScreenConfiguration=Configurazione Schermata\nTargetDivComponent=Div Destinazione\nTargetDivPlaceHolder=ID Div:\nTargetDivConfiguration=Configurazione Div Destinazione\nPlaceName=Nome Luogo\nEmptyTitleText=Crea una nuova Pagina\nEmptySubTitleText=Trascina un Componente qui per iniziare a costruire una nuova pagina.\nPluginsExplorer=Esplora Plugin\nPerspectivePlugin=Plugin Pagina\nScreenPlugin=Plugin Schermata\nEditorPlugin=Plugin Editor\nSplashScreenPlugin=Plugin SplashScreen\nDynamicMenu=Menu Dinamico\nPerspectiveEditor=Editor Pagina\nScreenPluginEditor=Editor Plugin Schermata\nEditorPluginEditor=Editor Plugin Editor\nSplashScreenPluginEditor=Editor Plugin SplashScreen\nDynamicMenuEditor=Editor Menu Dinamico\nMenuItem=Elemento di Menu\nActivityId=ID Attività\nMenuLabel=Etichetta Menu\nOk=Ok\nCancel=Annulla\nName=Nome\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSavePerspective=ページの保存\nPerspectiveName=ページ名\nPerspectiveNameHolder=ページ名\nTagName=タグ名\nTagNameHolder=タグ名\nAddTag= タグの追加\nTagLabel=タグ\nInvalidPerspectiveName=無効なページ名\nInvalidTagName=無効なタグ名\nInvalidParameterName=無効なパラメーター名\nInvalidActivityID=無効なアクティビティー名\nInvalidMenuLabel=無効なメニューラベル\nEmptyTagName=無効なタグ名\nEmptyParameterName=無効なパラメーター名\nEmptyActivityID=アクティビティー ID は必須項目のため空白にはできません。\nEmptyMenuLabel=ラベルは必須項目のため空白にはできません。\nDuplicatedMenuLabel=このラベルの付いたメニューアイテムはすでに存在します。\nDuplicateParameterName=重複したパラメーター名\nLoadPerspective=ページのロード\nEditHtml=HTML コンポーネントの編集\nEditComponent=コンポーネントの編集\nAdd=追加\nAddNewParameter=新規パラメーターの追加\nParamKey=キー\nParamKeyPlaceHolder=パラメーターキー\nParamValue=値\nParamValuePlaceHolder=パラメーター値\nInvalidGridConfiguration=行が 12 個あるグリッド上に行が構築されます。グリッド行は、使用できる 12 個の行の番号を指定して作成されます。\nMenusNoMenuItems=メニュー項目がありません。\nMenusMoveUpHint=上に移動\nMenusMoveDownHint=下に移動\nMenusActivityID=アクティビティー ID\nMenusLabel=ラベル\nMenusDeleteHint=行を削除。\nMenusDelete=削除\nDragAndDrop=ドラグアンドドロップ要素\nClickToDisplay=クリックしてプラグインを表示/非表示\nNewPerspective=新規ページ\nNewPerspectivePopUpTitle=新規ページ ...\nNewPerspectiveLayoutPopUpTitle=新規ページのレイアウト...\nNewScreen=新規スクリーン\nNewScreenPopUpTitle=新規スクリーンのプラグイン\nNewEditor=新規エディター\nNewEditorPopUpTitle=新規エディターのプラグイン\nNewSplashScreen=新規スプラッシュ画面\nNewSplashScreenPopUpTitle=新規スプラッシュのプラグイン\nNewDynamicMenu=新規 Dynamic メニュー\nNewDynamicMenuPopUpTitle=新規 Dynamic メニュー\nHTMLComponent=HTML\nHTMLplaceHolder=ここに HTML を追加してください\nScreenComponent=スクリーン\nScreenConfiguration=スクリーン設定\nTargetDivComponent=ターゲット Div\nTargetDivPlaceHolder=Div ID\nTargetDivConfiguration=ターゲット Div 設定\nPlaceName=場所の名前\nEmptyTitleText=新規ページの作成\nEmptySubTitleText=ここにコンポーネントをドラッグして新規ページを構築\nPluginsExplorer=プラグインエクスプローラー\nPerspectivePlugin=ページのプラグイン\nScreenPlugin=スクリーンプラグイン\nEditorPlugin=エディタープラグイン\nSplashScreenPlugin=スプラッシュ画面プラグイン\nDynamicMenu=ダイナミックメニュー\nPerspectiveEditor=ページエディター\nScreenPluginEditor=スクリーンプラグインエディター\nEditorPluginEditor=エディタープラグインエディター\nSplashScreenPluginEditor=スプラッシュ画面プラグインエディター\nDynamicMenuEditor=ダイナミックメニューエディター\nMenuItem=メニュー項目\nActivityId=アクティビティー ID\nMenuLabel=メニューラベル\nOk=OK\nCancel=キャンセル\nName=名前\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "TagName=Nome da Tag\nTagNameHolder=nome da tag\nAddTag=Adicionar Tag\nTagLabel=Tags\nInvalidTagName=Nome da Tag Inválido\nInvalidParameterName=Nome do Parâmetro Inválido\nInvalidActivityID=ID de Atividade Inválida\nInvalidMenuLabel=Rótulo do Menu Inválido\nEmptyTagName=Nome da Tag Inválido\nEmptyParameterName=Nome do Parâmetro Inválido\nEmptyActivityID=A ID de Atividade é mandatória e não pode estar vazia. \nEmptyMenuLabel=O Rótulo é mandatório e não pode estar vazio. \nDuplicatedMenuLabel=Um Item de Menu com este rótulo já existe.\nDuplicateParameterName=Nome de Parâmetro Duplicado \nEditHtml=Editar o Componente HTML\nEditComponent=Editar o Componente\nAdd=Adicionar\nAddNewParameter=Adicionar Novo Parâmetro\nParamKey=Chave\nParamKeyPlaceHolder=chave de parâmetro\nParamValue=Valor\nParamValuePlaceHolder=valor do parâmetro\nInvalidGridConfiguration=Uma linha é construída em grades de 12 colunas. As colunas de grade são criadas especificando o número de 12 colunas disponíveis que você deseja abarcar. \nMenusNoMenuItems=Nenhum item de menu. \nMenusMoveUpHint=Mover para cima\nMenusMoveDownHint=Mover para baixo\nMenusActivityID=ID de Atividade\nMenusLabel=Rótulo\nMenusDeleteHint=Excluir linha.\nMenusDelete=Excluir\nDragAndDrop=Arrastar e soltar \nClickToDisplay=Clique para mostrar/ esconder os plugins\nNewScreen=Nova Tela\nNewScreenPopUpTitle=Novo Plugin da Tela...\nNewEditor=Novo Editor\nNewEditorPopUpTitle=Novo Plugin do Editor...\nNewSplashScreen=Nova Tela Inicial\nNewSplashScreenPopUpTitle=Novo Plugin da Tela Inicial...\nNewDynamicMenu=Novo Menu Dinâmico\nNewDynamicMenuPopUpTitle=Novo Menu Dinâmico...\nHTMLplaceHolder=Adicione seu HTML aqui...\nScreenConfiguration=Configuração de Tela\nPlaceName=Nome do Local\nPluginsExplorer=Explorer de Plugins\nScreenPlugin=Plugin de tela\nEditorPlugin=Plugin do Editor \nSplashScreenPlugin=Plugin de SplashScreen\nDynamicMenu=Menu dinâmico\nScreenPluginEditor=Editor do plugin de tela \nEditorPluginEditor=Editor do plugin de editor\nSplashScreenPluginEditor=Editor do plugin de SplashScreen \nDynamicMenuEditor=Editor do menu dinâmico \nMenuItem=Item de menu\nActivityId=ID de Atividade\nMenuLabel=Rótulo do Menu \nOk=Ok\nCancel=Cancelar\nName=Nome\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "TagName=标签名称\nTagNameHolder=标签名称\nAddTag=添加标签\nTagLabel=标签\nInvalidTagName=无效的标签名称\nInvalidParameterName=无效的参数名称\nInvalidActivityID=无效的活动 ID\nInvalidMenuLabel=无效的菜单标签\nEmptyTagName=无效标签名称\nEmptyParameterName=无效参数名称\nEmptyActivityID=活动 ID 为必填项，不能为空。\nEmptyMenuLabel=标签为必填项，不能为空。\nDuplicatedMenuLabel=使用这个标签的菜单项已存在。\nDuplicateParameterName=重复的参数名称\nEditHtml=编辑 HTML 组件\nEditComponent=编辑透视\nAdd=添加\nAddNewParameter=添加新的参数\nParamKey=键\nParamKeyPlaceHolder=参数键\nParamValue=值\nParamValuePlaceHolder=参数值\nInvalidGridConfiguration=一行由 12 列的网格组成。通过指定要跨越 12 个可用列的数量来创建网格列。\nMenusNoMenuItems=无菜单项\nMenusMoveUpHint=上移\nMenusMoveDownHint=下移\nMenusActivityID=Activity ID\nMenusLabel=标签\nMenusDeleteHint=删除行\nMenusDelete=删除\nDragAndDrop=拖放\nClickToDisplay=点击显示/隐藏插件\nNewScreen=新页面\nNewScreenPopUpTitle=新页面插件......\nNewEditor=新编辑器\nNewEditorPopUpTitle=新编辑器插件......\nNewSplashScreen=新 SplashScreen\nNewSplashScreenPopUpTitle=新 Splash 插件......\nNewDynamicMenu=新动态菜单\nNewDynamicMenuPopUpTitle=新动态菜单......\nHTMLplaceHolder=在这里添加 HTML......\nScreenConfiguration=页面配置\nPlaceName=地点名称\nPluginsExplorer=插件浏览器\nScreenPlugin=页面插件\nEditorPlugin=编辑器插件\nSplashScreenPlugin=SplashScreen 插件\nDynamicMenu=动态菜单\nScreenPluginEditor=页面插件编辑器\nEditorPluginEditor=编辑器插件编辑器\nSplashScreenPluginEditor=SplashScreen 插件编辑器\nDynamicMenuEditor=动态菜单编辑器\nMenuItem=菜单项目\nActivityId=活动 ID\nMenuLabel=菜单标签\nOk=确定\nCancel=取消\nName=名称\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/Constants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nEditHTMLView.Title=Edit HTML Component\nEditHTMLView.Ok=Ok\nEditHTMLView.Cancel=Cancel\nEditHTMLView.HtmlPlaceHolder=Add your HTML here..."
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nEditHTMLView.Title=Editar componente HTML\nEditHTMLView.Ok=Aceptar\nEditHTMLView.Cancel=Cancelar\nEditHTMLView.HtmlPlaceHolder=Agregue su HTML aquí…"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nEditHTMLView.Title=Modifier le composant HTML\nEditHTMLView.Ok=OK\nEditHTMLView.Cancel=Annuler\nEditHTMLView.HtmlPlaceHolder=Ajoutez votre contenu HTML ici…"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nEditHTMLView.Title=Modifica componente HTML\nEditHTMLView.Ok=Ok\nEditHTMLView.Cancel=Annulla\nEditHTMLView.HtmlPlaceHolder=Inserisci qui il tuo HTML...\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nEditHTMLView.Title=HTML コンポーネントの編集\nEditHTMLView.Ok=OK\nEditHTMLView.Cancel=キャンセル\nEditHTMLView.HtmlPlaceHolder=ここに HTML を追加してください"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants.properties",
    "content": "coreComponentGroupName=Core\nnavComponentGroupName=Navigation"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants_es.properties",
    "content": "coreComponentGroupName=Core\nnavComponentGroupName=Navegación"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants_fr.properties",
    "content": "coreComponentGroupName=Noyau\nnavComponentGroupName=Navigation"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants_it.properties",
    "content": "coreComponentGroupName=Nucleo\nnavComponentGroupName=Navigazione\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/main/resources/org/uberfire/ext/plugin/client/resources/i18n/PerspectiveEditorPaletteConstants_ja.properties",
    "content": "coreComponentGroupName=コア\nnavComponentGroupName=ナビゲーション"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/editor/DynamicMenuEditorPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Supplier;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.plugin.client.validation.RuleValidator;\nimport org.uberfire.ext.plugin.model.DynamicMenu;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.service.PluginServices;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DynamicMenuEditorPresenterTest {\n\n    @Mock\n    Caller<PluginServices> pluginServices;\n\n    private DynamicMenuEditorPresenter presenter;\n\n    private DynamicMenuEditorPresenter.View view;\n\n    private DynamicMenuItem existingMenuItem;\n\n    @Before\n    public void setup() {\n        view = mock(DynamicMenuEditorPresenter.View.class);\n        presenter = spy(createDynamicMenuEditorPresenter());\n\n        when(view.emptyActivityID()).thenReturn(\"e1\");\n        when(view.invalidActivityID()).thenReturn(\"e2\");\n        when(view.emptyMenuLabel()).thenReturn(\"e3\");\n        when(view.invalidMenuLabel()).thenReturn(\"e4\");\n        when(view.duplicatedMenuLabel()).thenReturn(\"e5\");\n\n        existingMenuItem = new DynamicMenuItem(\"existingActivityId\",\n                                               \"existingMenuLabel\");\n    }\n\n    @Test\n    public void validateMenuItemActivityId() {\n        RuleValidator activityIdValidator = presenter.getMenuItemActivityIdValidator();\n\n        assertFalse(activityIdValidator.isValid(null));\n        assertFalse(activityIdValidator.isValid(\"\"));\n        assertTrue(activityIdValidator.isValid(\"existingActivityId\"));\n        assertTrue(activityIdValidator.isValid(\"newActivityId\"));\n    }\n\n    @Test\n    public void validateNewMenuItemLabel() {\n        RuleValidator labelValidator;\n\n        labelValidator = presenter.getMenuItemLabelValidator(new DynamicMenuItem(null,\n                                                                                 null),\n                                                             null);\n        assertFalse(labelValidator.isValid(null));\n\n        labelValidator = presenter.getMenuItemLabelValidator(new DynamicMenuItem(\"\",\n                                                                                 \"\"),\n                                                             null);\n        assertFalse(labelValidator.isValid(\"\"));\n\n        labelValidator = presenter.getMenuItemLabelValidator(new DynamicMenuItem(\"existingActivityId\",\n                                                                                 \"existingMenuLabel\"),\n                                                             null);\n        assertFalse(labelValidator.isValid(\"existingMenuLabel\"));\n\n        labelValidator = presenter.getMenuItemLabelValidator(new DynamicMenuItem(\"newActivityId\",\n                                                                                 \"newMenuLabel\"),\n                                                             null);\n        assertTrue(labelValidator.isValid(\"newMenuLabel\"));\n    }\n\n    @Test\n    public void validateEditedMenuItemLabel() {\n        RuleValidator labelValidator = presenter.getMenuItemLabelValidator(new DynamicMenuItem(\"existingActivityId\",\n                                                                                               \"existingMenuLabel\"),\n                                                                           existingMenuItem);\n        assertTrue(labelValidator.isValid(\"newMenuLabel\"));\n        assertTrue(labelValidator.isValid(\"existingMenuLabel\"));\n    }\n\n    @Test\n    public void testGetContentSupplier() {\n\n        final Plugin dynamicMenu = mock(DynamicMenu.class);\n\n        doReturn(dynamicMenu).when(presenter).getContent();\n\n        final Supplier<Plugin> contentSupplier = presenter.getContentSupplier();\n\n        assertEquals(dynamicMenu, contentSupplier.get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n\n        doReturn(pluginServices).when(presenter).getPluginServices();\n\n        assertEquals(pluginServices, presenter.getSaveAndRenameServiceCaller());\n    }\n\n    private DynamicMenuEditorPresenter createDynamicMenuEditorPresenter() {\n        return new DynamicMenuEditorPresenter(view) {\n            @Override\n            public List<DynamicMenuItem> getDynamicMenuItems() {\n                List<DynamicMenuItem> dynamicMenuItems = new ArrayList<DynamicMenuItem>();\n                dynamicMenuItems.add(existingMenuItem);\n\n                return dynamicMenuItems;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/editor/DynamicMenuUpdateIndexTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.plugin.model.DynamicMenuItem;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class DynamicMenuUpdateIndexTest {\n\n    private DynamicMenuEditorPresenter presenter;\n    private DynamicMenuItem firstMenuItem;\n    private DynamicMenuItem secondMenuItem;\n\n    @Test\n    public void validateItemIndexes() {\n        presenter = createDynamicMenuEditorPresenter(mock(DynamicMenuEditorPresenter.View.class));\n\n        firstMenuItem = new DynamicMenuItem(\"firstId\",\n                                            \"firstLabel\");\n        secondMenuItem = new DynamicMenuItem(\"secondId\",\n                                             \"secondLabel\");\n\n        presenter.addMenuItem(firstMenuItem);\n        presenter.addMenuItem(secondMenuItem);\n\n        presenter.updateIndex(firstMenuItem,\n                              0,\n                              DynamicMenuEditorPresenter.UpdateIndexOperation.UP);\n        checkMenuItemIndexes(0,\n                             1);\n\n        presenter.updateIndex(secondMenuItem,\n                              1,\n                              DynamicMenuEditorPresenter.UpdateIndexOperation.DOWN);\n        checkMenuItemIndexes(0,\n                             1);\n\n        presenter.updateIndex(firstMenuItem,\n                              0,\n                              DynamicMenuEditorPresenter.UpdateIndexOperation.DOWN);\n        checkMenuItemIndexes(1,\n                             0);\n\n        presenter.updateIndex(firstMenuItem,\n                              1,\n                              DynamicMenuEditorPresenter.UpdateIndexOperation.UP);\n        checkMenuItemIndexes(0,\n                             1);\n    }\n\n    private DynamicMenuEditorPresenter createDynamicMenuEditorPresenter(DynamicMenuEditorPresenter.View view) {\n\n        return new DynamicMenuEditorPresenter(view) {\n\n            private List<DynamicMenuItem> dynamicMenuItems = new ArrayList<DynamicMenuItem>();\n\n            @Override\n            public List<DynamicMenuItem> getDynamicMenuItems() {\n                return dynamicMenuItems;\n            }\n\n            @Override\n            public void addMenuItem(final DynamicMenuItem menuItem) {\n                dynamicMenuItems.add(menuItem);\n            }\n        };\n    }\n\n    private void checkMenuItemIndexes(int firstMenuItemIndex,\n                                      int secondMenuItemIndex) {\n        assertEquals(firstMenuItemIndex,\n                     presenter.getDynamicMenuItems().indexOf(firstMenuItem));\n        assertEquals(secondMenuItemIndex,\n                     presenter.getDynamicMenuItems().indexOf(secondMenuItem));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/editor/RuntimePluginBaseEditorTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.editor;\n\nimport java.util.function.Supplier;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentMatchers;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.plugin.event.PluginAdded;\nimport org.uberfire.ext.plugin.event.PluginDeleted;\nimport org.uberfire.ext.plugin.event.PluginRenamed;\nimport org.uberfire.ext.plugin.event.PluginSaved;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginContent;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyCollection;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RuntimePluginBaseEditorTest {\n\n    @Mock\n    private RemoteCallback<PluginContent> successCallBack;\n\n    @Mock\n    private RuntimePluginBaseView baseEditorView;\n\n    @Mock\n    private PluginServices pluginServices;\n\n    @Mock\n    private RuntimePluginBaseEditor editor;\n\n    @Mock\n    private Plugin pluginMock;\n\n    private CallerMock<PluginServices> callerMock;\n\n    @Before\n    public void setup() {\n        callerMock = new CallerMock<>(pluginServices);\n        editor = spy(createRuntimePluginBaseEditor());\n    }\n\n    @Test\n    public void loadContentTest() {\n\n        final PluginContent pluginContent = mock(PluginContent.class);\n        when(pluginServices.getPluginContent(ArgumentMatchers.<Path>any())).thenReturn(pluginContent);\n\n        assertNull(editor.getOriginalHash());\n\n        editor.loadContent();\n\n        verify(pluginServices).getPluginContent(ArgumentMatchers.<Path>any());\n        verify(baseEditorView).setFramework(anyCollection());\n        verify(baseEditorView).setupContent(eq(pluginContent),\n                                            ArgumentMatchers.<ParameterizedCommand<Media>>any());\n        verify(baseEditorView).hideBusyIndicator();\n\n        assertNotNull(editor.getOriginalHash());\n    }\n\n    @Test\n    public void pluginSavedTest() {\n        editor.onPluginSaved(mock(PluginSaved.class));\n        verify(editor).registerPlugin(any());\n    }\n\n    @Test\n    public void pluginAddedTest() {\n        editor.onPluginAdded(mock(PluginAdded.class));\n        verify(editor).registerPlugin(any());\n    }\n\n    @Test\n    public void pluginDeletedTest() {\n        editor.onPluginDeleted(mock(PluginDeleted.class));\n        verify(editor).unregisterPlugin(any(),\n                                        any());\n    }\n\n    @Test\n    public void pluginRenamedTest() {\n        editor.onPluginRenamed(mock(PluginRenamed.class));\n        verify(editor).unregisterPlugin(any(),\n                                        any());\n        verify(editor).registerPlugin(any());\n    }\n\n    @Test\n    public void saveCommandTest() {\n        editor.getSaveCommand().execute(\"commitMessage\");\n        verify(baseEditorView).onSave();\n    }\n\n    @Test\n    public void testGetContentSupplier() {\n\n        final Supplier<Plugin> contentSupplier = editor.getContentSupplier();\n\n        assertEquals(pluginMock, contentSupplier.get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n        assertEquals(callerMock, editor.getSaveAndRenameServiceCaller());\n    }\n\n    private RuntimePluginBaseEditor createRuntimePluginBaseEditor() {\n\n        return new RuntimePluginBaseEditor(baseEditorView) {\n            @Override\n            protected PluginType getPluginType() {\n                return PluginType.DYNAMIC_MENU;\n            }\n\n            @Override\n            protected ClientResourceType getResourceType() {\n                return null;\n            }\n\n            @Override\n            RuntimePluginBaseView view() {\n                return baseEditorView;\n            }\n\n            @Override\n            Caller<PluginServices> getPluginServices() {\n                return callerMock;\n            }\n\n            @Override\n            ObservablePath getCurrentPath() {\n                return mock(ObservablePath.class);\n            }\n\n            @Override\n            public Plugin getContent() {\n                return pluginMock;\n            }\n\n            @Override\n            void unregisterPlugin(String name,\n                                  PluginType type) {\n            }\n\n            @Override\n            void registerPlugin(Plugin plugin) {\n            }\n\n            @Override\n            public RemoteCallback<Path> getSaveSuccessCallback(final int newHash) {\n                return path -> {\n                };\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/info/PluginsInfoTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.info;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.ClientTypeRegistry;\nimport org.uberfire.ext.plugin.client.type.DynamicMenuResourceType;\nimport org.uberfire.ext.plugin.client.type.EditorPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.PerspectiveLayoutPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.ScreenPluginResourceType;\nimport org.uberfire.ext.plugin.client.type.SplashPluginResourceType;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class PluginsInfoTest {\n\n    private PluginsInfo pluginsInfo;\n\n    private EditorPluginResourceType editorPluginResourceType;\n    private PerspectiveLayoutPluginResourceType perspectiveLayoutPluginResourceType;\n    private ScreenPluginResourceType screenPluginResourceType;\n    private SplashPluginResourceType splashPluginResourceType;\n    private DynamicMenuResourceType dynamicMenuResourceType;\n    private ActivityBeansInfo activityBeansInfo;\n    private ClientTypeRegistry clientTypeRegistry;\n\n    @Before\n    public void setup() {\n\n        editorPluginResourceType = mock(EditorPluginResourceType.class);\n        perspectiveLayoutPluginResourceType = mock(PerspectiveLayoutPluginResourceType.class);\n        screenPluginResourceType = mock(ScreenPluginResourceType.class);\n        splashPluginResourceType = mock(SplashPluginResourceType.class);\n        dynamicMenuResourceType = mock(DynamicMenuResourceType.class);\n        activityBeansInfo = mock(ActivityBeansInfo.class);\n        clientTypeRegistry = mock(ClientTypeRegistry.class);\n\n        when(activityBeansInfo.getAvailableWorkbenchEditorsIds()).thenReturn(Arrays.asList(new String[]{\"editorId1\"}));\n        when(activityBeansInfo.getAvailablePerspectivesIds()).thenReturn(Arrays.asList(new String[]{\"perspectiveId1\", \"perspectiveId2\"}));\n        when(activityBeansInfo.getAvailableWorkbenchScreensIds()).thenReturn(Arrays.asList(new String[]{\"screenId1\", \"screenId2\", \"screenId3\"}));\n        when(activityBeansInfo.getAvailableSplashScreensIds()).thenReturn(Arrays.asList(new String[]{\"splashScreenId1\", \"splashScreenId2\", \"splashScreenId3\", \"splashScreenId4\"}));\n\n        when(clientTypeRegistry.resolve(any(Path.class))).thenReturn(dynamicMenuResourceType);\n\n        pluginsInfo = spy(new PluginsInfo(editorPluginResourceType,\n                                          perspectiveLayoutPluginResourceType,\n                                          screenPluginResourceType,\n                                          splashPluginResourceType,\n                                          dynamicMenuResourceType,\n                                          activityBeansInfo,\n                                          clientTypeRegistry));\n        doReturn(Collections.emptyList()).when(pluginsInfo).lookupBeans(any(Class.class));\n    }\n\n    @Test\n    public void getAllPluginsTest() {\n        Set<Activity> allPlugins = pluginsInfo.getAllPlugins(getPlugins());\n\n        assertEquals(15,\n                     allPlugins.size());\n    }\n\n    @Test\n    public void getClassifiedPluginsTest() {\n        final Map<ClientResourceType, Set<Activity>> classifiedPlugins = pluginsInfo.getClassifiedPlugins(getPlugins());\n\n        assertEquals(5,\n                     classifiedPlugins.keySet().size());\n        assertEquals(1,\n                     classifiedPlugins.get(editorPluginResourceType).size());\n        assertEquals(2,\n                     classifiedPlugins.get(perspectiveLayoutPluginResourceType).size());\n        assertEquals(3,\n                     classifiedPlugins.get(screenPluginResourceType).size());\n        assertEquals(4,\n                     classifiedPlugins.get(splashPluginResourceType).size());\n        assertEquals(5,\n                     classifiedPlugins.get(dynamicMenuResourceType).size());\n    }\n\n    private Set<Plugin> getPlugins() {\n        Set<Plugin> plugins = new HashSet<Plugin>();\n        plugins.add(new Plugin(\"existingPerspectiveLayout\",\n                               PluginType.PERSPECTIVE_LAYOUT,\n                               PathFactory.newPath(\"test1\",\n                                                   \"/tmp/test1\")));\n        plugins.add(new Plugin(\"existingScreen\",\n                               PluginType.SCREEN,\n                               PathFactory.newPath(\"test2\",\n                                                   \"/tmp/test2\")));\n        plugins.add(new Plugin(\"existingEditor\",\n                               PluginType.EDITOR,\n                               PathFactory.newPath(\"test3\",\n                                                   \"/tmp/test3\")));\n        plugins.add(new Plugin(\"existingSplashScreen\",\n                               PluginType.SPLASH,\n                               PathFactory.newPath(\"test4\",\n                                                   \"/tmp/test4\")));\n        plugins.add(new Plugin(\"existingDynamicMenu\",\n                               PluginType.DYNAMIC_MENU,\n                               PathFactory.newPath(\"test5\",\n                                                   \"/tmp/test5\")));\n\n        return plugins;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/PerspectiveEditorPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.Spy;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.client.history.VersionRecordManager;\nimport org.uberfire.ext.editor.commons.client.menu.BasicFileMenuBuilder;\nimport org.uberfire.ext.editor.commons.client.menu.common.SaveAndRenameCommandBuilder;\nimport org.uberfire.ext.editor.commons.client.validation.Validator;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.LayoutEditorPresenter;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponent;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentGroup;\nimport org.uberfire.ext.layout.editor.client.api.LayoutDragComponentPalette;\nimport org.uberfire.ext.layout.editor.client.api.LayoutEditorPlugin;\nimport org.uberfire.ext.layout.editor.client.widgets.LayoutComponentPaletteGroupProvider;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorComponentGroupProvider;\nimport org.uberfire.ext.plugin.client.perspective.editor.events.PerspectiveEditorFocusEvent;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.PerspectiveEditorSettings;\nimport org.uberfire.ext.plugin.client.security.PluginController;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.promise.SyncPromises;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isA;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PerspectiveEditorPresenterTest {\n\n    @Mock\n    PerspectiveEditorPresenter.View view;\n\n    @Mock\n    PluginController pluginController;\n\n    @Mock\n    ObservablePath observablePath;\n\n    @Mock\n    PlaceRequest placeRequest;\n\n    @Mock\n    VersionRecordManager versionRecordManager;\n\n    @Mock\n    BasicFileMenuBuilder menuBuilder;\n\n    @Mock\n    LayoutEditorPlugin layoutEditorPlugin;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PerspectiveEditorSettings settings;\n\n    @Mock\n    SyncBeanDef<PerspectiveEditorComponentGroupProvider> perspectiveEditorGroupBeanA;\n\n    @Mock\n    SyncBeanDef<PerspectiveEditorComponentGroupProvider> perspectiveEditorGroupBeanB;\n\n    @Mock\n    LayoutEditorPresenter layoutEditorPresenter;\n\n    @Mock\n    LayoutDragComponentPalette layoutDragComponentPalette;\n\n    @Mock\n    EventSourceMock<PerspectiveEditorFocusEvent> perspectiveEditorFocusEvent;\n\n    @Mock\n    Caller<PerspectiveServices> perspectiveServices;\n\n    @Mock\n    SaveAndRenameCommandBuilder<LayoutTemplate, DefaultMetadata> saveAndRenameCommandBuilder;\n\n    @Spy\n    SyncPromises promises;\n\n    @InjectMocks\n    PerspectiveEditorPresenter presenter;\n\n    @Captor\n    private ArgumentCaptor<Collection<LayoutComponentPaletteGroupProvider>> providersCaptor;\n\n    PerspectiveEditorComponentGroupProvider perspectiveEditorGroupA;\n    PerspectiveEditorComponentGroupProvider perspectiveEditorGroupB;\n    LayoutDragComponentGroup dragComponentGroupA;\n    LayoutDragComponentGroup dragComponentGroupB;\n\n    public static final String COMPONENT_GROUP_A = \"A\";\n    public static final String COMPONENT_GROUP_B = \"B\";\n\n    class PerspectiveEditorTestGroupProvider implements PerspectiveEditorComponentGroupProvider {\n\n        private String name;\n        private LayoutDragComponentGroup componentGroup;\n\n        public PerspectiveEditorTestGroupProvider(String name, LayoutDragComponentGroup componentGroup) {\n            this.name = name;\n            this.componentGroup = componentGroup;\n        }\n\n        @Override\n        public String getName() {\n            return name;\n        }\n\n        @Override\n        public LayoutDragComponentGroup getComponentGroup() {\n            return componentGroup;\n        }\n    }\n\n    @Before\n    public void setUp() {\n        presenter.perspectiveEditorFocusEvent = perspectiveEditorFocusEvent;\n        when(pluginController.canCreatePerspectives()).thenReturn(true);\n        when(pluginController.canDelete(any())).thenReturn(true);\n        when(pluginController.canUpdate(any())).thenReturn(true);\n\n        dragComponentGroupA = new LayoutDragComponentGroup(COMPONENT_GROUP_A);\n        dragComponentGroupA.addLayoutDragComponent(\"fd\", mock(LayoutDragComponent.class));\n        \n        perspectiveEditorGroupA = new PerspectiveEditorTestGroupProvider(COMPONENT_GROUP_A, dragComponentGroupA);\n        when(perspectiveEditorGroupBeanA.getInstance()).thenReturn(perspectiveEditorGroupA);\n        \n        dragComponentGroupB = new LayoutDragComponentGroup(COMPONENT_GROUP_B);\n        dragComponentGroupB.addLayoutDragComponent(\"fd\", mock(LayoutDragComponent.class));\n\n        perspectiveEditorGroupB = new PerspectiveEditorTestGroupProvider(COMPONENT_GROUP_B, dragComponentGroupB);\n        when(perspectiveEditorGroupBeanB.getInstance()).thenReturn(perspectiveEditorGroupB);\n\n        when(beanManager.lookupBeans(PerspectiveEditorComponentGroupProvider.class))\n                .thenReturn(Arrays.asList(perspectiveEditorGroupBeanB, perspectiveEditorGroupBeanA));\n\n        mockSaveAndRenameCommandBuilder();\n    }\n\n    @Test\n    public void testInitLayoutEditor() {\n        presenter.onStartup(observablePath, placeRequest);\n\n        verify(layoutEditorPlugin).init(any(), anyString(), anyString(), eq(LayoutTemplate.Style.PAGE));\n        verify(layoutEditorPlugin).setPreviewEnabled(true);\n        verify(layoutEditorPlugin).setElementSelectionEnabled(true);\n    }\n\n    @Test\n    public void testInitDragComponentGroups() {\n        presenter.onStartup(observablePath, placeRequest);\n\n        verify(layoutDragComponentPalette).clear();\n\n        // The component groups are grouped by name\n        verify(layoutDragComponentPalette).addDraggableGroups(providersCaptor.capture());\n\n        Collection<LayoutComponentPaletteGroupProvider> providers = providersCaptor.getValue();\n\n        Assertions.assertThat(providers)\n                .hasSize(2)\n                .containsExactly(perspectiveEditorGroupA, perspectiveEditorGroupB);\n    }\n\n    @Test\n    public void testTagsDisabledByDefault() {\n        presenter.onStartup(observablePath, placeRequest);\n\n        verify(menuBuilder).addSave(any(Command.class));\n        verify(menuBuilder).addCopy(Mockito.<Path>any(), any(), any(Caller.class));\n        verify(menuBuilder).addRename(any(Command.class));\n        verify(menuBuilder).addDelete(Mockito.<Path>any(), any(Caller.class));\n        verify(menuBuilder).addDelete(Mockito.<Path>any(), any(Caller.class));\n        verify(menuBuilder, never()).addNewTopLevelMenu(any());\n    }\n\n    @Test\n    public void testTagsEnabled() {\n        when(settings.isTagsEnabled()).thenReturn(true);\n        presenter.onStartup(observablePath, placeRequest);\n\n        verify(menuBuilder).addSave(any(Command.class));\n        verify(menuBuilder).addCopy(Mockito.<Path>any(), any(), any(Caller.class));\n        verify(menuBuilder).addRename(any(Command.class));\n        verify(menuBuilder).addDelete(Mockito.<Path>any(), any(Caller.class));\n        verify(menuBuilder).addDelete(Mockito.<Path>any(), any(Caller.class));\n        verify(menuBuilder).addNewTopLevelMenu(any());\n    }\n\n    @Test\n    public void testGetContentSupplier() {\n\n        final LayoutTemplate layoutTemplate = mock(LayoutTemplate.class);\n\n        doReturn(layoutTemplate).when(layoutEditorPlugin).getLayout();\n\n        final Supplier<LayoutTemplate> contentSupplier = presenter.getContentSupplier();\n\n        assertEquals(layoutTemplate, contentSupplier.get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n        assertEquals(perspectiveServices, presenter.getSaveAndRenameServiceCaller());\n    }\n\n    private void mockSaveAndRenameCommandBuilder() {\n        when(saveAndRenameCommandBuilder.addPathSupplier(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addValidator(Mockito.<Validator>any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addValidator(Mockito.<Supplier<Boolean>>any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addRenameService(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addMetadataSupplier(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addContentSupplier(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addIsDirtySupplier(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addSuccessCallback(any())).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.addBeforeSaveAndRenameCommand(isA(Command.class))).thenReturn(saveAndRenameCommandBuilder);\n        when(saveAndRenameCommandBuilder.build()).thenReturn(() -> {\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/generator/PerspectiveEditorGeneratorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.generator;\n\nimport java.util.Collections;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.ext.layout.editor.api.PerspectiveServices;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\nimport org.uberfire.ext.layout.editor.client.generator.LayoutGenerator;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PerspectiveEditorGeneratorTest {\n\n    @Mock\n    LayoutGenerator layoutGenerator;\n\n    @Mock\n    ActivityBeansCache activityBeansCache;\n\n    @Mock\n    SyncBeanManager beanManager;\n\n    @Mock\n    PerspectiveServices perspectiveServices;\n\n    @Mock\n    SyncBeanDef activityBeanDef;\n\n    PerspectiveEditorGenerator generator;\n\n    @Before\n    public void setUp() {\n        when(beanManager.lookupBeans(anyString())).thenReturn(Collections.singleton(activityBeanDef));\n        when(beanManager.lookupBeans(SyncBeanDef.class)).thenReturn(Collections.singleton(activityBeanDef));\n        generator = new PerspectiveEditorGenerator(beanManager,\n                activityBeansCache,\n                layoutGenerator,\n                new CallerMock<>(perspectiveServices));\n    }\n\n    @Test\n    public void testGeneratedActivitiesIdentifier() {\n        LayoutTemplate layoutTemplate = new LayoutTemplate(\"test\");\n        PerspectiveEditorActivity perspectiveActivity = generator.generatePerspective(layoutTemplate);\n        PerspectiveEditorScreenActivity screenActivity = perspectiveActivity.getScreen();\n\n        assertNotNull(perspectiveActivity);\n        assertNotNull(screenActivity);\n        assertEquals(perspectiveActivity.getIdentifier(), \"test\");\n        assertEquals(screenActivity.getIdentifier(), \"test [Screen]\");\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/ScreenLayoutDragComponentTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityBeansInfo;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutComponent;\nimport org.uberfire.ext.layout.editor.client.api.RenderingContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.api.PerspectiveEditorCoreComponent;\nimport org.uberfire.ext.plugin.event.NewPluginRegistered;\nimport org.uberfire.ext.plugin.event.PluginUnregistered;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.jgroups.util.Util.assertFalse;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ScreenLayoutDragComponentTest {\n\n    private ScreenLayoutDragComponent screenLayoutDragComponent;\n\n    @Mock\n    private ActivityBeansInfo activityBeansInfo;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setup() {\n        screenLayoutDragComponent = spy(new ScreenLayoutDragComponent(placeManager));\n\n        activityBeansInfo = spy(new ActivityBeansInfo(null, null));\n\n        List<String> availableWorkbenchScreensIds = new ArrayList<>();\n        availableWorkbenchScreensIds.add(\"screen1\");\n        availableWorkbenchScreensIds.add(\"screen2\");\n        availableWorkbenchScreensIds.add(\"screen3\");\n\n        doReturn(availableWorkbenchScreensIds).when(activityBeansInfo).getAvailableWorkbenchScreensIds();\n        doReturn(activityBeansInfo).when(screenLayoutDragComponent).getActivityBeansInfo();\n\n        screenLayoutDragComponent.setup();\n    }\n\n    @Test\n    public void newNotScreenPluginRegisteredTest() {\n        screenLayoutDragComponent.onNewPluginRegistered(new NewPluginRegistered(\"newPlugin\",\n                                                                                PluginType.EDITOR));\n        assertEquals(3,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void existingScreenRegisteredTest() {\n        screenLayoutDragComponent.onNewPluginRegistered(new NewPluginRegistered(\"screen1\",\n                                                                                PluginType.SCREEN));\n        assertEquals(3,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void newScreenRegisteredTest() {\n        screenLayoutDragComponent.onNewPluginRegistered(new NewPluginRegistered(\"newScreen\",\n                                                                                PluginType.SCREEN));\n        assertEquals(4,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void notScreenPluginUnregisteredTest() {\n        screenLayoutDragComponent.onPluginUnregistered(new PluginUnregistered(\"screen1\",\n                                                                              PluginType.EDITOR));\n        assertEquals(3,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void existingScreenUnregisteredTest() {\n        screenLayoutDragComponent.onPluginUnregistered(new PluginUnregistered(\"screen1\",\n                                                                              PluginType.SCREEN));\n        assertEquals(2,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void unexistingScreenUnregisteredTest() {\n        screenLayoutDragComponent.onPluginUnregistered(new PluginUnregistered(\"unexistingPlugin\",\n                                                                              PluginType.SCREEN));\n        assertEquals(3,\n                     screenLayoutDragComponent.getAvailableWorkbenchScreensIds().size());\n    }\n\n    @Test\n    public void removeCurrentWidgetTest() {\n        RenderingContext renderingContext = mock(RenderingContext.class);\n        LayoutComponent t = new LayoutComponent();\n        t.addProperty(ScreenLayoutDragComponent.PLACE_NAME_PARAMETER,\n                      \"dora\");\n\n        when(renderingContext.getComponent()).thenReturn(t);\n\n        screenLayoutDragComponent.removeCurrentWidget(renderingContext);\n\n        verify(placeManager).closePlace(any(DefaultPlaceRequest.class));\n    }\n\n    @Test\n    public void buildPlaceRequestTest() {\n        Map<String, String> properties = new HashMap<>();\n        properties.put(ScreenLayoutDragComponent.PLACE_NAME_PARAMETER,\n                       \"dora\");\n        properties.put(\"dora1\",\n                       \"dora1\");\n        DefaultPlaceRequest defaultPlaceRequest = screenLayoutDragComponent.buildPlaceRequest(properties);\n\n        assertEquals(\"dora\",\n                     defaultPlaceRequest.getIdentifier());\n        assertEquals(2,\n                     defaultPlaceRequest.getParameters().size());\n    }\n\n    @Test\n    public void createCleanupPlaceRequestTest() {\n        DefaultPlaceRequest dora = new DefaultPlaceRequest(\"dora\");\n        screenLayoutDragComponent.createCleanupPlaceRequest(dora).execute();\n\n        verify(placeManager).closePlace(dora);\n    }\n\n    /**\n     * Screen component remains disabled in the perspective editor\n     * => https://issues.jboss.org/browse/AF-904\n     */\n    @Test\n    public void componentDisabledTest() {\n        assertFalse(screenLayoutDragComponent instanceof PerspectiveEditorCoreComponent);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/TargetDivListTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor;\n\nimport java.net.URL;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.List;\n\nimport com.google.gson.Gson;\nimport com.google.gson.GsonBuilder;\nimport org.junit.Test;\nimport org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;\n\nimport static org.junit.Assert.*;\n\npublic class TargetDivListTest {\n\n    public static final String SAMPLE_LAYOUT = \"org/uberfire/ext/plugin/client/perspective/editor/layout/editor/fullLayoutPage.txt\";\n\n    private Gson gson = new GsonBuilder().setPrettyPrinting().create();\n\n    @Test\n    public void getAllTargetDivsTest() throws Exception {\n\n        LayoutTemplate layout = loadLayout(SAMPLE_LAYOUT);\n\n        List<String> divs = TargetDivList.list(layout);\n\n        assertEquals(3,\n                     divs.size());\n        assertTrue(divs.contains(\"dora_div_id\"));\n        assertTrue(divs.contains(\"bento_div_id\"));\n        assertTrue(divs.contains(\"another_div_id\"));\n    }\n\n    public LayoutTemplate loadLayout(String templateURL) throws Exception {\n        URL resource = getClass().getClassLoader()\n                .getResource(templateURL);\n        String layoutEditorModel = new String(Files.readAllBytes(Paths.get(resource.toURI())));\n\n        LayoutTemplate layoutTemplate = gson.fromJson(layoutEditorModel,\n                                                      LayoutTemplate.class);\n\n        return layoutTemplate;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditHTMLPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.editor.commons.client.htmleditor.HtmlEditorPresenter;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.HTMLLayoutDragComponent;\n\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\npublic class EditHTMLPresenterTest {\n\n    public static final String DEFAULT_CONTENT = \"default content\";\n\n    public static final String SOME_CONTENT = \"some content\";\n\n    private ModalConfigurationContext modalConfigurationContext;\n\n    private HtmlEditorPresenter htmlEditor;\n\n    private EditHTMLPresenter.View view;\n\n    private EditHTMLPresenter presenter;\n\n    @Before\n    public void setup() {\n        modalConfigurationContext = mock(ModalConfigurationContext.class);\n        htmlEditor = mock(HtmlEditorPresenter.class);\n        view = mock(EditHTMLPresenter.View.class);\n        doReturn(DEFAULT_CONTENT).when(view).getHtmlEditorPlaceHolder();\n        presenter = spy(new EditHTMLPresenter(view,\n                                              htmlEditor));\n    }\n\n    @Test\n    public void setupEmptyHTMLEditorTest() {\n        presenter.init(modalConfigurationContext);\n\n        verify(presenter).setupHTMLEditor();\n        verify(modalConfigurationContext).getComponentProperty(HTMLLayoutDragComponent.HTML_CODE_PARAMETER);\n        verify(view).getHtmlEditorPlaceHolder();\n        verify(htmlEditor).setContent(DEFAULT_CONTENT);\n        verify(htmlEditor).load();\n    }\n\n    @Test\n    public void setupNotEmptyHTMLEditorTest() {\n        doReturn(SOME_CONTENT).when(modalConfigurationContext).getComponentProperty(anyString());\n        presenter.init(modalConfigurationContext);\n\n        verify(presenter).setupHTMLEditor();\n        verify(modalConfigurationContext).getComponentProperty(HTMLLayoutDragComponent.HTML_CODE_PARAMETER);\n        verify(view,\n               never()).getHtmlEditorPlaceHolder();\n        verify(htmlEditor).setContent(SOME_CONTENT);\n        verify(htmlEditor).load();\n    }\n\n    @Test\n    public void showTest() {\n        presenter.init(modalConfigurationContext);\n        presenter.show();\n\n        verify(view).show();\n    }\n\n    @Test\n    public void okClickTest() {\n        presenter.init(modalConfigurationContext);\n        presenter.okClick();\n\n        verify(view).hide();\n        verify(presenter).destroyHtmlEditor();\n        verify(modalConfigurationContext,\n               never()).configurationCancelled();\n        verify(modalConfigurationContext).configurationFinished();\n    }\n\n    @Test\n    public void cancelButtonClickHandlerTest() {\n        presenter.init(modalConfigurationContext);\n        presenter.cancelClick();\n\n        verify(view).hide();\n        verify(presenter).destroyHtmlEditor();\n        verify(modalConfigurationContext).configurationCancelled();\n        verify(modalConfigurationContext,\n               never()).configurationFinished();\n    }\n\n    @Test\n    public void closeButtonClickHandlerTest() {\n        presenter.init(modalConfigurationContext);\n        presenter.closeClick();\n\n        verify(presenter.getModalConfigurationContext()).configurationCancelled();\n        verify(presenter.getModalConfigurationContext(),\n               never()).configurationFinished();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/popups/EditScreenTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.perspective.editor.layout.editor.popups;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.event.shared.SimpleEventBus;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport com.google.gwtmockito.fakes.FakeProvider;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mockito;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.layout.editor.client.api.ModalConfigurationContext;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Text.class})\npublic class EditScreenTest {\n\n    private EditScreenFake editScreen;\n\n    private ModalConfigurationContext ctx;\n\n    private SimpleEventBus simpleEventBus = new SimpleEventBus();\n\n    private ModalHiddenHandler modalHiddenHandler;\n\n    private Command cleanupPlaceRequest;\n\n    @Before\n    public void setup() {\n        GwtMockito.useProviderForType(SimpleEventBus.class,\n                                      new FakeProvider() {\n                                          @Override\n                                          public Object getFake(Class aClass) {\n                                              return simpleEventBus;\n                                          }\n                                      });\n\n        ctx = mock(ModalConfigurationContext.class);\n        cleanupPlaceRequest = mock(Command.class);\n        editScreen = spy(new EditScreenFake(ctx,\n                                            cleanupPlaceRequest));\n\n        when(editScreen.addHiddenHandler(Mockito.any(ModalHiddenHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                modalHiddenHandler = (ModalHiddenHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n\n        editScreen.realAddHiddenHandler();\n    }\n\n    @Test\n    public void okButtonClickHandlerTest() {\n        editScreen.okButton();\n        verify(editScreen).hide();\n\n        modalHiddenHandler.onHidden(new ModalHiddenEvent(editScreen,\n                                                         new Event() {\n                                                         }));\n        verify(editScreen.getConfigContext(),\n               never()).configurationCancelled();\n        verify(editScreen.getConfigContext()).configurationFinished();\n        verify(cleanupPlaceRequest).execute();\n    }\n\n    @Test\n    public void cancelButtonClickHandlerTest() {\n        editScreen.cancelButton();\n        verify(editScreen).hide();\n\n        modalHiddenHandler.onHidden(new ModalHiddenEvent(editScreen,\n                                                         new Event() {\n                                                         }));\n        verify(editScreen.getConfigContext()).configurationCancelled();\n        verify(editScreen.getConfigContext(),\n               never()).configurationFinished();\n    }\n\n    @Test\n    public void closeButtonClickHandlerTest() {\n        modalHiddenHandler.onHidden(new ModalHiddenEvent(editScreen,\n                                                         new Event() {\n                                                         }));\n        verify(editScreen.getConfigContext()).configurationCancelled();\n        verify(editScreen.getConfigContext(),\n               never()).configurationFinished();\n    }\n\n    @Test\n    public void shouldICleanupPlaceRequestTest() {\n        EditScreen edit = spy(new EditScreen(mock(ModalConfigurationContext.class),\n                                             new ArrayList<>(),\n                                             () -> {\n                                             }));\n\n        assertFalse(edit.shouldICleanupPlaceRequest());\n\n        when(edit.oldPlaceName()).thenReturn(\"some\");\n        when(edit.currentPlaceName()).thenReturn(\"some\");\n        assertFalse(edit.shouldICleanupPlaceRequest());\n\n        when(edit.oldPlaceName()).thenReturn(\"some\");\n        when(edit.currentPlaceName()).thenReturn(\"another\");\n        assertTrue(edit.shouldICleanupPlaceRequest());\n    }\n\n    private List<String> getScreensId() {\n        List<String> availableWorkbenchScreensIds = new ArrayList<String>();\n        availableWorkbenchScreensIds.add(\"screen\");\n\n        return availableWorkbenchScreensIds;\n    }\n\n    private class EditScreenFake extends EditScreen {\n\n        public EditScreenFake(ModalConfigurationContext ctx,\n                              Command cleanupPlaceRequest) {\n            super(ctx,\n                  getScreensId(),\n                  cleanupPlaceRequest);\n        }\n\n        public void realAddHiddenHandler() {\n            super.addHiddenHandler();\n        }\n\n        @Override\n        boolean shouldICleanupPlaceRequest() {\n            return true;\n        }\n\n        @Override\n        public void addHiddenHandler() {\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/validation/NameValidatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.validation;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class NameValidatorTest {\n\n    private static final String EMPTY_NAME = \"\";\n    private static final String INVALID_NAME = \"invalid*\";\n    private static final String VALID_NAME = \"valid\";\n\n    private static final String EMPTY_ERROR_MESSAGE = \"emptyError\";\n    private static final String INVALID_ERROR_MESSAGE = \"invalidError\";\n\n    private NameValidator nameValidator;\n\n    @Before\n    public void setup() {\n        nameValidator = NameValidator.createNameValidator(EMPTY_ERROR_MESSAGE,\n                                                          INVALID_ERROR_MESSAGE);\n    }\n\n    @Test\n    public void emptyNameTest() {\n        nameValidator.isValid(EMPTY_NAME);\n\n        assertEquals(EMPTY_ERROR_MESSAGE,\n                     nameValidator.getValidationError());\n    }\n\n    @Test\n    public void invalidNameTest() {\n        nameValidator.isValid(INVALID_NAME);\n\n        assertEquals(INVALID_ERROR_MESSAGE,\n                     nameValidator.getValidationError());\n    }\n\n    @Test\n    public void validNameTest() {\n        nameValidator.isValid(VALID_NAME);\n\n        assertNull(nameValidator.getValidationError());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/validation/PluginNameValidatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.validation;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.ext.editor.commons.client.validation.ValidationErrorReason;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorWithReasonCallback;\nimport org.uberfire.ext.plugin.client.info.PluginsInfo;\nimport org.uberfire.ext.plugin.model.Activity;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.mockito.ArgumentMatchers.anyCollection;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PluginNameValidatorTest {\n\n    @Mock\n    private PluginsInfo pluginsInfo;\n\n    @Mock\n    private ValidatorWithReasonCallback callback;\n\n    @Mock\n    private PluginServices pluginServices;\n    private Caller<PluginServices> pluginServicesCaller;\n\n    @InjectMocks\n    private PluginNameValidator validator;\n\n    @Before\n    public void setup() {\n        pluginServicesCaller = new CallerMock<PluginServices>(pluginServices);\n        validator.pluginServices = pluginServicesCaller;\n\n        Set<Activity> activities = new HashSet<Activity>();\n        activities.add(new Plugin(\"existingPerspectiveLayout\",\n                                  PluginType.PERSPECTIVE_LAYOUT,\n                                  PathFactory.newPath(\"test1\",\n                                                      \"/tmp/test1\")));\n        activities.add(new Plugin(\"existingScreen\",\n                                  PluginType.SCREEN,\n                                  PathFactory.newPath(\"test2\",\n                                                      \"/tmp/test2\")));\n        activities.add(new Plugin(\"existingEditor\",\n                                  PluginType.EDITOR,\n                                  PathFactory.newPath(\"test3\",\n                                                      \"/tmp/test3\")));\n        activities.add(new Plugin(\"existingSplashScreen\",\n                                  PluginType.SPLASH,\n                                  PathFactory.newPath(\"test4\",\n                                                      \"/tmp/test4\")));\n        activities.add(new Plugin(\"existingDynamicMenu\",\n                                  PluginType.DYNAMIC_MENU,\n                                  PathFactory.newPath(\"test5\",\n                                                      \"/tmp/test5\")));\n\n        when(pluginsInfo.getAllPlugins(anyCollection())).thenReturn(activities);\n    }\n\n    @Test\n    public void validateEmptyName() {\n        validator.validateName(\"\",\n                               callback);\n        verify(callback).onFailure(ValidationErrorReason.EMPTY_NAME.name());\n\n        validator.validateName(\"notEmpty\",\n                               callback);\n        verify(callback).onSuccess();\n    }\n\n    @Test\n    public void validateEmptyNameWithExtension() {\n        validator.validateName(\".plugin\",\n                               callback);\n        verify(callback).onFailure(ValidationErrorReason.EMPTY_NAME.name());\n\n        validator.validateName(\"notEmpty.plugin\",\n                               callback);\n        verify(callback).onSuccess();\n    }\n\n    @Test\n    public void validateInvalidName() {\n        validator.validateName(\"invalid*.plugin\",\n                               callback);\n        verify(callback).onFailure(ValidationErrorReason.INVALID_NAME.name());\n\n        validator.validateName(\"valid.plugin\",\n                               callback);\n        verify(callback).onSuccess();\n    }\n\n    @Test\n    public void validateDuplicatedName() {\n        validator.validateName(\"existingPerspectiveLayout.plugin\",\n                               callback);\n        verify(callback).onFailure(ValidationErrorReason.DUPLICATED_NAME.name());\n\n        validator.validateName(\"nonExistingPerspectiveLayout.plugin\",\n                               callback);\n        verify(callback).onSuccess();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/validation/RuleValidatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.validation;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RuleValidatorTest {\n\n    private static final String INVALID_VALUE = \"invalid*\";\n    private static final String VALID_VALUE = \"valid\";\n\n    private static final String ERROR_MESSAGE = \"error\";\n\n    private FormGroup field;\n\n    private HelpBlock help;\n\n    private RuleValidator validRuleValidator;\n\n    private RuleValidator invalidRuleValidator;\n\n    @Before\n    public void setup() {\n        field = mock(FormGroup.class);\n        help = mock(HelpBlock.class);\n\n        validRuleValidator = new RuleValidator() {\n            @Override\n            public boolean isValid(final String value) {\n                return true;\n            }\n\n            @Override\n            public String getValidationError() {\n                return null;\n            }\n        };\n\n        invalidRuleValidator = new RuleValidator() {\n            @Override\n            public boolean isValid(final String value) {\n                return false;\n            }\n\n            @Override\n            public String getValidationError() {\n                return ERROR_MESSAGE;\n            }\n        };\n    }\n\n    @Test\n    public void validRuleValidatorTest() {\n        validRuleValidator.validateFieldInline(VALID_VALUE,\n                                               field,\n                                               help);\n\n        verify(field).setValidationState(ValidationState.NONE);\n        verify(help).setText(\"\");\n    }\n\n    @Test\n    public void invalidRuleValidatorTest() {\n        invalidRuleValidator.validateFieldInline(INVALID_VALUE,\n                                                 field,\n                                                 help);\n\n        verify(field).setValidationState(ValidationState.ERROR);\n        verify(help).setText(ERROR_MESSAGE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/widget/media/MediaLibraryWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.media;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.plugin.event.MediaAdded;\nimport org.uberfire.ext.plugin.model.Media;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Text.class})\npublic class MediaLibraryWidgetTest {\n\n    public static final String PLUGIN_NAME = \"plugin\";\n\n    private MediaLibraryWidget mediaLibraryWidget;\n\n    private Media media;\n    private Collection<Media> existentMedia;\n    private ParameterizedCommand<Media> onMediaDelete;\n\n    @Before\n    public void setup() {\n        mediaLibraryWidget = new MediaLibraryWidget();\n        mediaLibraryWidget.library = mock(Row.class);\n\n        media = mock(Media.class);\n        existentMedia = new ArrayList<>();\n        onMediaDelete = spy(new ParameterizedCommand<Media>() {\n            @Override\n            public void execute(final Media parameter) {\n            }\n        });\n    }\n\n    @Test\n    public void newMediaDeletedOnCloseTest() {\n        mediaLibraryWidget.setup(PLUGIN_NAME,\n                                 existentMedia,\n                                 onMediaDelete);\n        mediaLibraryWidget.onNewMedia(new MediaAdded(PLUGIN_NAME,\n                                                     media));\n        mediaLibraryWidget.updateMediaOnClose();\n\n        verify(onMediaDelete).execute(media);\n    }\n\n    @Test\n    public void newMediaNotDeletedOnSaveTest() {\n        mediaLibraryWidget.setup(PLUGIN_NAME,\n                                 existentMedia,\n                                 onMediaDelete);\n        mediaLibraryWidget.onNewMedia(new MediaAdded(PLUGIN_NAME,\n                                                     media));\n        mediaLibraryWidget.updateMediaOnSave();\n\n        verify(onMediaDelete,\n               never()).execute(media);\n    }\n\n    @Test\n    public void existentMediaNotDeletedOnCloseTest() {\n        existentMedia.add(mock(Media.class));\n        existentMedia.add(mock(Media.class));\n\n        mediaLibraryWidget.setup(PLUGIN_NAME,\n                                 existentMedia,\n                                 onMediaDelete);\n        mediaLibraryWidget.onNewMedia(new MediaAdded(PLUGIN_NAME,\n                                                     media));\n        mediaLibraryWidget.updateMediaOnClose();\n\n        verify(onMediaDelete,\n               times(1)).execute(any(Media.class));\n        verify(onMediaDelete).execute(media);\n    }\n\n    @Test\n    public void existentAndUnexistentMediaNotDeletedOnSaveTest() {\n        existentMedia.add(mock(Media.class));\n        existentMedia.add(mock(Media.class));\n\n        mediaLibraryWidget.setup(PLUGIN_NAME,\n                                 existentMedia,\n                                 onMediaDelete);\n        mediaLibraryWidget.onNewMedia(new MediaAdded(PLUGIN_NAME,\n                                                     media));\n        mediaLibraryWidget.updateMediaOnSave();\n\n        verify(onMediaDelete,\n               never()).execute(any(Media.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/widget/plugin/GeneralPluginEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.plugin;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.NavPills;\nimport org.gwtbootstrap3.client.ui.gwt.FlowPanel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditor;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GeneralPluginEditorTest {\n\n    @Mock\n    private NavPills lifecycleHolder;\n\n    @Mock\n    private AceEditor templateEditor;\n\n    @Mock\n    private AceEditor cssEditor;\n\n    @Mock\n    private AceEditor jsEditor;\n\n    @InjectMocks\n    private GeneralPluginEditor generalPluginEditor;\n\n    @Before\n    public void setup() {\n        generalPluginEditor.leftBottomArea = mock(FlowPanel.class);\n    }\n\n    @Test\n    public void editorResizingNaNTest() {\n        doReturn(0).when(generalPluginEditor.leftBottomArea).getOffsetHeight();\n        doReturn(0).when(lifecycleHolder).getOffsetHeight();\n\n        generalPluginEditor.editorResizing.execute();\n\n        verify(jsEditor,\n               never()).setHeight(any(String.class));\n    }\n\n    @Test\n    public void editorResizingWithNegativeHeightTest() {\n        doReturn(1).when(generalPluginEditor.leftBottomArea).getOffsetHeight();\n        doReturn(2).when(lifecycleHolder).getOffsetHeight();\n\n        generalPluginEditor.editorResizing.execute();\n\n        verify(jsEditor,\n               never()).setHeight(any(String.class));\n    }\n\n    @Test\n    public void editorResizingWithZeroHeightTest() {\n        doReturn(1).when(generalPluginEditor.leftBottomArea).getOffsetHeight();\n        doReturn(1).when(lifecycleHolder).getOffsetHeight();\n\n        generalPluginEditor.editorResizing.execute();\n\n        verify(jsEditor,\n               never()).setHeight(any(String.class));\n    }\n\n    @Test\n    public void editorResizingWithPositiveHeightTest() {\n        doReturn(1).when(generalPluginEditor.leftBottomArea).getOffsetHeight();\n        doReturn(0).when(lifecycleHolder).getOffsetHeight();\n\n        generalPluginEditor.editorResizing.execute();\n\n        verify(jsEditor).setHeight(any(String.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/java/org/uberfire/ext/plugin/client/widget/popup/NewPluginPopUpTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.plugin.client.widget.popup;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.editor.commons.client.validation.ValidatorCallback;\nimport org.uberfire.ext.plugin.client.validation.PluginNameValidator;\nimport org.uberfire.ext.plugin.model.Plugin;\nimport org.uberfire.ext.plugin.model.PluginType;\nimport org.uberfire.ext.plugin.service.PluginServices;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NewPluginPopUpTest {\n\n    private PluginNameValidator successValidator;\n    private PluginNameValidator failureValidator;\n\n    @Mock\n    private NewPluginPopUpView view;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private PluginServices pluginServices;\n    private Caller<PluginServices> pluginServicesCaller;\n\n    @Mock\n    private Plugin plugin;\n\n    @Mock\n    private PathPlaceRequest pathPlaceRequest;\n\n    private NewPluginPopUp presenter;\n\n    @Before\n    public void setUp() {\n        presenter = new NewPluginPopUp(view) {\n            @Override\n            protected PlaceRequest getPathPlaceRequest(Plugin response) {\n                return new PathPlaceRequest();\n            }\n        };\n\n        pluginServicesCaller = new CallerMock<PluginServices>(pluginServices);\n        presenter.pluginServices = pluginServicesCaller;\n        presenter.placeManager = placeManager;\n\n        when(pluginServices.createNewPlugin(anyString(),\n                                            any(PluginType.class))).thenReturn(new Plugin());\n\n        successValidator = spy(new PluginNameValidator() {\n            @Override\n            public void validate(String value,\n                                 ValidatorCallback callback) {\n                callback.onSuccess();\n            }\n        });\n\n        failureValidator = spy(new PluginNameValidator() {\n            @Override\n            public void validate(String value,\n                                 ValidatorCallback callback) {\n                callback.onFailure();\n            }\n        });\n    }\n\n    @Test\n    public void testSuccessfulValidation() {\n        presenter.pluginNameValidator = successValidator;\n\n        presenter.onOK(\"newPlugin\",\n                       PluginType.PERSPECTIVE);\n\n        verify(successValidator).validate(eq(\"newPlugin.plugin\"),\n                                          any(ValidatorCallback.class));\n        verify(pluginServices).createNewPlugin(\"newPlugin\",\n                                               PluginType.PERSPECTIVE);\n    }\n\n    @Test\n    public void testFailedValidation() {\n        presenter.pluginNameValidator = failureValidator;\n\n        presenter.onOK(\"invalid*\",\n                       PluginType.PERSPECTIVE);\n\n        verify(failureValidator).validate(eq(\"invalid*.plugin\"),\n                                          any(ValidatorCallback.class));\n        verify(view).handleNameValidationError(any());\n        verify(view).invalidName();\n        verify(pluginServices,\n               never()).createNewPlugin(anyString(),\n                                        any(PluginType.class));\n    }\n\n    @Test\n    public void testPopupCanceled() {\n        presenter.onCancel();\n\n        verify(successValidator,\n               never()).validate(anyString(),\n                                 any(ValidatorCallback.class));\n        verify(failureValidator,\n               never()).validate(anyString(),\n                                 any(ValidatorCallback.class));\n        verify(pluginServices,\n               never()).createNewPlugin(anyString(),\n                                        any(PluginType.class));\n        verify(view).hide();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-runtime-plugins/uberfire-runtime-plugins-client/src/test/resources/org/uberfire/ext/plugin/client/perspective/editor/layout/editor/fullLayoutPage.txt",
    "content": "{\n  \"version\": 2,\n  \"name\": \"A\",\n  \"style\": \"PAGE\",\n  \"layoutProperties\": {\n    \"LAYOUT_TAGS\": \"a|\"\n  },\n  \"rows\": [\n    {\n      \"height\": \"8\",\n      \"layoutColumns\": [\n        {\n          \"span\": \"8\",\n          \"height\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivDragComponent\",\n              \"properties\": {\n                \"ID_PARAMETER\": \"dora_div_id\"\n              }\n            }\n          ]\n        },\n        {\n          \"span\": \"4\",\n          \"height\": \"12\",\n          \"rows\": [\n            {\n              \"height\": \"12\",\n              \"layoutColumns\": [\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivDragComponent\",\n                      \"properties\": {\n                        \"ID_PARAMETER\": \"bento_div_id\"\n                      }\n                    }\n                  ]\n                },\n                {\n                  \"span\": \"12\",\n                  \"height\": \"6\",\n                  \"rows\": [],\n                  \"layoutComponents\": [\n                    {\n                      \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.ScreenLayoutDragComponent\",\n                      \"properties\": {\n                        \"Place Name\": \"AnotherScreen\"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ],\n          \"layoutComponents\": []\n        }\n      ]\n    },\n    {\n      \"height\": \"4\",\n      \"layoutColumns\": [\n        {\n          \"span\": \"12\",\n          \"height\": \"12\",\n          \"rows\": [],\n          \"layoutComponents\": [\n            {\n              \"dragTypeName\": \"org.uberfire.ext.plugin.client.perspective.editor.layout.editor.TargetDivDragComponent\",\n              \"properties\": {\n                \"ID_PARAMETER\": \"another_div_id\"\n              }\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-security-extensions</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Security Extensions</name>\n\n  <modules>\n    <module>uberfire-servlet-security</module>\n    <module>uberfire-security-management</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/README.md",
    "content": "UberFire User System Management\n===============================\n\nTable of contents\n------------------\n\n* **[Introduction](#introduction)**\n* **[UberFire Users, Roles and Groups](#uberFire-users,-roles-and-groups)**\n* **[Project Modules](#project-modules)**\n* **[Installation notes](#installation-notes)**\n\nIntroduction\n------------\n\nThis module and its sub-modules provide the users, groups and roles management components, services and  user interface screens and widgets for the entities management of the application's security realm.                \n\nThe UberFire security system delegates the authorization and authentication to the underlying container's security environment. \nSo the users, groups and roles potentially come from different realms, such as the properties file for JBoss Wildfly's or EAP, or the XML file for Tomcat, etc. \nDue to this fact, the UF users management feature is based on services and their implementations. It defaults with the users, groups and roles services and three concrete implementations for:         \n* JBoss Wildfly / EAP - Properties based realms              \n* JBoss KeyCloak based realms           \n\nNOTE: If you are using the application against another security system, you can build your own users, groups and roles service provider implementations.               \n\nIn addition, note that each security realm can allow different features, for example, \nwhen using the properties realm in Wildfly, the user entity does not have name neither address, etc, \nso it does not have more properties than the identifier, but on the other hand, when using JBoss KeyCloak as the security provider, \nit allows more user meta-data. So the different UF users management services and interfaces are taking this into account by adding support for set of <i>capabilities</i>, \nwhich can be potentially supported by the provider implementation or not,  Please take a look at the concrete service provider implementation documentation to check all the supported capabilities.                   \n\n\nUberFire Users, Roles and Groups\n--------------------------------\n\nUberFire's security system provides an entities model based on users, groups and roles. As many security realms, such as the default for Wildfly, EAP or Keycloak, does either support groups or roles, not both, here is how UF behaves:                    \n\n* The users are the users that come from the security realm                 \n* The roles are the groups or roles, depending on what the concrete realm provides, that come from the security realm and are registered in the Roles Registry (see `org.uberfire.ext.security.server.RolesRegistry`)               \n* The groups are the groups or roles, depending on what the concrete realm provides, that come from the security realm and are not registered as roles in the Roles Registry                   \n\nSo keep in mind that if the security realm being used it does not support both groups and roles, \nthe user assignments will be performed with no differentiation, so all groups and roles assigned to a given user will be added in the security realm, \nno matter if it's a group or a role. At user load time, UF will check the Roles Registry and will apply the right assignment behaviour.             \n\nDo to this fact, the role management service implementation used by default is just based on having static roles, the roles that are present in the Roles Registry (see `org.uberfire.ext.security.server.RolesRegistry`).                     \n\nProject Modules\n---------------\n\nHere is a short summary of the project sub-modules:                  \n\n* [`uberfire-security-management-api`](./uberfire-security-management-api/) - Provides the different classes and interfaces for the users, groups and roles management used in both backend and client side.                         \n* [`uberfire-security-management-backend`](./uberfire-security-management-backend/) - Provides the different classes and implementations for the users, groups and roles management backend services and other stuff.                         \n* [`uberfire-security-management-client`](./uberfire-security-management-client/) - Provides the different classes and implementations for the users, groups and roles management client stuff.                         \n* [`uberfire-security-management-client-wb`](./uberfire-security-management-client-wb/README.md) - Provides the perspectives and screens for the client side integration into the UF workbench.                         \n* [`uberfire-security-management-keycloak`](./uberfire-security-management-keycloak/README.md) - Provides the concrete users, groups and roles service provider implementations for JBoss KeyCloak.                          \n* [`uberfire-security-management-wildfly`](./uberfire-security-management-wildfly/README.md) - Provides the concrete users, groups and roles service provider implementations for JBoss Wildfly or JBoss EAP.                          \n* [`uberfire-widgets-security-management`](./uberfire-widgets-security-management/README.md) - Provides the widgets for the users, groups and roles management, such as explorers, editors, etc.                         \n* [`uberfire-security-management-webapp`](./uberfire-security-management-webapp/README.md) - A simple web application that defaults with the users and group management perspectives and uses, by default, the embedded wildfly's realm.                         \n\nInstallation notes\n------------------\n\nPlease take a look at the installation notes at the [Client WB module readme](./uberfire-security-management-client-wb/README.md).               \n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-extensions</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Security - Users and groups Management</name>\n  <description>Uberfire Security - Users and groups Management</description>\n  <modules>\n    <module>uberfire-security-management-api</module>\n    <module>uberfire-security-management-backend</module>\n    <module>uberfire-security-management-keycloak</module>\n    <module>uberfire-security-management-wildfly</module>\n    <module>uberfire-security-management-client</module>\n    <module>uberfire-widgets-security-management</module>\n    <module>uberfire-security-management-client-wb</module>\n  </modules>\n\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Security Management - Users and groups management API</name>\n  <description>Uberfire Security Management - Users and groups management API</description>\n\n  <dependencies>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-servlet-security</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>javax.validation</groupId>\n      <artifactId>validation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    \n  </dependencies>\n  \n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/AbstractEntityManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\n\n/**\n * <p>Basic management API for security realm entities type of <code>T</code>.</p>\n * @since 0.8.0\n */\npublic interface AbstractEntityManager<T, S extends Settings> {\n\n    /**\n     * Search entities.\n     * @param request The search request constraints.\n     * @return List of resulting entities from the search result.\n     * @throws SecurityManagementException\n     */\n    SearchResponse<T> search(SearchRequest request) throws SecurityManagementException;\n\n    /**\n     * Obtain a single entity instance.\n     * @param identifier The entity's identifier.\n     * @return The entity for the given identifier.\n     * @throws SecurityManagementException\n     */\n    T get(final String identifier) throws SecurityManagementException;\n\n    /**\n     * <p>The entities list of given type.</p>\n     * @return List of all the entities present for given type.\n     * @throws SecurityManagementException\n     */\n    List<T> getAll() throws SecurityManagementException;\n\n    /**\n     * Creates a given entity in the backend security environment.\n     * @param entity The entity to create.\n     * @return The entity.\n     * @throws SecurityManagementException\n     */\n    T create(T entity) throws SecurityManagementException;\n\n    /**\n     * Creates a given entity in the backend security environment.\n     * @param entity The entity to create.\n     * @return The entity.\n     * @throws SecurityManagementException\n     */\n    T update(T entity) throws SecurityManagementException;\n\n    /**\n     * Deletes a given entity or entities (bulk delete) in the backend security environment.\n     * @param identifiers The entity identifiers to delete.\n     * @return The entity.\n     * @throws SecurityManagementException\n     */\n    void delete(final String... identifiers) throws SecurityManagementException;\n\n    /**\n     * The entity manager settings.\n     * @return The settings for the entitty manager.\n     */\n    S getSettings();\n\n    /**\n     * <p>The request parameters for performing entity searching on the backend security server.</p>\n     */\n    interface SearchRequest {\n\n        /**\n         * <p>The search pattern string.</p>\n         * @return The search pattern.\n         */\n        String getSearchPattern();\n\n        /**\n         * <p>Constrained (not available to use) identifiers.</p>\n         */\n        Set<String> getConstrainedIdentifiers();\n\n        /**\n         * <p>Constrained (not available to use) identifiers.</p>\n         * <p>If you don't want to include some entities in the response, add their identifiers in the collection.</p>\n         */\n        SearchRequest setConstrainedIdentifiers(Set<String> constrainedIdentifiers);\n\n        /**\n         * <p>The page number for the search cursor.</p>\n         * <p>IMPORTANT NOTE: Page number starts with value <code>1</code>.</p>\n         * @return The page for the returned results.\n         */\n        int getPage();\n\n        /**\n         * <p>The number of items for each page.</p>\n         * @return The page size.\n         */\n        int getPageSize();\n    }\n\n    /**\n     * <p>The response values for a search operation.</p>\n     * @param <T> The entity type.\n     */\n    interface SearchResponse<T> {\n\n        /**\n         * <p>The entities resulting from the search operation.</p>\n         * @return The entities resulting from the search operation.\n         */\n        List<T> getResults();\n\n        /**\n         * <p>The total entities count.</p>\n         * @return <p>By convention, if the service provider implementation class is not able to get the row count, this method should return <code>-1</code>.</p>\n         * <p>Otherwise, returns search results count for this entity type.</p>\n         */\n        int getTotal();\n\n        /**\n         * <p>Indicates if there are more results (next pages).</p>\n         * <p>If the service provider implementation class is not able to return a value for <code>getTotal</code>, this method can be used to find out if there are more pages.</p>\n         * @return Indicates if there are more results (next pages).\n         */\n        boolean hasNextPage();\n\n        /**\n         * <p>The search pattern string.</p>\n         * @return The search pattern.\n         */\n        String getSearchPattern();\n\n        /**\n         * <p>The page number for the search cursor.</p>\n         * <p>IMPORTANT NOTE: Page number starts with value <code>1</code>.</p>\n         * @return The page for the returned results.\n         */\n        int getPage();\n\n        /**\n         * <p>The number of items for each page.</p>\n         * @return The page size.\n         */\n        int getPageSize();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/Capability.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Supported features for the User System Management services.</p>\n * <p>The backend and UI features for users management available are based on these capability statuses.\n * If a capability is not supported by the current service provider implementation class, it will be not available from the user interface neither the backend method calls.</p>\n * @since 0.8.0\n */\n@Portable\npublic enum Capability {\n\n    // USERS features.\n    CAN_SEARCH_USERS,\n    CAN_ADD_USER,\n    CAN_UPDATE_USER,\n    CAN_READ_USER,\n    CAN_DELETE_USER,\n    CAN_MANAGE_ATTRIBUTES,\n    CAN_ASSIGN_GROUPS,\n    CAN_ASSIGN_ROLES,\n    CAN_CHANGE_PASSWORD,\n\n    // GROUPS features.\n    CAN_SEARCH_GROUPS,\n    CAN_ADD_GROUP,\n    CAN_UPDATE_GROUP,\n    CAN_READ_GROUP,\n    CAN_DELETE_GROUP,\n\n    // ROLES features.\n    CAN_SEARCH_ROLES,\n    CAN_ADD_ROLE,\n    CAN_UPDATE_ROLE,\n    CAN_READ_ROLE,\n    CAN_DELETE_ROLE;\n\n    Capability() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/CapabilityStatus.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>The status for a capability.</p>\n * <p>Usually a capability can be executed in the service provider if the status of it is <code>ENABLED</code>.</p>\n * @since 0.8.0\n */\n@Portable\npublic enum CapabilityStatus {\n    UNSUPPORTED,\n    ENABLED;\n\n    CapabilityStatus() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/ContextualManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\n/**\n * <p>You should implement this interface if your managed will be handled within the given EE context (eg: JavaEE CDI context).</p>.\n * @since 0.8.0\n */\npublic interface ContextualManager {\n\n    /**\n     * <p>Use this method to initialize your manager within the given context (usually JavaEE CDI).</p>\n     * @param userSystemManager The users system manager instance for the given context.\n     */\n    void initialize(UserSystemManager userSystemManager) throws Exception;\n\n    /**\n     * <p>Use this method to destroy your manager within the given context (usually JavaEE CDI).</p>\n     */\n    void destroy() throws Exception;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/GroupManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\n\n/**\n * <p>The Groups Manager.</p>\n * <p>\n * <p>NOTE: Some user management security systems do not provide support for roles and groups, only one of them.\n * Consider that UF roles are the ones defined in the deployment descriptor (web.xml) and present in the <code>org.uberfire.ext.security.server.RolesRegistry</code>.\n * So take care when searching or getting a group, if it's name is registered as a role, it must NOT be considered for management here.\n * This behavior has to be done by each security management provider implementation, depending on the external security system being used.</p>\n * @since 0.8.0\n */\npublic interface GroupManager extends AbstractEntityManager<Group, GroupManagerSettings> {\n\n    /**\n     * <p>Assign the a group to a given collection of users.</p>.\n     * @param name The group name.\n     * @param users The collection of user identifiers. The group will be assigned to each one.\n     * @throws SecurityManagementException\n     */\n    void assignUsers(String name,\n                     Collection<String> users) throws SecurityManagementException;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/GroupManagerSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.Collection;\n\n/**\n * <p>The settings for a groups entity manager.</p>\n * @since 0.8.0\n */\npublic interface GroupManagerSettings extends Settings {\n\n    /**\n     * <p>Specify if the provider allows groups with no users assigned.</p>\n     * <p>Usually realm based on property files, such as the default ones for Wildfly or EAP, does not allow empty users\n     * as the username is the key for the property entry.</p>\n     * @return Allows groups with any user assigned.\n     */\n    boolean allowEmpty();\n\n    /**\n     * Return constrained groups for management\n     */\n    Collection<String> getConstrainedGroups();\n\n    /**\n     * Sets constrained groups for management (usually the registered roles).\n     */\n    void setConstrainedGroups(Collection<String> constrainedGroups);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/RoleManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport org.jboss.errai.security.shared.api.Role;\n\n/**\n * <p>The Roles Manager.</p>\n * @since 0.8.0\n */\npublic interface RoleManager extends AbstractEntityManager<Role, RoleManagerSettings> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/RoleManagerSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\n/**\n * <p>The settings for a roles entity manager.</p>\n * @since 0.8.0\n */\npublic interface RoleManagerSettings extends Settings {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/Settings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.Map;\n\n/**\n * <p>The settings for a given entity manager.</p>\n * @since 0.8.0\n */\npublic interface Settings {\n\n    /**\n     * <p>Obtain all available provider capabilities in a single call.</p>\n     * @return All capabilities for the service and their status.\n     */\n    Map<Capability, CapabilityStatus> getCapabilities();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/UserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\n/**\n * <p>The services provided by a concrete user management service provider implementation.</p>\n * <p>Each concrete service provider has to implement this interface to provider the different managers.\n * Note that the service is found given a CDI bean name, eg: <code>Wildfly</code>,\n * so this interface defines the users, groups and roles manager beans to use when using the <code>Wildfly</code> or whatever the implementation is.</p>\n * @since 0.8.0\n */\npublic interface UserManagementService {\n\n    /**\n     * <p>The Users Manager service.</p>\n     * @return The concrete users manager service implementation used by this provider.\n     */\n    UserManager users();\n\n    /**\n     * <p>The Groups Manager service.</p>\n     * @return The concrete groups manager service implementation used by this provider.\n     */\n    GroupManager groups();\n\n    /**\n     * <p>The Roles Manager service.</p>\n     * @return The concrete roles manager service implementation used by this provider.\n     */\n    RoleManager roles();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/UserManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\n\n/**\n * <p>The Users Manager.</p>\n * <p>The user manager provide additional methods to implement from the entity manager ones.</p>\n * @since 0.8.0\n */\npublic interface UserManager extends AbstractEntityManager<User, UserManagerSettings> {\n\n    /**\n     * <p>Assign a collection of groups to a user.</p>.\n     * <p>All the groups given will be assigned to the user, the current existing assigned ones will be removed.</p>\n     * <p>It's important to note that the inherited <code>create</code> and <code>update</code> methods should not assign groups, this operations must be done in this method,\n     * as it's easier for mapping with the capabilities approach.</p>\n     * @param username The user identifier.\n     * @param groups The collection of groups identifiers to assign.\n     * @throws SecurityManagementException\n     */\n    void assignGroups(String username,\n                      Collection<String> groups) throws SecurityManagementException;\n\n    /**\n     * <p>Assign a collection of roles to a user.</p>.\n     * <p>All the roles given will be assigned to the user, the current existing assigned ones will be removed.</p>\n     * <p>It's important to note that the inherited <code>create</code> and <code>update</code> methods should not assign roles, this operations must be done in this method,\n     * as it's easier for mapping with the capabilities approach.</p>\n     * @param username The user identifier.\n     * @param roles The collection of roles identifiers to assign.\n     * @throws SecurityManagementException\n     */\n    void assignRoles(String username,\n                     Collection<String> roles) throws SecurityManagementException;\n\n    /**\n     * <p>Changes the user's password.</p>\n     * @param username The user identifier.\n     * @param newPassword The new password.\n     * @throws SecurityManagementException\n     */\n    void changePassword(String username,\n                        String newPassword) throws SecurityManagementException;\n\n    /**\n     * <p>Description of a user attribute that is supported by the specific manager implementation.</p>\n     */\n    interface UserAttribute {\n\n        /**\n         * The attribute name.\n         * @return The attribute name.\n         */\n        String getName();\n\n        /**\n         * Specifies if the attribute is required for creating a user or if it cannot be removed.\n         * @return Is mandatory.\n         */\n        boolean isMandatory();\n\n        /**\n         * Specifies if the attribute can be modified.\n         * @return Is editable.\n         */\n        boolean isEditable();\n\n        /**\n         * The default value for an attribute.\n         * Used when creating a new user and setting mandatory attributes.\n         * @return The default value for the attribute, if any.\n         */\n        String getDefaultValue();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/UserManagerSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport java.util.Collection;\n\n/**\n * <p>The settings for a users entity manager.</p>\n * @since 0.8.0\n */\npublic interface UserManagerSettings extends Settings {\n\n    /**\n     * <p>This method is used to provide all the supported user attributes supported by the specific manager implementation.</p>\n     * @return The collection of supported attributes in the underlying security system.\n     */\n    Collection<UserManager.UserAttribute> getSupportedAttributes();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/UserSystemManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.validation.EntityValidator;\n\n/**\n * <p>Main users, groups and roles management API.</p>\n * <p>It provides a centralized entry point for using the different entities management API.</p>\n * <p>By default, two implementation are provided. A given one for the backend side and another one for the client side.</p>\n * @see <a>org.uberfire.ext.security.management.BackendUserSystemManager</a>\n * @see <a>org.uberfire.ext.security.management.client.ClientUserSystemManager</a>\n * @since 0.8.0\n */\npublic interface UserSystemManager extends UserManagementService {\n\n    /**\n     * <p>The user validator.</p>\n     * @return The user validator instance.\n     */\n    EntityValidator<User> usersValidator();\n\n    /**\n     * <p>The group validator.</p>\n     * @return The group validator instance.\n     */\n    EntityValidator<Group> groupsValidator();\n\n    /**\n     * <p>The role validator.</p>\n     * @return The role validator instance.\n     */\n    EntityValidator<Role> rolesValidator();\n\n    /**\n     * Check if the user system management service are active and successfully initialized.\n     */\n    boolean isActive();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/event/UserDeletedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.event;\n\npublic class UserDeletedEvent {\n\n    private String identifier;\n\n    public UserDeletedEvent() {\n    }\n\n    public UserDeletedEvent(String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/ClientNotFoundException.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ClientNotFoundException extends EntityNotFoundException {\n\n    public ClientNotFoundException(@MapsTo(\"identifier\") String identifier) {\n        super(identifier);\n    }\n\n    @Override\n    public String getMessage() {\n        return \"Client [\" + getIdentifier() + \"] not configured\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/EntityNotFoundException.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when some entity is not found.</p>\n * @since 0.8.0\n */\n@Portable\npublic class EntityNotFoundException extends SecurityManagementException {\n\n    private String identifier;\n\n    public EntityNotFoundException(@MapsTo(\"identifier\") String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String getMessage() {\n        return \"Entity [\" + identifier + \"] not found\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/GroupNotFoundException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when the group is not found.</p>\n * @since 0.8.0\n */\n@Portable\npublic class GroupNotFoundException extends EntityNotFoundException {\n\n    public GroupNotFoundException(@MapsTo(\"identifier\") String identifier) {\n        super(identifier);\n    }\n\n    @Override\n    public String getMessage() {\n        return \"Group [\" + getIdentifier() + \"] not found\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/InvalidEntityIdentifierException.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>The entity's identifier is invalid.</p>\n * @since 2.0.0\n */\n@Portable\npublic class InvalidEntityIdentifierException extends EntityNotFoundException {\n\n    private final String symbolsAccepted;\n\n    public InvalidEntityIdentifierException(@MapsTo(\"identifier\") String identifier,\n                                            @MapsTo(\"symbolsAccepted\") String symbolsAccepted) {\n        super(identifier);\n        this.symbolsAccepted = symbolsAccepted;\n    }\n\n    public String getSymbolsAccepted() {\n        return symbolsAccepted;\n    }\n\n    @Override\n    public String getMessage() {\n        return \"Invalid entity identifier. \" +\n                \"[identifier=\" + getIdentifier() +\n                \", symbolsAccepted=\" + symbolsAccepted + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/NoImplementationAvailableException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when the service provider implementation class is not available.</p>\n * @since 0.8.0\n */\n@Portable\npublic class NoImplementationAvailableException extends SecurityManagementException {\n\n    public NoImplementationAvailableException() {\n    }\n\n    @Override\n    public String getMessage() {\n        return \"No user/group security management provider available\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/OperationFailedException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when some remote operation has failed.</p>\n * @since 0.8.0\n */\n@Portable\npublic class OperationFailedException extends SecurityManagementException {\n\n    private int code;\n    private String message;\n\n    public OperationFailedException(@MapsTo(\"code\") int code,\n                                    @MapsTo(\"message\") String message) {\n        this.code = code;\n        this.message = message;\n    }\n\n    public int getCode() {\n        return code;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/RealmManagementNotAuthorizedException.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RealmManagementNotAuthorizedException\n        extends SecurityManagementException {\n\n    private final String realmResource;\n\n    public RealmManagementNotAuthorizedException(final @MapsTo(\"realmResource\") String realmResource) {\n        this.realmResource = realmResource;\n    }\n\n    public String getRealmResource() {\n        return realmResource;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/SecurityManagementException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Generic exception for user system management API.</p>\n * @since 0.8.0\n */\n@Portable\npublic class SecurityManagementException extends RuntimeException {\n\n    public SecurityManagementException() {\n    }\n\n    public SecurityManagementException(String message) {\n        super(message);\n    }\n\n    public SecurityManagementException(Throwable cause) {\n        super(cause);\n    }\n\n    public SecurityManagementException(String message, Throwable cause) {\n        super(message, cause);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/UnsupportedServiceCapabilityException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.Capability;\n\n/**\n * <p>Exception for user system management when trying to operate with a non supported feature (capability).</p>\n * @since 0.8.0\n */\n@Portable\npublic class UnsupportedServiceCapabilityException extends SecurityManagementException {\n\n    private Capability capability;\n\n    public UnsupportedServiceCapabilityException(@MapsTo(\"capability\") Capability capability) {\n        this.capability = capability;\n    }\n\n    public Capability getCapability() {\n        return capability;\n    }\n\n    @Override\n    public String getMessage() {\n        return \"Capability [\" + capability + \"] not supported\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/UserAlreadyExistsException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when the entity to create already exists.</p>\n * @since 0.8.0\n */\n@SuppressWarnings(\"serial\")\n@Portable\npublic class UserAlreadyExistsException extends SecurityManagementException {\n\n    private String identifier;\n\n    public UserAlreadyExistsException(@MapsTo(\"identifier\") String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getUserId() {\n        return identifier;\n    }\n\n    @Override\n    public String getMessage() {\n        return \"User [\" + identifier + \" already exists\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/exception/UserNotFoundException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>Exception for user system management when the user is not found.</p>\n * @since 0.8.0\n */\n@Portable\npublic class UserNotFoundException extends EntityNotFoundException {\n\n    public UserNotFoundException(@MapsTo(\"identifier\") String identifier) {\n        super(identifier);\n    }\n\n    @Override\n    public String getMessage() {\n        return \"User [\" + getIdentifier() + \"] not found\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/service/GroupManagerService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.api.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.security.management.api.GroupManager;\n\n/**\n * <p>Remote service API for the Groups Manager.</p>\n * @since 0.8.0\n */\n@Remote\npublic interface GroupManagerService extends GroupManager {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/service/RoleManagerService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.api.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.security.management.api.RoleManager;\n\n/**\n * <p>Remote service API for the Roles Manager.</p>\n * @since 0.8.0\n */\n@Remote\npublic interface RoleManagerService extends RoleManager {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/service/UserManagerService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.api.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.security.WorkbenchUserManager;\n\n/**\n * <p>Remote service API for the Users Manager.</p>\n * @since 0.8.0\n */\n@Remote\npublic interface UserManagerService extends UserManager,\n                                            WorkbenchUserManager {\n\n    @Override\n    default User getUser(String identifier) {\n        return get(identifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/validation/EntityValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\n/**\n * <p>The validator contract for a given security entity of type <code>T</code>.</p>\n * <p>Compatible with JSR303 Bean Validation for future integration with other validation frameworks.</p>\n * @param <T> The security entity type.\n * @since 0.8.0\n */\npublic interface EntityValidator<T> {\n\n    /**\n     * <p>Validates the given entity.</p>\n     * @param entity The entity instance to validate.\n     * @return The validation constraints collection produced.\n     */\n    Set<ConstraintViolation<T>> validate(T entity);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/validation/GroupValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Path;\nimport javax.validation.metadata.ConstraintDescriptor;\n\nimport org.jboss.errai.security.shared.api.Group;\n\n/**\n * <p>The base validator class for a Group entity based on JSR303 Bean Validations.</p>\n * <p>Current validations:</p>\n * <ul>\n * <li>Group name is mandatory</li>\n * </ul>\n * <p>This provides validation logic for both backend and client sides, but you have to provide an instantiable class that provides the error message descriptions for each validation error supported.</p>\n * @since 0.8.0\n */\npublic abstract class GroupValidator implements EntityValidator<Group> {\n\n    public static final String KEY_NAME_NOT_EMPTY = \"nameNotEmpty\";\n\n    @Override\n    public Set<ConstraintViolation<Group>> validate(Group entity) {\n        if (entity == null) {\n            return null;\n        }\n        final String id = entity.getName();\n        Set<ConstraintViolation<Group>> result = new HashSet<ConstraintViolation<Group>>(1);\n        // Validate user name not empty.\n        if (id == null || id.trim().length() == 0) {\n            final String msg = getMessage(KEY_NAME_NOT_EMPTY);\n            result.add(createViolation(entity,\n                                       \"name\",\n                                       msg));\n        }\n        return result;\n    }\n\n    public abstract String getMessage(final String key);\n\n    private ConstraintViolation<Group> createViolation(final Group user,\n                                                       final String attribute,\n                                                       final String message) {\n        if (user == null) {\n            return null;\n        }\n\n        return new ConstraintViolation<Group>() {\n            @Override\n            public String getMessage() {\n                return message;\n            }\n\n            @Override\n            public String getMessageTemplate() {\n                return message;\n            }\n\n            @Override\n            public Group getRootBean() {\n                return user;\n            }\n\n            @Override\n            public Class<Group> getRootBeanClass() {\n                return Group.class;\n            }\n\n            @Override\n            public Object getLeafBean() {\n                return null;\n            }\n\n            @Override\n            public Path getPropertyPath() {\n                return new Path() {\n                    @Override\n                    public Iterator<Node> iterator() {\n                        Set<Node> nodes = new HashSet<Node>(1);\n                        nodes.add(new Node() {\n                            @Override\n                            public String getName() {\n                                return attribute;\n                            }\n\n                            @Override\n                            public boolean isInIterable() {\n                                return false;\n                            }\n\n                            @Override\n                            public Integer getIndex() {\n                                return 0;\n                            }\n\n                            @Override\n                            public Object getKey() {\n                                return attribute;\n                            }\n                        });\n                        return nodes.iterator();\n                    }\n                };\n            }\n\n            @Override\n            public Object getInvalidValue() {\n                return null;\n            }\n\n            @Override\n            public ConstraintDescriptor<?> getConstraintDescriptor() {\n                return null;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/validation/RoleValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Role;\n\n/**\n * <p>The base validator class for a Role entity based on JSR303 Bean Validations.</p>\n * <p>This provides validation logic for both backend and client sides, but you have to provide an instantiable class that provides the error message descriptions for each validation error supported.</p>\n * @since 0.8.0\n */\npublic abstract class RoleValidator implements EntityValidator<Role> {\n\n    @Override\n    public Set<ConstraintViolation<Role>> validate(Role entity) {\n        return new HashSet<>();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/api/validation/UserValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\nimport javax.validation.Path;\nimport javax.validation.metadata.ConstraintDescriptor;\n\nimport org.jboss.errai.security.shared.api.identity.User;\n\n/**\n * <p>The base validator class for a User entity based on JSR303 Bean Validations.</p>\n * <p>Current validations:</p>\n * <ul>\n * <li>User identifier (username) is mandatory</li>\n * </ul>\n * <p>This provides validation logic for both backend and client sides, but you have to provide an instantiable class that provides the error message descriptions for each validation error supported.</p>\n * @since 0.8.0\n */\npublic abstract class UserValidator implements EntityValidator<User> {\n\n    public static final String KEY_NAME_NOT_EMPTY = \"nameNotEmpty\";\n\n    @Override\n    public Set<ConstraintViolation<User>> validate(final User entity) {\n        if (entity == null) {\n            return null;\n        }\n        final String id = entity.getIdentifier();\n        Set<ConstraintViolation<User>> result = new HashSet<ConstraintViolation<User>>(1);\n        // Validate user name not empty.\n        if (id == null || id.trim().length() == 0) {\n            final String msg = getMessage(KEY_NAME_NOT_EMPTY);\n            result.add(createViolation(entity,\n                                       \"identifier\",\n                                       msg));\n        }\n        return result;\n    }\n\n    public abstract String getMessage(final String key);\n\n    private ConstraintViolation<User> createViolation(final User user,\n                                                      final String attribute,\n                                                      final String message) {\n        if (user == null) {\n            return null;\n        }\n\n        return new ConstraintViolation<User>() {\n            @Override\n            public String getMessage() {\n                return message;\n            }\n\n            @Override\n            public String getMessageTemplate() {\n                return message;\n            }\n\n            @Override\n            public User getRootBean() {\n                return user;\n            }\n\n            @Override\n            public Class<User> getRootBeanClass() {\n                return User.class;\n            }\n\n            @Override\n            public Object getLeafBean() {\n                return null;\n            }\n\n            @Override\n            public Path getPropertyPath() {\n                return new Path() {\n                    @Override\n                    public Iterator<Node> iterator() {\n                        Set<Node> nodes = new HashSet<Node>(1);\n                        nodes.add(new Node() {\n                            @Override\n                            public String getName() {\n                                return attribute;\n                            }\n\n                            @Override\n                            public boolean isInIterable() {\n                                return false;\n                            }\n\n                            @Override\n                            public Integer getIndex() {\n                                return 0;\n                            }\n\n                            @Override\n                            public Object getKey() {\n                                return attribute;\n                            }\n                        });\n                        return nodes.iterator();\n                    }\n                };\n            }\n\n            @Override\n            public Object getInvalidValue() {\n                return null;\n            }\n\n            @Override\n            public ConstraintDescriptor<?> getConstraintDescriptor() {\n                return null;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/GroupManagerSettingsImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\n\n/**\n * <p>Default settings for a group manager.</p>\n * @since 0.8.0\n */\n@Portable\npublic class GroupManagerSettingsImpl extends SettingsImpl implements GroupManagerSettings {\n\n    final boolean allowEmpty;\n    Collection<String> constrainedGroups;\n\n    public GroupManagerSettingsImpl(@MapsTo(\"capabilities\") Map<Capability, CapabilityStatus> capabilities,\n                                    @MapsTo(\"allowEmpty\") boolean allowEmpty) {\n        super(capabilities);\n        this.allowEmpty = allowEmpty;\n    }\n\n    @Override\n    public boolean allowEmpty() {\n        return allowEmpty;\n    }\n\n    @Override\n    public Collection<String> getConstrainedGroups() {\n        return constrainedGroups;\n    }\n\n    @Override\n    public void setConstrainedGroups(final Collection<String> constrainedGroups) {\n        this.constrainedGroups = constrainedGroups;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/RoleManagerSettingsImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.RoleManagerSettings;\n\n/**\n * <p>Default settings for a role manager.</p>\n * @since 0.8.0\n */\n@Portable\npublic class RoleManagerSettingsImpl extends SettingsImpl implements RoleManagerSettings {\n\n    public RoleManagerSettingsImpl(@MapsTo(\"capabilities\") Map<Capability, CapabilityStatus> capabilities) {\n        super(capabilities);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/SearchRequestImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\n\n/**\n * <p>A default search request implementation for the users system management.</p>\n * @since 0.8.0\n */\n@Portable\npublic class SearchRequestImpl implements AbstractEntityManager.SearchRequest {\n\n    private String searchPattern = \"\";\n    private Set<String> constrainedIdentifiers;\n    private int page = 1;\n    private int pageSize = 15;\n\n    public SearchRequestImpl() {\n    }\n\n    public SearchRequestImpl(String searchPattern,\n                             int page,\n                             int pageSize) {\n        this.searchPattern = searchPattern;\n        this.page = page;\n        this.pageSize = pageSize;\n    }\n\n    public SearchRequestImpl(String searchPattern,\n                             int page,\n                             int pageSize,\n                             Set<String> constrainedIdentifiers) {\n        this.searchPattern = searchPattern;\n        this.page = page;\n        this.pageSize = pageSize;\n        this.constrainedIdentifiers = constrainedIdentifiers;\n    }\n\n    @Override\n    public String getSearchPattern() {\n        return searchPattern;\n    }\n\n    @Override\n    public AbstractEntityManager.SearchRequest setConstrainedIdentifiers(Set<String> constrainedIdentifiers) {\n        this.constrainedIdentifiers = constrainedIdentifiers;\n        return this;\n    }\n\n    @Override\n    public Set<String> getConstrainedIdentifiers() {\n        return constrainedIdentifiers;\n    }\n\n    @Override\n    public int getPage() {\n        return page;\n    }\n\n    @Override\n    public int getPageSize() {\n        return pageSize;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/SearchResponseImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\n\n/**\n * <p>A default search response implementation for the users system management.</p>\n * @since 0.8.0\n */\n@Portable\npublic class SearchResponseImpl<T> implements AbstractEntityManager.SearchResponse<T> {\n\n    private String searchPattern = \"\";\n    private int page = -1;\n    private int pageSize = -1;\n    private List<T> results;\n    private int total = -1;\n    private boolean hasNextPage;\n\n    public SearchResponseImpl() {\n    }\n\n    public SearchResponseImpl(final List<T> results,\n                              final int page,\n                              final int pageSize,\n                              final int total,\n                              final boolean hasNextPage) {\n        this.results = results;\n        this.page = page;\n        this.pageSize = pageSize;\n        this.total = total;\n        this.hasNextPage = hasNextPage;\n    }\n\n    @Override\n    public List<T> getResults() {\n        return results;\n    }\n\n    @Override\n    public int getTotal() {\n        return total;\n    }\n\n    @Override\n    public boolean hasNextPage() {\n        return hasNextPage;\n    }\n\n    @Override\n    public String getSearchPattern() {\n        return searchPattern;\n    }\n\n    @Override\n    public int getPage() {\n        return page;\n    }\n\n    @Override\n    public int getPageSize() {\n        return pageSize;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/SettingsImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.Settings;\n\n/**\n * <p>Base provider settings implementation.</p>\n * @since 0.8.0\n */\n@Portable\npublic class SettingsImpl implements Settings {\n\n    final Map<Capability, CapabilityStatus> capabilities;\n\n    public SettingsImpl(@MapsTo(\"capabilities\") Map<Capability, CapabilityStatus> capabilities) {\n        this.capabilities = capabilities;\n    }\n\n    @Override\n    public Map<Capability, CapabilityStatus> getCapabilities() {\n        return capabilities;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/UserAttributeImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.UserManager;\n\n/**\n * <p>Default portable User attribute implementation class.</p>\n * @since 0.8.0\n */\n@Portable\npublic class UserAttributeImpl implements UserManager.UserAttribute {\n\n    private String name;\n    private boolean isEditable;\n    private boolean isMandatory;\n    private String defaultValue;\n\n    public UserAttributeImpl(@MapsTo(\"name\") String name,\n                             @MapsTo(\"isMandatory\") boolean isMandatory,\n                             @MapsTo(\"isEditable\") boolean isEditable,\n                             @MapsTo(\"defaultValue\") String defaultValue) {\n        this.name = name;\n        this.isMandatory = isMandatory;\n        this.isEditable = isEditable;\n        this.defaultValue = defaultValue;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public boolean isMandatory() {\n        return isMandatory;\n    }\n\n    @Override\n    public boolean isEditable() {\n        return isEditable;\n    }\n\n    @Override\n    public String getDefaultValue() {\n        return defaultValue;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == null) {\n            return false;\n        }\n        if (name == null) {\n            return false;\n        }\n\n        try {\n            UserManager.UserAttribute d = (UserManager.UserAttribute) obj;\n            return name.equals(d.getName());\n        } catch (ClassCastException e) {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/java/org/uberfire/ext/security/management/impl/UserManagerSettingsImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.impl;\n\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\n\n/**\n * <p>Default settings for a user manager.</p>\n * @since 0.8.0\n */\n@Portable\npublic class UserManagerSettingsImpl extends SettingsImpl implements UserManagerSettings {\n\n    // Supported attributes for users manager on backend side.\n    final Collection<UserManager.UserAttribute> supportedAttributes;\n\n    public UserManagerSettingsImpl(@MapsTo(\"capabilities\") Map<Capability, CapabilityStatus> capabilities,\n                                   @MapsTo(\"supportedAttributes\") Collection<UserManager.UserAttribute> supportedAttributes) {\n        super(capabilities);\n        this.supportedAttributes = supportedAttributes;\n    }\n\n    @Override\n    public Collection<UserManager.UserAttribute> getSupportedAttributes() {\n        return supportedAttributes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/main/resources/org/uberfire/ext/security/management/UberfireSecurityManagementAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n\n  <source path='api'/>\n  <source path='impl'/>\n  <source path='util'/>\n  \n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/test/java/org/uberfire/ext/security/management/api/validation/GroupValidatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class GroupValidatorTest {\n\n    @Test\n    public void testValid() {\n        final Group group = mock(Group.class);\n        when(group.getName()).thenReturn(\"group1\");\n        Set<ConstraintViolation<Group>> violations = new GroupValidatorTestImpl().validate(group);\n        assertTrue(violations.isEmpty());\n    }\n\n    @Test\n    public void testBlankGroupName() {\n        final Group blankGroup = mock(Group.class);\n        when(blankGroup.getName()).thenReturn(\"\");\n        final Set<ConstraintViolation<Group>> violations1 = new GroupValidatorTestImpl().validate(blankGroup);\n        assertTrue(violations1.size() == 1);\n        final ConstraintViolation<Group> violation = violations1.iterator().next();\n        assertEquals(violation.getPropertyPath().iterator().next().getName(),\n                     \"name\");\n        assertEquals(violation.getMessage(),\n                     GroupValidator.KEY_NAME_NOT_EMPTY);\n    }\n\n    public static class GroupValidatorTestImpl extends GroupValidator {\n\n        @Override\n        public String getMessage(String key) {\n            return key;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-api/src/test/java/org/uberfire/ext/security/management/api/validation/UserValidatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.api.validation;\n\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class UserValidatorTest {\n\n    @Test\n    public void testValid() {\n        final User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        Set<ConstraintViolation<User>> violations = new UserValidatorTestImpl().validate(user);\n        assertTrue(violations.isEmpty());\n    }\n\n    @Test\n    public void testBlankUsername() {\n        final User blankUser = mock(User.class);\n        when(blankUser.getIdentifier()).thenReturn(\"\");\n        final Set<ConstraintViolation<User>> violations1 = new UserValidatorTestImpl().validate(blankUser);\n        assertTrue(violations1.size() == 1);\n        final ConstraintViolation<User> violation = violations1.iterator().next();\n        assertEquals(violation.getPropertyPath().iterator().next().getName(),\n                     \"identifier\");\n        assertEquals(violation.getMessage(),\n                     UserValidator.KEY_NAME_NOT_EMPTY);\n    }\n\n    public static class UserValidatorTestImpl extends UserValidator {\n\n        @Override\n        public String getMessage(String key) {\n            return key;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Security Management - Users and groups management Backend</name>\n  <description>Uberfire Security Management - Users and groups management Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n\n    <plugins>\n\n      <!-- Build the test-jar artifact as tests for other service implementation modules depends on these ones. -->\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-jar-plugin</artifactId>\n        <executions>\n          <execution>\n            <goals>\n              <goal>test-jar</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n\n    </plugins>\n\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/BackendUserSystemManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Enumeration;\nimport java.util.Properties;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.RoleManager;\nimport org.uberfire.ext.security.management.api.UserManagementService;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.validation.EntityValidator;\nimport org.uberfire.ext.security.management.validation.GroupValidatorImpl;\nimport org.uberfire.ext.security.management.validation.RoleValidatorImpl;\nimport org.uberfire.ext.security.management.validation.UserValidatorImpl;\n\n/**\n * <p>The main backend manager for the user management stuff.</p>\n * <p>\n * Note: No full role management support yet.\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class BackendUserSystemManager implements UserSystemManager {\n\n    public static final String ENV_USER_MANAGEMENT_PREFIX = \"org.uberfire.ext.security.management\";\n    public static final String ENV_USER_MANAGEMENT_SERVICE = ENV_USER_MANAGEMENT_PREFIX + \".api.userManagementServices\";\n    public static final String SECURITY_MANAGEMENT_DESCRIPTOR = \"security-management.properties\";\n    private static final Logger LOG = LoggerFactory.getLogger(BackendUserSystemManager.class);\n    @Inject\n    BeanManager beanManager;\n\n    @Inject\n    Instance<UserManagementService> userManagementServices;\n\n    private UserManager usersManagementService;\n    private GroupManager groupsManagementService;\n    private RoleManager roleManagementService;\n    private boolean isActive;\n\n    @PostConstruct\n    public void initialize() {\n\n        // Load properties found in the descriptor.\n        loadDescriptor();\n\n        // Obtain the services with the given runtime, descriptor or default properties configuration.\n        UserManagementService userManagementService = getService();\n\n        boolean isUserManagerActive = false;\n        boolean isGroupManagerActive = false;\n        boolean isRoleManagerActive = false;\n\n        if (null != userManagementService) {\n\n            // Look for the Service Provider implementation class targeted for users management.\n            usersManagementService = userManagementService.users();\n            if (usersManagementService != null) {\n                try {\n                    ContextualManager m = (ContextualManager) usersManagementService;\n                    m.initialize(this);\n                    isUserManagerActive = true;\n                } catch (ClassCastException e) {\n                    // Manager is not contextual.\n                } catch (Exception e) {\n                    LOG.error(\"UsersManagementService initialization failure\",\n                              e);\n                }\n            } else {\n                LOG.warn(\"No management services for users available.\");\n            }\n\n            // Look for the Service Provider implementation class  targeted for groups management.\n            groupsManagementService = userManagementService.groups();\n            if (groupsManagementService != null) {\n                try {\n                    ContextualManager m = (ContextualManager) groupsManagementService;\n                    m.initialize(this);\n                    isGroupManagerActive = true;\n                } catch (ClassCastException e) {\n                    // Manager is not contextual.\n                } catch (Exception e) {\n                    LOG.error(\"GroupManagementService initialization failure\",\n                              e);\n                }\n            } else {\n                LOG.warn(\"No management services for groups available.\");\n            }\n\n            // Look for the Service Provider implementation class  targeted for role management.\n            // NOTE: Not full role management support yet, so if no present, do not complain.\n            roleManagementService = userManagementService.roles();\n            if (roleManagementService != null) {\n                try {\n                    ContextualManager m = (ContextualManager) roleManagementService;\n                    m.initialize(this);\n                    isRoleManagerActive = true;\n                } catch (ClassCastException e) {\n                    // Manager is not contextual.\n                } catch (Exception e) {\n                    LOG.error(\"RoleManagementService initialization failure\",\n                              e);\n                }\n            }\n\n            this.isActive = isUserManagerActive && isGroupManagerActive && isRoleManagerActive;\n        } else {\n            LOG.warn(\"No user management services available.\");\n        }\n    }\n\n    public UserManager users() {\n        return usersManagementService;\n    }\n\n    public GroupManager groups() {\n        return groupsManagementService;\n    }\n\n    public RoleManager roles() {\n        return roleManagementService;\n    }\n\n    @Override\n    public EntityValidator<User> usersValidator() {\n        return new UserValidatorImpl();\n    }\n\n    @Override\n    public EntityValidator<Group> groupsValidator() {\n        return new GroupValidatorImpl();\n    }\n\n    @Override\n    public EntityValidator<Role> rolesValidator() {\n        return new RoleValidatorImpl();\n    }\n\n    @Override\n    public boolean isActive() {\n        return isActive;\n    }\n\n    @PreDestroy\n    public void onDestroy() {\n\n        if (usersManagementService != null) {\n            try {\n                ContextualManager m = (ContextualManager) usersManagementService;\n                m.destroy();\n            } catch (ClassCastException e) {\n                // Manager is not contextual.\n            } catch (Exception e) {\n                LOG.error(\"UserManagementService destroy failure\",\n                          e);\n            }\n        }\n\n        if (groupsManagementService != null) {\n            try {\n                ContextualManager m = (ContextualManager) groupsManagementService;\n                m.destroy();\n            } catch (ClassCastException e) {\n                // Manager is not contextual.\n            } catch (Exception e) {\n                LOG.error(\"GroupManagementService destroy failure\",\n                          e);\n            }\n        }\n\n        if (roleManagementService != null) {\n            try {\n                ContextualManager m = (ContextualManager) roleManagementService;\n                m.destroy();\n            } catch (ClassCastException e) {\n                // Manager is not contextual.\n            } catch (Exception e) {\n                LOG.error(\"RoleManagementService destroy failure\",\n                          e);\n            }\n        }\n    }\n\n    private UserManagementService getService() {\n        // Try to obtain the service impl from the system properties or from the descriptor file.\n        String serviceName = System.getProperty(ENV_USER_MANAGEMENT_SERVICE);\n        if (isEmpty(serviceName)) {\n            LOG.warn(\"No user management services implementation specified neither at runtime or in the properties descriptor for security management.\");\n            return null;\n        }\n\n        // Obtain the beans for the concrete impl to use.\n        Set<Bean<?>> beans = beanManager.getBeans(serviceName);\n        if (beans == null || beans.isEmpty()) {\n            LOG.warn(\"No bean found for name '\" + serviceName + \"'. \" + serviceName + \" services will not work.\");\n            return null;\n        }\n\n        // Instantiate the service impl.\n        LOG.info(\"Using the user management service named '\" + serviceName + \"'\");\n        Bean bean = (Bean) beans.iterator().next();\n        if (beans.size() > 1) {\n            LOG.warn(\"More than a single bean found for bean named '\" + serviceName + \"'. \" +\n                             \"Using the first one found in the classpath with fully classified classname '\" + bean.getBeanClass() + \"'.\");\n        }\n        CreationalContext context = beanManager.createCreationalContext(bean);\n        return (UserManagementService) beanManager.getReference(bean,\n                                                                bean.getBeanClass(),\n                                                                context);\n    }\n\n    private void loadDescriptor() {\n        InputStream is = BackendUserSystemManager.this.getClass().getClassLoader().getResourceAsStream(SECURITY_MANAGEMENT_DESCRIPTOR);\n        if (null != is) {\n            try {\n                final Properties descriptorProperties = new Properties();\n                descriptorProperties.load(is);\n                if (!descriptorProperties.isEmpty()) {\n                    final Enumeration<?> propNames = descriptorProperties.propertyNames();\n                    if (null != propNames && propNames.hasMoreElements()) {\n                        while (propNames.hasMoreElements()) {\n                            String propId = (String) propNames.nextElement();\n                            // Check only properties with a given prefix, for security reasons.\n                            if (propId.startsWith(ENV_USER_MANAGEMENT_PREFIX)) {\n                                if (isEmpty(System.getProperty(propId))) {\n                                    System.setProperty(propId,\n                                                       descriptorProperties.getProperty(propId));\n                                }\n                            }\n                        }\n                    }\n                }\n            } catch (IOException e) {\n                LOG.error(\"Error reading security management properties descriptor.\",\n                          e);\n            }\n        }\n    }\n\n    private boolean isEmpty(String str) {\n        return str == null || str.trim().length() == 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/UberfireRoleManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Named;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.RoleManager;\nimport org.uberfire.ext.security.management.api.RoleManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.search.RolesRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.search.RuntimeSearchEngine;\n\n/**\n * <p>The default role manager implementation for UF based applications.</p>\n * <p>Roles are not coming from any external system, are just the ones registered in the application</p>\n * <p>CRUD operations for roles are not allowed, only search is allowed.</p>\n * @since 0.8.0\n */\n@Dependent\n@Named(\"uberfireRoleManager\")\npublic class UberfireRoleManager implements RoleManager,\n                                            ContextualManager {\n\n    UserSystemManager userSystemManager;\n    RuntimeSearchEngine<Role> rolesSearchEngine;\n\n    @Override\n    public void initialize(final UserSystemManager userSystemManager) throws Exception {\n        this.userSystemManager = userSystemManager;\n        rolesSearchEngine = new RolesRuntimeSearchEngine();\n    }\n\n    @Override\n    public SearchResponse<Role> search(SearchRequest request) throws SecurityManagementException {\n        return rolesSearchEngine.search(RoleRegistry.get().getRegisteredRoles(),\n                                        request);\n    }\n\n    @Override\n    public Role get(String identifier) throws SecurityManagementException {\n        return RoleRegistry.get().getRegisteredRole(identifier);\n    }\n\n    @Override\n    public List<Role> getAll() throws SecurityManagementException {\n        return new ArrayList<>(RoleRegistry.get().getRegisteredRoles());\n    }\n\n    @Override\n    public Role create(Role entity) throws SecurityManagementException {\n        throw new UnsupportedOperationException(\"Create operation is not available when using the UberfireRoleManager provider.\");\n    }\n\n    @Override\n    public Role update(Role entity) throws SecurityManagementException {\n        throw new UnsupportedOperationException(\"Update operation is not available when using the UberfireRoleManager provider.\");\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        throw new UnsupportedOperationException(\"Delete operation is not available when using the UberfireRoleManager provider.\");\n    }\n\n    @Override\n    public RoleManagerSettings getSettings() {\n        return null;\n    }\n\n    @Override\n    public void destroy() throws Exception {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/AbstractRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport java.util.Collection;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.impl.SearchResponseImpl;\n\n/**\n * <p>Base runtime search engine implementation for collections of entities.</p>\n * @since 0.8.0\n */\npublic abstract class AbstractRuntimeSearchEngine<T> implements RuntimeSearchEngine<T> {\n\n    @Override\n    public AbstractEntityManager.SearchResponse<T> search(Collection<T> entities,\n                                                          AbstractEntityManager.SearchRequest request) {\n        if (entities == null || request == null) {\n            return null;\n        }\n\n        // First page must be 1.\n        if (request.getPage() <= 0) {\n            throw new RuntimeException(\"First page must be 1.\");\n        }\n\n        // Search elements using the given pattern & check the returning elements are not considered roles on UF.\n        final String pattern = request.getSearchPattern();\n        final boolean isPatternEmpty = isEmpty(pattern);\n        Collection<T> result = isPatternEmpty ? entities : new LinkedList<T>();\n        if (!isPatternEmpty) {\n            for (T entity : entities) {\n                final String id = getIdentifier(entity);\n                if (!isConstrained(request,\n                                   id) && id.contains(pattern)) {\n                    result.add(entity);\n                }\n            }\n        }\n\n        return createResponse(result,\n                              request);\n    }\n\n    protected boolean isConstrained(AbstractEntityManager.SearchRequest request,\n                                    String name) {\n        final Set<String> constrainedIdentifiers = request.getConstrainedIdentifiers();\n        if (null != constrainedIdentifiers) {\n            for (final String id : constrainedIdentifiers) {\n                if (id.equals(name)) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    public AbstractEntityManager.SearchResponse<T> createResponse(Collection<T> entities,\n                                                                  AbstractEntityManager.SearchRequest request) {\n        List<T> result = new LinkedList<T>(entities);\n\n        // Apply pagination.\n        final int total = result.size();\n        // First page is 1.\n        final int page = request.getPage() - 1;\n        final int pageSize = request.getPageSize();\n        final int startPos = page * pageSize;\n        final int endPos = startPos + pageSize > total ? total : startPos + pageSize;\n        if (result.size() >= startPos) {\n            result = result.subList(startPos,\n                                    endPos);\n        }\n\n        // Return the paginated response.\n        return new SearchResponseImpl<T>(result,\n                                         page + 1,\n                                         pageSize,\n                                         total,\n                                         total > endPos);\n    }\n\n    protected abstract String getIdentifier(T entity);\n\n    protected boolean isEmpty(String str) {\n        return str == null || str.trim().length() == 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/GroupsIdentifierRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\n/**\n * <p>Default runtime search engine implementation for collections of group identifiers.</p>\n * @since 0.8.0\n */\npublic class GroupsIdentifierRuntimeSearchEngine extends IdentifierRuntimeSearchEngine<Group> {\n\n    @Override\n    protected Group createEntity(String identifier) {\n        return SecurityManagementUtils.createGroup(identifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/GroupsRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.security.shared.api.Group;\n\n/**\n * <p>Default runtime search engine implementation for collections of groups.</p>\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class GroupsRuntimeSearchEngine extends AbstractRuntimeSearchEngine<Group> {\n\n    @Override\n    protected String getIdentifier(Group entity) {\n        return entity.getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/IdentifierRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport java.util.Collection;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\n\n/**\n * <p>Default runtime search engine implementation for collections of users.</p>\n * @since 0.8.0\n */\npublic abstract class IdentifierRuntimeSearchEngine<T> extends AbstractRuntimeSearchEngine<T> {\n\n    public AbstractEntityManager.SearchResponse<T> searchByIdentifiers(Collection<String> entityIdentifiers,\n                                                                       AbstractEntityManager.SearchRequest request) {\n        if (entityIdentifiers == null || request == null) {\n            return null;\n        }\n\n        // First page must be 1.\n        if (request.getPage() <= 0) {\n            throw new RuntimeException(\"First page must be 1.\");\n        }\n\n        // Search elements using the given pattern  & check the returning elements are not considered roles on UF.\n        final String pattern = request.getSearchPattern();\n        final boolean isPatternEmpty = isEmpty(pattern);\n        Collection<String> result = isPatternEmpty ? entityIdentifiers : new LinkedList<String>();\n        if (!isPatternEmpty) {\n            for (String id : entityIdentifiers) {\n                if (!isConstrained(request,\n                                   id) && id.contains(pattern)) {\n                    result.add(id);\n                }\n            }\n        }\n\n        // Create the entities from the identifiers sublist.\n        List<T> resultEntities = new LinkedList<T>();\n        for (final String id : result) {\n            if (!isConstrained(request,\n                               id)) {\n                final T entity = createEntity(id);\n                resultEntities.add(entity);\n            }\n        }\n\n        return createResponse(resultEntities,\n                              request);\n    }\n\n    protected abstract T createEntity(String identifier);\n\n    @Override\n    protected String getIdentifier(T entity) {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/RolesRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.security.shared.api.Role;\n\n/**\n * <p>Default runtime search engine implementation for collections of roles.</p>\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class RolesRuntimeSearchEngine extends AbstractRuntimeSearchEngine<Role> {\n\n    @Override\n    protected String getIdentifier(Role entity) {\n        return entity.getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/RuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport java.util.Collection;\n\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\n\npublic interface RuntimeSearchEngine<T> {\n\n    /**\n     * <p>Perform a search using the given search request constraints over a collection of entities.</p>\n     * @param entities The entities collection used as search source.\n     * @param request The search constraints. If search pattern is <code>null</code> or empty, the result must contains all the entities from the source collection.\n     * @return The search response.\n     */\n    AbstractEntityManager.SearchResponse<T> search(Collection<T> entities,\n                                                   AbstractEntityManager.SearchRequest request);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/UsersIdentifierRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\n/**\n * <p>Default runtime search engine implementation for collections of user identifiers.</p>\n * @since 0.8.0\n */\npublic class UsersIdentifierRuntimeSearchEngine extends IdentifierRuntimeSearchEngine<User> {\n\n    @Override\n    protected User createEntity(String identifier) {\n        return SecurityManagementUtils.createUser(identifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/search/UsersRuntimeSearchEngine.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.security.shared.api.identity.User;\n\n/**\n * <p>Default runtime search engine implementation for collections of users.</p>\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class UsersRuntimeSearchEngine extends AbstractRuntimeSearchEngine<User> {\n\n    @Override\n    protected String getIdentifier(User entity) {\n        return entity.getIdentifier();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/service/AbstractUserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.service;\n\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.security.management.UberfireRoleManager;\nimport org.uberfire.ext.security.management.api.RoleManager;\nimport org.uberfire.ext.security.management.api.UserManagementService;\n\n/**\n * <p>The base user management service that uses the <code>org.uberfire.ext.security.management.UberfireRoleManager</code>\n * as the role manager service used in the platform.</p>\n * @since 0.8.0\n */\npublic abstract class AbstractUserManagementService implements UserManagementService {\n\n    UberfireRoleManager roleManager;\n\n    @Inject\n    public AbstractUserManagementService(UberfireRoleManager roleManager) {\n        this.roleManager = roleManager;\n    }\n\n    @Override\n    public RoleManager roles() {\n        return roleManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/service/GroupManagerServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.service;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.BackendUserSystemManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.exception.NoImplementationAvailableException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\n/**\n * <p>The UberFire service implementation for GroupsManager API.</p>\n */\n@Service\n@ApplicationScoped\npublic class GroupManagerServiceImpl implements GroupManagerService {\n\n    private static final Logger LOG = LoggerFactory.getLogger(GroupManagerServiceImpl.class);\n\n    @Inject\n    private BackendUserSystemManager userSystemManager;\n\n    private GroupManager service;\n\n    @PostConstruct\n    public void init() {\n        service = userSystemManager.groups();\n    }\n\n    private GroupManager getService() throws SecurityManagementException {\n        if (service == null) {\n            throw new NoImplementationAvailableException();\n        }\n        return service;\n    }\n\n    @Override\n    public SearchResponse<Group> search(SearchRequest request) throws SecurityManagementException {\n        final GroupManager serviceImpl = getService();\n        if (request.getPage() == 0) {\n            throw new IllegalArgumentException(\"First page must be 1.\");\n        }\n\n        // Constraint registered UF roles as not allowed for searching.\n        final Set<String> registeredRoleNames = SecurityManagementUtils.getRegisteredRoleNames();\n        if (request.getConstrainedIdentifiers() == null) {\n            request.setConstrainedIdentifiers(registeredRoleNames);\n        } else {\n            request.getConstrainedIdentifiers().addAll(registeredRoleNames);\n        }\n\n        // Delegate the search to the specific provider.\n        return serviceImpl.search(request);\n    }\n\n    @Override\n    public Group get(String identifier) throws SecurityManagementException {\n        final GroupManager serviceImpl = getService();\n        return serviceImpl.get(identifier);\n    }\n\n    @Override\n    public List<Group> getAll() throws SecurityManagementException {\n        final GroupManager serviceImpl = getService();\n        return serviceImpl.getAll()\n                .stream()\n                .filter(group -> !SecurityManagementUtils.getRegisteredRoleNames().contains(group.getName()))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public Group create(Group group) throws SecurityManagementException {\n        final String name = group.getName();\n        if (isConstrained(name)) {\n            throw new IllegalArgumentException(\"Group with name '\" + name + \"' cannot be created, \" +\n                                                       \"as it is a constrained value (it is a role or the admin group\");\n        }\n        final GroupManager serviceImpl = getService();\n        return serviceImpl.create(group);\n    }\n\n    @Override\n    public Group update(Group group) throws SecurityManagementException {\n        final String name = group.getName();\n        if (isConstrained(name)) {\n            throw new IllegalArgumentException(\"Group with name '\" + name + \"' cannot be updated, \" +\n                                                       \"as it is a constrained value (it is a role or the admin group\");\n        }\n        final GroupManager serviceImpl = getService();\n        return serviceImpl.update(group);\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        for (final String name : identifiers) {\n            if (isConstrained(name)) {\n                throw new IllegalArgumentException(\"Group with name '\" + name + \"' cannot be deleted, \" +\n                                                           \"as it is a constrained value (it is a role or the admin group\");\n            }\n        }\n        final GroupManager serviceImpl = getService();\n        serviceImpl.delete(identifiers);\n    }\n\n    @Override\n    public GroupManagerSettings getSettings() {\n        final GroupManager serviceImpl = getService();\n        final GroupManagerSettings settings = serviceImpl.getSettings();\n        if (null != settings) {\n            settings.setConstrainedGroups(SecurityManagementUtils.getRegisteredRoleNames());\n        }\n        return settings;\n    }\n\n    @Override\n    public void assignUsers(String name,\n                            Collection<String> users) throws SecurityManagementException {\n        final GroupManager serviceImpl = getService();\n        serviceImpl.assignUsers(name,\n                                users);\n    }\n\n    protected boolean isConstrained(final String name) {\n        return SecurityManagementUtils.getRegisteredRoleNames().contains(name);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/service/RoleManagerServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.service;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.BackendUserSystemManager;\nimport org.uberfire.ext.security.management.api.RoleManager;\nimport org.uberfire.ext.security.management.api.RoleManagerSettings;\nimport org.uberfire.ext.security.management.api.exception.NoImplementationAvailableException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\n\n/**\n * <p>The UberFire service implementation for RolesManager API.</p>\n */\n@Service\n@ApplicationScoped\npublic class RoleManagerServiceImpl implements RoleManagerService {\n\n    private static final Logger LOG = LoggerFactory.getLogger(RoleManagerServiceImpl.class);\n\n    @Inject\n    private BackendUserSystemManager userSystemManager;\n\n    private RoleManager service;\n\n    @PostConstruct\n    public void init() {\n        service = userSystemManager.roles();\n    }\n\n    private RoleManager getService() throws SecurityManagementException {\n        if (service == null) {\n            throw new NoImplementationAvailableException();\n        }\n        return service;\n    }\n\n    @Override\n    public SearchResponse<Role> search(SearchRequest request) throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        if (request.getPage() == 0) {\n            throw new IllegalArgumentException(\"First page must be 1.\");\n        }\n        return serviceImpl.search(request);\n    }\n\n    @Override\n    public Role get(String identifier) throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        return serviceImpl.get(identifier);\n    }\n\n    @Override\n    public List<Role> getAll() throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        return serviceImpl.getAll();\n    }\n\n    @Override\n    public Role create(Role entity) throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        return serviceImpl.create(entity);\n    }\n\n    @Override\n    public Role update(Role entity) throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        return serviceImpl.update(entity);\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        final RoleManager serviceImpl = getService();\n        serviceImpl.delete(identifiers);\n    }\n\n    @Override\n    public RoleManagerSettings getSettings() {\n        final RoleManager serviceImpl = getService();\n        return serviceImpl.getSettings();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/service/UserManagerServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.service;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.BackendUserSystemManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.event.UserDeletedEvent;\nimport org.uberfire.ext.security.management.api.exception.NoImplementationAvailableException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>The UberFire service implementation for UsersManager API.</p>\n */\n@Service\n@ApplicationScoped\npublic class UserManagerServiceImpl implements UserManagerService {\n\n    private static final Logger LOG = LoggerFactory.getLogger(UserManagerServiceImpl.class);\n\n    @Inject\n    private BackendUserSystemManager userSystemManager;\n\n    @Inject\n    Event<UserDeletedEvent> userDeletedEvent;\n\n    private UserManager service;\n\n    @PostConstruct\n    public void init() {\n        service = userSystemManager.users();\n    }\n\n    private UserManager getService() throws SecurityManagementException {\n        if (!userSystemManager.isActive() || service == null) {\n            throw new NoImplementationAvailableException();\n        }\n        return service;\n    }\n\n    @Override\n    public void assignGroups(String username,\n                             Collection<String> groups) {\n        final UserManager serviceImpl = getService();\n        serviceImpl.assignGroups(username,\n                                 groups);\n    }\n\n    @Override\n    public void assignRoles(String username,\n                            Collection<String> roles) {\n        final UserManager serviceImpl = getService();\n        serviceImpl.assignRoles(username,\n                                roles);\n    }\n\n    @Override\n    public void changePassword(String username,\n                               String newPassword) {\n        final UserManager serviceImpl = getService();\n        serviceImpl.changePassword(username,\n                                   newPassword);\n    }\n\n    @Override\n    public SearchResponse<User> search(SearchRequest request) {\n        final UserManager serviceImpl = getService();\n        // Delegate to the current service provider implementation.\n        if (request.getPage() == 0) {\n            throw new IllegalArgumentException(\"First page must be 1.\");\n        }\n        return serviceImpl.search(request);\n    }\n\n    @Override\n    public User get(String identifier) {\n        final UserManager serviceImpl = getService();\n        return serviceImpl.get(identifier);\n    }\n\n    @Override\n    public List<User> getAll() throws SecurityManagementException {\n        final UserManager serviceImpl = getService();\n        return serviceImpl.getAll();\n    }\n\n    @Override\n    public User create(User entity) {\n        final UserManager serviceImpl = getService();\n        return serviceImpl.create(entity);\n    }\n\n    @Override\n    public User update(User entity) {\n        final UserManager serviceImpl = getService();\n        return serviceImpl.update(entity);\n    }\n\n    @Override\n    public void delete(String... identifiers) {\n        checkNotNull(\"identifiers\",\n                     identifiers);\n        final UserManager serviceImpl = getService();\n        serviceImpl.delete(identifiers);\n        for (String identifier : identifiers) {\n            userDeletedEvent.fire(new UserDeletedEvent(identifier));\n        }\n    }\n\n    @Override\n    public UserManagerSettings getSettings() {\n        final UserManager serviceImpl = getService();\n        return serviceImpl.getSettings();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/util/SecurityManagementUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.util;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\n\n/**\n * <p>User system management helper class shared between backend and client side of the application.</p>\n * @since 0.8.0\n */\npublic class SecurityManagementUtils {\n\n    public static final Capability[] USERS_CAPABILITIES = new Capability[]{\n            Capability.CAN_SEARCH_USERS, Capability.CAN_ADD_USER, Capability.CAN_UPDATE_USER,\n            Capability.CAN_READ_USER, Capability.CAN_DELETE_USER, Capability.CAN_MANAGE_ATTRIBUTES,\n            Capability.CAN_ASSIGN_GROUPS, Capability.CAN_ASSIGN_ROLES, Capability.CAN_CHANGE_PASSWORD};\n\n    public static final Capability[] GROUPS_CAPABILITIES = new Capability[]{\n            Capability.CAN_SEARCH_GROUPS, Capability.CAN_ADD_GROUP, Capability.CAN_UPDATE_GROUP,\n            Capability.CAN_READ_GROUP, Capability.CAN_DELETE_GROUP};\n\n    public static final Capability[] ROLES_CAPABILITIES = new Capability[]{\n            Capability.CAN_SEARCH_ROLES, Capability.CAN_ADD_ROLE, Capability.CAN_UPDATE_ROLE,\n            Capability.CAN_READ_ROLE, Capability.CAN_DELETE_ROLE};\n\n    public static User createUser(final String id) {\n        return createUser(id,\n                          null);\n    }\n\n    public static User createUser(final String id,\n                                  final Set<Group> groups) {\n        return createUser(id,\n                          groups,\n                          null);\n    }\n\n    public static User createUser(final String id,\n                                  final Set<Group> groups,\n                                  final Set<Role> roles) {\n        return createUser(id,\n                          groups,\n                          roles,\n                          null);\n    }\n\n    public static User createUser(final String id,\n                                  final Set<Group> groups,\n                                  final Set<Role> roles,\n                                  final Map<String, String> properties) {\n        if (id == null) {\n            return null;\n        }\n        final Set<Group> _groups = groups != null ? new HashSet<Group>(groups) : new HashSet<Group>(0);\n        final Set<Role> _roles = roles != null ? new HashSet<Role>(roles) : new HashSet<Role>(0);\n        final Map<String, String> _properties = properties != null ? new HashMap<String, String>(properties) : new HashMap<String, String>(0);\n        return new UserImpl(id,\n                            _roles,\n                            _groups,\n                            _properties);\n    }\n\n    public static Group createGroup(final String name) {\n        if (name == null) {\n            return null;\n        }\n        return new GroupImpl(name);\n    }\n\n    public static Role createRole(final String name) {\n        if (name == null) {\n            return null;\n        }\n        return new RoleImpl(name);\n    }\n\n    public static User clone(final User user) {\n        if (user == null) {\n            return null;\n        }\n        final String id = user.getIdentifier();\n        final Set<Group> groups = user.getGroups() != null ? new HashSet<Group>(user.getGroups()) : new HashSet<Group>(0);\n        final Set<Role> roles = user.getRoles() != null ? new HashSet<Role>(user.getRoles()) : new HashSet<Role>(0);\n        final Map<String, String> properties = user.getProperties() != null ? new HashMap<String, String>(user.getProperties()) : new HashMap<String, String>(0);\n        return new UserImpl(id,\n                            roles,\n                            groups,\n                            properties);\n    }\n\n    public static Set<Group> getGroups(final UserSystemManager userSystemManager,\n                                       final String username) {\n        User user = userSystemManager.users().get(username);\n        if (null != user && null != user.getGroups() && !user.getGroups().isEmpty()) {\n            return user.getGroups();\n        }\n        return new HashSet<Group>();\n    }\n\n    public static Set<Role> getRoles(final UserSystemManager userSystemManager,\n                                     final String username) {\n        try {\n            User user = userSystemManager.users().get(username);\n            if (null != user && null != user.getRoles() && !user.getRoles().isEmpty()) {\n                return new HashSet<Role>(user.getRoles());\n            }\n        } catch (UserNotFoundException e) {\n            // User not found, no roles.\n        }\n        return new HashSet<Role>();\n    }\n\n    public static Set<Role> getRegisteredRoles() {\n        return RoleRegistry.get().getRegisteredRoles();\n    }\n\n    public static Set<String> getRegisteredRoleNames() {\n        Set<Role> registered = RoleRegistry.get().getRegisteredRoles();\n        Set<String> result = new HashSet<String>(registered.size() + 1);\n        result.addAll(rolesToString(registered));\n        return result;\n    }\n\n    /**\n     * Utility method that check if the given group or role name is in the list of registeredRoles, if it is,\n     * it adds the Role for the given name in the given roles set argument, otherwise, into the list.\n     * This method it's just a shortcut to avoid code duplipcation on several points.\n     */\n    public static void populateGroupOrRoles(final String name,\n                                            final Set<String> registeredRoles,\n                                            final Set<Group> groups,\n                                            final Set<Role> roles) {\n\n        if (registeredRoles.contains(name)) {\n            // Is a role.\n            Role r = createRole(name);\n            if (null != r) {\n                roles.add(r);\n            }\n        } else {\n            // Is a group.\n            Group g = createGroup(name);\n            if (null != g) {\n                groups.add(g);\n            }\n        }\n    }\n\n    public static Set<String> rolesToString(final Set<Role> roles) {\n        if (null != roles && !roles.isEmpty()) {\n            final Set<String> result = new HashSet<String>(roles.size());\n            for (final Role role : roles) {\n                result.add(role.getName());\n            }\n            return result;\n        }\n        return new HashSet<String>();\n    }\n\n    public static Set<String> groupsToString(final Set<Group> groups) {\n        if (null != groups && !groups.isEmpty()) {\n            final Set<String> result = new HashSet<String>(groups.size());\n            for (final Group group : groups) {\n                result.add(group.getName());\n            }\n            return result;\n        }\n        return new HashSet<String>();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/validation/GroupValidatorImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.validation;\n\nimport java.util.ResourceBundle;\n\nimport org.uberfire.ext.security.management.api.validation.GroupValidator;\n\npublic class GroupValidatorImpl extends GroupValidator {\n\n    private static final String BUNDLE_PREFFIX = \"group.validation.\";\n    private static final ResourceBundle MESSAGES = ResourceBundle.getBundle(\"org.uberfire.ext.security.management.UberfireSecurityManagementMessages\");\n\n    @Override\n    public String getMessage(String key) {\n        return MESSAGES.getString(BUNDLE_PREFFIX + key);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/validation/RoleValidatorImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.validation;\n\nimport org.uberfire.ext.security.management.api.validation.RoleValidator;\n\n// Not implemented yet.\npublic class RoleValidatorImpl extends RoleValidator {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/java/org/uberfire/ext/security/management/validation/UserValidatorImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.validation;\n\nimport java.util.ResourceBundle;\n\nimport org.uberfire.ext.security.management.api.validation.UserValidator;\n\npublic class UserValidatorImpl extends UserValidator {\n\n    private static final String BUNDLE_PREFFIX = \"user.validation.\";\n    private static final ResourceBundle MESSAGES = ResourceBundle.getBundle(\"org.uberfire.ext.security.management.UberfireSecurityManagementMessages\");\n\n    @Override\n    public String getMessage(String key) {\n        return MESSAGES.getString(BUNDLE_PREFFIX + key);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/main/resources/org/uberfire/ext/security/management/UberfireSecurityManagementMessages.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser.validation.nameNotEmpty=Name is mandatory\ngroup.validation.nameNotEmpty=Name is mandatory"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/test/java/org/uberfire/ext/security/management/BackendUserSystemManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management;\n\nimport java.lang.reflect.Method;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class BackendUserSystemManagerTest {\n\n    @Test\n    public void testSearch() {\n        for (Method method : BackendUserSystemManager.class.getMethods()) {\n            if (method.getAnnotation(PostConstruct.class) != null\n                    || method.getAnnotation(PreDestroy.class) != null) {\n\n                assertTrue(method.getExceptionTypes() == null\n                                   || method.getExceptionTypes().length == 0);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/test/java/org/uberfire/ext/security/management/BaseTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management;\n\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\n\nimport static org.mockito.Mockito.*;\n\n/**\n * <p>Base test class for users/groups/roles manager based services.</p>\n */\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic abstract class BaseTest {\n\n    @Mock\n    protected UserSystemManager userSystemManager;\n\n    protected AbstractEntityManager.SearchRequest buildSearchRequestMock(String pattern,\n                                                                         int page,\n                                                                         int pageSize) {\n        AbstractEntityManager.SearchRequest request = mock(AbstractEntityManager.SearchRequest.class);\n        when(request.getSearchPattern()).thenReturn(pattern);\n        when(request.getPage()).thenReturn(page);\n        when(request.getPageSize()).thenReturn(pageSize);\n        return request;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/test/java/org/uberfire/ext/security/management/UberfireRoleManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management;\n\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UberfireRoleManagerTest {\n\n    @Mock\n    UserSystemManager userSystemManager;\n    private UberfireRoleManager tested;\n\n    @Before\n    public void setup() throws Exception {\n        RoleRegistry.get().clear();\n        RoleRegistry.get().registerRole(\"regRole1\");\n        RoleRegistry.get().registerRole(\"regRole2\");\n        RoleRegistry.get().registerRole(\"regRole3\");\n        tested = new UberfireRoleManager();\n        tested.initialize(userSystemManager);\n    }\n\n    @Test\n    public void testSearch() {\n        AbstractEntityManager.SearchResponse<Role> response = tested.search(new SearchRequestImpl(\"\",\n                                                                                                  1,\n                                                                                                  10));\n        assertNotNull(response);\n        int total = response.getTotal();\n        assertEquals(total,\n                     3);\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     false);\n        List<Role> results = response.getResults();\n        assertEquals(results.size(),\n                     3);\n    }\n\n    @Test\n    public void testSearchRoleNotExists() {\n        AbstractEntityManager.SearchResponse<Role> response = tested.search(new SearchRequestImpl(\"\",\n                                                                                                  1,\n                                                                                                  10));\n        assertNotNull(response);\n        int total = response.getTotal();\n        assertEquals(total,\n                     3);\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     false);\n        List<Role> results = response.getResults();\n        assertEquals(results.size(),\n                     3);\n    }\n\n    @Test\n    public void testGetAllRoles() {\n        List<Role> results = tested.getAll();\n        assertEquals(results.size(),\n                     3);\n    }\n\n    public void testGet() {\n        Role role = tested.get(\"regRole1\");\n        assertEquals(role,\n                     new RoleImpl(\"regRole1\"));\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testCreate() {\n        tested.create(mock(Role.class));\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testUpdate() {\n        tested.update(mock(Role.class));\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testDelete() {\n        tested.delete(\"regRole1\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/test/java/org/uberfire/ext/security/management/search/GroupsRuntimeSearchEngineTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.search;\n\nimport java.util.ArrayList;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Test;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class GroupsRuntimeSearchEngineTest {\n\n    GroupsRuntimeSearchEngine searchEngine = new GroupsRuntimeSearchEngine();\n\n    @Test(expected = RuntimeException.class)\n    public void testSearchPageZero() {\n        List<Group> groups = new ArrayList<Group>(1);\n        // First page cannot be 0.\n        AbstractEntityManager.SearchRequest request = new SearchRequestImpl(\"\",\n                                                                            0,\n                                                                            5);\n        AbstractEntityManager.SearchResponse<Group> response = searchEngine.search(groups,\n                                                                                   request);\n    }\n\n    @Test\n    public void testSearchAll() {\n        List<Group> groups = createTestGroups(\"group\",\n                                              20);\n\n        // First page.\n        AbstractEntityManager.SearchRequest request = new SearchRequestImpl(\"\",\n                                                                            1,\n                                                                            5);\n        AbstractEntityManager.SearchResponse<Group> response = searchEngine.search(groups,\n                                                                                   request);\n        assertNotNull(response);\n        int total = response.getTotal();\n        assertEquals(total,\n                     20);\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     true);\n        List<Group> results = response.getResults();\n        assertEquals(results.size(),\n                     5);\n        Group g = results.get(0);\n        assertEquals(\"group0\",\n                     g.getName());\n        Group g4 = results.get(4);\n        assertEquals(\"group4\",\n                     g4.getName());\n\n        // Last page.\n        request = new SearchRequestImpl(\"\",\n                                        4,\n                                        5);\n        response = searchEngine.search(groups,\n                                       request);\n        assertNotNull(response);\n        total = response.getTotal();\n        assertEquals(total,\n                     20);\n        hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     false);\n        results = response.getResults();\n        assertEquals(results.size(),\n                     5);\n        Group g15 = results.get(0);\n        assertEquals(\"group15\",\n                     g15.getName());\n        Group g19 = results.get(4);\n        assertEquals(\"group19\",\n                     g19.getName());\n    }\n\n    @Test\n    public void testSearchSingle() {\n        List<Group> groups = createTestGroups(\"group\",\n                                              20);\n        AbstractEntityManager.SearchRequest request = new SearchRequestImpl(\"group18\",\n                                                                            1,\n                                                                            5);\n        AbstractEntityManager.SearchResponse<Group> response = searchEngine.search(groups,\n                                                                                   request);\n        assertNotNull(response);\n        int total = response.getTotal();\n        assertEquals(total,\n                     1);\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     false);\n        List<Group> results = response.getResults();\n        assertEquals(results.size(),\n                     1);\n        Group g = results.get(0);\n        assertEquals(\"group18\",\n                     g.getName());\n    }\n\n    @Test\n    public void testSearchMultiple() {\n        List<Group> groups = createTestGroups(\"group\",\n                                              20);\n        // First page.\n        AbstractEntityManager.SearchRequest request = new SearchRequestImpl(\"group1\",\n                                                                            1,\n                                                                            5);\n        AbstractEntityManager.SearchResponse<Group> response = searchEngine.search(groups,\n                                                                                   request);\n        assertNotNull(response);\n        int total = response.getTotal();\n        assertEquals(total,\n                     11);\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     true);\n        List<Group> results = response.getResults();\n        assertEquals(results.size(),\n                     5);\n        Group g0 = results.get(0);\n        assertEquals(\"group1\",\n                     g0.getName());\n        Group g10 = results.get(1);\n        assertEquals(\"group10\",\n                     g10.getName());\n        Group g13 = results.get(4);\n        assertEquals(\"group13\",\n                     g13.getName());\n\n        // Second page.\n        request = new SearchRequestImpl(\"group1\",\n                                        2,\n                                        5);\n        response = searchEngine.search(groups,\n                                       request);\n        assertNotNull(response);\n        total = response.getTotal();\n        assertEquals(total,\n                     11);\n        hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     true);\n        results = response.getResults();\n        assertEquals(results.size(),\n                     5);\n        Group g14 = results.get(0);\n        assertEquals(\"group14\",\n                     g14.getName());\n        Group g15 = results.get(1);\n        assertEquals(\"group15\",\n                     g15.getName());\n        Group g18 = results.get(4);\n        assertEquals(\"group18\",\n                     g18.getName());\n\n        // Third page.\n        request = new SearchRequestImpl(\"group1\",\n                                        3,\n                                        5);\n        response = searchEngine.search(groups,\n                                       request);\n        assertNotNull(response);\n        total = response.getTotal();\n        assertEquals(total,\n                     11);\n        hasNextPage = response.hasNextPage();\n        assertEquals(hasNextPage,\n                     false);\n        results = response.getResults();\n        assertEquals(results.size(),\n                     1);\n        Group g19 = results.get(0);\n        assertEquals(\"group19\",\n                     g19.getName());\n    }\n\n    private List<Group> createTestGroups(String namePrefix,\n                                         int size) {\n        List<Group> groups = new LinkedList<Group>();\n        for (int x = 0; x < size; x++) {\n            Group group = mock(Group.class);\n            when(group.getName()).thenReturn(namePrefix + x);\n            groups.add(group);\n        }\n        return groups;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-backend/src/test/java/org/uberfire/ext/security/management/util/SecurityManagementUtilsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.util;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.backend.server.security.RoleRegistry;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n/**\n * <p>Unit test class for SecurityManagementUtils.</p>\n * @since 0.8.0\n */\npublic class SecurityManagementUtilsTest {\n\n    @BeforeClass\n    public static void setup() throws IOException {\n        RoleRegistry.get().clear();\n    }\n\n    @Test\n    public void testCreateGroup() {\n        final String testId = \"id1\";\n        final Group group = SecurityManagementUtils.createGroup(testId);\n        assertNotNull(group);\n        final String name = group.getName();\n        assertEquals(name,\n                     testId);\n    }\n\n    @Test\n    public void testCreateRole() {\n        final String testId = \"id1\";\n        final Role role = SecurityManagementUtils.createRole(testId);\n        assertNotNull(role);\n        final String name = role.getName();\n        assertEquals(name,\n                     testId);\n    }\n\n    @Test\n    public void testCreateUserWithId() {\n        final String testId = \"id1\";\n        final User user = SecurityManagementUtils.createUser(testId);\n        assertNotNull(user);\n        final String id = user.getIdentifier();\n        assertEquals(id,\n                     testId);\n    }\n\n    @Test\n    public void testCreateUserWithIdNull() {\n        final String testId = null;\n        assertNull(SecurityManagementUtils.createUser(testId));\n    }\n\n    @Test\n    public void testCreateUserWithGroups() {\n        final String testId = \"id1\";\n        final String group1Id = \"g1\";\n        final String group2Id = \"g2\";\n        final Group group1 = SecurityManagementUtils.createGroup(group1Id);\n        final Group group2 = SecurityManagementUtils.createGroup(group2Id);\n        final Set<Group> groups = new HashSet<Group>(2);\n        groups.add(group1);\n        groups.add(group2);\n        final User user = SecurityManagementUtils.createUser(testId,\n                                                             groups);\n        assertNotNull(user);\n        final String id = user.getIdentifier();\n        assertEquals(id,\n                     testId);\n        final Set<Group> resultGroups = user.getGroups();\n        assertNotNull(resultGroups);\n        assertTrue(resultGroups.size() == 2);\n        assertEquals(resultGroups,\n                     groups);\n    }\n\n    @Test\n    public void testCreateUserWithGroupsAndRoles() {\n        final String testId = \"id1\";\n        final String group1Id = \"g1\";\n        final String group2Id = \"g2\";\n        final String role1Id = \"r1\";\n        final String role2Id = \"r2\";\n        final Group group1 = SecurityManagementUtils.createGroup(group1Id);\n        final Group group2 = SecurityManagementUtils.createGroup(group2Id);\n        final Set<Group> groups = new HashSet<Group>(2);\n        groups.add(group1);\n        groups.add(group2);\n        final Role role1 = SecurityManagementUtils.createRole(role1Id);\n        final Role role2 = SecurityManagementUtils.createRole(role2Id);\n        final Set<Role> roles = new HashSet<Role>(2);\n        roles.add(role1);\n        roles.add(role2);\n        final User user = SecurityManagementUtils.createUser(testId,\n                                                             groups,\n                                                             roles);\n        assertNotNull(user);\n        final String id = user.getIdentifier();\n        assertEquals(id,\n                     testId);\n        final Set<Group> resultGroups = user.getGroups();\n        assertNotNull(resultGroups);\n        assertTrue(resultGroups.size() == 2);\n        assertEquals(resultGroups,\n                     groups);\n        final Set<Role> resultRoles = user.getRoles();\n        assertNotNull(resultRoles);\n        assertTrue(resultRoles.size() == 2);\n        assertEquals(resultRoles,\n                     roles);\n    }\n\n    @Test\n    public void testCreateUserWithGroupsAndRolesAndProperties() {\n        final String testId = \"id1\";\n        final String group1Id = \"g1\";\n        final String group2Id = \"g2\";\n        final String role1Id = \"r1\";\n        final String role2Id = \"r2\";\n        final Group group1 = SecurityManagementUtils.createGroup(group1Id);\n        final Group group2 = SecurityManagementUtils.createGroup(group2Id);\n        final Set<Group> groups = new HashSet<Group>(2);\n        groups.add(group1);\n        groups.add(group2);\n        final Role role1 = SecurityManagementUtils.createRole(role1Id);\n        final Role role2 = SecurityManagementUtils.createRole(role2Id);\n        final Set<Role> roles = new HashSet<Role>(2);\n        roles.add(role1);\n        roles.add(role2);\n        final Map<String, String> props = new HashMap<String, String>(2);\n        props.put(\"p1\",\n                  \"value1\");\n        props.put(\"p2\",\n                  \"value2\");\n        final User user = SecurityManagementUtils.createUser(testId,\n                                                             groups,\n                                                             roles,\n                                                             props);\n        assertNotNull(user);\n        final String id = user.getIdentifier();\n        assertEquals(id,\n                     testId);\n        final Set<Group> resultGroups = user.getGroups();\n        assertNotNull(resultGroups);\n        assertTrue(resultGroups.size() == 2);\n        assertEquals(resultGroups,\n                     groups);\n        final Set<Role> resultRoles = user.getRoles();\n        assertNotNull(resultRoles);\n        assertTrue(resultRoles.size() == 2);\n        assertEquals(resultRoles,\n                     roles);\n\n        final Map<String, String> resultProps = user.getProperties();\n        assertNotNull(resultProps);\n        assertTrue(resultProps.size() == 2);\n        assertEquals(resultProps.get(\"p1\"),\n                     \"value1\");\n        assertEquals(resultProps.get(\"p2\"),\n                     \"value2\");\n    }\n\n    @Test\n    public void testCloneUser() {\n        final String testId = \"id1\";\n        final String group1Id = \"g1\";\n        final String group2Id = \"g2\";\n        final String role1Id = \"r1\";\n        final String role2Id = \"r2\";\n        final Group group1 = SecurityManagementUtils.createGroup(group1Id);\n        final Group group2 = SecurityManagementUtils.createGroup(group2Id);\n        final Set<Group> groups = new HashSet<Group>(2);\n        groups.add(group1);\n        groups.add(group2);\n        final Role role1 = SecurityManagementUtils.createRole(role1Id);\n        final Role role2 = SecurityManagementUtils.createRole(role2Id);\n        final Set<Role> roles = new HashSet<Role>(2);\n        roles.add(role1);\n        roles.add(role2);\n        final Map<String, String> props = new HashMap<String, String>(2);\n        props.put(\"p1\",\n                  \"value1\");\n        props.put(\"p2\",\n                  \"value2\");\n        final User user = SecurityManagementUtils.createUser(testId,\n                                                             groups,\n                                                             roles,\n                                                             props);\n        final User cloned = SecurityManagementUtils.clone(user);\n        assertNotNull(cloned);\n        final String id = cloned.getIdentifier();\n        assertEquals(id,\n                     testId);\n        final Set<Group> resultGroups = cloned.getGroups();\n        assertNotNull(resultGroups);\n        assertTrue(resultGroups.size() == 2);\n        assertEquals(resultGroups,\n                     groups);\n        final Set<Role> resultRoles = cloned.getRoles();\n        assertNotNull(resultRoles);\n        assertTrue(resultRoles.size() == 2);\n        assertEquals(resultRoles,\n                     roles);\n        final Map<String, String> resultProps = cloned.getProperties();\n        assertNotNull(resultProps);\n        assertTrue(resultProps.size() == 2);\n        assertEquals(resultProps.get(\"p1\"),\n                     \"value1\");\n        assertEquals(resultProps.get(\"p2\"),\n                     \"value2\");\n    }\n\n    @Test\n    public void testGetRegisteredRoles() {\n        RoleRegistry.get().registerRole(\"role1\");\n        RoleRegistry.get().registerRole(\"role2\");\n        final Set<Role> roles = SecurityManagementUtils.getRegisteredRoles();\n        assertNotNull(roles);\n        assertTrue(roles.size() == 2);\n        assertFalse(roles.contains(new RoleImpl(\"admin\")));\n    }\n\n    @Test\n    public void testGetRegisteredRoleNames() {\n        RoleRegistry.get().registerRole(\"role1\");\n        RoleRegistry.get().registerRole(\"role2\");\n        final Set<String> roles = SecurityManagementUtils.getRegisteredRoleNames();\n        assertNotNull(roles);\n        assertTrue(roles.size() == 2);\n        assertFalse(roles.contains(\"admin\"));\n    }\n\n    @Test\n    public void testRolesToString() {\n        Set<Role> roles = new HashSet<Role>(2);\n        Role role1 = mock(Role.class);\n        when(role1.getName()).thenReturn(\"role1\");\n        Role role2 = mock(Role.class);\n        when(role2.getName()).thenReturn(\"role2\");\n        roles.add(role1);\n        roles.add(role2);\n        final Set<String> rolesStr = SecurityManagementUtils.rolesToString(roles);\n        assertNotNull(rolesStr);\n        assertTrue(rolesStr.size() == 2);\n        assertTrue(rolesStr.contains(\"role1\"));\n        assertTrue(rolesStr.contains(\"role2\"));\n    }\n\n    @Test\n    public void testRolesToStringEmpty() {\n        final Set<String> rolesStr = SecurityManagementUtils.rolesToString(null);\n        assertNotNull(rolesStr);\n        assertTrue(rolesStr.size() == 0);\n    }\n\n    @Test\n    public void testGroupsToString() {\n        Set<Group> roles = new HashSet<Group>(2);\n        Group role1 = mock(Group.class);\n        when(role1.getName()).thenReturn(\"group1\");\n        Group role2 = mock(Group.class);\n        when(role2.getName()).thenReturn(\"group2\");\n        roles.add(role1);\n        roles.add(role2);\n        final Set<String> rolesStr = SecurityManagementUtils.groupsToString(roles);\n        assertNotNull(rolesStr);\n        assertTrue(rolesStr.size() == 2);\n        assertTrue(rolesStr.contains(\"group1\"));\n        assertTrue(rolesStr.contains(\"group2\"));\n    }\n\n    @Test\n    public void testGroupsToStringEmpty() {\n        final Set<String> rolesStr = SecurityManagementUtils.groupsToString(null);\n        assertNotNull(rolesStr);\n        assertTrue(rolesStr.size() == 0);\n    }\n\n    @Test\n    public void testPopulateGroupsOrRoles() {\n        RoleRegistry.get().registerRole(\"role1\");\n        Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames();\n        Set<Group> groups = new HashSet<Group>();\n        Set<Role> roles = new HashSet<Role>();\n        SecurityManagementUtils.populateGroupOrRoles(\"group1\",\n                                                     registeredRoles,\n                                                     groups,\n                                                     roles);\n        assertTrue(groups.size() == 1);\n        assertTrue(roles.isEmpty());\n        SecurityManagementUtils.populateGroupOrRoles(\"role1\",\n                                                     registeredRoles,\n                                                     groups,\n                                                     roles);\n        assertTrue(groups.size() == 1);\n        assertTrue(roles.size() == 1);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Security Management - Users and groups management Client</name>\n  <description>Uberfire Security Management - Users and groups management Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test scope. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/ClientSecurityExceptionMessageResolver.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.ext.security.management.api.exception.EntityNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.NoImplementationAvailableException;\nimport org.uberfire.ext.security.management.api.exception.RealmManagementNotAuthorizedException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UnsupportedServiceCapabilityException;\nimport org.uberfire.ext.security.management.api.exception.UserAlreadyExistsException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementClientConstants;\n\n/**\n * It resolves the security management exception messages\n * for being presented to the end users,\n */\n@ApplicationScoped\npublic class ClientSecurityExceptionMessageResolver {\n\n    private static final String ARG_SEPARATOR = \": \";\n\n    private final Map<Class<?>, Function<SecurityManagementException, String>> messageResolvers = new HashMap<>(6);\n\n    @PostConstruct\n    public void registerMessageResolvers() {\n        register(EntityNotFoundException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.entityNotFound(),\n                                    e.getIdentifier()));\n        register(UserNotFoundException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.userNotFound(),\n                                    e.getIdentifier()));\n        register(GroupNotFoundException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.groupNotFound(),\n                                    e.getIdentifier()));\n        register(NoImplementationAvailableException.class,\n                 e -> UsersManagementClientConstants.INSTANCE.noUserSystemManagerActive());\n        register(UnsupportedServiceCapabilityException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.unsupportedCapability(),\n                                    e.getCapability().name()));\n        register(UserAlreadyExistsException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.userAlreadyExists(),\n                                    e.getUserId()));\n        register(RealmManagementNotAuthorizedException.class,\n                 e -> getArgMessage(UsersManagementClientConstants.INSTANCE.realmManagementNotAuthorized(),\n                                    e.getRealmResource()));\n    }\n\n    /**\n     * Main entry point for handling all security management related errors.\n     * It uses the error's message, if any, otherwise uses the exception generic message.\n     * It also skips certain exception types for being displayed to the user and\n     * constantly showing popup error messages.\n     * @param exception The exception for being displayed\n     * @param messageConsumer Consumes the message to display, if applies. Otherwise it's not called.\n     */\n    public void consumeExceptionMessage(final Throwable exception,\n                                        final Consumer<String> messageConsumer) {\n        if (shouldDisplayError().test(exception)) {\n            final String message = isSecurityManagementException().test(exception) ?\n                    getSecurityExceptionMessage().apply((SecurityManagementException) exception) :\n                    getExceptionMessage().apply(exception);\n            messageConsumer.accept(message);\n        }\n    }\n\n    private Predicate<Throwable> shouldDisplayError() {\n        return throwable -> !(throwable instanceof NoImplementationAvailableException);\n    }\n\n    private Predicate<Throwable> isSecurityManagementException() {\n        return throwable -> throwable instanceof SecurityManagementException;\n    }\n\n    private Function<SecurityManagementException, String> getSecurityExceptionMessage() {\n        return exception -> messageResolvers\n                .getOrDefault(exception.getClass(),\n                              SecurityManagementException::getMessage)\n                .apply(exception);\n    }\n\n    private Function<Throwable, String> getExceptionMessage() {\n        return exception -> exception.getCause() != null ?\n                exception.getCause().getMessage() :\n                exception.getMessage();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <E extends SecurityManagementException> void register(final Class<E> type,\n                                                                  final Function<E, String> messageResolver) {\n        messageResolvers.put(type,\n                             (Function<SecurityManagementException, String>) messageResolver);\n    }\n\n    private static String getArgMessage(final String message,\n                                        final String arg) {\n        return message + ARG_SEPARATOR + arg;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/ClientUserSystemManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client;\n\nimport java.util.Collection;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ioc.client.api.AfterInitialization;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.RoleManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.ext.security.management.api.validation.EntityValidator;\nimport org.uberfire.ext.security.management.client.validation.ClientGroupValidator;\nimport org.uberfire.ext.security.management.client.validation.ClientRoleValidator;\nimport org.uberfire.ext.security.management.client.validation.ClientUserValidator;\nimport org.uberfire.ext.security.management.impl.UserAttributeImpl;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>The main client side manager for the user management stuff.</p>\n * <p>\n * @since 0.8.0\n */\n@ApplicationScoped\npublic class ClientUserSystemManager implements UserSystemManager {\n\n    // User management provider settings are immutable and can be cached to avoid some backend service calls.\n    UserManagerSettings userManagerSettings;\n    // Group management provider settings are immutable and can be cached to avoid some backend service calls.\n    GroupManagerSettings groupManagerSettings;\n    // The error presenter.\n    ErrorPopupPresenter errorPopupPresenter;\n    /**\n     * The service caller for the Users Manager.\n     */\n    private final Caller<UserManagerService> usersManagerService;\n    /**\n     * The service caller for the Groups Manager.\n     */\n    private final Caller<GroupManagerService> groupsManagerService;\n    /**\n     * The service caller for the Users Manager.\n     */\n    private final Caller<RoleManagerService> rolesManagerService;\n    private final ClientSecurityExceptionMessageResolver exceptionMessageResolver;\n    private boolean isActive;\n    protected final ErrorCallback<Message> loadErrorCallback = new ErrorCallback<Message>() {\n        @Override\n        public boolean error(final Message message,\n                             final Throwable throwable) {\n            showError(throwable);\n            ClientUserSystemManager.this.isActive = false;\n            return false;\n        }\n    };\n\n    @Inject\n    public ClientUserSystemManager(final Caller<UserManagerService> usersManagerService,\n                                   final Caller<GroupManagerService> groupsManagerService,\n                                   final Caller<RoleManagerService> rolesManagerService,\n                                   final ClientSecurityExceptionMessageResolver exceptionMessageResolver,\n                                   final ErrorPopupPresenter errorPopupPresenter) {\n        this.usersManagerService = usersManagerService;\n        this.groupsManagerService = groupsManagerService;\n        this.rolesManagerService = rolesManagerService;\n        this.exceptionMessageResolver = exceptionMessageResolver;\n        this.errorPopupPresenter = errorPopupPresenter;\n        this.isActive = false;\n    }\n\n    @PostConstruct\n    public void initCache() {\n        initializeCache(() -> ClientUserSystemManager.this.isActive = true,\n                        loadErrorCallback);\n    }\n\n    public UserManager users(RemoteCallback<?> remoteCallback,\n                             ErrorCallback errorCallback) {\n        return usersManagerService.call(remoteCallback,\n                                        errorCallback);\n    }\n\n    public GroupManager groups(RemoteCallback<?> remoteCallback,\n                               ErrorCallback errorCallback) {\n        return groupsManagerService.call(remoteCallback,\n                                         errorCallback);\n    }\n\n    public RoleManager roles(RemoteCallback<?> remoteCallback,\n                             ErrorCallback errorCallback) {\n        return rolesManagerService.call(remoteCallback,\n                                        errorCallback);\n    }\n\n    @Override\n    public UserManager users() {\n        return usersManagerService.call();\n    }\n\n    @Override\n    public GroupManager groups() {\n        return groupsManagerService.call();\n    }\n\n    @Override\n    public RoleManager roles() {\n        return rolesManagerService.call();\n    }\n\n    public boolean isUserCapabilityEnabled(final Capability capability) {\n        if (userManagerSettings != null) {\n            return isCapabilityEnabled(userManagerSettings.getCapabilities(),\n                                       capability);\n        }\n        return false;\n    }\n\n    public Collection<UserManager.UserAttribute> getUserSupportedAttributes() {\n        return userManagerSettings.getSupportedAttributes();\n    }\n\n    public UserManager.UserAttribute getUserSupportedAttribute(final String attributeName) {\n        if (attributeName != null && userManagerSettings != null &&\n                userManagerSettings.getSupportedAttributes() != null) {\n            for (final UserManager.UserAttribute attribute : userManagerSettings.getSupportedAttributes()) {\n                if (attributeName.equals(attribute.getName())) {\n                    return attribute;\n                }\n            }\n        }\n        return null;\n    }\n\n    public boolean isGroupCapabilityEnabled(final Capability capability) {\n        if (groupManagerSettings != null) {\n            return isCapabilityEnabled(groupManagerSettings.getCapabilities(),\n                                       capability);\n        }\n        return false;\n    }\n\n    public boolean isCapabilityEnabled(final Map<Capability, CapabilityStatus> capabilities,\n                                       final Capability capability) {\n        if (capabilities != null) {\n            final CapabilityStatus status = capabilities.get(capability);\n            return status != null && CapabilityStatus.ENABLED.equals(status);\n        }\n        return false;\n    }\n\n    public Collection<String> getConstrainedGroups() {\n        return groupManagerSettings != null ? groupManagerSettings.getConstrainedGroups() : null;\n    }\n\n    public User createUser(final String identifier) {\n        if (identifier == null) {\n            return null;\n        }\n        return new UserImpl(identifier);\n    }\n\n    public UserManager.UserAttribute createUserAttribute(final String name,\n                                                         final boolean isMandatory,\n                                                         boolean isEditable,\n                                                         final String defaultValue) {\n        if (name == null) {\n            return null;\n        }\n        return new UserAttributeImpl(name,\n                                     isMandatory,\n                                     isEditable,\n                                     defaultValue);\n    }\n\n    public Group createGroup(final String name) {\n        if (name == null) {\n            return null;\n        }\n        return new GroupImpl(name);\n    }\n\n    public Role createRole(final String name) {\n        if (name == null) {\n            return null;\n        }\n        return new RoleImpl(name);\n    }\n\n    @Override\n    public EntityValidator<User> usersValidator() {\n        return new ClientUserValidator();\n    }\n\n    @Override\n    public EntityValidator<Group> groupsValidator() {\n        return new ClientGroupValidator();\n    }\n\n    @Override\n    public EntityValidator<Role> rolesValidator() {\n        return new ClientRoleValidator();\n    }\n\n    @Override\n    public boolean isActive() {\n        return isActive;\n    }\n\n    /**\n     * Executes the command argument when services are initialized, you can.check the <code>isActive()</code> method after the command execution to check it services are up.\n     * The command argument is ensured to be executed whether services are up or when the initialization has failed.\n     * @param command The command executed when the initialization has finished.\n     */\n    public void waitForInitialization(final Command command) {\n        if (null != command) {\n            initializeCache(command,\n                            (message, throwable) -> {\n                                command.execute();\n                                return false;\n                            });\n        }\n    }\n\n    public UserManagerSettings getUserManagerSettings() {\n        return userManagerSettings;\n    }\n\n    public GroupManagerSettings getGroupManagerSettings() {\n        return groupManagerSettings;\n    }\n\n    private void initializeCache(final Command command,\n                                 final ErrorCallback<Message> errorCallback) {\n        // Load user & group management providers' settings.\n        loadUserSettings(() -> loadGroupSettings(new Command() {\n                                                     @Override\n                                                     public void execute() {\n                                                         command.execute();\n                                                     }\n                                                 },\n                                                 errorCallback),\n                         errorCallback);\n    }\n\n    /**\n     * Loads the user management provider's settings into cache.\n     * @param callback Load finished callback.\n     */\n    private void loadUserSettings(final Command callback,\n                                  final ErrorCallback<Message> errorCallback) {\n        if (null == userManagerSettings) {\n            usersManagerService.call(new RemoteCallback<UserManagerSettings>() {\n                                         @Override\n                                         public void callback(final UserManagerSettings userManagerSettings) {\n                                             ClientUserSystemManager.this.userManagerSettings = userManagerSettings;\n                                             if (null != callback) {\n                                                 callback.execute();\n                                             }\n                                         }\n                                     },\n                                     errorCallback).getSettings();\n        } else {\n            callback.execute();\n        }\n    }\n\n    /**\n     * Loads the group management provider's settings into cache.\n     * @param callback Load finished callback.\n     */\n    private void loadGroupSettings(final Command callback,\n                                   final ErrorCallback<Message> errorCallback) {\n        if (null == groupManagerSettings) {\n            groupsManagerService.call(new RemoteCallback<GroupManagerSettings>() {\n                                          @Override\n                                          public void callback(final GroupManagerSettings groupManagerSettings) {\n                                              ClientUserSystemManager.this.groupManagerSettings = groupManagerSettings;\n                                              if (null != callback) {\n                                                  callback.execute();\n                                              }\n                                          }\n                                      },\n                                      errorCallback).getSettings();\n        } else {\n            callback.execute();\n        }\n    }\n\n    void showError(final Throwable throwable) {\n        exceptionMessageResolver.consumeExceptionMessage(throwable,\n                                                         errorPopupPresenter::showMessage);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/Driver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor;\n\n/**\n * <p>A client side editor's driver.</p>\n * <p>\n * <p>Drivers are used to isolate the editors hierarchy from the edition logic for an instance of type <code>T</code>.</p>\n * <p>So do not matter the editors' concrete implementations, same driver can be used agains different client side editors reusing the edition logic.</p>\n * @since 0.8.0\n */\npublic interface Driver<T, E extends Editor<T, T>> {\n\n    /**\n     * Show the instance using the given editor.\n     * @param instance The instance to show.\n     * @param viewer The viewer for the instance.\n     */\n    void show(T instance,\n              E viewer);\n\n    /**\n     * Edit the instance using the given editor.\n     * @param instance The instance to show.\n     * @param editor The editor for the instance.\n     */\n    void edit(T instance,\n              E editor);\n\n    /**\n     * Flush the editors hierarchy states and perform the validations.\n     * @return The validation violations, if any.\n     */\n    boolean flush();\n\n    /**\n     * The instance after being flush with against the editors hierarchy.\n     * @return The instance.\n     */\n    T getValue();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/Editor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor;\n\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\n/**\n * <p>A client side editor.</p>\n * <p>\n * <p>Editors should implement this interface in order to isolate the editor components from the editing logic (provided by drivers) and the instance edited.</p>\n * <p>Editor sub-types should add more interface methods to describe the whole editor hierarchy for the instance of type <code>T</code>.</p>\n * <p>\n * <p>The most common edition workflow consist of:</p>\n * <ol>\n * <li>Create the editor implementation instance and call <code>edit()</code> using the edited instance as argument.</li>\n * <li>Let the user interact with the editors and update their states.</li>\n * <li>Flush the whole editors hierarchy to ensure editor's states are up to date.</li>\n * <li>Obtain the edited instance member values from each editor in the hierarchy by calling <code>getValue()</code>.</li>\n * <li>Validate the edited instance using any JSR303 validators for it.</li>\n * <li>Set the resulting violations, if any, into the editors hierarchy to display the validation errors.</li>\n * </ol>\n * @param <T> The edited entity type.\n * @param <A> The edited member type for this editor/sub-editor.\n * @since 0.8.0\n */\npublic interface Editor<T, A> extends Viewer<T> {\n\n    /**\n     * Initialize the editor hierarchy using the instance given.\n     * @param instance The instance used to initialize editors.\n     */\n    void edit(T instance);\n\n    /**\n     * Flush editor's state.\n     */\n    void flush();\n\n    /**\n     * Get edited value. This method must be called after flush.\n     * @return\n     */\n    A getValue();\n\n    /**\n     * Set validation violations into the editor hierarchy.\n     * @param violations The validation violations.\n     */\n    void setViolations(Set<ConstraintViolation<T>> violations);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/HasRestrictedValues.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor;\n\n/**\n * <p>A component that have restricted values (values not allowed to use)..</p>\n * @param <T> The type of the restricted values.\n * @since 0.8.0\n */\npublic interface HasRestrictedValues<T> {\n\n    void setRestrictedValues(T value);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/Viewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor;\n\n/**\n * <p>A client side viewer.</p>\n * @param <T> The entity type.\n * @since 0.8.0\n */\npublic interface Viewer<T> {\n\n    /**\n     * Initialize the viewer hierarchy and display the instance to show.\n     * @param instance The instance.\n     */\n    void show(T instance);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/group/GroupEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.group;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.editor.Editor;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * <p>A group editor</p>\n * @since 0.9.0\n */\npublic interface GroupEditor extends Editor<Group, Group> {\n\n    /**\n     * The group name.\n     */\n    String name();\n\n    /**\n     * The group's permissions\n     */\n    PermissionCollection permissions();\n\n    /**\n     * The group's home perspective\n     */\n    PerspectiveActivity homePerspective();\n\n    /**\n     * The group's priority\n     */\n    int groupPriority();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/group/GroupEditorDriver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.group;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.Driver;\nimport org.uberfire.security.authz.PermissionCollection;\n\n@Dependent\npublic class GroupEditorDriver implements Driver<Group, GroupEditor> {\n\n    ClientUserSystemManager userSystemManager;\n\n    GroupEditor groupEditor;\n    Group group;\n    boolean isFlushed = false;\n    boolean isEditMode = false;\n\n    @Inject\n    public GroupEditorDriver(final ClientUserSystemManager userSystemManager) {\n        this.userSystemManager = userSystemManager;\n    }\n\n    public void show(final Group group,\n                     final GroupEditor groupEditor) {\n        this.isFlushed = false;\n        this.isEditMode = false;\n        this.group = group;\n        this.groupEditor = groupEditor;\n        groupEditor.show(group);\n    }\n\n    public void edit(final Group group,\n                     final GroupEditor groupEditor) {\n        this.isFlushed = false;\n        this.isEditMode = true;\n        this.group = group;\n        this.groupEditor = groupEditor;\n        groupEditor.edit(group);\n    }\n\n    public boolean flush() {\n        assert this.isEditMode;\n        this.isFlushed = true;\n\n        groupEditor.flush();\n\n        // Obtain the editor's values\n        final String name = groupEditor.name();\n\n        // Create a new resulting instance\n        group = new GroupImpl(name);\n\n        // Validate the instance and set delegate violations, if any, to the editors hierarchy.\n        Set<ConstraintViolation<Group>> violations = userSystemManager.groupsValidator().validate(group);\n        groupEditor.setViolations(violations);\n        return violations == null || violations.isEmpty();\n    }\n\n    @Override\n    public Group getValue() {\n        assert this.isFlushed;\n        return group;\n    }\n\n    public PermissionCollection getPermissions() {\n        return groupEditor.permissions();\n    }\n\n    public PerspectiveActivity getHomePerspective() {\n        return groupEditor.homePerspective();\n    }\n\n    public int getGroupPriority() {\n        return groupEditor.groupPriority();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/role/RoleEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.role;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.editor.Editor;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * <p>A role editor.</p>\n * @since 0.9.0\n */\npublic interface RoleEditor extends Editor<Role, Role> {\n\n    /**\n     * The role name.\n     */\n    String name();\n\n    /**\n     * The role's permissions\n     */\n    PermissionCollection permissions();\n\n    /**\n     * The role's home perspective\n     */\n    PerspectiveActivity homePerspective();\n\n    /**\n     * The role's priority\n     */\n    int rolePriority();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/role/RoleEditorDriver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.role;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.Driver;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * <p>It links the user editors hierarchy with the instance edited by flushing the editor's values into the User model.</p>\n * <p>It contains all logic for editing a User instance by using Editors hierarchy instances, so\n * the editors's concrete widget/component implementation is isolated from the edition logic.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class RoleEditorDriver implements Driver<Role, RoleEditor> {\n\n    ClientUserSystemManager userSystemManager;\n\n    RoleEditor roleEditor;\n    Role role;\n    boolean isFlushed = false;\n    boolean isEditMode = false;\n\n    @Inject\n    public RoleEditorDriver(final ClientUserSystemManager userSystemManager) {\n        this.userSystemManager = userSystemManager;\n    }\n\n    public void show(final Role role,\n                     final RoleEditor roleEditor) {\n        this.isFlushed = false;\n        this.isEditMode = false;\n        this.role = role;\n        this.roleEditor = roleEditor;\n        roleEditor.show(role);\n    }\n\n    public void edit(final Role role,\n                     final RoleEditor roleEditor) {\n        this.isFlushed = false;\n        this.isEditMode = true;\n        this.role = role;\n        this.roleEditor = roleEditor;\n        roleEditor.edit(role);\n    }\n\n    public boolean flush() {\n        assert this.isEditMode;\n        this.isFlushed = true;\n\n        roleEditor.flush();\n\n        // Obtain the editor's values\n        final String name = roleEditor.name();\n\n        // Create a new resulting instance\n        role = new RoleImpl(name);\n\n        // Validate the instance and set delegate violations, if any, to the editors hierarchy.\n        Set<ConstraintViolation<Role>> violations = userSystemManager.rolesValidator().validate(role);\n        roleEditor.setViolations(violations);\n        return violations == null || violations.isEmpty();\n    }\n\n    @Override\n    public Role getValue() {\n        assert this.isFlushed;\n        return role;\n    }\n\n    public PerspectiveActivity getHomePerspective() {\n        return roleEditor.homePerspective();\n    }\n\n    public int getRolePriority() {\n        return roleEditor.rolePriority();\n    }\n\n    public PermissionCollection getPermissions() {\n        return roleEditor.permissions();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserAssignedGroupsEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user groups editor contract.</p>\n * @since 0.8.0\n */\npublic interface UserAssignedGroupsEditor extends Editor<User, Set<Group>> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserAssignedGroupsExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user groups explorer contract.</p>\n * @since 0.8.0\n */\npublic interface UserAssignedGroupsExplorer extends Editor<User, Set<Group>> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserAssignedRolesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user roles editor contract.</p>\n * @since 0.8.0\n */\npublic interface UserAssignedRolesEditor extends Editor<User, Set<Role>> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserAssignedRolesExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user roles explorer contract.</p>\n * @since 0.8.0\n */\npublic interface UserAssignedRolesExplorer extends Editor<User, Set<Role>> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserAttributesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user attributes editor contract.</p>\n * @since 0.8.0\n */\npublic interface UserAttributesEditor extends Editor<User, Map<String, String>> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.editor.Editor;\n\n/**\n * <p>A user editor.</p>\n * Note:Add roles sub-editor when they're supported in the future.\n * @since 0.8.0\n */\npublic interface UserEditor extends Editor<User, User> {\n\n    /**\n     * The leaf value user's identifier.\n     */\n    String identifier();\n\n    /**\n     * The editor for the user's attributes.\n     */\n    UserAttributesEditor attributesEditor();\n\n    /**\n     * The explorer for the user's groups. It's considered an editor as it allows removing assigned groups from the user instance.\n     */\n    UserAssignedGroupsExplorer groupsExplorer();\n\n    /**\n     * The explorer for the user's roles. It's considered an editor as it allows removing assigned roles from the user instance.\n     */\n    UserAssignedRolesExplorer rolesExplorer();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/editor/user/UserEditorDriver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.Driver;\n\n/**\n * <p>It links the user editors hierarchy with the instance edited by flushing the editor's values into the User model.</p>\n * <p>It contains all logic for editing a User instance by using Editors hierarchy instances, so\n * the editors's concrete widget/component implementation is isolated from the edition logic.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserEditorDriver implements Driver<User, UserEditor> {\n\n    ClientUserSystemManager userSystemManager;\n\n    UserEditor userEditor;\n    User user;\n    boolean isFlushed = false;\n    boolean isEditMode = false;\n\n    @Inject\n    public UserEditorDriver(final ClientUserSystemManager userSystemManager) {\n        this.userSystemManager = userSystemManager;\n    }\n\n    public User createNewUser(final String identifier) {\n        User user = userSystemManager.createUser(identifier);\n        final Collection<UserManager.UserAttribute> attrs = userSystemManager.getUserSupportedAttributes();\n        if (attrs != null) {\n            for (UserManager.UserAttribute attribute : attrs) {\n                final String name = attribute.getName();\n                final boolean isMandatory = attribute.isMandatory();\n                final boolean isEditable = attribute.isEditable();\n                if (isMandatory && isEditable && name != null) {\n                    final String defaultValue = attribute.getDefaultValue();\n                    user.setProperty(name,\n                                     defaultValue);\n                }\n            }\n        }\n        return user;\n    }\n\n    public void show(final User user,\n                     final UserEditor userEditor) {\n        this.isFlushed = false;\n        this.isEditMode = false;\n        this.user = user;\n        this.userEditor = userEditor;\n        // Root viewer..\n        userEditor.show(user);\n        // Sub-viewers.\n        userEditor.attributesEditor().show(user);\n        userEditor.groupsExplorer().show(user);\n        userEditor.rolesExplorer().show(user);\n    }\n\n    public void edit(final User user,\n                     final UserEditor userEditor) {\n        this.isFlushed = false;\n        this.isEditMode = true;\n        this.user = user;\n        this.userEditor = userEditor;\n        // Root editor edition.\n        userEditor.edit(user);\n        // Sub-editors edition.\n        userEditor.attributesEditor().edit(user);\n        userEditor.groupsExplorer().edit(user);\n        userEditor.rolesExplorer().edit(user);\n    }\n\n    public boolean flush() {\n        assert this.isEditMode;\n        this.isFlushed = true;\n\n        // Flush editor and sub-editors.\n        userEditor.flush();\n        userEditor.attributesEditor().flush();\n        userEditor.groupsExplorer().flush();\n        userEditor.rolesExplorer().flush();\n\n        // Obtain the editor's values.\n        final String id = userEditor.identifier();\n        final Map<String, String> properties = userEditor.attributesEditor().getValue();\n        final Set<Group> groups = userEditor.groupsExplorer().getValue();\n        final Set<Role> roles = userEditor.rolesExplorer().getValue();\n\n        // Create a new resulting instance (as groups & roles are unmodifiable collections in the default UserImpl).\n        user = new UserImpl(id,\n                            roles,\n                            groups,\n                            properties);\n\n        // Validate the instance and set delegate violations, if any, to the editors hierarchy.\n        Set<ConstraintViolation<User>> violations = userSystemManager.usersValidator().validate(user);\n        userEditor.setViolations(violations);\n        return violations == null || violations.isEmpty();\n    }\n\n    @Override\n    public User getValue() {\n        assert this.isFlushed;\n        return user;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.ConstantsWithLookup;\n\n/**\n * <p>UF Security client constants.</p>\n * @since 0.8.0\n */\npublic interface UsersManagementClientConstants extends ConstantsWithLookup {\n\n    UsersManagementClientConstants INSTANCE = GWT.create(UsersManagementClientConstants.class);\n\n    String user_validation_nameNotEmpty();\n\n    String group_validation_nameNotEmpty();\n\n    String userSystemManagerInitializationError();\n\n    String noUserSystemManagerActive();\n\n    String unsupportedCapability();\n\n    String userAlreadyExists();\n\n    String groupAlreadyExists();\n\n    String roleAlreadyExists();\n\n    String entityNotFound();\n\n    String userNotFound();\n\n    String groupNotFound();\n\n    String realmManagementNotAuthorized();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/validation/ClientGroupValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.validation;\n\nimport org.uberfire.ext.security.management.api.validation.GroupValidator;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementClientConstants;\n\npublic class ClientGroupValidator extends GroupValidator {\n\n    @Override\n    public String getMessage(String key) {\n        if (KEY_NAME_NOT_EMPTY.equals(key)) {\n            return UsersManagementClientConstants.INSTANCE.group_validation_nameNotEmpty();\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/validation/ClientRoleValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.validation;\n\nimport org.uberfire.ext.security.management.api.validation.RoleValidator;\n\n// Not implemented yet.\npublic class ClientRoleValidator extends RoleValidator {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/java/org/uberfire/ext/security/management/client/validation/ClientUserValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.validation;\n\nimport org.uberfire.ext.security.management.api.validation.UserValidator;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementClientConstants;\n\npublic class ClientUserValidator extends UserValidator {\n\n    @Override\n    public String getMessage(String key) {\n        if (KEY_NAME_NOT_EMPTY.equals(key)) {\n            return UsersManagementClientConstants.INSTANCE.user_validation_nameNotEmpty();\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/UberfireSecurityManagementClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.enterprise.CDI\"/>\n  <inherits name=\"org.jboss.errai.security.Security\"/>\n  <inherits name=\"org.jboss.errai.ui.nav.Navigation\"/>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementAPI\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser_validation_nameNotEmpty=Name is mandatory\ngroup_validation_nameNotEmpty=Name is mandatory\nuserSystemManagerInitializationError=The user system manager cannot be initialized properly, please check server logs\nnoUserSystemManagerActive=No security management providers available\nunsupportedCapability=Capability not supported\nuserAlreadyExists=User already exists\ngroupAlreadyExists=Group already exists\nroleAlreadyExists=Role already exists\nentityNotFound=Entity not found\nuserNotFound=User not found\ngroupNotFound=Group not found\nrealmManagementNotAuthorized=Not authorized to manage the realm\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_de.properties",
    "content": "user_validation_nameNotEmpty=Name ist obligatorisch\ngroup_validation_nameNotEmpty=Name ist obligatorisch\nuserSystemManagerInitializationError=Der Benutzersystem-Manager kann nicht ordnungsgemäß initialisiert werden, bitte überprüfen Sie die Server-Protokolle \nuserAlreadyExists=Benutzer existiert bereits\ngroupAlreadyExists=Gruppe existiert bereits\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser_validation_nameNotEmpty=El nombre es obligatorio\ngroup_validation_nameNotEmpty=El nombre es obligatorio\nuserSystemManagerInitializationError=El usuario administrador del sistema no puede iniciarse correctamente; compruebe los registros del servidor.\nnoUserSystemManagerActive=No hay proveedores de gestión de la seguridad disponibles\nunsupportedCapability=Capacidad no admitida\nuserAlreadyExists=El usuario ya existe\ngroupAlreadyExists=El grupo ya existe\nroleAlreadyExists=La función ya existe\nentityNotFound=No se encuentra la entidad\nuserNotFound=No se encuentra el usuario\ngroupNotFound=No se encuentra el grupo\nrealmManagementNotAuthorized=No está autorizado para gestionar el reino\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser_validation_nameNotEmpty=Le nom est obligatoire\ngroup_validation_nameNotEmpty=Le nom est obligatoire\nuserSystemManagerInitializationError=Le gestionnaire système de l''utilisateur ne peut pas être initialisé correctement ; consultez les journaux du serveur\nnoUserSystemManagerActive=Aucun fournisseur de gestion de la sécurité n''est disponible\nunsupportedCapability=Fonctionnalité non prise en charge\nuserAlreadyExists=L''utilisateur existe déjà\ngroupAlreadyExists=Le groupe existe déjà\nroleAlreadyExists=Le rôle existe déjà\nentityNotFound=Entité introuvable\nuserNotFound=Utilisateur introuvable\ngroupNotFound=Groupe introuvable\nrealmManagementNotAuthorized=Non autorisé à gérer le domaine\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser_validation_nameNotEmpty=Il nome è obbligatorio\ngroup_validation_nameNotEmpty=Il nome è obbligatorio\nuserSystemManagerInitializationError=Impossibile inizializzare correttamente il gestore del sistema utente, controllare i log del server\nnoUserSystemManagerActive=Nessun provider di gestione della sicurezza disponibile\nunsupportedCapability=Funzionalità non supportata\nuserAlreadyExists=L''utente esiste già\ngroupAlreadyExists=Il gruppo esiste già\nroleAlreadyExists=Il ruolo esiste già\nentityNotFound=Entità non trovata\nuserNotFound=Utente non trovato\ngroupNotFound=Gruppo non trovato\nrealmManagementNotAuthorized=Non autorizzato a gestire il dominio\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nuser_validation_nameNotEmpty=名前は必須項目です\ngroup_validation_nameNotEmpty=名前は必須項目です\nuserSystemManagerInitializationError=ユーザーシステムマネージャーが正常に初期化できません。サーバーログを確認してください\nnoUserSystemManagerActive=セキュリティー管理プロバイダーが利用できません\nunsupportedCapability=機能はサポートされていません\nuserAlreadyExists=ユーザーはすでに存在します\ngroupAlreadyExists=グループはすでに存在します\nroleAlreadyExists=ロールはすでに存在します\nentityNotFound=エンティティーは見つかりません\nuserNotFound=ユーザーは見つかりません\ngroupNotFound=グループは見つかりません\nrealmManagementNotAuthorized=レルムを管理する権限がありません\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_pt_BR.properties",
    "content": "user_validation_nameNotEmpty=O nome é mandatório\ngroup_validation_nameNotEmpty=O nome é mandatório\nuserSystemManagerInitializationError=O gerenciador do sistema do usuário não pode ser inicializado adequadamente, verifique os logs do servidor \nuserAlreadyExists=O usuário já existe\ngroupAlreadyExists=O grupo já existe\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementClientConstants_zh_CN.properties",
    "content": "user_validation_nameNotEmpty=名称为必填项\ngroup_validation_nameNotEmpty=名称为必填项\nuserSystemManagerInitializationError=无法正确初始化用户系统管理器，请检查服务器日志。\nuserAlreadyExists=用户已经存在\ngroupAlreadyExists=组已存在\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/test/java/org/uberfire/ext/security/management/client/ClientSecurityExceptionMessageResolverTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.exception.EntityNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.NoImplementationAvailableException;\nimport org.uberfire.ext.security.management.api.exception.RealmManagementNotAuthorizedException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UnsupportedServiceCapabilityException;\nimport org.uberfire.ext.security.management.api.exception.UserAlreadyExistsException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.contains;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ClientSecurityExceptionMessageResolverTest {\n\n    private ClientSecurityExceptionMessageResolver tested;\n\n    @Before\n    public void setup() {\n        this.tested = new ClientSecurityExceptionMessageResolver();\n        this.tested.registerMessageResolvers();\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testConsumeSecurityExceptions() {\n        final Consumer<String> c0 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new SecurityManagementException(\"custom\"),\n                                       c0);\n        verify(c0,\n               times(1)).accept(eq(\"custom\"));\n        final Consumer<String> c1 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new EntityNotFoundException(\"id1\"),\n                                       c1);\n        verify(c1,\n               times(1)).accept(contains(\"id1\"));\n        final Consumer<String> c2 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new UserNotFoundException(\"user1\"),\n                                       c2);\n        verify(c2,\n               times(1)).accept(contains(\"user1\"));\n        final Consumer<String> c3 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new GroupNotFoundException(\"group1\"),\n                                       c3);\n        verify(c3,\n               times(1)).accept(contains(\"group1\"));\n        final Consumer<String> c4 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new UnsupportedServiceCapabilityException(Capability.CAN_ADD_USER),\n                                       c4);\n        verify(c4,\n               times(1)).accept(contains(Capability.CAN_ADD_USER.name()));\n        final Consumer<String> c5 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new UserAlreadyExistsException(\"aUser\"),\n                                       c5);\n        verify(c5,\n               times(1)).accept(contains(\"aUser\"));\n\n        final Consumer<String> c6 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new RealmManagementNotAuthorizedException(\"aRealm\"),\n                                       c6);\n        verify(c6,\n               times(1)).accept(contains(\"aRealm\"));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testSkipSecurityExceptions() {\n        final Consumer<String> c1 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new NoImplementationAvailableException(),\n                                       c1);\n        verify(c1,\n               never()).accept(anyString());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testConsumeExceptions() {\n        final Consumer<String> c1 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new RuntimeException(\"anErrorMessage\"),\n                                       c1);\n        verify(c1,\n               times(1)).accept(eq(\"anErrorMessage\"));\n        final Consumer<String> c2 = mock(Consumer.class);\n        tested.consumeExceptionMessage(new RuntimeException(new RuntimeException(\"rootMessage\")),\n                                       c2);\n        verify(c2,\n               times(1)).accept(eq(\"rootMessage\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/test/java/org/uberfire/ext/security/management/client/ClientUserSystemManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.ext.security.management.impl.GroupManagerSettingsImpl;\nimport org.uberfire.ext.security.management.impl.UserManagerSettingsImpl;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ClientUserSystemManagerTest {\n\n    private static final String ATTRIBUTE_USER_ID = \"user.id\";\n    private static final String ATTRIBUTE_USER_FIRST_NAME = \"user.firstName\";\n    private static final String ATTRIBUTE_USER_LAST_NAME = \"user.lastName\";\n    private static final String ATTRIBUTE_USER_ENABLED = \"user.enabled\";\n    private static final String ATTRIBUTE_USER_EMAIL = \"user.email\";\n\n    @Mock\n    private ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    private UserManagerService userManagerService;\n    @Mock\n    private GroupManagerService groupsManagerService;\n    @Mock\n    private RoleManagerService rolesManagerService;\n    private Caller<UserManagerService> usersManagerServiceCaller;\n    private Caller<GroupManagerService> groupsManagerServiceCaller;\n    private Caller<RoleManagerService> rolesManagerServiceCaller;\n\n    private ClientUserSystemManager tested;\n\n    @Before\n    public void setup() {\n        MockitoAnnotations.initMocks(this);\n        final UserManagerSettings userManagerSettings = getUserSettings();\n        when(userManagerService.getSettings()).thenReturn(userManagerSettings);\n        final GroupManagerSettings groupManagerSettings = getGroupSettings();\n        when(groupsManagerService.getSettings()).thenReturn(groupManagerSettings);\n        usersManagerServiceCaller = new CallerMock<UserManagerService>(userManagerService);\n        groupsManagerServiceCaller = new CallerMock<GroupManagerService>(groupsManagerService);\n        rolesManagerServiceCaller = new CallerMock<RoleManagerService>(rolesManagerService);\n        tested = spy(new ClientUserSystemManager(usersManagerServiceCaller,\n                                                 groupsManagerServiceCaller,\n                                                 rolesManagerServiceCaller,\n                                                 new ClientSecurityExceptionMessageResolver(),\n                                                 errorPopupPresenter));\n    }\n\n    @Test\n    public void testInitCache() {\n        tested.initCache();\n        verify(userManagerService,\n               times(1)).getSettings();\n        verify(groupsManagerService,\n               times(1)).getSettings();\n    }\n\n    @Test\n    public void testIsUserCapabilityEnabled() {\n        tested.userManagerSettings = getUserSettings();\n        assertTrue(tested.isUserCapabilityEnabled(Capability.CAN_READ_USER));\n        assertTrue(tested.isUserCapabilityEnabled(Capability.CAN_ASSIGN_GROUPS));\n        assertFalse(tested.isUserCapabilityEnabled(Capability.CAN_ASSIGN_ROLES));\n    }\n\n    @Test\n    public void testIsGroupCapabilityEnabled() {\n        tested.groupManagerSettings = getGroupSettings();\n        assertTrue(tested.isGroupCapabilityEnabled(Capability.CAN_READ_GROUP));\n        assertTrue(tested.isGroupCapabilityEnabled(Capability.CAN_ADD_GROUP));\n        assertFalse(tested.isGroupCapabilityEnabled(Capability.CAN_DELETE_GROUP));\n    }\n\n    @Test\n    public void testGetUserSupportedAttributes() {\n        tested.userManagerSettings = getUserSettings();\n        assertNotNull(tested.getUserSupportedAttribute(ATTRIBUTE_USER_ID));\n        assertNull(tested.getUserSupportedAttribute(\"custom-attr\"));\n    }\n\n    @Test\n    public void testGetConstrainedGroups() {\n        tested.groupManagerSettings = getGroupSettings();\n        Collection<String> cGroups = new ArrayList<String>(1);\n        cGroups.add(\"admin\");\n        tested.groupManagerSettings.setConstrainedGroups(cGroups);\n        assertEquals(cGroups,\n                     tested.getConstrainedGroups());\n    }\n\n    @Test\n    public void testShowError() {\n        tested.showError(new RuntimeException());\n        verify(errorPopupPresenter,\n               times(1)).showMessage(any());\n    }\n\n    private UserManagerSettings getUserSettings() {\n        return new UserManagerSettingsImpl(getUserCapabilities(),\n                                           getUserAttributes());\n    }\n\n    private GroupManagerSettings getGroupSettings() {\n        return new GroupManagerSettingsImpl(getGroupCapabilities(),\n                                            true);\n    }\n\n    private Map<Capability, CapabilityStatus> getUserCapabilities() {\n        Map<Capability, CapabilityStatus> userCapabilityStatusMap = new HashMap<Capability, CapabilityStatus>();\n        userCapabilityStatusMap.put(Capability.CAN_SEARCH_USERS,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_READ_USER,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_ADD_USER,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_UPDATE_USER,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_DELETE_USER,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_MANAGE_ATTRIBUTES,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_ASSIGN_GROUPS,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_CHANGE_PASSWORD,\n                                    CapabilityStatus.ENABLED);\n        userCapabilityStatusMap.put(Capability.CAN_ASSIGN_ROLES,\n                                    CapabilityStatus.UNSUPPORTED);\n        return userCapabilityStatusMap;\n    }\n\n    private Map<Capability, CapabilityStatus> getGroupCapabilities() {\n        Map<Capability, CapabilityStatus> groupCapabilityStatusMap = new HashMap<Capability, CapabilityStatus>();\n        groupCapabilityStatusMap.put(Capability.CAN_SEARCH_GROUPS,\n                                     CapabilityStatus.ENABLED);\n        groupCapabilityStatusMap.put(Capability.CAN_READ_GROUP,\n                                     CapabilityStatus.ENABLED);\n        groupCapabilityStatusMap.put(Capability.CAN_ADD_GROUP,\n                                     CapabilityStatus.ENABLED);\n        groupCapabilityStatusMap.put(Capability.CAN_UPDATE_GROUP,\n                                     CapabilityStatus.ENABLED);\n        groupCapabilityStatusMap.put(Capability.CAN_DELETE_GROUP,\n                                     CapabilityStatus.UNSUPPORTED);\n        return groupCapabilityStatusMap;\n    }\n\n    protected Collection<UserManager.UserAttribute> getUserAttributes() {\n        Collection<UserManager.UserAttribute> attributes = new ArrayList<UserManager.UserAttribute>();\n\n        final UserManager.UserAttribute USER_ID = mock(UserManager.UserAttribute.class);\n        when(USER_ID.getName()).thenReturn(ATTRIBUTE_USER_ID);\n        attributes.add(USER_ID);\n\n        final UserManager.UserAttribute USER_FIST_NAME = mock(UserManager.UserAttribute.class);\n        when(USER_FIST_NAME.getName()).thenReturn(ATTRIBUTE_USER_FIRST_NAME);\n        attributes.add(USER_FIST_NAME);\n\n        final UserManager.UserAttribute USER_LAST_NAME = mock(UserManager.UserAttribute.class);\n        when(USER_LAST_NAME.getName()).thenReturn(ATTRIBUTE_USER_LAST_NAME);\n        attributes.add(USER_LAST_NAME);\n\n        final UserManager.UserAttribute USER_ENABLED = mock(UserManager.UserAttribute.class);\n        when(USER_ENABLED.getName()).thenReturn(ATTRIBUTE_USER_ENABLED);\n        attributes.add(USER_ENABLED);\n\n        final UserManager.UserAttribute USER_EMAIL = mock(UserManager.UserAttribute.class);\n        when(USER_EMAIL.getName()).thenReturn(ATTRIBUTE_USER_EMAIL);\n        attributes.add(USER_EMAIL);\n\n        return attributes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client/src/test/java/org/uberfire/ext/security/management/client/editor/user/UserEditorDriverTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.editor.user;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.validation.ConstraintViolation;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.validation.EntityValidator;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UserEditorDriverTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n\n    private UserEditorDriver tested;\n\n    @Before\n    public void setup() {\n        tested = new UserEditorDriver(userSystemManager);\n    }\n\n    @Test\n    public void testCreateUser() {\n\n        final User u = mock(User.class);\n        final ArgumentCaptor<String> idCaptor = ArgumentCaptor.forClass(String.class);\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final String idArgument = idCaptor.getValue();\n                when(u.getIdentifier()).thenReturn(idArgument);\n                return u;\n            }\n        }).when(userSystemManager).createUser(idCaptor.capture());\n\n        doAnswer(new Answer<Collection<UserManager.UserAttribute>>() {\n            @Override\n            public Collection<UserManager.UserAttribute> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Collection<UserManager.UserAttribute> attributes = new ArrayList<UserManager.UserAttribute>();\n                UserManager.UserAttribute a1 = mockUserAttribute(\"a1\",\n                                                                 \"v1\",\n                                                                 true,\n                                                                 true);\n                UserManager.UserAttribute a2 = mockUserAttribute(\"a2\",\n                                                                 \"v2\",\n                                                                 false,\n                                                                 true);\n                UserManager.UserAttribute a3 = mockUserAttribute(\"a3\",\n                                                                 \"v3\",\n                                                                 true,\n                                                                 false);\n                UserManager.UserAttribute a4 = mockUserAttribute(\"a4\",\n                                                                 \"v4\",\n                                                                 false,\n                                                                 false);\n                attributes.add(a1);\n                attributes.add(a2);\n                attributes.add(a3);\n                attributes.add(a4);\n                return attributes;\n            }\n        }).when(userSystemManager).getUserSupportedAttributes();\n\n        String id = \"user1\";\n        User user = tested.createNewUser(id);\n        assertEquals(user,\n                     u);\n        assertEquals(user.getIdentifier(),\n                     u.getIdentifier());\n        verify(user,\n               times(1)).setProperty(anyString(),\n                                     anyString());\n    }\n\n    @Test\n    public void testShow() {\n        final User user = mock(User.class);\n        final UserEditor userEditor = mock(UserEditor.class);\n        final UserAttributesEditor attributesEditor = mock(UserAttributesEditor.class);\n        final UserAssignedGroupsExplorer groupsExplorer = mock(UserAssignedGroupsExplorer.class);\n        final UserAssignedRolesExplorer rolesExplorer = mock(UserAssignedRolesExplorer.class);\n        when(userEditor.attributesEditor()).thenReturn(attributesEditor);\n        when(userEditor.groupsExplorer()).thenReturn(groupsExplorer);\n        when(userEditor.rolesExplorer()).thenReturn(rolesExplorer);\n        tested.isFlushed = true;\n        tested.isEditMode = true;\n        tested.show(user,\n                    userEditor);\n        assertEquals(user,\n                     tested.user);\n        assertEquals(userEditor,\n                     tested.userEditor);\n        assertFalse(tested.isFlushed);\n        assertFalse(tested.isEditMode);\n        verify(userEditor,\n               times(1)).show(user);\n        verify(attributesEditor,\n               times(1)).show(user);\n        verify(groupsExplorer,\n               times(1)).show(user);\n        verify(rolesExplorer,\n               times(1)).show(user);\n        verify(userEditor,\n               times(0)).edit(user);\n        verify(attributesEditor,\n               times(0)).edit(user);\n        verify(groupsExplorer,\n               times(0)).edit(user);\n        verify(rolesExplorer,\n               times(0)).edit(user);\n        verify(userEditor,\n               times(0)).flush();\n        verify(attributesEditor,\n               times(0)).flush();\n        verify(groupsExplorer,\n               times(0)).flush();\n        verify(rolesExplorer,\n               times(0)).flush();\n    }\n\n    @Test\n    public void testEdit() {\n        final User user = mock(User.class);\n        final UserEditor userEditor = mock(UserEditor.class);\n        final UserAttributesEditor attributesEditor = mock(UserAttributesEditor.class);\n        final UserAssignedGroupsExplorer groupsExplorer = mock(UserAssignedGroupsExplorer.class);\n        final UserAssignedRolesExplorer rolesExplorer = mock(UserAssignedRolesExplorer.class);\n        when(userEditor.attributesEditor()).thenReturn(attributesEditor);\n        when(userEditor.groupsExplorer()).thenReturn(groupsExplorer);\n        when(userEditor.rolesExplorer()).thenReturn(rolesExplorer);\n        tested.isFlushed = true;\n        tested.isEditMode = false;\n        tested.edit(user,\n                    userEditor);\n        assertEquals(user,\n                     tested.user);\n        assertEquals(userEditor,\n                     tested.userEditor);\n        assertFalse(tested.isFlushed);\n        assertTrue(tested.isEditMode);\n        verify(userEditor,\n               times(1)).edit(user);\n        verify(attributesEditor,\n               times(1)).edit(user);\n        verify(groupsExplorer,\n               times(1)).edit(user);\n        verify(rolesExplorer,\n               times(1)).edit(user);\n        verify(userEditor,\n               times(0)).show(user);\n        verify(attributesEditor,\n               times(0)).show(user);\n        verify(groupsExplorer,\n               times(0)).show(user);\n        verify(rolesExplorer,\n               times(0)).show(user);\n        verify(userEditor,\n               times(0)).flush();\n        verify(attributesEditor,\n               times(0)).flush();\n        verify(groupsExplorer,\n               times(0)).flush();\n        verify(rolesExplorer,\n               times(0)).flush();\n    }\n\n    @Test\n    public void testFlush() {\n        final User user = mock(User.class);\n        final Set<Role> roles = new HashSet<Role>();\n        final UserEditor userEditor = mock(UserEditor.class);\n        final UserAttributesEditor attributesEditor = mock(UserAttributesEditor.class);\n        final UserAssignedGroupsExplorer groupsExplorer = mock(UserAssignedGroupsExplorer.class);\n        final UserAssignedRolesExplorer rolesExplorer = mock(UserAssignedRolesExplorer.class);\n        when(userEditor.identifier()).thenReturn(\"user1\");\n        when(userEditor.attributesEditor()).thenReturn(attributesEditor);\n        final Map<String, String> attributes = new HashMap<String, String>();\n        when(attributesEditor.getValue()).thenReturn(attributes);\n        final Set<Group> groups = new HashSet<Group>();\n        when(userEditor.groupsExplorer()).thenReturn(groupsExplorer);\n        when(groupsExplorer.getValue()).thenReturn(groups);\n        final Set<Role> _roles = new HashSet<Role>();\n        when(userEditor.rolesExplorer()).thenReturn(rolesExplorer);\n        when(rolesExplorer.getValue()).thenReturn(_roles);\n        final EntityValidator<User> userEntityValidator = mock(EntityValidator.class);\n        when(userSystemManager.usersValidator()).thenReturn(userEntityValidator);\n        final Set<ConstraintViolation<User>> violations = mock(Set.class);\n        when(violations.isEmpty()).thenReturn(true);\n        when(userEntityValidator.validate(any(User.class))).thenReturn(violations);\n        tested.user = user;\n        tested.userEditor = userEditor;\n        tested.isFlushed = false;\n        tested.isEditMode = true;\n\n        tested.flush();\n        User result = tested.getValue();\n\n        verify(userEditor,\n               times(1)).flush();\n        verify(attributesEditor,\n               times(1)).flush();\n        verify(groupsExplorer,\n               times(1)).flush();\n        verify(rolesExplorer,\n               times(1)).flush();\n        verify(attributesEditor,\n               times(1)).getValue();\n        verify(groupsExplorer,\n               times(1)).getValue();\n        verify(rolesExplorer,\n               times(1)).getValue();\n        verify(userEntityValidator,\n               times(1)).validate(any(User.class));\n        assertEquals(\"user1\",\n                     result.getIdentifier());\n        assertEquals(roles,\n                     result.getRoles());\n        assertEquals(groups,\n                     result.getGroups());\n        assertEquals(_roles,\n                     result.getRoles());\n        assertEquals(attributes,\n                     result.getProperties());\n    }\n\n    private UserManager.UserAttribute mockUserAttribute(String name,\n                                                        String defaultValue,\n                                                        boolean isMandatory,\n                                                        boolean isEditable) {\n\n        UserManager.UserAttribute attr = mock(UserManager.UserAttribute.class);\n        when(attr.getName()).thenReturn(name);\n        when(attr.getDefaultValue()).thenReturn(defaultValue);\n        when(attr.isMandatory()).thenReturn(isMandatory);\n        when(attr.isEditable()).thenReturn(isEditable);\n        return attr;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/README.md",
    "content": "Users and groups management services - Workbench\n================================================\n\nIntroduction\n------------\n\nThis module provides the Uberfire perspectives and screens for the Users and Groups management feature.                               \n\nPlease, in order to use this module, use and specify and of the available Users and Groups management service implementations. For more information, please take a look at the [Uberfire Security Management](../../uberfire-security/uberfire-security-management/).                           \n\nIt provides the following workbench assets:               \n* The security management perspective                           \n* The security home screen                           \n* The security explorer screen                           \n* The role editor screen                           \n* The user editor screen                           \n* The group editor screen                           \n\nNote that the perspective is only available for the role \"admin\".             \n\nInstallation notes\n------------------\n\nTo use the perspectives, screens and widgets provided by this module, please follow these steps:                   \n\n1.- Add the following dependencies into your webapp project's POM                  \n\n        <!-- Security Management. -->\n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-api</artifactId>\n        </dependency>\n    \n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-backend</artifactId>\n        </dependency>\n        \n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-client</artifactId>\n          <scope>provided</scope>\n        </dependency>\n        \n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-widgets-security-management</artifactId>\n          <scope>provided</scope>\n        </dependency>\n        \n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-client-wb</artifactId>\n          <scope>provided</scope>\n        </dependency>\n\n2.- Add the dependencies for the Users and Groups Management service provider to use (use only ONE of the following ones) into your webapp project's POM                  \n\n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-keycloak</artifactId>\n        </dependency>\n    \n        <dependency>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-security-management-wildfly</artifactId>\n        </dependency>\n    \n2.1.- Specifying the provider to use using a properties file              \n\n* You can specify the concrete provider to use by adding a properties file named `security-management.properties` in your web application root classpath. (e.g. `src/main/resources/security-management.properties`)                       \n* Specify your users management services provider implementation class at runtime using the folowing key `org.uberfire.ext.security.management.api.userManagementServices`               \n\n2.2.- Specifying the provider to use at runtime                 \n\n* You have to specify some system properties for running the service provider implementation given               \n* Specify your users management services provider implementation class at runtime using the folowing Java system property `org.uberfire.ext.security.management.api.userManagementServices`                               \n\n*NOTE*: Please read the concrete service provider's documentation for more details about its configuration.                   \n\n3.- Add the following source GWT artifacts to compile in the `org.codehaus.mojo:gwt-maven-plugin`                    \n \n        <!-- Security Management -->\n        <compileSourcesArtifact>org.uberfire:uberfire-security-management-api</compileSourcesArtifact>\n        <compileSourcesArtifact>org.uberfire:uberfire-security-management-client</compileSourcesArtifact>\n        <compileSourcesArtifact>org.uberfire:uberfire-widgets-security-management</compileSourcesArtifact>\n        <compileSourcesArtifact>org.uberfire:uberfire-security-management-client-wb</compileSourcesArtifact>\n\n4.- Add the GWT module dependency in your webapp's GWT module file                     \n\n        <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementWorkbench\"/>\n\n5.- If deploying on JBoss Wildfly or EAP, please add or update the `jboss-deployment-structure.xml`, if necessary (read each service provider implementation docs)                       \n\n6.- You can use the Security Management perspective on your webapp by adding the perspective menu item as in the following example                   \n \n        @Inject\n        private WorkbenchMenuBarPresenter menubar;\n        \n        @Inject\n        private ClientUserSystemManager userSystemManager;\n        \n        ....\n        \n        @AfterInitialization\n        public void startApp() {\n        \n            final MenuFactory.TopLevelMenusBuilder<MenuFactory.MenuBuilder> builder = ...\n            \n            ...\n\n            if ( null != userSystemManager ) {\n                // Wait for user management services to be initialized, if any.\n                userSystemManager.waitForInitialization(new Command() {\n                    @Override\n                    public void execute() {\n                        if (userSystemManager.isActive()) {\n                            builder.newTopLevelMenu(\"Users management\").respondsWith(new Command() {\n                                @Override\n                                public void execute() {\n                                    placeManager.goTo(new DefaultPlaceRequest(\"UsersManagementPerspective\"));\n                                }\n                            }).endMenu().\n                                    newTopLevelMenu(\"Groups management\")\n                                    .respondsWith(new Command() {\n                                        @Override\n                                        public void execute() {\n                                            placeManager.goTo(new DefaultPlaceRequest(\"GroupsManagementPerspective\"));\n                                        }\n                                    }).endMenu();\n    \n                        } else {\n                            GWT.log(\"Users management is NOT ACTIVE.\");\n                        }\n    \n                        final Menus menus = builder.build();\n                        menubar.addMenus(menus);\n                    }\n                });\n            }\n            \n            ...\n            \n        }\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-client-wb</artifactId>\n  <name>Uberfire Security Management - Users and groups management Workbench client</name>\n  <description>Uberfire Security Management - Users and groups management Workbench client</description>\n\n  <dependencies>\n\n    <!-- Uberfire. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-security-management</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Errai. -->\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <!-- Others. -->\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test scope. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/ResourceBundleEntryPoint.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@Bundle(\"resources/i18n/SecurityManagementHomeConstants.properties\")\n@EntryPoint\npublic class ResourceBundleEntryPoint {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/perspectives/SecurityManagementPerspective.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.explorer.SecurityExplorerScreen;\nimport org.uberfire.ext.security.management.client.screens.home.SecurityManagementHomeScreen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"SecurityManagementPerspective\", isTransient = true)\npublic class SecurityManagementPerspective {\n\n    private PerspectiveDefinition perspective;\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        if (perspective == null) {\n            return createPerspectiveDefinition();\n        }\n\n        return perspective;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        perspective = createPerspectiveDefinition();\n        configurePerspective(placeRequest);\n    }\n\n    PerspectiveDefinition createPerspectiveDefinition() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(UsersManagementWorkbenchConstants.INSTANCE.securityManagement());\n\n        return perspective;\n    }\n\n    void configurePerspective(final PlaceRequest placeRequest) {\n        perspective.getRoot().addPart(SecurityManagementHomeScreen.SCREEN_ID);\n\n        final PanelDefinition west = new PanelDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        west.setWidth(400);\n        west.setMinWidth(400);\n        west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(SecurityExplorerScreen.SCREEN_ID,\n                                                                    placeRequest.getParameters())));\n        perspective.getRoot().insertChild(CompassPosition.WEST,\n                                          west);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * <p>Users Management constants for workbench module.</p>\n * @since 0.8.0\n */\npublic interface UsersManagementWorkbenchConstants extends Messages {\n\n    UsersManagementWorkbenchConstants INSTANCE = GWT.create(UsersManagementWorkbenchConstants.class);\n\n    String securityManagement();\n\n    String securityExplorer();\n\n    String roles();\n\n    String groups();\n\n    String users();\n\n    String usersManagement();\n\n    String groupsManagement();\n\n    String usersManagementHome();\n\n    String usersExplorer();\n\n    String userEditor();\n\n    String groupsManagementHome();\n\n    String groupsExplorer();\n\n    String groupEditor();\n\n    String rolesExplorer();\n\n    String roleEditor();\n\n    String home_createUser();\n\n    String home_listSearchUsers();\n\n    String home_clickOnUserInListToRead();\n\n    String home_editAndDeleteUser();\n\n    String home_createGroup();\n\n    String home_listSearchGroups();\n\n    String home_clickOnGroupInListToRead();\n\n    String home_deleteGroup();\n\n    String userEditorWelcomeText();\n\n    String groupEditorWelcomeText();\n\n    String showUser(String userId);\n\n    String editUser(String userId);\n\n    String showGroup(String groupName);\n\n    String editGroup(String groupName);\n\n    String createNewUser();\n\n    String createNewGroup();\n\n    String showRole(String roleName);\n\n    String editRole(String roleName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/BaseScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n/**\n * <p>Default explorer screen.</p>\n * @since 0.8.0\n */\npublic interface BaseScreen extends IsWidget {\n\n    void init(IsWidget explorerWidget);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/BaseScreenView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic class BaseScreenView extends Composite implements BaseScreen {\n\n    private static BaseScreenViewBinder uiBinder = GWT.create(BaseScreenViewBinder.class);\n    @UiField\n    FlowPanel mainPanel;\n\n    @UiConstructor\n    public BaseScreenView() {\n        init();\n    }\n\n    private void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(IsWidget explorerWidget) {\n        mainPanel.clear();\n        mainPanel.add(explorerWidget);\n    }\n\n    interface BaseScreenViewBinder\n            extends\n            UiBinder<FlowPanel, BaseScreenView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/BaseScreenView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n    .mainPanel {\n      padding: 15px;\n      padding-bottom: 50px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\"/>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/editor/GroupEditorScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.uberfire.client.annotations.WorkbenchContextId;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow.GroupCreationWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow.GroupEditorWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@WorkbenchScreen(identifier = GroupEditorScreen.SCREEN_ID)\npublic class GroupEditorScreen {\n\n    public static final String SCREEN_ID = \"GroupEditorScreen\";\n    public static final String GROUP_NAME = \"groupName\";\n    public static final String ADD_GROUP = \"addGroup\";\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    Event<ChangeTitleWidgetEvent> changeTitleNotification;\n\n    @Inject\n    ErrorPopupPresenter errorPopupPresenter;\n\n    @Inject\n    BaseScreen baseScreen;\n\n    @Inject\n    GroupEditorWorkflow groupEditorWorkflow;\n\n    @Inject\n    GroupCreationWorkflow groupCreationWorkflow;\n\n    @Inject\n    ClientUserSystemManager clientUserSystemManager;\n    String groupName;\n    private String title;\n    private PlaceRequest placeRequest;\n\n    @PostConstruct\n    public void init() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        this.placeRequest = placeRequest;\n        final String addGroup = placeRequest.getParameter(ADD_GROUP,\n                                                          \"false\");\n        groupName = placeRequest.getParameter(GROUP_NAME,\n                                              null);\n        if (Boolean.valueOf(addGroup)) {\n            create();\n        } else {\n            show();\n        }\n    }\n\n    @OnOpen\n    public void onOpen() {\n\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return !groupEditorWorkflow.isDirty() ||\n                Window.confirm(UsersManagementWidgetsConstants.INSTANCE.groupIsDirty());\n    }\n\n    @OnClose\n    public void onClose() {\n        groupEditorWorkflow.clear();\n        groupCreationWorkflow.clear();\n        this.groupName = null;\n    }\n\n    void showError(final String message) {\n        errorPopupPresenter.showMessage(message);\n    }\n\n    void show() {\n        title = UsersManagementWorkbenchConstants.INSTANCE.showGroup(groupName);\n        baseScreen.init(groupEditorWorkflow);\n        groupEditorWorkflow.show(groupName);\n    }\n\n    void create() {\n        this.groupName = null;\n        title = UsersManagementWorkbenchConstants.INSTANCE.createNewGroup();\n        baseScreen.init(groupCreationWorkflow);\n        groupCreationWorkflow.create();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return baseScreen;\n    }\n\n    @WorkbenchContextId\n    public String getMyContextRef() {\n        return \"groupEditorContext\";\n    }\n\n    void onGroupDeleted(@Observes final DeleteGroupEvent deleteGroupEvent) {\n        final String deletedGroup = deleteGroupEvent.getName();\n        if (groupName != null && groupName.equals(deletedGroup)) {\n            closeEditor();\n        }\n    }\n\n    private void closeEditor() {\n        placeManager.closePlace(placeRequest);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/editor/RoleEditorScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.uberfire.client.annotations.WorkbenchContextId;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.role.workflow.RoleEditorWorkflow;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@WorkbenchScreen(identifier = RoleEditorScreen.SCREEN_ID)\npublic class RoleEditorScreen {\n\n    public static final String SCREEN_ID = \"RoleEditorScreen\";\n    public static final String ROLE_NAME = \"roleName\";\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    Event<ChangeTitleWidgetEvent> changeTitleNotification;\n\n    @Inject\n    ErrorPopupPresenter errorPopupPresenter;\n\n    @Inject\n    BaseScreen baseScreen;\n\n    @Inject\n    ClientUserSystemManager clientUserSystemManager;\n\n    @Inject\n    RoleEditorWorkflow roleEditorWorkflow;\n\n    String roleName;\n\n    @PostConstruct\n    public void init() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        roleName = placeRequest.getParameter(ROLE_NAME,\n                                             null);\n        show();\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return !roleEditorWorkflow.isDirty() ||\n                Window.confirm(UsersManagementWidgetsConstants.INSTANCE.roleIsDirty());\n    }\n\n    @OnClose\n    public void onClose() {\n        roleEditorWorkflow.clear();\n        this.roleName = null;\n    }\n\n    void show() {\n        baseScreen.init(roleEditorWorkflow);\n        roleEditorWorkflow.show(roleName);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return UsersManagementWorkbenchConstants.INSTANCE.showRole(roleName);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return baseScreen;\n    }\n\n    @WorkbenchContextId\n    public String getMyContextRef() {\n        return \"roleEditorContext\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/editor/UserEditorScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.Window;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.annotations.WorkbenchContextId;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow.UserCreationWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow.UserEditorWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ContextualEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@WorkbenchScreen(identifier = UserEditorScreen.SCREEN_ID)\npublic class UserEditorScreen {\n\n    public static final String SCREEN_ID = \"UserEditorScreen\";\n    public static final String USER_ID = \"userId\";\n    public static final String ADD_USER = \"addUser\";\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    Event<ChangeTitleWidgetEvent> changeTitleNotification;\n\n    @Inject\n    ErrorPopupPresenter errorPopupPresenter;\n\n    @Inject\n    BaseScreen baseScreen;\n\n    @Inject\n    ClientUserSystemManager clientUserSystemManager;\n\n    @Inject\n    UserEditorWorkflow userEditorWorkflow;\n\n    @Inject\n    UserCreationWorkflow userCreationWorkflow;\n    String userId;\n    private String title = UsersManagementWorkbenchConstants.INSTANCE.userEditor();\n    private PlaceRequest placeRequest;\n\n    @PostConstruct\n    public void init() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        this.placeRequest = placeRequest;\n        final String addUser = placeRequest.getParameter(ADD_USER,\n                                                         \"false\");\n        final String userId = placeRequest.getParameter(USER_ID,\n                                                        null);\n        if (Boolean.valueOf(addUser)) {\n            create();\n        } else {\n            show(userId);\n        }\n    }\n\n    @OnOpen\n    public void onOpen() {\n\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return !isDirty() ||\n                Window.confirm(UsersManagementWidgetsConstants.INSTANCE.userIsDirty());\n    }\n\n    @OnClose\n    public void onClose() {\n        userEditorWorkflow.clear();\n        userCreationWorkflow.clear();\n        this.userId = null;\n    }\n\n    void show(final String id) {\n        baseScreen.init(userEditorWorkflow);\n        userEditorWorkflow.show(id);\n    }\n\n    void create() {\n        title = UsersManagementWorkbenchConstants.INSTANCE.createNewUser();\n        baseScreen.init(userCreationWorkflow);\n        userCreationWorkflow.create();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return baseScreen;\n    }\n\n    @WorkbenchContextId\n    public String getMyContextRef() {\n        return \"userEditorContext\";\n    }\n\n    void onEditUserEvent(@Observes final OnEditEvent onEditEvent) {\n        if (checkEventContext(onEditEvent,\n                              userEditorWorkflow.getUserEditor())) {\n            try {\n                User user = (User) onEditEvent.getInstance();\n                this.userId = user.getIdentifier();\n                changeTitleNotification.fire(new ChangeTitleWidgetEvent(placeRequest,\n                                                                        new SafeHtmlBuilder()\n                                                                                .appendEscaped(UsersManagementWorkbenchConstants.INSTANCE.editUser(user.getIdentifier()))\n                                                                                .toSafeHtml().asString()));\n            } catch (ClassCastException e) {\n            }\n        }\n    }\n\n    void onShowUserEvent(@Observes final OnShowEvent onShowEvent) {\n        if (checkEventContext(onShowEvent,\n                              userEditorWorkflow.getUserEditor())) {\n            try {\n                User user = (User) onShowEvent.getInstance();\n                this.userId = user.getIdentifier();\n                final String title = new SafeHtmlBuilder()\n                        .appendEscaped(UsersManagementWorkbenchConstants.INSTANCE.showUser(user.getIdentifier()))\n                        .toSafeHtml().asString();\n                changeTitleNotification.fire(new ChangeTitleWidgetEvent(placeRequest,\n                                                                        title));\n            } catch (ClassCastException e) {\n            }\n        }\n    }\n\n    void onUserDeleted(@Observes final DeleteUserEvent deleteUserEvent) {\n        final String deletedId = deleteUserEvent.getIdentifier();\n        if (userId != null && userId.equals(deletedId)) {\n            closeEditor();\n        }\n    }\n\n    private boolean checkEventContext(final ContextualEvent contextualEvent,\n                                      final Object context) {\n        return contextualEvent != null && contextualEvent.getContext() != null && contextualEvent.getContext().equals(context);\n    }\n\n    private boolean isDirty() {\n        return userEditorWorkflow.isDirty() || userCreationWorkflow.isDirty();\n    }\n\n    void closeEditor() {\n        placeManager.closePlace(placeRequest);\n    }\n\n    void showError(final String message) {\n        errorPopupPresenter.showMessage(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/explorer/SecurityExplorerScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.explorer;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.client.ClientSecurityExceptionMessageResolver;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.editor.GroupEditorScreen;\nimport org.uberfire.ext.security.management.client.screens.editor.RoleEditorScreen;\nimport org.uberfire.ext.security.management.client.screens.editor.UserEditorScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.GroupsExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.RolesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.UsersExplorer;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\n@WorkbenchScreen(identifier = SecurityExplorerScreen.SCREEN_ID)\npublic class SecurityExplorerScreen {\n\n    public static final String SCREEN_ID = \"SecurityExplorerScreen\";\n\n    public static final String ACTIVE_TAB = \"activeTab\";\n\n    public static final String ROLES_TAB = \"RolesTab\";\n\n    public static final String GROUPS_TAB = \"GroupsTab\";\n\n    public static final String USERS_TAB = \"UsersTab\";\n\n    private final View view;\n    private final RolesExplorer rolesExplorer;\n    private final GroupsExplorer groupsExplorer;\n    private final UsersExplorer usersExplorer;\n    private final ErrorPopupPresenter errorPopupPresenter;\n    private final PlaceManager placeManager;\n    private final ClientUserSystemManager userSystemManager;\n    private final ClientSecurityExceptionMessageResolver exceptionMessageResolver;\n\n    @Inject\n    public SecurityExplorerScreen(final View view,\n                                  final RolesExplorer rolesExplorer,\n                                  final GroupsExplorer groupsExplorer,\n                                  final UsersExplorer usersExplorer,\n                                  final ErrorPopupPresenter errorPopupPresenter,\n                                  final PlaceManager placeManager,\n                                  final ClientUserSystemManager userSystemManager,\n                                  final ClientSecurityExceptionMessageResolver exceptionMessageResolver) {\n        this.view = view;\n        this.rolesExplorer = rolesExplorer;\n        this.groupsExplorer = groupsExplorer;\n        this.usersExplorer = usersExplorer;\n        this.errorPopupPresenter = errorPopupPresenter;\n        this.placeManager = placeManager;\n        this.userSystemManager = userSystemManager;\n        this.exceptionMessageResolver = exceptionMessageResolver;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return UsersManagementWorkbenchConstants.INSTANCE.securityExplorer();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this,\n                  rolesExplorer,\n                  groupsExplorer,\n                  usersExplorer);\n        rolesExplorer.show();\n\n        view.rolesEnabled(true);\n        view.groupsEnabled(false);\n        view.usersEnabled(false);\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        final String activeTab = placeRequest.getParameter(ACTIVE_TAB,\n                                                           ROLES_TAB);\n\n        userSystemManager.waitForInitialization(() -> {\n            if (userSystemManager.isActive()) {\n                groupsExplorer.show();\n                usersExplorer.show();\n                view.groupsEnabled(true);\n                view.usersEnabled(true);\n\n                if (activeTab.equals(USERS_TAB)) {\n                    view.rolesActive(false);\n                    view.groupsActive(false);\n                    view.usersActive(true);\n                } else if (activeTab.equals(GROUPS_TAB)) {\n                    view.rolesActive(false);\n                    view.groupsActive(true);\n                    view.usersActive(false);\n                }\n            }\n        });\n    }\n\n    @OnClose\n    public void onClose() {\n        rolesExplorer.clear();\n        groupsExplorer.clear();\n        usersExplorer.clear();\n    }\n\n    void onRoleRead(@Observes final ReadRoleEvent readRoleEvent) {\n        checkNotNull(\"event\",\n                     readRoleEvent);\n        final String name = readRoleEvent.getName();\n        final Map<String, String> params = new HashMap(1);\n        params.put(RoleEditorScreen.ROLE_NAME,\n                   name);\n        placeManager.goTo(new DefaultPlaceRequest(RoleEditorScreen.SCREEN_ID,\n                                                  params));\n    }\n\n    // Event processing\n\n    void onGroupRead(@Observes final ReadGroupEvent readGroupEvent) {\n        final String name = readGroupEvent.getName();\n        final Map<String, String> params = new HashMap<String, String>(1);\n        params.put(GroupEditorScreen.GROUP_NAME,\n                   name);\n        placeManager.goTo(new DefaultPlaceRequest(GroupEditorScreen.SCREEN_ID,\n                                                  params));\n    }\n\n    void onUserRead(@Observes final ReadUserEvent readUserEvent) {\n        checkNotNull(\"event\",\n                     readUserEvent);\n        final String id = readUserEvent.getIdentifier();\n        final Map<String, String> params = new HashMap<String, String>(1);\n        params.put(UserEditorScreen.USER_ID,\n                   id);\n        placeManager.goTo(new DefaultPlaceRequest(UserEditorScreen.SCREEN_ID,\n                                                  params));\n    }\n\n    void onGroupCreate(@Observes final NewGroupEvent newGroupEvent) {\n        checkNotNull(\"event\",\n                     newGroupEvent);\n        final Map<String, String> params = new HashMap(1);\n        params.put(GroupEditorScreen.ADD_GROUP,\n                   \"true\");\n        placeManager.goTo(new DefaultPlaceRequest(GroupEditorScreen.SCREEN_ID,\n                                                  params));\n    }\n\n    void onUserCreate(@Observes final NewUserEvent newUserEvent) {\n        checkNotNull(\"event\",\n                     newUserEvent);\n        final Map<String, String> params = new HashMap(1);\n        params.put(UserEditorScreen.ADD_USER,\n                   \"true\");\n        placeManager.goTo(new DefaultPlaceRequest(UserEditorScreen.SCREEN_ID,\n                                                  params));\n    }\n\n    void onErrorEvent(@Observes final OnErrorEvent event) {\n        checkNotNull(\"event\",\n                     event);\n        exceptionMessageResolver\n                .consumeExceptionMessage(event.getException(),\n                                         errorPopupPresenter::showMessage);\n    }\n\n    public interface View extends UberView<SecurityExplorerScreen> {\n\n        void init(SecurityExplorerScreen presenter,\n                  IsWidget rolesExplorer,\n                  IsWidget groupsExplorer,\n                  IsWidget usersExplorer);\n\n        void rolesEnabled(boolean enabled);\n\n        void groupsEnabled(boolean enabled);\n\n        void usersEnabled(boolean enabled);\n\n        void rolesActive(boolean active);\n\n        void groupsActive(boolean active);\n\n        void usersActive(boolean active);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/explorer/SecurityExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.explorer;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class SecurityExplorerView extends Composite implements SecurityExplorerScreen.View {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField\n    TabListItem rolesTab;\n    @UiField\n    TabListItem groupsTab;\n    @UiField\n    TabListItem usersTab;\n    @UiField\n    TabPane rolesPane;\n    @UiField\n    TabPane groupsPane;\n    @UiField\n    TabPane usersPane;\n    SecurityExplorerScreen presenter;\n\n    @Override\n    public void init(SecurityExplorerScreen presenter) {\n        this.presenter = checkNotNull(\"presenter\",\n                                      presenter);\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(SecurityExplorerScreen presenter,\n                     IsWidget rolesExplorer,\n                     IsWidget groupsExplorer,\n                     IsWidget usersExplorer) {\n        this.init(presenter);\n        rolesPane.add(rolesExplorer);\n        groupsPane.add(groupsExplorer);\n        usersPane.add(usersExplorer);\n    }\n\n    @Override\n    public void rolesEnabled(boolean enabled) {\n        rolesTab.setEnabled(enabled);\n    }\n\n    @Override\n    public void groupsEnabled(boolean enabled) {\n        groupsTab.setEnabled(enabled);\n    }\n\n    @Override\n    public void usersEnabled(boolean enabled) {\n        usersTab.setEnabled(enabled);\n    }\n\n    @Override\n    public void rolesActive(boolean active) {\n        rolesTab.setActive(active);\n        rolesPane.setActive(active);\n    }\n\n    @Override\n    public void groupsActive(boolean active) {\n        groupsTab.setActive(active);\n        groupsPane.setActive(active);\n    }\n\n    @Override\n    public void usersActive(boolean active) {\n        usersTab.setActive(active);\n        usersPane.setActive(active);\n    }\n\n    interface Binder extends UiBinder<Widget, SecurityExplorerView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/explorer/SecurityExplorerView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field='i18n' type='org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants'/>\n\n  <b:Container fluid=\"true\">\n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <b:TabPanel addStyleNames=\"uf-tabbar-panel\">\n          <b:NavTabs addStyleNames=\"uf-tabbar-panel-nav-tabs nav-tabs-pf\">\n            <b:TabListItem ui:field=\"rolesTab\" dataTarget=\"#roles\" text=\"{i18n.roles}\" active=\"true\" />\n            <b:TabListItem ui:field=\"groupsTab\" dataTarget=\"#groups\" text=\"{i18n.groups}\"/>\n            <b:TabListItem ui:field=\"usersTab\" dataTarget=\"#users\" text=\"{i18n.users}\"/>\n          </b:NavTabs>\n          <b:TabContent>\n            <b:TabPane ui:field=\"rolesPane\" active=\"true\" b:id=\"roles\" />\n            <b:TabPane ui:field=\"groupsPane\" b:id=\"groups\" />\n            <b:TabPane ui:field=\"usersPane\" b:id=\"users\" />\n          </b:TabContent>\n        </b:TabPanel>\n      </b:Column>\n    </b:Row>\n  </b:Container>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/home/SecurityManagementHomeScreen.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.home;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWorkbenchConstants;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = SecurityManagementHomeScreen.SCREEN_ID)\npublic class SecurityManagementHomeScreen {\n\n    public static final String SCREEN_ID = \"SecurityManagementHomeScreen\";\n    @Inject\n    BaseScreen baseScreen;\n    @Inject\n    View view;\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        baseScreen.init(view);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return UsersManagementWorkbenchConstants.INSTANCE.securityManagement();\n    }\n\n    @WorkbenchPartView\n    public Widget getWidget() {\n        return baseScreen.asWidget();\n    }\n\n    public interface View extends UberView<SecurityManagementHomeScreen> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/home/SecurityManagementHomeView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"container-fluid text-center\" style=\"padding-top: 70px;\">\n  <div class=\"row\">\n    <i class=\"fa fa-unlock-alt\" style=\"font-size: 100px;\"></i>\n  </div>\n  <div class=\"row\" style=\"padding-top: 20px;\">\n    <h2><strong data-i18n-key=\"SecurityManagement\"></strong></h2>\n  </div>\n  <div class=\"row\" style=\"padding-top: 20px;\">\n    <p>\n      <span data-i18n-key=\"WelcomeMessage\" style=\"font-size: larger\"></span>\n    </p>\n  </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/java/org/uberfire/ext/security/management/client/screens/home/SecurityManagementHomeView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.home;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class SecurityManagementHomeView extends Composite implements SecurityManagementHomeScreen.View {\n\n    SecurityManagementHomeScreen presenter;\n\n    @Override\n    public void init(SecurityManagementHomeScreen presenter) {\n        this.presenter = presenter;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/UberfireSecurityManagementWorkbench.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementWidgets\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementHomeConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSecurityManagementHomeView.SecurityManagement=Security Management\nSecurityManagementHomeView.WelcomeMessage=Control who can access the different features and resources available\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementHomeConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSecurityManagementHomeView.SecurityManagement=Gestión de la seguridad\nSecurityManagementHomeView.WelcomeMessage=Controlar quién puede acceder a los diferentes recursos y funcionalidades disponibles\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementHomeConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSecurityManagementHomeView.SecurityManagement=Gestion de la sécurité\nSecurityManagementHomeView.WelcomeMessage=Contrôler les personnes autorisées à accéder aux différentes fonctionnalités et ressources disponibles\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementHomeConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSecurityManagementHomeView.SecurityManagement=Gestione della sicurezza\nSecurityManagementHomeView.WelcomeMessage=Controlla chi può accedere alle diverse funzionalità e risorse disponibili\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementHomeConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSecurityManagementHomeView.SecurityManagement=セキュリティー管理\nSecurityManagementHomeView.WelcomeMessage=別の利用可能な機能およびリソースにアクセスするユーザーを制限\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsecurityManagement=Security management\nsecurityExplorer=Security explorer\nroles=Roles\ngroups=Groups\nusers=Users\nusersManagement=Users management\ngroupsManagement=Groups management\nusersManagementHome=Users management home\nusersExplorer=Users explorer\nuserEditor=User editor\ngroupsManagementHome=Groups management home\ngroupsExplorer=Groups explorer\ngroupEditor=Group editor\nrolesExplorer=Roles explorer\nroleEditor=Role editor\nhome_createUser=Create new user\nhome_listSearchUsers=Search or navigate through system users at the list on left panel\nhome_clickOnUserInListToRead=Click on a user in the list to view it\nhome_editAndDeleteUser=Edit or delete a user after clicking on it in the list\nhome_createGroup=Create new group\nhome_listSearchGroups=Search or navigate through system groups at the list on left panel\nhome_clickOnGroupInListToRead=Click on a group in the list to view it\nhome_deleteGroup=Delete a group after clicking on it in the list\nuserEditorWelcomeText=Welcome to the users management screen. Here you can:\ngroupEditorWelcomeText=Welcome to the groups management screen. Here you can:\nshowUser=Showing user {0}\neditUser=Editing user {0}\nshowGroup=Showing group {0}\neditGroup=Editing group {0}\ncreateNewUser=Create new user\ncreateNewGroup=Create new group\nshowRole=Showing role {0}\neditRole=Editing role {0}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_de.properties",
    "content": "roles=Rollen\ngroups=Gruppen\nusers=Benutzer\nusersManagement=Benutzer-Management\ngroupsManagement=Gruppen-Management\nusersManagementHome=Benutzer-Management Home\nusersExplorer=Benutzer-Explorer\nuserEditor=Benutzer-Editor\ngroupsManagementHome=Gruppen-Management Home\ngroupsExplorer=Gruppen-Explorer\ngroupEditor=Gruppen-Editor\nhome_createUser=Neuen Benutzer erstellen\nhome_listSearchUsers=Suche oder Navigation über Systembenutzer in der Liste auf linkem Panel\nhome_clickOnUserInListToRead=Klicken Sie auf einen Benutzer in der Liste um ihn anzuzeigen\nhome_editAndDeleteUser=Klicken Sie auf einen Benutzer in der Liste um ihn zu bearbeiten oder zu löschen\nhome_createGroup=Neue Gruppe erstellen\nhome_listSearchGroups=Suche oder Navigation über Systemgruppen in der Liste auf linkem Panel\nhome_clickOnGroupInListToRead=Klicken Sie auf eine Gruppe in der Liste um sie anzuzeigen\nhome_deleteGroup=Klicken Sie auf eine Gruppe in der Liste um sie zu löschen\nuserEditorWelcomeText=Willkommen bei der Anzeige zum Benutzer-Management. Hier können Sie\\:\ngroupEditorWelcomeText=Willkommen bei der Anzeige zum Gruppen-Management. Hier können Sie\\:\ncreateNewUser=Neuen Benutzer erstellen\ncreateNewGroup=Neue Gruppe erstellen\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsecurityManagement=Gestión de la seguridad\nsecurityExplorer=Explorador de seguridad\nroles=Funciones\ngroups=Grupos\nusers=Usuarios\nusersManagement=Gestión de usuarios\ngroupsManagement=Gestión de grupos\nusersManagementHome=Inicio de la gestión de usuarios\nusersExplorer=Explorador de usuarios\nuserEditor=Editor de usuario\ngroupsManagementHome=Inicio de la gestión de grupos\ngroupsExplorer=Grupos exploradores\ngroupEditor=Editor de grupo\nrolesExplorer=Explorador de funciones\nroleEditor=Editor de función\nhome_createUser=Crear nuevo usuario\nhome_listSearchUsers=Buscar o explorar los usuarios del sistema en la lista del panel izquierdo\nhome_clickOnUserInListToRead=Hacer clic en un usuario de la lista para verlo\nhome_editAndDeleteUser=Editar o eliminar un usuario después de hacer clic en él en la lista\nhome_createGroup=Crear nuevo grupo\nhome_listSearchGroups=Buscar o explorar los grupos del sistema en la lista del panel izquierdo\nhome_clickOnGroupInListToRead=Haga clic en un grupo de la lista para verlo\nhome_deleteGroup=Eliminar un grupo después de hacer clic en él en la lista\nuserEditorWelcomeText=Bienvenido a la pantalla de gestión de usuarios. Aquí puede hacer lo siguiente:\ngroupEditorWelcomeText=Bienvenido a la pantalla de gestión de grupos. Aquí puede hacer lo siguiente:\nshowUser=Mostrando el usuario {0}\neditUser=Editando el usuario {0}\nshowGroup=Mostrando el grupo {0}\neditGroup=Editando el grupo {0}\ncreateNewUser=Crear nuevo usuario\ncreateNewGroup=Crear nuevo grupo\nshowRole=Mostrando la función {0}\neditRole=Editando la función {0}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsecurityManagement=Gestion de la sécurité\nsecurityExplorer=Explorateur de sécurité\nroles=Rôles\ngroups=Groupes\nusers=Utilisateurs\nusersManagement=Gestion des utilisateurs\ngroupsManagement=Gestion des groupes\nusersManagementHome=Accueil de la gestion des utilisateurs\nusersExplorer=Explorateur d''utilisateurs\nuserEditor=Éditeur d''utilisateur\ngroupsManagementHome=Accueil de la gestion des groupes\ngroupsExplorer=Explorateur de groupes\ngroupEditor=Éditeur de groupe\nrolesExplorer=Explorateur de rôles\nroleEditor=Éditeur de rôle\nhome_createUser=Créer un utilisateur\nhome_listSearchUsers=Recherchez des utilisateurs du système ou parcourez la liste disponible dans le panneau de gauche\nhome_clickOnUserInListToRead=Cliquez sur un utilisateur de la liste pour l''afficher\nhome_editAndDeleteUser=Modifiez ou supprimez un utilisateur après avoir cliqué sur celui-ci dans la liste\nhome_createGroup=Créer un groupe\nhome_listSearchGroups=Recherchez des groupes du système ou parcourez la liste disponible dans le panneau de gauche\nhome_clickOnGroupInListToRead=Cliquez sur un groupe de la liste pour l''afficher\nhome_deleteGroup=Supprimez un groupe après avoir cliqué sur celui-ci dans la liste\nuserEditorWelcomeText=Bienvenue dans l''écran de gestion des utilisateurs. Cet écran vous permet d''effectuer les opérations suivantes :\ngroupEditorWelcomeText=Bienvenue dans l''écran de gestion des groupes. Cet écran vous permet d''effectuer les opérations suivantes :\nshowUser=Afficher l''utilisateur {0}\neditUser=Modifier l''utilisateur {0}\nshowGroup=Afficher le groupe {0}\neditGroup=Modifier le groupe {0}\ncreateNewUser=Créer un utilisateur\ncreateNewGroup=Créer un groupe\nshowRole=Afficher le rôle {0}\neditRole=Modifier le rôle {0}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsecurityManagement=Gestione della sicurezza\nsecurityExplorer=Esploratore della sicurezza\nroles=Ruoli\ngroups=Gruppi\nusers=Utenti\nusersManagement=Gestione utenti\ngroupsManagement=Gestione gruppi\nusersManagementHome=Home della gestione utenti\nusersExplorer=Esploratore degli utenti\nuserEditor=Editor utente\ngroupsManagementHome=Home della gestione gruppi\ngroupsExplorer=Esploratore dei gruppi\ngroupEditor=Editor gruppo\nrolesExplorer=Esploratore dei ruoli\nroleEditor=Editor ruolo\nhome_createUser=Crea nuovo utente\nhome_listSearchUsers=Cerca o naviga tra gli utenti di sistema nella lista sul pannello sinistro\nhome_clickOnUserInListToRead=Fai clic su un utente nella lista per visualizzarlo\nhome_editAndDeleteUser=Modifica o elimina un utente dopo aver fatto clic su di esso nella lista\nhome_createGroup=Crea nuovo gruppo\nhome_listSearchGroups=Cerca o naviga tra i gruppi di sistema nella lista sul pannello sinistro\nhome_clickOnGroupInListToRead=Fai clic su un gruppo nella lista per visualizzarlo\nhome_deleteGroup=Elimina un gruppo dopo aver fatto clic su di esso nella lista\nuserEditorWelcomeText=Benvenuto nella schermata di gestione degli utenti. Qui puoi:\ngroupEditorWelcomeText=Benvenuto nella schermata di gestione dei gruppi. Qui puoi:\nshowUser=Visualizzazione utente {0}\neditUser=Modifica utente {0}\nshowGroup=Visualizzazione gruppo {0}\neditGroup=Modifica gruppo {0}\ncreateNewUser=Crea nuovo utente\ncreateNewGroup=Crea nuovo gruppo\nshowRole=Visualizzazione ruolo {0}\neditRole=Modifica ruolo {0}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nsecurityManagement=セキュリティー管理\nsecurityExplorer=セキュリティーエクスプローラー\nroles=ロール\ngroups=グループ\nusers=ユーザー\nusersManagement=ユーザー管理\ngroupsManagement=グループ管理\nusersManagementHome=ユーザー管理ホーム\nusersExplorer=ユーザーエクスプローラー\nuserEditor=ユーザーエディター\ngroupsManagementHome=グループ管理ホーム\ngroupsExplorer=グループエクスプローラー\ngroupEditor=グループエディター\nrolesExplorer=ロールエクスプローラー\nroleEditor=ロールエディター\nhome_createUser=新規ユーザーの作成\nhome_listSearchUsers=左側パネルの一覧でシステムユーザーを検索します\nhome_clickOnUserInListToRead=ユーザーをクリックするとそのユーザーが表示されます\nhome_editAndDeleteUser=一覧のユーザーをクリックしてからそのユーザーの編集または削除を行います\nhome_createGroup=新規グループの作成\nhome_listSearchGroups=左側パネルの一覧でシステムグループを検索します\nhome_clickOnGroupInListToRead=グループをクリックするとそのグループが表示されます\nhome_deleteGroup=一覧のグループをクリックしてからそのグループを削除します\nuserEditorWelcomeText=ユーザー管理画面へようこそ。この画面では次の操作を行うことができます。\ngroupEditorWelcomeText=グループ管理画面へようこそ。この画面では次の操作を行うことができます。\nshowUser=ユーザー {0} の表示\neditUser=ユーザー {0} の編集\nshowGroup=グループ {0} の表示\neditGroup=グループ {0} の編集\ncreateNewUser=新規ユーザーの作成\ncreateNewGroup=新規グループの作成\nshowRole=ロール {0} の表示\neditRole=ロール {0} の編集\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_pt_BR.properties",
    "content": "roles=Papéis\ngroups=Grupos\nusers=Usuários\nusersManagement=Gerenciamento de usuários\ngroupsManagement=Gerenciamento de grupos\nusersManagementHome=Página inicial de gerenciamento de usuários\nusersExplorer=Explorer de usuários\nuserEditor=Editor de usuário\ngroupsManagementHome=Página inicial de gerenciamento de grupos\ngroupsExplorer=Explorer de grupos\ngroupEditor=Editor de grupos\nhome_createUser=Criar novo usuário\nhome_listSearchUsers=Pesquise ou navegue através dos usuários do sistema na lista no painel à esquerda \nhome_clickOnUserInListToRead=Clique em um usuário na lista para visualizá-lo\nhome_editAndDeleteUser=Edite ou exclua um usuário clicando na lista \nhome_createGroup=Criar novo grupo\nhome_listSearchGroups=Pesquise ou navegue através dos grupos do sistema na lista no painel à esquerda \nhome_clickOnGroupInListToRead=Clique em um grupo na lista para visualizá-lo\nhome_deleteGroup=Exclua um grupo clicando nele na lista\nuserEditorWelcomeText=\\ Bem-vindo à tela de gerenciamento de usuários. Aqui você pode\\: \ngroupEditorWelcomeText=\\ Bem-vindo à tela de gerenciamento de grupos. Aqui você pode\\: \ncreateNewUser=Criar novo usuário\ncreateNewGroup=Criar novo grupo\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWorkbenchConstants_zh_CN.properties",
    "content": "roles=角色\ngroups=组\nusers=用户\nusersManagement=用户管理\ngroupsManagement=组管理\nusersManagementHome=用户管理首页\nusersExplorer=用户浏览器\nuserEditor=用户编辑器\ngroupsManagementHome=组管理首页\ngroupsExplorer=组浏览器\ngroupEditor=组编辑器\nhome_createUser=新建用户\nhome_listSearchUsers=在左侧面板列表中搜索或导航系统用户\nhome_clickOnUserInListToRead=点击该列表中的用户查看该用户\nhome_editAndDeleteUser=在列表中点击某个用户后编辑或删除该用户\nhome_createGroup=新建组\nhome_listSearchGroups=在左侧面板列表中搜索或导航系统组\nhome_clickOnGroupInListToRead=点击该列表中的组查看该组\nhome_deleteGroup=在列表中点击某个组后编辑或删除该组\nuserEditorWelcomeText=欢迎使用用户管理页面。在这里您可以：\ngroupEditorWelcomeText=欢迎使用组管理页面。在这里您可以：\ncreateNewUser=新建用户\ncreateNewGroup=新建组\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/test/java/org/uberfire/ext/security/management/client/perspectives/SecurityManagementPerspectiveTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.perspectives;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SecurityManagementPerspectiveTest {\n\n    private SecurityManagementPerspective perspective;\n\n    @Before\n    public void setup() {\n        perspective = spy(new SecurityManagementPerspective());\n        doNothing().when(perspective).configurePerspective(any(PlaceRequest.class));\n    }\n\n    @Test\n    public void getPerspectiveWithoutStartupTest() {\n        final PerspectiveDefinition perspectiveDefinition = perspective.getPerspective();\n\n        verify(perspective).createPerspectiveDefinition();\n        verify(perspective,\n               never()).configurePerspective(any(PlaceRequest.class));\n\n        assertNotNull(perspectiveDefinition);\n        assertNotNull(perspectiveDefinition.getName());\n    }\n\n    @Test\n    public void getPerspectiveWithStartupTest() {\n        this.perspective.onStartup(mock(PlaceRequest.class));\n\n        verify(perspective,\n               times(1)).createPerspectiveDefinition();\n        verify(perspective,\n               times(1)).configurePerspective(any(PlaceRequest.class));\n\n        final PerspectiveDefinition perspectiveDefinition = perspective.getPerspective();\n\n        verify(perspective,\n               times(1)).createPerspectiveDefinition();\n        verify(perspective,\n               times(1)).configurePerspective(any(PlaceRequest.class));\n\n        assertNotNull(perspectiveDefinition);\n        assertNotNull(perspectiveDefinition.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/test/java/org/uberfire/ext/security/management/client/screens/editor/GroupEditorScreenTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.GroupEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow.GroupCreationWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow.GroupEditorWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GroupEditorScreenTest {\n\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    EventSourceMock<ChangeTitleWidgetEvent> changeTitleNotification;\n    @Mock\n    ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    BaseScreen baseScreen;\n    @Mock\n    ClientUserSystemManager clientUserSystemManager;\n    @Mock\n    GroupEditorWorkflow groupEditorWorkflow;\n    @Mock\n    GroupCreationWorkflow groupCreationWorkflow;\n    @Mock\n    GroupEditor groupEditor;\n    @InjectMocks\n    GroupEditorScreen tested;\n\n    @Before\n    public void setup() {\n        when(clientUserSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n    }\n\n    @Test\n    public void testOnStartupAddingGroup() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(GroupEditorScreen.ADD_GROUP,\n                                       \"false\")).thenReturn(\"true\");\n        tested.onStartup(placeRequest);\n        verify(baseScreen,\n               times(1)).init(groupCreationWorkflow);\n        verify(groupCreationWorkflow,\n               times(1)).create();\n    }\n\n    @Test\n    public void testOnStartupShowingUser() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(GroupEditorScreen.ADD_GROUP,\n                                       \"false\")).thenReturn(\"false\");\n        when(placeRequest.getParameter(eq(GroupEditorScreen.GROUP_NAME),\n                                       isNull(String.class))).thenReturn(\"group1\");\n        tested.onStartup(placeRequest);\n        verify(baseScreen,\n               times(1)).init(groupEditorWorkflow);\n        verify(groupEditorWorkflow,\n               times(1)).show(\"group1\");\n    }\n\n    @Test\n    public void testOnMayCloseSuccess() {\n        when(groupEditorWorkflow.isDirty()).thenReturn(false);\n        assertTrue(tested.onMayClose());\n    }\n\n    @Test\n    public void testOnMayCloseFailed() {\n        when(groupEditorWorkflow.isDirty()).thenReturn(true);\n        assertFalse(tested.onMayClose());\n    }\n\n    @Test\n    public void testOnClose() {\n        tested.groupName = \"group1\";\n        tested.onClose();\n        assertNull(tested.groupName);\n        verify(groupEditorWorkflow,\n               times(1)).clear();\n        verify(groupCreationWorkflow,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testShowError() {\n        tested.showError(\"error\");\n        verify(errorPopupPresenter,\n               times(1)).showMessage(\"error\");\n    }\n\n    @Test\n    public void testOnGroupDeleted() {\n        final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class);\n        when(deleteGroupEvent.getName()).thenReturn(\"group1\");\n        tested.groupName = \"group1\";\n        tested.onGroupDeleted(deleteGroupEvent);\n        verify(placeManager,\n               times(1)).closePlace(Mockito.<PlaceRequest>any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/test/java/org/uberfire/ext/security/management/client/screens/editor/RoleEditorScreenTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.role.workflow.RoleEditorWorkflow;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RoleEditorScreenTest {\n\n    @Mock\n    ClientUserSystemManager clientUserSystemManager;\n\n    @Mock\n    RoleEditorWorkflow roleEditorWorkflow;\n\n    @InjectMocks\n    RoleEditorScreen tested;\n\n    @Before\n    public void setup() {\n        when(clientUserSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n    }\n\n    @Test\n    public void testOnMayCloseSuccess() {\n        when(roleEditorWorkflow.isDirty()).thenReturn(false);\n        assertTrue(tested.onMayClose());\n    }\n\n    @Test\n    public void testOnMayCloseFailed() {\n        when(roleEditorWorkflow.isDirty()).thenReturn(true);\n        assertFalse(tested.onMayClose());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/test/java/org/uberfire/ext/security/management/client/screens/editor/UserEditorScreenTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.screens.BaseScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow.UserCreationWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow.UserEditorWorkflow;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserEditorScreenTest {\n\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    EventSourceMock<ChangeTitleWidgetEvent> changeTitleNotification;\n    @Mock\n    ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    BaseScreen baseScreen;\n    @Mock\n    ClientUserSystemManager clientUserSystemManager;\n    @Mock\n    UserEditorWorkflow userEditorWorkflow;\n    @Mock\n    UserCreationWorkflow userCreationWorkflow;\n    @Mock\n    UserEditor userEditor;\n    @InjectMocks\n    UserEditorScreen tested;\n    @Mock\n    User user;\n\n    @Before\n    public void setup() {\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(clientUserSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        when(userEditorWorkflow.getUserEditor()).thenReturn(userEditor);\n    }\n\n    @Test\n    public void testOnStartupAddingUser() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(UserEditorScreen.ADD_USER,\n                                       \"false\")).thenReturn(\"true\");\n        tested.onStartup(placeRequest);\n        verify(baseScreen,\n               times(1)).init(userCreationWorkflow);\n        verify(userCreationWorkflow,\n               times(1)).create();\n    }\n\n    @Test\n    public void testOnStartupShowingUser() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(UserEditorScreen.ADD_USER,\n                                       \"false\")).thenReturn(\"false\");\n        when(placeRequest.getParameter(eq(UserEditorScreen.USER_ID),\n                                       isNull(String.class))).thenReturn(\"user1\");\n        tested.onStartup(placeRequest);\n        verify(baseScreen,\n               times(1)).init(userEditorWorkflow);\n        verify(userEditorWorkflow,\n               times(1)).show(\"user1\");\n    }\n\n    @Test\n    public void testOnMayCloseSuccess() {\n        when(userEditorWorkflow.isDirty()).thenReturn(false);\n        when(userCreationWorkflow.isDirty()).thenReturn(false);\n        assertTrue(tested.onMayClose());\n    }\n\n    @Test\n    public void testOnMayCloseFailed() {\n        when(userEditorWorkflow.isDirty()).thenReturn(true);\n        when(userCreationWorkflow.isDirty()).thenReturn(true);\n        assertFalse(tested.onMayClose());\n        when(userEditorWorkflow.isDirty()).thenReturn(false);\n        when(userCreationWorkflow.isDirty()).thenReturn(true);\n        assertFalse(tested.onMayClose());\n        when(userEditorWorkflow.isDirty()).thenReturn(true);\n        when(userCreationWorkflow.isDirty()).thenReturn(false);\n        assertFalse(tested.onMayClose());\n    }\n\n    @Test\n    public void testOnClose() {\n        tested.userId = \"user1\";\n        tested.onClose();\n        assertNull(tested.userId);\n        verify(userEditorWorkflow,\n               times(1)).clear();\n        verify(userCreationWorkflow,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testShowError() {\n        tested.showError(\"error\");\n        verify(errorPopupPresenter,\n               times(1)).showMessage(\"error\");\n    }\n\n    @Test\n    public void testOnEditUserEvent() {\n        final OnEditEvent onEditEvent = mock(OnEditEvent.class);\n        when(onEditEvent.getContext()).thenReturn(userEditor);\n        when(onEditEvent.getInstance()).thenReturn(user);\n        tested.onEditUserEvent(onEditEvent);\n        verify(changeTitleNotification,\n               times(1)).fire(any(ChangeTitleWidgetEvent.class));\n    }\n\n    @Test\n    public void testOnShowUserEvent() {\n        final OnShowEvent onShowEvent = mock(OnShowEvent.class);\n        when(onShowEvent.getContext()).thenReturn(userEditor);\n        when(onShowEvent.getInstance()).thenReturn(user);\n        tested.onShowUserEvent(onShowEvent);\n        verify(changeTitleNotification,\n               times(1)).fire(any(ChangeTitleWidgetEvent.class));\n    }\n\n    @Test\n    public void testOnUserDeleted() {\n        final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class);\n        when(deleteUserEvent.getIdentifier()).thenReturn(\"user1\");\n        tested.userId = \"user1\";\n        tested.onUserDeleted(deleteUserEvent);\n        verify(placeManager,\n               times(1)).closePlace(Mockito.<PlaceRequest>any());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-client-wb/src/test/java/org/uberfire/ext/security/management/client/screens/explorer/SecurityExplorerScreenTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.screens.explorer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.client.ClientSecurityExceptionMessageResolver;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.screens.editor.GroupEditorScreen;\nimport org.uberfire.ext.security.management.client.screens.editor.RoleEditorScreen;\nimport org.uberfire.ext.security.management.client.screens.editor.UserEditorScreen;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.GroupsExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.RolesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.UsersExplorer;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SecurityExplorerScreenTest {\n\n    @Mock\n    private SecurityExplorerScreen.View view;\n    @Mock\n    private RolesExplorer rolesExplorer;\n    @Mock\n    private GroupsExplorer groupsExplorer;\n    @Mock\n    private UsersExplorer usersExplorer;\n    @Mock\n    private ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    private PlaceManager placeManager;\n    @Mock\n    private ClientUserSystemManager userSystemManager;\n\n    private SecurityExplorerScreen tested;\n\n    @Before\n    public void setup() {\n        doAnswer(invocationOnMock -> {\n            ((Command) invocationOnMock.getArguments()[0]).execute();\n            return null;\n        }).when(userSystemManager).waitForInitialization(any(Command.class));\n        when(userSystemManager.isActive()).thenReturn(true);\n        this.tested = new SecurityExplorerScreen(view,\n                                                 rolesExplorer,\n                                                 groupsExplorer,\n                                                 usersExplorer,\n                                                 errorPopupPresenter,\n                                                 placeManager,\n                                                 userSystemManager,\n                                                 new ClientSecurityExceptionMessageResolver());\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(view,\n               times(1)).init(eq(tested),\n                              eq(rolesExplorer),\n                              eq(groupsExplorer),\n                              eq(usersExplorer));\n        verify(rolesExplorer,\n               times(1)).show();\n        verify(view,\n               times(1)).rolesEnabled(eq(true));\n        verify(view,\n               times(1)).groupsEnabled(eq(false));\n        verify(view,\n               times(1)).usersEnabled(eq(false));\n    }\n\n    @Test\n    public void testOnStartupUsersTab() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(eq(SecurityExplorerScreen.ACTIVE_TAB),\n                                       anyString())).thenReturn(SecurityExplorerScreen.USERS_TAB);\n        tested.onStartup(placeRequest);\n        verify(usersExplorer,\n               times(1)).show();\n        verify(groupsExplorer,\n               times(1)).show();\n        verify(view,\n               times(1)).groupsEnabled(eq(true));\n        verify(view,\n               times(1)).usersEnabled(eq(true));\n        verify(view,\n               times(1)).rolesActive(eq(false));\n        verify(view,\n               times(1)).groupsActive(eq(false));\n        verify(view,\n               times(1)).usersActive(eq(true));\n    }\n\n    @Test\n    public void testOnStartupGroupsTab() {\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n        when(placeRequest.getParameter(eq(SecurityExplorerScreen.ACTIVE_TAB),\n                                       anyString())).thenReturn(SecurityExplorerScreen.GROUPS_TAB);\n        tested.onStartup(placeRequest);\n        verify(usersExplorer,\n               times(1)).show();\n        verify(groupsExplorer,\n               times(1)).show();\n        verify(view,\n               times(1)).groupsEnabled(eq(true));\n        verify(view,\n               times(1)).usersEnabled(eq(true));\n        verify(view,\n               times(1)).rolesActive(eq(false));\n        verify(view,\n               times(1)).usersActive(eq(false));\n        verify(view,\n               times(1)).groupsActive(eq(true));\n    }\n\n    @Test\n    public void testOnClose() {\n        tested.onClose();\n        verify(usersExplorer,\n               times(1)).clear();\n        verify(groupsExplorer,\n               times(1)).clear();\n        verify(rolesExplorer,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testOnRoleRead() {\n        final ReadRoleEvent event = mock(ReadRoleEvent.class);\n        when(event.getName()).thenReturn(\"someRoleName\");\n        final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor =\n                ArgumentCaptor.forClass(DefaultPlaceRequest.class);\n        tested.onRoleRead(event);\n        verify(placeManager,\n               times(1)).goTo(placeRequestArgumentCaptor.capture());\n        final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(RoleEditorScreen.SCREEN_ID,\n                     placeRequest.getIdentifier());\n        assertEquals(\"someRoleName\",\n                     placeRequest.getParameters().get(RoleEditorScreen.ROLE_NAME));\n    }\n\n    @Test\n    public void testOnGroupRead() {\n        final ReadGroupEvent event = mock(ReadGroupEvent.class);\n        when(event.getName()).thenReturn(\"someGroupName\");\n        final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor =\n                ArgumentCaptor.forClass(DefaultPlaceRequest.class);\n        tested.onGroupRead(event);\n        verify(placeManager,\n               times(1)).goTo(placeRequestArgumentCaptor.capture());\n        final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(GroupEditorScreen.SCREEN_ID,\n                     placeRequest.getIdentifier());\n        assertEquals(\"someGroupName\",\n                     placeRequest.getParameters().get(GroupEditorScreen.GROUP_NAME));\n        assertFalse(placeRequest.getParameters().containsKey(GroupEditorScreen.ADD_GROUP));\n    }\n\n    @Test\n    public void testOnUserRead() {\n        final ReadUserEvent event = mock(ReadUserEvent.class);\n        when(event.getIdentifier()).thenReturn(\"someUserId\");\n        final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor =\n                ArgumentCaptor.forClass(DefaultPlaceRequest.class);\n        tested.onUserRead(event);\n        verify(placeManager,\n               times(1)).goTo(placeRequestArgumentCaptor.capture());\n        final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(UserEditorScreen.SCREEN_ID,\n                     placeRequest.getIdentifier());\n        assertEquals(\"someUserId\",\n                     placeRequest.getParameters().get(UserEditorScreen.USER_ID));\n        assertFalse(placeRequest.getParameters().containsKey(UserEditorScreen.ADD_USER));\n    }\n\n    @Test\n    public void testOnGroupCreate() {\n        final NewGroupEvent event = mock(NewGroupEvent.class);\n        final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor =\n                ArgumentCaptor.forClass(DefaultPlaceRequest.class);\n        tested.onGroupCreate(event);\n        verify(placeManager,\n               times(1)).goTo(placeRequestArgumentCaptor.capture());\n        final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(GroupEditorScreen.SCREEN_ID,\n                     placeRequest.getIdentifier());\n        assertTrue(Boolean.parseBoolean(placeRequest.getParameters().get(GroupEditorScreen.ADD_GROUP)));\n        assertFalse(placeRequest.getParameters().containsKey(GroupEditorScreen.GROUP_NAME));\n    }\n\n    @Test\n    public void testOnUserCreate() {\n        final NewUserEvent event = mock(NewUserEvent.class);\n        final ArgumentCaptor<DefaultPlaceRequest> placeRequestArgumentCaptor =\n                ArgumentCaptor.forClass(DefaultPlaceRequest.class);\n        tested.onUserCreate(event);\n        verify(placeManager,\n               times(1)).goTo(placeRequestArgumentCaptor.capture());\n        final DefaultPlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(UserEditorScreen.SCREEN_ID,\n                     placeRequest.getIdentifier());\n        assertTrue(Boolean.parseBoolean(placeRequest.getParameters().get(UserEditorScreen.ADD_USER)));\n        assertFalse(placeRequest.getParameters().containsKey(UserEditorScreen.USER_ID));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/README.md",
    "content": "KeyCloak provider for user and group management services\n==========================================================\n\nIntroduction\n------------\nThe classes in this package contain the user and group manager provider implementation for JBoss KeyCloak.              \n\nThere are two implementation for this provider:           \n\n**Based on username/password credentials**                \n\nRelies on being username & password credentials in the `security-management.properties` file.         \n\nIt's provided by the service `KCCredentialsUserManagementService`.                 \n\n**Based on Keycloak Client Adapter integration (SSO)**              \n\nRelies on considering that the application resides on an application server where any of the KC client adapters has been \ninstalled and setup, so the KeyCloak security context is available on the environment.                  \n\nIt's provided by the service `KCAdapterUserManagementService`.                 \n\nImportant considerations about the SSO provider implementation:                \n* Only use this provider implementation if any of the KC client adapters is installed and setup on the application server. Usually this happens when integration with Keycloak SSO.                              \n* It uses the current access token present in session, so ensure the current user logged has the `realm-management` client role assigned on Keycloak side,\n in order to manage the realm on Keycloak                   \n\nInstallation notes\n------------------\n\nStep 1 - Dependencies\n---------------------\n\nThe users and groups management provider for Keycloak, either the username/password credentials and the KC Client Adapter based implementation, \nuses a custom RestEasy client that consumes the Keycloak remote admin services.                     \n\nSo the following JAXRS, RestEasy and Keycloak dependencies must be present in the application's classpath:                          \n\n        <dependency>\n          <groupId>org.keycloak</groupId>\n          <artifactId>keycloak-core</artifactId>\n          <version>...</version>\n        </dependency>\n        \n       <dependency>\n         <groupId>org.jboss.resteasy</groupId>\n         <artifactId>resteasy-jaxrs</artifactId>\n         <version>...</version>\n         <version>\n       </dependency>\n   \n       <dependency>\n         <groupId>org.jboss.resteasy</groupId>\n         <artifactId>resteasy-jackson-provider</artifactId>\n         <version>...</version>\n       </dependency>\n\nRun the following command in order to figure out the versions to use for each of the above artifacts:\n\n    mvn dependency:list\n\nStep 2 - Provider settings\n--------------------------\n\nNOTE: If the workbench's user system manager feature is not configured for the distribution you are using, please take a look at the [Workbench installation instructions](../uberfire-security-management-client-wb/README.md).                        \n\nOnce dependencies have been specified as above, let's configure the Keycloak provider. To do it, please choose one of the following options:               \n\n**Using the credentials provider**                   \n\na) Specify the concrete provider to use by setting the Java system property below or by adding a properties file named `security-management.properties` in your web application root classpath\n(e.g. `src/main/resources/security-management.properties`), with the following keys and your concrete provider name as value:                               \n\n    org.uberfire.ext.security.management.api.userManagementServices=KCCredentialsUserManagementService\n\nb) Specify the following Java system properties at container startup:        \n\n    -Dorg.uberfire.ext.security.management.api.userManagementServices=KCCredentialsUserManagementService\n\nThe following properties are required to be present at startup either at the `security-management.properties` or as Java system properties:                 \n\n* `org.uberfire.ext.security.management.keycloak.authServer` - The URL for the KeyCloak authentication server. Property is mandatory. Defaults to: `http://localhost:8080/auth`.                  \n* `org.uberfire.ext.security.management.keycloak.realm` - The name of the realm to use. Property is mandatory. Defaults to `example`.                   \n* `org.uberfire.ext.security.management.keycloak.user` - The username. Property is mandatory. Defaults to `examples-admin-client`.                      \n* `org.uberfire.ext.security.management.keycloak.password` - The password. Property is mandatory. Defaults to `password`.                             \n* `org.uberfire.ext.security.management.keycloak.clientId` - The client identifier for the admin connection. Property is mandatory. Defaults to `examples-admin-client`.                                        \n* `org.uberfire.ext.security.management.keycloak.clientSecret` - The client password for the admin connection. Property is mandatory. Defaults to `password`.                  \n\nExample of the contents for the `security-management.properties`:                      \n\n    org.uberfire.ext.security.management.api.userManagementServices=KCCredentialsUserManagementService\n    org.uberfire.ext.security.management.keycloak.authServer=http://localhost:8080/auth\n    org.uberfire.ext.security.management.keycloak.realm=demo\n    org.uberfire.ext.security.management.keycloak.user=admin\n    org.uberfire.ext.security.management.keycloak.password=password\n    org.uberfire.ext.security.management.keycloak.clientId=kie\n    org.uberfire.ext.security.management.keycloak.clientSecret=925f9190-a7c1-4cfd-8a3c-004f9c73dae6\n    \n**Using the KC adapter provider**                   \n\nImportant considerations about the SSO provider implementation:                \n* Only use this provider implementation if any of the KC client adapters is installed and setup on the application server. Usually this happens when integration with Keycloak SSO.                              \n* It uses the current access token present in session, so ensure the current user logged has the `realm-management` client role assigned in order to manage the realm on Keycloak                   \n\na) Specify the concrete provider to use by adding a properties file named `security-management.properties` in your web application root classpath. \n(e.g. `src/main/resources/security-management.properties`), with the following keys and your concrete provider name as value:                               \n\n    org.uberfire.ext.security.management.api.userManagementServices=KCAdapterUserManagementService\n\n\nb) Specify the following Java system properties at container startup:        \n\n    -Dorg.uberfire.ext.security.management.api.userManagementServices=KCAdapterUserManagementService\n\nThe following property is required to be present at startup either at the `security-management.properties` or as Java system properties:                 \n\n* `org.uberfire.ext.security.management.keycloak.authServer` - The URL for the KeyCloak authentication server. Property is mandatory. Defaults to: `http://localhost:8080/auth`.                  \n* No more configurations required. The rest of settings are provided by the current access token in session.                \n\nExample of the contents for the `security-management.properties`:                      \n    \n    org.uberfire.ext.security.management.api.userManagementServices=KCAdapterUserManagementService\n    org.uberfire.ext.security.management.keycloak.authServer=http://localhost:8080/auth\n\n\nInstallation on an existing WAR file\n------------------------------------\n\nFollow these steps in order to update or enable the Keycloak users and group management provider in an Uberfire based packaged application (WAR file):                       \n\n1.- Ensure the following libraries on `WEB-INF/lib`                \n\n* Add if no present the uberfire-security-management-api-X.Y.Z.jar                             \n* Add if no present the uberfire-security-management-backend-X.Y.Z.jar                             \n* Add if no present the uberfire-security-management-keycloak-X.Y.Z.jar                             \n* Add keycloak-core-X.Y.Z.Final.jar\n* Add keycloak-common-X.Y.Z.Final.jar\n* Remove any existing provider implementation, if any (ex: uberfire-security-management-wildfly-X.Y.Z.jar, etc)                   \n\n2.- Replace the whole content for file `WEB-INF/classes/security-management.properties`, if not present, create it:                    \n\n    # Using the Keycloak Credential provider\n    org.uberfire.ext.security.management.api.userManagementServices=KCCredentialsUserManagementService\n    org.uberfire.ext.security.management.keycloak.authServer=http://localhost:8080/auth\n    org.uberfire.ext.security.management.keycloak.realm=demo\n    org.uberfire.ext.security.management.keycloak.user=admin\n    org.uberfire.ext.security.management.keycloak.password=password\n    org.uberfire.ext.security.management.keycloak.clientId=kie\n    org.uberfire.ext.security.management.keycloak.clientSecret=password\n\n    # Using the Keycloak Adapter provider\n    org.uberfire.ext.security.management.api.userManagementServices=KCAdapterUserManagementService\n    org.uberfire.ext.security.management.keycloak.authServer=http://localhost:8080/auth\n\nNote: Use the concrete values for your environment.           \n\n3.- Ensure on file `/META-INF/jboss-deployment-structure.xml`:\n\n* Dependency to `org.jboss.resteasy.resteasy-jackson-provider` module          \n     \n        <dependencies>\n            ...\n            <module name=\"org.jboss.resteasy.resteasy-jackson-provider\" services=\"import\"/>\n            ...\n        </dependencies>\n     \n* If deploying into Wildfly 8.2 or newer, add exclusion to `org.jboss.resteasy.resteasy-jackson2-provider` module               \n\n        <exclusions>\n            ...\n            <module name=\"org.jboss.resteasy.resteasy-jackson2-provider\"/>\n            ...\n        </exclusions>\n\n\nProvider capabilities\n---------------------\nThe KeyCloak provider for users and groups management services provides the following features:                   \n\n**User service capabilities**\n* User search - Can search or list users. Search is delegated to keycloak, so it search for different user attributes as username, first name, etc.         \n* Read user - Can read a user            \n* Create user - Can add new users            \n* Update user - Can update a user            \n* Delete user - Can delete a user            \n* User attributes - Can manage user attributes            \n* Group assignment - Can manage groups for a user            \n* Role assignment - Can manage roles for a user            \n* Change password - Can change user's password            \n\n**Group service capabilities**\n* Group search - Can search or list groups. Search by `name` attribute.             \n* Read group - Can read a group            \n* Create group - Can add new groups            \n* Delete group - Can delete a group            \n\nNotes\n-----\n* Java8+                   \n* This implementation has been tested for a KeyCloak version `3.4.0.Final`                \n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-keycloak</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Security Management - Provider Implementation for KeyCloak</name>\n  <description>Uberfire Security Management - Provider Implementation for KeyCloak</description>\n\n  <dependencies>\n\n    <!-- Uberfire related. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.xml.bind</groupId>\n      <artifactId>jakarta.xml.bind-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-jaxrs</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-jackson-provider</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.codehaus.jackson</groupId>\n      <artifactId>jackson-core-asl</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.keycloak</groupId>\n      <artifactId>keycloak-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.keycloak</groupId>\n      <artifactId>keycloak-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.keycloak</groupId>\n      <artifactId>keycloak-adapter-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>jcl-over-slf4j</artifactId>\n    </dependency>\n\n    <!-- Test scope. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.wildfly.security</groupId>\n      <artifactId>wildfly-elytron</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/BaseClientFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport org.uberfire.ext.security.management.keycloak.client.ClientFactory;\nimport org.uberfire.ext.security.management.keycloak.client.Keycloak;\n\n/**\n * Base client factory that provides the client instance..\n * @since 0.9.0\n */\npublic abstract class BaseClientFactory implements ClientFactory {\n\n    protected static final String DEFAULT_AUTH_SERVER = \"http://localhost:8080/auth\";\n    protected Keycloak client;\n\n    @Override\n    public Keycloak get() {\n        assert client != null;\n        return client;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/BaseKeyCloakManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.jboss.resteasy.client.ClientResponseFailure;\nimport org.jboss.resteasy.spi.NotFoundException;\nimport org.keycloak.representations.idm.ClientRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.kie.soup.commons.util.Maps;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.exception.ClientNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.OperationFailedException;\nimport org.uberfire.ext.security.management.api.exception.RealmManagementNotAuthorizedException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\nimport org.uberfire.ext.security.management.impl.UserAttributeImpl;\nimport org.uberfire.ext.security.management.keycloak.client.ClientFactory;\nimport org.uberfire.ext.security.management.keycloak.client.Keycloak;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleMappingResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleScopeResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RolesResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UsersResource;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\npublic abstract class BaseKeyCloakManager {\n\n    static final int STATUS_NOT_AUTHORIZED = 403;\n\n    protected static final String ATTRIBUTE_USER_ID = \"user.id\";\n    protected static final String ATTRIBUTE_USER_FIRST_NAME = \"user.firstName\";\n    protected static final String ATTRIBUTE_USER_LAST_NAME = \"user.lastName\";\n    protected static final String ATTRIBUTE_USER_ENABLED = \"user.enabled\";\n    protected static final String ATTRIBUTE_USER_EMAIL = \"user.email\";\n    protected static final String ATTRIBUTE_USER_EMAIL_VERIFIED = \"user.isEmailVerified\";\n    protected static final UserManager.UserAttribute USER_ID = new UserAttributeImpl(ATTRIBUTE_USER_ID,\n                                                                                     true,\n                                                                                     false,\n                                                                                     null);\n    protected static final UserManager.UserAttribute USER_FIST_NAME = new UserAttributeImpl(ATTRIBUTE_USER_FIRST_NAME,\n                                                                                            true,\n                                                                                            true,\n                                                                                            \"First name\");\n    protected static final UserManager.UserAttribute USER_LAST_NAME = new UserAttributeImpl(ATTRIBUTE_USER_LAST_NAME,\n                                                                                            true,\n                                                                                            true,\n                                                                                            \"Last name\");\n    protected static final UserManager.UserAttribute USER_ENABLED = new UserAttributeImpl(ATTRIBUTE_USER_ENABLED,\n                                                                                          true,\n                                                                                          true,\n                                                                                          \"true\");\n    protected static final UserManager.UserAttribute USER_EMAIL = new UserAttributeImpl(ATTRIBUTE_USER_EMAIL,\n                                                                                        false,\n                                                                                        true,\n                                                                                        \"\");\n    protected static final UserManager.UserAttribute USER_EMAIL_VERIFIED = new UserAttributeImpl(ATTRIBUTE_USER_EMAIL_VERIFIED,\n                                                                                                 false,\n                                                                                                 true,\n                                                                                                 \"false\");\n    protected static final Collection<UserManager.UserAttribute> USER_ATTRIBUTES =\n            Arrays.asList(USER_ID,\n                          USER_FIST_NAME,\n                          USER_LAST_NAME,\n                          USER_ENABLED,\n                          USER_EMAIL,\n                          USER_EMAIL_VERIFIED);\n    private static final Logger LOG = LoggerFactory.getLogger(BaseKeyCloakManager.class);\n    protected ClientFactory factory;\n\n    protected void init(ClientFactory factory) {\n        this.factory = factory;\n    }\n\n    protected synchronized Keycloak getKeyCloakInstance() {\n        return factory.get();\n    }\n\n    protected void consumeRealm(final Consumer<RealmResource> consumer) {\n        try {\n            consumer.accept(getRealmResource());\n        } catch (ClientResponseFailure e) {\n            if (STATUS_NOT_AUTHORIZED == e.getResponse().getResponseStatus().getStatusCode()) {\n                throw new RealmManagementNotAuthorizedException(getKeyCloakInstance().getRealm());\n            } else {\n                throw new SecurityManagementException(e);\n            }\n        }\n    }\n\n    private RealmResource getRealmResource() {\n        return getKeyCloakInstance().realm();\n    }\n\n    protected AbstractEntityManager.SearchRequest getSearchRequest(final AbstractEntityManager.SearchRequest request) {\n        return request != null ? request : new SearchRequestImpl();\n    }\n\n    protected User createUser(UserRepresentation userRepresentation) {\n        return createUser(userRepresentation,\n                          null,\n                          null);\n    }\n\n    protected User createUser(UserRepresentation userRepresentation,\n                              Set<Group> groups,\n                              Set<Role> roles) {\n        if (userRepresentation != null) {\n            String username = userRepresentation.getUsername();\n            final User user = SecurityManagementUtils.createUser(username,\n                                                                 groups,\n                                                                 roles);\n            fillUserAttributes(user,\n                               userRepresentation);\n            return user;\n        }\n        return null;\n    }\n\n    protected Group createGroup(RoleRepresentation roleRepresentation) {\n        if (roleRepresentation != null) {\n            String name = roleRepresentation.getName();\n            final Group group = createGroup(name);\n            return group;\n        }\n        return null;\n    }\n\n    protected Group createGroup(String name) {\n        if (name != null) {\n            final Group group = SecurityManagementUtils.createGroup(name);\n            return group;\n        }\n        return null;\n    }\n\n    protected Set[] getUserGroupsAndRoles(final RoleMappingResource roleMappingResource) {\n        if (roleMappingResource != null) {\n            List<RoleRepresentation> roles;\n            roles = getRolesScopeResource(roleMappingResource, getKeyCloakInstance().getUseRoleResourceMappings()).listEffective();\n            if (roles != null && !roles.isEmpty()) {\n                final Set<Group> _groups = new HashSet<Group>();\n                final Set<Role> _roles = new HashSet<Role>();\n                final Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames();\n                for (RoleRepresentation roleRepresentation : roles) {\n                    if (roleRepresentation != null) {\n                        String name = roleRepresentation.getName();\n                        SecurityManagementUtils.populateGroupOrRoles(name,\n                                                                     registeredRoles,\n                                                                     _groups,\n                                                                     _roles);\n                    }\n                }\n                return new Set[]{_groups, _roles};\n            }\n        }\n        return null;\n    }\n\n    protected void fillUserAttributes(final User user,\n                                      final UserRepresentation userRepresentation) {\n        final String userId = userRepresentation.getId();\n        final String firstName = userRepresentation.getFirstName();\n        final String lastName = userRepresentation.getLastName();\n        final String email = userRepresentation.getEmail();\n        final boolean isEmailVerified = userRepresentation.isEmailVerified();\n        final boolean isEnabled = userRepresentation.isEnabled();\n        user.setProperty(ATTRIBUTE_USER_ID,\n                         userId);\n        user.setProperty(ATTRIBUTE_USER_FIRST_NAME,\n                         firstName);\n        user.setProperty(ATTRIBUTE_USER_LAST_NAME,\n                         lastName);\n        user.setProperty(ATTRIBUTE_USER_EMAIL,\n                         email);\n        user.setProperty(ATTRIBUTE_USER_EMAIL_VERIFIED,\n                         Boolean.toString(isEmailVerified));\n        user.setProperty(ATTRIBUTE_USER_ENABLED,\n                         Boolean.toString(isEnabled));\n        final Map<String, List<String>> attrs = userRepresentation.getAttributes();\n        if (attrs != null && !attrs.isEmpty()) {\n            for (final Map.Entry<String, List<String>> entry : attrs.entrySet()) {\n                final String v = entry.getValue() != null ? String.join(\", \", entry.getValue()) : null;\n                user.setProperty(entry.getKey(), v);\n            }\n        }\n    }\n\n    protected void fillUserRepresentationAttributes(final User user,\n                                                    final UserRepresentation userRepresentation) {\n        String username = user.getIdentifier();\n        userRepresentation.setUsername(username);\n        Map<String, String> props = user.getProperties();\n        if (props != null && !props.isEmpty()) {\n            for (Map.Entry<String, String> entry : props.entrySet()) {\n                final String key = entry.getKey();\n                final String value = entry.getValue();\n                if (ATTRIBUTE_USER_ID.equals(key)) {\n                    userRepresentation.setId(value);\n                } else if (ATTRIBUTE_USER_FIRST_NAME.equals(key)) {\n                    userRepresentation.setFirstName(value);\n                } else if (ATTRIBUTE_USER_LAST_NAME.equals(key)) {\n                    userRepresentation.setLastName(value);\n                } else if (ATTRIBUTE_USER_EMAIL.equals(key)) {\n                    userRepresentation.setEmail(value);\n                } else if (ATTRIBUTE_USER_EMAIL_VERIFIED.equals(key)) {\n                    userRepresentation.setEmailVerified(Boolean.valueOf(value));\n                } else if (ATTRIBUTE_USER_ENABLED.equals(key)) {\n                    userRepresentation.setEnabled(Boolean.valueOf(value));\n                } else {\n                    userRepresentation.singleAttribute(key,\n                                                       value);\n                }\n            }\n        }\n        List<String> keycloakRoles = new ArrayList<>();\n\n        for (Group group : user.getGroups()) {\n            keycloakRoles.add(group.getName());\n        }\n\n        for (Role role : user.getRoles()) {\n            keycloakRoles.add(role.getName());\n        }\n\n        if (getKeyCloakInstance().getUseRoleResourceMappings()) {\n            userRepresentation.setClientRoles(new Maps.Builder().put(getKeyCloakInstance().getResource(), keycloakRoles).build());\n        } else {\n            userRepresentation.setRealmRoles(keycloakRoles);\n        }\n    }\n\n    protected UserResource getUserResource(UsersResource usersResource,\n                                           String username) {\n        List<UserRepresentation> userRepresentations = usersResource.search(username,\n                                                                            null,\n                                                                            null,\n                                                                            null,\n                                                                            0,\n                                                                            1);\n        if (userRepresentations == null || userRepresentations.isEmpty()) {\n            throw new UserNotFoundException(username);\n        }\n        String id = userRepresentations.get(0).getId();\n        return usersResource.get(id);\n    }\n\n    protected RoleRepresentation getRoleRepresentation(String name,\n                                                       RoleResource roleResource) {\n        if (roleResource != null) {\n            try {\n                return roleResource.toRepresentation();\n            } catch (NotFoundException e) {\n                throw new GroupNotFoundException(name);\n            } catch (ClientResponseFailure clientResponseFailure) {\n                int status = clientResponseFailure.getResponse().getResponseStatus().getStatusCode();\n                if (404 == status) {\n                    throw new GroupNotFoundException(name);\n                }\n            } catch (Exception e) {\n                throw new SecurityManagementException(e);\n            }\n        }\n        throw new GroupNotFoundException(name);\n    }\n\n    protected void handleResponse(ClientResponse response) {\n        if (response != null) {\n            int status = response.getStatus();\n            response.releaseConnection();\n\n            if (status >= 400) {\n                throw new OperationFailedException(status,\n                                                   \"Operation failed. See server log messages.\");\n            }\n        }\n    }\n\n    protected RolesResource getRolesResource(RealmResource realmResource, boolean useClientRoles) {\n        if (useClientRoles) {\n            return realmResource.clients().get(getClientIdByName(realmResource)).roles();\n        }\n        return realmResource.roles();\n    }\n\n    protected RoleScopeResource getRolesScopeResource(RoleMappingResource roleMappingResource, boolean useClientRoles) {\n        if (useClientRoles) {\n            return roleMappingResource.clientLevel(getClientIdByName(getRealmResource()));\n        }\n            return roleMappingResource.realmLevel();\n    }\n\n    protected String getClientIdByName(RealmResource realmResource) {\n        List<ClientRepresentation> clientResource = realmResource.clients().findByClientId(getKeyCloakInstance().getResource());\n        if (!clientResource.isEmpty()) {\n            return clientResource.get(0).getId();\n        }\n        throw new ClientNotFoundException(getKeyCloakInstance().getResource());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/CredentialsClientFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.keycloak.client.Keycloak;\nimport org.uberfire.ext.security.management.keycloak.client.auth.credentials.AuthSettings;\nimport org.uberfire.ext.security.management.keycloak.client.auth.credentials.AuthTokenManager;\n\n/**\n * Factory that creates Keycloak clients based on using Credentials authentication settings connection settings.\n *\n * @since 0.9.0\n */\n@Dependent\npublic class CredentialsClientFactory extends BaseClientFactory {\n\n    private static final String DEFAULT_REALM = \"example\";\n    private static final String DEFAULT_USER = \"examples-admin-client\";\n    private static final String DEFAULT_PASSWORD = \"\";\n    private static final String DEFAULT_CLIENT_ID = \"examples-admin-client\";\n    private static final String DEFAULT_CLIENT_SECRET = \"\";\n    private static final String DEFAULT_USE_RESOURCE_ROLE_MAPPING = \"false\";\n    private static final String DEFAULT_RESOURCE = \"kie\";\n\n    public void init(final ConfigProperties config) {\n        final ConfigProperties.ConfigProperty authServer = config.get(\"org.uberfire.ext.security.management.keycloak.authServer\",\n                                                                      DEFAULT_AUTH_SERVER);\n        final ConfigProperties.ConfigProperty realm = config.get(\"org.uberfire.ext.security.management.keycloak.realm\",\n                                                                 DEFAULT_REALM);\n        final ConfigProperties.ConfigProperty user = config.get(\"org.uberfire.ext.security.management.keycloak.user\",\n                                                                DEFAULT_USER);\n        final ConfigProperties.ConfigProperty password = config.get(\"org.uberfire.ext.security.management.keycloak.password\",\n                                                                    DEFAULT_PASSWORD);\n        final ConfigProperties.ConfigProperty clientId = config.get(\"org.uberfire.ext.security.management.keycloak.clientId\",\n                                                                    DEFAULT_CLIENT_ID);\n        final ConfigProperties.ConfigProperty clientSecret = config.get(\"org.uberfire.ext.security.management.keycloak.clientSecret\",\n                                                                        DEFAULT_CLIENT_SECRET);\n        final ConfigProperties.ConfigProperty useRoleResourceMappings = config.get(\"org.uberfire.ext.security.management.keycloak.use-resource-role-mappings\",\n                                                                                   DEFAULT_USE_RESOURCE_ROLE_MAPPING);\n        final ConfigProperties.ConfigProperty resource = config.get(\"org.uberfire.ext.security.management.keycloak.resource\",\n                                                                    DEFAULT_RESOURCE);\n\n        if (clientId.getValue().isEmpty() && clientSecret.getValue().isEmpty()) {\n            throw new IllegalArgumentException(\"Keycloack ID and client secret are unset.\");\n        }\n        this.client = Keycloak.getInstance(authServer.getValue(),\n                                           realm.getValue(),\n                                           resource.getValue(),\n                                           useRoleResourceMappings.getBooleanValue(),\n                                           new AuthTokenManager(new AuthSettings(authServer.getValue(),\n                                                                                 realm.getValue(),\n                                                                                 resource.getValue(),\n                                                                                 user.getValue(),\n                                                                                 password.getValue(),\n                                                                                 clientId.getValue(),\n                                                                                 clientSecret.getValue())));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/KCAdapterClientFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport javax.enterprise.context.Dependent;\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.keycloak.client.Keycloak;\nimport org.uberfire.ext.security.management.keycloak.client.auth.adapter.KCAdapterContextTokenManager;\n\n/**\n * Factory that build Keycloak clients using the current session access token provided by KC client adapter.\n * @since 0.9.0\n */\n@Dependent\npublic class KCAdapterClientFactory extends BaseClientFactory {\n\n    private Keycloak client;\n\n    @Override\n    public Keycloak get() {\n        assert client != null;\n        return client;\n    }\n\n    public void init(final ConfigProperties config,\n                     HttpServletRequest request) {\n\n        // Check mandatory properties.\n        final ConfigProperties.ConfigProperty authServer = config.get(\"org.uberfire.ext.security.management.keycloak.authServer\",\n                                                                      DEFAULT_AUTH_SERVER);\n        final ConfigProperties.ConfigProperty useRoleResourceMappings = config.get(\"org.uberfire.ext.security.management.keycloak.use-resource-role-mappings\",\n                                                                                   \"false\");\n\n        final KCAdapterContextTokenManager tokenManager = new KCAdapterContextTokenManager(request);\n        this.client = Keycloak.getInstance(authServer.getValue(),\n                                           tokenManager.getRealm(),\n                                           tokenManager.getResource(),\n                                           useRoleResourceMappings.getBooleanValue(),\n                                           tokenManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/KCAdapterUserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.UberfireRoleManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.service.AbstractUserManagementService;\n\n/**\n * <p>The KeyCloak management service beans to use if the KC client adapter is running on the application server.</p>\n * @since 0.9.0\n */\n@Dependent\n@Named(value = KCAdapterUserManagementService.NAME)\npublic class KCAdapterUserManagementService extends AbstractUserManagementService {\n    public static final String NAME = \"KCAdapterUserManagementService\";\n\n    KeyCloakUserManager userManager;\n    KeyCloakGroupManager groupManager;\n    KCAdapterClientFactory clientFactory;\n    HttpServletRequest request;\n\n    @Inject\n    public KCAdapterUserManagementService(final KeyCloakUserManager userManager,\n                                          final KeyCloakGroupManager groupManager,\n                                          final KCAdapterClientFactory clientFactory,\n                                          final HttpServletRequest request,\n                                          final @Named(\"uberfireRoleManager\") UberfireRoleManager roleManager) {\n        super(roleManager);\n        this.userManager = userManager;\n        this.groupManager = groupManager;\n        this.clientFactory = clientFactory;\n        this.request = request;\n    }\n\n    @PostConstruct\n    public void init() {\n        clientFactory.init(new ConfigProperties(System.getProperties()),\n                           request);\n        this.userManager.init(clientFactory);\n        this.groupManager.init(clientFactory);\n    }\n\n    @Override\n    public UserManager users() {\n        return userManager;\n    }\n\n    @Override\n    public GroupManager groups() {\n        return groupManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/KCCredentialsUserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.UberfireRoleManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.service.AbstractUserManagementService;\n\n/**\n * <p>The KeyCloak management service beans used if Credential authentication settings are provided.</p>\n * @since 0.9.0\n */\n@Dependent\n@Named(value = KCCredentialsUserManagementService.NAME)\npublic class KCCredentialsUserManagementService extends AbstractUserManagementService {\n    public static final String NAME = \"KCCredentialsUserManagementService\";\n\n    KeyCloakUserManager userManager;\n    KeyCloakGroupManager groupManager;\n    CredentialsClientFactory clientFactory;\n\n    @Inject\n    public KCCredentialsUserManagementService(final KeyCloakUserManager userManager,\n                                              final KeyCloakGroupManager groupManager,\n                                              final CredentialsClientFactory clientFactory,\n                                              final @Named(\"uberfireRoleManager\") UberfireRoleManager roleManager) {\n        super(roleManager);\n        this.userManager = userManager;\n        this.groupManager = groupManager;\n        this.clientFactory = clientFactory;\n    }\n\n    @PostConstruct\n    public void init() {\n        clientFactory.init(new ConfigProperties(System.getProperties()));\n        this.userManager.init(clientFactory);\n        this.groupManager.init(clientFactory);\n    }\n\n    @Override\n    public UserManager users() {\n        return userManager;\n    }\n\n    @Override\n    public GroupManager groups() {\n        return groupManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/KeyCloakGroupManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UnsupportedServiceCapabilityException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.impl.GroupManagerSettingsImpl;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RolesResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UsersResource;\nimport org.uberfire.ext.security.management.search.GroupsRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.search.RuntimeSearchEngine;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>GroupsManager Service Provider Implementation for KeyCloak.</p>\n * <p>Note that roles (in keycloak server) are mapped as groups (in the workbench) for the keycloak users management provider impl.</p>\n *\n * @since 0.8.0\n */\npublic class KeyCloakGroupManager extends BaseKeyCloakManager implements GroupManager,\n                                                                         ContextualManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(KeyCloakGroupManager.class);\n    RuntimeSearchEngine<Group> groupsSearchEngine;\n\n    public KeyCloakGroupManager() {\n    }\n\n    @Override\n    public void initialize(UserSystemManager userSystemManager) throws Exception {\n        groupsSearchEngine = new GroupsRuntimeSearchEngine();\n    }\n\n    @Override\n    public SearchResponse<Group> search(SearchRequest request) throws SecurityManagementException {\n        // First page must be 1.\n        if (request.getPage() <= 0) {\n            throw new RuntimeException(\"First page must be 1.\");\n        }\n        final List<Group> roles = getAll();\n        return groupsSearchEngine.search(roles,\n                                         request);\n    }\n\n    @Override\n    public Group get(String identifier) throws SecurityManagementException {\n        checkNotNull(\"identifier\",\n                     identifier);\n        final RoleResource[] roleResource = new RoleResource[1];\n        consumeRealm(realmResource -> {\n            roleResource[0] = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings()).get(identifier);\n        });\n        if (roleResource[0] != null) {\n            final RoleRepresentation roleRepresentation = getRoleRepresentation(identifier,\n                                                                                roleResource[0]);\n            Group g = createGroup(roleRepresentation);\n            if (g != null) {\n                return g;\n            }\n        }\n        throw new GroupNotFoundException(identifier);\n    }\n\n    @Override\n    public List<Group> getAll() throws SecurityManagementException {\n        final List<Group> roles = new LinkedList<>();\n\n        consumeRealm(realmResource -> {\n            RolesResource rolesResource = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings());\n            final List<RoleRepresentation> roleRepresentations = rolesResource.list();\n            final Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames();\n            if (roleRepresentations != null && !roleRepresentations.isEmpty()) {\n                for (RoleRepresentation role : roleRepresentations) {\n                    final String name = role.getName();\n                    if (!registeredRoles.contains(name)) {\n                        final Group group = createGroup(name);\n                        roles.add(group);\n                    }\n                }\n            }\n        });\n        return roles;\n    }\n\n    @Override\n    public Group create(Group entity) throws SecurityManagementException {\n        checkNotNull(\"entity\",\n                     entity);\n        consumeRealm(realmResource -> {\n            final RolesResource rolesResource = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings());\n            final RoleRepresentation roleRepresentation = new RoleRepresentation(entity.getName(), entity.getName(), Boolean.FALSE);\n            roleRepresentation.setId(entity.getName());\n            roleRepresentation.setComposite(false);\n            final ClientResponse response = (ClientResponse) rolesResource.create(roleRepresentation);\n            handleResponse(response);\n        });\n        return entity;\n    }\n\n    // The Group class from Errai does not hava any attributes holder. Group name cannot be modified for a group. \n    // So currently a group cannot be updated.\n    @Override\n    public Group update(Group entity) throws SecurityManagementException {\n        throw new UnsupportedServiceCapabilityException(Capability.CAN_UPDATE_GROUP);\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        checkNotNull(\"identifiers\",\n                     identifiers);\n        consumeRealm(realmResource -> {\n            final RolesResource rolesResource = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings());\n            for (String identifier : identifiers) {\n                final RoleResource roleResource = rolesResource.get(identifier);\n                if (roleResource == null) {\n                    throw new GroupNotFoundException(identifier);\n                }\n                roleResource.remove();\n            }\n        });\n    }\n\n    @Override\n    public GroupManagerSettings getSettings() {\n        final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<Capability, CapabilityStatus>(8);\n        for (final Capability capability : SecurityManagementUtils.GROUPS_CAPABILITIES) {\n            capabilityStatusMap.put(capability,\n                                    getCapabilityStatus(capability));\n        }\n        return new GroupManagerSettingsImpl(capabilityStatusMap,\n                                            true);\n    }\n\n    @Override\n    public void assignUsers(String name,\n                            Collection<String> users) throws SecurityManagementException {\n        checkNotNull(\"name\",\n                     name);\n        if (users != null) {\n            consumeRealm(realmResource -> {\n                final UsersResource usersResource = realmResource.users();\n                final RolesResource rolesResource = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings());\n                final RoleResource roleResource = rolesResource.get(name);\n                final List<RoleRepresentation> rolesToAdd = new ArrayList<RoleRepresentation>(1);\n                rolesToAdd.add(getRoleRepresentation(name,\n                                                     roleResource));\n                for (String username : users) {\n                    final UserResource userResource = getUserResource(usersResource,\n                                                                      username);\n                    if (userResource == null) {\n                        throw new UserNotFoundException(username);\n                    }\n                    getRolesScopeResource(userResource.roles(), getKeyCloakInstance().getUseRoleResourceMappings()).add(rolesToAdd);\n                }\n            });\n        }\n    }\n\n    protected CapabilityStatus getCapabilityStatus(final Capability capability) {\n        if (capability != null) {\n            switch (capability) {\n                case CAN_SEARCH_GROUPS:\n                case CAN_ADD_GROUP:\n                case CAN_READ_GROUP:\n                case CAN_DELETE_GROUP:\n                    return CapabilityStatus.ENABLED;\n            }\n        }\n        return CapabilityStatus.UNSUPPORTED;\n    }\n\n    @Override\n    public void destroy() throws Exception {\n        getKeyCloakInstance().close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/KeyCloakUserManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.keycloak.representations.idm.CredentialRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.impl.SearchResponseImpl;\nimport org.uberfire.ext.security.management.impl.UserManagerSettingsImpl;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleMappingResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleScopeResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RolesResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UsersResource;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * <p>UsersManager Service Provider Implementation for KeyCloak.</p>\n *\n * @since 0.8.0\n */\npublic class KeyCloakUserManager extends BaseKeyCloakManager implements UserManager,\n                                                                        ContextualManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(KeyCloakUserManager.class);\n    private static final String CREDENTIAL_TYPE_PASSWORD = \"password\";\n\n    UserSystemManager userSystemManager;\n\n    public KeyCloakUserManager() {\n    }\n\n    @Override\n    public void initialize(final UserSystemManager userSystemManager) throws Exception {\n        this.userSystemManager = userSystemManager;\n    }\n\n    @Override\n    public SearchResponse<User> search(SearchRequest request) throws SecurityManagementException {\n        final SearchRequest req = getSearchRequest(request);\n        // First page must be 1.\n        if (req.getPage() <= 0) {\n            throw new RuntimeException(\"First page must be 1.\");\n        }\n        final int page = req.getPage() - 1;\n        final int pageSize = req.getPageSize();\n        final List<User> users = new ArrayList<User>();\n        final int[] numberOfFoundUsers = new int[]{0};\n        final boolean[] hasNextPage = new boolean[]{false};\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final List<UserRepresentation> userRepresentations = usersResource.search(req.getSearchPattern(),\n                                                                                      page * pageSize,\n                                                                                      pageSize + 1);\n            numberOfFoundUsers[0] = usersResource.search(req.getSearchPattern(),\n                                                         1,\n                                                         Integer.MAX_VALUE).size();\n            if (userRepresentations != null && !userRepresentations.isEmpty()) {\n                int x = 0;\n                for (UserRepresentation userRepresentation : userRepresentations) {\n                    if (x == req.getPageSize()) {\n                        hasNextPage[0] = true;\n                    } else {\n                        final User user = createUser(userRepresentation);\n                        users.add(user);\n                        x++;\n                    }\n                }\n            }\n        });\n        return new SearchResponseImpl<User>(users,\n                                            page + 1,\n                                            pageSize,\n                                            numberOfFoundUsers[0],\n                                            hasNextPage[0]);\n    }\n\n    @Override\n    public User get(String username) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        final User[] user = new User[1];\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final UserResource userResource = getUserResource(usersResource,\n                                                              username);\n            final RoleMappingResource roleMappingResource = userResource.roles();\n            Set<Group> _groups = null;\n            Set<Role> _roles = null;\n            if (roleMappingResource != null) {\n                Set[] gr = getUserGroupsAndRoles(roleMappingResource);\n                if (null != gr) {\n                    _groups = gr[0];\n                    _roles = gr[1];\n                }\n            }\n            user[0] = createUser(userResource.toRepresentation(),\n                                 _groups,\n                                 _roles);\n        });\n        return user[0];\n    }\n\n    @Override\n    public List<User> getAll() throws SecurityManagementException {\n        final List<User> users = new ArrayList<>();\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final List<UserRepresentation> userRepresentations = usersResource.list();\n            if (userRepresentations != null && !userRepresentations.isEmpty()) {\n                for (UserRepresentation userRepresentation : userRepresentations) {\n                    final User user = createUser(userRepresentation);\n                    users.add(user);\n                }\n            }\n        });\n        return users;\n    }\n\n    @Override\n    public User create(User entity) throws SecurityManagementException {\n        checkNotNull(\"entity\",\n                     entity);\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final UserRepresentation userRepresentation = new UserRepresentation();\n            fillUserRepresentationAttributes(entity,\n                                             userRepresentation);\n            final ClientResponse response = (ClientResponse) usersResource.create(userRepresentation);\n            handleResponse(response);\n        });\n        return entity;\n    }\n\n    @Override\n    public User update(User entity) throws SecurityManagementException {\n        checkNotNull(\"entity\",\n                     entity);\n        consumeRealm(realmResource -> {\n            UsersResource usersResource = realmResource.users();\n            UserResource userResource = getUserResource(usersResource,\n                                                        entity.getIdentifier());\n            if (userResource == null) {\n                throw new UserNotFoundException(entity.getIdentifier());\n            }\n            UserRepresentation userRepresentation = new UserRepresentation();\n            fillUserRepresentationAttributes(entity,\n                                             userRepresentation);\n            ClientResponse response = (ClientResponse) userResource.update(userRepresentation);\n            handleResponse(response);\n        });\n        return entity;\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        checkNotNull(\"identifiers\",\n                     identifiers);\n        consumeRealm(realmResource -> {\n            UsersResource usersResource = realmResource.users();\n            for (String identifier : identifiers) {\n                UserResource userResource = getUserResource(usersResource,\n                                                            identifier);\n                if (userResource == null) {\n                    throw new UserNotFoundException(identifier);\n                }\n                ClientResponse response = (ClientResponse) userResource.remove();\n                handleResponse(response);\n            }\n        });\n    }\n\n    @Override\n    public UserManagerSettings getSettings() {\n        final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<Capability, CapabilityStatus>(8);\n        for (final Capability capability : SecurityManagementUtils.USERS_CAPABILITIES) {\n            capabilityStatusMap.put(capability,\n                                    getCapabilityStatus(capability));\n        }\n        return new UserManagerSettingsImpl(capabilityStatusMap,\n                                           USER_ATTRIBUTES);\n    }\n\n    @Override\n    public void assignGroups(String username,\n                             Collection<String> groups) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        final Set<String> userRoles = SecurityManagementUtils.rolesToString(SecurityManagementUtils.getRoles(userSystemManager,\n                                                                                                             username));\n        userRoles.addAll(groups);\n        assignGroupsOrRoles(username,\n                            userRoles);\n    }\n\n    @Override\n    public void assignRoles(String username,\n                            Collection<String> roles) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        final Set<String> userGroups = SecurityManagementUtils.groupsToString(SecurityManagementUtils.getGroups(userSystemManager,\n                                                                                                                username));\n        userGroups.addAll(roles);\n        assignGroupsOrRoles(username,\n                            userGroups);\n    }\n\n    private void assignGroupsOrRoles(String username,\n                                     Collection<String> idsToAssign) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final UserResource userResource = getUserResource(usersResource,\n                                                              username);\n            if (userResource == null) {\n                throw new UserNotFoundException(username);\n            }\n            final RolesResource rolesResource = getRolesResource(realmResource, getKeyCloakInstance().getUseRoleResourceMappings());\n            if (idsToAssign != null && !idsToAssign.isEmpty()) {\n                // Add the given assignments.\n                final List<RoleRepresentation> rolesToAdd = new ArrayList<RoleRepresentation>();\n                for (String name : idsToAssign) {\n                    RoleResource roleResource = rolesResource.get(name);\n                    if (roleResource != null) {\n                        rolesToAdd.add(getRoleRepresentation(name,\n                                                             roleResource));\n                    }\n                }\n\n                RoleScopeResource roleScopeResource = getRolesScopeResource(userResource.roles(), getKeyCloakInstance().getUseRoleResourceMappings());\n                final List<RoleRepresentation> roleRepresentations = roleScopeResource.listEffective();\n                roleScopeResource.remove(roleRepresentations);\n                roleScopeResource.add(rolesToAdd);\n            }\n        });\n    }\n\n    @Override\n    public void changePassword(String username,\n                               String newPassword) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        consumeRealm(realmResource -> {\n            final UsersResource usersResource = realmResource.users();\n            final UserResource userResource = getUserResource(usersResource,\n                                                              username);\n            if (userResource == null) {\n                throw new UserNotFoundException(username);\n            }\n            final CredentialRepresentation credentialRepresentation = new CredentialRepresentation();\n            credentialRepresentation.setType(CREDENTIAL_TYPE_PASSWORD);\n            credentialRepresentation.setValue(newPassword);\n            userResource.resetPassword(credentialRepresentation);\n        });\n    }\n\n    protected CapabilityStatus getCapabilityStatus(final Capability capability) {\n        if (capability != null) {\n            switch (capability) {\n                case CAN_SEARCH_USERS:\n                case CAN_ADD_USER:\n                case CAN_UPDATE_USER:\n                case CAN_DELETE_USER:\n                case CAN_READ_USER:\n                case CAN_MANAGE_ATTRIBUTES:\n                case CAN_ASSIGN_GROUPS:\n                    /** As it is using the UberfireRoleManager. **/\n                case CAN_ASSIGN_ROLES:\n                case CAN_CHANGE_PASSWORD:\n                    return CapabilityStatus.ENABLED;\n            }\n        }\n        return CapabilityStatus.UNSUPPORTED;\n    }\n\n    @Override\n    public void destroy() throws Exception {\n        getKeyCloakInstance().close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/ClientFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client;\n\n/**\n * The Keycloak client factory.\n * @since 0.9.0\n */\npublic interface ClientFactory {\n\n    /**\n     * Returns a valid Keycloak client.\n     */\n    Keycloak get();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/Keycloak.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client;\n\nimport javax.ws.rs.core.UriBuilder;\n\nimport org.jboss.resteasy.client.ClientRequestFactory;\nimport org.jboss.resteasy.spi.ResteasyProviderFactory;\nimport org.uberfire.ext.security.management.keycloak.client.auth.BearerAuthenticationInterceptor;\nimport org.uberfire.ext.security.management.keycloak.client.auth.TokenManager;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmsResource;\n\n/**\n * The Keycloak client.\n *\n * @since 0.9.0\n */\npublic class Keycloak {\n\n    private final String serverUrl;\n    private final String realm;\n    private final String resource;\n    private final Boolean useRoleResourceMappings;\n    private final ClientRequestFactory clientRequestFactory;\n\n    Keycloak(String serverUrl,\n             String realm,\n             String resource,\n             Boolean useRoleResourceMappings,\n             TokenManager tokenManager) {\n        this.serverUrl = serverUrl;\n        this.realm = realm;\n        this.resource = resource;\n        this.useRoleResourceMappings = useRoleResourceMappings;\n        this.clientRequestFactory = new ClientRequestFactory(UriBuilder.fromUri(serverUrl).build());\n        ResteasyProviderFactory.getInstance().getClientExecutionInterceptorRegistry().register(new BearerAuthenticationInterceptor(tokenManager));\n    }\n\n    public static Keycloak getInstance(String serverUrl,\n                                       String realm,\n                                       String resource,\n                                       Boolean useRoleResourceMappings,\n                                       TokenManager tokenManager) {\n        return new Keycloak(serverUrl,\n                            realm,\n                            resource,\n                            useRoleResourceMappings,\n                            tokenManager);\n    }\n\n    public RealmResource realm() {\n        return clientRequestFactory.createProxy(RealmsResource.class).realm(getRealm());\n    }\n\n    public String getServerUrl() {\n        return serverUrl;\n    }\n\n    public String getRealm() {\n        return realm;\n    }\n\n    public Boolean getUseRoleResourceMappings() {\n        return useRoleResourceMappings;\n    }\n\n    public String getResource() {\n        return resource;\n    }\n\n    public void close() {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/BearerAuthenticationInterceptor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth;\n\nimport java.lang.reflect.Method;\nimport javax.ws.rs.core.HttpHeaders;\n\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.jboss.resteasy.spi.interception.AcceptedByMethod;\nimport org.jboss.resteasy.spi.interception.ClientExecutionContext;\nimport org.jboss.resteasy.spi.interception.ClientExecutionInterceptor;\n\n/**\n * A Resteasy client interceptor used for Keycloak's client authentication based on the Bearer authentication method.\n * It does not intercept the \"grantToken\" and \"refreshToken\" calls from the token service endpoint (those requests are basic authentication based).\n *\n * @since 0.9.0\n */\npublic class BearerAuthenticationInterceptor implements ClientExecutionInterceptor,\n                                                        AcceptedByMethod {\n\n    private TokenManager tokenManager;\n\n    public BearerAuthenticationInterceptor(TokenManager tokenManager) {\n        this.tokenManager = tokenManager;\n    }\n\n    @Override\n    public ClientResponse execute(ClientExecutionContext ctx) throws Exception {\n        String token = tokenManager.getAccessTokenString();\n        if (null != token) {\n            ctx.getRequest().header(HttpHeaders.AUTHORIZATION,\n                                    \"Bearer \" + token);\n        }\n        return ctx.proceed();\n    }\n\n    @Override\n    public boolean accept(Class declaring,\n                          Method method) {\n        String name = method.getName();\n        boolean isToken = \"grantToken\".equals(name) || \"refreshToken\".equals(name);\n        return !isToken;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/TokenManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth;\n\n/**\n * The Token Manager.\n * @since 0.9.0\n */\npublic interface TokenManager {\n\n    void grantToken();\n\n    String getAccessTokenString();\n\n    String getRealm();\n\n    String getResource();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/TokenService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth;\n\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.HeaderParam;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.MultivaluedMap;\n\nimport org.uberfire.ext.security.management.keycloak.client.auth.credentials.AccessTokenResponse;\n\n/**\n * The service for the token management endpoints.\n * @since 0.9.0\n */\n@Produces(MediaType.APPLICATION_JSON)\n@Consumes(MediaType.APPLICATION_FORM_URLENCODED)\npublic interface TokenService {\n\n    @POST\n    @Path(\"/realms/{realm}/protocol/openid-connect/token\")\n    AccessTokenResponse grantToken(@PathParam(\"realm\") String realm,\n                                   @HeaderParam(\"Authorization\") String auth,\n                                   MultivaluedMap<String, String> map);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/adapter/KCAdapterContextTokenManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth.adapter;\n\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.keycloak.KeycloakSecurityContext;\nimport org.uberfire.ext.security.management.keycloak.client.auth.TokenManager;\n\n/**\n * Token manager that uses current session's access token (provided by the KC client adapter)\n * @since 0.9.0.\n */\npublic class KCAdapterContextTokenManager implements TokenManager {\n\n    private final HttpServletRequest request;\n\n    public KCAdapterContextTokenManager(HttpServletRequest request) {\n        this.request = request;\n    }\n\n    @Override\n    public void grantToken() {\n        // Nothing to do here. Token in session is granted and refresh by the KC client adapter.\n    }\n\n    @Override\n    public String getAccessTokenString() {\n        return getKCSessionContext().getTokenString();\n    }\n\n    @Override\n    public String getRealm() {\n        return getKCSessionContext().getRealm();\n    }\n\n    @Override\n    public String getResource() {\n        return getKCSessionContext().getToken().getIssuedFor();\n    }\n\n    protected KeycloakSecurityContext getKCSessionContext() {\n        KeycloakSecurityContext context = null;\n    \t\n    \tcontext = (KeycloakSecurityContext) request.getAttribute(KeycloakSecurityContext.class.getName());\n    \tif (context == null) {\n    \t\tcontext = (KeycloakSecurityContext) request.getSession().getAttribute(KeycloakSecurityContext.class.getName());\n    \t}\n    \treturn context;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/credentials/AccessTokenResponse.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth.credentials;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.codehaus.jackson.annotate.JsonAnyGetter;\nimport org.codehaus.jackson.annotate.JsonAnySetter;\nimport org.codehaus.jackson.annotate.JsonProperty;\nimport org.codehaus.jackson.annotate.JsonPropertyOrder;\n\n@JsonPropertyOrder({\n        \"access_token\",\n        \"expires_in\",\n        \"refresh_expires_in\",\n        \"refresh_token\",\n        \"token_type\",\n        \"id_token\",\n        \"not-before-policy\",\n        \"session_state\"\n})\n/**\n * The response for the access token service.\n *\n * @since 0.9.0\n */\npublic class AccessTokenResponse {\n\n    @JsonProperty(\"access_token\")\n    protected String token;\n\n    @JsonProperty(\"expires_in\")\n    protected long expiresIn;\n\n    @JsonProperty(\"refresh_expires_in\")\n    protected long refreshExpiresIn;\n\n    @JsonProperty(\"refresh_token\")\n    protected String refreshToken;\n\n    @JsonProperty(\"token_type\")\n    protected String tokenType;\n\n    @JsonProperty(\"id_token\")\n    protected String idToken;\n\n    @JsonProperty(\"not-before-policy\")\n    protected int notBeforePolicy;\n\n    @JsonProperty(\"session_state\")\n    protected String sessionState;\n\n    protected Map<String, Object> otherClaims = new HashMap<String, Object>();\n\n    public String getToken() {\n        return token;\n    }\n\n    public void setToken(String token) {\n        this.token = token;\n    }\n\n    public long getExpiresIn() {\n        return expiresIn;\n    }\n\n    public void setExpiresIn(long expiresIn) {\n        this.expiresIn = expiresIn;\n    }\n\n    public long getRefreshExpiresIn() {\n        return refreshExpiresIn;\n    }\n\n    public void setRefreshExpiresIn(long refreshExpiresIn) {\n        this.refreshExpiresIn = refreshExpiresIn;\n    }\n\n    public String getRefreshToken() {\n        return refreshToken;\n    }\n\n    public void setRefreshToken(String refreshToken) {\n        this.refreshToken = refreshToken;\n    }\n\n    public String getTokenType() {\n        return tokenType;\n    }\n\n    public void setTokenType(String tokenType) {\n        this.tokenType = tokenType;\n    }\n\n    public String getIdToken() {\n        return idToken;\n    }\n\n    public void setIdToken(String idToken) {\n        this.idToken = idToken;\n    }\n\n    public int getNotBeforePolicy() {\n        return notBeforePolicy;\n    }\n\n    public void setNotBeforePolicy(int notBeforePolicy) {\n        this.notBeforePolicy = notBeforePolicy;\n    }\n\n    public String getSessionState() {\n        return sessionState;\n    }\n\n    public void setSessionState(String sessionState) {\n        this.sessionState = sessionState;\n    }\n\n    @JsonAnyGetter\n    public Map<String, Object> getOtherClaims() {\n        return otherClaims;\n    }\n\n    @JsonAnySetter\n    public void setOtherClaims(String name,\n                               Object value) {\n        otherClaims.put(name,\n                        value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/credentials/AuthSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth.credentials;\n\n/**\n * The settings for credentials based authentication.\n * @since 0.9.0\n */\npublic class AuthSettings {\n\n    private String serverUrl;\n    private String realm;\n    private String resource;\n    private String username;\n    private String password;\n    private String clientId;\n    private String clientSecret;\n\n    public AuthSettings(String serverUrl,\n                        String realm,\n                        String resource,\n                        String username,\n                        String password,\n                        String clientId,\n                        String clientSecret) {\n        this.serverUrl = serverUrl;\n        this.realm = realm;\n        this.resource = resource;\n        this.username = username;\n        this.password = password;\n        this.clientId = clientId;\n        this.clientSecret = clientSecret;\n    }\n\n    public String getServerUrl() {\n        return serverUrl;\n    }\n\n    public void setServerUrl(String serverUrl) {\n        this.serverUrl = serverUrl;\n    }\n\n    public String getRealm() {\n        return realm;\n    }\n\n    public void setRealm(String realm) {\n        this.realm = realm;\n    }\n\n    public String getResource() {\n        return resource;\n    }\n\n    public void setResource(String resource) {\n        this.resource = resource;\n    }\n\n    public String getUsername() {\n        return username;\n    }\n\n    public void setUsername(String username) {\n        this.username = username;\n    }\n\n    public String getPassword() {\n        return password;\n    }\n\n    public void setPassword(String password) {\n        this.password = password;\n    }\n\n    public String getClientId() {\n        return clientId;\n    }\n\n    public void setClientId(String clientId) {\n        this.clientId = clientId;\n    }\n\n    public String getClientSecret() {\n        return clientSecret;\n    }\n\n    public void setClientSecret(String clientSecret) {\n        this.clientSecret = clientSecret;\n    }\n\n    public boolean isPublicClient() {\n        return clientSecret == null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/auth/credentials/AuthTokenManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth.credentials;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport javax.ws.rs.core.MultivaluedMap;\nimport javax.ws.rs.core.Response;\n\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.jboss.resteasy.client.ProxyFactory;\nimport org.jboss.resteasy.client.core.BaseClientResponse;\nimport org.jboss.resteasy.client.core.ClientErrorInterceptor;\nimport org.jboss.resteasy.spi.ResteasyProviderFactory;\nimport org.jboss.resteasy.util.CaseInsensitiveMap;\nimport org.keycloak.OAuth2Constants;\nimport org.keycloak.common.util.Time;\nimport org.keycloak.util.BasicAuthHelper;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ext.security.management.keycloak.client.auth.TokenManager;\nimport org.uberfire.ext.security.management.keycloak.client.auth.TokenService;\n\n/**\n * Token manager that uses credentials based authentication settings to manage the access token.\n * Handles:\n * - Public / non public clients\n * - Token refreshments based on OAuth2 token's expiration time.\n * @since 0.9.0\n */\npublic class AuthTokenManager implements TokenManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(AuthTokenManager.class);\n    private static final long DEFAULT_MIN_VALIDITY = 30;\n    private final AuthSettings config;\n    long expirationTime;\n    long minTokenValidity = DEFAULT_MIN_VALIDITY;\n    AccessTokenResponse accessTokenResponse;\n    private final ClientErrorInterceptor clientErrorInterceptor = new ClientErrorInterceptor() {\n        @Override\n        public void handle(ClientResponse<?> response) throws RuntimeException {\n\n            // Whatever the error is, let's nullify the current access token response.\n            AuthTokenManager.this.accessTokenResponse = null;\n\n            // Handle some of the common errors.\n            String error = null;\n            Exception exception = null;\n\n            try {\n\n                BaseClientResponse r = (BaseClientResponse) response;\n                InputStream stream = r.getStreamFactory().getInputStream();\n                stream.reset();\n\n                if (Response.Status.FORBIDDEN.equals(response.getResponseStatus())) {\n                    error = \"Error handling the Keycloak token, status is FORBIDDEN\";\n                } else if (Response.Status.UNAUTHORIZED.equals(response.getResponseStatus())) {\n                    error = \"Error handling the Keycloak token, status is UNAUTHORIZED\";\n                } else if (Response.Status.BAD_REQUEST.equals(response.getResponseStatus())) {\n                    error = \"Error handling the Keycloak token, status is BAD_REQUEST. Response data: \" + getResponseData(r);\n                } else if (Response.Status.NOT_FOUND.equals(response.getResponseStatus())) {\n                    error = \"Error handling the Keycloak token, status is NOT_FOUND.\";\n                } else if (!Response.Status.OK.equals(response.getResponseStatus())) {\n                    error = \"Error handling the Keycloak token. Response status is \" + response.getResponseStatus() +\n                            \". Response data: \" + getResponseData(r);\n                }\n            } catch (IOException e) {\n\n                error = \"Error handling the Keycloak token.\";\n                exception = e;\n            } finally {\n\n                response.releaseConnection();\n            }\n\n            // If error is handled here, log it and throw the exception.\n            // Otherwise, let's Resteasy do the generic work after a client error.\n            if (null != error) {\n\n                LOG.error(error);\n\n                if (null != exception) {\n                    throw new RuntimeException(error,\n                                               exception);\n                } else {\n                    throw new RuntimeException(error);\n                }\n            }\n        }\n\n        private String getResponseData(BaseClientResponse response) {\n            try {\n                return (String) response.getEntity(String.class);\n            } catch (Exception e) {\n                LOG.error(\"Error trying to obtain response data as String.\",\n                          e);\n            }\n            return null;\n        }\n    };\n\n    public AuthTokenManager(AuthSettings config) {\n        this.config = config;\n    }\n\n    @Override\n    public void grantToken() {\n        MultivaluedMap<String, String> mvm = new CaseInsensitiveMap<String>();\n        mvm.putSingle(OAuth2Constants.GRANT_TYPE,\n                      \"password\");\n        mvm.putSingle(\"username\",\n                      config.getUsername());\n        mvm.putSingle(\"password\",\n                      config.getPassword());\n        consumeGrantTokenService(mvm);\n    }\n\n    private void refreshToken() {\n        MultivaluedMap<String, String> mvm = new CaseInsensitiveMap<String>();\n        mvm.putSingle(OAuth2Constants.GRANT_TYPE,\n                      \"refresh_token\");\n        mvm.putSingle(\"refresh_token\",\n                      accessTokenResponse.getRefreshToken());\n        consumeGrantTokenService(mvm);\n    }\n\n    protected void consumeGrantTokenService(final MultivaluedMap<String, String> mvm) {\n\n        boolean isPublic = config.isPublicClient();\n\n        String authorization = \"\";\n        if (isPublic) { // if client is public access type\n            mvm.putSingle(OAuth2Constants.CLIENT_ID,\n                          config.getClientId());\n        } else {\n            authorization = BasicAuthHelper.createHeader(config.getClientId(),\n                                                         config.getClientSecret());\n        }\n\n        TokenService client = createTokenService();\n        AccessTokenResponse response = client.grantToken(config.getRealm(),\n                                                         authorization,\n                                                         mvm);\n\n        int requestTime = Time.currentTime();\n        expirationTime = requestTime + response.getExpiresIn();\n        this.accessTokenResponse = response;\n    }\n\n    @Override\n    public String getAccessTokenString() {\n        if (null == this.accessTokenResponse) {\n            grantToken();\n        } else if (tokenExpired()) {\n            refreshToken();\n        }\n        return accessTokenResponse != null ? accessTokenResponse.getToken() : null;\n    }\n\n    @Override\n    public String getRealm() {\n        return config.getRealm();\n    }\n\n    @Override\n    public String getResource() {\n        return config.getResource();\n    }\n\n    TokenService createTokenService() {\n        ResteasyProviderFactory pf = ResteasyProviderFactory.getInstance();\n        pf.addClientErrorInterceptor(clientErrorInterceptor);\n        return ProxyFactory.create(TokenService.class,\n                                   config.getServerUrl());\n    }\n\n    private boolean tokenExpired() {\n        return accessTokenResponse != null && (Time.currentTime() + minTokenValidity) >= expirationTime;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/ClientResource.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.Path;\n\npublic interface ClientResource {\n\n    @Path(\"roles\")\n    RolesResource roles();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/ClientsResource.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport java.util.List;\n\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.QueryParam;\nimport javax.ws.rs.core.MediaType;\nimport org.keycloak.representations.idm.ClientRepresentation;\n/**\n * @since 0.9.0\n */\npublic interface ClientsResource {\n\n    @Path(\"{id}\")\n    public ClientResource get(@PathParam(\"id\") String id);\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    List<ClientRepresentation> findByClientId(@QueryParam(value=\"clientId\") String clientId);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RealmResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.Path;\n\n/**\n * @since 0.9.0\n */\npublic interface RealmResource {\n\n    @Path(\"users\")\n    UsersResource users();\n\n    @Path(\"roles\")\n    RolesResource roles();\n\n    @Path(\"clients\")\n    ClientsResource clients();\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RealmsResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\n\n/**\n * @since 0.9.0\n */\npublic interface RealmsResource {\n\n    @Path(\"/admin/realms/{realm}\")\n    RealmResource realm(@PathParam(\"realm\") String realm);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RoleMappingResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\n\nimport org.keycloak.representations.idm.MappingsRepresentation;\n\n/**\n * @since 0.9.0\n */\n@Consumes(MediaType.APPLICATION_JSON)\n@Produces(MediaType.APPLICATION_JSON)\npublic interface RoleMappingResource {\n\n    @GET\n    public MappingsRepresentation getAll();\n\n    @Path(\"realm\")\n    public RoleScopeResource realmLevel();\n\n    @Path(\"clients/{clientId}\")\n    public RoleScopeResource clientLevel(@PathParam(\"clientId\") String clientId);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RoleResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\n\nimport org.keycloak.representations.idm.RoleRepresentation;\n\n/**\n * @since 0.9.0\n */\npublic interface RoleResource {\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    public RoleRepresentation toRepresentation();\n\n    @DELETE\n    public String remove();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RoleScopeResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport java.util.List;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\n\nimport org.keycloak.representations.idm.RoleRepresentation;\n\n/**\n * @since 0.9.0\n */\n@Consumes(MediaType.APPLICATION_JSON)\n@Produces(MediaType.APPLICATION_JSON)\npublic interface RoleScopeResource {\n\n    @GET\n    public List<RoleRepresentation> listAll();\n\n    @GET\n    @Path(\"available\")\n    public List<RoleRepresentation> listAvailable();\n\n    @GET\n    @Path(\"composite\")\n    public List<RoleRepresentation> listEffective();\n\n    @POST\n    public String add(List<RoleRepresentation> rolesToAdd);\n\n    @DELETE\n    public String remove(List<RoleRepresentation> rolesToRemove);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/RolesResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport java.util.List;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\n\nimport org.keycloak.representations.idm.RoleRepresentation;\n\n/**\n * @since 0.9.0\n */\npublic interface RolesResource {\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    public List<RoleRepresentation> list();\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    public Response create(RoleRepresentation roleRepresentation);\n\n    @Path(\"{roleName}\")\n    public RoleResource get(@PathParam(\"roleName\") String roleName);\n\n    @Path(\"{role-name}\")\n    @DELETE\n    public String deleteRole(final @PathParam(\"role-name\") String roleName);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/UserResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.PUT;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\n\nimport org.keycloak.representations.idm.CredentialRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\n\n/**\n * @since 0.9.0\n */\n@Consumes(MediaType.APPLICATION_JSON)\n@Produces(MediaType.APPLICATION_JSON)\npublic interface UserResource {\n\n    @GET\n    public UserRepresentation toRepresentation();\n\n    @PUT\n    public Response update(UserRepresentation userRepresentation);\n\n    @DELETE\n    public Response remove();\n\n    @PUT\n    @Path(\"reset-password\")\n    public String resetPassword(CredentialRepresentation credentialRepresentation);\n\n    @Path(\"role-mappings\")\n    public RoleMappingResource roles();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/client/resource/UsersResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.resource;\n\nimport java.util.List;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.QueryParam;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\n\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\n\n/**\n * @since 0.9.0\n */\npublic interface UsersResource {\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    List<UserRepresentation> list();\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    List<UserRepresentation> search(@QueryParam(\"username\") String username,\n                                    @QueryParam(\"firstName\") String firstName,\n                                    @QueryParam(\"lastName\") String lastName,\n                                    @QueryParam(\"email\") String email,\n                                    @QueryParam(\"first\") Integer firstResult,\n                                    @QueryParam(\"max\") Integer maxResults);\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    List<UserRepresentation> search(@QueryParam(\"search\") String search,\n                                    @QueryParam(\"first\") Integer firstResult,\n                                    @QueryParam(\"max\") Integer maxResults);\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    Response create(UserRepresentation userRepresentation);\n\n    @Path(\"{id}\")\n    UserResource get(@PathParam(\"id\") String id);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/elytron/KeyCloakElytronIdentityHelper.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.elytron;\n\nimport java.security.Principal;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.inject.Alternative;\nimport javax.security.auth.Subject;\nimport javax.security.auth.callback.Callback;\nimport javax.security.auth.callback.CallbackHandler;\nimport javax.security.auth.callback.NameCallback;\nimport javax.security.auth.callback.PasswordCallback;\nimport javax.security.auth.login.LoginException;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.keycloak.adapters.jaas.DirectAccessGrantsLoginModule;\nimport org.keycloak.adapters.jaas.RolePrincipal;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\n\n/**\n * Implementation of {@link ElytronIdentityHelper} for Keycloak integration. It tries to authenticate the given credentials\n * to Keycloak by using the {@link DirectAccessGrantsLoginModule}. Requires a keycloak-config-file and a SystemProperty\n * {@value KIE_GIT_FILE_SYSTEM_PROP} specifying the path of that file.\n */\n@Alternative\npublic class KeyCloakElytronIdentityHelper implements ElytronIdentityHelper {\n\n    public static final String KEYCLOAK_CONFIG_FILE_KEY = \"keycloak-config-file\";\n    public static final String KIE_GIT_FILE_SYSTEM_PROP = \"org.uberfire.ext.security.keycloak.keycloak-config-file\";\n    public static final String DEFAULT_KIE_GIT_FILE_PATH = System.getProperty(\"jboss.home.dir\") + \"/kie-git.json\";\n\n    private static final Logger logger = LoggerFactory.getLogger(KeyCloakElytronIdentityHelper.class);\n\n    private final String configFile;\n    private final DirectAccessGrantsLoginModule keycloakDelegate;\n\n    public KeyCloakElytronIdentityHelper() {\n        this(new DirectAccessGrantsLoginModule());\n    }\n\n    KeyCloakElytronIdentityHelper(DirectAccessGrantsLoginModule keycloakDelegate) {\n        this.keycloakDelegate = keycloakDelegate;\n        configFile = System.getProperty(KIE_GIT_FILE_SYSTEM_PROP, DEFAULT_KIE_GIT_FILE_PATH);\n    }\n\n    @Override\n    public User getIdentity(String userName, String password) {\n        Subject subject = new Subject();\n        subject.getPrincipals().add(new Principal() {\n            private final String name = userName;\n\n            @Override\n            public String getName() {\n                return name;\n            }\n        });\n        subject.getPublicCredentials().add(password);\n\n        Map<String, String> options = new HashMap<>();\n        options.put(KEYCLOAK_CONFIG_FILE_KEY, configFile);\n\n        keycloakDelegate.initialize(subject, new ElytronHelperCallbackHandler(userName, password), new HashMap<>(), options);\n\n        try {\n            if (keycloakDelegate.login()) {\n                keycloakDelegate.commit();\n\n                Collection<Role> roles = subject.getPrincipals(RolePrincipal.class)\n                        .stream()\n                        .map(principal -> new RoleImpl(principal.getName()))\n                        .collect(Collectors.toList());\n\n                return new UserImpl(userName, roles);\n            }\n        } catch (Exception ex) {\n            logger.debug(\"Identity provided for '{}' not valid\", userName);\n        } finally {\n            try {\n                keycloakDelegate.logout();\n            } catch (LoginException e) {\n                logger.debug(\"Error logging out user '{}'\", userName);\n            }\n        }\n\n        throw new FailedAuthenticationException();\n    }\n\n    static class ElytronHelperCallbackHandler implements CallbackHandler {\n\n        private final String userName;\n        private final String password;\n\n        public ElytronHelperCallbackHandler(final String userName, final String password) {\n            this.userName = userName;\n            this.password = password;\n        }\n\n        @Override\n        public void handle(Callback[] callbacks) {\n            Stream.of(callbacks).forEach(callback -> {\n                if (callback instanceof NameCallback) {\n                    NameCallback nc = (NameCallback) callback;\n                    nc.setName(userName);\n                } else if (callback instanceof PasswordCallback) {\n                    PasswordCallback pc = (PasswordCallback) callback;\n                    pc.setPassword(password.toCharArray());\n                } else {\n                    logger.debug(\"Unrecognized Callback {}\", callback);\n                }\n            });\n        }\n    }\n}\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/java/org/uberfire/ext/security/management/keycloak/elytron/KeyCloakElytronIdentityHelperProducer.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.elytron;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.Specializes;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.server.security.elytron.DefaultElytronIdentityHelper;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelperProducer;\nimport org.uberfire.ext.security.management.keycloak.KCAdapterUserManagementService;\nimport org.uberfire.ext.security.management.keycloak.KCCredentialsUserManagementService;\n\n/**\n * Produces {@link ElytronIdentityHelper} based on the user management service configured on the\n * {@value MANAGEMENT_SERVICES_SYSTEM_PROP} SystemProperty. If it refers to a Keycloak installation\n * {@link KCAdapterUserManagementService} or {@link KCCredentialsUserManagementService}\n * it will produce an instance of {@link KeyCloakElytronIdentityHelper} otherwhise it will produce\n * a {@link DefaultElytronIdentityHelper}\n */\n@ApplicationScoped\n@Specializes\npublic class KeyCloakElytronIdentityHelperProducer extends ElytronIdentityHelperProducer {\n\n    public static final String MANAGEMENT_SERVICES_SYSTEM_PROP = \"org.uberfire.ext.security.management.api.userManagementServices\";\n\n    private boolean isKeyCloak;\n\n    @Inject\n    public KeyCloakElytronIdentityHelperProducer() {\n    }\n\n    @PostConstruct\n    public void init() {\n        String managementService = System.getProperties().getProperty(MANAGEMENT_SERVICES_SYSTEM_PROP, \"\");\n        isKeyCloak = (KCCredentialsUserManagementService.NAME.equals(managementService) || KCAdapterUserManagementService.NAME.equals(managementService));\n    }\n\n    @Produces\n    @Override\n    public ElytronIdentityHelper getDefaultElytronIdentityHelper() {\n        if (isKeyCloak) {\n            return new KeyCloakElytronIdentityHelper();\n        }\n        return super.getDefaultElytronIdentityHelper();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/BaseKeyCloakTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.BaseTest;\nimport org.uberfire.ext.security.management.keycloak.client.Keycloak;\nimport org.uberfire.ext.security.management.keycloak.client.resource.ClientsResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RolesResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UsersResource;\n\nimport static org.mockito.Mockito.*;\n\n/**\n * <p>Base test class for KeyCloak based services.</p>\n * <p>It provides a mocked service for the remote KeyCloak Admin API for version <code>1.2.0.Final</code>.</p>\n */\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic abstract class BaseKeyCloakTest extends BaseTest {\n\n    public static final String REALM = \"testRealm\";\n\n    @Mock\n    protected Keycloak keycloakMock;\n\n    @Mock\n    protected RealmResource realmResource;\n\n    @Mock\n    protected UsersResource usersResource;\n\n    @Mock\n    protected RolesResource rolesResource;\n\n    @Mock\n    protected ClientsResource clientsResource;\n\n    @Before\n    public void setup() throws Exception {\n        when(realmResource.users()).thenReturn(usersResource);\n        when(realmResource.roles()).thenReturn(rolesResource);\n        when(realmResource.clients()).thenReturn(clientsResource);\n        when(keycloakMock.realm()).thenReturn(realmResource);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/DefaultKeyCloakTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.ws.rs.core.Response;\n\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.jboss.resteasy.client.ClientResponseFailure;\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.keycloak.representations.idm.ClientRepresentation;\nimport org.keycloak.representations.idm.RoleRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.kie.soup.commons.util.Lists;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.ext.security.management.keycloak.client.resource.ClientResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleMappingResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleScopeResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n/**\n * <p>It provides a default set of users and roles for mocking a keycloak service.</p>\n */\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic abstract class DefaultKeyCloakTest extends BaseKeyCloakTest {\n\n    public static final String USERNAME = \"user\";\n    public static final String ROLE = \"role\";\n    public static final int rolesCount = 50;\n    public static final int usersCount = 30;\n\n    protected final List<RoleResource> roleResources = new ArrayList<RoleResource>();\n    protected final List<RoleRepresentation> roleRepresentations = new ArrayList<RoleRepresentation>();\n    protected final List<UserResource> userResources = new ArrayList<UserResource>();\n    protected final List<UserRepresentation> userRepresentations = new ArrayList<UserRepresentation>();\n\n    @Before\n    public void setup() throws Exception {\n        super.setup();\n        // register roles\n        RoleRegistry.get().clear();\n        RoleRegistry.get().registerRole(\"admin\");\n        RoleRegistry.get().registerRole(\"developer\");\n\n        // Groups.\n        for (int x = 0; x < rolesCount; x++) {\n            String name = ROLE + x;\n            addRole(name);\n        }\n        addRole(\"admin\");\n        addRole(\"developer\");\n        when(rolesResource.get(any())).thenAnswer(new Answer<RoleResource>() {\n            @Override\n            public RoleResource answer(InvocationOnMock invocationOnMock) throws Throwable {\n                String name = (String) invocationOnMock.getArguments()[0];\n                return getRole(roleResources,\n                               name);\n            }\n        });\n        when(rolesResource.list()).thenReturn(roleRepresentations);\n\n        ClientResource clientResource = mock(ClientResource.class);\n        when(clientResource.roles()).thenReturn(rolesResource);\n        when(clientsResource.get(anyString())).thenReturn(clientResource);\n\n        ClientRepresentation clientRepresentation = mock(ClientRepresentation.class);\n        when(clientRepresentation.getId()).thenReturn(\"clientId\");\n        when(clientsResource.findByClientId(any())).thenReturn(new Lists.Builder<ClientRepresentation>().add(clientRepresentation).build());\n        when(realmResource.clients()).thenReturn(clientsResource);\n\n        // Users.\n        for (int x = 0; x < usersCount; x++) {\n            String username = USERNAME + x;\n            UserResource userResource = mock(UserResource.class);\n            mockUserResource(userResource,\n                             username);\n            userResources.add(userResource);\n            userRepresentations.add(userResource.toRepresentation());\n        }\n        when(usersResource.get(any())).thenAnswer(new Answer<UserResource>() {\n            @Override\n            public UserResource answer(InvocationOnMock invocationOnMock) throws Throwable {\n                String id = (String) invocationOnMock.getArguments()[0];\n                return getUser(userResources,\n                               id);\n            }\n        });\n        when(usersResource.search(any(),\n                                  any(),\n                                  any())).thenAnswer(new Answer<List<UserRepresentation>>() {\n            @Override\n            public List<UserRepresentation> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                String pattern = (String) invocationOnMock.getArguments()[0];\n                Integer start = (Integer) invocationOnMock.getArguments()[1];\n                Integer size = (Integer) invocationOnMock.getArguments()[2];\n\n                if (start == 1 && size == Integer.MAX_VALUE) {\n                    return userRepresentations;\n                }\n\n                List<UserRepresentation> result = getUserRepresentations(pattern,\n                                                                         start,\n                                                                         size);\n                return result;\n            }\n        });\n        when(usersResource.list()).thenAnswer(new Answer<List<UserRepresentation>>() {\n            @Override\n            public List<UserRepresentation> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return userRepresentations;\n            }\n        });\n        when(usersResource.search(any(),\n                                  any(),\n                                  any(),\n                                  any(),\n                                  any(),\n                                  any())).thenAnswer(new Answer<List<UserRepresentation>>() {\n            @Override\n            public List<UserRepresentation> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                String pattern = (String) invocationOnMock.getArguments()[0];\n                Integer start = (Integer) invocationOnMock.getArguments()[4];\n                Integer size = (Integer) invocationOnMock.getArguments()[5];\n                List<UserRepresentation> result = getUserRepresentations(pattern,\n                                                                         start,\n                                                                         size);\n                return result;\n            }\n        });\n        ClientResponse response = mock(ClientResponse.class);\n        when(response.getStatus()).thenReturn(200);\n        when(usersResource.create(any())).thenReturn(response);\n    }\n\n    protected ClientResponseFailure mockForbiddenResponse() {\n        ClientResponseFailure error = mock(ClientResponseFailure.class);\n        ClientResponse response = mock(ClientResponse.class);\n        Response.Status responseStatus = Response.Status.FORBIDDEN;\n        when(error.getResponse()).thenReturn(response);\n        when(response.getResponseStatus()).thenReturn(responseStatus);\n        return error;\n    }\n\n    private List<UserRepresentation> getUserRepresentations(String pattern,\n                                                            int start,\n                                                            int size) {\n        List<UserRepresentation> result = null;\n        if (isEmpty(pattern)) {\n            result = userRepresentations.subList(start,\n                                                 start + size);\n        } else {\n            UserResource userResource = getUser(userResources,\n                                                pattern);\n            if (userResource != null) {\n                result = new ArrayList<UserRepresentation>(1);\n                result.add(userResource.toRepresentation());\n            }\n        }\n        return result;\n    }\n\n    private boolean isEmpty(String str) {\n        return str == null || str.trim().length() == 0;\n    }\n\n    private void mockUserResource(UserResource userResource,\n                                  String username) {\n        UserRepresentation userRepresentation = mock(UserRepresentation.class);\n        when(userResource.toRepresentation()).thenReturn(userRepresentation);\n        mockUserRepresentation(userRepresentation,\n                               username);\n        RoleMappingResource roleMappingResource = mock(RoleMappingResource.class);\n        when(userResource.roles()).thenReturn(roleMappingResource);\n        RoleScopeResource roleScopeResource = mock(RoleScopeResource.class);\n        when(roleMappingResource.realmLevel()).thenReturn(roleScopeResource);\n        mockRoleMappingResource(roleMappingResource);\n    }\n\n    private void mockUserRepresentation(UserRepresentation userRepresentation,\n                                        String username) {\n        when(userRepresentation.getUsername()).thenReturn(username);\n        String id = username;\n        String fName = username.toUpperCase();\n        String lName = fName + \"Last\";\n        String mail = username + \"@jboss.org\";\n        when(userRepresentation.getId()).thenReturn(id);\n        when(userRepresentation.getFirstName()).thenReturn(fName);\n        when(userRepresentation.getLastName()).thenReturn(lName);\n        when(userRepresentation.getEmail()).thenReturn(mail);\n        when(userRepresentation.isEmailVerified()).thenReturn(true);\n        when(userRepresentation.isEnabled()).thenReturn(true);\n        Map<String, List<String>> attributes = new HashMap<String, List<String>>(6);\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_ID,\n                       Arrays.asList(id));\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_FIRST_NAME,\n                       Arrays.asList(fName));\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_LAST_NAME,\n                       Arrays.asList(lName));\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_ENABLED,\n                       Arrays.asList(\"true\"));\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_EMAIL,\n                       Arrays.asList(mail));\n        attributes.put(BaseKeyCloakManager.ATTRIBUTE_USER_EMAIL_VERIFIED,\n                       Arrays.asList(\"true\"));\n        when(userRepresentation.getAttributes()).thenReturn(attributes);\n    }\n\n    private void mockRoleMappingResource(RoleMappingResource roleMappingResource) {\n        RoleScopeResource roleScopeResource = mock(RoleScopeResource.class);\n        when(roleMappingResource.realmLevel()).thenReturn(roleScopeResource);\n        mockRoleScopeResource(roleScopeResource);\n    }\n\n    private void mockRoleScopeResource(RoleScopeResource roleScopeResource) {\n        when(roleScopeResource.listEffective()).thenReturn(roleRepresentations);\n    }\n\n    private void mockRoleResource(RoleResource roleResource,\n                                  String name) {\n        RoleRepresentation roleRepresentation = mock(RoleRepresentation.class);\n        when(roleResource.toRepresentation()).thenReturn(roleRepresentation);\n        mockRoleRepresentation(roleRepresentation,\n                               name);\n    }\n\n    private void mockRoleRepresentation(RoleRepresentation roleRepresentation,\n                                        String name) {\n        String id = Integer.toString(name.hashCode());\n        String description = \"Role \" + name;\n        when(roleRepresentation.getId()).thenReturn(id);\n        when(roleRepresentation.getName()).thenReturn(name);\n        when(roleRepresentation.getDescription()).thenReturn(description);\n        when(roleRepresentation.isComposite()).thenReturn(false);\n    }\n\n    private RoleResource getRole(List<RoleResource> roleResources,\n                                 String name) {\n        for (RoleResource roleResource : roleResources) {\n            if (roleResource.toRepresentation().getName().equals(name)) {\n                return roleResource;\n            }\n        }\n        return null;\n    }\n\n    private UserResource getUser(List<UserResource> userResources,\n                                 String id) {\n        for (UserResource userResource : userResources) {\n            if (userResource.toRepresentation().getId().equals(id)) {\n                return userResource;\n            }\n        }\n        return null;\n    }\n\n    private void addRole(String name) {\n        RoleResource roleResource = mock(RoleResource.class);\n        mockRoleResource(roleResource,\n                         name);\n        roleResources.add(roleResource);\n        roleRepresentations.add(roleResource.toRepresentation());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/KCCredentialsUserManagementServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.UberfireRoleManager;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KCCredentialsUserManagementServiceTest {\n\n    @Mock\n    KeyCloakUserManager userManager;\n    @Mock\n    KeyCloakGroupManager groupManager;\n    @Mock\n    CredentialsClientFactory clientFactory;\n    @Mock\n    UberfireRoleManager roleManager;\n    private KCCredentialsUserManagementService tested;\n\n    @Before\n    public void setup() throws Exception {\n        this.tested = new KCCredentialsUserManagementService(userManager,\n                                                             groupManager,\n                                                             clientFactory,\n                                                             roleManager);\n    }\n\n    @Test\n    public void testInit() {\n        this.tested.init();\n        verify(clientFactory,\n               times(1)).init(any(ConfigProperties.class));\n        verify(userManager,\n               times(1)).init(clientFactory);\n        verify(groupManager,\n               times(1)).init(clientFactory);\n    }\n\n    @Test\n    public void testGetUsersManager() {\n        Assert.assertEquals(userManager,\n                            tested.users());\n    }\n\n    @Test\n    public void testGetGroupsManager() {\n        Assert.assertEquals(groupManager,\n                            tested.groups());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/KCSSOUserManagementServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.UberfireRoleManager;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KCSSOUserManagementServiceTest {\n\n    @Mock\n    KeyCloakUserManager userManager;\n    @Mock\n    KeyCloakGroupManager groupManager;\n    @Mock\n    KCAdapterClientFactory clientFactory;\n    @Mock\n    HttpServletRequest request;\n    @Mock\n    UberfireRoleManager roleManager;\n    private KCAdapterUserManagementService tested;\n\n    @Before\n    public void setup() throws Exception {\n        this.tested = new KCAdapterUserManagementService(userManager,\n                                                         groupManager,\n                                                         clientFactory,\n                                                         request,\n                                                         roleManager);\n    }\n\n    @Test\n    public void testInit() {\n        this.tested.init();\n        verify(clientFactory,\n               times(1)).init(any(ConfigProperties.class),\n                              eq(request));\n        verify(userManager,\n               times(1)).init(clientFactory);\n        verify(groupManager,\n               times(1)).init(clientFactory);\n    }\n\n    @Test\n    public void testGetUsersManager() {\n        Assert.assertEquals(userManager,\n                            tested.users());\n    }\n\n    @Test\n    public void testGetGroupsManager() {\n        Assert.assertEquals(groupManager,\n                            tested.groups());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/KeyCloakGroupManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.RealmManagementNotAuthorizedException;\nimport org.uberfire.ext.security.management.api.exception.UnsupportedServiceCapabilityException;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleMappingResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleScopeResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RolesResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\n\nimport static junit.framework.TestCase.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class KeyCloakGroupManagerTest extends DefaultKeyCloakTest {\n\n    private KeyCloakGroupManager groupsManager;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() throws Exception {\n        super.setup();\n        initGroupManager();\n        doAnswer(invocationOnMock -> {\n            ((Consumer<RealmResource>) invocationOnMock.getArguments()[0]).accept(realmResource);\n            return null;\n        }).when(groupsManager).consumeRealm(any(Consumer.class));\n    }\n\n    @Test\n    public void testCapabilities() {\n        assertEquals(groupsManager.getCapabilityStatus(Capability.CAN_SEARCH_GROUPS),\n                     CapabilityStatus.ENABLED);\n        assertEquals(groupsManager.getCapabilityStatus(Capability.CAN_READ_GROUP),\n                     CapabilityStatus.ENABLED);\n        assertEquals(groupsManager.getCapabilityStatus(Capability.CAN_ADD_GROUP),\n                     CapabilityStatus.ENABLED);\n        assertEquals(groupsManager.getCapabilityStatus(Capability.CAN_DELETE_GROUP),\n                     CapabilityStatus.ENABLED);\n        assertEquals(groupsManager.getCapabilityStatus(Capability.CAN_UPDATE_GROUP),\n                     CapabilityStatus.UNSUPPORTED);\n    }\n\n    @Test\n    public void testAllowsEmpty() {\n        assertTrue(groupsManager.getSettings().allowEmpty());\n    }\n\n    @Test(expected = RealmManagementNotAuthorizedException.class)\n    public void testGroupNotAuthorized() throws Exception {\n        initGroupManager();\n        doThrow(mockForbiddenResponse()).when(keycloakMock).realm();\n        groupsManager.get(ROLE);\n    }\n\n    @Test\n    public void testGetGroup5() {\n        String name = ROLE + 5;\n        Group group = groupsManager.get(name);\n        assertGroup(group,\n                    name);\n    }\n    @Test(expected = GroupNotFoundException.class)\n    public void testGetGroup200() {\n        String name = ROLE + 200;\n        Group group = groupsManager.get(name);\n    }\n\n    @Test\n    public void testGetAllGroups() {\n        List<Group> groups = groupsManager.getAll();\n        assertEquals(52, roleResources.size());\n        assertEquals(50, groups.size());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testSearchPageZero() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             0,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<Group> response = groupsManager.search(request);\n    }\n\n    @Test\n    public void testSearchAllFirstPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             1,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<Group> response = groupsManager.search(request);\n        assertNotNull(response);\n        List<Group> groups = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     rolesCount);\n        assertTrue(hasNextPage);\n        assertEquals(groups.size(),\n                     5);\n        Group group0 = groups.get(0);\n        assertGroup(group0,\n                    ROLE + 0);\n        Group group4 = groups.get(4);\n        assertGroup(group4,\n                    ROLE + 4);\n    }\n\n    @Test\n    public void testSearchAllSecondPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             2,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<Group> response = groupsManager.search(request);\n        assertNotNull(response);\n        List<Group> groups = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     rolesCount);\n        assertTrue(hasNextPage);\n        assertEquals(groups.size(),\n                     5);\n        Group group5 = groups.get(0);\n        assertGroup(group5,\n                    ROLE + 5);\n        Group group9 = groups.get(4);\n        assertGroup(group9,\n                    ROLE + 9);\n    }\n\n    @Test\n    public void testSearchAllLastPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             10,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<Group> response = groupsManager.search(request);\n        assertNotNull(response);\n        List<Group> groups = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     rolesCount);\n\n        assertTrue(!hasNextPage);\n        assertEquals(groups.size(),\n                     5);\n        Group group45 = groups.get(0);\n        assertGroup(group45,\n                    ROLE + 45);\n        Group group49 = groups.get(4);\n        assertGroup(group49,\n                    ROLE + 49);\n    }\n\n    @Test\n    public void testCreateGroup() {\n        String groupName = \"newgroup\";\n        Group newgroup = groupsManager.create(SecurityManagementUtils.createGroup(\"newgroup\"));\n        assertGroup(newgroup, groupName);\n    }\n\n    @Test(expected = UnsupportedServiceCapabilityException.class)\n    public void testUpdateGroup() {\n        groupsManager.update(SecurityManagementUtils.createGroup(\"id1\"));\n    }\n\n    @Test\n    public void testDeleteGroup() {\n        RoleResource role0Resource = roleResources.get(0);\n        groupsManager.delete(\"role0\");\n        verify(role0Resource,\n               times(1)).remove();\n    }\n\n    @Test\n    public void testAssignUsers() {\n        final Collection<String> users = new ArrayList<String>();\n        users.add(\"user0\");\n        UserResource user0Resource = userResources.get(0);\n        RoleMappingResource roleMappingResource = user0Resource.roles();\n        RoleScopeResource roleScopeResource = roleMappingResource.realmLevel();\n        groupsManager.assignUsers(\"role0\",\n                                  users);\n        ArgumentCaptor<List> rolesCaptor = ArgumentCaptor.forClass(List.class);\n        verify(roleScopeResource,\n               times(1)).add(rolesCaptor.capture());\n        List rolesAdded = rolesCaptor.getValue();\n        assertEquals(1,\n                     rolesAdded.size());\n    }\n\n    @Test\n    public void testGetClientById() {\n        String clientId = groupsManager.getClientIdByName(realmResource);\n        assertEquals(\"clientId\", clientId);\n    }\n\n    @Test\n    public void testGetRoleResource() {\n        RolesResource rolesResource = groupsManager.getRolesResource(realmResource, true);\n        assertEquals(52, rolesResource.list().size());\n    }\n\n    @Test\n    public void testGetClientRoles() {\n        String name = ROLE + 5;\n        when(groupsManager.getRolesResource(realmResource, true)).thenReturn(rolesResource);\n        Group group = groupsManager.get(name);\n        assertGroup(group,\n                    name);\n    }\n\n    private void assertGroup(Group group,\n                             String name) {\n        assertNotNull(group);\n        assertEquals(name,\n                     group.getName());\n    }\n\n    private void initGroupManager() throws Exception {\n        groupsManager = spy(new KeyCloakGroupManager());\n        doReturn(keycloakMock).when(groupsManager).getKeyCloakInstance();\n        groupsManager.initialize(userSystemManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/KeyCloakUserManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.keycloak.representations.idm.CredentialRepresentation;\nimport org.keycloak.representations.idm.UserRepresentation;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.exception.RealmManagementNotAuthorizedException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RealmResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleMappingResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.RoleScopeResource;\nimport org.uberfire.ext.security.management.keycloak.client.resource.UserResource;\n\nimport static junit.framework.TestCase.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class KeyCloakUserManagerTest extends DefaultKeyCloakTest {\n\n    private KeyCloakUserManager usersManager;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() throws Exception {\n        super.setup();\n        initUserManager();\n        doAnswer(invocationOnMock -> {\n            ((Consumer<RealmResource>) invocationOnMock.getArguments()[0]).accept(realmResource);\n            return null;\n        }).when(usersManager).consumeRealm(any(Consumer.class));\n    }\n\n    @Test\n    public void testCapabilities() {\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_SEARCH_USERS),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_READ_USER),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_UPDATE_USER),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_ADD_USER),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_DELETE_USER),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_MANAGE_ATTRIBUTES),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_ASSIGN_GROUPS),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_CHANGE_PASSWORD),\n                     CapabilityStatus.ENABLED);\n        assertEquals(usersManager.getCapabilityStatus(Capability.CAN_ASSIGN_ROLES),\n                     CapabilityStatus.ENABLED);\n    }\n\n    @Test\n    public void testAttributes() {\n        final Collection<UserManager.UserAttribute> USER_ATTRIBUTES =\n                Arrays.asList(BaseKeyCloakManager.USER_ID,\n                              BaseKeyCloakManager.USER_FIST_NAME,\n                              BaseKeyCloakManager.USER_LAST_NAME,\n                              BaseKeyCloakManager.USER_ENABLED,\n                              BaseKeyCloakManager.USER_EMAIL,\n                              BaseKeyCloakManager.USER_EMAIL_VERIFIED);\n        Collection<UserManager.UserAttribute> attributes = usersManager.getSettings().getSupportedAttributes();\n        assertEquals(attributes,\n                     USER_ATTRIBUTES);\n    }\n\n    @Test(expected = RealmManagementNotAuthorizedException.class)\n    public void testUserNotAuthorized() throws Exception {\n        initUserManager();\n        doThrow(mockForbiddenResponse()).when(keycloakMock).realm();\n        usersManager.get(USERNAME);\n    }\n\n    @Test\n    public void testGetUser5() {\n        String username = USERNAME + 5;\n        User user = usersManager.get(username);\n        assertUser(user,\n                   username);\n    }\n\n    @Test(expected = UserNotFoundException.class)\n    public void testGetUser50() {\n        String username = USERNAME + 50;\n        User user = usersManager.get(username);\n        assertNull(user);\n    }\n\n    @Test\n    public void testGetAllUsers() {\n        List<User> users = usersManager.getAll();\n        Assert.assertEquals(usersCount, users.size());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testSearchPageZero() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             0,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);\n    }\n\n    @Test\n    public void testSearchAllFirstPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             1,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);\n        assertNotNull(response);\n        List<User> users = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     usersCount);\n        assertTrue(hasNextPage);\n        assertEquals(users.size(),\n                     5);\n        User user0 = users.get(0);\n        assertUser(user0,\n                   USERNAME + 0);\n        User user4 = users.get(4);\n        assertUser(user4,\n                   USERNAME + 4);\n    }\n\n    @Test\n    public void testSearchAllSecondPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             2,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);\n        assertNotNull(response);\n        List<User> users = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     usersCount);\n        assertTrue(hasNextPage);\n        assertEquals(users.size(),\n                     5);\n        User user5 = users.get(0);\n        assertUser(user5,\n                   USERNAME + 5);\n        User user9 = users.get(4);\n        assertUser(user9,\n                   USERNAME + 9);\n    }\n\n    @Test\n    public void testSearchAllThirdPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             3,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);\n        assertNotNull(response);\n        List<User> users = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     usersCount);\n        assertTrue(hasNextPage);\n        assertEquals(users.size(),\n                     5);\n        User user10 = users.get(0);\n        assertUser(user10,\n                   USERNAME + 10);\n        User user14 = users.get(4);\n        assertUser(user14,\n                   USERNAME + 14);\n    }\n\n    @Test\n    public void testSearchAllLastPage() {\n        AbstractEntityManager.SearchRequest request = buildSearchRequestMock(\"\",\n                                                                             4,\n                                                                             5);\n        AbstractEntityManager.SearchResponse<User> response = usersManager.search(request);\n        assertNotNull(response);\n        List<User> users = response.getResults();\n        int total = response.getTotal();\n        boolean hasNextPage = response.hasNextPage();\n        assertEquals(total,\n                     usersCount);\n        assertTrue(hasNextPage);\n        assertEquals(users.size(),\n                     5);\n        User user15 = users.get(0);\n        assertUser(user15,\n                   USERNAME + 15);\n        User user19 = users.get(4);\n        assertUser(user19,\n                   USERNAME + 19);\n    }\n\n    @Test\n    public void testCreateUser() {\n        User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user0\");\n        User userCreated = usersManager.create(user);\n        assertNotNull(userCreated);\n        verify(usersResource,\n               times(1)).create(any(UserRepresentation.class));\n    }\n\n    @Test\n    public void testUpdateUser() {\n        User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user0\");\n        UserResource user0Resource = userResources.get(0);\n        User userUpdated = usersManager.update(user);\n        assertNotNull(userUpdated);\n        verify(user0Resource,\n               times(1)).update(any(UserRepresentation.class));\n    }\n\n    @Test\n    public void testDeleteUser() {\n        UserResource user0Resource = userResources.get(0);\n        usersManager.delete(\"user0\");\n        verify(user0Resource,\n               times(1)).remove();\n    }\n\n    @Test\n    public void testChangePassword() {\n        UserResource user0Resource = userResources.get(0);\n        usersManager.changePassword(\"user0\",\n                                    \"newPassword\");\n        verify(user0Resource,\n               times(1)).resetPassword(any(CredentialRepresentation.class));\n    }\n\n    @Test\n    public void testAssignGroups() {\n        final User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user0\");\n        when(user.getRoles()).thenReturn(new HashSet<Role>());\n        UserManager userManagerMock = mock(UserManager.class);\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return user;\n            }\n        }).when(userManagerMock).get(\"user0\");\n        when(userSystemManager.users()).thenReturn(userManagerMock);\n        final Collection<String> groups = new ArrayList<String>();\n        groups.add(\"role1\");\n        groups.add(\"role2\");\n        UserResource user0Resource = userResources.get(0);\n        RoleMappingResource roleMappingResource = user0Resource.roles();\n        RoleScopeResource roleScopeResource = roleMappingResource.realmLevel();\n        usersManager.assignGroups(\"user0\",\n                                  groups);\n        ArgumentCaptor<List> rolesCaptor = ArgumentCaptor.forClass(List.class);\n        verify(roleScopeResource,\n               times(1)).add(rolesCaptor.capture());\n        List rolesAdded = rolesCaptor.getValue();\n        assertEquals(2,\n                     rolesAdded.size());\n    }\n\n    @Test\n    public void testAssignRoles() {\n        final User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user0\");\n        when(user.getGroups()).thenReturn(new HashSet<Group>());\n        UserManager userManagerMock = mock(UserManager.class);\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return user;\n            }\n        }).when(userManagerMock).get(\"user0\");\n        when(userSystemManager.users()).thenReturn(userManagerMock);\n        final Collection<String> roles = new ArrayList<String>();\n        roles.add(\"role1\");\n        roles.add(\"role2\");\n        UserResource user0Resource = userResources.get(0);\n        RoleMappingResource roleMappingResource = user0Resource.roles();\n        RoleScopeResource roleScopeResource = roleMappingResource.realmLevel();\n        usersManager.assignRoles(\"user0\",\n                                 roles);\n        ArgumentCaptor<List> rolesCaptor = ArgumentCaptor.forClass(List.class);\n        verify(roleScopeResource,\n               times(1)).add(rolesCaptor.capture());\n        List rolesAdded = rolesCaptor.getValue();\n        assertEquals(2,\n                     rolesAdded.size());\n    }\n\n    private void assertUser(User user,\n                            String username) {\n        assertNotNull(user);\n        assertEquals(username,\n                     user.getIdentifier());\n        Map<String, String> attributes = user.getProperties();\n        assertNotNull(attributes);\n        assertTrue(attributes.size() >= 4);\n        final String id = attributes.get(BaseKeyCloakManager.ATTRIBUTE_USER_ID);\n        assertNotNull(id);\n        assertTrue(id.trim().length() > 0);\n        final String firstName = attributes.get(BaseKeyCloakManager.ATTRIBUTE_USER_FIRST_NAME);\n        assertNotNull(firstName);\n        assertEquals(username.toUpperCase(),\n                     firstName);\n        final String lastName = attributes.get(BaseKeyCloakManager.ATTRIBUTE_USER_LAST_NAME);\n        assertNotNull(lastName);\n        assertEquals(username.toUpperCase() + \"Last\",\n                     lastName);\n        final String enabled = attributes.get(BaseKeyCloakManager.ATTRIBUTE_USER_ENABLED);\n        assertNotNull(enabled);\n        assertEquals(enabled,\n                     \"true\");\n        final String email = attributes.get(BaseKeyCloakManager.ATTRIBUTE_USER_EMAIL);\n        assertNotNull(email);\n        assertEquals(email,\n                     username + \"@jboss.org\");\n    }\n\n    private void initUserManager() throws Exception {\n        usersManager = spy(new KeyCloakUserManager());\n        doReturn(keycloakMock).when(usersManager).getKeyCloakInstance();\n        usersManager.initialize(userSystemManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/client/auth/AuthenticationClientExecutionInterceptorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth;\n\nimport javax.ws.rs.core.HttpHeaders;\n\nimport org.jboss.resteasy.client.ClientRequest;\nimport org.jboss.resteasy.client.ClientResponse;\nimport org.jboss.resteasy.spi.interception.ClientExecutionContext;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AuthenticationClientExecutionInterceptorTest {\n\n    @Mock\n    TokenManager tokenManager;\n\n    private BearerAuthenticationInterceptor interceptor;\n\n    @Before\n    public void setup() throws Exception {\n        when(tokenManager.getAccessTokenString()).thenReturn(\"token1\");\n        this.interceptor = new BearerAuthenticationInterceptor(tokenManager);\n    }\n\n    @Test\n    public void testExecute() throws Exception {\n        ClientExecutionContext ctx = mock(ClientExecutionContext.class);\n        ClientRequest request = mock(ClientRequest.class);\n        ClientResponse response = mock(ClientResponse.class);\n        when(ctx.getRequest()).thenReturn(request);\n        when(ctx.proceed()).thenReturn(response);\n        ClientResponse response1 = this.interceptor.execute(ctx);\n        verify(request,\n               times(1)).header(eq(HttpHeaders.AUTHORIZATION),\n                                eq(\"Bearer token1\"));\n        Assert.assertEquals(response,\n                            response1);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/client/auth/adapter/KCAdapterContextTokenManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.keycloak.client.auth.adapter;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpSession;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.keycloak.KeycloakSecurityContext;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KCAdapterContextTokenManagerTest {\n\n    @Mock\n    HttpServletRequest request;\n    \n    @Mock\n    HttpSession session;\n    \n    @Mock\n    KeycloakSecurityContext context;\n\n    private KCAdapterContextTokenManager tested;\n\n    @Before\n    public void setup() throws Exception {\n        when(request.getAttribute(KeycloakSecurityContext.class.getName())).thenReturn(context);\n        when(context.getTokenString()).thenReturn(\"token1\");\n        when(context.getRealm()).thenReturn(\"realm1\");\n        this.tested = new KCAdapterContextTokenManager(request);\n    }\n\n    @Test\n    public void testGetAccessTokenString() throws Exception {\n        String s = this.tested.getAccessTokenString();\n        Assert.assertEquals(\"token1\",\n                            s);\n    }\n\n    @Test\n    public void testGetRealm() throws Exception {\n        String s = this.tested.getRealm();\n        Assert.assertEquals(\"realm1\",\n                            s);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/client/auth/credentials/AuthTokenManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.client.auth.credentials;\n\nimport javax.ws.rs.core.MultivaluedMap;\n\nimport org.jboss.resteasy.client.exception.ResteasyClientException;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.keycloak.OAuth2Constants;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.keycloak.client.auth.TokenService;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AuthTokenManagerTest {\n\n    @Mock\n    AuthSettings config;\n\n    private AuthTokenManager tokenManager;\n    private TokenService tokenService;\n    private AccessTokenResponse response;\n\n    @Before\n    public void setup() throws Exception {\n        when(config.getUsername()).thenReturn(\"user1\");\n        when(config.getRealm()).thenReturn(\"realm1\");\n        when(config.getResource()).thenReturn(\"kie\");\n        when(config.getClientId()).thenReturn(\"clientId1\");\n        when(config.getClientSecret()).thenReturn(\"clientSecret1\");\n        when(config.getPassword()).thenReturn(\"password1\");\n        when(config.isPublicClient()).thenReturn(false);\n        this.tokenManager = spy(new AuthTokenManager(config));\n        this.tokenService = mock(TokenService.class);\n        doReturn(tokenService).when(this.tokenManager).createTokenService();\n        this.response = mock(AccessTokenResponse.class);\n        doReturn(response).when(tokenService).grantToken(anyString(),\n                                                         anyString(),\n                                                         any(MultivaluedMap.class));\n        when(response.getRefreshToken()).thenReturn(\"refreshToken\");\n    }\n\n    @Test\n    public void testGetRealm() throws Exception {\n        String r = this.tokenManager.getRealm();\n        Assert.assertEquals(\"realm1\",\n                            r);\n    }\n\n    @Test\n    public void testGetResource() throws Exception {\n        String r = this.tokenManager.getResource();\n        Assert.assertEquals(\"kie\",\n                            r);\n    }\n\n    @Test\n    public void testGetAccessTokenString() throws Exception {\n        AccessTokenResponse response = mock(AccessTokenResponse.class);\n        when(response.getToken()).thenReturn(\"token2\");\n        this.tokenManager.accessTokenResponse = response;\n        this.tokenManager.expirationTime = Long.MAX_VALUE;\n        this.tokenManager.minTokenValidity = 0;\n        String s = this.tokenManager.getAccessTokenString();\n        Assert.assertEquals(\"token2\",\n                            s);\n    }\n\n    @Test\n    public void testGrantToken() throws Exception {\n        when(response.getExpiresIn()).thenReturn(1000l);\n        this.tokenManager.grantToken();\n        ArgumentCaptor<MultivaluedMap> mapCaptor = ArgumentCaptor.forClass(MultivaluedMap.class);\n        verify(this.tokenService,\n               times(1)).grantToken(eq(\"realm1\"),\n                                    anyString(),\n                                    mapCaptor.capture());\n        MultivaluedMap<String, String> mvm = mapCaptor.getValue();\n        Assert.assertEquals(\"user1\",\n                            mvm.get(\"username\").get(0));\n        Assert.assertEquals(\"password1\",\n                            mvm.get(\"password\").get(0));\n    }\n\n    @Test\n    public void testGrantPublicToken() throws Exception {\n        when(response.getExpiresIn()).thenReturn(1000l);\n        when(config.isPublicClient()).thenReturn(true);\n        this.tokenManager.grantToken();\n        ArgumentCaptor<MultivaluedMap> mapCaptor = ArgumentCaptor.forClass(MultivaluedMap.class);\n        verify(this.tokenService,\n               times(1)).grantToken(eq(\"realm1\"),\n                                    anyString(),\n                                    mapCaptor.capture());\n        MultivaluedMap<String, String> mvm = mapCaptor.getValue();\n        Assert.assertEquals(\"password\",\n                            mvm.get(OAuth2Constants.GRANT_TYPE).get(0));\n        Assert.assertEquals(\"user1\",\n                            mvm.get(\"username\").get(0));\n        Assert.assertEquals(\"password1\",\n                            mvm.get(\"password\").get(0));\n        Assert.assertEquals(\"clientId1\",\n                            mvm.get(OAuth2Constants.CLIENT_ID).get(0));\n    }\n\n    @Test\n    public void testRefreshToken() throws Exception {\n        when(response.getExpiresIn()).thenReturn(1000l);\n        this.tokenManager.accessTokenResponse = response;\n        this.tokenManager.expirationTime = 0;\n        this.tokenManager.minTokenValidity = 100;\n        String s = this.tokenManager.getAccessTokenString();\n        ArgumentCaptor<MultivaluedMap> mapCaptor = ArgumentCaptor.forClass(MultivaluedMap.class);\n        verify(this.tokenService,\n               times(1)).grantToken(eq(\"realm1\"),\n                                    anyString(),\n                                    mapCaptor.capture());\n        MultivaluedMap<String, String> mvm = mapCaptor.getValue();\n        Assert.assertEquals(\"refresh_token\",\n                            mvm.get(OAuth2Constants.GRANT_TYPE).get(0));\n        Assert.assertEquals(\"refreshToken\",\n                            mvm.get(\"refresh_token\").get(0));\n    }\n\n    @Test\n    public void testRefreshPublicToken() throws Exception {\n        when(response.getExpiresIn()).thenReturn(1000l);\n        when(config.isPublicClient()).thenReturn(true);\n        this.tokenManager.accessTokenResponse = response;\n        this.tokenManager.expirationTime = 0;\n        this.tokenManager.minTokenValidity = 100;\n        String s = this.tokenManager.getAccessTokenString();\n        ArgumentCaptor<MultivaluedMap> mapCaptor = ArgumentCaptor.forClass(MultivaluedMap.class);\n        verify(this.tokenService,\n               times(1)).grantToken(eq(\"realm1\"),\n                                    anyString(),\n                                    mapCaptor.capture());\n        MultivaluedMap<String, String> mvm = mapCaptor.getValue();\n        Assert.assertEquals(\"refresh_token\",\n                            mvm.get(OAuth2Constants.GRANT_TYPE).get(0));\n        Assert.assertEquals(\"refreshToken\",\n                            mvm.get(\"refresh_token\").get(0));\n        Assert.assertEquals(\"clientId1\",\n                            mvm.get(OAuth2Constants.CLIENT_ID).get(0));\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void testClientError() throws Exception {\n        ResteasyClientException exception = mock(ResteasyClientException.class);\n        doThrow(exception).when(tokenService).grantToken(anyString(),\n                                                         anyString(),\n                                                         any(MultivaluedMap.class));\n        when(config.isPublicClient()).thenReturn(true);\n        this.tokenManager.grantToken();\n        Assert.assertNull(this.tokenManager.accessTokenResponse);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/elytron/KeyCloakElytronIdentityHelperProducerTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.elytron;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.security.elytron.DefaultElytronIdentityHelper;\nimport org.uberfire.backend.server.security.elytron.ElytronIdentityHelper;\nimport org.uberfire.ext.security.management.keycloak.KCAdapterUserManagementService;\nimport org.uberfire.ext.security.management.keycloak.KCCredentialsUserManagementService;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.uberfire.ext.security.management.keycloak.elytron.KeyCloakElytronIdentityHelperProducer.MANAGEMENT_SERVICES_SYSTEM_PROP;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KeyCloakElytronIdentityHelperProducerTest {\n\n    private KeyCloakElytronIdentityHelperProducer producer;\n\n    @Before\n    public void init() {\n        producer = new KeyCloakElytronIdentityHelperProducer();\n    }\n\n    @Test\n    public void testProduceKeycloakHelperCredentials() {\n        System.getProperties().setProperty(MANAGEMENT_SERVICES_SYSTEM_PROP, KCCredentialsUserManagementService.NAME);\n\n        producer.init();\n\n        ElytronIdentityHelper helper = producer.getDefaultElytronIdentityHelper();\n\n        assertNotNull(helper);\n        assertTrue(helper instanceof KeyCloakElytronIdentityHelper);\n    }\n\n    @Test\n    public void testProduceKeycloakHelperAdapter() {\n        System.getProperties().setProperty(MANAGEMENT_SERVICES_SYSTEM_PROP, KCAdapterUserManagementService.NAME);\n\n        producer.init();\n\n        ElytronIdentityHelper helper = producer.getDefaultElytronIdentityHelper();\n\n        assertNotNull(helper);\n        assertTrue(helper instanceof KeyCloakElytronIdentityHelper);\n    }\n\n    @Test\n    public void testProduceDefaultHelperAnyValue() {\n        System.getProperties().setProperty(MANAGEMENT_SERVICES_SYSTEM_PROP, \"any\");\n\n        producer.init();\n\n        ElytronIdentityHelper helper = producer.getDefaultElytronIdentityHelper();\n\n        assertNotNull(helper);\n        assertTrue(helper instanceof DefaultElytronIdentityHelper);\n    }\n\n    @Test\n    public void testProduceDefaultHelperNoValue() {\n        producer.init();\n\n        ElytronIdentityHelper helper = producer.getDefaultElytronIdentityHelper();\n\n        assertNotNull(helper);\n        assertTrue(helper instanceof DefaultElytronIdentityHelper);\n    }\n\n    @After\n    public void clear() {\n        System.getProperties().remove(MANAGEMENT_SERVICES_SYSTEM_PROP);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-keycloak/src/test/java/org/uberfire/ext/security/management/keycloak/elytron/KeyCloakElytronIdentityHelperTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.keycloak.elytron;\n\nimport javax.security.auth.callback.Callback;\nimport javax.security.auth.callback.NameCallback;\nimport javax.security.auth.callback.PasswordCallback;\nimport javax.security.auth.callback.TextInputCallback;\nimport javax.security.auth.login.LoginException;\n\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.keycloak.adapters.jaas.DirectAccessGrantsLoginModule;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.security.management.keycloak.elytron.KeyCloakElytronIdentityHelper.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KeyCloakElytronIdentityHelperTest {\n\n    private static final String USERNAME = \"user\";\n    private static final String PASSWORD = \"password\";\n\n    @Mock\n    private DirectAccessGrantsLoginModule loginModule;\n    private KeyCloakElytronIdentityHelper helper;\n\n    @Before\n    public void init() {\n        helper = new KeyCloakElytronIdentityHelper(loginModule);\n    }\n\n    @Test\n    public void testSuccessfulLogin() throws LoginException {\n        when(loginModule.login()).thenReturn(true);\n\n        helper.getIdentity(USERNAME, PASSWORD);\n\n        verify(loginModule).initialize(any(), any(), any(), any());\n        verify(loginModule).commit();\n        verify(loginModule).logout();\n    }\n\n    @Test(expected = FailedAuthenticationException.class)\n    public void testUnSuccessfulLogin() throws LoginException {\n        when(loginModule.login()).thenReturn(false);\n\n        helper.getIdentity(USERNAME, PASSWORD);\n\n        verify(loginModule).initialize(any(), any(), any(), any());\n        verify(loginModule, never()).commit();\n        verify(loginModule).logout();\n    }\n\n    @Test(expected = FailedAuthenticationException.class)\n    public void testUnSuccessfulLoginWithException() throws LoginException {\n\n        doThrow(new RuntimeException(\"error\")).when(loginModule).login();\n\n        helper.getIdentity(USERNAME, PASSWORD);\n\n        verify(loginModule).initialize(any(), any(), any(), any());\n        verify(loginModule, never()).commit();\n        verify(loginModule).logout();\n    }\n\n    @Test\n    public void testCallbackHandler() {\n\n        ElytronHelperCallbackHandler handler = new ElytronHelperCallbackHandler(USERNAME, PASSWORD);\n\n        NameCallback nameCallback = new NameCallback(\"Please fill in the user name\");\n        PasswordCallback passwordCallback = new PasswordCallback(\"Please fill in the password\", true);\n\n        handler.handle(new Callback[]{ nameCallback,\n                passwordCallback,\n                new TextInputCallback(\"Just for the test...\")\n        });\n\n        assertEquals(nameCallback.getName(), USERNAME);\n        assertEquals(new String(passwordCallback.getPassword()), PASSWORD);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/README.md",
    "content": "JBoss Wildfly / EAP provider for user and group management services\n=====================================================================\n\nIntroduction\n------------\nThe classes in this package contain the user and group manager implementations for JBoss Wildfly / EAP.                               \n \nThere are two JBoss Wildfly / EAP's service implementations, use any of the following ones that fits better in your environment:                       \n\n**JBoss Wildfly / EAP provider based on property files**                  \n\nThis provider supports realm types based on properties files (the default ones in JBoss server), such as `application-users.properties` or `application-roles.properties`.                                 \n\n* The user, group and role implementations are provided by `org.uberfire.ext.security.management.wildfly.properties.WildflyUserManagementService`              \n* The concrete user manager implementation is `org.uberfire.ext.security.management.wildfly.properties.WildflyUserPropertiesManager` which maps the Wildfly / EAP users for the given realm to application users\n\n* The concrete group manager implementation is `org.uberfire.ext.security.management.wildfly.properties.WildflyGroupPropertiesManager` which maps the Wildfly / EAP roles for the given realm to application groups. Wildfly/EAP realms do not have support for both groups and roles. The available roles are the ones statically defined in `org.uberfire.ext.security.server.RolesRegistry`. All other roles defined in Wildfly/EAP are considered groups.\n\n**JBoss Wildfly / EAP provider based on property files and CLI**                   \n\nThis provider supports realm types based on properties files, as the above one, but instead of specifying the file system paths for the users and roles property files to manage, you can just provide JBoss Wildfly native interface connection attributes, and this implementation will use CLI commands (use of CLI remote Java API) to discover the paths of the realm property files for you.                              \n\n* The user, group and role implementations are provided by `org.uberfire.ext.security.management.wildfly.cli.WildflyCLIUserManagementService`              \n* The concrete user manager implementation is `org.uberfire.ext.security.management.wildfly.cli.WildflyUserPropertiesCLIManager` which maps the Wildfly / EAP users for the given realm to application users\n\n* The concrete group manager implementation is `org.uberfire.ext.security.management.wildfly.cli.WildflyGroupPropertiesCLIManager` which maps the Wildfly / EAP roles for the given realm to application groups. Wildfly/EAP realms do not have support for both groups and roles. The available roles are the ones statically defined in `org.uberfire.ext.security.server.RolesRegistry`. All other roles defined in Wildfly/EAP are considered groups.\n                   \n\nInstallation notes\n------------------\n\nIf you are deploying the application in a Wildfly 8.X or an EAP 6.4, make sure you add the Wildfly / EAP controller and domain base module dependencies (provided by the server) into your application's classpath, \n by creating file or adding the following module dependencies in *jboss-deployment-descriptor.xml*:                                   \n\n        <jboss-deployment-structure>\n            <deployment>\n                <dependencies>\n                    <module name=\"org.jboss.as.controller-client\"/>\n                    <module name=\"org.jboss.as.domain-management\"/>\n                    <module name=\"org.jboss.sasl\"/>\n                    <module name=\"org.jboss.msc\"/>\n                    <module name=\"org.jboss.dmr\"/>\n                </dependencies>\n            </deployment>\n        </jboss-deployment-structure>\n\nAnd ensure you are excluding all Wildfly / EAP controller and domain libraries, if any, from your web applications classpath, as are provided by the container.                   \n\nUsage\n-----\n\n**Using the Wildfly / EAP provider based on property files**\n\nTo use this provider implementation for the users and groups management services, please choose one of the following options:               \n\na) Specify the concrete provider to use by adding a properties file named `security-management.properties` in your web application root classpath. \n(e.g. `src/main/resources/security-management.properties`), with the following keys and your concrete provider name as value:                               \n\n    org.uberfire.ext.security.management.api.userManagementServices=WildflyUserManagementService\n\nb) Specify the following Java system properties at container startup:        \n \n    -Dorg.uberfire.ext.security.management.api.userManagementServices=WildflyUserManagementService\n\nIn order to use any existing users/roles properties files from a JBoss Wildfly / EAP instance, the following system properties are required to be present at startup:                 \n\n* `org.uberfire.ext.security.management.wildfly.properties.realm` - The name of the realm to use. Property is not mandatory. Defaults to `ApplicationRealm`.                  \n* `org.uberfire.ext.security.management.wildfly.properties.users-file-path` - The absolute file path for the users properties file to manage. Property is mandatory. Defaults to `./standalone/configuration/application-users.properties`.                        \n* `org.uberfire.ext.security.management.wildfly.properties.groups-file-path` - The absolute file path for the groups properties file to manage. Property is mandatory. Defaults to `./standalone/configuration/application-roles.properties`.                        \n\n**Using Wildfly / EAP provider based on property files and CLI**\n\nTo use this provider implementation for the users and groups management services, please choose one of the following options:               \n\na) Specify the concrete provider to use by adding a properties file named `security-management.properties` in your web application root classpath. \n(e.g. `src/main/resources/security-management.properties`), with the following keys and your concrete provider name as value:                               \n\n    org.uberfire.ext.security.management.api.userManagementServices=WildflyCLIUserManagementService\n\n\nb) Specify the following Java system properties at container startup:        \n        \n    -Dorg.uberfire.ext.security.management.api.userManagementServices=WildflyCLIUserManagementService                                                                                   \n\nIn order to use any existing users/roles properties files from a JBoss Wildfly / EAP instance, the following system properties are required to be present at startup:                 \n\n* `org.uberfire.ext.security.management.wildfly.cli.host` - The native administration interface host. Property is not mandatory. Defaults to `localhost`.                                       \n* `org.uberfire.ext.security.management.wildfly.cli.port` - The native administration interface port. Property is not mandatory. Defaults to `9990`.                                       \n* `org.uberfire.ext.security.management.wildfly.cli.user` - The native administration interface username. Property is not mandatory. No default value provided. Only use it if you need to specify the administration credentials for managing the server instance.                                                      \n* `org.uberfire.ext.security.management.wildfly.cli.password` - The native administration interface user's password. Property is not mandatory. No default value provided. Only use it if you need to specify the administration credentials for managing the server instance.                                                                                 \n* `org.uberfire.ext.security.management.wildfly.cli.realm` - The realm used by the application's security context. Property is not mandatory. Default value is `ApplicationRealm`.                                         \n\nProvider capabilities\n---------------------\nThe Wildfly / EAP provider for users and groups management services provides the following features:                   \n\n**User service capabilities**\n* User search - Can search or list users. Search by `username`.          \n* Read user - Can read a user            \n* Create user - Can add new users            \n* Update user - Can update a user            \n* Delete user - Can delete a user            \n* Group assignment - Can manage groups for a user            \n* Role assignment - Can manage roles for a user             \n* Change password - Can change user's password            \n\n**Group service capabilities**\n* Group search - Can search or list groups. Search by `name` attribute.             \n* Read group - Can read a group            \n* Create group - Can add new groups            \n* Delete group - Can delete a group            \n\nNotes\n-----\n* Java7+\n* This implementation has been tested for JBoss Wildfly version `8.1.0.Final` and `8.2.0.Final` and for JBoss EAP version `6.4`.                \n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-security-management-wildfly</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Security Management - Provider Implementation for Wildfly</name>\n  <description>Uberfire Security Management - Provider Implementation for Wildfly</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.wildfly.security</groupId>\n      <artifactId>wildfly-elytron</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss</groupId>\n      <artifactId>jboss-dmr</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.msc</groupId>\n      <artifactId>jboss-msc</artifactId>\n    </dependency>\n\n    <!-- \n      NOTE:\n      If deploying into a JBoss Wildfly or EAP, there is no need to include these dependencies, \n      as they are provided by container's base modules if you use the jboss-deployment-descriptor. \n      -->\n    <dependency>\n      <groupId>org.wildfly.core</groupId>\n      <artifactId>wildfly-controller-client</artifactId>\n      <optional>true</optional>\n      <exclusions>\n        <exclusion>\n          <groupId>org.jboss.sasl</groupId>\n          <artifactId>jboss-sasl</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.wildfly.core</groupId>\n      <artifactId>wildfly-domain-management</artifactId>\n      <optional>true</optional>\n    </dependency>\n\n\n    <!-- Testing. -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/cli/BaseWildflyCLIManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.wildfly.cli;\n\nimport java.net.InetAddress;\n\nimport javax.security.auth.callback.Callback;\nimport javax.security.auth.callback.NameCallback;\nimport javax.security.auth.callback.PasswordCallback;\nimport javax.security.auth.callback.UnsupportedCallbackException;\nimport javax.security.sasl.RealmCallback;\n\nimport org.jboss.as.controller.client.ModelControllerClient;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.wildfly.filesystem.RealmProvider;\n\n/**\n * <p>Base class for JBoss Wildfly security management that uses the administration Java API for managing the command line interface.</p>\n * <p>Based on JBoss Wildfly administration API & Util classes.</p>\n *\n * @since 0.8.0\n */\npublic abstract class BaseWildflyCLIManager {\n\n    protected static final String DEFAULT_HOST = \"localhost\";\n    protected static final int DEFAULT_PORT = 9990;\n    protected static final String DEFAULT_ADMIN_USER = null;\n    protected static final String DEFAULT_ADMIN_PASSWORD = null;\n    protected String host;\n    protected int port;\n    protected String adminUser;\n    protected String adminPassword;\n    protected String folderPath;\n    protected String levels;\n    protected String encoded;\n\n    protected void loadConfig(final ConfigProperties config) {\n        final ConfigProperties.ConfigProperty host = config.get(\"org.uberfire.ext.security.management.wildfly.cli.host\",\n                                                                DEFAULT_HOST);\n        final ConfigProperties.ConfigProperty port = config.get(\"org.uberfire.ext.security.management.wildfly.cli.port\",\n                                                                Integer.toString(DEFAULT_PORT));\n        final ConfigProperties.ConfigProperty user = config.get(\"org.uberfire.ext.security.management.wildfly.cli.user\",\n                                                                DEFAULT_ADMIN_USER);\n        final ConfigProperties.ConfigProperty password = config.get(\"org.uberfire.ext.security.management.wildfly.cli.password\",\n                                                                    DEFAULT_ADMIN_PASSWORD);\n        final ConfigProperties.ConfigProperty realm = config.get(\"org.uberfire.ext.security.management.wildfly.cli.folderPath\",\n                                                                 RealmProvider.DEFAULT_FILE_SYSTEM_REALM_PATH);\n        final ConfigProperties.ConfigProperty levels = config.get(\"org.uberfire.ext.security.management.wildfly.cli.levels\",\n                                                                  RealmProvider.DEFAULT_FILE_SYSTEM_LEVELS);\n        final ConfigProperties.ConfigProperty encoded = config.get(\"org.uberfire.ext.security.management.wildfly.cli.encoded\",\n                                                                   RealmProvider.DEFAULT_FILE_SYSTEM_ENCODED);\n\n        this.host = host.getValue();\n        this.port = Integer.decode(port.getValue());\n        this.adminUser = user.getValue();\n        this.adminPassword = password.getValue();\n        this.folderPath = realm.getValue();\n        this.levels = levels.getValue();\n        this.encoded = encoded.getValue();\n    }\n\n    public ModelControllerClient getClient() throws Exception {\n        return ModelControllerClient.Factory.create(\n                InetAddress.getByName(host),\n                port,\n                callbacks -> {\n                    for (Callback current : callbacks) {\n                        if (current instanceof NameCallback) {\n                            NameCallback ncb = (NameCallback) current;\n                            ncb.setName(adminUser);\n                        } else if (current instanceof PasswordCallback) {\n                            PasswordCallback pcb = (PasswordCallback) current;\n                            pcb.setPassword(adminPassword.toCharArray());\n                        } else if (current instanceof RealmCallback) {\n                            RealmCallback rcb = (RealmCallback) current;\n                            rcb.setText(rcb.getDefaultText());\n                        } else {\n                            throw new UnsupportedCallbackException(current);\n                        }\n                    }\n                });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/cli/WildflyCLIUserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.wildfly.cli;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.ext.security.management.UberfireRoleManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.service.AbstractUserManagementService;\n\n/**\n * <p>The Wildfly/EAP management service beans for the CLI approach.</p>\n *\n * @since 0.8.0\n */\n@Dependent\n@Named(value = \"WildflyCLIUserManagementService\")\npublic class WildflyCLIUserManagementService extends AbstractUserManagementService {\n\n    WildflyUserFileSystemCLIManager userManager;\n    WildflyGroupFileSystemCLIManager groupManager;\n\n    @Inject\n    public WildflyCLIUserManagementService(final WildflyUserFileSystemCLIManager userManager,\n                                           final WildflyGroupFileSystemCLIManager groupManager,\n                                           final UberfireRoleManager roleManager) {\n        super(roleManager);\n        this.userManager = userManager;\n        this.groupManager = groupManager;\n    }\n\n    @Override\n    public UserManager users() {\n        return userManager;\n    }\n\n    @Override\n    public GroupManager groups() {\n        return groupManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/cli/WildflyGroupFileSystemCLIManager.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.wildfly.cli;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.wildfly.filesystem.WildflyGroupFileSystemManager;\n\n/**\n * <p>Groups manager service provider implementation for JBoss Wildfly.</p>\n * <p>It wraps the Wildfly groups manager based on properties file, but instead of the need to specify the path for the properties files, its absolute path discovery is automatically handled by using to the administration API for the server.</p>\n *\n * @since 0.8.0\n */\npublic class WildflyGroupFileSystemCLIManager extends BaseWildflyCLIManager implements GroupManager,\n                                                                                       ContextualManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(WildflyGroupFileSystemCLIManager.class);\n    protected WildflyGroupFileSystemManager groupsPropertiesManager;\n\n    public WildflyGroupFileSystemCLIManager() {\n        this(new ConfigProperties(System.getProperties()));\n    }\n\n    public WildflyGroupFileSystemCLIManager(final Map<String, String> gitPrefs) {\n        this(new ConfigProperties(gitPrefs));\n    }\n\n    public WildflyGroupFileSystemCLIManager(final ConfigProperties gitPrefs) {\n        loadConfig(gitPrefs);\n    }\n\n    private void init() {\n        try {\n            final Map<String, String> arguments = new HashMap<String, String>(3);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.folder-path\",\n                          folderPath);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.levels\",\n                          levels);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.encoded\",\n                          encoded);\n            this.groupsPropertiesManager = new WildflyGroupFileSystemManager(arguments);\n        } catch (Exception e) {\n            LOG.error(\"Cannot find groups properties file using the configuration present in the server instance.\",\n                      e);\n        }\n    }\n\n    @Override\n    public void initialize(UserSystemManager userSystemManager) throws Exception {\n        init();\n        groupsPropertiesManager.initialize(userSystemManager);\n    }\n\n    @Override\n    public void destroy() throws Exception {\n        groupsPropertiesManager.destroy();\n    }\n\n    @Override\n    public SearchResponse<Group> search(SearchRequest request) throws SecurityManagementException {\n        return groupsPropertiesManager.search(request);\n    }\n\n    @Override\n    public Group get(String identifier) throws SecurityManagementException {\n        return groupsPropertiesManager.get(identifier);\n    }\n\n    @Override\n    public List<Group> getAll() throws SecurityManagementException {\n        return groupsPropertiesManager.getAll();\n    }\n\n    @Override\n    public Group create(Group entity) throws SecurityManagementException {\n        return groupsPropertiesManager.create(entity);\n    }\n\n    @Override\n    public Group update(Group entity) throws SecurityManagementException {\n        return groupsPropertiesManager.update(entity);\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        groupsPropertiesManager.delete(identifiers);\n    }\n\n    @Override\n    public GroupManagerSettings getSettings() {\n        return groupsPropertiesManager.getSettings();\n    }\n\n    @Override\n    public void assignUsers(String name,\n                            Collection<String> users) throws SecurityManagementException {\n        groupsPropertiesManager.assignUsers(name,\n                                            users);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/cli/WildflyUserFileSystemCLIManager.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.wildfly.cli;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.wildfly.filesystem.WildflyGroupFileSystemManager;\nimport org.uberfire.ext.security.management.wildfly.filesystem.WildflyUserFileSystemManager;\n\n/**\n * <p>Users manager service provider implementation for JBoss Wildfly.</p>\n * <p>It wraps the Wildfly users manager based on properties file, but instead of the need to specify the path for the properties files, its absolute path discovery is automatically handled by using to the administration API for the server.</p>\n *\n * @since 0.8.0\n */\npublic class WildflyUserFileSystemCLIManager extends BaseWildflyCLIManager implements UserManager,\n                                                                                      ContextualManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(WildflyUserFileSystemCLIManager.class);\n    private WildflyUserFileSystemManager usersPropertiesManager;\n\n    public WildflyUserFileSystemCLIManager() {\n        this(new ConfigProperties(System.getProperties()));\n    }\n\n    public WildflyUserFileSystemCLIManager(final Map<String, String> gitPrefs) {\n        this(new ConfigProperties(gitPrefs));\n    }\n\n    public WildflyUserFileSystemCLIManager(final ConfigProperties gitPrefs) {\n        loadConfig(gitPrefs);\n    }\n\n    private void init(final UserSystemManager usManager) {\n        try {\n            final Map<String, String> arguments = new HashMap<String, String>(3);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.folder-path\",\n                          folderPath);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.levels\",\n                          levels);\n            arguments.put(\"org.uberfire.ext.security.management.wildfly.filesystem.encoded\",\n                          encoded);\n            this.usersPropertiesManager = new WildflyUserFileSystemManager(arguments) {\n                @Override\n                protected synchronized WildflyGroupFileSystemManager getGroupsFileSystemManager() {\n                    try {\n                        return ((WildflyGroupFileSystemCLIManager) usManager.groups()).groupsPropertiesManager;\n                    } catch (ClassCastException e) {\n                        return super.getGroupsFileSystemManager();\n                    }\n                }\n            };\n        } catch (Exception e) {\n            LOG.error(\"Cannot find users properties file using the configuration present in the server instance.\",\n                      e);\n        }\n    }\n\n    @Override\n    public void initialize(UserSystemManager userSystemManager) throws Exception {\n        init(userSystemManager);\n        usersPropertiesManager.initialize(userSystemManager);\n    }\n\n    @Override\n    public void destroy() throws Exception {\n        usersPropertiesManager.destroy();\n    }\n\n    @Override\n    public void assignGroups(String username,\n                             Collection<String> groups) throws SecurityManagementException {\n        usersPropertiesManager.assignGroups(username,\n                                            groups);\n    }\n\n    @Override\n    public void assignRoles(String username,\n                            Collection<String> roles) throws SecurityManagementException {\n        usersPropertiesManager.assignRoles(username,\n                                           roles);\n    }\n\n    @Override\n    public void changePassword(String username,\n                               String newPassword) throws SecurityManagementException {\n        usersPropertiesManager.changePassword(username,\n                                              newPassword);\n    }\n\n    @Override\n    public SearchResponse<User> search(SearchRequest request) throws SecurityManagementException {\n        return usersPropertiesManager.search(request);\n    }\n\n    @Override\n    public User get(String identifier) throws SecurityManagementException {\n        return usersPropertiesManager.get(identifier);\n    }\n\n    @Override\n    public List<User> getAll() throws SecurityManagementException {\n        return usersPropertiesManager.getAll();\n    }\n\n    @Override\n    public User create(User entity) throws SecurityManagementException {\n        return usersPropertiesManager.create(entity);\n    }\n\n    @Override\n    public User update(User entity) throws SecurityManagementException {\n        return usersPropertiesManager.update(entity);\n    }\n\n    @Override\n    public void delete(String... identifiers) throws SecurityManagementException {\n        usersPropertiesManager.delete(identifiers);\n    }\n\n    @Override\n    public UserManagerSettings getSettings() {\n        return usersPropertiesManager.getSettings();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/filesystem/RealmProvider.java",
    "content": "package org.uberfire.ext.security.management.wildfly.filesystem;\n\nimport java.nio.file.Paths;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.wildfly.security.auth.realm.FileSystemSecurityRealm;\nimport org.wildfly.security.auth.server.NameRewriter;\n\npublic class RealmProvider {\n\n    private static final Logger LOG = LoggerFactory.getLogger(RealmProvider.class);\n\n    public static final String DEFAULT_FILE_SYSTEM_REALM_PATH = System.getProperty(\"jboss.server.config.dir\") + \"/kie-fs-realm-users\";\n    public static final String DEFAULT_FILE_SYSTEM_LEVELS = \"2\";\n    public static final String DEFAULT_FILE_SYSTEM_ENCODED = \"true\";\n\n    private final String folderPath;\n    private final int levels;\n    private final boolean encoded;\n\n    public RealmProvider(final ConfigProperties config) {\n        LOG.debug(\"Configuring JBoss provider from properties.\");\n        // Configure properties.\n        this.folderPath = config.get(\"org.uberfire.ext.security.management.wildfly.filesystem.folder-path\",\n                                     DEFAULT_FILE_SYSTEM_REALM_PATH).getValue();\n        this.levels = config.get(\"org.uberfire.ext.security.management.wildfly.filesystem.levels\",\n                                 DEFAULT_FILE_SYSTEM_LEVELS).getIntValue();\n        this.encoded = config.get(\"org.uberfire.ext.security.management.wildfly.filesystem.encoded\",\n                                  DEFAULT_FILE_SYSTEM_ENCODED).getBooleanValue();\n\n        LOG.debug(\"Configuration of JBoss provider finished.\");\n    }\n\n    public FileSystemSecurityRealm getRealm() {\n        return new FileSystemSecurityRealm(Paths.get(folderPath), NameRewriter.IDENTITY_REWRITER, levels, encoded);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/filesystem/WildflyGroupFileSystemManager.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations  under the License.\n */\npackage org.uberfire.ext.security.management.wildfly.filesystem;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UnsupportedServiceCapabilityException;\nimport org.uberfire.ext.security.management.impl.GroupManagerSettingsImpl;\nimport org.uberfire.ext.security.management.search.GroupsIdentifierRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.search.IdentifierRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\nimport org.wildfly.security.auth.principal.NamePrincipal;\nimport org.wildfly.security.auth.realm.FileSystemSecurityRealm;\nimport org.wildfly.security.auth.server.ModifiableRealmIdentity;\nimport org.wildfly.security.auth.server.ModifiableRealmIdentityIterator;\nimport org.wildfly.security.auth.server.RealmUnavailableException;\nimport org.wildfly.security.authz.Attributes;\nimport org.wildfly.security.authz.MapAttributes;\n\npublic class WildflyGroupFileSystemManager\n        implements GroupManager,\n                   ContextualManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(WildflyGroupFileSystemManager.class);\n\n    protected final IdentifierRuntimeSearchEngine<Group> groupsSearchEngine = new GroupsIdentifierRuntimeSearchEngine();\n    private final RealmProvider realmProvider;\n\n    public WildflyGroupFileSystemManager() {\n        this(new ConfigProperties(System.getProperties()));\n    }\n\n    public WildflyGroupFileSystemManager(final Map<String, String> gitPrefs) {\n        this(new ConfigProperties(gitPrefs));\n    }\n\n    public WildflyGroupFileSystemManager(final ConfigProperties gitPrefs) {\n        realmProvider = new RealmProvider(gitPrefs);\n    }\n\n    @Override\n    public SearchResponse<Group> search(final SearchRequest request) throws SecurityManagementException {\n        final Set<String> result = getAllGroups();\n        final SearchResponse<Group> groupSearchResponse = groupsSearchEngine.searchByIdentifiers(result,\n                                                                                                 request);\n        return groupSearchResponse;\n    }\n\n    @Override\n    public Group get(final String identifier) throws SecurityManagementException {\n        if (identifier == null) {\n            throw new NullPointerException();\n        }\n        final Set<String> result = getAllGroups();\n        if (result != null && result.contains(identifier)) {\n            return SecurityManagementUtils.createGroup(identifier);\n        }\n        throw new GroupNotFoundException(identifier);\n    }\n\n    @Override\n    public List<Group> getAll() throws SecurityManagementException {\n\n        final Set<Group> result = new HashSet<>();\n        final Set<String> allGroup = getAllGroups();\n\n        for (String groupName : allGroup) {\n            result.add(SecurityManagementUtils.createGroup(groupName));\n        }\n\n        return new ArrayList<>(result);\n    }\n\n    protected Set<String> getAllGroups() {\n        final Set<String> result = new HashSet<>();\n        try {\n            final ModifiableRealmIdentityIterator realmIdentityIterator = realmProvider.getRealm().getRealmIdentityIterator();\n            while (realmIdentityIterator.hasNext()) {\n                final ModifiableRealmIdentity identity = realmIdentityIterator.next();\n                final Attributes attributes = identity.getAttributes();\n                final Attributes.Entry roles = attributes.get(\"role\");\n                for (String role : roles) {\n                    result.add(role);\n                }\n            }\n        } catch (Exception e) {\n            throw new SecurityManagementException(e);\n        }\n        return result;\n    }\n\n    @Override\n    public Group create(final Group entity) throws SecurityManagementException {\n        if (entity == null) {\n            throw new NullPointerException();\n        }\n        return new GroupImpl(entity.getName());\n    }\n\n    @Override\n    public Group update(final Group entity) throws SecurityManagementException {\n        throw new UnsupportedServiceCapabilityException(Capability.CAN_UPDATE_GROUP);\n    }\n\n    @Override\n    public void delete(final String... identifiers) throws SecurityManagementException {\n        if (identifiers == null) {\n            throw new NullPointerException();\n        }\n        final List<String> groupsToBeRemoved = Arrays.asList(identifiers);\n        try {\n            final ModifiableRealmIdentityIterator iterator = realmProvider.getRealm().getRealmIdentityIterator();\n\n            while (iterator.hasNext()) {\n                final ModifiableRealmIdentity identity = iterator.next();\n                final Attributes attributes = new MapAttributes(identity.getAttributes());\n\n                boolean found = false;\n\n                final HashSet<String> groups = new HashSet<>();\n                for (String group : identity.getAttributes().get(\"role\")) {\n                    if (groupsToBeRemoved.contains(group)) {\n                        found = true;\n                    } else {\n                        groups.add(group);\n                    }\n                }\n\n                attributes.remove(\"role\");\n                attributes.addAll(\"role\", groups);\n\n                if (found) {\n                    identity.setAttributes(attributes);\n                    identity.dispose();\n                }\n            }\n        } catch (Exception e) {\n            LOG.error(\"Error removing the folowing group names: \" + Arrays.toString(identifiers),\n                      e);\n            throw new SecurityManagementException(e);\n        }\n    }\n\n    @Override\n    public GroupManagerSettings getSettings() {\n        final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<>(8);\n        for (final Capability capability : SecurityManagementUtils.GROUPS_CAPABILITIES) {\n            capabilityStatusMap.put(capability,\n                                    getCapabilityStatus(capability));\n        }\n        return new GroupManagerSettingsImpl(capabilityStatusMap,\n                                            false);\n    }\n\n    protected CapabilityStatus getCapabilityStatus(Capability capability) {\n        if (capability != null) {\n            switch (capability) {\n                case CAN_ADD_GROUP:\n                case CAN_DELETE_GROUP:\n                case CAN_SEARCH_GROUPS:\n                case CAN_READ_GROUP:\n                    return CapabilityStatus.ENABLED;\n            }\n        }\n        return CapabilityStatus.UNSUPPORTED;\n    }\n\n    @Override\n    public void initialize(final UserSystemManager userSystemManager) {\n    }\n\n    @Override\n    public void destroy() throws Exception {\n\n    }\n\n    @Override\n    public void assignUsers(final String groupName, final Collection<String> users) throws SecurityManagementException {\n        for (String username : users) {\n            try {\n                final FileSystemSecurityRealm realm = realmProvider.getRealm();\n                final ModifiableRealmIdentity identity = realm.getRealmIdentityForUpdate(new NamePrincipal(username));\n                final MapAttributes attributes = new MapAttributes(identity.getAttributes());\n\n                final HashSet<String> groups = new HashSet<>();\n                for (String group : identity.getAttributes().get(\"role\")) {\n                    groups.add(group);\n                }\n                groups.add(groupName);\n\n                attributes.addAll(\"role\", groups);\n\n                identity.setAttributes(attributes);\n\n                identity.dispose();\n            } catch (RealmUnavailableException e) {\n                throw new SecurityManagementException(e);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/filesystem/WildflyUserFileSystemManager.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations  under the License.\n */\npackage org.uberfire.ext.security.management.wildfly.filesystem;\n\nimport java.io.IOException;\nimport java.security.NoSuchAlgorithmException;\nimport java.security.Provider;\nimport java.security.spec.InvalidKeySpecException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.ContextualManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.UserManagerSettings;\nimport org.uberfire.ext.security.management.api.UserSystemManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.impl.UserManagerSettingsImpl;\nimport org.uberfire.ext.security.management.search.IdentifierRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.search.UsersIdentifierRuntimeSearchEngine;\nimport org.uberfire.ext.security.management.util.SecurityManagementUtils;\nimport org.wildfly.security.auth.principal.NamePrincipal;\nimport org.wildfly.security.auth.realm.FileSystemSecurityRealm;\nimport org.wildfly.security.auth.server.ModifiableRealmIdentity;\nimport org.wildfly.security.auth.server.ModifiableRealmIdentityIterator;\nimport org.wildfly.security.auth.server.RealmUnavailableException;\nimport org.wildfly.security.authz.Attributes;\nimport org.wildfly.security.authz.MapAttributes;\nimport org.wildfly.security.credential.PasswordCredential;\nimport org.wildfly.security.password.PasswordFactory;\nimport org.wildfly.security.password.WildFlyElytronPasswordProvider;\nimport org.wildfly.security.password.interfaces.DigestPassword;\nimport org.wildfly.security.password.spec.DigestPasswordAlgorithmSpec;\nimport org.wildfly.security.password.spec.DigestPasswordSpec;\nimport org.wildfly.security.password.spec.EncryptablePasswordSpec;\n\nimport static com.google.common.base.Preconditions.checkNotNull;\n\npublic class WildflyUserFileSystemManager\n        implements ContextualManager,\n                   UserManager {\n\n    private static final Logger LOG = LoggerFactory.getLogger(WildflyUserFileSystemManager.class);\n\n    private static final Provider ELYTRON_PROVIDER = new WildFlyElytronPasswordProvider();\n\n    protected final IdentifierRuntimeSearchEngine<User> usersSearchEngine = new UsersIdentifierRuntimeSearchEngine();\n    private final RealmProvider realmProvider;\n    private UserSystemManager userSystemManager;\n\n    public WildflyUserFileSystemManager() {\n        this(new ConfigProperties(System.getProperties()));\n    }\n\n    public WildflyUserFileSystemManager(final Map<String, String> gitPrefs) {\n        this(new ConfigProperties(gitPrefs));\n    }\n\n    public WildflyUserFileSystemManager(final ConfigProperties gitPrefs) {\n        realmProvider = new RealmProvider(gitPrefs);\n    }\n\n    @Override\n    public void initialize(final UserSystemManager userSystemManager) {\n        this.userSystemManager = userSystemManager;\n    }\n\n    protected synchronized WildflyGroupFileSystemManager getGroupsFileSystemManager() {\n        try {\n            return (WildflyGroupFileSystemManager) userSystemManager.groups();\n        } catch (ClassCastException e) {\n            e.printStackTrace();\n            return null;\n        }\n    }\n\n    @Override\n    public void destroy() throws Exception {\n\n    }\n\n    @Override\n    public SearchResponse<User> search(final SearchRequest request) throws SecurityManagementException {\n        final List<String> users = new ArrayList<>();\n        try {\n            final ModifiableRealmIdentityIterator realmIdentityIterator = realmProvider.getRealm().getRealmIdentityIterator();\n            while (realmIdentityIterator.hasNext()) {\n                ModifiableRealmIdentity next = realmIdentityIterator.next();\n                users.add(next.getRealmIdentityPrincipal().getName());\n            }\n        } catch (RealmUnavailableException e) {\n            throw new SecurityManagementException(e);\n        }\n\n        return usersSearchEngine.searchByIdentifiers(users,\n                                                     request);\n    }\n\n    @Override\n    public User get(final String identifier) throws SecurityManagementException {\n        final ModifiableRealmIdentity modifiableIdentity = realmProvider.getRealm().getRealmIdentityForUpdate(new NamePrincipal(identifier));\n\n        try {\n            final Optional<User> user = getUser(modifiableIdentity);\n\n            if (user.isPresent()) {\n                return user.get();\n            } else {\n                throw new UserNotFoundException(identifier);\n            }\n        } catch (RealmUnavailableException e) {\n            throw new UserNotFoundException(identifier);\n        }\n    }\n\n    @Override\n    public List<User> getAll() throws SecurityManagementException {\n        final ArrayList<User> result = new ArrayList<>();\n\n        try {\n            final ModifiableRealmIdentityIterator realmIdentityIterator = realmProvider.getRealm().getRealmIdentityIterator();\n            while (realmIdentityIterator.hasNext()) {\n                final ModifiableRealmIdentity identity = realmIdentityIterator.next();\n\n                final Optional<User> user = getUser(identity);\n                if (user.isPresent()) {\n                    result.add(user.get());\n                }\n            }\n        } catch (RealmUnavailableException e) {\n            throw new SecurityManagementException(e);\n        }\n        return result;\n    }\n\n    private Optional<User> getUser(final ModifiableRealmIdentity identity) throws RealmUnavailableException {\n        final String userName = identity.getRealmIdentityPrincipal().getName();\n        final Attributes attributes = identity.getAttributes();\n        final Attributes.Entry roles = attributes.get(\"role\");\n        final Set<String> userGroups = new HashSet<>();\n        final Set<Group> groups = new HashSet<>();\n\n        for (String role : roles) {\n            userGroups.add(role);\n        }\n\n        final Set<String> registeredRoles = SecurityManagementUtils.getRegisteredRoleNames();\n        if (groups != null) {\n            final Set<String> allGroups = getGroupsFileSystemManager().getAllGroups();\n            if (allGroups != null) {\n                final Set<Group> _groups = new HashSet<>();\n                final Set<Role> _roles = new HashSet<>();\n                for (final String name : userGroups) {\n                    if (!allGroups.contains(name)) {\n                        String error = \"Error getting groups for user. User's group '\" + name + \"' does not exist.\";\n                        LOG.error(error);\n                        throw new SecurityManagementException(error);\n                    }\n                    SecurityManagementUtils.populateGroupOrRoles(name,\n                                                                 registeredRoles,\n                                                                 _groups,\n                                                                 _roles);\n                }\n\n                return Optional.of(SecurityManagementUtils.createUser(userName,\n                                                                      _groups,\n                                                                      _roles));\n            }\n        }\n        return Optional.empty();\n    }\n\n    @Override\n    public User create(final User entity) throws SecurityManagementException {\n        checkNotNull(\"entity\",\n                     entity);\n        final String username = entity.getIdentifier();\n        if (null == username || 0 == username.trim().length()) {\n            throw new IllegalArgumentException(\"No username specified.\");\n        }\n\n        try {\n            final ModifiableRealmIdentity modifiableIdentity = realmProvider.getRealm().getRealmIdentityForUpdate(new NamePrincipal(username));\n            if (!modifiableIdentity.exists()) {\n                modifiableIdentity.create();\n            }\n        } catch (RealmUnavailableException e) {\n            LOG.error(\"Error creating user \" + username,\n                      e);\n            throw new SecurityManagementException(e);\n        }\n        return entity;\n    }\n\n    @Override\n    public User update(final User entity) throws SecurityManagementException {\n        checkNotNull(\"entity\",\n                     entity);\n        return entity;\n    }\n\n    @Override\n    public void delete(final String... usernames) throws SecurityManagementException {\n        checkNotNull(\"usernames\",\n                     usernames);\n\n        for (final String username : usernames) {\n            final ModifiableRealmIdentity identity = realmProvider.getRealm().getRealmIdentityForUpdate(new NamePrincipal(username));\n            try {\n                if (identity.exists()) {\n                    identity.delete();\n                }\n            } catch (RealmUnavailableException e) {\n                throw new SecurityManagementException(e);\n            }\n        }\n    }\n\n    @Override\n    public UserManagerSettings getSettings() {\n        final Map<Capability, CapabilityStatus> capabilityStatusMap = new HashMap<>(8);\n        for (final Capability capability : SecurityManagementUtils.USERS_CAPABILITIES) {\n            capabilityStatusMap.put(capability,\n                                    getCapabilityStatus(capability));\n        }\n        return new UserManagerSettingsImpl(capabilityStatusMap,\n                                           null);\n    }\n\n    protected CapabilityStatus getCapabilityStatus(Capability capability) {\n        if (capability != null) {\n            switch (capability) {\n                case CAN_SEARCH_USERS:\n                case CAN_ADD_USER:\n                case CAN_UPDATE_USER:\n                case CAN_DELETE_USER:\n                case CAN_READ_USER:\n                case CAN_ASSIGN_GROUPS:\n                    /** As it is using the UberfireRoleManager. **/\n                case CAN_ASSIGN_ROLES:\n                case CAN_CHANGE_PASSWORD:\n                    return CapabilityStatus.ENABLED;\n            }\n        }\n        return CapabilityStatus.UNSUPPORTED;\n    }\n\n    @Override\n    public void assignGroups(final String username, final Collection<String> groups) throws SecurityManagementException {\n        try {\n            final FileSystemSecurityRealm realm = realmProvider.getRealm();\n            final ModifiableRealmIdentity identity = realm.getRealmIdentityForUpdate(new NamePrincipal(username));\n            final MapAttributes attributes = new MapAttributes();\n            final Set<String> userRoles = SecurityManagementUtils.rolesToString(SecurityManagementUtils.getRoles(userSystemManager,\n                                                                                                                 username));\n            userRoles.addAll(groups);\n            attributes.addAll(\"role\", userRoles);\n            identity.setAttributes(attributes);\n            identity.dispose();\n        } catch (RealmUnavailableException e) {\n            throw new SecurityManagementException(e);\n        }\n    }\n\n    @Override\n    public void assignRoles(final String username, final Collection<String> roles) throws SecurityManagementException {\n        try {\n            final FileSystemSecurityRealm realm = realmProvider.getRealm();\n            final ModifiableRealmIdentity identity = realm.getRealmIdentityForUpdate(new NamePrincipal(username));\n            final MapAttributes attributes = new MapAttributes();\n            final Set<String> userGroups = SecurityManagementUtils.groupsToString(SecurityManagementUtils.getGroups(userSystemManager,\n                                                                                                                    username));\n            userGroups.addAll(roles);\n            attributes.addAll(\"role\", userGroups);\n            identity.setAttributes(attributes);\n            identity.dispose();\n        } catch (RealmUnavailableException e) {\n            throw new SecurityManagementException(e);\n        }\n    }\n\n    @Override\n    public void changePassword(final String username, final String newPassword) throws SecurityManagementException {\n        checkNotNull(\"username\",\n                     username);\n        if (0 == username.trim().length()) {\n            throw new IllegalArgumentException(\"No username specified for updating password.\");\n        }\n\n        try {\n            final ModifiableRealmIdentity modifiableIdentity = realmProvider.getRealm().getRealmIdentityForUpdate(new NamePrincipal(username));\n\n            final String TEST_REALM = \"ApplicationRealm\";\n\n            final PasswordFactory passwordFactory = PasswordFactory.getInstance(DigestPassword.ALGORITHM_DIGEST_MD5, ELYTRON_PROVIDER);\n\n            final DigestPasswordAlgorithmSpec digestAlgorithmSpec = new DigestPasswordAlgorithmSpec(username, TEST_REALM);\n            final EncryptablePasswordSpec encryptableSpec = new EncryptablePasswordSpec(newPassword.toCharArray(), digestAlgorithmSpec);\n\n            final DigestPassword original = (DigestPassword) passwordFactory.generatePassword(encryptableSpec);\n\n            final byte[] digest = original.getDigest();\n\n            final DigestPasswordSpec digestPasswordSpec = new DigestPasswordSpec(username, TEST_REALM, digest);\n\n            final DigestPassword restored = (DigestPassword) passwordFactory.generatePassword(digestPasswordSpec);\n\n            modifiableIdentity.setCredentials(Collections.singleton(new PasswordCredential(restored)));\n\n            modifiableIdentity.dispose();\n        } catch (InvalidKeySpecException | NoSuchAlgorithmException | IOException e) {\n            LOG.error(\"Error changing user's password\",\n                      e);\n            throw new SecurityManagementException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/java/org/uberfire/ext/security/management/wildfly/filesystem/WildflyUserManagementService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.wildfly.filesystem;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.ext.security.management.UberfireRoleManager;\nimport org.uberfire.ext.security.management.api.GroupManager;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.service.AbstractUserManagementService;\n\n/**\n * <p>The Wildfly/EAP management service beans.</p>\n *\n * @since 0.8.0\n */\n@Dependent\n@Named(value = \"WildflyUserManagementService\")\npublic class WildflyUserManagementService extends AbstractUserManagementService {\n\n    WildflyUserFileSystemManager userManager;\n    WildflyGroupFileSystemManager groupManager;\n\n    @Inject\n    public WildflyUserManagementService(final WildflyUserFileSystemManager userManager,\n                                        final WildflyGroupFileSystemManager groupManager,\n                                        final UberfireRoleManager roleManager) {\n        super(roleManager);\n        this.userManager = userManager;\n        this.groupManager = groupManager;\n    }\n\n    @Override\n    public UserManager users() {\n        return userManager;\n    }\n\n    @Override\n    public GroupManager groups() {\n        return groupManager;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-security-management-wildfly/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/README.md",
    "content": "Users and groups management services - Widgets\n=========================================================\n\nThis module provides the client side widgets for the Users and Groups management feature.                               \n\nPlease, in order to use this module, use and specify and of the available Users and Groups management service providers. For more information, please take a look at the [Uberfire Security Management](../../uberfire-security/uberfire-security-management/).                           \n\nIt provides the following workbench widgets:                               \n\n* Entities list widget                    \n* Users explorer widget                    \n* Groups explorer widget                    \n* Roles explorer widget                    \n* Change password / modal widget                    \n* User editor widget                    \n* User attributes editor widget                    \n* User groups explorer widget                    \n* User groups assignment editor / modal widget                \n* User editor workflow             \n* User creation workflow           \n* Group viewer widget                    \n* Group viewer workflow          \n* Group creation workflow            \n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-security-management</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-widgets-security-management</artifactId>\n  <packaging>jar</packaging>\n  <name>Uberfire Security Management - Users and groups management Widgets</name>\n  <description>Uberfire Security Management - Users and groups management Widgets</description>\n\n  <dependencies>\n\n    <!-- Uberfire. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Errai. -->\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <!-- Others. -->\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test scope. -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface SecurityManagementConstants extends Messages {\n\n    SecurityManagementConstants INSTANCE = GWT.create(SecurityManagementConstants.class);\n\n    String addChildException();\n\n    String selectResourceInstance(String resourceName);\n\n    String searchResourceInstance(String resourceName);\n\n    String resourceInstanceNotFound(String resourceName);\n\n    String clearChildren();\n\n    String can();\n\n    String cant();\n\n    String canOnly();\n\n    String all();\n\n    String but();\n\n    String following();\n\n    String switchAllow();\n\n    String switchDeny();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.management.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * <p>Users Management constants for widgets module.</p>\n * @since 0.8.0\n */\npublic interface UsersManagementWidgetsConstants extends Messages {\n\n    UsersManagementWidgetsConstants INSTANCE = GWT.create(UsersManagementWidgetsConstants.class);\n\n    String loading();\n\n    String emptyEntities();\n\n    String firstPage();\n\n    String previousPage();\n\n    String nextPage();\n\n    String lastPage();\n\n    String next();\n\n    String userHasNoAttributes();\n\n    String attributeIsMandatory();\n\n    String userHasNoGroups();\n\n    String memberOfGroups();\n\n    String groupSelectionFor();\n\n    String userHasNoRoles();\n\n    String memberOfRoles();\n\n    String permissions();\n\n    String roleSelectionFor();\n\n    String userAttributes();\n\n    String name();\n\n    String value();\n\n    String search();\n\n    String searchFor();\n\n    String searchResultsFor();\n\n    String edit();\n\n    String delete();\n\n    String cancel();\n\n    String create();\n\n    String save();\n\n    String saveChanges();\n\n    String addToGroups();\n\n    String addToRoles();\n\n    String addAttribute();\n\n    String add();\n\n    String confirmAction();\n\n    String ensureRemoveUser();\n\n    String ensureRemoveGroup();\n\n    String ensureUserHasGroupsOrRoles();\n\n    String genericError();\n\n    String remove();\n\n    String ensureRemoveAttribute();\n\n    String ensureRemoveGroupFromUser();\n\n    String ensureRemoveRoleFromUser();\n\n    String nameIsMandatory();\n\n    String valueIsMandatory();\n\n    String attributeAlreadyExists();\n\n    String addToSelectedGroups();\n\n    String addToSelectedRoles();\n\n    String addUsersToGroup();\n\n    String assignUsersToGroupName();\n\n    String groupMustHaveAtLeastOneUser();\n\n    String doesNotHavePrivileges();\n\n    String patternAlphanumericSymbols();\n\n    String username();\n\n    String invalidUserName();\n\n    String inputUserName();\n\n    String groupName();\n\n    String invalidGroupName();\n\n    String inputGroupName();\n\n    String userIsDirty();\n\n    String changePassword();\n\n    String changePasswordFor();\n\n    String newPassword();\n\n    String repeatNewPassword();\n\n    String passwordCannotBeEmpty();\n\n    String passwordsNotMatch();\n\n    String passwordUpdatedSuccessfully();\n\n    String doSetPasswordNow();\n\n    String clear();\n\n    String clearSearch();\n\n    String change();\n\n    String user();\n\n    String users();\n\n    String group();\n\n    String groups();\n\n    String groupsAssigned();\n\n    String rolesAssigned();\n\n    String role();\n\n    String roles();\n\n    String noUsers();\n\n    String noGroups();\n\n    String noRoles();\n\n    String refresh();\n\n    String total();\n\n    String all();\n\n    String roleSettings(String rolename);\n\n    String roleIsDirty();\n\n    String groupIsDirty();\n\n    String userModified(String username);\n\n    String userStillNotCreated(String username);\n\n    String userCreated(String username);\n\n    String userSaved(String username);\n\n    String userRemoved(String username);\n\n    String groupSettings(String groupname);\n\n    String groupCreated(String name);\n\n    String groupRemoved(String name);\n\n    String groupModified(String groupname);\n\n    String groupSaved(String groupname);\n\n    String usersAssigned(String name);\n\n    String roleModified(String rolename);\n\n    String roleSaved(String rolename);\n\n    String newEntity(String entity);\n\n    String homePerspective();\n\n    String homePerspectiveTooltip();\n\n    String noHomePerspective();\n\n    String homePerspectiveReadDenied();\n\n    String priority();\n\n    String priorityTooltip();\n\n    String selectPriorityHint();\n\n    String priorityVeryHigh();\n\n    String priorityHigh();\n\n    String priorityNormal();\n\n    String priorityLow();\n\n    String priorityVeryLow();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePassword.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.form.error.BasicEditorError;\nimport org.gwtbootstrap3.client.ui.form.validator.Validator;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>Presenter class for change user's password widget.</p>\n */\n@Dependent\npublic class ChangePassword implements IsWidget {\n\n    /**\n     * <p>A default not empty password validator.</p>\n     */\n    final Validator<String> passwordValidator = new Validator<String>() {\n        @Override\n        public int getPriority() {\n            return 0;\n        }\n\n        @Override\n        public List<EditorError> validate(Editor<String> editor,\n                                          String value) {\n            List<EditorError> result = new ArrayList<EditorError>();\n            if (value == null || value.trim().length() == 0) {\n                result.add(new BasicEditorError(editor,\n                                                value,\n                                                UsersManagementWidgetsConstants.INSTANCE.passwordCannotBeEmpty()));\n            }\n            return result;\n        }\n    };\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    Event<NotificationEvent> workbenchNotification;\n    Event<OnErrorEvent> errorEvent;\n    Event<ChangePasswordEvent> changePasswordEvent;\n    String username = null;\n    ChangePasswordCallback callback;\n\n    @Inject\n    public ChangePassword(final ClientUserSystemManager userSystemManager,\n                          final Event<NotificationEvent> workbenchNotification,\n                          final Event<OnErrorEvent> errorEvent,\n                          final Event<ChangePasswordEvent> changePasswordEvent,\n                          final View view) {\n        this.userSystemManager = userSystemManager;\n        this.errorEvent = errorEvent;\n        this.workbenchNotification = workbenchNotification;\n        this.changePasswordEvent = changePasswordEvent;\n        this.view = view;\n    }\n    \n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        // Configure the view using the default not empty password validator.\n        view.configure(passwordValidator,\n                       passwordValidator);\n    }\n\n    public void show(final String username) {\n        // Clear current view.\n        clear();\n        this.username = username;\n        this.callback = null;\n        view.show(UsersManagementWidgetsConstants.INSTANCE.changePasswordFor() + \" \" + username);\n    }\n\n    public void show(final String username,\n                     final ChangePasswordCallback callback) {\n        // Clear current view.\n        clear();\n        this.username = username;\n        this.callback = callback;\n        view.show(UsersManagementWidgetsConstants.INSTANCE.changePasswordFor() + \" \" + username);\n    }\n\n    public void clear() {\n        username = null;\n        callback = null;\n        view.clear();\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    boolean validatePasswordsMatch(final String p1,\n                                   final String p2) {\n        final boolean valid = p1 != null && p1.equals(p2);\n        if (!valid) {\n            showErrorMessage(UsersManagementWidgetsConstants.INSTANCE.passwordsNotMatch());\n        }\n        return valid;\n    }\n\n     /*  ******************************************************************************************************\n                                 PACKAGE PROTECTED METHODS FOR USING AS CALLBACKS FOR THE VIEW \n     ****************************************************************************************************** */\n\n    void onUpdatePassword(final String newPassword,\n                          final Command callback) {\n        // Call backend service.\n        userSystemManager.users(new RemoteCallback<Void>() {\n                                    @Override\n                                    public void callback(final Void group) {\n                                        // Fire event as password changed succesfully on backend side.\n                                        changePasswordEvent.fire(new ChangePasswordEvent(this));\n\n                                        // Show a notification.\n                                        workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.passwordUpdatedSuccessfully(),\n                                                                                         SUCCESS));\n\n                                        // Run the callback when backend request completed.\n                                        if (callback != null) {\n                                            callback.execute();\n                                        }\n                                        if (ChangePassword.this.callback != null) {\n                                            ChangePassword.this.callback.onPasswordUpdated();\n                                        }\n\n                                        // Hide the view.\n                                        view.hide();\n                                    }\n                                },\n                                new ErrorCallback<Message>() {\n                                    @Override\n                                    public boolean error(final Message message,\n                                                         final Throwable throwable) {\n                                        if (throwable != null) {\n                                            showError(throwable);\n                                        } else {\n                                            showErrorMessage(message.getSubject());\n                                        }\n\n                                        // Run the callback when backend request completed.\n                                        if (callback != null) {\n                                            callback.execute();\n                                        }\n                                        if (ChangePassword.this.callback != null) {\n                                            ChangePassword.this.callback.onError(throwable);\n                                        }\n                                        return false;\n                                    }\n                                }).changePassword(username,\n                                                  newPassword);\n    }\n\n    void showErrorMessage(final String message) {\n        showError(new SecurityManagementException(message));\n    }\n\n    void showError(final Throwable throwable) {\n        errorEvent.fire(new OnErrorEvent(ChangePassword.this,\n                                         throwable));\n    }\n    \n    \n     /*  ******************************************************************************************************\n                                     PRIVATE METHODS FOR INTERNAL PRESENTER LOGIC \n         ****************************************************************************************************** */\n\n    public interface ChangePasswordCallback {\n\n        void onPasswordUpdated();\n\n        void onError(final Throwable throwable);\n    }\n\n    ;\n\n    public interface View extends UberView<ChangePassword> {\n\n        View configure(final Validator<String> newPasswordBoxValidator,\n                       final Validator<String> repeatNewPasswordBoxValidator);\n\n        View show(final String username);\n\n        View hide();\n\n        View clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.Input;\nimport org.gwtbootstrap3.client.ui.form.validator.Validator;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>View implementation for changing a user's password.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class ChangePasswordView extends Composite\n        implements\n        ChangePassword.View {\n\n    private static ChangePasswordViewBinder uiBinder = GWT.create(ChangePasswordViewBinder.class);\n    private final BaseModal modal = new BaseModal();\n    @UiField\n    FlowPanel mainPanel;\n\n    @UiField\n    Form changePasswordForm;\n\n    @UiField\n    FormGroup newPasswordFormGroup;\n\n    @UiField\n    Input newPasswordBox;\n\n    @UiField\n    FormGroup repeatNewPasswordFormGroup;\n\n    @UiField\n    Input repeatNewPasswordBox;\n\n    @UiField\n    Button clearButton;\n\n    @UiField\n    Button updateButton;\n    private final Command callback = new Command() {\n        @Override\n        public void execute() {\n            clear();\n        }\n    };\n    private ChangePassword presenter;\n\n    @Override\n    public void init(final ChangePassword presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n        modal.setBody(this);\n    }\n\n    @Override\n    public ChangePassword.View configure(final Validator<String> newPasswordBoxValidator,\n                                         final Validator<String> repeatNewPasswordBoxValidator) {\n        newPasswordBox.addValidator(newPasswordBoxValidator);\n        repeatNewPasswordBox.addValidator(repeatNewPasswordBoxValidator);\n        return this;\n    }\n\n    @Override\n    public ChangePassword.View show(final String username) {\n        modal.setTitle(username);\n        showModal();\n        return this;\n    }\n\n    @Override\n    public ChangePassword.View hide() {\n        modal.hide();\n        return this;\n    }\n\n    @Override\n    public ChangePassword.View clear() {\n        changePasswordForm.reset();\n        updateButton.state().reset();\n        return this;\n    }\n\n    private void showModal() {\n        modal.show();\n    }\n\n    @UiHandler(\"clearButton\")\n    public void onClear(final ClickEvent event) {\n        clear();\n    }\n\n    @UiHandler(\"updateButton\")\n    public void onUpdate(final ClickEvent event) {\n        updateButton.state().loading();\n        final boolean isValid = changePasswordForm.validate();\n        if (isValid && presenter.validatePasswordsMatch(newPasswordBox.getText(),\n                                                        repeatNewPasswordBox.getText())) {\n            presenter.onUpdatePassword(newPasswordBox.getValue(),\n                                       callback);\n        } else {\n            updateButton.state().reset();\n        }\n    }\n\n    interface ChangePasswordViewBinder\n            extends\n            UiBinder<FlowPanel, ChangePasswordView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .mainPanel {\n      width: 100%;\n    }\n    .changePasswordForm {\n      margin: 20px;\n      text-align: center;\n    }\n    .button {\n      margin-left: 2px;\n    }\n    .buttonGroup {\n      text-align: right;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n\n      <b:Form type=\"HORIZONTAL\" ui:field=\"changePasswordForm\" addStyleNames=\"{style.changePasswordForm}\">\n\n        <b:FormGroup ui:field=\"newPasswordFormGroup\">\n          <b:FormLabel for=\"newPasswordBox\" text=\"{i18n.newPassword}\" addStyleNames=\"col-md-4\"/>\n          <g:FlowPanel addStyleNames=\"col-md-8\">\n            <b:Input type=\"PASSWORD\" ui:field=\"newPasswordBox\" b:id=\"newPasswordBox\"\n                     placeholder=\"{i18n.newPassword}...\"/>\n          </g:FlowPanel>\n        </b:FormGroup>\n\n        <b:FormGroup ui:field=\"repeatNewPasswordFormGroup\">\n          <b:FormLabel for=\"repeatNewPasswordBox\" text=\"{i18n.repeatNewPassword}\" addStyleNames=\"col-md-4\"/>\n          <g:FlowPanel addStyleNames=\"col-md-8\">\n            <b:Input type=\"PASSWORD\" ui:field=\"repeatNewPasswordBox\" b:id=\"repeatNewPasswordBox\"\n                     placeholder=\"{i18n.repeatNewPassword}...\"/>\n          </g:FlowPanel>\n        </b:FormGroup>\n\n        <b:FormGroup addStyleNames=\"{style.buttonGroup}\">\n          <g:FlowPanel addStyleNames=\"col-md-12\">\n            <b:Button ui:field=\"updateButton\" type=\"PRIMARY\" title=\"{i18n.change}\" text=\"{i18n.change}\" addStyleNames=\"{style.button}\"/>\n            <b:Button ui:field=\"clearButton\" type=\"DEFAULT\" title=\"{i18n.clear}\" text=\"{i18n.clear}\" addStyleNames=\"{style.button}\"/>\n          </g:FlowPanel>\n        </b:FormGroup>\n\n      </b:Form>\n  \n  </g:FlowPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/CreateEntity.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\n\npublic class CreateEntity implements IsWidget {\n\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    String identifier;\n    @Inject\n    public CreateEntity(final ClientUserSystemManager userSystemManager,\n                        final View view) {\n        this.userSystemManager = userSystemManager;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    void onEntityIdentifierChanged(final String value) {\n        setNoneValidationState();\n        this.identifier = value;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(final String legend,\n                     String placeholder) {\n        clear();\n        view.show(legend,\n                  placeholder);\n    }\n\n    public void setErrorState() {\n        setErrorValidationState();\n    }\n\n    public String getEntityIdentifier() {\n        if (identifier != null && identifier.trim().length() > 0) {\n            setNoneValidationState();\n            return identifier;\n        } else {\n            setErrorValidationState();\n            return null;\n        }\n    }\n\n    public void clear() {\n        identifier = null;\n        setNoneValidationState();\n        view.clear();\n    }\n\n    private void setNoneValidationState() {\n        view.setValidationState(ValidationState.NONE);\n    }\n\n    private void setErrorValidationState() {\n        view.setValidationState(ValidationState.ERROR);\n    }\n\n    public interface View extends UberView<CreateEntity> {\n\n        void show(final String legend,\n                  String placeholder);\n\n        void setValidationState(ValidationState state);\n\n        void clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/CreateEntityView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.Legend;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\n/**\n * <p>View implementation for creating new entities.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class CreateEntityView extends Composite\n        implements\n        CreateEntity.View {\n\n    private static CreateEntityViewBinder uiBinder = GWT.create(CreateEntityViewBinder.class);\n    @UiField\n    Form form;\n    @UiField\n    Legend formLegend;\n    @UiField\n    FormGroup formGroup;\n    @UiField\n    TextBox identifierBox;\n    private CreateEntity presenter;\n\n    @Override\n    public void init(final CreateEntity presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n        identifierBox.addValueChangeHandler(new ValueChangeHandler<String>() {\n            @Override\n            public void onValueChange(final ValueChangeEvent<String> valueChangeEvent) {\n                presenter.onEntityIdentifierChanged(valueChangeEvent.getValue());\n            }\n        });\n    }\n\n    @Override\n    public void show(String legend,\n                     String placeholder) {\n        this.formLegend.setText(legend != null ? legend : \"\");\n        identifierBox.setPlaceholder(placeholder != null ? placeholder : \"\");\n    }\n\n    @Override\n    public void setValidationState(ValidationState state) {\n        formGroup.setValidationState(state);\n    }\n\n    @Override\n    public void clear() {\n        form.reset();\n    }\n\n    interface CreateEntityViewBinder\n            extends\n            UiBinder<Widget, CreateEntityView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/CreateEntityView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <b:Form type=\"INLINE\" ui:field=\"form\">\n    <b:FieldSet>\n\n      <b:Legend ui:field=\"formLegend\"/>\n\n      <b:FormGroup ui:field=\"formGroup\">\n        <b:TextBox ui:field=\"identifierBox\" allowBlank=\"false\" />\n      </b:FormGroup>\n\n    </b:FieldSet>\n  </b:Form>\n    \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>An editor view contract for modifying the assigned entities.</p>\n * <p>This view wraps the given <code>EntitiesExplorerView</code> instance for exploring the users, groups or roles and adds editing features.</p>\n * @param <T> The presenter instance.\n * @since 0.8.0\n */\npublic interface AssignedEntitiesEditor<T> extends UberView<T> {\n\n    /**\n     * Sets the explorer view being wrapped and the editor's title..\n     * @param explorerView The explorer view widget.\n     * @return The view implementation.\n     */\n    AssignedEntitiesEditor<T> configure(final EntitiesExplorerView explorerView);\n\n    /**\n     * Configures the editor close button's text and click callback.\n     * @param closeText The button's text..\n     * @param closeCallback The button's click handler callback.\n     * @return The view implementation.\n     */\n    AssignedEntitiesEditor<T> configureClose(final String closeText,\n                                             final Command closeCallback);\n\n    /**\n     * Configures the editor save button's text and click callback.\n     * @param saveText The button's text..\n     * @param saveCallback The button's click handler callback.\n     * @return The view implementation.\n     */\n    AssignedEntitiesEditor<T> configureSave(final String saveText,\n                                            final Command saveCallback);\n\n    /**\n     * Show the editor view.\n     * @param header The editor's header.\n     * @return The view implementation.\n     */\n    AssignedEntitiesEditor<T> show(final String header);\n\n    /**\n     * Hide the editor view.\n     * @return The view implementation.\n     */\n    AssignedEntitiesEditor<T> hide();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\n/**\n * <p>An explorer view contract for showing the assigned users, groups or roles for a given entity.</p>\n * @since 0.8.0\n */\npublic interface AssignedEntitiesExplorer extends IsWidget {\n\n    /**\n     * Configure the view header and text when no assigned entities are added.\n     * @param header The header text.\n     * @param entitiesList The entities list view instance.\n     * @return The view implementation.\n     */\n    AssignedEntitiesExplorer configure(final String header,\n                                       final EntitiesList.View entitiesList);\n\n    /**\n     * Clears the view..\n     * @return The view instance.\n     */\n    AssignedEntitiesExplorer clear();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\n/**\n * <p>View implementation for exploring the assigned groups or roles for a given user.</p>\n * <p>This explorer is implemented using a <code>org.gwtbootstrap3.client.ui.LinkedGroup</code> widget.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class AssignedEntitiesExplorerView extends Composite\n        implements\n        AssignedEntitiesExplorer {\n\n    private static AssignedEntitiesExplorerViewBinder uiBinder = GWT.create(AssignedEntitiesExplorerViewBinder.class);\n    @UiField\n    Row headerRow;\n    @UiField\n    Heading headerText;\n    @UiField(provided = true)\n    EntitiesList.View entitiesListView;\n\n    @Override\n    public AssignedEntitiesExplorer configure(final String header,\n                                              final EntitiesList.View entitiesList) {\n        this.entitiesListView = entitiesList;\n        initWidget(uiBinder.createAndBindUi(this));\n\n        if (null != header && header.trim().length() > 0) {\n            headerText.setText(header);\n            headerRow.setVisible(true);\n        } else {\n            headerText.setText(\"\");\n            headerRow.setVisible(false);\n        }\n\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesExplorer clear() {\n        return this;\n    }\n\n    interface AssignedEntitiesExplorerViewBinder\n            extends\n            UiBinder<Row, AssignedEntitiesExplorerView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesExplorerView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:ufm=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.list\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n  </ui:style>\n\n  <b:Row>\n    <b:Column size=\"MD_12\">\n      <b:Row ui:field=\"headerRow\">\n        <b:Column size=\"MD_12\" >\n          <b:Heading ui:field=\"headerText\" size=\"H3\" text=\"Assigned entities:\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <ufm:EntitiesList.View ui:field=\"entitiesListView\"/>\n        </b:Column>\n      </b:Row>\n    </b:Column>\n  </b:Row>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesInlineEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({METHOD, FIELD, PARAMETER, TYPE})\npublic @interface AssignedEntitiesInlineEditor {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesInlineEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>An editor view implementation for modifying the assigned entities inline in a bootstrap grip container.</p>\n * @since 0.8.0\n */\n\n@Dependent\n@AssignedEntitiesInlineEditor\npublic class AssignedEntitiesInlineEditorView<T> extends Composite\n        implements\n        AssignedEntitiesEditor<T> {\n\n    private static AssignedEntitiesInlineEditorViewBinder uiBinder = GWT.create(AssignedEntitiesInlineEditorViewBinder.class);\n    @UiField\n    Row mainRow;\n    @UiField\n    Heading heading;\n    @UiField(provided = true)\n    EntitiesExplorerView entitiesExplorerView;\n    @UiField\n    Button saveButton;\n    private T presenter;\n\n    @Override\n    public void init(final T presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configure(final EntitiesExplorerView explorerView) {\n        this.entitiesExplorerView = explorerView;\n        initWidget(uiBinder.createAndBindUi(this));\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configureClose(final String closeText,\n                                                    final Command closeCallback) {\n        // Close not available for this view implementation.\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configureSave(final String saveText,\n                                                   final Command saveCallback) {\n        saveButton.setText(saveText);\n        saveButton.setTitle(saveText);\n        saveButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent clickEvent) {\n                if (saveCallback != null) {\n                    saveCallback.execute();\n                    ;\n                }\n            }\n        });\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> show(final String title) {\n        heading.setText(title);\n        heading.setTitle(title);\n        mainRow.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> hide() {\n        mainRow.setVisible(false);\n        return this;\n    }\n\n    interface AssignedEntitiesInlineEditorViewBinder\n            extends\n            UiBinder<Row, AssignedEntitiesInlineEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesInlineEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:explorer=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.explorer\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .entitiesExplorerRow {\n        margin-top: 15px; \n    }\n  </ui:style>\n\n  <b:Row ui:field=\"mainRow\">\n    <b:Column size=\"MD_12\">\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <b:Heading size=\"H3\" ui:field=\"heading\"/>\n        </b:Column>\n      </b:Row>\n      <b:Row addStyleNames=\"{style.entitiesExplorerRow}\">\n        <b:Column size=\"MD_12\">\n          <explorer:EntitiesExplorerView ui:field=\"entitiesExplorerView\"/>\n        </b:Column>\n      </b:Row>\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <b:Button type=\"PRIMARY\" ui:field=\"saveButton\" text=\"{i18n.save}\" title=\"{i18n.save}\"/>\n        </b:Column>\n      </b:Row>\n    </b:Column>\n  </b:Row>\n  \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesModalEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({METHOD, FIELD, PARAMETER, TYPE})\npublic @interface AssignedEntitiesModalEditor {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesModalEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>An editor view implementation for modifying the assigned entities using a modal panel.</p>\n * <p>This view wraps the given <code>ExplorerView</code> instance in a GWT Bootstrap 3 Modal panel.</p>\n * @since 0.8.0\n */\n\n@Dependent\n@AssignedEntitiesModalEditor\npublic class AssignedEntitiesModalEditorView<T> extends Composite\n        implements\n        AssignedEntitiesEditor<T> {\n\n    private static AssignedEntitiesModalEditorViewBinder uiBinder = GWT.create(AssignedEntitiesModalEditorViewBinder.class);\n    @UiField\n    FlowPanel mainPanel;\n    @UiField\n    Modal entitiesModal;\n    @UiField(provided = true)\n    EntitiesExplorerView entitiesExplorerView;\n    @UiField\n    Button closeButton;\n    @UiField\n    Button saveButton;\n    private T presenter;\n\n    @Override\n    public void init(final T presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configure(final EntitiesExplorerView explorerView) {\n        this.entitiesExplorerView = explorerView;\n        initWidget(uiBinder.createAndBindUi(this));\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configureClose(final String closeText,\n                                                    final Command closeCallback) {\n        closeButton.setText(closeText);\n        closeButton.setTitle(closeText);\n        closeButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent clickEvent) {\n                if (closeCallback != null) {\n                    closeCallback.execute();\n                    ;\n                } else {\n                    entitiesModal.hide();\n                }\n            }\n        });\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> configureSave(final String saveText,\n                                                   final Command saveCallback) {\n        saveButton.setText(saveText);\n        saveButton.setTitle(saveText);\n        saveButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent clickEvent) {\n                if (saveCallback != null) {\n                    saveCallback.execute();\n                    ;\n                } else {\n                    entitiesModal.hide();\n                }\n            }\n        });\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> show(final String title) {\n        entitiesModal.setTitle(title);\n        entitiesModal.show();\n        return this;\n    }\n\n    @Override\n    public AssignedEntitiesEditor<T> hide() {\n        entitiesModal.hide();\n        return this;\n    }\n\n    interface AssignedEntitiesModalEditorViewBinder\n            extends\n            UiBinder<FlowPanel, AssignedEntitiesModalEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/AssignedEntitiesModalEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:explorer=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.explorer\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .mainPanel {\n      width: 100%;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n\n    <!-- Modal panel for assigned entities management- . -->\n    <b:Modal ui:field=\"entitiesModal\" title=\"Assigned entities\" closable=\"true\" fade=\"true\" dataBackdrop=\"STATIC\" dataKeyboard=\"true\">\n      <b:ModalBody>\n        <explorer:EntitiesExplorerView ui:field=\"entitiesExplorerView\"/>\n      </b:ModalBody>\n      <b:ModalFooter>\n        <b:Button type=\"PRIMARY\" ui:field=\"saveButton\" text=\"{i18n.save}\" title=\"{i18n.save}\"/>\n        <b:Button type=\"DEFAULT\"  ui:field=\"closeButton\" text=\"{i18n.cancel}\" title=\"{i18n.cancel}\"/>\n      </b:ModalFooter>\n    </b:Modal>\n      \n  </g:FlowPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionNodeEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionWidgetFactory;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeFactory;\nimport org.uberfire.security.impl.authz.DefaultPermissionCollection;\n\n@Dependent\npublic class ACLEditor implements IsWidget {\n\n    View view;\n    PermissionWidgetFactory nodeWidgetFactory;\n    PermissionTreeFactory permissionTreeFactory;\n    PermissionTree permissionTree;\n    List<PermissionNodeEditor> permissionNodeEditorList = new ArrayList<>();\n    @Inject\n    public ACLEditor(View view,\n                     PermissionWidgetFactory nodeWidgetFactory,\n                     PermissionTreeFactory permissionTreeFactory) {\n        this.view = view;\n        this.nodeWidgetFactory = nodeWidgetFactory;\n        this.permissionTreeFactory = permissionTreeFactory;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public PermissionCollection getPermissions() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        collect(pc,\n                permissionNodeEditorList);\n        return pc;\n    }\n\n    private void collect(PermissionCollection pc,\n                         List<PermissionNodeEditor> nodeEditors) {\n        if (nodeEditors != null) {\n            for (PermissionNodeEditor nodeEditor : nodeEditors) {\n                for (Permission p : nodeEditor.getPermissionNode().getPermissionList()) {\n                    pc.add(p);\n                }\n                collect(pc,\n                        nodeEditor.getChildEditors());\n            }\n        }\n    }\n\n    public void edit(Role role) {\n        edit(permissionTreeFactory.createPermissionTree(role));\n    }\n\n    public void edit(Group group) {\n        edit(permissionTreeFactory.createPermissionTree(group));\n    }\n\n    private void edit(PermissionTree tree) {\n        this.permissionTree = tree;\n\n        view.clear();\n        permissionNodeEditorList.clear();\n        List<PermissionNode> rootNodeList = tree.getRootNodes();\n        for (PermissionNode rootNode : rootNodeList) {\n            PermissionNodeEditor rootNodeEditor = nodeWidgetFactory.createEditor(rootNode);\n            rootNodeEditor.setACLEditor(this);\n            rootNodeEditor.edit(rootNode);\n            view.addRootNodeWidget(rootNodeEditor);\n            permissionNodeEditorList.add(rootNodeEditor);\n        }\n    }\n\n    public interface View extends UberView<ACLEditor> {\n\n        void clear();\n\n        void addRootNodeWidget(IsWidget rootNodeWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLEditorView.html",
    "content": "<div data-field=\"container\" class=\"pull-left\" style=\"margin-top: 10px;\">\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class ACLEditorView extends Composite implements ACLEditor.View {\n\n    @Inject\n    @DataField(\"container\")\n    Container container;\n    private ACLEditor presenter;\n\n    @Override\n    public void init(ACLEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        container.clear();\n    }\n\n    @Override\n    public void addRootNodeWidget(IsWidget rootNodeWidget) {\n        container.add(rootNodeWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLSettings.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.HomePerspectiveChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PriorityChangedEvent;\nimport org.uberfire.ext.widgets.common.client.dropdown.PerspectiveDropDown;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\n@Dependent\npublic class ACLSettings implements IsWidget {\n\n    View view;\n    PermissionManager permissionManager;\n    PerspectiveDropDown homePerspectiveDropDown;\n    PerspectiveTreeProvider perspectiveTreeProvider;\n    PriorityDropDown priorityDropDown;\n    Event<HomePerspectiveChangedEvent> homePerspectiveChangedEvent;\n    Event<PriorityChangedEvent> priorityChangedEvent;\n    AuthorizationPolicy authzPolicy;\n    boolean isEditMode;\n\n    @Inject\n    public ACLSettings(View view,\n                       PermissionManager permissionManager,\n                       PerspectiveDropDown homePerspectiveDropDown,\n                       PerspectiveTreeProvider perspectiveTreeProvider,\n                       PriorityDropDown priorityDropDown,\n                       Event<HomePerspectiveChangedEvent> homePerspectiveChangedEvent,\n                       Event<PriorityChangedEvent> priorityChangedEvent) {\n        this.view = view;\n        this.permissionManager = permissionManager;\n        this.homePerspectiveDropDown = homePerspectiveDropDown;\n        this.perspectiveTreeProvider = perspectiveTreeProvider;\n        this.priorityDropDown = priorityDropDown;\n        this.homePerspectiveChangedEvent = homePerspectiveChangedEvent;\n        this.priorityChangedEvent = priorityChangedEvent;\n        this.authzPolicy = permissionManager.getAuthorizationPolicy();\n\n        homePerspectiveDropDown.setMaxItems(50);\n        homePerspectiveDropDown.setOnChange(this::onHomePerspectiveSelected);\n        homePerspectiveDropDown.setPerspectiveNameProvider(perspectiveTreeProvider::getPerspectiveName);\n        homePerspectiveDropDown.setPerspectiveIdsExcluded(perspectiveTreeProvider.getPerspectiveIdsExcluded());\n\n        view.setHomePerspectiveSelector(homePerspectiveDropDown);\n\n        priorityDropDown.setOnChange(this::onPrioritySelected);\n        view.setPrioritySelector(priorityDropDown);\n\n        this.view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public PerspectiveActivity getHomePerspective() {\n        return homePerspectiveDropDown.getSelectedPerspective();\n    }\n\n    public int getPriority() {\n        return priorityDropDown.getSelectedPriority();\n    }\n\n    public void show(Role role) {\n        isEditMode = false;\n        open(role);\n    }\n\n    public void show(Group group) {\n        isEditMode = false;\n        open(group);\n    }\n\n    public void edit(Role role) {\n        isEditMode = true;\n        open(role);\n    }\n\n    public void edit(Group group) {\n        isEditMode = true;\n        open(group);\n    }\n\n    private void open(Role role) {\n        String homePerspectiveId = authzPolicy.getHomePerspective(role);\n        int priority = authzPolicy.getPriority(role);\n        open(homePerspectiveId,\n             priority);\n    }\n\n    private void open(Group group) {\n        String homePerspectiveId = authzPolicy.getHomePerspective(group);\n        int priority = authzPolicy.getPriority(group);\n        open(homePerspectiveId,\n             priority);\n    }\n\n    private void open(String homePerspectiveId,\n                      int priority) {\n        if (homePerspectiveId == null) {\n            homePerspectiveId = homePerspectiveDropDown.getDefaultPerspective().getIdentifier();\n        }\n\n        view.setHomePerspectiveSelectorEnabled(isEditMode);\n        view.setPrioritySelectorEnabled(isEditMode);\n\n        if (isEditMode) {\n            if (homePerspectiveId != null) {\n                homePerspectiveDropDown.setSelectedPerspective(homePerspectiveId);\n            }\n            priorityDropDown.setSelectedPriority(priority);\n        } else {\n            if (homePerspectiveId != null) {\n                String itemName = homePerspectiveDropDown.getItemName(homePerspectiveId);\n                view.setHomePerspectiveName(itemName);\n                view.setHomePerspectiveTitle(homePerspectiveId);\n            } else {\n                view.setNoHomePerspectiveDefined();\n            }\n            view.setPriorityName(priorityDropDown.getPriorityName(priority));\n        }\n    }\n\n    void onHomePerspectiveSelected() {\n        PerspectiveActivity p = getHomePerspective();\n        homePerspectiveChangedEvent.fire(new HomePerspectiveChangedEvent(this,\n                                                                         p));\n    }\n\n    void onPrioritySelected() {\n        int priority = getPriority();\n        priorityChangedEvent.fire(new PriorityChangedEvent(this,\n                                                           priority));\n    }\n\n    public void updateAuthzPolicy(@Observes AuthorizationPolicySavedEvent authzPolicySavedEvent) {\n        this.authzPolicy = authzPolicySavedEvent.getPolicy();\n    }\n\n    public interface View extends UberView<ACLSettings> {\n\n        View setHomePerspectiveName(String name);\n\n        View setHomePerspectiveTitle(String name);\n\n        View setHomePerspectiveSelectorEnabled(boolean enabled);\n\n        View setHomePerspectiveSelector(IsWidget widget);\n\n        View setNoHomePerspectiveDefined();\n\n        View setPriorityName(String name);\n\n        View setPrioritySelectorEnabled(boolean enabled);\n\n        View setPrioritySelector(IsWidget widget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLSettingsView.css",
    "content": ".acls-row {\n    margin-bottom: 15px;\n}\n\n.acls-priority-panel {\n    margin-right: 5px;\n}\n\n.acls-help-panel {\n    font-size: small;\n}\n\n.acls-help-icon {\n    margin-left: 5px;\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLSettingsView.html",
    "content": "<div class=\"pull-left\" style=\"width: 100%;\">\n    <div class=\"row acls-row\">\n        <div class=\"col-md-2\">\n            <label id=\"homePerspectiveLabel\" class=\"panel-title\">Home Perspective</label>\n            <span id=\"homePerspectiveHelp\" class=\"acl-help-panel\">\n                <i class=\"pf pficon-help acl-help-icon\" data-toggle=\"tooltip\" data-placement=\"left\"></i>\n            </span>\n        </div>\n        <div class=\"col-md-10\">\n            <span id=\"homePerspectiveName\" data-toggle=\"tooltip\" data-placement=\"left\"></span>\n            <div id=\"homePerspectiveSelectorPanel\"></div>\n        </div>\n    </div>\n    <div class=\"row acls-row\">\n        <div class=\"col-md-2\">\n            <label id=\"priorityLabel\" class=\"panel-title acls-priority-panel\">Priority</label>\n            <span id=\"priorityHelp\" class=\"acl-help-panel\">\n                <i class=\"pf pficon-help\" data-toggle=\"tooltip\" data-placement=\"left\"></i>\n            </span>\n        </div>\n        <div class=\"col-md-10\">\n            <span id=\"priorityValue\"></span>\n            <div id=\"prioritySelectorPanel\"></div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLSettingsView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.LabelElement;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\n\n@Dependent\n@Templated\npublic class ACLSettingsView extends Composite\n        implements ACLSettings.View {\n\n    @DataField\n    LabelElement homePerspectiveLabel = Document.get().createLabelElement();\n    @Inject\n    @DataField\n    Span homePerspectiveName;\n    @Inject\n    @DataField\n    FlowPanel homePerspectiveSelectorPanel;\n    @Inject\n    @DataField\n    Span homePerspectiveHelp;\n    @DataField\n    LabelElement priorityLabel = Document.get().createLabelElement();\n    @Inject\n    @DataField\n    Span priorityValue;\n    @Inject\n    @DataField\n    FlowPanel prioritySelectorPanel;\n    @Inject\n    @DataField\n    Span priorityHelp;\n    private ACLSettings presenter;\n\n    @Override\n    public void init(ACLSettings presenter) {\n        this.presenter = presenter;\n        homePerspectiveLabel.setInnerText(UsersManagementWidgetsConstants.INSTANCE.homePerspective());\n        homePerspectiveHelp.setAttribute(\"title\",\n                                         UsersManagementWidgetsConstants.INSTANCE.homePerspectiveTooltip());\n        priorityLabel.setInnerText(UsersManagementWidgetsConstants.INSTANCE.priority());\n        priorityHelp.setAttribute(\"title\",\n                                  UsersManagementWidgetsConstants.INSTANCE.priorityTooltip());\n    }\n\n    @Override\n    public ACLSettings.View setHomePerspectiveName(String name) {\n        homePerspectiveName.setTextContent(\"\\\"\" + name + \"\\\"\");\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setHomePerspectiveTitle(String name) {\n        homePerspectiveName.setTitle(name);\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setNoHomePerspectiveDefined() {\n        String undefined = UsersManagementWidgetsConstants.INSTANCE.noHomePerspective();\n        homePerspectiveName.setTextContent(undefined);\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setHomePerspectiveSelector(IsWidget widget) {\n        homePerspectiveSelectorPanel.clear();\n        homePerspectiveSelectorPanel.add(widget);\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setHomePerspectiveSelectorEnabled(boolean enabled) {\n        homePerspectiveSelectorPanel.setVisible(enabled);\n        if (enabled) {\n            homePerspectiveName.getStyle().setProperty(\"display\",\n                                                       \"none\");\n        } else {\n            homePerspectiveName.getStyle().removeProperty(\"display\");\n        }\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setPriorityName(String name) {\n        priorityValue.setTextContent(\"\\\"\" + name + \"\\\"\");\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setPrioritySelector(IsWidget widget) {\n        prioritySelectorPanel.clear();\n        prioritySelectorPanel.add(widget);\n        return this;\n    }\n\n    @Override\n    public ACLSettings.View setPrioritySelectorEnabled(boolean enabled) {\n        prioritySelectorPanel.setVisible(enabled);\n        if (enabled) {\n            priorityValue.getStyle().setProperty(\"display\",\n                                                 \"none\");\n        } else {\n            priorityValue.getStyle().removeProperty(\"display\");\n        }\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLViewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionNodeViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionWidgetFactory;\nimport org.uberfire.security.authz.VotingStrategy;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeFactory;\n\n@Dependent\npublic class ACLViewer implements IsWidget {\n\n    View view;\n    PermissionWidgetFactory nodeWidgetFactory;\n    PermissionTreeFactory permissionTreeFactory;\n    PermissionTree permissionTree;\n    @Inject\n    public ACLViewer(View view,\n                     PermissionWidgetFactory nodeWidgetFactory,\n                     PermissionTreeFactory permissionTreeFactory) {\n        this.view = view;\n        this.nodeWidgetFactory = nodeWidgetFactory;\n        this.permissionTreeFactory = permissionTreeFactory;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void show(Role role) {\n        show(permissionTreeFactory.createPermissionTree(role));\n    }\n\n    public void show(Group group) {\n        show(permissionTreeFactory.createPermissionTree(group));\n    }\n\n    public void show(User user) {\n        show(permissionTreeFactory.createPermissionTree(user,\n                                                        VotingStrategy.PRIORITY));\n    }\n\n    private void show(PermissionTree tree) {\n        view.clear();\n        permissionTree = tree;\n\n        if (tree != null) {\n            List<PermissionNode> rootNodeList = tree.getRootNodes();\n            for (PermissionNode rootNode : rootNodeList) {\n                PermissionNodeViewer rootNodeViewer = nodeWidgetFactory.createViewer(rootNode);\n                rootNodeViewer.show(rootNode);\n                view.addRootNodeWidget(rootNodeViewer);\n            }\n        }\n    }\n\n    public interface View extends UberView<ACLViewer> {\n\n        void clear();\n\n        void addRootNodeWidget(IsWidget rootNodeWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLViewerView.html",
    "content": "<div data-field=\"container\" class=\"pull-left\">\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLViewerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class ACLViewerView extends Composite\n        implements ACLViewer.View {\n\n    @Inject\n    @DataField(\"container\")\n    Container container;\n    private ACLViewer presenter;\n\n    @Override\n    public void init(ACLViewer presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        container.clear();\n    }\n\n    @Override\n    public void addRootNodeWidget(IsWidget rootNodeWidget) {\n        container.add(rootNodeWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/PriorityDropDown.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchResults;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchService;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class PriorityDropDown implements IsWidget {\n\n    LiveSearchDropDown<String> liveSearchDropDown;\n    LiveSearchService<String> searchService = new LiveSearchService<String>() {\n        @Override\n        public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n            LiveSearchResults results = new LiveSearchResults(priorityItemList).sortByKey();\n            callback.afterSearch(results);\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n            LiveSearchResults results = new LiveSearchResults(1);\n            if(priorityItemList.contains(key)) {\n                results.add(key);\n            }\n            callback.afterSearch(results);\n        }\n    };\n\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n    List<String> priorityItemList;\n\n\n    @Inject\n    public PriorityDropDown(LiveSearchDropDown liveSearchDropDown) {\n        this.liveSearchDropDown = liveSearchDropDown;\n        this.priorityItemList = new ArrayList<>();\n    }\n\n    @PostConstruct\n    private void init() {\n        priorityItemList.add(UsersManagementWidgetsConstants.INSTANCE.priorityVeryHigh());\n        priorityItemList.add(UsersManagementWidgetsConstants.INSTANCE.priorityHigh());\n        priorityItemList.add(UsersManagementWidgetsConstants.INSTANCE.priorityNormal());\n        priorityItemList.add(UsersManagementWidgetsConstants.INSTANCE.priorityLow());\n        priorityItemList.add(UsersManagementWidgetsConstants.INSTANCE.priorityVeryLow());\n\n        liveSearchDropDown.setSelectorHint(UsersManagementWidgetsConstants.INSTANCE.selectPriorityHint());\n        liveSearchDropDown.setSearchEnabled(false);\n        liveSearchDropDown.setClearSelectionEnabled(false);\n        liveSearchDropDown.init(searchService, selectionHandler);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return liveSearchDropDown.asWidget();\n    }\n\n    public String getPriorityName(int priority) {\n        Priority p = resolvePriority(priority);\n        int idx = p.getIndex();\n        return priorityItemList.get(idx);\n    }\n\n    public int getSelectedPriority() {\n        String selected = selectionHandler.getSelectedKey();\n        if (selected == null) {\n            return -1;\n        }\n        int idx = priorityItemList.indexOf(selected);\n        return Priority.get(idx).getOrdinal();\n    }\n\n    public void setSelectedPriority(int ordinal) {\n        Priority priority = resolvePriority(ordinal);\n        String item = priorityItemList.get(priority.getIndex());\n        liveSearchDropDown.setSelectedItem(item);\n    }\n\n    public void setWidth(int minWidth) {\n        liveSearchDropDown.setWidth(minWidth);\n    }\n\n    public void setOnChange(Command onChange) {\n        liveSearchDropDown.setOnChange(onChange);\n    }\n\n    public void clear() {\n        liveSearchDropDown.clear();\n    }\n\n    public Priority resolvePriority(int priority) {\n        if (priority < -5) {\n            return Priority.VERY_LOW;\n        }\n        if (priority < 0) {\n            return Priority.LOW;\n        }\n        if (priority == 0) {\n            return Priority.NORMAL;\n        }\n        if (priority <= 5) {\n            return Priority.HIGH;\n        }\n        return Priority.VERY_HIGH;\n    }\n\n    private enum Priority {\n\n        VERY_HIGH(10),\n        HIGH(5),\n        NORMAL(0),\n        LOW(-5),\n        VERY_LOW(-10);\n\n        private static Priority[] _typeArray = values();\n        int ordinal = 0;\n\n        Priority(int ordinal) {\n            this.ordinal = ordinal;\n        }\n\n        public static Priority get(int idx) {\n            return _typeArray[idx];\n        }\n\n        public int getOrdinal() {\n            return ordinal;\n        }\n\n        public int getIndex() {\n            for (int i = 0; i < _typeArray.length; i++) {\n                Priority item = _typeArray[i];\n                if (this.equals(item)) {\n                    return i;\n                }\n            }\n            return -1;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/BasePermissionNodeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\npublic abstract class BasePermissionNodeEditor implements PermissionNodeEditor {\n\n    protected ACLEditor aclEditor = null;\n    protected PermissionNode permissionNode;\n    protected Map<Permission, PermissionSwitchToogle> permissionSwitchMap = new HashMap<>();\n    protected int width = 240;\n    protected int leftMargin = 0;\n    protected int treeLevel = 0;\n    protected int padding = 15;\n    private PermissionNodeEditor parentEditor = null;\n    private List<PermissionNodeEditor> childEditorList = new ArrayList<>();\n\n    @Override\n    public ACLEditor getACLEditor() {\n        return aclEditor;\n    }\n\n    @Override\n    public void setACLEditor(ACLEditor aclEditor) {\n        this.aclEditor = aclEditor;\n    }\n\n    @Override\n    public PermissionNode getPermissionNode() {\n        return permissionNode;\n    }\n\n    @Override\n    public PermissionNodeEditor getParentEditor() {\n        return parentEditor;\n    }\n\n    @Override\n    public void setParentEditor(PermissionNodeEditor editor) {\n        this.parentEditor = editor;\n    }\n\n    @Override\n    public List<PermissionNodeEditor> getChildEditors() {\n        return childEditorList;\n    }\n\n    @Override\n    public void addChildEditor(PermissionNodeEditor editor) {\n        editor.setParentEditor(this);\n        childEditorList.add(editor);\n    }\n\n    @Override\n    public void removeChildEditor(PermissionNodeEditor editor) {\n        editor.setParentEditor(null);\n        childEditorList.remove(editor);\n    }\n\n    @Override\n    public boolean hasChildEditors() {\n        return !childEditorList.isEmpty();\n    }\n\n    @Override\n    public void clearChildEditors() {\n        childEditorList.clear();\n    }\n\n    @Override\n    public boolean isAnException(Permission permission) {\n        for (Permission p : permissionNode.getPermissionList()) {\n            if (p.impliesName(permission)) {\n                return !p.getResult().equals(permission.getResult());\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public int getExceptionNumber(Permission permission) {\n        int count = 0;\n        for (PermissionNodeEditor nodeEditor : getChildEditors()) {\n            if (nodeEditor.getPermissionNode() != null && nodeEditor.getPermissionNode().getPermissionList() != null) {\n                for (Permission p : nodeEditor.getPermissionNode().getPermissionList()) {\n                    if (permission.impliesName(p) && !permission.getResult().equals(p.getResult())) {\n                        count++;\n                    }\n                }\n            }\n        }\n        return count;\n    }\n\n    @Override\n    public int getTreeLevel() {\n        return treeLevel;\n    }\n\n    @Override\n    public void setTreeLevel(int treeLevel) {\n        this.treeLevel = treeLevel;\n        this.onNodePanelWidthChanged();\n    }\n\n    @Override\n    public void setLeftMargin(int margin) {\n        this.leftMargin = margin;\n        this.onNodePanelWidthChanged();\n    }\n\n    @Override\n    public int getNodePanelWidth() {\n        return width - leftMargin - (treeLevel * padding);\n    }\n\n    /**\n     * Invoked when any of the parent permissions of a permission editor changes.\n     * <p>\n     * <p>By default, it does nothing as it is up to each subclass to provide its own implementation.</p>\n     * <p>\n     * <p>Only leaf or intermediate nodes are invoked.</p>\n     */\n    @Override\n    public void onParentPermissionChanged(Permission permission,\n                                          boolean on) {\n\n    }\n\n    /**\n     * Invoked when any of the permissions of a child editor changes.\n     * <p>\n     * <p>By default, it does nothing as it is up to each subclass to provide its own implementation.</p>\n     * <p>\n     * <p>This method is never invoked on leaf nodes.</p>\n     */\n    @Override\n    public void onChildPermissionChanged(PermissionNodeEditor childEditor,\n                                         Permission permission,\n                                         boolean on) {\n\n    }\n\n    /**\n     * Invoked when the width of a node editor panel changes.\n     * <p>\n     * <p>By default, it  does nothing as it is up to each subclass to provide its own implementation.</p>\n     */\n    protected void onNodePanelWidthChanged() {\n\n    }\n\n    /**\n     * Invoked when a permission toogle switch changes its value.\n     * @param permission The changing permission\n     * @param on The switch status\n     */\n    protected void onPermissionChanged(Permission permission,\n                                       boolean on) {\n        notifyPermissionChange(permission,\n                               on);\n        processPermissionDependencies(permission);\n    }\n\n    /**\n     * Invoked when a permission toogle switch changes its value.\n     * @param permission The changing permission\n     * @param on The switch status\n     */\n    protected void notifyPermissionChange(Permission permission,\n                                          boolean on) {\n        // Notify the parent editor\n        if (parentEditor != null) {\n            parentEditor.onChildPermissionChanged(this,\n                                                  permission,\n                                                  on);\n        }\n        // Notify the children editors\n        for (PermissionNodeEditor child : getChildEditors()) {\n            child.onParentPermissionChanged(permission,\n                                            on);\n        }\n    }\n\n    /**\n     * Make sure all the permission switch controls are updated according the inter-dependencies\n     * declared between them.\n     * <p>\n     * <p>For instance, given an update & delete permissions that depends on a read permission,\n     * if the read permission is turned off then the update & delete permission switches are\n     * turned off as well.</p>\n     */\n    protected void processAllPermissionDependencies() {\n        for (Permission permission : permissionSwitchMap.keySet()) {\n            processPermissionDependencies(permission);\n        }\n    }\n\n    /**\n     * Updates any permission switch which has a dependency with the given permission.\n     * @param permission The permission which dependencies needs to be revisited.\n     */\n    protected void processPermissionDependencies(Permission permission) {\n        List<Permission> dependencyList = this.getPermissionNode().getDependencies(permission);\n        if (dependencyList != null) {\n            PermissionSwitchToogle permissionSwitch = permissionSwitchMap.get(permission);\n            for (Permission dep : dependencyList) {\n                PermissionSwitchToogle depSwitch = permissionSwitchMap.get(dep);\n\n                if (!permissionSwitch.isOn()) {\n                    dep.setResult(AuthorizationResult.ACCESS_DENIED);\n                    depSwitch.setOn(false);\n                    depSwitch.setEnabled(false);\n\n                    // Notify the dependant switch change\n                    this.notifyPermissionChange(dep,\n                                                false);\n                } else {\n                    depSwitch.setEnabled(true);\n                }\n            }\n        }\n    }\n\n    /**\n     * Links the given switch widget with the specified permission instance.\n     * @param permission The permission\n     * @param permissionSwitch The switch widget related\n     */\n    protected void registerPermissionSwitch(Permission permission,\n                                            PermissionSwitchToogle permissionSwitch) {\n        permissionSwitchMap.put(permission,\n                                permissionSwitch);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/BasePermissionNodeViewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\npublic abstract class BasePermissionNodeViewer implements PermissionNodeViewer {\n\n    protected int treeLevel = 0;\n\n    @Override\n    public int getTreeLevel() {\n        return treeLevel;\n    }\n\n    @Override\n    public void setTreeLevel(int treeLevel) {\n        this.treeLevel = treeLevel;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\n@Dependent\npublic class LeafPermissionNodeEditor extends BasePermissionNodeEditor {\n\n    View view;\n    PermissionWidgetFactory widgetFactory;\n    Event<PermissionChangedEvent> permissionChangedEvent;\n    @Inject\n    public LeafPermissionNodeEditor(View view,\n                                    PermissionWidgetFactory widgetFactory,\n                                    Event<PermissionChangedEvent> permissionChangedEvent) {\n        this.view = view;\n        this.widgetFactory = widgetFactory;\n        this.permissionChangedEvent = permissionChangedEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void edit(PermissionNode node) {\n        permissionNode = node;\n        permissionSwitchMap.clear();\n\n        String name = node.getNodeName();\n        String fullName = node.getNodeFullName();\n\n        view.setNodeName(name);\n        view.setNodePanelWidth(getNodePanelWidth());\n\n        if (fullName != null && !fullName.equals(name)) {\n            view.setNodeFullName(fullName);\n        }\n\n        PermissionNodeEditor parentEditor = getParentEditor();\n        for (Permission permission : permissionNode.getPermissionList()) {\n            String grantName = node.getPermissionGrantName(permission);\n            String denyName = node.getPermissionDenyName(permission);\n            boolean granted = AuthorizationResult.ACCESS_GRANTED.equals(permission.getResult());\n\n            PermissionSwitchToogle switchToogle = null;\n            if (parentEditor == null || parentEditor.getPermissionNode().getPermissionList().isEmpty()) {\n                PermissionSwitch permissionSwitch = widgetFactory.createSwitch();\n                permissionSwitch.init(grantName,\n                                      denyName,\n                                      granted,\n                                      0);\n                switchToogle = permissionSwitch;\n            } else {\n                PermissionExceptionSwitch permissionSwitch = widgetFactory.createExceptionSwitch();\n                boolean isException = parentEditor.isAnException(permission);\n                permissionSwitch.init(grantName,\n                                      denyName,\n                                      granted,\n                                      isException);\n                switchToogle = permissionSwitch;\n            }\n            initPermissionSwitchToogle(switchToogle,\n                                       permission);\n            super.registerPermissionSwitch(permission,\n                                           switchToogle);\n        }\n\n        // Update the switches status according to the inter-dependencies between their permissions\n        super.processAllPermissionDependencies();\n\n        // Add the switch controls to the view once initialized\n        for (PermissionSwitchToogle switchToogle : permissionSwitchMap.values()) {\n            view.addPermission(switchToogle);\n        }\n    }\n\n    private void initPermissionSwitchToogle(PermissionSwitchToogle permissionSwitch,\n                                            Permission permission) {\n        permissionSwitch.setOnChange(() -> {\n            permission.setResult(permissionSwitch.isOn() ? AuthorizationResult.ACCESS_GRANTED : AuthorizationResult.ACCESS_DENIED);\n\n            // Notify the change\n            super.onPermissionChanged(permission,\n                                      permissionSwitch.isOn());\n            permissionChangedEvent.fire(new PermissionChangedEvent(getACLEditor(),\n                                                                   permission,\n                                                                   permissionSwitch.isOn()));\n        });\n    }\n\n    @Override\n    protected void notifyPermissionChange(Permission permission,\n                                          boolean on) {\n        super.notifyPermissionChange(permission,\n                                     on);\n        this.updateExceptionFlags();\n    }\n\n    @Override\n    public void onParentPermissionChanged(Permission permission,\n                                          boolean on) {\n        this.updateExceptionFlags();\n    }\n\n    private void updateExceptionFlags() {\n        PermissionNodeEditor parentEditor = getParentEditor();\n        if (parentEditor != null && !parentEditor.getPermissionNode().getPermissionList().isEmpty()) {\n            for (Permission permission : permissionSwitchMap.keySet()) {\n                PermissionSwitchToogle switchToogle = permissionSwitchMap.get(permission);\n                boolean isException = parentEditor.isAnException(permission);\n                switchToogle.setNumberOfExceptions(isException ? 1 : 0);\n            }\n        }\n    }\n\n    @Override\n    protected void onNodePanelWidthChanged() {\n        int width = getNodePanelWidth();\n        view.setNodePanelWidth(width);\n    }\n\n    public interface View extends UberView<LeafPermissionNodeEditor> {\n\n        void setNodeName(String name);\n\n        void setNodePanelWidth(int width);\n\n        void setNodeFullName(String name);\n\n        void addPermission(PermissionSwitchToogle permissionSwitch);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeEditorView.css",
    "content": ".acl-leaf-panel {\n    padding-left: 20px;\n}\n\n.acl-display-none {\n    display: none;\n}\n\n.acl-help-icon {\n    margin-left: 5px;\n}\n\n.acl-name-panel {\n    display: table-cell;\n    vertical-align: middle;\n    height: 30px;\n}\n\n.acl-name-label {\n    float: left;\n}\n\n.acl-help-panel {\n    vertical-align: middle;\n    font-size: small;\n    margin-left: 5px;\n}\n\n.acl-permissions-panel {\n    display: table-cell;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeEditorView.html",
    "content": "<div class=\"acl-leaf-panel\">\n    <div data-field=\"nodeNamePanel\" class=\"acl-name-panel\">\n        <div data-field=\"nodeName\" class=\"acl-name-label\"></div>\n        <span data-field=\"nodeNameHelp\" class=\"acl-display-none\">\n            <i class=\"pf pficon-help\" data-toggle=\"tooltip\" data-placement=\"left\" class=\"acl-help-icon\"></i>\n        </span>\n\n    </div>\n    <div data-field=\"nodePermissions\" class=\"acl-permissions-panel\">\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Label;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class LeafPermissionNodeEditorView extends Composite\n        implements LeafPermissionNodeEditor.View {\n\n    @Inject\n    @DataField\n    Label nodeName;\n    @Inject\n    @DataField\n    Span nodeNameHelp;\n    @Inject\n    @DataField\n    Div nodeNamePanel;\n    @Inject\n    @DataField\n    FlowPanel nodePermissions;\n    private LeafPermissionNodeEditor presenter;\n\n    @Override\n    public void init(LeafPermissionNodeEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setNodeName(String name) {\n        nodeName.setText(name);\n    }\n\n    @Override\n    public void setNodePanelWidth(int width) {\n        nodeNamePanel.getStyle().setProperty(\"width\",\n                                             width + \"px\");\n    }\n\n    @Override\n    public void setNodeFullName(String name) {\n        nodeName.setTitle(name);\n        nodeNameHelp.setTitle(name);\n        nodeNameHelp.setClassName(\"acl-help-panel\");\n    }\n\n    @Override\n    public void addPermission(PermissionSwitchToogle permissionSwitch) {\n        nodePermissions.add(permissionSwitch);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeViewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\n@Dependent\npublic class LeafPermissionNodeViewer extends BasePermissionNodeViewer {\n\n    View view;\n    PermissionNode permissionNode;\n    @Inject\n    public LeafPermissionNodeViewer(View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public PermissionNode getPermissionNode() {\n        return permissionNode;\n    }\n\n    @Override\n    public List<PermissionNodeViewer> getChildren() {\n        return null;\n    }\n\n    @Override\n    public void show(PermissionNode node) {\n        permissionNode = node;\n\n        String name = node.getNodeName();\n        String fullName = node.getNodeFullName();\n\n        view.setNodeName(name);\n        if (fullName != null && !fullName.equals(name)) {\n            view.setNodeFullName(fullName);\n        }\n\n        for (Permission permission : permissionNode.getPermissionList()) {\n\n            if (AuthorizationResult.ACCESS_GRANTED.equals(permission.getResult())) {\n                String granted = node.getPermissionGrantName(permission).toLowerCase();\n                view.permissionGranted(granted);\n            } else {\n                String denied = node.getPermissionDenyName(permission).toLowerCase();\n                view.permissionDenied(denied);\n            }\n        }\n    }\n\n    public interface View extends UberView<LeafPermissionNodeViewer> {\n\n        void setNodeName(String name);\n\n        void setNodeFullName(String name);\n\n        void permissionGranted(String permission);\n\n        void permissionDenied(String permission);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeViewerView.html",
    "content": "<div data-field=\"nodePermissions\">\n    <div style=\"display: table-cell;\">\n        <label data-field=\"nodeName\"></label>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/LeafPermissionNodeViewerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Label;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class LeafPermissionNodeViewerView extends Composite\n        implements LeafPermissionNodeViewer.View {\n\n    @Inject\n    @DataField\n    Label nodeName;\n    @DataField\n    Element nodePermissions = DOM.createDiv();\n    private LeafPermissionNodeViewer presenter;\n\n    @Override\n    public void init(LeafPermissionNodeViewer presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setNodeName(String name) {\n        nodeName.setText(name + \":\");\n    }\n\n    @Override\n    public void setNodeFullName(String name) {\n        nodeName.setTitle(name);\n    }\n\n    @Override\n    public void permissionGranted(String permission) {\n        addPermission(permission,\n                      \"#00618a\");\n    }\n\n    @Override\n    public void permissionDenied(String permission) {\n        addPermission(permission,\n                      \"#a30000\");\n    }\n\n    private void addPermission(String permission,\n                               String color) {\n        Element div = DOM.createDiv();\n        div.getStyle().setDisplay(Style.Display.TABLE_CELL);\n        div.getStyle().setPaddingLeft(5,\n                                      Style.Unit.PX);\n        div.getStyle().setColor(color);\n        div.setInnerText(permission);\n        nodePermissions.appendChild(div);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.TreeMap;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeAddedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeRemovedEvent;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchCallback;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchResults;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchService;\nimport org.uberfire.ext.widgets.common.client.dropdown.SingleLiveSearchSelectionHandler;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.HasResources;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.DefaultLoadOptions;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\n\n@Dependent\npublic class MultiplePermissionNodeEditor extends BasePermissionNodeEditor {\n\n    View view;\n    PermissionWidgetFactory widgetFactory;\n    LiveSearchDropDown liveSearchDropDown;\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n    Event<PermissionChangedEvent> permissionChangedEvent;\n    Event<PermissionNodeAddedEvent> permissionNodeAddedEvent;\n    Event<PermissionNodeRemovedEvent> permissionNodeRemovedEvent;\n    Map<String, PermissionNode> childSelectorNodeMap = new TreeMap<>();\n    boolean expanded = false;\n\n    LiveSearchService<String> childrenSearchService = new LiveSearchService<String>() {\n        @Override\n        public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n            PermissionTreeProvider provider = permissionNode.getPermissionTreeProvider();\n            DefaultLoadOptions loadOptions = new DefaultLoadOptions();\n            loadOptions.setNodeNamePattern(pattern);\n            loadOptions.setMaxNodes(maxResults);\n\n            provider.loadChildren(permissionNode, loadOptions, children -> {\n                LiveSearchResults result = new LiveSearchResults(maxResults);\n                children.stream().filter(MultiplePermissionNodeEditor.this::isNotEdited).forEach(node -> {\n                    String permissionName = node.getPermissionList().get(0).getName();\n                    result.add(permissionName, node.getNodeName());\n                    childSelectorNodeMap.put(permissionName, node);\n                });\n\n                result.sortByValue();\n                callback.afterSearch(result);\n            });\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n            PermissionTreeProvider provider = permissionNode.getPermissionTreeProvider();\n            DefaultLoadOptions loadOptions = new DefaultLoadOptions();\n            loadOptions.setNodeNamePattern(key);\n            loadOptions.setMaxNodes(1);\n\n            provider.loadChildren(permissionNode, loadOptions, children -> {\n                LiveSearchResults result = new LiveSearchResults(1);\n                children.stream()\n                        .filter(node -> isNotEdited(node) && node.getNodeName().equals(key))\n                        .findAny()\n                        .ifPresent(node -> {\n                            String permissionName = node.getPermissionList().get(0).getName();\n                            result.add(permissionName, node.getNodeName());\n                            childSelectorNodeMap.put(permissionName, node);\n                        });\n\n                result.sortByValue();\n                callback.afterSearch(result);\n            });\n        }\n    };\n\n    public LiveSearchService getChildrenSearchService() {\n        return childrenSearchService;\n    }\n\n    @Inject\n    public MultiplePermissionNodeEditor(View view,\n                                        LiveSearchDropDown liveSearchDropDown,\n                                        PermissionWidgetFactory widgetFactory,\n                                        Event<PermissionChangedEvent> permissionChangedEvent,\n                                        Event<PermissionNodeAddedEvent> permissionNodeAddedEvent,\n                                        Event<PermissionNodeRemovedEvent> permissionNodeRemovedEvent) {\n        this.view = view;\n        this.liveSearchDropDown = liveSearchDropDown;\n        this.widgetFactory = widgetFactory;\n        this.permissionChangedEvent = permissionChangedEvent;\n        this.permissionNodeAddedEvent = permissionNodeAddedEvent;\n        this.permissionNodeRemovedEvent = permissionNodeRemovedEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public boolean hasResources() {\n        return permissionNode instanceof HasResources;\n    }\n\n    @Override\n    public void edit(PermissionNode node) {\n        permissionNode = node;\n        permissionSwitchMap.clear();\n\n        String name = node.getNodeName();\n        String fullName = node.getNodeFullName();\n\n        view.setNodeName(name);\n        view.setNodePanelWidth(getNodePanelWidth());\n        view.setClearChildrenEnabled(false);\n        if (fullName != null && !fullName.equals(name)) {\n            view.setNodeFullName(fullName);\n        }\n\n        // Resources are only supported for dynamic nodes\n        view.setAddChildEnabled(false);\n        if (hasResources()) {\n            String resourceName = ((PermissionResourceNode) permissionNode).getResourceName();\n            liveSearchDropDown.setSelectorHint(view.getChildSelectorHint(resourceName));\n            liveSearchDropDown.setSearchHint(view.getChildSearchHint(resourceName));\n            liveSearchDropDown.setNotFoundMessage(view.getChildrenNotFoundMsg(resourceName));\n            liveSearchDropDown.setMaxItems(50);\n            liveSearchDropDown.setWidth(220);\n            liveSearchDropDown.setClearSelectionEnabled(false);\n            liveSearchDropDown.init(childrenSearchService, selectionHandler);\n            liveSearchDropDown.setOnChange(() -> onChildSelected(selectionHandler.getSelectedKey()));\n\n            view.setAddChildEnabled(true);\n            view.setResourceName(resourceName);\n            view.setChildSelector(liveSearchDropDown);\n        }\n\n        // Init the switch control for every permission\n        for (Permission permission : permissionNode.getPermissionList()) {\n            String grantName = permissionNode.getPermissionGrantName(permission);\n            String denyName = permissionNode.getPermissionDenyName(permission);\n            boolean granted = AuthorizationResult.ACCESS_GRANTED.equals(permission.getResult());\n\n            PermissionSwitch permissionSwitch = widgetFactory.createSwitch();\n            permissionSwitch.init(grantName,\n                                  denyName,\n                                  granted,\n                                  0);\n            permissionSwitch.setOnChange(() -> {\n                permission.setResult(permissionSwitch.isOn() ? AuthorizationResult.ACCESS_GRANTED : AuthorizationResult.ACCESS_DENIED);\n\n                // Notify the change in the permission\n                super.onPermissionChanged(permission,\n                                          permissionSwitch.isOn());\n                permissionChangedEvent.fire(new PermissionChangedEvent(getACLEditor(),\n                                                                       permission,\n                                                                       permissionSwitch.isOn()));\n            });\n            super.registerPermissionSwitch(permission,\n                                           permissionSwitch);\n        }\n        // Update the switches status according to the inter-dependencies between their permissions\n        super.processAllPermissionDependencies();\n\n        // Add the switch controls to the view once initialized\n        for (PermissionSwitchToogle switchToogle : permissionSwitchMap.values()) {\n            view.addPermission(switchToogle);\n        }\n\n        // Load the children in order to initialize the exception counters properly\n        loadChildren();\n    }\n\n    @Override\n    protected void notifyPermissionChange(Permission permission,\n                                          boolean on) {\n        super.notifyPermissionChange(permission,\n                                     on);\n\n        // Update the exception count\n        PermissionSwitchToogle permissionSwitch = permissionSwitchMap.get(permission);\n        int n = getExceptionNumber(permission);\n        permissionSwitch.setNumberOfExceptions(n);\n    }\n\n    public void expand() {\n        expanded = true;\n        List<PermissionNodeEditor> childEditors = getChildEditors();\n\n        view.setExpanded(true);\n        view.clearChildren();\n        for (int i = 0; i < childEditors.size(); i++) {\n            PermissionNodeEditor nodeEditor = childEditors.get(i);\n            view.addChildEditor(nodeEditor,\n                                hasResources());\n            if (i < childEditors.size() - 1) {\n                view.addChildSeparator();\n            }\n        }\n        if (!childEditors.isEmpty()) {\n            view.setClearChildrenEnabled(hasResources());\n        }\n    }\n\n    public void collapse() {\n        permissionNode.collapse();\n        expanded = false;\n        view.setExpanded(false);\n        view.clearChildren();\n    }\n\n    protected void loadChildren() {\n        permissionNode.expand(children -> {\n            for (PermissionNode child : children) {\n                registerChild(child);\n            }\n            updateExceptionCounters();\n        });\n    }\n\n    protected PermissionNodeEditor registerChild(PermissionNode child) {\n        PermissionNodeEditor nodeEditor = widgetFactory.createEditor(child);\n        nodeEditor.setACLEditor(this.getACLEditor());\n        nodeEditor.setTreeLevel(getTreeLevel() + 1);\n        nodeEditor.setParentEditor(this);\n        nodeEditor.edit(child);\n        super.addChildEditor(nodeEditor);\n        return nodeEditor;\n    }\n\n    @Override\n    public void onChildPermissionChanged(PermissionNodeEditor childEditor,\n                                         Permission permission,\n                                         boolean on) {\n        updateExceptionCounters();\n    }\n\n    @Override\n    protected void onNodePanelWidthChanged() {\n        int width = getNodePanelWidth();\n        view.setNodePanelWidth(width);\n    }\n\n    private void updateExceptionCounters() {\n        for (Permission p : permissionSwitchMap.keySet()) {\n            PermissionSwitchToogle pswitch = permissionSwitchMap.get(p);\n            int n = getExceptionNumber(p);\n            pswitch.setNumberOfExceptions(n);\n        }\n    }\n\n    // View events\n\n    public void onNodeClick() {\n        if (expanded) {\n            collapse();\n        } else {\n            expand();\n        }\n    }\n\n    public void onAddChildStart() {\n        view.showChildSelector();\n    }\n\n    public void onAddChildCancel() {\n        view.hideChildSelector();\n    }\n\n    public void onClearChildren() {\n        for (PermissionNodeEditor child : new ArrayList<>(getChildEditors())) {\n            removeChild(child);\n        }\n        view.setClearChildrenEnabled(false);\n        updateExceptionCounters();\n    }\n\n    public void onRemoveChild(PermissionNodeEditor child) {\n        removeChild(child);\n        updateExceptionCounters();\n        view.setClearChildrenEnabled(hasResources() && hasChildEditors());\n    }\n\n    protected void removeChild(PermissionNodeEditor child) {\n        super.removeChildEditor(child);\n\n        liveSearchDropDown.clear();\n        view.hideChildSelector();\n        view.clearChildren();\n\n        List<PermissionNodeEditor> childEditors = getChildEditors();\n        for (int i = 0; i < childEditors.size(); i++) {\n            PermissionNodeEditor nodeEditor = childEditors.get(i);\n            view.addChildEditor(nodeEditor,\n                                hasResources());\n            if (i < childEditors.size() - 1) {\n                view.addChildSeparator();\n            }\n        }\n        permissionNodeRemovedEvent.fire(new PermissionNodeRemovedEvent(getACLEditor(),\n                                                                       permissionNode,\n                                                                       child.getPermissionNode()));\n    }\n\n    public void onChildSelected(String permissionName) {\n        PermissionNode childNode = childSelectorNodeMap.remove(permissionName);\n        overwritePermissions(childNode);\n        PermissionNodeEditor childEditor = registerChild(childNode);\n        if (view.hasChildren()) {\n            view.addChildSeparator();\n        }\n        view.addChildEditor(childEditor,\n                            hasResources());\n        view.setClearChildrenEnabled(true);\n        view.hideChildSelector();\n        liveSearchDropDown.clear();\n\n        updateExceptionCounters();\n\n        permissionNodeAddedEvent.fire(new PermissionNodeAddedEvent(getACLEditor(),\n                                                                   permissionNode,\n                                                                   childNode));\n    }\n\n    protected void overwritePermissions(PermissionNode child) {\n        for (Permission p1 : permissionNode.getPermissionList()) {\n            for (Permission p2 : child.getPermissionList()) {\n                if (p1.impliesName(p2)) {\n                    p2.setResult(p1.getResult().invert());\n                }\n            }\n        }\n    }\n\n    private boolean isNotEdited(PermissionNode node) {\n        String permissionName = node.getPermissionList().get(0).getName();\n        return !getChildEditors().stream()\n                .map(editor -> editor.getPermissionNode().getPermissionList().get(0).getName())\n                .filter(name -> name.equals(permissionName))\n                .findAny().isPresent();\n    }\n\n    public interface View extends UberView<MultiplePermissionNodeEditor> {\n\n        void setNodeName(String name);\n\n        void setNodePanelWidth(int width);\n\n        void setNodeFullName(String name);\n\n        void setResourceName(String name);\n\n        void addPermission(PermissionSwitchToogle permissionSwitch);\n\n        void addChildEditor(PermissionNodeEditor editor,\n                            boolean dynamic);\n\n        void addChildSeparator();\n\n        boolean hasChildren();\n\n        void clearChildren();\n\n        String getChildSelectorHint(String resourceName);\n\n        String getChildSearchHint(String resourceName);\n\n        String getChildrenNotFoundMsg(String resourceName);\n\n        void setChildSelector(IsWidget childSelector);\n\n        void showChildSelector();\n\n        void hideChildSelector();\n\n        void setAddChildEnabled(boolean enabled);\n\n        void setClearChildrenEnabled(boolean enabled);\n\n        void setExpanded(boolean expanded);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeEditorView.css",
    "content": ".acl-root-panel {\n    margin-top: 5px;\n}\n\n.acl-root-panel-expanded {\n    margin-top: 5px;\n    border: 1px solid lightgrey;\n}\n\n.acl-header-panel {\n    margin-top: 5px;\n    padding-left: 15px;\n    padding-top: 10px;\n    padding-bottom: 10px;\n}\n\n.acl-header-panel-expanded {\n    padding-left: 15px;\n    padding-top: 10px;\n    padding-bottom: 10px;\n    background-color: #e9e8e8;\n}\n\n.acl-header-panel-over {\n    margin-top: 5px;\n    padding-left: 15px;\n    padding-top: 10px;\n    padding-bottom: 10px;\n    background-color: #e9e8e8;\n}\n\n.acl-display-none {\n    display: none;\n}\n\n.acl-node-name-panel {\n    display: table-cell;\n    vertical-align: middle;\n}\n\n.acl-node-help-panel {\n    vertical-align: middle;\n    font-size: small;\n}\n\n.acl-node-help-icon {\n    margin-left: 5px;\n}\n\n.acl-collapse-panel {\n    margin-left: 10px;\n    margin-bottom: 10px;\n    padding-right: 10px;\n}\n\n.acl-permissions-panel {\n    display: table-cell;\n}\n\n.acl-add-child-panel {\n    margin-top: 10px;\n    padding-left: 20px;\n    padding-bottom: 10px;\n}\n\n.acl-clear-children-panel {\n    margin-top: 10px;\n    padding-left: 20px;\n}\n\n.acl-child-selector-panel {\n    display: table-cell;\n}\n\n.acl-add-child-anchor {\n    display: table-cell;\n}\n\n.acl-cancel-anchor {\n    display: table-cell;\n    width: 20px;\n}\n\n.acl-clear-children-anchor {\n    display: table-cell;\n    padding-left: 20px;\n}\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeEditorView.html",
    "content": "<div data-field=\"rootPanel\">\n    <div data-field=\"headerPanel\" class=\"acl-header-panel\">\n        <div data-field=\"nodeAnchorPanel\" class=\"acl-node-name-panel\">\n            <h4 class=\"panel-title\">\n                <a data-field=\"nodeAnchor\" data-toggle=\"collapse\" class=\"collapsed\" href=\"#\" aria-expanded=\"false\"\n                style=\"font-weight: inherit; color: inherit;\"></a>\n                <span data-field=\"nodeAnchorHelp\" class=\"acl-display-none\">\n                    <i class=\"pf pficon-help\" data-toggle=\"tooltip\" data-placement=\"left\" class=\"acl-node-help-icon\"></i>\n                </span>\n            </h4>\n        </div>\n        <div class=\"acl-permissions-panel\" data-field=\"nodePermissions\">\n        </div>\n    </div>\n    <div data-field=\"collapsePanel\" class=\"panel-collapse collapse acl-collapse-panel\" aria-expanded=\"false\">\n        <div data-field=\"nodeChildren\" class=\"acl-children-panel\">\n        </div>\n        <div data-field=\"addChildPanel\" class=\"acl-add-child-panel\" style=\"display: none;\">\n            <a data-field=\"cancelAnchor\" href=\"#\" class=\"pf pficon-delete acl-cancel-anchor\"></a>\n            <div data-field=\"childSelectorPanel\" class=\"acl-child-selector-panel\"></div>\n        </div>\n        <div data-field=\"clearChildrenPanel\" class=\"acl-clear-children-panel\">\n            <a data-field=\"addChildAnchor\" href=\"#\" class=\"pf pficon-add-circle-o acl-add-child-anchor\"></a>\n            <a data-field=\"clearChildrenAnchor\" href=\"#\" class=\"pf pficon-delete acl-clear-children-anchor\"></a>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.MouseOutEvent;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.security.management.client.resources.i18n.SecurityManagementConstants;\n\n@Dependent\n@Templated\npublic class MultiplePermissionNodeEditorView extends Composite\n        implements MultiplePermissionNodeEditor.View {\n\n    @Inject\n    @DataField\n    Div rootPanel;\n    @Inject\n    @DataField\n    Div headerPanel;\n    @Inject\n    @DataField\n    Anchor nodeAnchor;\n    @Inject\n    @DataField\n    Div nodeAnchorPanel;\n    @Inject\n    @DataField\n    Span nodeAnchorHelp;\n    @Inject\n    @DataField\n    FlowPanel nodePermissions;\n    @Inject\n    @DataField\n    Div collapsePanel;\n    @Inject\n    @DataField\n    FlowPanel nodeChildren;\n    @Inject\n    @DataField\n    Anchor addChildAnchor;\n    @Inject\n    @DataField\n    Anchor clearChildrenAnchor;\n    @Inject\n    @DataField\n    Div addChildPanel;\n    @Inject\n    @DataField\n    Div clearChildrenPanel;\n    @Inject\n    @DataField\n    Anchor cancelAnchor;\n    @Inject\n    @DataField\n    FlowPanel childSelectorPanel;\n    boolean expanded;\n    boolean mouseOver;\n    private MultiplePermissionNodeEditor presenter;\n\n    @Override\n    public void init(MultiplePermissionNodeEditor presenter) {\n        this.presenter = presenter;\n\n        String collapseId = Document.get().createUniqueId();\n        collapsePanel.setId(collapseId);\n        nodeAnchor.setHref(\"#\" + collapseId);\n\n        addChildAnchor.setTextContent(\" \" + SecurityManagementConstants.INSTANCE.addChildException());\n        clearChildrenAnchor.setTextContent(\" \" + SecurityManagementConstants.INSTANCE.clearChildren());\n    }\n\n    @Override\n    public void setNodeName(String name) {\n        nodeAnchor.setTextContent(name);\n    }\n\n    @Override\n    public void setNodePanelWidth(int width) {\n        nodeAnchorPanel.getStyle().setProperty(\"width\",\n                                               width + \"px\");\n    }\n\n    @Override\n    public void setNodeFullName(String name) {\n        nodeAnchor.setTitle(name);\n        nodeAnchorHelp.setTitle(name);\n        nodeAnchorHelp.setClassName(\"acl-node-help-panel\");\n    }\n\n    @Override\n    public void setResourceName(String name) {\n\n    }\n\n    @Override\n    public void addPermission(PermissionSwitchToogle permissionSwitch) {\n        nodePermissions.add(permissionSwitch);\n    }\n\n    @Override\n    public void addChildEditor(PermissionNodeEditor editor,\n                               boolean dynamic) {\n        if (dynamic) {\n            editor.setLeftMargin(20);\n\n            FlowPanel row = new FlowPanel();\n            org.gwtbootstrap3.client.ui.Anchor anchor = new org.gwtbootstrap3.client.ui.Anchor();\n            anchor.addStyleName(\"pf pficon-delete\");\n            anchor.getElement().getStyle().setWidth(20,\n                                                    Style.Unit.PX);\n            anchor.getElement().getStyle().setDisplay(Style.Display.TABLE_CELL);\n            anchor.getElement().getStyle().setVerticalAlign(Style.VerticalAlign.MIDDLE);\n            anchor.addClickHandler(event -> presenter.onRemoveChild(editor));\n            editor.asWidget().getElement().getStyle().setDisplay(Style.Display.TABLE_CELL);\n            editor.asWidget().getElement().getStyle().setProperty(\"paddingLeft\",\n                                                                  \"0px\");\n\n            row.getElement().getStyle().setProperty(\"paddingLeft\",\n                                                    \"20px\");\n            row.add(anchor);\n            row.add(editor);\n            nodeChildren.add(row);\n        } else {\n            nodeChildren.add(editor);\n        }\n    }\n\n    @Override\n    public void addChildSeparator() {\n        FlowPanel separator = new FlowPanel();\n        separator.getElement().getStyle().setHeight(1,\n                                                    Style.Unit.PX);\n        separator.getElement().getStyle().setBackgroundColor(\"lightgrey\");\n        nodeChildren.add(separator);\n    }\n\n    @Override\n    public boolean hasChildren() {\n        return nodeChildren.getWidgetCount() > 0;\n    }\n\n    @Override\n    public void clearChildren() {\n        nodeChildren.clear();\n    }\n\n    @Override\n    public String getChildSelectorHint(String resourceName) {\n        return SecurityManagementConstants.INSTANCE.selectResourceInstance(resourceName);\n    }\n\n    @Override\n    public String getChildSearchHint(String resourceName) {\n        return SecurityManagementConstants.INSTANCE.searchResourceInstance(resourceName);\n    }\n\n    @Override\n    public String getChildrenNotFoundMsg(String resourceName) {\n        return SecurityManagementConstants.INSTANCE.resourceInstanceNotFound(resourceName);\n    }\n\n    @Override\n    public void setChildSelector(IsWidget childSelector) {\n        childSelectorPanel.clear();\n        childSelectorPanel.add(childSelector);\n    }\n\n    @Override\n    public void showChildSelector() {\n        addChildPanel.getStyle().removeProperty(\"display\");\n    }\n\n    @Override\n    public void hideChildSelector() {\n        addChildPanel.getStyle().setProperty(\"display\",\n                                             \"none\");\n    }\n\n    @Override\n    public void setAddChildEnabled(boolean enabled) {\n        if (enabled) {\n            addChildAnchor.getStyle().removeProperty(\"display\");\n        } else {\n            addChildAnchor.getStyle().setProperty(\"display\",\n                                                  \"none\");\n        }\n    }\n\n    @Override\n    public void setClearChildrenEnabled(boolean enabled) {\n        if (enabled) {\n            clearChildrenAnchor.getStyle().removeProperty(\"display\");\n        } else {\n            clearChildrenAnchor.getStyle().setProperty(\"display\",\n                                                       \"none\");\n        }\n    }\n\n    @Override\n    public void setExpanded(boolean expanded) {\n        this.expanded = expanded;\n        this.mouseOver = false;\n        String rootPanelCss = expanded ? \"acl-root-panel-expanded\" : \"acl-root-panel\";\n        String headerPanelCss = expanded ? \"acl-header-panel-expanded\" : \"acl-header-panel\";\n        rootPanel.setClassName(rootPanelCss);\n        headerPanel.setClassName(headerPanelCss);\n    }\n\n    @EventHandler(\"nodeAnchor\")\n    private void onNodeClick(ClickEvent event) {\n        presenter.onNodeClick();\n    }\n\n    @EventHandler(\"addChildAnchor\")\n    private void onAddChild(ClickEvent event) {\n        presenter.onAddChildStart();\n    }\n\n    @EventHandler(\"clearChildrenAnchor\")\n    private void onClearChildren(ClickEvent event) {\n        presenter.onClearChildren();\n    }\n\n    @EventHandler(\"cancelAnchor\")\n    private void onCancelAdd(ClickEvent event) {\n        presenter.onAddChildCancel();\n    }\n\n    @EventHandler(\"headerPanel\")\n    private void onHeaderMouseOver(MouseOverEvent event) {\n        if (!expanded) {\n            headerPanel.setClassName(\"acl-header-panel-over\");\n            mouseOver = true;\n        }\n    }\n\n    @EventHandler(\"headerPanel\")\n    private void onHeaderMouseOut(MouseOutEvent event) {\n        if (mouseOver) {\n            headerPanel.setClassName(\"acl-header-panel\");\n            mouseOver = false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeViewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.HasResources;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\n@Dependent\npublic class MultiplePermissionNodeViewer extends BasePermissionNodeViewer {\n\n    View view;\n    PermissionWidgetFactory widgetFactory;\n    PermissionNode permissionNode;\n    List<PermissionNode> overwriteList = new ArrayList<>();\n    List<PermissionNodeViewer> childViewerList = new ArrayList<>();\n    @Inject\n    public MultiplePermissionNodeViewer(View view,\n                                        PermissionWidgetFactory widgetFactory) {\n        this.view = view;\n        this.widgetFactory = widgetFactory;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public boolean hasResources() {\n        return permissionNode instanceof HasResources;\n    }\n\n    @Override\n    public PermissionNode getPermissionNode() {\n        return permissionNode;\n    }\n\n    @Override\n    public List<PermissionNodeViewer> getChildren() {\n        return childViewerList;\n    }\n\n    @Override\n    public void show(PermissionNode node) {\n        permissionNode = node;\n        overwriteList.clear();\n        childViewerList.clear();\n\n        String name = node.getNodeName();\n        String fullName = node.getNodeFullName();\n\n        view.setNodeName(name);\n        if (fullName != null && !fullName.equals(name)) {\n            view.setNodeFullName(fullName);\n        }\n\n        // Expand the node and check children permissions\n        permissionNode.expand(children -> {\n            initChildren(children);\n            showPermissions();\n        });\n    }\n\n    protected void initChildren(List<PermissionNode> children) {\n        for (PermissionNode child : children) {\n\n            List<Permission> implied = permissionNode.impliesName(child);\n            if (hasResources() && !implied.isEmpty()) {\n                overwriteList.add(child);\n            } else {\n                registerChild(child);\n            }\n        }\n    }\n\n    protected void registerChild(PermissionNode child) {\n        PermissionNodeViewer nodeViewer = widgetFactory.createViewer(child);\n        nodeViewer.setTreeLevel(getTreeLevel() + 1);\n        childViewerList.add(nodeViewer);\n        view.addChildViewer(nodeViewer);\n        nodeViewer.show(child);\n    }\n\n    protected List<PermissionNode> getOverwrites(Permission parent) {\n        List<PermissionNode> result = new ArrayList<>();\n        for (PermissionNode node : overwriteList) {\n            for (Permission p : node.getPermissionList()) {\n                if (parent.impliesName(p) && !parent.impliesResult(p)) {\n                    result.add(node);\n                }\n            }\n        }\n        return result;\n    }\n\n    protected void showPermissions() {\n        List<Permission> permissionList = permissionNode.getPermissionList();\n        boolean permissionsEnabled = hasResources() && !permissionList.isEmpty();\n        view.setPermissionsVisible(permissionsEnabled);\n\n        if (permissionsEnabled) {\n\n            // For every permission show what children permissions are available\n            for (Permission permission : permissionList) {\n                String resourceName = permissionNode.getNodeName().toLowerCase();\n                String permissionGrantName = permissionNode.getPermissionGrantName(permission).toLowerCase();\n                List<PermissionNode> overwrites = getOverwrites(permission);\n\n                if (overwrites.isEmpty()) {\n\n                    if (AuthorizationResult.ACCESS_GRANTED.equals(permission.getResult())) {\n                        // Can read all \"items\"\n                        view.addAllItemsGrantedPermission(permissionGrantName,\n                                                          resourceName);\n                    } else {\n                        // Can't read any \"items\"\n                        view.addAllItemsDeniedPermission(permissionGrantName,\n                                                         resourceName);\n                    }\n                } else {\n                    if (AuthorizationResult.ACCESS_GRANTED.equals(permission.getResult())) {\n                        // Can read all \"items\" but: a, b, ...\n                        view.addItemsGrantedPermission(permissionGrantName,\n                                                       resourceName);\n                    } else {\n                        // Can only read the following \"items\": a, b, ...\n                        view.addItemsDeniedPermission(permissionGrantName,\n                                                      resourceName);\n                    }\n                    // The items added as exceptions\n                    for (PermissionNode overwrite : overwrites) {\n                        String itemName = overwrite.getNodeName();\n                        view.addItemException(itemName);\n                    }\n                }\n            }\n        }\n    }\n\n    public interface View extends UberView<MultiplePermissionNodeViewer> {\n\n        void setNodeName(String name);\n\n        void setNodeFullName(String name);\n\n        void addChildViewer(PermissionNodeViewer viewer);\n\n        void setPermissionsVisible(boolean enabled);\n\n        void addAllItemsGrantedPermission(String permission,\n                                          String resource);\n\n        void addAllItemsDeniedPermission(String permission,\n                                         String resource);\n\n        void addItemsGrantedPermission(String permission,\n                                       String resource);\n\n        void addItemsDeniedPermission(String permission,\n                                      String resource);\n\n        void addItemException(String item);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeViewerView.css",
    "content": ".acl-multiple-panel {\n    margin-top: 10px;\n    margin-bottom: 10px;\n}\n\n.acl-node-anchor {\n    font-weight: inherit;\n    color: inherit;\n}\n\n.acl-collapse-panel {\n    margin-left: 15px;\n    margin-top: 5px;\n    margin-bottom: 5px;\n}\n\n.acl-children-panel {\n    margin-bottom: 5px;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeViewerView.html",
    "content": "<div class=\"panel-group acl-multiple-panel\">\n    <div data-field=\"nodeAnchorPanel\">\n        <h4 class=\"panel-title\">\n            <a data-field=\"nodeAnchor\" data-toggle=\"collapse\" class=\"collapsed\" href=\"#\" aria-expanded=\"false\"\n               style=\"font-weight: inherit; color: inherit;\"></a>\n        </h4>\n    </div>\n    <div data-field=\"collapsePanel\" class=\"panel-collapse collapse acl-collapse-panel\" aria-expanded=\"false\">\n        <div data-field=\"nodePermissions\">\n        </div>\n        <div data-field=\"nodeChildren\" class=\"acl-children-panel\">\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/MultiplePermissionNodeViewerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.security.management.client.resources.i18n.SecurityManagementConstants;\n\n@Dependent\n@Templated\npublic class MultiplePermissionNodeViewerView extends Composite\n        implements MultiplePermissionNodeViewer.View {\n\n    @Inject\n    @DataField\n    Anchor nodeAnchor;\n    @Inject\n    @DataField\n    Div nodeAnchorPanel;\n    @Inject\n    @DataField\n    FlowPanel nodePermissions;\n    @Inject\n    @DataField\n    Div collapsePanel;\n    @Inject\n    @DataField\n    FlowPanel nodeChildren;\n    private MultiplePermissionNodeViewer presenter;\n\n    @Override\n    public void init(MultiplePermissionNodeViewer presenter) {\n        this.presenter = presenter;\n\n        String collapseId = Document.get().createUniqueId();\n        collapsePanel.setId(collapseId);\n\n        nodeAnchor.setDataToggle(Toggle.COLLAPSE);\n        nodeAnchor.setDataTarget(\"#\" + collapseId);\n    }\n\n    @Override\n    public void setNodeName(String name) {\n        nodeAnchor.setText(name);\n    }\n\n    @Override\n    public void setNodeFullName(String name) {\n        nodeAnchor.setTitle(name);\n    }\n\n    @Override\n    public void setPermissionsVisible(boolean enabled) {\n        nodePermissions.setVisible(enabled);\n    }\n\n    @Override\n    public void addChildViewer(PermissionNodeViewer viewer) {\n        nodeChildren.add(viewer);\n    }\n\n    private Label createLabel(String text,\n                              String color) {\n        Label l = new Label(text);\n        l.getElement().getStyle().setMarginLeft(3,\n                                                Style.Unit.PX);\n        if (color != null) {\n            l.getElement().getStyle().setColor(color);\n        }\n        return l;\n    }\n\n    private void addPermissionMessage(String preffix,\n                                      String permission,\n                                      String inffix,\n                                      String resource,\n                                      String suffix,\n                                      String color) {\n        HorizontalPanel panel = new HorizontalPanel();\n        if (preffix != null) {\n            Label l = createLabel(preffix,\n                                  null);\n            panel.add(l);\n        }\n        if (permission != null) {\n            Label l = createLabel(permission,\n                                  color);\n            panel.add(l);\n        }\n        if (inffix != null) {\n            Label l = createLabel(inffix,\n                                  null);\n            panel.add(l);\n        }\n        if (resource != null) {\n            Label l = createLabel(resource,\n                                  null);\n            panel.add(l);\n        }\n        if (suffix != null) {\n            Label l = createLabel(suffix,\n                                  null);\n            panel.add(l);\n        }\n        nodePermissions.add(panel);\n    }\n\n    @Override\n    public void addAllItemsGrantedPermission(String permission,\n                                             String resource) {\n        String can = SecurityManagementConstants.INSTANCE.can();\n        addPermissionMessage(can,\n                             permission,\n                             null,\n                             resource,\n                             null,\n                             \"#00618a\");\n    }\n\n    @Override\n    public void addAllItemsDeniedPermission(String permission,\n                                            String resource) {\n        String cant = SecurityManagementConstants.INSTANCE.cant();\n        addPermissionMessage(cant,\n                             permission,\n                             null,\n                             resource,\n                             null,\n                             \"#a30000\");\n    }\n\n    @Override\n    public void addItemsGrantedPermission(String permission,\n                                          String resource) {\n        String can = SecurityManagementConstants.INSTANCE.can();\n        String all = SecurityManagementConstants.INSTANCE.all();\n        String but = SecurityManagementConstants.INSTANCE.but();\n        addPermissionMessage(can,\n                             permission,\n                             all,\n                             resource,\n                             but + \":\",\n                             \"#00618a\");\n    }\n\n    @Override\n    public void addItemsDeniedPermission(String permission,\n                                         String resource) {\n        String canOnly = SecurityManagementConstants.INSTANCE.canOnly();\n        String following = SecurityManagementConstants.INSTANCE.following();\n        addPermissionMessage(canOnly,\n                             permission,\n                             following,\n                             resource + \":\",\n                             null,\n                             \"#a30000\");\n    }\n\n    @Override\n    public void addItemException(String item) {\n        HorizontalPanel panel = new HorizontalPanel();\n        Label l = createLabel(\"- \" + item,\n                              null);\n        panel.add(l);\n        panel.getElement().getStyle().setMarginLeft(15,\n                                                    Style.Unit.PX);\n        nodePermissions.add(panel);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionExceptionSwitch.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class PermissionExceptionSwitch implements PermissionSwitchToogle {\n\n    View view;\n    Command onChange;\n    @Inject\n    public PermissionExceptionSwitch(View view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void init(String switchOnName,\n                     String switchOffName,\n                     boolean on,\n                     boolean isException) {\n        view.init(switchOnName,\n                  switchOffName);\n        view.setOn(on);\n        view.setExceptionEnabled(isException);\n    }\n\n    @Override\n    public void setOnChange(Command onChange) {\n        this.onChange = onChange;\n    }\n\n    @Override\n    public boolean isOn() {\n        return view.isOn();\n    }\n\n    @Override\n    public void setOn(boolean on) {\n        view.setOn(on);\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        view.setEnabled(enabled);\n    }\n\n    @Override\n    public void setNumberOfExceptions(int n) {\n        view.setExceptionEnabled(n > 0);\n    }\n\n    public void onChange() {\n        onChange.execute();\n    }\n\n    public interface View extends UberView<PermissionExceptionSwitch> {\n\n        void init(String textOn,\n                  String textOff);\n\n        boolean isOn();\n\n        void setOn(boolean on);\n\n        void setExceptionEnabled(boolean enabled);\n\n        void setEnabled(boolean enabled);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionExceptionSwitchView.css",
    "content": ".acl-eswitch-panel {\n    display: table-cell;\n    margin-right: 10px;\n    min-width: 170px;\n}\n\n.acl-eseparator-vert {\n    margin-right: 10px;\n    width: 1px;\n    height: 40px;\n    float: left;\n    background-color: lightgray;\n}\n\n.acl-ebadge-panel {\n    float: left;\n    width: 20px;\n    margin-right: 5px;\n    margin-top: 11px;\n}\n\n.acl-ebadge-red {\n    color: white;\n    background-color: #c00;\n    font-size: smaller;\n}\n\n.acl-etoggle-panel {\n    float: left ;\n    margin-top: 7px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionExceptionSwitchView.html",
    "content": "<div class=\"acl-eswitch-panel\">\n    <span class=\"acl-eseparator-vert\"></span>\n    <div class=\"acl-ebadge-panel\">\n        <span class=\"badge acl-ebadge-red\">1</span>\n    </div>\n    <div data-field=\"togglePanel\" class=\"acl-etoggle-panel\"></div>\n</div>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionExceptionSwitchView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.ToggleSwitch;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants.SizeType;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.security.management.client.resources.i18n.SecurityManagementConstants;\n\n@Dependent\n@Templated\npublic class PermissionExceptionSwitchView extends Composite\n        implements PermissionExceptionSwitch.View {\n\n    @Inject\n    @DataField\n    FlowPanel togglePanel;\n\n    @Inject\n    @DataField\n    Span badge;\n\n    ToggleSwitch switchControl;\n    PermissionExceptionSwitch presenter;\n\n    @Override\n    public void init(PermissionExceptionSwitch presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void init(String textOn,\n                     String textOff) {\n        switchControl = new ToggleSwitch();\n        switchControl.setAnimate(true);\n        switchControl.setSize(SizeType.MINI);\n        switchControl.setOnText(textOn != null ? textOn : SecurityManagementConstants.INSTANCE.switchAllow());\n        switchControl.setOffText(textOff != null ? textOff : SecurityManagementConstants.INSTANCE.switchDeny());\n        switchControl.addValueChangeHandler(event -> presenter.onChange());\n        togglePanel.add(switchControl);\n    }\n\n    @Override\n    public void setExceptionEnabled(boolean enabled) {\n        if (enabled) {\n            badge.getStyle().setProperty(\"display\",\n                                         \"table-cell\");\n        } else {\n            badge.getStyle().setProperty(\"display\",\n                                         \"none\");\n        }\n    }\n\n    @Override\n    public boolean isOn() {\n        return switchControl.getValue();\n    }\n\n    @Override\n    public void setOn(boolean on) {\n        switchControl.setValue(on);\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        switchControl.setEnabled(enabled);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionNodeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\npublic interface PermissionNodeEditor extends IsWidget {\n\n    ACLEditor getACLEditor();\n\n    void setACLEditor(ACLEditor editor);\n\n    int getTreeLevel();\n\n    void setTreeLevel(int level);\n\n    int getNodePanelWidth();\n\n    void setLeftMargin(int margin);\n\n    PermissionNode getPermissionNode();\n\n    void edit(PermissionNode node);\n\n    PermissionNodeEditor getParentEditor();\n\n    void setParentEditor(PermissionNodeEditor editor);\n\n    List<PermissionNodeEditor> getChildEditors();\n\n    void addChildEditor(PermissionNodeEditor editor);\n\n    void removeChildEditor(PermissionNodeEditor editor);\n\n    boolean hasChildEditors();\n\n    void clearChildEditors();\n\n    void onParentPermissionChanged(Permission permission,\n                                   boolean on);\n\n    void onChildPermissionChanged(PermissionNodeEditor childEditor,\n                                  Permission permission,\n                                  boolean on);\n\n    boolean isAnException(Permission permission);\n\n    int getExceptionNumber(Permission permission);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionNodeViewer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\n\npublic interface PermissionNodeViewer extends IsWidget {\n\n    int getTreeLevel();\n\n    void setTreeLevel(int level);\n\n    PermissionNode getPermissionNode();\n\n    void show(PermissionNode node);\n\n    List<PermissionNodeViewer> getChildren();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionSwitch.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class PermissionSwitch implements PermissionSwitchToogle {\n\n    View view;\n    Command onChange;\n    @Inject\n    public PermissionSwitch(View view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public void init(String switchOnName,\n                     String switchOffName,\n                     boolean on,\n                     int nexceptions) {\n        view.init(switchOnName,\n                  switchOffName,\n                  on);\n        setNumberOfExceptions(nexceptions);\n    }\n\n    @Override\n    public void setOnChange(Command onChange) {\n        this.onChange = onChange;\n    }\n\n    @Override\n    public void setNumberOfExceptions(int n) {\n        view.hideExceptionsCount();\n        if (n > 0) {\n            view.showExceptionsCount(n);\n        }\n    }\n\n    @Override\n    public boolean isOn() {\n        return view.isOn();\n    }\n\n    @Override\n    public void setOn(boolean on) {\n        view.setOn(on);\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        view.setEnabled(enabled);\n    }\n\n    public void onChange() {\n        onChange.execute();\n    }\n\n    public interface View extends UberView<PermissionSwitch> {\n\n        void init(String textOn,\n                  String textOff,\n                  boolean on);\n\n        void showExceptionsCount(int n);\n\n        void hideExceptionsCount();\n\n        boolean isOn();\n\n        void setOn(boolean on);\n\n        void setEnabled(boolean enabled);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionSwitchToogle.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.mvp.Command;\n\npublic interface PermissionSwitchToogle extends IsWidget {\n\n    boolean isOn();\n\n    void setOn(boolean on);\n\n    void setEnabled(boolean enabled);\n\n    void setNumberOfExceptions(int n);\n\n    void setOnChange(Command onChange);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionSwitchView.css",
    "content": ".acl-switch-panel {\n    display: table-cell;\n    min-width: 170px;\n}\n\n.acl-separator-vert {\n    margin-right: 10px;\n    width: 1px;\n    height: 30px;\n    float: left;\n    background-color: lightgray;\n}\n\n.acl-badge-panel {\n    float: left;\n    width: 20px;\n    margin-right: 5px;\n    margin-top: 7px;\n}\n\n.acl-badge-red {\n    color: white;\n    background-color: #c00;\n    font-size: smaller;\n}\n\n.acl-toggle-panel {\n    float: left;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionSwitchView.html",
    "content": "<div class=\"acl-switch-panel\" style=\"\">\n    <span class=\"acl-separator-vert\"></span>\n    <div class=\"acl-badge-panel\">\n        <span class=\"badge acl-badge-red\"></span>\n    </div>\n    <div class=\"acl-toggle-panel\" data-field=\"togglePanel\"></div>\n</div>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionSwitchView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.ToggleSwitch;\nimport org.gwtbootstrap3.extras.toggleswitch.client.ui.base.constants.SizeType;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.security.management.client.resources.i18n.SecurityManagementConstants;\n\n@Dependent\n@Templated\npublic class PermissionSwitchView extends Composite\n        implements PermissionSwitch.View {\n\n    @Inject\n    @DataField\n    FlowPanel togglePanel;\n\n    @Inject\n    @DataField\n    Span badge;\n\n    ToggleSwitch switchControl;\n    PermissionSwitch presenter;\n\n    @Override\n    public void init(PermissionSwitch presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void init(String textOn,\n                     String textOff,\n                     boolean on) {\n        switchControl = new ToggleSwitch();\n        switchControl.setAnimate(true);\n        switchControl.setSize(SizeType.SMALL);\n        switchControl.setOnText(textOn != null ? textOn : SecurityManagementConstants.INSTANCE.switchAllow());\n        switchControl.setOffText(textOff != null ? textOff : SecurityManagementConstants.INSTANCE.switchDeny());\n        switchControl.setValue(on);\n        switchControl.addValueChangeHandler(event -> {\n            presenter.onChange();\n        });\n        togglePanel.add(switchControl);\n    }\n\n    @Override\n    public void showExceptionsCount(int n) {\n        badge.getStyle().setProperty(\"display\",\n                                     \"table-cell\");\n        badge.setTextContent(Integer.toString(n));\n    }\n\n    @Override\n    public void hideExceptionsCount() {\n        badge.getStyle().setProperty(\"display\",\n                                     \"none\");\n    }\n\n    @Override\n    public boolean isOn() {\n        return switchControl.getValue();\n    }\n\n    @Override\n    public void setOn(boolean on) {\n        switchControl.setValue(on);\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        switchControl.setEnabled(enabled);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/node/PermissionWidgetFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl.node;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\n\n@ApplicationScoped\npublic class PermissionWidgetFactory {\n\n    SyncBeanManager beanManager;\n\n    @Inject\n    public PermissionWidgetFactory(SyncBeanManager beanManager) {\n        this.beanManager = beanManager;\n    }\n\n    public PermissionNodeEditor createEditor(PermissionNode node) {\n        if (node instanceof PermissionLeafNode) {\n            return beanManager.lookupBean(LeafPermissionNodeEditor.class).newInstance();\n        }\n        return beanManager.lookupBean(MultiplePermissionNodeEditor.class).newInstance();\n    }\n\n    public PermissionNodeViewer createViewer(PermissionNode node) {\n        if (node instanceof PermissionLeafNode) {\n            return beanManager.lookupBean(LeafPermissionNodeViewer.class).newInstance();\n        }\n        return beanManager.lookupBean(MultiplePermissionNodeViewer.class).newInstance();\n    }\n\n    public PermissionSwitch createSwitch() {\n        return beanManager.lookupBean(PermissionSwitch.class).newInstance();\n    }\n\n    public PermissionExceptionSwitch createExceptionSwitch() {\n        return beanManager.lookupBean(PermissionExceptionSwitch.class).newInstance();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * <p>Editor class for a Group instance.</p>\n * <p>Additionally it shows a delete button, if the service provider supports the <code>CAN_DELETE_GROUP</code> capability.</p>\n * @since 0.9.0\n */\n@Dependent\npublic class GroupEditor implements IsWidget,\n                                    org.uberfire.ext.security.management.client.editor.group.GroupEditor {\n\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    Event<OnDeleteEvent> onDeleteEvent;\n    Event<OnEditEvent> onEditEvent;\n    Event<OnShowEvent> onShowEvent;\n    ACLSettings aclSettings;\n    ACLViewer aclViewer;\n    ACLEditor aclEditor;\n    Group group;\n    boolean isEditMode;\n    @Inject\n    public GroupEditor(final ClientUserSystemManager userSystemManager,\n                       final Event<OnEditEvent> onEditEvent,\n                       final Event<OnShowEvent> onShowEvent,\n                       final Event<OnDeleteEvent> onDeleteEvent,\n                       final ACLSettings aclSettings,\n                       final ACLViewer aclViewer,\n                       final ACLEditor aclEditor,\n                       final View view) {\n        this.userSystemManager = userSystemManager;\n        this.onDeleteEvent = onDeleteEvent;\n        this.aclSettings = aclSettings;\n        this.aclViewer = aclViewer;\n        this.aclEditor = aclEditor;\n        this.onEditEvent = onEditEvent;\n        this.onShowEvent = onShowEvent;\n        this.view = view;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setACLSettings(aclSettings);\n    }\n\n    @Override\n    public String name() {\n        return group.getName();\n    }\n\n    @Override\n    public PerspectiveActivity homePerspective() {\n        return aclSettings.getHomePerspective();\n    }\n\n    @Override\n    public int groupPriority() {\n        return aclSettings.getPriority();\n    }\n\n    @Override\n    public PermissionCollection permissions() {\n        return aclEditor.getPermissions();\n    }\n\n    public ACLSettings getAclSettings() {\n        return aclSettings;\n    }\n\n    public ACLEditor getAclEditor() {\n        return aclEditor;\n    }\n\n    @Override\n    public void show(final Group group) {\n        clear();\n        this.isEditMode = false;\n        open(group);\n        onShowEvent.fire(new OnShowEvent(this,\n                                         group));\n    }\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    @Override\n    public void edit(final Group group) {\n        clear();\n        this.isEditMode = true;\n        open(group);\n    }\n\n    public void clear() {\n        view.clear();\n        group = null;\n    }\n\n    @Override\n    public void flush() {\n        assert group != null;\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    @Override\n    public Group getValue() {\n        return group;\n    }\n\n    @Override\n    public void setViolations(final Set<ConstraintViolation<Group>> violations) {\n        //  Currently no violations expected.\n    }\n\n    boolean canDelete() {\n        return userSystemManager.isGroupCapabilityEnabled(Capability.CAN_DELETE_GROUP);\n    }\n\n     /*  ******************************************************************************************************\n                                 PACKAGE PROTECTED METHODS FOR USING AS CALLBACKS FOR THE VIEW \n     ****************************************************************************************************** */\n\n    void onDelete() {\n        GroupEditor.this.onDeleteEvent.fire(new OnDeleteEvent(GroupEditor.this,\n                                                              GroupEditor.this.group));\n    }\n\n    void onEdit() {\n        onEditEvent.fire(new OnEditEvent(this,\n                                         group));\n    }\n\n    protected void open(final Group group) {\n        assert group != null;\n        this.group = group;\n\n        // Role name\n        final String name = group.getName();\n        view.show(name);\n\n        // Edit mode\n        view.setEditButtonVisible(!isEditMode);\n        view.setDeleteButtonVisible(isEditMode && canDelete());\n\n        // ACL Editor/Viewer\n        if (isEditMode) {\n            aclSettings.edit(group);\n            aclEditor.edit(group);\n            view.editACL(aclEditor);\n        } else {\n            aclSettings.show(group);\n            aclViewer.show(group);\n            view.showACL(aclViewer);\n        }\n    }\n\n     /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    public interface View extends UberView<GroupEditor> {\n\n        View show(final String name);\n\n        View setEditButtonVisible(boolean isVisible);\n\n        View setDeleteButtonVisible(boolean isVisible);\n\n        View clear();\n\n        View setACLSettings(IsWidget aclSettings);\n\n        View showACL(IsWidget aclViewer);\n\n        View editACL(IsWidget aclEditor);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\n\n@Dependent\npublic class GroupEditorView extends Composite implements GroupEditor.View {\n\n    private static GroupEditorViewBinder uiBinder = GWT.create(GroupEditorViewBinder.class);\n    @UiField\n    Heading groupTitle;\n    @UiField\n    Button editButton;\n    @UiField\n    Button deleteButton;\n    @UiField\n    FlowPanel aclPanel;\n    @UiField\n    FlowPanel aclSettingsPanel;\n    GroupEditor presenter;\n\n    @Override\n    public void init(final GroupEditor presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public GroupEditor.View show(final String name) {\n        String headerText = UsersManagementWidgetsConstants.INSTANCE.groupSettings(name);\n        groupTitle.setText(headerText);\n        groupTitle.setTitle(headerText);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View setDeleteButtonVisible(boolean isVisible) {\n        deleteButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View clear() {\n        groupTitle.setText(\"\");\n        deleteButton.setVisible(false);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View setEditButtonVisible(final boolean isVisible) {\n        editButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View setACLSettings(IsWidget aclSettings) {\n        aclSettingsPanel.clear();\n        aclSettingsPanel.add(aclSettings);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View showACL(IsWidget aclViewer) {\n        aclPanel.clear();\n        aclPanel.add(aclViewer);\n        return this;\n    }\n\n    @Override\n    public GroupEditor.View editACL(IsWidget aclEditor) {\n        aclPanel.clear();\n        aclPanel.add(aclEditor);\n        return this;\n    }\n\n    @UiHandler(\"editButton\")\n    public void onEditButtonClick(final ClickEvent event) {\n        presenter.onEdit();\n    }\n\n    @UiHandler(\"deleteButton\")\n    public void onDeleteButtonClick(final ClickEvent event) {\n        if (presenter != null) {\n            presenter.onDelete();\n        }\n    }\n\n    interface GroupEditorViewBinder\n            extends\n            UiBinder<Widget, GroupEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .groupTitle {\n      float: left;\n      margin-top: 0;\n    }\n    .editButton {\n      margin-left: 5px;\n      display: table-cell;\n    }\n    .deleteColumn {\n      margin-top: 15px;\n      text-align: right;\n    }\n    .deleteButton {\n      margin: 5px;\n    }\n    .separator{\n      height: 1px;\n      background-color: lightgrey;\n      margin-top: 10px;\n      margin-bottom: -5px;\n    }\n    .aclSettingsPanel {\n      margin-top: 10px;\n    }\n    .aclPanel {\n      margin-left: 10px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\" addStyleNames=\"panel-group\">\n\n    <b:Row>\n      <b:Column size=\"MD_10\">\n        <b:Heading size=\"H1\" ui:field=\"groupTitle\" addStyleNames=\"{style.groupTitle}\"/>\n        <b:Button type=\"LINK\" text=\"{i18n.edit}\" title=\"{i18n.edit}\" icon=\"PENCIL\"\n                  ui:field=\"editButton\" addStyleNames=\"{style.editButton}\"/>\n      </b:Column>\n      <b:Column size=\"MD_2\" addStyleNames=\"{style.deleteColumn}\">\n        <b:Button type=\"DANGER\" text=\"{i18n.delete}\" title=\"{i18n.delete}\" ui:field=\"deleteButton\" addStyleNames=\"{style.deleteButton}\"/>\n      </b:Column>\n    </b:Row>\n\n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <g:FlowPanel ui:field=\"aclSettingsPanel\" addStyleNames=\"{style.aclSettingsPanel}\"/>\n      </b:Column>\n    </b:Row>\n\n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <g:Label text=\"{i18n.permissions}\" addStyleNames=\"panel-title\"/>\n        <g:FlowPanel addStyleNames=\"{style.separator}\"/>\n        <g:FlowPanel ui:field=\"aclPanel\" addStyleNames=\"{style.aclPanel}\"/>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupUsersAssignment.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesInlineEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.ExplorerViewContext;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.UsersExplorer;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>Presenter class for assign users to a new group.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class GroupUsersAssignment implements IsWidget {\n\n    AssignedEntitiesEditor<GroupUsersAssignment> view;\n    UsersExplorer usersExplorer;\n    Event<AddUsersToGroupEvent> addUsersToGroupEvent;\n    final Command saveEditorCallback = new Command() {\n        @Override\n        public void execute() {\n            hide();\n            // Fire the assign selection event.\n            final Set<String> selectedUsers = usersExplorer.getSelectedEntities();\n            // Delegate the recently updated assigned groups for the user.\n            addUsersToGroupEvent.fire(new AddUsersToGroupEvent(GroupUsersAssignment.this,\n                                                               selectedUsers));\n        }\n    };\n\n    @Inject\n    public GroupUsersAssignment(@AssignedEntitiesInlineEditor final AssignedEntitiesEditor<GroupUsersAssignment> view,\n                                final UsersExplorer usersExplorer,\n                                final Event<AddUsersToGroupEvent> addUsersToGroupEvent) {\n        this.view = view;\n        this.usersExplorer = usersExplorer;\n        this.addUsersToGroupEvent = addUsersToGroupEvent;\n    }\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.configure(usersExplorer.view);\n        view.configureSave(UsersManagementWidgetsConstants.INSTANCE.addUsersToGroup(),\n                           saveEditorCallback);\n    }\n\n    public void show(final String header) {\n        // Clear current view.\n        clear();\n\n        showUsersModal();\n        view.show(header);\n    }\n\n    public void hide() {\n        view.hide();\n    }\n    \n\n     /*  ******************************************************************************************************\n                                     PRIVATE METHODS FOR INTERNAL PRESENTER LOGIC \n         ****************************************************************************************************** */\n\n    public void clear() {\n        usersExplorer.clear();\n    }\n\n    private void showUsersModal() {\n        usersExplorer.show(new ExplorerViewContext() {\n\n            @Override\n            public boolean canCreate() {\n                return false;\n            }\n\n            @Override\n            public boolean canRead() {\n                return false;\n            }\n\n            @Override\n            public boolean canDelete() {\n                return false;\n            }\n\n            @Override\n            public boolean canSelect() {\n                return true;\n            }\n\n            @Override\n            public Set<String> getSelectedEntities() {\n                return null;\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/workflow/GroupCreationWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow;\n\nimport java.util.Collection;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.InvalidEntityIdentifierException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementClientConstants;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.CreateEntity;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.GroupUsersAssignment;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.INFO;\n\n/**\n * <p>Main entry point for creating a group instance.</p>\n *\n * @since 0.8.0\n */\n@Dependent\npublic class GroupCreationWorkflow implements IsWidget {\n\n    ClientUserSystemManager userSystemManager;\n    Caller<AuthorizationService> authorizationService;\n    PermissionManager permissionManager;\n    Event<OnErrorEvent> errorEvent;\n    ConfirmBox confirmBox;\n    LoadingBox loadingBox;\n    final ErrorCallback<Message> errorCallback = new ErrorCallback<Message>() {\n        @Override\n        public boolean error(final Message message,\n                             final Throwable throwable) {\n            loadingBox.hide();\n            showError(throwable);\n            return false;\n        }\n    };\n    Event<NotificationEvent> workbenchNotification;\n    CreateEntity createEntity;\n    GroupUsersAssignment groupUsersAssignment;\n    EntityWorkflowView view;\n    Event<CreateGroupEvent> onCreateGroupEvent;\n    Group group;\n\n    static final String PERSPECTIVE = \"perspective\";\n    static final String ACCESS = \"read\";\n\n    @Inject\n    public GroupCreationWorkflow(final ClientUserSystemManager userSystemManager,\n                                 final Caller<AuthorizationService> authorizationService,\n                                 final PermissionManager permissionManager,\n                                 final Event<OnErrorEvent> errorEvent,\n                                 final ConfirmBox confirmBox,\n                                 final LoadingBox loadingBox,\n                                 final Event<NotificationEvent> workbenchNotification,\n                                 final CreateEntity createEntity,\n                                 final GroupUsersAssignment groupUsersAssignment,\n                                 final Event<CreateGroupEvent> onCreateGroupEvent,\n                                 final EntityWorkflowView view) {\n        this.userSystemManager = userSystemManager;\n        this.authorizationService = authorizationService;\n        this.permissionManager = permissionManager;\n        this.errorEvent = errorEvent;\n        this.confirmBox = confirmBox;\n        this.loadingBox = loadingBox;\n        this.createEntity = createEntity;\n        this.groupUsersAssignment = groupUsersAssignment;\n        this.workbenchNotification = workbenchNotification;\n        this.onCreateGroupEvent = onCreateGroupEvent;\n        this.view = view;\n    }\n\n     /*  ******************************************************************************************************\n                                     PUBLIC PRESENTER API\n         ****************************************************************************************************** */\n\n    @PostConstruct\n    public void init() {\n\n    }\n\n    public void create() {\n        clear();\n\n        // Configure the view with the create entity component first.\n        view.setWidget(createEntity.asWidget())\n                .setSaveButtonVisible(true)\n                .setSaveButtonEnabled(true)\n                .setSaveButtonText(UsersManagementWidgetsConstants.INSTANCE.next())\n                .setCancelButtonVisible(false)\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        GroupCreationWorkflow.this.checkCreate();\n                    }\n\n                    @Override\n                    public void onCancel() {\n                        create();\n                    }\n                });\n\n        createEntity.show(UsersManagementWidgetsConstants.INSTANCE.inputGroupName(),\n                          UsersManagementWidgetsConstants.INSTANCE.groupName() + \"...\");\n    }\n\n    public void clear() {\n        view.clearNotifications();\n        createEntity.clear();\n        groupUsersAssignment.clear();\n        group = null;\n    }\n\n    /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    protected void showUsersAssignment(final String name) {\n        assert group != null;\n\n        // Configure the view with the group's users assignment component.\n        view.setWidget(groupUsersAssignment.asWidget())\n                .setSaveButtonVisible(false)\n                .setSaveButtonEnabled(false)\n                .setSaveButtonText(\"\")\n                .setCancelButtonVisible(true)\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        // Save button not present. Listen to the AddUsersToGroupEvent instance fired.\n                    }\n\n                    @Override\n                    public void onCancel() {\n                        create();\n                    }\n                });\n\n        groupUsersAssignment.show(UsersManagementWidgetsConstants.INSTANCE.assignUsersToGroupName() + \" \" + name);\n    }\n\n    protected void checkCreate() {\n        final String identifier = createEntity.getEntityIdentifier();\n\n        if (identifier != null) {\n            if (!isSafeValue(identifier)) {\n                showErrorMessage(UsersManagementWidgetsConstants.INSTANCE.invalidGroupName());\n            } else {\n            loadingBox.show();\n\n            // Check constrained groups, they cannot be created (such as registered roles).\n            final Collection<String> constrainedGroups = userSystemManager.getConstrainedGroups();\n            if (null != constrainedGroups && constrainedGroups.contains(identifier)) {\n\n                loadingBox.hide();\n\n                // Registered role found with this identifier, so name is not valid.\n                showErrorMessage(UsersManagementClientConstants.INSTANCE.roleAlreadyExists());\n                createEntity.setErrorState();\n            } else {\n\n                userSystemManager.groups(o -> {\n                                             loadingBox.hide();\n\n                                             // Group found, so name is not valid.\n                                             showErrorMessage(UsersManagementClientConstants.INSTANCE.groupAlreadyExists());\n                                             createEntity.setErrorState();\n                                         },\n                                         new ErrorCallback<Message>() {\n                                             @Override\n                                             public boolean error(final Message o,\n                                                                  final Throwable throwable) {\n                                                 loadingBox.hide();\n                                                 Throwable error = throwable;\n                                                 if (throwable instanceof GroupNotFoundException) {\n                                                     // Group not found, so name is valid.\n                                                     createGroup(identifier);\n                                                     error = null;\n                                                 } else if (throwable instanceof InvalidEntityIdentifierException) {\n                                                     error = new SecurityManagementException(getGroupIdentifierNotValidMessage((InvalidEntityIdentifierException) throwable),\n                                                                                             throwable);\n                                                 }\n                                                 // On error,\n                                                 if (null != error) {\n                                                     showError(throwable);\n                                                     create();\n                                                 }\n                                                 return false;\n                                             }\n                                         }).get(identifier);\n            }\n            }\n        }\n    }\n\n    private boolean isSafeValue(final String identifier) {\n        final String safeValue = new SafeHtmlBuilder().appendEscaped(identifier).toSafeHtml().asString();\n        return identifier.equals(safeValue);\n    }\n\n    private String getGroupIdentifierNotValidMessage(final InvalidEntityIdentifierException e) {\n        return UsersManagementWidgetsConstants.INSTANCE.invalidGroupName() +\n                \" [\" + e.getIdentifier() + \"]. \" +\n                UsersManagementWidgetsConstants.INSTANCE.patternAlphanumericSymbols() +\n                \" [\" + e.getSymbolsAccepted() + \"]\";\n    }\n\n    protected void createGroup(final String name) {\n        final Group _group = userSystemManager.createGroup(name);\n        createEntity.clear();\n        loadingBox.show();\n        userSystemManager.groups(new RemoteCallback<Group>() {\n                                     @Override\n                                     public void callback(Group group) {\n                                         GroupCreationWorkflow.this.group = group;\n                                         final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty();\n                                         loadingBox.hide();\n                                         if (!isEmptyUsersAllowed) {\n                                             showUsersAssignment(name);\n                                         } else {\n                                             confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                                                             UsersManagementWidgetsConstants.INSTANCE.assignUsersToGroupName() + \" \" + name,\n                                                             new Command() {\n                                                                 @Override\n                                                                 public void execute() {\n                                                                     showUsersAssignment(name);\n                                                                 }\n                                                             },\n                                                             new Command() {\n                                                                 @Override\n                                                                 public void execute() {\n                                                                     fireGroupCreated(name);\n                                                                     create();\n                                                                 }\n                                                             });\n                                         }\n                                     }\n                                 },\n                                 errorCallback).create(_group);\n    }\n\n    void onAssignUsers(@Observes final AddUsersToGroupEvent addUsersToGroupEvent) {\n        final Object editor = addUsersToGroupEvent.getContext();\n        if (editor != null && editor.equals(groupUsersAssignment)) {\n            final Set<String> users = addUsersToGroupEvent.getUsers();\n            assignUsers(users);\n        }\n    }\n\n    protected void assignUsers(final Collection<String> users) {\n        assert group != null;\n\n        final String name = group.getName();\n        final boolean isEmptyUsersAllowed = userSystemManager.getGroupManagerSettings().allowEmpty();\n        final boolean isEmpty = users == null || users.isEmpty();\n        if (!isEmptyUsersAllowed && isEmpty) {\n            showErrorMessage(UsersManagementWidgetsConstants.INSTANCE.groupMustHaveAtLeastOneUser());\n            showUsersAssignment(name);\n        } else {\n            loadingBox.show();\n            userSystemManager.groups(new RemoteCallback<Void>() {\n                                         @Override\n                                         public void callback(Void o) {\n                                             loadingBox.hide();\n                                             fireUsersAssigned(name);\n                                             create();\n                                         }\n                                     },\n                                     errorCallback).assignUsers(name,\n                                                                users);\n        }\n    }\n\n    protected void fireGroupCreated(final String name) {\n        workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.groupCreated(name) + \" \" + name,\n                                                         INFO));\n        onCreateGroupEvent.fire(new CreateGroupEvent(name));\n    }\n\n    protected void fireUsersAssigned(final String name) {\n        workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.usersAssigned(name),\n                                                         INFO));\n        onCreateGroupEvent.fire(new CreateGroupEvent(name));\n    }\n\n    void showErrorMessage(final String message) {\n        showError(new SecurityManagementException(message));\n    }\n\n    void showError(final Throwable throwable) {\n        errorEvent.fire(new OnErrorEvent(GroupCreationWorkflow.this,\n                                         throwable));\n    }\n\n    void onCreateGroupEvent(@Observes final CreateGroupEvent event) {\n        AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n        Group newGroup = new GroupImpl(event.getName());\n        String permissionName = PERSPECTIVE + \".\" + ACCESS + \".\" + authzPolicy.getHomePerspective(newGroup);\n        Permission permission = permissionManager.createPermission(permissionName, true);\n        authzPolicy.addPermission(newGroup, permission);\n        authorizationService.call(r -> {\n        }, errorCallback).savePolicy(authzPolicy);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/workflow/GroupEditorWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.group.GroupEditorDriver;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.GroupEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ContextualEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.HomePerspectiveChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeAddedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeRemovedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PriorityChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.INFO;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>Main entry point for viewing a group instance.</p>\n *\n * @since 0.8.0\n */\n@Dependent\npublic class GroupEditorWorkflow implements IsWidget {\n\n    public EntityWorkflowView view;\n    ClientUserSystemManager userSystemManager;\n    Caller<AuthorizationService> authorizationService;\n    PermissionManager permissionManager;\n    Event<OnErrorEvent> errorEvent;\n    protected final ErrorCallback<Message> errorCallback = (Message message, Throwable throwable) -> {\n        hideLoadingBox();\n        showError(throwable);\n        return false;\n    };\n    Event<NotificationEvent> workbenchNotification;\n    Event<SaveGroupEvent> saveGroupEvent;\n    Event<DeleteGroupEvent> deleteGroupEvent;\n    ConfirmBox confirmBox;\n    LoadingBox loadingBox;\n    GroupEditor groupEditor;\n    GroupEditorDriver groupEditorDriver;\n    Group group;\n    boolean isDirty;\n    PerspectiveActivity selectedHomePerspective = null;\n\n    @Inject\n    public GroupEditorWorkflow(final ClientUserSystemManager userSystemManager,\n                               final Caller<AuthorizationService> authorizationService,\n                               final PermissionManager permissionManager,\n                               final Event<OnErrorEvent> errorEvent,\n                               final ConfirmBox confirmBox,\n                               final LoadingBox loadingBox,\n                               final Event<NotificationEvent> workbenchNotification,\n                               final Event<SaveGroupEvent> saveGroupEvent,\n                               final Event<DeleteGroupEvent> deleteGroupEvent,\n                               final GroupEditor groupEditor,\n                               final GroupEditorDriver groupEditorDriver,\n                               final EntityWorkflowView view) {\n        this.userSystemManager = userSystemManager;\n        this.authorizationService = authorizationService;\n        this.permissionManager = permissionManager;\n        this.errorEvent = errorEvent;\n        this.confirmBox = confirmBox;\n        this.workbenchNotification = workbenchNotification;\n        this.saveGroupEvent = saveGroupEvent;\n        this.deleteGroupEvent = deleteGroupEvent;\n        this.groupEditor = groupEditor;\n        this.view = view;\n        this.groupEditorDriver = groupEditorDriver;\n        this.loadingBox = loadingBox;\n        this.isDirty = false;\n    }\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public GroupEditor getGroupEditor() {\n        return groupEditor;\n    }\n\n    public void show(final String name) {\n        doShow(name);\n    }\n\n    protected String getSaveButtonText() {\n        return UsersManagementWidgetsConstants.INSTANCE.saveChanges();\n    }\n\n    protected void onSave() {\n        doSave();\n    }\n\n    protected void onCancel() {\n        doShow(group.getName());\n    }\n\n    public void clear() {\n        groupEditor.clear();\n        view.clearNotifications();\n        group = null;\n    }\n\n    public boolean isDirty() {\n        return isDirty;\n    }\n\n    /*  ******************************************************************************************************\n                                 PROTECTED PRESENTER API\n     ****************************************************************************************************** */\n\n    void delete() {\n        final String name = group.getName();\n        userSystemManager.groups((Void v) -> {\n                                     doDelete();\n                                     clear();\n                                 },\n                                 errorCallback).delete(name);\n    }\n\n    protected void doDelete() {\n        final String name = group.getName();\n        AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n        showLoadingBox();\n        authorizationService.call(r -> {\n                                      hideLoadingBox();\n                                      deleteGroupEvent.fire(new DeleteGroupEvent(name));\n                                      workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.groupRemoved(name),\n                                                                                       INFO));\n                                  },\n                                  errorCallback).deletePolicyByGroup(group, authzPolicy);\n    }\n\n    protected void doShow(final String groupName) {\n        assert groupName != null;\n\n        // Configure the view.\n        doInitView();\n\n        // Start the workflow's logic.\n        checkDirty(() -> doLoad(groupName));\n    }\n\n    protected void doInitView() {\n        // Configure the workflow view.\n        view.setWidget(groupEditor.asWidget())\n                .setCancelButtonVisible(true)\n                .setSaveButtonVisible(true)\n                .setSaveButtonEnabled(isDirty)\n                .setSaveButtonText(getSaveButtonText())\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        GroupEditorWorkflow.this.onSave();\n                    }\n\n                    @Override\n                    public void onCancel() {\n                        GroupEditorWorkflow.this.onCancel();\n                    }\n                });\n    }\n\n    protected void doLoad(String name) {\n        clear();\n\n        // Call backend service.\n        showLoadingBox();\n        userSystemManager.groups((Group o) -> {\n                                     hideLoadingBox();\n                                     GroupEditorWorkflow.this.group = o;\n                                     assert group != null;\n\n                                     edit();\n                                 },\n                                 errorCallback).get(name);\n    }\n\n    protected void doSave() {\n        assert group != null;\n\n        final boolean isValid = groupEditorDriver.flush();\n        this.group = groupEditorDriver.getValue();\n        PermissionCollection groupPermissions = groupEditorDriver.getPermissions();\n        PerspectiveActivity homePerspective = groupEditorDriver.getHomePerspective();\n        int groupPriority = groupEditorDriver.getGroupPriority();\n\n        if (isValid) {\n            showLoadingBox();\n\n            // Update the current active policy\n            AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n            authzPolicy.setHomePerspective(group, homePerspective.getIdentifier());\n            authzPolicy.setPriority(group, groupPriority);\n            authzPolicy.setPermissions(group, groupPermissions);\n\n            // Save the policy in the backend\n            authorizationService.call(r -> {\n\n                                          hideLoadingBox();\n                                          isDirty = false;\n                                          workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.groupSaved(group.getName()),\n                                                                                           SUCCESS));\n                                          saveGroupEvent.fire(new SaveGroupEvent(group.getName()));\n                                          doShow(group.getName());\n                                      },\n                                      errorCallback).savePolicy(authzPolicy);\n        } else {\n            throw new RuntimeException(\"Group must be valid before updating it.\");\n        }\n    }\n\n    protected void showNotification(String message) {\n        view.showNotification(message);\n    }\n\n    protected void setDirty(final boolean isDirty) {\n        this.isDirty = isDirty;\n        view.setSaveButtonVisible(isDirty);\n        view.setSaveButtonEnabled(isDirty);\n        view.setCancelButtonVisible(true);\n        if (isDirty) {\n            view.showNotification(UsersManagementWidgetsConstants.INSTANCE.groupModified(group.getName()));\n        } else {\n            view.clearNotifications();\n        }\n    }\n\n    protected void checkDirty(final Command callback) {\n        if (isDirty) {\n            confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                            UsersManagementWidgetsConstants.INSTANCE.groupIsDirty(),\n                            () -> {\n                                GroupEditorWorkflow.this.isDirty = false;\n                                callback.execute();\n                            },\n                            () -> {\n                            });\n        } else {\n            callback.execute();\n        }\n    }\n\n    protected void showLoadingBox() {\n        loadingBox.show();\n    }\n\n    protected void hideLoadingBox() {\n        loadingBox.hide();\n    }\n\n    void showError(final Throwable throwable) {\n        errorEvent.fire(new OnErrorEvent(GroupEditorWorkflow.this,\n                                         throwable));\n    }\n\n    // Event observers\n\n    protected void edit() {\n        groupEditorDriver.edit(group,\n                               groupEditor);\n        view.setCancelButtonVisible(false);\n        view.setSaveButtonVisible(false);\n\n        selectedHomePerspective = groupEditor.getAclSettings().getHomePerspective();\n        if (isPerspectiveReadDenied(selectedHomePerspective)) {\n            showNotification(UsersManagementWidgetsConstants.INSTANCE.homePerspectiveReadDenied());\n        }\n    }\n\n    void onEditGroupEvent(@Observes final OnEditEvent onEditEvent) {\n        if (checkEventContext(onEditEvent,\n                              groupEditor)) {\n            edit();\n        }\n    }\n\n    void onDeleteGroupEvent(@Observes final OnDeleteEvent onDeleteEvent) {\n        if (checkEventContext(onDeleteEvent,\n                              groupEditor)) {\n            confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                            UsersManagementWidgetsConstants.INSTANCE.ensureRemoveGroup(),\n                            this::delete,\n                            () -> {\n                            });\n        }\n    }\n\n    void onHomePerspectiveChangedEvent(@Observes final HomePerspectiveChangedEvent event) {\n        if (checkEventContext(event,\n                              groupEditor.getAclSettings())) {\n            selectedHomePerspective = event.getPerspective();\n            checkStatus();\n        }\n    }\n\n    void onPriorityChangedEvent(@Observes final PriorityChangedEvent event) {\n        if (checkEventContext(event,\n                              groupEditor.getAclSettings())) {\n            checkStatus();\n        }\n    }\n\n    void onPermissionChangedEvent(@Observes final PermissionChangedEvent event) {\n        if (checkEventContext(event,\n                              groupEditor.getAclEditor())) {\n            checkStatus();\n        }\n    }\n\n    void onPermissionAddedEvent(@Observes final PermissionNodeAddedEvent event) {\n        if (checkEventContext(event,\n                              groupEditor.getAclEditor())) {\n            checkStatus();\n        }\n    }\n\n    void onPermissionRemovedEvent(@Observes final PermissionNodeRemovedEvent event) {\n        if (checkEventContext(event,\n                              groupEditor.getAclEditor())) {\n            checkStatus();\n        }\n    }\n\n    protected boolean checkEventContext(final ContextualEvent contextualEvent,\n                                        final Object context) {\n        return contextualEvent != null && contextualEvent.getContext() != null && contextualEvent.getContext().equals(context);\n    }\n\n    protected void checkStatus() {\n        boolean readDenied = isPerspectiveReadDenied(selectedHomePerspective);\n        if (readDenied) {\n            setDirty(false);\n            showNotification(UsersManagementWidgetsConstants.INSTANCE.homePerspectiveReadDenied());\n        } else {\n            setDirty(true);\n        }\n    }\n\n    protected boolean isPerspectiveReadDenied(PerspectiveActivity perspectiveActivity) {\n        if (perspectiveActivity == null) {\n            return false;\n        }\n        PermissionCollection permissionCollection = groupEditor.permissions();\n        if (permissionCollection == null) {\n            return false;\n        }\n        Permission p = permissionManager.createPermission(perspectiveActivity,\n                                                          PerspectiveAction.READ,\n                                                          false);\n        Permission existing = permissionCollection.get(p.getName());\n        if (existing != null) {\n            return existing.getResult().equals(AuthorizationResult.ACCESS_DENIED);\n        }\n        return permissionCollection.implies(p);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/RoleEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.role;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * <p>The user editor presenter.</p>\n * <p>User's groups are edited using the UserAssignedGroupsExplorer editor component. So the UserAssignedGroupsEditor works with a dummy user instance.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class RoleEditor implements IsWidget,\n                                   org.uberfire.ext.security.management.client.editor.role.RoleEditor {\n\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    ACLSettings aclSettings;\n    ACLViewer aclViewer;\n    ACLEditor aclEditor;\n    Event<OnEditEvent> onEditEvent;\n    Event<OnShowEvent> onShowEvent;\n    Role role;\n    boolean isEditMode;\n    @Inject\n    public RoleEditor(final ClientUserSystemManager userSystemManager,\n                      final ACLSettings aclSettings,\n                      final ACLViewer aclViewer,\n                      final ACLEditor aclEditor,\n                      final Event<OnEditEvent> onEditEvent,\n                      final Event<OnShowEvent> onShowEvent,\n                      final View view) {\n\n        this.userSystemManager = userSystemManager;\n        this.aclSettings = aclSettings;\n        this.aclViewer = aclViewer;\n        this.aclEditor = aclEditor;\n        this.onEditEvent = onEditEvent;\n        this.onShowEvent = onShowEvent;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.setACLSettings(aclSettings);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*  ******************************************************************************************************\n                                     PUBLIC PRESENTER API \n         ****************************************************************************************************** */\n\n    @Override\n    public String name() {\n        return role.getName();\n    }\n\n    @Override\n    public PerspectiveActivity homePerspective() {\n        return aclSettings.getHomePerspective();\n    }\n\n    @Override\n    public int rolePriority() {\n        return aclSettings.getPriority();\n    }\n\n    @Override\n    public PermissionCollection permissions() {\n        return aclEditor.getPermissions();\n    }\n\n    public ACLSettings getAclSettings() {\n        return aclSettings;\n    }\n\n    public ACLEditor getAclEditor() {\n        return aclEditor;\n    }\n\n    @Override\n    public void show(final Role role) {\n        clear();\n        this.isEditMode = false;\n        open(role);\n        onShowEvent.fire(new OnShowEvent(RoleEditor.this,\n                                         role));\n    }\n\n    @Override\n    public void edit(final Role role) {\n        clear();\n        this.isEditMode = true;\n        open(role);\n    }\n\n    @Override\n    public void flush() {\n        assert role != null;\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    @Override\n    public Role getValue() {\n        return role;\n    }\n\n    @Override\n    public void setViolations(final Set<ConstraintViolation<Role>> violations) {\n        //  Currently no violations expected.\n    }\n\n    public void clear() {\n        isEditMode = false;\n        role = null;\n    }\n\n    void onEdit() {\n        onEditEvent.fire(new OnEditEvent(RoleEditor.this,\n                                         role));\n    }\n    \n    /*  ******************************************************************************************************\n                                 VIEW CALLBACKS \n     ****************************************************************************************************** */\n\n    protected void open(final Role role) {\n        assert role != null;\n        this.role = role;\n\n        // Role name\n        final String name = role.getName();\n        view.setRolename(name);\n\n        // Edit mode\n        view.setEditButtonVisible(!isEditMode);\n\n        // ACL Editor/Viewer\n        if (isEditMode) {\n            aclSettings.edit(role);\n            aclEditor.edit(role);\n            view.editACL(aclEditor);\n        } else {\n            aclSettings.show(role);\n            aclViewer.show(role);\n            view.showACL(aclViewer);\n        }\n    }\n\n     /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    public interface View extends UberView<RoleEditor> {\n\n        View setRolename(String username);\n\n        View setEditButtonVisible(boolean isVisible);\n\n        View setACLSettings(IsWidget aclSettings);\n\n        View showACL(IsWidget aclViewer);\n\n        View editACL(IsWidget aclEditor);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/RoleEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.role;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\n\npublic class RoleEditorView extends Composite implements RoleEditor.View {\n\n    private static RoleEditorViewBinder uiBinder = GWT.create(RoleEditorViewBinder.class);\n    @UiField\n    FlowPanel aclPanel;\n    @UiField\n    FlowPanel aclSettingsPanel;\n    @UiField\n    Heading roleTitle;\n    @UiField\n    Button editButton;\n    private RoleEditor presenter;\n\n    @Override\n    public void init(final RoleEditor presenter) {\n        this.presenter = presenter;\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public RoleEditor.View setRolename(String rolename) {\n        String headerText = UsersManagementWidgetsConstants.INSTANCE.roleSettings(rolename);\n        roleTitle.setText(headerText);\n        roleTitle.setTitle(headerText);\n        return this;\n    }\n\n    @Override\n    public RoleEditor.View setEditButtonVisible(final boolean isVisible) {\n        editButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public RoleEditor.View setACLSettings(IsWidget aclSettings) {\n        aclSettingsPanel.clear();\n        aclSettingsPanel.add(aclSettings);\n        return this;\n    }\n\n    @Override\n    public RoleEditor.View showACL(IsWidget aclViewer) {\n        aclPanel.clear();\n        aclPanel.add(aclViewer);\n        return this;\n    }\n\n    @Override\n    public RoleEditor.View editACL(IsWidget aclEditor) {\n        aclPanel.clear();\n        aclPanel.add(aclEditor);\n        return this;\n    }\n\n    @UiHandler(\"editButton\")\n    public void onEditButtonClick(final ClickEvent event) {\n        presenter.onEdit();\n    }\n\n    interface RoleEditorViewBinder extends UiBinder<Widget, RoleEditorView> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/RoleEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .roleTitle {\n      margin-top: 0;\n      float: left;\n    }\n    .editButton {\n      margin-left: 5px;\n    }\n    .separator{\n      height: 1px;\n      background-color: lightgrey;\n      margin-top: 10px;\n      margin-bottom: -5px;\n    }\n    .aclSettingsLabel {\n      margin-top: 10px;\n    }\n    .aclPanel {\n      margin-bottom: 10px;\n    }\n  </ui:style>\n\n  <g:FlowPanel width=\"100%\">\n\n    <b:Container fluid=\"true\" addStyleNames=\"panel-group\">\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <b:Heading size=\"H1\" ui:field=\"roleTitle\" addStyleNames=\"{style.roleTitle}\"/>\n          <b:Button type=\"LINK\" text=\"{i18n.edit}\" title=\"{i18n.edit}\" icon=\"PENCIL\"\n                    ui:field=\"editButton\" addStyleNames=\"{style.editButton}\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <g:FlowPanel ui:field=\"aclSettingsPanel\" addStyleNames=\"{style.aclSettingsLabel}\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <g:Label text=\"{i18n.permissions}\" addStyleNames=\"panel-title\"/>\n          <g:FlowPanel addStyleNames=\"{style.separator}\"/>\n          <g:FlowPanel ui:field=\"aclPanel\" addStyleNames=\"{style.aclPanel}\"/>\n        </b:Column>\n      </b:Row>\n\n   </b:Container>\n\n  </g:FlowPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/workflow/BaseRoleEditorWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.role.workflow;\n\nimport java.util.Collection;\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.role.RoleEditorDriver;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.role.RoleEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ContextualEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>The workflow for editing a role.</p>\n * <p>It links the editor & sub-editors components with the editor driver and the remote user services.</p>\n * @since 0.9.0\n */\npublic abstract class BaseRoleEditorWorkflow implements IsWidget {\n\n    public EntityWorkflowView view;\n    protected ClientUserSystemManager userSystemManager;\n    protected Caller<AuthorizationService> authorizationService;\n    protected PermissionManager permissionManager;\n    protected Event<OnErrorEvent> errorEvent;\n    protected Event<NotificationEvent> workbenchNotification;\n    protected Event<SaveRoleEvent> saveRoleEvent;\n    protected ConfirmBox confirmBox;\n    protected RoleEditor roleEditor;\n    protected RoleEditorDriver roleEditorDriver;\n    protected LoadingBox loadingBox;\n    protected final ErrorCallback<Message> errorCallback = (message, throwable) -> {\n        hideLoadingBox();\n        showError(throwable);\n        return false;\n    };\n    protected Role role;\n    protected boolean isDirty;\n\n    public BaseRoleEditorWorkflow(final ClientUserSystemManager userSystemManager,\n                                  final Caller<AuthorizationService> authorizationService,\n                                  final PermissionManager permissionManager,\n                                  final Event<OnErrorEvent> errorEvent,\n                                  final Event<NotificationEvent> workbenchNotification,\n                                  final Event<SaveRoleEvent> saveRoleEvent,\n                                  final ConfirmBox confirmBox,\n                                  final RoleEditor roleEditor,\n                                  final RoleEditorDriver roleEditorDriver,\n                                  final LoadingBox loadingBox,\n                                  final EntityWorkflowView view) {\n\n        this.userSystemManager = userSystemManager;\n        this.authorizationService = authorizationService;\n        this.permissionManager = permissionManager;\n        this.errorEvent = errorEvent;\n        this.workbenchNotification = workbenchNotification;\n        this.saveRoleEvent = saveRoleEvent;\n        this.confirmBox = confirmBox;\n        this.roleEditor = roleEditor;\n        this.roleEditorDriver = roleEditorDriver;\n        this.loadingBox = loadingBox;\n        this.view = view;\n        this.isDirty = false;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public RoleEditor getRoleEditor() {\n        return roleEditor;\n    }\n\n    /*  ******************************************************************************************************\n                                     PROTECTED PRESENTER API\n         ****************************************************************************************************** */\n\n    public void clear() {\n        view.clearNotifications();\n        roleEditor.clear();\n        isDirty = false;\n        role = null;\n    }\n\n    public boolean isDirty() {\n        return isDirty;\n    }\n\n    protected void doShow(final String roleName) {\n        assert roleName != null;\n\n        // Configure the view.\n        doInitView();\n\n        // Start the workflow's logic.\n        checkDirty(() -> doLoad(roleName));\n    }\n\n    protected void doLoad(String roleName) {\n        checkDirty(this::clear);\n\n        // Call backend service.\n        showLoadingBox();\n        userSystemManager.roles((Role o) -> {\n                                    hideLoadingBox();\n                                    BaseRoleEditorWorkflow.this.role = o;\n                                    assert role != null;\n\n                                    edit();\n                                },\n                                errorCallback).get(roleName);\n    }\n\n    protected void onSave() {\n        doSave();\n    }\n\n    protected void onCancel() {\n        doShow(BaseRoleEditorWorkflow.this.role.getName());\n    }\n\n    protected void doInitView() {\n        view.setWidget(roleEditor.view)\n                .setCancelButtonVisible(true)\n                .setSaveButtonVisible(true)\n                .setSaveButtonEnabled(isDirty)\n                .setSaveButtonText(getSaveButtonText())\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        BaseRoleEditorWorkflow.this.onSave();\n                    }\n\n                    @Override\n                    public void onCancel() {\n                        BaseRoleEditorWorkflow.this.onCancel();\n                    }\n                });\n    }\n\n    protected String getSaveButtonText() {\n        return UsersManagementWidgetsConstants.INSTANCE.saveChanges();\n    }\n\n    protected void showNotification(String message) {\n        view.showNotification(message);\n    }\n\n    protected void setDirty(final boolean isDirty) {\n        this.isDirty = isDirty;\n        view.setSaveButtonVisible(isDirty);\n        view.setSaveButtonEnabled(isDirty);\n        view.setCancelButtonVisible(true);\n        if (isDirty) {\n            view.showNotification(UsersManagementWidgetsConstants.INSTANCE.roleModified(BaseRoleEditorWorkflow.this.role.getName()));\n        } else {\n            view.clearNotifications();\n        }\n    }\n\n    protected void edit() {\n        roleEditorDriver.edit(role,\n                              roleEditor);\n        view.setCancelButtonVisible(false);\n        view.setSaveButtonVisible(false);\n    }\n\n    protected void doSave() {\n        assert role != null;\n\n        final boolean isValid = roleEditorDriver.flush();\n        this.role = roleEditorDriver.getValue();\n        PermissionCollection rolePermissions = roleEditorDriver.getPermissions();\n        PerspectiveActivity homePerspective = roleEditorDriver.getHomePerspective();\n        int rolePriority = roleEditorDriver.getRolePriority();\n\n        if (isValid) {\n            showLoadingBox();\n\n            // Update the current active policy\n            AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n            authzPolicy.setHomePerspective(role, homePerspective.getIdentifier());\n            authzPolicy.setPriority(role, rolePriority);\n            authzPolicy.setPermissions(role, rolePermissions);\n\n            // Save the policy in the backend\n            authorizationService.call(r -> {\n\n                                          hideLoadingBox();\n                                          isDirty = false;\n                                          workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.roleSaved(role.getName()),\n                                                                                           SUCCESS));\n                                          saveRoleEvent.fire(new SaveRoleEvent(role.getName()));\n                                          doShow(role.getName());\n                                      },\n                                      errorCallback).savePolicy(authzPolicy);\n        } else {\n            throw new RuntimeException(\"Role must be valid before updating it.\");\n        }\n    }\n\n    protected boolean checkEventContext(final ContextualEvent contextualEvent,\n                                        final Object context) {\n        return contextualEvent != null && contextualEvent.getContext() != null && contextualEvent.getContext().equals(context);\n    }\n\n    void showError(final Throwable throwable) {\n        errorEvent.fire(new OnErrorEvent(BaseRoleEditorWorkflow.this,\n                                         throwable));\n    }\n\n    protected void checkDirty(final Command callback) {\n        if (isDirty) {\n            confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                            UsersManagementWidgetsConstants.INSTANCE.roleIsDirty(),\n                            () -> {\n                                BaseRoleEditorWorkflow.this.isDirty = false;\n                                callback.execute();\n                            },\n                            () -> {\n                            });\n        } else {\n            callback.execute();\n        }\n    }\n\n    protected void showLoadingBox() {\n        loadingBox.show();\n    }\n\n    protected void hideLoadingBox() {\n        loadingBox.hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/workflow/RoleEditorWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.role.workflow;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.role.RoleEditorDriver;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.role.RoleEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.HomePerspectiveChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeAddedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeRemovedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PriorityChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n/**\n * <p>The workflow for editing a role.</p>\n * <p>It links the editor & sub-editors components with the editor driver and the remote user services.</p>\n * @since 0.9.0\n */\n@Dependent\npublic class RoleEditorWorkflow extends BaseRoleEditorWorkflow {\n\n    private PerspectiveActivity selectedHomePerspective = null;\n\n    @Inject\n    public RoleEditorWorkflow(final ClientUserSystemManager userSystemManager,\n                              final Caller<AuthorizationService> authorizationService,\n                              final PermissionManager permissionManager,\n                              final Event<OnErrorEvent> errorEvent,\n                              final Event<NotificationEvent> workbenchNotification,\n                              final Event<SaveRoleEvent> saveUserEvent,\n                              final ConfirmBox confirmBox,\n                              final RoleEditor roleEditor,\n                              final RoleEditorDriver roleEditorDriver,\n                              final LoadingBox loadingBox,\n                              final EntityWorkflowView view) {\n\n        super(userSystemManager,\n              authorizationService,\n              permissionManager,\n              errorEvent,\n              workbenchNotification,\n              saveUserEvent,\n              confirmBox,\n              roleEditor,\n              roleEditorDriver,\n              loadingBox,\n              view);\n    }\n\n    public void show(final String roleName) {\n        doShow(roleName);\n    }\n\n    @Override\n    protected void edit() {\n        super.edit();\n\n        selectedHomePerspective = roleEditor.getAclSettings().getHomePerspective();\n        if (isPerspectiveReadDenied(selectedHomePerspective)) {\n            showNotification(UsersManagementWidgetsConstants.INSTANCE.homePerspectiveReadDenied());\n        }\n    }\n\n    void onEditRoleEvent(@Observes final OnEditEvent onEditEvent) {\n        if (checkEventContext(onEditEvent,\n                              roleEditor)) {\n            edit();\n        }\n    }\n\n    void onHomePerspectiveChangedEvent(@Observes final HomePerspectiveChangedEvent event) {\n        if (checkEventContext(event,\n                              roleEditor.getAclSettings())) {\n            selectedHomePerspective = event.getPerspective();\n            checkStatus();\n        }\n    }\n\n    void onPriorityChangedEvent(@Observes final PriorityChangedEvent event) {\n        if (checkEventContext(event,\n                              roleEditor.getAclSettings())) {\n            checkStatus();\n        }\n    }\n\n    void onPermissionChangedEvent(@Observes final PermissionChangedEvent event) {\n        if (checkEventContext(event,\n                              roleEditor.getAclEditor())) {\n            checkStatus();\n        }\n    }\n\n    void onPermissionAddedEvent(@Observes final PermissionNodeAddedEvent event) {\n        if (checkEventContext(event,\n                              roleEditor.getAclEditor())) {\n            setDirty(true);\n            checkStatus();\n        }\n    }\n\n    void onPermissionRemovedEvent(@Observes final PermissionNodeRemovedEvent event) {\n        if (checkEventContext(event,\n                              roleEditor.getAclEditor())) {\n            checkStatus();\n        }\n    }\n\n    protected void checkStatus() {\n        boolean readDenied = isPerspectiveReadDenied(selectedHomePerspective);\n        if (readDenied) {\n            setDirty(false);\n            showNotification(UsersManagementWidgetsConstants.INSTANCE.homePerspectiveReadDenied());\n        } else {\n            setDirty(true);\n        }\n    }\n\n    protected boolean isPerspectiveReadDenied(PerspectiveActivity perspectiveActivity) {\n        if (perspectiveActivity == null) {\n            return false;\n        }\n        PermissionCollection permissionCollection = roleEditor.permissions();\n        Permission p = permissionManager.createPermission(perspectiveActivity,\n                                                          PerspectiveAction.READ,\n                                                          false);\n        Permission existing = permissionCollection.get(p.getName());\n        if (existing != null) {\n            return existing.getResult().equals(AuthorizationResult.ACCESS_DENIED);\n        }\n        return permissionCollection.implies(p);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/NewUserAttributeEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.form.validator.Validator;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.editor.HasRestrictedValues;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\n\n/**\n * <p>Presenter class for creating a new user attribute.</p>\n */\n@Dependent\npublic class NewUserAttributeEditor implements IsWidget,\n                                               HasRestrictedValues<Collection<String>> {\n\n    public View view;\n    final Validator<String> attributeValueValidator = new Validator<String>() {\n        @Override\n        public int getPriority() {\n            return 1;\n        }\n\n        @Override\n        public List<EditorError> validate(final Editor<String> editor,\n                                          final String s) {\n            final List<EditorError> result = new ArrayList<EditorError>();\n            final String errorMsg = validateAttributeValue(s);\n            if (errorMsg != null) {\n                EditorError e = view.createAttributeValueError(s,\n                                                               errorMsg);\n                result.add(e);\n            }\n            return result;\n        }\n    };\n    Event<CreateUserAttributeEvent> createUserAttributeEventEvent;\n    Collection<String> restrictedAttributeNames;\n    final Validator<String> attributeNameValidator = new Validator<String>() {\n        @Override\n        public int getPriority() {\n            return 0;\n        }\n\n        @Override\n        public List<EditorError> validate(final Editor<String> editor,\n                                          final String s) {\n            final List<EditorError> result = new ArrayList<EditorError>();\n            final String errorMsg = validateAttributeName(s);\n            if (errorMsg != null) {\n                EditorError e = view.createAttributeNameError(s,\n                                                              errorMsg);\n                result.add(e);\n            }\n            return result;\n        }\n    };\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    @Inject\n    public NewUserAttributeEditor(final View view,\n                                  final Event<CreateUserAttributeEvent> createUserAttributeEventEvent) {\n        this.view = view;\n        this.createUserAttributeEventEvent = createUserAttributeEventEvent;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.configure(attributeNameValidator,\n                       attributeValueValidator);\n    }\n\n    public NewUserAttributeEditor showAddButton() {\n        view.reset().setShowAddButton(true).setShowForm(false);\n        return this;\n    }\n\n    public NewUserAttributeEditor showForm() {\n        view.reset().setShowAddButton(false).setShowForm(true);\n        return this;\n    }\n\n    public NewUserAttributeEditor clear() {\n        showAddButton();\n        restrictedAttributeNames = null;\n        return this;\n    }\n    \n    /*  ******************************************************************************************************\n                                 VIEW CALLBACKS \n     ****************************************************************************************************** */\n\n    @Override\n    public void setRestrictedValues(final Collection<String> value) {\n        this.restrictedAttributeNames = value;\n    }\n\n    void onNewAttributeClick() {\n        showForm();\n    }\n\n    void onCancel() {\n        showAddButton();\n    }\n\n    /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    void addNewAttribute(final String name,\n                         final String value) {\n        final Map.Entry<String, String> attr = createAttributeEntry(name,\n                                                                    value);\n        createUserAttributeEventEvent.fire(new CreateUserAttributeEvent(this,\n                                                                        attr));\n    }\n\n    String validateAttributeName(final String value) {\n        if (isEmpty(value)) {\n            return UsersManagementWidgetsConstants.INSTANCE.nameIsMandatory();\n        }\n        if (containsAttribute(value)) {\n            return UsersManagementWidgetsConstants.INSTANCE.attributeAlreadyExists();\n        }\n        return null;\n    }\n\n    String validateAttributeValue(final String value) {\n        if (isEmpty(value)) {\n            return UsersManagementWidgetsConstants.INSTANCE.valueIsMandatory();\n        }\n        return null;\n    }\n\n    private Map.Entry<String, String> createAttributeEntry(final String key,\n                                                           final String value) {\n        return new Map.Entry<String, String>() {\n            @Override\n            public String getKey() {\n                return key;\n            }\n\n            @Override\n            public String getValue() {\n                return value;\n            }\n\n            @Override\n            public String setValue(String value) {\n                return null;\n            }\n        };\n    }\n\n    private boolean containsAttribute(final String key) {\n        return key != null && this.restrictedAttributeNames != null\n                && restrictedAttributeNames.contains(key);\n    }\n\n    private boolean isEmpty(final String str) {\n        return str == null || str.trim().length() == 0;\n    }\n\n    public interface View extends UberView<NewUserAttributeEditor> {\n\n        View configure(Validator<String> attributeNameValidator,\n                       Validator<String> attributeValueValidator);\n\n        EditorError createAttributeNameError(String value,\n                                             String message);\n\n        EditorError createAttributeValueError(String value,\n                                              String message);\n\n        View reset();\n\n        View setShowAddButton(boolean isCreateButton);\n\n        View setShowForm(boolean isCreationForm);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/NewUserAttributeEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.gwtbootstrap3.client.ui.form.error.BasicEditorError;\nimport org.gwtbootstrap3.client.ui.form.validator.Validator;\n\n@Dependent\npublic class NewUserAttributeEditorView extends Composite implements NewUserAttributeEditor.View {\n\n    private static NewUserAttributeViewBinder uiBinder = GWT.create(NewUserAttributeViewBinder.class);\n    @UiField\n    Row addAttributeButtonRow;\n    @UiField\n    Button addAttributeButton;\n    @UiField\n    Row addAttributeRow;\n    @UiField\n    FormGroup newAttributeNameFormGroup;\n    @UiField\n    TextBox newAttributeNameBox;\n    @UiField\n    FormGroup newAttributeValueFormGroup;\n    @UiField\n    TextBox newAttributeValueBox;\n    @UiField\n    Button newAttributeCancelButton;\n    @UiField\n    Button newAttributeSaveButton;\n    private NewUserAttributeEditor presenter;\n\n    @UiConstructor\n    public NewUserAttributeEditorView() {\n\n    }\n\n    @Override\n    public void init(final NewUserAttributeEditor presenter) {\n        this.presenter = presenter;\n\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public NewUserAttributeEditor.View configure(final Validator<String> attributeNameValidator,\n                                                 final Validator<String> attributeValueValidator) {\n        // Text box bootstrap validators.\n        newAttributeNameBox.addValidator(attributeNameValidator);\n        newAttributeValueBox.addValidator(attributeValueValidator);\n        return this;\n    }\n\n    @Override\n    public EditorError createAttributeNameError(String value,\n                                                String message) {\n        return new BasicEditorError(newAttributeNameBox,\n                                    value,\n                                    message);\n    }\n\n    @Override\n    public EditorError createAttributeValueError(String value,\n                                                 String message) {\n        return new BasicEditorError(newAttributeValueBox,\n                                    value,\n                                    message);\n    }\n\n    @Override\n    public NewUserAttributeEditor.View setShowAddButton(boolean isCreateButton) {\n        addAttributeButtonRow.setVisible(isCreateButton);\n        return this;\n    }\n\n    @Override\n    public NewUserAttributeEditor.View setShowForm(boolean isCreationForm) {\n        addAttributeRow.setVisible(isCreationForm);\n        return this;\n    }\n\n    @Override\n    public NewUserAttributeEditor.View reset() {\n        newAttributeNameBox.setText(\"\");\n        newAttributeNameFormGroup.setValidationState(ValidationState.NONE);\n        newAttributeValueBox.setText(\"\");\n        newAttributeValueFormGroup.setValidationState(ValidationState.NONE);\n        return this;\n    }\n\n    @UiHandler(\"addAttributeButton\")\n    public void onAddAttributeButtonClick(final ClickEvent event) {\n        presenter.onNewAttributeClick();\n    }\n\n    @UiHandler(\"newAttributeCancelButton\")\n    public void onNewAttributeCancelButtonClick(final ClickEvent event) {\n        presenter.onCancel();\n    }\n\n    @UiHandler(\"newAttributeSaveButton\")\n    public void onNewAttributeSaveButtonClick(final ClickEvent event) {\n        final boolean isValid = newAttributeNameBox.validate() && newAttributeValueBox.validate();\n        if (isValid) {\n            newAttributeNameFormGroup.setValidationState(ValidationState.NONE);\n            newAttributeValueFormGroup.setValidationState(ValidationState.NONE);\n            final String name = newAttributeNameBox.getText();\n            final String value = newAttributeValueBox.getText();\n            presenter.addNewAttribute(name,\n                                      value);\n        }\n    }\n\n    interface NewUserAttributeViewBinder\n            extends\n            UiBinder<Widget, NewUserAttributeEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/NewUserAttributeEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .addAttributeButton {\n      margin-bottom: 2px;\n    }\n    .newAttributeForm {\n      text-align: center;\n    }\n    .newAttributeFormGroup {\n      margin-right: 5px;\n    }\n    .button {\n      margin-left: 2px;\n    }\n  </ui:style>\n  \n  <b:Container fluid=\"true\">\n\n    <b:Row ui:field=\"addAttributeButtonRow\">\n      <b:Column size=\"MD_12\">\n        <b:Button type=\"LINK\" icon=\"PLUS\" text=\"{i18n.addAttribute}\" title=\"{i18n.addAttribute}\"\n                  ui:field=\"addAttributeButton\" addStyleNames=\"{style.addAttributeButton} \"/>\n      </b:Column>\n    </b:Row>\n    \n    <b:Row ui:field=\"addAttributeRow\">\n      <b:Column size=\"MD_12\" >\n\n        <b:Well>\n          <b:Form type=\"INLINE\" addStyleNames=\"{style.newAttributeForm}\">\n\n            <b:FormGroup ui:field=\"newAttributeNameFormGroup\" addStyleNames=\"{style.newAttributeFormGroup}\">\n              <b:TextBox ui:field=\"newAttributeNameBox\" allowBlank=\"false\" placeholder=\"{i18n.name}\"/>\n            </b:FormGroup>\n\n            <b:FormGroup ui:field=\"newAttributeValueFormGroup\" addStyleNames=\"{style.newAttributeFormGroup}\">\n              <b:TextBox ui:field=\"newAttributeValueBox\" allowBlank=\"false\" placeholder=\"{i18n.value}\"/>\n            </b:FormGroup>\n\n            <b:FormGroup>\n              <b:Button ui:field=\"newAttributeSaveButton\" type=\"PRIMARY\" size=\"EXTRA_SMALL\" text=\"{i18n.add}\" title=\"{i18n.add}\" addStyleNames=\"{style.button}\"/>\n              <b:Button ui:field=\"newAttributeCancelButton\" type=\"DEFAULT\" size=\"EXTRA_SMALL\" text=\"{i18n.cancel}\" title=\"{i18n.cancel}\" addStyleNames=\"{style.button}\"/>\n            </b:FormGroup>\n\n          </b:Form>\n        </b:Well>\n\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n  \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedEntitiesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.AbstractEntityExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.ExplorerViewContext;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>Presenter base class for user's assigned entities editor.</p>\n * @since 0.8.0\n */\npublic abstract class UserAssignedEntitiesEditor<T> implements IsWidget {\n\n    public AssignedEntitiesEditor view;\n    final Command closeEditorCallback = new Command() {\n        @Override\n        public void execute() {\n            hide();\n        }\n    };\n    protected Set<T> entities = new LinkedHashSet<T>();\n    protected boolean isEditMode;\n    ClientUserSystemManager userSystemManager;\n    AbstractEntityExplorer<T> entitiesExplorer;\n    final Command saveEditorCallback = new Command() {\n\n        @Override\n        public void execute() {\n            hide();\n\n            final Set<String> selected = entitiesExplorer.getSelectedEntities();\n            entities.clear();\n            onSave(selected);\n            entitiesExplorer.clear();\n        }\n    };\n\n    @Inject\n    public UserAssignedEntitiesEditor(final ClientUserSystemManager userSystemManager,\n                                      final AbstractEntityExplorer<T> entitiesExplorer,\n                                      final AssignedEntitiesEditor view) {\n        this.userSystemManager = userSystemManager;\n        this.entitiesExplorer = entitiesExplorer;\n        this.view = view;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    protected abstract String getCancelText();\n\n    protected abstract String getAddText();\n    \n    \n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    protected abstract String getTitle();\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    protected abstract String getEntityIdentifier(T entity);\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.configure(entitiesExplorer.view);\n        view.configureClose(getCancelText(),\n                            closeEditorCallback);\n        view.configureSave(getAddText(),\n                           saveEditorCallback);\n        entitiesExplorer.setPageSize(10);\n    }\n\n    public void show(final User user) {\n        clear();\n        this.isEditMode = false;\n        open(user);\n    }\n\n    public void edit(final User user) {\n        clear();\n        this.isEditMode = true;\n        open(user);\n    }\n\n    public void flush() {\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    public Set<T> getValue() {\n        return entities;\n    }\n\n    public void setViolations(Set<ConstraintViolation<User>> constraintViolations) {\n        //  Currently no violations expected.\n    }\n    \n    \n    /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    public void hide() {\n        view.hide();\n    }\n\n    public void clear() {\n        entitiesExplorer.clear();\n        entities.clear();\n    }\n\n    protected ExplorerViewContext getViewContext() {\n        return new ExplorerViewContext() {\n\n            @Override\n            public boolean canCreate() {\n                return false;\n            }\n\n            @Override\n            public boolean canRead() {\n                return false;\n            }\n\n            @Override\n            public boolean canDelete() {\n                return false;\n            }\n\n            @Override\n            public boolean canSelect() {\n                return true;\n            }\n\n            @Override\n            public Set<String> getSelectedEntities() {\n                if (entities != null && !entities.isEmpty()) {\n                    final Set<String> result = new HashSet<String>(entities.size());\n                    for (final T entity : entities) {\n                        result.add(UserAssignedEntitiesEditor.this.getEntityIdentifier(entity));\n                    }\n                    return result;\n                }\n                return null;\n            }\n\n            @Override\n            public Set<String> getConstrainedEntities() {\n                return new HashSet<String>();\n            }\n        };\n    }\n\n    protected void open(final User user) {\n        assert user != null;\n        view.show(getTitle() + \" \" + user.getIdentifier());\n    }\n\n    protected void onSave(final Set<String> selectedEntities) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedEntitiesExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.LinkedHashSet;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesPagedList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\n\n/**\n * <p>Base presenter class for user's assigned entities explorer widget.</p>\n * <p>It's considered an Editor due to it allows removing assigned user's entities.</p>\n * @since 0.8.0\n */\npublic abstract class UserAssignedEntitiesExplorer<T> implements IsWidget {\n\n    protected final static int PAGE_SIZE = 5;\n    public AssignedEntitiesExplorer view;\n    protected Set<T> entities = new LinkedHashSet<T>();\n    protected boolean isEditMode;\n    ClientUserSystemManager userSystemManager;\n    ConfirmBox confirmBox;\n    EntitiesPagedList<T> entitiesList;\n    @Inject\n    public UserAssignedEntitiesExplorer(final ClientUserSystemManager userSystemManager,\n                                        final ConfirmBox confirmBox,\n                                        final EntitiesPagedList<T> entitiesList,\n                                        final AssignedEntitiesExplorer view) {\n        this.userSystemManager = userSystemManager;\n        this.confirmBox = confirmBox;\n        this.entitiesList = entitiesList;\n        this.view = view;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    protected abstract String getEmptyText();\n\n    protected abstract String getEntityType();\n\n    protected abstract String getTitle();\n\n    protected abstract String getEntityId(final T entity);\n\n    protected abstract String getEntityName(final T entity);\n\n    protected abstract String getEnsureRemoveText();\n\n    protected abstract boolean canAssignEntities();\n\n    protected abstract void doShow();\n\n    protected abstract void removeEntity(String name);\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    @PostConstruct\n    public void init() {\n        entitiesList.setPageSize(PAGE_SIZE);\n        entitiesList.setEmptyEntitiesText(getEmptyText());\n        view.configure(getTitle(),\n                       entitiesList.view);\n    }\n\n    public void show(final User user) {\n        clear();\n        this.isEditMode = false;\n        open(user);\n    }\n\n    public void edit(final User user) {\n        clear();\n        this.isEditMode = true;\n        open(user);\n    }\n\n    public void flush() {\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    public Set<T> getValue() {\n        return entities;\n    }\n\n    public void setViolations(Set<ConstraintViolation<User>> constraintViolations) {\n        //  Currently no violations expected.\n    }\n\n    public void clear() {\n        view.clear();\n        entitiesList.clear();\n        isEditMode = false;\n        entities.clear();\n    }\n    \n    \n    /*  ******************************************************************************************************\n                                 OTHER METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    protected EntitiesList.Callback<T> getCallback() {\n        return new EntitiesList.Callback<T>() {\n            @Override\n            public String getEntityType() {\n                return UserAssignedEntitiesExplorer.this.getEntityType();\n            }\n\n            @Override\n            public boolean canRead() {\n                return true;\n            }\n\n            @Override\n            public boolean canRemove() {\n                return canAssignEntities();\n            }\n\n            @Override\n            public boolean canSelect() {\n                return false;\n            }\n\n            @Override\n            public boolean isSelected(final String identifier) {\n                return false;\n            }\n\n            @Override\n            public String getIdentifier(final T entity) {\n                return UserAssignedEntitiesExplorer.this.getEntityId(entity);\n            }\n\n            @Override\n            public String getTitle(final T entity) {\n                return UserAssignedEntitiesExplorer.this.getEntityName(entity);\n            }\n\n            @Override\n            public void onReadEntity(final String identifier) {\n                // Not allowed.\n            }\n\n            @Override\n            public void onRemoveEntity(final String identifier) {\n                if (identifier != null) {\n                    confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                                    UserAssignedEntitiesExplorer.this.getEnsureRemoveText(),\n                                    () -> removeEntity(identifier),\n                                    () -> {\n                                    });\n                }\n            }\n\n            @Override\n            public void onSelectEntity(final String identifier,\n                                       final boolean isSelected) {\n                // Entity selection not available for the explorer widget.\n            }\n\n            @Override\n            public void onChangePage(final int currentPage,\n                                     final int goToPage) {\n                // Do nothing by default, let the entitiesList paginate.\n            }\n        };\n    }\n\n    protected void open(final User user) {\n        assert user != null;\n        doShow();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedGroupsEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesModalEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.GroupsExplorer;\n\n/**\n * <p>Presenter class for user's assigned groups editor.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserAssignedGroupsEditor extends UserAssignedEntitiesEditor<Group> implements org.uberfire.ext.security.management.client.editor.user.UserAssignedGroupsEditor {\n\n    Event<OnUpdateUserGroupsEvent> updateUserGroupsEventEvent;\n\n    @Inject\n    public UserAssignedGroupsEditor(final ClientUserSystemManager userSystemManager,\n                                    final GroupsExplorer groupsExplorer,\n                                    final @AssignedEntitiesModalEditor AssignedEntitiesEditor<UserAssignedGroupsEditor> view,\n                                    final Event<OnUpdateUserGroupsEvent> updateUserGroupsEventEvent) {\n        super(userSystemManager,\n              groupsExplorer,\n              view);\n        this.updateUserGroupsEventEvent = updateUserGroupsEventEvent;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    protected String getCancelText() {\n        return UsersManagementWidgetsConstants.INSTANCE.cancel();\n    }\n\n    @Override\n    protected String getAddText() {\n        return UsersManagementWidgetsConstants.INSTANCE.addToSelectedGroups();\n    }\n\n    @Override\n    protected String getTitle() {\n        return UsersManagementWidgetsConstants.INSTANCE.groupSelectionFor();\n    }\n\n    @Override\n    protected String getEntityIdentifier(final Group entity) {\n        return entity.getName();\n    }\n\n    protected void open(final User user) {\n        assert user != null;\n        this.entities.addAll(user.getGroups());\n        entitiesExplorer.show(getViewContext());\n        super.open(user);\n    }\n\n    @Override\n    protected void onSave(Set<String> selectedEntities) {\n        super.onSave(selectedEntities);\n        if (selectedEntities != null && !selectedEntities.isEmpty()) {\n            for (final String name : selectedEntities) {\n                entities.add(userSystemManager.createGroup(name));\n            }\n        }\n\n        // Delegate the recently updated assigned groups for the user.\n        updateUserGroupsEventEvent.fire(new OnUpdateUserGroupsEvent(UserAssignedGroupsEditor.this,\n                                                                    selectedEntities));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedGroupsExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Iterator;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.GroupsList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\n\n/**\n * <p>Presenter class for user's assigned groups explorer widget.</p>\n * <p>It's considered an Editor due to it allows removing assigned user's groups.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserAssignedGroupsExplorer extends UserAssignedEntitiesExplorer<Group> implements IsWidget,\n                                                                                               org.uberfire.ext.security.management.client.editor.user.UserAssignedGroupsExplorer {\n\n    Event<OnRemoveUserGroupEvent> removeUserGroupEventEvent;\n\n    @Inject\n    public UserAssignedGroupsExplorer(final ClientUserSystemManager userSystemManager,\n                                      final ConfirmBox confirmBox,\n                                      final GroupsList groupList,\n                                      final AssignedEntitiesExplorer view,\n                                      final Event<OnRemoveUserGroupEvent> removeUserGroupEventEvent) {\n        super(userSystemManager,\n              confirmBox,\n              groupList,\n              view);\n        this.removeUserGroupEventEvent = removeUserGroupEventEvent;\n    }\n\n    @Override\n    protected String getEmptyText() {\n        return UsersManagementWidgetsConstants.INSTANCE.userHasNoGroups();\n    }\n\n    @Override\n    protected String getEntityType() {\n        return UsersManagementWidgetsConstants.INSTANCE.groupsAssigned();\n    }\n\n    @Override\n    protected String getTitle() {\n        return null;\n    }\n\n    @Override\n    protected String getEntityId(final Group entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEntityName(final Group entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEnsureRemoveText() {\n        return UsersManagementWidgetsConstants.INSTANCE.ensureRemoveGroupFromUser();\n    }\n\n    @Override\n    protected boolean canAssignEntities() {\n        final boolean canAssignGroups = userSystemManager.isUserCapabilityEnabled(Capability.CAN_ASSIGN_GROUPS);\n        return isEditMode && canAssignGroups;\n    }\n\n    @Override\n    protected void open(final User user) {\n        final Set<Group> userGroups = user.getGroups();\n        for (final Group group : userGroups) {\n            if (!userSystemManager.getConstrainedGroups().contains(group.getName())) {\n                this.entities.add(group);\n            }\n        }\n        super.open(user);\n    }\n\n    @Override\n    protected void doShow() {\n        entitiesList.show(this.entities,\n                          getCallback());\n    }\n\n    @Override\n    protected void removeEntity(String name) {\n        // Remove the group from the local cache.\n        Iterator<Group> groups = this.entities.iterator();\n        while (groups.hasNext()) {\n            final Group g = groups.next();\n            if (g.getName().equals(name)) {\n                groups.remove();\n            }\n        }\n\n        // Reload view.\n        doShow();\n\n        // Fire the event for any others components listening.\n        removeUserGroupEventEvent.fire(new OnRemoveUserGroupEvent(UserAssignedGroupsExplorer.this,\n                                                                  name));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedRolesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesModalEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.RolesExplorer;\n\n/**\n * <p>Presenter class for user's assigned roles editor.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserAssignedRolesEditor extends UserAssignedEntitiesEditor<Role> implements org.uberfire.ext.security.management.client.editor.user.UserAssignedRolesEditor {\n\n    Event<OnUpdateUserRolesEvent> updateUserRolesEvent;\n\n    @Inject\n    public UserAssignedRolesEditor(final ClientUserSystemManager userSystemManager,\n                                   final RolesExplorer rolesExplorer,\n                                   final @AssignedEntitiesModalEditor AssignedEntitiesEditor<UserAssignedRolesEditor> view,\n                                   final Event<OnUpdateUserRolesEvent> updateUserRolesEvent) {\n        super(userSystemManager,\n              rolesExplorer,\n              view);\n        this.updateUserRolesEvent = updateUserRolesEvent;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    protected String getCancelText() {\n        return UsersManagementWidgetsConstants.INSTANCE.cancel();\n    }\n\n    @Override\n    protected String getAddText() {\n        return UsersManagementWidgetsConstants.INSTANCE.addToSelectedRoles();\n    }\n\n    @Override\n    protected String getTitle() {\n        return UsersManagementWidgetsConstants.INSTANCE.roleSelectionFor();\n    }\n\n    @Override\n    protected String getEntityIdentifier(final Role entity) {\n        return entity.getName();\n    }\n\n    protected void open(final User user) {\n        assert user != null;\n        this.entities.addAll(user.getRoles());\n        entitiesExplorer.show(getViewContext());\n        super.open(user);\n    }\n\n    @Override\n    protected void onSave(Set<String> selectedEntities) {\n        super.onSave(selectedEntities);\n        if (selectedEntities != null && !selectedEntities.isEmpty()) {\n            for (final String name : selectedEntities) {\n                entities.add(userSystemManager.createRole(name));\n            }\n        }\n\n        // Delegate the recently updated assigned roles for the user.\n        updateUserRolesEvent.fire(new OnUpdateUserRolesEvent(UserAssignedRolesEditor.this,\n                                                             selectedEntities));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedRolesExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Iterator;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.RolesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\n\n/**\n * <p>Presenter class for user's assigned roles explorer widget.</p>\n * <p>It's considered an Editor due to it allows removing assigned user's roles.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserAssignedRolesExplorer extends UserAssignedEntitiesExplorer<Role> implements org.uberfire.ext.security.management.client.editor.user.UserAssignedRolesExplorer {\n\n    Event<OnRemoveUserRoleEvent> removeUserRoleEvent;\n\n    @Inject\n    public UserAssignedRolesExplorer(final ClientUserSystemManager userSystemManager,\n                                     final ConfirmBox confirmBox,\n                                     final RolesList rolesList,\n                                     final AssignedEntitiesExplorer view,\n                                     final Event<OnRemoveUserRoleEvent> removeUserRoleEvent) {\n        super(userSystemManager,\n              confirmBox,\n              rolesList,\n              view);\n        this.removeUserRoleEvent = removeUserRoleEvent;\n    }\n\n    @Override\n    protected String getEmptyText() {\n        return UsersManagementWidgetsConstants.INSTANCE.userHasNoRoles();\n    }\n\n    @Override\n    protected String getEntityType() {\n        return UsersManagementWidgetsConstants.INSTANCE.rolesAssigned();\n    }\n\n    @Override\n    protected String getTitle() {\n        return null;\n    }\n\n    @Override\n    protected String getEntityId(final Role entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEntityName(final Role entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEnsureRemoveText() {\n        return UsersManagementWidgetsConstants.INSTANCE.ensureRemoveRoleFromUser();\n    }\n\n    @Override\n    protected boolean canAssignEntities() {\n        final boolean canAssignRoles = userSystemManager.isUserCapabilityEnabled(Capability.CAN_ASSIGN_ROLES);\n        return isEditMode && canAssignRoles;\n    }\n\n    @Override\n    protected void open(final User user) {\n        final Set<Role> uRoles = user.getRoles();\n        for (final Role _role : uRoles) {\n            this.entities.add(_role);\n        }\n        super.open(user);\n    }\n\n    @Override\n    protected void doShow() {\n        entitiesList.show(this.entities,\n                          getCallback());\n    }\n\n    @Override\n    protected void removeEntity(String name) {\n        // Remove the role from the local cache.\n        Iterator<Role> roles = this.entities.iterator();\n        while (roles.hasNext()) {\n            final Role g = roles.next();\n            if (g.getName().equals(name)) {\n                roles.remove();\n            }\n        }\n\n        // Reload view.\n        doShow();\n\n        // Fire the event for any others components listening.\n        removeUserRoleEvent.fire(new OnRemoveUserRoleEvent(UserAssignedRolesExplorer.this,\n                                                           name));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAttributesEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Map.Entry;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.EditTextCell;\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwt.user.client.ui.HasHorizontalAlignment;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.ListDataProvider;\nimport com.google.gwt.view.client.ProvidesKey;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\n\n/**\n * <p>Presenter class for user editor attributes widget.</p>\n */\n@Dependent\npublic class UserAttributesEditor implements IsWidget,\n                                             org.uberfire.ext.security.management.client.editor.user.UserAttributesEditor {\n\n    /**\n     * The provider that holds the list of containers.\n     */\n    final ListDataProvider<Entry<String, String>> userAttributesProvider = new ListDataProvider<Entry<String, String>>();\n    final ProvidesKey<Entry<String, String>> KEY_PROVIDER = new ProvidesKey<Map.Entry<String, String>>() {\n        @Override\n        public Object getKey(final Map.Entry<String, String> item) {\n            return item == null ? null : item.getKey();\n        }\n    };\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    ConfirmBox confirmBox;\n    Event<CreateUserAttributeEvent> createUserAttributeEventEvent;\n    Event<UpdateUserAttributeEvent> updateUserAttributeEventEvent;\n    Event<DeleteUserAttributeEvent> deleteUserAttributeEventEvent;\n    Event<OnErrorEvent> errorEvent;\n    NewUserAttributeEditor newUserAttributeEditor;\n    Map<UserManager.UserAttribute, String> attributes;\n    private final FieldUpdater keyModifiedEventHandler = new FieldUpdater<Entry<String, String>, String>() {\n        @Override\n        public void update(final int index,\n                           final Entry<String, String> object,\n                           final String value) {\n            final String k = object != null ? object.getKey() : null;\n            if (hasValueChanged(k,\n                                value)) {\n                updateUserAttribute(index,\n                                    value,\n                                    object != null ? object.getValue() : null);\n            }\n        }\n    };\n    private final FieldUpdater valueModifiedEventHandler = new FieldUpdater<Entry<String, String>, String>() {\n        @Override\n        public void update(final int index,\n                           final Entry<String, String> object,\n                           final String value) {\n            final String k = object != null ? object.getValue() : null;\n            if (hasValueChanged(k,\n                                value)) {\n                updateUserAttribute(index,\n                                    object != null ? object.getKey() : null,\n                                    value);\n            }\n        }\n    };\n    private final FieldUpdater removeButtonHandler = new FieldUpdater<Entry<String, String>, String>() {\n        @Override\n        public void update(final int index,\n                           final Entry<String, String> object,\n                           final String value) {\n            if (value == null) {\n                // Attribute is mandatory and cannot be removed.\n                errorEvent\n                        .fire(new OnErrorEvent(UserAttributesEditor.this,\n                                               new SecurityManagementException(UsersManagementWidgetsConstants.INSTANCE.attributeIsMandatory())));\n            } else {\n                confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                                UsersManagementWidgetsConstants.INSTANCE.ensureRemoveAttribute(),\n                                () -> removeUserAttribute(index,\n                                                          object),\n                                () -> {\n                                });\n            }\n        }\n    };\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n    boolean isEditMode;\n\n    @Inject\n    public UserAttributesEditor(final ClientUserSystemManager userSystemManager,\n                                final ConfirmBox confirmBox,\n                                final Event<CreateUserAttributeEvent> createUserAttributeEventEvent,\n                                final Event<UpdateUserAttributeEvent> updateUserAttributeEventEvent,\n                                final Event<DeleteUserAttributeEvent> deleteUserAttributeEventEvent,\n                                final Event<OnErrorEvent> errorEvent,\n                                final NewUserAttributeEditor newUserAttributeEditor,\n                                final View view) {\n        this.userSystemManager = userSystemManager;\n        this.confirmBox = confirmBox;\n        this.createUserAttributeEventEvent = createUserAttributeEventEvent;\n        this.updateUserAttributeEventEvent = updateUserAttributeEventEvent;\n        this.deleteUserAttributeEventEvent = deleteUserAttributeEventEvent;\n        this.errorEvent = errorEvent;\n        this.newUserAttributeEditor = newUserAttributeEditor;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(newUserAttributeEditor.view);\n        buildViewColumns();\n    }\n\n    @Override\n    public void show(final User user) {\n        this.isEditMode = false;\n        open(user);\n    }\n\n    @Override\n    public void edit(final User user) {\n        this.isEditMode = true;\n        open(user);\n    }\n\n    @Override\n    public void flush() {\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    @Override\n    public Map<String, String> getValue() {\n        final Map<String, String> result = new HashMap<String, String>(attributes.size());\n        for (Map.Entry<UserManager.UserAttribute, String> entry : attributes.entrySet()) {\n            result.put(entry.getKey().getName(),\n                       entry.getValue());\n        }\n        return result;\n    }\n\n    /*  ******************************************************************************************************\n                                 VIEW CALLBACKS \n     ****************************************************************************************************** */\n\n    @Override\n    public void setViolations(Set<ConstraintViolation<User>> constraintViolations) {\n        //  Currently no violations expected.\n    }\n\n    public void clear() {\n        userAttributesProvider.getList().clear();\n        attributes = null;\n        isEditMode = false;\n    }\n\n\n\n    /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /**\n     * View callback for getting the list.\n     */\n    void addDataDisplay(HasData<Entry<String, String>> display) {\n        userAttributesProvider.addDataDisplay(display);\n    }\n\n    protected void loadUserAttributes(final User user) {\n        final Map<String, String> properties = user.getProperties();\n        if (properties != null) {\n            final Map<UserManager.UserAttribute, String> _properties = new HashMap<UserManager.UserAttribute, String>(properties.size());\n            for (final Map.Entry<String, String> entry : properties.entrySet()) {\n                final String name = entry.getKey();\n                UserManager.UserAttribute attribute = getSupportedAttribute(name);\n                final String value = entry.getValue();\n                if (attribute != null) {\n                    _properties.put(attribute,\n                                    value);\n                }\n            }\n            this.attributes = _properties;\n        }\n    }\n\n    protected UserManager.UserAttribute getSupportedAttribute(final String name) {\n        UserManager.UserAttribute attribute = userSystemManager.getUserSupportedAttribute(name);\n        if (attribute == null) {\n            attribute = userSystemManager.createUserAttribute(name,\n                                                              false,\n                                                              true,\n                                                              null);\n        }\n        return attribute;\n    }\n\n    protected void open(final User user) {\n\n        // User attributes editor settings.\n        newUserAttributeEditor.clear().showAddButton();\n        view.setCanCreate(canManageAttributes());\n\n        // User load.\n        if (user != null) {\n            loadUserAttributes(user);\n            redraw();\n        }\n    }\n\n    protected void redraw() {\n        userAttributesProvider.getList().clear();\n        buildViewColumns();\n        if (attributes != null) {\n            for (final Map.Entry<UserManager.UserAttribute, String> entry : attributes.entrySet()) {\n                final UserManager.UserAttribute attribute = entry.getKey();\n                final String value = entry.getValue();\n                final Map.Entry<String, String> attrEntry = createAttributeEntry(attribute.getName(),\n                                                                                 value);\n                addAttributeEntry(attrEntry);\n            }\n            view.redraw();\n        } else {\n            view.showEmpty();\n        }\n    }\n\n    protected void addAttributeEntry(final Map.Entry<String, String> entry) {\n        List<Map.Entry<String, String>> contacts = userAttributesProvider.getList();\n        contacts.remove(entry);\n        contacts.add(entry);\n    }\n\n    boolean canManageAttributes() {\n        if (!isEditMode) {\n            return false;\n        }\n        final boolean canManageAttrs = userSystemManager.isUserCapabilityEnabled(Capability.CAN_MANAGE_ATTRIBUTES);\n        return canManageAttrs;\n    }\n\n    protected void buildViewColumns() {\n        int columnCount = view.getColumnCount();\n        while (columnCount > 0) {\n            view.removeColumn(0);\n            columnCount = view.getColumnCount();\n        }\n\n        // Attach a column sort handler to the ListDataProvider to sort the list.\n        ColumnSortEvent.ListHandler<Map.Entry<String, String>> sortHandler = new ColumnSortEvent.ListHandler<Map.Entry<String, String>>(userAttributesProvider.getList());\n        view.setColumnSortHandler(sortHandler);\n\n        // Attribute name.\n        final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> keyColumn = createAttributeNameColumn(sortHandler);\n        if (keyColumn != null) {\n            view.addColumn(keyColumn,\n                           UsersManagementWidgetsConstants.INSTANCE.name());\n        }\n\n        // Attribute value.\n        final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> valueColumn = createAttributeValueColumn(sortHandler);\n        if (valueColumn != null) {\n            view.addColumn(valueColumn,\n                           UsersManagementWidgetsConstants.INSTANCE.value());\n        }\n\n        // Create remove button column.\n        final com.google.gwt.user.cellview.client.Column<Map.Entry<String, String>, String> removeColumn = createAttributeRemoveColumn();\n        if (removeColumn != null) {\n            view.addColumn(removeColumn,\n                           UsersManagementWidgetsConstants.INSTANCE.remove());\n        }\n    }\n\n    protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeNameColumn(ColumnSortEvent.ListHandler<Entry<String, String>> sortHandler) {\n        // Attribute name.\n        final Cell<String> nameCell = canManageAttributes() ? new EditTextCell() : new TextCell();\n        final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> keyColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(\n                nameCell) {\n            @Override\n            public String getValue(final Entry<String, String> object) {\n                return object.getKey() != null ? object.getKey() : \"\";\n            }\n        };\n        keyColumn.setSortable(true);\n        sortHandler.setComparator(keyColumn,\n                                  new Comparator<Entry<String, String>>() {\n                                      @Override\n                                      public int compare(Entry<String, String> o1,\n                                                         Entry<String, String> o2) {\n                                          return o1.getKey().compareTo(o2.getKey());\n                                      }\n                                  });\n        keyColumn.setFieldUpdater(canManageAttributes() ? keyModifiedEventHandler : null);\n\n        return keyColumn;\n    }\n\n    protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeValueColumn(ColumnSortEvent.ListHandler<Entry<String, String>> sortHandler) {\n        // Attribute value.\n        final Cell<String> valueCell = canManageAttributes() ? new EditTextCell() : new TextCell();\n        final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> valueColumn = new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(\n                valueCell) {\n            @Override\n            public String getValue(final Entry<String, String> object) {\n                return object.getValue() != null ? object.getValue() : \"\";\n            }\n        };\n        valueColumn.setSortable(true);\n        sortHandler.setComparator(valueColumn,\n                                  new Comparator<Entry<String, String>>() {\n                                      @Override\n                                      public int compare(Entry<String, String> o1,\n                                                         Entry<String, String> o2) {\n                                          return o1.getValue().compareTo(o2.getValue());\n                                      }\n                                  });\n        valueColumn.setFieldUpdater(canManageAttributes() ? valueModifiedEventHandler : null);\n\n        return valueColumn;\n    }\n\n    protected com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> createAttributeRemoveColumn() {\n        // On read mode, remove button not present.\n        if (!canManageAttributes()) {\n            return null;\n        }\n\n        // Create remove button column.\n        final ButtonCell removeButtonCell = new ButtonCell(IconType.CLOSE,\n                                                           ButtonType.LINK,\n                                                           ButtonSize.SMALL);\n        final com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> removeColumn =\n                new com.google.gwt.user.cellview.client.Column<Entry<String, String>, String>(removeButtonCell) {\n\n                    @Override\n                    public String getValue(final Entry<String, String> object) {\n                        // if can be removed return empty string, if not, return null\n                        if (object != null) {\n                            final UserManager.UserAttribute attribute = getAttribute(object.getKey());\n                            if (attribute != null && !attribute.isMandatory() && attribute.isEditable()) {\n                                removeButtonCell.setEnabled(true);\n                                return \"\";\n                            }\n                        }\n                        removeButtonCell.setEnabled(false);\n                        return null;\n                    }\n                };\n\n        removeColumn.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);\n        removeColumn.setFieldUpdater(canManageAttributes() ? removeButtonHandler : null);\n\n        return removeColumn;\n    }\n\n    private UserManager.UserAttribute getAttribute(final String name) {\n        if (!isEmpty(name) && attributes != null && !attributes.isEmpty()) {\n            for (final Map.Entry<UserManager.UserAttribute, String> entry : attributes.entrySet()) {\n                final UserManager.UserAttribute attribute = entry.getKey();\n                if (name.equals(attribute.getName())) {\n                    return attribute;\n                }\n            }\n        }\n        return null;\n    }\n\n    private Map.Entry<String, String> createAttributeEntry(final String key,\n                                                           final String value) {\n        return new Map.Entry<String, String>() {\n            @Override\n            public String getKey() {\n                return key;\n            }\n\n            @Override\n            public String getValue() {\n                return value;\n            }\n\n            @Override\n            public String setValue(String value) {\n                return null;\n            }\n        };\n    }\n\n    private boolean hasValueChanged(final String s1,\n                                    final String s2) {\n        if (s1 != null && !s1.equals(s2)) {\n            return true;\n        }\n        if (s2 != null && !s2.equals(s1)) {\n            return true;\n        }\n        return false;\n    }\n\n    private boolean isEmpty(final String str) {\n        return str == null || str.trim().length() == 0;\n    }\n\n    void updateUserAttribute(final int index,\n                             final String key,\n                             final String value) {\n        final Entry<String, String> attr = createAttributeEntry(key,\n                                                                value);\n        UserManager.UserAttribute attribute = getAttribute(key);\n        attributes.put(attribute,\n                       value);\n        redraw();\n        updateUserAttributeEventEvent.fire(new UpdateUserAttributeEvent(UserAttributesEditor.this,\n                                                                        attr));\n    }\n\n    void removeUserAttribute(final int index,\n                             final Entry<String, String> entry) {\n        UserManager.UserAttribute attribute = getAttribute(entry.getKey());\n        attributes.remove(attribute);\n        redraw();\n        deleteUserAttributeEventEvent.fire(new DeleteUserAttributeEvent(UserAttributesEditor.this,\n                                                                        entry));\n    }\n\n    void onAttributeCreated(@Observes final CreateUserAttributeEvent createUserAttributeEvent) {\n        final Entry<String, String> entry = createUserAttributeEvent.getAttribute();\n        final String name = entry.getKey();\n        final String value = entry.getValue();\n        UserManager.UserAttribute attribute = getSupportedAttribute(name);\n        attributes.put(attribute,\n                       value);\n        redraw();\n    }\n\n    public interface View extends UberView<UserAttributesEditor> {\n\n        View initWidgets(NewUserAttributeEditor.View newUserAttributeEditorView);\n\n        View setCanCreate(boolean isCreateAllowed);\n\n        View setColumnSortHandler(ColumnSortEvent.ListHandler<Map.Entry<String, String>> sortHandler);\n\n        View addColumn(com.google.gwt.user.cellview.client.Column<Entry<String, String>, String> column,\n                       String name);\n\n        View removeColumn(int index);\n\n        int getColumnCount();\n\n        View showEmpty();\n\n        View redraw();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAttributesEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwt.user.cellview.client.SimplePager;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.DefaultSelectionEventManager;\nimport com.google.gwt.view.client.MultiSelectionModel;\nimport com.google.gwt.view.client.SelectionModel;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.gwt.CellTable;\n\n@Dependent\npublic class UserAttributesEditorView extends Composite implements UserAttributesEditor.View {\n\n    private static UserAttributesEditorViewBinder uiBinder = GWT.create(UserAttributesEditorViewBinder.class);\n    @UiField\n    Row userEmptyAttributesRow;\n    @UiField\n    FlowPanel newUserAttributePanel;\n    @UiField(provided = true)\n    NewUserAttributeEditor.View newUserAttributeView;\n    @UiField\n    Row userAttributesRow;\n    @UiField(provided = true)\n    CellTable attributesGrid;\n    @UiField(provided = true)\n    SimplePager attributesGridPager;\n    private UserAttributesEditor presenter;\n\n    @Override\n    public void init(final UserAttributesEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public UserAttributesEditor.View initWidgets(NewUserAttributeEditor.View newUserAttributeEditorView) {\n        this.newUserAttributeView = newUserAttributeEditorView;\n\n        // Init the image list grid.\n        attributesGrid = new CellTable<Map.Entry<String, String>>(presenter.KEY_PROVIDER);\n        attributesGrid.setWidth(\"100%\",\n                                true);\n\n        // Do not refresh the headers and footers every time the data is updated.\n        attributesGrid.setAutoHeaderRefreshDisabled(true);\n        attributesGrid.setAutoFooterRefreshDisabled(true);\n\n        // Create a Pager to control the table.\n        SimplePager.Resources pagerResources = GWT.create(SimplePager.Resources.class);\n        attributesGridPager = new SimplePager(SimplePager.TextLocation.CENTER,\n                                              pagerResources,\n                                              false,\n                                              0,\n                                              true);\n        attributesGridPager.setDisplay(attributesGrid);\n\n        // Add a selection model so we can select cells.\n        final SelectionModel<Map.Entry<String, String>> selectionModel = new MultiSelectionModel<Map.Entry<String, String>>(presenter.KEY_PROVIDER);\n        attributesGrid.setSelectionModel(selectionModel,\n                                         DefaultSelectionEventManager.<Map.Entry<String, String>>createCheckboxManager());\n\n        presenter.addDataDisplay(attributesGrid);\n\n        // Bind this view and initialize the widget.\n        initWidget(uiBinder.createAndBindUi(this));\n\n        return this;\n    }\n\n    @Override\n    public UserAttributesEditor.View setCanCreate(boolean isCreateAllowed) {\n        newUserAttributePanel.setVisible(isCreateAllowed);\n        return this;\n    }\n\n    @Override\n    public UserAttributesEditor.View setColumnSortHandler(ColumnSortEvent.ListHandler<Map.Entry<String, String>> sortHandler) {\n        attributesGrid.addColumnSortHandler(sortHandler);\n        return this;\n    }\n\n    @Override\n    public UserAttributesEditor.View addColumn(Column<Map.Entry<String, String>, String> column,\n                                               String name) {\n        attributesGrid.addColumn(column,\n                                 name);\n        attributesGrid.setColumnWidth(column,\n                                      5,\n                                      Style.Unit.PCT);\n        return this;\n    }\n\n    @Override\n    public UserAttributesEditor.View removeColumn(int index) {\n        attributesGrid.removeColumn(index);\n        return this;\n    }\n\n    @Override\n    public int getColumnCount() {\n        return attributesGrid.getColumnCount();\n    }\n\n    @Override\n    public UserAttributesEditor.View showEmpty() {\n        userAttributesRow.setVisible(false);\n        userEmptyAttributesRow.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public UserAttributesEditor.View redraw() {\n        attributesGrid.redraw();\n        return this;\n    }\n\n    interface UserAttributesEditorViewBinder\n            extends\n            UiBinder<Widget, UserAttributesEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAttributesEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bgwt=\"urn:import:org.gwtbootstrap3.client.ui.gwt\"\n             xmlns:gcell=\"urn:import:com.google.gwt.user.cellview.client\"\n             xmlns:user-editor=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.editor.user\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .attributesGrid {\n      width: 200px;\n      height: 200px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <b:Row>\n      <b:Column size=\"MD_12\" >\n        <b:Heading size=\"H3\" text=\"{i18n.userAttributes}\"/>\n      </b:Column>\n    </b:Row>\n\n    <g:FlowPanel ui:field=\"newUserAttributePanel\">\n      <user-editor:NewUserAttributeEditor.View ui:field=\"newUserAttributeView\"/>\n    </g:FlowPanel>\n\n    <b:Row ui:field=\"userEmptyAttributesRow\" visible=\"false\">\n      <b:Column size=\"MD_12\" >\n        <b:Label text=\"{i18n.userHasNoAttributes}\" type=\"INFO\"/>\n      </b:Column>\n    </b:Row>\n    \n    <b:Row ui:field=\"userAttributesRow\">\n      <b:Column size=\"MD_12\" >\n        <g:VerticalPanel>\n          <bgwt:CellTable ui:field=\"attributesGrid\" bordered=\"true\" condensed=\"true\" striped=\"true\" hover=\"true\" addStyleNames=\"{style.attributesGrid}\"/>\n          <gcell:SimplePager ui:field=\"attributesGridPager\" />\n        </g:VerticalPanel>\n      </b:Column>\n    </b:Row>\n\n  </b:Container>\n  \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserEditor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.validation.ConstraintViolation;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ContextualEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\n\n/**\n * <p>The user editor presenter.</p>\n * <p>User's groups are edited using the UserAssignedGroupsExplorer editor component. So the UserAssignedGroupsEditor works with a dummy user instance.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserEditor implements IsWidget,\n                                   org.uberfire.ext.security.management.client.editor.user.UserEditor {\n\n    public View view;\n    ClientUserSystemManager userSystemManager;\n    UserAttributesEditor userAttributesEditor;\n    UserAssignedGroupsExplorer userAssignedGroupsExplorer;\n    UserAssignedGroupsEditor userAssignedGroupsEditor;\n    UserAssignedRolesExplorer userAssignedRolesExplorer;\n    UserAssignedRolesEditor userAssignedRolesEditor;\n    ACLViewer aclViewer;\n    Event<OnEditEvent> onEditEvent;\n    Event<OnShowEvent> onShowEvent;\n    Event<OnDeleteEvent> onDeleteEvent;\n    Event<OnChangePasswordEvent> onChangePasswordEvent;\n    User user;\n    boolean isEditMode;\n    @Inject\n    public UserEditor(final ClientUserSystemManager userSystemManager,\n                      final UserAttributesEditor userAttributesEditor,\n                      final UserAssignedGroupsExplorer userAssignedGroupsExplorer,\n                      final UserAssignedGroupsEditor userAssignedGroupsEditor,\n                      final UserAssignedRolesExplorer userAssignedRolesExplorer,\n                      final UserAssignedRolesEditor userAssignedRolesEditor,\n                      final ACLViewer aclViewer,\n                      final Event<OnEditEvent> onEditEvent,\n                      final Event<OnShowEvent> onShowEvent,\n                      final Event<OnDeleteEvent> onDeleteEvent,\n                      final Event<OnChangePasswordEvent> onChangePasswordEvent,\n                      final View view) {\n\n        this.userSystemManager = userSystemManager;\n        this.userAttributesEditor = userAttributesEditor;\n        this.userAssignedGroupsExplorer = userAssignedGroupsExplorer;\n        this.userAssignedGroupsEditor = userAssignedGroupsEditor;\n        this.userAssignedRolesExplorer = userAssignedRolesExplorer;\n        this.userAssignedRolesEditor = userAssignedRolesEditor;\n        this.aclViewer = aclViewer;\n        this.onEditEvent = onEditEvent;\n        this.onShowEvent = onShowEvent;\n        this.onDeleteEvent = onDeleteEvent;\n        this.onChangePasswordEvent = onChangePasswordEvent;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        view.initWidgets(userAttributesEditor.view,\n                         userAssignedGroupsExplorer.view,\n                         userAssignedGroupsEditor.view,\n                         userAssignedRolesExplorer.view,\n                         userAssignedRolesEditor.view,\n                         aclViewer);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    /*  ******************************************************************************************************\n                                     PUBLIC PRESENTER API \n         ****************************************************************************************************** */\n\n    @Override\n    public String identifier() {\n        // Identifier is not editable, no need for any editor.\n        return user.getIdentifier();\n    }\n\n    @Override\n    public UserAttributesEditor attributesEditor() {\n        return userAttributesEditor;\n    }\n\n    @Override\n    public UserAssignedGroupsExplorer groupsExplorer() {\n        return userAssignedGroupsExplorer;\n    }\n\n    @Override\n    public org.uberfire.ext.security.management.client.editor.user.UserAssignedRolesExplorer rolesExplorer() {\n        return userAssignedRolesExplorer;\n    }\n\n    public UserAssignedGroupsEditor groupsEditor() {\n        return userAssignedGroupsEditor;\n    }\n\n    public UserAssignedRolesEditor rolesEditor() {\n        return userAssignedRolesEditor;\n    }\n\n    @Override\n    public void show(final User user) {\n        clear();\n        this.isEditMode = false;\n        aclViewer.show(user);\n        open(user);\n        onShowEvent.fire(new OnShowEvent(UserEditor.this,\n                                         user));\n    }\n\n    @Override\n    public void edit(final User user) {\n        clear();\n        this.isEditMode = true;\n        open(user);\n    }\n\n    @Override\n    public void flush() {\n        assert user != null;\n        assert isEditMode;\n        // No additional flush logic to perform here.\n    }\n\n    @Override\n    public User getValue() {\n        return user;\n    }\n\n    @Override\n    public void setViolations(final Set<ConstraintViolation<User>> violations) {\n        //  Currently no violations expected.\n    }\n\n    public void clear() {\n        isEditMode = false;\n        user = null;\n        userAttributesEditor.clear();\n        userAssignedGroupsExplorer.clear();\n        userAssignedGroupsEditor.clear();\n        userAssignedRolesExplorer.clear();\n    }\n\n    public UserEditor setEditButtonVisible(boolean isVisible) {\n        view.setEditButtonVisible(isVisible);\n        return this;\n    }\n\n    public UserEditor setDeleteButtonVisible(boolean isVisible) {\n        view.setDeleteButtonVisible(isVisible);\n        return this;\n    }\n\n    public UserEditor setChangePasswordButtonVisible(boolean isVisible) {\n        view.setChangePasswordButtonVisible(isVisible);\n        return this;\n    }\n\n    public UserEditor setAttributesEditorVisible(boolean isVisible) {\n        view.setAttributesEditorVisible(isVisible);\n        return this;\n    }\n\n    public UserEditor setAddToGroupsButtonVisible(boolean isVisible) {\n        view.setAddToGroupsButtonVisible(isVisible);\n        return this;\n    }\n\n    public UserEditor setPermissionsVisible(boolean isVisible) {\n        view.setPermissionsVisible(isVisible);\n        return this;\n    }\n\n    public ACLViewer getACLViewer() {\n        return aclViewer;\n    }\n\n    void onEdit() {\n        onEditEvent.fire(new OnEditEvent(UserEditor.this,\n                                         user));\n    }\n\n    /*  ******************************************************************************************************\n                                 VIEW CALLBACKS \n     ****************************************************************************************************** */\n\n    void onDelete() {\n        onDeleteEvent.fire(new OnDeleteEvent(UserEditor.this,\n                                             user));\n    }\n\n    void onChangePassword() {\n        onChangePasswordEvent.fire(new OnChangePasswordEvent(UserEditor.this,\n                                                             user));\n    }\n\n    void onAssignGroups() {\n\n        final User dummyUser = new UserImpl(user.getIdentifier(),\n                                            userAssignedRolesExplorer.getValue(),\n                                            userAssignedGroupsExplorer.getValue(),\n                                            user.getProperties());\n\n        if (isEditMode) {\n            userAssignedGroupsEditor.edit(dummyUser);\n        } else {\n            userAssignedGroupsEditor.show(dummyUser);\n        }\n    }\n\n    void onAssignRoles() {\n\n        final User dummyUser = new UserImpl(user.getIdentifier(),\n                                            userAssignedRolesExplorer.getValue(),\n                                            userAssignedGroupsExplorer.getValue(),\n                                            user.getProperties());\n\n        if (isEditMode) {\n            userAssignedRolesEditor.edit(dummyUser);\n        } else {\n            userAssignedRolesEditor.show(dummyUser);\n        }\n    }\n\n    protected void open(final User user) {\n        assert user != null;\n        this.user = user;\n\n        // User identifier.\n        final String id = user.getIdentifier();\n        view.setUsername(id);\n\n        // Edit mode & Capabilities.\n        final boolean canUpdate = canUpdate();\n        final boolean canDelete = canDelete();\n        final boolean canManageAttributes = canManageAttributes();\n        final boolean canChangePwd = canChangePassword();\n        final boolean canAssignGroups = canAssignGroups();\n        final boolean canAssignRoles = canAssignRoles();\n        final boolean hasAttributes = user.getProperties() != null && !user.getProperties().isEmpty();\n        final boolean shouldHideAttributesEditor = !canManageAttributes && !hasAttributes;\n        view.setEditButtonVisible(!isEditMode && canUpdate);\n        view.setDeleteButtonVisible(isEditMode && canDelete);\n        view.setChangePasswordButtonVisible(isEditMode && canChangePwd);\n        view.setAddToGroupsButtonVisible(isEditMode && canAssignGroups);\n        view.setAddToRolesButtonVisible(isEditMode && canAssignRoles);\n        view.setAttributesEditorVisible(!shouldHideAttributesEditor);\n    }\n    \n     /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    boolean canUpdate() {\n        final boolean canUpdate = userSystemManager.isUserCapabilityEnabled(Capability.CAN_UPDATE_USER);\n        return canUpdate;\n    }\n\n    boolean canDelete() {\n        final boolean canDelete = userSystemManager.isUserCapabilityEnabled(Capability.CAN_DELETE_USER);\n        return canDelete;\n    }\n\n    public boolean canAssignGroups() {\n        final boolean canAssignGroups = userSystemManager.isUserCapabilityEnabled(Capability.CAN_ASSIGN_GROUPS);\n        return canAssignGroups;\n    }\n\n    public boolean canAssignRoles() {\n        final boolean canAssignRoles = userSystemManager.isUserCapabilityEnabled(Capability.CAN_ASSIGN_ROLES);\n        return canAssignRoles;\n    }\n\n    boolean canChangePassword() {\n        final boolean canChangePassword = userSystemManager.isUserCapabilityEnabled(Capability.CAN_CHANGE_PASSWORD);\n        return canChangePassword;\n    }\n\n    boolean canManageAttributes() {\n        final boolean canManageAttributes = userSystemManager.isUserCapabilityEnabled(Capability.CAN_MANAGE_ATTRIBUTES);\n        return canManageAttributes;\n    }\n\n    void onOnUserGroupsUpdatedEvent(@Observes final OnUpdateUserGroupsEvent onUpdateUserGroupsEvent) {\n        if (checkEventContext(onUpdateUserGroupsEvent,\n                              userAssignedGroupsEditor)) {\n            userAssignedGroupsEditor.flush();\n            final Set<Group> groups = userAssignedGroupsEditor.getValue();\n            userAssignedGroupsExplorer.getValue().clear();\n            userAssignedGroupsExplorer.getValue().addAll(groups);\n            userAssignedGroupsExplorer.doShow();\n        }\n    }\n\n    void onOnUserRolesUpdatedEvent(@Observes final OnUpdateUserRolesEvent onUpdateUserRolesEvent) {\n        if (checkEventContext(onUpdateUserRolesEvent,\n                              userAssignedRolesEditor)) {\n            userAssignedRolesEditor.flush();\n            final Set<Role> roles = userAssignedRolesEditor.getValue();\n            userAssignedRolesExplorer.getValue().clear();\n            userAssignedRolesExplorer.getValue().addAll(roles);\n            userAssignedRolesExplorer.doShow();\n        }\n    }\n\n    private boolean checkEventContext(final ContextualEvent contextualEvent,\n                                      final Object context) {\n        return contextualEvent != null && contextualEvent.getContext() != null && contextualEvent.getContext().equals(context);\n    }\n\n    public interface View extends UberView<UserEditor> {\n\n        View initWidgets(UserAttributesEditor.View userAttributesEditorView,\n                         AssignedEntitiesExplorer userAssignedGroupsExplorerView,\n                         AssignedEntitiesEditor userAssignedGroupsEditorView,\n                         AssignedEntitiesExplorer userAssignedRolesExplorerView,\n                         AssignedEntitiesEditor userAssignedRolesEditorView,\n                         ACLViewer aclViewer);\n\n        View setUsername(String username);\n\n        View setEditButtonVisible(boolean isVisible);\n\n        View setDeleteButtonVisible(boolean isVisible);\n\n        View setChangePasswordButtonVisible(boolean isVisible);\n\n        View setAddToGroupsButtonVisible(boolean isVisible);\n\n        View setAddToRolesButtonVisible(boolean isVisible);\n\n        View setAttributesEditorVisible(boolean isVisible);\n\n        View setPermissionsVisible(boolean isVisible);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserEditorView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.TabContent;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\n\npublic class UserEditorView extends Composite implements UserEditor.View {\n\n    private static UserEditorViewBinder uiBinder = GWT.create(UserEditorViewBinder.class);\n    @UiField\n    FlowPanel mainPanel;\n    @UiField\n    Row userTitleRow;\n    @UiField\n    Heading userTitle;\n    @UiField\n    Button editButton;\n    @UiField\n    Button deleteButton;\n    @UiField\n    Row userAttributesRow;\n    @UiField(provided = true)\n    UserAttributesEditor.View userAttributesEditorView;\n    @UiField\n    TabListItem groupsTabItem;\n    @UiField\n    TabListItem rolesTabItem;\n    @UiField\n    TabListItem permissionsTabItem;\n    @UiField\n    TabContent tabContent;\n    @UiField\n    TabPane groupsTabPane;\n    @UiField\n    TabPane rolesTabPane;\n    @UiField\n    TabPane permissionsTabPane;\n    @UiField\n    Button addToGroupsButton;\n    @UiField(provided = true)\n    AssignedEntitiesExplorer userAssignedGroupsExplorerView;\n    @UiField\n    Button changePasswordButton;\n    @UiField(provided = true)\n    AssignedEntitiesEditor userAssignedGroupsEditorView;\n    @UiField(provided = true)\n    AssignedEntitiesEditor userAssignedRolesEditorView;\n    @UiField\n    Button addToRolesButton;\n    @UiField(provided = true)\n    AssignedEntitiesExplorer userAssignedRolesExplorerView;\n    @UiField(provided = true)\n    ACLViewer aclViewer;\n    private UserEditor presenter;\n\n    @Override\n    public void init(final UserEditor presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public UserEditor.View initWidgets(final UserAttributesEditor.View userAttributesEditorView,\n                                       final AssignedEntitiesExplorer userAssignedGroupsExplorerView,\n                                       final AssignedEntitiesEditor userAssignedGroupsEditorView,\n                                       final AssignedEntitiesExplorer userAssignedRolesExplorerView,\n                                       final AssignedEntitiesEditor userAssignedRolesEditorView,\n                                       final ACLViewer aclViewer) {\n\n        this.userAttributesEditorView = userAttributesEditorView;\n        this.userAssignedGroupsExplorerView = userAssignedGroupsExplorerView;\n        this.userAssignedGroupsEditorView = userAssignedGroupsEditorView;\n        this.userAssignedRolesExplorerView = userAssignedRolesExplorerView;\n        this.userAssignedRolesEditorView = userAssignedRolesEditorView;\n        this.aclViewer = aclViewer;\n\n        // Bind this view and initialize the widget.\n        initWidget(uiBinder.createAndBindUi(this));\n\n        // Tab panel configuration.\n        groupsTabItem.setDataTargetWidget(groupsTabPane);\n        rolesTabItem.setDataTargetWidget(rolesTabPane);\n        permissionsTabItem.setDataTargetWidget(permissionsTabPane);\n\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setUsername(final String username) {\n        userTitle.setText(username);\n        userTitle.setTitle(username);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setEditButtonVisible(final boolean isVisible) {\n        editButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setDeleteButtonVisible(final boolean isVisible) {\n        deleteButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setChangePasswordButtonVisible(final boolean isVisible) {\n        changePasswordButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setAddToGroupsButtonVisible(final boolean isVisible) {\n        addToGroupsButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setAddToRolesButtonVisible(final boolean isVisible) {\n        addToRolesButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setAttributesEditorVisible(boolean isVisible) {\n        userAttributesRow.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public UserEditor.View setPermissionsVisible(boolean isVisible) {\n        permissionsTabItem.setVisible(isVisible);\n        return this;\n    }\n\n    @UiHandler(\"editButton\")\n    public void onEditButtonClick(final ClickEvent event) {\n        presenter.onEdit();\n    }\n\n    @UiHandler(\"deleteButton\")\n    public void onDeleteButtonClick(final ClickEvent event) {\n        presenter.onDelete();\n    }\n\n    @UiHandler(\"changePasswordButton\")\n    public void onChangePasswordButtonClick(final ClickEvent event) {\n        presenter.onChangePassword();\n    }\n\n    @UiHandler(\"addToGroupsButton\")\n    public void onAddToGroupsButtonClick(final ClickEvent event) {\n        presenter.onAssignGroups();\n    }\n\n    @UiHandler(\"addToRolesButton\")\n    public void onAddToRolessButtonClick(final ClickEvent event) {\n        presenter.onAssignRoles();\n    }\n\n    interface UserEditorViewBinder\n            extends\n            UiBinder<Widget, UserEditorView> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:editor=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.editor\"\n             xmlns:user-editor=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.editor.user\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .mainPanel {\n      margin-bottom: 20px;\n      width: 100%;\n    }\n    .userTitle {\n      margin-top: 0;\n      float: left;\n    }\n    .editButton {\n      margin-left: 5px;\n    }\n    .addToGroupsButton {\n      float: right;\n    }\n    .buttonsColumn {\n      text-align: right;\n    }\n    .divider {\n      height: 1px;\n      width:100%;\n      display:block;\n      margin: 9px 0;\n      overflow: hidden;\n      background-color: #e5e5e5;\n    }\n    .tabPanel {\n      margin-top: 25px;\n    }\n    .tabContent {\n      height: 100%;\n      margin-top: 10px;\n      margin-right: 10px;\n      overflow-y: auto;\n      overflow-x: hidden;\n    }\n    .tabListItem {\n      font-size: large;\n    }\n    .button {\n      margin: 1px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n\n    <b:Container fluid=\"true\">\n\n      <b:Row ui:field=\"userTitleRow\">\n        <b:Column size=\"MD_8\">\n          <b:Heading size=\"H1\" ui:field=\"userTitle\" addStyleNames=\"{style.userTitle}\"/>\n          <b:Button type=\"LINK\" text=\"{i18n.edit}\" title=\"{i18n.edit}\" icon=\"PENCIL\"\n                    ui:field=\"editButton\" addStyleNames=\"{style.editButton}\"/>\n        </b:Column>\n        <b:Column size=\"MD_4\" addStyleNames=\"{style.buttonsColumn}\">\n          <b:Button type=\"DEFAULT\" title=\"{i18n.changePassword}\" text=\"{i18n.changePassword}\"\n                    ui:field=\"changePasswordButton\" addStyleNames=\"{style.button}\"/>\n          <b:Button type=\"DANGER\" text=\"{i18n.delete}\" title=\"{i18n.delete}\"\n                    ui:field=\"deleteButton\" addStyleNames=\"{style.button}\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row ui:field=\"userAttributesRow\">\n        <b:Column size=\"MD_12\" >\n          <g:FlowPanel addStyleNames=\"{style.divider}\"/>\n          <user-editor:UserAttributesEditor.View ui:field=\"userAttributesEditorView\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\" >\n          <g:FlowPanel>\n\n            <b:TabPanel tabPosition=\"TOP\" addStyleNames=\"{style.tabPanel}\">\n\n              <b:NavTabs addStyleNames=\"nav-tabs-pf\">\n                <b:TabListItem title=\"{i18n.memberOfGroups}\" text=\"{i18n.memberOfGroups}\" addStyleNames=\"{style.tabListItem}\" \n                               ui:field=\"groupsTabItem\" active=\"true\" />\n                <b:TabListItem title=\"{i18n.memberOfRoles}\" text=\"{i18n.memberOfRoles}\" addStyleNames=\"{style.tabListItem}\" \n                               ui:field=\"rolesTabItem\" active=\"false\" />\n                <b:TabListItem title=\"{i18n.permissions}\" text=\"{i18n.permissions}\" addStyleNames=\"{style.tabListItem}\"\n                               ui:field=\"permissionsTabItem\" active=\"false\" />\n              </b:NavTabs>\n\n              <b:TabContent ui:field=\"tabContent\" addStyleNames=\"{style.tabContent}\">\n\n                <!-- Assigned groups tab. -->\n                <b:TabPane ui:field=\"groupsTabPane\" active=\"true\">\n                  <g:VerticalPanel width=\"100%\">\n                    <b:Button ui:field=\"addToGroupsButton\" type=\"LINK\" icon=\"PLUS\" text=\"{i18n.addToGroups}\" addStyleNames=\"{style.button} {style.addToGroupsButton}\"/>\n                    <editor:AssignedEntitiesExplorer ui:field=\"userAssignedGroupsExplorerView\"/>  \n                  </g:VerticalPanel>\n                </b:TabPane>\n\n                <!-- Assigned roles tab. -->\n                <b:TabPane ui:field=\"rolesTabPane\" active=\"false\">\n                  <g:VerticalPanel width=\"100%\">\n                    <b:Button ui:field=\"addToRolesButton\" type=\"LINK\" icon=\"PLUS\" text=\"{i18n.addToRoles}\" addStyleNames=\"{style.button} {style.addToGroupsButton}\"/>\n                    <editor:AssignedEntitiesExplorer ui:field=\"userAssignedRolesExplorerView\"/>\n                  </g:VerticalPanel>\n                </b:TabPane>\n\n                <!-- Permissions summary tab. -->\n                <b:TabPane ui:field=\"permissionsTabPane\" active=\"false\">\n                    <g:IsWidget ui:field=\"aclViewer\"/>\n                </b:TabPane>\n\n              </b:TabContent>\n\n            </b:TabPanel>\n            \n          </g:FlowPanel>\n        </b:Column>\n      </b:Row>\n      \n  </b:Container>\n\n  <editor:AssignedEntitiesEditor ui:field=\"userAssignedGroupsEditorView\"/>\n\n  <editor:AssignedEntitiesEditor ui:field=\"userAssignedRolesEditorView\"/>\n  \n  </g:FlowPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/BaseUserEditorWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport java.util.LinkedHashSet;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ContextualEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>The workflow for editing a user.</p>\n * <p>It links the editor & sub-editors components with the editor driver and the remote user services.</p>\n * @since 0.8.0\n */\npublic abstract class BaseUserEditorWorkflow implements IsWidget {\n\n    public EntityWorkflowView view;\n    protected ClientUserSystemManager userSystemManager;\n    protected Event<OnErrorEvent> errorEvent;\n    protected Event<NotificationEvent> workbenchNotification;\n    protected Event<DeleteUserEvent> deleteUserEvent;\n    protected Event<SaveUserEvent> saveUserEvent;\n    protected ConfirmBox confirmBox;\n    protected UserEditor userEditor;\n    protected UserEditorDriver userEditorDriver;\n    protected ChangePassword changePassword;\n    protected LoadingBox loadingBox;\n    protected final ErrorCallback<Message> errorCallback = new ErrorCallback<Message>() {\n        @Override\n        public boolean error(final Message message,\n                             final Throwable throwable) {\n            hideLoadingBox();\n            showError(throwable);\n            return false;\n        }\n    };\n    protected User user;\n    protected boolean isDirty;\n\n    public BaseUserEditorWorkflow(final ClientUserSystemManager userSystemManager,\n                                  final Event<OnErrorEvent> errorEvent,\n                                  final Event<NotificationEvent> workbenchNotification,\n                                  final Event<DeleteUserEvent> deleteUserEvent,\n                                  final Event<SaveUserEvent> saveUserEvent,\n                                  final ConfirmBox confirmBox,\n                                  final UserEditor userEditor,\n                                  final UserEditorDriver userEditorDriver,\n                                  final ChangePassword changePassword,\n                                  final LoadingBox loadingBox,\n                                  final EntityWorkflowView view) {\n\n        this.userSystemManager = userSystemManager;\n        this.errorEvent = errorEvent;\n        this.workbenchNotification = workbenchNotification;\n        this.deleteUserEvent = deleteUserEvent;\n        this.saveUserEvent = saveUserEvent;\n        this.confirmBox = confirmBox;\n        this.userEditor = userEditor;\n        this.userEditorDriver = userEditorDriver;\n        this.changePassword = changePassword;\n        this.loadingBox = loadingBox;\n        this.view = view;\n        this.isDirty = false;\n    }\n\n    /*  ******************************************************************************************************\n                                     PROTECTED PRESENTER API \n         ****************************************************************************************************** */\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    protected void doShow(final String userId) {\n        assert userId != null;\n\n        // Configure the view.\n        doShowEditorView();\n\n        // Start the show workflow's logic.\n        checkDirty(new Command() {\n            @Override\n            public void execute() {\n                checkClear();\n                // Call backend service.\n                showLoadingBox();\n                userSystemManager.users(new RemoteCallback<User>() {\n                                            @Override\n                                            public void callback(User o) {\n                                                hideLoadingBox();\n                                                BaseUserEditorWorkflow.this.user = o;\n                                                assert user != null;\n\n                                                userEditorDriver.show(user,\n                                                                      userEditor);\n                                                view.setCancelButtonVisible(false);\n                                                view.setSaveButtonVisible(false);\n                                            }\n                                        },\n                                        errorCallback).get(userId);\n            }\n        });\n    }\n\n    public void clear() {\n        view.clearNotifications();\n        userEditor.clear();\n        user = null;\n        setDirty(false);\n    }\n\n    public UserEditor getUserEditor() {\n        return userEditor;\n    }\n\n    public boolean isDirty() {\n        return isDirty;\n    }\n\n    protected void onSave() {\n        doSave();\n    }\n\n    protected void onCancel() {\n        doShow(BaseUserEditorWorkflow.this.user.getIdentifier());\n    }\n\n    protected void doShowEditorView() {\n        view.setWidget(userEditor.view)\n                .setCancelButtonVisible(true)\n                .setSaveButtonVisible(true)\n                .setSaveButtonEnabled(isDirty)\n                .setSaveButtonText(getSaveButtonText())\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        BaseUserEditorWorkflow.this.onSave();\n                    }\n\n                    @Override\n                    public void onCancel() {\n                        BaseUserEditorWorkflow.this.onCancel();\n                    }\n                });\n    }\n\n    protected String getSaveButtonText() {\n        return UsersManagementWidgetsConstants.INSTANCE.saveChanges();\n    }\n\n    protected void setDirty(final boolean isDirty) {\n        this.isDirty = isDirty;\n        view.setSaveButtonEnabled(isDirty);\n        handleNotifications();\n    }\n\n    private void handleNotifications() {\n        final boolean emptyAssignments = null != user && !hasAssignments();\n        view.clearNotifications();\n        if (isDirty) {\n            view.showNotification(UsersManagementWidgetsConstants.INSTANCE.userModified(BaseUserEditorWorkflow.this.user.getIdentifier()));\n        }\n        if (emptyAssignments) {\n            view.showNotification(UsersManagementWidgetsConstants.INSTANCE.ensureUserHasGroupsOrRoles());\n        }\n    }\n\n    protected void edit() {\n        setDirty(false);\n        userEditorDriver.edit(user,\n                              userEditor);\n        view.setCancelButtonVisible(true);\n        view.setSaveButtonEnabled(false);\n        view.setSaveButtonVisible(true);\n    }\n\n    protected void doSave() {\n        assert user != null;\n\n        final boolean isValid = userEditorDriver.flush();\n        this.user = userEditorDriver.getValue();\n\n        if (isValid) {\n            final RemoteCallback<User> assignGroupsCallback =\n                    user1 -> doAssignGroups(() -> doAssignRoles(() -> {\n                        hideLoadingBox();\n                        BaseUserEditorWorkflow.this.isDirty = false;\n                        // Ask for the user's password if user is just created.\n                        final String id = user1.getIdentifier();\n                        afterSave(id);\n                    }));\n\n            // Update the wrapped user instance from the modifiable one and assign updated groups if update op is successful.\n            showLoadingBox();\n            doSaveRemoteServiceCall(assignGroupsCallback);\n        } else {\n            throw new RuntimeException(\"User must be valid before updating it.\");\n        }\n    }\n\n    protected void doAssignGroups(final Command callback) {\n        if (userEditor.canAssignGroups()) {\n            userSystemManager.users(aVoid -> callback.execute(),\n                                    errorCallback).assignGroups(user.getIdentifier(),\n                                                                getGroupNames());\n        } else {\n            callback.execute();\n        }\n    }\n\n    protected void doAssignRoles(final Command callback) {\n        if (userEditor.canAssignRoles()) {\n            userSystemManager.users(aVoid -> callback.execute(),\n                                    errorCallback).assignRoles(user.getIdentifier(),\n                                                               getRoleNames());\n        } else {\n            callback.execute();\n        }\n    }\n\n    protected void doSaveRemoteServiceCall(final RemoteCallback<User> callback) {\n        userSystemManager.users(callback,\n                                errorCallback).update(user);\n    }\n\n    protected void afterSave(final String id) {\n        workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.userSaved(id),\n                                                         SUCCESS));\n        saveUserEvent.fire(new SaveUserEvent(id));\n        doShow(user.getIdentifier());\n    }\n\n    protected void doDelete() {\n        if (user != null && user.getIdentifier() != null) {\n            confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                            UsersManagementWidgetsConstants.INSTANCE.ensureRemoveUser(),\n                            new Command() {\n                                @Override\n                                public void execute() {\n                                    final String id = user.getIdentifier();\n                                    showLoadingBox();\n                                    userSystemManager.users(new RemoteCallback<Void>() {\n                                                                @Override\n                                                                public void callback(Void o) {\n                                                                    hideLoadingBox();\n                                                                    final String id = user.getIdentifier();\n                                                                    deleteUserEvent.fire(new DeleteUserEvent(id));\n                                                                    workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.userRemoved(id),\n                                                                                                                     SUCCESS));\n                                                                    checkClear();\n                                                                }\n                                                            },\n                                                            errorCallback).delete(id);\n                                }\n                            },\n                            new Command() {\n                                @Override\n                                public void execute() {\n\n                                }\n                            });\n        }\n    }\n\n    protected void doChangePassword() {\n        showPasswordPopup(null);\n    }\n\n    protected void showPasswordPopup(final ChangePassword.ChangePasswordCallback callback) {\n        changePassword.show(user.getIdentifier(),\n                            callback);\n    }\n\n    protected Set<String> getGroupNames() {\n        final Set<String> result = new LinkedHashSet<String>(user.getGroups().size());\n        for (final Group group : user.getGroups()) {\n            result.add(group.getName());\n        }\n        return result;\n    }\n\n    protected Set<String> getRoleNames() {\n        final Set<String> result = new LinkedHashSet<String>(user.getRoles().size());\n        for (final Role role : user.getRoles()) {\n            result.add(role.getName());\n        }\n        return result;\n    }\n\n    protected boolean checkEventContext(final ContextualEvent contextualEvent,\n                                        final Object context) {\n        return contextualEvent != null && contextualEvent.getContext() != null && contextualEvent.getContext().equals(context);\n    }\n\n    protected void showError(final Throwable throwable) {\n        errorEvent.fire(new OnErrorEvent(BaseUserEditorWorkflow.this,\n                                         throwable));\n    }\n\n    protected void checkClear() {\n        checkDirty(this::clear);\n    }\n\n    protected void checkDirty(final Command callback) {\n        if (isDirty) {\n            confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                            UsersManagementWidgetsConstants.INSTANCE.userIsDirty(),\n                            () -> {\n                                BaseUserEditorWorkflow.this.isDirty = false;\n                                callback.execute();\n                            },\n                            () -> {\n                            });\n        } else {\n            callback.execute();\n        }\n    }\n\n    protected void showLoadingBox() {\n        loadingBox.show();\n    }\n\n    protected void hideLoadingBox() {\n        loadingBox.hide();\n    }\n\n    private boolean hasAssignments() {\n        final boolean hasGroups = null != userEditor.groupsExplorer().getValue() &&\n                !userEditor.groupsExplorer().getValue().isEmpty();\n        final boolean hasRoles = null != userEditor.rolesExplorer().getValue() &&\n                !userEditor.rolesExplorer().getValue().isEmpty();\n        return hasGroups || hasRoles;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/UserCreationWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.exception.InvalidEntityIdentifierException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UserAlreadyExistsException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.CreateEntity;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\n\n/**\n * <p>The workflow for creating a new user.</p>\n * <p>It links the editor & sub-editors components with the editor driver and the remote user services.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserCreationWorkflow extends BaseUserEditorWorkflow {\n\n    CreateEntity createEntity;\n    Event<CreateUserEvent> createUserEvent;\n\n    @Inject\n    public UserCreationWorkflow(final ClientUserSystemManager userSystemManager,\n                                final Event<OnErrorEvent> errorEvent,\n                                final Event<NotificationEvent> workbenchNotification,\n                                final Event<DeleteUserEvent> deleteUserEvent,\n                                final Event<SaveUserEvent> saveUserEvent,\n                                final Event<CreateUserEvent> createUserEvent,\n                                final ConfirmBox confirmBox,\n                                final CreateEntity createEntity,\n                                final UserEditor userEditor,\n                                final UserEditorDriver userEditorDriver,\n                                final ChangePassword changePassword,\n                                final LoadingBox loadingBox,\n                                final EntityWorkflowView view) {\n\n        super(userSystemManager,\n              errorEvent,\n              workbenchNotification,\n              deleteUserEvent,\n              saveUserEvent,\n              confirmBox,\n              userEditor,\n              userEditorDriver,\n              changePassword,\n              loadingBox,\n              view);\n\n        this.createUserEvent = createUserEvent;\n        this.createEntity = createEntity;\n    }\n\n    @PostConstruct\n    public void init() {\n    }\n\n    /*  ******************************************************************************************************\n                                     PUBLIC PRESENTER API\n         ****************************************************************************************************** */\n\n    public void create() {\n        checkClear();\n\n        // Permissions can not be shown until the user is created\n        getUserEditor().setPermissionsVisible(false);\n\n        // Show the create entity component for user instance types.\n        createEntity.show(UsersManagementWidgetsConstants.INSTANCE.inputUserName(),\n                          UsersManagementWidgetsConstants.INSTANCE.username() + \"...\");\n\n        // Show the create entity view.\n        view.setWidget(createEntity.asWidget())\n                .setCancelButtonVisible(false)\n                .setSaveButtonVisible(true)\n                .setSaveButtonEnabled(true)\n                .setSaveButtonText(UsersManagementWidgetsConstants.INSTANCE.next())\n                .setCallback(new EntityWorkflowView.Callback() {\n                    @Override\n                    public void onSave() {\n                        UserCreationWorkflow.this.onCreateEntityClick();\n                    }\n\n                    @Override\n                    public void onCancel() {\n\n                    }\n                });\n    }\n\n    /*  ******************************************************************************************************\n                                 VIEW CALLBACKS\n     ****************************************************************************************************** */\n\n    void onCreateEntityClick() {\n        final String identifier = createEntity.getEntityIdentifier();\n        if (identifier != null) {\n            checkCreate(identifier,\n                        new CheckCreateCallback() {\n                            @Override\n                            public void valid() {\n                                createEntity.clear();\n                                UserCreationWorkflow.this.user = userEditorDriver.createNewUser(identifier);\n                                doEdit();\n                            }\n\n                            @Override\n                            public void invalid(final SecurityManagementException exception) {\n                                showError(exception);\n                                createEntity.setErrorState();\n                            }\n\n                            @Override\n                            public void error(final Throwable error) {\n                                showError(error);\n                            }\n                        });\n        }\n    }\n\n\n    /*  ******************************************************************************************************\n                                 PRIVATE METHODS AND VALIDATORS\n     ****************************************************************************************************** */\n\n    protected void doEdit() {\n\n        // Configure the workflow's view.\n        doShowEditorView();\n        setDirty(false);\n\n        // Edit the instance using the user editor's driver.\n        edit();\n\n        // Enable the create button by default, not as the default edition behavior.\n        view\n                .setSaveButtonText(UsersManagementWidgetsConstants.INSTANCE.create())\n                .setSaveButtonEnabled(true)\n                .setSaveButtonVisible(true)\n                .setCancelButtonVisible(true);\n\n        // When creating, the edit, change password and delete buttons must not be available.\n        getUserEditor()\n                .setEditButtonVisible(false)\n                .setChangePasswordButtonVisible(false)\n                .setDeleteButtonVisible(false);\n    }\n\n    @Override\n    protected void doSaveRemoteServiceCall(RemoteCallback<User> callback) {\n        userSystemManager.users(callback,\n                                errorCallback).create(user);\n    }\n\n    @Override\n    protected void afterSave(String id) {\n        // Ask for password input at user creation time.\n        confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                        UsersManagementWidgetsConstants.INSTANCE.doSetPasswordNow(),\n                        new Command() {\n                            @Override\n                            public void execute() {\n                                // Set a password for the new user.\n                                showPasswordPopup(new ChangePassword.ChangePasswordCallback() {\n                                    @Override\n                                    public void onPasswordUpdated() {\n                                        doAfterSave(user.getIdentifier());\n                                    }\n\n                                    @Override\n                                    public void onError(Throwable throwable) {\n                                        showError(throwable);\n                                        onCancel();\n                                    }\n                                });\n                            }\n                        },\n                        new Command() {\n                            @Override\n                            public void execute() {\n                                // Do not set a password for the new user.\n                                doAfterSave(user.getIdentifier());\n                            }\n                        });\n    }\n\n    private void doAfterSave(final String id) {\n        workbenchNotification.fire(new NotificationEvent(UsersManagementWidgetsConstants.INSTANCE.userCreated(id),\n                                                         SUCCESS));\n        createUserEvent.fire(new CreateUserEvent(id));\n        create(); // Go to home workflow step.\n    }\n\n    @Override\n    protected String getSaveButtonText() {\n        return UsersManagementWidgetsConstants.INSTANCE.saveChanges();\n    }\n\n    @Override\n    protected void onCancel() {\n        create();\n    }\n\n    private void checkCreate(final String identifier,\n                             final CheckCreateCallback callback) {\n        if(!isSafeValue(identifier)) {\n            callback.invalid(new SecurityManagementException(UsersManagementWidgetsConstants.INSTANCE.invalidUserName()));\n        } else {\n            showLoadingBox();\n            userSystemManager.users(new RemoteCallback<User>() {\n                                        @Override\n                                        public void callback(User o) {\n                                            // User found, so identifier is not valid.\n                                            hideLoadingBox();\n                                            callback.invalid(new UserAlreadyExistsException(identifier));\n                                        }\n                                    },\n                                    new ErrorCallback<Message>() {\n                                        @Override\n                                        public boolean error(Message o,\n                                                             Throwable throwable) {\n                                            hideLoadingBox();\n                                            if (throwable instanceof UserNotFoundException) {\n                                                // User not found, so identifier is valid.\n                                                callback.valid();\n                                            } else if (throwable instanceof InvalidEntityIdentifierException) {\n                                                callback.invalid(new SecurityManagementException(getUserNameNotValidMessage((InvalidEntityIdentifierException) throwable),\n                                                                                                 throwable));\n                                            } else {\n                                                callback.error(throwable);\n                                            }\n                                            return false;\n                                        }\n                                    }).get(identifier);\n        }\n    }\n\n    private boolean isSafeValue(final String identifier) {\n        final String safeValue = new SafeHtmlBuilder().appendEscaped(identifier).toSafeHtml().asString();\n        return identifier.equals(safeValue);\n    }\n\n    private String getUserNameNotValidMessage(final InvalidEntityIdentifierException e) {\n        return UsersManagementWidgetsConstants.INSTANCE.invalidUserName() +\n                \" [\" + e.getIdentifier() + \"]. \" +\n                UsersManagementWidgetsConstants.INSTANCE.patternAlphanumericSymbols() +\n                \" [\" + e.getSymbolsAccepted() + \"]\";\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        createEntity.clear();\n    }\n\n    void onEditUserEvent(@Observes final OnEditEvent onEditEvent) {\n        if (checkEventContext(onEditEvent,\n                              getUserEditor())) {\n            edit();\n        }\n    }\n\n    void onDeleteUserEvent(@Observes final OnDeleteEvent onDeleteEvent) {\n        if (checkEventContext(onDeleteEvent,\n                              getUserEditor())) {\n            doDelete();\n        }\n    }\n\n    void onChangeUserPasswordEvent(@Observes final OnChangePasswordEvent onChangePasswordEvent) {\n        if (checkEventContext(onChangePasswordEvent,\n                              getUserEditor())) {\n            doChangePassword();\n        }\n    }\n\n    void onAttributeCreated(@Observes final CreateUserAttributeEvent createUserAttributeEvent) {\n        if (checkEventContext(createUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onAttributeDeleted(@Observes final DeleteUserAttributeEvent deleteUserAttributeEvent) {\n        if (checkEventContext(deleteUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onAttributeUpdated(@Observes final UpdateUserAttributeEvent updateUserAttributeEvent) {\n        if (checkEventContext(updateUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnRemoveUserGroupEvent(@Observes final OnRemoveUserGroupEvent onRemoveUserGroupEvent) {\n        if (checkEventContext(onRemoveUserGroupEvent,\n                              getUserEditor().groupsExplorer())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnUserGroupsUpdatedEvent(@Observes final OnUpdateUserGroupsEvent onUpdateUserGroupsEvent) {\n        if (checkEventContext(onUpdateUserGroupsEvent,\n                              getUserEditor().groupsEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnRemoveUserRoleEvent(@Observes final OnRemoveUserRoleEvent onRemoveUserRoleEvent) {\n        if (checkEventContext(onRemoveUserRoleEvent,\n                              getUserEditor().rolesExplorer())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnUserRolesUpdatedEvent(@Observes final OnUpdateUserRolesEvent onUpdateUserRolesEvent) {\n        if (checkEventContext(onUpdateUserRolesEvent,\n                              getUserEditor().rolesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    private interface CheckCreateCallback {\n\n        void valid();\n\n        void invalid(final SecurityManagementException exception);\n\n        void error(final Throwable error);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/UserEditorWorkflow.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n/**\n * <p>The workflow for editing a user.</p>\n * <p>It links the editor & sub-editors components with the editor driver and the remote user services.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserEditorWorkflow extends BaseUserEditorWorkflow {\n\n    @Inject\n    public UserEditorWorkflow(final ClientUserSystemManager userSystemManager,\n                              final Event<OnErrorEvent> errorEvent,\n                              final Event<NotificationEvent> workbenchNotification,\n                              final Event<DeleteUserEvent> deleteUserEvent,\n                              final Event<SaveUserEvent> saveUserEvent,\n                              final ConfirmBox confirmBox,\n                              final UserEditor userEditor,\n                              final UserEditorDriver userEditorDriver,\n                              final ChangePassword changePassword,\n                              final LoadingBox loadingBox,\n                              final EntityWorkflowView view) {\n\n        super(userSystemManager,\n              errorEvent,\n              workbenchNotification,\n              deleteUserEvent,\n              saveUserEvent,\n              confirmBox,\n              userEditor,\n              userEditorDriver,\n              changePassword,\n              loadingBox,\n              view);\n    }\n\n    @PostConstruct\n    public void init() {\n    }\n\n    public void show(final String userId) {\n        doShow(userId);\n    }\n\n    void onEditUserEvent(@Observes final OnEditEvent onEditEvent) {\n        if (checkEventContext(onEditEvent,\n                              userEditor)) {\n            edit();\n        }\n    }\n\n    void onDeleteUserEvent(@Observes final OnDeleteEvent onDeleteEvent) {\n        if (checkEventContext(onDeleteEvent,\n                              userEditor)) {\n            doDelete();\n        }\n    }\n\n    void onChangeUserPasswordEvent(@Observes final OnChangePasswordEvent onChangePasswordEvent) {\n        if (checkEventContext(onChangePasswordEvent,\n                              userEditor)) {\n            doChangePassword();\n        }\n    }\n\n    void onAttributeCreated(@Observes final CreateUserAttributeEvent createUserAttributeEvent) {\n        if (checkEventContext(createUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onAttributeDeleted(@Observes final DeleteUserAttributeEvent deleteUserAttributeEvent) {\n        if (checkEventContext(deleteUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onAttributeUpdated(@Observes final UpdateUserAttributeEvent updateUserAttributeEvent) {\n        if (checkEventContext(updateUserAttributeEvent,\n                              getUserEditor().attributesEditor())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnRemoveUserGroupEvent(@Observes final OnRemoveUserGroupEvent onRemoveUserGroupEvent) {\n        if (checkEventContext(onRemoveUserGroupEvent,\n                              getUserEditor().groupsExplorer())) {\n            setDirty(true);\n        }\n    }\n\n    void onOnUserGroupsUpdatedEvent(@Observes final OnUpdateUserGroupsEvent onUpdateUserGroupsEvent) {\n        if (checkEventContext(onUpdateUserGroupsEvent,\n                              getUserEditor().groupsEditor())) {\n            setDirty(true);\n            refreshPermissions(true);\n        }\n    }\n\n    void onOnRemoveUserRoleEvent(@Observes final OnRemoveUserRoleEvent onRemoveUserRoleEvent) {\n        if (checkEventContext(onRemoveUserRoleEvent,\n                              getUserEditor().rolesExplorer())) {\n            setDirty(true);\n            refreshPermissions(true);\n        }\n    }\n\n    void onOnUserRolesUpdatedEvent(@Observes final OnUpdateUserRolesEvent onUpdateUserRolesEvent) {\n        if (checkEventContext(onUpdateUserRolesEvent,\n                              getUserEditor().rolesEditor())) {\n            setDirty(true);\n            refreshPermissions(true);\n        }\n    }\n\n    void onRoleSavedEvent(@Observes SaveRoleEvent event) {\n        refreshPermissions(false);\n    }\n\n    void onGroupSavedEvent(@Observes SaveGroupEvent event) {\n        refreshPermissions(false);\n    }\n\n    void refreshPermissions(boolean flush) {\n        if (flush) {\n            userEditorDriver.flush();\n            User user = userEditorDriver.getValue();\n            userEditor.getACLViewer().show(user);\n        } else {\n            userEditor.getACLViewer().show(user);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/workflow/EntityWorkflowView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.workflow;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n/**\n * <p>The view for a entity workflow edition component.</p>\n * @since 0.8.0\n */\npublic interface EntityWorkflowView extends IsWidget {\n\n    EntityWorkflowView setCallback(Callback callback);\n\n    EntityWorkflowView setWidget(IsWidget widget);\n\n    EntityWorkflowView setCancelButtonVisible(boolean isVisible);\n\n    EntityWorkflowView setSaveButtonEnabled(boolean isEnabled);\n\n    EntityWorkflowView setSaveButtonVisible(boolean isVisible);\n\n    EntityWorkflowView setSaveButtonText(String text);\n\n    EntityWorkflowView showNotification(final String text);\n\n    EntityWorkflowView clearNotifications();\n\n    interface Callback {\n\n        void onSave();\n\n        void onCancel();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/workflow/EntityWorkflowViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.workflow;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Alert;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Span;\n\n@Dependent\npublic class EntityWorkflowViewImpl extends Composite implements EntityWorkflowView {\n\n    private static UserEditorWorkflowViewBinder uiBinder = GWT.create(UserEditorWorkflowViewBinder.class);\n    @UiField\n    Alert notification;\n    @UiField\n    Column content;\n    @UiField\n    Button saveButton;\n    @UiField\n    Button cancelButton;\n    private Callback callback;\n\n    @PostConstruct\n    public void init() {\n        // Bind this view and initialize the widget.\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public EntityWorkflowView setCallback(final Callback callback) {\n        this.callback = callback;\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView setWidget(final IsWidget widget) {\n        content.clear();\n        content.add(widget);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView setCancelButtonVisible(boolean isVisible) {\n        cancelButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView setSaveButtonEnabled(boolean isEnabled) {\n        saveButton.setEnabled(isEnabled);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView setSaveButtonVisible(boolean isVisible) {\n        saveButton.setVisible(isVisible);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView setSaveButtonText(final String text) {\n        saveButton.setText(text);\n        saveButton.setTitle(text);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView showNotification(final String text) {\n        Icon icon = new Icon(IconType.WARNING);\n        icon.setStyleName(\"pficon pficon-warning-triangle-o\");\n        notification.clear();\n        notification.add(icon);\n        notification.add(new Span(text));\n        notification.setVisible(true);\n        return this;\n    }\n\n    @Override\n    public EntityWorkflowView clearNotifications() {\n        notification.clear();\n        notification.setVisible(false);\n        return this;\n    }\n\n    @UiHandler(\"saveButton\")\n    public void onEditButtonClick(final ClickEvent event) {\n        if (callback != null) {\n            callback.onSave();\n        }\n    }\n\n    @UiHandler(\"cancelButton\")\n    public void onDeleteButtonClick(final ClickEvent event) {\n        if (callback != null) {\n            callback.onCancel();\n        }\n    }\n\n    interface UserEditorWorkflowViewBinder\n            extends\n            UiBinder<Widget, EntityWorkflowViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/editor/workflow/EntityWorkflowViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .button {\n      margin: 5px;\n    }\n  </ui:style>\n\n  <b:Container fluid=\"true\">\n\n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <b:Alert ui:field=\"notification\"/>\n      </b:Column>\n    </b:Row>\n    \n    <b:Row>\n      <b:Column size=\"MD_12\" ui:field=\"content\"/>\n    </b:Row>\n    \n    <b:Row>\n      <b:Column size=\"MD_12\">\n        <b:Button type=\"PRIMARY\" text=\"{i18n.saveChanges}\" title=\"{i18n.saveChanges}\" ui:field=\"saveButton\"  addStyleNames=\"{style.button}\"/>\n        <b:Button type=\"DEFAULT\" text=\"{i18n.cancel}\" title=\"{i18n.cancel}\" ui:field=\"cancelButton\" addStyleNames=\"{style.button}\"/>\n      </b:Column>\n    </b:Row>\n    \n  </b:Container>\n \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/AddUsersToGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Set;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event for assigning a collection of users to a given group.</p>\n */\npublic class AddUsersToGroupEvent extends ContextualEvent implements UberFireEvent {\n\n    private Set<String> users;\n\n    public AddUsersToGroupEvent(Object context,\n                                Set<String> users) {\n        super(context);\n        this.users = users;\n    }\n\n    public Set<String> getUsers() {\n        return users;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/ChangePasswordEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event fired when a user's password has been changed.</p>\n */\npublic class ChangePasswordEvent extends ContextualEvent implements UberFireEvent {\n\n    public ChangePasswordEvent(final Object context) {\n        super(context);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/ContextualEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\n/**\n * <p>Base class for any event that fires in a given context.</p>\n */\npublic abstract class ContextualEvent {\n\n    private final Object context;\n\n    public ContextualEvent(Object context) {\n        this.context = context;\n    }\n\n    public Object getContext() {\n        return context;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/CreateGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class CreateGroupEvent implements UberFireEvent {\n\n    private final String name;\n\n    public CreateGroupEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"CreateGroupEvent [identifier=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/CreateUserAttributeEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Map;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event for a user attribute creation.</p>\n */\npublic class CreateUserAttributeEvent extends ContextualEvent implements UberFireEvent {\n\n    private final Map.Entry<String, String> attribute;\n\n    public CreateUserAttributeEvent(Object context,\n                                    Map.Entry<String, String> attribute) {\n        super(context);\n        this.attribute = attribute;\n    }\n\n    public Map.Entry<String, String> getAttribute() {\n        return attribute;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/CreateUserEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class CreateUserEvent implements UberFireEvent {\n\n    private final String identifier;\n\n    public CreateUserEvent(final String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String toString() {\n        return \"CreateUserEvent [identifier=\" + identifier + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/DeleteGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class DeleteGroupEvent implements UberFireEvent {\n\n    private final String name;\n\n    public DeleteGroupEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"DeleteGroupEvent [name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/DeleteUserAttributeEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Map;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event for a user attribute deletion.</p>\n */\npublic class DeleteUserAttributeEvent extends ContextualEvent implements UberFireEvent {\n\n    private final Map.Entry<String, String> attribute;\n\n    public DeleteUserAttributeEvent(Object context,\n                                    Map.Entry<String, String> attribute) {\n        super(context);\n        this.attribute = attribute;\n    }\n\n    public Map.Entry<String, String> getAttribute() {\n        return attribute;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/DeleteUserEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class DeleteUserEvent implements UberFireEvent {\n\n    private final String identifier;\n\n    public DeleteUserEvent(final String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String toString() {\n        return \"DeleteUserEvent [identifier=\" + identifier + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/HomePerspectiveChangedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event notifying a change on the home perspective setting.</p>\n */\npublic class HomePerspectiveChangedEvent extends ContextualEvent implements UberFireEvent {\n\n    private PerspectiveActivity perspective;\n\n    public HomePerspectiveChangedEvent(Object context,\n                                       PerspectiveActivity p) {\n        super(context);\n        this.perspective = p;\n    }\n\n    public PerspectiveActivity getPerspective() {\n        return perspective;\n    }\n\n    @Override\n    public String toString() {\n        return \"HomePerspectiveChangedEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/NewGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class NewGroupEvent implements UberFireEvent {\n\n    @Override\n    public String toString() {\n        return \"NewGroupEvent\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/NewUserEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class NewUserEvent implements UberFireEvent {\n\n    @Override\n    public String toString() {\n        return \"NewUserEvent\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnChangePasswordEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>User ask for changing user's password.</p>\n * @since 0.8.0\n */\npublic class OnChangePasswordEvent extends ContextualEvent implements UberFireEvent {\n\n    private User instance;\n\n    public OnChangePasswordEvent(Object context,\n                                 User instance) {\n        super(context);\n        this.instance = instance;\n    }\n\n    public User getInstance() {\n        return instance;\n    }\n\n    @Override\n    public String toString() {\n        return \"OnChangePasswordEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnDeleteEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>User ask for deleting an instance.</p>\n * @since 0.8.0\n */\npublic class OnDeleteEvent extends ContextualEvent implements UberFireEvent {\n\n    private Object instance;\n\n    public OnDeleteEvent(Object context,\n                         Object instance) {\n        super(context);\n        this.instance = instance;\n    }\n\n    public Object getInstance() {\n        return instance;\n    }\n\n    @Override\n    public String toString() {\n        return \"OnDeleteEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnEditEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>User ask for edition mode.</p>\n * @since 0.8.0\n */\npublic class OnEditEvent extends ContextualEvent implements UberFireEvent {\n\n    private Object instance;\n\n    public OnEditEvent(Object context,\n                       Object instance) {\n        super(context);\n        this.instance = instance;\n    }\n\n    public Object getInstance() {\n        return instance;\n    }\n\n    @Override\n    public String toString() {\n        return \"OnEditEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnErrorEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * An error to be handled from a given context.\n * @since 0.8.0\n */\npublic class OnErrorEvent extends ContextualEvent implements UberFireEvent {\n\n    private Throwable exception;\n\n    public OnErrorEvent(final Object context,\n                        final Throwable exception) {\n        super(context);\n        this.exception = exception;\n    }\n\n    public Throwable getException() {\n        return exception;\n    }\n\n    @Override\n    public String toString() {\n        return \"ErrorEvent [context=\" + getContext() + \",\" +\n                \"exception=\" + exception + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnRemoveUserGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>A user wants to remove an assigned group from a user.</p>\n * @since 0.8.0\n */\npublic class OnRemoveUserGroupEvent extends ContextualEvent implements UberFireEvent {\n\n    private final String name;\n\n    public OnRemoveUserGroupEvent(Object context,\n                                  String name) {\n        super(context);\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnRemoveUserRoleEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>A user wants to remove an assigned role from a user.</p>\n * @since 0.8.0\n */\npublic class OnRemoveUserRoleEvent extends ContextualEvent implements UberFireEvent {\n\n    private final String name;\n\n    public OnRemoveUserRoleEvent(Object context,\n                                 String name) {\n        super(context);\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnShowEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>User ask for view mode.</p>\n * @since 0.8.0\n */\npublic class OnShowEvent extends ContextualEvent implements UberFireEvent {\n\n    private Object instance;\n\n    public OnShowEvent(Object context,\n                       Object instance) {\n        super(context);\n        this.instance = instance;\n    }\n\n    public Object getInstance() {\n        return instance;\n    }\n\n    @Override\n    public String toString() {\n        return \"OnShowEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnUpdateUserGroupsEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Set;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>A user is updating assigned user's groups.</p>\n * @since 0.8.0\n */\npublic class OnUpdateUserGroupsEvent extends ContextualEvent implements UberFireEvent {\n\n    private Set<String> groups;\n\n    public OnUpdateUserGroupsEvent(Object context,\n                                   Set<String> groups) {\n        super(context);\n        this.groups = groups;\n    }\n\n    public Set<String> getGroups() {\n        return groups;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/OnUpdateUserRolesEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Set;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>A user is updating assigned user's roles.</p>\n * @since 0.8.0\n */\npublic class OnUpdateUserRolesEvent extends ContextualEvent implements UberFireEvent {\n\n    private Set<String> roles;\n\n    public OnUpdateUserRolesEvent(Object context,\n                                  Set<String> roles) {\n        super(context);\n        this.roles = roles;\n    }\n\n    public Set<String> getRoles() {\n        return roles;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/PermissionChangedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event notifying a change on a {@link Permission} instance value.</p>\n */\npublic class PermissionChangedEvent extends ContextualEvent implements UberFireEvent {\n\n    private Permission permission;\n    private boolean granted;\n\n    public PermissionChangedEvent(ACLEditor aclEditor,\n                                  Permission permission,\n                                  boolean granted) {\n        super(aclEditor);\n        this.permission = permission;\n        this.granted = granted;\n    }\n\n    public Permission getPermission() {\n        return permission;\n    }\n\n    public boolean isGranted() {\n        return granted;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/PermissionNodeAddedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event notifying a new permission node is added.</p>\n */\npublic class PermissionNodeAddedEvent extends ContextualEvent implements UberFireEvent {\n\n    private PermissionNode childNode;\n    private PermissionNode parentNode;\n\n    public PermissionNodeAddedEvent(ACLEditor aclEditor,\n                                    PermissionNode parentNode,\n                                    PermissionNode childNode) {\n        super(aclEditor);\n        this.parentNode = parentNode;\n        this.childNode = childNode;\n    }\n\n    public PermissionNode getParentNode() {\n        return parentNode;\n    }\n\n    public PermissionNode getChildNode() {\n        return childNode;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/PermissionNodeRemovedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event notifying a new permission node is removed.</p>\n */\npublic class PermissionNodeRemovedEvent extends ContextualEvent implements UberFireEvent {\n\n    private PermissionNode childNode;\n    private PermissionNode parentNode;\n\n    public PermissionNodeRemovedEvent(ACLEditor aclEditor,\n                                      PermissionNode parentNode,\n                                      PermissionNode childNode) {\n        super(aclEditor);\n        this.parentNode = parentNode;\n        this.childNode = childNode;\n    }\n\n    public PermissionNode getParentNode() {\n        return parentNode;\n    }\n\n    public PermissionNode getChildNode() {\n        return childNode;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/PriorityChangedEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event notifying a change on the role/group priority setting.</p>\n */\npublic class PriorityChangedEvent extends ContextualEvent implements UberFireEvent {\n\n    private int priority;\n\n    public PriorityChangedEvent(Object context,\n                                int p) {\n        super(context);\n        this.priority = p;\n    }\n\n    public int getPriority() {\n        return priority;\n    }\n\n    @Override\n    public String toString() {\n        return \"PriorityChangedEvent [context=\" + getContext() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/ReadGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class ReadGroupEvent implements UberFireEvent {\n\n    private final String name;\n\n    public ReadGroupEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"ReadGroupEvent [name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/ReadRoleEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class ReadRoleEvent implements UberFireEvent {\n\n    private final String name;\n\n    public ReadRoleEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"ReadRoleEvent [name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/ReadUserEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class ReadUserEvent implements UberFireEvent {\n\n    private final String identifier;\n\n    public ReadUserEvent(final String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String toString() {\n        return \"ReadUserEvent [identifier=\" + identifier + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/RemoveUserGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event for removing an assigned group from a user.</p>\n */\npublic class RemoveUserGroupEvent extends ContextualEvent implements UberFireEvent {\n\n    private final String name;\n\n    public RemoveUserGroupEvent(Object context,\n                                String name) {\n        super(context);\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/SaveGroupEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class SaveGroupEvent implements UberFireEvent {\n\n    private final String name;\n\n    public SaveGroupEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"SaveGroupEvent [name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/SaveRoleEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class SaveRoleEvent implements UberFireEvent {\n\n    private final String name;\n\n    public SaveRoleEvent(final String name) {\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String toString() {\n        return \"SaveRoleEvent [name=\" + name + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/SaveUserEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class SaveUserEvent implements UberFireEvent {\n\n    private final String identifier;\n\n    public SaveUserEvent(final String identifier) {\n        this.identifier = identifier;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public String toString() {\n        return \"SaveUserEvent [identifier=\" + identifier + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/events/UpdateUserAttributeEvent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.events;\n\nimport java.util.Map;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * <p>Event for a user attribute updated.</p>\n */\npublic class UpdateUserAttributeEvent extends ContextualEvent implements UberFireEvent {\n\n    private final Map.Entry<String, String> attribute;\n\n    public UpdateUserAttributeEvent(Object context,\n                                    Map.Entry<String, String> attribute) {\n        super(context);\n        this.attribute = attribute;\n    }\n\n    public Map.Entry<String, String> getAttribute() {\n        return attribute;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/AbstractEntityExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\npublic abstract class AbstractEntityExplorer<T> implements IsWidget {\n\n    protected final static int PAGE_SIZE = 15;\n    protected static final String SEARCH_PATTERN_ALL = \"\";\n    public EntitiesExplorerView view;\n    ClientUserSystemManager userSystemManager;\n    Event<OnErrorEvent> errorEvent;\n    LoadingBox loadingBox;\n    protected final ErrorCallback<Message> errorCallback = new ErrorCallback<Message>() {\n        @Override\n        public boolean error(final Message message,\n                             final Throwable throwable) {\n            showError(throwable);\n            return false;\n        }\n    };\n    EntitiesList<T> entitiesList;\n    int pageSize = PAGE_SIZE;\n    String searchPattern = SEARCH_PATTERN_ALL;\n    int currentPage = 1;\n    protected EntitiesExplorerView.ViewCallback viewCallback = new EntitiesExplorerView.ViewCallback() {\n        @Override\n        public void onSearch(final String pattern) {\n            AbstractEntityExplorer.this.searchPattern = pattern != null ? pattern : SEARCH_PATTERN_ALL;\n            AbstractEntityExplorer.this.currentPage = 1;\n            if (pattern == null || pattern.trim().length() == 0) {\n                view.clearSearch();\n            }\n            showSearch();\n        }\n\n        @Override\n        public void onRefresh() {\n            currentPage = 1;\n            showSearch();\n        }\n\n        @Override\n        public void onCreate() {\n            showCreate();\n        }\n    };\n    ExplorerViewContext context;\n    Set<String> selected;\n\n    @Inject\n    public AbstractEntityExplorer(final ClientUserSystemManager userSystemManager,\n                                  final Event<OnErrorEvent> errorEvent,\n                                  final LoadingBox loadingBox,\n                                  final EntitiesList<T> entitiesList,\n                                  final EntitiesExplorerView view) {\n\n        this.userSystemManager = userSystemManager;\n        this.errorEvent = errorEvent;\n        this.loadingBox = loadingBox;\n        this.entitiesList = entitiesList;\n        this.view = view;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    protected abstract String getEmptyText();\n\n    protected abstract String getEntityType();\n\n    protected abstract String getTitle();\n\n    protected abstract String getEntityId(final T entity);\n\n    protected abstract String getEntityName(final T entity);\n\n    protected abstract boolean canSearch();\n\n    protected abstract boolean canCreate();\n\n    protected abstract boolean canRead();\n\n    protected abstract void showSearch();\n\n    protected abstract void showCreate();\n\n    @PostConstruct\n    public void init() {\n        entitiesList.setPageSize(pageSize);\n        entitiesList.setEmptyEntitiesText(getEmptyText());\n        view.configure(getTitle(),\n                       entitiesList.view);\n    }\n\n    public void show() {\n        show(null);\n    }\n\n    public void show(final ExplorerViewContext context) {\n        // Configure the view context.\n        this.context = context;\n        if (this.context == null) {\n            this.context = new ExplorerViewContext();\n        }\n        this.context.setParent(createParentContext());\n        this.selected = this.context.getSelectedEntities();\n\n        if (canSearch()) {\n            showSearch();\n        } else {\n            view.showMessage(LabelType.WARNING,\n                             UsersManagementWidgetsConstants.INSTANCE.doesNotHavePrivileges());\n        }\n    }\n\n    public Set<String> getSelectedEntities() {\n        return nullSafe(selected);\n    }\n\n    public void setPageSize(int pageSize) {\n        this.pageSize = pageSize;\n    }\n\n    protected EntitiesList.Callback<T> createCallback() {\n        return new EntitiesList.Callback<T>() {\n\n            @Override\n            public String getEntityType() {\n                return AbstractEntityExplorer.this.getEntityType();\n            }\n\n            @Override\n            public boolean canRead() {\n                return AbstractEntityExplorer.this.context.canRead();\n            }\n\n            @Override\n            public boolean canRemove() {\n                return AbstractEntityExplorer.this.context.canDelete();\n            }\n\n            @Override\n            public boolean canSelect() {\n                return AbstractEntityExplorer.this.context.canSelect();\n            }\n\n            @Override\n            public boolean isSelected(final String id) {\n                return selected != null && AbstractEntityExplorer.this.selected.contains(id);\n            }\n\n            @Override\n            public String getIdentifier(final T entity) {\n                return AbstractEntityExplorer.this.getEntityId(entity);\n            }\n\n            @Override\n            public String getTitle(final T entity) {\n                return AbstractEntityExplorer.this.getEntityName(entity);\n            }\n\n            @Override\n            public void onReadEntity(final String identifier) {\n                fireReadEvent(identifier);\n            }\n\n            @Override\n            public void onRemoveEntity(final String identifier) {\n                // Not available from explorer widget.\n            }\n\n            @Override\n            public void onSelectEntity(String identifier,\n                                       boolean isSelected) {\n                if (isSelected) {\n                    if (selected == null) {\n                        selected = new HashSet<String>(1);\n                    }\n                    AbstractEntityExplorer.this.selected.add(identifier);\n                } else if (selected != null) {\n                    AbstractEntityExplorer.this.selected.remove(identifier);\n                }\n            }\n\n            @Override\n            public void onChangePage(final int currentPage,\n                                     final int goToPage) {\n                AbstractEntityExplorer.this.currentPage = goToPage;\n                AbstractEntityExplorer.this.showSearch();\n            }\n        };\n    }\n\n    protected void fireReadEvent(final String identifier) {\n\n    }\n\n    protected EntitiesExplorerView.ViewContext createParentContext() {\n        final boolean canSelect = false;\n\n        return new EntitiesExplorerView.ViewContext() {\n            @Override\n            public boolean canSearch() {\n                return AbstractEntityExplorer.this.canSearch();\n            }\n\n            @Override\n            public boolean canCreate() {\n                return AbstractEntityExplorer.this.canCreate();\n            }\n\n            @Override\n            public boolean canRead() {\n                return AbstractEntityExplorer.this.canRead();\n            }\n\n            @Override\n            public boolean canDelete() {\n                // By default, the exlorer widget does not allow to delete.\n                return false;\n            }\n\n            @Override\n            public boolean canSelect() {\n                return canSelect;\n            }\n\n            @Override\n            public Set<String> getSelectedEntities() {\n                return selected;\n            }\n\n            @Override\n            public Set<String> getConstrainedEntities() {\n                return new HashSet<String>();\n            }\n        };\n    }\n\n    protected void showLoadingView() {\n        loadingBox.show();\n    }\n\n    protected Set<String> nullSafe(final Set<String> set) {\n        return set != null ? Collections.unmodifiableSet(set) : null;\n    }\n\n    protected void hideLoadingView() {\n        loadingBox.hide();\n    }\n\n    protected boolean hasContext() {\n        return null != context;\n    }\n\n    /**\n     * The bean can be still present in the context, even listening CDI events,\n     * but can be not currently active, so this method just ensures to perform show\n     * in case it's active (it has context).\n     * This is due the explorer components can be/is being used by other components in different\n     * ways, main screen, inside modals, etc.\n     */\n    protected void attemptToShowSearch() {\n        if (hasContext()) {\n            showSearch();\n        }\n    }\n\n    protected void showError(final Throwable throwable) {\n        hideLoadingView();\n        errorEvent.fire(new OnErrorEvent(AbstractEntityExplorer.this,\n                                         throwable));\n    }\n\n    public void clear() {\n        context = null;\n        searchPattern = SEARCH_PATTERN_ALL;\n        currentPage = 1;\n        view.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/EntitiesExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\n/**\n * <p>Entities explorer view methods signatures.</p>\n * @since 0.8.0\n */\npublic interface EntitiesExplorerView extends IsWidget {\n\n    /**\n     * <p>Configures the explorer's list widget.</p>\n     * @param entityType A string that represents the current exploring type for the entities (eg: user, group). Used in buttons and texts in the explorer.\n     * @param entitiesListView The view for entities list widget.\n     * @return The view instance.\n     * @see <a>org.uberfire.ext.security.management.client.widgets.management.EntitiesListView</a>\n     */\n    EntitiesExplorerView configure(final String entityType,\n                                   final EntitiesList.View entitiesListView);\n\n    /**\n     * <p>Shows the list.</p>\n     * @param context The view context.\n     * @param callback The view callback methods.\n     * @return The view instance.\n     * @see <a>org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView.ViewContext</a>\n     * @see <a>org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView.ViewCallback</a>\n     */\n    EntitiesExplorerView show(final ViewContext context,\n                              final ViewCallback callback);\n\n    /**\n     * <p>Shows a meesage in the entities explorer view. No entities will be displayed, just the message.</p>\n     * @param labelType The type of the label for the message.\n     * @param message The message.\n     * @return The view instance.\n     */\n    EntitiesExplorerView showMessage(final LabelType labelType,\n                                     final String message);\n\n    /**\n     * <p>Clears the current search.</p>\n     * @return The view instance.\n     */\n    EntitiesExplorerView clearSearch();\n\n    /**\n     * <p>Clears the view.</p>\n     * @return The view instance.\n     */\n    EntitiesExplorerView clear();\n\n    /**\n     * <p>The context for the entities explorer view.</p>\n     * <p>The view uses this callback methods for internal features management.</p>\n     */\n    interface ViewContext {\n\n        /**\n         * <p>Allows enabling or disabling the entities search feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities explorer widget enables the search feature.</li>\n         * <li><code>false</code> - The entities explorer widget disables the search feature.</li>\n         * </ul>\n         */\n        boolean canSearch();\n\n        /**\n         * <p>Allows enabling or disabling the entities creation feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities explorer widget enables the create feature.</li>\n         * <li><code>false</code> - The entities explorer widget disables the create feature.</li>\n         * <li><code>null</code> - The entities explorer widget will determine if create is enabled by using the UserSysteManager API.</li>\n         * </ul>\n         */\n        boolean canCreate();\n\n        /**\n         * <p>Allows enabling or disabling the entities read feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities explorer widget enables the read feature.</li>\n         * <li><code>false</code> - The entities explorer widget disables the read feature.</li>\n         * </ul>\n         */\n        boolean canRead();\n\n        /**\n         * <p>Allows enabling or disabling the entities delete feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities explorer widget enables the delete feature.</li>\n         * <li><code>false</code> - The entities explorer widget disables the delete feature.</li>\n         * </ul>\n         */\n        boolean canDelete();\n\n        /**\n         * <p>Allows enabling or disabling the entities selection feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities explorer widget enables the selection feature.</li>\n         * <li><code>false</code> - The entities explorer widget disables the selection feature.</li>\n         * </ul>\n         */\n        boolean canSelect();\n\n        /**\n         * <p>If <code>canSelect()</code> is enabled, the entity identifiers specified in the collection values will be mark as selected.</p>\n         * @return <p>A collection of the selected entity identifiers present in the entities collection returned by <code>getEntities()</code>,</p>\n         */\n        Set<String> getSelectedEntities();\n\n        /**\n         * <p>The entity identifiers that cannot be used.</p>\n         */\n        Set<String> getConstrainedEntities();\n    }\n\n    /**\n     * <p>Callback methods for view's user actions.</p>\n     */\n    interface ViewCallback {\n\n        /**\n         * <p>Search entities.</p>\n         * @param pattern The search pattern.\n         */\n        void onSearch(final String pattern);\n\n        /**\n         * <p>User requests a refresh.</p>\n         */\n        void onRefresh();\n\n        /**\n         * <p>User requests a new item creation.</p>\n         */\n        void onCreate();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/EntitiesExplorerViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\n@Dependent\npublic class EntitiesExplorerViewImpl extends Composite\n        implements\n        EntitiesExplorerView {\n\n    private static EntitiesExplorerViewImplBinder uiBinder = GWT.create(EntitiesExplorerViewImplBinder.class);\n    @UiField\n    FlowPanel mainPanel;\n    @UiField\n    org.gwtbootstrap3.client.ui.Label mainLabel;\n    @UiField\n    Container mainContainer;\n    @UiField\n    Heading heading;\n    @UiField\n    Row searchRow;\n    @UiField\n    TextBox searchBox;\n    @UiField\n    Button searchButton;\n    @UiField\n    Button clearSearchButton;\n    @UiField\n    Button createButton;\n    @UiField\n    Button refreshButton;\n    @UiField(provided = true)\n    EntitiesList.View entitiesListView;\n    private String entityType;\n    private EntitiesExplorerView.ViewContext context;\n    private EntitiesExplorerView.ViewCallback callback;\n\n    @PostConstruct\n    public void init() {\n\n    }\n\n    @Override\n    public EntitiesExplorerView configure(final String entityType,\n                                          final EntitiesList.View entitiesListView) {\n        this.entitiesListView = entitiesListView;\n        this.entityType = entityType;\n\n        initWidget(uiBinder.createAndBindUi(this));\n        searchBox.addKeyDownHandler(new KeyDownHandler() {\n\n            @Override\n            public void onKeyDown(KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    doSearch(searchBox.getText());\n                }\n            }\n        });\n        searchButton.addClickHandler(e -> doSearch(searchBox.getText()));\n\n        clearSearchButton.addDomHandler(new ClickHandler() {\n                                            @Override\n                                            public void onClick(final ClickEvent clickEvent) {\n                                                doSearch(\"\");\n                                            }\n                                        },\n                                        ClickEvent.getType());\n        clearSearch();\n        return this;\n    }\n\n    @Override\n    public EntitiesExplorerView show(ViewContext context,\n                                     ViewCallback callback) {\n        // Clear current view.\n        clear();\n\n        this.context = context;\n        this.callback = callback;\n\n        // Configure available features.\n        if (this.context.canSearch()) {\n            searchRow.setVisible(true);\n        }\n        if (this.context.canCreate()) {\n            createButton.setVisible(true);\n            String createText = UsersManagementWidgetsConstants.INSTANCE.newEntity(entityType);\n            createButton.setText(createText);\n            createButton.setTitle(createText);\n        }\n\n        // Configure titles and texts using the title for the entity type.\n        final String searchForEntities = getTitleWithEntityType(UsersManagementWidgetsConstants.INSTANCE.searchFor(),\n                                                                true);\n        searchButton.setTitle(searchForEntities);\n        return this;\n    }\n\n    @Override\n    public EntitiesExplorerView showMessage(final LabelType labelType,\n                                            final String message) {\n        clear();\n        mainLabel.setText(message);\n        mainLabel.setType(labelType);\n        mainLabel.setVisible(true);\n        mainContainer.setVisible(false);\n\n        return this;\n    }\n\n    @Override\n    public EntitiesExplorerView clearSearch() {\n        final String allEntitiesHeader = getTitleWithEntityType(UsersManagementWidgetsConstants.INSTANCE.all(),\n                                                                true);\n        heading.setText(allEntitiesHeader);\n        searchBox.setText(\"\");\n        searchBox.setPlaceholder(allEntitiesHeader);\n        clearSearchButton.setEnabled(false);\n        return this;\n    }\n\n    @Override\n    public EntitiesExplorerView clear() {\n        searchRow.setVisible(false);\n        createButton.setVisible(false);\n        context = null;\n        callback = null;\n        return this;\n    }\n\n    void doSearch(final String pattern) {\n        final String pEsc = SafeHtmlUtils.htmlEscape(pattern);\n        heading.setText(UsersManagementWidgetsConstants.INSTANCE.searchResultsFor() + \" \" + pEsc);\n        clearSearchButton.setEnabled(true);\n        if (callback != null) {\n            callback.onSearch(pattern);\n        }\n    }\n\n    private String getTitleWithEntityType(final String text,\n                                          final boolean plural) {\n        final String t = entityType != null ? plural ? entityType + \"s\" : entityType : null;\n        if (t != null) {\n            return text + \" \" + t;\n        } else {\n            return text;\n        }\n    }\n\n    @UiHandler(\"createButton\")\n    public void onCreateButtonClick(final ClickEvent event) {\n        if (callback != null) {\n            callback.onCreate();\n        }\n    }\n\n    @UiHandler(\"refreshButton\")\n    public void onRefreshButtonClick(final ClickEvent event) {\n        if (callback != null) {\n            callback.onRefresh();\n        }\n    }\n\n    interface EntitiesExplorerViewImplBinder\n            extends\n            UiBinder<FlowPanel, EntitiesExplorerViewImpl> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/EntitiesExplorerViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:ufm=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.list\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style>\n    .mainPanel {\n      width: 100%;\n    }\n    .headerButton {\n      margin-top: 15px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainPanel\" addStyleNames=\"{style.mainPanel}\">\n\n    <b:Label type=\"WARNING\" ui:field=\"mainLabel\" visible=\"false\"/>\n    \n    <b:Container fluid=\"true\" ui:field=\"mainContainer\">\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <b:Row>\n            <b:Column size=\"MD_6\">\n              <b:Heading size=\"H2\" ui:field=\"heading\" text=\"{i18n.all}\"/>\n            </b:Column>\n            <b:Column size=\"MD_6\">\n              <g:HorizontalPanel width=\"100%\" height=\"100%\">\n                <g:cell horizontalAlignment=\"ALIGN_RIGHT\" verticalAlignment=\"ALIGN_BOTTOM\">\n                  <b:Button ui:field=\"createButton\" type=\"LINK\" iconPosition=\"RIGHT\" icon=\"PLUS\"\n                            text=\"{i18n.create}\" title=\"{i18n.create}\" iconSize=\"LARGE\"\n                            addStyleNames=\"{style.headerButton}\"/>\n                </g:cell>\n                <g:cell horizontalAlignment=\"ALIGN_RIGHT\" verticalAlignment=\"ALIGN_BOTTOM\">\n                  <b:Button ui:field=\"refreshButton\" type=\"LINK\" iconPosition=\"RIGHT\" icon=\"REFRESH\"\n                            text=\"{i18n.refresh}\" title=\"{i18n.refresh}\" iconSize=\"LARGE\"\n                            addStyleNames=\"{style.headerButton}\"/>\n                </g:cell>\n              </g:HorizontalPanel>\n            </b:Column>\n          </b:Row>\n          <b:Row ui:field=\"searchRow\">\n            <b:Column size=\"MD_12\" >\n              <b:InputGroup>\n                <b:TextBox ui:field=\"searchBox\" placeholder=\"{i18n.search}...\" autoComplete=\"false\"/>\n                <b:InputGroupButton>\n                  <b:Button ui:field=\"searchButton\" icon=\"SEARCH\" title=\"{i18n.search}\" />\n                </b:InputGroupButton>\n                <b:InputGroupButton>\n                  <b:Button ui:field=\"clearSearchButton\" icon=\"REMOVE\" title=\"{i18n.clearSearch}\" />\n                </b:InputGroupButton>\n              </b:InputGroup>\n            </b:Column>\n          </b:Row>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <ufm:EntitiesList.View ui:field=\"entitiesListView\"/>\n        </b:Column>\n      </b:Row>\n\n    </b:Container>\n\n  </g:FlowPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/ExplorerViewContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.Set;\n\n/**\n * <p>Explorer View context implementation that has a parent view context.</p>\n * <p>Just override methods of your interest. By default, they delegate to the parent context.</p>\n */\npublic class ExplorerViewContext implements EntitiesExplorerView.ViewContext {\n\n    private EntitiesExplorerView.ViewContext parent;\n\n    public ExplorerViewContext() {\n    }\n\n    @Override\n    public boolean canSearch() {\n        return parent.canSearch();\n    }\n\n    @Override\n    public boolean canCreate() {\n        return parent.canCreate();\n    }\n\n    @Override\n    public boolean canRead() {\n        return parent.canRead();\n    }\n\n    @Override\n    public boolean canDelete() {\n        return parent.canDelete();\n    }\n\n    @Override\n    public boolean canSelect() {\n        return parent.canSelect();\n    }\n\n    @Override\n    public Set<String> getSelectedEntities() {\n        return parent.getSelectedEntities();\n    }\n\n    @Override\n    public Set<String> getConstrainedEntities() {\n        return parent.getConstrainedEntities();\n    }\n\n    public EntitiesExplorerView.ViewContext getParent() {\n        return parent;\n    }\n\n    public void setParent(EntitiesExplorerView.ViewContext parent) {\n        this.parent = parent;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/GroupsExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\n\n/**\n * <p>Presenter class for groups explorer widget.</p>\n * <p>By default, the <code>admin</code> identifier is constrained.</p>\n */\n@Dependent\npublic class GroupsExplorer extends AbstractEntityExplorer<Group> {\n\n    private Event<ReadGroupEvent> readGroupEvent;\n    private Event<NewGroupEvent> newGroupEvent;\n\n    @Inject\n    public GroupsExplorer(final ClientUserSystemManager userSystemManager,\n                          final Event<OnErrorEvent> errorEvent,\n                          final LoadingBox loadingBox,\n                          final EntitiesList<Group> entitiesList,\n                          final EntitiesExplorerView view,\n                          final Event<ReadGroupEvent> readGroupEvent,\n                          final Event<NewGroupEvent> newGroupEvent) {\n        super(userSystemManager,\n              errorEvent,\n              loadingBox,\n              entitiesList,\n              view);\n        this.readGroupEvent = readGroupEvent;\n        this.newGroupEvent = newGroupEvent;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    protected String getEmptyText() {\n        return UsersManagementWidgetsConstants.INSTANCE.noGroups();\n    }\n\n    @Override\n    protected String getEntityType() {\n        return UsersManagementWidgetsConstants.INSTANCE.groups();\n    }\n\n    @Override\n    protected String getTitle() {\n        return UsersManagementWidgetsConstants.INSTANCE.group();\n    }\n\n    @Override\n    protected String getEntityId(final Group entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEntityName(final Group entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected boolean canSearch() {\n        return userSystemManager.isGroupCapabilityEnabled(Capability.CAN_SEARCH_GROUPS);\n    }\n\n    @Override\n    protected boolean canCreate() {\n        return userSystemManager.isGroupCapabilityEnabled(Capability.CAN_ADD_GROUP);\n    }\n\n    @Override\n    protected boolean canRead() {\n        return userSystemManager.isGroupCapabilityEnabled(Capability.CAN_READ_GROUP);\n    }\n\n    @Override\n    protected void fireReadEvent(final String identifier) {\n        readGroupEvent.fire(new ReadGroupEvent(identifier));\n    }\n\n    @Override\n    protected void showCreate() {\n        newGroupEvent.fire(new NewGroupEvent());\n    }\n\n    @Override\n    protected void showSearch() {\n        showLoadingView();\n\n        // Call backend service.\n        userSystemManager.groups(new RemoteCallback<AbstractEntityManager.SearchResponse<Group>>() {\n                                     @Override\n                                     public void callback(final AbstractEntityManager.SearchResponse<Group> response) {\n                                         if (response != null) {\n\n                                             final EntitiesList.Callback<Group> callback = createCallback();\n\n                                             entitiesList.show(response,\n                                                               callback);\n\n                                             // Show the explorer's view.\n                                             view.show(context,\n                                                       viewCallback);\n\n                                             hideLoadingView();\n                                         }\n                                     }\n                                 },\n                                 errorCallback).search(new SearchRequestImpl(searchPattern,\n                                                                             currentPage,\n                                                                             pageSize,\n                                                                             context != null ? context.getConstrainedEntities() : null));\n    }\n\n    void onGroupDeleted(@Observes final DeleteGroupEvent deleteGroupEvent) {\n        attemptToShowSearch();\n    }\n\n    void onAddUsersToGroup(@Observes final AddUsersToGroupEvent addUsersToGroupEvent) {\n        attemptToShowSearch();\n    }\n\n    void onGroupCreated(@Observes final CreateGroupEvent createGroupEvent) {\n        attemptToShowSearch();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/RolesExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\n\n/**\n * <p>Presenter class for roles explorer widget.</p>\n * <p>By default, the <code>admin</code> identifier is constrained.</p>\n */\n@Dependent\npublic class RolesExplorer extends AbstractEntityExplorer<Role> {\n\n    private Event<ReadRoleEvent> readRoleEvent;\n\n    @Inject\n    public RolesExplorer(final ClientUserSystemManager userSystemManager,\n                         final Event<OnErrorEvent> errorEvent,\n                         final LoadingBox loadingBox,\n                         final EntitiesList<Role> entitiesList,\n                         final EntitiesExplorerView view,\n                         final Event<ReadRoleEvent> readRoleEvent) {\n        super(userSystemManager,\n              errorEvent,\n              loadingBox,\n              entitiesList,\n              view);\n        this.readRoleEvent = readRoleEvent;\n    }\n\n    @Override\n    protected String getEmptyText() {\n        return UsersManagementWidgetsConstants.INSTANCE.noRoles();\n    }\n\n    @Override\n    protected String getEntityType() {\n        return UsersManagementWidgetsConstants.INSTANCE.roles();\n    }\n\n    @Override\n    protected String getTitle() {\n        return UsersManagementWidgetsConstants.INSTANCE.role();\n    }\n\n    @Override\n    protected String getEntityId(final Role entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected String getEntityName(final Role entity) {\n        return entity.getName();\n    }\n\n    @Override\n    protected boolean canSearch() {\n        return true;\n    }\n\n    @Override\n    protected boolean canCreate() {\n        return false;\n    }\n\n    @Override\n    protected boolean canRead() {\n        return true;\n    }\n\n    @Override\n    protected void fireReadEvent(final String identifier) {\n        readRoleEvent.fire(new ReadRoleEvent(identifier));\n    }\n\n    @Override\n    protected void showCreate() {\n        throw new RuntimeException(\"Role creation not supported\");\n    }\n\n    @Override\n    protected void showSearch() {\n        showLoadingView();\n\n        // Call backend service.\n        userSystemManager.roles(new RemoteCallback<AbstractEntityManager.SearchResponse<Role>>() {\n                                    @Override\n                                    public void callback(final AbstractEntityManager.SearchResponse<Role> response) {\n                                        if (response != null) {\n\n                                            final EntitiesList.Callback<Role> callback = createCallback();\n\n                                            entitiesList.show(response,\n                                                              callback);\n\n                                            // Show the explorer's view.\n                                            view.show(context,\n                                                      viewCallback);\n\n                                            hideLoadingView();\n                                        }\n                                    }\n                                },\n                                errorCallback).search(new SearchRequestImpl(searchPattern,\n                                                                            currentPage,\n                                                                            pageSize,\n                                                                            context != null ? context.getConstrainedEntities() : null));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UserGroupsExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.RemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.management.list.GroupsList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\n\n/**\n * <p>Presenter class for user's assigned groups explorer widget.</p>\n */\n@Dependent\npublic class UserGroupsExplorer implements IsWidget {\n\n    private final static int PAGE_SIZE = 5;\n    protected GroupsList groupList;\n    protected View view;\n    ConfirmBox confirmBox;\n    boolean canRemove;\n    private Event<RemoveUserGroupEvent> removeUserGroupEventEvent;\n    @Inject\n    public UserGroupsExplorer(GroupsList groupList,\n                              View view,\n                              ConfirmBox confirmBox,\n                              Event<RemoveUserGroupEvent> removeUserGroupEventEvent) {\n        this.groupList = groupList;\n        this.view = view;\n        this.confirmBox = confirmBox;\n        this.removeUserGroupEventEvent = removeUserGroupEventEvent;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @PostConstruct\n    public void init() {\n        groupList.setPageSize(PAGE_SIZE);\n        groupList.setEmptyEntitiesText(UsersManagementWidgetsConstants.INSTANCE.userHasNoGroups());\n        groupList.setEntityTitleSize(HeadingSize.H5);\n        view.configure(groupList.view);\n    }\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API \n     ****************************************************************************************************** */\n\n    public void show(final Set<Group> groups,\n                     final boolean canRemove) {\n        // Clear current view.\n        clear();\n\n        // Remove assigned group feature.\n        this.canRemove = canRemove;\n\n        groupList.show(groups,\n                       new EntitiesList.Callback<Group>() {\n\n                           @Override\n                           public String getEntityType() {\n                               return UsersManagementWidgetsConstants.INSTANCE.groupsAssigned();\n                           }\n\n                           @Override\n                           public boolean canRead() {\n                               return false;\n                           }\n\n                           @Override\n                           public boolean canRemove() {\n                               return UserGroupsExplorer.this.canRemove;\n                           }\n\n                           @Override\n                           public boolean canSelect() {\n                               return false;\n                           }\n\n                           @Override\n                           public boolean isSelected(final String id) {\n                               return groups != null && groups.contains(id);\n                           }\n\n                           @Override\n                           public String getIdentifier(final Group entity) {\n                               return entity.getName();\n                           }\n\n                           @Override\n                           public String getTitle(final Group entity) {\n                               return entity.getName();\n                           }\n\n                           @Override\n                           public void onReadEntity(final String identifier) {\n                               // Not allowed.\n                           }\n\n                           @Override\n                           public void onRemoveEntity(final String identifier) {\n                               if (identifier != null) {\n                                   confirmBox.show(UsersManagementWidgetsConstants.INSTANCE.confirmAction(),\n                                                   UsersManagementWidgetsConstants.INSTANCE.ensureRemoveGroupFromUser(),\n                                                   () -> {\n                                                       // Delegate the recently created attribute addition to the entity.\n                                                       removeUserGroupEventEvent.fire(new RemoveUserGroupEvent(UserGroupsExplorer.this,\n                                                                                                               identifier));\n                                                   },\n                                                   () -> {\n                                                   });\n                               }\n                           }\n\n                           @Override\n                           public void onSelectEntity(String identifier,\n                                                      boolean isSelected) {\n                               // Entity selection not available for the explorer widget.\n                           }\n\n                           @Override\n                           public void onChangePage(int currentPage,\n                                                    int goToPage) {\n                               // Do nothing by default, let the groupList paginate.\n                           }\n                       });\n    }\n\n    public void clear() {\n        view.clear();\n        canRemove = false;\n    }\n\n    public interface View extends UberView<UserGroupsExplorer> {\n\n        /**\n         * Configure the view with the list view instance.\n         * @param entitiesList The entities list view instance.\n         * @return The view implementation.\n         */\n        View configure(final EntitiesList.View entitiesList);\n\n        /**\n         * Clears the view..\n         * @return The view instance.\n         */\n        View clear();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UserGroupsExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\n/**\n * <p>View implementation for exploring the assigned groups or roles for a given user.</p>\n * <p>This explorer is implemented using a <code>org.gwtbootstrap3.client.ui.LinkedGroup</code> widget.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class UserGroupsExplorerView extends Composite\n        implements\n        UserGroupsExplorer.View {\n\n    private static UserGroupsExplorerViewBinder uiBinder = GWT.create(UserGroupsExplorerViewBinder.class);\n    @UiField\n    UserGroupsExplorerViewStyle style;\n    @UiField(provided = true)\n    EntitiesList.View entitiesListView;\n    private UserGroupsExplorer presenter;\n\n    @Override\n    public void init(UserGroupsExplorer presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public UserGroupsExplorer.View configure(final EntitiesList.View entitiesList) {\n        this.entitiesListView = entitiesList;\n        initWidget(uiBinder.createAndBindUi(this));\n        return this;\n    }\n\n    @Override\n    public UserGroupsExplorer.View clear() {\n        entitiesListView.clear();\n        return this;\n    }\n\n    interface UserGroupsExplorerViewBinder\n            extends\n            UiBinder<Row, UserGroupsExplorerView> {\n\n    }\n\n    interface UserGroupsExplorerViewStyle extends CssResource {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UserGroupsExplorerView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:ufm=\"urn:import:org.uberfire.ext.security.management.client.widgets.management.list\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style type=\"org.uberfire.ext.security.management.client.widgets.management.explorer.UserGroupsExplorerView.UserGroupsExplorerViewStyle\">\n  </ui:style>\n\n  <b:Row>\n    <b:Column size=\"MD_10\" offset=\"MD_1\">\n      <ufm:EntitiesList.View ui:field=\"entitiesListView\"/>\n    </b:Column>\n  </b:Row>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UsersExplorer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.ext.security.management.impl.SearchRequestImpl;\n\n/**\n * <p>Presenter class for users explorer widget.</p>\n */\n@Dependent\npublic class UsersExplorer extends AbstractEntityExplorer<User> {\n\n    Event<ReadUserEvent> readUserEvent;\n    Event<NewUserEvent> newUserEvent;\n\n    @Inject\n    public UsersExplorer(final ClientUserSystemManager userSystemManager,\n                         final Event<OnErrorEvent> errorEvent,\n                         final LoadingBox loadingBox,\n                         final EntitiesList<User> entitiesList,\n                         final EntitiesExplorerView view,\n                         final Event<ReadUserEvent> readUserEvent,\n                         final Event<NewUserEvent> newUserEvent) {\n        super(userSystemManager,\n              errorEvent,\n              loadingBox,\n              entitiesList,\n              view);\n        this.readUserEvent = readUserEvent;\n        this.newUserEvent = newUserEvent;\n    }\n\n    @Override\n    protected String getEmptyText() {\n        return UsersManagementWidgetsConstants.INSTANCE.noUsers();\n    }\n\n    @Override\n    protected String getEntityType() {\n        return UsersManagementWidgetsConstants.INSTANCE.users();\n    }\n\n    @Override\n    protected String getTitle() {\n        return UsersManagementWidgetsConstants.INSTANCE.user();\n    }\n\n    @Override\n    protected String getEntityId(final User entity) {\n        return entity.getIdentifier();\n    }\n\n    @Override\n    protected String getEntityName(final User entity) {\n        return entity.getIdentifier();\n    }\n\n    @Override\n    protected boolean canSearch() {\n        return userSystemManager.isUserCapabilityEnabled(Capability.CAN_SEARCH_USERS);\n    }\n\n    @Override\n    protected boolean canCreate() {\n        return userSystemManager.isUserCapabilityEnabled(Capability.CAN_ADD_USER);\n    }\n\n    @Override\n    protected boolean canRead() {\n        return userSystemManager.isUserCapabilityEnabled(Capability.CAN_READ_USER);\n    }\n\n    @Override\n    protected void fireReadEvent(final String identifier) {\n        readUserEvent.fire(new ReadUserEvent(identifier));\n    }\n\n    @Override\n    protected void showCreate() {\n        newUserEvent.fire(new NewUserEvent());\n    }\n\n    @Override\n    protected void showSearch() {\n        showLoadingView();\n\n        // Call backend service.\n        userSystemManager.users(new RemoteCallback<AbstractEntityManager.SearchResponse<User>>() {\n                                    @Override\n                                    public void callback(final AbstractEntityManager.SearchResponse<User> response) {\n\n                                        // Configure the entities list view.\n                                        final EntitiesList.Callback<User> callback = createCallback();\n                                        entitiesList.show(response,\n                                                          callback);\n\n                                        // Show the explorer view.\n                                        view.show(context,\n                                                  viewCallback);\n\n                                        hideLoadingView();\n                                    }\n                                },\n                                errorCallback).search(new SearchRequestImpl(searchPattern,\n                                                                            currentPage,\n                                                                            PAGE_SIZE));\n    }\n\n    void onUserDeleted(@Observes final DeleteUserEvent deleteUserEvent) {\n        attemptToShowSearch();\n    }\n\n    void onUserCreated(@Observes final CreateUserEvent createUserEvent) {\n        attemptToShowSearch();\n    }\n\n    void onUserSaved(@Observes final SaveUserEvent saveUserEvent) {\n        attemptToShowSearch();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesList.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport java.util.Collection;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\n/**\n * <p>Presenter class for listing entities.</p>\n */\n@Dependent\n@Alternative\npublic class EntitiesList<T> implements IsWidget {\n\n    protected static final int DEFAULT_PAGE_SIZE = 5;\n    public View view;\n    LoadingBox loadingBox;\n    int pageSize = DEFAULT_PAGE_SIZE;\n    HeadingSize headingSize = HeadingSize.H3;\n    Callback callback;\n    PaginationConstraints paginationConstraints;\n    int totalPages = -1;\n    String emptyEntitiesText = null;\n    @Inject\n    public EntitiesList(LoadingBox loadingBox,\n                        View view) {\n        this.loadingBox = loadingBox;\n        this.view = view;\n    }\n\n    @PostConstruct\n    protected void init() {\n        view.init(this);\n    }\n\n    public void show(final AbstractEntityManager.SearchResponse<T> response,\n                     final Callback<T> callback) {\n\n        if (callback != null && response != null) {\n            show(response.getResults(),\n                 createPaginationCallback(response),\n                 callback);\n        }\n    }\n\n    public void select(final String identifier) {\n        doSelectEntity(identifier,\n                       true);\n    }\n\n    public void unselect(final String identifier) {\n        doSelectEntity(identifier,\n                       false);\n    }\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API\n     ****************************************************************************************************** */\n\n    public void clear() {\n        callback = null;\n        paginationConstraints = null;\n        totalPages = -1;\n        emptyEntitiesText = null;\n        view.clear();\n    }\n\n    public void setPageSize(int pageSize) {\n        this.pageSize = pageSize;\n    }\n\n    public void setEmptyEntitiesText(String emptyEntitiesText) {\n        this.emptyEntitiesText = emptyEntitiesText;\n    }\n\n    public void setEntityTitleSize(HeadingSize headingSize) {\n        this.headingSize = headingSize;\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    String getEntityType() {\n        return callback.getEntityType();\n    }\n\n    void onReadEntity(final String identifier) {\n        callback.onReadEntity(identifier);\n    }\n\n    void onRemoveEntity(final String identifier) {\n        callback.onRemoveEntity(identifier);\n    }\n\n    /*  ******************************************************************************************************\n                                 PACKAGE PROTECTED METHODS FOR USING AS CALLBACKS FOR THE VIEW\n     ****************************************************************************************************** */\n\n    void onGoToFirstPage() {\n        final int currentPage = paginationConstraints.getCurrentPage();\n        callback.onChangePage(currentPage,\n                              1);\n    }\n\n    void onGoToPrevPage() {\n        final int currentPage = paginationConstraints.getCurrentPage();\n        callback.onChangePage(currentPage,\n                              currentPage - 1);\n    }\n\n    void onGoToNextPage() {\n        final int currentPage = paginationConstraints.getCurrentPage();\n        callback.onChangePage(currentPage,\n                              currentPage + 1);\n    }\n\n    void onGoToLastPage() {\n        final int currentPage = paginationConstraints.getCurrentPage();\n        if (totalPages > 0) {\n            callback.onChangePage(currentPage,\n                                  totalPages + 1);\n        }\n    }\n\n    void onSelectEntity(String identifier,\n                        int index,\n                        boolean isSelected) {\n        doSelectEntity(identifier,\n                       isSelected);\n    }\n\n    private void doSelectEntity(String identifier,\n                                boolean isSelected) {\n        callback.onSelectEntity(identifier,\n                                isSelected);\n    }\n\n    protected void show(final Collection<T> entities,\n                        final PaginationConstraints paginationConstraints,\n                        final Callback<T> callback) {\n        this.callback = callback;\n        this.paginationConstraints = paginationConstraints;\n        if (callback != null && entities != null) {\n            showLoadingView();\n\n            // Configure view and the paginator.\n            view.configure(emptyEntitiesText,\n                           paginationConstraints);\n\n            // Add the entities.\n            if (!entities.isEmpty()) {\n                int index = 0;\n                for (final T entity : entities) {\n                    final String id = callback.getIdentifier(entity);\n                    final String title = callback.getTitle(entity);\n                    final boolean isSelected = callback.isSelected(id);\n                    view.add(index,\n                             id,\n                             title,\n                             headingSize,\n                             callback.canRead(),\n                             callback.canRemove(),\n                             callback.canSelect(),\n                             isSelected);\n                    index++;\n                }\n            }\n\n            hideLoadingView();\n        }\n    }\n\n    protected PaginationConstraints createPaginationCallback(final AbstractEntityManager.SearchResponse searchResponse) {\n        if (searchResponse != null) {\n            final int page = searchResponse.getPage();\n            final int total = searchResponse.getTotal();\n\n            // If the SPI is able to get max row count, calculate total pages.\n            final int totalPagesRounded = (int) Math.ceil(total / (double) searchResponse.getPageSize());\n            EntitiesList.this.totalPages = total > -1 ? total / searchResponse.getPageSize() : -1;\n            final boolean hasNextPage = totalPages > -1 ? page < totalPagesRounded : searchResponse.hasNextPage();\n            final boolean notInFistPage = page > 1;\n            final boolean isLastPageButtonEnabled = EntitiesList.this.totalPages > -1 && hasNextPage;\n\n            return (new PaginationConstraints() {\n\n                @Override\n                public boolean isFirstPageEnabled() {\n                    return notInFistPage;\n                }\n\n                @Override\n                public boolean isFirstPageVisible() {\n                    return notInFistPage;\n                }\n\n                @Override\n                public boolean isPrevPageEnabled() {\n                    return notInFistPage;\n                }\n\n                @Override\n                public boolean isPrevPageVisible() {\n                    return notInFistPage;\n                }\n\n                @Override\n                public int getCurrentPage() {\n                    return page;\n                }\n\n                @Override\n                public boolean isNextPageEnabled() {\n                    return hasNextPage;\n                }\n\n                @Override\n                public boolean isNextPageVisible() {\n                    return hasNextPage;\n                }\n\n                @Override\n                public boolean isLastPageEnabled() {\n                    return isLastPageButtonEnabled;\n                }\n\n                @Override\n                public boolean isLastPageVisible() {\n                    return isLastPageButtonEnabled;\n                }\n\n                @Override\n                public Integer getTotal() {\n                    return total > -1 ? total : null;\n                }\n            });\n        }\n        return null;\n    }\n\n\n     /*  ******************************************************************************************************\n                                     PROTECTED METHODS FOR INTERNAL PRESENTER LOGIC\n         ****************************************************************************************************** */\n\n    protected void showLoadingView() {\n        loadingBox.show();\n    }\n\n    protected void hideLoadingView() {\n        loadingBox.hide();\n    }\n\n    public interface View extends UberView<EntitiesList> {\n\n        View configure(final String emptyEntitiesText,\n                       final PaginationConstraints paginationConstraints);\n\n        View add(final int index,\n                 final String identifier,\n                 final String title,\n                 final HeadingSize titleSize,\n                 final boolean canRead,\n                 final boolean canRemove,\n                 final boolean canSelect,\n                 final boolean isSelected);\n\n        View clear();\n    }\n\n    /**\n     * <p>The pagination constraints for view's pager component.</p>\n     */\n    public interface PaginationConstraints {\n\n        /**\n         * <p>First page button status.</p>\n         * @return The first page button will be enabled if <code>true</code>, otherwise disabled.\n         */\n        boolean isFirstPageEnabled();\n\n        /**\n         * <p>First page button visibility.</p>\n         * @return The first page button will be visible if <code>true</code>, otherwise hidden.\n         */\n        boolean isFirstPageVisible();\n\n        /**\n         * <p>Previous page button status.</p>\n         * @return The previous page button will be enabled if <code>true</code>, otherwise disabled.\n         */\n        boolean isPrevPageEnabled();\n\n        /**\n         * <p>Previous page button visibility.</p>\n         * @return The previous page button will be visible if <code>true</code>, otherwise hidden.\n         */\n        boolean isPrevPageVisible();\n\n        /**\n         * <p>Current page.</p>\n         * @return The current page.\n         */\n        int getCurrentPage();\n\n        /**\n         * <p>Next page button status.</p>\n         * @return The next page button will be enabled if <code>true</code>, otherwise disabled.\n         */\n        boolean isNextPageEnabled();\n\n        /**\n         * <p>Next page button visibility.</p>\n         * @return The next page button will be visible if <code>true</code>, otherwise hidden.\n         */\n        boolean isNextPageVisible();\n\n        /**\n         * <p>Last page button status.</p>\n         * @return The last page button will be enabled if <code>true</code>, otherwise disabled.\n         */\n        boolean isLastPageEnabled();\n\n        /**\n         * <p>Last page button visibility.</p>\n         * @return The last page button will be visible if <code>true</code>, otherwise hidden.\n         */\n        boolean isLastPageVisible();\n\n        /**\n         * <p>Show the total number of entities, if available.</p>\n         * @return The total number of entities or <code>null</code> if not available.\n         */\n        Integer getTotal();\n    }\n\n    /**\n     * <p>Callback methods for view's user actions.</p>\n     */\n    public interface Callback<T> {\n\n        /**\n         * <p>The title for the entity type to manage, such as \"user\" or \"group\".</p>\n         * @return The entity type title.\n         */\n        String getEntityType();\n\n        /**\n         * <p>Allows enabling or disabling the entities read feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities list widget enables the read feature.</li>\n         * <li><code>false</code> - The entities list widget disables the read feature.</li>\n         * </ul>\n         */\n        boolean canRead();\n\n        /**\n         * <p>Allows enabling or disabling the entities delete feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities list widget enables the delete feature.</li>\n         * <li><code>false</code> - The entities list widget disables the delete feature.</li>\n         * </ul>\n         */\n        boolean canRemove();\n\n        /**\n         * <p>Allows enabling or disabling the entities selection feature.</p>\n         * @return <p>Two possible values:</p>\n         * <ul>\n         * <li><code>true</code> - The entities list widget enables the selection feature.</li>\n         * <li><code>false</code> - The entities list widget disables the selection feature.</li>\n         * </ul>\n         */\n        boolean canSelect();\n\n        /**\n         * <p>Specify if the entity must be marked as selected..</p>\n         */\n        boolean isSelected(final String identifier);\n\n        /**\n         * <p>The entity identifier.</p>\n         * @param entity The entity.\n         * @return The entity identifier.\n         */\n        String getIdentifier(final T entity);\n\n        /**\n         * <p>The entity title.</p>\n         * @param entity The title.\n         * @return The entity identifier.\n         */\n        String getTitle(final T entity);\n\n        /**\n         * <p>Read an entity</p>\n         * @param identifier The entity's identifier to read.\n         */\n        void onReadEntity(final String identifier);\n\n        /**\n         * <p>Remove an entity</p>\n         * @param identifier The entity's identifier to remove.\n         */\n        void onRemoveEntity(final String identifier);\n\n        /**\n         * <p>Select or unselect an entity from the list.</p>\n         * @param identifier The entity's identifier to remove.\n         * @param isSelected If <code>true</code>, the entity has been selected, otherwise has been unselected.\n         */\n        void onSelectEntity(final String identifier,\n                            final boolean isSelected);\n\n        /**\n         * <p>Change current page.</p>\n         * @param currentPage Current page.\n         * @param goToPage The target page number to navigate.\n         */\n        void onChangePage(final int currentPage,\n                          final int goToPage);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesListView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.MouseOutEvent;\nimport com.google.gwt.event.dom.client.MouseOutHandler;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.event.dom.client.MouseOverHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasVerticalAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Badge;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.LinkedGroup;\nimport org.gwtbootstrap3.client.ui.LinkedGroupItem;\nimport org.gwtbootstrap3.client.ui.Pagination;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.gwtbootstrap3.client.ui.constants.IconPosition;\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\n\n/**\n * <p>View implementation for listing entities with pagination features.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class EntitiesListView extends Composite\n        implements\n        EntitiesList.View {\n\n    private static EntitiesListViewBinder uiBinder = GWT.create(EntitiesListViewBinder.class);\n    @UiField\n    EntitiesListViewStyle style;\n    @UiField\n    Row emptyEntitiesRow;\n    @UiField\n    Label emptyEntitiesLabel;\n    @UiField\n    LinkedGroup entitiesList;\n    @UiField\n    Pagination pagination;\n    @UiField\n    AnchorListItem firstPageAnchor;\n    @UiField\n    AnchorListItem prevPageAnchor;\n    @UiField\n    AnchorListItem currentPageAnchor;\n    @UiField\n    AnchorListItem nextPageAnchor;\n    @UiField\n    AnchorListItem lastPageAnchor;\n    @UiField\n    Badge totalBadge;\n    @UiField\n    HTML totalText;\n    private EntitiesList presenter;\n    private HandlerRegistration firstPageAnchorClickHandlerRegistration = null;\n    private HandlerRegistration prevPageAnchorClickHandlerRegistration = null;\n    private HandlerRegistration nextPageAnchorClickHandlerRegistration = null;\n    private HandlerRegistration lastPageAnchorClickHandlerRegistration = null;\n\n    @PostConstruct\n    protected void initUIBinder() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final EntitiesList presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public EntitiesList.View configure(final String emptyEntitiesText,\n                                       final EntitiesList.PaginationConstraints paginationConstraints) {\n        clear();\n        final String emptyText = emptyEntitiesText != null ? emptyEntitiesText : UsersManagementWidgetsConstants.INSTANCE.emptyEntities();\n        emptyEntitiesLabel.setText(emptyText);\n        applyPaginationConstraints(paginationConstraints);\n        return this;\n    }\n\n    @Override\n    public EntitiesList.View add(final int index,\n                                 final String identifier,\n                                 final String title,\n                                 final HeadingSize titleSize,\n                                 final boolean canRead,\n                                 final boolean canRemove,\n                                 final boolean canSelect,\n                                 final boolean isSelected) {\n        addEntityInList(index,\n                        identifier,\n                        title,\n                        titleSize,\n                        canRead,\n                        canRemove,\n                        canSelect,\n                        isSelected);\n        emptyEntitiesRow.setVisible(false);\n        return this;\n    }\n\n    @Override\n    public EntitiesList.View clear() {\n        entitiesList.clear();\n        emptyEntitiesRow.setVisible(true);\n        return this;\n    }\n\n    private void addEntityInList(final int index,\n                                 final String id,\n                                 final String title,\n                                 final HeadingSize titleSize,\n                                 final boolean canRead,\n                                 final boolean canRemove,\n                                 final boolean canSelect,\n                                 final boolean isSelected) {\n\n        final LinkedGroupItem groupItem = new LinkedGroupItem();\n        groupItem.addStyleName(style.entityGroup());\n        if (canRead) {\n            groupItem.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(final ClickEvent clickEvent) {\n                    presenter.onReadEntity(id);\n                }\n            });\n        }\n\n        final HorizontalPanel groupPanel = new HorizontalPanel();\n        groupPanel.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);\n        groupPanel.addStyleName(style.entityPanel());\n\n        // Entity selection feature.\n        if (canSelect) {\n            final CheckBox checkBox = new CheckBox();\n            checkBox.addStyleName(style.entityListButton());\n            checkBox.addStyleName(style.left());\n            checkBox.setValue(isSelected);\n            checkBox.addDomHandler(new ClickHandler() {\n                                       @Override\n                                       public void onClick(ClickEvent clickEvent) {\n                                           clickEvent.stopPropagation();\n                                           final boolean value = checkBox.getValue();\n                                           presenter.onSelectEntity(id,\n                                                                    index,\n                                                                    checkBox.getValue());\n                                       }\n                                   },\n                                   ClickEvent.getType());\n\n            groupPanel.add(checkBox);\n        }\n\n        // Entity title.\n        final Heading heading = new Heading(titleSize);\n        heading.setText(title);\n        heading.addStyleName(style.entityListTitle());\n        groupPanel.add(heading);\n\n        // Entity remove from list feature.\n        if (canRemove) {\n\n            // The remove button.\n            final org.gwtbootstrap3.client.ui.Button removeButton = new org.gwtbootstrap3.client.ui.Button();\n            removeButton.addStyleName(style.entityListButton());\n            removeButton.setSize(ButtonSize.EXTRA_SMALL);\n            removeButton.setIconPosition(IconPosition.RIGHT);\n            removeButton.setType(ButtonType.DEFAULT);\n            removeButton.setText(UsersManagementWidgetsConstants.INSTANCE.remove());\n            removeButton.setTitle(UsersManagementWidgetsConstants.INSTANCE.remove());\n            removeButton.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(final ClickEvent clickEvent) {\n                    presenter.onRemoveEntity(id);\n                }\n            });\n            removeButton.setVisible(false);\n            groupPanel.add(removeButton);\n\n            // Show the button on mouse over.\n            groupItem.addDomHandler(new MouseOverHandler() {\n                                        @Override\n                                        public void onMouseOver(final MouseOverEvent mouseOverEvent) {\n                                            mouseOverEvent.stopPropagation();\n                                            removeButton.setVisible(true);\n                                        }\n                                    },\n                                    MouseOverEvent.getType());\n\n            // Hide the button on mouse over.\n            groupItem.addDomHandler(new MouseOutHandler() {\n                                        @Override\n                                        public void onMouseOut(final MouseOutEvent mouseOverEvent) {\n                                            mouseOverEvent.stopPropagation();\n                                            removeButton.setVisible(false);\n                                        }\n                                    },\n                                    MouseOutEvent.getType());\n        }\n\n        groupItem.add(groupPanel);\n        entitiesList.add(groupItem);\n    }\n\n    private void applyPaginationConstraints(final EntitiesList.PaginationConstraints constraints) {\n        boolean existsPagination = constraints != null;\n        if (existsPagination) {\n            final boolean isFirstPageEnabled = constraints.isFirstPageEnabled();\n            final boolean isFirstPageVisible = constraints.isFirstPageVisible();\n            final boolean isPrevPageEnabled = constraints.isPrevPageEnabled();\n            final boolean isPrevPageVisible = constraints.isPrevPageVisible();\n            final int currentPage = constraints.getCurrentPage();\n            final boolean isNextPageEnabled = constraints.isNextPageEnabled();\n            final boolean isNextPageVisible = constraints.isNextPageVisible();\n            final boolean isLastPageEnabled = constraints.isLastPageEnabled();\n            final boolean isLastPageVisible = constraints.isLastPageVisible();\n            final Integer total = constraints.getTotal();\n\n            // Only show pagination if necesssary.\n            existsPagination = isPrevPageVisible || isNextPageVisible;\n            if (existsPagination) {\n\n                // First page anchor.\n                firstPageAnchor.setEnabled(isFirstPageEnabled);\n                firstPageAnchor.setVisible(isFirstPageVisible);\n                if (firstPageAnchorClickHandlerRegistration != null) {\n                    firstPageAnchorClickHandlerRegistration.removeHandler();\n                }\n                ;\n                firstPageAnchorClickHandlerRegistration = firstPageAnchor.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent clickEvent) {\n                        clickEvent.stopPropagation();\n                        if (isFirstPageEnabled) {\n                            presenter.onGoToFirstPage();\n                        }\n                    }\n                });\n\n                // Previous page anchor.\n                prevPageAnchor.setEnabled(isPrevPageEnabled);\n                prevPageAnchor.setVisible(isPrevPageVisible);\n                if (prevPageAnchorClickHandlerRegistration != null) {\n                    prevPageAnchorClickHandlerRegistration.removeHandler();\n                }\n                ;\n                prevPageAnchorClickHandlerRegistration = prevPageAnchor.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent clickEvent) {\n                        clickEvent.stopPropagation();\n                        if (isPrevPageEnabled) {\n                            presenter.onGoToPrevPage();\n                        }\n                    }\n                });\n\n                // Current page anchor.\n                currentPageAnchor.setText(Integer.toString(currentPage));\n\n                // Next page anchor.\n                nextPageAnchor.setEnabled(isNextPageEnabled);\n                nextPageAnchor.setVisible(isNextPageVisible);\n                if (nextPageAnchorClickHandlerRegistration != null) {\n                    nextPageAnchorClickHandlerRegistration.removeHandler();\n                }\n                ;\n                nextPageAnchorClickHandlerRegistration = nextPageAnchor.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent clickEvent) {\n                        clickEvent.stopPropagation();\n                        if (isNextPageEnabled) {\n                            presenter.onGoToNextPage();\n                        }\n                    }\n                });\n\n                // Last page anchor.\n                lastPageAnchor.setEnabled(isLastPageEnabled);\n                lastPageAnchor.setVisible(isLastPageVisible);\n                if (lastPageAnchorClickHandlerRegistration != null) {\n                    lastPageAnchorClickHandlerRegistration.removeHandler();\n                }\n                ;\n                lastPageAnchorClickHandlerRegistration = lastPageAnchor.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent clickEvent) {\n                        clickEvent.stopPropagation();\n                        if (isLastPageEnabled) {\n                            presenter.onGoToLastPage();\n                        }\n                    }\n                });\n            }\n\n            // Show total if available.\n            if (total == null || total == 0) {\n                totalBadge.setVisible(false);\n            } else {\n                final String t = UsersManagementWidgetsConstants.INSTANCE.total() + \" \" + total.toString() + \" \" + presenter.getEntityType();\n                totalText.setText(t);\n                totalBadge.setVisible(true);\n            }\n        }\n        pagination.setVisible(existsPagination);\n    }\n\n    interface EntitiesListViewBinder\n            extends\n            UiBinder<Row, EntitiesListView> {\n\n    }\n\n    interface EntitiesListViewStyle extends CssResource {\n\n        String entityPanel();\n\n        String entityGroup();\n\n        String entitiesList();\n\n        String entityListTitle();\n\n        String entityListButton();\n\n        String left();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesListView.ui.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants\"/>\n\n  <ui:style type=\"org.uberfire.ext.security.management.client.widgets.management.list.EntitiesListView.EntitiesListViewStyle\">\n    .emptyEntitiesRow{\n      margin-top: 15px;\n    }\n    .entityPanel {\n      min-height: 20px;\n      max-height: 40px;\n    }\n    .entitiesList {\n      margin-top: 15px;\n    }\n    .entityGroup {\n      background-color: #f5f5f5;\n    }\n    .entityListTitle {\n      float: left;\n      margin: 5px;\n    }\n    .entityListButton {\n      vertical-align: middle;\n      margin: 5px;\n      margin-left: 15px;\n    }\n    .paginationColumn {\n      text-align: left;\n    }\n    .totalColumn {\n      text-align: right;\n    }\n    .createColumn {\n      text-align: right;\n    }\n    .left {\n      float: left;\n    }\n    .totalBadge {\n      margin-left: 5px;\n    }\n  </ui:style>\n\n\n  <b:Row>\n    <b:Column size=\"MD_12\">\n      <b:Row ui:field=\"emptyEntitiesRow\" addStyleNames=\"{style.emptyEntitiesRow}\">\n        <b:Column size=\"MD_12\">\n          <b:Label type=\"DEFAULT\" ui:field=\"emptyEntitiesLabel\" text=\"{i18n.emptyEntities}\"/>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_12\">\n          <b:LinkedGroup ui:field=\"entitiesList\" addStyleNames=\"{style.entitiesList}\">\n            <!-- Entities go here. -->\n          </b:LinkedGroup>\n        </b:Column>\n      </b:Row>\n\n      <b:Row>\n        <b:Column size=\"MD_10\" addStyleNames=\"{style.paginationColumn}\">\n          <g:HorizontalPanel verticalAlignment=\"ALIGN_MIDDLE\">\n            <b:Pagination ui:field=\"pagination\">\n              <b:AnchorListItem ui:field=\"firstPageAnchor\" enabled=\"true\" title=\"{i18n.firstPage}\" icon=\"ANGLE_DOUBLE_LEFT\"/>\n              <b:AnchorListItem ui:field=\"prevPageAnchor\" enabled=\"true\" title=\"{i18n.previousPage}\" icon=\"ANGLE_LEFT\"/>\n              <b:AnchorListItem ui:field=\"currentPageAnchor\" enabled=\"false\" text=\"0\"/>\n              <b:AnchorListItem ui:field=\"nextPageAnchor\" enabled=\"true\" title=\"{i18n.nextPage}\" icon=\"ANGLE_RIGHT\"/>\n              <b:AnchorListItem ui:field=\"lastPageAnchor\" enabled=\"true\" title=\"{i18n.lastPage}\" icon=\"ANGLE_DOUBLE_RIGHT\"/>\n            </b:Pagination>\n            <b:Badge ui:field=\"totalBadge\" addStyleNames=\"{style.totalBadge}\">\n              <g:HTML ui:field=\"totalText\"/>\n            </b:Badge>  \n          </g:HorizontalPanel>\n        </b:Column>\n      </b:Row>\n    </b:Column>\n  </b:Row>\n  \n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesPagedList.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport java.util.Collection;\nimport java.util.LinkedList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\n/**\n * <p>Presenter class for listing entities, with automatic pagination feature management.</p>\n * <p>Notes:</p>\n * <ul>\n * <li>\n * <p>By default the <code>onChangePage</code> callback method is not fired, it's handled by this class itself.</p>\n * </li>\n * </ul>\n * @since 0.8.0\n */\n@Dependent\n@Alternative\npublic class EntitiesPagedList<T> extends EntitiesList<T> {\n\n    protected Collection<T> entities;\n    protected Callback<T> callback;\n    protected int currentPage = -1;\n\n    @Inject\n    public EntitiesPagedList(LoadingBox loadingBox,\n                             View view) {\n        super(loadingBox,\n              view);\n    }\n\n    /*  ******************************************************************************************************\n                                 PUBLIC PRESENTER API\n     ****************************************************************************************************** */\n    public void show(final Collection<T> entities,\n                     final Callback<T> callback) {\n        if (this.currentPage == -1) {\n            this.currentPage = 1;\n        }\n        this.entities = entities;\n        this.callback = callback;\n        show();\n    }\n\n\n    /*  ******************************************************************************************************\n                                 PROTECTED PRESENTER API FOR IMPL WIDGETS\n     ****************************************************************************************************** */\n\n    protected void show() {\n        if (callback != null && getEntities() != null) {\n            final int size = getEntities().size();\n            EntitiesPagedList.this.totalPages = size / pageSize;\n            final int start = (currentPage - 1) * pageSize;\n            final boolean hasMorePages = hasMorePages();\n            final int end = hasMorePages ? (start + pageSize) : size;\n            final List<T> pageEntities = buildPageEntities(start,\n                                                           end);\n            final PaginationConstraints paginationConstraints = buildPaginationConstraints(size);\n            show(pageEntities,\n                 paginationConstraints,\n                 callback);\n        }\n    }\n\n\n\n    /*  ******************************************************************************************************\n                                 PROTECTED METHODS FOR INTERNAL PRESENTER LOGIC\n     ****************************************************************************************************** */\n\n    @Override\n    void onGoToFirstPage() {\n        if (this.currentPage > -1) {\n            this.currentPage = 1;\n            show();\n        } else {\n            super.onGoToFirstPage();\n        }\n    }\n\n    @Override\n    void onGoToPrevPage() {\n        if (this.currentPage > -1) {\n            this.currentPage = paginationConstraints.getCurrentPage() - 1;\n            show();\n        } else {\n            super.onGoToPrevPage();\n        }\n    }\n\n    @Override\n    void onGoToNextPage() {\n        if (this.currentPage > -1) {\n            this.currentPage = paginationConstraints.getCurrentPage() + 1;\n            show();\n        } else {\n            super.onGoToNextPage();\n        }\n    }\n\n    @Override\n    void onGoToLastPage() {\n        if (this.currentPage > -1) {\n            this.currentPage = totalPages + 1;\n            show();\n        } else {\n            super.onGoToLastPage();\n        }\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        entities = null;\n        callback = null;\n        currentPage = -1;\n    }\n\n    protected Collection<T> getEntities() {\n        return entities;\n    }\n\n    protected List<T> buildPageEntities(final int start,\n                                        final int end) {\n        return new LinkedList<T>(getEntities()).subList(start,\n                                                        end);\n    }\n\n    protected PaginationConstraints buildPaginationConstraints(final int size) {\n        final boolean hasMorePages = hasMorePages();\n        final boolean isNotFirstPage = currentPage > 1;\n        return new PaginationConstraints() {\n            @Override\n            public boolean isFirstPageEnabled() {\n                return isNotFirstPage;\n            }\n\n            @Override\n            public boolean isFirstPageVisible() {\n                return isNotFirstPage;\n            }\n\n            @Override\n            public boolean isPrevPageEnabled() {\n                return isNotFirstPage;\n            }\n\n            @Override\n            public boolean isPrevPageVisible() {\n                return isNotFirstPage;\n            }\n\n            @Override\n            public int getCurrentPage() {\n                return currentPage;\n            }\n\n            @Override\n            public boolean isNextPageEnabled() {\n                return hasMorePages;\n            }\n\n            @Override\n            public boolean isNextPageVisible() {\n                return hasMorePages;\n            }\n\n            @Override\n            public boolean isLastPageEnabled() {\n                return hasMorePages;\n            }\n\n            @Override\n            public boolean isLastPageVisible() {\n                return hasMorePages;\n            }\n\n            @Override\n            public Integer getTotal() {\n                return size;\n            }\n        };\n    }\n\n    protected boolean hasMorePages() {\n        return currentPage < EntitiesPagedList.this.totalPages;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/GroupsList.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\n/**\n * <p>Presenter class for listing groups, includes the super-type pagination features.</p>\n */\n@Dependent\npublic class GroupsList extends EntitiesPagedList<Group> {\n\n    ClientUserSystemManager userSystemManager;\n\n    @Inject\n    public GroupsList(LoadingBox loadingBox,\n                      View view,\n                      ClientUserSystemManager userSystemManager) {\n        super(loadingBox,\n              view);\n        this.userSystemManager = userSystemManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/RolesList.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\n/**\n * <p>Presenter class for listing roles, includes the super-type pagination features.</p>\n */\n@Dependent\npublic class RolesList extends EntitiesPagedList<Role> {\n\n    ClientUserSystemManager userSystemManager;\n\n    @Inject\n    public RolesList(LoadingBox loadingBox,\n                     View view,\n                     ClientUserSystemManager userSystemManager) {\n        super(loadingBox,\n              view);\n        this.userSystemManager = userSystemManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/management/list/UsersList.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\n@Dependent\npublic class UsersList extends EntitiesList<User> {\n\n    @Inject\n    public UsersList(LoadingBox loadingBox,\n                     View view) {\n        super(loadingBox,\n              view);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/ConfirmBox.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>A confirmation box presenter.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class ConfirmBox {\n\n    View view;\n\n    @Inject\n    public ConfirmBox(final View view) {\n        this.view = view;\n    }\n\n    public void show(final String title,\n                     final String message,\n                     final org.uberfire.mvp.Command yesCommand) {\n        view.show(title,\n                  message,\n                  yesCommand);\n    }\n\n    public void show(final String title,\n                     final String message,\n                     final org.uberfire.mvp.Command yesCommand,\n                     Command noCancelCommand) {\n        view.show(title,\n                  message,\n                  yesCommand,\n                  noCancelCommand);\n    }\n\n    public void show(final String title,\n                     final String message,\n                     final org.uberfire.mvp.Command yesCommand,\n                     final org.uberfire.mvp.Command noCommand,\n                     final org.uberfire.mvp.Command cancelCommand) {\n        view.show(title,\n                  message,\n                  yesCommand,\n                  noCommand,\n                  cancelCommand);\n    }\n\n    public interface View {\n\n        void show(final String title,\n                  final String message,\n                  final org.uberfire.mvp.Command yesCommand,\n                  final org.uberfire.mvp.Command noCommand,\n                  final org.uberfire.mvp.Command cancelCommand);\n\n        void show(final String title,\n                  final String message,\n                  final org.uberfire.mvp.Command yesCommand,\n                  final org.uberfire.mvp.Command noCommand);\n\n        void show(final String title,\n                  final String message,\n                  final org.uberfire.mvp.Command yesCommand);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/ConfirmBoxView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.mvp.Command;\n\n/**\n * <p>A confirm box view using <code>org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup</code>.</p>\n * @since 0.8.0\n */\npublic class ConfirmBoxView implements ConfirmBox.View {\n\n    @Override\n    public void show(final String title,\n                     final String message,\n                     final Command yesCommand,\n                     final Command noCommand,\n                     final Command cancelCommand) {\n        YesNoCancelPopup.newYesNoCancelPopup(title,\n                                             message,\n                                             yesCommand,\n                                             noCommand,\n                                             cancelCommand).show();\n    }\n\n    @Override\n    public void show(String title,\n                     String message,\n                     Command yesCommand,\n                     Command noCommand) {\n        YesNoCancelPopup.newYesNoCancelPopup(title,\n                                             message,\n                                             yesCommand,\n                                             noCommand,\n                                             null).show();\n    }\n\n    @Override\n    public void show(String title,\n                     String message,\n                     Command yesCommand) {\n        YesNoCancelPopup.newYesNoCancelPopup(title,\n                                             message,\n                                             yesCommand,\n                                             null,\n                                             null).show();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/ErrorBox.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n/**\n * <p>An error box presenter.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class ErrorBox {\n\n    View view;\n\n    @Inject\n    public ErrorBox(final View view) {\n        this.view = view;\n    }\n\n    public void show(final String message) {\n        view.show(message);\n    }\n\n    public interface View {\n\n        void show(final String message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/ErrorBoxView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup;\n\n/**\n * <p>An error box view using <code>org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup</code>.</p>\n * @since 0.8.0\n */\npublic class ErrorBoxView implements ErrorBox.View {\n\n    @Override\n    public void show(final String message) {\n        ErrorPopup.showMessage(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/LoadingBox.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.ext.security.management.client.resources.i18n.UsersManagementWidgetsConstants;\n\n/**\n * <p>An loading box presenter.</p>\n * @since 0.8.0\n */\n@Dependent\npublic class LoadingBox {\n\n    View view;\n\n    @Inject\n    public LoadingBox(View view) {\n        this.view = view;\n    }\n\n    public void show() {\n        view.show(UsersManagementWidgetsConstants.INSTANCE.loading());\n    }\n\n    public void hide() {\n        view.close();\n    }\n\n    public interface View {\n\n        void show(String message);\n\n        void close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/java/org/uberfire/ext/security/management/client/widgets/popup/LoadingBoxView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\n\n/**\n * <p>A loading box view using <code>org.uberfire.ext.widgets.common.client.common.BusyPopup</code>.</p>\n * @since 0.8.0\n */\npublic class LoadingBoxView implements LoadingBox.View {\n\n    @Override\n    public void show(final String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void close() {\n        BusyPopup.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/UberfireSecurityManagementWidgets.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~    http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.toggleswitch.ToggleSwitch\"/>\n  <inherits name=\"org.jboss.errai.enterprise.CDI\"/>\n  <inherits name=\"org.jboss.errai.security.Security\"/>\n  <inherits name=\"org.jboss.errai.ui.nav.Navigation\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementAPI\"/>\n  <inherits name=\"org.uberfire.ext.security.management.UberfireSecurityManagementClient\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectResourceInstance=- Select {0} -\nsearchResourceInstance=Search {0} ...\nresourceInstanceNotFound={0} not found\naddChildException=Add Exception\nclearChildren=Delete All\ncan=Can\ncant=Can''t\ncanOnly=Can only\nall=all\nbut=but\nfollowing=the following\nswitchAllow=Allow\nswitchDeny=Deny\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectResourceInstance=- Seleccionar {0} -\nsearchResourceInstance=Buscar {0}…\nresourceInstanceNotFound=No se encuentra {0}\naddChildException=Agregar excepción\nclearChildren=Eliminar todo\ncan=Puede\ncant=No puede\ncanOnly=Solo puede\nall=todo\nbut=pero\nfollowing=lo siguiente\nswitchAllow=Permitir\nswitchDeny=Denegar\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectResourceInstance=- Sélectionner {0} -\nsearchResourceInstance=Rechercher {0}…\nresourceInstanceNotFound={0} non trouvé\naddChildException=Ajouter une exception\nclearChildren=Supprimer tout\ncan=Peut\ncant=Ne peut pas\ncanOnly=Peut uniquement\nall=tous\nbut=mais\nfollowing=les éléments suivants\nswitchAllow=Autoriser\nswitchDeny=Refuser\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectResourceInstance=- Seleziona {0} -\nsearchResourceInstance=Cerca {0} ...\nresourceInstanceNotFound={0} non trovato\naddChildException=Aggiungi Eccezione\nclearChildren=Elimina Tutto\ncan=Può\ncant=Non può\ncanOnly=Può solo\nall=tutti\nbut=ma\nfollowing=il seguente\nswitchAllow=Consenti\nswitchDeny=Nega\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/SecurityManagementConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nselectResourceInstance=- {0} の選択 -\nsearchResourceInstance= {0} を検索中...\nresourceInstanceNotFound={0} は見つかりません\naddChildException=例外の追加\nclearChildren=すべて削除\ncan=可能\ncant=不可\ncanOnly=限定して可能\nall=すべての式が有効な場合は、\nbut=例外\nfollowing=次の\nswitchAllow=許可\nswitchDeny=拒否\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nloading=Loading\nemptyEntities=There are no entities\nfirstPage=First page\npreviousPage=Previous page\nnextPage=Next page\nlastPage=Last page\nnext=Next\nuserHasNoAttributes=No attributes\nattributeIsMandatory=Attribute is mandatory. Cannot be removed\nuserHasNoGroups=User does not have any groups assigned\nmemberOfGroups=Groups\ngroupSelectionFor=Group selection for\nuserHasNoRoles=User does not have any roles assigned\nmemberOfRoles=Roles\npermissions=Permissions\nroleSelectionFor=Role selection for\nuserAttributes=Attributes\nname=Name\nvalue=Value\nsearch=Search\nsearchFor=Search for\nsearchResultsFor=Search results for \nedit=Edit\ndelete=Delete\ncancel=Cancel\ncreate=Create\nsave=Save\nsaveChanges=Save\naddToGroups=Add to groups\naddToRoles=Add roles\naddAttribute=Add Attribute\nadd=Add\nconfirmAction=Please confirm the action\nensureRemoveUser=Are you sure you want to remove the user?\nensureRemoveGroup=Are you sure you want to remove the group?\nensureUserHasGroupsOrRoles=No assignments present, the user could be not able to log into the application\ngenericError=Error\nremove=Remove\nensureRemoveAttribute=Are you sure you want to remove the attribute?\nensureRemoveGroupFromUser=Are you sure you want to remove the group?\nensureRemoveRoleFromUser=Are you sure you want to remove the role?\nnameIsMandatory=Name is mandatory\nvalueIsMandatory=Value is mandatory\nattributeAlreadyExists=Attribute already exists\naddToSelectedGroups=Add to selected groups\naddToSelectedRoles=Add to selected roles\nassignUsersToGroupName=Assign users to group\ngroupMustHaveAtLeastOneUser=Group must have at least one user\naddUsersToGroup=Add selected users \ndoesNotHavePrivileges=Not available\npatternAlphanumericSymbols=Only alphanumeric characters are valid with the exception of the following accepted symbols\nusername=My username\ninvalidUserName=The user name is not valid\ninputUserName=Please introduce the user name\ngroupName=My group\ninvalidGroupName=The group name is not valid\ninputGroupName=Please introduce the group name\nuserIsDirty=Current editing user has been modified and not saved. Are you sure you want to discard your changes?\nchangePassword=Change password\nchangePasswordFor=Change password for\nnewPassword=New password\nrepeatNewPassword=Repeat new password\npasswordCannotBeEmpty=Password cannot be empty\npasswordsNotMatch=Passwords do not match\npasswordUpdatedSuccessfully=Password updated successfully\ndoSetPasswordNow=Do you want to set a password now?\nclear=Clear\nclearSearch=Clear current search\nchange=Change\nuser=user\nusers=users\ngroup=group\ngroups=groups\ngroupsAssigned=groups assigned\nrolesAssigned=roles assigned\nrole=role\nroles=roles\nnoUsers=No users\nnoGroups=No groups\nnoRoles=No roles\nrefresh=Refresh\ntotal=Total\nall=All\nroleSettings={0} settings\nroleIsDirty=Current editing role has been modified and not saved. Are you sure you want to discard your changes?\ngroupIsDirty=Current editing group has been modified and not saved. Are you sure you want to discard your changes?\nuserModified=User {0} has been modified. Please save your changes to apply them\nuserStillNotCreated=User {0} still not created, please continue the edition and click on Create button when finished\nuserCreated=User {0} has been created\nuserSaved=User {0} has been saved\nuserRemoved=User {0} has been deleted\ngroupCreated=Group {0} has been created\ngroupRemoved=Group {0} has been removed\nusersAssigned=Users assigned for group {0}\nroleModified=Role {0} has been modified. Please save your changes to apply them\nroleSaved=Role {0} has been saved\ngroupSettings={0} settings\ngroupModified=Group {0} has been modified. Please save your changes to apply them\ngroupSaved=Group {0} has been saved\nnewEntity=New {0}\nhomePerspective=Home Page\nnoHomePerspective=NO HOME DEFINED\nhomePerspectiveReadDenied=Read access to the selected Home Page is denied. Please, review the permissions.\npriority=Priority\nhomePerspectiveTooltip=The page where the user is directed after login\npriorityTooltip=Used to determine what settings (home page, permissions, ...) have precedence for those users with more that one role or group assigned\nselectPriorityHint=- Select Priority -\npriorityVeryHigh=Very High\npriorityHigh=High\npriorityNormal=Normal\npriorityLow=Low\npriorityVeryLow=Very Low\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_de.properties",
    "content": "loading=Wird geladen\nemptyEntities=Keine Entities vorhanden.\nfirstPage=Erste Seite\npreviousPage=Vorherige Seite\nnextPage=Nächste Seite\nlastPage=Letzte Seite\nnext=Weiter\nuserHasNoAttributes=Keine Attribute\nattributeIsMandatory=Attribute sind obligatorisch. Können nicht entfernt werden\nuserHasNoGroups=Benutzer ist keinen Gruppen zugeordnet\nmemberOfGroups=Gruppen\ngroupSelectionFor=Gruppenauswahl für\nuserHasNoRoles=Benutzer ist keinen Rollen zugeordnet\nmemberOfRoles=Rollen\nroleSelectionFor=Rollenauswahl für\nuserAttributes=Attribute\nname=Name\nvalue=Wert\nsearch=Suche\nsearchFor=Suchen nach\nsearchResultsFor=Suchergebnisse für\nedit=Bearbeiten\ndelete=Löschen\ncancel=Abbrechen\ncreate=Erstellen\nsave=Speichern\naddToGroups=Zu Gruppen hinzufügen\naddToRoles=Rollen hinzufgen\naddAttribute=Attribut hinzufügen\nadd=Hinzufügen\nconfirmAction=Bitte bestätigen Sie die Aktion \nensureRemoveUser=Sind Sie sicher, dass Sie den Benutzer entfernen möchten?\nensureRemoveGroup=Sind Sie sicher, dass Sie die Gruppe entfernen möchten?\ngenericError=Fehler\nremove=Entfernen\nensureRemoveAttribute=Sind Sie sicher, dass Sie das Attribut entfernen möchten?\nensureRemoveGroupFromUser=Sind Sie sicher, dass Sie die Gruppe entfernen möchten?\nensureRemoveRoleFromUser=Sind Sie sicher, dass Sie die Rolle entfernen möchten?\nnameIsMandatory=Name ist obligatorisch\nvalueIsMandatory=Wert ist obligatorisch\nattributeAlreadyExists=Attribut existiert bereits\naddToSelectedGroups=Zu ausgewählten Gruppen hinzufügen\naddToSelectedRoles=Zu ausgewählten Rollen hinzufügen\nassignUsersToGroupName=Benutzer der Gruppe zuweisen\ngroupMustHaveAtLeastOneUser=Gruppe muss mindestens einen Benutzer haben\naddUsersToGroup=Ausgewählte Benutzer hinzufügen\ndoesNotHavePrivileges=Nicht verfügbar\nusername=Mein Benutzername\ninputUserName=Bitte geben Sie den Benutzernamen ein\ngroupName=Meine Gruppe \ninputGroupName=Bitte geben Sie den Gruppennamen ein\nuserIsDirty=Aktuell bearbeiteter Benutzer wurde geändert und nicht gespeichert. Sind Sie sicher, dass Sie Ihre Änderungen verwerfen möchten?\nchangePassword=Passwort ändern\nchangePasswordFor=Passwort ändern für\nnewPassword=Neues Passwort\nrepeatNewPassword=Neues Passwort wiederholen\npasswordCannotBeEmpty=Passwort kann nicht leer sein\npasswordsNotMatch=Passworte stimmen nicht überein\npasswordUpdatedSuccessfully=Passwort erfolgreich aktualisiert\ndoSetPasswordNow=Möchten Sie jetzt ein Passwort einrichten?\nclear=Löschen\nclearSearch=Aktuelle Suche löschen\nchange=Ändern\nuser=Benutzer\nusers=Benutzer\ngroup=Gruppe\ngroups=Gruppen\ngroupsAssigned=Gruppen zugewiesen\nrolesAssigned=Rollen zugeordnet\nrole=Rolle \nroles=Rollen\nnoUsers=Keine Benutzer\nnoGroups=Keine Gruppen\nnoRoles=Keine Rollen\nrefresh=Aktualisieren\ntotal=Gesamt\nall=Alle\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nloading=Cargando\nemptyEntities=No hay entidades\nfirstPage=Primera página\npreviousPage=Página anterior\nnextPage=Página siguiente\nlastPage=Última página\nnext=Siguiente\nuserHasNoAttributes=Sin atributos\nattributeIsMandatory=El atributo es obligatorio. No se puede quitar\nuserHasNoGroups=El usuario no tiene ningún grupo asignado\nmemberOfGroups=Grupos\ngroupSelectionFor=Selección de grupo para\nuserHasNoRoles=El usuario no tiene ninguna función asignada\nmemberOfRoles=Funciones\npermissions=Permisos\nroleSelectionFor=Selección de función para\nuserAttributes=Atributos\nname=Nombre\nvalue=Valor\nsearch=Buscar\nsearchFor=Búsqueda de\nsearchResultsFor=Resultados de la búsqueda de \nedit=Editar\ndelete=Eliminar\ncancel=Cancelar\ncreate=Crear\nsave=Guardar\nsaveChanges=Guardar\naddToGroups=Agregar a grupos\naddToRoles=Agregar funciones\naddAttribute=Agregar atributo\nadd=Agregar\nconfirmAction=Confirme la acción\nensureRemoveUser=¿Está seguro de que desea quitar el usuario?\nensureRemoveGroup=¿Está seguro de que desea quitar el grupo?\nensureUserHasGroupsOrRoles=No hay asignaciones presentes, el usuario no puede acceder a la aplicación\ngenericError=Error\nremove=Quitar\nensureRemoveAttribute=¿Está seguro de que desea quitar el atributo?\nensureRemoveGroupFromUser=¿Está seguro de que desea quitar el grupo?\nensureRemoveRoleFromUser=¿Está seguro de que desea quitar la función?\nnameIsMandatory=El nombre es obligatorio\nvalueIsMandatory=El valor es obligatorio\nattributeAlreadyExists=El atributo ya existe\naddToSelectedGroups=Agregar a grupos seleccionados\naddToSelectedRoles=Agregar a funciones seleccionadas\nassignUsersToGroupName=Asignar usuarios al grupo\ngroupMustHaveAtLeastOneUser=El grupo debe tener al menos un usuario\naddUsersToGroup=Agregar usuarios seleccionados \ndoesNotHavePrivileges=No disponible\npatternAlphanumericSymbols=Solo son válidos los caracteres alfanuméricos, con la excepción de los siguientes símbolos aceptados\nusername=Mi nombre de usuario\ninvalidUserName=El nombre de usuario no es válido\ninputUserName=Introduzca el nombre de usuario\ngroupName=Mi grupo\ninvalidGroupName=El nombre del grupo no es válido\ninputGroupName=Introduzca el nombre del grupo\nuserIsDirty=El usuario de edición actual se ha modificado y no se guardó. ¿Está seguro de que desea descartar sus cambios?\nchangePassword=Cambiar la contraseña\nchangePasswordFor=Cambiar la contraseña de\nnewPassword=Nueva contraseña\nrepeatNewPassword=Repita la nueva contraseña\npasswordCannotBeEmpty=La contraseña no puede estar vacía\npasswordsNotMatch=Las contraseñas no coinciden\npasswordUpdatedSuccessfully=La contraseña se actualizó correctamente\ndoSetPasswordNow=¿Desea establecer una contraseña ahora?\nclear=Borrar\nclearSearch=Borrar la búsqueda actual\nchange=Cambiar\nuser=usuario\nusers=usuarios\ngroup=grupo\ngroups=grupos\ngroupsAssigned=grupos asignados\nrolesAssigned=funciones asignadas\nrole=función\nroles=funciones\nnoUsers=No hay usuarios\nnoGroups=No hay grupos\nnoRoles=No hay funciones\nrefresh=Actualizar\ntotal=Total\nall=Todo\nroleSettings=Ajustes de {0}\nroleIsDirty=La función de edición actual se ha modificado y no se guardó. ¿Está seguro de que desea descartar sus cambios?\ngroupIsDirty=El grupo de edición actual se ha modificado y no se guardó. ¿Está seguro de que desea descartar sus cambios?\nuserModified=El usuario {0} se ha modificado. Guarde sus cambios para aplicarlos\nuserStillNotCreated=El usuario {0} aún no se ha creado; continúe la edición y haga clic en el botón Crear cuando termine\nuserCreated=El usuario {0} se ha creado\nuserSaved=El usuario {0} se ha guardado\nuserRemoved=El usuario {0} se ha eliminado\ngroupCreated=El grupo {0} se ha creado\ngroupRemoved=Se ha quitado el grupo {0}\nusersAssigned=Usuarios asignados para el grupo {0}\nroleModified=La función {0} se ha modificado. Guarde sus cambios para aplicarlos\nroleSaved=La función {0} se ha guardado\ngroupSettings=Ajustes de {0}\ngroupModified=El grupo {0} se ha modificado. Guarde sus cambios para aplicarlos\ngroupSaved=El grupo {0} se ha guardado\nnewEntity=Nuevo {0}\nhomePerspective=Página de inicio\nnoHomePerspective=NO HAY UN INICIO DEFINIDO\nhomePerspectiveReadDenied=El acceso de lectura a la página de inicio seleccionada está denegado. Revise los permisos.\npriority=Prioridad\nhomePerspectiveTooltip=La página a la que se dirige al usuario después de iniciar sesión\npriorityTooltip=Se usa para determinar qué ajustes (página de inicio, permisos, etc.) tienen prioridad para aquellos usuarios con más de una función o un grupo asignados\nselectPriorityHint=- Seleccionar la prioridad -\npriorityVeryHigh=Muy alto\npriorityHigh=Alto\npriorityNormal=Normal\npriorityLow=Bajo\npriorityVeryLow=Muy bajo\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nloading=Chargement\nemptyEntities=Il n''y a aucune entité\nfirstPage=Première page\npreviousPage=Page précédente\nnextPage=Page suivante\nlastPage=Dernière page\nnext=Suivant\nuserHasNoAttributes=Aucun attribut\nattributeIsMandatory=L''attribut est obligatoire. Suppression impossible\nuserHasNoGroups=Aucun groupe n''est affecté à l''utilisateur\nmemberOfGroups=Groupes\ngroupSelectionFor=Sélection de groupe pour\nuserHasNoRoles=Aucun rôle n''est affecté à l''utilisateur\nmemberOfRoles=Rôles\npermissions=Autorisations\nroleSelectionFor=Sélection de rôle pour\nuserAttributes=Attributs\nname=Nom\nvalue=Valeur\nsearch=Rechercher\nsearchFor=Rechercher\nsearchResultsFor=Résultats de la recherche pour \nedit=Modifier\ndelete=Supprimer\ncancel=Annuler\ncreate=Créer\nsave=Enregistrer\nsaveChanges=Enregistrer\naddToGroups=Ajouter aux groupes\naddToRoles=Ajouter des rôles\naddAttribute=Ajouter un attribut\nadd=Ajouter\nconfirmAction=Veuillez confirmer l''action\nensureRemoveUser=Voulez-vous vraiment supprimer cet utilisateur ?\nensureRemoveGroup=Voulez-vous vraiment supprimer ce groupe ?\nensureUserHasGroupsOrRoles=Aucune affectation présente. Il se peut que l''utilisateur ne soit pas en mesure de se connecter à l''application.\ngenericError=Erreur\nremove=Supprimer\nensureRemoveAttribute=Voulez-vous vraiment supprimer cet attribut ?\nensureRemoveGroupFromUser=Voulez-vous vraiment supprimer ce groupe ?\nensureRemoveRoleFromUser=Voulez-vous vraiment supprimer ce rôle ?\nnameIsMandatory=Le nom est obligatoire\nvalueIsMandatory=La valeur est obligatoire\nattributeAlreadyExists=L''attribut existe déjà\naddToSelectedGroups=Ajouter aux groupes sélectionnés\naddToSelectedRoles=Ajouter aux rôles sélectionnés\nassignUsersToGroupName=Affecter les utilisateurs au groupe\ngroupMustHaveAtLeastOneUser=Le groupe doit contenir au moins un utilisateur\naddUsersToGroup=Ajouter les utilisateurs sélectionnés \ndoesNotHavePrivileges=Non disponible\npatternAlphanumericSymbols=Seuls les caractères alphanumériques sont valides. Les symboles suivants sont également acceptés.\nusername=Mon nom d''utilisateur\ninvalidUserName=Le nom d''utilisateur n''est pas valide\ninputUserName=Veuillez introduire le nom d''utilisateur\ngroupName=Mon groupe\ninvalidGroupName=Le nom du groupe n''est pas valide\ninputGroupName=Veuillez introduire le nom du groupe\nuserIsDirty=L''utilisateur en cours d''édition a été modifié et n''a pas été enregistré. Voulez-vous vraiment ignorer vos modifications ?\nchangePassword=Modifier le mot de passe\nchangePasswordFor=Changer le mot de passe en\nnewPassword=Nouveau mot de passe\nrepeatNewPassword=Répéter le nouveau mot de passe\npasswordCannotBeEmpty=Le mot de passe doit être renseigné\npasswordsNotMatch=Les mots de passe ne correspondent pas\npasswordUpdatedSuccessfully=Le mot de passe a été mis à jour\ndoSetPasswordNow=Voulez-vous définir un mot de passe maintenant ?\nclear=Effacer\nclearSearch=Effacer la recherche en cours\nchange=Modifier\nuser=utilisateur\nusers=utilisateurs\ngroup=groupe\ngroups=groupes\ngroupsAssigned=groupes affectés\nrolesAssigned=rôles affectés\nrole=rôle\nroles=rôles\nnoUsers=Aucun utilisateur\nnoGroups=Aucun groupe\nnoRoles=Aucun rôle\nrefresh=Rafraîchir\ntotal=Total\nall=Tous\nroleSettings={0} paramètres\nroleIsDirty=Le rôle en cours d''édition a été modifié et n''a pas été enregistré. Voulez-vous vraiment ignorer vos modifications ?\ngroupIsDirty=Le groupe en cours d''édition a été modifié et n''a pas été enregistré. Voulez-vous vraiment ignorer vos modifications ?\nuserModified=L''utilisateur {0} a été modifié. Veuillez enregistrer vos modifications pour les appliquer\nuserStillNotCreated=L''utilisateur {0} n''a toujours pas été créé. Veuillez poursuivre la modification et cliquer sur le bouton Créer lorsque vous avez terminé.\nuserCreated=L''utilisateur {0} a été créé\nuserSaved=L''utilisateur {0} a été enregistré\nuserRemoved=L''utilisateur {0} a été supprimé\ngroupCreated=Le groupe {0} a été créé\ngroupRemoved=Le groupe {0} a été supprimé\nusersAssigned=Utilisateurs affectés au groupe {0}\nroleModified=Le rôle {0} a été modifié. Veuillez enregistrer vos modifications pour les appliquer\nroleSaved=Le rôle {0} a été enregistré\ngroupSettings={0} paramètres\ngroupModified=Le groupe {0} a été modifié. Veuillez enregistrer vos modifications pour les appliquer\ngroupSaved=Le groupe {0} a été enregistré\nnewEntity=Nouveau {0}\nhomePerspective=Page d''accueil\nnoHomePerspective=AUCUNE PAGE D''ACCUEIL DÉFINIE\nhomePerspectiveReadDenied=L''accès en lecture à la page d''accueil sélectionnée est refusé. Veuillez vérifier les autorisations.\npriority=Priorité\nhomePerspectiveTooltip=Page vers laquelle l''utilisateur est redirigé après la connexion\npriorityTooltip=Utilisé pour déterminer les paramètres (page d''accueil, autorisations, …) prioritaires pour les utilisateurs auxquels plusieurs rôles ou groupes sont affectés\nselectPriorityHint=- Sélectionner une priorité -\npriorityVeryHigh=Très haute\npriorityHigh=Haute\npriorityNormal=Normale\npriorityLow=Faible\npriorityVeryLow=Très faible\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nloading=Caricamento\nemptyEntities=Non ci sono entità\nfirstPage=Prima pagina\npreviousPage=Pagina precedente\nnextPage=Pagina successiva\nlastPage=Ultima pagina\nnext=Successivo\nuserHasNoAttributes=L''utente non ha attributi\nattributeIsMandatory=L''attributo è obbligatorio. Non può essere rimosso\nuserHasNoGroups=L''utente non ha nessun gruppo assegnato\nmemberOfGroups=Gruppi\ngroupSelectionFor=Selezione gruppo per\nuserHasNoRoles=L''utente non ha nessun ruolo assegnato\nmemberOfRoles=Ruoli\npermissions=Permessi\nroleSelectionFor=Selezione ruolo per\nuserAttributes=Attributi\nname=Nome\nvalue=Valore\nsearch=Ricerca\nsearchFor=Cerca per\nsearchResultsFor=Risultati di ricerca per\nedit=Modifica\ndelete=Elimina\ncancel=Annulla\ncreate=Crea\nsave=Salva\nsaveChanges=Salva\naddToGroups=Aggiungi ai gruppi\naddToRoles=Aggiungi ruoli\naddAttribute=Aggiungi attributo\nadd=Aggiungi\nconfirmAction=Conferma l''azione\nensureRemoveUser=Sei sicuro di voler rimuovere l''utente?\nensureRemoveGroup=Sei sicuro di voler rimuovere il gruppo?\nensureUserHasGroupsOrRoles=Non ci sono assegnazioni presenti, l''utente potrebbe non essere in grado di accedere all''applicazione\ngenericError=Errore\nremove=Rimuovi\nensureRemoveAttribute=Sei sicuro di voler rimuovere l''attributo?\nensureRemoveGroupFromUser=Sei sicuro di voler rimuovere il gruppo?\nensureRemoveRoleFromUser=Sei sicuro di voler rimuovere il ruolo?\nnameIsMandatory=Il nome è obbligatorio\nvalueIsMandatory=Il valore è obbligatorio\nattributeAlreadyExists=L''attributo esiste già\naddToSelectedGroups=Aggiungi ai gruppi selezionati\naddToSelectedRoles=Aggiungi ai ruoli selezionati\nassignUsersToGroupName=Assegna utenti al gruppo\ngroupMustHaveAtLeastOneUser=Il gruppo deve avere almeno un utente\naddUsersToGroup=Aggiungi utenti selezionati\ndoesNotHavePrivileges=Non disponibile\npatternAlphanumericSymbols=Sono validi solo caratteri alfanumerici ad eccezione dei seguenti simboli accettati\nusername=Il mio nome utente\ninvalidUserName=Il nome utente non è valido\ninputUserName=Inserisci il nome utente\ngroupName=Il mio gruppo\ninvalidGroupName=Il nome del gruppo non è valido\ninputGroupName=Inserisci il nome del gruppo\nuserIsDirty=L''utente in modifica corrente è stato modificato e non è stato salvato. Sei sicuro di voler annullare le modifiche?\nchangePassword=Cambia password\nchangePasswordFor=Cambia password per\nnewPassword=Nuova password\nrepeatNewPassword=Ripeti nuova password\npasswordCannotBeEmpty=La password non può essere vuota\npasswordsNotMatch=Le password non corrispondono\npasswordUpdatedSuccessfully=Password aggiornata con successo\ndoSetPasswordNow=Vuoi impostare una password ora?\nclear=Cancella\nclearSearch=Cancella la ricerca corrente\nchange=Cambia\nuser=utente\nusers=utenti\ngroup=gruppo\ngroups=gruppi\ngroupsAssigned=gruppi assegnati\nrolesAssigned=ruoli assegnati\nrole=ruolo\nroles=ruoli\nnoUsers=Nessun utente\nnoGroups=Nessun gruppo\nnoRoles=Nessun ruolo\nrefresh=Aggiorna\ntotal=Totale\nall=Tutti\nroleSettings=Impostazioni {0}\nroleIsDirty=Il ruolo in modifica corrente è stato modificato e non è stato salvato. Sei sicuro di voler annullare le modifiche?\ngroupIsDirty=Il gruppo in modifica corrente è stato modificato e non è stato salvato. Sei sicuro di voler annullare le modifiche?\nuserModified=L''utente {0} è stato modificato. Salva le modifiche per applicarle\nuserStillNotCreated=L''utente {0} non è ancora stato creato, continua la modifica e clicca su Crea quando hai finito\nuserCreated=L''utente {0} è stato creato\nuserSaved=L''utente {0} è stato salvato\nuserRemoved=L''utente {0} è stato eliminato\ngroupCreated=Il gruppo {0} è stato creato\ngroupRemoved=Il gruppo {0} è stato rimosso\nusersAssigned=Utenti assegnati al gruppo {0}\nroleModified=Il ruolo {0} è stato modificato. Salva le modifiche per applicarle\nroleSaved=Il ruolo {0} è stato salvato\ngroupSettings=Impostazioni {0}\ngroupModified=Il gruppo {0} è stato modificato. Salva le modifiche per applicarle\ngroupSaved=Il gruppo {0} è stato salvato\nnewEntity=Nuovo {0}\nhomePerspective=Pagina iniziale\nnoHomePerspective=NESSUNA HOME DEFINITA\nhomePerspectiveReadDenied=Accesso in lettura alla Pagina iniziale selezionata negato. Per favore, verifica i permessi.\npriority=Priorità\nhomePerspectiveTooltip=La pagina a cui l''utente viene indirizzato dopo il login\npriorityTooltip=Utilizzato per determinare quali impostazioni (pagina iniziale, permessi, ...) hanno la precedenza per gli utenti con più di un ruolo o gruppo assegnato\nselectPriorityHint=- Seleziona Priorità -\npriorityVeryHigh=Molto alta\npriorityHigh=Alta\npriorityNormal=Normale\npriorityLow=Bassa\npriorityVeryLow=Molto bassa\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#  \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#  \n#    http://www.apache.org/licenses/LICENSE-2.0\n#  \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nloading=ロード中\nemptyEntities=エンティティーがありません\nfirstPage=最初のページ\npreviousPage=前のページ\nnextPage=次のページ\nlastPage=最後のページ\nnext=次へ\nuserHasNoAttributes=属性がありません\nattributeIsMandatory=属性は必須項目です削除できません\nuserHasNoGroups=ユーザーにグループが割り当てられていません\nmemberOfGroups=グループ\ngroupSelectionFor=グループ選択\nuserHasNoRoles=ユーザーにロールが割り当てられていません\nmemberOfRoles=ロール\npermissions=パーミッション\nroleSelectionFor=ロール選択\nuserAttributes=属性\nname=名前\nvalue=値\nsearch=検索\nsearchFor=検索\nsearchResultsFor=検索結果 \nedit=編集\ndelete=削除\ncancel=キャンセル\ncreate=作成\nsave=保存\nsaveChanges=保存\naddToGroups=グループへ追加\naddToRoles=ロールの追加\naddAttribute=属性を追加\nadd=追加\nconfirmAction=アクションを確認してください\nensureRemoveUser=このユーザーを本当に削除してもいいですか？\nensureRemoveGroup=このグループを本当に削除してもいいですか？\nensureUserHasGroupsOrRoles=割り当てが存在しません。このユーザーはアプリケーションにログインできません。\ngenericError=エラー\nremove=削除\nensureRemoveAttribute=この属性を本当に削除してもいいですか？\nensureRemoveGroupFromUser=このグループを本当に削除してもいいですか？\nensureRemoveRoleFromUser=このロールを本当に削除してもいいですか？\nnameIsMandatory=名前は必須項目です\nvalueIsMandatory=値は必須項目です\nattributeAlreadyExists=属性はすでに存在します\naddToSelectedGroups=選択したグループを追加する\naddToSelectedRoles=選択したロールを追加する\nassignUsersToGroupName=ユーザーをグループに割り当てる\ngroupMustHaveAtLeastOneUser=グループには少なくとも 1 ユーザーを割り当ててください\naddUsersToGroup=選択したユーザーを追加する \ndoesNotHavePrivileges=利用できません\npatternAlphanumericSymbols=英数字と、次の記号だけが有効です\nusername=自分のユーザー名\ninvalidUserName=ユーザー名が有効ではありません\ninputUserName=ユーザー名を入力してください\ngroupName=自分のグループ\ninvalidGroupName=グループ名は有効ではありません\ninputGroupName=グループ名を入力してください\nuserIsDirty=現在編集中のユーザーは変更されましたが、保存されていません。変更を破棄してもよろしいですか?\nchangePassword=パスワードの変更\nchangePasswordFor=パスワードの変更\nnewPassword=新しいパスワード\nrepeatNewPassword=新しいパスワードの再入力\npasswordCannotBeEmpty=パスワードを空白にはできません\npasswordsNotMatch=パスワードが一致しません\npasswordUpdatedSuccessfully=パスワードが正しく更新されました\ndoSetPasswordNow=今、パスワードを設定しますか？\nclear=消去\nclearSearch=現在の検索を消去する\nchange=変更\nuser=ユーザー\nusers=ユーザー\ngroup=グループ\ngroups=グループ\ngroupsAssigned=グループが割り当てられました\nrolesAssigned=ロールが割り当てられました\nrole=ロール\nroles=ロール\nnoUsers=ユーザーがいません\nnoGroups=グループがありません\nnoRoles=ロールがありません\nrefresh=更新\ntotal=合計\nall=すべて\nroleSettings={0} 設定\nroleIsDirty=現在編集中のロールは変更されましたが、保存されていません。変更を破棄してもよろしいですか?\ngroupIsDirty=現在編集中のグループは変更されましたが、保存されていません。変更を破棄してもよろしいですか?\nuserModified=ユーザー {0} が変更されました。変更を保存して適用してください。\nuserStillNotCreated=ユーザー {0} はまだ作成されていません。続行し、終了したら「作成」ボタンをクリックしてください。\nuserCreated=ユーザー {0} が作成されました。\nuserSaved=ユーザー {0} が保存されました。\nuserRemoved=ユーザー {0} が削除されました。\ngroupCreated=グループ {0} が作成されました。\ngroupRemoved=グループ {0} が削除されました。\nusersAssigned=ユーザーがグループ {0} に割り当てられました。\nroleModified=ロール {0} が変更されました。変更を保存して適用してください。\nroleSaved=ロール {0} が保存されました。\ngroupSettings={0} 設定\ngroupModified=グループ {0} が変更されました。変更を保存して適用してください。\ngroupSaved=グループ {0} が保存されました。\nnewEntity=新規 {0}\nhomePerspective=ホームページ\nnoHomePerspective=ホームが定義されていません\nhomePerspectiveReadDenied=選択したホームページへの読み取りアクセスが拒否されました。パーミッションを確認してください。\npriority=優先順位\nhomePerspectiveTooltip=ログイン後に表示するページ\npriorityTooltip=1 つ以上のロールまたはグループが割り当てられているユーザーに対して、どの設定 (ホームページ、パーミッションなど) が優先されるかを指定します。\nselectPriorityHint=- 優先順位の選択 -\npriorityVeryHigh=非常に高い\npriorityHigh=高\npriorityNormal=普通\npriorityLow=低\npriorityVeryLow=非常に低い\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_pt_BR.properties",
    "content": "loading=Carregando\nemptyEntities=Não existem entidades\nfirstPage=Primeira página\npreviousPage=Página anterior\nnextPage=Próxima página\nlastPage=Última página\nnext=Próximo\nuserHasNoAttributes=Não há atributos\nattributeIsMandatory=O atributo é mandatório. Não pode ser removido\nuserHasNoGroups=O usuário não tem nenhum grupo atribuído\nmemberOfGroups=Grupos\ngroupSelectionFor=Seleção de grupo para\nuserHasNoRoles=O usuário não recebeu nenhuma função\nmemberOfRoles=Funções\nroleSelectionFor=Seleção de função para \nuserAttributes=Atributos\nname=Nome\nvalue=Valor\nsearch=Pesquisar\nsearchFor=Pesquisar para\nsearchResultsFor=Resultados de pesquisa para \nedit=Editar\ndelete=Excluir\ncancel=Cancelar\ncreate=Criar\nsave=Salvar\naddToGroups=Adicionar aos grupos\naddToRoles=Adicionar funções\naddAttribute=Adicionar Atributo\nadd=Adicionar\nconfirmAction=Por favor confirme a ação\nensureRemoveUser=Você tem certeza que deseja remover este usuário?\nensureRemoveGroup=Você tem certeza que deseja remover este grupo?\ngenericError=Erro\nremove=Remover\nensureRemoveAttribute=Você tem certeza que deseja remover o atributo?\nensureRemoveGroupFromUser=Você tem certeza que deseja remover o grupo?\nensureRemoveRoleFromUser=Você tem certeza que deseja remover esta função?\nnameIsMandatory=O nome é mandatório\nvalueIsMandatory=O valor é mandatório\nattributeAlreadyExists=O atributo já existe\naddToSelectedGroups=Adicionar aos grupos selecionados\naddToSelectedRoles=Adicionar às funções selecionadas\nassignUsersToGroupName=Atribuir usuários ao gupo\ngroupMustHaveAtLeastOneUser=O grupo deve ter pelo menos um usuário\naddUsersToGroup=Adicionar os usuários selecionados\ndoesNotHavePrivileges=Não disponível\nusername=Meu nome de usuário\ninputUserName=Por favor introduza o nome de usuário\ngroupName=Meu grupo\ninputGroupName=Por favor introduza o nome do grupo\nuserIsDirty=O atual usuário passando por edições foi modificado e não foi salvo. Você tem certeza que deseja descartar as suas alterações?\nchangePassword=Alterar senha \nchangePasswordFor=Alterar senha para\nnewPassword=Nova senha\nrepeatNewPassword=Repetir a nova senha\npasswordCannotBeEmpty=A senha não pode estar vazia\npasswordsNotMatch=As senhas não coincidem\npasswordUpdatedSuccessfully=Senha atualizada com êxito\ndoSetPasswordNow=Você deseja definir a senha agora?\nclear=Limpar\nclearSearch=Limpar a pesquisa atual\nchange=Alterar\nuser=usuário\nusers=usuários\ngroup=grupo\ngroups=grupos\ngroupsAssigned=grupos atribuídos\nrolesAssigned=funções atribuídas\nrole=função\nroles=funções\nnoUsers=Não há usuários\nnoGroups=Não há grupos\nnoRoles=nenhuma função\nrefresh=Atualizar\ntotal=Total\nall=Todos(as)\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/main/resources/org/uberfire/ext/security/management/client/resources/i18n/UsersManagementWidgetsConstants_zh_CN.properties",
    "content": "loading=正在加载\nemptyEntities=没有条目\nfirstPage=首页\npreviousPage=上一页\nnextPage=下一页\nlastPage=尾页\nnext=下一项\nuserHasNoAttributes=无属性\nattributeIsMandatory=属性为必填项。无法删除。\nuserHasNoGroups=没有为用户分配任何组\nmemberOfGroups=组\ngroupSelectionFor=组选择\nuserHasNoRoles=没有为用户分配任何角色\nmemberOfRoles=角色\nroleSelectionFor=角色选择\nuserAttributes=属性\nname=名称\nvalue=值\nsearch=搜索\nsearchFor=搜索\nsearchResultsFor=搜索结果\nedit=编辑\ndelete=删除\ncancel=取消\ncreate=创建\nsave=保存\naddToGroups=添加到组中\naddToRoles=添加角色\naddAttribute=添加属性\nadd=添加\nconfirmAction=请确认该动作\nensureRemoveUser=您确定要删除这个用户吗?\nensureRemoveGroup=您确定要删除这个组吗?\ngenericError=错误\nremove=删除\nensureRemoveAttribute=您确定要删除这个属性吗?\nensureRemoveGroupFromUser=您确定要删除这个组吗?\nensureRemoveRoleFromUser=您确定要删除这个角色吗?\nnameIsMandatory=名称为必填项\nvalueIsMandatory=值为必填项\nattributeAlreadyExists=属性已经存在\naddToSelectedGroups=添加到所选组中\naddToSelectedRoles=添加到所选角色中\nassignUsersToGroupName=为用户分配组\ngroupMustHaveAtLeastOneUser=组长必须至少有一个用户\naddUsersToGroup=添加所选用户\ndoesNotHavePrivileges=不可用\nusername=我的用户名\ninputUserName=请输入用户名\ngroupName=我的组\ninputGroupName=请输入组名\nuserIsDirty=目前正在编辑的用户已经进行了修改但尚未保存。您确定要放弃所做更改吗？\nchangePassword=更改密码\nchangePasswordFor=更改密码\nnewPassword=新密码\nrepeatNewPassword=重复输入新密码\npasswordCannotBeEmpty=密码不能为空\npasswordsNotMatch=密码不匹配\npasswordUpdatedSuccessfully=密码更新成功\ndoSetPasswordNow=要现在设置密码吗？\nclear=清除\nclearSearch=清除当前搜索\nchange=更改\nuser=用户\nusers=用户\ngroup=组\ngroups=组\ngroupsAssigned=已分配的组\nrolesAssigned=已分配的角色\nrole=角色\nroles=角色\nnoUsers=没有用户\nnoGroups=没有组\nnoRoles=无角色\nrefresh=刷新\ntotal=总计\nall=全部\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/AbstractSecurityManagementTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.CapabilityStatus;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.ext.security.management.client.ClientSecurityExceptionMessageResolver;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\npublic abstract class AbstractSecurityManagementTest {\n\n    protected static final String ATTRIBUTE_USER_ID = \"user.id\";\n    protected static final String ATTRIBUTE_USER_FIRST_NAME = \"user.firstName\";\n    protected static final String ATTRIBUTE_USER_LAST_NAME = \"user.lastName\";\n    protected static final String ATTRIBUTE_USER_ENABLED = \"user.enabled\";\n    protected static final String ATTRIBUTE_USER_EMAIL = \"user.email\";\n\n    @Mock\n    protected EventSourceMock<NotificationEvent> workbenchNotification;\n    @Mock\n    protected UserManagerService userManagerService;\n    @Mock\n    protected GroupManagerService groupsManagerService;\n    @Mock\n    protected RoleManagerService rolesManagerService;\n    @Mock\n    protected ErrorPopupPresenter errorPopupPresenter;\n    @Mock\n    protected ClientSecurityExceptionMessageResolver exceptionMessageResolver;\n    protected Caller<UserManagerService> usersManagerServiceCaller;\n    protected Caller<GroupManagerService> groupsManagerServiceCaller;\n    protected Caller<RoleManagerService> rolesManagerServiceCaller;\n    protected ClientUserSystemManager userSystemManager;\n\n    protected void setup() {\n        MockitoAnnotations.openMocks(this);\n        usersManagerServiceCaller = new CallerMock<UserManagerService>(userManagerService);\n        groupsManagerServiceCaller = new CallerMock<GroupManagerService>(groupsManagerService);\n        rolesManagerServiceCaller = new CallerMock<RoleManagerService>(rolesManagerService);\n        userSystemManager = spy(new ClientUserSystemManager(usersManagerServiceCaller,\n                                                            groupsManagerServiceCaller,\n                                                            rolesManagerServiceCaller,\n                                                            exceptionMessageResolver,\n                                                            errorPopupPresenter));\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final String _id = (String) invocationOnMock.getArguments()[0];\n                final User user = mockUser(_id);\n                return user;\n            }\n        }).when(userSystemManager).createUser(anyString());\n        doAnswer(new Answer<Group>() {\n            @Override\n            public Group answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final String _name = (String) invocationOnMock.getArguments()[0];\n                final Group group = mock(Group.class);\n                when(group.getName()).thenReturn(_name);\n                return group;\n            }\n        }).when(userSystemManager).createGroup(anyString());\n        doAnswer(new Answer<UserManager.UserAttribute>() {\n            @Override\n            public UserManager.UserAttribute answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final String _name = (String) invocationOnMock.getArguments()[0];\n                final Boolean _isMandatory = (Boolean) invocationOnMock.getArguments()[1];\n                final Boolean _isEditable = (Boolean) invocationOnMock.getArguments()[2];\n                final String _defaultValue = (String) invocationOnMock.getArguments()[3];\n                final UserManager.UserAttribute attribute = mock(UserManager.UserAttribute.class);\n                when(attribute.getName()).thenReturn(_name);\n                when(attribute.isMandatory()).thenReturn(_isMandatory);\n                when(attribute.isEditable()).thenReturn(_isEditable);\n                when(attribute.getDefaultValue()).thenReturn(_defaultValue);\n                return attribute;\n            }\n        }).when(userSystemManager).createUserAttribute(anyString(),\n                                                       anyBoolean(),\n                                                       anyBoolean(),\n                                                       anyString());\n        // final Map<Capability, CapabilityStatus> usersCapabilities = getUserCapabilities();\n        // final Map<Capability, CapabilityStatus> groupsCapabilities = getGroupCapabilities();\n        final Collection<UserManager.UserAttribute> userAttributes = getUserAttributes();\n        ;\n        doReturn(true).when(userSystemManager).isUserCapabilityEnabled(any(Capability.class));\n        doReturn(userAttributes).when(userSystemManager).getUserSupportedAttributes();\n        doReturn(userAttributes).when(userSystemManager).getUserSupportedAttributes();\n        doAnswer(new Answer<UserManager.UserAttribute>() {\n            @Override\n            public UserManager.UserAttribute answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return null;\n            }\n        }).when(userSystemManager).getUserSupportedAttribute(anyString());\n        doReturn(true).when(userSystemManager).isGroupCapabilityEnabled(any(Capability.class));\n    }\n\n    protected Map<Capability, CapabilityStatus> getUserCapabilities() {\n        Map<Capability, CapabilityStatus> capabilities = new HashMap<Capability, CapabilityStatus>();\n        capabilities.put(Capability.CAN_SEARCH_USERS,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_ADD_USER,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_UPDATE_USER,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_DELETE_USER,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_READ_USER,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_MANAGE_ATTRIBUTES,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_ASSIGN_GROUPS,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_CHANGE_PASSWORD,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_ASSIGN_ROLES,\n                         CapabilityStatus.UNSUPPORTED);\n        return capabilities;\n    }\n\n    protected Map<Capability, CapabilityStatus> getGroupCapabilities() {\n        Map<Capability, CapabilityStatus> capabilities = new HashMap<Capability, CapabilityStatus>();\n        capabilities.put(Capability.CAN_SEARCH_GROUPS,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_ADD_GROUP,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_UPDATE_GROUP,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_DELETE_GROUP,\n                         CapabilityStatus.ENABLED);\n        capabilities.put(Capability.CAN_READ_GROUP,\n                         CapabilityStatus.ENABLED);\n        return capabilities;\n    }\n\n    protected Collection<UserManager.UserAttribute> getUserAttributes() {\n        Collection<UserManager.UserAttribute> attributes = new ArrayList<UserManager.UserAttribute>();\n\n        final UserManager.UserAttribute USER_ID = mock(UserManager.UserAttribute.class);\n        when(USER_ID.getName()).thenReturn(ATTRIBUTE_USER_ID);\n        when(USER_ID.isMandatory()).thenReturn(true);\n        when(USER_ID.isEditable()).thenReturn(false);\n        when(USER_ID.getDefaultValue()).thenReturn(null);\n        attributes.add(USER_ID);\n\n        final UserManager.UserAttribute USER_FIST_NAME = mock(UserManager.UserAttribute.class);\n        when(USER_FIST_NAME.getName()).thenReturn(ATTRIBUTE_USER_FIRST_NAME);\n        when(USER_FIST_NAME.isMandatory()).thenReturn(true);\n        when(USER_FIST_NAME.isEditable()).thenReturn(true);\n        when(USER_FIST_NAME.getDefaultValue()).thenReturn(\"First name\");\n        attributes.add(USER_FIST_NAME);\n\n        final UserManager.UserAttribute USER_LAST_NAME = mock(UserManager.UserAttribute.class);\n        when(USER_LAST_NAME.getName()).thenReturn(ATTRIBUTE_USER_LAST_NAME);\n        when(USER_LAST_NAME.isMandatory()).thenReturn(true);\n        when(USER_LAST_NAME.isEditable()).thenReturn(true);\n        when(USER_LAST_NAME.getDefaultValue()).thenReturn(\"Last name\");\n        attributes.add(USER_LAST_NAME);\n\n        final UserManager.UserAttribute USER_ENABLED = mock(UserManager.UserAttribute.class);\n        when(USER_ENABLED.getName()).thenReturn(ATTRIBUTE_USER_ENABLED);\n        when(USER_ENABLED.isMandatory()).thenReturn(true);\n        when(USER_ENABLED.isEditable()).thenReturn(true);\n        when(USER_ENABLED.getDefaultValue()).thenReturn(\"true\");\n        attributes.add(USER_ENABLED);\n\n        final UserManager.UserAttribute USER_EMAIL = mock(UserManager.UserAttribute.class);\n        when(USER_EMAIL.getName()).thenReturn(ATTRIBUTE_USER_EMAIL);\n        when(USER_EMAIL.isMandatory()).thenReturn(false);\n        when(USER_EMAIL.isEditable()).thenReturn(true);\n        when(USER_EMAIL.getDefaultValue()).thenReturn(\"\");\n        attributes.add(USER_EMAIL);\n\n        return attributes;\n    }\n\n    protected List<User> buildUsersList(final int size) {\n        final List<User> users = new ArrayList<User>();\n        for (int x = 0; x < size; x++) {\n            final User user = mockUser(getUserIdentifier(x));\n            when(user.getIdentifier()).thenReturn(getUserIdentifier(x));\n            users.add(user);\n        }\n        return users;\n    }\n\n    protected List<Group> buildGroupsList(final int size) {\n        final List<Group> groups = new ArrayList<Group>();\n        for (int x = 0; x < size; x++) {\n            final Group g = mock(Group.class);\n            when(g.getName()).thenReturn(getGroupIdentifier(x));\n            groups.add(g);\n        }\n        return groups;\n    }\n\n    protected List<Role> buildRolesList(final int size) {\n        final List<Role> groups = new ArrayList<Role>();\n        for (int x = 0; x < size; x++) {\n            final Role g = mock(Role.class);\n            when(g.getName()).thenReturn(getRoleIdentifier(x));\n            groups.add(g);\n        }\n        return groups;\n    }\n\n    protected Collection<String> buildGroupIdsList(final int size) {\n        final List<String> groups = new ArrayList<String>();\n        for (int x = 0; x < size; x++) {\n            groups.add(getGroupIdentifier(x));\n        }\n        return groups;\n    }\n\n    public User mockUser(final String id) {\n        final User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(id);\n        return user;\n    }\n\n    public Group mockGroup(final String name) {\n        final Group g = mock(Group.class);\n        when(g.getName()).thenReturn(name);\n        return g;\n    }\n\n    protected String getUserIdentifier(final int x) {\n        return \"user\" + x;\n    }\n\n    protected String getGroupIdentifier(final int x) {\n        return \"group\" + x;\n    }\n\n    protected String getRoleIdentifier(final int x) {\n        return \"role\" + x;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/ChangePasswordTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport java.util.List;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ChangePasswordTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EventSourceMock<ChangePasswordEvent> changePasswordEvent;\n    @Mock\n    EventSourceMock<OnErrorEvent> onErrorEvent;\n    @Mock\n    ChangePassword.View view;\n    private ChangePassword presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new ChangePassword(userSystemManager,\n                                       workbenchNotification,\n                                       onErrorEvent,\n                                       changePasswordEvent,\n                                       view);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n        assertNull(presenter.username);\n        assertNull(presenter.callback);\n    }\n\n    @Test\n    public void testShowError() throws Exception {\n        String error = \"error1\";\n        presenter.showErrorMessage(error);\n        verify(view,\n               times(0)).clear();\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n        verify(onErrorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show(\"user1\");\n        assertEquals(presenter.username,\n                     \"user1\");\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(1)).show(anyString());\n    }\n\n    @Test\n    public void testPasswordValidator() throws Exception {\n        List<EditorError> errors = presenter.passwordValidator.validate(mock(Editor.class),\n                                                                        \"password1\");\n        assertTrue(errors.isEmpty());\n        errors = presenter.passwordValidator.validate(mock(Editor.class),\n                                                      \"\");\n        assertFalse(errors.isEmpty());\n    }\n\n    @Test\n    public void testValidatePasswordMatch() throws Exception {\n        assertTrue(presenter.validatePasswordsMatch(\"password1\",\n                                                    \"password1\"));\n        assertFalse(presenter.validatePasswordsMatch(\"password1\",\n                                                     \"password2\"));\n    }\n\n    @Test\n    public void testUpdatePassword() throws Exception {\n        final String newPassw = \"new-password\";\n        Command callback = mock(Command.class);\n        ChangePassword.ChangePasswordCallback changePasswordCallback = mock(ChangePassword.ChangePasswordCallback.class);\n        presenter.username = \"user\";\n        presenter.callback = changePasswordCallback;\n        presenter.onUpdatePassword(newPassw,\n                                   callback);\n        verify(userManagerService,\n               times(1)).changePassword(presenter.username,\n                                        newPassw);\n        verify(changePasswordEvent,\n               times(1)).fire(any(ChangePasswordEvent.class));\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n        verify(callback,\n               times(1)).execute();\n        verify(changePasswordCallback,\n               times(1)).onPasswordUpdated();\n        verify(view,\n               times(1)).hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/CreateEntityTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management;\n\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class CreateEntityTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    CreateEntity.View view;\n    private CreateEntity presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new CreateEntity(userSystemManager,\n                                     view);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(1)).setValidationState(ValidationState.NONE);\n        verify(view,\n               times(0)).show(anyString(),\n                              anyString());\n        assertNull(presenter.identifier);\n    }\n\n    @Test\n    public void testSetErrorState() throws Exception {\n        presenter.setErrorState();\n        verify(view,\n               times(1)).setValidationState(ValidationState.ERROR);\n        verify(view,\n               times(0)).clear();\n        verify(view,\n               times(0)).show(anyString(),\n                              anyString());\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        final String legend = \"legend\";\n        final String ph = \"placeHolder\";\n        presenter.show(legend,\n                       ph);\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(1)).setValidationState(ValidationState.NONE);\n        verify(view,\n               times(1)).show(legend,\n                              ph);\n        assertNull(presenter.identifier);\n    }\n\n    @Test\n    public void testGetEntityIdentifierValid() throws Exception {\n        presenter.identifier = \"id1\";\n        String id = presenter.getEntityIdentifier();\n        verify(view,\n               times(1)).setValidationState(ValidationState.NONE);\n        verify(view,\n               times(0)).clear();\n        verify(view,\n               times(0)).show(anyString(),\n                              anyString());\n        Assert.assertEquals(\"id1\",\n                            id);\n    }\n\n    @Test\n    public void testGetEntityIdentifierInvalid() throws Exception {\n        presenter.identifier = null;\n        String id = presenter.getEntityIdentifier();\n        verify(view,\n               times(1)).setValidationState(ValidationState.ERROR);\n        verify(view,\n               times(0)).clear();\n        verify(view,\n               times(0)).show(anyString(),\n                              anyString());\n        Assert.assertEquals(null,\n                            id);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/ACLSettingsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.client.authz.PerspectiveTreeProvider;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.widgets.management.events.HomePerspectiveChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PriorityChangedEvent;\nimport org.uberfire.ext.widgets.common.client.dropdown.PerspectiveDropDown;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionTypeRegistry;\n\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.security.impl.authz.DefaultAuthorizationEntry.DEFAULT_PRIORITY;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ACLSettingsTest {\n\n    @Mock\n    ACLSettings.View view;\n\n    @Mock\n    PerspectiveDropDown homePerspectiveDropDown;\n\n    @Mock\n    PerspectiveTreeProvider perspectiveTreeProvider;\n\n    @Mock\n    PriorityDropDown priorityDropDown;\n\n    @Mock\n    Event<HomePerspectiveChangedEvent> homePerspectiveChangedEvent;\n\n    @Mock\n    Event<PriorityChangedEvent> priorityChangedEvent;\n\n    @Mock\n    PerspectiveActivity defaultPerspective;\n\n    ACLSettings presenter;\n    PermissionManager permissionManager;\n\n    @Before\n    public void setup() {\n        permissionManager = spy(new DefaultPermissionManager(new DefaultPermissionTypeRegistry()));\n\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                                  .role(\"admin\").home(\"HomeAdmin\").priority(10)\n                                                                  .group(\"group1\").home(\"HomeGroup1\").priority(DEFAULT_PRIORITY)\n                                                                  .build());\n\n        presenter = new ACLSettings(view,\n                                    permissionManager,\n                                    homePerspectiveDropDown,\n                                    perspectiveTreeProvider,\n                                    priorityDropDown,\n                                    homePerspectiveChangedEvent,\n                                    priorityChangedEvent);\n\n        when(defaultPerspective.getIdentifier()).thenReturn(\"DefaultPerspective\");\n        when(homePerspectiveDropDown.getDefaultPerspective()).thenReturn(defaultPerspective);\n        when(homePerspectiveDropDown.getItemName(\"DefaultPerspective\")).thenReturn(\"DefaultPerspective\");\n        when(homePerspectiveDropDown.getItemName(\"HomeAdmin\")).thenReturn(\"HomeAdmin\");\n        when(homePerspectiveDropDown.getItemName(\"HomeGroup1\")).thenReturn(\"HomeGroup1\");\n        when(priorityDropDown.getPriorityName(10)).thenReturn(\"High\");\n        when(priorityDropDown.getPriorityName(DEFAULT_PRIORITY)).thenReturn(\"Very Low\");\n    }\n\n    @Test\n    public void testShowRole() {\n        presenter.show(new RoleImpl(\"admin\"));\n\n        verify(view).setHomePerspectiveSelectorEnabled(false);\n        verify(view).setPrioritySelectorEnabled(false);\n        verify(view).setHomePerspectiveSelector(any());\n        verify(view).setPrioritySelector(any());\n        verify(view).setHomePerspectiveName(\"HomeAdmin\");\n        verify(view).setHomePerspectiveTitle(\"HomeAdmin\");\n        verify(view).setPriorityName(\"High\");\n    }\n\n    @Test\n    public void testEditRole() {\n        presenter.edit(new RoleImpl(\"admin\"));\n\n        verify(view).setHomePerspectiveSelectorEnabled(true);\n        verify(view).setPrioritySelectorEnabled(true);\n        verify(view).setHomePerspectiveSelector(any());\n        verify(view).setPrioritySelector(any());\n        verify(homePerspectiveDropDown).setSelectedPerspective(\"HomeAdmin\");\n        verify(priorityDropDown).setSelectedPriority(10);\n    }\n\n    @Test\n    public void testShowGroup() {\n        presenter.show(new GroupImpl(\"group1\"));\n\n        verify(view).setHomePerspectiveSelectorEnabled(false);\n        verify(view).setPrioritySelectorEnabled(false);\n        verify(view).setHomePerspectiveSelector(any());\n        verify(view).setPrioritySelector(any());\n        verify(view).setHomePerspectiveName(\"HomeGroup1\");\n        verify(view).setHomePerspectiveTitle(\"HomeGroup1\");\n        verify(view).setPriorityName(\"Very Low\");\n    }\n\n    @Test\n    public void testEditGroup() {\n        presenter.edit(new GroupImpl(\"group1\"));\n\n        verify(view).setHomePerspectiveSelectorEnabled(true);\n        verify(view).setPrioritySelectorEnabled(true);\n        verify(view).setHomePerspectiveSelector(any());\n        verify(view).setPrioritySelector(any());\n        verify(homePerspectiveDropDown).setSelectedPerspective(\"HomeGroup1\");\n        verify(priorityDropDown).setSelectedPriority(DEFAULT_PRIORITY);\n    }\n\n    @Test\n    public void testDefaultValues() {\n        reset(view);\n\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy().build());\n        presenter = new ACLSettings(view,\n                                    permissionManager,\n                                    homePerspectiveDropDown,\n                                    perspectiveTreeProvider,\n                                    priorityDropDown,\n                                    homePerspectiveChangedEvent,\n                                    priorityChangedEvent);\n\n        presenter.show(new RoleImpl(\"admin\"));\n\n        verify(view).setHomePerspectiveSelectorEnabled(false);\n        verify(view).setPrioritySelectorEnabled(false);\n        verify(view).setHomePerspectiveSelector(any());\n        verify(view).setPrioritySelector(any());\n        verify(view).setHomePerspectiveName(\"DefaultPerspective\");\n        verify(view).setHomePerspectiveTitle(\"DefaultPerspective\");\n        verify(view).setPriorityName(\"Very Low\");\n    }\n\n    @Test\n    public void testOnHomePerspectiveChange() {\n        presenter.onHomePerspectiveSelected();\n\n        verify(homePerspectiveChangedEvent).fire(any());\n    }\n\n    @Test\n    public void testOnPrioritySelected() {\n        presenter.onPrioritySelected();\n\n        verify(priorityChangedEvent).fire(any());\n    }\n\n    @Test\n    public void testAuthorizationPolicyChange() {\n        \n        final int NEW_PRIORITY = 100;\n        final String NEW_PERSPECTIVE = \"NewHomeAdmin\";\n\n        final AuthorizationPolicy newPolicy = permissionManager.newAuthorizationPolicy()\n                                                               .role(\"admin\").home(NEW_PERSPECTIVE).priority(NEW_PRIORITY)\n                                                               .group(\"group1\").home(\"HomeGroup1\").priority(DEFAULT_PRIORITY)\n                                                               .build();\n        \n        presenter.updateAuthzPolicy(new AuthorizationPolicySavedEvent(newPolicy));\n\n        presenter.edit(new RoleImpl(\"admin\"));\n\n        verify(homePerspectiveDropDown).setSelectedPerspective(NEW_PERSPECTIVE);\n        verify(priorityDropDown).setSelectedPriority(NEW_PRIORITY);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/LeafPermissionNodeEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport javax.enterprise.event.Event;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.LeafPermissionNodeEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionSwitch;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionWidgetFactory;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LeafPermissionNodeEditorTest {\n\n    @Mock\n    LeafPermissionNodeEditor.View view;\n\n    @Mock\n    PermissionSwitch.View permissionSwitchView1;\n\n    @Mock\n    PermissionSwitch.View permissionSwitchView2;\n\n    @Mock\n    PermissionWidgetFactory widgetFactory;\n\n    @Mock\n    Event<PermissionChangedEvent> changedEvent;\n\n    @Mock\n    Permission permission1;\n\n    @Mock\n    Permission permission2;\n\n    @Mock\n    Command onChange;\n\n    LeafPermissionNodeEditor presenter;\n    PermissionSwitch permissionSwitch1;\n    PermissionSwitch permissionSwitch2;\n    PermissionLeafNode permissionNode;\n\n    @Before\n    public void setUp() {\n        presenter = new LeafPermissionNodeEditor(view,\n                                                 widgetFactory,\n                                                 changedEvent);\n        permissionSwitch1 = spy(new PermissionSwitch(permissionSwitchView1));\n        permissionSwitch2 = spy(new PermissionSwitch(permissionSwitchView2));\n\n        when(widgetFactory.createSwitch()).thenReturn(permissionSwitch1,\n                                                      permissionSwitch2);\n        when(permission1.getResult()).thenReturn(AuthorizationResult.ACCESS_DENIED);\n        when(permission1.getName()).thenReturn(\"p1\");\n        when(permission2.getResult()).thenReturn(AuthorizationResult.ACCESS_GRANTED);\n        when(permission2.getName()).thenReturn(\"p2\");\n\n        permissionNode = new PermissionLeafNode();\n        permissionNode.setNodeName(\"r1\");\n        permissionNode.addPermission(permission1,\n                                     \"grant1\",\n                                     \"deny1\");\n        permissionNode.addPermission(permission2,\n                                     \"grant2\",\n                                     \"deny2\");\n    }\n\n    @Test\n    public void testInit() {\n        presenter.edit(permissionNode);\n\n        assertTrue(presenter.getChildEditors().isEmpty());\n        assertEquals(presenter.getPermissionNode(),\n                     permissionNode);\n\n        verify(view).setNodeName(\"r1\");\n        verify(view,\n               never()).setNodeFullName(anyString());\n        verify(view).addPermission(permissionSwitch1);\n        verify(view).addPermission(permissionSwitch2);\n        verify(permissionSwitch1).init(eq(\"grant1\"),\n                                       eq(\"deny1\"),\n                                       eq(false),\n                                       eq(0));\n        verify(permissionSwitch2).init(eq(\"grant2\"),\n                                       eq(\"deny2\"),\n                                       eq(true),\n                                       eq(0));\n    }\n\n    @Test\n    public void testSwitchChange() {\n        presenter.edit(permissionNode);\n\n        permissionSwitch1.onChange();\n\n        verify(permission1).setResult(any());\n        verify(changedEvent).fire(any());\n    }\n\n    @Test\n    public void testSwitchInitDependencies() {\n        when(permissionSwitchView1.isOn()).thenReturn(false);\n\n        reset(permission2);\n        permissionNode.addDependencies(permission1,\n                                       permission2);\n        presenter.edit(permissionNode);\n\n        verify(permission2).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitch2).setEnabled(false);\n        verify(permissionSwitch2).setOn(false);\n    }\n\n    @Test\n    public void testSwitchChangeDependencies() {\n        permissionNode.addDependencies(permission1,\n                                       permission2);\n        presenter.edit(permissionNode);\n\n        reset(permission2);\n        reset(permissionSwitch2);\n        when(permissionSwitch1.isOn()).thenReturn(false);\n        permissionSwitch1.onChange();\n\n        verify(permission2).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitch2).setEnabled(false);\n        verify(permissionSwitch2).setOn(false);\n\n        reset(permissionSwitch2);\n        when(permissionSwitch1.isOn()).thenReturn(true);\n        permissionSwitch1.onChange();\n\n        verify(permissionSwitch2).setEnabled(true);\n        verify(permissionSwitch2,\n               never()).setOn(anyBoolean());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/LeafPermissionNodeViewerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.LeafPermissionNodeViewer;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LeafPermissionNodeViewerTest {\n\n    @Mock\n    LeafPermissionNodeViewer.View view;\n\n    @Mock\n    Permission permission1;\n\n    @Mock\n    Permission permission2;\n\n    LeafPermissionNodeViewer presenter;\n    PermissionLeafNode permissionNode;\n\n    @Before\n    public void setUp() {\n        presenter = new LeafPermissionNodeViewer(view);\n\n        when(permission1.getResult()).thenReturn(AuthorizationResult.ACCESS_DENIED);\n        when(permission1.getName()).thenReturn(\"p1\");\n        when(permission2.getResult()).thenReturn(AuthorizationResult.ACCESS_GRANTED);\n        when(permission2.getName()).thenReturn(\"p2\");\n\n        permissionNode = new PermissionLeafNode();\n        permissionNode.setNodeName(\"r1\");\n        permissionNode.setNodeFullName(\"r1 full\");\n        permissionNode.addPermission(permission1,\n                                     \"grant1\",\n                                     \"deny1\");\n        permissionNode.addPermission(permission2,\n                                     \"grant2\",\n                                     \"deny2\");\n        presenter.show(permissionNode);\n    }\n\n    @Test\n    public void testShow() {\n        assertNull(presenter.getChildren());\n        assertEquals(presenter.getPermissionNode(),\n                     permissionNode);\n\n        verify(view).setNodeName(\"r1\");\n        verify(view).setNodeFullName(\"r1 full\");\n        verify(view).permissionDenied(\"deny1\");\n        verify(view).permissionGranted(\"grant2\");\n        verify(view,\n               never()).permissionGranted(\"grant1\");\n        verify(view,\n               never()).permissionDenied(\"deny2\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/MultiplePermissionNodeEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.event.Event;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.LeafPermissionNodeEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.MultiplePermissionNodeEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionExceptionSwitch;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionSwitch;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionWidgetFactory;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionChangedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeAddedEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.PermissionNodeRemovedEvent;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchService;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionGroupNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\nimport org.uberfire.security.impl.authz.DotNamedPermission;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MultiplePermissionNodeEditorTest {\n\n    @Mock\n    MultiplePermissionNodeEditor.View view;\n\n    @Mock\n    LeafPermissionNodeEditor.View childView1;\n\n    @Mock\n    LeafPermissionNodeEditor.View childView2;\n\n    @Mock\n    PermissionSwitch.View permissionSwitchReadView;\n\n    @Mock\n    PermissionSwitch.View permissionSwitchUpdateView;\n\n    @Mock\n    PermissionExceptionSwitch.View permissionSwitchReadView1;\n\n    @Mock\n    PermissionExceptionSwitch.View permissionSwitchUpdateView1;\n\n    @Mock\n    PermissionExceptionSwitch.View permissionSwitchReadView2;\n\n    @Mock\n    PermissionExceptionSwitch.View permissionSwitchUpdateView2;\n\n    @Mock\n    LiveSearchDropDown liveSearchDropDown;\n\n    @Mock\n    PermissionWidgetFactory widgetFactory;\n\n    @Mock\n    PermissionWidgetFactory widgetFactory1;\n\n    @Mock\n    PermissionWidgetFactory widgetFactory2;\n\n    @Mock\n    Event<PermissionChangedEvent> changedEvent;\n\n    @Mock\n    Event<PermissionNodeAddedEvent> nodeAddedEvent;\n\n    @Mock\n    Event<PermissionNodeRemovedEvent> nodeRemovedEvent;\n\n    @Mock\n    Command onChange;\n\n    PermissionTreeProvider permissionTreeProvider;\n    PermissionGroupNode permissionGroupNode;\n    PermissionResourceNode permissionResourceNode;\n    MultiplePermissionNodeEditor presenter;\n    PermissionSwitch permissionSwitchRead;\n    PermissionSwitch permissionSwitchUpdate;\n    PermissionExceptionSwitch permissionSwitchRead1;\n    PermissionExceptionSwitch permissionSwitchUpdate1;\n    PermissionExceptionSwitch permissionSwitchRead2;\n    PermissionExceptionSwitch permissionSwitchUpdate2;\n    PermissionLeafNode permissionChildNode1;\n    PermissionLeafNode permissionChildNode2;\n    LeafPermissionNodeEditor childEditor1;\n    LeafPermissionNodeEditor childEditor2;\n    Permission permissionRead;\n    Permission permissionUpdate;\n    Permission permissionRead1;\n    Permission permissionUpdate1;\n    Permission permissionRead2;\n    Permission permissionUpdate2;\n    List<PermissionNode> permissionResourceChildrenAdded = new ArrayList<>();\n    List<PermissionNode> permissionResourceChildrenAvailable = new ArrayList<>();\n\n    class TestPermissionProvider implements PermissionTreeProvider {\n\n        @Override\n        public PermissionNode buildRootNode() {\n            return null;\n        }\n\n        @Override\n        public void loadChildren(PermissionNode parent, LoadOptions options, LoadCallback consumer) {\n            consumer.afterLoad(permissionResourceChildrenAvailable);\n        }\n    }\n\n    @Before\n    public void setUp() {\n        permissionTreeProvider = new TestPermissionProvider();\n\n        permissionRead = spy(new DotNamedPermission(\"read\",\n                                                    true));\n        permissionRead1 = spy(new DotNamedPermission(\"read.p1\",\n                                                     false));\n        permissionRead2 = spy(new DotNamedPermission(\"read.p2\",\n                                                     false));\n        permissionUpdate = spy(new DotNamedPermission(\"update\",\n                                                      true));\n        permissionUpdate1 = spy(new DotNamedPermission(\"update.p1\",\n                                                       false));\n        permissionUpdate2 = spy(new DotNamedPermission(\"update.p2\",\n                                                       false));\n\n        permissionSwitchRead = spy(new PermissionSwitch(permissionSwitchReadView));\n        permissionSwitchRead1 = spy(new PermissionExceptionSwitch(permissionSwitchReadView1));\n        permissionSwitchRead2 = spy(new PermissionExceptionSwitch(permissionSwitchReadView2));\n        permissionSwitchUpdate = spy(new PermissionSwitch(permissionSwitchUpdateView));\n        permissionSwitchUpdate1 = spy(new PermissionExceptionSwitch(permissionSwitchUpdateView1));\n        permissionSwitchUpdate2 = spy(new PermissionExceptionSwitch(permissionSwitchUpdateView2));\n\n        permissionChildNode1 = spy(new PermissionLeafNode());\n        permissionChildNode1.setNodeName(\"p1\");\n        permissionChildNode1.addPermission(permissionRead1,\n                                           \"read\",\n                                           \"read\");\n        permissionChildNode1.addPermission(permissionUpdate1,\n                                           \"update\",\n                                           \"update\");\n        permissionChildNode1.addDependencies(permissionRead1,\n                                             permissionUpdate1);\n\n        permissionChildNode2 = spy(new PermissionLeafNode());\n        permissionChildNode2.setNodeName(\"p2\");\n        permissionChildNode2.addPermission(permissionRead2,\n                                           \"read\",\n                                           \"read\");\n        permissionChildNode2.addPermission(permissionUpdate2,\n                                           \"update\",\n                                           \"update\");\n        permissionChildNode2.addDependencies(permissionRead2,\n                                             permissionUpdate2);\n\n        permissionGroupNode = spy(new PermissionGroupNode(permissionTreeProvider));\n        permissionGroupNode.setNodeName(\"group\");\n        permissionGroupNode.addPermission(permissionRead,\n                                          \"read\",\n                                          \"read\");\n        permissionGroupNode.addPermission(permissionUpdate,\n                                          \"update\",\n                                          \"update\");\n        permissionGroupNode.addDependencies(permissionRead,\n                                            permissionUpdate);\n\n        permissionResourceNode = spy(new PermissionResourceNode(\"resource\",\n                                                                permissionTreeProvider));\n        permissionResourceNode.setNodeName(\"resource\");\n        permissionResourceNode.addPermission(permissionRead,\n                                             \"read\",\n                                             \"read\");\n        permissionResourceNode.addPermission(permissionUpdate,\n                                             \"update\",\n                                             \"update\");\n        permissionResourceNode.addDependencies(permissionRead,\n                                               permissionUpdate);\n\n        when(widgetFactory1.createExceptionSwitch()).thenReturn(permissionSwitchRead1,\n                                                                permissionSwitchUpdate1);\n        when(widgetFactory2.createExceptionSwitch()).thenReturn(permissionSwitchRead2,\n                                                                permissionSwitchUpdate2);\n\n        childEditor1 = spy(new LeafPermissionNodeEditor(childView1,\n                                                        widgetFactory1,\n                                                        changedEvent));\n        childEditor2 = spy(new LeafPermissionNodeEditor(childView2,\n                                                        widgetFactory2,\n                                                        changedEvent));\n\n        when(widgetFactory.createSwitch()).thenReturn(permissionSwitchRead,\n                                                      permissionSwitchUpdate);\n        when(widgetFactory.createEditor(permissionChildNode1)).thenReturn(childEditor1);\n        when(widgetFactory.createEditor(permissionChildNode2)).thenReturn(childEditor2);\n\n        presenter = new MultiplePermissionNodeEditor(view,\n                                                     liveSearchDropDown,\n                                                     widgetFactory,\n                                                     changedEvent,\n                                                     nodeAddedEvent,\n                                                     nodeRemovedEvent);\n\n        permissionResourceChildrenAvailable.add(permissionChildNode1);\n        permissionResourceChildrenAvailable.add(permissionChildNode2);\n\n        permissionResourceChildrenAdded.add(permissionChildNode1);\n        permissionResourceChildrenAdded.add(permissionChildNode2);\n\n        doAnswer(invocationOnMock -> {\n            LoadCallback callback = (LoadCallback) invocationOnMock.getArguments()[0];\n            callback.afterLoad(permissionResourceChildrenAdded);\n            return null;\n        }).when(permissionGroupNode).expand(any(LoadCallback.class));\n\n        doAnswer(invocationOnMock -> {\n            LoadCallback callback = (LoadCallback) invocationOnMock.getArguments()[0];\n            callback.afterLoad(permissionResourceChildrenAdded);\n            return null;\n        }).when(permissionResourceNode).expand(any(LoadCallback.class));\n    }\n\n    @Test\n    public void testInitGroupNode() {\n        presenter.edit(permissionGroupNode);\n\n        assertEquals(presenter.getChildEditors().size(),\n                     2);\n        assertEquals(presenter.getPermissionNode(),\n                     permissionGroupNode);\n\n        verify(view).setNodeName(\"group\");\n        verify(view,\n               never()).setNodeFullName(anyString());\n        verify(view).addPermission(permissionSwitchRead);\n        verify(view).addPermission(permissionSwitchUpdate);\n        verify(permissionSwitchRead).init(eq(\"read\"),\n                                          eq(\"read\"),\n                                          eq(true),\n                                          eq(0));\n        verify(permissionSwitchUpdate).init(eq(\"update\"),\n                                            eq(\"update\"),\n                                            eq(true),\n                                            eq(0));\n\n        verify(view).setClearChildrenEnabled(false);\n        verify(view,\n               never()).setAddChildEnabled(true);\n        verify(view,\n               never()).setChildSelector(any());\n        verifyZeroInteractions(liveSearchDropDown);\n    }\n\n    @Test\n    public void testInitResourceNode() {\n        presenter.edit(permissionResourceNode);\n\n        assertEquals(presenter.getChildEditors().size(),\n                     2);\n        assertEquals(presenter.getPermissionNode(),\n                     permissionResourceNode);\n\n        verify(view).setAddChildEnabled(true);\n        verify(view).setChildSelector(liveSearchDropDown);\n    }\n\n    @Test\n    public void testExpandGroupNode() {\n        presenter.edit(permissionGroupNode);\n        presenter.onNodeClick();\n\n        verify(view).addChildEditor(childEditor1,\n                                    false);\n        verify(view).addChildEditor(childEditor2,\n                                    false);\n        verify(view).setAddChildEnabled(false);\n        verify(view,\n               never()).setAddChildEnabled(true);\n        verify(view,\n               never()).setChildSelector(any());\n        verify(view,\n               never()).setClearChildrenEnabled(true);\n        verify(childEditor1).edit(permissionChildNode1);\n        verify(childEditor2).edit(permissionChildNode2);\n    }\n\n    @Test\n    public void testExpandResourceNode() {\n        presenter.edit(permissionResourceNode);\n        presenter.onNodeClick();\n\n        verify(view).addChildEditor(childEditor1,\n                                    true);\n        verify(view).addChildEditor(childEditor2,\n                                    true);\n        verify(view).setAddChildEnabled(true);\n        verify(view).setChildSelector(any());\n        verify(view,\n               atLeastOnce()).setClearChildrenEnabled(true);\n        verify(childEditor1).edit(permissionChildNode1);\n        verify(childEditor2).edit(permissionChildNode2);\n    }\n\n    @Test\n    public void testSwitchChange() {\n        presenter.edit(permissionGroupNode);\n\n        permissionSwitchRead.onChange();\n\n        verify(permissionRead).setResult(any());\n        verify(changedEvent).fire(any());\n    }\n\n    @Test\n    public void testSwitchInitDependencies() {\n        when(permissionSwitchReadView.isOn()).thenReturn(false);\n\n        presenter.edit(permissionGroupNode);\n\n        verify(permissionUpdate).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n    }\n\n    @Test\n    public void testSwitchChangeDependencies() {\n        presenter.edit(permissionGroupNode);\n\n        // Deny \"read\" permission\n        reset(permissionUpdate);\n        reset(permissionSwitchUpdate);\n        when(permissionSwitchRead.isOn()).thenReturn(false);\n        permissionSwitchRead.onChange();\n\n        // \"update\" permission switched to denied as it depends on \"read\"\n        verify(permissionUpdate).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n\n        // Grant \"read\" permission\n        reset(permissionSwitchUpdate);\n        when(permissionSwitchRead.isOn()).thenReturn(true);\n        permissionSwitchRead.onChange();\n\n        // \"update\" permission enabled but not switched on\n        verify(permissionSwitchUpdate).setEnabled(true);\n        verify(permissionSwitchUpdate,\n               never()).setOn(anyBoolean());\n    }\n\n    @Test\n    public void testSwitchChildDependencies() {\n        presenter.edit(permissionResourceNode);\n\n        // Permissions are denied by default on children\n        permissionSwitchReadView1.setExceptionEnabled(false);\n        permissionSwitchUpdateView1.setExceptionEnabled(false);\n\n        // Deny parent's read permission\n        reset(permissionUpdate);\n        reset(permissionSwitchRead);\n        reset(permissionSwitchUpdate);\n        when(permissionSwitchRead.isOn()).thenReturn(false);\n        permissionSwitchRead.onChange();\n\n        // Children exception flag hidden as parent has been denied\n        permissionSwitchReadView1.setExceptionEnabled(false);\n        permissionSwitchUpdateView1.setExceptionEnabled(false);\n\n        // Parent's \"update\" permission switched to denied as it depends on \"read\"\n        verify(permissionUpdate).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n        verify(permissionSwitchUpdate).setNumberOfExceptions(0);\n    }\n\n    @Test\n    public void testChildrenSwitchExceptions() {\n        presenter.edit(permissionResourceNode);\n\n        // Deny child read permission\n        when(permissionSwitchReadView1.isOn()).thenReturn(true);\n        permissionSwitchRead1.onChange();\n        verify(permissionRead1).setResult(AuthorizationResult.ACCESS_GRANTED);\n        verify(permissionSwitchReadView1).setExceptionEnabled(false);\n\n        // Deny parent's update permission\n        reset(permissionUpdate);\n        reset(permissionSwitchRead);\n        reset(permissionSwitchUpdate);\n        reset(permissionSwitchUpdateView1);\n        permissionSwitchRead.onChange();\n\n        // Children update exception flag hidden as parent has been denied\n        verify(permissionUpdate).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n        verify(permissionSwitchUpdateView1,\n               atLeastOnce()).setExceptionEnabled(false);\n\n        // Deny parent's read permission\n        reset(permissionUpdate);\n        reset(permissionSwitchRead);\n        reset(permissionSwitchUpdate);\n        reset(permissionSwitchUpdateView1);\n        when(permissionSwitchReadView.isOn()).thenReturn(false);\n        permissionSwitchRead.onChange();\n\n        // Parent's \"update\" permission switched to denied as it depends on \"read\"\n        verify(permissionUpdate).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n        verify(permissionSwitchUpdate).setNumberOfExceptions(0);\n\n        // Children's \"update\" permission switched to denied as well\n        verify(permissionUpdate1).setResult(AuthorizationResult.ACCESS_DENIED);\n        verify(permissionSwitchUpdate).setEnabled(false);\n        verify(permissionSwitchUpdate).setOn(false);\n        verify(permissionSwitchUpdateView1,\n               atLeastOnce()).setExceptionEnabled(false);\n    }\n\n    @Test\n    public void testAddChildDropDownEmpty() {\n        permissionResourceChildrenAdded.clear();\n        permissionResourceChildrenAdded.add(permissionChildNode1);\n        permissionResourceChildrenAdded.add(permissionChildNode2);\n        presenter.edit(permissionResourceNode);\n\n        LiveSearchService searchService = presenter.getChildrenSearchService();\n        searchService.search(\"\", -1, results -> {\n            assertEquals(results.size(), 0);\n        });\n    }\n\n    @Test\n    public void testAddChildDropDownFull() {\n        permissionResourceChildrenAdded.clear();\n        presenter.edit(permissionResourceNode);\n\n        LiveSearchService searchService = presenter.getChildrenSearchService();\n        searchService.search(\"\", -1, results -> {\n            assertEquals(results.size(), 2);\n        });\n    }\n\n    @Test\n    public void testAddChildDropDownDuplicateNames() {\n        permissionResourceChildrenAdded.clear();\n        permissionResourceChildrenAdded.add(permissionChildNode2);\n        PermissionLeafNode permissionChildNode3 = new PermissionLeafNode();\n        permissionChildNode3.addPermission(new DotNamedPermission(\"read.p1b\", true), \"\", \"\");\n        permissionChildNode3.setNodeName(\"p1\");\n        permissionResourceChildrenAvailable.add(permissionChildNode3);\n        presenter.edit(permissionResourceNode);\n\n        LiveSearchService<String> searchService = presenter.getChildrenSearchService();\n        searchService.search(\"\", -1, results -> {\n            assertEquals(results.size(), 2);\n            assertEquals(results.get(0).getKey(), \"read.p1\");\n            assertEquals(results.get(0).getValue(), \"p1\");\n            assertEquals(results.get(1).getKey(), \"read.p1b\");\n            assertEquals(results.get(1).getValue(), \"p1\");\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/MultiplePermissionNodeViewerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.MultiplePermissionNodeViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionNodeViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionWidgetFactory;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionGroupNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\nimport org.uberfire.security.impl.authz.DotNamedPermission;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MultiplePermissionNodeViewerTest {\n\n    @Mock\n    MultiplePermissionNodeViewer.View view;\n\n    @Mock\n    PermissionWidgetFactory widgetFactory;\n\n    @Mock\n    PermissionNode childNode1;\n\n    @Mock\n    PermissionNode childNode2;\n\n    @Mock\n    PermissionNodeViewer childViewer1;\n\n    @Mock\n    PermissionNodeViewer childViewer2;\n\n    MultiplePermissionNodeViewer presenter;\n    PermissionGroupNode permissionGroupNode;\n    PermissionResourceNode permissionResourceNode;\n    Permission permission1;\n    Permission permission2;\n    Permission permission3;\n\n    @Before\n    public void setUp() {\n        presenter = new MultiplePermissionNodeViewer(view,\n                                                     widgetFactory);\n\n        when(widgetFactory.createViewer(childNode1)).thenReturn(childViewer1);\n        when(widgetFactory.createViewer(childNode2)).thenReturn(childViewer2);\n\n        permission1 = new DotNamedPermission(\"p1\",\n                                             false);\n        permission2 = new DotNamedPermission(\"p2\",\n                                             true);\n        permission3 = new DotNamedPermission(\"p2.a\",\n                                             false);\n\n        permissionGroupNode = spy(new PermissionGroupNode(null));\n        permissionGroupNode.setNodeName(\"r1\");\n\n        permissionResourceNode = spy(new PermissionResourceNode(\"r2\",\n                                                                null));\n        permissionResourceNode.setNodeName(\"r2\");\n        permissionResourceNode.addPermission(permission1,\n                                             \"grant1\",\n                                             \"deny1\");\n        permissionResourceNode.addPermission(permission2,\n                                             \"grant2\",\n                                             \"deny2\");\n\n        when(childNode1.getNodeName()).thenReturn(\"p2.a\");\n        when(childNode1.getPermissionList()).thenReturn(Arrays.asList(permission3));\n\n        doAnswer(invocationOnMock -> {\n            LoadCallback callback = (LoadCallback) invocationOnMock.getArguments()[0];\n            callback.afterLoad(Arrays.asList(childNode1,\n                                             childNode2));\n            return null;\n        }).when(permissionGroupNode).expand(any(LoadCallback.class));\n\n        doAnswer(invocationOnMock -> {\n            LoadCallback callback = (LoadCallback) invocationOnMock.getArguments()[0];\n            callback.afterLoad(Arrays.asList(childNode1));\n            return null;\n        }).when(permissionResourceNode).expand(any(LoadCallback.class));\n    }\n\n    @Test\n    public void testInitGroupNode() {\n        presenter.show(permissionGroupNode);\n\n        assertEquals(presenter.getPermissionNode(),\n                     permissionGroupNode);\n\n        verify(view).setNodeName(\"r1\");\n        verify(view,\n               never()).setNodeFullName(anyString());\n        verify(view).setPermissionsVisible(false);\n        verify(view).addChildViewer(childViewer1);\n        verify(view).addChildViewer(childViewer2);\n    }\n\n    @Test\n    public void testInitResourceNode() {\n        presenter.show(permissionResourceNode);\n\n        assertEquals(presenter.getPermissionNode(),\n                     permissionResourceNode);\n\n        verify(view,\n               never()).addChildViewer(any());\n        verify(view).setNodeName(\"r2\");\n        verify(view,\n               never()).setNodeFullName(anyString());\n        verify(view).setPermissionsVisible(true);\n        verify(view).addItemsGrantedPermission(\"grant2\",\n                                               \"r2\");\n        verify(view).addItemException(\"p2.a\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/PermissionExceptionSwitchTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionExceptionSwitch;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PermissionExceptionSwitchTest {\n\n    @Mock\n    PermissionExceptionSwitch.View view;\n\n    @Mock\n    Command onChange;\n\n    PermissionExceptionSwitch presenter;\n\n    @Before\n    public void setup() {\n        presenter = new PermissionExceptionSwitch(view);\n    }\n\n    @Test\n    public void testExceptionInit() {\n        when(view.isOn()).thenReturn(true);\n        presenter.init(null,\n                       null,\n                       true,\n                       true);\n\n        assertTrue(presenter.isOn());\n        verify(view).init(null,\n                          null);\n        verify(view).setOn(true);\n        verify(view).setExceptionEnabled(true);\n        assertTrue(presenter.isOn());\n    }\n\n    @Test\n    public void testExceptionChange() {\n        when(view.isOn()).thenReturn(false);\n        presenter.init(null,\n                       null,\n                       true,\n                       true);\n        presenter.setOnChange(onChange);\n\n        reset(view);\n        presenter.onChange();\n        assertFalse(presenter.isOn());\n        verify(onChange).execute();\n\n        reset(view);\n        presenter.onChange();\n    }\n\n    @Test\n    public void testNoExceptionInit() {\n        when(view.isOn()).thenReturn(true);\n        presenter.init(null,\n                       null,\n                       true,\n                       false);\n\n        assertTrue(presenter.isOn());\n        verify(view).init(null,\n                          null);\n        verify(view).setOn(true);\n        assertTrue(presenter.isOn());\n    }\n\n    @Test\n    public void testNoExceptionChange() {\n        when(view.isOn()).thenReturn(false);\n        presenter.init(null,\n                       null,\n                       true,\n                       false);\n        presenter.setOnChange(onChange);\n\n        reset(view);\n        presenter.onChange();\n        assertFalse(presenter.isOn());\n        verify(onChange).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/PermissionSwitchTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.node.PermissionSwitch;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PermissionSwitchTest {\n\n    @Mock\n    PermissionSwitch.View view;\n\n    @Mock\n    Command onChange;\n\n    PermissionSwitch presenter;\n\n    @Before\n    public void setup() {\n        presenter = new PermissionSwitch(view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init(\"On\",\n                       \"Off\",\n                       true,\n                       0);\n        when(view.isOn()).thenReturn(true);\n\n        verify(view).init(\"On\",\n                          \"Off\",\n                          true);\n        assertTrue(presenter.isOn());\n    }\n\n    @Test\n    public void testChange() {\n        presenter.init(\"On\",\n                       \"Off\",\n                       true,\n                       0);\n        presenter.setOnChange(onChange);\n        when(view.isOn()).thenReturn(false);\n\n        presenter.onChange();\n        assertFalse(presenter.isOn());\n        verify(onChange).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/acl/PriorityDropDownTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.acl;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchDropDown;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PriorityDropDownTest {\n\n    PriorityDropDown priorityDropDown;\n\n    @Mock\n    LiveSearchDropDown searchDropDown;\n\n    @Before\n    public void setup() {\n        priorityDropDown = new PriorityDropDown(searchDropDown);\n        priorityDropDown.priorityItemList = Arrays.asList(\"5\",\n                                                          \"4\",\n                                                          \"3\",\n                                                          \"2\",\n                                                          \"1\");\n    }\n\n    @Test\n    public void testResolvePriority() {\n        assertEquals(priorityDropDown.getPriorityName(-10),\n                     \"1\");\n        assertEquals(priorityDropDown.getPriorityName(-5),\n                     \"2\");\n        assertEquals(priorityDropDown.getPriorityName(-1),\n                     \"2\");\n        assertEquals(priorityDropDown.getPriorityName(0),\n                     \"3\");\n        assertEquals(priorityDropDown.getPriorityName(1),\n                     \"4\");\n        assertEquals(priorityDropDown.getPriorityName(5),\n                     \"4\");\n        assertEquals(priorityDropDown.getPriorityName(6),\n                     \"5\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GroupEditorTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    EventSourceMock<OnShowEvent> onShowEvent;\n    @Mock\n    EventSourceMock<OnEditEvent> onEditEvent;\n    @Mock\n    EventSourceMock<OnDeleteEvent> onDeleteEvent;\n    @Mock\n    ACLSettings aclSettings;\n    @Mock\n    ACLViewer aclViewer;\n    @Mock\n    ACLEditor aclEditor;\n    @Mock\n    GroupEditor.View view;\n    @Mock\n    Group group;\n    private GroupEditor tested;\n\n    @Before\n    public void setup() {\n        when(userSystemManager.isGroupCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        when(group.getName()).thenReturn(\"group1\");\n        tested = new GroupEditor(userSystemManager,\n                                 onEditEvent,\n                                 onShowEvent,\n                                 onDeleteEvent,\n                                 aclSettings,\n                                 aclViewer,\n                                 aclEditor,\n                                 view);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(view,\n               times(1)).init(tested);\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).clear();\n    }\n\n    @Test\n    public void testClear() {\n        tested.group = group;\n        tested.clear();\n        assertNull(tested.group);\n        verify(view,\n               times(0)).init(tested);\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testShow() {\n        tested.show(group);\n        assertEquals(group,\n                     tested.group);\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(1)).show(\"group1\");\n        verify(view,\n               times(1)).showACL(aclViewer);\n        verify(view,\n               times(1)).setDeleteButtonVisible(false);\n        verify(view,\n               times(1)).setEditButtonVisible(true);\n        verify(view,\n               times(1)).setDeleteButtonVisible(false);\n    }\n\n    @Test\n    public void testEdit() {\n        tested.edit(group);\n        assertEquals(group,\n                     tested.group);\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(1)).show(\"group1\");\n        verify(view,\n               times(1)).editACL(aclEditor);\n        verify(view,\n               times(1)).setDeleteButtonVisible(true);\n        verify(view,\n               times(1)).setEditButtonVisible(false);\n        verify(view,\n               times(1)).setDeleteButtonVisible(true);\n    }\n\n    @Test\n    public void testOnDelete() {\n        tested.onDelete();\n        verify(onDeleteEvent,\n               times(1)).fire(any(OnDeleteEvent.class));\n        verify(view,\n               times(0)).init(tested);\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/GroupUsersAssignmentTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.ExplorerViewContext;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.UsersExplorer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GroupUsersAssignmentTest {\n\n    @Mock\n    AssignedEntitiesEditor<GroupUsersAssignment> view;\n    @Mock\n    UsersExplorer usersExplorer;\n    @Mock\n    EventSourceMock<AddUsersToGroupEvent> addUsersToGroupEvent;\n\n    private GroupUsersAssignment tested;\n\n    @Before\n    public void setup() {\n        tested = new GroupUsersAssignment(view,\n                                          usersExplorer,\n                                          addUsersToGroupEvent);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(view,\n               times(1)).init(tested);\n        verify(view,\n               times(1)).configure(any());\n        verify(view,\n               times(1)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testShow() {\n        final String header = \"header\";\n        tested.show(header);\n        verify(usersExplorer,\n               times(1)).clear();\n        verify(usersExplorer,\n               times(1)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(1)).show(anyString());\n        verify(view,\n               times(0)).init(tested);\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testHide() {\n        tested.hide();\n        verify(view,\n               times(1)).hide();\n        verify(usersExplorer,\n               times(0)).clear();\n        verify(usersExplorer,\n               times(0)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).init(tested);\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n    }\n\n    @Test\n    public void testSaveEditorCallback() {\n        final Set<String> selectedUsers = new HashSet<String>(1);\n        selectedUsers.add(\"user1\");\n        when(usersExplorer.getSelectedEntities()).thenReturn(selectedUsers);\n        tested.saveEditorCallback.execute();\n        verify(view,\n               times(1)).hide();\n        verify(addUsersToGroupEvent,\n               times(1)).fire(any(AddUsersToGroupEvent.class));\n        verify(usersExplorer,\n               times(0)).clear();\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).init(tested);\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(usersExplorer,\n               times(0)).show(any(ExplorerViewContext.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/workflow/GroupCreationWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.ext.security.management.api.GroupManagerSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.CreateEntity;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.GroupUsersAssignment;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GroupCreationWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    AuthorizationService authorizationService;\n    Caller<AuthorizationService> authorizationServiceCaller;\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    CreateEntity createEntity;\n    @Mock\n    GroupUsersAssignment groupUsersAssignment;\n    @Mock\n    EventSourceMock<CreateGroupEvent> onCreateGroupEvent;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    Group group;\n    @Mock\n    private GroupEditorWorkflow groupEditorWorkflow;\n\n    private GroupCreationWorkflow tested;\n\n    PermissionManager permissionManager;\n\n    @Before\n    public void setup() {\n        super.setup();\n        permissionManager = new DefaultPermissionManager();\n        authorizationServiceCaller = new CallerMock<>(authorizationService);\n        when(group.getName()).thenReturn(\"group1\");\n        when(view.setWidget(any())).thenReturn(view);\n        when(view.clearNotifications()).thenReturn(view);\n        when(view.setCallback(any())).thenReturn(view);\n        when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonText(any())).thenReturn(view);\n        when(view.showNotification(any())).thenReturn(view);\n        when(groupsManagerService.get(any())).thenReturn(group);\n        GroupManagerSettings settings = mock(GroupManagerSettings.class);\n        when(settings.allowEmpty()).thenReturn(true);\n        when(userSystemManager.getGroupManagerSettings()).thenReturn(settings);\n        tested = new GroupCreationWorkflow(userSystemManager,\n                                           authorizationServiceCaller,\n                                           permissionManager,\n                                           errorEvent,\n                                           confirmBox,\n                                           loadingBox,\n                                           workbenchNotification,\n                                           createEntity,\n                                           groupUsersAssignment,\n                                           onCreateGroupEvent,\n                                           view);\n    }\n\n    @Test\n    public void testClear() {\n        tested.group = group;\n        tested.clear();\n        assertNull(tested.group);\n        verify(createEntity,\n               times(1)).clear();\n        verify(groupUsersAssignment,\n               times(1)).clear();\n        verify(view,\n               times(1)).clearNotifications();\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setSaveButtonEnabled(anyBoolean());\n        verify(view,\n               times(0)).showNotification(anyString());\n    }\n\n    @Test\n    public void testShowError() {\n        tested.showErrorMessage(\"error1\");\n        verify(errorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testCreate() {\n        tested.create();\n        verify(createEntity,\n               times(1)).show(anyString(),\n                              anyString());\n        verify(view,\n               times(1)).setCancelButtonVisible(false);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(1)).clearNotifications();\n    }\n\n    @Test\n    public void testShowUsersAssignment() {\n        tested.group = group;\n        tested.showUsersAssignment(group.getName());\n        verify(groupUsersAssignment,\n               times(1)).show(anyString());\n        verify(view,\n               times(1)).setCancelButtonVisible(true);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(false);\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(0)).clearNotifications();\n    }\n\n    @Test\n    public void testCheckCreateExisting() {\n        when(groupsManagerService.get(anyString())).thenReturn(group);\n        when(createEntity.getEntityIdentifier()).thenReturn(\"group1\");\n        tested.checkCreate();\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(errorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n        verify(createEntity,\n               times(1)).setErrorState();\n    }\n\n    @Test\n    public void testOnCreateEntityXSSContent() {\n        when(createEntity.getEntityIdentifier()).thenReturn(\"<img/src/onerror=alert('XSS')>\");\n        tested.checkCreate();\n        verify(errorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testCheckCreateConstrainedGroup() {\n        Collection<String> cGroups = new ArrayList<String>(1);\n        cGroups.add(\"admin\");\n        when(userSystemManager.getConstrainedGroups()).thenReturn(cGroups);\n        when(createEntity.getEntityIdentifier()).thenReturn(\"admin\");\n        tested.checkCreate();\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(errorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n        verify(createEntity,\n               times(1)).setErrorState();\n    }\n\n    @Test\n    public void testCreateGroup() {\n        final CreateGroupEvent onCreateEvent = mock(CreateGroupEvent.class);\n        when(onCreateEvent.getName()).thenReturn(\"group1\");\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Command noCommand = (Command) invocationOnMock.getArguments()[3];\n                noCommand.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(Command.class),\n                                 any(Command.class));\n        tested.createGroup(\"group1\");\n        tested.onCreateGroupEvent(onCreateEvent);\n        verify(createEntity,\n               times(2)).clear();\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(Command.class),\n                              any(Command.class));\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n        verify(onCreateGroupEvent,\n               times(1)).fire(any(CreateGroupEvent.class));\n    }\n\n    @Test\n    public void testOnAssignUsers() {\n        final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class);\n        final Set<String> users = new HashSet<String>(1);\n        users.add(\"user1\");\n        when(addUsersToGroupEvent.getContext()).thenReturn(groupUsersAssignment);\n        when(addUsersToGroupEvent.getUsers()).thenReturn(users);\n        tested.group = group;\n        tested.onAssignUsers(addUsersToGroupEvent);\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n        verify(onCreateGroupEvent,\n               times(1)).fire(any(CreateGroupEvent.class));\n        verify(createEntity,\n               times(1)).show(anyString(),\n                              anyString());\n        verify(view,\n               times(1)).setCancelButtonVisible(false);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(1)).clearNotifications();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/group/workflow/GroupEditorWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.group.workflow;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.editor.group.GroupEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.group.GroupEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionCollection;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GroupEditorWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    AuthorizationService authorizationService;\n    Caller<AuthorizationService> authorizationServiceCaller;\n\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EventSourceMock<SaveGroupEvent> saveGroupEvent;\n    @Mock\n    EventSourceMock<DeleteGroupEvent> deleteGroupEvent;\n    @Mock\n    GroupEditor groupEditor;\n    @Mock\n    GroupEditorDriver groupEditorDriver;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    ACLSettings aclSettings;\n    @Mock\n    PerspectiveActivity homePerspective;\n\n    PermissionManager permissionManager;\n    PermissionCollection permissionCollection;\n    GroupEditorWorkflow tested;\n    @Mock\n    Group group;\n\n    @Before\n    public void setup() {\n        super.setup();\n        permissionCollection = new DefaultPermissionCollection();\n        permissionManager = new DefaultPermissionManager();\n\n        when(homePerspective.getIdentifier()).thenReturn(\"home\");\n        when(homePerspective.getResourceType()).thenReturn(ActivityResourceType.PERSPECTIVE);\n        when(groupEditor.permissions()).thenReturn(permissionCollection);\n        when(aclSettings.getHomePerspective()).thenReturn(homePerspective);\n        when(groupEditor.getAclSettings()).thenReturn(aclSettings);\n        when(group.getName()).thenReturn(\"group1\");\n        when(view.setWidget(any())).thenReturn(view);\n        when(view.clearNotifications()).thenReturn(view);\n        when(view.setCallback(any())).thenReturn(view);\n        when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonText(any())).thenReturn(view);\n        when(view.showNotification(any())).thenReturn(view);\n        when(groupsManagerService.get(any())).thenReturn(group);\n        authorizationServiceCaller = new CallerMock<>(authorizationService);\n        tested = spy(new GroupEditorWorkflow(userSystemManager,\n                                             authorizationServiceCaller,\n                                             permissionManager,\n                                             errorEvent,\n                                             confirmBox,\n                                             loadingBox,\n                                             workbenchNotification,\n                                             saveGroupEvent,\n                                             deleteGroupEvent,\n                                             groupEditor,\n                                             groupEditorDriver,\n                                             view));\n    }\n\n    @Test\n    public void testClear() {\n        tested.group = group;\n        tested.clear();\n        assertNull(tested.group);\n        verify(groupEditor,\n               times(1)).clear();\n        verify(groupEditor,\n               times(0)).show(any(Group.class));\n        verify(view,\n               times(1)).clearNotifications();\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setSaveButtonEnabled(anyBoolean());\n        verify(view,\n               times(0)).showNotification(anyString());\n    }\n\n    @Test\n    public void testShow() {\n        final String name = \"group1\";\n        tested.show(name);\n        verify(view,\n               times(1)).setCancelButtonVisible(false);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(false);\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(groupEditorDriver,\n               times(1)).edit(group,\n                              groupEditor);\n        verify(groupEditor,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testOnDeleteGroupEvent() {\n        final OnDeleteEvent onDeleteEvent = mock(OnDeleteEvent.class);\n        when(onDeleteEvent.getContext()).thenReturn(groupEditor);\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(),\n                                 any());\n        tested.group = group;\n        tested.onDeleteGroupEvent(onDeleteEvent);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(),\n                              any());\n        verify(deleteGroupEvent,\n               times(1)).fire(any(DeleteGroupEvent.class));\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n    }\n\n    @Test\n    public void testShowError() {\n        Throwable error = mock(Throwable.class);\n        when(error.getMessage()).thenReturn(\"error1\");\n        tested.showError(error);\n        verify(errorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testHomePerspectiveGranted() {\n        permissionCollection.add(permissionManager.createPermission(homePerspective,\n                                                                    PerspectiveAction.READ,\n                                                                    true));\n        tested.edit();\n        verify(tested,\n               never()).showNotification(anyString());\n    }\n\n    @Test\n    public void testHomePerspectiveDenied() {\n        permissionCollection.add(permissionManager.createPermission(homePerspective,\n                                                                    PerspectiveAction.READ,\n                                                                    false));\n        tested.edit();\n        verify(tested).showNotification(anyString());\n    }\n\n    private void assertNoViewCalls() {\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setSaveButtonEnabled(anyBoolean());\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(0)).clearNotifications();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/role/workflow/RoleEditorWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.role.workflow;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.client.authz.PerspectiveAction;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.security.management.client.editor.role.RoleEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLSettings;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.role.RoleEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionCollection;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RoleEditorWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    Caller<AuthorizationService> authorizationService;\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EventSourceMock<SaveRoleEvent> saveRoleEvent;\n    @Mock\n    RoleEditor roleEditor;\n    @Mock\n    RoleEditorDriver roleEditorDriver;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    ACLSettings aclSettings;\n    @Mock\n    PerspectiveActivity homePerspective;\n    @Mock\n    Role role;\n\n    PermissionManager permissionManager;\n    PermissionCollection permissionCollection;\n    RoleEditorWorkflow tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        permissionCollection = new DefaultPermissionCollection();\n        permissionManager = new DefaultPermissionManager();\n\n        when(homePerspective.getIdentifier()).thenReturn(\"home\");\n        when(homePerspective.getResourceType()).thenReturn(ActivityResourceType.PERSPECTIVE);\n        when(roleEditor.permissions()).thenReturn(permissionCollection);\n        when(aclSettings.getHomePerspective()).thenReturn(homePerspective);\n        when(roleEditor.getAclSettings()).thenReturn(aclSettings);\n        when(role.getName()).thenReturn(\"role1\");\n        when(view.setWidget(any())).thenReturn(view);\n        when(view.clearNotifications()).thenReturn(view);\n        when(view.setCallback(any())).thenReturn(view);\n        when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonText(any())).thenReturn(view);\n        when(view.showNotification(any())).thenReturn(view);\n        when(rolesManagerService.get(any())).thenReturn(role);\n\n        tested = spy(new RoleEditorWorkflow(userSystemManager,\n                                            authorizationService,\n                                            permissionManager,\n                                            errorEvent,\n                                            workbenchNotification,\n                                            saveRoleEvent,\n                                            confirmBox,\n                                            roleEditor,\n                                            roleEditorDriver,\n                                            loadingBox,\n                                            view));\n    }\n\n    @Test\n    public void testClear() {\n        tested.role = role;\n        tested.clear();\n        assertNull(tested.role);\n        verify(roleEditor).clear();\n        verify(roleEditor,\n               never()).show(any(Role.class));\n        verify(view,\n               atLeastOnce()).clearNotifications();\n        verify(view,\n               never()).setCancelButtonVisible(true);\n        verify(view,\n               never()).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               never()).setSaveButtonText(anyString());\n        verify(view,\n               never()).setWidget(any(IsWidget.class));\n        verify(view,\n               never()).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               never()).setSaveButtonEnabled(anyBoolean());\n        verify(view,\n               never()).showNotification(anyString());\n    }\n\n    @Test\n    public void testShow() {\n        final String name = \"role1\";\n        tested.show(name);\n        verify(view).setCancelButtonVisible(false);\n        verify(view).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view).setSaveButtonText(anyString());\n        verify(view).setWidget(any());\n        verify(view).setSaveButtonVisible(false);\n        verify(view).setSaveButtonEnabled(false);\n        verify(view,\n               never()).showNotification(anyString());\n        verify(view).clearNotifications();\n        verify(roleEditorDriver).edit(role,\n                                      roleEditor);\n        verify(roleEditor).clear();\n    }\n\n    @Test\n    public void testShowError() {\n        Throwable error = mock(Throwable.class);\n        when(error.getMessage()).thenReturn(\"error1\");\n        tested.showError(error);\n        verify(errorEvent).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testHomePerspectiveGranted() {\n        permissionCollection.add(permissionManager.createPermission(homePerspective,\n                                                                    PerspectiveAction.READ,\n                                                                    true));\n        tested.edit();\n        verify(tested,\n               never()).showNotification(anyString());\n    }\n\n    @Test\n    public void testHomePerspectiveDenied() {\n        permissionCollection.add(permissionManager.createPermission(homePerspective,\n                                                                    PerspectiveAction.READ,\n                                                                    false));\n        tested.edit();\n        verify(tested).showNotification(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/NewUserAttributeEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport com.google.gwt.editor.client.Editor;\nimport com.google.gwt.editor.client.EditorError;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.form.validator.Validator;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNull;\nimport static junit.framework.Assert.assertTrue;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NewUserAttributeEditorTest {\n\n    @Mock\n    EventSourceMock<CreateUserAttributeEvent> createUserAttributeEventEvent;\n    @Mock\n    NewUserAttributeEditor.View view;\n\n    private NewUserAttributeEditor presenter;\n\n    @Before\n    public void setup() {\n        when(view.configure(any(Validator.class),\n                            any(Validator.class))).thenReturn(view);\n        when(view.reset()).thenReturn(view);\n        when(view.setShowAddButton(anyBoolean())).thenReturn(view);\n        when(view.setShowForm(anyBoolean())).thenReturn(view);\n        presenter = new NewUserAttributeEditor(view,\n                                               createUserAttributeEventEvent);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view,\n               times(1)).init(presenter);\n        verify(view,\n               times(1)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(0)).reset();\n        verify(view,\n               times(0)).setShowAddButton(any(Boolean.class));\n        verify(view,\n               times(0)).setShowForm(any(Boolean.class));\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testShowAddButton() {\n        presenter.showAddButton();\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(1)).reset();\n        verify(view,\n               times(1)).setShowAddButton(true);\n        verify(view,\n               times(1)).setShowForm(false);\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testOnCancel() {\n        presenter.showAddButton();\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(1)).reset();\n        verify(view,\n               times(1)).setShowAddButton(true);\n        verify(view,\n               times(1)).setShowForm(false);\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testShowForm() {\n        presenter.showForm();\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(1)).reset();\n        verify(view,\n               times(1)).setShowAddButton(false);\n        verify(view,\n               times(1)).setShowForm(true);\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testOnNewAttributeClick() {\n        presenter.showForm();\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(1)).reset();\n        verify(view,\n               times(1)).setShowAddButton(false);\n        verify(view,\n               times(1)).setShowForm(true);\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testClear() {\n        presenter.restrictedAttributeNames = new ArrayList<String>();\n        presenter.clear();\n        assertNull(presenter.restrictedAttributeNames);\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(1)).reset();\n        verify(view,\n               times(1)).setShowAddButton(true);\n        verify(view,\n               times(1)).setShowForm(false);\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testSetRestrictedValues() {\n        Collection<String> values = new ArrayList<String>();\n        presenter.setRestrictedValues(values);\n        assertEquals(values,\n                     presenter.restrictedAttributeNames);\n    }\n\n    @Test\n    public void testAttributeNameValidatorSuccess() {\n        Editor<String> editorMock = mock(Editor.class);\n        List<EditorError> result = presenter.attributeNameValidator.validate(editorMock,\n                                                                             \"s1\");\n        assertTrue(result.isEmpty());\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(0)).reset();\n        verify(view,\n               times(0)).setShowAddButton(any(Boolean.class));\n        verify(view,\n               times(0)).setShowForm(any(Boolean.class));\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testAttributeNameValidatorFail() {\n        Editor<String> editorMock = mock(Editor.class);\n        List<EditorError> result = presenter.attributeNameValidator.validate(editorMock,\n                                                                             \"\");\n        assertFalse(result.isEmpty());\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(0)).reset();\n        verify(view,\n               times(0)).setShowAddButton(any(Boolean.class));\n        verify(view,\n               times(0)).setShowForm(any(Boolean.class));\n        verify(view,\n               times(1)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testAttributeValueValidatorSuccess() {\n        Editor<String> editorMock = mock(Editor.class);\n        List<EditorError> result = presenter.attributeValueValidator.validate(editorMock,\n                                                                              \"v1\");\n        assertTrue(result.isEmpty());\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(0)).reset();\n        verify(view,\n               times(0)).setShowAddButton(any(Boolean.class));\n        verify(view,\n               times(0)).setShowForm(any(Boolean.class));\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(0)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n\n    @Test\n    public void testAttributeValueValidatorFail() {\n        Editor<String> editorMock = mock(Editor.class);\n        List<EditorError> result = presenter.attributeValueValidator.validate(editorMock,\n                                                                              \"\");\n        assertFalse(result.isEmpty());\n        verify(view,\n               times(0)).init(any(NewUserAttributeEditor.class));\n        verify(view,\n               times(0)).configure(any(Validator.class),\n                                   any(Validator.class));\n        verify(view,\n               times(0)).reset();\n        verify(view,\n               times(0)).setShowAddButton(any(Boolean.class));\n        verify(view,\n               times(0)).setShowForm(any(Boolean.class));\n        verify(view,\n               times(0)).createAttributeNameError(anyString(),\n                                                  anyString());\n        verify(view,\n               times(1)).createAttributeValueError(anyString(),\n                                                   anyString());\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedGroupsEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.ExplorerViewContext;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.GroupsExplorer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserAssignedGroupsEditorTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    EventSourceMock<OnUpdateUserGroupsEvent> updateUserGroupsEventEvent;\n    @Mock\n    GroupsExplorer groupsExplorer;\n    @Mock\n    AssignedEntitiesEditor<UserAssignedGroupsEditor> view;\n    @Mock\n    User user;\n    private UserAssignedGroupsEditor tested;\n\n    @Before\n    public void setup() {\n        Map<String, String> userAttributes = new HashMap<String, String>(1);\n        userAttributes.put(\"attr1\",\n                           \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(userAttributes);\n        final Set<Group> groups = new HashSet<Group>();\n        groups.add(new GroupImpl(\"group1\"));\n        when(user.getGroups()).thenReturn(groups);\n        doAnswer(new Answer<Group>() {\n            @Override\n            public Group answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Group group = mock(Group.class);\n                return group;\n            }\n        }).when(userSystemManager).createGroup(anyString());\n        when(userSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        tested = new UserAssignedGroupsEditor(userSystemManager,\n                                              groupsExplorer,\n                                              view,\n                                              updateUserGroupsEventEvent);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(view,\n               times(1)).init(tested);\n        verify(view,\n               times(1)).configure(any());\n        verify(view,\n               times(1)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(1)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(groupsExplorer,\n               times(1)).setPageSize(anyInt());\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testClear() {\n        tested.clear();\n        verify(groupsExplorer,\n               times(1)).clear();\n        assertTrue(tested.entities.isEmpty());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testHide() {\n        tested.hide();\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testShow() {\n        tested.show(user);\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(groupsExplorer,\n               times(1)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(1)).show(anyString());\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testEdit() {\n        tested.edit(user);\n        assertTrue(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(groupsExplorer,\n               times(1)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(1)).show(anyString());\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testCloseEditorCallback() {\n        tested.closeEditorCallback.execute();\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testSaveEditorCallback() {\n        final Set<String> selectedGroups = new HashSet<String>();\n        selectedGroups.add(\"groupE1\");\n        when(groupsExplorer.getSelectedEntities()).thenReturn(selectedGroups);\n        tested.saveEditorCallback.execute();\n        assertTrue(tested.entities.size() == 1);\n        verify(groupsExplorer,\n               times(1)).getSelectedEntities();\n        verify(groupsExplorer,\n               times(1)).clear();\n        verify(updateUserGroupsEventEvent,\n               times(1)).fire(any(OnUpdateUserGroupsEvent.class));\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    private void assertNoViewCalls() {\n        verify(view,\n               times(0)).init(any(UserAssignedGroupsEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedGroupsExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.management.list.GroupsList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserAssignedGroupsExplorerTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    EventSourceMock<OnRemoveUserGroupEvent> removeUserGroupEventEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    GroupsList groupList;\n    @Mock\n    AssignedEntitiesExplorer view;\n    @Mock\n    User user;\n    private UserAssignedGroupsExplorer tested;\n\n    @Before\n    public void setup() {\n        Map<String, String> userAttributes = new HashMap<String, String>(1);\n        userAttributes.put(\"attr1\",\n                           \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(userAttributes);\n        final Set<Group> groups = new HashSet<Group>();\n        groups.add(new GroupImpl(\"group1\"));\n        when(user.getGroups()).thenReturn(groups);\n        doAnswer(new Answer<Group>() {\n            @Override\n            public Group answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Group group = mock(Group.class);\n                return group;\n            }\n        }).when(userSystemManager).createGroup(anyString());\n        when(userSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        tested = new UserAssignedGroupsExplorer(userSystemManager,\n                                                confirmBox,\n                                                groupList,\n                                                view,\n                                                removeUserGroupEventEvent);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(groupList,\n               times(1)).setPageSize(anyInt());\n        verify(groupList,\n               times(1)).setEmptyEntitiesText(anyString());\n        verify(view,\n               times(1)).configure(any(),\n                                   any());\n        verify(view,\n               times(0)).clear();\n    }\n\n    @Test\n    public void testClear() {\n        tested.clear();\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(1)).clear();\n        verify(groupList,\n               times(1)).clear();\n        assertTrue(tested.entities.isEmpty());\n        assertFalse(tested.isEditMode);\n    }\n\n    @Test\n    public void testShow() {\n        tested.show(user);\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(1)).clear();\n        verify(groupList,\n               times(1)).clear();\n        verify(groupList,\n               times(1)).show(anySet(),\n                              any(EntitiesList.Callback.class));\n    }\n\n    @Test\n    public void testRemoveGroup() {\n        Group g = mock(Group.class);\n        when(g.getName()).thenReturn(\"group1\");\n        tested.entities.add(g);\n        tested.removeEntity(\"group1\");\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 0);\n        verify(groupList,\n               times(1)).show(anySet(),\n                              any(EntitiesList.Callback.class));\n        verify(removeUserGroupEventEvent,\n               times(1)).fire(any(OnRemoveUserGroupEvent.class));\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(0)).clear();\n        verify(groupList,\n               times(0)).clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedRolesEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.EntitiesExplorerView;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.ExplorerViewContext;\nimport org.uberfire.ext.security.management.client.widgets.management.explorer.RolesExplorer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserAssignedRolesEditorTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    EventSourceMock<OnUpdateUserRolesEvent> updateUserRolesEvent;\n    @Mock\n    RolesExplorer rolesExplorer;\n    @Mock\n    AssignedEntitiesEditor<UserAssignedRolesEditor> view;\n    @Mock\n    User user;\n    private UserAssignedRolesEditor tested;\n\n    @Before\n    public void setup() {\n        Map<String, String> userAttributes = new HashMap<String, String>(1);\n        userAttributes.put(\"attr1\",\n                           \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(userAttributes);\n        final Set<Role> roles = new HashSet<Role>();\n        final Role role = mock(Role.class);\n        when(role.getName()).thenReturn(\"role1\");\n        roles.add(role);\n        when(user.getRoles()).thenReturn(roles);\n        doAnswer(new Answer<Role>() {\n            @Override\n            public Role answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Role _role = mock(Role.class);\n                return _role;\n            }\n        }).when(userSystemManager).createRole(anyString());\n        tested = new UserAssignedRolesEditor(userSystemManager,\n                                             rolesExplorer,\n                                             view,\n                                             updateUserRolesEvent);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(view,\n               times(1)).init(tested);\n        verify(view,\n               times(1)).configure(any());\n        verify(view,\n               times(1)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(1)).configureSave(anyString(),\n                                       any(Command.class));\n        verify(rolesExplorer,\n               times(1)).setPageSize(anyInt());\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testClear() {\n        tested.clear();\n        verify(rolesExplorer,\n               times(1)).clear();\n        assertTrue(tested.entities.isEmpty());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testHide() {\n        tested.hide();\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testShow() {\n        tested.show(user);\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(rolesExplorer,\n               times(1)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(1)).show(anyString());\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testEdit() {\n        tested.edit(user);\n        assertTrue(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(rolesExplorer,\n               times(1)).show(any(ExplorerViewContext.class));\n        verify(view,\n               times(1)).show(anyString());\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testCloseEditorCallback() {\n        tested.closeEditorCallback.execute();\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    @Test\n    public void testSaveEditorCallback() {\n        final Set<String> selectedRoles = new HashSet<String>();\n        selectedRoles.add(\"roleE1\");\n        when(rolesExplorer.getSelectedEntities()).thenReturn(selectedRoles);\n        tested.saveEditorCallback.execute();\n        assertTrue(tested.entities.size() == 1);\n        verify(rolesExplorer,\n               times(1)).getSelectedEntities();\n        verify(rolesExplorer,\n               times(1)).clear();\n        verify(updateUserRolesEvent,\n               times(1)).fire(any(OnUpdateUserRolesEvent.class));\n        verify(view,\n               times(1)).hide();\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n\n    private void assertNoViewCalls() {\n        verify(view,\n               times(0)).init(any(UserAssignedRolesEditor.class));\n        verify(view,\n               times(0)).configure(any(EntitiesExplorerView.class));\n        verify(view,\n               times(0)).show(anyString());\n        verify(view,\n               times(0)).hide();\n        verify(view,\n               times(0)).configureClose(anyString(),\n                                        any(Command.class));\n        verify(view,\n               times(0)).configureSave(anyString(),\n                                       any(Command.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAssignedRolesExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.management.list.RolesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserAssignedRolesExplorerTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    EventSourceMock<OnRemoveUserRoleEvent> removeUserRoleEventEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    RolesList rolesList;\n    @Mock\n    AssignedEntitiesExplorer view;\n    @Mock\n    User user;\n    private UserAssignedRolesExplorer tested;\n\n    @Before\n    public void setup() {\n        Map<String, String> userAttributes = new HashMap<String, String>(1);\n        userAttributes.put(\"attr1\",\n                           \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(userAttributes);\n        final Set<Role> roles = new HashSet<Role>();\n        final Role role = mock(Role.class);\n        when(role.getName()).thenReturn(\"role1\");\n        roles.add(role);\n        when(user.getRoles()).thenReturn(roles);\n        doAnswer(new Answer<Role>() {\n            @Override\n            public Role answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Role _role = mock(Role.class);\n                return _role;\n            }\n        }).when(userSystemManager).createRole(anyString());\n        tested = new UserAssignedRolesExplorer(userSystemManager,\n                                               confirmBox,\n                                               rolesList,\n                                               view,\n                                               removeUserRoleEventEvent);\n    }\n\n    @Test\n    public void testInit() {\n        tested.init();\n        verify(rolesList,\n               times(1)).setPageSize(anyInt());\n        verify(rolesList,\n               times(1)).setEmptyEntitiesText(anyString());\n        verify(view,\n               times(1)).configure(any(),\n                                   any());\n        verify(view,\n               times(0)).clear();\n    }\n\n    @Test\n    public void testClear() {\n        tested.clear();\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(1)).clear();\n        verify(rolesList,\n               times(1)).clear();\n        assertTrue(tested.entities.isEmpty());\n        assertFalse(tested.isEditMode);\n    }\n\n    @Test\n    public void testShow() {\n        tested.show(user);\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 1);\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(1)).clear();\n        verify(rolesList,\n               times(1)).clear();\n        verify(rolesList,\n               times(1)).show(anySet(),\n                              any(EntitiesList.Callback.class));\n    }\n\n    @Test\n    public void testRemoveRole() {\n        Role r = mock(Role.class);\n        when(r.getName()).thenReturn(\"role1\");\n        tested.entities.add(r);\n        tested.removeEntity(\"role1\");\n        assertFalse(tested.isEditMode);\n        assertTrue(tested.entities.size() == 0);\n        verify(rolesList,\n               times(1)).show(anySet(),\n                              any(EntitiesList.Callback.class));\n        verify(removeUserRoleEventEvent,\n               times(1)).fire(any(OnRemoveUserRoleEvent.class));\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.View.class));\n        verify(view,\n               times(0)).clear();\n        verify(rolesList,\n               times(0)).clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserAttributesEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.api.UserManager;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserAttributesEditorTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    EventSourceMock<CreateUserAttributeEvent> createUserAttributeEventEvent;\n    @Mock\n    EventSourceMock<UpdateUserAttributeEvent> updateUserAttributeEventEvent;\n    @Mock\n    EventSourceMock<DeleteUserAttributeEvent> deleteUserAttributeEventEvent;\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    NewUserAttributeEditor newUserAttributeEditor;\n    @Mock\n    UserAttributesEditor.View view;\n\n    private UserAttributesEditor presenter;\n    private UserManager.UserAttribute attribute;\n\n    @Before\n    public void setup() {\n        when(newUserAttributeEditor.clear()).thenReturn(newUserAttributeEditor);\n        when(userSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        attribute = mock(UserManager.UserAttribute.class);\n        when(attribute.getName()).thenReturn(\"attr1\");\n        when(attribute.getDefaultValue()).thenReturn(\"v1\");\n        when(attribute.isEditable()).thenReturn(true);\n        when(attribute.isMandatory()).thenReturn(true);\n        when(userSystemManager.getUserSupportedAttribute(\"attr1\")).thenReturn(attribute);\n        when(view.getColumnCount()).thenReturn(0);\n        presenter = new UserAttributesEditor(userSystemManager,\n                                             confirmBox,\n                                             createUserAttributeEventEvent,\n                                             updateUserAttributeEventEvent,\n                                             deleteUserAttributeEventEvent,\n                                             errorEvent,\n                                             newUserAttributeEditor,\n                                             view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view,\n               times(1)).init(presenter);\n        verify(view,\n               times(1)).initWidgets(any());\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(2)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).redraw();\n        verify(view,\n               times(0)).removeColumn(anyInt());\n        verify(view,\n               times(0)).setCanCreate(anyBoolean());\n        verify(view,\n               times(0)).showEmpty();\n    }\n\n    @Test\n    public void testClear() {\n        presenter.attributes = new HashMap<UserManager.UserAttribute, String>();\n        presenter.isEditMode = true;\n        presenter.clear();\n        assertNull(presenter.attributes);\n        assertFalse(presenter.isEditMode);\n        verify(view,\n               times(0)).init(presenter);\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).getColumnCount();\n        verify(view,\n               times(0)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(0)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).redraw();\n        verify(view,\n               times(0)).removeColumn(anyInt());\n        verify(view,\n               times(0)).setCanCreate(anyBoolean());\n        verify(view,\n               times(0)).showEmpty();\n    }\n\n    @Test\n    public void testShow() {\n        final User user = mock(User.class);\n        Map<String, String> attrs = new HashMap<String, String>(1);\n        attrs.put(\"attr1\",\n                  \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(attrs);\n        presenter.isEditMode = true;\n        presenter.show(user);\n        assertFalse(presenter.isEditMode);\n        assertTrue(presenter.attributes.size() == 1);\n        verify(newUserAttributeEditor,\n               times(1)).clear();\n        verify(newUserAttributeEditor,\n               times(1)).showAddButton();\n        verify(view,\n               times(1)).setCanCreate(false);\n        verify(view,\n               times(1)).redraw();\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(2)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).init(any(UserAttributesEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).removeColumn(anyInt());\n    }\n\n    @Test\n    public void testEdit() {\n        final User user = mock(User.class);\n        Map<String, String> attrs = new HashMap<String, String>(1);\n        attrs.put(\"attr1\",\n                  \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(attrs);\n        presenter.isEditMode = false;\n        presenter.edit(user);\n        assertTrue(presenter.isEditMode);\n        assertTrue(presenter.attributes.size() == 1);\n        verify(newUserAttributeEditor,\n               times(1)).clear();\n        verify(newUserAttributeEditor,\n               times(1)).showAddButton();\n        verify(view,\n               times(1)).setCanCreate(true);\n        verify(view,\n               times(1)).redraw();\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(3)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).init(any(UserAttributesEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).removeColumn(anyInt());\n    }\n\n    @Test\n    public void testGetValue() {\n        UserManager.UserAttribute attribute1 = mock(UserManager.UserAttribute.class);\n        when(attribute1.getName()).thenReturn(\"attr1\");\n        when(attribute1.getDefaultValue()).thenReturn(\"v1\");\n        when(attribute1.isEditable()).thenReturn(true);\n        when(attribute1.isMandatory()).thenReturn(true);\n        UserManager.UserAttribute attribute2 = mock(UserManager.UserAttribute.class);\n        when(attribute2.getName()).thenReturn(\"attr2\");\n        when(attribute2.getDefaultValue()).thenReturn(\"v2\");\n        when(attribute2.isEditable()).thenReturn(true);\n        when(attribute2.isMandatory()).thenReturn(true);\n        Map<UserManager.UserAttribute, String> attrs = new HashMap<UserManager.UserAttribute, String>(1);\n        attrs.put(attribute1,\n                  \"value1\");\n        attrs.put(attribute2,\n                  \"value2\");\n        presenter.attributes = attrs;\n        Map<String, String> result = presenter.getValue();\n        assertNotNull(result);\n        assertTrue(result.size() == 2);\n        assertEquals(\"value1\",\n                     result.get(\"attr1\"));\n        assertEquals(\"value2\",\n                     result.get(\"attr2\"));\n    }\n\n    @Test\n    public void testUpdateAttribute() {\n        presenter.isEditMode = true;\n        presenter.attributes = new HashMap<UserManager.UserAttribute, String>();\n        presenter.attributes.put(attribute,\n                                 \"value1\");\n        presenter.updateUserAttribute(0,\n                                      \"attr1\",\n                                      \"value2\");\n        verify(updateUserAttributeEventEvent,\n               times(1)).fire(any(UpdateUserAttributeEvent.class));\n        assertTrue(presenter.attributes.size() == 1);\n        assertEquals(\"value2\",\n                     presenter.attributes.get(attribute));\n        verify(view,\n               times(0)).setCanCreate(anyBoolean());\n        verify(view,\n               times(1)).redraw();\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(3)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).init(any(UserAttributesEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).removeColumn(anyInt());\n    }\n\n    @Test\n    public void testRemoveAttribute() {\n        presenter.isEditMode = true;\n        presenter.attributes = new HashMap<UserManager.UserAttribute, String>();\n        presenter.attributes.put(attribute,\n                                 \"value1\");\n        Map.Entry<String, String> entry = new Map.Entry<String, String>() {\n            @Override\n            public String getKey() {\n                return \"attr1\";\n            }\n\n            @Override\n            public String getValue() {\n                return \"value1\";\n            }\n\n            @Override\n            public String setValue(String value) {\n                return null;\n            }\n        };\n        presenter.removeUserAttribute(0,\n                                      entry);\n        verify(deleteUserAttributeEventEvent,\n               times(1)).fire(any(DeleteUserAttributeEvent.class));\n        assertTrue(presenter.attributes.isEmpty());\n        verify(view,\n               times(0)).setCanCreate(anyBoolean());\n        verify(view,\n               times(1)).redraw();\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(3)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).init(any(UserAttributesEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).removeColumn(anyInt());\n    }\n\n    @Test\n    public void testOnAttributeCreated() {\n        UserManager.UserAttribute attr2 = mock(UserManager.UserAttribute.class);\n        when(attr2.getName()).thenReturn(\"attr2\");\n        when(attr2.getDefaultValue()).thenReturn(\"v2\");\n        when(attr2.isEditable()).thenReturn(true);\n        when(attr2.isMandatory()).thenReturn(true);\n        when(userSystemManager.getUserSupportedAttribute(\"attr2\")).thenReturn(attr2);\n        CreateUserAttributeEvent createUserAttributeEvent = mock(CreateUserAttributeEvent.class);\n        Map.Entry<String, String> entry = new Map.Entry<String, String>() {\n            @Override\n            public String getKey() {\n                return \"attr2\";\n            }\n\n            @Override\n            public String getValue() {\n                return \"value2\";\n            }\n\n            @Override\n            public String setValue(String value) {\n                return null;\n            }\n        };\n        when(createUserAttributeEvent.getAttribute()).thenReturn(entry);\n        presenter.attributes = new HashMap<UserManager.UserAttribute, String>();\n        presenter.onAttributeCreated(createUserAttributeEvent);\n        assertTrue(presenter.attributes.size() == 1);\n        verify(view,\n               times(0)).setCanCreate(anyBoolean());\n        verify(view,\n               times(1)).redraw();\n        verify(view,\n               times(1)).getColumnCount();\n        verify(view,\n               times(1)).setColumnSortHandler(any(ColumnSortEvent.ListHandler.class));\n        verify(view,\n               times(2)).addColumn(any(Column.class),\n                                   anyString());\n        verify(view,\n               times(0)).init(any(UserAttributesEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(NewUserAttributeEditor.View.class));\n        verify(view,\n               times(0)).removeColumn(anyInt());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/UserEditorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.ClientUserSystemManager;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.AssignedEntitiesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnShowEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserRolesEvent;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UserEditorTest {\n\n    @Mock\n    ClientUserSystemManager userSystemManager;\n    @Mock\n    UserAttributesEditor userAttributesEditor;\n    @Mock\n    UserAssignedGroupsExplorer userAssignedGroupsExplorer;\n    @Mock\n    UserAssignedRolesExplorer userAssignedRolesExplorer;\n    @Mock\n    UserAssignedGroupsEditor userAssignedGroupsEditor;\n    @Mock\n    UserAssignedRolesEditor userAssignedRolesEditor;\n    @Mock\n    ACLViewer aclViewer;\n    @Mock\n    EventSourceMock<OnEditEvent> onEditEvent;\n    @Mock\n    EventSourceMock<OnShowEvent> onShowEvent;\n    @Mock\n    EventSourceMock<OnDeleteEvent> onDeleteEvent;\n    @Mock\n    EventSourceMock<OnChangePasswordEvent> onChangePasswordEvent;\n    @Mock\n    UserEditor.View view;\n    @Mock\n    User user;\n    private UserEditor presenter;\n\n    @Before\n    public void setup() {\n        Map<String, String> userAttributes = new HashMap<String, String>(1);\n        userAttributes.put(\"attr1\",\n                           \"value1\");\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getProperties()).thenReturn(userAttributes);\n        when(userSystemManager.isUserCapabilityEnabled(any(Capability.class))).thenReturn(true);\n        presenter = new UserEditor(userSystemManager,\n                                   userAttributesEditor,\n                                   userAssignedGroupsExplorer,\n                                   userAssignedGroupsEditor,\n                                   userAssignedRolesExplorer,\n                                   userAssignedRolesEditor,\n                                   aclViewer,\n                                   onEditEvent,\n                                   onShowEvent,\n                                   onDeleteEvent,\n                                   onChangePasswordEvent,\n                                   view);\n    }\n\n    @Test\n    public void testInit() {\n        presenter.init();\n        verify(view,\n               times(1)).init(presenter);\n        verify(view,\n               times(1)).initWidgets(any(),\n                                     any(),\n                                     any(),\n                                     any(),\n                                     any(),\n                                     any());\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setAttributesEditorVisible(anyBoolean());\n        verify(view,\n               times(0)).setChangePasswordButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setEditButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n\n    @Test\n    public void testClear() {\n        presenter.isEditMode = true;\n        presenter.user = user;\n        presenter.clear();\n        assertNull(presenter.user);\n        assertFalse(presenter.isEditMode);\n        verify(userAttributesEditor,\n               times(1)).clear();\n        verify(userAssignedGroupsExplorer,\n               times(1)).clear();\n        verify(userAssignedGroupsEditor,\n               times(1)).clear();\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testIdentifier() {\n        presenter.user = user;\n        String id = presenter.identifier();\n        assertEquals(\"user1\",\n                     id);\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testAttributesEditor() {\n        assertEquals(userAttributesEditor,\n                     presenter.attributesEditor());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testGroupsExplorer() {\n        assertEquals(userAssignedGroupsExplorer,\n                     presenter.groupsExplorer());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testGroupsEditor() {\n        assertEquals(userAssignedGroupsEditor,\n                     presenter.groupsEditor());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testRolesExplorer() {\n        assertEquals(userAssignedRolesExplorer,\n                     presenter.rolesExplorer());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testRolesEditor() {\n        assertEquals(userAssignedRolesEditor,\n                     presenter.rolesEditor());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testShow() {\n        presenter.show(user);\n        assertFalse(presenter.isEditMode);\n        verify(userAttributesEditor,\n               times(1)).clear();\n        verify(userAssignedGroupsExplorer,\n               times(1)).clear();\n        verify(userAssignedRolesExplorer,\n               times(1)).clear();\n        verify(userAssignedGroupsEditor,\n               times(1)).clear();\n        verify(onShowEvent,\n               times(1)).fire(any(OnShowEvent.class));\n        verify(view,\n               times(0)).init(any(UserEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(UserAttributesEditor.View.class),\n                                     any(AssignedEntitiesExplorer.class),\n                                     any(AssignedEntitiesEditor.class),\n                                     any(AssignedEntitiesExplorer.class),\n                                     any(AssignedEntitiesEditor.class),\n                                     any(ACLViewer.class));\n        verify(view,\n               times(1)).setAddToGroupsButtonVisible(false);\n        verify(view,\n               times(1)).setAttributesEditorVisible(true);\n        verify(view,\n               times(1)).setChangePasswordButtonVisible(false);\n        verify(view,\n               times(1)).setDeleteButtonVisible(false);\n        verify(view,\n               times(1)).setEditButtonVisible(true);\n        verify(view,\n               times(1)).setUsername(\"user1\");\n    }\n\n    @Test\n    public void testSetEditButtonVisible() {\n        presenter.setEditButtonVisible(true);\n        verify(view,\n               times(1)).setEditButtonVisible(true);\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setAttributesEditorVisible(anyBoolean());\n        verify(view,\n               times(0)).setChangePasswordButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n\n    @Test\n    public void testSetDeleteButtonVisible() {\n        presenter.setDeleteButtonVisible(true);\n        verify(view,\n               times(1)).setDeleteButtonVisible(true);\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setAttributesEditorVisible(anyBoolean());\n        verify(view,\n               times(0)).setChangePasswordButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setEditButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n\n    @Test\n    public void testSetChangePasswordButtonVisible() {\n        presenter.setChangePasswordButtonVisible(true);\n        verify(view,\n               times(1)).setChangePasswordButtonVisible(true);\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setAttributesEditorVisible(anyBoolean());\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setEditButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n\n    @Test\n    public void testSetAttributesEditorVisible() {\n        presenter.setAttributesEditorVisible(true);\n        verify(view,\n               times(1)).setAttributesEditorVisible(true);\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setChangePasswordButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setEditButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n\n    @Test\n    public void testOnEdit() {\n        presenter.onEdit();\n        verify(onEditEvent,\n               times(1)).fire(any(OnEditEvent.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnDelete() {\n        presenter.onDelete();\n        verify(onDeleteEvent,\n               times(1)).fire(any(OnDeleteEvent.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnChangePassword() {\n        presenter.onChangePassword();\n        verify(onChangePasswordEvent,\n               times(1)).fire(any(OnChangePasswordEvent.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnAssignGroupsInReadMode() {\n        presenter.user = user;\n        presenter.isEditMode = false;\n        presenter.onAssignGroups();\n        verify(userAssignedGroupsEditor,\n               times(1)).show(any(User.class));\n        verify(userAssignedGroupsEditor,\n               times(0)).edit(any(User.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnAssignGroupsInEditMode() {\n        presenter.user = user;\n        presenter.isEditMode = true;\n        presenter.onAssignGroups();\n        verify(userAssignedGroupsEditor,\n               times(0)).show(any(User.class));\n        verify(userAssignedGroupsEditor,\n               times(1)).edit(any(User.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnOnUserGroupsUpdatedEvent() {\n        OnUpdateUserGroupsEvent onUpdateUserGroupsEvent = mock(OnUpdateUserGroupsEvent.class);\n        when(onUpdateUserGroupsEvent.getContext()).thenReturn(userAssignedGroupsEditor);\n        final Set<Group> explorerGroups = new HashSet<Group>();\n        when(userAssignedGroupsExplorer.getValue()).thenReturn(explorerGroups);\n        final Set<Group> groups = new HashSet<Group>();\n        groups.add(new GroupImpl(\"group1\"));\n        when(userAssignedGroupsEditor.getValue()).thenReturn(groups);\n        presenter.onOnUserGroupsUpdatedEvent(onUpdateUserGroupsEvent);\n        assertEquals(groups,\n                     userAssignedGroupsExplorer.getValue());\n        verify(userAssignedGroupsEditor,\n               times(1)).flush();\n        verify(userAssignedGroupsExplorer,\n               times(1)).doShow();\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnAssignRolesInReadMode() {\n        presenter.user = user;\n        presenter.isEditMode = false;\n        presenter.onAssignRoles();\n        verify(userAssignedRolesEditor,\n               times(1)).show(any(User.class));\n        verify(userAssignedRolesEditor,\n               times(0)).edit(any(User.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnAssignRolesInEditMode() {\n        presenter.user = user;\n        presenter.isEditMode = true;\n        presenter.onAssignRoles();\n        verify(userAssignedRolesEditor,\n               times(0)).show(any(User.class));\n        verify(userAssignedRolesEditor,\n               times(1)).edit(any(User.class));\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testOnOnUserRolesUpdatedEvent() {\n        OnUpdateUserRolesEvent onUpdateUserRolesEvent = mock(OnUpdateUserRolesEvent.class);\n        when(onUpdateUserRolesEvent.getContext()).thenReturn(userAssignedRolesEditor);\n        final Set<Role> explorerRoles = new HashSet<Role>();\n        when(userAssignedRolesExplorer.getValue()).thenReturn(explorerRoles);\n        final Set<Role> roles = new HashSet<Role>();\n        roles.add(new RoleImpl(\"role1\"));\n        when(userAssignedRolesEditor.getValue()).thenReturn(roles);\n        presenter.onOnUserRolesUpdatedEvent(onUpdateUserRolesEvent);\n        assertEquals(roles,\n                     userAssignedRolesExplorer.getValue());\n        verify(userAssignedRolesEditor,\n               times(1)).flush();\n        verify(userAssignedRolesExplorer,\n               times(1)).doShow();\n        assertNoViewCalls();\n    }\n\n    private void assertNoViewCalls() {\n        verify(view,\n               times(0)).init(any(UserEditor.class));\n        verify(view,\n               times(0)).initWidgets(any(UserAttributesEditor.View.class),\n                                     any(AssignedEntitiesExplorer.class),\n                                     any(AssignedEntitiesEditor.class),\n                                     any(AssignedEntitiesExplorer.class),\n                                     any(AssignedEntitiesEditor.class),\n                                     any(ACLViewer.class));\n        verify(view,\n               times(0)).setAddToGroupsButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setAttributesEditorVisible(anyBoolean());\n        verify(view,\n               times(0)).setChangePasswordButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setDeleteButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setEditButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setUsername(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/BaseUserEditorWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedGroupsExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedRolesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BaseUserEditorWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    EventSourceMock<DeleteUserEvent> deleteUserEvent;\n    @Mock\n    EventSourceMock<SaveUserEvent> saveUserEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    UserEditor userEditor;\n    @Mock\n    UserEditorDriver userEditorDriver;\n    @Mock\n    UserAssignedGroupsExplorer userAssignedGroupsExplorer;\n    @Mock\n    UserAssignedRolesExplorer userAssignedRolesExplorer;\n    @Mock\n    ChangePassword changePassword;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    User user;\n    private BaseUserEditorWorkflow tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        when(view.setWidget(any())).thenReturn(view);\n        when(view.clearNotifications()).thenReturn(view);\n        when(view.setCallback(any())).thenReturn(view);\n        when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonText(any())).thenReturn(view);\n        when(view.showNotification(any())).thenReturn(view);\n        final Set<Group> groups = new HashSet<Group>();\n        final Group group1 = mock(Group.class);\n        when(group1.getName()).thenReturn(\"group1\");\n        groups.add(group1);\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getGroups()).thenReturn(groups);\n        when(userEditor.groupsExplorer()).thenReturn(userAssignedGroupsExplorer);\n        when(userAssignedGroupsExplorer.getValue()).thenReturn(Collections.emptySet());\n        when(userEditor.rolesExplorer()).thenReturn(userAssignedRolesExplorer);\n        when(userAssignedRolesExplorer.getValue()).thenReturn(Collections.emptySet());\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return user;\n            }\n        }).when(userManagerService).get(anyString());\n        doAnswer(new Answer<User>() {\n            @Override\n            public User answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return user;\n            }\n        }).when(userManagerService).update(any(User.class));\n\n        tested = new BaseUserEditorWorkflow(userSystemManager,\n                                            errorEvent,\n                                            workbenchNotification,\n                                            deleteUserEvent,\n                                            saveUserEvent,\n                                            confirmBox,\n                                            userEditor,\n                                            userEditorDriver,\n                                            changePassword,\n                                            loadingBox,\n                                            view) {\n        };\n    }\n\n    @Test\n    public void testDoShow() {\n        final String userId = \"user1\";\n        tested.isDirty = false;\n        tested.doShow(userId);\n        verify(userManagerService,\n               times(1)).get(anyString());\n        verify(view,\n               times(1)).setCancelButtonVisible(true);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(2)).setSaveButtonEnabled(false);\n        verify(view,\n               times(2)).clearNotifications();\n        verify(userEditor,\n               times(1)).clear();\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(userEditorDriver,\n               times(1)).show(user,\n                              userEditor);\n        verify(userEditorDriver,\n               times(0)).edit(user,\n                              userEditor);\n        verify(view,\n               times(1)).setCancelButtonVisible(false);\n        verify(view,\n               times(1)).setSaveButtonVisible(false);\n    }\n\n    @Test\n    public void testCheckDirtyFalse() {\n        final Command command = mock(Command.class);\n        tested.isDirty = false;\n        tested.checkDirty(command);\n        verify(command,\n               times(1)).execute();\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testCheckDirtyTrue() {\n        final Command command = mock(Command.class);\n        tested.isDirty = true;\n        tested.checkDirty(command);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(),\n                              any());\n        verify(command,\n               times(0)).execute();\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testSetDirtyTrue() {\n        tested.user = user;\n        tested.setDirty(true);\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(2)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testSetDirtyFalse() {\n        tested.setDirty(false);\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testNotifyEmptyAssignments() {\n        when(userAssignedGroupsExplorer.getValue()).thenReturn(Collections.emptySet());\n        when(userAssignedRolesExplorer.getValue()).thenReturn(Collections.emptySet());\n        tested.user = user;\n        tested.setDirty(false);\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(1)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testNoNeedToNotifyAssignmentsFound() {\n        when(userAssignedGroupsExplorer.getValue()).thenReturn(Collections.singleton(new GroupImpl(\"g1\")));\n        when(userAssignedRolesExplorer.getValue()).thenReturn(Collections.emptySet());\n        tested.user = user;\n        tested.setDirty(false);\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testEdit() {\n        tested.user = user;\n        tested.edit();\n        verify(userEditorDriver,\n               times(1)).edit(user,\n                              userEditor);\n        verify(userEditorDriver,\n               times(0)).show(user,\n                              userEditor);\n        verify(view,\n               times(1)).setCancelButtonVisible(true);\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(2)).setSaveButtonEnabled(false);\n        verify(view,\n               times(1)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testDoSaveWithoutGroupAssignment() {\n        when(userEditorDriver.flush()).thenReturn(true);\n        when(userEditorDriver.getValue()).thenReturn(user);\n        when(userEditor.getValue()).thenReturn(user);\n        when(userEditor.canAssignGroups()).thenReturn(false);\n        when(userEditor.canAssignRoles()).thenReturn(false);\n        tested.user = user;\n        tested.doSave();\n        verify(userManagerService,\n               times(1)).update(any(User.class));\n        verify(loadingBox,\n               times(2)).show();\n        verify(loadingBox,\n               times(2)).hide();\n    }\n\n    @Test\n    public void testDoShowChangePassword() {\n        tested.user = user;\n        tested.doChangePassword();\n        verify(changePassword,\n               times(1)).show(anyString(),\n                              any());\n        assertNoViewCalls();\n    }\n\n    @Test\n    public void testDoDelete() {\n        tested.user = user;\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(),\n                                 any());\n        tested.doDelete();\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(),\n                              any());\n        verify(userManagerService,\n               times(1)).delete(anyString());\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(deleteUserEvent,\n               times(1)).fire(any(DeleteUserEvent.class));\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(1)).setSaveButtonEnabled(false);\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(2)).clearNotifications();\n    }\n\n    private void assertNoViewCalls() {\n        verify(view,\n               times(0)).setCancelButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(0)).setSaveButtonVisible(anyBoolean());\n        verify(view,\n               times(0)).setSaveButtonEnabled(anyBoolean());\n        verify(view,\n               times(0)).showNotification(anyString());\n        verify(view,\n               times(0)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/UserCreationWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.CreateEntity;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedGroupsEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedGroupsExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedRolesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAttributesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserCreationWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    EventSourceMock<DeleteUserEvent> deleteUserEvent;\n    @Mock\n    EventSourceMock<SaveUserEvent> saveUserEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    UserEditor userEditor;\n    @Mock\n    UserEditorDriver userEditorDriver;\n    @Mock\n    ChangePassword changePassword;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    CreateEntity createEntity;\n    @Mock\n    EventSourceMock<CreateUserEvent> createUserEvent;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    UserAttributesEditor userAttributesEditor;\n    @Mock\n    UserAssignedGroupsExplorer userAssignedGroupsExplorer;\n    @Mock\n    UserAssignedGroupsEditor userAssignedGroupsEditor;\n    @Mock\n    UserAssignedRolesExplorer userAssignedRolesExplorer;\n    @Mock\n    User user;\n    private UserCreationWorkflow tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        final Set<Group> groups = new HashSet<Group>();\n        final Group group1 = mock(Group.class);\n        when(group1.getName()).thenReturn(\"group1\");\n        groups.add(group1);\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getGroups()).thenReturn(groups);\n        when(view.setWidget(any())).thenReturn(view);\n        when(view.clearNotifications()).thenReturn(view);\n        when(view.setCallback(any())).thenReturn(view);\n        when(view.setCancelButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonEnabled(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonVisible(anyBoolean())).thenReturn(view);\n        when(view.setSaveButtonText(any())).thenReturn(view);\n        when(view.showNotification(any())).thenReturn(view);\n        when(userEditor.setEditButtonVisible(anyBoolean())).thenReturn(userEditor);\n        when(userEditor.setChangePasswordButtonVisible(anyBoolean())).thenReturn(userEditor);\n        when(userEditor.setDeleteButtonVisible(anyBoolean())).thenReturn(userEditor);\n        when(userEditor.attributesEditor()).thenReturn(userAttributesEditor);\n        when(userEditor.groupsExplorer()).thenReturn(userAssignedGroupsExplorer);\n        when(userEditor.groupsEditor()).thenReturn(userAssignedGroupsEditor);\n        when(userEditor.rolesExplorer()).thenReturn(userAssignedRolesExplorer);\n        tested = new UserCreationWorkflow(userSystemManager,\n                                          errorEvent,\n                                          workbenchNotification,\n                                          deleteUserEvent,\n                                          saveUserEvent,\n                                          createUserEvent,\n                                          confirmBox,\n                                          createEntity,\n                                          userEditor,\n                                          userEditorDriver,\n                                          changePassword,\n                                          loadingBox,\n                                          view);\n    }\n\n    @Test\n    public void testCreate() {\n        tested.create();\n        verify(userEditor,\n               times(1)).clear();\n        verify(userEditor,\n               times(1)).setPermissionsVisible(false);\n        verify(createEntity,\n               times(1)).show(anyString(),\n                              anyString());\n        verify(view,\n               times(1)).setCancelButtonVisible(false);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(1)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(2)).clearNotifications();\n    }\n\n    @Test\n    public void testOnCreateEntityAlreadyExisting() {\n        when(userManagerService.get(anyString())).thenReturn(user);\n        when(createEntity.getEntityIdentifier()).thenReturn(\"user1\");\n        tested.onCreateEntityClick();\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(createEntity,\n               times(1)).setErrorState();\n    }\n\n    @Test\n    public void testOnCreateEntityXSSContent() {\n        when(createEntity.getEntityIdentifier()).thenReturn(\"<img/src/onerror=alert('XSS')>\");\n        tested.onCreateEntityClick();\n        verify(createEntity,\n               times(1)).setErrorState();\n    }\n\n    @Test\n    public void testDoEdit() {\n        tested.user = user;\n        tested.doEdit();\n        assertFalse(tested.isDirty);\n        verify(userManagerService,\n               times(0)).get(anyString());\n        verify(view,\n               times(3)).setCancelButtonVisible(true);\n        verify(view,\n               times(1)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(2)).setSaveButtonText(anyString());\n        verify(view,\n               times(1)).setWidget(any());\n        verify(view,\n               times(3)).setSaveButtonVisible(true);\n        verify(view,\n               times(4)).setSaveButtonEnabled(false);\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(2)).clearNotifications();\n        verify(userEditor,\n               times(0)).clear();\n        verify(userEditorDriver,\n               times(0)).show(user,\n                              userEditor);\n        verify(userEditorDriver,\n               times(1)).edit(user,\n                              userEditor);\n        verify(userEditor,\n               times(1)).setEditButtonVisible(false);\n        verify(userEditor,\n               times(1)).setChangePasswordButtonVisible(false);\n        verify(userEditor,\n               times(1)).setDeleteButtonVisible(false);\n    }\n\n    @Test\n    public void testAfterSaveSetPassword() {\n        tested.user = user;\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(Command.class),\n                                 any(Command.class));\n        final String id = \"user1\";\n        tested.afterSave(id);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(Command.class),\n                              any(Command.class));\n        verify(changePassword,\n               times(1)).show(anyString(),\n                              any(ChangePassword.ChangePasswordCallback.class));\n    }\n\n    @Test\n    public void testAfterSaveSkipSetPassword() {\n        tested.user = user;\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[3];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(Command.class),\n                                 any(Command.class));\n        final String id = \"user1\";\n        tested.afterSave(id);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(Command.class),\n                              any(Command.class));\n        verify(changePassword,\n               times(0)).show(anyString(),\n                              any(ChangePassword.ChangePasswordCallback.class));\n        verify(workbenchNotification,\n               times(1)).fire(any(NotificationEvent.class));\n        verify(createUserEvent,\n               times(1)).fire(any(CreateUserEvent.class));\n        verify(createEntity,\n               times(1)).show(anyString(),\n                              anyString());\n    }\n\n    @Test\n    public void testOnDeleteUserEvent() {\n        final OnDeleteEvent onDeleteEvent = mock(OnDeleteEvent.class);\n        when(onDeleteEvent.getContext()).thenReturn(userEditor);\n        tested.user = user;\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(Command.class),\n                                 any(Command.class));\n        tested.onDeleteUserEvent(onDeleteEvent);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(Command.class),\n                              any(Command.class));\n        verify(userManagerService,\n               times(1)).delete(anyString());\n    }\n\n    @Test\n    public void testOnChangeUserPasswordEvent() {\n        final OnChangePasswordEvent onChangePasswordEvent = mock(OnChangePasswordEvent.class);\n        when(onChangePasswordEvent.getContext()).thenReturn(userEditor);\n        tested.user = user;\n        tested.onChangeUserPasswordEvent(onChangePasswordEvent);\n        verify(changePassword,\n               times(1)).show(anyString(),\n                              any());\n    }\n\n    @Test\n    public void testOnAttributeCreated() {\n        final CreateUserAttributeEvent createUserAttributeEvent = mock(CreateUserAttributeEvent.class);\n        when(createUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeCreated(createUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnAttributeDeleted() {\n        final DeleteUserAttributeEvent deleteUserAttributeEvent = mock(DeleteUserAttributeEvent.class);\n        when(deleteUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeDeleted(deleteUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnAttributeUpdated() {\n        final UpdateUserAttributeEvent updateUserAttributeEvent = mock(UpdateUserAttributeEvent.class);\n        when(updateUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeUpdated(updateUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnRemoveUserGroupEvent() {\n        final OnRemoveUserGroupEvent onRemoveUserGroupEvent = mock(OnRemoveUserGroupEvent.class);\n        when(onRemoveUserGroupEvent.getContext()).thenReturn(userAssignedGroupsExplorer);\n        tested.user = user;\n        tested.onOnRemoveUserGroupEvent(onRemoveUserGroupEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnUserGroupsUpdatedEvent() {\n        final OnUpdateUserGroupsEvent onUpdateUserGroupsEvent = mock(OnUpdateUserGroupsEvent.class);\n        when(onUpdateUserGroupsEvent.getContext()).thenReturn(userAssignedGroupsEditor);\n        tested.user = user;\n        tested.onOnUserGroupsUpdatedEvent(onUpdateUserGroupsEvent);\n        assertSetDirty();\n    }\n\n    private void assertSetDirty() {\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(2)).showNotification(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/editor/user/workflow/UserEditorWorkflowTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.editor.user.workflow;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.client.editor.user.UserEditorDriver;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.ChangePassword;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.acl.ACLViewer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedGroupsEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedGroupsExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAssignedRolesExplorer;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserAttributesEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.user.UserEditor;\nimport org.uberfire.ext.security.management.client.widgets.management.editor.workflow.EntityWorkflowView;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnChangePasswordEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnDeleteEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnEditEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnRemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnUpdateUserGroupsEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.UpdateUserAttributeEvent;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserEditorWorkflowTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EventSourceMock<OnErrorEvent> errorEvent;\n    @Mock\n    EventSourceMock<DeleteUserEvent> deleteUserEvent;\n    @Mock\n    EventSourceMock<SaveUserEvent> saveUserEvent;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    UserEditor userEditor;\n    @Mock\n    ACLViewer aclViewer;\n    @Mock\n    UserEditorDriver userEditorDriver;\n    @Mock\n    ChangePassword changePassword;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntityWorkflowView view;\n    @Mock\n    UserAttributesEditor userAttributesEditor;\n    @Mock\n    UserAssignedGroupsExplorer userAssignedGroupsExplorer;\n    @Mock\n    UserAssignedGroupsEditor userAssignedGroupsEditor;\n    @Mock\n    UserAssignedRolesExplorer userAssignedRolesExplorer;\n    @Mock\n    User user;\n    private UserEditorWorkflow tested;\n\n    @Before\n    public void setup() {\n        super.setup();\n        when(userEditor.attributesEditor()).thenReturn(userAttributesEditor);\n        when(userEditor.groupsExplorer()).thenReturn(userAssignedGroupsExplorer);\n        when(userEditor.groupsEditor()).thenReturn(userAssignedGroupsEditor);\n        when(userEditor.rolesExplorer()).thenReturn(userAssignedRolesExplorer);\n        when(userEditor.getACLViewer()).thenReturn(aclViewer);\n        final Set<Group> groups = new HashSet<Group>();\n        final Group group1 = mock(Group.class);\n        when(group1.getName()).thenReturn(\"group1\");\n        groups.add(group1);\n        when(user.getIdentifier()).thenReturn(\"user1\");\n        when(user.getGroups()).thenReturn(groups);\n        tested = new UserEditorWorkflow(userSystemManager,\n                                        errorEvent,\n                                        workbenchNotification,\n                                        deleteUserEvent,\n                                        saveUserEvent,\n                                        confirmBox,\n                                        userEditor,\n                                        userEditorDriver,\n                                        changePassword,\n                                        loadingBox,\n                                        view);\n    }\n\n    @Test\n    public void testOnEditUserEvent() {\n        final OnEditEvent onEditEvent = mock(OnEditEvent.class);\n        when(onEditEvent.getContext()).thenReturn(userEditor);\n        tested.user = user;\n        tested.onEditUserEvent(onEditEvent);\n        verify(userEditorDriver,\n               times(1)).edit(user,\n                              userEditor);\n        verify(view,\n               times(1)).setCancelButtonVisible(true);\n        verify(view,\n               times(0)).setCallback(any(EntityWorkflowView.Callback.class));\n        verify(view,\n               times(0)).setSaveButtonText(anyString());\n        verify(view,\n               times(0)).setWidget(any(IsWidget.class));\n        verify(view,\n               times(1)).setSaveButtonVisible(true);\n        verify(view,\n               times(2)).setSaveButtonEnabled(false);\n        verify(view,\n               times(1)).showNotification(anyString());\n        verify(view,\n               times(1)).clearNotifications();\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(0)).hide();\n    }\n\n    @Test\n    public void testOnDeleteUserEvent() {\n        final OnDeleteEvent onDeleteEvent = mock(OnDeleteEvent.class);\n        when(onDeleteEvent.getContext()).thenReturn(userEditor);\n        tested.user = user;\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Command callback = (Command) invocationOnMock.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(confirmBox).show(anyString(),\n                                 anyString(),\n                                 any(),\n                                 any());\n        tested.onDeleteUserEvent(onDeleteEvent);\n        verify(confirmBox,\n               times(1)).show(anyString(),\n                              anyString(),\n                              any(),\n                              any());\n        verify(userManagerService,\n               times(1)).delete(anyString());\n    }\n\n    @Test\n    public void testOnChangeUserPasswordEvent() {\n        final OnChangePasswordEvent onChangePasswordEvent = mock(OnChangePasswordEvent.class);\n        when(onChangePasswordEvent.getContext()).thenReturn(userEditor);\n        tested.user = user;\n        tested.onChangeUserPasswordEvent(onChangePasswordEvent);\n        verify(changePassword,\n               times(1)).show(anyString(),\n                              any());\n    }\n\n    @Test\n    public void testOnAttributeCreated() {\n        final CreateUserAttributeEvent createUserAttributeEvent = mock(CreateUserAttributeEvent.class);\n        when(createUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeCreated(createUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnAttributeDeleted() {\n        final DeleteUserAttributeEvent deleteUserAttributeEvent = mock(DeleteUserAttributeEvent.class);\n        when(deleteUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeDeleted(deleteUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnAttributeUpdated() {\n        final UpdateUserAttributeEvent updateUserAttributeEvent = mock(UpdateUserAttributeEvent.class);\n        when(updateUserAttributeEvent.getContext()).thenReturn(userAttributesEditor);\n        tested.user = user;\n        tested.onAttributeUpdated(updateUserAttributeEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnRemoveUserGroupEvent() {\n        final OnRemoveUserGroupEvent onRemoveUserGroupEvent = mock(OnRemoveUserGroupEvent.class);\n        when(onRemoveUserGroupEvent.getContext()).thenReturn(userAssignedGroupsExplorer);\n        tested.user = user;\n        tested.onOnRemoveUserGroupEvent(onRemoveUserGroupEvent);\n        assertSetDirty();\n    }\n\n    @Test\n    public void testOnUserGroupsUpdatedEvent() {\n        final OnUpdateUserGroupsEvent onUpdateUserGroupsEvent = mock(OnUpdateUserGroupsEvent.class);\n        when(onUpdateUserGroupsEvent.getContext()).thenReturn(userAssignedGroupsEditor);\n        tested.user = user;\n        tested.onOnUserGroupsUpdatedEvent(onUpdateUserGroupsEvent);\n        assertSetDirty();\n    }\n\n    private void assertSetDirty() {\n        verify(view,\n               times(1)).setSaveButtonEnabled(true);\n        verify(view,\n               times(2)).showNotification(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/explorer/EntitiesExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *    http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class EntitiesExplorerTest {\n\n    @Mock\n    EntitiesList.View view;\n\n    @Test\n    public void enableClearButtonAfterSearchTest() {\n        EntitiesExplorerViewImpl entitiesExplorerView = new EntitiesExplorerViewImpl();\n        entitiesExplorerView.configure(\"\",\n                                       view);\n\n        verify(entitiesExplorerView.clearSearchButton,\n               times(1)).setEnabled(false);\n        verify(entitiesExplorerView.clearSearchButton,\n               never()).setEnabled(true);\n\n        reset(entitiesExplorerView.clearSearchButton);\n\n        entitiesExplorerView.doSearch(\"admin\");\n\n        verify(entitiesExplorerView.clearSearchButton,\n               never()).setEnabled(false);\n        verify(entitiesExplorerView.clearSearchButton,\n               times(1)).setEnabled(true);\n\n        reset(entitiesExplorerView.clearSearchButton);\n\n        entitiesExplorerView.clearSearch();\n\n        verify(entitiesExplorerView.clearSearchButton,\n               times(1)).setEnabled(false);\n        verify(entitiesExplorerView.clearSearchButton,\n               never()).setEnabled(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/explorer/GroupsExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.events.AddUsersToGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GroupsExplorerTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EntitiesExplorerView view;\n    @Mock\n    EventSourceMock<OnErrorEvent> onErrorEvent;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntitiesList<Group> entitiesList;\n    @Mock\n    EventSourceMock<ReadGroupEvent> readGroupEvent;\n    @Mock\n    EventSourceMock<NewGroupEvent> newGroupEvent;\n\n    private GroupsExplorer presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new GroupsExplorer(userSystemManager,\n                                       onErrorEvent,\n                                       loadingBox,\n                                       entitiesList,\n                                       view,\n                                       readGroupEvent,\n                                       newGroupEvent);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(0)).clearSearch();\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n        verify(view,\n               times(0)).show(any(EntitiesExplorerView.ViewContext.class),\n                              any(EntitiesExplorerView.ViewCallback.class));\n        assertNull(presenter.context);\n        assertNull(presenter.selected);\n        Assert.assertEquals(presenter.currentPage,\n                            1);\n    }\n\n    @Test\n    public void testLoadingViewShow() throws Exception {\n        presenter.showLoadingView();\n        verify(loadingBox,\n               times(1)).show();\n    }\n\n    @Test\n    public void testLoadingViewHide() throws Exception {\n        presenter.hideLoadingView();\n        verify(loadingBox,\n               times(1)).hide();\n    }\n\n    @Test\n    public void testShowError() throws Exception {\n        final String message = \"error1\";\n        final Throwable t = mock(Throwable.class);\n        when(t.getMessage()).thenReturn(message);\n        presenter.showError(t);\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(onErrorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testShowNotAllowed() throws Exception {\n        when(userSystemManager.isGroupCapabilityEnabled(Capability.CAN_SEARCH_GROUPS)).thenReturn(false);\n        final ExplorerViewContext context = mock(ExplorerViewContext.class);\n        presenter.show(context);\n        verify(view,\n               times(1)).showMessage(any(LabelType.class),\n                                     anyString());\n        verify(view,\n               times(0)).show(any(EntitiesExplorerView.ViewContext.class),\n                              any(EntitiesExplorerView.ViewCallback.class));\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        /// The mocked view context.\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          new HashSet<String>());\n\n        /// The mocked service response.\n        final List<Group> groups = buildGroupsList(10);\n        final AbstractEntityManager.SearchResponse<Group> response = createResponse(groups,\n                                                                                    10,\n                                                                                    false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testShowConstrained() throws Exception {\n        /// The mocked view context.\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          new HashSet<String>());\n        context.getConstrainedEntities().add(\"group8\");\n        context.getConstrainedEntities().add(\"group9\");\n\n        /// The mocked service response.\n        final List<Group> groups = buildGroupsList(8);\n        final AbstractEntityManager.SearchResponse<Group> response = createResponse(groups,\n                                                                                    8,\n                                                                                    false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testShowWithSelectedGroups() throws Exception {\n        /// The mocked view context.\n        final Set<String> selectedGroups = new HashSet<String>(5);\n        selectedGroups.add(\"group0\");\n        selectedGroups.add(\"group1\");\n        selectedGroups.add(\"group2\");\n        selectedGroups.add(\"group3\");\n        selectedGroups.add(\"group4\");\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          selectedGroups);\n\n        /// The mocked service response.\n        final List<Group> groups = buildGroupsList(10);\n        final AbstractEntityManager.SearchResponse<Group> response = createResponse(groups,\n                                                                                    10,\n                                                                                    false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testOnDeleteGroup() throws Exception {\n        final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onGroupDeleted(deleteGroupEvent);\n        verify(groupsManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnDeleteGroupButNoContext() throws Exception {\n        final DeleteGroupEvent deleteGroupEvent = mock(DeleteGroupEvent.class);\n        presenter.context = null;\n        presenter.onGroupDeleted(deleteGroupEvent);\n        verify(groupsManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnCreateGroup() throws Exception {\n        final CreateGroupEvent createGroupEvent = mock(CreateGroupEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onGroupCreated(createGroupEvent);\n        verify(groupsManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnCreateGroupButNoContext() throws Exception {\n        final CreateGroupEvent createGroupEvent = mock(CreateGroupEvent.class);\n        presenter.context = null;\n        presenter.onGroupCreated(createGroupEvent);\n        verify(groupsManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnAddUsersToGroupEvent() throws Exception {\n        final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onAddUsersToGroup(addUsersToGroupEvent);\n        verify(groupsManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnAddUsersToGroupEventButNoContext() throws Exception {\n        final AddUsersToGroupEvent addUsersToGroupEvent = mock(AddUsersToGroupEvent.class);\n        presenter.context = null;\n        presenter.onAddUsersToGroup(addUsersToGroupEvent);\n        verify(groupsManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    private ExplorerViewContext createContext(final boolean canCreate,\n                                              final boolean canRead,\n                                              final boolean canDelete,\n                                              final boolean canSearch,\n                                              final boolean canSelect,\n                                              final Set<String> selectedGroups) {\n        final ExplorerViewContext context = mock(ExplorerViewContext.class);\n        when(context.canCreate()).thenReturn(canCreate);\n        when(context.canRead()).thenReturn(canRead);\n        when(context.canDelete()).thenReturn(canDelete);\n        when(context.canSearch()).thenReturn(canSearch);\n        when(context.canSelect()).thenReturn(canSelect);\n        when(context.getSelectedEntities()).thenReturn(selectedGroups);\n        return context;\n    }\n\n    private AbstractEntityManager.SearchResponse<Group> createResponse(final List<Group> groups,\n                                                                       final int size,\n                                                                       final boolean hasNextPage) {\n        final AbstractEntityManager.SearchResponse<Group> response = mock(AbstractEntityManager.SearchResponse.class);\n        when(response.getResults()).thenReturn(groups);\n        when(response.getTotal()).thenReturn(size);\n        when(response.hasNextPage()).thenReturn(hasNextPage);\n        return response;\n    }\n\n    private void testShow(final ExplorerViewContext context,\n                          final AbstractEntityManager.SearchResponse<Group> response) {\n        when(groupsManagerService.search(any(AbstractEntityManager.SearchRequest.class))).thenAnswer(new Answer<AbstractEntityManager.SearchResponse<Group>>() {\n            @Override\n            public AbstractEntityManager.SearchResponse<Group> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return response;\n            }\n        });\n\n        // Run the logic.\n        presenter.show(context);\n\n        // State assertions.\n        assertEquals(context,\n                     presenter.context);\n        assertEquals(context.getSelectedEntities(),\n                     presenter.selected);\n        verify(context,\n               times(1)).setParent(any(EntitiesExplorerView.ViewContext.class));\n\n        // Verify no messages shown.\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n\n        // Verify loading box.\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n\n        // Verify entitiesList#show is called once and the generated callback argument. \n        final ArgumentCaptor<AbstractEntityManager.SearchResponse> responseArgumentCaptor = ArgumentCaptor.forClass(AbstractEntityManager.SearchResponse.class);\n        final ArgumentCaptor<EntitiesList.Callback> callbackArgumentCaptor = ArgumentCaptor.forClass(EntitiesList.Callback.class);\n        verify(entitiesList,\n               times(1)).show(responseArgumentCaptor.capture(),\n                              callbackArgumentCaptor.capture());\n        final AbstractEntityManager.SearchResponse responseArgumentCaptured = responseArgumentCaptor.getValue();\n        final List<Group> results = response.getResults();\n        assertEquals(results,\n                     responseArgumentCaptured.getResults());\n        assertEquals(response.getTotal(),\n                     responseArgumentCaptured.getTotal());\n        assertEquals(response.hasNextPage(),\n                     responseArgumentCaptured.hasNextPage());\n        final EntitiesList.Callback callbackArgumentCaptured = callbackArgumentCaptor.getValue();\n        assertEquals(context.canRead(),\n                     callbackArgumentCaptured.canRead());\n        assertEquals(context.canDelete(),\n                     callbackArgumentCaptured.canRemove());\n        assertEquals(context.canSelect(),\n                     callbackArgumentCaptured.canSelect());\n\n        int x = 0;\n        for (Group _group : results) {\n            final String gname = getGroupIdentifier(x);\n            assertEquals(gname,\n                         callbackArgumentCaptured.getIdentifier(_group));\n            assertEquals(gname,\n                         callbackArgumentCaptured.getTitle(_group));\n            final boolean isSelected = context.getSelectedEntities() != null && context.getSelectedEntities().contains(gname);\n            assertEquals(isSelected,\n                         callbackArgumentCaptured.isSelected(_group.getName()));\n            x++;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/explorer/RolesExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadRoleEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RolesExplorerTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EntitiesExplorerView view;\n    @Mock\n    EventSourceMock<OnErrorEvent> onErrorEvent;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntitiesList<Role> entitiesList;\n    @Mock\n    EventSourceMock<ReadRoleEvent> readRoleEvent;\n\n    private RolesExplorer presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new RolesExplorer(userSystemManager,\n                                      onErrorEvent,\n                                      loadingBox,\n                                      entitiesList,\n                                      view,\n                                      readRoleEvent);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(0)).clearSearch();\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n        verify(view,\n               times(0)).show(any(EntitiesExplorerView.ViewContext.class),\n                              any(EntitiesExplorerView.ViewCallback.class));\n        assertNull(presenter.context);\n        assertNull(presenter.selected);\n        Assert.assertEquals(presenter.currentPage,\n                            1);\n    }\n\n    @Test\n    public void testLoadingViewShow() throws Exception {\n        presenter.showLoadingView();\n        verify(loadingBox,\n               times(1)).show();\n    }\n\n    @Test\n    public void testLoadingViewHide() throws Exception {\n        presenter.hideLoadingView();\n        verify(loadingBox,\n               times(1)).hide();\n    }\n\n    @Test\n    public void testShowError() throws Exception {\n        final String message = \"error1\";\n        final Throwable t = mock(Throwable.class);\n        when(t.getMessage()).thenReturn(message);\n        presenter.showError(t);\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(onErrorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        /// The mocked view context.\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          new HashSet<String>());\n\n        /// The mocked service response.\n        final List<Role> roles = buildRolesList(10);\n        final AbstractEntityManager.SearchResponse<Role> response = createResponse(roles,\n                                                                                   10,\n                                                                                   false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testShowWithSelectedRoles() throws Exception {\n        /// The mocked view context.\n        final Set<String> selRoles = new HashSet<String>(5);\n        selRoles.add(\"role0\");\n        selRoles.add(\"role1\");\n        selRoles.add(\"role2\");\n        selRoles.add(\"role3\");\n        selRoles.add(\"role4\");\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          selRoles);\n\n        /// The mocked service response.\n        final List<Role> roles = buildRolesList(10);\n        final AbstractEntityManager.SearchResponse<Role> response = createResponse(roles,\n                                                                                   10,\n                                                                                   false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    private ExplorerViewContext createContext(final boolean canCreate,\n                                              final boolean canRead,\n                                              final boolean canDelete,\n                                              final boolean canSearch,\n                                              final boolean canSelect,\n                                              final Set<String> selRoles) {\n        final ExplorerViewContext context = mock(ExplorerViewContext.class);\n        when(context.canCreate()).thenReturn(canCreate);\n        when(context.canRead()).thenReturn(canRead);\n        when(context.canDelete()).thenReturn(canDelete);\n        when(context.canSearch()).thenReturn(canSearch);\n        when(context.canSelect()).thenReturn(canSelect);\n        when(context.getSelectedEntities()).thenReturn(selRoles);\n        return context;\n    }\n\n    private AbstractEntityManager.SearchResponse<Role> createResponse(final List<Role> roles,\n                                                                      final int size,\n                                                                      final boolean hasNextPage) {\n        final AbstractEntityManager.SearchResponse<Role> response = mock(AbstractEntityManager.SearchResponse.class);\n        when(response.getResults()).thenReturn(roles);\n        when(response.getTotal()).thenReturn(size);\n        when(response.hasNextPage()).thenReturn(hasNextPage);\n        return response;\n    }\n\n    private void testShow(final ExplorerViewContext context,\n                          final AbstractEntityManager.SearchResponse<Role> response) {\n        when(rolesManagerService.search(any(AbstractEntityManager.SearchRequest.class))).thenAnswer(new Answer<AbstractEntityManager.SearchResponse<Role>>() {\n            @Override\n            public AbstractEntityManager.SearchResponse<Role> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return response;\n            }\n        });\n\n        // Run the logic.\n        presenter.show(context);\n\n        // State assertions.\n        assertEquals(context,\n                     presenter.context);\n        assertEquals(context.getSelectedEntities(),\n                     presenter.selected);\n        verify(context,\n               times(1)).setParent(any(EntitiesExplorerView.ViewContext.class));\n\n        // Verify no messages shown.\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n\n        // Verify loading box.\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n\n        // Verify entitiesList#show is called once and the generated callback argument. \n        final ArgumentCaptor<AbstractEntityManager.SearchResponse> responseArgumentCaptor = ArgumentCaptor.forClass(AbstractEntityManager.SearchResponse.class);\n        final ArgumentCaptor<EntitiesList.Callback> callbackArgumentCaptor = ArgumentCaptor.forClass(EntitiesList.Callback.class);\n        verify(entitiesList,\n               times(1)).show(responseArgumentCaptor.capture(),\n                              callbackArgumentCaptor.capture());\n        final AbstractEntityManager.SearchResponse responseArgumentCaptured = responseArgumentCaptor.getValue();\n        final List<Role> results = response.getResults();\n        assertEquals(results,\n                     responseArgumentCaptured.getResults());\n        assertEquals(response.getTotal(),\n                     responseArgumentCaptured.getTotal());\n        assertEquals(response.hasNextPage(),\n                     responseArgumentCaptured.hasNextPage());\n        final EntitiesList.Callback callbackArgumentCaptured = callbackArgumentCaptor.getValue();\n        assertEquals(context.canRead(),\n                     callbackArgumentCaptured.canRead());\n        assertEquals(context.canDelete(),\n                     callbackArgumentCaptured.canRemove());\n        assertEquals(context.canSelect(),\n                     callbackArgumentCaptured.canSelect());\n\n        int x = 0;\n        for (Role _role : results) {\n            final String gname = getRoleIdentifier(x);\n            assertEquals(gname,\n                         callbackArgumentCaptured.getIdentifier(_role));\n            assertEquals(gname,\n                         callbackArgumentCaptured.getTitle(_role));\n            final boolean isSelected = context.getSelectedEntities() != null && context.getSelectedEntities().contains(gname);\n            assertEquals(isSelected,\n                         callbackArgumentCaptured.isSelected(_role.getName()));\n            x++;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UserGroupsExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.events.RemoveUserGroupEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.management.list.GroupsList;\nimport org.uberfire.ext.security.management.client.widgets.popup.ConfirmBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserGroupsExplorerTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    GroupsList groupList;\n    @Mock\n    UserGroupsExplorer.View view;\n    @Mock\n    ConfirmBox confirmBox;\n    @Mock\n    EventSourceMock<RemoveUserGroupEvent> removeUserGroupEventEvent;\n\n    private UserGroupsExplorer presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new UserGroupsExplorer(groupList,\n                                           view,\n                                           confirmBox,\n                                           removeUserGroupEventEvent);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        assertFalse(presenter.canRemove);\n        verify(view,\n               times(1)).clear();\n    }\n\n    @Test\n    public void show() {\n        final boolean canRemove = false;\n        final Set<Group> groups = new LinkedHashSet<Group>(buildGroupsList(10));\n        presenter.show(new HashSet<Group>(groups),\n                       canRemove);\n\n        assertFalse(presenter.canRemove);\n        verify(view,\n               times(1)).clear();\n\n        // Verify groupList#show is called once and the generated callback argument. \n        final ArgumentCaptor<Set> responseArgumentCaptor = ArgumentCaptor.forClass(Set.class);\n        final ArgumentCaptor<EntitiesList.Callback> callbackArgumentCaptor = ArgumentCaptor.forClass(EntitiesList.Callback.class);\n        verify(groupList,\n               times(1)).show(responseArgumentCaptor.capture(),\n                              callbackArgumentCaptor.capture());\n        final Set<Group> responseArgumentCaptured = responseArgumentCaptor.getValue();\n        assertEquals(groups,\n                     responseArgumentCaptured);\n        final EntitiesList.Callback callbackArgumentCaptured = callbackArgumentCaptor.getValue();\n        assertEquals(false,\n                     callbackArgumentCaptured.canRead());\n        assertEquals(false,\n                     callbackArgumentCaptured.canRemove());\n        assertEquals(false,\n                     callbackArgumentCaptured.canSelect());\n\n        int x = 0;\n        for (Group _group : groups) {\n            final String gname = getGroupIdentifier(x);\n            assertEquals(gname,\n                         callbackArgumentCaptured.getIdentifier(_group));\n            assertEquals(gname,\n                         callbackArgumentCaptured.getTitle(_group));\n            assertEquals(false,\n                         callbackArgumentCaptured.isSelected(_group.getName()));\n            x++;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/explorer/UsersExplorerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.explorer;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.constants.LabelType;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.api.Capability;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.management.events.CreateUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.DeleteUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.NewUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.OnErrorEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.ReadUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.events.SaveUserEvent;\nimport org.uberfire.ext.security.management.client.widgets.management.list.EntitiesList;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static junit.framework.Assert.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UsersExplorerTest extends AbstractSecurityManagementTest {\n\n    @Mock\n    EntitiesExplorerView view;\n    @Mock\n    EventSourceMock<OnErrorEvent> onErrorEvent;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntitiesList<User> entitiesList;\n    @Mock\n    EventSourceMock<ReadUserEvent> readUserEvent;\n    @Mock\n    EventSourceMock<NewUserEvent> newUserEvent;\n\n    private UsersExplorer presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new UsersExplorer(userSystemManager,\n                                      onErrorEvent,\n                                      loadingBox,\n                                      entitiesList,\n                                      view,\n                                      readUserEvent,\n                                      newUserEvent);\n        assertEquals(view.asWidget(),\n                     presenter.asWidget());\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.clear();\n        verify(view,\n               times(1)).clear();\n        verify(view,\n               times(0)).clearSearch();\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n        verify(view,\n               times(0)).show(any(EntitiesExplorerView.ViewContext.class),\n                              any(EntitiesExplorerView.ViewCallback.class));\n        assertNull(presenter.context);\n        assertNull(presenter.selected);\n        Assert.assertEquals(presenter.currentPage,\n                            1);\n    }\n\n    @Test\n    public void testLoadingViewShow() throws Exception {\n        presenter.showLoadingView();\n        verify(loadingBox,\n               times(1)).show();\n    }\n\n    @Test\n    public void testLoadingViewHide() throws Exception {\n        presenter.hideLoadingView();\n        verify(loadingBox,\n               times(1)).hide();\n    }\n\n    @Test\n    public void testShowError() throws Exception {\n        final String message = \"error1\";\n        final Throwable t = mock(Throwable.class);\n        when(t.getMessage()).thenReturn(message);\n        presenter.showError(t);\n        verify(loadingBox,\n               times(0)).show();\n        verify(loadingBox,\n               times(1)).hide();\n        verify(onErrorEvent,\n               times(1)).fire(any(OnErrorEvent.class));\n    }\n\n    @Test\n    public void testShowNotAllowed() throws Exception {\n        when(userSystemManager.isUserCapabilityEnabled(Capability.CAN_SEARCH_USERS)).thenReturn(false);\n        final ExplorerViewContext context = mock(ExplorerViewContext.class);\n        presenter.show(context);\n        verify(view,\n               times(1)).showMessage(any(LabelType.class),\n                                     anyString());\n        verify(view,\n               times(0)).show(any(EntitiesExplorerView.ViewContext.class),\n                              any(EntitiesExplorerView.ViewCallback.class));\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        /// The mocked view context.\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          new HashSet<String>());\n\n        /// The mocked service response.\n        final List<User> users = buildUsersList(10);\n        final AbstractEntityManager.SearchResponse<User> response = createResponse(users,\n                                                                                   10,\n                                                                                   false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testShowWithSelectedUsers() throws Exception {\n        /// The mocked view context.\n        final Set<String> selectedUsers = new HashSet<String>(5);\n        selectedUsers.add(\"user0\");\n        selectedUsers.add(\"user1\");\n        selectedUsers.add(\"user2\");\n        selectedUsers.add(\"user3\");\n        selectedUsers.add(\"user4\");\n        final ExplorerViewContext context = createContext(true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          true,\n                                                          selectedUsers);\n\n        /// The mocked service response.\n        final List<User> users = buildUsersList(10);\n        final AbstractEntityManager.SearchResponse<User> response = createResponse(users,\n                                                                                   10,\n                                                                                   false);\n\n        // Test the show method logic.\n        testShow(context,\n                 response);\n    }\n\n    @Test\n    public void testOnUserDeleted() throws Exception {\n        final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onUserDeleted(deleteUserEvent);\n        verify(userManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnUserDeletedButNoContext() throws Exception {\n        final DeleteUserEvent deleteUserEvent = mock(DeleteUserEvent.class);\n        presenter.context = null;\n        presenter.onUserDeleted(deleteUserEvent);\n        verify(userManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnCreateUser() throws Exception {\n        final CreateUserEvent createUserEvent = mock(CreateUserEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onUserCreated(createUserEvent);\n        verify(userManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnCreateUserButNoContext() throws Exception {\n        final CreateUserEvent createUserEvent = mock(CreateUserEvent.class);\n        presenter.context = null;\n        presenter.onUserCreated(createUserEvent);\n        verify(userManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnSaveUser() throws Exception {\n        final SaveUserEvent saveUserEvent = mock(SaveUserEvent.class);\n        presenter.context = mock(ExplorerViewContext.class);\n        presenter.onUserSaved(saveUserEvent);\n        verify(userManagerService,\n               times(1)).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    @Test\n    public void testOnSaveUserButNoContext() throws Exception {\n        final SaveUserEvent saveUserEvent = mock(SaveUserEvent.class);\n        presenter.context = null;\n        presenter.onUserSaved(saveUserEvent);\n        verify(userManagerService,\n               never()).search(any(AbstractEntityManager.SearchRequest.class));\n    }\n\n    private ExplorerViewContext createContext(final boolean canCreate,\n                                              final boolean canRead,\n                                              final boolean canDelete,\n                                              final boolean canSearch,\n                                              final boolean canSelect,\n                                              final Set<String> selectedUsers) {\n        final ExplorerViewContext context = mock(ExplorerViewContext.class);\n        when(context.canCreate()).thenReturn(canCreate);\n        when(context.canRead()).thenReturn(canRead);\n        when(context.canDelete()).thenReturn(canDelete);\n        when(context.canSearch()).thenReturn(canSearch);\n        when(context.canSelect()).thenReturn(canSelect);\n        when(context.getSelectedEntities()).thenReturn(selectedUsers);\n        return context;\n    }\n\n    private AbstractEntityManager.SearchResponse<User> createResponse(final List<User> users,\n                                                                      final int size,\n                                                                      final boolean hasNextPage) {\n        final AbstractEntityManager.SearchResponse<User> response = mock(AbstractEntityManager.SearchResponse.class);\n        when(response.getResults()).thenReturn(users);\n        when(response.getTotal()).thenReturn(size);\n        when(response.hasNextPage()).thenReturn(hasNextPage);\n        return response;\n    }\n\n    private void testShow(final ExplorerViewContext context,\n                          final AbstractEntityManager.SearchResponse<User> response) {\n        when(userManagerService.search(any(AbstractEntityManager.SearchRequest.class))).thenAnswer(new Answer<AbstractEntityManager.SearchResponse<User>>() {\n            @Override\n            public AbstractEntityManager.SearchResponse<User> answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return response;\n            }\n        });\n\n        // Run the logic.\n        presenter.show(context);\n\n        // State assertions.\n        assertEquals(context,\n                     presenter.context);\n        assertEquals(context.getSelectedEntities(),\n                     presenter.selected);\n        verify(context,\n               times(1)).setParent(any(EntitiesExplorerView.ViewContext.class));\n\n        // Verify no messages shown.\n        verify(view,\n               times(0)).showMessage(any(LabelType.class),\n                                     anyString());\n\n        // Verify loading box.\n        verify(loadingBox,\n               times(1)).show();\n        verify(loadingBox,\n               times(1)).hide();\n\n        // Verify entitiesList#show is called once and the generated callback argument. \n        final ArgumentCaptor<AbstractEntityManager.SearchResponse> responseArgumentCaptor = ArgumentCaptor.forClass(AbstractEntityManager.SearchResponse.class);\n        final ArgumentCaptor<EntitiesList.Callback> callbackArgumentCaptor = ArgumentCaptor.forClass(EntitiesList.Callback.class);\n        verify(entitiesList,\n               times(1)).show(responseArgumentCaptor.capture(),\n                              callbackArgumentCaptor.capture());\n        final AbstractEntityManager.SearchResponse responseArgumentCaptured = responseArgumentCaptor.getValue();\n        final List<User> results = response.getResults();\n        assertEquals(results,\n                     responseArgumentCaptured.getResults());\n        assertEquals(response.getTotal(),\n                     responseArgumentCaptured.getTotal());\n        assertEquals(response.hasNextPage(),\n                     responseArgumentCaptured.hasNextPage());\n        final EntitiesList.Callback callbackArgumentCaptured = callbackArgumentCaptor.getValue();\n        assertEquals(context.canRead(),\n                     callbackArgumentCaptured.canRead());\n        assertEquals(context.canDelete(),\n                     callbackArgumentCaptured.canRemove());\n        assertEquals(context.canSelect(),\n                     callbackArgumentCaptured.canSelect());\n\n        int x = 0;\n        for (User user : results) {\n            final String username = getUserIdentifier(x);\n            assertEquals(username,\n                         callbackArgumentCaptured.getIdentifier(user));\n            assertEquals(username,\n                         callbackArgumentCaptured.getTitle(user));\n            final boolean isSelected = context.getSelectedEntities() != null && context.getSelectedEntities().contains(username);\n            assertEquals(isSelected,\n                         callbackArgumentCaptured.isSelected(user.getIdentifier()));\n            x++;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesListTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.security.management.api.AbstractEntityManager;\nimport org.uberfire.ext.security.management.client.widgets.management.AbstractSecurityManagementTest;\nimport org.uberfire.ext.security.management.client.widgets.popup.LoadingBox;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class EntitiesListTest extends AbstractSecurityManagementTest {\n\n    protected EntitiesList<User> presenter;\n    protected HeadingSize headingSize = HeadingSize.H3;\n    @Mock\n    LoadingBox loadingBox;\n    @Mock\n    EntitiesList.View view;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new EntitiesList<User>(loadingBox,\n                                           view);\n        presenter.setPageSize(5);\n        presenter.setEntityTitleSize(headingSize);\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        presenter.callback = mock(EntitiesList.Callback.class);\n        presenter.paginationConstraints = mock(EntitiesList.PaginationConstraints.class);\n        presenter.totalPages = 10;\n        presenter.emptyEntitiesText = \"empty\";\n        presenter.clear();\n        assertNull(presenter.callback);\n        assertNull(presenter.paginationConstraints);\n        assertEquals(presenter.totalPages,\n                     -1);\n        assertNull(presenter.emptyEntitiesText);\n        verify(view,\n               times(0)).configure(anyString(),\n                                   any(EntitiesList.PaginationConstraints.class));\n        verify(view,\n               times(0)).add(anyInt(),\n                             anyString(),\n                             anyString(),\n                             any(HeadingSize.class),\n                             anyBoolean(),\n                             anyBoolean(),\n                             anyBoolean(),\n                             anyBoolean());\n        verify(view,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testCallbacks() throws Exception {\n        final String id = \"user1\";\n        final EntitiesList.Callback callback = mock(EntitiesList.Callback.class);\n        ;\n        final EntitiesList.PaginationConstraints paginationConstraints = mock(EntitiesList.PaginationConstraints.class);\n        when(paginationConstraints.getCurrentPage()).thenReturn(5);\n        presenter.callback = callback;\n        presenter.paginationConstraints = paginationConstraints;\n        presenter.totalPages = 10;\n\n        presenter.getEntityType();\n        verify(callback,\n               times(1)).getEntityType();\n\n        presenter.onReadEntity(id);\n        verify(callback,\n               times(1)).onReadEntity(id);\n\n        presenter.onRemoveEntity(id);\n        verify(callback,\n               times(1)).onRemoveEntity(id);\n\n        presenter.onGoToFirstPage();\n        verify(callback,\n               times(1)).onChangePage(anyInt(),\n                                      eq(1));\n\n        presenter.onGoToPrevPage();\n        verify(callback,\n               times(1)).onChangePage(anyInt(),\n                                      eq(4));\n\n        presenter.onGoToNextPage();\n        verify(callback,\n               times(1)).onChangePage(anyInt(),\n                                      eq(6));\n\n        presenter.onGoToLastPage();\n        verify(callback,\n               times(1)).onChangePage(anyInt(),\n                                      eq(11));\n\n        presenter.onSelectEntity(id,\n                                 0,\n                                 false);\n        verify(callback,\n               times(1)).onSelectEntity(id,\n                                        false);\n    }\n\n    @Test\n    public void testCreatePaginationCallbackSinglePage() throws Exception {\n        final Integer size = 10;\n        List<User> users = buildUsersList(size);\n        final boolean hasNextPage = false;\n        final int page = 1;\n        final int pageSize = 50;\n\n        final AbstractEntityManager.SearchResponse<User> searchResponse = createSearchResponse(users,\n                                                                                               size,\n                                                                                               hasNextPage,\n                                                                                               \"\",\n                                                                                               page,\n                                                                                               pageSize);\n\n        EntitiesList.PaginationConstraints constraints = presenter.createPaginationCallback(searchResponse);\n        assertFalse(constraints.isFirstPageEnabled());\n        assertFalse(constraints.isFirstPageVisible());\n        assertFalse(constraints.isNextPageEnabled());\n        assertFalse(constraints.isNextPageVisible());\n        assertFalse(constraints.isPrevPageEnabled());\n        assertFalse(constraints.isPrevPageVisible());\n        assertFalse(constraints.isLastPageEnabled());\n        assertFalse(constraints.isLastPageVisible());\n        assertEquals(constraints.getTotal(),\n                     size);\n        assertEquals(constraints.getCurrentPage(),\n                     page);\n    }\n\n    @Test\n    public void testCreatePaginationCallbackMultiplePagesAtFirstPage() throws Exception {\n        final Integer size = 10;\n        List<User> users = buildUsersList(size);\n        final boolean hasNextPage = false;\n        final int page = 1;\n        final int pageSize = 5;\n\n        final AbstractEntityManager.SearchResponse<User> searchResponse = createSearchResponse(users,\n                                                                                               size,\n                                                                                               hasNextPage,\n                                                                                               \"\",\n                                                                                               page,\n                                                                                               pageSize);\n\n        EntitiesList.PaginationConstraints constraints = presenter.createPaginationCallback(searchResponse);\n        assertFalse(constraints.isFirstPageEnabled());\n        assertFalse(constraints.isFirstPageVisible());\n        assertTrue(constraints.isNextPageEnabled());\n        assertTrue(constraints.isNextPageVisible());\n        assertFalse(constraints.isPrevPageEnabled());\n        assertFalse(constraints.isPrevPageVisible());\n        assertTrue(constraints.isLastPageEnabled());\n        assertTrue(constraints.isLastPageVisible());\n        assertEquals(constraints.getTotal(),\n                     size);\n        assertEquals(constraints.getCurrentPage(),\n                     page);\n    }\n\n    @Test\n    public void testCreatePaginationCallbackMultiplePagesAtSecondPage() throws Exception {\n        final Integer size = 10;\n        List<User> users = buildUsersList(size);\n        final boolean hasNextPage = false;\n        final int page = 2;\n        final int pageSize = 5;\n\n        final AbstractEntityManager.SearchResponse<User> searchResponse = createSearchResponse(users,\n                                                                                               size,\n                                                                                               hasNextPage,\n                                                                                               \"\",\n                                                                                               page,\n                                                                                               pageSize);\n\n        EntitiesList.PaginationConstraints constraints = presenter.createPaginationCallback(searchResponse);\n        assertTrue(constraints.isFirstPageEnabled());\n        assertTrue(constraints.isFirstPageVisible());\n        assertFalse(constraints.isNextPageEnabled());\n        assertFalse(constraints.isNextPageVisible());\n        assertTrue(constraints.isPrevPageEnabled());\n        assertTrue(constraints.isPrevPageVisible());\n        assertFalse(constraints.isLastPageEnabled());\n        assertFalse(constraints.isLastPageVisible());\n        assertEquals(constraints.getTotal(),\n                     size);\n        assertEquals(constraints.getCurrentPage(),\n                     page);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        final int size = 10;\n        List<User> users = buildUsersList(size);\n        final boolean hasNextPage = false;\n        final int page = 1;\n        final int pageSize = 50;\n\n        final AbstractEntityManager.SearchResponse<User> searchResponse = createSearchResponse(users,\n                                                                                               size,\n                                                                                               hasNextPage,\n                                                                                               \"\",\n                                                                                               page,\n                                                                                               pageSize);\n        final EntitiesList.Callback<User> callback = createEntitiesListCallback(users,\n                                                                                true,\n                                                                                true,\n                                                                                true);\n\n        // Call the public show method.\n        presenter.show(searchResponse,\n                       callback);\n        assertEquals(presenter.callback,\n                     callback);\n\n        // Not clear verify.\n        verify(view,\n               times(0)).clear();\n\n        // Verify loading popup.\n        verify(loadingBox,\n               times(1)).show();\n\n        // Verify view configuration.\n        verify(view,\n               times(1)).configure(any(),\n                                   any(EntitiesList.PaginationConstraints.class));\n\n        // Verify adding entities to the view. \n        for (int x = 0; x < size; x++) {\n            verify(view,\n                   times(1)).add(x,\n                                 getUserIdentifier(x),\n                                 getUserIdentifier(x),\n                                 headingSize,\n                                 true,\n                                 true,\n                                 true,\n                                 false);\n        }\n\n        // Verify loading popup.\n        verify(loadingBox,\n               times(1)).hide();\n    }\n\n    protected EntitiesList.Callback<User> createEntitiesListCallback(Collection<User> entities,\n                                                                     boolean canRead,\n                                                                     boolean canRemove,\n                                                                     boolean canSelect) {\n        EntitiesList.Callback<User> callback = mock(EntitiesList.Callback.class);\n        when(callback.canRead()).thenReturn(canRead);\n        when(callback.canRemove()).thenReturn(canRemove);\n        when(callback.canSelect()).thenReturn(canSelect);\n        when(callback.isSelected(anyString())).thenReturn(false);\n        when(callback.getIdentifier(any(User.class))).thenAnswer(new Answer<String>() {\n            @Override\n            public String answer(InvocationOnMock invocationOnMock) throws Throwable {\n                User user = (User) invocationOnMock.getArguments()[0];\n                return user.getIdentifier();\n            }\n        });\n        when(callback.getTitle(any(User.class))).thenAnswer(new Answer<String>() {\n            @Override\n            public String answer(InvocationOnMock invocationOnMock) throws Throwable {\n                User user = (User) invocationOnMock.getArguments()[0];\n                return user.getIdentifier();\n            }\n        });\n        return callback;\n    }\n\n    protected AbstractEntityManager.SearchResponse<User> createSearchResponse(final List<User> users,\n                                                                              final int total,\n                                                                              final boolean hasNextPage,\n                                                                              final String searchPattern,\n                                                                              final int page,\n                                                                              final int pageSize) {\n        AbstractEntityManager.SearchResponse<User> response = mock(AbstractEntityManager.SearchResponse.class);\n        when(response.getResults()).thenReturn(users);\n        when(response.getTotal()).thenReturn(total);\n        when(response.getPage()).thenReturn(page);\n        when(response.getPageSize()).thenReturn(pageSize);\n        return response;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/management/list/EntitiesPagedListTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.management.list;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class EntitiesPagedListTest extends EntitiesListTest {\n\n    private final static int PAGE_SIZE = 5;\n    private EntitiesPagedList<User> presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n        presenter = new EntitiesPagedList<User>(loadingBox,\n                                                view);\n        presenter.setPageSize(PAGE_SIZE);\n        presenter.setEntityTitleSize(headingSize);\n        super.presenter = presenter;\n    }\n\n    @Test\n    public void testClear() throws Exception {\n        super.testClear();\n        assertEquals(-1,\n                     presenter.currentPage);\n    }\n\n    @Test\n    public void testCreatePaginationCallbackSinglePage() throws Exception {\n        presenter.totalPages = 1;\n        presenter.currentPage = 1;\n        EntitiesList.PaginationConstraints constraints = presenter.buildPaginationConstraints(10);\n        assertFalse(constraints.isFirstPageEnabled());\n        assertFalse(constraints.isFirstPageVisible());\n        assertFalse(constraints.isPrevPageEnabled());\n        assertFalse(constraints.isPrevPageVisible());\n        assertFalse(constraints.isNextPageEnabled());\n        assertFalse(constraints.isNextPageVisible());\n        assertFalse(constraints.isLastPageEnabled());\n        assertFalse(constraints.isLastPageVisible());\n        assertEquals(constraints.getCurrentPage(),\n                     1);\n    }\n\n    @Test\n    public void testCreatePaginationCallbackMultiplePages() throws Exception {\n        presenter.totalPages = 5;\n        presenter.currentPage = 2;\n        EntitiesList.PaginationConstraints constraints = presenter.buildPaginationConstraints(10);\n        assertTrue(constraints.isFirstPageEnabled());\n        assertTrue(constraints.isFirstPageVisible());\n        assertTrue(constraints.isPrevPageEnabled());\n        assertTrue(constraints.isPrevPageVisible());\n        assertTrue(constraints.isNextPageEnabled());\n        assertTrue(constraints.isNextPageVisible());\n        assertTrue(constraints.isLastPageEnabled());\n        assertTrue(constraints.isLastPageVisible());\n        assertEquals(constraints.getCurrentPage(),\n                     2);\n    }\n\n    @Test\n    public void testShowFirstPage() throws Exception {\n        final int size = 10;\n        final Collection<User> entities = buildUsersList(size);\n        testShowPage(entities,\n                     1,\n                     PAGE_SIZE);\n    }\n\n    @Test\n    public void testShowSecondPage() throws Exception {\n        final int size = 10;\n        final Collection<User> entities = buildUsersList(size);\n        testShowPage(entities,\n                     2,\n                     PAGE_SIZE);\n    }\n\n    protected void testShowPage(Collection<User> entities,\n                                final int page,\n                                final int pageSize) throws Exception {\n        final EntitiesList.Callback<User> callback = createEntitiesListCallback(entities,\n                                                                                true,\n                                                                                true,\n                                                                                true);\n        presenter.currentPage = page;\n        presenter.show(entities,\n                       callback);\n        assertEquals(presenter.entities,\n                     entities);\n        assertEquals(presenter.callback,\n                     callback);\n\n        // Verify loading popup.\n        verify(loadingBox,\n               times(1)).show();\n\n        // Verify view configuration.\n        verify(view,\n               times(1)).configure(any(),\n                                   any(EntitiesList.PaginationConstraints.class));\n\n        // Verify adding entities to the view. \n        int start = pageSize * (page - 1);\n        for (int x = 0; x < pageSize; x++) {\n            final int pos = start + x;\n            verify(view,\n                   times(1)).add(x,\n                                 getUserIdentifier(pos),\n                                 getUserIdentifier(pos),\n                                 headingSize,\n                                 true,\n                                 true,\n                                 true,\n                                 false);\n        }\n\n        // Verify loading popup.\n        verify(loadingBox,\n               times(1)).hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/popup/ConfirmBoxTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConfirmBoxTest {\n\n    @Mock\n    ConfirmBox.View view;\n    private ConfirmBox presenter;\n\n    @Before\n    public void setup() {\n        presenter = new ConfirmBox(view);\n    }\n\n    @Test\n    public void testYesCommand() throws Exception {\n        final String title = \"title\";\n        final String message = \"message\";\n        final Command yesCommand = mock(Command.class);\n        presenter.show(title,\n                       message,\n                       yesCommand);\n        verify(view,\n               times(1)).show(title,\n                              message,\n                              yesCommand);\n    }\n\n    @Test\n    public void testNoCommands() throws Exception {\n        final String title = \"title\";\n        final String message = \"message\";\n        final Command yesCommand = mock(Command.class);\n        final Command noCommand = mock(Command.class);\n        presenter.show(title,\n                       message,\n                       yesCommand,\n                       noCommand);\n        verify(view,\n               times(1)).show(title,\n                              message,\n                              yesCommand,\n                              noCommand);\n    }\n\n    @Test\n    public void testNoCancelCommands() throws Exception {\n        final String title = \"title\";\n        final String message = \"message\";\n        final Command yesCommand = mock(Command.class);\n        final Command noCommand = mock(Command.class);\n        final Command cancelCommand = mock(Command.class);\n        presenter.show(title,\n                       message,\n                       yesCommand,\n                       noCommand,\n                       cancelCommand);\n        verify(view,\n               times(1)).show(title,\n                              message,\n                              yesCommand,\n                              noCommand,\n                              cancelCommand);\n    }\n\n    @Test\n    public void testAllCommands() throws Exception {\n        final String title = \"title\";\n        final String message = \"message\";\n        final Command yesCommand = mock(Command.class);\n        final Command noCommand = mock(Command.class);\n        final Command cancelCommand = mock(Command.class);\n        presenter.show(title,\n                       message,\n                       yesCommand,\n                       noCommand,\n                       cancelCommand);\n        verify(view,\n               times(1)).show(title,\n                              message,\n                              yesCommand,\n                              noCommand,\n                              cancelCommand);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/popup/ErrorBoxTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ErrorBoxTest {\n\n    @Mock\n    ErrorBox.View view;\n    private ErrorBox presenter;\n\n    @Before\n    public void setup() {\n        presenter = new ErrorBox(view);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        final String message = \"message\";\n        presenter.show(message);\n        verify(view,\n               times(1)).show(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-security-management/uberfire-widgets-security-management/src/test/java/org/uberfire/ext/security/management/client/widgets/popup/LoadingBoxTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  \n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *  \n *    http://www.apache.org/licenses/LICENSE-2.0\n *  \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.management.client.widgets.popup;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class LoadingBoxTest {\n\n    @Mock\n    LoadingBox.View view;\n    private LoadingBox presenter;\n\n    @Before\n    public void setup() {\n        presenter = new LoadingBox(view);\n    }\n\n    @Test\n    public void testShow() throws Exception {\n        presenter.show();\n        verify(view,\n               times(1)).show(anyString());\n    }\n\n    @Test\n    public void testHide() throws Exception {\n        presenter.hide();\n        verify(view,\n               times(1)).close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-security-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-servlet-security</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Servlet Security</name>\n  <description>Uberfire Servlet Security</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-codec</groupId>\n      <artifactId>commons-codec</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.security.jacc</groupId>\n      <artifactId>jakarta.security.jacc-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.wildfly.security</groupId>\n      <artifactId>wildfly-elytron</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/BasicAuthSecurityFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.inject.Inject;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport com.google.common.base.Charsets;\nimport org.apache.commons.codec.binary.Base64;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\n\nimport static java.util.stream.Collectors.toSet;\nimport static org.apache.commons.lang3.StringUtils.isBlank;\n\npublic class BasicAuthSecurityFilter implements Filter {\n\n    public static final String REALM_NAME_PARAM = \"realmName\";\n    public static final String INVALIDATE_PARAM = \"invalidate\";\n    public static final String EXCEPTION_PATHS = \"excludedPaths\";\n\n    @Inject\n    AuthenticationService authenticationService;\n\n    private String realmName = \"UberFire Security Extension Default Realm\";\n    private Boolean invalidate = true;\n    private Set<String> excludedPaths = new HashSet<>();\n\n    @Override\n    public void init(final FilterConfig filterConfig) {\n        final String realmName = filterConfig.getInitParameter(REALM_NAME_PARAM);\n        if (realmName != null) {\n            this.realmName = realmName;\n        }\n        final String invalidate = filterConfig.getInitParameter(INVALIDATE_PARAM);\n        if (invalidate != null) {\n            this.invalidate = Boolean.valueOf(invalidate);\n        }\n        final String excludedPaths = filterConfig.getInitParameter(EXCEPTION_PATHS);\n        if (excludedPaths != null) {\n            this.excludedPaths = Arrays.stream(excludedPaths.split(\",\")).filter(s -> !isBlank(s)).collect(toSet());\n        }\n    }\n\n    @Override\n    public void destroy() {\n    }\n\n    @Override\n    public void doFilter(final ServletRequest _request,\n                         final ServletResponse _response,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        final HttpServletRequest request = (HttpServletRequest) _request;\n        final HttpServletResponse response = (HttpServletResponse) _response;\n\n        if (isExceptionPath(request)) {\n            chain.doFilter(request, response);\n            return;\n        }\n\n        HttpSession session = request.getSession(false);\n        final User user = authenticationService.getUser();\n        try {\n            if (user == null) {\n                if (authenticate(request)) {\n                    chain.doFilter(request,\n                                   response);\n                    if (response.isCommitted()) {\n                        authenticationService.logout();\n                    }\n                } else {\n                    challengeClient(request,\n                                    response);\n                }\n            } else {\n                chain.doFilter(request,\n                               response);\n            }\n        } finally {\n            // invalidate session only when it did not exists before this request,\n            // it was created as part of this request and filter is configured to invalidate.\n            if (session == null && invalidate) {\n                session = request.getSession(false);\n                if (session != null) {\n                    session.invalidate();\n                }\n            }\n        }\n    }\n\n    private boolean isExceptionPath(final HttpServletRequest request) {\n        String requestURI = request.getRequestURI();\n\n        while (requestURI != null && requestURI.endsWith(\"/\")) {\n            requestURI = requestURI.substring(0, requestURI.length() - 1);\n        }\n\n        if (requestURI != null && requestURI.startsWith(request.getContextPath())) {\n            requestURI = requestURI.replaceFirst(request.getContextPath(), \"\");\n        }\n\n        return excludedPaths.contains(requestURI);\n    }\n\n    public void challengeClient(final HttpServletRequest request,\n                                final HttpServletResponse response) throws IOException {\n        response.setHeader(\"WWW-Authenticate\",\n                           \"Basic realm=\\\"\" + this.realmName + \"\\\"\");\n\n        // this usually means we have a failing authentication request from an ajax client. so we return SC_FORBIDDEN instead.\n        if (isAjaxRequest(request)) {\n            response.sendError(HttpServletResponse.SC_FORBIDDEN);\n        } else {\n            response.sendError(HttpServletResponse.SC_UNAUTHORIZED);\n        }\n    }\n\n    private boolean authenticate(final HttpServletRequest req) {\n        final String authHead = req.getHeader(\"Authorization\");\n\n        if (authHead != null) {\n            final int index = authHead.indexOf(' ');\n            final String[] credentials = new String(Base64.decodeBase64(authHead.substring(index)),\n                                                    Charsets.UTF_8).split(\":\",\n                                                                          -1);\n\n            try {\n                authenticationService.login(credentials[0],\n                                            credentials[1]);\n                return true;\n            } catch (final FailedAuthenticationException e) {\n                return false;\n            }\n        }\n\n        return false;\n    }\n\n    private boolean isAjaxRequest(HttpServletRequest request) {\n        return request.getHeader(\"X-Requested-With\") != null && \"XMLHttpRequest\".equalsIgnoreCase(request.getHeader(\"X-Requested-With\"));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/CacheHeadersFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport java.util.Calendar;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\npublic class CacheHeadersFilter implements Filter {\n\n    static final String EXPIRES_HEADER = \"Expires\";\n    static final String CACHE_CONTROL_HEADER = \"Cache-Control\";\n    static final String PRAGMA_HEADER = \"Pragma\";\n    static final int YEAR_IN_SECONDS = 365 * 24 * 60 * 60;\n\n    @Override\n    public void init(final FilterConfig filterConfig) throws ServletException {\n    }\n\n    @Override\n    public void destroy() {\n    }\n\n    @Override\n    public void doFilter(final ServletRequest request,\n                         final ServletResponse response,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        final HttpServletRequest httpServletRequest = (HttpServletRequest) request;\n        final HttpServletResponse httpServletResponse = (HttpServletResponse) response;\n        final String requestURI = httpServletRequest.getRequestURI();\n\n        if (requestURI.contains(\".cache.\")) {\n            final Calendar calendar = Calendar.getInstance();\n            calendar.add(Calendar.SECOND,\n                         YEAR_IN_SECONDS);\n\n            httpServletResponse.setHeader(CACHE_CONTROL_HEADER,\n                                          \"max-age=\" + YEAR_IN_SECONDS + \", must-revalidate\");\n            httpServletResponse.setHeader(PRAGMA_HEADER, \"cache\");\n            httpServletResponse.setDateHeader(EXPIRES_HEADER,\n                                              calendar.getTime().getTime());\n        } else if (requestURI.endsWith(\".nocache.js\") || (requestURI.endsWith(\".html\"))) {\n            httpServletResponse.setHeader(CACHE_CONTROL_HEADER,\n                                          \"no-cache, no-store, must-revalidate\");\n            httpServletResponse.setHeader(PRAGMA_HEADER,\n                                          \"no-cache\");\n            httpServletResponse.setDateHeader(EXPIRES_HEADER,\n                                              0);\n        }\n\n        chain.doFilter(request,\n                       response);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/CleanupSecurityCacheSessionListener.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.security.server;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.servlet.annotation.WebListener;\nimport javax.servlet.http.HttpSessionEvent;\nimport javax.servlet.http.HttpSessionListener;\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport static org.jboss.errai.security.shared.api.identity.User.ANONYMOUS;\n\n/**\n * Releases locks on session end and clear authz related caches.\n */\n@WebListener\npublic class CleanupSecurityCacheSessionListener implements HttpSessionListener {\n\n    private final Collection<AuthorizationManager> authorizationManagers = new ArrayList<>();\n\n    public CleanupSecurityCacheSessionListener() {\n        //empty needed for weld\n    }\n\n    @Inject\n    public CleanupSecurityCacheSessionListener(final Instance<AuthorizationManager> authorizationManagers) {\n        for (AuthorizationManager authorizationManager : authorizationManagers) {\n            this.authorizationManagers.add(authorizationManager);\n        }\n    }\n\n    @Override\n    public void sessionCreated(HttpSessionEvent se) {\n    }\n\n    @Override\n    public void sessionDestroyed(HttpSessionEvent se) {\n        if (authorizationManagers.isEmpty()) {\n            return;\n        }\n        final User currentUser = (User) se.getSession().getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME);\n        if (!ANONYMOUS.equals(currentUser)) {\n            for (AuthorizationManager authorizationManager : authorizationManagers) {\n                authorizationManager.invalidate(currentUser);\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/HttpRequestProducer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.RequestScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.servlet.http.HttpServletRequest;\n\n@ApplicationScoped\npublic class HttpRequestProducer {\n\n    @Produces\n    @RequestScoped\n    public HttpServletRequest produceHttpRequest() {\n        return ServletSecurityAuthenticationService.getRequestForThread();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/HttpServletRequestProducerExtension.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.spi.AnnotatedType;\nimport javax.enterprise.inject.spi.BeanManager;\nimport javax.enterprise.inject.spi.Extension;\n\npublic class HttpServletRequestProducerExtension implements Extension {\n\n    private boolean isHttpRequestSupportAvailable = false;\n\n    public HttpServletRequestProducerExtension() {\n        try {\n            Class.forName(\"javax.enterprise.inject.spi.CDI\");\n            isHttpRequestSupportAvailable = true;\n        } catch (ClassNotFoundException e) {\n            isHttpRequestSupportAvailable = false;\n        }\n    }\n\n    <X> void processAnnotatedType(@Observes final javax.enterprise.inject.spi.ProcessAnnotatedType<X> pat,\n                                  BeanManager beanManager) {\n        if (isHttpRequestSupportAvailable) {\n\n            final AnnotatedType<X> annotatedType = pat.getAnnotatedType();\n            final Class<X> javaClass = annotatedType.getJavaClass();\n\n            if (javaClass != null && javaClass.getName().equals(HttpRequestProducer.class.getName())) {\n                pat.veto();\n            }\n        }\n        return;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/LoginRedirectServlet.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport java.io.UnsupportedEncodingException;\nimport java.net.URLEncoder;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * A workaround for the servlet form authentication process (j_security_check), which, at least on WildFly 8.1, uses the\n * HTTP POST method when forwarding the request after successful login. This blows up after login, giving an\n * <code>HTTP 405 Method Not Allowed</code> response when the desired resource is a static one, such as a GWT host page.\n * <p>\n * This servlet works around the issue by sending an HTTP redirect <i>only if the request comes from an authenticated\n * user</i> to a URL of your choice. The end result is that your user will see the real resource's URL in their\n * browser's location bar after login. In addition, this servlet copies all request parameters that were submitted along\n * with the login form (except j_username and j_password) to the redirect URL.\n * <p>\n * To set this servlet up, configure your web application as follows:\n * <ul>\n * <li>Declare this servlet in web.xml with init-param <code>display-after-login</code> set to the context-relative URI\n * of the page you want the user to land on after a successful login. (for example, <code>/host_page.html</code>)\n * <li>Map this servlet to a url-pattern that makes sense for a sign-in page, such as <code>/login</code>.\n * <li>Mark this servlet's url-pattern with a security-constraint that only allows logged-in users to see it. (I know,\n * this part is confusing! The login URL has to be a protected resource!)\n * <li>Configure web.xml for auth-method <code>FORM</code>\n * <li>Configure the form-login-page and form-error-page to any resource you like. It can even be JSP's under /WEB-INF,\n * since the login and error pages will never display under their \"own\" URLs. They always display in place of the \"real\"\n * resource that was being requested by an unauthorized user. In our case, that resource should always be whatever this\n * servlet is mapped to (eg. <code>/login</code>).\n * <li>(Optional) set welcome-page-uri to this servlet's uri-pattern, as an easy way to direct new visitors into this\n * tangled web of deceit.\n * </ul>\n */\npublic class LoginRedirectServlet extends HttpServlet {\n\n    public static final String DISPLAY_AFTER_LOGIN_INIT_PARAM = \"display-after-login\";\n    public static final String DISPLAY_WHEN_NOT_AUTH_INIT_PARAM = \"display-when-not-authenticated\";\n    private static final Logger logger = LoggerFactory.getLogger(LoginRedirectServlet.class);\n    /**\n     * URI of the GWT host page, relative to the servlet container root (so it starts with '/' and includes the context\n     * path).\n     */\n    private String displayAfterLoginUri;\n    /**\n     * Optional URI of a page to redirect in case coming request is not authenticated (no user principal exists),\n     * relative to the servlet container root (so it starts with '/' and does not include context path)\n     */\n    private String displayWhenNotAuthenticatedUri;\n\n    /**\n     * Extracts all parameters except the username and password into a URL-encoded query string. The string does not begin\n     * or end with a \"&amp;\".\n     */\n    @SuppressWarnings(\"unchecked\")\n    private static String extractParameters(HttpServletRequest fromRequest) {\n        try {\n            StringBuilder sb = new StringBuilder();\n            for (Map.Entry<String, String[]> param : (Set<Map.Entry<String, String[]>>) fromRequest.getParameterMap().entrySet()) {\n                String paramName = URLEncoder.encode(param.getKey(),\n                                                     \"UTF-8\");\n                if (paramName.equals(\"j_username\") || paramName.equals(\"j_password\")) {\n                    continue;\n                }\n                for (String value : param.getValue()) {\n                    if (sb.length() != 0) {\n                        sb.append(\"&\");\n                    }\n                    sb.append(paramName).append(\"=\").append(URLEncoder.encode(value,\n                                                                              \"UTF-8\"));\n                }\n            }\n            return sb.toString();\n        } catch (UnsupportedEncodingException e) {\n            throw new AssertionError(\"UTF-8 not supported on this JVM?\");\n        }\n    }\n\n    @Override\n    public void init(ServletConfig config) throws ServletException {\n        String contextRelativeHostPageUri = config.getInitParameter(DISPLAY_AFTER_LOGIN_INIT_PARAM);\n        if (contextRelativeHostPageUri == null) {\n            throw new IllegalStateException(getClass().getSimpleName() + \" requires that you set the init parameter \\\"\"\n                                                    + DISPLAY_AFTER_LOGIN_INIT_PARAM + \"\\\" to the context-relative URI of the host page.\");\n        }\n        displayAfterLoginUri = config.getServletContext().getContextPath() + contextRelativeHostPageUri;\n\n        // optional display-when-not-authenticated\n        String contextRelativeNotAuthPageUri = config.getInitParameter(DISPLAY_WHEN_NOT_AUTH_INIT_PARAM);\n        if (contextRelativeNotAuthPageUri != null) {\n            displayWhenNotAuthenticatedUri = config.getServletContext().getContextPath() + contextRelativeNotAuthPageUri;\n        }\n    }\n\n    @Override\n    protected void doGet(HttpServletRequest req,\n                         HttpServletResponse resp) throws ServletException, IOException {\n        doPost(req,\n               resp);\n    }\n\n    @Override\n    protected void doPost(HttpServletRequest req,\n                          HttpServletResponse resp) throws ServletException, IOException {\n        // perform optional check and redirect in case no authenticated request is available\n        if (displayWhenNotAuthenticatedUri != null && req.getUserPrincipal() == null) {\n            logger.debug(\"No authorized user thus cleaning up session and redirecting to \" + displayWhenNotAuthenticatedUri);\n            try {\n                // clean up session\n                req.logout();\n                req.getSession().invalidate();\n            } catch (Exception e) {\n                // to avoid cases where logout causes issues for first request\n            }\n            resp.sendRedirect(displayWhenNotAuthenticatedUri);\n\n            return;\n        }\n\n        logger.debug(\"Redirecting \" + req.getUserPrincipal() + \" to \" + displayAfterLoginUri);\n        StringBuilder redirectTarget = new StringBuilder(displayAfterLoginUri);\n        String extraParams = extractParameters(req);\n        if (extraParams.length() > 0) {\n            redirectTarget.append(\"?\").append(extraParams);\n        }\n\n        resp.sendRedirect(redirectTarget.toString());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/SecureHeadersConfig.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport javax.servlet.FilterConfig;\n\n/**\n * HTTP headers related to security\n * For example: HSTS and Clickjacking mitigation support\n * <p>\n * Note: This implementation has been borrowed from Aerogear Security.\n */\npublic class SecureHeadersConfig {\n\n    private final Long maxAge;\n    private final Boolean includeSubDomains;\n    private final String location;\n    private final String frameOptions;\n    private final String xssOptions;\n\n    public SecureHeadersConfig(final FilterConfig config) {\n        final String _maxAge = config.getInitParameter(\"max-age\");\n        if (_maxAge != null) {\n            this.maxAge = Long.valueOf(_maxAge);\n        } else {\n            this.maxAge = null;\n        }\n        final String _includeSubDomains = config.getInitParameter(\"include-subdomains\");\n        if (_includeSubDomains != null) {\n            this.includeSubDomains = Boolean.valueOf(_includeSubDomains);\n        } else {\n            this.includeSubDomains = false;\n        }\n        this.location = config.getInitParameter(\"Location\");\n        this.frameOptions = config.getInitParameter(\"x-frame-options\");\n        final String _xssOptionsEnable = config.getInitParameter(\"x-xss-protection-enable\");\n        final String _xssOptionsBlock = config.getInitParameter(\"x-xss-protection-block\");\n        String _xssOptions;\n        if (_xssOptionsEnable == null) {\n            xssOptions = null;\n        } else {\n            if (toBoolean(_xssOptionsEnable,\n                          false)) {\n                _xssOptions = \"1\";\n            } else {\n                _xssOptions = \"0\";\n            }\n\n            if (toBoolean(_xssOptionsBlock,\n                          false)) {\n                _xssOptions += \"; mode=block\";\n            }\n            xssOptions = _xssOptions;\n        }\n    }\n\n    private boolean toBoolean(final String value,\n                              final boolean defaultValue) {\n        try {\n            return Boolean.valueOf(value);\n        } catch (Exception ex) {\n            return defaultValue;\n        }\n    }\n\n    /**\n     * Specifies the number of seconds, after the reception of the STS header field\n     * @return max-age directive\n     * @see <a href=\"https://tools.ietf.org/html/rfc6797#section-6.1.1\">The max-age Directive</a>\n     */\n    public String getMaxAge() {\n        final StringBuilder header = new StringBuilder(\"max-age=\" + maxAge);\n        if (includeSubDomains) {\n            header.append(\"; includeSubdomains\");\n        }\n        return header.toString();\n    }\n\n    /**\n     * Retrieve the Location header\n     * @return Location header field value\n     * @see <a href=\"https://tools.ietf.org/html/rfc6797#section-7.2\">HTTP Request Type</a>\n     */\n    public String getLocation() {\n        return location;\n    }\n\n    /**\n     * Allows a secure web page from host B to declare\n     * that its content (for example a button, links, text, etc.) must not\n     * be displayed in a frame (<frame> or <iframe>) of another page (e.g.\n     * from host A).  In principle this is done by a policy declared in the\n     * HTTP header and enforced by conforming browser implementations\n     * @return X-Frame-Options HTTP header field\n     * @see <a href=\"https://tools.ietf.org/html/draft-ietf-websec-x-frame-options-02#section-1\"> X-Frame-Options</a>\n     */\n    public String getFrameOptions() {\n        return frameOptions;\n    }\n\n    /**\n     * Verify if the option \"max-age\" is present\n     * @return boolean\n     */\n    public boolean hasMaxAge() {\n        return maxAge != null && maxAge >= 0;\n    }\n\n    /**\n     * Verify if the option \"Location\" is present\n     * @return boolean\n     */\n    public boolean hasLocation() {\n        return isEmpty(location);\n    }\n\n    /**\n     * Verify if \"x-frame-options\" is present\n     * @return boolean\n     */\n    public boolean hasFrameOptions() {\n        return isEmpty(frameOptions);\n    }\n\n    /**\n     * Verify if \"x-xss-protection\" is present\n     * @return boolean\n     */\n    public boolean hasXSSOptions() {\n        return isEmpty(xssOptions);\n    }\n\n    public String getXssOptions() {\n        return xssOptions;\n    }\n\n    private boolean isEmpty(final String value) {\n        return value != null && !value.trim().isEmpty();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/SecureHeadersFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n/**\n * HSTS servlet filter\n * For a detailed explanation please take a look at <a href=\"http://aerogear.org/docs/guides/aerogear-security/\">http://aerogear.org/docs/guides/aerogear-security/</a>\n * <p>\n * Note: This implementation has been borrowed from Aerogear Security.\n */\npublic class SecureHeadersFilter implements Filter {\n\n    public static final String LOCATION = \"Location\";\n    public static final String STRICT_TRANSPORT_SECURITY = \"Strict-Transport-Security\";\n    public static final String X_FRAME_OPTIONS = \"X-FRAME-OPTIONS\";\n    public static final String X_XSS_OPTIONS = \"X-XSS-Protection\";\n\n    private static SecureHeadersConfig config;\n\n    public static void applyHeaders(final ServletRequest request,\n                                    final HttpServletResponse response) {\n        if (config != null) {\n            addLocation(response);\n            addFrameOptions(response);\n            addXSSOptions(response);\n\n            if (request.getScheme().equals(\"https\")) {\n                addStrictTransportSecurity(response);\n            }\n        }\n    }\n\n    private static void addStrictTransportSecurity(HttpServletResponse response) {\n        if (config.hasMaxAge() && empty(response.getHeader(STRICT_TRANSPORT_SECURITY))) {\n            response.addHeader(STRICT_TRANSPORT_SECURITY,\n                               config.getMaxAge());\n        }\n    }\n\n    private static void addFrameOptions(HttpServletResponse response) {\n        if (config.hasFrameOptions() && empty(response.getHeader(X_FRAME_OPTIONS))) {\n            response.addHeader(X_FRAME_OPTIONS,\n                               config.getFrameOptions());\n        }\n    }\n\n    private static void addLocation(HttpServletResponse response) {\n        if (config.hasLocation() && empty(response.getHeader(LOCATION))) {\n            response.addHeader(LOCATION,\n                               config.getLocation());\n            response.setStatus(HttpServletResponse.SC_MOVED_PERMANENTLY);\n        }\n    }\n\n    private static void addXSSOptions(HttpServletResponse response) {\n        if (config.hasXSSOptions() && empty(response.getHeader(X_XSS_OPTIONS))) {\n            response.addHeader(X_XSS_OPTIONS,\n                               config.getXssOptions());\n        }\n    }\n\n    private static boolean empty(final String content) {\n        return content == null || content.trim().isEmpty();\n    }\n\n    @Override\n    public void init(final FilterConfig filterConfig) throws ServletException {\n        config = new SecureHeadersConfig(filterConfig);\n    }\n\n    @Override\n    public void destroy() {\n    }\n\n    @Override\n    public void doFilter(final ServletRequest servletRequest,\n                         final ServletResponse servletResponse,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        final HttpServletResponse response = (HttpServletResponse) servletResponse;\n        final HttpServletRequest request = (HttpServletRequest) servletRequest;\n\n        applyHeaders(request,\n                     response);\n\n        chain.doFilter(request,\n                       response);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/SecurityIntegrationFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.uberfire.backend.server.security.RoleRegistry;\n\npublic class SecurityIntegrationFilter implements Filter {\n\n    public static final String PROBE_ROLES_INIT_PARAM = \"probe-for-roles\";\n\n    static final ThreadLocal<HttpServletRequest> requests = new ThreadLocal<HttpServletRequest>();\n\n    /**\n     * Returns the current servlet request that this thread is handling, or null if this thread is not currently handling\n     * a servlet request.\n     */\n    public static HttpServletRequest getRequest() {\n        return requests.get();\n    }\n\n    @Override\n    public void init(FilterConfig filterConfig) throws ServletException {\n        MappingContextSingleton.get();\n\n        String commaSeparatedRoles = filterConfig.getInitParameter(PROBE_ROLES_INIT_PARAM);\n        if (commaSeparatedRoles != null) {\n            for (final String role : Collections.unmodifiableList(Arrays.asList(commaSeparatedRoles.split(\",\")))) {\n                RoleRegistry.get().registerRole(role);\n            }\n        }\n    }\n\n    @Override\n    public void destroy() {\n        // no op\n    }\n\n    @Override\n    public void doFilter(ServletRequest request,\n                         ServletResponse response,\n                         FilterChain chain) throws IOException, ServletException {\n        requests.set((HttpServletRequest) request);\n        try {\n            chain.doFilter(request,\n                           response);\n        } finally {\n            requests.remove();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/ServletSecurityAuthenticationService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.security.server;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpSession;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.backend.server.security.RoleRegistry;\nimport org.uberfire.backend.server.security.adapter.GroupAdapterAuthorizationSource;\nimport org.wildfly.security.auth.server.SecurityDomain;\n\n@Service\n@ApplicationScoped\npublic class ServletSecurityAuthenticationService extends GroupAdapterAuthorizationSource implements AuthenticationService {\n\n    static final String USER_SESSION_ATTR_NAME = \"uf.security.user\";\n\n    public ServletSecurityAuthenticationService() {\n        // For CDI\n    }\n\n    protected static HttpServletRequest getRequestForThread() {\n        HttpServletRequest request = SecurityIntegrationFilter.getRequest();\n        if (request == null) {\n            throw new IllegalStateException(\"This service only works from threads that are handling HTTP servlet requests\");\n        }\n        return request;\n    }\n\n    @Override\n    public User login(String username,\n                      String password) {\n        final HttpServletRequest request = getRequestForThread();\n\n        try {\n            request.login(username,\n                          password);\n            return getUser();\n        } catch (final ServletException e) {\n            throw new FailedAuthenticationException(\"Failed to authenticate user \" + username,\n                                                    e);\n        }\n    }\n\n    @Override\n    public boolean isLoggedIn() {\n        HttpServletRequest request = getRequestForThread();\n        return request.getUserPrincipal() != null;\n    }\n\n    @Override\n    public void logout() {\n        HttpServletRequest request = getRequestForThread();\n        try {\n            request.logout();\n        } catch (Exception e) {\n\n        }\n        HttpSession session = request.getSession(false);\n        if (session != null) {\n            // The try/catch is an ugly hack for EAP 7.0.x with Keycloak (or RH-SSO) adapter.\n            // Undertow (1.4.6-) will return what it appears to be a valid session (session != null), but in fact it\n            // was already invalidated by the Keycloak adapter during the request.logout() call.\n            // See https://issues.jboss.org/browse/RHBPMS-4574\n            try {\n                session.invalidate();\n            } catch (IllegalStateException ise) {\n                // Make sure we catch only the intended exception thrown by Undertow. Re-throw any other exception\n                String exceptionMessage = ise.getMessage();\n                if (exceptionMessage == null || !exceptionMessage.contains(\"UT000021\")) {\n                    throw ise;\n                }\n            }\n        }\n    }\n\n    @Override\n    public User getUser() {\n        HttpServletRequest request = getRequestForThread();\n\n        if (request.getUserPrincipal() == null) {\n            return null;\n        }\n        User user = null;\n        final HttpSession session = request.getSession();\n        if (session != null) {\n            user = (User) session.getAttribute(USER_SESSION_ATTR_NAME);\n            if (user == null) {\n                // Use roles present in the registry.\n                final Collection<Role> userRoles = new HashSet<>();\n                for (final Role checkRole : RoleRegistry.get().getRegisteredRoles()) {\n                    if (request.isUserInRole(checkRole.getName())) {\n                        userRoles.add(checkRole);\n                    }\n                }\n                // Obtain roles and groups from entities present in the javax security Principal instance.\n                final String name = request.getUserPrincipal().getName();\n                final List<String> principals = getPrincipals();\n                final Collection<Role> roles = getRoles(principals);\n                if (null != roles && !roles.isEmpty()) {\n                    userRoles.addAll(roles);\n                }\n                final Collection<org.jboss.errai.security.shared.api.Group> userGroups = getGroups(principals, name);\n                // Create the user instance.\n                user = new UserImpl(name,\n                                    userRoles,\n                                    userGroups);\n                session.setAttribute(USER_SESSION_ATTR_NAME,\n                                     user);\n            }\n        }\n\n        return user;\n    }\n\n    protected List<String> getPrincipals() {\n        final List<String> result = new ArrayList<>();\n        final SecurityDomain securityDomain = SecurityDomain.getCurrent();\n        if (securityDomain != null) {\n            for (String role : securityDomain.getCurrentSecurityIdentity().getRoles()) {\n                result.add(role);\n            }\n        }\n        return result;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/XSSServletFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n/**\n * Note: This implementation has been borrowed from Aerogear Security.\n */\npublic class XSSServletFilter implements Filter {\n\n    @Override\n    public void init(FilterConfig config) throws ServletException {\n    }\n\n    @Override\n    public void doFilter(final ServletRequest servletRequest,\n                         final ServletResponse servletResponse,\n                         final FilterChain filterChain) throws IOException, ServletException {\n        final HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest;\n        final HttpServletResponse httpServletResponse = (HttpServletResponse) servletResponse;\n\n        filterChain.doFilter(new XSSServletRequestWrapper(httpServletRequest),\n                             httpServletResponse);\n    }\n\n    @Override\n    public void destroy() {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/XSSServletRequestWrapper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletRequestWrapper;\n\nimport org.apache.commons.lang3.StringEscapeUtils;\n\n/**\n * Note: This implementation has been borrowed from Aerogear Security.\n */\npublic class XSSServletRequestWrapper extends HttpServletRequestWrapper {\n\n    public XSSServletRequestWrapper(final HttpServletRequest request) {\n        super(request);\n    }\n\n    @Override\n    public String[] getParameterValues(final String param) {\n        final String[] values = super.getParameterValues(param);\n\n        for (int i = 0; i < values.length; i++) {\n            values[i] = StringEscapeUtils.escapeHtml4(values[i]);\n        }\n\n        return values;\n    }\n\n    @Override\n    public String getParameter(final String param) {\n        return StringEscapeUtils.escapeHtml4(super.getParameter(param));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/java/org/uberfire/ext/security/server/io/IOSecurityService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server.io;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.backend.server.security.FileSystemResourceAdaptor;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static java.util.Arrays.asList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class IOSecurityService implements IOService {\n\n    private final IOService service;\n    private final AuthenticationService authenticationService;\n    private final AuthorizationManager authManager;\n\n    public IOSecurityService(final IOService service,\n                             final AuthenticationService authenticationService,\n                             final AuthorizationManager authManager) {\n        this.authManager = checkNotNull(\"authManager\",\n                                        authManager);\n        this.service = checkNotNull(\"service\",\n                                    service);\n        this.authenticationService = checkNotNull(\"provider\",\n                                                  authenticationService);\n        PriorityDisposableRegistry.register(this);\n    }\n\n    @Override\n    public void dispose() {\n    }\n\n    @Override\n    public int priority() {\n        return service.priority() + 1;\n    }\n\n    @Override\n    public void startBatch(FileSystem fs) {\n        if (!authManager.authorize(toResource(fs),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        service.startBatch(fs);\n    }\n\n    @Override\n    public void startBatch(FileSystem fs,\n                           Option... options) {\n        if (!authManager.authorize(toResource(fs),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        service.startBatch(fs,\n                           options);\n    }\n\n    @Override\n    public void endBatch() {\n        service.endBatch();\n    }\n\n    @Override\n    public FileAttribute<?>[] convert(Map<String, ?> attrs) {\n        return service.convert(attrs);\n    }\n\n    @Override\n    public Path get(String first,\n                    String... more) throws IllegalArgumentException {\n        final Path result = service.get(first,\n                                        more);\n        if (!authManager.authorize(toResource(result),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return result;\n    }\n\n    @Override\n    public Path get(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        final Path result = service.get(uri);\n        if (!authManager.authorize(toResource(result),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return result;\n    }\n\n    @Override\n    public Iterable<FileSystemMetadata> getFileSystemMetadata() {\n        final Iterable<FileSystemMetadata> _result = service.getFileSystemMetadata();\n        final Set<FileSystemMetadata> result = new HashSet<>();\n        for (final FileSystemMetadata fs : _result) {\n            if (authManager.authorize(toResource(fs),\n                                      getUser())) {\n                result.add(fs);\n            }\n        }\n\n        return result;\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, ProviderNotFoundException, SecurityException {\n        final FileSystem result = service.getFileSystem(uri);\n        if (!authManager.authorize(toResource(new FileSystemMetadata(result)),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return result;\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri,\n                                    Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {\n        final FileSystem fs = service.newFileSystem(uri,\n                                                    env);\n        if (!authManager.authorize(toResource(fs),\n                                   getUser())) {\n            service.delete(fs.getPath(null));\n            throw new SecurityException();\n        }\n        return fs;\n    }\n\n    @Override\n    public void onNewFileSystem(NewFileSystemListener listener) {\n        service.onNewFileSystem(listener);\n    }\n\n    @Override\n    public InputStream newInputStream(Path path,\n                                      OpenOption... options) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newInputStream(path,\n                                      options);\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path,\n                                        OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newOutputStream(path,\n                                       options);\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newByteChannel(path,\n                                      options);\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> options,\n                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newByteChannel(path,\n                                      options,\n                                      attrs);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newDirectoryStream(dir);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir,\n                                                    DirectoryStream.Filter<Path> filter) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newDirectoryStream(dir,\n                                          filter);\n    }\n\n    @Override\n    public Path createFile(Path path,\n                           FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createFile(path,\n                                  attrs);\n    }\n\n    @Override\n    public Path createDirectory(Path dir,\n                                FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createFile(dir,\n                                  attrs);\n    }\n\n    @Override\n    public Path createDirectories(Path dir,\n                                  FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createDirectories(dir,\n                                         attrs);\n    }\n\n    @Override\n    public Path createDirectory(Path dir,\n                                Map<String, ?> attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createDirectory(dir,\n                                       attrs);\n    }\n\n    @Override\n    public Path createDirectories(Path dir,\n                                  Map<String, ?> attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createDirectories(dir,\n                                         attrs);\n    }\n\n    @Override\n    public void delete(Path path,\n                       DeleteOption... options) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        service.delete(path,\n                       options);\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... options) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.deleteIfExists(path,\n                                      options);\n    }\n\n    @Override\n    public Path createTempFile(String prefix,\n                               String suffix,\n                               FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return service.createTempFile(prefix,\n                                      suffix,\n                                      attrs);\n    }\n\n    @Override\n    public Path createTempFile(Path dir,\n                               String prefix,\n                               String suffix,\n                               FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createTempFile(dir,\n                                      prefix,\n                                      suffix,\n                                      attrs);\n    }\n\n    @Override\n    public Path createTempDirectory(String prefix,\n                                    FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return service.createTempDirectory(prefix,\n                                           attrs);\n    }\n\n    @Override\n    public Path createTempDirectory(Path dir,\n                                    String prefix,\n                                    FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(dir),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.createTempDirectory(dir,\n                                           prefix,\n                                           attrs);\n    }\n\n    @Override\n    public Path copy(Path source,\n                     Path target,\n                     CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(source),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        if (!authManager.authorize(toResource(target),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.copy(source,\n                            target,\n                            options);\n    }\n\n    @Override\n    public Path move(Path source,\n                     Path target,\n                     CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(source),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        if (!authManager.authorize(toResource(target),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.move(source,\n                            target,\n                            options);\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                                Class<V> type) throws IllegalArgumentException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.getFileAttributeView(path,\n                                            type);\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAttributes(path);\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path,\n                                              String attributes) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAttributes(path,\n                                      attributes);\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              FileAttribute<?>... attrs) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.setAttributes(path,\n                                     attrs);\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              Map<String, Object> attrs) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.setAttributes(path,\n                                     attrs);\n    }\n\n    @Override\n    public Path setAttribute(Path path,\n                             String attribute,\n                             Object value) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.setAttribute(path,\n                                    attribute,\n                                    value);\n    }\n\n    @Override\n    public Object getAttribute(Path path,\n                               String attribute) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.getAttribute(path,\n                                    attribute);\n    }\n\n    @Override\n    public FileTime getLastModifiedTime(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.getLastModifiedTime(path);\n    }\n\n    @Override\n    public long size(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.size(path);\n    }\n\n    @Override\n    public boolean exists(Path path) throws IllegalArgumentException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.exists(path);\n    }\n\n    @Override\n    public boolean notExists(Path path) throws IllegalArgumentException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.notExists(path);\n    }\n\n    @Override\n    public boolean isSameFile(Path path,\n                              Path path2) throws IllegalArgumentException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        if (!authManager.authorize(toResource(path2),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.isSameFile(path,\n                                  path2);\n    }\n\n    @Override\n    public BufferedReader newBufferedReader(Path path,\n                                            Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newBufferedReader(path,\n                                         cs);\n    }\n\n    @Override\n    public BufferedWriter newBufferedWriter(Path path,\n                                            Charset cs,\n                                            OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.newBufferedWriter(path,\n                                         cs,\n                                         options);\n    }\n\n    @Override\n    public long copy(InputStream in,\n                     Path target,\n                     CopyOption... options) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {\n        if (!authManager.authorize(toResource(target),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.copy(in,\n                            target,\n                            options);\n    }\n\n    @Override\n    public long copy(Path source,\n                     OutputStream out) throws IOException, SecurityException {\n        if (!authManager.authorize(toResource(source),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.copy(source,\n                            out);\n    }\n\n    @Override\n    public byte[] readAllBytes(Path path) throws IOException, OutOfMemoryError, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAllBytes(path);\n    }\n\n    @Override\n    public List<String> readAllLines(Path path) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAllLines(path);\n    }\n\n    @Override\n    public List<String> readAllLines(Path path,\n                                     Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAllLines(path,\n                                    cs);\n    }\n\n    @Override\n    public String readAllString(Path path,\n                                Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAllString(path,\n                                     cs);\n    }\n\n    @Override\n    public String readAllString(Path path) throws IllegalArgumentException, NoSuchFileException, IOException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.readAllString(path);\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             bytes);\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             bytes,\n                             attrs,\n                             options);\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             bytes,\n                             options,\n                             attrs);\n    }\n\n    @Override\n    public Path write(Path path,\n                      Iterable<? extends CharSequence> lines,\n                      Charset cs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             lines,\n                             cs,\n                             options);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             options);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             cs,\n                             options);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             options,\n                             attrs);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             cs,\n                             options,\n                             attrs);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             attrs,\n                             options);\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        if (!authManager.authorize(toResource(path),\n                                   getUser())) {\n            throw new SecurityException();\n        }\n        return service.write(path,\n                             content,\n                             cs,\n                             attrs,\n                             options);\n    }\n\n    private Resource toResource(final FileSystem fs) {\n        return new FileSystemResourceAdaptor(new FileSystemMetadata(fs));\n    }\n\n    private Resource toResource(final FileSystemMetadata fs) {\n        return new FileSystemResourceAdaptor(fs);\n    }\n\n    private Resource toResource(final Path path) {\n        return new FileSystemResourceAdaptor(new FileSystemMetadata(path.getFileSystem()));\n    }\n\n    private User getUser() {\n        try {\n            return authenticationService.getUser();\n        } catch (final IllegalStateException ex) {\n            return new UserImpl(\"system\",\n                                asList(new RoleImpl(\"admin\")));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension",
    "content": "org.uberfire.ext.security.server.HttpServletRequestProducerExtension\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/BasicAuthSecurityFilterTest.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.io.IOException;\n\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport org.apache.commons.codec.binary.Base64;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class BasicAuthSecurityFilterTest {\n\n    @Mock\n    private HttpServletRequest request;\n\n    @Mock\n    private HttpServletResponse response;\n\n    @Mock\n    private FilterChain chain;\n\n    @Mock\n    private AuthenticationService authenticationService;\n\n    @Mock\n    private HttpSession httpSession;\n\n    @Test\n    public void excludedPathsWithNonEmptyContextSkipsAuthentication() throws IOException, ServletException {\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n\n        final FilterConfig config = mock(FilterConfig.class);\n        when(config.getInitParameter(BasicAuthSecurityFilter.EXCEPTION_PATHS)).thenReturn(\"/test/foo\");\n        filter.init(config);\n\n        when(request.getRequestURI()).thenReturn(\"/my-context/test/foo\");\n        when(request.getContextPath()).thenReturn(\"/my-context\");\n        filter.doFilter(request,response, chain);\n\n        verify(chain).doFilter(request, response);\n        verify(request, never()).getSession(anyBoolean());\n    }\n\n    @Test\n    public void excludedPathsWithEmptyPathSkipsAuthentication() throws IOException, ServletException {\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n\n        final FilterConfig config = mock(FilterConfig.class);\n        when(config.getInitParameter(BasicAuthSecurityFilter.EXCEPTION_PATHS)).thenReturn(\"/test/foo,,\");\n        filter.init(config);\n\n        when(request.getRequestURI()).thenReturn(\"/test/foo\");\n        when(request.getContextPath()).thenReturn(\"\");\n        filter.doFilter(request,response, chain);\n\n        verify(chain).doFilter(request, response);\n        verify(request, never()).getSession(anyBoolean());\n    }\n\n    @Test\n    public void excludedPathSkipsAuthentication() throws IOException, ServletException {\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n\n        final FilterConfig config = mock(FilterConfig.class);\n        when(config.getInitParameter(BasicAuthSecurityFilter.EXCEPTION_PATHS)).thenReturn(\"/test/foo,/test/bar\");\n        filter.init(config);\n\n        when(request.getRequestURI()).thenReturn(\"/test/foo\");\n        when(request.getContextPath()).thenReturn(\"\");\n        filter.doFilter(request,response, chain);\n\n        verify(chain).doFilter(request, response);\n        verify(request, never()).getSession(anyBoolean());\n    }\n\n    @Test\n    public void excludedPathWithTrailingSlashSkipsAuthentication() throws IOException, ServletException {\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n\n        final FilterConfig config = mock(FilterConfig.class);\n        when(config.getInitParameter(BasicAuthSecurityFilter.EXCEPTION_PATHS)).thenReturn(\"/test/foo,/test/bar\");\n        filter.init(config);\n\n        when(request.getRequestURI()).thenReturn(\"/test/bar/\");\n        when(request.getContextPath()).thenReturn(\"\");\n        filter.doFilter(request,response, chain);\n\n        verify(chain).doFilter(request, response);\n        verify(request, never()).getSession(anyBoolean());\n    }\n\n    @Test\n    public void testIndependentSessionInvalidated() throws Exception {\n\n        SessionProvider sessionProvider = new SessionProvider(httpSession,\n                                                              1);\n\n        when(authenticationService.getUser()).thenReturn(new UserImpl(\"testUser\"));\n        when(request.getSession(anyBoolean())).then((InvocationOnMock invocationOnMock) -> sessionProvider.provideSession());\n\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n        filter.authenticationService = authenticationService;\n        filter.doFilter(request,\n                        response,\n                        chain);\n\n        verify(httpSession,\n               times(1)).invalidate();\n    }\n\n    @Test\n    public void testExistingSessionNotInvalidated() throws Exception {\n\n        SessionProvider sessionProvider = new SessionProvider(httpSession);\n\n        when(authenticationService.getUser()).thenReturn(new UserImpl(\"testUser\"));\n        when(request.getSession(anyBoolean())).then((InvocationOnMock invocationOnMock) -> sessionProvider.provideSession());\n\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n        filter.authenticationService = authenticationService;\n        filter.doFilter(request,\n                        response,\n                        chain);\n\n        verify(httpSession,\n               never()).invalidate();\n    }\n\n    @Test\n    public void testNotInvalidateSession() throws Exception {\n\n        SessionProvider sessionProvider = new SessionProvider(httpSession,\n                                                              1);\n\n        when(authenticationService.getUser()).thenReturn(new UserImpl(\"testUser\"));\n        when(request.getSession(anyBoolean())).then((InvocationOnMock invocationOnMock) -> sessionProvider.provideSession());\n\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n        final FilterConfig config = mock(FilterConfig.class);\n        when(config.getInitParameter(BasicAuthSecurityFilter.INVALIDATE_PARAM)).thenReturn(\"false\");\n        filter.init(config);\n        filter.authenticationService = authenticationService;\n        filter.doFilter(request,\n                        response,\n                        chain);\n\n        verify(httpSession,\n               never()).invalidate();\n    }\n\n    @Test\n    public void testEmptyPassword() throws Exception {\n\n        String username = \"fakeUser\";\n        String password = \"\";\n\n        String authData = username + \":\" + password;\n        String authEncoded = Base64.encodeBase64String(authData.getBytes());\n\n        when(request.getHeader(\"Authorization\")).thenReturn(\"Basic \" + authEncoded);\n\n        final BasicAuthSecurityFilter filter = new BasicAuthSecurityFilter();\n        filter.authenticationService = authenticationService;\n        filter.doFilter(request,\n                        response,\n                        chain);\n\n        verify(authenticationService,\n               times(1)).login(username,\n                               password);\n    }\n\n    private class SessionProvider {\n\n        private int counter = 0;\n        private HttpSession httpSession;\n\n        public SessionProvider(HttpSession httpSession) {\n            this.httpSession = httpSession;\n        }\n\n        public SessionProvider(HttpSession httpSession,\n                               int counter) {\n            this.httpSession = httpSession;\n            this.counter = counter;\n        }\n\n        public HttpSession provideSession() {\n            if (counter == 0) {\n                return httpSession;\n            }\n            counter--;\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/CacheHeadersFilterTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.util.Calendar;\nimport javax.servlet.FilterChain;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.ext.security.server.CacheHeadersFilter.CACHE_CONTROL_HEADER;\nimport static org.uberfire.ext.security.server.CacheHeadersFilter.EXPIRES_HEADER;\nimport static org.uberfire.ext.security.server.CacheHeadersFilter.PRAGMA_HEADER;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CacheHeadersFilterTest {\n\n    @Mock\n    private HttpServletRequest request;\n\n    @Mock\n    private HttpServletResponse response;\n\n    @Mock\n    private FilterChain chain;\n\n    @Test\n    public void cacheFilesWithCacheExtension() throws Exception {\n        when(request.getRequestURI()).thenReturn(\"/app/hash.cache.js\");\n\n        final CacheHeadersFilter filter = new CacheHeadersFilter();\n        filter.doFilter(request,\n                        response,\n                        chain);\n        verify(response).setHeader(CACHE_CONTROL_HEADER,\n                                   \"max-age=31536000, must-revalidate\");\n\n        ArgumentCaptor<String> expiresHeader = ArgumentCaptor.forClass(String.class);\n        ArgumentCaptor<Long> expiresValue = ArgumentCaptor.forClass(Long.class);\n        verify(response).setDateHeader(expiresHeader.capture(),\n                                       expiresValue.capture());\n        assertEquals(EXPIRES_HEADER,\n                     expiresHeader.getValue());\n\n        final Calendar expiryDate = Calendar.getInstance();\n        expiryDate.setTimeInMillis(expiresValue.getValue());\n        final Calendar now = Calendar.getInstance();\n        long expiryInDays = (expiryDate.getTimeInMillis() - now.getTimeInMillis()) / (1000 * 60 * 60 * 24);\n        assertTrue(expiryInDays >= 364);\n    }\n\n    @Test\n    public void doNotCacheFilesWithNoCacheExtension() throws Exception {\n        when(request.getRequestURI()).thenReturn(\"/app/abc.nocache.js\");\n        verifyNoCache();\n    }\n\n    @Test\n    public void doNotCacheHostPage() throws Exception {\n        when(request.getRequestURI()).thenReturn(\"/host-page.html\");\n        verifyNoCache();\n    }\n\n    private void verifyNoCache() throws Exception {\n        final CacheHeadersFilter filter = new CacheHeadersFilter();\n        filter.doFilter(request,\n                        response,\n                        chain);\n\n        verify(response).setHeader(CACHE_CONTROL_HEADER,\n                                   \"no-cache, no-store, must-revalidate\");\n        verify(response).setDateHeader(EXPIRES_HEADER,\n                                       0);\n        verify(response).setHeader(PRAGMA_HEADER,\n                                   \"no-cache\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/CleanupSecurityCacheSessionListenerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.security.server;\n\nimport javax.enterprise.inject.Instance;\nimport javax.servlet.http.HttpSession;\nimport javax.servlet.http.HttpSessionEvent;\n\nimport com.google.common.collect.ImmutableSet;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static java.util.Arrays.asList;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CleanupSecurityCacheSessionListenerTest {\n\n    @Mock\n    private HttpSessionEvent evt;\n\n    @Mock\n    private HttpSession session;\n\n    @Test\n    public void testSessionCleanup() {\n        final AuthorizationManager authorizationManager1 = mock(AuthorizationManager.class);\n        final AuthorizationManager authorizationManager2 = mock(AuthorizationManager.class);\n\n        final Instance<AuthorizationManager> instances = mock(Instance.class);\n        when(instances.iterator()).thenReturn(asList(authorizationManager1,\n                                                     authorizationManager2).iterator());\n\n        final CleanupSecurityCacheSessionListener listener = new CleanupSecurityCacheSessionListener(instances);\n\n        final User user = new UserImpl(\"user\", ImmutableSet.of(new RoleImpl(\"author\")));\n\n        when(evt.getSession()).thenReturn(session);\n        when(session.getAttribute(ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME)).thenReturn(user);\n\n        listener.sessionDestroyed(evt);\n\n        verify(authorizationManager1, times(1)).invalidate(user);\n        verify(authorizationManager2, times(1)).invalidate(user);\n    }\n\n    @Test\n    public void testSessionCleanupNPE() {\n        final CleanupSecurityCacheSessionListener listener = new CleanupSecurityCacheSessionListener();\n        listener.sessionDestroyed(evt);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/ServletSecurityAuthenticationServiceTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server;\n\nimport java.security.Principal;\nimport java.security.acl.Group;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Enumeration;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.security.auth.Subject;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpSession;\n\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.exception.FailedAuthenticationException;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.server.security.RoleRegistry;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.security.server.ServletSecurityAuthenticationService.USER_SESSION_ATTR_NAME;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ServletSecurityAuthenticationServiceTest {\n\n    private static final String USERNAME = \"user1\";\n    private static final String PASSWORD = \"password1\";\n\n    @Mock\n    private HttpServletRequest request;\n\n    @Mock\n    private HttpSession httpSession;\n\n    private ServletSecurityAuthenticationService tested;\n\n    @Before\n    public void setup() throws Exception {\n\n        Principal p1 = mock(Principal.class);\n        doReturn(USERNAME).when(p1).getName();\n        doReturn(p1).when(request).getUserPrincipal();\n        doReturn(httpSession).when(request).getSession();\n        doReturn(null).when(httpSession).getAttribute(eq(USER_SESSION_ATTR_NAME));\n        when(request.getSession(anyBoolean())).then(new Answer<HttpSession>() {\n            @Override\n            public HttpSession answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return httpSession;\n            }\n        });\n\n        tested = spy(new ServletSecurityAuthenticationService());\n\n        // Set the request in the thread context.\n        SecurityIntegrationFilter.requests.set(request);\n    }\n\n    @Test\n    public void testLoggedIn() {\n        assertTrue(tested.isLoggedIn());\n    }\n\n    @Test\n    public void testNotLoggedIn() {\n        doReturn(null).when(request).getUserPrincipal();\n        assertFalse(tested.isLoggedIn());\n    }\n\n    @Test(expected = FailedAuthenticationException.class)\n    public void testLoginFailure() throws ServletException {\n        doThrow(new ServletException()).when(request).login(\"test\",\"test\");\n        tested.login(\"test\",\"test\");\n    }\n\n    @Test\n    public void testLogin() throws Exception {\n\n        RoleRegistry.get().registerRole(\"admin\");\n        RoleRegistry.get().registerRole(\"role1\");\n        final ArrayList<Object> principals = new ArrayList<>();\n        principals.add(\"admin\");\n        principals.add(\"role1\");\n        principals.add(\"group1\");\n        doReturn(principals).when(tested).getPrincipals();\n\n        User user = tested.login(USERNAME,\n                                 PASSWORD);\n\n        assertNotNull(user);\n        assertEquals(USERNAME,\n                     user.getIdentifier());\n        assertEquals(2,\n                     user.getRoles().size());\n        assertTrue(user.getRoles().contains(new RoleImpl(\"admin\")));\n        assertTrue(user.getRoles().contains(new RoleImpl(\"role1\")));\n        assertEquals(1,\n                     user.getGroups().size());\n        assertTrue(user.getGroups().contains(new GroupImpl(\"group1\")));\n    }\n\n    @Test\n    public void testLoginNoPrincipal() throws Exception {\n\n        doReturn(new ArrayList<>()).when(tested).getPrincipals();\n\n        User user = tested.login(USERNAME,\n                                 PASSWORD);\n\n        assertNotNull(user);\n        assertEquals(USERNAME,\n                     user.getIdentifier());\n        assertEquals(0,\n                     user.getRoles().size());\n        assertEquals(0,\n                     user.getGroups().size());\n    }\n\n    @Test\n    public void testLogout() throws Exception {\n        tested.logout();\n        verify(request,\n               times(1)).logout();\n        verify(httpSession,\n               times(1)).invalidate();\n    }\n\n    @Test\n    public void testLogoutNoSession() throws Exception {\n        doReturn(null).when(request).getSession(false);\n        tested.logout();\n        verify(request,\n               times(1)).logout();\n        verify(httpSession,\n               never()).invalidate();\n    }\n\n    @Test\n    public void testSwallowIllegalStateExceptionDuringLogoutWithKeycloak() {\n        doThrow(new IllegalStateException(\"UT000021: Session already invalidated\")).when(httpSession).invalidate();\n        tested.logout();\n    }\n\n    @Test\n    public void testReThrowUnexpectedIllegalStateExceptionDuringLogout() {\n        String exceptionMsg = \"This exception should be propagated!\";\n        doThrow(new IllegalStateException(exceptionMsg)).when(httpSession).invalidate();\n        try {\n            tested.logout();\n        } catch (IllegalStateException ise) {\n            // the exception message needs to be the same as defined above\n            assertEquals(exceptionMsg, ise.getMessage());\n        }\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testGetRequestForThreadNoRequest() {\n        SecurityIntegrationFilter.requests.set(null);\n        tested.getRequestForThread();\n        SecurityIntegrationFilter.requests.set(request);\n    }\n\n    @Test\n    public void testGetUserNoUserPrincipal() {\n        doReturn(null).when(request).getUserPrincipal();\n        assertNull(tested.getUser());\n    }\n\n    @Test\n    public void testGetUserNoSession() {\n        doReturn(null).when(request).getSession();\n        assertNull(tested.getUser());\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/io/IOServiceSecuritySetupTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server.io;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Test;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.*;\n\nimport java.net.URI;\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class IOServiceSecuritySetupTest {\n\n    @Test\n    public void nonSecureExecuted() {\n        final FileSystem fs = mock(FileSystem.class);\n        final Path rootPath = mock(Path.class);\n\n        when(fs.getRootDirectories()).thenReturn(Arrays.asList(rootPath));\n        when(rootPath.getFileSystem()).thenReturn(fs);\n        when(rootPath.toUri()).thenReturn(URI.create(\"/\"));\n\n        final IOSecurityService service = new IOSecurityService(new MockIOService(),\n                                                                new MockAuthenticationService(),\n                                                                new DummyAuthorizationManager(true));\n\n        assertTrue(PriorityDisposableRegistry.getDisposables().contains(service));\n\n        try {\n            service.startBatch(fs);\n        } catch (Exception e) {\n            e.printStackTrace();\n            fail(\"error\");\n        }\n    }\n\n    @Test\n    public void secureExecuted() {\n        final FileSystem fs = mock(FileSystem.class);\n        final Path rootPath = mock(Path.class);\n        when(rootPath.toUri()).thenReturn(URI.create(\"/\"));\n\n        when(fs.getRootDirectories()).thenReturn(Arrays.asList(rootPath));\n        when(rootPath.getFileSystem()).thenReturn(fs);\n\n        final IOSecurityService service = new IOSecurityService(new MockIOService(),\n                                                                new MockAuthenticationService(),\n                                                                new DummyAuthorizationManager(false));\n\n        try {\n            service.startBatch(fs);\n            fail(\"error\");\n        } catch (SecurityException e) {\n        } catch (Exception e) {\n            fail(\"error\");\n        }\n    }\n\n    class DummyAuthorizationManager implements AuthorizationManager {\n\n        private boolean grant;\n\n        public DummyAuthorizationManager(boolean grant) {\n            this.grant = grant;\n        }\n\n        @Override\n        public boolean authorize(Resource resource,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(Resource resource,\n                                 ResourceAction action,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(ResourceType resourceType,\n                                 ResourceAction action,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(String permission,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(Permission permission,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n            return grant;\n        }\n\n        @Override\n        public ResourceCheck check(Resource resource,\n                                   User user,\n                                   VotingStrategy votingStrategy) {\n            return null;\n        }\n\n        @Override\n        public ResourceCheck check(ResourceType resourceType,\n                                   User user,\n                                   VotingStrategy votingStrategy) {\n            return null;\n        }\n\n        @Override\n        public PermissionCheck check(String permission,\n                                     User user,\n                                     VotingStrategy votingStrategy) {\n            return null;\n        }\n\n        @Override\n        public boolean authorize(Resource resource,\n                                 User user) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(Resource resource,\n                                 ResourceAction action,\n                                 User user) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(ResourceType resourceType,\n                                 ResourceAction action,\n                                 User user) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(String permission,\n                                 User user) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(Permission permission,\n                                 User user) {\n            return grant;\n        }\n\n        @Override\n        public boolean authorize(Resource contributorResource,\n                                 Collection<Contributor> contributors,\n                                 ResourceAction action,\n                                 User user){\n            return grant;\n        }\n\n        @Override\n        public ResourceCheck check(Resource resource,\n                                   User user) {\n            return null;\n        }\n\n        @Override\n        public ResourceCheck check(ResourceType type,\n                                   User user) {\n            return null;\n        }\n\n        @Override\n        public PermissionCheck check(String permission,\n                                     User user) {\n            return null;\n        }\n\n        @Override\n        public void invalidate(User user) {\n\n        }\n    }\n\n    ;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/io/MockAuthenticationService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server.io;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\n\npublic class MockAuthenticationService implements AuthenticationService {\n\n    public static final User FAKE_USER = new UserImpl(\"fake\");\n\n    @Override\n    public User login(String username,\n                      String password) {\n        return FAKE_USER;\n    }\n\n    @Override\n    public boolean isLoggedIn() {\n        return true;\n    }\n\n    @Override\n    public void logout() {\n    }\n\n    @Override\n    public User getUser() {\n        return FAKE_USER;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-security/uberfire-servlet-security/src/test/java/org/uberfire/ext/security/server/io/MockIOService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.security.server.io;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class MockIOService implements IOService {\n\n    @Override\n    public void dispose() {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fs) {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fs,\n                           Option... options) {\n\n    }\n\n    @Override\n    public void endBatch() {\n\n    }\n\n    @Override\n    public FileAttribute<?>[] convert(Map<String, ?> attrs) {\n        return new FileAttribute<?>[0];\n    }\n\n    @Override\n    public Path get(String first,\n                    String... more) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Path get(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Iterable<FileSystemMetadata> getFileSystemMetadata() {\n        return null;\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, ProviderNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri,\n                                    Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void onNewFileSystem(NewFileSystemListener listener) {\n\n    }\n\n    @Override\n    public InputStream newInputStream(Path path,\n                                      OpenOption... options) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path,\n                                        OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              OpenOption... options) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> options,\n                                              FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path dir,\n                                                    DirectoryStream.Filter<Path> filter) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createFile(Path path,\n                           FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path dir,\n                                FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path dir,\n                                  FileAttribute<?>... attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path dir,\n                                Map<String, ?> attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path dir,\n                                  Map<String, ?> attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void delete(Path path,\n                       DeleteOption... options) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... options) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public Path createTempFile(String prefix,\n                               String suffix,\n                               FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempFile(Path dir,\n                               String prefix,\n                               String suffix,\n                               FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(String prefix,\n                                    FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(Path dir,\n                                    String prefix,\n                                    FileAttribute<?>... attrs) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path copy(Path source,\n                     Path target,\n                     CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path move(Path source,\n                     Path target,\n                     CopyOption... options) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                                Class<V> type) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path,\n                                              String attributes) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              FileAttribute<?>... attrs) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              Map<String, Object> attrs) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttribute(Path path,\n                             String attribute,\n                             Object value) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(Path path,\n                               String attribute) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileTime getLastModifiedTime(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long size(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public boolean exists(Path path) throws IllegalArgumentException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public boolean notExists(Path path) throws IllegalArgumentException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public boolean isSameFile(Path path,\n                              Path path2) throws IllegalArgumentException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public BufferedReader newBufferedReader(Path path,\n                                            Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public BufferedWriter newBufferedWriter(Path path,\n                                            Charset cs,\n                                            OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long copy(InputStream in,\n                     Path target,\n                     CopyOption... options) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public long copy(Path source,\n                     OutputStream out) throws IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public byte[] readAllBytes(Path path) throws IOException, OutOfMemoryError, SecurityException {\n        return new byte[0];\n    }\n\n    @Override\n    public List<String> readAllLines(Path path) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public List<String> readAllLines(Path path,\n                                     Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path,\n                                Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      Iterable<? extends CharSequence> lines,\n                      Charset cs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      Set<? extends OpenOption> options,\n                      FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String content,\n                      Charset cs,\n                      Map<String, ?> attrs,\n                      OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public int priority() {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/.gitignore",
    "content": "/target\n/local\ntarget\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n   <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-simple-docks</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Docks</name>\n\n  <modules>\n    <module>uberfire-simple-docks-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-simple-docks</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-simple-docks-client</artifactId>\n\n  <name>Uberfire Simple Docks Client</name>\n  <description>Uberfire Simple Docks Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/DocksEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.resources.WebAppResource;\n\n@EntryPoint\npublic class DocksEntryPoint {\n\n    @PostConstruct\n    public void init() {\n        WebAppResource.INSTANCE.CSS().ensureInjected();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/UberfireDocksImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.docks.view.DocksBar;\nimport org.uberfire.client.docks.view.DocksBars;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockContainerReadyEvent;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDockReadyEvent;\nimport org.uberfire.client.workbench.docks.UberfireDocks;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.mvp.Command;\n\n@ApplicationScoped\npublic class UberfireDocksImpl implements UberfireDocks {\n\n    final Map<String, List<UberfireDock>> docksPerPerspective = new HashMap<>();\n    final Map<String, List<Command>> delayedCommandsPerPerspective = new HashMap<>();\n\n    final Map<String, Set<UberfireDockPosition>> disableDocksPerPerspective = new HashMap<String, Set<UberfireDockPosition>>();\n    String currentPerspective;\n    private DocksBars docksBars;\n    private Event<UberfireDockReadyEvent> dockReadyEvent;\n\n    @Inject\n    public UberfireDocksImpl(DocksBars docksBars,\n                             Event<UberfireDockReadyEvent> dockReadyEvent) {\n        this.docksBars = docksBars;\n        this.dockReadyEvent = dockReadyEvent;\n    }\n\n    protected void setup(@Observes UberfireDockContainerReadyEvent event) {\n        docksBars.setup();\n    }\n\n    @Override\n    public void add(UberfireDock... docks) {\n        for (UberfireDock dock : docks) {\n            if (dock.getAssociatedPerspective() != null) {\n                List<UberfireDock> uberfireDocks = docksPerPerspective.get(dock.getAssociatedPerspective());\n                if (uberfireDocks == null) {\n                    uberfireDocks = new ArrayList<>();\n                }\n                uberfireDocks.add(dock);\n                docksPerPerspective.put(dock.getAssociatedPerspective(),\n                                        uberfireDocks);\n            }\n        }\n        clearAndCollapseDocks(docks);\n    }\n\n    public void perspectiveChangeEvent(@Observes PerspectiveChange perspectiveChange) {\n        this.currentPerspective = perspectiveChange.getIdentifier();\n        updateAllDocks();\n        executeDelayedCommands(perspectiveChange.getIdentifier());\n        fireDockReadyEvent();\n    }\n\n    private void fireDockReadyEvent() {\n        dockReadyEvent.fire(new UberfireDockReadyEvent(currentPerspective));\n    }\n\n    private void executeDelayedCommands(String perspective) {\n        List<Command> commands = delayedCommandsPerPerspective.get(perspective);\n        if (commands != null) {\n            commands.forEach(c -> {\n                c.execute();\n            });\n            delayedCommandsPerPerspective.remove(perspective);\n        }\n    }\n\n    @Override\n    public void remove(UberfireDock... docks) {\n        for (UberfireDock dock : docks) {\n            if (dock.getAssociatedPerspective() != null) {\n                List<UberfireDock> uberfireDocks = docksPerPerspective.get(dock.getAssociatedPerspective());\n                uberfireDocks.remove(dock);\n                docksPerPerspective.put(dock.getAssociatedPerspective(),\n                                        uberfireDocks);\n            }\n        }\n        clearAndCollapseDocks(docks);\n    }\n\n    @Override\n    public void open(UberfireDock dock) {\n        executeOnDocks(dock.getAssociatedPerspective(),\n                       dock.getDockPosition(),\n                       () -> docksBars.open(dock));\n    }\n\n    private void executeOnDocks(String perspective,\n                                UberfireDockPosition position,\n                                Command open) {\n        if (isCurrentPerspective(perspective) && docksBars.isReady(position)) {\n            open.execute();\n        } else {\n            addDelayedCommand(perspective,\n                              open);\n        }\n    }\n\n    private boolean isCurrentPerspective(String perspective) {\n        return perspective == currentPerspective;\n    }\n\n    private void addDelayedCommand(String perspective,\n                                   Command delayedCommand) {\n        List<Command> commands = delayedCommandsPerPerspective.get(perspective);\n        if (commands == null) {\n            commands = new ArrayList<>();\n        }\n        commands.add(delayedCommand);\n        delayedCommandsPerPerspective.put(perspective,\n                                          commands);\n    }\n\n    @Override\n    public void close(UberfireDock dock) {\n        executeOnDocks(dock.getAssociatedPerspective(),\n                       dock.getDockPosition(),\n                       () -> docksBars.close(dock));\n    }\n\n    @Override\n    public void toggle(UberfireDock dock) {\n        executeOnDocks(dock.getAssociatedPerspective(),\n                       dock.getDockPosition(),\n                       () -> docksBars.toggle(dock));\n    }\n\n    @Override\n    public void hide(UberfireDockPosition position,\n                     String perspectiveName) {\n        addToDisableDocksList(position,\n                              perspectiveName);\n        executeOnDocks(perspectiveName,\n                       position,\n                       () -> docksBars.clearAndHide(position));\n    }\n\n    @Override\n    public void show(UberfireDockPosition position,\n                     String perspectiveName) {\n        removeFromDisableDocksList(position,\n                                   perspectiveName);\n        executeOnDocks(perspectiveName,\n                       position,\n                       () -> showDock(position));\n    }\n\n    private void showDock(UberfireDockPosition position) {\n        docksBars.clearAndHide(position);\n        if (currentPerspective != null) {\n            List<UberfireDock> docks = docksPerPerspective.get(currentPerspective);\n            if (docks != null && !docks.isEmpty()) {\n                for (UberfireDock dock : docks) {\n                    if (dock.getDockPosition().equals(position)) {\n                        docksBars.addDock(dock);\n                    }\n                }\n                docksBars.show(position);\n            }\n        }\n    }\n\n    private void clearAndCollapseDocks(UberfireDock... docks) {\n        if (docks != null) {\n            List<UberfireDockPosition> processedPositions = new ArrayList<>();\n            for (UberfireDock dock : docks) {\n                if (!processedPositions.contains(dock.getDockPosition())) {\n                    processedPositions.add(dock.getDockPosition());\n                    if (docksBars.isReady(dock.getDockPosition())) {\n                        docksBars.clearAndCollapseDocks(dock.getDockPosition());\n                    }\n                }\n            }\n        }\n    }\n\n    private void updateAllDocks() {\n        docksBars.clearAndHideAllDocks();\n        if (currentPerspective != null) {\n            List<UberfireDock> activeDocks = docksPerPerspective.get(currentPerspective);\n            if (activeDocks != null && !activeDocks.isEmpty()) {\n                activeDocks.forEach(activeDock -> docksBars.addDock(activeDock));\n                expandAllAvailableDocks();\n            }\n        }\n    }\n\n    private void expandAllAvailableDocks() {\n        for (DocksBar docksBar : docksBars.getDocksBars()) {\n            if (dockIsEnable(docksBar.getPosition())) {\n                docksBars.show(docksBar);\n            }\n        }\n    }\n\n    private void addToDisableDocksList(UberfireDockPosition position,\n                                       String perspectiveName) {\n        Set<UberfireDockPosition> disableDocks = disableDocksPerPerspective.get(perspectiveName);\n        if (disableDocks == null) {\n            disableDocks = new HashSet<>();\n            disableDocksPerPerspective.put(perspectiveName,\n                                           disableDocks);\n        }\n        disableDocks.add(position);\n    }\n\n    private void removeFromDisableDocksList(UberfireDockPosition position,\n                                            String perspectiveName) {\n        Set<UberfireDockPosition> disableDocks = disableDocksPerPerspective.get(perspectiveName);\n        if (disableDocks != null) {\n            disableDocks.remove(position);\n        }\n    }\n\n    private boolean dockIsEnable(UberfireDockPosition dockPosition) {\n        Set<UberfireDockPosition> uberfireDockPositions = disableDocksPerPerspective.get(currentPerspective);\n        if (uberfireDockPositions != null && uberfireDockPositions.contains(dockPosition)) {\n            return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/DockResizeBar.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.event.dom.client.MouseOverHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class DockResizeBar extends FlowPanel implements OuiaComponent {\n\n    private static final String OUIA_COMPONENT_TYPE = \"resize-docks-bar\";\n\n    private static WebAppResource CSS = GWT.create(WebAppResource.class);\n\n    private Element glassElem = null;\n\n    private boolean mouseDown;\n\n    private double offset;\n\n    private ParameterizedCommand<Double> resizeCommand;\n\n    private DocksBar docksBar;\n\n    public DockResizeBar(final DocksBar docksBar) {\n        super();\n        this.docksBar = docksBar;\n        sinkEvents(Event.ONMOUSEDOWN | Event.ONMOUSEUP | Event.ONMOUSEMOVE | Event.ONDBLCLICK);\n        getElement().addClassName(CSS.CSS().resizableBar());\n        setupGlassElement();\n        setupMouseHandlers(docksBar);\n        initOuiaComponentAttributes();\n    }\n\n    public void setup(ParameterizedCommand<Double> resizeCommand) {\n        this.resizeCommand = resizeCommand;\n    }\n\n    @Override\n    public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n        return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(),\n                                                          ouiaAttribute.getValue());\n    }\n\n    @Override\n    public OuiaComponentTypeAttribute ouiaComponentType() {\n        return new OuiaComponentTypeAttribute(OUIA_COMPONENT_TYPE);\n    }\n\n    @Override\n    public OuiaComponentIdAttribute ouiaComponentId() {\n        return new OuiaComponentIdAttribute(OUIA_COMPONENT_TYPE + \"-\" + docksBar.getPosition().getShortName());\n    }\n\n    private void setupMouseHandlers(final DocksBar docksBar) {\n        addDomHandler(new MouseMoveHandler() {\n                          @Override\n                          public void onMouseMove(MouseMoveEvent event) {\n                              if (mouseDown) {\n                                  setupMoveIcon();\n                                  resizeCommand.execute(calculateDockSize(event,\n                                                                          docksBar));\n                                  event.preventDefault();\n                              }\n                          }\n                      },\n                      MouseMoveEvent.getType());\n\n        addDomHandler(new MouseOverHandler() {\n                          @Override\n                          public void onMouseOver(MouseOverEvent event) {\n                              setupMoveIcon();\n                          }\n                      },\n                      MouseOverEvent.getType());\n\n        addDomHandler(new MouseDownHandler() {\n                          @Override\n                          public void onMouseDown(MouseDownEvent event) {\n                              setupMoveIcon();\n\n                              mouseDown = true;\n                              int width = Math.max(Window.getClientWidth(),\n                                                   Document.get().getScrollWidth());\n                              int height = Math.max(Window.getClientHeight(),\n                                                    Document.get().getScrollHeight());\n                              glassElem.getStyle().setHeight(height,\n                                                             Style.Unit.PX);\n                              glassElem.getStyle().setWidth(width,\n                                                            Style.Unit.PX);\n                              Document.get().getBody().appendChild(glassElem);\n\n                              buildOffset(event);\n                              Event.setCapture(getElement());\n                              event.preventDefault();\n                          }\n                      },\n                      MouseDownEvent.getType());\n\n        addDomHandler(new MouseUpHandler() {\n                          @Override\n                          public void onMouseUp(MouseUpEvent event) {\n                              getElement().getStyle().setProperty(\"cursor\",\n                                                                  \"default\");\n                              mouseDown = false;\n\n                              glassElem.removeFromParent();\n\n                              Event.releaseCapture(getElement());\n                          }\n                      },\n                      MouseUpEvent.getType());\n    }\n\n    private void setupGlassElement() {\n        //This is a special div to prevent select elements in parent widgets during resize\n        glassElem = Document.get().createDivElement();\n        glassElem.getStyle().setPosition(Style.Position.ABSOLUTE);\n        glassElem.getStyle().setTop(0,\n                                    Style.Unit.PX);\n        glassElem.getStyle().setLeft(0,\n                                     Style.Unit.PX);\n        glassElem.getStyle().setMargin(0,\n                                       Style.Unit.PX);\n        glassElem.getStyle().setPadding(0,\n                                        Style.Unit.PX);\n        glassElem.getStyle().setBorderWidth(0,\n                                            Style.Unit.PX);\n        glassElem.getStyle().setProperty(\"background\",\n                                         \"white\");\n        glassElem.getStyle().setProperty(\"backgroundColor\",\n                                         \"red\");\n        glassElem.getStyle().setOpacity(0.0);\n    }\n\n    private void setupMoveIcon() {\n        UberfireDockPosition position = docksBar.getPosition();\n        if (position == UberfireDockPosition.SOUTH) {\n            getElement().getStyle().setProperty(\"cursor\",\n                                                \"ns-resize\");\n        } else {\n            getElement().getStyle().setProperty(\"cursor\",\n                                                \"ew-resize\");\n        }\n    }\n\n    private double calculateDockSize(MouseMoveEvent event,\n                                     DocksBar docksBar) {\n        UberfireDockPosition position = docksBar.getPosition();\n        if (position == UberfireDockPosition.WEST) {\n            return docksBar.getExpandedBarSize() + (event.getClientX() - getAbsoluteLeft());\n        }\n        if (position == UberfireDockPosition.EAST) {\n            return docksBar.getExpandedBarSize() + (getAbsoluteLeft() - event.getClientX());\n        }\n        if (position == UberfireDockPosition.SOUTH) {\n            return docksBar.getExpandedBarSize() + (getAbsoluteTop() - event.getClientY());\n        }\n        return docksBar.getExpandedBarSize();\n    }\n\n    private void buildOffset(MouseDownEvent event) {\n        offset = event.getClientX() - getAbsoluteLeft();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/DocksBar.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport org.uberfire.client.docks.view.bars.DocksCollapsedBar;\nimport org.uberfire.client.docks.view.bars.DocksExpandedBar;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\n\npublic class DocksBar {\n\n    private UberfireDockPosition position;\n\n    private DocksCollapsedBar collapsedBar;\n    private Double collapsedDefaultSize = 35.0;\n\n    private DocksExpandedBar expandedBar;\n    private Double expandedDefaultSize = 150.0;\n    private Double expandedSize = expandedDefaultSize;\n\n    private DockResizeBar dockResizeBar;\n    private Double dockResizeBarDefaultSize = 2.0;\n    private UberfireDock openDock;\n\n    public DocksBar(UberfireDockPosition position) {\n        this.position = position;\n        setupChildBars(position);\n    }\n\n    protected void setupChildBars(UberfireDockPosition position) {\n        this.collapsedBar = new DocksCollapsedBar(position);\n        this.expandedBar = new DocksExpandedBar(position);\n        this.dockResizeBar = new DockResizeBar(this);\n    }\n\n    public DocksCollapsedBar getCollapsedBar() {\n        return collapsedBar;\n    }\n\n    public boolean isCollapsedBarInSingleMode() {\n        return collapsedBar.singleDockMode();\n    }\n\n    public DocksExpandedBar getExpandedBar() {\n        return expandedBar;\n    }\n\n    public Double getCollapsedBarSize() {\n        return collapsedDefaultSize;\n    }\n\n    public double getExpandedBarSize() {\n        return expandedSize;\n    }\n\n    public void setExpandedSize(Double expandedSize) {\n        this.expandedSize = expandedSize;\n    }\n\n    public void clearAll() {\n        collapsedBar.clear();\n        expandedBar.clear();\n    }\n\n    public void addDock(final UberfireDock dock,\n                        final ParameterizedCommand<String> openCommand,\n                        final ParameterizedCommand<String> closeCommand) {\n        if (collapsedBar != null) {\n            collapsedBar.addDock(dock,\n                                 openCommand,\n                                 closeCommand);\n        }\n    }\n\n    public UberfireDockPosition getPosition() {\n        return position;\n    }\n\n    public boolean hasDocksItems() {\n        return !collapsedBar.getDocksItems().isEmpty();\n    }\n\n    public DockResizeBar getDockResizeBar() {\n        return dockResizeBar;\n    }\n\n    public Double getDockResizeBarDefaultSize() {\n        return dockResizeBarDefaultSize;\n    }\n\n    public void configureResizeBar(ParameterizedCommand<Double> resizeCommand) {\n        dockResizeBar.setup(resizeCommand);\n    }\n\n    public void open(UberfireDock dock) {\n        if (hasDocksItems()) {\n            collapsedBar.expand(dock);\n        }\n    }\n\n    public void setOpenDock(UberfireDock openDock) {\n        this.openDock = openDock;\n    }\n\n    public boolean isOpen() {\n        return openDock != null;\n    }\n\n    public boolean isOpenWith(PlaceRequest placeRequest) {\n        return isOpen() && openDock.getPlaceRequest().equals(placeRequest);\n    }\n\n    public void clearExpandedDock(UberfireDock expandedDock) {\n        if (this.openDock != null && this.openDock.getPlaceRequest().equals(expandedDock.getPlaceRequest())) {\n            this.openDock = null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/DocksBars.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.docks.view.bars.DocksCollapsedBar;\nimport org.uberfire.client.docks.view.bars.DocksExpandedBar;\nimport org.uberfire.client.docks.view.menu.MenuBuilder;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocksContainer;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\n@Dependent\npublic class DocksBars {\n\n    private PlaceManager placeManager;\n\n    private MenuBuilder menuBuilder;\n\n    private Event<UberfireDocksInteractionEvent> dockInteractionEvent;\n    private UberfireDocksContainer uberfireDocksContainer;\n    private List<DocksBar> docks = new ArrayList<>();\n    private AuthorizationManager authorizationManager;\n    private User identity;\n\n    @Inject\n    public DocksBars(PlaceManager placeManager,\n                     MenuBuilder menuBuilder,\n                     Event<UberfireDocksInteractionEvent> dockInteractionEvent,\n                     UberfireDocksContainer uberfireDocksContainer,\n                     AuthorizationManager authorizationManager,\n                     User identity) {\n        this.placeManager = placeManager;\n        this.menuBuilder = menuBuilder;\n        this.dockInteractionEvent = dockInteractionEvent;\n        this.uberfireDocksContainer = uberfireDocksContainer;\n        this.authorizationManager = authorizationManager;\n        this.identity = identity;\n    }\n\n    public void setup() {\n        for (UberfireDockPosition uberfireDockPosition : UberfireDockPosition.values()) {\n            createDock(uberfireDockPosition);\n        }\n    }\n\n    private void createDock(UberfireDockPosition position) {\n        DocksBar docksBar = createDockBar(position);\n\n        uberfireDocksContainer.add(position,\n                                   docksBar.getCollapsedBar(),\n                                   docksBar.getCollapsedBarSize());\n        uberfireDocksContainer.add(position,\n                                   docksBar.getExpandedBar(),\n                                   docksBar.getExpandedBarSize());\n        uberfireDocksContainer.add(position,\n                                   docksBar.getDockResizeBar(),\n                                   docksBar.getDockResizeBarDefaultSize());\n\n        docksBar.configureResizeBar(createResizeCommand(docksBar));\n        docks.add(docksBar);\n    }\n\n    private DocksBar createDockBar(UberfireDockPosition position) {\n        DocksBar docksBar = new DocksBar(position);\n        return docksBar;\n    }\n\n    public void addDock(UberfireDock dock) {\n        DocksBar docksBar = getDockBar(dock);\n        docksBar.addDock(dock,\n                         createDockOpenCommand(dock,\n                                               docksBar),\n                         createDockCloseCommand(dock,\n                                                docksBar));\n    }\n\n    DocksBar getDockBar(UberfireDock dock) {\n        for (DocksBar candidate : docks) {\n            if (candidate.getPosition().equals(dock.getDockPosition())) {\n                return candidate;\n            }\n        }\n        return null;\n    }\n\n    DocksBar getDockBar(UberfireDockPosition position) {\n        for (DocksBar candidate : docks) {\n            if (candidate.getPosition().equals(position)) {\n                return candidate;\n            }\n        }\n        return null;\n    }\n\n    ParameterizedCommand<Double> createResizeCommand(final DocksBar docksBar) {\n        return new ParameterizedCommand<Double>() {\n            @Override\n            public void execute(Double size) {\n                if (sizeIsValid(size,\n                                docksBar)) {\n                    docksBar.setExpandedSize(size);\n                    uberfireDocksContainer.setWidgetSize(docksBar.getExpandedBar(),\n                                                         docksBar.getExpandedBarSize());\n                    docksBar.getExpandedBar().setupDockContentSize();\n                    uberfireDocksContainer.resize();\n                    dockInteractionEvent.fire(new UberfireDocksInteractionEvent(docksBar.getPosition(),\n                                                                                UberfireDocksInteractionEvent.InteractionType.RESIZED));\n                }\n            }\n        };\n    }\n\n    boolean sizeIsValid(Double size,\n                        DocksBar docksBar) {\n        int max = calculateMaxSize(docksBar);\n        int minVisibleSize = 1;\n        return size > minVisibleSize && size < max;\n    }\n\n    private int calculateMaxSize(DocksBar docksBar) {\n        UberfireDockPosition position = docksBar.getPosition();\n        int collapsedSize = new Double(docksBar.getCollapsedBarSize()).intValue();\n\n        int max = 0;\n        if (position == UberfireDockPosition.SOUTH) {\n            max = uberfireDocksContainer.getOffsetHeight() - collapsedSize;\n        } else {\n            max = uberfireDocksContainer.getOffsetWidth() - 2 * collapsedSize;\n        }\n        return max;\n    }\n\n    public void clearAndCollapseDocks(final UberfireDockPosition position) {\n        collapsePosition(position);\n        clearPosition(position);\n    }\n\n    public void clearAndHideAllDocks() {\n        clearAndCollapseDocks(null);\n    }\n\n    private void clearPosition(final UberfireDockPosition position) {\n        getDocksBars().forEach(docksBar -> {\n            if (position == null || docksBar.getPosition().equals(position)) {\n                docksBar.clearAll();\n            }\n        });\n    }\n\n    private void collapsePosition(final UberfireDockPosition position) {\n        getDocksBars().forEach(docksBar -> {\n            // if position is null or equals the docksBar we must collapse the docksBar\n            if (position == null || docksBar.getPosition().equals(position)) {\n                hide(docksBar);\n            }\n        });\n    }\n\n    private void hide(DocksBar docksBar) {\n        uberfireDocksContainer.hide(docksBar.getCollapsedBar());\n        uberfireDocksContainer.hide(docksBar.getExpandedBar());\n        uberfireDocksContainer.hide(docksBar.getDockResizeBar());\n    }\n\n    void hide(Widget bar) {\n        uberfireDocksContainer.hide(bar);\n    }\n\n    public void clearAndHide(UberfireDockPosition position) {\n        DocksBar dockBar = getDockBar(position);\n        dockBar.clearAll();\n        hide(dockBar);\n\n        resizeDeferred();\n    }\n\n    void resizeDeferred() {\n        Scheduler.get().scheduleDeferred(() -> uberfireDocksContainer.resize());\n    }\n\n    ParameterizedCommand<String> createDockOpenCommand(final UberfireDock targetDock,\n                                                       final DocksBar docksBar) {\n        return clickDockName -> {\n            if (targetDock != null) {\n                openDock(targetDock,\n                         docksBar);\n                if (docksBar.isCollapsedBarInSingleMode()) {\n                    hide(docksBar.getCollapsedBar());\n                }\n                uberfireDocksContainer.resize();\n                dockInteractionEvent.fire(new UberfireDocksInteractionEvent(targetDock,\n                                                                            UberfireDocksInteractionEvent.InteractionType.OPENED));\n            }\n        };\n    }\n\n    void openDock(UberfireDock targetDock,\n                  DocksBar docksBar) {\n        docksBar.setOpenDock(targetDock);\n        DocksCollapsedBar collapsedBar = docksBar.getCollapsedBar();\n        DocksExpandedBar expandedBar = docksBar.getExpandedBar();\n        PlaceRequest placeRequest = targetDock.getPlaceRequest();\n\n        setupCollapsedBar(targetDock,\n                          collapsedBar);\n        setupExpandedBar(targetDock,\n                         docksBar,\n                         expandedBar);\n        show(docksBar.getDockResizeBar());\n        goToPlace(expandedBar,\n                  placeRequest);\n\n        lookUpContextMenus(placeRequest,\n                           docksBar.getExpandedBar());\n    }\n\n    private void goToPlace(DocksExpandedBar expandedBar,\n                           PlaceRequest placeRequest) {\n        placeRequest.setUpdateLocationBar(false);\n        placeManager.goTo(placeRequest,\n                          expandedBar.targetPanel());\n    }\n\n    private void lookUpContextMenus(PlaceRequest placeRequest,\n                                    DocksExpandedBar expandedBar) {\n        Activity activity = placeManager.getActivity(placeRequest);\n        if (activity instanceof AbstractWorkbenchScreenActivity) {\n            AbstractWorkbenchScreenActivity screen = (AbstractWorkbenchScreenActivity) activity;\n            screen.getMenus(menus -> {\n                if (menus != null) {\n                    menus.accept(new AuthFilterMenuVisitor(authorizationManager,\n                            identity, new BaseMenuVisitor() {\n\n                                @Override\n                                public void visit(MenuItemPlain menuItemPlain) {\n                                    expandedBar.addContextMenuItem(menuBuilder.makeItem(menuItemPlain, true));\n                                }\n                                @Override\n                                public void visit(MenuItemCommand menuItemCommand) {\n                                    expandedBar.addContextMenuItem(menuBuilder.makeItem(menuItemCommand, true));\n                                }\n                                @Override\n                                public void visit(MenuItemPerspective menuItemPerspective) {\n                                    expandedBar.addContextMenuItem(menuBuilder.makeItem(menuItemPerspective, true));\n                                }\n                                @Override\n                                public void visit(MenuCustom<?> menuCustom) {\n                                    expandedBar.addContextMenuItem(menuBuilder.makeItem(menuCustom, true));\n                                }\n                            }));\n                }\n            });\n        }\n    }\n\n    private void setupCollapsedBar(UberfireDock targetDock,\n                                   DocksCollapsedBar collapsedBar) {\n        collapsedBar.setDockClosed(targetDock);\n    }\n\n    private void setupExpandedBar(UberfireDock targetDock,\n                                  DocksBar docksBar,\n                                  DocksExpandedBar expandedBar) {\n        expandedBar.clear();\n        show(expandedBar);\n\n        setupExpandedBarSize(targetDock,\n                             docksBar);\n        expandedBar.setup(targetDock.getLabel(),\n                          createDockCloseCommand(targetDock,\n                                                 docksBar));\n    }\n\n    public void open(UberfireDock dock) {\n        DocksBar dockBar = getDockBar(dock);\n        if (dockBar != null) {\n            dockBar.open(dock);\n        }\n    }\n\n    public void close(UberfireDock dock) {\n        DocksBar dockBar = getDockBar(dock);\n        if (dockBar != null) {\n            if (isOpenWith(dock,\n                           dockBar)) {\n                closeDockProcess(dock,\n                                 dockBar);\n            }\n        }\n    }\n\n    public void toggle(UberfireDock dock) {\n        DocksBar dockBar = getDockBar(dock);\n        if (dockBar != null) {\n            if (isOpenWith(dock,\n                           dockBar)) {\n                closeDockProcess(dock,\n                                 dockBar);\n            } else {\n                dockBar.open(dock);\n            }\n        }\n    }\n\n    boolean isOpenWith(UberfireDock dock,\n                               DocksBar dockBar) {\n        return dockBar.isOpenWith(dock.getPlaceRequest());\n    }\n\n    ParameterizedCommand<String> createDockCloseCommand(final UberfireDock targetDock,\n                                                        final DocksBar docksBar) {\n        return clickedDockName -> closeDockProcess(targetDock,\n                                                   docksBar);\n    }\n\n    void closeDockProcess(UberfireDock targetDock,\n                                  DocksBar docksBar) {\n        if (targetDock != null) {\n            closeDock(targetDock,\n                      docksBar);\n            if (docksBar.isCollapsedBarInSingleMode()) {\n                show(docksBar.getCollapsedBar());\n            }\n            uberfireDocksContainer.resize();\n            dockInteractionEvent.fire(new UberfireDocksInteractionEvent(targetDock,\n                                                                        UberfireDocksInteractionEvent.InteractionType.CLOSED));\n        }\n    }\n\n    void closeDock(UberfireDock dock,\n                   DocksBar docksBar) {\n        DocksCollapsedBar collapsedBar = docksBar.getCollapsedBar();\n        DocksExpandedBar dockExpandedBar = docksBar.getExpandedBar();\n        docksBar.clearExpandedDock(dock);\n        collapsedBar.closeAllDocks();\n        dockExpandedBar.clear();\n        hide(dockExpandedBar);\n        hide(docksBar.getDockResizeBar());\n    }\n\n    private void setupExpandedBarSize(UberfireDock targetDock,\n                                      DocksBar docksBar) {\n\n        DocksExpandedBar expandedBar = docksBar.getExpandedBar();\n\n        if (thereIsASpecificSize(targetDock)) {\n            expandedBar.setPanelSize(targetDock.getSize().intValue(),\n                                     targetDock.getSize().intValue());\n            uberfireDocksContainer.setWidgetSize(expandedBar,\n                                                 targetDock.getSize());\n        } else {\n            int width = uberfireDocksContainer.getClientWidth();\n            Double height = new Double(docksBar.getExpandedBarSize());\n            expandedBar.setPanelSize(width,\n                                     height.intValue());\n            uberfireDocksContainer.setWidgetSize(expandedBar,\n                                                 docksBar.getExpandedBarSize());\n        }\n    }\n\n    private boolean thereIsASpecificSize(UberfireDock targetDock) {\n        return targetDock.getSize() != null;\n    }\n\n    public void show(DocksBar docksBar) {\n        if (docksBar.hasDocksItems()) {\n            show(docksBar.getCollapsedBar());\n        }\n    }\n\n    public void show(UberfireDockPosition position) {\n        DocksBar dockBar = getDockBar(position);\n        if (dockBar.hasDocksItems()) {\n            show(dockBar.getCollapsedBar());\n        }\n    }\n\n    public boolean isReady(UberfireDockPosition dockPosition) {\n        return uberfireDocksContainer.isReady() && docksBarIsReady(dockPosition);\n    }\n\n    private boolean docksBarIsReady(UberfireDockPosition dockPosition) {\n        DocksBar dockBar = getDockBar(dockPosition);\n        return dockBar != null;\n    }\n\n    void show(Widget widget) {\n        uberfireDocksContainer.show(widget);\n    }\n\n    private void hide(DocksExpandedBar dock) {\n        dock.clear();\n        uberfireDocksContainer.hide(dock);\n    }\n\n    public List<DocksBar> getDocksBars() {\n        return docks;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/bars/DocksCollapsedBar.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.bars;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.docks.view.items.AbstractDockItem;\nimport org.uberfire.client.docks.view.items.SingleSideDockItem;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class DocksCollapsedBar extends Composite implements OuiaComponent {\n\n    private static final String OUIA_COMPONENT_TYPE = \"collapsed-docks-bar\";\n\n    @UiField\n    FlowPanel docksBarPanel;\n    private UberfireDockPosition position;\n    private WebAppResource CSS = GWT.create(WebAppResource.class);\n    private AbstractDockItem firstDockItem;\n    private SingleSideDockItem singleSideDockItem;\n    private ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    private List<AbstractDockItem> docksItems = new ArrayList<AbstractDockItem>();\n\n    public DocksCollapsedBar(UberfireDockPosition position) {\n        initWidget(uiBinder.createAndBindUi(this));\n        this.position = position;\n        setCSS(position);\n        setupLocators(position);\n    }\n\n    private void setCSS(UberfireDockPosition position) {\n        if (position == UberfireDockPosition.SOUTH) {\n            docksBarPanel.addStyleName(CSS.CSS().gradientTopBottom());\n        } else {\n            docksBarPanel.addStyleName(CSS.CSS().gradientBottomTop());\n        }\n    }\n\n    private void setupLocators(UberfireDockPosition position) {\n        initOuiaComponentAttributes();\n        docksBarPanel.addStyleName(CSSLocatorsUtils.buildLocator(OUIA_COMPONENT_TYPE,\n                                                                 position.getShortName()));\n    }\n\n    public void addDock(final UberfireDock dock,\n                        final ParameterizedCommand<String> openCommand,\n                        final ParameterizedCommand<String> closeCommand) {\n\n        AbstractDockItem dockItem = AbstractDockItem.create(dock,\n                                                            openCommand,\n                                                            closeCommand);\n\n        if (dock.getDockPosition().allowSingleDockItem()) {\n            handleSingleDockItem(dockItem,\n                                 dock,\n                                 openCommand);\n        }\n\n        docksBarPanel.add(dockItem);\n\n        docksItems.add(dockItem);\n    }\n\n    private void handleSingleDockItem(AbstractDockItem dockItem,\n                                      UberfireDock dock,\n                                      ParameterizedCommand<String> openCommand) {\n        if (docksItems.isEmpty()) {\n            createSingleDockItem(dockItem,\n                                 dock,\n                                 openCommand);\n        } else if (singleDockMode()) {\n            clearSingleDockItem();\n        }\n    }\n\n    public boolean singleDockMode() {\n        return position.allowSingleDockItem() && docksItems.size() == 1;\n    }\n\n    private void createSingleDockItem(AbstractDockItem dockItem,\n                                      UberfireDock dock,\n                                      ParameterizedCommand<String> openCommand) {\n        firstDockItem = dockItem;\n        firstDockItem.addStyleName(CSS.CSS().hideElement());\n        singleSideDockItem = new SingleSideDockItem(dock,\n                                                    openCommand);\n        docksBarPanel.add(singleSideDockItem);\n    }\n\n    private void clearSingleDockItem() {\n        firstDockItem.removeStyleName(CSS.CSS().hideElement());\n        docksBarPanel.remove(singleSideDockItem);\n    }\n\n    public void clear() {\n        docksBarPanel.clear();\n        docksItems = new ArrayList<>();\n    }\n\n    public void setDockClosed(final UberfireDock dockOpen) {\n        for (AbstractDockItem docksItem : docksItems) {\n            if (docksItem.getDock().equals(dockOpen)) {\n                docksItem.open();\n            } else {\n                docksItem.close();\n            }\n        }\n    }\n\n    public void closeAllDocks() {\n        for (AbstractDockItem docksItem : docksItems) {\n            docksItem.close();\n        }\n    }\n\n    public UberfireDockPosition getPosition() {\n        return position;\n    }\n\n    public List<AbstractDockItem> getDocksItems() {\n        return docksItems;\n    }\n\n    public void expand(UberfireDock targetDock) {\n        for (AbstractDockItem abstractDockItem : getDocksItems()) {\n            UberfireDock candidate = abstractDockItem.getDock();\n            if (candidate.getPlaceRequest().equals(targetDock.getPlaceRequest())) {\n                abstractDockItem.openAndExecuteExpandCommand();\n            }\n        }\n    }\n\n    @Override\n    public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n        return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(), ouiaAttribute.getValue());\n    }\n\n    @Override\n    public OuiaComponentTypeAttribute ouiaComponentType() {\n        return new OuiaComponentTypeAttribute(OUIA_COMPONENT_TYPE);\n    }\n\n    @Override\n    public OuiaComponentIdAttribute ouiaComponentId() {\n        return new OuiaComponentIdAttribute(OUIA_COMPONENT_TYPE + \"-\" + position.getShortName());\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, DocksCollapsedBar> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/bars/DocksCollapsedBar.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <g:FlowPanel ui:field=\"docksBarPanel\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/bars/DocksExpandedBar.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.bars;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class DocksExpandedBar\n        extends Composite implements ProvidesResize,\n                                     RequiresResize,\n                                     OuiaComponent {\n\n    private static final String OUIA_COMPONENT_TYPE = \"expanded-docks-bar\";\n\n    private static WebAppResource CSS = GWT.create(WebAppResource.class);\n    @UiField\n    FlowPanel titlePanel;\n\n    @UiField\n    FlowPanel targetPanel;\n\n    Button collapse;\n\n    Heading title;\n    private UberfireDockPosition position;\n    private ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    public DocksExpandedBar(UberfireDockPosition position) {\n        initWidget(uiBinder.createAndBindUi(this));\n        this.position = position;\n        setupLocators(position);\n    }\n\n    private void setupLocators(final UberfireDockPosition position) {\n        initOuiaComponentAttributes();\n        getElement().addClassName(CSSLocatorsUtils.buildLocator(OUIA_COMPONENT_TYPE,\n                                                                position.getShortName()));\n    }\n\n    @Override\n    public void onResize() {\n        resizeTargetPanel();\n    }\n\n    public void setup(String titleString,\n                      ParameterizedCommand<String> closeCommand) {\n        clear();\n        createTitle(titleString);\n        createButtons(titleString,\n                      closeCommand);\n        setupComponents();\n        setupCSS();\n    }\n\n    private void setupComponents() {\n        if (position == UberfireDockPosition.SOUTH) {\n            titlePanel.add(collapse);\n            titlePanel.add(title);\n        } else if (position == UberfireDockPosition.WEST) {\n            titlePanel.add(title);\n            titlePanel.add(collapse);\n        } else if (position == UberfireDockPosition.EAST) {\n            titlePanel.add(collapse);\n            titlePanel.add(title);\n        }\n    }\n\n    public void addContextMenuItem(Widget menuItem) {\n        if (menuItem != null) {\n            final ButtonGroup bg = new ButtonGroup();\n            bg.addStyleName(CSS.CSS().dockExpandedContentButton());\n            bg.add(menuItem);\n            titlePanel.add(bg);\n        }\n    }\n\n    private void createTitle(String titleString) {\n        title = new Heading(HeadingSize.H3,\n                            titleString);\n    }\n\n    private void createButtons(final String identifier,\n                               final ParameterizedCommand<String> closeCommand) {\n        collapse = GWT.create(Button.class);\n        collapse.setSize(ButtonSize.SMALL);\n        collapse.addClickHandler(even -> closeCommand.execute(identifier));\n        final String componentType = \"collapse-docks-button\";\n        collapse.getElement().setAttribute(OuiaComponentTypeAttribute.COMPONENT_TYPE, componentType);\n        collapse.getElement().setAttribute(OuiaComponentIdAttribute.COMPONENT_ID, componentType + \"-\" + identifier);\n    }\n\n    private void setupCSS() {\n        if (position == UberfireDockPosition.SOUTH) {\n            titlePanel.addStyleName(CSS.CSS().dockExpandedContentPanelSouth());\n            title.addStyleName(CSS.CSS().dockExpandedLabelSouth());\n            collapse.addStyleName(CSS.CSS().dockExpandedButtonSouth());\n            collapse.setIcon(IconType.CHEVRON_DOWN);\n        } else if (position == UberfireDockPosition.WEST) {\n            title.addStyleName(CSS.CSS().dockExpandedLabelWest());\n            collapse.addStyleName(CSS.CSS().dockExpandedButtonWest());\n            collapse.setIcon(IconType.CHEVRON_LEFT);\n        } else if (position == UberfireDockPosition.EAST) {\n            title.addStyleName(CSS.CSS().dockExpandedLabelEast());\n            collapse.addStyleName(CSS.CSS().dockExpandedButtonEast());\n            collapse.setIcon(IconType.CHEVRON_RIGHT);\n        }\n        setupDockContentSize();\n    }\n\n    public void setupDockContentSize() {\n        //  goTo( PlaceRequest place, HasWidgets addTo ) lost widget size\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            @Override\n            public void execute() {\n                resizeTargetPanel();\n            }\n        });\n    }\n\n    protected void resizeTargetPanel() {\n        int width = calculateDockWidth();\n        int height = calculateDockHeight();\n        setPanelSize(width,\n                     height);\n    }\n\n    int calculateDockWidth() {\n        return getOffsetWidth();\n    }\n\n    int calculateDockHeight() {\n        return getOffsetHeight() - titlePanel.getOffsetHeight();\n    }\n\n    public void setPanelSize(int width,\n                             int height) {\n        if (isValidHeightWidth(width,\n                               height)) {\n            targetPanel.setPixelSize(width,\n                                     height);\n        }\n    }\n\n    private boolean isValidHeightWidth(int height,\n                                       int width) {\n        if (height > 0 && width > 0) {\n            return true;\n        }\n        return false;\n    }\n\n    public FlowPanel targetPanel() {\n        return targetPanel;\n    }\n\n    public void clear() {\n        targetPanel.clear();\n        titlePanel.clear();\n    }\n\n    public UberfireDockPosition getPosition() {\n        return position;\n    }\n\n    @Override\n    public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n        return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(), ouiaAttribute.getValue());\n    }\n\n    @Override\n    public OuiaComponentTypeAttribute ouiaComponentType() {\n        return new OuiaComponentTypeAttribute(OUIA_COMPONENT_TYPE);\n    }\n\n    @Override\n    public OuiaComponentIdAttribute ouiaComponentId() {\n        return new OuiaComponentIdAttribute(OUIA_COMPONENT_TYPE + \"-\" + position.getShortName());\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, DocksExpandedBar> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/bars/DocksExpandedBar.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field='res' type='org.uberfire.client.resources.WebAppResource'/>\n\n\n  <g:FlowPanel styleName=\"{res.CSS.dockExpanded}\">\n    <g:FlowPanel ui:field=\"titlePanel\" styleName=\"{res.CSS.dockExpandedTitlePanel}\"/>\n    <g:ScrollPanel styleName=\"{res.CSS.dockExpandedContentPanel}\">\n      <g:FlowPanel ui:field=\"targetPanel\"/>\n    </g:ScrollPanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/AbstractDockItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.IconPosition;\nimport org.gwtbootstrap3.client.ui.constants.IconSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic abstract class AbstractDockItem extends Composite implements OuiaComponent {\n\n    private static final String OUIA_COMPONENT_TYPE = \"docks-item\";\n\n    private final UberfireDock dock;\n\n    AbstractDockItem(UberfireDock dock) {\n        this.dock = dock;\n    }\n\n    public static AbstractDockItem create(UberfireDock dock,\n                                          ParameterizedCommand<String> openCommand,\n                                          ParameterizedCommand<String> closeCommand) {\n        if (dock.getDockPosition() == UberfireDockPosition.SOUTH) {\n            return new SouthDockItem(dock,\n                                     openCommand,\n                                     closeCommand);\n        } else {\n            return new SideDockItem(dock,\n                                    openCommand,\n                                    closeCommand);\n        }\n    }\n\n    void configureText(final Button itemButton,\n                       final String text) {\n        Span itemButtonText = GWT.create(Span.class);\n        itemButtonText.setText(text);\n        itemButton.insert(itemButtonText,\n                          0);\n    }\n\n    void configureIcon(Button itemButton,\n                       ImageResource imageResource) {\n        if (getDock().getIconType() != null) {\n            itemButton.setIcon(getIcon());\n            itemButton.setIconFixedWidth(true);\n            itemButton.setIconSize(IconSize.LARGE);\n            itemButton.setIconPosition(IconPosition.LEFT);\n        } else {\n            configureImageIcon(itemButton,\n                               imageResource);\n        }\n    }\n\n    void configureImageIcon(final Button itemButton,\n                            final ImageResource imageResource) {\n        if (imageResource != null) {\n            final Image imageIcon = new Image(imageResource);\n            imageIcon.getElement().getStyle().setWidth(14,\n                                                       Style.Unit.PX);\n            imageIcon.getElement().getStyle().setHeight(14,\n                                                        Style.Unit.PX);\n\n            if (itemButton.getWidgetCount() > 1) {\n                imageIcon.getElement().getStyle().setPosition(Style.Position.ABSOLUTE);\n                imageIcon.getElement().getStyle().setTop(3,\n                                                         Style.Unit.PX);\n                imageIcon.getElement().getStyle().setLeft(3,\n                                                          Style.Unit.PX);\n\n                itemButton.getElement().getStyle().setPaddingLeft(20,\n                                                                  Style.Unit.PX);\n                itemButton.getElement().getStyle().setPosition(Style.Position.RELATIVE);\n            }\n\n            itemButton.insert(imageIcon,\n                              0);\n        }\n    }\n\n    private IconType getIcon() {\n        if (dock.getIconType() == null) {\n            return null;\n        }\n\n        try {\n            return IconType.valueOf(dock.getIconType());\n        } catch (Exception e) {\n            return IconType.FOLDER_OPEN;\n        }\n    }\n\n    public UberfireDock getDock() {\n        return dock;\n    }\n\n    public String getIdentifier() {\n        return dock.getIdentifier();\n    }\n\n    public String getLabel() {\n        return dock.getLabel();\n    }\n\n    public abstract void openAndExecuteExpandCommand();\n\n    public abstract void open();\n\n    public abstract void close();\n\n    void setupLocators(final UberfireDock dock) {\n        initOuiaComponentAttributes();\n        getElement().addClassName(CSSLocatorsUtils.buildLocator(OUIA_COMPONENT_TYPE,\n                                                                dock.getDockPosition().getShortName(),\n                                                                dock.getIdentifier()));\n    }\n\n    @Override\n    public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n        return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(), ouiaAttribute.getValue());\n    }\n\n    @Override\n    public OuiaComponentTypeAttribute ouiaComponentType() {\n        return new OuiaComponentTypeAttribute(OUIA_COMPONENT_TYPE);\n    }\n\n    @Override\n    public OuiaComponentIdAttribute ouiaComponentId() {\n        return new OuiaComponentIdAttribute(OUIA_COMPONENT_TYPE + \"-\" + dock.getIdentifier());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/AbstractSideDockItem.java",
    "content": "package org.uberfire.client.docks.view.items;\n\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\n\npublic abstract class AbstractSideDockItem extends AbstractDockItem {\n\n    AbstractSideDockItem(UberfireDock dock) {\n        super(dock);\n    }\n\n    void configureTooltip(Tooltip itemTooltip,\n                          final String text) {\n        itemTooltip.setTitle(text);\n        itemTooltip.setContainer(\"body\");\n        if (this.getDock().getDockPosition() == UberfireDockPosition.EAST) {\n            itemTooltip.setPlacement(Placement.LEFT);\n        } else if (this.getDock().getDockPosition() == UberfireDockPosition.WEST) {\n            itemTooltip.setPlacement(Placement.RIGHT);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SideDockItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class SideDockItem extends AbstractSideDockItem {\n\n    private static WebAppResource CSS = GWT.create(WebAppResource.class);\n    private final ParameterizedCommand<String> openCommand;\n    private final ParameterizedCommand<String> closeCommand;\n\n    @UiField\n    Button itemButton;\n\n    @UiField\n    Tooltip itemTooltip;\n\n    private boolean opened;\n\n    private ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    SideDockItem(final UberfireDock dock,\n                 final ParameterizedCommand<String> openCommand,\n                 final ParameterizedCommand<String> closeCommand) {\n        super(dock);\n        this.openCommand = openCommand;\n        this.closeCommand = closeCommand;\n        initWidget(uiBinder.createAndBindUi(this));\n\n        createButton();\n        setupLocators(dock);\n    }\n\n    void createButton() {\n        itemButton.setSize(ButtonSize.SMALL);\n        itemButton.setType(ButtonType.LINK);\n        configureIcon(itemButton, getDock().getImageIcon());\n\n        String tooltip = getDock().getTooltip();\n        if (tooltip == null) {\n            tooltip = getDock().getLabel();\n        }\n\n        configureTooltip(itemTooltip, tooltip);\n\n        itemButton.addStyleName(CSS.CSS().sideDockItem());\n        itemButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                if (!isOpened()) {\n                    openAndExecuteExpandCommand();\n                } else {\n                    closeAndExecuteCommand();\n                }\n            }\n        });\n    }\n\n    @Override\n    public void open() {\n        opened = true;\n        itemButton.setActive(true);\n        itemButton.setType(ButtonType.INFO);\n        if (getDock().getImageIconFocused() != null) {\n            itemButton.remove(0);\n            configureImageIcon(itemButton,\n                               getDock().getImageIconFocused());\n        }\n    }\n\n    @Override\n    public void openAndExecuteExpandCommand() {\n        open();\n        openCommand.execute(getIdentifier());\n    }\n\n    @Override\n    public void close() {\n        opened = false;\n        itemButton.setActive(false);\n        itemButton.setType(ButtonType.LINK);\n        if (getDock().getImageIcon() != null) {\n            itemButton.remove(0);\n            configureImageIcon(itemButton,\n                               getDock().getImageIcon());\n        }\n    }\n\n    public void closeAndExecuteCommand() {\n        close();\n        closeCommand.execute(getIdentifier());\n    }\n\n    public boolean isOpened() {\n        return opened;\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, SideDockItem> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SideDockItem.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <g:HTMLPanel>\n\n    <b:Tooltip ui:field=\"itemTooltip\">\n      <b:Button ui:field=\"itemButton\"/>\n    </b:Tooltip>\n\n  </g:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SingleSideDockItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class SingleSideDockItem\n        extends AbstractDockItem {\n\n    private static WebAppResource CSS = GWT.create(WebAppResource.class);\n    private final ParameterizedCommand<String> openCommand;\n\n    @UiField\n    Button itemButton;\n\n    private ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    public SingleSideDockItem(UberfireDock dock,\n                              final ParameterizedCommand<String> openCommand) {\n        super(dock);\n        this.openCommand = openCommand;\n        initWidget(uiBinder.createAndBindUi(this));\n        createButtom();\n        setupLocators(dock);\n    }\n\n    private void createButtom() {\n        itemButton.addStyleName(CSS.CSS().singleDockItem());\n        itemButton.addStyleName(CSS.CSS().sideDockItem());\n        itemButton.setIcon(IconType.CHEVRON_RIGHT);\n        itemButton.setIconFixedWidth(true);\n        itemButton.setSize(ButtonSize.SMALL);\n        itemButton.setType(ButtonType.LINK);\n        itemButton.addClickHandler(event -> openAndExecuteExpandCommand());\n    }\n\n    @Override\n    public void openAndExecuteExpandCommand() {\n        openCommand.execute(getIdentifier());\n    }\n\n    @Override\n    public void open() {\n    }\n\n    @Override\n    public void close() {\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, SingleSideDockItem> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SingleSideDockItem.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Button ui:field=\"itemButton\"/>\n\n</ui:UiBinder>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SouthDockItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.uberfire.client.resources.WebAppResource;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class SouthDockItem\n        extends AbstractDockItem {\n\n    private static WebAppResource CSS = GWT.create(WebAppResource.class);\n    private final ParameterizedCommand<String> openCommand;\n    private final ParameterizedCommand<String> closeCommand;\n    @UiField\n    Button itemButton;\n    private boolean opened;\n    private ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    SouthDockItem(final UberfireDock dock,\n                  final ParameterizedCommand<String> openCommand,\n                  final ParameterizedCommand<String> closeCommand) {\n        super(dock);\n        this.openCommand = openCommand;\n        this.closeCommand = closeCommand;\n        initWidget(uiBinder.createAndBindUi(this));\n        createButton();\n        setupLocators(dock);\n    }\n\n    void createButton() {\n        itemButton.setSize(ButtonSize.SMALL);\n        itemButton.setType(ButtonType.LINK);\n        configureText(itemButton,\n                      getDock().getLabel());\n        configureIcon(itemButton,\n                      getDock().getImageIcon());\n        itemButton.getElement().addClassName(CSS.CSS().southDockItem());\n        itemButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                if (!opened) {\n                    open();\n                    openCommand.execute(getIdentifier());\n                } else {\n                    close();\n                    closeCommand.execute(getIdentifier());\n                }\n            }\n        });\n    }\n\n    @Override\n    public void openAndExecuteExpandCommand() {\n        open();\n        openCommand.execute(getIdentifier());\n    }\n\n    @Override\n    public void open() {\n        opened = true;\n        itemButton.setType(ButtonType.INFO);\n        if (getDock().getImageIconFocused() != null) {\n            itemButton.remove(0);\n            configureImageIcon(itemButton,\n                               getDock().getImageIconFocused());\n        }\n    }\n\n    @Override\n    public void close() {\n        opened = false;\n        itemButton.setType(ButtonType.LINK);\n        if (getDock().getImageIcon() != null) {\n            itemButton.remove(0);\n            configureImageIcon(itemButton,\n                               getDock().getImageIcon());\n        }\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, SouthDockItem> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/items/SouthDockItem.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Button ui:field=\"itemButton\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/docks/view/menu/MenuBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.menu;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.NavbarLink;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\n\n@ApplicationScoped\npublic class MenuBuilder {\n\n    @Inject\n    private AuthorizationManager authzManager;\n\n    @Inject\n    private User identity;\n\n    public Widget makeItem(final MenuItem item,\n                           boolean isRoot) {\n        if (!authzManager.authorize(item,\n                                    identity)) {\n            return null;\n        }\n\n        if (item instanceof MenuItemCommand) {\n            final MenuItemCommand cmdItem = (MenuItemCommand) item;\n            if (isRoot) {\n                final Button button = new Button(cmdItem.getCaption());\n                button.setSize(ButtonSize.SMALL);\n                button.setEnabled(item.isEnabled());\n                button.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent event) {\n                        cmdItem.getCommand().execute();\n                    }\n                });\n                item.addEnabledStateChangeListener(new EnabledStateChangeListener() {\n                    @Override\n                    public void enabledStateChanged(final boolean enabled) {\n                        button.setEnabled(enabled);\n                    }\n                });\n                return button;\n            } else {\n                final NavbarLink navbarLink = new NavbarLink();\n                navbarLink.setText(cmdItem.getCaption());\n                if (!item.isEnabled()) {\n                    navbarLink.addStyleName(\"disabled\");\n                }\n                navbarLink.addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent event) {\n                        cmdItem.getCommand().execute();\n                    }\n                });\n                item.addEnabledStateChangeListener(new EnabledStateChangeListener() {\n                    @Override\n                    public void enabledStateChanged(final boolean enabled) {\n                        if (enabled) {\n                            navbarLink.removeStyleName(\"disabled\");\n                        } else {\n                            navbarLink.addStyleName(\"disabled\");\n                        }\n                    }\n                });\n                return navbarLink;\n            }\n        } else if (item instanceof MenuGroup) {\n            final MenuGroup groups = (MenuGroup) item;\n            if (isRoot) {\n                final List<Widget> widgetList = new ArrayList<Widget>();\n                for (final MenuItem _item : groups.getItems()) {\n                    final Widget widget = makeItem(_item,\n                                                   false);\n                    if (widget != null) {\n                        widgetList.add(widget);\n                    }\n                }\n\n                if (widgetList.isEmpty()) {\n                    return null;\n                }\n\n                return makeDropDownMenuButton(groups.getCaption(),\n                                              widgetList);\n            } else {\n                final List<Widget> widgetList = new ArrayList<Widget>();\n                for (final MenuItem _item : groups.getItems()) {\n                    final Widget result = makeItem(_item,\n                                                   false);\n                    if (result != null) {\n                        widgetList.add(result);\n                    }\n                }\n\n                if (widgetList.isEmpty()) {\n                    return null;\n                }\n\n                return makeDropDownMenuButton(groups.getCaption(),\n                                              widgetList);\n            }\n        } else if (item instanceof MenuCustom) {\n            final Object result = ((MenuCustom) item).build();\n            if (result instanceof Widget) {\n                return (Widget) result;\n            }\n        }\n\n        return null;\n    }\n\n    private Widget makeDropDownMenuButton(final String caption,\n                                          final List<Widget> widgetList) {\n        final ButtonGroup buttonGroup = new ButtonGroup();\n        final Button dropdownButton = new Button(caption);\n        dropdownButton.setDataToggle(Toggle.DROPDOWN);\n        dropdownButton.setSize(ButtonSize.SMALL);\n        final DropDownMenu dropDownMenu = new DropDownMenu();\n        for (final Widget _item : widgetList) {\n            dropDownMenu.add(_item);\n        }\n        buttonGroup.add(dropdownButton);\n        buttonGroup.add(dropDownMenu);\n        return buttonGroup;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/resources/DocksCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface DocksCss extends CssResource {\n\n    @ClassName(\"gradientTopBottom\")\n    String gradientTopBottom();\n\n    @ClassName(\"gradientBottomTop\")\n    String gradientBottomTop();\n\n    @ClassName(\"sideDockItem\")\n    String sideDockItem();\n\n    @ClassName(\"singleDockItem\")\n    String singleDockItem();\n\n    @ClassName(\"hideElement\")\n    String hideElement();\n\n    @ClassName(\"dockExpanded\")\n    String dockExpanded();\n\n    @ClassName(\"dockExpandedLabelWest\")\n    String dockExpandedLabelWest();\n\n    @ClassName(\"dockExpandedButtonWest\")\n    String dockExpandedButtonWest();\n\n    @ClassName(\"dockExpandedLabelEast\")\n    String dockExpandedLabelEast();\n\n    @ClassName(\"dockExpandedButtonEast\")\n    String dockExpandedButtonEast();\n\n    @ClassName(\"dockExpandedButtonSouth\")\n    String dockExpandedButtonSouth();\n\n    @ClassName(\"dockExpandedLabelSouth\")\n    String dockExpandedLabelSouth();\n\n    @ClassName(\"dockExpandedTitlePanel\")\n    String dockExpandedTitlePanel();\n\n    @ClassName(\"dockExpandedContentPanel\")\n    String dockExpandedContentPanel();\n\n    @ClassName(\"dockExpandedContentPanelSouth\")\n    String dockExpandedContentPanelSouth();\n\n    @ClassName(\"buttonFocused\")\n    String buttonFocused();\n\n    @ClassName(\"southDockItem\")\n    String southDockItem();\n\n    @ClassName(\"resizableBar\")\n    String resizableBar();\n\n    @ClassName(\"dockExpandedContentButton\")\n    String dockExpandedContentButton();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/resources/WebAppResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface WebAppResource\n        extends\n        ClientBundle {\n\n    WebAppResource INSTANCE = GWT.create(WebAppResource.class);\n\n    @Source(\"css/docks.css\")\n    DocksCss CSS();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/java/org/uberfire/client/resources/i18n/DockConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface DockConstants\n        extends\n        Messages {\n\n    public static final DockConstants INSTANCE = GWT.create(DockConstants.class);\n\n    String OK();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/UberfireDocksClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <source path='client'/>\n\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/css/docks.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.sideDockItem {\n    margin-top: 5px;\n    margin-left: 2px;\n    margin-right: 2px;\n}\n\n.singleDockItem {\n    height: 100%;\n}\n\n.singleDockItem i {\n    height: 100%;\n}\n\n.hideElement {\n    display: none;\n}\n\n.gradientTopBottom {\n    border: 1px solid #ddd;\n}\n\n.gradientBottomTop {\n    border-right: 1px solid #ddd;\n    border-left: 1px solid #ddd;\n    text-align: center;\n}\n\n.dockExpanded {\n    height: 100%;\n    width: 100%;\n}\n\n.dockExpandedTitlePanel {\n    height: 36px;\n    border-bottom: 1px solid #ddd;\n}\n\n.dockExpandedContentPanel {\n    height: 100%;\n    width: 100%;\n}\n\n.dockExpandedContentPanelSouth {\n}\n\n.southDockItem {\n    margin-left: 5px;\n    margin-top: 5px;\n}\n\n.dockExpandedLabelWest {\n    float: left;\n    margin-left: 15px;\n    margin-top: 10px;\n    margin-bottom: 0px;\n}\n\n.dockExpandedButtonWest {\n    float: right;\n    margin-top: 6px;\n    margin-right: 15px\n}\n\n.dockExpandedLabelEast {\n    float: left;\n    margin-left: 15px;\n    margin-top: 10px;\n    margin-bottom: 0px;\n}\n\n.dockExpandedButtonEast {\n    float: right;\n    margin-top: 6px;\n    margin-right: 15px\n}\n\n.dockExpandedLabelSouth {\n    float: left;\n    margin-left: 15px;\n    margin-top: 10px;\n    margin-bottom: 0px;\n}\n\n.dockExpandedButtonSouth {\n    float: right;\n    margin-right: 15px;\n    margin-top: 6px;\n}\n\n.buttonFocused {\n    margin-left: 3px;\n    margin-right: 3px;\n}\n\n.resizableBar{\n    background-color: #ddd;\n    float: right;\n}\n\n.dockExpandedContentButton {\n    float: right;\n    margin-top: 6px;\n    margin-right: 5px\n}\n\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_de.properties",
    "content": "OK=OK\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=Aceptar\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "OK=OK\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/main/resources/org/uberfire/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "OK=确定\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/UberfireDocksImplTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.docks.view.DocksBar;\nimport org.uberfire.client.docks.view.DocksBars;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockContainerReadyEvent;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDockReadyEvent;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.toolbar.IconType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberfireDocksImplTest {\n\n    private final String SOME_PERSPECTIVE = \"SomePerspective\";\n    private final String ANOTHER_PERSPECTIVE = \"AnotherPerspective\";\n    @Mock\n    private DocksBars docksBars;\n    @Mock\n    private DockLayoutPanel dockLayoutPanel;\n    @Mock\n    EventSourceMock<UberfireDockReadyEvent> dockReadyEvent;\n    private UberfireDocksImpl uberfireDocks;\n    private Command resizeCommand;\n    private UberfireDock dock0 = new UberfireDock(UberfireDockPosition.SOUTH,\n                                                  IconType.CHEVRON_RIGHT.name(),\n                                                  new DefaultPlaceRequest(\"welcome\"),\n                                                  SOME_PERSPECTIVE)\n            .withLabel(\"albel\");\n    private UberfireDock dock1 = new UberfireDock(UberfireDockPosition.SOUTH,\n                                                  IconType.AMBULANCE.name(),\n                                                  new DefaultPlaceRequest(\"another\"),\n                                                  SOME_PERSPECTIVE)\n            .withLabel(\"Another\").withSize(200);\n    private UberfireDock dock2 = new UberfireDock(UberfireDockPosition.EAST,\n                                                  IconType.ADJUST.name(),\n                                                  new DefaultPlaceRequest(\"test\"),\n                                                  SOME_PERSPECTIVE);\n    private UberfireDock dock3 = new UberfireDock(UberfireDockPosition.EAST,\n                                                  IconType.BELL_ALT.name(),\n                                                  new DefaultPlaceRequest(\"welcome\"),\n                                                  ANOTHER_PERSPECTIVE);\n    private UberfireDock dock4 = new UberfireDock(UberfireDockPosition.WEST,\n                                                  IconType.FACETIME_VIDEO.name(),\n                                                  new DefaultPlaceRequest(\"welcome\"),\n                                                  ANOTHER_PERSPECTIVE)\n            .withLabel(\"Welcome\").withSize(200);\n\n    @Before\n    public void setup() {\n        uberfireDocks = new UberfireDocksImpl(docksBars,\n                                              dockReadyEvent);\n        resizeCommand = () -> {\n        };\n    }\n\n    @Test\n    public void setupDocks() {\n        uberfireDocks.setup(new UberfireDockContainerReadyEvent());\n        verify(docksBars).setup();\n    }\n\n    @Test\n    public void add() {\n\n        uberfireDocks.add(dock0,\n                          dock1,\n                          dock2,\n                          dock3,\n                          dock4);\n\n        List<UberfireDock> docksSomePerspective = uberfireDocks.docksPerPerspective.get(SOME_PERSPECTIVE);\n        List<UberfireDock> docksAnotherPerspective = uberfireDocks.docksPerPerspective.get(ANOTHER_PERSPECTIVE);\n\n        assertEquals(3,\n                     docksSomePerspective.size());\n        assertEquals(2,\n                     docksAnotherPerspective.size());\n    }\n\n    @Test\n    public void perspectiveChangeEvent() {\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.add(dock0,\n                          dock1);\n\n        uberfireDocks.perspectiveChangeEvent(new PerspectiveChange(null,\n                                                                   null,\n                                                                   null,\n                                                                   SOME_PERSPECTIVE));\n\n        assertEquals(SOME_PERSPECTIVE,\n                     uberfireDocks.currentPerspective);\n        verify(this.docksBars,\n               times(1)).clearAndHideAllDocks();\n        verify(this.docksBars,\n               times(1)).addDock(dock0);\n        verify(this.docksBars,\n               times(1)).addDock(dock1);\n\n        verify(this.docksBars,\n               times(docksBars.size())).show(any(DocksBar.class));\n    }\n\n    @Test\n    public void remove() {\n        uberfireDocks.add(dock0,\n                          dock1);\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        uberfireDocks.remove(dock0);\n\n        verify(docksBars,\n               times(2)).isReady(any());\n\n        verify(docksBars,\n               times(1)).clearAndCollapseDocks(any());\n\n        verify(docksBars,\n               never()).addDock(dock0);\n        verify(docksBars,\n               never()).addDock(dock1);\n    }\n\n    @Test\n    public void disableDock() {\n        when(docksBars.isReady(any())).thenReturn(true);\n        uberfireDocks.add(dock0,\n                          dock1);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.hide(UberfireDockPosition.WEST,\n                           SOME_PERSPECTIVE);\n\n        verify(this.docksBars).clearAndHide(UberfireDockPosition.WEST);\n    }\n\n    @Test\n    public void enableDock() {\n        when(docksBars.isReady(any())).thenReturn(true);\n        uberfireDocks.add(dock0,\n                          dock1);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.hide(UberfireDockPosition.WEST,\n                           SOME_PERSPECTIVE);\n        uberfireDocks.show(UberfireDockPosition.WEST,\n                           SOME_PERSPECTIVE);\n        verify(this.docksBars).show(UberfireDockPosition.WEST);\n    }\n\n    @Test\n    public void closeDockTest() {\n        when(docksBars.isReady(any())).thenReturn(true);\n        uberfireDocks.add(dock0,\n                          dock1);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.open(dock0);\n        uberfireDocks.close(dock0);\n\n        verify(this.docksBars).close(dock0);\n    }\n\n    @Test\n    public void toggleDockTest() {\n        when(docksBars.isReady(any())).thenReturn(true);\n        uberfireDocks.add(dock0,\n                          dock1);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        when(docksBars.isReady(any())).thenReturn(true);\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.toggle(dock0);\n        verify(this.docksBars).toggle(dock0);\n    }\n\n    @Test\n    public void openCloseDelayedOperationsTest() {\n        when(docksBars.isReady(any())).thenReturn(false);\n        uberfireDocks.add(dock0,\n                          dock1);\n        uberfireDocks.currentPerspective = SOME_PERSPECTIVE;\n\n        List<DocksBar> docksBars = generateDocksBars();\n        when(this.docksBars.getDocksBars()).thenReturn(docksBars);\n\n        uberfireDocks.open(dock0);\n        verify(this.docksBars,\n               never()).open(dock0);\n\n        uberfireDocks.close(dock0);\n        verify(this.docksBars,\n               never()).close(dock0);\n\n        assertEquals(2,\n                     uberfireDocks.delayedCommandsPerPerspective.get(SOME_PERSPECTIVE).size());\n\n        PerspectiveChange event = mock(PerspectiveChange.class);\n        when(event.getIdentifier()).thenReturn(\"Another\");\n\n        uberfireDocks.perspectiveChangeEvent(event);\n\n        verify(this.docksBars,\n               never()).open(dock0);\n        verify(this.docksBars,\n               never()).close(dock0);\n\n        when(event.getIdentifier()).thenReturn(SOME_PERSPECTIVE);\n        uberfireDocks.perspectiveChangeEvent(event);\n\n        verify(this.docksBars).open(dock0);\n        verify(this.docksBars).close(dock0);\n\n        assertNull(uberfireDocks.delayedCommandsPerPerspective.get(SOME_PERSPECTIVE));\n    }\n\n    private List<DocksBar> generateDocksBars() {\n\n        List<DocksBar> docksBar = new ArrayList<DocksBar>();\n\n        docksBar.add(createDocksBar(UberfireDockPosition.WEST));\n        docksBar.add(createDocksBar(UberfireDockPosition.EAST));\n        docksBar.add(createDocksBar(UberfireDockPosition.SOUTH));\n\n        return docksBar;\n    }\n\n    private DocksBar createDocksBar(final UberfireDockPosition west) {\n        return new DocksBar(west) {\n            @Override\n            protected void setupChildBars(UberfireDockPosition position) {\n            }\n\n            @Override\n            public boolean equals(Object obj) {\n                DocksBar obj1 = (DocksBar) obj;\n                return getPosition().equals(obj1.getPosition());\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/DockResizeBarTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport com.google.gwt.user.client.Element;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DockResizeBarTest {\n\n    private static final String POSITION_SHORT_NAME = \"W\";\n\n    @Mock\n    private Element elementMock;\n\n    @Mock\n    private UberfireDockPosition dockPositionMock;\n\n    @Mock\n    private DocksBar docksBarMock;\n\n    private DockResizeBar dockResizeBar;\n\n    @Before\n    public void setUp() throws Exception {\n        when(docksBarMock.getPosition()).thenReturn(dockPositionMock);\n        when(dockPositionMock.getShortName()).thenReturn(POSITION_SHORT_NAME);\n\n        dockResizeBar = spy(new DockResizeBar(docksBarMock));\n\n        when(dockResizeBar.getElement()).thenReturn(elementMock);\n    }\n\n    @Test\n    public void testOuiaComponentTypeAttribute() {\n        assertEquals(\"resize-docks-bar\", dockResizeBar.ouiaComponentType().getValue());\n    }\n\n    @Test\n    public void testOuiaComponentIdAttribute() {\n        assertEquals(\"resize-docks-bar-W\", dockResizeBar.ouiaComponentId().getValue());\n    }\n\n    @Test\n    public void testOuiaAttributeRenderer() {\n        final OuiaComponentTypeAttribute componentTypeAttribute = dockResizeBar.ouiaComponentType();\n        dockResizeBar.ouiaAttributeRenderer().accept(componentTypeAttribute);\n        verify(elementMock).setAttribute(componentTypeAttribute.getName(), componentTypeAttribute.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/DocksBarsTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.client.docks.view.bars.DocksCollapsedBar;\nimport org.uberfire.client.docks.view.menu.MenuBuilder;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocksContainer;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.toolbar.IconType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DocksBarsTest {\n\n    private final String SOME_PERSPECTIVE = \"SomePerspective\";\n    @Mock\n    private UberfireDocksContainer uberfireDocksContainer;\n    @Mock\n    private PlaceManager placeManager;\n    @Mock\n    private MenuBuilder menuBuilder;\n    @Mock\n    private EventSourceMock<UberfireDocksInteractionEvent> dockInteractionEvent;\n    @Mock\n    private AuthorizationManager authorizationManager;\n    @Mock\n    private User identity;\n    private DocksBars docksBars;\n    private UberfireDock dock0 = new UberfireDock(UberfireDockPosition.SOUTH,\n                                                  IconType.CHEVRON_RIGHT.name(),\n                                                  new DefaultPlaceRequest(\"welcome\"),\n                                                  SOME_PERSPECTIVE)\n            .withLabel(\"label\");\n\n    @Before\n    public void setup() {\n        docksBars = new DocksBars(placeManager,\n                                  menuBuilder,\n                                  dockInteractionEvent,\n                                  uberfireDocksContainer,\n                                  authorizationManager,\n                                  identity);\n    }\n\n    @Test\n    public void setupDocks() {\n        docksBars.setup();\n\n        assertEquals(3,\n                     docksBars.getDocksBars().size());\n        verify(uberfireDocksContainer,\n               times(3))\n                .add(eq(UberfireDockPosition.EAST),\n                     any(Widget.class),\n                     any(Double.class));\n        verify(uberfireDocksContainer,\n               times(3))\n                .add(eq(UberfireDockPosition.WEST),\n                     any(Widget.class),\n                     any(Double.class));\n        verify(uberfireDocksContainer,\n               times(3))\n                .add(eq(UberfireDockPosition.SOUTH),\n                     any(Widget.class),\n                     any(Double.class));\n    }\n\n    @Test\n    public void addDock() {\n        docksBars.setup();\n\n        DocksBar dockBar = docksBars.getDockBar(dock0);\n        DocksBar targetDockSpy = spy(dockBar);\n\n        DocksBars dockBarsSpy = spy(docksBars);\n        when(dockBarsSpy.getDockBar(dock0)).thenReturn(targetDockSpy);\n\n        dockBarsSpy.addDock(dock0);\n\n        verify(targetDockSpy)\n                .addDock(eq(dock0),\n                         any(ParameterizedCommand.class),\n                         any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void getDockBar() {\n        docksBars.setup();\n        DocksBar targetDockBar = docksBars.getDockBar(dock0);\n        assertEquals(dock0.getDockPosition(),\n                     targetDockBar.getPosition());\n    }\n\n    @Test\n    public void clearAndCollapseAllDocks() {\n\n        docksBars.setup();\n        DocksBars docksBarsSpy = spy(docksBars);\n        List<DocksBar> dockBars = new ArrayList<DocksBar>();\n        DocksBar dock1 = createDocksBarMock();\n        dockBars.add(dock1);\n        DocksBar dock2 = createDocksBarMock();\n        dockBars.add(dock2);\n        when(docksBarsSpy.getDocksBars()).thenReturn(dockBars);\n\n        docksBarsSpy.clearAndHideAllDocks();\n\n        verify(dock1).clearAll();\n        verify(dock2).clearAll();\n        //2 for each dock(collapsed/expanded/resize)\n        verify(uberfireDocksContainer,\n               times(6)).hide(Mockito.<Widget>any());\n    }\n\n    @Test\n    public void clearAndCollapse() {\n\n        docksBars.setup();\n        DocksBars docksBarsSpy = spy(docksBars);\n        DocksBar dock1 = createDocksBarMock();\n        when(docksBarsSpy.getDockBar(UberfireDockPosition.EAST)).thenReturn(dock1);\n\n        docksBarsSpy.clearAndHide(UberfireDockPosition.EAST);\n\n        verify(dock1).clearAll();\n        verify(docksBarsSpy).resizeDeferred();\n        verify(uberfireDocksContainer,\n               times(3)).hide(Mockito.<Widget>any());\n    }\n\n    @Test\n    public void expand() {\n        docksBars.setup();\n        docksBars.addDock(dock0);\n\n        docksBars.show(docksBars.getDockBar(dock0));\n\n        verify(uberfireDocksContainer,\n               times(1)).show(any(Widget.class));\n    }\n\n    @Test\n    public void dockOpenCommand() {\n        DocksBars docksBarsSpy = spy(docksBars);\n\n        docksBarsSpy.setup();\n        docksBarsSpy.addDock(dock0);\n\n        Mockito.doNothing().when(docksBarsSpy).openDock(dock0,\n                                                        docksBars.getDockBar(dock0));\n\n        ParameterizedCommand<String> dockSelectCommand = docksBarsSpy\n                .createDockOpenCommand(dock0,\n                                       docksBars.getDockBar(dock0));\n\n        dockSelectCommand.execute(dock0.getIdentifier());\n\n        verify(docksBarsSpy).openDock(dock0,\n                                      docksBars.getDockBar(dock0));\n        verify(uberfireDocksContainer).resize();\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.OPENED));\n    }\n\n    @Test\n    public void dockToggleTest() {\n        DocksBars docksBarsSpy = spy(docksBars);\n\n        docksBarsSpy.setup();\n        docksBarsSpy.addDock(dock0);\n\n        Mockito.doNothing().when(docksBarsSpy).openDock(dock0,\n                                                        docksBars.getDockBar(dock0));\n        Mockito.doNothing().when(docksBarsSpy).closeDock(dock0,\n                                                         docksBars.getDockBar(dock0));\n\n        docksBarsSpy.toggle(dock0);\n\n        verify(docksBarsSpy).openDock(dock0,\n                                      docksBars.getDockBar(dock0));\n\n        when(docksBarsSpy.isOpenWith(dock0,\n                                     docksBars.getDockBar(dock0))).thenReturn(true);\n\n        docksBarsSpy.toggle(dock0);\n\n        verify(docksBarsSpy).closeDockProcess(dock0,\n                                              docksBars.getDockBar(dock0));\n\n        docksBarsSpy.toggle(dock0);\n\n        verify(docksBarsSpy).openDock(dock0,\n                                      docksBars.getDockBar(dock0));\n    }\n\n    @Test\n    public void dockOpenCommandSingleMode() {\n        DocksBars docksBarsSpy = spy(docksBars);\n\n        docksBarsSpy.setup();\n        docksBarsSpy.addDock(dock0);\n\n        DocksBar dockBar = spy(docksBars.getDockBar(dock0));\n\n        Mockito.doNothing().when(docksBarsSpy).openDock(dock0,\n                                                        dockBar);\n        when(dockBar.isCollapsedBarInSingleMode()).thenReturn(true);\n\n        ParameterizedCommand<String> dockOpenCommand = docksBarsSpy.createDockOpenCommand(dock0,\n                                                                                          dockBar);\n\n        dockOpenCommand.execute(dock0.getIdentifier());\n\n        verify(docksBarsSpy).openDock(dock0,\n                                      dockBar);\n        verify(uberfireDocksContainer).resize();\n        verify(docksBarsSpy).hide(dockBar.getCollapsedBar());\n        verify(uberfireDocksContainer,\n               times(1)).hide(any(Widget.class));\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.OPENED));\n    }\n\n    @Test\n    public void dockCloseCommand() {\n        DocksBars spy = spy(docksBars);\n\n        spy.setup();\n        spy.addDock(dock0);\n\n        Mockito.doNothing().when(spy).closeDock(dock0,\n                                                docksBars.getDockBar(dock0));\n\n        ParameterizedCommand<String> dockCloseCommand = spy\n                .createDockCloseCommand(dock0,\n                                        docksBars.getDockBar(dock0));\n\n        dockCloseCommand.execute(dock0.getIdentifier());\n\n        verify(spy).closeDock(dock0,\n                              docksBars.getDockBar(dock0));\n        verify(uberfireDocksContainer).resize();\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.CLOSED));\n    }\n\n    @Test\n    public void dockCloseTest() {\n        DocksBars docksBars = spy(this.docksBars);\n\n        docksBars.setup();\n        docksBars.addDock(dock0);\n\n        ParameterizedCommand<String> dockCloseCommand = docksBars\n                .createDockCloseCommand(dock0,\n                                        docksBars.getDockBar(dock0));\n\n        dockCloseCommand.execute(dock0.getIdentifier());\n\n        Mockito.doNothing().when(docksBars).closeDock(dock0,\n                                                      this.docksBars.getDockBar(dock0));\n\n        docksBars.close(dock0);\n\n        verify(docksBars).closeDock(dock0,\n                                    this.docksBars.getDockBar(dock0));\n        verify(uberfireDocksContainer).resize();\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.CLOSED));\n    }\n\n    @Test\n    public void doNothingWhenICloseANotClosedTest() {\n        DocksBars docksBars = spy(this.docksBars);\n\n        docksBars.setup();\n        docksBars.addDock(dock0);\n\n        Mockito.doNothing().when(docksBars).closeDock(dock0,\n                                                      this.docksBars.getDockBar(dock0));\n\n        docksBars.close(dock0);\n\n        verify(docksBars,\n               times(0)).closeDock(dock0,\n                                   this.docksBars.getDockBar(dock0));\n        verify(uberfireDocksContainer,\n               times(0)).resize();\n        verify(dockInteractionEvent,\n               times(0)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.CLOSED));\n    }\n\n    @Test\n    public void dockCloseCommandSingleMode() {\n        DocksBars docksBarsSpy = spy(docksBars);\n\n        docksBarsSpy.setup();\n        docksBarsSpy.addDock(dock0);\n\n        DocksBar dockBar = spy(docksBars.getDockBar(dock0));\n\n        Mockito.doNothing().when(docksBarsSpy).closeDock(any(),\n                                                         eq(dockBar));\n        when(dockBar.isCollapsedBarInSingleMode()).thenReturn(true);\n\n        ParameterizedCommand<String> dockCloseCommand = docksBarsSpy.createDockCloseCommand(dock0,\n                                                                                            dockBar);\n\n        dockCloseCommand.execute(dock0.getIdentifier());\n\n        verify(docksBarsSpy).closeDock(any(),\n                                       eq(dockBar));\n        verify(uberfireDocksContainer).resize();\n        verify(docksBarsSpy).show(dockBar.getCollapsedBar());\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(dock0,\n                                                                UberfireDocksInteractionEvent.InteractionType.CLOSED));\n    }\n\n    @Test\n    public void dockResizeCommand() {\n        final double simulatedSize = 0d;\n        final DocksBars docksBarsSpy = spy(docksBars);\n\n        docksBarsSpy.setup();\n        docksBarsSpy.addDock(dock0);\n\n        Mockito.doReturn(true).when(docksBarsSpy).sizeIsValid(any(Double.class),\n                                                              any(DocksBar.class));\n\n        final DocksBar dockBar = spy(docksBars.getDockBar(dock0));\n        ParameterizedCommand<Double> dockResizeCommand = docksBarsSpy.createResizeCommand(dockBar);\n\n        dockResizeCommand.execute(simulatedSize);\n        verify(dockBar).setExpandedSize(simulatedSize);\n        verify(uberfireDocksContainer).resize();\n        verify(dockInteractionEvent,\n               times(1)).fire(new UberfireDocksInteractionEvent(UberfireDockPosition.SOUTH,\n                                                                UberfireDocksInteractionEvent.InteractionType.RESIZED));\n    }\n\n    @Test\n    public void isReadyTest() {\n\n        final DocksBars docksBarsSpy = spy(docksBars);\n\n        when(uberfireDocksContainer.isReady()).thenReturn(false);\n        assertFalse(docksBarsSpy.isReady(UberfireDockPosition.EAST));\n\n        when(uberfireDocksContainer.isReady()).thenReturn(true);\n        assertFalse(docksBarsSpy.isReady(UberfireDockPosition.EAST));\n\n        docksBars.setup();\n        when(uberfireDocksContainer.isReady()).thenReturn(true);\n        assertTrue(docksBarsSpy.isReady(UberfireDockPosition.EAST));\n    }\n\n    @Test\n    public void emptyDockBarShouldBeReady() {\n        final DocksBars docksBarsSpy = spy(docksBars);\n        docksBars.setup();\n        when(uberfireDocksContainer.isReady()).thenReturn(true);\n        DocksBar dockBar = docksBarsSpy.getDockBar(UberfireDockPosition.EAST);\n\n        assertFalse(dockBar.hasDocksItems());\n        assertTrue(docksBarsSpy.isReady(UberfireDockPosition.EAST));\n    }\n\n    private DocksBar createDocksBarMock() {\n        DocksBar mock = mock(DocksBar.class);\n        when(mock.getCollapsedBar()).thenReturn(mock(DocksCollapsedBar.class));\n        return mock;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/DocksBars_OpenDockTest.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.client.docks.view.bars.DocksCollapsedBar;\nimport org.uberfire.client.docks.view.bars.DocksExpandedBar;\nimport org.uberfire.client.docks.view.menu.MenuBuilder;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDocksContainer;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DocksBars_OpenDockTest {\n\n    @Mock\n    private UberfireDocksContainer uberfireDocksContainer;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private MenuBuilder menuBuilder;\n\n    @InjectMocks\n    private DocksBars docksBars;\n\n    @Captor\n    private ArgumentCaptor<PlaceRequest> placeRequestArgumentCaptor;\n\n    @Test\n    public void testOpenDockParametersArePreserved() throws Exception {\n\n        final DefaultPlaceRequest myPlace = new DefaultPlaceRequest(\"myPlace\");\n\n        myPlace.addParameter(\"my_parameter_key\",\n                             \"my_parameter_value\");\n\n        docksBars.openDock(getTargetDock(myPlace),\n                           getDocksBar());\n\n        verify(placeManager).goTo(placeRequestArgumentCaptor.capture(),\n                                  Mockito.<HasWidgets>any());\n\n        final PlaceRequest placeRequest = placeRequestArgumentCaptor.getValue();\n        assertEquals(\"myPlace\",\n                     placeRequest.getIdentifier());\n        assertEquals(\"my_parameter_value\",\n                     placeRequest.getParameter(\"my_parameter_key\",\n                                               \"\"));\n    }\n\n    private UberfireDock getTargetDock(final DefaultPlaceRequest placeRequest) {\n        final UberfireDock targetDock = mock(UberfireDock.class);\n        when(targetDock.getPlaceRequest()).thenReturn(placeRequest);\n        return targetDock;\n    }\n\n    private DocksBar getDocksBar() {\n        final DocksBar docksBar = mock(DocksBar.class);\n        when(docksBar.getCollapsedBar()).thenReturn(mock(DocksCollapsedBar.class));\n        final DocksExpandedBar docksExpandedBar = mock(DocksExpandedBar.class);\n        when(docksExpandedBar.targetPanel()).thenReturn(mock(FlowPanel.class));\n        when(docksBar.getExpandedBar()).thenReturn(docksExpandedBar);\n        when(docksBar.getExpandedBar()).thenReturn(mock(DocksExpandedBar.class));\n        return docksBar;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/bars/DocksCollapsedBarTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.bars;\n\nimport com.google.gwt.user.client.Element;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DocksCollapsedBarTest {\n\n    private static final String POSITION_SHORT_NAME = \"W\";\n\n    @Mock\n    private Element elementMock;\n\n    @Mock\n    private UberfireDockPosition dockPositionMock;\n\n    private DocksCollapsedBar docksCollapsedBar;\n\n    @Before\n    public void setUp() throws Exception {\n        when(dockPositionMock.getShortName()).thenReturn(POSITION_SHORT_NAME);\n\n        docksCollapsedBar = spy(new DocksCollapsedBar(dockPositionMock));\n\n        doReturn(elementMock).when(docksCollapsedBar).getElement();\n    }\n\n    @Test\n    public void testOuiaComponentTypeAttribute() {\n        assertEquals(\"collapsed-docks-bar\", docksCollapsedBar.ouiaComponentType().getValue());\n    }\n\n    @Test\n    public void testOuiaComponentIdAttribute() {\n        assertEquals(\"collapsed-docks-bar-W\", docksCollapsedBar.ouiaComponentId().getValue());\n    }\n\n    @Test\n    public void testOuiaAttributeRenderer() {\n        final OuiaComponentTypeAttribute componentTypeAttribute = docksCollapsedBar.ouiaComponentType();\n        docksCollapsedBar.ouiaAttributeRenderer().accept(componentTypeAttribute);\n        verify(elementMock).setAttribute(componentTypeAttribute.getName(), componentTypeAttribute.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/bars/DocksExpandedBarTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.bars;\n\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DocksExpandedBarTest {\n\n    @Mock\n    private Element elementMock;\n\n    private DocksExpandedBar docksExpandedBar;\n    private FlowPanel targetPanel;\n\n    @Before\n    public void setup() {\n        DocksExpandedBar dock = new DocksExpandedBar(UberfireDockPosition.WEST);\n        targetPanel = mock(FlowPanel.class);\n        dock.targetPanel = targetPanel;\n        docksExpandedBar = spy(dock);\n\n        doReturn(elementMock).when(docksExpandedBar).getElement();\n    }\n\n    @Test\n    public void resizeTest() {\n        docksExpandedBar.onResize();\n        verify(docksExpandedBar).resizeTargetPanel();\n    }\n\n    @Test\n    public void resizeWithAnInvalidWidthShouldNeverSetupSizeOfTargetPanel() {\n        doReturn(0).when(docksExpandedBar).calculateDockHeight();\n        doReturn(0).when(docksExpandedBar).calculateDockWidth();\n\n        docksExpandedBar.onResize();\n\n        verify(targetPanel,\n               never()).setPixelSize(anyInt(),\n                                     anyInt());\n    }\n\n    @Test\n    public void resizeWithAValidWidthShouldNeverSetupSizeOfTargetPanel() {\n        doReturn(10).when(docksExpandedBar).calculateDockHeight();\n        doReturn(110).when(docksExpandedBar).calculateDockWidth();\n\n        docksExpandedBar.onResize();\n\n        verify(targetPanel,\n               never()).setPixelSize(10,\n                                     110);\n    }\n\n    @Test\n    public void setPanelSizeWithAnInvalidWidthShouldNeverSetupSizeOfTargetPanel() {\n\n        docksExpandedBar.setPanelSize(0,\n                                      -1);\n\n        verify(targetPanel,\n               never()).setPixelSize(anyInt(),\n                                     anyInt());\n    }\n\n    @Test\n    public void setPanelSizeAValidWidthShouldNeverSetupSizeOfTargetPanel() {\n\n        docksExpandedBar.setPanelSize(1,\n                                      10);\n\n        verify(targetPanel).setPixelSize(1,\n                                         10);\n    }\n\n    @Test\n    public void testOuiaComponentTypeAttribute() {\n        assertEquals(\"expanded-docks-bar\", docksExpandedBar.ouiaComponentType().getValue());\n    }\n\n    @Test\n    public void testOuiaComponentIdAttribute() {\n        assertEquals(\"expanded-docks-bar-W\", docksExpandedBar.ouiaComponentId().getValue());\n    }\n\n    @Test\n    public void testOuiaAttributeRenderer() {\n        final OuiaComponentTypeAttribute componentTypeAttribute = docksExpandedBar.ouiaComponentType();\n        docksExpandedBar.ouiaAttributeRenderer().accept(componentTypeAttribute);\n        verify(elementMock).setAttribute(componentTypeAttribute.getName(), componentTypeAttribute.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/items/AbstractDockItemOuiaTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.user.client.Element;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class AbstractDockItemOuiaTest {\n\n    @Mock\n    private Element elementMock;\n\n    @Mock\n    private UberfireDock dockMock;\n\n    @Before\n    public void setUp() throws Exception {\n        when(dockMock.getIdentifier()).thenReturn(\"xyz\");\n    }\n\n    @Test\n    public void testSouthDockItem() {\n        when(dockMock.getDockPosition()).thenReturn(UberfireDockPosition.SOUTH);\n        assertOuiaCompliance(new SouthDockItem(dockMock,\n                                               mock(ParameterizedCommand.class),\n                                               mock(ParameterizedCommand.class)));\n    }\n\n    @Test\n    public void testSideDockItems() {\n        when(dockMock.getDockPosition()).thenReturn(UberfireDockPosition.WEST);\n        assertOuiaCompliance(new SideDockItem(dockMock,\n                                              mock(ParameterizedCommand.class),\n                                              mock(ParameterizedCommand.class)));\n\n        assertOuiaCompliance(new SingleSideDockItem(dockMock,\n                                                    mock(ParameterizedCommand.class)));\n    }\n\n    private void assertOuiaCompliance(AbstractDockItem dockItem) {\n        dockItem = spy(dockItem);\n        doReturn(elementMock).when(dockItem).getElement();\n\n        final OuiaComponentTypeAttribute componentTypeAttribute = dockItem.ouiaComponentType();\n\n        assertEquals(\"docks-item\", componentTypeAttribute.getValue());\n\n        assertEquals(\"docks-item-xyz\", dockItem.ouiaComponentId().getValue());\n\n        dockItem.ouiaAttributeRenderer().accept(componentTypeAttribute);\n        verify(elementMock).setAttribute(componentTypeAttribute.getName(), componentTypeAttribute.getValue());\n\n        reset(elementMock);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/items/SideDockItemTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SideDockItemTest {\n\n    @Mock\n    private ImageResource imageResource, imageResourceFocused;\n\n    @Mock\n    private PlaceRequest placeRequest;\n\n    private ParameterizedCommand<String> emptyCommand;\n\n    private UberfireDock dockWithFontIcon, dockWithImageIcon;\n\n    private SideDockItem sideDockWithFontIcon, sideDockWithImageIcon;\n\n    @Before\n    public void setup() {\n        dockWithFontIcon = new UberfireDock(UberfireDockPosition.EAST,\n                                            \"BRIEFCASE\",\n                                            placeRequest,\n                                            \"\")\n                .withSize(450)\n                .withLabel(\"dock\");\n        dockWithImageIcon = new UberfireDock(UberfireDockPosition.EAST,\n                                             imageResource,\n                                             imageResourceFocused,\n                                             placeRequest,\n                                             \"\")\n                .withSize(450)\n                .withLabel(\"dock\");\n\n        sideDockWithFontIcon = spy(new SideDockItem(dockWithFontIcon,\n                                                    emptyCommand,\n                                                    emptyCommand));\n        sideDockWithImageIcon = spy(new SideDockItem(dockWithImageIcon,\n                                                     emptyCommand,\n                                                     emptyCommand));\n\n        emptyCommand = parameter -> {\n        };\n    }\n\n    @Test\n    public void createSideDockItemWithFontIconTest() {\n        sideDockWithFontIcon.createButton();\n\n        verify(sideDockWithFontIcon).configureIcon(any(Button.class),\n                                                   eq((ImageResource) null));\n        verify(sideDockWithFontIcon,\n               never()).configureImageIcon(any(Button.class),\n                                           any(ImageResource.class));\n    }\n\n    @Test\n    public void openSideDockItemWithFontIconTest() {\n        sideDockWithFontIcon.open();\n\n        verify(sideDockWithFontIcon,\n               never()).configureImageIcon(any(Button.class),\n                                           any(ImageResource.class));\n    }\n\n    @Test\n    public void closeSideDockItemWithFontIconTest() {\n        sideDockWithFontIcon.close();\n\n        verify(sideDockWithFontIcon,\n               never()).configureImageIcon(any(Button.class),\n                                           any(ImageResource.class));\n    }\n\n    @Test\n    public void createSideDockItemWithImageIconTest() {\n        sideDockWithImageIcon.createButton();\n\n        verify(sideDockWithImageIcon).configureIcon(any(Button.class),\n                                                    eq(imageResource));\n        verify(sideDockWithImageIcon).configureImageIcon(any(Button.class),\n                                                         eq(imageResource));\n    }\n\n    @Test\n    public void openSouthDockItemWithImageIconTest() {\n        sideDockWithImageIcon.open();\n\n        verify(sideDockWithImageIcon).configureImageIcon(any(Button.class),\n                                                         eq(imageResourceFocused));\n    }\n\n    @Test\n    public void closeSouthDockItemWithImageIconTest() {\n        sideDockWithImageIcon.close();\n\n        verify(sideDockWithImageIcon).configureImageIcon(any(Button.class),\n\n                                                         eq(imageResource));\n    }\n\n    @Test\n    public void createSideDockItemWithTooltipTest() {\n        final String dock_screenID = \"SCREEN_ID\";\n        final String dock_label = \"DOCK TITLE\";\n        final String dock_tooltip = \"DOCK TOOLTIP\";\n\n        UberfireDock dock1 = new UberfireDock(UberfireDockPosition.EAST,\n                                              \"BRIEFCASE\",\n                                              placeRequest,\n                                              \"\")\n                .withLabel(dock_label)\n                .withTooltip(dock_tooltip);\n        SideDockItem tested1 = spy(new SideDockItem(dock1, emptyCommand, emptyCommand));\n        tested1.createButton();\n        verify(tested1).configureTooltip(any(Tooltip.class), eq(dock_tooltip));\n\n        UberfireDock dock2 = new UberfireDock(UberfireDockPosition.EAST,\n                                              \"BRIEFCASE\",\n                                              placeRequest,\n                                              \"\")\n                .withLabel(dock_label);\n        SideDockItem tested2 = spy(new SideDockItem(dock2, emptyCommand, emptyCommand));\n        tested2.createButton();\n        verify(tested2).configureTooltip(any(Tooltip.class), eq(dock_label));\n\n        UberfireDock dock3 = new UberfireDock(UberfireDockPosition.EAST,\n                                              \"BRIEFCASE\",\n                                              new DefaultPlaceRequest(dock_screenID),\n                                              \"\");\n        SideDockItem tested3 = spy(new SideDockItem(dock3, emptyCommand, emptyCommand));\n        tested3.createButton();\n        verify(tested3).configureTooltip(any(Tooltip.class), eq(dock_screenID));\n\n        Tooltip tooltip = new Tooltip();\n        sideDockWithImageIcon.configureTooltip(tooltip, sideDockWithImageIcon.getLabel());\n        assertEquals(sideDockWithImageIcon.getLabel(), tooltip.getTitle());\n        assertEquals(Placement.LEFT, tooltip.getPlacement());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-simple-docks/uberfire-simple-docks-client/src/test/java/org/uberfire/client/docks/view/items/SouthDockItemTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.docks.view.items;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.inOrder;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SouthDockItemTest {\n\n    @Mock\n    private ImageResource imageResource, imageResourceFocused;\n\n    @Mock\n    private PlaceRequest placeRequest;\n\n    private ParameterizedCommand<String> emptyCommand;\n\n    private UberfireDock dockWithFontIcon, dockWithImageIcon;\n\n    private SouthDockItem southDockWithFontIcon, southDockWithImageIcon;\n\n    @Before\n    public void setup() {\n        dockWithFontIcon = new UberfireDock(UberfireDockPosition.EAST,\n                                            \"BRIEFCASE\",\n                                            placeRequest,\n                                            \"\").withSize(450).withLabel(\"dock\");\n        dockWithImageIcon = new UberfireDock(UberfireDockPosition.EAST,\n                                             imageResource,\n                                             imageResourceFocused,\n                                             placeRequest,\n                                             \"\").withSize(450).withLabel(\"dock\");\n\n        southDockWithFontIcon = spy(new SouthDockItem(dockWithFontIcon,\n                                                      emptyCommand,\n                                                      emptyCommand));\n        southDockWithImageIcon = spy(new SouthDockItem(dockWithImageIcon,\n                                                       emptyCommand,\n                                                       emptyCommand));\n\n        emptyCommand = parameter -> {\n\n        };\n    }\n\n    @Test\n    public void createSouthDockItemWithFontIconTest() {\n        southDockWithFontIcon.createButton();\n\n        InOrder ordenatedVerification = inOrder(southDockWithFontIcon);\n        ordenatedVerification.verify(southDockWithFontIcon).configureText(any(Button.class),\n                                                                          anyString());\n        ordenatedVerification.verify(southDockWithFontIcon).configureIcon(any(Button.class),\n                                                                          eq((ImageResource) null));\n        ordenatedVerification.verify(southDockWithFontIcon,\n                                     never()).configureImageIcon(any(Button.class),\n                                                                 any(ImageResource.class));\n    }\n\n    @Test\n    public void selectSouthDockItemWithFontIconTest() {\n        southDockWithFontIcon.open();\n\n        verify(southDockWithFontIcon,\n               never()).configureImageIcon(any(Button.class),\n                                           any(ImageResource.class));\n    }\n\n    @Test\n    public void closeSouthDockItemWithFontIconTest() {\n        southDockWithFontIcon.close();\n\n        verify(southDockWithFontIcon,\n               never()).configureImageIcon(any(Button.class),\n                                           any(ImageResource.class));\n    }\n\n    @Test\n    public void createSouthDockItemWithImageIconTest() {\n        southDockWithImageIcon.createButton();\n\n        verify(southDockWithImageIcon).configureIcon(any(Button.class),\n                                                     eq(imageResource));\n        verify(southDockWithImageIcon).configureImageIcon(any(Button.class),\n                                                          eq(imageResource));\n    }\n\n    @Test\n    public void openSouthDockItemWithImageIconTest() {\n        southDockWithImageIcon.open();\n\n        verify(southDockWithImageIcon).configureImageIcon(any(Button.class),\n                                                          eq(imageResourceFocused));\n    }\n\n    @Test\n    public void closeSouthDockItemWithImageIconTest() {\n        southDockWithImageIcon.close();\n\n        verify(southDockWithImageIcon).configureImageIcon(any(Button.class),\n                                                          eq(imageResource));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-widgets</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Widgets</name>\n\n  <modules>\n    <module>uberfire-widgets-commons</module>\n    <module>uberfire-widgets-core</module>\n    <module>uberfire-widgets-properties-editor</module>\n    <module>uberfire-widgets-sandbox</module>\n    <module>uberfire-widgets-service</module>\n    <module>uberfire-widgets-table</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-commons</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Widgets Commons</name>\n  <description>Uberfire Widgets Commons</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-table</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n\n    <!-- Errai IoC - mandatory for entrypoint -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency><!-- to get CallerMock in unit test-->\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/CommonsEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.ext.widgets.common.client.resources.CommonResources;\n\n/**\n * Bootstrap widgets-commons\n */\n@EntryPoint\npublic class CommonsEntryPoint {\n\n    @PostConstruct\n    public void startApp() {\n        //Ensure CSS has been loaded\n        CommonResources.INSTANCE.CSS().ensureInjected();\n        PatternFlyBootstrapper.ensurejQueryIsAvailable();\n        PatternFlyBootstrapper.ensureBootstrapSelectIsAvailable();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/accordion/TriggerWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.accordion;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.HiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.HiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.ShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ShowHandler;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.gwtbootstrap3.client.ui.base.AbstractTextWidget;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Strong;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\n/**\n * Trigger Widget for ResourceType groups\n */\npublic class TriggerWidget extends PanelHeader {\n\n    private final FlexTable table = new FlexTable();\n    private final Icon caret;\n\n    public TriggerWidget(final String description) {\n        this(description,\n             true);\n    }\n\n    public TriggerWidget(final String description,\n                         final boolean isCaretDown) {\n        getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        caret = makeIcon(isCaretDown ? IconType.CARET_DOWN : IconType.CARET_UP,\n                         CommonConstants.INSTANCE.ClickToDisplay0(description));\n        table.setWidget(0,\n                        0,\n                        buildDescription(description));\n        table.setHTML(0,\n                      1,\n                      \"&nbsp;&nbsp;\");\n        table.setWidget(0,\n                        2,\n                        caret);\n        insert(table,\n               0);\n    }\n\n    public TriggerWidget(final IsWidget icon,\n                         final String description) {\n        this(icon,\n             description,\n             true);\n    }\n\n    public TriggerWidget(final IsWidget icon,\n                         final String description,\n                         boolean isCaretDown) {\n        getElement().getStyle().setCursor(Style.Cursor.POINTER);\n        caret = makeIcon(isCaretDown ? IconType.CARET_DOWN : IconType.CARET_UP,\n                         CommonConstants.INSTANCE.ClickToDisplay0(description));\n        if (icon == null) {\n            table.setWidget(0,\n                            0,\n                            buildDescription(description));\n            table.setHTML(0,\n                          1,\n                          \"&nbsp;&nbsp;\");\n            table.setWidget(0,\n                            2,\n                            caret);\n        } else {\n            table.setWidget(0,\n                            0,\n                            icon);\n            table.setHTML(0,\n                          1,\n                          \"&nbsp;&nbsp;\");\n            table.setWidget(0,\n                            2,\n                            buildDescription(description));\n            table.setHTML(0,\n                          3,\n                          \"&nbsp;&nbsp;\");\n            table.setWidget(0,\n                            4,\n                            caret);\n        }\n        insert(table,\n               0);\n    }\n\n    @Override\n    public void setDataTargetWidget(final Widget widget) {\n        super.setDataTargetWidget(widget);\n        if (widget instanceof PanelCollapse) {\n            final PanelCollapse collapse = (PanelCollapse) widget;\n            collapse.addShowHandler(new ShowHandler() {\n                @Override\n                public void onShow(ShowEvent showEvent) {\n                    caret.setType(IconType.CARET_UP);\n                }\n            });\n            collapse.addHiddenHandler(new HiddenHandler() {\n                @Override\n                public void onHidden(HiddenEvent event) {\n                    caret.setType(IconType.CARET_DOWN);\n                }\n            });\n        }\n    }\n\n    private Icon makeIcon(final IconType iconType,\n                          final String tooltip) {\n        return new Icon(iconType) {{\n            setTitle(tooltip);\n        }};\n    }\n\n    private Widget buildDescription(final String caption) {\n        return new AbstractTextWidget(Document.get().createSpanElement()) {{\n            addStyleName(\"text-uppercase\");\n            setTitle(CommonConstants.INSTANCE.ClickToDisplay0(caption));\n            setHTML(new Strong(caption).getElement().getString());\n        }};\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/animations/LinearFadeInAnimation.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.animations;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * A linear animation to fade a Widget from 0.0 to 1.0 opacity\n */\npublic class LinearFadeInAnimation extends SequencedAnimation {\n\n    private Widget widget;\n\n    public LinearFadeInAnimation(final Widget widget) {\n        this.widget = widget;\n    }\n\n    @Override\n    public void onUpdate(double progress) {\n        this.widget.getElement().getStyle().setOpacity(progress);\n    }\n\n    @Override\n    public double interpolate(double progress) {\n        return progress;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/animations/LinearFadeOutAnimation.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.animations;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * A linear animation to fade a Widget from 1.0 to 0.0 opacity\n */\npublic class LinearFadeOutAnimation extends SequencedAnimation {\n\n    private Widget widget;\n\n    public LinearFadeOutAnimation(final Widget widget) {\n        this.widget = widget;\n    }\n\n    @Override\n    public void onUpdate(double progress) {\n        this.widget.getElement().getStyle().setOpacity(1.0 - progress);\n    }\n\n    @Override\n    public double interpolate(double progress) {\n        return progress;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/animations/Pause.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.animations;\n\n/**\n * A pause (in between animations). Does nothing.\n */\npublic class Pause extends SequencedAnimation {\n\n    @Override\n    public void onUpdate(double progress) {\n        //Do nothing. This animation simply acts as a delay\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/animations/SequencedAnimation.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.animations;\n\nimport com.google.gwt.animation.client.Animation;\n\n/**\n * An animation that can be sequenced to run in a list of animations. In reality\n * we only GWT's Animation's protected methods to be public so we can chain the\n * completion of one Animation to another.\n */\npublic abstract class SequencedAnimation extends Animation {\n\n    @Override\n    public double interpolate(double progress) {\n        return super.interpolate(progress);\n    }\n\n    @Override\n    public void onCancel() {\n        super.onCancel();\n    }\n\n    @Override\n    public void onStart() {\n        super.onStart();\n    }\n\n    @Override\n    public void onComplete() {\n        super.onComplete();\n    }\n\n    @Override\n    public abstract void onUpdate(double progress);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/animations/Sequencer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.animations;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.animation.client.Animation;\n\n/**\n * Run a list of animations in order.\n */\npublic class Sequencer {\n\n    private int currentAnimationIndex = 0;\n    //The list of animations\n    private List<AnimationConfiguration> animations = new ArrayList<AnimationConfiguration>();\n\n    /**\n     * Add an animation to the list of animations to be sequenced.\n     * @param animation\n     * @param duration\n     */\n    public void add(final SequencedAnimation animation,\n                    final int duration) {\n        animations.add(new AnimationConfiguration(new WrappedAnimation(animation),\n                                                  duration));\n    }\n\n    /**\n     * Run all animations.\n     */\n    public void run() {\n        runNextAnimation();\n    }\n\n    /**\n     * Reset the sequence to the begining.\n     */\n    public void reset() {\n        currentAnimationIndex = 0;\n    }\n\n    private void runNextAnimation() {\n        if (currentAnimationIndex < animations.size()) {\n            final AnimationConfiguration config = animations.get(currentAnimationIndex++);\n            final WrappedAnimation animation = config.animation;\n            final int duration = config.duration;\n            animation.run(duration);\n        } else {\n            reset();\n        }\n    }\n\n    //Simple holder for sequenced animation details\n    private class AnimationConfiguration {\n\n        final WrappedAnimation animation;\n\n        final int duration;\n\n        AnimationConfiguration(final WrappedAnimation animation,\n                               final int duration) {\n            this.animation = animation;\n            this.duration = duration;\n        }\n    }\n\n    //A wrapper for sequenced animations allowing us to hook into the onComplete method to launch the next animation\n    private class WrappedAnimation extends Animation {\n\n        private final SequencedAnimation animation;\n\n        WrappedAnimation(final SequencedAnimation animation) {\n            this.animation = animation;\n        }\n\n        @Override\n        public void onComplete() {\n            //Pass through to the wrapped animation\n            animation.onComplete();\n            runNextAnimation();\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            //Pass through to the wrapped animation\n            animation.onUpdate(progress);\n        }\n\n        @Override\n        public void cancel() {\n            //Pass through to the wrapped animation\n            animation.cancel();\n        }\n\n        @Override\n        protected double interpolate(double progress) {\n            //Pass through to the wrapped animation\n            return animation.interpolate(progress);\n        }\n\n        @Override\n        protected void onCancel() {\n            //Pass through to the wrapped animation\n            animation.onCancel();\n        }\n\n        @Override\n        protected void onStart() {\n            //Pass through to the wrapped animation\n            animation.onStart();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/UberfireBreadcrumbs.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.header.UberfireBreadcrumbsContainer;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.widget.BreadcrumbPresenter;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.widget.DefaultBreadcrumbsPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\n\n@EntryPoint\npublic class UberfireBreadcrumbs {\n\n    final Map<String, List<BreadcrumbPresenter>> breadcrumbsPerPerspective = new HashMap<>();\n    final Map<String, Element> breadcrumbsToolBarPerPerspective = new HashMap<>();\n    private final UberfireBreadcrumbsContainer uberfireBreadcrumbsContainer;\n    private final View view;\n    String currentPerspective;\n    private ManagedInstance<DefaultBreadcrumbsPresenter> breadcrumbsPresenters;\n    private PlaceManager placeManager;\n\n    @Inject\n    public UberfireBreadcrumbs(UberfireBreadcrumbsContainer uberfireBreadcrumbsContainer,\n                               ManagedInstance<DefaultBreadcrumbsPresenter> breadcrumbsPresenters,\n                               PlaceManager placeManager,\n                               View view) {\n        this.uberfireBreadcrumbsContainer = uberfireBreadcrumbsContainer;\n        this.breadcrumbsPresenters = breadcrumbsPresenters;\n        this.placeManager = placeManager;\n        this.view = view;\n    }\n\n    void perspectiveChangeEvent(@Observes PerspectiveChange perspectiveChange) {\n        currentPerspective = perspectiveChange.getIdentifier();\n        updateView();\n    }\n\n    @PostConstruct\n    public void createBreadcrumbs() {\n        uberfireBreadcrumbsContainer.init(getView().getElement());\n    }\n\n    /**\n     * Clears the breadcrumbs associated with a perspective.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     */\n    public void clearBreadcrumbs(final String associatedPerspective) {\n        breadcrumbsPerPerspective.put(associatedPerspective, new ArrayList<>());\n    }\n\n    /**\n     * Clears the breadcrumbs and toolbars associated with a perspective.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     */\n    public void clearBreadcrumbsAndToolBars(final String associatedPerspective) {\n        breadcrumbsPerPerspective.put(associatedPerspective, new ArrayList<>());\n        breadcrumbsToolBarPerPerspective.remove(associatedPerspective);\n    }\n\n    /**\n     * Creates a breadcrumb associated with a perspective.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     * @param breadCrumbLabel label of the breadcrumb\n     * @param command command to be executed after the associated place request is accessed\n     */\n    public void addBreadCrumb(final String associatedPerspective,\n                              final String breadCrumbLabel,\n                              final Command command) {\n        addBreadCrumb(associatedPerspective,\n                      breadCrumbLabel,\n                      null,\n                      command,\n                      true);\n    }\n\n    /**\n     * Creates a breadcrumb associated with a perspective.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     * @param breadCrumbLabel label of the breadcrumb\n     * @param command command to be executed after the associated place request is accessed\n     * @param removeDeepLevelBreadcrumbsAfterActivation defines if the deep level breadcrumbs should be removed after the breadcrumb is activated\n     */\n    public void addBreadCrumb(final String associatedPerspective,\n                              final String breadCrumbLabel,\n                              final Command command,\n                              final boolean removeDeepLevelBreadcrumbsAfterActivation) {\n        addBreadCrumb(associatedPerspective,\n                      breadCrumbLabel,\n                      null,\n                      command,\n                      removeDeepLevelBreadcrumbsAfterActivation);\n    }\n\n    /**\n     * Creates a breadcrumb associated with a perspective\n     * and Place Request.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     * @param breadCrumbLabel label of the breadcrumb\n     * @param associatedPlaceRequest place request associated with the breadcrumb\n     */\n    public void addBreadCrumb(final String associatedPerspective,\n                              final String breadCrumbLabel,\n                              final PlaceRequest associatedPlaceRequest) {\n        addBreadCrumb(associatedPerspective,\n                      breadCrumbLabel,\n                      associatedPlaceRequest,\n                      null,\n                      true);\n    }\n\n    /**\n     * Creates a breadcrumb associated with a perspective\n     * and Place Request.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     * @param breadCrumbLabel label of the breadcrumb\n     * @param associatedPlaceRequest place request associated with the breadcrumb\n     * @param command command to be executed after the associated place request is accessed\n     */\n    public void addBreadCrumb(final String associatedPerspective,\n                              final String breadCrumbLabel,\n                              final PlaceRequest associatedPlaceRequest,\n                              final Command command) {\n        addBreadCrumb(associatedPerspective,\n                      breadCrumbLabel,\n                      associatedPlaceRequest,\n                      command,\n                      true);\n    }\n\n    /**\n     * Creates a breadcrumb associated with a perspective\n     * a Place Request and a target panel.\n     * @param associatedPerspective perspective associated with the breadcrumb\n     * @param breadCrumbLabel label of the breadcrumb\n     * @param associatedPlaceRequest place request associated with the breadcrumb\n     * @param command command to be executed after the associated place request is accessed\n     * @param removeDeepLevelBreadcrumbsAfterActivation defines if the deep level breadcrumbs should be removed after the breadcrumb is activated\n     */\n    public void addBreadCrumb(final String associatedPerspective,\n                              final String breadCrumbLabel,\n                              final PlaceRequest associatedPlaceRequest,\n                              final Command command,\n                              final boolean removeDeepLevelBreadcrumbsAfterActivation) {\n\n        final DefaultBreadcrumbsPresenter breadCrumb = breadcrumbsPresenters.get();\n\n        breadCrumb.setup(breadCrumbLabel,\n                         removeDeepLevelBreadcrumbsAfterActivation,\n                         generateBreadCrumbSelectCommand(associatedPerspective,\n                                                         breadCrumb,\n                                                         associatedPlaceRequest,\n                                                         command));\n\n        addBreadCrumb(associatedPerspective, breadCrumb);\n    }\n\n    public void addBreadCrumb(final String associatedPerspective,\n                              final BreadcrumbPresenter breadCrumbPresenter) {\n\n        final List<BreadcrumbPresenter> breadcrumbs = getBreadcrumbs(associatedPerspective);\n\n        activateLastBreadcrumb(breadcrumbs);\n        breadCrumbPresenter.deactivate();\n\n        breadcrumbs.add(breadCrumbPresenter);\n        breadcrumbsPerPerspective.put(associatedPerspective, breadcrumbs);\n        \n        if (currentPerspective.equals(associatedPerspective)) {\n            updateView();\n        }\n    }\n\n    /**\n     * Adds a toolbar to a perspective.\n     * Toolbar is placed in the right side of the breadcrumbs area.\n     * @param associatedPerspective perspective associated with the toolbar\n     * @param toolbar toolbar that will be added\n     */\n    public void addToolbar(final String associatedPerspective,\n                           final Element toolbar) {\n\n        breadcrumbsToolBarPerPerspective.put(associatedPerspective, toolbar);\n        if (currentPerspective.equals(associatedPerspective)) {\n            updateView();\n        }\n    }\n\n    private List<BreadcrumbPresenter> getBreadcrumbs(final String perspective) {\n        return breadcrumbsPerPerspective.getOrDefault(perspective, new ArrayList<>());\n    }\n\n    private void activateLastBreadcrumb(final List<BreadcrumbPresenter> breadcrumbs) {\n        if (!breadcrumbs.isEmpty()) {\n            breadcrumbs.get(breadcrumbs.size() - 1).activate();\n        }\n    }\n\n    Command generateBreadCrumbSelectCommand(final String perspective,\n                                            final DefaultBreadcrumbsPresenter breadCrumb,\n                                            final PlaceRequest placeRequest,\n                                            final Command command) {\n        if (command == null) {\n            return null;\n        }\n\n        return () -> {\n            removeDeepLevelBreadcrumbsIfNecessary(perspective, breadCrumb);\n\n            breadCrumb.deactivate();\n\n            if (placeRequest != null) {\n                placeManager.goTo(placeRequest);\n            }\n\n            updateView();\n            command.execute();\n        };\n    }\n\n    void removeDeepLevelBreadcrumbsIfNecessary(final String perspective,\n                                               final DefaultBreadcrumbsPresenter breadCrumb) {\n        if (breadCrumb.hasToRemoveDeepLevelBreadcrumbsAfterActivation()) {\n            final List<BreadcrumbPresenter> breadcrumbs = getBreadcrumbs(perspective);\n            breadcrumbs.removeIf(b -> breadcrumbs.indexOf(b) > breadcrumbs.indexOf(breadCrumb));\n        }\n    }\n\n    private void updateView() {\n        getView();\n    }\n\n    View getView() {\n        view.clear();\n        updateBreadcrumbsContainer();\n        updateBreadcrumbs();\n        return view;\n    }\n\n    private void updateBreadcrumbs() {\n        if (thereIsBreadcrumbsFor(currentPerspective)) {\n            breadcrumbsPerPerspective.get(currentPerspective).forEach(p -> view.addBreadcrumb(p.getView()));\n        }\n\n        if (thereIsBreadcrumbToolbarFor(currentPerspective)) {\n            view.addBreadcrumbToolbar(breadcrumbsToolBarPerPerspective.get(currentPerspective));\n        }\n    }\n\n    void updateBreadcrumbsContainer() {\n        if (thereIsContentOnBreadcrumbs()) {\n            uberfireBreadcrumbsContainer.enable();\n        } else {\n            uberfireBreadcrumbsContainer.disable();\n        }\n    }\n\n    private boolean thereIsContentOnBreadcrumbs() {\n        return thereIsBreadcrumbsFor(currentPerspective) || thereIsBreadcrumbToolbarFor(currentPerspective);\n    }\n\n    private boolean thereIsBreadcrumbsFor(final String perspective) {\n        return breadcrumbsPerPerspective.containsKey(perspective);\n    }\n\n    private boolean thereIsBreadcrumbToolbarFor(final String perspective) {\n        return breadcrumbsToolBarPerPerspective.containsKey(perspective);\n    }\n\n    public interface View extends UberElement<UberfireBreadcrumbs> {\n\n        void clear();\n\n        void addBreadcrumb(UberElemental<? extends BreadcrumbPresenter> view);\n\n        void addBreadcrumbToolbar(Element uberElement);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/UberfireBreadcrumbsView.css",
    "content": ".uf-breadcrumb {\n    margin-left: 20px;\n}\n\n.breadcrumbs-container {\n    display: -webkit-box;\n    display: -webkit-flex;\n    display: -ms-flexbox;\n    display: flex;\n\n    border-bottom:1px solid #ddd;\n\n    height: 35px;\n    width: 100%;\n}\n\n.breadcrumbs {\n    width: 50%;\n}\n\n.breadcrumbs-toolbar {\n    width: 50%;\n    text-align: right;\n    padding-top: 8px;\n    padding-bottom: 8px;\n}\n.breadcrumbs-toolbar-content{\n    margin-right: 20px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/UberfireBreadcrumbsView.html",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div class=\"breadcrumbs-container\">\n    <div class=\"breadcrumbs\">\n        <ol id=\"breadcrumbs\" class=\"breadcrumb uf-breadcrumb\">\n\n        </ol>\n    </div>\n    <div class=\"breadcrumbs-toolbar\">\n        <div id=\"breadcrumbsToolbar\" class=\"breadcrumbs-toolbar-content\">\n\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/UberfireBreadcrumbsView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLOListElement;\nimport elemental2.dom.Node;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.widget.BreadcrumbPresenter;\n\n@Templated\npublic class UberfireBreadcrumbsView implements UberElement<UberfireBreadcrumbs>,\n                                                UberfireBreadcrumbs.View,\n                                                IsElement {\n\n    @Inject\n    @DataField\n    HTMLOListElement breadcrumbs;\n\n    @Inject\n    @DataField\n    HTMLDivElement breadcrumbsToolbar;\n\n    @Inject\n    private Elemental2DomUtil elemental2DomUtil;\n\n    @Override\n    public void init(final UberfireBreadcrumbs presenter) {\n    }\n\n    @Override\n    public void clear() {\n        elemental2DomUtil.removeAllElementChildren(breadcrumbs);\n        elemental2DomUtil.removeAllElementChildren(breadcrumbsToolbar);\n    }\n\n    @Override\n    public void addBreadcrumb(UberElemental<? extends BreadcrumbPresenter> view) {\n        breadcrumbs.appendChild(view.getElement());\n    }\n\n    @Override\n    public void addBreadcrumbToolbar(Element toolbar) {\n        elemental2DomUtil.removeAllElementChildren(breadcrumbsToolbar);\n        breadcrumbsToolbar.appendChild((Node) toolbar);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/header/UberfireBreadcrumbsContainer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.header;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\n\npublic interface UberfireBreadcrumbsContainer {\n\n    void init(HTMLElement child);\n\n    void enable();\n\n    void disable();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/header/UberfireBreadcrumbsContainerImpl.css",
    "content": ".breadcrumb-disabled {\n    display: none;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/header/UberfireBreadcrumbsContainerImpl.html",
    "content": "<div data-field=\"breadcrumbs-container\" class=\"breadcrumbs-container\">\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/header/UberfireBreadcrumbsContainerImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.header;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.Header;\n\n@ApplicationScoped\n@Templated\npublic class UberfireBreadcrumbsContainerImpl implements Header,\n                                                         UberfireBreadcrumbsContainer {\n\n    @Inject\n    @DataField(\"breadcrumbs-container\")\n    Div breadcrumbsContainer;\n\n    @Override\n    public void init(HTMLElement child) {\n        DOMUtil.removeAllChildren(breadcrumbsContainer);\n        breadcrumbsContainer.appendChild(child);\n    }\n\n    @Override\n    public String getId() {\n        return \"UberfireBreadcrumbsContainer\";\n    }\n\n    @Override\n    public int getOrder() {\n        return 10;\n    }\n\n    @Override\n    public void enable() {\n        DOMUtil.removeCSSClass(breadcrumbsContainer,\n                               \"breadcrumb-disabled\");\n        DOMUtil.addCSSClass(breadcrumbsContainer,\n                            \"breadcrumbs-container\");\n\n    }\n\n    @Override\n    public void disable() {\n        DOMUtil.removeCSSClass(breadcrumbsContainer,\n                               \"breadcrumbs-container\");\n        DOMUtil.addCSSClass(breadcrumbsContainer,\n                            \"breadcrumb-disabled\");\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/BreadcrumbPresenter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.widget;\n\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface BreadcrumbPresenter {\n\n    void activate();\n\n    void deactivate();\n\n    UberElemental<? extends BreadcrumbPresenter> getView();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/DefaultBreadcrumbsPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.widget;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class DefaultBreadcrumbsPresenter implements BreadcrumbPresenter {\n\n    private final View view;\n    private Command selectCommand;\n    private boolean removeDeepLevelBreadcrumbsAfterActivation = true;\n\n    @Inject\n    public DefaultBreadcrumbsPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String label,\n                      final boolean removeDeepLevelBreadcrumbsAfterActivation,\n                      final Command selectCommand) {\n        this.selectCommand = selectCommand;\n        this.removeDeepLevelBreadcrumbsAfterActivation = removeDeepLevelBreadcrumbsAfterActivation;\n        view.setup(label);\n\n        if (selectCommand == null) {\n            view.setNoAction();\n        }\n    }\n\n    public boolean hasToRemoveDeepLevelBreadcrumbsAfterActivation() {\n        return removeDeepLevelBreadcrumbsAfterActivation;\n    }\n\n    @Override\n    public void activate() {\n        view.activate();\n    }\n\n    @Override\n    public void deactivate() {\n        view.deactivate();\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    public void onClick() {\n        if (selectCommand != null) {\n            selectCommand.execute();\n        }\n    }\n\n    public interface View extends UberElemental<DefaultBreadcrumbsPresenter> {\n\n        void setup(String label);\n\n        void activate();\n\n        void deactivate();\n\n        void setNoAction();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/DefaultBreadcrumbsView.css",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.breadcrumb-activated {\n    cursor: pointer;\n}\n\n.breadcrumb-no-action .breadcrumb-activated {\n    cursor: default;\n    color: inherit;\n    text-decoration-line: none;\n    pointer-events: none;\n    font-weight: normal;\n}\n\n.breadcrumb-deactivated {\n    cursor: default;\n    color: inherit;\n    text-decoration-line: none;\n    pointer-events: none;\n    font-weight: bold;\n}\n\nli[data-field=\"breadcrumb\"] a {\n    text-decoration: none;\n}\n\nli[data-field=\"breadcrumb\"] a span:first-child {\n    display: inline-block;\n    vertical-align: top;\n    text-overflow: ellipsis;\n    overflow: hidden;\n    white-space: nowrap;\n    max-width: 250px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/DefaultBreadcrumbsView.html",
    "content": "<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li data-field=\"breadcrumb\">\n    <a data-field=\"breadcrumbLink\"></a>\n</li>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/DefaultBreadcrumbsView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.widget;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLLIElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.mvp.UberElemental;\n\n@Templated\npublic class DefaultBreadcrumbsView implements UberElemental<DefaultBreadcrumbsPresenter>,\n                                               DefaultBreadcrumbsPresenter.View,\n                                               IsElement {\n\n    @Inject\n    @DataField(\"breadcrumb\")\n    private HTMLLIElement breadcrumb;\n\n    @Inject\n    @DataField(\"breadcrumbLink\")\n    private HTMLAnchorElement breadcrumbLink;\n\n    private DefaultBreadcrumbsPresenter presenter;\n\n    @Override\n    public void init(DefaultBreadcrumbsPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setup(final String label) {\n        breadcrumbLink.textContent = label;\n        breadcrumbLink.onclick = e -> {\n            presenter.onClick();\n            return null;\n        };\n    }\n\n    @Override\n    public void activate() {\n        breadcrumbLink.className = \"breadcrumb-activated\";\n    }\n\n    @Override\n    public void deactivate() {\n        breadcrumbLink.className = \"breadcrumb-deactivated\";\n    }\n\n    @Override\n    public void setNoAction() {\n        breadcrumb.className = \"breadcrumb-no-action\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/callbacks/CommandErrorCallback.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.callbacks;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Default Error handler for all views that support HasBusyIndicator. Now with Command support.\n */\npublic class CommandErrorCallback\n        extends DefaultErrorCallback {\n\n    private final Command command;\n\n    public CommandErrorCallback(final Command command) {\n        this.command = checkNotNull(\"command\", command);\n    }\n\n    @Override\n    public boolean error(final Message message,\n                         final Throwable throwable) {\n        command.execute();\n        return super.error(message, throwable);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/callbacks/DefaultErrorCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.callbacks;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.java.nio.IOException;\n\n/**\n * Default Error handler for all Portable Exceptions\n * @deprecated Please use GenericErrorPopup instead.\n */\n@Deprecated\npublic class DefaultErrorCallback implements ErrorCallback<Message> {\n\n    @Override\n    public boolean error(final Message message,\n                         final Throwable throwable) {\n        try {\n            throw throwable;\n        } catch (org.uberfire.java.nio.file.AccessDeniedException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.AtomicMoveNotSupportedException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.ClosedWatchServiceException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.DirectoryNotEmptyException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionFileAlreadyExists0(e.getFile()));\n        } catch (org.uberfire.java.nio.file.FileSystemAlreadyExistsException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.FileSystemNotFoundException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.InvalidPathException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionInvalidPath());\n        } catch (org.uberfire.java.nio.file.NoSuchFileException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionNoSuchFile0(e.getFile()));\n        } catch (org.uberfire.java.nio.file.NotDirectoryException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.NotLinkException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.PatternSyntaxException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.ProviderNotFoundException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (org.uberfire.java.nio.file.FileSystemException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (IOException e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        } catch (Throwable e) {\n            ErrorPopup.showMessage(CommonConstants.INSTANCE.ExceptionGeneric0(e.getMessage()));\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/callbacks/HasBusyIndicatorDefaultErrorCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.callbacks;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.uberfire.ext.widgets.common.client.common.HasBusyIndicator;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Default Error handler for all views that support HasBusyIndicator\n */\npublic class HasBusyIndicatorDefaultErrorCallback extends DefaultErrorCallback {\n\n    protected HasBusyIndicator view;\n\n    public HasBusyIndicatorDefaultErrorCallback(final HasBusyIndicator view) {\n        this.view = checkNotNull(\"view\",\n                                 view);\n    }\n\n    @Override\n    public boolean error(final Message message,\n                         final Throwable throwable) {\n        view.hideBusyIndicator();\n        return super.error(message,\n                           throwable);\n    }\n\n    public void hideBusyIndicator() {\n        view.hideBusyIndicator();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/ColorChangedEvent.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\npublic class ColorChangedEvent extends GwtEvent<ColorChangedHandler> {\r\n\r\n    private static Type<ColorChangedHandler> TYPE;\r\n\r\n    private String color;\r\n\r\n    ColorChangedEvent(String color) {\r\n        this.color = color;\r\n    }\r\n\r\n    public static Type<ColorChangedHandler> getType() {\r\n        if (TYPE == null) {\r\n            TYPE = new Type<ColorChangedHandler>();\r\n        }\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    public Type<ColorChangedHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(ColorChangedHandler handler) {\r\n        handler.colorChanged(this);\r\n    }\r\n\r\n    public String getColor() {\r\n        return color;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/ColorChangedHandler.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\n\r\npublic interface ColorChangedHandler extends EventHandler {\r\n\r\n    void colorChanged(ColorChangedEvent event);\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/ColorPickerDialog.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.user.client.ui.HorizontalPanel;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.dialog.Dialog;\r\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\r\n\r\npublic class ColorPickerDialog extends Dialog {\r\n\r\n    private SaturationLightnessPicker slPicker;\r\n    private HuePicker huePicker;\r\n    private String color;\r\n\r\n    @Override\r\n    protected Widget createDialogArea() {\r\n        setText(CommonConstants.INSTANCE.ColorPickerTitle());\r\n\r\n        HorizontalPanel panel = new HorizontalPanel();\r\n\r\n        // the pickers\r\n        slPicker = new SaturationLightnessPicker();\r\n        panel.add(slPicker);\r\n        huePicker = new HuePicker();\r\n        panel.add(huePicker);\r\n\r\n        // bind saturation/lightness picker and hue picker together\r\n        huePicker.addHueChangedHandler(new HueChangedHandler() {\r\n            public void hueChanged(HueChangedEvent event) {\r\n                slPicker.setHue(event.getHue());\r\n            }\r\n        });\r\n\r\n        return panel;\r\n    }\r\n\r\n    public String getColor() {\r\n        return color;\r\n    }\r\n\r\n    public void setColor(String color) {\r\n        int[] rgb = ColorUtils.getRGB(color);\r\n        int[] hsl = ColorUtils.rgb2hsl(rgb);\r\n        huePicker.setHue(hsl[0]);\r\n        slPicker.setColor(color);\r\n    }\r\n\r\n    @Override\r\n    protected void buttonClicked(Widget button) {\r\n        // remember color when \"OK\" is clicked\r\n        if (button == getOkButton()) {\r\n            color = slPicker.getColor();\r\n        }\r\n\r\n        close(button == getCancelButton());\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/ColorUtils.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\npublic final class ColorUtils {\r\n\r\n    private ColorUtils() {\r\n    }\r\n\r\n    static int[] hsl2rgb(int[] hsl) {\r\n        double h = hsl[0] / 360d;\r\n        double s = hsl[1] / 100d;\r\n        double l = hsl[2] / 100d;\r\n        double r = 0d;\r\n        double g = 0d;\r\n        double b;\r\n\r\n        if (s > 0d) {\r\n            if (h >= 1d) {\r\n                h = 0d;\r\n            }\r\n\r\n            h = h * 6d;\r\n            double f = h - Math.floor(h);\r\n            double a = Math.round(l * 255d * (1d - s));\r\n            b = Math.round(l * 255d * (1d - (s * f)));\r\n            double c = Math.round(l * 255d * (1d - (s * (1d - f))));\r\n            l = Math.round(l * 255d);\r\n\r\n            switch ((int) Math.floor(h)) {\r\n                case 0:\r\n                    r = l;\r\n                    g = c;\r\n                    b = a;\r\n                    break;\r\n                case 1:\r\n                    r = b;\r\n                    g = l;\r\n                    b = a;\r\n                    break;\r\n                case 2:\r\n                    r = a;\r\n                    g = l;\r\n                    b = c;\r\n                    break;\r\n                case 3:\r\n                    r = a;\r\n                    g = b;\r\n                    b = l;\r\n                    break;\r\n                case 4:\r\n                    r = c;\r\n                    g = a;\r\n                    b = l;\r\n                    break;\r\n                case 5:\r\n                    r = l;\r\n                    g = a;\r\n                    break;\r\n            }\r\n            return new int[]{(int) Math.round(r), (int) Math.round(g), (int) Math.round(b)};\r\n        }\r\n\r\n        l = Math.round(l * 255d);\r\n        return new int[]{(int) l, (int) l, (int) l};\r\n    }\r\n\r\n    static String toHex(int v) {\r\n        v = Math.min(Math.max(v,\r\n                              0),\r\n                     255);\r\n        return String.valueOf(\"0123456789abcdef\".charAt(((v - v % 16) / 16))) + //$NON-NLS-1$\r\n                String.valueOf(\"0123456789abcdef\".charAt(v % 16)); //$NON-NLS-1$\r\n    }\r\n\r\n    static String rgb2hex(int[] rgb) {\r\n        return toHex(rgb[0]) + toHex(rgb[1]) + toHex(rgb[2]);\r\n    }\r\n\r\n    static String rgb2hex(int r,\r\n                          int g,\r\n                          int b) {\r\n        return rgb2hex(new int[]{r, g, b});\r\n    }\r\n\r\n    static String hsl2hex(int[] hsl) {\r\n        return rgb2hex(hsl2rgb(hsl));\r\n    }\r\n\r\n    static String hsl2hex(int h,\r\n                          int s,\r\n                          int l) {\r\n        return hsl2hex(new int[]{h, s, l});\r\n    }\r\n\r\n    static int[] rgb2hsl(int[] rgb) {\r\n        double max = Math.max(Math.max(rgb[0],\r\n                                       rgb[1]),\r\n                              rgb[2]); // 0xdd = 221\r\n        double delta = max - Math.min(Math.min(rgb[0],\r\n                                               rgb[1]),\r\n                                      rgb[2]); // 153\r\n        double h = 0;\r\n        int s = 0;\r\n        int l = (int) Math.round(max * 100d / 255d); // 87 ok\r\n        if (max != 0) {\r\n            s = (int) Math.round(delta * 100d / max); // 69 ok\r\n            if (max == rgb[0]) {\r\n                h = (rgb[1] - rgb[2]) / delta;\r\n            } else if (max == rgb[1]) {\r\n                h = (rgb[2] - rgb[0]) / delta + 2d;\r\n            } else {\r\n                h = (rgb[0] - rgb[1]) / delta + 4d; // 4.8888888888\r\n            }\r\n            h = Math.min(Math.round(h * 60d),\r\n                         360d); // 293\r\n            if (h < 0d) {\r\n                h += 360d;\r\n            }\r\n        }\r\n        return new int[]{(int) Math.round(h), Math.round(s), l};\r\n    }\r\n\r\n    public static int[] getRGB(String color) {\r\n        return new int[]{\r\n                Integer.parseInt(color.substring(0,\r\n                                                 2),\r\n                                 16),\r\n                Integer.parseInt(color.substring(2,\r\n                                                 4),\r\n                                 16),\r\n                Integer.parseInt(color.substring(4,\r\n                                                 6),\r\n                                 16)\r\n        };\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/HueChangedEvent.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\npublic class HueChangedEvent extends GwtEvent<HueChangedHandler> {\r\n\r\n    private static Type<HueChangedHandler> TYPE;\r\n\r\n    private int hue;\r\n\r\n    HueChangedEvent(int hue) {\r\n        this.hue = hue;\r\n    }\r\n\r\n    public static Type<HueChangedHandler> getType() {\r\n        if (TYPE == null) {\r\n            TYPE = new Type<HueChangedHandler>();\r\n        }\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    public Type<HueChangedHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(HueChangedHandler handler) {\r\n        handler.hueChanged(this);\r\n    }\r\n\r\n    public int getHue() {\r\n        return hue;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/HueChangedHandler.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\n\r\npublic interface HueChangedHandler extends EventHandler {\r\n\r\n    void hueChanged(HueChangedEvent event);\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/HuePicker.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.event.dom.client.MouseDownEvent;\r\nimport com.google.gwt.event.dom.client.MouseDownHandler;\r\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\r\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\r\nimport com.google.gwt.event.dom.client.MouseOutEvent;\r\nimport com.google.gwt.event.dom.client.MouseOutHandler;\r\nimport com.google.gwt.event.dom.client.MouseUpEvent;\r\nimport com.google.gwt.event.dom.client.MouseUpHandler;\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.google.gwt.user.client.ui.Composite;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.Canvas;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.RenderingContext;\r\n\r\npublic class HuePicker extends Composite {\r\n\r\n    private Canvas canvas;\r\n    private int handleY = 90;\r\n    private boolean mouseDown;\r\n\r\n    public HuePicker() {\r\n        canvas = new Canvas();\r\n        canvas.setStylePrimaryName(\"subshell-HuePicker\");\r\n        canvas.setCanvasSize(26,\r\n                             180);\r\n\r\n        initWidget(canvas);\r\n\r\n        canvas.addMouseDownHandler(new MouseDownHandler() {\r\n            public void onMouseDown(MouseDownEvent event) {\r\n                handleY = event.getRelativeY(canvas.getElement());\r\n                drawGradient();\r\n                fireHueChanged(getHue());\r\n\r\n                mouseDown = true;\r\n            }\r\n        });\r\n        canvas.addMouseMoveHandler(new MouseMoveHandler() {\r\n            public void onMouseMove(MouseMoveEvent event) {\r\n                if (mouseDown) {\r\n                    handleY = event.getRelativeY(canvas.getElement());\r\n                    drawGradient();\r\n                    fireHueChanged(getHue());\r\n                }\r\n            }\r\n        });\r\n        canvas.addMouseUpHandler(new MouseUpHandler() {\r\n            public void onMouseUp(MouseUpEvent event) {\r\n                mouseDown = false;\r\n            }\r\n        });\r\n        canvas.addMouseOutHandler(new MouseOutHandler() {\r\n            public void onMouseOut(MouseOutEvent event) {\r\n                mouseDown = false;\r\n            }\r\n        });\r\n    }\r\n\r\n    @Override\r\n    protected void onAttach() {\r\n        super.onAttach();\r\n        drawGradient();\r\n    }\r\n\r\n    private void drawGradient() {\r\n        RenderingContext ctx = canvas.getContext();\r\n\r\n        // draw gradient\r\n        ctx.setFillStyle(\"#ffffff\");\r\n        ctx.fillRect(0,\r\n                     0,\r\n                     26,\r\n                     180);\r\n        for (int y = 0; y <= 179; y++) {\r\n            String hex = ColorUtils.hsl2hex(y * 2,\r\n                                            100,\r\n                                            100);\r\n            ctx.setFillStyle(\"#\" + hex);\r\n            ctx.fillRect(3,\r\n                         y,\r\n                         20,\r\n                         1);\r\n        }\r\n\r\n        // draw handle\r\n        if (handleY >= 0) {\r\n            ctx.setFillStyle(\"#000000\");\r\n\r\n            ctx.beginPath();\r\n            ctx.moveTo(3,\r\n                       handleY);\r\n            ctx.lineTo(0,\r\n                       handleY - 3);\r\n            ctx.lineTo(0,\r\n                       handleY + 3);\r\n            ctx.closePath();\r\n            ctx.fill();\r\n\r\n            ctx.moveTo(23,\r\n                       handleY);\r\n            ctx.lineTo(26,\r\n                       handleY - 3);\r\n            ctx.lineTo(26,\r\n                       handleY + 3);\r\n            ctx.closePath();\r\n            ctx.fill();\r\n        }\r\n    }\r\n\r\n    public HandlerRegistration addHueChangedHandler(HueChangedHandler handler) {\r\n        return addHandler(handler,\r\n                          HueChangedEvent.getType());\r\n    }\r\n\r\n    private void fireHueChanged(int hue) {\r\n        fireEvent(new HueChangedEvent(hue));\r\n    }\r\n\r\n    public int getHue() {\r\n        return handleY * 2;\r\n    }\r\n\r\n    public void setHue(int hue) {\r\n        handleY = (int) Math.min(Math.max(Math.round(hue / 2d),\r\n                                          0d),\r\n                                 179d);\r\n        drawGradient();\r\n        fireHueChanged(hue);\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/SaturationLightnessPicker.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker;\r\n\r\nimport com.google.gwt.core.client.JsArrayInteger;\r\nimport com.google.gwt.event.dom.client.MouseDownEvent;\r\nimport com.google.gwt.event.dom.client.MouseDownHandler;\r\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\r\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\r\nimport com.google.gwt.event.dom.client.MouseOutEvent;\r\nimport com.google.gwt.event.dom.client.MouseOutHandler;\r\nimport com.google.gwt.event.dom.client.MouseUpEvent;\r\nimport com.google.gwt.event.dom.client.MouseUpHandler;\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.google.gwt.user.client.ui.Composite;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.Canvas;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.Gradient;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.ImageData;\r\nimport org.uberfire.ext.widgets.common.client.colorpicker.canvas.RenderingContext;\r\n\r\npublic class SaturationLightnessPicker extends Composite {\r\n\r\n    private Canvas canvas;\r\n    private int hue = 180;\r\n    private int handleX = 90;\r\n    private int handleY = 90;\r\n    private boolean mouseDown;\r\n\r\n    public SaturationLightnessPicker() {\r\n        canvas = new Canvas();\r\n        canvas.setCanvasSize(180,\r\n                             180);\r\n\r\n        initWidget(canvas);\r\n\r\n        canvas.addMouseDownHandler(new MouseDownHandler() {\r\n            public void onMouseDown(MouseDownEvent event) {\r\n                handleX = event.getRelativeX(canvas.getElement());\r\n                handleY = event.getRelativeY(canvas.getElement());\r\n                drawGradient(false);\r\n                String color = getColorAtPixel(handleX,\r\n                                               handleY);\r\n                drawGradient(true);\r\n                fireColorChanged(color);\r\n\r\n                mouseDown = true;\r\n            }\r\n        });\r\n        canvas.addMouseMoveHandler(new MouseMoveHandler() {\r\n            public void onMouseMove(MouseMoveEvent event) {\r\n                if (mouseDown) {\r\n                    handleX = event.getRelativeX(canvas.getElement());\r\n                    handleY = event.getRelativeY(canvas.getElement());\r\n                    drawGradient(false);\r\n                    String color = getColorAtPixel(handleX,\r\n                                                   handleY);\r\n                    drawGradient(true);\r\n                    fireColorChanged(color);\r\n                }\r\n            }\r\n        });\r\n        canvas.addMouseUpHandler(new MouseUpHandler() {\r\n            public void onMouseUp(MouseUpEvent event) {\r\n                mouseDown = false;\r\n            }\r\n        });\r\n        canvas.addMouseOutHandler(new MouseOutHandler() {\r\n            public void onMouseOut(MouseOutEvent event) {\r\n                mouseDown = false;\r\n            }\r\n        });\r\n    }\r\n\r\n    @Override\r\n    protected void onAttach() {\r\n        super.onAttach();\r\n        drawGradient(true);\r\n    }\r\n\r\n    private void drawGradient(boolean drawHandle) {\r\n        RenderingContext ctx = canvas.getContext();\r\n\r\n        // draw gradient\r\n        for (int x = 0; x <= 179; x++) {\r\n            Gradient grad = ctx.createLinearGradient(x,\r\n                                                     0,\r\n                                                     x,\r\n                                                     179);\r\n            int s = Math.round(x * 100 / 179);\r\n            String hex = ColorUtils.hsl2hex(hue,\r\n                                            s,\r\n                                            0);\r\n            grad.addColorStop(0,\r\n                              \"#\" + hex);\r\n            hex = ColorUtils.hsl2hex(hue,\r\n                                     s,\r\n                                     100);\r\n            grad.addColorStop(1,\r\n                              \"#\" + hex);\r\n            ctx.setFillStyle(grad);\r\n            ctx.fillRect(x,\r\n                         0,\r\n                         1,\r\n                         180);\r\n        }\r\n\r\n        // draw handle\r\n        if (drawHandle) {\r\n            ctx.beginPath();\r\n            ctx.arc(handleX,\r\n                    handleY,\r\n                    3,\r\n                    0,\r\n                    Math.PI * 2,\r\n                    false);\r\n            ctx.closePath();\r\n            ctx.setFillStyle(\"#ffffff\");\r\n            ctx.fill();\r\n\r\n            ctx.beginPath();\r\n            ctx.arc(handleX,\r\n                    handleY,\r\n                    2,\r\n                    0,\r\n                    Math.PI * 2,\r\n                    false);\r\n            ctx.closePath();\r\n            ctx.setFillStyle(\"#000000\");\r\n            ctx.fill();\r\n        }\r\n    }\r\n\r\n    public HandlerRegistration addColorChangedHandler(ColorChangedHandler handler) {\r\n        return addHandler(handler,\r\n                          ColorChangedEvent.getType());\r\n    }\r\n\r\n    private void fireColorChanged(String color) {\r\n        fireEvent(new ColorChangedEvent(color));\r\n    }\r\n\r\n    private String getColorAtPixel(int x,\r\n                                   int y) {\r\n        x = Math.max(Math.min(x,\r\n                              179),\r\n                     0);\r\n        y = Math.max(Math.min(y,\r\n                              179),\r\n                     0);\r\n        RenderingContext ctx = canvas.getContext();\r\n        ImageData imageData = ctx.getImageData(x,\r\n                                               y,\r\n                                               1,\r\n                                               1);\r\n        JsArrayInteger data = imageData.getData();\r\n        return ColorUtils.rgb2hex(data.get(0),\r\n                                  data.get(1),\r\n                                  data.get(2));\r\n    }\r\n\r\n    public void setHue(int hue) {\r\n        this.hue = hue;\r\n        drawGradient(false);\r\n        String color = getColorAtPixel(handleX,\r\n                                       handleY);\r\n        drawGradient(true);\r\n        fireColorChanged(color);\r\n    }\r\n\r\n    public String getColor() {\r\n        drawGradient(false);\r\n        String color = getColorAtPixel(handleX,\r\n                                       handleY);\r\n        drawGradient(true);\r\n        return color;\r\n    }\r\n\r\n    public void setColor(String color) {\r\n        int[] rgb = ColorUtils.getRGB(color);\r\n        int[] hsl = ColorUtils.rgb2hsl(rgb);\r\n        hue = hsl[0];\r\n        handleX = (int) Math.min(Math.max(Math.round(hsl[1] * 180d / 100d),\r\n                                          0),\r\n                                 179);\r\n        handleY = (int) Math.min(Math.max(Math.round(hsl[2] * 180d / 100d),\r\n                                          0),\r\n                                 179);\r\n        drawGradient(true);\r\n        fireColorChanged(color);\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/canvas/Canvas.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.canvas;\r\n\r\nimport com.google.gwt.event.dom.client.HasAllMouseHandlers;\r\nimport com.google.gwt.event.dom.client.MouseDownHandler;\r\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\r\nimport com.google.gwt.event.dom.client.MouseOutHandler;\r\nimport com.google.gwt.event.dom.client.MouseOverHandler;\r\nimport com.google.gwt.event.dom.client.MouseUpHandler;\r\nimport com.google.gwt.event.dom.client.MouseWheelHandler;\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.google.gwt.user.client.DOM;\r\nimport com.google.gwt.user.client.Element;\r\nimport com.google.gwt.user.client.ui.Composite;\r\nimport com.google.gwt.user.client.ui.HTML;\r\n\r\npublic class Canvas extends Composite implements HasAllMouseHandlers {\r\n\r\n    private HTML html;\r\n    private Element canvas;\r\n\r\n    public Canvas() {\r\n        html = new HTML(\"<canvas></canvas>\");\r\n        initWidget(html);\r\n        canvas = (Element) html.getElement().getFirstChild();\r\n    }\r\n\r\n    public native RenderingContext getContext() /*-{\r\n        return this.@org.uberfire.ext.widgets.common.client.colorpicker.canvas.Canvas::canvas.getContext(\"2d\");\r\n    }-*/;\r\n\r\n    public void setCanvasSize(int width,\r\n                              int height) {\r\n        DOM.setElementPropertyInt(canvas,\r\n                                  \"width\",\r\n                                  width);\r\n        DOM.setElementPropertyInt(canvas,\r\n                                  \"height\",\r\n                                  height);\r\n    }\r\n\r\n    public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {\r\n        return html.addMouseDownHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addMouseUpHandler(MouseUpHandler handler) {\r\n        return html.addMouseUpHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addMouseOverHandler(MouseOverHandler handler) {\r\n        return html.addMouseOverHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addMouseOutHandler(MouseOutHandler handler) {\r\n        return html.addMouseOutHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addMouseMoveHandler(MouseMoveHandler handler) {\r\n        return html.addMouseMoveHandler(handler);\r\n    }\r\n\r\n    public HandlerRegistration addMouseWheelHandler(MouseWheelHandler handler) {\r\n        return html.addMouseWheelHandler(handler);\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/canvas/Gradient.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.canvas;\r\n\r\nimport com.google.gwt.core.client.JavaScriptObject;\r\n\r\npublic class Gradient extends JavaScriptObject {\r\n\r\n    protected Gradient() {\r\n    }\r\n\r\n    public final native void addColorStop(int offset,\r\n                                          String color) /*-{\r\n        this.addColorStop(offset, color);\r\n    }-*/;\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/canvas/ImageData.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.canvas;\r\n\r\nimport com.google.gwt.core.client.JavaScriptObject;\r\nimport com.google.gwt.core.client.JsArrayInteger;\r\n\r\npublic class ImageData extends JavaScriptObject {\r\n\r\n    protected ImageData() {\r\n    }\r\n\r\n    public final native int getWidth() /*-{\r\n        return this.width;\r\n    }-*/;\r\n\r\n    public final native int getHeight() /*-{\r\n        return this.height;\r\n    }-*/;\r\n\r\n    public final native JsArrayInteger getData() /*-{\r\n        return this.data;\r\n    }-*/;\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/canvas/RenderingContext.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.canvas;\r\n\r\nimport com.google.gwt.core.client.JavaScriptObject;\r\n\r\npublic class RenderingContext extends JavaScriptObject {\r\n\r\n    protected RenderingContext() {\r\n    }\r\n\r\n    public final native void setFillStyle(String style) /*-{\r\n        this.fillStyle = style;\r\n    }-*/;\r\n\r\n    public final native void setFillStyle(Gradient gradient) /*-{\r\n        this.fillStyle = gradient;\r\n    }-*/;\r\n\r\n    public final native void fillRect(int x,\r\n                                      int y,\r\n                                      int width,\r\n                                      int height) /*-{\r\n        this.fillRect(x, y, width, height);\r\n    }-*/;\r\n\r\n    public final native void beginPath() /*-{\r\n        this.beginPath();\r\n    }-*/;\r\n\r\n    public final native void closePath() /*-{\r\n        this.closePath();\r\n    }-*/;\r\n\r\n    public final native void fill() /*-{\r\n        this.fill();\r\n    }-*/;\r\n\r\n    public final native void moveTo(int x,\r\n                                    int y) /*-{\r\n        this.moveTo(x, y);\r\n    }-*/;\r\n\r\n    public final native void lineTo(int x,\r\n                                    int y) /*-{\r\n        this.lineTo(x, y);\r\n    }-*/;\r\n\r\n    public final native void arc(int x,\r\n                                 int y,\r\n                                 double radius,\r\n                                 double startAngle,\r\n                                 double endAngle,\r\n                                 boolean counterClockwise) /*-{\r\n        this.arc(x, y, radius, startAngle, endAngle, counterClockwise);\r\n    }-*/;\r\n\r\n    public final native Gradient createLinearGradient(int x1,\r\n                                                      int y1,\r\n                                                      int x2,\r\n                                                      int y2) /*-{\r\n        return this.createLinearGradient(x1, y1, x2, y2);\r\n    }-*/;\r\n\r\n    public final native ImageData getImageData(int x,\r\n                                               int y,\r\n                                               int width,\r\n                                               int height) /*-{\r\n        return this.getImageData(x, y, width, height);\r\n    }-*/;\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/dialog/Dialog.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.dialog;\r\n\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\nimport com.google.gwt.event.dom.client.ClickEvent;\r\nimport com.google.gwt.event.dom.client.ClickHandler;\r\nimport com.google.gwt.event.shared.HandlerRegistration;\r\nimport com.google.gwt.user.client.ui.Button;\r\nimport com.google.gwt.user.client.ui.DialogBox;\r\nimport com.google.gwt.user.client.ui.FlowPanel;\r\nimport com.google.gwt.user.client.ui.VerticalPanel;\r\nimport com.google.gwt.user.client.ui.Widget;\r\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\r\n\r\npublic abstract class Dialog extends DialogBox {\r\n\r\n    private ClickHandler buttonClickHandler = new ClickHandler() {\r\n        public void onClick(ClickEvent event) {\r\n            buttonClicked((Widget) event.getSource());\r\n        }\r\n    };\r\n    private Widget dialogArea;\r\n    private Button okButton;\r\n    private Button cancelButton;\r\n\r\n    public Dialog() {\r\n        VerticalPanel panel = new VerticalPanel();\r\n        dialogArea = createDialogArea();\r\n        panel.add(dialogArea);\r\n        panel.add(createButtonBar());\r\n        setWidget(panel);\r\n    }\r\n\r\n    public HandlerRegistration addDialogClosedHandler(DialogClosedHandler handler) {\r\n        return addHandler(handler,\r\n                          DialogClosedEvent.getType());\r\n    }\r\n\r\n    protected void close(boolean canceled) {\r\n        hide();\r\n        fireDialogClosed(canceled);\r\n    }\r\n\r\n    private void fireDialogClosed(boolean canceled) {\r\n        fireEvent(new DialogClosedEvent(canceled));\r\n    }\r\n\r\n    protected Widget createButtonBar() {\r\n        FlowPanel buttonsPanel = new FlowPanel();\r\n        buttonsPanel.setStyleName(\"DialogButtons\");\r\n        List<? extends Widget> buttons = createButtonsForButtonBar();\r\n        for (Widget button : buttons) {\r\n            buttonsPanel.add(button);\r\n        }\r\n        return buttonsPanel;\r\n    }\r\n\r\n    protected List<? extends Widget> createButtonsForButtonBar() {\r\n        okButton = createButton(CommonConstants.INSTANCE.OK());\r\n        cancelButton = createButton(CommonConstants.INSTANCE.Cancel());\r\n        return Arrays.asList(okButton,\r\n                             cancelButton);\r\n    }\r\n\r\n    protected Button createButton(String text) {\r\n        return new Button(text,\r\n                          buttonClickHandler);\r\n    }\r\n\r\n    protected abstract Widget createDialogArea();\r\n\r\n    protected Widget getDialogArea() {\r\n        return dialogArea;\r\n    }\r\n\r\n    protected abstract void buttonClicked(Widget button);\r\n\r\n    protected Button getOkButton() {\r\n        return okButton;\r\n    }\r\n\r\n    protected Button getCancelButton() {\r\n        return cancelButton;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/dialog/DialogClosedEvent.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.dialog;\r\n\r\nimport com.google.gwt.event.shared.GwtEvent;\r\n\r\npublic class DialogClosedEvent extends GwtEvent<DialogClosedHandler> {\r\n\r\n    private static Type<DialogClosedHandler> TYPE;\r\n\r\n    private boolean canceled;\r\n\r\n    DialogClosedEvent(boolean canceled) {\r\n        this.canceled = canceled;\r\n    }\r\n\r\n    public static Type<DialogClosedHandler> getType() {\r\n        if (TYPE == null) {\r\n            TYPE = new Type<DialogClosedHandler>();\r\n        }\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    public Type<DialogClosedHandler> getAssociatedType() {\r\n        return TYPE;\r\n    }\r\n\r\n    @Override\r\n    protected void dispatch(DialogClosedHandler handler) {\r\n        handler.dialogClosed(this);\r\n    }\r\n\r\n    public boolean isCanceled() {\r\n        return canceled;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/colorpicker/dialog/DialogClosedHandler.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.uberfire.ext.widgets.common.client.colorpicker.dialog;\r\n\r\nimport com.google.gwt.event.shared.EventHandler;\r\n\r\npublic interface DialogClosedHandler extends EventHandler {\r\n\r\n    void dialogClosed(DialogClosedEvent event);\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/AbstractConcurrentChangePopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterForceSaveReOpenCancelButtons;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterReOpenIgnoreButtons;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\npublic abstract class AbstractConcurrentChangePopup extends BaseModal {\n\n    @UiField\n    protected HTML message;\n    private AbstractConcurrentChangePopupWidgetBinder uiBinder = GWT.create(AbstractConcurrentChangePopupWidgetBinder.class);\n\n    protected AbstractConcurrentChangePopup(final String content,\n                                            final Command onIgnore,\n                                            final Command onAction,\n                                            final String buttonText) {\n        setTitle(CommonConstants.INSTANCE.Error());\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(AbstractConcurrentChangePopup.this));\n        }});\n        add(new ModalFooterReOpenIgnoreButtons(this,\n                                               onAction,\n                                               onIgnore,\n                                               buttonText));\n\n        message.setHTML(SafeHtmlUtils.fromTrustedString(content));\n    }\n\n    protected AbstractConcurrentChangePopup(final String content,\n                                            final Command onIgnore,\n                                            final Command onReOpen) {\n        this(content,\n             onIgnore,\n             onReOpen,\n             CommonConstants.INSTANCE.ReOpen());\n    }\n\n    protected AbstractConcurrentChangePopup(final String content,\n                                            final Command onForceSave,\n                                            final Command onIgnore,\n                                            final Command onReOpen) {\n        setTitle(CommonConstants.INSTANCE.Error());\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(AbstractConcurrentChangePopup.this));\n        }});\n        add(new ModalFooterForceSaveReOpenCancelButtons(this,\n                                                        onForceSave,\n                                                        onReOpen,\n                                                        onIgnore));\n\n        message.setHTML(SafeHtmlUtils.fromTrustedString(content));\n    }\n\n    interface AbstractConcurrentChangePopupWidgetBinder\n            extends\n            UiBinder<Widget, AbstractConcurrentChangePopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/AbstractConcurrentChangePopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Well>\n    <g:ScrollPanel width=\"100%\" height=\"200px\">\n      <g:HTML ui:field=\"message\"/>\n    </g:ScrollPanel>\n  </b:Well>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/AbstractLazyStackPanelHeader.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.event.logical.shared.HasOpenHandlers;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\npublic abstract class AbstractLazyStackPanelHeader extends SimplePanel\n        implements\n        HasCloseHandlers<AbstractLazyStackPanelHeader>,\n        HasOpenHandlers<AbstractLazyStackPanelHeader> {\n\n    protected boolean expanded = false;\n\n    public HandlerRegistration addOpenHandler(OpenHandler<AbstractLazyStackPanelHeader> handler) {\n        return addHandler(handler,\n                          OpenEvent.getType());\n    }\n\n    public HandlerRegistration addCloseHandler(CloseHandler<AbstractLazyStackPanelHeader> handler) {\n        return addHandler(handler,\n                          CloseEvent.getType());\n    }\n\n    public abstract void expand();\n\n    public abstract void collapse();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/AbstractRestrictedEntryTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyPressEvent;\nimport com.google.gwt.event.dom.client.KeyPressHandler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport org.gwtbootstrap3.client.ui.TextBox;\n\n/**\n * A TextBox to handle restricted entry\n */\npublic abstract class AbstractRestrictedEntryTextBox extends TextBox {\n\n    protected final boolean allowEmptyValue;\n\n    public AbstractRestrictedEntryTextBox() {\n        this(false);\n    }\n\n    public AbstractRestrictedEntryTextBox(final boolean allowEmptyValue) {\n        this.allowEmptyValue = allowEmptyValue;\n        setup();\n    }\n\n    protected void setup() {\n        final TextBox me = this;\n\n        //Validate value as it is entered\n        this.addKeyPressHandler(new KeyPressHandler() {\n\n            public void onKeyPress(KeyPressEvent event) {\n\n                // Permit navigation\n                int keyCode = event.getNativeEvent().getKeyCode();\n                if (event.isControlKeyDown()\n                        || keyCode == KeyCodes.KEY_BACKSPACE\n                        || keyCode == KeyCodes.KEY_DELETE\n                        || keyCode == KeyCodes.KEY_LEFT\n                        || keyCode == KeyCodes.KEY_RIGHT\n                        || keyCode == KeyCodes.KEY_TAB\n                        || keyCode == KeyCodes.KEY_HOME\n                        || keyCode == KeyCodes.KEY_END\n                        ) {\n                    return;\n                }\n\n                // Get new value and validate\n                int charCode = event.getCharCode();\n                String oldValue = me.getValue();\n                String newValue = oldValue.substring(0,\n                                                     me.getCursorPos());\n                newValue = newValue\n                        + ((char) charCode);\n                newValue = newValue\n                        + oldValue.substring(me.getCursorPos() + me.getSelectionLength());\n                if (!isValidValue(newValue,\n                                  false)) {\n                    event.preventDefault();\n                }\n            }\n        });\n\n        //Add validation when looses focus (for when values are pasted in by users')\n        this.addBlurHandler(new BlurHandler() {\n\n            @Override\n            public void onBlur(BlurEvent event) {\n                final String value = me.getText();\n                if (!isValidValue(value,\n                                  true)) {\n                    final String validValue = makeValidValue(value);\n                    me.setText(validValue);\n                    ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this,\n                                          validValue);\n                }\n            }\n        });\n    }\n\n    @Override\n    public void setText(final String text) {\n        if (!isValidValue(text,\n                          false)) {\n            final String validValue = makeValidValue(text);\n            super.setText(validValue);\n            ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this,\n                                  validValue);\n        } else {\n            super.setText(text);\n        }\n    }\n\n    @Override\n    public void setValue(final String value) {\n        if (!isValidValue(value,\n                          false)) {\n            final String validValue = makeValidValue(value);\n            super.setValue(validValue);\n            ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this,\n                                  validValue);\n        } else {\n            super.setValue(value);\n        }\n    }\n\n    @Override\n    public void setValue(final String value,\n                         final boolean fireEvents) {\n        if (!isValidValue(value,\n                          false)) {\n            final String validValue = makeValidValue(value);\n            super.setValue(validValue,\n                           fireEvents);\n            ValueChangeEvent.fire(AbstractRestrictedEntryTextBox.this,\n                                  validValue);\n        } else {\n            super.setValue(value,\n                           fireEvents);\n        }\n    }\n\n    /**\n     * Validate value of TextBox\n     * @param value\n     * @param isOnFocusLost Focus has been lost from the TextBox\n     * @return True if valid\n     */\n    public abstract boolean isValidValue(final String value,\n                                         final boolean isOnFocusLost);\n\n    /**\n     * If validation fails (e.g. as a result of a user pasting a value) when the\n     * TextBox looses focus this method is called to transform the current value\n     * into one which is valid. This default implementation returns an empty\n     * String, however numerical TextBoxes could check the value is numerical\n     * and scale to that suitable for the type.\n     * @param value Current value\n     * @return A valid value\n     */\n    protected String makeValidValue(String value) {\n        return \"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/AddButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.HasClickHandlers;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.Label;\nimport org.uberfire.ext.widgets.common.client.resources.CommonImages;\n\npublic class AddButton extends Composite\n        implements\n        HasClickHandlers {\n\n    private Image plusButton = new Image(CommonImages.INSTANCE.newItem());\n\n    private Label textLabel = new Label();\n\n    public AddButton() {\n        HorizontalPanel panel = new HorizontalPanel();\n        panel.add(plusButton);\n        panel.add(textLabel);\n\n        initWidget(panel);\n        setStyleName(\"guvnor-cursor\");\n    }\n\n    public void setText(String text) {\n        textLabel.setText(text);\n    }\n\n    public HandlerRegistration addClickHandler(ClickHandler handler) {\n        textLabel.addClickHandler(handler);\n        return plusButton.addClickHandler(handler);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/BooleanTextBox.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.Objects;\n\npublic class BooleanTextBox extends AbstractRestrictedEntryTextBox {\n\n    public BooleanTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(final String value,\n                                final boolean isOnFocusLost) {\n\n        return (!isOnFocusLost && \"-\".equals(value))\n                || (value.trim().isEmpty() && allowEmptyValue)\n                || Objects.equals(value.toLowerCase(), Boolean.TRUE.toString())\n                || Objects.equals(value.toLowerCase(), Boolean.FALSE.toString());\n    }\n\n    @Override\n    protected String makeValidValue(final String value) {\n        return Boolean.TRUE.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/BusyIndicatorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\n\n@Dependent\npublic class BusyIndicatorView implements HasBusyIndicator {\n\n    @Override\n    public void showBusyIndicator(final String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    /**\n     * This method is invoked by the container when this bean is destroyed,\n     * so that loading popups are guaranteed to close when an enclosing\n     * bean is destroyed.\n     */\n    @Override\n    @PreDestroy\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/BusyPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.ui.DecoratedPopupPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.uberfire.ext.widgets.common.client.animations.LinearFadeInAnimation;\nimport org.uberfire.ext.widgets.common.client.animations.LinearFadeOutAnimation;\n\n/**\n * A simple pop-up to show messages while \"long running\" activities take place\n */\npublic class BusyPopup extends DecoratedPopupPanel {\n\n    private static LoadingViewBinder uiBinder = GWT.create(LoadingViewBinder.class);\n    private static final BusyPopup INSTANCE = new BusyPopup();\n\n    private static Timer deferredShowTimer = new Timer() {\n        @Override\n        public void run() {\n            fadeInAnimation.run(250);\n        }\n    };\n\n    private static MessageState state = MessageState.DORMANT;\n    private static final LinearFadeInAnimation fadeInAnimation = new LinearFadeInAnimation(INSTANCE) {\n\n        @Override\n        public void onStart() {\n            state = MessageState.SHOWING;\n            INSTANCE.center();\n            super.onStart();\n        }\n\n        @Override\n        public void onComplete() {\n            state = MessageState.VISIBLE;\n            super.onComplete();\n        }\n    };\n    private static final LinearFadeOutAnimation fadeOutAnimation = new LinearFadeOutAnimation(INSTANCE) {\n\n        @Override\n        public void onStart() {\n            state = MessageState.HIDING;\n            super.onStart();\n        }\n\n        @Override\n        public void onComplete() {\n            state = MessageState.DORMANT;\n            INSTANCE.hide();\n            super.onComplete();\n        }\n    };\n    @UiField\n    Span message;\n\n    private BusyPopup() {\n        setWidget(uiBinder.createAndBindUi(this));\n\n        //Make sure it appears on top of other popups\n        getElement().getStyle().setZIndex(Integer.MAX_VALUE);\n        setGlassEnabled(true);\n    }\n\n    public static void showMessage(final String message) {\n        switch (state) {\n            case DORMANT:\n                INSTANCE.message.setText(message);\n                deferredShowTimer.schedule(250);\n                state = MessageState.PENDING;\n                break;\n            case PENDING:\n            case SHOWING:\n            case VISIBLE:\n                INSTANCE.message.setText(message);\n                break;\n            case HIDING:\n                fadeOutAnimation.cancel();\n                INSTANCE.message.setText(message);\n                fadeInAnimation.onComplete();\n        }\n    }\n\n    public static void close() {\n        switch (state) {\n            case DORMANT:\n                break;\n            case PENDING:\n                deferredShowTimer.cancel();\n                state = MessageState.DORMANT;\n                break;\n            case SHOWING:\n                fadeInAnimation.cancel();\n                fadeOutAnimation.run(250);\n                break;\n            case VISIBLE:\n                fadeOutAnimation.run(250);\n                break;\n            case HIDING:\n                break;\n        }\n    }\n\n    private enum MessageState {\n        DORMANT,\n        PENDING,\n        SHOWING,\n        VISIBLE,\n        HIDING\n    }\n\n    interface LoadingViewBinder\n            extends\n            UiBinder<Widget, BusyPopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/BusyPopup.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:h=\"urn:import:org.gwtbootstrap3.client.ui.html\">\n\n  <ui:with field=\"resources\" type=\"org.uberfire.ext.widgets.common.client.resources.CommonResources\"/>\n\n  <g:HTMLPanel styleName=\"{resources.CSS.busyPopup}\">\n    <b:Well>\n        <h:Div addStyleNames=\"spinner spinner-lg\" pull=\"LEFT\" />\n        <h:Span ui:field=\"message\"/>\n    </b:Well>\n  </g:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/ClickableLabel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.HTML;\n\npublic class ClickableLabel extends HTML {\n\n    public ClickableLabel(String text,\n                          ClickHandler event,\n                          boolean enabled) {\n        super(doText(text,\n                     enabled));\n        if (enabled) {\n            this.addClickHandler(event);\n        }\n    }\n\n    public ClickableLabel(String text,\n                          ClickHandler event) {\n        this(text,\n             event,\n             true);\n    }\n\n    private static String doText(String text,\n                                 boolean enabled) {\n        if (enabled) {\n            return \"<div class='form-field'><span class='selectable-label'>\" + text + \"</span></div>\";\n        } else {\n            return \"<div class='form-field'>\" + text + \"</div>\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/ConcurrentChangePopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.http.client.URL;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\npublic class ConcurrentChangePopup extends AbstractConcurrentChangePopup {\n\n    private ConcurrentChangePopup(final String content,\n                                  final Command onIgnore,\n                                  final Command onAction,\n                                  final String buttonText) {\n        super(content,\n              onIgnore,\n              onAction,\n              buttonText);\n    }\n\n    private ConcurrentChangePopup(final String content,\n                                  final Command onIgnore,\n                                  final Command onReOpen) {\n        this(content,\n             onIgnore,\n             onReOpen,\n             CommonConstants.INSTANCE.ReOpen());\n    }\n\n    private ConcurrentChangePopup(final String content,\n                                  final Command onForceSave,\n                                  final Command onIgnore,\n                                  final Command onReOpen) {\n        super(content,\n              onForceSave,\n              onIgnore,\n              onReOpen);\n    }\n\n    public static ConcurrentChangePopup newConcurrentUpdate(final Path path,\n                                                            final User identity,\n                                                            final Command onForceSave,\n                                                            final Command onCancel,\n                                                            final Command onReOpen) {\n\n        final String message = CommonConstants.INSTANCE.ConcurrentUpdate(identity.getIdentifier(),\n                                                                         decode(path));\n        return new ConcurrentChangePopup(message,\n                                         onForceSave,\n                                         onCancel,\n                                         onReOpen);\n    }\n\n    public static ConcurrentChangePopup newConcurrentRename(final Path source,\n                                                            final Path target,\n                                                            final User identity,\n                                                            final Command onIgnore,\n                                                            final Command onReOpen) {\n        final String message = CommonConstants.INSTANCE.ConcurrentRename(identity.getIdentifier(),\n                                                                         decode(source),\n                                                                         decode(target));\n        return new ConcurrentChangePopup(message,\n                                         onIgnore,\n                                         onReOpen);\n    }\n\n    public static ConcurrentChangePopup newConcurrentDelete(final Path path,\n                                                            final User identity,\n                                                            final Command onIgnore,\n                                                            final Command onClose) {\n        final String message = CommonConstants.INSTANCE.ConcurrentDelete(identity.getIdentifier(),\n                                                                         decode(path));\n        return new ConcurrentChangePopup(message,\n                                         onIgnore,\n                                         onClose,\n                                         CommonConstants.INSTANCE.Close());\n    }\n\n    private static String decode(final Path path) {\n        return URL.decode(path.toURI());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DatePicker.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.Date;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.editor.client.IsEditor;\nimport com.google.gwt.editor.client.LeafValueEditor;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.i18n.client.LocaleInfo;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.*;\nimport com.google.web.bindery.event.shared.HandlerRegistration;\nimport org.gwtbootstrap3.client.shared.event.HideEvent;\nimport org.gwtbootstrap3.client.shared.event.HideHandler;\nimport org.gwtbootstrap3.client.shared.event.ShowHandler;\nimport org.gwtbootstrap3.client.ui.base.HasId;\nimport org.gwtbootstrap3.client.ui.base.HasPlaceholder;\nimport org.gwtbootstrap3.client.ui.base.HasResponsiveness;\nimport org.gwtbootstrap3.client.ui.constants.DeviceSize;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.constants.*;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.events.ChangeDateHandler;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.events.ChangeMonthHandler;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.events.ChangeYearHandler;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.events.ClearDateHandler;\n\n/**\n * A DatePicker wrapping BS3's DatePicker component adding additional functionality\n * required by KIE Workbench.; such as prevention of empty values and support for\n * setting the date format with GWT's DateTimeFormat patterns.\n */\npublic class DatePicker extends Composite\n        implements HasEnabled,\n                   Focusable,\n                   HasId,\n                   HasResponsiveness,\n                   HasVisibility,\n                   HasPlaceholder,\n                   HasAutoClose,\n                   HasDaysOfWeekDisabled,\n                   HasEndDate,\n                   HasForceParse,\n                   HasHighlightToday,\n                   HasKeyboardNavigation,\n                   HasMinView,\n                   HasShowTodayButton,\n                   HasStartDate,\n                   HasStartView,\n                   HasViewSelect,\n                   HasWeekStart,\n                   HasDateTimePickerHandlers,\n                   HasLanguage,\n                   HasName,\n                   HasValue<Date>,\n                   HasPosition,\n                   IsEditor<LeafValueEditor<Date>> {\n\n    private final boolean allowEmptyValues;\n    private final org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker datePicker;\n    //Default GWT date format\n    private String gwtDateFormat = \"dd-MMM-yyyy\";\n    private DateTimeFormat gwtDateTimeFormat = DateTimeFormat.getFormat(gwtDateFormat);\n    private String localeName;\n\n    public DatePicker() {\n        this(true);\n    }\n\n    /**\n     * Basic constuctor of uberfire datePicker without setting the datepicker container and without setting the hide\n     * handler to manage the interaction with org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker popup\n     * @param datePicker\n     */\n    public DatePicker(org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker datePicker) {\n        this.datePicker = datePicker;\n        this.allowEmptyValues = true;\n    }\n\n    public DatePicker(final boolean allowEmptyValues) {\n        datePicker = GWT.create(org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker.class);\n        this.allowEmptyValues = allowEmptyValues;\n        datePicker.setContainer(RootPanel.get());\n\n        datePicker.setAutoClose(true);\n        setLocaleName();\n        setFormat(gwtDateFormat);\n\n        //When the popup Date Picker component is hidden assert empty values\n        datePicker.addHideHandler(new HideHandler() {\n            @Override\n            public void onHide(HideEvent hideEvent) {\n                final Date value = getDataPickerDate();\n                if (!allowEmptyValues && value == null) {\n                    doSetValue(new Date(),\n                               true);\n                } else {\n                    doSetValue(value,\n                               true);\n                }\n            }\n        });\n\n        initWidget(datePicker);\n    }\n\n    protected Date getDataPickerDate() {\n        DateTimeFormat dtf = DateTimeFormat.getFormat(\"dd/M/yyyy\");\n        String dateStr = parseDate(datePicker.getTextBox().getElement(),\n                                   DatePickerFormatUtilities.convertToBS3DateFormat(\"dd/M/yyyy\"));\n        if(dateStr == null || dateStr.isEmpty()){\n            return null;\n        } else {\n            return dtf.parse(dateStr);\n        }\n    }\n\n    public void setContainer(final Widget container) {\n        datePicker.setContainer(container);\n    }\n\n    @Override\n    public void setAutoClose(final boolean autoClose) {\n        datePicker.setAutoClose(autoClose);\n    }\n\n    @Override\n    public void onShow(final Event e) {\n        datePicker.onShow(e);\n    }\n\n    @Override\n    public HandlerRegistration addShowHandler(final ShowHandler showHandler) {\n        return datePicker.addShowHandler(showHandler);\n    }\n\n    @Override\n    public void onHide(final Event e) {\n        datePicker.onHide(e);\n    }\n\n    @Override\n    public HandlerRegistration addHideHandler(final HideHandler hideHandler) {\n        return datePicker.addHideHandler(hideHandler);\n    }\n\n    @Override\n    public void onChangeDate(final Event e) {\n        datePicker.onChangeDate(e);\n    }\n\n    @Override\n    public HandlerRegistration addChangeDateHandler(final ChangeDateHandler changeDateHandler) {\n        return datePicker.addChangeDateHandler(changeDateHandler);\n    }\n\n    @Override\n    public void onChangeYear(final Event e) {\n        datePicker.onChangeYear(e);\n    }\n\n    @Override\n    public HandlerRegistration addChangeYearHandler(final ChangeYearHandler changeYearHandler) {\n        return datePicker.addChangeYearHandler(changeYearHandler);\n    }\n\n    @Override\n    public void onChangeMonth(final Event e) {\n        datePicker.onChangeMonth(e);\n    }\n\n    @Override\n    public HandlerRegistration addChangeMonthHandler(final ChangeMonthHandler changeMonthHandler) {\n        return datePicker.addChangeMonthHandler(changeMonthHandler);\n    }\n\n    @Override\n    public void onClearDate(final Event e) {\n        datePicker.onClearDate(e);\n    }\n\n    @Override\n    public HandlerRegistration addClearDateHandler(final ClearDateHandler outOfRangeHandler) {\n        return datePicker.addClearDateHandler(outOfRangeHandler);\n    }\n\n    @Override\n    public void setDaysOfWeekDisabled(final DatePickerDayOfWeek... daysOfWeekDisabled) {\n        datePicker.setDaysOfWeekDisabled(daysOfWeekDisabled);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return datePicker.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(final boolean enabled) {\n        datePicker.setEnabled(enabled);\n    }\n\n    @Override\n    public void setEndDate(final Date endDate) {\n        datePicker.setEndDate(endDate);\n    }\n\n    @Override\n    public void setEndDate(final String endDate) {\n        datePicker.setEndDate(endDate);\n    }\n\n    @Override\n    public void clearEndDate() {\n        datePicker.clearEndDate();\n    }\n\n    @Override\n    public void setForceParse(final boolean forceParse) {\n        datePicker.setForceParse(forceParse);\n    }\n\n    /**\n     * Set the format of the Date shown in the TextBox component.\n     * This is converted to BS3's Date Format that the underlying jQuery-based BS3 DatePicker\n     * uses to convert values in the TextBox to selections in the popup date picker element.\n     * @param gwtDateFormat\n     */\n    public void setFormat(final String gwtDateFormat) {\n        this.gwtDateFormat = gwtDateFormat;\n        this.gwtDateTimeFormat = DateTimeFormat.getFormat(this.gwtDateFormat);\n        if (getLocaleName().equals(\"\")) {\n            datePicker.setLanguage(DatePickerLanguage.EN);\n        } else {\n            datePicker.setLanguage(DatePickerLanguage.valueOf(getLocaleName().toUpperCase()));\n        }\n        datePicker.setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat));\n    }\n\n    public String getLocaleName() {\n        if (localeName != null && !localeName.isEmpty() && !localeName.equalsIgnoreCase(\"default\")) {\n            return localeName;\n        }\n        return \"\";\n    }\n\n    public void setLocaleName(String localeName) {\n        if (localeName != null) {\n            this.localeName = localeName;\n        } else {\n            this.localeName = \"\";\n        }\n    }\n\n    public void setLocaleName() {\n        localeName = LocaleInfo.getCurrentLocale().getLocaleName();\n    }\n\n    @Override\n    public void setHighlightToday(final boolean highlightToday) {\n        datePicker.setHighlightToday(highlightToday);\n    }\n\n    @Override\n    public String getId() {\n        return datePicker.getId();\n    }\n\n    @Override\n    public void setId(final String id) {\n        datePicker.setId(id);\n    }\n\n    @Override\n    public void setHasKeyboardNavigation(final boolean hasKeyboardNavigation) {\n        datePicker.setHasKeyboardNavigation(hasKeyboardNavigation);\n    }\n\n    @Override\n    public DatePickerLanguage getLanguage() {\n        return datePicker.getLanguage();\n    }\n\n    @Override\n    public void setLanguage(final DatePickerLanguage language) {\n        datePicker.setLanguage(language);\n    }\n\n    @Override\n    public void setMinView(final DatePickerMinView datePickerMinView) {\n        datePicker.setMinView(datePickerMinView);\n    }\n\n    @Override\n    public String getName() {\n        return datePicker.getName();\n    }\n\n    @Override\n    public void setName(final String name) {\n        datePicker.setName(name);\n    }\n\n    @Override\n    public String getPlaceholder() {\n        return datePicker.getPlaceholder();\n    }\n\n    @Override\n    public void setPlaceholder(final String placeholder) {\n        datePicker.setPlaceholder(placeholder);\n    }\n\n    @Override\n    public DatePickerPosition getPosition() {\n        return datePicker.getPosition();\n    }\n\n    @Override\n    public void setPosition(final DatePickerPosition position) {\n        datePicker.setPosition(position);\n    }\n\n    @Override\n    public void setVisibleOn(final DeviceSize deviceSize) {\n        datePicker.setVisibleOn(deviceSize);\n    }\n\n    @Override\n    public void setHiddenOn(final DeviceSize deviceSize) {\n        datePicker.setHiddenOn(deviceSize);\n    }\n\n    @Override\n    public void setShowTodayButton(final boolean showTodayButton) {\n        datePicker.setShowTodayButton(showTodayButton);\n    }\n\n    @Override\n    public void setStartDate(final Date startDate) {\n        datePicker.setStartDate(startDate);\n    }\n\n    @Override\n    public void setStartDate(final String startDate) {\n        datePicker.setStartDate(startDate);\n    }\n\n    @Override\n    public void clearStartDate() {\n        datePicker.clearStartDate();\n    }\n\n    @Override\n    public void setStartView(final DatePickerMinView datePickerMinView) {\n        datePicker.setStartView(datePickerMinView);\n    }\n\n    @Override\n    //We don't delegate this to the wrapped DatePicker as that has some issues with the mismatch between GWT's DateFormat and BS3's DateFormat\n    public Date getValue() {\n        try {\n            return gwtDateTimeFormat != null && datePicker.getTextBox().getValue() != null ? gwtDateTimeFormat.parse(datePicker.getTextBox().getValue()) : null;\n        } catch (final Exception e) {\n            return null;\n        }\n    }\n\n    @Override\n    //We don't delegate this to the wrapped DatePicker as that has some issues with the mismatch between GWT's DateFormat and BS3's DateFormat\n    public void setValue(final Date value) {\n        if (!allowEmptyValues && value == null) {\n            doSetValue(new Date(),\n                       true);\n        } else {\n            doSetValue(value,\n                       false);\n        }\n    }\n\n    @Override\n    //We don't delegate this to the wrapped DatePicker as that has some issues with the mismatch between GWT's DateFormat and BS3's DateFormat\n    public void setValue(final Date value,\n                         final boolean fireEvents) {\n        if (!allowEmptyValues && value == null) {\n            doSetValue(new Date(),\n                       true);\n        } else {\n            doSetValue(value,\n                       fireEvents);\n        }\n    }\n\n    //This is essentially an override of the wrapped DatePicker's setValue() method however\n    //we need to override it to use the \"improved\" GWT DateFormat<->BS3's DateFormat handling.\n    private void doSetValue(final Date value,\n                            final boolean fireEvents) {\n        datePicker.getTextBox().setValue(value != null ? gwtDateTimeFormat.format(value) : null);\n        update(datePicker.getTextBox().getElement());\n\n        if (fireEvents) {\n            ValueChangeEvent.fire(datePicker,\n                                  value);\n        }\n    }\n\n    //Unfortunately the wrapped DatePicker hides the \"update\" method so we have to repeat it here\n    private native void update(Element e) /*-{\n        $wnd.jQuery(e).datepicker('update');\n    }-*/;\n\n    private final native String parseDate(Element e,\n                                          String format) /*-{\n        var dateStr = $wnd.jQuery(e).datepicker('getFormattedDate', format);\n        return dateStr\n    }-*/;\n\n    @Override\n    public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(final ValueChangeHandler<Date> handler) {\n        return datePicker.addValueChangeHandler(handler);\n    }\n\n    @Override\n    public void setViewSelect(final DatePickerMinView datePickerMinView) {\n        datePicker.setViewSelect(datePickerMinView);\n    }\n\n    @Override\n    public void setWeekStart(final DatePickerDayOfWeek weekStart) {\n        datePicker.setWeekStart(weekStart);\n    }\n\n    @Override\n    public LeafValueEditor<Date> asEditor() {\n        return datePicker;\n    }\n\n    @Override\n    public int getTabIndex() {\n        return datePicker.getTextBox().getTabIndex();\n    }\n\n    @Override\n    public void setTabIndex(final int index) {\n        datePicker.getTextBox().setTabIndex(index);\n    }\n\n    @Override\n    public void setAccessKey(final char key) {\n        datePicker.getTextBox().setAccessKey(key);\n    }\n\n    @Override\n    public void setFocus(final boolean focused) {\n        datePicker.getTextBox().setFocus(focused);\n    }\n\n    public HandlerRegistration addBlurHandler(final BlurHandler handler) {\n        return datePicker.getTextBox().addBlurHandler(handler);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DatePickerFormatUtilities.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.i18n.client.DateTimeFormat;\n\n/**\n * Utilties to handle conversion between GWT's DateFormat to BS3's DateFormat\n */\npublic class DatePickerFormatUtilities {\n\n    private static final String DEFAULT = \"dd-M-yyyy\";\n    private static List<Mapping> mappings = new ArrayList<Mapping>() {{\n        add(new Mapping(\"yyyy\",\n                        \"yyyy\"));\n        add(new Mapping(\"yy\",\n                        \"yy\"));\n        add(new Mapping(\"MMMM\",\n                        \"MM\"));\n        add(new Mapping(\"MMM\",\n                        \"M\"));\n        add(new Mapping(\"MM\",\n                        \"mm\"));\n        add(new Mapping(\"M\",\n                        \"m\"));\n        add(new Mapping(\"dd\",\n                        \"dd\"));\n        add(new Mapping(\"d\",\n                        \"d\"));\n        add(new Mapping(\"HH\",\n                        \"hh\"));\n        add(new Mapping(\"H\",\n                        \"h\"));\n        add(new Mapping(\"hh\",\n                        \"HH\"));\n        add(new Mapping(\"h\",\n                        \"H\"));\n        add(new Mapping(\"mm\",\n                        \"ii\"));\n        add(new Mapping(\"m\",\n                        \"i\"));\n        add(new Mapping(\"ss\",\n                        \"ss\"));\n        add(new Mapping(\"s\",\n                        \"s\"));\n        add(new Mapping(\"G\",\n                        null));\n        add(new Mapping(\"L\",\n                        null));\n        add(new Mapping(\"S\",\n                        null));\n        add(new Mapping(\"E\",\n                        null));\n        add(new Mapping(\"c\",\n                        null));\n        add(new Mapping(\"a\",\n                        \"p\"));\n        add(new Mapping(\"k\",\n                        null));\n        add(new Mapping(\"K\",\n                        null));\n        add(new Mapping(\"z\",\n                        null));\n        add(new Mapping(\"Z\",\n                        null));\n        add(new Mapping(\"v\",\n                        null));\n    }};\n\n    /**\n     * BS3's DateFormat constants:\n     * @see org.gwtbootstrap3.extras.datepicker.client.ui.base.constants.HasFormat\n     * <p>\n     * The date format, combination of p, P, h, hh, i, ii, s, ss, d, dd, m, mm, M, MM, yy, yyyy.\n     * p    meridian in lower case ('am' or 'pm') - according to locale file\n     * P    meridian in upper case ('AM' or 'PM') - according to locale file\n     * s    seconds without leading zeros\n     * ss   seconds, 2 digits with leading zeros\n     * i    minutes without leading zeros\n     * ii   minutes, 2 digits with leading zeros\n     * h    hour without leading zeros - 24-hour format\n     * hh   hour, 2 digits with leading zeros - 24-hour format\n     * H    hour without leading zeros - 12-hour format\n     * HH   hour, 2 digits with leading zeros - 12-hour format\n     * d    day of the month without leading zeros\n     * dd   day of the month, 2 digits with leading zeros\n     * m    numeric representation of month without leading zeros\n     * mm   numeric representation of the month, 2 digits with leading zeros\n     * M    short textual representation of a month, three letters\n     * MM   full textual representation of a month, such as January or March\n     * yy   two digit representation of a year\n     * yyyy full numeric representation of a year, 4 digits\n     * <p>\n     * GWT's DateFormat constants:\n     * @see com.google.gwt.i18n.client.DateTimeFormat\n     * <p>\n     * G\tera designator\tText\tAD\n     * y\tyear\tNumber\t1996\n     * L\tstandalone month in year\tText or Number\tJuly (or) 07\n     * M\tmonth in year\tText or Number\tJuly (or) 07\n     * d\tday in month\tNumber\t10\n     * h\thour in am/pm (1-12)\tNumber\t12\n     * H\thour in day (0-23)\tNumber\t0\n     * m\tminute in hour\tNumber\t30\n     * s\tsecond in minute\tNumber\t55\n     * S\tfractional second\tNumber\t978\n     * E\tday of week\tText\tTuesday\n     * c\tstandalone day of week\tText\tTuesday\n     * a\tam/pm marker\tText\tPM\n     * k\thour in day (1-24)\tNumber\t24\n     * K\thour in am/pm (0-11)\tNumber\t0\n     * z\ttime zone\tText\tPacific Standard Time(see comment)\n     * Z\ttime zone (RFC 822)\tText\t-0800(See comment)\n     * v\ttime zone id\tText\tAmerica/Los_Angeles(See comment)\n     * '\tescape for text\tDelimiter\t'Date='\n     * ''\tsingle quote\tLiteral\t'o''clock'\n     **/\n    public static String convertToBS3DateFormat(final String gwtDateFormat) {\n        if (!isValidGWTDateFormat(gwtDateFormat)) {\n            return DEFAULT;\n        }\n\n        final StringBuilder src = new StringBuilder(gwtDateFormat);\n        final StringBuilder tgt = new StringBuilder();\n        int idx = 0;\n        while (idx < gwtDateFormat.length()) {\n            boolean mapped = false;\n            for (Mapping mapping : mappings) {\n                if (src.indexOf(mapping.src) == 0) {\n                    if (mapping.tgt != null) {\n                        tgt.append(mapping.tgt);\n                    }\n                    src.delete(0,\n                               mapping.src.length());\n                    idx = idx + mapping.src.length() - 1;\n                    mapped = true;\n                    break;\n                }\n            }\n            if (!mapped) {\n                tgt.append(src.charAt(0));\n                src.deleteCharAt(0);\n            }\n            idx++;\n        }\n        return tgt.toString();\n    }\n\n    private static boolean isValidGWTDateFormat(final String gwtDateFormat) {\n        try {\n            DateTimeFormat.getFormat(gwtDateFormat);\n        } catch (IllegalArgumentException iae) {\n            return false;\n        }\n        return true;\n    }\n\n    private static class Mapping {\n\n        private final String src;\n        private final String tgt;\n\n        Mapping(final String src,\n                final String tgt) {\n            this.src = src;\n            this.tgt = tgt;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DecoratedDisclosurePanel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.Iterator;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.event.logical.shared.HasOpenHandlers;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.DisclosurePanel;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * Disclosure panel with rounded corners in header.\n * <p>\n * Using this class we don't need to set the header and event handlers for the header everywhere we use DisclosurePanels.\n */\npublic class DecoratedDisclosurePanel extends Composite\n        implements\n        HasWidgets,\n        HasOpenHandlers<DisclosurePanel>,\n        HasCloseHandlers<DisclosurePanel> {\n\n    private final DisclosurePanel widget = new DisclosurePanel();\n\n    private LazyStackPanelHeader header;\n\n    public DecoratedDisclosurePanel(String headerText,\n                                    ImageResource headerIcon) {\n        widget.setAnimationEnabled(true);\n        widget.setHeader(createHeader(headerText,\n                                      headerIcon));\n        initWidget(widget);\n    }\n\n    public DecoratedDisclosurePanel(String headerText) {\n        widget.setAnimationEnabled(true);\n        widget.setHeader(createHeader(headerText));\n        initWidget(widget);\n    }\n\n    private LazyStackPanelHeader createHeader(String headerText) {\n        header = new LazyStackPanelHeader(headerText);\n        setupEventHandlers();\n        return header;\n    }\n\n    private LazyStackPanelHeader createHeader(String headerText,\n                                              ImageResource headerIcon) {\n        header = new LazyStackPanelHeader(headerText,\n                                          headerIcon);\n        setupEventHandlers();\n        return header;\n    }\n\n    private void setupEventHandlers() {\n        widget.addOpenHandler(new OpenHandler<DisclosurePanel>() {\n            public void onOpen(OpenEvent<DisclosurePanel> event) {\n                header.expand();\n            }\n        });\n        widget.addCloseHandler(new CloseHandler<DisclosurePanel>() {\n            public void onClose(CloseEvent<DisclosurePanel> event) {\n                header.collapse();\n            }\n        });\n    }\n\n    public void add(Widget w) {\n        widget.add(w);\n    }\n\n    public void setContent(Widget content) {\n        widget.setContent(content);\n    }\n\n    public HandlerRegistration addOpenHandler(OpenHandler<DisclosurePanel> openHandler) {\n        return widget.addOpenHandler(openHandler);\n    }\n\n    public HandlerRegistration addCloseHandler(CloseHandler<DisclosurePanel> handler) {\n        return widget.addCloseHandler(handler);\n    }\n\n    public void clear() {\n        widget.clear();\n    }\n\n    public Iterator<Widget> iterator() {\n        return widget.iterator();\n    }\n\n    public boolean remove(Widget w) {\n        return widget.remove(w);\n    }\n\n    public boolean isOpen() {\n        return widget.isOpen();\n    }\n\n    public void setOpen(boolean b) {\n        widget.setOpen(b);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableComposite.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.ui.Composite;\n\npublic abstract class DirtyableComposite extends Composite\n        implements\n        DirtyableWidget {\n\n    protected boolean dirtyflag = false;\n\n    public DirtyableComposite() {\n    }\n\n    public static native int getHeight() /*-{\n        var yScroll;\n\n        if ($wnd.innerHeight && $wnd.scrollMaxY) {\n            yScroll = $wnd.innerHeight + $wnd.scrollMaxY;\n        } else if ($doc.body.scrollHeight > $doc.body.offsetHeight) { // all but Explorer Mac\n            yScroll = $doc.body.scrollHeight;\n        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari\n            yScroll = $doc.body.offsetHeight;\n        }\n\n        var windowHeight;\n        if (self.innerHeight) { // all except Explorer\n            windowHeight = self.innerHeight;\n        } else if ($doc.documentElement && $doc.documentElement.clientHeight) { // Explorer 6 Strict Mode\n            windowHeight = $doc.documentElement.clientHeight;\n        } else if ($doc.body) { // other Explorers\n            windowHeight = $doc.body.clientHeight;\n        }\n\n        // for small pages with total height less then height of the viewport\n        if (yScroll < windowHeight) {\n            pageHeight = windowHeight;\n        } else {\n            pageHeight = yScroll;\n        }\n        return pageHeight;\n    }-*/;\n\n    public static native int getWidth() /*-{\n        var xScroll;\n\n        if ($wnd.innerHeight && $wnd.scrollMaxY) {\n            xScroll = $doc.body.scrollWidth;\n        } else if ($doc.body.scrollHeight > $doc.body.offsetHeight) { // all but Explorer Mac\n            xScroll = $doc.body.scrollWidth;\n        } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari\n            xScroll = $doc.body.offsetWidth;\n        }\n\n        var windowHeight;\n        if (self.innerHeight) { // all except Explorer\n            windowWidth = self.innerWidth;\n        } else if ($doc.documentElement && $doc.documentElement.clientHeight) { // Explorer 6 Strict Mode\n            windowWidth = $doc.documentElement.clientWidth;\n        } else if ($doc.body) { // other Explorers\n            windowWidth = $doc.body.clientWidth;\n        }\n\n        // for small pages with total width less then width of the viewport\n        if (xScroll < windowWidth) {\n            pageWidth = windowWidth;\n        } else {\n            pageWidth = xScroll;\n        }\n        return pageWidth;\n    }-*/;\n\n    public void onBrowserEvent(Event event) {\n        super.onBrowserEvent(event);\n    }\n\n    /*\n     * (non-Javadoc)\n     * @see org.drools.guvnor.client.common.isDirtable#isDirty()\n     */\n    public boolean isDirty() {\n        return this.dirtyflag;\n    }\n\n    /*\n     * (non-Javadoc)\n     * @see org.drools.guvnor.client.common.isDirtable#resetDirty()\n     */\n    public void resetDirty() {\n        this.dirtyflag = false;\n    }\n\n    /*\n     * (non-Javadoc)\n     * @see org.drools.guvnor.client.common.isDirtable#makeDirty()\n     */\n    public void makeDirty() {\n        this.dirtyflag = true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableContainer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\npublic interface DirtyableContainer extends IDirtyable {\n\n    public boolean hasDirty();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableFlexTable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.Iterator;\n\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class DirtyableFlexTable\n        extends FlexTable\n        implements DirtyableContainer {\n\n    public boolean hasDirty() {\n        Iterator<Widget> itr = iterator();\n        while (itr.hasNext()) {\n            Widget w = itr.next();\n            if ((w instanceof DirtyableWidget && ((DirtyableWidget) w).isDirty()) || (w instanceof DirtyableContainer && ((DirtyableContainer) w).hasDirty())) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public void setHorizontalAlignmentForFlexCellFormatter(int row,\n                                                           int column,\n                                                           HorizontalAlignmentConstant horizontalAlignmentConstant) {\n        getFlexCellFormatter().setHorizontalAlignment(row,\n                                                      column,\n                                                      horizontalAlignmentConstant);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableHorizontalPane.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class DirtyableHorizontalPane extends HorizontalPanel implements DirtyableContainer {\n\n    public boolean hasDirty() {\n        int widNumber = getWidgetCount();\n        Widget element;\n\n        for (int i = 0; i < widNumber; i++) {\n            element = getWidget(i);\n            if ((element instanceof DirtyableWidget && ((DirtyableWidget) element).isDirty()) ||\n                    (element instanceof DirtyableContainer && ((DirtyableContainer) element).hasDirty())) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableVerticalPane.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class DirtyableVerticalPane extends VerticalPanel implements DirtyableContainer {\n\n    public boolean hasDirty() {\n\n        int widNumber = getWidgetCount();\n        Widget element;\n\n        for (int i = 0; i < widNumber; i++) {\n            element = getWidget(i);\n            if (element instanceof DirtyableWidget) {\n                if (((DirtyableWidget) element).isDirty()) {\n                    return true;\n                }\n            }\n            if (element instanceof DirtyableContainer) {\n                if (((DirtyableContainer) element).hasDirty()) {\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DirtyableWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\npublic interface DirtyableWidget\n        extends\n        IDirtyable {\n\n    public abstract boolean isDirty();\n\n    public abstract void resetDirty();\n\n    public abstract void makeDirty();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/DropDownValueChanged.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\n/**\n * Well this should be pretty obvious.\n */\npublic interface DropDownValueChanged {\n\n    public void valueChanged(String newText,\n                             String newValue);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/EditorWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface EditorWidget\n        extends\n        IsWidget {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FileInputButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.event.logical.shared.HasValueChangeHandlers;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FileUpload;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.uberfire.ext.widgets.common.client.resources.CommonCss;\nimport org.uberfire.ext.widgets.common.client.resources.CommonResources;\n\npublic class FileInputButton extends Composite implements HasValueChangeHandlers<JsArray<FileInputButton.UploadFile>> {\n\n    protected static final CommonCss css = CommonResources.INSTANCE.CSS();\n\n    private Span wrapper;\n    private Span textSpan;\n    private FileUpload upload;\n    private Icon icon;\n\n    public FileInputButton() {\n        wrapper = new Span();\n        wrapper.addStyleName(Styles.BTN);\n        upload = new FileUpload();\n\n        upload.addChangeHandler(new ChangeHandler() {\n            @Override\n            public void onChange(ChangeEvent event) {\n                fireChanged();\n            }\n        });\n\n        wrapper.add(upload);\n        wrapper.addStyleName(\"btn-file\");\n        initWidget(wrapper);\n    }\n\n    public void setMultiple(boolean multiple) {\n        if (multiple) {\n            upload.getElement().setPropertyBoolean(\"multiple\",\n                                                   true);\n        }\n    }\n\n    public void setType(final ButtonType additionalStyle) {\n        if (additionalStyle != null) {\n            addStyleName(additionalStyle.getCssName());\n        }\n    }\n\n    @Override\n    public void addStyleName(final String additionalStyle) {\n        if (additionalStyle != null) {\n            wrapper.addStyleName(additionalStyle);\n        }\n    }\n\n    public String getText() {\n        if (textSpan != null) {\n            return textSpan.getText();\n        }\n        return \"\";\n    }\n\n    public void setText(final String text) {\n        if (textSpan == null) {\n            textSpan = new Span(text);\n            wrapper.add(textSpan);\n        } else {\n            textSpan.setText(text);\n        }\n    }\n\n    public void setIcon(final IconType type) {\n        if (icon == null) {\n            icon = new Icon(type);\n            wrapper.add(icon);\n        } else {\n            icon.setType(type);\n        }\n    }\n\n    private void fireChanged() {\n        ValueChangeEvent.fire(this,\n                              getFiles(upload.getElement()));\n    }\n\n    private native JsArray<UploadFile> getFiles(Element el) /*-{\n        if (el.files) {\n            return el.files;\n        } else {\n            return null;\n        }\n    }-*/;\n\n    @Override\n    public HandlerRegistration addValueChangeHandler(final ValueChangeHandler<JsArray<UploadFile>> handler) {\n        return super.addHandler(handler,\n                                ValueChangeEvent.getType());\n    }\n\n    public static class UploadFile extends JavaScriptObject {\n\n        protected UploadFile() {\n        }\n\n        public final native int getSize() /*-{\n            return this.fileSize != null ? this.fileSize : this.size;\n        }-*/;\n\n        public final native String getName() /*-{\n            return this.fileName != null ? this.fileName : this.name;\n        }-*/;\n\n        public final native String getType() /*-{\n            return this.type;\n        }-*/;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FileInputGroupButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.Span;\n\npublic class FileInputGroupButton extends Composite {\n\n    private Span wrapper;\n\n    public FileInputGroupButton(FileInputButton input) {\n        wrapper = new Span();\n        wrapper.setStyleName(Styles.INPUT_GROUP_BTN);\n        wrapper.add(input);\n        initWidget(wrapper);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FileUpload.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.InputElement;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Input;\nimport org.gwtbootstrap3.client.ui.InputGroupAddon;\nimport org.uberfire.mvp.Command;\n\npublic class FileUpload\n        extends Composite {\n\n    private static final String FAKEPATH = \"c:\\\\fakepath\\\\\";\n    private static FileUploadBinder uiBinder = GWT.create(FileUploadBinder.class);\n    private final Command command;\n    @UiField\n    InputGroupAddon uploadButton;\n\n    @UiField\n    InputGroupAddon chooseButton;\n\n    @UiField\n    Input file;\n\n    @UiField\n    Input fileText;\n\n    private boolean isDisabled = false;\n\n    public FileUpload() {\n        this(null,\n             false);\n    }\n\n    public FileUpload(final Command command) {\n        this(command,\n             true);\n    }\n\n    public FileUpload(final Command command,\n                      boolean displayUploadButton) {\n        initWidget(uiBinder.createAndBindUi(this));\n        this.command = command;\n        fileText.setReadOnly(true);\n\n        file.addChangeHandler(getFileChangeHandler());\n\n        chooseButton.addDomHandler(new ClickHandler() {\n                                       @Override\n                                       public void onClick(ClickEvent event) {\n                                           ((InputElement) file.getElement().cast()).click();\n                                       }\n                                   },\n                                   ClickEvent.getType());\n\n        if (displayUploadButton) {\n            uploadButton.addDomHandler(new ClickHandler() {\n                                           @Override\n                                           public void onClick(ClickEvent event) {\n                                               if (isDisabled) {\n                                                   return;\n                                               }\n                                               if (command != null) {\n                                                   command.execute();\n                                               }\n                                           }\n                                       },\n                                       ClickEvent.getType());\n        } else {\n            uploadButton.removeFromParent();\n            uploadButton = null;\n        }\n    }\n\n    public void setName(final String name) {\n        file.setName(name);\n    }\n\n    public void upload() {\n        command.execute();\n    }\n\n    public String getFilename() {\n        return file.getValue();\n    }\n\n    public void setAccept(String type) {\n        file.getElement().setAttribute(\"accept\", type);\n    }\n\n    public void clear() {\n        file.setValue(\"\");\n        fileText.setText(\"\");\n    }\n\n    public void setEnabled(boolean b) {\n        if (uploadButton == null) {\n            return;\n        }\n        if (!b) {\n            isDisabled = true;\n            uploadButton.addStyleName(\"disabled\");\n        } else {\n            isDisabled = false;\n            uploadButton.removeStyleName(\"disabled\");\n        }\n    }\n\n    protected ChangeHandler getFileChangeHandler() {\n        return new ChangeHandler() {\n            @Override\n            public void onChange(ChangeEvent event) {\n                String fileName = file.getValue();\n                if (fileName != null && fileName.toLowerCase().startsWith(FAKEPATH)) {\n                    fileName = fileName.substring(FAKEPATH.length());\n                }\n                fileText.setValue(fileName);\n            }\n        };\n    }\n\n    interface FileUploadBinder extends UiBinder<Widget, FileUpload> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FileUpload.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n    <ui:with field=\"i18n\"\n             type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n    <b:InputGroup>\n        <b:Input ui:field=\"file\" type=\"FILE\" visible=\"false\"/>\n        <b:Input ui:field=\"fileText\" type=\"TEXT\"/>\n        <b:InputGroupAddon ui:field=\"chooseButton\" icon=\"FILE_O\" iconPosition=\"RIGHT\" title=\"{i18n.ChooseFile}\" addStyleNames=\"btn btn-default\"/>\n        <b:InputGroupAddon ui:field=\"uploadButton\" icon=\"UPLOAD\" iconPosition=\"RIGHT\" title=\"{i18n.Upload}\" addStyleNames=\"btn btn-default\"/>\n    </b:InputGroup>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FileUploadFormEncoder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.dom.client.FormElement;\nimport com.google.gwt.user.client.ui.Hidden;\nimport org.gwtbootstrap3.client.ui.Form;\n\npublic class FileUploadFormEncoder {\n\n    /**\n     * Sets the encoding of the provided form to UTF-8, see\n     * https://code.google.com/p/google-web-toolkit/issues/detail?id=4682 for\n     * details.\n     * @param form\n     */\n    public void addUtf8Charset(final Form form) {\n        FormElement.as(form.getElement()).setAcceptCharset(\"UTF-8\");\n\n        final Hidden field = new Hidden();\n        field.setName(\"utf8char\");\n        field.setValue(\"\\u8482\");\n        form.add(field);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FormStyleItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.uberfire.client.views.pfly.widgets.FormLabelHelp;\n\npublic class FormStyleItem extends Composite {\n\n    private static FormStyleLayoutBinder uiBinder = GWT.create(FormStyleLayoutBinder.class);\n    @UiField\n    FormGroup formGroup;\n    @UiField\n    FlowPanel group;\n    @UiField\n    FlowPanel labelContainer;\n    int index = -1;\n\n    public FormStyleItem() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setup(final String labelText,\n                      final IsWidget field,\n                      final int index) {\n        final FormLabel formLabel = GWT.create(FormLabel.class);\n        formLabel.setText(labelText);\n        labelContainer.add(formLabel);\n        group.add(field);\n        this.index = index;\n    }\n\n    public void setup(final String labelText,\n                      final String helpTitle,\n                      final String helpContent,\n                      final IsWidget widget,\n                      final int index) {\n        final FormLabelHelp formLabel = GWT.create(FormLabelHelp.class);\n        formLabel.setText(labelText);\n        formLabel.setHelpTitle(helpTitle);\n        formLabel.setHelpContent(helpContent);\n        labelContainer.add(formLabel);\n        group.add(widget);\n        this.index = index;\n    }\n\n    public FormGroup getFormGroup() {\n        return this.formGroup;\n    }\n\n    public FlowPanel getGroup() {\n        return this.group;\n    }\n\n    public int getIndex() {\n        return this.index;\n    }\n\n    interface FormStyleLayoutBinder\n            extends\n            UiBinder<Widget, FormStyleItem> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FormStyleItem.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n    <b:FormGroup ui:field=\"formGroup\">\n        <b:Column size=\"MD_4\">\n            <g:FlowPanel ui:field=\"labelContainer\"/>\n        </b:Column>\n        <b:Column size=\"MD_8\">\n            <g:FlowPanel ui:field=\"group\"/>\n        </b:Column>\n    </b:FormGroup>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/FormStyleLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.Legend;\nimport org.gwtbootstrap3.client.ui.constants.ColumnSize;\nimport org.gwtbootstrap3.client.ui.constants.FormType;\n\npublic class FormStyleLayout extends Form {\n\n    public FormStyleLayout() {\n        setType(FormType.HORIZONTAL);\n    }\n\n    public FormStyleLayout(final String title) {\n        this();\n        add(new Legend(title));\n    }\n\n    public FormStyleLayout(final Image icon,\n                           final String title) {\n        this();\n        add(new Legend() {{\n            getElement().appendChild(icon.getElement());\n            getElement().setInnerText(title);\n        }});\n    }\n\n    public FormStyleItem addAttribute(String label,\n                                      IsWidget widget) {\n        final FormStyleItem formStyleItem = GWT.create(FormStyleItem.class);\n        formStyleItem.setup(label,\n                            widget,\n                            getWidgetCount());\n        add(formStyleItem);\n        return formStyleItem;\n    }\n\n    public FormStyleItem addAttribute(final String label,\n                                      final String helpTitle,\n                                      final String helpContent,\n                                      final IsWidget widget) {\n        final FormStyleItem formStyleItem = GWT.create(FormStyleItem.class);\n        formStyleItem.setup(label,\n                            helpTitle,\n                            helpContent,\n                            widget,\n                            getWidgetCount());\n        add(formStyleItem);\n        return formStyleItem;\n    }\n\n    public int addRow(final IsWidget widget) {\n        final FormGroup formGroup;\n        if (widget instanceof FormGroup) {\n            formGroup = (FormGroup) widget;\n        } else {\n            formGroup = new FormGroup();\n            if (widget instanceof Column) {\n                formGroup.add(widget);\n            } else {\n                formGroup.add(new Column(ColumnSize.MD_12) {{\n                    add(widget);\n                }});\n            }\n        }\n\n        add(formGroup);\n        return getWidgetCount() - 1;\n    }\n\n    public void setAttributeVisibility(final int index,\n                                       final boolean b) {\n        try {\n            final IsWidget widget = getWidget(index);\n            if (widget != null) {\n                getWidget(index).setVisible(b);\n            }\n        } catch (final IndexOutOfBoundsException ignore) {\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/HasBusyIndicator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\n/**\n * Implementations support a \"Busy\" indicator\n */\npublic interface HasBusyIndicator {\n\n    void showBusyIndicator(final String message);\n\n    void hideBusyIndicator();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/HeaderHTML.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class HeaderHTML extends Composite {\n\n    private static HeaderHTMLBinder uiBinder = GWT.create(HeaderHTMLBinder.class);\n    @UiField\n    Label textLabel;\n    @UiField\n    Image image;\n\n    public HeaderHTML() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setText(String text) {\n        textLabel.setText(text);\n    }\n\n    public void setImageResource(ImageResource imageResource) {\n        image.setResource(imageResource);\n    }\n\n    interface HeaderHTMLBinder\n            extends\n            UiBinder<Widget, HeaderHTML> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/HeaderHTML.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'>\n\n  <gwt:HorizontalPanel>\n    <gwt:Image ui:field=\"image\"></gwt:Image>\n    <gwt:Label ui:field=\"textLabel\"></gwt:Label>\n  </gwt:HorizontalPanel>\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/IDirtyable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\npublic interface IDirtyable {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/ImageButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiConstructor;\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.Image;\n\n/**\n * Really just an image, but tacks on the image-Button style name.\n */\npublic class ImageButton extends FocusPanel {\n\n    private final Image img;\n    private final Image disabledImg;\n    private ClickHandler clickHandler;\n    private HandlerRegistration handlerRegistration;\n\n    @UiConstructor\n    public ImageButton(Image img) {\n        add(img);\n        this.img = img;\n        this.disabledImg = img;\n        setStyleName(\"image-Button\");\n    }\n\n    public ImageButton(Image img,\n                       Image disabledImg,\n                       String tooltip) {\n        add(img);\n        this.img = img;\n        this.disabledImg = disabledImg;\n        setStyleName(\"image-Button\");\n        setTitle(tooltip);\n    }\n\n    public ImageButton(Image img,\n                       Image disabledImg) {\n        add(img);\n        this.img = img;\n        this.disabledImg = disabledImg;\n        setStyleName(\"image-Button\");\n    }\n\n    public ImageButton(Image img,\n                       String tooltip) {\n        add(img);\n        this.img = img;\n        this.disabledImg = img;\n        setStyleName(\"image-Button\");\n        setTitle(tooltip);\n    }\n\n    public ImageButton(Image img,\n                       String tooltip,\n                       ClickHandler clickHandler) {\n        this(img,\n             tooltip);\n        this.clickHandler = clickHandler;\n        assertClickHandler();\n    }\n\n    public ImageButton(Image img,\n                       Image disabledImg,\n                       String tooltip,\n                       ClickHandler clickHandler) {\n        this(img,\n             disabledImg,\n             tooltip);\n        this.clickHandler = clickHandler;\n        assertClickHandler();\n    }\n\n    public void setEnabled(boolean enabled) {\n        clear();\n        if (enabled) {\n            add(img);\n            assertClickHandler();\n        } else {\n            add(disabledImg);\n            removeClickHandler();\n        }\n    }\n\n    private void assertClickHandler() {\n        if (this.clickHandler != null) {\n            if (this.handlerRegistration == null) {\n                this.handlerRegistration = addClickHandler(this.clickHandler);\n            }\n        }\n    }\n\n    private void removeClickHandler() {\n        if (this.handlerRegistration != null) {\n            this.handlerRegistration.removeHandler();\n            this.handlerRegistration = null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/InfoCube.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.HasClickHandlers;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\n\npublic class InfoCube\n        extends Composite\n        implements HasClickHandlers {\n\n    private static PerspectiveButtonBinder uiBinder = GWT.create(PerspectiveButtonBinder.class);\n    @UiField\n    Heading title;\n    @UiField\n    Paragraph content;\n\n    public InfoCube() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setTitle(String title) {\n        super.setTitle(title);\n        this.title.setText(title);\n    }\n\n    public void setContent(String text) {\n        content.setText(text);\n    }\n\n    @Override\n    public HandlerRegistration addClickHandler(ClickHandler handler) {\n        return addDomHandler(handler,\n                             ClickEvent.getType());\n    }\n\n    interface PerspectiveButtonBinder extends UiBinder<Widget, InfoCube> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/InfoCube.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bh=\"urn:import:org.gwtbootstrap3.client.ui.html\">\n\n  <ui:style>\n    .infoCube {\n      padding: 20px;\n      margin: 10px;\n    }\n\n    .infoCubeContent {\n      font-size: 16px;\n    }\n  </ui:style>\n\n  <b:Jumbotron addStyleNames=\"{style.infoCube}\">\n    <b:Heading ui:field=\"title\" size=\"H3\"/>\n    <bh:Paragraph ui:field=\"content\" addStyleNames=\"{style.infoCubeContent}\"/>\n  </b:Jumbotron>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/InfoPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Popover;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.gwtbootstrap3.client.ui.constants.Trigger;\n\nimport com.google.gwt.dom.client.Element;\n\n/**\n * This is handy for in-place context help.\n */\npublic class InfoPopup extends Popover {\n\n    public InfoPopup(final String text) {\n        super(text);\n        configure();\n        recreate();\n    }\n\n    public InfoPopup(final String heading,\n                     final String text) {\n        super(heading, text);\n        configure();\n        recreate();\n    }\n\n    private void configure() {\n        setPlacement(Placement.RIGHT);\n        setTrigger(Trigger.HOVER);\n\n        final Icon icon = new Icon(IconType.QUESTION);\n        icon.addStyleName(\"help-inline\");\n        setWidget(icon);\n\n        configurePopoverContainer(getWidget().getElement());\n        getWidget().getElement().getStyle().setZIndex(Integer.MAX_VALUE);\n    }\n\n    private native void configurePopoverContainer(Element e) /*-{\n                                                             $wnd.jQuery(e).popover({\n                                                             container: 'body'\n                                                             });\n                                                             }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/LazyStackPanel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\n\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * The GWT StackPanel is not working as we want. So doing a custom one.\n */\npublic class LazyStackPanel extends Composite\n        implements\n        HasSelectionHandlers<LazyStackPanelRow> {\n\n    private FlexTable flexTable = new FlexTable();\n    private int rowIndex = 0;\n\n    public LazyStackPanel() {\n\n        initWidget(flexTable);\n\n        flexTable.setStyleName(\"guvnor-lazyStackPanel\");\n\n        addSelectionHandler(new SelectionHandler<LazyStackPanelRow>() {\n\n            public void onSelection(SelectionEvent<LazyStackPanelRow> event) {\n                LazyStackPanelRow row = event.getSelectedItem();\n                if (row.isExpanded()) {\n                    row.compress();\n                } else {\n                    row.expand();\n                }\n            }\n        });\n    }\n\n    /**\n     * Add a new (collapsed) element to the stack.\n     * @param headerText\n     * @param contentLoad\n     */\n    public void add(String headerText,\n                    LoadContentCommand contentLoad) {\n        this.add(headerText,\n                 contentLoad,\n                 false);\n    }\n\n    public void add(String headerText,\n                    LoadContentCommand contentLoad,\n                    boolean expanded) {\n        LazyStackPanelHeader header = new LazyStackPanelHeader(headerText);\n        add(header,\n            contentLoad,\n            expanded);\n    }\n\n    public void add(String headerText,\n                    ImageResource icon,\n                    LoadContentCommand contentLoad) {\n        LazyStackPanelHeader header = new LazyStackPanelHeader(headerText,\n                                                               icon);\n        add(header,\n            contentLoad,\n            false);\n    }\n\n    /**\n     * Add a new (collapsed) element to the stack.\n     * @param header\n     * @param contentLoad\n     */\n    public void add(AbstractLazyStackPanelHeader header,\n                    LoadContentCommand contentLoad) {\n        this.add(header,\n                 contentLoad,\n                 false);\n    }\n\n    public void add(AbstractLazyStackPanelHeader header,\n                    LoadContentCommand contentLoad,\n                    boolean expanded) {\n        final LazyStackPanelRow row = new LazyStackPanelRow(header,\n                                                            contentLoad);\n\n        header.addOpenHandler(new OpenHandler<AbstractLazyStackPanelHeader>() {\n\n            public void onOpen(OpenEvent<AbstractLazyStackPanelHeader> event) {\n                selectRow(row);\n            }\n        });\n\n        header.addCloseHandler(new CloseHandler<AbstractLazyStackPanelHeader>() {\n\n            public void onClose(com.google.gwt.event.logical.shared.CloseEvent<AbstractLazyStackPanelHeader> event) {\n                selectRow(row);\n            }\n        });\n\n        addHeaderRow(row);\n\n        addContentRow(row.getContentPanel());\n\n        if (expanded) {\n            header.expand();\n        }\n    }\n\n    private void addHeaderRow(final LazyStackPanelRow row) {\n        flexTable.setWidget(rowIndex,\n                            0,\n                            row);\n        flexTable.getFlexCellFormatter().setStyleName(rowIndex,\n                                                      0,\n                                                      \"guvnor-LazyStackPanel-row-header\");\n        rowIndex++;\n    }\n\n    private void addContentRow(final SimplePanel panel) {\n        flexTable.setWidget(rowIndex++,\n                            0,\n                            panel);\n    }\n\n    private void selectRow(LazyStackPanelRow row) {\n        SelectionEvent.fire(this,\n                            row);\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(SelectionHandler<LazyStackPanelRow> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    public void swap(int firstIndex,\n                     int secondIndex) {\n\n        // Every list item is made of the header and content row.\n        // So we have twice as many rows.\n        firstIndex = firstIndex * 2;\n        secondIndex = secondIndex * 2;\n\n        Widget firstHeader = flexTable.getWidget(firstIndex,\n                                                 0);\n        Widget firstContent = flexTable.getWidget(firstIndex + 1,\n                                                  0);\n        Widget secondHeader = flexTable.getWidget(secondIndex,\n                                                  0);\n        Widget secondContent = flexTable.getWidget(secondIndex + 1,\n                                                   0);\n\n        flexTable.setWidget(firstIndex,\n                            0,\n                            secondHeader);\n        flexTable.setWidget(firstIndex + 1,\n                            0,\n                            secondContent);\n        flexTable.setWidget(secondIndex,\n                            0,\n                            firstHeader);\n        flexTable.setWidget(secondIndex + 1,\n                            0,\n                            firstContent);\n    }\n\n    public Iterator<AbstractLazyStackPanelHeader> getHeaderIterator() {\n        List<AbstractLazyStackPanelHeader> result = new ArrayList<AbstractLazyStackPanelHeader>();\n\n        for (final Widget widget : flexTable) {\n            if (widget instanceof LazyStackPanelRow) {\n                result.add(((LazyStackPanelRow) widget).getHeader());\n            }\n        }\n\n        return result.iterator();\n    }\n\n    public void remove(int index) {\n\n        index = index * 2;\n\n        flexTable.removeRow(index + 1);\n        flexTable.removeRow(index);\n    }\n\n    public void clean() {\n        flexTable.removeAllRows();\n        rowIndex = 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/LazyStackPanelHeader.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.widgets.common.client.resources.CommonImages;\n\npublic class LazyStackPanelHeader extends AbstractLazyStackPanelHeader {\n\n    private static LazyStackPanelHeaderBinder uiBinder = GWT.create(LazyStackPanelHeaderBinder.class);\n    @UiField\n    Image icon;\n    @UiField\n    HorizontalPanel container;\n    private ClickHandler expandClickHandler = new ClickHandler() {\n\n        public void onClick(ClickEvent event) {\n            onTitleClicked();\n        }\n    };\n\n    public LazyStackPanelHeader(final String headerText,\n                                final ImageResource headerIcon) {\n        this(headerText,\n             new Image(headerIcon));\n    }\n\n    public LazyStackPanelHeader(final String headerText,\n                                final Image headerIcon) {\n        this();\n        final Image titleIcon = headerIcon;\n        container.add(titleIcon);\n        final Label titleLabel = new Label(headerText);\n        titleLabel.setStyleName(\"guvnor-cursor\");\n        titleLabel.addClickHandler(expandClickHandler);\n        container.add(titleLabel);\n    }\n\n    public LazyStackPanelHeader(String headerText) {\n        this();\n        final Label titleLabel = new Label(headerText);\n        titleLabel.setStyleName(\"guvnor-cursor\");\n        titleLabel.addClickHandler(expandClickHandler);\n        container.add(titleLabel);\n    }\n\n    public LazyStackPanelHeader() {\n\n        add(uiBinder.createAndBindUi(this));\n\n        icon.addClickHandler(expandClickHandler);\n\n        setIconImage();\n\n        addOpenHandler(new OpenHandler<AbstractLazyStackPanelHeader>() {\n            public void onOpen(OpenEvent<AbstractLazyStackPanelHeader> event) {\n                expanded = true;\n                setIconImage();\n            }\n        });\n\n        addCloseHandler(new CloseHandler<AbstractLazyStackPanelHeader>() {\n            public void onClose(CloseEvent<AbstractLazyStackPanelHeader> event) {\n                expanded = false;\n                setIconImage();\n            }\n        });\n    }\n\n    public void expand() {\n        if (!expanded) {\n            onTitleClicked();\n        }\n    }\n\n    public void collapse() {\n        if (expanded) {\n            onTitleClicked();\n        }\n    }\n\n    private void setIconImage() {\n        if (expanded) {\n            icon.setResource(CommonImages.INSTANCE.collapse());\n        } else {\n            icon.setResource(CommonImages.INSTANCE.expand());\n        }\n    }\n\n    private void onTitleClicked() {\n        if (expanded) {\n            CloseEvent.fire(this,\n                            this);\n        } else {\n            OpenEvent.fire(this,\n                           this);\n        }\n    }\n\n    interface LazyStackPanelHeaderBinder\n            extends\n            UiBinder<Widget, LazyStackPanelHeader> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/LazyStackPanelHeader.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'\n    >\n\n  <ui:with field='resources' type='org.uberfire.ext.widgets.common.client.resources.CommonResources'/>\n\n  <gwt:HTMLPanel>\n    <table style='width:100%; border-collapse:collapse;'>\n      <tr>\n        <td style='width:4px;'><div class='{resources.CSS.greyTopLeftCornerClass}'></div></td>\n        <td><div class='{resources.CSS.greyTopClass}'></div></td>\n        <td style='width:4px;'><div class='{resources.CSS.greyTopRightCornerClass}'></div></td>\n      </tr>\n\n      <tr>\n        <td class='{resources.CSS.greySideLeftClass}'></td>\n        <td class='{resources.CSS.greyCenterClass}'>\n          <gwt:HorizontalPanel ui:field=\"container\">\n            <gwt:SimplePanel styleName=\"guvnor-LazyStackPanel-row-header-icon\">\n              <gwt:Image ui:field=\"icon\" />\n            </gwt:SimplePanel>\n          </gwt:HorizontalPanel>\n        </td>\n        <td class='{resources.CSS.greySideRightClass}'></td>\n      </tr>\n\n      <tr>\n        <td style='width:4px;'><div class='{resources.CSS.greyBottomLeftCornerClass}'></div></td>\n        <td><div class='{resources.CSS.greyBottomClass}'></div></td>\n        <td style='width:4px;'><div class='{resources.CSS.greyBottomRightCornerClass}'></div></td>\n      </tr>\n    </table>\n  </gwt:HTMLPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/LazyStackPanelRow.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.animation.client.Animation;\nimport com.google.gwt.dom.client.Style.Overflow;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class LazyStackPanelRow extends VerticalPanel {\n\n    private static final int ANIMATION_DURATION = 350;\n    private final AbstractLazyStackPanelHeader header;\n    private LoadContentCommand contentLoad;\n    private Widget contentWidget = null;\n    private SimplePanel contentPanel = new SimplePanel();\n    private boolean expanded;\n\n    public LazyStackPanelRow(AbstractLazyStackPanelHeader titleWidget,\n                             LoadContentCommand contentLoad,\n                             boolean expanded) {\n        this.setWidth(\"100%\");\n        this.expanded = expanded;\n        this.header = titleWidget;\n        this.contentLoad = contentLoad;\n        init();\n    }\n\n    public LazyStackPanelRow(AbstractLazyStackPanelHeader titleWidget,\n                             LoadContentCommand contentLoad) {\n        this(titleWidget,\n             contentLoad,\n             false);\n    }\n\n    private void init() {\n        clear();\n        add(header);\n        if (contentWidget != null) {\n            contentWidget.setVisible(expanded);\n        }\n    }\n\n    public AbstractLazyStackPanelHeader getHeader() {\n        return header;\n    }\n\n    public SimplePanel getContentPanel() {\n        return contentPanel;\n    }\n\n    public void expand() {\n        expanded = true;\n\n        if (contentWidget == null) {\n            contentWidget = contentLoad.load();\n            contentPanel.add(contentWidget);\n        }\n        contentPanel.setVisible(true);\n        doAnimation(true);\n    }\n\n    public void compress() {\n        expanded = false;\n        contentPanel.setVisible(true);\n        doAnimation(false);\n    }\n\n    public boolean isExpanded() {\n        return expanded;\n    }\n\n    private void doAnimation(boolean isExpanding) {\n        if (contentPanel.getWidget() != null) {\n            ContentAnimation contentAnimation = new ContentAnimation(contentPanel);\n            contentAnimation.setExpanding(isExpanding);\n            contentAnimation.run(ANIMATION_DURATION);\n        }\n    }\n\n    private static class ContentAnimation extends Animation {\n\n        private boolean isExpanding;\n        private SimplePanel content;\n        private int height;\n\n        ContentAnimation(SimplePanel content) {\n            this.content = content;\n            this.height = content.getOffsetHeight();\n        }\n\n        void setExpanding(boolean isExpanding) {\n            this.isExpanding = isExpanding;\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            if (!isExpanding) {\n                progress = 1.0 - progress;\n            }\n            int h = (int) (this.height * progress);\n            content.setHeight(h + \"px\");\n        }\n\n        @Override\n        protected void onStart() {\n            content.getElement().getStyle().setOverflow(Overflow.HIDDEN);\n            super.onStart();\n        }\n\n        @Override\n        protected void onComplete() {\n            super.onComplete();\n            content.setVisible(isExpanding);\n            content.getElement().getStyle().setOverflow(Overflow.VISIBLE);\n            content.setHeight(\"100%\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/LoadContentCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.Widget;\n\npublic interface LoadContentCommand {\n\n    Widget load();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericBigDecimalTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.math.BigDecimal;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric BigDecimal values\n */\npublic class NumericBigDecimalTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?[0-9]*\\\\.?[0-9]*([eE][-+]?[0-9]*)?$)\");\n\n    public NumericBigDecimalTextBox() {\n        super(false);\n    }\n\n    public NumericBigDecimalTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            @SuppressWarnings(\"unused\")\n            BigDecimal check = new BigDecimal(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0.0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericBigIntegerTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.math.BigInteger;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric BigInteger values\n */\npublic class NumericBigIntegerTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?\\\\d*$)\");\n\n    public NumericBigIntegerTextBox() {\n        super(false);\n    }\n\n    public NumericBigIntegerTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            @SuppressWarnings(\"unused\")\n            BigInteger check = new BigInteger(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericByteTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric Byte values\n */\npublic class NumericByteTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?\\\\d*$)\");\n\n    public NumericByteTextBox() {\n        super(false);\n    }\n\n    public NumericByteTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Byte.parseByte(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericDoubleTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric Double values\n */\npublic class NumericDoubleTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?[0-9]*\\\\.?[0-9]*$)\");\n\n    public NumericDoubleTextBox() {\n        super(false);\n    }\n\n    public NumericDoubleTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Double.parseDouble(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0.0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericFloatTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle float values\n */\npublic class NumericFloatTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid Float\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?[0-9]*\\\\.?[0-9]*$)\");\n\n    public NumericFloatTextBox() {\n        super(false);\n    }\n\n    public NumericFloatTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Float.parseFloat(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0.0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericIntegerTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle integer values\n */\npublic class NumericIntegerTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid integer\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?\\\\d*$)\");\n\n    public NumericIntegerTextBox() {\n        super(false);\n    }\n\n    public NumericIntegerTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(final String value,\n                                final boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Integer.parseInt(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericLongTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric Long values\n */\npublic class NumericLongTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?\\\\d*$)\");\n\n    public NumericLongTextBox() {\n        super(false);\n    }\n\n    public NumericLongTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Long.parseLong(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericShortTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric Short values\n */\npublic class NumericShortTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?\\\\d*$)\");\n\n    public NumericShortTextBox() {\n        super(false);\n    }\n\n    public NumericShortTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            Short.parseShort(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n\n    @Override\n    protected String makeValidValue(String value) {\n        return \"0\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/NumericTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.math.BigDecimal;\n\nimport com.google.gwt.regexp.shared.RegExp;\n\n/**\n * A TextBox to handle numeric values. This is only for *LEGACY* support when\n * all numerical data-types were handled as BigDecimals. Please refer to the\n * sibling classes NumericXXXTextBox\n */\npublic class NumericTextBox extends AbstractRestrictedEntryTextBox {\n\n    // A valid number\n    private static final RegExp VALID = RegExp.compile(\"(^[-]?[0-9]*\\\\.?[0-9]*([eE][-+]?[0-9]*)?$)\");\n\n    public NumericTextBox() {\n        super(false);\n    }\n\n    public NumericTextBox(final boolean allowEmptyValue) {\n        super(allowEmptyValue);\n    }\n\n    @Override\n    public boolean isValidValue(String value,\n                                boolean isOnFocusLost) {\n        boolean isValid = VALID.test(value);\n        if (!isValid) {\n            return isValid;\n        }\n        if (!isOnFocusLost && \"-\".equals(value)) {\n            return true;\n        }\n        try {\n            @SuppressWarnings(\"unused\")\n            BigDecimal check = new BigDecimal(value);\n        } catch (NumberFormatException nfe) {\n            isValid = (\"\".equals(value) && allowEmptyValue);\n        }\n        return isValid;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/Page.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n *\n */\npublic abstract class Page {\n\n    private final String label;\n    private final PageView view;\n\n    public Page(final IsWidget widget) {\n        this(widget,\n             \"\");\n    }\n\n    public Page(final IsWidget widget,\n                final String label) {\n        this.view = new PageView(this,\n                                 widget);\n        this.label = label;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public abstract void onFocus();\n\n    public abstract void onLostFocus();\n\n    PageView getView() {\n        return view;\n    }\n\n    public class PageView\n            extends SimpleLayoutPanel\n            implements RequiresResize {\n\n        private final Page presenter;\n        private final ScrollPanel sp = new ScrollPanel();\n\n        public PageView(Page presenter,\n                        IsWidget widget) {\n            this.presenter = presenter;\n            sp.setWidget(widget);\n            setWidget(sp);\n        }\n\n        @Override\n        public void onResize() {\n            final Widget parent = getParent();\n            if (parent != null) {\n                final int width = parent.getOffsetWidth();\n                final int height = parent.getOffsetHeight();\n                sp.setPixelSize(width,\n                                height);\n            }\n            super.onResize();\n        }\n\n        void onFocus() {\n            presenter.onFocus();\n        }\n\n        public void onLostFocus() {\n            presenter.onLostFocus();\n        }\n\n        public ScrollPanel getSp() {\n            return sp;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/PrettyFormLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlexTable;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasHorizontalAlignment;\nimport com.google.gwt.user.client.ui.HasVerticalAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Form;\n\n/**\n * Uses ext forms to do a prettier layout.\n */\npublic class PrettyFormLayout extends Composite {\n\n    private VerticalPanel layout = new VerticalPanel();\n    private FlexTable currentTable;\n    private String sectionName;\n\n    public PrettyFormLayout() {\n        layout.setWidth(\"100%\");\n        initWidget(layout);\n    }\n\n    public void startSection() {\n        this.currentTable = new FlexTable();\n    }\n\n    public void startSection(String title) {\n        startSection();\n        this.sectionName = title;\n    }\n\n    public void clear() {\n        this.layout.clear();\n    }\n\n    public void addHeader(Image img,\n                          String name,\n                          Image edit) {\n        HorizontalPanel h = new HorizontalPanel();\n        h.add(img);\n        h.add(new HTML(\"&nbsp;\"));\n        h.add(new Label(name));\n        if (edit != null) {\n            h.add(edit);\n        }\n\n        Form f = newForm(null);\n\n        f.add(h);\n        layout.add(f);\n    }\n\n    public void addHeader(Image img,\n                          Widget content) {\n        HorizontalPanel h = new HorizontalPanel();\n        h.add(img);\n        h.add(new HTML(\"&nbsp;\"));\n        h.add(content);\n        Form f = newForm(null);\n        f.add(h);\n        layout.add(f);\n    }\n\n    private Form newForm(final String hdr) {\n        Form fp = new Form();\n        fp.setWidth(\"100%\");\n        fp.addStyleName(\"guvnor-FormPanel\");\n        if (hdr != null) {\n            fp.setTitle(hdr);\n        }\n        return fp;\n    }\n\n    public void endSection() {\n        Form f = newForm(this.sectionName);\n\n        f.add(this.currentTable);\n\n        this.layout.add(f);\n        this.sectionName = null;\n    }\n\n    public void addRow(final Widget widget) {\n        //TODO ARIA: what to do with widget has no visible label?\n\n        int row = currentTable.getRowCount();\n        currentTable.setWidget(row,\n                               0,\n                               widget);\n        currentTable.getFlexCellFormatter().setColSpan(row,\n                                                       0,\n                                                       2);\n    }\n\n    public int addAttribute(String lbl,\n                            final Widget categories) {\n        String id = DOM.createUniqueId();\n        categories.getElement().setAttribute(\"aria-labelledby\",\n                                             id);\n        categories.getElement().setAttribute(\"aria-required\",\n                                             String.valueOf(true));\n        categories.getElement().setTabIndex(0);\n\n        int row = currentTable.getRowCount();\n        Label label = new Label(lbl);\n        label.getElement().setAttribute(\"id\",\n                                        id);\n\n        currentTable.setWidget(row,\n                               0,\n                               label);\n        currentTable.setWidget(row,\n                               1,\n                               categories);\n        currentTable.getFlexCellFormatter().setHorizontalAlignment(row,\n                                                                   0,\n                                                                   HasHorizontalAlignment.ALIGN_RIGHT);\n        currentTable.getFlexCellFormatter().setVerticalAlignment(row,\n                                                                 0,\n                                                                 HasVerticalAlignment.ALIGN_TOP);\n\n        return row;\n    }\n\n    public void removeRow(int row) {\n\n        currentTable.removeRow(row);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/ResizableTextArea.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.gwtbootstrap3.client.ui.TextArea;\n\npublic class ResizableTextArea extends TextArea\n        implements\n        RequiresResize {\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight() - 30;\n        int width = getParent().getOffsetWidth() - 30;\n        setPixelSize(width,\n                     height);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/SmallLabel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.safehtml.client.SafeHtmlTemplates;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.user.client.ui.HTML;\n\npublic class SmallLabel extends HTML {\n\n    private static final SmallLabelTemplate TEMPLATE = GWT.create(SmallLabelTemplate.class);\n\n    public SmallLabel() {\n    }\n\n    public SmallLabel(String text) {\n        setText(text);\n    }\n\n    public void setText(final String text) {\n        setHTML(TEMPLATE.message(new SafeHtml() {\n\n            private static final long serialVersionUID = 510L;\n\n            public String asString() {\n                return text;\n            }\n        }));\n    }\n\n    interface SmallLabelTemplate\n            extends\n            SafeHtmlTemplates {\n\n        @Template(\"<div class='form-field'>{0}</div>\")\n        SafeHtml message(SafeHtml message);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/StackItemHeader.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.resources.client.ImageResource;\n\npublic class StackItemHeader {\n\n    private StackItemHeaderView view;\n\n    public StackItemHeader(StackItemHeaderView view) {\n        this.view = view;\n    }\n\n    public void setName(String name) {\n        view.setText(name);\n    }\n\n    public void setImageResource(ImageResource imageResource) {\n        view.setImageResource(imageResource);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/StackItemHeaderView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface StackItemHeaderView extends IsWidget {\n\n    void setText(String text);\n\n    void setImageResource(ImageResource imageResource);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/StackItemHeaderViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class StackItemHeaderViewImpl extends Composite implements StackItemHeaderView {\n\n    private static HeaderHTMLBinder uiBinder = GWT.create(HeaderHTMLBinder.class);\n    @UiField\n    Label textLabel;\n    @UiField\n    Image imageResource;\n\n    public StackItemHeaderViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setText(String text) {\n        textLabel.setText(text);\n    }\n\n    public void setImageResource(ImageResource imageResource) {\n        this.imageResource.setResource(imageResource);\n    }\n\n    interface HeaderHTMLBinder\n            extends\n            UiBinder<Widget, StackItemHeaderViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/StackItemHeaderViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'>\n\n  <ui:style>\n    .floatLeft {\n      float: left;\n      font-family: Arial Unicode MS, Arial, sans-serif;\n      font-size: small;\n    }\n  </ui:style>\n\n  <gwt:HTMLPanel>\n    <div class='{style.floatLeft}'>\n      <gwt:Image ui:field=\"imageResource\"/>\n    </div>\n    <div class='{style.floatLeft}'>\n      <gwt:Label ui:field=\"textLabel\"/>\n    </div>\n  </gwt:HTMLPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/StyleHelper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\n\n/**\n * Borrow from GWTBootstrap3 (https://github.com/gwtbootstrap3/gwtbootstrap3)\n */\npublic final class StyleHelper {\n\n    // ------------------------------\n    // Helpers for legacy GWT Element\n    // ------------------------------\n\n    public static <E extends Style.HasCssName, F extends Enum<? extends Style.HasCssName>> void addUniqueEnumStyleName(final Element element,\n                                                                                                                       final Class<F> enumClass,\n                                                                                                                       final E style) {\n        removeEnumStyleNames(element,\n                             enumClass);\n        addEnumStyleName(element,\n                         style);\n    }\n\n    public static <E extends Enum<? extends Style.HasCssName>> void removeEnumStyleNames(final Element element,\n                                                                                         final Class<E> enumClass) {\n\n        for (final Enum<? extends Style.HasCssName> constant : enumClass.getEnumConstants()) {\n            final String cssClass = ((Style.HasCssName) constant).getCssName();\n\n            if (cssClass != null && !cssClass.isEmpty()) {\n                element.removeClassName(cssClass);\n            }\n        }\n    }\n\n    public static <E extends Style.HasCssName> void addEnumStyleName(final Element element,\n                                                                     final E style) {\n\n        if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {\n            element.addClassName(style.getCssName());\n        }\n    }\n\n    public static <E extends Style.HasCssName> void removeEnumStyleName(final Element element,\n                                                                        final E style) {\n\n        if (style != null && style.getCssName() != null && !style.getCssName().isEmpty()) {\n            element.removeClassName(style.getCssName());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/Util.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.AbstractImagePrototype;\nimport com.google.gwt.user.client.ui.HTML;\n\npublic class Util {\n\n    /**\n     * Get a string representation of the header that includes an image and some text.\n     * @param image the {@link ImageResource} to add next to the header\n     * @param text the header text\n     * @return the header as a string\n     */\n    public static String getHeader(final ImageResource image,\n                                   final String text) {\n        return AbstractImagePrototype.create(image).getHTML() + \" \" + text;\n    }\n\n    /**\n     * Get a HTML representation of the header that includes an image and some text.\n     * @param image the {@link ImageResource} to add next to the header\n     * @param text the header text\n     * @return the header as HTML\n     */\n    public static HTML getHeaderHTML(final ImageResource image,\n                                     final String text) {\n        HeaderHTML headerHTML = new HeaderHTML();\n        headerHTML.setText(text);\n        headerHTML.setImageResource(image);\n        return new HTML(headerHTML.getElement().getString());\n    }\n\n    /**\n     * Get a SafeHtml representation of the header that includes an image and some text.\n     * @param image the {@link ImageResource} to add next to the header\n     * @param text the header text\n     * @return the header as SafeHtml\n     */\n    public static SafeHtml getHeaderSafeHtml(final ImageResource image,\n                                             final String text) {\n        HeaderHTML headerHTML = new HeaderHTML();\n        headerHTML.setText(text);\n        headerHTML.setImageResource(image);\n        return toSafeHtml(headerHTML.getElement().getString());\n    }\n\n    /**\n     * The URL that will be used to open up assets in a feed.\n     * (by tacking asset id on the end, of course !).\n     */\n    public static String getSelfURL() {\n        String selfURL = Window.Location.getHref();\n        if (selfURL.contains(\"#\")) {\n            selfURL = selfURL.substring(0,\n                                        selfURL.indexOf(\"#\"));\n        }\n        return selfURL;\n    }\n\n    /**\n     * Convert String to a SafeHtml\n     * @param html\n     * @return\n     */\n    public static SafeHtml toSafeHtml(final String html) {\n        final SafeHtmlBuilder builder = new SafeHtmlBuilder();\n        builder.appendHtmlConstant(html);\n        return builder.toSafeHtml();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/ValueChanged.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\n/**\n * Use ValueChangeHandler instead.\n */\n@Deprecated\npublic interface ValueChanged {\n\n    void valueChanged(String newValue);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/BaseModal.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Focusable;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.ModalShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShowHandler;\nimport org.gwtbootstrap3.client.shared.event.ModalShownEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShownHandler;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.base.button.CloseButton;\nimport org.gwtbootstrap3.client.ui.base.modal.ModalContent;\nimport org.gwtbootstrap3.client.ui.base.modal.ModalDialog;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.ModalBackdrop;\n\n/**\n * Base class for modal popup implementations. Setting the following properties by default:\n * <ul>\n * <li>setBackdrop( {@link BackdropType#STATIC} );</li>\n * <li>setKeyboard( true );</li>\n * <li>setAnimation( true );</li>\n * <li>setDynamicSafe( true );</li>\n * <li>setHideOthers( false );</li>\n * </ul>\n * <p>\n * Furthermore this Modal provides:\n * <ul>\n * <li>Automatic focus to the first Focusable widget in the body</li>\n * <li>Automatic invocation of the first Button's ClickHandler where {@link ButtonType}==PRIMARY when &lt;enter&gt; is\n * pressed</li>\n * </ul>\n */\npublic class BaseModal extends Modal {\n\n    private ModalBody body;\n\n    public BaseModal() {\n        setDataBackdrop(ModalBackdrop.STATIC);\n        setDataKeyboard(true);\n        setRemoveOnHide(true);\n        setHideOtherModals(false);\n        setShowHandler();\n        setKeyPressHandler();\n        getElement().setId(\"panel-id\");\n        addShowHandler(new ModalShowHandler() {\n            @Override\n            public void onShow(ModalShowEvent evt) {\n                Modal modal = evt.getModal();\n                modal.getElement().setAttribute(\"maxHeight\",\n                                                \"100px\");\n                modal.getElement().setAttribute(\"overflowY\",\n                                                \"scroll\");\n            }\n        });\n    }\n\n    @Override\n    public void show() {\n        super.show();\n    }\n\n    private void setKeyPressHandler() {\n        this.addDomHandler(getEnterDomHandler(),\n                           KeyDownEvent.getType());\n    }\n\n    protected KeyDownHandler getEnterDomHandler() {\n        return new KeyDownHandler() {\n            @Override\n            public void onKeyDown(KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    if (handleDefaultAction()) {\n                        event.preventDefault();\n                        event.stopPropagation();\n                    }\n                }\n            }\n        };\n    }\n\n    private void setShowHandler() {\n        //Setting Focus in show() doesn't work so set after Modal is shown\n        addShownHandler(new ModalShownHandler() {\n            @Override\n            public void onShown(ModalShownEvent shownEvent) {\n                setFocus(BaseModal.this,\n                         Boolean.FALSE);\n            }\n        });\n    }\n\n    //Set focus on first widget. Ideally we'd only scan the body of the Modal but this is\n    //not accessible from sub-classes so we ignore some Focusable elements in the Header\n    protected boolean setFocus(final HasWidgets container,\n                               Boolean found) {\n        for (final Widget w : container) {\n            if (w instanceof CloseButton) {\n                continue;\n            } else if (w instanceof Focusable) {\n                ((Focusable) w).setFocus(true);\n                found = true;\n            } else if (w instanceof HasWidgets) {\n                found = setFocus(((HasWidgets) w),\n                                 found);\n            }\n            if (Boolean.TRUE.equals(found)) {\n                break;\n            }\n        }\n        return found;\n    }\n\n    //When <enter> is pressed look for a PRIMARY button in the ModalFooters and click it\n    protected boolean handleDefaultAction() {\n        return handleDefaultAction(this);\n    }\n\n    protected <T extends ComplexPanel> boolean handleDefaultAction(final T panel) {\n        for (int i = 0; i < panel.getWidgetCount(); i++) {\n            final Widget w = panel.getWidget(i);\n            if (w instanceof ModalFooter) {\n                return handleModalFooter((ModalFooter) w);\n            } else if (w instanceof ModalDialog) {\n                return handleDefaultAction((ModalDialog) w);\n            } else if (w instanceof ModalContent) {\n                return handleDefaultAction((ModalContent) w);\n            }\n        }\n        return false;\n    }\n\n    private boolean handleModalFooter(final ModalFooter footer) {\n        for (final Widget fw : footer) {\n            //Many of our standard ModalFooters embed a ModalFooter within a ModalFooter\n            if (fw instanceof ModalFooter) {\n                return handleModalFooter(((ModalFooter) fw));\n            } else if (fw instanceof Button) {\n                final Button b = (Button) fw;\n                if (b.getType().equals(ButtonType.PRIMARY)) {\n                    b.fireEvent(new ClickEvent() {\n                    });\n                    return true;\n                }\n            }\n        }\n        return false;\n    }\n\n    public void setBody(final Widget widget) {\n        final ModalBody body = new ModalBody();\n        body.add(widget);\n        this.add(body);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/ButtonPressed.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common.popups;\n\npublic enum ButtonPressed {\n    CLOSE,\n    OK,\n    CANCEL\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/FormStylePopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common.popups;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.ModalHeader;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleItem;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleLayout;\n\n/**\n * This builds on the FormStyleLayout for providing common popup features in a\n * columnar form layout, with a title and a large (ish) icon.\n */\npublic class FormStylePopup extends BaseModal {\n\n    private static FormStylePopupWidgetBinder uiBinder = GWT.create(FormStylePopupWidgetBinder.class);\n    @UiField\n    FormStyleLayout form;\n\n    public FormStylePopup(final String title) {\n        setBody(uiBinder.createAndBindUi(this));\n        setTitle(title);\n    }\n\n    public FormStylePopup(final Image icon,\n                          final String title) {\n        add(new ModalHeader() {{\n            add(new Heading(HeadingSize.H4) {{\n                add(icon);\n                getElement().setInnerText(title);\n            }});\n        }});\n        setBody(uiBinder.createAndBindUi(this));\n    }\n\n    public void clear() {\n        this.form.clear();\n    }\n\n    public FormStyleItem addAttribute(final String label,\n                                      final IsWidget wid) {\n        return form.addAttribute(label,\n                                 wid);\n    }\n\n    public FormStyleItem addAttribute(final String label,\n                                      final IsWidget wid,\n                                      final boolean visible) {\n        FormStyleItem formStyleItem = form.addAttribute(label,\n                                                        wid);\n        setAttributeVisibility(formStyleItem.getIndex(),\n                               visible);\n        return formStyleItem;\n    }\n\n    public FormStyleItem addAttributeWithHelp(final String attributeName,\n                                              final String helpTitle,\n                                              final String helpContent,\n                                              final Widget widget) {\n\n        FormStyleItem formStyleItem = form.addAttribute(attributeName,\n                                                        helpTitle,\n                                                        helpContent,\n                                                        widget);\n        setAttributeVisibility(formStyleItem.getIndex(), true);\n        return formStyleItem;\n    }\n\n    public int addRow(final IsWidget wid) {\n        return form.addRow(wid);\n    }\n\n    public void setAttributeVisibility(final int index,\n                                       final boolean b) {\n        form.setAttributeVisibility(index,\n                                    b);\n    }\n\n    interface FormStylePopupWidgetBinder\n            extends\n            UiBinder<Widget, FormStylePopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/FormStylePopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:uf=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n\n  <uf:FormStyleLayout ui:field=\"form\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/YesNoCancelPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common.popups;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterYesNoCancelButtons;\nimport org.uberfire.mvp.Command;\n\npublic class YesNoCancelPopup extends BaseModal {\n\n    @UiField\n    protected ScrollPanel scroll;\n    @UiField\n    protected HTML message;\n    private YesNoCancelPopupWidgetBinder uiBinder = GWT.create(YesNoCancelPopupWidgetBinder.class);\n\n    protected YesNoCancelPopup(final String title,\n                               final String content,\n                               final Command yesCommand,\n                               final String yesButtonText,\n                               final ButtonType yesButtonType,\n                               final IconType yesButtonIconType,\n                               final Command noCommand,\n                               final String noButtonText,\n                               final ButtonType noButtonType,\n                               final IconType noButtonIconType,\n                               final Command cancelCommand,\n                               final String cancelButtonText,\n                               final ButtonType cancelButtonType,\n                               final IconType cancelButtonIconType) {\n\n        setTitle(title);\n        setHideOtherModals(false);\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(YesNoCancelPopup.this));\n        }});\n        add(new ModalFooterYesNoCancelButtons(this,\n                                              yesCommand,\n                                              yesButtonText,\n                                              yesButtonType,\n                                              yesButtonIconType,\n                                              noCommand,\n                                              noButtonText,\n                                              noButtonType,\n                                              noButtonIconType,\n                                              cancelCommand,\n                                              cancelButtonText,\n                                              cancelButtonType,\n                                              cancelButtonIconType));\n\n        message.setHTML(SafeHtmlUtils.fromTrustedString(content != null ? content : \"\"));\n    }\n\n    protected YesNoCancelPopup(final String title,\n                               final String content,\n                               final Command yesCommand,\n                               final Command noCommand,\n                               final Command cancelCommand) {\n        this(title,\n             content,\n             yesCommand,\n             null,\n             null,\n             null,\n             noCommand,\n             null,\n             null,\n             null,\n             cancelCommand,\n             null,\n             null,\n             null);\n    }\n\n    public static YesNoCancelPopup newYesNoCancelPopup(final String title,\n                                                       final String content,\n                                                       final Command yesCommand,\n                                                       final String yesButtonText,\n                                                       final ButtonType yesButtonType,\n                                                       final IconType yesButtonIconType,\n                                                       final Command noCommand,\n                                                       final String noButtonText,\n                                                       final ButtonType noButtonType,\n                                                       final IconType noButtonIconType,\n                                                       final Command cancelCommand,\n                                                       final String cancelButtonText,\n                                                       final ButtonType cancelButtonType,\n                                                       final IconType cancelButtonIconType) {\n\n        return new YesNoCancelPopup(title,\n                                    content,\n                                    yesCommand,\n                                    yesButtonText,\n                                    yesButtonType,\n                                    yesButtonIconType,\n                                    noCommand,\n                                    noButtonText,\n                                    noButtonType,\n                                    noButtonIconType,\n                                    cancelCommand,\n                                    cancelButtonText,\n                                    cancelButtonType,\n                                    cancelButtonIconType);\n    }\n\n    public static YesNoCancelPopup newYesNoCancelPopup(final String title,\n                                                       final String content,\n                                                       final Command yesCommand,\n                                                       final Command noCommand,\n                                                       final Command cancelCommand) {\n\n        return new YesNoCancelPopup(title,\n                                    content,\n                                    yesCommand,\n                                    null,\n                                    null,\n                                    null,\n                                    noCommand,\n                                    null,\n                                    null,\n                                    null,\n                                    cancelCommand,\n                                    null,\n                                    null,\n                                    null);\n    }\n\n    public static YesNoCancelPopup newYesNoCancelPopup(final String title,\n                                                       final String content,\n                                                       final Command yesCommand,\n                                                       final String yesButtonText,\n                                                       final Command noCommand,\n                                                       final String noButtonText,\n                                                       final Command cancelCommand,\n                                                       final String cancelButtonText) {\n\n        return new YesNoCancelPopup(title,\n                                    content,\n                                    yesCommand,\n                                    yesButtonText,\n                                    null,\n                                    null,\n                                    noCommand,\n                                    noButtonText,\n                                    null,\n                                    null,\n                                    cancelCommand,\n                                    cancelButtonText,\n                                    null,\n                                    null);\n    }\n\n    public static YesNoCancelPopup newYesNoCancelPopup(final String title,\n                                                       final String content,\n                                                       final Command yesCommand,\n                                                       final String yesButtonText,\n                                                       final ButtonType yesButtonType,\n                                                       final Command noCommand,\n                                                       final String noButtonText,\n                                                       final ButtonType noButtonType,\n                                                       final Command cancelCommand,\n                                                       final String cancelButtonText,\n                                                       final ButtonType cancelButtonType) {\n\n        return new YesNoCancelPopup(title,\n                                    content,\n                                    yesCommand,\n                                    yesButtonText,\n                                    yesButtonType,\n                                    null,\n                                    noCommand,\n                                    noButtonText,\n                                    noButtonType,\n                                    null,\n                                    cancelCommand,\n                                    cancelButtonText,\n                                    cancelButtonType,\n                                    null);\n    }\n\n    public void clearScrollHeight() {\n        this.scroll.getElement().getStyle().clearHeight();\n    }\n\n    interface YesNoCancelPopupWidgetBinder\n            extends\n            UiBinder<Widget, YesNoCancelPopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/YesNoCancelPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <g:ScrollPanel width=\"100%\" height=\"200px\" ui:field=\"scroll\">\n    <g:HTML ui:field=\"message\"/>\n  </g:ScrollPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/errors/ErrorPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.errors;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.ModalShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShowHandler;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKButton;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\n/**\n * A popup that shows an error message\n */\npublic class ErrorPopup extends BaseModal {\n\n    private static ErrorPopupWidgetBinder uiBinder = GWT.create(ErrorPopupWidgetBinder.class);\n    private static ErrorPopup instance = new ErrorPopup();\n    @UiField\n    protected HTML message;\n\n    private ErrorPopup() {\n        setTitle(CommonConstants.INSTANCE.Error());\n\n        setBody(uiBinder.createAndBindUi(ErrorPopup.this));\n        add(new ModalFooterOKButton(new Command() {\n            @Override\n            public void execute() {\n                hide();\n            }\n        }));\n    }\n\n    public static void showMessage(String message) {\n        instance.setMessage(message);\n        instance.show();\n    }\n\n    public static void showMessage(final String msg,\n                                   final Command afterShow,\n                                   final Command afterClose) {\n        new ErrorPopup() {{\n            setMessage(msg);\n            addShowHandler(new ModalShowHandler() {\n                @Override\n                public void onShow(final ModalShowEvent showEvent) {\n                    if (afterShow != null) {\n                        afterShow.execute();\n                    }\n                }\n            });\n            addHiddenHandler(new ModalHiddenHandler() {\n                @Override\n                public void onHidden(final ModalHiddenEvent hiddenEvent) {\n                    if (afterClose != null) {\n                        afterClose.execute();\n                    }\n                }\n            });\n        }}.show();\n    }\n\n    public void setMessage(final String message) {\n        this.message.setHTML(SafeHtmlUtils.fromTrustedString(message));\n    }\n\n    interface ErrorPopupWidgetBinder\n            extends\n            UiBinder<Widget, ErrorPopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/errors/ErrorPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <g:ScrollPanel width=\"100%\" height=\"200px\">\n    <g:HTML ui:field=\"message\"/>\n  </g:ScrollPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/GenericModalFooter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.mvp.Command;\n\n/**\n * A Modal Footer that can accept arbitrary buttons\n */\npublic class GenericModalFooter extends ModalFooter {\n\n    public void addButton(final String caption,\n                          final Command command,\n                          final ButtonType buttonType) {\n        final Button button = new Button(caption,\n                                         new ClickHandler() {\n                                             @Override\n                                             public void onClick(ClickEvent event) {\n                                                 if (command != null) {\n                                                     command.execute();\n                                                 }\n                                             }\n                                         });\n        button.setType(buttonType);\n        this.add(button);\n    }\n\n    public void addButton(final String caption,\n                          final Command command,\n                          final IconType iconType,\n                          final ButtonType buttonType) {\n        final Button button = new Button(caption,\n                                         new ClickHandler() {\n                                             @Override\n                                             public void onClick(ClickEvent event) {\n                                                 if (command != null) {\n                                                     command.execute();\n                                                 }\n                                             }\n                                         });\n        button.setType(buttonType);\n        button.setIcon(iconType);\n        this.add(button);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A Modal Footer with OK and Cancel buttons\n */\npublic class ModalFooterForceSaveReOpenCancelButtons extends ModalFooter {\n\n    private static ModalFooterForceSaveReOpenCancelButtonsBinder uiBinder = GWT.create(ModalFooterForceSaveReOpenCancelButtonsBinder.class);\n\n    private final Command forceSaveCommand;\n    private final Command reopenCommand;\n    private final Command cancelCommand;\n\n    private final Modal panel;\n    @UiField\n    Button forceSaveButton;\n    @UiField\n    Button reopenButton;\n    @UiField\n    Button cancelButton;\n\n    public ModalFooterForceSaveReOpenCancelButtons(final Modal panel,\n                                                   final Command forceSaveCommand,\n                                                   final Command reopenCommand,\n                                                   final Command cancelCommand) {\n        this.forceSaveCommand = checkNotNull(\"forceSaveCommand\",\n                                             forceSaveCommand);\n        this.reopenCommand = checkNotNull(\"reopenCommand\",\n                                          reopenCommand);\n        this.cancelCommand = checkNotNull(\"cancelCommand\",\n                                          cancelCommand);\n        this.panel = checkNotNull(\"panel\",\n                                  panel);\n        add(uiBinder.createAndBindUi(this));\n    }\n\n    @UiHandler(\"forceSaveButton\")\n    public void onForceSaveButtonClick(final ClickEvent e) {\n        if (forceSaveCommand != null) {\n            forceSaveCommand.execute();\n        }\n        panel.hide();\n    }\n\n    @UiHandler(\"reopenButton\")\n    public void onReOpenButtonClick(final ClickEvent e) {\n        if (reopenCommand != null) {\n            reopenCommand.execute();\n        }\n        panel.hide();\n    }\n\n    @UiHandler(\"cancelButton\")\n    public void onCancelButtonClick(final ClickEvent e) {\n        if (cancelCommand != null) {\n            cancelCommand.execute();\n        }\n        panel.hide();\n    }\n\n    interface ModalFooterForceSaveReOpenCancelButtonsBinder\n            extends\n            UiBinder<Widget, ModalFooterForceSaveReOpenCancelButtons> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterForceSaveReOpenCancelButtons.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <b:Button ui:field=\"forceSaveButton\" type=\"DANGER\" text=\"{i18nCommon.ForceSave}\"/>\n    <b:Button ui:field=\"reopenButton\" type=\"PRIMARY\" text=\"{i18nCommon.ReOpen}\"/>\n    <b:Button ui:field=\"cancelButton\" type=\"DEFAULT\" text=\"{i18nCommon.Cancel}\"/>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A Modal Footer with a single OK button\n */\npublic class ModalFooterOKButton extends ModalFooter {\n\n    private static ModalFooterOKButtonBinder uiBinder = GWT.create(ModalFooterOKButtonBinder.class);\n\n    private final Command okCommand;\n    @UiField\n    Button okButton;\n\n    public ModalFooterOKButton(final Command okCommand) {\n        this.okCommand = PortablePreconditions.checkNotNull(\"okCommand\",\n                                                            okCommand);\n        add(uiBinder.createAndBindUi(this));\n    }\n\n    public void enableOkButton(final boolean enabled) {\n        okButton.setEnabled(enabled);\n    }\n\n    @UiHandler(\"okButton\")\n    public void onOKButtonClick(final ClickEvent e) {\n        okCommand.execute();\n    }\n\n    interface ModalFooterOKButtonBinder\n            extends\n            UiBinder<Widget, ModalFooterOKButton> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKButton.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <b:Button ui:field=\"okButton\" icon=\"PLUS\" type=\"PRIMARY\" text=\"{i18nCommon.OK}\"></b:Button>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A Modal Footer with OK and Cancel buttons\n */\npublic class ModalFooterOKCancelButtons extends ModalFooter {\n\n    private static ModalFooterOKCancelButtonsBinder uiBinder = GWT.create(ModalFooterOKCancelButtonsBinder.class);\n\n    private final Command okCommand;\n    private final Command cancelCommand;\n    @UiField\n    Button okButton;\n    @UiField\n    Button cancelButton;\n\n    public ModalFooterOKCancelButtons(final Command okCommand,\n                                      final Command cancelCommand) {\n        this.okCommand = PortablePreconditions.checkNotNull(\"okCommand\",\n                                                            okCommand);\n        this.cancelCommand = PortablePreconditions.checkNotNull(\"cancelCommand\",\n                                                                cancelCommand);\n        add(uiBinder.createAndBindUi(this));\n    }\n\n    public void enableOkButton(final boolean enabled) {\n        okButton.setEnabled(enabled);\n    }\n\n    public void enableCancelButton(final boolean enabled) {\n        cancelButton.setEnabled(enabled);\n    }\n\n    @UiHandler(\"okButton\")\n    public void onOKButtonClick(final ClickEvent e) {\n        okCommand.execute();\n    }\n\n    @UiHandler(\"cancelButton\")\n    public void onCancelButtonClick(final ClickEvent e) {\n        cancelCommand.execute();\n    }\n\n    interface ModalFooterOKCancelButtonsBinder\n            extends\n            UiBinder<Widget, ModalFooterOKCancelButtons> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterOKCancelButtons.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <b:Button ui:field=\"okButton\" icon=\"PLUS\" type=\"PRIMARY\" text=\"{i18nCommon.OK}\"></b:Button>\n    <b:Button ui:field=\"cancelButton\" type=\"DEFAULT\" text=\"{i18nCommon.Cancel}\"></b:Button>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A Modal Footer with OK and Cancel buttons\n */\npublic class ModalFooterReOpenIgnoreButtons extends ModalFooter {\n\n    private static ModalFooterReOpenIgnoreButtonsBinder uiBinder = GWT.create(ModalFooterReOpenIgnoreButtonsBinder.class);\n\n    private final Command actionCommand;\n    private final Command ignoreCommand;\n    private final Modal panel;\n    @UiField\n    Button actionButton;\n    @UiField\n    Button ignoreButton;\n\n    public ModalFooterReOpenIgnoreButtons(final Modal panel,\n                                          final Command actionCommand,\n                                          final Command ignoreCommand,\n                                          final String buttonText) {\n        this.actionCommand = checkNotNull(\"actionCommand\",\n                                          actionCommand);\n        this.ignoreCommand = checkNotNull(\"ignoreCommand\",\n                                          ignoreCommand);\n        this.panel = checkNotNull(\"panel\",\n                                  panel);\n        add(uiBinder.createAndBindUi(this));\n        this.actionButton.setText(buttonText);\n    }\n\n    @UiHandler(\"actionButton\")\n    public void onActionButtonClick(final ClickEvent e) {\n        if (actionCommand != null) {\n            actionCommand.execute();\n        }\n        panel.hide();\n    }\n\n    @UiHandler(\"ignoreButton\")\n    public void onIgnoreButtonClick(final ClickEvent e) {\n        if (ignoreCommand != null) {\n            ignoreCommand.execute();\n        }\n        panel.hide();\n    }\n\n    interface ModalFooterReOpenIgnoreButtonsBinder\n            extends\n            UiBinder<Widget, ModalFooterReOpenIgnoreButtons> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterReOpenIgnoreButtons.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <b:Button ui:field=\"actionButton\" type=\"PRIMARY\"/>\n    <b:Button ui:field=\"ignoreButton\" type=\"DEFAULT\" text=\"{i18nCommon.Ignore}\"/>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterYesNoCancelButtons.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common.popups.footers;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.mvp.Command;\n\npublic class ModalFooterYesNoCancelButtons extends ModalFooter {\n\n    private static ModalFooterYesNoCancelButtonsBinder uiBinder = GWT.create(ModalFooterYesNoCancelButtonsBinder.class);\n\n    private final Command yesCommand;\n\n    private final Command cancelCommand;\n\n    private final Command noCommand;\n\n    private final Modal panel;\n\n    private boolean closeModalAfterAction = true;\n\n    @UiField\n    Button yesButton;\n    @UiField\n    Button noButton;\n    @UiField\n    Button cancelButton;\n\n    public ModalFooterYesNoCancelButtons(final Modal panel,\n                                         final Command yesCommand,\n                                         final String yesButtonText,\n                                         final ButtonType yesButtonType,\n                                         final IconType yesButtonIconType,\n                                         final Command noCommand,\n                                         final String noButtonText,\n                                         final ButtonType noButtonType,\n                                         final IconType noButtonIconType,\n                                         final Command cancelCommand,\n                                         final String cancelButtonText,\n                                         final ButtonType cancelButtonType,\n                                         final IconType cancelButtonIconType) {\n\n        this.yesCommand = yesCommand;\n        this.noCommand = noCommand;\n        this.cancelCommand = cancelCommand;\n\n        add(uiBinder.createAndBindUi(this));\n\n        if (yesCommand == null) {\n            yesButton.setVisible(false);\n        }\n        if (noCommand == null) {\n            noButton.setVisible(false);\n        }\n        if (cancelCommand == null) {\n            cancelButton.setVisible(false);\n        }\n\n        if (yesButtonType != null) {\n            yesButton.setType(yesButtonType);\n        }\n        if (yesButtonText != null) {\n            yesButton.setText(yesButtonText);\n        }\n        if (yesButtonIconType != null) {\n            yesButton.setIcon(yesButtonIconType);\n        }\n\n        if (noButtonType != null) {\n            noButton.setType(noButtonType);\n        }\n        if (noButtonText != null) {\n            noButton.setText(noButtonText);\n        }\n        if (noButtonIconType != null) {\n            noButton.setIcon(noButtonIconType);\n        }\n\n        if (cancelButtonType != null) {\n            cancelButton.setType(cancelButtonType);\n        }\n        if (cancelButtonText != null) {\n            cancelButton.setText(cancelButtonText);\n        }\n        if (cancelButtonIconType != null) {\n            cancelButton.setIcon(cancelButtonIconType);\n        }\n\n        this.panel = panel;\n    }\n\n    public ModalFooterYesNoCancelButtons(final Modal panel,\n                                         final Command yesCommand,\n                                         final ButtonType yesButtonType,\n                                         final Command noCommand,\n                                         final ButtonType noButtonType,\n                                         final Command cancelCommand,\n                                         final ButtonType cancelButtonType) {\n        this(panel,\n             yesCommand,\n             null,\n             yesButtonType,\n             null,\n             noCommand,\n             null,\n             noButtonType,\n             null,\n             cancelCommand,\n             null,\n             cancelButtonType,\n             null);\n    }\n\n    public ModalFooterYesNoCancelButtons(final Modal panel,\n                                         final Command yesCommand,\n                                         final Command noCommand,\n                                         final Command cancelCommand) {\n        this(panel,\n             yesCommand,\n             null,\n             null,\n             null,\n             noCommand,\n             null,\n             null,\n             null,\n             cancelCommand,\n             null,\n             null,\n             null);\n    }\n\n    @UiHandler(\"yesButton\")\n    public void onYesButtonClick(final ClickEvent e) {\n        onButtonAction(yesCommand);\n    }\n\n    @UiHandler(\"noButton\")\n    public void onNoButtonClick(final ClickEvent e) {\n        onButtonAction(noCommand);\n    }\n\n    @UiHandler(\"cancelButton\")\n    public void onCancelButtonClick(final ClickEvent e) {\n        onButtonAction(cancelCommand);\n    }\n\n    private void onButtonAction(Command command) {\n        if(command != null) {\n            command.execute();\n        }\n\n        if(closeModalAfterAction) {\n            panel.hide();\n        }\n    }\n\n    public void setCloseModalAfterAction(boolean closeModalAfterAction) {\n        this.closeModalAfterAction = closeModalAfterAction;\n    }\n\n    interface ModalFooterYesNoCancelButtonsBinder\n            extends\n            UiBinder<Widget, ModalFooterYesNoCancelButtons> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/common/popups/footers/ModalFooterYesNoCancelButtons.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:with field=\"i18nCommon\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <g:FlowPanel>\n    <b:Button ui:field=\"yesButton\" icon=\"PLUS\" type=\"PRIMARY\" text=\"{i18nCommon.YES}\"></b:Button>\n    <b:Button ui:field=\"noButton\" type=\"DANGER\" text=\"{i18nCommon.NO}\"></b:Button>\n    <b:Button ui:field=\"cancelButton\" type=\"DEFAULT\" text=\"{i18nCommon.Cancel}\"></b:Button>\n  </g:FlowPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/diff2html/Diff2Html.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.diff2html;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.user.client.ui.Composite;\n\npublic class Diff2Html extends Composite {\n\n    private String containerId;\n\n    private DiffOutputFormat outputFormat;\n\n    private String diffText;\n\n    private JavaScriptObject viewer;\n\n    public Diff2Html(final String containerId,\n                     final DiffOutputFormat outputFormat,\n                     final String diffText) {\n        this.diffText = diffText;\n        this.outputFormat = outputFormat;\n        this.setupContainerId(containerId);\n        this.initialize();\n    }\n\n    private void setupContainerId(String containerId) {\n        this.containerId = \"#\" + containerId;\n    }\n\n    private native void initialize()/*-{\n        var diffText = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::diffText;\n\n        this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::viewer = new $wnd.Diff2HtmlUI({diff: diffText});\n    }-*/;\n\n    public native void draw() /*-{\n        // the format of the input data: 'diff' or 'json', default is 'diff'\n        var inputFormat = \"diff\";\n        // 'lines' for matching lines, 'words' for matching lines and words or 'none', default is none (avoids OOM)\n        var matching = \"none\";\n        // show a file list before the diff: true or false, default is false\n        var showFiles = false;\n        // the id of the div in which the diff will be drawn\n        var containerId = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::containerId;\n        // the format of the output data: 'line-by-line' or 'side-by-side', default is 'line-by-line'\n        var outputFormat = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::outputFormat.toString();\n        // similarity threshold for word matching, default is 0.25\n        var matchWordsThreshold = 0.25;\n        // perform at most this much comparisons for line matching a block of changes, default is 2500\n        var matchingMaxComparisons = 2500;\n        // maximum number os characters of the bigger line in a block to apply comparison, default is 200\n        var maxLineSizeInBlockForComparison = 200;\n        // only perform diff changes highlight if lines are smaller than this, default is 10000\n        var maxLineLengthHighlight = 10000;\n        // render nothing if the diff shows no change in its comparison: true or false, default is false\n        var renderNothingWhenEmpty = false;\n        // scroll both panes in side-by-side mode: true or false, default is false\n        var synchronisedScroll = true;\n\n        var viewer = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::viewer;\n\n        viewer.draw(containerId, {\n            inputFormat: inputFormat,\n            showFiles: showFiles,\n            matching: matching,\n            outputFormat: outputFormat,\n            matchWordsThreshold: matchWordsThreshold,\n            matchingMaxComparisons: matchingMaxComparisons,\n            maxLineSizeInBlockForComparison: maxLineSizeInBlockForComparison,\n            maxLineLengthHighlight: maxLineLengthHighlight,\n            renderNothingWhenEmpty: renderNothingWhenEmpty,\n            synchronisedScroll: synchronisedScroll\n        });\n    }-*/;\n\n    public native void highlightCode() /*-{\n        var viewer = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::viewer;\n        var containerId = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::containerId;\n        viewer.highlightCode(containerId);\n    }-*/;\n\n    public native void configContainerHeight(final int maxHeight) /*-{\n        var containerId = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::containerId;\n        var outputFormat = this.@org.uberfire.ext.widgets.common.client.diff2html.Diff2Html::outputFormat.toString();\n\n        var rowHeight = 18;\n        var tableRowsCount;\n\n        if (outputFormat === \"line-by-line\") {\n            tableRowsCount = $wnd.jQuery(containerId + \" .d2h-file-diff .d2h-diff-table >tbody >tr\").length;\n        } else {\n            tableRowsCount = $wnd.jQuery(containerId + \" .d2h-file-side-diff .d2h-diff-table >tbody >tr\").length / 2;\n        }\n\n        if (maxHeight <= tableRowsCount * rowHeight) {\n            $wnd.jQuery(containerId).find('.d2h-wrapper').css({\"height\": maxHeight + \"px\"});\n        }\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/diff2html/DiffOutputFormat.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.diff2html;\n\npublic enum DiffOutputFormat {\n    SIDE_BY_SIDE(\"side-by-side\"),\n    LINE_BY_LINE(\"line-by-line\");\n\n    private final String text;\n\n    DiffOutputFormat(final String text) {\n        this.text = text;\n    }\n\n    @Override\n    public String toString() {\n        return text;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/EntryCreationEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface EntryCreationEditor<TYPE> {\n\n    void init(ParameterizedCommand<LiveSearchEntry<TYPE>> okCommand, Command cancelCommand);\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/EntryCreationLiveSearchService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\npublic interface EntryCreationLiveSearchService<TYPE, EDITOR extends EntryCreationEditor<TYPE>> extends LiveSearchService<TYPE> {\n\n    EDITOR getEditor();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/InlineCreationEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface InlineCreationEditor<TYPE> extends EntryCreationEditor<TYPE>, IsElement{\n\n    void clear();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchCallback.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\npublic interface LiveSearchCallback<TYPE> {\n\n    void afterSearch(LiveSearchResults<TYPE> results);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchDropDown.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class LiveSearchDropDown<TYPE> implements IsWidget {\n\n    private View<TYPE> view;\n    private int maxItems = 10;\n    private LiveSearchService<TYPE> searchService = null;\n    private boolean changeCallbackEnabled = true;\n    private boolean searchEnabled = true;\n    private boolean clearSelectionEnabled;\n    private boolean searchCacheEnabled = true;\n    private Map<String, LiveSearchResults<TYPE>> searchCache = new HashMap<>();\n    private LiveSearchSelectionHandler selectionHandler;\n\n    private ManagedInstance<LiveSearchSelectorItem<TYPE>> liveSearchSelectorItems;\n    private String lastSearch = null;\n    private String searchHint = null;\n    private String selectorHint = null;\n    private String notFoundMessage = null;\n    private Command onChange;\n\n    private Command onAddItemPressed;\n\n    @Inject\n    public LiveSearchDropDown(View view,\n                              ManagedInstance<LiveSearchSelectorItem<TYPE>> liveSearchSelectorItems) {\n        this.view = view;\n        this.liveSearchSelectorItems = liveSearchSelectorItems;\n\n        this.view.init(this);\n\n        searchHint = view.getDefaultSearchHintI18nMessage();\n        selectorHint = view.getDefaultSelectorHintI18nMessage();\n        notFoundMessage = view.getDefaultNotFoundI18nMessage();\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public boolean isSearchEnabled() {\n        return searchEnabled;\n    }\n\n    public void setSearchEnabled(boolean searchEnabled) {\n        this.searchEnabled = searchEnabled;\n        view.setSearchEnabled(searchEnabled);\n    }\n\n    public void setClearSelectionEnabled(boolean clearSelectionEnabled) {\n        this.clearSelectionEnabled = clearSelectionEnabled;\n        view.setClearSelectionEnabled(clearSelectionEnabled);\n    }\n\n    public void setSelectorHint(String text) {\n        selectorHint = text;\n        view.setDropDownText(text);\n    }\n\n    public void setSearchHint(String text) {\n        searchHint = text;\n        view.setSearchHint(text);\n    }\n\n    public void setNotFoundMessage(String noItemsMessage) {\n        this.notFoundMessage = noItemsMessage;\n    }\n\n    public void init(LiveSearchService<TYPE> searchService,\n                     LiveSearchSelectionHandler<TYPE> selectionHandler) {\n        this.searchService = searchService;\n        this.selectionHandler = selectionHandler;\n\n        selectionHandler.setLiveSearchSelectionCallback(this::onItemSelected);\n\n        view.setClearSelectionMessage(selectionHandler.isMultipleSelection());\n\n        if (searchService instanceof EntryCreationLiveSearchService) {\n\n            view.setNewInstanceEnabled(true);\n\n            EntryCreationLiveSearchService<TYPE, ?> creationService = (EntryCreationLiveSearchService<TYPE, ?>) searchService;\n\n            EntryCreationEditor<TYPE> editor = creationService.getEditor();\n\n            if (creationService.getEditor() instanceof InlineCreationEditor) {\n                InlineCreationEditor<TYPE> inlineEditor = (InlineCreationEditor<TYPE>) editor;\n                inlineEditor.init(this::addNewItem, view::restoreFooter);\n                onAddItemPressed = () -> view.showNewItemEditor(inlineEditor);\n            } else if (creationService.getEditor() instanceof ModalCreationEditor) {\n                ModalCreationEditor<TYPE> modalEditor = (ModalCreationEditor<TYPE>) editor;\n                modalEditor.init(this::addNewItem, () -> {});\n                onAddItemPressed = () -> modalEditor.show();\n            }\n        } else {\n            view.setNewInstanceEnabled(false);\n        }\n    }\n\n    protected void addNewItem(LiveSearchEntry<TYPE> entry) {\n\n        LiveSearchSelectorItem<TYPE> itemInstance = liveSearchSelectorItems.get();\n\n        itemInstance.init(entry.getKey(), entry.getValue());\n\n        selectionHandler.selectItem(itemInstance);\n\n        searchCache.clear();\n\n        String pattern = lastSearch;\n\n        lastSearch = null;\n\n        search(pattern);\n\n        view.restoreFooter();\n    }\n\n    public boolean isSearchCacheEnabled() {\n        return searchCacheEnabled;\n    }\n\n    public void setSearchCacheEnabled(boolean searchCacheEnabled) {\n        this.searchCacheEnabled = searchCacheEnabled;\n    }\n\n    public int getMaxItems() {\n        return maxItems;\n    }\n\n    public void setMaxItems(int maxItems) {\n        this.maxItems = maxItems;\n    }\n\n    public void setWidth(int minWidth) {\n        view.setWidth(minWidth);\n    }\n\n    public void clear() {\n        lastSearch = null;\n        view.clearSearch();\n        view.clearItems();\n        view.setDropDownText(selectorHint);\n    }\n\n    public String getLastSearch() {\n        return lastSearch;\n    }\n\n    public void search(String pattern) {\n        if (lastSearch == null || !lastSearch.equals(pattern)) {\n            lastSearch = pattern != null ? pattern : \"\";\n\n            if (searchCacheEnabled && searchCache.containsKey(lastSearch)) {\n                showResults(getFromSearchCache(lastSearch));\n            } else {\n                doSearch(pattern);\n            }\n        }\n    }\n\n    public void setSelectedItem(final TYPE key) {\n        searchService.searchEntry(key,\n                                  results -> {\n                                      if(results.size() == 1) {\n                                          LiveSearchEntry<TYPE> entry = results.get(0);\n                                          changeCallbackEnabled = false;\n                                          LiveSearchSelectorItem<TYPE> item = getSelectorItemForEntry(entry);\n                                          selectionHandler.selectItem(item);\n                                          item.select();\n                                          view.clearItems();\n                                          lastSearch = null;\n                                          changeCallbackEnabled = true;\n                                      }\n                                  });\n    }\n\n    protected void doSearch(String pattern) {\n        view.searchInProgress(searchHint);\n        searchService.search(lastSearch,\n                             maxItems,\n                             results -> {\n                                 addToSearchCache(pattern,\n                                                  results);\n                                 showResults(results);\n                                 view.searchFinished();\n                             });\n    }\n\n    protected LiveSearchResults getFromSearchCache(String pattern) {\n        return searchCache.get(pattern);\n    }\n\n    protected void addToSearchCache(String pattern,\n                                    LiveSearchResults searchResults) {\n        searchCache.put(pattern,\n                        searchResults);\n    }\n\n    public void showResults(LiveSearchResults<TYPE> results) {\n        view.clearItems();\n        if (results.isEmpty()) {\n            view.noItems(notFoundMessage);\n        } else {\n            results.forEach(LiveSearchDropDown.this::getSelectorItemForEntry);\n        }\n    }\n\n    public LiveSearchSelectorItem<TYPE> getSelectorItemForEntry(LiveSearchEntry<TYPE> entry) {\n        LiveSearchSelectorItem<TYPE> item = liveSearchSelectorItems.get();\n\n        item.init(entry.getKey(),\n                  entry.getValue());\n\n        selectionHandler.registerItem(item);\n\n        view.addItem(item);\n\n        return item;\n    }\n\n    void onItemsShown() {\n        Scheduler.get().scheduleDeferred(() -> {\n            search(lastSearch);\n            view.restoreFooter();\n        });\n    }\n\n    public void setOnChange(Command onChange) {\n        this.onChange = onChange;\n    }\n\n    public void setEnabled(boolean enabled) {\n        view.setEnabled(enabled);\n    }\n\n    void onItemSelected() {\n        String message = selectionHandler.getDropDownMenuHeader();\n\n        if (message == null) {\n            message = selectorHint;\n        }\n\n        view.setDropDownText(message);\n\n        if (onChange != null & changeCallbackEnabled) {\n            onChange.execute();\n        }\n    }\n\n    public void clearSelection() {\n        selectionHandler.clearSelection();\n\n        if (onChange != null & changeCallbackEnabled) {\n            onChange.execute();\n        }\n    }\n\n    public void showNewItem() {\n        if (onAddItemPressed != null) {\n            onAddItemPressed.execute();\n        }\n    }\n\n    public interface View<TYPE> extends UberView<LiveSearchDropDown<TYPE>> {\n\n        void setNewInstanceEnabled(boolean enabled);\n\n        void showNewItemEditor(InlineCreationEditor editor);\n\n        void restoreFooter();\n\n        void clearItems();\n\n        void noItems(String msg);\n\n        void addItem(LiveSearchSelectorItem<TYPE> item);\n\n        void setSelectedValue(String selectedItem);\n\n        void setSearchEnabled(boolean enabled);\n\n        void setClearSelectionEnabled(boolean clearSelectionEnabled);\n\n        void setSearchHint(String text);\n\n        void clearSearch();\n\n        void searchInProgress(String msg);\n\n        void searchFinished();\n\n        void setDropDownText(String text);\n\n        void setWidth(int minWidth);\n\n        void setMaxHeight(int maxHeight);\n\n        void setNewEntryI18nMessage(String defaultNewInstanceI18nMessage);\n\n        String getDefaultNewEntryI18nMessage();\n\n        String getDefaultSearchHintI18nMessage();\n\n        String getDefaultSelectorHintI18nMessage();\n\n        String getDefaultNotFoundI18nMessage();\n\n        // For single selection\n        String getDefaultResetSelectionI18nMessage();\n\n        // For multiple selection\n        String getDefaultClearSelectionI18nMessage();\n\n        void setEnabled(boolean enabled);\n\n        void setClearSelectionMessage(boolean multipleSelection);\n    }\n\n    @PreDestroy\n    public void destroy() {\n        liveSearchSelectorItems.destroyAll();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchDropDownView.css",
    "content": ".appformer-live-search-button-text {\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.appformer-live-search-spinner-panel {\n    display: none;\n    margin-left: 10px;\n    height: 30px;\n}\n\n.appformer-live-search-spinner {\n    display: table-cell;\n}\n\n.appformer-live-search-spinner-text {\n    display: table-cell;\n    padding-left: 10px;\n    vertical-align: middle\n}\n\n.appformer-live-search-dropdown-menu {\n    max-height: 250px;\n    width:100%;\n    overflow-y: auto;\n}\n\n.appformer-live-search-spinner-select {\n  width: 220px;\n  vertical-align: middle;\n}\n.appformer-live-search-spinner-select > .dropdown-toggle {\n  position: relative;\n  width: 100%;\n  text-align: right;\n  white-space: nowrap;\n  display: -webkit-inline-box;\n  display: -webkit-inline-flex;\n  display: -ms-inline-flexbox;\n  display: inline-flex;\n  -webkit-box-align: center;\n  -webkit-align-items: center;\n      -ms-flex-align: center;\n          align-items: center;\n  -webkit-box-pack: justify;\n  -webkit-justify-content: space-between;\n      -ms-flex-pack: justify;\n          justify-content: space-between;\n}\n.appformer-live-search-spinner-select > .dropdown-toggle:after {\n  margin-top: -1px;\n}\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder:hover,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder:focus,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder:active {\n  color: #999;\n}\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder.btn-default,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder.btn-default:hover,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder.btn-default:focus,\n.appformer-live-search-spinner-select > .dropdown-toggle.bs-placeholder.btn-default:active {\n  color: rgba(255, 255, 255, 0.5);\n}\n\n.appformer-live-search-spinner-select:not([class*=\"col-\"]):not([class*=\"form-control\"]):not(.input-group-btn) {\n  width: 220px;\n}\n.appformer-live-search-spinner-select .dropdown-toggle:focus {\n  outline: thin dotted #333333 !important;\n  outline: 5px auto -webkit-focus-ring-color !important;\n  outline-offset: -2px;\n}\n.appformer-live-search-spinner-select.form-control {\n  margin-bottom: 0;\n  padding: 0;\n  border: none;\n  height: auto;\n}\n\n.appformer-live-search-spinner-select .dropdown-toggle .caret {\n  position: absolute;\n  top: 50%;\n  right: 12px;\n  margin-top: -2px;\n  vertical-align: middle;\n}\n\n.appformer-live-search-spinner-select .dropdown-menu {\n  min-width: 100%;\n  max-width:100%;\n  -webkit-box-sizing: border-box;\n     -moz-box-sizing: border-box;\n          box-sizing: border-box;\n}\n.appformer-live-search-spinner-select .dropdown-menu > .inner:focus {\n  outline: none !important;\n}\n.appformer-live-search-spinner-select .dropdown-menu.inner {\n  position: static;\n  float: none;\n  border: 0;\n  padding: 0;\n  margin: 0;\n  border-radius: 0;\n  -webkit-box-shadow: none;\n          box-shadow: none;\n}\n.appformer-live-search-spinner-select .dropdown-menu li {\n  position: relative;\n}\n.appformer-live-search-spinner-select .dropdown-menu li.active small {\n  color: rgba(255, 255, 255, 0.5) !important;\n}\n.appformer-live-search-spinner-select .dropdown-menu li.disabled a {\n  cursor: not-allowed;\n}\n.appformer-live-search-spinner-select .dropdown-menu li a {\n  cursor: pointer;\n  -webkit-user-select: none;\n     -moz-user-select: none;\n      -ms-user-select: none;\n          user-select: none;\n}\n.appformer-live-search-spinner-select .dropdown-menu li a.opt {\n  position: relative;\n  padding-left: 2.25em;\n}\n.appformer-live-search-spinner-select .dropdown-menu li a span.check-mark {\n  display: none;\n}\n.appformer-live-search-spinner-select .dropdown-menu li a span.text {\n  display: inline-block;\n}\n.appformer-live-search-spinner-select .dropdown-menu li small {\n  padding-left: 0.5em;\n}\n\n\n.bs-searchbox{\n  padding: 4px 8px;\n}\n.bs-searchbox .form-control {\n  margin-bottom: 0;\n  width: 100%;\n  float: none;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchDropDownView.html",
    "content": "<div data-field=\"mainPanel\" class=\"dropdown appformer-live-search-spinner-select btn-group\">\n    <button data-field=\"dropDownButton\" class=\"btn btn-default dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\" aria-expanded=\"false\">\n            <span id=\"dropDownText\" class=\"filter-option pull-left appformer-live-search-button-text\"></span>&nbsp;<span class=\"bs-caret\"><span class=\"caret\"></span></span>\n    </button>\n    <div data-field=\"dropDownPanel\" class=\"dropdown-menu open\">\n        <div data-field=\"searchPanel\" class=\"bs-searchbox\">\n            <input id=\"searchInput\" type=\"text\" class=\"form-control\" autofocus autocomplete=\"off\">\n        </div>\n        <div data-field=\"spinnerPanel\" class=\"appformer-live-search-spinner-panel\">\n            <div class=\"spinner spinner-lg appformer-live-search-spinner\"></div>\n            <span id=\"spinnerText\" class=\"appformer-live-search-spinner-text\"></span>\n        </div>\n        <div data-field=\"noItems\"></div>\n        <ul data-field=\"dropDownMenu\" class=\"dropdown-menu inner appformer-live-search-dropdown-menu\" role=\"menu\">\n        </ul>\n        <div data-field=\"liveSearchFooter\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchDropDownView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.event.dom.client.MouseOverEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Input;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.dropdown.footer.LiveSearchFooter;\nimport org.uberfire.ext.widgets.common.client.dropdown.noItems.NoItemsComponent;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\n@Dependent\n@Templated\npublic class LiveSearchDropDownView<TYPE> extends Composite\n        implements LiveSearchDropDown.View<TYPE> {\n\n    @Inject\n    @DataField\n    Div mainPanel;\n\n    @Inject\n    @DataField\n    Div dropDownPanel;\n\n    @Inject\n    @DataField\n    Button dropDownButton;\n\n    @Inject\n    @DataField\n    Span dropDownText;\n\n    @Inject\n    @DataField\n    Div searchPanel;\n\n    @Inject\n    @DataField\n    Input searchInput;\n\n    @Inject\n    @DataField\n    UnorderedList dropDownMenu;\n\n    @Inject\n    @DataField\n    Div spinnerPanel;\n\n    @Inject\n    @DataField\n    Span spinnerText;\n\n    @Inject\n    @DataField\n    private LiveSearchFooter liveSearchFooter;\n\n    @Inject\n    @DataField\n    private NoItemsComponent noItems;\n\n    private boolean resetEnabled = true;\n    private boolean newItemEnabled = true;\n\n    private LiveSearchDropDown presenter;\n\n    @Override\n    public void init(LiveSearchDropDown presenter) {\n        this.presenter = presenter;\n    }\n\n    @PostConstruct\n    public void initialize() {\n        setSearchHint(getDefaultSearchHintI18nMessage());\n        setDropDownText(getDefaultSelectorHintI18nMessage());\n        setNewInstanceEnabled(false);\n        setNewEntryI18nMessage(getDefaultNewEntryI18nMessage());\n        liveSearchFooter.init(this::showNewItem, this::clearSelection);\n    }\n\n    private void showNewItem() {\n        presenter.showNewItem();\n    }\n\n\n    private void clearSelection() {\n        presenter.clearSelection();\n    }\n\n    @Override\n    public void setMaxHeight(int maxHeight) {\n        dropDownMenu.getStyle().setProperty(\"max-height\",\n                                            maxHeight + \"px\");\n    }\n\n    @Override\n    public void setWidth(int minWidth) {\n        dropDownButton.getStyle().setProperty(\"width\",\n                                              minWidth + \"px\");\n        dropDownPanel.getStyle().setProperty(\"width\",\n                                             minWidth + \"px\");\n    }\n\n    @Override\n    public void setSearchEnabled(boolean enabled) {\n        searchPanel.setHidden(!enabled);\n    }\n\n    @Override\n    public void setClearSelectionEnabled(boolean enabled) {\n        resetEnabled = enabled;\n        liveSearchFooter.showReset(enabled);\n        refreshFooter();\n    }\n\n    @Override\n    public void setNewInstanceEnabled(boolean enabled) {\n        newItemEnabled = enabled;\n        liveSearchFooter.showAddNewEntry(enabled);\n        refreshFooter();\n    }\n\n    private void refreshFooter() {\n        liveSearchFooter.getElement().setHidden(!resetEnabled && !newItemEnabled);\n    }\n\n    @Override\n    public void showNewItemEditor(InlineCreationEditor editor) {\n        editor.clear();\n        liveSearchFooter.showEditor(editor);\n    }\n\n    @Override\n    public void restoreFooter() {\n        liveSearchFooter.restore();\n    }\n\n    @Override\n    public void clearItems() {\n        DOMUtil.removeAllChildren(dropDownMenu);\n        noItems.hide();\n    }\n\n    @Override\n    public void noItems(String msg) {\n        DOMUtil.removeAllChildren(dropDownMenu);\n        noItems.setMessage(msg);\n        noItems.show();\n    }\n\n    @Override\n    public void addItem(LiveSearchSelectorItem<TYPE> item) {\n        dropDownMenu.appendChild(item.getElement());\n    }\n\n    @Override\n    public void setSelectedValue(String selectedItem) {\n        dropDownText.setTextContent(selectedItem);\n    }\n\n    @Override\n    public void setDropDownText(String text) {\n        dropDownText.setTextContent(text);\n    }\n\n    @Override\n    public void clearSearch() {\n        searchInput.setValue(\"\");\n    }\n\n    @Override\n    public void setSearchHint(String text) {\n        searchInput.setAttribute(\"placeholder\",\n                                 text);\n    }\n\n    @Override\n    public void searchInProgress(String msg) {\n        spinnerText.setTextContent(msg);\n        spinnerPanel.getStyle().removeProperty(\"display\");\n        dropDownMenu.getStyle().setProperty(\"display\",\n                                            \"none\");\n    }\n\n    @Override\n    public void searchFinished() {\n        spinnerPanel.getStyle().setProperty(\"display\",\n                                            \"none\");\n        dropDownMenu.getStyle().removeProperty(\"display\");\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        dropDownButton.setDisabled(!enabled);\n    }\n\n    @Override\n    public void setClearSelectionMessage(boolean multipleSelection) {\n        String message = multipleSelection ? getDefaultClearSelectionI18nMessage() : getDefaultResetSelectionI18nMessage();\n        liveSearchFooter.setResetLabel(message);\n    }\n\n    @Override\n    public void setNewEntryI18nMessage(String message) {\n        liveSearchFooter.setNewEntryLabel(message);\n    }\n\n    @Override\n    public String getDefaultNewEntryI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchNewEntry();\n    }\n\n    @Override\n    public String getDefaultSearchHintI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchHint();\n    }\n\n    @Override\n    public String getDefaultSelectorHintI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchSelectorHint();\n    }\n\n    @Override\n    public String getDefaultNotFoundI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchNotFoundMessage();\n    }\n\n    @Override\n    public String getDefaultResetSelectionI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchResetSelectionMessage();\n    }\n\n    @Override\n    public String getDefaultClearSelectionI18nMessage() {\n        return CommonConstants.INSTANCE.liveSearchClearSelectionMessage();\n    }\n\n    @EventHandler(\"searchInput\")\n    void onSearchChanged(KeyUpEvent event) {\n        String pattern = searchInput.getValue();\n        presenter.search(pattern);\n    }\n\n    @EventHandler(\"searchInput\")\n    void onSearchClick(ClickEvent event) {\n        // Capture and ignore in order to avoid the drop-down to hide\n        event.stopPropagation();\n    }\n\n    @EventHandler(\"searchInput\")\n    void onSearchOver(MouseOverEvent event) {\n        searchInput.focus();\n    }\n\n    @EventHandler(\"searchInput\")\n    void onSearchOver(KeyDownEvent event) {\n        // Capture and ignore in order to avoid the js errors\n        event.stopPropagation();\n    }\n\n    @EventHandler(\"dropDownButton\")\n    void onDropDownClick(ClickEvent event) {\n        presenter.onItemsShown();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchEntry.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\npublic class LiveSearchEntry<TYPE> {\n\n    private TYPE key;\n    private String value;\n\n    public LiveSearchEntry(TYPE key, String value) {\n        this.key = key;\n        this.value = value;\n    }\n\n    public TYPE getKey() {\n        return key;\n    }\n\n    public String getValue() {\n        return value;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchResults.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Comparator;\n\npublic class LiveSearchResults<TYPE> extends ArrayList<LiveSearchEntry<TYPE>> {\n\n    private int maxEntries = -1;\n    private static Comparator<LiveSearchEntry> _byValue = (e1, e2) -> e1.getValue().compareTo(e2.getValue());\n    private static Comparator<LiveSearchEntry> _byKey = (e1, e2) -> e1.getKey().toString().compareTo(e2.getKey().toString());\n\n    public LiveSearchResults() {\n        super();\n    }\n\n    public LiveSearchResults(int maxEntries) {\n        super();\n        this.maxEntries = maxEntries;\n    }\n\n    public LiveSearchResults(Collection<String> keysCollection) {\n        super();\n        this.addKeys(keysCollection);\n    }\n\n    public LiveSearchResults(int maxEntries, Collection<String> itemCollection) {\n        this(maxEntries);\n        this.addKeys(itemCollection);\n    }\n\n    public boolean add(String key) {\n        return this.add(key, key);\n    }\n\n    public boolean add(String key, String value) {\n        if (maxEntries <= 0 || size() < maxEntries) {\n            LiveSearchEntry entry = new LiveSearchEntry(key, value);\n            return this.add(entry);\n        }\n        return false;\n    }\n\n    @Override\n    public boolean add(LiveSearchEntry entry) {\n        if (maxEntries <= 0 || size() < maxEntries) {\n            return super.add(entry);\n        }\n        return false;\n    }\n\n    public void addKeys(Collection<String> itemCollection) {\n        itemCollection.forEach(item -> add(item, item));\n    }\n\n    public LiveSearchResults sortByKey() {\n        sort(_byKey);\n        return this;\n    }\n\n    public LiveSearchResults sortByValue() {\n        sort(_byValue);\n        return this;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchSelectionHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.uberfire.mvp.Command;\n\n/**\n * Handles the selection of a {@link LiveSearchDropDown}\n * @param <TYPE> The data type handled by the component\n */\npublic interface LiveSearchSelectionHandler<TYPE> {\n\n    /**\n     * Retrieves the text for the {@link LiveSearchDropDown} header based on the selected values\n     * @return The {@link LiveSearchDropDown} header\n     */\n    String getDropDownMenuHeader();\n\n    /**\n     * Registers and initializes the given {@link LiveSearchSelectorItem}\n     * @param item\n     */\n    void registerItem(LiveSearchSelectorItem<TYPE> item);\n\n    /**\n     * Sets the given {@link LiveSearchSelectorItem} as a selected value\n     * @param item\n     */\n    void selectItem(LiveSearchSelectorItem<TYPE> item);\n\n    /**\n     * Selects the {@link LiveSearchSelectorItem} that has the given key\n     * @param key\n     */\n    void selectKey(TYPE key);\n\n    /**\n     * Clears the selection\n     */\n    void clearSelection();\n\n    /**\n     * Sets the {@link Command} callback to notify the {@link LiveSearchDropDown} when there's a selection change.\n     * @param command\n     */\n    void setLiveSearchSelectionCallback(Command command);\n\n    /**\n     * Determines if the handler supports multiple selection or not.\n     * @return True if supports multiple selection, false if not.\n     */\n    boolean isMultipleSelection();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchSelectorItem.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.mvp.Command;\n\npublic interface LiveSearchSelectorItem<TYPE> extends IsElement{\n\n    void init(TYPE key, String value);\n\n    TYPE getKey();\n\n    String getValue();\n\n    void reset();\n\n    void setMultipleSelection(boolean enable);\n\n    void onItemClick();\n\n    void select();\n\n    void setSelectionCallback(Command selectionCallback);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchSelectorItemView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.uberfire.client.mvp.UberElement;\n\npublic interface LiveSearchSelectorItemView<PRESENTER extends LiveSearchSelectorItem<TYPE>, TYPE> extends UberElement<PRESENTER> {\n\n    void render(String value);\n\n    void select();\n\n    void reset();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\npublic interface LiveSearchService<TYPE> {\n\n    void search(String pattern,\n                int maxResults,\n                LiveSearchCallback<TYPE> callback);\n\n    void searchEntry(TYPE key, LiveSearchCallback<TYPE> callback);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/ModalCreationEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface ModalCreationEditor<TYPE> extends EntryCreationEditor<TYPE> {\n\n    void show();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/MultipleLiveSearchSelectionHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\npublic class MultipleLiveSearchSelectionHandler<TYPE> implements LiveSearchSelectionHandler<TYPE> {\n\n    private int maxDropDownTextItems = 5;\n\n    private Command onChangeNotification;\n\n    private List<LiveSearchSelectorItem<TYPE>> visibleItems = new ArrayList<>();\n\n    private List<LiveSearchSelectorItem<TYPE>> selectedItems = new ArrayList<>();\n\n    public MultipleLiveSearchSelectionHandler() {\n    }\n\n    public MultipleLiveSearchSelectionHandler(int maxDropDownTextItems) {\n        this.maxDropDownTextItems = maxDropDownTextItems;\n    }\n\n    @Override\n    public String getDropDownMenuHeader() {\n        if(selectedItems.isEmpty()) {\n            return null;\n        }\n\n        if(selectedItems.size() > maxDropDownTextItems) {\n            return CommonConstants.INSTANCE.liveSearchElementsSelected(selectedItems.size());\n        }\n\n        StringBuilder builder = new StringBuilder();\n\n        for(int i = 0; i< selectedItems.size(); i++) {\n            if(i > 0) {\n                if(i == selectedItems.size() -1) {\n                    builder.append(\" & \");\n                } else {\n                    builder.append(\", \");\n                }\n            }\n\n            builder.append(selectedItems.get(i).getValue());\n        }\n\n        return builder.toString();\n    }\n\n    @Override\n    public void registerItem(LiveSearchSelectorItem<TYPE> item) {\n        item.setSelectionCallback(() -> selectItem(item));\n\n        item.setMultipleSelection(true);\n\n        LiveSearchSelectorItem<TYPE> selectedItem = selectedItems.stream()\n                .filter(filterItem -> filterItem.getKey().equals(item.getKey()))\n                .findFirst()\n                .orElse(null);\n\n        if(selectedItem != null && selectedItem.getKey().equals(item.getKey())) {\n            selectedItems.remove(selectedItem);\n            visibleItems.remove(selectedItem);\n\n            item.select();\n            selectedItems.add(item);\n        }\n\n        visibleItems.add(item);\n    }\n\n    @Override\n    public void selectItem(LiveSearchSelectorItem<TYPE> item) {\n\n        LiveSearchSelectorItem<TYPE> selectedItem = selectedItems.stream()\n                .filter(listItem -> listItem.getKey().equals(item.getKey())).findFirst()\n                .orElse(null);\n\n        if(selectedItem != null) {\n            selectedItem.reset();\n            selectedItems.remove(selectedItem);\n        } else {\n            item.select();\n            selectedItems.add(item);\n        }\n\n        if(onChangeNotification != null) {\n            onChangeNotification.execute();\n        }\n    }\n\n\n    @Override\n    public void selectKey(TYPE key) {\n        visibleItems.stream()\n                .filter(selectorItem -> selectorItem.getKey().equals(key))\n                .findFirst()\n                .ifPresent(this::selectItem);\n    }\n\n    @Override\n    public void clearSelection() {\n        if(!selectedItems.isEmpty()) {\n            selectedItems.forEach(LiveSearchSelectorItem::reset);\n            selectedItems.clear();\n\n            if (onChangeNotification != null) {\n                onChangeNotification.execute();\n            }\n        }\n    }\n\n    public List<TYPE> getSelectedValues() {\n        return selectedItems.stream()\n                .map(LiveSearchSelectorItem::getKey)\n                .collect(Collectors.toList());\n    }\n\n    public void setMaxDropDownTextItems(int maxDropDownTextItems) {\n        this.maxDropDownTextItems = maxDropDownTextItems;\n    }\n\n    @Override\n    public void setLiveSearchSelectionCallback(Command command) {\n        this.onChangeNotification = command;\n    }\n\n    @Override\n    public boolean isMultipleSelection() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/PerspectiveDropDown.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class PerspectiveDropDown implements IsWidget {\n\n    ActivityBeansCache activityBeansCache;\n    LiveSearchDropDown liveSearchDropDown;\n    PerspectiveNameProvider perspectiveNameProvider;\n    Set<String> perspectiveIdsExcluded;\n    LiveSearchService<String> searchService = new LiveSearchService<String>() {\n        @Override\n        public void search(String pattern, int maxResults, LiveSearchCallback<String> callback) {\n            LiveSearchResults result = new LiveSearchResults(maxResults);\n            for (SyncBeanDef<Activity> beanDef : activityBeansCache.getPerspectiveActivities()) {\n                String perspectiveName = beanDef.getName();\n                if (perspectiveIdsExcluded == null || !perspectiveIdsExcluded.contains(perspectiveName)) {\n                    String name = getItemName(perspectiveName);\n                    if (name.toLowerCase().contains(pattern.toLowerCase())) {\n                        result.add(perspectiveName, name);\n                    }\n                }\n            }\n            result.sortByValue();\n            callback.afterSearch(result);\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n            LiveSearchResults result = new LiveSearchResults(1);\n\n            activityBeansCache.getPerspectiveActivities()\n                    .stream()\n                    .map(SyncBeanDef::getName)\n                    .filter(perspectiveName -> (perspectiveIdsExcluded == null || !perspectiveIdsExcluded.contains(perspectiveName)) && perspectiveName.equals(key))\n                    .findAny()\n                    .ifPresent(perspectiveName -> result.add(perspectiveName, getItemName(perspectiveName)));\n            callback.afterSearch(result);\n        }\n    };\n\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n\n    @Inject\n    public PerspectiveDropDown(ActivityBeansCache activityBeansCache,\n                               LiveSearchDropDown liveSearchDropDown) {\n        this.activityBeansCache = activityBeansCache;\n        this.liveSearchDropDown = liveSearchDropDown;\n        this.perspectiveNameProvider = null;\n    }\n\n    @PostConstruct\n    private void init() {\n        liveSearchDropDown.setSelectorHint(CommonConstants.INSTANCE.PerspectiveSelectHint());\n        liveSearchDropDown.setSearchHint(CommonConstants.INSTANCE.PerspectiveSearchHint());\n        liveSearchDropDown.setNotFoundMessage(CommonConstants.INSTANCE.PerspectiveNotFound());\n        liveSearchDropDown.setClearSelectionEnabled(false);\n        liveSearchDropDown.init(searchService, selectionHandler);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return liveSearchDropDown.asWidget();\n    }\n\n    public void setPerspectiveNameProvider(PerspectiveNameProvider perspectiveNameProvider) {\n        this.perspectiveNameProvider = perspectiveNameProvider;\n    }\n\n    public void setPerspectiveIdsExcluded(Set<String> perspectiveIdsExcluded) {\n        this.perspectiveIdsExcluded = perspectiveIdsExcluded;\n    }\n\n    public PerspectiveActivity getDefaultPerspective() {\n        for (SyncBeanDef beanDef : activityBeansCache.getPerspectiveActivities()) {\n            PerspectiveActivity p = (PerspectiveActivity) beanDef.getInstance();\n            if (p.isDefault()) {\n                return p;\n            }\n        }\n        return null;\n    }\n\n    public PerspectiveActivity getSelectedPerspective() {\n        String selected = selectionHandler.getSelectedKey();\n        if (selected == null) {\n            return null;\n        }\n        SyncBeanDef beanDef = activityBeansCache.getActivity(selected);\n        PerspectiveActivity p = (PerspectiveActivity) beanDef.getInstance();\n        return p;\n    }\n\n    public void setSelectedPerspective(String perspectiveId) {\n        liveSearchDropDown.setSelectedItem(perspectiveId);\n    }\n\n    public void setSelectedPerspective(PerspectiveActivity selectedPerspective) {\n        liveSearchDropDown.setSelectedItem(selectedPerspective.getIdentifier());\n    }\n\n    public void setMaxItems(int maxItems) {\n        liveSearchDropDown.setMaxItems(maxItems);\n    }\n\n    public void setWidth(int minWidth) {\n        liveSearchDropDown.setWidth(minWidth);\n    }\n\n    public void setOnChange(Command onChange) {\n        liveSearchDropDown.setOnChange(onChange);\n    }\n\n    public void clear() {\n        liveSearchDropDown.clear();\n    }\n\n    public String getItemName(PerspectiveActivity p) {\n        return getItemName(p.getIdentifier());\n    }\n\n    public String getItemName(String perspectiveId) {\n        if (perspectiveNameProvider != null) {\n            return perspectiveNameProvider.getPerspectiveName(perspectiveId);\n        } else {\n            String fullName = perspectiveId;\n            int lastDot = fullName.lastIndexOf(\".\");\n            return lastDot != -1 ? fullName.substring(lastDot + 1) : fullName;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/PerspectiveNameProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\n/**\n * Interface used to feed the {@link PerspectiveDropDown} widget with user friendly perspective names.\n */\npublic interface PerspectiveNameProvider {\n\n    /**\n     * Get a user friendly name for the given perspective identifier\n     * @param perspectiveId The id. of an existing perspective.\n     * @return A displayable name\n     */\n    String getPerspectiveName(String perspectiveId);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/SingleLiveSearchSelectionHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.mvp.Command;\n\npublic class SingleLiveSearchSelectionHandler<TYPE> implements LiveSearchSelectionHandler<TYPE> {\n\n    protected List<LiveSearchSelectorItem<TYPE>> visibleItems = new ArrayList<>();\n\n    private LiveSearchSelectorItem<TYPE> selectedItem;\n\n    private Command onChangeNotification;\n\n    public SingleLiveSearchSelectionHandler() {\n    }\n\n    @Override\n    public String getDropDownMenuHeader() {\n        if(selectedItem != null) {\n            return selectedItem.getValue();\n        }\n        return null;\n    }\n\n    @Override\n    public void registerItem(final LiveSearchSelectorItem<TYPE> item) {\n        if(selectedItem != null && selectedItem.getKey().equals(item.getKey())) {\n            visibleItems.remove(selectedItem);\n            item.select();\n            selectedItem = item;\n        }\n\n        item.setSelectionCallback(() -> selectItem(item));\n\n        visibleItems.add(item);\n    }\n\n    @Override\n    public void selectItem(LiveSearchSelectorItem<TYPE> item) {\n        if(selectedItem == null) {\n            selectedItem = item;\n            selectedItem.select();\n        } else {\n            if(!selectedItem.getKey().equals(item.getKey())) {\n                selectedItem.reset();\n                selectedItem = item;\n                selectedItem.select();\n            }\n        }\n\n        if(onChangeNotification != null) {\n            onChangeNotification.execute();\n        }\n    }\n\n    @Override\n    public void selectKey(TYPE key) {\n        if(selectedItem != null && selectedItem.getKey().equals(key)) {\n            return;\n        }\n\n        visibleItems.stream()\n                .filter(item -> item.getKey().equals(key))\n                .findFirst()\n                .ifPresent(item -> selectItem(item));\n    }\n\n    public TYPE getSelectedKey() {\n        if(selectedItem != null) {\n            return selectedItem.getKey();\n        }\n\n        return null;\n    }\n\n    public String getSelectedValue() {\n        if(selectedItem != null) {\n            return selectedItem.getValue();\n        }\n\n        return null;\n    }\n\n    @Override\n    public void setLiveSearchSelectionCallback(Command command) {\n        this.onChangeNotification = command;\n    }\n\n    @Override\n    public void clearSelection() {\n        if(selectedItem != null) {\n            selectedItem.reset();\n            selectedItem = null;\n\n            if (onChangeNotification != null) {\n                onChangeNotification.execute();\n            }\n        }\n    }\n\n    @Override\n    public boolean isMultipleSelection() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.footer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.ext.widgets.common.client.dropdown.InlineCreationEditor;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class LiveSearchFooter implements LiveSearchFooterView.Presenter,\n                                         IsElement {\n\n    private LiveSearchFooterView view;\n\n    private Command onNewEntry;\n    private Command onReset;\n\n    @Inject\n    public LiveSearchFooter(LiveSearchFooterView view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    public void init(Command onNewEntry, Command onReset) {\n        this.onNewEntry = onNewEntry;\n        this.onReset = onReset;\n    }\n\n    public void showEditor(InlineCreationEditor editor) {\n        view.show(editor.getElement());\n    }\n\n    public void showReset(boolean show) {\n        view.showReset(show);\n    }\n\n    public void showAddNewEntry(boolean show) {\n        view.showAddNewEntry(show);\n    }\n\n    @Override\n    public void onNewEntryPressed() {\n        onNewEntry.execute();\n    }\n\n    @Override\n    public void onResetPressed() {\n        onReset.execute();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void restore() {\n        view.restore();\n    }\n\n    public void setResetLabel(String resetLabel) {\n        view.setResetLabel(resetLabel);\n    }\n\n    public void setNewEntryLabel(String newEntryLabel) {\n        view.setNewEntryLabel(newEntryLabel);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooterView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.footer;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\n\npublic interface LiveSearchFooterView extends UberElement<LiveSearchFooterView.Presenter> {\n\n    void showReset(boolean show);\n\n    void showAddNewEntry(boolean show);\n\n    void show(HTMLElement element);\n\n    void restore();\n\n    void setResetLabel(String resetLabel);\n\n    void setNewEntryLabel(String newEntryLabel);\n\n    interface Presenter {\n\n        void onNewEntryPressed();\n\n        void onResetPressed();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooterViewImpl.css",
    "content": ".appformer-live-search-selector-footer-panel{\n    border-top: 1px solid #bbb;\n    padding-top: 5px;\n    padding-left: 10px;\n    padding-right: 10px;\n}\n\n.appformer-live-search-selector-action {\n    cursor: pointer;\n}\n\n.appformer-live-search-selector-action-icon {\n    padding-right: 5px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooterViewImpl.html",
    "content": "<div class=\"appformer-live-search-selector-footer-panel\">\n    <div data-field=\"container\">\n        <div data-field=\"footer\">\n            <div>\n                <a data-field=\"newEntryAnchor\" class=\"appformer-live-search-selector-action\">\n                    <span class=\"fa fa-plus-circle appformer-live-search-selector-action-icon\"></span><span data-field=\"newEntryAnchorLabel\"></span>\n                </a>\n            </div>\n            <div>\n                <a data-field=\"resetAnchor\" class=\"appformer-live-search-selector-action\">\n                    <span class=\"fa fa-times-circle appformer-live-search-selector-action-icon\"></span><span data-field=\"resetAnchorLabel\"></span>\n                </a>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooterViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.footer;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class LiveSearchFooterViewImpl implements LiveSearchFooterView,\n                                                 IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private Div container;\n\n    @Inject\n    @DataField\n    private Div footer;\n\n    @Inject\n    @DataField\n    private Anchor newEntryAnchor;\n\n    @Inject\n    @DataField\n    private Span newEntryAnchorLabel;\n\n    @Inject\n    @DataField\n    private Anchor resetAnchor;\n\n    @Inject\n    @DataField\n    private Span resetAnchorLabel;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setResetLabel(String resetLabel) {\n        resetAnchorLabel.setTextContent(resetLabel);\n    }\n\n    @Override\n    public void setNewEntryLabel(String newEntryLabel) {\n        newEntryAnchorLabel.setTextContent(newEntryLabel);\n    }\n\n    @Override\n    public void showReset(boolean show) {\n        resetAnchor.setHidden(!show);\n    }\n\n    @Override\n    public void showAddNewEntry(boolean show) {\n        newEntryAnchor.setHidden(!show);\n    }\n\n    @Override\n    public void show(HTMLElement element) {\n        DOMUtil.removeAllChildren(container);\n        container.appendChild(element);\n    }\n\n    @Override\n    public void restore() {\n        DOMUtil.removeAllChildren(container);\n        container.appendChild(footer);\n    }\n\n    @EventHandler(\"newEntryAnchor\")\n    public void onNewEntryPresed(ClickEvent clickEvent) {\n        clickEvent.stopPropagation();\n        presenter.onNewEntryPressed();\n    }\n\n    @EventHandler(\"resetAnchor\")\n    public void onResetPressed(ClickEvent clickEvent) {\n        presenter.onResetPressed();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/items/LiveSearchSelectorDropDownItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.dropdown.items;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchSelectorItem;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class LiveSearchSelectorDropDownItem<TYPE> implements LiveSearchSelectorItem<TYPE> {\n\n    private LiveSearchSelectorDropDownItemView<TYPE> view;\n    private TYPE key;\n    private String value;\n    private Command selectionCallback;\n\n    @Inject\n    public LiveSearchSelectorDropDownItem(LiveSearchSelectorDropDownItemView view) {\n        this.view = view;\n        this.view.init(this);\n    }\n\n    @Override\n    public void init(TYPE key,\n                     String value) {\n\n        this.key = key;\n        this.value = value;\n        view.render(value);\n    }\n\n    @Override\n    public void setSelectionCallback(Command selectionCallback) {\n        this.selectionCallback = selectionCallback;\n    }\n\n    @Override\n    public TYPE getKey() {\n        return key;\n    }\n\n    @Override\n    public String getValue() {\n        return value;\n    }\n\n    @Override\n    public void onItemClick() {\n        if(selectionCallback != null) {\n            selectionCallback.execute();\n        }\n    }\n\n    @Override\n    public void select() {\n        view.select();\n    }\n\n    @Override\n    public void reset() {\n        view.reset();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public void setMultipleSelection(boolean enable) {\n        view.setSelectionIconVisible(enable);\n        view.setMultiSelect(enable);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/items/LiveSearchSelectorDropDownItemView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.items;\n\nimport org.uberfire.ext.widgets.common.client.dropdown.LiveSearchSelectorItemView;\n\npublic interface LiveSearchSelectorDropDownItemView<TYPE> extends LiveSearchSelectorItemView<LiveSearchSelectorDropDownItem<TYPE>, TYPE> {\n\n    void setSelectionIconVisible(boolean visible);\n\n    void setMultiSelect(boolean multiSelect);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/items/LiveSearchSelectorDropDownItemViewImpl.css",
    "content": ".appformer-live-search-selector-dditem {\n    cursor: pointer;\n}\n\n.appformer-live-search-selector-dditem-icon-hidden {\n    display:none;\n}\n\n.appformer-live-search-selector-dditem-icon-visible {\n    margin-left: 5px;\n    cursor: pointer;\n    float: right;\n    display:block !important;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/items/LiveSearchSelectorDropDownItemViewImpl.html",
    "content": "<li role=\"presentation\" data-field=\"item\" class=\"appformer-live-search-selector-dditem\">\n    <a data-field=\"itemAnchor\" role=\"menuitem\" tabindex=\"-1\" href=\"#\">\n        <span data-field=\"itemText\" class=\"text\"></span>\n        <span data-field=\"itemIcon\" class=\"glyphicon glyphicon-ok check-mark\"></span>\n    </a>\n</li>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/items/LiveSearchSelectorDropDownItemViewImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.items;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.DomEvent;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class LiveSearchSelectorDropDownItemViewImpl<TYPE> implements LiveSearchSelectorDropDownItemView<TYPE>,\n                                                                     IsElement {\n\n    private final static String ICON_VISIBLE_CLASSNAME = \"appformer-live-search-selector-dditem-icon-visible\";\n    private final static String ICON_HIDDEN_CLASSNAME = \"appformer-live-search-selector-dditem-icon-hidden\";\n\n    @Inject\n    @DataField\n    private ListItem item;\n\n    @Inject\n    @DataField\n    private Anchor itemAnchor;\n\n    @Inject\n    @DataField\n    private Span itemText;\n\n    @Inject\n    @DataField\n    private Span itemIcon;\n\n    private LiveSearchSelectorDropDownItem presenter;\n\n    private boolean iconVisible = false;\n\n    private boolean multiSelect = false;\n\n    @Override\n    public void render(String value) {\n        itemText.setTextContent(value);\n    }\n\n    @Override\n    public void init(LiveSearchSelectorDropDownItem presenter) {\n        this.presenter = presenter;\n        this.reset();\n    }\n\n    @Override\n    public void select() {\n        item.setClassName(\"appformer-live-search-selector-dditem selected\");\n        if (iconVisible) {\n            DOMUtil.removeCSSClass(itemIcon, ICON_HIDDEN_CLASSNAME);\n            DOMUtil.addCSSClass(itemIcon, ICON_VISIBLE_CLASSNAME);\n        }\n    }\n\n    @Override\n    public void reset() {\n        item.setClassName(\"appformer-live-search-selector-dditem\");\n        DOMUtil.removeCSSClass(itemIcon, ICON_VISIBLE_CLASSNAME);\n        DOMUtil.addCSSClass(itemIcon, ICON_HIDDEN_CLASSNAME);\n    }\n\n    @Override\n    public void setSelectionIconVisible(boolean visible) {\n        iconVisible = visible;\n        if (!iconVisible) {\n            DOMUtil.removeCSSClass(itemIcon, ICON_VISIBLE_CLASSNAME);\n            DOMUtil.addCSSClass(itemIcon, ICON_HIDDEN_CLASSNAME);\n        }\n    }\n\n    @Override\n    public void setMultiSelect(boolean multiSelect) {\n        this.multiSelect = multiSelect;\n    }\n\n    private void onItemSelected(DomEvent event) {\n        presenter.onItemClick();\n\n        if (multiSelect) {\n            event.stopPropagation();\n        }\n    }\n\n    @EventHandler(\"itemAnchor\")\n    public void onItemClick(ClickEvent event) {\n        onItemSelected(event);\n    }\n\n    @EventHandler(\"itemAnchor\")\n    void onEnterKeyDown(KeyDownEvent event) {\n        if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n            onItemSelected(event);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.noItems;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\n@Dependent\npublic class NoItemsComponent implements IsElement {\n\n    private NoItemsComponentView view;\n\n    @Inject\n    public NoItemsComponent(NoItemsComponentView view) {\n        this.view = view;\n    }\n\n    public void setMessage(String message) {\n        if(message == null || message.isEmpty()) {\n            message = CommonConstants.INSTANCE.liveSearchNotFoundMessage();\n        }\n\n        view.setMessage(message);\n    }\n\n    public void show() {\n        view.show();\n    }\n\n    public void hide() {\n        view.hide();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponentView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.noItems;\n\nimport org.jboss.errai.common.client.api.IsElement;\n\npublic interface NoItemsComponentView extends IsElement {\n\n    void setMessage(String message);\n\n    void hide();\n\n    void show();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponentViewImpl.css",
    "content": ".appformer-widgets-livesearch-no-items {\n    margin-left: 10px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponentViewImpl.html",
    "content": "<div data-field=\"container\">\n    <span data-field=\"message\" class=\"appformer-widgets-livesearch-no-items\">\n    </span>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponentViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.noItems;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class NoItemsComponentViewImpl implements NoItemsComponentView,\n                                                 IsElement {\n    @Inject\n    @DataField\n    private Div container;\n\n    @Inject\n    @DataField\n    private Span message;\n\n    @Override\n    public void setMessage(String msg) {\n        message.setTextContent(msg);\n    }\n\n    @Override\n    public void hide() {\n        container.setHidden(true);\n    }\n\n    @Override\n    public void show() {\n        container.setHidden(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/forms/GetFormParamsEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.forms;\n\nimport java.util.Map;\n\n//This class is not @Portable since we only want it client-side\npublic class GetFormParamsEvent {\n\n    private String action;\n    private Map<String, Object> params;\n\n    public GetFormParamsEvent() {\n    }\n\n    public GetFormParamsEvent(String action,\n                              Map<String, Object> params) {\n        this.action = action;\n        this.params = params;\n    }\n\n    public Map<String, Object> getParams() {\n        return params;\n    }\n\n    public String getAction() {\n        return action;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/forms/RequestFormParamsEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.forms;\n\n//This class is not @Portable since we only want it client-side\npublic class RequestFormParamsEvent {\n\n    private String action;\n\n    public RequestFormParamsEvent() {\n    }\n\n    public RequestFormParamsEvent(String action) {\n        this.action = action;\n    }\n\n    public String getAction() {\n        return action;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/forms/SetFormParamsEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.forms;\n\nimport java.util.Map;\n\n//This class is not @Portable since we only want it client-side\npublic class SetFormParamsEvent {\n\n    private Map<String, String> params;\n    private boolean readOnly;\n\n    public SetFormParamsEvent() {\n    }\n\n    public SetFormParamsEvent(Map<String, String> params,\n                              boolean readOnly) {\n        this.params = params;\n        this.readOnly = readOnly;\n    }\n\n    public Map<String, String> getParams() {\n        return params;\n    }\n\n    public boolean isReadOnly() {\n        return readOnly;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemDivider.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport org.uberfire.workbench.model.menu.MenuItem;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * A qualifier for removing ambiguity between different beans for {@link MenuItem} widgets.\n */\n@Documented\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE, FIELD, PARAMETER, METHOD})\npublic @interface MenuItemDivider {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemDividerView.html",
    "content": "<li role=\"separator\" class=\"divider\"></li>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemDividerView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@MenuItemDivider\npublic class MenuItemDividerView implements MenuItemView {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemFactory.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Any;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.views.pfly.listbar.ListBarWidgetImpl;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n/**\n * Factory for different {@link MenuCustom} and associated {@link MenuItemView}.\n */\n@ApplicationScoped\npublic class MenuItemFactory {\n\n    private ManagedInstance<MenuItemView> menuItemViewProducer;\n\n    @Inject\n    public MenuItemFactory(final @Any ManagedInstance<MenuItemView> menuItemViewProducer) {\n        this.menuItemViewProducer = menuItemViewProducer;\n    }\n\n    /**\n     * Makes a {@link MenuCustom} and associated {@link MenuItemWithIconView} that can be used\n     * to replace the default Views created by {@link ListBarWidgetImpl} if an icon is also required.\n     * If an icon is not required the caption is indented to the position that it would adopt if an\n     * icon had been specified. It is not possible to use BS3's {@link AnchorListItem} as this only\n     * indents the caption IF an icon is specified.\n     * @param caption Caption to be shown for the menu item.\n     * @param cmd Command to execute when the menu item is clicked.\n     * @param <T> {@link MenuItemWithIconView}\n     * @return A {@link MenuItemViewHolder} with both a {@link MenuItem} and {@link MenuItemView}\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <T extends MenuItemWithIconView> MenuItemViewHolder<T> makeMenuItemWithIcon(final String caption,\n                                                                                       final Command cmd) {\n        final MenuItemView _view = menuItemViewProducer.select(new MenuItemWithIcon() {\n            @Override\n            public Class<? extends Annotation> annotationType() {\n                return MenuItemWithIcon.class;\n            }\n        }).get();\n        final T view = (T) _view;\n        final MenuItem item = MenuFactory.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {\n\n            @Override\n            public void push(final MenuFactory.CustomMenuBuilder element) {\n\n            }\n\n            @Override\n            public MenuItem build() {\n                final BaseMenuCustom<IsWidget> cmdItem = new BaseMenuCustom<IsWidget>(null,\n                                                                                      caption) {\n\n                    private final List<EnabledStateChangeListener> enabledStateChangeListeners = new ArrayList<>();\n\n                    @Override\n                    public IsWidget build() {\n                        return ElementWrapperWidget.getWidget(view.getElement());\n                    }\n\n                    @Override\n                    public void setEnabled(final boolean enabled) {\n                        super.setEnabled(enabled);\n                        notifyListeners(enabled);\n                    }\n\n                    @Override\n                    public void addEnabledStateChangeListener(final EnabledStateChangeListener listener) {\n                        enabledStateChangeListeners.add(listener);\n                    }\n\n                    private void notifyListeners(final boolean enabled) {\n                        for (final EnabledStateChangeListener listener : enabledStateChangeListeners) {\n                            listener.enabledStateChanged(enabled);\n                        }\n                    }\n                };\n                cmdItem.addEnabledStateChangeListener(view::setEnabled);\n\n                return cmdItem;\n            }\n        }).endMenu().build().getItems().get(0);\n\n        view.setCaption(caption);\n        view.setClickHandler((e) -> {\n            if (item.isEnabled()) {\n                cmd.execute();\n            }\n        });\n\n        return new MenuItemViewHolder<>(item,\n                                        view);\n    }\n\n    /**\n     * Makes a {@link MenuCustom} and associated {@link MenuItemHeaderView} that can be used\n     * as a \"header\" in a menu. See http://getbootstrap.com/components/#dropdowns-headers\n     * @param caption Caption to be shown for the menu header.\n     * @param <T> {@link MenuItemHeaderView}\n     * @return A {@link MenuItemViewHolder} with both a {@link MenuItem} and {@link MenuItemView}\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <T extends MenuItemHeaderView> MenuItemViewHolder<T> makeMenuItemHeader(final String caption) {\n        final MenuItemView _view = menuItemViewProducer.select(new MenuItemHeader() {\n            @Override\n            public Class<? extends Annotation> annotationType() {\n                return MenuItemHeader.class;\n            }\n        }).get();\n        final T view = (T) _view;\n        final MenuItem item = MenuFactory.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {\n\n            @Override\n            public void push(final MenuFactory.CustomMenuBuilder element) {\n\n            }\n\n            @Override\n            public MenuItem build() {\n                final BaseMenuCustom<IsWidget> cmdItem = new BaseMenuCustom<IsWidget>(null,\n                                                                                      caption) {\n\n                    @Override\n                    public IsWidget build() {\n                        return ElementWrapperWidget.getWidget(view.getElement());\n                    }\n                };\n\n                return cmdItem;\n            }\n        }).endMenu().build().getItems().get(0);\n\n        view.setCaption(caption);\n\n        return new MenuItemViewHolder<>(item,\n                                        view);\n    }\n\n    /**\n     * Makes a {@link MenuCustom} and associated {@link MenuItemDividerView} that can be used as\n     * a \"divider\" in a menu. See http://getbootstrap.com/components/#dropdowns-divider\n     * @param <T> {@link }MenuItemDividerView}\n     * @return A {@link MenuItemViewHolder} with both a {@link MenuItem} and {@link MenuItemView}\n     */\n    @SuppressWarnings(\"unchecked\")\n    public <T extends MenuItemDividerView> MenuItemViewHolder<T> makeMenuItemDivider() {\n        final MenuItemView _view = menuItemViewProducer.select(new MenuItemDivider() {\n            @Override\n            public Class<? extends Annotation> annotationType() {\n                return MenuItemDivider.class;\n            }\n        }).get();\n        final T view = (T) _view;\n        final MenuItem item = MenuFactory.newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {\n\n            @Override\n            public void push(final MenuFactory.CustomMenuBuilder element) {\n\n            }\n\n            @Override\n            public MenuItem build() {\n                final BaseMenuCustom<IsWidget> cmdItem = new BaseMenuCustom<IsWidget>() {\n\n                    @Override\n                    public IsWidget build() {\n                        return ElementWrapperWidget.getWidget(view.getElement());\n                    }\n                };\n\n                return cmdItem;\n            }\n        }).endMenu().build().getItems().get(0);\n\n        return new MenuItemViewHolder<>(item,\n                                        view);\n    }\n\n    /**\n     * Container for @{link MenuCustom} and {@link MenuItemView}\n     * @param <T> Type of view.\n     */\n    public static class MenuItemViewHolder<T extends MenuItemView> {\n\n        private final MenuItem item;\n        private final T view;\n\n        public MenuItemViewHolder(final MenuItem item,\n                                  final T view) {\n            this.item = item;\n            this.view = view;\n        }\n\n        public MenuItem getMenuItem() {\n            return item;\n        }\n\n        public T getMenuItemView() {\n            return view;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemHeader.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport org.uberfire.workbench.model.menu.MenuItem;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * A qualifier for removing ambiguity between different beans for {@link MenuItem} widgets.\n */\n@Documented\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE, FIELD, PARAMETER, METHOD})\npublic @interface MenuItemHeader {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemHeaderView.html",
    "content": "<li id=\"listItemHeader\" class=\"dropdown-header\">\n  <span id=\"caption\">Zoom</span>\n</li>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemHeaderView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@MenuItemHeader\npublic class MenuItemHeaderView implements MenuItemView {\n\n    @Inject\n    @DataField\n    Span caption;\n\n    public void setCaption(final String caption) {\n        this.caption.setTextContent(caption);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.uberfire.workbench.model.menu.MenuItem;\n\n/**\n * Base interface for all {@link MenuItem} views.\n */\npublic interface MenuItemView extends IsElement {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemWithIcon.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport java.lang.annotation.Documented;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport org.uberfire.workbench.model.menu.MenuItem;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * A qualifier for removing ambiguity between different beans for {@link MenuItem} widgets.\n */\n@Documented\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE, FIELD, PARAMETER, METHOD})\npublic @interface MenuItemWithIcon {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemWithIconView.html",
    "content": "<li id=\"listItem\" class=\"disabled\">\n  <a href=\"javascript:;\">\n    <i id=\"icon\" class=\"fa fa-fw\" aria-hidden=\"true\"></i>\n    <span id=\"caption\">Append row</span>\n  </a>\n</li>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/MenuItemWithIconView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@MenuItemWithIcon\npublic class MenuItemWithIconView implements MenuItemView {\n\n    @Inject\n    @DataField\n    Div icon;\n\n    @Inject\n    @DataField\n    Span caption;\n\n    @Inject\n    @DataField\n    ListItem listItem;\n\n    private ClickHandler clickHandler;\n\n    public void setCaption(final String caption) {\n        this.caption.setTextContent(caption);\n    }\n\n    public void setClickHandler(final ClickHandler clickHandler) {\n        this.clickHandler = clickHandler;\n    }\n\n    public void setEnabled(final boolean enabled) {\n        if (enabled) {\n            DOMUtil.removeCSSClass(listItem,\n                                   \"disabled\");\n        } else {\n            DOMUtil.addCSSClass(listItem,\n                                \"disabled\");\n        }\n    }\n\n    public void setIconType(final IconType type) {\n        if (type == null) {\n            DOMUtil.removeEnumStyleNames(icon,\n                                         IconType.class);\n        } else {\n            DOMUtil.addUniqueEnumStyleName(icon,\n                                           IconType.class,\n                                           type);\n        }\n    }\n\n    @EventHandler(\"listItem\")\n    @SuppressWarnings(\"unused\")\n    public void onClickListItem(final ClickEvent event) {\n        if (clickHandler != null) {\n            clickHandler.onClick(event);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/RefreshMenuBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\npublic class RefreshMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    protected Button menuRefreshButton = GWT.create(Button.class);\n    private SupportsRefresh supportsRefresh;\n\n    public RefreshMenuBuilder(final SupportsRefresh supportsRefresh) {\n        this.supportsRefresh = supportsRefresh;\n        setupMenuButton();\n    }\n\n    @Override\n    public void push(MenuFactory.CustomMenuBuilder element) {\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n            @Override\n            public IsWidget build() {\n                return menuRefreshButton;\n            }\n\n            @Override\n            public boolean isEnabled() {\n                return true;\n            }\n\n            @Override\n            public void setEnabled(boolean enabled) {\n\n            }\n        };\n    }\n\n    public void setupMenuButton() {\n        menuRefreshButton.setIcon(IconType.REFRESH);\n        menuRefreshButton.setSize(ButtonSize.SMALL);\n        menuRefreshButton.setTitle(CommonConstants.INSTANCE.Refresh());\n        menuRefreshButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent clickEvent) {\n                supportsRefresh.onRefresh();\n            }\n        });\n    }\n\n    public interface SupportsRefresh {\n\n        void onRefresh();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/menu/RefreshSelectorMenuBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.Divider;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\npublic class RefreshSelectorMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    private final CommonConstants constants = CommonConstants.INSTANCE;\n    private final DropDownMenu menuDropDownMenu = GWT.create(DropDownMenu.class);\n    private final Button menuButton = GWT.create(Button.class);\n    private final ButtonGroup buttonGroup = GWT.create(ButtonGroup.class);\n    private SupportsRefreshInterval supportsRefreshInterval;\n    public RefreshSelectorMenuBuilder(final SupportsRefreshInterval supportsRefreshInterval) {\n        this.supportsRefreshInterval = supportsRefreshInterval;\n        setupMenuButton();\n        setupMenuDropDown();\n        setupMenuButtonGroup();\n    }\n\n    @Override\n    public void push(MenuFactory.CustomMenuBuilder element) {\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n            @Override\n            public IsWidget build() {\n                return buttonGroup;\n            }\n\n            @Override\n            public boolean isEnabled() {\n                return true;\n            }\n\n            @Override\n            public void setEnabled(boolean enabled) {\n\n            }\n        };\n    }\n\n    protected void setupMenuButtonGroup() {\n        buttonGroup.add(menuButton);\n        buttonGroup.add(menuDropDownMenu);\n    }\n\n    protected void setupMenuButton() {\n        menuButton.setDataToggle(Toggle.DROPDOWN);\n        menuButton.setIcon(IconType.COG);\n        menuButton.setTitle(constants.AutoRefresh());\n        menuButton.setSize(ButtonSize.SMALL);\n    }\n\n    protected void setupMenuDropDown() {\n        menuDropDownMenu.setPull(Pull.RIGHT);\n    }\n\n    protected AnchorListItem createTimeSelector(int time,\n                                                String name,\n                                                int configuredSeconds,\n                                                final AnchorListItem refreshDisableButton) {\n        final AnchorListItem oneMinuteRadioButton = GWT.create(AnchorListItem.class);\n        oneMinuteRadioButton.setText(name);\n        oneMinuteRadioButton.setIconFixedWidth(true);\n        final int selectedRefreshTime = time;\n        if (configuredSeconds == selectedRefreshTime) {\n            oneMinuteRadioButton.setIcon(IconType.CHECK);\n        }\n\n        oneMinuteRadioButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                oneMinuteRadioButton.setIcon(IconType.CHECK);\n                supportsRefreshInterval.onUpdateRefreshInterval(true,\n                                                                selectedRefreshTime);\n                refreshDisableButton.setActive(false);\n                refreshDisableButton.setEnabled(true);\n                refreshDisableButton.setText(constants.Disable_autorefresh());\n            }\n        });\n\n        return oneMinuteRadioButton;\n    }\n\n    public void loadOptions(int configuredSeconds) {\n        final AnchorListItem resetButton = new AnchorListItem(constants.Disable_autorefresh());\n\n        if (configuredSeconds > 10) {\n            supportsRefreshInterval.onUpdateRefreshInterval(true,\n                                                            configuredSeconds);\n            resetButton.setEnabled(true);\n        } else {\n            supportsRefreshInterval.onUpdateRefreshInterval(false,\n                                                            0);\n            resetButton.setEnabled(false);\n            resetButton.setText(constants.Autorefresh_Disabled());\n        }\n\n        final AnchorListItem oneMinuteRadioButton = createTimeSelector(60,\n                                                                       \"1 \" + constants.Minute(),\n                                                                       configuredSeconds,\n                                                                       resetButton);\n        final AnchorListItem fiveMinuteRadioButton = createTimeSelector(300,\n                                                                        \"5 \" + constants.Minutes(),\n                                                                        configuredSeconds,\n                                                                        resetButton);\n        final AnchorListItem tenMinuteRadioButton = createTimeSelector(600,\n                                                                       \"10 \" + constants.Minutes(),\n                                                                       configuredSeconds,\n                                                                       resetButton);\n\n        menuDropDownMenu.add(oneMinuteRadioButton);\n        menuDropDownMenu.add(fiveMinuteRadioButton);\n        menuDropDownMenu.add(tenMinuteRadioButton);\n\n        oneMinuteRadioButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                fiveMinuteRadioButton.setIcon(null);\n                tenMinuteRadioButton.setIcon(null);\n            }\n        });\n\n        fiveMinuteRadioButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                oneMinuteRadioButton.setIcon(null);\n                tenMinuteRadioButton.setIcon(null);\n            }\n        });\n\n        tenMinuteRadioButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                oneMinuteRadioButton.setIcon(null);\n                fiveMinuteRadioButton.setIcon(null);\n            }\n        });\n\n        resetButton.addClickHandler(new ClickHandler() {\n\n            @Override\n            public void onClick(ClickEvent event) {\n                supportsRefreshInterval.onUpdateRefreshInterval(false,\n                                                                0);\n                resetButton.setActive(false);\n                resetButton.setEnabled(false);\n                resetButton.setText(constants.Autorefresh_Disabled());\n                oneMinuteRadioButton.setIcon(null);\n                fiveMinuteRadioButton.setIcon(null);\n                tenMinuteRadioButton.setIcon(null);\n            }\n        });\n\n        menuDropDownMenu.add(new Divider());\n        menuDropDownMenu.add(resetButton);\n    }\n\n    public interface SupportsRefreshInterval {\n\n        void onUpdateRefreshInterval(boolean enableAutoRefresh,\n                                     int newInterval);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/CommonAltedImages.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.resources;\n\nimport com.google.gwt.user.client.ui.Image;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\n\n/**\n *\n */\npublic class CommonAltedImages {\n\n    public static final CommonAltedImages INSTANCE = new CommonAltedImages();\n\n    public Image close() {\n        final Image image = new Image(CommonImages.INSTANCE.close());\n        image.setAltText(CommonConstants.INSTANCE.Close());\n        return image;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/CommonCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface CommonCss\n        extends\n        CssResource {\n\n    @ClassName(\"whiteTopLeftCornerClass\")\n    String whiteTopLeftCornerClass();\n\n    @ClassName(\"whiteTopRightCornerClass\")\n    String whiteTopRightCornerClass();\n\n    @ClassName(\"whiteBottomLeftCornerClass\")\n    String whiteBottomLeftCornerClass();\n\n    @ClassName(\"whiteBottomRightCornerClass\")\n    String whiteBottomRightCornerClass();\n\n    @ClassName(\"whiteBottomClass\")\n    String whiteBottomClass();\n\n    @ClassName(\"whiteTopClass\")\n    String whiteTopClass();\n\n    @ClassName(\"whiteSideLeftClass\")\n    String whiteSideLeftClass();\n\n    @ClassName(\"whiteSideRightClass\")\n    String whiteSideRightClass();\n\n    @ClassName(\"whiteCenterClass\")\n    String whiteCenterClass();\n\n    @ClassName(\"greyTopLeftCornerClass\")\n    String greyTopLeftCornerClass();\n\n    @ClassName(\"greyTopRightCornerClass\")\n    String greyTopRightCornerClass();\n\n    @ClassName(\"greyBottomLeftCornerClass\")\n    String greyBottomLeftCornerClass();\n\n    @ClassName(\"greyBottomRightCornerClass\")\n    String greyBottomRightCornerClass();\n\n    @ClassName(\"greyBottomClass\")\n    String greyBottomClass();\n\n    @ClassName(\"greyTopClass\")\n    String greyTopClass();\n\n    @ClassName(\"greySideLeftClass\")\n    String greySideLeftClass();\n\n    @ClassName(\"greySideRightClass\")\n    String greySideRightClass();\n\n    @ClassName(\"greyCenterClass\")\n    String greyCenterClass();\n\n    @ClassName(\"clean-textarea\")\n    String cleanTextArea();\n\n    @ClassName(\"busy-popup\")\n    String busyPopup();\n\n    @ClassName(\"titleTextCellContainer\")\n    String titleTextCellContainer();\n\n    @ClassName(\"titleTextCellDescription\")\n    String titleTextCellDescription();\n\n    @ClassName(\"dataGrid\")\n    String dataGrid();\n\n    @ClassName(\"dataGridHeader\")\n    String dataGridHeader();\n\n    @ClassName(\"dataGridContent\")\n    String dataGridContent();\n\n    @ClassName(\"dataGridRow\")\n    String dataGridRow();\n\n    @ClassName(\"columnPickerPopup\")\n    String columnPickerPopup();\n\n    @ClassName(\"columnPickerButton\")\n    String columnPickerButton();\n\n    @ClassName(\"popoverTextBreakWord\")\n    String popoverTextBreakWord();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/CommonImages.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.resources.client.ImageResource.ImageOptions;\nimport com.google.gwt.resources.client.ImageResource.RepeatStyle;\n\npublic interface CommonImages\n        extends\n        ClientBundle {\n\n    public static final CommonImages INSTANCE = GWT.create(CommonImages.class);\n\n    @Source(\"images/new_item.gif\")\n    ImageResource newItem();\n\n    @Source(\"images/new_item_disabled.gif\")\n    ImageResource newItemDisabled();\n\n    @Source(\"images/collapse.gif\")\n    ImageResource collapse();\n\n    @Source(\"images/collapseall.gif\")\n    ImageResource collapseAll();\n\n    @Source(\"images/expand.gif\")\n    ImageResource expand();\n\n    @Source(\"images/expandall.gif\")\n    ImageResource expandAll();\n\n    @Source(\"images/close.gif\")\n    ImageResource close();\n\n    @Source(\"images/corners/whiteTopLeft.gif\")\n    ImageResource whiteTopLeftCorner();\n\n    @Source(\"images/corners/whiteTopRight.gif\")\n    ImageResource whiteTopRightCorner();\n\n    @Source(\"images/corners/whiteBottomLeft.gif\")\n    ImageResource whiteBottomLeftCorner();\n\n    @Source(\"images/corners/whiteBottomRight.gif\")\n    ImageResource whiteBottomRightCorner();\n\n    @Source(\"images/corners/greyTopLeftCorner.gif\")\n    ImageResource greyTopLeftCorner();\n\n    @Source(\"images/corners/greyTopRightCorner.gif\")\n    ImageResource greyTopRightCorner();\n\n    @Source(\"images/corners/greyBottomLeftCorner.gif\")\n    ImageResource greyBottomLeftCorner();\n\n    @Source(\"images/corners/greyBottomRightCorner.gif\")\n    ImageResource greyBottomRightCorner();\n\n    @ImageOptions(repeatStyle = RepeatStyle.Horizontal)\n    @Source(\"images/corners/greyBottom.gif\")\n    ImageResource greyBottom();\n\n    @ImageOptions(flipRtl = true, repeatStyle = RepeatStyle.Horizontal)\n    @Source(\"images/corners/greyTop.gif\")\n    ImageResource greyTop();\n\n    @ImageOptions(repeatStyle = RepeatStyle.Vertical)\n    @Source(\"images/corners/greyLeftSide.gif\")\n    ImageResource greySideLeft();\n\n    @ImageOptions(repeatStyle = RepeatStyle.Vertical)\n    @Source(\"images/corners/greyRightSide.gif\")\n    ImageResource greySideRight();\n\n    //A warning triangle\n    @Source(\"images/warning-large.png\")\n    ImageResource warningLarge();\n\n    @Source(\"images/information.gif\")\n    ImageResource information();\n\n    @Source(\"images/validation_error.gif\")\n    ImageResource validationError();\n\n    @Source(\"images/spinner.gif\")\n    ImageResource spinner();\n\n    //Simple Pager\n    @Source(\"images/downArrow.png\")\n    ImageResource downArrow();\n\n    //Simple Pager\n    @Source(\"images/smallDownArrow.png\")\n    ImageResource smallDownArrow();\n\n    //Simple Pager\n    @Source(\"images/upArrow.png\")\n    ImageResource upArrow();\n\n    //Simple Pager\n    @Source(\"images/smallUpArrow.png\")\n    ImageResource smallUpArrow();\n\n    //Simple Pager\n    @Source(\"images/columnPicker.png\")\n    ImageResource columnPicker();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/CommonResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface CommonResources\n        extends\n        ClientBundle {\n\n    CommonResources INSTANCE = GWT.create(CommonResources.class);\n\n    @Source(\"css/common.css\")\n    CommonCss CSS();\n\n    CommonImages images();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/HtmlEditorResources.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\npublic interface HtmlEditorResources extends ClientBundle {\n\n    HtmlEditorResources INSTANCE = GWT.create(HtmlEditorResources.class);\n\n    @Source({\"js/wysihtml/wysihtml.min.js\"})\n    TextResource wysihtml();\n\n    @Source({\"js/wysihtml/wysihtml.all-commands.min.js\"})\n    TextResource wysihtmlAllCommands();\n\n    @Source({\"js/wysihtml/wysihtml.table_editing.min.js\"})\n    TextResource wysihtmlTableEditing();\n\n    @Source({\"js/wysihtml/wysihtml.toolbar.min.js\"})\n    TextResource wysihtmlToolbar();\n\n    @Source({\"js/wysihtml/parser_rules/advanced_and_extended.js\"})\n    TextResource parserRules();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n *\n */\npublic interface CommonConstants\n        extends Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String OK();\n\n    String YES();\n\n    String NO();\n\n    String Information();\n\n    String Close();\n\n    String Error();\n\n    String Warning();\n\n    String ShowDetail();\n\n    String AbstractTableOpen();\n\n    String AbstractTablePleaseSelectAnItemToDelete();\n\n    String AbstractTableRefreshList();\n\n    String AbstractTableOpenSelected();\n\n    String AbstractTableFileURI();\n\n    String ReOpen();\n\n    String Ignore();\n\n    String ForceSave();\n\n    String Cancel();\n\n    String ConcurrentIssue();\n\n    String ConcurrentUpdate(String identity,\n                            String pathURI);\n\n    String ConcurrentRename(String identity,\n                            String sourceURI,\n                            String targetURI);\n\n    String ConcurrentDelete(String identity,\n                            String pathURI);\n\n    String ChooseFile();\n\n    String Upload();\n\n    String More();\n\n    String Active();\n\n    String ExceptionInvalidPath();\n\n    String ExceptionFileAlreadyExists0(final String uri);\n\n    String ExceptionNoSuchFile0(final String uri);\n\n    String ExceptionSecurity0(final String uri);\n\n    String ExceptionGeneric0(final String message);\n\n    String ItemDeletedSuccessfully();\n\n    String DeletePopupTitle();\n\n    String DeletePopupDelete();\n\n    String Version();\n\n    String Items();\n\n    String ColorPickerTitle();\n\n    String Add_New_Filter();\n\n    String Filter_parameters();\n\n    String Filter_Management();\n\n    String Filter_Name();\n\n    String Filter_Must_Have_A_Name();\n\n    String RemoveFilter();\n\n    String CustomFilters();\n\n    String NoCustomFilterAvailable();\n\n    String Refresh();\n\n    String ColumnPickerButtonTooltip();\n\n    String PageSizeSelectorTooltip();\n\n    String Reset();\n\n    String Actions();\n\n    String Basic_Properties();\n\n    String ClickToDisplay0(final String resourceGroup);\n\n    String RemoveTabTitle();\n\n    String RemoveTabConfirm(String tabName);\n\n    String AutoRefresh();\n\n    String Disable_autorefresh();\n\n    String Autorefresh_Disabled();\n\n    String Minutes();\n\n    String Minute();\n\n    String liveSearchHint();\n\n    String liveSearchSelectorHint();\n\n    String liveSearchNotFoundMessage();\n\n    String liveSearchElementsSelected(int elements);\n\n    String liveSearchNewEntry();\n\n    String liveSearchClearSelectionMessage();\n\n    String liveSearchResetSelectionMessage();\n\n    String PerspectiveSelectHint();\n\n    String PerspectiveSearchHint();\n\n    String PerspectiveNotFound();\n\n    String by();\n\n    String on();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/NullSelectOption.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\npublic class NullSelectOption implements SelectOption {\n\n    @Override\n    public String getSelector() {\n        return \"NONE\";\n    }\n\n    @Override\n    public String getName() {\n        return \"None\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectComponent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport java.util.stream.Collectors;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.client.mvp.UberElemental;\n\npublic class SelectComponent {\n\n    private View view;\n    private ManagedInstance<SelectOptionComponent> selectOptionWidget;\n    private SelectOption selected;\n    private Consumer<SelectOption> callback;\n    private List<SelectOptionComponent> components;\n\n    @Inject\n    public SelectComponent(final View view,\n                           final ManagedInstance<SelectOptionComponent> selectOptionComponent) {\n        this.view = view;\n        this.selectOptionWidget = selectOptionComponent;\n    }\n\n    @PostConstruct\n    public void init() {\n        this.view.init(this);\n    }\n\n    public void setup(List<SelectOption> options,\n                      Consumer<SelectOption> selectCallback) {\n        this.setSelected(getFirstSelectOption(options));\n        this.setSelectOptions(options);\n        this.callback = selectCallback;\n    }\n\n    private SelectOption getFirstSelectOption(List<SelectOption> options) {\n        return !options.isEmpty() ? options.get(0) : new NullSelectOption();\n    }\n\n    protected void setSelectOptions(List<SelectOption> options) {\n        this.view.clear();\n        this.components = new ArrayList<>();\n        components.addAll(options.stream().map(this::createSelectedOptionComponent).collect(Collectors.toList()));\n        this.view.addOptions(components);\n    }\n\n    protected SelectOptionComponent createSelectedOptionComponent(SelectOption selectOption) {\n        SelectOptionComponent component = this.selectOptionWidget.get();\n        component.initialize(selectOption,\n                             selected -> {\n                                 this.deactivateAll();\n                                 component.activate();\n                                 this.setSelected(selected);\n                                 this.callback.accept(selected);\n                             });\n        return component;\n    }\n\n    protected void deactivateAll() {\n        this.components.forEach(SelectOptionComponent::deactivate);\n    }\n\n    public void setSelected(SelectOption selected) {\n        this.selected = selected;\n        this.update();\n    }\n\n    private void update() {\n        this.view.setSelected(this.selected.getName());\n    }\n\n    public SelectOption getSelected() {\n        return this.selected;\n    }\n\n    public View getView() {\n        return this.view;\n    }\n\n    public interface View extends UberElemental<SelectComponent> {\n\n        void addOption(SelectOptionComponent selectOptionComponent);\n\n        void setSelected(String label);\n\n        void addOptions(List<SelectOptionComponent> components);\n\n        void clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOption.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\npublic interface SelectOption {\n\n    String getSelector();\n\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionComponent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport java.util.function.Consumer;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElemental;\n\npublic class SelectOptionComponent {\n\n    private View view;\n    private SelectOption selectOption;\n    private Consumer<SelectOption> callback;\n\n    @Inject\n    public SelectOptionComponent(final View view) {\n        this.view = view;\n    }\n\n    public void initialize(SelectOption selectOption,\n                           Consumer<SelectOption> callback) {\n        this.view.init(this);\n        this.selectOption = selectOption;\n        this.callback = callback;\n        this.view.setName(selectOption.getName());\n    }\n\n    public void select() {\n        this.callback.accept(selectOption);\n    }\n\n    public void activate() {\n        this.view.setActive(true);\n    }\n\n    public void deactivate() {\n        this.view.setActive(false);\n    }\n\n    public View getView() {\n        return this.view;\n    }\n\n    public interface View extends UberElemental<SelectOptionComponent> {\n\n        void setName(String name);\n\n        void setActive(boolean isActive);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\npublic class SelectOptionImpl implements SelectOption {\n\n    private final String selector;\n    private final String name;\n\n    public SelectOptionImpl(String selector,\n                            String name) {\n\n        this.selector = checkNotEmpty(\"selector\",\n                                      selector).toUpperCase();\n        this.name = name;\n    }\n\n    public String getSelector() {\n        return selector;\n    }\n\n    public String getName() {\n        if (this.name == null || this.name.isEmpty()) {\n            return this.selector;\n        } else {\n            return this.name;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~  \n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~  \n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~  \n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<li data-field=\"selector\"><a href=\"#\" data-field=\"option\"></a></li>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectOptionView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLLIElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectOptionView implements SelectOptionComponent.View,\n                                         IsElement {\n\n    @Inject\n    @DataField(\"selector\")\n    private HTMLLIElement selector;\n\n    @Inject\n    @DataField(\"option\")\n    private HTMLAnchorElement option;\n\n    private SelectOptionComponent presenter;\n\n    @Override\n    public void init(SelectOptionComponent presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setName(String name) {\n        this.option.textContent = name;\n    }\n\n    @Override\n    public void setActive(boolean isActive) {\n        this.selector.classList.remove(\"selected\");\n        if (isActive) {\n            this.selector.classList.add(\"selected\");\n        }\n    }\n\n    @EventHandler(\"option\")\n    public void onClick(ClickEvent clickEvent) {\n        this.presenter.select();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  ~\n  -->\n\n<div id=\"content\">\n    <button type=\"button\" class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">\n        <span data-field=\"selected\"></span><span class=\"caret\"></span></button>\n    <ul data-field=\"options\" class=\"dropdown-menu\"></ul>\n</div>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/select/SelectView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport java.util.List;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SelectView implements SelectComponent.View,\n                                   IsElement {\n\n    private SelectComponent presenter;\n\n    @Inject\n    @Named(\"span\")\n    @DataField(\"selected\")\n    private HTMLElement selected;\n\n    @Inject\n    @DataField(\"options\")\n    private HTMLUListElement options;\n\n    @Override\n    public void init(SelectComponent presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void addOption(SelectOptionComponent selectOptionComponent) {\n        this.options.appendChild(selectOptionComponent.getView().getElement());\n    }\n\n    @Override\n    public void setSelected(String label) {\n        this.selected.textContent = label;\n    }\n\n    @Override\n    public void addOptions(List<SelectOptionComponent> components) {\n        components.forEach(this::addOption);\n    }\n\n    @Override\n    public void clear() {\n        this.options.textContent = \"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/ColumnPicker.java",
    "content": "/*\n * Copyright 2019 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\nimport org.uberfire.ext.services.shared.preferences.GridColumnPreference;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.table.client.ColumnMeta;\nimport org.uberfire.ext.widgets.table.client.UberfireColumnPicker;\n\npublic class ColumnPicker<T> extends UberfireColumnPicker<T> {\n\n    public static int DETAULT_COLUMN_WIDTH = 120;\n    private GridPreferencesStore gridPreferences;\n    private Optional<String> columnZeroWidth = Optional.empty();\n    private int dataGridMinWidth = 0;\n    private int defaultColumnWidthSize = DETAULT_COLUMN_WIDTH;\n\n    public ColumnPicker(DataGrid<T> dataGrid,\n                        GridPreferencesStore gridPreferences) {\n        super(dataGrid);\n        this.gridPreferences = gridPreferences;\n    }\n\n    public ColumnPicker(DataGrid<T> dataGrid) {\n        super(dataGrid);\n    }\n\n    protected void sortAndAddColumns(List<ColumnMeta<T>> columnMetas) {\n        updateColumnsMeta(columnMetas);\n        super.sortAndAddColumns(columnMetas);\n    }\n\n    private void updateColumnsMeta(List<ColumnMeta<T>> columnMetas) {\n        for (ColumnMeta meta : columnMetas) {\n            checkColumnMeta(meta);\n        }\n    }\n\n    protected void checkColumnMeta(ColumnMeta<T> columnMeta) {\n        if (gridPreferences != null) {\n            List<GridColumnPreference> columnPreferences = gridPreferences.getColumnPreferences();\n            if (!columnPreferences.isEmpty()) {\n                boolean found = false;\n                for (int i = 0; i < gridPreferences.getColumnPreferences().size() && !found; i++) {\n                    GridColumnPreference gcp = gridPreferences.getColumnPreferences().get(i);\n                    if (gcp.getName().equals(getColumnStoreName(columnMeta))) {\n                        columnMeta.setVisible(true);\n                        if (gcp.getWidth() != null) {\n                            dataGrid.setColumnWidth(columnMeta.getColumn(),\n                                                    gcp.getWidth());\n                        } else {\n                            dataGrid.setColumnWidth(columnMeta.getColumn(),\n                                                    100,\n                                                    Style.Unit.PCT);\n                        }\n                        columnMeta.setPosition(gcp.getPosition());\n                        found = true;\n                    }\n                }\n                if (!found) {\n                    columnMeta.setPosition(-1);\n                    columnMeta.setVisible(false);\n                }\n            } else if (gridPreferences.getGlobalPreferences() != null) {\n                int position = gridPreferences.getGlobalPreferences().getInitialColumns()\n                        .indexOf(getColumnStoreName(columnMeta));\n                if (position != -1) {\n                    columnMeta.setVisible(true);\n                    columnMeta.setPosition(position);\n                } else {\n                    columnMeta.setPosition(-1);\n                    columnMeta.setVisible(false);\n                }\n            }\n        }\n    }\n\n    public void setGridPreferencesStore(GridPreferencesStore gridPreferences) {\n        this.gridPreferences = gridPreferences;\n    }\n\n    protected void addResetButtom(final int left,\n                                  final int top,\n                                  VerticalPanel popupContent) {\n        if (gridPreferences != null) {\n            Button resetButton = GWT.create(Button.class);\n            resetButton.setText(CommonConstants.INSTANCE.Reset());\n            resetButton.setSize(ButtonSize.EXTRA_SMALL);\n            resetButton.addClickHandler(event -> resetTableColumns(left,\n                                                                   top));\n\n            popupContent.add(resetButton);\n        }\n    }\n\n    protected boolean addThisColumnToPopup(ColumnMeta<T> columnMeta) {\n        return gridPreferences == null || !gridPreferences.getGlobalPreferences()\n                .getBannedColumns().contains(getColumnStoreName(columnMeta));\n    }\n\n    protected void loadGlobalGridPreferences() {\n        gridPreferences.resetGridColumnPreferences();\n        for (final ColumnMeta<T> columnMeta : columnMetaList) {\n            int position = gridPreferences.getGlobalPreferences().getInitialColumns()\n                    .indexOf(getColumnStoreName(columnMeta));\n            columnMeta.setPosition(position);\n            columnMeta.setVisible(position > -1);\n        }\n    }\n\n    public List<GridColumnPreference> getColumnsState() {\n        List<GridColumnPreference> state = new ArrayList<GridColumnPreference>();\n        for (final ColumnMeta<T> cm : columnMetaList) {\n            if (cm.isVisible()) {\n                state.add(new GridColumnPreference(getColumnStoreName(cm),\n                                                   dataGrid.getColumnIndex(cm.getColumn()),\n                                                   dataGrid.getColumnWidth(cm.getColumn())));\n            }\n        }\n        return state;\n    }\n\n    public void adjustColumnWidths() {\n        super.adjustColumnWidths();\n        List<GridColumnPreference> preferences = getColumnsState();\n\n        if (preferences.isEmpty()) {\n            return;\n        }\n\n        // If there's only 1 column then set it's width to 100%. However store the original 'requested' preferences\n        // in case a 2nd or 3rd etc column is added and we then need to revert to the 'requested' width\n        if (preferences.size() == 1) {\n            columnZeroWidth = Optional.of(preferences.get(0).getWidth());\n            dataGrid.setColumnWidth(dataGrid.getColumn(0),\n                                    100,\n                                    Style.Unit.PCT);\n            dataGridMinWidth = defaultColumnWidthSize;\n            return;\n        }\n\n        //So.. more than one column; we best restore column zero's original 'requested' width\n        columnZeroWidth.ifPresent(w -> {\n            preferences.get(0).setWidth(w);\n            columnZeroWidth = Optional.empty();\n        });\n\n        int fixedColumnsWidth = 0;\n        Map<String, String> fixedWidths = new HashMap<String, String>();\n        List<String> columnsToCalculate = new ArrayList<String>();\n\n        for (GridColumnPreference preference : preferences) {\n            if (preference.getWidth() != null && preference.getWidth().endsWith(Style.Unit.PX.getType())) {\n                String width = preference.getWidth().substring(0,\n                                                               preference.getWidth().indexOf(Style.Unit.PX.getType()));\n                if (width.contains(\".\")) {\n                    width = width.substring(0,\n                                            width.indexOf(\".\"));\n                }\n\n                fixedWidths.put(preference.getName(),\n                                width + Style.Unit.PX.getType());\n\n                fixedColumnsWidth += Integer.decode(width);\n            } else {\n                columnsToCalculate.add(preference.getName());\n            }\n        }\n\n        if (columnsToCalculate.size() > 0) {\n\n            double columnPCT = (100 / columnsToCalculate.size());\n\n            if (dataGrid.getOffsetWidth() != 0) {\n                int availableColumnSpace = dataGrid.getOffsetWidth() - fixedColumnsWidth;\n                double availablePCT = availableColumnSpace * 100 / dataGrid.getOffsetWidth();\n                columnPCT = columnPCT * availablePCT / 100;\n            }\n\n            for (ColumnMeta<T> cm : columnMetaList) {\n                if (cm.isVisible()) {\n                    if (columnsToCalculate.contains(getColumnStoreName(cm))) {\n                        dataGrid.setColumnWidth(cm.getColumn(),\n                                                columnPCT,\n                                                Style.Unit.PCT);\n                    } else {\n                        dataGrid.setColumnWidth(cm.getColumn(),\n                                                fixedWidths.get(getColumnStoreName(cm)));\n                    }\n                }\n            }\n        }\n        dataGridMinWidth = fixedColumnsWidth + columnsToCalculate.size() * defaultColumnWidthSize;\n    }\n\n    public int getDataGridMinWidth() {\n        return this.dataGridMinWidth;\n    }\n\n    public void setDefaultColumnWidthSize(int defaultColumnSize) {\n        this.defaultColumnWidthSize = defaultColumnSize;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/ComparableImageResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.user.client.ui.Image;\n\npublic class ComparableImageResource implements Comparable<ComparableImageResource> {\n\n    private final String format;\n    private final Image imageResource;\n\n    public ComparableImageResource(String format,\n                                   Image imageResource) {\n        this.format = format;\n        this.imageResource = imageResource;\n    }\n\n    public String getImageHTML() {\n        return this.imageResource.toString();\n    }\n\n    public int compareTo(ComparableImageResource o) {\n        return format.compareTo(o.format);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/ComparableImageResourceCell.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.cell.client.AbstractCell;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\n\npublic class ComparableImageResourceCell extends AbstractCell<ComparableImageResource> {\n\n    @Override\n    public void render(Context context,\n                       ComparableImageResource value,\n                       SafeHtmlBuilder sb) {\n        if (value != null) {\n            // The template will sanitize the URI.\n            sb.append(SafeHtmlUtils.fromTrustedString(value.getImageHTML()));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/DataGridFilter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport org.uberfire.mvp.Command;\n\npublic class DataGridFilter<T> implements Comparable {\n\n    private String key;\n    private Command filterCommand;\n\n    public DataGridFilter(String key,\n                          Command filterCommand) {\n        this.key = key;\n        this.filterCommand = filterCommand;\n    }\n\n    public DataGridFilter(String key,\n                          String filterName,\n                          Command filterCommand) {\n        this.key = key;\n        this.filterCommand = filterCommand;\n    }\n\n    public String getKey() {\n        return key;\n    }\n\n    public void setKey(String key) {\n        this.key = key;\n    }\n\n    public Command getFilterCommand() {\n        return filterCommand;\n    }\n\n    public void setFilterCommand(Command filterCommand) {\n        this.filterCommand = filterCommand;\n    }\n\n    @Override\n    public int compareTo(Object o) {\n        if (!(o instanceof DataGridFilter)) {\n            return 0;\n        }\n        DataGridFilter otherFilter = (DataGridFilter) o;\n        if (key != null && key.trim().equals(otherFilter.getKey())) {\n            return 0;\n        } else {\n            return -1;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/FilterPagedTable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.TabShowEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\nimport org.gwtbootstrap3.client.ui.*;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.ext.services.shared.preferences.MultiGridPreferencesStore;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesService;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.tables.popup.NewTabFilterPopup;\nimport org.uberfire.mvp.Command;\n\n/**\n * Widget that shows rows of paged data.\n */\npublic class FilterPagedTable<T>\n        extends Composite {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    public Command refreshGridCommand;\n    protected MultiGridPreferencesStore multiGridPreferencesStore;\n    @UiField\n    NavTabs navTabs;\n    @UiField\n    TabContent tabContent;\n    private HashMap<String, DataGridFilter> dataGridFilterHashMap = new HashMap<String, DataGridFilter>();\n    @Inject\n    private Caller<UserPreferencesService> preferencesService;\n\n    public FilterPagedTable() {\n\n    }\n\n    public FilterPagedTable(MultiGridPreferencesStore gridsPreferences) {\n        this.multiGridPreferencesStore = gridsPreferences;\n    }\n\n    public void removeTab(String gridKey) {\n        int index = getGridIndex(gridKey);\n        if (index != -1) {\n\n            dataGridFilterHashMap.remove(gridKey);\n\n            removeTab(index);\n            multiGridPreferencesStore.removeTab(gridKey);\n            multiGridPreferencesStore.setSelectedGrid(\"\");\n            if (navTabs.getWidgetCount() > 1) {\n                selectTab(index == 0 ? 0 : index - 1);\n            }\n            preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n        }\n    }\n\n    public String getValidKeyForAdditionalListGrid(String baseName) {\n        int i;\n        for (i = dataGridFilterHashMap.size(); dataGridFilterHashMap.get(baseName + i) != null; i++) {\n        }\n        return baseName + i;\n    }\n\n    public void createNewTab(PagedTable<T> pagedTable,\n                             final String key,\n                             Button button,\n                             Command filterCommand) {\n        multiGridPreferencesStore.setSelectedGrid(key);\n        preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n\n        if (navTabs.getWidgetCount() > 0) {\n            removeTab(navTabs.getWidgetCount() - 1);\n        }\n\n        addTab(pagedTable,\n               key,\n               filterCommand);\n\n        addAddTableButton(button);\n        selectTab(dataGridFilterHashMap.size() - 1);\n    }\n\n    public void addTab(final PagedTable<T> grid,\n                       final String key,\n                       final Command filterCommand) {\n        addTab(grid, key, filterCommand, true);\n    }\n\n    public void addTab(final PagedTable<T> grid,\n                       final String key,\n                       final Command filterCommand,\n                       final boolean selectTab) {\n\n        dataGridFilterHashMap.put(key,\n                                  new DataGridFilter(key,\n                                                     filterCommand));\n\n        final String gridHeader = multiGridPreferencesStore.getGridSettingParam(key,\n                                                                                NewTabFilterPopup.FILTER_TAB_NAME_PARAM);\n        final String gridTitle = multiGridPreferencesStore.getGridSettingParam(key,\n                                                                               NewTabFilterPopup.FILTER_TAB_DESC_PARAM);\n        final String safeHtmlGridHeader = (gridHeader != null ? SafeHtmlUtils.htmlEscape(gridHeader) : \"\");\n        final String safeHtmlGridTitle = (gridTitle != null ? SafeHtmlUtils.htmlEscape(gridTitle) : \"\");\n\n        grid.addTableTitle(safeHtmlGridTitle);\n\n        Button close = null;\n        if (!\"base\".equals(key)) {\n            close = GWT.create(Button.class);\n            close.setType(ButtonType.LINK);\n            close.setIcon(IconType.TIMES);\n            close.setSize(ButtonSize.EXTRA_SMALL);\n            close.setTitle(CommonConstants.INSTANCE.Close() + \" \" + gridHeader);\n            close.getElement().getStyle().setVerticalAlign(Style.VerticalAlign.TEXT_TOP);\n            close.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    getYesNoCancelPopup(safeHtmlGridHeader,\n                                        key).show();\n                }\n            });\n        }\n\n        addContentTab(gridHeader,\n                      close,\n                      grid,\n                      key);\n\n        if(selectTab) {\n            selectTab(dataGridFilterHashMap.size() - 1);\n        }\n    }\n\n    protected YesNoCancelPopup getYesNoCancelPopup(final String gridHeader,\n                                                   final String key) {\n        return YesNoCancelPopup.newYesNoCancelPopup(CommonConstants.INSTANCE.RemoveTabTitle(),\n                                                    CommonConstants.INSTANCE.RemoveTabConfirm(gridHeader),\n                                                    new Command() {\n                                                        @Override\n                                                        public void execute() {\n                                                            removeTab(key);\n                                                        }\n                                                    },\n                                                    null,\n                                                    new Command() {\n                                                        @Override\n                                                        public void execute() {\n                                                        }\n                                                    });\n    }\n\n    public void addAddTableButton(Button addTableButton) {\n        addContentTab(null,\n                      addTableButton,\n                      GWT.<HTML>create(HTML.class),\n                      null);\n    }\n\n    public Widget makeWidget() {\n        return uiBinder.createAndBindUi(this);\n    }\n\n    public MultiGridPreferencesStore getMultiGridPreferencesStore() {\n        return multiGridPreferencesStore;\n    }\n\n    public void setMultiGridPreferencesStore(MultiGridPreferencesStore multiGridPreferencesStore) {\n        this.multiGridPreferencesStore = multiGridPreferencesStore;\n    }\n\n    public void setPreferencesService(Caller<UserPreferencesService> preferencesService) {\n        this.preferencesService = preferencesService;\n    }\n\n    private int getGridIndex(String key) {\n        if (key == null) {\n            return -1;\n        }\n        ArrayList<String> tabsId = multiGridPreferencesStore.getGridsId();\n        for (int i = 0; i < tabsId.size(); i++) {\n            if (key.equals(tabsId.get(i))) {\n                return i;\n            }\n        }\n        return -1;\n    }\n\n    public void setSelectedTab() {\n        int selectedTab = getGridIndex(getMultiGridPreferencesStore().getSelectedGrid());\n        if (selectedTab != -1) {\n            selectTab(selectedTab);\n        } else {\n            selectTab(0);\n        }\n    }\n\n    public void saveTabSettings(String key,\n                                HashMap<String, Object> params) {\n        multiGridPreferencesStore.setGridSettings(key,\n                                                  params);\n        preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n    }\n\n    public void saveNewTabSettings(String key,\n                                   HashMap<String, Object> params) {\n        multiGridPreferencesStore.addNewTab(key,\n                                            params);\n        preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n    }\n\n    public void saveNewRefreshInterval(int newValue) {\n        multiGridPreferencesStore.setRefreshInterval(newValue);\n        preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n    }\n\n    public int getRefreshInterval() {\n        return multiGridPreferencesStore.getRefreshInterval();\n    }\n\n    public void setRefreshGridCommand(Command refreshGridCommand) {\n        this.refreshGridCommand = refreshGridCommand;\n    }\n\n    private void selectTab(int index) {\n        final TabListItem widget = (TabListItem) navTabs.getWidget(index);\n        if (widget != null) {\n            widget.showTab();\n        }\n    }\n\n    public void removeTab(int index) {\n        if (index < 0) {\n            return;\n        }\n        if (index < navTabs.getWidgetCount()) {\n            navTabs.remove(index);\n        }\n        if (index < tabContent.getWidgetCount()) {\n            tabContent.remove(index);\n        }\n    }\n\n    private void addContentTab(final String title,\n                               final Widget titleWidget,\n                               final Widget content,\n                               final String key) {\n        final TabListItem tabListItem = GWT.create(TabListItem.class);\n        tabListItem.addShowHandler(new TabShowHandler() {\n            @Override\n            public void onShow(TabShowEvent event) {\n                if (key != null) {\n                    multiGridPreferencesStore.setSelectedGrid(key);\n                    preferencesService.call().saveUserPreferences(multiGridPreferencesStore);\n                    dataGridFilterHashMap.get(key).getFilterCommand().execute();\n                }\n            }\n        });\n\n        final TabPane tabPane = GWT.create(TabPane.class);\n        tabPane.add(content);\n\n        tabListItem.setDataTargetWidget(tabPane);\n        if (title != null) {\n            tabListItem.setText(title);\n        }\n        if (titleWidget != null && tabListItem.getWidget(0) instanceof Anchor) {\n            ((Anchor) tabListItem.getWidget(0)).add(titleWidget);\n        }\n        navTabs.add(tabListItem);\n        tabContent.add(tabPane);\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, FilterPagedTable> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/FilterPagedTable.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <b:TabPanel>\n        <b:NavTabs ui:field=\"navTabs\"/>\n        <b:TabContent ui:field=\"tabContent\"/>\n    </b:TabPanel>\n\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/PagedTable.java",
    "content": "/*\n * Copyright 2019 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.AbstractDataProvider;\nimport com.google.gwt.view.client.ProvidesKey;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.extras.select.client.ui.Select;\nimport org.uberfire.ext.services.shared.preferences.GridGlobalPreferences;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.widgets.table.client.UberfireSimplePager;\nimport org.uberfire.ext.widgets.table.client.resources.UFTableResources;\n\n/**\n * Paged Table Widget that stores user preferences.\n * If you doesn't need persist the preferences,\n * take a look at UberfirePagedTable.\n */\npublic class PagedTable<T>\n        extends SimpleTable<T> {\n\n    public static final int DEFAULT_PAGE_SIZE = 10;\n    public static final int HEIGHT_OFFSET_PX = 20;\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    public UberfireSimplePager pager;\n\n    @UiField\n    public Select pageSizesSelector;\n\n    @UiField\n    public Column dataGridContainer;\n\n    @UiField\n    public Column topToolbar;\n\n    protected boolean showPageSizesSelector = false;\n    private int pageSize;\n    private AbstractDataProvider<T> dataProvider;\n    private boolean dataGridMinWidthEnabled = false;\n\n    public PagedTable() {\n        this(DEFAULT_PAGE_SIZE);\n    }\n\n    public PagedTable(final int pageSize) {\n        this(pageSize,\n             null);\n    }\n\n    public PagedTable(final int pageSize,\n                      final ProvidesKey<T> providesKey) {\n        this(pageSize,\n             providesKey,\n             null);\n    }\n\n    public PagedTable(final int pageSize,\n                      final ProvidesKey<T> providesKey,\n                      final GridGlobalPreferences gridGlobalPreferences) {\n        this(pageSize,\n             providesKey,\n             gridGlobalPreferences,\n             false);\n    }\n\n    public PagedTable(final int pageSize,\n                      final ProvidesKey<T> providesKey,\n                      final GridGlobalPreferences gridGlobalPreferences,\n                      final boolean showPageSizesSelector) {\n\n        this(pageSize,\n             providesKey,\n             gridGlobalPreferences,\n             showPageSizesSelector,\n             false,\n             false);\n    }\n\n    public PagedTable(final int pageSize,\n                      final ProvidesKey<T> providesKey,\n                      final GridGlobalPreferences gridGlobalPreferences,\n                      final boolean showPageSizesSelector,\n                      final boolean showFFButton,\n                      final boolean showLButton) {\n        super(providesKey,\n              gridGlobalPreferences);\n        this.showPageSizesSelector = showPageSizesSelector;\n        this.pageSize = pageSize;\n        this.dataGrid.setPageStart(0);\n        this.dataGrid.setPageSize(pageSize);\n        this.pager.setDisplay(dataGrid);\n        this.pageSizesSelector.setVisible(this.showPageSizesSelector);\n        setShowFastFordwardPagerButton(showFFButton);\n        setShowLastPagerButton(showLButton);\n        this.pageSizesSelector.addValueChangeHandler(event -> {\n            storePageSizeInGridPreferences(Integer.parseInt(pageSizesSelector.getValue()));\n            loadPageSizePreferences();\n        });\n        loadPageSizePreferences();\n\n        dataGrid.addRedrawHandler(() -> Scheduler.get().scheduleDeferred(() -> setTableHeight()));\n        dataGrid.getElement().getStyle().setMarginBottom(0,\n                                                         Style.Unit.PX);\n    }\n\n    protected static native int getTableHeight(final JavaScriptObject grid,\n                                               final String headerCss,\n                                               final String contentCss)/*-{\n        var headerHeight = $wnd.jQuery(grid).find(\".\" + headerCss).outerHeight();\n        var contentHeight = $wnd.jQuery(grid).find(\".\" + contentCss).outerHeight();\n        return headerHeight + contentHeight;\n    }-*/;\n\n    @Override\n    protected Widget makeWidget() {\n        return uiBinder.createAndBindUi(this);\n    }\n\n    public AbstractDataProvider<T> getDataProvider() {\n        return dataProvider;\n    }\n\n    public void setDataProvider(final AbstractDataProvider<T> dataProvider) {\n        this.dataProvider = dataProvider;\n        this.dataProvider.addDataDisplay(this);\n    }\n\n    public int getPageSize() {\n        return this.pageSize;\n    }\n\n    public int getPageStart() {\n        return this.pager.getPageStart();\n    }\n\n    public final void loadPageSizePreferences() {\n        pageSize = getPageSizeStored();\n        this.dataGrid.setPageStart(0);\n        this.dataGrid.setPageSize(pageSize);\n        this.pager.setPageSize(pageSize);\n        this.pageSizesSelector.setValue(String.valueOf(pageSize));\n        setTableHeight();\n    }\n\n    protected void setTableHeight() {\n        int base = getTableHeight(dataGrid.getElement(),\n                                  UFTableResources.INSTANCE.CSS().dataGridHeader(),\n                                  UFTableResources.INSTANCE.CSS().dataGridContent());\n        String height = (base + HEIGHT_OFFSET_PX) + \"px\";\n        if (height.equals(dataGrid.getElement().getStyle().getHeight()) == false) {\n            this.dataGrid.setHeight(height);\n            this.dataGrid.redraw();\n        }\n        if (isDataGridMinWidthEnabled()) {\n            dataGridContainer.getElement().setAttribute(\"style\", \"min-width:\" + super.columnPicker.getDataGridMinWidth() + Style.Unit.PX.getType());\n        }\n    }\n\n    public boolean isDataGridMinWidthEnabled() {\n        return dataGridMinWidthEnabled;\n    }\n\n    public void enableDataGridMinWidth(boolean enabled) {\n        this.dataGridMinWidthEnabled = enabled;\n    }\n\n    public void setDefaultColumWidthSize(int defaultColumWidthSize) {\n        super.columnPicker.setDefaultColumnWidthSize(defaultColumWidthSize);\n    }\n\n    public void setShowLastPagerButton(boolean showLastPagerButton) {\n        this.pager.setShowLastPageButton(showLastPagerButton);\n    }\n\n    public void setShowFastFordwardPagerButton(boolean showFastFordwardPagerButton) {\n        this.pager.setShowFastFordwardPageButton(showFastFordwardPagerButton);\n    }\n\n    private void storePageSizeInGridPreferences(int pageSize) {\n        GridPreferencesStore gridPreferencesStore = super.getGridPreferencesStore();\n        if (gridPreferencesStore != null) {\n            gridPreferencesStore.setPageSizePreferences(pageSize);\n            if (isPersistingPreferencesOnChange()) {\n                super.saveGridPreferences();\n            }\n        }\n        this.pageSize = pageSize;\n    }\n\n    private int getPageSizeStored() {\n        GridPreferencesStore gridPreferencesStore = super.getGridPreferencesStore();\n        if (gridPreferencesStore != null) {\n            return gridPreferencesStore.getPageSizePreferences();\n        }\n        return pageSize;\n    }\n\n    public void setPageSizesSelectorDropup(boolean forceDropup,\n                                           boolean dropupAuto) {\n        this.pageSizesSelector.setForceDropup(forceDropup);\n        this.pageSizesSelector.setDropupAuto(dropupAuto);\n    }\n\n    private void resetPageSize() {\n        GridPreferencesStore gridPreferencesStore = super.getGridPreferencesStore();\n\n        if (gridPreferencesStore != null) {\n            gridPreferencesStore.resetPageSizePreferences();\n            storePageSizeInGridPreferences(gridPreferencesStore.getGlobalPreferences().getPageSize());\n            loadPageSizePreferences();\n        }\n    }\n\n    public HasWidgets getTopToolbar() {\n        return topToolbar;\n    }\n\n    protected void setColumnPicker(ColumnPicker columnPicker) {\n        super.columnPicker = columnPicker;\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, PagedTable> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/PagedTable.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2019 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\"\n             xmlns:bh=\"urn:import:org.gwtbootstrap3.client.ui.html\"\n             xmlns:uf=\"urn:import:org.uberfire.ext.widgets.table.client\"\n             xmlns:s=\"urn:import:org.gwtbootstrap3.extras.select.client.ui\">\n\n  <ui:with field=\"i18n\"\n           type=\"org.uberfire.ext.widgets.table.client.resources.i18n.CommonConstants\"/>\n\n  <ui:style>\n    .pagedTableContainer {\n      padding-top: 10px;\n      padding-bottom: 10px;\n    }\n\n    .leftToolBar {\n      float: left;\n      text-align: left\n    }\n\n    .rightToolBar {\n      display: inline;\n      text-align: right;\n    }\n\n    .centerToolBar {\n      text-align: center\n    }\n\n    .pager {\n      margin: 0px;\n    }\n\n    .pager td {\n      padding-top: 0px;\n    }\n\n    .pager-row {\n      padding-top: 5px;\n    }\n\n    .dataGridContainer {\n      overflow: auto;\n    }\n\n  </ui:style>\n\n  <g:FlowPanel addStyleNames=\"{style.pagedTableContainer}\">\n    <b:Row>\n      <b:Column size=\"MD_12\" ui:field=\"topToolbar\"/>\n    </b:Row>\n    <b:Row ui:field=\"toolbarContainer\">\n      <b:Column size=\"MD_4\">\n        <g:FlowPanel width=\"100%\" ui:field=\"leftToolbar\" addStyleNames=\"{style.leftToolBar}\"></g:FlowPanel>\n      </b:Column>\n      <b:Column size=\"MD_4\">\n        <g:FlowPanel width=\"100%\" ui:field=\"centerToolbar\" addStyleNames=\"{style.centerToolBar}\"></g:FlowPanel>\n      </b:Column>\n      <b:Column size=\"MD_4\">\n        <bh:Div ui:field=\"rightToolbar\" pull=\"RIGHT\">\n          <g:FlowPanel width=\"100%\" ui:field=\"rightActionsToolbar\" addStyleNames=\"{style.rightToolBar}\"/>\n          <b:Button ui:field=\"columnPickerButton\" dataToggle=\"BUTTON\" icon=\"COLUMNS\"/>\n        </bh:Div>\n      </b:Column>\n    </b:Row>\n    <b:Row addStyleNames=\"{style.dataGridContainer}\">\n      <b:Column size=\"MD_12\" ui:field=\"dataGridContainer\">\n        <bg:DataGrid ui:field=\"dataGrid\"/>\n      </b:Column>\n    </b:Row>\n    <b:Row addStyleNames=\"{style.pager-row}\">\n      <b:Column size=\"MD_12\">\n        <uf:UberfireSimplePager ui:field=\"pager\" addStyleNames=\"pagination pagination-right pull-right {style.pager}\"/>\n        <s:Select ui:field=\"pageSizesSelector\" width=\"100px\">\n          <s:Option text=\"10 {i18n.Items}\" value=\"10\"/>\n          <s:Option text=\"20 {i18n.Items}\" value=\"20\"/>\n          <s:Option text=\"50 {i18n.Items}\" value=\"50\"/>\n          <s:Option text=\"100 {i18n.Items}\" value=\"100\"/>\n        </s:Select>\n      </b:Column>\n    </b:Row>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/PopoverTextCell.java",
    "content": "/*\n * Copyright 2015 JBoss Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.common.base.Strings;\nimport com.google.gwt.cell.client.AbstractSafeHtmlCell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.text.shared.SimpleSafeHtmlRenderer;\nimport com.google.gwt.user.client.DOM;\nimport org.uberfire.ext.widgets.common.client.resources.CommonCss;\nimport org.uberfire.ext.widgets.common.client.resources.CommonResources;\n\nimport static com.google.gwt.dom.client.BrowserEvents.MOUSEOUT;\nimport static com.google.gwt.dom.client.BrowserEvents.MOUSEOVER;\n\n/**\n * An extension to the normal TextCell that renders a Bootstrap Popover when text overflows.\n */\npublic class PopoverTextCell extends AbstractSafeHtmlCell<String> {\n\n    protected static final CommonCss CSS = CommonResources.INSTANCE.CSS();\n\n    private Placement placement;\n\n    public PopoverTextCell(final Placement placement) {\n        super(SimpleSafeHtmlRenderer.getInstance(),\n              MOUSEOVER,\n              MOUSEOUT);\n        this.placement = placement;\n    }\n\n    public PopoverTextCell() {\n        this(Placement.AUTO);\n    }\n\n    @Override\n    protected void render(Context context,\n                          SafeHtml data,\n                          SafeHtmlBuilder sb) {\n        hideAllPopover();\n        final String content = data.asString();\n        if (Strings.isNullOrEmpty(content)) {\n            return;\n        }\n\n        final Element div = DOM.createDiv();\n        div.setId(DOM.createUniqueId());\n        div.setInnerHTML(content);\n        div.getStyle().setOverflow(Style.Overflow.HIDDEN);\n        div.getStyle().setTextOverflow(Style.TextOverflow.ELLIPSIS);\n        div.getStyle().setWhiteSpace(Style.WhiteSpace.NOWRAP);\n\n        final String html = div.getString();\n        sb.appendHtmlConstant(html);\n\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            @Override\n            public void execute() {\n                initPopover(div.getId(), placement.name().toLowerCase(), CSS.popoverTextBreakWord());\n            }\n        });\n    }\n\n    @Override\n    public void onBrowserEvent(final Context context,\n                               final Element parent,\n                               final String value,\n                               final NativeEvent event,\n                               final ValueUpdater<String> valueUpdater) {\n        super.onBrowserEvent(context,\n                             parent,\n                             value,\n                             event,\n                             valueUpdater);\n\n        final Element element = Element.as(event.getEventTarget());\n\n        if (DivElement.is(element) == false) {\n            return;\n        }\n\n        if (MOUSEOVER.equals(event.getType())) {\n            Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n                @Override\n                public void execute() {\n                    showPopover(parent.getFirstChildElement().getId());\n                }\n            });\n        } else if (MOUSEOUT.equals(event.getType())) {\n            hidePopover(parent.getFirstChildElement().getId());\n        }\n    }\n\n    private native void hideAllPopover() /*-{\n        $wnd.jQuery('.popover').popover('hide');\n    }-*/;\n\n    private native void hidePopover(String id) /*-{\n        $wnd.jQuery('#' + id).popover('hide');\n    }-*/;\n\n    private native void showPopover(String id) /*-{\n        $wnd.jQuery('#' + id).popover('show');\n    }-*/;\n\n    private native void initPopover(String id, String placement, String css) /*-{\n        var jQueryId = '#' + id;\n        var div = $wnd.jQuery(jQueryId);\n        div.popover({\n            trigger: 'manual',\n            placement: placement,\n            html: true,\n            content: function () {\n                var offsetWidth = $wnd.document.getElementById(id).offsetWidth;\n                var scrollWidth = $wnd.document.getElementById(id).scrollWidth;\n\n                return offsetWidth < scrollWidth ? \"<span class='\" + css + \"'>\" + div.html() + \"</span>\" : \"\";\n            },\n            container: 'body'\n        });\n    }-*/;\n\n    public enum Placement {\n\n        LEFT,\n        TOP,\n        AUTO,\n        BOTTOM,\n        RIGHT\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/ResizableHeader.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.cell.client.AbstractCell;\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.Cell.Context;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.dom.client.Style.Cursor;\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.cellview.client.AbstractCellTable;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.Event.NativePreviewEvent;\nimport com.google.gwt.user.client.Event.NativePreviewHandler;\n\npublic class ResizableHeader<T> extends Header<String> {\n\n    private static final int width = 20;\n    private Column<T, ?> column = null;\n    private AbstractCellTable<T> cellTable;\n    private String title = \"\";\n\n    public ResizableHeader(String title,\n                           AbstractCellTable<T> cellTable,\n                           Column<T, ?> column) {\n        super(new HeaderCell());\n        this.title = title;\n        this.cellTable = cellTable;\n        this.column = column;\n    }\n\n    @Override\n    public String getValue() {\n        return title;\n    }\n\n    @Override\n    public void onBrowserEvent(Context context,\n                               Element target,\n                               NativeEvent event) {\n        String eventType = event.getType();\n        if (eventType.equals(\"mousemove\")) {\n            new ColumnResizeHelper<T>(cellTable,\n                                      column,\n                                      target);\n        } else {\n            return;\n        }\n    }\n\n    private void setCursor(Element element,\n                           Cursor cursor) {\n        element.getStyle().setCursor(cursor);\n    }\n\n    static class HeaderCell extends AbstractCell<String> {\n\n        public HeaderCell() {\n            super(\"click\",\n                  \"mousedown\",\n                  \"mousemove\",\n                  \"dblclick\");\n        }\n\n        @Override\n        public void render(Context context,\n                           String value,\n                           SafeHtmlBuilder sb) {\n            sb.append(SafeHtmlUtils.fromString(value));\n        }\n    }\n\n    class ColumnResizeHelper<E> implements NativePreviewHandler {\n\n        private HandlerRegistration handler;\n        private AbstractCellTable<E> table;\n        private Column<E, ?> col;\n        private Element el;\n        private boolean mousedown;\n        private Element measuringElement;\n\n        public ColumnResizeHelper(AbstractCellTable<E> table,\n                                  Column<E, ?> col,\n                                  Element el) {\n            this.el = el;\n            this.table = table;\n            this.col = col;\n            handler = Event.addNativePreviewHandler(this);\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public void onPreviewNativeEvent(NativePreviewEvent event) {\n            NativeEvent nativeEvent = event.getNativeEvent();\n            nativeEvent.preventDefault();\n            nativeEvent.stopPropagation();\n\n            String eventType = nativeEvent.getType();\n            int clientX = nativeEvent.getClientX();\n            if (eventType.equals(\"mousemove\") && mousedown) {\n                int absoluteLeft = el.getAbsoluteLeft();\n                int newWidth = clientX - absoluteLeft;\n                newWidth = newWidth < width ? width : newWidth;\n                table.setColumnWidth(col,\n                                     newWidth + \"px\");\n                return;\n            }\n\n            if (eventType.equals(\"mousemove\") || eventType.equals(\"mousedown\")) {\n                Element eventTargetEl = nativeEvent.getEventTarget().cast();\n                int absoluteLeft = eventTargetEl.getAbsoluteLeft();\n                int offsetWidth = eventTargetEl.getOffsetWidth();\n                if (clientX > absoluteLeft + offsetWidth - width) {\n                    if (eventType.equals(\"mousedown\")) {\n                        mousedown = true;\n                    } else {\n                        setCursor(el,\n                                  Cursor.COL_RESIZE);\n                    }\n                } else {\n                    removeHandler();\n                    return;\n                }\n            } else if (eventType.equals(\"mouseup\")) {\n                mousedown = false;\n            } else if (eventType.equals(\"mouseout\") && !mousedown) {\n                removeHandler();\n                return;\n            }\n\n            if (eventType.equals(\"dblclick\")) {\n                // Get column\n                nativeEvent.preventDefault();\n                nativeEvent.stopPropagation();\n                double max = 0;\n                startMeasuring();\n                for (E t : table.getVisibleItems()) {\n                    Object value = col.getValue(t);\n                    SafeHtmlBuilder sb = new SafeHtmlBuilder();\n                    Cell<Object> cell = (Cell<Object>) col.getCell();\n                    cell.render(null,\n                                value,\n                                sb);\n                    max = Math.max(measureText(sb.toSafeHtml().asString()),\n                                   max);\n                }\n                finishMeasuring();\n                table.setColumnWidth(col,\n                                     (max + width) + \"px\");\n                removeHandler();\n            }\n        }\n\n        private void removeHandler() {\n            handler.removeHandler();\n            setCursor(el,\n                      Cursor.DEFAULT);\n        }\n\n        private void startMeasuring() {\n            Document document = Document.get();\n            measuringElement = document.createElement(\"div\");\n            measuringElement.getStyle().setPosition(Position.ABSOLUTE);\n            measuringElement.getStyle().setLeft(-1000,\n                                                Unit.PX);\n            measuringElement.getStyle().setTop(-1000,\n                                               Unit.PX);\n            document.getBody().appendChild(measuringElement);\n        }\n\n        private double measureText(String text) {\n            measuringElement.setInnerHTML(text);\n            return measuringElement.getOffsetWidth();\n        }\n\n        private void finishMeasuring() {\n            Document.get().getBody().removeChild(measuringElement);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SelectionColumn.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.cell.client.CheckboxCell;\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.cellview.client.Column;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\n\npublic class SelectionColumn<T> extends Column<T, Boolean> {\n\n    private final DataGrid<T> dataGrid;\n\n    public SelectionColumn(DataGrid<T> dataGrid) {\n        super(new CheckboxCell(true,\n                               true));\n        this.dataGrid = dataGrid;\n        addUpdater();\n    }\n\n    public static <T> SelectionColumn<T> createAndAddSelectionColumn(DataGrid<T> dataGrid) {\n        SelectionColumn<T> selectionColumn = new SelectionColumn<T>(dataGrid);\n        dataGrid.addColumn(selectionColumn,\n                           SafeHtmlUtils.fromSafeConstant(\"<br>\"));\n        return selectionColumn;\n    }\n\n    private void addUpdater() {\n        setFieldUpdater(new FieldUpdater<T, Boolean>() {\n            public void update(int index,\n                               T object,\n                               Boolean value) {\n                dataGrid.getSelectionModel().setSelected(object,\n                                                         value);\n            }\n        });\n    }\n\n    public Boolean getValue(T object) {\n        return dataGrid.getSelectionModel().isSelected(object);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SimpleTable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport java.util.List;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.ProvidesKey;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.ext.services.shared.preferences.GridColumnPreference;\nimport org.uberfire.ext.services.shared.preferences.GridGlobalPreferences;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesService;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesType;\nimport org.uberfire.ext.widgets.table.client.ColumnChangedHandler;\nimport org.uberfire.ext.widgets.table.client.UberfireSimpleTable;\n\n/**\n * A composite Widget that shows rows of data (not-paged) and a \"column picker\"\n * to allow columns to be hidden from view. Columns can also be sorted.\n * User preferences are persisted. If you need a client only version\n * of this widget take a look at UberfireSimpleTable.\n */\npublic class SimpleTable<T>\n        extends UberfireSimpleTable<T> {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private GridPreferencesStore gridPreferencesStore;\n    private boolean persistPreferencesOnChange = true;\n\n    @Inject\n    private Caller<UserPreferencesService> preferencesService;\n\n    public SimpleTable() {\n        super();\n    }\n\n    public SimpleTable(final ProvidesKey<T> providesKey) {\n        super(providesKey);\n    }\n\n    public SimpleTable(final ProvidesKey<T> providesKey,\n                       final GridGlobalPreferences gridGlobalPreferences) {\n\n        super(providesKey);\n        if (gridGlobalPreferences != null) {\n            this.gridPreferencesStore = new GridPreferencesStore(gridGlobalPreferences);\n        }\n    }\n\n    public void setPersistPreferencesOnChange(boolean persistPreferencesOnChange) {\n        this.persistPreferencesOnChange = persistPreferencesOnChange;\n    }\n\n    public boolean isPersistingPreferencesOnChange() {\n        return persistPreferencesOnChange;\n    }\n\n    protected void setupColumnPicker() {\n        columnPicker = new ColumnPicker<T>(dataGrid,\n                                           gridPreferencesStore);\n\n        columnPicker.addColumnChangedHandler(new ColumnChangedHandler() {\n\n            @Override\n            public void beforeColumnChanged() {\n            }\n\n            @Override\n            public void afterColumnChanged() {\n                afterColumnChangedHandler();\n            }\n        });\n    }\n\n    protected void afterColumnChangedHandler() {\n        if (gridPreferencesStore != null && preferencesService != null) {\n            List<GridColumnPreference> columnsState = getColumnPicker().getColumnsState();\n            gridPreferencesStore.resetGridColumnPreferences();\n            for (GridColumnPreference gcp : columnsState) {\n                gridPreferencesStore.addGridColumnPreference(gcp);\n            }\n            if (isPersistingPreferencesOnChange()) {\n                saveGridPreferences();\n            }\n        }\n    }\n\n    protected Widget makeWidget() {\n        return uiBinder.createAndBindUi(this);\n    }\n\n    public void setPreferencesService(final Caller<UserPreferencesService> preferencesService) {\n        this.preferencesService = preferencesService;\n    }\n\n    public GridPreferencesStore getGridPreferencesStore() {\n        return this.gridPreferencesStore;\n    }\n\n    public void setGridPreferencesStore(final GridPreferencesStore gridPreferences) {\n        // I need to update my local copy of the preferences \n        //   if I would like to compare with the current state for changes\n        this.gridPreferencesStore = gridPreferences;\n        getColumnPicker().setGridPreferencesStore(gridPreferences);\n    }\n\n    public void saveGridPreferences() {\n        if (gridPreferencesStore != null) {\n            gridPreferencesStore.setPreferenceKey(gridPreferencesStore.getGlobalPreferences().getKey());\n            saveGridToUserPreferences();\n        }\n    }\n\n    public void saveGridToUserPreferences(){\n        if (preferencesService!=null && gridPreferencesStore != null) {\n            gridPreferencesStore.setType(UserPreferencesType.GRIDPREFERENCES);\n            preferencesService.call(response -> {\n            }).saveUserPreferences(gridPreferencesStore);\n        }\n    }\n\n    public void storeColumnToPreferences() {\n        List<GridColumnPreference> columnsState = getColumnPicker().getColumnsState();\n        gridPreferencesStore.resetGridColumnPreferences();\n        for (GridColumnPreference gcp : columnsState) {\n            gridPreferencesStore.addGridColumnPreference(gcp);\n        }\n        saveGridPreferences();\n    }\n\n    protected ColumnPicker getColumnPicker() {\n        return (ColumnPicker) columnPicker;\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, SimpleTable> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SimpleTable.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\">\n\n  <ui:style>\n    .dataGridContainer {\n      padding-top: 10px;\n      padding-bottom: 10px;\n    }\n\n    .horizontalContainer {\n      height: 32px;\n    }\n\n    .rightToolBar {\n      float: right;\n      text-align: right;\n    }\n\n    .centerToolBar {\n      text-align: center\n    }\n  </ui:style>\n\n  <g:FlowPanel addStyleNames=\"{style.dataGridContainer}\">\n    <g:HorizontalPanel ui:field=\"toolbarContainer\" width=\"100%\" addStyleNames=\"{style.horizontalContainer}\">\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"leftToolbar\"/>\n      </g:cell>\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"centerToolbar\" addStyleNames=\"{style.centerToolBar}\"></g:FlowPanel>\n      </g:cell>\n      <g:cell width=\"33%\" horizontalAlignment=\"right\">\n        <g:HorizontalPanel ui:field=\"rightToolbar\">\n          <g:FlowPanel width=\"100%\" ui:field=\"rightActionsToolbar\" addStyleNames=\"{style.rightToolBar}\"/>\n          <b:Button ui:field=\"columnPickerButton\" />\n        </g:HorizontalPanel>\n      </g:cell>\n    </g:HorizontalPanel>\n    <g:SimplePanel>\n      <bg:DataGrid ui:field=\"dataGrid\"/>\n    </g:SimplePanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SortDirection.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\npublic enum SortDirection {\n\n    NONE,\n    ASCENDING,\n    DESCENDING\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SortableHeader.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.ClickableTextCell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\nimport com.google.gwt.user.client.ui.AbstractImagePrototype;\nimport org.uberfire.ext.widgets.common.client.resources.CommonResources;\n\n/**\n * Based on GWT bikeshed example.\n */\npublic class SortableHeader<T, C extends Comparable> extends Header<String> {\n\n    private static final String DOWN_ARROW = makeImage(CommonResources.INSTANCE.images().downArrow());\n    private static final String SMALL_DOWN_ARROW = makeImage(CommonResources.INSTANCE.images().smallDownArrow());\n    private static final String UP_ARROW = makeImage(CommonResources.INSTANCE.images().upArrow());\n    private static final String SMALL_UP_ARROW = makeImage(CommonResources.INSTANCE.images().smallUpArrow());\n    private final SortableHeaderGroup sortableHeaderGroup;\n    private final Column<T, C> column;\n    private String text;\n    private SortDirection sortDirection = SortDirection.NONE;\n    private int sortIndex = -1;\n    public SortableHeader(SortableHeaderGroup sortableHeaderGroup,\n                          String text,\n                          Column<T, C> column) {\n        super(new ClickableTextCell());\n        this.sortableHeaderGroup = sortableHeaderGroup;\n        this.text = text;\n        this.column = column;\n        setUpdater(new ValueUpdater<String>() {\n            public void update(String s) {\n                SortableHeader.this.sortableHeaderGroup.headerClicked(SortableHeader.this);\n            }\n        });\n    }\n\n    private static String makeImage(ImageResource resource) {\n        AbstractImagePrototype prototype = AbstractImagePrototype.create(resource);\n        return prototype.getHTML();\n    }\n\n    /**\n     * @return the header label\n     */\n    public String getValue() {\n        return text;\n    }\n\n    /**\n     * Set the Column header\n     * @param text\n     */\n    public void setValue(String text) {\n        this.text = text;\n    }\n\n    public Column<T, C> getColumn() {\n        return column;\n    }\n\n    public SortDirection getSortDirection() {\n        return sortDirection;\n    }\n\n    public void setSortDirection(SortDirection sortDirection) {\n        this.sortDirection = sortDirection;\n    }\n\n    public int getSortIndex() {\n        return sortIndex;\n    }\n\n    public void setSortIndex(int sortIndex) {\n        this.sortIndex = sortIndex;\n    }\n\n    @Override\n    public void render(Cell.Context context,\n                       SafeHtmlBuilder sb) {\n        sb.appendHtmlConstant(\"<div style='position: relative; cursor: pointer; padding: 0px;'>\");\n        sb.appendHtmlConstant(\"<span style='padding-right: 10px'>\");\n        sb.appendEscaped(text);\n        sb.appendHtmlConstant(\"</span>\");\n        // sb.appendHtmlConstant(\"<div style='position:absolute;right:0px;top:0px;'></div>\");\n        switch (sortDirection) {\n            case NONE:\n                // nothing\n                break;\n            case ASCENDING:\n                sb.appendHtmlConstant(sortIndex == 0 ? UP_ARROW : SMALL_UP_ARROW);\n                break;\n            case DESCENDING:\n                sb.appendHtmlConstant(sortIndex == 0 ? DOWN_ARROW : SMALL_DOWN_ARROW);\n                break;\n            default:\n                throw new IllegalArgumentException(\"Unknown sortDirection (\"\n                                                           + sortDirection\n                                                           + \").\");\n        }\n        sb.appendHtmlConstant(\"</div>\");\n        // sb.appendHtmlConstant(\"<div>\");\n        // sb.appendHtmlConstant(\"</div></div>\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/SortableHeaderGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\n\npublic class SortableHeaderGroup<T extends Comparable> {\n\n    private final DataGrid<T> dataGrid;\n    // TODO change List into Deque after upgrade to java 6\n    private List<SortableHeader<T, ?>> sortOrderList = new LinkedList<SortableHeader<T, ?>>();\n\n    public SortableHeaderGroup(DataGrid<T> dataGrid) {\n        this.dataGrid = dataGrid;\n    }\n\n    public void headerClicked(SortableHeader<T, ?> header) {\n        updateSortOrder(header);\n        dataGrid.redrawHeaders();\n        updateData();\n    }\n\n    private void updateSortOrder(SortableHeader<T, ?> header) {\n        int index = sortOrderList.indexOf(header);\n        if (index == 0) {\n            if (header.getSortDirection() != SortDirection.ASCENDING) {\n                header.setSortDirection(SortDirection.ASCENDING);\n            } else {\n                header.setSortDirection(SortDirection.DESCENDING);\n            }\n        } else {\n            // Remove it if it's already sorted on this header later\n            if (index > 0) {\n                sortOrderList.remove(index);\n            }\n            header.setSortDirection(SortDirection.ASCENDING);\n            // Bring this header to front // Deque.addFirst(sortableHeader)\n            sortOrderList.add(0,\n                              header);\n            // Update sortIndexes\n            int sortIndex = 0;\n            for (SortableHeader<T, ?> sortableHeader : sortOrderList) {\n                sortableHeader.setSortIndex(sortIndex);\n                sortIndex++;\n            }\n        }\n    }\n\n    private void updateData() {\n        // TODO If paging is used, this should be a back-end call with a sorting meta data parameter\n        List<T> displayedItems = new ArrayList<T>(dataGrid.getDisplayedItems());\n        Collections.sort(displayedItems,\n                         new Comparator<T>() {\n                             public int compare(T leftRow,\n                                                T rightRow) {\n                                 for (SortableHeader<T, ?> sortableHeader : sortOrderList) {\n                                     Comparable leftColumnValue = sortableHeader.getColumn().getValue(leftRow);\n                                     Comparable rightColumnValue = sortableHeader.getColumn().getValue(rightRow);\n                                     int comparison = (leftColumnValue == rightColumnValue) ? 0\n                                             : (leftColumnValue == null) ? -1\n                                             : (rightColumnValue == null) ? 1\n                                             : leftColumnValue.compareTo(rightColumnValue);\n                                     if (comparison != 0) {\n                                         switch (sortableHeader.getSortDirection()) {\n                                             case ASCENDING:\n                                                 break;\n                                             case DESCENDING:\n                                                 comparison = -comparison;\n                                                 break;\n                                             default:\n                                                 throw new IllegalStateException(\"Sorting can only be enabled for ASCENDING or\" +\n                                                                                         \" DESCENDING, not sortDirection (\" + sortableHeader.getSortDirection() + \") .\");\n                                         }\n                                         return comparison;\n                                     }\n                                 }\n                                 return leftRow.compareTo(rightRow);\n                             }\n                         });\n        dataGrid.setRowData(0,\n                            displayedItems);\n        dataGrid.redraw();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/TitledTextCell.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.cell.client.AbstractSafeHtmlCell;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.text.shared.SafeHtmlRenderer;\nimport org.uberfire.ext.widgets.common.client.resources.CommonCss;\nimport org.uberfire.ext.widgets.common.client.resources.CommonResources;\n\n/**\n * An extension to the normal TextCell that renders upto two rows of text; one\n * being the title and the other being narrative.\n */\npublic class TitledTextCell extends AbstractSafeHtmlCell<TitledTextCell.TitledText> {\n\n    protected static final CommonCss css = CommonResources.INSTANCE.CSS();\n\n    /**\n     * Constructs a TitledTextCell that uses a\n     * {@link TitledTextSafeHtmlRenderer} to render its text.\n     */\n    public TitledTextCell() {\n        super(TitledTextSafeHtmlRenderer.getInstance());\n    }\n\n    /**\n     * Constructs a TextCell that uses the provided {@link SafeHtmlRenderer} to\n     * render its text.\n     * @param renderer a {@link SafeHtmlRenderer SafeHtmlRenderer<String>} instance\n     */\n    public TitledTextCell(final SafeHtmlRenderer<TitledText> renderer) {\n        super(renderer);\n    }\n\n    @Override\n    public void render(Context context,\n                       SafeHtml value,\n                       SafeHtmlBuilder sb) {\n        if (value != null) {\n            sb.append(value);\n        }\n    }\n\n    /**\n     * Container for the Cell value; consisting of title and description\n     */\n    public static class TitledText\n            implements\n            Comparable<TitledText> {\n\n        private String title;\n        private String description;\n\n        public TitledText(String title,\n                          String description) {\n            this.title = title;\n            this.description = description;\n        }\n\n        public String getTitle() {\n            return title;\n        }\n\n        public String getDescription() {\n            return description;\n        }\n\n        public int compareTo(TitledText o) {\n            return title.compareTo(o.title);\n        }\n    }\n\n    /**\n     * A renderer for TitledText values\n     */\n    public static class TitledTextSafeHtmlRenderer\n            implements\n            SafeHtmlRenderer<TitledText> {\n\n        // Singleton\n        private static TitledTextSafeHtmlRenderer instance;\n\n        private TitledTextSafeHtmlRenderer() {\n        }\n\n        public static TitledTextSafeHtmlRenderer getInstance() {\n            if (instance == null) {\n                instance = new TitledTextSafeHtmlRenderer();\n            }\n            return instance;\n        }\n\n        public SafeHtml render(TitledText object) {\n            boolean bHasDescription = object.description != null && !\"\".equals(object.description);\n\n            if (bHasDescription) {\n                String html = \"<div class='\" + css.titleTextCellContainer() + \"'>\";\n                html = html + \"<div>\" + object.title + \"</div>\";\n                html = html + \"<div class='\" + css.titleTextCellDescription() + \"'>\" + object.description + \"</div>\";\n                html = html + \"</div>\";\n                return SafeHtmlUtils.fromTrustedString(html);\n            } else {\n                String html = \"<div class='\" + css.titleTextCellContainer() + \"'>\";\n                html = html + \"<div>\" + object.title + \"</div>\";\n                html = html + \"</div>\";\n                return SafeHtmlUtils.fromTrustedString(html);\n            }\n        }\n\n        public void render(TitledText object,\n                           SafeHtmlBuilder builder) {\n            builder.append(render(object));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/TitledTextColumn.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.user.cellview.client.Column;\n\n/**\n * A column containing TitleText cells\n * @param <T>\n */\npublic abstract class TitledTextColumn<T> extends Column<T, TitledTextCell.TitledText> {\n\n    /**\n     * Construct a new TitledTextColumn.\n     */\n    public TitledTextColumn() {\n        super(new TitledTextCell());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/popup/DataGridFilterSummary.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables.popup;\n\nimport java.io.Serializable;\n\nimport org.uberfire.paging.AbstractPageRow;\n\npublic class DataGridFilterSummary extends AbstractPageRow implements Serializable {\n\n    private String filterName;\n\n    public DataGridFilterSummary() {\n\n    }\n\n    public DataGridFilterSummary(String filterName) {\n        this.filterName = filterName;\n    }\n\n    public String getFilterName() {\n        return filterName;\n    }\n\n    public void setFilterName(String filterName) {\n        this.filterName = filterName;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/popup/NewFilterPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables.popup;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.cell.client.ActionCell;\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.CompositeCell;\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.cell.client.HasCell;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.AbstractImagePrototype;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasHorizontalAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.ext.widgets.common.client.resources.CommonImages;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\nimport org.uberfire.ext.widgets.table.client.ColumnMeta;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Dependent\npublic class NewFilterPopup extends BaseModal {\n\n    public static String FILTER_NAME_PARAM = \"filterName\";\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final List<FormGroup> filterControlGroups = new ArrayList<FormGroup>();\n    @UiField\n    public TabListItem tabAdd;\n    @UiField\n    public TabListItem tabManagement;\n    @UiField\n    public Form horizontalForm;\n    @UiField\n    public FlowPanel existingFiltersPanel;\n    @UiField\n    public HelpBlock errorMessages;\n    @UiField\n    public FormGroup errorMessagesGroup;\n    protected AsyncDataProvider<DataGridFilterSummary> dataProvider;\n    @UiField\n    TabPane tab1;\n    @UiField\n    TabPane tab2;\n    HashMap formValues = new HashMap();\n    Command refreshFiltersCommand;\n    PagedTable<DataGridFilterSummary> existingFiltersGrid = new PagedTable<DataGridFilterSummary>();\n    @Inject\n    private Event<NotificationEvent> notification;\n    private GridPreferencesStore gridPreferenceStore;\n    private CommonImages images = GWT.create(CommonImages.class);\n\n    public NewFilterPopup() {\n        createProvider();\n\n        initColumns();\n        setTitle(CommonConstants.INSTANCE.Filter_Management());\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(NewFilterPopup.this));\n        }});\n\n        tabAdd.setDataTargetWidget(tab1);\n        tabManagement.setDataTargetWidget(tab2);\n\n        init();\n        final GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(CommonConstants.INSTANCE.OK(),\n                         new Command() {\n                             @Override\n                             public void execute() {\n                                 okButton();\n                             }\n                         },\n                         null,\n                         ButtonType.PRIMARY);\n\n        add(footer);\n    }\n\n    public void show(Command addfilterCommand,\n                     Command refreshFilters,\n                     GridPreferencesStore gridPreferenceStore) {\n        addCreateFilterButton(addfilterCommand);\n        this.refreshFiltersCommand = refreshFilters;\n        this.gridPreferenceStore = gridPreferenceStore;\n        refreshGrid();\n        super.show();\n    }\n\n    private void okButton() {\n        refreshFiltersCommand.execute();\n        closePopup();\n    }\n\n    public void init() {\n\n        horizontalForm.clear();\n        filterControlGroups.clear();\n\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(CommonConstants.INSTANCE.Filter_Name());\n        HTML lab = new HTML(\"<span style=\\\"color:red\\\"> * </span>\" + \"<span style=\\\"margin-right:10px\\\">\" + CommonConstants.INSTANCE.Filter_Name() + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        TextBox fieldTextBox = new TextBox();\n        fieldTextBox.setName(FILTER_NAME_PARAM);\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(fieldTextBox);\n\n        filterControlGroups.add(controlGroup);\n        horizontalForm.add(controlGroup);\n\n        existingFiltersPanel.clear();\n        existingFiltersPanel.add(existingFiltersGrid);\n        existingFiltersGrid.loadPageSizePreferences();\n        existingFiltersGrid.setColumnPickerButtonVisible(false);\n        existingFiltersGrid.setEmptyTableCaption(CommonConstants.INSTANCE.NoCustomFilterAvailable());\n    }\n\n    public void cleanFormValues(List<FormGroup> controlGroups) {\n        formValues = new HashMap();\n        clearErrorMessages();\n        for (FormGroup groupControl : controlGroups) {\n            if (groupControl.getWidget(1) instanceof TextBox) {\n                ((TextBox) groupControl.getWidget(1)).setText(\"\");\n            } else if (groupControl.getWidget(1) instanceof ListBox) {\n                ListBox listBox = (ListBox) groupControl.getWidget(1);\n                listBox.setSelectedIndex(-1);\n            }\n        }\n    }\n\n    public void closePopup() {\n        cleanFormValues(filterControlGroups);\n        hide();\n        super.hide();\n    }\n\n    private boolean validateForm() {\n        boolean valid = true;\n        clearErrorMessages();\n        String filterName = (String) formValues.get(FILTER_NAME_PARAM);\n        if (filterName == null || filterName.trim().length() == 0) {\n            errorMessages.setText(CommonConstants.INSTANCE.Filter_Must_Have_A_Name());\n            errorMessagesGroup.setValidationState(ValidationState.ERROR);\n            valid = false;\n        } else {\n            errorMessages.setText(\"\");\n            errorMessagesGroup.setValidationState(ValidationState.NONE);\n        }\n        return valid;\n    }\n\n    public void getFormValues(List<FormGroup> controlGroups) {\n        formValues = new HashMap();\n\n        for (FormGroup groupControl : controlGroups) {\n            if (groupControl.getWidget(1) instanceof TextBox) {\n                formValues.put(((TextBox) groupControl.getWidget(1)).getName(),\n                               ((TextBox) groupControl.getWidget(1)).getValue());\n            } else if (groupControl.getWidget(1) instanceof ListBox) {\n                ListBox listBox = (ListBox) groupControl.getWidget(1);\n\n                List<String> selectedValues = new ArrayList<String>();\n                for (int i = 0; i < listBox.getItemCount(); i++) {\n                    if (listBox.isItemSelected(i)) {\n                        selectedValues.add(listBox.getValue(i));\n                    }\n                }\n\n                formValues.put(listBox.getName(),\n                               selectedValues);\n            }\n        }\n    }\n\n    private void clearErrorMessages() {\n        errorMessages.setText(\"\");\n    }\n\n    public HashMap getFormValues() {\n        return formValues;\n    }\n\n    public void addListBoxToFilter(String label,\n                                   String fieldName,\n                                   boolean multiselect,\n                                   HashMap<String, String> listBoxInfo) {\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(label);\n        HTML lab = new HTML(\"<span style=\\\"margin-right:10px\\\">\" + label + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        ListBox listBox = new ListBox(multiselect);\n        if (listBoxInfo != null) {\n            Set listBoxKeys = listBoxInfo.keySet();\n            Iterator it = listBoxKeys.iterator();\n            String key;\n            while (it.hasNext()) {\n                key = (String) it.next();\n                listBox.addItem(listBoxInfo.get(key),\n                                key);\n            }\n        }\n        listBox.setName(fieldName);\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(listBox);\n\n        filterControlGroups.add(controlGroup);\n        horizontalForm.add(controlGroup);\n    }\n\n    public void addTextBoxToFilter(String label,\n                                   String fieldName) {\n        addTextBoxToFilter(label,\n                           fieldName,\n                           \"\");\n    }\n\n    public void addTextBoxToFilter(String label,\n                                   String fieldName,\n                                   String defaultValue) {\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(label);\n        HTML lab = new HTML(\"<span style=\\\"margin-right:10px\\\">\" + label + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        TextBox textBox = new TextBox();\n        textBox.setName(fieldName);\n        if (defaultValue != null && defaultValue.trim().length() > 0) {\n            textBox.setText(defaultValue);\n        }\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(textBox);\n\n        filterControlGroups.add(controlGroup);\n        horizontalForm.add(controlGroup);\n    }\n\n    private void createProvider() {\n        dataProvider = new AsyncDataProvider<DataGridFilterSummary>() {\n\n            @Override\n            protected void onRangeChanged(HasData<DataGridFilterSummary> display) {\n\n                final Range visibleRange = display.getVisibleRange();\n                List<DataGridFilterSummary> currentCustomFilters = getData();\n                dataProvider.updateRowCount(currentCustomFilters.size(),\n                                            true);\n                int endRange;\n                if (visibleRange.getStart() + 5 < currentCustomFilters.size()) {\n\n                    endRange = visibleRange.getStart() + 5;\n                } else {\n                    endRange = currentCustomFilters.size();\n                }\n                dataProvider.updateRowData(visibleRange.getStart(),\n                                           currentCustomFilters.subList(visibleRange.getStart(),\n                                                                        endRange));\n            }\n        };\n        existingFiltersGrid.setDataProvider(dataProvider);\n    }\n\n    private List<DataGridFilterSummary> getData() {\n        List<DataGridFilterSummary> customFilters = new ArrayList<DataGridFilterSummary>();\n        if (gridPreferenceStore != null) {\n            final HashMap storedCustomFilters = gridPreferenceStore.getCustomFilters();\n            if (storedCustomFilters != null && storedCustomFilters.size() > 0) {\n                Set customFilterKeys = storedCustomFilters.keySet();\n                Iterator it = customFilterKeys.iterator();\n                while (it.hasNext()) {\n\n                    final String customFilterName = (String) it.next();\n                    customFilters.add(new DataGridFilterSummary(customFilterName));\n                }\n            }\n        }\n        return customFilters;\n    }\n\n    public void initColumns() {\n\n        com.google.gwt.user.cellview.client.Column descriptionColumn = initDescriptionColumn();\n        com.google.gwt.user.cellview.client.Column actionsColumn = initActionsColumn();\n\n        List<ColumnMeta<DataGridFilterSummary>> columnMetas = new ArrayList<ColumnMeta<DataGridFilterSummary>>();\n\n        columnMetas.add(new ColumnMeta<DataGridFilterSummary>(descriptionColumn,\n                                                              CommonConstants.INSTANCE.Filter_Name()));\n        columnMetas.add(new ColumnMeta<DataGridFilterSummary>(actionsColumn,\n                                                              CommonConstants.INSTANCE.Actions()));\n        existingFiltersGrid.addColumns(columnMetas);\n    }\n\n    private com.google.gwt.user.cellview.client.Column initDescriptionColumn() {\n        // start time\n        com.google.gwt.user.cellview.client.Column<DataGridFilterSummary, String> descriptionColumn = new com.google.gwt.user.cellview.client.Column<DataGridFilterSummary, String>(new TextCell()) {\n            @Override\n            public String getValue(DataGridFilterSummary object) {\n                return object.getFilterName();\n            }\n        };\n        descriptionColumn.setSortable(true);\n        descriptionColumn.setDataStoreName(\"log.filterName\");\n        return descriptionColumn;\n    }\n\n    private com.google.gwt.user.cellview.client.Column initActionsColumn() {\n        List<HasCell<DataGridFilterSummary, ?>> cells = new LinkedList<HasCell<DataGridFilterSummary, ?>>();\n\n        cells.add(new RemoveActionHasCell(\"Remove\",\n                                          new ActionCell.Delegate<DataGridFilterSummary>() {\n                                              @Override\n                                              public void execute(DataGridFilterSummary filter) {\n                                                  gridPreferenceStore.removeCustomFilter(filter.getFilterName());\n                                                  refreshGrid();\n                                              }\n                                          }));\n\n        CompositeCell<DataGridFilterSummary> cell = new CompositeCell<DataGridFilterSummary>(cells);\n        com.google.gwt.user.cellview.client.Column<DataGridFilterSummary, DataGridFilterSummary> actionsColumn = new com.google.gwt.user.cellview.client.Column<DataGridFilterSummary, DataGridFilterSummary>(\n                cell) {\n            @Override\n            public DataGridFilterSummary getValue(DataGridFilterSummary object) {\n                return object;\n            }\n        };\n        return actionsColumn;\n    }\n\n    public void refreshGrid() {\n        HasData<DataGridFilterSummary> next = dataProvider.getDataDisplays().iterator().next();\n        next.setVisibleRangeAndClearData(next.getVisibleRange(),\n                                         true);\n    }\n\n    private void addCreateFilterButton(final Command addfilterCommand) {\n        HorizontalPanel buttonPanel = new HorizontalPanel();\n        buttonPanel.setWidth(\"100%\");\n        buttonPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);\n\n        Button createFilterButton = new Button();\n        createFilterButton.setText(CommonConstants.INSTANCE.Add_New_Filter());\n\n        createFilterButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                getFormValues(filterControlGroups);\n                if (validateForm()) {\n                    addfilterCommand.execute();\n                    refreshGrid();\n                    cleanFormValues(filterControlGroups);\n                    tabAdd.showTab();\n                }\n            }\n        });\n        buttonPanel.add(createFilterButton);\n        horizontalForm.add(buttonPanel);\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, NewFilterPopup> {\n\n    }\n\n    private class RemoveActionHasCell implements HasCell<DataGridFilterSummary, DataGridFilterSummary> {\n\n        private ActionCell<DataGridFilterSummary> cell;\n\n        public RemoveActionHasCell(String text,\n                                   ActionCell.Delegate<DataGridFilterSummary> delegate) {\n            cell = new ActionCell<DataGridFilterSummary>(text,\n                                                         delegate) {\n                @Override\n                public void render(Cell.Context context,\n                                   final DataGridFilterSummary value,\n                                   SafeHtmlBuilder sb) {\n                    AbstractImagePrototype imageProto = AbstractImagePrototype.create(images.close());\n                    SafeHtmlBuilder mysb = new SafeHtmlBuilder();\n                    mysb.appendHtmlConstant(\"<span title='\" + CommonConstants.INSTANCE.RemoveFilter() + \" \" + value.getFilterName() + \"' style='margin-right:5px;'>\");\n                    mysb.append(imageProto.getSafeHtml());\n                    mysb.appendHtmlConstant(\"</span>\");\n                    sb.append(mysb.toSafeHtml());\n                }\n            };\n        }\n\n        @Override\n        public Cell<DataGridFilterSummary> getCell() {\n            return cell;\n        }\n\n        @Override\n        public FieldUpdater<DataGridFilterSummary, DataGridFilterSummary> getFieldUpdater() {\n            return null;\n        }\n\n        @Override\n        public DataGridFilterSummary getValue(DataGridFilterSummary object) {\n            return object;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/popup/NewFilterPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n  <b:TabPanel>\n    <b:NavTabs>\n      <b:TabListItem ui:field=\"tabAdd\" text=\"{i18n.Add_New_Filter}\"/>\n      <b:TabListItem ui:field=\"tabManagement\" active=\"true\" text=\"{i18n.Filter_Management}\"/>\n    </b:NavTabs>\n    <b:TabContent>\n      <b:TabPane ui:field=\"tab1\">\n        <b:Well>\n          <b:FieldSet>\n            <b:FormGroup ui:field=\"errorMessagesGroup\">\n              <b:HelpBlock ui:field=\"errorMessages\"/>\n            </b:FormGroup>\n            <b:Form type=\"HORIZONTAL\" ui:field=\"horizontalForm\"/>\n          </b:FieldSet>\n        </b:Well>\n      </b:TabPane>\n      <b:TabPane ui:field=\"tab2\" active=\"true\">\n        <b:Well>\n          <b:FieldSet>\n            <g:FlowPanel ui:field=\"existingFiltersPanel\"/>\n          </b:FieldSet>\n        </b:Well>\n      </b:TabPane>\n    </b:TabContent>\n  </b:TabPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/popup/NewTabFilterPopup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables.popup;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.services.shared.preferences.MultiGridPreferencesStore;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.ext.widgets.common.client.resources.CommonImages;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Dependent\npublic class NewTabFilterPopup extends BaseModal {\n\n    public static String FILTER_TAB_NAME_PARAM = \"filterTabName\";\n    public static String FILTER_TAB_DESC_PARAM = \"filterTabDesc\";\n    private static Binder uiBinder = GWT.create(Binder.class);\n    private final List<FormGroup> filterControlGroups = new ArrayList<FormGroup>();\n    protected AsyncDataProvider<DataGridFilterSummary> dataProvider;\n    @UiField\n    Form filterForm;\n    @UiField\n    FlowPanel basicTabPanel;\n    @UiField\n    HelpBlock errorMessages;\n    @UiField\n    FormGroup errorMessagesGroup;\n    @UiField\n    TabListItem tabBasic;\n    @UiField\n    TabListItem tabFilter;\n    @UiField\n    TabPane tab1;\n    @UiField\n    TabPane tab2;\n    HashMap formValues = new HashMap();\n    Command addfilterCommand;\n    PagedTable<DataGridFilterSummary> existingFiltersGrid = new PagedTable<DataGridFilterSummary>();\n    @Inject\n    private Event<NotificationEvent> notification;\n    private CommonImages images = GWT.create(CommonImages.class);\n    private MultiGridPreferencesStore multiGridPreferenceStore;\n\n    public NewTabFilterPopup() {\n        setTitle(CommonConstants.INSTANCE.Filter_Management());\n\n        add(new ModalBody() {{\n            add(uiBinder.createAndBindUi(NewTabFilterPopup.this));\n        }});\n\n        tabBasic.setDataTargetWidget(tab1);\n        tabFilter.setDataTargetWidget(tab2);\n\n        init();\n        final GenericModalFooter footer = new GenericModalFooter();\n        footer.addButton(CommonConstants.INSTANCE.Add_New_Filter(),\n                         new Command() {\n                             @Override\n                             public void execute() {\n                                 okButton();\n                             }\n                         },\n                         null,\n                         ButtonType.PRIMARY);\n\n        add(footer);\n    }\n\n    public void show(Command addfilterCommand,\n                     MultiGridPreferencesStore multiGridPreferencesStore) {\n        cleanFormValues(filterControlGroups);\n        this.addfilterCommand = addfilterCommand;\n        this.multiGridPreferenceStore = multiGridPreferencesStore;\n        super.show();\n    }\n\n    private void okButton() {\n        getFormValues(filterControlGroups);\n        if (validateForm()) {\n            addfilterCommand.execute();\n            cleanFormValues(filterControlGroups);\n        }\n        closePopup();\n    }\n\n    public void init() {\n        basicTabPanel.clear();\n        filterControlGroups.clear();\n        filterForm.clear();\n\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(CommonConstants.INSTANCE.Filter_Name());\n        HTML lab = new HTML(\"<span style=\\\"color:red\\\"> * </span>\" + \"<span style=\\\"margin-right:10px\\\">\" + CommonConstants.INSTANCE.Filter_Name() + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        TextBox fieldTextBox = new TextBox();\n        fieldTextBox.setName(FILTER_TAB_NAME_PARAM);\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(fieldTextBox);\n\n        filterControlGroups.add(controlGroup);\n        basicTabPanel.add(controlGroup);\n\n        controlGroup = new FormGroup();\n\n        controlLabel = new FormLabel();\n        controlLabel.setTitle(\"Filter description\");\n        lab = new HTML(\"<span style=\\\"color:red\\\"> * </span>\" + \"<span style=\\\"margin-right:10px\\\">\" + \"Filter description\" + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        fieldTextBox = new TextBox();\n        fieldTextBox.setName(FILTER_TAB_DESC_PARAM);\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(fieldTextBox);\n\n        filterControlGroups.add(controlGroup);\n\n        basicTabPanel.add(controlGroup);\n    }\n\n    public void cleanFormValues(List<FormGroup> controlGroups) {\n        formValues = new HashMap();\n        clearErrorMessages();\n        for (FormGroup groupControl : controlGroups) {\n            if (groupControl.getWidget(1) instanceof TextBox) {\n                ((TextBox) groupControl.getWidget(1)).setText(\"\");\n            } else if (groupControl.getWidget(1) instanceof ListBox) {\n                ListBox listBox = (ListBox) groupControl.getWidget(1);\n                listBox.setSelectedIndex(-1);\n            }\n        }\n    }\n\n    public void closePopup() {\n        cleanFormValues(filterControlGroups);\n        hide();\n        super.hide();\n    }\n\n    private boolean validateForm() {\n        boolean valid = true;\n        clearErrorMessages();\n        String filterName = (String) formValues.get(FILTER_TAB_NAME_PARAM);\n        if (filterName == null || filterName.trim().length() == 0) {\n            errorMessages.setText(CommonConstants.INSTANCE.Filter_Must_Have_A_Name());\n            errorMessagesGroup.setValidationState(ValidationState.ERROR);\n            valid = false;\n        } else {\n            errorMessages.setText(\"\");\n            errorMessagesGroup.setValidationState(ValidationState.NONE);\n        }\n        return valid;\n    }\n\n    public void getFormValues(List<FormGroup> controlGroups) {\n        formValues = new HashMap();\n\n        for (FormGroup groupControl : controlGroups) {\n            if (groupControl.getWidget(1) instanceof TextBox) {\n                formValues.put(((TextBox) groupControl.getWidget(1)).getName(),\n                               ((TextBox) groupControl.getWidget(1)).getValue());\n            } else if (groupControl.getWidget(1) instanceof ListBox) {\n                ListBox listBox = (ListBox) groupControl.getWidget(1);\n\n                List<String> selectedValues = new ArrayList<String>();\n                for (int i = 0; i < listBox.getItemCount(); i++) {\n                    if (listBox.isItemSelected(i)) {\n                        selectedValues.add(listBox.getValue(i));\n                    }\n                }\n\n                formValues.put(listBox.getName(),\n                               selectedValues);\n            }\n        }\n    }\n\n    private void clearErrorMessages() {\n        errorMessages.setText(\"\");\n    }\n\n    public HashMap getFormValues() {\n        return formValues;\n    }\n\n    public void addListBoxToFilter(String label,\n                                   String fieldName,\n                                   boolean multiselect,\n                                   HashMap<String, String> listBoxInfo) {\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(label);\n        HTML lab = new HTML(\"<span style=\\\"margin-right:10px\\\">\" + label + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        ListBox listBox = new ListBox(multiselect);\n        if (listBoxInfo != null) {\n            Set listBoxKeys = listBoxInfo.keySet();\n            Iterator it = listBoxKeys.iterator();\n            String key;\n            while (it.hasNext()) {\n                key = (String) it.next();\n                listBox.addItem(listBoxInfo.get(key),\n                                key);\n            }\n        }\n        listBox.setName(fieldName);\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(listBox);\n\n        filterControlGroups.add(controlGroup);\n        filterForm.add(controlGroup);\n    }\n\n    public void addTextBoxToFilter(String label,\n                                   String fieldName) {\n        addTextBoxToFilter(label,\n                           fieldName,\n                           \"\");\n    }\n\n    public void addTextBoxToFilter(String label,\n                                   String fieldName,\n                                   String defaultValue) {\n        FormGroup controlGroup = new FormGroup();\n\n        FormLabel controlLabel = new FormLabel();\n        controlLabel.setTitle(label);\n        HTML lab = new HTML(\"<span style=\\\"margin-right:10px\\\">\" + label + \"</span>\");\n        controlLabel.setHTML(lab.getHTML());\n\n        TextBox textBox = new TextBox();\n        textBox.setName(fieldName);\n        if (defaultValue != null && defaultValue.trim().length() > 0) {\n            textBox.setText(defaultValue);\n        }\n\n        controlGroup.add(controlLabel);\n        controlGroup.add(textBox);\n\n        filterControlGroups.add(controlGroup);\n        filterForm.add(controlGroup);\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, NewTabFilterPopup> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/java/org/uberfire/ext/widgets/common/client/tables/popup/NewTabFilterPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants\"/>\n\n\n  <b:TabPanel>\n    <b:NavTabs>\n      <b:TabListItem ui:field=\"tabBasic\" active=\"true\" text=\"{i18n.Basic_Properties}\"/>\n      <b:TabListItem ui:field=\"tabFilter\" text=\"{i18n.Filter_parameters}\"/>\n    </b:NavTabs>\n    <b:TabContent>\n      <b:TabPane ui:field=\"tab1\" active=\"true\">\n        <b:Well>\n          <b:FieldSet>\n            <g:FlowPanel ui:field=\"basicTabPanel\"/>\n          </b:FieldSet>\n        </b:Well>\n      </b:TabPane>\n      <b:TabPane ui:field=\"tab2\">\n        <b:Well>\n          <b:FieldSet>\n            <b:FormGroup ui:field=\"errorMessagesGroup\">\n              <b:HelpBlock ui:field=\"errorMessages\"/>\n            </b:FormGroup>\n            <b:Form type=\"HORIZONTAL\" ui:field=\"filterForm\"/>\n          </b:FieldSet>\n        </b:Well>\n      </b:TabPane>\n    </b:TabContent>\n  </b:TabPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.widgets.common.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/UberfireWidgetsCommons.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <source path='client'/>\n\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.select.SelectNoResources\"/>\n  <inherits name=\"org.gwtbootstrap3.extras.datepicker.DatePicker\"/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.ext.services.UberfireWidgetsServicesAPI\"/>\n  <inherits name=\"org.uberfire.ext.widgets.table.UberfireTableWidget\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/css/common.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n@sprite .whiteTopLeftCornerClass {\n    gwt-image: 'images.whiteTopLeftCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .whiteTopRightCornerClass {\n    gwt-image: 'images.whiteTopRightCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .whiteBottomLeftCornerClass {\n    gwt-image: 'images.whiteBottomLeftCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .whiteBottomRightCornerClass {\n    gwt-image: 'images.whiteBottomRightCorner';\n    height: 4px;\n    width: 4px;\n}\n\n.whiteBottomClass {\n    border-bottom: 1px solid #bbbbbb;\n    height: 3px;\n    width: 100%;\n}\n\n.whiteTopClass {\n    border-top: 1px solid #bbbbbb;\n    height: 3px;\n    width: 100%;\n}\n\n.whiteSideLeftClass {\n    border-left: 1px solid #bbbbbb;\n    height: 100%;\n    width: 3px;\n}\n\n.whiteSideRightClass {\n    border-right: 1px solid #bbbbbb;\n    height: 100%;\n    width: 3px;\n}\n\n.whiteCenterClass {\n}\n\n@sprite .greyTopLeftCornerClass {\n    gwt-image: 'images.greyTopLeftCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .greyTopRightCornerClass {\n    gwt-image: 'images.greyTopRightCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .greyBottomLeftCornerClass {\n    gwt-image: 'images.greyBottomLeftCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .greyBottomRightCornerClass {\n    gwt-image: 'images.greyBottomRightCorner';\n    height: 4px;\n    width: 4px;\n}\n\n@sprite .greyBottomClass {\n    gwt-image: 'images.greyBottom';\n    height: 4px;\n    width: 100%;\n}\n\n@sprite .greyTopClass {\n    gwt-image: 'images.greyTop';\n    height: 4px;\n    width: 100%;\n}\n\n@sprite .greySideLeftClass {\n    gwt-image: 'images.greySideLeft';\n    height: 100%;\n    width: 4px;\n}\n\n@sprite .greySideRightClass {\n    gwt-image: 'images.greySideRight';\n    height: 100%;\n    width: 4px;\n}\n\n.greyCenterClass {\n    background: #E3E3E3;\n}\n\n.clean-textarea {\n    border: none !important;\n    width: 95%;\n}\n\n.busy-popup {\n    width: 300px;\n}\n\n.busy-popup span {\n    padding-left: 15px;\n    vertical-align: text-top;\n}\n\n@external .spinner;\n\n.busy-popup .spinner {\n    margin-top: -3px;\n}\n\n.titleTextCellContainer {\n    height: 32px;\n    vertical-align: middle;\n    display: table-cell;\n}\n\n.titleTextCellDescription {\n    font-size: smaller;\n    font-style: italic;\n}\n\n.dataGrid td div {\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.dataGridHeader {\n\n}\n\n.dataGridHeader thead th {\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.dataGridContent {\n    border-top: none;\n}\n\n.dataGridRow:first-child td {\n    border-top: none;\n}\n\n.columnPickerPopup {\n    background-color: #FFFFFF;\n    padding: 5px;\n    border: 1px solid #d1d1d1;\n    z-index: 2000;\n}\n\n@external .checkbox;\n\n.columnPickerPopup .checkbox {\n    margin-top: 2px;\n    margin-bottom: 2px;\n}\n\n.columnPickerButton {\n\n}\n\n/* Styles prefixed with uf- are not obfuscated and can be overridden in application stylesheets. */\n@external .btn-file;\n\n.btn-file {\n    position: relative;\n    overflow: hidden;\n}\n\n.btn-file input[type=file] {\n    position: absolute;\n    top: 0;\n    right: 0;\n    min-width: 100%;\n    min-height: 100%;\n    font-size: 999px;\n    text-align: right;\n    filter: literal(\"alpha(opacity=0)\");\n    opacity: 0;\n    outline: none;\n    background: white;\n    cursor: inherit;\n    display: block;\n}\n\n.btn-file > i + span {\n    padding-left: 2px;\n}\n\n.btn-file > span + i {\n    padding-left: 2px;\n}\n\n.popoverTextBreakWord {\n    overflow-wrap: break-word;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=Ok\nYES=Yes\nNO=No\nInformation=Information\nClose=Close\nError=Error\nWarning=Warning\nShowDetail=Show detail\nAbstractTableOpen=Open\nAbstractTablePleaseSelectAnItemToDelete=Please select one or more items to delete.\nAbstractTableRefreshList=Refresh list\nAbstractTableOpenSelected=Open selected\nAbstractTableFileURI=URI\nReOpen=Re-open\nIgnore=Ignore\nForceSave=Force Save\nCancel=Cancel\nConcurrentIssue=Concurrent issue\nConcurrentUpdate=User {0} has updated the following resource {1}.\nConcurrentRename=User {0} has renamed the following resource {1} to {2}.\nConcurrentDelete=User {0} has deleted the following resource {1}.\nChooseFile=Choose File...\nUpload=Upload\nMore=More...\nActive=Active:\nExceptionInvalidPath=Path is invalid.\nExceptionFileAlreadyExists0=File \"{0}\" already exists.\nExceptionNoSuchFile0=File \"{0}\" could not be found.\nExceptionSecurity0=Insufficient permissions for \"{0}\".\nExceptionGeneric0=Unable to complete your request. The following exception occurred: {0}.\nItemDeletedSuccessfully=Item successfully deleted.\nDeletePopupTitle=Delete this item\nDeletePopupDelete=Delete item\nVersion=Version\nItems=Items\nColorPickerTitle=Select Color\nAdd_New_Filter=Add new filter\nFilter_parameters=Filter parameters\nFilter_Name=Filter name\nFilter_Must_Have_A_Name=Filter must have a name\nFilter_Management=Filter Management\nRemoveFilter=Remove filter\nCustomFilters=Custom filters\nNoCustomFilterAvailable= No custom filter available\nRefresh=Refresh\nColumnPickerButtonTooltip=Show/hide columns\nPageSizeSelectorTooltip=Select table page size\nReset=Reset\nActions=Actions\nBasic_Properties=Basic properties\nClickToDisplay0=Click to show/hide {0}\nRemoveTabTitle=Remove tab\nRemoveTabConfirm=Are you sure you want to remove tab {0}?\nAutoRefresh=Auto Refresh\nDisable_autorefresh=Disable auto refresh\nAutorefresh_Disabled=Auto refresh Disabled\nMinutes=Minutes\nMinute=Minute\nliveSearchHint =Search items ...\nliveSearchSelectorHint =- Select -\nliveSearchNotFoundMessage =No items found\nliveSearchElementsSelected={0} elements selected\nliveSearchNewEntry=New\nliveSearchClearSelectionMessage=Clear Selection\nliveSearchResetSelectionMessage=Reset\nPerspectiveSelectHint=- Select Page -\nPerspectiveSearchHint=Search Page...\nPerspectiveNotFound=Page not found\nby=by\non=on"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_de.properties",
    "content": "OK=Ok\nYES=Ja\nNO=Nein\nInformation=Information\nClose=Schließen\nError=Fehler\nWarning=Warnung\nShowDetail=Details anzeigen\nAbstractTableOpen=Öffnen\nAbstractTablePleaseSelectAnItemToDelete=Bitte wählen Sie ein oder mehrere zu löschende Elemente aus\nAbstractTableRefreshList=Liste neu laden\nAbstractTableOpenSelected=Auswahl öffnen\nAbstractTableFileURI=URI\nReOpen=Erneut öffnen\nIgnore=Ignorieren\nForceSave=Speichern erzwingen\nCancel=Abbrechen\nConcurrentIssue=Nebenläufiges Problem\nConcurrentUpdate=Benutzer {0} hat die folgende Ressource {1} aktualisiert.\nConcurrentRename=Benutzer {0} hat die folgende Ressource {1} in {2} umbenannt.\nConcurrentDelete=Benutzer {0} hat die folgende Ressource {1} gelöscht.\nChooseFile=Datei wählen...\nUpload=Hochladen\nMore=Mehr...\nActive=Aktiv\\:\nExceptionInvalidPath=Pfad ist ungültig.\nExceptionFileAlreadyExists0=Datei \"{0}\" bereits vorhanden.\nExceptionNoSuchFile0=Datei \"{0}\" nicht gefunden.\nExceptionSecurity0=Unzureichende Berechtigungen für \"{0}\".\nExceptionGeneric0=Ihre Anfrage kann nicht ausgeführt werden. Die folgende Ausnahme ist aufgetreten\\: {0}.\nItemDeletedSuccessfully=Element erfolgreich gelöscht.\nDeletePopupTitle=Dieses Element löschen\nDeletePopupDelete=Element löschen\nVersion=Version\nItems=Posten\nColorPickerTitle=Farbe auswählen\nAdd_New_Filter=Neuen Filter hinzufügen\nFilter_parameters=Filterparameter\nFilter_Name=Filtername\nFilter_Must_Have_A_Name=Filter muss einen Namen haben\nFilter_Management=Filter Management\nRemoveFilter=Filter entfernen\nCustomFilters=Benutzerdefinierter Filter\nNoCustomFilterAvailable=Kein benutzerdefinierter Filter verfügbar\nRefresh=Aktualisieren\nColumnPickerButtonTooltip=Spalten einblenden/ausblenden\nPageSizeSelectorTooltip=Größe der Tabellenseite auswählen\nReset=Zurücksetzen\nActions=Aktionen\nBasic_Properties=Grundlegende Eigenschaften\nClickToDisplay0=Zum Einblenden/Ausblenden von {0} hier klicken\nRemoveTabTitle=Registerkarte entfernen\nRemoveTabConfirm=Sind Sie sicher, dass Sie Registerkarte {0} entfernen möchten?\nAutoRefresh=Auto-Refresh\nDisable_autorefresh=Auto-Refresh deaktivieren\nAutorefresh_Disabled=Auto-Refresh deaktiviert\nMinutes=Minuten\nMinute=Minute\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=Aceptar\nYES=Sí\nNO=No\nInformation=Información\nClose=Cerrar\nError=Error\nWarning=Advertencia\nShowDetail=Mostrar detalle\nAbstractTableOpen=Abrir\nAbstractTablePleaseSelectAnItemToDelete=Seleccione uno o más ítems para eliminarlos.\nAbstractTableRefreshList=Actualizar la lista\nAbstractTableOpenSelected=Abrir seleccionado\nAbstractTableFileURI=URI\nReOpen=Volver a abrir\nIgnore=Ignorar\nForceSave=Forzar guardado\nCancel=Cancelar\nConcurrentIssue=Problema simultáneo\nConcurrentUpdate=El usuario {0} ha actualizado el siguiente recurso {1}.\nConcurrentRename=El usuario {0} ha cambiado el nombre del siguiente recurso de {1} a {2}.\nConcurrentDelete=El usuario {0} ha eliminado el siguiente recurso {1}.\nChooseFile=Elegir archivo…\nUpload=Cargar\nMore=Más…\nActive=Activo:\nExceptionInvalidPath=La ruta no es válida.\nExceptionFileAlreadyExists0=El archivo \"{0}\" ya existe.\nExceptionNoSuchFile0=No se encuentra el archivo \"{0}\".\nExceptionSecurity0=No hay suficientes permisos para \"{0}\".\nExceptionGeneric0=No se puede completar su solicitud. Se produjo la siguiente excepción: {0}.\nItemDeletedSuccessfully=El ítem se eliminó correctamente.\nDeletePopupTitle=Eliminar este ítem\nDeletePopupDelete=Eliminar ítem\nVersion=Versión\nItems=Ítems\nColorPickerTitle=Seleccionar el color\nAdd_New_Filter=Agregar nuevo filtro\nFilter_parameters=Parámetros de filtro\nFilter_Name=Nombre de filtro\nFilter_Must_Have_A_Name=El filtro debe tener un nombre\nFilter_Management=Gestión de filtros\nRemoveFilter=Quitar filtro\nCustomFilters=Filtros personalizados\nNoCustomFilterAvailable= No hay un filtro personalizado disponible\nRefresh=Actualizar\nColumnPickerButtonTooltip=Mostrar/ocultar columnas\nPageSizeSelectorTooltip=Seleccionar el tamaño de la página de la tabla\nReset=Restablecer\nActions=Acciones\nBasic_Properties=Propiedades básicas\nClickToDisplay0=Haga clic para mostrar/ocultar {0}\nRemoveTabTitle=Quitar la pestaña\nRemoveTabConfirm=¿Está seguro de que desea quitar la pestaña {0}?\nAutoRefresh=Actualización automática\nDisable_autorefresh=Deshabilitar la actualización automática\nAutorefresh_Disabled=Actualización automática deshabilitada\nMinutes=Minutos\nMinute=Minuto\nliveSearchHint =Buscar ítems…\nliveSearchSelectorHint =- Seleccionar -\nliveSearchNotFoundMessage =No se encuentran ítems\nliveSearchElementsSelected={0} elementos seleccionados\nliveSearchNewEntry=Nuevo\nliveSearchClearSelectionMessage=Anular selección\nliveSearchResetSelectionMessage=Restablecer\nPerspectiveSelectHint=- Seleccionar página -\nPerspectiveSearchHint=Buscar página…\nPerspectiveNotFound=No se encuentra la página\nby=por\non=en"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nYES=Oui\nNO=Non\nInformation=Informations\nClose=Fermer\nError=Erreur\nWarning=Avertissement\nShowDetail=Afficher les détails\nAbstractTableOpen=Ouvrir\nAbstractTablePleaseSelectAnItemToDelete=Veuillez sélectionner un ou plusieurs éléments à supprimer.\nAbstractTableRefreshList=Rafraîchir la liste\nAbstractTableOpenSelected=Ouvrir la sélection\nAbstractTableFileURI=URI\nReOpen=Rouvrir\nIgnore=Ignorer\nForceSave=Force l''enregistrement\nCancel=Annuler\nConcurrentIssue=Problème simultané\nConcurrentUpdate=L''utilisateur {0} a mis à jour la ressource suivante {1}.\nConcurrentRename=L''utilisateur {0} a renommé la ressource suivante {1} en {2}.\nConcurrentDelete=L''utilisateur {0} a supprimé la ressource suivante {1}.\nChooseFile=Choisir un fichier…\nUpload=Envoyer\nMore=Plus…\nActive=Actif :\nExceptionInvalidPath=Le chemin d''accès n''est pas valide.\nExceptionFileAlreadyExists0=Le fichier \"{0}\" existe déjà.\nExceptionNoSuchFile0=Le fichier \"{0}\" est introuvable.\nExceptionSecurity0=Autorisations insuffisantes pour \"{0}\".\nExceptionGeneric0=Impossible de traiter votre demande. L''exception suivante s''est produite : {0}.\nItemDeletedSuccessfully=L''élément a été supprimé.\nDeletePopupTitle=Supprimer cet élément\nDeletePopupDelete=Supprimer l''élément\nVersion=Version\nItems=Éléments\nColorPickerTitle=Sélectionner une couleur\nAdd_New_Filter=Ajouter un nouveau filtre\nFilter_parameters=Paramètres du filtre\nFilter_Name=Nom du filtre\nFilter_Must_Have_A_Name=Le filtre doit avoir un nom\nFilter_Management=Gestion des filtres\nRemoveFilter=Supprimer le filtre\nCustomFilters=Filtres personnalisés\nNoCustomFilterAvailable= Aucun filtre personnalisé disponible\nRefresh=Rafraîchir\nColumnPickerButtonTooltip=Afficher/masquer les colonnes\nPageSizeSelectorTooltip=Sélectionner la taille de page du tableau\nReset=Réinitialiser\nActions=Actions\nBasic_Properties=Propriétés de base\nClickToDisplay0=Cliquez pour afficher/masquer {0}\nRemoveTabTitle=Supprimer l''onglet\nRemoveTabConfirm=Voulez-vous vraiment supprimer l''onglet {0} ?\nAutoRefresh=Rafraîchissement automatique\nDisable_autorefresh=Désactiver le rafraîchissement automatique\nAutorefresh_Disabled=Rafraîchissement automatique désactivé\nMinutes=Minutes\nMinute=Minute\nliveSearchHint =Rechercher des éléments…\nliveSearchSelectorHint =- Sélectionner -\nliveSearchNotFoundMessage =Aucun élément trouvé\nliveSearchElementsSelected={0} éléments sélectionnés\nliveSearchNewEntry=Nouveau\nliveSearchClearSelectionMessage=Effacer la sélection\nliveSearchResetSelectionMessage=Réinitialiser\nPerspectiveSelectHint=- Sélectionner une page -\nPerspectiveSearchHint=Rechercher la page…\nPerspectiveNotFound=Page introuvable\nby=par\non=sur"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=Ok\nYES=Sì\nNO=No\nInformation=Informazioni\nClose=Chiudi\nError=Errore\nWarning=Avviso\nShowDetail=Mostra dettagli\nAbstractTableOpen=Apri\nAbstractTablePleaseSelectAnItemToDelete=Seleziona uno o più elementi da eliminare.\nAbstractTableRefreshList=Aggiorna lista\nAbstractTableOpenSelected=Apri selezionato\nAbstractTableFileURI=URI\nReOpen=Riapri\nIgnore=Ignora\nForceSave=Forza salvataggio\nCancel=Annulla\nConcurrentIssue=Problema di concorrenza\nConcurrentUpdate=L''utente {0} ha aggiornato la risorsa seguente {1}.\nConcurrentRename=L''utente {0} ha rinominato la risorsa seguente {1} in {2}.\nConcurrentDelete=L''utente {0} ha eliminato la risorsa seguente {1}.\nChooseFile=Scegli file...\nUpload=Carica\nMore=Altro...\nActive=Attivo:\nExceptionInvalidPath=Percorso non valido.\nExceptionFileAlreadyExists0=Il file \"{0}\" esiste già.\nExceptionNoSuchFile0=Il file \"{0}\" non è stato trovato.\nExceptionSecurity0=Permessi insufficienti per \"{0}\".\nExceptionGeneric0=Impossibile completare la richiesta. Si è verificata l''eccezione seguente: {0}.\nItemDeletedSuccessfully=Elemento eliminato con successo.\nDeletePopupTitle=Elimina questo elemento\nDeletePopupDelete=Elimina elemento\nVersion=Versione\nItems=Elementi\nColorPickerTitle=Seleziona colore\nAdd_New_Filter=Aggiungi nuovo filtro\nFilter_parameters=Parametri filtro\nFilter_Name=Nome filtro\nFilter_Must_Have_A_Name=Il filtro deve avere un nome\nFilter_Management=Gestione filtro\nRemoveFilter=Rimuovi filtro\nCustomFilters=Filtri personalizzati\nNoCustomFilterAvailable=Nessun filtro personalizzato disponibile\nRefresh=Aggiorna\nColumnPickerButtonTooltip=Mostra/nascondi colonne\nPageSizeSelectorTooltip=Seleziona dimensione pagina tabella\nReset=Resetta\nActions=Azioni\nBasic_Properties=Proprietà di base\nClickToDisplay0=Clicca per mostrare/nascondere {0}\nRemoveTabTitle=Rimuovi scheda\nRemoveTabConfirm=Sei sicuro di voler rimuovere la scheda {0}?\nAutoRefresh=Aggiornamento automatico\nDisable_autorefresh=Disabilita aggiornamento automatico\nAutorefresh_Disabled=Aggiornamento automatico disabilitato\nMinutes=Minuti\nMinute=Minuto\nliveSearchHint =Cerca elementi ...\nliveSearchSelectorHint =- Seleziona -\nliveSearchNotFoundMessage =Nessun elemento trovato\nliveSearchElementsSelected={0} elementi selezionati\nliveSearchNewEntry=Nuovo\nliveSearchClearSelectionMessage=Cancella selezione\nliveSearchResetSelectionMessage=Resetta selezione\nPerspectiveSelectHint=- Seleziona Pagina -\nPerspectiveSearchHint=Cerca Pagina...\nPerspectiveNotFound=Pagina non trovata\nby=di\non=su\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nYES=はい\nNO=いいえ\nInformation=情報\nClose=閉じる\nError=エラー\nWarning=警告\nShowDetail=詳細を表示\nAbstractTableOpen=開く\nAbstractTablePleaseSelectAnItemToDelete=削除する項目を 1 つまたは複数選択してください。\nAbstractTableRefreshList=リストをリフレッシュ\nAbstractTableOpenSelected=選択項目を開く\nAbstractTableFileURI=URI\nReOpen=再度開く\nIgnore=無視\nForceSave=強制保存\nCancel=キャンセル\nConcurrentIssue=同時性の問題\nConcurrentUpdate=ユーザー {0} が次のリース {1} を更新しました。\nConcurrentRename=ユーザー {0} が次のリソースの名前を {1} から {2}. に変更しました。\nConcurrentDelete=ユーザー {0} が次のリース {1} を削除しました。\nChooseFile=ファイルの選択...\nUpload=アップロード\nMore=詳細...\nActive=アクティブ:\nExceptionInvalidPath=パスが無効です。\nExceptionFileAlreadyExists0=ファイル \"{0}\" はすでに存在します。\nExceptionNoSuchFile0=ファイル \"{0}\" はありません。\nExceptionSecurity0=\"{0}\" のパーミッションが不十分です。\nExceptionGeneric0=リクエストを完了できません。次の例外が発生しました: {0}。\nItemDeletedSuccessfully=アイテムが削除されました。\nDeletePopupTitle=このアイテムの削除\nDeletePopupDelete=アイテムを削除\nVersion=バージョン\nItems=アイテム\nColorPickerTitle=色を選択\nAdd_New_Filter=新規フィルターの追加\nFilter_parameters=パラメーターをフィルター\nFilter_Name=フィルター名\nFilter_Must_Have_A_Name=フィルターに名前を付ける必要があります\nFilter_Management=フィルター管理\nRemoveFilter=フィルターの削除\nCustomFilters=カスタムフィルター\nNoCustomFilterAvailable= 使用できるカスタムフィルターがありません\nRefresh=更新\nColumnPickerButtonTooltip=カラムの表示/非表示\nPageSizeSelectorTooltip=テーブルページサイズの選択\nReset=リセット\nActions=アクション\nBasic_Properties=基本プロパティー\nClickToDisplay0=クリックして {0} の表示と非表示を切り替えます\nRemoveTabTitle=タブを削除\nRemoveTabConfirm=本当にタブ {0} を削除していいですか?\nAutoRefresh=自動更新\nDisable_autorefresh=自動更新を無効化\nAutorefresh_Disabled=自動更新が無効になりました\nMinutes=分\nMinute=分\nliveSearchHint =アイテムを検索中 ...\nliveSearchSelectorHint =- 選択 -\nliveSearchNotFoundMessage =アイテムが見つかりません\nliveSearchElementsSelected={0} 個の要素が選択されました\nliveSearchNewEntry=新規\nliveSearchClearSelectionMessage=選択のクリア\nliveSearchResetSelectionMessage=リセット\nPerspectiveSelectHint=- ページの選択 -\nPerspectiveSearchHint=ページを検索中...\nPerspectiveNotFound=ページが見つかりません\nby=更新者\non=on"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "OK=Ok\nYES=Sim\nNO=Não\nInformation=Informação\nClose=Encerrar\nError=Erro\nWarning=Aviso\nShowDetail=Apresentar detalhe\nAbstractTableOpen=Abrir\nAbstractTablePleaseSelectAnItemToDelete=Favor selecionar um ou mais itens para exclusão.\nAbstractTableRefreshList=Atualizar a lista\nAbstractTableOpenSelected=Abrir selecionado\nAbstractTableFileURI=URI\nReOpen=Abrir novamente\nIgnore=Ignorar\nForceSave=Forçar o \"Salvar\"\nCancel=Cancelar\nConcurrentIssue=Problema simultâneo\nConcurrentUpdate=O usuário {0} atualizou o seguinte recurso {1}.\nConcurrentRename=O usuário {0} renomeou o seguinte recurso {1} para {2}.\nConcurrentDelete=O usuário {0} excluiu o seguinte recurso {1}.\nChooseFile=Selecionar Arquivo...\nUpload=Carregar\nMore=Mais...\nActive=Ativo\\:\nExceptionInvalidPath=O caminho é inválido.\nExceptionFileAlreadyExists0=O arquivo \"{0}\" já existe.\nExceptionNoSuchFile0=O arquivo \"{0}\" não pôde ser encontrado.\nExceptionSecurity0=Permissões insuficientes para \"{0}\".\nExceptionGeneric0=Não foi possível completar sua solicitação. Ocorreu a seguinte exceção\\: {0}.\nItemDeletedSuccessfully=Item excluído com sucesso.\nDeletePopupTitle=Excluir este item\nDeletePopupDelete=Excluir item\nVersion=Versão\nItems=Itens\nColorPickerTitle=Selecionar Cor\nAdd_New_Filter=Adicionar novo filtro\nFilter_parameters=Parâmetros de filtro\nFilter_Name=Nome do filtro\nFilter_Must_Have_A_Name=O filtro deve ter um nome\nFilter_Management=Gerenciamento de Filtros\nRemoveFilter=Remover filtro\nCustomFilters=Personalizar filtros\nNoCustomFilterAvailable=Nenhum filtro personalizado disponível\nRefresh=Atualizar\nColumnPickerButtonTooltip=Mostrar/ esconder colunas\nPageSizeSelectorTooltip=Selecionar o tamanho da página da tabela\nReset=Restaurar\nActions=Ações\nBasic_Properties=Propriedades básicas\nClickToDisplay0=Clique para mostrar/ esconder {0}\nRemoveTabTitle=Remover aba\nRemoveTabConfirm=Você tem certeza que deseja remover a aba {0} ?\nAutoRefresh=Atualizar Automaticamente\nDisable_autorefresh=Desabilitar atualização automática\nAutorefresh_Disabled=Atualização Automaticamente Desabilitada\nMinutes=Minutos\nMinute=Minuto\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "OK=确定\nYES=是\nNO=否\nInformation=信息\nClose=关闭\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nError=错误\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nWarning=警告\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nShowDetail=查看明细\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nAbstractTableOpen=打开\nAbstractTablePleaseSelectAnItemToDelete=请选择要删除的一个或多个项目\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nAbstractTableRefreshList=刷新列表\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nAbstractTableOpenSelected=打开选中的条目\nAbstractTableFileURI=URI\nReOpen=重新打开\n# auto translated by TM merge from project: JON strings, version: jon33strings, DocId: Messages\nIgnore=忽略\nForceSave=强制保存\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nCancel=取消\nConcurrentIssue=并发的问题\nConcurrentUpdate=用户 {0} 已更新了下列资源 {1}。\nConcurrentRename=用户 {0} 已将下列资源 {1} 重命名为 {2}。\nConcurrentDelete=用户 {0} 已删除了下列资源 {1}。\nChooseFile=选择文件...\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-dtable-xls-editor-client/org/drools/workbench/screens/dtablexls/client/resources/i18n/DecisionTableXLSEditorConstants\nUpload=上传\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nMore=更多...\nActive=活动的：\nExceptionInvalidPath=路径是无效的。 \nExceptionFileAlreadyExists0=文件 \"{0}\" 已经存在。\nExceptionNoSuchFile0=未找到 \"{0}\"。\nExceptionSecurity0=对 \"{0}\" 没有足够的权限。\nExceptionGeneric0=无法完成您的请求，发生了下列异常 {0}。\nItemDeletedSuccessfully=成功删除了条目。\nDeletePopupTitle=删除这个条目\nDeletePopupDelete=删除条目\nVersion=版本\nItems=条目\nColorPickerTitle=选择颜色\nAdd_New_Filter=添加新的过滤器\nFilter_parameters=过滤器参数\nFilter_Name=过滤器名称\nFilter_Must_Have_A_Name=过滤器必须具有名字\nFilter_Management=过滤器管理\nRemoveFilter=删除过滤器\nCustomFilters=自定义过滤器\nNoCustomFilterAvailable=没有可用的自定义过滤器\nRefresh=刷新\nColumnPickerButtonTooltip=显示/隐藏列\nPageSizeSelectorTooltip=选择表页面大小\nReset=重置\nActions=动作\nBasic_Properties=基本属性\nClickToDisplay0=点击显示/隐藏  {0}\nRemoveTabTitle=删除标签页\nRemoveTabConfirm=你确定要删除标签页 {0} 吗?\nAutoRefresh=自动刷新\nDisable_autorefresh=禁用自动刷新\nAutorefresh_Disabled=已禁用自动刷新\nMinutes=分\nMinute=分\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/main/resources/org/uberfire/ext/widgets/common/client/resources/js/wysihtml/parser_rules/advanced_and_extended.js",
    "content": "/**\n * Full HTML5 compatibility rule set\n * Loosened and extended ruleset. Allows more freedom on user side\n * These rules define which tags and CSS classes are supported and which tags should be specially treated.\n */\n\nvar wysihtmlParserRulesDefaults = {\n    \"blockLevelEl\": {\n        \"keep_styles\": {\n            \"textAlign\": /^((left)|(right)|(center)|(justify))$/i,\n            \"float\": 1\n        },\n        \"add_style\": {\n            \"align\": \"align_text\"\n        },\n        \"check_attributes\": {\n            \"id\": \"any\"\n        }\n    },\n\n    \"makeDiv\": {\n        \"rename_tag\": \"div\",\n        \"one_of_type\": {\n            \"alignment_object\": 1\n        },\n        \"remove_action\": \"unwrap\",\n        \"keep_styles\": {\n            \"textAlign\": 1,\n            \"float\": 1\n        },\n        \"add_style\": {\n            \"align\": \"align_text\"\n        },\n        \"check_attributes\": {\n            \"id\": \"any\"\n        }\n    }\n};\n\nvar wysihtmlParserRules = {\n    /**\n     * CSS Class white-list\n     * Following CSS classes won't be removed when parsed by the wysihtml HTML parser\n     * If all classes should pass \"any\" as classes value. Ex: \"classes\": \"any\"\n     */\n    \"classes\": \"any\",\n\n    /* blacklist of classes is only available if classes is set to any */\n    \"classes_blacklist\": {\n        \"Apple-interchange-newline\": 1,\n        \"MsoNormal\": 1,\n        \"MsoPlainText\": 1\n    },\n    \n    \"type_definitions\": {\n        \n        \"alignment_object\": {\n            \"classes\": {\n                \"wysiwyg-text-align-center\": 1,\n                \"wysiwyg-text-align-justify\": 1,\n                \"wysiwyg-text-align-left\": 1,\n                \"wysiwyg-text-align-right\": 1,\n                \"wysiwyg-float-left\": 1,\n                \"wysiwyg-float-right\": 1\n            },\n            \"styles\": {\n                \"float\": [\"left\", \"right\"],\n                \"text-align\": [\"left\", \"right\", \"center\"]\n            }\n        },\n        \n        \"valid_image_src\": {\n            \"attrs\": {\n                \"src\": /^[^data\\:]/i\n            }\n        },\n        \n        \"text_color_object\": {\n          \"styles\": {\n            \"color\": true,\n            \"background-color\": true\n          }\n        },\n        \n        \"text_fontsize_object\": {\n          \"styles\": {\n            \"font-size\": true\n          }\n        },\n        \n        \"text_formatting_object\": {\n            \"classes\": {\n                \"wysiwyg-color-aqua\": 1,\n                \"wysiwyg-color-black\": 1,\n                \"wysiwyg-color-blue\": 1,\n                \"wysiwyg-color-fuchsia\": 1,\n                \"wysiwyg-color-gray\": 1,\n                \"wysiwyg-color-green\": 1,\n                \"wysiwyg-color-lime\": 1,\n                \"wysiwyg-color-maroon\": 1,\n                \"wysiwyg-color-navy\": 1,\n                \"wysiwyg-color-olive\": 1,\n                \"wysiwyg-color-purple\": 1,\n                \"wysiwyg-color-red\": 1,\n                \"wysiwyg-color-silver\": 1,\n                \"wysiwyg-color-teal\": 1,\n                \"wysiwyg-color-white\": 1,\n                \"wysiwyg-color-yellow\": 1,\n                \"wysiwyg-font-size-large\": 1,\n                \"wysiwyg-font-size-larger\": 1,\n                \"wysiwyg-font-size-medium\": 1,\n                \"wysiwyg-font-size-small\": 1,\n                \"wysiwyg-font-size-smaller\": 1,\n                \"wysiwyg-font-size-x-large\": 1,\n                \"wysiwyg-font-size-x-small\": 1,\n                \"wysiwyg-font-size-xx-large\": 1,\n                \"wysiwyg-font-size-xx-small\": 1\n            }\n        }\n    },\n\n    \"comments\": 1, // if set allows comments to pass\n    \n    /**\n     * Tag list\n     *\n     * The following options are available:\n     *\n     *    - add_class:        converts and deletes the given HTML4 attribute (align, clear, ...) via the given method to a css class\n     *                        The following methods are implemented in wysihtml.dom.parse:\n     *                          - align_text:  converts align attribute values (right/left/center/justify) to their corresponding css class \"wysiwyg-text-align-*\")\n     *                            <p align=\"center\">foo</p> ... becomes ... <p> class=\"wysiwyg-text-align-center\">foo</p>\n     *                          - clear_br:    converts clear attribute values left/right/all/both to their corresponding css class \"wysiwyg-clear-*\"\n     *                            <br clear=\"all\"> ... becomes ... <br class=\"wysiwyg-clear-both\">\n     *                          - align_img:    converts align attribute values (right/left) on <img> to their corresponding css class \"wysiwyg-float-*\"\n     *                          \n     *    - remove:             removes the element and its content\n     *\n     *    - unwrap              removes element but leaves content\n     *\n     *    - rename_tag:         renames the element to the given tag\n     *\n     *    - set_class:          adds the given class to the element (note: make sure that the class is in the \"classes\" white list above)\n     *\n     *    - set_attributes:     sets/overrides the given attributes\n     *\n     *    - check_attributes:   checks the given HTML attribute via the given method\n     *                            - url:            allows only valid urls (starting with http:// or https://)\n     *                            - src:            allows something like \"/foobar.jpg\", \"http://google.com\", ...\n     *                            - href:           allows something like \"mailto:bert@foo.com\", \"http://google.com\", \"/foobar.jpg\"\n     *                            - alt:            strips unwanted characters. if the attribute is not set, then it gets set (to ensure valid and compatible HTML)\n     *                            - numbers:        ensures that the attribute only contains numeric (integer) characters (no float values or units)\n     *                            - dimension:      for with/height attributes where floating point numbrs and percentages are allowed\n     *                            - any:            allows anything to pass \n     */\n    \"tags\": {\n        \"tr\": {\n            \"add_style\": {\n                \"align\": \"align_text\"\n            },\n            \"check_attributes\": {\n                \"id\": \"any\"\n            }\n        },\n        \"strike\": {\n            \"unwrap\": 1\n        },\n        \"form\": {\n            \"unwrap\": 1\n        },\n        \"rt\": {\n            \"rename_tag\": \"span\"\n        },\n        \"code\": {},\n        \"acronym\": {\n            \"rename_tag\": \"span\"\n        },\n        \"br\": {\n            \"add_class\": {\n                \"clear\": \"clear_br\"\n            }\n        },\n        \"details\": {\n            \"unwrap\": 1\n        },\n        \"h4\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"em\": {},\n        \"title\": {\n            \"remove\": 1\n        },\n        \"multicol\": {\n            \"unwrap\": 1\n        },\n        \"figure\": {\n            \"unwrap\": 1\n        },\n        \"xmp\": {\n            \"unwrap\": 1\n        },\n        \"small\": {\n            \"rename_tag\": \"span\",\n            \"set_class\": \"wysiwyg-font-size-smaller\"\n        },\n        \"area\": {\n            \"remove\": 1\n        },\n        \"time\": {\n            \"unwrap\": 1\n        },\n        \"dir\": {\n            \"rename_tag\": \"ul\"\n        },\n        \"bdi\": {\n            \"unwrap\": 1\n        },\n        \"command\": {\n            \"unwrap\": 1\n        },\n        \"ul\": {\n            \"check_attributes\": {\n                \"id\": \"any\"\n            }\n        },\n        \"progress\": {\n            \"rename_tag\": \"span\"\n        },\n        \"dfn\": {\n            \"unwrap\": 1\n        },\n        \"iframe\": {\n            \"check_attributes\": {\n                \"src\": \"any\",\n                \"width\": \"any\",\n                \"height\": \"any\",\n                \"frameborder\": \"any\",\n                \"style\": \"any\",\n                \"id\": \"any\"\n            }\n        },\n        \"figcaption\": {\n            \"unwrap\": 1\n        },\n        \"a\": {\n            \"check_attributes\": {\n                \"href\": \"href\", // if you compiled main manually then change this from 'url' to 'href'\n                \"rel\": \"any\",\n                \"target\": \"any\",\n                \"id\": \"any\"\n            }\n        },\n        \"img\": {\n            \"one_of_type\": {\n                \"valid_image_src\": 1\n            },\n            \"check_attributes\": {\n                \"width\": \"dimension\",\n                \"alt\": \"alt\",\n                \"src\": \"src\", // if you compiled main manually then change this from 'url' to 'src'\n                \"height\": \"dimension\",\n                \"id\": \"any\"\n            },\n            \"add_class\": {\n                \"align\": \"align_img\"\n            }\n        },\n        \"rb\": {\n            \"unwrap\": 1\n        },\n        \"footer\": wysihtmlParserRulesDefaults.makeDiv,\n        \"noframes\": {\n            \"remove\": 1\n        },\n        \"abbr\": {\n            \"unwrap\": 1\n        },\n        \"u\": {},\n        \"bgsound\": {\n            \"remove\": 1\n        },\n        \"sup\": {},\n        \"address\": {\n            \"unwrap\": 1\n        },\n        \"basefont\": {\n            \"remove\": 1\n        },\n        \"nav\": {\n            \"unwrap\": 1\n        },\n        \"h1\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"head\": {\n            \"unwrap\": 1\n        },\n        \"tbody\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"dd\": {\n            \"unwrap\": 1\n        },\n        \"s\": {\n            \"unwrap\": 1\n        },\n        \"li\": {},\n        \"td\": {\n            \"check_attributes\": {\n                \"rowspan\": \"numbers\",\n                \"colspan\": \"numbers\",\n                \"valign\": \"any\",\n                \"align\": \"any\",\n                \"id\": \"any\",\n                \"class\": \"any\"\n            },\n            \"keep_styles\": {\n                \"backgroundColor\": 1,\n                \"width\": 1,\n                \"height\": 1\n            },\n            \"add_style\": {\n                \"align\": \"align_text\"\n            }\n        },\n        \"object\": {\n            \"remove\": 1\n        },\n        \n        \"div\": {\n            \"one_of_type\": {\n                \"alignment_object\": 1\n            },\n            \"remove_action\": \"unwrap\",\n            \"keep_styles\": {\n                \"textAlign\": 1,\n                \"float\": 1\n            },\n            \"add_style\": {\n                \"align\": \"align_text\"\n            },\n            \"check_attributes\": {\n                \"id\": \"any\",\n                \"contenteditable\": \"any\"\n            }\n        },\n        \n        \"option\": {\n            \"remove\":1\n        },\n        \"select\": {\n            \"remove\":1\n        },\n        \"i\": {},\n        \"track\": {\n            \"remove\": 1\n        },\n        \"wbr\": {\n            \"remove\": 1\n        },\n        \"fieldset\": {\n            \"unwrap\": 1\n        },\n        \"big\": {\n            \"rename_tag\": \"span\",\n            \"set_class\": \"wysiwyg-font-size-larger\"\n        },\n        \"button\": {\n            \"unwrap\": 1\n        },\n        \"noscript\": {\n            \"remove\": 1\n        },\n        \"svg\": {\n            \"remove\": 1\n        },\n        \"input\": {\n            \"remove\": 1\n        },\n        \"table\": {\n            \"keep_styles\": {\n                \"width\": 1,\n                \"textAlign\": 1,\n                \"float\": 1\n            },\n            \"check_attributes\": {\n                \"id\": \"any\"\n            }\n        },\n        \"keygen\": {\n            \"remove\": 1\n        },\n        \"h5\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"meta\": {\n            \"remove\": 1\n        },\n        \"map\": {\n            \"remove\": 1\n        },\n        \"isindex\": {\n            \"remove\": 1\n        },\n        \"mark\": {\n            \"unwrap\": 1\n        },\n        \"caption\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"tfoot\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"base\": {\n            \"remove\": 1\n        },\n        \"video\": {\n            \"remove\": 1\n        },\n        \"strong\": {},\n        \"canvas\": {\n            \"remove\": 1\n        },\n        \"output\": {\n            \"unwrap\": 1\n        },\n        \"marquee\": {\n            \"unwrap\": 1\n        },\n        \"b\": {},\n        \"q\": {\n            \"check_attributes\": {\n                \"cite\": \"url\",\n                \"id\": \"any\"\n            }\n        },\n        \"applet\": {\n            \"remove\": 1\n        },\n        \"span\": {\n            \"one_of_type\": {\n                \"text_formatting_object\": 1,\n                \"text_color_object\": 1,\n                \"text_fontsize_object\": 1\n            },\n            \"keep_styles\": {\n                \"color\": 1,\n                \"backgroundColor\": 1,\n                \"fontSize\": 1\n            },\n            \"remove_action\": \"unwrap\",\n            \"check_attributes\": {\n                \"id\": \"any\"\n            }\n        },\n        \"rp\": {\n            \"unwrap\": 1\n        },\n        \"spacer\": {\n            \"remove\": 1\n        },\n        \"source\": {\n            \"remove\": 1\n        },\n        \"aside\": wysihtmlParserRulesDefaults.makeDiv,\n        \"frame\": {\n            \"remove\": 1\n        },\n        \"section\": wysihtmlParserRulesDefaults.makeDiv,\n        \"body\": {\n            \"unwrap\": 1\n        },\n        \"ol\": {},\n        \"nobr\": {\n            \"unwrap\": 1\n        },\n        \"html\": {\n            \"unwrap\": 1\n        },\n        \"summary\": {\n            \"unwrap\": 1\n        },\n        \"var\": {\n            \"unwrap\": 1\n        },\n        \"del\": {\n            \"unwrap\": 1\n        },\n        \"blockquote\": {\n            \"keep_styles\": {\n                \"textAlign\": 1,\n                \"float\": 1\n            },\n            \"add_style\": {\n                \"align\": \"align_text\"\n            },\n            \"check_attributes\": {\n                \"cite\": \"url\",\n                \"id\": \"any\"\n            }\n        },\n        \"style\": {\n            \"check_attributes\": {\n                \"type\": \"any\",\n                \"src\": \"any\",\n                \"charset\": \"any\"\n            }\n        },\n        \"device\": {\n            \"remove\": 1\n        },\n        \"meter\": {\n            \"unwrap\": 1\n        },\n        \"h3\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"textarea\": {\n            \"unwrap\": 1\n        },\n        \"embed\": {\n            \"remove\": 1\n        },\n        \"hgroup\": {\n            \"unwrap\": 1\n        },\n        \"font\": {\n            \"rename_tag\": \"span\",\n            \"add_class\": {\n                \"size\": \"size_font\"\n            }\n        },\n        \"tt\": {\n            \"unwrap\": 1\n        },\n        \"noembed\": {\n            \"remove\": 1\n        },\n        \"thead\": {\n            \"add_style\": {\n                \"align\": \"align_text\"\n            },\n            \"check_attributes\": {\n                \"id\": \"any\"\n            }\n        },\n        \"blink\": {\n            \"unwrap\": 1\n        },\n        \"plaintext\": {\n            \"unwrap\": 1\n        },\n        \"xml\": {\n            \"remove\": 1\n        },\n        \"h6\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"param\": {\n            \"remove\": 1\n        },\n        \"th\": {\n            \"check_attributes\": {\n                \"rowspan\": \"numbers\",\n                \"colspan\": \"numbers\",\n                \"valign\": \"any\",\n                \"align\": \"any\",\n                \"id\": \"any\"\n            },\n            \"keep_styles\": {\n                \"backgroundColor\": 1,\n                \"width\": 1,\n                \"height\": 1\n            },\n            \"add_style\": {\n                \"align\": \"align_text\"\n            }\n        },\n        \"legend\": {\n            \"unwrap\": 1\n        },\n        \"hr\": {},\n        \"label\": {\n            \"unwrap\": 1\n        },\n        \"dl\": {\n            \"unwrap\": 1\n        },\n        \"kbd\": {\n            \"unwrap\": 1\n        },\n        \"listing\": {\n            \"unwrap\": 1\n        },\n        \"dt\": {\n            \"unwrap\": 1\n        },\n        \"nextid\": {\n            \"remove\": 1\n        },\n        \"pre\": {},\n        \"center\": wysihtmlParserRulesDefaults.makeDiv,\n        \"audio\": {\n            \"remove\": 1\n        },\n        \"datalist\": {\n            \"unwrap\": 1\n        },\n        \"samp\": {\n            \"unwrap\": 1\n        },\n        \"col\": {\n            \"remove\": 1\n        },\n        \"article\": wysihtmlParserRulesDefaults.makeDiv,\n        \"cite\": {},\n        \"link\": {\n            \"remove\": 1\n        },\n        \"script\": {\n            \"check_attributes\": {\n                \"type\": \"any\",\n                \"src\": \"any\",\n                \"charset\": \"any\"\n            }\n        },\n        \"bdo\": {\n            \"unwrap\": 1\n        },\n        \"menu\": {\n            \"rename_tag\": \"ul\"\n        },\n        \"colgroup\": {\n            \"remove\": 1\n        },\n        \"ruby\": {\n            \"unwrap\": 1\n        },\n        \"h2\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"ins\": {\n            \"unwrap\": 1\n        },\n        \"p\": wysihtmlParserRulesDefaults.blockLevelEl,\n        \"sub\": {},\n        \"comment\": {\n            \"remove\": 1\n        },\n        \"frameset\": {\n            \"remove\": 1\n        },\n        \"optgroup\": {\n            \"unwrap\": 1\n        },\n        \"header\": wysihtmlParserRulesDefaults.makeDiv\n    }\n};\n\n\n(function() {\n    // Paste cleanup rules universal for all rules (also applied to content copied from editor)\n    var commonRules = wysihtml.lang.object(wysihtmlParserRules).clone(true);\n    commonRules.comments    = false;\n    commonRules.selectors   = { \"a u\": \"unwrap\"};\n    commonRules.tags.style  = { \"remove\": 1 };\n    commonRules.tags.script = { \"remove\": 1 };\n    commonRules.tags.head = { \"remove\": 1 };\n    \n    // Paste cleanup for unindentified source\n    var universalRules = wysihtml.lang.object(commonRules).clone(true);\n    universalRules.tags.div.one_of_type.alignment_object = 1;\n    universalRules.tags.div.remove_action = \"unwrap\";\n    universalRules.tags.div.check_attributes.style = false;\n    universalRules.tags.div.keep_styles = {\n        \"textAlign\": /^((left)|(right)|(center)|(justify))$/i,\n        \"float\": 1\n    };\n    universalRules.tags.span.keep_styles = false;\n\n    // Paste cleanup for MS Office\n    // TODO: should be extended to stricter ruleset, as current set will probably not cover all Office bizarreness\n    var msOfficeRules = wysihtml.lang.object(universalRules).clone(true);\n    msOfficeRules.classes = {};\n\n    window.wysihtmlParserPasteRulesets = [\n        {\n            condition: /<font face=\"Times New Roman\"|class=\"?Mso|style=\"[^\"]*\\bmso-|style='[^'']*\\bmso-|w:WordDocument|class=\"OutlineElement|id=\"?docs\\-internal\\-guid\\-/i,\n            set: msOfficeRules\n        },{\n            condition: /<meta name=\"copied-from\" content=\"wysihtml\">/i,\n            set: commonRules\n        },{\n            set: universalRules\n        }\n    ];\n\n})();\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/breadcrumbs/UberfireBreadcrumbsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.header.UberfireBreadcrumbsContainer;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.widget.BreadcrumbPresenter;\nimport org.uberfire.ext.widgets.common.client.breadcrumbs.widget.DefaultBreadcrumbsPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberfireBreadcrumbsTest {\n\n    @Mock\n    private UberfireBreadcrumbsContainer uberfireBreadcrumbsContainer;\n\n    @Mock\n    private ManagedInstance<DefaultBreadcrumbsPresenter> breadcrumbsPresenters;\n\n    @Mock\n    private DefaultBreadcrumbsPresenter.View breadcrumbsPresenterView;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    private UberfireBreadcrumbs uberfireBreadcrumbs;\n    private UberfireBreadcrumbs.View view;\n\n    @Before\n    public void setup() {\n        doAnswer(invocationOnMock -> new DefaultBreadcrumbsPresenter(breadcrumbsPresenterView)).when(breadcrumbsPresenters).get();\n\n        view = mock(UberfireBreadcrumbs.View.class);\n        uberfireBreadcrumbs = spy(new UberfireBreadcrumbs(uberfireBreadcrumbsContainer,\n                                                          breadcrumbsPresenters,\n                                                          placeManager,\n                                                          view) {\n        });\n\n        uberfireBreadcrumbs.currentPerspective = \"currentPerspective\";\n    }\n\n    @Test\n    public void createBreadcrumbsTest() {\n        uberfireBreadcrumbs.createBreadcrumbs();\n\n        verify(uberfireBreadcrumbsContainer).init(any());\n    }\n\n    @Test\n    public void addToolbar() {\n        assertTrue(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n        uberfireBreadcrumbs.addToolbar(\"myperspective\",\n                                       mock(Element.class));\n\n        assertFalse(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n    }\n\n    @Test\n    public void addBreadcrumbs() {\n        assertTrue(uberfireBreadcrumbs.breadcrumbsPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label2\",\n                                          new DefaultPlaceRequest(\"screen2\"));\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective2\",\n                                          \"label4\",\n                                          new DefaultPlaceRequest(\"screen4\"));\n\n        assertFalse(uberfireBreadcrumbs.breadcrumbsPerPerspective.isEmpty());\n        assertEquals(2,\n                     uberfireBreadcrumbs.breadcrumbsPerPerspective.size());\n        assertEquals(2,\n                     uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").size());\n    }\n\n    @Test\n    public void clearBreadcrumbsTest() {\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n        uberfireBreadcrumbs.addToolbar(\"myperspective\",\n                                       mock(Element.class));\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n\n        assertFalse(uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").isEmpty());\n        assertFalse(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.clearBreadcrumbs(\"myperspective\");\n\n        assertTrue(uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").isEmpty());\n        assertFalse(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n    }\n\n    @Test\n    public void clearBreadcrumbsAndToolBarsTest() {\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n        uberfireBreadcrumbs.addToolbar(\"myperspective\",\n                                       mock(Element.class));\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n\n        assertFalse(uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").isEmpty());\n        assertFalse(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.clearBreadcrumbsAndToolBars(\"myperspective\");\n\n        assertTrue(uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").isEmpty());\n        assertTrue(uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.isEmpty());\n    }\n\n    @Test\n    public void removeDeepLevelBreadcrumbsTest() {\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n        uberfireBreadcrumbs\n                .addBreadCrumb(\"myperspective\",\n                               \"label2\",\n                               new DefaultPlaceRequest(\"screen2\"));\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label3\",\n                                          new DefaultPlaceRequest(\"screen3\"));\n\n        List<BreadcrumbPresenter> breadcrumbs = uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\");\n\n        uberfireBreadcrumbs.removeDeepLevelBreadcrumbsIfNecessary(\"myperspective\",\n                                                                  (DefaultBreadcrumbsPresenter) breadcrumbs.get(0));\n\n        assertEquals(1,\n                     uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").size());\n    }\n\n    @Test\n    public void doesNotRemoveDeepLevelBreadcrumbsTest() {\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          () -> {\n                                          },\n                                          false);\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label2\",\n                                          () -> {\n                                          },\n                                          false);\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label3\",\n                                          () -> {\n                                          },\n                                          false);\n\n        List<BreadcrumbPresenter> breadcrumbs = uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\");\n\n        uberfireBreadcrumbs.removeDeepLevelBreadcrumbsIfNecessary(\"myperspective\",\n                                                                  (DefaultBreadcrumbsPresenter) breadcrumbs.get(0));\n\n        assertEquals(3,\n                     uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\").size());\n    }\n\n    @Test\n    public void generateBreadCrumbSelectCommandTest() {\n        DefaultPlaceRequest placeRequest = new DefaultPlaceRequest(\"screen\");\n        final Command command = mock(Command.class);\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          placeRequest);\n\n        List<BreadcrumbPresenter> breadcrumbs = uberfireBreadcrumbs.breadcrumbsPerPerspective.get(\"myperspective\");\n\n        DefaultBreadcrumbsPresenter breadcrumb = (DefaultBreadcrumbsPresenter) breadcrumbs.get(0);\n\n        uberfireBreadcrumbs.generateBreadCrumbSelectCommand(\"myperspective\",\n                                                            breadcrumb,\n                                                            placeRequest,\n                                                            command).execute();\n\n        verify(placeManager).goTo(placeRequest);\n        verify(placeManager,\n               never()).goTo(eq(placeRequest),\n                             any(HasWidgets.class));\n        verify(command).execute();\n    }\n\n    @Test\n    public void getViewShouldAddInnerBreadcrumbsTest() {\n\n        List<BreadcrumbPresenter> breadcrumbs = Arrays\n                .asList(mock(DefaultBreadcrumbsPresenter.class),\n                        mock(DefaultBreadcrumbsPresenter.class));\n        uberfireBreadcrumbs.breadcrumbsPerPerspective.put(\"myperspective\",\n                                                          breadcrumbs);\n        uberfireBreadcrumbs.breadcrumbsToolBarPerPerspective.put(\"myperspective\",\n                                                                 mock(Element.class));\n\n        uberfireBreadcrumbs.getView();\n\n        verify(view).clear();\n        verify(view,\n               never()).addBreadcrumb(any(UberElemental.class));\n\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n\n        uberfireBreadcrumbs.getView();\n\n        verify(view,\n               times(2)).addBreadcrumb(any());\n        verify(view,\n               times(1)).addBreadcrumbToolbar(any());\n    }\n\n    @Test\n    public void addBreadcrumbAssociatedWithACommandTest() {\n        final Command command = mock(Command.class);\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          command);\n        verify(uberfireBreadcrumbs).addBreadCrumb(\"myperspective\",\n                                                  \"label\",\n                                                  null,\n                                                  command,\n                                                  true);\n    }\n\n    @Test\n    public void addBreadcrumbAssociatedWithAPlaceRequestTest() {\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n        verify(uberfireBreadcrumbs).addBreadCrumb(\"myperspective\",\n                                                  \"label\",\n                                                  new DefaultPlaceRequest(\"screen\"),\n                                                  null,\n                                                  true);\n    }\n\n    @Test\n    public void addBreadcrumbAssociatedWithAPlaceRequestWithACommandTest() {\n        final Command command = mock(Command.class);\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"),\n                                          command);\n        verify(uberfireBreadcrumbs).addBreadCrumb(\"myperspective\",\n                                                  \"label\",\n                                                  new DefaultPlaceRequest(\"screen\"),\n                                                  command,\n                                                  true);\n    }\n\n    @Test\n    public void updateBreadcrumbsContainerTest() {\n        assertTrue(uberfireBreadcrumbs.breadcrumbsPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n        uberfireBreadcrumbs.addBreadCrumb(\"myperspective\",\n                                          \"label\",\n                                          new DefaultPlaceRequest(\"screen\"));\n\n        verify(uberfireBreadcrumbsContainer).enable();\n    }\n\n    @Test\n    public void updateBreadcrumbsWithNoBreadcrumbsContainerTest() {\n        assertTrue(uberfireBreadcrumbs.breadcrumbsPerPerspective.isEmpty());\n\n        uberfireBreadcrumbs.currentPerspective = \"myperspective\";\n\n        uberfireBreadcrumbs.updateBreadcrumbsContainer();\n\n        verify(uberfireBreadcrumbsContainer).disable();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/breadcrumbs/widget/DefaultBreadcrumbsPresenterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.breadcrumbs.widget;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultBreadcrumbsPresenterTest {\n\n    @Mock\n    private DefaultBreadcrumbsPresenter.View view;\n\n    private DefaultBreadcrumbsPresenter presenter;\n\n    @Before\n    public void setup() {\n        presenter = new DefaultBreadcrumbsPresenter(view);\n    }\n\n    @Test\n    public void setupWithActionTest() {\n        final Command selectCommand = () -> {};\n\n        presenter.setup(\"label\", true, selectCommand);\n\n        verify(view).setup(\"label\");\n        verify(view, never()).setNoAction();\n    }\n\n    @Test\n    public void setupWithNoActionTest() {\n        presenter.setup(\"label\", true, null);\n\n        verify(view).setup(\"label\");\n        verify(view).setNoAction();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/callbacks/CommandErrorCallbackTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.callbacks;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Modal.class})\npublic class CommandErrorCallbackTest {\n\n    @Test\n    public void verifyCommandIsRanOnError() throws Exception {\n        final Command command = mock(Command.class);\n\n        new CommandErrorCallback(command).error(mock(Message.class), mock(org.uberfire.java.nio.file.AccessDeniedException.class));\n\n        verify(command).execute();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void doNotAcceptNulls() throws Exception {\n        new CommandErrorCallback(null);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/BooleanTextBoxTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BooleanTextBoxTest {\n\n    @Test\n    public void emptyValues() {\n        assertTrue(new BooleanTextBox(true).isValidValue(\"\", false));\n        assertFalse(new BooleanTextBox(false).isValidValue(\"\", false));\n    }\n\n    @Test\n    public void focusLost() {\n        assertFalse(new BooleanTextBox(true).isValidValue(\"-\", true));\n        assertFalse(new BooleanTextBox(false).isValidValue(\"-\", true));\n        assertTrue(new BooleanTextBox(false).isValidValue(\"-\", false));\n        assertTrue(new BooleanTextBox(true).isValidValue(\"-\", false));\n    }\n\n    @Test\n    public void values() {\n        assertFalse(new BooleanTextBox(true).isValidValue(\"blaa\", false));\n        assertTrue(new BooleanTextBox(false).isValidValue(\"true\", false));\n        assertTrue(new BooleanTextBox(false).isValidValue(\"false\", false));\n        assertTrue(new BooleanTextBox(false).isValidValue(\"TRUE\", false));\n        assertTrue(new BooleanTextBox(false).isValidValue(\"FALSE\", false));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/DatePickerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport java.util.Date;\n\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.extras.datepicker.client.ui.base.constants.DatePickerLanguage;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DatePickerTest {\n\n    @Mock\n    public org.gwtbootstrap3.extras.datepicker.client.ui.DatePicker datePickerMock;\n    public DatePicker datePicker;\n    @Mock\n    TextBox textBox;\n\n    @Before\n    public void setup() {\n        when(datePickerMock.getTextBox()).thenReturn(textBox);\n    }\n\n    @Test\n    public void testSetFormat() {\n        datePicker = new DatePicker(datePickerMock);\n        String gwtDateFormat = \"dd-MMM-yyyy\";\n        DateTimeFormat gwtDateTimeFormat = DateTimeFormat.getFormat(gwtDateFormat);\n\n        datePicker.setLocaleName(\"en\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.EN);\n        verify(datePickerMock).setFormat(DatePickerFormatUtilities.convertToBS3DateFormat(gwtDateFormat));\n\n        Date now = new Date();\n        now = gwtDateTimeFormat.parse(gwtDateTimeFormat.format(now));\n\n        datePicker.setValue(now);\n        verify(textBox).setValue(gwtDateTimeFormat.format(now));\n        when(textBox.getValue()).thenReturn(gwtDateTimeFormat.format(now));\n        assertEquals(now,\n                     datePicker.getValue());\n    }\n\n    @Test\n    public void testSetDatePickerLang() {\n        datePicker = new DatePicker(datePickerMock);\n        String gwtDateFormat = \"dd-MMM-yyyy\";\n\n        datePicker.setLocaleName(\"es\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.ES);\n\n        datePicker.setLocaleName(\"fr\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.FR);\n\n        datePicker.setLocaleName(\"ja\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.JA);\n\n        datePicker.setLocaleName(\"pt_BR\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.PT_BR);\n\n        datePicker.setLocaleName(\"zh_CN\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.ZH_CN);\n\n        datePicker.setLocaleName(\"de\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.DE);\n\n        datePicker.setLocaleName(\"zh_TW\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.ZH_TW);\n\n        datePicker.setLocaleName(\"ru\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.RU);\n\n        datePicker.setLocaleName(\"en\");\n        datePicker.setFormat(gwtDateFormat);\n        verify(datePickerMock).setLanguage(DatePickerLanguage.EN);\n    }\n\n    @Test\n    public void testGetLocaleName() {\n        datePicker = new DatePicker(datePickerMock);\n\n        datePicker.setLocaleName(\"\");\n        assertEquals(\"\",\n                     datePicker.getLocaleName());\n\n        datePicker.setLocaleName(null);\n        assertEquals(\"\",\n                     datePicker.getLocaleName());\n\n        datePicker.setLocaleName(\"default\");\n        assertEquals(\"\",\n                     datePicker.getLocaleName());\n\n        String currentLocale = \"testValue\";\n        datePicker.setLocaleName(currentLocale);\n        assertEquals(currentLocale,\n                     datePicker.getLocaleName());\n    }\n\n    @Test\n    public void testGetDataPickerDate(){\n        datePicker = new DatePicker(datePickerMock);\n\n        assertNull(datePicker.getDataPickerDate());\n    }\n\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/FileUploadTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Input;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FileUploadTest {\n\n    @Mock\n    Input file;\n\n    @Mock\n    Input fileText;\n\n    @InjectMocks\n    private FileUpload fileUpload;\n\n    @Test\n    public void testRegularFileName1() {\n        testFileName(\"newfile.txt\",\n                     \"newfile.txt\");\n    }\n\n    @Test\n    public void testRegularFileName2() {\n        testFileName(\"NewFile.txt\",\n                     \"NewFile.txt\");\n    }\n\n    @Test\n    public void testSecuredFileName1() {\n        testFileName(\"c:\\\\fakepath\\\\newfile.txt\",\n                     \"newfile.txt\");\n    }\n\n    @Test\n    public void testSecuredFileName2() {\n        testFileName(\"C:\\\\fakepath\\\\NewFile.txt\",\n                     \"NewFile.txt\");\n    }\n\n    private void testFileName(String fileInput,\n                              String expected) {\n        when(file.getValue()).thenReturn(fileInput);\n        fileUpload.getFileChangeHandler().onChange(mock(ChangeEvent.class));\n        verify(fileText).setValue(expected);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/FormStyleItemTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.views.pfly.widgets.FormLabelHelp;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FormStyleItemTest {\n\n    @Mock\n    private FlowPanel group;\n\n    @Mock\n    private FlowPanel labelContainer;\n\n    @Mock\n    private FormLabel formLabel;\n\n    @Mock\n    private FormLabelHelp formLabelHelp;\n\n    private FormStyleItem testedItem;\n\n    @Before\n    public void setUp() throws Exception {\n        GwtMockito.useProviderForType(FormLabel.class, aClass -> formLabel);\n        GwtMockito.useProviderForType(FormLabelHelp.class, aClass -> formLabelHelp);\n\n        testedItem = spy(new FormStyleItem() {{\n            labelContainer = FormStyleItemTest.this.labelContainer;\n            group = FormStyleItemTest.this.group;\n        }});\n    }\n\n    @Test\n    public void testSetup() throws Exception {\n        final String attribute = \"attribute\";\n        final IsWidget widget = mock(IsWidget.class);\n        final int index = 123;\n\n        testedItem.setup(attribute, widget, index);\n\n        verify(formLabel).setText(attribute);\n        verify(labelContainer).add(formLabel);\n        verify(group).add(widget);\n        assertEquals(index, testedItem.index);\n    }\n\n    @Test\n    public void testSetupWithHelp() throws Exception {\n        final String attribute = \"attribute\";\n        final String helpTitle = \"help key\";\n        final String helpContent = \"help content\";\n        final IsWidget widget = mock(IsWidget.class);\n        final int index = 123;\n\n        testedItem.setup(attribute,\n                         helpTitle,\n                         helpContent,\n                         widget, index);\n\n        verify(formLabelHelp).setText(attribute);\n        verify(formLabelHelp).setHelpTitle(helpTitle);\n        verify(formLabelHelp).setHelpContent(helpContent);\n        verify(labelContainer).add(formLabelHelp);\n        verify(group).add(widget);\n        assertEquals(index, testedItem.index);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/FormStyleLayoutTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwt.dom.client.FormElement;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@WithClassesToStub(FormElement.class)\n@RunWith(GwtMockitoTestRunner.class)\npublic class FormStyleLayoutTest {\n\n    @Mock\n    private FormStyleItem item;\n\n    private FormStyleLayout testedLayout;\n\n    @Before\n    public void setUp() throws Exception {\n        GwtMockito.useProviderForType(FormStyleItem.class, aClass -> item);\n\n        testedLayout = spy(new FormStyleLayout());\n    }\n\n    @Test\n    public void testAddAttributeWithHelp() throws Exception {\n        final String attribute = \"form attribute\";\n        final String helpTitle = \"help title\";\n        final String helpContent = \"help content\";\n        final IsWidget widget = mock(IsWidget.class);\n        final int widgetCount = 123;\n\n        doReturn(widgetCount).when(testedLayout).getWidgetCount();\n\n        testedLayout.addAttribute(attribute,\n                                  helpTitle,\n                                  helpContent,\n                                  widget);\n\n        verify(item).setup(attribute,\n                           helpTitle,\n                           helpContent,\n                           widget,\n                           widgetCount);\n        verify(testedLayout).add(item);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/InfoPopupTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport static org.junit.Assert.assertTrue;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\n\n/**\n * Test InfoPopup is initialized correctly for each constructor.\n *\n */\n@RunWith(GwtMockitoTestRunner.class)\npublic class InfoPopupTest {\n\n    private InfoPopup infoPopup;\n    private boolean infoPopupRecreated;\n\n    @Before\n    public void setup() {\n        infoPopupRecreated = false;\n    }\n\n    @Test\n    public void testRecreate_1() {\n\n        infoPopup = new InfoPopup(\"title\") {\n\n            @Override\n            public void recreate() {\n                super.recreate();\n                infoPopupRecreated = true;\n            }\n        };\n        assertTrue(infoPopupRecreated);\n\n    }\n\n    @Test\n    public void testRecreate_2() {\n\n        infoPopup = new InfoPopup(\"title\", \"content\") {\n\n            @Override\n            public void recreate() {\n                super.recreate();\n                infoPopupRecreated = true;\n            }\n        };\n        assertTrue(infoPopupRecreated);\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/NumericIntegerTextBoxTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NumericIntegerTextBoxTest {\n\n    private NumericIntegerTextBox numericIntegerTextBox;\n\n    @Before\n    public void setUp() throws Exception {\n        numericIntegerTextBox = new NumericIntegerTextBox();\n    }\n\n    @Test\n    public void testDefaultValue() {\n        Assertions.assertThat(numericIntegerTextBox.makeValidValue(\"\")).isEqualTo(\"0\");\n        Assertions.assertThat(numericIntegerTextBox.makeValidValue(\"123\")).isEqualTo(\"0\");\n        Assertions.assertThat(numericIntegerTextBox.makeValidValue(\"-123\")).isEqualTo(\"0\");\n        Assertions.assertThat(numericIntegerTextBox.makeValidValue(\"abcd\")).isEqualTo(\"0\");\n    }\n\n    @Test\n    public void testIsValidValue_ValidValues() {\n        Assertions.assertThat(numericIntegerTextBox.isValidValue(\"123\", false)).isTrue();\n        Assertions.assertThat(numericIntegerTextBox.isValidValue(\"-123\", false)).isTrue();\n    }\n\n    @Test\n    public void testIsValidValue_InvalidValues() {\n        Assertions.assertThat(numericIntegerTextBox.isValidValue(\"123.0\", false)).isFalse();\n        Assertions.assertThat(numericIntegerTextBox.isValidValue(\"abcd\", false)).isFalse();\n        Assertions.assertThat(numericIntegerTextBox.isValidValue(\"!\", false)).isFalse();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/common/popups/FormStylePopupTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.common.popups;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleItem;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleLayout;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@WithClassesToStub({BaseModal.class, Text.class})\n@RunWith(GwtMockitoTestRunner.class)\npublic class FormStylePopupTest {\n\n    @Mock\n    private FormStyleLayout formStyleLayout;\n\n    private FormStylePopup testedPopup;\n\n    @Before\n    public void setUp() throws Exception {\n        testedPopup = spy(new FormStylePopup(\"form\") {{\n            form = formStyleLayout;\n        }});\n    }\n\n    @Test\n    public void testAddAttributeWithHelp() throws Exception {\n        final String attribute = \"form attribute\";\n        final String helpTitle = \"help title\";\n        final String helpContent = \"help content\";\n        final Widget widget = mock(Widget.class);\n        final FormStyleItem expectedItem = mock(FormStyleItem.class);\n        final int expectedAttributeIndex = 123;\n\n        doReturn(expectedItem).when(formStyleLayout).addAttribute(attribute,\n                                                                  helpTitle,\n                                                                  helpContent,\n                                                                  widget);\n        doReturn(expectedAttributeIndex).when(expectedItem).getIndex();\n\n        testedPopup.addAttributeWithHelp(attribute,\n                                         helpTitle,\n                                         helpContent,\n                                         widget);\n\n        verify(formStyleLayout).addAttribute(attribute,\n                                             helpTitle,\n                                             helpContent,\n                                             widget);\n        verify(formStyleLayout).setAttributeVisibility(expectedAttributeIndex, true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/AbstractEntryCreationLiveSearchServiceTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic abstract class AbstractEntryCreationLiveSearchServiceTest<EDITOR extends EntryCreationEditor> {\n\n    protected static final String VALUE = \"value\";\n\n    protected EDITOR editor;\n\n    @Mock\n    protected EntryCreationLiveSearchService searchService;\n\n    @Mock\n    protected SingleLiveSearchSelectionHandler searchSelectionHandler;\n\n    @Mock\n    protected LiveSearchDropDownView view;\n\n    @Mock\n    private ManagedInstance<LiveSearchSelectorItem> selectorItems;\n\n    protected LiveSearchDropDown dropDown;\n\n    protected ParameterizedCommand<LiveSearchEntry> onAddCommand;\n\n    protected Command onCancelCommand;\n\n    @Before\n    public void init() {\n        when(selectorItems.get()).thenAnswer((Answer<LiveSearchSelectorItem<String>>) invocationOnMock -> mock(LiveSearchSelectorItem.class));\n\n        editor = mock(getEditorType());\n\n        when(searchService.getEditor()).thenReturn(editor);\n\n        dropDown = spy(new LiveSearchDropDown(view, selectorItems));\n    }\n\n    @Test\n    public void testEditorAddNewEntryAction() {\n\n        startTest();\n\n        LiveSearchEntry<String> entry = new LiveSearchEntry<>(VALUE, VALUE);\n\n        onAddCommand.execute(entry);\n\n        verify(dropDown).addNewItem(entry);\n        verify(searchSelectionHandler).selectItem(any());\n        verify(dropDown).search(any());\n        verify(dropDown).doSearch(any());\n        verify(view).searchInProgress(any());\n        verify(searchService).search(anyString(), anyInt(), any());\n        verify(view).restoreFooter();\n    }\n\n    protected void startTest() {\n        dropDown.init(searchService, searchSelectionHandler);\n\n        verify(view).setNewInstanceEnabled(true);\n\n        ArgumentCaptor<ParameterizedCommand> onAddCommandCaptor = ArgumentCaptor.forClass(ParameterizedCommand.class);\n        ArgumentCaptor<Command> onCancelCommandCaptor = ArgumentCaptor.forClass(Command.class);\n\n        verify(editor).init(onAddCommandCaptor.capture(), onCancelCommandCaptor.capture());\n\n        onAddCommand = onAddCommandCaptor.getValue();\n\n        onCancelCommand = onCancelCommandCaptor.getValue();\n\n        assertNotNull(onAddCommand);\n        assertNotNull(onCancelCommand);\n\n        dropDown.showNewItem();\n    }\n\n    abstract Class<EDITOR> getEditorType();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/InlineEntryCreationLiveSearchServiceTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class InlineEntryCreationLiveSearchServiceTest extends AbstractEntryCreationLiveSearchServiceTest<InlineCreationEditor> {\n\n    @Test\n    public void testInlineEditorCancelAction() {\n        startTest();\n\n        onCancelCommand.execute();\n\n        verify(dropDown, never()).addNewItem(any());\n        verify(view).restoreFooter();\n    }\n\n    @Override\n    protected void startTest() {\n        super.startTest();\n\n        verify(view).showNewItemEditor(editor);\n    }\n\n    @Override\n    protected Class<InlineCreationEditor> getEditorType() {\n        return InlineCreationEditor.class;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/LiveSearchDropDownTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class LiveSearchDropDownTest {\n\n    @Mock\n    LiveSearchDropDownView<String> view;\n\n    @Mock\n    LiveSearchCallback<String> searchCallback;\n\n    @Spy\n    LiveSearchService<String> searchService = new LiveSearchService<String>() {\n\n        @Override\n        public void search(String pattern,\n                           int maxResults,\n                           LiveSearchCallback<String> callback) {\n            LiveSearchResults results = new LiveSearchResults();\n            switch (pattern) {\n                case \"a\":\n                    results.add(\"1\", \"a\");\n                    break;\n                case \"b\":\n                    results.add(\"1\", \"a\");\n                    results.add(\"2\", \"b\");\n                    results.add(\"3\", \"c\");\n                    break;\n            }\n\n            callback.afterSearch(results);\n        }\n\n        @Override\n        public void searchEntry(String key, LiveSearchCallback<String> callback) {\n            LiveSearchResults results = new LiveSearchResults();\n            switch (key) {\n                case \"1\":\n                    results.add(\"1\", \"a\");\n                    break;\n                case \"2\":\n                    results.add(\"2\", \"b\");\n                    break;\n            }\n\n            callback.afterSearch(results);\n        }\n    };\n\n    @Spy\n    SingleLiveSearchSelectionHandler<String> selectionHandler = new SingleLiveSearchSelectionHandler<>();\n\n    @Mock\n    Command onChangeCommand;\n\n    @Mock\n    ClickEvent clickEvent;\n\n    LiveSearchDropDown<String> presenter;\n\n    @Mock\n    ManagedInstance<LiveSearchSelectorItem<String>> selectorItems;\n\n    @Before\n    public void setUp() {\n\n        when(selectorItems.get()).thenAnswer((Answer<LiveSearchSelectorItem<String>>) invocationOnMock -> {\n            final LiveSearchSelectorItem<String> result = mock(LiveSearchSelectorItem.class);\n\n            doAnswer((Answer<Void>) invocationOnMock1 -> {\n                String key = (String) invocationOnMock1.getArguments()[0];\n                String value = (String) invocationOnMock1.getArguments()[1];\n\n                when(result.getKey()).thenReturn(key);\n                when(result.getValue()).thenReturn(value);\n                return null;\n            }).when(result).init(any(), any());\n\n            return result;\n        });\n\n        presenter = spy(new LiveSearchDropDown(view, selectorItems));\n        presenter.setOnChange(onChangeCommand);\n        presenter.init(searchService, selectionHandler);\n\n        doAnswer(invocationOnMock -> {\n            ClickEvent event = (ClickEvent) invocationOnMock.getArguments()[0];\n            event.stopPropagation();\n            return null;\n        }).when(view).onSearchClick(any());\n    }\n\n    @Test\n    public void testInit() {\n        presenter.setWidth(200);\n        presenter.setMaxItems(10);\n        presenter.setSearchHint(\"a\");\n        presenter.setSelectorHint(\"b\");\n\n        assertEquals(presenter.getMaxItems(),\n                     10);\n\n        verify(view).setWidth(200);\n        verify(view).setSearchHint(\"a\");\n        verify(view).setDropDownText(\"b\");\n    }\n\n    @Test\n    public void testClear() {\n        presenter.clear();\n\n        assertNull(presenter.getLastSearch());\n        verify(view).clearItems();\n        verify(view).clearSearch();\n    }\n\n    @Test\n    public void testSearch() {\n        presenter.search(\"a\");\n\n        assertEquals(presenter.getLastSearch(),\n                     \"a\");\n\n        verify(view).clearItems();\n        verify(view).addItem(any());\n        verify(view).searchFinished();\n\n        verify(searchService).search(eq(\"a\"),\n                                     anyInt(),\n                                     any());\n    }\n\n    @Test\n    public void testEmptySearch() {\n        presenter.setSearchHint(\"s\");\n        presenter.setNotFoundMessage(\"n\");\n        presenter.setMaxItems(15);\n        presenter.search(\"\");\n\n        assertEquals(presenter.getLastSearch(),\n                     \"\");\n\n        verify(view).searchInProgress(\"s\");\n        verify(view).clearItems();\n        verify(view).noItems(\"n\");\n        verify(view).searchFinished();\n\n        verify(searchService).search(eq(\"\"),\n                                     eq(15),\n                                     any());\n    }\n\n    @Test\n    public void testRepeatedSearch() {\n        presenter.search(\"a\");\n        presenter.search(\"a\"); // 2nd search is ignored as it's a repetition\n\n        verify(view).clearItems();\n        verify(view).addItem(any());\n        verify(view).searchFinished();\n\n        verify(searchService).search(eq(\"a\"),\n                                     anyInt(),\n                                     any());\n    }\n\n    @Test\n    public void testSearchCache() {\n        presenter.search(\"a\");\n        presenter.search(\"\");\n        presenter.search(\"a\");\n        presenter.search(\"\");\n        presenter.search(\"a\");\n        presenter.search(\"\");\n\n        assertTrue(presenter.isSearchCacheEnabled());\n        assertEquals(presenter.getLastSearch(),\n                     \"\");\n\n        verify(view,\n               times(2)).searchInProgress(any());\n        verify(searchService).search(eq(\"a\"),\n                                     anyInt(),\n                                     any());\n        verify(searchService).search(eq(\"\"),\n                                     anyInt(),\n                                     any());\n        verify(view,\n               times(2)).searchFinished();\n\n        verify(view,\n               times(6)).clearItems();\n        verify(view,\n               times(3)).addItem(any());\n        verify(view,\n               times(3)).noItems(any());\n    }\n\n    @Test\n    public void testSearchCacheDisabled() {\n        presenter.setSearchCacheEnabled(false);\n\n        presenter.search(\"a\");\n        presenter.search(\"\");\n        presenter.search(\"a\");\n        presenter.search(\"\");\n        presenter.search(\"a\");\n        presenter.search(\"\");\n\n        assertFalse(presenter.isSearchCacheEnabled());\n        assertEquals(presenter.getLastSearch(),\n                     \"\");\n\n        verify(view,\n               times(6)).searchInProgress(any());\n        verify(searchService,\n               times(3)).search(eq(\"a\"),\n                                anyInt(),\n                                any());\n        verify(searchService,\n               times(3)).search(eq(\"\"),\n                                anyInt(),\n                                any());\n        verify(view,\n               times(6)).searchFinished();\n\n        verify(view,\n               times(6)).clearItems();\n        verify(view,\n               times(3)).addItem(any());\n        verify(view,\n               times(3)).noItems(any());\n    }\n\n    @Test\n    public void testItemsOrdered() {\n        presenter.search(\"b\");\n\n        ArgumentCaptor<LiveSearchResults> resultsCaptor = ArgumentCaptor.forClass(LiveSearchResults.class);\n        verify(presenter).showResults(resultsCaptor.capture());\n\n        LiveSearchResults<String> results = resultsCaptor.getValue();\n        assertEquals(results.size(),\n                     3);\n        assertEquals(results.get(0).getValue(),\n                     \"a\");\n        assertEquals(results.get(1).getValue(),\n                     \"b\");\n        assertEquals(results.get(2).getValue(),\n                     \"c\");\n    }\n\n    @Test\n    public void testItemSelected() {\n\n        doAnswer(invocationOnMock -> {\n            LiveSearchResults results = new LiveSearchResults(1);\n            results.add(\"1\", \"a\");\n            LiveSearchCallback callback = (LiveSearchCallback) invocationOnMock.getArguments()[1];\n            callback.afterSearch(results);\n\n            return null;\n        }).when(searchService).searchEntry(anyString(), any());\n\n        presenter.setSelectedItem(\"1\");\n\n        assertEquals(\"1\", selectionHandler.getSelectedKey());\n        verify(view).setDropDownText(\"a\");\n        verify(onChangeCommand, never()).execute();\n    }\n\n    @Test\n    public void testOnClickSearchInput() {\n        view.onSearchClick(clickEvent);\n\n        verify(clickEvent).stopPropagation();\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/ModalEntryCreationLiveSearchServiceTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ModalEntryCreationLiveSearchServiceTest extends AbstractEntryCreationLiveSearchServiceTest<ModalCreationEditor> {\n\n    @Test\n    public void testInlineEditorCancelAction() {\n\n        startTest();\n\n        onCancelCommand.execute();\n\n        verify(dropDown, never()).addNewItem(any());\n        verify(view, never()).restoreFooter();\n    }\n\n    @Override\n    protected Class<ModalCreationEditor> getEditorType() {\n        return ModalCreationEditor.class;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/MultipleLiveSearchSelectionHandlerTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown;\n\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.atLeast;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultipleLiveSearchSelectionHandlerTest {\n\n    private String SELECTED_ITEM_TEXT = \"selectedItem\";\n\n\n    @Mock\n    private Command callback;\n\n    @Spy\n    private MultipleLiveSearchSelectionHandler<String> handler;\n\n//    @GwtMock\n    private CommonConstants constants;\n\n    @Before\n    public void init() {\n        GwtMockito.initMocks(this);\n        System.out.println(CommonConstants.INSTANCE.liveSearchElementsSelected(2));\n        handler.setLiveSearchSelectionCallback(callback);\n    }\n\n    @Test\n    public void testRegisterItemWithoutSelectedValue() {\n        LiveSearchSelectorItem item = createItem(\"any\");\n\n        handler.registerItem(item);\n\n        verify(item, never()).select();\n        verify(item, times(1)).setSelectionCallback(any());\n        verify(item, times(1)).setMultipleSelection(true);\n\n        checkHandlerSelectedValue(null);\n\n        assertEquals(null, handler.getDropDownMenuHeader());\n    }\n\n    @Test\n    public void testRegisterIItemWithSelectedValue() {\n        LiveSearchSelectorItem selectedItem = doTestSelectItem();\n\n        LiveSearchSelectorItem secondItem = createItem(SELECTED_ITEM_TEXT);\n\n        handler.registerItem(secondItem);\n\n        verify(selectedItem, atLeast(1)).getKey();\n        verify(secondItem, times(2)).getKey();\n        verify(secondItem).select();\n\n        checkHandlerSelectedValue(SELECTED_ITEM_TEXT);\n\n        assertEquals(SELECTED_ITEM_TEXT, handler.getDropDownMenuHeader());\n    }\n\n    @Test\n    public void testSelectItem() {\n        doTestSelectItem();\n\n        assertEquals(1, handler.getSelectedValues().size());\n\n        assertEquals(SELECTED_ITEM_TEXT, handler.getDropDownMenuHeader());\n    }\n\n    @Test\n    public void testSelectMultipleItems() {\n\n        // Setting max title elements to 3\n        handler.setMaxDropDownTextItems(3);\n\n        // Register Items\n        LiveSearchSelectorItem firstItem = createItem(\"a\");\n        handler.registerItem(firstItem);\n        LiveSearchSelectorItem secondItem = createItem(\"b\");\n        handler.registerItem(secondItem);\n        LiveSearchSelectorItem thirdItem = createItem(\"c\");\n        handler.registerItem(thirdItem);\n        LiveSearchSelectorItem fourthItem = createItem(\"d\");\n        handler.registerItem(fourthItem);\n\n        // Selecting values\n\n        // Selecting \"a\"\n        handler.selectKey(\"a\");\n        verify(handler, times(1)).selectItem(firstItem);\n        verify(firstItem).select();\n        verify(callback).execute();\n        checkHandlerSelectedValue(\"a\");\n        assertEquals(1, handler.getSelectedValues().size());\n        assertEquals(\"a\", handler.getDropDownMenuHeader());\n\n        // Selecting \"a\" & \"b\"\n        handler.selectKey(\"b\");\n        verify(handler, times(1)).selectItem(secondItem);\n        verify(secondItem).select();\n        verify(callback, times(2)).execute();\n        checkHandlerSelectedValue(\"b\");\n        assertEquals(2, handler.getSelectedValues().size());\n        assertEquals(\"a & b\", handler.getDropDownMenuHeader());\n\n        // Selecting \"a\", \"b\" & \"c\"\n        handler.selectKey(\"c\");\n        verify(handler, times(1)).selectItem(thirdItem);\n        verify(thirdItem).select();\n        verify(callback, times(3)).execute();\n        checkHandlerSelectedValue(\"c\");\n        assertEquals(3, handler.getSelectedValues().size());\n        assertEquals(\"a, b & c\", handler.getDropDownMenuHeader());\n\n        // Selectiong \"a\", \"b\", \"c\" & \"d\"\n        handler.selectKey(\"d\");\n        verify(handler, times(1)).selectItem(fourthItem);\n        verify(fourthItem).select();\n        verify(callback, times(4)).execute();\n        checkHandlerSelectedValue(\"d\");\n        assertEquals(4, handler.getSelectedValues().size());\n        assertEquals(\"liveSearchElementsSelected(4)\", handler.getDropDownMenuHeader());\n\n        // Deselecting values\n\n        // Deselect \"a\"\n        handler.selectKey(\"a\");\n        verify(handler, times(2)).selectItem(firstItem);\n        verify(firstItem).reset();\n        verify(callback, times(5)).execute();\n        assertEquals(3, handler.getSelectedValues().size());\n        assertEquals(\"b, c & d\", handler.getDropDownMenuHeader());\n\n        // Deselect \"b\"\n        handler.selectKey(\"b\");\n        verify(handler, times(2)).selectItem(secondItem);\n        verify(secondItem).reset();\n        verify(callback, times(6)).execute();\n        assertEquals(2, handler.getSelectedValues().size());\n        assertEquals(\"c & d\", handler.getDropDownMenuHeader());\n\n        // Deselect \"c\"\n        handler.selectKey(\"c\");\n        verify(handler, times(2)).selectItem(thirdItem);\n        verify(thirdItem).reset();\n        verify(callback, times(7)).execute();\n        assertEquals(1, handler.getSelectedValues().size());\n        assertEquals(\"d\", handler.getDropDownMenuHeader());\n\n        // Deselect \"d\"\n        handler.selectKey(\"d\");\n        verify(handler, times(2)).selectItem(fourthItem);\n        verify(fourthItem).reset();\n        verify(callback, times(8)).execute();\n        assertEquals(0, handler.getSelectedValues().size());\n        assertEquals(null, handler.getDropDownMenuHeader());\n    }\n\n    @Test\n    public void testClearSelection() {\n        // Register Items\n        LiveSearchSelectorItem firstItem = createItem(\"a\");\n        handler.registerItem(firstItem);\n        LiveSearchSelectorItem secondItem = createItem(\"b\");\n        handler.registerItem(secondItem);\n        LiveSearchSelectorItem thirdItem = createItem(\"c\");\n        handler.registerItem(thirdItem);\n        LiveSearchSelectorItem fourthItem = createItem(\"d\");\n        handler.registerItem(fourthItem);\n\n        handler.selectKey(\"a\");\n        handler.selectKey(\"b\");\n        handler.selectKey(\"c\");\n        handler.selectKey(\"d\");\n\n        assertEquals(4, handler.getSelectedValues().size());\n        assertEquals(\"a, b, c & d\", handler.getDropDownMenuHeader());\n\n        handler.clearSelection();\n\n        assertEquals(0, handler.getSelectedValues().size());\n        assertEquals(null, handler.getDropDownMenuHeader());\n    }\n\n    protected LiveSearchSelectorItem doTestSelectItem() {\n        LiveSearchSelectorItem item = createItem(SELECTED_ITEM_TEXT);\n\n        handler.registerItem(item);\n\n        handler.selectItem(item);\n\n        verify(item).select();\n\n        checkHandlerSelectedValue(SELECTED_ITEM_TEXT);\n\n        assertEquals(SELECTED_ITEM_TEXT, handler.getDropDownMenuHeader());\n\n        verify(callback).execute();\n\n        return item;\n    }\n\n    private LiveSearchSelectorItem createItem(String value) {\n        LiveSearchSelectorItem item = mock(LiveSearchSelectorItem.class);\n\n        when(item.getKey()).thenReturn(value);\n        when(item.getValue()).thenReturn(value);\n\n        return item;\n    }\n\n    private void checkHandlerSelectedValue(String value) {\n        if (value != null) {\n            assertTrue(handler.getSelectedValues().contains(value));\n        } else {\n            assertTrue(handler.getSelectedValues().isEmpty());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/PerspectiveDropDownTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectiveDropDownTest {\n\n    @Mock\n    ActivityBeansCache activityBeansCache;\n\n    @Mock\n    LiveSearchDropDown liveSearchDropDown;\n\n    PerspectiveDropDown perspectiveDropDown;\n\n    @Before\n    public void setUp() {\n        perspectiveDropDown = new PerspectiveDropDown(activityBeansCache, liveSearchDropDown);\n\n        SyncBeanDef mock1 = mock(SyncBeanDef.class);\n        when(mock1.getName()).thenReturn(\"A\");\n\n        SyncBeanDef mock2 = mock(SyncBeanDef.class);\n        when(mock2.getName()).thenReturn(\"B\");\n\n        when(activityBeansCache.getPerspectiveActivities()).thenReturn(Arrays.asList(mock1, mock2));\n    }\n\n    @Test\n    public void testSearchAll() {\n        perspectiveDropDown.searchService.search(\"\", -1, itemList -> {\n            assertEquals(itemList.size(), 2);\n        });\n    }\n\n    @Test\n    public void testSearchItem() {\n        perspectiveDropDown.searchService.search(\"A\", -1, itemList -> {\n            assertEquals(itemList.size(), 1);\n        });\n        perspectiveDropDown.searchService.search(\"a\", -1, itemList -> {\n            assertEquals(itemList.size(), 1);\n        });\n    }\n\n    @Test\n    public void testSearchEmpty() {\n        perspectiveDropDown.searchService.search(\"x\", -1, itemList -> {\n            assertEquals(itemList.size(), 0);\n        });\n    }\n\n    @Test\n    public void testExcludeItems() {\n        Set<String> excluded = new HashSet<>();\n        excluded.add(\"A\");\n        perspectiveDropDown.setPerspectiveIdsExcluded(excluded);\n        perspectiveDropDown.searchService.search(\"\", -1, itemList -> {\n            assertEquals(itemList.size(), 1);\n            assertEquals(itemList.get(0).getKey(), \"B\");\n        });\n    }\n\n    @Test\n    public void testCustomNames() {\n        perspectiveDropDown.setPerspectiveNameProvider(itemId -> \"x\");\n        perspectiveDropDown.searchService.search(\"A\", -1, itemList -> {\n            assertEquals(itemList.size(), 0);\n        });\n        perspectiveDropDown.searchService.search(\"x\", -1, itemList -> {\n            assertEquals(itemList.size(), 2);\n        });\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/SingleLiveSearchSelectionHandlerTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.atLeast;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SingleLiveSearchSelectionHandlerTest {\n\n    private String SELECTED_ITEM_TEXT = \"selectedItem\";\n\n    @Spy\n    private SingleLiveSearchSelectionHandler handler = new SingleLiveSearchSelectionHandler();\n\n    @Mock\n    private Command callback;\n\n    @Before\n    public void init() {\n        handler.setLiveSearchSelectionCallback(callback);\n    }\n\n    @Test\n    public void testRegisterItemWithoutSelectedValue() {\n        LiveSearchSelectorItem item = createItem(\"any\");\n\n        handler.registerItem(item);\n\n        verify(item, never()).select();\n        verify(item, times(1)).setSelectionCallback(any());\n\n        checkHandlerSelectedValue(null);\n    }\n\n    @Test\n    public void testRegisterIItemWithSelectedValue() {\n        LiveSearchSelectorItem selectedItem = doTestSelectItem();\n\n        LiveSearchSelectorItem secondItem = createItem(SELECTED_ITEM_TEXT);\n\n        handler.registerItem(secondItem);\n\n        verify(selectedItem, atLeast(1)).getKey();\n        verify(secondItem).getKey();\n        verify(secondItem).select();\n    }\n\n    @Test\n    public void testSelectItem() {\n        doTestSelectItem();\n    }\n\n    protected LiveSearchSelectorItem doTestSelectItem() {\n        LiveSearchSelectorItem item = createItem(SELECTED_ITEM_TEXT);\n\n        handler.registerItem(item);\n\n        handler.selectItem(item);\n\n        verify(item).select();\n\n        checkHandlerSelectedValue(SELECTED_ITEM_TEXT);\n\n        verify(callback).execute();\n\n        return item;\n    }\n\n    @Test\n    public void testSelectSecondItem() {\n        LiveSearchSelectorItem firstItem = doTestSelectItem();\n\n        String secondSelected = SELECTED_ITEM_TEXT + \"2\";\n\n        LiveSearchSelectorItem secondItem = createItem(secondSelected);\n\n        handler.registerItem(secondItem);\n\n        handler.selectItem(secondItem);\n\n        verify(secondItem).select();\n        verify(firstItem).reset();\n\n        checkHandlerSelectedValue(secondSelected);\n    }\n\n    @Test\n    public void testSelectKeyWithoutSelectedValue() {\n\n        LiveSearchSelectorItem firstItem = createItem(\"a\");\n\n        handler.registerItem(firstItem);\n\n        LiveSearchSelectorItem secondItem = createItem(\"b\");\n\n        handler.registerItem(secondItem);\n\n        LiveSearchSelectorItem thirdItem = createItem(SELECTED_ITEM_TEXT);\n\n        handler.registerItem(thirdItem);\n\n        handler.selectKey(\"a\");\n\n        verify(handler).selectItem(firstItem);\n        verify(firstItem).select();\n\n        checkHandlerSelectedValue(\"a\");\n\n        handler.selectKey(\"b\");\n\n        verify(handler).selectItem(secondItem);\n        verify(secondItem).select();\n        verify(firstItem).reset();\n\n        checkHandlerSelectedValue(\"b\");\n\n        handler.selectKey(SELECTED_ITEM_TEXT);\n        verify(handler).selectItem(thirdItem);\n        verify(thirdItem).select();\n        verify(secondItem).reset();\n\n        checkHandlerSelectedValue(SELECTED_ITEM_TEXT);\n    }\n\n    @Test\n    public void testClearSelection() {\n        LiveSearchSelectorItem item = doTestSelectItem();\n\n        handler.clearSelection();\n\n        verify(item).reset();\n\n        checkHandlerSelectedValue(null);\n    }\n\n    private LiveSearchSelectorItem createItem(String value) {\n        LiveSearchSelectorItem item = mock(LiveSearchSelectorItem.class);\n\n        when(item.getKey()).thenReturn(value);\n        when(item.getValue()).thenReturn(value);\n\n        return item;\n    }\n\n    private void checkHandlerSelectedValue(String value) {\n        assertEquals(value, handler.getSelectedKey());\n        assertEquals(value, handler.getSelectedValue());\n        assertEquals(value, handler.getDropDownMenuHeader());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/footer/LiveSearchFooterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.dropdown.footer;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.widgets.common.client.dropdown.InlineCreationEditor;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LiveSearchFooterTest {\n\n    private static final String NEW_LABEL = \"new\";\n    private static final String RESET_LABEL = \"reset\";\n\n    @Mock\n    private HTMLElement editorElement;\n\n    @Mock\n    private InlineCreationEditor editor;\n\n    @Mock\n    private LiveSearchFooterView view;\n\n    @Mock\n    private Command onNewEntry;\n\n    @Mock\n    private Command onReset;\n\n    private LiveSearchFooter footer;\n\n    @Before\n    public void init() {\n        when(editor.getElement()).thenReturn(editorElement);\n\n        footer = new LiveSearchFooter(view);\n\n        footer.init(onNewEntry, onReset);\n    }\n\n    @Test\n    public void testFunctionallity() {\n\n        verify(view).init(footer);\n\n        footer.getElement();\n        verify(view).getElement();\n\n        footer.setNewEntryLabel(NEW_LABEL);\n        verify(view).setNewEntryLabel(NEW_LABEL);\n\n        footer.setResetLabel(RESET_LABEL);\n        verify(view).setResetLabel(RESET_LABEL);\n\n        footer.showReset(true);\n        verify(view).showReset(true);\n\n        footer.showAddNewEntry(true);\n        verify(view).showAddNewEntry(true);\n\n        footer.restore();\n        verify(view).restore();\n\n        footer.showEditor(editor);\n        verify(view).show(editorElement);\n\n        footer.onResetPressed();\n        verify(onReset).execute();\n\n        footer.onNewEntryPressed();\n        verify(onNewEntry).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/dropdown/noItems/NoItemsComponentTest.java",
    "content": "package org.uberfire.ext.widgets.common.client.dropdown.noItems;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class NoItemsComponentTest {\n\n    private static final String MESSAGE = \"a message\";\n\n    @Mock\n    private NoItemsComponentView view;\n\n    private NoItemsComponent component;\n\n    @Test\n    public void testFunctionality() {\n        component = new NoItemsComponent(view);\n\n        component.getElement();\n        verify(view).getElement();\n\n        component.show();\n        verify(view).show();\n\n        component.hide();\n        verify(view).hide();\n\n        component.setMessage(MESSAGE);\n        verify(view).setMessage(MESSAGE);\n\n        component.setMessage(null);\n        verify(view, times(2)).setMessage(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/menu/MenuItemFactoryTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport java.lang.annotation.Annotation;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.widgets.common.client.menu.MenuItemFactory.MenuItemViewHolder;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MenuItemFactoryTest {\n\n    @Mock\n    private ManagedInstance<MenuItemView> menuItemViewProducer;\n\n    @Mock\n    private ManagedInstance<MenuItemView> menuItemViewHeaderProducer;\n\n    @Mock\n    private ManagedInstance<MenuItemView> menuItemViewWithIconProducer;\n\n    @Mock\n    private ManagedInstance<MenuItemView> menuItemViewDividerProducer;\n\n    private MenuItemFactory menuItemFactory;\n    private Set<MenuItemView> menuItemFactoryViewMocks = new HashSet<>();\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n        menuItemFactory = new MenuItemFactory(menuItemViewProducer);\n        menuItemFactoryViewMocks.clear();\n\n        when(menuItemViewProducer.select(any(Annotation.class))).thenAnswer((o) -> {\n            final Annotation a = (Annotation) o.getArguments()[0];\n            if (a.annotationType().equals(MenuItemHeader.class)) {\n                return menuItemViewHeaderProducer;\n            } else if (a.annotationType().equals(MenuItemWithIcon.class)) {\n                return menuItemViewWithIconProducer;\n            } else if (a.annotationType().equals(MenuItemDivider.class)) {\n                return menuItemViewDividerProducer;\n            }\n            throw new IllegalArgumentException(\"Unexpected MenuItemView\");\n        });\n        when(menuItemViewHeaderProducer.get()).then(invocation -> {\n            final MenuItemHeaderView v = mock(MenuItemHeaderView.class);\n            menuItemFactoryViewMocks.add(v);\n            return v;\n        });\n        when(menuItemViewWithIconProducer.get()).then(invocation -> {\n            final MenuItemWithIconView v = mock(MenuItemWithIconView.class);\n            doCallRealMethod().when(v).onClickListItem(any(ClickEvent.class));\n            doCallRealMethod().when(v).setClickHandler(any(ClickHandler.class));\n            menuItemFactoryViewMocks.add(v);\n            return v;\n        });\n        when(menuItemViewDividerProducer.get()).then(invocation -> {\n            final MenuItemDividerView v = mock(MenuItemDividerView.class);\n            menuItemFactoryViewMocks.add(v);\n            return v;\n        });\n    }\n\n    @Test\n    public void checkMenuItemHeaderConstruction() {\n        final MenuItemViewHolder<MenuItemHeaderView> mih = menuItemFactory.makeMenuItemHeader(\"caption\");\n\n        assertNotNull(mih);\n        assertNotNull(mih.getMenuItem());\n        assertNotNull(mih.getMenuItemView());\n    }\n\n    @Test\n    public void checkMenuItemWithIconConstruction() {\n        final Command c = mock(Command.class);\n        final MenuItemViewHolder<MenuItemWithIconView> mih = menuItemFactory.makeMenuItemWithIcon(\"caption\",\n                                                                                                  c);\n\n        assertNotNull(mih);\n        assertNotNull(mih.getMenuItem());\n        assertNotNull(mih.getMenuItemView());\n    }\n\n    @Test\n    public void checkMenuItemDividerConstruction() {\n        final MenuItemViewHolder<MenuItemDividerView> mih = menuItemFactory.makeMenuItemDivider();\n\n        assertNotNull(mih);\n        assertNotNull(mih.getMenuItem());\n        assertNotNull(mih.getMenuItemView());\n    }\n\n    @Test\n    public void checkMenuItemWithIconEnabled() {\n        final Command c = mock(Command.class);\n        final MenuItemViewHolder<MenuItemWithIconView> mih = menuItemFactory.makeMenuItemWithIcon(\"caption\",\n                                                                                                  c);\n\n        mih.getMenuItem().setEnabled(true);\n        verify(mih.getMenuItemView(),\n               times(1)).setEnabled(eq(true));\n\n        mih.getMenuItemView().onClickListItem(mock(ClickEvent.class));\n\n        verify(c,\n               times(1)).execute();\n    }\n\n    @Test\n    public void checkMenuItemWithIconDisabled() {\n        final Command c = mock(Command.class);\n        final MenuItemViewHolder<MenuItemWithIconView> mih = menuItemFactory.makeMenuItemWithIcon(\"caption\",\n                                                                                                  c);\n\n        mih.getMenuItem().setEnabled(false);\n        verify(mih.getMenuItemView(),\n               times(1)).setEnabled(eq(false));\n\n        mih.getMenuItemView().onClickListItem(mock(ClickEvent.class));\n\n        verify(c,\n               never()).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/menu/RefreshMenuBuilderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RefreshMenuBuilderTest {\n\n    @Mock\n    RefreshMenuBuilder.SupportsRefresh supportsRefresh;\n\n    RefreshMenuBuilder refreshMenuBuilder;\n\n    @GwtMock\n    Button menuRefreshButton;\n\n    ClickHandler clickHandler;\n\n    @Before\n    public void setup() {\n        when(menuRefreshButton.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n        refreshMenuBuilder = new RefreshMenuBuilder(supportsRefresh);\n    }\n\n    @Test\n    public void testRefresh() {\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(supportsRefresh).onRefresh();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/menu/RefreshSelectorMenuBuilderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.menu;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RefreshSelectorMenuBuilderTest {\n\n    @Mock\n    RefreshSelectorMenuBuilder.SupportsRefreshInterval supportsRefreshInterval;\n\n    RefreshSelectorMenuBuilder refreshSelectorMenuBuilder;\n\n    @GwtMock\n    AnchorListItem oneMinuteRadioButton;\n\n    ClickHandler clickHandler;\n\n    @Before\n    public void setup() {\n        when(oneMinuteRadioButton.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n        refreshSelectorMenuBuilder = new RefreshSelectorMenuBuilder(supportsRefreshInterval);\n    }\n\n    @Test\n    public void testUpdateRefreshInterval() {\n        int time = 1;\n        refreshSelectorMenuBuilder.createTimeSelector(time,\n                                                      \"\",\n                                                      time,\n                                                      mock(AnchorListItem.class));\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(supportsRefreshInterval).onUpdateRefreshInterval(true,\n                                                                time);\n        verify(oneMinuteRadioButton,\n               times(2)).setIcon(IconType.CHECK);\n    }\n\n    @Test\n    public void testSelectedRefreshInterval() {\n        int time = 1;\n        int selectedTime = 2;\n        refreshSelectorMenuBuilder.createTimeSelector(time,\n                                                      \"\",\n                                                      selectedTime,\n                                                      mock(AnchorListItem.class));\n\n        verify(oneMinuteRadioButton,\n               never()).setIcon(any(IconType.class));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/select/SelectComponentTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SelectComponentTest {\n\n    @Mock\n    private SelectComponent.View view;\n\n    @Mock\n    private ManagedInstance<SelectOptionComponent> selectOptionComponents;\n    private SelectComponent component;\n    private SelectOption option1;\n\n    @Mock\n    private Consumer<SelectOption> callback;\n\n    @Mock\n    private SelectOptionComponent selectOptionComponent;\n\n    @Before\n    public void setUp() {\n\n        option1 = new SelectOptionImpl(\"FIRST\",\n                                       \"first\");\n\n        component = spy(new SelectComponent(view,\n                                            selectOptionComponents));\n\n        when(this.selectOptionComponents.get()).thenReturn(this.selectOptionComponent);\n\n        component.init();\n    }\n\n    @Test\n    public void testSetup() {\n        component.setup(Arrays.asList(option1),\n                        callback);\n        verify(selectOptionComponent).initialize(eq(option1),\n                                                 any());\n    }\n\n    @Test\n    public void testEmptySelectOptions() {\n        component.setup(Arrays.asList(),\n                        callback);\n        verify(selectOptionComponent,\n               never()).initialize(eq(option1),\n                                   any());\n    }\n\n    @Test\n    public void testSelectOption() {\n\n        List<Consumer<SelectOption>> consumer = new ArrayList();\n\n        doAnswer(invocation -> {\n            consumer.add((Consumer<SelectOption>) invocation.getArguments()[1]);\n            return null;\n        }).when(this.selectOptionComponent).initialize(any(),\n                                                       any());\n\n        doAnswer(invocation -> {\n            consumer.get(0).accept(option1);\n            return null;\n        }).when(selectOptionComponent).select();\n\n        component.setup(Arrays.asList(option1),\n                        callback);\n        selectOptionComponent.select();\n\n        verify(this.component,\n               times(1)).deactivateAll();\n\n        verify(this.callback,\n               times(1)).accept(option1);\n\n        verify(selectOptionComponent,\n               times(1)).activate();\n\n        verify(view,\n               atLeastOnce()).setSelected(eq(this.option1.getName()));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/select/SelectOptionComponentTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.widgets.common.client.select;\n\nimport java.util.function.Consumer;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SelectOptionComponentTest {\n\n    @Mock\n    private SelectOptionComponent.View view;\n\n    @Mock\n    private Consumer<SelectOption> callback;\n\n    private SelectOptionComponent component;\n\n    private SelectOptionImpl option;\n\n    @Before\n    public void setUp() {\n        this.option = new SelectOptionImpl(\"OPTION\",\n                                           \"Option\");\n\n        component = new SelectOptionComponent(this.view);\n        component.initialize(option,\n                             callback);\n    }\n\n    @Test\n    public void testSelectOption() {\n        this.component.select();\n        verify(this.callback,\n               times(1)).accept(eq(this.option));\n    }\n\n    @Test\n    public void testActivate() {\n        this.component.activate();\n        verify(this.view,\n               times(1)).setActive(true);\n    }\n\n    @Test\n    public void testDeactivate() {\n        this.component.deactivate();\n        verify(this.view,\n               times(1)).setActive(false);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/tables/ColumnPickerTest.java",
    "content": "/*\n * Copyright 2019 JBoss Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.google.common.collect.Lists;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\nimport com.google.gwt.user.cellview.client.TextHeader;\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.services.shared.preferences.GridColumnPreference;\nimport org.uberfire.ext.widgets.table.client.ColumnMeta;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@SuppressWarnings(\"unchecked\")\n@RunWith(GwtMockitoTestRunner.class)\npublic class ColumnPickerTest {\n\n    @InjectMocks\n    ColumnPicker columnPicker;\n\n    @GwtMock\n    DataGrid dataGrid;\n\n    @GwtMock\n    Button toggleButton;\n\n    @GwtMock\n    PopupPanel popup;\n\n    ClickHandler clickHandler;\n\n    @Before\n    public void setUp() throws Exception {\n        final List<Column> columns = new ArrayList<Column>();\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                columns.add((Column) invocationOnMock.getArguments()[0]);\n                return null;\n            }\n        }).when(dataGrid).addColumn(any(Column.class), any(Header.class));\n\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                columns.add((Column) invocationOnMock.getArguments()[1]);\n                return null;\n            }\n        }).when(dataGrid).insertColumn(any(int.class),\n                                       any(Column.class),\n                                       any(Header.class));\n\n        doAnswer(new Answer<Integer>() {\n            @Override\n            public Integer answer(InvocationOnMock invocationOnMock) throws Throwable {\n                return columns.size();\n            }\n        }).when(dataGrid).getColumnCount();\n\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocationOnMock) throws Throwable {\n                columns.remove(0);\n                return null;\n            }\n        }).when(dataGrid).removeColumn(0);\n\n        when(toggleButton.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n    }\n\n    @Test\n    public void testAddRemoveColumn() {\n        final Column column = mock(Column.class);\n        when(column.getDataStoreName()).thenReturn(\"id\");\n        final ColumnMeta meta = new ColumnMeta(column, \"caption\");\n        meta.setHeader(new TextHeader(\"header\"));\n\n        columnPicker.addColumn(meta);\n\n        assertTrue(columnPicker.getColumnMetaList().contains(meta));\n        verify(dataGrid).insertColumn(0, column, meta.getHeader());\n        assertEquals(1, dataGrid.getColumnCount());\n\n        columnPicker.removeColumn(meta);\n\n        assertFalse(columnPicker.getColumnMetaList().contains(meta));\n        verify(dataGrid).removeColumn(0);\n        assertEquals(0, dataGrid.getColumnCount());\n    }\n\n\n    @Test\n    public void testSortColumn() {\n        final Column column1 = mock(Column.class);\n        final ColumnMeta meta1 = new ColumnMeta(column1, \"caption1\", true, 1);\n        meta1.setHeader(new TextHeader(\"header1\"));\n        final Column column0 = mock(Column.class);\n        final ColumnMeta meta0 = new ColumnMeta(column0, \"caption0\", true, 0);\n        meta0.setHeader(new TextHeader(\"header0\"));\n\n        columnPicker.addColumns(Arrays.asList(meta1, meta0));\n\n        assertEquals(2, columnPicker.getColumnMetaList().size());\n        verify(dataGrid).insertColumn(0, column0, meta0.getHeader());\n        verify(dataGrid).insertColumn(1, column1, meta1.getHeader());\n        assertEquals(2, dataGrid.getColumnCount());\n    }\n\n    @Test\n    public void testColumnPreference() {\n        final Column column = mock(Column.class);\n        when(column.getDataStoreName()).thenReturn(\"id\");\n        final ColumnMeta meta = new ColumnMeta(column, \"caption\");\n        meta.setHeader(new TextHeader(\"header\"));\n\n        columnPicker.addColumn(meta);\n        final List<GridColumnPreference> columnsState = columnPicker.getColumnsState();\n        assertEquals(1, columnsState.size());\n\n        final GridColumnPreference preference = columnsState.get(0);\n        assertEquals(preference.getName(), column.getDataStoreName());\n        assertEquals(0, preference.getPosition().intValue());\n    }\n\n    @Test\n    public void testToggleButton() {\n        columnPicker.createToggleButton();\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(popup).show();\n\n        when(toggleButton.isActive()).thenReturn(true);\n\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(popup).hide(false);\n    }\n\n    @Test\n    public void testAdjustColumnWidths() {\n        final Column column1 = createColumn(\"col1\", \"col1\");\n        final ColumnMeta meta1 = new ColumnMeta(column1, \"caption1\", true, 1);\n        meta1.setHeader(new TextHeader(\"header1\"));\n        final Column column2 = createColumn(\"col2\", \"col2\");\n        final ColumnMeta meta2 = new ColumnMeta(column2, \"caption2\", true, 0);\n        meta2.setHeader(new TextHeader(\"header2\"));\n        final Column column3 = createColumn(\"col3\", \"col3\");\n        final ColumnMeta meta3 = new ColumnMeta(column3, \"caption3\", true, 0);\n        meta3.setHeader(new TextHeader(\"header3\"));\n\n        when(dataGrid.getColumnWidth(column1)).thenReturn(\"35px\");\n        when(dataGrid.getColumnWidth(column2)).thenReturn(null);\n        when(dataGrid.getColumnWidth(column3)).thenReturn(null);\n\n        List<ColumnMeta> columnMetasList = new ArrayList<ColumnMeta>();\n        columnMetasList.add(meta1);\n        columnMetasList.add(meta2);\n        columnMetasList.add(meta3);\n        columnPicker.addColumns(columnMetasList);\n\n        verify(dataGrid).setColumnWidth(column1, \"35px\");\n        verify(dataGrid).setColumnWidth(column2, 50, Style.Unit.PCT);\n        verify(dataGrid).setColumnWidth(column3, 50, Style.Unit.PCT);\n    }\n\n    private Column createColumn(String value,\n                                String dataStoreName) {\n\n        Column<String, String> testColumn = new Column<String, String>(new TextCell()) {\n            @Override\n            public String getValue(String object) {\n                return value;\n            }\n        };\n        testColumn.setSortable(true);\n        testColumn.setDataStoreName(dataStoreName);\n        return testColumn;\n    }\n\n    @Test\n    public void testSetColumnWidth() {\n        final Column column1 = createColumn(\"col1\", \"col1\");\n        final ColumnMeta meta1 = new ColumnMeta(column1, \"caption1\", true, 1);\n        final Column column2 = createColumn(\"col2\", \"col2\");\n        final ColumnMeta meta2 = new ColumnMeta(column2, \"caption2\", true, 0);\n\n        when(dataGrid.getColumnWidth(column1)).thenReturn(\"38.0px\");\n\n        columnPicker.addColumns(Lists.newArrayList(meta1, meta2));\n\n        verify(dataGrid).setColumnWidth(eq(column1), eq(\"38px\"));\n    }\n\n    @Test\n    public void testAddColumnsIncrementally() {\n        final Column column1 = createColumn(\"col1\", \"col1\");\n        final ColumnMeta meta1 = new ColumnMeta(column1, \"caption1\", true, 0);\n        final Column column2 = createColumn(\"col2\", \"col2\");\n        final ColumnMeta meta2 = new ColumnMeta(column2, \"caption2\", true, 1);\n\n        when(dataGrid.getColumn(0)).thenReturn(column1);\n        when(dataGrid.getColumn(1)).thenReturn(column2);\n        when(dataGrid.getColumnWidth(column1)).thenReturn(\"100px\");\n        when(dataGrid.getColumnWidth(column2)).thenReturn(\"90%\");\n\n        columnPicker.addColumns(Collections.singletonList(meta1));\n\n        verify(dataGrid).setColumnWidth(eq(column1), eq(100.0), eq(Style.Unit.PCT));\n\n        columnPicker.addColumns(Collections.singletonList(meta2));\n\n        verify(dataGrid).setColumnWidth(eq(column1), eq(\"100px\"));\n        verify(dataGrid).setColumnWidth(eq(column2), eq(100.0), eq(Style.Unit.PCT));\n    }\n\n    @Test\n    public void testDataGridMinWidthCalculation() {\n        int defaultColumnWidthSize = 150;\n        int fixedColumn1Width = 38;\n        final Column column1 = createColumn(\"col1\", \"col1\");\n        final ColumnMeta meta1 = new ColumnMeta(column1, \"caption1\", true, 1);\n        final Column column2 = createColumn(\"col2\", \"col2\");\n        final ColumnMeta meta2 = new ColumnMeta(column2, \"caption2\", true, 0);\n        final Column column3 = createColumn(\"col3\", \"col3\");\n        final ColumnMeta meta3 = new ColumnMeta(column3, \"caption3\", false, 2);\n\n        when(dataGrid.getColumn(0)).thenReturn(column1);\n        when(dataGrid.getColumn(1)).thenReturn(column2);\n        when(dataGrid.getColumnWidth(column1)).thenReturn(fixedColumn1Width + Style.Unit.PX.getType());\n        when(dataGrid.getColumnWidth(column2)).thenReturn(100 + Style.Unit.PC.getType());\n        when(dataGrid.getColumnWidth(column3)).thenReturn(57 + Style.Unit.PX.getType());\n\n        columnPicker.addColumns(Arrays.asList(meta1, meta2, meta3));\n        assertEquals(fixedColumn1Width + ColumnPicker.DETAULT_COLUMN_WIDTH, columnPicker.getDataGridMinWidth());\n\n        columnPicker.setDefaultColumnWidthSize(defaultColumnWidthSize);\n        columnPicker.adjustColumnWidths();\n        assertEquals(fixedColumn1Width + defaultColumnWidthSize, columnPicker.getDataGridMinWidth());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/tables/FilterPagedTableTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ext.services.shared.preferences.MultiGridPreferencesStore;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.ext.widgets.common.client.tables.popup.NewTabFilterPopup;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(Modal.class)\npublic class FilterPagedTableTest {\n\n    @InjectMocks\n    @Spy\n    FilterPagedTable filterPagedTable;\n\n    @GwtMock\n    Button button;\n\n    @Mock\n    protected MultiGridPreferencesStore multiGridPreferencesStoreMock;\n\n    @GwtMock\n    protected PagedTable pagedTableMock;\n\n    @GwtMock\n    protected YesNoCancelPopup yesNoCancelPopupMock;\n\n    @GwtMock\n    TabListItem tabListItem;\n\n    @GwtMock\n    NavTabs navTabs;\n\n    ClickHandler clickHandler;\n\n    @Before\n    public void setup(){\n        filterPagedTable.makeWidget();\n    }\n\n    @Test\n    public void testAddTab() throws Exception {\n        when(navTabs.getWidget(anyInt())).thenReturn(tabListItem);\n\n        filterPagedTable.addTab(pagedTableMock, \"base\", mock(Command.class));\n\n        verify(tabListItem, times(1)).showTab();\n\n        filterPagedTable.addTab(pagedTableMock, \"base\", mock(Command.class), true);\n\n        verify(tabListItem, times(2)).showTab();\n\n        filterPagedTable.addTab(pagedTableMock, \"base\", mock(Command.class), false);\n\n        verify(tabListItem, times(2)).showTab();\n    }\n\n    @Test\n    public void testRemoveTab() throws Exception {\n        final Element element = mock(Element.class);\n        when(element.getStyle()).thenReturn(mock(Style.class));\n        when(button.getElement()).thenReturn(element);\n        when(button.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n\n        final YesNoCancelPopup yesNoCancelPopup = mock(YesNoCancelPopup.class);\n        doReturn(yesNoCancelPopup).when(filterPagedTable).getYesNoCancelPopup(anyString(), anyString());\n\n        filterPagedTable.addTab(mock(PagedTable.class), \"\", mock(Command.class));\n\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(yesNoCancelPopup).show();\n        verify(filterPagedTable, never()).removeTab(anyInt());\n        verify(filterPagedTable, never()).removeTab(anyString());\n    }\n\n    @Test\n    public void testScapeHtmlCodeInDescriptionRemoveTab() throws Exception {\n        String key = \"test\";\n        String header = \"*<h1>test</h1>*\";\n        String title = \"*<h1>test</h1>*\";\n\n        final Element element = mock(Element.class);\n        when(element.getStyle()).thenReturn(mock(Style.class));\n        when(button.getElement()).thenReturn(element);\n        when(button.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n\n        doReturn(yesNoCancelPopupMock).when(filterPagedTable).getYesNoCancelPopup(eq(SafeHtmlUtils.htmlEscape(header)), anyString());\n\n        when(multiGridPreferencesStoreMock.getGridSettingParam(eq(key),eq(NewTabFilterPopup.FILTER_TAB_NAME_PARAM))).thenReturn(header);\n        when(multiGridPreferencesStoreMock.getGridSettingParam(eq(key),eq(NewTabFilterPopup.FILTER_TAB_DESC_PARAM))).thenReturn(title);\n\n        filterPagedTable.addTab(pagedTableMock, key, mock(Command.class));\n\n        clickHandler.onClick(new ClickEvent() {\n        });\n\n        verify(pagedTableMock).addTableTitle(eq(SafeHtmlUtils.htmlEscape(title)));\n        verify(yesNoCancelPopupMock).show();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/tables/PagedTableTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.gwtbootstrap3.extras.select.client.ui.Select;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.services.shared.preferences.GridGlobalPreferences;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.services.shared.preferences.UserPreference;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesService;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.jgroups.util.Util.assertFalse;\nimport static org.jgroups.util.Util.assertTrue;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.ext.widgets.common.client.tables.PagedTable.DEFAULT_PAGE_SIZE;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Image.class, Label.class, Text.class})\npublic class PagedTableTest {\n\n    @GwtMock\n    AsyncDataProvider dataProvider;\n\n    @GwtMock\n    Select select;\n\n    protected CallerMock<UserPreferencesService> userPreferencesService;\n\n    @Mock\n    protected UserPreferencesService userPreferencesServiceMock;\n\n    @Before\n    public void setupMocks() {\n        userPreferencesService = new CallerMock<>(userPreferencesServiceMock);\n    }\n\n    @Test\n    public void testSetDataProvider() throws Exception {\n        PagedTable pagedTable = new PagedTable();\n\n        pagedTable.setDataProvider(dataProvider);\n        verify(dataProvider).addDataDisplay(pagedTable);\n    }\n\n    @Test\n    public void testDataGridHeight() throws Exception {\n        final int PAGE_SIZE = 10;\n        final int ROWS = 2;\n        final int EXPECTED_HEIGHT_PX = PagedTable.HEIGHT_OFFSET_PX;\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false);\n        pagedTable.dataGrid = spy(pagedTable.dataGrid);\n        when(pagedTable.dataGrid.getRowCount()).thenReturn(ROWS);\n\n        verify(pagedTable.dataGrid, times(0)).setHeight(anyString());\n        pagedTable.loadPageSizePreferences();\n        verify(pagedTable.dataGrid, times(1)).setHeight(eq(EXPECTED_HEIGHT_PX + \"px\"));\n    }\n\n    @Test\n    public void testDataGridHeightWithMoreItemsThanPaging() throws Exception {\n        final int PAGE_SIZE = 10;\n        final int ROWS = 12;\n        final int EXPECTED_HEIGHT_PX = PagedTable.HEIGHT_OFFSET_PX;\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false);\n        pagedTable.dataGrid = spy(pagedTable.dataGrid);\n        when(pagedTable.dataGrid.getRowCount()).thenReturn(ROWS);\n\n        verify(pagedTable.dataGrid, times(0)).setHeight(anyString());\n        pagedTable.loadPageSizePreferences();\n        verify(pagedTable.dataGrid, times(1)).setHeight(eq(EXPECTED_HEIGHT_PX + \"px\"));\n    }\n\n    @Test\n    public void testLoadPageSizePreferencesResetsPageStart() throws Exception {\n        final int PAGE_SIZE = 10;\n\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE);\n        pagedTable.dataGrid = spy(pagedTable.dataGrid);\n\n        verify(pagedTable.dataGrid, times(0)).setPageStart(0);\n\n        pagedTable.loadPageSizePreferences();\n        verify(pagedTable.dataGrid, times(1)).setPageStart(0);\n    }\n\n    @Test\n    public void testPageSizeSelectStartValue() throws Exception {\n        final int size = 10;\n\n        new PagedTable(size);\n\n        verify(select).setValue(String.valueOf(size));\n        verify(select).addValueChangeHandler(any());\n    }\n\n    @Test\n    public void testDefaultPageSizeValue() throws Exception {\n        new PagedTable();\n\n        verify(select).setValue(String.valueOf(DEFAULT_PAGE_SIZE));\n        verify(select).addValueChangeHandler(any());\n    }\n\n    @Test\n    public void testDataGridMinWidthNotSetByDefault() throws Exception {\n        final int PAGE_SIZE = 10;\n        Element mockElement = mock(Element.class);\n        final int minWidth = 800;\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false);\n        ColumnPicker columnPickerMock = mock(ColumnPicker.class);\n\n        when(pagedTable.dataGridContainer.getElement()).thenReturn(mockElement);\n        when(columnPickerMock.getDataGridMinWidth()).thenReturn(minWidth);\n\n        pagedTable.setColumnPicker(columnPickerMock);\n        pagedTable.setTableHeight();\n\n        verify(mockElement, never()).setAttribute(eq(\"style\"), anyString());\n    }\n\n    @Test\n    public void testEnableDataGridMinWidth() throws Exception {\n        final int PAGE_SIZE = 10;\n        Element mockElement = mock(Element.class);\n        final int minWidth = 800;\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false);\n        ColumnPicker columnPickerMock = mock(ColumnPicker.class);\n\n        when(pagedTable.dataGridContainer.getElement()).thenReturn(mockElement);\n        when(columnPickerMock.getDataGridMinWidth()).thenReturn(minWidth);\n\n        pagedTable.setColumnPicker(columnPickerMock);\n        pagedTable.enableDataGridMinWidth(true);\n        pagedTable.setTableHeight();\n\n        verify(columnPickerMock, never()).setDefaultColumnWidthSize(anyInt());\n        verify(mockElement).setAttribute(\"style\", \"min-width:\" + minWidth + Style.Unit.PX.getType());\n    }\n\n    @Test\n    public void testDefaultColumnWidth() throws Exception {\n        final int PAGE_SIZE = 10;\n        Element mockElement = mock(Element.class);\n        final int minWidth = 800;\n        PagedTable pagedTable = new PagedTable(PAGE_SIZE, null, null, false, false, false);\n        ColumnPicker columnPickerMock = mock(ColumnPicker.class);\n\n        when(pagedTable.dataGridContainer.getElement()).thenReturn(mockElement);\n        when(columnPickerMock.getDataGridMinWidth()).thenReturn(minWidth);\n\n        pagedTable.setColumnPicker(columnPickerMock);\n        pagedTable.setDefaultColumWidthSize(150);\n        pagedTable.enableDataGridMinWidth(true);\n        pagedTable.setTableHeight();\n\n        verify(columnPickerMock).setDefaultColumnWidthSize(150);\n        verify(mockElement).setAttribute(\"style\", \"min-width:\" + minWidth + Style.Unit.PX.getType());\n    }\n\n    @Test\n    public void testPreferencesPersistenceOnChange(){\n        PagedTable pagedTable = new PagedTable();\n        GridPreferencesStore gridPreferencesStore = new GridPreferencesStore(new GridGlobalPreferences(\"key\", null, null));\n        pagedTable.setGridPreferencesStore(gridPreferencesStore);\n        pagedTable.setPreferencesService(userPreferencesService);\n\n        when(select.getValue()).thenReturn(\"20\");\n\n        ArgumentCaptor<ValueChangeHandler> sizeSelectorChangeHandlerArgumentCaptor = ArgumentCaptor.forClass(ValueChangeHandler.class);\n        verify(select).addValueChangeHandler(sizeSelectorChangeHandlerArgumentCaptor.capture());\n\n        pagedTable.setPersistPreferencesOnChange(true);\n        assertTrue(pagedTable.isPersistingPreferencesOnChange());\n        sizeSelectorChangeHandlerArgumentCaptor.getValue().onValueChange(mock(ValueChangeEvent.class));\n        verify(userPreferencesServiceMock).saveUserPreferences(any(UserPreference.class));\n\n        pagedTable.setPersistPreferencesOnChange(false);\n        assertFalse(pagedTable.isPersistingPreferencesOnChange());\n        sizeSelectorChangeHandlerArgumentCaptor.getValue().onValueChange(mock(ValueChangeEvent.class));\n        pagedTable.afterColumnChangedHandler();\n        verifyNoMoreInteractions(userPreferencesServiceMock);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-commons/src/test/java/org/uberfire/ext/widgets/common/client/tables/SimpleTableTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.tables;\n\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Image;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.services.shared.preferences.GridGlobalPreferences;\nimport org.uberfire.ext.services.shared.preferences.GridPreferencesStore;\nimport org.uberfire.ext.services.shared.preferences.UserPreference;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesService;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesType;\nimport org.uberfire.ext.widgets.table.client.DataGrid;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub({Image.class, Label.class, Text.class})\npublic class SimpleTableTest {\n\n    @GwtMock\n    DataGrid dataGridMock;\n\n    protected CallerMock<UserPreferencesService> userPreferencesService;\n\n    @Mock\n    protected UserPreferencesService userPreferencesServiceMock;\n\n    private SimpleTable simpleTable;\n    private GridPreferencesStore gridPreferencesStore;\n\n    @Before\n    public void setupMocks() {\n        simpleTable = new SimpleTable();\n        gridPreferencesStore = new GridPreferencesStore(new GridGlobalPreferences(\"key\", null, null));\n        simpleTable.setGridPreferencesStore(gridPreferencesStore);\n\n        userPreferencesService = new CallerMock<>(userPreferencesServiceMock);\n        simpleTable.setPreferencesService(userPreferencesService);\n    }\n\n    @Test\n    public void testRedrawFlush() throws Exception {\n        this.simpleTable = new SimpleTable();\n\n        simpleTable.dataGrid = dataGridMock;\n        simpleTable.redraw();\n        verify(dataGridMock).redraw();\n        verify(dataGridMock).flush();\n    }\n\n    @Test\n    public void testSavePreferencesAfterColumnChangeByDefault() {\n        simpleTable.afterColumnChangedHandler();\n\n        assertTrue(simpleTable.isPersistingPreferencesOnChange());\n        verify(userPreferencesServiceMock).saveUserPreferences(any(UserPreference.class));\n    }\n\n    @Test\n    public void testSavePreferencesAfterColumnChangeConf() {\n        simpleTable.setPersistPreferencesOnChange(true);\n        simpleTable.afterColumnChangedHandler();\n\n        verify(userPreferencesServiceMock).saveUserPreferences(any(UserPreference.class));\n\n        simpleTable.setPersistPreferencesOnChange(false);\n        simpleTable.afterColumnChangedHandler();\n\n        verifyNoMoreInteractions(userPreferencesServiceMock);\n    }\n    @Test\n    public void testDefaultSavePreferencesUsingGlobalPreferencesKey() {\n        String newKey = \"newKey\";\n        gridPreferencesStore.setPreferenceKey(newKey);\n\n        simpleTable.saveGridPreferences();\n\n        ArgumentCaptor<UserPreference> argumentCaptor = ArgumentCaptor.forClass(UserPreference.class);\n        verify(userPreferencesServiceMock).saveUserPreferences(argumentCaptor.capture());\n\n        assertEquals(gridPreferencesStore.getGlobalPreferences().getKey(), argumentCaptor.getValue().getPreferenceKey());\n        assertNotEquals(newKey, argumentCaptor.getValue().getPreferenceKey());\n        assertEquals(UserPreferencesType.GRIDPREFERENCES, argumentCaptor.getValue().getType());\n    }\n\n    @Test\n    public void testSaveUserPreferencesUsingPreferencesKey() {\n        String newKey = \"newKey\";\n        gridPreferencesStore.setPreferenceKey(newKey);\n\n        simpleTable.saveGridToUserPreferences();\n\n        ArgumentCaptor<UserPreference> argumentCaptor = ArgumentCaptor.forClass(UserPreference.class);\n        verify(userPreferencesServiceMock).saveUserPreferences(argumentCaptor.capture());\n\n        assertEquals(newKey, argumentCaptor.getValue().getPreferenceKey());\n        assertEquals(UserPreferencesType.GRIDPREFERENCES, argumentCaptor.getValue().getType());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-core</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Widgets Core</name>\n  <description>Uberfire Widgets Core</description>\n\n  <modules>\n    <module>uberfire-widgets-core-client</module>\n    <module>uberfire-widgets-core-ace</module>\n    <module>uberfire-widgets-core-editors</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-core-ace</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Widgets Core Ace Editor</name>\n  <description>Uberfire Widgets Core Ace Editor</description>\n\n  <dependencies>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <resources>\n      <!-- Include src/main/java in order not to break the Eclipse GWT plug-in -->\n      <resource>\n        <directory>src/main/java</directory>\n      </resource>\n      <!-- Include module descriptors from src/main/resources in order not to break the Intellij GWT plug-in -->\n      <resource>\n        <directory>src/main/resources</directory>\n      </resource>\n    </resources>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceAnnotation.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Represents an AceAnnotation object\n */\nclass AceAnnotation extends JavaScriptObject {\n\n    protected AceAnnotation() {\n    }\n\n    public static native AceAnnotation create(int row,\n                                              int column,\n                                              String text,\n                                              String type) /*-{\n        return {row: row, column: column, text: text, type: type};\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceAnnotationType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * Enumeration for ACE annotation types.\n */\npublic enum AceAnnotationType {\n    ERROR(\"error\"),\n    INFORMATION(\"information\"),\n    WARNING(\"warning\");\n\n    private final String name;\n\n    private AceAnnotationType(final String name) {\n        this.name = name;\n    }\n\n    /**\n     * @return the theme name (e.g., \"error\")\n     */\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * Enumeration for ACE command types.\n */\npublic enum AceCommand {\n    FIND(\"find\"),\n    FIND_NEXT(\"findnext\"),\n    FIND_PREVIOUS(\"findprevious\"),\n    GOTO_LINE(\"gotoline\"),\n    REPLACE(\"replace\"),\n    REPLACE_ALL(\"replaceall\");\n\n    private final String name;\n\n    private AceCommand(final String name) {\n        this.name = name;\n    }\n\n    /**\n     * @return the theme name (e.g., \"error\")\n     */\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletion.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * A completion proposed by an {@link AceCompletionProvider}.\n * <p>\n * <strong>Warning</strong>: this is an experimental feature of AceGWT.\n * It is possible that the API will change in an incompatible way\n * in future releases.\n */\npublic abstract class AceCompletion {\n\n    /**\n     * A completion maps to a generated JavaScript object in a variety of formats depending on the concrete implementation\n     * @return A non-null JavaScript object.\n     */\n    abstract JavaScriptObject toJsObject();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * Callback interface for submitting code completion proposals.\n */\npublic interface AceCompletionCallback {\n\n    /**\n     * Submit code completion proposals.\n     * @param proposals the code completion proposals to submit\n     */\n    public void invokeWithCompletions(AceCompletion[] proposals);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionCallbackImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\n\n/**\n * Implementation of {@link AceCompletionCallback}\n * that delegates to a native JavaScript Ace code completion\n * callback.\n */\nclass AceCompletionCallbackImpl implements AceCompletionCallback {\n\n    private JavaScriptObject jsCallback;\n\n    public AceCompletionCallbackImpl(JavaScriptObject jsCallback) {\n        this.jsCallback = jsCallback;\n    }\n\n    @Override\n    public void invokeWithCompletions(AceCompletion[] proposals) {\n        JsArray<JavaScriptObject> jsProposals = JavaScriptObject.createArray().cast();\n        for (AceCompletion proposal : proposals) {\n            jsProposals.push(proposal.toJsObject());\n        }\n        doInvokeWithCompletions(jsProposals);\n    }\n\n    private native void doInvokeWithCompletions(JsArray<JavaScriptObject> jsProposals) /*-{\n        var callback = this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionCallbackImpl::jsCallback;\n        callback(null, jsProposals);\n    }-*/;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionProvider.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * A provider of custom code-completion proposals.\n * <p>\n * <strong>Warning</strong>: this is an experimental feature of AceGWT.\n * It is possible that the API will change in an incompatible way\n * in future releases.\n */\npublic interface AceCompletionProvider {\n\n    /**\n     * Call to get code completion proposals, which are delivered\n     * to a callback. Note that it is fine for this method to\n     * invoke the callback at a later time (for example, on completion\n     * of RPC.)\n     * @param editor the {@link AceEditor}\n     * @param pos the cursor position\n     * @param prefix the word prefix\n     * @param callback the {@link AceCompletionCallback} to which the\n     * proposals should be delivered\n     */\n    public void getProposals(AceEditor editor,\n                             AceEditorCursorPosition pos,\n                             String prefix,\n                             AceCompletionCallback callback);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionSnippet.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * A completion proposed by an {@link AceCompletionProvider}. This particular implementation\n * allows for tabstops to be defines post-sunstitution.<br/><br/>This is useful when providing substitutions with\n * a default value in the centre of the substituted text value that typically has to be overwritten by the user or\n * when substituting several values that should be modified by the user.<br/><br/>\n * <p>\n * There are two different constructors, a simple constructor that trust the user to manually escape the snippet text, and\n * a constructor where the escaping and tokenization is managed.<br/><br/>\n * <p>\n * <strong>Warning</strong>: this is an experimental feature of AceGWT.\n * It is possible that the API will change in an incompatible way\n * in future releases.\n */\npublic class AceCompletionSnippet extends AceCompletion {\n\n    /**\n     * The caption of the completion (this is the left aligned autocompletion name on the left side of items in the dropdown box. If only a single completion is available in a context, then the caption will not be seen.\n     */\n    private final String caption;\n\n    /**\n     * The snippet text of the substitution, this should be in the format start-${0:snippetText}-after-${1:nexttabstop}-after. $ and backslash should be escaped with a leading backslash\n     */\n    private final String snippet;\n\n    /**\n     * \"meta\" means the category of the substitution (this appears right aligned on the dropdown list). This is freeform description and can contain anything but typically a very short category description (9 chars or less) such as \"function\" or \"param\" or \"template\".\n     */\n    private final String meta;\n\n    /**\n     * The score is the value assigned to the autocompletion option. Scores with a higher value will appear closer to the top. Items with an identical score are sorted alphbetically by caption in the drop down.\n     */\n    private final int score;\n\n    /**\n     * Creates a snippet type substitution. A snippet-type substitution allows for tab-stop regions to be defined, in which text is automatically selected immediately the\n     * autocomplete substitution. Multiple regions may be defined to be tabbed through for user editing.<br/><br/>This may be useful if a substiution is a template type subsitution where\n     * several areas of the template typically need to be edited always after a substitution. Being able to tab through the regions rather than having to manually locate and edit\n     * is a lot faster when dealing with potentially repeated text editing usage patterns.\n     * @param caption The caption of the completion (this is the left aligned autocompletion name on the left side of items in the dropdown box. If only a single completion is available in a context, then the caption will not be seen.\n     * @param snippetSegments The segments that make up this snippet. None of these segments needs to be escaped, this will be handled automatically.\n     * @param meta \"meta\" means the category of the substitution (this appears right aligned on the dropdown list). This is freeform description and can contain anything but typically a very short category description (9 chars or less) such as \"function\" or \"param\" or \"template\".\n     * @param score The score is the value assigned to the autocompletion option. Scores with a higher value will appear closer to the top. Items with an identical score are sorted alphbetically by caption in the drop down.\n     */\n    public AceCompletionSnippet(String caption,\n                                AceCompletionSnippetSegment[] snippetSegments,\n                                String meta,\n                                int score) {\n        this.caption = caption;\n        this.score = score;\n        this.meta = meta;\n\n        StringBuilder sb = new StringBuilder();\n\n        int tabStopNumber = 1;\n\n        for (AceCompletionSnippetSegment segment : snippetSegments) {\n            sb.append(segment.getPreparedText(tabStopNumber));\n            if (segment instanceof AceCompletionSnippetSegmentTabstopItem) {\n                tabStopNumber++;\n            }\n        }\n\n        this.snippet = sb.toString();\n    }\n\n    /**\n     * Creates a snippet type substitution. A snippet-type substitution allows for tab-stop regions to be defined, in which text is automatically selected immediately the\n     * autocomplete substitution. Multiple regions may be defined to be tabbed through for user editing.<br/><br/>This may be useful if a substiution is a template type subsitution where\n     * several areas of the template typically need to be edited always after a substitution. Being able to tab through the regions rather than having to manually locate and edit\n     * is a lot faster when dealing with potentially repeated text editing usage patterns.\n     * <p>\n     * <br/><br/>\n     * <strong>NOTE :: This is the advanced version of the completion snippet, where escaping and tokenization must be done manually.<br/><br/>It is recommended to use the alternative {@link #AceCompletionSnippet(String, AceCompletionSnippetSegment[], String, int)} constructor for 99% of use-cases. This raw version is provided as a convenience.</strong>\n     * @param caption The caption of the completion (this is the left aligned autocompletion name on the left side of items in the dropdown box. If only a single completion is available in a context, then the caption will not be seen.\n     * @param snippet the snippet text of the substitution, this should be in the format start-${0:snippetText}-after-${1:nexttabstop}-after. $ and backslash and rbrace should be escaped with a leading backslash\n     * @param meta \"meta\" means the category of the substitution (this appears right aligned on the dropdown list). This is freeform description and can contain anything but typically a very short category description (9 chars or less) such as \"function\" or \"param\" or \"template\".\n     * @param score The score is the value assigned to the autocompletion option. Scores with a higher value will appear closer to the top. Items with an identical score are sorted alphbetically by caption in the drop down.\n     */\n    public AceCompletionSnippet(String caption,\n                                String snippet,\n                                int score,\n                                String meta) {\n        this.caption = caption;\n        this.score = score;\n        this.meta = meta;\n        this.snippet = snippet;\n    }\n\n    /**\n     * Convert to a native JS object in the format expected\n     * by the Ace code completion callback.<br/><br/>\n     * <p>\n     * <strong>NOTE:</strong>: When providing snippet based substitutions, we use the 'caption' attribute rather than the 'name' attribute to describe the name that appears\n     * in the substitution selection list. This is not a bug in the wrapper, but rather a requirement of the ACE library itself.... see <a href=\"https://groups.google.com/forum/#!topic/ace-discuss/M4vw4XdVzBU\">Ace Editor AutoComplete Tooltip + Web Link</a>\n     * @return native JS object\n     */\n    native JavaScriptObject toJsObject() /*-{\n        return {\n            caption: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionSnippet::caption,\n            snippet: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionSnippet::snippet,\n            score: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionSnippet::score,\n            meta: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionSnippet::meta\n        };\n    }-*/;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionSnippetSegment.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * A segment of a completion snippet\n */\npublic interface AceCompletionSnippetSegment {\n\n    /**\n     * Gets the escaped and prepared textual representation of this snippet segment (backslash and dollar are escaped in general and the dollar is used for certain special tokens)\n     * @return the prepared textual representation of this snippet segment\n     */\n    public String getPreparedText(int tabStopNumber);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionSnippetSegmentLiteral.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * A segment of a completion snippet\n */\npublic class AceCompletionSnippetSegmentLiteral implements AceCompletionSnippetSegment {\n\n    private String literalText;\n\n    /**\n     * The literal text that makes up part of the snippet segment\n     * @param literalText The literal text that makes up part of the snippet. This does not need to be escaped, escaping will be handled automatically.\n     */\n    public AceCompletionSnippetSegmentLiteral(String literalText) {\n        this.literalText = literalText;\n    }\n\n    @Override\n    public String getPreparedText(int tabstopNumber) {\n        final String escapedText = literalText.replace(\"\\\\\",\n                                                       \"\\\\\\\\\").replace(\"$\",\n                                                                       \"\\\\$\");\n        return escapedText;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionSnippetSegmentTabstopItem.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * A segment of a completion snippet\n */\npublic class AceCompletionSnippetSegmentTabstopItem implements AceCompletionSnippetSegment {\n\n    private String tabstopText;\n\n    /**\n     * Text that should fit inside a tabstop, the first tabstop is selected after a substitution, and subsequent tabstops are moved between by\n     * pressing the tab button. Tabstops are identified using an id.\n     * @param tabstopText The literal text that makes up part of the tab stop. This does not need to be escaped, escaping will be handled automatically.\n     */\n    public AceCompletionSnippetSegmentTabstopItem(String tabstopText) {\n        this.tabstopText = tabstopText;\n    }\n\n    @Override\n    public String getPreparedText(int tabstopNumber) {\n\n        // Special characters need escaping so that we can support tokens, see demo to see how this works in practice\n\n        final String escapedText =\n                tabstopText\n                        .replace(\"\\\\\",\n                                 \"\\\\\\\\\") // backslash becomes double backslash\n                        .replace(\"$\",\n                                 \"\\\\$\")   // dollar becomes backslash dollar\n                        .replace(\"}\",\n                                 \"\\\\}\");  // right brace becones backslash right brace\n        return \"${\" + tabstopNumber + \":\" + escapedText + \"}\";\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceCompletionValue.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * A completion proposed by an {@link AceCompletionProvider}.\n * <p>\n * <strong>Warning</strong>: this is an experimental feature of AceGWT.\n * It is possible that the API will change in an incompatible way\n * in future releases.\n */\npublic class AceCompletionValue extends AceCompletion {\n\n    /**\n     * The caption of the completion (this is the left aligned autocompletion name on the left side of items in the dropdown box. If only a single completion is available in a context, then the caption will not be seen.\n     */\n    private final String caption;\n\n    /**\n     * The text value of the completion. This does not need to be escaped.\n     */\n    private final String value;\n\n    /**\n     * \"meta\" means the category of the substitution (this appears right aligned on the dropdown list). This is freeform description and can contain anything but typically a very short category description (9 chars or less) such as \"function\" or \"param\" or \"template\".\n     */\n    private final String meta;\n\n    /**\n     * The score is the value assigned to the autocompletion option. Scores with a higher value will appear closer to the top. Items with an identical score are sorted alphbetically by caption in the drop down.\n     */\n    private final int score;\n\n    /**\n     * Constructor.\n     * @param caption The caption of the completion (this is the left aligned autocompletion name on the left side of items in the dropdown box. If only a single completion is available in a context, then the caption will not be seen.\n     * @param value The text value of the completion. This does not need to be escaped.\n     * @param meta \"meta\" means the category of the substitution (this appears right aligned on the dropdown list). This is freeform description and can contain anything but typically a very short category description (9 chars or less) such as \"function\" or \"param\" or \"template\".\n     * @param score The score is the value assigned to the autocompletion option. Scores with a higher value will appear closer to the top. Items with an identical score are sorted alphbetically by caption in the drop down.\n     */\n    public AceCompletionValue(String name,\n                              String value,\n                              String meta,\n                              int score) {\n        this.caption = name;\n        this.value = value;\n        this.score = score;\n        this.meta = meta;\n    }\n\n    /**\n     * Convert to a native JS object in the format expected\n     * by the Ace code completion callback.\n     * @return native JS object\n     */\n    native JavaScriptObject toJsObject() /*-{\n        return {\n            caption: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionValue::caption,\n            value: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionValue::value,\n            score: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionValue::score,\n            meta: this.@org.uberfire.ext.widgets.common.client.ace.AceCompletionValue::meta\n        };\n    }-*/;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.TakesValue;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HasText;\nimport com.google.gwt.user.client.ui.RequiresResize;\n\n/**\n * A GWT widget for the Ajax.org Code Editor (ACE).\n * @see <a href=\"http://ace.ajax.org/\">Ajax.org Code Editor</a>\n */\npublic class AceEditor extends Composite implements RequiresResize,\n                                                    HasText,\n                                                    TakesValue<String> {\n\n    // Used to generate unique element ids for Ace widgets.\n    private static int nextId = 0;\n\n    private final String elementId;\n\n    private JavaScriptObject editor;\n\n    private JsArray<AceAnnotation> annotations = JavaScriptObject.createArray().cast();\n\n    private Element divElement;\n\n    /**\n     * Preferred constructor.\n     */\n    public AceEditor() {\n        elementId = \"_aceGWT\" + nextId;\n        nextId++;\n        FlowPanel div = new FlowPanel();\n        div.getElement().setId(elementId);\n        initWidget(div);\n        divElement = div.getElement();\n        getElement().setAttribute(\"data-uf-lock-on-click\",\n                                  \"false\");\n    }\n\n    /**\n     * Do not use this constructor: just use the default constructor.\n     */\n    @Deprecated\n    public AceEditor(boolean unused) {\n        this();\n    }\n\n    /**\n     * Removes all existing completers from the langtools<br/><br/>\n     * This can be used to disable all completers including local completers, which can be very useful\n     * when completers are used on very large files (as the local completer tokenizes every word to put in the selected list).<br/><br/>\n     * <strong>NOTE:</strong> This method may be removed, and replaced with another solution. It works at point of check-in, but treat this as unstable for now.\n     */\n    public native static void removeAllExistingCompleters() /*-{\n        var langTools = $wnd.ace.require(\"ace/ext/language_tools\");\n        langTools.removeCompleters();\n    }-*/;\n\n    /**\n     * Add an {@link AceCompletionProvider} to provide\n     * custom code completions.\n     * <p>\n     * <strong>Warning</strong>: this is an experimental feature of AceGWT.\n     * It is possible that the API will change in an incompatible way\n     * in future releases.\n     * @param provider the {@link AceCompletionProvider}\n     */\n    public native static void addCompletionProvider(AceCompletionProvider provider) /*-{\n        var langTools = $wnd.ace.require(\"ace/ext/language_tools\");\n        var completer = {\n            getCompletions: function (editor, session, pos, prefix, callback) {\n                var callbackWrapper =\n                        @org.uberfire.ext.widgets.common.client.ace.AceEditor::wrapCompletionCallback(Lcom/google/gwt/core/client/JavaScriptObject;)(callback);\n                var aceEditor = editor._aceGWTAceEditor;\n                provider.@org.uberfire.ext.widgets.common.client.ace.AceCompletionProvider::getProposals(Lorg/uberfire/ext/widgets/common/client/ace/AceEditor;Lorg/uberfire/ext/widgets/common/client/ace/AceEditorCursorPosition;Ljava/lang/String;Lorg/uberfire/ext/widgets/common/client/ace/AceCompletionCallback;)(\n                        aceEditor,\n                        @org.uberfire.ext.widgets.common.client.ace.AceEditorCursorPosition::create(II)(pos.row, pos.column),\n                        prefix,\n                        callbackWrapper\n                );\n            }\n        };\n        langTools.addCompleter(completer);\n    }-*/;\n\n    private static AceCompletionCallback wrapCompletionCallback(JavaScriptObject jsCallback) {\n        return new AceCompletionCallbackImpl(jsCallback);\n    }\n\n    /**\n     * Call this method to start the editor.\n     * Make sure that the widget has been attached to the DOM tree\n     * before calling this method.\n     */\n    public native void startEditor() /*-{\n        var editor = $wnd.ace.edit(this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::divElement);\n        editor.getSession().setUseWorker(false);\n        this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor = editor;\n\n        // Store a reference to the (Java) AceEditor object in the\n        // JavaScript editor object.\n        editor._aceGWTAceEditor = this;\n\n        // I have been noticing sporadic failures of the editor\n        // to display properly and receive key/mouse events.\n        // Try to force the editor to resize and display itself fully.  See:\n        //    https://groups.google.com/group/ace-discuss/browse_thread/thread/237262b521dcea33\n        editor.resize();\n        this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::redisplay();\n    }-*/;\n\n    /**\n     * Call this to force the editor contents to be redisplayed.\n     * There seems to be a problem when an AceEditor is embedded in a LayoutPanel:\n     * the editor contents don't appear, and it refuses to accept focus\n     * and mouse events, until the browser window is resized.\n     * Calling this method works around the problem by forcing\n     * the underlying editor to redisplay itself fully. (?)\n     */\n    public native void redisplay() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.renderer.onResize(true);\n        editor.renderer.updateFull();\n        editor.resize();\n        editor.focus();\n    }-*/;\n\n    /**\n     * Cleans up the entire editor.\n     */\n    public native void destroy() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.destroy();\n    }-*/;\n\n    /**\n     * Set the theme.\n     * @param theme the theme (one of the values in the {@link AceEditorTheme}\n     * enumeration)\n     */\n    public void setTheme(final AceEditorTheme theme) {\n        setThemeByName(theme.getName());\n    }\n\n    /**\n     * Set the theme by name.\n     * @param themeName the theme name (e.g., \"twilight\")\n     */\n    public native void setThemeByName(String themeName) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.setTheme(\"ace/theme/\" + themeName);\n    }-*/;\n\n    /**\n     * Set the mode.\n     * @param mode the mode (one of the values in the\n     * {@link AceEditorMode} enumeration)\n     */\n    public void setMode(final AceEditorMode mode) {\n        setModeByName(mode.getName());\n    }\n\n    /**\n     * Set the mode by name.\n     * @param shortModeName name of mode (e.g., \"eclipse\")\n     */\n    public native void setModeByName(String shortModeName) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        var modeName = \"ace/mode/\" + shortModeName;\n        var TheMode = $wnd.ace.require(modeName).Mode;\n        editor.getSession().setMode(new TheMode());\n    }-*/;\n\n    /**\n     * Register a handler for change events generated by the editor.\n     * @param callback the change event handler\n     */\n    public native void addOnChangeHandler(AceEditorCallback callback) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().on(\"change\", function (e) {\n            callback.@org.uberfire.ext.widgets.common.client.ace.AceEditorCallback::invokeAceCallback(Lcom/google/gwt/core/client/JavaScriptObject;)(e);\n        });\n    }-*/;\n\n    /**\n     * Register a handler for cursor position change events generated by the editor.\n     * @param callback the cursor position change event handler\n     */\n    public native void addOnCursorPositionChangeHandler(AceEditorCallback callback) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().selection.on(\"changeCursor\", function (e) {\n            callback.@org.uberfire.ext.widgets.common.client.ace.AceEditorCallback::invokeAceCallback(Lcom/google/gwt/core/client/JavaScriptObject;)(e);\n        });\n    }-*/;\n\n    /**\n     * Set font size.\n     */\n    public native void setFontSize(String fontSize) /*-{\n        var elementId = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::elementId;\n        var elt = $doc.getElementById(elementId);\n        elt.style.fontSize = fontSize;\n    }-*/;\n\n    /**\n     * Get the complete text in the editor as a String.\n     * @return the text in the editor\n     */\n    public native String getText() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        return editor.getSession().getValue();\n    }-*/;\n\n    /**\n     * Set the complete text in the editor from a String.\n     * @param text the text to set in the editor\n     */\n    public native void setText(String text) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().setValue(text);\n    }-*/;\n\n    /**\n     * Get the line of text at the given row number.\n     * @param row the row number\n     * @return the line of text at that row number\n     */\n    public native String getLine(int row) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        return editor.getSession().getDocument().getLine(row);\n    }-*/;\n\n    /**\n     * Insert given text at the cursor.\n     * @param text text to insert at the cursor\n     */\n    public native void insertAtCursor(String text) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.insert(text);\n    }-*/;\n\n    /**\n     * Get the current cursor position.\n     * @return the current cursor position\n     */\n    public native AceEditorCursorPosition getCursorPosition() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        var pos = editor.getCursorPosition();\n        return this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::getCursorPositionImpl(DD)(pos.row, pos.column);\n    }-*/;\n\n    private AceEditorCursorPosition getCursorPositionImpl(final double row,\n                                                          final double column) {\n        return new AceEditorCursorPosition((int) row,\n                                           (int) column);\n    }\n\n    /**\n     * Gets the given document position as a zero-based index.\n     * @param position the position to obtain the absolute index of (base zero)\n     * @return An index to the current location in the document\n     */\n    public int getIndexFromPosition(AceEditorCursorPosition position) {\n        return getIndexFromPositionImpl(position.toJsObject());\n    }\n\n    private native int getIndexFromPositionImpl(JavaScriptObject jsPosition) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        return editor.getSession().getDocument().positionToIndex(jsPosition);\n    }-*/;\n\n    /**\n     * Gets a document position from a supplied zero-based index.\n     * @param index (base zero)\n     * @return A position object showing the row and column of the supplied index in the document\n     */\n    public native AceEditorCursorPosition getPositionFromIndex(int index) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        var jsPosition = editor.getSession().getDocument().indexToPosition(index);\n        return @org.uberfire.ext.widgets.common.client.ace.AceEditorCursorPosition::create(II)(\n                jsPosition.row,\n                jsPosition.column\n        );\n    }-*/;\n\n    /**\n     * Set whether or not soft tabs should be used.\n     * @param useSoftTabs true if soft tabs should be used, false otherwise\n     */\n    public native void setUseSoftTabs(boolean useSoftTabs) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().setUseSoftTabs(useSoftTabs);\n    }-*/;\n\n    /**\n     * Set tab size.  (Default is 4.)\n     * @param tabSize the tab size to set\n     */\n    public native void setTabSize(int tabSize) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().setTabSize(tabSize);\n    }-*/;\n\n    /**\n     * Go to given line.\n     * @param line the line to go to\n     */\n    public native void gotoLine(int line) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.gotoLine(line);\n    }-*/;\n\n    /**\n     * Go to given line.\n     * @param line the line to go to\n     */\n    public native void scrollToLine(int line) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.resize(true);\n\n        editor.scrollToLine(line, true, true, function () {\n        });\n    }-*/;\n\n    /**\n     * Set whether or not the horizontal scrollbar is always visible.\n     * @param hScrollBarAlwaysVisible true if the horizontal scrollbar is always\n     * visible, false if it is hidden when not needed\n     */\n    public native void setHScrollBarAlwaysVisible(boolean hScrollBarAlwaysVisible) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.renderer.setHScrollBarAlwaysVisible(hScrollBarAlwaysVisible);\n    }-*/;\n\n    /**\n     * Set whether or not the gutter is shown.\n     * @param showGutter true if the gutter should be shown, false if it should be hidden\n     */\n    public native void setShowGutter(boolean showGutter) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.renderer.setShowGutter(showGutter);\n    }-*/;\n\n    /**\n     * Set or unset read-only mode.\n     * @param readOnly true if editor should be set to readonly, false if the\n     * editor should be set to read-write\n     */\n    public native void setReadOnly(boolean readOnly) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.setReadOnly(readOnly);\n    }-*/;\n\n    /**\n     * Set or unset highlighting of currently selected word.\n     * @param highlightSelectedWord true to highlight currently selected word, false otherwise\n     */\n    public native void setHighlightSelectedWord(boolean highlightSelectedWord) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.setHighlightSelectedWord(highlightSelectedWord);\n    }-*/;\n\n    /**\n     * Set or unset the visibility of the print margin.\n     * @param showPrintMargin true if the print margin should be shown, false otherwise\n     */\n    public native void setShowPrintMargin(boolean showPrintMargin) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.renderer.setShowPrintMargin(showPrintMargin);\n    }-*/;\n\n    /**\n     * Add an annotation to a the local <code>annotations</code> JsArray<AceAnnotation>, but does not set it on the editor\n     * @param row to which the annotation should be added\n     * @param column to which the annotation applies\n     * @param text to display as a tooltip with the annotation\n     * @param type to be displayed (one of the values in the\n     * {@link AceAnnotationType} enumeration)\n     */\n    public void addAnnotation(final int row,\n                              final int column,\n                              final String text,\n                              final AceAnnotationType type) {\n        annotations.push(AceAnnotation.create(row,\n                                              column,\n                                              text,\n                                              type.getName()));\n    }\n\n    /**\n     * Set any annotations which have been added via <code>addAnnotation</code> on the editor\n     */\n    public native void setAnnotations() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        var annotations = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::annotations;\n        editor.getSession().setAnnotations(annotations);\n    }-*/;\n\n    /**\n     * Clear any annotations from the editor and reset the local <code>annotations</code> JsArray<AceAnnotation>\n     */\n    public native void clearAnnotations() /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().clearAnnotations();\n        this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::resetAnnotations()();\n    }-*/;\n\n    /**\n     * Reset any annotations in the local <code>annotations</code> JsArray<AceAnnotation>\n     */\n    private void resetAnnotations() {\n        annotations = JavaScriptObject.createArray().cast();\n    }\n\n    /**\n     * Remove a command from the editor.\n     * @param command the command (one of the values in the\n     * {@link AceCommand} enumeration)\n     */\n    public void removeCommand(final AceCommand command) {\n        removeCommandByName(command.getName());\n    }\n\n    /**\n     * Remove commands, that may not be required, from the editor\n     * @param command to be removed, one of\n     * \"gotoline\", \"findnext\", \"findprevious\", \"find\", \"replace\", \"replaceall\"\n     */\n    public native void removeCommandByName(String command) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.commands.removeCommand(command);\n    }-*/;\n\n    /**\n     * Set whether to use wrap mode or not\n     * @param useWrapMode true if word wrap should be used, false otherwise\n     */\n    public native void setUseWrapMode(boolean useWrapMode) /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.getSession().setUseWrapMode(useWrapMode);\n    }-*/;\n\n    /* (non-Javadoc)\n     * @see com.google.gwt.user.client.ui.ResizeComposite#onResize()\n     */\n    @Override\n    public void onResize() {\n        redisplay();\n    }\n\n    @Override\n    public String getValue() {\n        return this.getText();\n    }\n\n    @Override\n    public void setValue(String value) {\n        this.setText(value);\n    }\n\n    /**\n     * Set whether or not autocomplete is enabled.\n     * @param b true if autocomplete should be enabled, false if not\n     */\n    public native void setAutocompleteEnabled(boolean b) /*-{\n        // See: https://github.com/ajaxorg/ace/wiki/How-to-enable-Autocomplete-in-the-Ace-editor\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        if (b) {\n            $wnd.ace.require(\"ace/ext/language_tools\");\n            editor.setOptions({enableBasicAutocompletion: true});\n        } else {\n            editor.setOptions({enableBasicAutocompletion: false});\n        }\n    }-*/;\n\n    public native void setFocus()  /*-{\n        var editor = this.@org.uberfire.ext.widgets.common.client.ace.AceEditor::editor;\n        editor.focus();\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceEditorCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Callback interface for events generated by {@link AceEditor}.\n * Note that the argument the callback receives is a\n * JavaScriptObject, so you will probably need to use JSNI to\n * make use of it.\n */\npublic interface AceEditorCallback {\n\n    /**\n     * Callback method.\n     * @param obj the event object: for example, an onChange event\n     * if this callback is receiving onChange events\n     */\n    public void invokeAceCallback(JavaScriptObject obj);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceEditorCursorPosition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n/**\n * Represents a cursor position.\n */\npublic class AceEditorCursorPosition {\n\n    private final int row, column;\n\n    /**\n     * Constructor.\n     * @param row row (0 for first row)\n     * @param column column (0 for first column)\n     */\n    public AceEditorCursorPosition(int row,\n                                   int column) {\n        this.row = row;\n        this.column = column;\n    }\n\n    /**\n     * Static creation method.\n     * This is handy for calling from JSNI code.\n     * @param row the row\n     * @param column the column\n     * @return the {@link AceEditorCursorPosition}\n     */\n    public static AceEditorCursorPosition create(int row,\n                                                 int column) {\n        return new AceEditorCursorPosition(row,\n                                           column);\n    }\n\n    /**\n     * @return the row (0 for first row)\n     */\n    public int getRow() {\n        return row;\n    }\n\n    /**\n     * @return the column (0 for first column)\n     */\n    public int getColumn() {\n        return column;\n    }\n\n    @Override\n    public String toString() {\n        return row + \":\" + column;\n    }\n\n    /**\n     * Convert to a native Ace JavaScript position object\n     * (with integer-valued <code>row</code> and <code>column</code> fields.)\n     * @return native Ace JavaScript position object\n     */\n    public native JavaScriptObject toJsObject() /*-{\n        return {\n            row: this.@org.uberfire.ext.widgets.common.client.ace.AceEditorCursorPosition::row,\n            column: this.@org.uberfire.ext.widgets.common.client.ace.AceEditorCursorPosition::column\n        };\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceEditorMode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * Enumeration for ACE editor modes.\n * Note that the corresponding .js file must be loaded\n * before a mode can be set.\n */\npublic enum AceEditorMode {\n    /**\n     * ABAP (Advanced Business Application Programming).\n     */\n    ABAP(\"abap\"),\n    /**\n     * Actionscript.\n     */\n    ACTIONSCRIPT(\"actionscript\"),\n    /**\n     * Ada.\n     */\n    ADA(\"ada\"),\n    /**\n     * Apache configuration.\n     */\n    APACHE_CONF(\"apache_conf\"),\n    /**\n     * Applescript.\n     */\n    APPLESCRIPT(\"applescript\"),\n    /**\n     * ASCIIDOC.\n     */\n    ASCIIDOC(\"asciidoc\"),\n    /**\n     * Assembly (x86).\n     */\n    ASSEMBLY_X86(\"assembly_x86\"),\n    /**\n     * Auto Hotkey.\n     */\n    AUTOHOTKEY(\"autohotkey\"),\n    /**\n     * Batch file.\n     */\n    BATCHFILE(\"batchfile\"),\n    /**\n     * c9search\n     */\n    C9SEARCH(\"c9search\"),\n    /**\n     * C/C++.\n     */\n    C_CPP(\"c_cpp\"),\n    /**\n     * Cirru, indentation-based grammar for languages.\n     */\n    CIRRU(\"cirru\"),\n    /**\n     * Clojure.\n     */\n    CLOJURE(\"clojure\"),\n    /**\n     * COBOL.\n     */\n    COBOL(\"cobol\"),\n    /**\n     * Coffee.\n     */\n    COFFEE(\"coffee\"),\n    /**\n     * ColdFusion.\n     */\n    COLDFUSION(\"coldfusion\"),\n    /**\n     * C#.\n     */\n    CSHARP(\"csharp\"),\n    /**\n     * CSS.\n     */\n    CSS(\"css\"),\n    /* Curly. */\n    CURLY(\"curly\"),\n    /**\n     * Dart.\n     */\n    DART(\"Dart\"),\n    /**\n     * Diff.\n     */\n    DIFF(\"diff\"),\n    /**\n     * Django.\n     */\n    DJANGO(\"django\"),\n    /**\n     * D.\n     */\n    D(\"d\"),\n    /**\n     * Docker files.\n     */\n    DOCKERFILE(\"dockerfile\"),\n    /**\n     * Dot.\n     */\n    DOT(\"dot\"),\n    /**\n     * EJS (Embedded Javascript).\n     */\n    EJS(\"ejs\"),\n    /**\n     * Erlang.\n     */\n    ERLANG(\"erlang\"),\n    /**\n     * Forth.\n     */\n    FORTH(\"forth\"),\n    /**\n     * FTL.\n     */\n    FTL(\"ftl\"),\n    /**\n     * Gherkin: Business Readable, Domain Specific Language.\n     */\n    GHERKIN(\"gherkin\"),\n    /**\n     * GLSL (OpenGL Shading Language).\n     */\n    GLSL(\"glsl\"),\n    /**\n     * Go (http://golang.org/).\n     */\n    GOLANG(\"golang\"),\n    /**\n     * Groovy.\n     */\n    GROOVY(\"groovy\"),\n    /**\n     * HAML.\n     */\n    HAML(\"haml\"),\n    /**\n     * Handlebars.js: Minimal Templating on Steroids.\n     */\n    HANDLEBARS(\"handlebars\"),\n    /**\n     * Haskell.\n     */\n    HASKELL(\"haskell\"),\n    /**\n     * Haxe.\n     */\n    HAXE(\"haxe\"),\n    /**\n     * HTML.\n     */\n    HTML(\"html\"),\n    /**\n     * HTML completions.\n     */\n    HTML_COMPLETIONS(\"html_completions\"),\n    /**\n     * HTML (Ruby).\n     */\n    HTML_RUBY(\"html_ruby\"),\n    /**\n     * Ini file.\n     */\n    INI(\"ini\"),\n    /**\n     * JADE.\n     */\n    JADE(\"jade\"),\n    /**\n     * Jack.\n     */\n    JACK(\"jack\"),\n    /**\n     * JAVA.\n     */\n    JAVA(\"java\"),\n    /**\n     * Javascript.\n     */\n    JAVASCRIPT(\"javascript\"),\n    /**\n     * JSONiq, the JSON Query Language.\n     */\n    JSONIQ(\"jsoniq\"),\n    /**\n     * JSON.\n     */\n    JSON(\"json\"),\n    /**\n     * JSP, Java Server Pages.\n     */\n    JSP(\"jsp\"),\n    /**\n     * JSX.\n     */\n    JSX(\"jsx\"),\n    /**\n     * Julia.\n     */\n    JULIA(\"julia\"),\n    /**\n     * LaTeX.\n     */\n    LATEX(\"latex\"),\n    /**\n     * Less.\n     */\n    LESS(\"less\"),\n    /**\n     * Liquid.\n     */\n    LIQUID(\"liquid\"),\n    /**\n     * LISP.\n     */\n    LISP(\"lisp\"),\n    /**\n     * Livescript.\n     */\n    LIVESCRIPT(\"livescript\"),\n    /**\n     * LogiQL.\n     */\n    LOGIQL(\"logiql\"),\n    /**\n     * LSL.\n     */\n    LSL(\"lsl\"),\n    /**\n     * Lua.\n     */\n    LUA(\"lua\"),\n    /**\n     * Luapage.\n     */\n    LUAPAGE(\"luapage\"),\n    /**\n     * Lucene.\n     */\n    LUCENE(\"lucene\"),\n    /**\n     * Makefile.\n     */\n    MAKEFILE(\"makefile\"),\n    /**\n     * Markdown.\n     */\n    MARKDOWN(\"markdown\"),\n    /**\n     * Matlab.\n     */\n    MATLAB(\"matlab\"),\n    /**\n     * Mel.\n     */\n    MEL(\"mel\"),\n    /**\n     * MUSHCode (High Rules).\n     */\n    MUSHCODE_HIGH_RULES(\"mushcode_high_rules\"),\n    /**\n     * MUSHCode.\n     */\n    MUSHCODE(\"mushcode\"),\n    /**\n     * MySQL.\n     */\n    MYSQL(\"mysql\"),\n    /**\n     * Nix.\n     */\n    NIX(\"nix\"),\n    /**\n     * Objective C.\n     */\n    OBJECTIVEC(\"objectivec\"),\n    /**\n     * OCaml.\n     */\n    OCAML(\"ocaml\"),\n    /**\n     * Pascal.\n     */\n    PASCAL(\"pascal\"),\n    /**\n     * Perl.\n     */\n    PERL(\"perl\"),\n    /**\n     * PgSQL.\n     */\n    PGSQL(\"pgsql\"),\n    /**\n     * PHP.\n     */\n    PHP(\"php\"),\n    /**\n     * Plain text.\n     */\n    PLAIN_TEXT(\"plain_text\"),\n    /**\n     * PowerShell.\n     */\n    POWERSHELL(\"powershell\"),\n    /**\n     * Prolog.\n     */\n    PROLOG(\"prolog\"),\n    /**\n     * Java properties file.\n     */\n    PROPERTIES(\"properties\"),\n    /**\n     * Protocol Buffers - Google's data interchange format.\n     */\n    PROTOBUF(\"protobuf\"),\n    /**\n     * Python.\n     */\n    PYTHON(\"python\"),\n    /**\n     * RDoc (Ruby documentation).\n     */\n    RDOC(\"rdoc\"),\n    /**\n     * RHTML.\n     */\n    RHTML(\"rhtml\"),\n    /**\n     * R.\n     */\n    R(\"r\"),\n    /**\n     * Ruby.\n     */\n    RUBY(\"ruby\"),\n    /**\n     * Rust.\n     */\n    RUST(\"rust\"),\n    /**\n     * SASS.\n     */\n    SASS(\"sass\"),\n    /**\n     * Scad.\n     */\n    SCAD(\"scad\"),\n    /**\n     * Scala.\n     */\n    SCALA(\"scala\"),\n    /**\n     * Scheme.\n     */\n    SCHEME(\"scheme\"),\n    /**\n     * SCSS.\n     */\n    SCSS(\"scss\"),\n    /**\n     * Sh (Bourne shell).\n     */\n    SH(\"sh\"),\n    /**\n     * Sjs.\n     */\n    SJS(\"sjs\"),\n    /**\n     * Smarty (PHP template engine).\n     */\n    SMARTY(\"smarty\"),\n    /**\n     * Snippets.\n     */\n    SNIPPETS(\"snippets\"),\n    /**\n     * Soy template.\n     */\n    SOY_TEMPLATE(\"soy_template\"),\n    /**\n     * Space.\n     */\n    SPACE(\"space\"),\n    /**\n     * SQL.\n     */\n    SQL(\"sql\"),\n    /**\n     * Stylus.\n     */\n    STYLUS(\"stylus\"),\n    /**\n     * SVG.\n     */\n    SVG(\"svg\"),\n    /**\n     * Tcl.\n     */\n    TCL(\"tcl\"),\n    /**\n     * TeX.\n     */\n    TEX(\"tex\"),\n    /**\n     * Text.\n     */\n    TEXT(\"text\"),\n    /**\n     * Textile.\n     */\n    TEXTILE(\"textile\"),\n    /**\n     * TOML.\n     */\n    TOML(\"toml\"),\n    /**\n     * TWIG.\n     */\n    TWIG(\"twig\"),\n    /**\n     * TypeScript.\n     */\n    TYPESCRIPT(\"typescript\"),\n    /**\n     * Vala.\n     */\n    VALA(\"vala\"),\n    /**\n     * VBScript.\n     */\n    VBSCRIPT(\"vbscript\"),\n    /**\n     * Velocity.\n     */\n    VELOCITY(\"velocity\"),\n    /**\n     * Verilog.\n     */\n    VERILOG(\"verilog\"),\n    /**\n     * VHDL.\n     */\n    VHDL(\"vhdl\"),\n    /**\n     * XML.\n     */\n    XML(\"xml\"),\n    /**\n     * XQuery.\n     */\n    XQUERY(\"xquery\"),\n    /**\n     * YAML.\n     */\n    YAML(\"yaml\");\n\n    private final String name;\n\n    private AceEditorMode(String name) {\n        this.name = name;\n    }\n\n    /**\n     * @return mode name (e.g., \"java\" for Java mode)\n     */\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/java/org/uberfire/ext/widgets/common/client/ace/AceEditorTheme.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.common.client.ace;\n\n/**\n * Enumeration for ACE editor themes.\n * Note that the corresponding .js file must be loaded\n * before a theme can be set.\n */\npublic enum AceEditorTheme {\n    AMBIANCE(\"ambiance\"),\n    CHAOS(\"chaos\"),\n    CHROME(\"chrome\"),\n    CLOUD9_DAY(\"cloud9_day\"),\n    CLOUD9_NIGHT(\"cloud9_night\"),\n    CLOUD9_NIGHT_LOW_COLOR(\"cloud9_night_low_color\"),\n    CLOUDS(\"clouds\"),\n    CLOUDS_MIDNIGHT(\"clouds_midnight\"),\n    COBALT(\"cobalt\"),\n    CRIMSON_EDITOR(\"crimson_editor\"),\n    DAWN(\"dawn\"),\n    DREAMWEAVER(\"dreamweaver\"),\n    ECLIPSE(\"eclipse\"),\n    GITHUB(\"github\"),\n    IDLE_FINGERS(\"idle_fingers\"),\n    KATZENMILCH(\"katzenmilch\"),\n    KR_THEME(\"kr_theme\"),\n    KR(\"kr\"),\n    KUROIR(\"kuroir\"),\n    MERBIVORE(\"merbivore\"),\n    MERBIVORE_SOFT(\"merbivore_soft\"),\n    MONO_INDUSTRIAL(\"mono_industrial\"),\n    MONOKAI(\"monokai\"),\n    PASTEL_ON_DARK(\"pastel_on_dark\"),\n    SOLARIZED_DARK(\"solarized_dark\"),\n    SOLARIZED_LIGHT(\"solarized_light\"),\n    TERMINAL(\"terminal\"),\n    TEXTMATE(\"textmate\"),\n    TOMORROW_NIGHT_BLUE(\"tomorrow_night_blue\"),\n    TOMORROW_NIGHT_BRIGHT(\"tomorrow_night_bright\"),\n    TOMORROW_NIGHT_EIGHTIES(\"tomorrow_night_eighties\"),\n    TOMORROW_NIGHT(\"tomorrow_night\"),\n    TOMORROW(\"tomorrow\"),\n    TWILIGHT(\"twilight\"),\n    VIBRANT_INK(\"vibrant_ink\"),\n    XCODE(\"xcode\");\n\n    private final String name;\n\n    private AceEditorTheme(String name) {\n        this.name = name;\n    }\n\n    /**\n     * @return the theme name (e.g., \"eclipse\")\n     */\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/UberfireAceEditor.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ace-compat.js",
    "content": "define(\"pilot/index\",[\"require\",\"exports\",\"module\",\"pilot/browser_focus\",\"pilot/dom\",\"pilot/event\",\"pilot/event_emitter\",\"pilot/fixoldbrowsers\",\"pilot/keys\",\"pilot/lang\",\"pilot/oop\",\"pilot/useragent\",\"pilot/canon\"],function(a,b,c){a(\"pilot/browser_focus\"),a(\"pilot/dom\"),a(\"pilot/event\"),a(\"pilot/event_emitter\"),a(\"pilot/fixoldbrowsers\"),a(\"pilot/keys\"),a(\"pilot/lang\"),a(\"pilot/oop\"),a(\"pilot/useragent\"),a(\"pilot/canon\")}),define(\"pilot/browser_focus\",[\"require\",\"exports\",\"module\",\"ace/lib/browser_focus\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/browser_focus' is deprecated. Use 'ace/lib/browser_focus' instead\"),c.exports=a(\"ace/lib/browser_focus\")}),define(\"pilot/dom\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/dom' is deprecated. Use 'ace/lib/dom' instead\"),c.exports=a(\"ace/lib/dom\")}),define(\"pilot/event\",[\"require\",\"exports\",\"module\",\"ace/lib/event\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/event' is deprecated. Use 'ace/lib/event' instead\"),c.exports=a(\"ace/lib/event\")}),define(\"pilot/event_emitter\",[\"require\",\"exports\",\"module\",\"ace/lib/event_emitter\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/event_emitter' is deprecated. Use 'ace/lib/event_emitter' instead\"),c.exports=a(\"ace/lib/event_emitter\")}),define(\"pilot/fixoldbrowsers\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/fixoldbrowsers' is deprecated. Use 'ace/lib/fixoldbrowsers' instead\"),c.exports=a(\"ace/lib/fixoldbrowsers\")}),define(\"pilot/keys\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/keys' is deprecated. Use 'ace/lib/keys' instead\"),c.exports=a(\"ace/lib/keys\")}),define(\"pilot/lang\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/lang' is deprecated. Use 'ace/lib/lang' instead\"),c.exports=a(\"ace/lib/lang\")}),define(\"pilot/oop\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/oop' is deprecated. Use 'ace/lib/oop' instead\"),c.exports=a(\"ace/lib/oop\")}),define(\"pilot/useragent\",[\"require\",\"exports\",\"module\",\"ace/lib/useragent\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/useragent' is deprecated. Use 'ace/lib/useragent' instead\"),c.exports=a(\"ace/lib/useragent\")}),define(\"pilot/canon\",[\"require\",\"exports\",\"module\"],function(a,b,c){console.warn(\"DEPRECATED: 'pilot/canon' is deprecated.\"),b.addCommand=function(){console.warn(\"DEPRECATED: 'canon.addCommand()' is deprecated. Use 'editor.commands.addCommand(command)' instead.\"),console.trace()},b.removeCommand=function(){console.warn(\"DEPRECATED: 'canon.removeCommand()' is deprecated. Use 'editor.commands.removeCommand(command)' instead.\"),console.trace()}}),function(){window.require([\"ace/ace\"],function(a){window.ace||(window.ace={});for(var b in a)a.hasOwnProperty(b)&&(ace[b]=a[b])})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ace.js",
    "content": "(function(){function o(e){var i=function(e,t){return r(\"\",e,t)},s=t;e&&(t[e]||(t[e]={}),s=t[e]);if(!s.define||!s.define.packaged)n.original=s.define,s.define=n,s.define.packaged=!0;if(!s.require||!s.require.packaged)r.original=s.require,s.require=i,s.require.packaged=!0}var e=\"\",t=function(){return this}();if(!e&&typeof requirejs!=\"undefined\")return;var n=function(e,t,r){if(typeof e!=\"string\"){n.original?n.original.apply(window,arguments):(console.error(\"dropping module because define wasn't a string.\"),console.trace());return}arguments.length==2&&(r=t),n.modules||(n.modules={},n.payloads={}),n.payloads[e]=r,n.modules[e]=null},r=function(e,t,n){if(Object.prototype.toString.call(t)===\"[object Array]\"){var i=[];for(var o=0,u=t.length;o<u;++o){var a=s(e,t[o]);if(!a&&r.original)return r.original.apply(window,arguments);i.push(a)}n&&n.apply(null,i)}else{if(typeof t==\"string\"){var f=s(e,t);return!f&&r.original?r.original.apply(window,arguments):(n&&n(),f)}if(r.original)return r.original.apply(window,arguments)}},i=function(e,t){if(t.indexOf(\"!\")!==-1){var n=t.split(\"!\");return i(e,n[0])+\"!\"+i(e,n[1])}if(t.charAt(0)==\".\"){var r=e.split(\"/\").slice(0,-1).join(\"/\");t=r+\"/\"+t;while(t.indexOf(\".\")!==-1&&s!=t){var s=t;t=t.replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return t},s=function(e,t){t=i(e,t);var s=n.modules[t];if(!s){s=n.payloads[t];if(typeof s==\"function\"){var o={},u={id:t,uri:\"\",exports:o,packaged:!0},a=function(e,n){return r(t,e,n)},f=s(a,o,u);o=f||u.exports,n.modules[t]=o,delete n.payloads[t]}s=n.modules[t]=o||s}return s};o(e)})(),define(\"ace/ace\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/editor\",\"ace/edit_session\",\"ace/undomanager\",\"ace/virtual_renderer\",\"ace/worker/worker_client\",\"ace/keyboard/hash_handler\",\"ace/placeholder\",\"ace/multi_select\",\"ace/mode/folding/fold_mode\",\"ace/theme/textmate\",\"ace/ext/error_marker\",\"ace/config\"],function(e,t,n){e(\"./lib/fixoldbrowsers\");var r=e(\"./lib/dom\"),i=e(\"./lib/event\"),s=e(\"./editor\").Editor,o=e(\"./edit_session\").EditSession,u=e(\"./undomanager\").UndoManager,a=e(\"./virtual_renderer\").VirtualRenderer;e(\"./worker/worker_client\"),e(\"./keyboard/hash_handler\"),e(\"./placeholder\"),e(\"./multi_select\"),e(\"./mode/folding/fold_mode\"),e(\"./theme/textmate\"),e(\"./ext/error_marker\"),t.config=e(\"./config\"),t.require=e,t.edit=function(e){if(typeof e==\"string\"){var n=e;e=document.getElementById(n);if(!e)throw new Error(\"ace.edit can't find div #\"+n)}if(e.env&&e.env.editor instanceof s)return e.env.editor;var o=t.createEditSession(r.getInnerText(e));e.innerHTML=\"\";var u=new s(new a(e));u.setSession(o);var f={document:o,editor:u,onResize:u.resize.bind(u,null)};return i.addListener(window,\"resize\",f.onResize),u.on(\"destroy\",function(){i.removeListener(window,\"resize\",f.onResize)}),e.env=u.env=f,u},t.createEditSession=function(e,t){var n=new o(e,t);return n.setUndoManager(new u),n},t.EditSession=o,t.UndoManager=u}),define(\"ace/mode/behaviour\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(){this.$behaviours={}};(function(){this.add=function(e,t,n){switch(undefined){case this.$behaviours:this.$behaviours={};case this.$behaviours[e]:this.$behaviours[e]={}}this.$behaviours[e][t]=n},this.addBehaviours=function(e){for(var t in e)for(var n in e[t])this.add(t,n,e[t][n])},this.remove=function(e){this.$behaviours&&this.$behaviours[e]&&delete this.$behaviours[e]},this.inherit=function(e,t){if(typeof e==\"function\")var n=(new e).getBehaviours(t);else var n=e.getBehaviours(t);this.addBehaviours(n)},this.getBehaviours=function(e){if(!e)return this.$behaviours;var t={};for(var n=0;n<e.length;n++)this.$behaviours[e[n]]&&(t[e[n]]=this.$behaviours[e[n]]);return t}}).call(r.prototype),t.Behaviour=r}),define(\"ace/unicode\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(e){var n=/\\w{4}/g;for(var r in e)t.packages[r]=e[r].replace(n,\"\\\\u$&\")}t.packages={},r({L:\"0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC\",Ll:\"0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A\",Lu:\"0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A\",Lt:\"01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC\",Lm:\"02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F\",Lo:\"01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC\",M:\"0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26\",Mn:\"0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26\",Mc:\"0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC\",Me:\"0488048906DE20DD-20E020E2-20E4A670-A672\",N:\"0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19\",Nd:\"0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19\",Nl:\"16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF\",No:\"00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835\",P:\"0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65\",Pd:\"002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D\",Ps:\"0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62\",Pe:\"0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63\",Pi:\"00AB2018201B201C201F20392E022E042E092E0C2E1C2E20\",Pf:\"00BB2019201D203A2E032E052E0A2E0D2E1D2E21\",Pc:\"005F203F20402054FE33FE34FE4D-FE4FFF3F\",Po:\"0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65\",S:\"0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD\",Sm:\"002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC\",Sc:\"002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6\",Sk:\"005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3\",So:\"00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD\",Z:\"002000A01680180E2000-200A20282029202F205F3000\",Zs:\"002000A01680180E2000-200A202F205F3000\",Zl:\"2028\",Zp:\"2029\",C:\"0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF\",Cc:\"0000-001F007F-009F\",Cf:\"00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB\",Co:\"E000-F8FF\",Cs:\"D800-DFFF\",Cn:\"03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF\"})}),define(\"ace/token_iterator\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t,n){this.$session=e,this.$row=t,this.$rowTokens=e.getTokens(t);var r=e.getTokenAt(t,n);this.$tokenIndex=r?r.index:-1};(function(){this.stepBackward=function(){this.$tokenIndex-=1;while(this.$tokenIndex<0){this.$row-=1;if(this.$row<0)return this.$row=0,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=this.$rowTokens.length-1}return this.$rowTokens[this.$tokenIndex]},this.stepForward=function(){this.$tokenIndex+=1;var e;while(this.$tokenIndex>=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n}}).call(r.prototype),t.TokenIterator=r}),define(\"ace/mode/text_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../lib/lang\"),i=function(){this.$rules={start:[{token:\"empty_line\",regex:\"^$\"},{defaultToken:\"text\"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i<r.length;i++){var s=r[i];s.next&&(typeof s.next!=\"string\"?s.nextState&&s.nextState.indexOf(t)!==0&&(s.nextState=t+s.nextState):s.next.indexOf(t)!==0&&(s.next=t+s.next))}this.$rules[t+n]=r}},this.getRules=function(){return this.$rules},this.embedRules=function(e,t,n,i,s){var o=typeof e==\"function\"?(new e).getRules():e;if(i)for(var u=0;u<i.length;u++)i[u]=t+i[u];else{i=[];for(var a in o)i.push(t+a)}this.addRules(o,t);if(n){var f=Array.prototype[s?\"push\":\"unshift\"];for(var u=0;u<i.length;u++)f.apply(this.$rules[i[u]],r.deepCopy(n))}this.$embeds||(this.$embeds=[]),this.$embeds.push(t)},this.getEmbeds=function(){return this.$embeds};var e=function(e,t){return(e!=\"start\"||t.length)&&t.unshift(this.nextState,e),this.nextState},t=function(e,t){return t.shift(),t.shift()||\"start\"};this.normalizeRules=function(){function i(s){var o=r[s];o.processed=!0;for(var u=0;u<o.length;u++){var a=o[u];!a.regex&&a.start&&(a.regex=a.start,a.next||(a.next=[]),a.next.push({defaultToken:a.token},{token:a.token+\".end\",regex:a.end||a.start,next:\"pop\"}),a.token=a.token+\".start\",a.push=!0);var f=a.next||a.push;if(f&&Array.isArray(f)){var l=a.stateName;l||(l=a.token,typeof l!=\"string\"&&(l=l[0]||\"\"),r[l]&&(l+=n++)),r[l]=f,a.next=l,i(l)}else f==\"pop\"&&(a.next=t);a.push&&(a.nextState=a.next||a.push,a.next=e,delete a.push);if(a.rules)for(var c in a.rules)r[c]?r[c].push&&r[c].push.apply(r[c],a.rules[c]):r[c]=a.rules[c];if(a.include||typeof a==\"string\")var h=a.include||a,p=r[h];else Array.isArray(a)&&(p=a);if(p){var d=[u,1].concat(p);a.noEscape&&(d=d.filter(function(e){return!e.next})),o.splice.apply(o,d),u--,p=null}a.keywordMap&&(a.token=this.createKeywordMapper(a.keywordMap,a.defaultToken||\"text\",a.caseInsensitive),delete a.defaultToken)}}var n=0,r=this.$rules;Object.keys(r).forEach(i,this)},this.createKeywordMapper=function(e,t,n,r){var i=Object.create(null);return Object.keys(e).forEach(function(t){var s=e[t];n&&(s=s.toLowerCase());var o=s.split(r||\"|\");for(var u=o.length;u--;)i[o[u]]=t}),Object.getPrototypeOf(i)&&(i.__proto__=null),this.$keywordList=Object.keys(i),e=null,n?function(e){return i[e.toLowerCase()]||t}:function(e){return i[e]||t}},this.getKeywords=function(){return this.$keywords}}).call(i.prototype),t.TextHighlightRules=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/background_tokenizer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=function(e,t){this.running=!1,this.lines=[],this.states=[],this.currentLine=0,this.tokenizer=e;var n=this;this.$worker=function(){if(!n.running)return;var e=new Date,t=n.currentLine,r=-1,i=n.doc;while(n.lines[t])t++;var s=t,o=i.getLength(),u=0;n.running=!1;while(t<o){n.$tokenizeRow(t),r=t;do t++;while(n.lines[t]);u++;if(u%5==0&&new Date-e>20){n.running=setTimeout(n.$worker,20),n.currentLine=t;return}}n.currentLine=t,s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal(\"update\",{data:n})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.range,n=t.start.row,r=t.end.row-n;if(r===0)this.lines[n]=null;else if(e.action==\"removeText\"||e.action==\"removeLines\")this.lines.splice(n,r+1,null),this.states.splice(n,r+1,null);else{var i=Array(r+1);i.unshift(n,1),this.lines.splice.apply(this.lines,i),this.states.splice.apply(this.states,i)}this.currentLine=Math.min(n,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||\"start\"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+\"\"!=r.state+\"\"?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define(\"ace/search_highlight\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"],function(e,t,n){var r=e(\"./lib/lang\"),i=e(\"./lib/oop\"),s=e(\"./range\").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||\"text\"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+\"\"==e+\"\")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:\"\");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),define(\"ace/edit_session/folding\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/edit_session/fold_line\",\"ace/edit_session/fold\",\"ace/token_iterator\"],function(e,t,n){function u(){this.getFoldAt=function(e,t,n){var r=this.getFoldLine(e);if(!r)return null;var i=r.folds;for(var s=0;s<i.length;s++){var o=i[s];if(o.range.contains(e,t)){if(n==1&&o.range.isEnd(e,t))continue;if(n==-1&&o.range.isStart(e,t))continue;return o}}},this.getFoldsInRange=function(e){var t=e.start,n=e.end,r=this.$foldData,i=[];t.column+=1,n.column-=1;for(var s=0;s<r.length;s++){var o=r[s].range.compareRange(e);if(o==2)continue;if(o==-2)break;var u=r[s].folds;for(var a=0;a<u.length;a++){var f=u[a];o=f.range.compareRange(e);if(o==-2)break;if(o==2)continue;if(o==42)break;i.push(f)}}return t.column-=1,n.column+=1,i},this.getFoldsInRangeList=function(e){if(Array.isArray(e)){var t=[];e.forEach(function(e){t=t.concat(this.getFoldsInRange(e))},this)}else var t=this.getFoldsInRange(e);return t},this.getAllFolds=function(){var e=[],t=this.$foldData;for(var n=0;n<t.length;n++)for(var r=0;r<t[n].folds.length;r++)e.push(t[n].folds[r]);return e},this.getFoldStringAt=function(e,t,n,r){r=r||this.getFoldLine(e);if(!r)return null;var i={end:{column:0}},s,o;for(var u=0;u<r.folds.length;u++){o=r.folds[u];var a=o.range.compareEnd(e,t);if(a==-1){s=this.getLine(o.start.row).substring(i.end.column,o.start.column);break}if(a===0)return null;i=o}return s||(s=this.getLine(o.start.row).substring(i.end.column)),n==-1?s.substring(0,t-i.end.column):n==1?s.substring(t-i.end.column):s},this.getFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.start.row<=e&&i.end.row>=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r<n.length;r++){var i=n[r];if(i.end.row>=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i<n.length;i++){var s=n[i],o=s.end.row,u=s.start.row;if(o>=t){u<t&&(u>=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column;if(u<f||u==f&&a<=l-2){var c=this.getFoldAt(u,a,1),h=this.getFoldAt(f,l,-1);if(c&&h==c)return c.addSubFold(o);if(c&&!c.range.isStart(u,a)||h&&!h.range.isEnd(f,l))throw new Error(\"A fold can't intersect already existing fold\"+o.range+c.range);var p=this.getFoldsInRange(o.range);p.length>0&&(this.removeFolds(p),p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d<n.length;d++){var v=n[d];if(f==v.start.row){v.addFold(o),r=!0;break}if(u==v.end.row){v.addFold(o),r=!0;if(!o.sameRow){var m=n[d+1];if(m&&m.start.row==f){v.merge(m);break}}break}if(f<=v.start.row)break}return r||(v=this.$addFoldLine(new i(this.$foldData,o))),this.$useWrapMode?this.$updateWrapData(v.start.row,v.start.row):this.$updateRowLengthCache(v.start.row,v.start.row),this.$modified=!0,this._emit(\"changeFold\",{data:o,action:\"add\"}),o}throw new Error(\"The range has to be at least 2 characters width\")},this.addFolds=function(e){e.forEach(function(e){this.addFold(e)},this)},this.removeFold=function(e){var t=e.foldLine,n=t.start.row,r=t.end.row,i=this.$foldData,s=t.folds;if(s.length==1)i.splice(i.indexOf(t),1);else if(t.range.isEnd(e.end.row,e.end.column))s.pop(),t.end.row=s[s.length-1].end.row,t.end.column=s[s.length-1].end.column;else if(t.range.isStart(e.start.row,e.start.column))s.shift(),t.start.row=s[0].start.row,t.start.column=s[0].start.column;else if(e.sameRow)s.splice(s.indexOf(e),1);else{var o=t.split(e.start.row,e.start.column);s=o.folds,s.shift(),o.start.row=s[0].start.row,o.start.column=s[0].start.column}this.$updating||(this.$useWrapMode?this.$updateWrapData(n,r):this.$updateRowLengthCache(n,r)),this.$modified=!0,this._emit(\"changeFold\",{data:e,action:\"remove\"})},this.removeFolds=function(e){var t=[];for(var n=0;n<e.length;n++)t.push(e[n]);t.forEach(function(e){this.removeFold(e)},this),this.$modified=!0},this.expandFold=function(e){this.removeFold(e),e.subFolds.forEach(function(t){e.restoreRange(t),this.addFold(t)},this),e.collapseChildren>0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t=!0):typeof e==\"number\"?n=new r(e,0,e,this.getLine(e).length):\"row\"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n);if(t)this.removeFolds(i);else{var s=i;while(s.length)this.expandFolds(s),s=this.getFoldsInRangeList(n)}if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row,i=0),t==null&&(t=e.end.row,n=this.getLine(t).length);var s=this.doc,o=\"\";return e.walk(function(e,t,n,u){if(t<r)return;if(t==r){if(n<i)return;u=Math.max(i,u)}e!=null?o+=e:o+=s.getLine(t).substring(u,n)},t,n),o},this.getDisplayLine=function(e,t,n,r){var i=this.getFoldLine(e);if(!i){var s;return s=this.doc.getLine(e),s.substring(r||0,t||s.length)}return this.getFoldDisplayLine(i,e,t,n,r)},this.$cloneFoldData=function(){var e=[];return e=this.$foldData.map(function(t){var n=t.folds.map(function(e){return e.clone()});return new i(e,n)}),e},this.toggleFold=function(e){var t=this.selection,n=t.getRange(),r,i;if(n.isEmpty()){var s=n.start;r=this.getFoldAt(s.row,s.column);if(r){this.expandFold(r);return}(i=this.findMatchingBracket(s))?n.comparePoint(i)==1?n.end=i:(n.start=i,n.start.column++,n.end.column--):(i=this.findMatchingBracket({row:s.row,column:s.column+1}))?(n.comparePoint(i)==1?n.end=i:n.start=i,n.start.column++):n=this.getCommentFoldRange(s.row,s.column)||n}else{var o=this.getFoldsInRange(n);if(e&&o.length){this.expandFolds(o);return}o.length==1&&(r=o[0])}r||(r=this.getFoldAt(n.start.row,n.start.column));if(r&&r.range.toString()==n.toString()){this.expandFold(r);return}var u=\"...\";if(!n.isMultiLine()){u=this.getTextRange(n);if(u.length<4)return;u=u.trim().substring(0,2)+\"..\"}this.addFold(u,n)},this.getCommentFoldRange=function(e,t,n){var i=new o(this,e,t),s=i.getCurrentToken();if(s&&/^comment|string/.test(s.type)){var u=new r,a=new RegExp(s.type.replace(/\\..*/,\"\\\\.\"));if(n!=1){do s=i.stepBackward();while(s&&a.test(s.type));i.stepForward()}u.start.row=i.getCurrentTokenRow(),u.start.column=i.getCurrentTokenColumn()+2,i=new o(this,e,t);if(n!=-1){do s=i.stepForward();while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return u.end.row=i.getCurrentTokenRow(),u.end.column=i.getCurrentTokenColumn()+s.value.length-2,u}},this.foldAll=function(e,t,n){n==undefined&&(n=1e5);var r=this.foldWidgets;if(!r)return;t=t||this.getLength(),e=e||0;for(var i=e;i<t;i++){r[i]==null&&(r[i]=this.getFoldWidget(i));if(r[i]!=\"start\")continue;var s=this.getFoldWidgetRange(i);if(s&&s.isMultiLine()&&s.end.row<=t&&s.start.row>=e){i=s.end.row;try{var o=this.addFold(\"...\",s);o&&(o.collapseChildren=n)}catch(u){}}}},this.$foldStyles={manual:1,markbegin:1,markbeginend:1},this.$foldStyle=\"markbegin\",this.setFoldStyle=function(e){if(!this.$foldStyles[e])throw new Error(\"invalid fold style: \"+e+\"[\"+Object.keys(this.$foldStyles).join(\", \")+\"]\");if(this.$foldStyle==e)return;this.$foldStyle=e,e==\"manual\"&&this.unfold();var t=this.$foldMode;this.$setFolding(null),this.$setFolding(t)},this.$setFolding=function(e){if(this.$foldMode==e)return;this.$foldMode=e,this.removeListener(\"change\",this.$updateFoldWidgets),this._emit(\"changeAnnotation\");if(!e||this.$foldStyle==\"manual\"){this.foldWidgets=null;return}this.foldWidgets=[],this.getFoldWidget=e.getFoldWidget.bind(e,this,this.$foldStyle),this.getFoldWidgetRange=e.getFoldWidgetRange.bind(e,this,this.$foldStyle),this.$updateFoldWidgets=this.updateFoldWidgets.bind(this),this.on(\"change\",this.$updateFoldWidgets)},this.getParentFoldRangeData=function(e,t){var n=this.foldWidgets;if(!n||t&&n[e])return{};var r=e-1,i;while(r>=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s==\"start\"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=\" ace_invalid\")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n===\"end\"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s){t.children||t.all?this.removeFold(s):this.expandFold(s);return}var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range)){this.removeFold(s);return}}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,o.end.row,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold(\"...\",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold(\"...\",n)}},this.updateFoldWidgets=function(e){var t=e.data,n=t.range,r=n.start.row,i=n.end.row-r;if(i===0)this.foldWidgets[r]=null;else if(t.action==\"removeText\"||t.action==\"removeLines\")this.foldWidgets.splice(r,i+1,null);else{var s=Array(i+1);s.unshift(r,1),this.foldWidgets.splice.apply(this.foldWidgets,s)}}}var r=e(\"../range\").Range,i=e(\"./fold_line\").FoldLine,s=e(\"./fold\").Fold,o=e(\"../token_iterator\").TokenIterator;t.Folding=u}),define(\"ace/edit_session/fold_line\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e(\"../range\").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.row<this.startRow||e.endRow>this.endRow)throw new Error(\"Can't add a fold to this FoldLine as it has no connection\");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error(\"Trying to add fold to FoldRow that doesn't have a matching row\");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f<i.length;f++){s=i[f],o=s.range.compareStart(t,n);if(o==-1){e(null,t,n,r,a);return}u=e(null,s.start.row,s.start.column,r,a),u=!u&&e(s.placeholder,s.start.row,s.start.column,r);if(u||o==0)return;a=!s.sameRow,r=s.end.column}e(null,t,n,r,a)},this.getNextFoldTo=function(e,t){var n,r;for(var i=0;i<this.folds.length;i++){n=this.folds[i],r=n.range.compareEnd(e,t);if(r==-1)return{fold:n,kind:\"after\"};if(r==0)return{fold:n,kind:\"inside\"}}return null},this.addRemoveChars=function(e,t,n){var r=this.getNextFoldTo(e,t),i,s;if(r){i=r.fold;if(r.kind==\"inside\"&&i.start.column!=t&&i.start.row!=e)window.console&&window.console.log(e,t,i);else if(i.start.row==e){s=this.folds;var o=s.indexOf(i);o==0&&(this.start.column+=n);for(o;o<s.length;o++){i=s[o],i.start.column+=n;if(!i.sameRow)return;i.end.column+=n}this.end.column+=n}}},this.split=function(e,t){var n=this.getNextFoldTo(e,t).fold,r=this.folds,s=this.foldData;if(!n)return null;var o=r.indexOf(n),u=r[o-1];this.end.row=u.end.row,this.end.column=u.end.column,r=r.splice(o,r.length-o);var a=new i(s,r);return s.splice(s.indexOf(this)+1,0,a),a},this.merge=function(e){var t=e.folds;for(var n=0;n<t.length;n++)this.addFold(t[n]);var r=this.foldData;r.splice(r.indexOf(e),1)},this.toString=function(){var e=[this.range.toString()+\": [\"];return this.folds.forEach(function(t){e.push(\"  \"+t.toString())}),e.push(\"]\"),e.join(\"\\n\")},this.idxToPosition=function(e){var t=0,n;for(var r=0;r<this.folds.length;r++){var n=this.folds[r];e-=n.start.column-t;if(e<0)return{row:n.start.row,column:n.start.column+e};e-=n.placeholder.length;if(e<0)return n.start;t=n.end.column}return{row:this.end.row,column:this.end.column+e}}}).call(i.prototype),t.FoldLine=i}),define(\"ace/tokenizer\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=1e3,i=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:\"text\"},o=\"g\",u=[];for(var a=0;a<n.length;a++){var f=n[a];f.defaultToken&&(s.defaultToken=f.defaultToken),f.caseInsensitive&&(o=\"gi\");if(f.regex==null)continue;f.regex instanceof RegExp&&(f.regex=f.regex.toString().slice(1,-1));var l=f.regex,c=(new RegExp(\"(?:(\"+l+\")|(.))\")).exec(\"a\").length-2;if(Array.isArray(f.token))if(f.token.length==1||c==1)f.token=f.token[0];else{if(c-1!=f.token.length)throw new Error(\"number of classes and regexp groups in '\"+f.token+\"'\\n'\"+f.regex+\"' doesn't match\\n\"+(c-1)+\"!=\"+f.token.length);f.tokenArray=f.token,f.token=null,f.onMatch=this.$arrayTokens}else typeof f.token==\"function\"&&!f.onMatch&&(c>1?f.onMatch=this.$applyToken:f.onMatch=f.token);c>1&&(/\\\\\\d/.test(f.regex)?l=f.regex.replace(/\\\\([0-9]+)/g,function(e,t){return\"\\\\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!=\"string\"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp(\"(\"+r.join(\")|(\")+\")|($)\",o)}};(function(){this.$setMaxTokenCount=function(e){r=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n==\"string\")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;i<s;i++)t[i]&&(r[r.length]={type:n[i],value:t[i]});return r},this.$arrayTokens=function(e){if(!e)return[];var t=this.splitRegex.exec(e);if(!t)return\"text\";var n=[],r=this.tokenArray;for(var i=0,s=r.length;i<s;i++)t[i+1]&&(n[n.length]={type:r[i],value:t[i+1]});return n},this.removeCapturingGroups=function(e){var t=e.replace(/\\[(?:\\\\.|[^\\]])*?\\]|\\\\.|\\(\\?[:=!]|(\\()/g,function(e,t){return t?\"(?:\":e});return t},this.createSplitterRegexp=function(e,t){if(e.indexOf(\"(?=\")!=-1){var n=0,r=!1,i={};e.replace(/(\\\\.)|(\\((?:\\?[=!])?)|(\\))|([\\[\\]])/g,function(e,t,s,o,u,a){return r?r=u!=\"]\":u?r=!0:o?(n==i.stack&&(i.end=a+1,i.stack=-1),n--):s&&(n++,s.length!=1&&(i.stack=n,i.start=a)),e}),i.end!=null&&/^\\)*$/.test(e.substr(i.end))&&(e=e.substring(0,i.start)+e.substr(i.end))}return new RegExp(e,(t||\"\").replace(\"g\",\"\"))},this.getLineTokens=function(e,t){if(t&&typeof t!=\"string\"){var n=t.slice(0);t=n[0]}else var n=[];var i=t||\"start\",s=this.states[i];s||(i=\"start\",s=this.states[i]);var o=this.matchMappings[i],u=this.regExps[i];u.lastIndex=0;var a,f=[],l=0,c={type:null,value:\"\"};while(a=u.exec(e)){var h=o.defaultToken,p=null,d=a[0],v=u.lastIndex;if(v-d.length>l){var m=e.substring(l,v-d.length);c.type==h?c.value+=m:(c.type&&f.push(c),c={type:h,value:m})}for(var g=0;g<a.length-2;g++){if(a[g+1]===undefined)continue;p=s[o[g]],p.onMatch?h=p.onMatch(d,i,n):h=p.token,p.next&&(typeof p.next==\"string\"?i=p.next:i=p.next(i,n),s=this.states[i],s||(window.console&&console.error&&console.error(i,\"doesn't exist\"),i=\"start\",s=this.states[i]),o=this.matchMappings[i],l=v,u=this.regExps[i],u.lastIndex=v);break}if(d)if(typeof h==\"string\")!!p&&p.merge===!1||c.type!==h?(c.type&&f.push(c),c={type:h,value:d}):c.value+=d;else if(h){c.type&&f.push(c),c={type:null,value:\"\"};for(var g=0;g<h.length;g++)f.push(h[g])}if(l==e.length)break;l=v;if(f.length>r){while(l<e.length)c.type&&f.push(c),c={value:e.substring(l,l+=2e3),type:\"overflow\"};i=\"start\",n=[];break}}return c.type&&f.push(c),n.length>1&&n[0]!==i&&n.unshift(i),{tokens:f,state:n.length?n:i}}}).call(i.prototype),t.Tokenizer=i}),define(\"ace/edit_session/fold\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/range_list\",\"ace/lib/oop\"],function(e,t,n){function u(e,t){e.row-=t.row,e.row==0&&(e.column-=t.column)}function a(e,t){u(e.start,t),u(e.end,t)}function f(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row}function l(e,t){f(e.start,t),f(e.end,t)}var r=e(\"../range\").Range,i=e(\"../range_list\").RangeList,s=e(\"../lib/oop\"),o=t.Fold=function(e,t){this.foldLine=null,this.placeholder=t,this.range=e,this.start=e.start,this.end=e.end,this.sameRow=e.start.row==e.end.row,this.subFolds=this.ranges=[]};s.inherits(o,i),function(){this.toString=function(){return'\"'+this.placeholder+'\" '+this.range.toString()},this.setFoldLine=function(e){this.foldLine=e,this.subFolds.forEach(function(t){t.setFoldLine(e)})},this.clone=function(){var e=this.range.clone(),t=new o(e,this.placeholder);return this.subFolds.forEach(function(e){t.subFolds.push(e.clone())}),t.collapseChildren=this.collapseChildren,t},this.addSubFold=function(e){if(this.range.isEqual(e))return;if(!this.range.containsRange(e))throw new Error(\"A fold can't intersect already existing fold\"+e.range+this.range);a(e,this.start);var t=e.start.row,n=e.start.column;for(var r=0,i=-1;r<this.subFolds.length;r++){i=this.subFolds[r].range.compare(t,n);if(i!=1)break}var s=this.subFolds[r];if(i==0)return s.addSubFold(e);var t=e.range.end.row,n=e.range.end.column;for(var o=r,i=-1;o<this.subFolds.length;o++){i=this.subFolds[o].range.compare(t,n);if(i!=1)break}var u=this.subFolds[o];if(i==0)throw new Error(\"A fold can't intersect already existing fold\"+e.range+this.range);var f=this.subFolds.splice(r,o-r,e);return e.setFoldLine(this.foldLine),e},this.restoreRange=function(e){return l(e,this.start)}}.call(o.prototype)}),define(\"ace/mode/text\",[\"require\",\"exports\",\"module\",\"ace/tokenizer\",\"ace/mode/text_highlight_rules\",\"ace/mode/behaviour\",\"ace/unicode\",\"ace/lib/lang\",\"ace/token_iterator\",\"ace/range\"],function(e,t,n){var r=e(\"../tokenizer\").Tokenizer,i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./behaviour\").Behaviour,o=e(\"../unicode\"),u=e(\"../lib/lang\"),a=e(\"../token_iterator\").TokenIterator,f=e(\"../range\").Range,l=function(){this.HighlightRules=i,this.$behaviour=new s};(function(){this.tokenRe=new RegExp(\"^[\"+o.packages.L+o.packages.Mn+o.packages.Mc+o.packages.Nd+o.packages.Pc+\"\\\\$_]+\",\"g\"),this.nonTokenRe=new RegExp(\"^(?:[^\"+o.packages.L+o.packages.Mn+o.packages.Mc+o.packages.Nd+o.packages.Pc+\"\\\\$_]|\\\\s])+\",\"g\"),this.getTokenizer=function(){return this.$tokenizer||(this.$highlightRules=new this.HighlightRules,this.$tokenizer=new r(this.$highlightRules.getRules())),this.$tokenizer},this.lineCommentStart=\"\",this.blockComment=\"\",this.toggleCommentLines=function(e,t,n,r){function w(e){for(var t=n;t<=r;t++)e(i.getLine(t),t)}var i=t.doc,s=!0,o=!0,a=Infinity,f=t.getTabSize(),l=!1;if(!this.lineCommentStart){if(!this.blockComment)return!1;var c=this.blockComment.start,h=this.blockComment.end,p=new RegExp(\"^(\\\\s*)(?:\"+u.escapeRegExp(c)+\")\"),d=new RegExp(\"(?:\"+u.escapeRegExp(h)+\")\\\\s*$\"),v=function(e,t){if(g(e,t))return;if(!s||/\\S/.test(e))i.insertInLine({row:t,column:e.length},h),i.insertInLine({row:t,column:a},c)},m=function(e,t){var n;(n=e.match(d))&&i.removeInLine(t,e.length-n[0].length,e.length),(n=e.match(p))&&i.removeInLine(t,n[1].length,n[0].length)},g=function(e,n){if(p.test(e))return!0;var r=t.getTokens(n);for(var i=0;i<r.length;i++)if(r[i].type===\"comment\")return!0}}else{if(Array.isArray(this.lineCommentStart))var p=this.lineCommentStart.map(u.escapeRegExp).join(\"|\"),c=this.lineCommentStart[0];else var p=u.escapeRegExp(this.lineCommentStart),c=this.lineCommentStart;p=new RegExp(\"^(\\\\s*)(?:\"+p+\") ?\"),l=t.getUseSoftTabs();var m=function(e,t){var n=e.match(p);if(!n)return;var r=n[1].length,s=n[0].length;!b(e,r,s)&&n[0][s-1]==\" \"&&s--,i.removeInLine(t,r,s)},y=c+\" \",v=function(e,t){if(!s||/\\S/.test(e))b(e,a,a)?i.insertInLine({row:t,column:a},y):i.insertInLine({row:t,column:a},c)},g=function(e,t){return p.test(e)},b=function(e,t,n){var r=0;while(t--&&e.charAt(t)==\" \")r++;if(r%f!=0)return!1;var r=0;while(e.charAt(n++)==\" \")r++;return f>2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\\S/);n!==-1?(n<a&&(a=n),o&&!g(e,t)&&(o=!1)):E>e.length&&(E=e.length)}),a==Infinity&&(a=E,s=!1,o=!1),l&&a%f!=0&&(a=Math.floor(a/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new a(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,l=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new f(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new a(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new f(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);l.start.row==c&&(l.start.column+=h),l.end.row==c&&(l.end.column+=h),t.selection.fromOrientedRange(l)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)e[t]&&(this.$embeds.push(t),this.$modes[t]=new e[t]);var n=[\"toggleBlockComment\",\"toggleCommentLines\",\"getNextLineIndent\",\"checkOutdent\",\"autoOutdent\",\"transformAction\",\"getCompletions\"];for(var t=0;t<n.length;t++)(function(e){var r=n[t],i=e[r];e[n[t]]=function(){return this.$delegator(r,arguments,i)}})(this)},this.$delegator=function(e,t,n){var r=t[0];typeof r!=\"string\"&&(r=r[0]);for(var i=0;i<this.$embeds.length;i++){if(!this.$modes[this.$embeds[i]])continue;var s=r.split(this.$embeds[i]);if(!s[0]&&s[1]){t[0]=s[1];var o=this.$modes[this.$embeds[i]];return o[e].apply(o,t)}}var u=n.apply(this,t);return n?u:undefined},this.transformAction=function(e,t,n,r,i){if(this.$behaviour){var s=this.$behaviour.getBehaviours();for(var o in s)if(s[o][t]){var u=s[o][t].apply(this,arguments);if(u)return u}}},this.getKeywords=function(e){if(!this.completionKeywords){var t=this.$tokenizer.rules,n=[];for(var r in t){var i=t[r];for(var s=0,o=i.length;s<o;s++)if(typeof i[s].token==\"string\")/keyword|support|storage/.test(i[s].token)&&n.push(i[s].regex);else if(typeof i[s].token==\"object\")for(var u=0,a=i[s].token.length;u<a;u++)if(/keyword|support|storage/.test(i[s].token[u])){var r=i[s].regex.match(/\\(.+?\\)/g)[u];n.push(r.substr(1,r.length-2))}}this.completionKeywords=n}return e?n.concat(this.$keywordList||[]):this.$keywordList},this.$createKeywordList=function(){return this.$highlightRules||this.getTokenizer(),this.$keywordList=this.$highlightRules.$keywordList||[]},this.getCompletions=function(e,t,n,r){var i=this.$keywordList||this.$createKeywordList();return i.map(function(e){return{name:e,value:e,score:0,meta:\"keyword\"}})},this.$id=\"ace/mode/text\"}).call(l.prototype),t.Mode=l}),define(\"ace/range_list\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"./range\").Range,i=r.comparePoints,s=function(){this.ranges=[]};(function(){this.comparePoints=i,this.pointIndex=function(e,t,n){var r=this.ranges;for(var s=n||0;s<r.length;s++){var o=r[s],u=i(e,o.end);if(u>0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.call(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s<t.length;s++){r=n,n=t[s];var o=i(r.end,n.start);if(o<0)continue;if(o==0&&!r.isEmpty()&&!n.isEmpty())continue;i(r.end,n.end)<0&&(r.end.row=n.end.row,r.end.column=n.end.column),t.splice(s,1),e.push(n),n=r,s--}return this.ranges=t,e},this.contains=function(e,t){return this.pointIndex({row:e,column:t})>=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row<e)return[];var r=this.pointIndex({row:e,column:0});r<0&&(r=-r-1);var i=this.pointIndex({row:t,column:0},r);i<0&&(i=-i-1);var s=[];for(var o=r;o<i;o++)s.push(n[o]);return s},this.removeAll=function(){return this.ranges.splice(0,this.ranges.length)},this.attach=function(e){this.session&&this.detach(),this.session=e,this.onChange=this.$onChange.bind(this),this.session.on(\"change\",this.onChange)},this.detach=function(){if(!this.session)return;this.session.removeListener(\"change\",this.onChange),this.session=null},this.$onChange=function(e){var t=e.data.range;if(e.data.action[0]==\"i\")var n=t.start,r=t.end;else var r=t.start,n=t.end;var i=n.row,s=r.row,o=s-i,u=-n.column+r.column,a=this.ranges;for(var f=0,l=a.length;f<l;f++){var c=a[f];if(c.end.row<i)continue;if(c.start.row>i)break;c.start.row==i&&c.start.column>=n.column&&(c.start.column!=n.column||!this.$insertRight)&&(c.start.column+=u,c.start.row+=o);if(c.end.row==i&&c.end.column>=n.column){if(c.end.column==n.column&&this.$insertRight)continue;c.end.column==n.column&&u>0&&f<l-1&&c.end.column>c.start.column&&c.end.column==a[f+1].start.column&&(c.end.column-=u),c.end.column+=u,c.end.row+=o}}if(o!=0&&f<l)for(;f<l;f++){var c=a[f];c.start.row+=o,c.end.row+=o}}}).call(s.prototype),t.RangeList=s}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/edit_session/bracket_match\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\",\"ace/range\"],function(e,t,n){function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n==\"\")return null;var r=n.match(/([\\(\\[\\{])|([\\)\\]\\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\\(\\[\\{])|([\\)\\]\\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\\(\\[\\{])|([\\)\\]\\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.$brackets={\")\":\"(\",\"(\":\")\",\"]\":\"[\",\"[\":\"]\",\"{\":\"}\",\"}\":\"{\"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp(\"(\\\\.?\"+u.type.replace(\".\",\"\\\\.\").replace(\"rparen\",\".paren\")+\")+\"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp(\"(\\\\.?\"+u.type.replace(\".\",\"\\\\.\").replace(\"lparen\",\".paren\")+\")+\"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a<l){var c=f.charAt(a);if(c==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else c==e&&(s+=1);a+=1}do u=o.stepForward();while(u&&!n.test(u.type));if(u==null)break;a=0}return null}}var r=e(\"../token_iterator\").TokenIterator,i=e(\"../range\").Range;t.BracketMatch=s}),define(\"ace/selection\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\",\"ace/range\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/lang\"),s=e(\"./lib/event_emitter\").EventEmitter,o=e(\"./range\").Range,u=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.lead=this.selectionLead=this.doc.createAnchor(0,0),this.anchor=this.selectionAnchor=this.doc.createAnchor(0,0);var t=this;this.lead.on(\"change\",function(e){t._emit(\"changeCursor\"),t.$isEmpty||t._emit(\"changeSelection\"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.selectionAnchor.on(\"change\",function(){t.$isEmpty||t._emit(\"changeSelection\")})};(function(){r.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return this.isEmpty()?!1:this.getRange().isMultiLine()},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.anchor.setPosition(e,t),this.$isEmpty&&(this.$isEmpty=!1,this._emit(\"changeSelection\"))},this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.shiftSelection=function(e){if(this.$isEmpty){this.moveCursorTo(this.lead.row,this.lead.column+e);return}var t=this.getSelectionAnchor(),n=this.getSelectionLead(),r=this.isBackwards();(!r||t.column!==0)&&this.setSelectionAnchor(t.row,t.column+e),(r||n.column!==0)&&this.$moveSelection(function(){this.moveCursorTo(n.row,n.column+e)})},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.isEmpty()?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit(\"changeSelection\"))},this.selectAll=function(){var e=this.doc.getLength()-1;this.setSelectionAnchor(0,0),this.moveCursorTo(e,this.doc.getLine(e).length)},this.setRange=this.setSelectionRange=function(e,t){t?(this.setSelectionAnchor(e.end.row,e.end.column),this.selectTo(e.start.row,e.start.column)):(this.setSelectionAnchor(e.start.row,e.start.column),this.selectTo(e.end.row,e.end.column)),this.getRange().isEmpty()&&(this.$isEmpty=!0),this.$desiredColumn=null},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t==\"undefined\"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e==\"number\"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column==0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(e.column-n,e.column).split(\" \").length-1==n?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row<this.doc.getLength()-1&&this.moveCursorTo(this.lead.row+1,0);else{var n=this.session.getTabSize(),e=this.lead;this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(e.column,e.column+n).split(\" \").length-1==n?this.moveCursorBy(0,n):this.moveCursorBy(0,1)}},this.moveCursorLineStart=function(){var e=this.lead.row,t=this.lead.column,n=this.session.documentToScreenRow(e,t),r=this.session.screenToDocumentPosition(n,0),i=this.session.getDisplayLine(e,null,r.row,r.column),s=i.match(/^\\s*/);s[0].length!=t&&!this.session.$useEmacsStyleLineStart&&(r.column+=s[0].length),this.moveCursorToPosition(r)},this.moveCursorLineEnd=function(){var e=this.lead,t=this.session.getDocumentLastRowColumnPosition(e.row,e.column);if(this.lead.column==t.column){var n=this.session.getLine(t.row);if(t.column==n.length){var r=n.search(/\\s+$/);r>0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i;this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var s=this.session.getFoldAt(e,t,1);if(s){this.moveCursorTo(s.end.row,s.end.column);return}if(i=this.session.nonTokenRe.exec(r))t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t);if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e<this.doc.getLength()-1&&this.moveCursorWordRight();return}if(i=this.session.tokenRe.exec(r))t+=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0;this.moveCursorTo(e,t)},this.moveCursorLongWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1)){this.moveCursorTo(n.start.row,n.start.column);return}var r=this.session.getFoldStringAt(e,t,-1);r==null&&(r=this.doc.getLine(e).substring(0,t));var s=i.stringReverse(r),o;this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;if(o=this.session.nonTokenRe.exec(s))t-=this.session.nonTokenRe.lastIndex,s=s.slice(this.session.nonTokenRe.lastIndex),this.session.nonTokenRe.lastIndex=0;if(t<=0){this.moveCursorTo(e,0),this.moveCursorLeft(),e>0&&this.moveCursorWordLeft();return}if(o=this.session.tokenRe.exec(s))t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0;this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t,n=0,r,i=/\\s/,s=this.session.tokenRe;s.lastIndex=0;if(t=this.session.tokenRe.exec(e))n=this.session.tokenRe.lastIndex;else{while((r=e[n])&&i.test(r))n++;if(n<1){s.lastIndex=0;while((r=e[n])&&!s.test(r)){s.lastIndex=0,n++;if(i.test(r)){if(n>2){n--;break}while((r=e[n])&&i.test(r))n++;if(n>2)break}}}}return s.lastIndex=0,n},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e<s&&/^\\s*$/.test(r));/^\\s+/.test(r)||(r=\"\"),t=0}var o=this.$shortWordEndIndex(r);this.moveCursorTo(e,t+o)},this.moveCursorShortWordLeft=function(){var e=this.lead.row,t=this.lead.column,n;if(n=this.session.getFoldAt(e,t,-1))return this.moveCursorTo(n.start.row,n.start.column);var r=this.session.getLine(e).substring(0,t);if(t==0){do e--,r=this.doc.getLine(e);while(e>0&&/^\\s*$/.test(r));t=r.length,/\\s+$/.test(r)||(r=\"\")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column);t===0&&(this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);var r=this.session.screenToDocumentPosition(n.row+e,n.column);e!==0&&t===0&&r.row===this.lead.row&&r.column===this.lead.column&&this.session.lineWidgets&&this.session.lineWidgets[r.row]&&r.row++,this.moveCursorTo(r.row,r.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0,this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e.call(null,this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e.isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),define(\"ace/search\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/range\"],function(e,t,n){var r=e(\"./lib/lang\"),i=e(\"./lib/oop\"),s=e(\"./range\").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$matchIterator(e,this.$options);if(!t)return!1;var n=null;return t.forEach(function(e,t,r){if(!e.start){var i=e.offset+(r||0);n=new s(t,i,t,i+e.length)}else n=e;return!0}),n},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;h<a;h++)if(i[c+h].search(u[h])==-1)continue e;var p=i[c],d=i[c+a-1],v=p.length-p.match(u[0])[0].length,m=d.match(u[a-1])[0].length;if(l&&l.end.row===c&&l.end.column>v)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;g<i.length;g++){var y=r.getMatchOffsets(i[g],u);for(var h=0;h<y.length;h++){var b=y[h];o.push(new s(g,b.offset,g,b.offset+b.length))}}if(n){var w=n.start.column,E=n.start.column,g=0,h=o.length-1;while(g<h&&o[g].start.column<w&&o[g].start.row==n.start.row)g++;while(g<h&&o[h].end.column>E&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g<h;g++)o[g].start.row+=n.start.row,o[g].end.row+=n.start.row}return o},this.replace=function(e,t){var n=this.$options,r=this.$assembleRegExp(n);if(n.$isMultiLine)return t;if(!r)return;var i=r.exec(e);if(!i||i[0].length!=e.length)return null;t=e.replace(r,t);if(n.preserveCase){t=t.split(\"\");for(var s=Math.min(e.length,e.length);s--;){var o=e[s];o&&o.toLowerCase()!=o?t[s]=t[s].toUpperCase():t[s]=t[s].toLowerCase()}t=t.join(\"\")}return t},this.$matchIterator=function(e,t){var n=this.$assembleRegExp(t);if(!n)return!1;var i=this,o,u=t.backwards;if(t.$isMultiLine)var a=n.length,f=function(t,r,i){var u=t.search(n[0]);if(u==-1)return;for(var f=1;f<a;f++){t=e.getLine(r+f);if(t.search(n[f])==-1)return}var l=t.match(n[a-1])[0].length,c=new s(r,u,r+a-1,l);n.offset==1?(c.start.row--,c.start.column=Number.MAX_VALUE):i&&(c.start.column+=i);if(o(c))return!0};else if(u)var f=function(e,t,i){var s=r.getMatchOffsets(e,n);for(var u=s.length-1;u>=0;u--)if(o(s[u],t,i))return!0};else var f=function(e,t,i){var s=r.getMatchOffsets(e,n);for(var u=0;u<s.length;u++)if(o(s[u],t,i))return!0};return{forEach:function(n){o=n,i.$lineIterator(e,t).forEach(f)}}},this.$assembleRegExp=function(e,t){if(e.needle instanceof RegExp)return e.re=e.needle;var n=e.needle;if(!e.needle)return e.re=!1;e.regExp||(n=r.escapeRegExp(n)),e.wholeWord&&(n=\"\\\\b\"+n+\"\\\\b\");var i=e.caseSensitive?\"g\":\"gi\";e.$isMultiLine=!t&&/[\\n\\r]/.test(n);if(e.$isMultiLine)return e.re=this.$assembleMultilineRegExp(n,i);try{var s=new RegExp(n,i)}catch(o){s=!1}return e.re=s},this.$assembleMultilineRegExp=function(e,t){var n=e.replace(/\\r\\n|\\r|\\n/g,\"$\\n^\").split(\"\\n\"),r=[];for(var i=0;i<n.length;i++)try{r.push(new RegExp(n[i],t))}catch(s){return!1}return n[0]==\"\"?(r.shift(),r.offset=1):r.offset=0,r},this.$lineIterator=function(e,t){var n=t.backwards==1,r=t.skipCurrent!=0,i=t.range,s=t.start;s||(s=i?i[n?\"end\":\"start\"]:e.selection.getRange()),s.start&&(s=s[r!=n?\"end\":\"start\"]);var o=i?i.start.row:0,u=i?i.end.row:e.getLength()-1,a=n?function(n){var r=s.row,i=e.getLine(r).substring(0,s.column);if(n(i,r))return;for(r--;r>=o;r--)if(n(e.getLine(r),r))return;if(t.wrap==0)return;for(r=u,o=s.row;r>=o;r--)if(n(e.getLine(r),r))return}:function(n){var r=s.row,i=e.getLine(r).substr(s.column);if(n(i,r,s.column))return;for(r+=1;r<=u;r++)if(n(e.getLine(r),r))return;if(t.wrap==0)return;for(r=o,u=s.row;r<=u;r++)if(n(e.getLine(r),r))return};return{forEach:a}}}).call(o.prototype),t.Search=o}),define(\"ace/edit_session\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/config\",\"ace/lib/event_emitter\",\"ace/selection\",\"ace/mode/text\",\"ace/range\",\"ace/document\",\"ace/background_tokenizer\",\"ace/search_highlight\",\"ace/edit_session/folding\",\"ace/edit_session/bracket_match\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/lang\"),s=e(\"./config\"),o=e(\"./lib/event_emitter\").EventEmitter,u=e(\"./selection\").Selection,a=e(\"./mode/text\").Mode,f=e(\"./range\").Range,l=e(\"./document\").Document,c=e(\"./background_tokenizer\").BackgroundTokenizer,h=e(\"./search_highlight\").SearchHighlight,p=function(e,t){this.$breakpoints=[],this.$decorations=[],this.$frontMarkers={},this.$backMarkers={},this.$markerId=1,this.$undoSelect=!0,this.$foldData=[],this.$foldData.toString=function(){return this.join(\"\\n\")},this.on(\"changeFold\",this.onChangeFold.bind(this)),this.$onChange=this.onChange.bind(this);if(typeof e!=\"object\"||!e.getLine)e=new l(e);this.setDocument(e),this.selection=new u(this),s.resetOptions(this),this.setMode(t),s._signal(\"session\",this)};(function(){function g(e){return e<4352?!1:e>=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,o),this.setDocument=function(e){this.doc&&this.doc.removeListener(\"change\",this.$onChange),this.doc=e,e.on(\"change\",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t<s))return i;r=i-1}}return n-1},this.resetCaches=function(){this.$modified=!0,this.$wrapData=[],this.$rowLengthCache=[],this.$resetRowCache(0),this.bgTokenizer&&this.bgTokenizer.start(0)},this.onChangeFold=function(e){var t=e.data;this.$resetRowCache(t.start.row)},this.onChange=function(e){var t=e.data;this.$modified=!0,this.$resetRowCache(t.range.start.row);var n=this.$updateInternalDataOnChange(e);!this.$fromUndo&&this.$undoManager&&!t.ignore&&(this.$deltasDoc.push(t),n&&n.length!=0&&this.$deltasFold.push({action:\"removeFolds\",folds:n}),this.$informUndoManager.schedule()),this.bgTokenizer.$updateOnChange(t),this._signal(\"change\",e)},this.setValue=function(e){this.doc.setValue(e),this.selection.moveTo(0,0),this.$resetRowCache(0),this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.setUndoManager(this.$undoManager),this.getUndoManager().reset()},this.getValue=this.toString=function(){return this.doc.getValue()},this.getSelection=function(){return this.selection},this.getState=function(e){return this.bgTokenizer.getState(e)},this.getTokens=function(e){return this.bgTokenizer.getTokens(e)},this.getTokenAt=function(e,t){var n=this.bgTokenizer.getTokens(e),r,i=0;if(t==null)s=n.length-1,i=this.getLine(e).length;else for(var s=0;s<n.length;s++){i+=n[s].value.length;if(i>=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$deltas=[],this.$deltasDoc=[],this.$deltasFold=[],this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.$deltasFold.length&&(t.$deltas.push({group:\"fold\",deltas:t.$deltasFold}),t.$deltasFold=[]),t.$deltasDoc.length&&(t.$deltas.push({group:\"doc\",deltas:t.$deltasDoc}),t.$deltasDoc=[]),t.$deltas.length>0&&e.execute({action:\"aceupdate\",args:[t.$deltas,t],merge:t.mergeUndoDeltas}),t.mergeUndoDeltas=!1,t.$deltas=[]},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},reset:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(\" \",this.getTabSize()):\"\t\"},this.setUseSoftTabs=function(e){this.setOption(\"useSoftTabs\",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption(\"tabSize\",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption(\"overwrite\",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=\"\"),this.$decorations[e]+=\" \"+t,this._signal(\"changeBreakpoint\",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||\"\").replace(\" \"+t,\"\"),this._signal(\"changeBreakpoint\",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t<e.length;t++)this.$breakpoints[e[t]]=\"ace_breakpoint\";this._signal(\"changeBreakpoint\",{})},this.clearBreakpoints=function(){this.$breakpoints=[],this._signal(\"changeBreakpoint\",{})},this.setBreakpoint=function(e,t){t===undefined&&(t=\"ace_breakpoint\"),t?this.$breakpoints[e]=t:delete this.$breakpoints[e],this._signal(\"changeBreakpoint\",{})},this.clearBreakpoint=function(e){delete this.$breakpoints[e],this._signal(\"changeBreakpoint\",{})},this.addMarker=function(e,t,n,r){var i=this.$markerId++,s={range:e,type:n||\"line\",renderer:typeof n==\"function\"?n:null,clazz:t,inFront:!!r,id:i};return r?(this.$frontMarkers[i]=s,this._signal(\"changeFrontMarker\")):(this.$backMarkers[i]=s,this._signal(\"changeBackMarker\")),i},this.addDynamicMarker=function(e,t){if(!e.update)return;var n=this.$markerId++;return e.id=n,e.inFront=!!t,t?(this.$frontMarkers[n]=e,this._signal(\"changeFrontMarker\")):(this.$backMarkers[n]=e,this._signal(\"changeBackMarker\")),e},this.removeMarker=function(e){var t=this.$frontMarkers[e]||this.$backMarkers[e];if(!t)return;var n=t.inFront?this.$frontMarkers:this.$backMarkers;t&&(delete n[e],this._signal(t.inFront?\"changeFrontMarker\":\"changeBackMarker\"))},this.getMarkers=function(e){return e?this.$frontMarkers:this.$backMarkers},this.highlight=function(e){if(!this.$searchHighlight){var t=new h(null,\"ace_selected-word\",\"text\");this.$searchHighlight=this.addDynamicMarker(t)}this.$searchHighlight.setRegexp(e)},this.highlightLines=function(e,t,n,r){typeof t!=\"number\"&&(n=t,t=e),n||(n=\"ace_step\");var i=new f(e,0,t,Infinity);return i.id=this.addMarker(i,n,\"fullLine\",r),i},this.setAnnotations=function(e){this.$annotations=e,this._signal(\"changeAnnotation\",{})},this.getAnnotations=function(){return this.$annotations||[]},this.clearAnnotations=function(){this.setAnnotations([])},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r?\\n)/m);t?this.$autoNewLine=t[1]:this.$autoNewLine=\"\\n\"},this.getWordRange=function(e,t){var n=this.getLine(e),r=!1;t>0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\\s+$/.test(n.slice(t-1,t+1)))var i=/\\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(o<n.length&&n.charAt(o).match(i))o++;return new f(e,s,e,o)},this.getAWordRange=function(e,t){var n=this.getWordRange(e,t),r=this.getLine(n.end.row);while(r.charAt(n.end.column).match(/[ \\t]/))n.end.column+=1;return n},this.setNewLineMode=function(e){this.doc.setNewLineMode(e)},this.getNewLineMode=function(){return this.doc.getNewLineMode()},this.setUseWorker=function(e){this.setOption(\"useWorker\",e)},this.getUseWorker=function(){return this.$useWorker},this.onReloadTokenizer=function(e){var t=e.data;this.bgTokenizer.start(t.first),this._signal(\"tokenizerUpdate\",e)},this.$modes={},this.$mode=null,this.$modeId=null,this.setMode=function(e,t){if(e&&typeof e==\"object\"){if(e.getTokenizer)return this.$onChangeMode(e);var n=e,r=n.path}else r=e||\"ace/mode/text\";this.$modes[\"ace/mode/text\"]||(this.$modes[\"ace/mode/text\"]=new a);if(this.$modes[r]&&!n){this.$onChangeMode(this.$modes[r]),t&&t();return}this.$modeId=r,s.loadModule([\"mode\",r],function(e){if(this.$modeId!==r)return t&&t();if(this.$modes[r]&&!n)return this.$onChangeMode(this.$modes[r]);e&&e.Mode&&(e=new e.Mode(n),n||(this.$modes[r]=e,e.$id=r),this.$onChangeMode(e),t&&t())}.bind(this)),this.$mode||this.$onChangeMode(this.$modes[\"ace/mode/text\"],!0)},this.$onChangeMode=function(e,t){t||(this.$modeId=e.$id);if(this.$mode===e)return;this.$mode=e,this.$stopWorker(),this.$useWorker&&this.$startWorker();var n=e.getTokenizer();if(n.addEventListener!==undefined){var r=this.onReloadTokenizer.bind(this);n.addEventListener(\"update\",r)}if(!this.bgTokenizer){this.bgTokenizer=new c(n);var i=this;this.bgTokenizer.addEventListener(\"update\",function(e){i._signal(\"tokenizerUpdate\",e)})}else this.bgTokenizer.setTokenizer(n);this.bgTokenizer.setDocument(this.getDocument()),this.tokenRe=e.tokenRe,this.nonTokenRe=e.nonTokenRe,t||(this.$options.wrapMethod.set.call(this,this.$wrapMethod),this.$setFolding(e.foldingRules),this.bgTokenizer.start(0),this._emit(\"changeMode\"))},this.$stopWorker=function(){this.$worker&&this.$worker.terminate(),this.$worker=null},this.$startWorker=function(){if(typeof Worker!=\"undefined\"&&!e.noWorker)try{this.$worker=this.$mode.createWorker(this)}catch(t){console.log(\"Could not load worker\"),console.log(t),this.$worker=null}else this.$worker=null},this.getMode=function(){return this.$mode},this.$scrollTop=0,this.setScrollTop=function(e){if(this.$scrollTop===e||isNaN(e))return;this.$scrollTop=e,this._signal(\"changeScrollTop\",e)},this.getScrollTop=function(){return this.$scrollTop},this.$scrollLeft=0,this.setScrollLeft=function(e){if(this.$scrollLeft===e||isNaN(e))return;this.$scrollLeft=e,this._signal(\"changeScrollLeft\",e)},this.getScrollLeft=function(){return this.$scrollLeft},this.getScreenWidth=function(){return this.$computeWidth(),this.lineWidgets?Math.max(this.getLineWidgetMaxWidth(),this.screenWidth):this.screenWidth},this.getLineWidgetMaxWidth=function(){if(this.lineWidgetsWidth!=null)return this.lineWidgetsWidth;var e=0;return this.lineWidgets.forEach(function(t){t&&t.screenWidth>e&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;a<u;a++){if(a>o){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;var n=null;for(var r=e.length-1;r!=-1;r--){var i=e[r];i.group==\"doc\"?(this.doc.revertDeltas(i.deltas),n=this.$getUndoSelection(i.deltas,!0,n)):i.deltas.forEach(function(e){this.addFolds(e.folds)},this)}return this.$fromUndo=!1,n&&this.$undoSelect&&!t&&this.selection.setSelectionRange(n),n},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;var n=null;for(var r=0;r<e.length;r++){var i=e[r];i.group==\"doc\"&&(this.doc.applyDeltas(i.deltas),n=this.$getUndoSelection(i.deltas,!1,n))}return this.$fromUndo=!1,n&&this.$undoSelect&&!t&&this.selection.setSelectionRange(n),n},this.setUndoSelect=function(e){this.$undoSelect=e},this.$getUndoSelection=function(e,t,n){function r(e){var n=e.action===\"insertText\"||e.action===\"insertLines\";return t?!n:n}var i=e[0],s,o,u=!1;r(i)?(s=f.fromPoints(i.range.start,i.range.end),u=!0):(s=f.fromPoints(i.range.start,i.range.start),u=!1);for(var a=1;a<e.length;a++)i=e[a],r(i)?(o=i.range.start,s.compare(o.row,o.column)==-1&&s.setStart(i.range.start),o=i.range.end,s.compare(o.row,o.column)==1&&s.setEnd(i.range.end),u=!0):(o=i.range.start,s.compare(o.row,o.column)==-1&&(s=f.fromPoints(i.range.start,i.range.start)),u=!1);if(n!=null){f.comparePoints(n.start,s.start)===0&&(n.start.column+=s.end.column-s.start.column,n.end.column+=s.end.column-s.start.column);var l=n.compareRange(s);l==1?s.setStart(n.start):l==-1&&s.setEnd(n.end)}return s},this.replace=function(e,t){return this.doc.replace(e,t)},this.moveText=function(e,t,n){var r=this.getTextRange(e),i=this.getFoldsInRange(e),s=f.fromPoints(t,t);if(!n){this.remove(e);var o=e.start.row-e.end.row,u=o?-e.end.column:e.start.column-e.end.column;u&&(s.start.row==e.end.row&&s.start.column>e.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,l=s.start,o=l.row-a.row,u=l.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\\t/g,this.getTabString());for(var r=e;r<=t;r++)this.insert({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new f(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o<r;++o)if(s.charAt(o)!=\" \")break;o<r&&s.charAt(o)==\"\t\"?(n.start.column=o,n.end.column=o+1):(n.start.column=0,n.end.column=o),this.remove(n)}},this.$moveLines=function(e,t,n){e=this.getRowFoldStart(e),t=this.getRowFoldEnd(t);if(n<0){var r=this.getRowFoldStart(e+n);if(r<0)return 0;var i=r-e}else if(n>0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new f(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeLines(e,t);return this.doc.insertLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal(\"changeWrapMode\")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this._signal(\"changeWrapMode\")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal(\"changeWrapLimit\")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n,r=e.data.action,i=e.data.range.start.row,s=e.data.range.end.row,o=e.data.range.start,u=e.data.range.end,a=null;r.indexOf(\"Lines\")!=-1?(r==\"insertLines\"?s=i+e.data.lines.length:s=i,n=e.data.lines?e.data.lines.length:s-i):n=s-i,this.$updating=!0;if(n!=0)if(r.indexOf(\"remove\")!=-1){this[t?\"$wrapData\":\"$rowLengthCache\"].splice(i,n);var f=this.$foldData;a=this.getFoldsInRange(e.data.range),this.removeFolds(a);var l=this.getFoldLine(u.row),c=0;if(l){l.addRemoveChars(u.row,u.column,o.column-u.column),l.shiftRow(-n);var h=this.getFoldLine(i);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=u.row&&l.shiftRow(-n)}s=i}else{var p=Array(n);p.unshift(i,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(i),c=0;if(l){var v=l.range.compareInside(o.row,o.column);v==0?(l=l.split(o.row,o.column),l.shiftRow(n),l.addRemoveChars(s,0,u.column-o.column)):v==-1&&(l.addRemoveChars(i,0,u.column-o.column),l.shiftRow(n)),c=f.indexOf(l)+1}for(c;c<f.length;c++){var l=f[c];l.start.row>=i&&l.shiftRow(n)}}else{n=Math.abs(e.data.range.start.column-e.data.range.end.column),r.indexOf(\"remove\")!=-1&&(a=this.getFoldsInRange(e.data.range),this.removeFolds(a),n=-n);var l=this.getFoldLine(i);l&&l.addRemoveChars(i,o.column,n)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error(\"doc.getLength() and $wrapData.length have to be the same!\"),this.$updating=!1,t?this.$updateWrapData(i,s):this.$updateRowLengthCache(i,s),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var n=this.doc.getAllLines(),r=this.getTabSize(),i=this.$wrapData,s=this.$wrapLimit,o,a,f=e;t=Math.min(t,n.length-1);while(f<=t)a=this.getFoldLine(f,a),a?(o=[],a.walk(function(e,t,r,i){var s;if(e!=null){s=this.$getDisplayTokens(e,o.length),s[0]=u;for(var a=1;a<s.length;a++)s[a]=l}else s=this.$getDisplayTokens(n[t].substring(i,r),o.length);o=o.concat(s)}.bind(this),a.end.row,n[a.end.row].length+1),i[a.start.row]=this.$computeWrapSplits(o,s,r),f=a.end.row+1):(o=this.$getDisplayTokens(n[f]),i[f]=this.$computeWrapSplits(o,s,r),f++)};var t=1,n=2,u=3,l=4,p=9,d=10,v=11,m=12;this.$computeWrapSplits=function(e,t){function a(t){var r=e.slice(i,t),o=r.length;r.join(\"\").replace(/12/g,function(){o-=1}).replace(/2/g,function(){o-=1}),s+=o,n.push(s),i=t}if(e.length==0)return[];var n=[],r=e.length,i=0,s=0,o=this.$wrapAsCode;while(r-i>t){var f=i+t;if(e[f-1]>=d&&e[f]>=d){a(f);continue}if(e[f]==u||e[f]==l){for(f;f!=i-1;f--)if(e[f]==u)break;if(f>i){a(f);continue}f=i+t;for(f;f<e.length;f++)if(e[f]!=l)break;if(f==e.length)break;a(f);continue}var c=Math.max(f-(o?10:t-(t>>2)),i-1);while(f>c&&e[f]<u)f--;if(o){while(f>c&&e[f]<u)f--;while(f>c&&e[f]==p)f--}else while(f>c&&e[f]<d)f--;if(f>c){a(++f);continue}f=i+t,a(f)}return n},this.$getDisplayTokens=function(e,r){var i=[],s;r=r||0;for(var o=0;o<e.length;o++){var u=e.charCodeAt(o);if(u==9){s=this.getScreenTabSize(i.length+r),i.push(v);for(var a=1;a<s;a++)i.push(m)}else u==32?i.push(d):u>39&&u<48||u>57&&u<64?i.push(p):u>=4352&&g(u)?i.push(t,n):i.push(t)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i<e.length;i++){r=e.charCodeAt(i),r==9?n+=this.getScreenTabSize(n):r>=4352&&g(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){if(this.lineWidgets)var t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0;else t=0;return!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getScreenLastRowColumn=function(e){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE);return this.documentToScreenColumn(t.row,t.column)},this.getDocumentLastRowColumn=function(e,t){var n=this.documentToScreenRow(e,t);return this.getScreenLastRowColumn(n)},this.getDocumentLastRowColumnPosition=function(e,t){var n=this.documentToScreenRow(e,t);return this.screenToDocumentPosition(n,Number.MAX_VALUE/10)},this.getRowSplitData=function(e){return this.$useWrapMode?this.$wrapData[e]:undefined},this.getScreenTabSize=function(e){return this.$tabSize-e%this.$tabSize},this.screenToDocumentRow=function(e,t){return this.screenToDocumentPosition(e,t).row},this.screenToDocumentColumn=function(e,t){return this.screenToDocumentPosition(e,t).column},this.screenToDocumentPosition=function(e,t){if(e<0)return{row:0,column:0};var n,r=0,i=0,s,o=0,u=0,a=this.$screenRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var o=a[f],r=this.$docRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getLength()-1,p=this.getNextFoldLine(r),d=p?p.start.row:Infinity;while(o<=e){u=this.getRowLength(r);if(o+u>e||r>=h)break;o+=u,r++,r>d&&(r=p.end.row+1,p=this.getNextFoldLine(r,p),d=p?p.start.row:Infinity),c&&(this.$docRowCache.push(r),this.$screenRowCache.push(o))}if(p&&p.start.row<=r)n=this.getFoldDisplayLine(p),r=p.start.row;else{if(o+u<=e||r>h)return{row:h,column:this.getLine(h).length};n=this.getLine(r),p=null}if(this.$useWrapMode){var v=this.$wrapData[r];if(v){var m=Math.floor(e-o);s=v[m],m>0&&v.length&&(i=v[m-1]||v[v.length-1],n=n.substring(i))}}return i+=this.$getStringScreenWidth(n,t)[1],this.$useWrapMode&&i>=s&&(i=s-1),p?p.idxToPosition(i):{row:r,column:i}},this.documentToScreenPosition=function(e,t){if(typeof t==\"undefined\")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u<e){if(u>=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d=\"\";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);if(this.$useWrapMode){var v=this.$wrapData[i];if(v){var m=0;while(d.length>=v[m])r++,m++;d=d.substring(v[m-1]||0,d.length)}}return{row:r,column:this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;r<n.length;r++)t=n[r],e-=t.end.row-t.start.row}else{var i=this.$wrapData.length,s=0,r=0,t=this.$foldData[r++],o=t?t.start.row:Infinity;while(s<i){var u=this.$wrapData[s];e+=u?u.length+1:1,s++,s>o&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){}}).call(p.prototype),e(\"./edit_session/folding\").Folding.call(p.prototype),e(\"./edit_session/bracket_match\").BracketMatch.call(p.prototype),s.defineOptions(p.prototype,\"session\",{wrap:{set:function(e){!e||e==\"off\"?e=!1:e==\"free\"?e=!0:e==\"printMargin\"?e=-1:typeof e==\"string\"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;if(!e)this.setUseWrapMode(!1);else{var t=typeof e==\"number\"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}this.$wrap=e},get:function(){return this.getUseWrapMode()?this.$wrap==-1?\"printMargin\":this.getWrapLimitRange().min?this.$wrap:\"free\":\"off\"},handlesSet:!0},wrapMethod:{set:function(e){e=e==\"auto\"?this.$mode.type!=\"text\":e!=\"text\",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$modified=!0,this.$resetRowCache(0),this.$updateWrapData(0,this.getLength()-1)))},initialValue:\"auto\"},firstLineNumber:{set:function(){this._signal(\"changeBreakpoint\")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){if(isNaN(e)||this.$tabSize===e)return;this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal(\"changeTabSize\")},initialValue:4,handlesSet:!0},overwrite:{set:function(e){this._signal(\"changeOverwrite\")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId}}}),t.EditSession=p}),define(\"ace/commands/command_manager\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/keyboard/hash_handler\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../keyboard/hash_handler\").HashHandler,s=e(\"../lib/event_emitter\").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler(\"exec\",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){typeof e==\"string\"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;var r={editor:t,command:e,args:n},i=this._emit(\"exec\",r);return this._signal(\"afterExec\",r),i===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit(\"changeStatus\"),this.recording?(this.macro.pop(),this.removeEventListener(\"exec\",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on(\"exec\",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t==\"string\"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!=\"string\"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define(\"ace/keyboard/keybinding\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/event\"],function(e,t,n){var r=e(\"../lib/keys\"),i=e(\"../lib/event\"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e==\"function\"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command==\"null\"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){var t=this.$callKeyboardHandlers(-1,e);t||this.$editor.commands.exec(\"insertstring\",this.$editor,e)}}).call(s.prototype),t.KeyBinding=s}),define(\"ace/keyboard/hash_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"],function(e,t,n){function s(e,t){this.platform=t||(i.isMac?\"mac\":\"win\"),this.commands={},this.commandKeyBinding={};if(this.__defineGetter__&&this.__defineSetter__&&typeof console!=\"undefined\"&&console.error){var n=!1,r=function(){n||(n=!0,console.error(\"commmandKeyBinding has too many m's. use commandKeyBinding\"))};this.__defineGetter__(\"commmandKeyBinding\",function(){return r(),this.commandKeyBinding}),this.__defineSetter__(\"commmandKeyBinding\",function(e){return r(),this.commandKeyBinding=e})}else this.commmandKeyBinding=this.commandKeyBinding;this.addCommands(e)}var r=e(\"../lib/keys\"),i=e(\"../lib/useragent\");(function(){this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e){var t=typeof e==\"string\"?e:e.name;e=this.commands[t],delete this.commands[t];var n=this.commandKeyBinding;for(var r in n)for(var i in n[r])n[r][i]==e&&delete n[r][i]},this.bindKey=function(e,t){if(!e)return;if(typeof t==\"function\"){this.addCommand({exec:t,bindKey:e,name:t.name||e});return}var n=this.commandKeyBinding;e.split(\"|\").forEach(function(e){var r=this.parseKeys(e,t),i=r.hashId;(n[i]||(n[i]={}))[r.key]=t},this)},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n==\"string\")return this.bindKey(n,t);typeof n==\"function\"&&(n={exec:n});if(typeof n!=\"object\")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){var t=e.bindKey;if(!t)return;var n=typeof t==\"string\"?t:t[this.platform];this.bindKey(n,e)},this.parseKeys=function(e){e.indexOf(\" \")!=-1&&(e=e.split(/\\s+/).pop());var t=e.toLowerCase().split(/[\\-\\+]([\\-\\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]==\"shift\")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!=\"undefined\"&&console.error(\"invalid modifier \"+t[o]+\" in \"+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=this.commandKeyBinding;return r[t]&&r[t][n]},this.handleKeyboard=function(e,t,n,r){return{command:this.findKeyCommand(t,n)}}}).call(s.prototype),t.HashHandler=s}),define(\"ace/mouse/fold_handler\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(e){e.on(\"click\",function(t){var n=t.getDocumentPosition(),r=e.session,i=r.getFoldAt(n.row,n.column,1);i&&(t.getAccelKey()?r.removeFold(i):r.expandFold(i),t.stop())}),e.on(\"gutterclick\",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n==\"foldWidgets\"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on(\"gutterdblclick\",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n==\"foldWidgets\"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold(\"...\",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}t.FoldHandler=r}),define(\"ace/commands/default_commands\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/config\",\"ace/range\"],function(e,t,n){function o(e,t){return{win:e,mac:t}}var r=e(\"../lib/lang\"),i=e(\"../config\"),s=e(\"../range\").Range;t.commands=[{name:\"showSettingsMenu\",bindKey:o(\"Ctrl-,\",\"Command-,\"),exec:function(e){i.loadModule(\"ace/ext/settings_menu\",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:\"goToNextError\",bindKey:o(\"Alt-E\",\"Ctrl-E\"),exec:function(e){i.loadModule(\"ace/ext/error_marker\",function(t){t.showErrorMarker(e,1)})},scrollIntoView:\"animate\",readOnly:!0},{name:\"goToPreviousError\",bindKey:o(\"Alt-Shift-E\",\"Ctrl-Shift-E\"),exec:function(e){i.loadModule(\"ace/ext/error_marker\",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:\"animate\",readOnly:!0},{name:\"selectall\",bindKey:o(\"Ctrl-A\",\"Command-A\"),exec:function(e){e.selectAll()},readOnly:!0},{name:\"centerselection\",bindKey:o(null,\"Ctrl-L\"),exec:function(e){e.centerSelection()},readOnly:!0},{name:\"gotoline\",bindKey:o(\"Ctrl-L\",\"Command-L\"),exec:function(e){var t=parseInt(prompt(\"Enter line number:\"),10);isNaN(t)||e.gotoLine(t)},readOnly:!0},{name:\"fold\",bindKey:o(\"Alt-L|Ctrl-F1\",\"Command-Alt-L|Command-F1\"),exec:function(e){e.session.toggleFold(!1)},scrollIntoView:\"center\",readOnly:!0},{name:\"unfold\",bindKey:o(\"Alt-Shift-L|Ctrl-Shift-F1\",\"Command-Alt-Shift-L|Command-Shift-F1\"),exec:function(e){e.session.toggleFold(!0)},scrollIntoView:\"center\",readOnly:!0},{name:\"toggleFoldWidget\",bindKey:o(\"F2\",\"F2\"),exec:function(e){e.session.toggleFoldWidget()},scrollIntoView:\"center\",readOnly:!0},{name:\"toggleParentFoldWidget\",bindKey:o(\"Alt-F2\",\"Alt-F2\"),exec:function(e){e.session.toggleFoldWidget(!0)},scrollIntoView:\"center\",readOnly:!0},{name:\"foldall\",bindKey:o(\"Ctrl-Alt-0\",\"Ctrl-Command-Option-0\"),exec:function(e){e.session.foldAll()},scrollIntoView:\"center\",readOnly:!0},{name:\"foldOther\",bindKey:o(\"Alt-0\",\"Command-Option-0\"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:\"center\",readOnly:!0},{name:\"unfoldall\",bindKey:o(\"Alt-Shift-0\",\"Command-Option-Shift-0\"),exec:function(e){e.session.unfold()},scrollIntoView:\"center\",readOnly:!0},{name:\"findnext\",bindKey:o(\"Ctrl-K\",\"Command-G\"),exec:function(e){e.findNext()},multiSelectAction:\"forEach\",scrollIntoView:\"center\",readOnly:!0},{name:\"findprevious\",bindKey:o(\"Ctrl-Shift-K\",\"Command-Shift-G\"),exec:function(e){e.findPrevious()},multiSelectAction:\"forEach\",scrollIntoView:\"center\",readOnly:!0},{name:\"selectOrFindNext\",bindKey:o(\"Alt-K\",\"Ctrl-G\"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:\"selectOrFindPrevious\",bindKey:o(\"Alt-Shift-K\",\"Ctrl-Shift-G\"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:\"find\",bindKey:o(\"Ctrl-F\",\"Command-F\"),exec:function(e){i.loadModule(\"ace/ext/searchbox\",function(t){t.Search(e)})},readOnly:!0},{name:\"overwrite\",bindKey:\"Insert\",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:\"selecttostart\",bindKey:o(\"Ctrl-Shift-Home\",\"Command-Shift-Up\"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:\"forEach\",readOnly:!0,scrollIntoView:\"animate\",aceCommandGroup:\"fileJump\"},{name:\"gotostart\",bindKey:o(\"Ctrl-Home\",\"Command-Home|Command-Up\"),exec:function(e){e.navigateFileStart()},multiSelectAction:\"forEach\",readOnly:!0,scrollIntoView:\"animate\",aceCommandGroup:\"fileJump\"},{name:\"selectup\",bindKey:o(\"Shift-Up\",\"Shift-Up\"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:\"forEach\",readOnly:!0},{name:\"golineup\",bindKey:o(\"Up\",\"Up|Ctrl-P\"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:\"forEach\",readOnly:!0},{name:\"selecttoend\",bindKey:o(\"Ctrl-Shift-End\",\"Command-Shift-Down\"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:\"forEach\",readOnly:!0,scrollIntoView:\"animate\",aceCommandGroup:\"fileJump\"},{name:\"gotoend\",bindKey:o(\"Ctrl-End\",\"Command-End|Command-Down\"),exec:function(e){e.navigateFileEnd()},multiSelectAction:\"forEach\",readOnly:!0,scrollIntoView:\"animate\",aceCommandGroup:\"fileJump\"},{name:\"selectdown\",bindKey:o(\"Shift-Down\",\"Shift-Down\"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"golinedown\",bindKey:o(\"Down\",\"Down|Ctrl-N\"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectwordleft\",bindKey:o(\"Ctrl-Shift-Left\",\"Option-Shift-Left\"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotowordleft\",bindKey:o(\"Ctrl-Left\",\"Option-Left\"),exec:function(e){e.navigateWordLeft()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selecttolinestart\",bindKey:o(\"Alt-Shift-Left\",\"Command-Shift-Left\"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotolinestart\",bindKey:o(\"Alt-Left|Home\",\"Command-Left|Home|Ctrl-A\"),exec:function(e){e.navigateLineStart()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectleft\",bindKey:o(\"Shift-Left\",\"Shift-Left\"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotoleft\",bindKey:o(\"Left\",\"Left|Ctrl-B\"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectwordright\",bindKey:o(\"Ctrl-Shift-Right\",\"Option-Shift-Right\"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotowordright\",bindKey:o(\"Ctrl-Right\",\"Option-Right\"),exec:function(e){e.navigateWordRight()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selecttolineend\",bindKey:o(\"Alt-Shift-Right\",\"Command-Shift-Right\"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotolineend\",bindKey:o(\"Alt-Right|End\",\"Command-Right|End|Ctrl-E\"),exec:function(e){e.navigateLineEnd()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectright\",bindKey:o(\"Shift-Right\",\"Shift-Right\"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"gotoright\",bindKey:o(\"Right\",\"Right|Ctrl-F\"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectpagedown\",bindKey:\"Shift-PageDown\",exec:function(e){e.selectPageDown()},readOnly:!0},{name:\"pagedown\",bindKey:o(null,\"Option-PageDown\"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:\"gotopagedown\",bindKey:o(\"PageDown\",\"PageDown|Ctrl-V\"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:\"selectpageup\",bindKey:\"Shift-PageUp\",exec:function(e){e.selectPageUp()},readOnly:!0},{name:\"pageup\",bindKey:o(null,\"Option-PageUp\"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:\"gotopageup\",bindKey:\"PageUp\",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:\"scrollup\",bindKey:o(\"Ctrl-Up\",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:\"scrolldown\",bindKey:o(\"Ctrl-Down\",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:\"selectlinestart\",bindKey:\"Shift-Home\",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"selectlineend\",bindKey:\"Shift-End\",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"togglerecording\",bindKey:o(\"Ctrl-Alt-E\",\"Command-Option-E\"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:\"replaymacro\",bindKey:o(\"Ctrl-Shift-E\",\"Command-Shift-E\"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:\"jumptomatching\",bindKey:o(\"Ctrl-P\",\"Ctrl-Shift-P\"),exec:function(e){e.jumpToMatching()},multiSelectAction:\"forEach\",readOnly:!0},{name:\"selecttomatching\",bindKey:o(\"Ctrl-Shift-P\",null),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:\"forEach\",readOnly:!0},{name:\"cut\",exec:function(e){var t=e.getSelectionRange();e._emit(\"cut\",t),e.selection.isEmpty()||(e.session.remove(t),e.clearSelection())},scrollIntoView:\"cursor\",multiSelectAction:\"forEach\"},{name:\"removeline\",bindKey:o(\"Ctrl-D\",\"Command-D\"),exec:function(e){e.removeLines()},scrollIntoView:\"cursor\",multiSelectAction:\"forEachLine\"},{name:\"duplicateSelection\",bindKey:o(\"Ctrl-Shift-D\",\"Command-Shift-D\"),exec:function(e){e.duplicateSelection()},scrollIntoView:\"cursor\",multiSelectAction:\"forEach\"},{name:\"sortlines\",bindKey:o(\"Ctrl-Alt-S\",\"Command-Alt-S\"),exec:function(e){e.sortLines()},scrollIntoView:\"selection\",multiSelectAction:\"forEachLine\"},{name:\"togglecomment\",bindKey:o(\"Ctrl-/\",\"Command-/\"),exec:function(e){e.toggleCommentLines()},multiSelectAction:\"forEachLine\",scrollIntoView:\"selectionPart\"},{name:\"toggleBlockComment\",bindKey:o(\"Ctrl-Shift-/\",\"Command-Shift-/\"),exec:function(e){e.toggleBlockComment()},multiSelectAction:\"forEach\",scrollIntoView:\"selectionPart\"},{name:\"modifyNumberUp\",bindKey:o(\"Ctrl-Shift-Up\",\"Alt-Shift-Up\"),exec:function(e){e.modifyNumber(1)},multiSelectAction:\"forEach\"},{name:\"modifyNumberDown\",bindKey:o(\"Ctrl-Shift-Down\",\"Alt-Shift-Down\"),exec:function(e){e.modifyNumber(-1)},multiSelectAction:\"forEach\"},{name:\"replace\",bindKey:o(\"Ctrl-H\",\"Command-Option-F\"),exec:function(e){i.loadModule(\"ace/ext/searchbox\",function(t){t.Search(e,!0)})}},{name:\"undo\",bindKey:o(\"Ctrl-Z\",\"Command-Z\"),exec:function(e){e.undo()}},{name:\"redo\",bindKey:o(\"Ctrl-Shift-Z|Ctrl-Y\",\"Command-Shift-Z|Command-Y\"),exec:function(e){e.redo()}},{name:\"copylinesup\",bindKey:o(\"Alt-Shift-Up\",\"Command-Option-Up\"),exec:function(e){e.copyLinesUp()},scrollIntoView:\"cursor\"},{name:\"movelinesup\",bindKey:o(\"Alt-Up\",\"Option-Up\"),exec:function(e){e.moveLinesUp()},scrollIntoView:\"cursor\"},{name:\"copylinesdown\",bindKey:o(\"Alt-Shift-Down\",\"Command-Option-Down\"),exec:function(e){e.copyLinesDown()},scrollIntoView:\"cursor\"},{name:\"movelinesdown\",bindKey:o(\"Alt-Down\",\"Option-Down\"),exec:function(e){e.moveLinesDown()},scrollIntoView:\"cursor\"},{name:\"del\",bindKey:o(\"Delete\",\"Delete|Ctrl-D|Shift-Delete\"),exec:function(e){e.remove(\"right\")},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"backspace\",bindKey:o(\"Shift-Backspace|Backspace\",\"Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H\"),exec:function(e){e.remove(\"left\")},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"cut_or_delete\",bindKey:o(\"Shift-Delete\",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove(\"left\")},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"removetolinestart\",bindKey:o(\"Alt-Backspace\",\"Command-Backspace\"),exec:function(e){e.removeToLineStart()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"removetolineend\",bindKey:o(\"Alt-Delete\",\"Ctrl-K\"),exec:function(e){e.removeToLineEnd()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"removewordleft\",bindKey:o(\"Ctrl-Backspace\",\"Alt-Backspace|Ctrl-Alt-Backspace\"),exec:function(e){e.removeWordLeft()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"removewordright\",bindKey:o(\"Ctrl-Delete\",\"Alt-Delete\"),exec:function(e){e.removeWordRight()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"outdent\",bindKey:o(\"Shift-Tab\",\"Shift-Tab\"),exec:function(e){e.blockOutdent()},multiSelectAction:\"forEach\",scrollIntoView:\"selectionPart\"},{name:\"indent\",bindKey:o(\"Tab\",\"Tab\"),exec:function(e){e.indent()},multiSelectAction:\"forEach\",scrollIntoView:\"selectionPart\"},{name:\"blockoutdent\",bindKey:o(\"Ctrl-[\",\"Ctrl-[\"),exec:function(e){e.blockOutdent()},multiSelectAction:\"forEachLine\",scrollIntoView:\"selectionPart\"},{name:\"blockindent\",bindKey:o(\"Ctrl-]\",\"Ctrl-]\"),exec:function(e){e.blockIndent()},multiSelectAction:\"forEachLine\",scrollIntoView:\"selectionPart\"},{name:\"insertstring\",exec:function(e,t){e.insert(t)},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"inserttext\",exec:function(e,t){e.insert(r.stringRepeat(t.text||\"\",t.times||1))},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"splitline\",bindKey:o(null,\"Ctrl-O\"),exec:function(e){e.splitLine()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"transposeletters\",bindKey:o(\"Ctrl-T\",\"Ctrl-T\"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:\"cursor\"},{name:\"touppercase\",bindKey:o(\"Ctrl-U\",\"Ctrl-U\"),exec:function(e){e.toUpperCase()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"tolowercase\",bindKey:o(\"Ctrl-Shift-U\",\"Ctrl-Shift-U\"),exec:function(e){e.toLowerCase()},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\"},{name:\"expandtoline\",bindKey:o(\"Ctrl-Shift-L\",\"Command-Shift-L\"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:\"forEach\",scrollIntoView:\"cursor\",readOnly:!0},{name:\"joinlines\",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\\n\\s*/,\" \").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=\" \"+c),f+=c}i.row+1<e.session.doc.getLength()-1&&(f+=e.session.doc.getNewLineCharacter()),e.clearSelection(),e.session.doc.replace(new s(n.row,0,i.row+2,0),f),a>0?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:\"forEach\",readOnly:!0},{name:\"invertSelection\",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o<r.length;o++)o==r.length-1&&(r[o].end.row!==t||r[o].end.column!==n)&&i.push(new s(r[o].end.row,r[o].end.column,t,n)),o===0?(r[o].start.row!==0||r[o].start.column!==0)&&i.push(new s(0,0,r[o].start.row,r[o].start.column)):i.push(new s(r[o-1].end.row,r[o-1].end.column,r[o].start.row,r[o].start.column));e.exitMultiSelectMode(),e.clearSelection();for(var o=0;o<i.length;o++)e.selection.addRange(i[o],!1)},readOnly:!0,scrollIntoView:\"none\"}]}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/undomanager\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(){this.reset()};(function(){this.execute=function(e){var t=e.args[0];this.$doc=e.args[1],e.merge&&this.hasUndo()&&(this.dirtyCounter--,t=this.$undoStack.pop().concat(t)),this.$undoStack.push(t),this.$redoStack=[],this.dirtyCounter<0&&(this.dirtyCounter=NaN),this.dirtyCounter++},this.undo=function(e){var t=this.$undoStack.pop(),n=null;return t&&(n=this.$doc.undoChanges(t,e),this.$redoStack.push(t),this.dirtyCounter--),n},this.redo=function(e){var t=this.$redoStack.pop(),n=null;return t&&(n=this.$doc.redoChanges(t,e),this.$undoStack.push(t),this.dirtyCounter++),n},this.reset=function(){this.$undoStack=[],this.$redoStack=[],this.dirtyCounter=0},this.hasUndo=function(){return this.$undoStack.length>0},this.hasRedo=function(){return this.$redoStack.length>0},this.markClean=function(){this.dirtyCounter=0},this.isClean=function(){return this.dirtyCounter===0}}).call(r.prototype),t.UndoManager=r}),define(\"ace/lib/net\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"./dom\");t.get=function(e,t){var n=new XMLHttpRequest;n.open(\"GET\",e,!0),n.onreadystatechange=function(){n.readyState===4&&t(n.responseText)},n.send(null)},t.loadScript=function(e,t){var n=r.getDocumentHead(),i=document.createElement(\"script\");i.src=e,n.appendChild(i),i.onload=i.onreadystatechange=function(e,n){if(n||!i.readyState||i.readyState==\"loaded\"||i.readyState==\"complete\")i=i.onload=i.onreadystatechange=null,n||t()}},t.qualifyURL=function(e){var t=document.createElement(\"a\");return t.href=e,t.href}}),define(\"ace/virtual_renderer\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/config\",\"ace/lib/useragent\",\"ace/layer/gutter\",\"ace/layer/marker\",\"ace/layer/text\",\"ace/layer/cursor\",\"ace/scrollbar\",\"ace/renderloop\",\"ace/layer/font_metrics\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/dom\"),s=e(\"./config\"),o=e(\"./lib/useragent\"),u=e(\"./layer/gutter\").Gutter,a=e(\"./layer/marker\").Marker,f=e(\"./layer/text\").Text,l=e(\"./layer/cursor\").Cursor,c=e(\"./scrollbar\").HScrollBar,h=e(\"./scrollbar\").VScrollBar,p=e(\"./renderloop\").RenderLoop,d=e(\"./layer/font_metrics\").FontMetrics,v=e(\"./lib/event_emitter\").EventEmitter,m='.ace_editor {position: relative;overflow: hidden;font-family: \\'Monaco\\', \\'Menlo\\', \\'Ubuntu Mono\\', \\'Consolas\\', \\'source-code-pro\\', monospace;font-size: 12px;line-height: normal;direction: ltr;}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_content {position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: text;min-width: 100%;}.ace_dragging, .ace_dragging * {cursor: move !important;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \\'\\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==\");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==\");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=\");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC\");}.ace_scrollbar {position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;text-indent: -1em;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;}.ace_text-input.ace_composition {background: #f8f8f8;color: #111;z-index: 1000;opacity: 1;text-indent: 0;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;white-space: pre;height: 100%;width: 100%;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;/* setting pointer-events: auto; on node under the mouse, which changesduring scroll, will break mouse wheel scrolling in Safari */pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;}.ace_text-layer {font: inherit !important;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;border-left: 2px solid}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0px;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_smooth-blinking .ace_cursor {-moz-transition: opacity 0.18s;-webkit-transition: opacity 0.18s;-o-transition: opacity 0.18s;-ms-transition: opacity 0.18s;transition: opacity 0.18s;}.ace_editor.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}.ace_line .ace_fold {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=\");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;-moz-border-radius: 2px;-webkit-border-radius: 2px;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII=\"),url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC\");}.ace_tooltip {background-color: #FFF;background-image: -webkit-linear-gradient(top, transparent, rgba(0, 0, 0, 0.1));background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;display: block;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==\");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block;   }.ace_fold-widget.ace_end {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==\");}.ace_fold-widget.ace_closed {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==\");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}/*** Dark version for fold widgets*/.ace_dark .ace_fold-widget {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC\");}.ace_dark .ace_fold-widget.ace_end {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==\");}.ace_dark .ace_fold-widget.ace_closed {background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==\");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {-moz-transition: opacity 0.4s ease 0.05s;-webkit-transition: opacity 0.4s ease 0.05s;-o-transition: opacity 0.4s ease 0.05s;-ms-transition: opacity 0.4s ease 0.05s;transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {-moz-transition: opacity 0.05s ease 0.05s;-webkit-transition: opacity 0.05s ease 0.05s;-o-transition: opacity 0.05s ease 0.05s;-ms-transition: opacity 0.05s ease 0.05s;transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}';i.importCssString(m,\"ace_editor\");var g=function(e,t){var n=this;this.container=e||i.createElement(\"div\"),this.$keepTextAreaAtCursor=!o.isOldIE,i.addCssClass(this.container,\"ace_editor\"),this.setTheme(t),this.$gutter=i.createElement(\"div\"),this.$gutter.className=\"ace_gutter\",this.container.appendChild(this.$gutter),this.scroller=i.createElement(\"div\"),this.scroller.className=\"ace_scroller\",this.container.appendChild(this.scroller),this.content=i.createElement(\"div\"),this.content.className=\"ace_content\",this.scroller.appendChild(this.content),this.$gutterLayer=new u(this.$gutter),this.$gutterLayer.on(\"changeGutterWidth\",this.onGutterResize.bind(this)),this.$markerBack=new a(this.content);var r=this.$textLayer=new f(this.content);this.canvas=r.element,this.$markerFront=new a(this.content),this.$cursorLayer=new l(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new h(this.container,this),this.scrollBarH=new c(this.container,this),this.scrollBarV.addEventListener(\"scroll\",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.addEventListener(\"scroll\",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new d(this.container,500),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.addEventListener(\"changeCharacterSize\",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal(\"changeCharacterSize\",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$loop=new p(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._emit(\"renderer\",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,r.implement(this,v),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle(\"ace_nobold\",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin()},this.setSession=function(e){this.session&&this.session.doc.off(\"changeNewLineMode\",this.onChangeNewLineMode),this.session=e;if(!e)return;this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e),this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on(\"changeNewLineMode\",this.onChangeNewLineMode)},this.updateLines=function(e,t){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRow<t&&(this.$changedLines.lastRow=t)):this.$changedLines={firstRow:e,lastRow:t};if(this.$changedLines.firstRow>this.layerConfig.lastRow||this.$changedLines.lastRow<this.layerConfig.firstRow)return;this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar()},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0)},this.$updateCachedSize=function(e,t,n,r){r-=this.$extraHeight||0;var i=0,s=this.$size,o={width:s.width,height:s.height,scrollerHeight:s.scrollerHeight,scrollerWidth:s.scrollerWidth};r&&(e||s.height!=r)&&(s.height=r,i|=this.CHANGE_SIZE,s.scrollerHeight=s.height,this.$horizScroll&&(s.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+\"px\",i|=this.CHANGE_SCROLL);if(n&&(e||s.width!=n)){i|=this.CHANGE_SIZE,s.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,this.scrollBarH.element.style.left=this.scroller.style.left=t+\"px\",s.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()),this.scrollBarH.element.style.right=this.scroller.style.right=this.scrollBarV.getWidth()+\"px\",this.scroller.style.bottom=this.scrollBarH.getHeight()+\"px\";if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)i|=this.CHANGE_FULL}return s.$dirty=!n||!r,i&&this._signal(\"resize\",o),i},this.onGutterResize=function(){var e=this.$showGutter?this.$gutter.offsetWidth:0;e!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,e,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):(this.$computeLayerConfig(),this.$loop.schedule(this.CHANGE_MARKER))},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption(\"animatedScroll\",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption(\"showInvisibles\",e)},this.getShowInvisibles=function(){return this.getOption(\"showInvisibles\")},this.getDisplayIndentGuides=function(){return this.getOption(\"displayIndentGuides\")},this.setDisplayIndentGuides=function(e){this.setOption(\"displayIndentGuides\",e)},this.setShowPrintMargin=function(e){this.setOption(\"showPrintMargin\",e)},this.getShowPrintMargin=function(){return this.getOption(\"showPrintMargin\")},this.setPrintMarginColumn=function(e){this.setOption(\"printMarginColumn\",e)},this.getPrintMarginColumn=function(){return this.getOption(\"printMarginColumn\")},this.getShowGutter=function(){return this.getOption(\"showGutter\")},this.setShowGutter=function(e){return this.setOption(\"showGutter\",e)},this.getFadeFoldWidgets=function(){return this.getOption(\"fadeFoldWidgets\")},this.setFadeFoldWidgets=function(e){this.setOption(\"fadeFoldWidgets\",e)},this.setHighlightGutterLine=function(e){this.setOption(\"highlightGutterLine\",e)},this.getHighlightGutterLine=function(){return this.getOption(\"highlightGutterLine\")},this.$updateGutterLineHighlight=function(){var e=this.$cursorLayer.$pixelPos,t=this.layerConfig.lineHeight;if(this.session.getUseWrapMode()){var n=this.session.selection.getCursor();n.column=0,e=this.$cursorLayer.getPixelPosition(n,!0),t*=this.session.getRowLength(n.row)}this.$gutterLineHighlight.style.top=e.top-this.layerConfig.offset+\"px\",this.$gutterLineHighlight.style.height=t+\"px\"},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement(\"div\");e.className=\"ace_layer ace_print-margin-layer\",this.$printMarginEl=i.createElement(\"div\"),this.$printMarginEl.className=\"ace_print-margin\",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=this.characterWidth*this.$printMarginColumn+this.$padding+\"px\",t.visibility=this.$showPrintMargin?\"visible\":\"hidden\",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.content},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(!this.$keepTextAreaAtCursor)return;var e=this.layerConfig,t=this.$cursorLayer.$pixelPos.top,n=this.$cursorLayer.$pixelPos.left;t-=e.offset;var r=this.lineHeight;if(t<0||t>e.height-r)return;var i=this.characterWidth;if(this.$composition){var s=this.textarea.value.replace(/^\\x01+/,\"\");i*=this.session.$getStringScreenWidth(s)[0]+2,r+=2,t-=1}n-=this.scrollLeft,n>this.$size.scrollerWidth-i&&(n=this.$size.scrollerWidth-i),n-=this.scrollBar.width,this.textarea.style.height=r+\"px\",this.textarea.style.width=i+\"px\",this.textarea.style.right=Math.max(0,this.$size.scrollerWidth-n-i)+\"px\",this.textarea.style.bottom=Math.max(0,this.$size.height-t-r)+\"px\"},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=Math.floor((this.layerConfig.height+this.layerConfig.offset)/this.layerConfig.lineHeight);return this.layerConfig.firstRow-1+e},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption(\"hScrollBarAlwaysVisible\",e)},this.getVScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption(\"vScrollBarAlwaysVisible\",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal(\"beforeRender\");var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL)e|=this.$computeLayerConfig(),n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),this.$gutterLayer.element.style.marginTop=-n.offset+\"px\",this.content.style.marginTop=-n.offset+\"px\",this.content.style.width=n.width+2*this.$padding+\"px\",this.content.style.height=n.minHeight+\"px\";e&this.CHANGE_H_SCROLL&&(this.content.style.marginLeft=-this.scrollLeft+\"px\",this.scroller.className=this.scrollLeft<=0?\"ace_scroller\":\"ace_scroller ace_scroll-left\");if(e&this.CHANGE_FULL){this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this._signal(\"afterRender\");return}if(e&this.CHANGE_SCROLL){e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$highlightGutterLine&&this.$updateGutterLineHighlight(),this.$moveTextAreaToCursor(),this._signal(\"afterRender\");return}e&this.CHANGE_TEXT?(this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):(e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER)&&this.$showGutter&&this.$gutterLayer.update(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this.$highlightGutterLine&&this.$updateGutterLineHighlight()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal(\"afterRender\")},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.max((this.$minLines||1)*this.lineHeight,Math.min(t,e))+this.scrollMargin.v+(this.$extraHeight||0),r=e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||r!=this.$vScroll){r!=this.$vScroll&&(this.$vScroll=r,this.scrollBarV.setVisible(r));var i=this.container.clientWidth;this.container.style.height=n+\"px\",this.$updateCachedSize(!0,this.$gutterWidth,i,n),this.desiredHeight=n}},this.$computeLayerConfig=function(){this.$maxLines&&this.lineHeight>1&&this.$autosize();var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.scrollTop%this.lineHeight,o=t.scrollerHeight+this.lineHeight,u=this.$getLongestLine(),a=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-u-2*this.$padding<0),f=this.$horizScroll!==a;f&&(this.$horizScroll=a,this.scrollBarH.setVisible(a)),!this.$maxLines&&this.$scrollPastEnd&&(i+=(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd);var l=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i<0),c=this.$vScroll!==l;c&&(this.$vScroll=l,this.scrollBarV.setVisible(l)),this.session.setScrollTop(Math.max(-this.scrollMargin.top,Math.min(this.scrollTop,i-t.scrollerHeight+this.scrollMargin.bottom))),this.session.setScrollLeft(Math.max(-this.scrollMargin.left,Math.min(this.scrollLeft,u+2*this.$padding-t.scrollerWidth+this.scrollMargin.right)));var h=Math.ceil(o/this.lineHeight)-1,p=Math.max(0,Math.round((this.scrollTop-s)/this.lineHeight)),d=p+h,v,m,g=this.lineHeight;p=e.screenToDocumentRow(p,0);var y=e.getFoldLine(p);y&&(p=y.start.row),v=e.documentToScreenRow(p,0),m=e.getRowLength(p)*g,d=Math.min(e.screenToDocumentRow(d,0),e.getLength()-1),o=t.scrollerHeight+e.getRowLength(d)*g+m,s=this.scrollTop-v*g;var b=0;this.layerConfig.width!=u&&(b=this.CHANGE_H_SCROLL);if(f||c)b=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal(\"scrollbarVisibilityChanged\"),c&&(u=this.$getLongestLine());return this.layerConfig={width:u,padding:this.$padding,firstRow:p,firstRowScreen:v,lastRow:d,lineHeight:g,characterWidth:this.characterWidth,minHeight:o,maxHeight:i,offset:s,gutterOffset:Math.max(0,Math.ceil((s+t.height-t.scrollerHeight)/g)),height:this.$size.scrollerHeight},b},this.$updateLines=function(){var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(t<n.firstRow)return;if(t===Infinity){this.$showGutter&&this.$gutterLayer.update(n),this.$textLayer.update(n);return}return this.$textLayer.updateLines(n,e,t),!0},this.$getLongestLine=function(){var e=this.session.getScreenWidth();return this.showInvisibles&&!this.session.$useWrapMode&&(e+=1),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},this.scrollCursorIntoView=function(e,t,n){if(this.$size.scrollerHeight===0)return;var r=this.$cursorLayer.getPixelPosition(e),i=r.left,s=r.top,o=n&&n.top||0,u=n&&n.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-u<s+this.lineHeight&&(t&&(s+=t*this.$size.scrollerHeight),this.session.setScrollTop(s+this.lineHeight-this.$size.scrollerHeight));var f=this.scrollLeft;f>i?(i<this.$padding+2*this.layerConfig.characterWidth&&(i=-this.scrollMargin.left),this.session.setScrollLeft(i)):f+this.$size.scrollerWidth<i+this.characterWidth?this.session.setScrollLeft(Math.round(i+this.characterWidth-this.$size.scrollerWidth)):f<=this.$padding&&i-f<this.characterWidth&&this.session.setScrollLeft(0)},this.getScrollTop=function(){return this.session.getScrollTop()},this.getScrollLeft=function(){return this.session.getScrollLeft()},this.getScrollTopRow=function(){return this.scrollTop/this.lineHeight},this.getScrollBottomRow=function(){return Math.max(0,Math.floor((this.scrollTop+this.$size.scrollerHeight)/this.lineHeight)-1)},this.scrollToRow=function(e){this.session.setScrollTop(e*this.lineHeight)},this.alignCursor=function(e,t){typeof e==\"number\"&&(e={row:e,column:0});var n=this.$cursorLayer.getPixelPosition(e),r=this.$size.scrollerHeight-this.lineHeight,i=n.top-r*(t||0);return this.session.setScrollTop(i),i},this.STEPS=8,this.$calcSteps=function(e,t){var n=0,r=this.STEPS,i=[],s=function(e,t,n){return n*(Math.pow(e-1,3)+1)+t};for(n=0;n<r;++n)i.push(s(n/this.STEPS,e,t-e));return i},this.scrollToLine=function(e,t,n,r){var i=this.$cursorLayer.getPixelPosition({row:e,column:0}),s=i.top;t&&(s-=this.$size.scrollerHeight/2);var o=this.scrollTop;this.session.setScrollTop(s),n!==!1&&this.animateScrolling(o,r)},this.animateScrolling=function(e,t){var n=this.scrollTop;if(!this.$animatedScroll)return;var r=this;if(e==n)return;if(this.$scrollAnimation){var i=this.$scrollAnimation.steps;if(i.length){e=i[0];if(e==n)return}}var s=r.$calcSteps(e,n);this.$scrollAnimation={from:e,to:n,steps:s},clearInterval(this.$timer),r.session.setScrollTop(s.shift()),r.session.$scrollTop=n,this.$timer=setInterval(function(){s.length?(r.session.setScrollTop(s.shift()),r.session.$scrollTop=n):n!=null?(r.session.$scrollTop=-1,r.session.setScrollTop(n),n=null):(r.$timer=clearInterval(r.$timer),r.$scrollAnimation=null,t&&t())},10)},this.scrollToY=function(e){this.scrollTop!==e&&(this.$loop.schedule(this.CHANGE_SCROLL),this.scrollTop=e)},this.scrollToX=function(e){this.scrollLeft!==e&&(this.scrollLeft=e),this.$loop.schedule(this.CHANGE_H_SCROLL)},this.scrollTo=function(e,t){this.session.setScrollTop(t),this.session.setScrollLeft(t)},this.scrollBy=function(e,t){t&&this.session.setScrollTop(this.session.getScrollTop()+t),e&&this.session.setScrollLeft(this.session.getScrollLeft()+e)},this.isScrollableBy=function(e,t){if(t<0&&this.session.getScrollTop()>=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=(e+this.scrollLeft-n.left-this.$padding)/this.characterWidth,i=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),s=Math.round(r);return{row:i,column:s,side:r-s>0?1:-1}},this.screenToTextCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=Math.round((e+this.scrollLeft-n.left-this.$padding)/this.characterWidth),i=(t+this.scrollTop-n.top)/this.lineHeight;return this.session.screenToDocumentPosition(i,Math.max(r,0))},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+Math.round(r.column*this.characterWidth),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,\"ace_focus\")},this.visualizeBlur=function(){i.removeCssClass(this.container,\"ace_focus\")},this.showComposition=function(e){this.$composition||(this.$composition={keepTextAreaAtCursor:this.$keepTextAreaAtCursor,cssText:this.textarea.style.cssText}),this.$keepTextAreaAtCursor=!0,i.addCssClass(this.textarea,\"ace_composition\"),this.textarea.style.cssText=\"\",this.$moveTextAreaToCursor()},this.setCompositionText=function(e){this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;i.removeCssClass(this.textarea,\"ace_composition\"),this.$keepTextAreaAtCursor=this.$composition.keepTextAreaAtCursor,this.textarea.style.cssText=this.$composition.cssText,this.$composition=null},this.setTheme=function(e,t){function o(r){if(n.$themeId!=e)return t&&t();if(!r.cssClass)return;i.importCssString(r.cssText,r.cssClass,n.container.ownerDocument),n.theme&&i.removeCssClass(n.container,n.theme.cssClass);var s=\"padding\"in r?r.padding:\"padding\"in(n.theme||{})?4:n.$padding;n.$padding&&s!=n.$padding&&n.setPadding(s),n.$theme=r.cssClass,n.theme=r,i.addCssClass(n.container,r.cssClass),i.setCssClass(n.container,\"ace_dark\",r.isDark),n.$size&&(n.$size.width=0,n.$updateSizeAsync()),n._dispatchEvent(\"themeLoaded\",{theme:r}),t&&t()}var n=this;this.$themeId=e,n._dispatchEvent(\"themeChange\",{theme:e});if(!e||typeof e==\"string\"){var r=e||this.$options.theme.initialValue;s.loadModule([\"theme\",r],o)}else o(e)},this.getTheme=function(){return this.$themeId},this.setStyle=function(e,t){i.setCssClass(this.container,e,t!==!1)},this.unsetStyle=function(e){i.removeCssClass(this.container,e)},this.setCursorStyle=function(e){this.content.style.cursor!=e&&(this.content.style.cursor=e)},this.setMouseCursor=function(e){this.content.style.cursor=e},this.destroy=function(){this.$textLayer.destroy(),this.$cursorLayer.destroy()}}).call(g.prototype),s.defineOptions(g.prototype,\"renderer\",{animatedScroll:{initialValue:!1},showInvisibles:{set:function(e){this.$textLayer.setShowInvisibles(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!1},showPrintMargin:{set:function(){this.$updatePrintMargin()},initialValue:!0},printMarginColumn:{set:function(){this.$updatePrintMargin()},initialValue:80},printMargin:{set:function(e){typeof e==\"number\"&&(this.$printMarginColumn=e),this.$showPrintMargin=!!e,this.$updatePrintMargin()},get:function(){return this.$showPrintMargin&&this.$printMarginColumn}},showGutter:{set:function(e){this.$gutter.style.display=e?\"block\":\"none\",this.$loop.schedule(this.CHANGE_FULL),this.onGutterResize()},initialValue:!0},fadeFoldWidgets:{set:function(e){i.setCssClass(this.$gutter,\"ace_fade-fold-widgets\",e)},initialValue:!1},showFoldWidgets:{set:function(e){this.$gutterLayer.setShowFoldWidgets(e)},initialValue:!0},showLineNumbers:{set:function(e){this.$gutterLayer.setShowLineNumbers(e),this.$loop.schedule(this.CHANGE_GUTTER)},initialValue:!0},displayIndentGuides:{set:function(e){this.$textLayer.setDisplayIndentGuides(e)&&this.$loop.schedule(this.CHANGE_TEXT)},initialValue:!0},highlightGutterLine:{set:function(e){if(!this.$gutterLineHighlight){this.$gutterLineHighlight=i.createElement(\"div\"),this.$gutterLineHighlight.className=\"ace_gutter-active-line\",this.$gutter.appendChild(this.$gutterLineHighlight);return}this.$gutterLineHighlight.style.display=e?\"\":\"none\",this.$cursorLayer.$pixelPos&&this.$updateGutterLineHighlight()},initialValue:!1,value:!0},hScrollBarAlwaysVisible:{set:function(e){(!this.$hScrollBarAlwaysVisible||!this.$horizScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},vScrollBarAlwaysVisible:{set:function(e){(!this.$vScrollBarAlwaysVisible||!this.$vScroll)&&this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:!1},fontSize:{set:function(e){typeof e==\"number\"&&(e+=\"px\"),this.container.style.fontSize=e,this.updateFontSize()},initialValue:12},fontFamily:{set:function(e){this.container.style.fontFamily=e,this.updateFontSize()}},maxLines:{set:function(e){this.updateFull()}},minLines:{set:function(e){this.updateFull()}},scrollPastEnd:{set:function(e){e=+e||0;if(this.$scrollPastEnd==e)return;this.$scrollPastEnd=e,this.$loop.schedule(this.CHANGE_SCROLL)},initialValue:0,handlesSet:!0},fixedWidthGutter:{set:function(e){this.$gutterLayer.$fixedWidth=!!e,this.$loop.schedule(this.CHANGE_GUTTER)}},theme:{set:function(e){this.setTheme(e)},get:function(){return this.$themeId||this.theme},initialValue:\"./theme/textmate\",handlesSet:!0}}),t.VirtualRenderer=g}),define(\"ace/config\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/oop\",\"ace/lib/net\",\"ace/lib/event_emitter\"],function(e,t,n){\"no use strict\";function f(r){a.packaged=r||e.packaged||n.packaged||u.define&&define.packaged;if(!u.document)return\"\";var i={},s=\"\",o=document.getElementsByTagName(\"script\");for(var f=0;f<o.length;f++){var c=o[f],h=c.src||c.getAttribute(\"src\");if(!h)continue;var p=c.attributes;for(var d=0,v=p.length;d<v;d++){var m=p[d];m.name.indexOf(\"data-ace-\")===0&&(i[l(m.name.replace(/^data-ace-/,\"\"))]=m.value)}var g=h.match(/^(.*)\\/ace(\\-\\w+)?\\.js(\\?|$)/);g&&(s=g[1])}s&&(i.base=i.base||s,i.packaged=!0),i.basePath=i.base,i.workerPath=i.workerPath||i.base,i.modePath=i.modePath||i.base,i.themePath=i.themePath||i.base,delete i.base;for(var y in i)typeof i[y]!=\"undefined\"&&t.set(y,i[y])}function l(e){return e.replace(/-(.)/g,function(e,t){return t.toUpperCase()})}var r=e(\"./lib/lang\"),i=e(\"./lib/oop\"),s=e(\"./lib/net\"),o=e(\"./lib/event_emitter\").EventEmitter,u=function(){return this}(),a={packaged:!1,workerPath:null,modePath:null,themePath:null,basePath:\"\",suffix:\".js\",$moduleUrls:{}};t.get=function(e){if(!a.hasOwnProperty(e))throw new Error(\"Unknown config key: \"+e);return a[e]},t.set=function(e,t){if(!a.hasOwnProperty(e))throw new Error(\"Unknown config key: \"+e);a[e]=t},t.all=function(){return r.copyObject(a)},i.implement(t,o),t.moduleUrl=function(e,t){if(a.$moduleUrls[e])return a.$moduleUrls[e];var n=e.split(\"/\");t=t||n[n.length-2]||\"\";var r=t==\"snippets\"?\"/\":\"-\",i=n[n.length-1];if(r==\"-\"){var s=new RegExp(\"^\"+t+\"[\\\\-_]|[\\\\-_]\"+t+\"$\",\"g\");i=i.replace(s,\"\")}(!i||i==t)&&n.length>1&&(i=n[n.length-2]);var o=a[t+\"Path\"];return o==null?o=a.basePath:r==\"/\"&&(t=r=\"\"),o&&o.slice(-1)!=\"/\"&&(o+=\"/\"),o+t+r+i+this.get(\"suffix\")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit(\"load.module\",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get(\"packaged\"))return a();s.loadScript(t.moduleUrl(n,o),a)},f(!0),t.init=f;var c={setOptions:function(e){Object.keys(e).forEach(function(t){this.setOption(t,e[t])},this)},getOptions:function(e){var t={};return e?Array.isArray(e)||(t=e,e=Object.keys(t)):e=Object.keys(this.$options),e.forEach(function(e){t[e]=this.getOption(e)},this),t},setOption:function(e,t){if(this[\"$\"+e]===t)return;var n=this.$options[e];if(!n)return typeof console!=\"undefined\"&&console.warn&&console.warn('misspelled option \"'+e+'\"'),undefined;if(n.forwardTo)return this[n.forwardTo]&&this[n.forwardTo].setOption(e,t);n.handlesSet||(this[\"$\"+e]=t),n&&n.set&&n.set.call(this,t)},getOption:function(e){var t=this.$options[e];return t?t.forwardTo?this[t.forwardTo]&&this[t.forwardTo].getOption(e):t&&t.get?t.get.call(this):this[\"$\"+e]:(typeof console!=\"undefined\"&&console.warn&&console.warn('misspelled option \"'+e+'\"'),undefined)}},h={};t.defineOptions=function(e,t,n){return e.$options||(h[t]=e.$options={}),Object.keys(n).forEach(function(t){var r=n[t];typeof r==\"string\"&&(r={forwardTo:r}),r.name||(r.name=t),e.$options[r.name]=r,\"initialValue\"in r&&(e[\"$\"+r.name]=r.initialValue)}),i.implement(e,c),this},t.resetOptions=function(e){Object.keys(e.$options).forEach(function(t){var n=e.$options[t];\"value\"in n&&e.setOption(t,n.value)})},t.setDefaultValue=function(e,n,r){var i=h[e]||(h[e]={});i[n]&&(i.forwardTo?t.setDefaultValue(i.forwardTo,n,r):i[n].value=r)},t.setDefaultValues=function(e,n){Object.keys(n).forEach(function(r){t.setDefaultValue(e,r,n[r])})}}),define(\"ace/layer/gutter\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"../lib/dom\"),i=e(\"../lib/oop\"),s=e(\"../lib/lang\"),o=e(\"../lib/event_emitter\").EventEmitter,u=function(e){this.element=r.createElement(\"div\"),this.element.className=\"ace_layer ace_gutter-layer\",e.appendChild(this.element),this.setShowFoldWidgets(this.$showFoldWidgets),this.gutterWidth=0,this.$annotations=[],this.$updateAnnotations=this.$updateAnnotations.bind(this),this.$cells=[]};(function(){i.implement(this,o),this.setSession=function(e){this.session&&this.session.removeEventListener(\"change\",this.$updateAnnotations),this.session=e,e.on(\"change\",this.$updateAnnotations)},this.addGutterDecoration=function(e,t){window.console&&console.warn&&console.warn(\"deprecated use session.addGutterDecoration\"),this.session.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){window.console&&console.warn&&console.warn(\"deprecated use session.removeGutterDecoration\"),this.session.removeGutterDecoration(e,t)},this.setAnnotations=function(e){this.$annotations=[];for(var t=0;t<e.length;t++){var n=e[t],r=n.row,i=this.$annotations[r];i||(i=this.$annotations[r]={text:[]});var o=n.text;o=o?s.escapeHTML(o):n.html||\"\",i.text.indexOf(o)===-1&&i.text.push(o);var u=n.type;u==\"error\"?i.className=\" ace_error\":u==\"warning\"&&i.className!=\" ace_error\"?i.className=\" ace_warning\":u==\"info\"&&!i.className&&(i.className=\" ace_info\")}},this.$updateAnnotations=function(e){if(!this.$annotations.length)return;var t=e.data,n=t.range,r=n.start.row,i=n.end.row-r;if(i!==0)if(t.action==\"removeText\"||t.action==\"removeLines\")this.$annotations.splice(r,i+1,null);else{var s=new Array(i+1);s.unshift(r,1),this.$annotations.splice.apply(this.$annotations,s)}},this.update=function(e){var t=this.session,n=e.firstRow,i=Math.min(e.lastRow+e.gutterOffset,t.getLength()-1),s=t.getNextFoldLine(n),o=s?s.start.row:Infinity,u=this.$showFoldWidgets&&t.foldWidgets,a=t.$breakpoints,f=t.$decorations,l=t.$firstLineNumber,c=0,h=t.gutterRenderer||this.$renderer,p=null,d=-1,v=n;for(;;){v>o&&(v=s.end.row+1,s=t.getNextFoldLine(v,s),o=s?s.start.row:Infinity);if(v>i){while(this.$cells.length>d+1)p=this.$cells.pop(),this.element.removeChild(p.element);break}p=this.$cells[++d],p||(p={element:null,textNode:null,foldWidget:null},p.element=r.createElement(\"div\"),p.textNode=document.createTextNode(\"\"),p.element.appendChild(p.textNode),this.element.appendChild(p.element),this.$cells[d]=p);var m=\"ace_gutter-cell \";a[v]&&(m+=a[v]),f[v]&&(m+=f[v]),this.$annotations[v]&&(m+=this.$annotations[v].className),p.element.className!=m&&(p.element.className=m);var g=t.getRowLength(v)*e.lineHeight+\"px\";g!=p.element.style.height&&(p.element.style.height=g);if(u){var y=u[v];y==null&&(y=u[v]=t.getFoldWidget(v))}if(y){p.foldWidget||(p.foldWidget=r.createElement(\"span\"),p.element.appendChild(p.foldWidget));var m=\"ace_fold-widget ace_\"+y;y==\"start\"&&v==o&&v<s.end.row?m+=\" ace_closed\":m+=\" ace_open\",p.foldWidget.className!=m&&(p.foldWidget.className=m);var g=e.lineHeight+\"px\";p.foldWidget.style.height!=g&&(p.foldWidget.style.height=g)}else p.foldWidget&&(p.element.removeChild(p.foldWidget),p.foldWidget=null);var b=c=h?h.getText(t,v):v+l;b!=p.textNode.data&&(p.textNode.data=b),v++}this.element.style.height=e.minHeight+\"px\";if(this.$fixedWidth||t.$useWrapMode)c=t.getLength()+l;var w=h?h.getWidth(t,c,e):c.toString().length*e.characterWidth,E=this.$padding||this.$computePadding();w+=E.left+E.right,w!==this.gutterWidth&&!isNaN(w)&&(this.gutterWidth=w,this.element.style.width=Math.ceil(this.gutterWidth)+\"px\",this._emit(\"changeGutterWidth\",w))},this.$fixedWidth=!1,this.$showLineNumbers=!0,this.$renderer=\"\",this.setShowLineNumbers=function(e){this.$renderer=!e&&{getWidth:function(){return\"\"},getText:function(){return\"\"}}},this.getShowLineNumbers=function(){return this.$showLineNumbers},this.$showFoldWidgets=!0,this.setShowFoldWidgets=function(e){e?r.addCssClass(this.element,\"ace_folding-enabled\"):r.removeCssClass(this.element,\"ace_folding-enabled\"),this.$showFoldWidgets=e,this.$padding=null},this.getShowFoldWidgets=function(){return this.$showFoldWidgets},this.$computePadding=function(){if(!this.element.firstChild)return{left:0,right:0};var e=r.computedStyle(this.element.firstChild);return this.$padding={},this.$padding.left=parseInt(e.paddingLeft)+1||0,this.$padding.right=parseInt(e.paddingRight)||0,this.$padding},this.getRegion=function(e){var t=this.$padding||this.$computePadding(),n=this.element.getBoundingClientRect();if(e.x<t.left+n.left)return\"markers\";if(this.$showFoldWidgets&&e.x>n.right-t.right)return\"foldWidgets\"}}).call(u.prototype),t.Gutter=u}),define(\"ace/mouse/dragdrop_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/useragent\"],function(e,t,n){function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.$blockScrolling+=1,t.moveCursorToPosition(e),t.$blockScrolling-=1,S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left<a.x.right?-3:2),l/i<=1&&(c.row+=a.y.top<a.y.bottom?-1:1);var h=e.row!=c.row,v=e.column!=c.column,m=!n||e.row!=n.row;h||v&&!m?E?r-E>=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,\"ace_selection\",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),v=setInterval(C,20),y=0,i.addListener(document,\"mousemove\",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.$blockScrolling+=1,t.selection.fromOrientedRange(m),t.$blockScrolling-=1,t.isFocused()&&!w&&t.renderer.$cursorLayer.setBlinking(!t.getReadOnly()),m=null,y=0,E=null,S=null,i.removeListener(document,\"mousemove\",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e==\"text/plain\"||e==\"Text\"})}function _(e){var t=[\"copy\",\"copymove\",\"all\",\"uninitialized\"],n=[\"move\",\"copymove\",\"linkmove\",\"all\",\"uninitialized\"],r=s.isMac?e.altKey:e.ctrlKey,i=\"uninitialized\";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o=\"none\";return r&&t.indexOf(i)>=0?o=\"copy\":n.indexOf(i)>=0?o=\"move\":t.indexOf(i)>=0&&(o=\"copy\"),o}var t=e.editor,n=r.createElement(\"img\");n.src=\"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\",s.isOpera&&(n.style.cssText=\"width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;\");var f=[\"dragWait\",\"dragWaitEnd\",\"startDrag\",\"dragReadyEnd\",\"onMouseDrag\"];f.forEach(function(t){e[t]=this[t]},this),t.addEventListener(\"mousedown\",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?\"copy\":\"copyMove\",s.isOpera&&(t.container.appendChild(n),n._top=n.offsetTop),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData(\"Text\",t.session.getTextRange()),w=!0,this.setState(\"drag\")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n==\"move\"&&t.session.remove(t.getSelectionRange()),t.renderer.$cursorLayer.setBlinking(!0)}this.editor.unsetStyle(\"ace_dragging\")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return h||(k(),y++),A!==null&&(A=null),p=e.clientX,d=e.clientY,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!h)return;var n=e.dataTransfer;if(w)switch(b){case\"move\":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case\"copy\":m=t.moveText(m,g,!0)}else{var r=n.getData(\"Text\");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,\"dragstart\",this.onDragStart.bind(e)),i.addListener(c,\"dragend\",this.onDragEnd.bind(e)),i.addListener(c,\"dragenter\",this.onDragEnter.bind(e)),i.addListener(c,\"dragover\",this.onDragOver.bind(e)),i.addListener(c,\"dragleave\",this.onDragLeave.bind(e)),i.addListener(c,\"drop\",this.onDrop.bind(e));var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e(\"../lib/dom\"),i=e(\"../lib/event\"),s=e(\"../lib/useragent\"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.renderer.$cursorLayer.setBlinking(!this.editor.getReadOnly()),this.editor.unsetStyle(\"ace_dragging\"),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor.container;e.draggable=!0,this.editor.renderer.$cursorLayer.setBlinking(!1),this.editor.setStyle(\"ace_dragging\"),this.setState(\"dragReady\")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state==\"dragReady\"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state===\"dragWait\"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;\"unselectable\"in o&&(o.unselectable=\"on\");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState(\"dragWait\")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),define(\"ace/layer/marker\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../range\").Range,i=e(\"../lib/dom\"),s=function(e){this.element=i.createElement(\"div\"),this.element.className=\"ace_layer ace_marker-layer\",e.appendChild(this.element)};(function(){this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.update=function(e){var e=e||this.config;if(!e)return;this.config=e;var t=[];for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var s=r.range.clipRows(e.firstRow,e.lastRow);if(s.isEmpty())continue;s=s.toScreenRange(this.session);if(r.renderer){var o=this.$getTop(s.start.row,e),u=this.$padding+s.start.column*e.characterWidth;r.renderer(t,s,u,o,e)}else r.type==\"fullLine\"?this.drawFullLineMarker(t,s,r.clazz,e):r.type==\"screenLine\"?this.drawScreenLineMarker(t,s,r.clazz,e):s.isMultiLine()?r.type==\"text\"?this.drawTextMarker(t,s,r.clazz,e):this.drawMultiLineMarker(t,s,r.clazz,e):this.drawSingleLineMarker(t,s,r.clazz+\" ace_start\",e)}this.element=i.setInnerHtml(this.element,t.join(\"\"))},this.$getTop=function(e,t){return(e-t.firstRowScreen)*t.lineHeight},this.drawTextMarker=function(e,t,n,i,s){var o=t.start.row,u=new r(o,t.start.column,o,this.session.getScreenLastRowColumn(o));this.drawSingleLineMarker(e,u,n+\" ace_start\",i,1,s),o=t.end.row,u=new r(o,0,o,t.end.column),this.drawSingleLineMarker(e,u,n,i,0,s);for(o=t.start.row+1;o<t.end.row;o++)u.start.row=o,u.end.row=o,u.end.column=this.session.getScreenLastRowColumn(o),this.drawSingleLineMarker(e,u,n,i,1,s)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth;i=i||\"\",e.push(\"<div class='\",n,\" ace_start' style='\",\"height:\",o,\"px;\",\"right:0;\",\"top:\",u,\"px;\",\"left:\",a,\"px;\",i,\"'></div>\"),u=this.$getTop(t.end.row,r);var f=t.end.column*r.characterWidth;e.push(\"<div class='\",n,\"' style='\",\"height:\",o,\"px;\",\"width:\",f,\"px;\",\"top:\",u,\"px;\",\"left:\",s,\"px;\",i,\"'></div>\"),o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<0)return;u=this.$getTop(t.start.row+1,r),e.push(\"<div class='\",n,\"' style='\",\"height:\",o,\"px;\",\"right:0;\",\"top:\",u,\"px;\",\"left:\",s,\"px;\",i,\"'></div>\")},this.drawSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;e.push(\"<div class='\",n,\"' style='\",\"height:\",o,\"px;\",\"width:\",u,\"px;\",\"top:\",a,\"px;\",\"left:\",f,\"px;\",s||\"\",\"'></div>\")},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),e.push(\"<div class='\",n,\"' style='\",\"height:\",o,\"px;\",\"top:\",s,\"px;\",\"left:0;right:0;\",i||\"\",\"'></div>\")},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;e.push(\"<div class='\",n,\"' style='\",\"height:\",o,\"px;\",\"top:\",s,\"px;\",\"left:0;right:0;\",i||\"\",\"'></div>\")}}).call(s.prototype),t.Marker=s}),define(\"ace/mouse/mouse_event\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\"],function(e,t,n){var r=e(\"../lib/event\"),i=e(\"../lib/useragent\"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define(\"ace/layer/text\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/dom\"),s=e(\"../lib/lang\"),o=e(\"../lib/useragent\"),u=e(\"../lib/event_emitter\").EventEmitter,a=function(e){this.element=i.createElement(\"div\"),this.element.className=\"ace_layer ace_text-layer\",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this)};(function(){r.implement(this,u),this.EOF_CHAR=\"\\xb6\",this.EOL_CHAR_LF=\"\\xac\",this.EOL_CHAR_CRLF=\"\\xa4\",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR=\"\\u2192\",this.SPACE_CHAR=\"\\xb7\",this.$padding=0,this.$updateEolChar=function(){var e=this.session.doc.getNewLineCharacter()==\"\\n\"?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=e)return this.EOL_CHAR=e,!0},this.setPadding=function(e){this.$padding=e,this.element.style.padding=\"0 \"+e+\"px\"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on(\"changeCharacterSize\",function(e){this._signal(\"changeCharacterSize\",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,this.$computeTabString()},this.showInvisibles=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;n<e+1;n++)this.showInvisibles?t.push(\"<span class='ace_invisible ace_invisible_tab'>\"+this.TAB_CHAR+s.stringRepeat(\"\\xa0\",n-1)+\"</span>\"):t.push(s.stringRepeat(\"\\xa0\",n));if(this.displayIndentGuides){this.$indentGuideRe=/\\s\\S| \\t|\\t |\\s$/;var r=\"ace_indent-guide\",i=\"\",o=\"\";if(this.showInvisibles){r+=\" ace_invisible\",i=\" ace_invisible_space\",o=\" ace_invisible_tab\";var u=s.stringRepeat(this.SPACE_CHAR,this.tabSize),a=this.TAB_CHAR+s.stringRepeat(\"\\xa0\",this.tabSize-1)}else var u=s.stringRepeat(\"\\xa0\",this.tabSize),a=u;this.$tabStrings[\" \"]=\"<span class='\"+r+i+\"'>\"+u+\"</span>\",this.$tabStrings[\"\t\"]=\"<span class='\"+r+o+\"'>\"+a+\"</span>\"}},this.updateLines=function(e,t,n){(this.config.lastRow!=e.lastRow||this.config.firstRow!=e.firstRow)&&this.scrollLines(e),this.config=e;var r=Math.max(t,e.firstRow),s=Math.min(n,e.lastRow),o=this.element.childNodes,u=0;for(var a=e.firstRow;a<r;a++){var f=this.session.getFoldLine(a);if(f){if(f.containsRow(r)){r=f.start.row;break}a=f.end.row}u++}var a=r,f=this.session.getNextFoldLine(a),l=f?f.start.row:Infinity;for(;;){a>l&&(a=f.end.row+1,f=this.session.getNextFoldLine(a,f),l=f?f.start.row:Infinity);if(a>s)break;var c=o[u++];if(c){var h=[];this.$renderLine(h,a,!this.$useLineGroups(),a==l?f:!1),c.style.height=e.lineHeight*this.session.getRowLength(a)+\"px\",i.setInnerHtml(c,h.join(\"\"))}a++}},this.scrollLines=function(e){var t=this.config;this.config=e;if(!t||t.lastRow<e.firstRow)return this.update(e);if(e.lastRow<t.firstRow)return this.update(e);var n=this.element;if(t.firstRow<e.firstRow)for(var r=this.session.getFoldedRowCount(t.firstRow,e.firstRow-1);r>0;r--)n.removeChild(n.firstChild);if(t.lastRow>e.lastRow)for(var r=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);r>0;r--)n.removeChild(n.lastChild);if(e.firstRow<t.firstRow){var i=this.$renderLinesFragment(e,e.firstRow,t.firstRow-1);n.firstChild?n.insertBefore(i,n.firstChild):n.appendChild(i)}if(e.lastRow>t.lastRow){var i=this.$renderLinesFragment(e,t.lastRow+1,e.lastRow);n.appendChild(i)}},this.$renderLinesFragment=function(e,t,n){var r=this.element.ownerDocument.createDocumentFragment(),s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=i.createElement(\"div\"),f=[];this.$renderLine(f,s,!1,s==u?o:!1),a.innerHTML=f.join(\"\");if(this.$useLineGroups())a.className=\"ace_line_group\",r.appendChild(a),a.style.height=e.lineHeight*this.session.getRowLength(s)+\"px\";else while(a.firstChild)r.appendChild(a.firstChild);s++}return r},this.update=function(e){this.config=e;var t=[],n=e.firstRow,r=e.lastRow,s=n,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>r)break;this.$useLineGroups()&&t.push(\"<div class='ace_line_group' style='height:\",e.lineHeight*this.session.getRowLength(s),\"px'>\"),this.$renderLine(t,s,!1,s==u?o:!1),this.$useLineGroups()&&t.push(\"</div>\"),s++}this.element=i.setInnerHtml(this.element,t.join(\"\"))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var i=this,o=/\\t|&|<|( +)|([\\x00-\\x1f\\x80-\\xa0\\u1680\\u180E\\u2000-\\u200f\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF])|[\\u1100-\\u115F\\u11A3-\\u11A7\\u11FA-\\u11FF\\u2329-\\u232A\\u2E80-\\u2E99\\u2E9B-\\u2EF3\\u2F00-\\u2FD5\\u2FF0-\\u2FFB\\u3000-\\u303E\\u3041-\\u3096\\u3099-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u3190-\\u31BA\\u31C0-\\u31E3\\u31F0-\\u321E\\u3220-\\u3247\\u3250-\\u32FE\\u3300-\\u4DBF\\u4E00-\\uA48C\\uA490-\\uA4C6\\uA960-\\uA97C\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFAFF\\uFE10-\\uFE19\\uFE30-\\uFE52\\uFE54-\\uFE66\\uFE68-\\uFE6B\\uFF01-\\uFF60\\uFFE0-\\uFFE6]/g,u=function(e,n,r,o,u){if(n)return i.showInvisibles?\"<span class='ace_invisible ace_invisible_space'>\"+s.stringRepeat(i.SPACE_CHAR,e.length)+\"</span>\":s.stringRepeat(\"\\xa0\",e.length);if(e==\"&\")return\"&#38;\";if(e==\"<\")return\"&#60;\";if(e==\"\t\"){var a=i.session.getScreenTabSize(t+o);return t+=a-1,i.$tabStrings[a]}if(e==\"\\u3000\"){var f=i.showInvisibles?\"ace_cjk ace_invisible ace_invisible_space\":\"ace_cjk\",l=i.showInvisibles?i.SPACE_CHAR:\"\";return t+=1,\"<span class='\"+f+\"' style='width:\"+i.config.characterWidth*2+\"px'>\"+l+\"</span>\"}return r?\"<span class='ace_invisible ace_invisible_space ace_invalid'>\"+i.SPACE_CHAR+\"</span>\":(t+=1,\"<span class='ace_cjk' style='width:\"+i.config.characterWidth*2+\"px'>\"+e+\"</span>\")},a=r.replace(o,u);if(!this.$textToken[n.type]){var f=\"ace_\"+n.type.replace(/\\./g,\" ace_\"),l=\"\";n.type==\"fold\"&&(l=\" style='width:\"+n.value.length*this.config.characterWidth+\"px;' \"),e.push(\"<span class='\",f,\"'\",l,\">\",a,\"</span>\")}else e.push(a);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);return r<=0||r>=n?t:t[0]==\" \"?(r-=r%this.tabSize,e.push(s.stringRepeat(this.$tabStrings[\" \"],r/this.tabSize)),t.substr(r)):t[0]==\"\t\"?(e.push(s.stringRepeat(this.$tabStrings[\"\t\"],r)),t.substr(r)):t},this.$renderWrappedLine=function(e,t,n,r){var i=0,s=0,o=n[0],u=0;for(var a=0;a<t.length;a++){var f=t[a],l=f.value;if(a==0&&this.displayIndentGuides){i=l.length,l=this.renderIndentGuide(e,l,o);if(!l)continue;i-=l.length}if(i+l.length<o)u=this.$renderToken(e,u,f,l),i+=l.length;else{while(i+l.length>=o)u=this.$renderToken(e,u,f,l.substring(0,o-i)),l=l.substring(o-i),i=o,r||e.push(\"</div>\",\"<div class='ace_line' style='height:\",this.config.lineHeight,\"px'>\"),s++,u=0,o=n[s]||Number.MAX_VALUE;l.length!=0&&(i+=l.length,u=this.$renderToken(e,u,f,l))}}},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;s<t.length;s++)r=t[s],i=r.value,n=this.$renderToken(e,n,r,i)},this.$renderLine=function(e,t,n,r){!r&&r!=0&&(r=this.session.getFoldLine(t));if(r)var i=this.$getFoldLineTokens(t,r);else var i=this.session.getTokens(t);n||e.push(\"<div class='ace_line' style='height:\",this.config.lineHeight*(this.$useLineGroups()?1:this.session.getRowLength(t)),\"px'>\");if(i.length){var s=this.session.getRowSplitData(t);s&&s.length?this.$renderWrappedLine(e,i,s,n):this.$renderSimpleLine(e,i)}this.showInvisibles&&(r&&(t=r.end.row),e.push(\"<span class='ace_invisible ace_invisible_eol'>\",t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,\"</span>\")),n||e.push(\"</div>\")},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.length<t){s+=e[i].value.length,i++;if(i==e.length)return}if(s!=t){var o=e[i].value.substring(t-s);o.length>n-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(s<n&&i<e.length){var o=e[i].value;o.length+s>n?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:\"fold\",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$measureNode&&this.$measureNode.parentNode.removeChild(this.$measureNode),delete this.$measureNode}}).call(a.prototype),t.Text=a}),define(\"ace/tooltip\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\"],function(e,t,n){function s(e){this.isOpen=!1,this.$element=null,this.$parentNode=e}var r=e(\"./lib/oop\"),i=e(\"./lib/dom\");(function(){this.$init=function(){return this.$element=i.createElement(\"div\"),this.$element.className=\"ace_tooltip\",this.$element.style.display=\"none\",this.$parentNode.appendChild(this.$element),this.$element},this.getElement=function(){return this.$element||this.$init()},this.setText=function(e){i.setInnerText(this.getElement(),e)},this.setHtml=function(e){this.getElement().innerHTML=e},this.setPosition=function(e,t){this.getElement().style.left=e+\"px\",this.getElement().style.top=t+\"px\"},this.setClassName=function(e){i.addCssClass(this.getElement(),e)},this.show=function(e,t,n){e!=null&&this.setText(e),t!=null&&n!=null&&this.setPosition(t,n),this.isOpen||(this.getElement().style.display=\"block\",this.isOpen=!0)},this.hide=function(){this.isOpen&&(this.getElement().style.display=\"none\",this.isOpen=!1)},this.getHeight=function(){return this.getElement().offsetHeight},this.getWidth=function(){return this.getElement().offsetWidth}}).call(s.prototype),t.Tooltip=s}),define(\"ace/layer/cursor\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../lib/dom\"),i,s=function(e){this.element=r.createElement(\"div\"),this.element.className=\"ace_layer ace_cursor-layer\",e.appendChild(this.element),i===undefined&&(i=\"opacity\"in this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,\"ace_hidden-cursors\"),this.$updateCursors=this.$updateVisibility.bind(this)};(function(){this.$updateVisibility=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.visibility=e?\"\":\"hidden\"},this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)t[n].style.opacity=e?\"\":\"0\"},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&!i&&(this.smoothBlinking=e,r.setCssClass(this.element,\"ace_smooth-blinking\",e),this.$updateCursors(!0),this.$updateCursors=(e?this.$updateOpacity:this.$updateVisibility).bind(this),this.restartTimer())},this.addCursor=function(){var e=r.createElement(\"div\");return e.className=\"ace_cursor\",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,\"ace_hidden-cursors\"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,\"ace_hidden-cursors\"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.smoothBlinking&&r.removeCssClass(this.element,\"ace_smooth-blinking\"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible)return;this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,\"ace_smooth-blinking\")}.bind(this));var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+n.column*this.config.characterWidth,i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.update=function(e){this.config=e;var t=this.session.$selectionMarkers,n=0,r=0;if(t===undefined||t.length===0)t=[{cursor:null}];for(var n=0,i=t.length;n<i;n++){var s=this.getPixelPosition(t[n].cursor,!0);if((s.top>e.height+e.offset||s.top<0)&&n>1)continue;var o=(this.cursors[r++]||this.addCursor()).style;o.left=s.left+\"px\",o.top=s.top+\"px\",o.width=e.characterWidth+\"px\",o.height=e.lineHeight+\"px\"}while(this.cursors.length>r)this.removeCursor();var u=this.session.getOverwrite();this.$setOverwrite(u),this.$pixelPos=s,this.restartTimer()},this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,\"ace_overwrite-cursors\"):r.removeCssClass(this.element,\"ace_overwrite-cursors\"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(s.prototype),t.Cursor=s}),define(\"ace/mouse/default_gutter_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/oop\",\"ace/lib/event\",\"ace/tooltip\"],function(e,t,n){function u(e){function l(){var r=u.getDocumentPosition().row,s=n.$annotations[r];if(!s)return c();var o=t.session.getLength();if(r==o){var a=t.renderer.pixelToScreenCoordinates(0,u.y).row,l=u.$pos;if(a>t.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join(\"<br/>\"),i.setHtml(f),i.show(),t.on(\"mousewheel\",c);if(e.$tooltipFollowsMouse)h(u);else{var p=n.$cells[t.session.documentToScreenRow(r,0)].element,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+\"px\",v.top=d.bottom+\"px\"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t.removeEventListener(\"mousewheel\",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler(\"guttermousedown\",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i==\"foldWidgets\")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState(\"selectByLines\"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler(\"guttermousemove\",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,\"ace_fold-widget\"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,\"mouseout\",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)}),t.on(\"changeSession\",c)}function a(e){o.call(this,e)}var r=e(\"../lib/dom\"),i=e(\"../lib/oop\"),s=e(\"../lib/event\"),o=e(\"../tooltip\").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),define(\"ace/scrollbar\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/dom\"),s=e(\"./lib/event\"),o=e(\"./lib/event_emitter\").EventEmitter,u=function(e){this.element=i.createElement(\"div\"),this.element.className=\"ace_scrollbar ace_scrollbar\"+this.classSuffix,this.inner=i.createElement(\"div\"),this.inner.className=\"ace_scrollbar-inner\",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,\"scroll\",this.onScroll.bind(this)),s.addListener(this.element,\"mousedown\",s.preventDefault)};(function(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?\"\":\"none\",this.isVisible=e}}).call(u.prototype);var a=function(e,t){u.call(this,e),this.scrollTop=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+\"px\"};r.inherits(a,u),function(){this.classSuffix=\"-v\",this.onScroll=function(){this.skipEvent||(this.scrollTop=this.element.scrollTop,this._emit(\"scroll\",{data:this.scrollTop})),this.skipEvent=!1},this.getWidth=function(){return this.isVisible?this.width:0},this.setHeight=function(e){this.element.style.height=e+\"px\"},this.setInnerHeight=function(e){this.inner.style.height=e+\"px\"},this.setScrollHeight=function(e){this.inner.style.height=e+\"px\"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=this.element.scrollTop=e)}}.call(a.prototype);var f=function(e,t){u.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+\"px\"};r.inherits(f,u),function(){this.classSuffix=\"-h\",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit(\"scroll\",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+\"px\"},this.setInnerWidth=function(e){this.inner.style.width=e+\"px\"},this.setScrollWidth=function(e){this.inner.style.width=e+\"px\"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(f.prototype),t.ScrollBar=a,t.ScrollBarV=a,t.ScrollBarH=f,t.VScrollBar=a,t.HScrollBar=f}),define(\"ace/mouse/default_handlers\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/lib/useragent\"],function(e,t,n){function u(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler(\"mousedown\",this.onMouseDown.bind(e)),t.setDefaultHandler(\"dblclick\",this.onDoubleClick.bind(e)),t.setDefaultHandler(\"tripleclick\",this.onTripleClick.bind(e)),t.setDefaultHandler(\"quadclick\",this.onQuadClick.bind(e)),t.setDefaultHandler(\"mousewheel\",this.onMouseWheel.bind(e));var n=[\"select\",\"startSelect\",\"selectEnd\",\"selectAllEnd\",\"selectByWordsEnd\",\"selectByLinesEnd\",\"dragWait\",\"dragWaitEnd\",\"focusWait\"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,\"getLineRange\"),e.selectByWords=this.extendSelectionBy.bind(e,\"getWordRange\")}function a(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function f(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row==e.end.row-1&&!e.start.column&&!e.end.column)var n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e(\"../lib/dom\"),i=e(\"../lib/event\"),s=e(\"../lib/useragent\"),o=0;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var r=this.editor,i=e.getButton();if(i!==0){var s=r.getSelectionRange(),o=s.isEmpty();o&&r.selection.moveToPosition(n),r.textInput.onContextMenu(e.domEvent);return}if(t&&!r.isFocused()){r.focus();if(this.$focusTimout&&!this.$clickSelection&&!r.inMultiSelectMode){this.mousedownEvent.time=Date.now(),this.setState(\"focusWait\"),this.captureMouse(e);return}}return this.captureMouse(e),!t||this.$clickSelection||e.getShiftKey()||r.inMultiSelectMode?this.startSelect(n):t&&(this.mousedownEvent.time=Date.now(),this.startSelect(n)),e.preventDefault()},this.startSelect=function(e){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var t=this.editor,n=this.mousedownEvent.getShiftKey();n?t.selection.selectToPosition(e):this.$clickSelection||t.selection.moveToPosition(e),t.renderer.scroller.setCapture&&t.renderer.scroller.setCapture(),t.setStyle(\"ace_selecting\"),this.setState(\"select\")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=f(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=f(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle(\"ace_selecting\"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=a(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>o||t-this.mousedownEvent.time>this.$focusTimout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState(\"select\")):(i=n.selection.getWordRange(t.row,t.column),this.setState(\"selectByWords\")),this.$clickSelection=i,this[this.state]&&this[this.state](e)},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState(\"selectByLines\"),this.$clickSelection=n.selection.getLineRange(t.row),this[this.state]&&this[this.state](e)},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState(\"selectAll\")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=e.domEvent.timeStamp,n=t-(this.$lastScrollTime||0),r=this.editor,i=r.renderer.isScrollableBy(e.wheelX*e.speed,e.wheelY*e.speed);if(i||n<200)return this.$lastScrollTime=t,r.renderer.scrollBy(e.wheelX*e.speed,e.wheelY*e.speed),e.stop()}}).call(u.prototype),t.DefaultHandlers=u}),define(\"ace/renderloop\",[\"require\",\"exports\",\"module\",\"ace/lib/event\"],function(e,t,n){var r=e(\"./lib/event\"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.window=t||window};(function(){this.schedule=function(e){this.changes=this.changes|e;if(!this.pending&&this.changes){this.pending=!0;var t=this;r.nextFrame(function(){t.pending=!1;var e;while(e=t.changes)t.changes=0,t.onRender(e)},this.window)}}}).call(i.prototype),t.RenderLoop=i}),define(\"ace/mouse/mouse_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/mouse/default_handlers\",\"ace/mouse/default_gutter_handler\",\"ace/mouse/mouse_event\",\"ace/mouse/dragdrop_handler\",\"ace/config\"],function(e,t,n){var r=e(\"../lib/event\"),i=e(\"../lib/useragent\"),s=e(\"./default_handlers\").DefaultHandlers,o=e(\"./default_gutter_handler\").GutterHandler,u=e(\"./mouse_event\").MouseEvent,a=e(\"./dragdrop_handler\").DragdropHandler,f=e(\"../config\"),l=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,\"click\",this.onMouseEvent.bind(this,\"click\")),r.addListener(u,\"mousemove\",this.onMouseMove.bind(this,\"mousemove\")),r.addMultiMouseDownListener(u,[400,300,250],this,\"onMouseEvent\"),e.renderer.scrollBarV&&(r.addMultiMouseDownListener(e.renderer.scrollBarV.inner,[400,300,250],this,\"onMouseEvent\"),r.addMultiMouseDownListener(e.renderer.scrollBarH.inner,[400,300,250],this,\"onMouseEvent\"),i.isIE&&(r.addListener(e.renderer.scrollBarV.element,\"mousedown\",n),r.addListener(e.renderer.scrollBarH.element,\"mousemove\",n))),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,\"mousewheel\"));var f=e.renderer.$gutter;r.addListener(f,\"mousedown\",this.onMouseEvent.bind(this,\"guttermousedown\")),r.addListener(f,\"click\",this.onMouseEvent.bind(this,\"gutterclick\")),r.addListener(f,\"dblclick\",this.onMouseEvent.bind(this,\"gutterdblclick\")),r.addListener(f,\"mousemove\",this.onMouseEvent.bind(this,\"guttermousemove\")),r.addListener(u,\"mousedown\",n),r.addListener(f,\"mousedown\",function(t){return e.focus(),r.preventDefault(t)}),e.on(\"mousemove\",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle(\"default\"):s.setCursorStyle(\"\")})};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor.renderer;n.$keepTextAreaAtCursor&&(n.$keepTextAreaAtCursor=null);var s=this,o=function(e){if(!e)return;if(i.isWebKit&&!e.which&&s.releaseMouse)return s.releaseMouse();s.x=e.clientX,s.y=e.clientY,t&&t(e),s.mouseEvent=new u(e,s.editor),s.$mouseMoved=!0},a=function(e){clearInterval(l),f(),s[s.state+\"End\"]&&s[s.state+\"End\"](e),s.state=\"\",n.$keepTextAreaAtCursor==null&&(n.$keepTextAreaAtCursor=!0,n.$moveTextAreaToCursor()),s.isMousePressed=!1,s.$onCaptureMouseMove=s.releaseMouse=null,e&&s.onMouseEvent(\"mouseup\",e)},f=function(){s[s.state]&&s[s.state](),s.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type==\"dblclick\")return setTimeout(function(){a(e)});s.$onCaptureMouseMove=o,s.releaseMouse=r.capture(this.editor.container,o,a);var l=setInterval(f,20)},this.releaseMouse=null}).call(l.prototype),f.defineOptions(l.prototype,\"mouseHandler\",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:150},dragEnabled:{initialValue:!0},focusTimout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=l}),define(\"ace/layer/font_metrics\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/dom\"),s=e(\"../lib/lang\"),o=e(\"../lib/useragent\"),u=e(\"../lib/event_emitter\").EventEmitter,a=0,f=t.FontMetrics=function(e,t){this.el=i.createElement(\"div\"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement(\"div\"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.createElement(\"div\"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),a||this.$testFractionalRect(),this.$measureNode.innerHTML=s.stringRepeat(\"X\",a),this.$characterSize={width:0,height:0},this.checkForSizeChanges()};(function(){r.implement(this,u),this.$characterSize={width:0,height:0},this.$testFractionalRect=function(){var e=i.createElement(\"div\");this.$setMeasureNodeStyles(e.style),e.style.width=\"0.2px\",document.documentElement.appendChild(e);var t=e.getBoundingClientRect().width;t>0&&t<1?a=1:a=100,e.parentNode.removeChild(e)},this.$setMeasureNodeStyles=function(e,t){e.width=e.height=\"auto\",e.left=e.top=\"-100px\",e.visibility=\"hidden\",e.position=\"fixed\",e.whiteSpace=\"pre\",o.isIE<8?e[\"font-family\"]=\"inherit\":e.font=\"inherit\",e.overflow=t?\"hidden\":\"visible\"},this.checkForSizeChanges=function(){var e=this.$measureSizes();if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight=\"bold\";var t=this.$measureSizes();this.$measureNode.style.fontWeight=\"\",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit(\"changeCharacterSize\",{data:e})}},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=setInterval(function(){e.checkForSizeChanges()},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&this.$pollSizeChangesTimer},this.$measureSizes=function(){if(a===1)var e=this.$measureNode.getBoundingClientRect(),t={height:e.height,width:e.width};else var t={height:this.$measureNode.clientHeight,width:this.$measureNode.clientWidth/a};return t.width===0||t.height===0?null:t},this.$measureCharWidth=function(e){this.$main.innerHTML=s.stringRepeat(e,a);var t=this.$main.getBoundingClientRect();return t.width/a},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)}}).call(f.prototype)}),define(\"ace/keyboard/textinput\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/dom\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../lib/event\"),i=e(\"../lib/useragent\"),s=e(\"../lib/dom\"),o=e(\"../lib/lang\"),u=i.isChrome<18,a=i.isIE,f=function(e,t){function b(e){if(h)return;if(k)t=0,r=e?0:n.value.length-1;else var t=e?2:1,r=2;try{n.setSelectionRange(t,r)}catch(i){}}function w(){if(h)return;n.value=f,i.isWebKit&&y.schedule()}function q(){setTimeout(function(){p&&(n.style.cssText=p,p=\"\"),t.renderer.$keepTextAreaAtCursor==null&&(t.renderer.$keepTextAreaAtCursor=!0,t.renderer.$moveTextAreaToCursor())},0)}var n=s.createElement(\"textarea\");n.className=\"ace_text-input\",i.isTouchPad&&n.setAttribute(\"x-palm-disable-auto-cap\",!0),n.wrap=\"off\",n.autocorrect=\"off\",n.autocapitalize=\"off\",n.spellcheck=!1,n.style.opacity=\"0\",e.insertBefore(n,e.firstChild);var f=\"\\x01\\x01\",l=!1,c=!1,h=!1,p=\"\",d=!0;try{var v=document.activeElement===n}catch(m){}r.addListener(n,\"blur\",function(){t.onBlur(),v=!1}),r.addListener(n,\"focus\",function(){v=!0,t.onFocus(),b()}),this.focus=function(){n.focus()},this.blur=function(){n.blur()},this.isFocused=function(){return v};var g=o.delayedCall(function(){v&&b(d)}),y=o.delayedCall(function(){h||(n.value=f,v&&b())});i.isWebKit||t.addEventListener(\"changeSelection\",function(){t.selection.isEmpty()!=d&&(d=!d,g.schedule())}),w(),v&&t.onFocus();var E=function(e){return e.selectionStart===0&&e.selectionEnd===e.value.length};!n.setSelectionRange&&n.createTextRange&&(n.setSelectionRange=function(e,t){var n=this.createTextRange();n.collapse(!0),n.moveStart(\"character\",e),n.moveEnd(\"character\",t),n.select()},E=function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return!t||t.parentElement()!=e?!1:t.text==e.value});if(i.isOldIE){var S=!1,x=function(e){if(S)return;var t=n.value;if(h||!t||t==f)return;if(e&&t==f[0])return T.schedule();A(t),S=!0,w(),S=!1},T=o.delayedCall(x);r.addListener(n,\"propertychange\",x);var N={13:1,27:1};r.addListener(n,\"keyup\",function(e){h&&(!n.value||N[e.keyCode])&&setTimeout(F,0);if((n.value.charCodeAt(0)||0)<129)return T.call();h?j():B()}),r.addListener(n,\"keydown\",function(e){T.schedule(50)})}var C=function(e){l?l=!1:E(n)?(t.selectAll(),b()):k&&b(t.selection.isEmpty())},k=null;this.setInputHandler=function(e){k=e},this.getInputHandler=function(){return k};var L=!1,A=function(e){k&&(e=k(e),k=null),c?(b(),e&&t.onPaste(e),c=!1):e==f.charAt(0)?L?t.execCommand(\"del\",{source:\"ace\"}):t.execCommand(\"backspace\",{source:\"ace\"}):(e.substring(0,2)==f?e=e.substr(2):e.charAt(0)==f.charAt(0)?e=e.substr(1):e.charAt(e.length-1)==f.charAt(0)&&(e=e.slice(0,-1)),e.charAt(e.length-1)==f.charAt(0)&&(e=e.slice(0,-1)),e&&t.onTextInput(e)),L&&(L=!1)},O=function(e){if(h)return;var t=n.value;A(t),w()},M=function(e,t){var n=e.clipboardData||window.clipboardData;if(!n||u)return;var r=a?\"Text\":\"text/plain\";return t?n.setData(r,t)!==!1:n.getData(r)},_=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);M(e,s)?(i?t.onCut():t.onCopy(),r.preventDefault(e)):(l=!0,n.value=s,n.select(),setTimeout(function(){l=!1,w(),b(),i?t.onCut():t.onCopy()}))},D=function(e){_(e,!0)},P=function(e){_(e,!1)},H=function(e){var s=M(e);typeof s==\"string\"?(s&&t.onPaste(s),i.isIE&&setTimeout(b),r.preventDefault(e)):(n.value=\"\",c=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t)),r.addListener(n,\"select\",C),r.addListener(n,\"input\",O),r.addListener(n,\"cut\",D),r.addListener(n,\"copy\",P),r.addListener(n,\"paste\",H),(!(\"oncut\"in n)||!(\"oncopy\"in n)||!(\"onpaste\"in n))&&r.addListener(e,\"keydown\",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:P(e);break;case 86:H(e);break;case 88:D(e)}});var B=function(e){if(h||!t.onCompositionStart)return;h={},t.onCompositionStart(),setTimeout(j,0),t.on(\"mousedown\",F),t.selection.isEmpty()||(t.insert(\"\"),t.session.markUndoGroup(),t.selection.clearSelection()),t.session.markUndoGroup()},j=function(){if(!h||!t.onCompositionUpdate)return;var e=n.value.replace(/\\x01/g,\"\");if(h.lastValue===e)return;t.onCompositionUpdate(e),h.lastValue&&t.undo(),h.lastValue=e;if(h.lastValue){var r=t.selection.getRange();t.insert(h.lastValue),t.session.markUndoGroup(),h.range=t.selection.getRange(),t.selection.setRange(r),t.selection.clearSelection()}},F=function(e){if(!t.onCompositionEnd)return;var r=h;h=!1;var i=setTimeout(function(){i=null;var e=n.value.replace(/\\x01/g,\"\");if(h)return;e==r.lastValue?w():!r.lastValue&&e&&(w(),A(e))});k=function(n){return i&&clearTimeout(i),n=n.replace(/\\x01/g,\"\"),n==r.lastValue?\"\":(r.lastValue&&i&&t.undo(),n)},t.onCompositionEnd(),t.removeListener(\"mousedown\",F),e.type==\"compositionend\"&&r.range&&t.selection.setRange(r.range)},I=o.delayedCall(j,50);r.addListener(n,\"compositionstart\",B),i.isGecko?r.addListener(n,\"text\",function(){I.schedule()}):(r.addListener(n,\"keyup\",function(){I.schedule()}),r.addListener(n,\"keydown\",function(){I.schedule()})),r.addListener(n,\"compositionend\",F),this.getElement=function(){return n},this.setReadOnly=function(e){n.readOnly=e},this.onContextMenu=function(e){L=!0,p||(p=n.style.cssText),n.style.cssText=\"z-index:100000;\"+(i.isIE?\"opacity:0.1;\":\"\"),b(t.selection.isEmpty()),t._emit(\"nativecontextmenu\",{target:t,domEvent:e});var o=t.container.getBoundingClientRect(),u=s.computedStyle(t.container),a=o.top+(parseInt(u.borderTopWidth)||0),f=o.left+(parseInt(o.borderLeftWidth)||0),l=o.bottom-a-n.clientHeight,c=function(e){n.style.left=e.clientX-f-2+\"px\",n.style.top=Math.min(e.clientY-a-2,l)+\"px\"};c(e);if(e.type!=\"mousedown\")return;t.renderer.$keepTextAreaAtCursor&&(t.renderer.$keepTextAreaAtCursor=null),i.isWin&&r.capture(t.container,c,q)},this.onContextMenuClose=q;if(!i.isGecko||i.isMac){var R=function(e){t.textInput.onContextMenu(e),q()};r.addListener(t.renderer.scroller,\"contextmenu\",R),r.addListener(n,\"contextmenu\",R)}};t.TextInput=f}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/worker/worker_client\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/net\",\"ace/lib/event_emitter\",\"ace/config\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/net\"),s=e(\"../lib/event_emitter\").EventEmitter,o=e(\"../config\"),u=function(t,n,r,i){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.onMessage=this.onMessage.bind(this),e.nameToUrl&&!e.toUrl&&(e.toUrl=e.nameToUrl);if(o.get(\"packaged\")||!e.toUrl)i=i||o.moduleUrl(n,\"worker\");else{var s=this.$normalizePath;i=i||s(e.toUrl(\"ace/worker/worker.js\",null,\"_\"));var u={};t.forEach(function(t){u[t]=s(e.toUrl(t,null,\"_\").replace(/(\\.js)?(\\?.*)?$/,\"\"))})}try{this.$worker=new Worker(i)}catch(a){if(!(a instanceof window.DOMException))throw a;var f=this.$workerBlob(i),l=window.URL||window.webkitURL,c=l.createObjectURL(f);this.$worker=new Worker(c),l.revokeObjectURL(c)}this.$worker.postMessage({init:!0,tlns:u,module:n,classname:r}),this.callbackId=1,this.callbacks={},this.$worker.onmessage=this.onMessage};(function(){r.implement(this,s),this.onMessage=function(e){var t=e.data;switch(t.type){case\"log\":window.console&&console.log&&console.log.apply(console,t.data);break;case\"event\":this._signal(t.name,{data:t.data});break;case\"call\":var n=this.callbacks[t.id];n&&(n(t.data),delete this.callbacks[t.id])}},this.$normalizePath=function(e){return i.qualifyURL(e)},this.terminate=function(){this._signal(\"terminate\",{}),this.deltaQueue=null,this.$worker.terminate(),this.$worker=null,this.$doc.removeEventListener(\"change\",this.changeListener),this.$doc=null},this.send=function(e,t){this.$worker.postMessage({command:e,args:t})},this.call=function(e,t,n){if(n){var r=this.callbackId++;this.callbacks[r]=n,t.push(r)}this.send(e,t)},this.emit=function(e,t){try{this.$worker.postMessage({event:e,data:{data:t.data}})}catch(n){console.error(n.stack)}},this.attachToDocument=function(e){this.$doc&&this.terminate(),this.$doc=e,this.call(\"setValue\",[e.getValue()]),e.on(\"change\",this.changeListener)},this.changeListener=function(e){this.deltaQueue?this.deltaQueue.push(e.data):(this.deltaQueue=[e.data],setTimeout(this.$sendDeltaQueue,0))},this.$sendDeltaQueue=function(){var e=this.deltaQueue;if(!e)return;this.deltaQueue=null,e.length>20&&e.length>this.$doc.getLength()>>1?this.call(\"setValue\",[this.$doc.getValue()]):this.emit(\"change\",{data:e})},this.$workerBlob=function(e){var t=\"importScripts('\"+i.qualifyURL(e)+\"');\";try{return new Blob([t],{type:\"application/javascript\"})}catch(n){var r=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder,s=new r;return s.append(t),s.getBlob(\"application/javascript\")}}}).call(u.prototype);var a=function(e,t,n){this.$sendDeltaQueue=this.$sendDeltaQueue.bind(this),this.changeListener=this.changeListener.bind(this),this.callbackId=1,this.callbacks={},this.messageBuffer=[];var r=null,i=!1,u=Object.create(s),a=this;this.$worker={},this.$worker.terminate=function(){},this.$worker.postMessage=function(e){a.messageBuffer.push(e),r&&(i?setTimeout(f):f())},this.setEmitSync=function(e){i=e};var f=function(){var e=a.messageBuffer.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};u.postMessage=function(e){a.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:\"call\",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:\"event\",name:e,data:t})},o.loadModule([\"worker\",t],function(e){r=new e[n](u);while(a.messageBuffer.length)f()})};a.prototype=u.prototype,t.UIWorkerClient=a,t.WorkerClient=u}),define(\"ace/editor\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/useragent\",\"ace/keyboard/textinput\",\"ace/mouse/mouse_handler\",\"ace/mouse/fold_handler\",\"ace/keyboard/keybinding\",\"ace/edit_session\",\"ace/search\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/commands/command_manager\",\"ace/commands/default_commands\",\"ace/config\",\"ace/token_iterator\"],function(e,t,n){e(\"./lib/fixoldbrowsers\");var r=e(\"./lib/oop\"),i=e(\"./lib/dom\"),s=e(\"./lib/lang\"),o=e(\"./lib/useragent\"),u=e(\"./keyboard/textinput\").TextInput,a=e(\"./mouse/mouse_handler\").MouseHandler,f=e(\"./mouse/fold_handler\").FoldHandler,l=e(\"./keyboard/keybinding\").KeyBinding,c=e(\"./edit_session\").EditSession,h=e(\"./search\").Search,p=e(\"./range\").Range,d=e(\"./lib/event_emitter\").EventEmitter,v=e(\"./commands/command_manager\").CommandManager,m=e(\"./commands/default_commands\").commands,g=e(\"./config\"),y=e(\"./token_iterator\").TokenIterator,b=function(e,t){var n=e.getContainerElement();this.container=n,this.renderer=e,this.commands=new v(o.isMac?\"mac\":\"win\",m),this.textInput=new u(e.getTextAreaContainer(),this),this.renderer.textarea=this.textInput.getElement(),this.keyBinding=new l(this),this.$mouseHandler=new a(this),new f(this),this.$blockScrolling=0,this.$search=(new h).set({wrap:!0}),this.$historyTracker=this.$historyTracker.bind(this),this.commands.on(\"exec\",this.$historyTracker),this.$initOperationListeners(),this._$emitInputEvent=s.delayedCall(function(){this._signal(\"input\",{}),this.session.bgTokenizer&&this.session.bgTokenizer.scheduleStart()}.bind(this)),this.on(\"change\",function(e,t){t._$emitInputEvent.schedule(31)}),this.setSession(t||new c(\"\")),g.resetOptions(this),g._signal(\"editor\",this)};(function(){r.implement(this,d),this.$initOperationListeners=function(){function e(e){return e[e.length-1]}this.selections=[],this.commands.on(\"exec\",function(t){this.startOperation(t);var n=t.command;if(n.aceCommandGroup==\"fileJump\"){var r=this.prevOp;if(!r||r.command.aceCommandGroup!=\"fileJump\")this.lastFileJumpPos=e(this.selections)}else this.lastFileJumpPos=null}.bind(this),!0),this.commands.on(\"afterExec\",function(e){var t=e.command;t.aceCommandGroup==\"fileJump\"&&this.lastFileJumpPos&&!this.curOp.selectionChanged&&this.selection.fromJSON(this.lastFileJumpPos),this.endOperation(e)}.bind(this),!0),this.$opResetTimer=s.delayedCall(this.endOperation.bind(this)),this.on(\"change\",function(){this.curOp||this.startOperation(),this.curOp.docChanged=!0}.bind(this),!0),this.on(\"changeSelection\",function(){this.curOp||this.startOperation(),this.curOp.selectionChanged=!0}.bind(this),!0)},this.curOp=null,this.prevOp={},this.startOperation=function(e){if(this.curOp){if(!e||this.curOp.command)return;this.prevOp=this.curOp}e||(this.previousCommand=null,e={}),this.$opResetTimer.schedule(),this.curOp={command:e.command||{},args:e.args,scrollTop:this.renderer.scrollTop};var t=this.curOp.command;t&&t.scrollIntoView&&this.$blockScrolling++,this.selections.push(this.selection.toJSON())},this.endOperation=function(){if(this.curOp){var e=this.curOp.command;if(e&&e.scrollIntoView){this.$blockScrolling--;switch(e.scrollIntoView){case\"center\":this.renderer.scrollCursorIntoView(null,.5);break;case\"animate\":case\"cursor\":this.renderer.scrollCursorIntoView();break;case\"selectionPart\":var t=this.selection.getRange(),n=this.renderer.layerConfig;(t.start.row>=n.lastRow||t.end.row<=n.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}e.scrollIntoView==\"animate\"&&this.renderer.animateScrolling(this.curOp.scrollTop)}this.prevOp=this.curOp,this.curOp=null}},this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=[\"backspace\",\"del\",\"insertstring\"],r=t.command&&e.command.name==t.command.name;if(e.command.name==\"insertstring\"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\\s/.test(i)||/\\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!=\"always\"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e){if(!e)this.keyBinding.setKeyboardHandler(null);else if(typeof e==\"string\"){this.$keybindingId=e;var t=this;g.loadModule([\"keybinding\",e],function(n){t.$keybindingId==e&&t.keyBinding.setKeyboardHandler(n&&n.handler)})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e)},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;var t=this.session;if(t){this.session.removeEventListener(\"change\",this.$onDocumentChange),this.session.removeEventListener(\"changeMode\",this.$onChangeMode),this.session.removeEventListener(\"tokenizerUpdate\",this.$onTokenizerUpdate),this.session.removeEventListener(\"changeTabSize\",this.$onChangeTabSize),this.session.removeEventListener(\"changeWrapLimit\",this.$onChangeWrapLimit),this.session.removeEventListener(\"changeWrapMode\",this.$onChangeWrapMode),this.session.removeEventListener(\"onChangeFold\",this.$onChangeFold),this.session.removeEventListener(\"changeFrontMarker\",this.$onChangeFrontMarker),this.session.removeEventListener(\"changeBackMarker\",this.$onChangeBackMarker),this.session.removeEventListener(\"changeBreakpoint\",this.$onChangeBreakpoint),this.session.removeEventListener(\"changeAnnotation\",this.$onChangeAnnotation),this.session.removeEventListener(\"changeOverwrite\",this.$onCursorChange),this.session.removeEventListener(\"changeScrollTop\",this.$onScrollTopChange),this.session.removeEventListener(\"changeScrollLeft\",this.$onScrollLeftChange);var n=this.session.getSelection();n.removeEventListener(\"changeCursor\",this.$onCursorChange),n.removeEventListener(\"changeSelection\",this.$onSelectionChange)}this.session=e,e&&(this.$onDocumentChange=this.onDocumentChange.bind(this),e.addEventListener(\"change\",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.addEventListener(\"changeMode\",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.addEventListener(\"tokenizerUpdate\",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.addEventListener(\"changeTabSize\",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.addEventListener(\"changeWrapLimit\",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.addEventListener(\"changeWrapMode\",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.addEventListener(\"changeFold\",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.addEventListener(\"changeFrontMarker\",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.addEventListener(\"changeBackMarker\",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.addEventListener(\"changeBreakpoint\",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.addEventListener(\"changeAnnotation\",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.addEventListener(\"changeOverwrite\",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.addEventListener(\"changeScrollTop\",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.addEventListener(\"changeScrollLeft\",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.addEventListener(\"changeCursor\",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.addEventListener(\"changeSelection\",this.$onSelectionChange),this.onChangeMode(),this.$blockScrolling+=1,this.onCursorChange(),this.$blockScrolling-=1,this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()),this._signal(\"changeSession\",{session:e,oldSession:t}),t&&t._signal(\"changeEditor\",{oldEditor:this}),e&&e._signal(\"changeEditor\",{editor:this})},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?t==1?this.navigateFileEnd():t==-1&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption(\"fontSize\")||i.computedStyle(this.container,\"fontSize\")},this.setFontSize=function(e){this.setOption(\"fontSize\",e)},this.$highlightBrackets=function(){this.session.$bracketHighlight&&(this.session.removeMarker(this.session.$bracketHighlight),this.session.$bracketHighlight=null);if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session.findMatchingBracket(e.getCursorPosition());if(t)var n=new p(t.row,t.column,t.row,t.column+1);else if(e.session.$mode.getMatching)var n=e.session.$mode.getMatching(e.session);n&&(e.session.$bracketHighlight=e.session.addMarker(n,\"ace_bracket\",\"text\"))},50)},this.$highlightTags=function(){var e=this.session;if(this.$highlightTagPending)return;var t=this;this.$highlightTagPending=!0,setTimeout(function(){t.$highlightTagPending=!1;var n=t.getCursorPosition(),r=new y(t.session,n.row,n.column),i=r.getCurrentToken();if(!i||i.type.indexOf(\"tag-name\")===-1){e.removeMarker(e.$tagHighlight),e.$tagHighlight=null;return}var s=i.value,o=0,u=r.stepBackward();if(u.value==\"<\"){do u=i,i=r.stepForward(),i&&i.value===s&&i.type.indexOf(\"tag-name\")!==-1&&(u.value===\"<\"?o++:u.value===\"</\"&&o--);while(i&&o>=0)}else{do i=u,u=r.stepBackward(),i&&i.value===s&&i.type.indexOf(\"tag-name\")!==-1&&(u.value===\"<\"?o++:u.value===\"</\"&&o--);while(u&&o<=0);r.stepForward()}if(!i){e.removeMarker(e.$tagHighlight),e.$tagHighlight=null;return}var a=r.getCurrentTokenRow(),f=r.getCurrentTokenColumn(),l=new p(a,f,a,f+i.value.length);e.$tagHighlight&&l.compareRange(e.$backMarkers[e.$tagHighlight].range)!==0&&(e.removeMarker(e.$tagHighlight),e.$tagHighlight=null),l&&!e.$tagHighlight&&(e.$tagHighlight=e.addMarker(l,\"ace_bracket\",\"text\"))},50)},this.focus=function(){var e=this;setTimeout(function(){e.textInput.focus()}),this.textInput.focus()},this.isFocused=function(){return this.textInput.isFocused()},this.blur=function(){this.textInput.blur()},this.onFocus=function(){if(this.$isFocused)return;this.$isFocused=!0,this.renderer.showCursor(),this.renderer.visualizeFocus(),this._emit(\"focus\")},this.onBlur=function(){if(!this.$isFocused)return;this.$isFocused=!1,this.renderer.hideCursor(),this.renderer.visualizeBlur(),this._emit(\"blur\")},this.$cursorChange=function(){this.renderer.updateCursor()},this.onDocumentChange=function(e){var t=e.data,n=t.range,r;n.start.row==n.end.row&&t.action!=\"insertLines\"&&t.action!=\"removeLines\"?r=n.end.row:r=Infinity,this.renderer.updateLines(n.start.row,r),this._signal(\"change\",e),this.$cursorChange()},this.onTokenizerUpdate=function(e){var t=e.data;this.renderer.updateLines(t.first,t.last)},this.onScrollTopChange=function(){this.renderer.scrollToY(this.session.getScrollTop())},this.onScrollLeftChange=function(){this.renderer.scrollToX(this.session.getScrollLeft())},this.onCursorChange=function(){this.$cursorChange(),this.$blockScrolling||this.renderer.scrollCursorIntoView(),this.$highlightBrackets(),this.$highlightTags(),this.$updateHighlightActiveLine(),this._signal(\"changeSelection\")},this.$updateHighlightActiveLine=function(){var e=this.getSession(),t;if(this.$highlightActiveLine){if(this.$selectionStyle!=\"line\"||!this.selection.isMultiLine())t=this.getCursorPosition();this.renderer.$maxLines&&this.session.getLength()===1&&!(this.renderer.$minLines>1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,\"ace_active-line\",\"screenLine\"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal(\"changeBackMarker\"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,\"ace_selection\",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal(\"changeSelection\")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column-1,r=t.end.column+1,i=e.getLine(t.start.row),s=i.length,o=i.substring(Math.max(n,0),Math.min(r,s));if(n>=0&&/^[\\w\\d]/.test(o)||r<=s&&/[\\w\\d]$/.test(o))return;o=i.substring(t.start.column,t.end.column);if(!/^[\\w\\d]+$/.test(o))return;var u=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:o});return u},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit(\"changeMode\",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText();return this._signal(\"copy\",e),e},this.onCopy=function(){this.commands.exec(\"copy\",this)},this.onCut=function(){this.commands.exec(\"cut\",this)},this.onPaste=function(e){if(this.$readOnly)return;var t={text:e};this._signal(\"paste\",t),this.insert(t.text,!0)},this.execCommand=function(e,t){this.commands.exec(e,this,t)},this.insert=function(e,t){var n=this.session,r=n.getMode(),i=this.getCursorPosition();if(this.getBehavioursEnabled()&&!t){var s=r.transformAction(n.getState(i.row),\"insertion\",this,n,e);s&&(e!==s.text&&(this.session.mergeUndoDeltas=!1,this.$mergeNextCommand=!1),e=s.text)}e==\"\t\"&&(e=this.session.getTabString());if(!this.selection.isEmpty()){var o=this.getSelectionRange();i=this.session.remove(o),this.clearSelection()}else if(this.session.getOverwrite()){var o=new p.fromPoints(i,i);o.end.column+=e.length,this.session.remove(o)}if(e==\"\\n\"||e==\"\\r\\n\"){var u=n.getLine(i.row);if(i.column>u.search(/\\S|$/)){var a=u.substr(i.column).search(/\\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e),h=n.insert(i,e);s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(n.getDocument().isNewLine(e)){var d=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},d)}c&&r.autoOutdent(l,n,i.row)},this.onTextInput=function(e){this.keyBinding.onTextInput(e)},this.onCommandKey=function(e,t,n){this.keyBinding.onCommandKey(e,t,n)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption(\"scrollSpeed\",e)},this.getScrollSpeed=function(){return this.getOption(\"scrollSpeed\")},this.setDragDelay=function(e){this.setOption(\"dragDelay\",e)},this.getDragDelay=function(){return this.getOption(\"dragDelay\")},this.setSelectionStyle=function(e){this.setOption(\"selectionStyle\",e)},this.getSelectionStyle=function(){return this.getOption(\"selectionStyle\")},this.setHighlightActiveLine=function(e){this.setOption(\"highlightActiveLine\",e)},this.getHighlightActiveLine=function(){return this.getOption(\"highlightActiveLine\")},this.setHighlightGutterLine=function(e){this.setOption(\"highlightGutterLine\",e)},this.getHighlightGutterLine=function(){return this.getOption(\"highlightGutterLine\")},this.setHighlightSelectedWord=function(e){this.setOption(\"highlightSelectedWord\",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption(\"readOnly\",e)},this.getReadOnly=function(){return this.getOption(\"readOnly\")},this.setBehavioursEnabled=function(e){this.setOption(\"behavioursEnabled\",e)},this.getBehavioursEnabled=function(){return this.getOption(\"behavioursEnabled\")},this.setWrapBehavioursEnabled=function(e){this.setOption(\"wrapBehavioursEnabled\",e)},this.getWrapBehavioursEnabled=function(){return this.getOption(\"wrapBehavioursEnabled\")},this.setShowFoldWidgets=function(e){this.setOption(\"showFoldWidgets\",e)},this.getShowFoldWidgets=function(){return this.getOption(\"showFoldWidgets\")},this.setFadeFoldWidgets=function(e){this.setOption(\"fadeFoldWidgets\",e)},this.getFadeFoldWidgets=function(){return this.getOption(\"fadeFoldWidgets\")},this.remove=function(e){this.selection.isEmpty()&&(e==\"left\"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,\"deletion\",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]==\"\\n\"){var o=n.getLine(t.end.row);/^\\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert(\"\\n\"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;t<n.length?(r=n.charAt(t)+n.charAt(t-1),i=new p(e.row,t-1,e.row,t+1)):(r=n.charAt(t-1)+n.charAt(t-2),i=new p(e.row,t-2,e.row,t)),this.session.replace(i,r)},this.toLowerCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toLowerCase()),this.selection.setSelectionRange(e)},this.toUpperCase=function(){var e=this.getSelectionRange();this.selection.isEmpty()&&this.selection.selectWord();var t=this.getSelectionRange(),n=this.session.getTextRange(t);this.session.replace(t,n.toUpperCase()),this.selection.setSelectionRange(e)},this.indent=function(){var e=this.session,t=this.getSelectionRange();if(t.start.row<t.end.row){var n=this.$getSelectedRows();e.indentRows(n.first,n.last,\"\t\");return}if(t.start.column<t.end.column){var r=e.getTextRange(t);if(!/^\\s+$/.test(r)){var n=this.$getSelectedRows();e.indentRows(n.first,n.last,\"\t\");return}}var i=e.getLine(t.start.row),o=t.start,u=e.getTabSize(),a=e.documentToScreenColumn(o.row,o.column);if(this.session.getUseSoftTabs())var f=u-a%u,l=s.stringRepeat(\" \",f);else{var f=a%u;while(i[t.start.column]==\" \"&&f)t.start.column--,f--;this.selection.setSelectionRange(t),l=\"\t\"}return this.insert(l)},this.blockIndent=function(){var e=this.$getSelectedRows();this.session.indentRows(e.first,e.last,\"\t\")},this.blockOutdent=function(){var e=this.session.getSelection();this.session.outdentRows(e.getRange())},this.sortLines=function(){var e=this.$getSelectedRows(),t=this.session,n=[];for(i=e.first;i<=e.last;i++)n.push(t.getLine(i));n.sort(function(e,t){return e.toLowerCase()<t.toLowerCase()?-1:e.toLowerCase()>t.toLowerCase()?1:0});var r=new p(0,0,0,0);for(var i=e.first;i<=e.last;i++){var s=t.getLine(i);r.start.row=i,r.end.row=i,r.end.column=s.length,t.replace(r,n[i-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\\-]?[0-9]+(?:\\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex<t){var i=n.exec(r);if(i.index<=t&&i.index+i[0].length>=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(\".\")>=0?s.start+s.value.indexOf(\".\")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&n<o?e*=Math.pow(10,s.end-n-1):e*=Math.pow(10,s.end-n),a+=e,a/=Math.pow(10,u);var f=a.toFixed(u),l=new p(t,s.start,t,s.end);this.session.replace(l,f),this.moveCursorTo(t,Math.max(s.start+1,n+f.length-s.value.length))}}},this.removeLines=function(){var e=this.$getSelectedRows(),t;e.first===0||e.last+1<this.session.getLength()?t=new p(e.first,0,e.last+1,0):t=new p(e.first-1,this.session.getLine(e.first-1).length,e.last,this.session.getLine(e.last).length),this.session.remove(t),this.clearSelection()},this.duplicateSelection=function(){var e=this.selection,t=this.session,n=e.getRange(),r=e.isBackwards();if(n.isEmpty()){var i=n.start.row;t.duplicateLines(i,i)}else{var s=r?n.start:n.end,o=t.insert(s,t.getTextRange(n),!1);n.start=s,n.end=o,e.setSelectionRange(n,r)}},this.moveLinesDown=function(){this.$moveLines(function(e,t){return this.session.moveLinesDown(e,t)})},this.moveLinesUp=function(){this.$moveLines(function(e,t){return this.session.moveLinesUp(e,t)})},this.moveText=function(e,t,n){return this.session.moveText(e,t,n)},this.copyLinesUp=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t),0})},this.copyLinesDown=function(){this.$moveLines(function(e,t){return this.session.duplicateLines(e,t)})},this.$moveLines=function(e){var t=this.selection;if(!t.inMultiSelectMode||this.inVirtualSelectionMode){var n=t.toOrientedRange(),r=this.$getSelectedRows(n),i=e.call(this,r.first,r.last);n.moveBy(i,0),t.fromOrientedRange(n)}else{var s=t.rangeList.ranges;t.rangeList.detach(this.session);for(var o=s.length;o--;){var u=o,r=s[o].collapseRows(),a=r.end.row,f=r.start.row;while(o--){r=s[o].collapseRows();if(!(f-r.end.row<=1))break;f=r.end.row}o++;var i=e.call(this,f,a);while(u>=o)s[u].moveBy(i,0),u--}t.fromOrientedRange(t.ranges[0]),t.rangeList.attach(this.session)}},this.$getSelectedRows=function(){var e=this.getSelectionRange().collapseRows();return{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(this.getCursorPosition())},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);this.$blockScrolling++,t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection()),this.$blockScrolling--;var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,n,r){this.renderer.scrollToLine(e,t,n,r)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.$blockScrolling+=1,this.selection.selectAll(),this.$blockScrolling-=1},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e){var t=this.getCursorPosition(),n=this.session.getBracketRange(t);if(!n){n=this.find({needle:/[{}()\\[\\]]/g,preventScroll:!0,start:{row:t.row,column:t.column-1}});if(!n)return;var r=n.start;r.row==t.row&&Math.abs(r.column-t.column)<2&&(n=this.session.getBracketRange(r))}r=n&&n.cursor||r,r&&(e?n&&n.isEqual(this.getSelectionRange())?this.clearSelection():this.selection.selectTo(r.row,r.column):this.selection.moveTo(r.row,r.column))},this.gotoLine=function(e,t,n){this.selection.clearSelection(),this.session.unfold({row:e-1,column:t||0}),this.$blockScrolling+=1,this.exitMultiSelectMode&&this.exitMultiSelectMode(),this.moveCursorTo(e-1,t||0),this.$blockScrolling-=1,this.isRowFullyVisible(e-1)||this.scrollToLine(e-1,!0,n)},this.navigateTo=function(e,t){this.selection.moveTo(e,t)},this.navigateUp=function(e){if(this.selection.isMultiLine()&&!this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(-e||-1,0)},this.navigateDown=function(e){if(this.selection.isMultiLine()&&this.selection.isBackwards()){var t=this.selection.anchor.getPosition();return this.moveCursorToPosition(t)}this.selection.clearSelection(),this.selection.moveCursorBy(e||1,0)},this.navigateLeft=function(e){if(!this.selection.isEmpty()){var t=this.getSelectionRange().start;this.moveCursorToPosition(t)}else{e=e||1;while(e--)this.selection.moveCursorLeft()}this.clearSelection()},this.navigateRight=function(e){if(!this.selection.isEmpty()){var t=this.getSelectionRange().end;this.moveCursorToPosition(t)}else{e=e||1;while(e--)this.selection.moveCursorRight()}this.clearSelection()},this.navigateLineStart=function(){this.selection.moveCursorLineStart(),this.clearSelection()},this.navigateLineEnd=function(){this.selection.moveCursorLineEnd(),this.clearSelection()},this.navigateFileEnd=function(){this.selection.moveCursorFileEnd(),this.clearSelection()},this.navigateFileStart=function(){this.selection.moveCursorFileStart(),this.clearSelection()},this.navigateWordRight=function(){this.selection.moveCursorWordRight(),this.clearSelection()},this.navigateWordLeft=function(){this.selection.moveCursorWordLeft(),this.clearSelection()},this.replace=function(e,t){t&&this.$search.set(t);var n=this.$search.find(this.session),r=0;return n?(this.$tryReplace(n,e)&&(r=1),n!==null&&(this.selection.setSelectionRange(n),this.renderer.scrollSelectionIntoView(n.start,n.end)),r):r},this.replaceAll=function(e,t){t&&this.$search.set(t);var n=this.$search.findAll(this.session),r=0;if(!n.length)return r;this.$blockScrolling+=1;var i=this.getSelectionRange();this.selection.moveTo(0,0);for(var s=n.length-1;s>=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),this.$blockScrolling-=1,r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e==\"string\"||e instanceof RegExp?t.needle=e:typeof e==\"object\"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.$blockScrolling+=1,this.session.unfold(e),this.selection.setSelectionRange(e),this.$blockScrolling-=1;var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},this.undo=function(){this.$blockScrolling++,this.session.getUndoManager().undo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.$blockScrolling++,this.session.getUndoManager().redo(),this.$blockScrolling--,this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.renderer.destroy(),this._signal(\"destroy\",this)},this.setAutoScrollEditorIntoView=function(e){if(!e)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement(\"div\"));var i=this.$scrollAnchor;i.style.cssText=\"position:absolute\",this.container.insertBefore(i,this.container.firstChild);var s=this.on(\"changeSelection\",function(){r=!0}),o=this.renderer.on(\"beforeRender\",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on(\"afterRender\",function(){if(r&&t&&n.isFocused()){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.top<o.height&&s.top+t.top+o.lineHeight>window.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+\"px\",i.style.left=s.left+\"px\",i.style.height=o.lineHeight+\"px\",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.removeEventListener(\"changeSelection\",s),this.renderer.removeEventListener(\"afterRender\",u),this.renderer.removeEventListener(\"beforeRender\",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||\"ace\",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!=\"wide\",i.setCssClass(t.element,\"ace_slim-cursors\",/slim/.test(e))}}).call(b.prototype),g.defineOptions(b.prototype,\"editor\",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal(\"changeSelectionStyle\",{data:e})},initialValue:\"line\"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.$resetCursorStyle()},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:[\"ace\",\"slim\",\"smooth\",\"wide\"],initialValue:\"ace\"},mergeUndoDeltas:{values:[!1,!0,\"always\"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},hScrollBarAlwaysVisible:\"renderer\",vScrollBarAlwaysVisible:\"renderer\",highlightGutterLine:\"renderer\",animatedScroll:\"renderer\",showInvisibles:\"renderer\",showPrintMargin:\"renderer\",printMarginColumn:\"renderer\",printMargin:\"renderer\",fadeFoldWidgets:\"renderer\",showFoldWidgets:\"renderer\",showLineNumbers:\"renderer\",showGutter:\"renderer\",displayIndentGuides:\"renderer\",fontSize:\"renderer\",fontFamily:\"renderer\",maxLines:\"renderer\",minLines:\"renderer\",scrollPastEnd:\"renderer\",fixedWidthGutter:\"renderer\",theme:\"renderer\",scrollSpeed:\"$mouseHandler\",dragDelay:\"$mouseHandler\",dragEnabled:\"$mouseHandler\",focusTimout:\"$mouseHandler\",tooltipFollowsMouse:\"$mouseHandler\",firstLineNumber:\"session\",overwrite:\"session\",newLineMode:\"session\",useWorker:\"session\",useSoftTabs:\"session\",tabSize:\"session\",wrap:\"session\",foldStyle:\"session\",mode:\"session\"}),t.Editor=b}),define(\"ace/placeholder\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/event_emitter\",\"ace/lib/oop\"],function(e,t,n){var r=e(\"./range\").Range,i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./lib/oop\"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on(\"change\",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on(\"changeCursor\",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session,i=this.$pos;this.pos=t.createAnchor(i.row,i.column),this.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.pos.on(\"change\",function(t){n.removeMarker(e.markerId),e.markerId=n.addMarker(new r(t.value.row,t.value.column,t.value.row,t.value.column+e.length),e.mainClass,null,!1)}),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1),n.on(\"change\",function(i){e.removeMarker(n.markerId),n.markerId=e.addMarker(new r(i.value.row,i.value.column,i.value.row,i.value.column+t.length),t.othersClass,null,!1)})})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e<this.others.length;e++)this.session.removeMarker(this.others[e].markerId)},this.onUpdate=function(e){var t=e.data,n=t.range;if(n.start.row!==n.end.row)return;if(n.start.row!==this.pos.row)return;if(this.$updating)return;this.$updating=!0;var i=t.action===\"insertText\"?n.end.column-n.start.column:n.start.column-n.end.column;if(n.start.column>=this.pos.column&&n.start.column<=this.pos.column+this.length+1){var s=n.start.column-this.pos.column;this.length+=i;if(!this.session.$fromUndo){if(t.action===\"insertText\")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};u.row===n.start.row&&n.start.column<u.column&&(a.column+=i),this.doc.insert(a,t.text)}else if(t.action===\"removeText\")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};u.row===n.start.row&&n.start.column<u.column&&(a.column+=i),this.doc.remove(new r(a.row,a.column,a.row,a.column-i))}n.start.column===this.pos.column&&t.action===\"insertText\"?setTimeout(function(){this.pos.setPosition(this.pos.row,this.pos.column-i);for(var e=0;e<this.others.length;e++){var t=this.others[e],r={row:t.row,column:t.column-i};t.row===n.start.row&&n.start.column<t.column&&(r.column+=i),t.setPosition(r.row,r.column)}}.bind(this),0):n.start.column===this.pos.column&&t.action===\"removeText\"&&setTimeout(function(){for(var e=0;e<this.others.length;e++){var t=this.others[e];t.row===n.start.row&&n.start.column<t.column&&t.setPosition(t.row,t.column-i)}}.bind(this),0)}this.pos._emit(\"change\",{value:this.pos});for(var o=0;o<this.others.length;o++)this.others[o]._emit(\"change\",{value:this.others[o]})}this.$updating=!1},this.onCursorChange=function(e){if(this.$updating)return;var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit(\"cursorEnter\",e)):(this.hideOtherMarkers(),this._emit(\"cursorLeave\",e))},this.detach=function(){this.session.removeMarker(this.markerId),this.hideOtherMarkers(),this.doc.removeEventListener(\"change\",this.$onUpdate),this.session.selection.removeEventListener(\"changeCursor\",this.$onCursorChange),this.pos.detach();for(var e=0;e<this.others.length;e++)this.others[e].detach();this.session.setUndoSelect(!0)},this.cancel=function(){if(this.$undoStackDepth===-1)throw Error(\"Canceling placeholders only supported with undo manager attached to session.\");var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth;for(var n=0;n<t;n++)e.undo(!0)}}).call(o.prototype),t.PlaceHolder=o}),define(\"ace/lib/useragent\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.OS={LINUX:\"LINUX\",MAC:\"MAC\",WINDOWS:\"WINDOWS\"},t.getOS=function(){return t.isMac?t.OS.MAC:t.isLinux?t.OS.LINUX:t.OS.WINDOWS};if(typeof navigator!=\"object\")return;var r=(navigator.platform.match(/mac|win|linux/i)||[\"other\"])[0].toLowerCase(),i=navigator.userAgent;t.isWin=r==\"win\",t.isMac=r==\"mac\",t.isLinux=r==\"linux\",t.isIE=navigator.appName==\"Microsoft Internet Explorer\"||navigator.appName.indexOf(\"MSAppHost\")>=0?parseFloat((i.match(/(?:MSIE |Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1]):parseFloat((i.match(/(?:Trident\\/[0-9]+[\\.0-9]+;.*rv:)([0-9]+[\\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=window.controllers&&window.navigator.product===\"Gecko\",t.isOldGecko=t.isGecko&&parseInt((i.match(/rv\\:(\\d+)/)||[])[1],10)<4,t.isOpera=window.opera&&Object.prototype.toString.call(window.opera)==\"[object Opera]\",t.isWebKit=parseFloat(i.split(\"WebKit/\")[1])||undefined,t.isChrome=parseFloat(i.split(\" Chrome/\")[1])||undefined,t.isAIR=i.indexOf(\"AdobeAIR\")>=0,t.isIPad=i.indexOf(\"iPad\")>=0,t.isTouchPad=i.indexOf(\"TouchPad\")>=0,t.isChromeOS=i.indexOf(\" CrOS \")>=0}),define(\"ace/multi_select\",[\"require\",\"exports\",\"module\",\"ace/range_list\",\"ace/range\",\"ace/selection\",\"ace/mouse/multi_select_handler\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/commands/multi_select_commands\",\"ace/search\",\"ace/edit_session\",\"ace/editor\",\"ace/config\"],function(e,t,n){function h(e,t,n){return c.$options.wrap=!0,c.$options.needle=t,c.$options.backwards=n==-1,c.find(e)}function v(e,t){return e.row==t.row&&e.column==t.column}function m(e){if(e.$multiselectOnSessionChange)return;e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$multiselectOnSessionChange(e),e.on(\"changeSession\",e.$multiselectOnSessionChange),e.on(\"mousedown\",o),e.commands.addCommands(f.defaultCommands),g(e)}function g(e){function r(t){n&&(e.renderer.setMouseCursor(\"\"),n=!1)}var t=e.textInput.getElement(),n=!1;u.addListener(t,\"keydown\",function(t){t.keyCode==18&&!(t.ctrlKey||t.shiftKey||t.metaKey)?n||(e.renderer.setMouseCursor(\"crosshair\"),n=!0):n&&r()}),u.addListener(t,\"keyup\",r),u.addListener(t,\"blur\",r)}var r=e(\"./range_list\").RangeList,i=e(\"./range\").Range,s=e(\"./selection\").Selection,o=e(\"./mouse/multi_select_handler\").onMouseDown,u=e(\"./lib/event\"),a=e(\"./lib/lang\"),f=e(\"./commands/multi_select_commands\");t.commands=f.defaultCommands.concat(f.multiSelectCommands);var l=e(\"./search\").Search,c=new l,p=e(\"./edit_session\").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(p.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(!e)return;if(!this.inMultiSelectMode&&this.rangeCount==0){var n=this.toOrientedRange();this.rangeList.add(n),this.rangeList.add(e);if(this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(n),this.$onAddRange(n)}e.cursor||(e.cursor=e.end);var r=this.rangeList.add(e);return this.$onAddRange(e),r.length&&this.$onRemoveRange(r),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal(\"multiSelect\"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length?this.$onRemoveRange(e):this.ranges[0]&&this.fromOrientedRange(this.ranges[0])},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal(\"addRange\",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal(\"removeRange\",{ranges:e}),this.rangeCount==0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal(\"singleSelect\"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var n=this.getRange(),r=this.isBackwards(),s=n.start.row,o=n.end.row;if(s==o){if(r)var u=n.end,a=n.start;else var u=n.start,a=n.end;this.addRange(i.fromPoints(a,a)),this.addRange(i.fromPoints(u,u));return}var f=[],l=this.getLineRange(s,!0);l.start.column=n.start.column,f.push(l);for(var c=s+1;c<o;c++)f.push(this.getLineRange(c,!0));l=this.getLineRange(o,!0),l.end.column=n.end.column,f.push(l),f.forEach(this.addRange,this)}},this.toggleBlockSelection=function(){if(this.rangeCount>1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.selectionLead),s=this.session.documentToScreenPosition(this.selectionAnchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column<t.column;if(s)var o=e.column,u=t.column;else var o=t.column,u=e.column;var a=e.row<t.row;if(a)var f=e.row,l=t.row;else var f=t.row,l=e.row;o<0&&(o=0),f<0&&(f=0),f==l&&(n=!0);for(var c=f;c<=l;c++){var h=i.fromPoints(this.session.screenToDocumentPosition(c,o),this.session.screenToDocumentPosition(c,u));if(h.isEmpty()){if(p&&v(h.end,p))break;var p=h.end}h.cursor=s?h.start:h.end,r.push(h)}a&&r.reverse();if(!n){var d=r.length-1;while(r[d].isEmpty()&&d>0)d--;if(d>0){var m=0;while(r[m].isEmpty())m++}for(var g=d;g>=m;g--)r[g].isEmpty()&&r.splice(g,1)}return r}}.call(s.prototype);var d=e(\"./editor\").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,\"ace_selection\",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(!e.marker)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,1)}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle(\"ace_multiselect\"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler(\"exec\",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle(\"ace_multiselect\"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler(\"exec\",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit(\"changeSelection\")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction==\"forEach\"?r=n.forEachSelection(t,e.args):t.multiSelectAction==\"forEachLine\"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction==\"single\"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges();var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e=\"\";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r<t.length;r++)n.push(this.session.getTextRange(t[r]));var i=this.session.getDocument().getNewLineCharacter();e=n.join(i),e.length==(n.length-1)*i.length&&(e=\"\")}else this.selection.isEmpty()||(e=this.session.getTextRange(this.getSelectionRange()));return e},this.onPaste=function(e){if(this.$readOnly)return;var t={text:e};this._signal(\"paste\",t),e=t.text;if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return this.insert(e);var n=e.split(/\\r\\n|\\r|\\n/),r=this.selection.rangeList.ranges;if(n.length>r.length||n.length<2||!n[1])return this.commands.exec(\"insertstring\",this,e);for(var i=r.length;i--;){var s=r[i];s.isEmpty()||this.session.remove(s),this.session.insert(s.start,n[i])}},this.findAll=function(e,t,n){t=t||{},t.needle=e||t.needle;if(t.needle==undefined){var r=this.selection.isEmpty()?this.selection.getWordRange():this.selection.getRange();t.needle=this.session.getTextRange(r)}this.$search.set(t);var i=this.$search.findAll(this.session);if(!i.length)return 0;this.$blockScrolling+=1;var s=this.multiSelect;n||s.toSingleRange(i[0]);for(var o=i.length;o--;)s.addRange(i[o],!0);return r&&s.rangeList.rangeAtPoint(r.start)&&s.addRange(r,!0),this.$blockScrolling-=1,i.length},this.selectMoreLines=function(e,t){var n=this.selection.toOrientedRange(),r=n.cursor==n.end,s=this.session.documentToScreenPosition(n.cursor);this.selection.$desiredColumn&&(s.column=this.selection.$desiredColumn);var o=this.session.screenToDocumentPosition(s.row+e,s.column);if(!n.isEmpty())var u=this.session.documentToScreenPosition(r?n.end:n.start),a=this.session.screenToDocumentPosition(u.row+e,u.column);else var a=o;if(r){var f=i.fromPoints(o,a);f.cursor=f.start}else{var f=i.fromPoints(a,o);f.cursor=f.end}f.desiredColumn=s.column;if(!this.selection.inMultiSelectMode)this.selection.addRange(n);else if(t)var l=n.cursor;this.selection.addRange(f),l&&this.selection.substractPoint(l)},this.transposeSelections=function(e){var t=this.session,n=t.multiSelect,r=n.ranges;for(var i=r.length;i--;){var s=r[i];if(s.isEmpty()){var o=t.getWordRange(s.start.row,s.start.column);s.start.row=o.start.row,s.start.column=o.start.column,s.end.row=o.end.row,s.end.column=o.end.column}}n.mergeOverlappingRanges();var u=[];for(var i=r.length;i--;){var s=r[i];u.unshift(t.getTextRange(s))}e<0?u.unshift(u.pop()):u.push(u.shift());for(var i=r.length;i--;){var s=r[i],o=s.clone();t.replace(s,u[i]),s.start.row=o.start.row,s.start.column=o.start.column}},this.selectMore=function(e,t){var n=this.session,r=n.multiSelect,i=r.toOrientedRange();i.isEmpty()&&(i=n.getWordRange(i.start.row,i.start.column),i.cursor=e==-1?i.start:i.end,this.multiSelect.addRange(i));var s=n.getTextRange(i),o=h(n,s,e);o&&(o.cursor=e==-1?o.start:o.end,this.$blockScrolling+=1,this.session.unfold(o),this.multiSelect.addRange(o),this.$blockScrolling-=1,this.renderer.scrollCursorIntoView(null,.5)),t&&this.multiSelect.substractPoint(i.cursor)},this.alignCursors=function(){var e=this.session,t=e.multiSelect,n=t.ranges;if(!n.length){var r=this.selection.getRange(),s=r.start.row,o=r.end.row,u=s==o;if(u){var f=this.session.getLength(),l;do l=this.session.getLine(o);while(/[=:]/.test(l)&&++o<f);do l=this.session.getLine(s);while(/[=:]/.test(l)&&--s>0);s<0&&(s=0),o>=f&&(o=f-1)}var c=this.session.doc.removeLines(s,o);c=this.$reAlignText(c,u),this.session.doc.insert({row:s,column:0},c.join(\"\\n\")+\"\\n\"),u||(r.start.column=0,r.end.column=c[c.length-1].length),this.selection.setRange(r)}else{var h=-1,p=n.filter(function(e){if(e.cursor.row==h)return!0;h=e.cursor.row});t.$onRemoveRange(p);var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),i<v&&(v=i),i});n.forEach(function(t,n){var r=t.cursor,s=d-r.column,o=m[n]-v;s>o?e.insert(r,a.stringRepeat(\" \",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(\" \",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\\s+/,\"$1 \"):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o,\" \")+e[4].replace(/^([=:])\\s+/,\"$1 \"):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\\s+/,\"$1 \"):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\\s*)(.*?)(\\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),s<t[2].length&&(s=t[2].length),o>t[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.prototype),t.onSessionChange=function(e){var t=e.session;t.multiSelect||(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.removeEventListener(\"addRange\",this.$onAddRange),n.multiSelect.removeEventListener(\"removeRange\",this.$onRemoveRange),n.multiSelect.removeEventListener(\"multiSelect\",this.$onMultiSelect),n.multiSelect.removeEventListener(\"singleSelect\",this.$onSingleSelect)),t.multiSelect.on(\"addRange\",this.$onAddRange),t.multiSelect.on(\"removeRange\",this.$onRemoveRange),t.multiSelect.on(\"multiSelect\",this.$onMultiSelect),t.multiSelect.on(\"singleSelect\",this.$onSingleSelect),this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=m,e(\"./config\").defineOptions(d.prototype,\"editor\",{enableMultiselect:{set:function(e){m(this),e?(this.on(\"changeSession\",this.$multiselectOnSessionChange),this.on(\"mousedown\",o)):(this.off(\"changeSession\",this.$multiselectOnSessionChange),this.off(\"mousedown\",o))},value:!0}})}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/mouse/multi_select_handler\",[\"require\",\"exports\",\"module\",\"ace/lib/event\"],function(e,t,n){function i(e,t){return e.row==t.row&&e.column==t.column}function s(e){var t=e.domEvent,n=t.altKey,s=t.shiftKey,o=e.getAccelKey(),u=e.getButton();if(e.editor.inMultiSelectMode&&u==2){e.editor.textInput.onContextMenu(e.domEvent);return}if(!o&&!n){u===0&&e.editor.inMultiSelectMode&&e.editor.exitMultiSelectMode();return}var a=e.editor,f=a.selection,l=a.inMultiSelectMode,c=e.getDocumentPosition(),h=f.getCursor(),p=e.inSelection()||f.isEmpty()&&i(c,h),d=e.x,v=e.y,m=function(e){d=e.clientX,v=e.clientY},g=function(){var e=a.renderer.pixelToScreenCoordinates(d,v),t=y.screenToDocumentPosition(e.row,e.column);if(i(w,e)&&i(t,f.selectionLead))return;w=e,a.selection.moveToPosition(t),a.renderer.scrollCursorIntoView(),a.removeSelectionMarkers(x),x=f.rectangularRangeBlock(w,b),x.forEach(a.addSelectionMarker,a),a.updateSelectionMarkers()},y=a.session,b=a.renderer.pixelToScreenCoordinates(d,v),w=b;if(o&&!n&&!s&&u===0){if(!l&&p)return;if(!l){var E=f.toOrientedRange();a.addSelectionMarker(E)}var S=f.rangeList.rangeAtPoint(c);a.$blockScrolling++,a.once(\"mouseup\",function(){var e=f.toOrientedRange();S&&e.isEmpty()&&i(S.cursor,e.cursor)?f.substractPoint(e.cursor):(E&&(a.removeSelectionMarker(E),f.addRange(E)),f.addRange(e)),a.$blockScrolling--})}else if(n&&u===0){e.stop(),l&&!o?f.toSingleRange():!l&&o&&f.addRange();var x=[];s?(b=y.documentToScreenPosition(f.lead),g()):f.moveToPosition(c);var T=function(e){clearInterval(C),a.removeSelectionMarkers(x);for(var t=0;t<x.length;t++)f.addRange(x[t])},N=g;r.capture(a.container,m,T);var C=setInterval(function(){N()},20);return e.preventDefault()}}var r=e(\"../lib/event\");t.onMouseDown=s}),define(\"ace/lib/keys\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\"],function(e,t,n){var r=e(\"./oop\"),i=function(){var e={MODIFIER_KEYS:{16:\"Shift\",17:\"Ctrl\",18:\"Alt\",224:\"Meta\"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,\"super\":8,meta:8,command:8,cmd:8},FUNCTION_KEYS:{8:\"Backspace\",9:\"Tab\",13:\"Return\",19:\"Pause\",27:\"Esc\",32:\"Space\",33:\"PageUp\",34:\"PageDown\",35:\"End\",36:\"Home\",37:\"Left\",38:\"Up\",39:\"Right\",40:\"Down\",44:\"Print\",45:\"Insert\",46:\"Delete\",96:\"Numpad0\",97:\"Numpad1\",98:\"Numpad2\",99:\"Numpad3\",100:\"Numpad4\",101:\"Numpad5\",102:\"Numpad6\",103:\"Numpad7\",104:\"Numpad8\",105:\"Numpad9\",\"-13\":\"NumpadEnter\",112:\"F1\",113:\"F2\",114:\"F3\",115:\"F4\",116:\"F5\",117:\"F6\",118:\"F7\",119:\"F8\",120:\"F9\",121:\"F10\",122:\"F11\",123:\"F12\",144:\"Numlock\",145:\"Scrolllock\"},PRINTABLE_KEYS:{32:\" \",48:\"0\",49:\"1\",50:\"2\",51:\"3\",52:\"4\",53:\"5\",54:\"6\",55:\"7\",56:\"8\",57:\"9\",59:\";\",61:\"=\",65:\"a\",66:\"b\",67:\"c\",68:\"d\",69:\"e\",70:\"f\",71:\"g\",72:\"h\",73:\"i\",74:\"j\",75:\"k\",76:\"l\",77:\"m\",78:\"n\",79:\"o\",80:\"p\",81:\"q\",82:\"r\",83:\"s\",84:\"t\",85:\"u\",86:\"v\",87:\"w\",88:\"x\",89:\"y\",90:\"z\",107:\"+\",109:\"-\",110:\".\",187:\"=\",188:\",\",189:\"-\",190:\".\",191:\"/\",192:\"`\",219:\"[\",220:\"\\\\\",221:\"]\",222:\"'\"}},t,n;for(n in e.FUNCTION_KEYS)t=e.FUNCTION_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);for(n in e.PRINTABLE_KEYS)t=e.PRINTABLE_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);return r.mixin(e,e.MODIFIER_KEYS),r.mixin(e,e.PRINTABLE_KEYS),r.mixin(e,e.FUNCTION_KEYS),e.enter=e[\"return\"],e.escape=e.esc,e.del=e[\"delete\"],e[173]=\"-\",function(){var t=[\"cmd\",\"ctrl\",\"alt\",\"shift\"];for(var n=Math.pow(2,t.length);n--;)e.KEY_MODS[n]=t.filter(function(t){return n&e.KEY_MODS[t]}).join(\"-\")+\"-\"}(),e}();r.mixin(t,i),t.keyCodeToString=function(e){var t=i[e];return typeof t!=\"string\"&&(t=String.fromCharCode(e)),t.toLowerCase()}}),define(\"ace/commands/multi_select_commands\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\"],function(e,t,n){t.defaultCommands=[{name:\"addCursorAbove\",exec:function(e){e.selectMoreLines(-1)},bindKey:{win:\"Ctrl-Alt-Up\",mac:\"Ctrl-Alt-Up\"},readonly:!0},{name:\"addCursorBelow\",exec:function(e){e.selectMoreLines(1)},bindKey:{win:\"Ctrl-Alt-Down\",mac:\"Ctrl-Alt-Down\"},readonly:!0},{name:\"addCursorAboveSkipCurrent\",exec:function(e){e.selectMoreLines(-1,!0)},bindKey:{win:\"Ctrl-Alt-Shift-Up\",mac:\"Ctrl-Alt-Shift-Up\"},readonly:!0},{name:\"addCursorBelowSkipCurrent\",exec:function(e){e.selectMoreLines(1,!0)},bindKey:{win:\"Ctrl-Alt-Shift-Down\",mac:\"Ctrl-Alt-Shift-Down\"},readonly:!0},{name:\"selectMoreBefore\",exec:function(e){e.selectMore(-1)},bindKey:{win:\"Ctrl-Alt-Left\",mac:\"Ctrl-Alt-Left\"},readonly:!0},{name:\"selectMoreAfter\",exec:function(e){e.selectMore(1)},bindKey:{win:\"Ctrl-Alt-Right\",mac:\"Ctrl-Alt-Right\"},readonly:!0},{name:\"selectNextBefore\",exec:function(e){e.selectMore(-1,!0)},bindKey:{win:\"Ctrl-Alt-Shift-Left\",mac:\"Ctrl-Alt-Shift-Left\"},readonly:!0},{name:\"selectNextAfter\",exec:function(e){e.selectMore(1,!0)},bindKey:{win:\"Ctrl-Alt-Shift-Right\",mac:\"Ctrl-Alt-Shift-Right\"},readonly:!0},{name:\"splitIntoLines\",exec:function(e){e.multiSelect.splitIntoLines()},bindKey:{win:\"Ctrl-Alt-L\",mac:\"Ctrl-Alt-L\"},readonly:!0},{name:\"alignCursors\",exec:function(e){e.alignCursors()},bindKey:{win:\"Ctrl-Alt-A\",mac:\"Ctrl-Alt-A\"}},{name:\"findAll\",exec:function(e){e.findAll()},bindKey:{win:\"Ctrl-Alt-K\",mac:\"Ctrl-Alt-G\"},readonly:!0}],t.multiSelectCommands=[{name:\"singleSelection\",bindKey:\"esc\",exec:function(e){e.exitMultiSelectMode()},readonly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var r=e(\"../keyboard/hash_handler\").HashHandler;t.keyboardHandler=new r(t.multiSelectCommands)}),define(\"ace/lib/event\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\",\"ace/lib/useragent\"],function(e,t,n){function o(e,t,n){var o=s(t);if(!i.isMac&&u){if(u[91]||u[92])o|=8;if(u.altGr){if((3&o)==3)return;u.altGr=0}if(n===18||n===17){var f=t.location||t.keyLocation;if(n===17&&f===1)a=t.timeStamp;else if(n===18&&o===3&&f===2){var l=-a;a=t.timeStamp,l+=a,l<3&&(u.altGr=!0)}}}if(n in r.MODIFIER_KEYS){switch(r.MODIFIER_KEYS[n]){case\"Alt\":o=2;break;case\"Shift\":o=4;break;case\"Ctrl\":o=1;break;default:o=8}n=-1}o&8&&(n===91||n===93)&&(n=-1);if(!o&&n===13)if(t.location||t.keyLocation===3){e(t,o,-n);if(t.defaultPrevented)return}if(i.isChromeOS&&o&8){e(t,o,n);if(t.defaultPrevented)return;o&=-9}return!!o||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,o,n):!1}var r=e(\"./keys\"),i=e(\"./useragent\");t.addListener=function(e,t,n){if(e.addEventListener)return e.addEventListener(t,n,!1);if(e.attachEvent){var r=function(){n.call(e,window.event)};n._wrapper=r,e.attachEvent(\"on\"+t,r)}},t.removeListener=function(e,t,n){if(e.removeEventListener)return e.removeEventListener(t,n,!1);e.detachEvent&&e.detachEvent(\"on\"+t,n._wrapper||n)},t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0},t.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},t.getButton=function(e){return e.type==\"dblclick\"?0:e.type==\"contextmenu\"||e.ctrlKey&&i.isMac?2:e.preventDefault?e.button:{1:0,2:2,4:1}[e.button]},t.capture=function(e,n,r){function i(e){n&&n(e),r&&r(e),t.removeListener(document,\"mousemove\",n,!0),t.removeListener(document,\"mouseup\",i,!0),t.removeListener(document,\"dragstart\",i,!0)}return t.addListener(document,\"mousemove\",n,!0),t.addListener(document,\"mouseup\",i,!0),t.addListener(document,\"dragstart\",i,!0),i},t.addMouseWheelListener=function(e,n){\"onmousewheel\"in e?t.addListener(e,\"mousewheel\",function(e){var t=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/t,e.wheelY=-e.wheelDeltaY/t):(e.wheelX=0,e.wheelY=-e.wheelDelta/t),n(e)}):\"onwheel\"in e?t.addListener(e,\"wheel\",function(e){var t=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*t||0,e.wheelY=e.deltaY*t||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}n(e)}):t.addListener(e,\"DOMMouseScroll\",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),n(e)})},t.addMultiMouseDownListener=function(e,n,r,s){var o=0,u,a,f,l={2:\"dblclick\",3:\"tripleclick\",4:\"quadclick\"};t.addListener(e,\"mousedown\",function(e){t.getButton(e)!==0?o=0:e.detail>1?(o++,o>4&&(o=1)):o=1;if(i.isIE){var c=Math.abs(e.clientX-u)>5||Math.abs(e.clientY-a)>5;if(!f||c)o=1;f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),o==1&&(u=e.clientX,a=e.clientY)}r[s](\"mousedown\",e);if(o>4)o=0;else if(o>1)return r[s](l[o],e)}),i.isOldIE&&t.addListener(e,\"dblclick\",function(e){o=2,f&&clearTimeout(f),f=setTimeout(function(){f=null},n[o-1]||600),r[s](\"mousedown\",e),r[s](l[o],e)})};var s=!i.isMac||!i.isOpera||\"KeyboardEvent\"in window?function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)}:function(e){return 0|(e.metaKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.ctrlKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[s(e)]};var u=null,a=0;t.addCommandKeyListener=function(e,n){var r=t.addListener;if(i.isOldGecko||i.isOpera&&!(\"KeyboardEvent\"in window)){var s=null;r(e,\"keydown\",function(e){s=e.keyCode}),r(e,\"keypress\",function(e){return o(n,e,s)})}else{var a=null;r(e,\"keydown\",function(e){u[e.keyCode]=!0;var t=o(n,e,e.keyCode);return a=e.defaultPrevented,t}),r(e,\"keypress\",function(e){a&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),a=null)}),r(e,\"keyup\",function(e){u[e.keyCode]=null}),u||(u=Object.create(null),r(window,\"focus\",function(e){u=Object.create(null)}))}};if(window.postMessage&&!i.isOldIE){var f=1;t.nextTick=function(e,n){n=n||window;var r=\"zero-timeout-message-\"+f;t.addListener(n,\"message\",function i(s){s.data==r&&(t.stopPropagation(s),t.removeListener(n,\"message\",i),e())}),n.postMessage(r,\"*\")}}t.nextFrame=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame,t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),define(\"ace/mode/folding/fold_mode\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../../range\").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?\"start\":t==\"markbeginend\"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?\"end\":\"\"},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++t<a){var c=e.getLine(t).search(i);if(c==-1)continue;if(c<=o)break;l=t}if(l>f){var h=e.getLine(l).length;return new r(f,u,l,h)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a==\"start\"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),define(\"ace/lib/dom\",[\"require\",\"exports\",\"module\"],function(e,t,n){if(typeof document==\"undefined\")return;var r=\"http://www.w3.org/1999/xhtml\";t.getDocumentHead=function(e){return e||(e=document),e.head||e.getElementsByTagName(\"head\")[0]||e.documentElement},t.createElement=function(e,t){return document.createElementNS?document.createElementNS(t||r,e):document.createElement(e)},t.hasCssClass=function(e,t){var n=e.className.split(/\\s+/g);return n.indexOf(t)!==-1},t.addCssClass=function(e,n){t.hasCssClass(e,n)||(e.className+=\" \"+n)},t.removeCssClass=function(e,t){var n=e.className.split(/\\s+/g);for(;;){var r=n.indexOf(t);if(r==-1)break;n.splice(r,1)}e.className=n.join(\" \")},t.toggleCssClass=function(e,t){var n=e.className.split(/\\s+/g),r=!0;for(;;){var i=n.indexOf(t);if(i==-1)break;r=!1,n.splice(i,1)}return r&&n.push(t),e.className=n.join(\" \"),r},t.setCssClass=function(e,n,r){r?t.addCssClass(e,n):t.removeCssClass(e,n)},t.hasCssString=function(e,t){var n=0,r;t=t||document;if(t.createStyleSheet&&(r=t.styleSheets)){while(n<r.length)if(r[n++].owningElement.id===e)return!0}else if(r=t.getElementsByTagName(\"style\"))while(n<r.length)if(r[n++].id===e)return!0;return!1},t.importCssString=function(n,i,s){s=s||document;if(i&&t.hasCssString(i,s))return null;var o;s.createStyleSheet?(o=s.createStyleSheet(),o.cssText=n,i&&(o.owningElement.id=i)):(o=s.createElementNS?s.createElementNS(r,\"style\"):s.createElement(\"style\"),o.appendChild(s.createTextNode(n)),i&&(o.id=i),t.getDocumentHead(s).appendChild(o))},t.importCssStylsheet=function(e,n){if(n.createStyleSheet)n.createStyleSheet(e);else{var r=t.createElement(\"link\");r.rel=\"stylesheet\",r.href=e,t.getDocumentHead(n).appendChild(r)}},t.getInnerWidth=function(e){return parseInt(t.computedStyle(e,\"paddingLeft\"),10)+parseInt(t.computedStyle(e,\"paddingRight\"),10)+e.clientWidth},t.getInnerHeight=function(e){return parseInt(t.computedStyle(e,\"paddingTop\"),10)+parseInt(t.computedStyle(e,\"paddingBottom\"),10)+e.clientHeight},window.pageYOffset!==undefined?(t.getPageScrollTop=function(){return window.pageYOffset},t.getPageScrollLeft=function(){return window.pageXOffset}):(t.getPageScrollTop=function(){return document.body.scrollTop},t.getPageScrollLeft=function(){return document.body.scrollLeft}),window.getComputedStyle?t.computedStyle=function(e,t){return t?(window.getComputedStyle(e,\"\")||{})[t]||\"\":window.getComputedStyle(e,\"\")||{}}:t.computedStyle=function(e,t){return t?e.currentStyle[t]:e.currentStyle},t.scrollbarWidth=function(e){var n=t.createElement(\"ace_inner\");n.style.width=\"100%\",n.style.minWidth=\"0px\",n.style.height=\"200px\",n.style.display=\"block\";var r=t.createElement(\"ace_outer\"),i=r.style;i.position=\"absolute\",i.left=\"-10000px\",i.overflow=\"hidden\",i.width=\"200px\",i.minWidth=\"0px\",i.height=\"150px\",i.display=\"block\",r.appendChild(n);var s=e.documentElement;s.appendChild(r);var o=n.offsetWidth;i.overflow=\"scroll\";var u=n.offsetWidth;return o==u&&(u=r.clientWidth),s.removeChild(r),o-u},t.setInnerHtml=function(e,t){var n=e.cloneNode(!1);return n.innerHTML=t,e.parentNode.replaceChild(n,e),n},\"textContent\"in document.documentElement?(t.setInnerText=function(e,t){e.textContent=t},t.getInnerText=function(e){return e.textContent}):(t.setInnerText=function(e,t){e.innerText=t},t.getInnerText=function(e){return e.innerText}),t.getParentWindow=function(e){return e.defaultView||e.parentWindow}}),define(\"ace/theme/textmate\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-tm\",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;border-radius: 2px;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function w(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function H(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function B(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function j(e){var t,n,r;if(B(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(B(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(B(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(t){var n=this;if(typeof n!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+n);var i=u.call(arguments,1),s=function(){if(this instanceof s){var e=n.apply(this,i.concat(u.call(arguments)));return Object(e)===e?e:this}return n.apply(t,i.concat(u.call(arguments)))};return n.prototype&&(r.prototype=n.prototype,s.prototype=new r,r.prototype=null),s});var i=Function.prototype.call,s=Array.prototype,o=Object.prototype,u=s.slice,a=i.bind(o.toString),f=i.bind(o.hasOwnProperty),l,c,h,p,d;if(d=f(o,\"__defineGetter__\"))l=i.bind(o.__defineGetter__),c=i.bind(o.__defineSetter__),h=i.bind(o.__lookupGetter__),p=i.bind(o.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=u.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),a=e+o,f=a+s-o,l=n-a,c=n-o;if(f<a)for(var h=0;h<l;++h)this[f+h]=this[a+h];else if(f>a)for(h=l;h--;)this[f+h]=this[a+h];if(s&&e===c)this.length=c,this.push.apply(this,i);else{this.length=c+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var v=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?v.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(u.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(t){return a(t)==\"[object Array]\"});var m=Object(\"a\"),g=m[0]!=\"a\"||!(0 in m);Array.prototype.forEach||(Array.prototype.forEach=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=arguments[1],s=-1,o=r.length>>>0;if(a(t)!=\"[object Function]\")throw new TypeError;while(++s<o)s in r&&t.call(i,r[s],s,n)}),Array.prototype.map||(Array.prototype.map=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0,s=Array(i),o=arguments[1];if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");for(var u=0;u<i;u++)u in r&&(s[u]=t.call(o,r[u],u,n));return s}),Array.prototype.filter||(Array.prototype.filter=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0,s=[],o,u=arguments[1];if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");for(var f=0;f<i;f++)f in r&&(o=r[f],t.call(u,o,f,n)&&s.push(o));return s}),Array.prototype.every||(Array.prototype.every=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0,s=arguments[1];if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");for(var o=0;o<i;o++)if(o in r&&!t.call(s,r[o],o,n))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0,s=arguments[1];if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");for(var o=0;o<i;o++)if(o in r&&t.call(s,r[o],o,n))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0;if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");if(!i&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var s=0,o;if(arguments.length>=2)o=arguments[1];else do{if(s in r){o=r[s++];break}if(++s>=i)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;s<i;s++)s in r&&(o=t.call(void 0,o,r[s],s,n));return o}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(t){var n=F(this),r=g&&a(this)==\"[object String]\"?this.split(\"\"):n,i=r.length>>>0;if(a(t)!=\"[object Function]\")throw new TypeError(t+\" is not a function\");if(!i&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var s,o=i-1;if(arguments.length>=2)s=arguments[1];else do{if(o in r){s=r[o--];break}if(--o<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do o in this&&(s=t.call(void 0,s,r[o],o,n));while(o--);return s});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(t){var n=g&&a(this)==\"[object String]\"?this.split(\"\"):F(this),r=n.length>>>0;if(!r)return-1;var i=0;arguments.length>1&&(i=H(arguments[1])),i=i>=0?i:Math.max(0,r+i);for(;i<r;i++)if(i in n&&n[i]===t)return i;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(t){var n=g&&a(this)==\"[object String]\"?this.split(\"\"):F(this),r=n.length>>>0;if(!r)return-1;var i=r-1;arguments.length>1&&(i=Math.min(i,H(arguments[1]))),i=i>=0?i:r-Math.abs(i);for(;i>=0;i--)if(i in n&&t===n[i])return i;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(t){return t.__proto__||(t.constructor?t.constructor.prototype:o)});if(!Object.getOwnPropertyDescriptor){var y=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(t,n){if(typeof t!=\"object\"&&typeof t!=\"function\"||t===null)throw new TypeError(y+t);if(!f(t,n))return;var r,i,s;r={enumerable:!0,configurable:!0};if(d){var u=t.__proto__;t.__proto__=o;var i=h(t,n),s=p(t,n);t.__proto__=u;if(i||s)return i&&(r.get=i),s&&(r.set=s),r}return r.value=t[n],r}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(t){return Object.keys(t)});if(!Object.create){var b;Object.prototype.__proto__===null?b=function(){return{__proto__:null}}:b=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(t,n){var r;if(t===null)r=b();else{if(typeof t!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof t+\"] != 'object'\");var i=function(){};i.prototype=t,r=new i,r.__proto__=t}return n!==void 0&&Object.defineProperties(r,n),r}}if(Object.defineProperty){var E=w({}),S=typeof document==\"undefined\"||w(document.createElement(\"div\"));if(!E||!S)var x=Object.defineProperty}if(!Object.defineProperty||x){var T=\"Property description must be an object: \",N=\"Object.defineProperty called on non-object: \",C=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(t,n,r){if(typeof t!=\"object\"&&typeof t!=\"function\"||t===null)throw new TypeError(N+t);if(typeof r!=\"object\"&&typeof r!=\"function\"||r===null)throw new TypeError(T+r);if(x)try{return x.call(Object,t,n,r)}catch(i){}if(f(r,\"value\"))if(d&&(h(t,n)||p(t,n))){var s=t.__proto__;t.__proto__=o,delete t[n],t[n]=r.value,t.__proto__=s}else t[n]=r.value;else{if(!d)throw new TypeError(C);f(r,\"get\")&&l(t,n,r.get),f(r,\"set\")&&c(t,n,r.set)}return t}}Object.defineProperties||(Object.defineProperties=function(t,n){for(var r in n)f(n,r)&&Object.defineProperty(t,r,n[r]);return t}),Object.seal||(Object.seal=function(t){return t}),Object.freeze||(Object.freeze=function(t){return t});try{Object.freeze(function(){})}catch(k){Object.freeze=function(t){return function(n){return typeof n==\"function\"?n:t(n)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(t){return t}),Object.isSealed||(Object.isSealed=function(t){return!1}),Object.isFrozen||(Object.isFrozen=function(t){return!1}),Object.isExtensible||(Object.isExtensible=function(t){if(Object(t)===t)throw new TypeError;var n=\"\";while(f(t,n))n+=\"?\";t[n]=!0;var r=f(t,n);return delete t[n],r});if(!Object.keys){var L=!0,A=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],O=A.length;for(var M in{toString:null})L=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)f(e,t)&&I.push(t);if(L)for(var n=0,r=O;n<r;n++){var i=A[n];f(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var _=\"\t\\n\\x0b\\f\\r \\xa0\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\u2028\\u2029\\ufeff\";if(!String.prototype.trim||_.trim()){_=\"[\"+_+\"]\";var D=new RegExp(\"^\"+_+_+\"*\"),P=new RegExp(_+_+\"*$\");String.prototype.trim=function(){return String(this).replace(D,\"\").replace(P,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/lib/regexp\",[\"require\",\"exports\",\"module\"],function(e,t,n){function o(e){return(e.global?\"g\":\"\")+(e.ignoreCase?\"i\":\"\")+(e.multiline?\"m\":\"\")+(e.extended?\"x\":\"\")+(e.sticky?\"y\":\"\")}function u(e,t,n){if(Array.prototype.indexOf)return e.indexOf(t,n);for(var r=n||0;r<e.length;r++)if(e[r]===t)return r;return-1}var r={exec:RegExp.prototype.exec,test:RegExp.prototype.test,match:String.prototype.match,replace:String.prototype.replace,split:String.prototype.split},i=r.exec.call(/()??/,\"\")[1]===undefined,s=function(){var e=/^/g;return r.test.call(e,\"\"),!e.lastIndex}();if(s&&i)return;RegExp.prototype.exec=function(e){var t=r.exec.apply(this,arguments),n,a;if(typeof e==\"string\"&&t){!i&&t.length>1&&u(t,\"\")>-1&&(a=RegExp(this.source,r.replace.call(o(this),\"g\",\"\")),r.replace.call(e.slice(t.index),a,function(){for(var e=1;e<arguments.length-2;e++)arguments[e]===undefined&&(t[e]=undefined)}));if(this._xregexp&&this._xregexp.captureNames)for(var f=1;f<t.length;f++)n=this._xregexp.captureNames[f-1],n&&(t[n]=t[f]);!s&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--}return t},s||(RegExp.prototype.test=function(e){var t=r.exec.call(this,e);return t&&this.global&&!t[0].length&&this.lastIndex>t.index&&this.lastIndex--,!!t})}),define(\"ace/ext/error_marker\",[\"require\",\"exports\",\"module\",\"ace/line_widgets\",\"ace/lib/dom\",\"ace/range\"],function(e,t,n){function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length-1?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?\"unshift\":\"push\"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e(\"ace/line_widgets\").LineWidgets,i=e(\"ace/lib/dom\"),s=e(\"ace/range\").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.lineWidgets&&n.lineWidgets[o];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!=\"number\"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:[\"Looks good!\"],className:\"ace_ok\"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement(\"div\")},p=h.el.appendChild(i.createElement(\"div\")),d=h.el.appendChild(i.createElement(\"div\"));d.className=\"error_widget_arrow \"+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+\"px\",h.el.className=\"error_widget_wrapper\",p.className=\"error_widget \"+l.className,p.innerHTML=l.text.join(\"<br>\"),p.appendChild(i.createElement(\"div\"));var m=function(e,t,n){if(t===0&&(n===\"esc\"||n===\"return\"))return h.destroy(),{command:\"null\"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off(\"changeSelection\",h.destroy),e.off(\"changeSession\",h.destroy),e.off(\"mouseup\",h.destroy),e.off(\"change\",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on(\"changeSelection\",h.destroy),e.on(\"changeSession\",h.destroy),e.on(\"mouseup\",h.destroy),e.on(\"change\",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.el.offsetHeight})},i.importCssString(\"    .error_widget_wrapper {        background: inherit;        color: inherit;        border:none    }    .error_widget {        border-top: solid 2px;        border-bottom: solid 2px;        margin: 5px 0;        padding: 10px 40px;        white-space: pre-wrap;    }    .error_widget.ace_error, .error_widget_arrow.ace_error{        border-color: #ff5a5a    }    .error_widget.ace_warning, .error_widget_arrow.ace_warning{        border-color: #F1D817    }    .error_widget.ace_info, .error_widget_arrow.ace_info{        border-color: #5a5a5a    }    .error_widget.ace_ok, .error_widget_arrow.ace_ok{        border-color: #5aaa5a    }    .error_widget_arrow {        position: absolute;        border: solid 5px;        border-top-color: transparent!important;        border-right-color: transparent!important;        border-left-color: transparent!important;        top: -5px;    }\",\"\")}),define(\"ace/lib/fixoldbrowsers\",[\"require\",\"exports\",\"module\",\"ace/lib/regexp\",\"ace/lib/es5-shim\"],function(e,t,n){e(\"./regexp\"),e(\"./es5-shim\")}),define(\"ace/line_widgets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/dom\",\"ace/range\"],function(e,t,n){function o(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.detach=this.detach.bind(this),this.session.on(\"change\",this.updateOnChange)}var r=e(\"./lib/oop\"),i=e(\"./lib/dom\"),s=e(\"./range\").Range;(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&(e+=t.rowCount)}),e},this.attach=function(e){e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach();if(this.editor==e)return;this.detach(),this.editor=e,this.editor.on(\"changeSession\",this.detach),e.widgetManager=this,e.setOption(\"enableLineWidgets\",!0),e.renderer.on(\"beforeRender\",this.measureWidgets),e.renderer.on(\"afterRender\",this.renderWidgets)},this.detach=function(e){if(e&&e.session==this.session)return;var t=this.editor;if(!t)return;t.off(\"changeSession\",this.detach),this.editor=null,t.widgetManager=null,t.renderer.off(\"beforeRender\",this.measureWidgets),t.renderer.off(\"afterRender\",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnChange=function(e){var t=this.session.lineWidgets;if(!t)return;var n=e.data,r=n.range,i=r.start.row,s=r.end.row-i;if(s!==0)if(n.action==\"removeText\"||n.action==\"removeLines\"){var o=t.splice(i+1,s);o.forEach(function(e){e&&this.removeLineWidget(e)},this),this.$updateRows()}else{var u=new Array(s);u.unshift(i,0),t.splice.apply(t,u),this.$updateRows()}},this.$updateRows=function(){var e=this.session.lineWidgets;if(!e)return;var t=!0;e.forEach(function(e,n){e&&(t=!1,e.row=n)}),t&&(this.session.lineWidgets=null)},this.addLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength())),this.session.lineWidgets[e.row]=e;var t=this.editor.renderer;return e.html&&!e.el&&(e.el=i.createElement(\"div\"),e.el.innerHTML=e.html),e.el&&(i.addCssClass(e.el,\"ace_lineWidgetContainer\"),e.el.style.position=\"absolute\",e.el.style.zIndex=5,t.container.appendChild(e.el),e._inDocument=!0),e.coverGutter||(e.el.style.zIndex=3),e.pixelHeight||(e.pixelHeight=e.el.offsetHeight),e.rowCount==null&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight),this.session._emit(\"changeFold\",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),e},this.removeLineWidget=function(e){e._inDocument=!1,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el);if(e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(t){}this.session.lineWidgets&&(this.session.lineWidgets[e.row]=undefined),this.session._emit(\"changeFold\",{data:{start:{row:e.row}}}),this.$updateRows()},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var n=this.session._changedWidgets,r=t.layerConfig;if(!n||!n.length)return;var i=Infinity;for(var s=0;s<n.length;s++){var o=n[s];o._inDocument||(o._inDocument=!0,t.container.appendChild(o.el)),o.h=o.el.offsetHeight,o.fixedWidth||(o.w=o.el.offsetWidth,o.screenWidth=Math.ceil(o.w/r.characterWidth));var u=o.h/r.lineHeight;o.coverLine&&(u-=this.session.getRowLineCount(o.row),u<0&&(u=0)),o.rowCount!=u&&(o.rowCount=u,o.row<i&&(i=o.row))}i!=Infinity&&(this.session._emit(\"changeFold\",{data:{start:{row:i}}}),this.session.lineWidgetWidth=null),this.session._changedWidgets=[]},this.renderWidgets=function(e,t){var n=t.layerConfig,r=this.session.lineWidgets;if(!r)return;var i=Math.min(this.firstRow,n.firstRow),s=Math.max(this.lastRow,n.lastRow,r.length);while(i>0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+\"px\";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+\"px\",u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+\"px\":u.el.style.right=\"\"}}}).call(o.prototype),t.LineWidgets=o}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u}),function(){window.require([\"ace/ace\"],function(e){e&&e.config.init(!0),window.ace||(window.ace=e);for(var t in e)e.hasOwnProperty(t)&&(ace[t]=e[t])})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/cockpit.js",
    "content": "define(\"cockpit/index\",[\"require\",\"exports\",\"module\",\"pilot/index\",\"cockpit/cli\",\"cockpit/ui/settings\",\"cockpit/ui/cli_view\",\"cockpit/commands/basic\"],function(a,b,c){b.startup=function(b,c){a(\"pilot/index\"),a(\"cockpit/cli\").startup(b,c),a(\"cockpit/ui/settings\").startup(b,c),a(\"cockpit/ui/cli_view\").startup(b,c),a(\"cockpit/commands/basic\").startup(b,c)}}),define(\"cockpit/cli\",[\"require\",\"exports\",\"module\",\"pilot/console\",\"pilot/lang\",\"pilot/oop\",\"pilot/event_emitter\",\"pilot/types\",\"pilot/canon\"],function(a,b,c){function r(a,b){q.call(this,a),b&&b.flags&&(this.flags=b.flags)}function q(a){this.env=a,this.commandAssignment=new o(p,this)}function o(a,b){this.param=a,this.requisition=b,this.setValue(a.defaultValue)}function n(a,b,c,d,e,f){this.emitter=a,this.setText(b),this.start=c,this.end=d,this.prefix=e,this.suffix=f}function m(a,b){this.status=a.status,this.message=a.message,b?(this.start=b.start,this.end=b.end):(this.start=0,this.end=0),this.predictions=a.predictions}function l(a,b,c,d,e){this.status=a,this.message=b;if(typeof c===\"number\")this.start=c,this.end=d,this.predictions=e;else{var f=c;this.start=f.start,this.end=f.end,this.predictions=f.predictions}}var d=a(\"pilot/console\"),e=a(\"pilot/lang\"),f=a(\"pilot/oop\"),g=a(\"pilot/event_emitter\").EventEmitter,h=a(\"pilot/types\"),i=a(\"pilot/types\").Status,j=a(\"pilot/types\").Conversion,k=a(\"pilot/canon\");b.startup=function(a,b){k.upgradeType(\"command\",p)},l.prototype={},l.sort=function(a,b){b!==undefined&&a.forEach(function(a){a.start===n.AT_CURSOR?a.distance=0:b<a.start?a.distance=a.start-b:b>a.end?a.distance=b-a.end:a.distance=0},this),a.sort(function(a,c){if(b!==undefined){var d=a.distance-c.distance;if(d!=0)return d}return c.status-a.status}),b!==undefined&&a.forEach(function(a){delete a.distance},this);return a},b.Hint=l,f.inherits(m,l),n.prototype={merge:function(a){if(a.emitter!=this.emitter)throw new Error(\"Can't merge Arguments from different EventEmitters\");return new n(this.emitter,this.text+this.suffix+a.prefix+a.text,this.start,a.end,this.prefix,a.suffix)},setText:function(a){if(a==null)throw new Error(\"Illegal text for Argument: \"+a);var b={argument:this,oldText:this.text,text:a};this.text=a,this.emitter._dispatchEvent(\"argumentChange\",b)},toString:function(){return this.prefix+this.text+this.suffix}},n.merge=function(a,b,c){b=b===undefined?0:b,c=c===undefined?a.length:c;var d;for(var e=b;e<c;e++){var f=a[e];d?d=d.merge(f):d=f}return d},n.AT_CURSOR=-1,o.prototype={param:undefined,conversion:undefined,value:undefined,arg:undefined,value:undefined,setValue:function(a){if(this.value!==a){if(a===undefined)this.value=this.param.defaultValue,this.conversion=this.param.getDefault?this.param.getDefault():this.param.type.getDefault(),this.arg=undefined;else{this.value=a,this.conversion=undefined;var b=a==null?\"\":this.param.type.stringify(a);this.arg&&this.arg.setText(b)}this.requisition._assignmentChanged(this)}},arg:undefined,setArgument:function(a){this.arg!==a&&(this.arg=a,this.conversion=this.param.type.parse(a.text),this.conversion.arg=a,this.value=this.conversion.value,this.requisition._assignmentChanged(this))},getHint:function(){if(this.param.getCustomHint&&this.value&&this.arg){var a=this.param.getCustomHint(this.value,this.arg);if(a)return a}var b=\"<strong>\"+this.param.name+\"</strong>: \";this.param.description&&(b+=this.param.description.trim(),b.charAt(b.length-1)!==\".\"&&(b+=\".\"),b.charAt(b.length-1)!==\" \"&&(b+=\" \"));var c=i.VALID,d=this.arg?this.arg.start:n.AT_CURSOR,e=this.arg?this.arg.end:n.AT_CURSOR,f;this.conversion&&(c=this.conversion.status,this.conversion.message&&(b+=this.conversion.message),f=this.conversion.predictions);var g=this.arg&&this.arg.text!==\"\",h=this.value!==undefined||g;this.param.defaultValue===undefined&&!h&&(c=i.INVALID,b+=\"<strong>Required<strong>\");return new l(c,b,d,e,f)},complete:function(){this.conversion&&this.conversion.predictions&&this.conversion.predictions.length>0&&this.setValue(this.conversion.predictions[0])},isPositionCaptured:function(a){if(!this.arg)return!1;if(this.arg.start===-1)return!1;if(a>this.arg.end)return!1;if(a===this.arg.end)return this.conversion.status!==i.VALID||this.conversion.predictions.length!==0;return!0},decrement:function(){var a=this.param.type.decrement(this.value);a!=null&&this.setValue(a)},increment:function(){var a=this.param.type.increment(this.value);a!=null&&this.setValue(a)},toString:function(){return this.arg?this.arg.toString():\"\"}},b.Assignment=o;var p={name:\"__command\",type:\"command\",description:\"The command to execute\",getCustomHint:function(a,b){var c=[];c.push(\"<strong><tt> &gt; \"),c.push(a.name),a.params&&a.params.length>0&&a.params.forEach(function(a){a.defaultValue===undefined?c.push(\" [\"+a.name+\"]\"):c.push(\" <em>[\"+a.name+\"]</em>\")},this),c.push(\"</tt></strong><br/>\"),c.push(a.description?a.description:\"(No description)\"),c.push(\"<br/>\"),a.params&&a.params.length>0&&(c.push(\"<ul>\"),a.params.forEach(function(a){c.push(\"<li>\"),c.push(\"<strong><tt>\"+a.name+\"</tt></strong>: \"),c.push(a.description?a.description:\"(No description)\"),a.defaultValue===undefined?c.push(\" <em>[Required]</em>\"):a.defaultValue===null?c.push(\" <em>[Optional]</em>\"):c.push(\" <em>[Default: \"+a.defaultValue+\"]</em>\"),c.push(\"</li>\")},this),c.push(\"</ul>\"));return new l(i.VALID,c.join(\"\"),b)}};q.prototype={commandAssignment:undefined,assignmentCount:undefined,_assignments:undefined,_hints:undefined,_assignmentChanged:function(a){a.param.name===\"__command\"&&(this._assignments={},a.value&&a.value.params.forEach(function(a){this._assignments[a.name]=new o(a,this)},this),this.assignmentCount=Object.keys(this._assignments).length,this._dispatchEvent(\"commandChange\",{command:a.value}))},getAssignment:function(a){var b=typeof a===\"string\"?a:Object.keys(this._assignments)[a];return this._assignments[b]},getParameterNames:function(){return Object.keys(this._assignments)},cloneAssignments:function(){return Object.keys(this._assignments).map(function(a){return this._assignments[a]},this)},_updateHints:function(){this.getAssignments(!0).forEach(function(a){this._hints.push(a.getHint())},this),l.sort(this._hints)},getWorstHint:function(){return this._hints[0]},getArgsObject:function(){var a={};this.getAssignments().forEach(function(b){a[b.param.name]=b.value},this);return a},getAssignments:function(a){var b=[];a===!0&&b.push(this.commandAssignment),Object.keys(this._assignments).forEach(function(a){b.push(this.getAssignment(a))},this);return b},setDefaultValues:function(){this.getAssignments().forEach(function(a){a.setValue(undefined)},this)},exec:function(){k.exec(this.commandAssignment.value,this.env,\"cli\",this.getArgsObject(),this.toCanonicalString())},toCanonicalString:function(){var a=[];a.push(this.commandAssignment.value.name),Object.keys(this._assignments).forEach(function(b){var c=this._assignments[b],d=c.param.type;c.value!==c.param.defaultValue&&(a.push(\" \"),a.push(d.stringify(c.value)))},this);return a.join(\"\")}},f.implement(q.prototype,g),b.Requisition=q,f.inherits(r,q),function(){r.prototype.update=function(a){this.input=a,this._hints=[];var b=this._tokenize(a.typed);this._split(b),this.commandAssignment.value&&this._assign(b),this._updateHints()},r.prototype.getInputStatusMarkup=function(){var a=this.toString().split(\"\").map(function(a){return i.VALID});this._hints.forEach(function(b){for(var c=b.start;c<=b.end;c++)b.status>a[c]&&(a[c]=b.status)},this);return a},r.prototype.toString=function(){return this.getAssignments(!0).map(function(a){return a.toString()},this).join(\"\")};var a=r.prototype._updateHints;r.prototype._updateHints=function(){a.call(this);var b=this.input.cursor;this._hints.forEach(function(a){var c=b.start>=a.start&&b.start<=a.end,d=b.end>=a.start&&b.end<=a.end,e=c||d;!e&&a.status===i.INCOMPLETE&&(a.status=i.INVALID)},this),l.sort(this._hints)},r.prototype.getHints=function(){return this._hints},r.prototype.getAssignmentAt=function(a){var b=this.getAssignments(!0);for(var c=0;c<b.length;c++){var d=b[c];if(!d.arg)return d;if(d.isPositionCaptured(a))return d}return d},r.prototype._tokenize=function(a){function g(a){return a.replace(/\\uF000/g,\" \").replace(/\\uF001/g,\"'\").replace(/\\uF002/g,'\"')}if(a==null||a.length===0)return[new n(this,\"\",0,0,\"\",\"\")];var b=1,c=2,d=3,e=4,f=b;a=a.replace(/\\\\\\\\/g,\"\\\\\").replace(/\\\\b/g,\"\\b\").replace(/\\\\f/g,\"\\f\").replace(/\\\\n/g,\"\\n\").replace(/\\\\r/g,\"\\r\").replace(/\\\\t/g,\"\\t\").replace(/\\\\v/g,\"\u000b\").replace(/\\\\n/g,\"\\n\").replace(/\\\\r/g,\"\\r\").replace(/\\\\ /g,\"\").replace(/\\\\'/g,\"\").replace(/\\\\\"/g,\"\");var h=0,i=0,j=\"\",k=[];while(!0){if(h>=a.length){if(f!==b){var l=g(a.substring(i,h));k.push(new n(this,l,i,h,j,\"\"))}else if(h!==i){var m=a.substring(i,h),o=k[k.length-1];o?o.suffix+=m:(o=new n(this,\"\",h,h,m,\"\"),k.push(o))}break}var p=a[h];switch(f){case b:p===\"'\"?(j=a.substring(i,h+1),f=d,i=h+1):p==='\"'?(j=a.substring(i,h+1),f=e,i=h+1):/ /.test(p)||(j=a.substring(i,h),f=c,i=h);break;case c:if(p===\" \"){var l=g(a.substring(i,h));k.push(new n(this,l,i,h,j,\"\")),f=b,i=h,j=\"\"}break;case d:if(p===\"'\"){var l=g(a.substring(i,h));k.push(new n(this,l,i-1,h+1,j,p)),f=b,i=h+1,j=\"\"}break;case e:if(p==='\"'){var l=g(a.substring(i,h));k.push(new n(this,l,i-1,h+1,j,p)),f=b,i=h+1,j=\"\"}}h++}return k},r.prototype._split=function(a){var b=1,c;while(b<=a.length){var c=n.merge(a,0,b);this.commandAssignment.setArgument(c);if(!this.commandAssignment.value)break;if(this.commandAssignment.value.exec){for(var d=0;d<b;d++)a.shift();break}b++}},r.prototype._assign=function(a){if(a.length===0)this.setDefaultValues();else{if(this.assignmentCount===0){this._hints.push(new l(i.INVALID,this.commandAssignment.value.name+\" does not take any parameters\",n.merge(a)));return}if(this.assignmentCount===1){var b=this.getAssignment(0);if(b.param.type.name===\"text\"){b.setArgument(n.merge(a));return}}var c=this.cloneAssignments(),d=this.getParameterNames(),f=[];c.forEach(function(b){var c=\"--\"+b.name,f=0;while(!0){var g=a[f];if(c!==g.text){f++;if(f>=a.length)break;continue}b.param.type.name===\"boolean\"?b.setValue(!0):f+1<a.length?this._hints.push(new l(i.INCOMPLETE,\"Missing value for: \"+c,a[f])):(a.splice(f+1,1),b.setArgument(a[f+1])),e.arrayRemove(d,b.name),a.splice(f,1)}},this),d.forEach(function(b){var c=this.getAssignment(b);if(a.length===0)c.setValue(undefined);else{var d=a[0];a.splice(0,1),c.setArgument(d)}},this);if(a.length>0){var g=n.merge(a);this._hints.push(new l(i.INVALID,\"Input '\"+g.text+\"' makes no sense.\",g))}}}}(),b.CliRequisition=r}),define(\"cockpit/ui/settings\",[\"require\",\"exports\",\"module\",\"pilot/types\",\"pilot/types/basic\"],function(a,b,c){var d=a(\"pilot/types\"),e=a(\"pilot/types/basic\").SelectionType,f=new e({name:\"direction\",data:[\"above\",\"below\"]}),g={name:\"hintDirection\",description:\"Are hints shown above or below the command line?\",type:\"direction\",defaultValue:\"above\"},h={name:\"outputDirection\",description:\"Is the output window shown above or below the command line?\",type:\"direction\",defaultValue:\"above\"},i={name:\"outputHeight\",description:\"What height should the output panel be?\",type:\"number\",defaultValue:300};b.startup=function(a,b){d.registerType(f),a.env.settings.addSetting(g),a.env.settings.addSetting(h),a.env.settings.addSetting(i)},b.shutdown=function(a,b){d.unregisterType(f),a.env.settings.removeSetting(g),a.env.settings.removeSetting(h),a.env.settings.removeSetting(i)}}),define(\"cockpit/ui/cli_view\",[\"require\",\"exports\",\"module\",\"text!cockpit/ui/cli_view.css\",\"pilot/event\",\"pilot/dom\",\"pilot/keys\",\"pilot/canon\",\"pilot/types\",\"cockpit/cli\",\"cockpit/ui/request_view\"],function(a,b,c){function n(a,b){a.cliView=this,this.cli=a,this.doc=document,this.win=f.getParentWindow(this.doc),this.env=b,this.element=this.doc.getElementById(\"cockpitInput\");this.element&&(this.settings=b.settings,this.hintDirection=this.settings.getSetting(\"hintDirection\"),this.outputDirection=this.settings.getSetting(\"outputDirection\"),this.outputHeight=this.settings.getSetting(\"outputHeight\"),this.isUpdating=!1,this.createElements(),this.update())}var d=a(\"text!cockpit/ui/cli_view.css\"),e=a(\"pilot/event\"),f=a(\"pilot/dom\");f.importCssString(d);var e=a(\"pilot/event\"),g=a(\"pilot/keys\"),h=a(\"pilot/canon\"),i=a(\"pilot/types\").Status,j=a(\"cockpit/cli\").CliRequisition,k=a(\"cockpit/cli\").Hint,l=a(\"cockpit/ui/request_view\").RequestView,m=new k(i.VALID,\"\",0,0);b.startup=function(a,b){var c=new j(a.env),d=new n(c,a.env);a.env.cli=c},n.prototype={createElements:function(){function d(){f.removeCssClass(this.output,\"cptFocusPopup\"),f.removeCssClass(this.hinter,\"cptFocusPopup\")}var a=this.element;this.element.spellcheck=!1,this.output=this.doc.getElementById(\"cockpitOutput\"),this.popupOutput=this.output==null;if(!this.output){this.output=this.doc.createElement(\"div\"),this.output.id=\"cockpitOutput\",this.output.className=\"cptOutput\",a.parentNode.insertBefore(this.output,a.nextSibling);var b=function(){this.output.style.maxHeight=this.outputHeight.get()+\"px\"}.bind(this);this.outputHeight.addEventListener(\"change\",b),b()}this.completer=this.doc.createElement(\"div\"),this.completer.className=\"cptCompletion VALID\",this.completer.style.color=f.computedStyle(a,\"color\"),this.completer.style.fontSize=f.computedStyle(a,\"fontSize\"),this.completer.style.fontFamily=f.computedStyle(a,\"fontFamily\"),this.completer.style.fontWeight=f.computedStyle(a,\"fontWeight\"),this.completer.style.fontStyle=f.computedStyle(a,\"fontStyle\"),a.parentNode.insertBefore(this.completer,a.nextSibling),this.completer.style.backgroundColor=a.style.backgroundColor,a.style.backgroundColor=\"transparent\",this.hinter=this.doc.createElement(\"div\"),this.hinter.className=\"cptHints\",a.parentNode.insertBefore(this.hinter,a.nextSibling);var c=this.resizer.bind(this);e.addListener(this.win,\"resize\",c),this.hintDirection.addEventListener(\"change\",c),this.outputDirection.addEventListener(\"change\",c),c(),h.addEventListener(\"output\",function(a){new l(a.request,this)}.bind(this)),e.addCommandKeyListener(a,this.onCommandKey.bind(this)),e.addListener(a,\"keyup\",this.onKeyUp.bind(this)),e.addListener(a,\"mouseup\",function(a){this.isUpdating=!0,this.update(),this.isUpdating=!1}.bind(this)),this.cli.addEventListener(\"argumentChange\",this.onArgChange.bind(this)),e.addListener(a,\"focus\",function(){f.addCssClass(this.output,\"cptFocusPopup\"),f.addCssClass(this.hinter,\"cptFocusPopup\")}.bind(this)),e.addListener(a,\"blur\",d.bind(this)),d.call(this)},scrollOutputToBottom:function(){var a=Math.max(this.output.scrollHeight,this.output.clientHeight);this.output.scrollTop=a-this.output.clientHeight},resizer:function(){var a=this.element.getClientRects()[0];this.completer.style.top=a.top+\"px\";var b=a.bottom-a.top;this.completer.style.height=b+\"px\",this.completer.style.lineHeight=b+\"px\",this.completer.style.left=a.left+\"px\";var c=a.right-a.left;this.completer.style.width=c+\"px\",this.hintDirection.get()===\"below\"?(this.hinter.style.top=a.bottom+\"px\",this.hinter.style.bottom=\"auto\"):(this.hinter.style.top=\"auto\",this.hinter.style.bottom=this.doc.documentElement.clientHeight-a.top+\"px\"),this.hinter.style.left=a.left+30+\"px\",this.hinter.style.maxWidth=c-110+\"px\",this.popupOutput&&(this.outputDirection.get()===\"below\"?(this.output.style.top=a.bottom+\"px\",this.output.style.bottom=\"auto\"):(this.output.style.top=\"auto\",this.output.style.bottom=this.doc.documentElement.clientHeight-a.top+\"px\"),this.output.style.left=a.left+\"px\",this.output.style.width=c-80+\"px\")},onCommandKey:function(a,b,c){var d;if(c===g.TAB||c===g.UP||c===g.DOWN)d=!0;else if(b!=0||c!=0)d=h.execKeyCommand(this.env,\"cli\",b,c);d&&e.stopEvent(a)},onKeyUp:function(a){var b;if(a.keyCode===g.RETURN){var c=this.cli.getWorstHint();c.status===i.VALID?(this.cli.exec(),this.element.value=\"\"):(f.setSelectionStart(this.element,c.start),f.setSelectionEnd(this.element,c.end))}this.update();var d=this.cli.getAssignmentAt(f.getSelectionStart(this.element));d&&(a.keyCode===g.TAB&&(d.complete(),this.update()),a.keyCode===g.UP&&(d.increment(),this.update()),a.keyCode===g.DOWN&&(d.decrement(),this.update()));return b},update:function(){this.isUpdating=!0;var a={typed:this.element.value,cursor:{start:f.getSelectionStart(this.element),end:f.getSelectionEnd(this.element.selectionEnd)}};this.cli.update(a);var b=this.cli.getAssignmentAt(a.cursor.start).getHint();f.removeCssClass(this.completer,i.VALID.toString()),f.removeCssClass(this.completer,i.INCOMPLETE.toString()),f.removeCssClass(this.completer,i.INVALID.toString());var c='<span class=\"cptPrompt\">&gt;</span> ';if(this.element.value.length>0){var d=this.cli.getInputStatusMarkup();c+=this.markupStatusScore(d)}if(this.element.value.length>0&&b.predictions&&b.predictions.length>0){var e=b.predictions[0];c+=\" &nbsp;&#x21E5; \"+(e.name?e.name:e)}this.completer.innerHTML=c,f.addCssClass(this.completer,this.cli.getWorstHint().status.toString());var g=\"\";this.element.value.length!==0&&(g+=b.message,b.predictions&&b.predictions.length>0&&(g+=\": [ \",b.predictions.forEach(function(a){g+=a.name?a.name:a,g+=\" | \"},this),g=g.replace(/\\| $/,\"]\"))),this.hinter.innerHTML=g,g.length===0?f.addCssClass(this.hinter,\"cptNoPopup\"):f.removeCssClass(this.hinter,\"cptNoPopup\"),this.isUpdating=!1},markupStatusScore:function(a){var b=\"\",c=0,d=-1;while(!0){d!==a[c]&&(b+=\"<span class=\"+a[c].toString()+\">\",d=a[c]),b+=this.element.value[c],c++;if(c===this.element.value.length){b+=\"</span>\";break}d!==a[c]&&(b+=\"</span>\")}return b},onArgChange:function(a){if(!this.isUpdating){var b=this.element.value.substring(0,a.argument.start),c=this.element.value.substring(a.argument.end),d=typeof a.text===\"string\"?a.text:a.text.name;this.element.value=b+d+c;var e=(b+d).length;this.element.selectionStart=e,this.element.selectionEnd=e}}},b.CliView=n}),define(\"cockpit/ui/request_view\",[\"require\",\"exports\",\"module\",\"pilot/dom\",\"pilot/event\",\"text!cockpit/ui/request_view.html\",\"pilot/domtemplate\",\"text!cockpit/ui/request_view.css\"],function(a,b,c){function l(a,b){this.request=a,this.cliView=b,this.imageUrl=k,this.rowin=null,this.rowout=null,this.output=null,this.hide=null,this.show=null,this.duration=null,this.throb=null,(new g).processNode(j.cloneNode(!0),this),this.cliView.output.appendChild(this.rowin),this.cliView.output.appendChild(this.rowout),this.request.addEventListener(\"output\",this.onRequestChange.bind(this))}function k(b){var d;try{d=a(\"text!cockpit/ui/\"+b)}catch(e){}if(d)return d;var f=c.id.split(\"/\").pop()+\".js\",g;if(c.uri.substr(-f.length)!==f){console.error(\"Can't work out path from module.uri/module.id\");return b}if(c.uri){var h=c.uri.length-f.length-1;return c.uri.substr(0,h)+\"/\"+b}return f+b}var d=a(\"pilot/dom\"),e=a(\"pilot/event\"),f=a(\"text!cockpit/ui/request_view.html\"),g=a(\"pilot/domtemplate\").Templater,h=a(\"text!cockpit/ui/request_view.css\");d.importCssString(h);var i=document.createElement(\"div\");i.innerHTML=f;var j=i.querySelector(\".cptRow\");l.prototype={copyToInput:function(){this.cliView.element.value=this.request.typed},executeRequest:function(a){this.cliView.cli.update({typed:this.request.typed,cursor:{start:0,end:0}}),this.cliView.cli.exec()},hideOutput:function(a){this.output.style.display=\"none\",d.addCssClass(this.hide,\"cmd_hidden\"),d.removeCssClass(this.show,\"cmd_hidden\"),e.stopPropagation(a)},showOutput:function(a){this.output.style.display=\"block\",d.removeCssClass(this.hide,\"cmd_hidden\"),d.addCssClass(this.show,\"cmd_hidden\"),e.stopPropagation(a)},remove:function(a){this.cliView.output.removeChild(this.rowin),this.cliView.output.removeChild(this.rowout),e.stopPropagation(a)},onRequestChange:function(a){this.duration.innerHTML=this.request.duration?\"completed in \"+this.request.duration/1e3+\" sec \":\"\",this.output.innerHTML=\"\",this.request.outputs.forEach(function(a){var b;typeof a==\"string\"?(b=document.createElement(\"p\"),b.innerHTML=a):b=a,this.output.appendChild(b)},this),this.cliView.scrollOutputToBottom(),d.setCssClass(this.output,\"cmd_error\",this.request.error),this.throb.style.display=this.request.completed?\"none\":\"block\"}},b.RequestView=l}),define(\"pilot/domtemplate\",[\"require\",\"exports\",\"module\"],function(require,exports,module){function Templater(){this.scope=[]}Templater.prototype.processNode=function(a,b){typeof a===\"string\"&&(a=document.getElementById(a));if(b===null||b===undefined)b={};this.scope.push(a.nodeName+(a.id?\"#\"+a.id:\"\"));try{if(a.attributes&&a.attributes.length){if(a.hasAttribute(\"foreach\")){this.processForEach(a,b);return}if(a.hasAttribute(\"if\"))if(!this.processIf(a,b))return;b.__element=a;var c=Array.prototype.slice.call(a.attributes);for(var d=0;d<c.length;d++){var e=c[d].value,f=c[d].name;this.scope.push(f);try{if(f===\"save\")e=this.stripBraces(e),this.property(e,b,a),a.removeAttribute(\"save\");else if(f.substring(0,2)===\"on\"){e=this.stripBraces(e);var g=this.property(e,b);typeof g!==\"function\"&&this.handleError(\"Expected \"+e+\" to resolve to a function, but got \"+typeof g),a.removeAttribute(f);var h=a.hasAttribute(\"capture\"+f.substring(2));a.addEventListener(f.substring(2),g,h),h&&a.removeAttribute(\"capture\"+f.substring(2))}else{var i=this,j=e.replace(/\\$\\{[^}]*\\}/g,function(a){return i.envEval(a.slice(2,-1),b,e)});f.charAt(0)===\"_\"?(a.removeAttribute(f),a.setAttribute(f.substring(1),j)):e!==j&&(c[d].value=j)}}finally{this.scope.pop()}}}var k=Array.prototype.slice.call(a.childNodes);for(var l=0;l<k.length;l++)this.processNode(k[l],b);a.nodeType===Node.TEXT_NODE&&this.processTextNode(a,b)}finally{this.scope.pop()}},Templater.prototype.processIf=function(a,b){this.scope.push(\"if\");try{var c=a.getAttribute(\"if\"),d=this.stripBraces(c),e=!0;try{var f=this.envEval(d,b,c);e=!!f}catch(g){this.handleError(\"Error with '\"+d+\"'\",g),e=!1}e||a.parentNode.removeChild(a),a.removeAttribute(\"if\");return e}finally{this.scope.pop()}},Templater.prototype.processForEach=function(a,b){this.scope.push(\"foreach\");try{var c=a.getAttribute(\"foreach\"),d=c,e=\"param\";if(d.charAt(0)===\"$\")d=this.stripBraces(d);else{var f=d.split(\" in \");e=f[0].trim(),d=this.stripBraces(f[1].trim())}a.removeAttribute(\"foreach\");try{var g=this,h=function(a,c,d){d.parentNode.insertBefore(c,d),b[e]=a,g.processNode(c,b),delete b[e]},i=function(b,c){g.scope.push(b);try{if(a.nodeName===\"LOOP\")for(var d=0;d<a.childNodes.length;d++){var e=a.childNodes[d].cloneNode(!0);h(c,e,a)}else{var e=a.cloneNode(!0);e.removeAttribute(\"foreach\"),h(c,e,a)}}finally{g.scope.pop()}},j=this.envEval(d,b,c);if(Array.isArray(j))j.forEach(function(a,b){i(\"\"+b,a)},this);else for(var k in j)j.hasOwnProperty(k)&&i(k,k);a.parentNode.removeChild(a)}catch(l){this.handleError(\"Error with '\"+d+\"'\",l)}}finally{this.scope.pop()}},Templater.prototype.processTextNode=function(a,b){var c=a.data;c=c.replace(/\\$\\{([^}]*)\\}/g,\"$$$1\");var d=c.split(/\\uF001|\\uF002/);d.length>1&&(d.forEach(function(c){c!==null&&c!==undefined&&c!==\"\"&&(c.charAt(0)===\"$\"&&(c=this.envEval(c.slice(1),b,a.data)),c===null&&(c=\"null\"),c===undefined&&(c=\"undefined\"),typeof c.cloneNode!==\"function\"&&(c=a.ownerDocument.createTextNode(c.toString())),a.parentNode.insertBefore(c,a))},this),a.parentNode.removeChild(a))},Templater.prototype.stripBraces=function(a){if(!a.match(/\\$\\{.*\\}/g)){this.handleError(\"Expected \"+a+\" to match ${...}\");return a}return a.slice(2,-1)},Templater.prototype.property=function(a,b,c){this.scope.push(a);try{typeof a===\"string\"&&(a=a.split(\".\"));var d=b[a[0]];if(a.length===1){c!==undefined&&(b[a[0]]=c);if(typeof d===\"function\")return function(){return d.apply(b,arguments)};return d}if(!d){this.handleError(\"Can't find path=\"+a);return null}return this.property(a.slice(1),d,c)}finally{this.scope.pop()}},Templater.prototype.envEval=function(script,env,context){with(env)try{this.scope.push(context);return eval(script)}catch(ex){this.handleError(\"Template error evaluating '\"+script+\"'\",ex);return script}finally{this.scope.pop()}},Templater.prototype.handleError=function(a,b){this.logError(a),this.logError(\"In: \"+this.scope.join(\" > \")),b&&this.logError(b)},Templater.prototype.logError=function(a){window.console&&window.console.log&&console.log(a)},exports.Templater=Templater}),define(\"cockpit/commands/basic\",[\"require\",\"exports\",\"module\",\"pilot/canon\"],function(a,b,c){var d=a(\"pilot/canon\"),e={name:\"sh\",description:\"Execute a system command (requires server support)\",params:[{name:\"command\",type:\"text\",description:\"The string to send to the os shell.\"}],exec:function(a,b,c){var d=new XMLHttpRequest;d.open(\"GET\",\"/exec?args=\"+b.command,!0),d.onreadystatechange=function(a){d.readyState==4&&(d.status==200&&c.done(\"<pre>\"+d.responseText+\"</pre>\"))},d.send(null)}},d=a(\"pilot/canon\");b.startup=function(a,b){d.addCommand(e)},b.shutdown=function(a,b){d.removeCommand(e)}}),define(\"text!cockpit/ui/cli_view.css\",[],\"#cockpitInput { padding-left: 16px; }.cptOutput { overflow: auto; position: absolute; z-index: 999; display: none; }.cptCompletion { padding: 0; position: absolute; z-index: -1000; }.cptCompletion.VALID { background: #FFF; }.cptCompletion.INCOMPLETE { background: #DDD; }.cptCompletion.INVALID { background: #DDD; }.cptCompletion span { color: #FFF; }.cptCompletion span.INCOMPLETE { color: #DDD; border-bottom: 2px dotted #F80; }.cptCompletion span.INVALID { color: #DDD; border-bottom: 2px dotted #F00; }span.cptPrompt { color: #66F; font-weight: bold; }.cptHints {  color: #000;  position: absolute;  border: 1px solid rgba(230, 230, 230, 0.8);  background: rgba(250, 250, 250, 0.8);  -moz-border-radius-topleft: 10px;  -moz-border-radius-topright: 10px;  border-top-left-radius: 10px; border-top-right-radius: 10px;  z-index: 1000;  padding: 8px;  display: none;}.cptFocusPopup { display: block; }.cptFocusPopup.cptNoPopup { display: none; }.cptHints ul { margin: 0; padding: 0 15px; }.cptGt { font-weight: bold; font-size: 120%; }\"),define(\"text!cockpit/ui/request_view.css\",[],\".cptRowIn {  display: box; display: -moz-box; display: -webkit-box;  box-orient: horizontal; -moz-box-orient: horizontal; -webkit-box-orient: horizontal;  box-align: center; -moz-box-align: center; -webkit-box-align: center;  color: #333;  background-color: #EEE;  width: 100%;  font-family: consolas, courier, monospace;}.cptRowIn > * { padding-left: 2px; padding-right: 2px; }.cptRowIn > img { cursor: pointer; }.cptHover { display: none; }.cptRowIn:hover > .cptHover { display: block; }.cptRowIn:hover > .cptHover.cptHidden { display: none; }.cptOutTyped {  box-flex: 1; -moz-box-flex: 1; -webkit-box-flex: 1;  font-weight: bold; color: #000; font-size: 120%;}.cptRowOutput { padding-left: 10px; line-height: 1.2em; }.cptRowOutput strong,.cptRowOutput b,.cptRowOutput th,.cptRowOutput h1,.cptRowOutput h2,.cptRowOutput h3 { color: #000; }.cptRowOutput a { font-weight: bold; color: #666; text-decoration: none; }.cptRowOutput a: hover { text-decoration: underline; cursor: pointer; }.cptRowOutput input[type=password],.cptRowOutput input[type=text],.cptRowOutput textarea {  color: #000; font-size: 120%;  background: transparent; padding: 3px;  border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px;}.cptRowOutput table,.cptRowOutput td,.cptRowOutput th { border: 0; padding: 0 2px; }.cptRowOutput .right { text-align: right; }\"),define(\"text!cockpit/ui/request_view.html\",[],'<div class=cptRow>  <!-- The div for the input (i.e. what was typed) -->  <div class=\"cptRowIn\" save=\"${rowin}\"      onclick=\"${copyToInput}\"      ondblclick=\"${executeRequest}\">    <!-- What the user actually typed -->    <div class=\"cptGt\">&gt; </div>    <div class=\"cptOutTyped\">${request.typed}</div>    <!-- The extra details that appear on hover -->    <div class=cptHover save=\"${duration}\"></div>    <img class=cptHover onclick=\"${hideOutput}\" save=\"${hide}\"        alt=\"Hide command output\" _src=\"${imageUrl(\\'images/minus.png\\')}\"/>    <img class=\"cptHover cptHidden\" onclick=\"${showOutput}\" save=\"${show}\"        alt=\"Show command output\" _src=\"${imageUrl(\\'images/plus.png\\')}\"/>    <img class=cptHover onclick=\"${remove}\"        alt=\"Remove this command from the history\"        _src=\"${imageUrl(\\'images/closer.png\\')}\"/>  </div>  <!-- The div for the command output -->  <div class=\"cptRowOut\" save=\"${rowout}\">    <div class=\"cptRowOutput\" save=\"${output}\"></div>    <img _src=\"${imageUrl(\\'images/throbber.gif\\')}\" save=\"${throb}\"/>  </div></div>'),define(\"text!cockpit/ui/images/closer.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAj9JREFUeNp0ks+LUlEUx7/vV1o8Z8wUx3IEHcQmiBiQlomjRNCiZpEuEqF/oEUwq/6EhvoHggmRcJUQBM1CRJAW0aLIaGQimZJxJsWxyV/P9/R1zzWlFl04vPvOPZ9z7rnnK5imidmKRCIq+zxgdoPZ1T/ut8xeM3tcKpW6s1hhBkaj0Qj7bDebTX+324WmadxvsVigqipcLleN/d4rFoulORiLxTZY8ItOp8MBCpYkiYPj8Xjus9vtlORWoVB4KcTjcQc732dLpSRXvCZaAws6Q4WDdqsO52kNH+oCRFGEz+f7ydwBKRgMPmTXi49GI1x2D/DsznesB06ws2eDbI7w9HYN6bVjvGss4KAjwDAMq81mM2SW5Wa/3weBbz42UL9uYnVpiO2Nr9ANHSGXib2Wgm9tCYIggGKJEVkvlwgi5/FQRmTLxO6hgJVzI1x0T/fJrBtHJxPeL6tI/fsZLA6ot8lkQi8HRVbw94gkWYI5MaHrOjcCGSNRxZosy9y5cErDzn0Dqx7gcwO8WtBp4PndI35GMYqiUMUvBL5yOBz8yRfFNpbPmqgcCFh/IuHa1nR/YXGM8+oUpFhihEQiwcdRLpfVRqOBtWXWq34Gra6AXq8Hp2piZcmKT4cKnE4nwuHwdByVSmWQz+d32WCTlHG/qaHHREN9kgi0sYQfv0R4PB4EAgESQDKXy72fSy6VSnHJVatVf71eR7vd5n66mtfrRSgU4pLLZrOlf7RKK51Ok8g3/yPyR5lMZi7y3wIMAME4EigHWgKnAAAAAElFTkSuQmCC\"),define(\"text!cockpit/ui/images/dot_clear.gif\",[],\"data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAEBMgA7\"),define(\"text!cockpit/ui/images/minus.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4xMrIJw5EAAAHcSURBVCjPhZIxSxtxGMZ/976XhJA/RA5EAyJcFksnp64hjUPBoXRyCYLQTyD0UxScu0nFwalCQSgFCVk7dXAwUAiBDA2RO4W7yN1x9+9gcyhU+pteHt4H3pfncay1LOl0OgY4BN4Ar/7KP4BvwNFwOIyWu87S2O12O8DxfD73oygiSRIAarUaxhhWV1fHwMFgMBiWxl6v9y6Koi+3t7ckSUKtVkNVAcjzvNRWVlYwxry9vLz86uzs7HjAZDKZGGstjUaDfxHHMSLC5ubmHdB2VfVwNpuZ5clxHPMcRVFwc3PTXFtbO3RFZHexWJCmabnweAaoVqvlv4vFAhHZdVX1ZZqmOI5DURR8fz/lxbp9Yrz+7bD72SfPcwBU1XdF5N5aWy2KgqIoeBzPEnWVLMseYnAcRERdVR27rrsdxzGqyutP6898+GBsNBqo6i9XVS88z9sOggAR4X94noeqXoiIHPm+H9XrdYIgIAxDwjAkTVPCMESzBy3LMprNJr7v34nIkV5dXd2fn59fG2P2siwjSRIqlQrWWlSVJFcqlQqtVot2u40xZu/s7OxnWbl+v98BjkejkT+dTgmCoDxtY2ODra2tMXBweno6fNJVgP39fQN8eKbkH09OTsqS/wHFRdHPfTSfjwAAAABJRU5ErkJggg==\"),define(\"text!cockpit/ui/images/pinaction.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC7mlDQ1BJQ0MgUHJvZmlsZQAAeAGFVM9rE0EU/jZuqdAiCFprDrJ4kCJJWatoRdQ2/RFiawzbH7ZFkGQzSdZuNuvuJrWliOTi0SreRe2hB/+AHnrwZC9KhVpFKN6rKGKhFy3xzW5MtqXqwM5+8943731vdt8ADXLSNPWABOQNx1KiEWlsfEJq/IgAjqIJQTQlVdvsTiQGQYNz+Xvn2HoPgVtWw3v7d7J3rZrStpoHhP1A4Eea2Sqw7xdxClkSAog836Epx3QI3+PY8uyPOU55eMG1Dys9xFkifEA1Lc5/TbhTzSXTQINIOJT1cVI+nNeLlNcdB2luZsbIEL1PkKa7zO6rYqGcTvYOkL2d9H5Os94+wiHCCxmtP0a4jZ71jNU/4mHhpObEhj0cGDX0+GAVtxqp+DXCFF8QTSeiVHHZLg3xmK79VvJKgnCQOMpkYYBzWkhP10xu+LqHBX0m1xOv4ndWUeF5jxNn3tTd70XaAq8wDh0MGgyaDUhQEEUEYZiwUECGPBoxNLJyPyOrBhuTezJ1JGq7dGJEsUF7Ntw9t1Gk3Tz+KCJxlEO1CJL8Qf4qr8lP5Xn5y1yw2Fb3lK2bmrry4DvF5Zm5Gh7X08jjc01efJXUdpNXR5aseXq8muwaP+xXlzHmgjWPxHOw+/EtX5XMlymMFMXjVfPqS4R1WjE3359sfzs94i7PLrXWc62JizdWm5dn/WpI++6qvJPmVflPXvXx/GfNxGPiKTEmdornIYmXxS7xkthLqwviYG3HCJ2VhinSbZH6JNVgYJq89S9dP1t4vUZ/DPVRlBnM0lSJ93/CKmQ0nbkOb/qP28f8F+T3iuefKAIvbODImbptU3HvEKFlpW5zrgIXv9F98LZua6N+OPwEWDyrFq1SNZ8gvAEcdod6HugpmNOWls05Uocsn5O66cpiUsxQ20NSUtcl12VLFrOZVWLpdtiZ0x1uHKE5QvfEp0plk/qv8RGw/bBS+fmsUtl+ThrWgZf6b8C8/UXAeIuJAAAACXBIWXMAAAsTAAALEwEAmpwYAAAClklEQVQ4EX1TXUhUQRQ+Z3Zmd+9uN1q2P3UpZaEwcikKekkqLKggKHJ96MHe9DmLkCDa9U198Id8kErICmIlRAN96UdE6QdBW/tBA5Uic7E0zN297L17p5mb1zYjD3eYc+d83zlnON8g5xzWNUSEdUBkHTJasRWySPP7fw3hfwkk2GoNsc0vOaJRHo1GV/GiMctkTIJRFlpZli8opK+htmf83gXeG63oteOtra0u25e7TYJIJELb26vYCACTgUe1lXV86BTn745l+MsyHqs53S/Aq4VEUa9Y6ko14eYY4u3AyM3HYwdKU35DZyblGR2+qq6W0X2Nnh07xynnVYpHORx/E1/GvvqaAZUayjMjdM2f/Lgr5E+fV93zR4u3zKCLughsZqKwAzAxaz6dPY6JgjLUF+eSP5OpjmAw2E8DvldHSvJMKPg08aRor1tc4BuALu6mOwGWdQC3mKIqRsC8mKd8wYfD78/earzSYzdMDW9QgKb0Is8CBY1mQXOiaXAHEpMDE5XTJqIq4EiyxUqKlpfkF0pyV1OTAoFAhmTmyCCoDsZNZvIkUjELQpipo0sQqYZAswZHwsEEE10M0pq2SSZY9HqNcDicJcNTpBvQJz40UbSOTh1B8bDpuY0w9Hb3kkn9lPAlBLfhfD39XTtX/blFJqiqrjbkTi63Hbofj2uL4GMsmzFgbDJ/vmMgv/lB4syJ0oXO7d3j++vio6GFsYmD6cHJreWc3/jRVVHhsOYvM8iZ36mtjPDBk/xDZE8CoHlbrlAssbTxDdDJvdb536L7I6S7Vy++6Gi4Xi9BsUthJRaLOYSPz4XALKI4j4iObd/e5UtDKUjZzYyYRyGAJv01Zj8kC5cbs5WY83hQnv0DzCXl+r8APElkq0RU6oMAAAAASUVORK5CYII=\"),define(\"text!cockpit/ui/images/pinin.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC7mlDQ1BJQ0MgUHJvZmlsZQAAeAGFVM9rE0EU/jZuqdAiCFprDrJ4kCJJWatoRdQ2/RFiawzbH7ZFkGQzSdZuNuvuJrWliOTi0SreRe2hB/+AHnrwZC9KhVpFKN6rKGKhFy3xzW5MtqXqwM5+8943731vdt8ADXLSNPWABOQNx1KiEWlsfEJq/IgAjqIJQTQlVdvsTiQGQYNz+Xvn2HoPgVtWw3v7d7J3rZrStpoHhP1A4Eea2Sqw7xdxClkSAog836Epx3QI3+PY8uyPOU55eMG1Dys9xFkifEA1Lc5/TbhTzSXTQINIOJT1cVI+nNeLlNcdB2luZsbIEL1PkKa7zO6rYqGcTvYOkL2d9H5Os94+wiHCCxmtP0a4jZ71jNU/4mHhpObEhj0cGDX0+GAVtxqp+DXCFF8QTSeiVHHZLg3xmK79VvJKgnCQOMpkYYBzWkhP10xu+LqHBX0m1xOv4ndWUeF5jxNn3tTd70XaAq8wDh0MGgyaDUhQEEUEYZiwUECGPBoxNLJyPyOrBhuTezJ1JGq7dGJEsUF7Ntw9t1Gk3Tz+KCJxlEO1CJL8Qf4qr8lP5Xn5y1yw2Fb3lK2bmrry4DvF5Zm5Gh7X08jjc01efJXUdpNXR5aseXq8muwaP+xXlzHmgjWPxHOw+/EtX5XMlymMFMXjVfPqS4R1WjE3359sfzs94i7PLrXWc62JizdWm5dn/WpI++6qvJPmVflPXvXx/GfNxGPiKTEmdornIYmXxS7xkthLqwviYG3HCJ2VhinSbZH6JNVgYJq89S9dP1t4vUZ/DPVRlBnM0lSJ93/CKmQ0nbkOb/qP28f8F+T3iuefKAIvbODImbptU3HvEKFlpW5zrgIXv9F98LZua6N+OPwEWDyrFq1SNZ8gvAEcdod6HugpmNOWls05Uocsn5O66cpiUsxQ20NSUtcl12VLFrOZVWLpdtiZ0x1uHKE5QvfEp0plk/qv8RGw/bBS+fmsUtl+ThrWgZf6b8C8/UXAeIuJAAAACXBIWXMAAAsTAAALEwEAmpwYAAABZ0lEQVQ4Ea2TPUsDQRCGZ89Eo4FACkULEQs1CH4Uamfjn7GxEYJFIFXgChFsbPwzNnZioREkaiHBQtEiEEiMRm/dZ8OEGAxR4sBxx877Pju7M2estTJIxLrNuVwuMxQEx0ZkzcFHyRtjXt02559RtB2GYanTYzoryOfz+6l4Nbszf2niwffKmpGRo9sVW22mDgqFwp5C2gDMm+P32a3JB1N+n5JifUGeP9JeNxGryPLYjcwMP8rJ07Q9fZltQzyAstOJ2vVu5sKc1ZZkRBrOcKeb+HexPidvkpCN5JUcllZtpZFc5DgBWc5M2eysZuMuofMBSA4NWjx4PUCsXefMlI0QY3ewRg4NWi4ZTQsgrjYXema+e4VqtEMK6KXvu+4B9Bklt90vVKMeD2BI6DOt4rZ/Gk7WyKFBi4fNPIAJY0joM61SCCZ9tI1o0OIB8D+DBIkYaJRbCBH9mZgNt+bb++ufSSF/eX8BYcDeAzuQJVUAAAAASUVORK5CYII=\"),define(\"text!cockpit/ui/images/pinout.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAC7mlDQ1BJQ0MgUHJvZmlsZQAAeAGFVM9rE0EU/jZuqdAiCFprDrJ4kCJJWatoRdQ2/RFiawzbH7ZFkGQzSdZuNuvuJrWliOTi0SreRe2hB/+AHnrwZC9KhVpFKN6rKGKhFy3xzW5MtqXqwM5+8943731vdt8ADXLSNPWABOQNx1KiEWlsfEJq/IgAjqIJQTQlVdvsTiQGQYNz+Xvn2HoPgVtWw3v7d7J3rZrStpoHhP1A4Eea2Sqw7xdxClkSAog836Epx3QI3+PY8uyPOU55eMG1Dys9xFkifEA1Lc5/TbhTzSXTQINIOJT1cVI+nNeLlNcdB2luZsbIEL1PkKa7zO6rYqGcTvYOkL2d9H5Os94+wiHCCxmtP0a4jZ71jNU/4mHhpObEhj0cGDX0+GAVtxqp+DXCFF8QTSeiVHHZLg3xmK79VvJKgnCQOMpkYYBzWkhP10xu+LqHBX0m1xOv4ndWUeF5jxNn3tTd70XaAq8wDh0MGgyaDUhQEEUEYZiwUECGPBoxNLJyPyOrBhuTezJ1JGq7dGJEsUF7Ntw9t1Gk3Tz+KCJxlEO1CJL8Qf4qr8lP5Xn5y1yw2Fb3lK2bmrry4DvF5Zm5Gh7X08jjc01efJXUdpNXR5aseXq8muwaP+xXlzHmgjWPxHOw+/EtX5XMlymMFMXjVfPqS4R1WjE3359sfzs94i7PLrXWc62JizdWm5dn/WpI++6qvJPmVflPXvXx/GfNxGPiKTEmdornIYmXxS7xkthLqwviYG3HCJ2VhinSbZH6JNVgYJq89S9dP1t4vUZ/DPVRlBnM0lSJ93/CKmQ0nbkOb/qP28f8F+T3iuefKAIvbODImbptU3HvEKFlpW5zrgIXv9F98LZua6N+OPwEWDyrFq1SNZ8gvAEcdod6HugpmNOWls05Uocsn5O66cpiUsxQ20NSUtcl12VLFrOZVWLpdtiZ0x1uHKE5QvfEp0plk/qv8RGw/bBS+fmsUtl+ThrWgZf6b8C8/UXAeIuJAAAACXBIWXMAAAsTAAALEwEAmpwYAAACyUlEQVQ4EW1TXUgUURQ+Z3ZmnVV3QV2xJbVSEIowQbAfLQx8McLoYX2qjB58MRSkP3vZppceYhGxgrZaIughlYpE7CHFWiiKyj9II0qxWmwlNh1Xtp2f27mz7GDlZX7uuXO+73zfuXeQMQYIgAyALppgyBtse32stsw86txkHhATn+FbfPfzxnPB+vR3RMJYuTwW6bbB4a6WS5O3Yu2VlXIesDiAamiQNKVlVXfx5I0GJ7DY7p0/+erU4dgeMJIA31WNxZmAgibOreXDqF55sY4SFUURqbi+nkjgwTyAbHhLX8yOLsSM2QRA3JRAAgd4RGPbVhkKEp8qeJ7PFyW3fw++YHtC7CkaD0amqyqihSwlMQQ0wa07IjPVI/vbexreIUrVaQV2D4RMQ/o7m12Mdfx4H3PfB9FNzTR1U2cO0Bi45aV6xNvFBNaoIAfbSiwLlqi9/hR/R3Nrhua+Oqi9TEKiB02C7YXz+Pba4MTDrpbLiMAxNgmXb+HpwVkZdoIrkn9isW7nRw/TZYaagZArAWyhfqsSDL/c9aTx7JUjGZCtYExRqCzAwGblwr6aFQ84nTo6qZ7XCeCVQNckE/KSWolvoQnxeoFFgIh8G/nA+kBAxxuQO5m9eFrwLIGJHgcyM63VFMhRSgNVyJr7og8y1vbTQpH8DIEVgxuYuexw0QECIalq5FYgEmpkgoFYltU/lnrqDz5osirSFpF7lrHAFKSWHYfEs+mY/82UnAStyMlW8sUPsVIciTZgz3jV1ebg0CEOpgPF22s1z1YQYKSXPJ1hbAhR8T26WdLhkuVfAzPR+YO1Ox5n58SmCcF6e3uzAoHA77RkevJdWH/3+f2O9TGf3w3fWQ2Hw5F/13mcsWAT+vv6DK4kFApJ/d3d1k+kJtbCrmxXHS3n8ER6b3CQbAqaEHVra6sGxcXW4SovLx+empxapS//FfwD9kpMJjMMBBAAAAAASUVORK5CYII=\"),define(\"text!cockpit/ui/images/pins.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAQCAYAAABQrvyxAAAACXBIWXMAAAsTAAALEwEAmpwYAAAGYklEQVRIDbVWe0yURxCf/R735o6DO0FBe0RFsaL4iLXGIKa2SY3P6JGa2GpjlJjUV9NosbU++tYUbEnaQIrVaKJBG7WiNFQFUWO1UUEsVg2CAgoeHHLewcH32O58cBdQsX9Y5+7LfrszOzO/2ZnZj1BKgTBiIwVGVvKd49OVVYunDlXn6wdBKh+ogXrv+DOz1melIb+3LM5fNv2XPYE5EHY+L3PJljN5zavHpJjsQNsA/JJEgyC2+WTjy3b0GfoJW8O4aoHtDwiHQrj5lw1LLyyb1bp5zAjJTus9klrVpdD6TqH2ngVO+0dsRJnp06cLIYU4fx7NnRI3bu7UIYOeJ/McnuY88q3k62gc0S4Dgf5qhICQtIXS2lqD7BhSduPk3YfyzXaANhBBJDxYdUqCywB2qS4RdyUuSkTF/VJxcbH5j8N7/75RuFrN3Zh8OS8zqf5m4UpPeenOyP42dbtBeuvVnCdkK1e4PfPouX03mo9se+c33M8wqDk5Ofqed8REUTicQhbySUxp9u3KlMSHTtrFU6Kyn03lz15PPpW25vsZeYSIKyiVURcqeZJOH9lTNZLfnxRjU/uwrjbEUBWsapcSO2Hq4k0VfZg9EzxdDNCEjDxgNqRDme9umz/btwlsHRIEePHgAf73RdnHZ6LTuIUBN7OBQ+c1Fdnp6cZ1BQUdeRuWZi97o3ktDQQkVeFFzqJARd1A5a0Vr7ta6Kp6TZjtZ+NTIOoKF6qDrL7e0QQIUCiqMMKk8Z1Q/SCSKvzocf2B6NEN0SQn/kTO6fKJ0zqjZUlQBSpJ0GjR77w0aoc1Pr6S5/kVJrNpakV5hR+LWKN4t7sLX+p0rx2vqSta64olIulUKUgCSXLWE1R4KPPSj+5vhm2hdDOG+CkQBmhhyyKq6SaFYWTn5bB3QJRNz54AuXKn8TJjhu0Wbv+wNEKQjVhnmKopjo4FxXmetCRnC4F7BhCiCUepqAepRh0TM/gjjzOOSK2NgWZPc05qampRWJHb7dbOffep2ednzLzgczlbrQA6gHYF9BYDh9GY+FjddMweHMscmMuep07gXlMQoqw9ALoYu5MJsak9QmJA2IvAgVmoCRciooyPujJtNCv1uHt3TmK9gegFKrG9kh6oXwZiIEAtBIjORGKNTWR/WeW8XVkbjuJepLAyloM8LmTN//njKZPbraATZaLjCHEww9Ei4FFiPg6Ja5gT6gxYgLgnRDHRQwJXbz2GOw0d4A3K4GXlUtMahJjYVxiYbrwOmxIS10bFnIBOSi6Tl9Jgs0zbOEX18wyEwgLPMrxD1Y4aCK8kmTpgYcpAF27Mzs42Hjx4kA8BICUlJfKArR7LcEvTB1xEC9AoEw9OPagWkVU/D1oesmK6U911zEczMVe01oZjiMggg6ux2Qk379qh4rYKet4GjrhhwEteBgBrH8BssoXEtbHzPpSBRRSpqlNpgAiUoxzHKxLRszoVuggIisxaDQWZqkQvQjAoax3NbDbLLGuUEABNGedXqSyLRupXgDT5JfAGZNLio9B0X8Uiwk4w77MDc1D4yejjWtykPS3DX01UDCY/GPQcVDe0QYT0CIxGFvUorfvBxZsRfVrUuWruMBAb/lXCUofoFNZfzGJtowXOX0vwUSFK4BgyMKm6P6s9wQUZld+jrYyMDC0iIQDaJdG4IyZQfL3RfbFcCBIlRgc+u3CjaTApuZ9KsANgG8PNzHlWWD3tCxd6kafNNiFp5HAalAkkJ0SCV2H3CgOD9Nc/FqrXuyb0Eocvfhq171p5eyuJ1omKJEP5rQGe/FOOnXtq335z8YmvYo9cHb2t8spIb3lVSseZW46FlGY/Sk9P50P2w20UlWJUkUHIushfc5PXGAzCo0PlD2pnpCYfCXga3lu+fPlevEhWrVrFyrN/Orfv87FOW9tlqb2Kc9pV8DzioMk3UNUbXM+8B/ATBr8C8CKdvGXWGD/9sqm3dkxtzA4McMjHMB8D2ftheYXo+qzt3pXvz8/PP/vk+v8537V+yYW87Zu+RZ1ZbrexoKAA/SBpaWn4+aL5w5zGk+/jW59JiMkESW5urpiVlWXENRb1H/Yf2I9txIxz5IdkX3TsraukpsbQjz6090yb4XsAvQoRE0YvJdamtIIbOnRoUVlZ2ftsLVQzIdEXHntsaZdimssVfCpFui109+BnWPsXaWLI/zactygAAAAASUVORK5CYII=\"),define(\"text!cockpit/ui/images/plus.png\",[],\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAOCAYAAAAfSC3RAAAAAXNSR0IArs4c6QAAAAZiS0dEANIA0gDS7KbF4AAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFGw4yFTwuJTkAAAH7SURBVCjPdZKxa1NRFMZ/956XZMgFyyMlCZRA4hBx6lBcQ00GoYi4tEstFPwLAs7iLDi7FWuHThaUggihBDI5OWRoQAmBQFISQgvvpbwX3rsOaR4K+o2H8zvfOZxPWWtZqVarGaAJPAEe3ZW/A1+Bd+1221v1qhW4vb1dA44mk0nZ8zyCIAAgk8lgjGF9fb0PHF5cXLQTsF6vP/c879P19TVBEJDJZBARAKIoSmpra2sYY561Wq3PqtFouMBgMBgYay3ZbJZ/yfd9tNaUSqUboOKISPPq6sqsVvZ9H4AvL34B8PTj/QSO45jpdHovn883Ha31znw+JwzDpCEMQx4UloM8zyOdTif3zudztNY7jog8DMMQpRRxHPPt5TCBAEZvxlyOFTsfykRRBICIlB2t9a21Nh3HMXEc8+d7VhJHWCwWyzcohdZaHBHpO46z6fs+IsLj94XECaD4unCHL8FsNouI/HRE5Nx13c3ZbIbWOnG5HKtl+53TSq7rIiLnand31wUGnU7HjEYjlFLJZN/3yRnL1FMYY8jlcmxtbd0AFel2u7dnZ2eXxpi9xWJBEASkUimstYgIQSSkUimKxSKVSgVjzN7p6emPJHL7+/s14KjX65WHwyGz2SxZbWNjg2q12gcOT05O2n9lFeDg4MAAr/4T8rfHx8dJyH8DvvbYGzKvWukAAAAASUVORK5CYII=\"),define(\"text!cockpit/ui/images/throbber.gif\",[],\"data:image/gif;base64,R0lGODlh3AATAPQAAP///wAAAL6+vqamppycnLi4uLKyssjIyNjY2MTExNTU1Nzc3ODg4OTk5LCwsLy8vOjo6Ozs7MrKyvLy8vT09M7Ozvb29sbGxtDQ0O7u7tbW1sLCwqqqqvj4+KCgoJaWliH/C05FVFNDQVBFMi4wAwEAAAAh/hpDcmVhdGVkIHdpdGggYWpheGxvYWQuaW5mbwAh+QQJCgAAACwAAAAA3AATAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgECAaEpHLJbDqf0Kh0Sq1ar9isdjoQtAQFg8PwKIMHnLF63N2438f0mv1I2O8buXjvaOPtaHx7fn96goR4hmuId4qDdX95c4+RG4GCBoyAjpmQhZN0YGYFXitdZBIVGAoKoq4CG6Qaswi1CBtkcG6ytrYJubq8vbfAcMK9v7q7D8O1ycrHvsW6zcTKsczNz8HZw9vG3cjTsMIYqQgDLAQGCQoLDA0QCwUHqfYSFw/xEPz88/X38Onr14+Bp4ADCco7eC8hQYMAEe57yNCew4IVBU7EGNDiRn8Z831cGLHhSIgdE/9chIeBgDoB7gjaWUWTlYAFE3LqzDCTlc9WOHfm7PkTqNCh54rePDqB6M+lR536hCpUqs2gVZM+xbrTqtGoWqdy1emValeXKwgcWABB5y1acFNZmEvXwoJ2cGfJrTv3bl69Ffj2xZt3L1+/fw3XRVw4sGDGcR0fJhxZsF3KtBTThZxZ8mLMgC3fRatCLYMIFCzwLEprg84OsDus/tvqdezZf13Hvr2B9Szdu2X3pg18N+68xXn7rh1c+PLksI/Dhe6cuO3ow3NfV92bdArTqC2Ebc3A8vjf5QWf15Bg7Nz17c2fj69+fnq+8N2Lty+fuP78/eV2X13neIcCeBRwxorbZrAxAJoCDHbgoG8RTshahQ9iSKEEzUmYIYfNWViUhheCGJyIP5E4oom7WWjgCeBBAJNv1DVV01MZdJhhjdkplWNzO/5oXI846njjVEIqR2OS2B1pE5PVscajkxhMycqLJgxQCwT40PjfAV4GqNSXYdZXJn5gSkmmmmJu1aZYb14V51do+pTOCmA00AqVB4hG5IJ9PvYnhIFOxmdqhpaI6GeHCtpooisuutmg+Eg62KOMKuqoTaXgicQWoIYq6qiklmoqFV0UoeqqrLbq6quwxirrrLTWauutJ4QAACH5BAkKAAAALAAAAADcABMAAAX/ICCOZGmeaKqubOu+cCzPdG3feK7vfO//wKBwSAQIBoSkcslsOp/QqHRKrVqv2Kx2OhC0BAXHx/EoCzboAcdhcLDdgwJ6nua03YZ8PMFPoBMca215eg98G36IgYNvDgOGh4lqjHd7fXOTjYV9nItvhJaIfYF4jXuIf4CCbHmOBZySdoOtj5eja59wBmYFXitdHhwSFRgKxhobBgUPAmdoyxoI0tPJaM5+u9PaCQZzZ9gP2tPcdM7L4tLVznPn6OQb18nh6NV0fu3i5OvP8/nd1qjwaasHcIPAcf/gBSyAAMMwBANYEAhWYQGDBhAyLihwYJiEjx8fYMxIcsGDAxVA/yYIOZIkBAaGPIK8INJlRpgrPeasaRPmx5QgJfB0abLjz50tSeIM+pFmUo0nQQIV+vRlTJUSnNq0KlXCSq09ozIFexEBAYkeNiwgOaEtn2LFpGEQsKCtXbcSjOmVlqDuhAx3+eg1Jo3u37sZBA9GoMAw4MB5FyMwfLht4sh7G/utPGHlYAV8Nz9OnOBz4c2VFWem/Pivar0aKCP2LFn2XwhnVxBwsPbuBAQbEGiIFg1BggoWkidva5z4cL7IlStfkED48OIYoiufYIH68+cKPkqfnsB58ePjmZd3Dj199/XE20tv6/27XO3S6z9nPCz9BP3FISDefL/Bt192/uWmAv8BFzAQAQUWWFaaBgqA11hbHWTIXWIVXifNhRlq6FqF1sm1QQYhdiAhbNEYc2KKK1pXnAIvhrjhBh0KxxiINlqQAY4UXjdcjSJyeAx2G2BYJJD7NZQkjCPKuCORKnbAIXsuKhlhBxEomAIBBzgIYXIfHfmhAAyMR2ZkHk62gJoWlNlhi33ZJZ2cQiKTJoG05Wjcm3xith9dcOK5X51tLRenoHTuud2iMnaolp3KGXrdBo7eKYF5p/mXgJcogClmcgzAR5gCKymXYqlCgmacdhp2UCqL96mq4nuDBTmgBasaCFp4sHaQHHUsGvNRiiGyep1exyIra2mS7dprrtA5++z/Z8ZKYGuGsy6GqgTIDvupRGE+6CO0x3xI5Y2mOTkBjD4ySeGU79o44mcaSEClhglgsKyJ9S5ZTGY0Bnzrj+3SiKK9Rh5zjAALCywZBk/ayCWO3hYM5Y8Dn6qxxRFsgAGoJwwgDQRtYXAAragyQOmaLKNZKGaEuUlpyiub+ad/KtPqpntypvvnzR30DBtjMhNodK6Eqrl0zU0/GjTUgG43wdN6Ra2pAhGtAAZGE5Ta8TH6wknd2IytNKaiZ+Or79oR/tcvthIcAPe7DGAs9Edwk6r3qWoTaNzY2fb9HuHh2S343Hs1VIHhYtOt+Hh551rh24vP5YvXSGzh+eeghy76GuikU9FFEainrvrqrLfu+uuwxy777LTXfkIIACH5BAkKAAAALAAAAADcABMAAAX/ICCOZGmeaKqubOu+cCzPdG3feK7vfO//wKBwSAQIBoSkcslsOp/QqHRKrVqv2Kx2OhC0BAWHB2l4CDZo9IDjcBja7UEhTV+3DXi3PJFA8xMcbHiDBgMPG31pgHBvg4Z9iYiBjYx7kWocb26OD398mI2EhoiegJlud4UFiZ5sm6Kdn2mBr5t7pJ9rlG0cHg5gXitdaxwFGArIGgoaGwYCZ3QFDwjU1AoIzdCQzdPV1c0bZ9vS3tUJBmjQaGXl1OB0feze1+faiBvk8wjnimn55e/o4OtWjp+4NPIKogsXjaA3g/fiGZBQAcEAFgQGOChgYEEDCCBBLihwQILJkxIe/3wMKfJBSQkJYJpUyRIkgwcVUJq8QLPmTYoyY6ZcyfJmTp08iYZc8MBkhZgxk9aEcPOlzp5FmwI9KdWn1qASurJkClRoWKwhq6IUqpJBAwQEMBYroAHkhLt3+RyzhgCDgAV48Wbgg+waAnoLMgTOm6DwQ8CLBzdGdvjw38V5JTg2lzhyTMeUEwBWHPgzZc4TSOM1bZia6LuqJxCmnOxv7NSsl1mGHHiw5tOuIWeAEHcFATwJME/ApgFBc3MVLEgPvE+Ddb4JokufPmFBAuvPXWu3MIF89wTOmxvOvp179evQtwf2nr6aApPyzVd3jn089e/8xdfeXe/xdZ9/d1ngHf98lbHH3V0LMrgPgsWpcFwBEFBgHmyNXWeYAgLc1UF5sG2wTHjIhNjBiIKZCN81GGyQwYq9uajeMiBOQGOLJ1KjTI40kmfBYNfc2NcGIpI4pI0vyrhjiT1WFqOOLEIZnjVOVpmajYfBiCSNLGbA5YdOkjdihSkQwIEEEWg4nQUmvYhYe+bFKaFodN5lp3rKvJYfnBKAJ+gGDMi3mmbwWYfng7IheuWihu5p32XcSWdSj+stkF95dp64jJ+RBipocHkCCp6PCiRQ6INookCAAwy0yd2CtNET3Yo7RvihBjFZAOaKDHT43DL4BQnsZMo8xx6uI1oQrHXXhHZrB28G62n/YSYxi+uzP2IrgbbHbiaer7hCiOxDFWhrbmGnLVuus5NFexhFuHLX6gkEECorlLpZo0CWJG4pLjIACykmBsp0eSSVeC15TDJeUhlkowlL+SWLNJpW2WEF87urXzNWSZ6JOEb7b8g1brZMjCg3ezBtWKKc4MvyEtwybPeaMAA1ECRoAQYHYLpbeYYCLfQ+mtL5c9CnfQpYpUtHOSejEgT9ogZ/GSqd0f2m+LR5WzOtHqlQX1pYwpC+WbXKqSYtpJ5Mt4a01lGzS3akF60AxkcTaLgAyRBPWCoDgHfJqwRuBuzdw/1ml3iCwTIeLUWJN0v4McMe7uasCTxseNWPSxc5RbvIgD7geZLbGrqCG3jepUmbbze63Y6fvjiOylbwOITPfIHEFsAHL/zwxBdvPBVdFKH88sw37/zz0Ecv/fTUV2/99SeEAAAh+QQJCgAAACwAAAAA3AATAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgECAaEpHLJbDqf0Kh0Sq1ar9isdjoQtAQFh2cw8BQEm3T6yHEYHHD4oKCuD9qGvNsxT6QTgAkcHHmFeX11fm17hXwPG35qgnhxbwMPkXaLhgZ9gWp3bpyegX4DcG+inY+Qn6eclpiZkHh6epetgLSUcBxlD2csXXdvBQrHGgoaGhsGaIkFDwjTCArTzX+QadHU3c1ofpHc3dcGG89/4+TYktvS1NYI7OHu3fEJ5tpqBu/k+HX7+nXDB06SuoHm0KXhR65cQT8P3FRAMIAFgVMPwDCAwLHjggIHJIgceeFBg44eC/+ITCCBZYKSJ1FCWPBgpE2YMmc+qNCypwScMmnaXAkUJYOaFVyKLOqx5tCXJnMelcBzJNSYKIX2ZPkzqsyjPLku9Zr1QciVErYxaICAgEUOBRJIgzChbt0MLOPFwyBggV27eCUcmxZvg9+/dfPGo5bg8N/Ag61ZM4w4seDF1fpWhizZmoa+GSortgcaMWd/fkP/HY0MgWbTipVV++wY8GhvqSG4XUEgoYTKE+Qh0OCvggULiBckWEZ4Ggbjx5HXVc58IPQJ0idQJ66XanTpFraTe348+XLizRNcz658eHMN3rNPT+C+G/nodqk3t6a+fN3j+u0Xn3nVTQPfdRPspkL/b+dEIN8EeMm2GAYbTNABdrbJ1hyFFv5lQYTodSZABhc+loCEyhxTYYkZopdMMiNeiBxyIFajV4wYHpfBBspUl8yKHu6ooV5APsZjQxyyeNeJ3N1IYod38cgdPBUid6GCKfRWgAYU4IccSyHew8B3doGJHmMLkGkZcynKk2Z50Ym0zJzLbDCmfBbI6eIyCdyJmJmoqZmnBAXy9+Z/yOlZDZpwYihnj7IZpuYEevrYJ5mJEuqiof4l+NYDEXQpXQcMnNjZNDx1oGqJ4S2nF3EsqWrhqqVWl6JIslpAK5MaIqDeqjJq56qN1aTaQaPbHTPYr8Be6Gsyyh6Da7OkmmqP/7GyztdrNVQBm5+pgw3X7aoYKhfZosb6hyUKBHCgQKij1rghkOAJuZg1SeYIIY+nIpDvf/sqm4yNG5CY64f87qdAwSXKGqFkhPH1ZHb2EgYtw3bpKGVkPz5pJAav+gukjB1UHE/HLNJobWcSX8jiuicMMBFd2OmKwQFs2tjXpDfnPE1j30V3c7iRHlrzBD2HONzODyZtsQJMI4r0AUNaE3XNHQw95c9GC001MpIxDacFQ+ulTNTZlU3O1eWVHa6vb/pnQUUrgHHSBKIuwG+bCPyEqbAg25gMVV1iOB/IGh5YOKLKIQ6xBAcUHmzjIcIqgajZ+Ro42DcvXl7j0U4WOUd+2IGu7DWjI1pt4DYq8BPm0entuGSQY/4tBi9Ss0HqfwngBQtHbCH88MQXb/zxyFfRRRHMN+/889BHL/301Fdv/fXYZ39CCAAh+QQJCgAAACwAAAAA3AATAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv/8CgcEgECAaEpHLJbDqf0Kh0Sq1ar9isdjoQtAQFh2fAKXsKm7R6Q+Y43vABep0mGwwOPH7w2CT+gHZ3d3lyagl+CQNvg4yGh36LcHoGfHR/ZYOElQ9/a4ocmoRygIiRk5p8pYmZjXePaYBujHoOqp5qZHBlHAUFXitddg8PBg8KGsgayxvGkAkFDwgICtPTzX2mftHW3QnOpojG3dbYkNjk1waxsdDS1N7ga9zw1t/aifTk35fu6Qj3numL14fOuHTNECHqU4DDgQEsCCwidiHBAwYQMmpcUOCAhI8gJVzUuLGThAQnP/9abEAyI4MCIVOKZNnyJUqUJxNcGNlywYOQgHZirGkSJ8gHNEky+AkS58qWEJYC/bMzacmbQHkqNdlUJ1KoSz2i9COhmQYCEXtVrCBgwYS3cCf8qTcNQ9u4cFFOq2bPLV65Cf7dxZthbjW+CgbjnWtNgWPFcAsHdoxgWWK/iyV045sAc2S96SDn1exYw17REwpLQEYt2eW/qtPZRQAB7QoC61RW+GsBwYZ/CXb/XRCYLsAKFizEtUAc+G7lcZsjroscOvTmsoUvx15PwccJ0N8yL17N9PG/E7jv9S4hOV7pdIPDdZ+ePDzv2qMXn2b5+wTbKuAWnF3oZbABZY0lVmD/ApQd9thybxno2GGuCVDggaUpoyBsB1bGGgIYbJCBcuFJiOAyGohIInQSmmdeiBnMF2GHfNUlIoc1rncjYRjW6NgGf3VQGILWwNjBfxEZcAFbC7gHXQcfUYOYdwzQNxo5yUhQZXhvRYlMeVSuSOJHKJa5AQMQThBlZWZ6Bp4Fa1qzTAJbijcBlJrtxeaZ4lnnpZwpukWieGQmYx5ATXIplwTL8DdNZ07CtWYybNIJF4Ap4NZHe0920AEDk035kafieQrqXofK5ympn5JHKYjPrfoWcR8WWQGp4Ul32KPVgXdnqxM6OKqspjIYrGPDrlrsZtRIcOuR86nHFwbPvmes/6PH4frrqbvySh+mKGhaAARPzjjdhCramdoGGOhp44i+zogBkSDuWC5KlE4r4pHJkarXrj++Raq5iLmWLlxHBteavjG+6amJrUkJJI4Ro5sBv9AaOK+jAau77sbH7nspCwNIYIACffL7J4JtWQnen421nNzMcB6AqpRa9klonmBSiR4GNi+cJZpvwgX0ejj71W9yR+eIgaVvQgf0l/A8nWjUFhwtZYWC4hVnkZ3p/PJqNQ5NnwUQrQCGBBBMQIGTtL7abK+5JjAv1fi9bS0GLlJHgdjEgYzzARTwC1fgEWdJuKKBZzj331Y23qB3i9v5aY/rSUC4w7PaLeWXmr9NszMFoN79eeiM232o33EJAIzaSGwh++y012777bhT0UURvPfu++/ABy/88MQXb/zxyCd/QggAIfkECQoAAAAsAAAAANwAEwAABf8gII5kaZ5oqq5s675wLM90bd94ru987//AoHBIBAgGhKRyyWw6n9CodEqtWq/YrHY6ELQEBY5nwCk7xIWNer0hO95wziC9Ttg5b4ND/+Y87IBqZAaEe29zGwmJigmDfHoGiImTjXiQhJEPdYyWhXwDmpuVmHwOoHZqjI6kZ3+MqhyemJKAdo6Ge3OKbEd4ZRwFBV4rc4MPrgYPChrMzAgbyZSJBcoI1tfQoYsJydfe2amT3d7W0OGp1OTl0YtqyQrq0Lt11PDk3KGoG+nxBpvTD9QhwCctm0BzbOyMIwdOUwEDEgawIOCB2oMLgB4wgMCx44IHBySIHClBY0ePfyT/JCB5weRJCAwejFw58kGDlzBTqqTZcuPLmCIBiWx58+VHmiRLFj0JVCVLl0xl7qSZwCbOo0lFWv0pdefQrVFDJtr5gMBEYBgxqBWwYILbtxPsqMPAFu7blfa81bUbN4HAvXAzyLWnoDBguHIRFF6m4LBbwQngMYPXuC3fldbyPrMcGLM3w5wRS1iWWUNlvnElKDZtz/EEwaqvYahQoexEfyILi4RrYYKFZwJ3810QWZ2ECrx9Ew+O3K6F5Yq9zXbb+y30a7olJJ+wnLC16W97Py+uwdtx1NcLWzs/3G9e07stVPc9kHJ0BcLtQp+c3ewKAgYkUAFpCaAmmHqKLSYA/18WHEiZPRhsQF1nlLFWmIR8ZbDBYs0YZuCGpGXWmG92aWiPMwhEOOEEHXRwIALlwXjhio+BeE15IzpnInaLbZBBhhti9x2GbnVQo2Y9ZuCfCgBeMCB+DJDIolt4iVhOaNSJdCOBUfIlkmkyMpPAAvKJ59aXzTQzJo0WoJnmQF36Jp6W1qC4gWW9GZladCiyJd+KnsHImgRRVjfnaDEKuiZvbcYWo5htzefbl5LFWNeSKQAo1QXasdhiiwwUl2B21H3aQaghXnPcp1NagCqYslXAqnV+zYWcpNwVp9l5eepJnHqL4SdBi56CGlmw2Zn6aaiZjZqfb8Y2m+Cz1O0n3f+tnvrGbF6kToApCgAWoNWPeh754JA0vmajiAr4iOuOW7abQXVGNriBWoRdOK8FxNqLwX3oluubhv8yluRbegqGb536ykesuoXhyJqPQJIGbLvQhkcwjKs1zBvBwSZIsbcsDCCBAAf4ya+UEhyQoIiEJtfoZ7oxUOafE2BwgMWMqUydfC1LVtiArk0QtGkWEopzlqM9aJrKHfw5c6wKjFkmXDrbhwFockodtMGFLWpXy9JdiXN1ZDNszV4WSLQCGBKoQYHUyonqrHa4ErewAgMmcAAF7f2baIoVzC2p3gUvJtLcvIWqloy6/R04mIpLwDhciI8qLOB5yud44pHPLbA83hFDWPjNbuk9KnySN57Av+TMBvgEAgzzNhJb5K777rz37vvvVHRRxPDEF2/88cgnr/zyzDfv/PPQnxACACH5BAkKAAAALAAAAADcABMAAAX/ICCOZGmeaKqubOu+cCzPdG3feK7vfO//wKBwSAQIBoSkcslsOp/QqHRKrVqv2Kx2OhC0BIUCwcMpO84OT2HDbm8GHLQjnn6wE3g83SA3DB55G3llfHxnfnZ4gglvew6Gf4ySgmYGlpCJknochWiId3kJcZZyDn93i6KPl4eniopwq6SIoZKxhpenbhtHZRxhXisDopwPgHkGDxrLGgjLG8mC0gkFDwjX2AgJ0bXJ2djbgNJsAtbfCNB2oOnn6MmKbeXt226K1fMGi6j359D69ua+QZskjd+3cOvY9XNgp4ABCQNYEDBl7EIeCQkeMIDAseOCBwckiBSZ4ILGjh4B/40kaXIjSggMHmBcifHky5gYE6zM2OAlzGM6Z5rs+fIjTZ0tfcYMSlLCUJ8fL47kCVXmTjwPiKJkUCDnyqc3CxzQmYeAxAEGLGJYiwCDgAUT4sqdgOebArdw507IUNfuW71xdZ7DC5iuhGsKErf9CxhPYgUaEhPWyzfBMgUIJDPW6zhb5M1y+R5GjFkBaLmCM0dOfHqvztXYJnMejaFCBQlmVxAYsEGkYnQV4lqYMNyCtnYSggNekAC58uJxmTufW5w55mwKkg+nLp105uTC53a/nhg88fMTmDfDVl65Xum/IZt/3/zaag3a5W63nll1dvfiWbaaZLmpQIABCVQA2f9lAhTG112PQWYadXE9+FtmEwKWwQYQJrZagxomsOCAGVImInsSbpCBhhwug6KKcXXQQYUcYuDMggrASFmNzjjzzIrh7cUhhhHqONeGpSEW2QYxHsmjhxpgUGAKB16g4IIbMNCkXMlhaJ8GWVJo2I3NyKclYF1GxgyYDEAnXHJrMpNAm/rFBSczPiYAlwXF8ZnmesvoOdyMbx7m4o0S5LWdn4bex2Z4xYmEzaEb5EUcnxbA+WWglqIn6aHPTInCgVbdlZyMqMrIQHMRSiaBBakS1903p04w434n0loBoQFOt1yu2YAnY68RXiNsqh2s2qqxuyKb7Imtmgcrqsp6h8D/fMSpapldx55nwayK/SfqCQd2hcFdAgDp5GMvqhvakF4mZuS710WGIYy30khekRkMu92GNu6bo7r/ttjqwLaua5+HOdrKq5Cl3dcwi+xKiLBwwwom4b0E6xvuYyqOa8IAEghwQAV45VvovpkxBl2mo0W7AKbCZXoAhgMmWnOkEqx2JX5nUufbgJHpXCfMOGu2QAd8eitpW1eaNrNeMGN27mNz0swziYnpSbXN19gYtstzfXrdYjNHtAIYGFVwwAEvR1dfxdjKxVzAP0twAAW/ir2w3nzTd3W4yQWO3t0DfleB4XYnEHCEhffdKgaA29p0eo4fHLng9qoG+OVyXz0gMeWGY7qq3xhiRIEAwayNxBawxy777LTXbjsVXRSh++689+7778AHL/zwxBdv/PEnhAAAIfkECQoAAAAsAAAAANwAEwAABf8gII5kaZ5oqq5s675wLM90bd94ru987//AoHBIBAgGhKRyyWw6n9CodEqtWq/YrHY6ELQEhYLD4BlwHGg0ubBpuzdm9Dk9eCTu+MTZkDb4PXYbeIIcHHxqf4F3gnqGY2kOdQmCjHCGfpCSjHhmh2N+knmEkJmKg3uHfgaaeY2qn6t2i4t7sKAPbwIJD2VhXisDCQZgDrKDBQ8aGgjKyhvDlJMJyAjV1gjCunkP1NfVwpRtk93e2ZVt5NfCk27jD97f0LPP7/Dr4pTp1veLgvrx7AL+Q/BM25uBegoYkDCABYFhEobhkUBRwoMGEDJqXPDgQMUEFC9c1LjxQUUJICX/iMRIEgIDkycrjmzJMSXFlDNJvkwJsmdOjQwKfDz5M+PLoSGLQqgZU6XSoB/voHxawGbFlS2XGktAwKEADB0xiEWAodqGBRPSqp1wx5qCamDRrp2Qoa3bagLkzrULF4GCvHPTglRAmKxZvWsHayBcliDitHUlvGWM97FgCdYWVw4c2e/kw4HZJlCwmDBhwHPrjraGYTHqtaoxVKggoesKAgd2SX5rbUMFCxOAC8cGDwHFwBYWJCgu4XfwtcqZV0grPHj0u2SnqwU+IXph3rK5b1fOu7Bx5+K7L6/2/Xhg8uyXnQ8dvfRiDe7TwyfNuzlybKYpgIFtKhAgwEKkKcOf/wChZbBBgMucRh1so5XH3wbI1WXafRJy9iCErmX4IWHNaIAhZ6uxBxeGHXQA24P3yYfBBhmgSBozESpwongWOBhggn/N1aKG8a1YY2oVAklgCgQUUwGJ8iXAgItrWUARbwpqIOWEal0ZoYJbzmWlZCWSlsAC6VkwZonNbMAAl5cpg+NiZwpnJ0Xylegmlc+tWY1mjnGnZnB4QukMA9UJRxGOf5r4ppqDjjmnfKilh2ejGiyJAgF1XNmYbC2GmhZ5AcJVgajcXecNqM9Rx8B6bingnlotviqdkB3YCg+rtOaapFsUhSrsq6axJ6sEwoZK7I/HWpCsr57FBxJ1w8LqV/81zbkoXK3LfVeNpic0KRQG4NHoIW/XEmZuaiN6tti62/moWbk18uhjqerWS6GFpe2YVotskVssWfBOAHACrZHoWcGQwQhlvmsdXBZ/F9YLMF2jzUuYBP4a7CLCnoEHrgkDSCDAARUILAGaVVqAwQHR8pZXomm9/ONhgjrbgc2lyYxmpIRK9uSNjrXs8gEbTrYyl2ryTJmsLCdKkWzFQl1lWlOXGmifal6p9VnbQfpyY2SZyXKVV7JmZkMrgIFSyrIeUJ2r7YKnXdivUg1kAgdQ8B7IzJjGsd9zKSdwyBL03WpwDGxwuOASEP5vriO2F3nLjQdIrpaRDxqcBdgIHGA74pKrZXiR2ZWuZt49m+o3pKMC3p4Av7SNxBa456777rz37jsVXRQh/PDEF2/88cgnr/zyzDfv/PMnhAAAIfkECQoAAAAsAAAAANwAEwAABf8gII5kaZ5oqq5s675wLM90bd94ru987//AoHBIBAgGhKRyyWw6n9CodEqtWq/YrHY6ELQEhYLDUPAMHGi0weEpbN7wI8cxTzsGj4R+n+DUxwaBeBt7hH1/gYIPhox+Y3Z3iwmGk36BkIN8egOIl3h8hBuOkAaZhQlna4BrpnyWa4mleZOFjrGKcXoFA2ReKwMJBgISDw6abwUPGggazc0bBqG0G8kI1tcIwZp51djW2nC03d7BjG8J49jl4cgP3t/RetLp1+vT6O7v5fKhAvnk0UKFogeP3zmCCIoZkDCABQFhChQYuKBHgkUJkxpA2MhxQYEDFhNcvPBAI8eNCx7/gMQYckPJkxsZPLhIM8FLmDJrYiRp8mTKkCwT8IQJwSPQkENhpgQpEunNkzlpWkwKdSbGihKocowqVSvKWQkIOBSgQOYFDBgQpI0oYMGEt3AzTLKm4BqGtnDjirxW95vbvG/nWlub8G9euRsiqqWLF/AEkRoiprX2wLDeDQgkW9PQGLDgyNc665WguK8C0XAnRY6oGPUEuRLsgk5g+a3cCxUqSBC7gsCBBXcVq6swwULx4hayvctGPK8FCwsSLE9A3Hje6NOrHzeOnW695sffRi/9HfDz7sIVSNB+XXrmugo0rHcM3X388o6jr44ceb51uNjF1xcC8zk3wXiS8aYC/wESaLABBs7ch0ECjr2WAGvLsLZBeHqVFl9kGxooV0T81TVhBo6NiOEyJ4p4IYnNRBQiYCN6x4wCG3ZAY2If8jXjYRcyk2FmG/5nXAY8wqhWAii+1YGOSGLoY4VRfqiAgikwmIeS1gjAgHkWYLQZf9m49V9gDWYWY5nmTYCRM2TS5pxxb8IZGV5nhplmhJyZadxzbrpnZ2d/6rnZgHIid5xIMDaDgJfbLdrgMkKW+Rygz1kEZz1mehabkBpgiQIByVikwGTqVfDkk2/Vxxqiqur4X3fksHccre8xlxerDLiHjQIVUAgXr77yFeyuOvYqXGbMrbrqBMqaFpFFzhL7qv9i1FX7ZLR0LUNdcc4e6Cus263KbV+inkAAHhJg0BeITR6WmHcaxhvXg/AJiKO9R77ILF1FwmVdAu6WBu+ZFua72mkZWMfqBElKu0G8rFZ5n4ATp5jkmvsOq+Nj7u63ZMMPv4bveyYy6fDH+C6brgnACHBABQUrkGirz2FwAHnM4Mmhzq9yijOrOi/MKabH6VwBiYwZdukEQAvILKTWXVq0ZvH5/CfUM7M29Zetthp1eht0eqkFYw8IKXKA6mzXfTeH7fZg9zW0AhgY0TwthUa6Ch9dBeIsbsFrYkRBfgTfiG0FhwMWnbsoq3cABUYOnu/ejU/A6uNeT8u4wMb1WnBCyJJTLjjnr8o3OeJrUcpc5oCiPqAEkz8tXuLkPeDL3Uhs4fvvwAcv/PDEU9FFEcgnr/zyzDfv/PPQRy/99NRXf0IIACH5BAkKAAAALAAAAADcABMAAAX/ICCOZGmeaKqubOu+cCzPdG3feK7vfO//wKBwSAQIBoSkcslsOp/QqHRKrVqv2Kx2OhC0BIWCw/AoDziOtCHt8BQ28PjmzK57Hom8fo42+P8DeAkbeYQcfX9+gYOFg4d1bIGEjQmPbICClI9/YwaLjHAJdJeKmZOViGtpn3qOqZineoeJgG8CeWUbBV4rAwkGAhIVGL97hGACGsrKCAgbBoTRhLvN1c3PepnU1s2/oZO6AtzdBoPf4eMI3tIJyOnF0YwFD+nY8e3z7+Xfefnj9uz8cVsXCh89axgk7BrAggAwBQsYIChwQILFixIeNIDAseOCBwcSXMy2sSPHjxJE/6a0eEGjSY4MQGK86PIlypUJEmYsaTKmyJ8JW/Ls6HMkzaEn8YwMWtPkx4pGd76E4DMPRqFTY860OGhogwYagBFoKEABA46DEGBAoEBB0AUT4sqdIFKBNbcC4M6dkEEk22oYFOTdG9fvWrtsBxM23MytYL17666t9phwXwlum2lIDHmuSA2IGyuOLOHv38qLMbdFjHruZbWgRXeOe1nC2BUEDiyAMMHZuwoTLAQX3nvDOAUW5Vogru434d4JnAsnPmFB9NBshQXfa9104+Rxl8e13rZxN+CEydtVsFkd+vDjE7C/q52wOvb4s7+faz025frbxefWbSoQIAEDEUCwgf9j7bUlwHN9ZVaegxDK1xYzFMJH24L5saXABhlYxiEzHoKoIV8LYqAMaw9aZqFmJUK4YHuNfRjiXhmk+NcyJgaIolvM8BhiBx3IleN8lH1IWAcRgkZgCgYiaBGJojGgHHFTgtagAFYSZhF7/qnTpY+faVlNAnqJN0EHWa6ozAZjBtgmmBokwMB01LW5jAZwbqfmlNips4B4eOqJgDJ2+imXRZpthuigeC6XZTWIxilXmRo8iYKBCwiWmWkJVEAkfB0w8KI1IvlIpKnOkVpqdB5+h96o8d3lFnijrgprjbfGRSt0lH0nAZG5vsprWxYRW6Suq4UWqrLEsspWg8Io6yv/q6EhK0Fw0GLbjKYn5CZYBYht1laPrnEY67kyrhYbuyceiR28Pso7bYwiXjihjWsWuWF5p/H765HmNoiur3RJsGKNG/jq748XMrwmjhwCfO6QD9v7LQsDxPTAMKsFpthyJCdkmgYiw0VdXF/Om9dyv7YMWGXTLYpZg5wNR11C78oW3p8HSGgul4qyrJppgllJHJZHn0Y0yUwDXCXUNquFZNLKyYXBAVZvxtAKYIQEsmPgDacr0tltO1y/DMwYpkgUpJfTasLGzd3cdCN3gN3UWRcY3epIEPevfq+3njBxq/kqBoGBduvea8f393zICS63ivRBTqgFpgaWZEIUULdcK+frIfAAL2AjscXqrLfu+uuwx05FF0XUbvvtuOeu++689+7778AHL/wJIQAAOwAAAAAAAAAAAA==\")"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-beautify.js",
    "content": "define(\"ace/ext/beautify\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\",\"ace/ext/beautify/php_rules\"],function(e,t,n){var r=e(\"ace/token_iterator\").TokenIterator,i=e(\"./beautify/php_rules\").transform;t.beautify=function(e){var t=new r(e,0,0),n=t.getCurrentToken(),s=e.$modeId.split(\"/\").pop(),o=i(t,s);e.doc.setValue(o)},t.commands=[{name:\"beautify\",exec:function(e){t.beautify(e.session)},bindKey:\"Ctrl-Shift-B\"}]}),define(\"ace/ext/beautify/php_rules\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"ace/token_iterator\").TokenIterator;t.newLines=[{type:\"support.php_tag\",value:\"<?php\"},{type:\"support.php_tag\",value:\"<?\"},{type:\"support.php_tag\",value:\"?>\"},{type:\"paren.lparen\",value:\"{\",indent:!0},{type:\"paren.rparen\",breakBefore:!0,value:\"}\",indent:!1},{type:\"paren.rparen\",breakBefore:!0,value:\"})\",indent:!1,dontBreak:!0},{type:\"comment\"},{type:\"text\",value:\";\"},{type:\"text\",value:\":\",context:\"php\"},{type:\"keyword\",value:\"case\",indent:!0,dontBreak:!0},{type:\"keyword\",value:\"default\",indent:!0,dontBreak:!0},{type:\"keyword\",value:\"break\",indent:!1,dontBreak:!0},{type:\"punctuation.doctype.end\",value:\">\"},{type:\"meta.tag.punctuation.end\",value:\">\"},{type:\"meta.tag.punctuation.begin\",value:\"<\",blockTag:!0,indent:!0,dontBreak:!0},{type:\"meta.tag.punctuation.begin\",value:\"</\",indent:!1,breakBefore:!0,dontBreak:!0},{type:\"punctuation.operator\",value:\";\"}],t.spaces=[{type:\"xml-pe\",prepend:!0},{type:\"entity.other.attribute-name\",prepend:!0},{type:\"storage.type\",value:\"var\",append:!0},{type:\"storage.type\",value:\"function\",append:!0},{type:\"keyword.operator\",value:\"=\"},{type:\"keyword\",value:\"as\",prepend:!0,append:!0},{type:\"keyword\",value:\"function\",append:!0},{type:\"support.function\",next:/[^\\(]/,append:!0},{type:\"keyword\",value:\"or\",append:!0,prepend:!0},{type:\"keyword\",value:\"and\",append:!0,prepend:!0},{type:\"keyword\",value:\"case\",append:!0},{type:\"keyword.operator\",value:\"||\",append:!0,prepend:!0},{type:\"keyword.operator\",value:\"&&\",append:!0,prepend:!0}],t.singleTags=[\"!doctype\",\"area\",\"base\",\"br\",\"hr\",\"input\",\"img\",\"link\",\"meta\"],t.transform=function(e,n,r){var i=e.getCurrentToken(),s=t.newLines,o=t.spaces,u=t.singleTags,a=\"\",f=0,l=!1,c,h,p={},d,v={},m=!1,g=\"\";while(i!==null){console.log(i);if(!i){i=e.stepForward();continue}i.type==\"support.php_tag\"&&i.value!=\"?>\"?r=\"php\":i.type==\"support.php_tag\"&&i.value==\"?>\"?r=\"html\":i.type==\"meta.tag.name.style\"&&r!=\"css\"?r=\"css\":i.type==\"meta.tag.name.style\"&&r==\"css\"?r=\"html\":i.type==\"meta.tag.name.script\"&&r!=\"js\"?r=\"js\":i.type==\"meta.tag.name.script\"&&r==\"js\"&&(r=\"html\"),v=e.stepForward(),v&&v.type.indexOf(\"meta.tag.name\")==0&&(d=v.value),p.type==\"support.php_tag\"&&p.value==\"<?=\"&&(l=!0),i.type==\"meta.tag.name\"&&(i.value=i.value.toLowerCase()),i.type==\"text\"&&(i.value=i.value.trim());if(!i.value){i=v;continue}g=i.value;for(var y in o)i.type==o[y].type&&(!o[y].value||i.value==o[y].value)&&v&&(!o[y].next||o[y].next.test(v.value))&&(o[y].prepend&&(g=\" \"+i.value),o[y].append&&(g+=\" \"));i.type.indexOf(\"meta.tag.name\")==0&&(c=i.value),m=!1;for(y in s)if(i.type==s[y].type&&(!s[y].value||i.value==s[y].value)&&(!s[y].blockTag||u.indexOf(d)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!1&&f--;if(s[y].breakBefore&&(!s[y].prev||s[y].prev.test(p.value))){a+=\"\\n\",m=!0;for(y=0;y<f;y++)a+=\"\t\"}break}if(l===!1)for(y in s)if(p.type==s[y].type&&(!s[y].value||p.value==s[y].value)&&(!s[y].blockTag||u.indexOf(c)===-1)&&(!s[y].context||s[y].context===r)){s[y].indent===!0&&f++;if(!s[y].dontBreak&&!m){a+=\"\\n\";for(y=0;y<f;y++)a+=\"\t\"}break}a+=g,p.type==\"support.php_tag\"&&p.value==\"?>\"&&(l=!1),h=c,p=i,i=v;if(i===null)break}return a}}),function(){window.require([\"ace/ext/beautify\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-chromevox.js",
    "content": "define(\"ace/ext/chromevox\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/config\"],function(e,t,n){function gt(){return typeof cvox!=\"undefined\"&&cvox&&cvox.Api}function wt(e){if(gt())mt(e);else{yt++;if(yt>=bt)return;window.setTimeout(wt,500,e)}}var r={};r.SpeechProperty,r.Cursor,r.Token,r.Annotation;var i={rate:.8,pitch:.4,volume:.9},s={rate:1,pitch:.5,volume:.9},o={rate:.8,pitch:.8,volume:.9},u={rate:.8,pitch:.3,volume:.9},a={rate:.8,pitch:.7,volume:.9},f={rate:.8,pitch:.8,volume:.9},l={punctuationEcho:\"none\",relativePitch:-0.6},c=\"ALERT_NONMODAL\",h=\"ALERT_MODAL\",p=\"INVALID_KEYPRESS\",d=\"insertMode\",v=\"start\",m=[{substr:\";\",newSubstr:\" semicolon \"},{substr:\":\",newSubstr:\" colon \"}],g={SPEAK_ANNOT:\"annots\",SPEAK_ALL_ANNOTS:\"all_annots\",TOGGLE_LOCATION:\"toggle_location\",SPEAK_MODE:\"mode\",SPEAK_ROW_COL:\"row_col\",TOGGLE_DISPLACEMENT:\"toggle_displacement\",FOCUS_TEXT:\"focus_text\"},y=\"CONTROL + SHIFT \";r.editor=null;var b=null,w={},E=!1,S=!1,x=!1,T=null,N={},C={},k=function(e){return y+String.fromCharCode(e)},L=function(){var e=r.editor.keyBinding.getKeyboardHandler();return e.$id===\"ace/keyboard/vim\"},A=function(e){return r.editor.getSession().getTokenAt(e.row,e.column+1)},O=function(e){return r.editor.getSession().getLine(e.row)},M=function(e){w[e.row]&&cvox.Api.playEarcon(c),E?(cvox.Api.stop(),W(e),R(A(e)),I(e.row,1)):I(e.row,0)},_=function(e){var t=O(e),n=t.substr(e.column-1);e.column===0&&(n=\" \"+t);var r=/^\\W(\\w+)/,i=r.exec(n);return i!==null},D={constant:{prop:i},entity:{prop:o},keyword:{prop:u},storage:{prop:a},variable:{prop:f},meta:{prop:s,replace:[{substr:\"</\",newSubstr:\" closing tag \"},{substr:\"/>\",newSubstr:\" close tag \"},{substr:\"<\",newSubstr:\" tag start \"},{substr:\">\",newSubstr:\" tag end \"}]}},P={prop:P},H=function(e,t){var n=e;for(var r=0;r<t.length;r++){var i=t[r],s=new RegExp(i.substr,\"g\");n=n.replace(s,i.newSubstr)}return n},B=function(e,t,n){var r={};r.value=\"\",r.type=e[t].type;for(var i=t;i<n;i++)r.value+=e[i].value;return r},j=function(e){if(e.length<=1)return e;var t=[],n=0;for(var r=1;r<e.length;r++){var i=e[n],s=e[r];U(i)!==U(s)&&(t.push(B(e,n,r)),n=r)}return t.push(B(e,n,e.length)),t},F=function(e){var t=r.editor.getSession().getLine(e),n=/^\\s*$/;return n.exec(t)!==null},I=function(e,t){var n=r.editor.getSession().getTokens(e);if(n.length===0||F(e)){cvox.Api.playEarcon(\"EDITABLE_TEXT\");return}n=j(n);var i=n[0];n=n.filter(function(e){return e!==i}),z(i,t),n.forEach(R)},q=function(e){z(e,0)},R=function(e){z(e,1)},U=function(e){if(!e||!e.type)return;var t=e.type.split(\".\");if(t.length===0)return;var n=t[0],r=D[n];return r?r:P},z=function(e,t){var n=U(e),r=H(e.value,m);n.replace&&(r=H(r,n.replace)),cvox.Api.speak(r,t,n.prop)},W=function(e){var t=O(e);cvox.Api.speak(t[e.column],1)},X=function(e,t){var n=O(t),r=n.substring(e.column,t.column);r=r.replace(/ /g,\" space \"),cvox.Api.speak(r)},V=function(e,t){if(Math.abs(e.column-t.column)!==1){var n=O(t).length;if(t.column===0||t.column===n){I(t.row,0);return}if(_(t)){cvox.Api.stop(),R(A(t));return}}W(t)},$=function(e,t){r.editor.selection.isEmpty()?S?X(e,t):V(e,t):(X(e,t),cvox.Api.speak(\"selected\",1))},J=function(e){if(x){x=!1;return}var t=r.editor.selection.getCursor();t.row!==b.row?M(t):$(b,t),b=t},K=function(e){r.editor.selection.isEmpty()&&cvox.Api.speak(\"unselected\")},Q=function(e){var t=e.data;switch(t.action){case\"removeText\":cvox.Api.speak(t.text,0,l),x=!0;break;case\"insertText\":cvox.Api.speak(t.text,0),x=!0}},G=function(e){var t=e.row,n=e.column;return!w[t]||!w[t][n]},Y=function(e){w={};for(var t=0;t<e.length;t++){var n=e[t],r=n.row,i=n.column;w[r]||(w[r]={}),w[r][i]=n}},Z=function(e){var t=r.editor.getSession().getAnnotations(),n=t.filter(G);n.length>0&&cvox.Api.playEarcon(c),Y(t)},et=function(e){var t=e.type+\" \"+e.text+\" on \"+nt(e.row,e.column);t=t.replace(\";\",\"semicolon\"),cvox.Api.speak(t,1)},tt=function(e){var t=w[e];for(var n in t)et(t[n])},nt=function(e,t){return\"row \"+(e+1)+\" column \"+(t+1)},rt=function(){cvox.Api.speak(nt(b.row,b.column))},it=function(){for(var e in w)tt(e)},st=function(){if(!L())return;switch(r.editor.keyBinding.$data.state){case d:cvox.Api.speak(\"Insert mode\");break;case v:cvox.Api.speak(\"Command mode\")}},ot=function(){E=!E,E?cvox.Api.speak(\"Speak location on row change enabled.\"):cvox.Api.speak(\"Speak location on row change disabled.\")},ut=function(){S=!S,S?cvox.Api.speak(\"Speak displacement on column changes.\"):cvox.Api.speak(\"Speak current character or word on column changes.\")},at=function(e){if(e.ctrlKey&&e.shiftKey){var t=N[e.keyCode];t&&t.func()}},ft=function(e,t){if(!L())return;var n=t.keyBinding.$data.state;if(n===T)return;switch(n){case d:cvox.Api.playEarcon(h),cvox.Api.setKeyEcho(!0);break;case v:cvox.Api.playEarcon(h),cvox.Api.setKeyEcho(!1)}T=n},lt=function(e){var t=e.detail.customCommand,n=C[t];n&&(n.func(),r.editor.focus())},ct=function(){var e=dt.map(function(e){return{desc:e.desc+k(e.keyCode),cmd:e.cmd}}),t=document.querySelector(\"body\");t.setAttribute(\"contextMenuActions\",JSON.stringify(e)),t.addEventListener(\"ATCustomEvent\",lt,!0)},ht=function(e){e.match?I(b.row,0):cvox.Api.playEarcon(p)},pt=function(){r.editor.focus()},dt=[{keyCode:49,func:function(){tt(b.row)},cmd:g.SPEAK_ANNOT,desc:\"Speak annotations on line\"},{keyCode:50,func:it,cmd:g.SPEAK_ALL_ANNOTS,desc:\"Speak all annotations\"},{keyCode:51,func:st,cmd:g.SPEAK_MODE,desc:\"Speak Vim mode\"},{keyCode:52,func:ot,cmd:g.TOGGLE_LOCATION,desc:\"Toggle speak row location\"},{keyCode:53,func:rt,cmd:g.SPEAK_ROW_COL,desc:\"Speak row and column\"},{keyCode:54,func:ut,cmd:g.TOGGLE_DISPLACEMENT,desc:\"Toggle speak displacement\"},{keyCode:55,func:pt,cmd:g.FOCUS_TEXT,desc:\"Focus text\"}],vt=function(){r.editor=editor,editor.getSession().selection.on(\"changeCursor\",J),editor.getSession().selection.on(\"changeSelection\",K),editor.getSession().on(\"change\",Q),editor.getSession().on(\"changeAnnotation\",Z),editor.on(\"changeStatus\",ft),editor.on(\"findSearchBox\",ht),editor.container.addEventListener(\"keydown\",at),b=editor.selection.getCursor()},mt=function(e){vt(),dt.forEach(function(e){N[e.keyCode]=e,C[e.cmd]=e}),e.on(\"focus\",vt),L()&&cvox.Api.setKeyEcho(!1),ct()},yt=0,bt=15,Et=e(\"../editor\").Editor;e(\"../config\").defineOptions(Et.prototype,\"editor\",{enableChromevoxEnhancements:{set:function(e){e&&wt(this)},value:!0}})}),function(){window.require([\"ace/ext/chromevox\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-elastic_tabstops_lite.js",
    "content": "define(\"ace/ext/elastic_tabstops_lite\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/config\"],function(e,t,n){var r=function(e){this.$editor=e;var t=this,n=[],r=!1;this.onAfterExec=function(){r=!1,t.processRows(n),n=[]},this.onExec=function(){r=!0},this.onChange=function(e){var t=e.data.range;r&&(n.indexOf(t.start.row)==-1&&n.push(t.start.row),t.end.row!=t.start.row&&n.push(t.end.row))}};(function(){this.processRows=function(e){this.$inChange=!0;var t=[];for(var n=0,r=e.length;n<r;n++){var i=e[n];if(t.indexOf(i)>-1)continue;var s=this.$findCellWidthsForBlock(i),o=this.$setBlockCellWidthsToMax(s.cellWidths),u=s.firstRow;for(var a=0,f=o.length;a<f;a++){var l=o[a];t.push(u),this.$adjustRow(u,l),u++}}this.$inChange=!1},this.$findCellWidthsForBlock=function(e){var t=[],n,r=e;while(r>=0){n=this.$cellWidthsForRow(r);if(n.length==0)break;t.unshift(n),r--}var i=r+1;r=e;var s=this.$editor.session.getLength();while(r<s-1){r++,n=this.$cellWidthsForRow(r);if(n.length==0)break;t.push(n)}return{cellWidths:t,firstRow:i}},this.$cellWidthsForRow=function(e){var t=this.$selectionColumnsForRow(e),n=[-1].concat(this.$tabsForRow(e)),r=n.map(function(e){return 0}).slice(1),i=this.$editor.session.getLine(e);for(var s=0,o=n.length-1;s<o;s++){var u=n[s]+1,a=n[s+1],f=this.$rightmostSelectionInCell(t,a),l=i.substring(u,a);r[s]=Math.max(l.replace(/\\s+$/g,\"\").length,f-u)}return r},this.$selectionColumnsForRow=function(e){var t=[],n=this.$editor.getCursorPosition();return this.$editor.session.getSelection().isEmpty()&&e==n.row&&t.push(n.column),t},this.$setBlockCellWidthsToMax=function(e){var t=!0,n,r,i,s=this.$izip_longest(e);for(var o=0,u=s.length;o<u;o++){var a=s[o];if(!a.push){console.error(a);continue}a.push(NaN);for(var f=0,l=a.length;f<l;f++){var c=a[f];t&&(n=f,i=0,t=!1);if(isNaN(c)){r=f;for(var h=n;h<r;h++)e[h][o]=i;t=!0}i=Math.max(i,c)}}return e},this.$rightmostSelectionInCell=function(e,t){var n=0;if(e.length){var r=[];for(var i=0,s=e.length;i<s;i++)e[i]<=t?r.push(i):r.push(0);n=Math.max.apply(Math,r)}return n},this.$tabsForRow=function(e){var t=[],n=this.$editor.session.getLine(e),r=/\\t/g,i;while((i=r.exec(n))!=null)t.push(i.index);return t},this.$adjustRow=function(e,t){var n=this.$tabsForRow(e);if(n.length==0)return;var r=0,i=-1,s=this.$izip(t,n);for(var o=0,u=s.length;o<u;o++){var a=s[o][0],f=s[o][1];i+=1+a,f+=r;var l=i-f;if(l==0)continue;var c=this.$editor.session.getLine(e).substr(0,f),h=c.replace(/\\s*$/g,\"\"),p=c.length-h.length;l>0&&(this.$editor.session.getDocument().insertInLine({row:e,column:f+1},Array(l+1).join(\" \")+\"\t\"),this.$editor.session.getDocument().removeInLine(e,f,f+1),r+=l),l<0&&p>=-l&&(this.$editor.session.getDocument().removeInLine(e,f+l,f),r+=l)}},this.$izip_longest=function(e){if(!e[0])return[];var t=e[0].length,n=e.length;for(var r=1;r<n;r++){var i=e[r].length;i>t&&(t=i)}var s=[];for(var o=0;o<t;o++){var u=[];for(var r=0;r<n;r++)e[r][o]===\"\"?u.push(NaN):u.push(e[r][o]);s.push(u)}return s},this.$izip=function(e,t){var n=e.length>=t.length?t.length:e.length,r=[];for(var i=0;i<n;i++){var s=[e[i],t[i]];r.push(s)}return r}}).call(r.prototype),t.ElasticTabstopsLite=r;var i=e(\"../editor\").Editor;e(\"../config\").defineOptions(i.prototype,\"editor\",{useElasticTabstops:{set:function(e){e?(this.elasticTabstops||(this.elasticTabstops=new r(this)),this.commands.on(\"afterExec\",this.elasticTabstops.onAfterExec),this.commands.on(\"exec\",this.elasticTabstops.onExec),this.on(\"change\",this.elasticTabstops.onChange)):this.elasticTabstops&&(this.commands.removeListener(\"afterExec\",this.elasticTabstops.onAfterExec),this.commands.removeListener(\"exec\",this.elasticTabstops.onExec),this.removeListener(\"change\",this.elasticTabstops.onChange))}}})}),function(){window.require([\"ace/ext/elastic_tabstops_lite\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-emmet.js",
    "content": "define(\"ace/ext/emmet\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\",\"ace/editor\",\"ace/snippets\",\"ace/range\",\"ace/config\"],function(e,t,n){function a(){}var r=e(\"ace/keyboard/hash_handler\").HashHandler,i=e(\"ace/editor\").Editor,s=e(\"ace/snippets\").snippetManager,o=e(\"ace/range\").Range,u;i.prototype.indexToPosition=function(e){return this.session.doc.indexToPosition(e)},i.prototype.positionToIndex=function(e){return this.session.doc.positionToIndex(e)},a.prototype={setupContext:function(e){this.ace=e,this.indentation=e.session.getTabString(),u||(u=window.emmet),u.require(\"resources\").setVariable(\"indentation\",this.indentation),this.$syntax=null,this.$syntax=this.getSyntax()},getSelectionRange:function(){var e=this.ace.getSelectionRange();return{start:this.ace.positionToIndex(e.start),end:this.ace.positionToIndex(e.end)}},createSelection:function(e,t){this.ace.selection.setRange({start:this.ace.indexToPosition(e),end:this.ace.indexToPosition(t)})},getCurrentLineRange:function(){var e=this.ace.getCursorPosition().row,t=this.ace.session.getLine(e).length,n=this.ace.positionToIndex({row:e,column:0});return{start:n,end:n+t}},getCaretPos:function(){var e=this.ace.getCursorPosition();return this.ace.positionToIndex(e)},setCaretPos:function(e){var t=this.ace.indexToPosition(e);this.ace.selection.moveToPosition(t)},getCurrentLine:function(){var e=this.ace.getCursorPosition().row;return this.ace.session.getLine(e)},replaceContent:function(e,t,n,r){n==null&&(n=t==null?this.getContent().length:t),t==null&&(t=0);var i=this.ace,u=o.fromPoints(i.indexToPosition(t),i.indexToPosition(n));i.session.remove(u),u.end=u.start,e=this.$updateTabstops(e),s.insertSnippet(i,e)},getContent:function(){return this.ace.getValue()},getSyntax:function(){if(this.$syntax)return this.$syntax;var e=this.ace.session.$modeId.split(\"/\").pop();if(e==\"html\"||e==\"php\"){var t=this.ace.getCursorPosition(),n=this.ace.session.getState(t.row);typeof n!=\"string\"&&(n=n[0]),n&&(n=n.split(\"-\"),n.length>1?e=n[0]:e==\"php\"&&(e=\"html\"))}return e},getProfileName:function(){switch(this.getSyntax()){case\"css\":return\"css\";case\"xml\":case\"xsl\":return\"xml\";case\"html\":var e=u.require(\"resources\").getVariable(\"profile\");return e||(e=this.ace.session.getLines(0,2).join(\"\").search(/<!DOCTYPE[^>]+XHTML/i)!=-1?\"xhtml\":\"html\"),e}return\"xhtml\"},prompt:function(e){return prompt(e)},getSelection:function(){return this.ace.session.getTextRange()},getFilePath:function(){return\"\"},$updateTabstops:function(e){var t=1e3,n=0,r=null,i=u.require(\"range\"),s=u.require(\"tabStops\"),o=u.require(\"resources\").getVocabulary(\"user\"),a={tabstop:function(e){var o=parseInt(e.group,10),u=o===0;u?o=++n:o+=t;var f=e.placeholder;f&&(f=s.processText(f,a));var l=\"${\"+o+(f?\":\"+f:\"\")+\"}\";return u&&(r=i.create(e.start,l)),l},escape:function(e){return e==\"$\"?\"\\\\$\":e==\"\\\\\"?\"\\\\\\\\\":e}};return e=s.processText(e,a),o.variables.insert_final_tabstop&&!/\\$\\{0\\}$/.test(e)?e+=\"${0}\":r&&(e=u.require(\"utils\").replaceSubstring(e,\"${0}\",r)),e}};var f={expand_abbreviation:{mac:\"ctrl+alt+e\",win:\"alt+e\"},match_pair_outward:{mac:\"ctrl+d\",win:\"ctrl+,\"},match_pair_inward:{mac:\"ctrl+j\",win:\"ctrl+shift+0\"},matching_pair:{mac:\"ctrl+alt+j\",win:\"alt+j\"},next_edit_point:\"alt+right\",prev_edit_point:\"alt+left\",toggle_comment:{mac:\"command+/\",win:\"ctrl+/\"},split_join_tag:{mac:\"shift+command+'\",win:\"shift+ctrl+`\"},remove_tag:{mac:\"command+'\",win:\"shift+ctrl+;\"},evaluate_math_expression:{mac:\"shift+command+y\",win:\"shift+ctrl+y\"},increment_number_by_1:\"ctrl+up\",decrement_number_by_1:\"ctrl+down\",increment_number_by_01:\"alt+up\",decrement_number_by_01:\"alt+down\",increment_number_by_10:{mac:\"alt+command+up\",win:\"shift+alt+up\"},decrement_number_by_10:{mac:\"alt+command+down\",win:\"shift+alt+down\"},select_next_item:{mac:\"shift+command+.\",win:\"shift+ctrl+.\"},select_previous_item:{mac:\"shift+command+,\",win:\"shift+ctrl+,\"},reflect_css_value:{mac:\"shift+command+r\",win:\"shift+ctrl+r\"},encode_decode_data_url:{mac:\"shift+ctrl+d\",win:\"ctrl+'\"},expand_abbreviation_with_tab:\"Tab\",wrap_with_abbreviation:{mac:\"shift+ctrl+a\",win:\"shift+ctrl+a\"}},l=new a;t.commands=new r,t.runEmmetCommand=function(e){l.setupContext(e);if(l.getSyntax()==\"php\")return!1;var t=u.require(\"actions\");if(this.action==\"expand_abbreviation_with_tab\"&&!e.selection.isEmpty())return!1;if(this.action==\"wrap_with_abbreviation\")return setTimeout(function(){t.run(\"wrap_with_abbreviation\",l)},0);try{var n=t.run(this.action,l)}catch(r){e._signal(\"changeStatus\",typeof r==\"string\"?r:r.message),console.log(r),n=!1}return n};for(var c in f)t.commands.addCommand({name:\"emmet:\"+c,action:c,bindKey:f[c],exec:t.runEmmetCommand,multiSelectAction:\"forEach\"});var h=function(e,n){var r=n;if(!r)return;var i=r.session.$modeId,s=i&&/css|less|scss|sass|stylus|html|php/.test(i);e.enableEmmet===!1&&(s=!1),s?r.keyBinding.addKeyboardHandler(t.commands):r.keyBinding.removeKeyboardHandler(t.commands)};t.AceEmmetEditor=a,e(\"ace/config\").defineOptions(i.prototype,\"editor\",{enableEmmet:{set:function(e){this[e?\"on\":\"removeListener\"](\"changeMode\",h),h({enableEmmet:!!e},this)},value:!0}}),t.setCore=function(e){u=e}}),define(\"ace/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/lib/lang\",\"ace/range\",\"ace/anchor\",\"ace/keyboard/hash_handler\",\"ace/tokenizer\",\"ace/lib/dom\",\"ace/editor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./lib/lang\"),o=e(\"./range\").Range,u=e(\"./anchor\").Anchor,a=e(\"./keyboard/hash_handler\").HashHandler,f=e(\"./tokenizer\").Tokenizer,l=o.comparePoints,c=function(){this.snippetMap={},this.snippetNameMap={}};(function(){r.implement(this,i),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return\"(?:[^\\\\\\\\\"+e+\"]|\\\\\\\\.)\"}return c.$tokenizer=new f({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):\":\"}},{regex:/\\\\./,onMatch:function(e,t,n){var r=e[1];return r==\"}\"&&n.length?e=r:\"`$\\\\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r==\"n\"?e=\"\\n\":r==\"t\"?e=\"\\n\":\"ulULE\".indexOf(r)!=-1&&(e={changeCase:r,local:r>\"a\"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\\$(?:\\d+|\\w+)/,onMatch:e},{regex:/\\$\\{[\\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:\"snippetVar\"},{regex:/\\n/,token:\"newline\",merge:!1}],snippetVar:[{regex:\"\\\\|\"+t(\"\\\\|\")+\"*\\\\|\",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(\",\")},next:\"start\"},{regex:\"/(\"+t(\"/\")+\"+)/(?:(\"+t(\"/\")+\"*)/)(\\\\w*):?\",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],\"\"},next:\"start\"},{regex:\"`\"+t(\"`\")+\"*`\",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),\"\"},next:\"start\"},{regex:\"\\\\?\",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:\"start\"},{regex:\"([^:}\\\\\\\\]|\\\\\\\\.)*:?\",token:\"\",next:\"start\"}],formatString:[{regex:\"/(\"+t(\"/\")+\"+)/\",token:\"regex\"},{regex:\"\",onMatch:function(e,t,n){n.inFormatString=!0},next:\"start\"}]}),c.prototype.getTokenizer=function(){return c.$tokenizer},c.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+\"__\"]||{})[n]}if(/^\\d+$/.test(t))return(this.variables.__||{})[t];t=t.replace(/^TM_/,\"\");if(!e)return;var r=e.session;switch(t){case\"CURRENT_WORD\":var i=r.getWordRange();case\"SELECTION\":case\"SELECTED_TEXT\":return r.getTextRange(i);case\"CURRENT_LINE\":return r.getLine(e.getCursorPosition().row);case\"PREV_LINE\":return r.getLine(e.getCursorPosition().row-1);case\"LINE_INDEX\":return e.getCursorPosition().column;case\"LINE_NUMBER\":return e.getCursorPosition().row+1;case\"SOFT_TABS\":return r.getUseSoftTabs()?\"YES\":\"NO\";case\"TAB_SIZE\":return r.getTabSize();case\"FILENAME\":case\"FILEPATH\":return\"\";case\"FULLNAME\":return\"Ace\"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||\"\":this.$getDefaultValue(e,t)||\"\"},this.tmStrFormat=function(e,t,n){var r=t.flag||\"\",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,\"\"));var s=this.tokenizeTmSnippet(t.fmt,\"formatString\"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t=\"E\";for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"object\"){e[r]=\"\";if(i.changeCase&&i.local){var u=e[r+1];u&&typeof u==\"string\"&&(i.changeCase==\"u\"?e[r]=u[0].toUpperCase():e[r]=u[0].toLowerCase(),e[r+1]=u.substr(1))}else i.changeCase&&(t=i.changeCase)}else t==\"U\"?e[r]=i.toUpperCase():t==\"L\"&&(e[r]=i.toLowerCase())}return e.join(\"\")});return this.variables.__=null,u},this.resolveVariables=function(e,t){function o(t){var n=e.indexOf(t,r+1);n!=-1&&(r=n)}var n=[];for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"string\")n.push(i);else{if(typeof i!=\"object\")continue;if(i.skip)o(i);else{if(i.processed<r)continue;if(i.text){var s=this.getVariableValue(t,i.text);s&&i.fmtString&&(s=this.tmStrFormat(s,i)),i.processed=r,i.expectIf==null?s&&(n.push(s),o(i)):s?i.skip=i.elseBranch:o(i)}else i.tabstopId!=null?n.push(i):i.changeCase!=null&&n.push(i)}}}return n},this.insertSnippetForSelection=function(e,t){function f(e){var t=[];for(var n=0;n<e.length;n++){var r=e[n];if(typeof r==\"object\"){if(a[r.tabstopId])continue;var i=e.lastIndexOf(r,n-1);r=t[i]||{tabstopId:r.tabstopId}}t[n]=r}return t}var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=e.session.getTabString(),s=r.match(/^\\s*/)[0];n.column<s.length&&(s=s.slice(0,n.column));var o=this.tokenizeTmSnippet(t);o=this.resolveVariables(o,e),o=o.map(function(e){return e==\"\\n\"?e+s:typeof e==\"string\"?e.replace(/\\t/g,i):e});var u=[];o.forEach(function(e,t){if(typeof e!=\"object\")return;var n=e.tabstopId,r=u[n];r||(r=u[n]=[],r.index=n,r.value=\"\");if(r.indexOf(e)!==-1)return;r.push(e);var i=o.indexOf(e,t+1);if(i===-1)return;var s=o.slice(t+1,i),a=s.some(function(e){return typeof e==\"object\"});a&&!r.value?r.value=s:s.length&&(!r.value||typeof r.value!=\"string\")&&(r.value=s.join(\"\"))}),u.forEach(function(e){e.length=0});var a={};for(var l=0;l<o.length;l++){var c=o[l];if(typeof c!=\"object\")continue;var p=c.tabstopId,d=o.indexOf(c,l+1);if(a[p]){a[p]===c&&(a[p]=null);continue}var v=u[p],m=typeof v.value==\"string\"?[v.value]:f(v.value);m.unshift(l+1,Math.max(0,d-l)),m.push(c),a[p]=c,o.splice.apply(o,m),v.indexOf(c)===-1&&v.push(c)}var g=0,y=0,b=\"\";o.forEach(function(e){typeof e==\"string\"?(e[0]===\"\\n\"?(y=e.length-1,g++):y+=e.length,b+=e):e.start?e.end={row:g,column:y}:e.start={row:g,column:y}});var w=e.getSelectionRange(),E=e.session.replace(w,b),S=new h(e),x=e.inVirtualSelectionMode&&e.selection.index;S.addTabstops(u,w.start,E,x)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t=e.session.$mode.$id||\"\";t=t.split(\"/\").pop();if(t===\"html\"||t===\"php\"){t===\"php\"&&!e.session.$mode.inlinePhp&&(t=\"html\");var n=e.getCursorPosition(),r=e.session.getState(n.row);typeof r==\"object\"&&(r=r[0]),r.substring&&(r.substring(0,3)==\"js-\"?t=\"javascript\":r.substring(0,4)==\"css-\"?t=\"css\":r.substring(0,4)==\"php-\"&&(t=\"php\"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],r=this.snippetMap;return r[t]&&r[t].includeScopes&&n.push.apply(n,r[t].includeScopes),n.push(\"_\"),n},this.expandWithTab=function(e,t){var n=this,r=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return r&&e.tabstopManager&&e.tabstopManager.tabNext(),r},this.expandSnippetForSelection=function(e,t){var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=r.substring(0,n.column),s=r.substr(n.column),o=this.snippetMap,u;return this.getActiveScopes(e).some(function(e){var t=o[e];return t&&(u=this.findMatchingSnippet(t,i,s)),!!u},this),u?t&&t.dryRun?!0:(e.session.doc.removeInLine(n.row,n.column-u.replaceBefore.length,n.column+u.replaceAfter.length),this.variables.M__=u.matchBefore,this.variables.T__=u.matchAfter,this.insertSnippetForSelection(e,u.content),this.variables.M__=this.variables.T__=null,!0):!1},this.findMatchingSnippet=function(e,t,n){for(var r=e.length;r--;){var i=e[r];if(i.startRe&&!i.startRe.test(t))continue;if(i.endRe&&!i.endRe.test(n))continue;if(!i.startRe&&!i.endRe)continue;return i.matchBefore=i.startRe?i.startRe.exec(t):[\"\"],i.matchAfter=i.endRe?i.endRe.exec(n):[\"\"],i.replaceBefore=i.triggerRe?i.triggerRe.exec(t)[0]:\"\",i.replaceAfter=i.endTriggerRe?i.endTriggerRe.exec(n)[0]:\"\",i}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){function o(e){return e&&!/^\\^?\\(.*\\)\\$?$|^\\\\b$/.test(e)&&(e=\"(?:\"+e+\")\"),e||\"\"}function u(e,t,n){return e=o(e),t=o(t),n?(e=t+e,e&&e[e.length-1]!=\"$\"&&(e+=\"$\")):(e+=t,e&&e[0]!=\"^\"&&(e=\"^\"+e)),new RegExp(e)}function a(e){e.scope||(e.scope=t||\"_\"),t=e.scope,n[t]||(n[t]=[],r[t]={});var o=r[t];if(e.name){var a=o[e.name];a&&i.unregister(a),o[e.name]=e}n[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\\w/.test(e.tabTrigger)&&(e.guard=\"\\\\b\"),e.trigger=s.escapeRegExp(e.tabTrigger)),e.startRe=u(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,\"\",!0),e.endRe=u(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,\"\",!0)}var n=this.snippetMap,r=this.snippetNameMap,i=this;e.content?a(e):Array.isArray(e)&&e.forEach(a),this._signal(\"registerSnippets\",{scope:t})},this.unregister=function(e,t){function i(e){var i=r[e.scope||t];if(i&&i[e.name]){delete i[e.name];var s=n[e.scope||t],o=s&&s.indexOf(e);o>=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\\r/g,\"\");var t=[],n={},r=/^#.*|^({[\\s\\S]*})\\s*$|^(\\S+) (.*)$|^((?:\\n*\\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\\t/gm,\"\"),t.push(n),n={};else{var o=i[2],u=i[3];if(o==\"regex\"){var a=/\\/((?:[^\\/\\\\]|\\\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o==\"snippet\"?(n.tabTrigger=u.match(/^\\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,r;return this.getActiveScopes(t).some(function(t){var i=n[t];return i&&(r=i[e]),!!r},this),r}}).call(c.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on(\"change\",this.$onChange),this.editor.on(\"changeSelection\",this.$onChangeSelection),this.editor.on(\"changeSession\",this.$onChangeSession),this.editor.commands.on(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener(\"change\",this.$onChange),this.editor.removeListener(\"changeSelection\",this.$onChangeSelection),this.editor.removeListener(\"changeSession\",this.$onChangeSession),this.editor.commands.removeListener(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e.data.range,n=e.data.action[0]==\"r\",r=t.start,i=t.end,s=r.row,o=i.row,u=o-s,a=i.column-r.column;n&&(u=-u,a=-a);if(!this.$inChange&&n){var f=this.selectedTabstop,c=f&&!f.some(function(e){return l(e.start,r)<=0&&l(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p<h.length;p++){var d=h[p];if(d.end.row<r.row)continue;if(n&&l(r,d.start)<0&&l(i,d.end)>0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=a),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=a),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),l(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e||!e.hasLinkedRanges)return;this.$inChange=!0;var n=this.editor.session,r=n.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=t.snippetManager.tmStrFormat(r,s.original);n.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),n===0&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}n.ranges[0]&&n.addRange(n.ranges[0].clone())}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){this.$openTabstops||(this.$openTabstops=[]);if(!e[0]){var r=o.fromPoints(n,n);v(r.start,t),v(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,s=[i+1,0],u=this.ranges;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;for(var i=e.length;i--;){var a=e[i],f=o.fromPoints(a.start,a.end||a.start);d(f.start,t),d(f.end,t),f.original=a,f.tabstop=r,u.push(f),r!=e?r.unshift(f):r[i]=f,a.fmtString?(f.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=f)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(s.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,\"ace_snippet-marker\",\"text\"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),t!=-1&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new a,this.keyboardHandler.bindKeys({Tab:function(e){if(t.snippetManager&&t.snippetManager.expandWithTab(e))return;e.tabstopManager.tabNext(1)},\"Shift-Tab\":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var p={};p.onChange=u.prototype.onChange,p.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},p.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var d=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},v=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e(\"./lib/dom\").importCssString(\".ace_snippet-marker {    -moz-box-sizing: border-box;    box-sizing: border-box;    background: rgba(194, 193, 208, 0.09);    border: 1px dotted rgba(211, 208, 235, 0.62);    position: absolute;}\"),t.snippetManager=new c;var m=e(\"./editor\").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),function(){window.require([\"ace/ext/emmet\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-error_marker.js",
    "content": "(function(){window.require([\"ace/ext/error_marker\"],function(){})})()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-keybinding_menu.js",
    "content": "define(\"ace/ext/keybinding_menu\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/ext/menu_tools/overlay_page\",\"ace/ext/menu_tools/get_editor_keyboard_shortcuts\"],function(e,t,n){function i(t){if(!document.getElementById(\"kbshortcutmenu\")){var n=e(\"./menu_tools/overlay_page\").overlayPage,r=e(\"./menu_tools/get_editor_keyboard_shortcuts\").getEditorKeybordShortcuts,i=r(t),s=document.createElement(\"div\"),o=i.reduce(function(e,t){return e+'<div class=\"ace_optionsMenuEntry\"><span class=\"ace_optionsMenuCommand\">'+t.command+\"</span> : \"+'<span class=\"ace_optionsMenuKey\">'+t.key+\"</span></div>\"},\"\");s.id=\"kbshortcutmenu\",s.innerHTML=\"<h1>Keyboard Shortcuts</h1>\"+o+\"</div>\",n(t,s,\"0\",\"0\",\"0\",null)}}var r=e(\"ace/editor\").Editor;n.exports.init=function(e){r.prototype.showKeyboardShortcuts=function(){i(this)},e.commands.addCommands([{name:\"showKeyboardShortcuts\",bindKey:{win:\"Ctrl-Alt-h\",mac:\"Command-Alt-h\"},exec:function(e,t){e.showKeyboardShortcuts()}}])}}),define(\"ace/ext/menu_tools/overlay_page\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../../lib/dom\"),i=\"#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);-webkit-transition: all 0.5s;transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 1000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}\";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?\"top: \"+i+\";\":\"\",o=o?\"bottom: \"+o+\";\":\"\",s=s?\"right: \"+s+\";\":\"\",u=u?\"left: \"+u+\";\":\"\";var a=document.createElement(\"div\"),f=document.createElement(\"div\");a.style.cssText=\"margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);\",a.addEventListener(\"click\",function(){document.removeEventListener(\"keydown\",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener(\"keydown\",l),f.style.cssText=i+s+o+u,f.addEventListener(\"click\",function(e){e.stopPropagation()});var c=r.createElement(\"div\");c.style.position=\"relative\";var h=r.createElement(\"div\");h.className=\"ace_closeButton\",h.addEventListener(\"click\",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),define(\"ace/ext/menu_tools/get_editor_keyboard_shortcuts\",[\"require\",\"exports\",\"module\",\"ace/lib/keys\"],function(e,t,n){var r=e(\"../../lib/keys\");n.exports.getEditorKeybordShortcuts=function(e){var t=r.KEY_MODS,n=[],i={};return e.keyBinding.$handlers.forEach(function(e){var r=e.commandKeyBinding;for(var s in r){var o=parseInt(s);o==-1?o=\"\":isNaN(o)?o=s:o=\"\"+(o&t.command?\"Cmd-\":\"\")+(o&t.ctrl?\"Ctrl-\":\"\")+(o&t.alt?\"Alt-\":\"\")+(o&t.shift?\"Shift-\":\"\");for(var u in r[s]){var a=r[s][u];typeof a!=\"string\"&&(a=a.name),i[a]?i[a].key+=\"|\"+o+u:(i[a]={key:o+u,command:a},n.push(i[a]))}}}),n}}),function(){window.require([\"ace/ext/keybinding_menu\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-language_tools.js",
    "content": "define(\"ace/ext/language_tools\",[\"require\",\"exports\",\"module\",\"ace/snippets\",\"ace/autocomplete\",\"ace/config\",\"ace/autocomplete/util\",\"ace/autocomplete/text_completer\",\"ace/editor\"],function(e,t,n){var r=e(\"../snippets\").snippetManager,i=e(\"../autocomplete\").Autocomplete,s=e(\"../config\"),o=e(\"../autocomplete/util\"),u=e(\"../autocomplete/text_completer\"),a={getCompletions:function(e,t,n,r,i){var s=e.session.getState(n.row),o=t.$mode.getCompletions(s,t,n,r);i(null,o)}},f={getCompletions:function(e,t,n,i,s){var o=r.snippetMap,u=[];r.getActiveScopes(e).forEach(function(e){var t=o[e]||[];for(var n=t.length;n--;){var r=t[n],i=r.name||r.tabTrigger;if(!i)continue;u.push({caption:i,snippet:r.content,meta:r.tabTrigger&&!r.name?r.tabTrigger+\"\\u21e5 \":\"snippet\"})}},this),s(null,u)}},l=[f,u,a];t.addCompleter=function(e){l.push(e)},t.textCompleter=u,t.keyWordCompleter=a,t.snippetCompleter=f;var c={name:\"expandSnippet\",exec:function(e){var t=r.expandWithTab(e);t||e.execCommand(\"indent\")},bindKey:\"Tab\"},h=function(e,t){p(t.session.$mode)},p=function(e){var t=e.$id;r.files||(r.files={}),d(t),e.modes&&e.modes.forEach(p)},d=function(e){if(!e||r.files[e])return;var t=e.replace(\"mode\",\"snippets\");r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){d(\"ace/mode/\"+e)})))})},v=function(e){var t=e.editor,n=e.args||\"\",r=t.getCursorPosition(),s=t.session.getLine(r.row),u=t.completer&&t.completer.activated,a=o.retrievePrecedingIdentifier(s,r.column);l.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(e){a||(a=o.retrievePrecedingIdentifier(s,r.column,e))})}),e.command.name===\"backspace\"&&!a?u&&t.completer.detach():e.command.name===\"insertstring\"&&(a&&!u?(t.completer||(t.completer=new i,t.completer.autoSelect=!1,t.completer.autoInsert=!1),t.completer.showPopup(t)):!a&&u&&t.completer.detach())},m=e(\"../editor\").Editor;e(\"../config\").defineOptions(m.prototype,\"editor\",{enableBasicAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.on(\"afterExec\",v)):this.commands.removeListener(\"afterExec\",v)},value:!1},enableSnippets:{set:function(e){e?(this.commands.addCommand(c),this.on(\"changeMode\",h),h(null,this)):(this.commands.removeCommand(c),this.off(\"changeMode\",h))},value:!1}})}),define(\"ace/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/lib/lang\",\"ace/range\",\"ace/anchor\",\"ace/keyboard/hash_handler\",\"ace/tokenizer\",\"ace/lib/dom\",\"ace/editor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./lib/lang\"),o=e(\"./range\").Range,u=e(\"./anchor\").Anchor,a=e(\"./keyboard/hash_handler\").HashHandler,f=e(\"./tokenizer\").Tokenizer,l=o.comparePoints,c=function(){this.snippetMap={},this.snippetNameMap={}};(function(){r.implement(this,i),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return\"(?:[^\\\\\\\\\"+e+\"]|\\\\\\\\.)\"}return c.$tokenizer=new f({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):\":\"}},{regex:/\\\\./,onMatch:function(e,t,n){var r=e[1];return r==\"}\"&&n.length?e=r:\"`$\\\\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r==\"n\"?e=\"\\n\":r==\"t\"?e=\"\\n\":\"ulULE\".indexOf(r)!=-1&&(e={changeCase:r,local:r>\"a\"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\\$(?:\\d+|\\w+)/,onMatch:e},{regex:/\\$\\{[\\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:\"snippetVar\"},{regex:/\\n/,token:\"newline\",merge:!1}],snippetVar:[{regex:\"\\\\|\"+t(\"\\\\|\")+\"*\\\\|\",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(\",\")},next:\"start\"},{regex:\"/(\"+t(\"/\")+\"+)/(?:(\"+t(\"/\")+\"*)/)(\\\\w*):?\",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],\"\"},next:\"start\"},{regex:\"`\"+t(\"`\")+\"*`\",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),\"\"},next:\"start\"},{regex:\"\\\\?\",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:\"start\"},{regex:\"([^:}\\\\\\\\]|\\\\\\\\.)*:?\",token:\"\",next:\"start\"}],formatString:[{regex:\"/(\"+t(\"/\")+\"+)/\",token:\"regex\"},{regex:\"\",onMatch:function(e,t,n){n.inFormatString=!0},next:\"start\"}]}),c.prototype.getTokenizer=function(){return c.$tokenizer},c.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+\"__\"]||{})[n]}if(/^\\d+$/.test(t))return(this.variables.__||{})[t];t=t.replace(/^TM_/,\"\");if(!e)return;var r=e.session;switch(t){case\"CURRENT_WORD\":var i=r.getWordRange();case\"SELECTION\":case\"SELECTED_TEXT\":return r.getTextRange(i);case\"CURRENT_LINE\":return r.getLine(e.getCursorPosition().row);case\"PREV_LINE\":return r.getLine(e.getCursorPosition().row-1);case\"LINE_INDEX\":return e.getCursorPosition().column;case\"LINE_NUMBER\":return e.getCursorPosition().row+1;case\"SOFT_TABS\":return r.getUseSoftTabs()?\"YES\":\"NO\";case\"TAB_SIZE\":return r.getTabSize();case\"FILENAME\":case\"FILEPATH\":return\"\";case\"FULLNAME\":return\"Ace\"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||\"\":this.$getDefaultValue(e,t)||\"\"},this.tmStrFormat=function(e,t,n){var r=t.flag||\"\",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,\"\"));var s=this.tokenizeTmSnippet(t.fmt,\"formatString\"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t=\"E\";for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"object\"){e[r]=\"\";if(i.changeCase&&i.local){var u=e[r+1];u&&typeof u==\"string\"&&(i.changeCase==\"u\"?e[r]=u[0].toUpperCase():e[r]=u[0].toLowerCase(),e[r+1]=u.substr(1))}else i.changeCase&&(t=i.changeCase)}else t==\"U\"?e[r]=i.toUpperCase():t==\"L\"&&(e[r]=i.toLowerCase())}return e.join(\"\")});return this.variables.__=null,u},this.resolveVariables=function(e,t){function o(t){var n=e.indexOf(t,r+1);n!=-1&&(r=n)}var n=[];for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"string\")n.push(i);else{if(typeof i!=\"object\")continue;if(i.skip)o(i);else{if(i.processed<r)continue;if(i.text){var s=this.getVariableValue(t,i.text);s&&i.fmtString&&(s=this.tmStrFormat(s,i)),i.processed=r,i.expectIf==null?s&&(n.push(s),o(i)):s?i.skip=i.elseBranch:o(i)}else i.tabstopId!=null?n.push(i):i.changeCase!=null&&n.push(i)}}}return n},this.insertSnippetForSelection=function(e,t){function f(e){var t=[];for(var n=0;n<e.length;n++){var r=e[n];if(typeof r==\"object\"){if(a[r.tabstopId])continue;var i=e.lastIndexOf(r,n-1);r=t[i]||{tabstopId:r.tabstopId}}t[n]=r}return t}var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=e.session.getTabString(),s=r.match(/^\\s*/)[0];n.column<s.length&&(s=s.slice(0,n.column));var o=this.tokenizeTmSnippet(t);o=this.resolveVariables(o,e),o=o.map(function(e){return e==\"\\n\"?e+s:typeof e==\"string\"?e.replace(/\\t/g,i):e});var u=[];o.forEach(function(e,t){if(typeof e!=\"object\")return;var n=e.tabstopId,r=u[n];r||(r=u[n]=[],r.index=n,r.value=\"\");if(r.indexOf(e)!==-1)return;r.push(e);var i=o.indexOf(e,t+1);if(i===-1)return;var s=o.slice(t+1,i),a=s.some(function(e){return typeof e==\"object\"});a&&!r.value?r.value=s:s.length&&(!r.value||typeof r.value!=\"string\")&&(r.value=s.join(\"\"))}),u.forEach(function(e){e.length=0});var a={};for(var l=0;l<o.length;l++){var c=o[l];if(typeof c!=\"object\")continue;var p=c.tabstopId,d=o.indexOf(c,l+1);if(a[p]){a[p]===c&&(a[p]=null);continue}var v=u[p],m=typeof v.value==\"string\"?[v.value]:f(v.value);m.unshift(l+1,Math.max(0,d-l)),m.push(c),a[p]=c,o.splice.apply(o,m),v.indexOf(c)===-1&&v.push(c)}var g=0,y=0,b=\"\";o.forEach(function(e){typeof e==\"string\"?(e[0]===\"\\n\"?(y=e.length-1,g++):y+=e.length,b+=e):e.start?e.end={row:g,column:y}:e.start={row:g,column:y}});var w=e.getSelectionRange(),E=e.session.replace(w,b),S=new h(e),x=e.inVirtualSelectionMode&&e.selection.index;S.addTabstops(u,w.start,E,x)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t=e.session.$mode.$id||\"\";t=t.split(\"/\").pop();if(t===\"html\"||t===\"php\"){t===\"php\"&&!e.session.$mode.inlinePhp&&(t=\"html\");var n=e.getCursorPosition(),r=e.session.getState(n.row);typeof r==\"object\"&&(r=r[0]),r.substring&&(r.substring(0,3)==\"js-\"?t=\"javascript\":r.substring(0,4)==\"css-\"?t=\"css\":r.substring(0,4)==\"php-\"&&(t=\"php\"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],r=this.snippetMap;return r[t]&&r[t].includeScopes&&n.push.apply(n,r[t].includeScopes),n.push(\"_\"),n},this.expandWithTab=function(e,t){var n=this,r=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return r&&e.tabstopManager&&e.tabstopManager.tabNext(),r},this.expandSnippetForSelection=function(e,t){var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=r.substring(0,n.column),s=r.substr(n.column),o=this.snippetMap,u;return this.getActiveScopes(e).some(function(e){var t=o[e];return t&&(u=this.findMatchingSnippet(t,i,s)),!!u},this),u?t&&t.dryRun?!0:(e.session.doc.removeInLine(n.row,n.column-u.replaceBefore.length,n.column+u.replaceAfter.length),this.variables.M__=u.matchBefore,this.variables.T__=u.matchAfter,this.insertSnippetForSelection(e,u.content),this.variables.M__=this.variables.T__=null,!0):!1},this.findMatchingSnippet=function(e,t,n){for(var r=e.length;r--;){var i=e[r];if(i.startRe&&!i.startRe.test(t))continue;if(i.endRe&&!i.endRe.test(n))continue;if(!i.startRe&&!i.endRe)continue;return i.matchBefore=i.startRe?i.startRe.exec(t):[\"\"],i.matchAfter=i.endRe?i.endRe.exec(n):[\"\"],i.replaceBefore=i.triggerRe?i.triggerRe.exec(t)[0]:\"\",i.replaceAfter=i.endTriggerRe?i.endTriggerRe.exec(n)[0]:\"\",i}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){function o(e){return e&&!/^\\^?\\(.*\\)\\$?$|^\\\\b$/.test(e)&&(e=\"(?:\"+e+\")\"),e||\"\"}function u(e,t,n){return e=o(e),t=o(t),n?(e=t+e,e&&e[e.length-1]!=\"$\"&&(e+=\"$\")):(e+=t,e&&e[0]!=\"^\"&&(e=\"^\"+e)),new RegExp(e)}function a(e){e.scope||(e.scope=t||\"_\"),t=e.scope,n[t]||(n[t]=[],r[t]={});var o=r[t];if(e.name){var a=o[e.name];a&&i.unregister(a),o[e.name]=e}n[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\\w/.test(e.tabTrigger)&&(e.guard=\"\\\\b\"),e.trigger=s.escapeRegExp(e.tabTrigger)),e.startRe=u(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,\"\",!0),e.endRe=u(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,\"\",!0)}var n=this.snippetMap,r=this.snippetNameMap,i=this;e.content?a(e):Array.isArray(e)&&e.forEach(a),this._signal(\"registerSnippets\",{scope:t})},this.unregister=function(e,t){function i(e){var i=r[e.scope||t];if(i&&i[e.name]){delete i[e.name];var s=n[e.scope||t],o=s&&s.indexOf(e);o>=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\\r/g,\"\");var t=[],n={},r=/^#.*|^({[\\s\\S]*})\\s*$|^(\\S+) (.*)$|^((?:\\n*\\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\\t/gm,\"\"),t.push(n),n={};else{var o=i[2],u=i[3];if(o==\"regex\"){var a=/\\/((?:[^\\/\\\\]|\\\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o==\"snippet\"?(n.tabTrigger=u.match(/^\\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,r;return this.getActiveScopes(t).some(function(t){var i=n[t];return i&&(r=i[e]),!!r},this),r}}).call(c.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on(\"change\",this.$onChange),this.editor.on(\"changeSelection\",this.$onChangeSelection),this.editor.on(\"changeSession\",this.$onChangeSession),this.editor.commands.on(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener(\"change\",this.$onChange),this.editor.removeListener(\"changeSelection\",this.$onChangeSelection),this.editor.removeListener(\"changeSession\",this.$onChangeSession),this.editor.commands.removeListener(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e.data.range,n=e.data.action[0]==\"r\",r=t.start,i=t.end,s=r.row,o=i.row,u=o-s,a=i.column-r.column;n&&(u=-u,a=-a);if(!this.$inChange&&n){var f=this.selectedTabstop,c=f&&!f.some(function(e){return l(e.start,r)<=0&&l(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p<h.length;p++){var d=h[p];if(d.end.row<r.row)continue;if(n&&l(r,d.start)<0&&l(i,d.end)>0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=a),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=a),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),l(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e||!e.hasLinkedRanges)return;this.$inChange=!0;var n=this.editor.session,r=n.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=t.snippetManager.tmStrFormat(r,s.original);n.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),n===0&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}n.ranges[0]&&n.addRange(n.ranges[0].clone())}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){this.$openTabstops||(this.$openTabstops=[]);if(!e[0]){var r=o.fromPoints(n,n);v(r.start,t),v(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,s=[i+1,0],u=this.ranges;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;for(var i=e.length;i--;){var a=e[i],f=o.fromPoints(a.start,a.end||a.start);d(f.start,t),d(f.end,t),f.original=a,f.tabstop=r,u.push(f),r!=e?r.unshift(f):r[i]=f,a.fmtString?(f.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=f)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(s.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,\"ace_snippet-marker\",\"text\"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),t!=-1&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new a,this.keyboardHandler.bindKeys({Tab:function(e){if(t.snippetManager&&t.snippetManager.expandWithTab(e))return;e.tabstopManager.tabNext(1)},\"Shift-Tab\":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var p={};p.onChange=u.prototype.onChange,p.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},p.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var d=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},v=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e(\"./lib/dom\").importCssString(\".ace_snippet-marker {    -moz-box-sizing: border-box;    box-sizing: border-box;    background: rgba(194, 193, 208, 0.09);    border: 1px dotted rgba(211, 208, 235, 0.62);    position: absolute;}\"),t.snippetManager=new c;var m=e(\"./editor\").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),define(\"ace/autocomplete\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\",\"ace/autocomplete/popup\",\"ace/autocomplete/util\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/snippets\"],function(e,t,n){var r=e(\"./keyboard/hash_handler\").HashHandler,i=e(\"./autocomplete/popup\").AcePopup,s=e(\"./autocomplete/util\"),o=e(\"./lib/event\"),u=e(\"./lib/lang\"),a=e(\"./snippets\").snippetManager,f=function(){this.autoInsert=!0,this.autoSelect=!0,this.keyboardHandler=new r,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=u.delayedCall(function(){this.updateCompletions(!0)}.bind(this))};(function(){this.gatherCompletionsId=0,this.$init=function(){this.popup=new i(document.body||document.documentElement),this.popup.on(\"click\",function(e){this.insertMatch(),e.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor)},this.openPopup=function(e,t,n){this.popup||this.$init(),this.popup.setData(this.completions.filtered);var r=e.renderer;this.popup.setRow(this.autoSelect?0:-1);if(!n){this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize());var i=r.layerConfig.lineHeight,s=r.$cursorLayer.getPixelPosition(this.base,!0);s.left-=this.popup.getTextLeftOffset();var o=e.container.getBoundingClientRect();s.top+=o.top-r.layerConfig.offset,s.left+=o.left-e.renderer.scrollLeft,s.left+=r.$gutterLayer.gutterWidth,this.popup.show(s,i)}},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off(\"changeSelection\",this.changeListener),this.editor.off(\"blur\",this.blurListener),this.editor.off(\"mousedown\",this.mousedownListener),this.editor.off(\"mousewheel\",this.mousewheelListener),this.changeTimer.cancel(),this.popup&&this.popup.isOpen&&(this.gatherCompletionsId=this.gatherCompletionsId+1),this.popup&&this.popup.hide(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(){var e=document.activeElement;e!=this.editor.textInput.getElement()&&e.parentNode!=this.popup.container&&this.detach()},this.mousedownListener=function(e){this.detach()},this.mousewheelListener=function(e){this.detach()},this.goTo=function(e){var t=this.popup.getRow(),n=this.popup.session.getLength()-1;switch(e){case\"up\":t=t<=0?n:t-1;break;case\"down\":t=t>=n?-1:t+1;break;case\"start\":t=0;break;case\"end\":t=n}this.popup.setRow(t)},this.insertMatch=function(e){e||(e=this.popup.getData(this.popup.getRow()));if(!e)return!1;if(e.completer&&e.completer.insertMatch)e.completer.insertMatch(this.editor);else{if(this.completions.filterText){var t=this.editor.selection.getAllRanges();for(var n=0,r;r=t[n];n++)r.start.column-=this.completions.filterText.length,this.editor.session.remove(r)}e.snippet?a.insertSnippet(this.editor,e.snippet):this.editor.execCommand(\"insertstring\",e.value||e)}this.detach()},this.commands={Up:function(e){e.completer.goTo(\"up\")},Down:function(e){e.completer.goTo(\"down\")},\"Ctrl-Up|Ctrl-Home\":function(e){e.completer.goTo(\"start\")},\"Ctrl-Down|Ctrl-End\":function(e){e.completer.goTo(\"end\")},Esc:function(e){e.completer.detach()},Space:function(e){e.completer.detach(),e.insert(\" \")},Return:function(e){return e.completer.insertMatch()},\"Shift-Return\":function(e){e.completer.insertMatch(!0)},Tab:function(e){var t=e.completer.insertMatch();if(!!t||!!e.tabstopManager)return t;e.completer.goTo(\"down\")},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},this.gatherCompletions=function(e,t){var n=e.getSession(),r=e.getCursorPosition(),i=n.getLine(r.row),o=s.retrievePrecedingIdentifier(i,r.column);this.base=e.getCursorPosition(),this.base.column-=o.length;var u=[],a=e.completers.length;return e.completers.forEach(function(i,f){i.getCompletions(e,n,r,o,function(r,i){r||(u=u.concat(i));var o=e.getCursorPosition(),f=n.getLine(o.row);t(null,{prefix:s.retrievePrecedingIdentifier(f,o.column,i[0]&&i[0].identifierRegex),matches:u,finished:--a===0})})}),!0},this.showPopup=function(e){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.keyBinding.addKeyboardHandler(this.keyboardHandler),e.on(\"changeSelection\",this.changeListener),e.on(\"blur\",this.blurListener),e.on(\"mousedown\",this.mousedownListener),e.on(\"mousewheel\",this.mousewheelListener),this.updateCompletions()},this.updateCompletions=function(e){if(e&&this.base&&this.completions){var t=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:t});if(n==this.completions.filterText)return;this.completions.setFilter(n);if(!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==n&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,n,e);return}var r=this.gatherCompletionsId;this.gatherCompletions(this.editor,function(t,n){var i=function(){if(!n.finished)return;return this.detach()}.bind(this),s=n.prefix,o=n&&n.matches;if(!o||!o.length)return i();if(s.indexOf(n.prefix)!==0||r!=this.gatherCompletionsId)return;this.completions=new l(o),this.completions.setFilter(s);var u=this.completions.filtered;if(!u.length)return i();if(u.length==1&&u[0].value==s&&!u[0].snippet)return i();if(this.autoInsert&&u.length==1)return this.insertMatch(u[0]);this.openPopup(this.editor,s,e)}.bind(this))},this.cancelContextMenu=function(){var e=function(t){this.editor.off(\"nativecontextmenu\",e),t&&t.domEvent&&o.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on(\"nativecontextmenu\",e)}}).call(f.prototype),f.startCommand={name:\"startAutocomplete\",exec:function(e){e.completer||(e.completer=new f),e.completer.autoInsert=e.completer.autoSelect=!0,e.completer.showPopup(e),e.completer.cancelContextMenu()},bindKey:\"Ctrl-Space|Ctrl-Shift-Space|Alt-Space\"};var l=function(e,t,n){this.all=e,this.filtered=e,this.filterText=t||\"\"};(function(){this.setFilter=function(e){if(e.length>this.filterText&&e.lastIndexOf(this.filterText,0)===0)var t=this.filtered;else var t=this.all;this.filterText=e,t=this.filterCompletions(t,this.filterText),t=t.sort(function(e,t){return t.exactMatch-e.exactMatch||t.score-e.score});var n=null;t=t.filter(function(e){var t=e.value||e.caption||e.snippet;return t===n?!1:(n=t,!0)}),this.filtered=t},this.filterCompletions=function(e,t){var n=[],r=t.toUpperCase(),i=t.toLowerCase();e:for(var s=0,o;o=e[s];s++){var u=o.value||o.caption||o.snippet;if(!u)continue;var a=-1,f=0,l=0,c,h;for(var p=0;p<t.length;p++){var d=u.indexOf(i[p],a+1),v=u.indexOf(r[p],a+1);c=d>=0?v<0||d<v?d:v:v;if(c<0)continue e;h=c-a-1,h>0&&(a===-1&&(l+=10),l+=h),f|=1<<c,a=c}o.matchMask=f,o.exactMatch=l?0:1,o.score=(o.score||0)-l,n.push(o)}return n}}).call(l.prototype),t.Autocomplete=f,t.FilteredList=l}),define(\"ace/autocomplete/popup\",[\"require\",\"exports\",\"module\",\"ace/edit_session\",\"ace/virtual_renderer\",\"ace/editor\",\"ace/range\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../edit_session\").EditSession,i=e(\"../virtual_renderer\").VirtualRenderer,s=e(\"../editor\").Editor,o=e(\"../range\").Range,u=e(\"../lib/event\"),a=e(\"../lib/lang\"),f=e(\"../lib/dom\"),l=function(e){var t=new i(e);t.$maxLines=4;var n=new s(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusWaitTimout=0,n},c=function(e){var t=f.createElement(\"div\"),n=new l(t);e&&e.appendChild(t),t.style.display=\"none\",n.renderer.content.style.cursor=\"default\",n.renderer.setStyle(\"ace_autocomplete\"),n.setOption(\"displayIndentGuides\",!1);var r=function(){};n.focus=r,n.$isFocused=!0,n.renderer.$cursorLayer.restartTimer=r,n.renderer.$cursorLayer.element.style.opacity=0,n.renderer.$maxLines=8,n.renderer.$keepTextAreaAtCursor=!1,n.setHighlightActiveLine(!1),n.session.highlight(\"\"),n.session.$searchHighlight.clazz=\"ace_highlight-marker\",n.on(\"mousedown\",function(e){var t=e.getDocumentPosition();n.selection.moveToPosition(t),c.start.row=c.end.row=t.row,e.stop()});var i,s=new o(-1,0,-1,Infinity),c=new o(-1,0,-1,Infinity);c.id=n.session.addMarker(c,\"ace_active-line\",\"fullLine\"),n.setSelectOnHover=function(e){e?s.id&&(n.session.removeMarker(s.id),s.id=null):s.id=n.session.addMarker(s,\"ace_line-hover\",\"fullLine\")},n.setSelectOnHover(!1),n.on(\"mousemove\",function(e){if(!i){i=e;return}if(i.x==e.x&&i.y==e.y)return;i=e,i.scrollTop=n.renderer.scrollTop;var t=i.getDocumentPosition().row;s.start.row!=t&&(s.id||n.setRow(t),p(t))}),n.renderer.on(\"beforeRender\",function(){if(i&&s.start.row!=-1){i.$pos=null;var e=i.getDocumentPosition().row;s.id||n.setRow(e),p(e,!0)}}),n.renderer.on(\"afterRender\",function(){var e=n.getRow(),t=n.renderer.$textLayer,r=t.element.childNodes[e-t.config.firstRow];if(r==t.selectedNode)return;t.selectedNode&&f.removeCssClass(t.selectedNode,\"ace_selected\"),t.selectedNode=r,r&&f.addCssClass(r,\"ace_selected\")});var h=function(){p(-1)},p=function(e,t){e!==s.start.row&&(s.start.row=s.end.row=e,t||n.session._emit(\"changeBackMarker\"),n._emit(\"changeHoverMarker\"))};n.getHoveredRow=function(){return s.start.row},u.addListener(n.container,\"mouseout\",h),n.on(\"hide\",h),n.on(\"changeSelection\",h),n.session.doc.getLength=function(){return n.data.length},n.session.doc.getLine=function(e){var t=n.data[e];return typeof t==\"string\"?t:t&&t.value||\"\"};var d=n.session.bgTokenizer;return d.$tokenizeRow=function(e){var t=n.data[e],r=[];if(!t)return r;typeof t==\"string\"&&(t={value:t}),t.caption||(t.caption=t.value);var i=-1,s,o;for(var e=0;e<t.caption.length;e++)o=t.caption[e],s=t.matchMask&1<<e?1:0,i!==s?(r.push({type:t.className||\"\"+(s?\"completion-highlight\":\"\"),value:o}),i=s):r[r.length-1].value+=o;if(t.meta){var u=n.renderer.$size.scrollerWidth/n.renderer.layerConfig.characterWidth;t.meta.length+t.caption.length<u-2&&r.push({type:\"rightAlignedText\",value:t.meta})}return r},d.$updateOnChange=r,d.start=r,n.session.$computeWidth=function(){return this.screenWidth=0},n.isOpen=!1,n.isTopdown=!1,n.data=[],n.setData=function(e){n.data=e||[],n.setValue(a.stringRepeat(\"\\n\",e.length),-1),n.setRow(0)},n.getData=function(e){return n.data[e]},n.getRow=function(){return c.start.row},n.setRow=function(e){e=Math.max(-1,Math.min(this.data.length,e)),c.start.row!=e&&(n.selection.clearSelection(),c.start.row=c.end.row=e||0,n.session._emit(\"changeBackMarker\"),n.moveCursorTo(e||0,0),n.isOpen&&n._signal(\"select\"))},n.on(\"changeSelection\",function(){n.isOpen&&n.setRow(n.selection.lead.row)}),n.hide=function(){this.container.style.display=\"none\",this._signal(\"hide\"),n.isOpen=!1},n.show=function(e,t,r){var s=this.container,o=window.innerHeight,u=window.innerWidth,a=this.renderer,f=a.$maxLines*t*1.4,l=e.top+this.$borderSize;l+f>o-t&&!r?(s.style.top=\"\",s.style.bottom=o-l+\"px\",n.isTopdown=!1):(l+=t,s.style.top=l+\"px\",s.style.bottom=\"\",n.isTopdown=!0),s.style.display=\"\",this.renderer.$textLayer.checkForSizeChanges();var c=e.left;c+s.offsetWidth>u&&(c=u-s.offsetWidth),s.style.left=c+\"px\",this._signal(\"show\"),i=null,n.isOpen=!0},n.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},n.$imageSize=0,n.$borderSize=1,n};f.importCssString(\".ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {    background-color: #CAD6FA;    z-index: 1;}.ace_editor.ace_autocomplete .ace_line-hover {    border: 1px solid #abbffe;    margin-top: -1px;    background: rgba(233,233,253,0.4);}.ace_editor.ace_autocomplete .ace_line-hover {    position: absolute;    z-index: 2;}.ace_editor.ace_autocomplete .ace_scroller {   background: none;   border: none;   box-shadow: none;}.ace_rightAlignedText {    color: gray;    display: inline-block;    position: absolute;    right: 4px;    text-align: right;    z-index: -1;}.ace_editor.ace_autocomplete .ace_completion-highlight{    color: #000;    text-shadow: 0 0 0.01em;}.ace_editor.ace_autocomplete {    width: 280px;    z-index: 200000;    background: #fbfbfb;    color: #444;    border: 1px lightgray solid;    position: fixed;    box-shadow: 2px 3px 5px rgba(0,0,0,.2);    line-height: 1.4;}\"),t.AcePopup=c}),define(\"ace/autocomplete/util\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.parForEach=function(e,t,n){var r=0,i=e.length;i===0&&n();for(var s=0;s<i;s++)t(e[s],function(e,t){r++,r===i&&n(e,t)})};var r=/[a-zA-Z_0-9\\$\\-\\u00A2-\\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t-1;s>=0;s--){if(!n.test(e[s]))break;i.push(e[s])}return i.reverse().join(\"\")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t;s<e.length;s++){if(!n.test(e[s]))break;i.push(e[s])}return i}}),define(\"ace/autocomplete/text_completer\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){function s(e,t){var n=e.getTextRange(r.fromPoints({row:0,column:0},t));return n.split(i).length-1}function o(e,t){var n=s(e,t),r=e.getValue().split(i),o=Object.create(null),u=r[n];return r.forEach(function(e,t){if(!e||e===u)return;var i=Math.abs(n-t),s=r.length-i;o[e]?o[e]=Math.max(s,o[e]):o[e]=s}),o}var r=e(\"../range\").Range,i=/[^a-zA-Z_0-9\\$\\-\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w]+/;t.getCompletions=function(e,t,n,r,i){var s=o(t,n,r),u=Object.keys(s);i(null,u.map(function(e){return{name:e,value:e,score:s[e],meta:\"local\"}}))}}),function(){window.require([\"ace/ext/language_tools\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-linking.js",
    "content": "define(\"ace/ext/linking\",[\"require\",\"exports\",\"module\",\"ace/editor\",\"ace/config\"],function(e,t,n){function i(e){var t=e.editor,n=e.getAccelKey();if(n){var t=e.editor,r=e.getDocumentPosition(),i=t.session,s=i.getTokenAt(r.row,r.column);t._emit(\"linkHover\",{position:r,token:s})}}function s(e){var t=e.getAccelKey(),n=e.getButton();if(n==0&&t){var r=e.editor,i=e.getDocumentPosition(),s=r.session,o=s.getTokenAt(i.row,i.column);r._emit(\"linkClick\",{position:i,token:o})}}var r=e(\"ace/editor\").Editor;e(\"../config\").defineOptions(r.prototype,\"editor\",{enableLinking:{set:function(e){e?(this.on(\"click\",s),this.on(\"mousemove\",i)):(this.off(\"click\",s),this.off(\"mousemove\",i))},value:!1}})}),function(){window.require([\"ace/ext/linking\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-modelist.js",
    "content": "define(\"ace/ext/modelist\",[\"require\",\"exports\",\"module\"],function(e,t,n){function i(e){var t=a.text,n=e.split(/[\\/\\\\]/).pop();for(var i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var r=[],s=function(e,t,n){this.name=e,this.caption=t,this.mode=\"ace/mode/\"+e,this.extensions=n;if(/\\^/.test(n))var r=n.replace(/\\|(\\^)?/g,function(e,t){return\"$|\"+(t?\"^\":\"^.*\\\\.\")})+\"$\";else var r=\"^.*\\\\.(\"+n+\")$\";this.extRe=new RegExp(r,\"gi\")};s.prototype.supportsFile=function(e){return e.match(this.extRe)};var o={ABAP:[\"abap\"],ActionScript:[\"as\"],ADA:[\"ada|adb\"],Apache_Conf:[\"^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd\"],AsciiDoc:[\"asciidoc\"],Assembly_x86:[\"asm\"],AutoHotKey:[\"ahk\"],BatchFile:[\"bat|cmd\"],C9Search:[\"c9search_results\"],C_Cpp:[\"cpp|c|cc|cxx|h|hh|hpp\"],Cirru:[\"cirru|cr\"],Clojure:[\"clj\"],Cobol:[\"CBL|COB\"],coffee:[\"coffee|cf|cson|^Cakefile\"],ColdFusion:[\"cfm\"],CSharp:[\"cs\"],CSS:[\"css\"],Curly:[\"curly\"],D:[\"d|di\"],Dart:[\"dart\"],Diff:[\"diff|patch\"],Dockerfile:[\"^Dockerfile\"],Dot:[\"dot\"],Erlang:[\"erl|hrl\"],EJS:[\"ejs\"],Forth:[\"frt|fs|ldr\"],FTL:[\"ftl\"],Gherkin:[\"feature\"],Glsl:[\"glsl|frag|vert\"],golang:[\"go\"],Groovy:[\"groovy\"],HAML:[\"haml\"],Handlebars:[\"hbs|handlebars|tpl|mustache\"],Haskell:[\"hs\"],haXe:[\"hx\"],HTML:[\"html|htm|xhtml\"],HTML_Ruby:[\"erb|rhtml|html.erb\"],INI:[\"ini|conf|cfg|prefs\"],Jack:[\"jack\"],Jade:[\"jade\"],Java:[\"java\"],JavaScript:[\"js|jsm\"],JSON:[\"json\"],JSONiq:[\"jq\"],JSP:[\"jsp\"],JSX:[\"jsx\"],Julia:[\"jl\"],LaTeX:[\"tex|latex|ltx|bib\"],LESS:[\"less\"],Liquid:[\"liquid\"],Lisp:[\"lisp\"],LiveScript:[\"ls\"],LogiQL:[\"logic|lql\"],LSL:[\"lsl\"],Lua:[\"lua\"],LuaPage:[\"lp\"],Lucene:[\"lucene\"],Makefile:[\"^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make\"],MATLAB:[\"matlab\"],Markdown:[\"md|markdown\"],MEL:[\"mel\"],MySQL:[\"mysql\"],MUSHCode:[\"mc|mush\"],Nix:[\"nix\"],ObjectiveC:[\"m|mm\"],OCaml:[\"ml|mli\"],Pascal:[\"pas|p\"],Perl:[\"pl|pm\"],pgSQL:[\"pgsql\"],PHP:[\"php|phtml\"],Powershell:[\"ps1\"],Prolog:[\"plg|prolog\"],Properties:[\"properties\"],Protobuf:[\"proto\"],Python:[\"py\"],R:[\"r\"],RDoc:[\"Rd\"],RHTML:[\"Rhtml\"],Ruby:[\"rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile\"],Rust:[\"rs\"],SASS:[\"sass\"],SCAD:[\"scad\"],Scala:[\"scala\"],Smarty:[\"smarty|tpl\"],Scheme:[\"scm|rkt\"],SCSS:[\"scss\"],SH:[\"sh|bash|^.bashrc\"],SJS:[\"sjs\"],Space:[\"space\"],snippets:[\"snippets\"],Soy_Template:[\"soy\"],SQL:[\"sql\"],Stylus:[\"styl|stylus\"],SVG:[\"svg\"],Tcl:[\"tcl\"],Tex:[\"tex\"],Text:[\"txt\"],Textile:[\"textile\"],Toml:[\"toml\"],Twig:[\"twig\"],Typescript:[\"ts|typescript|str\"],Vala:[\"vala\"],VBScript:[\"vbs\"],Velocity:[\"vm\"],Verilog:[\"v|vh|sv|svh\"],XML:[\"xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl\"],XQuery:[\"xq\"],YAML:[\"yaml|yml\"]},u={ObjectiveC:\"Objective-C\",CSharp:\"C#\",golang:\"Go\",C_Cpp:\"C/C++\",coffee:\"CoffeeScript\",HTML_Ruby:\"HTML (Ruby)\",FTL:\"FreeMarker\"},a={};for(var f in o){var l=o[f],c=(u[f]||f).replace(/_/g,\" \"),h=f.toLowerCase(),p=new s(h,c,l[0]);a[h]=p,r.push(p)}n.exports={getModeForPath:i,modes:r,modesByName:a}}),function(){window.require([\"ace/ext/modelist\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-old_ie.js",
    "content": "define(\"ace/ext/old_ie\",[\"require\",\"exports\",\"module\",\"ace/lib/useragent\",\"ace/tokenizer\",\"ace/ext/searchbox\",\"ace/mode/text\"],function(require,exports,module){function patch(obj,name,regexp,replacement){eval(\"obj['\"+name+\"']=\"+obj[name].toString().replace(regexp,replacement))}var MAX_TOKEN_COUNT=1e3,useragent=require(\"../lib/useragent\"),TokenizerModule=require(\"../tokenizer\");useragent.isIE&&useragent.isIE<10&&window.top.document.compatMode===\"BackCompat\"&&(useragent.isOldIE=!0);if(typeof document!=\"undefined\"&&!document.documentElement.querySelector){useragent.isOldIE=!0;var qs=function(e,t){if(t.charAt(0)==\".\")var n=t.slice(1);else var r=t.match(/(\\w+)=(\\w+)/),i=r&&r[1],s=r&&r[2];for(var o=0;o<e.all.length;o++){var u=e.all[o];if(n){if(u.className.indexOf(n)!=-1)return u}else if(i&&u.getAttribute(i)==s)return u}},sb=require(\"./searchbox\").SearchBox.prototype;patch(sb,\"$initElements\",/([^\\s=]*).querySelector\\((\".*?\")\\)/g,\"qs($1, $2)\")}var compliantExecNpcg=/()??/.exec(\"\")[1]===undefined;if(compliantExecNpcg)return;var proto=TokenizerModule.Tokenizer.prototype;TokenizerModule.Tokenizer_orig=TokenizerModule.Tokenizer,proto.getLineTokens_orig=proto.getLineTokens,patch(TokenizerModule,\"Tokenizer\",\"ruleRegExps.push(adjustedregex);\\n\",function(e){return e+'        if (state[i].next && RegExp(adjustedregex).test(\"\"))\\n            rule._qre = RegExp(adjustedregex, \"g\");\\n        '}),TokenizerModule.Tokenizer.prototype=proto,patch(proto,\"getLineTokens\",/if \\(match\\[i \\+ 1\\] === undefined\\)\\s*continue;/,\"if (!match[i + 1]) {\\n        if (value)continue;\\n        var qre = state[mapping[i]]._qre;\\n        if (!qre) continue;\\n        qre.lastIndex = lastIndex;\\n        if (!qre.exec(line) || qre.lastIndex != lastIndex)\\n            continue;\\n    }\"),patch(require(\"../mode/text\").Mode.prototype,\"getTokenizer\",/Tokenizer/,\"TokenizerModule.Tokenizer\"),useragent.isOldIE=!0}),define(\"ace/ext/searchbox\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/event\",\"ace/keyboard/hash_handler\",\"ace/lib/keys\"],function(e,t,n){var r=e(\"../lib/dom\"),i=e(\"../lib/lang\"),s=e(\"../lib/event\"),o=\"/* ------------------------------------------------------------------------------------------* Editor Search Form* --------------------------------------------------------------------------------------- */.ace_search {background-color: #ddd;border: 1px solid #cbcbcb;border-top: 0 none;max-width: 297px;overflow: hidden;margin: 0;padding: 4px;padding-right: 6px;padding-bottom: 0;position: absolute;top: 0px;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {border-radius: 3px;border: 1px solid #cbcbcb;float: left;margin-bottom: 4px;overflow: hidden;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {background-color: white;border-right: 1px solid #cbcbcb;border: 0 none;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;display: block;float: left;height: 22px;outline: 0;padding: 0 7px;width: 214px;margin: 0;}.ace_searchbtn,.ace_replacebtn {background: #fff;border: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;display: block;float: left;height: 22px;margin: 0;padding: 0;position: relative;}.ace_searchbtn:last-child,.ace_replacebtn:last-child {border-top-right-radius: 3px;border-bottom-right-radius: 3px;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn {background-position: 50% 50%;background-repeat: no-repeat;width: 27px;}.ace_searchbtn.prev {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=);    }.ace_searchbtn.next {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=);    }.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;display: block;float: right;font-family: Arial;font-size: 16px;height: 14px;line-height: 16px;margin: 5px 1px 9px 5px;padding: 0;text-align: center;width: 14px;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_replacebtn.prev {width: 54px}.ace_replacebtn.next {width: 27px}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;-moz-box-sizing: border-box;box-sizing:    border-box;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;}\",u=e(\"../keyboard/hash_handler\").HashHandler,a=e(\"../lib/keys\");r.importCssString(o,\"ace_searchbox\");var f='<div class=\"ace_search right\">    <button type=\"button\" action=\"hide\" class=\"ace_searchbtn_close\"></button>    <div class=\"ace_search_form\">        <input class=\"ace_search_field\" placeholder=\"Search for\" spellcheck=\"false\"></input>        <button type=\"button\" action=\"findNext\" class=\"ace_searchbtn next\"></button>        <button type=\"button\" action=\"findPrev\" class=\"ace_searchbtn prev\"></button>    </div>    <div class=\"ace_replace_form\">        <input class=\"ace_search_field\" placeholder=\"Replace with\" spellcheck=\"false\"></input>        <button type=\"button\" action=\"replaceAndFindNext\" class=\"ace_replacebtn\">Replace</button>        <button type=\"button\" action=\"replaceAll\" class=\"ace_replacebtn\">All</button>    </div>    <div class=\"ace_search_options\">        <span action=\"toggleRegexpMode\" class=\"ace_button\" title=\"RegExp Search\">.*</span>        <span action=\"toggleCaseSensitive\" class=\"ace_button\" title=\"CaseSensitive Search\">Aa</span>        <span action=\"toggleWholeWords\" class=\"ace_button\" title=\"Whole Word Search\">\\\\b</span>    </div></div>'.replace(/>\\s+/g,\">\"),l=function(e,t,n){var i=r.createElement(\"div\");i.innerHTML=f,this.element=i.firstChild,this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.container.appendChild(this.element),this.editor=e},this.$initElements=function(e){this.searchBox=e.querySelector(\".ace_search_form\"),this.replaceBox=e.querySelector(\".ace_replace_form\"),this.searchOptions=e.querySelector(\".ace_search_options\"),this.regExpOption=e.querySelector(\"[action=toggleRegexpMode]\"),this.caseSensitiveOption=e.querySelector(\"[action=toggleCaseSensitive]\"),this.wholeWordOption=e.querySelector(\"[action=toggleWholeWords]\"),this.searchInput=this.searchBox.querySelector(\".ace_search_field\"),this.replaceInput=this.replaceBox.querySelector(\".ace_search_field\")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;s.addListener(e,\"mousedown\",function(e){setTimeout(function(){t.activeInput.focus()},0),s.stopPropagation(e)}),s.addListener(e,\"click\",function(e){var n=e.target||e.srcElement,r=n.getAttribute(\"action\");r&&t[r]?t[r]():t.$searchBarKb.commands[r]&&t.$searchBarKb.commands[r].exec(t),s.stopPropagation(e)}),s.addCommandKeyListener(e,function(e,n,r){var i=a.keyCodeToString(r),o=t.$searchBarKb.findKeyCommand(n,i);o&&o.exec&&(o.exec(t),s.stopEvent(e))}),this.$onChange=i.delayedCall(function(){t.find(!1,!1)}),s.addListener(this.searchInput,\"input\",function(){t.$onChange.schedule(20)}),s.addListener(this.searchInput,\"focus\",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),s.addListener(this.replaceInput,\"focus\",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new u([{bindKey:\"Esc\",name:\"closeSearchBar\",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new u,this.$searchBarKb.bindKeys({\"Ctrl-f|Command-f|Ctrl-H|Command-Option-F\":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?\"\":\"none\",e[t?\"replaceInput\":\"searchInput\"].focus()},\"Ctrl-G|Command-G\":function(e){e.findNext()},\"Ctrl-Shift-G|Command-Shift-G\":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},\"Shift-Return\":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:\"toggleRegexpMode\",bindKey:{win:\"Alt-R|Alt-/\",mac:\"Ctrl-Alt-R|Ctrl-Alt-/\"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:\"toggleCaseSensitive\",bindKey:{win:\"Alt-C|Alt-I\",mac:\"Ctrl-Alt-R|Ctrl-Alt-I\"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:\"toggleWholeWords\",bindKey:{win:\"Alt-B|Alt-W\",mac:\"Ctrl-Alt-B|Ctrl-Alt-W\"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}}]),this.$syncOptions=function(){r.setCssClass(this.regExpOption,\"checked\",this.regExpOption.checked),r.setCssClass(this.wholeWordOption,\"checked\",this.wholeWordOption.checked),r.setCssClass(this.caseSensitiveOption,\"checked\",this.caseSensitiveOption.checked),this.find(!1,!1)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t){var n=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),i=!n&&this.searchInput.value;r.setCssClass(this.searchBox,\"ace_nomatch\",i),this.editor._emit(\"findSearchBox\",{match:!i}),this.highlight()},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.element.style.display=\"none\",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.element.style.display=\"\",this.replaceBox.style.display=t?\"\":\"none\",this.isReplace=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb)}}).call(l.prototype),t.SearchBox=l,t.Search=function(e,t){var n=e.searchBox||new l(e);n.show(e.session.getTextRange(),t)}}),function(){window.require([\"ace/ext/old_ie\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-options.js",
    "content": "define(\"ace/ext/options\",[\"require\",\"exports\",\"module\"],function(e,t,n){function u(e,t){var n=document.getElementById(e);localStorage&&localStorage.getItem(e)&&(n.checked=localStorage.getItem(e)==\"1\");var r=function(){t(!!n.checked),saveOption(n)};n.onclick=r,r()}function a(e,t){var n=document.getElementById(e);localStorage&&localStorage.getItem(e)&&(n.value=localStorage.getItem(e));var r=function(){t(n.value),saveOption(n)};n.onchange=r,r()}function f(e,t){e.forEach(function(e){var n=document.createElement(\"option\");n.setAttribute(\"value\",e.name),n.innerHTML=e.desc,t.appendChild(n)})}function l(e,t){if(Array.isArray(e)){f(e,t);return}for(var n in e){var r=document.createElement(\"optgroup\");r.setAttribute(\"label\",n),f(e[n],r),t.appendChild(r)}}function c(e){if(e.values){var t=dom.createElement(\"select\");t.setAttribute(\"size\",e.visibleSize||1),l(e.values,t)}else var t=dom.createElement(\"checkbox\");return t.setAttribute(\"name\",\"opt_\"+e.name),t}function h(e){if(e.values){var t=dom.createElement(\"select\");t.setAttribute(\"size\",e.visibleSize||1),l(e.values,t)}else var t=dom.createElement(\"checkbox\");return t.setAttribute(\"name\",\"opt_\"+e.name),t}var r=modelist.modesByName,i=[[\"Document\",function(e){doclist.loadDoc(e,function(e){if(!e)return;e=env.split.setSession(e),updateUIEditorOptions(),env.editor.focus()})},doclist.all],[\"Mode\",function(e){env.editor.session.setMode(r[e].mode||r.text.mode),env.editor.session.modeName=e},function(e){return env.editor.session.modeName||\"text\"},modelist.modes],[\"Split\",function(e){var t=env.split;if(e==\"none\")t.getSplits()==2&&(env.secondSession=t.getEditor(1).session),t.setSplits(1);else{var n=t.getSplits()==1;e==\"below\"?t.setOrientation(t.BELOW):t.setOrientation(t.BESIDE),t.setSplits(2);if(n){var r=env.secondSession||t.getEditor(0).session,i=t.setSession(r,1);i.name=r.name}}},[\"None\",\"Beside\",\"Below\"]],[\"Theme\",function(e){if(!e)return;env.editor.setTheme(\"ace/theme/\"+e),themeEl.selectedValue=e},function(){return env.editor.getTheme()},{Bright:{chrome:\"Chrome\",clouds:\"Clouds\",crimson_editor:\"Crimson Editor\",dawn:\"Dawn\",dreamweaver:\"Dreamweaver\",eclipse:\"Eclipse\",github:\"GitHub\",solarized_light:\"Solarized Light\",textmate:\"TextMate\",tomorrow:\"Tomorrow\",xcode:\"XCode\"},Dark:{ambiance:\"Ambiance\",chaos:\"Chaos\",clouds_midnight:\"Clouds Midnight\",cobalt:\"Cobalt\",idle_fingers:\"idleFingers\",kr_theme:\"krTheme\",merbivore:\"Merbivore\",merbivore_soft:\"Merbivore Soft\",mono_industrial:\"Mono Industrial\",monokai:\"Monokai\",pastel_on_dark:\"Pastel on dark\",solarized_dark:\"Solarized Dark\",twilight:\"Twilight\",tomorrow_night:\"Tomorrow Night\",tomorrow_night_blue:\"Tomorrow Night Blue\",tomorrow_night_bright:\"Tomorrow Night Bright\",tomorrow_night_eighties:\"Tomorrow Night 80s\",vibrant_ink:\"Vibrant Ink\"}}],[\"Code Folding\",function(e){env.editor.getSession().setFoldStyle(e),env.editor.setShowFoldWidgets(e!==\"manual\")},[\"manual\",\"mark begin\",\"mark begin and end\"]],[\"Soft Wrap\",function(e){e=e.toLowerCase();var t=env.editor.getSession(),n=env.editor.renderer;t.setUseWrapMode(e==\"off\");var r=parseInt(e)||null;n.setPrintMarginColumn(r||80),t.setWrapLimitRange(r,r)},[\"Off\",\"40 Chars\",\"80 Chars\",\"Free\"]],[\"Key Binding\",function(e){env.editor.setKeyboardHandler(keybindings[e])},[\"Ace\",\"Vim\",\"Emacs\",\"Custom\"]],[\"Font Size\",function(e){env.split.setFontSize(e+\"px\")},[10,11,12,14,16,20,24]],[\"Full Line Selection\",function(e){env.editor.setSelectionStyle(e?\"line\":\"text\")}],[\"Highlight Active Line\",function(e){env.editor.setHighlightActiveLine(e)}],[\"Show Invisibles\",function(e){env.editor.setShowInvisibles(e)}],[\"Show Gutter\",function(e){env.editor.renderer.setShowGutter(e)}],[\"Show Indent Guides\",function(e){env.editor.renderer.setDisplayIndentGuides(e)}],[\"Show Print Margin\",function(e){env.editor.renderer.setShowPrintMargin(e)}],[\"Persistent HScroll\",function(e){env.editor.renderer.setHScrollBarAlwaysVisible(e)}],[\"Animate Scrolling\",function(e){env.editor.setAnimatedScroll(e)}],[\"Use Soft Tab\",function(e){env.editor.getSession().setUseSoftTabs(e)}],[\"Highlight Selected Word\",function(e){env.editor.setHighlightSelectedWord(e)}],[\"Enable Behaviours\",function(e){env.editor.setBehavioursEnabled(e)}],[\"Fade Fold Widgets\",function(e){env.editor.setFadeFoldWidgets(e)}],[\"Show Token info\",function(e){env.editor.setFadeFoldWidgets(e)}]],o=function(e){var t=[],n=document.createElement(\"div\");n.style.cssText=\"position: absolute; overflow: hidden\";var r=document.createElement(\"div\");return r.style.cssText=\"width: 120%;height:100%;overflow: scroll\",n.appendChild(r),t.push(\"<table><tbody>\"),e.forEach(function(e){}),t.push(\"<tr>\",\"<td>\",'<label for=\"',s,'\"></label>',\"</td><td>\",'<input type=\"',s,'\" name=\"',s,'\" id=\"',s,'\">',\"</td>\",\"</tr>\"),t.push(\"</tbody></table>\"),n};o(i)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-prompt.js",
    "content": "define(\"ace/ext/prompt\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/lib/dom\",\"ace/lib/event\",\"ace/edit_session\",\"ace/undomanager\",\"ace/virtual_renderer\",\"ace/editor\",\"ace/multi_select\"],function(e,t,n){function c(e,t){var n=this.pixelToScreenCoordinates(e,t);return this.session.screenToDocumentPosition(Math.min(this.session.getScreenLength()-1,Math.max(n.row,0)),Math.max(n.column,0))}var r=e(\"../lib/lang\"),i=e(\"ace/lib/dom\"),s=e(\"ace/lib/event\"),o=e(\"ace/edit_session\").EditSession,u=e(\"ace/undomanager\").UndoManager,a=e(\"ace/virtual_renderer\").VirtualRenderer,f=e(\"ace/editor\").Editor,l=e(\"ace/multi_select\").MultiSelect;t.singleLineEditor=function(e){var t=new a;t.container.style.overflow=\"hidden\",t.screenToTextCoordinates=c,t.setStyle(\"ace_one-line\");var n=new f(t);return n.session.setUndoManager(new u),n.setOptions({showPrintMargin:!1,showGutter:!1,highlightGutterLine:!1,focusWaitTimout:0,maxLines:4}),n}}),function(){window.require([\"ace/ext/prompt\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-searchbox.js",
    "content": "define(\"ace/ext/searchbox\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/lang\",\"ace/lib/event\",\"ace/keyboard/hash_handler\",\"ace/lib/keys\"],function(e,t,n){var r=e(\"../lib/dom\"),i=e(\"../lib/lang\"),s=e(\"../lib/event\"),o=\"/* ------------------------------------------------------------------------------------------* Editor Search Form* --------------------------------------------------------------------------------------- */.ace_search {background-color: #ddd;border: 1px solid #cbcbcb;border-top: 0 none;max-width: 297px;overflow: hidden;margin: 0;padding: 4px;padding-right: 6px;padding-bottom: 0;position: absolute;top: 0px;z-index: 99;white-space: normal;}.ace_search.left {border-left: 0 none;border-radius: 0px 0px 5px 0px;left: 0;}.ace_search.right {border-radius: 0px 0px 0px 5px;border-right: 0 none;right: 0;}.ace_search_form, .ace_replace_form {border-radius: 3px;border: 1px solid #cbcbcb;float: left;margin-bottom: 4px;overflow: hidden;}.ace_search_form.ace_nomatch {outline: 1px solid red;}.ace_search_field {background-color: white;border-right: 1px solid #cbcbcb;border: 0 none;-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;display: block;float: left;height: 22px;outline: 0;padding: 0 7px;width: 214px;margin: 0;}.ace_searchbtn,.ace_replacebtn {background: #fff;border: 0 none;border-left: 1px solid #dcdcdc;cursor: pointer;display: block;float: left;height: 22px;margin: 0;padding: 0;position: relative;}.ace_searchbtn:last-child,.ace_replacebtn:last-child {border-top-right-radius: 3px;border-bottom-right-radius: 3px;}.ace_searchbtn:disabled {background: none;cursor: default;}.ace_searchbtn {background-position: 50% 50%;background-repeat: no-repeat;width: 27px;}.ace_searchbtn.prev {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADFJREFUeNpiSU1NZUAC/6E0I0yACYskCpsJiySKIiY0SUZk40FyTEgCjGgKwTRAgAEAQJUIPCE+qfkAAAAASUVORK5CYII=);    }.ace_searchbtn.next {background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAFCAYAAAB4ka1VAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAADRJREFUeNpiTE1NZQCC/0DMyIAKwGJMUAYDEo3M/s+EpvM/mkKwCQxYjIeLMaELoLMBAgwAU7UJObTKsvAAAAAASUVORK5CYII=);    }.ace_searchbtn_close {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0;border-radius: 50%;border: 0 none;color: #656565;cursor: pointer;display: block;float: right;font-family: Arial;font-size: 16px;height: 14px;line-height: 16px;margin: 5px 1px 9px 5px;padding: 0;text-align: center;width: 14px;}.ace_searchbtn_close:hover {background-color: #656565;background-position: 50% 100%;color: white;}.ace_replacebtn.prev {width: 54px}.ace_replacebtn.next {width: 27px}.ace_button {margin-left: 2px;cursor: pointer;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;overflow: hidden;opacity: 0.7;border: 1px solid rgba(100,100,100,0.23);padding: 1px;-moz-box-sizing: border-box;box-sizing:    border-box;color: black;}.ace_button:hover {background-color: #eee;opacity:1;}.ace_button:active {background-color: #ddd;}.ace_button.checked {border-color: #3399ff;opacity:1;}.ace_search_options{margin-bottom: 3px;text-align: right;-webkit-user-select: none;-moz-user-select: none;-o-user-select: none;-ms-user-select: none;user-select: none;}\",u=e(\"../keyboard/hash_handler\").HashHandler,a=e(\"../lib/keys\");r.importCssString(o,\"ace_searchbox\");var f='<div class=\"ace_search right\">    <button type=\"button\" action=\"hide\" class=\"ace_searchbtn_close\"></button>    <div class=\"ace_search_form\">        <input class=\"ace_search_field\" placeholder=\"Search for\" spellcheck=\"false\"></input>        <button type=\"button\" action=\"findNext\" class=\"ace_searchbtn next\"></button>        <button type=\"button\" action=\"findPrev\" class=\"ace_searchbtn prev\"></button>    </div>    <div class=\"ace_replace_form\">        <input class=\"ace_search_field\" placeholder=\"Replace with\" spellcheck=\"false\"></input>        <button type=\"button\" action=\"replaceAndFindNext\" class=\"ace_replacebtn\">Replace</button>        <button type=\"button\" action=\"replaceAll\" class=\"ace_replacebtn\">All</button>    </div>    <div class=\"ace_search_options\">        <span action=\"toggleRegexpMode\" class=\"ace_button\" title=\"RegExp Search\">.*</span>        <span action=\"toggleCaseSensitive\" class=\"ace_button\" title=\"CaseSensitive Search\">Aa</span>        <span action=\"toggleWholeWords\" class=\"ace_button\" title=\"Whole Word Search\">\\\\b</span>    </div></div>'.replace(/>\\s+/g,\">\"),l=function(e,t,n){var i=r.createElement(\"div\");i.innerHTML=f,this.element=i.firstChild,this.$init(),this.setEditor(e)};(function(){this.setEditor=function(e){e.searchBox=this,e.container.appendChild(this.element),this.editor=e},this.$initElements=function(e){this.searchBox=e.querySelector(\".ace_search_form\"),this.replaceBox=e.querySelector(\".ace_replace_form\"),this.searchOptions=e.querySelector(\".ace_search_options\"),this.regExpOption=e.querySelector(\"[action=toggleRegexpMode]\"),this.caseSensitiveOption=e.querySelector(\"[action=toggleCaseSensitive]\"),this.wholeWordOption=e.querySelector(\"[action=toggleWholeWords]\"),this.searchInput=this.searchBox.querySelector(\".ace_search_field\"),this.replaceInput=this.replaceBox.querySelector(\".ace_search_field\")},this.$init=function(){var e=this.element;this.$initElements(e);var t=this;s.addListener(e,\"mousedown\",function(e){setTimeout(function(){t.activeInput.focus()},0),s.stopPropagation(e)}),s.addListener(e,\"click\",function(e){var n=e.target||e.srcElement,r=n.getAttribute(\"action\");r&&t[r]?t[r]():t.$searchBarKb.commands[r]&&t.$searchBarKb.commands[r].exec(t),s.stopPropagation(e)}),s.addCommandKeyListener(e,function(e,n,r){var i=a.keyCodeToString(r),o=t.$searchBarKb.findKeyCommand(n,i);o&&o.exec&&(o.exec(t),s.stopEvent(e))}),this.$onChange=i.delayedCall(function(){t.find(!1,!1)}),s.addListener(this.searchInput,\"input\",function(){t.$onChange.schedule(20)}),s.addListener(this.searchInput,\"focus\",function(){t.activeInput=t.searchInput,t.searchInput.value&&t.highlight()}),s.addListener(this.replaceInput,\"focus\",function(){t.activeInput=t.replaceInput,t.searchInput.value&&t.highlight()})},this.$closeSearchBarKb=new u([{bindKey:\"Esc\",name:\"closeSearchBar\",exec:function(e){e.searchBox.hide()}}]),this.$searchBarKb=new u,this.$searchBarKb.bindKeys({\"Ctrl-f|Command-f|Ctrl-H|Command-Option-F\":function(e){var t=e.isReplace=!e.isReplace;e.replaceBox.style.display=t?\"\":\"none\",e[t?\"replaceInput\":\"searchInput\"].focus()},\"Ctrl-G|Command-G\":function(e){e.findNext()},\"Ctrl-Shift-G|Command-Shift-G\":function(e){e.findPrev()},esc:function(e){setTimeout(function(){e.hide()})},Return:function(e){e.activeInput==e.replaceInput&&e.replace(),e.findNext()},\"Shift-Return\":function(e){e.activeInput==e.replaceInput&&e.replace(),e.findPrev()},Tab:function(e){(e.activeInput==e.replaceInput?e.searchInput:e.replaceInput).focus()}}),this.$searchBarKb.addCommands([{name:\"toggleRegexpMode\",bindKey:{win:\"Alt-R|Alt-/\",mac:\"Ctrl-Alt-R|Ctrl-Alt-/\"},exec:function(e){e.regExpOption.checked=!e.regExpOption.checked,e.$syncOptions()}},{name:\"toggleCaseSensitive\",bindKey:{win:\"Alt-C|Alt-I\",mac:\"Ctrl-Alt-R|Ctrl-Alt-I\"},exec:function(e){e.caseSensitiveOption.checked=!e.caseSensitiveOption.checked,e.$syncOptions()}},{name:\"toggleWholeWords\",bindKey:{win:\"Alt-B|Alt-W\",mac:\"Ctrl-Alt-B|Ctrl-Alt-W\"},exec:function(e){e.wholeWordOption.checked=!e.wholeWordOption.checked,e.$syncOptions()}}]),this.$syncOptions=function(){r.setCssClass(this.regExpOption,\"checked\",this.regExpOption.checked),r.setCssClass(this.wholeWordOption,\"checked\",this.wholeWordOption.checked),r.setCssClass(this.caseSensitiveOption,\"checked\",this.caseSensitiveOption.checked),this.find(!1,!1)},this.highlight=function(e){this.editor.session.highlight(e||this.editor.$search.$options.re),this.editor.renderer.updateBackMarkers()},this.find=function(e,t){var n=this.editor.find(this.searchInput.value,{skipCurrent:e,backwards:t,wrap:!0,regExp:this.regExpOption.checked,caseSensitive:this.caseSensitiveOption.checked,wholeWord:this.wholeWordOption.checked}),i=!n&&this.searchInput.value;r.setCssClass(this.searchBox,\"ace_nomatch\",i),this.editor._emit(\"findSearchBox\",{match:!i}),this.highlight()},this.findNext=function(){this.find(!0,!1)},this.findPrev=function(){this.find(!0,!0)},this.replace=function(){this.editor.getReadOnly()||this.editor.replace(this.replaceInput.value)},this.replaceAndFindNext=function(){this.editor.getReadOnly()||(this.editor.replace(this.replaceInput.value),this.findNext())},this.replaceAll=function(){this.editor.getReadOnly()||this.editor.replaceAll(this.replaceInput.value)},this.hide=function(){this.element.style.display=\"none\",this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb),this.editor.focus()},this.show=function(e,t){this.element.style.display=\"\",this.replaceBox.style.display=t?\"\":\"none\",this.isReplace=t,e&&(this.searchInput.value=e),this.searchInput.focus(),this.searchInput.select(),this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb)}}).call(l.prototype),t.SearchBox=l,t.Search=function(e,t){var n=e.searchBox||new l(e);n.show(e.session.getTextRange(),t)}}),function(){window.require([\"ace/ext/searchbox\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-settings_menu.js",
    "content": "define(\"ace/ext/settings_menu\",[\"require\",\"exports\",\"module\",\"ace/ext/menu_tools/generate_settings_menu\",\"ace/ext/menu_tools/overlay_page\",\"ace/editor\"],function(e,t,n){function s(e){var t=document.getElementById(\"ace_settingsmenu\");t||i(e,r(e),\"0\",\"0\",\"0\")}var r=e(\"./menu_tools/generate_settings_menu\").generateSettingsMenu,i=e(\"./menu_tools/overlay_page\").overlayPage;n.exports.init=function(t){var n=e(\"ace/editor\").Editor;n.prototype.showSettingsMenu=function(){s(this)}}}),define(\"ace/ext/menu_tools/generate_settings_menu\",[\"require\",\"exports\",\"module\",\"ace/ext/menu_tools/element_generator\",\"ace/ext/menu_tools/add_editor_menu_options\",\"ace/ext/menu_tools/get_set_functions\"],function(e,t,n){var r=e(\"./element_generator\"),i=e(\"./add_editor_menu_options\").addEditorMenuOptions,s=e(\"./get_set_functions\").getSetFunctions;n.exports.generateSettingsMenu=function(t){function o(){n.sort(function(e,t){var n=e.getAttribute(\"contains\"),r=t.getAttribute(\"contains\");return n.localeCompare(r)})}function u(){var e=document.createElement(\"div\");return e.setAttribute(\"id\",\"ace_settingsmenu\"),n.forEach(function(t){e.appendChild(t)}),e}function a(e,n,i,s){var o,u=document.createElement(\"div\");return u.setAttribute(\"contains\",i),u.setAttribute(\"class\",\"ace_optionsMenuEntry\"),u.setAttribute(\"style\",\"clear: both;\"),u.appendChild(r.createLabel(i.replace(/^set/,\"\").replace(/([A-Z])/g,\" $1\").trim(),i)),Array.isArray(s)?(o=r.createSelection(i,s,n),o.addEventListener(\"change\",function(n){try{t.menuOptions[n.target.id].forEach(function(e){e.textContent!==n.target.textContent&&delete e.selected}),e[n.target.id](n.target.value)}catch(r){throw new Error(r)}})):typeof s==\"boolean\"?(o=r.createCheckbox(i,s,n),o.addEventListener(\"change\",function(t){try{e[t.target.id](!!t.target.checked)}catch(n){throw new Error(n)}})):(o=r.createInput(i,s,n),o.addEventListener(\"change\",function(t){try{t.target.value===\"true\"?e[t.target.id](!0):t.target.value===\"false\"?e[t.target.id](!1):e[t.target.id](t.target.value)}catch(n){throw new Error(n)}})),o.style.cssText=\"float:right;\",u.appendChild(o),u}function f(e,n,r,i){var s=t.menuOptions[e],o=n[i]();return typeof o==\"object\"&&(o=o.$id),s.forEach(function(e){e.value===o&&(e.selected=\"selected\")}),a(n,r,e,s)}function l(e){var r=e.functionName,i=e.parentObj,s=e.parentName,o,u=r.replace(/^set/,\"get\");if(t.menuOptions[r]!==undefined)n.push(f(r,i,s,u));else if(typeof i[u]==\"function\")try{o=i[u](),typeof o==\"object\"&&(o=o.$id),n.push(a(i,s,r,o))}catch(l){}}var n=[];return i(t),s(t).forEach(function(e){l(e)}),o(),u()}}),define(\"ace/ext/menu_tools/element_generator\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports.createOption=function(t){var n,r=document.createElement(\"option\");for(n in t)t.hasOwnProperty(n)&&(n===\"selected\"?r.setAttribute(n,t[n]):r[n]=t[n]);return r},n.exports.createCheckbox=function(t,n,r){var i=document.createElement(\"input\");return i.setAttribute(\"type\",\"checkbox\"),i.setAttribute(\"id\",t),i.setAttribute(\"name\",t),i.setAttribute(\"value\",n),i.setAttribute(\"class\",r),n&&i.setAttribute(\"checked\",\"checked\"),i},n.exports.createInput=function(t,n,r){var i=document.createElement(\"input\");return i.setAttribute(\"type\",\"text\"),i.setAttribute(\"id\",t),i.setAttribute(\"name\",t),i.setAttribute(\"value\",n),i.setAttribute(\"class\",r),i},n.exports.createLabel=function(t,n){var r=document.createElement(\"label\");return r.setAttribute(\"for\",n),r.textContent=t,r},n.exports.createSelection=function(t,r,i){var s=document.createElement(\"select\");return s.setAttribute(\"id\",t),s.setAttribute(\"name\",t),s.setAttribute(\"class\",i),r.forEach(function(e){s.appendChild(n.exports.createOption(e))}),s}}),define(\"ace/ext/menu_tools/add_editor_menu_options\",[\"require\",\"exports\",\"module\",\"ace/ext/modelist\",\"ace/ext/themelist\"],function(e,t,n){n.exports.addEditorMenuOptions=function(n){var r=e(\"../modelist\"),i=e(\"../themelist\");n.menuOptions={setNewLineMode:[{textContent:\"unix\",value:\"unix\"},{textContent:\"windows\",value:\"windows\"},{textContent:\"auto\",value:\"auto\"}],setTheme:[],setMode:[],setKeyboardHandler:[{textContent:\"ace\",value:\"\"},{textContent:\"vim\",value:\"ace/keyboard/vim\"},{textContent:\"emacs\",value:\"ace/keyboard/emacs\"}]},n.menuOptions.setTheme=i.themes.map(function(e){return{textContent:e.caption,value:e.theme}}),n.menuOptions.setMode=r.modes.map(function(e){return{textContent:e.name,value:e.mode}})}}),define(\"ace/ext/modelist\",[\"require\",\"exports\",\"module\"],function(e,t,n){function i(e){var t=a.text,n=e.split(/[\\/\\\\]/).pop();for(var i=0;i<r.length;i++)if(r[i].supportsFile(n)){t=r[i];break}return t}var r=[],s=function(e,t,n){this.name=e,this.caption=t,this.mode=\"ace/mode/\"+e,this.extensions=n;if(/\\^/.test(n))var r=n.replace(/\\|(\\^)?/g,function(e,t){return\"$|\"+(t?\"^\":\"^.*\\\\.\")})+\"$\";else var r=\"^.*\\\\.(\"+n+\")$\";this.extRe=new RegExp(r,\"gi\")};s.prototype.supportsFile=function(e){return e.match(this.extRe)};var o={ABAP:[\"abap\"],ActionScript:[\"as\"],ADA:[\"ada|adb\"],Apache_Conf:[\"^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd\"],AsciiDoc:[\"asciidoc\"],Assembly_x86:[\"asm\"],AutoHotKey:[\"ahk\"],BatchFile:[\"bat|cmd\"],C9Search:[\"c9search_results\"],C_Cpp:[\"cpp|c|cc|cxx|h|hh|hpp\"],Cirru:[\"cirru|cr\"],Clojure:[\"clj\"],Cobol:[\"CBL|COB\"],coffee:[\"coffee|cf|cson|^Cakefile\"],ColdFusion:[\"cfm\"],CSharp:[\"cs\"],CSS:[\"css\"],Curly:[\"curly\"],D:[\"d|di\"],Dart:[\"dart\"],Diff:[\"diff|patch\"],Dockerfile:[\"^Dockerfile\"],Dot:[\"dot\"],Erlang:[\"erl|hrl\"],EJS:[\"ejs\"],Forth:[\"frt|fs|ldr\"],FTL:[\"ftl\"],Gherkin:[\"feature\"],Glsl:[\"glsl|frag|vert\"],golang:[\"go\"],Groovy:[\"groovy\"],HAML:[\"haml\"],Handlebars:[\"hbs|handlebars|tpl|mustache\"],Haskell:[\"hs\"],haXe:[\"hx\"],HTML:[\"html|htm|xhtml\"],HTML_Ruby:[\"erb|rhtml|html.erb\"],INI:[\"ini|conf|cfg|prefs\"],Jack:[\"jack\"],Jade:[\"jade\"],Java:[\"java\"],JavaScript:[\"js|jsm\"],JSON:[\"json\"],JSONiq:[\"jq\"],JSP:[\"jsp\"],JSX:[\"jsx\"],Julia:[\"jl\"],LaTeX:[\"tex|latex|ltx|bib\"],LESS:[\"less\"],Liquid:[\"liquid\"],Lisp:[\"lisp\"],LiveScript:[\"ls\"],LogiQL:[\"logic|lql\"],LSL:[\"lsl\"],Lua:[\"lua\"],LuaPage:[\"lp\"],Lucene:[\"lucene\"],Makefile:[\"^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make\"],MATLAB:[\"matlab\"],Markdown:[\"md|markdown\"],MEL:[\"mel\"],MySQL:[\"mysql\"],MUSHCode:[\"mc|mush\"],Nix:[\"nix\"],ObjectiveC:[\"m|mm\"],OCaml:[\"ml|mli\"],Pascal:[\"pas|p\"],Perl:[\"pl|pm\"],pgSQL:[\"pgsql\"],PHP:[\"php|phtml\"],Powershell:[\"ps1\"],Prolog:[\"plg|prolog\"],Properties:[\"properties\"],Protobuf:[\"proto\"],Python:[\"py\"],R:[\"r\"],RDoc:[\"Rd\"],RHTML:[\"Rhtml\"],Ruby:[\"rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile\"],Rust:[\"rs\"],SASS:[\"sass\"],SCAD:[\"scad\"],Scala:[\"scala\"],Smarty:[\"smarty|tpl\"],Scheme:[\"scm|rkt\"],SCSS:[\"scss\"],SH:[\"sh|bash|^.bashrc\"],SJS:[\"sjs\"],Space:[\"space\"],snippets:[\"snippets\"],Soy_Template:[\"soy\"],SQL:[\"sql\"],Stylus:[\"styl|stylus\"],SVG:[\"svg\"],Tcl:[\"tcl\"],Tex:[\"tex\"],Text:[\"txt\"],Textile:[\"textile\"],Toml:[\"toml\"],Twig:[\"twig\"],Typescript:[\"ts|typescript|str\"],Vala:[\"vala\"],VBScript:[\"vbs\"],Velocity:[\"vm\"],Verilog:[\"v|vh|sv|svh\"],XML:[\"xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl\"],XQuery:[\"xq\"],YAML:[\"yaml|yml\"]},u={ObjectiveC:\"Objective-C\",CSharp:\"C#\",golang:\"Go\",C_Cpp:\"C/C++\",coffee:\"CoffeeScript\",HTML_Ruby:\"HTML (Ruby)\",FTL:\"FreeMarker\"},a={};for(var f in o){var l=o[f],c=(u[f]||f).replace(/_/g,\" \"),h=f.toLowerCase(),p=new s(h,c,l[0]);a[h]=p,r.push(p)}n.exports={getModeForPath:i,modes:r,modesByName:a}}),define(\"ace/ext/themelist\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\"],function(e,t,n){e(\"ace/lib/fixoldbrowsers\");var r=[[\"Chrome\"],[\"Clouds\"],[\"Crimson Editor\"],[\"Dawn\"],[\"Dreamweaver\"],[\"Eclipse\"],[\"GitHub\"],[\"Solarized Light\"],[\"TextMate\"],[\"Tomorrow\"],[\"XCode\"],[\"Kuroir\"],[\"KatzenMilch\"],[\"Ambiance\",\"ambiance\",\"dark\"],[\"Chaos\",\"chaos\",\"dark\"],[\"Clouds Midnight\",\"clouds_midnight\",\"dark\"],[\"Cobalt\",\"cobalt\",\"dark\"],[\"idle Fingers\",\"idle_fingers\",\"dark\"],[\"krTheme\",\"kr_theme\",\"dark\"],[\"Merbivore\",\"merbivore\",\"dark\"],[\"Merbivore Soft\",\"merbivore_soft\",\"dark\"],[\"Mono Industrial\",\"mono_industrial\",\"dark\"],[\"Monokai\",\"monokai\",\"dark\"],[\"Pastel on dark\",\"pastel_on_dark\",\"dark\"],[\"Solarized Dark\",\"solarized_dark\",\"dark\"],[\"Terminal\",\"terminal\",\"dark\"],[\"Tomorrow Night\",\"tomorrow_night\",\"dark\"],[\"Tomorrow Night Blue\",\"tomorrow_night_blue\",\"dark\"],[\"Tomorrow Night Bright\",\"tomorrow_night_bright\",\"dark\"],[\"Tomorrow Night 80s\",\"tomorrow_night_eighties\",\"dark\"],[\"Twilight\",\"twilight\",\"dark\"],[\"Vibrant Ink\",\"vibrant_ink\",\"dark\"]];t.themesByName={},t.themes=r.map(function(e){var n=e[1]||e[0].replace(/ /g,\"_\").toLowerCase(),r={caption:e[0],theme:\"ace/theme/\"+n,isDark:e[2]==\"dark\",name:n};return t.themesByName[n]=r,r})}),define(\"ace/ext/menu_tools/get_set_functions\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports.getSetFunctions=function(t){var n=[],r={editor:t,session:t.session,renderer:t.renderer},i=[],s=[\"setOption\",\"setUndoManager\",\"setDocument\",\"setValue\",\"setBreakpoints\",\"setScrollTop\",\"setScrollLeft\",\"setSelectionStyle\",\"setWrapLimitRange\"];return[\"renderer\",\"session\",\"editor\"].forEach(function(e){var t=r[e],o=e;for(var u in t)s.indexOf(u)===-1&&/^set/.test(u)&&i.indexOf(u)===-1&&(i.push(u),n.push({functionName:u,parentObj:t,parentName:o}))}),n}}),define(\"ace/ext/menu_tools/overlay_page\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../../lib/dom\"),i=\"#ace_settingsmenu, #kbshortcutmenu {background-color: #F7F7F7;color: black;box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55);padding: 1em 0.5em 2em 1em;overflow: auto;position: absolute;margin: 0;bottom: 0;right: 0;top: 0;z-index: 9991;cursor: default;}.ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu {box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25);background-color: rgba(255, 255, 255, 0.6);color: black;}.ace_optionsMenuEntry:hover {background-color: rgba(100, 100, 100, 0.1);-webkit-transition: all 0.5s;transition: all 0.3s}.ace_closeButton {background: rgba(245, 146, 146, 0.5);border: 1px solid #F48A8A;border-radius: 50%;padding: 7px;position: absolute;right: -8px;top: -8px;z-index: 1000;}.ace_closeButton{background: rgba(245, 146, 146, 0.9);}.ace_optionsMenuKey {color: darkslateblue;font-weight: bold;}.ace_optionsMenuCommand {color: darkcyan;font-weight: normal;}\";r.importCssString(i),n.exports.overlayPage=function(t,n,i,s,o,u){function l(e){e.keyCode===27&&a.click()}i=i?\"top: \"+i+\";\":\"\",o=o?\"bottom: \"+o+\";\":\"\",s=s?\"right: \"+s+\";\":\"\",u=u?\"left: \"+u+\";\":\"\";var a=document.createElement(\"div\"),f=document.createElement(\"div\");a.style.cssText=\"margin: 0; padding: 0; position: fixed; top:0; bottom:0; left:0; right:0;z-index: 9990; background-color: rgba(0, 0, 0, 0.3);\",a.addEventListener(\"click\",function(){document.removeEventListener(\"keydown\",l),a.parentNode.removeChild(a),t.focus(),a=null}),document.addEventListener(\"keydown\",l),f.style.cssText=i+s+o+u,f.addEventListener(\"click\",function(e){e.stopPropagation()});var c=r.createElement(\"div\");c.style.position=\"relative\";var h=r.createElement(\"div\");h.className=\"ace_closeButton\",h.addEventListener(\"click\",function(){a.click()}),c.appendChild(h),f.appendChild(c),f.appendChild(n),a.appendChild(f),document.body.appendChild(a),t.blur()}}),function(){window.require([\"ace/ext/settings_menu\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-spellcheck.js",
    "content": "define(\"ace/ext/spellcheck\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/editor\",\"ace/config\"],function(e,t,n){var r=e(\"../lib/event\");t.contextMenuHandler=function(e){var t=e.target,n=t.textInput.getElement();if(!t.selection.isEmpty())return;var i=t.getCursorPosition(),s=t.session.getWordRange(i.row,i.column),o=t.session.getTextRange(s);t.session.tokenRe.lastIndex=0;if(!t.session.tokenRe.test(o))return;var u=\"\\x01\\x01\",a=o+\" \"+u;n.value=a,n.setSelectionRange(o.length,o.length+1),n.setSelectionRange(0,0),n.setSelectionRange(0,o.length);var f=!1;r.addListener(n,\"keydown\",function l(){r.removeListener(n,\"keydown\",l),f=!0}),t.textInput.setInputHandler(function(e){console.log(e,a,n.selectionStart,n.selectionEnd);if(e==a)return\"\";if(e.lastIndexOf(a,0)===0)return e.slice(a.length);if(e.substr(n.selectionEnd)==a)return e.slice(0,-a.length);if(e.slice(-2)==u){var r=e.slice(0,-2);if(r.slice(-1)==\" \")return f?r.substring(0,n.selectionEnd):(r=r.slice(0,-1),t.session.replace(s,r),\"\")}return e})};var i=e(\"../editor\").Editor;e(\"../config\").defineOptions(i.prototype,\"editor\",{spellcheck:{set:function(e){var n=this.textInput.getElement();n.spellcheck=!!e,e?this.on(\"nativecontextmenu\",t.contextMenuHandler):this.removeListener(\"nativecontextmenu\",t.contextMenuHandler)},value:!0}})}),function(){window.require([\"ace/ext/spellcheck\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-split.js",
    "content": "define(\"ace/ext/split\",[\"require\",\"exports\",\"module\",\"ace/split\"],function(e,t,n){n.exports=e(\"../split\")}),define(\"ace/split\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/lib/event_emitter\",\"ace/editor\",\"ace/virtual_renderer\",\"ace/edit_session\"],function(e,t,n){function l(e,t){this.$u=e,this.$doc=t}var r=e(\"./lib/oop\"),i=e(\"./lib/lang\"),s=e(\"./lib/event_emitter\").EventEmitter,o=e(\"./editor\").Editor,u=e(\"./virtual_renderer\").VirtualRenderer,a=e(\"./edit_session\").EditSession,f=function(e,t,n){this.BELOW=1,this.BESIDE=0,this.$container=e,this.$theme=t,this.$splits=0,this.$editorCSS=\"\",this.$editors=[],this.$orientation=this.BESIDE,this.setSplits(n||1),this.$cEditor=this.$editors[0],this.on(\"focus\",function(e){this.$cEditor=e}.bind(this))};(function(){r.implement(this,s),this.$createEditor=function(){var e=document.createElement(\"div\");e.className=this.$editorCSS,e.style.cssText=\"position: absolute; top:0px; bottom:0px\",this.$container.appendChild(e);var t=new o(new u(e,this.$theme));return t.on(\"focus\",function(){this._emit(\"focus\",t)}.bind(this)),this.$editors.push(t),t.setFontSize(this.$fontSize),t},this.setSplits=function(e){var t;if(e<1)throw\"The number of splits have to be > 0!\";if(e==this.$splits)return;if(e>this.$splits){while(this.$splits<this.$editors.length&&this.$splits<e)t=this.$editors[this.$splits],this.$container.appendChild(t.container),t.setFontSize(this.$fontSize),this.$splits++;while(this.$splits<e)this.$createEditor(),this.$splits++}else while(this.$splits>e)t=this.$editors[this.$splits-1],this.$container.removeChild(t.container),this.$splits--;this.resize()},this.getSplits=function(){return this.$splits},this.getEditor=function(e){return this.$editors[e]},this.getCurrentEditor=function(){return this.$cEditor},this.focus=function(){this.$cEditor.focus()},this.blur=function(){this.$cEditor.blur()},this.setTheme=function(e){this.$editors.forEach(function(t){t.setTheme(e)})},this.setKeyboardHandler=function(e){this.$editors.forEach(function(t){t.setKeyboardHandler(e)})},this.forEach=function(e,t){this.$editors.forEach(e,t)},this.$fontSize=\"\",this.setFontSize=function(e){this.$fontSize=e,this.forEach(function(t){t.setFontSize(e)})},this.$cloneSession=function(e){var t=new a(e.getDocument(),e.getMode()),n=e.getUndoManager();if(n){var r=new l(n,t);t.setUndoManager(r)}return t.$informUndoManager=i.delayedCall(function(){t.$deltas=[]}),t.setTabSize(e.getTabSize()),t.setUseSoftTabs(e.getUseSoftTabs()),t.setOverwrite(e.getOverwrite()),t.setBreakpoints(e.getBreakpoints()),t.setUseWrapMode(e.getUseWrapMode()),t.setUseWorker(e.getUseWorker()),t.setWrapLimitRange(e.$wrapLimitRange.min,e.$wrapLimitRange.max),t.$foldData=e.$cloneFoldData(),t},this.setSession=function(e,t){var n;t==null?n=this.$cEditor:n=this.$editors[t];var r=this.$editors.some(function(t){return t.session===e});return r&&(e=this.$cloneSession(e)),n.setSession(e),e},this.getOrientation=function(){return this.$orientation},this.setOrientation=function(e){if(this.$orientation==e)return;this.$orientation=e,this.resize()},this.resize=function(){var e=this.$container.clientWidth,t=this.$container.clientHeight,n;if(this.$orientation==this.BESIDE){var r=e/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=r+\"px\",n.container.style.top=\"0px\",n.container.style.left=i*r+\"px\",n.container.style.height=t+\"px\",n.resize()}else{var s=t/this.$splits;for(var i=0;i<this.$splits;i++)n=this.$editors[i],n.container.style.width=e+\"px\",n.container.style.top=i*s+\"px\",n.container.style.left=\"0px\",n.container.style.height=s+\"px\",n.resize()}}}).call(f.prototype),function(){this.execute=function(e){this.$u.execute(e)},this.undo=function(){var e=this.$u.undo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.redo=function(){var e=this.$u.redo(!0);e&&this.$doc.selection.setSelectionRange(e)},this.reset=function(){this.$u.reset()},this.hasUndo=function(){return this.$u.hasUndo()},this.hasRedo=function(){return this.$u.hasRedo()}}.call(l.prototype),t.Split=f}),function(){window.require([\"ace/ext/split\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-static_highlight.js",
    "content": "define(\"ace/ext/static_highlight\",[\"require\",\"exports\",\"module\",\"ace/edit_session\",\"ace/layer/text\",\"ace/config\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../edit_session\").EditSession,i=e(\"../layer/text\").Text,s=\".ace_static_highlight {font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace;font-size: 12px;}.ace_static_highlight .ace_gutter {width: 25px !important;display: block;float: left;text-align: right;padding: 0 3px 0 0;margin-right: 3px;position: static !important;}.ace_static_highlight .ace_line { clear: both; }.ace_static_highlight .ace_gutter-cell {-moz-user-select: -moz-none;-khtml-user-select: none;-webkit-user-select: none;user-select: none;}.ace_static_highlight .ace_gutter-cell:before {content: counter(ace_line, decimal);counter-increment: ace_line;}.ace_static_highlight {counter-reset: ace_line;}\",o=e(\"../config\"),u=e(\"../lib/dom\"),a=function(e,t,n){var r=e.className.match(/lang-(\\w+)/),i=t.mode||r&&\"ace/mode/\"+r[1];if(!i)return!1;var s=t.theme||\"ace/theme/textmate\",o=\"\",f=[];if(e.firstElementChild){var l=0;for(var c=0;c<e.childNodes.length;c++){var h=e.childNodes[c];h.nodeType==3?(l+=h.data.length,o+=h.data):f.push(l,h)}}else o=u.getInnerText(e),t.trim&&(o=o.trim());a.render(o,i,s,t.firstLineNumber,!t.showGutter,function(t){u.importCssString(t.css,\"ace_highlight\"),e.innerHTML=t.html;var r=e.firstChild.firstChild;for(var i=0;i<f.length;i+=2){var s=t.session.doc.indexToPosition(f[i]),o=f[i+1],a=r.children[s.row];a&&a.appendChild(o)}n&&n()})};a.render=function(e,t,n,i,s,u){function c(){var r=a.renderSync(e,t,n,i,s);return u?u(r):r}var f=1,l=r.prototype.$modes;return typeof n==\"string\"&&(f++,o.loadModule([\"theme\",n],function(e){n=e,--f||c()})),typeof t==\"string\"&&(f++,o.loadModule([\"mode\",t],function(e){l[t]||(l[t]=new e.Mode),t=l[t],--f||c()})),--f||c()},a.renderSync=function(e,t,n,o,u){o=parseInt(o||1,10);var a=new r(\"\");a.setUseWorker(!1),a.setMode(t);var f=new i(document.createElement(\"div\"));f.setSession(a),f.config={characterWidth:10,lineHeight:20},a.setValue(e);var l=[],c=a.getLength();for(var h=0;h<c;h++)l.push(\"<div class='ace_line'>\"),u||l.push(\"<span class='ace_gutter ace_gutter-cell' unselectable='on'></span>\"),f.$renderLine(l,h,!0,!1),l.push(\"\\n</div>\");var p=\"<div class='\"+n.cssClass+\"'>\"+\"<div class='ace_static_highlight' style='counter-reset:ace_line \"+(o-1)+\"'>\"+l.join(\"\")+\"</div>\"+\"</div>\";return f.destroy(),{css:s+n.cssText,html:p,session:a}},n.exports=a,n.exports.highlight=a}),function(){window.require([\"ace/ext/static_highlight\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-statusbar.js",
    "content": "define(\"ace/ext/statusbar\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"ace/lib/dom\"),i=e(\"ace/lib/lang\"),s=function(e,t){this.element=r.createElement(\"div\"),this.element.className=\"ace_status-indicator\",this.element.style.cssText=\"display: inline-block;\",t.appendChild(this.element);var n=i.delayedCall(function(){this.updateStatus(e)}.bind(this));e.on(\"changeStatus\",function(){n.schedule(100)}),e.on(\"changeSelection\",function(){n.schedule(100)})};(function(){this.updateStatus=function(e){function n(e,n){e&&t.push(e,n||\"|\")}var t=[];e.$vimModeHandler?n(e.$vimModeHandler.getStatusText()):e.commands.recording&&n(\"REC\");var r=e.selection.lead;n(r.row+\":\"+r.column,\" \");if(!e.selection.isEmpty()){var i=e.getSelectionRange();n(\"(\"+(i.end.row-i.start.row)+\":\"+(i.end.column-i.start.column)+\")\")}t.pop(),this.element.textContent=t.join(\"\")}}).call(s.prototype),t.StatusBar=s}),function(){window.require([\"ace/ext/statusbar\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-textarea.js",
    "content": "define(\"ace/ext/textarea\",[\"require\",\"exports\",\"module\",\"ace/lib/event\",\"ace/lib/useragent\",\"ace/lib/net\",\"ace/ace\",\"ace/theme/textmate\",\"ace/mode/text\"],function(e,t,n){function a(e,t){for(var n in t)e.style[n]=t[n]}function f(e,t){if(e.type!=\"textarea\")throw new Error(\"Textarea required!\");var n=e.parentNode,i=document.createElement(\"div\"),s=function(){var t=\"position:relative;\";[\"margin-top\",\"margin-left\",\"margin-right\",\"margin-bottom\"].forEach(function(n){t+=n+\":\"+u(e,i,n)+\";\"});var n=u(e,i,\"width\")||e.clientWidth+\"px\",r=u(e,i,\"height\")||e.clientHeight+\"px\";t+=\"height:\"+r+\";width:\"+n+\";\",t+=\"display:inline-block;\",i.setAttribute(\"style\",t)};r.addListener(window,\"resize\",s),s(),n.insertBefore(i,e.nextSibling);while(n!==document){if(n.tagName.toUpperCase()===\"FORM\"){var o=n.onsubmit;n.onsubmit=function(n){e.value=t(),o&&o.call(this,n)};break}n=n.parentNode}return i}function l(t,n,r){s.loadScript(t,function(){e([n],r)})}function c(n,r,i,s,o,u){function c(e){return e===\"true\"||e==1}var a=n.getSession(),f=n.renderer;return u=u||l,n.setDisplaySettings=function(e){e==null&&(e=i.style.display==\"none\"),e?(i.style.display=\"block\",i.hideButton.focus(),n.on(\"focus\",function t(){n.removeListener(\"focus\",t),i.style.display=\"none\"})):n.focus()},n.$setOption=n.setOption,n.setOption=function(t,i){if(o[t]==i)return;switch(t){case\"mode\":i!=\"text\"?u(\"mode-\"+i+\".js\",\"ace/mode/\"+i,function(){var t=e(\"../mode/\"+i).Mode;a.setMode(new t)}):a.setMode(new(e(\"../mode/text\").Mode));break;case\"theme\":i!=\"textmate\"?u(\"theme-\"+i+\".js\",\"ace/theme/\"+i,function(){n.setTheme(\"ace/theme/\"+i)}):n.setTheme(\"ace/theme/textmate\");break;case\"fontSize\":r.style.fontSize=i;break;case\"keybindings\":switch(i){case\"vim\":n.setKeyboardHandler(\"ace/keyboard/vim\");break;case\"emacs\":n.setKeyboardHandler(\"ace/keyboard/emacs\");break;default:n.setKeyboardHandler(null)}break;case\"softWrap\":switch(i){case\"off\":a.setUseWrapMode(!1),f.setPrintMarginColumn(80);break;case\"40\":a.setUseWrapMode(!0),a.setWrapLimitRange(40,40),f.setPrintMarginColumn(40);break;case\"80\":a.setUseWrapMode(!0),a.setWrapLimitRange(80,80),f.setPrintMarginColumn(80);break;case\"free\":a.setUseWrapMode(!0),a.setWrapLimitRange(null,null),f.setPrintMarginColumn(80)}break;default:n.$setOption(t,c(i))}o[t]=i},n.getOption=function(e){return o[e]},n.getOptions=function(){return o},n.setOptions(t.options),n}function h(e,t,n,i){function f(e,t,n,r){if(!n){e.push(\"<input type='checkbox' title='\",t,\"' \",r==\"true\"?\"checked='true'\":\"\",\"'></input>\");return}e.push(\"<select title='\"+t+\"'>\");for(var i in n)e.push(\"<option value='\"+i+\"' \"),r==i&&e.push(\" selected \"),e.push(\">\",n[i],\"</option>\");e.push(\"</select>\")}var s=null,o={mode:\"Mode:\",gutter:\"Display Gutter:\",theme:\"Theme:\",fontSize:\"Font Size:\",softWrap:\"Soft Wrap:\",keybindings:\"Keyboard\",showPrintMargin:\"Show Print Margin:\",useSoftTabs:\"Use Soft Tabs:\",showInvisibles:\"Show Invisibles\"},u={mode:{text:\"Plain\",javascript:\"JavaScript\",xml:\"XML\",html:\"HTML\",css:\"CSS\",scss:\"SCSS\",python:\"Python\",php:\"PHP\",java:\"Java\",ruby:\"Ruby\",c_cpp:\"C/C++\",coffee:\"CoffeeScript\",json:\"json\",perl:\"Perl\",clojure:\"Clojure\",ocaml:\"OCaml\",csharp:\"C#\",haxe:\"haXe\",svg:\"SVG\",textile:\"Textile\",groovy:\"Groovy\",liquid:\"Liquid\",Scala:\"Scala\"},theme:{clouds:\"Clouds\",clouds_midnight:\"Clouds Midnight\",cobalt:\"Cobalt\",crimson_editor:\"Crimson Editor\",dawn:\"Dawn\",eclipse:\"Eclipse\",idle_fingers:\"Idle Fingers\",kr_theme:\"Kr Theme\",merbivore:\"Merbivore\",merbivore_soft:\"Merbivore Soft\",mono_industrial:\"Mono Industrial\",monokai:\"Monokai\",pastel_on_dark:\"Pastel On Dark\",solarized_dark:\"Solarized Dark\",solarized_light:\"Solarized Light\",textmate:\"Textmate\",twilight:\"Twilight\",vibrant_ink:\"Vibrant Ink\"},gutter:s,fontSize:{\"10px\":\"10px\",\"11px\":\"11px\",\"12px\":\"12px\",\"14px\":\"14px\",\"16px\":\"16px\"},softWrap:{off:\"Off\",40:\"40\",80:\"80\",free:\"Free\"},keybindings:{ace:\"ace\",vim:\"vim\",emacs:\"emacs\"},showPrintMargin:s,useSoftTabs:s,showInvisibles:s},a=[];a.push(\"<table><tr><th>Setting</th><th>Value</th></tr>\");for(var l in i)a.push(\"<tr><td>\",o[l],\"</td>\"),a.push(\"<td>\"),f(a,l,u[l],i[l]),a.push(\"</td></tr>\");a.push(\"</table>\"),e.innerHTML=a.join(\"\");var c=function(e){var t=e.currentTarget;n.setOption(t.title,t.value)},h=function(e){var t=e.currentTarget;n.setOption(t.title,t.checked)},p=e.getElementsByTagName(\"select\");for(var d=0;d<p.length;d++)p[d].onchange=c;var v=e.getElementsByTagName(\"input\");for(var d=0;d<v.length;d++)v[d].onclick=h;var m=document.createElement(\"input\");m.type=\"button\",m.value=\"Hide\",r.addListener(m,\"click\",function(){n.setDisplaySettings(!1)}),e.appendChild(m),e.hideButton=m}var r=e(\"../lib/event\"),i=e(\"../lib/useragent\"),s=e(\"../lib/net\"),o=e(\"../ace\");e(\"../theme/textmate\"),n.exports=t=o;var u=function(e,t,n){var r=e.style[n];r||(window.getComputedStyle?r=window.getComputedStyle(e,\"\").getPropertyValue(n):r=e.currentStyle[n]);if(!r||r==\"auto\"||r==\"intrinsic\")r=t.style[n];return r};t.transformTextarea=function(e,t){var n,s=f(e,function(){return n.getValue()});e.style.display=\"none\",s.style.background=\"white\";var u=document.createElement(\"div\");a(u,{top:\"0px\",left:\"0px\",right:\"0px\",bottom:\"0px\",border:\"1px solid gray\",position:\"absolute\"}),s.appendChild(u);var l=document.createElement(\"div\");a(l,{position:\"absolute\",right:\"0px\",bottom:\"0px\",background:\"red\",cursor:\"nw-resize\",borderStyle:\"solid\",borderWidth:\"9px 8px 10px 9px\",width:\"2px\",borderColor:\"lightblue gray gray lightblue\",zIndex:101});var p=document.createElement(\"div\"),d={top:\"0px\",left:\"20%\",right:\"0px\",bottom:\"0px\",position:\"absolute\",padding:\"5px\",zIndex:100,color:\"white\",display:\"none\",overflow:\"auto\",fontSize:\"14px\",boxShadow:\"-5px 2px 3px gray\"};i.isOldIE?d.backgroundColor=\"#333\":d.backgroundColor=\"rgba(0, 0, 0, 0.6)\",a(p,d),s.appendChild(p);var v={},m=o.edit(u);n=m.getSession(),n.setValue(e.value||e.innerHTML),m.focus(),s.appendChild(l),c(m,u,p,o,v,t),h(p,l,m,v);var g=\"\";return r.addListener(l,\"mousemove\",function(e){var t=this.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;n+r<(t.width+t.height)/2?(this.style.cursor=\"pointer\",g=\"toggle\"):(g=\"resize\",this.style.cursor=\"nw-resize\")}),r.addListener(l,\"mousedown\",function(e){if(g==\"toggle\"){m.setDisplaySettings();return}s.style.zIndex=1e5;var t=s.getBoundingClientRect(),n=t.width+t.left-e.clientX,i=t.height+t.top-e.clientY;r.capture(l,function(e){s.style.width=e.clientX-t.left+n+\"px\",s.style.height=e.clientY-t.top+i+\"px\",m.resize()},function(){})}),m},t.options={mode:\"text\",theme:\"textmate\",gutter:\"false\",fontSize:\"12px\",softWrap:\"off\",keybindings:\"ace\",showPrintMargin:\"false\",useSoftTabs:\"true\",showInvisibles:\"false\"}}),function(){window.require([\"ace/ext/textarea\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-themelist.js",
    "content": "define(\"ace/ext/themelist\",[\"require\",\"exports\",\"module\",\"ace/lib/fixoldbrowsers\"],function(e,t,n){e(\"ace/lib/fixoldbrowsers\");var r=[[\"Chrome\"],[\"Clouds\"],[\"Crimson Editor\"],[\"Dawn\"],[\"Dreamweaver\"],[\"Eclipse\"],[\"GitHub\"],[\"Solarized Light\"],[\"TextMate\"],[\"Tomorrow\"],[\"XCode\"],[\"Kuroir\"],[\"KatzenMilch\"],[\"Ambiance\",\"ambiance\",\"dark\"],[\"Chaos\",\"chaos\",\"dark\"],[\"Clouds Midnight\",\"clouds_midnight\",\"dark\"],[\"Cobalt\",\"cobalt\",\"dark\"],[\"idle Fingers\",\"idle_fingers\",\"dark\"],[\"krTheme\",\"kr_theme\",\"dark\"],[\"Merbivore\",\"merbivore\",\"dark\"],[\"Merbivore Soft\",\"merbivore_soft\",\"dark\"],[\"Mono Industrial\",\"mono_industrial\",\"dark\"],[\"Monokai\",\"monokai\",\"dark\"],[\"Pastel on dark\",\"pastel_on_dark\",\"dark\"],[\"Solarized Dark\",\"solarized_dark\",\"dark\"],[\"Terminal\",\"terminal\",\"dark\"],[\"Tomorrow Night\",\"tomorrow_night\",\"dark\"],[\"Tomorrow Night Blue\",\"tomorrow_night_blue\",\"dark\"],[\"Tomorrow Night Bright\",\"tomorrow_night_bright\",\"dark\"],[\"Tomorrow Night 80s\",\"tomorrow_night_eighties\",\"dark\"],[\"Twilight\",\"twilight\",\"dark\"],[\"Vibrant Ink\",\"vibrant_ink\",\"dark\"]];t.themesByName={},t.themes=r.map(function(e){var n=e[1]||e[0].replace(/ /g,\"_\").toLowerCase(),r={caption:e[0],theme:\"ace/theme/\"+n,isDark:e[2]==\"dark\",name:n};return t.themesByName[n]=r,r})}),function(){window.require([\"ace/ext/themelist\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/ext-whitespace.js",
    "content": "define(\"ace/ext/whitespace\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../lib/lang\");t.$detectIndentation=function(e,t){function h(e){var t=0;for(var r=e;r<n.length;r+=e)t+=n[r]||0;return t}var n=[],r=[],i=0,s=0,o=Math.min(e.length,1e3);for(var u=0;u<o;u++){var a=e[u];if(!/^\\s*[^*+\\-\\s]/.test(a))continue;var f=a.match(/^\\t*/)[0].length;a[0]==\"\t\"&&i++;var l=a.match(/^ */)[0].length;if(l&&a[l]!=\"\t\"){var c=l-s;c>0&&!(s%c)&&!(l%c)&&(r[c]=(r[c]||0)+1),n[l]=(n[l]||0)+1}s=l;while(u<o&&a[a.length-1]==\"\\\\\")a=e[u++]}if(!n.length)return;var p=r.reduce(function(e,t){return e+t},0),d={score:0,length:0},v=0;for(var u=1;u<12;u++){if(u==1){v=h(u);var m=1}else var m=h(u)/v;r[u]&&(m+=r[u]/p),m>d.score&&(d={score:m,length:u})}if(d.score&&d.score>1.4)var g=d.length;if(i>v+1)return{ch:\"\t\",length:g};if(v+1>i)return{ch:\" \",length:g}},t.detectIndentation=function(e){var n=e.getLines(0,1e3),r=t.$detectIndentation(n)||{};return r.ch&&e.setUseSoftTabs(r.ch==\" \"),r.length&&e.setTabSize(r.length),r},t.trimTrailingSpace=function(e,t){var n=e.getDocument(),r=n.getAllLines(),i=t?-1:0;for(var s=0,o=r.length;s<o;s++){var u=r[s],a=u.search(/\\s+$/);a>i&&n.removeInLine(s,a,u.length)}},t.convertIndentation=function(e,t,n){var i=e.getTabString()[0],s=e.getTabSize();n||(n=s),t||(t=i);var o=t==\"\t\"?t:r.stringRepeat(t,n),u=e.doc,a=u.getAllLines(),f={},l={};for(var c=0,h=a.length;c<h;c++){var p=a[c],d=p.match(/^\\s*/)[0];if(d){var v=e.$getStringScreenWidth(d)[0],m=Math.floor(v/s),g=v%s,y=f[m]||(f[m]=r.stringRepeat(o,m));y+=l[g]||(l[g]=r.stringRepeat(\" \",g)),y!=d&&(u.removeInLine(c,0,d.length),u.insertInLine({row:c,column:0},y))}}e.setTabSize(n),e.setUseSoftTabs(t==\" \")},t.$parseStringArg=function(e){var t={};/t/.test(e)?t.ch=\"\t\":/s/.test(e)&&(t.ch=\" \");var n=e.match(/\\d+/);return n&&(t.length=parseInt(n[0],10)),t},t.$parseArg=function(e){return e?typeof e==\"string\"?t.$parseStringArg(e):typeof e.text==\"string\"?t.$parseStringArg(e.text):e:{}},t.commands=[{name:\"detectIndentation\",exec:function(e){t.detectIndentation(e.session)}},{name:\"trimTrailingSpace\",exec:function(e){t.trimTrailingSpace(e.session)}},{name:\"convertIndentation\",exec:function(e,n){var r=t.$parseArg(n);t.convertIndentation(e.session,r.ch,r.length)}},{name:\"setIndentation\",exec:function(e,n){var r=t.$parseArg(n);r.length&&e.session.setTabSize(r.length),r.ch&&e.session.setUseSoftTabs(r.ch==\" \")}}]}),function(){window.require([\"ace/ext/whitespace\"],function(){})}()"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/keybinding-emacs.js",
    "content": "define(\"ace/keyboard/emacs\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\",\"ace/incremental_search\",\"ace/commands/incremental_search_commands\",\"ace/keyboard/hash_handler\",\"ace/lib/keys\"],function(e,t,n){var r=e(\"../lib/dom\");e(\"../incremental_search\");var i=e(\"../commands/incremental_search_commands\"),s=function(e,t){var n=this.scroller.getBoundingClientRect(),r=Math.floor((e+this.scrollLeft-n.left-this.$padding)/this.characterWidth),i=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(i,r)},o=e(\"./hash_handler\").HashHandler;t.handler=new o,t.handler.isEmacs=!0,t.handler.$id=\"ace/keyboard/emacs\";var u=!1,a,f;t.handler.attach=function(e){u||(u=!0,r.importCssString(\"            .emacs-mode .ace_cursor{                border: 2px rgba(50,250,50,0.8) solid!important;                -moz-box-sizing: border-box!important;                -webkit-box-sizing: border-box!important;                box-sizing: border-box!important;                background-color: rgba(0,250,0,0.9);                opacity: 0.5;            }            .emacs-mode .ace_hidden-cursors .ace_cursor{                opacity: 1;                background-color: transparent;            }            .emacs-mode .ace_overwrite-cursors .ace_cursor {                opacity: 1;                background-color: transparent;                border-width: 0 0 2px 2px !important;            }            .emacs-mode .ace_text-layer {                z-index: 4            }            .emacs-mode .ace_cursor-layer {                z-index: 2            }\",\"emacsMode\")),a=e.session.$selectLongWords,e.session.$selectLongWords=!0,f=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.$emacsMark=null,e.session.$emacsMarkRing=e.session.$emacsMarkRing||[],e.emacsMark=function(){return this.session.$emacsMark},e.setEmacsMark=function(e){this.session.$emacsMark=e},e.pushEmacsMark=function(e,t){var n=this.session.$emacsMark;n&&this.session.$emacsMarkRing.push(n),!e||t?this.setEmacsMark(e):this.session.$emacsMarkRing.push(e)},e.popEmacsMark=function(){var e=this.emacsMark();return e?(this.setEmacsMark(null),e):this.session.$emacsMarkRing.pop()},e.getLastEmacsMark=function(e){return this.session.$emacsMark||this.session.$emacsMarkRing.slice(-1)[0]},e.on(\"click\",c),e.on(\"changeSession\",l),e.renderer.screenToTextCoordinates=s,e.setStyle(\"emacs-mode\"),e.commands.addCommands(v),t.handler.platform=e.commands.platform,e.$emacsModeHandler=this,e.addEventListener(\"copy\",this.onCopy),e.addEventListener(\"paste\",this.onPaste)},t.handler.detach=function(e){delete e.renderer.screenToTextCoordinates,e.session.$selectLongWords=a,e.session.$useEmacsStyleLineStart=f,e.removeEventListener(\"click\",c),e.removeEventListener(\"changeSession\",l),e.unsetStyle(\"emacs-mode\"),e.commands.removeCommands(v),e.removeEventListener(\"copy\",this.onCopy),e.removeEventListener(\"paste\",this.onPaste)};var l=function(e){e.oldSession&&(e.oldSession.$selectLongWords=a,e.oldSession.$useEmacsStyleLineStart=f),a=e.session.$selectLongWords,e.session.$selectLongWords=!0,f=e.session.$useEmacsStyleLineStart,e.session.$useEmacsStyleLineStart=!0,e.session.hasOwnProperty(\"$emacsMark\")||(e.session.$emacsMark=null),e.session.hasOwnProperty(\"$emacsMarkRing\")||(e.session.$emacsMarkRing=[])},c=function(e){e.editor.session.$emacsMark=null},h=e(\"../lib/keys\").KEY_MODS,p={C:\"ctrl\",S:\"shift\",M:\"alt\",CMD:\"command\"},d=[\"C-S-M-CMD\",\"S-M-CMD\",\"C-M-CMD\",\"C-S-CMD\",\"C-S-M\",\"M-CMD\",\"S-CMD\",\"S-M\",\"C-CMD\",\"C-M\",\"C-S\",\"CMD\",\"M\",\"S\",\"C\"];d.forEach(function(e){var t=0;e.split(\"-\").forEach(function(e){t|=h[p[e]]}),p[t]=e.toLowerCase()+\"-\"}),t.handler.onCopy=function(e,n){if(n.$handlesEmacsOnCopy)return;n.$handlesEmacsOnCopy=!0,t.handler.commands.killRingSave.exec(n),delete n.$handlesEmacsOnCopy},t.handler.onPaste=function(e,t){t.pushEmacsMark(t.getCursorPosition())},t.handler.bindKey=function(e,t){if(!e)return;var n=this.commandKeyBinding;e.split(\"|\").forEach(function(e){e=e.toLowerCase(),n[e]=t;var r=e.split(\" \").slice(0,-1);r.reduce(function(e,t,n){var r=e[n-1]?e[n-1]+\" \":\"\";return e.concat([r+t])},[]).forEach(function(e){n[e]||(n[e]=\"null\")})},this)},t.handler.handleKeyboard=function(e,t,n,r){if(r===-1)return undefined;var i=e.editor;if(t==-1){i.pushEmacsMark();if(e.count){var s=(new Array(e.count+1)).join(n);return e.count=null,{command:\"insertstring\",args:s}}}if(n==\"\\0\")return undefined;var o=p[t];if(o==\"c-\"||e.universalArgument){var u=String(e.count||0),a=parseInt(n[n.length-1]);if(typeof a==\"number\"&&!isNaN(a))return e.count=parseInt(u+a),{command:\"null\"};e.universalArgument&&(e.count=4)}e.universalArgument=!1,o&&(n=o+n),e.keyChain&&(n=e.keyChain+=\" \"+n);var f=this.commandKeyBinding[n];e.keyChain=f==\"null\"?n:\"\";if(!f)return undefined;if(f===\"null\")return{command:\"null\"};if(f===\"universalArgument\")return e.universalArgument=!0,{command:\"null\"};var l;typeof f!=\"string\"&&(l=f.args,f.command&&(f=f.command),f===\"goorselect\"&&(f=i.emacsMark()?l[1]:l[0],l=null));if(typeof f==\"string\"){(f===\"insertstring\"||f===\"splitline\"||f===\"togglecomment\")&&i.pushEmacsMark(),f=this.commands[f]||i.commands.commands[f];if(!f)return undefined}!f.readonly&&!f.isYank&&(e.lastCommand=null);if(e.count){var a=e.count;e.count=0;if(!f||!f.handlesCount)return{args:l,command:{exec:function(e,t){for(var n=0;n<a;n++)f.exec(e,t)}}};l||(l={}),typeof l==\"object\"&&(l.count=a)}return{command:f,args:l}},t.emacsKeys={\"Up|C-p\":{command:\"goorselect\",args:[\"golineup\",\"selectup\"]},\"Down|C-n\":{command:\"goorselect\",args:[\"golinedown\",\"selectdown\"]},\"Left|C-b\":{command:\"goorselect\",args:[\"gotoleft\",\"selectleft\"]},\"Right|C-f\":{command:\"goorselect\",args:[\"gotoright\",\"selectright\"]},\"C-Left|M-b\":{command:\"goorselect\",args:[\"gotowordleft\",\"selectwordleft\"]},\"C-Right|M-f\":{command:\"goorselect\",args:[\"gotowordright\",\"selectwordright\"]},\"Home|C-a\":{command:\"goorselect\",args:[\"gotolinestart\",\"selecttolinestart\"]},\"End|C-e\":{command:\"goorselect\",args:[\"gotolineend\",\"selecttolineend\"]},\"C-Home|S-M-,\":{command:\"goorselect\",args:[\"gotostart\",\"selecttostart\"]},\"C-End|S-M-.\":{command:\"goorselect\",args:[\"gotoend\",\"selecttoend\"]},\"S-Up|S-C-p\":\"selectup\",\"S-Down|S-C-n\":\"selectdown\",\"S-Left|S-C-b\":\"selectleft\",\"S-Right|S-C-f\":\"selectright\",\"S-C-Left|S-M-b\":\"selectwordleft\",\"S-C-Right|S-M-f\":\"selectwordright\",\"S-Home|S-C-a\":\"selecttolinestart\",\"S-End|S-C-e\":\"selecttolineend\",\"S-C-Home\":\"selecttostart\",\"S-C-End\":\"selecttoend\",\"C-l\":\"recenterTopBottom\",\"M-s\":\"centerselection\",\"M-g\":\"gotoline\",\"C-x C-p\":\"selectall\",\"C-Down\":{command:\"goorselect\",args:[\"gotopagedown\",\"selectpagedown\"]},\"C-Up\":{command:\"goorselect\",args:[\"gotopageup\",\"selectpageup\"]},\"PageDown|C-v\":{command:\"goorselect\",args:[\"gotopagedown\",\"selectpagedown\"]},\"PageUp|M-v\":{command:\"goorselect\",args:[\"gotopageup\",\"selectpageup\"]},\"S-C-Down\":\"selectpagedown\",\"S-C-Up\":\"selectpageup\",\"C-s\":\"iSearch\",\"C-r\":\"iSearchBackwards\",\"M-C-s\":\"findnext\",\"M-C-r\":\"findprevious\",\"S-M-5\":\"replace\",Backspace:\"backspace\",\"Delete|C-d\":\"del\",\"Return|C-m\":{command:\"insertstring\",args:\"\\n\"},\"C-o\":\"splitline\",\"M-d|C-Delete\":{command:\"killWord\",args:\"right\"},\"C-Backspace|M-Backspace|M-Delete\":{command:\"killWord\",args:\"left\"},\"C-k\":\"killLine\",\"C-y|S-Delete\":\"yank\",\"M-y\":\"yankRotate\",\"C-g\":\"keyboardQuit\",\"C-w\":\"killRegion\",\"M-w\":\"killRingSave\",\"C-Space\":\"setMark\",\"C-x C-x\":\"exchangePointAndMark\",\"C-t\":\"transposeletters\",\"M-u\":\"touppercase\",\"M-l\":\"tolowercase\",\"M-/\":\"autocomplete\",\"C-u\":\"universalArgument\",\"M-;\":\"togglecomment\",\"C-/|C-x u|S-C--|C-z\":\"undo\",\"S-C-/|S-C-x u|C--|S-C-z\":\"redo\",\"C-x r\":\"selectRectangularRegion\",\"M-x\":{command:\"focusCommandLine\",args:\"M-x \"}},t.handler.bindKeys(t.emacsKeys),t.handler.addCommands({recenterTopBottom:function(e){var t=e.renderer,n=t.$cursorLayer.getPixelPosition(),r=t.$size.scrollerHeight-t.lineHeight,i=t.scrollTop;Math.abs(n.top-i)<2?i=n.top-r:Math.abs(n.top-i-r*.5)<2?i=n.top:i=n.top-r*.5,e.session.setScrollTop(i)},selectRectangularRegion:function(e){e.multiSelect.toggleBlockSelection()},setMark:{exec:function(e,t){if(t&&t.count){var n=e.popEmacsMark();n&&e.selection.moveCursorToPosition(n);return}var n=e.emacsMark(),r=!0;if(r&&(n||!e.selection.isEmpty())){e.pushEmacsMark(),e.clearSelection();return}if(n){var i=e.getCursorPosition();if(e.selection.isEmpty()&&n.row==i.row&&n.column==i.column){e.pushEmacsMark();return}}n=e.getCursorPosition(),e.setEmacsMark(n),e.selection.setSelectionAnchor(n.row,n.column)},readonly:!0,handlesCount:!0,multiSelectAction:\"forEach\"},exchangePointAndMark:{exec:function(e,t){var n=e.selection;if(t.count){var r=e.getCursorPosition();n.clearSelection(),n.moveCursorToPosition(e.popEmacsMark()),e.pushEmacsMark(r);return}var i=e.getLastEmacsMark(),s=n.getRange();if(s.isEmpty()){n.selectToPosition(i);return}n.setSelectionRange(s,!n.isBackwards())},readonly:!0,handlesCount:!0,multiSelectAction:\"forEach\"},killWord:{exec:function(e,n){e.clearSelection(),n==\"left\"?e.selection.selectWordLeft():e.selection.selectWordRight();var r=e.getSelectionRange(),i=e.session.getTextRange(r);t.killRing.add(i),e.session.remove(r),e.clearSelection()},multiSelectAction:\"forEach\"},killLine:function(e){e.pushEmacsMark(null);var n=e.getCursorPosition();n.column===0&&e.session.doc.getLine(n.row).length===0?e.selection.selectLine():(e.clearSelection(),e.selection.selectLineEnd());var r=e.getSelectionRange(),i=e.session.getTextRange(r);t.killRing.add(i),e.session.remove(r),e.clearSelection()},yank:function(e){e.onPaste(t.killRing.get()||\"\"),e.keyBinding.$data.lastCommand=\"yank\"},yankRotate:function(e){if(e.keyBinding.$data.lastCommand!=\"yank\")return;e.undo(),e.onPaste(t.killRing.rotate()),e.keyBinding.$data.lastCommand=\"yank\"},killRegion:{exec:function(e){t.killRing.add(e.getCopyText()),e.commands.byName.cut.exec(e)},readonly:!0,multiSelectAction:\"forEach\"},killRingSave:{exec:function(e){t.killRing.add(e.getCopyText()),setTimeout(function(){var t=e.selection,n=t.getRange();e.pushEmacsMark(t.isBackwards()?n.end:n.start),t.clearSelection()},0)},readonly:!0},keyboardQuit:function(e){e.selection.clearSelection(),e.setEmacsMark(null)},focusCommandLine:function(e,t){e.showCommandLine&&e.showCommandLine(t)}}),t.handler.addCommands(i.iSearchStartCommands);var v=t.handler.commands;v.yank.isYank=!0,v.yankRotate.isYank=!0,t.killRing={$data:[],add:function(e){e&&this.$data.push(e),this.$data.length>30&&this.$data.shift()},get:function(e){return e=e||1,this.$data.slice(this.$data.length-e,this.$data.length).reverse().join(\"\\n\")},pop:function(){return this.$data.length>1&&this.$data.pop(),this.get()},rotate:function(){return this.$data.unshift(this.$data.pop()),this.get()}}}),define(\"ace/incremental_search\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/search\",\"ace/search_highlight\",\"ace/commands/incremental_search_commands\",\"ace/lib/dom\",\"ace/commands/command_manager\",\"ace/editor\",\"ace/config\"],function(e,t,n){function f(){this.$options={wrap:!1,skipCurrent:!1},this.$keyboardHandler=new a(this)}var r=e(\"./lib/oop\"),i=e(\"./range\").Range,s=e(\"./search\").Search,o=e(\"./search_highlight\").SearchHighlight,u=e(\"./commands/incremental_search_commands\"),a=u.IncrementalSearchKeyboardHandler;r.inherits(f,s),function(){this.activate=function(e,t){this.$editor=e,this.$startPos=this.$currentPos=e.getCursorPosition(),this.$options.needle=\"\",this.$options.backwards=t,e.keyBinding.addKeyboardHandler(this.$keyboardHandler),this.$originalEditorOnPaste=e.onPaste,e.onPaste=this.onPaste.bind(this),this.$mousedownHandler=e.addEventListener(\"mousedown\",this.onMouseDown.bind(this)),this.selectionFix(e),this.statusMessage(!0)},this.deactivate=function(e){this.cancelSearch(e);var t=this.$editor;t.keyBinding.removeKeyboardHandler(this.$keyboardHandler),this.$mousedownHandler&&(t.removeEventListener(\"mousedown\",this.$mousedownHandler),delete this.$mousedownHandler),t.onPaste=this.$originalEditorOnPaste,this.message(\"\")},this.selectionFix=function(e){e.selection.isEmpty()&&!e.session.$emacsMark&&e.clearSelection()},this.highlight=function(e){var t=this.$editor.session,n=t.$isearchHighlight=t.$isearchHighlight||t.addDynamicMarker(new o(null,\"ace_isearch-result\",\"text\"));n.setRegexp(e),t._emit(\"changeBackMarker\")},this.cancelSearch=function(e){var t=this.$editor;return this.$prevNeedle=this.$options.needle,this.$options.needle=\"\",e?(t.moveCursorToPosition(this.$startPos),this.$currentPos=this.$startPos):t.pushEmacsMark&&t.pushEmacsMark(this.$startPos,!1),this.highlight(null),i.fromPoints(this.$currentPos,this.$currentPos)},this.highlightAndFindWithNeedle=function(e,t){if(!this.$editor)return null;var n=this.$options;t&&(n.needle=t.call(this,n.needle||\"\")||\"\");if(n.needle.length===0)return this.statusMessage(!0),this.cancelSearch(!0);n.start=this.$currentPos;var r=this.$editor.session,s=this.find(r);return s&&(n.backwards&&(s=i.fromPoints(s.end,s.start)),this.$editor.moveCursorToPosition(s.end),e&&(this.$currentPos=s.end),this.highlight(n.re)),this.statusMessage(s),s},this.addString=function(e){return this.highlightAndFindWithNeedle(!1,function(t){return t+e})},this.removeChar=function(e){return this.highlightAndFindWithNeedle(!1,function(e){return e.length>0?e.substring(0,e.length-1):e})},this.next=function(e){return e=e||{},this.$options.backwards=!!e.backwards,this.$currentPos=this.$editor.getCursorPosition(),this.highlightAndFindWithNeedle(!0,function(t){return e.useCurrentOrPrevSearch&&t.length===0?this.$prevNeedle||\"\":t})},this.onMouseDown=function(e){return this.deactivate(),!0},this.onPaste=function(e){this.addString(e)},this.statusMessage=function(e){var t=this.$options,n=\"\";n+=t.backwards?\"reverse-\":\"\",n+=\"isearch: \"+t.needle,n+=e?\"\":\" (not found)\",this.message(n)},this.message=function(e){this.$editor.showCommandLine?(this.$editor.showCommandLine(e),this.$editor.focus()):console.log(e)}}.call(f.prototype),t.IncrementalSearch=f;var l=e(\"./lib/dom\");l.importCssString&&l.importCssString(\".ace_marker-layer .ace_isearch-result {  position: absolute;  z-index: 6;  -moz-box-sizing: border-box;  -webkit-box-sizing: border-box;  box-sizing: border-box;}div.ace_isearch-result {  border-radius: 4px;  background-color: rgba(255, 200, 0, 0.5);  box-shadow: 0 0 4px rgb(255, 200, 0);}.ace_dark div.ace_isearch-result {  background-color: rgb(100, 110, 160);  box-shadow: 0 0 4px rgb(80, 90, 140);}\",\"incremental-search-highlighting\");var c=e(\"./commands/command_manager\");(function(){this.setupIncrementalSearch=function(e,t){if(this.usesIncrementalSearch==t)return;this.usesIncrementalSearch=t;var n=u.iSearchStartCommands,r=t?\"addCommands\":\"removeCommands\";this[r](n)}}).call(c.CommandManager.prototype);var h=e(\"./editor\").Editor;e(\"./config\").defineOptions(h.prototype,\"editor\",{useIncrementalSearch:{set:function(e){this.keyBinding.$handlers.forEach(function(t){t.setupIncrementalSearch&&t.setupIncrementalSearch(this,e)}),this._emit(\"incrementalSearchSettingChanged\",{isEnabled:e})}}})}),define(\"ace/commands/incremental_search_commands\",[\"require\",\"exports\",\"module\",\"ace/config\",\"ace/lib/oop\",\"ace/keyboard/hash_handler\",\"ace/commands/occur_commands\"],function(e,t,n){function u(e){this.$iSearch=e}var r=e(\"../config\"),i=e(\"../lib/oop\"),s=e(\"../keyboard/hash_handler\").HashHandler,o=e(\"./occur_commands\").occurStartCommand;t.iSearchStartCommands=[{name:\"iSearch\",bindKey:{win:\"Ctrl-F\",mac:\"Command-F\"},exec:function(e,t){r.loadModule([\"core\",\"ace/incremental_search\"],function(n){var r=n.iSearch=n.iSearch||new n.IncrementalSearch;r.activate(e,t.backwards),t.jumpToFirstMatch&&r.next(t)})},readOnly:!0},{name:\"iSearchBackwards\",exec:function(e,t){e.execCommand(\"iSearch\",{backwards:!0})},readOnly:!0},{name:\"iSearchAndGo\",bindKey:{win:\"Ctrl-K\",mac:\"Command-G\"},exec:function(e,t){e.execCommand(\"iSearch\",{jumpToFirstMatch:!0,useCurrentOrPrevSearch:!0})},readOnly:!0},{name:\"iSearchBackwardsAndGo\",bindKey:{win:\"Ctrl-Shift-K\",mac:\"Command-Shift-G\"},exec:function(e){e.execCommand(\"iSearch\",{jumpToFirstMatch:!0,backwards:!0,useCurrentOrPrevSearch:!0})},readOnly:!0}],t.iSearchCommands=[{name:\"restartSearch\",bindKey:{win:\"Ctrl-F\",mac:\"Command-F\"},exec:function(e){e.cancelSearch(!0)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"searchForward\",bindKey:{win:\"Ctrl-S|Ctrl-K\",mac:\"Ctrl-S|Command-G\"},exec:function(e,t){t.useCurrentOrPrevSearch=!0,e.next(t)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"searchBackward\",bindKey:{win:\"Ctrl-R|Ctrl-Shift-K\",mac:\"Ctrl-R|Command-Shift-G\"},exec:function(e,t){t.useCurrentOrPrevSearch=!0,t.backwards=!0,e.next(t)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"extendSearchTerm\",exec:function(e,t){e.addString(t)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"extendSearchTermSpace\",bindKey:\"space\",exec:function(e){e.addString(\" \")},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"shrinkSearchTerm\",bindKey:\"backspace\",exec:function(e){e.removeChar()},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"confirmSearch\",bindKey:\"return\",exec:function(e){e.deactivate()},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"cancelSearch\",bindKey:\"esc|Ctrl-G\",exec:function(e){e.deactivate(!0)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"occurisearch\",bindKey:\"Ctrl-O\",exec:function(e){var t=i.mixin({},e.$options);e.deactivate(),o.exec(e.$editor,t)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"yankNextWord\",bindKey:\"Ctrl-w\",exec:function(e){var t=e.$editor,n=t.selection.getRangeOfMovements(function(e){e.moveCursorWordRight()}),r=t.session.getTextRange(n);e.addString(r)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"yankNextChar\",bindKey:\"Ctrl-Alt-y\",exec:function(e){var t=e.$editor,n=t.selection.getRangeOfMovements(function(e){e.moveCursorRight()}),r=t.session.getTextRange(n);e.addString(r)},readOnly:!0,isIncrementalSearchCommand:!0},{name:\"recenterTopBottom\",bindKey:\"Ctrl-l\",exec:function(e){e.$editor.execCommand(\"recenterTopBottom\")},readOnly:!0,isIncrementalSearchCommand:!0}],i.inherits(u,s),function(){this.attach=function(e){var n=this.$iSearch;s.call(this,t.iSearchCommands,e.commands.platform),this.$commandExecHandler=e.commands.addEventListener(\"exec\",function(e){return e.command.isIncrementalSearchCommand?(e.stopPropagation(),e.preventDefault(),e.command.exec(n,e.args||{})):undefined})},this.detach=function(e){if(!this.$commandExecHandler)return;e.commands.removeEventListener(\"exec\",this.$commandExecHandler),delete this.$commandExecHandler};var e=this.handleKeyboard;this.handleKeyboard=function(t,n,r,i){if((n===1||n===8)&&r===\"v\"||n===1&&r===\"y\")return null;var s=e.call(this,t,n,r,i);if(s.command)return s;if(n==-1){var o=this.commands.extendSearchTerm;if(o)return{command:o,args:r}}return{command:\"null\",passEvent:n==0||n==4}}}.call(u.prototype),t.IncrementalSearchKeyboardHandler=u}),define(\"ace/commands/occur_commands\",[\"require\",\"exports\",\"module\",\"ace/config\",\"ace/occur\",\"ace/keyboard/hash_handler\",\"ace/lib/oop\"],function(e,t,n){function f(){}var r=e(\"../config\"),i=e(\"../occur\").Occur,s={name:\"occur\",exec:function(e,t){var n=!!e.session.$occur,r=(new i).enter(e,t);r&&!n&&f.installIn(e)},readOnly:!0},o=[{name:\"occurexit\",bindKey:\"esc|Ctrl-G\",exec:function(e){var t=e.session.$occur;if(!t)return;t.exit(e,{}),e.session.$occur||f.uninstallFrom(e)},readOnly:!0},{name:\"occuraccept\",bindKey:\"enter\",exec:function(e){var t=e.session.$occur;if(!t)return;t.exit(e,{translatePosition:!0}),e.session.$occur||f.uninstallFrom(e)},readOnly:!0}],u=e(\"../keyboard/hash_handler\").HashHandler,a=e(\"../lib/oop\");a.inherits(f,u),function(){this.isOccurHandler=!0,this.attach=function(e){u.call(this,o,e.commands.platform),this.$editor=e};var e=this.handleKeyboard;this.handleKeyboard=function(t,n,r,i){var s=e.call(this,t,n,r,i);return s&&s.command?s:undefined}}.call(f.prototype),f.installIn=function(e){var t=new this;e.keyBinding.addKeyboardHandler(t),e.commands.addCommands(o)},f.uninstallFrom=function(e){e.commands.removeCommands(o);var t=e.getKeyboardHandler();t.isOccurHandler&&e.keyBinding.removeKeyboardHandler(t)},t.occurStartCommand=s}),define(\"ace/occur\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/search\",\"ace/edit_session\",\"ace/search_highlight\",\"ace/lib/dom\"],function(e,t,n){function a(){}var r=e(\"./lib/oop\"),i=e(\"./range\").Range,s=e(\"./search\").Search,o=e(\"./edit_session\").EditSession,u=e(\"./search_highlight\").SearchHighlight;r.inherits(a,s),function(){this.enter=function(e,t){if(!t.needle)return!1;var n=e.getCursorPosition();this.displayOccurContent(e,t);var r=this.originalToOccurPosition(e.session,n);return e.moveCursorToPosition(r),!0},this.exit=function(e,t){var n=t.translatePosition&&e.getCursorPosition(),r=n&&this.occurToOriginalPosition(e.session,n);return this.displayOriginalContent(e),r&&e.moveCursorToPosition(r),!0},this.highlight=function(e,t){var n=e.$occurHighlight=e.$occurHighlight||e.addDynamicMarker(new u(null,\"ace_occur-highlight\",\"text\"));n.setRegexp(t),e._emit(\"changeBackMarker\")},this.displayOccurContent=function(e,t){this.$originalSession=e.session;var n=this.matchingLines(e.session,t),r=n.map(function(e){return e.content}),i=new o(r.join(\"\\n\"));i.$occur=this,i.$occurMatchingLines=n,e.setSession(i),this.$useEmacsStyleLineStart=this.$originalSession.$useEmacsStyleLineStart,i.$useEmacsStyleLineStart=this.$useEmacsStyleLineStart,this.highlight(i,t.re),i._emit(\"changeBackMarker\")},this.displayOriginalContent=function(e){e.setSession(this.$originalSession),this.$originalSession.$useEmacsStyleLineStart=this.$useEmacsStyleLineStart},this.originalToOccurPosition=function(e,t){var n=e.$occurMatchingLines,r={row:0,column:0};if(!n)return r;for(var i=0;i<n.length;i++)if(n[i].row===t.row)return{row:i,column:t.column};return r},this.occurToOriginalPosition=function(e,t){var n=e.$occurMatchingLines;return!n||!n[t.row]?t:{row:n[t.row].row,column:t.column}},this.matchingLines=function(e,t){t=r.mixin({},t);if(!e||!t.needle)return[];var n=new s;return n.set(t),n.findAll(e).reduce(function(t,n){var r=n.start.row,i=t[t.length-1];return i&&i.row===r?t:t.concat({row:r,content:e.getLine(r)})},[])}}.call(a.prototype);var f=e(\"./lib/dom\");f.importCssString(\".ace_occur-highlight {\\n    border-radius: 4px;\\n    background-color: rgba(87, 255, 8, 0.25);\\n    position: absolute;\\n    z-index: 4;\\n    -moz-box-sizing: border-box;\\n    -webkit-box-sizing: border-box;\\n    box-sizing: border-box;\\n    box-shadow: 0 0 4px rgb(91, 255, 50);\\n}\\n.ace_dark .ace_occur-highlight {\\n    background-color: rgb(80, 140, 85);\\n    box-shadow: 0 0 4px rgb(60, 120, 70);\\n}\\n\",\"incremental-occur-highlighting\"),t.Occur=a})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/keybinding-vim.js",
    "content": "define(\"ace/keyboard/vim\",[\"require\",\"exports\",\"module\",\"ace/keyboard/vim/commands\",\"ace/keyboard/vim/maps/util\",\"ace/lib/useragent\"],function(e,t,n){var r=e(\"./vim/commands\"),i=r.coreCommands,s=e(\"./vim/maps/util\"),o=e(\"../lib/useragent\"),u={i:{command:i.start},I:{command:i.startBeginning},a:{command:i.append},A:{command:i.appendEnd},\"ctrl-f\":{command:\"gotopagedown\"},\"ctrl-b\":{command:\"gotopageup\"}};t.handler={$id:\"ace/keyboard/vim\",handleMacRepeat:function(e,t,n){if(t==-1)e.inputChar=n,e.lastEvent=\"input\";else if(e.inputChar&&e.$lastHash==t&&e.$lastKey==n){if(e.lastEvent==\"input\")e.lastEvent=\"input1\";else if(e.lastEvent==\"input1\")return!0}else e.$lastHash=t,e.$lastKey=n,e.lastEvent=\"keypress\"},updateMacCompositionHandlers:function(e,t){var n=function(e){if(s.currentMode!==\"insert\"){var t=this.textInput.getElement();t.blur(),t.focus(),t.value=e}else this.onCompositionUpdateOrig(e)},r=function(e){s.currentMode===\"insert\"&&this.onCompositionStartOrig(e)};t?e.onCompositionUpdateOrig||(e.onCompositionUpdateOrig=e.onCompositionUpdate,e.onCompositionUpdate=n,e.onCompositionStartOrig=e.onCompositionStart,e.onCompositionStart=r):e.onCompositionUpdateOrig&&(e.onCompositionUpdate=e.onCompositionUpdateOrig,e.onCompositionUpdateOrig=null,e.onCompositionStart=e.onCompositionStartOrig,e.onCompositionStartOrig=null)},handleKeyboard:function(e,t,n,s,a){if(t!==0&&(!n||s==-1))return null;var f=e.editor,l=e.vimState||\"start\";t==1&&(n=\"ctrl-\"+n);if(n==\"ctrl-c\")return!o.isMac&&f.getCopyText()?(f.once(\"copy\",function(){l==\"start\"?i.stop.exec(f):f.selection.clearSelection()}),{command:\"null\",passEvent:!0}):{command:i.stop};if(n==\"esc\"&&t===0||n==\"ctrl-[\")return{command:i.stop};if(l==\"start\"){o.isMac&&this.handleMacRepeat(e,t,n)&&(t=-1,n=e.inputChar);if(t==-1||t==1||t===0&&n.length>1){if(r.inputBuffer.idle&&u[n])return u[n];var c=r.inputBuffer.push(f,n);if(!c&&t!==-1)return;return{command:\"null\",passEvent:!c}}if(n==\"esc\"&&t===0)return{command:i.stop};if(t===0||t==4)return{command:\"null\",passEvent:!0}}else if(n==\"ctrl-w\")return{command:\"removewordleft\"}},attach:function(e){e.on(\"click\",t.onCursorMove),s.currentMode!==\"insert\"&&r.coreCommands.stop.exec(e),e.$vimModeHandler=this,this.updateMacCompositionHandlers(e,!0)},detach:function(e){e.removeListener(\"click\",t.onCursorMove),s.noMode(e),s.currentMode=\"normal\",this.updateMacCompositionHandlers(e,!1)},actions:r.actions,getStatusText:function(){return s.currentMode==\"insert\"?\"INSERT\":s.onVisualMode?(s.onVisualLineMode?\"VISUAL LINE \":\"VISUAL \")+r.inputBuffer.status:r.inputBuffer.status}},t.onCursorMove=function(e){r.onCursorMove(e.editor,e),t.onCursorMove.scheduled=!1}}),define(\"ace/keyboard/vim/commands\",[\"require\",\"exports\",\"module\",\"ace/lib/lang\",\"ace/keyboard/vim/maps/util\",\"ace/keyboard/vim/maps/motions\",\"ace/keyboard/vim/maps/operators\",\"ace/keyboard/vim/maps/aliases\",\"ace/keyboard/vim/registers\"],function(e,t,n){\"never use strict\";function y(e){g.previous={action:{action:{fn:e}}}}var r=e(\"../../lib/lang\"),i=e(\"./maps/util\"),s=e(\"./maps/motions\"),o=e(\"./maps/operators\"),u=e(\"./maps/aliases\"),a=e(\"./registers\"),f=1,l=2,c=3,h=4,p=8,d=function(t,n,r){while(0<n--)t.apply(this,r)},v=function(e){var t=e.renderer,n=t.$cursorLayer.getPixelPosition(),r=n.top,i=p*t.layerConfig.lineHeight;2*i>t.$size.scrollerHeight&&(i=t.$size.scrollerHeight/2),t.scrollTop>r-i&&t.session.setScrollTop(r-i),t.scrollTop+t.$size.scrollerHeight<r+i+t.lineHeight&&t.session.setScrollTop(r+i+t.lineHeight-t.$size.scrollerHeight)},m=t.actions={z:{param:!0,fn:function(e,t,n,r){switch(r){case\"z\":e.renderer.alignCursor(null,.5);break;case\"t\":e.renderer.alignCursor(null,0);break;case\"b\":e.renderer.alignCursor(null,1);break;case\"c\":e.session.onFoldWidgetClick(t.start.row,{domEvent:{target:{}}});break;case\"o\":e.session.onFoldWidgetClick(t.start.row,{domEvent:{target:{}}});break;case\"C\":e.session.foldAll();break;case\"O\":e.session.unfold()}}},r:{param:!0,fn:function(e,t,n,r){r&&r.length&&(r.length>1&&(r=r==\"return\"?\"\\n\":r==\"tab\"?\"\t\":r),d(function(){e.insert(r)},n||1),e.navigateLeft())}},R:{fn:function(e,t,n,r){i.insertMode(e),e.setOverwrite(!0)}},\"~\":{fn:function(e,t,n){d(function(){var t=e.selection.getRange();t.isEmpty()&&t.end.column++;var n=e.session.getTextRange(t),r=n.toUpperCase();r!=n?e.session.replace(t,r):n.toLowerCase()!=n?e.session.replace(t,n.toLowerCase()):e.navigateRight()},n||1)}},\"*\":{fn:function(e,t,n,r){e.selection.selectWord(),e.findNext(),v(e);var i=e.selection.getRange();e.selection.setSelectionRange(i,!0)}},\"#\":{fn:function(e,t,n,r){e.selection.selectWord(),e.findPrevious(),v(e);var i=e.selection.getRange();e.selection.setSelectionRange(i,!0)}},m:{param:!0,fn:function(e,t,n,r){var i=e.session,s=i.vimMarkers||(i.vimMarkers={}),o=e.getCursorPosition();s[r]||(s[r]=e.session.doc.createAnchor(o)),s[r].setPosition(o.row,o.column,!0)}},n:{fn:function(e,t,n,r){var i=e.getLastSearchOptions();i.backwards=!1,i.start=null,e.selection.moveCursorRight(),e.selection.clearSelection(),e.findNext(i),v(e);var s=e.selection.getRange();s.end.row=s.start.row,s.end.column=s.start.column,e.selection.setSelectionRange(s,!0)}},N:{fn:function(e,t,n,r){var i=e.getLastSearchOptions();i.backwards=!0,i.start=null,e.findPrevious(i),v(e);var s=e.selection.getRange();s.end.row=s.start.row,s.end.column=s.start.column,e.selection.setSelectionRange(s,!0)}},v:{fn:function(e,t,n,r){e.selection.selectRight(),i.visualMode(e,!1)},acceptsMotion:!0},V:{fn:function(e,t,n,r){var s=e.getCursorPosition().row;e.selection.moveTo(s,0),e.selection.selectLineEnd(),e.selection.visualLineStart=s,i.visualMode(e,!0)},acceptsMotion:!0},Y:{fn:function(e,t,n,r){i.copyLine(e)}},p:{fn:function(e,t,n,i){var s=a._default;e.setOverwrite(!1);if(s.isLine){var o=e.getCursorPosition();o.column=e.session.getLine(o.row).length;var u=r.stringRepeat(\"\\n\"+s.text,n||1);e.session.insert(o,u),e.moveCursorTo(o.row+1,0)}else e.navigateRight(),e.insert(r.stringRepeat(s.text,n||1)),e.navigateLeft();e.setOverwrite(!0),e.selection.clearSelection()}},P:{fn:function(e,t,n,i){var s=a._default;e.setOverwrite(!1);if(s.isLine){var o=e.getCursorPosition();o.column=0;var u=r.stringRepeat(s.text+\"\\n\",n||1);e.session.insert(o,u),e.moveCursorToPosition(o)}else e.insert(r.stringRepeat(s.text,n||1));e.setOverwrite(!0),e.selection.clearSelection()}},J:{fn:function(e,t,n,r){var i=e.session;t=e.getSelectionRange();var s={row:t.start.row,column:t.start.column};n=n||t.end.row-t.start.row;var o=Math.min(s.row+(n||1),i.getLength()-1);t.start.column=i.getLine(s.row).length,t.end.column=i.getLine(o).length,t.end.row=o;var u=\"\";for(var a=s.row;a<o;a++){var f=i.getLine(a+1);u+=\" \"+/^\\s*(.*)$/.exec(f)[1]||\"\"}i.replace(t,u),e.moveCursorTo(s.row,s.column)}},u:{fn:function(e,t,n,r){n=parseInt(n||1,10);for(var i=0;i<n;i++)e.undo();e.selection.clearSelection()}},\"ctrl-r\":{fn:function(e,t,n,r){n=parseInt(n||1,10);for(var i=0;i<n;i++)e.redo();e.selection.clearSelection()}},\":\":{fn:function(e,t,n,r){var i=\":\";n>1&&(i=\".,.+\"+n+i),e.showCommandLine&&e.showCommandLine(i)}},\"/\":{fn:function(e,t,n,r){e.showCommandLine&&e.showCommandLine(\"/\")}},\"?\":{fn:function(e,t,n,r){e.showCommandLine&&e.showCommandLine(\"?\")}},\".\":{fn:function(e,t,n,r){i.onInsertReplaySequence=g.lastInsertCommands;var s=g.previous;s&&g.exec(e,s.action,s.param)}},\"ctrl-x\":{fn:function(e,t,n,r){e.modifyNumber(-(n||1))}},\"ctrl-a\":{fn:function(e,t,n,r){e.modifyNumber(n||1)}}},g=t.inputBuffer={accepting:[f,l,c,h],currentCmd:null,currentCount:\"\",pendingCount:\"\",status:\"\",operator:null,motion:null,lastInsertCommands:[],push:function(e,t,n){var r=this.status,i=!0;this.idle=!1;var a=this.waitingForParam;/^numpad\\d+$/i.test(t)&&(t=t.substr(6));if(a)this.exec(e,a,t);else if(t===\"0\"&&!this.currentCount.length||!/^\\d+$/.test(t)||!this.isAccepting(f))if(!this.operator&&this.isAccepting(l)&&o[t])this.operator={ch:t,count:this.getCount()},this.currentCmd=l,this.accepting=[f,c,h],this.exec(e,{operator:this.operator});else if(s[t]&&this.isAccepting(c)){this.currentCmd=c;var p={operator:this.operator,motion:{ch:t,count:this.getCount()}};s[t].param?this.waitForParam(p):this.exec(e,p)}else if(u[t]&&this.isAccepting(c))u[t].operator.count=this.getCount(),this.exec(e,u[t]);else if(m[t]&&this.isAccepting(h)){var d={action:{fn:m[t].fn,count:this.getCount()}};m[t].param?this.waitForParam(d):this.exec(e,d),m[t].acceptsMotion&&(this.idle=!1)}else this.operator?(this.operator.count=this.getCount(),this.exec(e,{operator:this.operator},t)):(i=t.length==1,this.reset());else this.currentCount+=t,this.currentCmd=f,this.accepting=[f,l,c,h];return this.waitingForParam||this.motion||this.operator?this.status+=t:this.currentCount?this.status=this.currentCount:this.status&&(this.status=\"\"),this.status!=r&&e._emit(\"changeStatus\"),i},waitForParam:function(e){this.waitingForParam=e},getCount:function(){var e=this.currentCount||this.pendingCount;return this.currentCount=\"\",this.pendingCount=e,e&&parseInt(e,10)},exec:function(e,t,n){var r=t.motion,u=t.operator,a=t.action;n||(n=t.param),u&&(this.previous={action:t,param:n});if(u&&!e.selection.isEmpty()){o[u.ch].selFn&&(o[u.ch].selFn(e,e.getSelectionRange(),u.count,n),this.reset());return}if(!r&&!a&&u&&n)o[u.ch].fn(e,null,u.count,n),this.reset();else if(r){var f=function(t){t&&typeof t==\"function\"&&(r.count&&!l.handlesCount?d(t,r.count,[e,null,r.count,n]):t(e,null,r.count,n))},l=s[r.ch],c=l.sel;u?c&&d(function(){f(l.sel),o[u.ch].fn(e,e.getSelectionRange(),u.count,l.param?l:n)},u.count||1):(i.onVisualMode||i.onVisualLineMode)&&c?f(l.sel):f(l.nav),this.reset()}else a&&(a.fn(e,e.getSelectionRange(),a.count,n),this.reset());b(e)},isAccepting:function(e){return this.accepting.indexOf(e)!==-1},reset:function(){this.operator=null,this.motion=null,this.currentCount=\"\",this.pendingCount=\"\",this.status=\"\",this.accepting=[f,l,c,h],this.idle=!0,this.waitingForParam=null}};t.coreCommands={start:{exec:function w(e){i.insertMode(e),y(w)}},startBeginning:{exec:function E(e){e.navigateLineStart(),i.insertMode(e),y(E)}},stop:{exec:function(t){g.reset(),i.onVisualMode=!1,i.onVisualLineMode=!1,g.lastInsertCommands=i.normalMode(t)}},append:{exec:function S(e){var t=e.getCursorPosition(),n=e.session.getLine(t.row).length;n&&e.navigateRight(),i.insertMode(e),y(S)}},appendEnd:{exec:function x(e){e.navigateLineEnd(),i.insertMode(e),y(x)}}};var b=t.onCursorMove=function(e,t){if(i.currentMode===\"insert\"||b.running)return;if(!e.selection.isEmpty()){b.running=!0;if(i.onVisualLineMode){var n=e.selection.visualLineStart,r=e.getCursorPosition().row;if(n<=r){var s=e.session.getLine(r);e.selection.moveTo(n,0),e.selection.selectTo(r,s.length)}else{var s=e.session.getLine(n);e.selection.moveTo(n,s.length),e.selection.selectTo(r,0)}}b.running=!1;return}t&&(i.onVisualLineMode||i.onVisualMode)&&(e.selection.clearSelection(),i.normalMode(e)),b.running=!0;var o=e.getCursorPosition(),u=e.session.getLine(o.row).length;u&&o.column===u&&e.navigateLeft(),b.running=!1}}),define(\"ace/keyboard/vim/maps/util\",[\"require\",\"exports\",\"module\",\"ace/keyboard/vim/registers\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../registers\"),i=e(\"../../../lib/dom\");i.importCssString(\".insert-mode .ace_cursor{    border-left: 2px solid #333333;}.ace_dark.insert-mode .ace_cursor{    border-left: 2px solid #eeeeee;}.normal-mode .ace_cursor{    border: 0!important;    background-color: red;    opacity: 0.5;}\",\"vimMode\"),n.exports={onVisualMode:!1,onVisualLineMode:!1,currentMode:\"normal\",noMode:function(e){e.unsetStyle(\"insert-mode\"),e.unsetStyle(\"normal-mode\"),e.commands.recording&&e.commands.toggleRecording(e),e.setOverwrite(!1)},insertMode:function(e){this.currentMode=\"insert\",e.setStyle(\"insert-mode\"),e.unsetStyle(\"normal-mode\"),e.setOverwrite(!1),e.keyBinding.$data.buffer=\"\",e.keyBinding.$data.vimState=\"insertMode\",this.onVisualMode=!1,this.onVisualLineMode=!1,this.onInsertReplaySequence?(e.commands.macro=this.onInsertReplaySequence,e.commands.replay(e),this.onInsertReplaySequence=null,this.normalMode(e)):(e._emit(\"changeStatus\"),e.commands.recording||e.commands.toggleRecording(e))},normalMode:function(e){this.currentMode=\"normal\",e.unsetStyle(\"insert-mode\"),e.setStyle(\"normal-mode\"),e.clearSelection();var t;return e.getOverwrite()||(t=e.getCursorPosition(),t.column>0&&e.navigateLeft()),e.setOverwrite(!0),e.keyBinding.$data.buffer=\"\",e.keyBinding.$data.vimState=\"start\",this.onVisualMode=!1,this.onVisualLineMode=!1,e._emit(\"changeStatus\"),e.commands.recording?(e.commands.toggleRecording(e),e.commands.macro):[]},visualMode:function(e,t){if(this.onVisualLineMode&&t||this.onVisualMode&&!t){this.normalMode(e);return}e.setStyle(\"insert-mode\"),e.unsetStyle(\"normal-mode\"),e._emit(\"changeStatus\"),t?this.onVisualLineMode=!0:(this.onVisualMode=!0,this.onVisualLineMode=!1)},getRightNthChar:function(e,t,n,r){var i=e.getSession().getLine(t.row),s=i.substr(t.column+1).split(n);return r<s.length?s.slice(0,r).join(n).length:null},getLeftNthChar:function(e,t,n,r){var i=e.getSession().getLine(t.row),s=i.substr(0,t.column).split(n);return r<s.length?s.slice(-1*r).join(n).length:null},toRealChar:function(e){return e.length===1?e:/^shift-./.test(e)?e[e.length-1].toUpperCase():\"\"},copyLine:function(e){var t=e.getCursorPosition();e.selection.moveTo(t.row,t.column),e.selection.selectLine(),r._default.isLine=!0,r._default.text=e.getCopyText().replace(/\\n$/,\"\"),e.selection.moveTo(t.row,t.column)}}}),define(\"ace/keyboard/vim/registers\",[\"require\",\"exports\",\"module\"],function(e,t,n){\"never use strict\";n.exports={_default:{text:\"\",isLine:!1}}}),define(\"ace/keyboard/vim/maps/motions\",[\"require\",\"exports\",\"module\",\"ace/keyboard/vim/maps/util\",\"ace/search\",\"ace/range\"],function(e,t,n){function s(e){if(typeof e==\"function\"){var t=e;e=this}else var t=e.getPos;return e.nav=function(e,n,r,i){var s=t(e,n,r,i,!1);if(!s)return;e.selection.moveTo(s.row,s.column)},e.sel=function(e,n,r,i){var s=t(e,n,r,i,!0);if(!s)return;e.selection.selectTo(s.row,s.column)},e}function h(e,t,n){return c.$options.needle=t,c.$options.backwards=n==-1,c.find(e.session)}var r=e(\"./util\"),i=function(e,t){var n=e.renderer.getScrollTopRow(),r=e.getCursorPosition().row,i=r-n;t&&t.call(e),e.renderer.scrollToRow(e.getCursorPosition().row-i)},o=/[\\s.\\/\\\\()\\\"'-:,.;<>~!@#$%^&*|+=\\[\\]{}`~?]/,u=/[.\\/\\\\()\\\"'-:,.;<>~!@#$%^&*|+=\\[\\]{}`~?]/,a=/\\s/,f=function(e,t){var n=e.selection;this.range=n.getRange(),t=t||n.selectionLead,this.row=t.row,this.col=t.column;var r=e.session.getLine(this.row),i=e.session.getLength();this.ch=r[this.col]||\"\\n\",this.skippedLines=0,this.next=function(){return this.ch=r[++this.col]||this.handleNewLine(1),this.ch},this.prev=function(){return this.ch=r[--this.col]||this.handleNewLine(-1),this.ch},this.peek=function(t){var n=r[this.col+t];return n?n:t==-1?\"\\n\":this.col==r.length-1?\"\\n\":e.session.getLine(this.row+1)[0]||\"\\n\"},this.handleNewLine=function(t){if(t==1)return this.col==r.length?\"\\n\":this.row==i-1?\"\":(this.col=0,this.row++,r=e.session.getLine(this.row),this.skippedLines++,r[0]||\"\\n\");if(t==-1)return this.row===0?\"\":(this.row--,r=e.session.getLine(this.row),this.col=r.length,this.skippedLines--,\"\\n\")},this.debug=function(){console.log(r.substring(0,this.col)+\"|\"+this.ch+\"'\"+this.col+\"'\"+r.substr(this.col+1))}},l=e(\"../../../search\").Search,c=new l,p=e(\"../../../range\").Range,d={};n.exports={w:new s(function(e){var t=new f(e);if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.next();else while(t.ch&&!o.test(t.ch))t.next();while(t.ch&&a.test(t.ch)&&t.skippedLines<2)t.next();return t.skippedLines==2&&t.prev(),{column:t.col,row:t.row}}),W:new s(function(e){var t=new f(e);while(t.ch&&(!a.test(t.ch)||!!a.test(t.peek(1)))&&t.skippedLines<2)t.next();return t.skippedLines==2?t.prev():t.next(),{column:t.col,row:t.row}}),b:new s(function(e){var t=new f(e);t.prev();while(t.ch&&a.test(t.ch)&&t.skippedLines>-2)t.prev();if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.prev();else while(t.ch&&!o.test(t.ch))t.prev();return t.ch&&t.next(),{column:t.col,row:t.row}}),B:new s(function(e){var t=new f(e);t.prev();while(t.ch&&(!!a.test(t.ch)||!a.test(t.peek(-1)))&&t.skippedLines>-2)t.prev();return t.skippedLines==-2&&t.next(),{column:t.col,row:t.row}}),e:new s(function(e){var t=new f(e);t.next();while(t.ch&&a.test(t.ch))t.next();if(t.ch&&u.test(t.ch))while(t.ch&&u.test(t.ch))t.next();else while(t.ch&&!o.test(t.ch))t.next();return t.ch&&t.prev(),{column:t.col,row:t.row}}),E:new s(function(e){var t=new f(e);t.next();while(t.ch&&(!!a.test(t.ch)||!a.test(t.peek(1))))t.next();return{column:t.col,row:t.row}}),l:{nav:function(e){var t=e.getCursorPosition(),n=t.column,r=e.session.getLine(t.row).length;r&&n!==r&&e.navigateRight()},sel:function(e){var t=e.getCursorPosition(),n=t.column,r=e.session.getLine(t.row).length;r&&n!==r&&e.selection.selectRight()}},h:{nav:function(e){var t=e.getCursorPosition();t.column>0&&e.navigateLeft()},sel:function(e){var t=e.getCursorPosition();t.column>0&&e.selection.selectLeft()}},H:{nav:function(e){var t=e.renderer.getScrollTopRow();e.moveCursorTo(t)},sel:function(e){var t=e.renderer.getScrollTopRow();e.selection.selectTo(t)}},M:{nav:function(e){var t=e.renderer.getScrollTopRow(),n=e.renderer.getScrollBottomRow(),r=t+(n-t)/2;e.moveCursorTo(r)},sel:function(e){var t=e.renderer.getScrollTopRow(),n=e.renderer.getScrollBottomRow(),r=t+(n-t)/2;e.selection.selectTo(r)}},L:{nav:function(e){var t=e.renderer.getScrollBottomRow();e.moveCursorTo(t)},sel:function(e){var t=e.renderer.getScrollBottomRow();e.selection.selectTo(t)}},k:{nav:function(e){e.navigateUp()},sel:function(e){e.selection.selectUp()}},j:{nav:function(e){e.navigateDown()},sel:function(e){e.selection.selectDown()}},i:{param:!0,sel:function(e,t,n,r){switch(r){case\"w\":e.selection.selectWord();break;case\"W\":e.selection.selectAWord();break;case\"(\":case\"{\":case\"[\":var i=e.getCursorPosition(),s=e.session.$findClosingBracket(r,i,/paren/);if(!s)return;var o=e.session.$findOpeningBracket(e.session.$brackets[r],i,/paren/);if(!o)return;o.column++,e.selection.setSelectionRange(p.fromPoints(o,s));break;case\"'\":case'\"':case\"/\":var s=h(e,r,1);if(!s)return;var o=h(e,r,-1);if(!o)return;e.selection.setSelectionRange(p.fromPoints(o.end,s.start))}}},a:{param:!0,sel:function(e,t,n,r){switch(r){case\"w\":e.selection.selectAWord();break;case\"W\":e.selection.selectAWord();break;case\")\":case\"}\":case\"]\":r=e.session.$brackets[r];case\"(\":case\"{\":case\"[\":var i=e.getCursorPosition(),s=e.session.$findClosingBracket(r,i,/paren/);if(!s)return;var o=e.session.$findOpeningBracket(e.session.$brackets[r],i,/paren/);if(!o)return;s.column++,e.selection.setSelectionRange(p.fromPoints(o,s));break;case\"'\":case'\"':case\"/\":var s=h(e,r,1);if(!s)return;var o=h(e,r,-1);if(!o)return;s.column++,e.selection.setSelectionRange(p.fromPoints(o.start,s.end))}}},f:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s,o){i==\"space\"&&(i=\" \"),o||(d={ch:\"f\",param:i});var u=e.getCursorPosition(),a=r.getRightNthChar(e,u,i,n||1);if(typeof a==\"number\")return u.column+=a+(s?2:1),u}}),F:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s,o){i==\"space\"&&(i=\" \"),o||(d={ch:\"F\",param:i});var u=e.getCursorPosition(),a=r.getLeftNthChar(e,u,i,n||1);if(typeof a==\"number\")return u.column-=a+1,u}}),t:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s,o){i==\"space\"&&(i=\" \"),o||(d={ch:\"t\",param:i});var u=e.getCursorPosition(),a=r.getRightNthChar(e,u,i,n||1);if(o&&a==0&&!(n>1))var a=r.getRightNthChar(e,u,i,2);if(typeof a==\"number\")return u.column+=a+(s?1:0),u}}),T:new s({param:!0,handlesCount:!0,getPos:function(e,t,n,i,s,o){i==\"space\"&&(i=\" \"),o||(d={ch:\"T\",param:i});var u=e.getCursorPosition(),a=r.getLeftNthChar(e,u,i,n||1);if(o&&a==0&&!(n>1))var a=r.getLeftNthChar(e,u,i,2);if(typeof a==\"number\")return u.column-=a,u}}),\";\":new s({handlesCount:!0,getPos:function(e,t,r,i,s){var o=d.ch;if(!o)return;return n.exports[o].getPos(e,t,r,d.param,s,!0)}}),\",\":new s({handlesCount:!0,getPos:function(e,t,r,i,s){var o=d.ch;if(!o)return;var u=o.toUpperCase();return o=o===u?o.toLowerCase():u,n.exports[o].getPos(e,t,r,d.param,s,!0)}}),\"^\":{nav:function(e){e.navigateLineStart()},sel:function(e){e.selection.selectLineStart()}},$:{handlesCount:!0,nav:function(e,t,n,r){n>1&&e.navigateDown(n-1),e.navigateLineEnd()},sel:function(e,t,n,r){n>1&&e.selection.moveCursorBy(n-1,0),e.selection.selectLineEnd()}},0:new s(function(e){return{row:e.selection.lead.row,column:0}}),G:{nav:function(e,t,n,r){!n&&n!==0&&(n=e.session.getLength()),e.gotoLine(n)},sel:function(e,t,n,r){!n&&n!==0&&(n=e.session.getLength()),e.selection.selectTo(n,0)}},g:{param:!0,nav:function(e,t,n,r){switch(r){case\"m\":console.log(\"Middle line\");break;case\"e\":console.log(\"End of prev word\");break;case\"g\":e.gotoLine(n||0);case\"u\":e.gotoLine(n||0);case\"U\":e.gotoLine(n||0)}},sel:function(e,t,n,r){switch(r){case\"m\":console.log(\"Middle line\");break;case\"e\":console.log(\"End of prev word\");break;case\"g\":e.selection.selectTo(n||0,0)}}},o:{nav:function(e,t,n,i){n=n||1;var s=\"\";while(0<n--)s+=\"\\n\";s.length&&(e.navigateLineEnd(),e.insert(s),r.insertMode(e))}},O:{nav:function(e,t,n,i){var s=e.getCursorPosition().row;n=n||1;var o=\"\";while(0<n--)o+=\"\\n\";o.length&&(s>0?(e.navigateUp(),e.navigateLineEnd(),e.insert(o)):(e.session.insert({row:0,column:0},o),e.navigateUp()),r.insertMode(e))}},\"%\":new s(function(e){var t=/[\\[\\]{}()]/g,n=e.getCursorPosition(),r=e.session.getLine(n.row)[n.column];if(!t.test(r)){var i=h(e,t);if(!i)return;n=i.start}var s=e.session.findMatchingBracket({row:n.row,column:n.column+1});return s}),\"{\":new s(function(e){var t=e.session,n=t.selection.lead.row;while(n>0&&!/\\S/.test(t.getLine(n)))n--;while(/\\S/.test(t.getLine(n)))n--;return{column:0,row:n}}),\"}\":new s(function(e){var t=e.session,n=t.getLength(),r=t.selection.lead.row;while(r<n&&!/\\S/.test(t.getLine(r)))r++;while(/\\S/.test(t.getLine(r)))r++;return{column:0,row:r}}),\"ctrl-d\":{nav:function(e,t,n,r){e.selection.clearSelection(),i(e,e.gotoPageDown)},sel:function(e,t,n,r){i(e,e.selectPageDown)}},\"ctrl-u\":{nav:function(e,t,n,r){e.selection.clearSelection(),i(e,e.gotoPageUp)},sel:function(e,t,n,r){i(e,e.selectPageUp)}},\"`\":new s({param:!0,handlesCount:!0,getPos:function(e,t,n,r,i){var s=e.session,o=s.vimMarkers&&s.vimMarkers[r];if(o)return o.getPosition()}}),\"'\":new s({param:!0,handlesCount:!0,getPos:function(e,t,n,r,i){var s=e.session,o=s.vimMarkers&&s.vimMarkers[r];if(o){var u=o.getPosition(),a=e.session.getLine(u.row);return u.column=a.search(/\\S/),u.column==-1&&(u.column=a.length),u}},isLine:!0})},n.exports.backspace=n.exports.left=n.exports.h,n.exports.space=n.exports[\"return\"]=n.exports.right=n.exports.l,n.exports.up=n.exports.k,n.exports.down=n.exports.j,n.exports.pagedown=n.exports[\"ctrl-d\"],n.exports.pageup=n.exports[\"ctrl-u\"],n.exports.home=n.exports[0],n.exports.end=n.exports.$}),define(\"ace/keyboard/vim/maps/operators\",[\"require\",\"exports\",\"module\",\"ace/keyboard/vim/maps/util\",\"ace/keyboard/vim/registers\"],function(e,t,n){var r=e(\"./util\"),i=e(\"../registers\");n.exports={d:{selFn:function(e,t,n,s){i._default.text=e.getCopyText(),i._default.isLine=r.onVisualLineMode,r.onVisualLineMode?e.removeLines():e.session.remove(t),r.normalMode(e)},fn:function(e,t,n,r){n=n||1;switch(r){case\"d\":i._default.text=\"\",i._default.isLine=!0;for(var s=0;s<n;s++){e.selection.selectLine(),i._default.text+=e.getCopyText();var o=e.getSelectionRange();if(!o.isMultiLine()){var u=o.start.row-1,a=e.session.getLine(u).length;o.setStart(u,a),e.session.remove(o),e.selection.clearSelection();break}e.session.remove(o),e.selection.clearSelection()}i._default.text=i._default.text.replace(/\\n$/,\"\");break;default:t&&(e.selection.setSelectionRange(t),i._default.text=e.getCopyText(),i._default.isLine=!1,e.session.remove(t),e.selection.clearSelection())}}},c:{selFn:function(e,t,n,i){e.session.remove(t),r.insertMode(e)},fn:function(e,t,n,i){n=n||1;switch(i){case\"c\":for(var s=0;s<n;s++)e.removeLines(),r.insertMode(e);break;default:t&&(e.session.remove(t),r.insertMode(e))}}},y:{selFn:function(e,t,n,s){i._default.text=e.getCopyText(),i._default.isLine=r.onVisualLineMode,e.selection.clearSelection(),r.normalMode(e)},fn:function(e,t,n,r){n=n||1,r&&r.isLine&&(r=\"y\");switch(r){case\"y\":var s=e.getCursorPosition();e.selection.selectLine();for(var o=0;o<n-1;o++)e.selection.moveCursorDown();i._default.text=e.getCopyText().replace(/\\n$/,\"\"),e.selection.clearSelection(),i._default.isLine=!0,e.moveCursorToPosition(s);break;default:if(t){var s=e.getCursorPosition();e.selection.setSelectionRange(t),i._default.text=e.getCopyText(),i._default.isLine=!1,e.selection.clearSelection(),e.moveCursorTo(s.row,s.column)}}}},\">\":{selFn:function(e,t,n,i){n=n||1;for(var s=0;s<n;s++)e.indent();r.normalMode(e)},fn:function(e,t,n,r){n=parseInt(n||1,10);switch(r){case\">\":var i=e.getCursorPosition();e.selection.selectLine();for(var s=0;s<n-1;s++)e.selection.moveCursorDown();e.indent(),e.selection.clearSelection(),e.moveCursorToPosition(i),e.navigateLineEnd(),e.navigateLineStart()}}},\"<\":{selFn:function(e,t,n,i){n=n||1;for(var s=0;s<n;s++)e.blockOutdent();r.normalMode(e)},fn:function(e,t,n,r){n=n||1;switch(r){case\"<\":var i=e.getCursorPosition();e.selection.selectLine();for(var s=0;s<n-1;s++)e.selection.moveCursorDown();e.blockOutdent(),e.selection.clearSelection(),e.moveCursorToPosition(i),e.navigateLineEnd(),e.navigateLineStart()}}}}}),\"use strict\",define(\"ace/keyboard/vim/maps/aliases\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports={x:{operator:{ch:\"d\",count:1},motion:{ch:\"l\",count:1}},X:{operator:{ch:\"d\",count:1},motion:{ch:\"h\",count:1}},D:{operator:{ch:\"d\",count:1},motion:{ch:\"$\",count:1}},C:{operator:{ch:\"c\",count:1},motion:{ch:\"$\",count:1}},s:{operator:{ch:\"c\",count:1},motion:{ch:\"l\",count:1}},S:{operator:{ch:\"c\",count:1},param:\"c\"}}})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-abap.js",
    "content": "define(\"ace/mode/abap\",[\"require\",\"exports\",\"module\",\"ace/mode/abap_highlight_rules\",\"ace/mode/folding/coffee\",\"ace/range\",\"ace/mode/text\",\"ace/lib/oop\"],function(e,t,n){function a(){this.HighlightRules=r,this.foldingRules=new i}var r=e(\"./abap_highlight_rules\").AbapHighlightRules,i=e(\"./folding/coffee\").FoldMode,s=e(\"../range\").Range,o=e(\"./text\").Mode,u=e(\"../lib/oop\");u.inherits(a,o),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.toggleCommentLines=function(e,t,n,r){var i=new s(0,0,0,0);for(var o=n;o<=r;++o){var u=t.getLine(o);if(hereComment.test(u))continue;commentLine.test(u)?u=u.replace(commentLine,\"$1\"):u=u.replace(indentation,\"$&#\"),i.end.row=i.start.row=o,i.end.column=u.length+1,t.replace(i,u)}},this.$id=\"ace/mode/abap\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/abap_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=this.createKeywordMapper({\"variable.language\":\"this\",keyword:\"ADD ALIAS ALIASES ASSERT ASSIGN ASSIGNING AT BACK CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY DATA DEFINE DEFINITION DEFERRED DELETE DESCRIBE DETAIL DIVIDE DO ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT FETCH FIELDS FORM FORMAT FREE FROM FUNCTION GENERATE GET HIDE IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION LEAVE LIKE LINE LOAD LOCAL LOOP MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY ON OVERLAY OPTIONAL OTHERS PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURNING ROLLBACK SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES UNASSIGN ULINE UNPACK UPDATE WHEN WHILE WINDOW WRITE OCCURS STRUCTURE OBJECT PROPERTY CASTING APPEND RAISING VALUE COLOR CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT ID NUMBER FOR TITLE OUTPUT WITH EXIT USING INTO WHERE GROUP BY HAVING ORDER BY SINGLE APPENDING CORRESPONDING FIELDS OF TABLE LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN\",\"constant.language\":\"TRUE FALSE NULL SPACE\",\"support.type\":\"c n i p f d t x string xstring decfloat16 decfloat34\",\"keyword.operator\":\"abs sign ceil floor trunc frac acos asin atan cos sin tan abapOperator cosh sinh tanh exp log log10 sqrt strlen xstrlen charlen numofchar dbmaxlen lines\"},\"text\",!0,\" \"),t=\"WITH\\\\W+(?:HEADER\\\\W+LINE|FRAME|KEY)|NO\\\\W+STANDARD\\\\W+PAGE\\\\W+HEADING|EXIT\\\\W+FROM\\\\W+STEP\\\\W+LOOP|BEGIN\\\\W+OF\\\\W+(?:BLOCK|LINE)|BEGIN\\\\W+OF|END\\\\W+OF\\\\W+(?:BLOCK|LINE)|END\\\\W+OF|NO\\\\W+INTERVALS|RESPECTING\\\\W+BLANKS|SEPARATED\\\\W+BY|USING\\\\W+(?:EDIT\\\\W+MASK)|WHERE\\\\W+(?:LINE)|RADIOBUTTON\\\\W+GROUP|REF\\\\W+TO|(?:PUBLIC|PRIVATE|PROTECTED)(?:\\\\W+SECTION)?|DELETING\\\\W+(?:TRAILING|LEADING)(?:ALL\\\\W+OCCURRENCES)|(?:FIRST|LAST)\\\\W+OCCURRENCE|INHERITING\\\\W+FROM|LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|IS\\\\W+(?:NOT\\\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)\";this.$rules={start:[{token:\"string\",regex:\"`\",next:\"string\"},{token:\"string\",regex:\"'\",next:\"qstring\"},{token:\"doc.comment\",regex:/^\\*.+/},{token:\"comment\",regex:/\".+$/},{token:\"invalid\",regex:\"\\\\.{2,}\"},{token:\"keyword.operator\",regex:/\\W[\\-+\\%=<>*]\\W|\\*\\*|[~:,\\.&$]|->*?|=>/},{token:\"paren.lparen\",regex:\"[\\\\[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+\\\\b\"},{token:\"variable.parameter\",regex:/sy|pa?\\d\\d\\d\\d\\|t\\d\\d\\d\\.|innnn/},{token:\"keyword\",regex:t},{token:\"variable.parameter\",regex:/\\w+-\\w+(?:-\\w+)*/},{token:e,regex:\"\\\\b\\\\w+\\\\b\"},{caseInsensitive:!0}],qstring:[{token:\"constant.language.escape\",regex:\"''\"},{token:\"string\",regex:\"'\",next:\"start\"},{defaultToken:\"string\"}],string:[{token:\"constant.language.escape\",regex:\"``\"},{token:\"string\",regex:\"`\",next:\"start\"},{defaultToken:\"string\"}]}};r.inherits(s,i),t.AbapHighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-actionscript.js",
    "content": "define(\"ace/mode/actionscript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/actionscript_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./actionscript_highlight_rules\").ActionScriptHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/actionscript\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/actionscript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"support.class.actionscript.2\",regex:\"\\\\b(?:R(?:ecordset|DBMSResolver|adioButton(?:Group)?)|X(?:ML(?:Socket|Node|Connector)?|UpdateResolverDataHolder)|M(?:M(?:Save|Execute)|icrophoneMicrophone|o(?:use|vieClip(?:Loader)?)|e(?:nu(?:Bar)?|dia(?:Controller|Display|Playback))|ath)|B(?:yName|inding|utton)|S(?:haredObject|ystem|crollPane|t(?:yleSheet|age|ream)|ound|e(?:ndEvent|rviceObject)|OAPCall|lide)|N(?:umericStepper|et(?:stream|S(?:tream|ervices)|Connection|Debug(?:Config)?))|C(?:heckBox|o(?:ntextMenu(?:Item)?|okie|lor|m(?:ponentMixins|boBox))|ustomActions|lient|amera)|T(?:ypedValue|ext(?:Snapshot|Input|F(?:ield|ormat)|Area)|ree|AB)|Object|D(?:ownload|elta(?:Item|Packet)?|at(?:e(?:Chooser|Field)?|a(?:G(?:lue|rid)|Set|Type)))|U(?:RL|TC|IScrollBar)|P(?:opUpManager|endingCall|r(?:intJob|o(?:duct|gressBar)))|E(?:ndPoint|rror)|Video|Key|F(?:RadioButton|GridColumn|MessageBox|BarChart|S(?:croll(?:Bar|Pane)|tyleFormat|plitView)|orm|C(?:heckbox|omboBox|alendar)|unction|T(?:icker|ooltip(?:Lite)?|ree(?:Node)?)|IconButton|D(?:ataGrid|raggablePane)|P(?:ieChart|ushButton|ro(?:gressBar|mptBox))|L(?:i(?:stBox|neChart)|oadingBox)|AdvancedMessageBox)|W(?:indow|SDLURL|ebService(?:Connector)?)|L(?:ist|o(?:calConnection|ad(?:er|Vars)|g)|a(?:unch|bel))|A(?:sBroadcaster|cc(?:ordion|essibility)|S(?:Set(?:Native|PropFlags)|N(?:ew|ative)|C(?:onstructor|lamp(?:2)?)|InstanceOf)|pplication|lert|rray))\\\\b\"},{token:\"support.function.actionscript.2\",regex:\"\\\\b(?:s(?:h(?:ift|ow(?:GridLines|Menu|Border|Settings|Headers|ColumnHeaders|Today|Preferences)?|ad(?:ow|ePane))|c(?:hema|ale(?:X|Mode|Y|Content)|r(?:oll(?:Track|Drag)?|een(?:Resolution|Color|DPI)))|t(?:yleSheet|op(?:Drag|A(?:nimation|llSounds|gent))?|epSize|a(?:tus|rt(?:Drag|A(?:nimation|gent))?))|i(?:n|ze|lence(?:TimeOut|Level))|o(?:ngname|urce|rt(?:Items(?:By)?|On(?:HeaderRelease)?|able(?:Columns)?)?)|u(?:ppressInvalidCalls|bstr(?:ing)?)|p(?:li(?:ce|t)|aceCol(?:umnsEqually|lumnsEqually))|e(?:nd(?:DefaultPushButtonEvent|AndLoad)?|curity|t(?:R(?:GB|o(?:otNode|w(?:Height|Count))|esizable(?:Columns)?|a(?:nge|te))|G(?:ain|roupName)|X(?:AxisTitle)?|M(?:i(?:n(?:imum|utes)|lliseconds)|o(?:nth(?:Names)?|tionLevel|de)|ultilineMode|e(?:ssage|nu(?:ItemEnabled(?:At)?|EnabledAt)|dia)|a(?:sk|ximum))|B(?:u(?:tton(?:s|Width)|fferTime)|a(?:seTabIndex|ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Target|P(?:osition|roperties)|barState|Location)|t(?:yle(?:Property)?|opOnFocus|at(?:us|e))|i(?:ze|lenceLevel)|ort(?:able(?:Columns)?|Function)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)?|Style|Color|ed(?:Node(?:s)?|Cell|I(?:nd(?:ices|ex)|tem(?:s)?))?|able))|kin|m(?:oothness|allScroll))|H(?:ighlight(?:s|Color)|Scroll|o(?:urs|rizontal)|eader(?:Symbol|Height|Text|Property|Format|Width|Location)?|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:ode(?:Properties|ExpansionHandler)|ewTextFormat)|C(?:h(?:ildNodes|a(?:ngeHandler|rt(?:Title|EventHandler)))|o(?:ntent(?:Size)?|okie|lumns)|ell(?:Symbol|Data)|l(?:i(?:ckHandler|pboard)|oseHandler)|redentials)|T(?:ype(?:dVaule)?|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:out(?:Handler)?)?)|oggle|extFormat|ransform)|I(?:s(?:Branch|Open)|n(?:terval|putProperty)|con(?:SymbolName)?|te(?:rator|m(?:ByKey|Symbol)))|Orientation|D(?:i(?:splay(?:Range|Graphics|Mode|Clip|Text|edMonth)|rection)|uration|e(?:pth(?:Below|To|Above)|fault(?:GatewayURL|Mappings|NodeIconSymbolName)|l(?:iveryMode|ay)|bug(?:ID)?)|a(?:yOfWeekNames|t(?:e(?:Filter)?|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Provider|All(?:Height|Property|Format|Width))?))|ra(?:wConnectors|gContent))|U(?:se(?:Shadow|HandCursor|EchoSuppression|rInput|Fade)|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear))|P(?:osition|ercentComplete|an(?:e(?:M(?:inimumSize|aximumSize)|Size|Title))?|ro(?:pert(?:y(?:Data)?|iesAt)|gress))|E(?:nabled|dit(?:Handler|able)|xpand(?:NodeTrigger|erSymbolName))|V(?:Scroll|olume|alue(?:Source)?)|KeyFrameInterval|Quality|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|ocus|ullYear|ps|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:opback|adTarget)|a(?:rgeScroll|bel(?:Source|Placement)?))|A(?:s(?:Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:e(?:State(?:Handler)?|Handler)|ateHandler)|utoH(?:ideScrollBar|eight)))?|paratorBefore|ek|lect(?:ion(?:Disabled|Unfocused)?|ed(?:Node(?:s)?|Child|I(?:nd(?:ices|ex)|tem(?:s)?)|Dat(?:e|a))?|able(?:Ranges)?)|rver(?:String)?)|kip|qrt|wapDepths|lice|aveToSharedObj|moothing)|h(?:scroll(?:Policy)?|tml(?:Text)?|i(?:t(?:Test(?:TextNearPos)?|Area)|de(?:BuiltInItems|Child)?|ghlight(?:2D|3D)?)|orizontal|e(?:ight|ader(?:Re(?:nderer|lease)|Height|Text))|P(?:osition|ageScrollSize)|a(?:s(?:childNodes|MP3|S(?:creen(?:Broadcast|Playback)|treaming(?:Video|Audio)|ort)|Next|OwnProperty|Pr(?:inting|evious)|EmbeddedVideo|VideoEncoder|A(?:ccesibility|udio(?:Encoder)?))|ndlerName)|LineScrollSize)|ye(?:sLabel|ar)|n(?:o(?:t|de(?:Name|Close|Type|Open|Value)|Label)|u(?:llValue|mChild(?:S(?:creens|lides)|ren|Forms))|e(?:w(?:Item|line|Value|LocationDialog)|xt(?:S(?:cene|ibling|lide)|TabIndex|Value|Frame)?)?|ame(?:s)?)|c(?:h(?:ildNodes|eck|a(?:nge(?:sPending)?|r(?:CodeAt|At))|r)|o(?:s|n(?:st(?:ant|ructor)|nect|c(?:urrency|at)|t(?:ent(?:Type|Path)?|ains|rol(?:Placement|lerPolicy))|denseWhite|version)|py|l(?:or|umn(?:Stretch|Name(?:s)?|Count))|m(?:p(?:onent|lete)|ment))|u(?:stomItems|ePoint(?:s)?|r(?:veTo|Value|rent(?:Slide|ChildSlide|Item|F(?:ocused(?:S(?:creen|lide)|Form)|ps))))|e(?:il|ll(?:Renderer|Press|Edit|Focus(?:In|Out)))|l(?:i(?:ck|ents)|o(?:se(?:Button|Pane)?|ne(?:Node)?)|ear(?:S(?:haredObjects|treams)|Timeout|Interval)?)|a(?:ncelLabel|tch|p(?:tion|abilities)|l(?:cFields|l(?:e(?:e|r))?))|reate(?:GatewayConnection|Menu|Se(?:rver|gment)|C(?:hild(?:AtDepth)?|l(?:ient|ass(?:ChildAtDepth|Object(?:AtDepth)?))|all)|Text(?:Node|Field)|Item|Object(?:AtDepth)?|PopUp|E(?:lement|mptyMovieClip)))|t(?:h(?:is|row)|ype(?:of|Name)?|i(?:tle(?:StyleDeclaration)?|me(?:out)?)|o(?:talTime|String|olTipText|p|UpperCase|ggle(?:HighQuality)?|Lo(?:caleString|werCase))|e(?:st|llTarget|xt(?:RightMargin|Bold|S(?:ize|elected)|Height|Color|I(?:ndent|talic)|Disabled|Underline|F(?:ield|ont)|Width|LeftMargin|Align)?)|a(?:n|rget(?:Path)?|b(?:Stops|Children|Index|Enabled|leName))|r(?:y|igger|ac(?:e|k(?:AsMenu)?)))|i(?:s(?:Running|Branch|NaN|Con(?:soleOpen|nected)|Toggled|Installed|Open|D(?:own|ebugger)|P(?:urchased|ro(?:totypeOf|pertyEnumerable))|Empty|F(?:inite|ullyPopulated)|Local|Active)|n(?:s(?:tall|ertBefore)|cludeDeltaPacketInfo|t|it(?:ialize|Component|Pod|A(?:pplication|gent))?|de(?:nt|terminate|x(?:InParent(?:Slide|Form)?|Of)?)|put|validate|finity|LocalInternetCache)?|con(?:F(?:ield|unction))?|t(?:e(?:ratorScrolled|m(?:s|RollO(?:ut|ver)|ClassName))|alic)|d3|p|fFrameLoaded|gnore(?:Case|White))|o(?:s|n(?:R(?:ollO(?:ut|ver)|e(?:s(?:ize|ult)|l(?:ease(?:Outside)?|aseOutside)))|XML|Mouse(?:Move|Down|Up|Wheel)|S(?:ync|croller|tatus|oundComplete|e(?:tFocus|lect(?:edItem)?))|N(?:oticeEvent|etworkChange)|C(?:hanged|onnect|l(?:ipEvent|ose))|ID3|D(?:isconnect|eactivate|ata|ragO(?:ut|ver))|Un(?:install|load)|P(?:aymentResult|ress)|EnterFrame|K(?:illFocus|ey(?:Down|Up))|Fault|Lo(?:ad|g)|A(?:ctiv(?:ity|ate)|ppSt(?:op|art)))?|pe(?:n|ration)|verLayChildren|kLabel|ldValue|r(?:d)?)|d(?:i(?:s(?:connect|play(?:Normal|ed(?:Month|Year)|Full)|able(?:Shader|d(?:Ranges|Days)|CloseBox|Events))|rection)|o(?:cTypeDecl|tall|Decoding|main|LazyDecoding)|u(?:plicateMovieClip|ration)|e(?:stroy(?:ChildAt|Object)|code|fault(?:PushButton(?:Enabled)?|KeydownHandler)?|l(?:ta(?:Packet(?:Changed)?)?|ete(?:PopUp|All)?)|blocking)|a(?:shBoardSave|yNames|ta(?:Provider)?|rkshadow)|r(?:opdown(?:Width)?|a(?:w|gO(?:ut|ver))))|u(?:se(?:Sort|HandCursor|Codepage|EchoSuppression)|n(?:shift|install|derline|escape|format|watch|lo(?:ck|ad(?:Movie(?:Num)?)?))|pdate(?:Results|Mode|I(?:nputProperties|tem(?:ByIndex)?)|P(?:acket|roperties)|View|AfterEvent)|rl)|join|p(?:ixelAspectRatio|o(?:sition|p|w)|u(?:sh|rge|blish)|ercen(?:tComplete|Loaded)|lay(?:head(?:Change|Time)|ing|Hidden|erType)?|a(?:ssword|use|r(?:se(?:XML|CSS|Int|Float)|ent(?:Node|Is(?:S(?:creen|lide)|Form))|ams))|r(?:int(?:Num|AsBitmap(?:Num)?)?|o(?:to(?:type)?|pert(?:y|ies)|gress)|e(?:ss|v(?:ious(?:S(?:ibling|lide)|Value)?|Scene|Frame)|ferred(?:Height|Width))))|e(?:scape|n(?:code(?:r)?|ter(?:Frame)?|dFill|able(?:Shader|d|CloseBox|Events))|dit(?:able|Field|LocationDialog)|v(?:ent|al(?:uate)?)|q|x(?:tended|p|ec(?:ute)?|actSettings)|m(?:phasized(?:StyleDeclaration)?|bedFonts))|v(?:i(?:sible|ewPod)|ScrollPolicy|o(?:id|lume)|ersion|P(?:osition|ageScrollSize)|a(?:l(?:idat(?:ionError|e(?:Property|ActivationKey)?)|ue(?:Of)?)|riable)|LineScrollSize)|k(?:ind|ey(?:Down|Up|Press|FrameInterval))|q(?:sort|uality)|f(?:scommand|i(?:n(?:d(?:Text|First|Last)?|ally)|eldInfo|lter(?:ed|Func)?|rst(?:Slide|Child|DayOfWeek|VisibleNode)?)|o(?:nt|cus(?:In|edCell|Out|Enabled)|r(?:egroundDisabled|mat(?:ter)?))|unctionName|ps|l(?:oor|ush)|ace|romCharCode)|w(?:i(?:th|dth)|ordWrap|atch|riteAccess)|l(?:t|i(?:st(?:Owner)?|ne(?:Style|To))|o(?:c(?:k|a(?:t(?:ion|eByld)|l(?:ToGlobal|FileReadDisable)))|opback|ad(?:Movie(?:Num)?|S(?:crollContent|ound)|ed|Variables(?:Num)?|Application)?|g(?:Changes)?)|e(?:ngth|ft(?:Margin)?|ading)?|a(?:st(?:Slide|Child|Index(?:Of)?)?|nguage|b(?:el(?:Placement|F(?:ield|unction))?|leField)))|a(?:s(?:scociate(?:Controller|Display)|in|pectRatio|function)|nd|c(?:ceptConnection|tiv(?:ityLevel|ePlayControl)|os)|t(?:t(?:ach(?:Movie|Sound|Video|Audio)|ributes)|an(?:2)?)|dd(?:header|RequestHeader|Menu(?:Item(?:At)?|At)?|Sort|Header|No(?:tice|de(?:At)?)|C(?:olumn(?:At)?|uePoint)|T(?:oLocalInternetCache|reeNode(?:At)?)|I(?:con|tem(?:s(?:At)?|At)?)|DeltaItem|P(?:od|age|roperty)|EventListener|View|FieldInfo|Listener|Animation)?|uto(?:Size|Play|KeyNav|Load)|pp(?:endChild|ly(?:Changes|Updates)?)|vHardwareDisable|fterLoaded|l(?:ternateRowColors|ign|l(?:ow(?:InsecureDomain|Domain)|Transitions(?:InDone|OutDone))|bum)|r(?:tist|row|g(?:uments|List))|gent|bs)|r(?:ight(?:Margin)?|o(?:ot(?:S(?:creen|lide)|Form)|und|w(?:Height|Count)|llO(?:ut|ver))|e(?:s(?:yncDepth|t(?:orePane|artAnimation|rict)|iz(?:e|able(?:Columns)?)|olveDelta|ult(?:s)?|ponse)|c(?:o(?:ncile(?:Results|Updates)|rd)|eive(?:Video|Audio))|draw|jectConnection|place(?:Sel|ItemAt|AllItems)?|ve(?:al(?:Child)?|rse)|quest(?:SizeChange|Payment)?|f(?:errer|resh(?:ScrollContent|Destinations|Pane|FromSources)?)|lease(?:Outside)?|ad(?:Only|Access)|gister(?:SkinElement|C(?:olor(?:Style|Name)|lass)|InheritingStyle|Proxy)|move(?:Range|M(?:ovieClip|enu(?:Item(?:At)?|At))|Background|Sort|No(?:tice|de(?:sAt|At)?)|C(?:olum(?:nAt|At)|uePoints)|T(?:extField|reeNode(?:At)?)|Item(?:At)?|Pod|EventListener|FromLocalInternetCache|Listener|All(?:C(?:olumns|uePoints)|Items)?))|a(?:ndom|te|dioDot))|g(?:t|oto(?:Slide|NextSlide|PreviousSlide|FirstSlide|LastSlide|And(?:Stop|Play))|e(?:nre|t(?:R(?:GB|o(?:otNode|wCount)|e(?:sizable|mote))|X(?:AxisTitle)?|M(?:i(?:n(?:imum(?:Size)?|utes)|lliseconds)|onth(?:Names)?|ultilineMode|e(?:ssage|nu(?:ItemAt|EnabledAt|At))|aximum(?:Size)?)|B(?:ytes(?:Total|Loaded)|ounds|utton(?:s|Width)|eginIndex|a(?:ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Position|barState|Location)|t(?:yle(?:Names)?|opOnFocus|ate)|ize|o(?:urce|rtState)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)|Style|ed(?:Node(?:s)?|Cell|Text|I(?:nd(?:ices|ex)|tem(?:s)?))?)|rvice)|moothness|WFVersion)|H(?:ighlight(?:s|Color)|ours|e(?:ight|ader(?:Height|Text|Property|Format|Width|Location)?)|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:o(?:tices|de(?:DisplayedAt|At))|um(?:Children|berAvailable)|e(?:wTextFormat|xtHighestDepth))|C(?:h(?:ild(?:S(?:creen|lide)|Nodes|Form|At)|artTitle)|o(?:n(?:tent|figInfo)|okie|de|unt|lumn(?:Names|Count|Index|At))|uePoint|ellIndex|loseHandler|a(?:ll|retIndex))|T(?:ypedValue|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:stamp|zoneOffset|out(?:State|Handler)|r)?)|oggle|ext(?:Extent|Format)?|r(?:ee(?:NodeAt|Length)|ans(?:form|actionId)))|I(?:s(?:Branch|Open)|n(?:stanceAtDepth|d(?:icesByKey|exByKey))|con(?:SymbolName)?|te(?:rator|m(?:sByKey|By(?:Name|Key)|id|ID|At))|d)|O(?:utput(?:Parameter(?:s|ByName)?|Value(?:s)?)|peration|ri(?:entation|ginalCellData))|D(?:i(?:s(?:play(?:Range|Mode|Clip|Index|edMonth)|kUsage)|rection)|uration|e(?:pth|faultNodeIconSymbolName|l(?:taPacket|ay)|bug(?:Config|ID)?)|a(?:y(?:OfWeekNames)?|t(?:e|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Label|All(?:Height|Property|Format|Width))?))|rawConnectors)|U(?:se(?:Shadow|HandCursor|rInput|Fade)|RL|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear))|P(?:o(?:sition|ds)|ercentComplete|a(?:n(?:e(?:M(?:inimums|aximums)|Height|Title|Width))?|rentNode)|r(?:operty(?:Name|Data)?|efer(?:ences|red(?:Height|Width))))|E(?:n(?:dIndex|abled)|ditingData|x(?:panderSymbolName|andNodeTrigger))|V(?:iewed(?:Pods|Applications)|olume|ersion|alue(?:Source)?)|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|o(?:ntList|cus)|ullYear|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:cal|adTarget)|ength|a(?:stTabIndex|bel(?:Source)?))|A(?:s(?:cii|Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:eState(?:Handler)?|ateHandler)|utoH(?:ideScrollBar|eight)|llItems|gent))?)?|lobal(?:StyleFormat|ToLocal)?|ain|roupName)|x(?:updatePackety|mlDecl)?|m(?:y(?:MethodName|Call)|in(?:imum)?|o(?:nthNames|tion(?:TimeOut|Level)|de(?:lChanged)?|use(?:Move|O(?:ut|ver)|Down(?:Somewhere|Outside)?|Up(?:Somewhere)?|WheelEnabled)|ve(?:To)?)|u(?:ted|lti(?:pleS(?:imultaneousAllowed|elections)|line))|e(?:ssage|nu(?:Show|Hide)?|th(?:od)?|diaType)|a(?:nufacturer|tch|x(?:scroll|hscroll|imum|HPosition|Chars|VPosition)?)|b(?:substring|chr|ord|length))|b(?:ytes(?:Total|Loaded)|indFormat(?:Strings|Function)|o(?:ttom(?:Scroll)?|ld|rder(?:Color)?)|u(?:tton(?:Height|Width)|iltInItems|ffer(?:Time|Length)|llet)|e(?:foreApplyUpdates|gin(?:GradientFill|Fill))|lockIndent|a(?:ndwidth|ckground(?:Style|Color|Disabled)?)|roadcastMessage)|onHTTPStatus)\\\\b\"},{token:\"support.constant.actionscript.2\",regex:\"\\\\b(?:__proto__|__resolve|_accProps|_alpha|_changed|_currentframe|_droptarget|_flash|_focusrect|_framesloaded|_global|_height|_highquality|_level|_listeners|_lockroot|_name|_parent|_quality|_root|_rotation|_soundbuftime|_target|_totalframes|_url|_visible|_width|_x|_xmouse|_xscale|_y|_ymouse|_yscale)\\\\b\"},{token:\"keyword.control.actionscript.2\",regex:\"\\\\b(?:dynamic|extends|import|implements|interface|public|private|new|static|super|var|for|in|break|continue|while|do|return|if|else|case|switch)\\\\b\"},{token:\"storage.type.actionscript.2\",regex:\"\\\\b(?:Boolean|Number|String|Void)\\\\b\"},{token:\"constant.language.actionscript.2\",regex:\"\\\\b(?:null|undefined|true|false)\\\\b\"},{token:\"constant.numeric.actionscript.2\",regex:\"\\\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\\\.?[0-9]*|\\\\.[0-9]+)(?:(?:e|E)(?:\\\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\\\b\"},{token:\"punctuation.definition.string.begin.actionscript.2\",regex:'\"',push:[{token:\"punctuation.definition.string.end.actionscript.2\",regex:'\"',next:\"pop\"},{token:\"constant.character.escape.actionscript.2\",regex:\"\\\\\\\\.\"},{defaultToken:\"string.quoted.double.actionscript.2\"}]},{token:\"punctuation.definition.string.begin.actionscript.2\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.actionscript.2\",regex:\"'\",next:\"pop\"},{token:\"constant.character.escape.actionscript.2\",regex:\"\\\\\\\\.\"},{defaultToken:\"string.quoted.single.actionscript.2\"}]},{token:\"support.constant.actionscript.2\",regex:\"\\\\b(?:BACKSPACE|CAPSLOCK|CONTROL|DELETEKEY|DOWN|END|ENTER|HOME|INSERT|LEFT|LN10|LN2|LOG10E|LOG2E|MAX_VALUE|MIN_VALUE|NEGATIVE_INFINITY|NaN|PGDN|PGUP|PI|POSITIVE_INFINITY|RIGHT|SPACE|SQRT1_2|SQRT2|UP)\\\\b\"},{token:\"punctuation.definition.comment.actionscript.2\",regex:\"/\\\\*\",push:[{token:\"punctuation.definition.comment.actionscript.2\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.actionscript.2\"}]},{token:\"punctuation.definition.comment.actionscript.2\",regex:\"//.*$\",push_:[{token:\"comment.line.double-slash.actionscript.2\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.double-slash.actionscript.2\"}]},{token:\"keyword.operator.actionscript.2\",regex:\"\\\\binstanceof\\\\b\"},{token:\"keyword.operator.symbolic.actionscript.2\",regex:\"[-!%&*+=/?:]\"},{token:[\"meta.preprocessor.actionscript.2\",\"punctuation.definition.preprocessor.actionscript.2\",\"meta.preprocessor.actionscript.2\"],regex:\"^([ \\\\t]*)(#)([a-zA-Z]+)\"},{token:[\"storage.type.function.actionscript.2\",\"meta.function.actionscript.2\",\"entity.name.function.actionscript.2\",\"meta.function.actionscript.2\",\"punctuation.definition.parameters.begin.actionscript.2\"],regex:\"\\\\b(function)(\\\\s+)([a-zA-Z_]\\\\w*)(\\\\s*)(\\\\()\",push:[{token:\"punctuation.definition.parameters.end.actionscript.2\",regex:\"\\\\)\",next:\"pop\"},{token:\"variable.parameter.function.actionscript.2\",regex:\"[^,)$]+\"},{defaultToken:\"meta.function.actionscript.2\"}]},{token:[\"storage.type.class.actionscript.2\",\"meta.class.actionscript.2\",\"entity.name.type.class.actionscript.2\",\"meta.class.actionscript.2\",\"storage.modifier.extends.actionscript.2\",\"meta.class.actionscript.2\",\"entity.other.inherited-class.actionscript.2\"],regex:\"\\\\b(class)(\\\\s+)([a-zA-Z_](?:\\\\w|\\\\.)*)(?:(\\\\s+)(extends)(\\\\s+)([a-zA-Z_](?:\\\\w|\\\\.)*))?\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"as\"],keyEquivalent:\"^~A\",name:\"ActionScript\",scopeName:\"source.actionscript.2\"},r.inherits(s,i),t.ActionScriptHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ada.js",
    "content": "define(\"ace/mode/ada\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ada_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ada_highlight_rules\").AdaHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.$id=\"ace/mode/ada\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/ada_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|body|private|then|if|procedure|type|case|in|protected|constant|interface|until||is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor\",t=\"true|false|null\",n=\"count|min|max|avg|sum|rank|now|coalesce|main\",r=this.createKeywordMapper({\"support.function\":n,keyword:e,\"constant.language\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"--.*$\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|%|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.AdaHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-apache_conf.js",
    "content": "define(\"ace/mode/apache_conf\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/apache_conf_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./apache_conf_highlight_rules\").ApacheConfHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"#\",this.$id=\"ace/mode/apache_conf\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/apache_conf_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:[\"punctuation.definition.comment.apacheconf\",\"comment.line.hash.ini\",\"comment.line.hash.ini\"],regex:\"^((?:\\\\s)*)(#)(.*$)\"},{token:[\"punctuation.definition.tag.apacheconf\",\"entity.tag.apacheconf\",\"text\",\"string.value.apacheconf\",\"punctuation.definition.tag.apacheconf\"],regex:\"(<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(?:(\\\\s)(.+?))?(>)\"},{token:[\"punctuation.definition.tag.apacheconf\",\"entity.tag.apacheconf\",\"punctuation.definition.tag.apacheconf\"],regex:\"(</)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(>)\"},{token:[\"keyword.alias.apacheconf\",\"text\",\"string.regexp.apacheconf\",\"text\",\"string.replacement.apacheconf\",\"text\"],regex:\"(Rewrite(?:Rule|Cond))(\\\\s+)(.+?)(\\\\s+)(.+?)($|\\\\s)\"},{token:[\"keyword.alias.apacheconf\",\"text\",\"entity.status.apacheconf\",\"text\",\"string.regexp.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\"],regex:\"(RedirectMatch)(?:(\\\\s+)(\\\\d\\\\d\\\\d|permanent|temp|seeother|gone))?(\\\\s+)(.+?)(\\\\s+)(?:(.+?)($|\\\\s))?\"},{token:[\"keyword.alias.apacheconf\",\"text\",\"entity.status.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\"],regex:\"(Redirect)(?:(\\\\s+)(\\\\d\\\\d\\\\d|permanent|temp|seeother|gone))?(\\\\s+)(.+?)(\\\\s+)(?:(.+?)($|\\\\s))?\"},{token:[\"keyword.alias.apacheconf\",\"text\",\"string.regexp.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\"],regex:\"(ScriptAliasMatch|AliasMatch)(\\\\s+)(.+?)(\\\\s+)(?:(.+?)(\\\\s))?\"},{token:[\"keyword.alias.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\",\"string.path.apacheconf\",\"text\"],regex:\"(RedirectPermanent|RedirectTemp|ScriptAlias|Alias)(\\\\s+)(.+?)(\\\\s+)(?:(.+?)($|\\\\s))?\"},{token:\"keyword.core.apacheconf\",regex:\"\\\\b(?:AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|TimeOut|TraceEnable|UseCanonicalName)\\\\b\"},{token:\"keyword.mpm.apacheconf\",regex:\"\\\\b(?:AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\\\\b\"},{token:\"keyword.access.apacheconf\",regex:\"\\\\b(?:Allow|Deny|Order)\\\\b\"},{token:\"keyword.actions.apacheconf\",regex:\"\\\\b(?:Action|Script)\\\\b\"},{token:\"keyword.alias.apacheconf\",regex:\"\\\\b(?:Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\\\\b\"},{token:\"keyword.auth.apacheconf\",regex:\"\\\\b(?:AuthAuthoritative|AuthGroupFile|AuthUserFile)\\\\b\"},{token:\"keyword.auth_anon.apacheconf\",regex:\"\\\\b(?:Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\\\\b\"},{token:\"keyword.auth_dbm.apacheconf\",regex:\"\\\\b(?:AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\\\\b\"},{token:\"keyword.auth_digest.apacheconf\",regex:\"\\\\b(?:AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)\\\\b\"},{token:\"keyword.auth_ldap.apacheconf\",regex:\"\\\\b(?:AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\\\\b\"},{token:\"keyword.autoindex.apacheconf\",regex:\"\\\\b(?:AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|ReadmeName)\\\\b\"},{token:\"keyword.cache.apacheconf\",regex:\"\\\\b(?:CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\\\\b\"},{token:\"keyword.cern_meta.apacheconf\",regex:\"\\\\b(?:MetaDir|MetaFiles|MetaSuffix)\\\\b\"},{token:\"keyword.cgi.apacheconf\",regex:\"\\\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength)\\\\b\"},{token:\"keyword.cgid.apacheconf\",regex:\"\\\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\\\\b\"},{token:\"keyword.charset_lite.apacheconf\",regex:\"\\\\b(?:CharsetDefault|CharsetOptions|CharsetSourceEnc)\\\\b\"},{token:\"keyword.dav.apacheconf\",regex:\"\\\\b(?:Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\\\\b\"},{token:\"keyword.deflate.apacheconf\",regex:\"\\\\b(?:DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\\\\b\"},{token:\"keyword.dir.apacheconf\",regex:\"\\\\b(?:DirectoryIndex|DirectorySlash)\\\\b\"},{token:\"keyword.disk_cache.apacheconf\",regex:\"\\\\b(?:CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\\\\b\"},{token:\"keyword.dumpio.apacheconf\",regex:\"\\\\b(?:DumpIOInput|DumpIOOutput)\\\\b\"},{token:\"keyword.env.apacheconf\",regex:\"\\\\b(?:PassEnv|SetEnv|UnsetEnv)\\\\b\"},{token:\"keyword.expires.apacheconf\",regex:\"\\\\b(?:ExpiresActive|ExpiresByType|ExpiresDefault)\\\\b\"},{token:\"keyword.ext_filter.apacheconf\",regex:\"\\\\b(?:ExtFilterDefine|ExtFilterOptions)\\\\b\"},{token:\"keyword.file_cache.apacheconf\",regex:\"\\\\b(?:CacheFile|MMapFile)\\\\b\"},{token:\"keyword.headers.apacheconf\",regex:\"\\\\b(?:Header|RequestHeader)\\\\b\"},{token:\"keyword.imap.apacheconf\",regex:\"\\\\b(?:ImapBase|ImapDefault|ImapMenu)\\\\b\"},{token:\"keyword.include.apacheconf\",regex:\"\\\\b(?:SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\\\\b\"},{token:\"keyword.isapi.apacheconf\",regex:\"\\\\b(?:ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\\\\b\"},{token:\"keyword.ldap.apacheconf\",regex:\"\\\\b(?:LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\\\\b\"},{token:\"keyword.log.apacheconf\",regex:\"\\\\b(?:BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\\\\b\"},{token:\"keyword.mem_cache.apacheconf\",regex:\"\\\\b(?:MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\\\\b\"},{token:\"keyword.mime.apacheconf\",regex:\"\\\\b(?:AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\\\\b\"},{token:\"keyword.misc.apacheconf\",regex:\"\\\\b(?:ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\\\\b\"},{token:\"keyword.negotiation.apacheconf\",regex:\"\\\\b(?:CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\\\\b\"},{token:\"keyword.nw_ssl.apacheconf\",regex:\"\\\\b(?:NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\\\\b\"},{token:\"keyword.proxy.apacheconf\",regex:\"\\\\b(?:AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\\\\b\"},{token:\"keyword.rewrite.apacheconf\",regex:\"\\\\b(?:RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\\\\b\"},{token:\"keyword.setenvif.apacheconf\",regex:\"\\\\b(?:BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\\\\b\"},{token:\"keyword.so.apacheconf\",regex:\"\\\\b(?:LoadFile|LoadModule)\\\\b\"},{token:\"keyword.ssl.apacheconf\",regex:\"\\\\b(?:SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth)\\\\b\"},{token:\"keyword.usertrack.apacheconf\",regex:\"\\\\b(?:CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\\\\b\"},{token:\"keyword.vhost_alias.apacheconf\",regex:\"\\\\b(?:VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\\\\b\"},{token:[\"keyword.php.apacheconf\",\"text\",\"entity.property.apacheconf\",\"text\",\"string.value.apacheconf\",\"text\"],regex:\"\\\\b(php_value|php_flag)\\\\b(?:(\\\\s+)(.+?)(?:(\\\\s+)(.+?))?)?(\\\\s)\"},{token:[\"punctuation.variable.apacheconf\",\"variable.env.apacheconf\",\"variable.misc.apacheconf\",\"punctuation.variable.apacheconf\"],regex:\"(%\\\\{)(?:(HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\\\\})\"},{token:[\"entity.mime-type.apacheconf\",\"text\"],regex:\"\\\\b((?:text|image|application|video|audio)/.+?)(\\\\s)\"},{token:\"entity.helper.apacheconf\",regex:\"\\\\b(?:from|unset|set|on|off)\\\\b\",caseInsensitive:!0},{token:\"constant.integer.apacheconf\",regex:\"\\\\b\\\\d+\\\\b\"},{token:[\"text\",\"punctuation.definition.flag.apacheconf\",\"string.flag.apacheconf\",\"punctuation.definition.flag.apacheconf\",\"text\"],regex:\"(\\\\s)(\\\\[)(.*?)(\\\\])(\\\\s)\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"conf\",\"CONF\",\"htaccess\",\"HTACCESS\",\"htgroups\",\"HTGROUPS\",\"htpasswd\",\"HTPASSWD\",\".htaccess\",\".HTACCESS\",\".htgroups\",\".HTGROUPS\",\".htpasswd\",\".HTPASSWD\"],name:\"Apache Conf\",scopeName:\"source.apacheconf\"},r.inherits(s,i),t.ApacheConfHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-applescript.js",
    "content": "define(\"ace/mode/applescript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/tokenizer\",\"ace/mode/applescript_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"../tokenizer\").Tokenizer,o=e(\"./applescript_highlight_rules\").AppleScriptHighlightRules,u=e(\"./folding/cstyle\").FoldMode,a=function(){this.HighlightRules=o,this.foldingRules=new u};r.inherits(a,i),function(){this.lineCommentStart=\"--\",this.blockComment={start:\"(*\",end:\"*)\"}}.call(a.prototype),t.Mode=a}),define(\"ace/mode/applescript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"about|above|after|against|and|around|as|at|back|before|beginning|behind|below|beneath|beside|between|but|by|considering|contain|contains|continue|copy|div|does|eighth|else|end|equal|equals|error|every|exit|fifth|first|for|fourth|from|front|get|given|global|if|ignoring|in|into|is|it|its|last|local|me|middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|reference|repeat|returning|script|second|set|seventh|since|sixth|some|tell|tenth|that|the|then|third|through|thru|timeout|times|to|transaction|try|until|where|while|whose|with|without\",t=\"AppleScript|false|linefeed|return|pi|quote|result|space|tab|true\",n=\"activate|beep|count|delay|launch|log|offset|read|round|run|say|summarize|write\",r=\"alias|application|boolean|class|constant|date|file|integer|list|number|real|record|string|text|character|characters|contents|day|frontmost|id|item|length|month|name|paragraph|paragraphs|rest|reverse|running|time|version|weekday|word|words|year\",i=this.createKeywordMapper({\"support.function\":n,\"constant.language\":t,\"support.type\":r,keyword:e},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"--.*$\"},{token:\"comment\",regex:\"\\\\(\\\\*\",next:\"comment\"},{token:\"string\",regex:'\".*?\"'},{token:\"support.type\",regex:\"\\\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\\\b\"},{token:\"support.function\",regex:\"\\\\b(clipboard info|the clipboard|info for|list (disks|folder)|mount volume|path to|(close|open for) access|(get|set) eof|current date|do shell script|get volume settings|random number|set volume|system attribute|system info|time to GMT|(load|run|store) script|scripting components|ASCII (character|number)|localized string|choose (application|color|file|file name|folder|from list|remote application|URL)|display (alert|dialog))\\\\b|^\\\\s*return\\\\b\"},{token:\"constant.language\",regex:\"\\\\b(text item delimiters|current application|missing value)\\\\b\"},{token:\"keyword\",regex:\"\\\\b(apart from|aside from|instead of|out of|greater than|isn't|(doesn't|does not) (equal|come before|come after|contain)|(greater|less) than( or equal)?|(starts?|ends|begins?) with|contained by|comes (before|after)|a (ref|reference))\\\\b\"},{token:i,regex:\"[a-zA-Z][a-zA-Z0-9_]*\\\\b\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\)\",next:\"start\"},{defaultToken:\"comment\"}]},this.normalizeRules()};r.inherits(s,i),t.AppleScriptHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-asciidoc.js",
    "content": "define(\"ace/mode/asciidoc\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/asciidoc_highlight_rules\",\"ace/mode/folding/asciidoc\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./asciidoc_highlight_rules\").AsciidocHighlightRules,o=e(\"./folding/asciidoc\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.type=\"text\",this.getNextLineIndent=function(e,t,n){if(e==\"listblock\"){var r=/^((?:.+)?)([-+*][ ]+)/.exec(t);return r?(new Array(r[1].length+1)).join(\" \")+r[2]:\"\"}return this.$getIndent(t)},this.$id=\"ace/mode/asciidoc\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/asciidoc_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){function t(e){var t=/\\w/.test(e)?\"\\\\b\":\"(?:\\\\B|^)\";return t+e+\"[^\"+e+\"].*?\"+e+\"(?![\\\\w*])\"}var e=\"[a-zA-Z\\xa1-\\uffff]+\\\\b\";this.$rules={start:[{token:\"empty\",regex:/$/},{token:\"literal\",regex:/^\\.{4,}\\s*$/,next:\"listingBlock\"},{token:\"literal\",regex:/^-{4,}\\s*$/,next:\"literalBlock\"},{token:\"string\",regex:/^\\+{4,}\\s*$/,next:\"passthroughBlock\"},{token:\"keyword\",regex:/^={4,}\\s*$/},{token:\"text\",regex:/^\\s*$/},{token:\"empty\",regex:\"\",next:\"dissallowDelimitedBlock\"}],dissallowDelimitedBlock:[{include:\"paragraphEnd\"},{token:\"comment\",regex:\"^//.+$\"},{token:\"keyword\",regex:\"^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):\"},{include:\"listStart\"},{token:\"literal\",regex:/^\\s+.+$/,next:\"indentedBlock\"},{token:\"empty\",regex:\"\",next:\"text\"}],paragraphEnd:[{token:\"doc.comment\",regex:/^\\/{4,}\\s*$/,next:\"commentBlock\"},{token:\"tableBlock\",regex:/^\\s*[|!]=+\\s*$/,next:\"tableBlock\"},{token:\"keyword\",regex:/^(?:--|''')\\s*$/,next:\"start\"},{token:\"option\",regex:/^\\[.*\\]\\s*$/,next:\"start\"},{token:\"pageBreak\",regex:/^>{3,}$/,next:\"start\"},{token:\"literal\",regex:/^\\.{4,}\\s*$/,next:\"listingBlock\"},{token:\"titleUnderline\",regex:/^(?:={2,}|-{2,}|~{2,}|\\^{2,}|\\+{2,})\\s*$/,next:\"start\"},{token:\"singleLineTitle\",regex:/^={1,5}\\s+\\S.*$/,next:\"start\"},{token:\"otherBlock\",regex:/^(?:\\*{2,}|_{2,})\\s*$/,next:\"start\"},{token:\"optionalTitle\",regex:/^\\.[^.\\s].+$/,next:\"start\"}],listStart:[{token:\"keyword\",regex:/^\\s*(?:\\d+\\.|[a-zA-Z]\\.|[ixvmIXVM]+\\)|\\*{1,5}|-|\\.{1,5})\\s/,next:\"listText\"},{token:\"meta.tag\",regex:/^.+(?::{2,4}|;;)(?: |$)/,next:\"listText\"},{token:\"support.function.list.callout\",regex:/^(?:<\\d+>|\\d+>|>) /,next:\"text\"},{token:\"keyword\",regex:/^\\+\\s*$/,next:\"start\"}],text:[{token:[\"link\",\"variable.language\"],regex:/((?:https?:\\/\\/|ftp:\\/\\/|file:\\/\\/|mailto:|callto:)[^\\s\\[]+)(\\[.*?\\])/},{token:\"link\",regex:/(?:https?:\\/\\/|ftp:\\/\\/|file:\\/\\/|mailto:|callto:)[^\\s\\[]+/},{token:\"link\",regex:/\\b[\\w\\.\\/\\-]+@[\\w\\.\\/\\-]+\\b/},{include:\"macros\"},{include:\"paragraphEnd\"},{token:\"literal\",regex:/\\+{3,}/,next:\"smallPassthrough\"},{token:\"escape\",regex:/\\((?:C|TM|R)\\)|\\.{3}|->|<-|=>|<=|&#(?:\\d+|x[a-fA-F\\d]+);|(?: |^)--(?=\\s+\\S)/},{token:\"escape\",regex:/\\\\[_*'`+#]|\\\\{2}[_*'`+#]{2}/},{token:\"keyword\",regex:/\\s\\+$/},{token:\"text\",regex:e},{token:[\"keyword\",\"string\",\"keyword\"],regex:/(<<[\\w\\d\\-$]+,)(.*?)(>>|$)/},{token:\"keyword\",regex:/<<[\\w\\d\\-$]+,?|>>/},{token:\"constant.character\",regex:/\\({2,3}.*?\\){2,3}/},{token:\"keyword\",regex:/\\[\\[.+?\\]\\]/},{token:\"support\",regex:/^\\[{3}[\\w\\d =\\-]+\\]{3}/},{include:\"quotes\"},{token:\"empty\",regex:/^\\s*$/,next:\"start\"}],listText:[{include:\"listStart\"},{include:\"text\"}],indentedBlock:[{token:\"literal\",regex:/^[\\s\\w].+$/,next:\"indentedBlock\"},{token:\"literal\",regex:\"\",next:\"start\"}],listingBlock:[{token:\"literal\",regex:/^\\.{4,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"constant.numeric\",regex:\"<\\\\d+>\"},{token:\"literal\",regex:\"[^<]+\"},{token:\"literal\",regex:\"<\"}],literalBlock:[{token:\"literal\",regex:/^-{4,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"constant.numeric\",regex:\"<\\\\d+>\"},{token:\"literal\",regex:\"[^<]+\"},{token:\"literal\",regex:\"<\"}],passthroughBlock:[{token:\"literal\",regex:/^\\+{4,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"literal\",regex:e+\"|\\\\d+\"},{include:\"macros\"},{token:\"literal\",regex:\".\"}],smallPassthrough:[{token:\"literal\",regex:/[+]{3,}/,next:\"dissallowDelimitedBlock\"},{token:\"literal\",regex:/^\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"literal\",regex:e+\"|\\\\d+\"},{include:\"macros\"}],commentBlock:[{token:\"doc.comment\",regex:/^\\/{4,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"doc.comment\",regex:\"^.*$\"}],tableBlock:[{token:\"tableBlock\",regex:/^\\s*\\|={3,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"tableBlock\",regex:/^\\s*!={3,}\\s*$/,next:\"innerTableBlock\"},{token:\"tableBlock\",regex:/\\|/},{include:\"text\",noEscape:!0}],innerTableBlock:[{token:\"tableBlock\",regex:/^\\s*!={3,}\\s*$/,next:\"tableBlock\"},{token:\"tableBlock\",regex:/^\\s*|={3,}\\s*$/,next:\"dissallowDelimitedBlock\"},{token:\"tableBlock\",regex:/\\!/}],macros:[{token:\"macro\",regex:/{[\\w\\-$]+}/},{token:[\"text\",\"string\",\"text\",\"constant.character\",\"text\"],regex:/({)([\\w\\-$]+)(:)?(.+)?(})/},{token:[\"text\",\"markup.list.macro\",\"keyword\",\"string\"],regex:/(\\w+)(footnote(?:ref)?::?)([^\\s\\[]+)?(\\[.*?\\])?/},{token:[\"markup.list.macro\",\"keyword\",\"string\"],regex:/([a-zA-Z\\-][\\w\\.\\/\\-]*::?)([^\\s\\[]+)(\\[.*?\\])?/},{token:[\"markup.list.macro\",\"keyword\"],regex:/([a-zA-Z\\-][\\w\\.\\/\\-]+::?)(\\[.*?\\])/},{token:\"keyword\",regex:/^:.+?:(?= |$)/}],quotes:[{token:\"string.italic\",regex:/__[^_\\s].*?__/},{token:\"string.italic\",regex:t(\"_\")},{token:\"keyword.bold\",regex:/\\*\\*[^*\\s].*?\\*\\*/},{token:\"keyword.bold\",regex:t(\"\\\\*\")},{token:\"literal\",regex:t(\"\\\\+\")},{token:\"literal\",regex:/\\+\\+[^+\\s].*?\\+\\+/},{token:\"literal\",regex:/\\$\\$.+?\\$\\$/},{token:\"literal\",regex:t(\"`\")},{token:\"keyword\",regex:t(\"^\")},{token:\"keyword\",regex:t(\"~\")},{token:\"keyword\",regex:/##?/},{token:\"keyword\",regex:/(?:\\B|^)``|\\b''/}]};var n={macro:\"constant.character\",tableBlock:\"doc.comment\",titleUnderline:\"markup.heading\",singleLineTitle:\"markup.heading\",pageBreak:\"string\",option:\"string.regexp\",otherBlock:\"markup.list\",literal:\"support.function\",optionalTitle:\"constant.numeric\",escape:\"constant.language.escape\",link:\"markup.underline.list\"};for(var r in this.$rules){var i=this.$rules[r];for(var s=i.length;s--;){var o=i[s];if(o.include||typeof o==\"string\"){var u=[s,1].concat(this.$rules[o.include||o]);o.noEscape&&(u=u.filter(function(e){return!e.next})),i.splice.apply(i,u)}else o.token in n&&(o.token=n[o.token])}}};r.inherits(s,i),t.AsciidocHighlightRules=s}),define(\"ace/mode/folding/asciidoc\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.foldingStartMarker=/^(?:\\|={10,}|[\\.\\/=\\-~^+]{4,}\\s*$|={1,5} )/,this.singleLineHeadingRe=/^={1,5}(?=\\s+\\S)/,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?r[0]==\"=\"?this.singleLineHeadingRe.test(r)?\"start\":e.getLine(n-1).length!=e.getLine(n).length?\"\":\"start\":e.bgTokenizer.getState(n)==\"dissallowDelimitedBlock\"?\"end\":\"start\":\"\"},this.getFoldWidgetRange=function(e,t,n){function l(t){return f=e.getTokens(t)[0],f&&f.type}function d(){var t=f.value.match(p);if(t)return t[0].length;var r=c.indexOf(f.value[0])+1;return r==1&&e.getLine(n-1).length!=e.getLine(n).length?Infinity:r}var r=e.getLine(n),i=r.length,o=e.getLength(),u=n,a=n;if(!r.match(this.foldingStartMarker))return;var f,c=[\"=\",\"-\",\"~\",\"^\",\"+\"],h=\"markup.heading\",p=this.singleLineHeadingRe;if(l(n)==h){var v=d();while(++n<o){if(l(n)!=h)continue;var m=d();if(m<=v)break}var g=f&&f.value.match(this.singleLineHeadingRe);a=g?n-1:n-2;if(a>u)while(a>u&&(!l(a)||f.value[0]==\"[\"))a--;if(a>u){var y=e.getLine(a).length;return new s(u,i,a,y)}}else{var b=e.bgTokenizer.getState(n);if(b==\"dissallowDelimitedBlock\"){while(n-->0)if(e.bgTokenizer.getState(n).lastIndexOf(\"Block\")==-1)break;a=n+1;if(a<u){var y=e.getLine(n).length;return new s(a,5,u,i-5)}}else{while(++n<o)if(e.bgTokenizer.getState(n)==\"dissallowDelimitedBlock\")break;a=n;if(a>u){var y=e.getLine(n).length;return new s(u,5,a,y-5)}}}}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-assembly_x86.js",
    "content": "define(\"ace/mode/assembly_x86\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/assembly_x86_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./assembly_x86_highlight_rules\").AssemblyX86HighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\";\",this.$id=\"ace/mode/assembly_x86\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/assembly_x86_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"keyword.control.assembly\",regex:\"\\\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\\\b\",caseInsensitive:!0},{token:\"variable.parameter.register.assembly\",regex:\"\\\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\\\b\",caseInsensitive:!0},{token:\"constant.character.decimal.assembly\",regex:\"\\\\b[0-9]+\\\\b\"},{token:\"constant.character.hexadecimal.assembly\",regex:\"\\\\b0x[A-F0-9]+\\\\b\",caseInsensitive:!0},{token:\"constant.character.hexadecimal.assembly\",regex:\"\\\\b[A-F0-9]+h\\\\b\",caseInsensitive:!0},{token:\"string.assembly\",regex:/'([^\\\\']|\\\\.)*'/},{token:\"string.assembly\",regex:/\"([^\\\\\"]|\\\\.)*\"/},{token:\"support.function.directive.assembly\",regex:\"^\\\\[\",push:[{token:\"support.function.directive.assembly\",regex:\"\\\\]$\",next:\"pop\"},{defaultToken:\"support.function.directive.assembly\"}]},{token:[\"support.function.directive.assembly\",\"support.function.directive.assembly\",\"entity.name.function.assembly\"],regex:\"(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)\"},{token:\"support.function.directive.assembly\",regex:\"^endstruc\\\\b\"},{token:[\"support.function.directive.assembly\",\"entity.name.function.assembly\",\"support.function.directive.assembly\",\"constant.character.assembly\"],regex:\"^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)\"},{token:\"support.function.directive.assembly\",regex:\"^%endmacro\"},{token:[\"text\",\"support.function.directive.assembly\",\"text\",\"entity.name.function.assembly\"],regex:\"(\\\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\\\$\\\\$|\\\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)\",caseInsensitive:!0},{token:\"support.function.directive.assembly\",regex:\"\\\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\\\b\",caseInsensitive:!0},{token:\"entity.name.function.assembly\",regex:\"^\\\\s*%%[\\\\w.]+?:$\"},{token:\"entity.name.function.assembly\",regex:\"^\\\\s*%\\\\$[\\\\w.]+?:$\"},{token:\"entity.name.function.assembly\",regex:\"^[\\\\w.]+?:\"},{token:\"entity.name.function.assembly\",regex:\"^[\\\\w.]+?\\\\b\"},{token:\"comment.assembly\",regex:\";.*$\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"asm\"],name:\"Assembly x86\",scopeName:\"source.assembly\"},r.inherits(s,i),t.AssemblyX86HighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-autohotkey.js",
    "content": "define(\"ace/mode/autohotkey\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/autohotkey_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./autohotkey_highlight_rules\").AutoHotKeyHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"/\\\\*\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/autohotkey\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/autohotkey_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"And|ByRef|Case|Const|ContinueCase|ContinueLoop|Default|Dim|Do|Else|ElseIf|EndFunc|EndIf|EndSelect|EndSwitch|EndWith|Enum|Exit|ExitLoop|False|For|Func|Global|If|In|Local|Next|Not|Or|ReDim|Return|Select|Step|Switch|Then|To|True|Until|WEnd|While|With|Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitRotate|BitShift|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|ControlTreeView|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCallbackFree|DllCallbackGetPtr|DllCallbackRegister|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|FileCopy|FileCreateNTFSLink|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GUICreate|GUICtrlCreateAvi|GUICtrlCreateButton|GUICtrlCreateCheckbox|GUICtrlCreateCombo|GUICtrlCreateContextMenu|GUICtrlCreateDate|GUICtrlCreateDummy|GUICtrlCreateEdit|GUICtrlCreateGraphic|GUICtrlCreateGroup|GUICtrlCreateIcon|GUICtrlCreateInput|GUICtrlCreateLabel|GUICtrlCreateList|GUICtrlCreateListView|GUICtrlCreateListViewItem|GUICtrlCreateMenu|GUICtrlCreateMenuItem|GUICtrlCreateMonthCal|GUICtrlCreateObj|GUICtrlCreatePic|GUICtrlCreateProgress|GUICtrlCreateRadio|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTabItem|GUICtrlCreateTreeView|GUICtrlCreateTreeViewItem|GUICtrlCreateUpdown|GUICtrlDelete|GUICtrlGetHandle|GUICtrlGetState|GUICtrlRead|GUICtrlRecvMsg|GUICtrlRegisterListViewSort|GUICtrlSendMsg|GUICtrlSendToDummy|GUICtrlSetBkColor|GUICtrlSetColor|GUICtrlSetCursor|GUICtrlSetData|GUICtrlSetFont|GUICtrlSetDefColor|GUICtrlSetDefBkColor|GUICtrlSetGraphic|GUICtrlSetImage|GUICtrlSetLimit|GUICtrlSetOnEvent|GUICtrlSetPos|GUICtrlSetResizing|GUICtrlSetState|GUICtrlSetStyle|GUICtrlSetTip|GUIDelete|GUIGetCursorInfo|GUIGetMsg|GUIGetStyle|GUIRegisterMsg|GUISetAccelerators()|GUISetBkColor|GUISetCoord|GUISetCursor|GUISetFont|GUISetHelp|GUISetIcon|GUISetOnEvent|GUISetState|GUISetStyle|GUIStartGroup|GUISwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsPtr|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Opt|Ping|PixelChecksum|PixelGetColor|PixelSearch|PluginClose|PluginOpen|ProcessClose|ProcessExists|ProcessGetStats|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProgressOn|ProgressSet|Ptr|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAs|RunAsWait|RunWait|Send|SendKeepActive|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdioClose|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCPAccept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPRecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|UDPShutdown|UDPStartup|VarGetType|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive|ArrayAdd|ArrayBinarySearch|ArrayConcatenate|ArrayDelete|ArrayDisplay|ArrayFindAll|ArrayInsert|ArrayMax|ArrayMaxIndex|ArrayMin|ArrayMinIndex|ArrayPop|ArrayPush|ArrayReverse|ArraySearch|ArraySort|ArraySwap|ArrayToClip|ArrayToString|ArrayTrim|ChooseColor|ChooseFont|ClipBoard_ChangeChain|ClipBoard_Close|ClipBoard_CountFormats|ClipBoard_Empty|ClipBoard_EnumFormats|ClipBoard_FormatStr|ClipBoard_GetData|ClipBoard_GetDataEx|ClipBoard_GetFormatName|ClipBoard_GetOpenWindow|ClipBoard_GetOwner|ClipBoard_GetPriorityFormat|ClipBoard_GetSequenceNumber|ClipBoard_GetViewer|ClipBoard_IsFormatAvailable|ClipBoard_Open|ClipBoard_RegisterFormat|ClipBoard_SetData|ClipBoard_SetDataEx|ClipBoard_SetViewer|ClipPutFile|ColorConvertHSLtoRGB|ColorConvertRGBtoHSL|ColorGetBlue|ColorGetGreen|ColorGetRed|Date_Time_CompareFileTime|Date_Time_DOSDateTimeToArray|Date_Time_DOSDateTimeToFileTime|Date_Time_DOSDateTimeToStr|Date_Time_DOSDateToArray|Date_Time_DOSDateToStr|Date_Time_DOSTimeToArray|Date_Time_DOSTimeToStr|Date_Time_EncodeFileTime|Date_Time_EncodeSystemTime|Date_Time_FileTimeToArray|Date_Time_FileTimeToDOSDateTime|Date_Time_FileTimeToLocalFileTime|Date_Time_FileTimeToStr|Date_Time_FileTimeToSystemTime|Date_Time_GetFileTime|Date_Time_GetLocalTime|Date_Time_GetSystemTime|Date_Time_GetSystemTimeAdjustment|Date_Time_GetSystemTimeAsFileTime|Date_Time_GetSystemTimes|Date_Time_GetTickCount|Date_Time_GetTimeZoneInformation|Date_Time_LocalFileTimeToFileTime|Date_Time_SetFileTime|Date_Time_SetLocalTime|Date_Time_SetSystemTime|Date_Time_SetSystemTimeAdjustment|Date_Time_SetTimeZoneInformation|Date_Time_SystemTimeToArray|Date_Time_SystemTimeToDateStr|Date_Time_SystemTimeToDateTimeStr|Date_Time_SystemTimeToFileTime|Date_Time_SystemTimeToTimeStr|Date_Time_SystemTimeToTzSpecificLocalTime|Date_Time_TzSpecificLocalTimeToSystemTime|DateAdd|DateDayOfWeek|DateDaysInMonth|DateDiff|DateIsLeapYear|DateIsValid|DateTimeFormat|DateTimeSplit|DateToDayOfWeek|DateToDayOfWeekISO|DateToDayValue|DateToMonth|DayValueToDate|DebugBugReportEnv|DebugOut|DebugSetup|Degree|EventLog__Backup|EventLog__Clear|EventLog__Close|EventLog__Count|EventLog__DeregisterSource|EventLog__Full|EventLog__Notify|EventLog__Oldest|EventLog__Open|EventLog__OpenBackup|EventLog__Read|EventLog__RegisterSource|EventLog__Report|FileCountLines|FileCreate|FileListToArray|FilePrint|FileReadToArray|FileWriteFromArray|FileWriteLog|FileWriteToLine|GDIPlus_ArrowCapCreate|GDIPlus_ArrowCapDispose|GDIPlus_ArrowCapGetFillState|GDIPlus_ArrowCapGetHeight|GDIPlus_ArrowCapGetMiddleInset|GDIPlus_ArrowCapGetWidth|GDIPlus_ArrowCapSetFillState|GDIPlus_ArrowCapSetHeight|GDIPlus_ArrowCapSetMiddleInset|GDIPlus_ArrowCapSetWidth|GDIPlus_BitmapCloneArea|GDIPlus_BitmapCreateFromFile|GDIPlus_BitmapCreateFromGraphics|GDIPlus_BitmapCreateFromHBITMAP|GDIPlus_BitmapCreateHBITMAPFromBitmap|GDIPlus_BitmapDispose|GDIPlus_BitmapLockBits|GDIPlus_BitmapUnlockBits|GDIPlus_BrushClone|GDIPlus_BrushCreateSolid|GDIPlus_BrushDispose|GDIPlus_BrushGetType|GDIPlus_CustomLineCapDispose|GDIPlus_Decoders|GDIPlus_DecodersGetCount|GDIPlus_DecodersGetSize|GDIPlus_Encoders|GDIPlus_EncodersGetCLSID|GDIPlus_EncodersGetCount|GDIPlus_EncodersGetParamList|GDIPlus_EncodersGetParamListSize|GDIPlus_EncodersGetSize|GDIPlus_FontCreate|GDIPlus_FontDispose|GDIPlus_FontFamilyCreate|GDIPlus_FontFamilyDispose|GDIPlus_GraphicsClear|GDIPlus_GraphicsCreateFromHDC|GDIPlus_GraphicsCreateFromHWND|GDIPlus_GraphicsDispose|GDIPlus_GraphicsDrawArc|GDIPlus_GraphicsDrawBezier|GDIPlus_GraphicsDrawClosedCurve|GDIPlus_GraphicsDrawCurve|GDIPlus_GraphicsDrawEllipse|GDIPlus_GraphicsDrawImage|GDIPlus_GraphicsDrawImageRect|GDIPlus_GraphicsDrawImageRectRect|GDIPlus_GraphicsDrawLine|GDIPlus_GraphicsDrawPie|GDIPlus_GraphicsDrawPolygon|GDIPlus_GraphicsDrawRect|GDIPlus_GraphicsDrawString|GDIPlus_GraphicsDrawStringEx|GDIPlus_GraphicsFillClosedCurve|GDIPlus_GraphicsFillEllipse|GDIPlus_GraphicsFillPie|GDIPlus_GraphicsFillRect|GDIPlus_GraphicsGetDC|GDIPlus_GraphicsGetSmoothingMode|GDIPlus_GraphicsMeasureString|GDIPlus_GraphicsReleaseDC|GDIPlus_GraphicsSetSmoothingMode|GDIPlus_GraphicsSetTransform|GDIPlus_ImageDispose|GDIPlus_ImageGetGraphicsContext|GDIPlus_ImageGetHeight|GDIPlus_ImageGetWidth|GDIPlus_ImageLoadFromFile|GDIPlus_ImageSaveToFile|GDIPlus_ImageSaveToFileEx|GDIPlus_MatrixCreate|GDIPlus_MatrixDispose|GDIPlus_MatrixRotate|GDIPlus_ParamAdd|GDIPlus_ParamInit|GDIPlus_PenCreate|GDIPlus_PenDispose|GDIPlus_PenGetAlignment|GDIPlus_PenGetColor|GDIPlus_PenGetCustomEndCap|GDIPlus_PenGetDashCap|GDIPlus_PenGetDashStyle|GDIPlus_PenGetEndCap|GDIPlus_PenGetWidth|GDIPlus_PenSetAlignment|GDIPlus_PenSetColor|GDIPlus_PenSetCustomEndCap|GDIPlus_PenSetDashCap|GDIPlus_PenSetDashStyle|GDIPlus_PenSetEndCap|GDIPlus_PenSetWidth|GDIPlus_RectFCreate|GDIPlus_Shutdown|GDIPlus_Startup|GDIPlus_StringFormatCreate|GDIPlus_StringFormatDispose|GetIP|GUICtrlAVI_Close|GUICtrlAVI_Create|GUICtrlAVI_Destroy|GUICtrlAVI_Open|GUICtrlAVI_OpenEx|GUICtrlAVI_Play|GUICtrlAVI_Seek|GUICtrlAVI_Show|GUICtrlAVI_Stop|GUICtrlButton_Click|GUICtrlButton_Create|GUICtrlButton_Destroy|GUICtrlButton_Enable|GUICtrlButton_GetCheck|GUICtrlButton_GetFocus|GUICtrlButton_GetIdealSize|GUICtrlButton_GetImage|GUICtrlButton_GetImageList|GUICtrlButton_GetState|GUICtrlButton_GetText|GUICtrlButton_GetTextMargin|GUICtrlButton_SetCheck|GUICtrlButton_SetFocus|GUICtrlButton_SetImage|GUICtrlButton_SetImageList|GUICtrlButton_SetSize|GUICtrlButton_SetState|GUICtrlButton_SetStyle|GUICtrlButton_SetText|GUICtrlButton_SetTextMargin|GUICtrlButton_Show|GUICtrlComboBox_AddDir|GUICtrlComboBox_AddString|GUICtrlComboBox_AutoComplete|GUICtrlComboBox_BeginUpdate|GUICtrlComboBox_Create|GUICtrlComboBox_DeleteString|GUICtrlComboBox_Destroy|GUICtrlComboBox_EndUpdate|GUICtrlComboBox_FindString|GUICtrlComboBox_FindStringExact|GUICtrlComboBox_GetComboBoxInfo|GUICtrlComboBox_GetCount|GUICtrlComboBox_GetCurSel|GUICtrlComboBox_GetDroppedControlRect|GUICtrlComboBox_GetDroppedControlRectEx|GUICtrlComboBox_GetDroppedState|GUICtrlComboBox_GetDroppedWidth|GUICtrlComboBox_GetEditSel|GUICtrlComboBox_GetEditText|GUICtrlComboBox_GetExtendedUI|GUICtrlComboBox_GetHorizontalExtent|GUICtrlComboBox_GetItemHeight|GUICtrlComboBox_GetLBText|GUICtrlComboBox_GetLBTextLen|GUICtrlComboBox_GetList|GUICtrlComboBox_GetListArray|GUICtrlComboBox_GetLocale|GUICtrlComboBox_GetLocaleCountry|GUICtrlComboBox_GetLocaleLang|GUICtrlComboBox_GetLocalePrimLang|GUICtrlComboBox_GetLocaleSubLang|GUICtrlComboBox_GetMinVisible|GUICtrlComboBox_GetTopIndex|GUICtrlComboBox_InitStorage|GUICtrlComboBox_InsertString|GUICtrlComboBox_LimitText|GUICtrlComboBox_ReplaceEditSel|GUICtrlComboBox_ResetContent|GUICtrlComboBox_SelectString|GUICtrlComboBox_SetCurSel|GUICtrlComboBox_SetDroppedWidth|GUICtrlComboBox_SetEditSel|GUICtrlComboBox_SetEditText|GUICtrlComboBox_SetExtendedUI|GUICtrlComboBox_SetHorizontalExtent|GUICtrlComboBox_SetItemHeight|GUICtrlComboBox_SetMinVisible|GUICtrlComboBox_SetTopIndex|GUICtrlComboBox_ShowDropDown|GUICtrlComboBoxEx_AddDir|GUICtrlComboBoxEx_AddString|GUICtrlComboBoxEx_BeginUpdate|GUICtrlComboBoxEx_Create|GUICtrlComboBoxEx_CreateSolidBitMap|GUICtrlComboBoxEx_DeleteString|GUICtrlComboBoxEx_Destroy|GUICtrlComboBoxEx_EndUpdate|GUICtrlComboBoxEx_FindStringExact|GUICtrlComboBoxEx_GetComboBoxInfo|GUICtrlComboBoxEx_GetComboControl|GUICtrlComboBoxEx_GetCount|GUICtrlComboBoxEx_GetCurSel|GUICtrlComboBoxEx_GetDroppedControlRect|GUICtrlComboBoxEx_GetDroppedControlRectEx|GUICtrlComboBoxEx_GetDroppedState|GUICtrlComboBoxEx_GetDroppedWidth|GUICtrlComboBoxEx_GetEditControl|GUICtrlComboBoxEx_GetEditSel|GUICtrlComboBoxEx_GetEditText|GUICtrlComboBoxEx_GetExtendedStyle|GUICtrlComboBoxEx_GetExtendedUI|GUICtrlComboBoxEx_GetImageList|GUICtrlComboBoxEx_GetItem|GUICtrlComboBoxEx_GetItemEx|GUICtrlComboBoxEx_GetItemHeight|GUICtrlComboBoxEx_GetItemImage|GUICtrlComboBoxEx_GetItemIndent|GUICtrlComboBoxEx_GetItemOverlayImage|GUICtrlComboBoxEx_GetItemParam|GUICtrlComboBoxEx_GetItemSelectedImage|GUICtrlComboBoxEx_GetItemText|GUICtrlComboBoxEx_GetItemTextLen|GUICtrlComboBoxEx_GetList|GUICtrlComboBoxEx_GetListArray|GUICtrlComboBoxEx_GetLocale|GUICtrlComboBoxEx_GetLocaleCountry|GUICtrlComboBoxEx_GetLocaleLang|GUICtrlComboBoxEx_GetLocalePrimLang|GUICtrlComboBoxEx_GetLocaleSubLang|GUICtrlComboBoxEx_GetMinVisible|GUICtrlComboBoxEx_GetTopIndex|GUICtrlComboBoxEx_InitStorage|GUICtrlComboBoxEx_InsertString|GUICtrlComboBoxEx_LimitText|GUICtrlComboBoxEx_ReplaceEditSel|GUICtrlComboBoxEx_ResetContent|GUICtrlComboBoxEx_SetCurSel|GUICtrlComboBoxEx_SetDroppedWidth|GUICtrlComboBoxEx_SetEditSel|GUICtrlComboBoxEx_SetEditText|GUICtrlComboBoxEx_SetExtendedStyle|GUICtrlComboBoxEx_SetExtendedUI|GUICtrlComboBoxEx_SetImageList|GUICtrlComboBoxEx_SetItem|GUICtrlComboBoxEx_SetItemEx|GUICtrlComboBoxEx_SetItemHeight|GUICtrlComboBoxEx_SetItemImage|GUICtrlComboBoxEx_SetItemIndent|GUICtrlComboBoxEx_SetItemOverlayImage|GUICtrlComboBoxEx_SetItemParam|GUICtrlComboBoxEx_SetItemSelectedImage|GUICtrlComboBoxEx_SetMinVisible|GUICtrlComboBoxEx_SetTopIndex|GUICtrlComboBoxEx_ShowDropDown|GUICtrlDTP_Create|GUICtrlDTP_Destroy|GUICtrlDTP_GetMCColor|GUICtrlDTP_GetMCFont|GUICtrlDTP_GetMonthCal|GUICtrlDTP_GetRange|GUICtrlDTP_GetRangeEx|GUICtrlDTP_GetSystemTime|GUICtrlDTP_GetSystemTimeEx|GUICtrlDTP_SetFormat|GUICtrlDTP_SetMCColor|GUICtrlDTP_SetMCFont|GUICtrlDTP_SetRange|GUICtrlDTP_SetRangeEx|GUICtrlDTP_SetSystemTime|GUICtrlDTP_SetSystemTimeEx|GUICtrlEdit_AppendText|GUICtrlEdit_BeginUpdate|GUICtrlEdit_CanUndo|GUICtrlEdit_CharFromPos|GUICtrlEdit_Create|GUICtrlEdit_Destroy|GUICtrlEdit_EmptyUndoBuffer|GUICtrlEdit_EndUpdate|GUICtrlEdit_Find|GUICtrlEdit_FmtLines|GUICtrlEdit_GetFirstVisibleLine|GUICtrlEdit_GetLimitText|GUICtrlEdit_GetLine|GUICtrlEdit_GetLineCount|GUICtrlEdit_GetMargins|GUICtrlEdit_GetModify|GUICtrlEdit_GetPasswordChar|GUICtrlEdit_GetRECT|GUICtrlEdit_GetRECTEx|GUICtrlEdit_GetSel|GUICtrlEdit_GetText|GUICtrlEdit_GetTextLen|GUICtrlEdit_HideBalloonTip|GUICtrlEdit_InsertText|GUICtrlEdit_LineFromChar|GUICtrlEdit_LineIndex|GUICtrlEdit_LineLength|GUICtrlEdit_LineScroll|GUICtrlEdit_PosFromChar|GUICtrlEdit_ReplaceSel|GUICtrlEdit_Scroll|GUICtrlEdit_SetLimitText|GUICtrlEdit_SetMargins|GUICtrlEdit_SetModify|GUICtrlEdit_SetPasswordChar|GUICtrlEdit_SetReadOnly|GUICtrlEdit_SetRECT|GUICtrlEdit_SetRECTEx|GUICtrlEdit_SetRECTNP|GUICtrlEdit_SetRectNPEx|GUICtrlEdit_SetSel|GUICtrlEdit_SetTabStops|GUICtrlEdit_SetText|GUICtrlEdit_ShowBalloonTip|GUICtrlEdit_Undo|GUICtrlHeader_AddItem|GUICtrlHeader_ClearFilter|GUICtrlHeader_ClearFilterAll|GUICtrlHeader_Create|GUICtrlHeader_CreateDragImage|GUICtrlHeader_DeleteItem|GUICtrlHeader_Destroy|GUICtrlHeader_EditFilter|GUICtrlHeader_GetBitmapMargin|GUICtrlHeader_GetImageList|GUICtrlHeader_GetItem|GUICtrlHeader_GetItemAlign|GUICtrlHeader_GetItemBitmap|GUICtrlHeader_GetItemCount|GUICtrlHeader_GetItemDisplay|GUICtrlHeader_GetItemFlags|GUICtrlHeader_GetItemFormat|GUICtrlHeader_GetItemImage|GUICtrlHeader_GetItemOrder|GUICtrlHeader_GetItemParam|GUICtrlHeader_GetItemRect|GUICtrlHeader_GetItemRectEx|GUICtrlHeader_GetItemText|GUICtrlHeader_GetItemWidth|GUICtrlHeader_GetOrderArray|GUICtrlHeader_GetUnicodeFormat|GUICtrlHeader_HitTest|GUICtrlHeader_InsertItem|GUICtrlHeader_Layout|GUICtrlHeader_OrderToIndex|GUICtrlHeader_SetBitmapMargin|GUICtrlHeader_SetFilterChangeTimeout|GUICtrlHeader_SetHotDivider|GUICtrlHeader_SetImageList|GUICtrlHeader_SetItem|GUICtrlHeader_SetItemAlign|GUICtrlHeader_SetItemBitmap|GUICtrlHeader_SetItemDisplay|GUICtrlHeader_SetItemFlags|GUICtrlHeader_SetItemFormat|GUICtrlHeader_SetItemImage|GUICtrlHeader_SetItemOrder|GUICtrlHeader_SetItemParam|GUICtrlHeader_SetItemText|GUICtrlHeader_SetItemWidth|GUICtrlHeader_SetOrderArray|GUICtrlHeader_SetUnicodeFormat|GUICtrlIpAddress_ClearAddress|GUICtrlIpAddress_Create|GUICtrlIpAddress_Destroy|GUICtrlIpAddress_Get|GUICtrlIpAddress_GetArray|GUICtrlIpAddress_GetEx|GUICtrlIpAddress_IsBlank|GUICtrlIpAddress_Set|GUICtrlIpAddress_SetArray|GUICtrlIpAddress_SetEx|GUICtrlIpAddress_SetFocus|GUICtrlIpAddress_SetFont|GUICtrlIpAddress_SetRange|GUICtrlIpAddress_ShowHide|GUICtrlListBox_AddFile|GUICtrlListBox_AddString|GUICtrlListBox_BeginUpdate|GUICtrlListBox_Create|GUICtrlListBox_DeleteString|GUICtrlListBox_Destroy|GUICtrlListBox_Dir|GUICtrlListBox_EndUpdate|GUICtrlListBox_FindInText|GUICtrlListBox_FindString|GUICtrlListBox_GetAnchorIndex|GUICtrlListBox_GetCaretIndex|GUICtrlListBox_GetCount|GUICtrlListBox_GetCurSel|GUICtrlListBox_GetHorizontalExtent|GUICtrlListBox_GetItemData|GUICtrlListBox_GetItemHeight|GUICtrlListBox_GetItemRect|GUICtrlListBox_GetItemRectEx|GUICtrlListBox_GetListBoxInfo|GUICtrlListBox_GetLocale|GUICtrlListBox_GetLocaleCountry|GUICtrlListBox_GetLocaleLang|GUICtrlListBox_GetLocalePrimLang|GUICtrlListBox_GetLocaleSubLang|GUICtrlListBox_GetSel|GUICtrlListBox_GetSelCount|GUICtrlListBox_GetSelItems|GUICtrlListBox_GetSelItemsText|GUICtrlListBox_GetText|GUICtrlListBox_GetTextLen|GUICtrlListBox_GetTopIndex|GUICtrlListBox_InitStorage|GUICtrlListBox_InsertString|GUICtrlListBox_ItemFromPoint|GUICtrlListBox_ReplaceString|GUICtrlListBox_ResetContent|GUICtrlListBox_SelectString|GUICtrlListBox_SelItemRange|GUICtrlListBox_SelItemRangeEx|GUICtrlListBox_SetAnchorIndex|GUICtrlListBox_SetCaretIndex|GUICtrlListBox_SetColumnWidth|GUICtrlListBox_SetCurSel|GUICtrlListBox_SetHorizontalExtent|GUICtrlListBox_SetItemData|GUICtrlListBox_SetItemHeight|GUICtrlListBox_SetLocale|GUICtrlListBox_SetSel|GUICtrlListBox_SetTabStops|GUICtrlListBox_SetTopIndex|GUICtrlListBox_Sort|GUICtrlListBox_SwapString|GUICtrlListBox_UpdateHScroll|GUICtrlListView_AddArray|GUICtrlListView_AddColumn|GUICtrlListView_AddItem|GUICtrlListView_AddSubItem|GUICtrlListView_ApproximateViewHeight|GUICtrlListView_ApproximateViewRect|GUICtrlListView_ApproximateViewWidth|GUICtrlListView_Arrange|GUICtrlListView_BeginUpdate|GUICtrlListView_CancelEditLabel|GUICtrlListView_ClickItem|GUICtrlListView_CopyItems|GUICtrlListView_Create|GUICtrlListView_CreateDragImage|GUICtrlListView_CreateSolidBitMap|GUICtrlListView_DeleteAllItems|GUICtrlListView_DeleteColumn|GUICtrlListView_DeleteItem|GUICtrlListView_DeleteItemsSelected|GUICtrlListView_Destroy|GUICtrlListView_DrawDragImage|GUICtrlListView_EditLabel|GUICtrlListView_EnableGroupView|GUICtrlListView_EndUpdate|GUICtrlListView_EnsureVisible|GUICtrlListView_FindInText|GUICtrlListView_FindItem|GUICtrlListView_FindNearest|GUICtrlListView_FindParam|GUICtrlListView_FindText|GUICtrlListView_GetBkColor|GUICtrlListView_GetBkImage|GUICtrlListView_GetCallbackMask|GUICtrlListView_GetColumn|GUICtrlListView_GetColumnCount|GUICtrlListView_GetColumnOrder|GUICtrlListView_GetColumnOrderArray|GUICtrlListView_GetColumnWidth|GUICtrlListView_GetCounterPage|GUICtrlListView_GetEditControl|GUICtrlListView_GetExtendedListViewStyle|GUICtrlListView_GetGroupInfo|GUICtrlListView_GetGroupViewEnabled|GUICtrlListView_GetHeader|GUICtrlListView_GetHotCursor|GUICtrlListView_GetHotItem|GUICtrlListView_GetHoverTime|GUICtrlListView_GetImageList|GUICtrlListView_GetISearchString|GUICtrlListView_GetItem|GUICtrlListView_GetItemChecked|GUICtrlListView_GetItemCount|GUICtrlListView_GetItemCut|GUICtrlListView_GetItemDropHilited|GUICtrlListView_GetItemEx|GUICtrlListView_GetItemFocused|GUICtrlListView_GetItemGroupID|GUICtrlListView_GetItemImage|GUICtrlListView_GetItemIndent|GUICtrlListView_GetItemParam|GUICtrlListView_GetItemPosition|GUICtrlListView_GetItemPositionX|GUICtrlListView_GetItemPositionY|GUICtrlListView_GetItemRect|GUICtrlListView_GetItemRectEx|GUICtrlListView_GetItemSelected|GUICtrlListView_GetItemSpacing|GUICtrlListView_GetItemSpacingX|GUICtrlListView_GetItemSpacingY|GUICtrlListView_GetItemState|GUICtrlListView_GetItemStateImage|GUICtrlListView_GetItemText|GUICtrlListView_GetItemTextArray|GUICtrlListView_GetItemTextString|GUICtrlListView_GetNextItem|GUICtrlListView_GetNumberOfWorkAreas|GUICtrlListView_GetOrigin|GUICtrlListView_GetOriginX|GUICtrlListView_GetOriginY|GUICtrlListView_GetOutlineColor|GUICtrlListView_GetSelectedColumn|GUICtrlListView_GetSelectedCount|GUICtrlListView_GetSelectedIndices|GUICtrlListView_GetSelectionMark|GUICtrlListView_GetStringWidth|GUICtrlListView_GetSubItemRect|GUICtrlListView_GetTextBkColor|GUICtrlListView_GetTextColor|GUICtrlListView_GetToolTips|GUICtrlListView_GetTopIndex|GUICtrlListView_GetUnicodeFormat|GUICtrlListView_GetView|GUICtrlListView_GetViewDetails|GUICtrlListView_GetViewLarge|GUICtrlListView_GetViewList|GUICtrlListView_GetViewRect|GUICtrlListView_GetViewSmall|GUICtrlListView_GetViewTile|GUICtrlListView_HideColumn|GUICtrlListView_HitTest|GUICtrlListView_InsertColumn|GUICtrlListView_InsertGroup|GUICtrlListView_InsertItem|GUICtrlListView_JustifyColumn|GUICtrlListView_MapIDToIndex|GUICtrlListView_MapIndexToID|GUICtrlListView_RedrawItems|GUICtrlListView_RegisterSortCallBack|GUICtrlListView_RemoveAllGroups|GUICtrlListView_RemoveGroup|GUICtrlListView_Scroll|GUICtrlListView_SetBkColor|GUICtrlListView_SetBkImage|GUICtrlListView_SetCallBackMask|GUICtrlListView_SetColumn|GUICtrlListView_SetColumnOrder|GUICtrlListView_SetColumnOrderArray|GUICtrlListView_SetColumnWidth|GUICtrlListView_SetExtendedListViewStyle|GUICtrlListView_SetGroupInfo|GUICtrlListView_SetHotItem|GUICtrlListView_SetHoverTime|GUICtrlListView_SetIconSpacing|GUICtrlListView_SetImageList|GUICtrlListView_SetItem|GUICtrlListView_SetItemChecked|GUICtrlListView_SetItemCount|GUICtrlListView_SetItemCut|GUICtrlListView_SetItemDropHilited|GUICtrlListView_SetItemEx|GUICtrlListView_SetItemFocused|GUICtrlListView_SetItemGroupID|GUICtrlListView_SetItemImage|GUICtrlListView_SetItemIndent|GUICtrlListView_SetItemParam|GUICtrlListView_SetItemPosition|GUICtrlListView_SetItemPosition32|GUICtrlListView_SetItemSelected|GUICtrlListView_SetItemState|GUICtrlListView_SetItemStateImage|GUICtrlListView_SetItemText|GUICtrlListView_SetOutlineColor|GUICtrlListView_SetSelectedColumn|GUICtrlListView_SetSelectionMark|GUICtrlListView_SetTextBkColor|GUICtrlListView_SetTextColor|GUICtrlListView_SetToolTips|GUICtrlListView_SetUnicodeFormat|GUICtrlListView_SetView|GUICtrlListView_SetWorkAreas|GUICtrlListView_SimpleSort|GUICtrlListView_SortItems|GUICtrlListView_SubItemHitTest|GUICtrlListView_UnRegisterSortCallBack|GUICtrlMenu_AddMenuItem|GUICtrlMenu_AppendMenu|GUICtrlMenu_CheckMenuItem|GUICtrlMenu_CheckRadioItem|GUICtrlMenu_CreateMenu|GUICtrlMenu_CreatePopup|GUICtrlMenu_DeleteMenu|GUICtrlMenu_DestroyMenu|GUICtrlMenu_DrawMenuBar|GUICtrlMenu_EnableMenuItem|GUICtrlMenu_FindItem|GUICtrlMenu_FindParent|GUICtrlMenu_GetItemBmp|GUICtrlMenu_GetItemBmpChecked|GUICtrlMenu_GetItemBmpUnchecked|GUICtrlMenu_GetItemChecked|GUICtrlMenu_GetItemCount|GUICtrlMenu_GetItemData|GUICtrlMenu_GetItemDefault|GUICtrlMenu_GetItemDisabled|GUICtrlMenu_GetItemEnabled|GUICtrlMenu_GetItemGrayed|GUICtrlMenu_GetItemHighlighted|GUICtrlMenu_GetItemID|GUICtrlMenu_GetItemInfo|GUICtrlMenu_GetItemRect|GUICtrlMenu_GetItemRectEx|GUICtrlMenu_GetItemState|GUICtrlMenu_GetItemStateEx|GUICtrlMenu_GetItemSubMenu|GUICtrlMenu_GetItemText|GUICtrlMenu_GetItemType|GUICtrlMenu_GetMenu|GUICtrlMenu_GetMenuBackground|GUICtrlMenu_GetMenuBarInfo|GUICtrlMenu_GetMenuContextHelpID|GUICtrlMenu_GetMenuData|GUICtrlMenu_GetMenuDefaultItem|GUICtrlMenu_GetMenuHeight|GUICtrlMenu_GetMenuInfo|GUICtrlMenu_GetMenuStyle|GUICtrlMenu_GetSystemMenu|GUICtrlMenu_InsertMenuItem|GUICtrlMenu_InsertMenuItemEx|GUICtrlMenu_IsMenu|GUICtrlMenu_LoadMenu|GUICtrlMenu_MapAccelerator|GUICtrlMenu_MenuItemFromPoint|GUICtrlMenu_RemoveMenu|GUICtrlMenu_SetItemBitmaps|GUICtrlMenu_SetItemBmp|GUICtrlMenu_SetItemBmpChecked|GUICtrlMenu_SetItemBmpUnchecked|GUICtrlMenu_SetItemChecked|GUICtrlMenu_SetItemData|GUICtrlMenu_SetItemDefault|GUICtrlMenu_SetItemDisabled|GUICtrlMenu_SetItemEnabled|GUICtrlMenu_SetItemGrayed|GUICtrlMenu_SetItemHighlighted|GUICtrlMenu_SetItemID|GUICtrlMenu_SetItemInfo|GUICtrlMenu_SetItemState|GUICtrlMenu_SetItemSubMenu|GUICtrlMenu_SetItemText|GUICtrlMenu_SetItemType|GUICtrlMenu_SetMenu|GUICtrlMenu_SetMenuBackground|GUICtrlMenu_SetMenuContextHelpID|GUICtrlMenu_SetMenuData|GUICtrlMenu_SetMenuDefaultItem|GUICtrlMenu_SetMenuHeight|GUICtrlMenu_SetMenuInfo|GUICtrlMenu_SetMenuStyle|GUICtrlMenu_TrackPopupMenu|GUICtrlMonthCal_Create|GUICtrlMonthCal_Destroy|GUICtrlMonthCal_GetColor|GUICtrlMonthCal_GetColorArray|GUICtrlMonthCal_GetCurSel|GUICtrlMonthCal_GetCurSelStr|GUICtrlMonthCal_GetFirstDOW|GUICtrlMonthCal_GetFirstDOWStr|GUICtrlMonthCal_GetMaxSelCount|GUICtrlMonthCal_GetMaxTodayWidth|GUICtrlMonthCal_GetMinReqHeight|GUICtrlMonthCal_GetMinReqRect|GUICtrlMonthCal_GetMinReqRectArray|GUICtrlMonthCal_GetMinReqWidth|GUICtrlMonthCal_GetMonthDelta|GUICtrlMonthCal_GetMonthRange|GUICtrlMonthCal_GetMonthRangeMax|GUICtrlMonthCal_GetMonthRangeMaxStr|GUICtrlMonthCal_GetMonthRangeMin|GUICtrlMonthCal_GetMonthRangeMinStr|GUICtrlMonthCal_GetMonthRangeSpan|GUICtrlMonthCal_GetRange|GUICtrlMonthCal_GetRangeMax|GUICtrlMonthCal_GetRangeMaxStr|GUICtrlMonthCal_GetRangeMin|GUICtrlMonthCal_GetRangeMinStr|GUICtrlMonthCal_GetSelRange|GUICtrlMonthCal_GetSelRangeMax|GUICtrlMonthCal_GetSelRangeMaxStr|GUICtrlMonthCal_GetSelRangeMin|GUICtrlMonthCal_GetSelRangeMinStr|GUICtrlMonthCal_GetToday|GUICtrlMonthCal_GetTodayStr|GUICtrlMonthCal_GetUnicodeFormat|GUICtrlMonthCal_HitTest|GUICtrlMonthCal_SetColor|GUICtrlMonthCal_SetCurSel|GUICtrlMonthCal_SetDayState|GUICtrlMonthCal_SetFirstDOW|GUICtrlMonthCal_SetMaxSelCount|GUICtrlMonthCal_SetMonthDelta|GUICtrlMonthCal_SetRange|GUICtrlMonthCal_SetSelRange|GUICtrlMonthCal_SetToday|GUICtrlMonthCal_SetUnicodeFormat|GUICtrlRebar_AddBand|GUICtrlRebar_AddToolBarBand|GUICtrlRebar_BeginDrag|GUICtrlRebar_Create|GUICtrlRebar_DeleteBand|GUICtrlRebar_Destroy|GUICtrlRebar_DragMove|GUICtrlRebar_EndDrag|GUICtrlRebar_GetBandBackColor|GUICtrlRebar_GetBandBorders|GUICtrlRebar_GetBandBordersEx|GUICtrlRebar_GetBandChildHandle|GUICtrlRebar_GetBandChildSize|GUICtrlRebar_GetBandCount|GUICtrlRebar_GetBandForeColor|GUICtrlRebar_GetBandHeaderSize|GUICtrlRebar_GetBandID|GUICtrlRebar_GetBandIdealSize|GUICtrlRebar_GetBandLength|GUICtrlRebar_GetBandLParam|GUICtrlRebar_GetBandMargins|GUICtrlRebar_GetBandMarginsEx|GUICtrlRebar_GetBandRect|GUICtrlRebar_GetBandRectEx|GUICtrlRebar_GetBandStyle|GUICtrlRebar_GetBandStyleBreak|GUICtrlRebar_GetBandStyleChildEdge|GUICtrlRebar_GetBandStyleFixedBMP|GUICtrlRebar_GetBandStyleFixedSize|GUICtrlRebar_GetBandStyleGripperAlways|GUICtrlRebar_GetBandStyleHidden|GUICtrlRebar_GetBandStyleHideTitle|GUICtrlRebar_GetBandStyleNoGripper|GUICtrlRebar_GetBandStyleTopAlign|GUICtrlRebar_GetBandStyleUseChevron|GUICtrlRebar_GetBandStyleVariableHeight|GUICtrlRebar_GetBandText|GUICtrlRebar_GetBarHeight|GUICtrlRebar_GetBKColor|GUICtrlRebar_GetColorScheme|GUICtrlRebar_GetRowCount|GUICtrlRebar_GetRowHeight|GUICtrlRebar_GetTextColor|GUICtrlRebar_GetToolTips|GUICtrlRebar_GetUnicodeFormat|GUICtrlRebar_HitTest|GUICtrlRebar_IDToIndex|GUICtrlRebar_MaximizeBand|GUICtrlRebar_MinimizeBand|GUICtrlRebar_MoveBand|GUICtrlRebar_SetBandBackColor|GUICtrlRebar_SetBandForeColor|GUICtrlRebar_SetBandHeaderSize|GUICtrlRebar_SetBandID|GUICtrlRebar_SetBandIdealSize|GUICtrlRebar_SetBandLength|GUICtrlRebar_SetBandLParam|GUICtrlRebar_SetBandStyle|GUICtrlRebar_SetBandStyleBreak|GUICtrlRebar_SetBandStyleChildEdge|GUICtrlRebar_SetBandStyleFixedBMP|GUICtrlRebar_SetBandStyleFixedSize|GUICtrlRebar_SetBandStyleGripperAlways|GUICtrlRebar_SetBandStyleHidden|GUICtrlRebar_SetBandStyleHideTitle|GUICtrlRebar_SetBandStyleNoGripper|GUICtrlRebar_SetBandStyleTopAlign|GUICtrlRebar_SetBandStyleUseChevron|GUICtrlRebar_SetBandStyleVariableHeight|GUICtrlRebar_SetBandText|GUICtrlRebar_SetBKColor|GUICtrlRebar_SetColorScheme|GUICtrlRebar_SetTextColor|GUICtrlRebar_SetToolTips|GUICtrlRebar_SetUnicodeFormat|GUICtrlRebar_ShowBand|GUICtrlSlider_ClearSel|GUICtrlSlider_ClearTics|GUICtrlSlider_Create|GUICtrlSlider_Destroy|GUICtrlSlider_GetBuddy|GUICtrlSlider_GetChannelRect|GUICtrlSlider_GetLineSize|GUICtrlSlider_GetNumTics|GUICtrlSlider_GetPageSize|GUICtrlSlider_GetPos|GUICtrlSlider_GetPTics|GUICtrlSlider_GetRange|GUICtrlSlider_GetRangeMax|GUICtrlSlider_GetRangeMin|GUICtrlSlider_GetSel|GUICtrlSlider_GetSelEnd|GUICtrlSlider_GetSelStart|GUICtrlSlider_GetThumbLength|GUICtrlSlider_GetThumbRect|GUICtrlSlider_GetThumbRectEx|GUICtrlSlider_GetTic|GUICtrlSlider_GetTicPos|GUICtrlSlider_GetToolTips|GUICtrlSlider_GetUnicodeFormat|GUICtrlSlider_SetBuddy|GUICtrlSlider_SetLineSize|GUICtrlSlider_SetPageSize|GUICtrlSlider_SetPos|GUICtrlSlider_SetRange|GUICtrlSlider_SetRangeMax|GUICtrlSlider_SetRangeMin|GUICtrlSlider_SetSel|GUICtrlSlider_SetSelEnd|GUICtrlSlider_SetSelStart|GUICtrlSlider_SetThumbLength|GUICtrlSlider_SetTic|GUICtrlSlider_SetTicFreq|GUICtrlSlider_SetTipSide|GUICtrlSlider_SetToolTips|GUICtrlSlider_SetUnicodeFormat|GUICtrlStatusBar_Create|GUICtrlStatusBar_Destroy|GUICtrlStatusBar_EmbedControl|GUICtrlStatusBar_GetBorders|GUICtrlStatusBar_GetBordersHorz|GUICtrlStatusBar_GetBordersRect|GUICtrlStatusBar_GetBordersVert|GUICtrlStatusBar_GetCount|GUICtrlStatusBar_GetHeight|GUICtrlStatusBar_GetIcon|GUICtrlStatusBar_GetParts|GUICtrlStatusBar_GetRect|GUICtrlStatusBar_GetRectEx|GUICtrlStatusBar_GetText|GUICtrlStatusBar_GetTextFlags|GUICtrlStatusBar_GetTextLength|GUICtrlStatusBar_GetTextLengthEx|GUICtrlStatusBar_GetTipText|GUICtrlStatusBar_GetUnicodeFormat|GUICtrlStatusBar_GetWidth|GUICtrlStatusBar_IsSimple|GUICtrlStatusBar_Resize|GUICtrlStatusBar_SetBkColor|GUICtrlStatusBar_SetIcon|GUICtrlStatusBar_SetMinHeight|GUICtrlStatusBar_SetParts|GUICtrlStatusBar_SetSimple|GUICtrlStatusBar_SetText|GUICtrlStatusBar_SetTipText|GUICtrlStatusBar_SetUnicodeFormat|GUICtrlStatusBar_ShowHide|GUICtrlTab_Create|GUICtrlTab_DeleteAllItems|GUICtrlTab_DeleteItem|GUICtrlTab_DeselectAll|GUICtrlTab_Destroy|GUICtrlTab_FindTab|GUICtrlTab_GetCurFocus|GUICtrlTab_GetCurSel|GUICtrlTab_GetDisplayRect|GUICtrlTab_GetDisplayRectEx|GUICtrlTab_GetExtendedStyle|GUICtrlTab_GetImageList|GUICtrlTab_GetItem|GUICtrlTab_GetItemCount|GUICtrlTab_GetItemImage|GUICtrlTab_GetItemParam|GUICtrlTab_GetItemRect|GUICtrlTab_GetItemRectEx|GUICtrlTab_GetItemState|GUICtrlTab_GetItemText|GUICtrlTab_GetRowCount|GUICtrlTab_GetToolTips|GUICtrlTab_GetUnicodeFormat|GUICtrlTab_HighlightItem|GUICtrlTab_HitTest|GUICtrlTab_InsertItem|GUICtrlTab_RemoveImage|GUICtrlTab_SetCurFocus|GUICtrlTab_SetCurSel|GUICtrlTab_SetExtendedStyle|GUICtrlTab_SetImageList|GUICtrlTab_SetItem|GUICtrlTab_SetItemImage|GUICtrlTab_SetItemParam|GUICtrlTab_SetItemSize|GUICtrlTab_SetItemState|GUICtrlTab_SetItemText|GUICtrlTab_SetMinTabWidth|GUICtrlTab_SetPadding|GUICtrlTab_SetToolTips|GUICtrlTab_SetUnicodeFormat|GUICtrlToolbar_AddBitmap|GUICtrlToolbar_AddButton|GUICtrlToolbar_AddButtonSep|GUICtrlToolbar_AddString|GUICtrlToolbar_ButtonCount|GUICtrlToolbar_CheckButton|GUICtrlToolbar_ClickAccel|GUICtrlToolbar_ClickButton|GUICtrlToolbar_ClickIndex|GUICtrlToolbar_CommandToIndex|GUICtrlToolbar_Create|GUICtrlToolbar_Customize|GUICtrlToolbar_DeleteButton|GUICtrlToolbar_Destroy|GUICtrlToolbar_EnableButton|GUICtrlToolbar_FindToolbar|GUICtrlToolbar_GetAnchorHighlight|GUICtrlToolbar_GetBitmapFlags|GUICtrlToolbar_GetButtonBitmap|GUICtrlToolbar_GetButtonInfo|GUICtrlToolbar_GetButtonInfoEx|GUICtrlToolbar_GetButtonParam|GUICtrlToolbar_GetButtonRect|GUICtrlToolbar_GetButtonRectEx|GUICtrlToolbar_GetButtonSize|GUICtrlToolbar_GetButtonState|GUICtrlToolbar_GetButtonStyle|GUICtrlToolbar_GetButtonText|GUICtrlToolbar_GetColorScheme|GUICtrlToolbar_GetDisabledImageList|GUICtrlToolbar_GetExtendedStyle|GUICtrlToolbar_GetHotImageList|GUICtrlToolbar_GetHotItem|GUICtrlToolbar_GetImageList|GUICtrlToolbar_GetInsertMark|GUICtrlToolbar_GetInsertMarkColor|GUICtrlToolbar_GetMaxSize|GUICtrlToolbar_GetMetrics|GUICtrlToolbar_GetPadding|GUICtrlToolbar_GetRows|GUICtrlToolbar_GetString|GUICtrlToolbar_GetStyle|GUICtrlToolbar_GetStyleAltDrag|GUICtrlToolbar_GetStyleCustomErase|GUICtrlToolbar_GetStyleFlat|GUICtrlToolbar_GetStyleList|GUICtrlToolbar_GetStyleRegisterDrop|GUICtrlToolbar_GetStyleToolTips|GUICtrlToolbar_GetStyleTransparent|GUICtrlToolbar_GetStyleWrapable|GUICtrlToolbar_GetTextRows|GUICtrlToolbar_GetToolTips|GUICtrlToolbar_GetUnicodeFormat|GUICtrlToolbar_HideButton|GUICtrlToolbar_HighlightButton|GUICtrlToolbar_HitTest|GUICtrlToolbar_IndexToCommand|GUICtrlToolbar_InsertButton|GUICtrlToolbar_InsertMarkHitTest|GUICtrlToolbar_IsButtonChecked|GUICtrlToolbar_IsButtonEnabled|GUICtrlToolbar_IsButtonHidden|GUICtrlToolbar_IsButtonHighlighted|GUICtrlToolbar_IsButtonIndeterminate|GUICtrlToolbar_IsButtonPressed|GUICtrlToolbar_LoadBitmap|GUICtrlToolbar_LoadImages|GUICtrlToolbar_MapAccelerator|GUICtrlToolbar_MoveButton|GUICtrlToolbar_PressButton|GUICtrlToolbar_SetAnchorHighlight|GUICtrlToolbar_SetBitmapSize|GUICtrlToolbar_SetButtonBitMap|GUICtrlToolbar_SetButtonInfo|GUICtrlToolbar_SetButtonInfoEx|GUICtrlToolbar_SetButtonParam|GUICtrlToolbar_SetButtonSize|GUICtrlToolbar_SetButtonState|GUICtrlToolbar_SetButtonStyle|GUICtrlToolbar_SetButtonText|GUICtrlToolbar_SetButtonWidth|GUICtrlToolbar_SetCmdID|GUICtrlToolbar_SetColorScheme|GUICtrlToolbar_SetDisabledImageList|GUICtrlToolbar_SetDrawTextFlags|GUICtrlToolbar_SetExtendedStyle|GUICtrlToolbar_SetHotImageList|GUICtrlToolbar_SetHotItem|GUICtrlToolbar_SetImageList|GUICtrlToolbar_SetIndent|GUICtrlToolbar_SetIndeterminate|GUICtrlToolbar_SetInsertMark|GUICtrlToolbar_SetInsertMarkColor|GUICtrlToolbar_SetMaxTextRows|GUICtrlToolbar_SetMetrics|GUICtrlToolbar_SetPadding|GUICtrlToolbar_SetParent|GUICtrlToolbar_SetRows|GUICtrlToolbar_SetStyle|GUICtrlToolbar_SetStyleAltDrag|GUICtrlToolbar_SetStyleCustomErase|GUICtrlToolbar_SetStyleFlat|GUICtrlToolbar_SetStyleList|GUICtrlToolbar_SetStyleRegisterDrop|GUICtrlToolbar_SetStyleToolTips|GUICtrlToolbar_SetStyleTransparent|GUICtrlToolbar_SetStyleWrapable|GUICtrlToolbar_SetToolTips|GUICtrlToolbar_SetUnicodeFormat|GUICtrlToolbar_SetWindowTheme|GUICtrlTreeView_Add|GUICtrlTreeView_AddChild|GUICtrlTreeView_AddChildFirst|GUICtrlTreeView_AddFirst|GUICtrlTreeView_BeginUpdate|GUICtrlTreeView_ClickItem|GUICtrlTreeView_Create|GUICtrlTreeView_CreateDragImage|GUICtrlTreeView_CreateSolidBitMap|GUICtrlTreeView_Delete|GUICtrlTreeView_DeleteAll|GUICtrlTreeView_DeleteChildren|GUICtrlTreeView_Destroy|GUICtrlTreeView_DisplayRect|GUICtrlTreeView_DisplayRectEx|GUICtrlTreeView_EditText|GUICtrlTreeView_EndEdit|GUICtrlTreeView_EndUpdate|GUICtrlTreeView_EnsureVisible|GUICtrlTreeView_Expand|GUICtrlTreeView_ExpandedOnce|GUICtrlTreeView_FindItem|GUICtrlTreeView_FindItemEx|GUICtrlTreeView_GetBkColor|GUICtrlTreeView_GetBold|GUICtrlTreeView_GetChecked|GUICtrlTreeView_GetChildCount|GUICtrlTreeView_GetChildren|GUICtrlTreeView_GetCount|GUICtrlTreeView_GetCut|GUICtrlTreeView_GetDropTarget|GUICtrlTreeView_GetEditControl|GUICtrlTreeView_GetExpanded|GUICtrlTreeView_GetFirstChild|GUICtrlTreeView_GetFirstItem|GUICtrlTreeView_GetFirstVisible|GUICtrlTreeView_GetFocused|GUICtrlTreeView_GetHeight|GUICtrlTreeView_GetImageIndex|GUICtrlTreeView_GetImageListIconHandle|GUICtrlTreeView_GetIndent|GUICtrlTreeView_GetInsertMarkColor|GUICtrlTreeView_GetISearchString|GUICtrlTreeView_GetItemByIndex|GUICtrlTreeView_GetItemHandle|GUICtrlTreeView_GetItemParam|GUICtrlTreeView_GetLastChild|GUICtrlTreeView_GetLineColor|GUICtrlTreeView_GetNext|GUICtrlTreeView_GetNextChild|GUICtrlTreeView_GetNextSibling|GUICtrlTreeView_GetNextVisible|GUICtrlTreeView_GetNormalImageList|GUICtrlTreeView_GetParentHandle|GUICtrlTreeView_GetParentParam|GUICtrlTreeView_GetPrev|GUICtrlTreeView_GetPrevChild|GUICtrlTreeView_GetPrevSibling|GUICtrlTreeView_GetPrevVisible|GUICtrlTreeView_GetScrollTime|GUICtrlTreeView_GetSelected|GUICtrlTreeView_GetSelectedImageIndex|GUICtrlTreeView_GetSelection|GUICtrlTreeView_GetSiblingCount|GUICtrlTreeView_GetState|GUICtrlTreeView_GetStateImageIndex|GUICtrlTreeView_GetStateImageList|GUICtrlTreeView_GetText|GUICtrlTreeView_GetTextColor|GUICtrlTreeView_GetToolTips|GUICtrlTreeView_GetTree|GUICtrlTreeView_GetUnicodeFormat|GUICtrlTreeView_GetVisible|GUICtrlTreeView_GetVisibleCount|GUICtrlTreeView_HitTest|GUICtrlTreeView_HitTestEx|GUICtrlTreeView_HitTestItem|GUICtrlTreeView_Index|GUICtrlTreeView_InsertItem|GUICtrlTreeView_IsFirstItem|GUICtrlTreeView_IsParent|GUICtrlTreeView_Level|GUICtrlTreeView_SelectItem|GUICtrlTreeView_SelectItemByIndex|GUICtrlTreeView_SetBkColor|GUICtrlTreeView_SetBold|GUICtrlTreeView_SetChecked|GUICtrlTreeView_SetCheckedByIndex|GUICtrlTreeView_SetChildren|GUICtrlTreeView_SetCut|GUICtrlTreeView_SetDropTarget|GUICtrlTreeView_SetFocused|GUICtrlTreeView_SetHeight|GUICtrlTreeView_SetIcon|GUICtrlTreeView_SetImageIndex|GUICtrlTreeView_SetIndent|GUICtrlTreeView_SetInsertMark|GUICtrlTreeView_SetInsertMarkColor|GUICtrlTreeView_SetItemHeight|GUICtrlTreeView_SetItemParam|GUICtrlTreeView_SetLineColor|GUICtrlTreeView_SetNormalImageList|GUICtrlTreeView_SetScrollTime|GUICtrlTreeView_SetSelected|GUICtrlTreeView_SetSelectedImageIndex|GUICtrlTreeView_SetState|GUICtrlTreeView_SetStateImageIndex|GUICtrlTreeView_SetStateImageList|GUICtrlTreeView_SetText|GUICtrlTreeView_SetTextColor|GUICtrlTreeView_SetToolTips|GUICtrlTreeView_SetUnicodeFormat|GUICtrlTreeView_Sort|GUIImageList_Add|GUIImageList_AddBitmap|GUIImageList_AddIcon|GUIImageList_AddMasked|GUIImageList_BeginDrag|GUIImageList_Copy|GUIImageList_Create|GUIImageList_Destroy|GUIImageList_DestroyIcon|GUIImageList_DragEnter|GUIImageList_DragLeave|GUIImageList_DragMove|GUIImageList_Draw|GUIImageList_DrawEx|GUIImageList_Duplicate|GUIImageList_EndDrag|GUIImageList_GetBkColor|GUIImageList_GetIcon|GUIImageList_GetIconHeight|GUIImageList_GetIconSize|GUIImageList_GetIconSizeEx|GUIImageList_GetIconWidth|GUIImageList_GetImageCount|GUIImageList_GetImageInfoEx|GUIImageList_Remove|GUIImageList_ReplaceIcon|GUIImageList_SetBkColor|GUIImageList_SetIconSize|GUIImageList_SetImageCount|GUIImageList_Swap|GUIScrollBars_EnableScrollBar|GUIScrollBars_GetScrollBarInfoEx|GUIScrollBars_GetScrollBarRect|GUIScrollBars_GetScrollBarRGState|GUIScrollBars_GetScrollBarXYLineButton|GUIScrollBars_GetScrollBarXYThumbBottom|GUIScrollBars_GetScrollBarXYThumbTop|GUIScrollBars_GetScrollInfo|GUIScrollBars_GetScrollInfoEx|GUIScrollBars_GetScrollInfoMax|GUIScrollBars_GetScrollInfoMin|GUIScrollBars_GetScrollInfoPage|GUIScrollBars_GetScrollInfoPos|GUIScrollBars_GetScrollInfoTrackPos|GUIScrollBars_GetScrollPos|GUIScrollBars_GetScrollRange|GUIScrollBars_Init|GUIScrollBars_ScrollWindow|GUIScrollBars_SetScrollInfo|GUIScrollBars_SetScrollInfoMax|GUIScrollBars_SetScrollInfoMin|GUIScrollBars_SetScrollInfoPage|GUIScrollBars_SetScrollInfoPos|GUIScrollBars_SetScrollRange|GUIScrollBars_ShowScrollBar|GUIToolTip_Activate|GUIToolTip_AddTool|GUIToolTip_AdjustRect|GUIToolTip_BitsToTTF|GUIToolTip_Create|GUIToolTip_DelTool|GUIToolTip_Destroy|GUIToolTip_EnumTools|GUIToolTip_GetBubbleHeight|GUIToolTip_GetBubbleSize|GUIToolTip_GetBubbleWidth|GUIToolTip_GetCurrentTool|GUIToolTip_GetDelayTime|GUIToolTip_GetMargin|GUIToolTip_GetMarginEx|GUIToolTip_GetMaxTipWidth|GUIToolTip_GetText|GUIToolTip_GetTipBkColor|GUIToolTip_GetTipTextColor|GUIToolTip_GetTitleBitMap|GUIToolTip_GetTitleText|GUIToolTip_GetToolCount|GUIToolTip_GetToolInfo|GUIToolTip_HitTest|GUIToolTip_NewToolRect|GUIToolTip_Pop|GUIToolTip_PopUp|GUIToolTip_SetDelayTime|GUIToolTip_SetMargin|GUIToolTip_SetMaxTipWidth|GUIToolTip_SetTipBkColor|GUIToolTip_SetTipTextColor|GUIToolTip_SetTitle|GUIToolTip_SetToolInfo|GUIToolTip_SetWindowTheme|GUIToolTip_ToolExists|GUIToolTip_ToolToArray|GUIToolTip_TrackActivate|GUIToolTip_TrackPosition|GUIToolTip_TTFToBits|GUIToolTip_Update|GUIToolTip_UpdateTipText|HexToString|IE_Example|IE_Introduction|IE_VersionInfo|IEAction|IEAttach|IEBodyReadHTML|IEBodyReadText|IEBodyWriteHTML|IECreate|IECreateEmbedded|IEDocGetObj|IEDocInsertHTML|IEDocInsertText|IEDocReadHTML|IEDocWriteHTML|IEErrorHandlerDeRegister|IEErrorHandlerRegister|IEErrorNotify|IEFormElementCheckBoxSelect|IEFormElementGetCollection|IEFormElementGetObjByName|IEFormElementGetValue|IEFormElementOptionSelect|IEFormElementRadioSelect|IEFormElementSetValue|IEFormGetCollection|IEFormGetObjByName|IEFormImageClick|IEFormReset|IEFormSubmit|IEFrameGetCollection|IEFrameGetObjByName|IEGetObjById|IEGetObjByName|IEHeadInsertEventScript|IEImgClick|IEImgGetCollection|IEIsFrameSet|IELinkClickByIndex|IELinkClickByText|IELinkGetCollection|IELoadWait|IELoadWaitTimeout|IENavigate|IEPropertyGet|IEPropertySet|IEQuit|IETableGetCollection|IETableWriteToArray|IETagNameAllGetCollection|IETagNameGetCollection|Iif|INetExplorerCapable|INetGetSource|INetMail|INetSmtpMail|IsPressed|MathCheckDiv|Max|MemGlobalAlloc|MemGlobalFree|MemGlobalLock|MemGlobalSize|MemGlobalUnlock|MemMoveMemory|MemMsgBox|MemShowError|MemVirtualAlloc|MemVirtualAllocEx|MemVirtualFree|MemVirtualFreeEx|Min|MouseTrap|NamedPipes_CallNamedPipe|NamedPipes_ConnectNamedPipe|NamedPipes_CreateNamedPipe|NamedPipes_CreatePipe|NamedPipes_DisconnectNamedPipe|NamedPipes_GetNamedPipeHandleState|NamedPipes_GetNamedPipeInfo|NamedPipes_PeekNamedPipe|NamedPipes_SetNamedPipeHandleState|NamedPipes_TransactNamedPipe|NamedPipes_WaitNamedPipe|Net_Share_ConnectionEnum|Net_Share_FileClose|Net_Share_FileEnum|Net_Share_FileGetInfo|Net_Share_PermStr|Net_Share_ResourceStr|Net_Share_SessionDel|Net_Share_SessionEnum|Net_Share_SessionGetInfo|Net_Share_ShareAdd|Net_Share_ShareCheck|Net_Share_ShareDel|Net_Share_ShareEnum|Net_Share_ShareGetInfo|Net_Share_ShareSetInfo|Net_Share_StatisticsGetSvr|Net_Share_StatisticsGetWrk|Now|NowCalc|NowCalcDate|NowDate|NowTime|PathFull|PathMake|PathSplit|ProcessGetName|ProcessGetPriority|Radian|ReplaceStringInFile|RunDOS|ScreenCapture_Capture|ScreenCapture_CaptureWnd|ScreenCapture_SaveImage|ScreenCapture_SetBMPFormat|ScreenCapture_SetJPGQuality|ScreenCapture_SetTIFColorDepth|ScreenCapture_SetTIFCompression|Security__AdjustTokenPrivileges|Security__GetAccountSid|Security__GetLengthSid|Security__GetTokenInformation|Security__ImpersonateSelf|Security__IsValidSid|Security__LookupAccountName|Security__LookupAccountSid|Security__LookupPrivilegeValue|Security__OpenProcessToken|Security__OpenThreadToken|Security__OpenThreadTokenEx|Security__SetPrivilege|Security__SidToStringSid|Security__SidTypeStr|Security__StringSidToSid|SendMessage|SendMessageA|SetDate|SetTime|Singleton|SoundClose|SoundLength|SoundOpen|SoundPause|SoundPlay|SoundPos|SoundResume|SoundSeek|SoundStatus|SoundStop|SQLite_Changes|SQLite_Close|SQLite_Display2DResult|SQLite_Encode|SQLite_ErrCode|SQLite_ErrMsg|SQLite_Escape|SQLite_Exec|SQLite_FetchData|SQLite_FetchNames|SQLite_GetTable|SQLite_GetTable2d|SQLite_LastInsertRowID|SQLite_LibVersion|SQLite_Open|SQLite_Query|SQLite_QueryFinalize|SQLite_QueryReset|SQLite_QuerySingleRow|SQLite_SaveMode|SQLite_SetTimeout|SQLite_Shutdown|SQLite_SQLiteExe|SQLite_Startup|SQLite_TotalChanges|StringAddComma|StringBetween|StringEncrypt|StringInsert|StringProper|StringRepeat|StringReverse|StringSplit|StringToHex|TCPIpToName|TempFile|TicksToTime|Timer_Diff|Timer_GetTimerID|Timer_Init|Timer_KillAllTimers|Timer_KillTimer|Timer_SetTimer|TimeToTicks|VersionCompare|viClose|viExecCommand|viFindGpib|viGpibBusReset|viGTL|viOpen|viSetAttribute|viSetTimeout|WeekNumberISO|WinAPI_AttachConsole|WinAPI_AttachThreadInput|WinAPI_Beep|WinAPI_BitBlt|WinAPI_CallNextHookEx|WinAPI_Check|WinAPI_ClientToScreen|WinAPI_CloseHandle|WinAPI_CommDlgExtendedError|WinAPI_CopyIcon|WinAPI_CreateBitmap|WinAPI_CreateCompatibleBitmap|WinAPI_CreateCompatibleDC|WinAPI_CreateEvent|WinAPI_CreateFile|WinAPI_CreateFont|WinAPI_CreateFontIndirect|WinAPI_CreateProcess|WinAPI_CreateSolidBitmap|WinAPI_CreateSolidBrush|WinAPI_CreateWindowEx|WinAPI_DefWindowProc|WinAPI_DeleteDC|WinAPI_DeleteObject|WinAPI_DestroyIcon|WinAPI_DestroyWindow|WinAPI_DrawEdge|WinAPI_DrawFrameControl|WinAPI_DrawIcon|WinAPI_DrawIconEx|WinAPI_DrawText|WinAPI_EnableWindow|WinAPI_EnumDisplayDevices|WinAPI_EnumWindows|WinAPI_EnumWindowsPopup|WinAPI_EnumWindowsTop|WinAPI_ExpandEnvironmentStrings|WinAPI_ExtractIconEx|WinAPI_FatalAppExit|WinAPI_FillRect|WinAPI_FindExecutable|WinAPI_FindWindow|WinAPI_FlashWindow|WinAPI_FlashWindowEx|WinAPI_FloatToInt|WinAPI_FlushFileBuffers|WinAPI_FormatMessage|WinAPI_FrameRect|WinAPI_FreeLibrary|WinAPI_GetAncestor|WinAPI_GetAsyncKeyState|WinAPI_GetClassName|WinAPI_GetClientHeight|WinAPI_GetClientRect|WinAPI_GetClientWidth|WinAPI_GetCurrentProcess|WinAPI_GetCurrentProcessID|WinAPI_GetCurrentThread|WinAPI_GetCurrentThreadId|WinAPI_GetCursorInfo|WinAPI_GetDC|WinAPI_GetDesktopWindow|WinAPI_GetDeviceCaps|WinAPI_GetDIBits|WinAPI_GetDlgCtrlID|WinAPI_GetDlgItem|WinAPI_GetFileSizeEx|WinAPI_GetFocus|WinAPI_GetForegroundWindow|WinAPI_GetIconInfo|WinAPI_GetLastError|WinAPI_GetLastErrorMessage|WinAPI_GetModuleHandle|WinAPI_GetMousePos|WinAPI_GetMousePosX|WinAPI_GetMousePosY|WinAPI_GetObject|WinAPI_GetOpenFileName|WinAPI_GetOverlappedResult|WinAPI_GetParent|WinAPI_GetProcessAffinityMask|WinAPI_GetSaveFileName|WinAPI_GetStdHandle|WinAPI_GetStockObject|WinAPI_GetSysColor|WinAPI_GetSysColorBrush|WinAPI_GetSystemMetrics|WinAPI_GetTextExtentPoint32|WinAPI_GetWindow|WinAPI_GetWindowDC|WinAPI_GetWindowHeight|WinAPI_GetWindowLong|WinAPI_GetWindowRect|WinAPI_GetWindowText|WinAPI_GetWindowThreadProcessId|WinAPI_GetWindowWidth|WinAPI_GetXYFromPoint|WinAPI_GlobalMemStatus|WinAPI_GUIDFromString|WinAPI_GUIDFromStringEx|WinAPI_HiWord|WinAPI_InProcess|WinAPI_IntToFloat|WinAPI_InvalidateRect|WinAPI_IsClassName|WinAPI_IsWindow|WinAPI_IsWindowVisible|WinAPI_LoadBitmap|WinAPI_LoadImage|WinAPI_LoadLibrary|WinAPI_LoadLibraryEx|WinAPI_LoadShell32Icon|WinAPI_LoadString|WinAPI_LocalFree|WinAPI_LoWord|WinAPI_MakeDWord|WinAPI_MAKELANGID|WinAPI_MAKELCID|WinAPI_MakeLong|WinAPI_MessageBeep|WinAPI_Mouse_Event|WinAPI_MoveWindow|WinAPI_MsgBox|WinAPI_MulDiv|WinAPI_MultiByteToWideChar|WinAPI_MultiByteToWideCharEx|WinAPI_OpenProcess|WinAPI_PointFromRect|WinAPI_PostMessage|WinAPI_PrimaryLangId|WinAPI_PtInRect|WinAPI_ReadFile|WinAPI_ReadProcessMemory|WinAPI_RectIsEmpty|WinAPI_RedrawWindow|WinAPI_RegisterWindowMessage|WinAPI_ReleaseCapture|WinAPI_ReleaseDC|WinAPI_ScreenToClient|WinAPI_SelectObject|WinAPI_SetBkColor|WinAPI_SetCapture|WinAPI_SetCursor|WinAPI_SetDefaultPrinter|WinAPI_SetDIBits|WinAPI_SetEvent|WinAPI_SetFocus|WinAPI_SetFont|WinAPI_SetHandleInformation|WinAPI_SetLastError|WinAPI_SetParent|WinAPI_SetProcessAffinityMask|WinAPI_SetSysColors|WinAPI_SetTextColor|WinAPI_SetWindowLong|WinAPI_SetWindowPos|WinAPI_SetWindowsHookEx|WinAPI_SetWindowText|WinAPI_ShowCursor|WinAPI_ShowError|WinAPI_ShowMsg|WinAPI_ShowWindow|WinAPI_StringFromGUID|WinAPI_SubLangId|WinAPI_SystemParametersInfo|WinAPI_TwipsPerPixelX|WinAPI_TwipsPerPixelY|WinAPI_UnhookWindowsHookEx|WinAPI_UpdateLayeredWindow|WinAPI_UpdateWindow|WinAPI_ValidateClassName|WinAPI_WaitForInputIdle|WinAPI_WaitForMultipleObjects|WinAPI_WaitForSingleObject|WinAPI_WideCharToMultiByte|WinAPI_WindowFromPoint|WinAPI_WriteConsole|WinAPI_WriteFile|WinAPI_WriteProcessMemory|WinNet_AddConnection|WinNet_AddConnection2|WinNet_AddConnection3|WinNet_CancelConnection|WinNet_CancelConnection2|WinNet_CloseEnum|WinNet_ConnectionDialog|WinNet_ConnectionDialog1|WinNet_DisconnectDialog|WinNet_DisconnectDialog1|WinNet_EnumResource|WinNet_GetConnection|WinNet_GetConnectionPerformance|WinNet_GetLastError|WinNet_GetNetworkInformation|WinNet_GetProviderName|WinNet_GetResourceInformation|WinNet_GetResourceParent|WinNet_GetUniversalName|WinNet_GetUser|WinNet_OpenEnum|WinNet_RestoreConnection|WinNet_UseConnection|Word_VersionInfo|WordAttach|WordCreate|WordDocAdd|WordDocAddLink|WordDocAddPicture|WordDocClose|WordDocFindReplace|WordDocGetCollection|WordDocLinkGetCollection|WordDocOpen|WordDocPrint|WordDocPropertyGet|WordDocPropertySet|WordDocSave|WordDocSaveAs|WordErrorHandlerDeRegister|WordErrorHandlerRegister|WordErrorNotify|WordMacroRun|WordPropertyGet|WordPropertySet|WordQuit|ce|comments-end|comments-start|cs|include|include-once|NoTrayIcon|RequireAdmin|AutoIt3Wrapper_Au3Check_Parameters|AutoIt3Wrapper_Au3Check_Stop_OnWarning|AutoIt3Wrapper_Change2CUI|AutoIt3Wrapper_Compression|AutoIt3Wrapper_cvsWrapper_Parameters|AutoIt3Wrapper_Icon|AutoIt3Wrapper_Outfile|AutoIt3Wrapper_Outfile_Type|AutoIt3Wrapper_Plugin_Funcs|AutoIt3Wrapper_Res_Comment|AutoIt3Wrapper_Res_Description|AutoIt3Wrapper_Res_Field|AutoIt3Wrapper_Res_File_Add|AutoIt3Wrapper_Res_Fileversion|AutoIt3Wrapper_Res_FileVersion_AutoIncrement|AutoIt3Wrapper_Res_Icon_Add|AutoIt3Wrapper_Res_Language|AutoIt3Wrapper_Res_LegalCopyright|AutoIt3Wrapper_res_requestedExecutionLevel|AutoIt3Wrapper_Res_SaveSource|AutoIt3Wrapper_Run_After|AutoIt3Wrapper_Run_Au3check|AutoIt3Wrapper_Run_Before|AutoIt3Wrapper_Run_cvsWrapper|AutoIt3Wrapper_Run_Debug_Mode|AutoIt3Wrapper_Run_Obfuscator|AutoIt3Wrapper_Run_Tidy|AutoIt3Wrapper_Tidy_Stop_OnError|AutoIt3Wrapper_UseAnsi|AutoIt3Wrapper_UseUpx|AutoIt3Wrapper_UseX64|AutoIt3Wrapper_Version|EndRegion|forceref|Obfuscator_Ignore_Funcs|Obfuscator_Ignore_Variables|Obfuscator_Parameters|Region|Tidy_Parameters\",t=\"AppDataCommonDir|AppDataDir|AutoItExe|AutoItPID|AutoItUnicode|AutoItVersion|AutoItX64|COM_EventObj|CommonFilesDir|Compiled|ComputerName|ComSpec|CR|CRLF|DesktopCommonDir|DesktopDepth|DesktopDir|DesktopHeight|DesktopRefresh|DesktopWidth|DocumentsCommonDir|error|exitCode|exitMethod|extended|FavoritesCommonDir|FavoritesDir|GUI_CtrlHandle|GUI_CtrlId|GUI_DragFile|GUI_DragId|GUI_DropId|GUI_WinHandle|HomeDrive|HomePath|HomeShare|HotKeyPressed|HOUR|InetGetActive|InetGetBytesRead|IPAddress1|IPAddress2|IPAddress3|IPAddress4|KBLayout|LF|LogonDNSDomain|LogonDomain|LogonServer|MDAY|MIN|MON|MyDocumentsDir|NumParams|OSBuild|OSLang|OSServicePack|OSTYPE|OSVersion|ProcessorArch|ProgramFilesDir|ProgramsCommonDir|ProgramsDir|ScriptDir|ScriptFullPath|ScriptLineNumber|ScriptName|SEC|StartMenuCommonDir|StartMenuDir|StartupCommonDir|StartupDir|SW_DISABLE|SW_ENABLE|SW_HIDE|SW_LOCK|SW_MAXIMIZE|SW_MINIMIZE|SW_RESTORE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWMINNOACTIVE|SW_SHOWNA|SW_SHOWNOACTIVATE|SW_SHOWNORMAL|SW_UNLOCK|SystemDir|TAB|TempDir|TRAY_ID|TrayIconFlashing|TrayIconVisible|UserName|UserProfileDir|WDAY|WindowsDir|WorkingDir|YDAY|YEAR\";this.$rules={start:[{token:\"comment.line.ahk\",regex:\"(?:^| );.*$\"},{token:\"comment.block.ahk\",regex:\"/\\\\*\",push:[{token:\"comment.block.ahk\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.ahk\"}]},{token:\"doc.comment.ahk\",regex:\"#cs\",push:[{token:\"doc.comment.ahk\",regex:\"#ce\",next:\"pop\"},{defaultToken:\"doc.comment.ahk\"}]},{token:\"keyword.command.ahk\",regex:\"(?:\\\\b|^)(?:allowsamelinecomments|clipboardtimeout|commentflag|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|include|includeagain|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|noenv|notrayicon|persistent|singleinstance|usehook|winactivateforce|autotrim|blockinput|click|clipwait|continue|control|controlclick|controlfocus|controlget|controlgetfocus|controlgetpos|controlgettext|controlmove|controlsend|controlsendraw|controlsettext|coordmode|critical|detecthiddentext|detecthiddenwindows|drive|driveget|drivespacefree|edit|endrepeat|envadd|envdiv|envget|envmult|envset|envsub|envupdate|exit|exitapp|fileappend|filecopy|filecopydir|filecreatedir|filecreateshortcut|filedelete|filegetattrib|filegetshortcut|filegetsize|filegettime|filegetversion|fileinstall|filemove|filemovedir|fileread|filereadline|filerecycle|filerecycleempty|fileremovedir|fileselectfile|fileselectfolder|filesetattrib|filesettime|formattime|getkeystate|gosub|goto|groupactivate|groupadd|groupclose|groupdeactivate|gui|guicontrol|guicontrolget|hideautoitwin|hotkey|ifequal|ifexist|ifgreater|ifgreaterorequal|ifinstring|ifless|iflessorequal|ifmsgbox|ifnotequal|ifnotexist|ifnotinstring|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|imagesearch|inidelete|iniread|iniwrite|input|inputbox|keyhistory|keywait|listhotkeys|listlines|listvars|menu|mouseclick|mouseclickdrag|mousegetpos|mousemove|msgbox|onexit|outputdebug|pause|pixelgetcolor|pixelsearch|postmessage|process|progress|random|regdelete|regread|regwrite|reload|repeat|run|runas|runwait|send|sendevent|sendinput|sendmode|sendplay|sendmessage|sendraw|setbatchlines|setcapslockstate|setcontroldelay|setdefaultmousespeed|setenv|setformat|setkeydelay|setmousedelay|setnumlockstate|setscrolllockstate|setstorecapslockmode|settimer|settitlematchmode|setwindelay|setworkingdir|shutdown|sleep|sort|soundbeep|soundget|soundgetwavevolume|soundplay|soundset|soundsetwavevolume|splashimage|splashtextoff|splashtexton|splitpath|statusbargettext|statusbarwait|stringcasesense|stringgetpos|stringleft|stringlen|stringlower|stringmid|stringreplace|stringright|stringsplit|stringtrimleft|stringtrimright|stringupper|suspend|sysget|thread|tooltip|transform|traytip|urldownloadtofile|while|winactivate|winactivatebottom|winclose|winget|wingetactivestats|wingetactivetitle|wingetclass|wingetpos|wingettext|wingettitle|winhide|winkill|winmaximize|winmenuselectitem|winminimize|winminimizeall|winminimizeallundo|winmove|winrestore|winset|winsettitle|winshow|winwait|winwaitactive|winwaitclose|winwaitnotactive)\\\\b\",caseInsensitive:!0},{token:\"keyword.control.ahk\",regex:\"(?:\\\\b|^)(?:if|else|return|loop|break|for|while|global|local|byref)\\\\b\",caseInsensitive:!0},{token:\"support.function.ahk\",regex:\"(?:\\\\b|^)(?:abs|acos|asc|asin|atan|ceil|chr|cos|dllcall|exp|fileexist|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist)\\\\b\",caseInsensitive:!0},{token:\"variable.predefined.ahk\",regex:\"(?:\\\\b|^)(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\\\\b\",caseInsensitive:!0},{token:\"support.constant.ahk\",regex:\"(?:\\\\b|^)(?:shift|lshift|rshift|alt|lalt|ralt|control|lcontrol|rcontrol|ctrl|lctrl|rctrl|lwin|rwin|appskey|altdown|altup|shiftdown|shiftup|ctrldown|ctrlup|lwindown|lwinup|rwindown|rwinup|lbutton|rbutton|mbutton|wheelup|wheelleft|wheelright|wheeldown|xbutton1|xbutton2|joy1|joy2|joy3|joy4|joy5|joy6|joy7|joy8|joy9|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy30|joy31|joy32|joyx|joyy|joyz|joyr|joyu|joyv|joypov|joyname|joybuttons|joyaxes|joyinfo|space|tab|enter|escape|esc|backspace|bs|delete|del|insert|ins|pgup|pgdn|home|end|up|down|left|right|printscreen|ctrlbreak|pause|scrolllock|capslock|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadmult|numpadadd|numpadsub|numpaddiv|numpaddot|numpaddel|numpadins|numpadclear|numpadup|numpaddown|numpadleft|numpadright|numpadhome|numpadend|numpadpgup|numpadpgdn|numpadenter|f1|f2|f3|f4|f5|f6|f7|f8|f9|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f20|f21|f22|f23|f24|browser_back|browser_forward|browser_refresh|browser_stop|browser_search|browser_favorites|browser_home|volume_mute|volume_down|volume_up|media_next|media_prev|media_stop|media_play_pause|launch_mail|launch_media|launch_app1|launch_app2)\\\\b\",caseInsensitive:!0},{token:\"variable.parameter\",regex:\"(?:\\\\b|^)(?:pixel|mouse|screen|relative|rgb|ltrim|rtrim|join|low|belownormal|normal|abovenormal|high|realtime|ahk_id|ahk_pid|ahk_class|ahk_group|between|contains|in|is|integer|float|integerfast|floatfast|number|digit|xdigit|alpha|upper|lower|alnum|time|date|not|or|and|alwaysontop|topmost|top|bottom|transparent|transcolor|redraw|region|id|idlast|processname|minmax|controllist|count|list|capacity|statuscd|eject|lock|unlock|label|filesystem|label|setlabel|serial|type|status|static|seconds|minutes|hours|days|read|parse|logoff|close|error|single|tray|add|rename|check|uncheck|togglecheck|enable|disable|toggleenable|default|nodefault|standard|nostandard|color|delete|deleteall|icon|noicon|tip|click|show|mainwindow|nomainwindow|useerrorlevel|text|picture|pic|groupbox|button|checkbox|radio|dropdownlist|ddl|combobox|listbox|listview|datetime|monthcal|updown|slider|tab|tab2|statusbar|treeview|iconsmall|tile|report|sortdesc|nosort|nosorthdr|grid|hdr|autosize|range|xm|ym|ys|xs|xp|yp|font|resize|owner|submit|nohide|minimize|maximize|restore|noactivate|na|cancel|destroy|center|margin|maxsize|minsize|owndialogs|guiescape|guiclose|guisize|guicontextmenu|guidropfiles|tabstop|section|altsubmit|wrap|hscroll|vscroll|border|top|bottom|buttons|expand|first|imagelist|lines|wantctrla|wantf2|vis|visfirst|number|uppercase|lowercase|limit|password|multi|wantreturn|group|background|bold|italic|strike|underline|norm|backgroundtrans|theme|caption|delimiter|minimizebox|maximizebox|sysmenu|toolwindow|flash|style|exstyle|check3|checked|checkedgray|readonly|password|hidden|left|right|center|notab|section|move|focus|hide|choose|choosestring|text|pos|enabled|disabled|visible|lastfound|lastfoundexist|alttab|shiftalttab|alttabmenu|alttabandmenu|alttabmenudismiss|notimers|interrupt|priority|waitclose|blind|raw|unicode|deref|pow|bitnot|bitand|bitor|bitxor|bitshiftleft|bitshiftright|yes|no|ok|cancel|abort|retry|ignore|tryagain|on|off|all|hkey_local_machine|hkey_users|hkey_current_user|hkey_classes_root|hkey_current_config|hklm|hku|hkcu|hkcr|hkcc|reg_sz|reg_expand_sz|reg_multi_sz|reg_dword|reg_qword|reg_binary|reg_link|reg_resource_list|reg_full_resource_descriptor|reg_resource_requirements_list|reg_dword_big_endian)\\\\b\",caseInsensitive:!0},{keywordMap:{\"constant.language\":e},regex:\"\\\\w+\\\\b\"},{keywordMap:{\"variable.function\":t},regex:\"@\\\\w+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"keyword.operator.ahk\",regex:\"=|==|<>|:=|<|>|\\\\*|\\\\/|\\\\+|:|\\\\?|\\\\-\"},{token:\"punctuation.ahk\",regex:\"#|`|::|,|\\\\{|\\\\}|\\\\(|\\\\)|\\\\%\"},{token:[\"punctuation.quote.double\",\"string.quoted.ahk\",\"punctuation.quote.double\"],regex:'(\")((?:[^\"]|\"\")*)(\")'},{token:[\"label.ahk\",\"punctuation.definition.label.ahk\"],regex:\"^([^: ]+)(:)(?!:)\"}]},this.normalizeRules()};s.metaData={name:\"AutoHotKey\",scopeName:\"source.ahk\",fileTypes:[\"ahk\"],foldingStartMarker:\"^\\\\s*/\\\\*|^(?![^{]*?;|[^{]*?/\\\\*(?!.*?\\\\*/.*?\\\\{)).*?\\\\{\\\\s*($|;|/\\\\*(?!.*?\\\\*/.*\\\\S))\",foldingStopMarker:\"^\\\\s*\\\\*/|^\\\\s*\\\\}\"},r.inherits(s,i),t.AutoHotKeyHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-batchfile.js",
    "content": "define(\"ace/mode/batchfile\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/batchfile_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./batchfile_highlight_rules\").BatchFileHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"::\",this.blockComment=\"\",this.$id=\"ace/mode/batchfile\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/batchfile_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"keyword.command.dosbatch\",regex:\"\\\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\\\b\",caseInsensitive:!0},{token:\"keyword.control.statement.dosbatch\",regex:\"\\\\b(?:goto|call|exit)\\\\b\",caseInsensitive:!0},{token:\"keyword.control.conditional.if.dosbatch\",regex:\"\\\\bif\\\\s+not\\\\s+(?:exist|defined|errorlevel|cmdextversion)\\\\b\",caseInsensitive:!0},{token:\"keyword.control.conditional.dosbatch\",regex:\"\\\\b(?:if|else)\\\\b\",caseInsensitive:!0},{token:\"keyword.control.repeat.dosbatch\",regex:\"\\\\bfor\\\\b\",caseInsensitive:!0},{token:\"keyword.operator.dosbatch\",regex:\"\\\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\\\b\"},{token:[\"doc.comment\",\"comment\"],regex:\"(?:^|\\\\b)(rem)($|\\\\s.*$)\",caseInsensitive:!0},{token:\"comment.line.colons.dosbatch\",regex:\"::.*$\"},{include:\"variable\"},{token:\"punctuation.definition.string.begin.shell\",regex:'\"',push:[{token:\"punctuation.definition.string.end.shell\",regex:'\"',next:\"pop\"},{include:\"variable\"},{defaultToken:\"string.quoted.double.dosbatch\"}]},{token:\"keyword.operator.pipe.dosbatch\",regex:\"[|]\"},{token:\"keyword.operator.redirect.shell\",regex:\"&>|\\\\d*>&\\\\d*|\\\\d*(?:>>|>|<)|\\\\d*<&|\\\\d*<>\"}],variable:[{token:\"constant.numeric\",regex:\"%%\\\\w+|%[*\\\\d]|%\\\\w+%\"},{token:\"constant.numeric\",regex:\"%~\\\\d+\"},{token:[\"markup.list\",\"constant.other\",\"markup.list\"],regex:\"(%)(\\\\w+)(%?)\"}]},this.normalizeRules()};s.metaData={name:\"Batch File\",scopeName:\"source.dosbatch\",fileTypes:[\"bat\"]},r.inherits(s,i),t.BatchFileHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-c9search.js",
    "content": "define(\"ace/mode/c9search\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c9search_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/folding/c9search\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c9search_highlight_rules\").C9SearchHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./folding/c9search\").FoldMode,a=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c9search\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/c9search_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){function o(e,t){try{return new RegExp(e,t)}catch(n){}}var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){this.$rules={start:[{tokenNames:[\"c9searchresults.constant.numeric\",\"c9searchresults.text\",\"c9searchresults.text\",\"c9searchresults.keyword\"],regex:\"(^\\\\s+[0-9]+)(:\\\\s)(.+)\",onMatch:function(e,t,n){var r=this.splitRegex.exec(e),i=this.tokenNames,s=[{type:i[0],value:r[1]},{type:i[1],value:r[2]}],o=n[1],u=r[3],a,f=0;if(o&&o.exec){o.lastIndex=0;while(a=o.exec(u)){var l=u.substring(f,a.index);f=o.lastIndex,l&&s.push({type:i[2],value:l});if(a[0])s.push({type:i[3],value:a[0]});else if(!l)break}}return f<u.length&&s.push({type:i[2],value:u.substr(f)}),s}},{token:[\"string\",\"text\"],regex:\"(\\\\S.*)(:$)\"},{regex:\"Searching for .*$\",onMatch:function(e,t,n){var r=e.split(\"\\x01\");if(r.length<3)return\"text\";var s,u,a,f=0,l=[{value:r[f++]+\"'\",type:\"text\"},{value:u=r[f++],type:\"text\"},{value:\"'\"+r[f++],type:\"text\"}];r[2]!==\" in\"&&(a=r[f],l.push({value:\"'\"+r[f++]+\"'\",type:\"text\"},{value:r[f++],type:\"text\"})),l.push({value:\" \"+r[f++]+\" \",type:\"text\"}),r[f+1]?(s=r[f+1],l.push({value:\"(\"+r[f+1]+\")\",type:\"text\"}),f+=1):f-=1;while(f++<r.length)r[f]&&l.push({value:r[f],type:\"text\"});a&&(u=a,s=\"\"),u&&(/regex/.test(s)||(u=i.escapeRegExp(u)),/whole/.test(s)&&(u=\"\\\\b\"+u+\"\\\\b\"));var c=u&&o(\"(\"+u+\")\",/ sensitive/.test(s)?\"g\":\"ig\");return c&&(n[0]=t,n[1]=c),l}},{regex:\"\\\\d+\",token:\"constant.numeric\"}]}};r.inherits(u,s),t.C9SearchHighlightRules=u}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/c9search\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^(\\S.*\\:|Searching for.*)$/,this.foldingStopMarker=/^(\\s+|Found.*)$/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getAllLines(n),s=r[n],o=/^(Found.*|Searching for.*)$/,u=/^(\\S.*\\:|\\s*)$/,a=o.test(s)?o:u,f=n,l=n;if(this.foldingStartMarker.test(s)){for(var c=n+1,h=e.getLength();c<h;c++)if(a.test(r[c]))break;l=c}else if(this.foldingStopMarker.test(s)){for(var c=n-1;c>=0;c--){s=r[c];if(a.test(s))break}f=c}if(f!=l){var p=s.length;return a===o&&(p=s.search(/\\(Found[^)]+\\)$|$/)),new i(f,p,l,0)}}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-c_cpp.js",
    "content": "define(\"ace/mode/c_cpp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c_cpp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c_cpp\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-cirru.js",
    "content": "define(\"ace/mode/cirru\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/cirru_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./cirru_highlight_rules\").CirruHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.$id=\"ace/mode/cirru\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/cirru_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"constant.numeric\",regex:/[\\d\\.]+/},{token:\"comment.line.double-dash\",regex:/--/,next:\"comment\"},{token:\"storage.modifier\",regex:/\\(/},{token:\"storage.modifier\",regex:/\\,/,next:\"line\"},{token:\"support.function\",regex:/[^\\(\\)\\\"\\s]+/,next:\"line\"},{token:\"string.quoted.double\",regex:/\"/,next:\"string\"},{token:\"storage.modifier\",regex:/\\)/}],comment:[{token:\"comment.line.double-dash\",regex:/\\ +[^\\n]+/,next:\"start\"}],string:[{token:\"string.quoted.double\",regex:/\"/,next:\"line\"},{token:\"constant.character.escape\",regex:/\\\\/,next:\"escape\"},{token:\"string.quoted.double\",regex:/[^\\\\\\\"]+/}],escape:[{token:\"constant.character.escape\",regex:/./,next:\"string\"}],line:[{token:\"constant.numeric\",regex:/[\\d\\.]+/},{token:\"markup.raw\",regex:/^\\s*/,next:\"start\"},{token:\"storage.modifier\",regex:/\\$/,next:\"start\"},{token:\"variable.parameter\",regex:/[^\\(\\)\\\"\\s]+/},{token:\"storage.modifier\",regex:/\\(/,next:\"start\"},{token:\"storage.modifier\",regex:/\\)/},{token:\"markup.raw\",regex:/^\\ */,next:\"start\"},{token:\"string.quoted.double\",regex:/\"/,next:\"string\"}]}};r.inherits(s,i),t.CirruHighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-clojure.js",
    "content": "define(\"ace/mode/clojure\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/clojure_highlight_rules\",\"ace/mode/matching_parens_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./clojure_highlight_rules\").ClojureHighlightRules,o=e(\"./matching_parens_outdent\").MatchingParensOutdent,u=function(){this.HighlightRules=s,this.$outdent=new o};r.inherits(u,i),function(){this.lineCommentStart=\";\",this.minorIndentFunctions=[\"defn\",\"defn-\",\"defmacro\",\"def\",\"deftest\",\"testing\"],this.$toIndent=function(e){return e.split(\"\").map(function(e){return/\\s/.exec(e)?e:\" \"}).join(\"\")},this.$calculateIndent=function(e,t){var n=this.$getIndent(e),r=0,i,s;for(var o=e.length-1;o>=0;o--){s=e[o],s===\"(\"?(r--,i=!0):s===\"(\"||s===\"[\"||s===\"{\"?(r--,i=!1):(s===\")\"||s===\"]\"||s===\"}\")&&r++;if(r<0)break}if(!(r<0&&i))return r<0&&!i?this.$toIndent(e.substring(0,o+1)):r>0?(n=n.substring(0,n.length-t.length),n):n;o+=1;var u=o,a=\"\";for(;;){s=e[o];if(s===\" \"||s===\"\t\")return this.minorIndentFunctions.indexOf(a)!==-1?this.$toIndent(e.substring(0,u-1)+t):this.$toIndent(e.substring(0,o+1));if(s===undefined)return this.$toIndent(e.substring(0,u-1)+t);a+=e[o],o++}},this.getNextLineIndent=function(e,t,n){return this.$calculateIndent(t,n)},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/clojure\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/clojure_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* *command-line-args* *compile-files* *compile-path* *e *err* *file* *flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* *print-dup* *print-length* *print-level* *print-meta* *print-readably* *read-eval* *source-path* *use-context-classloader* *warn-on-reflection* + - -> ->> .. / < <= = == > &gt; >= &gt;= accessor aclone add-classpath add-watch agent agent-errors aget alength alias all-ns alter alter-meta! alter-var-root amap ancestors and apply areduce array-map aset aset-boolean aset-byte aset-char aset-double aset-float aset-int aset-long aset-short assert assoc assoc! assoc-in associative? atom await await-for await1 bases bean bigdec bigint binding bit-and bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left bit-shift-right bit-test bit-xor boolean boolean-array booleans bound-fn bound-fn* butlast byte byte-array bytes cast char char-array char-escape-string char-name-string char? chars chunk chunk-append chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? class class? clear-agent-errors clojure-version coll? comment commute comp comparator compare compare-and-set! compile complement concat cond condp conj conj! cons constantly construct-proxy contains? count counted? create-ns create-struct cycle dec decimal? declare definline defmacro defmethod defmulti defn defn- defonce defstruct delay delay? deliver deref derive descendants destructure disj disj! dissoc dissoc! distinct distinct? doall doc dorun doseq dosync dotimes doto double double-array doubles drop drop-last drop-while empty empty? ensure enumeration-seq eval even? every? false? ffirst file-seq filter find find-doc find-ns find-var first float float-array float? floats flush fn fn? fnext for force format future future-call future-cancel future-cancelled? future-done? future? gen-class gen-interface gensym get get-in get-method get-proxy-class get-thread-bindings get-validator hash hash-map hash-set identical? identity if-let if-not ifn? import in-ns inc init-proxy instance? int int-array integer? interleave intern interpose into into-array ints io! isa? iterate iterator-seq juxt key keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list list* list? load load-file load-reader load-string loaded-libs locking long long-array longs loop macroexpand macroexpand-1 make-array make-hierarchy map map? mapcat max max-key memfn memoize merge merge-with meta method-sig methods min min-key mod name namespace neg? newline next nfirst nil? nnext not not-any? not-empty not-every? not= ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? or parents partial partition pcalls peek persistent! pmap pop pop! pop-thread-bindings pos? pr pr-str prefer-method prefers primitives-classnames print print-ctor print-doc print-dup print-method print-namespace-doc print-simple print-special-doc print-str printf println println-str prn prn-str promise proxy proxy-call-with-super proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot rand rand-int range ratio? rational? rationalize re-find re-groups re-matcher re-matches re-pattern re-seq read read-line read-string reduce ref ref-history-count ref-max-history ref-min-history ref-set refer refer-clojure release-pending-sends rem remove remove-method remove-ns remove-watch repeat repeatedly replace replicate require reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq rsubseq second select-keys send send-off seq seq? seque sequence sequential? set set-validator! set? short short-array shorts shutdown-agents slurp some sort sort-by sorted-map sorted-map-by sorted-set sorted-set-by sorted? special-form-anchor special-symbol? split-at split-with str stream? string? struct struct-map subs subseq subvec supers swap! symbol symbol? sync syntax-symbol-anchor take take-last take-nth take-while test the-ns time to-array to-array-2d trampoline transient tree-seq true? type unchecked-add unchecked-dec unchecked-divide unchecked-inc unchecked-multiply unchecked-negate unchecked-remainder unchecked-subtract underive unquote unquote-splicing update-in update-proxy use val vals var-get var-set var? vary-meta vec vector vector? when when-first when-let when-not while with-bindings with-bindings* with-in-str with-loading-context with-local-vars with-meta with-open with-out-str with-precision xml-seq zero? zipmap\",t=\"throw try var def do fn if let loop monitor-enter monitor-exit new quote recur set!\",n=\"true false nil\",r=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"support.function\":e},\"identifier\",!1,\" \");this.$rules={start:[{token:\"comment\",regex:\";.*$\"},{token:\"keyword\",regex:\"[\\\\(|\\\\)]\"},{token:\"keyword\",regex:\"[\\\\'\\\\(]\"},{token:\"keyword\",regex:\"[\\\\[|\\\\]]\"},{token:\"keyword\",regex:\"[\\\\{|\\\\}|\\\\#\\\\{|\\\\#\\\\}]\"},{token:\"keyword\",regex:\"[\\\\&]\"},{token:\"keyword\",regex:\"[\\\\#\\\\^\\\\{]\"},{token:\"keyword\",regex:\"[\\\\%]\"},{token:\"keyword\",regex:\"[@]\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language\",regex:\"[!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+||=|!=|<=|>=|<>|<|>|!|&&]\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$\\\\-]*\\\\b\"},{token:\"string\",regex:'\"',next:\"string\"},{token:\"constant\",regex:/:[^()\\[\\]{}'\"\\^%`,;\\s]+/},{token:\"string.regexp\",regex:'/#\"(?:\\\\.|(?:\\\\\")|[^\"\"\\n])*\"/g'}],string:[{token:\"constant.language.escape\",regex:\"\\\\\\\\.|\\\\\\\\$\"},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:'\"',next:\"start\"}]}};r.inherits(s,i),t.ClojureHighlightRules=s}),define(\"ace/mode/matching_parens_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\)/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\))/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){var t=e.match(/^(\\s+)/);return t?t[1]:\"\"}}).call(i.prototype),t.MatchingParensOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-cobol.js",
    "content": "define(\"ace/mode/cobol\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/cobol_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./cobol_highlight_rules\").CobolHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"*\",this.$id=\"ace/mode/cobol\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/cobol_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT\",t=\"true|false|null\",n=\"count|min|max|avg|sum|rank|now|coalesce|main\",r=this.createKeywordMapper({\"support.function\":n,keyword:e,\"constant.language\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\*.*$\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|%|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.CobolHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-coffee.js",
    "content": "define(\"ace/mode/coffee\",[\"require\",\"exports\",\"module\",\"ace/mode/coffee_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/folding/coffee\",\"ace/range\",\"ace/mode/text\",\"ace/worker/worker_client\",\"ace/lib/oop\"],function(e,t,n){function l(){this.HighlightRules=r,this.$outdent=new i,this.foldingRules=new s}var r=e(\"./coffee_highlight_rules\").CoffeeHighlightRules,i=e(\"./matching_brace_outdent\").MatchingBraceOutdent,s=e(\"./folding/coffee\").FoldMode,o=e(\"../range\").Range,u=e(\"./text\").Mode,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"../lib/oop\");f.inherits(l,u),function(){var e=/(?:[({[=:]|[-=]>|\\b(?:else|try|(?:swi|ca)tch(?:\\s+[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*)?|finally))\\s*$|^\\s*(else\\b\\s*)?(?:if|for|while|loop)\\b(?!.*\\bthen\\b)/,t=/^(\\s*)#/,n=/^\\s*###(?!#)/,r=/^\\s*/;this.getNextLineIndent=function(t,n,r){var i=this.$getIndent(n),s=this.getTokenizer().getLineTokens(n,t).tokens;return(!s.length||s[s.length-1].type!==\"comment\")&&t===\"start\"&&e.test(n)&&(i+=r),i},this.toggleCommentLines=function(e,i,s,u){console.log(\"toggle\");var a=new o(0,0,0,0);for(var f=s;f<=u;++f){var l=i.getLine(f);if(n.test(l))continue;t.test(l)?l=l.replace(t,\"$1\"):l=l.replace(r,\"$&#\"),a.end.row=a.start.row=f,a.end.column=l.length+1,i.replace(a,l)}},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/coffee_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"error\",function(t){e.setAnnotations([t.data])}),t.on(\"ok\",function(t){e.clearAnnotations()}),t},this.$id=\"ace/mode/coffee\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/coffee_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){function s(){var e=\"[$A-Za-z_\\\\x7f-\\\\uffff][$\\\\w\\\\x7f-\\\\uffff]*\",t=\"this|throw|then|try|typeof|super|switch|return|break|by|continue|catch|class|in|instanceof|is|isnt|if|else|extends|for|own|finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|or|on|unless|until|and|yes\",n=\"true|false|null|undefined|NaN|Infinity\",r=\"case|const|default|function|var|void|with|enum|export|implements|interface|let|package|private|protected|public|static|yield|__hasProp|slice|bind|indexOf\",i=\"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray\",s=\"Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|encodeURIComponent|decodeURI|decodeURIComponent|String|\",o=\"window|arguments|prototype|document\",u=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"invalid.illegal\":r,\"language.support.class\":i,\"language.support.function\":s,\"variable.language\":o},\"identifier\"),a={token:[\"paren.lparen\",\"variable.parameter\",\"paren.rparen\",\"text\",\"storage.type\"],regex:/(?:(\\()((?:\"[^\")]*?\"|'[^')]*?'|\\/[^\\/)]*?\\/|[^()\\\"'\\/])*?)(\\))(\\s*))?([\\-=]>)/.source},f=/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;this.$rules={start:[{token:\"constant.numeric\",regex:\"(?:0x[\\\\da-fA-F]+|(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:[eE][+-]?\\\\d+)?)\"},{stateName:\"qdoc\",token:\"string\",regex:\"'''\",next:[{token:\"string\",regex:\"'''\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qqdoc\",token:\"string\",regex:'\"\"\"',next:[{token:\"string\",regex:'\"\"\"',next:\"start\"},{token:\"paren.string\",regex:\"#{\",push:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qstring\",token:\"string\",regex:\"'\",next:[{token:\"string\",regex:\"'\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qqstring\",token:\"string.start\",regex:'\"',next:[{token:\"string.end\",regex:'\"',next:\"start\"},{token:\"paren.string\",regex:\"#{\",push:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"js\",token:\"string\",regex:\"`\",next:[{token:\"string\",regex:\"`\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{regex:\"[{}]\",onMatch:function(e,t,n){this.next=\"\";if(e==\"{\"&&n.length)return n.unshift(\"start\",t),\"paren\";if(e==\"}\"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf(\"string\")!=-1)return\"paren.string\"}return\"paren\"}},{token:\"string.regex\",regex:\"///\",next:\"heregex\"},{token:\"string.regex\",regex:/(?:\\/(?![\\s=])[^[\\/\\n\\\\]*(?:(?:\\\\[\\s\\S]|\\[[^\\]\\n\\\\]*(?:\\\\[\\s\\S][^\\]\\n\\\\]*)*])[^[\\/\\n\\\\]*)*\\/)(?:[imgy]{0,4})(?!\\w)/},{token:\"comment\",regex:\"###(?!#)\",next:\"comment\"},{token:\"comment\",regex:\"#.*\"},{token:[\"punctuation.operator\",\"text\",\"identifier\"],regex:\"(\\\\.)(\\\\s*)(\"+r+\")\"},{token:\"punctuation.operator\",regex:\"\\\\.\"},{token:[\"keyword\",\"text\",\"language.support.class\",\"text\",\"keyword\",\"text\",\"language.support.class\"],regex:\"(class)(\\\\s+)(\"+e+\")(?:(\\\\s+)(extends)(\\\\s+)(\"+e+\"))?\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\"].concat(a.token),regex:\"(\"+e+\")(\\\\s*)([=:])(\\\\s*)\"+a.regex},a,{token:\"variable\",regex:\"@(?:\"+e+\")?\"},{token:u,regex:e},{token:\"punctuation.operator\",regex:\"\\\\,|\\\\.\"},{token:\"storage.type\",regex:\"[\\\\-=]>\"},{token:\"keyword.operator\",regex:\"(?:[-+*/%<>&|^!?=]=|>>>=?|\\\\-\\\\-|\\\\+\\\\+|::|&&=|\\\\|\\\\|=|<<=|>>=|\\\\?\\\\.|\\\\.{2,3}|[!*+-=><])\"},{token:\"paren.lparen\",regex:\"[({[]\"},{token:\"paren.rparen\",regex:\"[\\\\]})]\"},{token:\"text\",regex:\"\\\\s+\"}],heregex:[{token:\"string.regex\",regex:\".*?///[imgy]{0,4}\",next:\"start\"},{token:\"comment.regex\",regex:\"\\\\s+(?:#.*)?\"},{token:\"string.regex\",regex:\"\\\\S+\"}],comment:[{token:\"comment\",regex:\"###\",next:\"start\"},{defaultToken:\"comment\"}]},this.normalizeRules()}var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules;r.inherits(s,i),t.CoffeeHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-coldfusion.js",
    "content": "define(\"ace/mode/coldfusion\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/html\",\"ace/mode/coldfusion_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./html\").Mode,o=e(\"./coldfusion_highlight_rules\").ColdfusionHighlightRules,u=\"cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)\".split(\"|\"),a=function(){s.call(this),this.HighlightRules=o};r.inherits(a,s),function(){this.voidElements=r.mixin(i.arrayToMap(u),this.voidElements),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.$id=\"ace/mode/coldfusion\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/coldfusion_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,s=e(\"./html_highlight_rules\").HtmlHighlightRules,o=function(){s.call(this),this.embedTagRules(i,\"cfjs-\",\"cfscript\"),this.normalizeRules()};r.inherits(o,s),t.ColdfusionHighlightRules=o}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-csharp.js",
    "content": "define(\"ace/mode/csharp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/csharp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/csharp\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./csharp_highlight_rules\").CSharpHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/csharp\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){return null},this.$id=\"ace/mode/csharp\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/csharp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"this\",keyword:\"abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic\",\"constant.language\":\"null|true|false\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:/'(?:.|\\\\(:?u[\\da-fA-F]+|x[\\da-fA-F]+|[tbrf'\"n]))'/},{token:\"string\",start:'\"',end:'\"|$',next:[{token:\"constant.language.escape\",regex:/\\\\(:?u[\\da-fA-F]+|x[\\da-fA-F]+|[tbrf'\"n])/},{token:\"invalid\",regex:/\\\\./}]},{token:\"string\",start:'@\"',end:'\"',next:[{token:\"constant.language.escape\",regex:'\"\"'}]},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"keyword\",regex:\"^\\\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")]),this.normalizeRules()};r.inherits(o,s),t.CSharpHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/csharp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./cstyle\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.usingRe=/^\\s*using \\S/,this.getFoldWidgetRangeBase=this.getFoldWidgetRange,this.getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=this.getFoldWidgetBase(e,t,n);if(!r){var i=e.getLine(n);if(/^\\s*#region\\b/.test(i))return\"start\";var s=this.usingRe;if(s.test(i)){var o=e.getLine(n-1),u=e.getLine(n+1);if(!s.test(o)&&s.test(u))return\"start\"}}return r},this.getFoldWidgetRange=function(e,t,n){var r=this.getFoldWidgetRangeBase(e,t,n);if(r)return r;var i=e.getLine(n);if(this.usingRe.test(i))return this.getUsingStatementBlock(e,i,n);if(/^\\s*#region\\b/.test(i))return this.getRegionBlock(e,i,n)},this.getUsingStatementBlock=function(e,t,n){var r=t.match(this.usingRe)[0].length-1,s=e.getLength(),o=n,u=n;while(++n<s){t=e.getLine(n);if(/^\\s*$/.test(t))continue;if(!this.usingRe.test(t))break;u=n}if(u>o){var a=e.getLine(u).length;return new i(o,r,u,a)}},this.getRegionBlock=function(e,t,n){var r=t.search(/\\s*$/),s=e.getLength(),o=n,u=/^\\s*#(end)?region\\b/,a=1;while(++n<s){t=e.getLine(n);var f=u.exec(t);if(!f)continue;f[1]?a--:a++;if(!a)break}var l=n;if(l>o){var c=t.search(/\\S/);return new i(o,r,l,c)}}}.call(o.prototype)}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-css.js",
    "content": "define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-curly.js",
    "content": "define(\"ace/mode/curly\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/matching_brace_outdent\",\"ace/mode/html_highlight_rules\",\"ace/mode/folding/html\",\"ace/mode/curly_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./matching_brace_outdent\").MatchingBraceOutdent,o=e(\"./html_highlight_rules\").HtmlHighlightRules,u=e(\"./folding/html\").FoldMode,a=e(\"./curly_highlight_rules\").CurlyHighlightRules,f=function(){i.call(this),this.HighlightRules=a,this.$outdent=new s,this.foldingRules=new u};r.inherits(f,i),function(){this.$id=\"ace/mode/curly\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/curly_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=function(){i.call(this),this.$rules.start.unshift({token:\"variable\",regex:\"{{\",push:\"curly-start\"}),this.$rules[\"curly-start\"]=[{token:\"variable\",regex:\"}}\",next:\"pop\"}],this.normalizeRules()};r.inherits(s,i),t.CurlyHighlightRules=s}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-d.js",
    "content": "define(\"ace/mode/d\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/d_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./d_highlight_rules\").DHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"/\\\\+\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/d\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/d_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"this|super|import|module|body|mixin|__traits|invariant|alias|asm|delete|typeof|typeid|sizeof|cast|new|in|is|typedef|__vector|__parameters\",t=\"break|case|continue|default|do|else|for|foreach|foreach_reverse|goto|if|return|switch|while|catch|try|throw|finally|version|assert|unittest|with\",n=\"auto|bool|char|dchar|wchar|byte|ubyte|float|double|real|cfloat|creal|cdouble|cent|ifloat|ireal|idouble|int|long|short|void|uint|ulong|ushort|ucent|function|delegate|string|wstring|dstring|size_t|ptrdiff_t|hash_t|Object\",r=\"abstract|align|debug|deprecated|export|extern|const|final|in|inout|out|ref|immutable|lazy|nothrow|override|package|pragma|private|protected|public|pure|scope|shared|__gshared|synchronized|static|volatile\",s=\"class|struct|union|template|interface|enum|macro\",o={token:\"constant.language.escape\",regex:\"\\\\\\\\(?:(?:x[0-9A-F]{2})|(?:[0-7]{1,3})|(?:['\\\"\\\\?0abfnrtv\\\\\\\\])|(?:u[0-9a-fA-F]{4})|(?:U[0-9a-fA-F]{8}))\"},u=\"null|true|false|__DATE__|__EOF__|__TIME__|__TIMESTAMP__|__VENDOR__|__VERSION__|__FILE__|__MODULE__|__LINE__|__FUNCTION__|__PRETTY_FUNCTION__\",a=\"/|/\\\\=|&|&\\\\=|&&|\\\\|\\\\|\\\\=|\\\\|\\\\||\\\\-|\\\\-\\\\=|\\\\-\\\\-|\\\\+|\\\\+\\\\=|\\\\+\\\\+|\\\\<|\\\\<\\\\=|\\\\<\\\\<|\\\\<\\\\<\\\\=|\\\\<\\\\>|\\\\<\\\\>\\\\=|\\\\>|\\\\>\\\\=|\\\\>\\\\>\\\\=|\\\\>\\\\>\\\\>\\\\=|\\\\>\\\\>|\\\\>\\\\>\\\\>|\\\\!|\\\\!\\\\=|\\\\!\\\\<\\\\>|\\\\!\\\\<\\\\>\\\\=|\\\\!\\\\<|\\\\!\\\\<\\\\=|\\\\!\\\\>|\\\\!\\\\>\\\\=|\\\\?|\\\\$|\\\\=|\\\\=\\\\=|\\\\*|\\\\*\\\\=|%|%\\\\=|\\\\^|\\\\^\\\\=|\\\\^\\\\^|\\\\^\\\\^\\\\=|~|~\\\\=|\\\\=\\\\>|#\",f=this.$keywords=this.createKeywordMapper({\"keyword.modifier\":r,\"keyword.control\":t,\"keyword.type\":n,keyword:e,\"keyword.storage\":s,punctation:\"\\\\.|\\\\,|;|\\\\.\\\\.|\\\\.\\\\.\\\\.\",\"keyword.operator\":a,\"constant.language\":u},\"identifier\"),l=\"[a-zA-Z_\\xa1-\\uffff][a-zA-Z\\\\d_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"star-comment\"},{token:\"comment.shebang\",regex:\"^s*#!.*\"},{token:\"comment\",regex:\"\\\\/\\\\+\",next:\"plus-comment\"},{onMatch:function(e,t,n){return n.unshift(this.next,e.substr(2)),\"string\"},regex:'q\"(?:[\\\\[\\\\(\\\\{\\\\<]+)',next:\"operator-heredoc-string\"},{onMatch:function(e,t,n){return n.unshift(this.next,e.substr(2)),\"string\"},regex:'q\"(?:[a-zA-Z_]+)$',next:\"identifier-heredoc-string\"},{token:\"string\",regex:'[xr]?\"',next:\"quote-string\"},{token:\"string\",regex:\"[xr]?`\",next:\"backtick-string\"},{token:\"string\",regex:\"[xr]?['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?['][cdw]?\"},{token:[\"keyword\",\"text\",\"paren.lparen\"],regex:/(asm)(\\s*)({)/,next:\"d-asm\"},{token:[\"keyword\",\"text\",\"paren.lparen\",\"constant.language\"],regex:\"(__traits)(\\\\s*)(\\\\()(\"+l+\")\"},{token:[\"keyword\",\"text\",\"variable.module\"],regex:\"(import|module)(\\\\s+)((?:\"+l+\"\\\\.?)*)\"},{token:[\"keyword.storage\",\"text\",\"entity.name.type\"],regex:\"(\"+s+\")(\\\\s*)(\"+l+\")\"},{token:[\"keyword\",\"text\",\"variable.storage\",\"text\"],regex:\"(alias|typedef)(\\\\s*)(\"+l+\")(\\\\s*)\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F_]+(l|ul|u|f|F|L|U|UL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d[\\\\d_]*(?:(?:\\\\.[\\\\d_]*)?(?:[eE][+-]?[\\\\d_]+)?)?(l|ul|u|f|F|L|U|UL)?\\\\b\"},{token:\"entity.other.attribute-name\",regex:\"@\"+l},{token:f,regex:\"[a-zA-Z_][a-zA-Z0-9_]*\\\\b\"},{token:\"keyword.operator\",regex:a},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.|\\\\:\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],\"star-comment\":[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],\"plus-comment\":[{token:\"comment\",regex:\"\\\\+\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],\"quote-string\":[o,{token:\"string\",regex:'\"[cdw]?',next:\"start\"},{defaultToken:\"string\"}],\"backtick-string\":[o,{token:\"string\",regex:\"`[cdw]?\",next:\"start\"},{defaultToken:\"string\"}],\"operator-heredoc-string\":[{onMatch:function(e,t,n){e=e.substring(e.length-2,e.length-1);var r={\">\":\"<\",\"]\":\"[\",\")\":\"(\",\"}\":\"{\"};return Object.keys(r).indexOf(e)!=-1&&(e=r[e]),e!=n[1]?\"string\":(n.shift(),n.shift(),\"string\")},regex:'(?:[\\\\]\\\\)}>]+)\"',next:\"start\"},{token:\"string\",regex:\"[^\\\\]\\\\)}>]+\"}],\"identifier-heredoc-string\":[{onMatch:function(e,t,n){return e=e.substring(0,e.length-1),e!=n[1]?\"string\":(n.shift(),n.shift(),\"string\")},regex:'^(?:[A-Za-z_][a-zA-Z0-9]+)\"',next:\"start\"},{token:\"string\",regex:\"[^\\\\]\\\\)}>]+\"}],\"d-asm\":[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"start\"},{token:\"keyword.instruction\",regex:\"[a-zA-Z]+\",next:\"d-asm-instruction\"},{token:\"text\",regex:\"\\\\s+\"}],\"d-asm-instruction\":[{token:\"constant.language\",regex:/AL|AH|AX|EAX|BL|BH|BX|EBX|CL|CH|CX|ECX|DL|DH|DX|EDX|BP|EBP|SP|ESP|DI|EDI|SI|ESI/i},{token:\"identifier\",regex:\"[a-zA-Z]+\"},{token:\"string\",regex:'\".*\"'},{token:\"comment\",regex:\"//.*$\"},{token:\"constant.numeric\",regex:\"[0-9.xA-F]+\"},{token:\"punctuation.operator\",regex:\"\\\\,\"},{token:\"punctuation.operator\",regex:\";\",next:\"d-asm\"},{token:\"text\",regex:\"\\\\s+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};o.metaData={comment:\"D language\",fileTypes:[\"d\",\"di\"],firstLineMatch:\"^#!.*\\\\b[glr]?dmd\\\\b.\",foldingStartMarker:\"(?x)/\\\\*\\\\*(?!\\\\*)|^(?![^{]*?//|[^{]*?/\\\\*(?!.*?\\\\*/.*?\\\\{)).*?\\\\{\\\\s*($|//|/\\\\*(?!.*?\\\\*/.*\\\\S))\",foldingStopMarker:\"(?<!\\\\*)\\\\*\\\\*/|^\\\\s*\\\\}\",keyEquivalent:\"^~D\",name:\"D\",scopeName:\"source.d\"},r.inherits(o,s),t.DHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-dart.js",
    "content": "define(\"ace/mode/dart\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/c_cpp\",\"ace/mode/dart_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./c_cpp\").Mode,s=e(\"./dart_highlight_rules\").DartHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){i.call(this),this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/dart\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/c_cpp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c_cpp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c_cpp\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/dart_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"true|false|null\",t=\"this|super\",n=\"try|catch|finally|throw|rethrow|assert|break|case|continue|default|do|else|for|if|in|return|switch|while|new\",r=\"abstract|class|extends|external|factory|implements|get|native|operator|set|typedef|with\",s=\"static|final|const\",o=\"void|bool|num|int|double|dynamic|var|String\",u=this.createKeywordMapper({\"constant.language.dart\":e,\"variable.language.dart\":t,\"keyword.control.dart\":n,\"keyword.declaration.dart\":r,\"storage.modifier.dart\":s,\"storage.type.primitive.dart\":o},\"identifier\"),a={token:\"string\",regex:\".+\"};this.$rules={start:[{token:\"comment\",regex:/\\/\\/.*$/},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:[\"meta.preprocessor.script.dart\"],regex:\"^(#!.*)$\"},{token:\"keyword.other.import.dart\",regex:\"(?:\\\\b)(?:library|import|part|of)(?:\\\\b)\"},{token:[\"keyword.other.import.dart\",\"text\"],regex:\"(?:\\\\b)(prefix)(\\\\s*:)\"},{regex:\"\\\\bas\\\\b\",token:\"keyword.cast.dart\"},{regex:\"\\\\?|:\",token:\"keyword.control.ternary.dart\"},{regex:\"(?:\\\\b)(is\\\\!?)(?:\\\\b)\",token:[\"keyword.operator.dart\"]},{regex:\"(<<|>>>?|~|\\\\^|\\\\||&)\",token:[\"keyword.operator.bitwise.dart\"]},{regex:\"((?:&|\\\\^|\\\\||<<|>>>?)=)\",token:[\"keyword.operator.assignment.bitwise.dart\"]},{regex:\"(===?|!==?|<=?|>=?)\",token:[\"keyword.operator.comparison.dart\"]},{regex:\"((?:[+*/%-]|\\\\~)=)\",token:[\"keyword.operator.assignment.arithmetic.dart\"]},{regex:\"=\",token:\"keyword.operator.assignment.dart\"},{token:\"string\",regex:\"'''\",next:\"qdoc\"},{token:\"string\",regex:'\"\"\"',next:\"qqdoc\"},{token:\"string\",regex:\"'\",next:\"qstring\"},{token:\"string\",regex:'\"',next:\"qqstring\"},{regex:\"(\\\\-\\\\-|\\\\+\\\\+)\",token:[\"keyword.operator.increment-decrement.dart\"]},{regex:\"(\\\\-|\\\\+|\\\\*|\\\\/|\\\\~\\\\/|%)\",token:[\"keyword.operator.arithmetic.dart\"]},{regex:\"(!|&&|\\\\|\\\\|)\",token:[\"keyword.operator.logical.dart\"]},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qdoc:[{token:\"string\",regex:\".*?'''\",next:\"start\"},a],qqdoc:[{token:\"string\",regex:'.*?\"\"\"',next:\"start\"},a],qstring:[{token:\"string\",regex:\"[^\\\\\\\\']*(?:\\\\\\\\.[^\\\\\\\\']*)*'\",next:\"start\"},a],qqstring:[{token:\"string\",regex:'[^\\\\\\\\\"]*(?:\\\\\\\\.[^\\\\\\\\\"]*)*\"',next:\"start\"},a]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.DartHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-diff.js",
    "content": "define(\"ace/mode/diff\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/diff_highlight_rules\",\"ace/mode/folding/diff\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./diff_highlight_rules\").DiffHighlightRules,o=e(\"./folding/diff\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o([\"diff\",\"index\",\"\\\\+{3}\",\"@@|\\\\*{5}\"],\"i\")};r.inherits(u,i),function(){this.$id=\"ace/mode/diff\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/diff_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{regex:\"^(?:\\\\*{15}|={67}|-{3}|\\\\+{3})$\",token:\"punctuation.definition.separator.diff\",name:\"keyword\"},{regex:\"^(@@)(\\\\s*.+?\\\\s*)(@@)(.*)$\",token:[\"constant\",\"constant.numeric\",\"constant\",\"comment.doc.tag\"]},{regex:\"^(\\\\d+)([,\\\\d]+)(a|d|c)(\\\\d+)([,\\\\d]+)(.*)$\",token:[\"constant.numeric\",\"punctuation.definition.range.diff\",\"constant.function\",\"constant.numeric\",\"punctuation.definition.range.diff\",\"invalid\"],name:\"meta.\"},{regex:\"^(\\\\-{3}|\\\\+{3}|\\\\*{3})( .+)$\",token:[\"constant.numeric\",\"meta.tag\"]},{regex:\"^([!+>])(.*?)(\\\\s*)$\",token:[\"support.constant\",\"text\",\"invalid\"]},{regex:\"^([<\\\\-])(.*?)(\\\\s*)$\",token:[\"support.function\",\"string\",\"invalid\"]},{regex:\"^(diff)(\\\\s+--\\\\w+)?(.+?)( .+)?$\",token:[\"variable\",\"variable\",\"keyword\",\"variable\"]},{regex:\"^Index.+$\",token:\"variable\"},{regex:\"^\\\\s+$\",token:\"text\"},{regex:\"\\\\s*$\",token:\"invalid\"},{defaultToken:\"invisible\",caseInsensitive:!0}]}};r.inherits(s,i),t.DiffHighlightRules=s}),define(\"ace/mode/folding/diff\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(e,t){this.regExpList=e,this.flag=t,this.foldingStartMarker=RegExp(\"^(\"+e.join(\"|\")+\")\",this.flag)};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i={row:n,column:r.length},o=this.regExpList;for(var u=1;u<=o.length;u++){var a=RegExp(\"^(\"+o.slice(0,u).join(\"|\")+\")\",this.flag);if(a.test(r))break}for(var f=e.getLength();++n<f;){r=e.getLine(n);if(a.test(r))break}if(n==i.row+1)return;return s.fromPoints(i,{row:n-1,column:r.length})}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-django.js",
    "content": "define(\"ace/mode/django\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/html_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./html_highlight_rules\").HtmlHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){this.$rules={start:[{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant\",regex:\"[0-9]+\"},{token:\"variable\",regex:\"[-_a-zA-Z0-9:]+\"}],comment:[{token:\"comment.block\",merge:!0,regex:\".+?\"}],tag:[{token:\"entity.name.function\",regex:\"[a-zA-Z][_a-zA-Z0-9]*\",next:\"start\"}]}};r.inherits(u,o);var a=function(){this.$rules=(new s).getRules();for(var e in this.$rules)this.$rules[e].unshift({token:\"comment.line\",regex:\"\\\\{#.*?#\\\\}\"},{token:\"comment.block\",regex:\"\\\\{\\\\%\\\\s*comment\\\\s*\\\\%\\\\}\",merge:!0,next:\"django-comment\"},{token:\"constant.language\",regex:\"\\\\{\\\\{\",next:\"django-start\"},{token:\"constant.language\",regex:\"\\\\{\\\\%\",next:\"django-tag\"}),this.embedRules(u,\"django-\",[{token:\"comment.block\",regex:\"\\\\{\\\\%\\\\s*endcomment\\\\s*\\\\%\\\\}\",merge:!0,next:\"start\"},{token:\"constant.language\",regex:\"\\\\%\\\\}\",next:\"start\"},{token:\"constant.language\",regex:\"\\\\}\\\\}\",next:\"start\"}])};r.inherits(a,s);var f=function(){i.call(this),this.HighlightRules=a};r.inherits(f,i),function(){this.$id=\"ace/mode/django\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-dockerfile.js",
    "content": "define(\"ace/mode/dockerfile\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/sh\",\"ace/mode/dockerfile_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./sh\").Mode,s=e(\"./dockerfile_highlight_rules\").DockerfileHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){i.call(this),this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.$id=\"ace/mode/dockerfile\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/sh\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/sh_highlight_rules\",\"ace/range\",\"ace/mode/folding/cstyle\",\"ace/mode/behaviour/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./sh_highlight_rules\").ShHighlightRules,o=e(\"../range\").Range,u=e(\"./folding/cstyle\").FoldMode,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=function(){this.HighlightRules=s,this.foldingRules=new u,this.$behaviour=new a};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);o&&(r+=n)}return r};var e={pass:1,\"return\":1,raise:1,\"break\":1,\"continue\":1};this.checkOutdent=function(t,n,r){if(r!==\"\\r\\n\"&&r!==\"\\r\"&&r!==\"\\n\")return!1;var i=this.getTokenizer().getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type==\"comment\"||s.type==\"text\"&&s.value.match(/^\\s+$/)));return s?s.type==\"keyword\"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new o(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/sh\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/sh_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.reservedKeywords=\"!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set\",o=t.languageConstructs=\"[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait\",u=function(){var e=this.createKeywordMapper({keyword:s,\"support.function.builtin\":o,\"invalid.deprecated\":\"debugger\"},\"identifier\"),t=\"(?:(?:[1-9]\\\\d*)|(?:0))\",n=\"(?:\\\\.\\\\d+)\",r=\"(?:\\\\d+)\",i=\"(?:(?:\"+r+\"?\"+n+\")|(?:\"+r+\"\\\\.))\",u=\"(?:(?:\"+i+\"|\"+r+\")\"+\")\",a=\"(?:\"+u+\"|\"+i+\")\",f=\"(?:&\"+r+\")\",l=\"[a-zA-Z_][a-zA-Z0-9_]*\",c=\"(?:(?:\\\\$\"+l+\")|(?:\"+l+\"=))\",h=\"(?:\\\\$(?:SHLVL|\\\\$|\\\\!|\\\\?))\",p=\"(?:\"+l+\"\\\\s*\\\\(\\\\))\";this.$rules={start:[{token:\"constant\",regex:/\\\\./},{token:[\"text\",\"comment\"],regex:/(^|\\s)(#.*)$/},{token:\"string\",regex:'\"',push:[{token:\"constant.language.escape\",regex:/\\\\(?:[$abeEfnrtv\\\\'\"]|x[a-fA-F\\d]{1,2}|u[a-fA-F\\d]{4}([a-fA-F\\d]{4})?|c.|\\d{1,3})/},{token:\"constant\",regex:/\\$\\w+/},{token:\"string\",regex:'\"',next:\"pop\"},{defaultToken:\"string\"}]},{token:\"variable.language\",regex:h},{token:\"variable\",regex:c},{token:\"support.function\",regex:p},{token:\"support.function\",regex:f},{token:\"string\",start:\"'\",end:\"'\"},{token:\"constant.numeric\",regex:a},{token:\"constant.numeric\",regex:t+\"\\\\b\"},{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|~|<|>|<=|=>|=|!=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"}]},this.normalizeRules()};r.inherits(u,i),t.ShHighlightRules=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/dockerfile_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/sh_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./sh_highlight_rules\").ShHighlightRules,s=function(){i.call(this);var e=this.$rules.start;for(var t=0;t<e.length;t++)if(e[t].token==\"variable.language\"){e.splice(t,0,{token:\"variable.language\",regex:\"(?:^(?:FROM|MAINTAINER|RUN|CMD|EXPOSE|ENV|ADD|ENTRYPOINT|VOLUME|USER|WORKDIR|ONBUILD)\\\\b)\",caseInsensitive:!0});break}};r.inherits(s,i),t.DockerfileHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-dot.js",
    "content": "define(\"ace/mode/dot\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/matching_brace_outdent\",\"ace/mode/dot_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./matching_brace_outdent\").MatchingBraceOutdent,o=e(\"./dot_highlight_rules\").DotHighlightRules,u=e(\"./folding/cstyle\").FoldMode,a=function(){this.HighlightRules=o,this.$outdent=new s,this.foldingRules=new u};r.inherits(a,i),function(){this.lineCommentStart=[\"//\",\"#\"],this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/dot\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/dot_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/doc_comment_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,u=function(){var e=i.arrayToMap(\"strict|node|edge|graph|digraph|subgraph\".split(\"|\")),t=i.arrayToMap(\"damping|k|url|area|arrowhead|arrowsize|arrowtail|aspect|bb|bgcolor|center|charset|clusterrank|color|colorscheme|comment|compound|concentrate|constraint|decorate|defaultdist|dim|dimen|dir|diredgeconstraints|distortion|dpi|edgeurl|edgehref|edgetarget|edgetooltip|epsilon|esep|fillcolor|fixedsize|fontcolor|fontname|fontnames|fontpath|fontsize|forcelabels|gradientangle|group|headurl|head_lp|headclip|headhref|headlabel|headport|headtarget|headtooltip|height|href|id|image|imagepath|imagescale|label|labelurl|label_scheme|labelangle|labeldistance|labelfloat|labelfontcolor|labelfontname|labelfontsize|labelhref|labeljust|labelloc|labeltarget|labeltooltip|landscape|layer|layerlistsep|layers|layerselect|layersep|layout|len|levels|levelsgap|lhead|lheight|lp|ltail|lwidth|margin|maxiter|mclimit|mindist|minlen|mode|model|mosek|nodesep|nojustify|normalize|nslimit|nslimit1|ordering|orientation|outputorder|overlap|overlap_scaling|pack|packmode|pad|page|pagedir|pencolor|penwidth|peripheries|pin|pos|quadtree|quantum|rank|rankdir|ranksep|ratio|rects|regular|remincross|repulsiveforce|resolution|root|rotate|rotation|samehead|sametail|samplepoints|scale|searchsize|sep|shape|shapefile|showboxes|sides|size|skew|smoothing|sortv|splines|start|style|stylesheet|tailurl|tail_lp|tailclip|tailhref|taillabel|tailport|tailtarget|tailtooltip|target|tooltip|truecolor|vertices|viewport|voro_margin|weight|width|xlabel|xlp|z\".split(\"|\"));this.$rules={start:[{token:\"comment\",regex:/\\/\\/.*$/},{token:\"comment\",regex:/#.*$/},{token:\"comment\",merge:!0,regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/[+\\-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?)?\\b/},{token:\"keyword.operator\",regex:/\\+|=|\\->/},{token:\"punctuation.operator\",regex:/,|;/},{token:\"paren.lparen\",regex:/[\\[{]/},{token:\"paren.rparen\",regex:/[\\]}]/},{token:\"comment\",regex:/^#!.*$/},{token:function(n){return e.hasOwnProperty(n.toLowerCase())?\"keyword\":t.hasOwnProperty(n.toLowerCase())?\"variable\":\"text\"},regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",merge:!0,next:\"start\"},{token:\"comment\",merge:!0,regex:\".+\"}],qqstring:[{token:\"string\",regex:'[^\"\\\\\\\\]+',merge:!0},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\",merge:!0},{token:\"string\",regex:'\"|$',next:\"start\",merge:!0}],qstring:[{token:\"string\",regex:\"[^'\\\\\\\\]+\",merge:!0},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\",merge:!0},{token:\"string\",regex:\"'|$\",next:\"start\",merge:!0}]}};r.inherits(u,s),t.DotHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ejs.js",
    "content": "define(\"ace/mode/ejs\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/html\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/ruby\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=function(e,t){i.call(this),e||(e=\"(?:<%|<\\\\?|{{)\"),t||(t=\"(?:%>|\\\\?>|}})\");for(var n in this.$rules)this.$rules[n].unshift({token:\"markup.list.meta.tag\",regex:e+\"(?![>}])[-=]?\",push:\"ejs-start\"});this.embedRules(s,\"ejs-\"),this.$rules[\"ejs-start\"].unshift({token:\"markup.list.meta.tag\",regex:\"-?\"+t,next:\"pop\"},{token:\"comment\",regex:\"//.*?\"+t,next:\"pop\"}),this.$rules[\"ejs-no_regex\"].unshift({token:\"markup.list.meta.tag\",regex:\"-?\"+t,next:\"pop\"},{token:\"comment\",regex:\"//.*?\"+t,next:\"pop\"}),this.normalizeRules()};r.inherits(o,i),t.EjsHighlightRules=o;var r=e(\"../lib/oop\"),u=e(\"./html\").Mode,a=e(\"./javascript\").Mode,f=e(\"./css\").Mode,l=e(\"./ruby\").Mode,c=function(){u.call(this),this.HighlightRules=o,this.createModeDelegates({\"js-\":a,\"css-\":f,\"ejs-\":a})};r.inherits(c,u),function(){this.$id=\"ace/mode/ejs\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/ruby\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ruby_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ruby_highlight_rules\").RubyHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./folding/coffee\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/),u=t.match(/^\\s*(class|def|module)\\s.*$/),a=t.match(/.*do(\\s*|\\s+\\|.*\\|\\s*)$/),f=t.match(/^\\s*(if|else)\\s*/);if(o||u||a||f)r+=n}return r},this.checkOutdent=function(e,t,n){return/^\\s+end$/.test(t+n)||/^\\s+}$/.test(t+n)||/^\\s+else$/.test(t+n)},this.autoOutdent=function(e,t,n){var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new u(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/ruby\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/ruby_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.constantOtherSymbol={token:\"constant.other.symbol.ruby\",regex:\"[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?\"},o=t.qString={token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},u=t.qqString={token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},a=t.tString={token:\"string\",regex:\"[`](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[`]\"},f=t.constantNumericHex={token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\\\b\"},l=t.constantNumericFloat={token:\"constant.numeric\",regex:\"[+-]?\\\\d(?:\\\\d|_(?=\\\\d))*(?:(?:\\\\.\\\\d(?:\\\\d|_(?=\\\\d))*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},c=function(){var e=\"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|validates_inclusion_of|validates_numericality_of|validates_with|validates_each|authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|cache|expire_fragment|expire_cache_for|observe|cache_sweeper|has_many|has_one|belongs_to|has_and_belongs_to_many\",t=\"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield\",n=\"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING\",r=\"$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|$!|root_url|flash|session|cookies|params|request|response|logger|self\",i=this.$keywords=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"variable.language\":r,\"support.function\":e,\"invalid.deprecated\":\"debugger\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"comment\",regex:\"^=begin(?:$|\\\\s.*$)\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},o,u,a,{token:\"text\",regex:\"::\"},{token:\"variable.instance\",regex:\"@{1,2}[a-zA-Z_\\\\d]+\"},{token:\"support.class\",regex:\"[A-Z][a-zA-Z_\\\\d]+\"},s,f,l,{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"punctuation.separator.key-value\",regex:\"=>\"},{stateName:\"heredoc\",onMatch:function(e,t,n){var r=e[2]==\"-\"?\"indentedHeredoc\":\"heredoc\",i=e.split(this.splitRegex);return n.push(r,i[3]),[{type:\"constant\",value:i[1]},{type:\"string\",value:i[2]},{type:\"support.class\",value:i[3]},{type:\"string\",value:i[4]}]},regex:\"(<<-?)(['\\\"`]?)([\\\\w]+)(['\\\"`]?)\",rules:{heredoc:[{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}],indentedHeredoc:[{token:\"string\",regex:\"^ +\"},{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}]}},{regex:\"$\",token:\"empty\",next:function(e,t){return t[0]===\"heredoc\"||t[0]===\"indentedHeredoc\"?t[0]:e}},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\"^=end(?:$|\\\\s.*$)\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.normalizeRules()};r.inherits(c,i),t.RubyHighlightRules=c}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-erlang.js",
    "content": "define(\"ace/mode/erlang\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/erlang_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./erlang_highlight_rules\").ErlangHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"%\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/erlang\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/erlang_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{include:\"#module-directive\"},{include:\"#import-export-directive\"},{include:\"#behaviour-directive\"},{include:\"#record-directive\"},{include:\"#define-directive\"},{include:\"#macro-directive\"},{include:\"#directive\"},{include:\"#function\"},{include:\"#everything-else\"}],\"#atom\":[{token:\"punctuation.definition.symbol.begin.erlang\",regex:\"'\",push:[{token:\"punctuation.definition.symbol.end.erlang\",regex:\"'\",next:\"pop\"},{token:[\"punctuation.definition.escape.erlang\",\"constant.other.symbol.escape.erlang\",\"punctuation.definition.escape.erlang\",\"constant.other.symbol.escape.erlang\",\"constant.other.symbol.escape.erlang\"],regex:\"(\\\\\\\\)(?:([bdefnrstv\\\\\\\\'\\\"])|(\\\\^)([@-_])|([0-7]{1,3}))\"},{token:\"invalid.illegal.atom.erlang\",regex:\"\\\\\\\\\\\\^?.?\"},{defaultToken:\"constant.other.symbol.quoted.single.erlang\"}]},{token:\"constant.other.symbol.unquoted.erlang\",regex:\"[a-z][a-zA-Z\\\\d@_]*\"}],\"#behaviour-directive\":[{token:[\"meta.directive.behaviour.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.behaviour.erlang\",\"keyword.control.directive.behaviour.erlang\",\"meta.directive.behaviour.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.behaviour.erlang\",\"entity.name.type.class.behaviour.definition.erlang\",\"meta.directive.behaviour.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.behaviour.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(behaviour)(\\\\s*)(\\\\()(\\\\s*)([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\"}],\"#binary\":[{token:\"punctuation.definition.binary.begin.erlang\",regex:\"<<\",push:[{token:\"punctuation.definition.binary.end.erlang\",regex:\">>\",next:\"pop\"},{token:[\"punctuation.separator.binary.erlang\",\"punctuation.separator.value-size.erlang\"],regex:\"(,)|(:)\"},{include:\"#internal-type-specifiers\"},{include:\"#everything-else\"},{defaultToken:\"meta.structure.binary.erlang\"}]}],\"#character\":[{token:[\"punctuation.definition.character.erlang\",\"punctuation.definition.escape.erlang\",\"constant.character.escape.erlang\",\"punctuation.definition.escape.erlang\",\"constant.character.escape.erlang\",\"constant.character.escape.erlang\"],regex:\"(\\\\$)(\\\\\\\\)(?:([bdefnrstv\\\\\\\\'\\\"])|(\\\\^)([@-_])|([0-7]{1,3}))\"},{token:\"invalid.illegal.character.erlang\",regex:\"\\\\$\\\\\\\\\\\\^?.?\"},{token:[\"punctuation.definition.character.erlang\",\"constant.character.erlang\"],regex:\"(\\\\$)(\\\\S)\"},{token:\"invalid.illegal.character.erlang\",regex:\"\\\\$.?\"}],\"#comment\":[{token:\"punctuation.definition.comment.erlang\",regex:\"%.*$\",push_:[{token:\"comment.line.percentage.erlang\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.percentage.erlang\"}]}],\"#define-directive\":[{token:[\"meta.directive.define.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.define.erlang\",\"keyword.control.directive.define.erlang\",\"meta.directive.define.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.define.erlang\",\"entity.name.function.macro.definition.erlang\",\"meta.directive.define.erlang\",\"punctuation.separator.parameters.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(define)(\\\\s*)(\\\\()(\\\\s*)([a-zA-Z\\\\d@_]+)(\\\\s*)(,)\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"meta.directive.define.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\))(\\\\s*)(\\\\.)\",next:\"pop\"},{include:\"#everything-else\"},{defaultToken:\"meta.directive.define.erlang\"}]},{token:\"meta.directive.define.erlang\",regex:\"(?=^\\\\s*-\\\\s*define\\\\s*\\\\(\\\\s*[a-zA-Z\\\\d@_]+\\\\s*\\\\()\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"meta.directive.define.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\))(\\\\s*)(\\\\.)\",next:\"pop\"},{token:[\"text\",\"punctuation.section.directive.begin.erlang\",\"text\",\"keyword.control.directive.define.erlang\",\"text\",\"punctuation.definition.parameters.begin.erlang\",\"text\",\"entity.name.function.macro.definition.erlang\",\"text\",\"punctuation.definition.parameters.begin.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(define)(\\\\s*)(\\\\()(\\\\s*)([a-zA-Z\\\\d@_]+)(\\\\s*)(\\\\()\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"text\",\"punctuation.separator.parameters.erlang\"],regex:\"(\\\\))(\\\\s*)(,)\",next:\"pop\"},{token:\"punctuation.separator.parameters.erlang\",regex:\",\"},{include:\"#everything-else\"}]},{token:\"punctuation.separator.define.erlang\",regex:\"\\\\|\\\\||\\\\||:|;|,|\\\\.|->\"},{include:\"#everything-else\"},{defaultToken:\"meta.directive.define.erlang\"}]}],\"#directive\":[{token:[\"meta.directive.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.erlang\",\"keyword.control.directive.erlang\",\"meta.directive.erlang\",\"punctuation.definition.parameters.begin.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(\\\\(?)\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"meta.directive.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\)?)(\\\\s*)(\\\\.)\",next:\"pop\"},{include:\"#everything-else\"},{defaultToken:\"meta.directive.erlang\"}]},{token:[\"meta.directive.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.erlang\",\"keyword.control.directive.erlang\",\"meta.directive.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(\\\\.)\"}],\"#everything-else\":[{include:\"#comment\"},{include:\"#record-usage\"},{include:\"#macro-usage\"},{include:\"#expression\"},{include:\"#keyword\"},{include:\"#textual-operator\"},{include:\"#function-call\"},{include:\"#tuple\"},{include:\"#list\"},{include:\"#binary\"},{include:\"#parenthesized-expression\"},{include:\"#character\"},{include:\"#number\"},{include:\"#atom\"},{include:\"#string\"},{include:\"#symbolic-operator\"},{include:\"#variable\"}],\"#expression\":[{token:\"keyword.control.if.erlang\",regex:\"\\\\bif\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#internal-expression-punctuation\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.if.erlang\"}]},{token:\"keyword.control.case.erlang\",regex:\"\\\\bcase\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#internal-expression-punctuation\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.case.erlang\"}]},{token:\"keyword.control.receive.erlang\",regex:\"\\\\breceive\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#internal-expression-punctuation\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.receive.erlang\"}]},{token:[\"keyword.control.fun.erlang\",\"text\",\"entity.name.type.class.module.erlang\",\"text\",\"punctuation.separator.module-function.erlang\",\"text\",\"entity.name.function.erlang\",\"text\",\"punctuation.separator.function-arity.erlang\"],regex:\"\\\\b(fun)(\\\\s*)(?:([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(:)(\\\\s*))?([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(/)\"},{token:\"keyword.control.fun.erlang\",regex:\"\\\\bfun\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{token:\"text\",regex:\"(?=\\\\()\",push:[{token:\"punctuation.separator.clauses.erlang\",regex:\";|(?=\\\\bend\\\\b)\",next:\"pop\"},{include:\"#internal-function-parts\"}]},{include:\"#everything-else\"},{defaultToken:\"meta.expression.fun.erlang\"}]},{token:\"keyword.control.try.erlang\",regex:\"\\\\btry\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#internal-expression-punctuation\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.try.erlang\"}]},{token:\"keyword.control.begin.erlang\",regex:\"\\\\bbegin\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#internal-expression-punctuation\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.begin.erlang\"}]},{token:\"keyword.control.query.erlang\",regex:\"\\\\bquery\\\\b\",push:[{token:\"keyword.control.end.erlang\",regex:\"\\\\bend\\\\b\",next:\"pop\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.query.erlang\"}]}],\"#function\":[{token:[\"meta.function.erlang\",\"entity.name.function.definition.erlang\",\"meta.function.erlang\"],regex:\"^(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(?=\\\\()\",push:[{token:\"punctuation.terminator.function.erlang\",regex:\"\\\\.\",next:\"pop\"},{token:[\"text\",\"entity.name.function.erlang\",\"text\"],regex:\"^(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(?=\\\\()\"},{token:\"text\",regex:\"(?=\\\\()\",push:[{token:\"punctuation.separator.clauses.erlang\",regex:\";|(?=\\\\.)\",next:\"pop\"},{include:\"#parenthesized-expression\"},{include:\"#internal-function-parts\"}]},{include:\"#everything-else\"},{defaultToken:\"meta.function.erlang\"}]}],\"#function-call\":[{token:\"meta.function-call.erlang\",regex:\"(?=(?:[a-z][a-zA-Z\\\\d@_]*|'[^']*')\\\\s*(?:\\\\(|:\\\\s*(?:[a-z][a-zA-Z\\\\d@_]*|'[^']*')\\\\s*\\\\())\",push:[{token:\"punctuation.definition.parameters.end.erlang\",regex:\"\\\\)\",next:\"pop\"},{token:[\"entity.name.type.class.module.erlang\",\"text\",\"punctuation.separator.module-function.erlang\",\"text\",\"entity.name.function.guard.erlang\",\"text\",\"punctuation.definition.parameters.begin.erlang\"],regex:\"(?:(erlang)(\\\\s*)(:)(\\\\s*))?(is_atom|is_binary|is_constant|is_float|is_function|is_integer|is_list|is_number|is_pid|is_port|is_reference|is_tuple|is_record|abs|element|hd|length|node|round|self|size|tl|trunc)(\\\\s*)(\\\\()\",push:[{token:\"text\",regex:\"(?=\\\\))\",next:\"pop\"},{token:\"punctuation.separator.parameters.erlang\",regex:\",\"},{include:\"#everything-else\"}]},{token:[\"entity.name.type.class.module.erlang\",\"text\",\"punctuation.separator.module-function.erlang\",\"text\",\"entity.name.function.erlang\",\"text\",\"punctuation.definition.parameters.begin.erlang\"],regex:\"(?:([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(:)(\\\\s*))?([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(\\\\()\",push:[{token:\"text\",regex:\"(?=\\\\))\",next:\"pop\"},{token:\"punctuation.separator.parameters.erlang\",regex:\",\"},{include:\"#everything-else\"}]},{defaultToken:\"meta.function-call.erlang\"}]}],\"#import-export-directive\":[{token:[\"meta.directive.import.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.import.erlang\",\"keyword.control.directive.import.erlang\",\"meta.directive.import.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.import.erlang\",\"entity.name.type.class.module.erlang\",\"meta.directive.import.erlang\",\"punctuation.separator.parameters.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(import)(\\\\s*)(\\\\()(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(,)\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"meta.directive.import.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\))(\\\\s*)(\\\\.)\",next:\"pop\"},{include:\"#internal-function-list\"},{defaultToken:\"meta.directive.import.erlang\"}]},{token:[\"meta.directive.export.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.export.erlang\",\"keyword.control.directive.export.erlang\",\"meta.directive.export.erlang\",\"punctuation.definition.parameters.begin.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(export)(\\\\s*)(\\\\()\",push:[{token:[\"punctuation.definition.parameters.end.erlang\",\"meta.directive.export.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\))(\\\\s*)(\\\\.)\",next:\"pop\"},{include:\"#internal-function-list\"},{defaultToken:\"meta.directive.export.erlang\"}]}],\"#internal-expression-punctuation\":[{token:[\"punctuation.separator.clause-head-body.erlang\",\"punctuation.separator.clauses.erlang\",\"punctuation.separator.expressions.erlang\"],regex:\"(->)|(;)|(,)\"}],\"#internal-function-list\":[{token:\"punctuation.definition.list.begin.erlang\",regex:\"\\\\[\",push:[{token:\"punctuation.definition.list.end.erlang\",regex:\"\\\\]\",next:\"pop\"},{token:[\"entity.name.function.erlang\",\"text\",\"punctuation.separator.function-arity.erlang\"],regex:\"([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(/)\",push:[{token:\"punctuation.separator.list.erlang\",regex:\",|(?=\\\\])\",next:\"pop\"},{include:\"#everything-else\"}]},{include:\"#everything-else\"},{defaultToken:\"meta.structure.list.function.erlang\"}]}],\"#internal-function-parts\":[{token:\"text\",regex:\"(?=\\\\()\",push:[{token:\"punctuation.separator.clause-head-body.erlang\",regex:\"->\",next:\"pop\"},{token:\"punctuation.definition.parameters.begin.erlang\",regex:\"\\\\(\",push:[{token:\"punctuation.definition.parameters.end.erlang\",regex:\"\\\\)\",next:\"pop\"},{token:\"punctuation.separator.parameters.erlang\",regex:\",\"},{include:\"#everything-else\"}]},{token:\"punctuation.separator.guards.erlang\",regex:\",|;\"},{include:\"#everything-else\"}]},{token:\"punctuation.separator.expressions.erlang\",regex:\",\"},{include:\"#everything-else\"}],\"#internal-record-body\":[{token:\"punctuation.definition.class.record.begin.erlang\",regex:\"\\\\{\",push:[{token:\"meta.structure.record.erlang\",regex:\"(?=\\\\})\",next:\"pop\"},{token:[\"variable.other.field.erlang\",\"variable.language.omitted.field.erlang\",\"text\",\"keyword.operator.assignment.erlang\"],regex:\"(?:([a-z][a-zA-Z\\\\d@_]*|'[^']*')|(_))(\\\\s*)(=|::)\",push:[{token:\"punctuation.separator.class.record.erlang\",regex:\",|(?=\\\\})\",next:\"pop\"},{include:\"#everything-else\"}]},{token:[\"variable.other.field.erlang\",\"text\",\"punctuation.separator.class.record.erlang\"],regex:\"([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)((?:,)?)\"},{include:\"#everything-else\"},{defaultToken:\"meta.structure.record.erlang\"}]}],\"#internal-type-specifiers\":[{token:\"punctuation.separator.value-type.erlang\",regex:\"/\",push:[{token:\"text\",regex:\"(?=,|:|>>)\",next:\"pop\"},{token:[\"storage.type.erlang\",\"storage.modifier.signedness.erlang\",\"storage.modifier.endianness.erlang\",\"storage.modifier.unit.erlang\",\"punctuation.separator.type-specifiers.erlang\"],regex:\"(integer|float|binary|bytes|bitstring|bits)|(signed|unsigned)|(big|little|native)|(unit)|(-)\"}]}],\"#keyword\":[{token:\"keyword.control.erlang\",regex:\"\\\\b(?:after|begin|case|catch|cond|end|fun|if|let|of|query|try|receive|when)\\\\b\"}],\"#list\":[{token:\"punctuation.definition.list.begin.erlang\",regex:\"\\\\[\",push:[{token:\"punctuation.definition.list.end.erlang\",regex:\"\\\\]\",next:\"pop\"},{token:\"punctuation.separator.list.erlang\",regex:\"\\\\||\\\\|\\\\||,\"},{include:\"#everything-else\"},{defaultToken:\"meta.structure.list.erlang\"}]}],\"#macro-directive\":[{token:[\"meta.directive.ifdef.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.ifdef.erlang\",\"keyword.control.directive.ifdef.erlang\",\"meta.directive.ifdef.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.ifdef.erlang\",\"entity.name.function.macro.erlang\",\"meta.directive.ifdef.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.ifdef.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(ifdef)(\\\\s*)(\\\\()(\\\\s*)([a-zA-z\\\\d@_]+)(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\"},{token:[\"meta.directive.ifndef.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.ifndef.erlang\",\"keyword.control.directive.ifndef.erlang\",\"meta.directive.ifndef.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.ifndef.erlang\",\"entity.name.function.macro.erlang\",\"meta.directive.ifndef.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.ifndef.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(ifndef)(\\\\s*)(\\\\()(\\\\s*)([a-zA-z\\\\d@_]+)(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\"},{token:[\"meta.directive.undef.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.undef.erlang\",\"keyword.control.directive.undef.erlang\",\"meta.directive.undef.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.undef.erlang\",\"entity.name.function.macro.erlang\",\"meta.directive.undef.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.undef.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(undef)(\\\\s*)(\\\\()(\\\\s*)([a-zA-z\\\\d@_]+)(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\"}],\"#macro-usage\":[{token:[\"keyword.operator.macro.erlang\",\"meta.macro-usage.erlang\",\"entity.name.function.macro.erlang\"],regex:\"(\\\\?\\\\??)(\\\\s*)([a-zA-Z\\\\d@_]+)\"}],\"#module-directive\":[{token:[\"meta.directive.module.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.module.erlang\",\"keyword.control.directive.module.erlang\",\"meta.directive.module.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.module.erlang\",\"entity.name.type.class.module.definition.erlang\",\"meta.directive.module.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.module.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(module)(\\\\s*)(\\\\()(\\\\s*)([a-z][a-zA-Z\\\\d@_]*)(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\"}],\"#number\":[{token:\"text\",regex:\"(?=\\\\d)\",push:[{token:\"text\",regex:\"(?!\\\\d)\",next:\"pop\"},{token:[\"constant.numeric.float.erlang\",\"punctuation.separator.integer-float.erlang\",\"constant.numeric.float.erlang\",\"punctuation.separator.float-exponent.erlang\"],regex:\"(\\\\d+)(\\\\.)(\\\\d+)((?:[eE][\\\\+\\\\-]?\\\\d+)?)\"},{token:[\"constant.numeric.integer.binary.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.binary.erlang\"],regex:\"(2)(#)([0-1]+)\"},{token:[\"constant.numeric.integer.base-3.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-3.erlang\"],regex:\"(3)(#)([0-2]+)\"},{token:[\"constant.numeric.integer.base-4.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-4.erlang\"],regex:\"(4)(#)([0-3]+)\"},{token:[\"constant.numeric.integer.base-5.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-5.erlang\"],regex:\"(5)(#)([0-4]+)\"},{token:[\"constant.numeric.integer.base-6.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-6.erlang\"],regex:\"(6)(#)([0-5]+)\"},{token:[\"constant.numeric.integer.base-7.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-7.erlang\"],regex:\"(7)(#)([0-6]+)\"},{token:[\"constant.numeric.integer.octal.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.octal.erlang\"],regex:\"(8)(#)([0-7]+)\"},{token:[\"constant.numeric.integer.base-9.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-9.erlang\"],regex:\"(9)(#)([0-8]+)\"},{token:[\"constant.numeric.integer.decimal.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.decimal.erlang\"],regex:\"(10)(#)(\\\\d+)\"},{token:[\"constant.numeric.integer.base-11.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-11.erlang\"],regex:\"(11)(#)([\\\\daA]+)\"},{token:[\"constant.numeric.integer.base-12.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-12.erlang\"],regex:\"(12)(#)([\\\\da-bA-B]+)\"},{token:[\"constant.numeric.integer.base-13.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-13.erlang\"],regex:\"(13)(#)([\\\\da-cA-C]+)\"},{token:[\"constant.numeric.integer.base-14.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-14.erlang\"],regex:\"(14)(#)([\\\\da-dA-D]+)\"},{token:[\"constant.numeric.integer.base-15.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-15.erlang\"],regex:\"(15)(#)([\\\\da-eA-E]+)\"},{token:[\"constant.numeric.integer.hexadecimal.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.hexadecimal.erlang\"],regex:\"(16)(#)([\\\\da-fA-F]+)\"},{token:[\"constant.numeric.integer.base-17.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-17.erlang\"],regex:\"(17)(#)([\\\\da-gA-G]+)\"},{token:[\"constant.numeric.integer.base-18.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-18.erlang\"],regex:\"(18)(#)([\\\\da-hA-H]+)\"},{token:[\"constant.numeric.integer.base-19.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-19.erlang\"],regex:\"(19)(#)([\\\\da-iA-I]+)\"},{token:[\"constant.numeric.integer.base-20.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-20.erlang\"],regex:\"(20)(#)([\\\\da-jA-J]+)\"},{token:[\"constant.numeric.integer.base-21.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-21.erlang\"],regex:\"(21)(#)([\\\\da-kA-K]+)\"},{token:[\"constant.numeric.integer.base-22.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-22.erlang\"],regex:\"(22)(#)([\\\\da-lA-L]+)\"},{token:[\"constant.numeric.integer.base-23.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-23.erlang\"],regex:\"(23)(#)([\\\\da-mA-M]+)\"},{token:[\"constant.numeric.integer.base-24.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-24.erlang\"],regex:\"(24)(#)([\\\\da-nA-N]+)\"},{token:[\"constant.numeric.integer.base-25.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-25.erlang\"],regex:\"(25)(#)([\\\\da-oA-O]+)\"},{token:[\"constant.numeric.integer.base-26.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-26.erlang\"],regex:\"(26)(#)([\\\\da-pA-P]+)\"},{token:[\"constant.numeric.integer.base-27.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-27.erlang\"],regex:\"(27)(#)([\\\\da-qA-Q]+)\"},{token:[\"constant.numeric.integer.base-28.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-28.erlang\"],regex:\"(28)(#)([\\\\da-rA-R]+)\"},{token:[\"constant.numeric.integer.base-29.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-29.erlang\"],regex:\"(29)(#)([\\\\da-sA-S]+)\"},{token:[\"constant.numeric.integer.base-30.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-30.erlang\"],regex:\"(30)(#)([\\\\da-tA-T]+)\"},{token:[\"constant.numeric.integer.base-31.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-31.erlang\"],regex:\"(31)(#)([\\\\da-uA-U]+)\"},{token:[\"constant.numeric.integer.base-32.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-32.erlang\"],regex:\"(32)(#)([\\\\da-vA-V]+)\"},{token:[\"constant.numeric.integer.base-33.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-33.erlang\"],regex:\"(33)(#)([\\\\da-wA-W]+)\"},{token:[\"constant.numeric.integer.base-34.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-34.erlang\"],regex:\"(34)(#)([\\\\da-xA-X]+)\"},{token:[\"constant.numeric.integer.base-35.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-35.erlang\"],regex:\"(35)(#)([\\\\da-yA-Y]+)\"},{token:[\"constant.numeric.integer.base-36.erlang\",\"punctuation.separator.base-integer.erlang\",\"constant.numeric.integer.base-36.erlang\"],regex:\"(36)(#)([\\\\da-zA-Z]+)\"},{token:\"invalid.illegal.integer.erlang\",regex:\"\\\\d+#[\\\\da-zA-Z]+\"},{token:\"constant.numeric.integer.decimal.erlang\",regex:\"\\\\d+\"}]}],\"#parenthesized-expression\":[{token:\"punctuation.section.expression.begin.erlang\",regex:\"\\\\(\",push:[{token:\"punctuation.section.expression.end.erlang\",regex:\"\\\\)\",next:\"pop\"},{include:\"#everything-else\"},{defaultToken:\"meta.expression.parenthesized\"}]}],\"#record-directive\":[{token:[\"meta.directive.record.erlang\",\"punctuation.section.directive.begin.erlang\",\"meta.directive.record.erlang\",\"keyword.control.directive.import.erlang\",\"meta.directive.record.erlang\",\"punctuation.definition.parameters.begin.erlang\",\"meta.directive.record.erlang\",\"entity.name.type.class.record.definition.erlang\",\"meta.directive.record.erlang\",\"punctuation.separator.parameters.erlang\"],regex:\"^(\\\\s*)(-)(\\\\s*)(record)(\\\\s*)(\\\\()(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(,)\",push:[{token:[\"punctuation.definition.class.record.end.erlang\",\"meta.directive.record.erlang\",\"punctuation.definition.parameters.end.erlang\",\"meta.directive.record.erlang\",\"punctuation.section.directive.end.erlang\"],regex:\"(\\\\})(\\\\s*)(\\\\))(\\\\s*)(\\\\.)\",next:\"pop\"},{include:\"#internal-record-body\"},{defaultToken:\"meta.directive.record.erlang\"}]}],\"#record-usage\":[{token:[\"keyword.operator.record.erlang\",\"meta.record-usage.erlang\",\"entity.name.type.class.record.erlang\",\"meta.record-usage.erlang\",\"punctuation.separator.record-field.erlang\",\"meta.record-usage.erlang\",\"variable.other.field.erlang\"],regex:\"(#)(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')(\\\\s*)(\\\\.)(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')\"},{token:[\"keyword.operator.record.erlang\",\"meta.record-usage.erlang\",\"entity.name.type.class.record.erlang\"],regex:\"(#)(\\\\s*)([a-z][a-zA-Z\\\\d@_]*|'[^']*')\",push:[{token:\"punctuation.definition.class.record.end.erlang\",regex:\"\\\\}\",next:\"pop\"},{include:\"#internal-record-body\"},{defaultToken:\"meta.record-usage.erlang\"}]}],\"#string\":[{token:\"punctuation.definition.string.begin.erlang\",regex:'\"',push:[{token:\"punctuation.definition.string.end.erlang\",regex:'\"',next:\"pop\"},{token:[\"punctuation.definition.escape.erlang\",\"constant.character.escape.erlang\",\"punctuation.definition.escape.erlang\",\"constant.character.escape.erlang\",\"constant.character.escape.erlang\"],regex:\"(\\\\\\\\)(?:([bdefnrstv\\\\\\\\'\\\"])|(\\\\^)([@-_])|([0-7]{1,3}))\"},{token:\"invalid.illegal.string.erlang\",regex:\"\\\\\\\\\\\\^?.?\"},{token:[\"punctuation.definition.placeholder.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"constant.other.placeholder.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"constant.other.placeholder.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"constant.other.placeholder.erlang\",\"constant.other.placeholder.erlang\"],regex:\"(~)(?:((?:\\\\-)?)(\\\\d+)|(\\\\*))?(?:(\\\\.)(?:(\\\\d+)|(\\\\*)))?(?:(\\\\.)(?:(\\\\*)|(.)))?([~cfegswpWPBX#bx\\\\+ni])\"},{token:[\"punctuation.definition.placeholder.erlang\",\"punctuation.separator.placeholder-parts.erlang\",\"constant.other.placeholder.erlang\",\"constant.other.placeholder.erlang\"],regex:\"(~)((?:\\\\*)?)((?:\\\\d+)?)([~du\\\\-#fsacl])\"},{token:\"invalid.illegal.string.erlang\",regex:\"~.?\"},{defaultToken:\"string.quoted.double.erlang\"}]}],\"#symbolic-operator\":[{token:\"keyword.operator.symbolic.erlang\",regex:\"\\\\+\\\\+|\\\\+|--|-|\\\\*|/=|/|=/=|=:=|==|=<|=|<-|<|>=|>|!|::\"}],\"#textual-operator\":[{token:\"keyword.operator.textual.erlang\",regex:\"\\\\b(?:andalso|band|and|bxor|xor|bor|orelse|or|bnot|not|bsl|bsr|div|rem)\\\\b\"}],\"#tuple\":[{token:\"punctuation.definition.tuple.begin.erlang\",regex:\"\\\\{\",push:[{token:\"punctuation.definition.tuple.end.erlang\",regex:\"\\\\}\",next:\"pop\"},{token:\"punctuation.separator.tuple.erlang\",regex:\",\"},{include:\"#everything-else\"},{defaultToken:\"meta.structure.tuple.erlang\"}]}],\"#variable\":[{token:[\"variable.other.erlang\",\"variable.language.omitted.erlang\"],regex:\"(_[a-zA-Z\\\\d@_]+|[A-Z][a-zA-Z\\\\d@_]*)|(_)\"}]},this.normalizeRules()};s.metaData={comment:\"The recognition of function definitions and compiler directives (such as module, record and macro definitions) requires that each of the aforementioned constructs must be the first string inside a line (except for whitespace).  Also, the function/module/record/macro names must be given unquoted.  -- desp\",fileTypes:[\"erl\",\"hrl\"],keyEquivalent:\"^~E\",name:\"Erlang\",scopeName:\"source.erlang\"},r.inherits(s,i),t.ErlangHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-forth.js",
    "content": "define(\"ace/mode/forth\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/forth_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./forth_highlight_rules\").ForthHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"(?<=^|\\\\s)\\\\.?\\\\( [^)]*\\\\)\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/forth\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/forth_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{include:\"#forth\"}],\"#comment\":[{token:\"comment.line.double-dash.forth\",regex:\"(?:^|\\\\s)--\\\\s.*$\",comment:\"line comments for iForth\"},{token:\"comment.line.backslash.forth\",regex:\"(?:^|\\\\s)\\\\\\\\[\\\\s\\\\S]*$\",comment:\"ANSI line comment\"},{token:\"comment.line.backslash-g.forth\",regex:\"(?:^|\\\\s)\\\\\\\\[Gg] .*$\",comment:\"gForth line comment\"},{token:\"comment.block.forth\",regex:\"(?:^|\\\\s)\\\\(\\\\*(?=\\\\s|$)\",push:[{token:\"comment.block.forth\",regex:\"(?:^|\\\\s)\\\\*\\\\)(?=\\\\s|$)\",next:\"pop\"},{defaultToken:\"comment.block.forth\"}],comment:\"multiline comments for iForth\"},{token:\"comment.block.documentation.forth\",regex:\"\\\\bDOC\\\\b\",caseInsensitive:!0,push:[{token:\"comment.block.documentation.forth\",regex:\"\\\\bENDDOC\\\\b\",caseInsensitive:!0,next:\"pop\"},{defaultToken:\"comment.block.documentation.forth\"}],comment:\"documentation comments for iForth\"},{token:\"comment.line.parentheses.forth\",regex:\"(?:^|\\\\s)\\\\.?\\\\( [^)]*\\\\)\",comment:\"ANSI line comment\"}],\"#constant\":[{token:\"constant.language.forth\",regex:\"(?:^|\\\\s)(?:TRUE|FALSE|BL|PI|CELL|C/L|R/O|W/O|R/W)(?=\\\\s|$)\",caseInsensitive:!0},{token:\"constant.numeric.forth\",regex:\"(?:^|\\\\s)[$#%]?[-+]?[0-9]+(?:\\\\.[0-9]*e-?[0-9]+|\\\\.?[0-9a-fA-F]*)(?=\\\\s|$)\"},{token:\"constant.character.forth\",regex:\"(?:^|\\\\s)(?:[&^]\\\\S|(?:\\\"|')\\\\S(?:\\\"|'))(?=\\\\s|$)\"}],\"#forth\":[{include:\"#constant\"},{include:\"#comment\"},{include:\"#string\"},{include:\"#word\"},{include:\"#variable\"},{include:\"#storage\"},{include:\"#word-def\"}],\"#storage\":[{token:\"storage.type.forth\",regex:\"(?:^|\\\\s)(?:2CONSTANT|2VARIABLE|ALIAS|CONSTANT|CREATE-INTERPRET/COMPILE[:]?|CREATE|DEFER|FCONSTANT|FIELD|FVARIABLE|USER|VALUE|VARIABLE|VOCABULARY)(?=\\\\s|$)\",caseInsensitive:!0}],\"#string\":[{token:\"string.quoted.double.forth\",regex:'(ABORT\" |BREAK\" |\\\\.\" |C\" |0\"|S\\\\\\\\?\" )([^\"]+\")',caseInsensitive:!0},{token:\"string.unquoted.forth\",regex:\"(?:INCLUDE|NEEDS|REQUIRE|USE)[ ]\\\\S+(?=\\\\s|$)\",caseInsensitive:!0}],\"#variable\":[{token:\"variable.language.forth\",regex:\"\\\\b(?:I|J)\\\\b\",caseInsensitive:!0}],\"#word\":[{token:\"keyword.control.immediate.forth\",regex:\"(?:^|\\\\s)\\\\[(?:\\\\?DO|\\\\+LOOP|AGAIN|BEGIN|DEFINED|DO|ELSE|ENDIF|FOR|IF|IFDEF|IFUNDEF|LOOP|NEXT|REPEAT|THEN|UNTIL|WHILE)\\\\](?=\\\\s|$)\",caseInsensitive:!0},{token:\"keyword.other.immediate.forth\",regex:\"(?:^|\\\\s)(?:COMPILE-ONLY|IMMEDIATE|IS|RESTRICT|TO|WHAT'S|])(?=\\\\s|$)\",caseInsensitive:!0},{token:\"keyword.control.compile-only.forth\",regex:'(?:^|\\\\s)(?:-DO|\\\\-LOOP|\\\\?DO|\\\\?LEAVE|\\\\+DO|\\\\+LOOP|ABORT\\\\\"|AGAIN|AHEAD|BEGIN|CASE|DO|ELSE|ENDCASE|ENDIF|ENDOF|ENDTRY\\\\-IFERROR|ENDTRY|FOR|IF|IFERROR|LEAVE|LOOP|NEXT|RECOVER|REPEAT|RESTORE|THEN|TRY|U\\\\-DO|U\\\\+DO|UNTIL|WHILE)(?=\\\\s|$)',caseInsensitive:!0},{token:\"keyword.other.compile-only.forth\",regex:\"(?:^|\\\\s)(?:\\\\?DUP-0=-IF|\\\\?DUP-IF|\\\\)|\\\\[|\\\\['\\\\]|\\\\[CHAR\\\\]|\\\\[COMPILE\\\\]|\\\\[IS\\\\]|\\\\[TO\\\\]|<COMPILATION|<INTERPRETATION|ASSERT\\\\(|ASSERT0\\\\(|ASSERT1\\\\(|ASSERT2\\\\(|ASSERT3\\\\(|COMPILATION>|DEFERS|DOES>|INTERPRETATION>|OF|POSTPONE)(?=\\\\s|$)\",caseInsensitive:!0},{token:\"keyword.other.non-immediate.forth\",regex:\"(?:^|\\\\s)(?:'|<IS>|<TO>|CHAR|END-STRUCT|INCLUDE[D]?|LOAD|NEEDS|REQUIRE[D]?|REVISION|SEE|STRUCT|THRU|USE)(?=\\\\s|$)\",caseInsensitive:!0},{token:\"keyword.other.warning.forth\",regex:'(?:^|\\\\s)(?:~~|BREAK:|BREAK\"|DBG)(?=\\\\s|$)',caseInsensitive:!0}],\"#word-def\":[{token:[\"keyword.other.compile-only.forth\",\"keyword.other.compile-only.forth\",\"meta.block.forth\",\"entity.name.function.forth\"],regex:\"(:NONAME)|(^:|\\\\s:)(\\\\s)(\\\\S+)(?=\\\\s|$)\",caseInsensitive:!0,push:[{token:\"keyword.other.compile-only.forth\",regex:\";(?:CODE)?\",caseInsensitive:!0,next:\"pop\"},{include:\"#constant\"},{include:\"#comment\"},{include:\"#string\"},{include:\"#word\"},{include:\"#variable\"},{include:\"#storage\"},{defaultToken:\"meta.block.forth\"}]}]},this.normalizeRules()};s.metaData={fileTypes:[\"frt\",\"fs\",\"ldr\"],foldingStartMarker:\"/\\\\*\\\\*|\\\\{\\\\s*$\",foldingStopMarker:\"\\\\*\\\\*/|^\\\\s*\\\\}\",keyEquivalent:\"^~F\",name:\"Forth\",scopeName:\"source.forth\"},r.inherits(s,i),t.ForthHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ftl.js",
    "content": "define(\"ace/mode/ftl\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ftl_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ftl_highlight_rules\").FtlHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.$id=\"ace/mode/ftl\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/ftl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"\\\\?|substring|cap_first|uncap_first|capitalize|chop_linebreak|date|time|datetime|ends_with|html|groups|index_of|j_string|js_string|json_string|last_index_of|length|lower_case|left_pad|right_pad|contains|matches|number|replace|rtf|url|split|starts_with|string|trim|upper_case|word_list|xhtml|xml\",t=\"c|round|floor|ceiling\",n=\"iso_[a-z_]+\",r=\"first|last|seq_contains|seq_index_of|seq_last_index_of|reverse|size|sort|sort_by|chunk\",i=\"keys|values\",s=\"children|parent|root|ancestors|node_name|node_type|node_namespace\",o=\"byte|double|float|int|long|short|number_to_date|number_to_time|number_to_datetime|eval|has_content|interpret|is_[a-z_]+|namespacenew\",u=e+t+n+r+i+s+o,a=\"default|exists|if_exists|web_safe\",f=\"data_model|error|globals|lang|locale|locals|main|namespace|node|current_node|now|output_encoding|template_name|url_escaping_charset|vars|version\",l=\"gt|gte|lt|lte|as|in|using\",c=\"true|false\",h=\"encoding|parse|locale|number_format|date_format|time_format|datetime_format|time_zone|url_escaping_charset|classic_compatible|strip_whitespace|strip_text|strict_syntax|ns_prefixes|attributes\";this.$rules={start:[{token:\"constant.character.entity\",regex:/&[^;]+;/},{token:\"support.function\",regex:\"\\\\?(\"+u+\")\"},{token:\"support.function.deprecated\",regex:\"\\\\?(\"+a+\")\"},{token:\"language.variable\",regex:\"\\\\.(?:\"+f+\")\"},{token:\"constant.language\",regex:\"\\\\b(\"+c+\")\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\b(?:\"+l+\")\\\\b\"},{token:\"entity.other.attribute-name\",regex:h},{token:\"string\",regex:/['\"]/,next:\"qstring\"},{token:function(e){return e.match(\"^[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?$\")?\"constant.numeric\":\"variable\"},regex:/[\\w.+\\-]+/},{token:\"keyword.operator\",regex:\"!|\\\\.|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],qstring:[{token:\"constant.character.escape\",regex:'\\\\\\\\[nrtvef\\\\\\\\\"$]'},{token:\"string\",regex:/['\"]/,next:\"start\"},{defaultToken:\"string\"}]}};r.inherits(o,s);var u=function(){i.call(this);var e=\"assign|attempt|break|case|compress|default|elseif|else|escape|fallback|function|flush|ftl|global|if|import|include|list|local|lt|macro|nested|noescape|noparse|nt|recover|recurse|return|rt|setting|stop|switch|t|visit\",t=[{token:\"comment\",regex:\"<#--\",next:\"ftl-dcomment\"},{token:\"string.interpolated\",regex:\"\\\\${\",push:\"ftl-start\"},{token:\"keyword.function\",regex:\"</?#(\"+e+\")\",push:\"ftl-start\"},{token:\"keyword.other\",regex:\"</?@[a-zA-Z\\\\.]+\",push:\"ftl-start\"}],n=[{token:\"keyword\",regex:\"/?>\",next:\"pop\"},{token:\"string.interpolated\",regex:\"}\",next:\"pop\"}];for(var r in this.$rules)this.$rules[r].unshift.apply(this.$rules[r],t);this.embedRules(o,\"ftl-\",n,[\"start\"]),this.addRules({\"ftl-dcomment\":[{token:\"comment\",regex:\".*?-->\",next:\"pop\"},{token:\"comment\",regex:\".+\"}]}),this.normalizeRules()};r.inherits(u,i),t.FtlHighlightRules=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-gherkin.js",
    "content": "define(\"ace/mode/gherkin\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/gherkin_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./gherkin_highlight_rules\").GherkinHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart=\"#\",this.$id=\"ace/mode/gherkin\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=\"  \",s=this.getTokenizer().getLineTokens(t,e),o=s.tokens;return console.log(e),t.match(\"[ ]*\\\\|\")&&(r+=\"| \"),o.length&&o[o.length-1].type==\"comment\"?r:(e==\"start\"&&(t.match(\"Scenario:|Feature:|Scenario Outline:|Background:\")?r+=i:t.match(\"(Given|Then).+(:)$|Examples:\")?r+=i:t.match(\"\\\\*.+\")&&(r+=\"* \")),r)}}.call(o.prototype),t.Mode=o}),define(\"ace/mode/gherkin_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=\"\\\\\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\\\\\abfnrtv'\\\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})\",o=function(){this.$rules={start:[{token:\"constant.numeric\",regex:\"(?:(?:[1-9]\\\\d*)|(?:0))\"},{token:\"comment\",regex:\"#.*$\"},{token:\"keyword\",regex:\"Feature:|Background:|Scenario:|Scenario Outline:|Examples:|Given|When|Then|And|But|\\\\*\"},{token:\"string\",regex:'\"{3}',next:\"qqstring3\"},{token:\"string\",regex:'\"',next:\"qqstring\"},{token:\"comment\",regex:\"@[A-Za-z0-9]+\",next:\"start\"},{token:\"comment\",regex:\"<.+>\"},{token:\"comment\",regex:\"\\\\| \",next:\"table-item\"},{token:\"comment\",regex:\"\\\\|$\",next:\"start\"}],qqstring3:[{token:\"constant.language.escape\",regex:s},{token:\"string\",regex:'\"{3}',next:\"start\"},{defaultToken:\"string\"}],qqstring:[{token:\"constant.language.escape\",regex:s},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"start\"},{defaultToken:\"string\"}],\"table-item\":[{token:\"string\",regex:\"[A-Za-z0-9 ]*\",next:\"start\"}]}};r.inherits(o,i),t.GherkinHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-glsl.js",
    "content": "define(\"ace/mode/glsl\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/c_cpp\",\"ace/mode/glsl_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./c_cpp\").Mode,s=e(\"./glsl_highlight_rules\").glslHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.$id=\"ace/mode/glsl\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c_cpp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c_cpp\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/glsl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/c_cpp_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,s=function(){var e=\"attribute|const|uniform|varying|break|continue|do|for|while|if|else|in|out|inout|float|int|void|bool|true|false|lowp|mediump|highp|precision|invariant|discard|return|mat2|mat3|mat4|vec2|vec3|vec4|ivec2|ivec3|ivec4|bvec2|bvec3|bvec4|sampler2D|samplerCube|struct\",t=\"radians|degrees|sin|cos|tan|asin|acos|atan|pow|exp|log|exp2|log2|sqrt|inversesqrt|abs|sign|floor|ceil|fract|mod|min|max|clamp|mix|step|smoothstep|length|distance|dot|cross|normalize|faceforward|reflect|refract|matrixCompMult|lessThan|lessThanEqual|greaterThan|greaterThanEqual|equal|notEqual|any|all|not|dFdx|dFdy|fwidth|texture2D|texture2DProj|texture2DLod|texture2DProjLod|textureCube|textureCubeLod|gl_MaxVertexAttribs|gl_MaxVertexUniformVectors|gl_MaxVaryingVectors|gl_MaxVertexTextureImageUnits|gl_MaxCombinedTextureImageUnits|gl_MaxTextureImageUnits|gl_MaxFragmentUniformVectors|gl_MaxDrawBuffers|gl_DepthRangeParameters|gl_DepthRange|gl_Position|gl_PointSize|gl_FragCoord|gl_FrontFacing|gl_PointCoord|gl_FragColor|gl_FragData\",n=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"constant.language\":t},\"identifier\");this.$rules=(new i).$rules,this.$rules.start.forEach(function(e){typeof e.token==\"function\"&&(e.token=n)})};r.inherits(s,i),t.glslHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-golang.js",
    "content": "define(\"ace/mode/golang\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/golang_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./golang_highlight_rules\").GolangHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/golang\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/golang_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"else|break|case|return|goto|if|const|select|continue|struct|default|switch|for|range|func|import|package|chan|defer|fallthrough|go|interface|map|range|select|type|var\",t=\"string|uint8|uint16|uint32|uint64|int8|int16|int32|int64|float32|float64|complex64|complex128|byte|rune|uint|int|uintptr|bool|error\",n=\"make|close|new|panic|recover\",r=\"nil|true|false|iota\",s=this.createKeywordMapper({keyword:e,\"constant.language\":r,\"support.function\":n,\"support.type\":t},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"[`](?:[^`]*)[`]\"},{token:\"string\",merge:!0,regex:\"[`](?:[^`]*)$\",next:\"bqstring\"},{token:\"constant.numeric\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:s,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"invalid\",regex:\"\\\\s+$\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],bqstring:[{token:\"string\",regex:\"(?:[^`]*)`\",next:\"start\"},{token:\"string\",regex:\".+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.GolangHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-groovy.js",
    "content": "define(\"ace/mode/groovy\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript\",\"ace/mode/groovy_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript\").Mode,s=e(\"./groovy_highlight_rules\").GroovyHighlightRules,o=function(){i.call(this),this.HighlightRules=s};r.inherits(o,i),function(){this.createWorker=function(e){return null},this.$id=\"ace/mode/groovy\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/groovy_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"assert|with|abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|def|float|native|super|while\",t=\"null|Infinity|NaN|undefined\",n=\"AbstractMethodError|AssertionError|ClassCircularityError|ClassFormatError|Deprecated|EnumConstantNotPresentException|ExceptionInInitializerError|IllegalAccessError|IllegalThreadStateException|InstantiationError|InternalError|NegativeArraySizeException|NoSuchFieldError|Override|Process|ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|SuppressWarnings|TypeNotPresentException|UnknownError|UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|InstantiationException|IndexOutOfBoundsException|ArrayIndexOutOfBoundsException|CloneNotSupportedException|NoSuchFieldException|IllegalArgumentException|NumberFormatException|SecurityException|Void|InheritableThreadLocal|IllegalStateException|InterruptedException|NoSuchMethodException|IllegalAccessException|UnsupportedOperationException|Enum|StrictMath|Package|Compiler|Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|Character|Boolean|StackTraceElement|Appendable|StringBuffer|Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|StackOverflowError|OutOfMemoryError|VirtualMachineError|ArrayStoreException|ClassCastException|LinkageError|NoClassDefFoundError|ClassNotFoundException|RuntimeException|Exception|ThreadDeath|Error|Throwable|System|ClassLoader|Cloneable|Class|CharSequence|Comparable|String|Object\",r=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"support.function\":n,\"constant.language\":t},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'\"\"\"',next:\"qqstring\"},{token:\"string\",regex:\"'''\",next:\"qstring\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\?:|\\\\?\\\\.|\\\\*\\\\.|<=>|=~|==~|\\\\.@|\\\\*\\\\.@|\\\\.&|as|in|is|!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"constant.language.escape\",regex:/\\\\(?:u[0-9A-Fa-f]{4}|.|$)/},{token:\"constant.language.escape\",regex:/\\$[\\w\\d]+/},{token:\"constant.language.escape\",regex:/\\$\\{[^\"\\}]+\\}?/},{token:\"string\",regex:'\"{3,5}',next:\"start\"},{token:\"string\",regex:\".+?\"}],qstring:[{token:\"constant.language.escape\",regex:/\\\\(?:u[0-9A-Fa-f]{4}|.|$)/},{token:\"string\",regex:\"'{3,5}\",next:\"start\"},{token:\"string\",regex:\".+?\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.GroovyHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-haml.js",
    "content": "define(\"ace/mode/haml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/haml_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./haml_highlight_rules\").HamlHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=[\"//\",\"#\"],this.$id=\"ace/mode/haml\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/haml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\",\"ace/mode/ruby_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./ruby_highlight_rules\"),o=s.RubyHighlightRules,u=function(){this.$rules={start:[{token:\"punctuation.section.comment\",regex:/^\\s*\\/.*/},{token:\"punctuation.section.comment\",regex:/^\\s*#.*/},{token:\"string.quoted.double\",regex:\"==.+?==\"},{token:\"keyword.other.doctype\",regex:\"^!!!\\\\s*(?:[a-zA-Z0-9-_]+)?\"},s.qString,s.qqString,s.tString,{token:[\"entity.name.tag.haml\"],regex:/^\\s*%[\\w:]+/,next:\"tag_single\"},{token:[\"meta.escape.haml\"],regex:\"^\\\\s*\\\\\\\\.\"},s.constantNumericHex,s.constantNumericFloat,s.constantOtherSymbol,{token:\"text\",regex:\"=|-|~\",next:\"embedded_ruby\"}],tag_single:[{token:\"entity.other.attribute-name.class.haml\",regex:\"\\\\.[\\\\w-]+\"},{token:\"entity.other.attribute-name.id.haml\",regex:\"#[\\\\w-]+\"},{token:\"punctuation.section\",regex:\"\\\\{\",next:\"section\"},s.constantOtherSymbol,{token:\"text\",regex:/\\s/,next:\"start\"},{token:\"empty\",regex:\"$|(?!\\\\.|#|\\\\{|\\\\[|=|-|~|\\\\/)\",next:\"start\"}],section:[s.constantOtherSymbol,s.qString,s.qqString,s.tString,s.constantNumericHex,s.constantNumericFloat,{token:\"punctuation.section\",regex:\"\\\\}\",next:\"start\"}],embedded_ruby:[s.constantNumericHex,s.constantNumericFloat,{token:\"support.class\",regex:\"[A-Z][a-zA-Z_\\\\d]+\"},{token:(new o).getKeywords(),regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:[\"keyword\",\"text\",\"text\"],regex:\"(?:do|\\\\{)(?: \\\\|[^|]+\\\\|)?$\",next:\"start\"},{token:[\"text\"],regex:\"^$\",next:\"start\"},{token:[\"text\"],regex:\"^(?!.*\\\\|\\\\s*$)\",next:\"start\"}]}};r.inherits(u,i),t.HamlHighlightRules=u}),define(\"ace/mode/ruby_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.constantOtherSymbol={token:\"constant.other.symbol.ruby\",regex:\"[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?\"},o=t.qString={token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},u=t.qqString={token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},a=t.tString={token:\"string\",regex:\"[`](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[`]\"},f=t.constantNumericHex={token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\\\b\"},l=t.constantNumericFloat={token:\"constant.numeric\",regex:\"[+-]?\\\\d(?:\\\\d|_(?=\\\\d))*(?:(?:\\\\.\\\\d(?:\\\\d|_(?=\\\\d))*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},c=function(){var e=\"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|validates_inclusion_of|validates_numericality_of|validates_with|validates_each|authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|cache|expire_fragment|expire_cache_for|observe|cache_sweeper|has_many|has_one|belongs_to|has_and_belongs_to_many\",t=\"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield\",n=\"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING\",r=\"$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|$!|root_url|flash|session|cookies|params|request|response|logger|self\",i=this.$keywords=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"variable.language\":r,\"support.function\":e,\"invalid.deprecated\":\"debugger\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"comment\",regex:\"^=begin(?:$|\\\\s.*$)\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},o,u,a,{token:\"text\",regex:\"::\"},{token:\"variable.instance\",regex:\"@{1,2}[a-zA-Z_\\\\d]+\"},{token:\"support.class\",regex:\"[A-Z][a-zA-Z_\\\\d]+\"},s,f,l,{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"punctuation.separator.key-value\",regex:\"=>\"},{stateName:\"heredoc\",onMatch:function(e,t,n){var r=e[2]==\"-\"?\"indentedHeredoc\":\"heredoc\",i=e.split(this.splitRegex);return n.push(r,i[3]),[{type:\"constant\",value:i[1]},{type:\"string\",value:i[2]},{type:\"support.class\",value:i[3]},{type:\"string\",value:i[4]}]},regex:\"(<<-?)(['\\\"`]?)([\\\\w]+)(['\\\"`]?)\",rules:{heredoc:[{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}],indentedHeredoc:[{token:\"string\",regex:\"^ +\"},{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}]}},{regex:\"$\",token:\"empty\",next:function(e,t){return t[0]===\"heredoc\"||t[0]===\"indentedHeredoc\"?t[0]:e}},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\"^=end(?:$|\\\\s.*$)\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.normalizeRules()};r.inherits(c,i),t.RubyHighlightRules=c}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-handlebars.js",
    "content": "define(\"ace/mode/handlebars\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/handlebars_highlight_rules\",\"ace/mode/behaviour/html\",\"ace/mode/folding/html\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./handlebars_highlight_rules\").HandlebarsHighlightRules,o=e(\"./behaviour/html\").HtmlBehaviour,u=e(\"./folding/html\").FoldMode,a=function(){i.call(this),this.HighlightRules=s,this.$behaviour=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.$id=\"ace/mode/handlebars\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/handlebars_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\"],function(e,t,n){function s(e,t){return t.splice(0,3),t.shift()||\"start\"}var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,o=function(){i.call(this);var e={regex:\"(?={{)\",push:\"handlebars\"};for(var t in this.$rules)this.$rules[t].unshift(e);this.$rules.handlebars=[{token:\"comment.start\",regex:\"{{!--\",push:[{token:\"comment.end\",regex:\"--}}\",next:s},{defaultToken:\"comment\"}]},{token:\"comment.start\",regex:\"{{!\",push:[{token:\"comment.end\",regex:\"}}\",next:s},{defaultToken:\"comment\"}]},{token:\"storage.type.start\",regex:\"{{[#\\\\^/&]?\",push:[{token:\"storage.type.end\",regex:\"}}\",next:s},{token:\"variable.parameter\",regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\"}]},{token:\"support.function\",regex:\"{{{\",push:[{token:\"support.function\",regex:\"}}}\",next:s},{token:\"variable.parameter\",regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\"}]}],this.normalizeRules()};r.inherits(o,i),t.HandlebarsHighlightRules=o}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/behaviour/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour/xml\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour/xml\").XmlBehaviour,s=function(){i.call(this)};r.inherits(s,i),t.HtmlBehaviour=s}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-haskell.js",
    "content": "define(\"ace/mode/haskell\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/haskell_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./haskell_highlight_rules\").HaskellHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/haskell\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/haskell_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:[\"punctuation.definition.entity.haskell\",\"keyword.operator.function.infix.haskell\",\"punctuation.definition.entity.haskell\"],regex:\"(`)([a-zA-Z_']*?)(`)\",comment:\"In case this regex seems unusual for an infix operator, note that Haskell allows any ordinary function application (elem 4 [1..10]) to be rewritten as an infix expression (4 `elem` [1..10]).\"},{token:\"constant.language.unit.haskell\",regex:\"\\\\(\\\\)\"},{token:\"constant.language.empty-list.haskell\",regex:\"\\\\[\\\\]\"},{token:\"keyword.other.haskell\",regex:\"module\",push:[{token:\"keyword.other.haskell\",regex:\"where\",next:\"pop\"},{include:\"#module_name\"},{include:\"#module_exports\"},{token:\"invalid\",regex:\"[a-z]+\"},{defaultToken:\"meta.declaration.module.haskell\"}]},{token:\"keyword.other.haskell\",regex:\"\\\\bclass\\\\b\",push:[{token:\"keyword.other.haskell\",regex:\"\\\\bwhere\\\\b\",next:\"pop\"},{token:\"support.class.prelude.haskell\",regex:\"\\\\b(?:Monad|Functor|Eq|Ord|Read|Show|Num|(?:Frac|Ra)tional|Enum|Bounded|Real(?:Frac|Float)?|Integral|Floating)\\\\b\"},{token:\"entity.other.inherited-class.haskell\",regex:\"[A-Z][A-Za-z_']*\"},{token:\"variable.other.generic-type.haskell\",regex:\"\\\\b[a-z][a-zA-Z0-9_']*\\\\b\"},{defaultToken:\"meta.declaration.class.haskell\"}]},{token:\"keyword.other.haskell\",regex:\"\\\\binstance\\\\b\",push:[{token:\"keyword.other.haskell\",regex:\"\\\\bwhere\\\\b|$\",next:\"pop\"},{include:\"#type_signature\"},{defaultToken:\"meta.declaration.instance.haskell\"}]},{token:\"keyword.other.haskell\",regex:\"import\",push:[{token:\"meta.import.haskell\",regex:\"$|;\",next:\"pop\"},{token:\"keyword.other.haskell\",regex:\"qualified|as|hiding\"},{include:\"#module_name\"},{include:\"#module_exports\"},{defaultToken:\"meta.import.haskell\"}]},{token:[\"keyword.other.haskell\",\"meta.deriving.haskell\"],regex:\"(deriving)(\\\\s*\\\\()\",push:[{token:\"meta.deriving.haskell\",regex:\"\\\\)\",next:\"pop\"},{token:\"entity.other.inherited-class.haskell\",regex:\"\\\\b[A-Z][a-zA-Z_']*\"},{defaultToken:\"meta.deriving.haskell\"}]},{token:\"keyword.other.haskell\",regex:\"\\\\b(?:deriving|where|data|type|case|of|let|in|newtype|default)\\\\b\"},{token:\"keyword.operator.haskell\",regex:\"\\\\binfix[lr]?\\\\b\"},{token:\"keyword.control.haskell\",regex:\"\\\\b(?:do|if|then|else)\\\\b\"},{token:\"constant.numeric.float.haskell\",regex:\"\\\\b(?:[0-9]+\\\\.[0-9]+(?:[eE][+-]?[0-9]+)?|[0-9]+[eE][+-]?[0-9]+)\\\\b\",comment:\"Floats are always decimal\"},{token:\"constant.numeric.haskell\",regex:\"\\\\b(?:[0-9]+|0(?:[xX][0-9a-fA-F]+|[oO][0-7]+))\\\\b\"},{token:[\"meta.preprocessor.c\",\"punctuation.definition.preprocessor.c\",\"meta.preprocessor.c\"],regex:\"^(\\\\s*)(#)(\\\\s*\\\\w+)\",comment:'In addition to Haskell\\'s \"native\" syntax, GHC permits the C preprocessor to be run on a source file.'},{include:\"#pragma\"},{token:\"punctuation.definition.string.begin.haskell\",regex:'\"',push:[{token:\"punctuation.definition.string.end.haskell\",regex:'\"',next:\"pop\"},{token:\"constant.character.escape.haskell\",regex:\"\\\\\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\\\\\\\\\\"'\\\\&])\"},{token:\"constant.character.escape.octal.haskell\",regex:\"\\\\\\\\o[0-7]+|\\\\\\\\x[0-9A-Fa-f]+|\\\\\\\\[0-9]+\"},{token:\"constant.character.escape.control.haskell\",regex:\"\\\\^[A-Z@\\\\[\\\\]\\\\\\\\\\\\^_]\"},{defaultToken:\"string.quoted.double.haskell\"}]},{token:[\"punctuation.definition.string.begin.haskell\",\"string.quoted.single.haskell\",\"constant.character.escape.haskell\",\"constant.character.escape.octal.haskell\",\"constant.character.escape.hexadecimal.haskell\",\"constant.character.escape.control.haskell\",\"punctuation.definition.string.end.haskell\"],regex:\"(')(?:([\\\\ -\\\\[\\\\]-~])|(\\\\\\\\(?:NUL|SOH|STX|ETX|EOT|ENQ|ACK|BEL|BS|HT|LF|VT|FF|CR|SO|SI|DLE|DC1|DC2|DC3|DC4|NAK|SYN|ETB|CAN|EM|SUB|ESC|FS|GS|RS|US|SP|DEL|[abfnrtv\\\\\\\\\\\\\\\"'\\\\&]))|(\\\\\\\\o[0-7]+)|(\\\\\\\\x[0-9A-Fa-f]+)|(\\\\^[A-Z@\\\\[\\\\]\\\\\\\\\\\\^_]))(')\"},{token:[\"meta.function.type-declaration.haskell\",\"entity.name.function.haskell\",\"meta.function.type-declaration.haskell\",\"keyword.other.double-colon.haskell\"],regex:\"^(\\\\s*)([a-z_][a-zA-Z0-9_']*|\\\\([|!%$+\\\\-.,=</>]+\\\\))(\\\\s*)(::)\",push:[{token:\"meta.function.type-declaration.haskell\",regex:\"$\",next:\"pop\"},{include:\"#type_signature\"},{defaultToken:\"meta.function.type-declaration.haskell\"}]},{token:\"support.constant.haskell\",regex:\"\\\\b(?:Just|Nothing|Left|Right|True|False|LT|EQ|GT|\\\\(\\\\)|\\\\[\\\\])\\\\b\"},{token:\"constant.other.haskell\",regex:\"\\\\b[A-Z]\\\\w*\\\\b\"},{include:\"#comments\"},{token:\"support.function.prelude.haskell\",regex:\"\\\\b(?:abs|acos|acosh|all|and|any|appendFile|applyM|asTypeOf|asin|asinh|atan|atan2|atanh|break|catch|ceiling|compare|concat|concatMap|const|cos|cosh|curry|cycle|decodeFloat|div|divMod|drop|dropWhile|elem|encodeFloat|enumFrom|enumFromThen|enumFromThenTo|enumFromTo|error|even|exp|exponent|fail|filter|flip|floatDigits|floatRadix|floatRange|floor|fmap|foldl|foldl1|foldr|foldr1|fromEnum|fromInteger|fromIntegral|fromRational|fst|gcd|getChar|getContents|getLine|head|id|init|interact|ioError|isDenormalized|isIEEE|isInfinite|isNaN|isNegativeZero|iterate|last|lcm|length|lex|lines|log|logBase|lookup|map|mapM|mapM_|max|maxBound|maximum|maybe|min|minBound|minimum|mod|negate|not|notElem|null|odd|or|otherwise|pi|pred|print|product|properFraction|putChar|putStr|putStrLn|quot|quotRem|read|readFile|readIO|readList|readLn|readParen|reads|readsPrec|realToFrac|recip|rem|repeat|replicate|return|reverse|round|scaleFloat|scanl|scanl1|scanr|scanr1|seq|sequence|sequence_|show|showChar|showList|showParen|showString|shows|showsPrec|significand|signum|sin|sinh|snd|span|splitAt|sqrt|subtract|succ|sum|tail|take|takeWhile|tan|tanh|toEnum|toInteger|toRational|truncate|uncurry|undefined|unlines|until|unwords|unzip|unzip3|userError|words|writeFile|zip|zip3|zipWith|zipWith3)\\\\b\"},{include:\"#infix_op\"},{token:\"keyword.operator.haskell\",regex:\"[|!%$?~+:\\\\-.=</>\\\\\\\\]+\",comment:\"In case this regex seems overly general, note that Haskell permits the definition of new operators which can be nearly any string of punctuation characters, such as $%^&*.\"},{token:\"punctuation.separator.comma.haskell\",regex:\",\"}],\"#block_comment\":[{token:\"punctuation.definition.comment.haskell\",regex:\"\\\\{-(?!#)\",push:[{include:\"#block_comment\"},{token:\"punctuation.definition.comment.haskell\",regex:\"-\\\\}\",next:\"pop\"},{defaultToken:\"comment.block.haskell\"}]}],\"#comments\":[{token:\"punctuation.definition.comment.haskell\",regex:\"--.*\",push_:[{token:\"comment.line.double-dash.haskell\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.double-dash.haskell\"}]},{include:\"#block_comment\"}],\"#infix_op\":[{token:\"entity.name.function.infix.haskell\",regex:\"\\\\([|!%$+:\\\\-.=</>]+\\\\)|\\\\(,+\\\\)\"}],\"#module_exports\":[{token:\"meta.declaration.exports.haskell\",regex:\"\\\\(\",push:[{token:\"meta.declaration.exports.haskell\",regex:\"\\\\)\",next:\"pop\"},{token:\"entity.name.function.haskell\",regex:\"\\\\b[a-z][a-zA-Z_']*\"},{token:\"storage.type.haskell\",regex:\"\\\\b[A-Z][A-Za-z_']*\"},{token:\"punctuation.separator.comma.haskell\",regex:\",\"},{include:\"#infix_op\"},{token:\"meta.other.unknown.haskell\",regex:\"\\\\(.*?\\\\)\",comment:\"So named because I don't know what to call this.\"},{defaultToken:\"meta.declaration.exports.haskell\"}]}],\"#module_name\":[{token:\"support.other.module.haskell\",regex:\"[A-Z][A-Za-z._']*\"}],\"#pragma\":[{token:\"meta.preprocessor.haskell\",regex:\"\\\\{-#\",push:[{token:\"meta.preprocessor.haskell\",regex:\"#-\\\\}\",next:\"pop\"},{token:\"keyword.other.preprocessor.haskell\",regex:\"\\\\b(?:LANGUAGE|UNPACK|INLINE)\\\\b\"},{defaultToken:\"meta.preprocessor.haskell\"}]}],\"#type_signature\":[{token:[\"meta.class-constraint.haskell\",\"entity.other.inherited-class.haskell\",\"meta.class-constraint.haskell\",\"variable.other.generic-type.haskell\",\"meta.class-constraint.haskell\",\"keyword.other.big-arrow.haskell\"],regex:\"(\\\\(\\\\s*)([A-Z][A-Za-z]*)(\\\\s+)([a-z][A-Za-z_']*)(\\\\)\\\\s*)(=>)\"},{include:\"#pragma\"},{token:\"keyword.other.arrow.haskell\",regex:\"->\"},{token:\"keyword.other.big-arrow.haskell\",regex:\"=>\"},{token:\"support.type.prelude.haskell\",regex:\"\\\\b(?:Int(?:eger)?|Maybe|Either|Bool|Float|Double|Char|String|Ordering|ShowS|ReadS|FilePath|IO(?:Error)?)\\\\b\"},{token:\"variable.other.generic-type.haskell\",regex:\"\\\\b[a-z][a-zA-Z0-9_']*\\\\b\"},{token:\"storage.type.haskell\",regex:\"\\\\b[A-Z][a-zA-Z0-9_']*\\\\b\"},{token:\"support.constant.unit.haskell\",regex:\"\\\\(\\\\)\"},{include:\"#comments\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"hs\"],keyEquivalent:\"^~H\",name:\"Haskell\",scopeName:\"source.haskell\"},r.inherits(s,i),t.HaskellHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-haxe.js",
    "content": "define(\"ace/mode/haxe\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/haxe_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./haxe_highlight_rules\").HaxeHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/haxe\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/haxe_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"break|case|cast|catch|class|continue|default|else|enum|extends|for|function|if|implements|import|in|inline|interface|new|override|package|private|public|return|static|super|switch|this|throw|trace|try|typedef|untyped|var|while|Array|Void|Bool|Int|UInt|Float|Dynamic|String|List|Hash|IntHash|Error|Unknown|Type|Std\",t=\"null|true|false\",n=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"constant.language\":t},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:n,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({<]\"},{token:\"paren.rparen\",regex:\"[\\\\])}>]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.HaxeHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-html.js",
    "content": "define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-html_completions.js",
    "content": "define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){var n=e.type.split(\".\");return t.split(\".\").every(function(e){return n.indexOf(e)!==-1})}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();if(!i||!f(i,\"tag\")&&(!f(i,\"text\")||!i.value.match(\"/\")))do i=n.stepBackward();while(i&&(f(i,\"string\")||f(i,\"operator\")||f(i,\"attribute-name\")||f(i,\"text\")));if(i&&f(i,\"tag-name\")&&!n.stepBackward().value.match(\"/\"))return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||i.value==\"<\"&&f(i,\"text\")?this.getTagCompletions(e,t,n,r):f(i,\"text\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){var i=a;return r&&(i=i.filter(function(e){return e.indexOf(r)===0})),i.map(function(e){return{value:e,meta:\"tag\"}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),r&&(s=s.filter(function(e){return e.indexOf(r)===0})),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\"}})}}).call(c.prototype),t.HtmlCompletions=c})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-html_ruby.js",
    "content": "define(\"ace/mode/html_ruby\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_ruby_highlight_rules\",\"ace/mode/html\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/ruby\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_ruby_highlight_rules\").HtmlRubyHighlightRules,s=e(\"./html\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./ruby\").Mode,f=function(){s.call(this),this.HighlightRules=i,this.createModeDelegates({\"js-\":o,\"css-\":u,\"ruby-\":a})};r.inherits(f,s),function(){this.$id=\"ace/mode/html_ruby\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/ruby_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.constantOtherSymbol={token:\"constant.other.symbol.ruby\",regex:\"[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?\"},o=t.qString={token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},u=t.qqString={token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},a=t.tString={token:\"string\",regex:\"[`](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[`]\"},f=t.constantNumericHex={token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\\\b\"},l=t.constantNumericFloat={token:\"constant.numeric\",regex:\"[+-]?\\\\d(?:\\\\d|_(?=\\\\d))*(?:(?:\\\\.\\\\d(?:\\\\d|_(?=\\\\d))*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},c=function(){var e=\"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|validates_inclusion_of|validates_numericality_of|validates_with|validates_each|authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|cache|expire_fragment|expire_cache_for|observe|cache_sweeper|has_many|has_one|belongs_to|has_and_belongs_to_many\",t=\"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield\",n=\"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING\",r=\"$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|$!|root_url|flash|session|cookies|params|request|response|logger|self\",i=this.$keywords=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"variable.language\":r,\"support.function\":e,\"invalid.deprecated\":\"debugger\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"comment\",regex:\"^=begin(?:$|\\\\s.*$)\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},o,u,a,{token:\"text\",regex:\"::\"},{token:\"variable.instance\",regex:\"@{1,2}[a-zA-Z_\\\\d]+\"},{token:\"support.class\",regex:\"[A-Z][a-zA-Z_\\\\d]+\"},s,f,l,{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"punctuation.separator.key-value\",regex:\"=>\"},{stateName:\"heredoc\",onMatch:function(e,t,n){var r=e[2]==\"-\"?\"indentedHeredoc\":\"heredoc\",i=e.split(this.splitRegex);return n.push(r,i[3]),[{type:\"constant\",value:i[1]},{type:\"string\",value:i[2]},{type:\"support.class\",value:i[3]},{type:\"string\",value:i[4]}]},regex:\"(<<-?)(['\\\"`]?)([\\\\w]+)(['\\\"`]?)\",rules:{heredoc:[{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}],indentedHeredoc:[{token:\"string\",regex:\"^ +\"},{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}]}},{regex:\"$\",token:\"empty\",next:function(e,t){return t[0]===\"heredoc\"||t[0]===\"indentedHeredoc\"?t[0]:e}},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\"^=end(?:$|\\\\s.*$)\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.normalizeRules()};r.inherits(c,i),t.RubyHighlightRules=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/ruby\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ruby_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ruby_highlight_rules\").RubyHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./folding/coffee\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/),u=t.match(/^\\s*(class|def|module)\\s.*$/),a=t.match(/.*do(\\s*|\\s+\\|.*\\|\\s*)$/),f=t.match(/^\\s*(if|else)\\s*/);if(o||u||a||f)r+=n}return r},this.checkOutdent=function(e,t,n){return/^\\s+end$/.test(t+n)||/^\\s+}$/.test(t+n)||/^\\s+else$/.test(t+n)},this.autoOutdent=function(e,t,n){var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new u(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/ruby\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/html_ruby_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\",\"ace/mode/ruby_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=e(\"./ruby_highlight_rules\").RubyHighlightRules,o=function(){i.call(this);var e=[{regex:\"<%%|%%>\",token:\"constant.language.escape\"},{token:\"comment.start.erb\",regex:\"<%#\",push:[{token:\"comment.end.erb\",regex:\"%>\",next:\"pop\",defaultToken:\"comment\"}]},{token:\"support.ruby_tag\",regex:\"<%+(?!>)[-=]?\",push:\"ruby-start\"}],t=[{token:\"support.ruby_tag\",regex:\"%>\",next:\"pop\"},{token:\"comment\",regex:\"#(?:[^%]|%[^>])*\"}];for(var n in this.$rules)this.$rules[n].unshift.apply(this.$rules[n],e);this.embedRules(s,\"ruby-\",t,[\"start\"]),this.normalizeRules()};r.inherits(o,i),t.HtmlRubyHighlightRules=o}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ini.js",
    "content": "define(\"ace/mode/ini\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ini_highlight_rules\",\"ace/mode/folding/ini\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ini_highlight_rules\").IniHighlightRules,o=e(\"./folding/ini\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\";\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/ini\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/ini_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=\"\\\\\\\\(?:[\\\\\\\\0abtrn;#=:]|x[a-fA-F\\\\d]{4})\",o=function(){this.$rules={start:[{token:\"punctuation.definition.comment.ini\",regex:\"#.*\",push_:[{token:\"comment.line.number-sign.ini\",regex:\"$|^\",next:\"pop\"},{defaultToken:\"comment.line.number-sign.ini\"}]},{token:\"punctuation.definition.comment.ini\",regex:\";.*\",push_:[{token:\"comment.line.semicolon.ini\",regex:\"$|^\",next:\"pop\"},{defaultToken:\"comment.line.semicolon.ini\"}]},{token:[\"keyword.other.definition.ini\",\"text\",\"punctuation.separator.key-value.ini\"],regex:\"\\\\b([a-zA-Z0-9_.-]+)\\\\b(\\\\s*)(=)\"},{token:[\"punctuation.definition.entity.ini\",\"constant.section.group-title.ini\",\"punctuation.definition.entity.ini\"],regex:\"^(\\\\[)(.*?)(\\\\])\"},{token:\"punctuation.definition.string.begin.ini\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.ini\",regex:\"'\",next:\"pop\"},{token:\"constant.language.escape\",regex:s},{defaultToken:\"string.quoted.single.ini\"}]},{token:\"punctuation.definition.string.begin.ini\",regex:'\"',push:[{token:\"constant.language.escape\",regex:s},{token:\"punctuation.definition.string.end.ini\",regex:'\"',next:\"pop\"},{defaultToken:\"string.quoted.double.ini\"}]}]},this.normalizeRules()};o.metaData={fileTypes:[\"ini\",\"conf\"],keyEquivalent:\"^~I\",name:\"Ini\",scopeName:\"source.ini\"},r.inherits(o,i),t.IniHighlightRules=o}),define(\"ace/mode/folding/ini\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^\\s*\\[([^\\])]*)]\\s*(?:$|[;#])/,this.getFoldWidgetRange=function(e,t,n){var r=this.foldingStartMarker,s=e.getLine(n),o=s.match(r);if(!o)return;var u=o[1]+\".\",a=s.length,f=e.getLength(),l=n,c=n;while(++n<f){s=e.getLine(n);if(/^\\s*$/.test(s))continue;o=s.match(r);if(o&&o[1].lastIndexOf(u,0)!==0)break;c=n}if(c>l){var h=e.getLine(c).length;return new i(l,a,c,h)}}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-jack.js",
    "content": "define(\"ace/mode/jack\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/jack_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./jack_highlight_rules\").JackHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"--\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e==\"start\"){var i=t.match(/^.*[\\{\\(\\[]\\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/jack\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/jack_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"string\",regex:'\"',next:\"string2\"},{token:\"string\",regex:\"'\",next:\"string1\"},{token:\"constant.numeric\",regex:\"-?0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"(?:0|[-+]?[1-9][0-9]*)\\\\b\"},{token:\"constant.binary\",regex:\"<[0-9A-Fa-f][0-9A-Fa-f](\\\\s+[0-9A-Fa-f][0-9A-Fa-f])*>\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:\"constant.language.null\",regex:\"null\\\\b\"},{token:\"storage.type\",regex:\"(?:Integer|Boolean|Null|String|Buffer|Tuple|List|Object|Function|Coroutine|Form)\\\\b\"},{token:\"keyword\",regex:\"(?:return|abort|vars|for|delete|in|is|escape|exec|split|and|if|elif|else|while)\\\\b\"},{token:\"language.builtin\",regex:\"(?:lines|source|parse|read-stream|interval|substr|parseint|write|print|range|rand|inspect|bind|i-values|i-pairs|i-map|i-filter|i-chunk|i-all\\\\?|i-any\\\\?|i-collect|i-zip|i-merge|i-each)\\\\b\"},{token:\"comment\",regex:\"--.*$\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"storage.form\",regex:\"@[a-z]+\"},{token:\"constant.other.symbol\",regex:\":+[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?\"},{token:\"variable\",regex:\"[a-zA-Z_]([-]?[a-zA-Z0-9_])*[?!]?\"},{token:\"keyword.operator\",regex:\"\\\\|\\\\||\\\\^\\\\^|&&|!=|==|<=|<|>=|>|\\\\+|-|\\\\*|\\\\/|\\\\^|\\\\%|\\\\#|\\\\!\"},{token:\"text\",regex:\"\\\\s+\"}],string1:[{token:\"constant.language.escape\",regex:/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['\"\\\\\\/bfnrt])/},{token:\"string\",regex:\"[^'\\\\\\\\]+\"},{token:\"string\",regex:\"'\",next:\"start\"},{token:\"string\",regex:\"\",next:\"start\"}],string2:[{token:\"constant.language.escape\",regex:/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|['\"\\\\\\/bfnrt])/},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:'\"',next:\"start\"},{token:\"string\",regex:\"\",next:\"start\"}]}};r.inherits(s,i),t.JackHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-jade.js",
    "content": "define(\"ace/mode/jade\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/jade_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./jade_highlight_rules\").JadeHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.$id=\"ace/mode/jade\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/markdown_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\",\"ace/mode/html_highlight_rules\",\"ace/mode/css_highlight_rules\"],function(e,t,n){function c(e,t){return{token:\"support.function\",regex:\"^\\\\s*```\"+e+\"\\\\s*$\",push:t+\"start\"}}var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./css_highlight_rules\").CssHighlightRules,l=function(e){return\"(?:[^\"+i.escapeRegExp(e)+\"\\\\\\\\]|\\\\\\\\.)*\"},h=function(){a.call(this),this.$rules.start.unshift({token:\"empty_line\",regex:\"^$\",next:\"allowBlock\"},{token:\"markup.heading.1\",regex:\"^=+(?=\\\\s*$)\"},{token:\"markup.heading.2\",regex:\"^\\\\-+(?=\\\\s*$)\"},{token:function(e){return\"markup.heading.\"+e.length},regex:/^#{1,6}(?=\\s*[^ #]|\\s+#.)/,next:\"header\"},c(\"(?:javascript|js)\",\"jscode-\"),c(\"xml\",\"xmlcode-\"),c(\"html\",\"htmlcode-\"),c(\"css\",\"csscode-\"),{token:\"support.function\",regex:\"^\\\\s*```\\\\s*\\\\S*(?:{.*?\\\\})?\\\\s*$\",next:\"githubblock\"},{token:\"string.blockquote\",regex:\"^\\\\s*>\\\\s*(?:[*+-]|\\\\d+\\\\.)?\\\\s+\",next:\"blockquote\"},{token:\"constant\",regex:\"^ {0,2}(?:(?: ?\\\\* ?){3,}|(?: ?\\\\- ?){3,}|(?: ?\\\\_ ?){3,})\\\\s*$\",next:\"allowBlock\"},{token:\"markup.list\",regex:\"^\\\\s{0,3}(?:[*+-]|\\\\d+\\\\.)\\\\s+\",next:\"listblock-start\"},{include:\"basic\"}),this.addRules({basic:[{token:\"constant.language.escape\",regex:/\\\\[\\\\`*_{}\\[\\]()#+\\-.!]/},{token:\"support.function\",regex:\"(`+)(.*?[^`])(\\\\1)\"},{token:[\"text\",\"constant\",\"text\",\"url\",\"string\",\"text\"],regex:'^([ ]{0,3}\\\\[)([^\\\\]]+)(\\\\]:\\\\s*)([^ ]+)(\\\\s*(?:[\"][^\"]+[\"])?(\\\\s*))$'},{token:[\"text\",\"string\",\"text\",\"constant\",\"text\"],regex:\"(\\\\[)(\"+l(\"]\")+\")(\\\\]s*\\\\[)(\"+l(\"]\")+\")(\\\\])\"},{token:[\"text\",\"string\",\"text\",\"markup.underline\",\"string\",\"text\"],regex:\"(\\\\[)(\"+l(\"]\")+\")(\\\\]\\\\()\"+'((?:[^\\\\)\\\\s\\\\\\\\]|\\\\\\\\.|\\\\s(?=[^\"]))*)'+'(\\\\s*\"'+l('\"')+'\"\\\\s*)?'+\"(\\\\))\"},{token:\"string.strong\",regex:\"([*]{2}|[_]{2}(?=\\\\S))(.*?\\\\S[*_]*)(\\\\1)\"},{token:\"string.emphasis\",regex:\"([*]|[_](?=\\\\S))(.*?\\\\S[*_]*)(\\\\1)\"},{token:[\"text\",\"url\",\"text\"],regex:\"(<)((?:https?|ftp|dict):[^'\\\">\\\\s]+|(?:mailto:)?[-.\\\\w]+\\\\@[-a-z0-9]+(?:\\\\.[-a-z0-9]+)*\\\\.[a-z]+)(>)\"}],allowBlock:[{token:\"support.function\",regex:\"^ {4}.+\",next:\"allowBlock\"},{token:\"empty\",regex:\"\",next:\"start\"}],header:[{regex:\"$\",next:\"start\"},{include:\"basic\"},{defaultToken:\"heading\"}],\"listblock-start\":[{token:\"support.variable\",regex:/(?:\\[[ x]\\])?/,next:\"listblock\"}],listblock:[{token:\"empty_line\",regex:\"^$\",next:\"start\"},{token:\"markup.list\",regex:\"^\\\\s{0,3}(?:[*+-]|\\\\d+\\\\.)\\\\s+\",next:\"listblock-start\"},{include:\"basic\",noEscape:!0},{token:\"support.function\",regex:\"^\\\\s*```\\\\s*[a-zA-Z]*(?:{.*?\\\\})?\\\\s*$\",next:\"githubblock\"},{defaultToken:\"list\"}],blockquote:[{token:\"empty_line\",regex:\"^\\\\s*$\",next:\"start\"},{token:\"string.blockquote\",regex:\"^\\\\s*>\\\\s*(?:[*+-]|\\\\d+\\\\.)?\\\\s+\",next:\"blockquote\"},{include:\"basic\",noEscape:!0},{defaultToken:\"string.blockquote\"}],githubblock:[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"start\"},{token:\"support.function\",regex:\".+\"}]}),this.embedRules(o,\"jscode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(a,\"htmlcode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(f,\"csscode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(u,\"xmlcode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.normalizeRules()};r.inherits(h,s),t.MarkdownHighlightRules=h}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/jade_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\",\"ace/mode/markdown_highlight_rules\",\"ace/mode/scss_highlight_rules\",\"ace/mode/less_highlight_rules\",\"ace/mode/coffee_highlight_rules\",\"ace/mode/javascript_highlight_rules\"],function(e,t,n){function l(e,t){return{token:\"entity.name.function.jade\",regex:\"^\\\\s*\\\\:\"+e,next:t+\"start\"}}var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./markdown_highlight_rules\").MarkdownHighlightRules,o=e(\"./scss_highlight_rules\").ScssHighlightRules,u=e(\"./less_highlight_rules\").LessHighlightRules,a=e(\"./coffee_highlight_rules\").CoffeeHighlightRules,f=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,c=function(){var e=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={start:[{token:\"keyword.control.import.include.jade\",regex:\"\\\\s*\\\\binclude\\\\b\"},{token:\"keyword.other.doctype.jade\",regex:\"^!!!\\\\s*(?:[a-zA-Z0-9-_]+)?\"},{token:\"punctuation.section.comment\",regex:\"^\\\\s*//(?:\\\\s*[^-\\\\s]|\\\\s+\\\\S)(?:.*$)\"},{onMatch:function(e,t,n){return n.unshift(this.next,e.length-2,t),\"comment\"},regex:/^\\s*\\/\\//,next:\"comment_block\"},l(\"markdown\",\"markdown-\"),l(\"sass\",\"sass-\"),l(\"less\",\"less-\"),l(\"coffee\",\"coffee-\"),{token:[\"storage.type.function.jade\",\"entity.name.function.jade\",\"punctuation.definition.parameters.begin.jade\",\"variable.parameter.function.jade\",\"punctuation.definition.parameters.end.jade\"],regex:\"^(\\\\s*mixin)( [\\\\w\\\\-]+)(\\\\s*\\\\()(.*?)(\\\\))\"},{token:[\"storage.type.function.jade\",\"entity.name.function.jade\"],regex:\"^(\\\\s*mixin)( [\\\\w\\\\-]+)\"},{token:\"source.js.embedded.jade\",regex:\"^\\\\s*(?:-|=|!=)\",next:\"js-start\"},{token:\"string.interpolated.jade\",regex:\"[#!]\\\\{[^\\\\}]+\\\\}\"},{token:\"meta.tag.any.jade\",regex:/^\\s*(?!\\w+\\:)(?:[\\w]+|(?=\\.|#)])/,next:\"tag_single\"},{token:\"suport.type.attribute.id.jade\",regex:\"#\\\\w+\"},{token:\"suport.type.attribute.class.jade\",regex:\"\\\\.\\\\w+\"},{token:\"punctuation\",regex:\"\\\\s*(?:\\\\()\",next:\"tag_attributes\"}],comment_block:[{regex:/^\\s*/,onMatch:function(e,t,n){return e.length<=n[1]?(n.shift(),n.shift(),this.next=n.shift(),\"text\"):(this.next=\"\",\"comment\")},next:\"start\"},{defaultToken:\"comment\"}],tag_single:[{token:\"entity.other.attribute-name.class.jade\",regex:\"\\\\.[\\\\w-]+\"},{token:\"entity.other.attribute-name.id.jade\",regex:\"#[\\\\w-]+\"},{token:[\"text\",\"punctuation\"],regex:\"($)|((?!\\\\.|#|=|-))\",next:\"start\"}],tag_attributes:[{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"entity.other.attribute-name.jade\",regex:\"\\\\b[a-zA-Z\\\\-:]+\"},{token:[\"entity.other.attribute-name.jade\",\"punctuation\"],regex:\"\\\\b([a-zA-Z:\\\\.-]+)(=)\",next:\"attribute_strings\"},{token:\"punctuation\",regex:\"\\\\)\",next:\"start\"}],attribute_strings:[{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"}],qqstring:[{token:\"constant.language.escape\",regex:e},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"tag_attributes\"}],qstring:[{token:\"constant.language.escape\",regex:e},{token:\"string\",regex:\"[^'\\\\\\\\]+\"},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"tag_attributes\"}]},this.embedRules(f,\"js-\",[{token:\"text\",regex:\".$\",next:\"start\"}])};r.inherits(c,i),t.JadeHighlightRules=c}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/scss_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=i.arrayToMap(function(){var e=\"-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-\".split(\"|\"),t=\"appearance|background-clip|background-inline-policy|background-origin|background-size|binding|border-bottom-colors|border-left-colors|border-right-colors|border-top-colors|border-end|border-end-color|border-end-style|border-end-width|border-image|border-start|border-start-color|border-start-style|border-start-width|box-align|box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|box-pack|box-sizing|column-count|column-gap|column-width|column-rule|column-rule-width|column-rule-style|column-rule-color|float-edge|font-feature-settings|font-language-override|force-broken-image-icon|image-region|margin-end|margin-start|opacity|outline|outline-color|outline-offset|outline-radius|outline-radius-bottomleft|outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|outline-style|outline-width|padding-end|padding-start|stack-sizing|tab-size|text-blink|text-decoration-color|text-decoration-line|text-decoration-style|transform|transform-origin|transition|transition-delay|transition-duration|transition-property|transition-timing-function|user-focus|user-input|user-modify|user-select|window-shadow|border-radius\".split(\"|\"),n=\"azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index\".split(\"|\"),r=[];for(var i=0,s=e.length;i<s;i++)Array.prototype.push.apply(r,(e[i]+t.join(\"|\"+e[i])).split(\"|\"));return Array.prototype.push.apply(r,t),Array.prototype.push.apply(r,n),r}()),t=i.arrayToMap(\"hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|scale_color|transparentize|type_of|unit|unitless|unqoute\".split(\"|\")),n=i.arrayToMap(\"absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero\".split(\"|\")),r=i.arrayToMap(\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\".split(\"|\")),s=i.arrayToMap(\"@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare\".split(\"|\")),o=i.arrayToMap(\"a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp\".split(\"|\")),u=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:u+\"(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:\"constant.numeric\",regex:u},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:function(i){return e.hasOwnProperty(i.toLowerCase())?\"support.type\":s.hasOwnProperty(i)?\"keyword\":n.hasOwnProperty(i)?\"constant.language\":t.hasOwnProperty(i)?\"support.function\":r.hasOwnProperty(i.toLowerCase())?\"support.constant.color\":o.hasOwnProperty(i.toLowerCase())?\"variable.language\":\"text\"},regex:\"\\\\-?[@a-z_][@a-z0-9_\\\\-]*\"},{token:\"variable\",regex:\"[a-z_\\\\-$][a-z0-9_\\\\-$]*\\\\b\"},{token:\"variable.language\",regex:\"#[a-z0-9-_]+\"},{token:\"variable.language\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"variable.language\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{token:\"keyword.operator\",regex:\"<|>|<=|>=|==|!=|-|%|#|\\\\+|\\\\$|\\\\+|\\\\*\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(o,s),t.ScssHighlightRules=o}),define(\"ace/mode/less_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=i.arrayToMap(function(){var e=\"-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-\".split(\"|\"),t=\"appearance|background-clip|background-inline-policy|background-origin|background-size|binding|border-bottom-colors|border-left-colors|border-right-colors|border-top-colors|border-end|border-end-color|border-end-style|border-end-width|border-image|border-start|border-start-color|border-start-style|border-start-width|box-align|box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|box-pack|box-sizing|column-count|column-gap|column-width|column-rule|column-rule-width|column-rule-style|column-rule-color|float-edge|font-feature-settings|font-language-override|force-broken-image-icon|image-region|margin-end|margin-start|opacity|outline|outline-color|outline-offset|outline-radius|outline-radius-bottomleft|outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|outline-style|outline-width|padding-end|padding-start|stack-sizing|tab-size|text-blink|text-decoration-color|text-decoration-line|text-decoration-style|transform|transform-origin|transition|transition-delay|transition-duration|transition-property|transition-timing-function|user-focus|user-input|user-modify|user-select|window-shadow|border-radius\".split(\"|\"),n=\"azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index\".split(\"|\"),r=[];for(var i=0,s=e.length;i<s;i++)Array.prototype.push.apply(r,(e[i]+t.join(\"|\"+e[i])).split(\"|\"));return Array.prototype.push.apply(r,t),Array.prototype.push.apply(r,n),r}()),t=i.arrayToMap(\"hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|iskeyword|isurl|ispixel|ispercentage|isem\".split(\"|\")),n=i.arrayToMap(\"absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero\".split(\"|\")),r=i.arrayToMap(\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\".split(\"|\")),s=i.arrayToMap(\"@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare|when|not|and\".split(\"|\")),o=i.arrayToMap(\"a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp\".split(\"|\")),u=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:u+\"(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:\"constant.numeric\",regex:u},{token:function(e){return s.hasOwnProperty(e)?\"keyword\":\"variable\"},regex:\"@[a-z0-9_\\\\-@]*\\\\b\"},{token:function(i){return e.hasOwnProperty(i.toLowerCase())?\"support.type\":s.hasOwnProperty(i)?\"keyword\":n.hasOwnProperty(i)?\"constant.language\":t.hasOwnProperty(i)?\"support.function\":r.hasOwnProperty(i.toLowerCase())?\"support.constant.color\":o.hasOwnProperty(i.toLowerCase())?\"variable.language\":\"text\"},regex:\"\\\\-?[@a-z_][@a-z0-9_\\\\-]*\"},{token:\"variable.language\",regex:\"#[a-z0-9-_]+\"},{token:\"variable.language\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"variable.language\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{token:\"keyword.operator\",regex:\"<|>|<=|>=|==|!=|-|%|#|\\\\+|\\\\$|\\\\+|\\\\*\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]}};r.inherits(o,s),t.LessHighlightRules=o}),define(\"ace/mode/coffee_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){function s(){var e=\"[$A-Za-z_\\\\x7f-\\\\uffff][$\\\\w\\\\x7f-\\\\uffff]*\",t=\"this|throw|then|try|typeof|super|switch|return|break|by|continue|catch|class|in|instanceof|is|isnt|if|else|extends|for|own|finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|or|on|unless|until|and|yes\",n=\"true|false|null|undefined|NaN|Infinity\",r=\"case|const|default|function|var|void|with|enum|export|implements|interface|let|package|private|protected|public|static|yield|__hasProp|slice|bind|indexOf\",i=\"Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray\",s=\"Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|encodeURIComponent|decodeURI|decodeURIComponent|String|\",o=\"window|arguments|prototype|document\",u=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"invalid.illegal\":r,\"language.support.class\":i,\"language.support.function\":s,\"variable.language\":o},\"identifier\"),a={token:[\"paren.lparen\",\"variable.parameter\",\"paren.rparen\",\"text\",\"storage.type\"],regex:/(?:(\\()((?:\"[^\")]*?\"|'[^')]*?'|\\/[^\\/)]*?\\/|[^()\\\"'\\/])*?)(\\))(\\s*))?([\\-=]>)/.source},f=/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/;this.$rules={start:[{token:\"constant.numeric\",regex:\"(?:0x[\\\\da-fA-F]+|(?:\\\\d+(?:\\\\.\\\\d+)?|\\\\.\\\\d+)(?:[eE][+-]?\\\\d+)?)\"},{stateName:\"qdoc\",token:\"string\",regex:\"'''\",next:[{token:\"string\",regex:\"'''\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qqdoc\",token:\"string\",regex:'\"\"\"',next:[{token:\"string\",regex:'\"\"\"',next:\"start\"},{token:\"paren.string\",regex:\"#{\",push:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qstring\",token:\"string\",regex:\"'\",next:[{token:\"string\",regex:\"'\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"qqstring\",token:\"string.start\",regex:'\"',next:[{token:\"string.end\",regex:'\"',next:\"start\"},{token:\"paren.string\",regex:\"#{\",push:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{stateName:\"js\",token:\"string\",regex:\"`\",next:[{token:\"string\",regex:\"`\",next:\"start\"},{token:\"constant.language.escape\",regex:f},{defaultToken:\"string\"}]},{regex:\"[{}]\",onMatch:function(e,t,n){this.next=\"\";if(e==\"{\"&&n.length)return n.unshift(\"start\",t),\"paren\";if(e==\"}\"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf(\"string\")!=-1)return\"paren.string\"}return\"paren\"}},{token:\"string.regex\",regex:\"///\",next:\"heregex\"},{token:\"string.regex\",regex:/(?:\\/(?![\\s=])[^[\\/\\n\\\\]*(?:(?:\\\\[\\s\\S]|\\[[^\\]\\n\\\\]*(?:\\\\[\\s\\S][^\\]\\n\\\\]*)*])[^[\\/\\n\\\\]*)*\\/)(?:[imgy]{0,4})(?!\\w)/},{token:\"comment\",regex:\"###(?!#)\",next:\"comment\"},{token:\"comment\",regex:\"#.*\"},{token:[\"punctuation.operator\",\"text\",\"identifier\"],regex:\"(\\\\.)(\\\\s*)(\"+r+\")\"},{token:\"punctuation.operator\",regex:\"\\\\.\"},{token:[\"keyword\",\"text\",\"language.support.class\",\"text\",\"keyword\",\"text\",\"language.support.class\"],regex:\"(class)(\\\\s+)(\"+e+\")(?:(\\\\s+)(extends)(\\\\s+)(\"+e+\"))?\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\"].concat(a.token),regex:\"(\"+e+\")(\\\\s*)([=:])(\\\\s*)\"+a.regex},a,{token:\"variable\",regex:\"@(?:\"+e+\")?\"},{token:u,regex:e},{token:\"punctuation.operator\",regex:\"\\\\,|\\\\.\"},{token:\"storage.type\",regex:\"[\\\\-=]>\"},{token:\"keyword.operator\",regex:\"(?:[-+*/%<>&|^!?=]=|>>>=?|\\\\-\\\\-|\\\\+\\\\+|::|&&=|\\\\|\\\\|=|<<=|>>=|\\\\?\\\\.|\\\\.{2,3}|[!*+-=><])\"},{token:\"paren.lparen\",regex:\"[({[]\"},{token:\"paren.rparen\",regex:\"[\\\\]})]\"},{token:\"text\",regex:\"\\\\s+\"}],heregex:[{token:\"string.regex\",regex:\".*?///[imgy]{0,4}\",next:\"start\"},{token:\"comment.regex\",regex:\"\\\\s+(?:#.*)?\"},{token:\"string.regex\",regex:\"\\\\S+\"}],comment:[{token:\"comment\",regex:\"###\",next:\"start\"},{defaultToken:\"comment\"}]},this.normalizeRules()}var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules;r.inherits(s,i),t.CoffeeHighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-java.js",
    "content": "define(\"ace/mode/java\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript\",\"ace/mode/java_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript\").Mode,s=e(\"./java_highlight_rules\").JavaHighlightRules,o=function(){i.call(this),this.HighlightRules=s};r.inherits(o,i),function(){this.createWorker=function(e){return null},this.$id=\"ace/mode/java\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/java_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while\",t=\"null|Infinity|NaN|undefined\",n=\"AbstractMethodError|AssertionError|ClassCircularityError|ClassFormatError|Deprecated|EnumConstantNotPresentException|ExceptionInInitializerError|IllegalAccessError|IllegalThreadStateException|InstantiationError|InternalError|NegativeArraySizeException|NoSuchFieldError|Override|Process|ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|SuppressWarnings|TypeNotPresentException|UnknownError|UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|InstantiationException|IndexOutOfBoundsException|ArrayIndexOutOfBoundsException|CloneNotSupportedException|NoSuchFieldException|IllegalArgumentException|NumberFormatException|SecurityException|Void|InheritableThreadLocal|IllegalStateException|InterruptedException|NoSuchMethodException|IllegalAccessException|UnsupportedOperationException|Enum|StrictMath|Package|Compiler|Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|Character|Boolean|StackTraceElement|Appendable|StringBuffer|Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|StackOverflowError|OutOfMemoryError|VirtualMachineError|ArrayStoreException|ClassCastException|LinkageError|NoClassDefFoundError|ClassNotFoundException|RuntimeException|Exception|ThreadDeath|Error|Throwable|System|ClassLoader|Cloneable|Class|CharSequence|Comparable|String|Object\",r=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"constant.language\":t,\"support.function\":n},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.JavaHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-javascript.js",
    "content": "define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-json.js",
    "content": "define(\"ace/mode/json\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/json_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./json_highlight_rules\").JsonHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=e(\"../worker/worker_client\").WorkerClient,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e==\"start\"){var i=t.match(/^.*[\\{\\(\\[]\\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f([\"ace\"],\"ace/mode/json_worker\",\"JsonWorker\");return t.attachToDocument(e.getDocument()),t.on(\"error\",function(t){e.setAnnotations([t.data])}),t.on(\"ok\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/json\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/json_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"variable\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]\\\\s*(?=:)'},{token:\"string\",regex:'\"',next:\"string\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:\"invalid.illegal\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"invalid.illegal\",regex:\"\\\\/\\\\/.*$\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],string:[{token:\"constant.language.escape\",regex:/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[\"\\\\\\/bfnrt])/},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:'\"',next:\"start\"},{token:\"string\",regex:\"\",next:\"start\"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-jsoniq.js",
    "content": "define(\"ace/mode/jsoniq\",[\"require\",\"exports\",\"module\",\"ace/worker/worker_client\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/xquery/jsoniq_lexer\",\"ace/range\",\"ace/mode/behaviour/xquery\",\"ace/mode/folding/cstyle\",\"ace/anchor\",\"ace/ext/language_tools\"],function(e,t,n){var r=e(\"../worker/worker_client\").WorkerClient,i=e(\"../lib/oop\"),s=e(\"./text\").Mode,o=e(\"./text_highlight_rules\").TextHighlightRules,u=e(\"./xquery/jsoniq_lexer\").JSONiqLexer,a=e(\"../range\").Range,f=e(\"./behaviour/xquery\").XQueryBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=e(\"../anchor\").Anchor,h=e(\"../ext/language_tools\"),p=function(){this.$tokenizer=new u,this.$behaviour=new f,this.foldingRules=new l,this.$highlightRules=new o};i.inherits(p,s),function(){h.addCompleter({getCompletions:function(e,t,n,r,i){t.$worker.emit(\"complete\",{data:{pos:n,prefix:r}}),t.$worker.on(\"complete\",function(e){i(null,e.data)})}}),this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=t.match(/\\s*(?:then|else|return|[{\\(]|<\\w+>)\\s*$/);return i&&(r+=n),r},this.checkOutdent=function(e,t,n){return/^\\s+$/.test(t)?/^\\s*[\\}\\)]/.test(n):!1},this.autoOutdent=function(e,t,n){var r=t.getLine(n),i=r.match(/^(\\s*[\\}\\)])/);if(!i)return 0;var s=i[1].length,o=t.findMatchingBracket({row:n,column:s});if(!o||o.row==n)return 0;var u=this.$getIndent(t.getLine(o.row));t.replace(new a(n,0,n,s-1),u)},this.toggleCommentLines=function(e,t,n,r){var i,s,o=!0,u=/^\\s*\\(:(.*):\\)/;for(i=n;i<=r;i++)if(!u.test(t.getLine(i))){o=!1;break}var f=new a(0,0,0,0);for(i=n;i<=r;i++)s=t.getLine(i),f.start.row=i,f.end.row=i,f.end.column=s.length,t.replace(f,o?s.match(u)[1]:\"(:\"+s+\":)\")},this.createWorker=function(e){var t=new r([\"ace\"],\"ace/mode/xquery_worker\",\"XQueryWorker\"),n=this;return t.attachToDocument(e.getDocument()),t.on(\"ok\",function(t){e.clearAnnotations()}),t.on(\"markers\",function(t){e.clearAnnotations(),n.addMarkers(t.data,e)}),t},this.removeMarkers=function(e){var t=e.getMarkers(!1);for(var n in t)t[n].clazz.indexOf(\"language_highlight_\")===0&&e.removeMarker(n);for(var r=0;r<e.markerAnchors.length;r++)e.markerAnchors[r].detach();e.markerAnchors=[]},this.addMarkers=function(e,t){var n=this;t.markerAnchors||(t.markerAnchors=[]),this.removeMarkers(t),t.languageAnnos=[],e.forEach(function(e){function u(i){r&&t.removeMarker(r),o.row=n.row;if(e.pos.sc!==undefined&&e.pos.ec!==undefined){var s=new a(e.pos.sl,e.pos.sc,e.pos.el,e.pos.ec);r=t.addMarker(s,\"language_highlight_\"+(e.type?e.type:\"default\"))}i&&t.setAnnotations(t.languageAnnos)}var n=new c(t.getDocument(),e.pos.sl,e.pos.sc||0);t.markerAnchors.push(n);var r,i=e.pos.ec-e.pos.sc,s=e.pos.el-e.pos.sl,o={guttertext:e.message,type:e.level||\"warning\",text:e.message};u(),n.on(\"change\",function(){u(!0)}),e.message&&t.languageAnnos.push(o)}),t.setAnnotations(t.languageAnnos)},this.$id=\"ace/mode/jsoniq\"}.call(p.prototype),t.Mode=p}),define(\"ace/mode/behaviour/xquery\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/mode/behaviour/xml\",\"ace/token_iterator\"],function(e,t,n){function a(e,t){var n=!0,r=e.type.split(\".\"),i=t.split(\".\");return i.forEach(function(e){if(r.indexOf(e)==-1)return n=!1,!1}),n}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../behaviour/xml\").XmlBehaviour,u=e(\"../../token_iterator\").TokenIterator,f=function(){this.inherit(s,[\"braces\",\"parens\",\"string_dquotes\"]),this.inherit(o),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var s=n.getCursorPosition(),o=new u(r,s.row,s.column),f=o.getCurrentToken(),l=!1,e=JSON.parse(e).pop();if(f&&f.value===\">\"||e!==\"StartTag\")return;if(!f||!a(f,\"meta.tag\")&&(!a(f,\"text\")||!f.value.match(\"/\"))){do f=o.stepBackward();while(f&&(a(f,\"string\")||a(f,\"keyword.operator\")||a(f,\"entity.attribute-name\")||a(f,\"text\")))}else l=!0;var c=o.stepBackward();if(!f||!a(f,\"meta.tag\")||c!==null&&c.value.match(\"/\"))return;var h=f.value.substring(1);if(l)var h=h.substring(0,s.column-f.start);return{text:\"></\"+h+\">\",selection:[1,1]}}})};r.inherits(f,i),t.XQueryBehaviour=f}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/xquery/jsoniq_lexer\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports=function r(t,n,i){function s(u,a){if(!n[u]){if(!t[u]){var f=typeof e==\"function\"&&e;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error(\"Cannot find module '\"+u+\"'\")}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return s(n?n:e)},l,l.exports,r,t,n,i)}return n[u].exports}var o=typeof e==\"function\"&&e;for(var u=0;u<i.length;u++)s(i[u]);return s}({1:[function(e,t,n){var r=n.JSONiqTokenizer=function i(e,t){function r(e,t){E=t,S=e,x=e.length,s(0,0,0)}function s(e,t,n){m=t,g=t,y=e,b=t,w=n,N=n,E.reset(S)}function o(){E.startNonterminal(\"EQName\",g);switch(y){case 80:f(80);break;case 94:f(94);break;case 118:f(118);break;case 119:f(119);break;case 122:f(122);break;case 143:f(143);break;case 150:f(150);break;case 163:f(163);break;case 183:f(183);break;case 189:f(189);break;case 214:f(214);break;case 224:f(224);break;case 225:f(225);break;case 241:f(241);break;case 242:f(242);break;case 251:f(251);break;default:u()}E.endNonterminal(\"EQName\",g)}function u(){E.startNonterminal(\"FunctionName\",g);switch(y){case 17:f(17);break;case 68:f(68);break;case 71:f(71);break;case 72:f(72);break;case 73:f(73);break;case 77:f(77);break;case 78:f(78);break;case 82:f(82);break;case 86:f(86);break;case 87:f(87);break;case 88:f(88);break;case 91:f(91);break;case 92:f(92);break;case 101:f(101);break;case 103:f(103);break;case 106:f(106);break;case 107:f(107);break;case 108:f(108);break;case 109:f(109);break;case 110:f(110);break;case 111:f(111);break;case 116:f(116);break;case 117:f(117);break;case 120:f(120);break;case 121:f(121);break;case 124:f(124);break;case 126:f(126);break;case 127:f(127);break;case 129:f(129);break;case 132:f(132);break;case 133:f(133);break;case 134:f(134);break;case 135:f(135);break;case 144:f(144);break;case 146:f(146);break;case 148:f(148);break;case 149:f(149);break;case 151:f(151);break;case 157:f(157);break;case 158:f(158);break;case 160:f(160);break;case 161:f(161);break;case 162:f(162);break;case 168:f(168);break;case 170:f(170);break;case 172:f(172);break;case 176:f(176);break;case 178:f(178);break;case 179:f(179);break;case 180:f(180);break;case 182:f(182);break;case 184:f(184);break;case 196:f(196);break;case 198:f(198);break;case 199:f(199);break;case 200:f(200);break;case 204:f(204);break;case 210:f(210);break;case 211:f(211);break;case 216:f(216);break;case 217:f(217);break;case 218:f(218);break;case 222:f(222);break;case 227:f(227);break;case 233:f(233);break;case 234:f(234);break;case 235:f(235);break;case 246:f(246);break;case 247:f(247);break;case 248:f(248);break;case 252:f(252);break;case 254:f(254);break;case 258:f(258);break;case 264:f(264);break;case 268:f(268);break;case 272:f(272);break;case 70:f(70);break;case 79:f(79);break;case 81:f(81);break;case 83:f(83);break;case 84:f(84);break;case 89:f(89);break;case 96:f(96);break;case 99:f(99);break;case 100:f(100);break;case 102:f(102);break;case 104:f(104);break;case 123:f(123);break;case 130:f(130);break;case 131:f(131);break;case 139:f(139);break;case 152:f(152);break;case 153:f(153);break;case 159:f(159);break;case 169:f(169);break;case 190:f(190);break;case 197:f(197);break;case 201:f(201);break;case 220:f(220);break;case 223:f(223);break;case 226:f(226);break;case 232:f(232);break;case 238:f(238);break;case 249:f(249);break;case 250:f(250);break;case 255:f(255);break;case 259:f(259);break;case 260:f(260);break;case 261:f(261);break;case 265:f(265);break;case 95:f(95);break;case 174:f(174);break;default:f(219)}E.endNonterminal(\"FunctionName\",g)}function a(){E.startNonterminal(\"NCName\",g);switch(y){case 28:f(28);break;case 68:f(68);break;case 73:f(73);break;case 77:f(77);break;case 78:f(78);break;case 82:f(82);break;case 86:f(86);break;case 87:f(87);break;case 88:f(88);break;case 92:f(92);break;case 103:f(103);break;case 107:f(107);break;case 111:f(111);break;case 116:f(116);break;case 120:f(120);break;case 121:f(121);break;case 124:f(124);break;case 126:f(126);break;case 129:f(129);break;case 135:f(135);break;case 144:f(144);break;case 146:f(146);break;case 148:f(148);break;case 149:f(149);break;case 158:f(158);break;case 160:f(160);break;case 161:f(161);break;case 162:f(162);break;case 170:f(170);break;case 172:f(172);break;case 176:f(176);break;case 178:f(178);break;case 179:f(179);break;case 184:f(184);break;case 196:f(196);break;case 198:f(198);break;case 199:f(199);break;case 218:f(218);break;case 222:f(222);break;case 234:f(234);break;case 235:f(235);break;case 246:f(246);break;case 247:f(247);break;case 252:f(252);break;case 264:f(264);break;case 268:f(268);break;case 71:f(71);break;case 72:f(72);break;case 80:f(80);break;case 91:f(91);break;case 94:f(94);break;case 101:f(101);break;case 106:f(106);break;case 108:f(108);break;case 109:f(109);break;case 110:f(110);break;case 117:f(117);break;case 118:f(118);break;case 119:f(119);break;case 122:f(122);break;case 127:f(127);break;case 132:f(132);break;case 133:f(133);break;case 134:f(134);break;case 143:f(143);break;case 150:f(150);break;case 151:f(151);break;case 157:f(157);break;case 163:f(163);break;case 168:f(168);break;case 180:f(180);break;case 182:f(182);break;case 183:f(183);break;case 189:f(189);break;case 200:f(200);break;case 204:f(204);break;case 210:f(210);break;case 211:f(211);break;case 214:f(214);break;case 216:f(216);break;case 217:f(217);break;case 224:f(224);break;case 225:f(225);break;case 227:f(227);break;case 233:f(233);break;case 241:f(241);break;case 242:f(242);break;case 248:f(248);break;case 251:f(251);break;case 254:f(254);break;case 258:f(258);break;case 260:f(260);break;case 272:f(272);break;case 70:f(70);break;case 79:f(79);break;case 81:f(81);break;case 83:f(83);break;case 84:f(84);break;case 89:f(89);break;case 96:f(96);break;case 99:f(99);break;case 100:f(100);break;case 102:f(102);break;case 104:f(104);break;case 123:f(123);break;case 130:f(130);break;case 131:f(131);break;case 139:f(139);break;case 152:f(152);break;case 153:f(153);break;case 159:f(159);break;case 169:f(169);break;case 190:f(190);break;case 197:f(197);break;case 201:f(201);break;case 220:f(220);break;case 223:f(223);break;case 226:f(226);break;case 232:f(232);break;case 238:f(238);break;case 249:f(249);break;case 250:f(250);break;case 255:f(255);break;case 259:f(259);break;case 261:f(261);break;case 265:f(265);break;case 95:f(95);break;case 174:f(174);break;default:f(219)}E.endNonterminal(\"NCName\",g)}function f(e){y==e?(l(),E.terminal(i.TOKEN[y],b,w>x?x:w),m=b,g=w,y=0):d(b,w,0,y,e)}function l(){g!=b&&(m=g,g=b,E.whitespace(m,g))}function c(e){var t;for(;;){t=C(e);if(t!=30)break}return t}function h(e){y==0&&(y=c(e),b=T,w=N)}function p(e){y==0&&(y=C(e),b=T,w=N)}function d(e,t,r,i,s){throw new n.ParseException(e,t,r,i,s)}function C(e){var t=!1;T=N;var n=N,r=i.INITIAL[e],s=0;for(var o=r&4095;o!=0;){var u,a=n<x?S.charCodeAt(n):0;++n;if(a<128)u=i.MAP0[a];else if(a<55296){var f=a>>4;u=i.MAP1[(a&15)+i.MAP1[(f&31)+i.MAP1[f>>5]]]}else{if(a<56320){var f=n<x?S.charCodeAt(n):0;f>=56320&&f<57344&&(++n,a=((a&1023)<<10)+(f&1023)+65536,t=!0)}var l=0,c=5;for(var h=3;;h=c+l>>1){if(i.MAP2[h]>a)c=h-1;else{if(!(i.MAP2[6+h]<a)){u=i.MAP2[12+h];break}l=h+1}if(l>c){u=0;break}}}s=o;var p=(u<<12)+o-1;o=i.TRANSITION[(p&15)+i.TRANSITION[p>>4]],o>4095&&(r=o,o&=4095,N=n)}r>>=12;if(r==0){N=n-1;var f=N<x?S.charCodeAt(N):0;return f>=56320&&f<57344&&--N,d(T,N,s,-1,-1)}if(t)for(var v=r>>9;v>0;--v){--N;var f=N<x?S.charCodeAt(N):0;f>=56320&&f<57344&&--N}else N-=r>>9;return(r&511)-1}r(e,t);var n=this;this.ParseException=function(e,t,n,r,i){var s=e,o=t,u=n,a=r,f=i;this.getBegin=function(){return s},this.getEnd=function(){return o},this.getState=function(){return u},this.getExpected=function(){return f},this.getOffending=function(){return a},this.getMessage=function(){return a<0?\"lexical analysis failed\":\"syntax error\"}},this.getInput=function(){return S},this.getOffendingToken=function(e){var t=e.getOffending();return t>=0?i.TOKEN[t]:null},this.getExpectedTokenSet=function(e){var t;return e.getExpected()<0?t=i.getTokenSet(-e.getState()):t=[i.TOKEN[e.getExpected()]],t},this.getErrorMessage=function(e){var t=this.getExpectedTokenSet(e),n=this.getOffendingToken(e),r=S.substring(0,e.getBegin()),i=r.split(\"\\n\"),s=i.length,o=i[s-1].length+1,u=e.getEnd()-e.getBegin();return e.getMessage()+(n==null?\"\":\", found \"+n)+\"\\nwhile expecting \"+(t.length==1?t[0]:\"[\"+t.join(\", \")+\"]\")+\"\\n\"+(u==0||n!=null?\"\":\"after successfully scanning \"+u+\" characters beginning \")+\"at line \"+s+\", column \"+o+\":\\n...\"+S.substring(e.getBegin(),Math.min(S.length,e.getBegin()+64))+\"...\"},this.parse_start=function(){E.startNonterminal(\"start\",g),h(14);switch(y){case 58:f(58);break;case 57:f(57);break;case 59:f(59);break;case 43:f(43);break;case 45:f(45);break;case 44:f(44);break;case 37:f(37);break;case 41:f(41);break;case 277:f(277);break;case 274:f(274);break;case 42:f(42);break;case 46:f(46);break;case 52:f(52);break;case 65:f(65);break;case 66:f(66);break;case 49:f(49);break;case 51:f(51);break;case 56:f(56);break;case 54:f(54);break;case 36:f(36);break;case 276:f(276);break;case 40:f(40);break;case 5:f(5);break;case 4:f(4);break;case 6:f(6);break;case 15:f(15);break;case 16:f(16);break;case 18:f(18);break;case 19:f(19);break;case 20:f(20);break;case 8:f(8);break;case 9:f(9);break;case 7:f(7);break;case 35:f(35);break;default:o()}E.endNonterminal(\"start\",g)},this.parse_StartTag=function(){E.startNonterminal(\"StartTag\",g),h(8);switch(y){case 61:f(61);break;case 53:f(53);break;case 29:f(29);break;case 60:f(60);break;case 37:f(37);break;case 41:f(41);break;default:f(35)}E.endNonterminal(\"StartTag\",g)},this.parse_TagContent=function(){E.startNonterminal(\"TagContent\",g),p(11);switch(y){case 25:f(25);break;case 9:f(9);break;case 10:f(10);break;case 58:f(58);break;case 57:f(57);break;case 21:f(21);break;case 31:f(31);break;case 275:f(275);break;case 278:f(278);break;case 274:f(274);break;default:f(35)}E.endNonterminal(\"TagContent\",g)},this.parse_AposAttr=function(){E.startNonterminal(\"AposAttr\",g),p(10);switch(y){case 23:f(23);break;case 27:f(27);break;case 21:f(21);break;case 31:f(31);break;case 275:f(275);break;case 278:f(278);break;case 274:f(274);break;case 41:f(41);break;default:f(35)}E.endNonterminal(\"AposAttr\",g)},this.parse_QuotAttr=function(){E.startNonterminal(\"QuotAttr\",g),p(9);switch(y){case 22:f(22);break;case 26:f(26);break;case 21:f(21);break;case 31:f(31);break;case 275:f(275);break;case 278:f(278);break;case 274:f(274);break;case 37:f(37);break;default:f(35)}E.endNonterminal(\"QuotAttr\",g)},this.parse_CData=function(){E.startNonterminal(\"CData\",g),p(1);switch(y){case 14:f(14);break;case 67:f(67);break;default:f(35)}E.endNonterminal(\"CData\",g)},this.parse_XMLComment=function(){E.startNonterminal(\"XMLComment\",g),p(0);switch(y){case 12:f(12);break;case 50:f(50);break;default:f(35)}E.endNonterminal(\"XMLComment\",g)},this.parse_PI=function(){E.startNonterminal(\"PI\",g),p(3);switch(y){case 13:f(13);break;case 62:f(62);break;case 63:f(63);break;default:f(35)}E.endNonterminal(\"PI\",g)},this.parse_Pragma=function(){E.startNonterminal(\"Pragma\",g),p(2);switch(y){case 11:f(11);break;case 38:f(38);break;case 39:f(39);break;default:f(35)}E.endNonterminal(\"Pragma\",g)},this.parse_Comment=function(){E.startNonterminal(\"Comment\",g),p(4);switch(y){case 55:f(55);break;case 44:f(44);break;case 32:f(32);break;default:f(35)}E.endNonterminal(\"Comment\",g)},this.parse_CommentDoc=function(){E.startNonterminal(\"CommentDoc\",g),p(6);switch(y){case 33:f(33);break;case 34:f(34);break;case 55:f(55);break;case 44:f(44);break;default:f(35)}E.endNonterminal(\"CommentDoc\",g)},this.parse_QuotString=function(){E.startNonterminal(\"QuotString\",g),p(5);switch(y){case 3:f(3);break;case 2:f(2);break;case 1:f(1);break;case 37:f(37);break;default:f(35)}E.endNonterminal(\"QuotString\",g)},this.parse_AposString=function(){E.startNonterminal(\"AposString\",g),p(7);switch(y){case 21:f(21);break;case 31:f(31);break;case 23:f(23);break;case 24:f(24);break;case 41:f(41);break;default:f(35)}E.endNonterminal(\"AposString\",g)},this.parse_Prefix=function(){E.startNonterminal(\"Prefix\",g),h(13),l(),a(),E.endNonterminal(\"Prefix\",g)},this.parse__EQName=function(){E.startNonterminal(\"_EQName\",g),h(12),l(),o(),E.endNonterminal(\"_EQName\",g)};var v,m,g,y,b,w,E,S,x,T,N};r.getTokenSet=function(e){var t=[],n=e<0?-e:INITIAL[e]&4095;for(var i=0;i<279;i+=32){var s=i,o=(i>>5)*2066+n-1,u=o>>2,a=u>>2,f=r.EXPECTED[(o&3)+r.EXPECTED[(u&3)+r.EXPECTED[(a&3)+r.EXPECTED[a>>2]]]];for(;f!=0;f>>>=1,++s)(f&1)!=0&&t.push(r.TOKEN[s])}return t},r.MAP0=[67,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,27,31,31,31,31,31,31,31,31,31,31,32,31,31,33,31,31,31,31,31,31,34,35,36,37,31,37,38,39,40,41,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,31,62,63,64,65,37],r.MAP1=[108,124,214,214,214,214,214,214,214,214,214,214,214,214,214,214,156,181,181,181,181,181,214,215,213,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,247,261,277,293,309,347,363,379,416,416,416,408,331,323,331,323,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,433,433,433,433,433,433,433,316,331,331,331,331,331,331,331,331,394,416,416,417,415,416,416,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,330,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,416,67,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,27,31,31,31,31,31,31,31,31,31,31,31,31,31,31,37,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,32,31,31,33,31,31,31,31,31,31,34,35,36,37,31,37,38,39,40,41,42,43,44,45,46,31,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,31,62,63,64,65,37,37,37,37,37,37,37,37,37,37,37,37,31,31,37,37,37,37,37,37,37,66,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66,66],r.MAP2=[57344,63744,64976,65008,65536,983040,63743,64975,65007,65533,983039,1114111,37,31,37,31,31,37],r.INITIAL=[1,2,49155,57348,5,6,7,8,9,10,11,12,13,14,15],r.TRANSITION=[19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,17408,19288,17439,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,22126,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17672,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,19469,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,36919,18234,18262,18278,18294,18320,18336,18361,18397,18419,18432,18304,18448,18485,18523,18553,18583,18599,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,18825,18841,18871,18906,18944,18960,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19074,36169,17439,36866,17466,36890,36866,22314,19105,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,22126,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17672,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,19469,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,36919,18234,18262,18278,18294,18320,18336,18361,18397,18419,18432,18304,18448,18485,18523,18553,18583,18599,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,18825,18841,18871,18906,18944,18960,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22182,19288,19121,36866,17466,18345,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19273,19552,19304,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19332,17423,19363,36866,17466,17537,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,18614,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,19391,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,19427,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36154,19288,19457,36866,17466,17740,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22780,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22375,22197,18469,36866,17466,36890,36866,21991,24018,22987,17556,17575,22288,17486,17509,17525,18373,21331,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,19485,19501,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19537,22390,19568,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19596,19611,19457,36866,17466,36890,36866,18246,19627,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22242,20553,19457,36866,17466,36890,36866,18648,30477,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36472,19288,19457,36866,17466,17809,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,21770,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,19643,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,19672,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,20538,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,17975,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22345,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19726,19742,21529,24035,23112,26225,23511,27749,27397,24035,34360,24035,24036,23114,35166,23114,23114,19758,23511,35247,23511,23511,28447,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,24254,19821,23511,23511,23511,23511,23512,19441,36539,24035,24035,24035,24035,19846,19869,23114,23114,23114,28618,32187,19892,23511,23511,23511,34585,20402,36647,24035,24035,24036,23114,33757,23114,23114,23029,20271,23511,27070,23511,23511,30562,24035,24035,29274,26576,23114,23114,31118,23036,29695,23511,23511,32431,23634,30821,24035,23110,19913,23114,23467,31261,23261,34299,19932,24035,32609,19965,35389,19984,27689,19830,29391,29337,20041,22643,35619,33728,20062,20121,20166,35100,26145,20211,23008,19876,20208,20227,25670,20132,26578,27685,20141,20243,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36094,19288,19457,36866,17466,21724,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22735,19552,20287,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22750,19288,21529,24035,23112,28056,23511,29483,28756,24035,24035,24035,24036,23114,23114,23114,23114,20327,23511,23511,23511,23511,31156,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,24254,20371,23511,23511,23511,23511,27443,20395,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,29457,29700,23511,23511,23511,23511,33444,20402,24035,24035,24035,24036,23114,23114,23114,23114,28350,20421,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,20447,20475,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,20523,22257,20569,20783,21715,17603,20699,20837,20614,20630,21149,20670,21405,17486,17509,17525,18373,19179,20695,20716,20732,20755,19194,18042,21641,20592,20779,20598,21412,17470,17591,20896,17468,17619,20799,20700,21031,20744,20699,20828,18075,21259,20581,20853,18048,20868,20884,17756,17784,17800,17825,17854,21171,21200,20931,20947,21378,20955,20971,18086,20645,21002,20986,18178,17960,18012,18381,18064,29176,21044,21438,21018,21122,21393,21060,21844,21094,20654,17493,18150,18166,18214,25967,20763,21799,21110,21830,21138,21246,21301,18336,18361,21165,21187,20812,21216,21232,21287,21317,18553,21347,21363,21428,21454,21271,21483,21499,21515,21575,21467,18712,21591,21633,21078,18189,18198,20679,21657,21701,21074,21687,21740,21756,21786,21815,21860,21876,21892,21946,21962,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36457,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,36813,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,21981,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,22151,22007,18884,17900,17922,17944,18178,17960,18012,18381,18064,27898,17884,18890,17906,17928,22042,25022,18130,36931,36963,17493,18150,18166,22070,22112,25026,18134,36935,18262,18278,18294,18320,18336,18361,22142,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36109,19288,18469,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22167,19288,19457,36866,17466,17768,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22227,36487,22273,36866,17466,36890,36866,19316,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18749,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,22304,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,19580,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22330,19089,19457,36866,17466,18721,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22765,19347,19457,36866,17466,36890,36866,18114,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,29116,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,27443,22493,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34541,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,22839,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,22540,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,29116,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,27443,22493,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34564,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,22839,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,29908,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,27443,22493,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34564,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,22839,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,29116,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,27443,22561,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34564,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,22839,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,23837,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22584,23511,23511,23511,23511,29116,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,27443,22493,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34564,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,22839,23511,23511,23511,23511,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,31507,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,24694,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36442,19288,21605,24035,23112,28137,23511,31507,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,24694,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,31507,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,24694,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,31568,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22690,19288,19457,36866,17466,36890,36866,21991,27584,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,22659,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22360,19552,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22675,22811,19457,36866,17466,36890,36866,19133,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,22827,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36139,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36064,19288,22865,22881,32031,22897,22913,22956,29939,24035,24035,24035,23003,23114,23114,23114,23024,22420,23511,23511,23511,23052,29116,23073,29268,24035,25563,26915,23106,23131,23114,23114,23159,23181,23197,23248,23511,23511,23282,23305,22493,32364,24035,33472,30138,26325,31770,33508,27345,33667,23114,23321,23473,23351,35793,36576,23511,23375,22500,24145,24035,29197,20192,24533,23440,23114,19017,23459,22839,23489,23510,23511,33563,23528,32076,25389,24035,26576,23561,23583,23114,32683,22516,23622,23655,23511,23634,35456,37144,23110,23683,34153,20499,32513,25824,23705,24035,24035,23111,23114,19874,27078,33263,19830,24035,23112,19872,27741,23266,24036,23114,30243,20507,32241,20150,31862,27464,35108,23727,23007,35895,34953,26578,27685,20141,24569,31691,19787,33967,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36427,19552,21605,24035,23112,32618,23511,29483,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,29116,19803,24035,24035,24035,27027,26576,23114,23114,23114,31471,23756,22468,23511,23511,23511,34687,23772,22493,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34564,23788,24035,24035,24035,21559,23828,23114,23114,23114,25086,22839,23853,23511,23511,23511,23876,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,31761,23909,23953,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36049,19288,21605,30825,23112,23987,23511,24003,31001,27617,24034,24035,24036,24052,24089,23114,23114,22420,24109,24168,23511,23511,29116,24188,27609,20017,29516,24035,26576,24222,19968,23114,24252,33811,22468,24270,33587,23511,24320,27443,22493,24035,24035,24035,24035,24339,23113,23114,23114,23114,28128,28618,29700,23511,23511,23511,28276,34564,20402,24035,24035,32929,24036,23114,23114,23114,24357,23029,22839,23511,23511,23511,24377,25645,24035,34112,24035,26576,23114,26643,23114,32683,22516,23511,25638,23511,23711,24035,24395,27809,23114,24414,20499,24432,30917,23628,24035,30680,23111,23114,30233,27078,25748,24452,24035,23112,19872,27741,23266,24036,23114,24475,19829,26577,26597,26154,24519,24556,24596,23007,20046,20132,26578,24634,20141,24569,31691,24679,24727,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36412,19288,21605,19943,34861,32618,26027,29483,32016,32050,36233,24776,35574,24801,24819,32671,31289,22420,24868,24886,20087,26849,29116,19803,24035,24035,24035,36228,26576,23114,23114,23114,24981,33811,22468,23511,23511,23511,29028,27443,22493,24923,27965,24035,24035,32797,24946,23443,23114,23114,29636,24997,22849,28252,23511,23511,23511,25042,25110,24035,24035,34085,24036,25133,23114,23114,25152,23029,22839,25169,23511,36764,23511,25645,30403,24035,25186,26576,31806,24093,25212,32683,22516,32713,26245,34293,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,24035,32406,23111,23114,28676,30944,27689,25234,24035,23112,19872,37063,23266,24036,23114,30243,20379,26100,29218,20211,30105,25257,25284,23007,20046,20132,26578,27685,20141,24569,24834,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36034,19288,21671,25314,25072,25330,25346,25362,29939,29951,35288,29984,23812,27216,25405,25424,30456,22584,26292,25461,25480,31592,29116,25516,34963,25545,27007,25579,33937,25614,25661,25686,34872,25702,25718,25734,25769,25795,25811,25840,22493,26533,25856,24035,25876,30763,27481,25909,23114,28987,25936,25954,29700,25983,23511,31412,26043,26063,22568,29241,29592,26116,31216,35383,26170,34783,26194,26221,22839,26241,26261,22477,26283,26308,27306,31035,24655,26576,29854,33386,26341,32683,22516,32153,30926,26361,19996,26381,35463,26397,26424,34646,26478,35605,31386,26494,35567,31964,22940,23689,25218,30309,32289,19830,33605,23112,32109,27733,27084,24496,35886,35221,26525,36602,26549,26558,26574,26594,26613,26629,26666,26700,26578,27685,23740,24285,31691,26733,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36397,19552,18991,25887,28117,32618,26776,29483,29939,26802,24035,24035,24036,28664,23114,23114,23114,22420,30297,23511,23511,23511,29116,19803,24035,24035,24035,25559,26576,23114,23114,23114,30525,33811,22468,23511,23511,23511,28725,27443,22493,24035,24035,27249,24035,24035,23113,23114,23114,26827,23114,28618,29700,23511,23511,26845,23511,34564,20402,24035,24035,26979,24036,23114,23114,23114,24974,23029,22839,23511,23511,23511,26865,25645,24035,24035,24035,26576,23114,23114,23114,32683,22516,23511,23511,23511,23634,24035,24035,23110,23114,23114,20499,23511,23261,23628,33305,24035,25598,23114,19874,34253,27689,19830,24035,23112,19872,27741,23266,24036,23114,26886,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,26931,24569,26439,26947,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36019,19288,26995,24035,23112,32618,23511,31507,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,27043,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,27061,23511,23511,23511,23511,23512,24694,24035,24035,29978,24035,24035,23113,23114,33114,23114,23114,30010,29700,23511,35913,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,27155,26576,23114,23114,30447,23036,29695,23511,23511,30935,20099,24152,25529,27100,34461,27121,22625,29156,26009,27137,30422,31903,31655,28870,27171,32439,31731,19830,27232,22612,27265,26786,25494,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,20342,27288,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,27322,27339,28020,27361,27382,29939,24035,24035,32581,24036,23114,23114,23114,27425,22420,23511,23511,23511,27442,28306,19803,24035,24035,24035,24035,26710,23114,23114,23114,23114,32261,22468,23511,23511,23511,23511,35719,24694,29510,24035,24035,24035,24035,26717,23114,23114,23114,23114,28618,32217,23511,23511,23511,23511,34585,20402,24035,24035,24035,27459,23114,23114,23114,36252,23029,20271,23511,23511,23511,28840,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,27480,34483,28401,29761,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36382,19288,21605,27497,27517,28504,28898,27569,29939,29401,27600,27323,27633,19025,27662,23114,27705,22420,20483,27721,23511,27765,28306,19803,23540,24035,24610,27781,27805,26650,23114,28573,32990,25920,22468,26870,23511,26684,34262,34737,25057,34622,24035,24035,23971,24206,27825,27847,23114,23114,27865,27885,35766,27914,23511,23511,32766,32844,27934,28795,26909,27955,26092,27988,25445,28005,28036,28052,21965,23511,32196,19897,28072,28102,36534,21541,23801,28153,28180,28197,28221,23036,32695,28251,28268,28292,23667,34825,23930,24580,28322,28344,31627,28366,25996,23628,24035,24035,23111,23114,19874,27078,27689,35625,33477,33359,27674,28393,33992,24036,23114,30243,19829,28417,28433,28463,23008,19876,20208,23007,20046,20132,28489,28520,20141,24569,31691,19787,28550,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,24035,23112,32618,23511,31507,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,24694,28589,24035,24035,24035,24035,28608,23114,23114,23114,23114,28618,20431,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36004,19288,28634,31951,28565,28702,28718,28741,32544,20175,28792,32086,20105,28811,29059,29862,28856,22420,28886,30354,23359,28922,28306,28952,23888,26320,36506,24035,29331,28968,36609,23114,29003,31661,27061,30649,27366,23511,29023,27918,24694,24035,24035,23893,33094,30867,23113,23114,23114,29044,34184,30010,29700,23511,23511,29081,29102,34585,20402,27789,24035,24035,24036,23114,29132,23114,23114,23029,20271,23511,29153,23511,23511,30562,30174,24035,24035,27409,25438,23114,23114,29172,36668,31332,23511,23511,29192,30144,24035,23110,30203,23114,23467,31544,23261,23628,24035,22545,23111,23114,29213,27078,27689,29234,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,29257,23008,19876,20208,28768,29290,29320,34776,29353,20141,22435,29378,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36367,19288,21605,34616,19006,32618,31497,31507,36216,20184,24035,34393,29424,34668,23114,34900,29447,22420,30360,23511,37089,29473,28306,19803,29499,24398,24035,24035,26576,31799,29532,29550,23114,33811,22468,32298,29571,31184,23511,23512,37127,36628,29589,24035,24135,24035,23113,29608,23114,27831,29634,28618,29652,30037,23511,24172,29671,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,29555,29690,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,29719,24035,23110,29738,23114,23467,34035,29756,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,29777,34364,28181,30243,29799,31920,27272,27185,23008,31126,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29828,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,35989,19552,19687,35139,28649,29878,29894,29924,29939,23224,23085,31969,24036,35173,24752,24803,23114,22420,31190,30318,24870,23511,28306,29967,23967,24035,24035,24035,26576,3e4,23114,23114,23114,33811,22468,30026,23511,23511,23511,23512,26078,24035,24035,24035,30053,37137,30071,23114,23114,33368,25136,28618,30723,23511,23511,37096,31356,34585,20402,30092,30127,30160,24036,35740,30219,24960,30259,23029,20271,34042,30285,30342,30376,23289,30055,30400,30419,30438,32640,33532,33514,30472,18792,26267,24323,23057,30493,23639,20008,30196,33188,30517,20075,23511,30541,23628,30578,33928,28776,30594,19874,30610,30637,19830,30677,27646,19872,25779,23266,23232,35016,30243,30696,29812,30712,30746,27206,30779,30807,23007,33395,20132,26578,27685,31703,22928,31691,19787,31079,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36352,19288,23335,30841,26131,30888,30904,30986,29939,24035,24704,31017,20025,23114,26178,31051,31095,22420,23511,22524,31142,31172,28534,31206,35497,25196,24035,28592,24503,23114,31239,31285,23114,31305,31321,31355,31372,31407,23511,30556,24694,24035,27501,19805,24035,24035,23113,23114,31428,24066,23114,28618,29700,23511,31837,18809,23511,34585,31448,24035,24035,24035,23090,23114,23114,23114,23114,31619,35038,23511,23511,23511,23511,33714,24035,33085,24035,29431,23114,31467,23114,23143,31487,23511,31523,23511,35195,36783,24035,30111,23567,23114,23467,31543,31560,23628,24035,24035,23111,23114,19874,30953,31584,34508,24035,31608,26345,37055,23266,31643,31677,31719,31747,31786,31822,26898,23008,19876,31859,23007,20046,20132,26578,27685,20141,24569,31691,31878,31936,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,35974,19288,21605,27972,35663,31985,29655,32001,36715,24785,25893,23545,31912,19853,19916,25938,24540,22420,31843,29674,29573,32735,28936,19803,24035,24035,32047,24035,26576,23114,23114,27544,23114,33811,22468,23511,23511,32161,23511,23512,32066,24035,33313,24035,24035,24035,23113,27426,32102,23114,23114,28618,32125,23511,32144,23511,23511,33569,20402,24035,27045,24035,24036,23114,23114,28328,23114,30076,32177,23511,23511,30384,23511,30562,24035,24035,24035,26576,23114,23114,23114,23595,32212,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,22635,25753,32233,32257,32277,19829,26577,26597,20211,23008,19876,32322,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,32352,35285,32380,34196,33016,30661,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,32404,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,32422,23511,23511,23511,23511,23512,24694,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,30269,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,19949,24035,23111,32455,19874,31269,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36337,19552,19209,21617,26509,32475,32491,32529,29939,24035,32578,25241,32597,23114,32634,29007,32656,22420,23511,32729,26365,32751,28306,32788,32882,24035,24035,32813,36727,23114,33182,23114,27553,33235,32829,23511,32706,23511,28906,28377,26962,32881,32904,32898,32920,24035,32953,23114,32977,26408,23114,28164,33006,23511,33039,35774,23511,32306,20402,33076,30872,24035,24036,25408,33110,28979,23114,23029,20271,35835,33130,33054,23511,30562,33148,24035,24035,33167,23114,23114,33775,23036,20459,23511,23511,25464,24646,24035,24035,22446,23114,23114,25627,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,31391,33204,33220,33251,33287,26577,26597,20211,33329,19876,33345,23007,20046,20132,26578,27685,28473,22599,31691,33411,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,35959,19288,21907,27243,29843,32618,33427,31507,29939,33460,34090,24035,24036,33493,24416,33530,23114,22420,33548,24379,33585,23511,28306,19803,33603,24202,24035,24035,25593,33749,28205,23114,23114,32388,22468,33853,33060,23511,23511,31339,33621,24035,24035,34397,24618,30757,33663,23114,23114,33683,35684,28618,26678,23511,23511,32506,33699,34585,20402,24035,32562,26973,24036,23114,23114,33377,33773,23029,20271,23511,23511,30621,23511,23860,24035,33791,21553,26576,36558,23114,33809,23036,32857,26047,23511,33827,23634,24035,24035,23110,23114,23114,31252,23511,33845,23628,24035,24459,23111,23114,33869,27078,30791,29783,24035,24742,19872,33895,23266,26462,19710,33879,33919,26577,26597,24123,24930,21930,20208,30501,33953,25268,20252,33983,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36322,19552,23390,33634,35154,34008,34024,34058,35544,34106,34128,26811,33151,34144,34169,34212,23114,34228,34244,34278,34315,23511,34331,34347,34380,34413,24035,24663,26576,34429,34453,34477,29534,33811,22468,34499,34524,34557,25170,34580,35436,23937,34601,24035,24341,26453,23113,34638,34662,23114,24236,28618,34684,34703,34729,23511,35352,34753,34799,24035,34815,32558,34848,34888,35814,34923,23165,29137,23606,30326,30730,34939,33023,30562,36848,34979,24035,24847,34996,23114,23114,35032,29695,35054,23511,23511,35091,33296,35124,24296,28235,24361,36276,32772,35067,35189,27301,30855,24852,22452,35211,35237,35316,25500,35270,23405,24304,35304,29362,24036,23114,35332,19829,26577,26597,20211,23008,19876,20208,35368,28823,23920,32336,35405,20141,24569,31691,35421,35479,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,35944,22795,21605,33647,35877,35513,30962,35529,34073,35557,24035,24035,20405,31107,23114,23114,23114,35590,34713,23511,23511,23511,35641,19803,29408,32937,25298,24035,35657,23115,27849,24760,35679,26205,22468,23511,35700,24907,24901,35075,31893,34980,24035,24035,24035,24035,23113,35009,23114,23114,23114,28618,35716,30970,23511,23511,23511,34585,23215,24035,24035,24035,24036,35735,23114,23114,23114,27105,35756,35790,23511,23511,23511,35254,35446,24035,24035,31223,35809,23114,23114,23036,36825,35830,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,31031,20355,19872,33903,23266,24036,23114,28686,19829,26577,26597,20211,23008,23424,20208,24711,31065,24486,26578,27685,20141,19773,35851,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36307,19288,21605,35494,19702,32618,33437,31507,29939,25117,24035,27939,24036,27869,23114,26829,23114,22420,23494,23511,33132,23511,28306,19803,24035,34832,24035,24035,26576,23114,25153,23114,23114,33811,22468,23511,23511,35911,23511,23512,24694,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,35929,19288,21605,25860,23112,36185,23511,36201,29939,24035,24035,24035,24036,23114,23114,23114,23114,22420,23511,23511,23511,23511,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,26748,24035,24035,24035,24035,24035,36249,23114,23114,23114,23114,28618,28835,23511,23511,23511,23511,34585,20402,24035,27151,24035,26760,23114,27989,23114,23114,36268,20271,23511,24436,23511,29703,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36292,19288,21605,36503,21922,32618,34534,31507,36522,24035,33793,24035,35864,23114,23114,36555,23417,22420,23511,23511,36574,26020,28306,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,33811,22468,23511,23511,23511,23511,23512,36592,24035,24035,36625,24035,24035,23113,23114,32961,23114,23114,29618,29700,23511,29086,23511,23511,34585,20402,36644,24035,24035,24036,29740,23114,23114,23114,29065,36663,31527,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36079,19288,21605,31451,23112,36684,23511,36700,29939,24035,24035,24035,30185,23114,23114,23114,27526,22420,23511,23511,23511,32865,28306,19803,36743,24035,27017,24035,26576,27535,23114,31432,23114,33811,22468,33271,23511,32128,23511,23512,24694,24035,27196,24035,24035,24035,23113,32459,23114,23114,23114,28618,29700,33829,36762,23511,23511,34585,20402,24035,36746,24035,29722,23114,23114,34437,23114,34907,20271,23511,23511,18801,23511,23206,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,36837,24035,24035,33739,23114,23114,25094,23511,23261,23628,24035,36780,23111,24073,19874,27078,35344,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22720,19288,36799,36866,17466,36890,36864,21991,22211,22987,17556,17575,22288,17486,17509,17525,18373,17631,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,36883,36906,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,22705,19288,19457,36866,17466,36890,36866,19375,22971,22987,17556,17575,22288,17486,17509,17525,18373,18855,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36124,19288,36951,36866,17466,36890,36866,21991,22404,22987,17556,17575,22288,17486,17509,17525,18373,18567,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,36979,36995,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36139,19288,19457,36866,17466,36890,36866,21991,22971,22987,17556,17575,22288,17486,17509,17525,18373,18027,22984,17553,17572,22285,18462,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,17619,22083,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,36139,19288,21529,24035,23112,23033,23511,31507,25377,24035,24035,24035,24036,23114,23114,23114,23114,37040,23511,23511,23511,23511,28086,19803,24035,24035,24035,24035,26576,23114,23114,23114,23114,24254,37079,23511,23511,23511,23511,23512,34766,24035,24035,24035,24035,24035,23113,23114,23114,23114,23114,28618,29700,23511,23511,23511,23511,34585,20402,24035,24035,24035,24036,23114,23114,23114,23114,23029,20271,23511,23511,23511,23511,30562,24035,24035,24035,26576,23114,23114,23114,23036,29695,23511,23511,23511,23634,24035,24035,23110,23114,23114,23467,23511,23261,23628,24035,24035,23111,23114,19874,27078,27689,19830,24035,23112,19872,27741,23266,24036,23114,30243,19829,26577,26597,20211,23008,19876,20208,23007,20046,20132,26578,27685,20141,24569,31691,19787,29304,20268,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,37112,37160,18469,36866,17466,36890,36866,17656,37174,22987,17556,17575,22288,17486,17509,17525,18373,18537,22984,17553,17572,22285,18780,17990,18622,19411,20306,17996,17689,17470,17591,20896,17468,36883,36906,36867,19404,20299,36866,17647,17862,18921,19514,17705,20311,37017,17728,17756,17784,17800,17825,17854,18403,18928,19521,17712,37008,37024,17878,18884,17900,17922,17944,18178,17960,18012,18381,18064,18218,17884,18890,17906,17928,18102,25022,18130,36931,36963,17493,18150,18166,18214,25010,25026,18134,36935,18262,18278,18294,18320,18336,18361,18397,18274,22096,18304,18448,18485,18523,18553,18583,19149,18638,18497,19656,18664,18680,18507,18696,19164,18712,18737,17681,22026,20906,20915,22054,17838,17450,22022,18765,19225,18841,18871,18906,19241,19257,18976,19041,19056,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,19058,53264,18,49172,57366,24,8192,28,102432,127011,110630,114730,106539,127011,127011,127011,53264,18,18,0,0,57366,0,24,24,24,0,28,28,28,28,102432,0,0,127011,0,2220032,110630,0,0,0,114730,106539,0,2170880,2170880,2170880,2170880,0,0,0,2170880,2170880,2170880,3002368,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2576384,2215936,2215936,2215936,2416640,2424832,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2543616,2215936,2215936,2215936,2215936,2215936,2629632,2215936,2617344,2215936,2215936,2215936,2215936,2215936,2215936,2691072,2215936,2707456,2215936,2715648,2215936,2723840,2764800,2215936,2215936,2797568,2215936,2822144,2215936,2215936,2854912,2215936,2215936,2215936,2912256,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,180224,0,0,2174976,0,0,2170880,2617344,2170880,2170880,2170880,2170880,2170880,2170880,2691072,2170880,2707456,2170880,2715648,2170880,2723840,2764800,2170880,2170880,2797568,2170880,2170880,2797568,2170880,2822144,2170880,2170880,2854912,2170880,2170880,2170880,2912256,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2215936,2609152,2215936,2215936,2215936,2215936,2215936,2215936,2654208,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,184599,280,0,2174976,0,0,2215936,3117056,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,544,0,546,0,0,2179072,0,0,0,552,0,0,2170880,2170880,2170880,3117056,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,0,0,0,2158592,2158592,2232320,2232320,0,2240512,2240512,0,0,0,644,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,3129344,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2400256,2215936,2215936,2215936,2215936,2711552,2170880,2170880,2170880,2170880,2170880,2760704,2768896,2789376,2813952,2170880,2170880,2170880,2875392,2904064,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2453504,2457600,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,167936,0,0,0,0,2174976,0,0,2215936,2215936,2514944,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2592768,2215936,2215936,2215936,2215936,2215936,2215936,2215936,32768,0,0,0,0,0,2174976,32768,0,2633728,2215936,2215936,2215936,2215936,2215936,2215936,2711552,2215936,2215936,2215936,2215936,2215936,2760704,2768896,2789376,2813952,2215936,2215936,2215936,2875392,2904064,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,0,0,0,2174976,0,65819,2215936,2215936,3031040,2215936,3055616,2215936,2215936,2215936,2215936,3092480,2215936,2215936,3125248,2215936,2215936,2215936,2215936,2215936,2215936,3002368,2215936,2215936,2170880,2170880,2494464,2170880,2170880,0,0,2215936,2215936,2215936,2215936,2215936,2215936,3198976,2215936,0,0,0,0,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,0,0,0,2379776,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2445312,2170880,2465792,2473984,2170880,2170880,2170880,2170880,2170880,2170880,2523136,2170880,2170880,2641920,2170880,2170880,2170880,2699264,2170880,2727936,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2879488,2170880,2916352,2170880,2170880,2170880,2879488,2170880,2916352,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3026944,2170880,2170880,3063808,2170880,2170880,3112960,2170880,2170880,3133440,2170880,2170880,3112960,2170880,2170880,3133440,2170880,2170880,2170880,3162112,2170880,2170880,3182592,3186688,2170880,2379776,2215936,2523136,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2596864,2215936,2621440,2215936,2215936,2641920,2215936,2215936,0,0,0,0,0,0,2179072,548,0,0,0,0,287,2170880,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3117056,2170880,2170880,2170880,2170880,2215936,2215936,2699264,2215936,2727936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2879488,2215936,2916352,2215936,2215936,0,0,0,0,188416,0,2179072,0,0,0,0,0,287,2170880,0,2171019,2171019,2171019,2400395,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3031179,2171019,3055755,2171019,2171019,2215936,3133440,2215936,2215936,2215936,3162112,2215936,2215936,3182592,3186688,2215936,0,0,0,0,0,0,0,0,0,0,2171019,2171019,2171019,2171019,2171019,2171019,2523275,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2597003,2171019,2621579,2170880,2170880,2170880,3162112,2170880,2170880,3182592,3186688,2170880,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,18,18,24,24,0,4337664,28,2170880,2170880,2170880,2629632,2170880,2170880,2170880,2170880,2719744,2744320,2170880,2170880,2170880,2834432,2838528,2170880,2908160,2170880,2170880,2936832,2215936,2215936,2215936,2215936,2719744,2744320,2215936,2215936,2215936,2834432,2838528,2215936,2908160,2215936,2215936,2936832,2215936,2215936,2985984,2215936,2994176,2215936,2215936,3014656,2215936,3059712,3076096,3088384,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2445312,2215936,2465792,2473984,2215936,2215936,2215936,2215936,2215936,2215936,2171166,2171166,2171166,2171166,2171166,0,0,0,2171166,2171166,2171166,2171166,2171166,2171166,2171019,2171019,2494603,2171019,2171019,2215936,2215936,2215936,3215360,0,0,0,0,0,0,0,0,0,0,0,0,0,2379776,2170880,2170880,2170880,2170880,2985984,2170880,2994176,2170880,2170880,3016168,2170880,3059712,3076096,3088384,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,18,18,124,124,0,128,128,2170880,2170880,2170880,3215360,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2486272,2170880,2170880,2506752,2170880,2170880,2170880,2535424,2539520,2170880,2170880,2588672,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2920448,2170880,2170880,2170880,2990080,2170880,2170880,2170880,2170880,3051520,2170880,2170880,2170880,2170880,2170880,2170880,3170304,0,2387968,2392064,2170880,2170880,2433024,2170880,2170880,2170880,3170304,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2486272,2215936,2215936,2506752,2215936,2215936,2215936,2535424,2539520,2215936,2215936,2588672,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,0,0,0,2174976,136,0,2215936,2215936,2920448,2215936,2215936,2215936,2990080,2215936,2215936,2215936,2215936,3051520,2215936,2215936,2215936,2215936,2215936,2215936,2215936,3108864,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,3026944,2215936,2215936,3063808,2215936,2215936,3112960,2215936,2215936,2215936,3170304,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2453504,2457600,2170880,2170880,2170880,2486272,2170880,2170880,2506752,2170880,2170880,2170880,2537049,2539520,2170880,2170880,2588672,2170880,2170880,2170880,1508,2170880,2170880,2170880,1512,2170880,2920448,2170880,2170880,2170880,2990080,2170880,2170880,2170880,2461696,2170880,2170880,2170880,2510848,2170880,2170880,2170880,2170880,2580480,2170880,2605056,2637824,2170880,2170880,18,0,0,0,0,0,0,0,0,2220032,0,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2686976,2748416,2170880,2170880,2170880,2924544,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3121152,2170880,2170880,3145728,3158016,3166208,2170880,2420736,2428928,2170880,2478080,2170880,2170880,2170880,2170880,0,0,2170880,2170880,2170880,2170880,2646016,2670592,0,0,3145728,3158016,3166208,2387968,2392064,2215936,2215936,2433024,2215936,2461696,2215936,2215936,2215936,2510848,2215936,2215936,0,0,0,0,0,0,2179072,0,0,0,0,0,0,2170880,2215936,2215936,2580480,2215936,2605056,2637824,2215936,2215936,2686976,2748416,2215936,2215936,2215936,2924544,2215936,2215936,0,0,0,0,0,0,2179072,0,0,0,0,0,286,2170880,2215936,2215936,2215936,2215936,2215936,3121152,2215936,2215936,3145728,3158016,3166208,2387968,2392064,2170880,2170880,2433024,2170880,2461696,2170880,2170880,2170880,2510848,2170880,2170880,1625,2170880,2170880,2580480,2170880,2605056,2637824,2170880,647,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2576384,2170880,2170880,2170880,2170880,2170880,2609152,2170880,2170880,2686976,0,0,2748416,2170880,2170880,0,2170880,2924544,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,18,18,24,0,0,28,28,2170880,3141632,2215936,2420736,2428928,2215936,2478080,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2646016,2670592,2752512,2756608,2846720,2961408,2215936,2998272,2215936,3010560,2215936,2215936,2215936,3141632,2170880,2420736,2428928,2752512,2756608,0,2846720,2961408,2170880,2998272,2170880,3010560,2170880,2170880,2170880,3141632,2170880,2170880,2490368,2215936,2490368,2215936,2215936,2215936,2547712,2555904,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,0,0,0,2174976,245760,0,3129344,2170880,2170880,2490368,2170880,2170880,2170880,0,0,2547712,2555904,2170880,2170880,2170880,0,0,0,0,0,0,0,0,0,2220032,0,0,45056,0,2584576,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2170880,2170880,2170880,2170880,0,0,0,2170880,2170880,2158592,0,0,0,0,0,0,0,0,2220032,0,0,0,0,0,0,0,0,1482,97,97,97,97,97,97,97,1354,97,97,97,97,97,97,97,97,1148,97,97,97,97,97,97,97,2584576,2170880,2170880,1512,0,2170880,2170880,2170880,2170880,2170880,2170880,2441216,2170880,2527232,2170880,2600960,2170880,2850816,2170880,2170880,2170880,3022848,2215936,2441216,2215936,2527232,2215936,2600960,2215936,2850816,2215936,2215936,0,0,0,0,0,0,2179072,0,0,0,0,0,287,2170880,2215936,3022848,2170880,2441216,2170880,2527232,0,0,2170880,2600960,2170880,0,2850816,2170880,2170880,2170880,2170880,2170880,2523136,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2596864,2170880,2621440,2170880,2170880,2641920,2170880,2170880,2170880,3022848,2170880,2519040,2170880,2170880,2170880,2170880,2170880,2215936,2519040,2215936,2215936,2215936,2215936,2215936,2170880,2170880,2170880,2453504,2457600,2170880,2170880,2170880,2170880,2170880,2170880,2514944,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2592768,2170880,2170880,2519040,0,2024,2170880,2170880,0,2170880,2170880,2170880,2396160,2170880,2170880,2170880,2170880,3018752,2396160,2215936,2215936,2215936,2215936,3018752,2396160,0,2024,2170880,2170880,2170880,2170880,3018752,2170880,2650112,2965504,2170880,2215936,2650112,2965504,2215936,0,0,2170880,2650112,2965504,2170880,2551808,2170880,2551808,2215936,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,141,45,45,67,67,67,67,67,224,67,67,238,67,67,67,67,67,67,67,1288,67,67,67,67,67,67,67,67,67,469,67,67,67,67,67,67,0,2551808,2170880,2170880,2215936,0,2170880,2170880,2215936,0,2170880,2170880,2215936,0,2170880,2977792,2977792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53264,18,49172,57366,24,8192,29,102432,127011,110630,114730,106539,127011,127011,127011,53264,18,18,49172,0,0,0,24,24,24,0,28,28,28,28,102432,127,0,0,0,0,0,0,0,0,0,0,140,2170880,2170880,2170880,2416640,0,0,0,0,2220032,110630,0,0,0,114730,106539,136,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,4256099,4256099,24,24,0,28,28,2170880,2461696,2170880,2170880,2170880,2510848,2170880,2170880,0,2170880,2170880,2580480,2170880,2605056,2637824,2170880,2170880,2170880,2547712,2555904,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3129344,2215936,2215936,543,543,545,545,0,0,2179072,0,550,551,551,0,287,2171166,2171166,18,0,0,0,0,0,0,0,0,2220032,0,0,645,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,149,2584576,2170880,2170880,0,0,2170880,2170880,2170880,2170880,2170880,2170880,2441216,2170880,2527232,2170880,2600960,2519040,0,0,2170880,2170880,0,2170880,2170880,2170880,2396160,2170880,2170880,2170880,2170880,3018752,2396160,2215936,2215936,2215936,2215936,3018752,2396160,0,0,2170880,2170880,2170880,2170880,3018752,2170880,2650112,2965504,53264,18,49172,57366,24,155648,28,102432,155648,155687,114730,106539,0,0,155648,53264,18,18,49172,0,57366,0,24,24,24,0,28,28,28,28,102432,0,0,0,0,2220032,0,94208,0,0,114730,106539,0,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,208896,18,278528,24,24,0,28,28,53264,18,159765,57366,24,8192,28,102432,0,110630,114730,106539,0,0,0,53264,18,18,49172,0,57366,0,24,24,24,0,28,139394,28,28,102432,131,0,0,0,2220032,110630,0,0,0,114730,106539,0,2170880,2170880,2170880,2170880,2170880,2170880,32768,53264,0,18,18,24,24,0,28,28,0,546,0,0,2183168,0,0,552,832,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2170880,2609152,2170880,2170880,2170880,2170880,2170880,2170880,2654208,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2215936,2215936,2215936,3198976,2215936,0,1084,0,1088,0,1092,0,0,0,0,0,41606,0,0,0,0,45,45,45,45,45,937,0,0,0,0,2220032,110630,0,0,0,114730,106539,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3198976,2170880,0,0,644,0,0,0,2215936,3117056,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,826,0,828,0,0,2183168,0,0,830,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2592768,2170880,2170880,2170880,2170880,2633728,2170880,2170880,2170880,2170880,2170880,2170880,2711552,2170880,2170880,2170880,2170880,2170880,2760704,53264,18,49172,57366,24,8192,28,172066,172032,110630,172066,106539,0,0,172032,53264,18,18,49172,0,57366,0,24,24,24,16384,28,28,28,28,102432,0,98304,0,0,2220032,110630,0,0,0,0,106539,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3198976,2170880,0,0,45056,0,0,0,53264,18,49172,57366,25,8192,30,102432,0,110630,114730,106539,0,0,176219,53264,18,18,49172,0,57366,0,124,124,124,0,128,128,128,128,102432,128,0,0,0,0,0,0,0,0,0,0,140,2170880,2170880,2170880,2416640,0,546,0,0,2183168,0,65536,552,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2646016,2670592,2752512,2756608,2846720,2961408,2170880,2998272,2170880,3010560,2170880,2170880,2215936,2215936,2215936,2215936,2215936,2215936,3198976,2215936,0,0,0,0,0,0,65536,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,143,45,45,67,67,67,67,67,227,67,67,67,67,67,67,67,67,67,1824,67,1826,67,67,67,67,17,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,32768,120,121,18,18,49172,0,57366,0,24,24,24,0,28,28,28,28,102432,67,67,37139,37139,24853,24853,0,0,2179072,548,0,65820,65820,0,287,97,0,0,97,97,0,97,97,97,45,45,45,45,2033,45,67,67,67,67,0,0,97,97,97,97,45,45,67,67,0,369,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,978,0,546,70179,0,2183168,0,0,552,0,97,97,97,97,97,97,97,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,1013,67,67,67,67,67,67,67,67,67,67,473,67,67,67,67,483,67,67,1025,67,67,67,67,67,67,67,67,67,67,67,67,67,97,97,97,97,97,0,0,97,97,97,97,1119,97,97,97,97,97,97,97,97,97,97,97,97,1359,97,97,97,67,67,1584,67,67,67,67,67,67,67,67,67,67,67,67,67,497,67,67,1659,45,45,45,45,45,45,45,45,45,1667,45,45,45,45,45,169,45,45,45,45,45,45,45,45,45,45,45,1668,45,45,45,45,67,67,1694,67,67,67,67,67,67,67,67,67,67,67,67,67,774,67,67,1713,97,97,97,97,97,97,97,0,97,97,1723,97,97,97,97,0,45,45,45,45,45,45,1538,45,45,45,45,45,1559,45,45,1561,45,45,45,45,45,45,45,687,45,45,45,45,45,45,45,45,448,45,45,45,45,45,45,67,67,67,67,1771,1772,67,67,67,67,67,67,67,67,97,97,97,97,0,0,0,97,67,67,67,67,67,1821,67,67,67,67,67,67,1827,67,67,67,0,0,0,0,0,0,97,97,1614,97,97,97,97,97,603,97,97,605,97,97,608,97,97,97,97,0,1532,45,45,45,45,45,45,45,45,45,45,450,45,45,45,45,67,67,97,97,97,97,97,97,0,0,1839,97,97,97,97,0,0,97,97,97,97,97,45,45,45,45,45,45,45,67,67,67,67,67,67,67,97,1883,97,1885,97,0,1888,0,97,97,0,97,97,1848,97,97,97,97,1852,45,45,45,45,45,45,45,384,391,45,45,45,45,45,45,45,385,45,45,45,45,45,45,45,45,1237,45,45,45,45,45,45,67,0,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,45,45,45,45,1951,45,45,45,45,45,45,45,45,67,67,67,67,1963,97,2023,0,97,97,0,97,97,97,45,45,45,45,45,45,67,67,1994,67,1995,67,67,67,67,67,67,97,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,97,97,0,0,0,0,2220032,110630,0,0,0,114730,106539,137,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2793472,2805760,2170880,2830336,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3031040,2170880,3055616,2170880,2170880,67,67,37139,37139,24853,24853,0,0,281,549,0,65820,65820,0,287,97,0,0,97,97,0,97,97,97,45,45,2031,2032,45,45,67,67,67,67,67,67,67,67,67,67,67,67,1769,67,0,546,70179,549,549,0,0,552,0,97,97,97,97,97,97,97,45,45,45,45,45,45,1858,45,641,0,0,0,0,41606,926,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,456,67,0,0,0,1313,0,0,0,1096,1319,0,0,0,0,97,97,97,97,97,97,97,97,1110,97,97,97,97,67,67,67,67,1301,1476,0,0,0,0,1307,1478,0,0,0,0,0,0,0,0,97,97,97,97,1486,97,1487,97,1313,1480,0,0,0,0,1319,0,97,97,97,97,97,97,97,97,97,566,97,97,97,97,97,97,67,67,67,1476,0,1478,0,1480,0,97,97,97,97,97,97,97,45,1853,45,1855,45,45,45,45,53264,18,49172,57366,26,8192,31,102432,0,110630,114730,106539,0,0,225368,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,32768,53264,18,18,49172,163840,57366,0,24,24,229376,0,28,28,28,229376,102432,0,0,0,0,2220167,110630,0,0,0,114730,106539,0,2171019,2171019,2171019,2171019,2592907,2171019,2171019,2171019,2171019,2633867,2171019,2171019,2171019,2171019,2171019,2171019,2654347,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3117195,2171019,2171019,2171019,2171019,2240641,0,0,0,0,0,0,0,0,368,0,140,2171019,2171019,2171019,2416779,2424971,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2617483,2171019,2171019,2642059,2171019,2171019,2171019,2699403,2171019,2728075,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3215499,2215936,2215936,2215936,2215936,2215936,2437120,2215936,2215936,2171019,2822283,2171019,2171019,2855051,2171019,2171019,2171019,2912395,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3002507,2171019,2171019,2215936,2215936,2494464,2215936,2215936,2215936,2171166,2171166,2416926,2425118,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2576670,2171166,2617630,2171166,2171166,2171166,2171166,2171166,2171166,2691358,2171166,2707742,2171166,2715934,2171166,2724126,2765086,2171166,2171166,2797854,2171166,2822430,2171166,2171166,2855198,2171166,2171166,2171166,2912542,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2793758,2806046,2171166,2830622,2171166,2171166,2171166,2171166,2171166,2171166,2171166,3109150,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2543902,2171166,2171166,2171166,2171166,2171166,2629918,2793611,2805899,2171019,2830475,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,0,546,0,0,2183168,0,0,552,0,2171166,2171166,2171166,2400542,2171166,2171166,2171166,0,2171166,2171166,2171166,0,2171166,2920734,2171166,2171166,2171166,2990366,2171166,2171166,2171166,2171166,3117342,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,0,53264,0,18,18,4329472,2232445,0,2240641,4337664,2711691,2171019,2171019,2171019,2171019,2171019,2760843,2769035,2789515,2814091,2171019,2171019,2171019,2875531,2904203,2171019,2171019,3092619,2171019,2171019,3125387,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3199115,2171019,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2453504,2457600,2215936,2215936,2215936,2215936,2215936,2215936,2793472,2805760,2215936,2830336,2215936,2215936,2215936,2215936,2215936,2215936,2170880,2170880,2170880,2170880,2170880,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2494464,2170880,2170880,2171166,2171166,2634014,2171166,2171166,2171166,2171166,2171166,2171166,2711838,2171166,2171166,2171166,2171166,2171166,2760990,2769182,2789662,2814238,2171166,2171166,2171166,2875678,2904350,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,3199262,2171166,0,0,0,0,0,0,0,0,0,2379915,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2445451,2171019,2465931,2474123,2171019,2171019,3113099,2171019,2171019,3133579,2171019,2171019,2171019,3162251,2171019,2171019,3182731,3186827,2171019,2379776,2879627,2171019,2916491,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3027083,2171019,2171019,3063947,2699550,2171166,2728222,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2879774,2171166,2916638,2171166,2171166,2171166,2171166,2171166,2609438,2171166,2171166,2171166,2171166,2171166,2171166,2654494,2171166,2171166,2171166,2171166,2171166,2445598,2171166,2466078,2474270,2171166,2171166,2171166,2171166,2171166,2171166,2523422,2171019,2437259,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2543755,2171019,2171019,2171019,2584715,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2908299,2171019,2171019,2936971,2171019,2171019,2986123,2171019,2994315,2171019,2171019,3014795,2171019,3059851,3076235,3088523,2171166,2171166,2986270,2171166,2994462,2171166,2171166,3014942,2171166,3059998,3076382,3088670,2171166,2171166,2171166,2171166,2171166,2171166,3027230,2171166,2171166,3064094,2171166,2171166,3113246,2171166,2171166,3133726,2506891,2171019,2171019,2171019,2535563,2539659,2171019,2171019,2588811,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2691211,2171019,2707595,2171019,2715787,2171019,2723979,2764939,2171019,2171019,2797707,2215936,2215936,3170304,0,0,0,0,0,0,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2453790,2457886,2171166,2171166,2171166,2486558,2171166,2171166,2507038,2171166,2171166,2171166,2535710,2539806,2171166,2171166,2588958,2171166,2171166,2171166,2171166,2515230,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2593054,2171166,2171166,2171166,2171166,3051806,2171166,2171166,2171166,2171166,2171166,2171166,3170590,0,2388107,2392203,2171019,2171019,2433163,2171019,2461835,2171019,2171019,2171019,2510987,2171019,2171019,2171019,2171019,2580619,2171019,2605195,2637963,2171019,2171019,2171019,2920587,2171019,2171019,2171019,2990219,2171019,2171019,2171019,2171019,3051659,2171019,2171019,2171019,2453643,2457739,2171019,2171019,2171019,2171019,2171019,2171019,2515083,2171019,2171019,2171019,2171019,2646155,2670731,2752651,2756747,2846859,2961547,2171019,2998411,2171019,3010699,2171019,2171019,2687115,2748555,2171019,2171019,2171019,2924683,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3121291,2171019,2171019,2171019,3170443,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2486272,2215936,2215936,2506752,3145867,3158155,3166347,2387968,2392064,2215936,2215936,2433024,2215936,2461696,2215936,2215936,2215936,2510848,2215936,2215936,0,0,0,0,0,0,2179072,0,0,0,0,0,553,2170880,2215936,2215936,2215936,2215936,2215936,3121152,2215936,2215936,3145728,3158016,3166208,2388254,2392350,2171166,2171166,2433310,2171166,2461982,2171166,2171166,2171166,2511134,2171166,2171166,0,2171166,2171166,2580766,2171166,2605342,2638110,2171166,2171166,2171166,2171166,3031326,2171166,3055902,2171166,2171166,2171166,2171166,3092766,2171166,2171166,3125534,2171166,2171166,2171166,3162398,2171166,2171166,3182878,3186974,2171166,0,0,0,2171019,2171019,2171019,2171019,3109003,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2215936,2215936,2215936,2400256,2215936,2215936,2215936,2215936,2171166,2687262,0,0,2748702,2171166,2171166,0,2171166,2924830,2171166,2171166,2171166,2171166,2171166,2171166,2171166,2597150,2171166,2621726,2171166,2171166,2642206,2171166,2171166,2171166,2171166,3121438,2171166,2171166,3146014,3158302,3166494,2171019,2420875,2429067,2171019,2478219,2171019,2171019,2171019,2171019,2547851,2556043,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,3129483,2215936,2171019,3141771,2215936,2420736,2428928,2215936,2478080,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2646016,2670592,2752512,2756608,2846720,2961408,2215936,2998272,2215936,3010560,2215936,2215936,2215936,3141632,2171166,2421022,2429214,2171166,2478366,2171166,2171166,2171166,2171166,0,0,2171166,2171166,2171166,2171166,2646302,2670878,0,0,0,0,37,110630,0,0,0,114730,106539,0,45,45,45,45,45,1405,1406,45,45,45,45,1409,45,45,45,45,45,1415,45,45,45,45,45,45,45,45,45,45,1238,45,45,45,45,67,2752798,2756894,0,2847006,2961694,2171166,2998558,2171166,3010846,2171166,2171166,2171166,3141918,2171019,2171019,2490507,3129344,2171166,2171166,2490654,2171166,2171166,2171166,0,0,2547998,2556190,2171166,2171166,2171166,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,45,167,45,45,45,45,185,187,45,45,198,45,45,0,2171166,2171166,2171166,2171166,2171166,2171166,3129630,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2576523,2171019,2171019,2171019,2171019,2171019,2609291,2171019,2215936,2215936,2215936,2215936,2215936,2215936,3002368,2215936,2215936,2171166,2171166,2494750,2171166,2171166,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,147,2584576,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2171166,2171166,2171166,2171166,0,0,0,2171166,2171166,2171166,2171166,0,0,0,2171166,2171166,2171166,3002654,2171166,2171166,2171019,2171019,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,0,0,0,2175257,0,0,2584862,2171166,2171166,0,0,2171166,2171166,2171166,2171166,2171166,2171019,2441355,2171019,2527371,2171019,2601099,2171019,2850955,2171019,2171019,2171019,3022987,2215936,2441216,2215936,2527232,2215936,2600960,2215936,2850816,2215936,2215936,0,0,0,0,0,0,2179072,0,0,0,0,69632,287,2170880,2215936,3022848,2171166,2441502,2171166,2527518,0,0,2171166,2601246,2171166,0,2851102,2171166,2171166,2171166,2171166,2720030,2744606,2171166,2171166,2171166,2834718,2838814,2171166,2908446,2171166,2171166,2937118,3023134,2171019,2519179,2171019,2171019,2171019,2171019,2171019,2215936,2519040,2215936,2215936,2215936,2215936,2215936,2171166,2171166,2171166,3215646,0,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2171019,2486411,2171019,2171019,2171019,2629771,2171019,2171019,2171019,2171019,2719883,2744459,2171019,2171019,2171019,2834571,2838667,2171019,2519326,0,0,2171166,2171166,0,2171166,2171166,2171166,2396299,2171019,2171019,2171019,2171019,3018891,2396160,2215936,2215936,2215936,2215936,3018752,2396446,0,0,2171166,2171166,2171166,2171166,3019038,2171019,2650251,2965643,2171019,2215936,2650112,2965504,2215936,0,0,2171166,2650398,2965790,2171166,2551947,2171019,2551808,2215936,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,144,45,45,67,67,67,67,67,228,67,67,67,67,67,67,67,67,67,1929,97,97,97,97,0,0,0,2552094,2171166,2171019,2215936,0,2171166,2171019,2215936,0,2171166,2171019,2215936,0,2171166,2977931,2977792,2978078,0,0,0,0,0,0,0,0,0,0,0,0,0,0,97,1321,97,131072,0,0,0,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,18,18,24,24,0,28,28,0,140,0,2379776,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2445312,2170880,2465792,2473984,2170880,2170880,2170880,2584576,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2170880,2170880,2170880,3162112,2170880,2170880,3182592,3186688,2170880,0,140,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3002368,2170880,2170880,2215936,2215936,2494464,2215936,2215936,2215936,2215936,2215936,2215936,3215360,544,0,0,0,544,0,546,0,0,0,546,0,0,2183168,0,0,552,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,0,2170880,2170880,2170880,0,2170880,2920448,2170880,2170880,2170880,2990080,2170880,2170880,552,0,0,0,552,0,287,0,2170880,2170880,2170880,2170880,2170880,2437120,2170880,2170880,18,0,0,0,0,0,0,0,0,2220032,0,0,644,0,2215936,2215936,3170304,544,0,546,0,552,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3198976,2170880,0,0,0,140,0,0,53264,18,49172,57366,24,8192,28,102432,249856,110630,114730,106539,0,0,32768,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,151640,53264,18,18,49172,0,57366,0,24,24,24,0,28,28,28,28,0,0,0,0,0,0,0,0,0,0,0,2170880,2170880,2170880,2416640,53264,18,49172,57366,24,8192,28,102432,253952,110630,114730,106539,0,0,32856,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,192512,53264,18,18,49172,0,57366,0,2232445,184320,2232445,0,2240641,2240641,184320,2240641,102432,0,0,0,221184,2220032,110630,0,0,0,114730,106539,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3108864,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2215936,0,0,0,45056,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,0,53264,0,18,18,24,24,0,127,127,53264,18,49172,258071,24,8192,28,102432,0,110630,114730,106539,0,0,32768,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,204800,53264,18,49172,57366,24,27,28,102432,0,110630,114730,106539,0,0,0,53264,18,49172,57366,24,8192,28,33,0,33,33,33,0,0,0,53264,18,18,49172,0,57366,0,24,24,24,16384,28,28,28,28,0,0,0,0,0,0,0,0,0,0,139,2170880,2170880,2170880,2416640,67,67,37139,37139,24853,24853,0,70179,0,0,0,65820,65820,369,287,97,0,0,97,97,0,97,97,97,45,2030,45,45,45,45,67,1573,67,67,67,67,67,67,67,67,67,67,67,1699,67,67,67,67,25403,546,70179,0,0,66365,66365,552,0,97,97,97,97,97,97,97,97,1355,97,97,97,1358,97,97,97,641,0,0,0,925,41606,0,0,0,0,45,45,45,45,45,45,45,1187,45,45,45,45,45,0,1480,0,0,0,0,1319,0,97,97,97,97,97,97,97,97,97,592,97,97,97,97,97,97,97,97,97,97,1531,45,45,45,45,45,45,45,45,45,45,45,45,1680,45,45,45,641,0,924,0,925,41606,0,0,0,0,45,45,45,45,45,45,1186,45,45,45,45,45,45,67,67,37139,37139,24853,24853,0,70179,282,0,0,65820,65820,369,287,97,0,0,97,97,0,97,2028,97,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,1767,67,67,67,0,0,0,0,0,0,1612,97,97,97,97,97,97,0,1785,97,97,97,97,97,97,0,0,97,97,97,97,1790,97,0,0,2170880,2170880,3051520,2170880,2170880,2170880,2170880,2170880,2170880,3170304,241664,2387968,2392064,2170880,2170880,2433024,53264,19,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,274432,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,270336,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,1134711,53264,18,49172,57366,24,8192,28,102432,0,1126440,1126440,1126440,0,0,1126400,53264,18,49172,57366,24,8192,28,102432,36,110630,114730,106539,0,0,217088,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,94,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,96,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,24666,53264,18,18,49172,0,57366,0,24,24,24,126,28,28,28,28,102432,53264,122,123,49172,0,57366,0,24,24,24,0,28,28,28,28,102432,2170880,2170880,4256099,0,0,0,0,0,0,0,0,2220032,0,0,0,0,0,0,0,0,1319,0,0,0,0,97,97,97,97,97,97,97,1109,97,97,97,97,1113,132,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,146,150,45,45,45,45,45,175,45,180,45,186,45,189,45,45,203,67,256,67,67,270,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,97,293,297,97,97,97,97,97,322,97,327,97,333,97,0,0,97,2026,0,2027,97,97,45,45,45,45,45,45,67,67,67,1685,67,67,67,67,67,67,67,1690,67,336,97,97,350,97,97,0,53264,0,18,18,24,24,356,28,28,0,0,0,0,0,0,0,0,0,0,140,2170880,2170880,2170880,2416640,2424832,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2617344,2170880,45,439,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,525,67,67,67,67,67,67,67,67,67,67,67,0,0,0,0,0,0,0,0,0,0,0,0,97,97,97,97,622,97,97,97,97,97,97,97,97,97,97,97,97,1524,97,97,1527,369,648,45,45,45,45,45,45,45,45,45,659,45,45,45,45,408,45,45,45,45,45,45,45,45,45,45,45,1239,45,45,45,67,729,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,762,67,746,67,67,67,67,67,67,67,67,67,759,67,67,67,67,0,0,0,1477,0,1086,0,0,0,1479,0,1090,67,67,796,67,67,799,67,67,67,67,67,67,67,67,67,67,67,67,1291,67,67,67,811,67,67,67,67,67,816,67,67,67,67,67,67,67,37689,544,25403,546,70179,0,0,66365,66365,552,833,97,97,97,97,97,97,97,97,1380,0,0,0,45,45,45,45,45,1185,45,45,45,45,45,45,45,386,45,45,45,45,45,45,45,45,1810,45,45,45,45,45,45,67,97,97,844,97,97,97,97,97,97,97,97,97,857,97,97,97,0,97,97,97,0,97,97,97,97,97,97,97,97,97,97,45,45,45,97,97,97,894,97,97,897,97,97,97,97,97,97,97,97,97,0,0,0,1382,45,45,45,97,909,97,97,97,97,97,914,97,97,97,97,97,97,97,923,67,67,1079,67,67,67,67,67,37689,1085,25403,1089,66365,1093,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,148,1114,97,97,97,97,97,97,1122,97,97,97,97,97,97,97,97,97,606,97,97,97,97,97,97,97,97,97,97,1173,97,97,97,97,97,12288,0,925,0,1179,0,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,145,45,45,67,67,67,67,67,1762,67,67,67,1766,67,67,67,67,67,67,528,67,67,67,67,67,67,67,67,67,97,97,97,97,97,0,1934,67,67,1255,67,67,67,67,67,67,67,67,67,67,67,67,67,1035,67,67,67,67,67,67,1297,67,67,67,67,67,67,0,0,0,0,0,0,97,97,97,97,97,97,97,97,97,97,1111,97,97,97,97,97,97,1327,97,97,97,97,97,97,97,97,97,97,97,97,33344,97,97,97,1335,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,0,97,97,1377,97,97,97,97,97,97,0,1179,0,45,45,45,45,670,45,45,45,45,45,45,45,45,45,45,45,430,45,45,45,45,67,67,1438,67,67,1442,67,67,67,67,67,67,67,67,67,67,67,67,1592,67,67,67,1451,67,67,67,67,67,67,67,67,67,67,1458,67,67,67,67,0,0,1305,0,0,0,0,0,1311,0,0,0,1317,0,0,0,0,0,0,0,97,97,1322,97,97,1491,97,97,1495,97,97,97,97,97,97,97,97,97,97,0,45,45,45,45,45,45,45,45,45,45,45,45,1551,45,1553,45,1504,97,97,97,97,97,97,97,97,97,97,1513,97,97,97,97,0,45,45,45,45,1536,45,45,45,45,1540,45,67,67,67,67,67,1585,67,67,67,67,67,67,67,67,67,67,67,67,1700,67,67,67,97,1648,97,97,97,97,97,97,97,97,0,45,45,45,45,45,45,45,45,45,45,1541,0,97,97,97,97,0,1940,0,97,97,97,97,97,97,45,45,2011,45,45,45,2015,67,67,2017,67,67,67,2021,97,67,67,812,67,67,67,67,67,67,67,67,67,67,67,37689,544,97,97,97,910,97,97,97,97,97,97,97,97,97,97,97,923,0,0,0,45,45,45,45,1184,45,45,45,45,1188,45,45,45,45,1414,45,45,45,1417,45,1419,45,45,45,45,45,443,45,45,45,45,45,45,453,45,45,67,67,67,67,1244,67,67,67,67,1248,67,67,67,67,67,67,67,0,37139,24853,0,0,0,282,41098,65820,97,1324,97,97,97,97,1328,97,97,97,97,97,97,97,97,97,0,0,930,45,45,45,45,97,97,97,97,1378,97,97,97,97,0,1179,0,45,45,45,45,671,45,45,45,45,45,45,45,45,45,45,45,975,45,45,45,45,67,67,1923,67,1925,67,67,1927,67,97,97,97,97,97,0,0,97,97,97,97,1985,45,45,45,45,45,45,1560,45,45,45,45,45,45,45,45,45,946,45,45,950,45,45,45,0,97,97,97,1939,0,0,0,97,1943,97,97,1945,97,45,45,45,669,45,45,45,45,45,45,45,45,45,45,45,45,990,45,45,45,67,257,67,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,337,97,97,97,97,97,0,53264,0,18,18,24,24,356,28,28,0,0,0,0,0,0,0,0,0,0,370,2170880,2170880,2170880,2416640,401,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,459,461,67,67,67,67,67,67,67,67,475,67,480,67,67,67,67,67,67,1054,67,67,67,67,67,67,67,67,67,67,1698,67,67,67,67,67,484,67,67,487,67,67,67,67,67,67,67,67,67,67,67,67,67,1459,67,67,97,556,558,97,97,97,97,97,97,97,97,572,97,577,97,97,0,0,1896,97,97,97,97,97,97,1903,45,45,45,45,983,45,45,45,45,988,45,45,45,45,45,45,1195,45,45,45,45,45,45,45,45,45,45,1549,45,45,45,45,45,581,97,97,584,97,97,97,97,97,97,97,97,97,97,97,97,97,1153,97,97,369,0,45,45,45,45,45,45,45,45,45,45,45,662,45,45,45,684,45,45,45,45,45,45,45,45,45,45,45,45,1004,45,45,45,67,67,67,749,67,67,67,67,67,67,67,67,67,761,67,67,67,67,67,67,1068,67,67,67,1071,67,67,67,67,1076,794,795,67,67,67,67,67,67,67,67,67,67,67,67,67,67,0,544,97,97,97,97,847,97,97,97,97,97,97,97,97,97,859,97,0,0,2025,97,20480,97,97,2029,45,45,45,45,45,45,67,67,67,1575,67,67,67,67,67,67,67,67,67,1775,67,67,67,97,97,97,97,892,893,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1515,97,993,994,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,992,67,67,67,1284,67,67,67,67,67,67,67,67,67,67,67,67,67,1607,67,67,97,1364,97,97,97,97,97,97,97,97,97,97,97,97,97,97,596,97,45,1556,1557,45,45,45,45,45,45,45,45,45,45,45,45,45,45,696,45,1596,1597,67,67,67,67,67,67,67,67,67,67,67,67,67,67,499,67,97,97,97,1621,97,97,97,97,97,97,97,97,97,97,97,97,97,1346,97,97,97,97,1740,97,97,97,97,45,45,45,45,45,45,45,45,45,45,1678,45,45,45,45,45,67,97,97,97,97,97,97,1836,0,97,97,97,97,97,0,0,97,97,97,1984,97,45,45,45,45,45,45,1808,45,45,45,45,45,45,45,45,67,739,67,67,67,67,67,744,45,45,1909,45,45,45,45,45,45,45,67,1917,67,1918,67,67,67,67,67,67,1247,67,67,67,67,67,67,67,67,67,67,532,67,67,67,67,67,67,1922,67,67,67,67,67,67,67,97,1930,97,1931,97,0,0,97,97,0,97,97,97,45,45,45,45,45,45,67,67,67,67,1576,67,67,67,67,1580,67,67,0,97,97,1938,97,0,0,0,97,97,97,97,97,97,45,45,45,699,45,45,45,704,45,45,45,45,45,45,45,45,987,45,45,45,45,45,45,45,67,67,97,97,97,97,0,0,97,97,97,2006,97,97,97,97,0,45,1533,45,45,45,45,45,45,45,45,45,1416,45,45,45,45,45,45,45,45,722,723,45,45,45,45,45,45,2045,67,67,67,2047,0,0,97,97,97,2051,45,45,67,67,0,0,0,0,925,41606,0,0,0,0,45,45,45,45,45,45,409,45,45,45,45,45,45,45,45,45,1957,45,67,67,67,67,67,1836,97,97,45,67,0,97,45,67,0,97,45,67,0,97,45,45,67,67,67,1761,67,67,67,1764,67,67,67,67,67,67,67,494,67,67,67,67,67,67,67,67,67,787,67,67,67,67,67,67,45,45,420,45,45,422,45,45,425,45,45,45,45,45,45,45,387,45,45,45,45,397,45,45,45,67,460,67,67,67,67,67,67,67,67,67,67,67,67,67,67,515,67,485,67,67,67,67,67,67,67,67,67,67,67,67,67,498,67,67,67,67,67,97,0,2039,97,97,97,97,97,45,45,45,45,1426,45,45,45,67,67,67,67,67,67,67,67,67,1689,67,67,67,97,557,97,97,97,97,97,97,97,97,97,97,97,97,97,97,612,97,582,97,97,97,97,97,97,97,97,97,97,97,97,97,595,97,97,97,97,97,896,97,97,97,97,97,97,97,97,97,97,885,97,97,97,97,97,45,939,45,45,45,45,943,45,45,45,45,45,45,45,45,45,45,1916,67,67,67,67,67,45,67,67,67,67,67,67,67,1015,67,67,67,67,1019,67,67,67,67,67,67,1271,67,67,67,67,67,67,1277,67,67,67,67,67,67,1287,67,67,67,67,67,67,67,67,67,67,804,67,67,67,67,67,1077,67,67,67,67,67,67,67,37689,0,25403,0,66365,0,0,0,0,0,0,0,0,2170880,2170880,2170880,2170880,2170880,2437120,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2543616,2170880,2170880,2170880,2170880,2170880,2629632,1169,97,1171,97,97,97,97,97,97,97,12288,0,925,0,1179,0,0,0,0,925,41606,0,0,0,0,45,45,45,45,936,45,45,67,67,214,67,220,67,67,233,67,243,67,248,67,67,67,67,67,67,1298,67,67,67,67,0,0,0,0,0,0,97,97,97,97,97,1617,97,0,0,0,45,45,45,1183,45,45,45,45,45,45,45,45,45,393,45,45,45,45,45,45,67,67,1243,67,67,67,67,67,67,67,67,67,67,67,67,67,1074,67,67,1281,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,776,1323,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,907,45,1412,45,45,45,45,45,45,45,1418,45,45,45,45,45,45,686,45,45,45,690,45,45,695,45,45,67,67,67,67,67,1465,67,67,67,67,67,67,67,67,67,67,67,97,97,97,1712,97,97,97,97,1741,97,97,97,45,45,45,45,45,45,45,45,45,426,45,45,45,45,45,45,67,67,67,1924,67,67,67,67,67,97,97,97,97,97,0,0,97,97,1983,97,97,45,45,1987,45,1988,45,0,97,97,97,97,0,0,0,1942,97,97,97,97,97,45,45,45,700,45,45,45,45,45,45,45,45,45,45,711,45,45,153,45,45,166,45,176,45,181,45,45,188,191,196,45,204,255,258,263,67,271,67,67,0,37139,24853,0,0,0,282,41098,65820,97,97,97,294,97,300,97,97,313,97,323,97,328,97,97,335,338,343,97,351,97,97,0,53264,0,18,18,24,24,356,28,28,0,0,0,0,0,0,0,0,41098,0,140,45,45,45,45,1404,45,45,45,45,45,45,45,45,45,45,1411,67,67,486,67,67,67,67,67,67,67,67,67,67,67,67,67,1251,67,67,501,67,67,67,67,67,67,67,67,67,67,67,67,513,67,67,67,67,67,67,1443,67,67,67,67,67,67,67,67,67,67,1263,67,67,67,67,67,97,97,583,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1526,97,598,97,97,97,97,97,97,97,97,97,97,97,97,610,97,97,0,97,97,1796,97,97,97,97,97,97,97,45,45,45,45,45,1744,45,45,45,369,0,651,45,653,45,654,45,656,45,45,45,660,45,45,45,45,1558,45,45,45,45,45,45,45,45,1566,45,45,681,45,683,45,45,45,45,45,45,45,45,691,692,694,45,45,45,716,45,45,45,45,45,45,45,45,45,45,45,45,709,45,45,712,45,714,45,45,45,718,45,45,45,45,45,45,45,726,45,45,45,733,45,45,45,45,67,67,67,67,67,67,67,67,67,67,67,67,1691,67,67,747,67,67,67,67,67,67,67,67,67,760,67,67,67,0,0,0,0,0,0,97,1613,97,97,97,97,97,97,1509,97,97,97,97,97,97,97,97,97,0,1179,0,45,45,45,45,67,764,67,67,67,67,768,67,770,67,67,67,67,67,67,67,67,97,97,97,97,0,0,0,1977,67,778,779,781,67,67,67,67,67,67,788,789,67,67,792,793,67,67,67,813,67,67,67,67,67,67,67,67,67,824,37689,544,25403,546,70179,0,0,66365,66365,552,0,836,97,838,97,839,97,841,97,97,97,845,97,97,97,97,97,97,97,97,97,858,97,97,0,1728,97,97,97,0,97,97,97,97,97,97,97,97,97,97,45,1802,45,97,97,862,97,97,97,97,866,97,868,97,97,97,97,97,97,0,0,97,97,1788,97,97,97,0,0,97,97,876,877,879,97,97,97,97,97,97,886,887,97,97,890,891,97,97,97,97,97,97,97,899,97,97,97,903,97,97,97,0,97,97,97,0,97,97,97,97,97,97,97,1646,97,97,97,97,911,97,97,97,97,97,97,97,97,97,922,923,45,955,45,957,45,45,45,45,45,45,45,45,45,45,45,45,195,45,45,45,45,45,981,982,45,45,45,45,45,45,989,45,45,45,45,45,170,45,45,45,45,45,45,45,45,45,45,411,45,45,45,45,45,67,1023,67,67,67,67,67,67,1031,67,1033,67,67,67,67,67,67,67,817,819,67,67,67,67,67,37689,544,67,1065,67,67,67,67,67,67,67,67,67,67,67,67,67,67,516,67,67,1078,67,67,1081,1082,67,67,37689,0,25403,0,66365,0,0,0,0,0,0,0,0,2171166,2171166,2171166,2171166,2171166,2437406,2171166,2171166,97,1115,97,1117,97,97,97,97,97,97,1125,97,1127,97,97,97,0,97,97,97,0,97,97,97,97,1644,97,97,97,0,97,97,97,0,97,97,1642,97,97,97,97,97,97,625,97,97,97,97,97,97,97,97,97,316,97,97,97,97,97,97,97,97,97,1159,97,97,97,97,97,97,97,97,97,97,97,97,97,1502,97,97,97,97,97,1172,97,97,1175,1176,97,97,12288,0,925,0,1179,0,0,0,0,925,41606,0,0,0,0,45,45,45,935,45,45,45,1233,45,45,45,1236,45,45,45,45,45,45,45,67,67,67,67,67,67,1873,67,67,45,45,1218,45,45,45,1223,45,45,45,45,45,45,45,1230,45,45,67,67,215,219,222,67,230,67,67,244,246,249,67,67,67,67,67,67,1882,97,97,97,97,0,0,0,97,97,97,97,97,97,45,1904,45,1905,45,67,67,67,67,67,1258,67,1260,67,67,67,67,67,67,67,67,67,495,67,67,67,67,67,67,67,67,1283,67,67,67,67,67,67,67,1290,67,67,67,67,67,67,67,818,67,67,67,67,67,67,37689,544,67,67,1295,67,67,67,67,67,67,67,67,0,0,0,0,0,0,2174976,0,0,97,97,97,1326,97,97,97,97,97,97,97,97,97,97,97,97,97,1514,97,97,97,97,97,1338,97,1340,97,97,97,97,97,97,97,97,97,97,97,1500,97,97,1503,97,1363,97,97,97,97,97,97,97,1370,97,97,97,97,97,97,97,563,97,97,97,97,97,97,578,97,1375,97,97,97,97,97,97,97,97,0,1179,0,45,45,45,45,685,45,45,45,45,45,45,45,45,45,45,45,1003,45,45,45,45,67,67,67,1463,67,67,67,67,67,67,67,67,67,67,67,67,67,1778,97,97,97,97,97,1518,97,97,97,97,97,97,97,97,97,97,97,97,609,97,97,97,45,1542,45,45,45,45,45,45,45,1548,45,45,45,45,45,1554,45,1570,1571,45,67,67,67,67,67,67,1578,67,67,67,67,67,67,67,1055,67,67,67,67,67,1061,67,67,1582,67,67,67,67,67,67,67,1588,67,67,67,67,67,1594,67,67,67,67,67,97,2038,0,97,97,97,97,97,2044,45,45,45,995,45,45,45,45,1e3,45,45,45,45,45,45,45,1809,45,1811,45,45,45,45,45,67,1610,1611,67,1476,0,1478,0,1480,0,97,97,97,97,97,97,1618,1647,1649,97,97,97,1652,97,1654,1655,97,0,45,45,45,1658,45,45,67,67,216,67,67,67,67,234,67,67,67,67,252,254,1845,97,97,97,97,97,97,97,45,45,45,45,45,45,45,45,945,45,947,45,45,45,45,45,67,67,67,67,67,1881,97,97,97,97,97,0,0,0,97,97,97,97,97,1902,45,45,45,45,45,45,1908,45,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,1921,67,67,67,67,67,67,67,67,97,97,97,97,97,0,0,0,97,97,0,97,1937,97,97,1940,0,0,97,97,97,97,97,97,1947,1948,1949,45,45,45,1952,45,1954,45,45,45,45,1959,1960,1961,67,67,67,67,67,67,1455,67,67,67,67,67,67,67,67,67,67,757,67,67,67,67,67,67,1964,67,1966,67,67,67,67,1971,1972,1973,97,0,0,0,97,97,1104,97,97,97,97,97,97,97,97,97,97,884,97,97,97,889,97,97,1978,97,0,0,1981,97,97,97,97,45,45,45,45,45,45,736,45,67,67,67,67,67,67,67,67,67,67,67,1018,67,67,67,45,67,67,67,67,0,2049,97,97,97,97,45,45,67,67,0,0,0,0,925,41606,0,0,0,0,45,933,45,45,45,45,1234,45,45,45,45,45,45,45,45,45,45,67,97,97,288,97,97,97,97,97,97,317,97,97,97,97,97,97,0,0,97,1787,97,97,97,97,0,0,45,45,378,45,45,45,45,45,390,45,45,45,45,45,45,45,424,45,45,45,431,433,45,45,45,67,1050,67,67,67,67,67,67,67,67,67,67,67,67,67,67,518,67,97,97,97,1144,97,97,97,97,97,97,97,97,97,97,97,97,632,97,97,97,97,97,97,97,1367,97,97,97,97,97,97,97,97,97,97,97,855,97,97,97,97,67,97,97,97,97,97,97,1837,0,97,97,97,97,97,0,0,0,1897,97,97,97,97,97,45,45,45,45,45,1208,45,45,45,45,45,45,45,45,45,45,724,45,45,45,45,45,97,2010,45,45,45,45,45,45,2016,67,67,67,67,67,67,2022,45,2046,67,67,67,0,0,2050,97,97,97,45,45,67,67,0,0,0,0,925,41606,0,0,0,0,932,45,45,45,45,45,1222,45,45,45,45,45,45,45,45,45,45,1227,45,45,45,45,45,133,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,45,701,702,45,45,705,706,45,45,45,45,45,45,703,45,45,45,45,45,45,45,45,45,719,45,45,45,45,45,725,45,45,45,369,649,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1216,25403,546,70179,0,0,66365,66365,552,834,97,97,97,97,97,97,97,1342,97,97,97,97,97,97,97,97,0,97,97,97,97,97,97,97,1799,97,97,45,45,45,1569,45,45,45,1572,67,67,67,67,67,67,67,67,67,67,67,0,0,0,1306,0,67,67,67,1598,67,67,67,67,67,67,67,67,1606,67,67,1609,97,97,97,1650,97,97,1653,97,97,97,0,45,45,1657,45,45,45,1206,45,45,45,45,45,45,45,45,45,45,45,45,1421,45,45,45,1703,67,67,67,67,67,67,67,67,67,67,97,97,1711,97,97,0,1895,0,97,97,97,97,97,97,45,45,45,45,45,958,45,960,45,45,45,45,45,45,45,45,1913,45,45,1915,67,67,67,67,67,67,67,466,67,67,67,67,67,67,481,67,45,1749,45,45,45,45,45,45,45,45,1755,45,45,45,45,45,173,45,45,45,45,45,45,45,45,45,45,974,45,45,45,45,45,67,67,67,67,67,1773,67,67,67,67,67,67,67,97,97,97,97,1886,0,0,0,97,97,67,2035,2036,67,67,97,0,0,97,2041,2042,97,97,45,45,45,45,1662,45,45,45,45,45,45,45,45,45,45,45,1397,45,45,45,45,151,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,437,205,45,67,67,67,218,67,67,67,67,67,67,67,67,67,67,67,1047,67,67,67,67,97,97,97,97,298,97,97,97,97,97,97,97,97,97,97,97,870,97,97,97,97,97,97,97,97,352,97,0,53264,0,18,18,24,24,0,28,28,0,0,0,0,0,0,365,0,41098,0,140,45,45,45,45,45,1427,45,45,67,67,67,67,67,67,67,1435,520,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1037,617,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,923,45,1232,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,67,67,1919,67,1759,45,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1021,45,154,45,162,45,45,45,45,45,45,45,45,45,45,45,45,964,45,45,45,206,45,67,67,67,67,221,67,229,67,67,67,67,67,67,67,67,530,67,67,67,67,67,67,67,67,755,67,67,67,67,67,67,67,67,785,67,67,67,67,67,67,67,67,802,67,67,67,807,67,67,67,97,97,97,97,353,97,0,53264,0,18,18,24,24,0,28,28,0,0,0,0,0,0,366,0,0,0,140,2170880,2170880,2170880,2416640,402,45,45,45,45,45,45,45,410,45,45,45,45,45,45,45,674,45,45,45,45,45,45,45,45,389,45,394,45,45,398,45,45,45,45,441,45,45,45,45,45,447,45,45,45,454,45,45,67,67,67,67,67,67,67,67,67,67,67,1768,67,67,67,67,67,488,67,67,67,67,67,67,67,496,67,67,67,67,67,67,67,1774,67,67,67,67,67,97,97,97,97,0,0,97,97,97,0,97,97,97,97,97,97,97,97,67,67,523,67,67,527,67,67,67,67,67,533,67,67,67,540,97,97,97,585,97,97,97,97,97,97,97,593,97,97,97,97,97,97,1784,0,97,97,97,97,97,97,0,0,97,97,97,97,97,97,0,0,0,18,18,24,24,0,28,28,97,97,620,97,97,624,97,97,97,97,97,630,97,97,97,637,713,45,45,45,45,45,45,721,45,45,45,45,45,45,45,45,1197,45,45,45,45,45,45,45,45,730,732,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,1581,67,45,67,67,67,67,1012,67,67,67,67,67,67,67,67,67,67,67,1059,67,67,67,67,67,1024,67,67,67,67,67,67,67,67,67,67,67,67,67,67,775,67,67,67,67,1066,67,67,67,67,67,67,67,67,67,67,67,67,479,67,67,67,67,67,67,1080,67,67,67,67,37689,0,25403,0,66365,0,0,0,0,0,0,0,287,0,0,0,287,0,2379776,2170880,2170880,97,97,97,1118,97,97,97,97,97,97,97,97,97,97,97,97,920,97,97,0,0,0,0,45,1181,45,45,45,45,45,45,45,45,45,45,45,432,45,45,45,45,45,45,1219,45,45,45,45,45,45,1226,45,45,45,45,45,45,959,45,45,45,45,45,45,45,45,45,184,45,45,45,45,202,45,1241,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1266,67,1268,67,67,67,67,67,67,67,67,67,67,67,67,1279,67,67,67,67,67,272,67,0,37139,24853,0,0,0,0,41098,65820,67,67,67,67,67,1286,67,67,67,67,67,67,67,67,67,1293,67,67,67,1296,67,67,67,67,67,67,67,0,0,0,0,0,281,94,0,0,97,97,97,1366,97,97,97,97,97,97,97,97,97,1373,97,97,18,0,139621,0,0,0,0,0,0,364,0,0,367,0,97,1376,97,97,97,97,97,97,97,0,0,0,45,45,1384,45,45,67,208,67,67,67,67,67,67,237,67,67,67,67,67,67,67,1069,1070,67,67,67,67,67,67,67,0,37140,24854,0,0,0,0,41098,65821,45,1423,45,45,45,45,45,45,67,67,1431,67,67,67,67,67,67,67,1083,37689,0,25403,0,66365,0,0,0,1436,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1830,67,1452,1453,67,67,67,67,1456,67,67,67,67,67,67,67,67,67,771,67,67,67,67,67,67,1461,67,67,67,1464,67,1466,67,67,67,67,67,67,1470,67,67,67,67,67,67,1587,67,67,67,67,67,67,67,67,1595,1489,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1129,97,1505,1506,97,97,97,97,1510,97,97,97,97,97,97,97,97,97,1163,1164,97,97,97,97,97,1516,97,97,97,1519,97,1521,97,97,97,97,97,97,1525,97,97,18,0,139621,0,0,0,0,0,0,364,0,0,367,41606,67,67,67,67,67,1586,67,67,67,67,67,67,67,67,67,67,67,1276,67,67,67,67,67,67,67,67,67,1600,67,67,67,67,67,67,67,67,67,67,67,1301,0,0,0,1307,97,97,1620,97,97,97,97,97,97,97,1627,97,97,97,97,97,97,913,97,97,97,97,919,97,97,97,0,97,97,97,1781,97,97,0,0,97,97,97,97,97,97,0,0,97,97,97,97,97,97,0,1792,1860,45,1862,1863,45,1865,45,67,67,67,67,67,67,67,67,1875,67,1877,1878,67,1880,67,97,97,97,97,97,1887,0,1889,97,97,18,0,139621,0,0,0,0,0,0,364,237568,0,367,0,97,1893,0,0,0,97,1898,1899,97,1901,97,45,45,45,45,45,2014,45,67,67,67,67,67,2020,67,97,1989,45,1990,45,45,45,67,67,67,67,67,67,1996,67,1997,67,67,67,67,67,273,67,0,37139,24853,0,0,0,0,41098,65820,67,67,97,97,97,97,0,0,97,97,2005,0,97,2007,97,97,18,0,139621,0,0,0,642,0,133,364,0,0,367,41606,0,97,97,2056,2057,0,2059,45,67,0,97,45,67,0,97,45,45,67,209,67,67,67,223,67,67,67,67,67,67,67,67,67,786,67,67,67,791,67,67,45,45,940,45,45,45,45,45,45,45,45,45,45,45,45,45,45,727,45,45,67,67,67,67,67,67,67,67,1016,67,67,67,67,67,67,67,67,37689,0,25403,0,66365,0,0,0,133,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,142,45,45,67,210,67,67,67,225,67,67,239,67,67,67,250,67,67,67,67,67,464,67,67,67,67,67,476,67,67,67,67,67,67,67,1709,67,67,67,97,97,97,97,97,97,0,0,97,97,97,97,97,1843,0,67,259,67,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,289,97,97,97,303,97,97,97,97,97,97,97,97,97,97,901,97,97,97,97,97,339,97,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,0,358,0,0,0,0,0,0,41098,0,140,45,45,45,45,45,1953,45,1955,45,45,45,67,67,67,67,67,67,67,1687,1688,67,67,67,67,45,45,405,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1203,45,458,67,67,67,67,67,67,67,67,67,470,477,67,67,67,67,67,67,67,1970,97,97,97,1974,0,0,0,97,1103,97,97,97,97,97,97,97,97,97,97,97,1372,97,97,97,97,67,522,67,67,67,67,67,67,67,67,67,67,67,536,67,67,67,67,67,67,1696,67,67,67,67,67,67,67,1701,67,555,97,97,97,97,97,97,97,97,97,567,574,97,97,97,97,97,301,97,309,97,97,97,97,97,97,97,97,97,900,97,97,97,905,97,97,97,619,97,97,97,97,97,97,97,97,97,97,97,633,97,97,18,0,139621,0,0,362,0,0,0,364,0,0,367,41606,369,649,45,45,45,45,45,45,45,45,45,45,45,45,663,664,67,67,67,67,750,751,67,67,67,67,758,67,67,67,67,67,67,67,1272,67,67,67,67,67,67,67,67,67,1057,1058,67,67,67,67,67,67,67,67,797,67,67,67,67,67,67,67,67,67,67,67,67,512,67,67,67,97,97,97,97,895,97,97,97,97,97,97,97,97,97,97,97,902,97,97,97,97,67,67,1051,67,67,67,67,67,67,67,67,67,67,67,1062,67,67,67,67,67,491,67,67,67,67,67,67,67,67,67,67,67,1302,0,0,0,1308,97,97,97,97,1145,97,97,97,97,97,97,97,97,97,97,97,1139,97,97,97,97,1156,97,97,97,97,97,97,1161,97,97,97,97,97,1166,97,97,18,640,139621,0,641,0,0,0,0,364,0,0,367,41606,67,67,67,67,1257,67,67,67,67,67,67,67,67,67,67,67,0,0,1305,0,0,97,97,1337,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1630,97,67,1474,67,67,0,0,0,0,0,0,0,0,0,0,0,0,0,2380062,2171166,2171166,97,1529,97,97,0,45,45,45,45,45,45,45,45,45,45,45,1228,45,45,45,45,67,67,67,67,1707,67,67,67,67,67,67,97,97,97,97,97,0,0,0,97,1891,1739,97,97,97,97,97,97,45,45,45,45,45,45,45,45,45,1198,45,1200,45,45,45,45,97,97,1894,0,0,97,97,97,97,97,97,45,45,45,45,45,672,45,45,45,45,45,45,45,45,45,45,45,1420,45,45,45,45,67,67,1965,67,1967,67,67,67,97,97,97,97,0,1976,0,97,97,45,67,0,97,45,67,0,97,45,67,0,97,45,97,97,1979,0,0,97,1982,97,97,97,1986,45,45,45,45,45,735,45,45,67,67,67,67,67,67,67,67,67,67,67,67,67,1770,67,67,2e3,97,97,97,2002,0,97,97,97,0,97,97,97,97,97,97,1798,97,97,97,45,45,45,2034,67,67,67,67,97,0,0,2040,97,97,97,97,45,45,45,45,1752,45,45,45,1753,1754,45,45,45,45,45,45,383,45,45,45,45,45,45,45,45,45,675,45,45,45,45,45,45,438,45,45,45,45,45,445,45,45,45,45,45,45,45,45,67,1430,67,67,67,67,67,67,67,67,67,524,67,67,67,67,67,531,67,67,67,67,67,67,67,67,37689,0,25403,0,66365,0,0,1096,97,97,97,621,97,97,97,97,97,628,97,97,97,97,97,97,0,53264,0,18,18,24,24,356,28,28,665,45,45,45,45,45,45,45,45,45,676,45,45,45,45,45,942,45,45,45,45,45,45,45,45,45,45,707,708,45,45,45,45,763,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,809,810,67,67,67,67,783,67,67,67,67,67,67,67,67,67,67,67,0,1303,0,0,0,97,861,97,97,97,97,97,97,97,97,97,97,97,97,97,97,613,97,45,45,956,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1215,45,67,67,67,67,1027,67,67,67,67,1032,67,67,67,67,67,67,67,67,37689,0,25403,0,66365,0,0,1097,1064,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1075,67,1098,0,0,97,97,97,97,97,97,97,97,97,97,97,97,97,331,97,97,97,97,1158,97,97,97,97,97,97,97,97,97,97,97,97,97,594,97,97,1309,0,0,0,1315,0,0,0,0,0,0,0,0,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1374,97,45,45,1543,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1240,67,67,1583,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1252,67,97,97,97,1635,97,97,97,0,97,97,97,97,97,97,97,97,1800,97,45,45,45,97,97,1793,97,97,97,97,97,97,97,97,97,97,45,45,45,1743,45,45,45,1746,45,0,97,97,97,97,97,1851,97,45,45,45,45,1856,45,45,45,45,1864,45,45,67,67,1869,67,67,67,67,1874,67,0,97,97,45,67,2058,97,45,67,0,97,45,67,0,97,45,45,67,211,67,67,67,67,67,67,240,67,67,67,67,67,67,67,1444,67,67,67,67,67,67,67,67,67,509,67,67,67,67,67,67,67,67,67,268,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,290,97,97,97,305,97,97,319,97,97,97,330,97,97,18,640,139621,0,641,0,0,0,0,364,0,643,367,41606,97,97,348,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,0,0,364,0,367,41098,369,140,45,45,45,45,380,45,45,45,45,45,45,395,45,45,45,400,369,0,45,45,45,45,45,45,45,45,658,45,45,45,45,45,972,45,45,45,45,45,45,45,45,45,45,427,45,45,45,45,45,745,67,67,67,67,67,67,67,67,756,67,67,67,67,67,67,67,67,37689,1086,25403,1090,66365,1094,0,0,97,843,97,97,97,97,97,97,97,97,854,97,97,97,97,97,97,1121,97,97,97,97,1126,97,97,97,97,45,980,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1400,45,67,67,67,1011,67,67,67,67,67,67,67,67,67,67,67,0,1304,0,0,0,1190,45,45,1193,1194,45,45,45,45,45,1199,45,1201,45,45,45,45,1911,45,45,45,45,45,67,67,67,67,67,67,67,1579,67,67,67,67,45,1205,45,45,45,45,45,45,45,45,1211,45,45,45,45,45,984,45,45,45,45,45,45,45,45,45,45,45,1550,45,45,45,45,45,1217,45,45,45,45,45,45,1225,45,45,45,45,1229,45,45,45,1388,45,45,45,45,45,45,1396,45,45,45,45,45,444,45,45,45,45,45,45,45,45,45,67,67,1574,67,67,67,67,67,67,67,67,67,67,1590,67,67,67,67,67,1254,67,67,67,67,67,1259,67,1261,67,67,67,67,1265,67,67,67,67,67,67,1708,67,67,67,67,97,97,97,97,97,97,0,0,97,97,97,97,97,0,0,67,67,67,67,1285,67,67,67,67,1289,67,67,67,67,67,67,67,67,37689,1087,25403,1091,66365,1095,0,0,97,97,97,97,1339,97,1341,97,97,97,97,1345,97,97,97,97,97,561,97,97,97,97,97,573,97,97,97,97,97,97,1717,97,0,97,97,97,97,97,97,97,591,97,97,97,97,97,97,97,97,97,1329,97,97,97,97,97,97,97,97,97,97,1351,97,97,97,97,97,97,1357,97,97,97,97,97,588,97,97,97,97,97,97,97,97,97,97,568,97,97,97,97,97,97,97,1365,97,97,97,97,1369,97,97,97,97,97,97,97,97,97,1356,97,97,97,97,97,97,45,45,1403,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1399,45,45,45,1413,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1669,45,1422,45,45,1425,45,45,1428,45,1429,67,67,67,67,67,67,67,67,1468,67,67,67,67,67,67,67,67,529,67,67,67,67,67,67,539,67,67,1475,67,0,0,0,0,0,0,0,0,0,0,0,0,140,2170880,2170880,2170880,2416640,97,97,1530,97,0,45,45,1534,45,45,45,45,45,45,45,45,1956,45,45,67,67,67,67,67,67,67,67,67,1599,67,67,1601,67,67,67,67,67,67,67,67,67,803,67,67,67,67,67,67,1632,97,1634,0,97,97,97,1640,97,97,97,1643,97,97,1645,97,97,97,97,97,912,97,97,97,97,97,97,97,97,97,0,0,0,45,45,45,45,45,45,1660,1661,45,45,45,45,1665,1666,45,45,45,45,45,1670,1692,1693,67,67,67,67,67,1697,67,67,67,67,67,67,67,1702,97,97,1714,1715,97,97,97,97,0,1721,1722,97,97,97,97,97,97,1353,97,97,97,97,97,97,97,97,1362,1726,97,0,0,97,97,97,0,97,97,97,1734,97,97,97,97,97,848,849,97,97,97,97,856,97,97,97,97,97,354,0,53264,0,18,18,24,24,0,28,28,45,45,1750,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1681,45,0,1846,97,97,97,97,97,97,45,45,1854,45,45,45,45,1859,67,67,67,1879,67,67,97,97,1884,97,97,0,0,0,97,97,97,1105,97,97,97,97,97,97,97,97,97,97,1344,97,97,97,1347,97,1892,97,0,0,0,97,97,97,1900,97,97,45,45,45,45,45,997,45,45,45,45,45,45,45,45,45,45,1002,45,45,1005,1006,45,67,67,67,67,67,1926,67,67,1928,97,97,97,97,97,0,0,97,97,97,0,97,97,97,97,97,97,1737,97,0,97,97,97,97,0,0,0,97,97,1944,97,97,1946,45,45,45,1544,45,45,45,45,45,45,45,45,45,45,45,45,190,45,45,45,152,155,45,163,45,45,177,179,182,45,45,45,193,197,45,45,45,1672,45,45,45,45,45,1677,45,1679,45,45,45,45,996,45,45,45,45,45,45,45,45,45,45,45,1212,45,45,45,45,67,260,264,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,97,295,299,302,97,310,97,97,324,326,329,97,97,97,0,97,97,1639,0,1641,97,97,97,97,97,97,97,97,1511,97,97,97,97,97,97,97,97,1523,97,97,97,97,97,97,97,97,1719,97,97,97,97,97,97,97,97,1720,97,97,97,97,97,97,97,312,97,97,97,97,97,97,97,97,1123,97,97,97,97,97,97,97,340,344,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,0,0,364,0,367,41098,369,140,45,45,373,375,419,45,45,45,45,45,45,45,45,45,428,45,45,435,45,45,45,1751,45,45,45,45,45,45,45,45,45,45,45,45,1410,45,45,45,67,67,67,505,67,67,67,67,67,67,67,67,67,514,67,67,67,67,67,67,1969,67,97,97,97,97,0,0,0,97,97,45,67,0,97,45,67,0,97,2064,2065,0,2066,45,521,67,67,67,67,67,67,67,67,67,67,534,67,67,67,67,67,67,465,67,67,67,474,67,67,67,67,67,67,67,1467,67,67,67,67,67,67,67,67,67,97,97,97,97,97,1933,0,97,97,97,602,97,97,97,97,97,97,97,97,97,611,97,97,18,640,139621,358,641,0,0,0,0,364,0,0,367,0,618,97,97,97,97,97,97,97,97,97,97,631,97,97,97,97,97,881,97,97,97,97,97,97,97,97,97,97,569,97,97,97,97,97,369,0,45,652,45,45,45,45,45,657,45,45,45,45,45,45,1235,45,45,45,45,45,45,45,45,67,67,67,1432,67,67,67,67,67,67,67,766,67,67,67,67,67,67,67,67,773,67,67,67,0,1305,0,1311,0,1317,97,97,97,97,97,97,97,1624,97,97,97,97,97,97,97,97,0,97,97,97,1724,97,97,97,777,67,67,782,67,67,67,67,67,67,67,67,67,67,67,67,535,67,67,67,67,67,67,67,814,67,67,67,67,67,67,67,67,67,37689,544,25403,546,70179,0,0,66365,66365,552,0,97,837,97,97,97,97,97,97,1496,97,97,97,97,97,97,97,97,97,97,918,97,97,97,97,0,842,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1168,97,97,97,97,864,97,97,97,97,97,97,97,97,871,97,97,97,0,1637,97,97,0,97,97,97,97,97,97,97,97,97,97,1801,45,45,97,875,97,97,880,97,97,97,97,97,97,97,97,97,97,97,1151,1152,97,97,97,67,67,67,1040,67,67,67,67,67,67,67,67,67,67,67,67,790,67,67,67,1180,0,649,45,45,45,45,45,45,45,45,45,45,45,45,45,200,45,45,67,67,67,1454,67,67,67,67,67,67,67,67,67,67,67,67,806,67,67,67,0,0,0,1481,0,1094,0,0,97,1483,97,97,97,97,97,97,304,97,97,318,97,97,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,97,97,97,1507,97,97,97,97,97,97,97,97,97,97,97,97,1332,97,97,97,1619,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1631,97,1633,97,0,97,97,97,0,97,97,97,97,97,97,97,97,97,1381,0,0,45,45,45,45,97,97,1727,0,97,97,97,0,97,97,97,97,97,97,97,97,626,97,97,97,97,97,97,636,45,45,1760,67,67,67,67,67,67,67,1765,67,67,67,67,67,67,67,1299,67,67,67,0,0,0,0,0,0,97,97,97,97,1616,97,97,1803,45,45,45,45,1807,45,45,45,45,45,1813,45,45,45,67,67,1684,67,67,67,67,67,67,67,67,67,67,67,822,67,67,37689,544,67,67,1818,67,67,67,67,1822,67,67,67,67,67,1828,67,67,67,67,67,97,0,0,97,97,97,97,97,45,45,45,2012,2013,45,45,67,67,67,2018,2019,67,67,97,67,97,97,97,1833,97,97,0,0,97,97,1840,97,97,0,0,97,97,97,0,97,97,1733,97,1735,97,97,97,0,97,97,97,1849,97,97,97,45,45,45,45,45,1857,45,45,45,1910,45,1912,45,45,1914,45,67,67,67,67,67,67,67,67,67,67,1017,67,67,1020,67,45,1861,45,45,45,45,45,67,67,67,67,67,1872,67,67,67,67,67,67,752,67,67,67,67,67,67,67,67,67,67,1446,67,67,67,67,67,1876,67,67,67,67,67,97,97,97,97,97,0,0,0,1890,97,97,97,97,97,1134,97,97,97,97,97,97,97,97,97,97,570,97,97,97,97,580,1935,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,45,1906,45,67,67,67,67,2048,0,97,97,97,97,45,45,67,67,0,0,0,0,925,41606,0,0,0,931,45,45,45,45,45,45,1674,45,1676,45,45,45,45,45,45,45,446,45,45,45,45,45,45,45,67,67,67,67,1871,67,67,67,67,0,97,97,45,67,0,97,2060,2061,0,2063,45,67,0,97,45,45,156,45,45,45,45,45,45,45,45,45,192,45,45,45,45,1673,45,45,45,45,45,45,45,45,45,45,45,429,45,45,45,45,67,67,67,269,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,349,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,0,0,364,0,367,41098,369,140,45,45,374,45,45,67,67,213,217,67,67,67,67,67,242,67,247,67,253,45,45,698,45,45,45,45,45,45,45,45,45,45,45,45,45,399,45,45,0,0,0,0,925,41606,0,929,0,0,45,45,45,45,45,45,1391,45,45,1395,45,45,45,45,45,45,423,45,45,45,45,45,45,45,436,45,67,67,67,67,1041,67,1043,67,67,67,67,67,67,67,67,67,67,1776,67,67,97,97,97,1099,0,0,97,97,97,97,97,97,97,97,97,97,97,97,97,888,97,97,97,1131,97,97,97,97,1135,97,1137,97,97,97,97,97,97,97,1497,97,97,97,97,97,97,97,97,97,883,97,97,97,97,97,97,1310,0,0,0,1316,0,0,0,0,1100,0,0,0,97,97,97,97,97,1107,97,97,97,97,97,97,97,97,1343,97,97,97,97,97,97,1348,0,0,1317,0,0,0,0,0,97,97,97,97,97,97,97,97,97,97,97,1112,97,45,1804,45,45,45,45,45,45,45,45,45,45,45,45,45,67,1868,67,1870,67,67,67,67,67,1817,67,67,1819,67,67,67,67,67,67,67,67,67,67,67,67,823,67,37689,544,67,97,1832,97,97,1834,97,0,0,97,97,97,97,97,0,0,97,97,97,0,1732,97,97,97,97,97,97,97,850,97,97,97,97,97,97,97,97,97,1177,0,0,925,0,0,0,0,97,97,97,97,0,0,1941,97,97,97,97,97,97,45,45,45,1991,1992,45,67,67,67,67,67,67,67,67,67,1998,134,0,0,0,37,110630,0,0,0,114730,106539,41098,45,45,45,45,941,45,45,944,45,45,45,45,45,45,952,45,45,207,67,67,67,67,67,226,67,67,67,67,67,67,67,67,67,820,67,67,67,67,37689,544,369,650,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1682,25403,546,70179,0,0,66365,66365,552,835,97,97,97,97,97,97,97,1522,97,97,97,97,97,97,97,97,0,97,97,97,97,97,97,1725,67,67,67,1695,67,67,67,67,67,67,67,67,67,67,67,67,1034,67,1036,67,67,67,265,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,97,296,97,97,97,97,314,97,97,97,97,332,334,97,97,97,97,97,1146,1147,97,97,97,97,97,97,97,97,97,97,1626,97,97,97,97,97,97,345,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,0,0,364,0,367,41098,369,140,45,372,45,45,45,1220,45,45,45,45,45,45,45,45,45,45,45,45,1213,45,45,45,45,404,406,45,45,45,45,45,45,45,45,45,45,45,45,45,434,45,45,45,440,45,45,45,45,45,45,45,45,451,452,45,45,45,67,1683,67,67,67,1686,67,67,67,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,67,67,67,67,490,492,67,67,67,67,67,67,67,67,67,67,67,1447,67,67,1450,67,67,67,67,67,526,67,67,67,67,67,67,67,67,537,538,67,67,67,67,67,506,67,67,508,67,67,511,67,67,67,67,0,1476,0,0,0,0,0,1478,0,0,0,0,0,0,0,0,97,97,1484,97,97,97,97,97,97,865,97,97,97,97,97,97,97,97,97,97,1499,97,97,97,97,97,97,97,97,97,587,589,97,97,97,97,97,97,97,97,97,97,629,97,97,97,97,97,97,97,97,97,623,97,97,97,97,97,97,97,97,634,635,97,97,97,97,97,1160,97,97,97,97,97,97,97,97,97,97,97,1628,97,97,97,97,369,0,45,45,45,45,45,655,45,45,45,45,45,45,45,45,999,45,1001,45,45,45,45,45,45,45,45,715,45,45,45,720,45,45,45,45,45,45,45,45,728,25403,546,70179,0,0,66365,66365,552,0,97,97,97,97,97,840,97,97,97,97,97,1174,97,97,97,97,0,0,925,0,0,0,0,0,0,0,1100,97,97,97,97,97,97,97,97,627,97,97,97,97,97,97,97,938,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,680,45,968,45,970,45,973,45,45,45,45,45,45,45,45,45,45,962,45,45,45,45,45,979,45,45,45,45,45,985,45,45,45,45,45,45,45,45,45,1224,45,45,45,45,45,45,45,45,688,45,45,45,45,45,45,45,1007,1008,67,67,67,67,67,1014,67,67,67,67,67,67,67,67,67,1045,67,67,67,67,67,67,67,1038,67,67,67,67,67,67,1044,67,1046,67,1049,67,67,67,67,67,67,800,67,67,67,67,67,67,808,67,67,0,0,0,1102,97,97,97,97,97,1108,97,97,97,97,97,97,306,97,97,97,97,97,97,97,97,97,97,1371,97,97,97,97,97,97,97,97,1132,97,97,97,97,97,97,1138,97,1140,97,1143,97,97,97,97,97,1352,97,97,97,97,97,97,97,97,97,97,869,97,97,97,97,97,45,1191,45,45,45,45,45,1196,45,45,45,45,45,45,45,45,1407,45,45,45,45,45,45,45,45,986,45,45,45,45,45,45,991,45,67,67,67,1256,67,67,67,67,67,67,67,67,67,67,67,67,1048,67,67,67,97,1336,97,97,97,97,97,97,97,97,97,97,97,97,97,97,615,97,1386,45,1387,45,45,45,45,45,45,45,45,45,45,45,45,45,455,45,457,45,45,1424,45,45,45,45,45,67,67,67,67,1433,67,1434,67,67,67,67,67,767,67,67,67,67,67,67,67,67,67,67,67,1591,67,1593,67,67,45,45,1805,45,45,45,45,45,45,45,45,45,1814,45,45,1816,67,67,67,67,1820,67,67,67,67,67,67,67,67,67,1829,67,67,67,67,67,815,67,67,67,67,821,67,67,67,37689,544,67,1831,97,97,97,97,1835,0,0,97,97,97,97,97,0,0,97,97,97,1731,97,97,97,97,97,97,97,97,97,853,97,97,97,97,97,97,0,97,97,97,97,1850,97,97,45,45,45,45,45,45,45,45,1547,45,45,45,45,45,45,45,45,1664,45,45,45,45,45,45,45,45,961,45,45,45,45,965,45,967,1907,45,45,45,45,45,45,45,45,45,67,67,67,67,67,1920,0,1936,97,97,97,0,0,0,97,97,97,97,97,97,45,45,67,67,67,67,67,67,1763,67,67,67,67,67,67,67,67,1056,67,67,67,67,67,67,67,67,1273,67,67,67,67,67,67,67,67,1457,67,67,67,67,67,67,67,67,97,97,97,97,0,0,28672,97,45,67,67,67,67,0,0,97,97,97,97,45,45,67,67,2054,97,97,291,97,97,97,97,97,97,320,97,97,97,97,97,97,307,97,97,97,97,97,97,97,97,97,97,12288,0,925,926,1179,0,45,377,45,45,45,381,45,45,392,45,45,396,45,45,45,45,971,45,45,45,45,45,45,45,45,45,45,45,45,1756,45,45,45,67,67,67,67,463,67,67,67,467,67,67,478,67,67,482,67,67,67,67,67,1028,67,67,67,67,67,67,67,67,67,67,67,67,1469,67,67,1472,67,502,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1460,67,97,97,97,97,560,97,97,97,564,97,97,575,97,97,579,97,97,97,97,97,1368,97,97,97,97,97,97,97,97,97,97,0,0,925,0,0,930,97,599,97,97,97,97,97,97,97,97,97,97,97,97,97,97,872,97,45,666,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1758,0,362,0,0,925,41606,0,0,0,0,45,45,934,45,45,45,164,168,174,178,45,45,45,45,45,194,45,45,45,165,45,45,45,45,45,45,45,45,45,199,45,45,45,67,67,1010,67,67,67,67,67,67,67,67,67,67,67,67,1060,67,67,67,67,67,67,1052,1053,67,67,67,67,67,67,67,67,67,67,1063,97,1157,97,97,97,97,97,97,97,97,97,97,97,97,1167,97,97,97,97,97,1379,97,97,97,0,0,0,45,1383,45,45,45,1806,45,45,45,45,45,45,1812,45,45,45,45,67,67,67,67,67,1577,67,67,67,67,67,67,67,753,67,67,67,67,67,67,67,67,67,1262,67,67,67,67,67,67,67,1282,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1471,67,45,1402,45,45,45,45,45,45,45,45,45,45,45,45,45,45,417,45,67,1462,67,67,67,67,67,67,67,67,67,67,67,67,67,67,37689,544,97,1517,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1128,97,97,97,97,1636,97,97,97,0,97,97,97,97,97,97,97,97,851,97,97,97,97,97,97,97,67,67,1705,67,67,67,67,67,67,67,67,97,97,97,97,97,97,0,0,97,97,97,97,1842,0,0,1779,97,97,97,1782,97,0,0,97,97,97,97,97,97,0,0,97,97,97,1789,97,97,0,0,0,97,1847,97,97,97,97,97,45,45,45,45,45,45,45,45,1675,45,45,45,45,45,45,45,45,737,738,67,740,67,741,67,743,67,67,67,67,67,67,1968,67,67,97,97,97,97,0,0,0,97,97,45,67,0,97,45,67,2062,97,45,67,0,97,45,67,67,97,97,2001,97,0,0,2004,97,97,0,97,97,97,97,1797,97,97,97,97,97,45,45,45,67,261,67,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,97,292,97,97,97,97,311,315,321,325,97,97,97,97,97,97,1623,97,97,97,97,97,97,97,97,97,97,1330,97,97,1333,1334,97,341,97,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,0,363,364,0,367,41098,369,140,45,45,45,45,1221,45,45,45,45,45,45,45,45,45,45,45,413,45,45,416,45,376,45,45,45,45,382,45,45,45,45,45,45,45,45,45,45,1408,45,45,45,45,45,403,45,45,45,45,45,45,45,45,45,45,414,45,45,45,418,67,67,67,462,67,67,67,67,468,67,67,67,67,67,67,67,67,1602,67,1604,67,67,67,67,67,67,67,67,489,67,67,67,67,67,67,67,67,67,67,500,67,67,67,67,67,1067,67,67,67,67,67,1072,67,67,67,67,67,67,274,0,37139,24853,0,0,0,0,41098,65820,67,67,504,67,67,67,67,67,67,67,510,67,67,67,517,519,541,67,37139,37139,24853,24853,0,70179,0,0,0,65820,65820,369,287,554,97,97,97,559,97,97,97,97,565,97,97,97,97,97,97,97,1718,0,97,97,97,97,97,97,97,898,97,97,97,97,97,97,906,97,97,97,97,586,97,97,97,97,97,97,97,97,97,97,597,97,97,97,97,97,1520,97,97,97,97,97,97,97,97,97,97,0,45,1656,45,45,45,97,97,601,97,97,97,97,97,97,97,607,97,97,97,614,616,638,97,18,0,139621,0,0,0,0,0,0,364,0,0,367,41606,369,0,45,45,45,45,45,45,45,45,45,45,661,45,45,45,407,45,45,45,45,45,45,45,45,45,45,45,45,45,1815,45,67,45,667,45,45,45,45,45,45,45,45,45,45,678,45,45,45,421,45,45,45,45,45,45,45,45,45,45,45,45,976,977,45,45,45,682,45,45,45,45,45,45,45,45,45,45,693,45,45,697,67,67,748,67,67,67,67,754,67,67,67,67,67,67,67,67,67,1274,67,67,67,67,67,67,67,67,765,67,67,67,67,769,67,67,67,67,67,67,67,67,67,1589,67,67,67,67,67,67,67,67,780,67,67,784,67,67,67,67,67,67,67,67,67,67,67,1777,67,97,97,97,97,97,97,846,97,97,97,97,852,97,97,97,97,97,97,97,1742,45,45,45,45,45,45,45,1747,97,97,97,863,97,97,97,97,867,97,97,97,97,97,97,97,308,97,97,97,97,97,97,97,97,97,97,12288,1178,925,0,1179,0,97,97,97,878,97,97,882,97,97,97,97,97,97,97,97,97,97,12288,0,925,0,1179,0,908,97,97,97,97,97,97,97,97,97,97,97,97,97,97,0,0,925,0,0,0,954,45,45,45,45,45,45,45,45,45,45,963,45,45,966,45,45,157,45,45,171,45,45,45,45,45,45,45,45,45,45,948,45,45,45,45,45,1022,67,67,1026,67,67,67,1030,67,67,67,67,67,67,67,67,67,1603,1605,67,67,67,1608,67,67,67,1039,67,67,1042,67,67,67,67,67,67,67,67,67,67,471,67,67,67,67,67,0,1100,0,97,97,97,97,97,97,97,97,97,97,97,97,97,904,97,97,97,97,1116,97,97,1120,97,97,97,1124,97,97,97,97,97,97,562,97,97,97,571,97,97,97,97,97,97,97,97,97,1133,97,97,1136,97,97,97,97,97,97,97,97,915,917,97,97,97,97,97,0,97,1170,97,97,97,97,97,97,97,97,0,0,925,0,0,0,0,0,41606,0,0,0,0,45,45,45,45,45,45,1993,67,67,67,67,67,67,67,67,67,67,1275,67,67,67,1278,67,0,0,0,45,45,1182,45,45,45,45,45,45,45,45,45,1189,1204,45,45,45,1207,45,45,1209,45,1210,45,45,45,45,45,45,1546,45,45,45,45,45,45,45,45,45,689,45,45,45,45,45,45,1231,45,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,236,67,67,67,67,67,67,67,801,67,67,67,805,67,67,67,67,67,1242,67,67,67,67,67,67,67,67,67,1249,67,67,67,67,67,67,507,67,67,67,67,67,67,67,67,67,67,1300,0,0,0,0,0,1267,67,67,1269,67,1270,67,67,67,67,67,67,67,67,67,1280,97,1349,97,1350,97,97,97,97,97,97,97,97,97,1360,97,97,97,0,1980,97,97,97,97,97,45,45,45,45,45,45,673,45,45,45,45,677,45,45,45,45,1401,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,953,67,1437,67,1440,67,67,67,67,1445,67,67,67,1448,67,67,67,67,67,67,1029,67,67,67,67,67,67,67,67,67,67,1825,67,67,67,67,67,1473,67,67,67,0,0,0,0,0,0,0,0,0,0,0,0,1320,0,834,97,97,97,97,1490,97,1493,97,97,97,97,1498,97,97,97,1501,97,97,97,0,97,1638,97,0,97,97,97,97,97,97,97,97,916,97,97,97,97,97,97,0,1528,97,97,97,0,45,45,45,1535,45,45,45,45,45,45,45,1867,67,67,67,67,67,67,67,67,67,97,97,97,97,1932,0,0,1555,45,45,45,45,45,45,45,45,45,45,45,45,45,1567,45,45,158,45,45,172,45,45,45,183,45,45,45,45,201,45,45,67,212,67,67,67,67,231,235,241,245,67,67,67,67,67,67,493,67,67,67,67,67,67,67,67,67,67,472,67,67,67,67,67,97,97,97,97,1651,97,97,97,97,97,0,45,45,45,45,45,45,45,1539,45,45,45,67,1704,67,1706,67,67,67,67,67,67,67,97,97,97,97,97,97,0,0,97,97,97,1841,97,0,1844,97,97,97,97,1716,97,97,97,0,97,97,97,97,97,97,97,590,97,97,97,97,97,97,97,97,97,0,0,0,45,45,45,1385,1748,45,45,45,45,45,45,45,45,45,45,45,45,45,1757,45,45,159,45,45,45,45,45,45,45,45,45,45,45,45,45,415,45,45,97,97,1780,97,97,97,0,0,1786,97,97,97,97,97,0,0,97,97,1730,0,97,97,97,97,97,1736,97,1738,67,97,97,97,97,97,97,0,1838,97,97,97,97,97,0,0,97,1729,97,0,97,97,97,97,97,97,97,97,1162,97,97,97,1165,97,97,97,45,1950,45,45,45,45,45,45,45,45,1958,67,67,67,1962,67,67,67,67,67,1246,67,67,67,67,67,67,67,67,67,67,67,97,1710,97,97,97,1999,67,97,97,97,97,0,2003,97,97,97,0,97,97,2008,2009,45,67,67,67,67,0,0,97,97,97,97,45,2052,67,2053,0,0,0,0,925,41606,0,0,930,0,45,45,45,45,45,45,1392,45,1394,45,45,45,45,45,45,45,1545,45,45,45,45,45,45,45,45,45,45,1563,1565,45,45,45,1568,0,97,2055,45,67,0,97,45,67,0,97,45,67,28672,97,45,45,160,45,45,45,45,45,45,45,45,45,45,45,45,45,679,45,45,67,67,266,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,346,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,0,362,0,364,0,367,41098,369,140,371,45,45,45,379,45,45,45,388,45,45,45,45,45,45,45,45,1663,45,45,45,45,45,45,45,45,45,449,45,45,45,45,45,67,67,542,37139,37139,24853,24853,0,70179,0,0,0,65820,65820,369,287,97,97,97,97,97,1622,97,97,97,97,97,97,97,1629,97,97,0,1794,1795,97,97,97,97,97,97,97,97,45,45,45,45,45,45,1745,45,45,97,639,18,0,139621,0,0,0,0,0,0,364,0,0,367,41606,45,731,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,67,67,251,67,67,67,67,67,798,67,67,67,67,67,67,67,67,67,67,67,67,1073,67,67,67,860,97,97,97,97,97,97,97,97,97,97,97,97,97,97,873,0,0,1101,97,97,97,97,97,97,97,97,97,97,97,97,97,921,97,0,67,67,67,67,1245,67,67,67,67,67,67,67,67,67,67,67,67,1250,67,67,1253,0,0,1312,0,0,0,1318,0,0,0,0,0,0,97,97,97,97,1106,97,97,97,97,97,97,97,97,97,1149,97,97,97,97,97,1155,97,97,1325,97,97,97,97,97,97,97,97,97,97,97,97,97,1141,97,97,67,67,1439,67,1441,67,67,67,67,67,67,67,67,67,67,67,67,1264,67,67,67,97,97,1492,97,1494,97,97,97,97,97,97,97,97,97,97,97,1331,97,97,97,97,67,67,67,2037,67,97,0,0,97,97,97,2043,97,45,45,45,442,45,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,67,232,67,67,67,67,67,67,67,67,1823,67,67,67,67,67,67,67,67,97,97,97,97,1975,0,0,97,874,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1142,97,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,65,86,117,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,63,84,115,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,61,82,113,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,59,80,111,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,57,78,109,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,55,76,107,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,53,74,105,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,51,72,103,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,49,70,101,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,47,68,99,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,45,67,97,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,213085,53264,18,49172,57366,24,8192,28,102432,0,0,0,44,0,0,32863,53264,18,49172,57366,24,8192,28,102432,0,41,41,41,0,0,1138688,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,0,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,89,53264,18,18,49172,0,57366,0,24,24,24,0,127,127,127,127,102432,67,262,67,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,342,97,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,360,0,0,364,0,367,41098,369,140,45,45,45,45,717,45,45,45,45,45,45,45,45,45,45,45,412,45,45,45,45,45,67,1009,67,67,67,67,67,67,67,67,67,67,67,67,67,1292,67,67,1294,67,67,67,67,67,67,67,67,67,67,0,0,0,0,0,0,97,97,97,1615,97,97,97,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,66,87,118,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,64,85,116,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,62,83,114,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,60,81,112,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,58,79,110,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,56,77,108,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,54,75,106,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,52,73,104,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,50,71,102,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,48,69,100,53264,18,49172,57366,24,8192,28,102432,37,110630,114730,106539,46,67,98,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,233472,53264,18,49172,57366,24,8192,28,102432,0,110630,114730,106539,0,0,69724,53264,18,18,49172,0,57366,262144,24,24,24,0,28,28,28,28,102432,45,45,161,45,45,45,45,45,45,45,45,45,45,45,45,45,710,45,45,28,139621,359,0,0,0,364,0,367,41098,369,140,45,45,45,45,1389,45,45,45,45,45,45,45,45,45,45,45,949,45,45,45,45,67,503,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1449,67,67,97,600,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1154,97,0,0,0,0,925,41606,927,0,0,0,45,45,45,45,45,45,1866,67,67,67,67,67,67,67,67,67,67,772,67,67,67,67,67,45,45,969,45,45,45,45,45,45,45,45,45,45,45,45,45,951,45,45,45,45,1192,45,45,45,45,45,45,45,45,45,45,45,45,45,1202,45,45,0,0,0,1314,0,0,0,0,0,0,0,0,0,97,97,97,97,97,97,97,1488,67,67,267,67,67,67,67,0,37139,24853,0,0,0,0,41098,65820,97,347,97,97,97,97,0,53264,0,18,18,24,24,0,28,28,139621,0,361,0,0,364,0,367,41098,369,140,45,45,45,45,734,45,45,45,67,67,67,67,67,742,67,67,45,45,668,45,45,45,45,45,45,45,45,45,45,45,45,45,1214,45,45,1130,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1361,97,45,45,1671,45,45,45,45,45,45,45,45,45,45,45,45,45,1552,45,45,0,0,0,0,2220032,0,0,1130496,0,0,0,0,2170880,2171020,2170880,2170880,18,0,0,131072,0,0,0,90112,0,2220032,0,0,0,0,0,0,0,0,97,97,97,1485,97,97,97,97,0,45,45,45,45,45,1537,45,45,45,45,45,1390,45,1393,45,45,45,45,1398,45,45,45,2170880,2171167,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2576384,2215936,3117056,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,0,0,0,0,0,2174976,0,0,0,0,0,0,2183168,0,0,0,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,2721252,2744320,2170880,2170880,2170880,2834432,2840040,2170880,2908160,2170880,2170880,2936832,2170880,2170880,2985984,2170880,2994176,2170880,2170880,3014656,2170880,3059712,3076096,3088384,2170880,2170880,2170880,2170880,0,0,0,0,2220032,0,0,0,1142784,0,0,0,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3215360,2215936,2215936,2215936,2215936,2215936,2437120,2215936,2215936,2215936,3117056,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,2215936,0,543,0,545,0,0,2183168,0,0,831,0,2170880,2170880,2170880,2400256,2170880,2170880,2170880,2170880,3031040,2170880,3055616,2170880,2170880,2170880,2170880,3092480,2170880,2170880,3125248,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,2170880,3198976,2170880,0,0,0,0,0,0,67,67,37139,37139,24853,24853,0,0,0,0,0,65820,65820,0,287,97,97,97,97,97,1783,0,0,97,97,97,97,97,97,0,0,97,97,97,97,97,97,1791,0,0,546,70179,0,0,0,0,552,0,97,97,97,97,97,97,97,604,97,97,97,97,97,97,97,97,97,97,1150,97,97,97,97,97,147456,147456,147456,147456,147456,147456,147456,147456,147456,147456,147456,147456,0,0,147456,0,0,0,0,925,41606,0,928,0,0,45,45,45,45,45,45,998,45,45,45,45,45,45,45,45,45,1562,45,1564,45,45,45,45,0,2158592,2158592,0,0,0,0,2232320,2232320,2232320,0,2240512,2240512,2240512,2240512,0,0,0,0,0,0,0,0,0,0,0,2170880,2170880,2170880,2416640],r.EXPECTED=[291,300,304,341,315,309,305,295,319,323,327,329,296,333,337,339,342,346,350,294,356,360,312,367,352,371,363,375,379,383,387,391,395,726,399,405,518,684,405,405,405,405,808,405,405,405,512,405,405,405,431,405,405,406,405,405,404,405,405,405,405,405,405,405,908,631,410,415,405,414,419,608,405,429,602,405,435,443,405,441,641,478,405,447,451,450,456,643,461,460,762,679,465,469,741,473,477,482,486,492,932,931,523,498,504,720,405,510,596,405,516,941,580,522,929,527,590,589,897,939,534,538,547,551,555,559,563,567,571,969,575,708,690,689,579,584,634,405,594,731,405,600,882,405,606,895,786,452,612,405,615,620,876,624,628,638,647,651,655,659,663,667,676,683,688,695,694,791,405,699,437,405,706,714,405,712,825,870,405,718,724,769,768,823,730,735,745,751,422,755,759,425,766,902,810,587,775,888,887,405,773,992,405,779,962,405,785,781,986,790,795,797,506,500,499,801,805,814,820,829,833,837,841,845,849,853,857,861,616,865,869,868,488,405,874,816,405,880,738,405,886,892,543,405,901,906,913,912,918,494,541,922,926,936,945,949,953,957,530,966,973,960,702,701,405,979,981,405,985,747,405,990,998,914,405,996,1004,672,975,974,1014,1002,1008,670,1012,405,405,405,405,405,401,1018,1022,1026,1106,1071,1111,1111,1111,1082,1145,1030,1101,1034,1038,1106,1106,1106,1106,1046,1206,1052,1106,1072,1111,1111,1042,1134,1065,1111,1112,1056,1160,1207,1062,1204,1208,1069,1106,1106,1106,1076,1111,1207,1161,1122,1205,1064,1094,1106,1106,1107,1111,1111,1111,1078,1086,1207,1092,1098,1046,1058,1106,1106,1110,1111,1111,1116,1120,1161,1126,1202,1104,1106,1145,1146,1129,1138,1088,1151,1048,1157,1153,1132,1141,1165,1107,1111,1172,1179,1109,1183,1175,1143,1147,1187,1108,1191,1195,1144,1199,1168,1212,1216,1220,1224,1228,1232,1236,1557,1247,1241,1241,1038,1434,1241,1241,1241,1241,1254,1275,1617,1241,1280,1287,1241,1241,1241,1287,1241,2114,1291,1241,1243,1241,2049,1824,2094,2095,1520,1309,1241,1241,1302,1241,1321,1311,1241,1241,1313,1778,1325,1336,1241,1241,1325,1330,1353,1241,1241,1695,1354,1241,1241,1241,1294,1686,1331,1241,1696,1368,1241,1338,1370,1241,1392,1399,1364,2017,1406,2016,1405,1716,1406,1407,1422,1417,1421,1241,1241,1241,1349,1426,1241,1774,1756,1241,1773,1241,1241,1345,1964,1812,1432,1241,1241,1345,1993,1459,1241,1241,1241,1395,1848,1767,1465,1241,1241,1394,1847,1242,1477,1241,1241,1428,1241,1445,1492,1241,1241,1438,1241,1499,1241,1241,1241,1455,1241,1818,1448,1241,1250,1241,2026,1623,1449,1241,1612,1616,1241,1614,1241,1257,1241,1241,1985,1292,1586,1512,1241,1517,2050,1526,1674,1519,1524,1647,2051,1532,1537,1551,1544,1550,1555,1561,1571,1578,1584,1590,1591,1653,1595,1602,1606,1610,1634,1628,1640,1633,1645,1241,1241,1241,1469,1241,1970,1651,1241,1270,1241,1241,1819,1449,1241,1293,1664,1241,1241,1481,1485,1574,1672,1241,1241,1513,1317,1487,1684,1241,1241,1533,1299,1694,1241,1241,1295,1241,1241,1241,1546,1700,1241,1241,1707,1241,1713,1241,1849,1715,1241,1720,1241,1276,1267,1241,1241,2107,1657,1864,1241,1881,1241,1326,1292,1241,1685,1358,1724,1338,1241,1363,1362,1342,1340,1361,1339,1833,1372,1360,1833,1833,1342,1343,1835,1341,1731,1738,1344,1241,1745,1241,1379,1241,1241,2092,1241,1388,1761,1754,1241,1386,1241,1400,1760,1241,1241,1241,1598,1734,1241,1241,1241,1635,1645,1241,1780,1766,1241,1241,1332,1771,1241,1241,1629,2079,1241,1242,1784,1241,1241,1680,1639,2063,1790,1241,1241,1741,1241,1241,1800,1241,1241,1762,1473,1241,1806,1241,1241,1786,1240,1709,1241,1241,1241,1668,1811,1241,1940,1241,1401,1974,1241,1408,1413,1382,1241,1816,1241,1241,1802,2086,1811,1241,1817,1945,1823,2095,2095,2047,2094,2046,2080,1241,1409,1312,1376,2096,2048,1241,1241,1807,1241,1241,1241,2035,1241,1241,1828,1241,2057,2061,1241,1241,1843,1241,2059,1241,1241,1241,1690,1847,1241,1241,1241,1703,2102,1848,1241,1241,1853,1292,1848,1241,2016,1857,1241,2002,1868,1241,1436,1241,1241,1271,1305,1241,1874,1241,1241,1884,2037,1892,1241,1890,1241,1461,1241,1241,1795,1241,1241,1891,1241,1878,1241,1888,1241,1888,1905,1896,2087,1912,1903,1241,1911,1906,1916,1905,2027,1863,1925,2088,1859,1861,1922,1927,1931,1935,1494,1241,1241,1918,1907,1939,1917,1944,1949,1241,1241,1451,1955,1241,1241,1241,1796,1727,2061,1241,1241,1899,1241,1660,1968,1241,1241,1951,1678,1978,1241,1241,1241,1839,1241,1241,1984,1982,1241,1488,1241,1241,1624,1450,1989,1241,1241,1241,1870,1995,1292,1241,1241,1958,1261,1241,1996,1241,1241,1241,2039,2008,1241,1241,1750,2e3,1241,1256,2001,1960,1241,1564,1241,1504,1241,1241,1442,1241,1241,1564,1528,1263,1241,1508,1241,1241,1468,1498,2006,1540,2015,1539,2014,1748,2013,1539,1831,2014,2012,1500,1567,2022,2021,1241,1580,1241,1241,2033,2037,1791,2045,2031,1241,1621,1241,1641,2044,1241,1241,1241,2093,1241,1241,2055,1241,1241,2067,1241,1283,1241,1241,1241,2101,2071,1241,1241,1241,2073,1848,2040,1241,1241,1241,2077,1241,1241,2106,1241,1241,2084,1241,2111,1241,1241,1381,1380,1241,1241,1241,2100,1241,2129,2118,2122,2126,2197,2133,3010,2825,2145,2698,2156,2226,2160,2161,2165,2174,2293,2194,2630,2201,2203,2152,3019,2226,2263,2209,2213,2218,2269,2292,2269,2269,2184,2226,2238,2148,2151,3017,2245,2214,2269,2269,2185,2226,2292,2269,2291,2269,2269,2269,2292,2205,3019,2226,2226,2160,2160,2160,2261,2160,2160,2160,2262,2276,2160,2160,2277,2216,2283,2216,2269,2269,2268,2269,2267,2269,2269,2269,2271,2568,2292,2269,2293,2269,2182,2190,2269,2186,2226,2226,2226,2226,2227,2160,2160,2160,2160,2263,2160,2275,2277,2282,2215,2217,2269,2269,2291,2269,2269,2293,2291,2269,2220,2269,2295,2294,2269,2269,2305,2233,2262,2278,2218,2269,2234,2226,2226,2228,2160,2160,2160,2289,2220,2294,2294,2269,2269,2304,2269,2160,2160,2287,2269,2269,2305,2269,2269,2312,2269,2269,2225,2226,2160,2287,2289,2219,2304,2295,2314,2234,2226,2314,2269,2226,2226,2160,2288,2219,2222,2304,2296,2269,2224,2160,2160,2269,2302,2294,2314,2224,2226,2288,2220,2294,2269,2290,2269,2269,2293,2269,2269,2269,2269,2270,2221,2313,2225,2227,2160,2300,2269,2225,2261,2309,2234,2229,2223,2318,2318,2318,2328,2336,2340,2344,2350,2637,2712,2358,2362,2372,2135,2378,2398,2135,2135,2135,2135,2136,2417,2241,2135,2378,2135,2135,2980,2984,2135,3006,2135,2135,2135,2945,2931,2425,2400,2135,2135,2135,2954,2135,2481,2433,2135,2135,2988,2824,2135,2135,2482,2434,2135,2135,2440,2445,2452,2135,2135,2998,3002,2961,2441,2446,2453,2463,2974,2135,2135,2135,2140,2642,2709,2459,2470,2465,2135,2135,3005,2135,2135,2987,2823,2458,2469,2464,2975,2135,2135,2135,2353,2488,2447,2324,2974,2135,2409,2459,2448,2135,2961,2487,2446,2476,2323,2973,2135,2135,2135,2354,2476,2974,2135,2135,2135,2957,2135,2135,2960,2135,2135,2135,2363,2409,2459,2474,2465,2487,2571,2973,2135,2135,2168,2973,2135,2135,2135,2959,2135,2135,2135,2506,2135,2957,2488,2170,2135,2135,2135,2960,2135,2818,2493,2135,2135,3033,2135,2135,2135,2934,2819,2494,2135,2135,2135,2976,2780,2499,2135,2135,2135,3e3,2968,2135,2935,2135,2135,2135,2364,2507,2135,2135,2934,2135,2135,2780,2492,2507,2135,2135,2506,2780,2135,2135,2782,2780,2135,2782,2135,2783,2374,2514,2135,2135,2135,3007,2530,2974,2135,2135,2135,3008,2135,2135,2134,2135,2526,2531,2975,2135,2135,3042,2581,2575,2956,2135,2135,2135,2394,2135,2508,2535,2840,2844,2495,2135,2135,2136,2684,2537,2842,2846,2135,2136,2561,2581,2551,2536,2841,2845,2975,3043,2582,2843,2555,2135,3040,3044,2538,2844,2975,2135,2135,2253,2644,2672,2542,2554,2135,2135,2346,2873,2551,2555,2135,2135,2135,2381,2559,2565,2538,2553,2135,2560,2914,2576,2590,2135,2135,2135,2408,2136,2596,2624,2135,2135,2135,2409,2135,2618,2597,3008,2135,2135,2380,2956,2601,2135,2135,2135,2410,2620,2624,2135,2136,2383,2135,2135,2783,2623,2135,2135,2393,2888,2136,2621,3008,2135,2618,2618,2622,2135,2135,2405,2414,2619,2384,2624,2135,2136,2950,2135,2138,2135,2139,2135,2604,2623,2135,2140,2878,2665,2957,2622,2135,2135,2428,2762,2606,2612,2135,2135,2501,2586,2604,3038,2135,2604,3036,2387,2958,2386,2135,2141,2135,2421,2387,2385,2135,2385,2384,2384,2135,2386,2628,2384,2135,2135,2501,2596,2591,2135,2135,2135,2400,2135,2634,2135,2135,2559,2580,2575,2648,2135,2135,2135,2429,2649,2135,2135,2135,2435,2654,2658,2135,2135,2135,2436,2649,2178,2659,2135,2135,2595,2601,2669,2677,2135,2135,2616,2957,2879,2665,2691,2135,2363,2367,2900,2878,2664,2690,2975,2877,2643,2670,2974,2671,2975,2135,2135,2619,2608,2669,2673,2135,2135,2653,2177,2672,2135,2135,2135,2486,2168,2251,2255,2695,2974,2709,2135,2135,2135,2487,2169,2399,2716,2975,2135,2363,2770,2776,2640,2717,2135,2135,2729,2135,2135,2641,2718,2135,2135,2135,2505,2135,2640,2257,2974,2135,2727,2975,2135,2365,2332,2895,2957,2135,2959,2135,2365,2749,2754,2959,2958,2958,2135,2380,2793,2799,2135,2735,2738,2135,2381,2135,2135,2940,2974,2135,2744,2135,2135,2739,2519,2976,2745,2135,2135,2135,2509,2755,2135,2135,2135,2510,2772,2778,2135,2135,2740,2520,2135,2771,2777,2135,2135,2759,2750,2792,2798,2135,2135,2781,2392,2779,2135,2135,2135,2521,2135,2679,2248,2135,2135,2681,2480,2135,2135,2786,3e3,2135,2679,2683,2135,2135,2416,2135,2135,2135,2525,2135,2730,2135,2135,2135,2560,2581,2135,2805,2135,2135,2804,2962,2832,2974,2135,2382,2135,2135,2958,2135,2135,2960,2135,2829,2833,2975,2961,2965,2969,2973,2968,2972,2135,2135,2135,2641,2135,2515,2966,2970,2851,2478,2135,2135,2808,2135,2809,2135,2135,2135,2722,2852,2479,2135,2135,2815,2135,2135,2766,2853,2480,2135,2857,2479,2135,2388,2723,2135,2364,2331,2894,2858,2480,2135,2135,2850,2478,2135,2135,2135,2806,2864,2135,2399,2256,2974,2865,2135,2135,2862,2135,2135,2135,2685,2807,2865,2135,2135,2807,2863,2135,2135,2135,2686,2884,2807,2135,2809,2807,2135,2135,2807,2806,2705,2810,2808,2700,2869,2702,2702,2702,2704,2883,2135,2135,2135,2730,2884,2135,2135,2135,2731,2321,2546,2135,2135,2876,2255,2889,2322,2547,2135,2401,2135,2135,2135,2949,2367,2893,2544,2973,2906,2973,2135,2135,2877,2663,2368,2901,2907,2974,2366,2899,2905,2972,2920,2974,2135,2135,2911,2900,2920,2363,2913,2918,2465,2941,2975,2135,2135,2924,2928,2974,2945,2931,2135,2135,2135,2765,2136,2955,2135,2135,2939,2931,2380,2135,2135,2380,2135,2135,2135,2780,2507,2137,2135,2137,2135,2139,2135,2806,2810,2135,2135,2135,2992,2135,2135,2962,2966,2970,2974,2135,2135,2787,3014,2135,2521,2993,2135,2135,2135,2803,2135,2135,2135,2618,2607,2997,3001,2135,2135,2963,2967,2971,2975,2135,2135,2791,2797,2135,3009,2999,3003,2787,3001,2135,2135,2964,2968,2785,2999,3003,2135,2135,2135,2804,2785,2999,3004,2135,2135,2135,2807,2135,2135,3023,2135,2135,2135,2811,2135,2135,3027,2135,2135,2135,2837,2968,3028,2135,2135,2135,2875,2135,2784,3029,2135,2408,2457,2446,0,14,0,-2120220672,1610612736,-2074083328,-2002780160,-2111830528,1073872896,1342177280,1075807216,4096,16384,2048,8192,0,8192,0,0,0,0,1,0,0,0,2,0,-2145386496,8388608,1073741824,0,2147483648,2147483648,2097152,2097152,2097152,536870912,0,0,134217728,33554432,1536,268435456,268435456,268435456,268435456,128,256,32,0,65536,131072,524288,16777216,268435456,2147483648,1572864,1835008,640,32768,65536,262144,1048576,2097152,196608,196800,196608,196608,0,131072,131072,131072,196608,196624,196608,196624,196608,196608,128,4096,16384,16384,2048,0,4,0,0,2147483648,2097152,0,1024,32,32,0,65536,1572864,1048576,32768,32768,32768,32768,196608,196608,196608,64,64,196608,196608,131072,131072,131072,131072,268435456,268435456,64,196736,196608,196608,196608,131072,196608,196608,16384,4,4,4,2,32,32,65536,1048576,12582912,1073741824,0,0,2,8,16,96,2048,32768,0,0,131072,268435456,268435456,268435456,256,256,196608,196672,196608,196608,196608,196608,4,0,256,256,256,256,32,32,32768,32,32,32,32,32768,268435456,268435456,268435456,196608,196608,196608,196624,196608,196608,196608,16,16,16,268435456,196608,64,64,64,196608,196608,196608,196672,268435456,64,64,196608,196608,16,196608,196608,196608,268435456,64,196608,131072,262144,4194304,25165824,33554432,134217728,268435456,268435456,196608,262152,8,256,512,3072,16384,200,-1073741816,8392713,40,8392718,520,807404072,40,520,100663304,0,0,-540651761,-540651761,257589048,0,262144,0,0,3,8,256,0,4,6,4100,8388612,0,0,0,3,4,8,256,512,1024,0,2097152,0,0,-537854471,-537854471,0,100663296,0,0,1,2,0,0,0,16384,0,0,0,96,14336,0,0,0,7,8,234881024,0,0,0,8,0,0,0,0,262144,0,0,16,64,384,512,0,1,1,0,12582912,0,0,0,0,33554432,67108864,-606084144,-606084144,-606084138,0,0,28,32,768,1966080,-608174080,0,0,0,14,35056,16,64,896,24576,98304,98304,131072,262144,524288,1048576,4194304,25165824,1048576,62914560,134217728,-805306368,0,384,512,16384,65536,131072,262144,29360128,33554432,134217728,268435456,1073741824,2147483648,262144,524288,1048576,29360128,33554432,524288,1048576,16777216,33554432,134217728,268435456,1073741824,0,0,0,123856,1966080,0,64,384,16384,65536,131072,16384,65536,524288,268435456,2147483648,0,0,524288,2147483648,0,0,1,16,0,256,524288,0,0,0,25,96,128,-537854471,0,0,0,32,7404800,-545259520,0,0,0,60,0,249,64768,1048576,6291456,6291456,25165824,100663296,402653184,1073741824,96,128,1280,2048,4096,57344,6291456,57344,6291456,8388608,16777216,33554432,201326592,1342177280,2147483648,0,57344,6291456,8388608,100663296,134217728,2147483648,0,0,0,1,8,16,64,128,64,128,256,1024,131072,131072,131072,262144,524288,16777216,57344,6291456,8388608,67108864,134217728,64,256,1024,2048,4096,57344,64,256,0,24576,32768,6291456,67108864,134217728,0,1,64,256,24576,32768,4194304,32768,4194304,67108864,0,0,64,256,0,0,24576,32768,0,16384,4194304,67108864,64,16384,0,0,1,64,256,16384,4194304,67108864,0,0,0,16384,0,16384,16384,0,-470447874,-470447874,-470447874,0,0,128,0,0,8,96,2048,32768,262144,8388608,35056,1376256,-471859200,0,0,14,16,224,2048,32768,2097152,4194304,8388608,-486539264,0,96,128,2048,32768,262144,2097152,262144,2097152,8388608,33554432,536870912,1073741824,2147483648,0,1610612736,2147483648,0,0,1,524288,1048576,12582912,0,0,0,151311,264503296,2097152,8388608,33554432,1610612736,2147483648,262144,8388608,33554432,536870912,67108864,4194304,0,4194304,0,4194304,4194304,0,0,524288,8388608,536870912,1073741824,2147483648,1,4097,8388609,96,2048,32768,1073741824,2147483648,0,96,2048,2147483648,0,0,96,2048,0,0,1,12582912,0,0,0,0,1641895695,1641895695,0,0,0,249,7404800,15,87808,1835008,1639972864,0,768,5120,16384,65536,1835008,1835008,12582912,16777216,1610612736,0,3,4,8,768,4096,65536,0,0,256,512,786432,8,256,512,4096,16384,1835008,16384,1835008,12582912,1610612736,0,0,0,256,0,0,0,4,8,16,32,1,2,8,256,16384,524288,16384,524288,1048576,12582912,1610612736,0,0,0,8388608,0,0,0,524288,4194304,0,0,0,8388608,-548662288,-548662288,-548662288,0,0,256,16384,65536,520093696,-1073741824,0,0,0,16777216,0,16,32,960,4096,4980736,520093696,1073741824,0,32,896,4096,57344,1048576,6291456,8388608,16777216,100663296,134217728,268435456,2147483648,0,512,786432,4194304,33554432,134217728,268435456,0,786432,4194304,134217728,268435456,0,524288,4194304,268435456,0,0,0,0,0,4194304,4194304,-540651761,0,0,0,2,4,8,16,96,128,264503296,-805306368,0,0,0,8,256,512,19456,131072,3072,16384,131072,262144,8388608,16777216,512,1024,2048,16384,131072,262144,131072,262144,8388608,33554432,201326592,268435456,0,3,4,256,1024,2048,57344,16384,131072,8388608,33554432,134217728,268435456,0,3,256,1024,16384,131072,33554432,134217728,1073741824,2147483648,0,0,256,524288,2147483648,0,3,256,33554432,134217728,1073741824,0,1,2,33554432,1,2,134217728,1073741824,0,1,2,134217728,0,0,0,64,0,0,0,16,32,896,4096,786432,4194304,16777216,33554432,201326592,268435456,1073741824,2147483648,0,0,0,15,0,4980736,4980736,4980736,70460,70460,3478332,0,0,1008,4984832,520093696,60,4864,65536,0,0,0,12,16,32,256,512,4096,65536,0,0,0,67108864,0,0,0,12,0,256,512,65536,0,0,1024,512,131072,131072,4,16,32,65536,0,4,16,32,0,0,0,4,16,0,0,16384,67108864,0,0,1,24,96,128,256,1024],r.TOKEN=[\"(0)\",\"JSONChar\",\"JSONCharRef\",\"JSONPredefinedCharRef\",\"ModuleDecl\",\"Annotation\",\"OptionDecl\",\"Operator\",\"Variable\",\"Tag\",\"EndTag\",\"PragmaContents\",\"DirCommentContents\",\"DirPIContents\",\"CDataSectionContents\",\"AttrTest\",\"Wildcard\",\"EQName\",\"IntegerLiteral\",\"DecimalLiteral\",\"DoubleLiteral\",\"PredefinedEntityRef\",\"'\\\"\\\"'\",\"EscapeApos\",\"AposChar\",\"ElementContentChar\",\"QuotAttrContentChar\",\"AposAttrContentChar\",\"NCName\",\"QName\",\"S\",\"CharRef\",\"CommentContents\",\"DocTag\",\"DocCommentContents\",\"EOF\",\"'!'\",\"'\\\"'\",\"'#'\",\"'#)'\",\"'$$'\",\"''''\",\"'('\",\"'(#'\",\"'(:'\",\"'(:~'\",\"')'\",\"'*'\",\"'*'\",\"','\",\"'-->'\",\"'.'\",\"'/'\",\"'/>'\",\"':'\",\"':)'\",\"';'\",\"'<!--'\",\"'<![CDATA['\",\"'<?'\",\"'='\",\"'>'\",\"'?'\",\"'?>'\",\"'NaN'\",\"'['\",\"']'\",\"']]>'\",\"'after'\",\"'all'\",\"'allowing'\",\"'ancestor'\",\"'ancestor-or-self'\",\"'and'\",\"'any'\",\"'append'\",\"'array'\",\"'as'\",\"'ascending'\",\"'at'\",\"'attribute'\",\"'base-uri'\",\"'before'\",\"'boundary-space'\",\"'break'\",\"'by'\",\"'case'\",\"'cast'\",\"'castable'\",\"'catch'\",\"'check'\",\"'child'\",\"'collation'\",\"'collection'\",\"'comment'\",\"'constraint'\",\"'construction'\",\"'contains'\",\"'content'\",\"'context'\",\"'continue'\",\"'copy'\",\"'copy-namespaces'\",\"'count'\",\"'decimal-format'\",\"'decimal-separator'\",\"'declare'\",\"'default'\",\"'delete'\",\"'descendant'\",\"'descendant-or-self'\",\"'descending'\",\"'diacritics'\",\"'different'\",\"'digit'\",\"'distance'\",\"'div'\",\"'document'\",\"'document-node'\",\"'element'\",\"'else'\",\"'empty'\",\"'empty-sequence'\",\"'encoding'\",\"'end'\",\"'entire'\",\"'eq'\",\"'every'\",\"'exactly'\",\"'except'\",\"'exit'\",\"'external'\",\"'first'\",\"'following'\",\"'following-sibling'\",\"'for'\",\"'foreach'\",\"'foreign'\",\"'from'\",\"'ft-option'\",\"'ftand'\",\"'ftnot'\",\"'ftor'\",\"'function'\",\"'ge'\",\"'greatest'\",\"'group'\",\"'grouping-separator'\",\"'gt'\",\"'idiv'\",\"'if'\",\"'import'\",\"'in'\",\"'index'\",\"'infinity'\",\"'inherit'\",\"'insensitive'\",\"'insert'\",\"'instance'\",\"'integrity'\",\"'intersect'\",\"'into'\",\"'is'\",\"'item'\",\"'json'\",\"'json-item'\",\"'key'\",\"'language'\",\"'last'\",\"'lax'\",\"'le'\",\"'least'\",\"'let'\",\"'levels'\",\"'loop'\",\"'lowercase'\",\"'lt'\",\"'minus-sign'\",\"'mod'\",\"'modify'\",\"'module'\",\"'most'\",\"'namespace'\",\"'namespace-node'\",\"'ne'\",\"'next'\",\"'no'\",\"'no-inherit'\",\"'no-preserve'\",\"'node'\",\"'nodes'\",\"'not'\",\"'object'\",\"'occurs'\",\"'of'\",\"'on'\",\"'only'\",\"'option'\",\"'or'\",\"'order'\",\"'ordered'\",\"'ordering'\",\"'paragraph'\",\"'paragraphs'\",\"'parent'\",\"'pattern-separator'\",\"'per-mille'\",\"'percent'\",\"'phrase'\",\"'position'\",\"'preceding'\",\"'preceding-sibling'\",\"'preserve'\",\"'previous'\",\"'processing-instruction'\",\"'relationship'\",\"'rename'\",\"'replace'\",\"'return'\",\"'returning'\",\"'revalidation'\",\"'same'\",\"'satisfies'\",\"'schema'\",\"'schema-attribute'\",\"'schema-element'\",\"'score'\",\"'self'\",\"'sensitive'\",\"'sentence'\",\"'sentences'\",\"'skip'\",\"'sliding'\",\"'some'\",\"'stable'\",\"'start'\",\"'stemming'\",\"'stop'\",\"'strict'\",\"'strip'\",\"'structured-item'\",\"'switch'\",\"'text'\",\"'then'\",\"'thesaurus'\",\"'times'\",\"'to'\",\"'treat'\",\"'try'\",\"'tumbling'\",\"'type'\",\"'typeswitch'\",\"'union'\",\"'unique'\",\"'unordered'\",\"'updating'\",\"'uppercase'\",\"'using'\",\"'validate'\",\"'value'\",\"'variable'\",\"'version'\",\"'weight'\",\"'when'\",\"'where'\",\"'while'\",\"'wildcards'\",\"'window'\",\"'with'\",\"'without'\",\"'word'\",\"'words'\",\"'xquery'\",\"'zero-digit'\",\"'{'\",\"'{{'\",\"'|'\",\"'}'\",\"'}}'\"]},{}],2:[function(e,t,n){var r=e(\"./JSONiqTokenizer\").JSONiqTokenizer,i=function(e){var t=e;this.tokens=[],this.reset=function(){t=t,this.tokens=[]},this.startNonterminal=function(){},this.endNonterminal=function(){},this.terminal=function(e,n,r){this.tokens.push({name:e,value:t.substring(n,r)})},this.whitespace=function(e,n){this.tokens.push({name:\"WS\",value:t.substring(e,n)})}},s=\"NaN|after|allowing|ancestor|ancestor-or-self|and|append|array|as|ascending|at|attribute|base-uri|before|boundary-space|break|by|case|cast|castable|catch|child|collation|comment|constraint|construction|contains|context|continue|copy|copy-namespaces|count|decimal-format|decimal-separator|declare|default|delete|descendant|descendant-or-self|descending|digit|div|document|document-node|element|else|empty|empty-sequence|encoding|end|eq|every|except|exit|external|false|first|following|following-sibling|for|from|ft-option|function|ge|greatest|group|grouping-separator|gt|idiv|if|import|in|index|infinity|insert|instance|integrity|intersect|into|is|item|json|json-item|jsoniq|last|lax|le|least|let|loop|lt|minus-sign|mod|modify|module|namespace|namespace-node|ne|next|node|nodes|not|null|object|of|only|option|or|order|ordered|ordering|paragraphs|parent|pattern-separator|per-mille|percent|preceding|preceding-sibling|previous|processing-instruction|rename|replace|return|returning|revalidation|satisfies|schema|schema-attribute|schema-element|score|select|self|sentences|sliding|some|stable|start|strict|switch|text|then|times|to|treat|true|try|tumbling|type|typeswitch|union|unordered|updating|validate|value|variable|version|when|where|while|window|with|words|xquery|zero-digit\".split(\"|\"),o=s.map(function(e){return{name:\"'\"+e+\"'\",token:\"keyword\"}}),u=s.map(function(e){return{name:\"'\"+e+\"'\",token:\"text\",next:function(e){e.pop()}}}),a=\"constant.language\",f=\"constant\",l=\"comment\",c=\"xml-pe\",h=\"constant.buildin\",p=function(e){return\"'\"+e+\"'\"},d={start:[{name:p(\"(#\"),token:h,next:function(e){e.push(\"Pragma\")}},{name:p(\"(:\"),token:\"comment\",next:function(e){e.push(\"Comment\")}},{name:p(\"(:~\"),token:\"comment.doc\",next:function(e){e.push(\"CommentDoc\")}},{name:p(\"<!--\"),token:l,next:function(e){e.push(\"XMLComment\")}},{name:p(\"<?\"),token:c,next:function(e){e.push(\"PI\")}},{name:p(\"''\"),token:\"string\",next:function(e){e.push(\"AposString\")}},{name:p('\"'),token:\"string\",next:function(e){e.push(\"QuotString\")}},{name:\"Annotation\",token:\"support.function\"},{name:\"ModuleDecl\",token:\"keyword\",next:function(e){e.push(\"Prefix\")}},{name:\"OptionDecl\",token:\"keyword\",next:function(e){e.push(\"_EQName\")}},{name:\"AttrTest\",token:\"support.type\"},{name:\"Variable\",token:\"variable\"},{name:p(\"<![CDATA[\"),token:a,next:function(e){e.push(\"CData\")}},{name:\"IntegerLiteral\",token:f},{name:\"DecimalLiteral\",token:f},{name:\"DoubleLiteral\",token:f},{name:\"Operator\",token:\"keyword.operator\"},{name:\"EQName\",token:function(e){return s.indexOf(e)!==-1?\"keyword\":\"support.function\"}},{name:p(\"(\"),token:\"lparen\"},{name:p(\")\"),token:\"rparen\"},{name:\"Tag\",token:\"meta.tag\",next:function(e){e.push(\"StartTag\")}},{name:p(\"}\"),token:\"text\",next:function(e){e.length>1&&e.pop()}},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}].concat(o),_EQName:[{name:\"EQName\",token:\"text\",next:function(e){e.pop()}}].concat(u),Prefix:[{name:\"NCName\",token:\"text\",next:function(e){e.pop()}}].concat(u),StartTag:[{name:p(\">\"),token:\"meta.tag\",next:function(e){e.push(\"TagContent\")}},{name:\"QName\",token:\"entity.other.attribute-name\"},{name:p(\"=\"),token:\"text\"},{name:p(\"''\"),token:\"string\",next:function(e){e.push(\"AposAttr\")}},{name:p('\"'),token:\"string\",next:function(e){e.push(\"QuotAttr\")}},{name:p(\"/>\"),token:\"meta.tag.r\",next:function(e){e.pop()}}],TagContent:[{name:\"ElementContentChar\",token:\"text\"},{name:p(\"<![CDATA[\"),token:a,next:function(e){e.push(\"CData\")}},{name:p(\"<!--\"),token:l,next:function(e){e.push(\"XMLComment\")}},{name:\"Tag\",token:\"meta.tag\",next:function(e){e.push(\"StartTag\")}},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"text\"},{name:p(\"}}\"),token:\"text\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}},{name:\"EndTag\",token:\"meta.tag\",next:function(e){e.pop(),e.pop()}}],AposAttr:[{name:p(\"''\"),token:\"string\",next:function(e){e.pop()}},{name:\"EscapeApos\",token:\"constant.language.escape\"},{name:\"AposAttrContentChar\",token:\"string\"},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"string\"},{name:p(\"}}\"),token:\"string\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}],QuotAttr:[{name:p('\"'),token:\"string\",next:function(e){e.pop()}},{name:\"EscapeQuot\",token:\"constant.language.escape\"},{name:\"QuotAttrContentChar\",token:\"string\"},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"string\"},{name:p(\"}}\"),token:\"string\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}],Pragma:[{name:\"PragmaContents\",token:h},{name:p(\"#\"),token:h},{name:p(\"#)\"),token:h,next:function(e){e.pop()}}],Comment:[{name:\"CommentContents\",token:\"comment\"},{name:p(\"(:\"),token:\"comment\",next:function(e){e.push(\"Comment\")}},{name:p(\":)\"),token:\"comment\",next:function(e){e.pop()}}],CommentDoc:[{name:\"DocCommentContents\",token:\"comment.doc\"},{name:\"DocTag\",token:\"comment.doc.tag\"},{name:p(\"(:\"),token:\"comment.doc\",next:function(e){e.push(\"CommentDoc\")}},{name:p(\":)\"),token:\"comment.doc\",next:function(e){e.pop()}}],XMLComment:[{name:\"DirCommentContents\",token:l},{name:p(\"-->\"),token:l,next:function(e){e.pop()}}],CData:[{name:\"CDataSectionContents\",token:a},{name:p(\"]]>\"),token:a,next:function(e){e.pop()}}],PI:[{name:\"DirPIContents\",token:c},{name:p(\"?\"),token:c},{name:p(\"?>\"),token:c,next:function(e){e.pop()}}],AposString:[{name:p(\"''\"),token:\"string\",next:function(e){e.pop()}},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:\"EscapeApos\",token:\"constant.language.escape\"},{name:\"AposChar\",token:\"string\"}],QuotString:[{name:p('\"'),token:\"string\",next:function(e){e.pop()}},{name:\"JSONPredefinedCharRef\",token:\"constant.language.escape\"},{name:\"JSONCharRef\",token:\"constant.language.escape\"},{name:\"JSONChar\",token:\"string\"}]};n.JSONiqLexer=function(){this.tokens=[],this.getLineTokens=function(e,t){t=t===\"start\"||!t?'[\"start\"]':t;var n=JSON.parse(t),s=new i(e),o=new r(e,s),u=[];for(;;){var a=n[n.length-1];try{s.tokens=[],o[\"parse_\"+a]();var f=null;s.tokens.length>1&&s.tokens[0].name===\"WS\"&&(u.push({type:\"text\",value:s.tokens[0].value}),s.tokens.splice(0,1));var l=s.tokens[0],c=d[a];for(var h=0;h<c.length;h++){var p=d[a][h];if(typeof p.name==\"function\"&&p.name(l)||p.name===l.name){f=p;break}}if(l.name===\"EOF\")break;if(l.value===\"\")throw\"Encountered empty string lexical rule.\";u.push({type:f===null?\"text\":typeof f.token==\"function\"?f.token(l.value):f.token,value:l.value}),f&&f.next&&f.next(n)}catch(v){if(v instanceof o.ParseException){var m=0;for(var g=0;g<u.length;g++)m+=u[g].value.length;return u.push({type:\"text\",value:e.substring(m)}),{tokens:u,state:JSON.stringify([\"start\"])}}throw v}}return{tokens:u,state:JSON.stringify(n)}}}},{\"./JSONiqTokenizer\":1}]},{},[2])(2)}),define(\"ace/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/lib/lang\",\"ace/range\",\"ace/anchor\",\"ace/keyboard/hash_handler\",\"ace/tokenizer\",\"ace/lib/dom\",\"ace/editor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./lib/lang\"),o=e(\"./range\").Range,u=e(\"./anchor\").Anchor,a=e(\"./keyboard/hash_handler\").HashHandler,f=e(\"./tokenizer\").Tokenizer,l=o.comparePoints,c=function(){this.snippetMap={},this.snippetNameMap={}};(function(){r.implement(this,i),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return\"(?:[^\\\\\\\\\"+e+\"]|\\\\\\\\.)\"}return c.$tokenizer=new f({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):\":\"}},{regex:/\\\\./,onMatch:function(e,t,n){var r=e[1];return r==\"}\"&&n.length?e=r:\"`$\\\\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r==\"n\"?e=\"\\n\":r==\"t\"?e=\"\\n\":\"ulULE\".indexOf(r)!=-1&&(e={changeCase:r,local:r>\"a\"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\\$(?:\\d+|\\w+)/,onMatch:e},{regex:/\\$\\{[\\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:\"snippetVar\"},{regex:/\\n/,token:\"newline\",merge:!1}],snippetVar:[{regex:\"\\\\|\"+t(\"\\\\|\")+\"*\\\\|\",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(\",\")},next:\"start\"},{regex:\"/(\"+t(\"/\")+\"+)/(?:(\"+t(\"/\")+\"*)/)(\\\\w*):?\",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],\"\"},next:\"start\"},{regex:\"`\"+t(\"`\")+\"*`\",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),\"\"},next:\"start\"},{regex:\"\\\\?\",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:\"start\"},{regex:\"([^:}\\\\\\\\]|\\\\\\\\.)*:?\",token:\"\",next:\"start\"}],formatString:[{regex:\"/(\"+t(\"/\")+\"+)/\",token:\"regex\"},{regex:\"\",onMatch:function(e,t,n){n.inFormatString=!0},next:\"start\"}]}),c.prototype.getTokenizer=function(){return c.$tokenizer},c.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+\"__\"]||{})[n]}if(/^\\d+$/.test(t))return(this.variables.__||{})[t];t=t.replace(/^TM_/,\"\");if(!e)return;var r=e.session;switch(t){case\"CURRENT_WORD\":var i=r.getWordRange();case\"SELECTION\":case\"SELECTED_TEXT\":return r.getTextRange(i);case\"CURRENT_LINE\":return r.getLine(e.getCursorPosition().row);case\"PREV_LINE\":return r.getLine(e.getCursorPosition().row-1);case\"LINE_INDEX\":return e.getCursorPosition().column;case\"LINE_NUMBER\":return e.getCursorPosition().row+1;case\"SOFT_TABS\":return r.getUseSoftTabs()?\"YES\":\"NO\";case\"TAB_SIZE\":return r.getTabSize();case\"FILENAME\":case\"FILEPATH\":return\"\";case\"FULLNAME\":return\"Ace\"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||\"\":this.$getDefaultValue(e,t)||\"\"},this.tmStrFormat=function(e,t,n){var r=t.flag||\"\",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,\"\"));var s=this.tokenizeTmSnippet(t.fmt,\"formatString\"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t=\"E\";for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"object\"){e[r]=\"\";if(i.changeCase&&i.local){var u=e[r+1];u&&typeof u==\"string\"&&(i.changeCase==\"u\"?e[r]=u[0].toUpperCase():e[r]=u[0].toLowerCase(),e[r+1]=u.substr(1))}else i.changeCase&&(t=i.changeCase)}else t==\"U\"?e[r]=i.toUpperCase():t==\"L\"&&(e[r]=i.toLowerCase())}return e.join(\"\")});return this.variables.__=null,u},this.resolveVariables=function(e,t){function o(t){var n=e.indexOf(t,r+1);n!=-1&&(r=n)}var n=[];for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"string\")n.push(i);else{if(typeof i!=\"object\")continue;if(i.skip)o(i);else{if(i.processed<r)continue;if(i.text){var s=this.getVariableValue(t,i.text);s&&i.fmtString&&(s=this.tmStrFormat(s,i)),i.processed=r,i.expectIf==null?s&&(n.push(s),o(i)):s?i.skip=i.elseBranch:o(i)}else i.tabstopId!=null?n.push(i):i.changeCase!=null&&n.push(i)}}}return n},this.insertSnippetForSelection=function(e,t){function f(e){var t=[];for(var n=0;n<e.length;n++){var r=e[n];if(typeof r==\"object\"){if(a[r.tabstopId])continue;var i=e.lastIndexOf(r,n-1);r=t[i]||{tabstopId:r.tabstopId}}t[n]=r}return t}var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=e.session.getTabString(),s=r.match(/^\\s*/)[0];n.column<s.length&&(s=s.slice(0,n.column));var o=this.tokenizeTmSnippet(t);o=this.resolveVariables(o,e),o=o.map(function(e){return e==\"\\n\"?e+s:typeof e==\"string\"?e.replace(/\\t/g,i):e});var u=[];o.forEach(function(e,t){if(typeof e!=\"object\")return;var n=e.tabstopId,r=u[n];r||(r=u[n]=[],r.index=n,r.value=\"\");if(r.indexOf(e)!==-1)return;r.push(e);var i=o.indexOf(e,t+1);if(i===-1)return;var s=o.slice(t+1,i),a=s.some(function(e){return typeof e==\"object\"});a&&!r.value?r.value=s:s.length&&(!r.value||typeof r.value!=\"string\")&&(r.value=s.join(\"\"))}),u.forEach(function(e){e.length=0});var a={};for(var l=0;l<o.length;l++){var c=o[l];if(typeof c!=\"object\")continue;var p=c.tabstopId,d=o.indexOf(c,l+1);if(a[p]){a[p]===c&&(a[p]=null);continue}var v=u[p],m=typeof v.value==\"string\"?[v.value]:f(v.value);m.unshift(l+1,Math.max(0,d-l)),m.push(c),a[p]=c,o.splice.apply(o,m),v.indexOf(c)===-1&&v.push(c)}var g=0,y=0,b=\"\";o.forEach(function(e){typeof e==\"string\"?(e[0]===\"\\n\"?(y=e.length-1,g++):y+=e.length,b+=e):e.start?e.end={row:g,column:y}:e.start={row:g,column:y}});var w=e.getSelectionRange(),E=e.session.replace(w,b),S=new h(e),x=e.inVirtualSelectionMode&&e.selection.index;S.addTabstops(u,w.start,E,x)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t=e.session.$mode.$id||\"\";t=t.split(\"/\").pop();if(t===\"html\"||t===\"php\"){t===\"php\"&&!e.session.$mode.inlinePhp&&(t=\"html\");var n=e.getCursorPosition(),r=e.session.getState(n.row);typeof r==\"object\"&&(r=r[0]),r.substring&&(r.substring(0,3)==\"js-\"?t=\"javascript\":r.substring(0,4)==\"css-\"?t=\"css\":r.substring(0,4)==\"php-\"&&(t=\"php\"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],r=this.snippetMap;return r[t]&&r[t].includeScopes&&n.push.apply(n,r[t].includeScopes),n.push(\"_\"),n},this.expandWithTab=function(e,t){var n=this,r=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return r&&e.tabstopManager&&e.tabstopManager.tabNext(),r},this.expandSnippetForSelection=function(e,t){var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=r.substring(0,n.column),s=r.substr(n.column),o=this.snippetMap,u;return this.getActiveScopes(e).some(function(e){var t=o[e];return t&&(u=this.findMatchingSnippet(t,i,s)),!!u},this),u?t&&t.dryRun?!0:(e.session.doc.removeInLine(n.row,n.column-u.replaceBefore.length,n.column+u.replaceAfter.length),this.variables.M__=u.matchBefore,this.variables.T__=u.matchAfter,this.insertSnippetForSelection(e,u.content),this.variables.M__=this.variables.T__=null,!0):!1},this.findMatchingSnippet=function(e,t,n){for(var r=e.length;r--;){var i=e[r];if(i.startRe&&!i.startRe.test(t))continue;if(i.endRe&&!i.endRe.test(n))continue;if(!i.startRe&&!i.endRe)continue;return i.matchBefore=i.startRe?i.startRe.exec(t):[\"\"],i.matchAfter=i.endRe?i.endRe.exec(n):[\"\"],i.replaceBefore=i.triggerRe?i.triggerRe.exec(t)[0]:\"\",i.replaceAfter=i.endTriggerRe?i.endTriggerRe.exec(n)[0]:\"\",i}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){function o(e){return e&&!/^\\^?\\(.*\\)\\$?$|^\\\\b$/.test(e)&&(e=\"(?:\"+e+\")\"),e||\"\"}function u(e,t,n){return e=o(e),t=o(t),n?(e=t+e,e&&e[e.length-1]!=\"$\"&&(e+=\"$\")):(e+=t,e&&e[0]!=\"^\"&&(e=\"^\"+e)),new RegExp(e)}function a(e){e.scope||(e.scope=t||\"_\"),t=e.scope,n[t]||(n[t]=[],r[t]={});var o=r[t];if(e.name){var a=o[e.name];a&&i.unregister(a),o[e.name]=e}n[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\\w/.test(e.tabTrigger)&&(e.guard=\"\\\\b\"),e.trigger=s.escapeRegExp(e.tabTrigger)),e.startRe=u(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,\"\",!0),e.endRe=u(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,\"\",!0)}var n=this.snippetMap,r=this.snippetNameMap,i=this;e.content?a(e):Array.isArray(e)&&e.forEach(a),this._signal(\"registerSnippets\",{scope:t})},this.unregister=function(e,t){function i(e){var i=r[e.scope||t];if(i&&i[e.name]){delete i[e.name];var s=n[e.scope||t],o=s&&s.indexOf(e);o>=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\\r/g,\"\");var t=[],n={},r=/^#.*|^({[\\s\\S]*})\\s*$|^(\\S+) (.*)$|^((?:\\n*\\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\\t/gm,\"\"),t.push(n),n={};else{var o=i[2],u=i[3];if(o==\"regex\"){var a=/\\/((?:[^\\/\\\\]|\\\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o==\"snippet\"?(n.tabTrigger=u.match(/^\\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,r;return this.getActiveScopes(t).some(function(t){var i=n[t];return i&&(r=i[e]),!!r},this),r}}).call(c.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on(\"change\",this.$onChange),this.editor.on(\"changeSelection\",this.$onChangeSelection),this.editor.on(\"changeSession\",this.$onChangeSession),this.editor.commands.on(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener(\"change\",this.$onChange),this.editor.removeListener(\"changeSelection\",this.$onChangeSelection),this.editor.removeListener(\"changeSession\",this.$onChangeSession),this.editor.commands.removeListener(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e.data.range,n=e.data.action[0]==\"r\",r=t.start,i=t.end,s=r.row,o=i.row,u=o-s,a=i.column-r.column;n&&(u=-u,a=-a);if(!this.$inChange&&n){var f=this.selectedTabstop,c=f&&!f.some(function(e){return l(e.start,r)<=0&&l(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p<h.length;p++){var d=h[p];if(d.end.row<r.row)continue;if(n&&l(r,d.start)<0&&l(i,d.end)>0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=a),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=a),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),l(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e||!e.hasLinkedRanges)return;this.$inChange=!0;var n=this.editor.session,r=n.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=t.snippetManager.tmStrFormat(r,s.original);n.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),n===0&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}n.ranges[0]&&n.addRange(n.ranges[0].clone())}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){this.$openTabstops||(this.$openTabstops=[]);if(!e[0]){var r=o.fromPoints(n,n);v(r.start,t),v(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,s=[i+1,0],u=this.ranges;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;for(var i=e.length;i--;){var a=e[i],f=o.fromPoints(a.start,a.end||a.start);d(f.start,t),d(f.end,t),f.original=a,f.tabstop=r,u.push(f),r!=e?r.unshift(f):r[i]=f,a.fmtString?(f.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=f)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(s.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,\"ace_snippet-marker\",\"text\"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),t!=-1&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new a,this.keyboardHandler.bindKeys({Tab:function(e){if(t.snippetManager&&t.snippetManager.expandWithTab(e))return;e.tabstopManager.tabNext(1)},\"Shift-Tab\":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var p={};p.onChange=u.prototype.onChange,p.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},p.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var d=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},v=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e(\"./lib/dom\").importCssString(\".ace_snippet-marker {    -moz-box-sizing: border-box;    box-sizing: border-box;    background: rgba(194, 193, 208, 0.09);    border: 1px dotted rgba(211, 208, 235, 0.62);    position: absolute;}\"),t.snippetManager=new c;var m=e(\"./editor\").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),define(\"ace/autocomplete\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\",\"ace/autocomplete/popup\",\"ace/autocomplete/util\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/snippets\"],function(e,t,n){var r=e(\"./keyboard/hash_handler\").HashHandler,i=e(\"./autocomplete/popup\").AcePopup,s=e(\"./autocomplete/util\"),o=e(\"./lib/event\"),u=e(\"./lib/lang\"),a=e(\"./snippets\").snippetManager,f=function(){this.autoInsert=!0,this.autoSelect=!0,this.keyboardHandler=new r,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=u.delayedCall(function(){this.updateCompletions(!0)}.bind(this))};(function(){this.gatherCompletionsId=0,this.$init=function(){this.popup=new i(document.body||document.documentElement),this.popup.on(\"click\",function(e){this.insertMatch(),e.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor)},this.openPopup=function(e,t,n){this.popup||this.$init(),this.popup.setData(this.completions.filtered);var r=e.renderer;this.popup.setRow(this.autoSelect?0:-1);if(!n){this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize());var i=r.layerConfig.lineHeight,s=r.$cursorLayer.getPixelPosition(this.base,!0);s.left-=this.popup.getTextLeftOffset();var o=e.container.getBoundingClientRect();s.top+=o.top-r.layerConfig.offset,s.left+=o.left-e.renderer.scrollLeft,s.left+=r.$gutterLayer.gutterWidth,this.popup.show(s,i)}},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off(\"changeSelection\",this.changeListener),this.editor.off(\"blur\",this.blurListener),this.editor.off(\"mousedown\",this.mousedownListener),this.editor.off(\"mousewheel\",this.mousewheelListener),this.changeTimer.cancel(),this.popup&&this.popup.isOpen&&(this.gatherCompletionsId=this.gatherCompletionsId+1),this.popup&&this.popup.hide(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(){var e=document.activeElement;e!=this.editor.textInput.getElement()&&e.parentNode!=this.popup.container&&this.detach()},this.mousedownListener=function(e){this.detach()},this.mousewheelListener=function(e){this.detach()},this.goTo=function(e){var t=this.popup.getRow(),n=this.popup.session.getLength()-1;switch(e){case\"up\":t=t<=0?n:t-1;break;case\"down\":t=t>=n?-1:t+1;break;case\"start\":t=0;break;case\"end\":t=n}this.popup.setRow(t)},this.insertMatch=function(e){e||(e=this.popup.getData(this.popup.getRow()));if(!e)return!1;if(e.completer&&e.completer.insertMatch)e.completer.insertMatch(this.editor);else{if(this.completions.filterText){var t=this.editor.selection.getAllRanges();for(var n=0,r;r=t[n];n++)r.start.column-=this.completions.filterText.length,this.editor.session.remove(r)}e.snippet?a.insertSnippet(this.editor,e.snippet):this.editor.execCommand(\"insertstring\",e.value||e)}this.detach()},this.commands={Up:function(e){e.completer.goTo(\"up\")},Down:function(e){e.completer.goTo(\"down\")},\"Ctrl-Up|Ctrl-Home\":function(e){e.completer.goTo(\"start\")},\"Ctrl-Down|Ctrl-End\":function(e){e.completer.goTo(\"end\")},Esc:function(e){e.completer.detach()},Space:function(e){e.completer.detach(),e.insert(\" \")},Return:function(e){return e.completer.insertMatch()},\"Shift-Return\":function(e){e.completer.insertMatch(!0)},Tab:function(e){var t=e.completer.insertMatch();if(!!t||!!e.tabstopManager)return t;e.completer.goTo(\"down\")},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},this.gatherCompletions=function(e,t){var n=e.getSession(),r=e.getCursorPosition(),i=n.getLine(r.row),o=s.retrievePrecedingIdentifier(i,r.column);this.base=e.getCursorPosition(),this.base.column-=o.length;var u=[],a=e.completers.length;return e.completers.forEach(function(i,f){i.getCompletions(e,n,r,o,function(r,i){r||(u=u.concat(i));var o=e.getCursorPosition(),f=n.getLine(o.row);t(null,{prefix:s.retrievePrecedingIdentifier(f,o.column,i[0]&&i[0].identifierRegex),matches:u,finished:--a===0})})}),!0},this.showPopup=function(e){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.keyBinding.addKeyboardHandler(this.keyboardHandler),e.on(\"changeSelection\",this.changeListener),e.on(\"blur\",this.blurListener),e.on(\"mousedown\",this.mousedownListener),e.on(\"mousewheel\",this.mousewheelListener),this.updateCompletions()},this.updateCompletions=function(e){if(e&&this.base&&this.completions){var t=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:t});if(n==this.completions.filterText)return;this.completions.setFilter(n);if(!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==n&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,n,e);return}var r=this.gatherCompletionsId;this.gatherCompletions(this.editor,function(t,n){var i=function(){if(!n.finished)return;return this.detach()}.bind(this),s=n.prefix,o=n&&n.matches;if(!o||!o.length)return i();if(s.indexOf(n.prefix)!==0||r!=this.gatherCompletionsId)return;this.completions=new l(o),this.completions.setFilter(s);var u=this.completions.filtered;if(!u.length)return i();if(u.length==1&&u[0].value==s&&!u[0].snippet)return i();if(this.autoInsert&&u.length==1)return this.insertMatch(u[0]);this.openPopup(this.editor,s,e)}.bind(this))},this.cancelContextMenu=function(){var e=function(t){this.editor.off(\"nativecontextmenu\",e),t&&t.domEvent&&o.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on(\"nativecontextmenu\",e)}}).call(f.prototype),f.startCommand={name:\"startAutocomplete\",exec:function(e){e.completer||(e.completer=new f),e.completer.autoInsert=e.completer.autoSelect=!0,e.completer.showPopup(e),e.completer.cancelContextMenu()},bindKey:\"Ctrl-Space|Ctrl-Shift-Space|Alt-Space\"};var l=function(e,t,n){this.all=e,this.filtered=e,this.filterText=t||\"\"};(function(){this.setFilter=function(e){if(e.length>this.filterText&&e.lastIndexOf(this.filterText,0)===0)var t=this.filtered;else var t=this.all;this.filterText=e,t=this.filterCompletions(t,this.filterText),t=t.sort(function(e,t){return t.exactMatch-e.exactMatch||t.score-e.score});var n=null;t=t.filter(function(e){var t=e.value||e.caption||e.snippet;return t===n?!1:(n=t,!0)}),this.filtered=t},this.filterCompletions=function(e,t){var n=[],r=t.toUpperCase(),i=t.toLowerCase();e:for(var s=0,o;o=e[s];s++){var u=o.value||o.caption||o.snippet;if(!u)continue;var a=-1,f=0,l=0,c,h;for(var p=0;p<t.length;p++){var d=u.indexOf(i[p],a+1),v=u.indexOf(r[p],a+1);c=d>=0?v<0||d<v?d:v:v;if(c<0)continue e;h=c-a-1,h>0&&(a===-1&&(l+=10),l+=h),f|=1<<c,a=c}o.matchMask=f,o.exactMatch=l?0:1,o.score=(o.score||0)-l,n.push(o)}return n}}).call(l.prototype),t.Autocomplete=f,t.FilteredList=l}),define(\"ace/autocomplete/popup\",[\"require\",\"exports\",\"module\",\"ace/edit_session\",\"ace/virtual_renderer\",\"ace/editor\",\"ace/range\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../edit_session\").EditSession,i=e(\"../virtual_renderer\").VirtualRenderer,s=e(\"../editor\").Editor,o=e(\"../range\").Range,u=e(\"../lib/event\"),a=e(\"../lib/lang\"),f=e(\"../lib/dom\"),l=function(e){var t=new i(e);t.$maxLines=4;var n=new s(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusWaitTimout=0,n},c=function(e){var t=f.createElement(\"div\"),n=new l(t);e&&e.appendChild(t),t.style.display=\"none\",n.renderer.content.style.cursor=\"default\",n.renderer.setStyle(\"ace_autocomplete\"),n.setOption(\"displayIndentGuides\",!1);var r=function(){};n.focus=r,n.$isFocused=!0,n.renderer.$cursorLayer.restartTimer=r,n.renderer.$cursorLayer.element.style.opacity=0,n.renderer.$maxLines=8,n.renderer.$keepTextAreaAtCursor=!1,n.setHighlightActiveLine(!1),n.session.highlight(\"\"),n.session.$searchHighlight.clazz=\"ace_highlight-marker\",n.on(\"mousedown\",function(e){var t=e.getDocumentPosition();n.selection.moveToPosition(t),c.start.row=c.end.row=t.row,e.stop()});var i,s=new o(-1,0,-1,Infinity),c=new o(-1,0,-1,Infinity);c.id=n.session.addMarker(c,\"ace_active-line\",\"fullLine\"),n.setSelectOnHover=function(e){e?s.id&&(n.session.removeMarker(s.id),s.id=null):s.id=n.session.addMarker(s,\"ace_line-hover\",\"fullLine\")},n.setSelectOnHover(!1),n.on(\"mousemove\",function(e){if(!i){i=e;return}if(i.x==e.x&&i.y==e.y)return;i=e,i.scrollTop=n.renderer.scrollTop;var t=i.getDocumentPosition().row;s.start.row!=t&&(s.id||n.setRow(t),p(t))}),n.renderer.on(\"beforeRender\",function(){if(i&&s.start.row!=-1){i.$pos=null;var e=i.getDocumentPosition().row;s.id||n.setRow(e),p(e,!0)}}),n.renderer.on(\"afterRender\",function(){var e=n.getRow(),t=n.renderer.$textLayer,r=t.element.childNodes[e-t.config.firstRow];if(r==t.selectedNode)return;t.selectedNode&&f.removeCssClass(t.selectedNode,\"ace_selected\"),t.selectedNode=r,r&&f.addCssClass(r,\"ace_selected\")});var h=function(){p(-1)},p=function(e,t){e!==s.start.row&&(s.start.row=s.end.row=e,t||n.session._emit(\"changeBackMarker\"),n._emit(\"changeHoverMarker\"))};n.getHoveredRow=function(){return s.start.row},u.addListener(n.container,\"mouseout\",h),n.on(\"hide\",h),n.on(\"changeSelection\",h),n.session.doc.getLength=function(){return n.data.length},n.session.doc.getLine=function(e){var t=n.data[e];return typeof t==\"string\"?t:t&&t.value||\"\"};var d=n.session.bgTokenizer;return d.$tokenizeRow=function(e){var t=n.data[e],r=[];if(!t)return r;typeof t==\"string\"&&(t={value:t}),t.caption||(t.caption=t.value);var i=-1,s,o;for(var e=0;e<t.caption.length;e++)o=t.caption[e],s=t.matchMask&1<<e?1:0,i!==s?(r.push({type:t.className||\"\"+(s?\"completion-highlight\":\"\"),value:o}),i=s):r[r.length-1].value+=o;if(t.meta){var u=n.renderer.$size.scrollerWidth/n.renderer.layerConfig.characterWidth;t.meta.length+t.caption.length<u-2&&r.push({type:\"rightAlignedText\",value:t.meta})}return r},d.$updateOnChange=r,d.start=r,n.session.$computeWidth=function(){return this.screenWidth=0},n.isOpen=!1,n.isTopdown=!1,n.data=[],n.setData=function(e){n.data=e||[],n.setValue(a.stringRepeat(\"\\n\",e.length),-1),n.setRow(0)},n.getData=function(e){return n.data[e]},n.getRow=function(){return c.start.row},n.setRow=function(e){e=Math.max(-1,Math.min(this.data.length,e)),c.start.row!=e&&(n.selection.clearSelection(),c.start.row=c.end.row=e||0,n.session._emit(\"changeBackMarker\"),n.moveCursorTo(e||0,0),n.isOpen&&n._signal(\"select\"))},n.on(\"changeSelection\",function(){n.isOpen&&n.setRow(n.selection.lead.row)}),n.hide=function(){this.container.style.display=\"none\",this._signal(\"hide\"),n.isOpen=!1},n.show=function(e,t,r){var s=this.container,o=window.innerHeight,u=window.innerWidth,a=this.renderer,f=a.$maxLines*t*1.4,l=e.top+this.$borderSize;l+f>o-t&&!r?(s.style.top=\"\",s.style.bottom=o-l+\"px\",n.isTopdown=!1):(l+=t,s.style.top=l+\"px\",s.style.bottom=\"\",n.isTopdown=!0),s.style.display=\"\",this.renderer.$textLayer.checkForSizeChanges();var c=e.left;c+s.offsetWidth>u&&(c=u-s.offsetWidth),s.style.left=c+\"px\",this._signal(\"show\"),i=null,n.isOpen=!0},n.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},n.$imageSize=0,n.$borderSize=1,n};f.importCssString(\".ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {    background-color: #CAD6FA;    z-index: 1;}.ace_editor.ace_autocomplete .ace_line-hover {    border: 1px solid #abbffe;    margin-top: -1px;    background: rgba(233,233,253,0.4);}.ace_editor.ace_autocomplete .ace_line-hover {    position: absolute;    z-index: 2;}.ace_editor.ace_autocomplete .ace_scroller {   background: none;   border: none;   box-shadow: none;}.ace_rightAlignedText {    color: gray;    display: inline-block;    position: absolute;    right: 4px;    text-align: right;    z-index: -1;}.ace_editor.ace_autocomplete .ace_completion-highlight{    color: #000;    text-shadow: 0 0 0.01em;}.ace_editor.ace_autocomplete {    width: 280px;    z-index: 200000;    background: #fbfbfb;    color: #444;    border: 1px lightgray solid;    position: fixed;    box-shadow: 2px 3px 5px rgba(0,0,0,.2);    line-height: 1.4;}\"),t.AcePopup=c}),define(\"ace/autocomplete/util\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.parForEach=function(e,t,n){var r=0,i=e.length;i===0&&n();for(var s=0;s<i;s++)t(e[s],function(e,t){r++,r===i&&n(e,t)})};var r=/[a-zA-Z_0-9\\$\\-\\u00A2-\\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t-1;s>=0;s--){if(!n.test(e[s]))break;i.push(e[s])}return i.reverse().join(\"\")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t;s<e.length;s++){if(!n.test(e[s]))break;i.push(e[s])}return i}}),define(\"ace/autocomplete/text_completer\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){function s(e,t){var n=e.getTextRange(r.fromPoints({row:0,column:0},t));return n.split(i).length-1}function o(e,t){var n=s(e,t),r=e.getValue().split(i),o=Object.create(null),u=r[n];return r.forEach(function(e,t){if(!e||e===u)return;var i=Math.abs(n-t),s=r.length-i;o[e]?o[e]=Math.max(s,o[e]):o[e]=s}),o}var r=e(\"../range\").Range,i=/[^a-zA-Z_0-9\\$\\-\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w]+/;t.getCompletions=function(e,t,n,r,i){var s=o(t,n,r),u=Object.keys(s);i(null,u.map(function(e){return{name:e,value:e,score:s[e],meta:\"local\"}}))}}),define(\"ace/ext/language_tools\",[\"require\",\"exports\",\"module\",\"ace/snippets\",\"ace/autocomplete\",\"ace/config\",\"ace/autocomplete/util\",\"ace/autocomplete/text_completer\",\"ace/editor\"],function(e,t,n){var r=e(\"../snippets\").snippetManager,i=e(\"../autocomplete\").Autocomplete,s=e(\"../config\"),o=e(\"../autocomplete/util\"),u=e(\"../autocomplete/text_completer\"),a={getCompletions:function(e,t,n,r,i){var s=e.session.getState(n.row),o=t.$mode.getCompletions(s,t,n,r);i(null,o)}},f={getCompletions:function(e,t,n,i,s){var o=r.snippetMap,u=[];r.getActiveScopes(e).forEach(function(e){var t=o[e]||[];for(var n=t.length;n--;){var r=t[n],i=r.name||r.tabTrigger;if(!i)continue;u.push({caption:i,snippet:r.content,meta:r.tabTrigger&&!r.name?r.tabTrigger+\"\\u21e5 \":\"snippet\"})}},this),s(null,u)}},l=[f,u,a];t.addCompleter=function(e){l.push(e)},t.textCompleter=u,t.keyWordCompleter=a,t.snippetCompleter=f;var c={name:\"expandSnippet\",exec:function(e){var t=r.expandWithTab(e);t||e.execCommand(\"indent\")},bindKey:\"Tab\"},h=function(e,t){p(t.session.$mode)},p=function(e){var t=e.$id;r.files||(r.files={}),d(t),e.modes&&e.modes.forEach(p)},d=function(e){if(!e||r.files[e])return;var t=e.replace(\"mode\",\"snippets\");r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){d(\"ace/mode/\"+e)})))})},v=function(e){var t=e.editor,n=e.args||\"\",r=t.getCursorPosition(),s=t.session.getLine(r.row),u=t.completer&&t.completer.activated,a=o.retrievePrecedingIdentifier(s,r.column);l.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(e){a||(a=o.retrievePrecedingIdentifier(s,r.column,e))})}),e.command.name===\"backspace\"&&!a?u&&t.completer.detach():e.command.name===\"insertstring\"&&(a&&!u?(t.completer||(t.completer=new i,t.completer.autoSelect=!1,t.completer.autoInsert=!1),t.completer.showPopup(t)):!a&&u&&t.completer.detach())},m=e(\"../editor\").Editor;e(\"../config\").defineOptions(m.prototype,\"editor\",{enableBasicAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.on(\"afterExec\",v)):this.commands.removeListener(\"afterExec\",v)},value:!1},enableSnippets:{set:function(e){e?(this.commands.addCommand(c),this.on(\"changeMode\",h),h(null,this)):(this.commands.removeCommand(c),this.off(\"changeMode\",h))},value:!1}})})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-jsp.js",
    "content": "define(\"ace/mode/jsp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/jsp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./jsp_highlight_rules\").JspHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.$id=\"ace/mode/jsp\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/jsp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\",\"ace/mode/java_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=e(\"./java_highlight_rules\").JavaHighlightRules,o=function(){i.call(this);var e=\"request|response|out|session|application|config|pageContext|page|Exception\",t=\"page|include|taglib\",n=[{token:\"comment\",regex:\"<%--\",push:\"jsp-dcomment\"},{token:\"meta.tag\",regex:\"<%@?|<%=?|<jsp:[^>]+>\",push:\"jsp-start\"}],r=[{token:\"meta.tag\",regex:\"%>|<\\\\/jsp:[^>]+>\",next:\"pop\"},{token:\"variable.language\",regex:e},{token:\"keyword\",regex:t}];for(var o in this.$rules)this.$rules[o].unshift.apply(this.$rules[o],n);this.embedRules(s,\"jsp-\",r,[\"start\"]),this.addRules({\"jsp-dcomment\":[{token:\"comment\",regex:\".*?--%>\",next:\"pop\"}]}),this.normalizeRules()};r.inherits(o,i),t.JspHighlightRules=o}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/java_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"abstract|continue|for|new|switch|assert|default|goto|package|synchronized|boolean|do|if|private|this|break|double|implements|protected|throw|byte|else|import|public|throws|case|enum|instanceof|return|transient|catch|extends|int|short|try|char|final|interface|static|void|class|finally|long|strictfp|volatile|const|float|native|super|while\",t=\"null|Infinity|NaN|undefined\",n=\"AbstractMethodError|AssertionError|ClassCircularityError|ClassFormatError|Deprecated|EnumConstantNotPresentException|ExceptionInInitializerError|IllegalAccessError|IllegalThreadStateException|InstantiationError|InternalError|NegativeArraySizeException|NoSuchFieldError|Override|Process|ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|SuppressWarnings|TypeNotPresentException|UnknownError|UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|InstantiationException|IndexOutOfBoundsException|ArrayIndexOutOfBoundsException|CloneNotSupportedException|NoSuchFieldException|IllegalArgumentException|NumberFormatException|SecurityException|Void|InheritableThreadLocal|IllegalStateException|InterruptedException|NoSuchMethodException|IllegalAccessException|UnsupportedOperationException|Enum|StrictMath|Package|Compiler|Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|Character|Boolean|StackTraceElement|Appendable|StringBuffer|Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|StackOverflowError|OutOfMemoryError|VirtualMachineError|ArrayStoreException|ClassCastException|LinkageError|NoClassDefFoundError|ClassNotFoundException|RuntimeException|Exception|ThreadDeath|Error|Throwable|System|ClassLoader|Cloneable|Class|CharSequence|Comparable|String|Object\",r=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"constant.language\":t,\"support.function\":n},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.JavaHighlightRules=o}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-jsx.js",
    "content": "define(\"ace/mode/jsx\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/jsx_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){function f(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a}var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./jsx_highlight_rules\").JsxHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode;r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/jsx\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/jsx_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){var e=i.arrayToMap(\"break|do|instanceof|typeof|case|else|new|var|catch|finally|return|void|continue|for|switch|default|while|function|this|if|throw|delete|in|try|class|extends|super|import|from|into|implements|interface|static|mixin|override|abstract|final|number|int|string|boolean|variant|log|assert\".split(\"|\")),t=i.arrayToMap(\"null|true|false|NaN|Infinity|__FILE__|__LINE__|undefined\".split(\"|\")),n=i.arrayToMap(\"debugger|with|const|export|let|private|public|yield|protected|extern|native|as|operator|__fake__|__readonly__\".split(\"|\")),r=\"[a-zA-Z_][a-zA-Z0-9_]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},s.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:[\"storage.type\",\"text\",\"entity.name.function\"],regex:\"(function)(\\\\s+)(\"+r+\")\"},{token:function(r){return r==\"this\"?\"variable.language\":r==\"function\"?\"storage.type\":e.hasOwnProperty(r)||n.hasOwnProperty(r)?\"keyword\":t.hasOwnProperty(r)?\"constant.language\":/^_?[A-Z][a-zA-Z0-9_]*$/.test(r)?\"language.support.class\":\"identifier\"},regex:r},{token:\"keyword.operator\",regex:\"!|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({<]\"},{token:\"paren.rparen\",regex:\"[\\\\])}>]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.embedRules(s,\"doc-\",[s.getEndRule(\"start\")])};r.inherits(u,o),t.JsxHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-julia.js",
    "content": "define(\"ace/mode/julia\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/julia_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./julia_highlight_rules\").JuliaHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"#\",this.blockComment=\"\",this.$id=\"ace/mode/julia\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/julia_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{include:\"#function_decl\"},{include:\"#function_call\"},{include:\"#type_decl\"},{include:\"#keyword\"},{include:\"#operator\"},{include:\"#number\"},{include:\"#string\"},{include:\"#comment\"}],\"#bracket\":[{token:\"keyword.bracket.julia\",regex:\"\\\\(|\\\\)|\\\\[|\\\\]|\\\\{|\\\\}|,\"}],\"#comment\":[{token:[\"punctuation.definition.comment.julia\",\"comment.line.number-sign.julia\"],regex:\"(#)(?!\\\\{)(.*$)\"}],\"#function_call\":[{token:[\"support.function.julia\",\"text\"],regex:\"([a-zA-Z0-9_]+!?)([\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]*\\\\()\"}],\"#function_decl\":[{token:[\"keyword.other.julia\",\"meta.function.julia\",\"entity.name.function.julia\",\"meta.function.julia\",\"text\"],regex:\"(function|macro)(\\\\s*)([a-zA-Z0-9_\\\\{]+!?)([\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]*)([(\\\\\\\\{])\"}],\"#keyword\":[{token:\"keyword.other.julia\",regex:\"\\\\b(?:function|type|immutable|macro|quote|abstract|bitstype|typealias|module|baremodule|new)\\\\b\"},{token:\"keyword.control.julia\",regex:\"\\\\b(?:if|else|elseif|while|for|in|begin|let|end|do|try|catch|finally|return|break|continue)\\\\b\"},{token:\"storage.modifier.variable.julia\",regex:\"\\\\b(?:global|local|const|export|import|importall|using)\\\\b\"},{token:\"variable.macro.julia\",regex:\"@[\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]+\\\\b\"}],\"#number\":[{token:\"constant.numeric.julia\",regex:\"\\\\b0(?:x|X)[0-9a-fA-F]*|(?:\\\\b[0-9]+\\\\.?[0-9]*|\\\\.[0-9]+)(?:(?:e|E)(?:\\\\+|-)?[0-9]*)?(?:im)?|\\\\bInf(?:32)?\\\\b|\\\\bNaN(?:32)?\\\\b|\\\\btrue\\\\b|\\\\bfalse\\\\b\"}],\"#operator\":[{token:\"keyword.operator.update.julia\",regex:\"=|:=|\\\\+=|-=|\\\\*=|/=|//=|\\\\.//=|\\\\.\\\\*=|\\\\\\\\=|\\\\.\\\\\\\\=|^=|\\\\.^=|%=|\\\\|=|&=|\\\\$=|<<=|>>=\"},{token:\"keyword.operator.ternary.julia\",regex:\"\\\\?|:\"},{token:\"keyword.operator.boolean.julia\",regex:\"\\\\|\\\\||&&|!\"},{token:\"keyword.operator.arrow.julia\",regex:\"->|<-|-->\"},{token:\"keyword.operator.relation.julia\",regex:\">|<|>=|<=|==|!=|\\\\.>|\\\\.<|\\\\.>=|\\\\.>=|\\\\.==|\\\\.!=|\\\\.=|\\\\.!|<:|:>\"},{token:\"keyword.operator.range.julia\",regex:\":\"},{token:\"keyword.operator.shift.julia\",regex:\"<<|>>\"},{token:\"keyword.operator.bitwise.julia\",regex:\"\\\\||\\\\&|~\"},{token:\"keyword.operator.arithmetic.julia\",regex:\"\\\\+|-|\\\\*|\\\\.\\\\*|/|\\\\./|//|\\\\.//|%|\\\\.%|\\\\\\\\|\\\\.\\\\\\\\|\\\\^|\\\\.\\\\^\"},{token:\"keyword.operator.isa.julia\",regex:\"::\"},{token:\"keyword.operator.dots.julia\",regex:\"\\\\.(?=[a-zA-Z])|\\\\.\\\\.+\"},{token:\"keyword.operator.interpolation.julia\",regex:\"\\\\$#?(?=.)\"},{token:[\"variable\",\"keyword.operator.transposed-variable.julia\"],regex:\"([\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]+)((?:'|\\\\.')*\\\\.?')\"},{token:\"text\",regex:\"\\\\[|\\\\(\"},{token:[\"text\",\"keyword.operator.transposed-matrix.julia\"],regex:\"([\\\\]\\\\)])((?:'|\\\\.')*\\\\.?')\"}],\"#string\":[{token:\"punctuation.definition.string.begin.julia\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.julia\",regex:\"'\",next:\"pop\"},{include:\"#string_escaped_char\"},{defaultToken:\"string.quoted.single.julia\"}]},{token:\"punctuation.definition.string.begin.julia\",regex:'\"',push:[{token:\"punctuation.definition.string.end.julia\",regex:'\"',next:\"pop\"},{include:\"#string_escaped_char\"},{defaultToken:\"string.quoted.double.julia\"}]},{token:\"punctuation.definition.string.begin.julia\",regex:'\\\\b[\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]+\"',push:[{token:\"punctuation.definition.string.end.julia\",regex:'\"[\\\\w\\\\xff-\\\\u218e\\\\u2455-\\\\uffff]*',next:\"pop\"},{include:\"#string_custom_escaped_char\"},{defaultToken:\"string.quoted.custom-double.julia\"}]},{token:\"punctuation.definition.string.begin.julia\",regex:\"`\",push:[{token:\"punctuation.definition.string.end.julia\",regex:\"`\",next:\"pop\"},{include:\"#string_escaped_char\"},{defaultToken:\"string.quoted.backtick.julia\"}]}],\"#string_custom_escaped_char\":[{token:\"constant.character.escape.julia\",regex:'\\\\\\\\\"'}],\"#string_escaped_char\":[{token:\"constant.character.escape.julia\",regex:\"\\\\\\\\(?:\\\\\\\\|[0-3]\\\\d{,2}|[4-7]\\\\d?|x[a-fA-F0-9]{,2}|u[a-fA-F0-9]{,4}|U[a-fA-F0-9]{,8}|.)\"}],\"#type_decl\":[{token:[\"keyword.control.type.julia\",\"meta.type.julia\",\"entity.name.type.julia\",\"entity.other.inherited-class.julia\",\"punctuation.separator.inheritance.julia\",\"entity.other.inherited-class.julia\"],regex:\"(type|immutable)(\\\\s+)([a-zA-Z0-9_]+)(?:(\\\\s*)(<:)(\\\\s*[.a-zA-Z0-9_:]+))?\"},{token:[\"other.typed-variable.julia\",\"support.type.julia\"],regex:\"([a-zA-Z0-9_]+)(::[a-zA-Z0-9_{}]+)\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"jl\"],firstLineMatch:\"^#!.*\\\\bjulia\\\\s*$\",foldingStartMarker:\"^\\\\s*(?:if|while|for|begin|function|macro|module|baremodule|type|immutable|let)\\\\b(?!.*\\\\bend\\\\b).*$\",foldingStopMarker:\"^\\\\s*(?:end)\\\\b.*$\",name:\"Julia\",scopeName:\"source.julia\"},r.inherits(s,i),t.JuliaHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-latex.js",
    "content": "define(\"ace/mode/latex\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/latex_highlight_rules\",\"ace/mode/folding/latex\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./latex_highlight_rules\").LatexHighlightRules,o=e(\"./folding/latex\").FoldMode,u=e(\"../range\").Range,a=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(a,i),function(){this.lineCommentStart=\"%\",this.$id=\"ace/mode/latex\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/latex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"keyword\",regex:\"\\\\\\\\(?:[^a-zA-Z]|[a-zA-Z]+)\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"string\",regex:\"\\\\$(?:(?:\\\\\\\\.)|(?:[^\\\\$\\\\\\\\]))*?\\\\$\"},{token:\"comment\",regex:\"%.*$\"}]}};r.inherits(s,i),t.LatexHighlightRules=s}),define(\"ace/mode/folding/latex\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=e(\"../../token_iterator\").TokenIterator,u=t.FoldMode=function(){};r.inherits(u,i),function(){this.foldingStartMarker=/^\\s*\\\\(begin)|(section|subsection)\\b|{\\s*$/,this.foldingStopMarker=/^\\s*\\\\(end)\\b|^\\s*}/,this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getLine(n),i=this.foldingStartMarker.exec(r);if(i)return i[1]?this.latexBlock(e,n,i[0].length-1):i[2]?this.latexSection(e,n,i[0].length-1):this.openingBracketBlock(e,\"{\",n,i.index);var i=this.foldingStopMarker.exec(r);if(i)return i[1]?this.latexBlock(e,n,i[0].length-1):this.closingBracketBlock(e,\"}\",n,i.index+i[0].length)},this.latexBlock=function(e,t,n){var r={\"\\\\begin\":1,\"\\\\end\":-1},i=new o(e,t,n),u=i.getCurrentToken();if(!u||u.type!==\"keyword\")return;var a=u.value,f=r[a],l=function(){var e=i.stepForward(),t=e.type==\"lparen\"?i.stepForward().value:\"\";return f===-1&&(i.stepBackward(),t&&i.stepBackward()),t},c=[l()],h=f===-1?i.getCurrentTokenColumn():e.getLine(t).length,p=t;i.step=f===-1?i.stepBackward:i.stepForward;while(u=i.step()){if(u.type!==\"keyword\")continue;var d=r[u.value];if(!d)continue;var v=l();if(d===f)c.unshift(v);else if(c.shift()!==v||!c.length)break}if(c.length)return;var t=i.getCurrentTokenRow();return f===-1?new s(t,e.getLine(t).length,p,h):(i.stepBackward(),new s(p,h,t,i.getCurrentTokenColumn()))},this.latexSection=function(e,t,n){var r=[\"\\\\subsection\",\"\\\\section\",\"\\\\begin\",\"\\\\end\"],i=new o(e,t,n),u=i.getCurrentToken();if(!u||u.type!=\"keyword\")return;var a=r.indexOf(u.value),f=0,l=t;while(u=i.stepForward()){if(u.type!==\"keyword\")continue;var c=r.indexOf(u.value);if(c>=2){f||(l=i.getCurrentTokenRow()-1),f+=c==2?1:-1;if(f<0)break}else if(c>=a)break}f||(l=i.getCurrentTokenRow()-1);while(l>t&&!/\\S/.test(e.getLine(l)))l--;return new s(t,e.getLine(t).length,l,e.getLine(l).length)}}.call(u.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-less.js",
    "content": "define(\"ace/mode/less\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/less_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./less_highlight_rules\").LessHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/css\").CssBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/less\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/less_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=i.arrayToMap(function(){var e=\"-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-\".split(\"|\"),t=\"appearance|background-clip|background-inline-policy|background-origin|background-size|binding|border-bottom-colors|border-left-colors|border-right-colors|border-top-colors|border-end|border-end-color|border-end-style|border-end-width|border-image|border-start|border-start-color|border-start-style|border-start-width|box-align|box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|box-pack|box-sizing|column-count|column-gap|column-width|column-rule|column-rule-width|column-rule-style|column-rule-color|float-edge|font-feature-settings|font-language-override|force-broken-image-icon|image-region|margin-end|margin-start|opacity|outline|outline-color|outline-offset|outline-radius|outline-radius-bottomleft|outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|outline-style|outline-width|padding-end|padding-start|stack-sizing|tab-size|text-blink|text-decoration-color|text-decoration-line|text-decoration-style|transform|transform-origin|transition|transition-delay|transition-duration|transition-property|transition-timing-function|user-focus|user-input|user-modify|user-select|window-shadow|border-radius\".split(\"|\"),n=\"azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index\".split(\"|\"),r=[];for(var i=0,s=e.length;i<s;i++)Array.prototype.push.apply(r,(e[i]+t.join(\"|\"+e[i])).split(\"|\"));return Array.prototype.push.apply(r,t),Array.prototype.push.apply(r,n),r}()),t=i.arrayToMap(\"hsl|hsla|rgb|rgba|url|attr|counter|counters|lighten|darken|saturate|desaturate|fadein|fadeout|fade|spin|mix|hue|saturation|lightness|alpha|round|ceil|floor|percentage|color|iscolor|isnumber|isstring|iskeyword|isurl|ispixel|ispercentage|isem\".split(\"|\")),n=i.arrayToMap(\"absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero\".split(\"|\")),r=i.arrayToMap(\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\".split(\"|\")),s=i.arrayToMap(\"@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare|when|not|and\".split(\"|\")),o=i.arrayToMap(\"a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp\".split(\"|\")),u=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:u+\"(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:\"constant.numeric\",regex:u},{token:function(e){return s.hasOwnProperty(e)?\"keyword\":\"variable\"},regex:\"@[a-z0-9_\\\\-@]*\\\\b\"},{token:function(i){return e.hasOwnProperty(i.toLowerCase())?\"support.type\":s.hasOwnProperty(i)?\"keyword\":n.hasOwnProperty(i)?\"constant.language\":t.hasOwnProperty(i)?\"support.function\":r.hasOwnProperty(i.toLowerCase())?\"support.constant.color\":o.hasOwnProperty(i.toLowerCase())?\"variable.language\":\"text\"},regex:\"\\\\-?[@a-z_][@a-z0-9_\\\\-]*\"},{token:\"variable.language\",regex:\"#[a-z0-9-_]+\"},{token:\"variable.language\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"variable.language\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{token:\"keyword.operator\",regex:\"<|>|<=|>=|==|!=|-|%|#|\\\\+|\\\\$|\\\\+|\\\\*\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]}};r.inherits(o,s),t.LessHighlightRules=o}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-liquid.js",
    "content": "define(\"ace/mode/liquid\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/liquid_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./liquid_highlight_rules\").LiquidHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=function(){this.HighlightRules=s,this.$outdent=new o};r.inherits(a,i),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/liquid\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/liquid_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./html_highlight_rules\").HtmlHighlightRules,o=function(){s.call(this);var e=\"date|capitalize|downcase|upcase|first|last|join|sort|map|size|escape|escape_once|strip_html|strip_newlines|newline_to_br|replace|replace_first|truncate|truncatewords|prepend|append|minus|plus|times|divided_by|split\",t=\"capture|endcapture|case|endcase|when|comment|endcomment|cycle|for|endfor|in|reversed|if|endif|else|elsif|include|endinclude|unless|endunless|style|text|image|widget|plugin|marker|endmarker|tablerow|endtablerow\",n=\"forloop|tablerowloop\",r=\"assign\",i=this.createKeywordMapper({\"variable.language\":n,keyword:t,\"support.function\":e,\"keyword.definition\":r},\"identifier\");for(var o in this.$rules)this.$rules[o].unshift({token:\"variable\",regex:\"{%\",push:\"liquid-start\"},{token:\"variable\",regex:\"{{\",push:\"liquid-start\"});this.addRules({\"liquid-start\":[{token:\"variable\",regex:\"}}\",next:\"pop\"},{token:\"variable\",regex:\"%}\",next:\"pop\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"/|\\\\*|\\\\-|\\\\+|=|!=|\\\\?\\\\:\"},{token:\"paren.lparen\",regex:/[\\[\\({]/},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"text\",regex:\"\\\\s+\"}]}),this.normalizeRules()};r.inherits(o,i),t.LiquidHighlightRules=o}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-lisp.js",
    "content": "define(\"ace/mode/lisp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/lisp_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./lisp_highlight_rules\").LispHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart=\";\",this.$id=\"ace/mode/lisp\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/lisp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"case|do|let|loop|if|else|when\",t=\"eq|neq|and|or\",n=\"null|nil\",r=\"cons|car|cdr|cond|lambda|format|setq|setf|quote|eval|append|list|listp|memberp|t|load|progn\",i=this.createKeywordMapper({\"keyword.control\":e,\"keyword.operator\":t,\"constant.language\":n,\"support.function\":r},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\";.*$\"},{token:[\"storage.type.function-type.lisp\",\"text\",\"entity.name.function.lisp\"],regex:\"(?:\\\\b(?:(defun|defmethod|defmacro))\\\\b)(\\\\s+)((?:\\\\w|\\\\-|\\\\!|\\\\?)*)\"},{token:[\"punctuation.definition.constant.character.lisp\",\"constant.character.lisp\"],regex:\"(#)((?:\\\\w|[\\\\\\\\+-=<>'\\\"&#])+)\"},{token:[\"punctuation.definition.variable.lisp\",\"variable.other.global.lisp\",\"punctuation.definition.variable.lisp\"],regex:\"(\\\\*)(\\\\S*)(\\\\*)\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"}],qqstring:[{token:\"constant.character.escape.lisp\",regex:\"\\\\\\\\.\"},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"start\"}]}};r.inherits(s,i),t.LispHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-livescript.js",
    "content": "define(\"ace/mode/livescript\",[\"require\",\"exports\",\"module\",\"ace/tokenizer\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/text\"],function(e,t,n){function u(e,t){function n(){}return n.prototype=(e.superclass=t).prototype,(e.prototype=new n).constructor=e,typeof t.extended==\"function\"&&t.extended(e),e}function a(e,t){var n={}.hasOwnProperty;for(var r in t)n.call(t,r)&&(e[r]=t[r]);return e}var r,i,s,o;r=\"(?![\\\\d\\\\s])[$\\\\w\\\\xAA-\\\\uFFDC](?:(?!\\\\s)[$\\\\w\\\\xAA-\\\\uFFDC]|-[A-Za-z])*\",t.Mode=i=function(t){function o(){var t;this.$tokenizer=new(e(\"../tokenizer\").Tokenizer)(o.Rules);if(t=e(\"../mode/matching_brace_outdent\"))this.$outdent=new t.MatchingBraceOutdent;this.$id=\"ace/mode/livescript\"}var n,i=u((a(o,t).displayName=\"LiveScriptMode\",o),t).prototype,s=o;return n=RegExp(\"(?:[({[=:]|[-~]>|\\\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\\\s*all)?|const|var|let|new|catch(?:\\\\s*\"+r+\")?))\\\\s*$\"),i.getNextLineIndent=function(e,t,r){var i,s;return i=this.$getIndent(t),s=this.$tokenizer.getLineTokens(t,e).tokens,(!s.length||s[s.length-1].type!==\"comment\")&&e===\"start\"&&n.test(t)&&(i+=r),i},i.toggleCommentLines=function(t,n,r,i){var s,o,u,a,f,l;s=/^(\\s*)#/,o=new(e(\"../range\").Range)(0,0,0,0);for(u=r;u<=i;++u)a=u,(f=s.test(l=n.getLine(a)))?l=l.replace(s,\"$1\"):l=l.replace(/^\\s*/,\"$&#\"),o.end.row=o.start.row=a,o.end.column=l.length+1,n.replace(o,l);return 1-f*2},i.checkOutdent=function(e,t,n){var r;return(r=this.$outdent)!=null?r.checkOutdent(t,n):void 8},i.autoOutdent=function(e,t,n){var r;return(r=this.$outdent)!=null?r.autoOutdent(t,n):void 8},o}(e(\"../mode/text\").Mode),s=\"(?![$\\\\w]|-[A-Za-z]|\\\\s*:(?![:=]))\",o={token:\"string\",regex:\".+\"},i.Rules={start:[{token:\"keyword\",regex:\"(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)\"+s},{token:\"constant.language\",regex:\"(?:true|false|yes|no|on|off|null|void|undefined)\"+s},{token:\"invalid.illegal\",regex:\"(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)\"+s},{token:\"language.support.class\",regex:\"(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)\"+s},{token:\"language.support.function\",regex:\"(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)\"+s},{token:\"variable.language\",regex:\"(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)\"+s},{token:\"identifier\",regex:r+\"\\\\s*:(?![:=])\"},{token:\"variable\",regex:r},{token:\"keyword.operator\",regex:\"(?:\\\\.{3}|\\\\s+\\\\?)\"},{token:\"keyword.variable\",regex:\"(?:@+|::|\\\\.\\\\.)\",next:\"key\"},{token:\"keyword.operator\",regex:\"\\\\.\\\\s*\",next:\"key\"},{token:\"string\",regex:\"\\\\\\\\\\\\S[^\\\\s,;)}\\\\]]*\"},{token:\"string.doc\",regex:\"'''\",next:\"qdoc\"},{token:\"string.doc\",regex:'\"\"\"',next:\"qqdoc\"},{token:\"string\",regex:\"'\",next:\"qstring\"},{token:\"string\",regex:'\"',next:\"qqstring\"},{token:\"string\",regex:\"`\",next:\"js\"},{token:\"string\",regex:\"<\\\\[\",next:\"words\"},{token:\"string.regex\",regex:\"//\",next:\"heregex\"},{token:\"comment.doc\",regex:\"/\\\\*\",next:\"comment\"},{token:\"comment\",regex:\"#.*\"},{token:\"string.regex\",regex:\"\\\\/(?:[^[\\\\/\\\\n\\\\\\\\]*(?:(?:\\\\\\\\.|\\\\[[^\\\\]\\\\n\\\\\\\\]*(?:\\\\\\\\.[^\\\\]\\\\n\\\\\\\\]*)*\\\\])[^[\\\\/\\\\n\\\\\\\\]*)*)\\\\/[gimy$]{0,4}\",next:\"key\"},{token:\"constant.numeric\",regex:\"(?:0x[\\\\da-fA-F][\\\\da-fA-F_]*|(?:[2-9]|[12]\\\\d|3[0-6])r[\\\\da-zA-Z][\\\\da-zA-Z_]*|(?:\\\\d[\\\\d_]*(?:\\\\.\\\\d[\\\\d_]*)?|\\\\.\\\\d[\\\\d_]*)(?:e[+-]?\\\\d[\\\\d_]*)?[\\\\w$]*)\"},{token:\"lparen\",regex:\"[({[]\"},{token:\"rparen\",regex:\"[)}\\\\]]\",next:\"key\"},{token:\"keyword.operator\",regex:\"\\\\S+\"},{token:\"text\",regex:\"\\\\s+\"}],heregex:[{token:\"string.regex\",regex:\".*?//[gimy$?]{0,4}\",next:\"start\"},{token:\"string.regex\",regex:\"\\\\s*#{\"},{token:\"comment.regex\",regex:\"\\\\s+(?:#.*)?\"},{token:\"string.regex\",regex:\"\\\\S+\"}],key:[{token:\"keyword.operator\",regex:\"[.?@!]+\"},{token:\"identifier\",regex:r,next:\"start\"},{token:\"text\",regex:\".\",next:\"start\"}],comment:[{token:\"comment.doc\",regex:\".*?\\\\*/\",next:\"start\"},{token:\"comment.doc\",regex:\".+\"}],qdoc:[{token:\"string\",regex:\".*?'''\",next:\"key\"},o],qqdoc:[{token:\"string\",regex:'.*?\"\"\"',next:\"key\"},o],qstring:[{token:\"string\",regex:\"[^\\\\\\\\']*(?:\\\\\\\\.[^\\\\\\\\']*)*'\",next:\"key\"},o],qqstring:[{token:\"string\",regex:'[^\\\\\\\\\"]*(?:\\\\\\\\.[^\\\\\\\\\"]*)*\"',next:\"key\"},o],js:[{token:\"string\",regex:\"[^\\\\\\\\`]*(?:\\\\\\\\.[^\\\\\\\\`]*)*`\",next:\"key\"},o],words:[{token:\"string\",regex:\".*?\\\\]>\",next:\"key\"},o]}}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-logiql.js",
    "content": "define(\"ace/mode/logiql\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/logiql_highlight_rules\",\"ace/mode/folding/coffee\",\"ace/token_iterator\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./logiql_highlight_rules\").LogiQLHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=e(\"../token_iterator\").TokenIterator,a=e(\"../range\").Range,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./matching_brace_outdent\").MatchingBraceOutdent,c=function(){this.HighlightRules=s,this.foldingRules=new o,this.$outdent=new l,this.$behaviour=new f};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(/comment|string/.test(o))return r;if(s.length&&s[s.length-1].type==\"comment.single\")return r;var u=t.match();return/(-->|<--|<-|->|{)\\s*$/.test(t)&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)?!0:n!==\"\\n\"&&n!==\"\\r\\n\"?!1:/^\\s+/.test(t)?!0:!1},this.autoOutdent=function(e,t,n){if(this.$outdent.autoOutdent(t,n))return;var r=t.getLine(n),i=r.match(/^\\s+/),s=r.lastIndexOf(\".\")+1;if(!i||!n||!s)return 0;var o=t.getLine(n+1),u=this.getMatching(t,{row:n,column:s});if(!u||u.start.row==n)return 0;s=i[0].length;var f=this.$getIndent(t.getLine(u.start.row));t.replace(new a(n+1,0,n+1,s),f)},this.getMatching=function(e,t,n){t==undefined&&(t=e.selection.lead),typeof t==\"object\"&&(n=t.column,t=t.row);var r=e.getTokenAt(t,n),i=\"keyword.start\",s=\"keyword.end\",o;if(!r)return;if(r.type==i){var f=new u(e,t,n);f.step=f.stepForward}else{if(r.type!=s)return;var f=new u(e,t,n);f.step=f.stepBackward}while(o=f.step())if(o.type==i||o.type==s)break;if(!o||o.type==r.type)return;var l=f.getCurrentTokenColumn(),t=f.getCurrentTokenRow();return new a(t,l,t,l+o.value.length)},this.$id=\"ace/mode/logiql\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/logiql_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.block\",regex:\"/\\\\*\",push:[{token:\"comment.block\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block\"}]},{token:\"comment.single\",regex:\"//.*\"},{token:\"constant.numeric\",regex:\"\\\\d+(?:\\\\.\\\\d+)?(?:[eE][+-]?\\\\d+)?[fd]?\"},{token:\"string\",regex:'\"',push:[{token:\"string\",regex:'\"',next:\"pop\"},{defaultToken:\"string\"}]},{token:\"constant.language\",regex:\"\\\\b(true|false)\\\\b\"},{token:\"entity.name.type.logicblox\",regex:\"`[a-zA-Z_:]+(\\\\d|\\\\a)*\\\\b\"},{token:\"keyword.start\",regex:\"->\",comment:\"Constraint\"},{token:\"keyword.start\",regex:\"-->\",comment:\"Level 1 Constraint\"},{token:\"keyword.start\",regex:\"<-\",comment:\"Rule\"},{token:\"keyword.start\",regex:\"<--\",comment:\"Level 1 Rule\"},{token:\"keyword.end\",regex:\"\\\\.\",comment:\"Terminator\"},{token:\"keyword.other\",regex:\"!\",comment:\"Negation\"},{token:\"keyword.other\",regex:\",\",comment:\"Conjunction\"},{token:\"keyword.other\",regex:\";\",comment:\"Disjunction\"},{token:\"keyword.operator\",regex:\"<=|>=|!=|<|>\",comment:\"Equality\"},{token:\"keyword.other\",regex:\"@\",comment:\"Equality\"},{token:\"keyword.operator\",regex:\"\\\\+|-|\\\\*|/\",comment:\"Arithmetic operations\"},{token:\"keyword\",regex:\"::\",comment:\"Colon colon\"},{token:\"support.function\",regex:\"\\\\b(agg\\\\s*<<)\",push:[{include:\"$self\"},{token:\"support.function\",regex:\">>\",next:\"pop\"}]},{token:\"storage.modifier\",regex:\"\\\\b(lang:[\\\\w:]*)\"},{token:[\"storage.type\",\"text\"],regex:\"(export|sealed|clauses|block|alias|alias_all)(\\\\s*\\\\()(?=`)\"},{token:\"entity.name\",regex:\"[a-zA-Z_][a-zA-Z_0-9:]*(@prev|@init|@final)?(?=(\\\\(|\\\\[))\"},{token:\"variable.parameter\",regex:\"([a-zA-Z][a-zA-Z_0-9]*|_)\\\\s*(?=(,|\\\\.|<-|->|\\\\)|\\\\]|=))\"}]},this.normalizeRules()};r.inherits(s,i),t.LogiQLHighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-lsl.js",
    "content": "define(\"ace/mode/lsl\",[\"require\",\"exports\",\"module\",\"ace/mode/lsl_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/text\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\",\"ace/lib/oop\"],function(e,t,n){var r=e(\"./lsl_highlight_rules\").LSLHighlightRules,i=e(\"./matching_brace_outdent\").MatchingBraceOutdent,s=e(\"../range\").Range,o=e(\"./text\").Mode,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=e(\"../lib/oop\"),l=function(){this.HighlightRules=r,this.$outdent=new i,this.$behaviour=new u,this.foldingRules=new a};f.inherits(l,o),function(){this.lineCommentStart=[\"//\"],this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type===\"comment.block.lsl\")return r;if(e===\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/lsl\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/lsl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){function s(){var e=this.createKeywordMapper({\"constant.language.float.lsl\":\"DEG_TO_RAD|PI|PI_BY_TWO|RAD_TO_DEG|SQRT2|TWO_PI\",\"constant.language.integer.lsl\":\"ACTIVE|AGENT|AGENT_ALWAYS_RUN|AGENT_ATTACHMENTS|AGENT_AUTOPILOT|AGENT_AWAY|AGENT_BUSY|AGENT_BY_LEGACY_NAME|AGENT_BY_USERNAME|AGENT_CROUCHING|AGENT_FLYING|AGENT_IN_AIR|AGENT_LIST_PARCEL|AGENT_LIST_PARCEL_OWNER|AGENT_LIST_REGION|AGENT_MOUSELOOK|AGENT_ON_OBJECT|AGENT_SCRIPTED|AGENT_SITTING|AGENT_TYPING|AGENT_WALKING|ALL_SIDES|ANIM_ON|ATTACH_AVATAR_CENTER|ATTACH_BACK|ATTACH_BELLY|ATTACH_CHEST|ATTACH_CHIN|ATTACH_HEAD|ATTACH_HUD_BOTTOM|ATTACH_HUD_BOTTOM_LEFT|ATTACH_HUD_BOTTOM_RIGHT|ATTACH_HUD_CENTER_1|ATTACH_HUD_CENTER_2|ATTACH_HUD_TOP_CENTER|ATTACH_HUD_TOP_LEFT|ATTACH_HUD_TOP_RIGHT|ATTACH_LEAR|ATTACH_LEFT_PEC|ATTACH_LEYE|ATTACH_LFOOT|ATTACH_LHAND|ATTACH_LHIP|ATTACH_LLARM|ATTACH_LLLEG|ATTACH_LSHOULDER|ATTACH_LUARM|ATTACH_LULEG|ATTACH_MOUTH|ATTACH_NECK|ATTACH_NOSE|ATTACH_PELVIS|ATTACH_REAR|ATTACH_REYE|ATTACH_RFOOT|ATTACH_RHAND|ATTACH_RHIP|ATTACH_RIGHT_PEC|ATTACH_RLARM|ATTACH_RLLEG|ATTACH_RSHOULDER|ATTACH_RUARM|ATTACH_RULEG|AVOID_CHARACTERS|AVOID_DYNAMIC_OBSTACLES|AVOID_NONE|CAMERA_ACTIVE|CAMERA_BEHINDNESS_ANGLE|CAMERA_BEHINDNESS_LAG|CAMERA_DISTANCE|CAMERA_FOCUS|CAMERA_FOCUS_LAG|CAMERA_FOCUS_LOCKED|CAMERA_FOCUS_OFFSET|CAMERA_FOCUS_THRESHOLD|CAMERA_PITCH|CAMERA_POSITION|CAMERA_POSITION_LAG|CAMERA_POSITION_LOCKED|CAMERA_POSITION_THRESHOLD|CHANGED_ALLOWED_DROP|CHANGED_COLOR|CHANGED_INVENTORY|CHANGED_LINK|CHANGED_MEDIA|CHANGED_OWNER|CHANGED_REGION|CHANGED_REGION_START|CHANGED_SCALE|CHANGED_SHAPE|CHANGED_TELEPORT|CHANGED_TEXTURE|CHARACTER_ACCOUNT_FOR_SKIPPED_FRAMES|CHARACTER_AVOIDANCE_MODE|CHARACTER_CMD_JUMP|CHARACTER_CMD_SMOOTH_STOP|CHARACTER_CMD_STOP|CHARACTER_DESIRED_SPEED|CHARACTER_DESIRED_TURN_SPEED|CHARACTER_LENGTH|CHARACTER_MAX_ACCEL|CHARACTER_MAX_DECEL|CHARACTER_MAX_SPEED|CHARACTER_MAX_TURN_RADIUS|CHARACTER_ORIENTATION|CHARACTER_RADIUS|CHARACTER_STAY_WITHIN_PARCEL|CHARACTER_TYPE|CHARACTER_TYPE_A|CHARACTER_TYPE_B|CHARACTER_TYPE_C|CHARACTER_TYPE_D|CHARACTER_TYPE_NONE|CLICK_ACTION_BUY|CLICK_ACTION_NONE|CLICK_ACTION_OPEN|CLICK_ACTION_OPEN_MEDIA|CLICK_ACTION_PAY|CLICK_ACTION_PLAY|CLICK_ACTION_SIT|CLICK_ACTION_TOUCH|CONTENT_TYPE_ATOM|CONTENT_TYPE_FORM|CONTENT_TYPE_HTML|CONTENT_TYPE_JSON|CONTENT_TYPE_LLSD|CONTENT_TYPE_RSS|CONTENT_TYPE_TEXT|CONTENT_TYPE_XHTML|CONTENT_TYPE_XML|CONTROL_BACK|CONTROL_DOWN|CONTROL_FWD|CONTROL_LBUTTON|CONTROL_LEFT|CONTROL_ML_LBUTTON|CONTROL_RIGHT|CONTROL_ROT_LEFT|CONTROL_ROT_RIGHT|CONTROL_UP|DATA_BORN|DATA_NAME|DATA_ONLINE|DATA_PAYINFO|DATA_SIM_POS|DATA_SIM_RATING|DATA_SIM_STATUS|DEBUG_CHANNEL|DENSITY|ERR_GENERIC|ERR_MALFORMED_PARAMS|ERR_PARCEL_PERMISSIONS|ERR_RUNTIME_PERMISSIONS|ERR_THROTTLED|ESTATE_ACCESS_ALLOWED_AGENT_ADD|ESTATE_ACCESS_ALLOWED_AGENT_REMOVE|ESTATE_ACCESS_ALLOWED_GROUP_ADD|ESTATE_ACCESS_ALLOWED_GROUP_REMOVE|ESTATE_ACCESS_BANNED_AGENT_ADD|ESTATE_ACCESS_BANNED_AGENT_REMOVE|FALSE|FORCE_DIRECT_PATH|FRICTION|GCNP_RADIUS|GCNP_STATIC|GRAVITY_MULTIPLIER|HORIZONTAL|HTTP_BODY_MAXLENGTH|HTTP_BODY_TRUNCATED|HTTP_CUSTOM_HEADER|HTTP_METHOD|HTTP_MIMETYPE|HTTP_PRAGMA_NO_CACHE|HTTP_VERBOSE_THROTTLE|HTTP_VERIFY_CERT|INVENTORY_ALL|INVENTORY_ANIMATION|INVENTORY_BODYPART|INVENTORY_CLOTHING|INVENTORY_GESTURE|INVENTORY_LANDMARK|INVENTORY_NONE|INVENTORY_NOTECARD|INVENTORY_OBJECT|INVENTORY_SCRIPT|INVENTORY_SOUND|INVENTORY_TEXTURE|JSON_APPEND|KFM_CMD_PAUSE|KFM_CMD_PLAY|KFM_CMD_SET_MODE|KFM_CMD_STOP|KFM_COMMAND|KFM_DATA|KFM_FORWARD|KFM_LOOP|KFM_MODE|KFM_PING_PONG|KFM_REVERSE|KFM_ROTATION|KFM_TRANSLATION|LAND_LEVEL|LAND_LOWER|LAND_NOISE|LAND_RAISE|LAND_REVERT|LAND_SMOOTH|LINK_ALL_CHILDREN|LINK_ALL_OTHERS|LINK_ROOT|LINK_SET|LINK_THIS|LIST_STAT_GEOMETRIC_MEAN|LIST_STAT_MAX|LIST_STAT_MEAN|LIST_STAT_MEDIAN|LIST_STAT_MIN|LIST_STAT_NUM_COUNT|LIST_STAT_RANGE|LIST_STAT_STD_DEV|LIST_STAT_SUM|LIST_STAT_SUM_SQUARES|LOOP|MASK_BASE|MASK_EVERYONE|MASK_GROUP|MASK_NEXT|MASK_OWNER|OBJECT_ATTACHED_POINT|OBJECT_CHARACTER_TIME|OBJECT_CREATOR|OBJECT_DESC|OBJECT_GROUP|OBJECT_NAME|OBJECT_OWNER|OBJECT_PATHFINDING_TYPE|OBJECT_PHANTOM|OBJECT_PHYSICS|OBJECT_PHYSICS_COST|OBJECT_POS|OBJECT_PRIM_EQUIVALENCE|OBJECT_RENDER_WEIGHT|OBJECT_RETURN_PARCEL|OBJECT_RETURN_PARCEL_OWNER|OBJECT_RETURN_REGION|OBJECT_ROOT|OBJECT_ROT|OBJECT_RUNNING_SCRIPT_COUNT|OBJECT_SCRIPT_MEMORY|OBJECT_SCRIPT_TIME|OBJECT_SERVER_COST|OBJECT_STREAMING_COST|OBJECT_TEMP_ON_REZ|OBJECT_TOTAL_SCRIPT_COUNT|OBJECT_UNKNOWN_DETAIL|OBJECT_VELOCITY|OPT_AVATAR|OPT_CHARACTER|OPT_EXCLUSION_VOLUME|OPT_LEGACY_LINKSET|OPT_MATERIAL_VOLUME|OPT_OTHER|OPT_STATIC_OBSTACLE|OPT_WALKABLE|PARCEL_COUNT_GROUP|PARCEL_COUNT_OTHER|PARCEL_COUNT_OWNER|PARCEL_COUNT_SELECTED|PARCEL_COUNT_TEMP|PARCEL_COUNT_TOTAL|PARCEL_DETAILS_AREA|PARCEL_DETAILS_DESC|PARCEL_DETAILS_GROUP|PARCEL_DETAILS_ID|PARCEL_DETAILS_NAME|PARCEL_DETAILS_OWNER|PARCEL_DETAILS_SEE_AVATARS|PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS|PARCEL_FLAG_ALLOW_CREATE_OBJECTS|PARCEL_FLAG_ALLOW_DAMAGE|PARCEL_FLAG_ALLOW_FLY|PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY|PARCEL_FLAG_ALLOW_GROUP_SCRIPTS|PARCEL_FLAG_ALLOW_LANDMARK|PARCEL_FLAG_ALLOW_SCRIPTS|PARCEL_FLAG_ALLOW_TERRAFORM|PARCEL_FLAG_LOCAL_SOUND_ONLY|PARCEL_FLAG_RESTRICT_PUSHOBJECT|PARCEL_FLAG_USE_ACCESS_GROUP|PARCEL_FLAG_USE_ACCESS_LIST|PARCEL_FLAG_USE_BAN_LIST|PARCEL_FLAG_USE_LAND_PASS_LIST|PARCEL_MEDIA_COMMAND_AGENT|PARCEL_MEDIA_COMMAND_AUTO_ALIGN|PARCEL_MEDIA_COMMAND_DESC|PARCEL_MEDIA_COMMAND_LOOP|PARCEL_MEDIA_COMMAND_LOOP_SET|PARCEL_MEDIA_COMMAND_PAUSE|PARCEL_MEDIA_COMMAND_PLAY|PARCEL_MEDIA_COMMAND_SIZE|PARCEL_MEDIA_COMMAND_STOP|PARCEL_MEDIA_COMMAND_TEXTURE|PARCEL_MEDIA_COMMAND_TIME|PARCEL_MEDIA_COMMAND_TYPE|PARCEL_MEDIA_COMMAND_UNLOAD|PARCEL_MEDIA_COMMAND_URL|PASSIVE|PATROL_PAUSE_AT_WAYPOINTS|PAYMENT_INFO_ON_FILE|PAYMENT_INFO_USED|PAY_DEFAULT|PAY_HIDE|PERMISSION_ATTACH|PERMISSION_CHANGE_LINKS|PERMISSION_CONTROL_CAMERA|PERMISSION_DEBIT|PERMISSION_OVERRIDE_ANIMATIONS|PERMISSION_RETURN_OBJECTS|PERMISSION_SILENT_ESTATE_MANAGEMENT|PERMISSION_TAKE_CONTROLS|PERMISSION_TELEPORT|PERMISSION_TRACK_CAMERA|PERMISSION_TRIGGER_ANIMATION|PERM_ALL|PERM_COPY|PERM_MODIFY|PERM_MOVE|PERM_TRANSFER|PING_PONG|PRIM_BUMP_BARK|PRIM_BUMP_BLOBS|PRIM_BUMP_BRICKS|PRIM_BUMP_BRIGHT|PRIM_BUMP_CHECKER|PRIM_BUMP_CONCRETE|PRIM_BUMP_DARK|PRIM_BUMP_DISKS|PRIM_BUMP_GRAVEL|PRIM_BUMP_LARGETILE|PRIM_BUMP_NONE|PRIM_BUMP_SHINY|PRIM_BUMP_SIDING|PRIM_BUMP_STONE|PRIM_BUMP_STUCCO|PRIM_BUMP_SUCTION|PRIM_BUMP_TILE|PRIM_BUMP_WEAVE|PRIM_BUMP_WOOD|PRIM_COLOR|PRIM_DESC|PRIM_FLEXIBLE|PRIM_FULLBRIGHT|PRIM_GLOW|PRIM_HOLE_CIRCLE|PRIM_HOLE_DEFAULT|PRIM_HOLE_SQUARE|PRIM_HOLE_TRIANGLE|PRIM_LINK_TARGET|PRIM_MATERIAL|PRIM_MATERIAL_FLESH|PRIM_MATERIAL_GLASS|PRIM_MATERIAL_METAL|PRIM_MATERIAL_PLASTIC|PRIM_MATERIAL_RUBBER|PRIM_MATERIAL_STONE|PRIM_MATERIAL_WOOD|PRIM_MEDIA_ALT_IMAGE_ENABLE|PRIM_MEDIA_AUTO_LOOP|PRIM_MEDIA_AUTO_PLAY|PRIM_MEDIA_AUTO_SCALE|PRIM_MEDIA_AUTO_ZOOM|PRIM_MEDIA_CONTROLS|PRIM_MEDIA_CONTROLS_MINI|PRIM_MEDIA_CONTROLS_STANDARD|PRIM_MEDIA_CURRENT_URL|PRIM_MEDIA_FIRST_CLICK_INTERACT|PRIM_MEDIA_HEIGHT_PIXELS|PRIM_MEDIA_HOME_URL|PRIM_MEDIA_MAX_HEIGHT_PIXELS|PRIM_MEDIA_MAX_URL_LENGTH|PRIM_MEDIA_MAX_WHITELIST_COUNT|PRIM_MEDIA_MAX_WHITELIST_SIZE|PRIM_MEDIA_MAX_WIDTH_PIXELS|PRIM_MEDIA_PARAM_MAX|PRIM_MEDIA_PERMS_CONTROL|PRIM_MEDIA_PERMS_INTERACT|PRIM_MEDIA_PERM_ANYONE|PRIM_MEDIA_PERM_GROUP|PRIM_MEDIA_PERM_NONE|PRIM_MEDIA_PERM_OWNER|PRIM_MEDIA_WHITELIST|PRIM_MEDIA_WHITELIST_ENABLE|PRIM_MEDIA_WIDTH_PIXELS|PRIM_NAME|PRIM_OMEGA|PRIM_PHANTOM|PRIM_PHYSICS|PRIM_PHYSICS_SHAPE_CONVEX|PRIM_PHYSICS_SHAPE_NONE|PRIM_PHYSICS_SHAPE_PRIM|PRIM_PHYSICS_SHAPE_TYPE|PRIM_POINT_LIGHT|PRIM_POSITION|PRIM_POS_LOCAL|PRIM_ROTATION|PRIM_ROT_LOCAL|PRIM_SCULPT_FLAG_INVERT|PRIM_SCULPT_FLAG_MIRROR|PRIM_SCULPT_TYPE_CYLINDER|PRIM_SCULPT_TYPE_MASK|PRIM_SCULPT_TYPE_PLANE|PRIM_SCULPT_TYPE_SPHERE|PRIM_SCULPT_TYPE_TORUS|PRIM_SHINY_HIGH|PRIM_SHINY_LOW|PRIM_SHINY_MEDIUM|PRIM_SHINY_NONE|PRIM_SIZE|PRIM_SLICE|PRIM_TEMP_ON_REZ|PRIM_TEXGEN|PRIM_TEXGEN_DEFAULT|PRIM_TEXGEN_PLANAR|PRIM_TEXT|PRIM_TEXTURE|PRIM_TYPE|PRIM_TYPE_BOX|PRIM_TYPE_CYLINDER|PRIM_TYPE_PRISM|PRIM_TYPE_RING|PRIM_TYPE_SCULPT|PRIM_TYPE_SPHERE|PRIM_TYPE_TORUS|PRIM_TYPE_TUBE|PROFILE_NONE|PROFILE_SCRIPT_MEMORY|PSYS_PART_BF_DEST_COLOR|PSYS_PART_BF_ONE|PSYS_PART_BF_ONE_MINUS_DEST_COLOR|PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA|PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR|PSYS_PART_BF_SOURCE_ALPHA|PSYS_PART_BF_SOURCE_COLOR|PSYS_PART_BF_ZERO|PSYS_PART_BLEND_FUNC_DEST|PSYS_PART_BLEND_FUNC_SOURCE|PSYS_PART_BOUNCE_MASK|PSYS_PART_EMISSIVE_MASK|PSYS_PART_END_ALPHA|PSYS_PART_END_COLOR|PSYS_PART_END_GLOW|PSYS_PART_END_SCALE|PSYS_PART_FLAGS|PSYS_PART_FOLLOW_SRC_MASK|PSYS_PART_FOLLOW_VELOCITY_MASK|PSYS_PART_INTERP_COLOR_MASK|PSYS_PART_INTERP_SCALE_MASK|PSYS_PART_MAX_AGE|PSYS_PART_RIBBON_MASK|PSYS_PART_START_ALPHA|PSYS_PART_START_COLOR|PSYS_PART_START_GLOW|PSYS_PART_START_SCALE|PSYS_PART_TARGET_LINEAR_MASK|PSYS_PART_TARGET_POS_MASK|PSYS_PART_WIND_MASK|PSYS_SRC_ACCEL|PSYS_SRC_ANGLE_BEGIN|PSYS_SRC_ANGLE_END|PSYS_SRC_BURST_PART_COUNT|PSYS_SRC_BURST_RADIUS|PSYS_SRC_BURST_RATE|PSYS_SRC_BURST_SPEED_MAX|PSYS_SRC_BURST_SPEED_MIN|PSYS_SRC_MAX_AGE|PSYS_SRC_OMEGA|PSYS_SRC_PATTERN|PSYS_SRC_PATTERN_ANGLE|PSYS_SRC_PATTERN_ANGLE_CONE|PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY|PSYS_SRC_PATTERN_DROP|PSYS_SRC_PATTERN_EXPLODE|PSYS_SRC_TARGET_KEY|PSYS_SRC_TEXTURE|PUBLIC_CHANNEL|PURSUIT_FUZZ_FACTOR|PURSUIT_GOAL_TOLERANCE|PURSUIT_INTERCEPT|PURSUIT_OFFSET|PU_EVADE_HIDDEN|PU_EVADE_SPOTTED|PU_FAILURE_DYNAMIC_PATHFINDING_DISABLED|PU_FAILURE_INVALID_GOAL|PU_FAILURE_INVALID_START|PU_FAILURE_NO_NAVMESH|PU_FAILURE_NO_VALID_DESTINATION|PU_FAILURE_OTHER|PU_FAILURE_PARCEL_UNREACHABLE|PU_FAILURE_TARGET_GONE|PU_FAILURE_UNREACHABLE|PU_GOAL_REACHED|PU_SLOWDOWN_DISTANCE_REACHED|RCERR_CAST_TIME_EXCEEDED|RCERR_SIM_PERF_LOW|RCERR_UNKNOWN|RC_DATA_FLAGS|RC_DETECT_PHANTOM|RC_GET_LINK_NUM|RC_GET_NORMAL|RC_GET_ROOT_KEY|RC_MAX_HITS|RC_REJECT_AGENTS|RC_REJECT_LAND|RC_REJECT_NONPHYSICAL|RC_REJECT_PHYSICAL|RC_REJECT_TYPES|REGION_FLAG_ALLOW_DAMAGE|REGION_FLAG_ALLOW_DIRECT_TELEPORT|REGION_FLAG_BLOCK_FLY|REGION_FLAG_BLOCK_TERRAFORM|REGION_FLAG_DISABLE_COLLISIONS|REGION_FLAG_DISABLE_PHYSICS|REGION_FLAG_FIXED_SUN|REGION_FLAG_RESTRICT_PUSHOBJECT|REGION_FLAG_SANDBOX|REMOTE_DATA_CHANNEL|REMOTE_DATA_REPLY|REMOTE_DATA_REQUEST|REQUIRE_LINE_OF_SIGHT|RESTITUTION|REVERSE|ROTATE|SCALE|SCRIPTED|SIM_STAT_PCT_CHARS_STEPPED|SMOOTH|STATUS_BLOCK_GRAB|STATUS_BLOCK_GRAB_OBJECT|STATUS_BOUNDS_ERROR|STATUS_CAST_SHADOWS|STATUS_DIE_AT_EDGE|STATUS_INTERNAL_ERROR|STATUS_MALFORMED_PARAMS|STATUS_NOT_FOUND|STATUS_NOT_SUPPORTED|STATUS_OK|STATUS_PHANTOM|STATUS_PHYSICS|STATUS_RETURN_AT_EDGE|STATUS_ROTATE_X|STATUS_ROTATE_Y|STATUS_ROTATE_Z|STATUS_SANDBOX|STATUS_TYPE_MISMATCH|STATUS_WHITELIST_FAILED|STRING_TRIM|STRING_TRIM_HEAD|STRING_TRIM_TAIL|TOUCH_INVALID_FACE|TRAVERSAL_TYPE|TRAVERSAL_TYPE_FAST|TRAVERSAL_TYPE_NONE|TRAVERSAL_TYPE_SLOW|TRUE|TYPE_FLOAT|TYPE_INTEGER|TYPE_INVALID|TYPE_KEY|TYPE_ROTATION|TYPE_STRING|TYPE_VECTOR|VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY|VEHICLE_ANGULAR_DEFLECTION_TIMESCALE|VEHICLE_ANGULAR_FRICTION_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE|VEHICLE_ANGULAR_MOTOR_DIRECTION|VEHICLE_ANGULAR_MOTOR_TIMESCALE|VEHICLE_BANKING_EFFICIENCY|VEHICLE_BANKING_MIX|VEHICLE_BANKING_TIMESCALE|VEHICLE_BUOYANCY|VEHICLE_FLAG_CAMERA_DECOUPLED|VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT|VEHICLE_FLAG_HOVER_TERRAIN_ONLY|VEHICLE_FLAG_HOVER_UP_ONLY|VEHICLE_FLAG_HOVER_WATER_ONLY|VEHICLE_FLAG_LIMIT_MOTOR_UP|VEHICLE_FLAG_LIMIT_ROLL_ONLY|VEHICLE_FLAG_MOUSELOOK_BANK|VEHICLE_FLAG_MOUSELOOK_STEER|VEHICLE_FLAG_NO_DEFLECTION_UP|VEHICLE_HOVER_EFFICIENCY|VEHICLE_HOVER_HEIGHT|VEHICLE_HOVER_TIMESCALE|VEHICLE_LINEAR_DEFLECTION_EFFICIENCY|VEHICLE_LINEAR_DEFLECTION_TIMESCALE|VEHICLE_LINEAR_FRICTION_TIMESCALE|VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE|VEHICLE_LINEAR_MOTOR_DIRECTION|VEHICLE_LINEAR_MOTOR_OFFSET|VEHICLE_LINEAR_MOTOR_TIMESCALE|VEHICLE_REFERENCE_FRAME|VEHICLE_TYPE_AIRPLANE|VEHICLE_TYPE_BALLOON|VEHICLE_TYPE_BOAT|VEHICLE_TYPE_CAR|VEHICLE_TYPE_NONE|VEHICLE_TYPE_SLED|VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY|VEHICLE_VERTICAL_ATTRACTION_TIMESCALE|VERTICAL|WANDER_PAUSE_AT_WAYPOINTS\",\"constant.language.integer.boolean.lsl\":\"FALSE|TRUE\",\"constant.language.quaternion.lsl\":\"ZERO_ROTATION\",\"constant.language.string.lsl\":\"EOF|JSON_ARRAY|JSON_DELETE|JSON_FALSE|JSON_INVALID|JSON_NULL|JSON_NUMBER|JSON_OBJECT|JSON_STRING|JSON_TRUE|NULL_KEY|TEXTURE_BLANK|TEXTURE_DEFAULT|TEXTURE_MEDIA|TEXTURE_PLYWOOD|TEXTURE_TRANSPARENT|URL_REQUEST_DENIED|URL_REQUEST_GRANTED\",\"constant.language.vector.lsl\":\"TOUCH_INVALID_TEXCOORD|TOUCH_INVALID_VECTOR|ZERO_VECTOR\",\"invalid.broken.lsl\":\"LAND_LARGE_BRUSH|LAND_MEDIUM_BRUSH|LAND_SMALL_BRUSH\",\"invalid.deprecated.lsl\":\"ATTACH_LPEC|ATTACH_RPEC|DATA_RATING|OBJECT_ATTACHMENT_GEOMETRY_BYTES|OBJECT_ATTACHMENT_SURFACE_AREA|PRIM_CAST_SHADOWS|PRIM_MATERIAL_LIGHT|PRIM_TYPE_LEGACY|PSYS_SRC_INNERANGLE|PSYS_SRC_OUTERANGLE|VEHICLE_FLAG_NO_FLY_UP|llCloud|llMakeExplosion|llMakeFire|llMakeFountain|llMakeSmoke|llRemoteDataSetRegion|llSound|llSoundPreload|llXorBase64Strings|llXorBase64StringsCorrect\",\"invalid.illegal.lsl\":\"event\",\"invalid.unimplemented.lsl\":\"CHARACTER_MAX_ANGULAR_ACCEL|CHARACTER_MAX_ANGULAR_SPEED|CHARACTER_TURN_SPEED_MULTIPLIER|PERMISSION_CHANGE_JOINTS|PERMISSION_CHANGE_PERMISSIONS|PERMISSION_RELEASE_OWNERSHIP|PERMISSION_REMAP_CONTROLS|PRIM_PHYSICS_MATERIAL|PSYS_SRC_OBJ_REL_MASK|llCollisionSprite|llPointAt|llRefreshPrimURL|llReleaseCamera|llRemoteLoadScript|llSetPrimURL|llStopPointAt|llTakeCamera\",\"reserved.godmode.lsl\":\"llGodLikeRezObject|llSetInventoryPermMask|llSetObjectPermMask\",\"reserved.log.lsl\":\"print\",\"keyword.control.lsl\":\"do|else|for|if|jump|return|while\",\"storage.type.lsl\":\"float|integer|key|list|quaternion|rotation|string|vector\",\"support.function.lsl\":\"llAbs|llAcos|llAddToLandBanList|llAddToLandPassList|llAdjustSoundVolume|llAllowInventoryDrop|llAngleBetween|llApplyImpulse|llApplyRotationalImpulse|llAsin|llAtan2|llAttachToAvatar|llAttachToAvatarTemp|llAvatarOnLinkSitTarget|llAvatarOnSitTarget|llAxes2Rot|llAxisAngle2Rot|llBase64ToInteger|llBase64ToString|llBreakAllLinks|llBreakLink|llCSV2List|llCastRay|llCeil|llClearCameraParams|llClearLinkMedia|llClearPrimMedia|llCloseRemoteDataChannel|llCollisionFilter|llCollisionSound|llCos|llCreateCharacter|llCreateLink|llDeleteCharacter|llDeleteSubList|llDeleteSubString|llDetachFromAvatar|llDetectedGrab|llDetectedGroup|llDetectedKey|llDetectedLinkNumber|llDetectedName|llDetectedOwner|llDetectedPos|llDetectedRot|llDetectedTouchBinormal|llDetectedTouchFace|llDetectedTouchNormal|llDetectedTouchPos|llDetectedTouchST|llDetectedTouchUV|llDetectedType|llDetectedVel|llDialog|llDie|llDumpList2String|llEdgeOfWorld|llEjectFromLand|llEmail|llEscapeURL|llEuler2Rot|llEvade|llExecCharacterCmd|llFabs|llFleeFrom|llFloor|llForceMouselook|llFrand|llGenerateKey|llGetAccel|llGetAgentInfo|llGetAgentLanguage|llGetAgentList|llGetAgentSize|llGetAlpha|llGetAndResetTime|llGetAnimation|llGetAnimationList|llGetAnimationOverride|llGetAttached|llGetBoundingBox|llGetCameraPos|llGetCameraRot|llGetCenterOfMass|llGetClosestNavPoint|llGetColor|llGetCreator|llGetDate|llGetDisplayName|llGetEnergy|llGetEnv|llGetForce|llGetFreeMemory|llGetFreeURLs|llGetGMTclock|llGetGeometricCenter|llGetHTTPHeader|llGetInventoryCreator|llGetInventoryKey|llGetInventoryName|llGetInventoryNumber|llGetInventoryPermMask|llGetInventoryType|llGetKey|llGetLandOwnerAt|llGetLinkKey|llGetLinkMedia|llGetLinkName|llGetLinkNumber|llGetLinkNumberOfSides|llGetLinkPrimitiveParams|llGetListEntryType|llGetListLength|llGetLocalPos|llGetLocalRot|llGetMass|llGetMassMKS|llGetMaxScaleFactor|llGetMemoryLimit|llGetMinScaleFactor|llGetNextEmail|llGetNotecardLine|llGetNumberOfNotecardLines|llGetNumberOfPrims|llGetNumberOfSides|llGetObjectDesc|llGetObjectDetails|llGetObjectMass|llGetObjectName|llGetObjectPermMask|llGetObjectPrimCount|llGetOmega|llGetOwner|llGetOwnerKey|llGetParcelDetails|llGetParcelFlags|llGetParcelMaxPrims|llGetParcelMusicURL|llGetParcelPrimCount|llGetParcelPrimOwners|llGetPermissions|llGetPermissionsKey|llGetPhysicsMaterial|llGetPos|llGetPrimMediaParams|llGetPrimitiveParams|llGetRegionAgentCount|llGetRegionCorner|llGetRegionFPS|llGetRegionFlags|llGetRegionName|llGetRegionTimeDilation|llGetRootPosition|llGetRootRotation|llGetRot|llGetSPMaxMemory|llGetScale|llGetScriptName|llGetScriptState|llGetSimStats|llGetSimulatorHostname|llGetStartParameter|llGetStaticPath|llGetStatus|llGetSubString|llGetSunDirection|llGetTexture|llGetTextureOffset|llGetTextureRot|llGetTextureScale|llGetTime|llGetTimeOfDay|llGetTimestamp|llGetTorque|llGetUnixTime|llGetUsedMemory|llGetUsername|llGetVel|llGetWallclock|llGiveInventory|llGiveInventoryList|llGiveMoney|llGround|llGroundContour|llGroundNormal|llGroundRepel|llGroundSlope|llHTTPRequest|llHTTPResponse|llInsertString|llInstantMessage|llIntegerToBase64|llJson2List|llJsonGetValue|llJsonSetValue|llJsonValueType|llKey2Name|llLinkParticleSystem|llLinkSitTarget|llList2CSV|llList2Float|llList2Integer|llList2Json|llList2Key|llList2List|llList2ListStrided|llList2Rot|llList2String|llList2Vector|llListFindList|llListInsertList|llListRandomize|llListReplaceList|llListSort|llListStatistics|llListen|llListenControl|llListenRemove|llLoadURL|llLog|llLog10|llLookAt|llLoopSound|llLoopSoundMaster|llLoopSoundSlave|llMD5String|llManageEstateAccess|llMapDestination|llMessageLinked|llMinEventDelay|llModPow|llModifyLand|llMoveToTarget|llNavigateTo|llOffsetTexture|llOpenRemoteDataChannel|llOverMyLand|llOwnerSay|llParcelMediaCommandList|llParcelMediaQuery|llParseString2List|llParseStringKeepNulls|llParticleSystem|llPassCollisions|llPassTouches|llPatrolPoints|llPlaySound|llPlaySoundSlave|llPow|llPreloadSound|llPursue|llPushObject|llRegionSay|llRegionSayTo|llReleaseControls|llReleaseURL|llRemoteDataReply|llRemoteLoadScriptPin|llRemoveFromLandBanList|llRemoveFromLandPassList|llRemoveInventory|llRemoveVehicleFlags|llRequestAgentData|llRequestDisplayName|llRequestInventoryData|llRequestPermissions|llRequestSecureURL|llRequestSimulatorData|llRequestURL|llRequestUsername|llResetAnimationOverride|llResetLandBanList|llResetLandPassList|llResetOtherScript|llResetScript|llResetTime|llReturnObjectsByID|llReturnObjectsByOwner|llRezAtRoot|llRezObject|llRot2Angle|llRot2Axis|llRot2Euler|llRot2Fwd|llRot2Left|llRot2Up|llRotBetween|llRotLookAt|llRotTarget|llRotTargetRemove|llRotateTexture|llRound|llSHA1String|llSameGroup|llSay|llScaleByFactor|llScaleTexture|llScriptDanger|llScriptProfiler|llSendRemoteData|llSensor|llSensorRemove|llSensorRepeat|llSetAlpha|llSetAngularVelocity|llSetAnimationOverride|llSetBuoyancy|llSetCameraAtOffset|llSetCameraEyeOffset|llSetCameraParams|llSetClickAction|llSetColor|llSetContentType|llSetDamage|llSetForce|llSetForceAndTorque|llSetHoverHeight|llSetKeyframedMotion|llSetLinkAlpha|llSetLinkCamera|llSetLinkColor|llSetLinkMedia|llSetLinkPrimitiveParams|llSetLinkPrimitiveParamsFast|llSetLinkTexture|llSetLinkTextureAnim|llSetLocalRot|llSetMemoryLimit|llSetObjectDesc|llSetObjectName|llSetParcelMusicURL|llSetPayPrice|llSetPhysicsMaterial|llSetPos|llSetPrimMediaParams|llSetPrimitiveParams|llSetRegionPos|llSetRemoteScriptAccessPin|llSetRot|llSetScale|llSetScriptState|llSetSitText|llSetSoundQueueing|llSetSoundRadius|llSetStatus|llSetText|llSetTexture|llSetTextureAnim|llSetTimerEvent|llSetTorque|llSetTouchText|llSetVehicleFlags|llSetVehicleFloatParam|llSetVehicleRotationParam|llSetVehicleType|llSetVehicleVectorParam|llSetVelocity|llShout|llSin|llSitTarget|llSleep|llSqrt|llStartAnimation|llStopAnimation|llStopHover|llStopLookAt|llStopMoveToTarget|llStopSound|llStringLength|llStringToBase64|llStringTrim|llSubStringIndex|llTakeControls|llTan|llTarget|llTargetOmega|llTargetRemove|llTeleportAgent|llTeleportAgentGlobalCoords|llTeleportAgentHome|llTextBox|llToLower|llToUpper|llTransferLindenDollars|llTriggerSound|llTriggerSoundLimited|llUnSit|llUnescapeURL|llUpdateCharacter|llVecDist|llVecMag|llVecNorm|llVolumeDetect|llWanderWithin|llWater|llWhisper|llWind|llXorBase64\",\"support.function.event.lsl\":\"at_rot_target|at_target|attach|changed|collision|collision_end|collision_start|control|dataserver|email|http_request|http_response|land_collision|land_collision_end|land_collision_start|link_message|listen|money|moving_end|moving_start|no_sensor|not_at_rot_target|not_at_target|object_rez|on_rez|path_update|remote_data|run_time_permissions|sensor|state_entry|state_exit|timer|touch|touch_end|touch_start|transaction_result\"},\"identifier\");this.$rules={start:[{token:\"comment.line.double-slash.lsl\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment.block.begin.lsl\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.quoted.double.lsl\",start:'\"',end:'\"',next:[{token:\"constant.character.escape.lsl\",regex:/\\\\[tn\"\\\\]/}]},{token:\"constant.numeric.lsl\",regex:\"(0[xX][0-9a-fA-F]+|[+-]?[0-9]+(?:(?:\\\\.[0-9]*)?(?:[eE][+-]?[0-9]+)?)?)\\\\b\"},{token:\"entity.name.state.lsl\",regex:\"\\\\b((state)\\\\s+\\\\w+|default)\\\\b\"},{token:e,regex:\"\\\\b[a-zA-Z_][a-zA-Z0-9_]*\\\\b\"},{token:\"support.function.user-defined.lsl\",regex:/\\b([a-zA-Z_]\\w*)(?=\\(.*?\\))/},{token:\"keyword.operator.lsl\",regex:\"\\\\+\\\\+|\\\\-\\\\-|<<|>>|&&?|\\\\|\\\\|?|\\\\^|~|[!%<>=*+\\\\-\\\\/]=?\"},{token:\"invalid.illegal.keyword.operator.lsl\",regex:\":=?\"},{token:\"punctuation.operator.lsl\",regex:\"\\\\,|\\\\;\"},{token:\"paren.lparen.lsl\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen.lsl\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text.lsl\",regex:\"\\\\s+\"}],comment:[{token:\"comment.block.end.lsl\",regex:\"\\\\*\\\\/\",next:\"start\"},{token:\"comment.block.lsl\",regex:\".+\"}]},this.normalizeRules()}var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules;r.inherits(s,i),t.LSLHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-lua.js",
    "content": "define(\"ace/mode/lua\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/lua_highlight_rules\",\"ace/mode/folding/lua\",\"ace/range\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./lua_highlight_rules\").LuaHighlightRules,o=e(\"./folding/lua\").FoldMode,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(f,i),function(){function n(t){var n=0;for(var r=0;r<t.length;r++){var i=t[r];i.type==\"keyword\"?i.value in e&&(n+=e[i.value]):i.type==\"paren.lparen\"?n++:i.type==\"paren.rparen\"&&n--}return n<0?-1:n>0?1:0}this.lineCommentStart=\"--\",this.blockComment={start:\"--[\",end:\"]--\"};var e={\"function\":1,then:1,\"do\":1,\"else\":1,elseif:1,repeat:1,end:-1,until:-1},t=[\"else\",\"elseif\",\"end\",\"until\"];this.getNextLineIndent=function(e,t,r){var i=this.$getIndent(t),s=0,o=this.getTokenizer().getLineTokens(t,e),u=o.tokens;return e==\"start\"&&(s=n(u)),s>0?i+r:s<0&&i.substr(i.length-r.length)==r&&!this.checkOutdent(e,t,\"\\n\")?i.substr(0,i.length-r.length):i},this.checkOutdent=function(e,n,r){if(r!=\"\\n\"&&r!=\"\\r\"&&r!=\"\\r\\n\")return!1;if(n.match(/^\\s*[\\)\\}\\]]$/))return!0;var i=this.getTokenizer().getLineTokens(n.trim(),e).tokens;return!i||!i.length?!1:i[0].type==\"keyword\"&&t.indexOf(i[0].value)!=-1},this.autoOutdent=function(e,t,r){var i=t.getLine(r-1),s=this.$getIndent(i).length,o=this.getTokenizer().getLineTokens(i,\"start\").tokens,a=t.getTabString().length,f=s+a*n(o),l=this.$getIndent(t.getLine(r)).length;if(l<f)return;t.outdentRows(new u(r,0,r+2,0))},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/lua_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"error\",function(t){e.setAnnotations([t.data])}),t.on(\"ok\",function(t){e.clearAnnotations()}),t},this.$id=\"ace/mode/lua\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/lua_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"break|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while|or|and|not\",t=\"true|false|nil|_G|_VERSION\",n=\"string|xpcall|package|tostring|print|os|unpack|require|getfenv|setmetatable|next|assert|tonumber|io|rawequal|collectgarbage|getmetatable|module|rawset|math|debug|pcall|table|newproxy|type|coroutine|_G|select|gcinfo|pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|load|error|loadfile|sub|upper|len|gfind|rep|find|match|char|dump|gmatch|reverse|byte|format|gsub|lower|preload|loadlib|loaded|loaders|cpath|config|path|seeall|exit|setlocale|date|getenv|difftime|remove|time|clock|tmpname|rename|execute|lines|write|close|flush|open|output|type|read|stderr|stdin|input|stdout|popen|tmpfile|log|max|acos|huge|ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|gethook|setmetatable|setlocal|traceback|setfenv|getinfo|setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|foreachi|maxn|foreach|concat|sort|remove|resume|yield|status|wrap|create|running|__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber\",r=\"string|package|os|io|math|debug|table|coroutine\",i=\"\",s=\"setn|foreach|foreachi|gcinfo|log10|maxn\",o=this.createKeywordMapper({keyword:e,\"support.function\":n,\"invalid.deprecated\":s,\"constant.library\":r,\"constant.language\":t,\"invalid.illegal\":i,\"variable.language\":\"self\"},\"identifier\"),u=\"(?:(?:[1-9]\\\\d*)|(?:0))\",a=\"(?:0[xX][\\\\dA-Fa-f]+)\",f=\"(?:\"+u+\"|\"+a+\")\",l=\"(?:\\\\.\\\\d+)\",c=\"(?:\\\\d+)\",h=\"(?:(?:\"+c+\"?\"+l+\")|(?:\"+c+\"\\\\.))\",p=\"(?:\"+h+\")\";this.$rules={start:[{stateName:\"bracketedComment\",onMatch:function(e,t,n){return n.unshift(this.next,e.length-2,t),\"comment\"},regex:/\\-\\-\\[=*\\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next=\"\",\"comment\"},regex:/\\]=*\\]/,next:\"start\"},{defaultToken:\"comment\"}]},{token:\"comment\",regex:\"\\\\-\\\\-.*$\"},{stateName:\"bracketedString\",onMatch:function(e,t,n){return n.unshift(this.next,e.length,t),\"comment\"},regex:/\\[=*\\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next=\"\",\"comment\"},regex:/\\]=*\\]/,next:\"start\"},{defaultToken:\"comment\"}]},{token:\"string\",regex:'\"(?:[^\\\\\\\\]|\\\\\\\\.)*?\"'},{token:\"string\",regex:\"'(?:[^\\\\\\\\]|\\\\\\\\.)*?'\"},{token:\"constant.numeric\",regex:p},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:o,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\/|%|\\\\#|\\\\^|~|<|>|<=|=>|==|~=|=|\\\\:|\\\\.\\\\.\\\\.|\\\\.\\\\.\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+|\\\\w+\"}]},this.normalizeRules()};r.inherits(s,i),t.LuaHighlightRules=s}),define(\"ace/mode/folding/lua\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=e(\"../../token_iterator\").TokenIterator,u=t.FoldMode=function(){};r.inherits(u,i),function(){this.foldingStartMarker=/\\b(function|then|do|repeat)\\b|{\\s*$|(\\[=*\\[)/,this.foldingStopMarker=/\\bend\\b|^\\s*}|\\]=*\\]/,this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=this.foldingStartMarker.test(r),s=this.foldingStopMarker.test(r);if(i&&!s){var o=r.match(this.foldingStartMarker);if(o[1]==\"then\"&&/\\belseif\\b/.test(r))return;if(o[1]){if(e.getTokenAt(n,o.index+1).type===\"keyword\")return\"start\"}else{if(!o[2])return\"start\";var u=e.bgTokenizer.getState(n)||\"\";if(u[0]==\"bracketedComment\"||u[0]==\"bracketedString\")return\"start\"}}if(t!=\"markbeginend\"||!s||i&&s)return\"\";var o=r.match(this.foldingStopMarker);if(o[0]===\"end\"){if(e.getTokenAt(n,o.index+1).type===\"keyword\")return\"end\"}else{if(o[0][0]!==\"]\")return\"end\";var u=e.bgTokenizer.getState(n-1)||\"\";if(u[0]==\"bracketedComment\"||u[0]==\"bracketedString\")return\"end\"}},this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getLine(n),i=this.foldingStartMarker.exec(r);if(i)return i[1]?this.luaBlock(e,n,i.index+1):i[2]?e.getCommentFoldRange(n,i.index+1):this.openingBracketBlock(e,\"{\",n,i.index);var i=this.foldingStopMarker.exec(r);if(i)return i[0]===\"end\"&&e.getTokenAt(n,i.index+1).type===\"keyword\"?this.luaBlock(e,n,i.index+1):i[0][0]===\"]\"?e.getCommentFoldRange(n,i.index+1):this.closingBracketBlock(e,\"}\",n,i.index+i[0].length)},this.luaBlock=function(e,t,n){var r=new o(e,t,n),i={\"function\":1,\"do\":1,then:1,elseif:-1,end:-1,repeat:1,until:-1},u=r.getCurrentToken();if(!u||u.type!=\"keyword\")return;var a=u.value,f=[a],l=i[a];if(!l)return;var c=l===-1?r.getCurrentTokenColumn():e.getLine(t).length,h=t;r.step=l===-1?r.stepBackward:r.stepForward;while(u=r.step()){if(u.type!==\"keyword\")continue;var p=l*i[u.value];if(p>0)f.unshift(u.value);else if(p<=0){f.shift();if(!f.length&&u.value!=\"elseif\")break;p===0&&f.unshift(u.value)}}var t=r.getCurrentTokenRow();return l===-1?new s(t,e.getLine(t).length,h,c):new s(h,c,t,r.getCurrentTokenColumn())}}.call(u.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-luapage.js",
    "content": "define(\"ace/mode/luapage\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/lua\",\"ace/mode/luapage_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./lua\").Mode,o=e(\"./luapage_highlight_rules\").LuaPageHighlightRules,u=function(){i.call(this),this.HighlightRules=o,this.createModeDelegates({\"lua-\":s})};r.inherits(u,i),function(){this.$id=\"ace/mode/luapage\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/lua\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/lua_highlight_rules\",\"ace/mode/folding/lua\",\"ace/range\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./lua_highlight_rules\").LuaHighlightRules,o=e(\"./folding/lua\").FoldMode,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(f,i),function(){function n(t){var n=0;for(var r=0;r<t.length;r++){var i=t[r];i.type==\"keyword\"?i.value in e&&(n+=e[i.value]):i.type==\"paren.lparen\"?n++:i.type==\"paren.rparen\"&&n--}return n<0?-1:n>0?1:0}this.lineCommentStart=\"--\",this.blockComment={start:\"--[\",end:\"]--\"};var e={\"function\":1,then:1,\"do\":1,\"else\":1,elseif:1,repeat:1,end:-1,until:-1},t=[\"else\",\"elseif\",\"end\",\"until\"];this.getNextLineIndent=function(e,t,r){var i=this.$getIndent(t),s=0,o=this.getTokenizer().getLineTokens(t,e),u=o.tokens;return e==\"start\"&&(s=n(u)),s>0?i+r:s<0&&i.substr(i.length-r.length)==r&&!this.checkOutdent(e,t,\"\\n\")?i.substr(0,i.length-r.length):i},this.checkOutdent=function(e,n,r){if(r!=\"\\n\"&&r!=\"\\r\"&&r!=\"\\r\\n\")return!1;if(n.match(/^\\s*[\\)\\}\\]]$/))return!0;var i=this.getTokenizer().getLineTokens(n.trim(),e).tokens;return!i||!i.length?!1:i[0].type==\"keyword\"&&t.indexOf(i[0].value)!=-1},this.autoOutdent=function(e,t,r){var i=t.getLine(r-1),s=this.$getIndent(i).length,o=this.getTokenizer().getLineTokens(i,\"start\").tokens,a=t.getTabString().length,f=s+a*n(o),l=this.$getIndent(t.getLine(r)).length;if(l<f)return;t.outdentRows(new u(r,0,r+2,0))},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/lua_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"error\",function(t){e.setAnnotations([t.data])}),t.on(\"ok\",function(t){e.clearAnnotations()}),t},this.$id=\"ace/mode/lua\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/lua_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"break|do|else|elseif|end|for|function|if|in|local|repeat|return|then|until|while|or|and|not\",t=\"true|false|nil|_G|_VERSION\",n=\"string|xpcall|package|tostring|print|os|unpack|require|getfenv|setmetatable|next|assert|tonumber|io|rawequal|collectgarbage|getmetatable|module|rawset|math|debug|pcall|table|newproxy|type|coroutine|_G|select|gcinfo|pairs|rawget|loadstring|ipairs|_VERSION|dofile|setfenv|load|error|loadfile|sub|upper|len|gfind|rep|find|match|char|dump|gmatch|reverse|byte|format|gsub|lower|preload|loadlib|loaded|loaders|cpath|config|path|seeall|exit|setlocale|date|getenv|difftime|remove|time|clock|tmpname|rename|execute|lines|write|close|flush|open|output|type|read|stderr|stdin|input|stdout|popen|tmpfile|log|max|acos|huge|ldexp|pi|cos|tanh|pow|deg|tan|cosh|sinh|random|randomseed|frexp|ceil|floor|rad|abs|sqrt|modf|asin|min|mod|fmod|log10|atan2|exp|sin|atan|getupvalue|debug|sethook|getmetatable|gethook|setmetatable|setlocal|traceback|setfenv|getinfo|setupvalue|getlocal|getregistry|getfenv|setn|insert|getn|foreachi|maxn|foreach|concat|sort|remove|resume|yield|status|wrap|create|running|__add|__sub|__mod|__unm|__concat|__lt|__index|__call|__gc|__metatable|__mul|__div|__pow|__len|__eq|__le|__newindex|__tostring|__mode|__tonumber\",r=\"string|package|os|io|math|debug|table|coroutine\",i=\"\",s=\"setn|foreach|foreachi|gcinfo|log10|maxn\",o=this.createKeywordMapper({keyword:e,\"support.function\":n,\"invalid.deprecated\":s,\"constant.library\":r,\"constant.language\":t,\"invalid.illegal\":i,\"variable.language\":\"self\"},\"identifier\"),u=\"(?:(?:[1-9]\\\\d*)|(?:0))\",a=\"(?:0[xX][\\\\dA-Fa-f]+)\",f=\"(?:\"+u+\"|\"+a+\")\",l=\"(?:\\\\.\\\\d+)\",c=\"(?:\\\\d+)\",h=\"(?:(?:\"+c+\"?\"+l+\")|(?:\"+c+\"\\\\.))\",p=\"(?:\"+h+\")\";this.$rules={start:[{stateName:\"bracketedComment\",onMatch:function(e,t,n){return n.unshift(this.next,e.length-2,t),\"comment\"},regex:/\\-\\-\\[=*\\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next=\"\",\"comment\"},regex:/\\]=*\\]/,next:\"start\"},{defaultToken:\"comment\"}]},{token:\"comment\",regex:\"\\\\-\\\\-.*$\"},{stateName:\"bracketedString\",onMatch:function(e,t,n){return n.unshift(this.next,e.length,t),\"comment\"},regex:/\\[=*\\[/,next:[{onMatch:function(e,t,n){return e.length==n[1]?(n.shift(),n.shift(),this.next=n.shift()):this.next=\"\",\"comment\"},regex:/\\]=*\\]/,next:\"start\"},{defaultToken:\"comment\"}]},{token:\"string\",regex:'\"(?:[^\\\\\\\\]|\\\\\\\\.)*?\"'},{token:\"string\",regex:\"'(?:[^\\\\\\\\]|\\\\\\\\.)*?'\"},{token:\"constant.numeric\",regex:p},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:o,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\/|%|\\\\#|\\\\^|~|<|>|<=|=>|==|~=|=|\\\\:|\\\\.\\\\.\\\\.|\\\\.\\\\.\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+|\\\\w+\"}]},this.normalizeRules()};r.inherits(s,i),t.LuaHighlightRules=s}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/folding/lua\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=e(\"../../token_iterator\").TokenIterator,u=t.FoldMode=function(){};r.inherits(u,i),function(){this.foldingStartMarker=/\\b(function|then|do|repeat)\\b|{\\s*$|(\\[=*\\[)/,this.foldingStopMarker=/\\bend\\b|^\\s*}|\\]=*\\]/,this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=this.foldingStartMarker.test(r),s=this.foldingStopMarker.test(r);if(i&&!s){var o=r.match(this.foldingStartMarker);if(o[1]==\"then\"&&/\\belseif\\b/.test(r))return;if(o[1]){if(e.getTokenAt(n,o.index+1).type===\"keyword\")return\"start\"}else{if(!o[2])return\"start\";var u=e.bgTokenizer.getState(n)||\"\";if(u[0]==\"bracketedComment\"||u[0]==\"bracketedString\")return\"start\"}}if(t!=\"markbeginend\"||!s||i&&s)return\"\";var o=r.match(this.foldingStopMarker);if(o[0]===\"end\"){if(e.getTokenAt(n,o.index+1).type===\"keyword\")return\"end\"}else{if(o[0][0]!==\"]\")return\"end\";var u=e.bgTokenizer.getState(n-1)||\"\";if(u[0]==\"bracketedComment\"||u[0]==\"bracketedString\")return\"end\"}},this.getFoldWidgetRange=function(e,t,n){var r=e.doc.getLine(n),i=this.foldingStartMarker.exec(r);if(i)return i[1]?this.luaBlock(e,n,i.index+1):i[2]?e.getCommentFoldRange(n,i.index+1):this.openingBracketBlock(e,\"{\",n,i.index);var i=this.foldingStopMarker.exec(r);if(i)return i[0]===\"end\"&&e.getTokenAt(n,i.index+1).type===\"keyword\"?this.luaBlock(e,n,i.index+1):i[0][0]===\"]\"?e.getCommentFoldRange(n,i.index+1):this.closingBracketBlock(e,\"}\",n,i.index+i[0].length)},this.luaBlock=function(e,t,n){var r=new o(e,t,n),i={\"function\":1,\"do\":1,then:1,elseif:-1,end:-1,repeat:1,until:-1},u=r.getCurrentToken();if(!u||u.type!=\"keyword\")return;var a=u.value,f=[a],l=i[a];if(!l)return;var c=l===-1?r.getCurrentTokenColumn():e.getLine(t).length,h=t;r.step=l===-1?r.stepBackward:r.stepForward;while(u=r.step()){if(u.type!==\"keyword\")continue;var p=l*i[u.value];if(p>0)f.unshift(u.value);else if(p<=0){f.shift();if(!f.length&&u.value!=\"elseif\")break;p===0&&f.unshift(u.value)}}var t=r.getCurrentTokenRow();return l===-1?new s(t,e.getLine(t).length,h,c):new s(h,c,t,r.getCurrentTokenColumn())}}.call(u.prototype)}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/luapage_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\",\"ace/mode/lua_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=e(\"./lua_highlight_rules\").LuaHighlightRules,o=function(){i.call(this);var e=[{token:\"keyword\",regex:\"<\\\\%\\\\=?\",push:\"lua-start\"},{token:\"keyword\",regex:\"<\\\\?lua\\\\=?\",push:\"lua-start\"}],t=[{token:\"keyword\",regex:\"\\\\%>\",next:\"pop\"},{token:\"keyword\",regex:\"\\\\?>\",next:\"pop\"}];this.embedRules(s,\"lua-\",t,[\"start\"]);for(var n in this.$rules)this.$rules[n].unshift.apply(this.$rules[n],e);this.normalizeRules()};r.inherits(o,i),t.LuaPageHighlightRules=o}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-lucene.js",
    "content": "define(\"ace/mode/lucene\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/lucene_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./lucene_highlight_rules\").LuceneHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.$id=\"ace/mode/lucene\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/lucene_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){this.$rules={start:[{token:\"constant.character.negation\",regex:\"[\\\\-]\"},{token:\"constant.character.interro\",regex:\"[\\\\?]\"},{token:\"constant.character.asterisk\",regex:\"[\\\\*]\"},{token:\"constant.character.proximity\",regex:\"~[0-9]+\\\\b\"},{token:\"keyword.operator\",regex:\"(?:AND|OR|NOT)\\\\b\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"keyword\",regex:\"[\\\\S]+:\"},{token:\"string\",regex:'\".*?\"'},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(o,s),t.LuceneHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-makefile.js",
    "content": "define(\"ace/mode/makefile\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/makefile_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./makefile_highlight_rules\").MakefileHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"#\",this.$indentWithTabs=!0,this.$id=\"ace/mode/makefile\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/makefile_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\",\"ace/mode/sh_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./sh_highlight_rules\"),o=function(){var e=this.createKeywordMapper({keyword:s.reservedKeywords,\"support.function.builtin\":s.languageConstructs,\"invalid.deprecated\":\"debugger\"},\"string\");this.$rules={start:[{token:\"string.interpolated.backtick.makefile\",regex:\"`\",next:\"shell-start\"},{token:\"punctuation.definition.comment.makefile\",regex:/#(?=.)/,next:\"comment\"},{token:[\"keyword.control.makefile\"],regex:\"^(?:\\\\s*\\\\b)(\\\\-??include|ifeq|ifneq|ifdef|ifndef|else|endif|vpath|export|unexport|define|endef|override)(?:\\\\b)\"},{token:[\"entity.name.function.makefile\",\"text\"],regex:\"^([^\\\\t ]+(?:\\\\s[^\\\\t ]+)*:)(\\\\s*.*)\"}],comment:[{token:\"punctuation.definition.comment.makefile\",regex:/.+\\\\/},{token:\"punctuation.definition.comment.makefile\",regex:\".+\",next:\"start\"}],\"shell-start\":[{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"string\",regex:\"\\\\w+\"},{token:\"string.interpolated.backtick.makefile\",regex:\"`\",next:\"start\"}]}};r.inherits(o,i),t.MakefileHighlightRules=o}),define(\"ace/mode/sh_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.reservedKeywords=\"!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set\",o=t.languageConstructs=\"[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait\",u=function(){var e=this.createKeywordMapper({keyword:s,\"support.function.builtin\":o,\"invalid.deprecated\":\"debugger\"},\"identifier\"),t=\"(?:(?:[1-9]\\\\d*)|(?:0))\",n=\"(?:\\\\.\\\\d+)\",r=\"(?:\\\\d+)\",i=\"(?:(?:\"+r+\"?\"+n+\")|(?:\"+r+\"\\\\.))\",u=\"(?:(?:\"+i+\"|\"+r+\")\"+\")\",a=\"(?:\"+u+\"|\"+i+\")\",f=\"(?:&\"+r+\")\",l=\"[a-zA-Z_][a-zA-Z0-9_]*\",c=\"(?:(?:\\\\$\"+l+\")|(?:\"+l+\"=))\",h=\"(?:\\\\$(?:SHLVL|\\\\$|\\\\!|\\\\?))\",p=\"(?:\"+l+\"\\\\s*\\\\(\\\\))\";this.$rules={start:[{token:\"constant\",regex:/\\\\./},{token:[\"text\",\"comment\"],regex:/(^|\\s)(#.*)$/},{token:\"string\",regex:'\"',push:[{token:\"constant.language.escape\",regex:/\\\\(?:[$abeEfnrtv\\\\'\"]|x[a-fA-F\\d]{1,2}|u[a-fA-F\\d]{4}([a-fA-F\\d]{4})?|c.|\\d{1,3})/},{token:\"constant\",regex:/\\$\\w+/},{token:\"string\",regex:'\"',next:\"pop\"},{defaultToken:\"string\"}]},{token:\"variable.language\",regex:h},{token:\"variable\",regex:c},{token:\"support.function\",regex:p},{token:\"support.function\",regex:f},{token:\"string\",start:\"'\",end:\"'\"},{token:\"constant.numeric\",regex:a},{token:\"constant.numeric\",regex:t+\"\\\\b\"},{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|~|<|>|<=|=>|=|!=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"}]},this.normalizeRules()};r.inherits(u,i),t.ShHighlightRules=u}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-markdown.js",
    "content": "define(\"ace/mode/markdown\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/xml\",\"ace/mode/html\",\"ace/mode/markdown_highlight_rules\",\"ace/mode/folding/markdown\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript\").Mode,o=e(\"./xml\").Mode,u=e(\"./html\").Mode,a=e(\"./markdown_highlight_rules\").MarkdownHighlightRules,f=e(\"./folding/markdown\").FoldMode,l=function(){this.HighlightRules=a,this.createModeDelegates({\"js-\":s,\"xml-\":o,\"html-\":u}),this.foldingRules=new f};r.inherits(l,i),function(){this.type=\"text\",this.blockComment={start:\"<!--\",end:\"-->\"},this.getNextLineIndent=function(e,t,n){if(e==\"listblock\"){var r=/^(\\s*)(?:([-+*])|(\\d+)\\.)(\\s+)/.exec(t);if(!r)return\"\";var i=r[2];return i||(i=parseInt(r[3],10)+1+\".\"),r[1]+i+r[4]}return this.$getIndent(t)},this.$id=\"ace/mode/markdown\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/xml_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/xml\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./xml_highlight_rules\").XmlHighlightRules,u=e(\"./behaviour/xml\").XmlBehaviour,a=e(\"./folding/xml\").FoldMode,f=function(){this.HighlightRules=o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,s),function(){this.voidElements=i.arrayToMap([]),this.blockComment={start:\"<!--\",end:\"-->\"},this.$id=\"ace/mode/xml\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/markdown_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\",\"ace/mode/html_highlight_rules\",\"ace/mode/css_highlight_rules\"],function(e,t,n){function c(e,t){return{token:\"support.function\",regex:\"^\\\\s*```\"+e+\"\\\\s*$\",push:t+\"start\"}}var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./css_highlight_rules\").CssHighlightRules,l=function(e){return\"(?:[^\"+i.escapeRegExp(e)+\"\\\\\\\\]|\\\\\\\\.)*\"},h=function(){a.call(this),this.$rules.start.unshift({token:\"empty_line\",regex:\"^$\",next:\"allowBlock\"},{token:\"markup.heading.1\",regex:\"^=+(?=\\\\s*$)\"},{token:\"markup.heading.2\",regex:\"^\\\\-+(?=\\\\s*$)\"},{token:function(e){return\"markup.heading.\"+e.length},regex:/^#{1,6}(?=\\s*[^ #]|\\s+#.)/,next:\"header\"},c(\"(?:javascript|js)\",\"jscode-\"),c(\"xml\",\"xmlcode-\"),c(\"html\",\"htmlcode-\"),c(\"css\",\"csscode-\"),{token:\"support.function\",regex:\"^\\\\s*```\\\\s*\\\\S*(?:{.*?\\\\})?\\\\s*$\",next:\"githubblock\"},{token:\"string.blockquote\",regex:\"^\\\\s*>\\\\s*(?:[*+-]|\\\\d+\\\\.)?\\\\s+\",next:\"blockquote\"},{token:\"constant\",regex:\"^ {0,2}(?:(?: ?\\\\* ?){3,}|(?: ?\\\\- ?){3,}|(?: ?\\\\_ ?){3,})\\\\s*$\",next:\"allowBlock\"},{token:\"markup.list\",regex:\"^\\\\s{0,3}(?:[*+-]|\\\\d+\\\\.)\\\\s+\",next:\"listblock-start\"},{include:\"basic\"}),this.addRules({basic:[{token:\"constant.language.escape\",regex:/\\\\[\\\\`*_{}\\[\\]()#+\\-.!]/},{token:\"support.function\",regex:\"(`+)(.*?[^`])(\\\\1)\"},{token:[\"text\",\"constant\",\"text\",\"url\",\"string\",\"text\"],regex:'^([ ]{0,3}\\\\[)([^\\\\]]+)(\\\\]:\\\\s*)([^ ]+)(\\\\s*(?:[\"][^\"]+[\"])?(\\\\s*))$'},{token:[\"text\",\"string\",\"text\",\"constant\",\"text\"],regex:\"(\\\\[)(\"+l(\"]\")+\")(\\\\]s*\\\\[)(\"+l(\"]\")+\")(\\\\])\"},{token:[\"text\",\"string\",\"text\",\"markup.underline\",\"string\",\"text\"],regex:\"(\\\\[)(\"+l(\"]\")+\")(\\\\]\\\\()\"+'((?:[^\\\\)\\\\s\\\\\\\\]|\\\\\\\\.|\\\\s(?=[^\"]))*)'+'(\\\\s*\"'+l('\"')+'\"\\\\s*)?'+\"(\\\\))\"},{token:\"string.strong\",regex:\"([*]{2}|[_]{2}(?=\\\\S))(.*?\\\\S[*_]*)(\\\\1)\"},{token:\"string.emphasis\",regex:\"([*]|[_](?=\\\\S))(.*?\\\\S[*_]*)(\\\\1)\"},{token:[\"text\",\"url\",\"text\"],regex:\"(<)((?:https?|ftp|dict):[^'\\\">\\\\s]+|(?:mailto:)?[-.\\\\w]+\\\\@[-a-z0-9]+(?:\\\\.[-a-z0-9]+)*\\\\.[a-z]+)(>)\"}],allowBlock:[{token:\"support.function\",regex:\"^ {4}.+\",next:\"allowBlock\"},{token:\"empty\",regex:\"\",next:\"start\"}],header:[{regex:\"$\",next:\"start\"},{include:\"basic\"},{defaultToken:\"heading\"}],\"listblock-start\":[{token:\"support.variable\",regex:/(?:\\[[ x]\\])?/,next:\"listblock\"}],listblock:[{token:\"empty_line\",regex:\"^$\",next:\"start\"},{token:\"markup.list\",regex:\"^\\\\s{0,3}(?:[*+-]|\\\\d+\\\\.)\\\\s+\",next:\"listblock-start\"},{include:\"basic\",noEscape:!0},{token:\"support.function\",regex:\"^\\\\s*```\\\\s*[a-zA-Z]*(?:{.*?\\\\})?\\\\s*$\",next:\"githubblock\"},{defaultToken:\"list\"}],blockquote:[{token:\"empty_line\",regex:\"^\\\\s*$\",next:\"start\"},{token:\"string.blockquote\",regex:\"^\\\\s*>\\\\s*(?:[*+-]|\\\\d+\\\\.)?\\\\s+\",next:\"blockquote\"},{include:\"basic\",noEscape:!0},{defaultToken:\"string.blockquote\"}],githubblock:[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"start\"},{token:\"support.function\",regex:\".+\"}]}),this.embedRules(o,\"jscode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(a,\"htmlcode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(f,\"csscode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.embedRules(u,\"xmlcode-\",[{token:\"support.function\",regex:\"^\\\\s*```\",next:\"pop\"}]),this.normalizeRules()};r.inherits(h,s),t.MarkdownHighlightRules=h}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/folding/markdown\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.foldingStartMarker=/^(?:[=-]+\\s*$|#{1,6} |`{3})/,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?r[0]==\"`\"?e.bgTokenizer.getState(n)==\"start\"?\"end\":\"start\":\"start\":\"\"},this.getFoldWidgetRange=function(e,t,n){function l(t){return f=e.getTokens(t)[0],f&&f.type.lastIndexOf(c,0)===0}function h(){var e=f.value[0];return e==\"=\"?6:e==\"-\"?5:7-f.value.search(/[^#]/)}var r=e.getLine(n),i=r.length,o=e.getLength(),u=n,a=n;if(!r.match(this.foldingStartMarker))return;if(r[0]==\"`\"){if(e.bgTokenizer.getState(n)!==\"start\"){while(++n<o){r=e.getLine(n);if(r[0]==\"`\"&r.substring(0,3)==\"```\")break}return new s(u,i,n,0)}while(n-->0){r=e.getLine(n);if(r[0]==\"`\"&r.substring(0,3)==\"```\")break}return new s(n,r.length,u,0)}var f,c=\"markup.heading\";if(l(n)){var p=h();while(++n<o){if(!l(n))continue;var d=h();if(d>=p)break}a=n-(!f||[\"=\",\"-\"].indexOf(f.value[0])==-1?1:2);if(a>u)while(a>u&&/^\\s*$/.test(e.getLine(a)))a--;if(a>u){var v=e.getLine(a).length;return new s(u,i,a,v)}}}}.call(o.prototype)}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-matlab.js",
    "content": "define(\"ace/mode/matlab\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/matlab_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./matlab_highlight_rules\").MatlabHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"%\",this.blockComment={start:\"%{\",end:\"%}\"},this.$id=\"ace/mode/matlab\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/matlab_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"break|case|catch|classdef|continue|else|elseif|end|for|function|global|if|otherwise|parfor|persistent|return|spmd|switch|try|while\",t=\"true|false|inf|Inf|nan|NaN|eps|pi|ans|nargin|nargout|varargin|varargout\",n=\"abs|accumarray|acos(?:d|h)?|acot(?:d|h)?|acsc(?:d|h)?|actxcontrol(?:list|select)?|actxGetRunningServer|actxserver|addlistener|addpath|addpref|addtodate|airy|align|alim|all|allchild|alpha|alphamap|amd|ancestor|and|angle|annotation|any|area|arrayfun|asec(?:d|h)?|asin(?:d|h)?|assert|assignin|atan(?:2|d|h)?|audiodevinfo|audioplayer|audiorecorder|aufinfo|auread|autumn|auwrite|avifile|aviinfo|aviread|axes|axis|balance|bar(?:3|3h|h)?|base2dec|beep|BeginInvoke|bench|bessel(?:h|i|j|k|y)|beta|betainc|betaincinv|betaln|bicg|bicgstab|bicgstabl|bin2dec|bitand|bitcmp|bitget|bitmax|bitnot|bitor|bitset|bitshift|bitxor|blanks|blkdiag|bone|box|brighten|brush|bsxfun|builddocsearchdb|builtin|bvp4c|bvp5c|bvpget|bvpinit|bvpset|bvpxtend|calendar|calllib|callSoapService|camdolly|cameratoolbar|camlight|camlookat|camorbit|campan|campos|camproj|camroll|camtarget|camup|camva|camzoom|cart2pol|cart2sph|cast|cat|caxis|cd|cdf2rdf|cdfepoch|cdfinfo|cdflib(?:.(?:close|closeVar|computeEpoch|computeEpoch16|create|createAttr|createVar|delete|deleteAttr|deleteAttrEntry|deleteAttrgEntry|deleteVar|deleteVarRecords|epoch16Breakdown|epochBreakdown|getAttrEntry|getAttrgEntry|getAttrMaxEntry|getAttrMaxgEntry|getAttrName|getAttrNum|getAttrScope|getCacheSize|getChecksum|getCompression|getCompressionCacheSize|getConstantNames|getConstantValue|getCopyright|getFileBackward|getFormat|getLibraryCopyright|getLibraryVersion|getMajority|getName|getNumAttrEntries|getNumAttrgEntries|getNumAttributes|getNumgAttributes|getReadOnlyMode|getStageCacheSize|getValidate|getVarAllocRecords|getVarBlockingFactor|getVarCacheSize|getVarCompression|getVarData|getVarMaxAllocRecNum|getVarMaxWrittenRecNum|getVarName|getVarNum|getVarNumRecsWritten|getVarPadValue|getVarRecordData|getVarReservePercent|getVarsMaxWrittenRecNum|getVarSparseRecords|getVersion|hyperGetVarData|hyperPutVarData|inquire|inquireAttr|inquireAttrEntry|inquireAttrgEntry|inquireVar|open|putAttrEntry|putAttrgEntry|putVarData|putVarRecordData|renameAttr|renameVar|setCacheSize|setChecksum|setCompression|setCompressionCacheSize|setFileBackward|setFormat|setMajority|setReadOnlyMode|setStageCacheSize|setValidate|setVarAllocBlockRecords|setVarBlockingFactor|setVarCacheSize|setVarCompression|setVarInitialRecs|setVarPadValue|SetVarReservePercent|setVarsCacheSize|setVarSparseRecords))?|cdfread|cdfwrite|ceil|cell2mat|cell2struct|celldisp|cellfun|cellplot|cellstr|cgs|checkcode|checkin|checkout|chol|cholinc|cholupdate|circshift|cla|clabel|class|clc|clear|clearvars|clf|clipboard|clock|close|closereq|cmopts|cmpermute|cmunique|colamd|colon|colorbar|colordef|colormap|colormapeditor|colperm|Combine|comet|comet3|commandhistory|commandwindow|compan|compass|complex|computer|cond|condeig|condest|coneplot|conj|containers.Map|contour(?:3|c|f|slice)?|contrast|conv|conv2|convhull|convhulln|convn|cool|copper|copyfile|copyobj|corrcoef|cos(?:d|h)?|cot(?:d|h)?|cov|cplxpair|cputime|createClassFromWsdl|createSoapMessage|cross|csc(?:d|h)?|csvread|csvwrite|ctranspose|cumprod|cumsum|cumtrapz|curl|customverctrl|cylinder|daqread|daspect|datacursormode|datatipinfo|date|datenum|datestr|datetick|datevec|dbclear|dbcont|dbdown|dblquad|dbmex|dbquit|dbstack|dbstatus|dbstep|dbstop|dbtype|dbup|dde23|ddeget|ddesd|ddeset|deal|deblank|dec2base|dec2bin|dec2hex|decic|deconv|del2|delaunay|delaunay3|delaunayn|DelaunayTri|delete|demo|depdir|depfun|det|detrend|deval|diag|dialog|diary|diff|diffuse|dir|disp|display|dither|divergence|dlmread|dlmwrite|dmperm|doc|docsearch|dos|dot|dragrect|drawnow|dsearch|dsearchn|dynamicprops|echo|echodemo|edit|eig|eigs|ellipj|ellipke|ellipsoid|empty|enableNETfromNetworkDrive|enableservice|EndInvoke|enumeration|eomday|eq|erf|erfc|erfcinv|erfcx|erfinv|error|errorbar|errordlg|etime|etree|etreeplot|eval|evalc|evalin|event.(?:EventData|listener|PropertyEvent|proplistener)|exifread|exist|exit|exp|expint|expm|expm1|export2wsdlg|eye|ezcontour|ezcontourf|ezmesh|ezmeshc|ezplot|ezplot3|ezpolar|ezsurf|ezsurfc|factor|factorial|fclose|feather|feature|feof|ferror|feval|fft|fft2|fftn|fftshift|fftw|fgetl|fgets|fieldnames|figure|figurepalette|fileattrib|filebrowser|filemarker|fileparts|fileread|filesep|fill|fill3|filter|filter2|find|findall|findfigs|findobj|findstr|finish|fitsdisp|fitsinfo|fitsread|fitswrite|fix|flag|flipdim|fliplr|flipud|floor|flow|fminbnd|fminsearch|fopen|format|fplot|fprintf|frame2im|fread|freqspace|frewind|fscanf|fseek|ftell|FTP|full|fullfile|func2str|functions|funm|fwrite|fzero|gallery|gamma|gammainc|gammaincinv|gammaln|gca|gcbf|gcbo|gcd|gcf|gco|ge|genpath|genvarname|get|getappdata|getenv|getfield|getframe|getpixelposition|getpref|ginput|gmres|gplot|grabcode|gradient|gray|graymon|grid|griddata(?:3|n)?|griddedInterpolant|gsvd|gt|gtext|guidata|guide|guihandles|gunzip|gzip|h5create|h5disp|h5info|h5read|h5readatt|h5write|h5writeatt|hadamard|handle|hankel|hdf|hdf5|hdf5info|hdf5read|hdf5write|hdfinfo|hdfread|hdftool|help|helpbrowser|helpdesk|helpdlg|helpwin|hess|hex2dec|hex2num|hgexport|hggroup|hgload|hgsave|hgsetget|hgtransform|hidden|hilb|hist|histc|hold|home|horzcat|hostid|hot|hsv|hsv2rgb|hypot|ichol|idivide|ifft|ifft2|ifftn|ifftshift|ilu|im2frame|im2java|imag|image|imagesc|imapprox|imfinfo|imformats|import|importdata|imread|imwrite|ind2rgb|ind2sub|inferiorto|info|inline|inmem|inpolygon|input|inputdlg|inputname|inputParser|inspect|instrcallback|instrfind|instrfindall|int2str|integral(?:2|3)?|interp(?:1|1q|2|3|ft|n)|interpstreamspeed|intersect|intmax|intmin|inv|invhilb|ipermute|isa|isappdata|iscell|iscellstr|ischar|iscolumn|isdir|isempty|isequal|isequaln|isequalwithequalnans|isfield|isfinite|isfloat|isglobal|ishandle|ishghandle|ishold|isinf|isinteger|isjava|iskeyword|isletter|islogical|ismac|ismatrix|ismember|ismethod|isnan|isnumeric|isobject|isocaps|isocolors|isonormals|isosurface|ispc|ispref|isprime|isprop|isreal|isrow|isscalar|issorted|isspace|issparse|isstr|isstrprop|isstruct|isstudent|isunix|isvarname|isvector|javaaddpath|javaArray|javachk|javaclasspath|javacomponent|javaMethod|javaMethodEDT|javaObject|javaObjectEDT|javarmpath|jet|keyboard|kron|lasterr|lasterror|lastwarn|lcm|ldivide|ldl|le|legend|legendre|length|libfunctions|libfunctionsview|libisloaded|libpointer|libstruct|license|light|lightangle|lighting|lin2mu|line|lines|linkaxes|linkdata|linkprop|linsolve|linspace|listdlg|listfonts|load|loadlibrary|loadobj|log|log10|log1p|log2|loglog|logm|logspace|lookfor|lower|ls|lscov|lsqnonneg|lsqr|lt|lu|luinc|magic|makehgtform|mat2cell|mat2str|material|matfile|matlab.io.MatFile|matlab.mixin.(?:Copyable|Heterogeneous(?:.getDefaultScalarElement)?)|matlabrc|matlabroot|max|maxNumCompThreads|mean|median|membrane|memmapfile|memory|menu|mesh|meshc|meshgrid|meshz|meta.(?:class(?:.fromName)?|DynamicProperty|EnumeratedValue|event|MetaData|method|package(?:.(?:fromName|getAllPackages))?|property)|metaclass|methods|methodsview|mex(?:.getCompilerConfigurations)?|MException|mexext|mfilename|min|minres|minus|mislocked|mkdir|mkpp|mldivide|mlint|mlintrpt|mlock|mmfileinfo|mmreader|mod|mode|more|move|movefile|movegui|movie|movie2avi|mpower|mrdivide|msgbox|mtimes|mu2lin|multibandread|multibandwrite|munlock|namelengthmax|nargchk|narginchk|nargoutchk|native2unicode|nccreate|ncdisp|nchoosek|ncinfo|ncread|ncreadatt|ncwrite|ncwriteatt|ncwriteschema|ndgrid|ndims|ne|NET(?:.(?:addAssembly|Assembly|convertArray|createArray|createGeneric|disableAutoRelease|enableAutoRelease|GenericClass|invokeGenericMethod|NetException|setStaticProperty))?|netcdf.(?:abort|close|copyAtt|create|defDim|defGrp|defVar|defVarChunking|defVarDeflate|defVarFill|defVarFletcher32|delAtt|endDef|getAtt|getChunkCache|getConstant|getConstantNames|getVar|inq|inqAtt|inqAttID|inqAttName|inqDim|inqDimID|inqDimIDs|inqFormat|inqGrpName|inqGrpNameFull|inqGrpParent|inqGrps|inqLibVers|inqNcid|inqUnlimDims|inqVar|inqVarChunking|inqVarDeflate|inqVarFill|inqVarFletcher32|inqVarID|inqVarIDs|open|putAtt|putVar|reDef|renameAtt|renameDim|renameVar|setChunkCache|setDefaultFormat|setFill|sync)|newplot|nextpow2|nnz|noanimate|nonzeros|norm|normest|not|notebook|now|nthroot|null|num2cell|num2hex|num2str|numel|nzmax|ode(?:113|15i|15s|23|23s|23t|23tb|45)|odeget|odeset|odextend|onCleanup|ones|open|openfig|opengl|openvar|optimget|optimset|or|ordeig|orderfields|ordqz|ordschur|orient|orth|pack|padecoef|pagesetupdlg|pan|pareto|parseSoapResponse|pascal|patch|path|path2rc|pathsep|pathtool|pause|pbaspect|pcg|pchip|pcode|pcolor|pdepe|pdeval|peaks|perl|perms|permute|pie|pink|pinv|planerot|playshow|plot|plot3|plotbrowser|plotedit|plotmatrix|plottools|plotyy|plus|pol2cart|polar|poly|polyarea|polyder|polyeig|polyfit|polyint|polyval|polyvalm|pow2|power|ppval|prefdir|preferences|primes|print|printdlg|printopt|printpreview|prod|profile|profsave|propedit|propertyeditor|psi|publish|PutCharArray|PutFullMatrix|PutWorkspaceData|pwd|qhull|qmr|qr|qrdelete|qrinsert|qrupdate|quad|quad2d|quadgk|quadl|quadv|questdlg|quit|quiver|quiver3|qz|rand|randi|randn|randperm|RandStream(?:.(?:create|getDefaultStream|getGlobalStream|list|setDefaultStream|setGlobalStream))?|rank|rat|rats|rbbox|rcond|rdivide|readasync|real|reallog|realmax|realmin|realpow|realsqrt|record|rectangle|rectint|recycle|reducepatch|reducevolume|refresh|refreshdata|regexp|regexpi|regexprep|regexptranslate|rehash|rem|Remove|RemoveAll|repmat|reset|reshape|residue|restoredefaultpath|rethrow|rgb2hsv|rgb2ind|rgbplot|ribbon|rmappdata|rmdir|rmfield|rmpath|rmpref|rng|roots|rose|rosser|rot90|rotate|rotate3d|round|rref|rsf2csf|run|save|saveas|saveobj|savepath|scatter|scatter3|schur|sec|secd|sech|selectmoveresize|semilogx|semilogy|sendmail|serial|set|setappdata|setdiff|setenv|setfield|setpixelposition|setpref|setstr|setxor|shading|shg|shiftdim|showplottool|shrinkfaces|sign|sin(?:d|h)?|size|slice|smooth3|snapnow|sort|sortrows|sound|soundsc|spalloc|spaugment|spconvert|spdiags|specular|speye|spfun|sph2cart|sphere|spinmap|spline|spones|spparms|sprand|sprandn|sprandsym|sprank|spring|sprintf|spy|sqrt|sqrtm|squeeze|ss2tf|sscanf|stairs|startup|std|stem|stem3|stopasync|str2double|str2func|str2mat|str2num|strcat|strcmp|strcmpi|stream2|stream3|streamline|streamparticles|streamribbon|streamslice|streamtube|strfind|strjust|strmatch|strncmp|strncmpi|strread|strrep|strtok|strtrim|struct2cell|structfun|strvcat|sub2ind|subplot|subsasgn|subsindex|subspace|subsref|substruct|subvolume|sum|summer|superclasses|superiorto|support|surf|surf2patch|surface|surfc|surfl|surfnorm|svd|svds|swapbytes|symamd|symbfact|symmlq|symrcm|symvar|system|tan(?:d|h)?|tar|tempdir|tempname|tetramesh|texlabel|text|textread|textscan|textwrap|tfqmr|throw|tic|Tiff(?:.(?:getTagNames|getVersion))?|timer|timerfind|timerfindall|times|timeseries|title|toc|todatenum|toeplitz|toolboxdir|trace|transpose|trapz|treelayout|treeplot|tril|trimesh|triplequad|triplot|TriRep|TriScatteredInterp|trisurf|triu|tscollection|tsearch|tsearchn|tstool|type|typecast|uibuttongroup|uicontextmenu|uicontrol|uigetdir|uigetfile|uigetpref|uiimport|uimenu|uiopen|uipanel|uipushtool|uiputfile|uiresume|uisave|uisetcolor|uisetfont|uisetpref|uistack|uitable|uitoggletool|uitoolbar|uiwait|uminus|undocheckout|unicode2native|union|unique|unix|unloadlibrary|unmesh|unmkpp|untar|unwrap|unzip|uplus|upper|urlread|urlwrite|usejava|userpath|validateattributes|validatestring|vander|var|vectorize|ver|verctrl|verLessThan|version|vertcat|VideoReader(?:.isPlatformSupported)?|VideoWriter(?:.getProfiles)?|view|viewmtx|visdiff|volumebounds|voronoi|voronoin|wait|waitbar|waitfor|waitforbuttonpress|warndlg|warning|waterfall|wavfinfo|wavplay|wavread|wavrecord|wavwrite|web|weekday|what|whatsnew|which|whitebg|who|whos|wilkinson|winopen|winqueryreg|winter|wk1finfo|wk1read|wk1write|workspace|xlabel|xlim|xlsfinfo|xlsread|xlswrite|xmlread|xmlwrite|xor|xslt|ylabel|ylim|zeros|zip|zlabel|zlim|zoom|addedvarplot|andrewsplot|anova(?:1|2|n)|ansaribradley|aoctool|barttest|bbdesign|beta(?:cdf|fit|inv|like|pdf|rnd|stat)|bino(?:cdf|fit|inv|pdf|rnd|stat)|biplot|bootci|bootstrp|boxplot|candexch|candgen|canoncorr|capability|capaplot|caseread|casewrite|categorical|ccdesign|cdfplot|chi2(?:cdf|gof|inv|pdf|rnd|stat)|cholcov|Classification(?:BaggedEnsemble|Discriminant(?:.(?:fit|make|template))?|Ensemble|KNN(?:.(?:fit|template))?|PartitionedEnsemble|PartitionedModel|Tree(?:.(?:fit|template))?)|classify|classregtree|cluster|clusterdata|cmdscale|combnk|Compact(?:Classification(?:Discriminant|Ensemble|Tree)|Regression(?:Ensemble|Tree)|TreeBagger)|confusionmat|controlchart|controlrules|cophenet|copula(?:cdf|fit|param|pdf|rnd|stat)|cordexch|corr|corrcov|coxphfit|createns|crosstab|crossval|cvpartition|datasample|dataset|daugment|dcovary|dendrogram|dfittool|disttool|dummyvar|dwtest|ecdf|ecdfhist|ev(?:cdf|fit|inv|like|pdf|rnd|stat)|ExhaustiveSearcher|exp(?:cdf|fit|inv|like|pdf|rnd|stat)|factoran|fcdf|ff2n|finv|fitdist|fitensemble|fpdf|fracfact|fracfactgen|friedman|frnd|fstat|fsurfht|fullfact|gagerr|gam(?:cdf|fit|inv|like|pdf|rnd|stat)|GeneralizedLinearModel(?:.fit)?|geo(?:cdf|inv|mean|pdf|rnd|stat)|gev(?:cdf|fit|inv|like|pdf|rnd|stat)|gline|glmfit|glmval|glyphplot|gmdistribution(?:.fit)?|gname|gp(?:cdf|fit|inv|like|pdf|rnd|stat)|gplotmatrix|grp2idx|grpstats|gscatter|haltonset|harmmean|hist3|histfit|hmm(?:decode|estimate|generate|train|viterbi)|hougen|hyge(?:cdf|inv|pdf|rnd|stat)|icdf|inconsistent|interactionplot|invpred|iqr|iwishrnd|jackknife|jbtest|johnsrnd|KDTreeSearcher|kmeans|knnsearch|kruskalwallis|ksdensity|kstest|kstest2|kurtosis|lasso|lassoglm|lassoPlot|leverage|lhsdesign|lhsnorm|lillietest|LinearModel(?:.fit)?|linhyptest|linkage|logn(?:cdf|fit|inv|like|pdf|rnd|stat)|lsline|mad|mahal|maineffectsplot|manova1|manovacluster|mdscale|mhsample|mle|mlecov|mnpdf|mnrfit|mnrnd|mnrval|moment|multcompare|multivarichart|mvn(?:cdf|pdf|rnd)|mvregress|mvregresslike|mvt(?:cdf|pdf|rnd)|NaiveBayes(?:.fit)?|nan(?:cov|max|mean|median|min|std|sum|var)|nbin(?:cdf|fit|inv|pdf|rnd|stat)|ncf(?:cdf|inv|pdf|rnd|stat)|nct(?:cdf|inv|pdf|rnd|stat)|ncx2(?:cdf|inv|pdf|rnd|stat)|NeighborSearcher|nlinfit|nlintool|nlmefit|nlmefitsa|nlparci|nlpredci|nnmf|nominal|NonLinearModel(?:.fit)?|norm(?:cdf|fit|inv|like|pdf|rnd|stat)|normplot|normspec|ordinal|outlierMeasure|parallelcoords|paretotails|partialcorr|pcacov|pcares|pdf|pdist|pdist2|pearsrnd|perfcurve|perms|piecewisedistribution|plsregress|poiss(?:cdf|fit|inv|pdf|rnd|tat)|polyconf|polytool|prctile|princomp|ProbDist(?:Kernel|Parametric|UnivKernel|UnivParam)?|probplot|procrustes|qqplot|qrandset|qrandstream|quantile|randg|random|randsample|randtool|range|rangesearch|ranksum|rayl(?:cdf|fit|inv|pdf|rnd|stat)|rcoplot|refcurve|refline|regress|Regression(?:BaggedEnsemble|Ensemble|PartitionedEnsemble|PartitionedModel|Tree(?:.(?:fit|template))?)|regstats|relieff|ridge|robustdemo|robustfit|rotatefactors|rowexch|rsmdemo|rstool|runstest|sampsizepwr|scatterhist|sequentialfs|signrank|signtest|silhouette|skewness|slicesample|sobolset|squareform|statget|statset|stepwise|stepwisefit|surfht|tabulate|tblread|tblwrite|tcdf|tdfread|tiedrank|tinv|tpdf|TreeBagger|treedisp|treefit|treeprune|treetest|treeval|trimmean|trnd|tstat|ttest|ttest2|unid(?:cdf|inv|pdf|rnd|stat)|unif(?:cdf|inv|it|pdf|rnd|stat)|vartest(?:2|n)?|wbl(?:cdf|fit|inv|like|pdf|rnd|stat)|wblplot|wishrnd|x2fx|xptread|zscore|ztestadapthisteq|analyze75info|analyze75read|applycform|applylut|axes2pix|bestblk|blockproc|bwarea|bwareaopen|bwboundaries|bwconncomp|bwconvhull|bwdist|bwdistgeodesic|bweuler|bwhitmiss|bwlabel|bwlabeln|bwmorph|bwpack|bwperim|bwselect|bwtraceboundary|bwulterode|bwunpack|checkerboard|col2im|colfilt|conndef|convmtx2|corner|cornermetric|corr2|cp2tform|cpcorr|cpselect|cpstruct2pairs|dct2|dctmtx|deconvblind|deconvlucy|deconvreg|deconvwnr|decorrstretch|demosaic|dicom(?:anon|dict|info|lookup|read|uid|write)|edge|edgetaper|entropy|entropyfilt|fan2para|fanbeam|findbounds|fliptform|freqz2|fsamp2|fspecial|ftrans2|fwind1|fwind2|getheight|getimage|getimagemodel|getline|getneighbors|getnhood|getpts|getrangefromclass|getrect|getsequence|gray2ind|graycomatrix|graycoprops|graydist|grayslice|graythresh|hdrread|hdrwrite|histeq|hough|houghlines|houghpeaks|iccfind|iccread|iccroot|iccwrite|idct2|ifanbeam|im2bw|im2col|im2double|im2int16|im2java2d|im2single|im2uint16|im2uint8|imabsdiff|imadd|imadjust|ImageAdapter|imageinfo|imagemodel|imapplymatrix|imattributes|imbothat|imclearborder|imclose|imcolormaptool|imcomplement|imcontour|imcontrast|imcrop|imdilate|imdisplayrange|imdistline|imdivide|imellipse|imerode|imextendedmax|imextendedmin|imfill|imfilter|imfindcircles|imfreehand|imfuse|imgca|imgcf|imgetfile|imhandles|imhist|imhmax|imhmin|imimposemin|imlincomb|imline|immagbox|immovie|immultiply|imnoise|imopen|imoverview|imoverviewpanel|impixel|impixelinfo|impixelinfoval|impixelregion|impixelregionpanel|implay|impoint|impoly|impositionrect|improfile|imputfile|impyramid|imreconstruct|imrect|imregconfig|imregionalmax|imregionalmin|imregister|imresize|imroi|imrotate|imsave|imscrollpanel|imshow|imshowpair|imsubtract|imtool|imtophat|imtransform|imview|ind2gray|ind2rgb|interfileinfo|interfileread|intlut|ippl|iptaddcallback|iptcheckconn|iptcheckhandle|iptcheckinput|iptcheckmap|iptchecknargin|iptcheckstrs|iptdemos|iptgetapi|iptGetPointerBehavior|iptgetpref|ipticondir|iptnum2ordinal|iptPointerManager|iptprefs|iptremovecallback|iptSetPointerBehavior|iptsetpref|iptwindowalign|iradon|isbw|isflat|isgray|isicc|isind|isnitf|isrgb|isrset|lab2double|lab2uint16|lab2uint8|label2rgb|labelmatrix|makecform|makeConstrainToRectFcn|makehdr|makelut|makeresampler|maketform|mat2gray|mean2|medfilt2|montage|nitfinfo|nitfread|nlfilter|normxcorr2|ntsc2rgb|openrset|ordfilt2|otf2psf|padarray|para2fan|phantom|poly2mask|psf2otf|qtdecomp|qtgetblk|qtsetblk|radon|rangefilt|reflect|regionprops|registration.metric.(?:MattesMutualInformation|MeanSquares)|registration.optimizer.(?:OnePlusOneEvolutionary|RegularStepGradientDescent)|rgb2gray|rgb2ntsc|rgb2ycbcr|roicolor|roifill|roifilt2|roipoly|rsetwrite|std2|stdfilt|strel|stretchlim|subimage|tformarray|tformfwd|tforminv|tonemap|translate|truesize|uintlut|viscircles|warp|watershed|whitepoint|wiener2|xyz2double|xyz2uint16|ycbcr2rgb|bintprog|color|fgoalattain|fminbnd|fmincon|fminimax|fminsearch|fminunc|fseminf|fsolve|fzero|fzmult|gangstr|ktrlink|linprog|lsqcurvefit|lsqlin|lsqnonlin|lsqnonneg|optimget|optimset|optimtool|quadprog\",r=\"cell|struct|char|double|single|logical|u?int(?:8|16|32|64)|sparse\",i=this.createKeywordMapper({\"storage.type\":r,\"support.function\":n,keyword:e,\"constant.language\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"%[^\\r\\n]*\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.MatlabHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-mel.js",
    "content": "define(\"ace/mode/mel\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/mel_highlight_rules\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./mel_highlight_rules\").MELHighlightRules,o=e(\"./behaviour/cstyle\").CstyleBehaviour,u=e(\"./folding/cstyle\").FoldMode,a=function(){this.HighlightRules=s,this.$behaviour=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/mel\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/mel_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{caseInsensitive:!0,token:\"storage.type.mel\",regex:\"\\\\b(matrix|string|vector|float|int|void)\\\\b\"},{caseInsensitive:!0,token:\"support.function.mel\",regex:\"\\\\b((s(h(ow(ManipCtx|S(hadingGroupAttrEditor|electionInTitle)|H(idden|elp)|Window)|el(f(Button|TabLayout|Layout)|lField)|ading(GeometryRelCtx|Node|Connection|LightRelCtx))|y(s(tem|File)|mbol(Button|CheckBox))|nap(shot|Mode|2to2 |TogetherCtx|Key)|c(ulpt|ene(UIReplacement|Editor)|ale(BrushBrightness |Constraint|Key(Ctx)?)?|r(ipt(Node|Ctx|Table|edPanel(Type)?|Job|EditorInfo)|oll(Field|Layout))|mh)|t(itch(Surface(Points)?|AndExplodeShell )|a(ckTrace|rt(sWith |String ))|r(cmp|i(ng(ToStringArray |Array(Remove(Duplicates | )|C(ount |atenate )|ToString |Intersector))|p )|oke))|i(n(gleProfileBirailSurface)?|ze|gn|mplify)|o(u(nd(Control)?|rce)|ft(Mod(Ctx)?)?|rt)|u(perCtx|rface(S(haderList|ampler))?|b(st(itute(Geometry|AllString )?|ring)|d(M(irror|a(tchTopology|p(SewMove|Cut)))|iv(Crease|DisplaySmoothness)?|C(ollapse|leanTopology)|T(o(Blind|Poly)|ransferUVsToCache)|DuplicateAndConnect|EditUV|ListComponentConversion|AutoProjection)))|p(h(ere|rand)|otLight(PreviewPort)?|aceLocator|r(ing|eadSheetEditor))|e(t(s|MenuMode|Sta(te |rtupMessage|mpDensity )|NodeTypeFlag|ConstraintRestPosition |ToolTo|In(putDeviceMapping|finity)|D(ynamic|efaultShadingGroup|rivenKeyframe)|UITemplate|P(ar(ticleAttr|ent)|roject )|E(scapeCtx|dit(or|Ctx))|Key(Ctx|frame|Path)|F(ocus|luidAttr)|Attr(Mapping)?)|parator|ed|l(ect(Mode|ionConnection|Context|Type|edNodes|Pr(iority|ef)|Key(Ctx)?)?|LoadSettings)|archPathArray )|kin(Cluster|Percent)|q(uareSurface|rt)|w(itchTable|atchDisplayPort)|a(ve(Menu|Shelf|ToolSettings|I(nitialState|mage)|Pref(s|Objects)|Fluid|A(ttrPreset |llShelves))|mpleImage)|rtContext|mooth(step|Curve|TangentSurface))|h(sv_to_rgb|yp(ot|er(Graph|Shade|Panel))|i(tTest|de|lite)|ot(Box|key(Check)?)|ud(Button|Slider(Button)?)|e(lp(Line)?|adsUpDisplay|rmite)|wRe(nder(Load)?|flectionMap)|ard(enPointCurve|ware(RenderPanel)?))|n(o(nLinear|ise|de(Type|IconButton|Outliner|Preset)|rmal(ize |Constraint))|urbs(Boolean|S(elect|quare)|C(opyUVSet|ube)|To(Subdiv|Poly(gonsPref)?)|Plane|ViewDirectionVector )|ew(ton|PanelItems)|ame(space(Info)?|Command|Field))|c(h(oice|dir|eck(Box(Grp)?|DefaultRenderGlobals)|a(n(nelBox|geSubdiv(Region|ComponentDisplayLevel))|racter(Map|OutlineEditor)?))|y(cleCheck|linder)|tx(Completion|Traverse|EditMode|Abort)|irc(ularFillet|le)|o(s|n(str(uctionHistory|ain(Value)?)|nect(ionInfo|Control|Dynamic|Joint|Attr)|t(extInfo|rol)|dition|e|vert(SolidTx|Tessellation|Unit|FromOldLayers |Lightmap)|firmDialog)|py(SkinWeights|Key|Flexor|Array )|l(or(Slider(Grp|ButtonGrp)|Index(SliderGrp)?|Editor|AtPoint)?|umnLayout|lision)|arsenSubdivSelectionList|m(p(onentEditor|utePolysetVolume |actHairSystem )|mand(Port|Echo|Line)))|u(tKey|r(ve(MoveEPCtx|SketchCtx|CVCtx|Intersect|OnSurface|E(ditorCtx|PCtx)|AddPtCtx)?|rent(Ctx|Time(Ctx)?|Unit)))|p(GetSolverAttr|Button|S(olver(Types)?|e(t(SolverAttr|Edit)|am))|C(o(nstraint|llision)|ache)|Tool|P(anel|roperty))|eil|l(ip(Schedule(rOutliner)?|TrimBefore |Editor(CurrentTimeCtx)?)?|ose(Surface|Curve)|uster|ear(Cache)?|amp)|a(n(CreateManip|vas)|tch(Quiet)?|pitalizeString |mera(View)?)|r(oss(Product )?|eate(RenderLayer|MotionField |SubdivRegion|N(ode|ewShelf )|D(isplayLayer|rawCtx)|Editor))|md(Shell|FileOutput))|M(R(ender(ShadowData|Callback|Data|Util|View|Line(Array)?)|ampAttribute)|G(eometryData|lobal)|M(odelMessage|essage|a(nipData|t(erial|rix)))|BoundingBox|S(yntax|ceneMessage|t(atus|ring(Array)?)|imple|pace|elect(ion(Mask|List)|Info)|watchRender(Register|Base))|H(ardwareRenderer|WShaderSwatchGenerator)|NodeMessage|C(o(nditionMessage|lor(Array)?|m(putation|mand(Result|Message)))|ursor|loth(Material|S(ystem|olverRegister)|Con(straint|trol)|Triangle|Particle|Edge|Force)|allbackIdArray)|T(ypeId|ime(r(Message)?|Array)?|oolsInfo|esselationParams|r(imBoundaryArray|ansformationMatrix))|I(ntArray|t(Geometry|Mesh(Polygon|Edge|Vertex|FaceVertex)|S(urfaceCV|electionList)|CurveCV|Instancer|eratorType|D(ependency(Graph|Nodes)|ag)|Keyframe)|k(System|HandleGroup)|mage)|3dView|Object(SetMessage|Handle|Array)?|D(G(M(odifier|essage)|Context)|ynSwept(Triangle|Line)|istance|oubleArray|evice(State|Channel)|a(ta(Block|Handle)|g(M(odifier|essage)|Path(Array)?))|raw(Request(Queue)?|Info|Data|ProcedureBase))|U(serEventMessage|i(nt(Array|64Array)|Message))|P(o(int(Array)?|lyMessage)|lug(Array)?|rogressWindow|x(G(eometry(Iterator|Data)|lBuffer)|M(idiInputDevice|odelEditorCommand|anipContainer)|S(urfaceShape(UI)?|pringNode|electionContext)|HwShaderNode|Node|Co(ntext(Command)?|m(ponentShape|mand))|T(oolCommand|ransform(ationMatrix)?)|IkSolver(Node)?|3dModelView|ObjectSet|D(eformerNode|ata|ragAndDropBehavior)|PolyT(weakUVCommand|rg)|EmitterNode|F(i(eldNode|leTranslator)|luidEmitterNode)|LocatorNode))|E(ulerRotation|vent(Message)?)|ayatomr|Vector(Array)?|Quaternion|F(n(R(otateManip|eflectShader|adialField)|G(e(nericAttribute|ometry(Data|Filter))|ravityField)|M(otionPath|es(sageAttribute|h(Data)?)|a(nip3D|trix(Data|Attribute)))|B(l(innShader|endShapeDeformer)|ase)|S(caleManip|t(ateManip|ring(Data|ArrayData))|ingleIndexedComponent|ubd(Names|Data)?|p(hereData|otLight)|et|kinCluster)|HikEffector|N(on(ExtendedLight|AmbientLight)|u(rbs(Surface(Data)?|Curve(Data)?)|meric(Data|Attribute))|ewtonField)|C(haracter|ircleSweepManip|ompo(nent(ListData)?|undAttribute)|urveSegmentManip|lip|amera)|T(ypedAttribute|oggleManip|urbulenceField|r(ipleIndexedComponent|ansform))|I(ntArrayData|k(Solver|Handle|Joint|Effector))|D(ynSweptGeometryData|i(s(cManip|tanceManip)|rection(Manip|alLight))|ouble(IndexedComponent|ArrayData)|ependencyNode|a(ta|gNode)|ragField)|U(ni(tAttribute|formField)|Int64ArrayData)|P(hong(Shader|EShader)|oint(On(SurfaceManip|CurveManip)|Light|ArrayData)|fxGeometry|lugin(Data)?|arti(cleSystem|tion))|E(numAttribute|xpression)|V(o(lume(Light|AxisField)|rtexField)|ectorArrayData)|KeyframeDelta(Move|B(lockAddRemove|reakdown)|Scale|Tangent|InfType|Weighted|AddRemove)?|F(ield|luid|reePointTriadManip)|W(ireDeformer|eightGeometryFilter)|L(ight(DataAttribute)?|a(yeredShader|ttice(D(eformer|ata))?|mbertShader))|A(ni(sotropyShader|mCurve)|ttribute|irField|r(eaLight|rayAttrsData)|mbientLight))?|ile(IO|Object)|eedbackLine|loat(Matrix|Point(Array)?|Vector(Array)?|Array))|L(i(ghtLinks|brary)|ockMessage)|A(n(im(Message|C(ontrol|urveC(hange|lipboard(Item(Array)?)?))|Util)|gle)|ttribute(Spec(Array)?|Index)|r(rayData(Builder|Handle)|g(Database|Parser|List))))|t(hreePointArcCtx|ime(Control|Port|rX)|o(ol(Button|HasOptions|Collection|Dropped|PropertyWindow)|NativePath |upper|kenize(List )?|l(ower|erance)|rus|ggle(WindowVisibility|Axis)?)|u(rbulence|mble(Ctx)?)|ex(RotateContext|M(oveContext|anipContext)|t(ScrollList|Curves|ure(HairColor |DisplacePlane |PlacementContext|Window)|ToShelf |Field(Grp|ButtonGrp)?)?|S(caleContext|electContext|mudgeUVContext)|WinToolCtx)|woPointArcCtx|a(n(gentConstraint)?|bLayout)|r(im|unc(ate(HairCache|FluidCache))?|a(ns(formLimits|lator)|c(e|k(Ctx)?))))|i(s(olateSelect|Connected|True|Dirty|ParentOf |Valid(String |ObjectName |UiName )|AnimCurve )|n(s(tance(r)?|ert(Joint(Ctx)?|K(not(Surface|Curve)|eyCtx)))|heritTransform|t(S(crollBar|lider(Grp)?)|er(sect|nalVar|ToUI )|Field(Grp)?))|conText(Radio(Button|Collection)|Button|StaticLabel|CheckBox)|temFilter(Render|Type|Attr)?|prEngine|k(S(ystem(Info)?|olver|plineHandleCtx)|Handle(Ctx|DisplayScale)?|fkDisplayMethod)|m(portComposerCurves |fPlugins|age))|o(ceanNurbsPreviewPlane |utliner(Panel|Editor)|p(tion(Menu(Grp)?|Var)|en(GLExtension|MayaPref))|verrideModifier|ffset(Surface|Curve(OnSurface)?)|r(ientConstraint|bit(Ctx)?)|b(soleteProc |j(ect(Center|Type(UI)?|Layer )|Exists)))|d(yn(RelEd(itor|Panel)|Globals|C(ontrol|ache)|P(a(intEditor|rticleCtx)|ref)|Exp(ort|ression)|amicLoad)|i(s(connect(Joint|Attr)|tanceDim(Context|ension)|pla(y(RGBColor|S(tats|urface|moothness)|C(olor|ull)|Pref|LevelOfDetail|Affected)|cementToPoly)|kCache|able)|r(name |ect(ionalLight|KeyCtx)|map)|mWhen)|o(cServer|Blur|t(Product )?|ubleProfileBirailSurface|peSheetEditor|lly(Ctx)?)|uplicate(Surface|Curve)?|e(tach(Surface|Curve|DeviceAttr)|vice(Panel|Editor)|f(ine(DataServer|VirtualDevice)|ormer|ault(Navigation|LightListCheckBox))|l(ete(Sh(elfTab |adingGroupsAndMaterials )|U(nusedBrushes |I)|Attr)?|randstr)|g_to_rad)|agPose|r(opoffLocator|ag(gerContext)?)|g(timer|dirty|Info|eval))|CBG |u(serCtx|n(t(angleUV|rim)|i(t|form)|do(Info)?|loadPlugin|assignInputDevice|group)|iTemplate|p(dateAE |Axis)|v(Snapshot|Link))|joint(C(tx|luster)|DisplayScale|Lattice)?|p(sd(ChannelOutliner|TextureFile|E(ditTextureFile|xport))|close|i(c(ture|kWalk)|xelMove)|o(se|int(MatrixMult |C(onstraint|urveConstraint)|On(Surface|Curve)|Position|Light)|p(upMenu|en)|w|l(y(Reduce|GeoSampler|M(irrorFace|ove(UV|Edge|Vertex|Facet(UV)?)|erge(UV|Edge(Ctx)?|Vertex|Facet(Ctx)?)|ap(Sew(Move)?|Cut|Del))|B(oolOp|evel|l(indData|endColor))|S(traightenUVBorder|oftEdge|u(perCtx|bdivide(Edge|Facet))|p(her(icalProjection|e)|lit(Ring|Ctx|Edge|Vertex)?)|e(tToFaceNormal|parate|wEdge|lect(Constraint(Monitor)?|EditCtx))|mooth)|Normal(izeUV|PerVertex)?|C(hipOff|ylind(er|ricalProjection)|o(ne|pyUV|l(or(BlindData|Set|PerVertex)|lapse(Edge|Facet)))|u(t(Ctx)?|be)|l(ipboard|oseBorder)|acheMonitor|rea(seEdge|teFacet(Ctx)?))|T(o(Subdiv|rus)|r(iangulate|ansfer))|In(stallAction|fo)|Options|D(uplicate(Edge|AndConnect)|el(Edge|Vertex|Facet))|U(nite|VSet)|P(yramid|oke|lan(e|arProjection)|r(ism|ojection))|E(ditUV|valuate|xtrude(Edge|Facet))|Qu(eryBlindData|ad)|F(orceUV|lip(UV|Edge))|WedgeFace|L(istComponentConversion|ayoutUV)|A(utoProjection|ppend(Vertex|FacetCtx)?|verage(Normal|Vertex)))|eVectorConstraint))|utenv|er(cent|formanceOptions)|fxstrokes|wd|l(uginInfo|a(y(b(last|ackOptions))?|n(e|arSrf)))|a(steKey|ne(l(History|Configuration)?|Layout)|thAnimation|irBlend|use|lettePort|r(ti(cle(RenderInfo|Instancer|Exists)?|tion)|ent(Constraint)?|am(Dim(Context|ension)|Locator)))|r(int|o(j(ect(ion(Manip|Context)|Curve|Tangent)|FileViewer)|pMo(dCtx|ve)|gress(Bar|Window)|mptDialog)|eloadRefEd))|e(n(codeString|d(sWith |String )|v|ableDevice)|dit(RenderLayer(Globals|Members)|or(Template)?|DisplayLayer(Globals|Members)|AttrLimits )|v(ent|al(Deferred|Echo)?)|quivalent(Tol | )|ffector|r(f|ror)|x(clusiveLightCheckBox|t(end(Surface|Curve)|rude)|ists|p(ortComposerCurves |ression(EditorListen)?)?|ec(uteForEachObject )?|actWorldBoundingBox)|mit(ter)?)|v(i(sor|ew(Set|HeadOn|2dToolCtx|C(lipPlane|amera)|Place|Fit|LookAt))|o(lumeAxis|rtex)|e(ctorize|rifyCmd )|alidateShelfName )|key(Tangent|frame(Region(MoveKeyCtx|S(caleKeyCtx|e(tKeyCtx|lectKeyCtx))|CurrentTimeCtx|TrackCtx|InsertKeyCtx|D(irectKeyCtx|ollyCtx))|Stats|Outliner)?)|qu(it|erySubdiv)|f(c(heck|lose)|i(nd(RelatedSkinCluster |MenuItem |er|Keyframe|AllIntersections )|tBspline|l(ter(StudioImport|Curve|Expand)?|e(BrowserDialog|test|Info|Dialog|Extension )?|letCurve)|rstParentOf )|o(ntDialog|pen|rmLayout)|print|eof|flush|write|l(o(or|w|at(S(crollBar|lider(Grp|ButtonGrp|2)?)|Eq |Field(Grp)?))|u(shUndo|id(CacheInfo|Emitter|VoxelInfo))|exor)|r(omNativePath |e(eFormFillet|wind|ad)|ameLayout)|get(word|line)|mod)|w(hatIs|i(ndow(Pref)?|re(Context)?)|orkspace|ebBrowser(Prefs)?|a(itCursor|rning)|ri(nkle(Context)?|teTake))|l(s(T(hroughFilter|ype )|UI)?|i(st(Relatives|MenuAnnotation |Sets|History|NodeTypes|C(onnections|ameras)|Transforms |InputDevice(s|Buttons|Axes)|erEditor|DeviceAttachments|Unselected |A(nimatable|ttr))|n(step|eIntersection )|ght(link|List(Panel|Editor)?))|o(ckNode|okThru|ft|ad(NewShelf |P(lugin|refObjects)|Fluid)|g)|a(ssoContext|y(out|er(Button|ed(ShaderPort|TexturePort)))|ttice(DeformKeyCtx)?|unch(ImageEditor)?))|a(ssign(Command|InputDevice)|n(notate|im(C(one|urveEditor)|Display|View)|gle(Between)?)|tt(ach(Surface|Curve|DeviceAttr)|r(ibute(Menu|Info|Exists|Query)|NavigationControlGrp|Co(ntrolGrp|lorSliderGrp|mpatibility)|PresetEditWin|EnumOptionMenu(Grp)?|Field(Grp|SliderGrp)))|i(r|mConstraint)|d(d(NewShelfTab|Dynamic|PP|Attr(ibuteEditorNodeHelp)?)|vanceToNextDrivenKey)|uto(Place|Keyframe)|pp(endStringArray|l(y(Take|AttrPreset)|icationName))|ffect(s|edNet)|l(i(as(Attr)?|gn(Surface|C(tx|urve))?)|lViewFit)|r(c(len|Len(DimContext|gthDimension))|t(BuildPaintMenu|Se(tPaintCtx|lectCtx)|3dPaintCtx|UserPaintCtx|PuttyCtx|FluidAttrCtx|Attr(SkinPaintCtx|Ctx|PaintVertexCtx))|rayMapper)|mbientLight|b(s|out))|r(igid(Body|Solver)|o(t(at(ionInterpolation|e))?|otOf |undConstantRadius|w(ColumnLayout|Layout)|ll(Ctx)?)|un(up|TimeCommand)|e(s(olutionNode|et(Tool|AE )|ampleFluid)|hash|n(der(GlobalsNode|Manip|ThumbnailUpdate|Info|er|Partition|QualityNode|Window(SelectContext|Editor)|LayerButton)?|ame(SelectionList |UI|Attr)?)|cord(Device|Attr)|target|order(Deformers)?|do|v(olve|erse(Surface|Curve))|quires|f(ineSubdivSelectionList|erence(Edit|Query)?|resh(AE )?)|loadImage|adTake|root|move(MultiInstance|Joint)|build(Surface|Curve))|a(n(d(state|omizeFollicles )?|geControl)|d(i(o(MenuItemCollection|Button(Grp)?|Collection)|al)|_to_deg)|mpColorPort)|gb_to_hsv)|g(o(toBindPose |al)|e(t(M(odifiers|ayaPanelTypes )|Classification|InputDeviceRange|pid|env|DefaultBrush|Pa(nel|rticleAttr)|F(ileList|luidAttr)|A(ttr|pplicationVersionAsFloat ))|ometryConstraint)|l(Render(Editor)?|obalStitch)|a(uss|mma)|r(id(Layout)?|oup(ObjectsByName )?|a(dientControl(NoAttr)?|ph(SelectContext|TrackCtx|DollyCtx)|vity|bColor))|match)|x(pmPicker|form|bmLangPathList )|m(i(n(imizeApp)?|rrorJoint)|o(del(CurrentTimeCtx|Panel|Editor)|use|v(In|e(IKtoFK |VertexAlongDirection|KeyCtx)?|Out))|u(te|ltiProfileBirailSurface)|e(ssageLine|nu(BarLayout|Item(ToShelf )?|Editor)?|mory)|a(nip(Rotate(Context|LimitsCtx)|Move(Context|LimitsCtx)|Scale(Context|LimitsCtx)|Options)|tch|ke(Roll |SingleSurface|TubeOn |Identity|Paintable|bot|Live)|rker|g|x))|b(in(Membership|d(Skin|Pose))|o(neLattice|undary|x(ZoomCtx|DollyCtx))|u(tton(Manip)?|ild(BookmarkMenu|KeyframeMenu)|fferCurve)|e(ssel|vel(Plus)?)|l(indDataType|end(Shape(Panel|Editor)?|2|TwoAttr))|a(sename(Ex | )|tchRender|ke(Results|Simulation|Clip|PartialHistory|FluidShading )))))\\\\b\"},{caseInsensitive:!0,token:\"support.constant.mel\",regex:\"\\\\b(s(h(ellTessellate|a(d(ing(Map|Engine)|erGlow)|pe))|n(ow|apshot(Shape)?)|c(ulpt|aleConstraint|ript)|t(yleCurve|itch(Srf|AsNurbsShell)|u(cco|dioClearCoat)|encil|roke(Globals)?)|i(ngleShadingSwitch|mpleVolumeShader)|o(ftMod(Manip|Handle)?|lidFractal)|u(rface(Sha(der|pe)|Info|EdManip|VarGroup|Luminance)|b(Surface|d(M(odifier(UV|World)?|ap(SewMove|Cut|pingManip))|B(lindData|ase)|iv(ReverseFaces|SurfaceVarGroup|Co(llapse|mponentId)|To(Nurbs|Poly))?|HierBlind|CleanTopology|Tweak(UV)?|P(lanarProj|rojManip)|LayoutUV|A(ddTopology|utoProj))|Curve))|p(BirailSrf|otLight|ring)|e(tRange|lectionListOperator)|k(inCluster|etchPlane)|quareSrf|ampler(Info)?|m(ooth(Curve|TangentSrf)|ear))|h(svToRgb|yper(GraphInfo|View|Layout)|ik(Solver|Handle|Effector)|oldMatrix|eightField|w(Re(nderGlobals|flectionMap)|Shader)|a(ir(System|Constraint|TubeShader)|rd(enPoint|wareRenderGlobals)))|n(o(n(ExtendedLightShapeNode|Linear|AmbientLightShapeNode)|ise|rmalConstraint)|urbs(Surface|Curve|T(oSubdiv(Proc)?|essellate)|DimShape)|e(twork|wtonField))|c(h(o(ice|oser)|ecker|aracter(Map|Offset)?)|o(n(straint|tr(olPoint|ast)|dition)|py(ColorSet|UVSet))|urve(Range|Shape|Normalizer(Linear|Angle)?|In(tersect|fo)|VarGroup|From(Mesh(CoM|Edge)?|Su(rface(Bnd|CoS|Iso)?|bdiv(Edge|Face)?)))|l(ip(Scheduler|Library)|o(se(stPointOnSurface|Surface|Curve)|th|ud)|uster(Handle)?|amp)|amera(View)?|r(eate(BPManip|ColorSet|UVSet)|ater))|t(ime(ToUnitConversion|Function)?|oo(nLineAttributes|lDrawManip)|urbulenceField|ex(BaseDeformManip|ture(BakeSet|2d|ToGeom|3d|Env)|SmudgeUVManip|LatticeDeformManip)|weak|angentConstraint|r(i(pleShadingSwitch|m(WithBoundaries)?)|ansform(Geometry)?))|i(n(s(tancer|ertKnot(Surface|Curve))|tersectSurface)|k(RPsolver|MCsolver|S(ystem|olver|Csolver|plineSolver)|Handle|PASolver|Effector)|m(plicit(Box|Sphere|Cone)|agePlane))|o(cean(Shader)?|pticalFX|ffset(Surface|C(os|urve))|ldBlindDataBase|rient(Constraint|ationMarker)|bject(RenderFilter|MultiFilter|BinFilter|S(criptFilter|et)|NameFilter|TypeFilter|Filter|AttrFilter))|d(yn(Globals|Base)|i(s(tance(Between|DimShape)|pla(yLayer(Manager)?|cementShader)|kCache)|rect(ionalLight|edDisc)|mensionShape)|o(ubleShadingSwitch|f)|pBirailSrf|e(tach(Surface|Curve)|pendNode|f(orm(Bend|S(ine|quash)|Twist|ableShape|F(unc|lare)|Wave)|ault(RenderUtilityList|ShaderList|TextureList|LightList))|lete(Co(lorSet|mponent)|UVSet))|ag(Node|Pose)|r(opoffLocator|agField))|u(seBackground|n(trim|i(t(Conversion|ToTimeConversion)|formField)|known(Transform|Dag)?)|vChooser)|j(iggle|oint(Cluster|Ffd|Lattice)?)|p(sdFileTex|hong(E)?|o(s(tProcessList|itionMarker)|int(MatrixMult|Constraint|On(SurfaceInfo|CurveInfo)|Emitter|Light)|l(y(Reduce|M(irror|o(difier(UV|World)?|ve(UV|Edge|Vertex|Face(tUV)?))|erge(UV|Edge|Vert|Face)|ap(Sew(Move)?|Cut|Del))|B(oolOp|evel|lindData|ase)|S(traightenUVBorder|oftEdge|ubd(Edge|Face)|p(h(ere|Proj)|lit(Ring|Edge|Vert)?)|e(parate|wEdge)|mooth(Proxy|Face)?)|Normal(izeUV|PerVertex)?|C(hipOff|yl(inder|Proj)|o(ne|pyUV|l(orPerVertex|lapse(Edge|F)))|u(t(Manip(Container)?)?|be)|loseBorder|rea(seEdge|t(or|eFace)))|T(o(Subdiv|rus)|weak(UV)?|r(iangulate|ansfer))|OptUvs|D(uplicateEdge|el(Edge|Vertex|Facet))|Unite|P(yramid|oke(Manip)?|lan(e|arProj)|r(i(sm|mitive)|oj))|Extrude(Edge|Vertex|Face)|VertexNormalManip|Quad|Flip(UV|Edge)|WedgeFace|LayoutUV|A(utoProj|ppend(Vertex)?|verageVertex))|eVectorConstraint))|fx(Geometry|Hair|Toon)|l(usMinusAverage|a(n(e|arTrimSurface)|ce(2dTexture|3dTexture)))|a(ssMatrix|irBlend|r(ti(cle(SamplerInfo|C(olorMapper|loud)|TranspMapper|IncandMapper|AgeMapper)?|tion)|ent(Constraint|Tessellate)|amDimension))|r(imitive|o(ject(ion|Curve|Tangent)|xyManager)))|e(n(tity|v(Ball|ironmentFog|S(phere|ky)|C(hrome|ube)|Fog))|x(t(end(Surface|Curve)|rude)|p(lodeNurbsShell|ression)))|v(iewManip|o(lume(Shader|Noise|Fog|Light|AxisField)|rtexField)|e(ctor(RenderGlobals|Product)|rtexBakeSet))|quadShadingSwitch|f(i(tBspline|eld|l(ter(Resample|Simplify|ClosestSample|Euler)?|e|letCurve))|o(urByFourMatrix|llicle)|urPointOn(MeshInfo|Subd)|f(BlendSrf(Obsolete)?|d|FilletSrf)|l(ow|uid(S(hape|liceManip)|Texture(2D|3D)|Emitter)|exorShape)|ra(ctal|meCache))|w(tAddMatrix|ire|ood|eightGeometryFilter|ater|rap)|l(ight(Info|Fog|Li(st|nker))?|o(cator|okAt|d(Group|Thresholds)|ft)|uminance|ea(stSquaresModifier|ther)|a(yered(Shader|Texture)|ttice|mbert))|a(n(notationShape|i(sotropic|m(Blend(InOut)?|C(urve(T(T|U|L|A)|U(T|U|L|A))?|lip)))|gleBetween)|tt(ach(Surface|Curve)|rHierarchyTest)|i(rField|mConstraint)|dd(Matrix|DoubleLinear)|udio|vg(SurfacePoints|NurbsSurfacePoints|Curves)|lign(Manip|Surface|Curve)|r(cLengthDimension|tAttrPaintTest|eaLight|rayMapper)|mbientLight|bstractBase(NurbsConversion|Create))|r(igid(Body|Solver|Constraint)|o(ck|undConstantRadius)|e(s(olution|ultCurve(TimeTo(Time|Unitless|Linear|Angular))?)|nder(Rect|Globals(List)?|Box|Sphere|Cone|Quality|L(ight|ayer(Manager)?))|cord|v(olve(dPrimitive)?|erse(Surface|Curve)?)|f(erence|lect)|map(Hsv|Color|Value)|build(Surface|Curve))|a(dialField|mp(Shader)?)|gbToHsv|bfSrf)|g(uide|eo(Connect(or|able)|metry(Shape|Constraint|VarGroup|Filter))|lobal(Stitch|CacheControl)|ammaCorrect|r(id|oup(Id|Parts)|a(nite|vityField)))|Fur(Globals|Description|Feedback|Attractors)|xformManip|m(o(tionPath|untain|vie)|u(te|lt(Matrix|i(plyDivide|listerLight)|DoubleLinear))|pBirailSrf|e(sh(VarGroup)?|ntalray(Texture|IblShape))|a(terialInfo|ke(Group|Nurb(sSquare|Sphere|C(ylinder|ircle|one|ube)|Torus|Plane)|CircularArc|T(hreePointCircularArc|extCurves|woPointCircularArc))|rble))|b(irailSrf|o(neLattice|olean|undary(Base)?)|u(lge|mp(2d|3d))|evel(Plus)?|l(in(n|dDataTemplate)|end(Shape|Color(s|Sets)|TwoAttr|Device|Weighted)?)|a(se(GeometryVarGroup|ShadingSwitch|Lattice)|keSet)|r(ownian|ush)))\\\\b\"},{caseInsensitive:!0,token:\"keyword.control.mel\",regex:\"\\\\b(if|in|else|for|while|break|continue|case|default|do|switch|return|switch|case|source|catch|alias)\\\\b\"},{token:\"keyword.other.mel\",regex:\"\\\\b(global)\\\\b\"},{caseInsensitive:!0,token:\"constant.language.mel\",regex:\"\\\\b(null|undefined)\\\\b\"},{token:\"constant.numeric.mel\",regex:\"\\\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\\\.?[0-9]*)|(\\\\.[0-9]+))((e|E)(\\\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f)?\\\\b\"},{token:\"punctuation.definition.string.begin.mel\",regex:'\"',push:[{token:\"constant.character.escape.mel\",regex:\"\\\\\\\\.\"},{token:\"punctuation.definition.string.end.mel\",regex:'\"',next:\"pop\"},{defaultToken:\"string.quoted.double.mel\"}]},{token:[\"variable.other.mel\",\"punctuation.definition.variable.mel\"],regex:\"(\\\\$)([a-zA-Z_\\\\x7f-\\\\xff][a-zA-Z0-9_\\\\x7f-\\\\xff]*?\\\\b)\"},{token:\"punctuation.definition.string.begin.mel\",regex:\"'\",push:[{token:\"constant.character.escape.mel\",regex:\"\\\\\\\\.\"},{token:\"punctuation.definition.string.end.mel\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.quoted.single.mel\"}]},{token:\"constant.language.mel\",regex:\"\\\\b(false|true|yes|no|on|off)\\\\b\"},{token:\"punctuation.definition.comment.mel\",regex:\"/\\\\*\",push:[{token:\"punctuation.definition.comment.mel\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.mel\"}]},{token:[\"comment.line.double-slash.mel\",\"punctuation.definition.comment.mel\"],regex:\"(//)(.*$\\\\n?)\"},{caseInsensitive:!0,token:\"keyword.operator.mel\",regex:\"\\\\b(instanceof)\\\\b\"},{token:\"keyword.operator.symbolic.mel\",regex:\"[-\\\\!\\\\%\\\\&\\\\*\\\\+\\\\=\\\\/\\\\?\\\\:]\"},{token:[\"meta.preprocessor.mel\",\"punctuation.definition.preprocessor.mel\"],regex:\"(^[ \\\\t]*)((?:#)[a-zA-Z]+)\"},{token:[\"meta.function.mel\",\"keyword.other.mel\",\"storage.type.mel\",\"entity.name.function.mel\",\"punctuation.section.function.mel\"],regex:\"((?:global\\\\s*)?proc)\\\\s*(\\\\w+\\\\s*\\\\[?\\\\]?\\\\s+|\\\\s+)([A-Za-z_][A-Za-z0-9_\\\\.]*)(\\\\s*(\\\\())\",push:[{include:\"$self\"},{token:\"punctuation.section.function.mel\",regex:\"\\\\)\",next:\"pop\"},{defaultToken:\"meta.function.mel\"}]}]},this.normalizeRules()};r.inherits(s,i),t.MELHighlightRules=s}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-mushcode.js",
    "content": "define(\"ace/mode/mushcode\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/mushcode_highlight_rules\",\"ace/mode/folding/pythonic\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./mushcode_highlight_rules\").MushCodeRules,o=e(\"./folding/pythonic\").FoldMode,u=e(\"../range\").Range,a=function(){this.HighlightRules=s,this.foldingRules=new o(\"\\\\:\")};r.inherits(a,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);o&&(r+=n)}return r};var e={pass:1,\"return\":1,raise:1,\"break\":1,\"continue\":1};this.checkOutdent=function(t,n,r){if(r!==\"\\r\\n\"&&r!==\"\\r\"&&r!==\"\\n\")return!1;var i=this.getTokenizer().getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type==\"comment\"||s.type==\"text\"&&s.value.match(/^\\s+$/)));return s?s.type==\"keyword\"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new u(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/mushcode\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/mushcode_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"@if|@ifelse|@switch|@halt|@dolist|@create|@scent|@sound|@touch|@ataste|@osound|@ahear|@aahear|@amhear|@otouch|@otaste|@drop|@odrop|@adrop|@dropfail|@odropfail|@smell|@oemit|@emit|@pemit|@parent|@clone|@taste|whisper|page|say|pose|semipose|teach|touch|taste|smell|listen|look|move|go|home|follow|unfollow|desert|dismiss|@tel\",t=\"=#0\",n=\"default|edefault|eval|get_eval|get|grep|grepi|hasattr|hasattrp|hasattrval|hasattrpval|lattr|nattr|poss|udefault|ufun|u|v|uldefault|xget|zfun|band|bnand|bnot|bor|bxor|shl|shr|and|cand|cor|eq|gt|gte|lt|lte|nand|neq|nor|not|or|t|xor|con|entrances|exit|followers|home|lcon|lexits|loc|locate|lparent|lsearch|next|num|owner|parent|pmatch|rloc|rnum|room|where|zone|worn|held|carried|acos|asin|atan|ceil|cos|e|exp|fdiv|fmod|floor|log|ln|pi|power|round|sin|sqrt|tan|aposs|andflags|conn|commandssent|controls|doing|elock|findable|flags|fullname|hasflag|haspower|hastype|hidden|idle|isbaker|lock|lstats|money|who|name|nearby|obj|objflags|photo|poll|powers|pendingtext|receivedtext|restarts|restarttime|subj|shortestpath|tmoney|type|visible|cat|element|elements|extract|filter|filterbool|first|foreach|fold|grab|graball|index|insert|itemize|items|iter|last|ldelete|map|match|matchall|member|mix|munge|pick|remove|replace|rest|revwords|setdiff|setinter|setunion|shuffle|sort|sortby|splice|step|wordpos|words|add|lmath|max|mean|median|min|mul|percent|sign|stddev|sub|val|bound|abs|inc|dec|dist2d|dist3d|div|floordiv|mod|modulo|remainder|vadd|vdim|vdot|vmag|vmax|vmin|vmul|vsub|vunit|regedit|regeditall|regeditalli|regediti|regmatch|regmatchi|regrab|regraball|regraballi|regrabi|regrep|regrepi|after|alphamin|alphamax|art|before|brackets|capstr|case|caseall|center|containsfansi|comp|decompose|decrypt|delete|edit|encrypt|escape|if|ifelse|lcstr|left|lit|ljust|merge|mid|ostrlen|pos|repeat|reverse|right|rjust|scramble|secure|space|spellnum|squish|strcat|strmatch|strinsert|stripansi|stripfansi|strlen|switch|switchall|table|tr|trim|ucstr|unsafe|wrap|ctitle|cwho|channels|clock|cflags|ilev|itext|inum|convsecs|convutcsecs|convtime|ctime|etimefmt|isdaylight|mtime|secs|msecs|starttime|time|timefmt|timestring|utctime|atrlock|clone|create|cook|dig|emit|lemit|link|oemit|open|pemit|remit|set|tel|wipe|zemit|fbcreate|fbdestroy|fbwrite|fbclear|fbcopy|fbcopyto|fbclip|fbdump|fbflush|fbhset|fblist|fbstats|qentries|qentry|play|ansi|break|c|asc|die|isdbref|isint|isnum|isletters|linecoords|localize|lnum|nameshort|null|objeval|r|rand|s|setq|setr|soundex|soundslike|valid|vchart|vchart2|vlabel|@@|bakerdays|bodybuild|box|capall|catalog|children|ctrailer|darttime|debt|detailbar|exploredroom|fansitoansi|fansitoxansi|fullbar|halfbar|isdarted|isnewbie|isword|lambda|lobjects|lplayers|lthings|lvexits|lvobjects|lvplayers|lvthings|newswrap|numsuffix|playerson|playersthisweek|randomad|randword|realrandword|replacechr|second|splitamount|strlenall|text|third|tofansi|totalac|unique|getaddressroom|listpropertycomm|listpropertyres|lotowner|lotrating|lotratingcount|lotvalue|boughtproduct|companyabb|companyicon|companylist|companyname|companyowners|companyvalue|employees|invested|productlist|productname|productowners|productrating|productratingcount|productsoldat|producttype|ratedproduct|soldproduct|topproducts|totalspentonproduct|totalstock|transfermoney|uniquebuyercount|uniqueproductsbought|validcompany|deletepicture|fbsave|getpicturesecurity|haspicture|listpictures|picturesize|replacecolor|rgbtocolor|savepicture|setpicturesecurity|showpicture|piechart|piechartlabel|createmaze|drawmaze|drawwireframe\",r=this.createKeywordMapper({\"invalid.deprecated\":\"debugger\",\"support.function\":n,\"constant.language\":t,keyword:e},\"identifier\"),i=\"(?:r|u|ur|R|U|UR|Ur|uR)?\",s=\"(?:(?:[1-9]\\\\d*)|(?:0))\",o=\"(?:0[oO]?[0-7]+)\",u=\"(?:0[xX][\\\\dA-Fa-f]+)\",a=\"(?:0[bB][01]+)\",f=\"(?:\"+s+\"|\"+o+\"|\"+u+\"|\"+a+\")\",l=\"(?:[eE][+-]?\\\\d+)\",c=\"(?:\\\\.\\\\d+)\",h=\"(?:\\\\d+)\",p=\"(?:(?:\"+h+\"?\"+c+\")|(?:\"+h+\"\\\\.))\",d=\"(?:(?:\"+p+\"|\"+h+\")\"+l+\")\",v=\"(?:\"+d+\"|\"+p+\")\";this.$rules={start:[{token:\"variable\",regex:\"%[0-9]{1}\"},{token:\"variable\",regex:\"%q[0-9A-Za-z]{1}\"},{token:\"variable\",regex:\"%[a-zA-Z]{1}\"},{token:\"variable.language\",regex:\"%[a-z0-9-_]+\"},{token:\"constant.numeric\",regex:\"(?:\"+v+\"|\\\\d+)[jJ]\\\\b\"},{token:\"constant.numeric\",regex:v},{token:\"constant.numeric\",regex:f+\"[lL]\\\\b\"},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|#|%|<<|>>|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.MushCodeRules=s}),define(\"ace/mode/folding/pythonic\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e){this.foldingStartMarker=new RegExp(\"([\\\\[{])(?:\\\\s*)$|(\"+e+\")(?:\\\\s*)(?:#.*)?$\")};r.inherits(s,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i)return i[1]?this.openingBracketBlock(e,i[1],n,i.index):i[2]?this.indentationBlock(e,n,i.index+i[2].length):this.indentationBlock(e,n)}}.call(s.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-mushcode_high_rules.js",
    "content": "define(\"ace/mode/mushcode_high_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"@if|@ifelse|@switch|@halt|@dolist|@create|@scent|@sound|@touch|@ataste|@osound|@ahear|@aahear|@amhear|@otouch|@otaste|@drop|@odrop|@adrop|@dropfail|@odropfail|@smell|@oemit|@emit|@pemit|@parent|@clone|@taste|whisper|page|say|pose|semipose|teach|touch|taste|smell|listen|look|move|go|home|follow|unfollow|desert|dismiss|@tel\",t=\"=#0\",n=\"default|edefault|eval|get_eval|get|grep|grepi|hasattr|hasattrp|hasattrval|hasattrpval|lattr|nattr|poss|udefault|ufun|u|v|uldefault|xget|zfun|band|bnand|bnot|bor|bxor|shl|shr|and|cand|cor|eq|gt|gte|lt|lte|nand|neq|nor|not|or|t|xor|con|entrances|exit|followers|home|lcon|lexits|loc|locate|lparent|lsearch|next|num|owner|parent|pmatch|rloc|rnum|room|where|zone|worn|held|carried|acos|asin|atan|ceil|cos|e|exp|fdiv|fmod|floor|log|ln|pi|power|round|sin|sqrt|tan|aposs|andflags|conn|commandssent|controls|doing|elock|findable|flags|fullname|hasflag|haspower|hastype|hidden|idle|isbaker|lock|lstats|money|who|name|nearby|obj|objflags|photo|poll|powers|pendingtext|receivedtext|restarts|restarttime|subj|shortestpath|tmoney|type|visible|cat|element|elements|extract|filter|filterbool|first|foreach|fold|grab|graball|index|insert|itemize|items|iter|last|ldelete|map|match|matchall|member|mix|munge|pick|remove|replace|rest|revwords|setdiff|setinter|setunion|shuffle|sort|sortby|splice|step|wordpos|words|add|lmath|max|mean|median|min|mul|percent|sign|stddev|sub|val|bound|abs|inc|dec|dist2d|dist3d|div|floordiv|mod|modulo|remainder|vadd|vdim|vdot|vmag|vmax|vmin|vmul|vsub|vunit|regedit|regeditall|regeditalli|regediti|regmatch|regmatchi|regrab|regraball|regraballi|regrabi|regrep|regrepi|after|alphamin|alphamax|art|before|brackets|capstr|case|caseall|center|containsfansi|comp|decompose|decrypt|delete|edit|encrypt|escape|if|ifelse|lcstr|left|lit|ljust|merge|mid|ostrlen|pos|repeat|reverse|right|rjust|scramble|secure|space|spellnum|squish|strcat|strmatch|strinsert|stripansi|stripfansi|strlen|switch|switchall|table|tr|trim|ucstr|unsafe|wrap|ctitle|cwho|channels|clock|cflags|ilev|itext|inum|convsecs|convutcsecs|convtime|ctime|etimefmt|isdaylight|mtime|secs|msecs|starttime|time|timefmt|timestring|utctime|atrlock|clone|create|cook|dig|emit|lemit|link|oemit|open|pemit|remit|set|tel|wipe|zemit|fbcreate|fbdestroy|fbwrite|fbclear|fbcopy|fbcopyto|fbclip|fbdump|fbflush|fbhset|fblist|fbstats|qentries|qentry|play|ansi|break|c|asc|die|isdbref|isint|isnum|isletters|linecoords|localize|lnum|nameshort|null|objeval|r|rand|s|setq|setr|soundex|soundslike|valid|vchart|vchart2|vlabel|@@|bakerdays|bodybuild|box|capall|catalog|children|ctrailer|darttime|debt|detailbar|exploredroom|fansitoansi|fansitoxansi|fullbar|halfbar|isdarted|isnewbie|isword|lambda|lobjects|lplayers|lthings|lvexits|lvobjects|lvplayers|lvthings|newswrap|numsuffix|playerson|playersthisweek|randomad|randword|realrandword|replacechr|second|splitamount|strlenall|text|third|tofansi|totalac|unique|getaddressroom|listpropertycomm|listpropertyres|lotowner|lotrating|lotratingcount|lotvalue|boughtproduct|companyabb|companyicon|companylist|companyname|companyowners|companyvalue|employees|invested|productlist|productname|productowners|productrating|productratingcount|productsoldat|producttype|ratedproduct|soldproduct|topproducts|totalspentonproduct|totalstock|transfermoney|uniquebuyercount|uniqueproductsbought|validcompany|deletepicture|fbsave|getpicturesecurity|haspicture|listpictures|picturesize|replacecolor|rgbtocolor|savepicture|setpicturesecurity|showpicture|piechart|piechartlabel|createmaze|drawmaze|drawwireframe\",r=this.createKeywordMapper({\"invalid.deprecated\":\"debugger\",\"support.function\":n,\"constant.language\":t,keyword:e},\"identifier\"),i=\"(?:r|u|ur|R|U|UR|Ur|uR)?\",s=\"(?:(?:[1-9]\\\\d*)|(?:0))\",o=\"(?:0[oO]?[0-7]+)\",u=\"(?:0[xX][\\\\dA-Fa-f]+)\",a=\"(?:0[bB][01]+)\",f=\"(?:\"+s+\"|\"+o+\"|\"+u+\"|\"+a+\")\",l=\"(?:[eE][+-]?\\\\d+)\",c=\"(?:\\\\.\\\\d+)\",h=\"(?:\\\\d+)\",p=\"(?:(?:\"+h+\"?\"+c+\")|(?:\"+h+\"\\\\.))\",d=\"(?:(?:\"+p+\"|\"+h+\")\"+l+\")\",v=\"(?:\"+d+\"|\"+p+\")\";this.$rules={start:[{token:\"variable\",regex:\"%[0-9]{1}\"},{token:\"variable\",regex:\"%q[0-9A-Za-z]{1}\"},{token:\"variable\",regex:\"%[a-zA-Z]{1}\"},{token:\"variable.language\",regex:\"%[a-z0-9-_]+\"},{token:\"constant.numeric\",regex:\"(?:\"+v+\"|\\\\d+)[jJ]\\\\b\"},{token:\"constant.numeric\",regex:v},{token:\"constant.numeric\",regex:f+\"[lL]\\\\b\"},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|#|%|<<|>>|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.MushCodeRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-mysql.js",
    "content": "define(\"ace/mode/mysql\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/mysql_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../mode/text\").Mode,s=e(\"./mysql_highlight_rules\").MysqlHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=[\"--\",\"#\"],this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/mysql\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/mysql_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){function i(e){var t=e.start,n=e.escape;return{token:\"string.start\",regex:t,next:[{token:\"constant.language.escape\",regex:n},{token:\"string.end\",next:\"start\",regex:t},{defaultToken:\"string\"}]}}var e=\"alter|and|as|asc|between|count|create|delete|desc|distinct|drop|from|having|in|insert|into|is|join|like|not|on|or|order|select|set|table|union|update|values|where|accessible|action|add|after|algorithm|all|analyze|asensitive|at|authors|auto_increment|autocommit|avg|avg_row_length|before|binary|binlog|both|btree|cache|call|cascade|cascaded|case|catalog_name|chain|change|changed|character|check|checkpoint|checksum|class_origin|client_statistics|close|coalesce|code|collate|collation|collations|column|columns|comment|commit|committed|completion|concurrent|condition|connection|consistent|constraint|contains|continue|contributors|convert|cross|current_date|current_time|current_timestamp|current_user|cursor|data|database|databases|day_hour|day_microsecond|day_minute|day_second|deallocate|dec|declare|default|delay_key_write|delayed|delimiter|des_key_file|describe|deterministic|dev_pop|dev_samp|deviance|directory|disable|discard|distinctrow|div|dual|dumpfile|each|elseif|enable|enclosed|end|ends|engine|engines|enum|errors|escape|escaped|even|event|events|every|execute|exists|exit|explain|extended|fast|fetch|field|fields|first|flush|for|force|foreign|found_rows|full|fulltext|function|general|global|grant|grants|group|groupby_concat|handler|hash|help|high_priority|hosts|hour_microsecond|hour_minute|hour_second|if|ignore|ignore_server_ids|import|index|index_statistics|infile|inner|innodb|inout|insensitive|insert_method|install|interval|invoker|isolation|iterate|key|keys|kill|language|last|leading|leave|left|level|limit|linear|lines|list|load|local|localtime|localtimestamp|lock|logs|low_priority|master|master_heartbeat_period|master_ssl_verify_server_cert|masters|match|max|max_rows|maxvalue|message_text|middleint|migrate|min|min_rows|minute_microsecond|minute_second|mod|mode|modifies|modify|mutex|mysql_errno|natural|next|no|no_write_to_binlog|offline|offset|one|online|open|optimize|option|optionally|out|outer|outfile|pack_keys|parser|partition|partitions|password|phase|plugin|plugins|prepare|preserve|prev|primary|privileges|procedure|processlist|profile|profiles|purge|query|quick|range|read|read_write|reads|real|rebuild|recover|references|regexp|relaylog|release|remove|rename|reorganize|repair|repeatable|replace|require|resignal|restrict|resume|return|returns|revoke|right|rlike|rollback|rollup|row|row_format|rtree|savepoint|schedule|schema|schema_name|schemas|second_microsecond|security|sensitive|separator|serializable|server|session|share|show|signal|slave|slow|smallint|snapshot|soname|spatial|specific|sql|sql_big_result|sql_buffer_result|sql_cache|sql_calc_found_rows|sql_no_cache|sql_small_result|sqlexception|sqlstate|sqlwarning|ssl|start|starting|starts|status|std|stddev|stddev_pop|stddev_samp|storage|straight_join|subclass_origin|sum|suspend|table_name|table_statistics|tables|tablespace|temporary|terminated|to|trailing|transaction|trigger|triggers|truncate|uncommitted|undo|uninstall|unique|unlock|upgrade|usage|use|use_frm|user|user_resources|user_statistics|using|utc_date|utc_time|utc_timestamp|value|variables|varying|view|views|warnings|when|while|with|work|write|xa|xor|year_month|zerofill|begin|do|then|else|loop|repeat\",t=\"by|bool|boolean|bit|blob|decimal|double|enum|float|long|longblob|longtext|medium|mediumblob|mediumint|mediumtext|time|timestamp|tinyblob|tinyint|tinytext|text|bigint|int|int1|int2|int3|int4|int8|integer|float|float4|float8|double|char|varbinary|varchar|varcharacter|precision|date|datetime|year|unsigned|signed|numeric\",n=\"charset|clear|connect|edit|ego|exit|go|help|nopager|notee|nowarning|pager|print|prompt|quit|rehash|source|status|system|tee\",r=this.createKeywordMapper({\"support.function\":t,keyword:e,constant:\"false|true|null|unknown|date|time|timestamp|ODBCdotTable|zerolessFloat\",\"variable.language\":n},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"(?:-- |#).*$\"},i({start:'\"',escape:/\\\\[0'\"bnrtZ\\\\%_]?/}),i({start:\"'\",escape:/\\\\[0'\"bnrtZ\\\\%_]?/}),s.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+|[xX]'[0-9a-fA-F]+'|0[bB][01]+|[bB]'[01]+'/},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"constant.class\",regex:\"@@?[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"constant.buildin\",regex:\"`[^`]*`\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|%|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}]},this.embedRules(s,\"doc-\",[s.getEndRule(\"start\")]),this.normalizeRules()};r.inherits(u,o),t.MysqlHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-nix.js",
    "content": "define(\"ace/mode/nix\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/c_cpp\",\"ace/mode/nix_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./c_cpp\").Mode,s=e(\"./nix_highlight_rules\").NixHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){i.call(this),this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"#\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/nix\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/c_cpp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c_cpp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c_cpp\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/nix_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"true|false\",t=\"with|import|if|else|then|inherit\",n=\"let|in|rec\",r=this.createKeywordMapper({\"constant.language.nix\":e,\"keyword.control.nix\":t,\"keyword.declaration.nix\":n},\"identifier\");this.$rules={start:[{token:\"comment\",regex:/#.*$/},{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"constant\",regex:\"<[^>]+>\"},{regex:\"(==|!=|<=?|>=?)\",token:[\"keyword.operator.comparison.nix\"]},{regex:\"((?:[+*/%-]|\\\\~)=)\",token:[\"keyword.operator.assignment.arithmetic.nix\"]},{regex:\"=\",token:\"keyword.operator.assignment.nix\"},{token:\"string\",regex:\"''\",next:\"qqdoc\"},{token:\"string\",regex:\"'\",next:\"qstring\"},{token:\"string\",regex:'\"',push:\"qqstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{regex:\"}\",token:function(e,t,n){return n[1]&&n[1].charAt(0)==\"q\"?\"constant.language.escape\":\"text\"},next:\"pop\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqdoc:[{token:\"constant.language.escape\",regex:/\\$\\{/,push:\"start\"},{token:\"string\",regex:\"''\",next:\"pop\"},{defaultToken:\"string\"}],qqstring:[{token:\"constant.language.escape\",regex:/\\$\\{/,push:\"start\"},{token:\"string\",regex:'\"',next:\"pop\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:/\\$\\{/,push:\"start\"},{token:\"string\",regex:\"'\",next:\"pop\"},{defaultToken:\"string\"}]},this.normalizeRules()};r.inherits(s,i),t.NixHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-objectivec.js",
    "content": "define(\"ace/mode/objectivec\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/objectivec_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./objectivec_highlight_rules\").ObjectiveCHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/objectivec\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/objectivec_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/c_cpp_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./c_cpp_highlight_rules\"),o=s.c_cppHighlightRules,u=function(){var e=\"\\\\\\\\(?:[abefnrtv'\\\"?\\\\\\\\]|[0-3]\\\\d{1,2}|[4-7]\\\\d?|222|x[a-zA-Z0-9]+)\",t=[{regex:\"\\\\b_cmd\\\\b\",token:\"variable.other.selector.objc\"},{regex:\"\\\\b(?:self|super)\\\\b\",token:\"variable.language.objc\"}],n=new o,r=n.getRules();this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:[\"storage.type.objc\",\"punctuation.definition.storage.type.objc\",\"entity.name.type.objc\",\"text\",\"entity.other.inherited-class.objc\"],regex:\"(@)(interface|protocol)(?!.+;)(\\\\s+[A-Za-z_][A-Za-z0-9_]*)(\\\\s*:\\\\s*)([A-Za-z]+)\"},{token:[\"storage.type.objc\"],regex:\"(@end)\"},{token:[\"storage.type.objc\",\"entity.name.type.objc\",\"entity.other.inherited-class.objc\"],regex:\"(@implementation)(\\\\s+[A-Za-z_][A-Za-z0-9_]*)(\\\\s*?::\\\\s*(?:[A-Za-z][A-Za-z0-9]*))?\"},{token:\"string.begin.objc\",regex:'@\"',next:\"constant_NSString\"},{token:\"storage.type.objc\",regex:\"\\\\bid\\\\s*<\",next:\"protocol_list\"},{token:\"keyword.control.macro.objc\",regex:\"\\\\bNS_DURING|NS_HANDLER|NS_ENDHANDLER\\\\b\"},{token:[\"punctuation.definition.keyword.objc\",\"keyword.control.exception.objc\"],regex:\"(@)(try|catch|finally|throw)\\\\b\"},{token:[\"punctuation.definition.keyword.objc\",\"keyword.other.objc\"],regex:\"(@)(defs|encode)\\\\b\"},{token:[\"storage.type.id.objc\",\"text\"],regex:\"(\\\\bid\\\\b)(\\\\s|\\\\n)?\"},{token:\"storage.type.objc\",regex:\"\\\\bIBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class\\\\b\"},{token:[\"punctuation.definition.storage.type.objc\",\"storage.type.objc\"],regex:\"(@)(class|protocol)\\\\b\"},{token:[\"punctuation.definition.storage.type.objc\",\"punctuation\"],regex:\"(@selector)(\\\\s*\\\\()\",next:\"selectors\"},{token:[\"punctuation.definition.storage.modifier.objc\",\"storage.modifier.objc\"],regex:\"(@)(synchronized|public|private|protected|package)\\\\b\"},{token:\"constant.language.objc\",regex:\"\\\\bYES|NO|Nil|nil\\\\b\"},{token:\"support.variable.foundation\",regex:\"\\\\bNSApp\\\\b\"},{token:[\"support.function.cocoa.leopard\"],regex:\"(?:\\\\b)(NS(?:Rect(?:ToCGRect|FromCGRect)|MakeCollectable|S(?:tringFromProtocol|ize(?:ToCGSize|FromCGSize))|Draw(?:NinePartImage|ThreePartImage)|P(?:oint(?:ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))(?:\\\\b)\"},{token:[\"support.function.cocoa\"],regex:\"(?:\\\\b)(NS(?:R(?:ound(?:DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(?:CriticalAlertPanel(?:RelativeToWindow)?|InformationalAlertPanel(?:RelativeToWindow)?|AlertPanel(?:RelativeToWindow)?)|e(?:set(?:MapTable|HashTable)|c(?:ycleZone|t(?:Clip(?:List)?|F(?:ill(?:UsingOperation|List(?:UsingOperation|With(?:Grays|Colors(?:UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(?:dPixel|l(?:MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(?:SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(?:s)?|WindowServerMemory|AlertPanel)|M(?:i(?:n(?:X|Y)|d(?:X|Y))|ouseInRect|a(?:p(?:Remove|Get|Member|Insert(?:IfAbsent|KnownAbsent)?)|ke(?:R(?:ect|ange)|Size|Point)|x(?:Range|X|Y)))|B(?:itsPer(?:SampleFromDepth|PixelFromDepth)|e(?:stDepth|ep|gin(?:CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(?:ho(?:uldRetainWithZone|w(?:sServicesMenuItem|AnimationEffect))|tringFrom(?:R(?:ect|ange)|MapTable|S(?:ize|elector)|HashTable|Class|Point)|izeFromString|e(?:t(?:ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(?:Big(?:ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(?:ToHost|LongToHost))|Short|Host(?:ShortTo(?:Big|Little)|IntTo(?:Big|Little)|DoubleTo(?:Big|Little)|FloatTo(?:Big|Little)|Long(?:To(?:Big|Little)|LongTo(?:Big|Little)))|Int|Double|Float|L(?:ittle(?:ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(?:ToHost|LongToHost))|ong(?:Long)?)))|H(?:ighlightRect|o(?:stByteOrder|meDirectory(?:ForUser)?)|eight|ash(?:Remove|Get|Insert(?:IfAbsent|KnownAbsent)?)|FSType(?:CodeFromFileType|OfFile))|N(?:umberOfColorComponents|ext(?:MapEnumeratorPair|HashEnumeratorItem))|C(?:o(?:n(?:tainsRect|vert(?:GlyphsToPackedGlyphs|Swapped(?:DoubleToHost|FloatToHost)|Host(?:DoubleToSwapped|FloatToSwapped)))|unt(?:MapTable|HashTable|Frames|Windows(?:ForContext)?)|py(?:M(?:emoryPages|apTableWithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(?:MapTables|HashTables))|lassFromString|reate(?:MapTable(?:WithZone)?|HashTable(?:WithZone)?|Zone|File(?:namePboardType|ContentsPboardType)))|TemporaryDirectory|I(?:s(?:ControllerMarker|EmptyRect|FreedObject)|n(?:setRect|crementExtraRefCount|te(?:r(?:sect(?:sRect|ionR(?:ect|ange))|faceStyleForKey)|gralRect)))|Zone(?:Realloc|Malloc|Name|Calloc|Fr(?:omPointer|ee))|O(?:penStepRootDirectory|ffsetRect)|D(?:i(?:sableScreenUpdates|videRect)|ottedFrameRect|e(?:c(?:imal(?:Round|Multiply|S(?:tring|ubtract)|Normalize|Co(?:py|mpa(?:ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(?:MemoryPages|Object))|raw(?:Gr(?:oove|ayBezel)|B(?:itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(?:hiteBezel|indowBackground)|LightBezel))|U(?:serName|n(?:ionR(?:ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(?:Bundle(?:Setup|Cleanup)|Setup(?:VirtualMachine)?|Needs(?:ToLoadClasses|VirtualMachine)|ClassesF(?:orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(?:oint(?:InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(?:n(?:d(?:MapTableEnumeration|HashTableEnumeration)|umerate(?:MapTable|HashTable)|ableScreenUpdates)|qual(?:R(?:ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(?:ileTypeForHFSTypeCode|ullUserName|r(?:ee(?:MapTable|HashTable)|ame(?:Rect(?:WithWidth(?:UsingOperation)?)?|Address)))|Wi(?:ndowList(?:ForContext)?|dth)|Lo(?:cationInRange|g(?:v|PageSize)?)|A(?:ccessibility(?:R(?:oleDescription(?:ForUIElement)?|aiseBadArgumentException)|Unignored(?:Children(?:ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(?:Main|Load)|vailableWindowDepths|ll(?:MapTable(?:Values|Keys)|HashTableObjects|ocate(?:MemoryPages|Collectable|Object)))))(?:\\\\b)\"},{token:[\"support.class.cocoa.leopard\"],regex:\"(?:\\\\b)(NS(?:RuleEditor|G(?:arbageCollector|radient)|MapTable|HashTable|Co(?:ndition|llectionView(?:Item)?)|T(?:oolbarItemGroup|extInputClient|r(?:eeNode|ackingArea))|InvocationOperation|Operation(?:Queue)?|D(?:ictionaryController|ockTile)|P(?:ointer(?:Functions|Array)|athC(?:o(?:ntrol(?:Delegate)?|mponentCell)|ell(?:Delegate)?)|r(?:intPanelAccessorizing|edicateEditor(?:RowTemplate)?))|ViewController|FastEnumeration|Animat(?:ionContext|ablePropertyContainer)))(?:\\\\b)\"},{token:[\"support.class.cocoa\"],regex:\"(?:\\\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cell|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\\\b)\"},{token:[\"support.type.cocoa.leopard\"],regex:\"(?:\\\\b)(NS(?:R(?:u(?:nLoop|ler(?:Marker|View))|e(?:sponder|cursiveLock|lativeSpecifier)|an(?:domSpecifier|geSpecifier))|G(?:etCommand|lyph(?:Generator|Storage|Info)|raphicsContext)|XML(?:Node|D(?:ocument|TD(?:Node)?)|Parser|Element)|M(?:iddleSpecifier|ov(?:ie(?:View)?|eCommand)|utable(?:S(?:tring|et)|C(?:haracterSet|opying)|IndexSet|D(?:ictionary|ata)|URLRequest|ParagraphStyle|A(?:ttributedString|rray))|e(?:ssagePort(?:NameServer)?|nu(?:Item(?:Cell)?|View)?|t(?:hodSignature|adata(?:Item|Query(?:ResultGroup|AttributeValueTuple)?)))|a(?:ch(?:BootstrapServer|Port)|trix))|B(?:itmapImageRep|ox|u(?:ndle|tton(?:Cell)?)|ezierPath|rowser(?:Cell)?)|S(?:hadow|c(?:anner|r(?:ipt(?:SuiteRegistry|C(?:o(?:ercionHandler|mmand(?:Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(?:er|View)|een))|t(?:epper(?:Cell)?|atus(?:Bar|Item)|r(?:ing|eam))|imple(?:HorizontalTypesetter|CString)|o(?:cketPort(?:NameServer)?|und|rtDescriptor)|p(?:e(?:cifierTest|ech(?:Recognizer|Synthesizer)|ll(?:Server|Checker))|litView)|e(?:cureTextField(?:Cell)?|t(?:Command)?|archField(?:Cell)?|rializer|gmentedC(?:ontrol|ell))|lider(?:Cell)?|avePanel)|H(?:ost|TTP(?:Cookie(?:Storage)?|URLResponse)|elpManager)|N(?:ib(?:Con(?:nector|trolConnector)|OutletConnector)?|otification(?:Center|Queue)?|u(?:ll|mber(?:Formatter)?)|etService(?:Browser)?|ameSpecifier)|C(?:ha(?:ngeSpelling|racterSet)|o(?:n(?:stantString|nection|trol(?:ler)?|ditionLock)|d(?:ing|er)|unt(?:Command|edSet)|pying|lor(?:Space|P(?:ick(?:ing(?:Custom|Default)|er)|anel)|Well|List)?|m(?:p(?:oundPredicate|arisonPredicate)|boBox(?:Cell)?))|u(?:stomImageRep|rsor)|IImageRep|ell|l(?:ipView|o(?:seCommand|neCommand)|assDescription)|a(?:ched(?:ImageRep|URLResponse)|lendar(?:Date)?)|reateCommand)|T(?:hread|ypesetter|ime(?:Zone|r)|o(?:olbar(?:Item(?:Validations)?)?|kenField(?:Cell)?)|ext(?:Block|Storage|Container|Tab(?:le(?:Block)?)?|Input|View|Field(?:Cell)?|List|Attachment(?:Cell)?)?|a(?:sk|b(?:le(?:Header(?:Cell|View)|Column|View)|View(?:Item)?))|reeController)|I(?:n(?:dex(?:S(?:pecifier|et)|Path)|put(?:Manager|S(?:tream|erv(?:iceProvider|er(?:MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(?:Rep|Cell|View)?)|O(?:ut(?:putStream|lineView)|pen(?:GL(?:Context|Pixel(?:Buffer|Format)|View)|Panel)|bj(?:CTypeSerializationCallBack|ect(?:Controller)?))|D(?:i(?:st(?:antObject(?:Request)?|ributed(?:NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(?:Controller)?|e(?:serializer|cimalNumber(?:Behaviors|Handler)?|leteCommand)|at(?:e(?:Components|Picker(?:Cell)?|Formatter)?|a)|ra(?:wer|ggingInfo))|U(?:ser(?:InterfaceValidations|Defaults(?:Controller)?)|RL(?:Re(?:sponse|quest)|Handle(?:Client)?|C(?:onnection|ache|redential(?:Storage)?)|Download(?:Delegate)?|Prot(?:ocol(?:Client)?|ectionSpace)|AuthenticationChallenge(?:Sender)?)?|n(?:iqueIDSpecifier|doManager|archiver))|P(?:ipe|o(?:sitionalSpecifier|pUpButton(?:Cell)?|rt(?:Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(?:steboard|nel|ragraphStyle|geLayout)|r(?:int(?:Info|er|Operation|Panel)|o(?:cessInfo|tocolChecker|perty(?:Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(?:numerator|vent|PSImageRep|rror|x(?:ception|istsCommand|pression))|V(?:iew(?:Animation)?|al(?:idated(?:ToobarItem|UserInterfaceItem)|ue(?:Transformer)?))|Keyed(?:Unarchiver|Archiver)|Qui(?:ckDrawView|tCommand)|F(?:ile(?:Manager|Handle|Wrapper)|o(?:nt(?:Manager|Descriptor|Panel)?|rm(?:Cell|atter)))|W(?:hoseSpecifier|indow(?:Controller)?|orkspace)|L(?:o(?:c(?:k(?:ing)?|ale)|gicalTest)|evelIndicator(?:Cell)?|ayoutManager)|A(?:ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(?:ication|e(?:Script|Event(?:Manager|Descriptor)))|ffineTransform|lert|r(?:chiver|ray(?:Controller)?))))(?:\\\\b)\"},{token:[\"support.class.quartz\"],regex:\"(?:\\\\b)(C(?:I(?:Sampler|Co(?:ntext|lor)|Image(?:Accumulator)?|PlugIn(?:Registration)?|Vector|Kernel|Filter(?:Generator|Shape)?)|A(?:Renderer|MediaTiming(?:Function)?|BasicAnimation|ScrollLayer|Constraint(?:LayoutManager)?|T(?:iledLayer|extLayer|rans(?:ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(?:nimation(?:Group)?|ction))))(?:\\\\b)\"},{token:[\"support.type.quartz\"],regex:\"(?:\\\\b)(C(?:G(?:Float|Point|Size|Rect)|IFormat|AConstraintAttribute))(?:\\\\b)\"},{token:[\"support.type.cocoa\"],regex:\"(?:\\\\b)(NS(?:R(?:ect(?:Edge)?|ange)|G(?:lyph(?:Relation|LayoutMode)?|radientType)|M(?:odalSession|a(?:trixMode|p(?:Table|Enumerator)))|B(?:itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(?:cr(?:oll(?:er(?:Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(?:Granularity|Direction|Affinity)|wapped(?:Double|Float)|aveOperationType)|Ha(?:sh(?:Table|Enumerator)|ndler(?:2)?)|C(?:o(?:ntrol(?:Size|Tint)|mp(?:ositingOperation|arisonResult))|ell(?:State|Type|ImagePosition|Attribute))|T(?:hreadPrivate|ypesetterGlyphInfo|i(?:ckMarkPosition|tlePosition|meInterval)|o(?:ol(?:TipTag|bar(?:SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(?:TabType|Alignment)|ab(?:State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(?:ContextAuxiliary|PixelFormatAuxiliary)|D(?:ocumentChangeType|atePickerElementFlags|ra(?:werState|gOperation))|UsableScrollerParts|P(?:oint|r(?:intingPageOrder|ogressIndicator(?:Style|Th(?:ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(?:nt(?:SymbolicTraits|TraitMask|Action)|cusRingType)|W(?:indow(?:OrderingMode|Depth)|orkspace(?:IconCreationOptions|LaunchOptions)|ritingDirection)|L(?:ineBreakMode|ayout(?:Status|Direction))|A(?:nimation(?:Progress|Effect)|ppl(?:ication(?:TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle)))(?:\\\\b)\"},{token:[\"support.constant.cocoa\"],regex:\"(?:\\\\b)(NS(?:NotFound|Ordered(?:Ascending|Descending|Same)))(?:\\\\b)\"},{token:[\"support.constant.notification.cocoa.leopard\"],regex:\"(?:\\\\b)(NS(?:MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification)(?:\\\\b)\"},{token:[\"support.constant.notification.cocoa\"],regex:\"(?:\\\\b)(NS(?:Menu(?:Did(?:RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(?:ystemColorsDidChange|plitView(?:DidResizeSubviews|WillResizeSubviews))|C(?:o(?:nt(?:extHelpModeDid(?:Deactivate|Activate)|rolT(?:intDidChange|extDid(?:BeginEditing|Change|EndEditing)))|lor(?:PanelColorDidChange|ListDidChange)|mboBox(?:Selection(?:IsChanging|DidChange)|Will(?:Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(?:oolbar(?:DidRemoveItem|WillAddItem)|ext(?:Storage(?:DidProcessEditing|WillProcessEditing)|Did(?:BeginEditing|Change|EndEditing)|View(?:DidChange(?:Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(?:Selection(?:IsChanging|DidChange)|ColumnDid(?:Resize|Move)))|ImageRepRegistryDidChange|OutlineView(?:Selection(?:IsChanging|DidChange)|ColumnDid(?:Resize|Move)|Item(?:Did(?:Collapse|Expand)|Will(?:Collapse|Expand)))|Drawer(?:Did(?:Close|Open)|Will(?:Close|Open))|PopUpButton(?:CellWillPopUp|WillPopUp)|View(?:GlobalFrameDidChange|BoundsDidChange|F(?:ocusDidChange|rameDidChange))|FontSetChanged|W(?:indow(?:Did(?:Resi(?:ze|gn(?:Main|Key))|M(?:iniaturize|ove)|Become(?:Main|Key)|ChangeScreen(?:|Profile)|Deminiaturize|Update|E(?:ndSheet|xpose))|Will(?:M(?:iniaturize|ove)|BeginSheet|Close))|orkspace(?:SessionDid(?:ResignActive|BecomeActive)|Did(?:Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(?:Sleep|Unmount|PowerOff|LaunchApplication)))|A(?:ntialiasThresholdChanged|ppl(?:ication(?:Did(?:ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(?:nhide|pdate)|FinishLaunching)|Will(?:ResignActive|BecomeActive|Hide|Terminate|U(?:nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification)(?:\\\\b)\"},{token:[\"support.constant.cocoa.leopard\"],regex:\"(?:\\\\b)(NS(?:RuleEditor(?:RowType(?:Simple|Compound)|NestingMode(?:Si(?:ngle|mple)|Compound|List))|GradientDraws(?:BeforeStartingLocation|AfterEndingLocation)|M(?:inusSetExpressionType|a(?:chPortDeallocate(?:ReceiveRight|SendRight|None)|pTable(?:StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(?:oxCustom|undleExecutableArchitecture(?:X86|I386|PPC(?:64)?)|etweenPredicateOperatorType|ackgroundStyle(?:Raised|Dark|L(?:ight|owered)))|S(?:tring(?:DrawingTruncatesLastVisibleLine|EncodingConversion(?:ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(?:e(?:ech(?:SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(?:GrammarFlag|SpellingFlag))|litViewDividerStyleThi(?:n|ck))|e(?:rvice(?:RequestTimedOutError|M(?:iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(?:inimum|aximum)|Application(?:NotFoundError|LaunchFailedError))|gmentStyle(?:Round(?:Rect|ed)|SmallSquare|Capsule|Textured(?:Rounded|Square)|Automatic)))|H(?:UDWindowMask|ashTable(?:StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(?:oModeColorPanel|etServiceNoAutoRename)|C(?:hangeRedone|o(?:ntainsPredicateOperatorType|l(?:orRenderingIntent(?:RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(?:None|ContentArea|TrackableArea|EditableTextArea))|T(?:imeZoneNameStyle(?:S(?:hort(?:Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(?:Regular|SourceList)|racking(?:Mouse(?:Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(?:ssumeInside|ctive(?:In(?:KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(?:n(?:tersectSetExpressionType|dexedColorSpaceModel)|mageScale(?:None|Proportionally(?:Down|UpOrDown)|AxesIndependently))|Ope(?:nGLPFAAllowOfflineRenderers|rationQueue(?:DefaultMaxConcurrentOperationCount|Priority(?:High|Normal|Very(?:High|Low)|Low)))|D(?:iacriticInsensitiveSearch|ownloadsDirectory)|U(?:nionSetExpressionType|TF(?:16(?:BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(?:BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(?:ointerFunctions(?:Ma(?:chVirtualMemory|llocMemory)|Str(?:ongMemory|uctPersonality)|C(?:StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(?:paque(?:Memory|Personality)|bjectP(?:ointerPersonality|ersonality)))|at(?:hStyle(?:Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(?:Scaling|Copies|Orientation|P(?:a(?:perSize|ge(?:Range|SetupAccessory))|review)))|Executable(?:RuntimeMismatchError|NotLoadableError|ErrorM(?:inimum|aximum)|L(?:inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(?:Initial|Prior)|F(?:i(?:ndPanelSubstringMatchType(?:StartsWith|Contains|EndsWith|FullWord)|leRead(?:TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(?:ndow(?:BackingLocation(?:MainMemory|Default|VideoMemory)|Sharing(?:Read(?:Only|Write)|None)|CollectionBehavior(?:MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType))(?:\\\\b)\"},{token:[\"support.constant.cocoa\"],regex:\"(?:\\\\b)(NS(?:R(?:GB(?:ModeColorPanel|ColorSpaceModel)|ight(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|T(?:ext(?:Movement|Alignment)|ab(?:sBezelBorder|StopType))|ArrowFunctionKey)|ound(?:RectBezelStyle|Bankers|ed(?:BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(?:CapStyle|JoinStyle))|un(?:StoppedResponse|ContinuesResponse|AbortedResponse)|e(?:s(?:izableWindowMask|et(?:CursorRectsRunLoopOrdering|FunctionKey))|ce(?:ssedBezelStyle|iver(?:sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(?:evancyLevelIndicatorStyle|ative(?:Before|After))|gular(?:SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(?:n(?:domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(?:ModeMatrix|Button)))|G(?:IFFileType|lyph(?:Below|Inscribe(?:B(?:elow|ase)|Over(?:strike|Below)|Above)|Layout(?:WithPrevious|A(?:tAPoint|gainstAPoint))|A(?:ttribute(?:BidiLevel|Soft|Inscribe|Elastic)|bove))|r(?:ooveBorder|eaterThan(?:Comparison|OrEqualTo(?:Comparison|PredicateOperatorType)|PredicateOperatorType)|a(?:y(?:ModeColorPanel|ColorSpaceModel)|dient(?:None|Con(?:cave(?:Strong|Weak)|vex(?:Strong|Weak)))|phiteControlTint)))|XML(?:N(?:o(?:tationDeclarationKind|de(?:CompactEmptyElement|IsCDATA|OptionsNone|Use(?:SingleQuotes|DoubleQuotes)|Pre(?:serve(?:NamespaceOrder|C(?:haracterReferences|DATA)|DTD|Prefixes|E(?:ntities|mptyElements)|Quotes|Whitespace|A(?:ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(?:ocument(?:X(?:MLKind|HTMLKind|Include)|HTMLKind|T(?:idy(?:XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(?:arser(?:GTRequiredError|XMLDeclNot(?:StartedError|FinishedError)|Mi(?:splaced(?:XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(?:StartedError|FinishedError))|S(?:t(?:andaloneValueError|ringNot(?:StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(?:MTOKENRequiredError|o(?:t(?:ationNot(?:StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(?:haracterRef(?:In(?:DTDError|PrologError|EpilogError)|AtEOFError)|o(?:nditionalSectionNot(?:StartedError|FinishedError)|mment(?:NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(?:ternalError|valid(?:HexCharacterRefError|C(?:haracter(?:RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(?:NameError|Error)))|OutOfMemoryError|D(?:ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(?:RI(?:RequiredError|FragmentError)|n(?:declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(?:CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(?:MissingSemiError|NoNameError|In(?:Internal(?:SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(?:ocessingInstructionNot(?:StartedError|FinishedError)|ematureDocumentEndError))|E(?:n(?:codingNotSupportedError|tity(?:Ref(?:In(?:DTDError|PrologError|EpilogError)|erence(?:MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(?:StartedError|FinishedError)|Is(?:ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(?:StartedError|FinishedError)|xt(?:ernalS(?:tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(?:iteralNot(?:StartedError|FinishedError)|T(?:RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(?:RedefinedError|HasNoValueError|Not(?:StartedError|FinishedError)|ListNot(?:StartedError|FinishedError)))|rocessingInstructionKind)|E(?:ntity(?:GeneralKind|DeclarationKind|UnparsedKind|P(?:ar(?:sedKind|ameterKind)|redefined))|lement(?:Declaration(?:MixedKind|UndefinedKind|E(?:lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(?:N(?:MToken(?:sKind|Kind)|otationKind)|CDATAKind|ID(?:Ref(?:sKind|Kind)|Kind)|DeclarationKind|En(?:tit(?:yKind|iesKind)|umerationKind)|Kind))|M(?:i(?:n(?:XEdge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(?:nthCalendarUnit|deSwitchFunctionKey|use(?:Moved(?:Mask)?|E(?:ntered(?:Mask)?|ventSubtype|xited(?:Mask)?))|veToBezierPathElement|mentary(?:ChangeButton|Push(?:Button|InButton)|Light(?:Button)?))|enuFunctionKey|a(?:c(?:intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(?:XEdge|YEdge))|ACHOperatingSystem)|B(?:MPFileType|o(?:ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(?:Se(?:condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(?:zelBorder|velLineJoinStyle|low(?:Bottom|Top)|gin(?:sWith(?:Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(?:spaceCharacter|tabTextMovement|ingStore(?:Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(?:owser(?:NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(?:h(?:ift(?:JISStringEncoding|KeyMask)|ow(?:ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(?:s(?:ReqFunctionKey|tem(?:D(?:omainMask|efined(?:Mask)?)|FunctionKey))|mbolStringEncoding)|c(?:a(?:nnedOption|le(?:None|ToFit|Proportionally))|r(?:oll(?:er(?:NoPart|Increment(?:Page|Line|Arrow)|Decrement(?:Page|Line|Arrow)|Knob(?:Slot)?|Arrows(?:M(?:inEnd|axEnd)|None|DefaultSetting))|Wheel(?:Mask)?|LockFunctionKey)|eenChangedEventType))|t(?:opFunctionKey|r(?:ingDrawing(?:OneShot|DisableScreenFontSubstitution|Uses(?:DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(?:Status(?:Reading|NotOpen|Closed|Open(?:ing)?|Error|Writing|AtEnd)|Event(?:Has(?:BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(?:ndEncountered|rrorOccurred)))))|i(?:ngle(?:DateMode|UnderlineStyle)|ze(?:DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(?:condCalendarUnit|lect(?:By(?:Character|Paragraph|Word)|i(?:ng(?:Next|Previous)|onAffinity(?:Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(?:Momentary|Select(?:One|Any)))|quareLineCapStyle|witchButton|ave(?:ToOperation|Op(?:tions(?:Yes|No|Ask)|eration)|AsOperation)|mall(?:SquareBezelStyle|C(?:ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(?:ighlightModeMatrix|SBModeColorPanel|o(?:ur(?:Minute(?:SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(?:Never|OnlyFromMainDocumentDomain|Always)|e(?:lp(?:ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(?:MonthDa(?:yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(?:o(?:n(?:StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(?:ification(?:SuspensionBehavior(?:Hold|Coalesce|D(?:eliverImmediately|rop))|NoCoalescing|CoalescingOn(?:Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(?:cr(?:iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(?:itle|opLevelContainersSpecifierError|abs(?:BezelBorder|NoBorder|LineBorder))|I(?:nterfaceStyle|mage)|UnderlineStyle|FontChangeAction)|u(?:ll(?:Glyph|CellType)|m(?:eric(?:Search|PadKeyMask)|berFormatter(?:Round(?:Half(?:Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(?:10|Default)|S(?:cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(?:ercentStyle|ad(?:Before(?:Suffix|Prefix)|After(?:Suffix|Prefix))))))|e(?:t(?:Services(?:BadArgumentError|NotFoundError|C(?:ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(?:StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(?:t(?:iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(?:hange(?:ReadOtherContents|GrayCell(?:Mask)?|BackgroundCell(?:Mask)?|Cleared|Done|Undone|Autosaved)|MYK(?:ModeColorPanel|ColorSpaceModel)|ircular(?:BezelStyle|Slider)|o(?:n(?:stantValueExpressionType|t(?:inuousCapacityLevelIndicatorStyle|entsCellMask|ain(?:sComparison|erSpecifierError)|rol(?:Glyph|KeyMask))|densedFontMask)|lor(?:Panel(?:RGBModeMask|GrayModeMask|HSBModeMask|C(?:MYKModeMask|olorListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(?:p(?:osite(?:XOR|Source(?:In|O(?:ut|ver)|Atop)|Highlight|C(?:opy|lear)|Destination(?:In|O(?:ut|ver)|Atop)|Plus(?:Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(?:stom(?:SelectorPredicateOperatorType|PaletteModeColorPanel)|r(?:sor(?:Update(?:Mask)?|PointingDevice)|veToBezierPathElement))|e(?:nterT(?:extAlignment|abStopType)|ll(?:State|H(?:ighlighted|as(?:Image(?:Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(?:Bordered|InsetButton)|Disabled|Editable|LightsBy(?:Gray|Background|Contents)|AllowsMixedState))|l(?:ipPagination|o(?:s(?:ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(?:ControlTint|DisplayFunctionKey|LineFunctionKey))|a(?:seInsensitive(?:Search|PredicateOption)|n(?:notCreateScriptCommandError|cel(?:Button|TextMovement))|chesDirectory|lculation(?:NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageReturnCharacter)|r(?:itical(?:Request|AlertStyle)|ayonModeColorPanel))|T(?:hick(?:SquareBezelStyle|erSquareBezelStyle)|ypesetter(?:Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(?:ineBreakAction|atestBehavior))|i(?:ckMark(?:Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(?:olbarItemVisibilityPriority(?:Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(?:Compression(?:N(?:one|EXT)|CCITTFAX(?:3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(?:rminate(?:Now|Cancel|Later)|xt(?:Read(?:InapplicableDocumentTypeError|WriteErrorM(?:inimum|aximum))|Block(?:M(?:i(?:nimum(?:Height|Width)|ddleAlignment)|a(?:rgin|ximum(?:Height|Width)))|B(?:o(?:ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(?:ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(?:Characters|Attributes)|CellType|ured(?:RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(?:FixedLayoutAlgorithm|AutomaticLayoutAlgorithm)|Field(?:RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(?:Character|TextMovement|le(?:tP(?:oint(?:Mask|EventSubtype)?|roximity(?:Mask|EventSubtype)?)|Column(?:NoResizing|UserResizingMask|AutoresizingMask)|View(?:ReverseSequentialColumnAutoresizingStyle|GridNone|S(?:olid(?:HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(?:n(?:sert(?:CharFunctionKey|FunctionKey|LineFunctionKey)|t(?:Type|ernalS(?:criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(?:Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(?:2022JPStringEncoding|Latin(?:1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(?:R(?:ight|ep(?:MatchesDevice|LoadStatus(?:ReadingHeader|Completed|InvalidData|Un(?:expectedEOF|knownType)|WillNeedAllData)))|Below|C(?:ellType|ache(?:BySize|Never|Default|Always))|Interpolation(?:High|None|Default|Low)|O(?:nly|verlaps)|Frame(?:Gr(?:oove|ayBezel)|Button|None|Photo)|L(?:oadStatus(?:ReadError|C(?:ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(?:lign(?:Right|Bottom(?:Right|Left)?|Center|Top(?:Right|Left)?|Left)|bove)))|O(?:n(?:State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|TextMovement)|SF1OperatingSystem|pe(?:n(?:GL(?:GO(?:Re(?:setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(?:R(?:obust|endererID)|M(?:inimumPolicy|ulti(?:sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(?:creenMask|te(?:ncilSize|reo)|ingleRenderer|upersample|ample(?:s|Buffers|Alpha))|NoRecovery|C(?:o(?:lor(?:Size|Float)|mpliant)|losestPolicy)|OffScreen|D(?:oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(?:cc(?:umSize|elerated)|ux(?:Buffers|DepthStencil)|l(?:phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(?:criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(?:B(?:itfield|oolType)|S(?:hortType|tr(?:ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(?:Type|longType)|ArrayType))|D(?:i(?:s(?:c(?:losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(?:Selection|PredicateModifier))|o(?:c(?:ModalWindowMask|ument(?:Directory|ationDirectory))|ubleType|wn(?:TextMovement|ArrowFunctionKey))|e(?:s(?:cendingPageOrder|ktopDirectory)|cimalTabStopType|v(?:ice(?:NColorSpaceModel|IndependentModifierFlagsMask)|eloper(?:Directory|ApplicationDirectory))|fault(?:ControlTint|TokenStyle)|lete(?:Char(?:acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(?:yCalendarUnit|teFormatter(?:MediumStyle|Behavior(?:10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(?:wer(?:Clos(?:ingState|edState)|Open(?:ingState|State))|gOperation(?:Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(?:ser(?:CancelledError|D(?:irectory|omainMask)|FunctionKey)|RL(?:Handle(?:NotLoaded|Load(?:Succeeded|InProgress|Failed))|CredentialPersistence(?:None|Permanent|ForSession))|n(?:scaledWindowMask|cachedRead|i(?:codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(?:o(?:CloseGroupingRunLoopOrdering|FunctionKey)|e(?:finedDateComponent|rline(?:Style(?:Single|None|Thick|Double)|Pattern(?:Solid|D(?:ot|ash(?:Dot(?:Dot)?)?)))))|known(?:ColorSpaceModel|P(?:ointingDevice|ageOrder)|KeyS(?:criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(?:dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(?:ustifiedTextAlignment|PEG(?:2000FileType|FileType)|apaneseEUC(?:GlyphPacking|StringEncoding))|P(?:o(?:s(?:t(?:Now|erFontMask|WhenIdle|ASAP)|iti(?:on(?:Replace|Be(?:fore|ginning)|End|After)|ve(?:IntType|DoubleType|FloatType)))|pUp(?:NoArrow|ArrowAt(?:Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(?:InCell(?:Mask)?|OnPushOffButton)|e(?:n(?:TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(?:Mask)?)|P(?:S(?:caleField|tatus(?:Title|Field)|aveButton)|N(?:ote(?:Title|Field)|ame(?:Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(?:a(?:perFeedButton|ge(?:Range(?:To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(?:useFunctionKey|ragraphSeparatorCharacter|ge(?:DownFunctionKey|UpFunctionKey))|r(?:int(?:ing(?:ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(?:NotFound|OK|Error)|FunctionKey)|o(?:p(?:ertyList(?:XMLFormat|MutableContainers(?:AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(?:BarStyle|SpinningStyle|Preferred(?:SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(?:ssedTab|vFunctionKey))|L(?:HeightForm|CancelButton|TitleField|ImageButton|O(?:KButton|rientationMatrix)|UnitsButton|PaperNameButton|WidthForm))|E(?:n(?:terCharacter|d(?:sWith(?:Comparison|PredicateOperatorType)|FunctionKey))|v(?:e(?:nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(?:Comparison|PredicateOperatorType)|ra(?:serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(?:clude(?:10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(?:i(?:ew(?:M(?:in(?:XMargin|YMargin)|ax(?:XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(?:lidationErrorM(?:inimum|aximum)|riableExpressionType))|Key(?:SpecifierEvaluationScriptError|Down(?:Mask)?|Up(?:Mask)?|PathExpressionType|Value(?:MinusSetMutation|SetSetMutation|Change(?:Re(?:placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(?:New|Old)|UnionSetMutation|ValidationError))|QTMovie(?:NormalPlayback|Looping(?:BackAndForthPlayback|Playback))|F(?:1(?:1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|7FunctionKey|i(?:nd(?:PanelAction(?:Replace(?:A(?:ndFind|ll(?:InSelection)?))?|S(?:howFindPanel|e(?:tFindString|lectAll(?:InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(?:Read(?:No(?:SuchFileError|PermissionError)|CorruptFileError|In(?:validFileNameError|applicableStringEncodingError)|Un(?:supportedSchemeError|knownError))|HandlingPanel(?:CancelButton|OKButton)|NoSuchFileError|ErrorM(?:inimum|aximum)|Write(?:NoPermissionError|In(?:validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(?:supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(?:1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(?:nt(?:Mo(?:noSpaceTrait|dernSerifsClass)|BoldTrait|S(?:ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(?:o(?:ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(?:ntegerAdvancementsRenderingMode|talicTrait)|O(?:ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(?:nknownClass|IOptimizedTrait)|Panel(?:S(?:hadowEffectModeMask|t(?:andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(?:ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(?:amilyClassMask|reeformSerifsClass)|Antialiased(?:RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(?:Below|Type(?:None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(?:attingError(?:M(?:inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(?:ExpressionType|KeyMask)|3(?:1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(?:RevertButton|S(?:ize(?:Title|Field)|etButton)|CurrentField|Preview(?:Button|Field))|l(?:oat(?:ingPointSamplesBitmapFormat|Type)|agsChanged(?:Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(?:heelModeColorPanel|indow(?:s(?:NTOperatingSystem|CP125(?:1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(?:InterfaceStyle|OperatingSystem))|M(?:iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(?:NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(?:ctivation|ddingToRecents)|A(?:sync|nd(?:Hide(?:Others)?|Print)|llowingClassicStartup))|eek(?:day(?:CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(?:ntsBidiLevels|rningAlertStyle)|r(?:itingDirection(?:RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(?:i(?:stModeMatrix|ne(?:Moves(?:Right|Down|Up|Left)|B(?:order|reakBy(?:C(?:harWrapping|lipping)|Truncating(?:Middle|Head|Tail)|WordWrapping))|S(?:eparatorCharacter|weep(?:Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(?:ssThan(?:Comparison|OrEqualTo(?:Comparison|PredicateOperatorType)|PredicateOperatorType)|ft(?:Mouse(?:D(?:own(?:Mask)?|ragged(?:Mask)?)|Up(?:Mask)?)|T(?:ext(?:Movement|Alignment)|ab(?:sBezelBorder|StopType))|ArrowFunctionKey))|a(?:yout(?:RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(?:sc(?:iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(?:y(?:Type|PredicateModifier|EventMask)|choredSearch|imation(?:Blocking|Nonblocking(?:Threaded)?|E(?:ffect(?:DisappearingItemDefault|Poof)|ase(?:In(?:Out)?|Out))|Linear)|dPredicateType)|t(?:Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(?:obe(?:GB1CharacterCollection|CNS1CharacterCollection|Japan(?:1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(?:saveOperation|Pagination)|pp(?:lication(?:SupportDirectory|D(?:irectory|e(?:fined(?:Mask)?|legateReply(?:Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(?:Mask)?)|l(?:ternateKeyMask|pha(?:ShiftKeyMask|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(?:SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(?:ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(?:sWrongScriptError|EvaluationScriptError)|bove(?:Bottom|Top)|WTEventType)))(?:\\\\b)\"},{token:\"support.function.C99.c\",regex:s.cFunctions},{token:n.getKeywords(),regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"punctuation.section.scope.begin.objc\",regex:\"\\\\[\",next:\"bracketed_content\"},{token:\"meta.function.objc\",regex:\"^(?:-|\\\\+)\\\\s*\"}],constant_NSString:[{token:\"constant.character.escape.objc\",regex:e},{token:\"invalid.illegal.unknown-escape.objc\",regex:\"\\\\\\\\.\"},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"punctuation.definition.string.end\",regex:'\"',next:\"start\"}],protocol_list:[{token:\"punctuation.section.scope.end.objc\",regex:\">\",next:\"start\"},{token:\"support.other.protocol.objc\",regex:\"\\bNS(?:GlyphStorage|M(?:utableCopying|enuItem)|C(?:hangeSpelling|o(?:ding|pying|lorPicking(?:Custom|Default)))|T(?:oolbarItemValidations|ext(?:Input|AttachmentCell))|I(?:nputServ(?:iceProvider|erMouseTracker)|gnoreMisspelledWords)|Obj(?:CTypeSerializationCallBack|ect)|D(?:ecimalNumberBehaviors|raggingInfo)|U(?:serInterfaceValidations|RL(?:HandleClient|DownloadDelegate|ProtocolClient|AuthenticationChallengeSender))|Validated(?:ToobarItem|UserInterfaceItem)|Locking)\\b\"}],selectors:[{token:\"support.function.any-method.name-of-parameter.objc\",regex:\"\\\\b(?:[a-zA-Z_:][\\\\w]*)+\"},{token:\"punctuation\",regex:\"\\\\)\",next:\"start\"}],bracketed_content:[{token:\"punctuation.section.scope.end.objc\",regex:\"]\",next:\"start\"},{token:[\"support.function.any-method.objc\"],regex:\"(?:predicateWithFormat:| NSPredicate predicateWithFormat:)\",next:\"start\"},{token:\"support.function.any-method.objc\",regex:\"\\\\w+(?::|(?=]))\",next:\"start\"}],bracketed_strings:[{token:\"punctuation.section.scope.end.objc\",regex:\"]\",next:\"start\"},{token:\"keyword.operator.logical.predicate.cocoa\",regex:\"\\\\b(?:AND|OR|NOT|IN)\\\\b\"},{token:[\"invalid.illegal.unknown-method.objc\",\"punctuation.separator.arguments.objc\"],regex:\"\\\\b(w+)(:)\"},{regex:\"\\\\b(?:ALL|ANY|SOME|NONE)\\\\b\",token:\"constant.language.predicate.cocoa\"},{regex:\"\\\\b(?:NULL|NIL|SELF|TRUE|YES|FALSE|NO|FIRST|LAST|SIZE)\\\\b\",token:\"constant.language.predicate.cocoa\"},{regex:\"\\\\b(?:MATCHES|CONTAINS|BEGINSWITH|ENDSWITH|BETWEEN)\\\\b\",token:\"keyword.operator.comparison.predicate.cocoa\"},{regex:\"\\\\bC(?:ASEINSENSITIVE|I)\\\\b\",token:\"keyword.other.modifier.predicate.cocoa\"},{regex:\"\\\\b(?:ANYKEY|SUBQUERY|CAST|TRUEPREDICATE|FALSEPREDICATE)\\\\b\",token:\"keyword.other.predicate.cocoa\"},{regex:e,token:\"constant.character.escape.objc\"},{regex:\"\\\\\\\\.\",token:\"invalid.illegal.unknown-escape.objc\"},{token:\"string\",regex:'[^\"\\\\\\\\]'},{token:\"punctuation.definition.string.end.objc\",regex:'\"',next:\"predicates\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],methods:[{token:\"meta.function.objc\",regex:\"(?=\\\\{|#)|;\",next:\"start\"}]};for(var u in r)this.$rules[u]?this.$rules[u].push&&this.$rules[u].push.apply(this.$rules[u],r[u]):this.$rules[u]=r[u];this.$rules.bracketed_content=this.$rules.bracketed_content.concat(this.$rules.start,t),this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,o),t.ObjectiveCHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ocaml.js",
    "content": "define(\"ace/mode/ocaml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ocaml_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ocaml_highlight_rules\").OcamlHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=function(){this.HighlightRules=s,this.$outdent=new o};r.inherits(a,i);var f=/(?:[({[=:]|[-=]>|\\b(?:else|try|with))\\s*$/;(function(){this.toggleCommentLines=function(e,t,n,r){var i,s,o=!0,a=/^\\s*\\(\\*(.*)\\*\\)/;for(i=n;i<=r;i++)if(!a.test(t.getLine(i))){o=!1;break}var f=new u(0,0,0,0);for(i=n;i<=r;i++)s=t.getLine(i),f.start.row=i,f.end.row=i,f.end.column=s.length,t.replace(f,o?s.match(a)[1]:\"(*\"+s+\"*)\")},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;return(!i.length||i[i.length-1].type!==\"comment\")&&e===\"start\"&&f.test(t)&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/ocaml\"}).call(a.prototype),t.Mode=a}),define(\"ace/mode/ocaml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|object|of|open|or|private|rec|sig|struct|then|to|try|type|val|virtual|when|while|with\",t=\"true|false\",n=\"abs|abs_big_int|abs_float|abs_num|abstract_tag|accept|access|acos|add|add_available_units|add_big_int|add_buffer|add_channel|add_char|add_initializer|add_int_big_int|add_interfaces|add_num|add_string|add_substitute|add_substring|alarm|allocated_bytes|allow_only|allow_unsafe_modules|always|append|appname_get|appname_set|approx_num_exp|approx_num_fix|arg|argv|arith_status|array|array1_of_genarray|array2_of_genarray|array3_of_genarray|asin|asr|assoc|assq|at_exit|atan|atan2|auto_synchronize|background|basename|beginning_of_input|big_int_of_int|big_int_of_num|big_int_of_string|bind|bind_class|bind_tag|bits|bits_of_float|black|blit|blit_image|blue|bool|bool_of_string|bounded_full_split|bounded_split|bounded_split_delim|bprintf|break|broadcast|bscanf|button_down|c_layout|capitalize|cardinal|cardinal|catch|catch_break|ceil|ceiling_num|channel|char|char_of_int|chdir|check|check_suffix|chmod|choose|chop_extension|chop_suffix|chown|chown|chr|chroot|classify_float|clear|clear_available_units|clear_close_on_exec|clear_graph|clear_nonblock|clear_parser|close|close|closeTk|close_box|close_graph|close_in|close_in_noerr|close_out|close_out_noerr|close_process|close_process|close_process_full|close_process_in|close_process_out|close_subwindow|close_tag|close_tbox|closedir|closedir|closure_tag|code|combine|combine|combine|command|compact|compare|compare_big_int|compare_num|complex32|complex64|concat|conj|connect|contains|contains_from|contents|copy|cos|cosh|count|count|counters|create|create_alarm|create_image|create_matrix|create_matrix|create_matrix|create_object|create_object_and_run_initializers|create_object_opt|create_process|create_process|create_process_env|create_process_env|create_table|current|current_dir_name|current_point|current_x|current_y|curveto|custom_tag|cyan|data_size|decr|decr_num|default_available_units|delay|delete_alarm|descr_of_in_channel|descr_of_out_channel|destroy|diff|dim|dim1|dim2|dim3|dims|dirname|display_mode|div|div_big_int|div_num|double_array_tag|double_tag|draw_arc|draw_char|draw_circle|draw_ellipse|draw_image|draw_poly|draw_poly_line|draw_rect|draw_segments|draw_string|dummy_pos|dummy_table|dump_image|dup|dup2|elements|empty|end_of_input|environment|eprintf|epsilon_float|eq_big_int|eq_num|equal|err_formatter|error_message|escaped|establish_server|executable_name|execv|execve|execvp|execvpe|exists|exists2|exit|exp|failwith|fast_sort|fchmod|fchown|field|file|file_exists|fill|fill_arc|fill_circle|fill_ellipse|fill_poly|fill_rect|filter|final_tag|finalise|find|find_all|first_chars|firstkey|flatten|float|float32|float64|float_of_big_int|float_of_bits|float_of_int|float_of_num|float_of_string|floor|floor_num|flush|flush_all|flush_input|flush_str_formatter|fold|fold_left|fold_left2|fold_right|fold_right2|for_all|for_all2|force|force_newline|force_val|foreground|fork|format_of_string|formatter_of_buffer|formatter_of_out_channel|fortran_layout|forward_tag|fprintf|frexp|from|from_channel|from_file|from_file_bin|from_function|from_string|fscanf|fst|fstat|ftruncate|full_init|full_major|full_split|gcd_big_int|ge_big_int|ge_num|genarray_of_array1|genarray_of_array2|genarray_of_array3|get|get_all_formatter_output_functions|get_approx_printing|get_copy|get_ellipsis_text|get_error_when_null_denominator|get_floating_precision|get_formatter_output_functions|get_formatter_tag_functions|get_image|get_margin|get_mark_tags|get_max_boxes|get_max_indent|get_method|get_method_label|get_normalize_ratio|get_normalize_ratio_when_printing|get_print_tags|get_state|get_variable|getcwd|getegid|getegid|getenv|getenv|getenv|geteuid|geteuid|getgid|getgid|getgrgid|getgrgid|getgrnam|getgrnam|getgroups|gethostbyaddr|gethostbyname|gethostname|getitimer|getlogin|getpeername|getpid|getppid|getprotobyname|getprotobynumber|getpwnam|getpwuid|getservbyname|getservbyport|getsockname|getsockopt|getsockopt_float|getsockopt_int|getsockopt_optint|gettimeofday|getuid|global_replace|global_substitute|gmtime|green|grid|group_beginning|group_end|gt_big_int|gt_num|guard|handle_unix_error|hash|hash_param|hd|header_size|i|id|ignore|in_channel_length|in_channel_of_descr|incr|incr_num|index|index_from|inet_addr_any|inet_addr_of_string|infinity|infix_tag|init|init_class|input|input_binary_int|input_byte|input_char|input_line|input_value|int|int16_signed|int16_unsigned|int32|int64|int8_signed|int8_unsigned|int_of_big_int|int_of_char|int_of_float|int_of_num|int_of_string|integer_num|inter|interactive|inv|invalid_arg|is_block|is_empty|is_implicit|is_int|is_int_big_int|is_integer_num|is_relative|iter|iter2|iteri|join|junk|key_pressed|kill|kind|kprintf|kscanf|land|last_chars|layout|lazy_from_fun|lazy_from_val|lazy_is_val|lazy_tag|ldexp|le_big_int|le_num|length|lexeme|lexeme_char|lexeme_end|lexeme_end_p|lexeme_start|lexeme_start_p|lineto|link|list|listen|lnot|loadfile|loadfile_private|localtime|lock|lockf|log|log10|logand|lognot|logor|logxor|lor|lower_window|lowercase|lseek|lsl|lsr|lstat|lt_big_int|lt_num|lxor|magenta|magic|mainLoop|major|major_slice|make|make_formatter|make_image|make_lexer|make_matrix|make_self_init|map|map2|map_file|mapi|marshal|match_beginning|match_end|matched_group|matched_string|max|max_array_length|max_big_int|max_elt|max_float|max_int|max_num|max_string_length|mem|mem_assoc|mem_assq|memq|merge|min|min_big_int|min_elt|min_float|min_int|min_num|minor|minus_big_int|minus_num|minus_one|mkdir|mkfifo|mktime|mod|mod_big_int|mod_float|mod_num|modf|mouse_pos|moveto|mul|mult_big_int|mult_int_big_int|mult_num|nan|narrow|nat_of_num|nativeint|neg|neg_infinity|new_block|new_channel|new_method|new_variable|next|nextkey|nice|nice|no_scan_tag|norm|norm2|not|npeek|nth|nth_dim|num_digits_big_int|num_dims|num_of_big_int|num_of_int|num_of_nat|num_of_ratio|num_of_string|O|obj|object_tag|ocaml_version|of_array|of_channel|of_float|of_int|of_int32|of_list|of_nativeint|of_string|one|openTk|open_box|open_connection|open_graph|open_hbox|open_hovbox|open_hvbox|open_in|open_in_bin|open_in_gen|open_out|open_out_bin|open_out_gen|open_process|open_process_full|open_process_in|open_process_out|open_subwindow|open_tag|open_tbox|open_temp_file|open_vbox|opendbm|opendir|openfile|or|os_type|out_channel_length|out_channel_of_descr|output|output_binary_int|output_buffer|output_byte|output_char|output_string|output_value|over_max_boxes|pack|params|parent_dir_name|parse|parse_argv|partition|pause|peek|pipe|pixels|place|plot|plots|point_color|polar|poll|pop|pos_in|pos_out|pow|power_big_int_positive_big_int|power_big_int_positive_int|power_int_positive_big_int|power_int_positive_int|power_num|pp_close_box|pp_close_tag|pp_close_tbox|pp_force_newline|pp_get_all_formatter_output_functions|pp_get_ellipsis_text|pp_get_formatter_output_functions|pp_get_formatter_tag_functions|pp_get_margin|pp_get_mark_tags|pp_get_max_boxes|pp_get_max_indent|pp_get_print_tags|pp_open_box|pp_open_hbox|pp_open_hovbox|pp_open_hvbox|pp_open_tag|pp_open_tbox|pp_open_vbox|pp_over_max_boxes|pp_print_as|pp_print_bool|pp_print_break|pp_print_char|pp_print_cut|pp_print_float|pp_print_flush|pp_print_if_newline|pp_print_int|pp_print_newline|pp_print_space|pp_print_string|pp_print_tab|pp_print_tbreak|pp_set_all_formatter_output_functions|pp_set_ellipsis_text|pp_set_formatter_out_channel|pp_set_formatter_output_functions|pp_set_formatter_tag_functions|pp_set_margin|pp_set_mark_tags|pp_set_max_boxes|pp_set_max_indent|pp_set_print_tags|pp_set_tab|pp_set_tags|pred|pred_big_int|pred_num|prerr_char|prerr_endline|prerr_float|prerr_int|prerr_newline|prerr_string|print|print_as|print_bool|print_break|print_char|print_cut|print_endline|print_float|print_flush|print_if_newline|print_int|print_newline|print_space|print_stat|print_string|print_tab|print_tbreak|printf|prohibit|public_method_label|push|putenv|quo_num|quomod_big_int|quote|raise|raise_window|ratio_of_num|rcontains_from|read|read_float|read_int|read_key|read_line|readdir|readdir|readlink|really_input|receive|recv|recvfrom|red|ref|regexp|regexp_case_fold|regexp_string|regexp_string_case_fold|register|register_exception|rem|remember_mode|remove|remove_assoc|remove_assq|rename|replace|replace_first|replace_matched|repr|reset|reshape|reshape_1|reshape_2|reshape_3|rev|rev_append|rev_map|rev_map2|rewinddir|rgb|rhs_end|rhs_end_pos|rhs_start|rhs_start_pos|rindex|rindex_from|rlineto|rmdir|rmoveto|round_num|run_initializers|run_initializers_opt|scanf|search_backward|search_forward|seek_in|seek_out|select|self|self_init|send|sendto|set|set_all_formatter_output_functions|set_approx_printing|set_binary_mode_in|set_binary_mode_out|set_close_on_exec|set_close_on_exec|set_color|set_ellipsis_text|set_error_when_null_denominator|set_field|set_floating_precision|set_font|set_formatter_out_channel|set_formatter_output_functions|set_formatter_tag_functions|set_line_width|set_margin|set_mark_tags|set_max_boxes|set_max_indent|set_method|set_nonblock|set_nonblock|set_normalize_ratio|set_normalize_ratio_when_printing|set_print_tags|set_signal|set_state|set_tab|set_tag|set_tags|set_text_size|set_window_title|setgid|setgid|setitimer|setitimer|setsid|setsid|setsockopt|setsockopt|setsockopt_float|setsockopt_float|setsockopt_int|setsockopt_int|setsockopt_optint|setsockopt_optint|setuid|setuid|shift_left|shift_left|shift_left|shift_right|shift_right|shift_right|shift_right_logical|shift_right_logical|shift_right_logical|show_buckets|shutdown|shutdown|shutdown_connection|shutdown_connection|sigabrt|sigalrm|sigchld|sigcont|sigfpe|sighup|sigill|sigint|sigkill|sign_big_int|sign_num|signal|signal|sigpending|sigpending|sigpipe|sigprocmask|sigprocmask|sigprof|sigquit|sigsegv|sigstop|sigsuspend|sigsuspend|sigterm|sigtstp|sigttin|sigttou|sigusr1|sigusr2|sigvtalrm|sin|singleton|sinh|size|size|size_x|size_y|sleep|sleep|sleep|slice_left|slice_left|slice_left_1|slice_left_2|slice_right|slice_right|slice_right_1|slice_right_2|snd|socket|socket|socket|socketpair|socketpair|sort|sound|split|split_delim|sprintf|sprintf|sqrt|sqrt|sqrt_big_int|square_big_int|square_num|sscanf|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|stable_sort|stat|stat|stat|stat|stat|stats|stats|std_formatter|stdbuf|stderr|stderr|stderr|stdib|stdin|stdin|stdin|stdout|stdout|stdout|str_formatter|string|string_after|string_before|string_match|string_of_big_int|string_of_bool|string_of_float|string_of_format|string_of_inet_addr|string_of_inet_addr|string_of_int|string_of_num|string_partial_match|string_tag|sub|sub|sub_big_int|sub_left|sub_num|sub_right|subset|subset|substitute_first|substring|succ|succ|succ|succ|succ_big_int|succ_num|symbol_end|symbol_end_pos|symbol_start|symbol_start_pos|symlink|symlink|sync|synchronize|system|system|system|tag|take|tan|tanh|tcdrain|tcdrain|tcflow|tcflow|tcflush|tcflush|tcgetattr|tcgetattr|tcsendbreak|tcsendbreak|tcsetattr|tcsetattr|temp_file|text_size|time|time|time|timed_read|timed_write|times|times|tl|tl|tl|to_buffer|to_channel|to_float|to_hex|to_int|to_int32|to_list|to_list|to_list|to_nativeint|to_string|to_string|to_string|to_string|to_string|top|top|total_size|transfer|transp|truncate|truncate|truncate|truncate|truncate|truncate|try_lock|umask|umask|uncapitalize|uncapitalize|uncapitalize|union|union|unit_big_int|unlink|unlink|unlock|unmarshal|unsafe_blit|unsafe_fill|unsafe_get|unsafe_get|unsafe_set|unsafe_set|update|uppercase|uppercase|uppercase|uppercase|usage|utimes|utimes|wait|wait|wait|wait|wait_next_event|wait_pid|wait_read|wait_signal|wait_timed_read|wait_timed_write|wait_write|waitpid|white|widen|window_id|word_size|wrap|wrap_abort|write|yellow|yield|zero|zero_big_int|Arg|Arith_status|Array|Array1|Array2|Array3|ArrayLabels|Big_int|Bigarray|Buffer|Callback|CamlinternalOO|Char|Complex|Condition|Dbm|Digest|Dynlink|Event|Filename|Format|Gc|Genarray|Genlex|Graphics|GraphicsX11|Hashtbl|Int32|Int64|LargeFile|Lazy|Lexing|List|ListLabels|Make|Map|Marshal|MoreLabels|Mutex|Nativeint|Num|Obj|Oo|Parsing|Pervasives|Printexc|Printf|Queue|Random|Scanf|Scanning|Set|Sort|Stack|State|StdLabels|Str|Stream|String|StringLabels|Sys|Thread|ThreadUnix|Tk|Unix|UnixLabels|Weak\",r=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"constant.language\":t,\"support.function\":n},\"identifier\"),i=\"(?:(?:[1-9]\\\\d*)|(?:0))\",s=\"(?:0[oO]?[0-7]+)\",o=\"(?:0[xX][\\\\dA-Fa-f]+)\",u=\"(?:0[bB][01]+)\",a=\"(?:\"+i+\"|\"+s+\"|\"+o+\"|\"+u+\")\",f=\"(?:[eE][+-]?\\\\d+)\",l=\"(?:\\\\.\\\\d+)\",c=\"(?:\\\\d+)\",h=\"(?:(?:\"+c+\"?\"+l+\")|(?:\"+c+\"\\\\.))\",p=\"(?:(?:\"+h+\"|\"+c+\")\"+f+\")\",d=\"(?:\"+p+\"|\"+h+\")\";this.$rules={start:[{token:\"comment\",regex:\"\\\\(\\\\*.*?\\\\*\\\\)\\\\s*?$\"},{token:\"comment\",regex:\"\\\\(\\\\*.*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"'.'\"},{token:\"string\",regex:'\"',next:\"qstring\"},{token:\"constant.numeric\",regex:\"(?:\"+d+\"|\\\\d+)[jJ]\\\\b\"},{token:\"constant.numeric\",regex:d},{token:\"constant.numeric\",regex:a+\"\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+\\\\.|\\\\-\\\\.|\\\\*\\\\.|\\\\/\\\\.|#|;;|\\\\+|\\\\-|\\\\*|\\\\*\\\\*\\\\/|\\\\/\\\\/|%|<<|>>|&|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|<-|=\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\)\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qstring:[{token:\"string\",regex:'\"',next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(s,i),t.OcamlHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-pascal.js",
    "content": "define(\"ace/mode/pascal\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/pascal_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./pascal_highlight_rules\").PascalHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=[\"--\",\"//\"],this.blockComment=[{start:\"(*\",end:\"*)\"},{start:\"{\",end:\"}\"}],this.$id=\"ace/mode/pascal\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/pascal_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{caseInsensitive:!0,token:\"keyword.control.pascal\",regex:\"\\\\b(?:(absolute|abstract|all|and|and_then|array|as|asm|attribute|begin|bindable|case|class|const|constructor|destructor|div|do|do|else|end|except|export|exports|external|far|file|finalization|finally|for|forward|goto|if|implementation|import|in|inherited|initialization|interface|interrupt|is|label|library|mod|module|name|near|nil|not|object|of|only|operator|or|or_else|otherwise|packed|pow|private|program|property|protected|public|published|qualified|record|repeat|resident|restricted|segment|set|shl|shr|then|to|try|type|unit|until|uses|value|var|view|virtual|while|with|xor))\\\\b\"},{caseInsensitive:!0,token:[\"variable.pascal\",\"text\",\"storage.type.prototype.pascal\",\"entity.name.function.prototype.pascal\"],regex:\"\\\\b(function|procedure)(\\\\s+)(\\\\w+)(\\\\.\\\\w+)?(?=(?:\\\\(.*?\\\\))?;\\\\s*(?:attribute|forward|external))\"},{caseInsensitive:!0,token:[\"variable.pascal\",\"text\",\"storage.type.function.pascal\",\"entity.name.function.pascal\"],regex:\"\\\\b(function|procedure)(\\\\s+)(\\\\w+)(\\\\.\\\\w+)?\"},{token:\"constant.numeric.pascal\",regex:\"\\\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\\\.?[0-9]*)|(\\\\.[0-9]+))((e|E)(\\\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"punctuation.definition.comment.pascal\",regex:\"--.*$\",push_:[{token:\"comment.line.double-dash.pascal.one\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.double-dash.pascal.one\"}]},{token:\"punctuation.definition.comment.pascal\",regex:\"//.*$\",push_:[{token:\"comment.line.double-slash.pascal.two\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.double-slash.pascal.two\"}]},{token:\"punctuation.definition.comment.pascal\",regex:\"\\\\(\\\\*\",push:[{token:\"punctuation.definition.comment.pascal\",regex:\"\\\\*\\\\)\",next:\"pop\"},{defaultToken:\"comment.block.pascal.one\"}]},{token:\"punctuation.definition.comment.pascal\",regex:\"\\\\{\",push:[{token:\"punctuation.definition.comment.pascal\",regex:\"\\\\}\",next:\"pop\"},{defaultToken:\"comment.block.pascal.two\"}]},{token:\"punctuation.definition.string.begin.pascal\",regex:'\"',push:[{token:\"constant.character.escape.pascal\",regex:\"\\\\\\\\.\"},{token:\"punctuation.definition.string.end.pascal\",regex:'\"',next:\"pop\"},{defaultToken:\"string.quoted.double.pascal\"}]},{token:\"punctuation.definition.string.begin.pascal\",regex:\"'\",push:[{token:\"constant.character.escape.apostrophe.pascal\",regex:\"''\"},{token:\"punctuation.definition.string.end.pascal\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.quoted.single.pascal\"}]},{token:\"keyword.operator\",regex:\"[+\\\\-;,/*%]|:=|=\"}]},this.normalizeRules()};r.inherits(s,i),t.PascalHighlightRules=s}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-perl.js",
    "content": "define(\"ace/mode/perl\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/perl_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./perl_highlight_rules\").PerlHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new a({start:\"^=(begin|item)\\\\b\",end:\"^=(cut)\\\\b\"})};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.blockComment=[{start:\"=begin\",end:\"=cut\"},{start:\"=item\",end:\"=cut\"}],this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/perl\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/perl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars\",t=\"ARGV|ENV|INC|SIG\",n=\"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do\",r=this.createKeywordMapper({keyword:e,\"constant.language\":t,\"support.function\":n},\"identifier\");this.$rules={start:[{token:\"comment.doc\",regex:\"^=(?:begin|item)\\\\b\",next:\"block_comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0x[0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"%#|\\\\$#|\\\\.\\\\.\\\\.|\\\\|\\\\|=|>>=|<<=|<=>|&&=|=>|!~|\\\\^=|&=|\\\\|=|\\\\.=|x=|%=|\\\\/=|\\\\*=|\\\\-=|\\\\+=|=~|\\\\*\\\\*|\\\\-\\\\-|\\\\.\\\\.|\\\\|\\\\||&&|\\\\+\\\\+|\\\\->|!=|==|>=|<=|>>|<<|,|=|\\\\?\\\\:|\\\\^|\\\\||x|%|\\\\/|\\\\*|<|&|\\\\\\\\|~|!|>|\\\\.|\\\\-|\\\\+|\\\\-C|\\\\-b|\\\\-S|\\\\-u|\\\\-t|\\\\-p|\\\\-l|\\\\-d|\\\\-f|\\\\-g|\\\\-s|\\\\-z|\\\\-k|\\\\-e|\\\\-O|\\\\-T|\\\\-B|\\\\-M|\\\\-A|\\\\-X|\\\\-W|\\\\-c|\\\\-R|\\\\-o|\\\\-x|\\\\-w|\\\\-r|\\\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\"},{token:\"comment\",regex:\"#.*$\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],block_comment:[{token:\"comment.doc\",regex:\"^=cut\\\\b\",next:\"start\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),t.PerlHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-pgsql.js",
    "content": "define(\"ace/mode/pgsql\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/pgsql_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../mode/text\").Mode,s=e(\"./pgsql_highlight_rules\").PgsqlHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){return e==\"start\"||e==\"keyword.statementEnd\"?\"\":this.$getIndent(t)},this.$id=\"ace/mode/pgsql\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/pgsql_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\",\"ace/mode/perl_highlight_rules\",\"ace/mode/python_highlight_rules\",\"ace/mode/json_highlight_rules\",\"ace/mode/javascript_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=e(\"./perl_highlight_rules\").PerlHighlightRules,a=e(\"./python_highlight_rules\").PythonHighlightRules,f=e(\"./json_highlight_rules\").JsonHighlightRules,l=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,c=function(){var e=\"abort|absolute|abstime|access|aclitem|action|add|admin|after|aggregate|all|also|alter|always|analyse|analyze|and|any|anyarray|anyelement|anyenum|anynonarray|anyrange|array|as|asc|assertion|assignment|asymmetric|at|attribute|authorization|backward|before|begin|between|bigint|binary|bit|bool|boolean|both|box|bpchar|by|bytea|cache|called|cascade|cascaded|case|cast|catalog|chain|char|character|characteristics|check|checkpoint|cid|cidr|circle|class|close|cluster|coalesce|collate|collation|column|comment|comments|commit|committed|concurrently|configuration|connection|constraint|constraints|content|continue|conversion|copy|cost|create|cross|cstring|csv|current|current_catalog|current_date|current_role|current_schema|current_time|current_timestamp|current_user|cursor|cycle|data|database|date|daterange|day|deallocate|dec|decimal|declare|default|defaults|deferrable|deferred|definer|delete|delimiter|delimiters|desc|dictionary|disable|discard|distinct|do|document|domain|double|drop|each|else|enable|encoding|encrypted|end|enum|escape|event|event_trigger|except|exclude|excluding|exclusive|execute|exists|explain|extension|external|extract|false|family|fdw_handler|fetch|first|float|float4|float8|following|for|force|foreign|forward|freeze|from|full|function|functions|global|grant|granted|greatest|group|gtsvector|handler|having|header|hold|hour|identity|if|ilike|immediate|immutable|implicit|in|including|increment|index|indexes|inet|inherit|inherits|initially|inline|inner|inout|input|insensitive|insert|instead|int|int2|int2vector|int4|int4range|int8|int8range|integer|internal|intersect|interval|into|invoker|is|isnull|isolation|join|json|key|label|language|language_handler|large|last|lateral|lc_collate|lc_ctype|leading|leakproof|least|left|level|like|limit|line|listen|load|local|localtime|localtimestamp|location|lock|lseg|macaddr|mapping|match|materialized|maxvalue|minute|minvalue|mode|money|month|move|name|names|national|natural|nchar|next|no|none|not|nothing|notify|notnull|nowait|null|nullif|nulls|numeric|numrange|object|of|off|offset|oid|oids|oidvector|on|only|opaque|operator|option|options|or|order|out|outer|over|overlaps|overlay|owned|owner|parser|partial|partition|passing|password|path|pg_attribute|pg_auth_members|pg_authid|pg_class|pg_database|pg_node_tree|pg_proc|pg_type|placing|plans|point|polygon|position|preceding|precision|prepare|prepared|preserve|primary|prior|privileges|procedural|procedure|program|quote|range|read|real|reassign|recheck|record|recursive|ref|refcursor|references|refresh|regclass|regconfig|regdictionary|regoper|regoperator|regproc|regprocedure|regtype|reindex|relative|release|reltime|rename|repeatable|replace|replica|reset|restart|restrict|returning|returns|revoke|right|role|rollback|row|rows|rule|savepoint|schema|scroll|search|second|security|select|sequence|sequences|serializable|server|session|session_user|set|setof|share|show|similar|simple|smallint|smgr|snapshot|some|stable|standalone|start|statement|statistics|stdin|stdout|storage|strict|strip|substring|symmetric|sysid|system|table|tables|tablespace|temp|template|temporary|text|then|tid|time|timestamp|timestamptz|timetz|tinterval|to|trailing|transaction|treat|trigger|trim|true|truncate|trusted|tsquery|tsrange|tstzrange|tsvector|txid_snapshot|type|types|unbounded|uncommitted|unencrypted|union|unique|unknown|unlisten|unlogged|until|update|user|using|uuid|vacuum|valid|validate|validator|value|values|varbit|varchar|variadic|varying|verbose|version|view|void|volatile|when|where|whitespace|window|with|without|work|wrapper|write|xid|xml|xmlattributes|xmlconcat|xmlelement|xmlexists|xmlforest|xmlparse|xmlpi|xmlroot|xmlserialize|year|yes|zone\",t=\"RI_FKey_cascade_del|RI_FKey_cascade_upd|RI_FKey_check_ins|RI_FKey_check_upd|RI_FKey_noaction_del|RI_FKey_noaction_upd|RI_FKey_restrict_del|RI_FKey_restrict_upd|RI_FKey_setdefault_del|RI_FKey_setdefault_upd|RI_FKey_setnull_del|RI_FKey_setnull_upd|abbrev|abs|abstime|abstimeeq|abstimege|abstimegt|abstimein|abstimele|abstimelt|abstimene|abstimeout|abstimerecv|abstimesend|aclcontains|acldefault|aclexplode|aclinsert|aclitemeq|aclitemin|aclitemout|aclremove|acos|age|any_in|any_out|anyarray_in|anyarray_out|anyarray_recv|anyarray_send|anyelement_in|anyelement_out|anyenum_in|anyenum_out|anynonarray_in|anynonarray_out|anyrange_in|anyrange_out|anytextcat|area|areajoinsel|areasel|array_agg|array_agg_finalfn|array_agg_transfn|array_append|array_cat|array_dims|array_eq|array_fill|array_ge|array_gt|array_in|array_larger|array_le|array_length|array_lower|array_lt|array_ndims|array_ne|array_out|array_prepend|array_recv|array_remove|array_replace|array_send|array_smaller|array_to_json|array_to_string|array_typanalyze|array_upper|arraycontained|arraycontains|arraycontjoinsel|arraycontsel|arrayoverlap|ascii|ascii_to_mic|ascii_to_utf8|asin|atan|atan2|avg|big5_to_euc_tw|big5_to_mic|big5_to_utf8|bit_and|bit_in|bit_length|bit_or|bit_out|bit_recv|bit_send|bitand|bitcat|bitcmp|biteq|bitge|bitgt|bitle|bitlt|bitne|bitnot|bitor|bitshiftleft|bitshiftright|bittypmodin|bittypmodout|bitxor|bool|bool_and|bool_or|booland_statefunc|booleq|boolge|boolgt|boolin|boolle|boollt|boolne|boolor_statefunc|boolout|boolrecv|boolsend|box|box_above|box_above_eq|box_add|box_below|box_below_eq|box_center|box_contain|box_contain_pt|box_contained|box_distance|box_div|box_eq|box_ge|box_gt|box_in|box_intersect|box_le|box_left|box_lt|box_mul|box_out|box_overabove|box_overbelow|box_overlap|box_overleft|box_overright|box_recv|box_right|box_same|box_send|box_sub|bpchar_larger|bpchar_pattern_ge|bpchar_pattern_gt|bpchar_pattern_le|bpchar_pattern_lt|bpchar_smaller|bpcharcmp|bpchareq|bpcharge|bpchargt|bpchariclike|bpcharicnlike|bpcharicregexeq|bpcharicregexne|bpcharin|bpcharle|bpcharlike|bpcharlt|bpcharne|bpcharnlike|bpcharout|bpcharrecv|bpcharregexeq|bpcharregexne|bpcharsend|bpchartypmodin|bpchartypmodout|broadcast|btabstimecmp|btarraycmp|btbeginscan|btboolcmp|btbpchar_pattern_cmp|btbuild|btbuildempty|btbulkdelete|btcanreturn|btcharcmp|btcostestimate|btendscan|btfloat48cmp|btfloat4cmp|btfloat4sortsupport|btfloat84cmp|btfloat8cmp|btfloat8sortsupport|btgetbitmap|btgettuple|btinsert|btint24cmp|btint28cmp|btint2cmp|btint2sortsupport|btint42cmp|btint48cmp|btint4cmp|btint4sortsupport|btint82cmp|btint84cmp|btint8cmp|btint8sortsupport|btmarkpos|btnamecmp|btnamesortsupport|btoidcmp|btoidsortsupport|btoidvectorcmp|btoptions|btrecordcmp|btreltimecmp|btrescan|btrestrpos|btrim|bttext_pattern_cmp|bttextcmp|bttidcmp|bttintervalcmp|btvacuumcleanup|bytea_string_agg_finalfn|bytea_string_agg_transfn|byteacat|byteacmp|byteaeq|byteage|byteagt|byteain|byteale|bytealike|bytealt|byteane|byteanlike|byteaout|bytearecv|byteasend|cash_cmp|cash_div_cash|cash_div_flt4|cash_div_flt8|cash_div_int2|cash_div_int4|cash_eq|cash_ge|cash_gt|cash_in|cash_le|cash_lt|cash_mi|cash_mul_flt4|cash_mul_flt8|cash_mul_int2|cash_mul_int4|cash_ne|cash_out|cash_pl|cash_recv|cash_send|cash_words|cashlarger|cashsmaller|cbrt|ceil|ceiling|center|char|char_length|character_length|chareq|charge|chargt|charin|charle|charlt|charne|charout|charrecv|charsend|chr|cideq|cidin|cidout|cidr|cidr_in|cidr_out|cidr_recv|cidr_send|cidrecv|cidsend|circle|circle_above|circle_add_pt|circle_below|circle_center|circle_contain|circle_contain_pt|circle_contained|circle_distance|circle_div_pt|circle_eq|circle_ge|circle_gt|circle_in|circle_le|circle_left|circle_lt|circle_mul_pt|circle_ne|circle_out|circle_overabove|circle_overbelow|circle_overlap|circle_overleft|circle_overright|circle_recv|circle_right|circle_same|circle_send|circle_sub_pt|clock_timestamp|close_lb|close_ls|close_lseg|close_pb|close_pl|close_ps|close_sb|close_sl|col_description|concat|concat_ws|contjoinsel|contsel|convert|convert_from|convert_to|corr|cos|cot|count|covar_pop|covar_samp|cstring_in|cstring_out|cstring_recv|cstring_send|cume_dist|current_database|current_query|current_schema|current_schemas|current_setting|current_user|currtid|currtid2|currval|cursor_to_xml|cursor_to_xmlschema|database_to_xml|database_to_xml_and_xmlschema|database_to_xmlschema|date|date_cmp|date_cmp_timestamp|date_cmp_timestamptz|date_eq|date_eq_timestamp|date_eq_timestamptz|date_ge|date_ge_timestamp|date_ge_timestamptz|date_gt|date_gt_timestamp|date_gt_timestamptz|date_in|date_larger|date_le|date_le_timestamp|date_le_timestamptz|date_lt|date_lt_timestamp|date_lt_timestamptz|date_mi|date_mi_interval|date_mii|date_ne|date_ne_timestamp|date_ne_timestamptz|date_out|date_part|date_pl_interval|date_pli|date_recv|date_send|date_smaller|date_sortsupport|date_trunc|daterange|daterange_canonical|daterange_subdiff|datetime_pl|datetimetz_pl|dcbrt|decode|degrees|dense_rank|dexp|diagonal|diameter|dispell_init|dispell_lexize|dist_cpoly|dist_lb|dist_pb|dist_pc|dist_pl|dist_ppath|dist_ps|dist_sb|dist_sl|div|dlog1|dlog10|domain_in|domain_recv|dpow|dround|dsimple_init|dsimple_lexize|dsnowball_init|dsnowball_lexize|dsqrt|dsynonym_init|dsynonym_lexize|dtrunc|elem_contained_by_range|encode|enum_cmp|enum_eq|enum_first|enum_ge|enum_gt|enum_in|enum_larger|enum_last|enum_le|enum_lt|enum_ne|enum_out|enum_range|enum_recv|enum_send|enum_smaller|eqjoinsel|eqsel|euc_cn_to_mic|euc_cn_to_utf8|euc_jis_2004_to_shift_jis_2004|euc_jis_2004_to_utf8|euc_jp_to_mic|euc_jp_to_sjis|euc_jp_to_utf8|euc_kr_to_mic|euc_kr_to_utf8|euc_tw_to_big5|euc_tw_to_mic|euc_tw_to_utf8|event_trigger_in|event_trigger_out|every|exp|factorial|family|fdw_handler_in|fdw_handler_out|first_value|float4|float48div|float48eq|float48ge|float48gt|float48le|float48lt|float48mi|float48mul|float48ne|float48pl|float4_accum|float4abs|float4div|float4eq|float4ge|float4gt|float4in|float4larger|float4le|float4lt|float4mi|float4mul|float4ne|float4out|float4pl|float4recv|float4send|float4smaller|float4um|float4up|float8|float84div|float84eq|float84ge|float84gt|float84le|float84lt|float84mi|float84mul|float84ne|float84pl|float8_accum|float8_avg|float8_corr|float8_covar_pop|float8_covar_samp|float8_regr_accum|float8_regr_avgx|float8_regr_avgy|float8_regr_intercept|float8_regr_r2|float8_regr_slope|float8_regr_sxx|float8_regr_sxy|float8_regr_syy|float8_stddev_pop|float8_stddev_samp|float8_var_pop|float8_var_samp|float8abs|float8div|float8eq|float8ge|float8gt|float8in|float8larger|float8le|float8lt|float8mi|float8mul|float8ne|float8out|float8pl|float8recv|float8send|float8smaller|float8um|float8up|floor|flt4_mul_cash|flt8_mul_cash|fmgr_c_validator|fmgr_internal_validator|fmgr_sql_validator|format|format_type|gb18030_to_utf8|gbk_to_utf8|generate_series|generate_subscripts|get_bit|get_byte|get_current_ts_config|getdatabaseencoding|getpgusername|gin_cmp_prefix|gin_cmp_tslexeme|gin_extract_tsquery|gin_extract_tsvector|gin_tsquery_consistent|ginarrayconsistent|ginarrayextract|ginbeginscan|ginbuild|ginbuildempty|ginbulkdelete|gincostestimate|ginendscan|gingetbitmap|gininsert|ginmarkpos|ginoptions|ginqueryarrayextract|ginrescan|ginrestrpos|ginvacuumcleanup|gist_box_compress|gist_box_consistent|gist_box_decompress|gist_box_penalty|gist_box_picksplit|gist_box_same|gist_box_union|gist_circle_compress|gist_circle_consistent|gist_point_compress|gist_point_consistent|gist_point_distance|gist_poly_compress|gist_poly_consistent|gistbeginscan|gistbuild|gistbuildempty|gistbulkdelete|gistcostestimate|gistendscan|gistgetbitmap|gistgettuple|gistinsert|gistmarkpos|gistoptions|gistrescan|gistrestrpos|gistvacuumcleanup|gtsquery_compress|gtsquery_consistent|gtsquery_decompress|gtsquery_penalty|gtsquery_picksplit|gtsquery_same|gtsquery_union|gtsvector_compress|gtsvector_consistent|gtsvector_decompress|gtsvector_penalty|gtsvector_picksplit|gtsvector_same|gtsvector_union|gtsvectorin|gtsvectorout|has_any_column_privilege|has_column_privilege|has_database_privilege|has_foreign_data_wrapper_privilege|has_function_privilege|has_language_privilege|has_schema_privilege|has_sequence_privilege|has_server_privilege|has_table_privilege|has_tablespace_privilege|has_type_privilege|hash_aclitem|hash_array|hash_numeric|hash_range|hashbeginscan|hashbpchar|hashbuild|hashbuildempty|hashbulkdelete|hashchar|hashcostestimate|hashendscan|hashenum|hashfloat4|hashfloat8|hashgetbitmap|hashgettuple|hashinet|hashinsert|hashint2|hashint2vector|hashint4|hashint8|hashmacaddr|hashmarkpos|hashname|hashoid|hashoidvector|hashoptions|hashrescan|hashrestrpos|hashtext|hashvacuumcleanup|hashvarlena|height|host|hostmask|iclikejoinsel|iclikesel|icnlikejoinsel|icnlikesel|icregexeqjoinsel|icregexeqsel|icregexnejoinsel|icregexnesel|inet_client_addr|inet_client_port|inet_in|inet_out|inet_recv|inet_send|inet_server_addr|inet_server_port|inetand|inetmi|inetmi_int8|inetnot|inetor|inetpl|initcap|int2|int24div|int24eq|int24ge|int24gt|int24le|int24lt|int24mi|int24mul|int24ne|int24pl|int28div|int28eq|int28ge|int28gt|int28le|int28lt|int28mi|int28mul|int28ne|int28pl|int2_accum|int2_avg_accum|int2_mul_cash|int2_sum|int2abs|int2and|int2div|int2eq|int2ge|int2gt|int2in|int2larger|int2le|int2lt|int2mi|int2mod|int2mul|int2ne|int2not|int2or|int2out|int2pl|int2recv|int2send|int2shl|int2shr|int2smaller|int2um|int2up|int2vectoreq|int2vectorin|int2vectorout|int2vectorrecv|int2vectorsend|int2xor|int4|int42div|int42eq|int42ge|int42gt|int42le|int42lt|int42mi|int42mul|int42ne|int42pl|int48div|int48eq|int48ge|int48gt|int48le|int48lt|int48mi|int48mul|int48ne|int48pl|int4_accum|int4_avg_accum|int4_mul_cash|int4_sum|int4abs|int4and|int4div|int4eq|int4ge|int4gt|int4in|int4inc|int4larger|int4le|int4lt|int4mi|int4mod|int4mul|int4ne|int4not|int4or|int4out|int4pl|int4range|int4range_canonical|int4range_subdiff|int4recv|int4send|int4shl|int4shr|int4smaller|int4um|int4up|int4xor|int8|int82div|int82eq|int82ge|int82gt|int82le|int82lt|int82mi|int82mul|int82ne|int82pl|int84div|int84eq|int84ge|int84gt|int84le|int84lt|int84mi|int84mul|int84ne|int84pl|int8_accum|int8_avg|int8_avg_accum|int8_sum|int8abs|int8and|int8div|int8eq|int8ge|int8gt|int8in|int8inc|int8inc_any|int8inc_float8_float8|int8larger|int8le|int8lt|int8mi|int8mod|int8mul|int8ne|int8not|int8or|int8out|int8pl|int8pl_inet|int8range|int8range_canonical|int8range_subdiff|int8recv|int8send|int8shl|int8shr|int8smaller|int8um|int8up|int8xor|integer_pl_date|inter_lb|inter_sb|inter_sl|internal_in|internal_out|interval_accum|interval_avg|interval_cmp|interval_div|interval_eq|interval_ge|interval_gt|interval_hash|interval_in|interval_larger|interval_le|interval_lt|interval_mi|interval_mul|interval_ne|interval_out|interval_pl|interval_pl_date|interval_pl_time|interval_pl_timestamp|interval_pl_timestamptz|interval_pl_timetz|interval_recv|interval_send|interval_smaller|interval_transform|interval_um|intervaltypmodin|intervaltypmodout|intinterval|isclosed|isempty|isfinite|ishorizontal|iso8859_1_to_utf8|iso8859_to_utf8|iso_to_koi8r|iso_to_mic|iso_to_win1251|iso_to_win866|isopen|isparallel|isperp|isvertical|johab_to_utf8|json_agg|json_agg_finalfn|json_agg_transfn|json_array_element|json_array_element_text|json_array_elements|json_array_length|json_each|json_each_text|json_extract_path|json_extract_path_op|json_extract_path_text|json_extract_path_text_op|json_in|json_object_field|json_object_field_text|json_object_keys|json_out|json_populate_record|json_populate_recordset|json_recv|json_send|justify_days|justify_hours|justify_interval|koi8r_to_iso|koi8r_to_mic|koi8r_to_utf8|koi8r_to_win1251|koi8r_to_win866|koi8u_to_utf8|lag|language_handler_in|language_handler_out|last_value|lastval|latin1_to_mic|latin2_to_mic|latin2_to_win1250|latin3_to_mic|latin4_to_mic|lead|left|length|like|like_escape|likejoinsel|likesel|line|line_distance|line_eq|line_horizontal|line_in|line_interpt|line_intersect|line_out|line_parallel|line_perp|line_recv|line_send|line_vertical|ln|lo_close|lo_creat|lo_create|lo_export|lo_import|lo_lseek|lo_lseek64|lo_open|lo_tell|lo_tell64|lo_truncate|lo_truncate64|lo_unlink|log|loread|lower|lower_inc|lower_inf|lowrite|lpad|lseg|lseg_center|lseg_distance|lseg_eq|lseg_ge|lseg_gt|lseg_horizontal|lseg_in|lseg_interpt|lseg_intersect|lseg_le|lseg_length|lseg_lt|lseg_ne|lseg_out|lseg_parallel|lseg_perp|lseg_recv|lseg_send|lseg_vertical|ltrim|macaddr_and|macaddr_cmp|macaddr_eq|macaddr_ge|macaddr_gt|macaddr_in|macaddr_le|macaddr_lt|macaddr_ne|macaddr_not|macaddr_or|macaddr_out|macaddr_recv|macaddr_send|makeaclitem|masklen|max|md5|mic_to_ascii|mic_to_big5|mic_to_euc_cn|mic_to_euc_jp|mic_to_euc_kr|mic_to_euc_tw|mic_to_iso|mic_to_koi8r|mic_to_latin1|mic_to_latin2|mic_to_latin3|mic_to_latin4|mic_to_sjis|mic_to_win1250|mic_to_win1251|mic_to_win866|min|mktinterval|mod|money|mul_d_interval|name|nameeq|namege|namegt|nameiclike|nameicnlike|nameicregexeq|nameicregexne|namein|namele|namelike|namelt|namene|namenlike|nameout|namerecv|nameregexeq|nameregexne|namesend|neqjoinsel|neqsel|netmask|network|network_cmp|network_eq|network_ge|network_gt|network_le|network_lt|network_ne|network_sub|network_subeq|network_sup|network_supeq|nextval|nlikejoinsel|nlikesel|notlike|now|npoints|nth_value|ntile|numeric_abs|numeric_accum|numeric_add|numeric_avg|numeric_avg_accum|numeric_cmp|numeric_div|numeric_div_trunc|numeric_eq|numeric_exp|numeric_fac|numeric_ge|numeric_gt|numeric_in|numeric_inc|numeric_larger|numeric_le|numeric_ln|numeric_log|numeric_lt|numeric_mod|numeric_mul|numeric_ne|numeric_out|numeric_power|numeric_recv|numeric_send|numeric_smaller|numeric_sqrt|numeric_stddev_pop|numeric_stddev_samp|numeric_sub|numeric_transform|numeric_uminus|numeric_uplus|numeric_var_pop|numeric_var_samp|numerictypmodin|numerictypmodout|numnode|numrange|numrange_subdiff|obj_description|octet_length|oid|oideq|oidge|oidgt|oidin|oidlarger|oidle|oidlt|oidne|oidout|oidrecv|oidsend|oidsmaller|oidvectoreq|oidvectorge|oidvectorgt|oidvectorin|oidvectorle|oidvectorlt|oidvectorne|oidvectorout|oidvectorrecv|oidvectorsend|oidvectortypes|on_pb|on_pl|on_ppath|on_ps|on_sb|on_sl|opaque_in|opaque_out|overlaps|overlay|path|path_add|path_add_pt|path_center|path_contain_pt|path_distance|path_div_pt|path_in|path_inter|path_length|path_mul_pt|path_n_eq|path_n_ge|path_n_gt|path_n_le|path_n_lt|path_npoints|path_out|path_recv|path_send|path_sub_pt|pclose|percent_rank|pg_advisory_lock|pg_advisory_lock_shared|pg_advisory_unlock|pg_advisory_unlock_all|pg_advisory_unlock_shared|pg_advisory_xact_lock|pg_advisory_xact_lock_shared|pg_available_extension_versions|pg_available_extensions|pg_backend_pid|pg_backup_start_time|pg_cancel_backend|pg_char_to_encoding|pg_client_encoding|pg_collation_for|pg_collation_is_visible|pg_column_is_updatable|pg_column_size|pg_conf_load_time|pg_conversion_is_visible|pg_create_restore_point|pg_current_xlog_insert_location|pg_current_xlog_location|pg_cursor|pg_database_size|pg_describe_object|pg_encoding_max_length|pg_encoding_to_char|pg_event_trigger_dropped_objects|pg_export_snapshot|pg_extension_config_dump|pg_extension_update_paths|pg_function_is_visible|pg_get_constraintdef|pg_get_expr|pg_get_function_arguments|pg_get_function_identity_arguments|pg_get_function_result|pg_get_functiondef|pg_get_indexdef|pg_get_keywords|pg_get_multixact_members|pg_get_ruledef|pg_get_serial_sequence|pg_get_triggerdef|pg_get_userbyid|pg_get_viewdef|pg_has_role|pg_identify_object|pg_indexes_size|pg_is_in_backup|pg_is_in_recovery|pg_is_other_temp_schema|pg_is_xlog_replay_paused|pg_last_xact_replay_timestamp|pg_last_xlog_receive_location|pg_last_xlog_replay_location|pg_listening_channels|pg_lock_status|pg_ls_dir|pg_my_temp_schema|pg_node_tree_in|pg_node_tree_out|pg_node_tree_recv|pg_node_tree_send|pg_notify|pg_opclass_is_visible|pg_operator_is_visible|pg_opfamily_is_visible|pg_options_to_table|pg_postmaster_start_time|pg_prepared_statement|pg_prepared_xact|pg_read_binary_file|pg_read_file|pg_relation_filenode|pg_relation_filepath|pg_relation_is_updatable|pg_relation_size|pg_reload_conf|pg_rotate_logfile|pg_sequence_parameters|pg_show_all_settings|pg_size_pretty|pg_sleep|pg_start_backup|pg_stat_clear_snapshot|pg_stat_file|pg_stat_get_activity|pg_stat_get_analyze_count|pg_stat_get_autoanalyze_count|pg_stat_get_autovacuum_count|pg_stat_get_backend_activity|pg_stat_get_backend_activity_start|pg_stat_get_backend_client_addr|pg_stat_get_backend_client_port|pg_stat_get_backend_dbid|pg_stat_get_backend_idset|pg_stat_get_backend_pid|pg_stat_get_backend_start|pg_stat_get_backend_userid|pg_stat_get_backend_waiting|pg_stat_get_backend_xact_start|pg_stat_get_bgwriter_buf_written_checkpoints|pg_stat_get_bgwriter_buf_written_clean|pg_stat_get_bgwriter_maxwritten_clean|pg_stat_get_bgwriter_requested_checkpoints|pg_stat_get_bgwriter_stat_reset_time|pg_stat_get_bgwriter_timed_checkpoints|pg_stat_get_blocks_fetched|pg_stat_get_blocks_hit|pg_stat_get_buf_alloc|pg_stat_get_buf_fsync_backend|pg_stat_get_buf_written_backend|pg_stat_get_checkpoint_sync_time|pg_stat_get_checkpoint_write_time|pg_stat_get_db_blk_read_time|pg_stat_get_db_blk_write_time|pg_stat_get_db_blocks_fetched|pg_stat_get_db_blocks_hit|pg_stat_get_db_conflict_all|pg_stat_get_db_conflict_bufferpin|pg_stat_get_db_conflict_lock|pg_stat_get_db_conflict_snapshot|pg_stat_get_db_conflict_startup_deadlock|pg_stat_get_db_conflict_tablespace|pg_stat_get_db_deadlocks|pg_stat_get_db_numbackends|pg_stat_get_db_stat_reset_time|pg_stat_get_db_temp_bytes|pg_stat_get_db_temp_files|pg_stat_get_db_tuples_deleted|pg_stat_get_db_tuples_fetched|pg_stat_get_db_tuples_inserted|pg_stat_get_db_tuples_returned|pg_stat_get_db_tuples_updated|pg_stat_get_db_xact_commit|pg_stat_get_db_xact_rollback|pg_stat_get_dead_tuples|pg_stat_get_function_calls|pg_stat_get_function_self_time|pg_stat_get_function_total_time|pg_stat_get_last_analyze_time|pg_stat_get_last_autoanalyze_time|pg_stat_get_last_autovacuum_time|pg_stat_get_last_vacuum_time|pg_stat_get_live_tuples|pg_stat_get_numscans|pg_stat_get_tuples_deleted|pg_stat_get_tuples_fetched|pg_stat_get_tuples_hot_updated|pg_stat_get_tuples_inserted|pg_stat_get_tuples_returned|pg_stat_get_tuples_updated|pg_stat_get_vacuum_count|pg_stat_get_wal_senders|pg_stat_get_xact_blocks_fetched|pg_stat_get_xact_blocks_hit|pg_stat_get_xact_function_calls|pg_stat_get_xact_function_self_time|pg_stat_get_xact_function_total_time|pg_stat_get_xact_numscans|pg_stat_get_xact_tuples_deleted|pg_stat_get_xact_tuples_fetched|pg_stat_get_xact_tuples_hot_updated|pg_stat_get_xact_tuples_inserted|pg_stat_get_xact_tuples_returned|pg_stat_get_xact_tuples_updated|pg_stat_reset|pg_stat_reset_shared|pg_stat_reset_single_function_counters|pg_stat_reset_single_table_counters|pg_stop_backup|pg_switch_xlog|pg_table_is_visible|pg_table_size|pg_tablespace_databases|pg_tablespace_location|pg_tablespace_size|pg_terminate_backend|pg_timezone_abbrevs|pg_timezone_names|pg_total_relation_size|pg_trigger_depth|pg_try_advisory_lock|pg_try_advisory_lock_shared|pg_try_advisory_xact_lock|pg_try_advisory_xact_lock_shared|pg_ts_config_is_visible|pg_ts_dict_is_visible|pg_ts_parser_is_visible|pg_ts_template_is_visible|pg_type_is_visible|pg_typeof|pg_xlog_location_diff|pg_xlog_replay_pause|pg_xlog_replay_resume|pg_xlogfile_name|pg_xlogfile_name_offset|pi|plainto_tsquery|plpgsql_call_handler|plpgsql_inline_handler|plpgsql_validator|point|point_above|point_add|point_below|point_distance|point_div|point_eq|point_horiz|point_in|point_left|point_mul|point_ne|point_out|point_recv|point_right|point_send|point_sub|point_vert|poly_above|poly_below|poly_center|poly_contain|poly_contain_pt|poly_contained|poly_distance|poly_in|poly_left|poly_npoints|poly_out|poly_overabove|poly_overbelow|poly_overlap|poly_overleft|poly_overright|poly_recv|poly_right|poly_same|poly_send|polygon|popen|position|positionjoinsel|positionsel|postgresql_fdw_validator|pow|power|prsd_end|prsd_headline|prsd_lextype|prsd_nexttoken|prsd_start|pt_contained_circle|pt_contained_poly|query_to_xml|query_to_xml_and_xmlschema|query_to_xmlschema|querytree|quote_ident|quote_literal|quote_nullable|radians|radius|random|range_adjacent|range_after|range_before|range_cmp|range_contained_by|range_contains|range_contains_elem|range_eq|range_ge|range_gist_compress|range_gist_consistent|range_gist_decompress|range_gist_penalty|range_gist_picksplit|range_gist_same|range_gist_union|range_gt|range_in|range_intersect|range_le|range_lt|range_minus|range_ne|range_out|range_overlaps|range_overleft|range_overright|range_recv|range_send|range_typanalyze|range_union|rangesel|rank|record_eq|record_ge|record_gt|record_in|record_le|record_lt|record_ne|record_out|record_recv|record_send|regclass|regclassin|regclassout|regclassrecv|regclasssend|regconfigin|regconfigout|regconfigrecv|regconfigsend|regdictionaryin|regdictionaryout|regdictionaryrecv|regdictionarysend|regexeqjoinsel|regexeqsel|regexnejoinsel|regexnesel|regexp_matches|regexp_replace|regexp_split_to_array|regexp_split_to_table|regoperatorin|regoperatorout|regoperatorrecv|regoperatorsend|regoperin|regoperout|regoperrecv|regopersend|regprocedurein|regprocedureout|regprocedurerecv|regproceduresend|regprocin|regprocout|regprocrecv|regprocsend|regr_avgx|regr_avgy|regr_count|regr_intercept|regr_r2|regr_slope|regr_sxx|regr_sxy|regr_syy|regtypein|regtypeout|regtyperecv|regtypesend|reltime|reltimeeq|reltimege|reltimegt|reltimein|reltimele|reltimelt|reltimene|reltimeout|reltimerecv|reltimesend|repeat|replace|reverse|right|round|row_number|row_to_json|rpad|rtrim|scalargtjoinsel|scalargtsel|scalarltjoinsel|scalarltsel|schema_to_xml|schema_to_xml_and_xmlschema|schema_to_xmlschema|session_user|set_bit|set_byte|set_config|set_masklen|setseed|setval|setweight|shell_in|shell_out|shift_jis_2004_to_euc_jis_2004|shift_jis_2004_to_utf8|shobj_description|sign|similar_escape|sin|sjis_to_euc_jp|sjis_to_mic|sjis_to_utf8|slope|smgreq|smgrin|smgrne|smgrout|spg_kd_choose|spg_kd_config|spg_kd_inner_consistent|spg_kd_picksplit|spg_quad_choose|spg_quad_config|spg_quad_inner_consistent|spg_quad_leaf_consistent|spg_quad_picksplit|spg_range_quad_choose|spg_range_quad_config|spg_range_quad_inner_consistent|spg_range_quad_leaf_consistent|spg_range_quad_picksplit|spg_text_choose|spg_text_config|spg_text_inner_consistent|spg_text_leaf_consistent|spg_text_picksplit|spgbeginscan|spgbuild|spgbuildempty|spgbulkdelete|spgcanreturn|spgcostestimate|spgendscan|spggetbitmap|spggettuple|spginsert|spgmarkpos|spgoptions|spgrescan|spgrestrpos|spgvacuumcleanup|split_part|sqrt|statement_timestamp|stddev|stddev_pop|stddev_samp|string_agg|string_agg_finalfn|string_agg_transfn|string_to_array|strip|strpos|substr|substring|sum|suppress_redundant_updates_trigger|table_to_xml|table_to_xml_and_xmlschema|table_to_xmlschema|tan|text|text_ge|text_gt|text_larger|text_le|text_lt|text_pattern_ge|text_pattern_gt|text_pattern_le|text_pattern_lt|text_smaller|textanycat|textcat|texteq|texticlike|texticnlike|texticregexeq|texticregexne|textin|textlen|textlike|textne|textnlike|textout|textrecv|textregexeq|textregexne|textsend|thesaurus_init|thesaurus_lexize|tideq|tidge|tidgt|tidin|tidlarger|tidle|tidlt|tidne|tidout|tidrecv|tidsend|tidsmaller|time_cmp|time_eq|time_ge|time_gt|time_hash|time_in|time_larger|time_le|time_lt|time_mi_interval|time_mi_time|time_ne|time_out|time_pl_interval|time_recv|time_send|time_smaller|time_transform|timedate_pl|timemi|timenow|timeofday|timepl|timestamp_cmp|timestamp_cmp_date|timestamp_cmp_timestamptz|timestamp_eq|timestamp_eq_date|timestamp_eq_timestamptz|timestamp_ge|timestamp_ge_date|timestamp_ge_timestamptz|timestamp_gt|timestamp_gt_date|timestamp_gt_timestamptz|timestamp_hash|timestamp_in|timestamp_larger|timestamp_le|timestamp_le_date|timestamp_le_timestamptz|timestamp_lt|timestamp_lt_date|timestamp_lt_timestamptz|timestamp_mi|timestamp_mi_interval|timestamp_ne|timestamp_ne_date|timestamp_ne_timestamptz|timestamp_out|timestamp_pl_interval|timestamp_recv|timestamp_send|timestamp_smaller|timestamp_sortsupport|timestamp_transform|timestamptypmodin|timestamptypmodout|timestamptz_cmp|timestamptz_cmp_date|timestamptz_cmp_timestamp|timestamptz_eq|timestamptz_eq_date|timestamptz_eq_timestamp|timestamptz_ge|timestamptz_ge_date|timestamptz_ge_timestamp|timestamptz_gt|timestamptz_gt_date|timestamptz_gt_timestamp|timestamptz_in|timestamptz_larger|timestamptz_le|timestamptz_le_date|timestamptz_le_timestamp|timestamptz_lt|timestamptz_lt_date|timestamptz_lt_timestamp|timestamptz_mi|timestamptz_mi_interval|timestamptz_ne|timestamptz_ne_date|timestamptz_ne_timestamp|timestamptz_out|timestamptz_pl_interval|timestamptz_recv|timestamptz_send|timestamptz_smaller|timestamptztypmodin|timestamptztypmodout|timetypmodin|timetypmodout|timetz_cmp|timetz_eq|timetz_ge|timetz_gt|timetz_hash|timetz_in|timetz_larger|timetz_le|timetz_lt|timetz_mi_interval|timetz_ne|timetz_out|timetz_pl_interval|timetz_recv|timetz_send|timetz_smaller|timetzdate_pl|timetztypmodin|timetztypmodout|timezone|tinterval|tintervalct|tintervalend|tintervaleq|tintervalge|tintervalgt|tintervalin|tintervalle|tintervalleneq|tintervallenge|tintervallengt|tintervallenle|tintervallenlt|tintervallenne|tintervallt|tintervalne|tintervalout|tintervalov|tintervalrecv|tintervalrel|tintervalsame|tintervalsend|tintervalstart|to_ascii|to_char|to_date|to_hex|to_json|to_number|to_timestamp|to_tsquery|to_tsvector|transaction_timestamp|translate|trigger_in|trigger_out|trunc|ts_debug|ts_headline|ts_lexize|ts_match_qv|ts_match_tq|ts_match_tt|ts_match_vq|ts_parse|ts_rank|ts_rank_cd|ts_rewrite|ts_stat|ts_token_type|ts_typanalyze|tsmatchjoinsel|tsmatchsel|tsq_mcontained|tsq_mcontains|tsquery_and|tsquery_cmp|tsquery_eq|tsquery_ge|tsquery_gt|tsquery_le|tsquery_lt|tsquery_ne|tsquery_not|tsquery_or|tsqueryin|tsqueryout|tsqueryrecv|tsquerysend|tsrange|tsrange_subdiff|tstzrange|tstzrange_subdiff|tsvector_cmp|tsvector_concat|tsvector_eq|tsvector_ge|tsvector_gt|tsvector_le|tsvector_lt|tsvector_ne|tsvector_update_trigger|tsvector_update_trigger_column|tsvectorin|tsvectorout|tsvectorrecv|tsvectorsend|txid_current|txid_current_snapshot|txid_snapshot_in|txid_snapshot_out|txid_snapshot_recv|txid_snapshot_send|txid_snapshot_xip|txid_snapshot_xmax|txid_snapshot_xmin|txid_visible_in_snapshot|uhc_to_utf8|unique_key_recheck|unknownin|unknownout|unknownrecv|unknownsend|unnest|upper|upper_inc|upper_inf|utf8_to_ascii|utf8_to_big5|utf8_to_euc_cn|utf8_to_euc_jis_2004|utf8_to_euc_jp|utf8_to_euc_kr|utf8_to_euc_tw|utf8_to_gb18030|utf8_to_gbk|utf8_to_iso8859|utf8_to_iso8859_1|utf8_to_johab|utf8_to_koi8r|utf8_to_koi8u|utf8_to_shift_jis_2004|utf8_to_sjis|utf8_to_uhc|utf8_to_win|uuid_cmp|uuid_eq|uuid_ge|uuid_gt|uuid_hash|uuid_in|uuid_le|uuid_lt|uuid_ne|uuid_out|uuid_recv|uuid_send|var_pop|var_samp|varbit_in|varbit_out|varbit_recv|varbit_send|varbit_transform|varbitcmp|varbiteq|varbitge|varbitgt|varbitle|varbitlt|varbitne|varbittypmodin|varbittypmodout|varchar_transform|varcharin|varcharout|varcharrecv|varcharsend|varchartypmodin|varchartypmodout|variance|version|void_in|void_out|void_recv|void_send|width|width_bucket|win1250_to_latin2|win1250_to_mic|win1251_to_iso|win1251_to_koi8r|win1251_to_mic|win1251_to_win866|win866_to_iso|win866_to_koi8r|win866_to_mic|win866_to_win1251|win_to_utf8|xideq|xideqint4|xidin|xidout|xidrecv|xidsend|xml|xml_in|xml_is_well_formed|xml_is_well_formed_content|xml_is_well_formed_document|xml_out|xml_recv|xml_send|xmlagg|xmlcomment|xmlconcat2|xmlexists|xmlvalidate|xpath|xpath_exists\",n=this.createKeywordMapper({\"support.function\":t,keyword:e},\"identifier\",!0),r=[{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"variable.language\",regex:'\".*?\"'},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:n,regex:\"[a-zA-Z_][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|!!|!~|!~\\\\*|!~~|!~~\\\\*|#|##|#<|#<=|#<>|#=|#>|#>=|%|\\\\&|\\\\&\\\\&|\\\\&<|\\\\&<\\\\||\\\\&>|\\\\*|\\\\+|\\\\-|/|<|<#>|<\\\\->|<<|<<=|<<\\\\||<=|<>|<\\\\?>|<@|<\\\\^|=|>|>=|>>|>>=|>\\\\^|\\\\?#|\\\\?\\\\-|\\\\?\\\\-\\\\||\\\\?\\\\||\\\\?\\\\|\\\\||@|@\\\\-@|@>|@@|@@@|\\\\^|\\\\||\\\\|\\\\&>|\\\\|/|\\\\|>>|\\\\|\\\\||\\\\|\\\\|/|~|~\\\\*|~<=~|~<~|~=|~>=~|~>~|~~|~~\\\\*\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}];this.$rules={start:[{token:\"comment\",regex:\"--.*$\"},s.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"keyword.statementBegin\",regex:\"^[a-zA-Z]+\",next:\"statement\"},{token:\"support.buildin\",regex:\"^\\\\\\\\[\\\\S]+.*$\"}],statement:[{token:\"comment\",regex:\"--.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"commentStatement\"},{token:\"statementEnd\",regex:\";\",next:\"start\"},{token:\"string\",regex:\"\\\\$perl\\\\$\",next:\"perl-start\"},{token:\"string\",regex:\"\\\\$python\\\\$\",next:\"python-start\"},{token:\"string\",regex:\"\\\\$json\\\\$\",next:\"json-start\"},{token:\"string\",regex:\"\\\\$(js|javascript)\\\\$\",next:\"javascript-start\"},{token:\"string\",regex:\"\\\\$[\\\\w_0-9]*\\\\$$\",next:\"dollarSql\"},{token:\"string\",regex:\"\\\\$[\\\\w_0-9]*\\\\$\",next:\"dollarStatementString\"}].concat(r),dollarSql:[{token:\"comment\",regex:\"--.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"commentDollarSql\"},{token:\"string\",regex:\"^\\\\$[\\\\w_0-9]*\\\\$\",next:\"statement\"},{token:\"string\",regex:\"\\\\$[\\\\w_0-9]*\\\\$\",next:\"dollarSqlString\"}].concat(r),comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],commentStatement:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"statement\"},{token:\"comment\",regex:\".+\"}],commentDollarSql:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"dollarSql\"},{token:\"comment\",regex:\".+\"}],dollarStatementString:[{token:\"string\",regex:\".*?\\\\$[\\\\w_0-9]*\\\\$\",next:\"statement\"},{token:\"string\",regex:\".+\"}],dollarSqlString:[{token:\"string\",regex:\".*?\\\\$[\\\\w_0-9]*\\\\$\",next:\"dollarSql\"},{token:\"string\",regex:\".+\"}]},this.embedRules(s,\"doc-\",[s.getEndRule(\"start\")]),this.embedRules(u,\"perl-\",[{token:\"string\",regex:\"\\\\$perl\\\\$\",next:\"statement\"}]),this.embedRules(a,\"python-\",[{token:\"string\",regex:\"\\\\$python\\\\$\",next:\"statement\"}]),this.embedRules(f,\"json-\",[{token:\"string\",regex:\"\\\\$json\\\\$\",next:\"statement\"}]),this.embedRules(l,\"javascript-\",[{token:\"string\",regex:\"\\\\$(js|javascript)\\\\$\",next:\"statement\"}])};r.inherits(c,o),t.PgsqlHighlightRules=c}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/perl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"base|constant|continue|else|elsif|for|foreach|format|goto|if|last|local|my|next|no|package|parent|redo|require|scalar|sub|unless|until|while|use|vars\",t=\"ARGV|ENV|INC|SIG\",n=\"getprotobynumber|getprotobyname|getservbyname|gethostbyaddr|gethostbyname|getservbyport|getnetbyaddr|getnetbyname|getsockname|getpeername|setpriority|getprotoent|setprotoent|getpriority|endprotoent|getservent|setservent|endservent|sethostent|socketpair|getsockopt|gethostent|endhostent|setsockopt|setnetent|quotemeta|localtime|prototype|getnetent|endnetent|rewinddir|wantarray|getpwuid|closedir|getlogin|readlink|endgrent|getgrgid|getgrnam|shmwrite|shutdown|readline|endpwent|setgrent|readpipe|formline|truncate|dbmclose|syswrite|setpwent|getpwnam|getgrent|getpwent|ucfirst|sysread|setpgrp|shmread|sysseek|sysopen|telldir|defined|opendir|connect|lcfirst|getppid|binmode|syscall|sprintf|getpgrp|readdir|seekdir|waitpid|reverse|unshift|symlink|dbmopen|semget|msgrcv|rename|listen|chroot|msgsnd|shmctl|accept|unpack|exists|fileno|shmget|system|unlink|printf|gmtime|msgctl|semctl|values|rindex|substr|splice|length|msgget|select|socket|return|caller|delete|alarm|ioctl|index|undef|lstat|times|srand|chown|fcntl|close|write|umask|rmdir|study|sleep|chomp|untie|print|utime|mkdir|atan2|split|crypt|flock|chmod|BEGIN|bless|chdir|semop|shift|reset|link|stat|chop|grep|fork|dump|join|open|tell|pipe|exit|glob|warn|each|bind|sort|pack|eval|push|keys|getc|kill|seek|sqrt|send|wait|rand|tied|read|time|exec|recv|eof|chr|int|ord|exp|pos|pop|sin|log|abs|oct|hex|tie|cos|vec|END|ref|map|die|uc|lc|do\",r=this.createKeywordMapper({keyword:e,\"constant.language\":t,\"support.function\":n},\"identifier\");this.$rules={start:[{token:\"comment.doc\",regex:\"^=(?:begin|item)\\\\b\",next:\"block_comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0x[0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"%#|\\\\$#|\\\\.\\\\.\\\\.|\\\\|\\\\|=|>>=|<<=|<=>|&&=|=>|!~|\\\\^=|&=|\\\\|=|\\\\.=|x=|%=|\\\\/=|\\\\*=|\\\\-=|\\\\+=|=~|\\\\*\\\\*|\\\\-\\\\-|\\\\.\\\\.|\\\\|\\\\||&&|\\\\+\\\\+|\\\\->|!=|==|>=|<=|>>|<<|,|=|\\\\?\\\\:|\\\\^|\\\\||x|%|\\\\/|\\\\*|<|&|\\\\\\\\|~|!|>|\\\\.|\\\\-|\\\\+|\\\\-C|\\\\-b|\\\\-S|\\\\-u|\\\\-t|\\\\-p|\\\\-l|\\\\-d|\\\\-f|\\\\-g|\\\\-s|\\\\-z|\\\\-k|\\\\-e|\\\\-O|\\\\-T|\\\\-B|\\\\-M|\\\\-A|\\\\-X|\\\\-W|\\\\-c|\\\\-R|\\\\-o|\\\\-x|\\\\-w|\\\\-r|\\\\b(?:and|cmp|eq|ge|gt|le|lt|ne|not|or|xor)\"},{token:\"comment\",regex:\"#.*$\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],block_comment:[{token:\"comment.doc\",regex:\"^=cut\\\\b\",next:\"start\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),t.PerlHighlightRules=s}),define(\"ace/mode/python_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield\",t=\"True|False|None|NotImplemented|Ellipsis|__debug__\",n=\"abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern\",r=this.createKeywordMapper({\"invalid.deprecated\":\"debugger\",\"support.function\":n,\"constant.language\":t,keyword:e},\"identifier\"),i=\"(?:r|u|ur|R|U|UR|Ur|uR)?\",s=\"(?:(?:[1-9]\\\\d*)|(?:0))\",o=\"(?:0[oO]?[0-7]+)\",u=\"(?:0[xX][\\\\dA-Fa-f]+)\",a=\"(?:0[bB][01]+)\",f=\"(?:\"+s+\"|\"+o+\"|\"+u+\"|\"+a+\")\",l=\"(?:[eE][+-]?\\\\d+)\",c=\"(?:\\\\.\\\\d+)\",h=\"(?:\\\\d+)\",p=\"(?:(?:\"+h+\"?\"+c+\")|(?:\"+h+\"\\\\.))\",d=\"(?:(?:\"+p+\"|\"+h+\")\"+l+\")\",v=\"(?:\"+d+\"|\"+p+\")\",m=\"\\\\\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\\\\\abfnrtv'\\\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})\";this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"string\",regex:i+'\"{3}',next:\"qqstring3\"},{token:\"string\",regex:i+'\"(?=.)',next:\"qqstring\"},{token:\"string\",regex:i+\"'{3}\",next:\"qstring3\"},{token:\"string\",regex:i+\"'(?=.)\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"(?:\"+v+\"|\\\\d+)[jJ]\\\\b\"},{token:\"constant.numeric\",regex:v},{token:\"constant.numeric\",regex:f+\"[lL]\\\\b\"},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|%|<<|>>|&|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring3:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:'\"{3}',next:\"start\"},{defaultToken:\"string\"}],qstring3:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"'{3}\",next:\"start\"},{defaultToken:\"string\"}],qqstring:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"start\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"start\"},{defaultToken:\"string\"}]}};r.inherits(s,i),t.PythonHighlightRules=s}),define(\"ace/mode/json_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"variable\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]\\\\s*(?=:)'},{token:\"string\",regex:'\"',next:\"string\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:\"invalid.illegal\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"invalid.illegal\",regex:\"\\\\/\\\\/.*$\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],string:[{token:\"constant.language.escape\",regex:/\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[\"\\\\\\/bfnrt])/},{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:'\"',next:\"start\"},{token:\"string\",regex:\"\",next:\"start\"}]}};r.inherits(s,i),t.JsonHighlightRules=s}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-php.js",
    "content": "define(\"ace/mode/php\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/php_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\",\"ace/unicode\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./php_highlight_rules\").PhpHighlightRules,o=e(\"./php_highlight_rules\").PhpLangHighlightRules,u=e(\"./matching_brace_outdent\").MatchingBraceOutdent,a=e(\"../range\").Range,f=e(\"../worker/worker_client\").WorkerClient,l=e(\"./behaviour/cstyle\").CstyleBehaviour,c=e(\"./folding/cstyle\").FoldMode,h=e(\"../unicode\"),p=function(e){this.inlinePhp=e&&e.inline;var t=this.inlinePhp?o:s;this.HighlightRules=t,this.$outdent=new u,this.$behaviour=new l,this.foldingRules=new c};r.inherits(p,i),function(){this.tokenRe=new RegExp(\"^[\"+h.packages.L+h.packages.Mn+h.packages.Mc+h.packages.Nd+h.packages.Pc+\"_]+\",\"g\"),this.nonTokenRe=new RegExp(\"^(?:[^\"+h.packages.L+h.packages.Mn+h.packages.Mc+h.packages.Nd+h.packages.Pc+\"_]|s])+\",\"g\"),this.lineCommentStart=[\"//\",\"#\"],this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"php-start\"){var u=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);u&&(r+=n)}else if(e==\"php-doc-start\"){if(o!=\"php-doc-start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new f([\"ace\"],\"ace/mode/php_worker\",\"PhpWorker\");return t.attachToDocument(e.getDocument()),this.inlinePhp&&t.call(\"setOptions\",[{inline:!0}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"ok\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/php\"}.call(p.prototype),t.Mode=p}),define(\"ace/mode/php_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=e(\"./html_highlight_rules\").HtmlHighlightRules,a=function(){var e=s,t=i.arrayToMap(\"abs|acos|acosh|addcslashes|addslashes|aggregate|aggregate_info|aggregate_methods|aggregate_methods_by_list|aggregate_methods_by_regexp|aggregate_properties|aggregate_properties_by_list|aggregate_properties_by_regexp|aggregation_info|amqpconnection|amqpexchange|amqpqueue|apache_child_terminate|apache_get_modules|apache_get_version|apache_getenv|apache_lookup_uri|apache_note|apache_request_headers|apache_reset_timeout|apache_response_headers|apache_setenv|apc_add|apc_bin_dump|apc_bin_dumpfile|apc_bin_load|apc_bin_loadfile|apc_cache_info|apc_cas|apc_clear_cache|apc_compile_file|apc_dec|apc_define_constants|apc_delete|apc_delete_file|apc_exists|apc_fetch|apc_inc|apc_load_constants|apc_sma_info|apc_store|apciterator|apd_breakpoint|apd_callstack|apd_clunk|apd_continue|apd_croak|apd_dump_function_table|apd_dump_persistent_resources|apd_dump_regular_resources|apd_echo|apd_get_active_symbols|apd_set_pprof_trace|apd_set_session|apd_set_session_trace|apd_set_session_trace_socket|appenditerator|array|array_change_key_case|array_chunk|array_combine|array_count_values|array_diff|array_diff_assoc|array_diff_key|array_diff_uassoc|array_diff_ukey|array_fill|array_fill_keys|array_filter|array_flip|array_intersect|array_intersect_assoc|array_intersect_key|array_intersect_uassoc|array_intersect_ukey|array_key_exists|array_keys|array_map|array_merge|array_merge_recursive|array_multisort|array_pad|array_pop|array_product|array_push|array_rand|array_reduce|array_replace|array_replace_recursive|array_reverse|array_search|array_shift|array_slice|array_splice|array_sum|array_udiff|array_udiff_assoc|array_udiff_uassoc|array_uintersect|array_uintersect_assoc|array_uintersect_uassoc|array_unique|array_unshift|array_values|array_walk|array_walk_recursive|arrayaccess|arrayiterator|arrayobject|arsort|asin|asinh|asort|assert|assert_options|atan|atan2|atanh|audioproperties|badfunctioncallexception|badmethodcallexception|base64_decode|base64_encode|base_convert|basename|bbcode_add_element|bbcode_add_smiley|bbcode_create|bbcode_destroy|bbcode_parse|bbcode_set_arg_parser|bbcode_set_flags|bcadd|bccomp|bcdiv|bcmod|bcmul|bcompiler_load|bcompiler_load_exe|bcompiler_parse_class|bcompiler_read|bcompiler_write_class|bcompiler_write_constant|bcompiler_write_exe_footer|bcompiler_write_file|bcompiler_write_footer|bcompiler_write_function|bcompiler_write_functions_from_file|bcompiler_write_header|bcompiler_write_included_filename|bcpow|bcpowmod|bcscale|bcsqrt|bcsub|bin2hex|bind_textdomain_codeset|bindec|bindtextdomain|bson_decode|bson_encode|bumpValue|bzclose|bzcompress|bzdecompress|bzerrno|bzerror|bzerrstr|bzflush|bzopen|bzread|bzwrite|cachingiterator|cairo|cairo_create|cairo_font_face_get_type|cairo_font_face_status|cairo_font_options_create|cairo_font_options_equal|cairo_font_options_get_antialias|cairo_font_options_get_hint_metrics|cairo_font_options_get_hint_style|cairo_font_options_get_subpixel_order|cairo_font_options_hash|cairo_font_options_merge|cairo_font_options_set_antialias|cairo_font_options_set_hint_metrics|cairo_font_options_set_hint_style|cairo_font_options_set_subpixel_order|cairo_font_options_status|cairo_format_stride_for_width|cairo_image_surface_create|cairo_image_surface_create_for_data|cairo_image_surface_create_from_png|cairo_image_surface_get_data|cairo_image_surface_get_format|cairo_image_surface_get_height|cairo_image_surface_get_stride|cairo_image_surface_get_width|cairo_matrix_create_scale|cairo_matrix_create_translate|cairo_matrix_invert|cairo_matrix_multiply|cairo_matrix_rotate|cairo_matrix_transform_distance|cairo_matrix_transform_point|cairo_matrix_translate|cairo_pattern_add_color_stop_rgb|cairo_pattern_add_color_stop_rgba|cairo_pattern_create_for_surface|cairo_pattern_create_linear|cairo_pattern_create_radial|cairo_pattern_create_rgb|cairo_pattern_create_rgba|cairo_pattern_get_color_stop_count|cairo_pattern_get_color_stop_rgba|cairo_pattern_get_extend|cairo_pattern_get_filter|cairo_pattern_get_linear_points|cairo_pattern_get_matrix|cairo_pattern_get_radial_circles|cairo_pattern_get_rgba|cairo_pattern_get_surface|cairo_pattern_get_type|cairo_pattern_set_extend|cairo_pattern_set_filter|cairo_pattern_set_matrix|cairo_pattern_status|cairo_pdf_surface_create|cairo_pdf_surface_set_size|cairo_ps_get_levels|cairo_ps_level_to_string|cairo_ps_surface_create|cairo_ps_surface_dsc_begin_page_setup|cairo_ps_surface_dsc_begin_setup|cairo_ps_surface_dsc_comment|cairo_ps_surface_get_eps|cairo_ps_surface_restrict_to_level|cairo_ps_surface_set_eps|cairo_ps_surface_set_size|cairo_scaled_font_create|cairo_scaled_font_extents|cairo_scaled_font_get_ctm|cairo_scaled_font_get_font_face|cairo_scaled_font_get_font_matrix|cairo_scaled_font_get_font_options|cairo_scaled_font_get_scale_matrix|cairo_scaled_font_get_type|cairo_scaled_font_glyph_extents|cairo_scaled_font_status|cairo_scaled_font_text_extents|cairo_surface_copy_page|cairo_surface_create_similar|cairo_surface_finish|cairo_surface_flush|cairo_surface_get_content|cairo_surface_get_device_offset|cairo_surface_get_font_options|cairo_surface_get_type|cairo_surface_mark_dirty|cairo_surface_mark_dirty_rectangle|cairo_surface_set_device_offset|cairo_surface_set_fallback_resolution|cairo_surface_show_page|cairo_surface_status|cairo_surface_write_to_png|cairo_svg_surface_create|cairo_svg_surface_restrict_to_version|cairo_svg_version_to_string|cairoantialias|cairocontent|cairocontext|cairoexception|cairoextend|cairofillrule|cairofilter|cairofontface|cairofontoptions|cairofontslant|cairofonttype|cairofontweight|cairoformat|cairogradientpattern|cairohintmetrics|cairohintstyle|cairoimagesurface|cairolineargradient|cairolinecap|cairolinejoin|cairomatrix|cairooperator|cairopath|cairopattern|cairopatterntype|cairopdfsurface|cairopslevel|cairopssurface|cairoradialgradient|cairoscaledfont|cairosolidpattern|cairostatus|cairosubpixelorder|cairosurface|cairosurfacepattern|cairosurfacetype|cairosvgsurface|cairosvgversion|cairotoyfontface|cal_days_in_month|cal_from_jd|cal_info|cal_to_jd|calcul_hmac|calculhmac|call_user_func|call_user_func_array|call_user_method|call_user_method_array|callbackfilteriterator|ceil|chdb|chdb_create|chdir|checkdate|checkdnsrr|chgrp|chmod|chop|chown|chr|chroot|chunk_split|class_alias|class_exists|class_implements|class_parents|classkit_import|classkit_method_add|classkit_method_copy|classkit_method_redefine|classkit_method_remove|classkit_method_rename|clearstatcache|clone|closedir|closelog|collator|com|com_addref|com_create_guid|com_event_sink|com_get|com_get_active_object|com_invoke|com_isenum|com_load|com_load_typelib|com_message_pump|com_print_typeinfo|com_propget|com_propput|com_propset|com_release|com_set|compact|connection_aborted|connection_status|connection_timeout|constant|construct|construct|construct|convert_cyr_string|convert_uudecode|convert_uuencode|copy|cos|cosh|count|count_chars|countable|counter_bump|counter_bump_value|counter_create|counter_get|counter_get_meta|counter_get_named|counter_get_value|counter_reset|counter_reset_value|crack_check|crack_closedict|crack_getlastmessage|crack_opendict|crc32|create_function|crypt|ctype_alnum|ctype_alpha|ctype_cntrl|ctype_digit|ctype_graph|ctype_lower|ctype_print|ctype_punct|ctype_space|ctype_upper|ctype_xdigit|cubrid_affected_rows|cubrid_bind|cubrid_client_encoding|cubrid_close|cubrid_close_prepare|cubrid_close_request|cubrid_col_get|cubrid_col_size|cubrid_column_names|cubrid_column_types|cubrid_commit|cubrid_connect|cubrid_connect_with_url|cubrid_current_oid|cubrid_data_seek|cubrid_db_name|cubrid_disconnect|cubrid_drop|cubrid_errno|cubrid_error|cubrid_error_code|cubrid_error_code_facility|cubrid_error_msg|cubrid_execute|cubrid_fetch|cubrid_fetch_array|cubrid_fetch_assoc|cubrid_fetch_field|cubrid_fetch_lengths|cubrid_fetch_object|cubrid_fetch_row|cubrid_field_flags|cubrid_field_len|cubrid_field_name|cubrid_field_seek|cubrid_field_table|cubrid_field_type|cubrid_free_result|cubrid_get|cubrid_get_autocommit|cubrid_get_charset|cubrid_get_class_name|cubrid_get_client_info|cubrid_get_db_parameter|cubrid_get_server_info|cubrid_insert_id|cubrid_is_instance|cubrid_list_dbs|cubrid_load_from_glo|cubrid_lob_close|cubrid_lob_export|cubrid_lob_get|cubrid_lob_send|cubrid_lob_size|cubrid_lock_read|cubrid_lock_write|cubrid_move_cursor|cubrid_new_glo|cubrid_next_result|cubrid_num_cols|cubrid_num_fields|cubrid_num_rows|cubrid_ping|cubrid_prepare|cubrid_put|cubrid_query|cubrid_real_escape_string|cubrid_result|cubrid_rollback|cubrid_save_to_glo|cubrid_schema|cubrid_send_glo|cubrid_seq_drop|cubrid_seq_insert|cubrid_seq_put|cubrid_set_add|cubrid_set_autocommit|cubrid_set_db_parameter|cubrid_set_drop|cubrid_unbuffered_query|cubrid_version|curl_close|curl_copy_handle|curl_errno|curl_error|curl_exec|curl_getinfo|curl_init|curl_multi_add_handle|curl_multi_close|curl_multi_exec|curl_multi_getcontent|curl_multi_info_read|curl_multi_init|curl_multi_remove_handle|curl_multi_select|curl_setopt|curl_setopt_array|curl_version|current|cyrus_authenticate|cyrus_bind|cyrus_close|cyrus_connect|cyrus_query|cyrus_unbind|date|date_add|date_create|date_create_from_format|date_date_set|date_default_timezone_get|date_default_timezone_set|date_diff|date_format|date_get_last_errors|date_interval_create_from_date_string|date_interval_format|date_isodate_set|date_modify|date_offset_get|date_parse|date_parse_from_format|date_sub|date_sun_info|date_sunrise|date_sunset|date_time_set|date_timestamp_get|date_timestamp_set|date_timezone_get|date_timezone_set|dateinterval|dateperiod|datetime|datetimezone|db2_autocommit|db2_bind_param|db2_client_info|db2_close|db2_column_privileges|db2_columns|db2_commit|db2_conn_error|db2_conn_errormsg|db2_connect|db2_cursor_type|db2_escape_string|db2_exec|db2_execute|db2_fetch_array|db2_fetch_assoc|db2_fetch_both|db2_fetch_object|db2_fetch_row|db2_field_display_size|db2_field_name|db2_field_num|db2_field_precision|db2_field_scale|db2_field_type|db2_field_width|db2_foreign_keys|db2_free_result|db2_free_stmt|db2_get_option|db2_last_insert_id|db2_lob_read|db2_next_result|db2_num_fields|db2_num_rows|db2_pclose|db2_pconnect|db2_prepare|db2_primary_keys|db2_procedure_columns|db2_procedures|db2_result|db2_rollback|db2_server_info|db2_set_option|db2_special_columns|db2_statistics|db2_stmt_error|db2_stmt_errormsg|db2_table_privileges|db2_tables|dba_close|dba_delete|dba_exists|dba_fetch|dba_firstkey|dba_handlers|dba_insert|dba_key_split|dba_list|dba_nextkey|dba_open|dba_optimize|dba_popen|dba_replace|dba_sync|dbase_add_record|dbase_close|dbase_create|dbase_delete_record|dbase_get_header_info|dbase_get_record|dbase_get_record_with_names|dbase_numfields|dbase_numrecords|dbase_open|dbase_pack|dbase_replace_record|dbplus_add|dbplus_aql|dbplus_chdir|dbplus_close|dbplus_curr|dbplus_errcode|dbplus_errno|dbplus_find|dbplus_first|dbplus_flush|dbplus_freealllocks|dbplus_freelock|dbplus_freerlocks|dbplus_getlock|dbplus_getunique|dbplus_info|dbplus_last|dbplus_lockrel|dbplus_next|dbplus_open|dbplus_prev|dbplus_rchperm|dbplus_rcreate|dbplus_rcrtexact|dbplus_rcrtlike|dbplus_resolve|dbplus_restorepos|dbplus_rkeys|dbplus_ropen|dbplus_rquery|dbplus_rrename|dbplus_rsecindex|dbplus_runlink|dbplus_rzap|dbplus_savepos|dbplus_setindex|dbplus_setindexbynumber|dbplus_sql|dbplus_tcl|dbplus_tremove|dbplus_undo|dbplus_undoprepare|dbplus_unlockrel|dbplus_unselect|dbplus_update|dbplus_xlockrel|dbplus_xunlockrel|dbx_close|dbx_compare|dbx_connect|dbx_error|dbx_escape_string|dbx_fetch_row|dbx_query|dbx_sort|dcgettext|dcngettext|deaggregate|debug_backtrace|debug_print_backtrace|debug_zval_dump|decbin|dechex|decoct|define|define_syslog_variables|defined|deg2rad|delete|dgettext|die|dio_close|dio_fcntl|dio_open|dio_read|dio_seek|dio_stat|dio_tcsetattr|dio_truncate|dio_write|dir|directoryiterator|dirname|disk_free_space|disk_total_space|diskfreespace|dl|dngettext|dns_check_record|dns_get_mx|dns_get_record|dom_import_simplexml|domainexception|domattr|domattribute_name|domattribute_set_value|domattribute_specified|domattribute_value|domcharacterdata|domcomment|domdocument|domdocument_add_root|domdocument_create_attribute|domdocument_create_cdata_section|domdocument_create_comment|domdocument_create_element|domdocument_create_element_ns|domdocument_create_entity_reference|domdocument_create_processing_instruction|domdocument_create_text_node|domdocument_doctype|domdocument_document_element|domdocument_dump_file|domdocument_dump_mem|domdocument_get_element_by_id|domdocument_get_elements_by_tagname|domdocument_html_dump_mem|domdocument_xinclude|domdocumentfragment|domdocumenttype|domdocumenttype_entities|domdocumenttype_internal_subset|domdocumenttype_name|domdocumenttype_notations|domdocumenttype_public_id|domdocumenttype_system_id|domelement|domelement_get_attribute|domelement_get_attribute_node|domelement_get_elements_by_tagname|domelement_has_attribute|domelement_remove_attribute|domelement_set_attribute|domelement_set_attribute_node|domelement_tagname|domentity|domentityreference|domexception|domimplementation|domnamednodemap|domnode|domnode_add_namespace|domnode_append_child|domnode_append_sibling|domnode_attributes|domnode_child_nodes|domnode_clone_node|domnode_dump_node|domnode_first_child|domnode_get_content|domnode_has_attributes|domnode_has_child_nodes|domnode_insert_before|domnode_is_blank_node|domnode_last_child|domnode_next_sibling|domnode_node_name|domnode_node_type|domnode_node_value|domnode_owner_document|domnode_parent_node|domnode_prefix|domnode_previous_sibling|domnode_remove_child|domnode_replace_child|domnode_replace_node|domnode_set_content|domnode_set_name|domnode_set_namespace|domnode_unlink_node|domnodelist|domnotation|domprocessinginstruction|domprocessinginstruction_data|domprocessinginstruction_target|domtext|domxml_new_doc|domxml_open_file|domxml_open_mem|domxml_version|domxml_xmltree|domxml_xslt_stylesheet|domxml_xslt_stylesheet_doc|domxml_xslt_stylesheet_file|domxml_xslt_version|domxpath|domxsltstylesheet_process|domxsltstylesheet_result_dump_file|domxsltstylesheet_result_dump_mem|dotnet|dotnet_load|doubleval|each|easter_date|easter_days|echo|empty|emptyiterator|enchant_broker_describe|enchant_broker_dict_exists|enchant_broker_free|enchant_broker_free_dict|enchant_broker_get_error|enchant_broker_init|enchant_broker_list_dicts|enchant_broker_request_dict|enchant_broker_request_pwl_dict|enchant_broker_set_ordering|enchant_dict_add_to_personal|enchant_dict_add_to_session|enchant_dict_check|enchant_dict_describe|enchant_dict_get_error|enchant_dict_is_in_session|enchant_dict_quick_check|enchant_dict_store_replacement|enchant_dict_suggest|end|ereg|ereg_replace|eregi|eregi_replace|error_get_last|error_log|error_reporting|errorexception|escapeshellarg|escapeshellcmd|eval|event_add|event_base_free|event_base_loop|event_base_loopbreak|event_base_loopexit|event_base_new|event_base_priority_init|event_base_set|event_buffer_base_set|event_buffer_disable|event_buffer_enable|event_buffer_fd_set|event_buffer_free|event_buffer_new|event_buffer_priority_set|event_buffer_read|event_buffer_set_callback|event_buffer_timeout_set|event_buffer_watermark_set|event_buffer_write|event_del|event_free|event_new|event_set|exception|exec|exif_imagetype|exif_read_data|exif_tagname|exif_thumbnail|exit|exp|expect_expectl|expect_popen|explode|expm1|export|export|extension_loaded|extract|ezmlm_hash|fam_cancel_monitor|fam_close|fam_monitor_collection|fam_monitor_directory|fam_monitor_file|fam_next_event|fam_open|fam_pending|fam_resume_monitor|fam_suspend_monitor|fbsql_affected_rows|fbsql_autocommit|fbsql_blob_size|fbsql_change_user|fbsql_clob_size|fbsql_close|fbsql_commit|fbsql_connect|fbsql_create_blob|fbsql_create_clob|fbsql_create_db|fbsql_data_seek|fbsql_database|fbsql_database_password|fbsql_db_query|fbsql_db_status|fbsql_drop_db|fbsql_errno|fbsql_error|fbsql_fetch_array|fbsql_fetch_assoc|fbsql_fetch_field|fbsql_fetch_lengths|fbsql_fetch_object|fbsql_fetch_row|fbsql_field_flags|fbsql_field_len|fbsql_field_name|fbsql_field_seek|fbsql_field_table|fbsql_field_type|fbsql_free_result|fbsql_get_autostart_info|fbsql_hostname|fbsql_insert_id|fbsql_list_dbs|fbsql_list_fields|fbsql_list_tables|fbsql_next_result|fbsql_num_fields|fbsql_num_rows|fbsql_password|fbsql_pconnect|fbsql_query|fbsql_read_blob|fbsql_read_clob|fbsql_result|fbsql_rollback|fbsql_rows_fetched|fbsql_select_db|fbsql_set_characterset|fbsql_set_lob_mode|fbsql_set_password|fbsql_set_transaction|fbsql_start_db|fbsql_stop_db|fbsql_table_name|fbsql_tablename|fbsql_username|fbsql_warnings|fclose|fdf_add_doc_javascript|fdf_add_template|fdf_close|fdf_create|fdf_enum_values|fdf_errno|fdf_error|fdf_get_ap|fdf_get_attachment|fdf_get_encoding|fdf_get_file|fdf_get_flags|fdf_get_opt|fdf_get_status|fdf_get_value|fdf_get_version|fdf_header|fdf_next_field_name|fdf_open|fdf_open_string|fdf_remove_item|fdf_save|fdf_save_string|fdf_set_ap|fdf_set_encoding|fdf_set_file|fdf_set_flags|fdf_set_javascript_action|fdf_set_on_import_javascript|fdf_set_opt|fdf_set_status|fdf_set_submit_form_action|fdf_set_target_frame|fdf_set_value|fdf_set_version|feof|fflush|fgetc|fgetcsv|fgets|fgetss|file|file_exists|file_get_contents|file_put_contents|fileatime|filectime|filegroup|fileinode|filemtime|fileowner|fileperms|filepro|filepro_fieldcount|filepro_fieldname|filepro_fieldtype|filepro_fieldwidth|filepro_retrieve|filepro_rowcount|filesize|filesystemiterator|filetype|filter_has_var|filter_id|filter_input|filter_input_array|filter_list|filter_var|filter_var_array|filteriterator|finfo_buffer|finfo_close|finfo_file|finfo_open|finfo_set_flags|floatval|flock|floor|flush|fmod|fnmatch|fopen|forward_static_call|forward_static_call_array|fpassthru|fprintf|fputcsv|fputs|fread|frenchtojd|fribidi_log2vis|fscanf|fseek|fsockopen|fstat|ftell|ftok|ftp_alloc|ftp_cdup|ftp_chdir|ftp_chmod|ftp_close|ftp_connect|ftp_delete|ftp_exec|ftp_fget|ftp_fput|ftp_get|ftp_get_option|ftp_login|ftp_mdtm|ftp_mkdir|ftp_nb_continue|ftp_nb_fget|ftp_nb_fput|ftp_nb_get|ftp_nb_put|ftp_nlist|ftp_pasv|ftp_put|ftp_pwd|ftp_quit|ftp_raw|ftp_rawlist|ftp_rename|ftp_rmdir|ftp_set_option|ftp_site|ftp_size|ftp_ssl_connect|ftp_systype|ftruncate|func_get_arg|func_get_args|func_num_args|function_exists|fwrite|gc_collect_cycles|gc_disable|gc_enable|gc_enabled|gd_info|gearmanclient|gearmanjob|gearmantask|gearmanworker|geoip_continent_code_by_name|geoip_country_code3_by_name|geoip_country_code_by_name|geoip_country_name_by_name|geoip_database_info|geoip_db_avail|geoip_db_filename|geoip_db_get_all_info|geoip_id_by_name|geoip_isp_by_name|geoip_org_by_name|geoip_record_by_name|geoip_region_by_name|geoip_region_name_by_code|geoip_time_zone_by_country_and_region|getMeta|getNamed|getValue|get_browser|get_called_class|get_cfg_var|get_class|get_class_methods|get_class_vars|get_current_user|get_declared_classes|get_declared_interfaces|get_defined_constants|get_defined_functions|get_defined_vars|get_extension_funcs|get_headers|get_html_translation_table|get_include_path|get_included_files|get_loaded_extensions|get_magic_quotes_gpc|get_magic_quotes_runtime|get_meta_tags|get_object_vars|get_parent_class|get_required_files|get_resource_type|getallheaders|getconstant|getconstants|getconstructor|getcwd|getdate|getdefaultproperties|getdoccomment|getendline|getenv|getextension|getextensionname|getfilename|gethostbyaddr|gethostbyname|gethostbynamel|gethostname|getimagesize|getinterfacenames|getinterfaces|getlastmod|getmethod|getmethods|getmodifiers|getmxrr|getmygid|getmyinode|getmypid|getmyuid|getname|getnamespacename|getopt|getparentclass|getproperties|getproperty|getprotobyname|getprotobynumber|getrandmax|getrusage|getservbyname|getservbyport|getshortname|getstartline|getstaticproperties|getstaticpropertyvalue|gettext|gettimeofday|gettype|glob|globiterator|gmagick|gmagickdraw|gmagickpixel|gmdate|gmmktime|gmp_abs|gmp_add|gmp_and|gmp_clrbit|gmp_cmp|gmp_com|gmp_div|gmp_div_q|gmp_div_qr|gmp_div_r|gmp_divexact|gmp_fact|gmp_gcd|gmp_gcdext|gmp_hamdist|gmp_init|gmp_intval|gmp_invert|gmp_jacobi|gmp_legendre|gmp_mod|gmp_mul|gmp_neg|gmp_nextprime|gmp_or|gmp_perfect_square|gmp_popcount|gmp_pow|gmp_powm|gmp_prob_prime|gmp_random|gmp_scan0|gmp_scan1|gmp_setbit|gmp_sign|gmp_sqrt|gmp_sqrtrem|gmp_strval|gmp_sub|gmp_testbit|gmp_xor|gmstrftime|gnupg_adddecryptkey|gnupg_addencryptkey|gnupg_addsignkey|gnupg_cleardecryptkeys|gnupg_clearencryptkeys|gnupg_clearsignkeys|gnupg_decrypt|gnupg_decryptverify|gnupg_encrypt|gnupg_encryptsign|gnupg_export|gnupg_geterror|gnupg_getprotocol|gnupg_import|gnupg_init|gnupg_keyinfo|gnupg_setarmor|gnupg_seterrormode|gnupg_setsignmode|gnupg_sign|gnupg_verify|gopher_parsedir|grapheme_extract|grapheme_stripos|grapheme_stristr|grapheme_strlen|grapheme_strpos|grapheme_strripos|grapheme_strrpos|grapheme_strstr|grapheme_substr|gregoriantojd|gupnp_context_get_host_ip|gupnp_context_get_port|gupnp_context_get_subscription_timeout|gupnp_context_host_path|gupnp_context_new|gupnp_context_set_subscription_timeout|gupnp_context_timeout_add|gupnp_context_unhost_path|gupnp_control_point_browse_start|gupnp_control_point_browse_stop|gupnp_control_point_callback_set|gupnp_control_point_new|gupnp_device_action_callback_set|gupnp_device_info_get|gupnp_device_info_get_service|gupnp_root_device_get_available|gupnp_root_device_get_relative_location|gupnp_root_device_new|gupnp_root_device_set_available|gupnp_root_device_start|gupnp_root_device_stop|gupnp_service_action_get|gupnp_service_action_return|gupnp_service_action_return_error|gupnp_service_action_set|gupnp_service_freeze_notify|gupnp_service_info_get|gupnp_service_info_get_introspection|gupnp_service_introspection_get_state_variable|gupnp_service_notify|gupnp_service_proxy_action_get|gupnp_service_proxy_action_set|gupnp_service_proxy_add_notify|gupnp_service_proxy_callback_set|gupnp_service_proxy_get_subscribed|gupnp_service_proxy_remove_notify|gupnp_service_proxy_set_subscribed|gupnp_service_thaw_notify|gzclose|gzcompress|gzdecode|gzdeflate|gzencode|gzeof|gzfile|gzgetc|gzgets|gzgetss|gzinflate|gzopen|gzpassthru|gzputs|gzread|gzrewind|gzseek|gztell|gzuncompress|gzwrite|halt_compiler|haruannotation|haruannotation_setborderstyle|haruannotation_sethighlightmode|haruannotation_seticon|haruannotation_setopened|harudestination|harudestination_setfit|harudestination_setfitb|harudestination_setfitbh|harudestination_setfitbv|harudestination_setfith|harudestination_setfitr|harudestination_setfitv|harudestination_setxyz|harudoc|harudoc_addpage|harudoc_addpagelabel|harudoc_construct|harudoc_createoutline|harudoc_getcurrentencoder|harudoc_getcurrentpage|harudoc_getencoder|harudoc_getfont|harudoc_getinfoattr|harudoc_getpagelayout|harudoc_getpagemode|harudoc_getstreamsize|harudoc_insertpage|harudoc_loadjpeg|harudoc_loadpng|harudoc_loadraw|harudoc_loadttc|harudoc_loadttf|harudoc_loadtype1|harudoc_output|harudoc_readfromstream|harudoc_reseterror|harudoc_resetstream|harudoc_save|harudoc_savetostream|harudoc_setcompressionmode|harudoc_setcurrentencoder|harudoc_setencryptionmode|harudoc_setinfoattr|harudoc_setinfodateattr|harudoc_setopenaction|harudoc_setpagelayout|harudoc_setpagemode|harudoc_setpagesconfiguration|harudoc_setpassword|harudoc_setpermission|harudoc_usecnsencodings|harudoc_usecnsfonts|harudoc_usecntencodings|harudoc_usecntfonts|harudoc_usejpencodings|harudoc_usejpfonts|harudoc_usekrencodings|harudoc_usekrfonts|haruencoder|haruencoder_getbytetype|haruencoder_gettype|haruencoder_getunicode|haruencoder_getwritingmode|haruexception|harufont|harufont_getascent|harufont_getcapheight|harufont_getdescent|harufont_getencodingname|harufont_getfontname|harufont_gettextwidth|harufont_getunicodewidth|harufont_getxheight|harufont_measuretext|haruimage|haruimage_getbitspercomponent|haruimage_getcolorspace|haruimage_getheight|haruimage_getsize|haruimage_getwidth|haruimage_setcolormask|haruimage_setmaskimage|haruoutline|haruoutline_setdestination|haruoutline_setopened|harupage|harupage_arc|harupage_begintext|harupage_circle|harupage_closepath|harupage_concat|harupage_createdestination|harupage_createlinkannotation|harupage_createtextannotation|harupage_createurlannotation|harupage_curveto|harupage_curveto2|harupage_curveto3|harupage_drawimage|harupage_ellipse|harupage_endpath|harupage_endtext|harupage_eofill|harupage_eofillstroke|harupage_fill|harupage_fillstroke|harupage_getcharspace|harupage_getcmykfill|harupage_getcmykstroke|harupage_getcurrentfont|harupage_getcurrentfontsize|harupage_getcurrentpos|harupage_getcurrenttextpos|harupage_getdash|harupage_getfillingcolorspace|harupage_getflatness|harupage_getgmode|harupage_getgrayfill|harupage_getgraystroke|harupage_getheight|harupage_gethorizontalscaling|harupage_getlinecap|harupage_getlinejoin|harupage_getlinewidth|harupage_getmiterlimit|harupage_getrgbfill|harupage_getrgbstroke|harupage_getstrokingcolorspace|harupage_gettextleading|harupage_gettextmatrix|harupage_gettextrenderingmode|harupage_gettextrise|harupage_gettextwidth|harupage_gettransmatrix|harupage_getwidth|harupage_getwordspace|harupage_lineto|harupage_measuretext|harupage_movetextpos|harupage_moveto|harupage_movetonextline|harupage_rectangle|harupage_setcharspace|harupage_setcmykfill|harupage_setcmykstroke|harupage_setdash|harupage_setflatness|harupage_setfontandsize|harupage_setgrayfill|harupage_setgraystroke|harupage_setheight|harupage_sethorizontalscaling|harupage_setlinecap|harupage_setlinejoin|harupage_setlinewidth|harupage_setmiterlimit|harupage_setrgbfill|harupage_setrgbstroke|harupage_setrotate|harupage_setsize|harupage_setslideshow|harupage_settextleading|harupage_settextmatrix|harupage_settextrenderingmode|harupage_settextrise|harupage_setwidth|harupage_setwordspace|harupage_showtext|harupage_showtextnextline|harupage_stroke|harupage_textout|harupage_textrect|hasconstant|hash|hash_algos|hash_copy|hash_file|hash_final|hash_hmac|hash_hmac_file|hash_init|hash_update|hash_update_file|hash_update_stream|hasmethod|hasproperty|header|header_register_callback|header_remove|headers_list|headers_sent|hebrev|hebrevc|hex2bin|hexdec|highlight_file|highlight_string|html_entity_decode|htmlentities|htmlspecialchars|htmlspecialchars_decode|http_build_cookie|http_build_query|http_build_str|http_build_url|http_cache_etag|http_cache_last_modified|http_chunked_decode|http_date|http_deflate|http_get|http_get_request_body|http_get_request_body_stream|http_get_request_headers|http_head|http_inflate|http_match_etag|http_match_modified|http_match_request_header|http_negotiate_charset|http_negotiate_content_type|http_negotiate_language|http_parse_cookie|http_parse_headers|http_parse_message|http_parse_params|http_persistent_handles_clean|http_persistent_handles_count|http_persistent_handles_ident|http_post_data|http_post_fields|http_put_data|http_put_file|http_put_stream|http_redirect|http_request|http_request_body_encode|http_request_method_exists|http_request_method_name|http_request_method_register|http_request_method_unregister|http_response_code|http_send_content_disposition|http_send_content_type|http_send_data|http_send_file|http_send_last_modified|http_send_status|http_send_stream|http_support|http_throttle|httpdeflatestream|httpdeflatestream_construct|httpdeflatestream_factory|httpdeflatestream_finish|httpdeflatestream_flush|httpdeflatestream_update|httpinflatestream|httpinflatestream_construct|httpinflatestream_factory|httpinflatestream_finish|httpinflatestream_flush|httpinflatestream_update|httpmessage|httpmessage_addheaders|httpmessage_construct|httpmessage_detach|httpmessage_factory|httpmessage_fromenv|httpmessage_fromstring|httpmessage_getbody|httpmessage_getheader|httpmessage_getheaders|httpmessage_gethttpversion|httpmessage_getparentmessage|httpmessage_getrequestmethod|httpmessage_getrequesturl|httpmessage_getresponsecode|httpmessage_getresponsestatus|httpmessage_gettype|httpmessage_guesscontenttype|httpmessage_prepend|httpmessage_reverse|httpmessage_send|httpmessage_setbody|httpmessage_setheaders|httpmessage_sethttpversion|httpmessage_setrequestmethod|httpmessage_setrequesturl|httpmessage_setresponsecode|httpmessage_setresponsestatus|httpmessage_settype|httpmessage_tomessagetypeobject|httpmessage_tostring|httpquerystring|httpquerystring_construct|httpquerystring_get|httpquerystring_mod|httpquerystring_set|httpquerystring_singleton|httpquerystring_toarray|httpquerystring_tostring|httpquerystring_xlate|httprequest|httprequest_addcookies|httprequest_addheaders|httprequest_addpostfields|httprequest_addpostfile|httprequest_addputdata|httprequest_addquerydata|httprequest_addrawpostdata|httprequest_addssloptions|httprequest_clearhistory|httprequest_construct|httprequest_enablecookies|httprequest_getcontenttype|httprequest_getcookies|httprequest_getheaders|httprequest_gethistory|httprequest_getmethod|httprequest_getoptions|httprequest_getpostfields|httprequest_getpostfiles|httprequest_getputdata|httprequest_getputfile|httprequest_getquerydata|httprequest_getrawpostdata|httprequest_getrawrequestmessage|httprequest_getrawresponsemessage|httprequest_getrequestmessage|httprequest_getresponsebody|httprequest_getresponsecode|httprequest_getresponsecookies|httprequest_getresponsedata|httprequest_getresponseheader|httprequest_getresponseinfo|httprequest_getresponsemessage|httprequest_getresponsestatus|httprequest_getssloptions|httprequest_geturl|httprequest_resetcookies|httprequest_send|httprequest_setcontenttype|httprequest_setcookies|httprequest_setheaders|httprequest_setmethod|httprequest_setoptions|httprequest_setpostfields|httprequest_setpostfiles|httprequest_setputdata|httprequest_setputfile|httprequest_setquerydata|httprequest_setrawpostdata|httprequest_setssloptions|httprequest_seturl|httprequestpool|httprequestpool_attach|httprequestpool_construct|httprequestpool_destruct|httprequestpool_detach|httprequestpool_getattachedrequests|httprequestpool_getfinishedrequests|httprequestpool_reset|httprequestpool_send|httprequestpool_socketperform|httprequestpool_socketselect|httpresponse|httpresponse_capture|httpresponse_getbuffersize|httpresponse_getcache|httpresponse_getcachecontrol|httpresponse_getcontentdisposition|httpresponse_getcontenttype|httpresponse_getdata|httpresponse_getetag|httpresponse_getfile|httpresponse_getgzip|httpresponse_getheader|httpresponse_getlastmodified|httpresponse_getrequestbody|httpresponse_getrequestbodystream|httpresponse_getrequestheaders|httpresponse_getstream|httpresponse_getthrottledelay|httpresponse_guesscontenttype|httpresponse_redirect|httpresponse_send|httpresponse_setbuffersize|httpresponse_setcache|httpresponse_setcachecontrol|httpresponse_setcontentdisposition|httpresponse_setcontenttype|httpresponse_setdata|httpresponse_setetag|httpresponse_setfile|httpresponse_setgzip|httpresponse_setheader|httpresponse_setlastmodified|httpresponse_setstream|httpresponse_setthrottledelay|httpresponse_status|hw_array2objrec|hw_changeobject|hw_children|hw_childrenobj|hw_close|hw_connect|hw_connection_info|hw_cp|hw_deleteobject|hw_docbyanchor|hw_docbyanchorobj|hw_document_attributes|hw_document_bodytag|hw_document_content|hw_document_setcontent|hw_document_size|hw_dummy|hw_edittext|hw_error|hw_errormsg|hw_free_document|hw_getanchors|hw_getanchorsobj|hw_getandlock|hw_getchildcoll|hw_getchildcollobj|hw_getchilddoccoll|hw_getchilddoccollobj|hw_getobject|hw_getobjectbyquery|hw_getobjectbyquerycoll|hw_getobjectbyquerycollobj|hw_getobjectbyqueryobj|hw_getparents|hw_getparentsobj|hw_getrellink|hw_getremote|hw_getremotechildren|hw_getsrcbydestobj|hw_gettext|hw_getusername|hw_identify|hw_incollections|hw_info|hw_inscoll|hw_insdoc|hw_insertanchors|hw_insertdocument|hw_insertobject|hw_mapid|hw_modifyobject|hw_mv|hw_new_document|hw_objrec2array|hw_output_document|hw_pconnect|hw_pipedocument|hw_root|hw_setlinkroot|hw_stat|hw_unlock|hw_who|hwapi_attribute|hwapi_attribute_key|hwapi_attribute_langdepvalue|hwapi_attribute_value|hwapi_attribute_values|hwapi_checkin|hwapi_checkout|hwapi_children|hwapi_content|hwapi_content_mimetype|hwapi_content_read|hwapi_copy|hwapi_dbstat|hwapi_dcstat|hwapi_dstanchors|hwapi_dstofsrcanchor|hwapi_error_count|hwapi_error_reason|hwapi_find|hwapi_ftstat|hwapi_hgcsp|hwapi_hwstat|hwapi_identify|hwapi_info|hwapi_insert|hwapi_insertanchor|hwapi_insertcollection|hwapi_insertdocument|hwapi_link|hwapi_lock|hwapi_move|hwapi_new_content|hwapi_object|hwapi_object_assign|hwapi_object_attreditable|hwapi_object_count|hwapi_object_insert|hwapi_object_new|hwapi_object_remove|hwapi_object_title|hwapi_object_value|hwapi_objectbyanchor|hwapi_parents|hwapi_reason_description|hwapi_reason_type|hwapi_remove|hwapi_replace|hwapi_setcommittedversion|hwapi_srcanchors|hwapi_srcsofdst|hwapi_unlock|hwapi_user|hwapi_userlist|hypot|ibase_add_user|ibase_affected_rows|ibase_backup|ibase_blob_add|ibase_blob_cancel|ibase_blob_close|ibase_blob_create|ibase_blob_echo|ibase_blob_get|ibase_blob_import|ibase_blob_info|ibase_blob_open|ibase_close|ibase_commit|ibase_commit_ret|ibase_connect|ibase_db_info|ibase_delete_user|ibase_drop_db|ibase_errcode|ibase_errmsg|ibase_execute|ibase_fetch_assoc|ibase_fetch_object|ibase_fetch_row|ibase_field_info|ibase_free_event_handler|ibase_free_query|ibase_free_result|ibase_gen_id|ibase_maintain_db|ibase_modify_user|ibase_name_result|ibase_num_fields|ibase_num_params|ibase_param_info|ibase_pconnect|ibase_prepare|ibase_query|ibase_restore|ibase_rollback|ibase_rollback_ret|ibase_server_info|ibase_service_attach|ibase_service_detach|ibase_set_event_handler|ibase_timefmt|ibase_trans|ibase_wait_event|iconv|iconv_get_encoding|iconv_mime_decode|iconv_mime_decode_headers|iconv_mime_encode|iconv_set_encoding|iconv_strlen|iconv_strpos|iconv_strrpos|iconv_substr|id3_get_frame_long_name|id3_get_frame_short_name|id3_get_genre_id|id3_get_genre_list|id3_get_genre_name|id3_get_tag|id3_get_version|id3_remove_tag|id3_set_tag|id3v2attachedpictureframe|id3v2frame|id3v2tag|idate|idn_to_ascii|idn_to_unicode|idn_to_utf8|ifx_affected_rows|ifx_blobinfile_mode|ifx_byteasvarchar|ifx_close|ifx_connect|ifx_copy_blob|ifx_create_blob|ifx_create_char|ifx_do|ifx_error|ifx_errormsg|ifx_fetch_row|ifx_fieldproperties|ifx_fieldtypes|ifx_free_blob|ifx_free_char|ifx_free_result|ifx_get_blob|ifx_get_char|ifx_getsqlca|ifx_htmltbl_result|ifx_nullformat|ifx_num_fields|ifx_num_rows|ifx_pconnect|ifx_prepare|ifx_query|ifx_textasvarchar|ifx_update_blob|ifx_update_char|ifxus_close_slob|ifxus_create_slob|ifxus_free_slob|ifxus_open_slob|ifxus_read_slob|ifxus_seek_slob|ifxus_tell_slob|ifxus_write_slob|ignore_user_abort|iis_add_server|iis_get_dir_security|iis_get_script_map|iis_get_server_by_comment|iis_get_server_by_path|iis_get_server_rights|iis_get_service_state|iis_remove_server|iis_set_app_settings|iis_set_dir_security|iis_set_script_map|iis_set_server_rights|iis_start_server|iis_start_service|iis_stop_server|iis_stop_service|image2wbmp|image_type_to_extension|image_type_to_mime_type|imagealphablending|imageantialias|imagearc|imagechar|imagecharup|imagecolorallocate|imagecolorallocatealpha|imagecolorat|imagecolorclosest|imagecolorclosestalpha|imagecolorclosesthwb|imagecolordeallocate|imagecolorexact|imagecolorexactalpha|imagecolormatch|imagecolorresolve|imagecolorresolvealpha|imagecolorset|imagecolorsforindex|imagecolorstotal|imagecolortransparent|imageconvolution|imagecopy|imagecopymerge|imagecopymergegray|imagecopyresampled|imagecopyresized|imagecreate|imagecreatefromgd|imagecreatefromgd2|imagecreatefromgd2part|imagecreatefromgif|imagecreatefromjpeg|imagecreatefrompng|imagecreatefromstring|imagecreatefromwbmp|imagecreatefromxbm|imagecreatefromxpm|imagecreatetruecolor|imagedashedline|imagedestroy|imageellipse|imagefill|imagefilledarc|imagefilledellipse|imagefilledpolygon|imagefilledrectangle|imagefilltoborder|imagefilter|imagefontheight|imagefontwidth|imageftbbox|imagefttext|imagegammacorrect|imagegd|imagegd2|imagegif|imagegrabscreen|imagegrabwindow|imageinterlace|imageistruecolor|imagejpeg|imagelayereffect|imageline|imageloadfont|imagepalettecopy|imagepng|imagepolygon|imagepsbbox|imagepsencodefont|imagepsextendfont|imagepsfreefont|imagepsloadfont|imagepsslantfont|imagepstext|imagerectangle|imagerotate|imagesavealpha|imagesetbrush|imagesetpixel|imagesetstyle|imagesetthickness|imagesettile|imagestring|imagestringup|imagesx|imagesy|imagetruecolortopalette|imagettfbbox|imagettftext|imagetypes|imagewbmp|imagexbm|imagick|imagick_adaptiveblurimage|imagick_adaptiveresizeimage|imagick_adaptivesharpenimage|imagick_adaptivethresholdimage|imagick_addimage|imagick_addnoiseimage|imagick_affinetransformimage|imagick_animateimages|imagick_annotateimage|imagick_appendimages|imagick_averageimages|imagick_blackthresholdimage|imagick_blurimage|imagick_borderimage|imagick_charcoalimage|imagick_chopimage|imagick_clear|imagick_clipimage|imagick_clippathimage|imagick_clone|imagick_clutimage|imagick_coalesceimages|imagick_colorfloodfillimage|imagick_colorizeimage|imagick_combineimages|imagick_commentimage|imagick_compareimagechannels|imagick_compareimagelayers|imagick_compareimages|imagick_compositeimage|imagick_construct|imagick_contrastimage|imagick_contraststretchimage|imagick_convolveimage|imagick_cropimage|imagick_cropthumbnailimage|imagick_current|imagick_cyclecolormapimage|imagick_decipherimage|imagick_deconstructimages|imagick_deleteimageartifact|imagick_despeckleimage|imagick_destroy|imagick_displayimage|imagick_displayimages|imagick_distortimage|imagick_drawimage|imagick_edgeimage|imagick_embossimage|imagick_encipherimage|imagick_enhanceimage|imagick_equalizeimage|imagick_evaluateimage|imagick_extentimage|imagick_flattenimages|imagick_flipimage|imagick_floodfillpaintimage|imagick_flopimage|imagick_frameimage|imagick_fximage|imagick_gammaimage|imagick_gaussianblurimage|imagick_getcolorspace|imagick_getcompression|imagick_getcompressionquality|imagick_getcopyright|imagick_getfilename|imagick_getfont|imagick_getformat|imagick_getgravity|imagick_gethomeurl|imagick_getimage|imagick_getimagealphachannel|imagick_getimageartifact|imagick_getimagebackgroundcolor|imagick_getimageblob|imagick_getimageblueprimary|imagick_getimagebordercolor|imagick_getimagechanneldepth|imagick_getimagechanneldistortion|imagick_getimagechanneldistortions|imagick_getimagechannelextrema|imagick_getimagechannelmean|imagick_getimagechannelrange|imagick_getimagechannelstatistics|imagick_getimageclipmask|imagick_getimagecolormapcolor|imagick_getimagecolors|imagick_getimagecolorspace|imagick_getimagecompose|imagick_getimagecompression|imagick_getimagecompressionquality|imagick_getimagedelay|imagick_getimagedepth|imagick_getimagedispose|imagick_getimagedistortion|imagick_getimageextrema|imagick_getimagefilename|imagick_getimageformat|imagick_getimagegamma|imagick_getimagegeometry|imagick_getimagegravity|imagick_getimagegreenprimary|imagick_getimageheight|imagick_getimagehistogram|imagick_getimageindex|imagick_getimageinterlacescheme|imagick_getimageinterpolatemethod|imagick_getimageiterations|imagick_getimagelength|imagick_getimagemagicklicense|imagick_getimagematte|imagick_getimagemattecolor|imagick_getimageorientation|imagick_getimagepage|imagick_getimagepixelcolor|imagick_getimageprofile|imagick_getimageprofiles|imagick_getimageproperties|imagick_getimageproperty|imagick_getimageredprimary|imagick_getimageregion|imagick_getimagerenderingintent|imagick_getimageresolution|imagick_getimagesblob|imagick_getimagescene|imagick_getimagesignature|imagick_getimagesize|imagick_getimagetickspersecond|imagick_getimagetotalinkdensity|imagick_getimagetype|imagick_getimageunits|imagick_getimagevirtualpixelmethod|imagick_getimagewhitepoint|imagick_getimagewidth|imagick_getinterlacescheme|imagick_getiteratorindex|imagick_getnumberimages|imagick_getoption|imagick_getpackagename|imagick_getpage|imagick_getpixeliterator|imagick_getpixelregioniterator|imagick_getpointsize|imagick_getquantumdepth|imagick_getquantumrange|imagick_getreleasedate|imagick_getresource|imagick_getresourcelimit|imagick_getsamplingfactors|imagick_getsize|imagick_getsizeoffset|imagick_getversion|imagick_hasnextimage|imagick_haspreviousimage|imagick_identifyimage|imagick_implodeimage|imagick_labelimage|imagick_levelimage|imagick_linearstretchimage|imagick_liquidrescaleimage|imagick_magnifyimage|imagick_mapimage|imagick_mattefloodfillimage|imagick_medianfilterimage|imagick_mergeimagelayers|imagick_minifyimage|imagick_modulateimage|imagick_montageimage|imagick_morphimages|imagick_mosaicimages|imagick_motionblurimage|imagick_negateimage|imagick_newimage|imagick_newpseudoimage|imagick_nextimage|imagick_normalizeimage|imagick_oilpaintimage|imagick_opaquepaintimage|imagick_optimizeimagelayers|imagick_orderedposterizeimage|imagick_paintfloodfillimage|imagick_paintopaqueimage|imagick_painttransparentimage|imagick_pingimage|imagick_pingimageblob|imagick_pingimagefile|imagick_polaroidimage|imagick_posterizeimage|imagick_previewimages|imagick_previousimage|imagick_profileimage|imagick_quantizeimage|imagick_quantizeimages|imagick_queryfontmetrics|imagick_queryfonts|imagick_queryformats|imagick_radialblurimage|imagick_raiseimage|imagick_randomthresholdimage|imagick_readimage|imagick_readimageblob|imagick_readimagefile|imagick_recolorimage|imagick_reducenoiseimage|imagick_removeimage|imagick_removeimageprofile|imagick_render|imagick_resampleimage|imagick_resetimagepage|imagick_resizeimage|imagick_rollimage|imagick_rotateimage|imagick_roundcorners|imagick_sampleimage|imagick_scaleimage|imagick_separateimagechannel|imagick_sepiatoneimage|imagick_setbackgroundcolor|imagick_setcolorspace|imagick_setcompression|imagick_setcompressionquality|imagick_setfilename|imagick_setfirstiterator|imagick_setfont|imagick_setformat|imagick_setgravity|imagick_setimage|imagick_setimagealphachannel|imagick_setimageartifact|imagick_setimagebackgroundcolor|imagick_setimagebias|imagick_setimageblueprimary|imagick_setimagebordercolor|imagick_setimagechanneldepth|imagick_setimageclipmask|imagick_setimagecolormapcolor|imagick_setimagecolorspace|imagick_setimagecompose|imagick_setimagecompression|imagick_setimagecompressionquality|imagick_setimagedelay|imagick_setimagedepth|imagick_setimagedispose|imagick_setimageextent|imagick_setimagefilename|imagick_setimageformat|imagick_setimagegamma|imagick_setimagegravity|imagick_setimagegreenprimary|imagick_setimageindex|imagick_setimageinterlacescheme|imagick_setimageinterpolatemethod|imagick_setimageiterations|imagick_setimagematte|imagick_setimagemattecolor|imagick_setimageopacity|imagick_setimageorientation|imagick_setimagepage|imagick_setimageprofile|imagick_setimageproperty|imagick_setimageredprimary|imagick_setimagerenderingintent|imagick_setimageresolution|imagick_setimagescene|imagick_setimagetickspersecond|imagick_setimagetype|imagick_setimageunits|imagick_setimagevirtualpixelmethod|imagick_setimagewhitepoint|imagick_setinterlacescheme|imagick_setiteratorindex|imagick_setlastiterator|imagick_setoption|imagick_setpage|imagick_setpointsize|imagick_setresolution|imagick_setresourcelimit|imagick_setsamplingfactors|imagick_setsize|imagick_setsizeoffset|imagick_settype|imagick_shadeimage|imagick_shadowimage|imagick_sharpenimage|imagick_shaveimage|imagick_shearimage|imagick_sigmoidalcontrastimage|imagick_sketchimage|imagick_solarizeimage|imagick_spliceimage|imagick_spreadimage|imagick_steganoimage|imagick_stereoimage|imagick_stripimage|imagick_swirlimage|imagick_textureimage|imagick_thresholdimage|imagick_thumbnailimage|imagick_tintimage|imagick_transformimage|imagick_transparentpaintimage|imagick_transposeimage|imagick_transverseimage|imagick_trimimage|imagick_uniqueimagecolors|imagick_unsharpmaskimage|imagick_valid|imagick_vignetteimage|imagick_waveimage|imagick_whitethresholdimage|imagick_writeimage|imagick_writeimagefile|imagick_writeimages|imagick_writeimagesfile|imagickdraw|imagickdraw_affine|imagickdraw_annotation|imagickdraw_arc|imagickdraw_bezier|imagickdraw_circle|imagickdraw_clear|imagickdraw_clone|imagickdraw_color|imagickdraw_comment|imagickdraw_composite|imagickdraw_construct|imagickdraw_destroy|imagickdraw_ellipse|imagickdraw_getclippath|imagickdraw_getcliprule|imagickdraw_getclipunits|imagickdraw_getfillcolor|imagickdraw_getfillopacity|imagickdraw_getfillrule|imagickdraw_getfont|imagickdraw_getfontfamily|imagickdraw_getfontsize|imagickdraw_getfontstyle|imagickdraw_getfontweight|imagickdraw_getgravity|imagickdraw_getstrokeantialias|imagickdraw_getstrokecolor|imagickdraw_getstrokedasharray|imagickdraw_getstrokedashoffset|imagickdraw_getstrokelinecap|imagickdraw_getstrokelinejoin|imagickdraw_getstrokemiterlimit|imagickdraw_getstrokeopacity|imagickdraw_getstrokewidth|imagickdraw_gettextalignment|imagickdraw_gettextantialias|imagickdraw_gettextdecoration|imagickdraw_gettextencoding|imagickdraw_gettextundercolor|imagickdraw_getvectorgraphics|imagickdraw_line|imagickdraw_matte|imagickdraw_pathclose|imagickdraw_pathcurvetoabsolute|imagickdraw_pathcurvetoquadraticbezierabsolute|imagickdraw_pathcurvetoquadraticbezierrelative|imagickdraw_pathcurvetoquadraticbeziersmoothabsolute|imagickdraw_pathcurvetoquadraticbeziersmoothrelative|imagickdraw_pathcurvetorelative|imagickdraw_pathcurvetosmoothabsolute|imagickdraw_pathcurvetosmoothrelative|imagickdraw_pathellipticarcabsolute|imagickdraw_pathellipticarcrelative|imagickdraw_pathfinish|imagickdraw_pathlinetoabsolute|imagickdraw_pathlinetohorizontalabsolute|imagickdraw_pathlinetohorizontalrelative|imagickdraw_pathlinetorelative|imagickdraw_pathlinetoverticalabsolute|imagickdraw_pathlinetoverticalrelative|imagickdraw_pathmovetoabsolute|imagickdraw_pathmovetorelative|imagickdraw_pathstart|imagickdraw_point|imagickdraw_polygon|imagickdraw_polyline|imagickdraw_pop|imagickdraw_popclippath|imagickdraw_popdefs|imagickdraw_poppattern|imagickdraw_push|imagickdraw_pushclippath|imagickdraw_pushdefs|imagickdraw_pushpattern|imagickdraw_rectangle|imagickdraw_render|imagickdraw_rotate|imagickdraw_roundrectangle|imagickdraw_scale|imagickdraw_setclippath|imagickdraw_setcliprule|imagickdraw_setclipunits|imagickdraw_setfillalpha|imagickdraw_setfillcolor|imagickdraw_setfillopacity|imagickdraw_setfillpatternurl|imagickdraw_setfillrule|imagickdraw_setfont|imagickdraw_setfontfamily|imagickdraw_setfontsize|imagickdraw_setfontstretch|imagickdraw_setfontstyle|imagickdraw_setfontweight|imagickdraw_setgravity|imagickdraw_setstrokealpha|imagickdraw_setstrokeantialias|imagickdraw_setstrokecolor|imagickdraw_setstrokedasharray|imagickdraw_setstrokedashoffset|imagickdraw_setstrokelinecap|imagickdraw_setstrokelinejoin|imagickdraw_setstrokemiterlimit|imagickdraw_setstrokeopacity|imagickdraw_setstrokepatternurl|imagickdraw_setstrokewidth|imagickdraw_settextalignment|imagickdraw_settextantialias|imagickdraw_settextdecoration|imagickdraw_settextencoding|imagickdraw_settextundercolor|imagickdraw_setvectorgraphics|imagickdraw_setviewbox|imagickdraw_skewx|imagickdraw_skewy|imagickdraw_translate|imagickpixel|imagickpixel_clear|imagickpixel_construct|imagickpixel_destroy|imagickpixel_getcolor|imagickpixel_getcolorasstring|imagickpixel_getcolorcount|imagickpixel_getcolorvalue|imagickpixel_gethsl|imagickpixel_issimilar|imagickpixel_setcolor|imagickpixel_setcolorvalue|imagickpixel_sethsl|imagickpixeliterator|imagickpixeliterator_clear|imagickpixeliterator_construct|imagickpixeliterator_destroy|imagickpixeliterator_getcurrentiteratorrow|imagickpixeliterator_getiteratorrow|imagickpixeliterator_getnextiteratorrow|imagickpixeliterator_getpreviousiteratorrow|imagickpixeliterator_newpixeliterator|imagickpixeliterator_newpixelregioniterator|imagickpixeliterator_resetiterator|imagickpixeliterator_setiteratorfirstrow|imagickpixeliterator_setiteratorlastrow|imagickpixeliterator_setiteratorrow|imagickpixeliterator_synciterator|imap_8bit|imap_alerts|imap_append|imap_base64|imap_binary|imap_body|imap_bodystruct|imap_check|imap_clearflag_full|imap_close|imap_create|imap_createmailbox|imap_delete|imap_deletemailbox|imap_errors|imap_expunge|imap_fetch_overview|imap_fetchbody|imap_fetchheader|imap_fetchmime|imap_fetchstructure|imap_fetchtext|imap_gc|imap_get_quota|imap_get_quotaroot|imap_getacl|imap_getmailboxes|imap_getsubscribed|imap_header|imap_headerinfo|imap_headers|imap_last_error|imap_list|imap_listmailbox|imap_listscan|imap_listsubscribed|imap_lsub|imap_mail|imap_mail_compose|imap_mail_copy|imap_mail_move|imap_mailboxmsginfo|imap_mime_header_decode|imap_msgno|imap_num_msg|imap_num_recent|imap_open|imap_ping|imap_qprint|imap_rename|imap_renamemailbox|imap_reopen|imap_rfc822_parse_adrlist|imap_rfc822_parse_headers|imap_rfc822_write_address|imap_savebody|imap_scan|imap_scanmailbox|imap_search|imap_set_quota|imap_setacl|imap_setflag_full|imap_sort|imap_status|imap_subscribe|imap_thread|imap_timeout|imap_uid|imap_undelete|imap_unsubscribe|imap_utf7_decode|imap_utf7_encode|imap_utf8|implementsinterface|implode|import_request_variables|in_array|include|include_once|inclued_get_data|inet_ntop|inet_pton|infiniteiterator|ingres_autocommit|ingres_autocommit_state|ingres_charset|ingres_close|ingres_commit|ingres_connect|ingres_cursor|ingres_errno|ingres_error|ingres_errsqlstate|ingres_escape_string|ingres_execute|ingres_fetch_array|ingres_fetch_assoc|ingres_fetch_object|ingres_fetch_proc_return|ingres_fetch_row|ingres_field_length|ingres_field_name|ingres_field_nullable|ingres_field_precision|ingres_field_scale|ingres_field_type|ingres_free_result|ingres_next_error|ingres_num_fields|ingres_num_rows|ingres_pconnect|ingres_prepare|ingres_query|ingres_result_seek|ingres_rollback|ingres_set_environment|ingres_unbuffered_query|ini_alter|ini_get|ini_get_all|ini_restore|ini_set|innamespace|inotify_add_watch|inotify_init|inotify_queue_len|inotify_read|inotify_rm_watch|interface_exists|intl_error_name|intl_get_error_code|intl_get_error_message|intl_is_failure|intldateformatter|intval|invalidargumentexception|invoke|invokeargs|ip2long|iptcembed|iptcparse|is_a|is_array|is_bool|is_callable|is_dir|is_double|is_executable|is_file|is_finite|is_float|is_infinite|is_int|is_integer|is_link|is_long|is_nan|is_null|is_numeric|is_object|is_readable|is_real|is_resource|is_scalar|is_soap_fault|is_string|is_subclass_of|is_uploaded_file|is_writable|is_writeable|isabstract|iscloneable|isdisabled|isfinal|isinstance|isinstantiable|isinterface|isinternal|isiterateable|isset|issubclassof|isuserdefined|iterator|iterator_apply|iterator_count|iterator_to_array|iteratoraggregate|iteratoriterator|java_last_exception_clear|java_last_exception_get|jddayofweek|jdmonthname|jdtofrench|jdtogregorian|jdtojewish|jdtojulian|jdtounix|jewishtojd|join|jpeg2wbmp|json_decode|json_encode|json_last_error|jsonserializable|judy|judy_type|judy_version|juliantojd|kadm5_chpass_principal|kadm5_create_principal|kadm5_delete_principal|kadm5_destroy|kadm5_flush|kadm5_get_policies|kadm5_get_principal|kadm5_get_principals|kadm5_init_with_password|kadm5_modify_principal|key|krsort|ksort|lcfirst|lcg_value|lchgrp|lchown|ldap_8859_to_t61|ldap_add|ldap_bind|ldap_close|ldap_compare|ldap_connect|ldap_count_entries|ldap_delete|ldap_dn2ufn|ldap_err2str|ldap_errno|ldap_error|ldap_explode_dn|ldap_first_attribute|ldap_first_entry|ldap_first_reference|ldap_free_result|ldap_get_attributes|ldap_get_dn|ldap_get_entries|ldap_get_option|ldap_get_values|ldap_get_values_len|ldap_list|ldap_mod_add|ldap_mod_del|ldap_mod_replace|ldap_modify|ldap_next_attribute|ldap_next_entry|ldap_next_reference|ldap_parse_reference|ldap_parse_result|ldap_read|ldap_rename|ldap_sasl_bind|ldap_search|ldap_set_option|ldap_set_rebind_proc|ldap_sort|ldap_start_tls|ldap_t61_to_8859|ldap_unbind|lengthexception|levenshtein|libxml_clear_errors|libxml_disable_entity_loader|libxml_get_errors|libxml_get_last_error|libxml_set_streams_context|libxml_use_internal_errors|libxmlerror|limititerator|link|linkinfo|list|locale|localeconv|localtime|log|log10|log1p|logicexception|long2ip|lstat|ltrim|lzf_compress|lzf_decompress|lzf_optimized_for|m_checkstatus|m_completeauthorizations|m_connect|m_connectionerror|m_deletetrans|m_destroyconn|m_destroyengine|m_getcell|m_getcellbynum|m_getcommadelimited|m_getheader|m_initconn|m_initengine|m_iscommadelimited|m_maxconntimeout|m_monitor|m_numcolumns|m_numrows|m_parsecommadelimited|m_responsekeys|m_responseparam|m_returnstatus|m_setblocking|m_setdropfile|m_setip|m_setssl|m_setssl_cafile|m_setssl_files|m_settimeout|m_sslcert_gen_hash|m_transactionssent|m_transinqueue|m_transkeyval|m_transnew|m_transsend|m_uwait|m_validateidentifier|m_verifyconnection|m_verifysslcert|magic_quotes_runtime|mail|mailparse_determine_best_xfer_encoding|mailparse_msg_create|mailparse_msg_extract_part|mailparse_msg_extract_part_file|mailparse_msg_extract_whole_part_file|mailparse_msg_free|mailparse_msg_get_part|mailparse_msg_get_part_data|mailparse_msg_get_structure|mailparse_msg_parse|mailparse_msg_parse_file|mailparse_rfc822_parse_addresses|mailparse_stream_encode|mailparse_uudecode_all|main|max|maxdb_affected_rows|maxdb_autocommit|maxdb_bind_param|maxdb_bind_result|maxdb_change_user|maxdb_character_set_name|maxdb_client_encoding|maxdb_close|maxdb_close_long_data|maxdb_commit|maxdb_connect|maxdb_connect_errno|maxdb_connect_error|maxdb_data_seek|maxdb_debug|maxdb_disable_reads_from_master|maxdb_disable_rpl_parse|maxdb_dump_debug_info|maxdb_embedded_connect|maxdb_enable_reads_from_master|maxdb_enable_rpl_parse|maxdb_errno|maxdb_error|maxdb_escape_string|maxdb_execute|maxdb_fetch|maxdb_fetch_array|maxdb_fetch_assoc|maxdb_fetch_field|maxdb_fetch_field_direct|maxdb_fetch_fields|maxdb_fetch_lengths|maxdb_fetch_object|maxdb_fetch_row|maxdb_field_count|maxdb_field_seek|maxdb_field_tell|maxdb_free_result|maxdb_get_client_info|maxdb_get_client_version|maxdb_get_host_info|maxdb_get_metadata|maxdb_get_proto_info|maxdb_get_server_info|maxdb_get_server_version|maxdb_info|maxdb_init|maxdb_insert_id|maxdb_kill|maxdb_master_query|maxdb_more_results|maxdb_multi_query|maxdb_next_result|maxdb_num_fields|maxdb_num_rows|maxdb_options|maxdb_param_count|maxdb_ping|maxdb_prepare|maxdb_query|maxdb_real_connect|maxdb_real_escape_string|maxdb_real_query|maxdb_report|maxdb_rollback|maxdb_rpl_parse_enabled|maxdb_rpl_probe|maxdb_rpl_query_type|maxdb_select_db|maxdb_send_long_data|maxdb_send_query|maxdb_server_end|maxdb_server_init|maxdb_set_opt|maxdb_sqlstate|maxdb_ssl_set|maxdb_stat|maxdb_stmt_affected_rows|maxdb_stmt_bind_param|maxdb_stmt_bind_result|maxdb_stmt_close|maxdb_stmt_close_long_data|maxdb_stmt_data_seek|maxdb_stmt_errno|maxdb_stmt_error|maxdb_stmt_execute|maxdb_stmt_fetch|maxdb_stmt_free_result|maxdb_stmt_init|maxdb_stmt_num_rows|maxdb_stmt_param_count|maxdb_stmt_prepare|maxdb_stmt_reset|maxdb_stmt_result_metadata|maxdb_stmt_send_long_data|maxdb_stmt_sqlstate|maxdb_stmt_store_result|maxdb_store_result|maxdb_thread_id|maxdb_thread_safe|maxdb_use_result|maxdb_warning_count|mb_check_encoding|mb_convert_case|mb_convert_encoding|mb_convert_kana|mb_convert_variables|mb_decode_mimeheader|mb_decode_numericentity|mb_detect_encoding|mb_detect_order|mb_encode_mimeheader|mb_encode_numericentity|mb_encoding_aliases|mb_ereg|mb_ereg_match|mb_ereg_replace|mb_ereg_search|mb_ereg_search_getpos|mb_ereg_search_getregs|mb_ereg_search_init|mb_ereg_search_pos|mb_ereg_search_regs|mb_ereg_search_setpos|mb_eregi|mb_eregi_replace|mb_get_info|mb_http_input|mb_http_output|mb_internal_encoding|mb_language|mb_list_encodings|mb_output_handler|mb_parse_str|mb_preferred_mime_name|mb_regex_encoding|mb_regex_set_options|mb_send_mail|mb_split|mb_strcut|mb_strimwidth|mb_stripos|mb_stristr|mb_strlen|mb_strpos|mb_strrchr|mb_strrichr|mb_strripos|mb_strrpos|mb_strstr|mb_strtolower|mb_strtoupper|mb_strwidth|mb_substitute_character|mb_substr|mb_substr_count|mcrypt_cbc|mcrypt_cfb|mcrypt_create_iv|mcrypt_decrypt|mcrypt_ecb|mcrypt_enc_get_algorithms_name|mcrypt_enc_get_block_size|mcrypt_enc_get_iv_size|mcrypt_enc_get_key_size|mcrypt_enc_get_modes_name|mcrypt_enc_get_supported_key_sizes|mcrypt_enc_is_block_algorithm|mcrypt_enc_is_block_algorithm_mode|mcrypt_enc_is_block_mode|mcrypt_enc_self_test|mcrypt_encrypt|mcrypt_generic|mcrypt_generic_deinit|mcrypt_generic_end|mcrypt_generic_init|mcrypt_get_block_size|mcrypt_get_cipher_name|mcrypt_get_iv_size|mcrypt_get_key_size|mcrypt_list_algorithms|mcrypt_list_modes|mcrypt_module_close|mcrypt_module_get_algo_block_size|mcrypt_module_get_algo_key_size|mcrypt_module_get_supported_key_sizes|mcrypt_module_is_block_algorithm|mcrypt_module_is_block_algorithm_mode|mcrypt_module_is_block_mode|mcrypt_module_open|mcrypt_module_self_test|mcrypt_ofb|md5|md5_file|mdecrypt_generic|memcache|memcache_debug|memcached|memory_get_peak_usage|memory_get_usage|messageformatter|metaphone|method_exists|mhash|mhash_count|mhash_get_block_size|mhash_get_hash_name|mhash_keygen_s2k|microtime|mime_content_type|min|ming_keypress|ming_setcubicthreshold|ming_setscale|ming_setswfcompression|ming_useconstants|ming_useswfversion|mkdir|mktime|money_format|mongo|mongobindata|mongocode|mongocollection|mongoconnectionexception|mongocursor|mongocursorexception|mongocursortimeoutexception|mongodate|mongodb|mongodbref|mongoexception|mongogridfs|mongogridfscursor|mongogridfsexception|mongogridfsfile|mongoid|mongoint32|mongoint64|mongomaxkey|mongominkey|mongoregex|mongotimestamp|move_uploaded_file|mpegfile|mqseries_back|mqseries_begin|mqseries_close|mqseries_cmit|mqseries_conn|mqseries_connx|mqseries_disc|mqseries_get|mqseries_inq|mqseries_open|mqseries_put|mqseries_put1|mqseries_set|mqseries_strerror|msession_connect|msession_count|msession_create|msession_destroy|msession_disconnect|msession_find|msession_get|msession_get_array|msession_get_data|msession_inc|msession_list|msession_listvar|msession_lock|msession_plugin|msession_randstr|msession_set|msession_set_array|msession_set_data|msession_timeout|msession_uniq|msession_unlock|msg_get_queue|msg_queue_exists|msg_receive|msg_remove_queue|msg_send|msg_set_queue|msg_stat_queue|msql|msql_affected_rows|msql_close|msql_connect|msql_create_db|msql_createdb|msql_data_seek|msql_db_query|msql_dbname|msql_drop_db|msql_error|msql_fetch_array|msql_fetch_field|msql_fetch_object|msql_fetch_row|msql_field_flags|msql_field_len|msql_field_name|msql_field_seek|msql_field_table|msql_field_type|msql_fieldflags|msql_fieldlen|msql_fieldname|msql_fieldtable|msql_fieldtype|msql_free_result|msql_list_dbs|msql_list_fields|msql_list_tables|msql_num_fields|msql_num_rows|msql_numfields|msql_numrows|msql_pconnect|msql_query|msql_regcase|msql_result|msql_select_db|msql_tablename|mssql_bind|mssql_close|mssql_connect|mssql_data_seek|mssql_execute|mssql_fetch_array|mssql_fetch_assoc|mssql_fetch_batch|mssql_fetch_field|mssql_fetch_object|mssql_fetch_row|mssql_field_length|mssql_field_name|mssql_field_seek|mssql_field_type|mssql_free_result|mssql_free_statement|mssql_get_last_message|mssql_guid_string|mssql_init|mssql_min_error_severity|mssql_min_message_severity|mssql_next_result|mssql_num_fields|mssql_num_rows|mssql_pconnect|mssql_query|mssql_result|mssql_rows_affected|mssql_select_db|mt_getrandmax|mt_rand|mt_srand|multipleiterator|mysql_affected_rows|mysql_client_encoding|mysql_close|mysql_connect|mysql_create_db|mysql_data_seek|mysql_db_name|mysql_db_query|mysql_drop_db|mysql_errno|mysql_error|mysql_escape_string|mysql_fetch_array|mysql_fetch_assoc|mysql_fetch_field|mysql_fetch_lengths|mysql_fetch_object|mysql_fetch_row|mysql_field_flags|mysql_field_len|mysql_field_name|mysql_field_seek|mysql_field_table|mysql_field_type|mysql_free_result|mysql_get_client_info|mysql_get_host_info|mysql_get_proto_info|mysql_get_server_info|mysql_info|mysql_insert_id|mysql_list_dbs|mysql_list_fields|mysql_list_processes|mysql_list_tables|mysql_num_fields|mysql_num_rows|mysql_pconnect|mysql_ping|mysql_query|mysql_real_escape_string|mysql_result|mysql_select_db|mysql_set_charset|mysql_stat|mysql_tablename|mysql_thread_id|mysql_unbuffered_query|mysqli|mysqli_bind_param|mysqli_bind_result|mysqli_client_encoding|mysqli_connect|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_driver|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_escape_string|mysqli_execute|mysqli_fetch|mysqli_get_metadata|mysqli_master_query|mysqli_param_count|mysqli_report|mysqli_result|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|mysqli_send_long_data|mysqli_send_query|mysqli_set_opt|mysqli_slave_query|mysqli_stmt|mysqli_warning|mysqlnd_ms_get_stats|mysqlnd_ms_query_is_select|mysqlnd_ms_set_user_pick_server|mysqlnd_qc_change_handler|mysqlnd_qc_clear_cache|mysqlnd_qc_get_cache_info|mysqlnd_qc_get_core_stats|mysqlnd_qc_get_handler|mysqlnd_qc_get_query_trace_log|mysqlnd_qc_set_user_handlers|natcasesort|natsort|ncurses_addch|ncurses_addchnstr|ncurses_addchstr|ncurses_addnstr|ncurses_addstr|ncurses_assume_default_colors|ncurses_attroff|ncurses_attron|ncurses_attrset|ncurses_baudrate|ncurses_beep|ncurses_bkgd|ncurses_bkgdset|ncurses_border|ncurses_bottom_panel|ncurses_can_change_color|ncurses_cbreak|ncurses_clear|ncurses_clrtobot|ncurses_clrtoeol|ncurses_color_content|ncurses_color_set|ncurses_curs_set|ncurses_def_prog_mode|ncurses_def_shell_mode|ncurses_define_key|ncurses_del_panel|ncurses_delay_output|ncurses_delch|ncurses_deleteln|ncurses_delwin|ncurses_doupdate|ncurses_echo|ncurses_echochar|ncurses_end|ncurses_erase|ncurses_erasechar|ncurses_filter|ncurses_flash|ncurses_flushinp|ncurses_getch|ncurses_getmaxyx|ncurses_getmouse|ncurses_getyx|ncurses_halfdelay|ncurses_has_colors|ncurses_has_ic|ncurses_has_il|ncurses_has_key|ncurses_hide_panel|ncurses_hline|ncurses_inch|ncurses_init|ncurses_init_color|ncurses_init_pair|ncurses_insch|ncurses_insdelln|ncurses_insertln|ncurses_insstr|ncurses_instr|ncurses_isendwin|ncurses_keyok|ncurses_keypad|ncurses_killchar|ncurses_longname|ncurses_meta|ncurses_mouse_trafo|ncurses_mouseinterval|ncurses_mousemask|ncurses_move|ncurses_move_panel|ncurses_mvaddch|ncurses_mvaddchnstr|ncurses_mvaddchstr|ncurses_mvaddnstr|ncurses_mvaddstr|ncurses_mvcur|ncurses_mvdelch|ncurses_mvgetch|ncurses_mvhline|ncurses_mvinch|ncurses_mvvline|ncurses_mvwaddstr|ncurses_napms|ncurses_new_panel|ncurses_newpad|ncurses_newwin|ncurses_nl|ncurses_nocbreak|ncurses_noecho|ncurses_nonl|ncurses_noqiflush|ncurses_noraw|ncurses_pair_content|ncurses_panel_above|ncurses_panel_below|ncurses_panel_window|ncurses_pnoutrefresh|ncurses_prefresh|ncurses_putp|ncurses_qiflush|ncurses_raw|ncurses_refresh|ncurses_replace_panel|ncurses_reset_prog_mode|ncurses_reset_shell_mode|ncurses_resetty|ncurses_savetty|ncurses_scr_dump|ncurses_scr_init|ncurses_scr_restore|ncurses_scr_set|ncurses_scrl|ncurses_show_panel|ncurses_slk_attr|ncurses_slk_attroff|ncurses_slk_attron|ncurses_slk_attrset|ncurses_slk_clear|ncurses_slk_color|ncurses_slk_init|ncurses_slk_noutrefresh|ncurses_slk_refresh|ncurses_slk_restore|ncurses_slk_set|ncurses_slk_touch|ncurses_standend|ncurses_standout|ncurses_start_color|ncurses_termattrs|ncurses_termname|ncurses_timeout|ncurses_top_panel|ncurses_typeahead|ncurses_ungetch|ncurses_ungetmouse|ncurses_update_panels|ncurses_use_default_colors|ncurses_use_env|ncurses_use_extended_names|ncurses_vidattr|ncurses_vline|ncurses_waddch|ncurses_waddstr|ncurses_wattroff|ncurses_wattron|ncurses_wattrset|ncurses_wborder|ncurses_wclear|ncurses_wcolor_set|ncurses_werase|ncurses_wgetch|ncurses_whline|ncurses_wmouse_trafo|ncurses_wmove|ncurses_wnoutrefresh|ncurses_wrefresh|ncurses_wstandend|ncurses_wstandout|ncurses_wvline|newinstance|newinstanceargs|newt_bell|newt_button|newt_button_bar|newt_centered_window|newt_checkbox|newt_checkbox_get_value|newt_checkbox_set_flags|newt_checkbox_set_value|newt_checkbox_tree|newt_checkbox_tree_add_item|newt_checkbox_tree_find_item|newt_checkbox_tree_get_current|newt_checkbox_tree_get_entry_value|newt_checkbox_tree_get_multi_selection|newt_checkbox_tree_get_selection|newt_checkbox_tree_multi|newt_checkbox_tree_set_current|newt_checkbox_tree_set_entry|newt_checkbox_tree_set_entry_value|newt_checkbox_tree_set_width|newt_clear_key_buffer|newt_cls|newt_compact_button|newt_component_add_callback|newt_component_takes_focus|newt_create_grid|newt_cursor_off|newt_cursor_on|newt_delay|newt_draw_form|newt_draw_root_text|newt_entry|newt_entry_get_value|newt_entry_set|newt_entry_set_filter|newt_entry_set_flags|newt_finished|newt_form|newt_form_add_component|newt_form_add_components|newt_form_add_hot_key|newt_form_destroy|newt_form_get_current|newt_form_run|newt_form_set_background|newt_form_set_height|newt_form_set_size|newt_form_set_timer|newt_form_set_width|newt_form_watch_fd|newt_get_screen_size|newt_grid_add_components_to_form|newt_grid_basic_window|newt_grid_free|newt_grid_get_size|newt_grid_h_close_stacked|newt_grid_h_stacked|newt_grid_place|newt_grid_set_field|newt_grid_simple_window|newt_grid_v_close_stacked|newt_grid_v_stacked|newt_grid_wrapped_window|newt_grid_wrapped_window_at|newt_init|newt_label|newt_label_set_text|newt_listbox|newt_listbox_append_entry|newt_listbox_clear|newt_listbox_clear_selection|newt_listbox_delete_entry|newt_listbox_get_current|newt_listbox_get_selection|newt_listbox_insert_entry|newt_listbox_item_count|newt_listbox_select_item|newt_listbox_set_current|newt_listbox_set_current_by_key|newt_listbox_set_data|newt_listbox_set_entry|newt_listbox_set_width|newt_listitem|newt_listitem_get_data|newt_listitem_set|newt_open_window|newt_pop_help_line|newt_pop_window|newt_push_help_line|newt_radio_get_current|newt_radiobutton|newt_redraw_help_line|newt_reflow_text|newt_refresh|newt_resize_screen|newt_resume|newt_run_form|newt_scale|newt_scale_set|newt_scrollbar_set|newt_set_help_callback|newt_set_suspend_callback|newt_suspend|newt_textbox|newt_textbox_get_num_lines|newt_textbox_reflowed|newt_textbox_set_height|newt_textbox_set_text|newt_vertical_scrollbar|newt_wait_for_key|newt_win_choice|newt_win_entries|newt_win_menu|newt_win_message|newt_win_messagev|newt_win_ternary|next|ngettext|nl2br|nl_langinfo|norewinditerator|normalizer|notes_body|notes_copy_db|notes_create_db|notes_create_note|notes_drop_db|notes_find_note|notes_header_info|notes_list_msgs|notes_mark_read|notes_mark_unread|notes_nav_create|notes_search|notes_unread|notes_version|nsapi_request_headers|nsapi_response_headers|nsapi_virtual|nthmac|number_format|numberformatter|oauth|oauth_get_sbs|oauth_urlencode|oauthexception|oauthprovider|ob_clean|ob_deflatehandler|ob_end_clean|ob_end_flush|ob_etaghandler|ob_flush|ob_get_clean|ob_get_contents|ob_get_flush|ob_get_length|ob_get_level|ob_get_status|ob_gzhandler|ob_iconv_handler|ob_implicit_flush|ob_inflatehandler|ob_list_handlers|ob_start|ob_tidyhandler|oci_bind_array_by_name|oci_bind_by_name|oci_cancel|oci_client_version|oci_close|oci_collection_append|oci_collection_assign|oci_collection_element_assign|oci_collection_element_get|oci_collection_free|oci_collection_max|oci_collection_size|oci_collection_trim|oci_commit|oci_connect|oci_define_by_name|oci_error|oci_execute|oci_fetch|oci_fetch_all|oci_fetch_array|oci_fetch_assoc|oci_fetch_object|oci_fetch_row|oci_field_is_null|oci_field_name|oci_field_precision|oci_field_scale|oci_field_size|oci_field_type|oci_field_type_raw|oci_free_statement|oci_internal_debug|oci_lob_append|oci_lob_close|oci_lob_copy|oci_lob_eof|oci_lob_erase|oci_lob_export|oci_lob_flush|oci_lob_free|oci_lob_getbuffering|oci_lob_import|oci_lob_is_equal|oci_lob_load|oci_lob_read|oci_lob_rewind|oci_lob_save|oci_lob_savefile|oci_lob_seek|oci_lob_setbuffering|oci_lob_size|oci_lob_tell|oci_lob_truncate|oci_lob_write|oci_lob_writetemporary|oci_lob_writetofile|oci_new_collection|oci_new_connect|oci_new_cursor|oci_new_descriptor|oci_num_fields|oci_num_rows|oci_parse|oci_password_change|oci_pconnect|oci_result|oci_rollback|oci_server_version|oci_set_action|oci_set_client_identifier|oci_set_client_info|oci_set_edition|oci_set_module_name|oci_set_prefetch|oci_statement_type|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|octdec|odbc_autocommit|odbc_binmode|odbc_close|odbc_close_all|odbc_columnprivileges|odbc_columns|odbc_commit|odbc_connect|odbc_cursor|odbc_data_source|odbc_do|odbc_error|odbc_errormsg|odbc_exec|odbc_execute|odbc_fetch_array|odbc_fetch_into|odbc_fetch_object|odbc_fetch_row|odbc_field_len|odbc_field_name|odbc_field_num|odbc_field_precision|odbc_field_scale|odbc_field_type|odbc_foreignkeys|odbc_free_result|odbc_gettypeinfo|odbc_longreadlen|odbc_next_result|odbc_num_fields|odbc_num_rows|odbc_pconnect|odbc_prepare|odbc_primarykeys|odbc_procedurecolumns|odbc_procedures|odbc_result|odbc_result_all|odbc_rollback|odbc_setoption|odbc_specialcolumns|odbc_statistics|odbc_tableprivileges|odbc_tables|openal_buffer_create|openal_buffer_data|openal_buffer_destroy|openal_buffer_get|openal_buffer_loadwav|openal_context_create|openal_context_current|openal_context_destroy|openal_context_process|openal_context_suspend|openal_device_close|openal_device_open|openal_listener_get|openal_listener_set|openal_source_create|openal_source_destroy|openal_source_get|openal_source_pause|openal_source_play|openal_source_rewind|openal_source_set|openal_source_stop|openal_stream|opendir|openlog|openssl_cipher_iv_length|openssl_csr_export|openssl_csr_export_to_file|openssl_csr_get_public_key|openssl_csr_get_subject|openssl_csr_new|openssl_csr_sign|openssl_decrypt|openssl_dh_compute_key|openssl_digest|openssl_encrypt|openssl_error_string|openssl_free_key|openssl_get_cipher_methods|openssl_get_md_methods|openssl_get_privatekey|openssl_get_publickey|openssl_open|openssl_pkcs12_export|openssl_pkcs12_export_to_file|openssl_pkcs12_read|openssl_pkcs7_decrypt|openssl_pkcs7_encrypt|openssl_pkcs7_sign|openssl_pkcs7_verify|openssl_pkey_export|openssl_pkey_export_to_file|openssl_pkey_free|openssl_pkey_get_details|openssl_pkey_get_private|openssl_pkey_get_public|openssl_pkey_new|openssl_private_decrypt|openssl_private_encrypt|openssl_public_decrypt|openssl_public_encrypt|openssl_random_pseudo_bytes|openssl_seal|openssl_sign|openssl_verify|openssl_x509_check_private_key|openssl_x509_checkpurpose|openssl_x509_export|openssl_x509_export_to_file|openssl_x509_free|openssl_x509_parse|openssl_x509_read|ord|outeriterator|outofboundsexception|outofrangeexception|output_add_rewrite_var|output_reset_rewrite_vars|overflowexception|overload|override_function|ovrimos_close|ovrimos_commit|ovrimos_connect|ovrimos_cursor|ovrimos_exec|ovrimos_execute|ovrimos_fetch_into|ovrimos_fetch_row|ovrimos_field_len|ovrimos_field_name|ovrimos_field_num|ovrimos_field_type|ovrimos_free_result|ovrimos_longreadlen|ovrimos_num_fields|ovrimos_num_rows|ovrimos_prepare|ovrimos_result|ovrimos_result_all|ovrimos_rollback|pack|parentiterator|parse_ini_file|parse_ini_string|parse_str|parse_url|parsekit_compile_file|parsekit_compile_string|parsekit_func_arginfo|passthru|pathinfo|pclose|pcntl_alarm|pcntl_exec|pcntl_fork|pcntl_getpriority|pcntl_setpriority|pcntl_signal|pcntl_signal_dispatch|pcntl_sigprocmask|pcntl_sigtimedwait|pcntl_sigwaitinfo|pcntl_wait|pcntl_waitpid|pcntl_wexitstatus|pcntl_wifexited|pcntl_wifsignaled|pcntl_wifstopped|pcntl_wstopsig|pcntl_wtermsig|pdf_activate_item|pdf_add_annotation|pdf_add_bookmark|pdf_add_launchlink|pdf_add_locallink|pdf_add_nameddest|pdf_add_note|pdf_add_outline|pdf_add_pdflink|pdf_add_table_cell|pdf_add_textflow|pdf_add_thumbnail|pdf_add_weblink|pdf_arc|pdf_arcn|pdf_attach_file|pdf_begin_document|pdf_begin_font|pdf_begin_glyph|pdf_begin_item|pdf_begin_layer|pdf_begin_page|pdf_begin_page_ext|pdf_begin_pattern|pdf_begin_template|pdf_begin_template_ext|pdf_circle|pdf_clip|pdf_close|pdf_close_image|pdf_close_pdi|pdf_close_pdi_page|pdf_closepath|pdf_closepath_fill_stroke|pdf_closepath_stroke|pdf_concat|pdf_continue_text|pdf_create_3dview|pdf_create_action|pdf_create_annotation|pdf_create_bookmark|pdf_create_field|pdf_create_fieldgroup|pdf_create_gstate|pdf_create_pvf|pdf_create_textflow|pdf_curveto|pdf_define_layer|pdf_delete|pdf_delete_pvf|pdf_delete_table|pdf_delete_textflow|pdf_encoding_set_char|pdf_end_document|pdf_end_font|pdf_end_glyph|pdf_end_item|pdf_end_layer|pdf_end_page|pdf_end_page_ext|pdf_end_pattern|pdf_end_template|pdf_endpath|pdf_fill|pdf_fill_imageblock|pdf_fill_pdfblock|pdf_fill_stroke|pdf_fill_textblock|pdf_findfont|pdf_fit_image|pdf_fit_pdi_page|pdf_fit_table|pdf_fit_textflow|pdf_fit_textline|pdf_get_apiname|pdf_get_buffer|pdf_get_errmsg|pdf_get_errnum|pdf_get_font|pdf_get_fontname|pdf_get_fontsize|pdf_get_image_height|pdf_get_image_width|pdf_get_majorversion|pdf_get_minorversion|pdf_get_parameter|pdf_get_pdi_parameter|pdf_get_pdi_value|pdf_get_value|pdf_info_font|pdf_info_matchbox|pdf_info_table|pdf_info_textflow|pdf_info_textline|pdf_initgraphics|pdf_lineto|pdf_load_3ddata|pdf_load_font|pdf_load_iccprofile|pdf_load_image|pdf_makespotcolor|pdf_moveto|pdf_new|pdf_open_ccitt|pdf_open_file|pdf_open_gif|pdf_open_image|pdf_open_image_file|pdf_open_jpeg|pdf_open_memory_image|pdf_open_pdi|pdf_open_pdi_document|pdf_open_pdi_page|pdf_open_tiff|pdf_pcos_get_number|pdf_pcos_get_stream|pdf_pcos_get_string|pdf_place_image|pdf_place_pdi_page|pdf_process_pdi|pdf_rect|pdf_restore|pdf_resume_page|pdf_rotate|pdf_save|pdf_scale|pdf_set_border_color|pdf_set_border_dash|pdf_set_border_style|pdf_set_char_spacing|pdf_set_duration|pdf_set_gstate|pdf_set_horiz_scaling|pdf_set_info|pdf_set_info_author|pdf_set_info_creator|pdf_set_info_keywords|pdf_set_info_subject|pdf_set_info_title|pdf_set_layer_dependency|pdf_set_leading|pdf_set_parameter|pdf_set_text_matrix|pdf_set_text_pos|pdf_set_text_rendering|pdf_set_text_rise|pdf_set_value|pdf_set_word_spacing|pdf_setcolor|pdf_setdash|pdf_setdashpattern|pdf_setflat|pdf_setfont|pdf_setgray|pdf_setgray_fill|pdf_setgray_stroke|pdf_setlinecap|pdf_setlinejoin|pdf_setlinewidth|pdf_setmatrix|pdf_setmiterlimit|pdf_setpolydash|pdf_setrgbcolor|pdf_setrgbcolor_fill|pdf_setrgbcolor_stroke|pdf_shading|pdf_shading_pattern|pdf_shfill|pdf_show|pdf_show_boxed|pdf_show_xy|pdf_skew|pdf_stringwidth|pdf_stroke|pdf_suspend_page|pdf_translate|pdf_utf16_to_utf8|pdf_utf32_to_utf16|pdf_utf8_to_utf16|pdo|pdo_cubrid_schema|pdo_pgsqllobcreate|pdo_pgsqllobopen|pdo_pgsqllobunlink|pdo_sqlitecreateaggregate|pdo_sqlitecreatefunction|pdoexception|pdostatement|pfsockopen|pg_affected_rows|pg_cancel_query|pg_client_encoding|pg_close|pg_connect|pg_connection_busy|pg_connection_reset|pg_connection_status|pg_convert|pg_copy_from|pg_copy_to|pg_dbname|pg_delete|pg_end_copy|pg_escape_bytea|pg_escape_string|pg_execute|pg_fetch_all|pg_fetch_all_columns|pg_fetch_array|pg_fetch_assoc|pg_fetch_object|pg_fetch_result|pg_fetch_row|pg_field_is_null|pg_field_name|pg_field_num|pg_field_prtlen|pg_field_size|pg_field_table|pg_field_type|pg_field_type_oid|pg_free_result|pg_get_notify|pg_get_pid|pg_get_result|pg_host|pg_insert|pg_last_error|pg_last_notice|pg_last_oid|pg_lo_close|pg_lo_create|pg_lo_export|pg_lo_import|pg_lo_open|pg_lo_read|pg_lo_read_all|pg_lo_seek|pg_lo_tell|pg_lo_unlink|pg_lo_write|pg_meta_data|pg_num_fields|pg_num_rows|pg_options|pg_parameter_status|pg_pconnect|pg_ping|pg_port|pg_prepare|pg_put_line|pg_query|pg_query_params|pg_result_error|pg_result_error_field|pg_result_seek|pg_result_status|pg_select|pg_send_execute|pg_send_prepare|pg_send_query|pg_send_query_params|pg_set_client_encoding|pg_set_error_verbosity|pg_trace|pg_transaction_status|pg_tty|pg_unescape_bytea|pg_untrace|pg_update|pg_version|php_check_syntax|php_ini_loaded_file|php_ini_scanned_files|php_logo_guid|php_sapi_name|php_strip_whitespace|php_uname|phpcredits|phpinfo|phpversion|pi|png2wbmp|popen|pos|posix_access|posix_ctermid|posix_errno|posix_get_last_error|posix_getcwd|posix_getegid|posix_geteuid|posix_getgid|posix_getgrgid|posix_getgrnam|posix_getgroups|posix_getlogin|posix_getpgid|posix_getpgrp|posix_getpid|posix_getppid|posix_getpwnam|posix_getpwuid|posix_getrlimit|posix_getsid|posix_getuid|posix_initgroups|posix_isatty|posix_kill|posix_mkfifo|posix_mknod|posix_setegid|posix_seteuid|posix_setgid|posix_setpgid|posix_setsid|posix_setuid|posix_strerror|posix_times|posix_ttyname|posix_uname|pow|preg_filter|preg_grep|preg_last_error|preg_match|preg_match_all|preg_quote|preg_replace|preg_replace_callback|preg_split|prev|print|print_r|printer_abort|printer_close|printer_create_brush|printer_create_dc|printer_create_font|printer_create_pen|printer_delete_brush|printer_delete_dc|printer_delete_font|printer_delete_pen|printer_draw_bmp|printer_draw_chord|printer_draw_elipse|printer_draw_line|printer_draw_pie|printer_draw_rectangle|printer_draw_roundrect|printer_draw_text|printer_end_doc|printer_end_page|printer_get_option|printer_list|printer_logical_fontheight|printer_open|printer_select_brush|printer_select_font|printer_select_pen|printer_set_option|printer_start_doc|printer_start_page|printer_write|printf|proc_close|proc_get_status|proc_nice|proc_open|proc_terminate|property_exists|ps_add_bookmark|ps_add_launchlink|ps_add_locallink|ps_add_note|ps_add_pdflink|ps_add_weblink|ps_arc|ps_arcn|ps_begin_page|ps_begin_pattern|ps_begin_template|ps_circle|ps_clip|ps_close|ps_close_image|ps_closepath|ps_closepath_stroke|ps_continue_text|ps_curveto|ps_delete|ps_end_page|ps_end_pattern|ps_end_template|ps_fill|ps_fill_stroke|ps_findfont|ps_get_buffer|ps_get_parameter|ps_get_value|ps_hyphenate|ps_include_file|ps_lineto|ps_makespotcolor|ps_moveto|ps_new|ps_open_file|ps_open_image|ps_open_image_file|ps_open_memory_image|ps_place_image|ps_rect|ps_restore|ps_rotate|ps_save|ps_scale|ps_set_border_color|ps_set_border_dash|ps_set_border_style|ps_set_info|ps_set_parameter|ps_set_text_pos|ps_set_value|ps_setcolor|ps_setdash|ps_setflat|ps_setfont|ps_setgray|ps_setlinecap|ps_setlinejoin|ps_setlinewidth|ps_setmiterlimit|ps_setoverprintmode|ps_setpolydash|ps_shading|ps_shading_pattern|ps_shfill|ps_show|ps_show2|ps_show_boxed|ps_show_xy|ps_show_xy2|ps_string_geometry|ps_stringwidth|ps_stroke|ps_symbol|ps_symbol_name|ps_symbol_width|ps_translate|pspell_add_to_personal|pspell_add_to_session|pspell_check|pspell_clear_session|pspell_config_create|pspell_config_data_dir|pspell_config_dict_dir|pspell_config_ignore|pspell_config_mode|pspell_config_personal|pspell_config_repl|pspell_config_runtogether|pspell_config_save_repl|pspell_new|pspell_new_config|pspell_new_personal|pspell_save_wordlist|pspell_store_replacement|pspell_suggest|putenv|px_close|px_create_fp|px_date2string|px_delete|px_delete_record|px_get_field|px_get_info|px_get_parameter|px_get_record|px_get_schema|px_get_value|px_insert_record|px_new|px_numfields|px_numrecords|px_open_fp|px_put_record|px_retrieve_record|px_set_blob_file|px_set_parameter|px_set_tablename|px_set_targetencoding|px_set_value|px_timestamp2string|px_update_record|qdom_error|qdom_tree|quoted_printable_decode|quoted_printable_encode|quotemeta|rad2deg|radius_acct_open|radius_add_server|radius_auth_open|radius_close|radius_config|radius_create_request|radius_cvt_addr|radius_cvt_int|radius_cvt_string|radius_demangle|radius_demangle_mppe_key|radius_get_attr|radius_get_vendor_attr|radius_put_addr|radius_put_attr|radius_put_int|radius_put_string|radius_put_vendor_addr|radius_put_vendor_attr|radius_put_vendor_int|radius_put_vendor_string|radius_request_authenticator|radius_send_request|radius_server_secret|radius_strerror|rand|range|rangeexception|rar_wrapper_cache_stats|rararchive|rarentry|rarexception|rawurldecode|rawurlencode|read_exif_data|readdir|readfile|readgzfile|readline|readline_add_history|readline_callback_handler_install|readline_callback_handler_remove|readline_callback_read_char|readline_clear_history|readline_completion_function|readline_info|readline_list_history|readline_on_new_line|readline_read_history|readline_redisplay|readline_write_history|readlink|realpath|realpath_cache_get|realpath_cache_size|recode|recode_file|recode_string|recursivearrayiterator|recursivecachingiterator|recursivecallbackfilteriterator|recursivedirectoryiterator|recursivefilteriterator|recursiveiterator|recursiveiteratoriterator|recursiveregexiterator|recursivetreeiterator|reflection|reflectionclass|reflectionexception|reflectionextension|reflectionfunction|reflectionfunctionabstract|reflectionmethod|reflectionobject|reflectionparameter|reflectionproperty|reflector|regexiterator|register_shutdown_function|register_tick_function|rename|rename_function|require|require_once|reset|resetValue|resourcebundle|restore_error_handler|restore_exception_handler|restore_include_path|return|rewind|rewinddir|rmdir|round|rpm_close|rpm_get_tag|rpm_is_valid|rpm_open|rpm_version|rrd_create|rrd_error|rrd_fetch|rrd_first|rrd_graph|rrd_info|rrd_last|rrd_lastupdate|rrd_restore|rrd_tune|rrd_update|rrd_xport|rrdcreator|rrdgraph|rrdupdater|rsort|rtrim|runkit_class_adopt|runkit_class_emancipate|runkit_constant_add|runkit_constant_redefine|runkit_constant_remove|runkit_function_add|runkit_function_copy|runkit_function_redefine|runkit_function_remove|runkit_function_rename|runkit_import|runkit_lint|runkit_lint_file|runkit_method_add|runkit_method_copy|runkit_method_redefine|runkit_method_remove|runkit_method_rename|runkit_return_value_used|runkit_sandbox_output_handler|runkit_superglobals|runtimeexception|samconnection_commit|samconnection_connect|samconnection_constructor|samconnection_disconnect|samconnection_errno|samconnection_error|samconnection_isconnected|samconnection_peek|samconnection_peekall|samconnection_receive|samconnection_remove|samconnection_rollback|samconnection_send|samconnection_setDebug|samconnection_subscribe|samconnection_unsubscribe|sammessage_body|sammessage_constructor|sammessage_header|sca_createdataobject|sca_getservice|sca_localproxy_createdataobject|sca_soapproxy_createdataobject|scandir|sdo_das_changesummary_beginlogging|sdo_das_changesummary_endlogging|sdo_das_changesummary_getchangeddataobjects|sdo_das_changesummary_getchangetype|sdo_das_changesummary_getoldcontainer|sdo_das_changesummary_getoldvalues|sdo_das_changesummary_islogging|sdo_das_datafactory_addpropertytotype|sdo_das_datafactory_addtype|sdo_das_datafactory_getdatafactory|sdo_das_dataobject_getchangesummary|sdo_das_relational_applychanges|sdo_das_relational_construct|sdo_das_relational_createrootdataobject|sdo_das_relational_executepreparedquery|sdo_das_relational_executequery|sdo_das_setting_getlistindex|sdo_das_setting_getpropertyindex|sdo_das_setting_getpropertyname|sdo_das_setting_getvalue|sdo_das_setting_isset|sdo_das_xml_addtypes|sdo_das_xml_create|sdo_das_xml_createdataobject|sdo_das_xml_createdocument|sdo_das_xml_document_getrootdataobject|sdo_das_xml_document_getrootelementname|sdo_das_xml_document_getrootelementuri|sdo_das_xml_document_setencoding|sdo_das_xml_document_setxmldeclaration|sdo_das_xml_document_setxmlversion|sdo_das_xml_loadfile|sdo_das_xml_loadstring|sdo_das_xml_savefile|sdo_das_xml_savestring|sdo_datafactory_create|sdo_dataobject_clear|sdo_dataobject_createdataobject|sdo_dataobject_getcontainer|sdo_dataobject_getsequence|sdo_dataobject_gettypename|sdo_dataobject_gettypenamespaceuri|sdo_exception_getcause|sdo_list_insert|sdo_model_property_getcontainingtype|sdo_model_property_getdefault|sdo_model_property_getname|sdo_model_property_gettype|sdo_model_property_iscontainment|sdo_model_property_ismany|sdo_model_reflectiondataobject_construct|sdo_model_reflectiondataobject_export|sdo_model_reflectiondataobject_getcontainmentproperty|sdo_model_reflectiondataobject_getinstanceproperties|sdo_model_reflectiondataobject_gettype|sdo_model_type_getbasetype|sdo_model_type_getname|sdo_model_type_getnamespaceuri|sdo_model_type_getproperties|sdo_model_type_getproperty|sdo_model_type_isabstracttype|sdo_model_type_isdatatype|sdo_model_type_isinstance|sdo_model_type_isopentype|sdo_model_type_issequencedtype|sdo_sequence_getproperty|sdo_sequence_insert|sdo_sequence_move|seekableiterator|sem_acquire|sem_get|sem_release|sem_remove|serializable|serialize|session_cache_expire|session_cache_limiter|session_commit|session_decode|session_destroy|session_encode|session_get_cookie_params|session_id|session_is_registered|session_module_name|session_name|session_pgsql_add_error|session_pgsql_get_error|session_pgsql_get_field|session_pgsql_reset|session_pgsql_set_field|session_pgsql_status|session_regenerate_id|session_register|session_save_path|session_set_cookie_params|session_set_save_handler|session_start|session_unregister|session_unset|session_write_close|setCounterClass|set_error_handler|set_exception_handler|set_file_buffer|set_include_path|set_magic_quotes_runtime|set_socket_blocking|set_time_limit|setcookie|setlocale|setproctitle|setrawcookie|setstaticpropertyvalue|setthreadtitle|settype|sha1|sha1_file|shell_exec|shm_attach|shm_detach|shm_get_var|shm_has_var|shm_put_var|shm_remove|shm_remove_var|shmop_close|shmop_delete|shmop_open|shmop_read|shmop_size|shmop_write|show_source|shuffle|signeurlpaiement|similar_text|simplexml_import_dom|simplexml_load_file|simplexml_load_string|simplexmlelement|simplexmliterator|sin|sinh|sizeof|sleep|snmp|snmp2_get|snmp2_getnext|snmp2_real_walk|snmp2_set|snmp2_walk|snmp3_get|snmp3_getnext|snmp3_real_walk|snmp3_set|snmp3_walk|snmp_get_quick_print|snmp_get_valueretrieval|snmp_read_mib|snmp_set_enum_print|snmp_set_oid_numeric_print|snmp_set_oid_output_format|snmp_set_quick_print|snmp_set_valueretrieval|snmpget|snmpgetnext|snmprealwalk|snmpset|snmpwalk|snmpwalkoid|soapclient|soapfault|soapheader|soapparam|soapserver|soapvar|socket_accept|socket_bind|socket_clear_error|socket_close|socket_connect|socket_create|socket_create_listen|socket_create_pair|socket_get_option|socket_get_status|socket_getpeername|socket_getsockname|socket_last_error|socket_listen|socket_read|socket_recv|socket_recvfrom|socket_select|socket_send|socket_sendto|socket_set_block|socket_set_blocking|socket_set_nonblock|socket_set_option|socket_set_timeout|socket_shutdown|socket_strerror|socket_write|solr_get_version|solrclient|solrclientexception|solrdocument|solrdocumentfield|solrexception|solrgenericresponse|solrillegalargumentexception|solrillegaloperationexception|solrinputdocument|solrmodifiableparams|solrobject|solrparams|solrpingresponse|solrquery|solrqueryresponse|solrresponse|solrupdateresponse|solrutils|sort|soundex|sphinxclient|spl_autoload|spl_autoload_call|spl_autoload_extensions|spl_autoload_functions|spl_autoload_register|spl_autoload_unregister|spl_classes|spl_object_hash|splbool|spldoublylinkedlist|splenum|splfileinfo|splfileobject|splfixedarray|splfloat|splheap|splint|split|spliti|splmaxheap|splminheap|splobjectstorage|splobserver|splpriorityqueue|splqueue|splstack|splstring|splsubject|spltempfileobject|spoofchecker|sprintf|sql_regcase|sqlite3|sqlite3result|sqlite3stmt|sqlite_array_query|sqlite_busy_timeout|sqlite_changes|sqlite_close|sqlite_column|sqlite_create_aggregate|sqlite_create_function|sqlite_current|sqlite_error_string|sqlite_escape_string|sqlite_exec|sqlite_factory|sqlite_fetch_all|sqlite_fetch_array|sqlite_fetch_column_types|sqlite_fetch_object|sqlite_fetch_single|sqlite_fetch_string|sqlite_field_name|sqlite_has_more|sqlite_has_prev|sqlite_key|sqlite_last_error|sqlite_last_insert_rowid|sqlite_libencoding|sqlite_libversion|sqlite_next|sqlite_num_fields|sqlite_num_rows|sqlite_open|sqlite_popen|sqlite_prev|sqlite_query|sqlite_rewind|sqlite_seek|sqlite_single_query|sqlite_udf_decode_binary|sqlite_udf_encode_binary|sqlite_unbuffered_query|sqlite_valid|sqrt|srand|sscanf|ssdeep_fuzzy_compare|ssdeep_fuzzy_hash|ssdeep_fuzzy_hash_filename|ssh2_auth_hostbased_file|ssh2_auth_none|ssh2_auth_password|ssh2_auth_pubkey_file|ssh2_connect|ssh2_exec|ssh2_fetch_stream|ssh2_fingerprint|ssh2_methods_negotiated|ssh2_publickey_add|ssh2_publickey_init|ssh2_publickey_list|ssh2_publickey_remove|ssh2_scp_recv|ssh2_scp_send|ssh2_sftp|ssh2_sftp_lstat|ssh2_sftp_mkdir|ssh2_sftp_readlink|ssh2_sftp_realpath|ssh2_sftp_rename|ssh2_sftp_rmdir|ssh2_sftp_stat|ssh2_sftp_symlink|ssh2_sftp_unlink|ssh2_shell|ssh2_tunnel|stat|stats_absolute_deviation|stats_cdf_beta|stats_cdf_binomial|stats_cdf_cauchy|stats_cdf_chisquare|stats_cdf_exponential|stats_cdf_f|stats_cdf_gamma|stats_cdf_laplace|stats_cdf_logistic|stats_cdf_negative_binomial|stats_cdf_noncentral_chisquare|stats_cdf_noncentral_f|stats_cdf_poisson|stats_cdf_t|stats_cdf_uniform|stats_cdf_weibull|stats_covariance|stats_den_uniform|stats_dens_beta|stats_dens_cauchy|stats_dens_chisquare|stats_dens_exponential|stats_dens_f|stats_dens_gamma|stats_dens_laplace|stats_dens_logistic|stats_dens_negative_binomial|stats_dens_normal|stats_dens_pmf_binomial|stats_dens_pmf_hypergeometric|stats_dens_pmf_poisson|stats_dens_t|stats_dens_weibull|stats_harmonic_mean|stats_kurtosis|stats_rand_gen_beta|stats_rand_gen_chisquare|stats_rand_gen_exponential|stats_rand_gen_f|stats_rand_gen_funiform|stats_rand_gen_gamma|stats_rand_gen_ibinomial|stats_rand_gen_ibinomial_negative|stats_rand_gen_int|stats_rand_gen_ipoisson|stats_rand_gen_iuniform|stats_rand_gen_noncenral_chisquare|stats_rand_gen_noncentral_f|stats_rand_gen_noncentral_t|stats_rand_gen_normal|stats_rand_gen_t|stats_rand_get_seeds|stats_rand_phrase_to_seeds|stats_rand_ranf|stats_rand_setall|stats_skew|stats_standard_deviation|stats_stat_binomial_coef|stats_stat_correlation|stats_stat_gennch|stats_stat_independent_t|stats_stat_innerproduct|stats_stat_noncentral_t|stats_stat_paired_t|stats_stat_percentile|stats_stat_powersum|stats_variance|stomp|stomp_connect_error|stomp_version|stompexception|stompframe|str_getcsv|str_ireplace|str_pad|str_repeat|str_replace|str_rot13|str_shuffle|str_split|str_word_count|strcasecmp|strchr|strcmp|strcoll|strcspn|stream_bucket_append|stream_bucket_make_writeable|stream_bucket_new|stream_bucket_prepend|stream_context_create|stream_context_get_default|stream_context_get_options|stream_context_get_params|stream_context_set_default|stream_context_set_option|stream_context_set_params|stream_copy_to_stream|stream_encoding|stream_filter_append|stream_filter_prepend|stream_filter_register|stream_filter_remove|stream_get_contents|stream_get_filters|stream_get_line|stream_get_meta_data|stream_get_transports|stream_get_wrappers|stream_is_local|stream_notification_callback|stream_register_wrapper|stream_resolve_include_path|stream_select|stream_set_blocking|stream_set_read_buffer|stream_set_timeout|stream_set_write_buffer|stream_socket_accept|stream_socket_client|stream_socket_enable_crypto|stream_socket_get_name|stream_socket_pair|stream_socket_recvfrom|stream_socket_sendto|stream_socket_server|stream_socket_shutdown|stream_supports_lock|stream_wrapper_register|stream_wrapper_restore|stream_wrapper_unregister|streamwrapper|strftime|strip_tags|stripcslashes|stripos|stripslashes|stristr|strlen|strnatcasecmp|strnatcmp|strncasecmp|strncmp|strpbrk|strpos|strptime|strrchr|strrev|strripos|strrpos|strspn|strstr|strtok|strtolower|strtotime|strtoupper|strtr|strval|substr|substr_compare|substr_count|substr_replace|svm|svmmodel|svn_add|svn_auth_get_parameter|svn_auth_set_parameter|svn_blame|svn_cat|svn_checkout|svn_cleanup|svn_client_version|svn_commit|svn_delete|svn_diff|svn_export|svn_fs_abort_txn|svn_fs_apply_text|svn_fs_begin_txn2|svn_fs_change_node_prop|svn_fs_check_path|svn_fs_contents_changed|svn_fs_copy|svn_fs_delete|svn_fs_dir_entries|svn_fs_file_contents|svn_fs_file_length|svn_fs_is_dir|svn_fs_is_file|svn_fs_make_dir|svn_fs_make_file|svn_fs_node_created_rev|svn_fs_node_prop|svn_fs_props_changed|svn_fs_revision_prop|svn_fs_revision_root|svn_fs_txn_root|svn_fs_youngest_rev|svn_import|svn_log|svn_ls|svn_mkdir|svn_repos_create|svn_repos_fs|svn_repos_fs_begin_txn_for_commit|svn_repos_fs_commit_txn|svn_repos_hotcopy|svn_repos_open|svn_repos_recover|svn_revert|svn_status|svn_update|swf_actiongeturl|swf_actiongotoframe|swf_actiongotolabel|swf_actionnextframe|swf_actionplay|swf_actionprevframe|swf_actionsettarget|swf_actionstop|swf_actiontogglequality|swf_actionwaitforframe|swf_addbuttonrecord|swf_addcolor|swf_closefile|swf_definebitmap|swf_definefont|swf_defineline|swf_definepoly|swf_definerect|swf_definetext|swf_endbutton|swf_enddoaction|swf_endshape|swf_endsymbol|swf_fontsize|swf_fontslant|swf_fonttracking|swf_getbitmapinfo|swf_getfontinfo|swf_getframe|swf_labelframe|swf_lookat|swf_modifyobject|swf_mulcolor|swf_nextid|swf_oncondition|swf_openfile|swf_ortho|swf_ortho2|swf_perspective|swf_placeobject|swf_polarview|swf_popmatrix|swf_posround|swf_pushmatrix|swf_removeobject|swf_rotate|swf_scale|swf_setfont|swf_setframe|swf_shapearc|swf_shapecurveto|swf_shapecurveto3|swf_shapefillbitmapclip|swf_shapefillbitmaptile|swf_shapefilloff|swf_shapefillsolid|swf_shapelinesolid|swf_shapelineto|swf_shapemoveto|swf_showframe|swf_startbutton|swf_startdoaction|swf_startshape|swf_startsymbol|swf_textwidth|swf_translate|swf_viewport|swfaction|swfbitmap|swfbutton|swfdisplayitem|swffill|swffont|swffontchar|swfgradient|swfmorph|swfmovie|swfprebuiltclip|swfshape|swfsound|swfsoundinstance|swfsprite|swftext|swftextfield|swfvideostream|swish_construct|swish_getmetalist|swish_getpropertylist|swish_prepare|swish_query|swishresult_getmetalist|swishresult_stem|swishresults_getparsedwords|swishresults_getremovedstopwords|swishresults_nextresult|swishresults_seekresult|swishsearch_execute|swishsearch_resetlimit|swishsearch_setlimit|swishsearch_setphrasedelimiter|swishsearch_setsort|swishsearch_setstructure|sybase_affected_rows|sybase_close|sybase_connect|sybase_data_seek|sybase_deadlock_retry_count|sybase_fetch_array|sybase_fetch_assoc|sybase_fetch_field|sybase_fetch_object|sybase_fetch_row|sybase_field_seek|sybase_free_result|sybase_get_last_message|sybase_min_client_severity|sybase_min_error_severity|sybase_min_message_severity|sybase_min_server_severity|sybase_num_fields|sybase_num_rows|sybase_pconnect|sybase_query|sybase_result|sybase_select_db|sybase_set_message_handler|sybase_unbuffered_query|symlink|sys_get_temp_dir|sys_getloadavg|syslog|system|tag|tan|tanh|tcpwrap_check|tempnam|textdomain|tidy|tidy_access_count|tidy_config_count|tidy_diagnose|tidy_error_count|tidy_get_error_buffer|tidy_get_output|tidy_load_config|tidy_reset_config|tidy_save_config|tidy_set_encoding|tidy_setopt|tidy_warning_count|tidynode|time|time_nanosleep|time_sleep_until|timezone_abbreviations_list|timezone_identifiers_list|timezone_location_get|timezone_name_from_abbr|timezone_name_get|timezone_offset_get|timezone_open|timezone_transitions_get|timezone_version_get|tmpfile|token_get_all|token_name|tokyotyrant|tokyotyrantquery|tokyotyranttable|tostring|tostring|touch|transliterator|traversable|trigger_error|trim|uasort|ucfirst|ucwords|udm_add_search_limit|udm_alloc_agent|udm_alloc_agent_array|udm_api_version|udm_cat_list|udm_cat_path|udm_check_charset|udm_check_stored|udm_clear_search_limits|udm_close_stored|udm_crc32|udm_errno|udm_error|udm_find|udm_free_agent|udm_free_ispell_data|udm_free_res|udm_get_doc_count|udm_get_res_field|udm_get_res_param|udm_hash32|udm_load_ispell_data|udm_open_stored|udm_set_agent_param|uksort|umask|underflowexception|unexpectedvalueexception|uniqid|unixtojd|unlink|unpack|unregister_tick_function|unserialize|unset|urldecode|urlencode|use_soap_error_handler|user_error|usleep|usort|utf8_decode|utf8_encode|v8js|v8jsexception|var_dump|var_export|variant|variant_abs|variant_add|variant_and|variant_cast|variant_cat|variant_cmp|variant_date_from_timestamp|variant_date_to_timestamp|variant_div|variant_eqv|variant_fix|variant_get_type|variant_idiv|variant_imp|variant_int|variant_mod|variant_mul|variant_neg|variant_not|variant_or|variant_pow|variant_round|variant_set|variant_set_type|variant_sub|variant_xor|version_compare|vfprintf|virtual|vpopmail_add_alias_domain|vpopmail_add_alias_domain_ex|vpopmail_add_domain|vpopmail_add_domain_ex|vpopmail_add_user|vpopmail_alias_add|vpopmail_alias_del|vpopmail_alias_del_domain|vpopmail_alias_get|vpopmail_alias_get_all|vpopmail_auth_user|vpopmail_del_domain|vpopmail_del_domain_ex|vpopmail_del_user|vpopmail_error|vpopmail_passwd|vpopmail_set_user_quota|vprintf|vsprintf|w32api_deftype|w32api_init_dtype|w32api_invoke_function|w32api_register_function|w32api_set_call_method|wddx_add_vars|wddx_deserialize|wddx_packet_end|wddx_packet_start|wddx_serialize_value|wddx_serialize_vars|win32_continue_service|win32_create_service|win32_delete_service|win32_get_last_control_message|win32_pause_service|win32_ps_list_procs|win32_ps_stat_mem|win32_ps_stat_proc|win32_query_service_status|win32_set_service_status|win32_start_service|win32_start_service_ctrl_dispatcher|win32_stop_service|wincache_fcache_fileinfo|wincache_fcache_meminfo|wincache_lock|wincache_ocache_fileinfo|wincache_ocache_meminfo|wincache_refresh_if_changed|wincache_rplist_fileinfo|wincache_rplist_meminfo|wincache_scache_info|wincache_scache_meminfo|wincache_ucache_add|wincache_ucache_cas|wincache_ucache_clear|wincache_ucache_dec|wincache_ucache_delete|wincache_ucache_exists|wincache_ucache_get|wincache_ucache_inc|wincache_ucache_info|wincache_ucache_meminfo|wincache_ucache_set|wincache_unlock|wordwrap|xattr_get|xattr_list|xattr_remove|xattr_set|xattr_supported|xdiff_file_bdiff|xdiff_file_bdiff_size|xdiff_file_bpatch|xdiff_file_diff|xdiff_file_diff_binary|xdiff_file_merge3|xdiff_file_patch|xdiff_file_patch_binary|xdiff_file_rabdiff|xdiff_string_bdiff|xdiff_string_bdiff_size|xdiff_string_bpatch|xdiff_string_diff|xdiff_string_diff_binary|xdiff_string_merge3|xdiff_string_patch|xdiff_string_patch_binary|xdiff_string_rabdiff|xhprof_disable|xhprof_enable|xhprof_sample_disable|xhprof_sample_enable|xml_error_string|xml_get_current_byte_index|xml_get_current_column_number|xml_get_current_line_number|xml_get_error_code|xml_parse|xml_parse_into_struct|xml_parser_create|xml_parser_create_ns|xml_parser_free|xml_parser_get_option|xml_parser_set_option|xml_set_character_data_handler|xml_set_default_handler|xml_set_element_handler|xml_set_end_namespace_decl_handler|xml_set_external_entity_ref_handler|xml_set_notation_decl_handler|xml_set_object|xml_set_processing_instruction_handler|xml_set_start_namespace_decl_handler|xml_set_unparsed_entity_decl_handler|xmlreader|xmlrpc_decode|xmlrpc_decode_request|xmlrpc_encode|xmlrpc_encode_request|xmlrpc_get_type|xmlrpc_is_fault|xmlrpc_parse_method_descriptions|xmlrpc_server_add_introspection_data|xmlrpc_server_call_method|xmlrpc_server_create|xmlrpc_server_destroy|xmlrpc_server_register_introspection_callback|xmlrpc_server_register_method|xmlrpc_set_type|xmlwriter_end_attribute|xmlwriter_end_cdata|xmlwriter_end_comment|xmlwriter_end_document|xmlwriter_end_dtd|xmlwriter_end_dtd_attlist|xmlwriter_end_dtd_element|xmlwriter_end_dtd_entity|xmlwriter_end_element|xmlwriter_end_pi|xmlwriter_flush|xmlwriter_full_end_element|xmlwriter_open_memory|xmlwriter_open_uri|xmlwriter_output_memory|xmlwriter_set_indent|xmlwriter_set_indent_string|xmlwriter_start_attribute|xmlwriter_start_attribute_ns|xmlwriter_start_cdata|xmlwriter_start_comment|xmlwriter_start_document|xmlwriter_start_dtd|xmlwriter_start_dtd_attlist|xmlwriter_start_dtd_element|xmlwriter_start_dtd_entity|xmlwriter_start_element|xmlwriter_start_element_ns|xmlwriter_start_pi|xmlwriter_text|xmlwriter_write_attribute|xmlwriter_write_attribute_ns|xmlwriter_write_cdata|xmlwriter_write_comment|xmlwriter_write_dtd|xmlwriter_write_dtd_attlist|xmlwriter_write_dtd_element|xmlwriter_write_dtd_entity|xmlwriter_write_element|xmlwriter_write_element_ns|xmlwriter_write_pi|xmlwriter_write_raw|xpath_eval|xpath_eval_expression|xpath_new_context|xpath_register_ns|xpath_register_ns_auto|xptr_eval|xptr_new_context|xslt_backend_info|xslt_backend_name|xslt_backend_version|xslt_create|xslt_errno|xslt_error|xslt_free|xslt_getopt|xslt_process|xslt_set_base|xslt_set_encoding|xslt_set_error_handler|xslt_set_log|xslt_set_object|xslt_set_sax_handler|xslt_set_sax_handlers|xslt_set_scheme_handler|xslt_set_scheme_handlers|xslt_setopt|xsltprocessor|yaml_emit|yaml_emit_file|yaml_parse|yaml_parse_file|yaml_parse_url|yaz_addinfo|yaz_ccl_conf|yaz_ccl_parse|yaz_close|yaz_connect|yaz_database|yaz_element|yaz_errno|yaz_error|yaz_es|yaz_es_result|yaz_get_option|yaz_hits|yaz_itemorder|yaz_present|yaz_range|yaz_record|yaz_scan|yaz_scan_result|yaz_schema|yaz_search|yaz_set_option|yaz_sort|yaz_syntax|yaz_wait|yp_all|yp_cat|yp_err_string|yp_errno|yp_first|yp_get_default_domain|yp_master|yp_match|yp_next|yp_order|zend_logo_guid|zend_thread_id|zend_version|zip_close|zip_entry_close|zip_entry_compressedsize|zip_entry_compressionmethod|zip_entry_filesize|zip_entry_name|zip_entry_open|zip_entry_read|zip_open|zip_read|ziparchive|ziparchive_addemptydir|ziparchive_addfile|ziparchive_addfromstring|ziparchive_close|ziparchive_deleteindex|ziparchive_deletename|ziparchive_extractto|ziparchive_getarchivecomment|ziparchive_getcommentindex|ziparchive_getcommentname|ziparchive_getfromindex|ziparchive_getfromname|ziparchive_getnameindex|ziparchive_getstatusstring|ziparchive_getstream|ziparchive_locatename|ziparchive_open|ziparchive_renameindex|ziparchive_renamename|ziparchive_setCommentName|ziparchive_setarchivecomment|ziparchive_setcommentindex|ziparchive_statindex|ziparchive_statname|ziparchive_unchangeall|ziparchive_unchangearchive|ziparchive_unchangeindex|ziparchive_unchangename|zlib_get_coding_type\".split(\"|\")),n=i.arrayToMap(\"abstract|and|array|as|break|case|catch|class|clone|const|continue|declare|default|do|else|elseif|enddeclare|endfor|endforeach|endif|endswitch|endwhile|extends|final|for|foreach|function|global|goto|if|implements|interface|instanceof|namespace|new|or|private|protected|public|static|switch|throw|try|use|var|while|xor\".split(\"|\")),r=i.arrayToMap(\"die|echo|empty|exit|eval|include|include_once|isset|list|require|require_once|return|print|unset\".split(\"|\")),o=i.arrayToMap(\"true|false|null|__CLASS__|__DIR__|__FILE__|__LINE__|__METHOD__|__FUNCTION__|__NAMESPACE__\".split(\"|\")),u=i.arrayToMap(\"$GLOBALS|$_SERVER|$_GET|$_POST|$_FILES|$_REQUEST|$_SESSION|$_ENV|$_COOKIE|$php_errormsg|$HTTP_RAW_POST_DATA|$http_response_header|$argc|$argv\".split(\"|\")),a=i.arrayToMap(\"key_exists|cairo_matrix_create_scale|cairo_matrix_create_translate|call_user_method|call_user_method_array|com_addref|com_get|com_invoke|com_isenum|com_load|com_release|com_set|connection_timeout|cubrid_load_from_glo|cubrid_new_glo|cubrid_save_to_glo|cubrid_send_glo|define_syslog_variables|dl|ereg|ereg_replace|eregi|eregi_replace|hw_documentattributes|hw_documentbodytag|hw_documentsize|hw_outputdocument|imagedashedline|maxdb_bind_param|maxdb_bind_result|maxdb_client_encoding|maxdb_close_long_data|maxdb_execute|maxdb_fetch|maxdb_get_metadata|maxdb_param_count|maxdb_send_long_data|mcrypt_ecb|mcrypt_generic_end|mime_content_type|mysql_createdb|mysql_dbname|mysql_db_query|mysql_drop_db|mysql_dropdb|mysql_escape_string|mysql_fieldflags|mysql_fieldflags|mysql_fieldname|mysql_fieldtable|mysql_fieldtype|mysql_freeresult|mysql_listdbs|mysql_list_fields|mysql_listfields|mysql_list_tables|mysql_listtables|mysql_numfields|mysql_numrows|mysql_selectdb|mysql_tablename|mysqli_bind_param|mysqli_bind_result|mysqli_disable_reads_from_master|mysqli_disable_rpl_parse|mysqli_enable_reads_from_master|mysqli_enable_rpl_parse|mysqli_execute|mysqli_fetch|mysqli_get_metadata|mysqli_master_query|mysqli_param_count|mysqli_rpl_parse_enabled|mysqli_rpl_probe|mysqli_rpl_query_type|mysqli_send_long_data|mysqli_send_query|mysqli_slave_query|ocibindbyname|ocicancel|ocicloselob|ocicollappend|ocicollassign|ocicollassignelem|ocicollgetelem|ocicollmax|ocicollsize|ocicolltrim|ocicolumnisnull|ocicolumnname|ocicolumnprecision|ocicolumnscale|ocicolumnsize|ocicolumntype|ocicolumntyperaw|ocicommit|ocidefinebyname|ocierror|ociexecute|ocifetch|ocifetchinto|ocifetchstatement|ocifreecollection|ocifreecursor|ocifreedesc|ocifreestatement|ociinternaldebug|ociloadlob|ocilogoff|ocilogon|ocinewcollection|ocinewcursor|ocinewdescriptor|ocinlogon|ocinumcols|ociparse|ociplogon|ociresult|ocirollback|ocirowcount|ocisavelob|ocisavelobfile|ociserverversion|ocisetprefetch|ocistatementtype|ociwritelobtofile|ociwritetemporarylob|PDF_add_annotation|PDF_add_bookmark|PDF_add_launchlink|PDF_add_locallink|PDF_add_note|PDF_add_outline|PDF_add_pdflink|PDF_add_weblink|PDF_attach_file|PDF_begin_page|PDF_begin_template|PDF_close_pdi|PDF_close|PDF_findfont|PDF_get_font|PDF_get_fontname|PDF_get_fontsize|PDF_get_image_height|PDF_get_image_width|PDF_get_majorversion|PDF_get_minorversion|PDF_get_pdi_parameter|PDF_get_pdi_value|PDF_open_ccitt|PDF_open_file|PDF_open_gif|PDF_open_image_file|PDF_open_image|PDF_open_jpeg|PDF_open_pdi|PDF_open_tiff|PDF_place_image|PDF_place_pdi_page|PDF_set_border_color|PDF_set_border_dash|PDF_set_border_style|PDF_set_char_spacing|PDF_set_duration|PDF_set_horiz_scaling|PDF_set_info_author|PDF_set_info_creator|PDF_set_info_keywords|PDF_set_info_subject|PDF_set_info_title|PDF_set_leading|PDF_set_text_matrix|PDF_set_text_rendering|PDF_set_text_rise|PDF_set_word_spacing|PDF_setgray_fill|PDF_setgray_stroke|PDF_setgray|PDF_setpolydash|PDF_setrgbcolor_fill|PDF_setrgbcolor_stroke|PDF_setrgbcolor|PDF_show_boxed|php_check_syntax|px_set_tablename|px_set_targetencoding|runkit_sandbox_output_handler|session_is_registered|session_register|session_unregisterset_magic_quotes_runtime|magic_quotes_runtime|set_socket_blocking|socket_set_blocking|set_socket_timeout|socket_set_timeout|split|spliti|sql_regcase\".split(\"|\")),f=i.arrayToMap(\"cfunction|old_function\".split(\"|\")),l=i.arrayToMap([]);this.$rules={start:[{token:\"comment\",regex:/(?:#|\\/\\/)(?:[^?]|\\?[^>])*/},e.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/][gimy]*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'\"',next:\"qqstring\"},{token:\"string\",regex:\"'\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language\",regex:\"\\\\b(?:DEFAULT_INCLUDE_PATH|E_(?:ALL|CO(?:MPILE_(?:ERROR|WARNING)|RE_(?:ERROR|WARNING))|ERROR|NOTICE|PARSE|STRICT|USER_(?:ERROR|NOTICE|WARNING)|WARNING)|P(?:EAR_(?:EXTENSION_DIR|INSTALL_DIR)|HP_(?:BINDIR|CONFIG_FILE_(?:PATH|SCAN_DIR)|DATADIR|E(?:OL|XTENSION_DIR)|INT_(?:MAX|SIZE)|L(?:IBDIR|OCALSTATEDIR)|O(?:S|UTPUT_HANDLER_(?:CONT|END|START))|PREFIX|S(?:API|HLIB_SUFFIX|YSCONFDIR)|VERSION))|__COMPILER_HALT_OFFSET__)\\\\b\"},{token:[\"keyword\",\"text\",\"support.class\"],regex:\"\\\\b(new)(\\\\s+)(\\\\w+)\"},{token:[\"support.class\",\"keyword.operator\"],regex:\"\\\\b(\\\\w+)(::)\"},{token:\"constant.language\",regex:\"\\\\b(?:A(?:B(?:DAY_(?:1|2|3|4|5|6|7)|MON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9))|LT_DIGITS|M_STR|SSERT_(?:ACTIVE|BAIL|CALLBACK|QUIET_EVAL|WARNING))|C(?:ASE_(?:LOWER|UPPER)|HAR_MAX|O(?:DESET|NNECTION_(?:ABORTED|NORMAL|TIMEOUT)|UNT_(?:NORMAL|RECURSIVE))|R(?:EDITS_(?:ALL|DOCS|FULLPAGE|G(?:ENERAL|ROUP)|MODULES|QA|SAPI)|NCYSTR|YPT_(?:BLOWFISH|EXT_DES|MD5|S(?:ALT_LENGTH|TD_DES)))|URRENCY_SYMBOL)|D(?:AY_(?:1|2|3|4|5|6|7)|ECIMAL_POINT|IRECTORY_SEPARATOR|_(?:FMT|T_FMT))|E(?:NT_(?:COMPAT|NOQUOTES|QUOTES)|RA(?:_(?:D_(?:FMT|T_FMT)|T_FMT|YEAR)|)|XTR_(?:IF_EXISTS|OVERWRITE|PREFIX_(?:ALL|I(?:F_EXISTS|NVALID)|SAME)|SKIP))|FRAC_DIGITS|GROUPING|HTML_(?:ENTITIES|SPECIALCHARS)|IN(?:FO_(?:ALL|C(?:ONFIGURATION|REDITS)|ENVIRONMENT|GENERAL|LICENSE|MODULES|VARIABLES)|I_(?:ALL|PERDIR|SYSTEM|USER)|T_(?:CURR_SYMBOL|FRAC_DIGITS))|L(?:C_(?:ALL|C(?:OLLATE|TYPE)|M(?:ESSAGES|ONETARY)|NUMERIC|TIME)|O(?:CK_(?:EX|NB|SH|UN)|G_(?:A(?:LERT|UTH(?:PRIV|))|C(?:ONS|R(?:IT|ON))|D(?:AEMON|EBUG)|E(?:MERG|RR)|INFO|KERN|L(?:OCAL(?:0|1|2|3|4|5|6|7)|PR)|MAIL|N(?:DELAY|EWS|O(?:TICE|WAIT))|ODELAY|P(?:ERROR|ID)|SYSLOG|U(?:SER|UCP)|WARNING)))|M(?:ON_(?:1(?:0|1|2|)|2|3|4|5|6|7|8|9|DECIMAL_POINT|GROUPING|THOUSANDS_SEP)|_(?:1_PI|2_(?:PI|SQRTPI)|E|L(?:N(?:10|2)|OG(?:10E|2E))|PI(?:_(?:2|4)|)|SQRT(?:1_2|2)))|N(?:EGATIVE_SIGN|O(?:EXPR|STR)|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|P(?:ATH(?:INFO_(?:BASENAME|DIRNAME|EXTENSION)|_SEPARATOR)|M_STR|OSITIVE_SIGN|_(?:CS_PRECEDES|S(?:EP_BY_SPACE|IGN_POSN)))|RADIXCHAR|S(?:EEK_(?:CUR|END|SET)|ORT_(?:ASC|DESC|NUMERIC|REGULAR|STRING)|TR_PAD_(?:BOTH|LEFT|RIGHT))|T(?:HOUS(?:ANDS_SEP|EP)|_FMT(?:_AMPM|))|YES(?:EXPR|STR)|STD(?:IN|OUT|ERR))\\\\b\"},{token:function(e){return n.hasOwnProperty(e)?\"keyword\":o.hasOwnProperty(e)?\"constant.language\":u.hasOwnProperty(e)?\"variable.language\":l.hasOwnProperty(e)?\"invalid.illegal\":t.hasOwnProperty(e)?\"support.function\":e==\"debugger\"?\"invalid.deprecated\":e.match(/^(\\$[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*|self|parent)$/)?\"variable\":\"identifier\"},regex:/[a-zA-Z_$\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*/},{onMatch:function(e,t,n){e=e.substr(3);if(e[0]==\"'\"||e[0]=='\"')e=e.slice(1,-1);return n.unshift(this.next,e),\"markup.list\"},regex:/<<<(?:\\w+|'\\w+'|\"\\w+\")$/,next:\"heredoc\"},{token:\"keyword.operator\",regex:\"::|!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|!=|!==|<=|>=|=>|<<=|>>=|>>>=|<>|<|>|=|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],heredoc:[{onMatch:function(e,t,n){return n[1]!=e?\"string\":(n.shift(),n.shift(),\"markup.list\")},regex:\"^\\\\w+(?=;?$)\",next:\"start\"},{token:\"string\",regex:\".*\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"constant.language.escape\",regex:'\\\\\\\\(?:[nrtvef\\\\\\\\\"$]|[0-7]{1,3}|x[0-9A-Fa-f]{1,2})'},{token:\"constant.language.escape\",regex:/\\$[\\w]+(?:\\[[\\w\\]+]|=>\\w+)?/},{token:\"constant.language.escape\",regex:/\\$\\{[^\"\\}]+\\}?/},{token:\"string\",regex:'\"',next:\"start\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:/\\\\['\\\\]/},{token:\"string\",regex:\"'\",next:\"start\"},{defaultToken:\"string\"}]},this.embedRules(s,\"doc-\",[s.getEndRule(\"start\")])};r.inherits(a,o);var f=function(){u.call(this);var e=[{token:\"support.php_tag\",regex:\"<\\\\?(?:php|=)?\",push:\"php-start\"}],t=[{token:\"support.php_tag\",regex:\"\\\\?>\",next:\"pop\"}];for(var n in this.$rules)this.$rules[n].unshift.apply(this.$rules[n],e);this.embedRules(a,\"php-\",t,[\"start\"]),this.normalizeRules()};r.inherits(f,u),t.PhpHighlightRules=f,t.PhpLangHighlightRules=a}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-plain_text.js",
    "content": "define(\"ace/mode/plain_text\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/behaviour\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./behaviour\").Behaviour,u=function(){this.HighlightRules=s,this.$behaviour=new o};r.inherits(u,i),function(){this.type=\"text\",this.getNextLineIndent=function(e,t,n){return\"\"},this.$id=\"ace/mode/plain_text\"}.call(u.prototype),t.Mode=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-powershell.js",
    "content": "define(\"ace/mode/powershell\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/powershell_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./powershell_highlight_rules\").PowershellHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a({start:\"^\\\\s*(<#)\",end:\"^[#\\\\s]>\\\\s*$\"})};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.blockComment={start:\"<#\",end:\"#>\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){return null},this.$id=\"ace/mode/powershell\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/powershell_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"function|if|else|elseif|switch|while|default|for|do|until|break|continue|foreach|return|filter|in|trap|throw|param|begin|process|end\",t=\"Get-Alias|Import-Alias|New-Alias|Set-Alias|Get-AuthenticodeSignature|Set-AuthenticodeSignature|Set-Location|Get-ChildItem|Clear-Item|Get-Command|Measure-Command|Trace-Command|Add-Computer|Checkpoint-Computer|Remove-Computer|Restart-Computer|Restore-Computer|Stop-Computer|Reset-ComputerMachinePassword|Test-ComputerSecureChannel|Add-Content|Get-Content|Set-Content|Clear-Content|Get-Command|Invoke-Command|Enable-ComputerRestore|Disable-ComputerRestore|Get-ComputerRestorePoint|Test-Connection|ConvertFrom-CSV|ConvertTo-CSV|ConvertTo-Html|ConvertTo-Xml|ConvertFrom-SecureString|ConvertTo-SecureString|Copy-Item|Export-Counter|Get-Counter|Import-Counter|Get-Credential|Get-Culture|Get-ChildItem|Get-Date|Set-Date|Remove-Item|Compare-Object|Get-Event|Get-WinEvent|New-Event|Remove-Event|Unregister-Event|Wait-Event|Clear-EventLog|Get-Eventlog|Limit-EventLog|New-Eventlog|Remove-EventLog|Show-EventLog|Write-EventLog|Get-EventSubscriber|Register-EngineEvent|Register-ObjectEvent|Register-WmiEvent|Get-ExecutionPolicy|Set-ExecutionPolicy|Export-Alias|Export-Clixml|Export-Console|Export-Csv|ForEach-Object|Format-Custom|Format-List|Format-Table|Format-Wide|Export-FormatData|Get-FormatData|Get-Item|Get-ChildItem|Get-Help|Add-History|Clear-History|Get-History|Invoke-History|Get-Host|Read-Host|Write-Host|Get-HotFix|Import-Clixml|Import-Csv|Invoke-Command|Invoke-Expression|Get-Item|Invoke-Item|New-Item|Remove-Item|Set-Item|Clear-ItemProperty|Copy-ItemProperty|Get-ItemProperty|Move-ItemProperty|New-ItemProperty|Remove-ItemProperty|Rename-ItemProperty|Set-ItemProperty|Get-Job|Receive-Job|Remove-Job|Start-Job|Stop-Job|Wait-Job|Stop-Process|Update-List|Get-Location|Pop-Location|Push-Location|Set-Location|Send-MailMessage|Add-Member|Get-Member|Move-Item|Compare-Object|Group-Object|Measure-Object|New-Object|Select-Object|Sort-Object|Where-Object|Out-Default|Out-File|Out-GridView|Out-Host|Out-Null|Out-Printer|Out-String|Convert-Path|Join-Path|Resolve-Path|Split-Path|Test-Path|Get-Pfxcertificate|Pop-Location|Push-Location|Get-Process|Start-Process|Stop-Process|Wait-Process|Enable-PSBreakpoint|Disable-PSBreakpoint|Get-PSBreakpoint|Set-PSBreakpoint|Remove-PSBreakpoint|Get-PSDrive|New-PSDrive|Remove-PSDrive|Get-PSProvider|Set-PSdebug|Enter-PSSession|Exit-PSSession|Export-PSSession|Get-PSSession|Import-PSSession|New-PSSession|Remove-PSSession|Disable-PSSessionConfiguration|Enable-PSSessionConfiguration|Get-PSSessionConfiguration|Register-PSSessionConfiguration|Set-PSSessionConfiguration|Unregister-PSSessionConfiguration|New-PSSessionOption|Add-PsSnapIn|Get-PsSnapin|Remove-PSSnapin|Get-Random|Read-Host|Remove-Item|Rename-Item|Rename-ItemProperty|Select-Object|Select-XML|Send-MailMessage|Get-Service|New-Service|Restart-Service|Resume-Service|Set-Service|Start-Service|Stop-Service|Suspend-Service|Sort-Object|Start-Sleep|ConvertFrom-StringData|Select-String|Tee-Object|New-Timespan|Trace-Command|Get-Tracesource|Set-Tracesource|Start-Transaction|Complete-Transaction|Get-Transaction|Use-Transaction|Undo-Transaction|Start-Transcript|Stop-Transcript|Add-Type|Update-TypeData|Get-Uiculture|Get-Unique|Update-Formatdata|Update-Typedata|Clear-Variable|Get-Variable|New-Variable|Remove-Variable|Set-Variable|New-WebServiceProxy|Where-Object|Write-Debug|Write-Error|Write-Host|Write-Output|Write-Progress|Write-Verbose|Write-Warning|Set-WmiInstance|Invoke-WmiMethod|Get-WmiObject|Remove-WmiObject|Connect-WSMan|Disconnect-WSMan|Test-WSMan|Invoke-WSManAction|Disable-WSManCredSSP|Enable-WSManCredSSP|Get-WSManCredSSP|New-WSManInstance|Get-WSManInstance|Set-WSManInstance|Remove-WSManInstance|Set-WSManQuickConfig|New-WSManSessionOption\",n=this.createKeywordMapper({\"support.function\":t,keyword:e},\"identifier\"),r=\"eq|ne|ge|gt|lt|le|like|notlike|match|notmatch|replace|contains|notcontains|ieq|ine|ige|igt|ile|ilt|ilike|inotlike|imatch|inotmatch|ireplace|icontains|inotcontains|is|isnot|as|and|or|band|bor|not\";this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"comment.start\",regex:\"<#\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"[$](?:[Tt]rue|[Ff]alse)\\\\b\"},{token:\"constant.language\",regex:\"[$][Nn]ull\\\\b\"},{token:\"variable.instance\",regex:\"[$][a-zA-Z][a-zA-Z0-9_]*\\\\b\"},{token:n,regex:\"[a-zA-Z_$][a-zA-Z0-9_$\\\\-]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\-(?:\"+r+\")\"},{token:\"keyword.operator\",regex:\"&|\\\\*|\\\\+|\\\\-|\\\\=|\\\\+=|\\\\-=\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment.end\",regex:\"#>\",next:\"start\"},{token:\"doc.comment.tag\",regex:\"^\\\\.\\\\w+\"},{token:\"comment\",regex:\"\\\\w+\"},{token:\"comment\",regex:\".\"}]}};r.inherits(s,i),t.PowershellHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-prolog.js",
    "content": "define(\"ace/mode/prolog\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/prolog_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./prolog_highlight_rules\").PrologHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"%\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/prolog\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/prolog_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{include:\"#comment\"},{include:\"#basic_fact\"},{include:\"#rule\"},{include:\"#directive\"},{include:\"#fact\"}],\"#atom\":[{token:\"constant.other.atom.prolog\",regex:\"\\\\b[a-z][a-zA-Z0-9_]*\\\\b\"},{token:\"constant.numeric.prolog\",regex:\"-?\\\\d+(?:\\\\.\\\\d+)?\"},{include:\"#string\"}],\"#basic_elem\":[{include:\"#comment\"},{include:\"#statement\"},{include:\"#constants\"},{include:\"#operators\"},{include:\"#builtins\"},{include:\"#list\"},{include:\"#atom\"},{include:\"#variable\"}],\"#basic_fact\":[{token:[\"entity.name.function.fact.basic.prolog\",\"punctuation.end.fact.basic.prolog\"],regex:\"([a-z]\\\\w*)(\\\\.)\"}],\"#builtins\":[{token:\"support.function.builtin.prolog\",regex:\"\\\\b(?:abolish|abort|ancestors|arg|ascii|assert[az]|atom(?:ic)?|body|char|close|conc|concat|consult|define|definition|dynamic|dump|fail|file|free|free_proc|functor|getc|goal|halt|head|head|integer|length|listing|match_args|member|next_clause|nl|nonvar|nth|number|cvars|nvars|offset|op|print?|prompt|putc|quoted|ratom|read|redefine|rename|retract(?:all)?|see|seeing|seen|skip|spy|statistics|system|tab|tell|telling|term|time|told|univ|unlink_clause|unspy_predicate|var|write)\\\\b\"}],\"#comment\":[{token:[\"punctuation.definition.comment.prolog\",\"comment.line.percentage.prolog\"],regex:\"(%)(.*$)\"},{token:\"punctuation.definition.comment.prolog\",regex:\"/\\\\*\",push:[{token:\"punctuation.definition.comment.prolog\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.prolog\"}]}],\"#constants\":[{token:\"constant.language.prolog\",regex:\"\\\\b(?:true|false|yes|no)\\\\b\"}],\"#directive\":[{token:\"keyword.operator.directive.prolog\",regex:\":-\",push:[{token:\"meta.directive.prolog\",regex:\"\\\\.\",next:\"pop\"},{include:\"#comment\"},{include:\"#statement\"},{defaultToken:\"meta.directive.prolog\"}]}],\"#expr\":[{include:\"#comments\"},{token:\"meta.expression.prolog\",regex:\"\\\\(\",push:[{token:\"meta.expression.prolog\",regex:\"\\\\)\",next:\"pop\"},{include:\"#expr\"},{defaultToken:\"meta.expression.prolog\"}]},{token:\"keyword.control.cutoff.prolog\",regex:\"!\"},{token:\"punctuation.control.and.prolog\",regex:\",\"},{token:\"punctuation.control.or.prolog\",regex:\";\"},{include:\"#basic_elem\"}],\"#fact\":[{token:[\"entity.name.function.fact.prolog\",\"punctuation.begin.fact.parameters.prolog\"],regex:\"([a-z]\\\\w*)(\\\\()(?!.*:-)\",push:[{token:[\"punctuation.end.fact.parameters.prolog\",\"punctuation.end.fact.prolog\"],regex:\"(\\\\))(\\\\.?)\",next:\"pop\"},{include:\"#parameter\"},{defaultToken:\"meta.fact.prolog\"}]}],\"#list\":[{token:\"punctuation.begin.list.prolog\",regex:\"\\\\[(?=.*\\\\])\",push:[{token:\"punctuation.end.list.prolog\",regex:\"\\\\]\",next:\"pop\"},{include:\"#comment\"},{token:\"punctuation.separator.list.prolog\",regex:\",\"},{token:\"punctuation.concat.list.prolog\",regex:\"\\\\|\",push:[{token:\"meta.list.concat.prolog\",regex:\"(?=\\\\s*\\\\])\",next:\"pop\"},{include:\"#basic_elem\"},{defaultToken:\"meta.list.concat.prolog\"}]},{include:\"#basic_elem\"},{defaultToken:\"meta.list.prolog\"}]}],\"#operators\":[{token:\"keyword.operator.prolog\",regex:\"\\\\\\\\\\\\+|\\\\bnot\\\\b|\\\\bis\\\\b|->|[><]|[><\\\\\\\\:=]?=|(?:=\\\\\\\\|\\\\\\\\=)=\"}],\"#parameter\":[{token:\"variable.language.anonymous.prolog\",regex:\"\\\\b_\\\\b\"},{token:\"variable.parameter.prolog\",regex:\"\\\\b[A-Z_]\\\\w*\\\\b\"},{token:\"punctuation.separator.parameters.prolog\",regex:\",\"},{include:\"#basic_elem\"},{token:\"text\",regex:\"[^\\\\s]\"}],\"#rule\":[{token:\"meta.rule.prolog\",regex:\"(?=[a-z]\\\\w*.*:-)\",push:[{token:\"punctuation.rule.end.prolog\",regex:\"\\\\.\",next:\"pop\"},{token:\"meta.rule.signature.prolog\",regex:\"(?=[a-z]\\\\w*.*:-)\",push:[{token:\"meta.rule.signature.prolog\",regex:\"(?=:-)\",next:\"pop\"},{token:\"entity.name.function.rule.prolog\",regex:\"[a-z]\\\\w*(?=\\\\(|\\\\s*:-)\"},{token:\"punctuation.rule.parameters.begin.prolog\",regex:\"\\\\(\",push:[{token:\"punctuation.rule.parameters.end.prolog\",regex:\"\\\\)\",next:\"pop\"},{include:\"#parameter\"},{defaultToken:\"meta.rule.parameters.prolog\"}]},{defaultToken:\"meta.rule.signature.prolog\"}]},{token:\"keyword.operator.definition.prolog\",regex:\":-\",push:[{token:\"meta.rule.definition.prolog\",regex:\"(?=\\\\.)\",next:\"pop\"},{include:\"#comment\"},{include:\"#expr\"},{defaultToken:\"meta.rule.definition.prolog\"}]},{defaultToken:\"meta.rule.prolog\"}]}],\"#statement\":[{token:\"meta.statement.prolog\",regex:\"(?=[a-z]\\\\w*\\\\()\",push:[{token:\"punctuation.end.statement.parameters.prolog\",regex:\"\\\\)\",next:\"pop\"},{include:\"#builtins\"},{include:\"#atom\"},{token:\"punctuation.begin.statement.parameters.prolog\",regex:\"\\\\(\",push:[{token:\"meta.statement.parameters.prolog\",regex:\"(?=\\\\))\",next:\"pop\"},{token:\"punctuation.separator.statement.prolog\",regex:\",\"},{include:\"#basic_elem\"},{defaultToken:\"meta.statement.parameters.prolog\"}]},{defaultToken:\"meta.statement.prolog\"}]}],\"#string\":[{token:\"punctuation.definition.string.begin.prolog\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.prolog\",regex:\"'\",next:\"pop\"},{token:\"constant.character.escape.prolog\",regex:\"\\\\\\\\.\"},{token:\"constant.character.escape.quote.prolog\",regex:\"''\"},{defaultToken:\"string.quoted.single.prolog\"}]}],\"#variable\":[{token:\"variable.language.anonymous.prolog\",regex:\"\\\\b_\\\\b\"},{token:\"variable.other.prolog\",regex:\"\\\\b[A-Z_][a-zA-Z0-9_]*\\\\b\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"plg\",\"prolog\"],foldingStartMarker:\"(%\\\\s*region \\\\w*)|([a-z]\\\\w*.*:- ?)\",foldingStopMarker:\"(%\\\\s*end(\\\\s*region)?)|(?=\\\\.)\",keyEquivalent:\"^~P\",name:\"Prolog\",scopeName:\"source.prolog\"},r.inherits(s,i),t.PrologHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-properties.js",
    "content": "define(\"ace/mode/properties\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/properties_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./properties_highlight_rules\").PropertiesHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.$id=\"ace/mode/properties\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/properties_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=/\\\\u[0-9a-fA-F]{4}|\\\\/;this.$rules={start:[{token:\"comment\",regex:/[!#].*$/},{token:\"keyword\",regex:/[=:]$/},{token:\"keyword\",regex:/[=:]/,next:\"value\"},{token:\"constant.language.escape\",regex:e},{defaultToken:\"variable\"}],value:[{regex:/\\\\$/,token:\"string\",next:\"value\"},{regex:/$/,token:\"string\",next:\"start\"},{token:\"constant.language.escape\",regex:e},{defaultToken:\"string\"}]}};r.inherits(s,i),t.PropertiesHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-protobuf.js",
    "content": "define(\"ace/mode/protobuf\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/c_cpp\",\"ace/mode/protobuf_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./c_cpp\").Mode,s=e(\"./protobuf_highlight_rules\").ProtobufHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){i.call(this),this.foldingRules=new o,this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/protobuf\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/c_cpp\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/c_cpp_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./c_cpp_highlight_rules\").c_cppHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/c_cpp\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/c_cpp_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.cFunctions=\"\\\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\\\b\",u=function(){var e=\"break|case|continue|default|do|else|for|goto|if|_Pragma|return|switch|while|catch|operator|try|throw|using\",t=\"asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|class|wchar_t|template\",n=\"const|extern|register|restrict|static|volatile|inline|private:|protected:|public:|friend|explicit|virtual|export|mutable|typename\",r=\"and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eqconst_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace\",s=\"NULL|true|false|TRUE|FALSE\",u=this.$keywords=this.createKeywordMapper({\"keyword.control\":e,\"storage.type\":t,\"storage.modifier\":n,\"keyword.operator\":r,\"variable.language\":\"this\",\"constant.language\":s},\"identifier\"),a=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Zd\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\\\b\"},{token:\"keyword\",regex:\"#\\\\s*(?:include|import|pragma|line|define|undef|if|ifdef|else|elif|ifndef)\\\\b\",next:\"directive\"},{token:\"keyword\",regex:\"(?:#\\\\s*endif)\\\\b\"},{token:\"support.function.C99.c\",regex:o},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"punctuation.operator\",regex:\"\\\\?|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}],directive:[{token:\"constant.other.multiline\",regex:/\\\\/},{token:\"constant.other.multiline\",regex:/.*\\\\/},{token:\"constant.other\",regex:\"\\\\s*<.+?>\",next:\"start\"},{token:\"constant.other\",regex:'\\\\s*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]',next:\"start\"},{token:\"constant.other\",regex:\"\\\\s*['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\",next:\"start\"},{token:\"constant.other\",regex:/[^\\\\\\/]+/,next:\"start\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(u,s),t.c_cppHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/protobuf_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"double|float|int32|int64|uint32|uint64|sint32|sint64|fixed32|fixed64|sfixed32|sfixed64|bool|string|bytes\",t=\"message|required|optional|repeated|package|import|option|enum\",n=this.createKeywordMapper({\"keyword.declaration.protobuf\":t,\"support.type\":e},\"identifier\");this.$rules={start:[{token:\"comment\",regex:/\\/\\/.*$/},{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"constant\",regex:\"<[^>]+>\"},{regex:\"=\",token:\"keyword.operator.assignment.protobuf\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:n,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.normalizeRules()};r.inherits(s,i),t.ProtobufHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-python.js",
    "content": "define(\"ace/mode/python\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/python_highlight_rules\",\"ace/mode/folding/pythonic\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./python_highlight_rules\").PythonHighlightRules,o=e(\"./folding/pythonic\").FoldMode,u=e(\"../range\").Range,a=function(){this.HighlightRules=s,this.foldingRules=new o(\"\\\\:\")};r.inherits(a,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);o&&(r+=n)}return r};var e={pass:1,\"return\":1,raise:1,\"break\":1,\"continue\":1};this.checkOutdent=function(t,n,r){if(r!==\"\\r\\n\"&&r!==\"\\r\"&&r!==\"\\n\")return!1;var i=this.getTokenizer().getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type==\"comment\"||s.type==\"text\"&&s.value.match(/^\\s+$/)));return s?s.type==\"keyword\"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new u(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/python\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/python_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"and|as|assert|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|not|or|pass|print|raise|return|try|while|with|yield\",t=\"True|False|None|NotImplemented|Ellipsis|__debug__\",n=\"abs|divmod|input|open|staticmethod|all|enumerate|int|ord|str|any|eval|isinstance|pow|sum|basestring|execfile|issubclass|print|super|binfile|iter|property|tuple|bool|filter|len|range|type|bytearray|float|list|raw_input|unichr|callable|format|locals|reduce|unicode|chr|frozenset|long|reload|vars|classmethod|getattr|map|repr|xrange|cmp|globals|max|reversed|zip|compile|hasattr|memoryview|round|__import__|complex|hash|min|set|apply|delattr|help|next|setattr|buffer|dict|hex|object|slice|coerce|dir|id|oct|sorted|intern\",r=this.createKeywordMapper({\"invalid.deprecated\":\"debugger\",\"support.function\":n,\"constant.language\":t,keyword:e},\"identifier\"),i=\"(?:r|u|ur|R|U|UR|Ur|uR)?\",s=\"(?:(?:[1-9]\\\\d*)|(?:0))\",o=\"(?:0[oO]?[0-7]+)\",u=\"(?:0[xX][\\\\dA-Fa-f]+)\",a=\"(?:0[bB][01]+)\",f=\"(?:\"+s+\"|\"+o+\"|\"+u+\"|\"+a+\")\",l=\"(?:[eE][+-]?\\\\d+)\",c=\"(?:\\\\.\\\\d+)\",h=\"(?:\\\\d+)\",p=\"(?:(?:\"+h+\"?\"+c+\")|(?:\"+h+\"\\\\.))\",d=\"(?:(?:\"+p+\"|\"+h+\")\"+l+\")\",v=\"(?:\"+d+\"|\"+p+\")\",m=\"\\\\\\\\(x[0-9A-Fa-f]{2}|[0-7]{3}|[\\\\\\\\abfnrtv'\\\"]|U[0-9A-Fa-f]{8}|u[0-9A-Fa-f]{4})\";this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"string\",regex:i+'\"{3}',next:\"qqstring3\"},{token:\"string\",regex:i+'\"(?=.)',next:\"qqstring\"},{token:\"string\",regex:i+\"'{3}\",next:\"qstring3\"},{token:\"string\",regex:i+\"'(?=.)\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"(?:\"+v+\"|\\\\d+)[jJ]\\\\b\"},{token:\"constant.numeric\",regex:v},{token:\"constant.numeric\",regex:f+\"[lL]\\\\b\"},{token:\"constant.numeric\",regex:f+\"\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|%|<<|>>|&|\\\\||\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring3:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:'\"{3}',next:\"start\"},{defaultToken:\"string\"}],qstring3:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"'{3}\",next:\"start\"},{defaultToken:\"string\"}],qqstring:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"start\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:m},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"start\"},{defaultToken:\"string\"}]}};r.inherits(s,i),t.PythonHighlightRules=s}),define(\"ace/mode/folding/pythonic\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e){this.foldingStartMarker=new RegExp(\"([\\\\[{])(?:\\\\s*)$|(\"+e+\")(?:\\\\s*)(?:#.*)?$\")};r.inherits(s,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=e.getLine(n),i=r.match(this.foldingStartMarker);if(i)return i[1]?this.openingBracketBlock(e,i[1],n,i.index):i[2]?this.indentationBlock(e,n,i.index+i[2].length):this.indentationBlock(e,n)}}.call(s.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-r.js",
    "content": "define(\"ace/mode/r\",[\"require\",\"exports\",\"module\",\"ace/range\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/r_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/unicode\"],function(e,t,n){var r=e(\"../range\").Range,i=e(\"../lib/oop\"),s=e(\"./text\").Mode,o=e(\"./text_highlight_rules\").TextHighlightRules,u=e(\"./r_highlight_rules\").RHighlightRules,a=e(\"./matching_brace_outdent\").MatchingBraceOutdent,f=e(\"../unicode\"),l=function(){this.HighlightRules=u,this.$outdent=new a};i.inherits(l,s),function(){this.lineCommentStart=\"#\",this.$id=\"ace/mode/r\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/r_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/tex_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./tex_highlight_rules\").TexHighlightRules,u=function(){var e=i.arrayToMap(\"function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass\".split(\"|\")),t=i.arrayToMap(\"NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|NA_complex_\".split(\"|\"));this.$rules={start:[{token:\"comment.sectionhead\",regex:\"#+(?!').*(?:----|====|####)\\\\s*$\"},{token:\"comment\",regex:\"#+'\",next:\"rd-start\"},{token:\"comment\",regex:\"#.*$\"},{token:\"string\",regex:'[\"]',next:\"qqstring\"},{token:\"string\",regex:\"[']\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+[Li]?\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\d+L\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\d+(?:\\\\.\\\\d*)?(?:[eE][+\\\\-]?\\\\d*)?i?\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\.\\\\d+(?:[eE][+\\\\-]?\\\\d*)?i?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:TRUE|FALSE|T|F)\\\\b\"},{token:\"identifier\",regex:\"`.*?`\"},{onMatch:function(n){return e[n]?\"keyword\":t[n]?\"constant.language\":n==\"...\"||n.match(/^\\.\\.\\d+$/)?\"variable.language\":\"identifier\"},regex:\"[a-zA-Z.][a-zA-Z0-9._]*\\\\b\"},{token:\"keyword.operator\",regex:\"%%|>=|<=|==|!=|\\\\->|<\\\\-|\\\\|\\\\||&&|=|\\\\+|\\\\-|\\\\*|/|\\\\^|>|<|!|&|\\\\||~|\\\\$|:\"},{token:\"keyword.operator\",regex:\"%.*?%\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]};var n=(new o(\"comment\")).getRules();for(var r=0;r<n.start.length;r++)n.start[r].token+=\".virtual-comment\";this.addRules(n,\"rd-\"),this.$rules[\"rd-start\"].unshift({token:\"text\",regex:\"^\",next:\"start\"}),this.$rules[\"rd-start\"].unshift({token:\"keyword\",regex:\"@(?!@)[^ ]*\"}),this.$rules[\"rd-start\"].unshift({token:\"comment\",regex:\"@@\"}),this.$rules[\"rd-start\"].push({token:\"comment\",regex:\"[^%\\\\\\\\[({\\\\])}]+\"})};r.inherits(u,s),t.RHighlightRules=u}),define(\"ace/mode/tex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(e){e||(e=\"text\"),this.$rules={start:[{token:\"comment\",regex:\"%.*$\"},{token:e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\",next:\"nospell\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:e,regex:\"\\\\s+\"}],nospell:[{token:\"comment\",regex:\"%.*$\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\",next:\"start\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])]\"},{token:\"paren.keyword.operator\",regex:\"}\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\s+\"},{token:\"nospell.\"+e,regex:\"\\\\w+\"}]}};r.inherits(o,s),t.TexHighlightRules=o}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-rdoc.js",
    "content": "define(\"ace/mode/rdoc\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/rdoc_highlight_rules\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./rdoc_highlight_rules\").RDocHighlightRules,u=e(\"./matching_brace_outdent\").MatchingBraceOutdent,a=function(e){this.HighlightRules=o,this.$outdent=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.$id=\"ace/mode/rdoc\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/rdoc_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/latex_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./latex_highlight_rules\"),u=function(){this.$rules={start:[{token:\"comment\",regex:\"%.*$\"},{token:\"text\",regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\\\b\",next:\"nospell\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],nospell:[{token:\"comment\",regex:\"%.*$\",next:\"start\"},{token:\"nospell.text\",regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:name|alias|method|S3method|S4method|item|code|preformatted|kbd|pkg|var|env|option|command|author|email|url|source|cite|acronym|href|code|preformatted|link|eqn|deqn|keyword|usage|examples|dontrun|dontshow|figure|if|ifelse|Sexpr|RdOpts|inputencoding|usepackage)\\\\b\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\",next:\"start\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])]\"},{token:\"paren.keyword.operator\",regex:\"}\",next:\"start\"},{token:\"nospell.text\",regex:\"\\\\s+\"},{token:\"nospell.text\",regex:\"\\\\w+\"}]}};r.inherits(u,s),t.RDocHighlightRules=u}),define(\"ace/mode/latex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"keyword\",regex:\"\\\\\\\\(?:[^a-zA-Z]|[a-zA-Z]+)\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"string\",regex:\"\\\\$(?:(?:\\\\\\\\.)|(?:[^\\\\$\\\\\\\\]))*?\\\\$\"},{token:\"comment\",regex:\"%.*$\"}]}};r.inherits(s,i),t.LatexHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-rhtml.js",
    "content": "define(\"ace/mode/rhtml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/rhtml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./rhtml_highlight_rules\").RHtmlHighlightRules,o=function(e,t){i.call(this),this.$session=t,this.HighlightRules=s};r.inherits(o,i),function(){this.insertChunkInfo={value:\"<!--begin.rcode\\n\\nend.rcode-->\\n\",position:{row:0,column:15}},this.getLanguageMode=function(e){return this.$session.getState(e.row).match(/^r-/)?\"R\":\"HTML\"},this.$id=\"ace/mode/rhtml\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/rhtml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/r_highlight_rules\",\"ace/mode/html_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./r_highlight_rules\").RHighlightRules,s=e(\"./html_highlight_rules\").HtmlHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){s.call(this),this.$rules.start.unshift({token:\"support.function.codebegin\",regex:\"^<!--\\\\s*begin.rcode\\\\s*(?:.*)\",next:\"r-start\"}),this.embedRules(i,\"r-\",[{token:\"support.function.codeend\",regex:\"^\\\\s*end.rcode\\\\s*-->\",next:\"start\"}],[\"start\"]),this.normalizeRules()};r.inherits(u,o),t.RHtmlHighlightRules=u}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/r_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/tex_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./tex_highlight_rules\").TexHighlightRules,u=function(){var e=i.arrayToMap(\"function|if|in|break|next|repeat|else|for|return|switch|while|try|tryCatch|stop|warning|require|library|attach|detach|source|setMethod|setGeneric|setGroupGeneric|setClass\".split(\"|\")),t=i.arrayToMap(\"NULL|NA|TRUE|FALSE|T|F|Inf|NaN|NA_integer_|NA_real_|NA_character_|NA_complex_\".split(\"|\"));this.$rules={start:[{token:\"comment.sectionhead\",regex:\"#+(?!').*(?:----|====|####)\\\\s*$\"},{token:\"comment\",regex:\"#+'\",next:\"rd-start\"},{token:\"comment\",regex:\"#.*$\"},{token:\"string\",regex:'[\"]',next:\"qqstring\"},{token:\"string\",regex:\"[']\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+[Li]?\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\d+L\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\d+(?:\\\\.\\\\d*)?(?:[eE][+\\\\-]?\\\\d*)?i?\\\\b\"},{token:\"constant.numeric\",regex:\"\\\\.\\\\d+(?:[eE][+\\\\-]?\\\\d*)?i?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:TRUE|FALSE|T|F)\\\\b\"},{token:\"identifier\",regex:\"`.*?`\"},{onMatch:function(n){return e[n]?\"keyword\":t[n]?\"constant.language\":n==\"...\"||n.match(/^\\.\\.\\d+$/)?\"variable.language\":\"identifier\"},regex:\"[a-zA-Z.][a-zA-Z0-9._]*\\\\b\"},{token:\"keyword.operator\",regex:\"%%|>=|<=|==|!=|\\\\->|<\\\\-|\\\\|\\\\||&&|=|\\\\+|\\\\-|\\\\*|/|\\\\^|>|<|!|&|\\\\||~|\\\\$|:\"},{token:\"keyword.operator\",regex:\"%.*?%\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]};var n=(new o(\"comment\")).getRules();for(var r=0;r<n.start.length;r++)n.start[r].token+=\".virtual-comment\";this.addRules(n,\"rd-\"),this.$rules[\"rd-start\"].unshift({token:\"text\",regex:\"^\",next:\"start\"}),this.$rules[\"rd-start\"].unshift({token:\"keyword\",regex:\"@(?!@)[^ ]*\"}),this.$rules[\"rd-start\"].unshift({token:\"comment\",regex:\"@@\"}),this.$rules[\"rd-start\"].push({token:\"comment\",regex:\"[^%\\\\\\\\[({\\\\])}]+\"})};r.inherits(u,s),t.RHighlightRules=u}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/tex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(e){e||(e=\"text\"),this.$rules={start:[{token:\"comment\",regex:\"%.*$\"},{token:e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\",next:\"nospell\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:e,regex:\"\\\\s+\"}],nospell:[{token:\"comment\",regex:\"%.*$\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\",next:\"start\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])]\"},{token:\"paren.keyword.operator\",regex:\"}\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\s+\"},{token:\"nospell.\"+e,regex:\"\\\\w+\"}]}};r.inherits(o,s),t.TexHighlightRules=o}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-ruby.js",
    "content": "define(\"ace/mode/ruby\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/ruby_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./ruby_highlight_rules\").RubyHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./folding/coffee\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/),u=t.match(/^\\s*(class|def|module)\\s.*$/),a=t.match(/.*do(\\s*|\\s+\\|.*\\|\\s*)$/),f=t.match(/^\\s*(if|else)\\s*/);if(o||u||a||f)r+=n}return r},this.checkOutdent=function(e,t,n){return/^\\s+end$/.test(t+n)||/^\\s+}$/.test(t+n)||/^\\s+else$/.test(t+n)},this.autoOutdent=function(e,t,n){var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new u(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/ruby\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/ruby_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.constantOtherSymbol={token:\"constant.other.symbol.ruby\",regex:\"[:](?:[A-Za-z_]|[@$](?=[a-zA-Z0-9_]))[a-zA-Z0-9_]*[!=?]?\"},o=t.qString={token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},u=t.qqString={token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},a=t.tString={token:\"string\",regex:\"[`](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[`]\"},f=t.constantNumericHex={token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F](?:[0-9a-fA-F]|_(?=[0-9a-fA-F]))*\\\\b\"},l=t.constantNumericFloat={token:\"constant.numeric\",regex:\"[+-]?\\\\d(?:\\\\d|_(?=\\\\d))*(?:(?:\\\\.\\\\d(?:\\\\d|_(?=\\\\d))*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},c=function(){var e=\"abort|Array|assert|assert_equal|assert_not_equal|assert_same|assert_not_same|assert_nil|assert_not_nil|assert_match|assert_no_match|assert_in_delta|assert_throws|assert_raise|assert_nothing_raised|assert_instance_of|assert_kind_of|assert_respond_to|assert_operator|assert_send|assert_difference|assert_no_difference|assert_recognizes|assert_generates|assert_response|assert_redirected_to|assert_template|assert_select|assert_select_email|assert_select_rjs|assert_select_encoded|css_select|at_exit|attr|attr_writer|attr_reader|attr_accessor|attr_accessible|autoload|binding|block_given?|callcc|caller|catch|chomp|chomp!|chop|chop!|defined?|delete_via_redirect|eval|exec|exit|exit!|fail|Float|flunk|follow_redirect!|fork|form_for|form_tag|format|gets|global_variables|gsub|gsub!|get_via_redirect|host!|https?|https!|include|Integer|lambda|link_to|link_to_unless_current|link_to_function|link_to_remote|load|local_variables|loop|open|open_session|p|print|printf|proc|putc|puts|post_via_redirect|put_via_redirect|raise|rand|raw|readline|readlines|redirect?|request_via_redirect|require|scan|select|set_trace_func|sleep|split|sprintf|srand|String|stylesheet_link_tag|syscall|system|sub|sub!|test|throw|trace_var|trap|untrace_var|atan2|cos|exp|frexp|ldexp|log|log10|sin|sqrt|tan|render|javascript_include_tag|csrf_meta_tag|label_tag|text_field_tag|submit_tag|check_box_tag|content_tag|radio_button_tag|text_area_tag|password_field_tag|hidden_field_tag|fields_for|select_tag|options_for_select|options_from_collection_for_select|collection_select|time_zone_select|select_date|select_time|select_datetime|date_select|time_select|datetime_select|select_year|select_month|select_day|select_hour|select_minute|select_second|file_field_tag|file_field|respond_to|skip_before_filter|around_filter|after_filter|verify|protect_from_forgery|rescue_from|helper_method|redirect_to|before_filter|send_data|send_file|validates_presence_of|validates_uniqueness_of|validates_length_of|validates_format_of|validates_acceptance_of|validates_associated|validates_exclusion_of|validates_inclusion_of|validates_numericality_of|validates_with|validates_each|authenticate_or_request_with_http_basic|authenticate_or_request_with_http_digest|filter_parameter_logging|match|get|post|resources|redirect|scope|assert_routing|translate|localize|extract_locale_from_tld|caches_page|expire_page|caches_action|expire_action|cache|expire_fragment|expire_cache_for|observe|cache_sweeper|has_many|has_one|belongs_to|has_and_belongs_to_many\",t=\"alias|and|BEGIN|begin|break|case|class|def|defined|do|else|elsif|END|end|ensure|__FILE__|finally|for|gem|if|in|__LINE__|module|next|not|or|private|protected|public|redo|rescue|retry|return|super|then|undef|unless|until|when|while|yield\",n=\"true|TRUE|false|FALSE|nil|NIL|ARGF|ARGV|DATA|ENV|RUBY_PLATFORM|RUBY_RELEASE_DATE|RUBY_VERSION|STDERR|STDIN|STDOUT|TOPLEVEL_BINDING\",r=\"$DEBUG|$defout|$FILENAME|$LOAD_PATH|$SAFE|$stdin|$stdout|$stderr|$VERBOSE|$!|root_url|flash|session|cookies|params|request|response|logger|self\",i=this.$keywords=this.createKeywordMapper({keyword:t,\"constant.language\":n,\"variable.language\":r,\"support.function\":e,\"invalid.deprecated\":\"debugger\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"comment\",regex:\"^=begin(?:$|\\\\s.*$)\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},o,u,a,{token:\"text\",regex:\"::\"},{token:\"variable.instance\",regex:\"@{1,2}[a-zA-Z_\\\\d]+\"},{token:\"support.class\",regex:\"[A-Z][a-zA-Z_\\\\d]+\"},s,f,l,{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:i,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"punctuation.separator.key-value\",regex:\"=>\"},{stateName:\"heredoc\",onMatch:function(e,t,n){var r=e[2]==\"-\"?\"indentedHeredoc\":\"heredoc\",i=e.split(this.splitRegex);return n.push(r,i[3]),[{type:\"constant\",value:i[1]},{type:\"string\",value:i[2]},{type:\"support.class\",value:i[3]},{type:\"string\",value:i[4]}]},regex:\"(<<-?)(['\\\"`]?)([\\\\w]+)(['\\\"`]?)\",rules:{heredoc:[{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}],indentedHeredoc:[{token:\"string\",regex:\"^ +\"},{onMatch:function(e,t,n){return e===n[1]?(n.shift(),n.shift(),this.next=n[0]||\"start\",\"support.class\"):(this.next=\"\",\"string\")},regex:\".*$\",next:\"start\"}]}},{regex:\"$\",token:\"empty\",next:function(e,t){return t[0]===\"heredoc\"||t[0]===\"indentedHeredoc\"?t[0]:e}},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\"^=end(?:$|\\\\s.*$)\",next:\"start\"},{token:\"comment\",regex:\".+\"}]},this.normalizeRules()};r.inherits(c,i),t.RubyHighlightRules=c}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-rust.js",
    "content": "define(\"ace/mode/rust\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/rust_highlight_rules\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./rust_highlight_rules\").RustHighlightRules,o=e(\"./folding/cstyle\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"/\\\\*\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/rust\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/rust_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"variable.other.source.rust\",regex:\"'[a-zA-Z_][a-zA-Z0-9_]*[^\\\\']\"},{token:\"string.quoted.single.source.rust\",regex:\"'\",push:[{token:\"string.quoted.single.source.rust\",regex:\"'\",next:\"pop\"},{include:\"#rust_escaped_character\"},{defaultToken:\"string.quoted.single.source.rust\"}]},{token:\"string.quoted.double.source.rust\",regex:'\"',push:[{token:\"string.quoted.double.source.rust\",regex:'\"',next:\"pop\"},{include:\"#rust_escaped_character\"},{defaultToken:\"string.quoted.double.source.rust\"}]},{token:[\"keyword.source.rust\",\"meta.function.source.rust\",\"entity.name.function.source.rust\",\"meta.function.source.rust\"],regex:\"\\\\b(fn)(\\\\s+)([a-zA-Z_][a-zA-Z0-9_][\\\\w\\\\:,+ \\\\'<>]*)(\\\\s*\\\\()\"},{token:\"support.constant\",regex:\"\\\\b[a-zA-Z_][\\\\w\\\\d]*::\"},{token:\"keyword.source.rust\",regex:\"\\\\b(?:as|assert|break|claim|const|copy|Copy|do|drop|else|extern|fail|for|if|impl|in|let|log|loop|match|mod|module|move|mut|Owned|priv|pub|pure|ref|return|unchecked|unsafe|use|while|mod|Send|static|trait|class|struct|enum|type)\\\\b\"},{token:\"storage.type.source.rust\",regex:\"\\\\b(?:Self|m32|m64|m128|f80|f16|f128|int|uint|float|char|bool|u8|u16|u32|u64|f32|f64|i8|i16|i32|i64|str|option|either|c_float|c_double|c_void|FILE|fpos_t|DIR|dirent|c_char|c_schar|c_uchar|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|size_t|ptrdiff_t|clock_t|time_t|c_longlong|c_ulonglong|intptr_t|uintptr_t|off_t|dev_t|ino_t|pid_t|mode_t|ssize_t)\\\\b\"},{token:\"variable.language.source.rust\",regex:\"\\\\bself\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|-->|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|/=|%=|\\\\+=|\\\\-=|&=|\\\\^=|,|;\"},{token:\"constant.language.source.rust\",regex:\"\\\\b(?:true|false|Some|None|Left|Right|Ok|Err)\\\\b\"},{token:\"support.constant.source.rust\",regex:\"\\\\b(?:EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|EOF|SEEK_SET|SEEK_CUR|SEEK_END|_IOFBF|_IONBF|_IOLBF|BUFSIZ|FOPEN_MAX|FILENAME_MAX|L_tmpnam|TMP_MAX|O_RDONLY|O_WRONLY|O_RDWR|O_APPEND|O_CREAT|O_EXCL|O_TRUNC|S_IFIFO|S_IFCHR|S_IFBLK|S_IFDIR|S_IFREG|S_IFMT|S_IEXEC|S_IWRITE|S_IREAD|S_IRWXU|S_IXUSR|S_IWUSR|S_IRUSR|F_OK|R_OK|W_OK|X_OK|STDIN_FILENO|STDOUT_FILENO|STDERR_FILENO)\\\\b\"},{token:\"meta.preprocessor.source.rust\",regex:\"\\\\b\\\\w\\\\(\\\\w\\\\)*!|#\\\\[[\\\\w=\\\\(\\\\)_]+\\\\]\\\\b\"},{token:\"constant.numeric.integer.source.rust\",regex:\"\\\\b(?:[0-9][0-9_]*|[0-9][0-9_]*(?:u|u8|u16|u32|u64)|[0-9][0-9_]*(?:i|i8|i16|i32|i64))\\\\b\"},{token:\"constant.numeric.hex.source.rust\",regex:\"\\\\b(?:0x[a-fA-F0-9_]+|0x[a-fA-F0-9_]+(?:u|u8|u16|u32|u64)|0x[a-fA-F0-9_]+(?:i|i8|i16|i32|i64))\\\\b\"},{token:\"constant.numeric.binary.source.rust\",regex:\"\\\\b(?:0b[01_]+|0b[01_]+(?:u|u8|u16|u32|u64)|0b[01_]+(?:i|i8|i16|i32|i64))\\\\b\"},{token:\"constant.numeric.float.source.rust\",regex:\"[0-9][0-9_]*(?:f32|f64|f)|[0-9][0-9_]*[eE][+-]=[0-9_]+|[0-9][0-9_]*[eE][+-]=[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\\\.[0-9_]+|[0-9][0-9_]*\\\\.[0-9_]+(?:f32|f64|f)|[0-9][0-9_]*\\\\.[0-9_]+%[eE][+-]=[0-9_]+|[0-9][0-9_]*\\\\.[0-9_]+%[eE][+-]=[0-9_]+(?:f32|f64|f)\"},{token:\"comment.line.documentation.source.rust\",regex:\"//!.*$\",push_:[{token:\"comment.line.documentation.source.rust\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.documentation.source.rust\"}]},{token:\"comment.line.double-dash.source.rust\",regex:\"//.*$\",push_:[{token:\"comment.line.double-dash.source.rust\",regex:\"$\",next:\"pop\"},{defaultToken:\"comment.line.double-dash.source.rust\"}]},{token:\"comment.block.source.rust\",regex:\"/\\\\*\",push:[{token:\"comment.block.source.rust\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.source.rust\"}]}],\"#rust_escaped_character\":[{token:\"constant.character.escape.source.rust\",regex:\"\\\\\\\\(?:x[\\\\da-fA-F]{2}|[0-2][0-7]{,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\"}]},this.normalizeRules()};s.metaData={fileTypes:[\"rs\",\"rc\"],foldingStartMarker:\"^.*\\\\bfn\\\\s*(\\\\w+\\\\s*)?\\\\([^\\\\)]*\\\\)(\\\\s*\\\\{[^\\\\}]*)?\\\\s*$\",foldingStopMarker:\"^\\\\s*\\\\}\",name:\"Rust\",scopeName:\"source.rust\"},r.inherits(s,i),t.RustHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-sass.js",
    "content": "define(\"ace/mode/sass\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/sass_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./sass_highlight_rules\").SassHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.$id=\"ace/mode/sass\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/sass_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/scss_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./scss_highlight_rules\").ScssHighlightRules,o=function(){s.call(this);var e=this.$rules.start;e[1].token==\"comment\"&&(e.splice(1,1,{onMatch:function(e,t,n){return n.unshift(this.next,-1,e.length-2,t),\"comment\"},regex:/^\\s*\\/\\*/,next:\"comment\"},{token:\"error.invalid\",regex:\"/\\\\*|[{;}]\"},{token:\"support.type\",regex:/^\\s*:[\\w\\-]+\\s/}),this.$rules.comment=[{regex:/^\\s*/,onMatch:function(e,t,n){return n[1]===-1&&(n[1]=Math.max(n[2],e.length-1)),e.length<=n[1]?(n.shift(),n.shift(),n.shift(),this.next=n.shift(),\"text\"):(this.next=\"\",\"comment\")},next:\"start\"},{defaultToken:\"comment\"}])};r.inherits(o,s),t.SassHighlightRules=o}),define(\"ace/mode/scss_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=i.arrayToMap(function(){var e=\"-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-\".split(\"|\"),t=\"appearance|background-clip|background-inline-policy|background-origin|background-size|binding|border-bottom-colors|border-left-colors|border-right-colors|border-top-colors|border-end|border-end-color|border-end-style|border-end-width|border-image|border-start|border-start-color|border-start-style|border-start-width|box-align|box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|box-pack|box-sizing|column-count|column-gap|column-width|column-rule|column-rule-width|column-rule-style|column-rule-color|float-edge|font-feature-settings|font-language-override|force-broken-image-icon|image-region|margin-end|margin-start|opacity|outline|outline-color|outline-offset|outline-radius|outline-radius-bottomleft|outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|outline-style|outline-width|padding-end|padding-start|stack-sizing|tab-size|text-blink|text-decoration-color|text-decoration-line|text-decoration-style|transform|transform-origin|transition|transition-delay|transition-duration|transition-property|transition-timing-function|user-focus|user-input|user-modify|user-select|window-shadow|border-radius\".split(\"|\"),n=\"azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index\".split(\"|\"),r=[];for(var i=0,s=e.length;i<s;i++)Array.prototype.push.apply(r,(e[i]+t.join(\"|\"+e[i])).split(\"|\"));return Array.prototype.push.apply(r,t),Array.prototype.push.apply(r,n),r}()),t=i.arrayToMap(\"hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|scale_color|transparentize|type_of|unit|unitless|unqoute\".split(\"|\")),n=i.arrayToMap(\"absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero\".split(\"|\")),r=i.arrayToMap(\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\".split(\"|\")),s=i.arrayToMap(\"@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare\".split(\"|\")),o=i.arrayToMap(\"a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp\".split(\"|\")),u=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:u+\"(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:\"constant.numeric\",regex:u},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:function(i){return e.hasOwnProperty(i.toLowerCase())?\"support.type\":s.hasOwnProperty(i)?\"keyword\":n.hasOwnProperty(i)?\"constant.language\":t.hasOwnProperty(i)?\"support.function\":r.hasOwnProperty(i.toLowerCase())?\"support.constant.color\":o.hasOwnProperty(i.toLowerCase())?\"variable.language\":\"text\"},regex:\"\\\\-?[@a-z_][@a-z0-9_\\\\-]*\"},{token:\"variable\",regex:\"[a-z_\\\\-$][a-z0-9_\\\\-$]*\\\\b\"},{token:\"variable.language\",regex:\"#[a-z0-9-_]+\"},{token:\"variable.language\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"variable.language\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{token:\"keyword.operator\",regex:\"<|>|<=|>=|==|!=|-|%|#|\\\\+|\\\\$|\\\\+|\\\\*\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(o,s),t.ScssHighlightRules=o}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-scad.js",
    "content": "define(\"ace/mode/scad\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/scad_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./scad_highlight_rules\").scadHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/scad\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/scad_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){var e=this.createKeywordMapper({\"variable.language\":\"this\",keyword:\"module|if|else|for\",\"constant.language\":\"NULL\"},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},s.getStartRule(\"start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant\",regex:\"<[a-zA-Z0-9.]+>\"},{token:\"keyword\",regex:\"(?:use|include)\"},{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|==|=|!=|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]},this.embedRules(s,\"doc-\",[s.getEndRule(\"start\")])};r.inherits(u,o),t.scadHighlightRules=u}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-scala.js",
    "content": "define(\"ace/mode/scala\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript\",\"ace/mode/scala_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript\").Mode,s=e(\"./scala_highlight_rules\").ScalaHighlightRules,o=function(){i.call(this),this.HighlightRules=s};r.inherits(o,i),function(){this.createWorker=function(e){return null},this.$id=\"ace/mode/scala\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/scala_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"case|default|do|else|for|if|match|while|throw|return|try|catch|finally|yield|abstract|class|def|extends|final|forSome|implicit|implicits|import|lazy|new|object|override|package|private|protected|sealed|super|this|trait|type|val|var|with\",t=\"true|false\",n=\"AbstractMethodError|AssertionError|ClassCircularityError|ClassFormatError|Deprecated|EnumConstantNotPresentException|ExceptionInInitializerError|IllegalAccessError|IllegalThreadStateException|InstantiationError|InternalError|NegativeArraySizeException|NoSuchFieldError|Override|Process|ProcessBuilder|SecurityManager|StringIndexOutOfBoundsException|SuppressWarnings|TypeNotPresentException|UnknownError|UnsatisfiedLinkError|UnsupportedClassVersionError|VerifyError|InstantiationException|IndexOutOfBoundsException|ArrayIndexOutOfBoundsException|CloneNotSupportedException|NoSuchFieldException|IllegalArgumentException|NumberFormatException|SecurityException|Void|InheritableThreadLocal|IllegalStateException|InterruptedException|NoSuchMethodException|IllegalAccessException|UnsupportedOperationException|Enum|StrictMath|Package|Compiler|Readable|Runtime|StringBuilder|Math|IncompatibleClassChangeError|NoSuchMethodError|ThreadLocal|RuntimePermission|ArithmeticException|NullPointerException|Long|Integer|Short|Byte|Double|Number|Float|Character|Boolean|StackTraceElement|Appendable|StringBuffer|Iterable|ThreadGroup|Runnable|Thread|IllegalMonitorStateException|StackOverflowError|OutOfMemoryError|VirtualMachineError|ArrayStoreException|ClassCastException|LinkageError|NoClassDefFoundError|ClassNotFoundException|RuntimeException|Exception|ThreadDeath|Error|Throwable|System|ClassLoader|Cloneable|Class|CharSequence|Comparable|String|Object|Unit|Any|AnyVal|AnyRef|Null|ScalaObject|Singleton|Seq|Iterable|List|Option|Array|Char|Byte|Short|Int|Long|Nothing\",r=this.createKeywordMapper({\"variable.language\":\"this\",keyword:e,\"support.function\":n,\"constant.language\":t},\"identifier\");this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'\"\"\"',next:\"tstring\"},{token:\"string\",regex:'\"(?=.)',next:\"string\"},{token:\"symbol.constant\",regex:\"'[\\\\w\\\\d_]+\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|\\\\b(?:in|instanceof|new|delete|typeof|void)\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],string:[{token:\"escape\",regex:'\\\\\\\\\"'},{token:\"string\",regex:'\"',next:\"start\"},{token:\"string.invalid\",regex:'[^\"\\\\\\\\]*$',next:\"start\"},{token:\"string\",regex:'[^\"\\\\\\\\]+'}],tstring:[{token:\"string\",regex:'\"{3,5}',next:\"start\"},{token:\"string\",regex:\".+?\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"start\")])};r.inherits(o,s),t.ScalaHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-scheme.js",
    "content": "define(\"ace/mode/scheme\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/scheme_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./scheme_highlight_rules\").SchemeHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart=\";\",this.$id=\"ace/mode/scheme\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/scheme_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"case|do|let|loop|if|else|when\",t=\"eq?|eqv?|equal?|and|or|not|null?\",n=\"#t|#f\",r=\"cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load\",i=this.createKeywordMapper({\"keyword.control\":e,\"keyword.operator\":t,\"constant.language\":n,\"support.function\":r},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\";.*$\"},{token:[\"storage.type.function-type.scheme\",\"text\",\"entity.name.function.scheme\"],regex:\"(?:\\\\b(?:(define|define-syntax|define-macro))\\\\b)(\\\\s+)((?:\\\\w|\\\\-|\\\\!|\\\\?)*)\"},{token:\"punctuation.definition.constant.character.scheme\",regex:\"#:\\\\S+\"},{token:[\"punctuation.definition.variable.scheme\",\"variable.other.global.scheme\",\"punctuation.definition.variable.scheme\"],regex:\"(\\\\*)(\\\\S*)(\\\\*)\"},{token:\"constant.numeric\",regex:\"#[xXoObB][0-9a-fA-F]+\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\"},{token:i,regex:\"[a-zA-Z_#][a-zA-Z0-9_\\\\-\\\\?\\\\!\\\\*]*\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"}],qqstring:[{token:\"constant.character.escape.scheme\",regex:\"\\\\\\\\.\"},{token:\"string\",regex:'[^\"\\\\\\\\]+',merge:!0},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\",merge:!0},{token:\"string\",regex:'\"|$',next:\"start\",merge:!0}]}};r.inherits(s,i),t.SchemeHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-scss.js",
    "content": "define(\"ace/mode/scss\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/scss_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./scss_highlight_rules\").ScssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/css\").CssBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/scss\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/scss_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=i.arrayToMap(function(){var e=\"-webkit-|-moz-|-o-|-ms-|-svg-|-pie-|-khtml-\".split(\"|\"),t=\"appearance|background-clip|background-inline-policy|background-origin|background-size|binding|border-bottom-colors|border-left-colors|border-right-colors|border-top-colors|border-end|border-end-color|border-end-style|border-end-width|border-image|border-start|border-start-color|border-start-style|border-start-width|box-align|box-direction|box-flex|box-flexgroup|box-ordinal-group|box-orient|box-pack|box-sizing|column-count|column-gap|column-width|column-rule|column-rule-width|column-rule-style|column-rule-color|float-edge|font-feature-settings|font-language-override|force-broken-image-icon|image-region|margin-end|margin-start|opacity|outline|outline-color|outline-offset|outline-radius|outline-radius-bottomleft|outline-radius-bottomright|outline-radius-topleft|outline-radius-topright|outline-style|outline-width|padding-end|padding-start|stack-sizing|tab-size|text-blink|text-decoration-color|text-decoration-line|text-decoration-style|transform|transform-origin|transition|transition-delay|transition-duration|transition-property|transition-timing-function|user-focus|user-input|user-modify|user-select|window-shadow|border-radius\".split(\"|\"),n=\"azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-bottom-color|border-bottom-style|border-bottom-width|border-bottom|border-collapse|border-color|border-left-color|border-left-style|border-left-width|border-left|border-right-color|border-right-style|border-right-width|border-right|border-spacing|border-style|border-top-color|border-top-style|border-top-width|border-top|border-width|border|bottom|box-shadow|box-sizing|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size-adjust|font-size|font-stretch|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|marker-offset|margin|marks|max-height|max-width|min-height|min-width|opacity|orphans|outline-color|outline-style|outline-width|outline|overflow|overflow-x|overflow-y|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|size|speak-header|speak-numeral|speak-punctuation|speech-rate|speak|stress|table-layout|text-align|text-decoration|text-indent|text-shadow|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index\".split(\"|\"),r=[];for(var i=0,s=e.length;i<s;i++)Array.prototype.push.apply(r,(e[i]+t.join(\"|\"+e[i])).split(\"|\"));return Array.prototype.push.apply(r,t),Array.prototype.push.apply(r,n),r}()),t=i.arrayToMap(\"hsl|hsla|rgb|rgba|url|attr|counter|counters|abs|adjust_color|adjust_hue|alpha|join|blue|ceil|change_color|comparable|complement|darken|desaturate|floor|grayscale|green|hue|if|invert|join|length|lighten|lightness|mix|nth|opacify|opacity|percentage|quote|red|round|saturate|saturation|scale_color|transparentize|type_of|unit|unitless|unqoute\".split(\"|\")),n=i.arrayToMap(\"absolute|all-scroll|always|armenian|auto|baseline|below|bidi-override|block|bold|bolder|border-box|both|bottom|break-all|break-word|capitalize|center|char|circle|cjk-ideographic|col-resize|collapse|content-box|crosshair|dashed|decimal-leading-zero|decimal|default|disabled|disc|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ellipsis|fixed|georgian|groove|hand|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|inactive|inherit|inline-block|inline|inset|inside|inter-ideograph|inter-word|italic|justify|katakana-iroha|katakana|keep-all|left|lighter|line-edge|line-through|line|list-item|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|medium|middle|move|n-resize|ne-resize|newspaper|no-drop|no-repeat|nw-resize|none|normal|not-allowed|nowrap|oblique|outset|outside|overline|pointer|progress|relative|repeat-x|repeat-y|repeat|right|ridge|row-resize|rtl|s-resize|scroll|se-resize|separate|small-caps|solid|square|static|strict|super|sw-resize|table-footer-group|table-header-group|tb-rl|text-bottom|text-top|text|thick|thin|top|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|zero\".split(\"|\")),r=i.arrayToMap(\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\".split(\"|\")),s=i.arrayToMap(\"@mixin|@extend|@include|@import|@media|@debug|@warn|@if|@for|@each|@while|@else|@font-face|@-webkit-keyframes|if|and|!default|module|def|end|declare\".split(\"|\")),o=i.arrayToMap(\"a|abbr|acronym|address|applet|area|article|aside|audio|b|base|basefont|bdo|big|blockquote|body|br|button|canvas|caption|center|cite|code|col|colgroup|command|datalist|dd|del|details|dfn|dir|div|dl|dt|em|embed|fieldset|figcaption|figure|font|footer|form|frame|frameset|h1|h2|h3|h4|h5|h6|head|header|hgroup|hr|html|i|iframe|img|input|ins|keygen|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|rp|rt|ruby|s|samp|script|section|select|small|source|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|u|ul|var|video|wbr|xmp\".split(\"|\")),u=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\";this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\/.*$\"},{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[\"].*\\\\\\\\$',next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"string\",regex:\"['].*\\\\\\\\$\",next:\"qstring\"},{token:\"constant.numeric\",regex:u+\"(?:em|ex|px|cm|mm|in|pt|pc|deg|rad|grad|ms|s|hz|khz|%)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:\"constant.numeric\",regex:u},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:function(i){return e.hasOwnProperty(i.toLowerCase())?\"support.type\":s.hasOwnProperty(i)?\"keyword\":n.hasOwnProperty(i)?\"constant.language\":t.hasOwnProperty(i)?\"support.function\":r.hasOwnProperty(i.toLowerCase())?\"support.constant.color\":o.hasOwnProperty(i.toLowerCase())?\"variable.language\":\"text\"},regex:\"\\\\-?[@a-z_][@a-z0-9_\\\\-]*\"},{token:\"variable\",regex:\"[a-z_\\\\-$][a-z0-9_\\\\-$]*\\\\b\"},{token:\"variable.language\",regex:\"#[a-z0-9-_]+\"},{token:\"variable.language\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"variable.language\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{token:\"keyword.operator\",regex:\"<|>|<=|>=|==|!=|-|%|#|\\\\+|\\\\$|\\\\+|\\\\*\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'(?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?\"',next:\"start\"},{token:\"string\",regex:\".+\"}],qstring:[{token:\"string\",regex:\"(?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?'\",next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(o,s),t.ScssHighlightRules=o}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-sh.js",
    "content": "define(\"ace/mode/sh\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/sh_highlight_rules\",\"ace/range\",\"ace/mode/folding/cstyle\",\"ace/mode/behaviour/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./sh_highlight_rules\").ShHighlightRules,o=e(\"../range\").Range,u=e(\"./folding/cstyle\").FoldMode,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=function(){this.HighlightRules=s,this.foldingRules=new u,this.$behaviour=new a};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[\\:]\\s*$/);o&&(r+=n)}return r};var e={pass:1,\"return\":1,raise:1,\"break\":1,\"continue\":1};this.checkOutdent=function(t,n,r){if(r!==\"\\r\\n\"&&r!==\"\\r\"&&r!==\"\\n\")return!1;var i=this.getTokenizer().getLineTokens(n.trim(),t).tokens;if(!i)return!1;do var s=i.pop();while(s&&(s.type==\"comment\"||s.type==\"text\"&&s.value.match(/^\\s+$/)));return s?s.type==\"keyword\"&&e[s.value]:!1},this.autoOutdent=function(e,t,n){n+=1;var r=this.$getIndent(t.getLine(n)),i=t.getTabString();r.slice(-i.length)==i&&t.remove(new o(n,r.length-i.length,n,r.length))},this.$id=\"ace/mode/sh\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/sh_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=t.reservedKeywords=\"!|{|}|case|do|done|elif|else|esac|fi|for|if|in|then|until|while|&|;|export|local|read|typeset|unset|elif|select|set\",o=t.languageConstructs=\"[|]|alias|bg|bind|break|builtin|cd|command|compgen|complete|continue|dirs|disown|echo|enable|eval|exec|exit|fc|fg|getopts|hash|help|history|jobs|kill|let|logout|popd|printf|pushd|pwd|return|set|shift|shopt|source|suspend|test|times|trap|type|ulimit|umask|unalias|wait\",u=function(){var e=this.createKeywordMapper({keyword:s,\"support.function.builtin\":o,\"invalid.deprecated\":\"debugger\"},\"identifier\"),t=\"(?:(?:[1-9]\\\\d*)|(?:0))\",n=\"(?:\\\\.\\\\d+)\",r=\"(?:\\\\d+)\",i=\"(?:(?:\"+r+\"?\"+n+\")|(?:\"+r+\"\\\\.))\",u=\"(?:(?:\"+i+\"|\"+r+\")\"+\")\",a=\"(?:\"+u+\"|\"+i+\")\",f=\"(?:&\"+r+\")\",l=\"[a-zA-Z_][a-zA-Z0-9_]*\",c=\"(?:(?:\\\\$\"+l+\")|(?:\"+l+\"=))\",h=\"(?:\\\\$(?:SHLVL|\\\\$|\\\\!|\\\\?))\",p=\"(?:\"+l+\"\\\\s*\\\\(\\\\))\";this.$rules={start:[{token:\"constant\",regex:/\\\\./},{token:[\"text\",\"comment\"],regex:/(^|\\s)(#.*)$/},{token:\"string\",regex:'\"',push:[{token:\"constant.language.escape\",regex:/\\\\(?:[$abeEfnrtv\\\\'\"]|x[a-fA-F\\d]{1,2}|u[a-fA-F\\d]{4}([a-fA-F\\d]{4})?|c.|\\d{1,3})/},{token:\"constant\",regex:/\\$\\w+/},{token:\"string\",regex:'\"',next:\"pop\"},{defaultToken:\"string\"}]},{token:\"variable.language\",regex:h},{token:\"variable\",regex:c},{token:\"support.function\",regex:p},{token:\"support.function\",regex:f},{token:\"string\",start:\"'\",end:\"'\"},{token:\"constant.numeric\",regex:a},{token:\"constant.numeric\",regex:t+\"\\\\b\"},{token:e,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\*|\\\\*\\\\*|\\\\/|\\\\/\\\\/|~|<|>|<=|=>|=|!=\"},{token:\"paren.lparen\",regex:\"[\\\\[\\\\(\\\\{]\"},{token:\"paren.rparen\",regex:\"[\\\\]\\\\)\\\\}]\"}]},this.normalizeRules()};r.inherits(u,i),t.ShHighlightRules=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-sjs.js",
    "content": "define(\"ace/mode/sjs\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript\",\"ace/mode/sjs_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript\").Mode,s=e(\"./sjs_highlight_rules\").SJSHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./behaviour/cstyle\").CstyleBehaviour,a=e(\"./folding/cstyle\").FoldMode,f=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,i),function(){this.createWorker=function(e){return null},this.$id=\"ace/mode/sjs\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/sjs_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=new i,t=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\",n=function(e){return e.isContextAware=!0,e},r=function(e){return{token:e.token,regex:e.regex,next:n(function(t,n){return n.length===0&&n.unshift(t),n.unshift(e.next),e.next})}},s=function(e){return{token:e.token,regex:e.regex,next:n(function(e,t){return t.shift(),t[0]||\"start\"})}};this.$rules=e.$rules,this.$rules.no_regex=[{token:\"keyword\",regex:\"(waitfor|or|and|collapse|spawn|retract)\\\\b\"},{token:\"keyword.operator\",regex:\"(->|=>|\\\\.\\\\.)\"},{token:\"variable.language\",regex:\"(hold|default)\\\\b\"},r({token:\"string\",regex:\"`\",next:\"bstring\"}),r({token:\"string\",regex:'\"',next:\"qqstring\"}),r({token:\"string\",regex:'\"',next:\"qqstring\"}),{token:[\"paren.lparen\",\"text\",\"paren.rparen\"],regex:\"(\\\\{)(\\\\s*)(\\\\|)\",next:\"block_arguments\"}].concat(this.$rules.no_regex),this.$rules.block_arguments=[{token:\"paren.rparen\",regex:\"\\\\|\",next:\"no_regex\"}].concat(this.$rules.function_arguments),this.$rules.bstring=[{token:\"constant.language.escape\",regex:t},{token:\"string\",regex:\"\\\\\\\\$\",next:\"bstring\"},r({token:\"paren.lparen\",regex:\"\\\\$\\\\{\",next:\"string_interp\"}),r({token:\"paren.lparen\",regex:\"\\\\$\",next:\"bstring_interp_single\"}),s({token:\"string\",regex:\"`\"}),{defaultToken:\"string\"}],this.$rules.qqstring=[{token:\"constant.language.escape\",regex:t},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},r({token:\"paren.lparen\",regex:\"#\\\\{\",next:\"string_interp\"}),s({token:\"string\",regex:'\"'}),{defaultToken:\"string\"}];var o=[];for(var u=0;u<this.$rules.no_regex.length;u++){var a=this.$rules.no_regex[u],f=String(a.token);f.indexOf(\"paren\")==-1&&(!a.next||a.next.isContextAware)&&o.push(a)}this.$rules.string_interp=[s({token:\"paren.rparen\",regex:\"\\\\}\"}),r({token:\"paren.lparen\",regex:\"{\",next:\"string_interp\"})].concat(o),this.$rules.bstring_interp_single=[{token:[\"identifier\",\"paren.lparen\"],regex:\"(\\\\w+)(\\\\()\",next:\"bstring_interp_single_call\"},s({token:\"identifier\",regex:\"\\\\w*\"})],this.$rules.bstring_interp_single_call=[r({token:\"paren.lparen\",regex:\"\\\\(\",next:\"bstring_interp_single_call\"}),s({token:\"paren.rparen\",regex:\"\\\\)\"})].concat(o)};r.inherits(o,s),t.SJSHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-smarty.js",
    "content": "define(\"ace/mode/smarty\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/smarty_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./smarty_highlight_rules\").SmartyHighlightRules,o=function(){i.call(this),this.HighlightRules=s};r.inherits(o,i),function(){this.$id=\"ace/mode/smarty\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/smarty_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=function(){i.call(this);var e={start:[{include:\"#comments\"},{include:\"#blocks\"}],\"#blocks\":[{token:\"punctuation.section.embedded.begin.smarty\",regex:\"\\\\{%?\",push:[{token:\"punctuation.section.embedded.end.smarty\",regex:\"%?\\\\}\",next:\"pop\"},{include:\"#strings\"},{include:\"#variables\"},{include:\"#lang\"},{defaultToken:\"source.smarty\"}]}],\"#comments\":[{token:[\"punctuation.definition.comment.smarty\",\"comment.block.smarty\"],regex:\"(\\\\{%?)(\\\\*)\",push:[{token:\"comment.block.smarty\",regex:\"\\\\*%?\\\\}\",next:\"pop\"},{defaultToken:\"comment.block.smarty\"}]}],\"#lang\":[{token:\"keyword.operator.smarty\",regex:\"(?:!=|!|<=|>=|<|>|===|==|%|&&|\\\\|\\\\|)|\\\\b(?:and|or|eq|neq|ne|gte|gt|ge|lte|lt|le|not|mod)\\\\b\"},{token:\"constant.language.smarty\",regex:\"\\\\b(?:TRUE|FALSE|true|false)\\\\b\"},{token:\"keyword.control.smarty\",regex:\"\\\\b(?:if|else|elseif|foreach|foreachelse|section|switch|case|break|default)\\\\b\"},{token:\"variable.parameter.smarty\",regex:\"\\\\b[a-zA-Z]+=\"},{token:\"support.function.built-in.smarty\",regex:\"\\\\b(?:capture|config_load|counter|cycle|debug|eval|fetch|include_php|include|insert|literal|math|strip|rdelim|ldelim|assign|constant|block|html_[a-z_]*)\\\\b\"},{token:\"support.function.variable-modifier.smarty\",regex:\"\\\\|(?:capitalize|cat|count_characters|count_paragraphs|count_sentences|count_words|date_format|default|escape|indent|lower|nl2br|regex_replace|replace|spacify|string_format|strip_tags|strip|truncate|upper|wordwrap)\"}],\"#strings\":[{token:\"punctuation.definition.string.begin.smarty\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.smarty\",regex:\"'\",next:\"pop\"},{token:\"constant.character.escape.smarty\",regex:\"\\\\\\\\.\"},{defaultToken:\"string.quoted.single.smarty\"}]},{token:\"punctuation.definition.string.begin.smarty\",regex:'\"',push:[{token:\"punctuation.definition.string.end.smarty\",regex:'\"',next:\"pop\"},{token:\"constant.character.escape.smarty\",regex:\"\\\\\\\\.\"},{defaultToken:\"string.quoted.double.smarty\"}]}],\"#variables\":[{token:[\"punctuation.definition.variable.smarty\",\"variable.other.global.smarty\"],regex:\"\\\\b(\\\\$)(Smarty\\\\.)\"},{token:[\"punctuation.definition.variable.smarty\",\"variable.other.smarty\"],regex:\"(\\\\$)([a-zA-Z_][a-zA-Z0-9_]*)\\\\b\"},{token:[\"keyword.operator.smarty\",\"variable.other.property.smarty\"],regex:\"(->)([a-zA-Z_][a-zA-Z0-9_]*)\\\\b\"},{token:[\"keyword.operator.smarty\",\"meta.function-call.object.smarty\",\"punctuation.definition.variable.smarty\",\"variable.other.smarty\",\"punctuation.definition.variable.smarty\"],regex:\"(->)([a-zA-Z_][a-zA-Z0-9_]*)(\\\\()(.*?)(\\\\))\"}]},t=e.start;for(var n in this.$rules)this.$rules[n].unshift.apply(this.$rules[n],t);Object.keys(e).forEach(function(t){this.$rules[t]||(this.$rules[t]=e[t])},this),this.normalizeRules()};s.metaData={fileTypes:[\"tpl\"],foldingStartMarker:\"\\\\{%?\",foldingStopMarker:\"%?\\\\}\",name:\"Smarty\",scopeName:\"text.html.smarty\"},r.inherits(s,i),t.SmartyHighlightRules=s}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-snippets.js",
    "content": "define(\"ace/mode/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=\"SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME\";this.$rules={start:[{token:\"constant.language.escape\",regex:/\\\\[\\$}`\\\\]/},{token:\"keyword\",regex:\"\\\\$(?:TM_)?(?:\"+e+\")\\\\b\"},{token:\"variable\",regex:\"\\\\$\\\\w+\"},{onMatch:function(e,t,n){return n[1]?n[1]++:n.unshift(t,1),this.tokenName},tokenName:\"markup.list\",regex:\"\\\\${\",next:\"varDecl\"},{onMatch:function(e,t,n){return n[1]?(n[1]--,n[1]||n.splice(0,2),this.tokenName):\"text\"},tokenName:\"markup.list\",regex:\"}\"},{token:\"doc.comment\",regex:/^\\${2}-{5,}$/}],varDecl:[{regex:/\\d+\\b/,token:\"constant.numeric\"},{token:\"keyword\",regex:\"(?:TM_)?(?:\"+e+\")\\\\b\"},{token:\"variable\",regex:\"\\\\w+\"},{regex:/:/,token:\"punctuation.operator\",next:\"start\"},{regex:/\\//,token:\"string.regex\",next:\"regexp\"},{regex:\"\",next:\"start\"}],regexp:[{regex:/\\\\./,token:\"escape\"},{regex:/\\[/,token:\"regex.start\",next:\"charClass\"},{regex:\"/\",token:\"string.regex\",next:\"format\"},{token:\"string.regex\",regex:\".\"}],charClass:[{regex:\"\\\\.\",token:\"escape\"},{regex:\"\\\\]\",token:\"regex.end\",next:\"regexp\"},{token:\"string.regex\",regex:\".\"}],format:[{regex:/\\\\[ulULE]/,token:\"keyword\"},{regex:/\\$\\d+/,token:\"variable\"},{regex:\"/[gim]*:?\",token:\"string.regex\",next:\"start\"},{token:\"string\",regex:\".\"}]}};r.inherits(o,s),t.SnippetHighlightRules=o;var u=function(){this.$rules={start:[{token:\"text\",regex:\"^\\\\t\",next:\"sn-start\"},{token:\"invalid\",regex:/^ \\s*/},{token:\"comment\",regex:/^#.*/},{token:\"constant.language.escape\",regex:\"^regex \",next:\"regex\"},{token:\"constant.language.escape\",regex:\"^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\\\b\"}],regex:[{token:\"text\",regex:\"\\\\.\"},{token:\"keyword\",regex:\"/\"},{token:\"empty\",regex:\"$\",next:\"start\"}]},this.embedRules(o,\"sn-\",[{token:\"text\",regex:\"^\\\\t\",next:\"sn-start\"},{onMatch:function(e,t,n){return n.splice(n.length),this.tokenName},tokenName:\"text\",regex:\"^(?!\t)\",next:\"start\"}])};r.inherits(u,s),t.SnippetGroupHighlightRules=u;var a=e(\"./folding/coffee\").FoldMode,f=function(){this.HighlightRules=u,this.foldingRules=new a};r.inherits(f,i),function(){this.$indentWithTabs=!0,this.$id=\"ace/mode/snippets\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-soy_template.js",
    "content": "define(\"ace/mode/soy_template\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/soy_template_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./soy_template_highlight_rules\").SoyTemplateHighlightRules,o=function(){i.call(this),this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/soy_template\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/soy_template_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html_highlight_rules\").HtmlHighlightRules,s=function(){i.call(this);var e={start:[{include:\"#template\"},{include:\"#if\"},{include:\"#comment-line\"},{include:\"#comment-block\"},{include:\"#comment-doc\"},{include:\"#call\"},{include:\"#css\"},{include:\"#param\"},{include:\"#print\"},{include:\"#msg\"},{include:\"#for\"},{include:\"#foreach\"},{include:\"#switch\"},{include:\"#tag\"},{include:\"text.html.basic\"}],\"#call\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.call.soy\"],regex:\"(\\\\{/?)(\\\\s*)(?=call|delcall)\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#string-quoted-single\"},{include:\"#string-quoted-double\"},{token:[\"entity.name.tag.soy\",\"variable.parameter.soy\"],regex:\"(call|delcall)(\\\\s+[\\\\.\\\\w]+)\"},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\"],regex:\"\\\\b(data)(\\\\s*)(=)\"},{defaultToken:\"meta.tag.call.soy\"}]}],\"#comment-line\":[{token:[\"comment.line.double-slash.soy\",\"punctuation.definition.comment.soy\",\"comment.line.double-slash.soy\"],regex:\"(\\\\s+)(//)(.*$)\"}],\"#comment-block\":[{token:\"punctuation.definition.comment.begin.soy\",regex:\"/\\\\*(?!\\\\*)\",push:[{token:\"punctuation.definition.comment.end.soy\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.soy\"}]}],\"#comment-doc\":[{token:\"punctuation.definition.comment.begin.soy\",regex:\"/\\\\*\\\\*(?!/)\",push:[{token:\"punctuation.definition.comment.end.soy\",regex:\"\\\\*/\",next:\"pop\"},{token:[\"support.type.soy\",\"text\",\"variable.parameter.soy\"],regex:\"(@param|@param\\\\?)(\\\\s+)(\\\\w+)\"},{defaultToken:\"comment.block.documentation.soy\"}]}],\"#css\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.css.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(css)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{token:\"support.constant.soy\",regex:\"\\\\b(?:LITERAL|REFERENCE|BACKEND_SPECIFIC|GOOG)\\\\b\"},{defaultToken:\"meta.tag.css.soy\"}]}],\"#for\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.for.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(for)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword.operator.soy\",regex:\"\\\\bin\\\\b\"},{token:\"support.function.soy\",regex:\"\\\\brange\\\\b\"},{include:\"#variable\"},{include:\"#number\"},{include:\"#primitive\"},{defaultToken:\"meta.tag.for.soy\"}]}],\"#foreach\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.foreach.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(foreach)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword.operator.soy\",regex:\"\\\\bin\\\\b\"},{include:\"#variable\"},{defaultToken:\"meta.tag.foreach.soy\"}]}],\"#function\":[{token:\"support.function.soy\",regex:\"\\\\b(?:isFirst|isLast|index|hasData|length|keys|round|floor|ceiling|min|max|randomInt)\\\\b\"}],\"#if\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.if.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(if|elseif)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#variable\"},{include:\"#operator\"},{include:\"#function\"},{include:\"#string-quoted-single\"},{include:\"#string-quoted-double\"},{defaultToken:\"meta.tag.if.soy\"}]}],\"#namespace\":[{token:[\"entity.name.tag.soy\",\"text\",\"variable.parameter.soy\"],regex:\"(namespace|delpackage)(\\\\s+)([\\\\w\\\\.]+)\"}],\"#number\":[{token:\"constant.numeric\",regex:\"[\\\\d]+\"}],\"#operator\":[{token:\"keyword.operator.soy\",regex:\"==|!=|\\\\band\\\\b|\\\\bor\\\\b|\\\\bnot\\\\b|-|\\\\+|/|\\\\?:\"}],\"#param\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.param.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(param)\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#variable\"},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\"],regex:\"\\\\b([\\\\w]*)(\\\\s*)((?::)?)\"},{defaultToken:\"meta.tag.param.soy\"}]}],\"#primitive\":[{token:\"constant.language.soy\",regex:\"\\\\b(?:null|false|true)\\\\b\"}],\"#msg\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.msg.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(msg)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#string-quoted-single\"},{include:\"#string-quoted-double\"},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\"],regex:\"\\\\b(meaning|desc)(\\\\s*)(=)\"},{defaultToken:\"meta.tag.msg.soy\"}]}],\"#print\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.print.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(print)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#variable\"},{include:\"#print-parameter\"},{include:\"#number\"},{include:\"#primitive\"},{include:\"#attribute-lookup\"},{defaultToken:\"meta.tag.print.soy\"}]}],\"#print-parameter\":[{token:\"keyword.operator.soy\",regex:\"\\\\|\"},{token:\"variable.parameter.soy\",regex:\"noAutoescape|id|escapeHtml|escapeJs|insertWorkBreaks|truncate\"}],\"#special-character\":[{token:\"support.constant.soy\",regex:\"\\\\bsp\\\\b|\\\\bnil\\\\b|\\\\\\\\r|\\\\\\\\n|\\\\\\\\t|\\\\blb\\\\b|\\\\brb\\\\b\"}],\"#string-quoted-double\":[{token:\"string.quoted.double\",regex:'\"[^\"]*\"'}],\"#string-quoted-single\":[{token:\"string.quoted.single\",regex:\"'[^']*'\"}],\"#switch\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.switch.soy\",\"entity.name.tag.soy\"],regex:\"(\\\\{/?)(\\\\s*)(switch|case)\\\\b\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#variable\"},{include:\"#function\"},{include:\"#number\"},{include:\"#string-quoted-single\"},{include:\"#string-quoted-double\"},{defaultToken:\"meta.tag.switch.soy\"}]}],\"#attribute-lookup\":[{token:\"punctuation.definition.attribute-lookup.begin.soy\",regex:\"\\\\[\",push:[{token:\"punctuation.definition.attribute-lookup.end.soy\",regex:\"\\\\]\",next:\"pop\"},{include:\"#variable\"},{include:\"#function\"},{include:\"#operator\"},{include:\"#number\"},{include:\"#primitive\"},{include:\"#string-quoted-single\"},{include:\"#string-quoted-double\"}]}],\"#tag\":[{token:\"punctuation.definition.tag.begin.soy\",regex:\"\\\\{\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{include:\"#namespace\"},{include:\"#variable\"},{include:\"#special-character\"},{include:\"#tag-simple\"},{include:\"#function\"},{include:\"#operator\"},{include:\"#attribute-lookup\"},{include:\"#number\"},{include:\"#primitive\"},{include:\"#print-parameter\"}]}],\"#tag-simple\":[{token:\"entity.name.tag.soy\",regex:\"{{\\\\s*(?:literal|else|ifempty|default)\\\\s*(?=\\\\})\"}],\"#template\":[{token:[\"punctuation.definition.tag.begin.soy\",\"meta.tag.template.soy\"],regex:\"(\\\\{/?)(\\\\s*)(?=template|deltemplate)\",push:[{token:\"punctuation.definition.tag.end.soy\",regex:\"\\\\}\",next:\"pop\"},{token:[\"entity.name.tag.soy\",\"text\",\"entity.name.function.soy\"],regex:\"(template|deltemplate)(\\\\s+)([\\\\.\\\\w]+)\",originalRegex:\"(?<=template|deltemplate)\\\\s+([\\\\.\\\\w]+)\"},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\",\"text\",\"string.quoted.double.soy\"],regex:'\\\\b(private)(\\\\s*)(=)(\\\\s*)(\"true\"|\"false\")'},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\",\"text\",\"string.quoted.single.soy\"],regex:\"\\\\b(private)(\\\\s*)(=)(\\\\s*)('true'|'false')\"},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\",\"text\",\"string.quoted.double.soy\"],regex:'\\\\b(autoescape)(\\\\s*)(=)(\\\\s*)(\"true\"|\"false\"|\"contextual\")'},{token:[\"entity.other.attribute-name.soy\",\"text\",\"keyword.operator.soy\",\"text\",\"string.quoted.single.soy\"],regex:\"\\\\b(autoescape)(\\\\s*)(=)(\\\\s*)('true'|'false'|'contextual')\"},{defaultToken:\"meta.tag.template.soy\"}]}],\"#variable\":[{token:\"variable.other.soy\",regex:\"\\\\$[\\\\w\\\\.]+\"}]};for(var t in e)this.$rules[t]?this.$rules[t].unshift.call(this.$rules[t],e[t]):this.$rules[t]=e[t];this.normalizeRules()};s.metaData={comment:\"SoyTemplate\",fileTypes:[\"soy\"],firstLineMatch:\"\\\\{\\\\s*namespace\\\\b\",foldingStartMarker:\"\\\\{\\\\s*template\\\\s+[^\\\\}]*\\\\}\",foldingStopMarker:\"\\\\{\\\\s*/\\\\s*template\\\\s*\\\\}\",name:\"SoyTemplate\",scopeName:\"source.soy\"},r.inherits(s,i),t.SoyTemplateHighlightRules=s}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-space.js",
    "content": "define(\"ace/mode/space\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/folding/coffee\",\"ace/mode/space_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./folding/coffee\").FoldMode,o=e(\"./space_highlight_rules\").SpaceHighlightRules,u=function(){this.HighlightRules=o,this.foldingRules=new s};r.inherits(u,i),function(){this.$id=\"ace/mode/space\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/space_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"empty_line\",regex:/ */,next:\"key\"},{token:\"empty_line\",regex:/$/,next:\"key\"}],key:[{token:\"variable\",regex:/\\S+/},{token:\"empty_line\",regex:/$/,next:\"start\"},{token:\"keyword.operator\",regex:/ /,next:\"value\"}],value:[{token:\"keyword.operator\",regex:/$/,next:\"start\"},{token:\"string\",regex:/[^$]/}]}};r.inherits(s,i),t.SpaceHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-sql.js",
    "content": "define(\"ace/mode/sql\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/sql_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./sql_highlight_rules\").SqlHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.$id=\"ace/mode/sql\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/sql_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"select|insert|update|delete|from|where|and|or|group|by|order|limit|offset|having|as|case|when|else|end|type|left|right|join|on|outer|desc|asc\",t=\"true|false|null\",n=\"count|min|max|avg|sum|rank|now|coalesce\",r=this.createKeywordMapper({\"support.function\":n,keyword:e,\"constant.language\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"--.*$\"},{token:\"comment\",start:\"/\\\\*\",end:\"\\\\*/\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|%|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}]},this.normalizeRules()};r.inherits(s,i),t.SqlHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-stylus.js",
    "content": "define(\"ace/mode/stylus\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/stylus_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./stylus_highlight_rules\").StylusHighlightRules,o=e(\"./folding/coffee\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.$id=\"ace/mode/stylus\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/stylus_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\",\"ace/mode/css_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=e(\"./css_highlight_rules\"),o=function(){var e=this.createKeywordMapper({\"support.type\":s.supportType,\"support.function\":s.supportFunction,\"support.constant\":s.supportConstant,\"support.constant.color\":s.supportConstantColor,\"support.constant.fonts\":s.supportConstantFonts},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:/\\/\\/.*$/},{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:[\"entity.name.function.stylus\",\"text\"],regex:\"^([-a-zA-Z_][-\\\\w]*)?(\\\\()\"},{token:[\"entity.other.attribute-name.class.stylus\"],regex:\"\\\\.-?[_a-zA-Z]+[_a-zA-Z0-9-]*\"},{token:[\"entity.language.stylus\"],regex:\"^ *&\"},{token:[\"variable.language.stylus\"],regex:\"(arguments)\"},{token:[\"keyword.stylus\"],regex:\"@[-\\\\w]+\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:s.pseudoElements},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:s.pseudoClasses},{token:[\"entity.name.tag.stylus\"],regex:\"(?:\\\\b)(a|abbr|acronym|address|area|article|aside|audio|b|base|big|blockquote|body|br|button|canvas|caption|cite|code|col|colgroup|datalist|dd|del|details|dfn|dialog|div|dl|dt|em|eventsource|fieldset|figure|figcaption|footer|form|frame|frameset|(?:h[1-6])|head|header|hgroup|hr|html|i|iframe|img|input|ins|kbd|label|legend|li|link|map|mark|menu|meta|meter|nav|noframes|noscript|object|ol|optgroup|option|output|p|param|pre|progress|q|samp|script|section|select|small|span|strike|strong|style|sub|summary|sup|table|tbody|td|textarea|tfoot|th|thead|time|title|tr|tt|ul|var|video)(?:\\\\b)\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation.definition.entity.stylus\",\"entity.other.attribute-name.id.stylus\"],regex:\"(#)([a-zA-Z][a-zA-Z0-9_-]*)\"},{token:\"meta.vendor-prefix.stylus\",regex:\"-webkit-|-moz\\\\-|-ms-|-o-\"},{token:\"keyword.control.stylus\",regex:\"(?:!important|for|in|return|true|false|null|if|else|unless|return)\\\\b\"},{token:\"keyword.operator.stylus\",regex:\"!|~|\\\\+|-|(?:\\\\*)?\\\\*|\\\\/|%|(?:\\\\.)\\\\.\\\\.|<|>|(?:=|:|\\\\?|\\\\+|-|\\\\*|\\\\/|%|<|>)?=|!=\"},{token:\"keyword.operator.stylus\",regex:\"(?:in|is(?:nt)?|not)\\\\b\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:s.numRe},{token:\"keyword\",regex:\"(?:ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\\\\b\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"}],comment:[{token:\"comment\",regex:\".*?\\\\*\\\\/\",next:\"start\"},{token:\"comment\",regex:\".+\"}],qqstring:[{token:\"string\",regex:'[^\"\\\\\\\\]+'},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"start\"}],qstring:[{token:\"string\",regex:\"[^'\\\\\\\\]+\"},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"start\"}]}};r.inherits(o,i),t.StylusHighlightRules=o}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-svg.js",
    "content": "define(\"ace/mode/svg\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/xml\",\"ace/mode/javascript\",\"ace/mode/svg_highlight_rules\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./xml\").Mode,s=e(\"./javascript\").Mode,o=e(\"./svg_highlight_rules\").SvgHighlightRules,u=e(\"./folding/mixed\").FoldMode,a=e(\"./folding/xml\").FoldMode,f=e(\"./folding/cstyle\").FoldMode,l=function(){i.call(this),this.HighlightRules=o,this.createModeDelegates({\"js-\":s}),this.foldingRules=new u(new a,{\"js-\":new f})};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.$id=\"ace/mode/svg\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/svg_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,s=e(\"./xml_highlight_rules\").XmlHighlightRules,o=function(){s.call(this),this.embedTagRules(i,\"js-\",\"script\"),this.normalizeRules()};r.inherits(o,s),t.SvgHighlightRules=o}),define(\"ace/mode/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/xml_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/xml\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./xml_highlight_rules\").XmlHighlightRules,u=e(\"./behaviour/xml\").XmlBehaviour,a=e(\"./folding/xml\").FoldMode,f=function(){this.HighlightRules=o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,s),function(){this.voidElements=i.arrayToMap([]),this.blockComment={start:\"<!--\",end:\"-->\"},this.$id=\"ace/mode/xml\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-tcl.js",
    "content": "define(\"ace/mode/tcl\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/folding/cstyle\",\"ace/mode/tcl_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./folding/cstyle\").FoldMode,o=e(\"./tcl_highlight_rules\").TclHighlightRules,u=e(\"./matching_brace_outdent\").MatchingBraceOutdent,a=e(\"../range\").Range,f=function(){this.HighlightRules=o,this.$outdent=new u,this.foldingRules=new s};r.inherits(f,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var o=t.match(/^.*[\\{\\(\\[]\\s*$/);o&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/tcl\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/tcl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment\",regex:\"#.*\\\\\\\\$\",next:\"commentfollow\"},{token:\"comment\",regex:\"#.*$\"},{token:\"support.function\",regex:\"[\\\\\\\\]$\",next:\"splitlineStart\"},{token:\"text\",regex:'[\\\\\\\\](?:[\"]|[{]|[}]|[[]|[]]|[$]|[])'},{token:\"text\",regex:\"^|[^{][;][^}]|[/\\r/]\",next:\"commandItem\"},{token:\"string\",regex:'[ ]*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:'[ ]*[\"]',next:\"qqstring\"},{token:\"variable.instance\",regex:\"[$]\",next:\"variable\"},{token:\"support.function\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|{\\\\*}|;|::\"},{token:\"identifier\",regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"paren.lparen\",regex:\"[[{]\",next:\"commandItem\"},{token:\"paren.lparen\",regex:\"[(]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}],commandItem:[{token:\"comment\",regex:\"#.*\\\\\\\\$\",next:\"commentfollow\"},{token:\"comment\",regex:\"#.*$\",next:\"start\"},{token:\"string\",regex:'[ ]*[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"variable.instance\",regex:\"[$]\",next:\"variable\"},{token:\"support.function\",regex:\"(?:[:][:])[a-zA-Z0-9_/]+(?:[:][:])\",next:\"commandItem\"},{token:\"support.function\",regex:\"[a-zA-Z0-9_/]+(?:[:][:])\",next:\"commandItem\"},{token:\"support.function\",regex:\"(?:[:][:])\",next:\"commandItem\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"},{token:\"support.function\",regex:\"!|\\\\$|%|&|\\\\*|\\\\-\\\\-|\\\\-|\\\\+\\\\+|\\\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\\\|\\\\||\\\\?\\\\:|\\\\*=|%=|\\\\+=|\\\\-=|&=|\\\\^=|{\\\\*}|;|::\"},{token:\"keyword\",regex:\"[a-zA-Z0-9_/]+\",next:\"start\"}],commentfollow:[{token:\"comment\",regex:\".*\\\\\\\\$\",next:\"commentfollow\"},{token:\"comment\",regex:\".+\",next:\"start\"}],splitlineStart:[{token:\"text\",regex:\"^.\",next:\"start\"}],variable:[{token:\"variable.instance\",regex:\"[a-zA-Z_\\\\d]+(?:[(][a-zA-Z_\\\\d]+[)])?\",next:\"start\"},{token:\"variable.instance\",regex:\"{?[a-zA-Z_\\\\d]+}?\",next:\"start\"}],qqstring:[{token:\"string\",regex:'(?:[^\\\\\\\\]|\\\\\\\\.)*?[\"]',next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(s,i),t.TclHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-tex.js",
    "content": "define(\"ace/mode/tex\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/tex_highlight_rules\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./tex_highlight_rules\").TexHighlightRules,u=e(\"./matching_brace_outdent\").MatchingBraceOutdent,a=function(e){e?this.HighlightRules=s:this.HighlightRules=o,this.$outdent=new u};r.inherits(a,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.allowAutoInsert=function(){return!1},this.$id=\"ace/mode/tex\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/tex_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(e){e||(e=\"text\"),this.$rules={start:[{token:\"comment\",regex:\"%.*$\"},{token:e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\",next:\"nospell\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])}]\"},{token:e,regex:\"\\\\s+\"}],nospell:[{token:\"comment\",regex:\"%.*$\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\\\\\[$&%#\\\\{\\\\}]\"},{token:\"keyword\",regex:\"\\\\\\\\(?:documentclass|usepackage|newcounter|setcounter|addtocounter|value|arabic|stepcounter|newenvironment|renewenvironment|ref|vref|eqref|pageref|label|cite[a-zA-Z]*|tag|begin|end|bibitem)\\\\b\"},{token:\"keyword\",regex:\"\\\\\\\\(?:[a-zA-z0-9]+|[^a-zA-z0-9])\",next:\"start\"},{token:\"paren.keyword.operator\",regex:\"[[({]\"},{token:\"paren.keyword.operator\",regex:\"[\\\\])]\"},{token:\"paren.keyword.operator\",regex:\"}\",next:\"start\"},{token:\"nospell.\"+e,regex:\"\\\\s+\"},{token:\"nospell.\"+e,regex:\"\\\\w+\"}]}};r.inherits(o,s),t.TexHighlightRules=o}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-text.js",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-textile.js",
    "content": "define(\"ace/mode/textile\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/textile_highlight_rules\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./textile_highlight_rules\").TextileHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=function(){this.HighlightRules=s,this.$outdent=new o};r.inherits(u,i),function(){this.getNextLineIndent=function(e,t,n){return e==\"intag\"?n:\"\"},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/textile\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/textile_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:function(e){return e.charAt(0)==\"h\"?\"markup.heading.\"+e.charAt(1):\"markup.heading\"},regex:\"h1|h2|h3|h4|h5|h6|bq|p|bc|pre\",next:\"blocktag\"},{token:\"keyword\",regex:\"[\\\\*]+|[#]+\"},{token:\"text\",regex:\".+\"}],blocktag:[{token:\"keyword\",regex:\"\\\\. \",next:\"start\"},{token:\"keyword\",regex:\"\\\\(\",next:\"blocktagproperties\"}],blocktagproperties:[{token:\"keyword\",regex:\"\\\\)\",next:\"blocktag\"},{token:\"string\",regex:\"[a-zA-Z0-9\\\\-_]+\"},{token:\"keyword\",regex:\"#\"}]}};r.inherits(s,i),t.TextileHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-tmsnippet.js",
    "content": "define(\"ace/mode/tmsnippet\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/tokenizer\",\"ace/mode/text_highlight_rules\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"../tokenizer\").Tokenizer,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){var e=\"SELECTION|CURRENT_WORD|SELECTED_TEXT|CURRENT_LINE|LINE_INDEX|LINE_NUMBER|SOFT_TABS|TAB_SIZE|FILENAME|FILEPATH|FULLNAME\";this.$rules={start:[{token:\"constant.language.escape\",regex:/\\\\[\\$}`\\\\]/},{token:\"keyword\",regex:\"\\\\$(?:TM_)?(?:\"+e+\")\\\\b\"},{token:\"variable\",regex:\"\\\\$\\\\w+\"},{onMatch:function(e,t,n){return n[1]?n[1]++:n.unshift(t,1),this.tokenName},tokenName:\"markup.list\",regex:\"\\\\${\",next:\"varDecl\"},{onMatch:function(e,t,n){return n[1]?(n[1]--,n[1]||n.splice(0,2),this.tokenName):\"text\"},tokenName:\"markup.list\",regex:\"}\"},{token:\"doc.comment\",regex:/^\\${2}-{5,}$/}],varDecl:[{regex:/\\d+\\b/,token:\"constant.numeric\"},{token:\"keyword\",regex:\"(?:TM_)?(?:\"+e+\")\\\\b\"},{token:\"variable\",regex:\"\\\\w+\"},{regex:/:/,token:\"punctuation.operator\",next:\"start\"},{regex:/\\//,token:\"string.regex\",next:\"regexp\"},{regex:\"\",next:\"start\"}],regexp:[{regex:/\\\\./,token:\"escape\"},{regex:/\\[/,token:\"regex.start\",next:\"charClass\"},{regex:\"/\",token:\"string.regex\",next:\"format\"},{token:\"string.regex\",regex:\".\"}],charClass:[{regex:\"\\\\.\",token:\"escape\"},{regex:\"\\\\]\",token:\"regex.end\",next:\"regexp\"},{token:\"string.regex\",regex:\".\"}],format:[{regex:/\\\\[ulULE]/,token:\"keyword\"},{regex:/\\$\\d+/,token:\"variable\"},{regex:\"/[gim]*:?\",token:\"string.regex\",next:\"start\"},{token:\"string\",regex:\".\"}]}};r.inherits(u,o),t.SnippetHighlightRules=u;var a=function(){this.$rules={start:[{token:\"text\",regex:\"^\\\\t\",next:\"sn-start\"},{token:\"invalid\",regex:/^ \\s*/},{token:\"comment\",regex:/^#.*/},{token:\"constant.language.escape\",regex:\"^regex \",next:\"regex\"},{token:\"constant.language.escape\",regex:\"^(trigger|endTrigger|name|snippet|guard|endGuard|tabTrigger|key)\\\\b\"}],regex:[{token:\"text\",regex:\"\\\\.\"},{token:\"keyword\",regex:\"/\"},{token:\"empty\",regex:\"$\",next:\"start\"}]},this.embedRules(u,\"sn-\",[{token:\"text\",regex:\"^\\\\t\",next:\"sn-start\"},{onMatch:function(e,t,n){return n.splice(n.length),this.tokenName},tokenName:\"text\",regex:\"^(?!\t)\",next:\"start\"}])};r.inherits(a,o),t.SnippetGroupHighlightRules=a;var f=e(\"./folding/coffee\").FoldMode,l=function(){var e=new a;this.foldingRules=new f,this.$tokenizer=new s(e.getRules())};r.inherits(l,i),function(){this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)}}.call(l.prototype),t.Mode=l}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-toml.js",
    "content": "define(\"ace/mode/toml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/toml_highlight_rules\",\"ace/mode/folding/ini\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./toml_highlight_rules\").TomlHighlightRules,o=e(\"./folding/ini\").FoldMode,u=function(){this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"#\",this.$id=\"ace/mode/toml\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/toml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=this.createKeywordMapper({\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\";this.$rules={start:[{token:\"comment.toml\",regex:/#.*$/},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:[\"variable.keygroup.toml\"],regex:\"(?:^\\\\s*)(\\\\[([^\\\\]]+)\\\\])\"},{token:e,regex:t},{token:\"support.date.toml\",regex:\"\\\\d{4}-\\\\d{2}-\\\\d{2}(T)\\\\d{2}:\\\\d{2}:\\\\d{2}(Z)\"},{token:\"constant.numeric.toml\",regex:\"-?\\\\d+(\\\\.?\\\\d+)?\"}],qqstring:[{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"constant.language.escape\",regex:'\\\\\\\\[0tnr\"\\\\\\\\]'},{token:\"string\",regex:'\"|$',next:\"start\"},{defaultToken:\"string\"}]}};r.inherits(s,i),t.TomlHighlightRules=s}),define(\"ace/mode/folding/ini\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(){};r.inherits(o,s),function(){this.foldingStartMarker=/^\\s*\\[([^\\])]*)]\\s*(?:$|[;#])/,this.getFoldWidgetRange=function(e,t,n){var r=this.foldingStartMarker,s=e.getLine(n),o=s.match(r);if(!o)return;var u=o[1]+\".\",a=s.length,f=e.getLength(),l=n,c=n;while(++n<f){s=e.getLine(n);if(/^\\s*$/.test(s))continue;o=s.match(r);if(o&&o[1].lastIndexOf(u,0)!==0)break;c=n}if(c>l){var h=e.getLine(c).length;return new i(l,a,c,h)}}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-twig.js",
    "content": "define(\"ace/mode/twig\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/twig_highlight_rules\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./twig_highlight_rules\").TwigHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=function(){i.call(this),this.HighlightRules=s,this.$outdent=new o};r.inherits(u,i),function(){this.blockComment={start:\"{#\",end:\"#}\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"){var u=t.match(/^.*[\\{\\(\\[]\\s*$/);u&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/twig\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/twig_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/html_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./html_highlight_rules\").HtmlHighlightRules,o=e(\"./text_highlight_rules\").TextHighlightRules,u=function(){s.call(this);var e=\"autoescape|block|do|embed|extends|filter|flush|for|from|if|import|include|macro|sandbox|set|spaceless|use|verbatim\";e=e+\"|end\"+e.replace(/\\|/g,\"|end\");var t=\"abs|batch|capitalize|convert_encoding|date|date_modify|default|e|escape|first|format|join|json_encode|keys|last|length|lower|merge|nl2br|number_format|raw|replace|reverse|slice|sort|split|striptags|title|trim|upper|url_encode\",n=\"attribute|constant|cycle|date|dump|parent|random|range|template_from_string\",r=\"constant|divisibleby|sameas|defined|empty|even|iterable|odd\",i=\"null|none|true|false\",o=\"b-and|b-xor|b-or|in|is|and|or|not\",u=this.createKeywordMapper({\"keyword.control.twig\":e,\"support.function.twig\":[t,n,r].join(\"|\"),\"keyword.operator.twig\":o,\"constant.language.twig\":i},\"identifier\");for(var a in this.$rules)this.$rules[a].unshift({token:\"variable.other.readwrite.local.twig\",regex:\"\\\\{\\\\{-?\",push:\"twig-start\"},{token:\"meta.tag.twig\",regex:\"\\\\{%-?\",push:\"twig-start\"},{token:\"comment.block.twig\",regex:\"\\\\{#-?\",push:\"twig-comment\"});this.$rules[\"twig-comment\"]=[{token:\"comment.block.twig\",regex:\".*-?#\\\\}\",next:\"pop\"}],this.$rules[\"twig-start\"]=[{token:\"variable.other.readwrite.local.twig\",regex:\"-?\\\\}\\\\}\",next:\"pop\"},{token:\"meta.tag.twig\",regex:\"-?%\\\\}\",next:\"pop\"},{token:\"string\",regex:\"'\",next:\"twig-qstring\"},{token:\"string\",regex:'\"',next:\"twig-qqstring\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:u,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator.assignment\",regex:\"=|~\"},{token:\"keyword.operator.comparison\",regex:\"==|!=|<|>|>=|<=|===\"},{token:\"keyword.operator.arithmetic\",regex:\"\\\\+|-|/|%|//|\\\\*|\\\\*\\\\*\"},{token:\"keyword.operator.other\",regex:\"\\\\.\\\\.|\\\\|\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./},{token:\"paren.lparen\",regex:/[\\[\\({]/},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"text\",regex:\"\\\\s+\"}],this.$rules[\"twig-qqstring\"]=[{token:\"constant.language.escape\",regex:/\\\\[\\\\\"$#ntr]|#{[^\"}]*}/},{token:\"string\",regex:'\"',next:\"twig-start\"},{defaultToken:\"string\"}],this.$rules[\"twig-qstring\"]=[{token:\"constant.language.escape\",regex:/\\\\[\\\\'ntr]}/},{token:\"string\",regex:\"'\",next:\"twig-start\"},{defaultToken:\"string\"}],this.normalizeRules()};r.inherits(u,o),t.TwigHighlightRules=u}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-typescript.js",
    "content": "define(\"ace/mode/typescript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript\",\"ace/mode/typescript_highlight_rules\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript\").Mode,s=e(\"./typescript_highlight_rules\").TypeScriptHighlightRules,o=e(\"./behaviour/cstyle\").CstyleBehaviour,u=e(\"./folding/cstyle\").FoldMode,a=e(\"./matching_brace_outdent\").MatchingBraceOutdent,f=function(){this.HighlightRules=s,this.$outdent=new a,this.$behaviour=new o,this.foldingRules=new u};r.inherits(f,i),function(){this.createWorker=function(e){return null},this.$id=\"ace/mode/typescript\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/typescript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/javascript_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,s=function(){var e=[{token:[\"keyword.operator.ts\",\"text\",\"variable.parameter.function.ts\",\"text\"],regex:\"\\\\b(module)(\\\\s*)([a-zA-Z0-9_?.$][\\\\w?.$]*)(\\\\s*\\\\{)\"},{token:[\"storage.type.variable.ts\",\"text\",\"keyword.other.ts\",\"text\"],regex:\"(super)(\\\\s*\\\\()([a-zA-Z0-9,_?.$\\\\s]+\\\\s*)(\\\\))\"},{token:[\"entity.name.function.ts\",\"paren.lparen\",\"paren.rparen\"],regex:\"([a-zA-Z_?.$][\\\\w?.$]*)(\\\\()(\\\\))\"},{token:[\"variable.parameter.function.ts\",\"text\",\"variable.parameter.function.ts\"],regex:\"([a-zA-Z0-9_?.$][\\\\w?.$]*)(\\\\s*:\\\\s*)([a-zA-Z0-9_?.$][\\\\w?.$]*)\"},{token:[\"keyword.operator.ts\"],regex:\"(?:\\\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\\\b)\"},{token:[\"storage.type.variable.ts\"],regex:\"(?:\\\\b(this\\\\.|string\\\\b|bool\\\\b|number)\\\\b)\"},{token:[\"keyword.operator.ts\",\"storage.type.variable.ts\",\"keyword.operator.ts\",\"storage.type.variable.ts\"],regex:\"(class)(\\\\s+[a-zA-Z0-9_?.$][\\\\w?.$]*\\\\s+)(extends)(\\\\s+[a-zA-Z0-9_?.$][\\\\w?.$]*\\\\s+)?\"},{token:\"keyword\",regex:\"(?:super|export|class|extends|import)\\\\b\"}],t=(new i).getRules();t.start=e.concat(t.start),this.$rules=t};r.inherits(s,i),t.TypeScriptHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-vala.js",
    "content": "define(\"ace/mode/vala\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/tokenizer\",\"ace/mode/vala_highlight_rules\",\"ace/mode/folding/cstyle\",\"ace/mode/behaviour/cstyle\",\"ace/mode/matching_brace_outdent\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"../tokenizer\").Tokenizer,o=e(\"./vala_highlight_rules\").ValaHighlightRules,u=e(\"./folding/cstyle\").FoldMode,a=e(\"./behaviour/cstyle\").CstyleBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=e(\"./matching_brace_outdent\").MatchingBraceOutdent,c=function(){this.HighlightRules=o,this.$outdent=new l,this.$behaviour=new a,this.foldingRules=new f};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/vala\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/vala_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:[\"meta.using.vala\",\"keyword.other.using.vala\",\"meta.using.vala\",\"storage.modifier.using.vala\",\"meta.using.vala\",\"punctuation.terminator.vala\"],regex:\"^(\\\\s*)(using)\\\\b(?:(\\\\s*)([^ ;$]+)(\\\\s*)((?:;)?))?\"},{include:\"#code\"}],\"#all-types\":[{include:\"#primitive-arrays\"},{include:\"#primitive-types\"},{include:\"#object-types\"}],\"#annotations\":[{token:[\"storage.type.annotation.vala\",\"punctuation.definition.annotation-arguments.begin.vala\"],regex:\"(@[^ (]+)(\\\\()\",push:[{token:\"punctuation.definition.annotation-arguments.end.vala\",regex:\"\\\\)\",next:\"pop\"},{token:[\"constant.other.key.vala\",\"text\",\"keyword.operator.assignment.vala\"],regex:\"(\\\\w*)(\\\\s*)(=)\"},{include:\"#code\"},{token:\"punctuation.seperator.property.vala\",regex:\",\"},{defaultToken:\"meta.declaration.annotation.vala\"}]},{token:\"storage.type.annotation.vala\",regex:\"@\\\\w*\"}],\"#anonymous-classes-and-new\":[{token:\"keyword.control.new.vala\",regex:\"\\\\bnew\\\\b\",push_disabled:[{token:\"text\",regex:\"(?<=\\\\)|\\\\])(?!\\\\s*{)|(?<=})|(?=;)\",TODO:\"FIXME: regexp doesn't have js equivalent\",originalRegex:\"(?<=\\\\)|\\\\])(?!\\\\s*{)|(?<=})|(?=;)\",next:\"pop\"},{token:[\"storage.type.vala\",\"text\"],regex:\"(\\\\w+)(\\\\s*)(?=\\\\[)\",push:[{token:\"text\",regex:\"}|(?=;|\\\\))\",next:\"pop\"},{token:\"text\",regex:\"\\\\[\",push:[{token:\"text\",regex:\"\\\\]\",next:\"pop\"},{include:\"#code\"}]},{token:\"text\",regex:\"{\",push:[{token:\"text\",regex:\"(?=})\",next:\"pop\"},{include:\"#code\"}]}]},{token:\"text\",regex:\"(?=\\\\w.*\\\\()\",push:[{token:\"text\",regex:\"(?<=\\\\))\",TODO:\"FIXME: regexp doesn't have js equivalent\",originalRegex:\"(?<=\\\\))\",next:\"pop\"},{include:\"#object-types\"},{token:\"text\",regex:\"\\\\(\",push:[{token:\"text\",regex:\"\\\\)\",next:\"pop\"},{include:\"#code\"}]}]},{token:\"meta.inner-class.vala\",regex:\"{\",push:[{token:\"meta.inner-class.vala\",regex:\"}\",next:\"pop\"},{include:\"#class-body\"},{defaultToken:\"meta.inner-class.vala\"}]}]}],\"#assertions\":[{token:[\"keyword.control.assert.vala\",\"meta.declaration.assertion.vala\"],regex:\"\\\\b(assert|requires|ensures)(\\\\s)\",push:[{token:\"meta.declaration.assertion.vala\",regex:\"$\",next:\"pop\"},{token:\"keyword.operator.assert.expression-seperator.vala\",regex:\":\"},{include:\"#code\"},{defaultToken:\"meta.declaration.assertion.vala\"}]}],\"#class\":[{token:\"meta.class.vala\",regex:\"(?=\\\\w?[\\\\w\\\\s]*(?:class|(?:@)?interface|enum|struct|namespace)\\\\s+\\\\w+)\",push:[{token:\"punctuation.section.class.end.vala\",regex:\"}\",next:\"pop\"},{include:\"#storage-modifiers\"},{include:\"#comments\"},{token:[\"storage.modifier.vala\",\"meta.class.identifier.vala\",\"entity.name.type.class.vala\"],regex:\"(class|(?:@)?interface|enum|struct|namespace)(\\\\s+)([\\\\w\\\\.]+)\"},{token:\"storage.modifier.extends.vala\",regex:\":\",push:[{token:\"meta.definition.class.inherited.classes.vala\",regex:\"(?={|,)\",next:\"pop\"},{include:\"#object-types-inherited\"},{include:\"#comments\"},{defaultToken:\"meta.definition.class.inherited.classes.vala\"}]},{token:[\"storage.modifier.implements.vala\",\"meta.definition.class.implemented.interfaces.vala\"],regex:\"(,)(\\\\s)\",push:[{token:\"meta.definition.class.implemented.interfaces.vala\",regex:\"(?=\\\\{)\",next:\"pop\"},{include:\"#object-types-inherited\"},{include:\"#comments\"},{defaultToken:\"meta.definition.class.implemented.interfaces.vala\"}]},{token:\"meta.class.body.vala\",regex:\"{\",push:[{token:\"meta.class.body.vala\",regex:\"(?=})\",next:\"pop\"},{include:\"#class-body\"},{defaultToken:\"meta.class.body.vala\"}]},{defaultToken:\"meta.class.vala\"}],comment:\"attempting to put namespace in here.\"}],\"#class-body\":[{include:\"#comments\"},{include:\"#class\"},{include:\"#enums\"},{include:\"#methods\"},{include:\"#annotations\"},{include:\"#storage-modifiers\"},{include:\"#code\"}],\"#code\":[{include:\"#comments\"},{include:\"#class\"},{token:\"text\",regex:\"{\",push:[{token:\"text\",regex:\"}\",next:\"pop\"},{include:\"#code\"}]},{include:\"#assertions\"},{include:\"#parens\"},{include:\"#constants-and-special-vars\"},{include:\"#anonymous-classes-and-new\"},{include:\"#keywords\"},{include:\"#storage-modifiers\"},{include:\"#strings\"},{include:\"#all-types\"}],\"#comments\":[{token:\"punctuation.definition.comment.vala\",regex:\"/\\\\*\\\\*/\"},{include:\"text.html.javadoc\"},{include:\"#comments-inline\"}],\"#comments-inline\":[{token:\"punctuation.definition.comment.vala\",regex:\"/\\\\*\",push:[{token:\"punctuation.definition.comment.vala\",regex:\"\\\\*/\",next:\"pop\"},{defaultToken:\"comment.block.vala\"}]},{token:[\"text\",\"punctuation.definition.comment.vala\",\"comment.line.double-slash.vala\"],regex:\"(\\\\s*)(//)(.*$)\"}],\"#constants-and-special-vars\":[{token:\"constant.language.vala\",regex:\"\\\\b(?:true|false|null)\\\\b\"},{token:\"variable.language.vala\",regex:\"\\\\b(?:this|base)\\\\b\"},{token:\"constant.numeric.vala\",regex:\"\\\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\\\.?[0-9]*|\\\\.[0-9]+)(?:(?:e|E)(?:\\\\+|-)?[0-9]+)?)(?:[LlFfUuDd]|UL|ul)?\\\\b\"},{token:[\"keyword.operator.dereference.vala\",\"constant.other.vala\"],regex:\"((?:\\\\.)?)\\\\b([A-Z][A-Z0-9_]+)(?!<|\\\\.class|\\\\s*\\\\w+\\\\s*=)\\\\b\"}],\"#enums\":[{token:\"text\",regex:\"^(?=\\\\s*[A-Z0-9_]+\\\\s*(?:{|\\\\(|,))\",push:[{token:\"text\",regex:\"(?=;|})\",next:\"pop\"},{token:\"constant.other.enum.vala\",regex:\"\\\\w+\",push:[{token:\"meta.enum.vala\",regex:\"(?=,|;|})\",next:\"pop\"},{include:\"#parens\"},{token:\"text\",regex:\"{\",push:[{token:\"text\",regex:\"}\",next:\"pop\"},{include:\"#class-body\"}]},{defaultToken:\"meta.enum.vala\"}]}]}],\"#keywords\":[{token:\"keyword.control.catch-exception.vala\",regex:\"\\\\b(?:try|catch|finally|throw)\\\\b\"},{token:\"keyword.control.vala\",regex:\"\\\\?|:|\\\\?\\\\?\"},{token:\"keyword.control.vala\",regex:\"\\\\b(?:return|break|case|continue|default|do|while|for|foreach|switch|if|else|in|yield|get|set|value)\\\\b\"},{token:\"keyword.operator.vala\",regex:\"\\\\b(?:typeof|is|as)\\\\b\"},{token:\"keyword.operator.comparison.vala\",regex:\"==|!=|<=|>=|<>|<|>\"},{token:\"keyword.operator.assignment.vala\",regex:\"=\"},{token:\"keyword.operator.increment-decrement.vala\",regex:\"\\\\-\\\\-|\\\\+\\\\+\"},{token:\"keyword.operator.arithmetic.vala\",regex:\"\\\\-|\\\\+|\\\\*|\\\\/|%\"},{token:\"keyword.operator.logical.vala\",regex:\"!|&&|\\\\|\\\\|\"},{token:\"keyword.operator.dereference.vala\",regex:\"\\\\.(?=\\\\S)\",originalRegex:\"(?<=\\\\S)\\\\.(?=\\\\S)\"},{token:\"punctuation.terminator.vala\",regex:\";\"},{token:\"keyword.operator.ownership\",regex:\"owned|unowned\"}],\"#methods\":[{token:\"meta.method.vala\",regex:\"(?!new)(?=\\\\w.*\\\\s+)(?=[^=]+\\\\()\",push:[{token:\"meta.method.vala\",regex:\"}|(?=;)\",next:\"pop\"},{include:\"#storage-modifiers\"},{token:[\"entity.name.function.vala\",\"meta.method.identifier.vala\"],regex:\"([\\\\~\\\\w\\\\.]+)(\\\\s*\\\\()\",push:[{token:\"meta.method.identifier.vala\",regex:\"\\\\)\",next:\"pop\"},{include:\"#parameters\"},{defaultToken:\"meta.method.identifier.vala\"}]},{token:\"meta.method.return-type.vala\",regex:\"(?=\\\\w.*\\\\s+\\\\w+\\\\s*\\\\()\",push:[{token:\"meta.method.return-type.vala\",regex:\"(?=\\\\w+\\\\s*\\\\()\",next:\"pop\"},{include:\"#all-types\"},{defaultToken:\"meta.method.return-type.vala\"}]},{include:\"#throws\"},{token:\"meta.method.body.vala\",regex:\"{\",push:[{token:\"meta.method.body.vala\",regex:\"(?=})\",next:\"pop\"},{include:\"#code\"},{defaultToken:\"meta.method.body.vala\"}]},{defaultToken:\"meta.method.vala\"}]}],\"#namespace\":[{token:\"text\",regex:\"^(?=\\\\s*[A-Z0-9_]+\\\\s*(?:{|\\\\(|,))\",push:[{token:\"text\",regex:\"(?=;|})\",next:\"pop\"},{token:\"constant.other.namespace.vala\",regex:\"\\\\w+\",push:[{token:\"meta.namespace.vala\",regex:\"(?=,|;|})\",next:\"pop\"},{include:\"#parens\"},{token:\"text\",regex:\"{\",push:[{token:\"text\",regex:\"}\",next:\"pop\"},{include:\"#code\"}]},{defaultToken:\"meta.namespace.vala\"}]}],comment:\"This is not quite right. See the class grammar right now\"}],\"#object-types\":[{token:\"storage.type.generic.vala\",regex:\"\\\\b(?:[a-z]\\\\w*\\\\.)*[A-Z]+\\\\w*<\",push:[{token:\"storage.type.generic.vala\",regex:\">|[^\\\\w\\\\s,\\\\?<\\\\[()\\\\]]\",TODO:\"FIXME: regexp doesn't have js equivalent\",originalRegex:\">|[^\\\\w\\\\s,\\\\?<\\\\[(?:[,]+)\\\\]]\",next:\"pop\"},{include:\"#object-types\"},{token:\"storage.type.generic.vala\",regex:\"<\",push:[{token:\"storage.type.generic.vala\",regex:\">|[^\\\\w\\\\s,\\\\[\\\\]<]\",next:\"pop\"},{defaultToken:\"storage.type.generic.vala\"}],comment:\"This is just to support <>'s with no actual type prefix\"},{defaultToken:\"storage.type.generic.vala\"}]},{token:\"storage.type.object.array.vala\",regex:\"\\\\b(?:[a-z]\\\\w*\\\\.)*[A-Z]+\\\\w*(?=\\\\[)\",push:[{token:\"storage.type.object.array.vala\",regex:\"(?=[^\\\\]\\\\s])\",next:\"pop\"},{token:\"text\",regex:\"\\\\[\",push:[{token:\"text\",regex:\"\\\\]\",next:\"pop\"},{include:\"#code\"}]},{defaultToken:\"storage.type.object.array.vala\"}]},{token:[\"storage.type.vala\",\"keyword.operator.dereference.vala\",\"storage.type.vala\"],regex:\"\\\\b(?:([a-z]\\\\w*)(\\\\.))*([A-Z]+\\\\w*\\\\b)\"}],\"#object-types-inherited\":[{token:\"entity.other.inherited-class.vala\",regex:\"\\\\b(?:[a-z]\\\\w*\\\\.)*[A-Z]+\\\\w*<\",push:[{token:\"entity.other.inherited-class.vala\",regex:\">|[^\\\\w\\\\s,<]\",next:\"pop\"},{include:\"#object-types\"},{token:\"storage.type.generic.vala\",regex:\"<\",push:[{token:\"storage.type.generic.vala\",regex:\">|[^\\\\w\\\\s,<]\",next:\"pop\"},{defaultToken:\"storage.type.generic.vala\"}],comment:\"This is just to support <>'s with no actual type prefix\"},{defaultToken:\"entity.other.inherited-class.vala\"}]},{token:[\"entity.other.inherited-class.vala\",\"keyword.operator.dereference.vala\",\"entity.other.inherited-class.vala\"],regex:\"\\\\b(?:([a-z]\\\\w*)(\\\\.))*([A-Z]+\\\\w*)\"}],\"#parameters\":[{token:\"storage.modifier.vala\",regex:\"final\"},{include:\"#primitive-arrays\"},{include:\"#primitive-types\"},{include:\"#object-types\"},{token:\"variable.parameter.vala\",regex:\"\\\\w+\"}],\"#parens\":[{token:\"text\",regex:\"\\\\(\",push:[{token:\"text\",regex:\"\\\\)\",next:\"pop\"},{include:\"#code\"}]}],\"#primitive-arrays\":[{token:\"storage.type.primitive.array.vala\",regex:\"\\\\b(?:bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|int8|int16|int32|int64|uint8|uint16|uint32|uint64)(?:\\\\[\\\\])*\\\\b\"}],\"#primitive-types\":[{token:\"storage.type.primitive.vala\",regex:\"\\\\b(?:var|bool|byte|sbyte|char|decimal|double|float|int|uint|long|ulong|object|short|ushort|string|void|signal|int8|int16|int32|int64|uint8|uint16|uint32|uint64)\\\\b\",comment:\"var is not really a primitive, but acts like one in most cases\"}],\"#storage-modifiers\":[{token:\"storage.modifier.vala\",regex:\"\\\\b(?:public|private|protected|internal|static|final|sealed|virtual|override|abstract|readonly|volatile|dynamic|async|unsafe|out|ref|weak|owned|unowned|const)\\\\b\",comment:\"Not sure about unsafe and readonly\"}],\"#strings\":[{token:\"punctuation.definition.string.begin.vala\",regex:'@\"',push:[{token:\"punctuation.definition.string.end.vala\",regex:'\"',next:\"pop\"},{token:\"constant.character.escape.vala\",regex:\"\\\\\\\\.|%[\\\\w\\\\.\\\\-]+|\\\\$(?:\\\\w+|\\\\([\\\\w\\\\s\\\\+\\\\-\\\\*\\\\/]+\\\\))\"},{defaultToken:\"string.quoted.interpolated.vala\"}]},{token:\"punctuation.definition.string.begin.vala\",regex:'\"',push:[{token:\"punctuation.definition.string.end.vala\",regex:'\"',next:\"pop\"},{token:\"constant.character.escape.vala\",regex:\"\\\\\\\\.\"},{token:\"constant.character.escape.vala\",regex:\"%[\\\\w\\\\.\\\\-]+\"},{defaultToken:\"string.quoted.double.vala\"}]},{token:\"punctuation.definition.string.begin.vala\",regex:\"'\",push:[{token:\"punctuation.definition.string.end.vala\",regex:\"'\",next:\"pop\"},{token:\"constant.character.escape.vala\",regex:\"\\\\\\\\.\"},{defaultToken:\"string.quoted.single.vala\"}]},{token:\"punctuation.definition.string.begin.vala\",regex:'\"\"\"',push:[{token:\"punctuation.definition.string.end.vala\",regex:'\"\"\"',next:\"pop\"},{token:\"constant.character.escape.vala\",regex:\"%[\\\\w\\\\.\\\\-]+\"},{defaultToken:\"string.quoted.triple.vala\"}]}],\"#throws\":[{token:\"storage.modifier.vala\",regex:\"throws\",push:[{token:\"meta.throwables.vala\",regex:\"(?={|;)\",next:\"pop\"},{include:\"#object-types\"},{defaultToken:\"meta.throwables.vala\"}]}],\"#values\":[{include:\"#strings\"},{include:\"#object-types\"},{include:\"#constants-and-special-vars\"}]},this.normalizeRules()};s.metaData={comment:\"Based heavily on the Java bundle's language syntax. TODO:\\n* Closures\\n* Delegates\\n* Properties: Better support for properties.\\n* Annotations\\n* Error domains\\n* Named arguments\\n* Array slicing, negative indexes, multidimensional\\n* construct blocks\\n* lock blocks?\\n* regex literals\\n* DocBlock syntax highlighting. (Currently importing javadoc)\\n* Folding rule for comments.\\n\",fileTypes:[\"vala\"],foldingStartMarker:\"(\\\\{\\\\s*(//.*)?$|^\\\\s*// \\\\{\\\\{\\\\{)\",foldingStopMarker:\"^\\\\s*(\\\\}|// \\\\}\\\\}\\\\}$)\",name:\"Vala\",scopeName:\"source.vala\"},r.inherits(s,i),t.ValaHighlightRules=s}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-vbscript.js",
    "content": "define(\"ace/mode/vbscript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/vbscript_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./vbscript_highlight_rules\").VBScriptHighlightRules,o=function(){this.HighlightRules=s};r.inherits(o,i),function(){this.lineCommentStart=[\"'\",\"REM\"],this.$id=\"ace/mode/vbscript\"}.call(o.prototype),t.Mode=o}),define(\"ace/mode/vbscript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:[\"meta.ending-space\"],regex:\"$\"},{token:[null],regex:\"^(?=\\\\t)\",next:\"state_3\"},{token:[null],regex:\"^(?= )\",next:\"state_4\"},{token:[\"text\",\"storage.type.function.asp\",\"text\",\"entity.name.function.asp\",\"text\",\"punctuation.definition.parameters.asp\",\"variable.parameter.function.asp\",\"punctuation.definition.parameters.asp\"],regex:\"^(\\\\s*)(Function|Sub)(\\\\s*)([a-zA-Z_]\\\\w*)(\\\\s*)(\\\\()([^)]*)(\\\\))\"},{token:\"punctuation.definition.comment.asp\",regex:\"'|REM\",next:\"comment\"},{token:[\"keyword.control.asp\"],regex:\"\\\\b(?:If|Then|Else|ElseIf|Else If|End If|While|Wend|For|To|Each|Case|Select|End Select|Return|Continue|Do|Until|Loop|Next|With|Exit Do|Exit For|Exit Function|Exit Property|Exit Sub|IIf)\\\\b\"},{token:\"keyword.operator.asp\",regex:\"\\\\b(?:Mod|And|Not|Or|Xor|as)\\\\b\"},{token:\"storage.type.asp\",regex:\"Dim|Call|Class|Const|Dim|Redim|Function|Sub|Private Sub|Public Sub|End sub|End Function|Set|Let|Get|New|Randomize|Option Explicit|On Error Resume Next|On Error GoTo\"},{token:\"storage.modifier.asp\",regex:\"\\\\b(?:Private|Public|Default)\\\\b\"},{token:\"constant.language.asp\",regex:\"\\\\b(?:Empty|False|Nothing|Null|True)\\\\b\"},{token:\"punctuation.definition.string.begin.asp\",regex:'\"',next:\"string\"},{token:[\"punctuation.definition.variable.asp\"],regex:\"(\\\\$)[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\\\b\\\\s*\"},{token:\"support.class.asp\",regex:\"\\\\b(?:Application|ObjectContext|Request|Response|Server|Session)\\\\b\"},{token:\"support.class.collection.asp\",regex:\"\\\\b(?:Contents|StaticObjects|ClientCertificate|Cookies|Form|QueryString|ServerVariables)\\\\b\"},{token:\"support.constant.asp\",regex:\"\\\\b(?:TotalBytes|Buffer|CacheControl|Charset|ContentType|Expires|ExpiresAbsolute|IsClientConnected|PICS|Status|ScriptTimeout|CodePage|LCID|SessionID|Timeout)\\\\b\"},{token:\"support.function.asp\",regex:\"\\\\b(?:Lock|Unlock|SetAbort|SetComplete|BinaryRead|AddHeader|AppendToLog|BinaryWrite|Clear|End|Flush|Redirect|Write|CreateObject|HTMLEncode|MapPath|URLEncode|Abandon|Convert|Regex)\\\\b\"},{token:\"support.function.event.asp\",regex:\"\\\\b(?:Application_OnEnd|Application_OnStart|OnTransactionAbort|OnTransactionCommit|Session_OnEnd|Session_OnStart)\\\\b\"},{token:\"support.function.vb.asp\",regex:\"\\\\b(?:Array|Add|Asc|Atn|CBool|CByte|CCur|CDate|CDbl|Chr|CInt|CLng|Conversions|Cos|CreateObject|CSng|CStr|Date|DateAdd|DateDiff|DatePart|DateSerial|DateValue|Day|Derived|Math|Escape|Eval|Exists|Exp|Filter|FormatCurrency|FormatDateTime|FormatNumber|FormatPercent|GetLocale|GetObject|GetRef|Hex|Hour|InputBox|InStr|InStrRev|Int|Fix|IsArray|IsDate|IsEmpty|IsNull|IsNumeric|IsObject|Item|Items|Join|Keys|LBound|LCase|Left|Len|LoadPicture|Log|LTrim|RTrim|Trim|Maths|Mid|Minute|Month|MonthName|MsgBox|Now|Oct|Remove|RemoveAll|Replace|RGB|Right|Rnd|Round|ScriptEngine|ScriptEngineBuildVersion|ScriptEngineMajorVersion|ScriptEngineMinorVersion|Second|SetLocale|Sgn|Sin|Space|Split|Sqr|StrComp|String|StrReverse|Tan|Time|Timer|TimeSerial|TimeValue|TypeName|UBound|UCase|Unescape|VarType|Weekday|WeekdayName|Year)\\\\b\"},{token:[\"constant.numeric.asp\"],regex:\"-?\\\\b(?:(?:0(?:x|X)[0-9a-fA-F]*)|(?:(?:[0-9]+\\\\.?[0-9]*)|(?:\\\\.[0-9]+))(?:(?:e|E)(?:\\\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\\\b\"},{token:\"support.type.vb.asp\",regex:\"\\\\b(?:vbtrue|vbfalse|vbcr|vbcrlf|vbformfeed|vblf|vbnewline|vbnullchar|vbnullstring|int32|vbtab|vbverticaltab|vbbinarycompare|vbtextcomparevbsunday|vbmonday|vbtuesday|vbwednesday|vbthursday|vbfriday|vbsaturday|vbusesystemdayofweek|vbfirstjan1|vbfirstfourdays|vbfirstfullweek|vbgeneraldate|vblongdate|vbshortdate|vblongtime|vbshorttime|vbobjecterror|vbEmpty|vbNull|vbInteger|vbLong|vbSingle|vbDouble|vbCurrency|vbDate|vbString|vbObject|vbError|vbBoolean|vbVariant|vbDataObject|vbDecimal|vbByte|vbArray)\\\\b\"},{token:[\"entity.name.function.asp\"],regex:\"(?:(\\\\b[a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*?\\\\b)(?=\\\\(\\\\)?))\"},{token:[\"keyword.operator.asp\"],regex:\"\\\\-|\\\\+|\\\\*\\\\/|\\\\>|\\\\<|\\\\=|\\\\&\"}],state_3:[{token:[\"meta.odd-tab.tabs\",\"meta.even-tab.tabs\"],regex:\"(\\\\t)(\\\\t)?\"},{token:\"meta.leading-space\",regex:\"(?=[^\\\\t])\",next:\"start\"},{token:\"meta.leading-space\",regex:\".\",next:\"state_3\"}],state_4:[{token:[\"meta.odd-tab.spaces\",\"meta.even-tab.spaces\"],regex:\"(  )(  )?\"},{token:\"meta.leading-space\",regex:\"(?=[^ ])\",next:\"start\"},{defaultToken:\"meta.leading-space\"}],comment:[{token:\"comment.line.apostrophe.asp\",regex:\"$|(?=(?:%>))\",next:\"start\"},{defaultToken:\"comment.line.apostrophe.asp\"}],string:[{token:\"constant.character.escape.apostrophe.asp\",regex:'\"\"'},{token:\"string.quoted.double.asp\",regex:'\"',next:\"start\"},{defaultToken:\"string.quoted.double.asp\"}]}};r.inherits(s,i),t.VBScriptHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-velocity.js",
    "content": "define(\"ace/mode/velocity\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/html\",\"ace/mode/velocity_highlight_rules\",\"ace/mode/folding/velocity\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./html\").Mode,s=e(\"./velocity_highlight_rules\").VelocityHighlightRules,o=e(\"./folding/velocity\").FoldMode,u=function(){i.call(this),this.HighlightRules=s,this.foldingRules=new o};r.inherits(u,i),function(){this.lineCommentStart=\"##\",this.blockComment={start:\"#*\",end:\"*#\"},this.$id=\"ace/mode/velocity\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/css_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/worker/worker_client\",\"ace/mode/behaviour/css\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../worker/worker_client\").WorkerClient,a=e(\"./behaviour/css\").CssBehaviour,f=e(\"./folding/cstyle\").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.foldingRules=\"cStyle\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e).tokens;if(i.length&&i[i.length-1].type==\"comment\")return r;var s=t.match(/^.*\\{\\s*$/);return s&&(r+=n),r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u([\"ace\"],\"ace/mode/css_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),t.on(\"csslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/css\"}.call(l.prototype),t.Mode=l}),define(\"ace/mode/css_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=t.supportType=\"animation-fill-mode|alignment-adjust|alignment-baseline|animation-delay|animation-direction|animation-duration|animation-iteration-count|animation-name|animation-play-state|animation-timing-function|animation|appearance|azimuth|backface-visibility|background-attachment|background-break|background-clip|background-color|background-image|background-origin|background-position|background-repeat|background-size|background|baseline-shift|binding|bleed|bookmark-label|bookmark-level|bookmark-state|bookmark-target|border-bottom|border-bottom-color|border-bottom-left-radius|border-bottom-right-radius|border-bottom-style|border-bottom-width|border-collapse|border-color|border-image|border-image-outset|border-image-repeat|border-image-slice|border-image-source|border-image-width|border-left|border-left-color|border-left-style|border-left-width|border-radius|border-right|border-right-color|border-right-style|border-right-width|border-spacing|border-style|border-top|border-top-color|border-top-left-radius|border-top-right-radius|border-top-style|border-top-width|border-width|border|bottom|box-align|box-decoration-break|box-direction|box-flex-group|box-flex|box-lines|box-ordinal-group|box-orient|box-pack|box-shadow|box-sizing|break-after|break-before|break-inside|caption-side|clear|clip|color-profile|color|column-count|column-fill|column-gap|column-rule|column-rule-color|column-rule-style|column-rule-width|column-span|column-width|columns|content|counter-increment|counter-reset|crop|cue-after|cue-before|cue|cursor|direction|display|dominant-baseline|drop-initial-after-adjust|drop-initial-after-align|drop-initial-before-adjust|drop-initial-before-align|drop-initial-size|drop-initial-value|elevation|empty-cells|fit|fit-position|float-offset|float|font-family|font-size|font-size-adjust|font-stretch|font-style|font-variant|font-weight|font|grid-columns|grid-rows|hanging-punctuation|height|hyphenate-after|hyphenate-before|hyphenate-character|hyphenate-lines|hyphenate-resource|hyphens|icon|image-orientation|image-rendering|image-resolution|inline-box-align|left|letter-spacing|line-height|line-stacking-ruby|line-stacking-shift|line-stacking-strategy|line-stacking|list-style-image|list-style-position|list-style-type|list-style|margin-bottom|margin-left|margin-right|margin-top|margin|mark-after|mark-before|mark|marks|marquee-direction|marquee-play-count|marquee-speed|marquee-style|max-height|max-width|min-height|min-width|move-to|nav-down|nav-index|nav-left|nav-right|nav-up|opacity|orphans|outline-color|outline-offset|outline-style|outline-width|outline|overflow-style|overflow-x|overflow-y|overflow|padding-bottom|padding-left|padding-right|padding-top|padding|page-break-after|page-break-before|page-break-inside|page-policy|page|pause-after|pause-before|pause|perspective-origin|perspective|phonemes|pitch-range|pitch|play-during|pointer-events|position|presentation-level|punctuation-trim|quotes|rendering-intent|resize|rest-after|rest-before|rest|richness|right|rotation-point|rotation|ruby-align|ruby-overhang|ruby-position|ruby-span|size|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|string-set|table-layout|target-name|target-new|target-position|target|text-align-last|text-align|text-decoration|text-emphasis|text-height|text-indent|text-justify|text-outline|text-shadow|text-transform|text-wrap|top|transform-origin|transform-style|transform|transition-delay|transition-duration|transition-property|transition-timing-function|transition|unicode-bidi|vertical-align|visibility|voice-balance|voice-duration|voice-family|voice-pitch-range|voice-pitch|voice-rate|voice-stress|voice-volume|volume|white-space-collapse|white-space|widows|width|word-break|word-spacing|word-wrap|z-index\",u=t.supportFunction=\"rgb|rgba|url|attr|counter|counters\",a=t.supportConstant=\"absolute|after-edge|after|all-scroll|all|alphabetic|always|antialiased|armenian|auto|avoid-column|avoid-page|avoid|balance|baseline|before-edge|before|below|bidi-override|block-line-height|block|bold|bolder|border-box|both|bottom|box|break-all|break-word|capitalize|caps-height|caption|center|central|char|circle|cjk-ideographic|clone|close-quote|col-resize|collapse|column|consider-shifts|contain|content-box|cover|crosshair|cubic-bezier|dashed|decimal-leading-zero|decimal|default|disabled|disc|disregard-shifts|distribute-all-lines|distribute-letter|distribute-space|distribute|dotted|double|e-resize|ease-in|ease-in-out|ease-out|ease|ellipsis|end|exclude-ruby|fill|fixed|georgian|glyphs|grid-height|groove|hand|hanging|hebrew|help|hidden|hiragana-iroha|hiragana|horizontal|icon|ideograph-alpha|ideograph-numeric|ideograph-parenthesis|ideograph-space|ideographic|inactive|include-ruby|inherit|initial|inline-block|inline-box|inline-line-height|inline-table|inline|inset|inside|inter-ideograph|inter-word|invert|italic|justify|katakana-iroha|katakana|keep-all|last|left|lighter|line-edge|line-through|line|linear|list-item|local|loose|lower-alpha|lower-greek|lower-latin|lower-roman|lowercase|lr-tb|ltr|mathematical|max-height|max-size|medium|menu|message-box|middle|move|n-resize|ne-resize|newspaper|no-change|no-close-quote|no-drop|no-open-quote|no-repeat|none|normal|not-allowed|nowrap|nw-resize|oblique|open-quote|outset|outside|overline|padding-box|page|pointer|pre-line|pre-wrap|pre|preserve-3d|progress|relative|repeat-x|repeat-y|repeat|replaced|reset-size|ridge|right|round|row-resize|rtl|s-resize|scroll|se-resize|separate|slice|small-caps|small-caption|solid|space|square|start|static|status-bar|step-end|step-start|steps|stretch|strict|sub|super|sw-resize|table-caption|table-cell|table-column-group|table-column|table-footer-group|table-header-group|table-row-group|table-row|table|tb-rl|text-after-edge|text-before-edge|text-bottom|text-size|text-top|text|thick|thin|transparent|underline|upper-alpha|upper-latin|upper-roman|uppercase|use-script|vertical-ideographic|vertical-text|visible|w-resize|wait|whitespace|z-index|zero\",f=t.supportConstantColor=\"aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow\",l=t.supportConstantFonts=\"arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|serif|monospace\",c=t.numRe=\"\\\\-?(?:(?:[0-9]+)|(?:[0-9]*\\\\.[0-9]+))\",h=t.pseudoElements=\"(\\\\:+)\\\\b(after|before|first-letter|first-line|moz-selection|selection)\\\\b\",p=t.pseudoClasses=\"(:)\\\\b(active|checked|disabled|empty|enabled|first-child|first-of-type|focus|hover|indeterminate|invalid|last-child|last-of-type|link|not|nth-child|nth-last-child|nth-last-of-type|nth-of-type|only-child|only-of-type|required|root|target|valid|visited)\\\\b\",d=function(){var e=this.createKeywordMapper({\"support.function\":u,\"support.constant\":a,\"support.type\":o,\"support.constant.color\":f,\"support.constant.fonts\":l},\"text\",!0);this.$rules={start:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"@.*?{\",push:\"media\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],media:[{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"paren.lparen\",regex:\"\\\\{\",push:\"ruleset\"},{token:\"string\",regex:\"\\\\}\",next:\"pop\"},{token:\"keyword\",regex:\"#[a-z0-9-_]+\"},{token:\"variable\",regex:\"\\\\.[a-z0-9-_]+\"},{token:\"string\",regex:\":[a-z0-9-_]+\"},{token:\"constant\",regex:\"[a-z0-9-_]+\"},{caseInsensitive:!0}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"pop\"},{defaultToken:\"comment\"}],ruleset:[{token:\"paren.rparen\",regex:\"\\\\}\",next:\"pop\"},{token:\"comment\",regex:\"\\\\/\\\\*\",push:\"comment\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:[\"constant.numeric\",\"keyword\"],regex:\"(\"+c+\")(ch|cm|deg|em|ex|fr|gd|grad|Hz|in|kHz|mm|ms|pc|pt|px|rad|rem|s|turn|vh|vm|vw|%)\"},{token:\"constant.numeric\",regex:c},{token:\"constant.numeric\",regex:\"#[a-f0-9]{6}\"},{token:\"constant.numeric\",regex:\"#[a-f0-9]{3}\"},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-element.css\"],regex:h},{token:[\"punctuation\",\"entity.other.attribute-name.pseudo-class.css\"],regex:p},{token:[\"support.function\",\"string\",\"support.function\"],regex:\"(url\\\\()(.*)(\\\\))\"},{token:e,regex:\"\\\\-?[a-zA-Z_][a-zA-Z0-9_\\\\-]*\"},{caseInsensitive:!0}]},this.normalizeRules()};r.inherits(d,s),t.CssHighlightRules=d}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/html_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/css_highlight_rules\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/xml_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./css_highlight_rules\").CssHighlightRules,o=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,u=e(\"./xml_highlight_rules\").XmlHighlightRules,a=i.createMap({a:\"anchor\",button:\"form\",form:\"form\",img:\"image\",input:\"form\",label:\"form\",option:\"form\",script:\"script\",select:\"form\",textarea:\"form\",style:\"style\",table:\"table\",tbody:\"table\",td:\"table\",tfoot:\"table\",th:\"table\",tr:\"table\"}),f=function(){u.call(this),this.addRules({attributes:[{include:\"tag_whitespace\"},{token:\"entity.other.attribute-name.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\",push:[{include:\"tag_whitespace\"},{token:\"string.unquoted.attribute-value.html\",regex:\"[^<>='\\\"`\\\\s]+\",next:\"pop\"},{token:\"empty\",regex:\"\",next:\"pop\"}]},{include:\"attribute_value\"}],tag:[{token:function(e,t){var n=a[t];return[\"meta.tag.punctuation.\"+(e==\"<\"?\"\":\"end-\")+\"tag-open.xml\",\"meta.tag\"+(n?\".\"+n:\"\")+\".tag-name.xml\"]},regex:\"(</?)([-_a-zA-Z0-9:]+)\",next:\"tag_stuff\"}],tag_stuff:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}),this.embedTagRules(s,\"css-\",\"style\"),this.embedTagRules(o,\"js-\",\"script\"),this.constructor===f&&this.normalizeRules()};r.inherits(f,u),t.HtmlHighlightRules=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/mixed\",\"ace/mode/folding/xml\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./mixed\").FoldMode,s=e(\"./xml\").FoldMode,o=e(\"./cstyle\").FoldMode,u=t.FoldMode=function(e,t){i.call(this,new s(e,t),{\"js-\":new o,\"css-\":new o})};r.inherits(u,i)}),define(\"ace/mode/folding/mixed\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=t.FoldMode=function(e,t){this.defaultMode=e,this.subModes=t};r.inherits(s,i),function(){this.$getMode=function(e){typeof e!=\"string\"&&(e=e[0]);for(var t in this.subModes)if(e.indexOf(t)===0)return this.subModes[t];return null},this.$tryMode=function(e,t,n,r){var i=this.$getMode(e);return i?i.getFoldWidget(t,n,r):\"\"},this.getFoldWidget=function(e,t,n){return this.$tryMode(e.getState(n-1),e,t,n)||this.$tryMode(e.getState(n),e,t,n)||this.defaultMode.getFoldWidget(e,t,n)},this.getFoldWidgetRange=function(e,t,n){var r=this.$getMode(e.getState(n-1));if(!r||!r.getFoldWidget(e,t,n))r=this.$getMode(e.getState(n));if(!r||!r.getFoldWidget(e,t,n))r=this.defaultMode;return r.getFoldWidgetRange(e,t,n)}}.call(s.prototype)}),define(\"ace/mode/doc_comment_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment.doc.tag\",regex:\"@[\\\\w\\\\d_]+\"},{token:\"comment.doc.tag\",regex:\"\\\\bTODO\\\\b\"},{defaultToken:\"comment.doc\"}]}};r.inherits(s,i),s.getStartRule=function(e){return{token:\"comment.doc\",regex:\"\\\\/\\\\*(?=\\\\*)\",next:e}},s.getEndRule=function(e){return{token:\"comment.doc\",regex:\"\\\\*\\\\/\",next:e}},t.DocCommentHighlightRules=s}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)}),define(\"ace/mode/javascript_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/doc_comment_highlight_rules\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./doc_comment_highlight_rules\").DocCommentHighlightRules,s=e(\"./text_highlight_rules\").TextHighlightRules,o=function(){var e=this.createKeywordMapper({\"variable.language\":\"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document\",keyword:\"const|yield|import|get|set|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static\",\"storage.type\":\"const|let|var|function\",\"constant.language\":\"null|Infinity|NaN|undefined\",\"support.function\":\"alert\",\"constant.language.boolean\":\"true|false\"},\"identifier\"),t=\"case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void\",n=\"[a-zA-Z\\\\$_\\xa1-\\uffff][a-zA-Z\\\\d\\\\$_\\xa1-\\uffff]*\\\\b\",r=\"\\\\\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)\";this.$rules={no_regex:[{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment\"},i.getStartRule(\"doc-start\"),{token:\"comment\",regex:/\\/\\*/,next:\"comment\"},{token:\"string\",regex:\"'(?=.)\",next:\"qstring\"},{token:\"string\",regex:'\"(?=.)',next:\"qqstring\"},{token:\"constant.numeric\",regex:/0[xX][0-9a-fA-F]+\\b/},{token:\"constant.numeric\",regex:/[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\"],regex:\"(\"+n+\")(\\\\.)(prototype)(\\\\.)(\"+n+\")(\\\\s*)(=)\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"punctuation.operator\",\"entity.name.function\",\"text\",\"keyword.operator\",\"text\",\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\.)(\"+n+\")(\\\\s*)(=)(\\\\s*)(function)(\\\\s+)(\\\\w+)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"storage.type\",\"text\",\"entity.name.function\",\"text\",\"paren.lparen\"],regex:\"(function)(\\\\s+)(\"+n+\")(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"entity.name.function\",\"text\",\"punctuation.operator\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(\"+n+\")(\\\\s*)(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:[\"text\",\"text\",\"storage.type\",\"text\",\"paren.lparen\"],regex:\"(:)(\\\\s*)(function)(\\\\s*)(\\\\()\",next:\"function_arguments\"},{token:\"keyword\",regex:\"(?:\"+t+\")\\\\b\",next:\"start\"},{token:[\"punctuation.operator\",\"support.function\"],regex:/(\\.)(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.function.dom\"],regex:/(\\.)(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName)|ById)|Attribute(?:Node)?)|blur)\\b(?=\\()/},{token:[\"punctuation.operator\",\"support.constant\"],regex:/(\\.)(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\\b/},{token:[\"support.constant\"],regex:/that\\b/},{token:[\"storage.type\",\"punctuation.operator\",\"support.function.firebug\"],regex:/(console)(\\.)(warn|info|log|error|time|trace|timeEnd|assert)\\b/},{token:e,regex:n},{token:\"keyword.operator\",regex:/--|\\+\\+|[!$%&*+\\-~]|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=/,next:\"start\"},{token:\"punctuation.operator\",regex:/\\?|\\:|\\,|\\;|\\./,next:\"start\"},{token:\"paren.lparen\",regex:/[\\[({]/,next:\"start\"},{token:\"paren.rparen\",regex:/[\\])}]/},{token:\"keyword.operator\",regex:/\\/=?/,next:\"start\"},{token:\"comment\",regex:/^#!.*$/}],start:[i.getStartRule(\"doc-start\"),{token:\"comment\",regex:\"\\\\/\\\\*\",next:\"comment_regex_allowed\"},{token:\"comment\",regex:\"\\\\/\\\\/\",next:\"line_comment_regex_allowed\"},{token:\"string.regexp\",regex:\"\\\\/\",next:\"regex\"},{token:\"text\",regex:\"\\\\s+|^$\",next:\"start\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],regex:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"string.regexp\",regex:\"/[sxngimy]*\",next:\"no_regex\"},{token:\"invalid\",regex:/\\{\\d+\\b,?\\d*\\}[+*]|[+*$^?][+*]|[$^][?]|\\?{3,}/},{token:\"constant.language.escape\",regex:/\\(\\?[:=!]|\\)|\\{\\d+\\b,?\\d*\\}|[+*]\\?|[()$^+*?.]/},{token:\"constant.language.delimiter\",regex:/\\|/},{token:\"constant.language.escape\",regex:/\\[\\^?/,next:\"regex_character_class\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp\"}],regex_character_class:[{token:\"regexp.keyword.operator\",regex:\"\\\\\\\\(?:u[\\\\da-fA-F]{4}|x[\\\\da-fA-F]{2}|.)\"},{token:\"constant.language.escape\",regex:\"]\",next:\"regex\"},{token:\"constant.language.escape\",regex:\"-\"},{token:\"empty\",regex:\"$\",next:\"no_regex\"},{defaultToken:\"string.regexp.charachterclass\"}],function_arguments:[{token:\"variable.parameter\",regex:n},{token:\"punctuation.operator\",regex:\"[, ]+\"},{token:\"punctuation.operator\",regex:\"$\"},{token:\"empty\",regex:\"\",next:\"no_regex\"}],comment_regex_allowed:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"start\"},{defaultToken:\"comment\"}],comment:[{token:\"comment\",regex:\"\\\\*\\\\/\",next:\"no_regex\"},{defaultToken:\"comment\"}],line_comment_regex_allowed:[{token:\"comment\",regex:\"$|^\",next:\"start\"},{defaultToken:\"comment\"}],line_comment:[{token:\"comment\",regex:\"$|^\",next:\"no_regex\"},{defaultToken:\"comment\"}],qqstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qqstring\"},{token:\"string\",regex:'\"|$',next:\"no_regex\"},{defaultToken:\"string\"}],qstring:[{token:\"constant.language.escape\",regex:r},{token:\"string\",regex:\"\\\\\\\\$\",next:\"qstring\"},{token:\"string\",regex:\"'|$\",next:\"no_regex\"},{defaultToken:\"string\"}]},this.embedRules(i,\"doc-\",[i.getEndRule(\"no_regex\")])};r.inherits(o,s),t.JavaScriptHighlightRules=o}),define(\"ace/mode/html_completions\",[\"require\",\"exports\",\"module\",\"ace/token_iterator\"],function(e,t,n){function f(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}function l(e,t){var n=new r(e,t.row,t.column),i=n.getCurrentToken();while(i&&!f(i,\"tag-name\"))i=n.stepBackward();if(i)return i.value}var r=e(\"../token_iterator\").TokenIterator,i=[\"accesskey\",\"class\",\"contenteditable\",\"contextmenu\",\"dir\",\"draggable\",\"dropzone\",\"hidden\",\"id\",\"inert\",\"itemid\",\"itemprop\",\"itemref\",\"itemscope\",\"itemtype\",\"lang\",\"spellcheck\",\"style\",\"tabindex\",\"title\",\"translate\"],s=[\"onabort\",\"onblur\",\"oncancel\",\"oncanplay\",\"oncanplaythrough\",\"onchange\",\"onclick\",\"onclose\",\"oncontextmenu\",\"oncuechange\",\"ondblclick\",\"ondrag\",\"ondragend\",\"ondragenter\",\"ondragleave\",\"ondragover\",\"ondragstart\",\"ondrop\",\"ondurationchange\",\"onemptied\",\"onended\",\"onerror\",\"onfocus\",\"oninput\",\"oninvalid\",\"onkeydown\",\"onkeypress\",\"onkeyup\",\"onload\",\"onloadeddata\",\"onloadedmetadata\",\"onloadstart\",\"onmousedown\",\"onmousemove\",\"onmouseout\",\"onmouseover\",\"onmouseup\",\"onmousewheel\",\"onpause\",\"onplay\",\"onplaying\",\"onprogress\",\"onratechange\",\"onreset\",\"onscroll\",\"onseeked\",\"onseeking\",\"onselect\",\"onshow\",\"onstalled\",\"onsubmit\",\"onsuspend\",\"ontimeupdate\",\"onvolumechange\",\"onwaiting\"],o=i.concat(s),u={html:[\"manifest\"],head:[],title:[],base:[\"href\",\"target\"],link:[\"href\",\"hreflang\",\"rel\",\"media\",\"type\",\"sizes\"],meta:[\"http-equiv\",\"name\",\"content\",\"charset\"],style:[\"type\",\"media\",\"scoped\"],script:[\"charset\",\"type\",\"src\",\"defer\",\"async\"],noscript:[\"href\"],body:[\"onafterprint\",\"onbeforeprint\",\"onbeforeunload\",\"onhashchange\",\"onmessage\",\"onoffline\",\"onpopstate\",\"onredo\",\"onresize\",\"onstorage\",\"onundo\",\"onunload\"],section:[],nav:[],article:[\"pubdate\"],aside:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],header:[],footer:[],address:[],main:[],p:[],hr:[],pre:[],blockquote:[\"cite\"],ol:[\"start\",\"reversed\"],ul:[],li:[\"value\"],dl:[],dt:[],dd:[],figure:[],figcaption:[],div:[],a:[\"href\",\"target\",\"ping\",\"rel\",\"media\",\"hreflang\",\"type\"],em:[],strong:[],small:[],s:[],cite:[],q:[\"cite\"],dfn:[],abbr:[],data:[],time:[\"datetime\"],code:[],\"var\":[],samp:[],kbd:[],sub:[],sup:[],i:[],b:[],u:[],mark:[],ruby:[],rt:[],rp:[],bdi:[],bdo:[],span:[],br:[],wbr:[],ins:[\"cite\",\"datetime\"],del:[\"cite\",\"datetime\"],img:[\"alt\",\"src\",\"height\",\"width\",\"usemap\",\"ismap\"],iframe:[\"name\",\"src\",\"height\",\"width\",\"sandbox\",\"seamless\"],embed:[\"src\",\"height\",\"width\",\"type\"],object:[\"param\",\"data\",\"type\",\"height\",\"width\",\"usemap\",\"name\",\"form\",\"classid\"],param:[\"name\",\"value\"],video:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\",\"width\",\"height\",\"poster\"],audio:[\"src\",\"autobuffer\",\"autoplay\",\"loop\",\"controls\"],source:[\"src\",\"type\",\"media\"],track:[\"kind\",\"src\",\"srclang\",\"label\",\"default\"],canvas:[\"width\",\"height\"],map:[\"name\"],area:[\"shape\",\"coords\",\"href\",\"hreflang\",\"alt\",\"target\",\"media\",\"rel\",\"ping\",\"type\"],svg:[],math:[],table:[\"summary\"],caption:[],colgroup:[\"span\"],col:[\"span\"],tbody:[],thead:[],tfoot:[],tr:[],td:[\"headers\",\"rowspan\",\"colspan\"],th:[\"headers\",\"rowspan\",\"colspan\",\"scope\"],form:[\"accept-charset\",\"action\",\"autocomplete\",\"enctype\",\"method\",\"name\",\"novalidate\",\"target\"],fieldset:[\"disabled\",\"form\",\"name\"],legend:[],label:[\"form\",\"for\"],input:[\"type\",\"accept\",\"alt\",\"autocomplete\",\"checked\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"height\",\"list\",\"max\",\"maxlength\",\"min\",\"multiple\",\"pattern\",\"placeholder\",\"readonly\",\"required\",\"size\",\"src\",\"step\",\"width\",\"files\",\"value\"],button:[\"autofocus\",\"disabled\",\"form\",\"formaction\",\"formenctype\",\"formmethod\",\"formnovalidate\",\"formtarget\",\"name\",\"value\",\"type\"],select:[\"autofocus\",\"disabled\",\"form\",\"multiple\",\"name\",\"size\"],datalist:[],optgroup:[\"disabled\",\"label\"],option:[\"disabled\",\"selected\",\"label\",\"value\"],textarea:[\"autofocus\",\"disabled\",\"form\",\"maxlength\",\"name\",\"placeholder\",\"readonly\",\"required\",\"rows\",\"cols\",\"wrap\"],keygen:[\"autofocus\",\"challenge\",\"disabled\",\"form\",\"keytype\",\"name\"],output:[\"for\",\"form\",\"name\"],progress:[\"value\",\"max\"],meter:[\"value\",\"min\",\"max\",\"low\",\"high\",\"optimum\"],details:[\"open\"],summary:[],command:[\"type\",\"label\",\"icon\",\"disabled\",\"checked\",\"radiogroup\",\"command\"],menu:[\"type\",\"label\"],dialog:[\"open\"]},a=Object.keys(u),c=function(){};(function(){this.getCompletions=function(e,t,n,r){var i=t.getTokenAt(n.row,n.column);return i?f(i,\"tag-name\")||f(i,\"tag-open\")||f(i,\"end-tag-open\")?this.getTagCompletions(e,t,n,r):f(i,\"tag-whitespace\")||f(i,\"attribute-name\")?this.getAttributeCompetions(e,t,n,r):[]:[]},this.getTagCompletions=function(e,t,n,r){return a.map(function(e){return{value:e,meta:\"tag\",score:Number.MAX_VALUE}})},this.getAttributeCompetions=function(e,t,n,r){var i=l(t,n);if(!i)return[];var s=o;return i in u&&(s=s.concat(u[i])),s.map(function(e){return{caption:e,snippet:e+'=\"$0\"',meta:\"attribute\",score:Number.MAX_VALUE}})}}).call(c.prototype),t.HtmlCompletions=c}),define(\"ace/mode/javascript\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/javascript_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/range\",\"ace/worker/worker_client\",\"ace/mode/behaviour/cstyle\",\"ace/mode/folding/cstyle\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./javascript_highlight_rules\").JavaScriptHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"../range\").Range,a=e(\"../worker/worker_client\").WorkerClient,f=e(\"./behaviour/cstyle\").CstyleBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new f,this.foldingRules=new l};r.inherits(c,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type==\"comment\")return r;if(e==\"start\"||e==\"no_regex\"){var u=t.match(/^.*(?:\\bcase\\b.*\\:|[\\{\\(\\[])\\s*$/);u&&(r+=n)}else if(e==\"doc-start\"){if(o==\"start\"||o==\"no_regex\")return\"\";var u=t.match(/^\\s*(\\/?)\\*/);u&&(u[1]&&(r+=\" \"),r+=\"* \")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new a([\"ace\"],\"ace/mode/javascript_worker\",\"JavaScriptWorker\");return t.attachToDocument(e.getDocument()),t.on(\"jslint\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/javascript\"}.call(c.prototype),t.Mode=c}),define(\"ace/mode/velocity_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text_highlight_rules\",\"ace/mode/html_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text_highlight_rules\").TextHighlightRules,o=e(\"./html_highlight_rules\").HtmlHighlightRules,u=function(){o.call(this);var e=i.arrayToMap(\"true|false|null\".split(\"|\")),t=i.arrayToMap(\"_DateTool|_DisplayTool|_EscapeTool|_FieldTool|_MathTool|_NumberTool|_SerializerTool|_SortTool|_StringTool|_XPathTool\".split(\"|\")),n=i.arrayToMap(\"$contentRoot|$foreach\".split(\"|\")),r=i.arrayToMap(\"#set|#macro|#include|#parse|#if|#elseif|#else|#foreach|#break|#end|#stop\".split(\"|\"));this.$rules.start.push({token:\"comment\",regex:\"##.*$\"},{token:\"comment.block\",regex:\"#\\\\*\",next:\"vm_comment\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:function(i){return r.hasOwnProperty(i)?\"keyword\":e.hasOwnProperty(i)?\"constant.language\":n.hasOwnProperty(i)?\"variable.language\":t.hasOwnProperty(i)||t.hasOwnProperty(i.substring(1))?\"support.function\":i==\"debugger\"?\"invalid.deprecated\":i.match(/^(\\$[a-zA-Z_][a-zA-Z0-9_]*)$/)?\"variable\":\"identifier\"},regex:\"[a-zA-Z$#][a-zA-Z0-9_]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|&|\\\\*|\\\\-|\\\\+|=|!=|<=|>=|<|>|&&|\\\\|\\\\|\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}),this.$rules.vm_comment=[{token:\"comment\",regex:\"\\\\*#|-->\",next:\"start\"},{defaultToken:\"comment\"}],this.$rules.vm_start=[{token:\"variable\",regex:\"}\",next:\"pop\"},{token:\"string.regexp\",regex:\"[/](?:(?:\\\\[(?:\\\\\\\\]|[^\\\\]])+\\\\])|(?:\\\\\\\\/|[^\\\\]/]))*[/]\\\\w*\\\\s*(?=[).,;]|$)\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:\"0[xX][0-9a-fA-F]+\\\\b\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"constant.language.boolean\",regex:\"(?:true|false)\\\\b\"},{token:function(i){return r.hasOwnProperty(i)?\"keyword\":e.hasOwnProperty(i)?\"constant.language\":n.hasOwnProperty(i)?\"variable.language\":t.hasOwnProperty(i)||t.hasOwnProperty(i.substring(1))?\"support.function\":i==\"debugger\"?\"invalid.deprecated\":i.match(/^(\\$[a-zA-Z_$][a-zA-Z0-9_]*)$/)?\"variable\":\"identifier\"},regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"!|&|\\\\*|\\\\-|\\\\+|=|!=|<=|>=|<|>|&&|\\\\|\\\\|\"},{token:\"lparen\",regex:\"[[({]\"},{token:\"rparen\",regex:\"[\\\\])}]\"},{token:\"text\",regex:\"\\\\s+\"}];for(var s in this.$rules)this.$rules[s].unshift({token:\"variable\",regex:\"\\\\${\",push:\"vm_start\"});this.normalizeRules()};r.inherits(u,s),t.VelocityHighlightRules=u}),define(\"ace/mode/html\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/javascript\",\"ace/mode/css\",\"ace/mode/html_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/html\",\"ace/mode/html_completions\",\"ace/worker/worker_client\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./javascript\").Mode,u=e(\"./css\").Mode,a=e(\"./html_highlight_rules\").HtmlHighlightRules,f=e(\"./behaviour/xml\").XmlBehaviour,l=e(\"./folding/html\").FoldMode,c=e(\"./html_completions\").HtmlCompletions,h=e(\"../worker/worker_client\").WorkerClient,p=[\"area\",\"base\",\"br\",\"col\",\"embed\",\"hr\",\"img\",\"input\",\"keygen\",\"link\",\"meta\",\"param\",\"source\",\"track\",\"wbr\"],d=[\"li\",\"dt\",\"dd\",\"p\",\"rt\",\"rp\",\"optgroup\",\"option\",\"colgroup\",\"td\",\"th\"],v=function(e){this.fragmentContext=e&&e.fragmentContext,this.HighlightRules=a,this.$behaviour=new f,this.$completer=new c,this.createModeDelegates({\"js-\":o,\"css-\":u}),this.foldingRules=new l(this.voidElements,i.arrayToMap(d))};r.inherits(v,s),function(){this.blockComment={start:\"<!--\",end:\"-->\"},this.voidElements=i.arrayToMap(p),this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.getCompletions=function(e,t,n,r){return this.$completer.getCompletions(e,t,n,r)},this.createWorker=function(e){if(this.constructor!=v)return;var t=new h([\"ace\"],\"ace/mode/html_worker\",\"Worker\");return t.attachToDocument(e.getDocument()),this.fragmentContext&&t.call(\"setOptions\",[{context:this.fragmentContext}]),t.on(\"error\",function(t){e.setAnnotations(t.data)}),t.on(\"terminate\",function(){e.clearAnnotations()}),t},this.$id=\"ace/mode/html\"}.call(v.prototype),t.Mode=v}),define(\"ace/mode/folding/velocity\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"##\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"##\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"##\"&&s[i]==\"##\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"##\"&&o[i]==\"##\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)}),define(\"ace/mode/behaviour/css\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/token_iterator\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../../token_iterator\").TokenIterator,u=function(){this.inherit(s),this.add(\"colon\",\"insertion\",function(e,t,n,r,i){if(i===\":\"){var s=n.getCursorPosition(),u=new o(r,s.row,s.column),a=u.getCurrentToken();a&&a.value.match(/\\s+/)&&(a=u.stepBackward());if(a&&a.type===\"support.type\"){var f=r.doc.getLine(s.row),l=f.substring(s.column,s.column+1);if(l===\":\")return{text:\"\",selection:[1,1]};if(!f.substring(s.column).match(/^\\s*;/))return{text:\":;\",selection:[1,1]}}}}),this.add(\"colon\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s===\":\"){var u=n.getCursorPosition(),a=new o(r,u.row,u.column),f=a.getCurrentToken();f&&f.value.match(/\\s+/)&&(f=a.stepBackward());if(f&&f.type===\"support.type\"){var l=r.doc.getLine(i.start.row),c=l.substring(i.end.column,i.end.column+1);if(c===\";\")return i.end.column++,i}}}),this.add(\"semicolon\",\"insertion\",function(e,t,n,r,i){if(i===\";\"){var s=n.getCursorPosition(),o=r.doc.getLine(s.row),u=o.substring(s.column,s.column+1);if(u===\";\")return{text:\"\",selection:[1,1]}}})};r.inherits(u,s),t.CssBehaviour=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-verilog.js",
    "content": "define(\"ace/mode/verilog\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/verilog_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./verilog_highlight_rules\").VerilogHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"//\",this.blockComment={start:\"/*\",end:\"*/\"},this.$id=\"ace/mode/verilog\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/verilog_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"always|and|assign|automatic|begin|buf|bufif0|bufif1|case|casex|casez|cell|cmos|config|deassign|default|defparam|design|disable|edge|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|event|for|force|forever|fork|function|generate|genvar|highz0|highz1|if|ifnone|incdir|include|initial|inout|input|instance|integer|join|large|liblist|library|localparam|macromodule|medium|module|nand|negedge|nmos|nor|noshowcancelled|not|notif0|notif1|or|output|parameter|pmos|posedge|primitive|pull0|pull1|pulldown|pullup|pulsestyle_onevent|pulsestyle_ondetect|rcmos|real|realtime|reg|release|repeat|rnmos|rpmos|rtran|rtranif0|rtranif1|scalared|showcancelled|signed|small|specify|specparam|strong0|strong1|supply0|supply1|table|task|time|tran|tranif0|tranif1|tri|tri0|tri1|triand|trior|trireg|unsigned|use|vectored|wait|wand|weak0|weak1|while|wire|wor|xnor|xorbegin|bufif0|bufif1|case|casex|casez|config|else|end|endcase|endconfig|endfunction|endgenerate|endmodule|endprimitive|endspecify|endtable|endtask|for|forever|function|generate|if|ifnone|macromodule|module|primitive|repeat|specify|table|task|while\",t=\"true|false|null\",n=\"count|min|max|avg|sum|rank|now|coalesce|main\",r=this.createKeywordMapper({\"support.function\":n,keyword:e,\"constant.language\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"//.*$\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:r,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"\\\\+|\\\\-|\\\\/|\\\\/\\\\/|%|<@>|@>|<@|&|\\\\^|~|<|>|<=|=>|==|!=|<>|=\"},{token:\"paren.lparen\",regex:\"[\\\\(]\"},{token:\"paren.rparen\",regex:\"[\\\\)]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.VerilogHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-vhdl.js",
    "content": "define(\"ace/mode/vhdl\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/vhdl_highlight_rules\",\"ace/range\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./vhdl_highlight_rules\").VHDLHighlightRules,o=e(\"../range\").Range,u=function(){this.HighlightRules=s};r.inherits(u,i),function(){this.lineCommentStart=\"--\",this.$id=\"ace/mode/vhdl\"}.call(u.prototype),t.Mode=u}),define(\"ace/mode/vhdl_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){var e=\"access|after|ailas|all|architecture|assert|attribute|begin|block|buffer|bus|case|component|configuration|disconnect|downto|else|elsif|end|entity|file|for|function|generate|generic|guarded|if|impure|in|inertial|inout|is|label|linkage|literal|loop|mapnew|next|of|on|open|others|out|port|process|pure|range|record|reject|report|return|select|shared|subtype|then|to|transport|type|unaffected|united|until|wait|when|while|with\",t=\"bit|bit_vector|boolean|character|integer|line|natural|positive|real|register|severity|signal|signed|std_logic|std_logic_vector|string||text|time|unsigned|variable\",n=\"array|constant\",r=\"abs|and|mod|nand|nor|not|rem|rol|ror|sla|sll|srasrl|xnor|xor\",i=\"true|false|null\",s=this.createKeywordMapper({\"keyword.operator\":r,keyword:e,\"constant.language\":i,\"storage.modifier\":n,\"storage.type\":t},\"identifier\",!0);this.$rules={start:[{token:\"comment\",regex:\"--.*$\"},{token:\"string\",regex:'\".*?\"'},{token:\"string\",regex:\"'.*?'\"},{token:\"constant.numeric\",regex:\"[+-]?\\\\d+(?:(?:\\\\.\\\\d*)?(?:[eE][+-]?\\\\d+)?)?\\\\b\"},{token:\"keyword\",regex:\"\\\\s*(?:library|package|use)\\\\b\"},{token:s,regex:\"[a-zA-Z_$][a-zA-Z0-9_$]*\\\\b\"},{token:\"keyword.operator\",regex:\"&|\\\\*|\\\\+|\\\\-|\\\\/|<|=|>|\\\\||=>|\\\\*\\\\*|:=|\\\\/=|>=|<=|<>\"},{token:\"punctuation.operator\",regex:\"\\\\'|\\\\:|\\\\,|\\\\;|\\\\.\"},{token:\"paren.lparen\",regex:\"[[(]\"},{token:\"paren.rparen\",regex:\"[\\\\])]\"},{token:\"text\",regex:\"\\\\s+\"}]}};r.inherits(s,i),t.VHDLHighlightRules=s})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-xml.js",
    "content": "define(\"ace/mode/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/mode/text\",\"ace/mode/xml_highlight_rules\",\"ace/mode/behaviour/xml\",\"ace/mode/folding/xml\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"./text\").Mode,o=e(\"./xml_highlight_rules\").XmlHighlightRules,u=e(\"./behaviour/xml\").XmlBehaviour,a=e(\"./folding/xml\").FoldMode,f=function(){this.HighlightRules=o,this.$behaviour=new u,this.foldingRules=new a};r.inherits(f,s),function(){this.voidElements=i.arrayToMap([]),this.blockComment={start:\"<!--\",end:\"-->\"},this.$id=\"ace/mode/xml\"}.call(f.prototype),t.Mode=f}),define(\"ace/mode/xml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(e){this.$rules={start:[{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\",next:\"cdata\"},{token:[\"punctuation.xml-decl.xml\",\"keyword.xml-decl.xml\"],regex:\"(<\\\\?)(xml)(?=[\\\\s])\",next:\"xml_decl\",caseInsensitive:!0},{token:[\"punctuation.instruction.xml\",\"keyword.instruction.xml\"],regex:\"(<\\\\?)([-_a-zA-Z0-9]+)\",next:\"processing_instruction\"},{token:\"comment.xml\",regex:\"<\\\\!--\",next:\"comment\"},{token:[\"xml-pe.doctype.xml\",\"xml-pe.doctype.xml\"],regex:\"(<\\\\!)(DOCTYPE)(?=[\\\\s])\",next:\"doctype\",caseInsensitive:!0},{include:\"tag\"},{token:\"text.end-tag-open.xml\",regex:\"</\"},{token:\"text.tag-open.xml\",regex:\"<\"},{include:\"reference\"},{defaultToken:\"text.xml\"}],xml_decl:[{token:\"entity.other.attribute-name.decl-attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.decl-attribute-equals.xml\",regex:\"=\"},{include:\"whitespace\"},{include:\"string\"},{token:\"punctuation.xml-decl.xml\",regex:\"\\\\?>\",next:\"start\"}],processing_instruction:[{token:\"punctuation.instruction.xml\",regex:\"\\\\?>\",next:\"start\"},{defaultToken:\"instruction.xml\"}],doctype:[{include:\"whitespace\"},{include:\"string\"},{token:\"xml-pe.doctype.xml\",regex:\">\",next:\"start\"},{token:\"xml-pe.xml\",regex:\"[-_a-zA-Z0-9:]+\"},{token:\"punctuation.int-subset\",regex:\"\\\\[\",push:\"int_subset\"}],int_subset:[{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"punctuation.int-subset.xml\",regex:\"]\",next:\"pop\"},{token:[\"punctuation.markup-decl.xml\",\"keyword.markup-decl.xml\"],regex:\"(<\\\\!)([-_a-zA-Z0-9]+)\",push:[{token:\"text\",regex:\"\\\\s+\"},{token:\"punctuation.markup-decl.xml\",regex:\">\",next:\"pop\"},{include:\"string\"}]}],cdata:[{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\",next:\"start\"},{token:\"text.xml\",regex:\"\\\\s+\"},{token:\"text.xml\",regex:\"(?:[^\\\\]]|\\\\](?!\\\\]>))+\"}],comment:[{token:\"comment.xml\",regex:\"-->\",next:\"start\"},{defaultToken:\"comment.xml\"}],reference:[{token:\"constant.language.escape.reference.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],attr_reference:[{token:\"constant.language.escape.reference.attribute-value.xml\",regex:\"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\\\.-]+;)\"}],tag:[{token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.tag-name.xml\"],regex:\"(?:(<)|(</))((?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+)\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\"}]}],tag_whitespace:[{token:\"text.tag-whitespace.xml\",regex:\"\\\\s+\"}],whitespace:[{token:\"text.whitespace.xml\",regex:\"\\\\s+\"}],string:[{token:\"string.xml\",regex:\"'\",push:[{token:\"string.xml\",regex:\"'\",next:\"pop\"},{defaultToken:\"string.xml\"}]},{token:\"string.xml\",regex:'\"',push:[{token:\"string.xml\",regex:'\"',next:\"pop\"},{defaultToken:\"string.xml\"}]}],attributes:[{token:\"entity.other.attribute-name.xml\",regex:\"(?:[-_a-zA-Z0-9]+:)?[-_a-zA-Z0-9]+\"},{token:\"keyword.operator.attribute-equals.xml\",regex:\"=\"},{include:\"tag_whitespace\"},{include:\"attribute_value\"}],attribute_value:[{token:\"string.attribute-value.xml\",regex:\"'\",push:[{token:\"string.attribute-value.xml\",regex:\"'\",next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]},{token:\"string.attribute-value.xml\",regex:'\"',push:[{token:\"string.attribute-value.xml\",regex:'\"',next:\"pop\"},{include:\"attr_reference\"},{defaultToken:\"string.attribute-value.xml\"}]}]},this.constructor===s&&this.normalizeRules()};(function(){this.embedTagRules=function(e,t,n){this.$rules.tag.unshift({token:[\"meta.tag.punctuation.tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(<)(\"+n+\"(?=\\\\s|>|$))\",next:[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:t+\"start\"}]}),this.$rules[n+\"-end\"]=[{include:\"attributes\"},{token:\"meta.tag.punctuation.tag-close.xml\",regex:\"/?>\",next:\"start\",onMatch:function(e,t,n){return n.splice(0),this.token}}],this.embedRules(e,t,[{token:[\"meta.tag.punctuation.end-tag-open.xml\",\"meta.tag.\"+n+\".tag-name.xml\"],regex:\"(</)(\"+n+\"(?=\\\\s|>|$))\",next:n+\"-end\"},{token:\"string.cdata.xml\",regex:\"<\\\\!\\\\[CDATA\\\\[\"},{token:\"string.cdata.xml\",regex:\"\\\\]\\\\]>\"}])}}).call(i.prototype),r.inherits(s,i),t.XmlHighlightRules=s}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/range\",\"ace/mode/folding/fold_mode\",\"ace/token_iterator\"],function(e,t,n){function l(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../../lib/lang\"),s=e(\"../../range\").Range,o=e(\"./fold_mode\").FoldMode,u=e(\"../../token_iterator\").TokenIterator,a=t.FoldMode=function(e,t){o.call(this),this.voidElements=r.mixin(e||{},t||{})};r.inherits(a,o);var f=function(){this.tagName=\"\",this.closing=!1,this.selfClosing=!1,this.start={row:0,column:0},this.end={row:0,column:0}};(function(){this.getFoldWidget=function(e,t,n){var r=this._getFirstTagInLine(e,n);return r?r.closing||!r.tagName&&r.selfClosing?t==\"markbeginend\"?\"end\":\"\":!r.tagName||r.selfClosing||this.voidElements.hasOwnProperty(r.tagName.toLowerCase())?\"\":this._findEndTagInLine(e,n,r.tagName,r.end.column)?\"\":\"start\":\"\"},this._getFirstTagInLine=function(e,t){var n=e.getTokens(t),r=new f;for(var i=0;i<n.length;i++){var s=n[i];if(l(s,\"tag-open\")){r.end.column=r.start.column+s.value.length,r.closing=l(s,\"end-tag-open\"),s=n[++i];if(!s)return null;r.tagName=s.value,r.end.column+=s.value.length;for(i++;i<n.length;i++){s=n[i],r.end.column+=s.value.length;if(l(s,\"tag-close\")){r.selfClosing=s.value==\"/>\";break}}return r}if(l(s,\"tag-close\"))return r.selfClosing=s.value==\"/>\",r;r.start.column+=s.value.length}return null},this._findEndTagInLine=function(e,t,n,r){var i=e.getTokens(t),s=0;for(var o=0;o<i.length;o++){var u=i[o];s+=u.value.length;if(s<r)continue;if(l(u,\"end-tag-open\")){u=i[o+1];if(u&&u.value==n)return!0}}return!1},this._readTagForward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do if(l(t,\"tag-open\"))n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn();else if(l(t,\"tag-name\"))n.tagName=t.value;else if(l(t,\"tag-close\"))return n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length,e.stepForward(),n;while(t=e.stepForward());return null},this._readTagBackward=function(e){var t=e.getCurrentToken();if(!t)return null;var n=new f;do{if(l(t,\"tag-open\"))return n.closing=l(t,\"end-tag-open\"),n.start.row=e.getCurrentTokenRow(),n.start.column=e.getCurrentTokenColumn(),e.stepBackward(),n;l(t,\"tag-name\")?n.tagName=t.value:l(t,\"tag-close\")&&(n.selfClosing=t.value==\"/>\",n.end.row=e.getCurrentTokenRow(),n.end.column=e.getCurrentTokenColumn()+t.value.length)}while(t=e.stepBackward());return null},this._pop=function(e,t){while(e.length){var n=e[e.length-1];if(!t||n.tagName==t.tagName)return e.pop();if(this.voidElements.hasOwnProperty(t.tagName))return;if(this.voidElements.hasOwnProperty(n.tagName)){e.pop();continue}return null}},this.getFoldWidgetRange=function(e,t,n){var r=this._getFirstTagInLine(e,n);if(!r)return null;var i=r.closing||r.selfClosing,o=[],a;if(!i){var f=new u(e,n,r.start.column),l={row:n,column:r.start.column+r.tagName.length+2};while(a=this._readTagForward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(a.closing){this._pop(o,a);if(o.length==0)return s.fromPoints(l,a.start)}else o.push(a)}}else{var f=new u(e,n,r.end.column),c={row:n,column:r.start.column};while(a=this._readTagBackward(f)){if(a.selfClosing){if(!o.length)return a.start.column+=a.tagName.length+2,a.end.column-=2,s.fromPoints(a.start,a.end);continue}if(!a.closing){this._pop(o,a);if(o.length==0)return a.start.column+=a.tagName.length+2,s.fromPoints(a.start,c)}else o.push(a)}}}}).call(a.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-xquery.js",
    "content": "define(\"ace/mode/xquery\",[\"require\",\"exports\",\"module\",\"ace/worker/worker_client\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/text_highlight_rules\",\"ace/mode/xquery/xquery_lexer\",\"ace/range\",\"ace/mode/behaviour/xquery\",\"ace/mode/folding/cstyle\",\"ace/anchor\",\"ace/ext/language_tools\"],function(e,t,n){var r=e(\"../worker/worker_client\").WorkerClient,i=e(\"../lib/oop\"),s=e(\"./text\").Mode,o=e(\"./text_highlight_rules\").TextHighlightRules,u=e(\"./xquery/xquery_lexer\").XQueryLexer,a=e(\"../range\").Range,f=e(\"./behaviour/xquery\").XQueryBehaviour,l=e(\"./folding/cstyle\").FoldMode,c=e(\"../anchor\").Anchor,h=e(\"../ext/language_tools\"),p=function(){this.$tokenizer=new u,this.$behaviour=new f,this.foldingRules=new l,this.$highlightRules=new o};i.inherits(p,s),function(){h.addCompleter({getCompletions:function(e,t,n,r,i){t.$worker.emit(\"complete\",{data:{pos:n,prefix:r}}),t.$worker.on(\"complete\",function(e){i(null,e.data)})}}),this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=t.match(/\\s*(?:then|else|return|[{\\(]|<\\w+>)\\s*$/);return i&&(r+=n),r},this.checkOutdent=function(e,t,n){return/^\\s+$/.test(t)?/^\\s*[\\}\\)]/.test(n):!1},this.autoOutdent=function(e,t,n){var r=t.getLine(n),i=r.match(/^(\\s*[\\}\\)])/);if(!i)return 0;var s=i[1].length,o=t.findMatchingBracket({row:n,column:s});if(!o||o.row==n)return 0;var u=this.$getIndent(t.getLine(o.row));t.replace(new a(n,0,n,s-1),u)},this.toggleCommentLines=function(e,t,n,r){var i,s,o=!0,u=/^\\s*\\(:(.*):\\)/;for(i=n;i<=r;i++)if(!u.test(t.getLine(i))){o=!1;break}var f=new a(0,0,0,0);for(i=n;i<=r;i++)s=t.getLine(i),f.start.row=i,f.end.row=i,f.end.column=s.length,t.replace(f,o?s.match(u)[1]:\"(:\"+s+\":)\")},this.createWorker=function(e){var t=new r([\"ace\"],\"ace/mode/xquery_worker\",\"XQueryWorker\"),n=this;return t.attachToDocument(e.getDocument()),t.on(\"ok\",function(t){e.clearAnnotations()}),t.on(\"markers\",function(t){e.clearAnnotations(),n.addMarkers(t.data,e)}),t.on(\"highlight\",function(t){n.$tokenizer.tokens=t.data.tokens,n.$tokenizer.lines=e.getDocument().getAllLines();var r=Object.keys(n.$tokenizer.tokens);for(var i=0;i<r.length;i++){var s=parseInt(r[i]);delete e.bgTokenizer.lines[s],delete e.bgTokenizer.states[s],e.bgTokenizer.fireUpdateEvent(s,s)}}),t},this.removeMarkers=function(e){var t=e.getMarkers(!1);for(var n in t)t[n].clazz.indexOf(\"language_highlight_\")===0&&e.removeMarker(n);for(var r=0;r<e.markerAnchors.length;r++)e.markerAnchors[r].detach();e.markerAnchors=[]},this.addMarkers=function(e,t){var n=this;t.markerAnchors||(t.markerAnchors=[]),this.removeMarkers(t),t.languageAnnos=[],e.forEach(function(e){function u(i){r&&t.removeMarker(r),o.row=n.row;if(e.pos.sc!==undefined&&e.pos.ec!==undefined){var s=new a(e.pos.sl,e.pos.sc,e.pos.el,e.pos.ec);r=t.addMarker(s,\"language_highlight_\"+(e.type?e.type:\"default\"))}i&&t.setAnnotations(t.languageAnnos)}var n=new c(t.getDocument(),e.pos.sl,e.pos.sc||0);t.markerAnchors.push(n);var r,i=e.pos.ec-e.pos.sc,s=e.pos.el-e.pos.sl,o={guttertext:e.message,type:e.level||\"warning\",text:e.message};u(),n.on(\"change\",function(){u(!0)}),e.message&&t.languageAnnos.push(o)}),t.setAnnotations(t.languageAnnos)},this.$id=\"ace/mode/xquery\"}.call(p.prototype),t.Mode=p}),define(\"ace/mode/behaviour/xquery\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/mode/behaviour/cstyle\",\"ace/mode/behaviour/xml\",\"ace/token_iterator\"],function(e,t,n){function a(e,t){var n=!0,r=e.type.split(\".\"),i=t.split(\".\");return i.forEach(function(e){if(r.indexOf(e)==-1)return n=!1,!1}),n}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"./cstyle\").CstyleBehaviour,o=e(\"../behaviour/xml\").XmlBehaviour,u=e(\"../../token_iterator\").TokenIterator,f=function(){this.inherit(s,[\"braces\",\"parens\",\"string_dquotes\"]),this.inherit(o),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var s=n.getCursorPosition(),o=new u(r,s.row,s.column),f=o.getCurrentToken(),l=!1,e=JSON.parse(e).pop();if(f&&f.value===\">\"||e!==\"StartTag\")return;if(!f||!a(f,\"meta.tag\")&&(!a(f,\"text\")||!f.value.match(\"/\"))){do f=o.stepBackward();while(f&&(a(f,\"string\")||a(f,\"keyword.operator\")||a(f,\"entity.attribute-name\")||a(f,\"text\")))}else l=!0;var c=o.stepBackward();if(!f||!a(f,\"meta.tag\")||c!==null&&c.value.match(\"/\"))return;var h=f.value.substring(1);if(l)var h=h.substring(0,s.column-f.start);return{text:\"></\"+h+\">\",selection:[1,1]}}})};r.inherits(f,i),t.XQueryBehaviour=f}),define(\"ace/mode/behaviour/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,o=e(\"../../lib/lang\"),u=[\"text\",\"paren.rparen\",\"punctuation.operator\"],a=[\"text\",\"paren.rparen\",\"punctuation.operator\",\"comment\"],f,l={},c=function(e){var t=-1;e.multiSelect&&(t=e.selection.id,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:\"\",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:\"\",maybeInsertedLineEnd:\"\"}},h=function(){this.add(\"braces\",\"insertion\",function(e,t,n,r,i){var s=n.getCursorPosition(),u=r.doc.getLine(s.row);if(i==\"{\"){c(n);var a=n.getSelectionRange(),l=r.doc.getTextRange(a);if(l!==\"\"&&l!==\"{\"&&n.getWrapBehavioursEnabled())return{text:\"{\"+l+\"}\",selection:!1};if(h.isSaneInsertion(n,r))return/[\\]\\}\\)]/.test(u[s.column])||n.inMultiSelectMode?(h.recordAutoInsert(n,r,\"}\"),{text:\"{}\",selection:[1,1]}):(h.recordMaybeInsert(n,r,\"{\"),{text:\"{\",selection:[1,1]})}else if(i==\"}\"){c(n);var p=u.substring(s.column,s.column+1);if(p==\"}\"){var d=r.$findOpeningBracket(\"}\",{column:s.column+1,row:s.row});if(d!==null&&h.isAutoInsertedClosing(s,u,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}else{if(i==\"\\n\"||i==\"\\r\\n\"){c(n);var v=\"\";h.isMaybeInsertedClosing(s,u)&&(v=o.stringRepeat(\"}\",f.maybeInsertedBrackets),h.clearMaybeInsertedClosing());var p=u.substring(s.column,s.column+1);if(p===\"}\"){var m=r.findMatchingBracket({row:s.row,column:s.column+1},\"}\");if(!m)return null;var g=this.$getIndent(r.getLine(m.row))}else{if(!v){h.clearMaybeInsertedClosing();return}var g=this.$getIndent(u)}var y=g+r.getTabString();return{text:\"\\n\"+y+\"\\n\"+g+v,selection:[1,y.length,1,y.length]}}h.clearMaybeInsertedClosing()}}),this.add(\"braces\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"{\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u==\"}\")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add(\"parens\",\"insertion\",function(e,t,n,r,i){if(i==\"(\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"(\"+o+\")\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\")\"),{text:\"()\",selection:[1,1]}}else if(i==\")\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\")\"){var l=r.$findOpeningBracket(\")\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"parens\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"(\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\")\")return i.end.column++,i}}),this.add(\"brackets\",\"insertion\",function(e,t,n,r,i){if(i==\"[\"){c(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==\"\"&&n.getWrapBehavioursEnabled())return{text:\"[\"+o+\"]\",selection:!1};if(h.isSaneInsertion(n,r))return h.recordAutoInsert(n,r,\"]\"),{text:\"[]\",selection:[1,1]}}else if(i==\"]\"){c(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==\"]\"){var l=r.$findOpeningBracket(\"]\",{column:u.column+1,row:u.row});if(l!==null&&h.isAutoInsertedClosing(u,a,i))return h.popAutoInsertedClosing(),{text:\"\",selection:[1,1]}}}}),this.add(\"brackets\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s==\"[\"){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==\"]\")return i.end.column++,i}}),this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){c(n);var s=i,o=n.getSelectionRange(),u=r.doc.getTextRange(o);if(u!==\"\"&&u!==\"'\"&&u!='\"'&&n.getWrapBehavioursEnabled())return{text:s+u+s,selection:!1};var a=n.getCursorPosition(),f=r.doc.getLine(a.row),l=f.substring(a.column-1,a.column);if(l==\"\\\\\")return null;var p=r.getTokens(o.start.row),d=0,v,m=-1;for(var g=0;g<p.length;g++){v=p[g],v.type==\"string\"?m=-1:m<0&&(m=v.value.indexOf(s));if(v.value.length+d>o.start.column)break;d+=p[g].value.length}if(!v||m<0&&v.type!==\"comment\"&&(v.type!==\"string\"||o.start.column!==v.value.length+d-1&&v.value.lastIndexOf(s)===v.value.length-1)){if(!h.isSaneInsertion(n,r))return;return{text:s+s,selection:[1,1]}}if(v&&v.type===\"string\"){var y=f.substring(a.column,a.column+1);if(y==s)return{text:\"\",selection:[1,1]}}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){c(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}})};h.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||\"text\",u)){var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||\"text\",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||\"text\",a)},h.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},h.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},h.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},h.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},h.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},h.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},h.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(h,i),t.CstyleBehaviour=h}),define(\"ace/mode/behaviour/xml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/behaviour\",\"ace/token_iterator\"],function(e,t,n){function o(e,t){return e.type.lastIndexOf(t+\".xml\")>-1}var r=e(\"../../lib/oop\"),i=e(\"../behaviour\").Behaviour,s=e(\"../../token_iterator\").TokenIterator,u=function(){this.add(\"string_dquotes\",\"insertion\",function(e,t,n,r,i){if(i=='\"'||i==\"'\"){var u=i,a=r.doc.getTextRange(n.getSelectionRange());if(a!==\"\"&&a!==\"'\"&&a!='\"'&&n.getWrapBehavioursEnabled())return{text:u+a+u,selection:!1};var f=n.getCursorPosition(),l=r.doc.getLine(f.row),c=l.substring(f.column,f.column+1),h=new s(r,f.row,f.column),p=h.getCurrentToken();if(c==u&&(o(p,\"attribute-value\")||o(p,\"string\")))return{text:\"\",selection:[1,1]};p||(p=h.stepBackward());if(!p)return;while(o(p,\"tag-whitespace\")||o(p,\"whitespace\"))p=h.stepBackward();var d=!c||c.match(/\\s/);if(o(p,\"attribute-equals\")&&(d||c==\">\")||o(p,\"decl-attribute-equals\")&&(d||c==\"?\"))return{text:u+u,selection:[1,1]}}}),this.add(\"string_dquotes\",\"deletion\",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&(s=='\"'||s==\"'\")){var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==s)return i.end.column++,i}}),this.add(\"autoclosing\",\"insertion\",function(e,t,n,r,i){if(i==\">\"){var u=n.getCursorPosition(),a=new s(r,u.row,u.column),f=a.getCurrentToken()||a.stepBackward();if(!f||!(o(f,\"tag-name\")||o(f,\"tag-whitespace\")||o(f,\"attribute-name\")||o(f,\"attribute-equals\")||o(f,\"attribute-value\")))return;if(o(f,\"reference.attribute-value\"))return;if(o(f,\"attribute-value\")){var l=f.value.charAt(0);if(l=='\"'||l==\"'\"){var c=f.value.charAt(f.value.length-1),h=a.getCurrentTokenColumn()+f.value.length;if(h>u.column||h==u.column&&l!=c)return}}while(!o(f,\"tag-name\"))f=a.stepBackward();var p=a.getCurrentTokenRow(),d=a.getCurrentTokenColumn();if(o(a.stepBackward(),\"end-tag-open\"))return;var v=f.value;p==u.row&&(v=v.substring(0,u.column-d));if(this.voidElements.hasOwnProperty(v.toLowerCase()))return;return{text:\"></\"+v+\">\",selection:[1,1]}}}),this.add(\"autoindent\",\"insertion\",function(e,t,n,r,i){if(i==\"\\n\"){var s=n.getCursorPosition(),o=r.getLine(s.row),u=o.substring(s.column,s.column+2);if(u==\"</\"){var a=this.$getIndent(o),f=a+r.getTabString();return{text:\"\\n\"+f+\"\\n\"+a,selection:[1,f.length,1,f.length]}}}})};r.inherits(u,i),t.XmlBehaviour=u}),define(\"ace/mode/folding/cstyle\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/range\",\"ace/mode/folding/fold_mode\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"../../range\").Range,s=e(\"./fold_mode\").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\\|[^|]*?$/,\"|\"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/(\\{|\\[)[^\\}\\]]*$|^\\s*(\\/\\*)/,this.foldingStopMarker=/^[^\\[\\{]*(\\}|\\])|^[\\s\\*]*(\\*\\/)/,this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n),s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!=\"all\"&&(u=null)),u}if(t===\"markbegin\")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++t<a){n=e.getLine(t);var f=n.search(/\\S/);if(f===-1)continue;if(r>f)break;var l=this.getFoldWidgetRange(e,\"all\",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)}}.call(o.prototype)}),define(\"ace/mode/xquery/xquery_lexer\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports=function r(t,n,i){function s(u,a){if(!n[u]){if(!t[u]){var f=typeof e==\"function\"&&e;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error(\"Cannot find module '\"+u+\"'\")}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return s(n?n:e)},l,l.exports,r,t,n,i)}return n[u].exports}var o=typeof e==\"function\"&&e;for(var u=0;u<i.length;u++)s(i[u]);return s}({1:[function(e,t,n){var r=n.XQueryTokenizer=function i(e,t){function r(e,t){E=t,S=e,x=e.length,s(0,0,0)}function s(e,t,n){m=t,g=t,y=e,b=t,w=n,N=n,E.reset(S)}function o(){E.startNonterminal(\"EQName\",g);switch(y){case 77:f(77);break;case 91:f(91);break;case 115:f(115);break;case 116:f(116);break;case 119:f(119);break;case 140:f(140);break;case 147:f(147);break;case 160:f(160);break;case 180:f(180);break;case 186:f(186);break;case 211:f(211);break;case 221:f(221);break;case 222:f(222);break;case 238:f(238);break;case 239:f(239);break;case 248:f(248);break;default:u()}E.endNonterminal(\"EQName\",g)}function u(){E.startNonterminal(\"FunctionName\",g);switch(y){case 14:f(14);break;case 65:f(65);break;case 68:f(68);break;case 69:f(69);break;case 70:f(70);break;case 74:f(74);break;case 75:f(75);break;case 79:f(79);break;case 83:f(83);break;case 84:f(84);break;case 85:f(85);break;case 88:f(88);break;case 89:f(89);break;case 98:f(98);break;case 100:f(100);break;case 103:f(103);break;case 104:f(104);break;case 105:f(105);break;case 106:f(106);break;case 107:f(107);break;case 108:f(108);break;case 113:f(113);break;case 114:f(114);break;case 117:f(117);break;case 118:f(118);break;case 121:f(121);break;case 123:f(123);break;case 124:f(124);break;case 126:f(126);break;case 129:f(129);break;case 130:f(130);break;case 131:f(131);break;case 132:f(132);break;case 141:f(141);break;case 143:f(143);break;case 145:f(145);break;case 146:f(146);break;case 148:f(148);break;case 154:f(154);break;case 155:f(155);break;case 157:f(157);break;case 158:f(158);break;case 159:f(159);break;case 165:f(165);break;case 167:f(167);break;case 169:f(169);break;case 173:f(173);break;case 175:f(175);break;case 176:f(176);break;case 177:f(177);break;case 179:f(179);break;case 181:f(181);break;case 193:f(193);break;case 195:f(195);break;case 196:f(196);break;case 197:f(197);break;case 201:f(201);break;case 207:f(207);break;case 208:f(208);break;case 213:f(213);break;case 214:f(214);break;case 215:f(215);break;case 219:f(219);break;case 224:f(224);break;case 230:f(230);break;case 231:f(231);break;case 232:f(232);break;case 243:f(243);break;case 244:f(244);break;case 245:f(245);break;case 249:f(249);break;case 251:f(251);break;case 255:f(255);break;case 261:f(261);break;case 265:f(265);break;case 269:f(269);break;case 67:f(67);break;case 76:f(76);break;case 78:f(78);break;case 80:f(80);break;case 81:f(81);break;case 86:f(86);break;case 93:f(93);break;case 96:f(96);break;case 97:f(97);break;case 99:f(99);break;case 101:f(101);break;case 120:f(120);break;case 127:f(127);break;case 128:f(128);break;case 136:f(136);break;case 149:f(149);break;case 150:f(150);break;case 156:f(156);break;case 166:f(166);break;case 187:f(187);break;case 194:f(194);break;case 198:f(198);break;case 217:f(217);break;case 220:f(220);break;case 223:f(223);break;case 229:f(229);break;case 235:f(235);break;case 246:f(246);break;case 247:f(247);break;case 252:f(252);break;case 256:f(256);break;case 257:f(257);break;case 258:f(258);break;case 262:f(262);break;case 92:f(92);break;case 171:f(171);break;default:f(216)}E.endNonterminal(\"FunctionName\",g)}function a(){E.startNonterminal(\"NCName\",g);switch(y){case 26:f(26);break;case 65:f(65);break;case 70:f(70);break;case 74:f(74);break;case 75:f(75);break;case 79:f(79);break;case 83:f(83);break;case 84:f(84);break;case 85:f(85);break;case 89:f(89);break;case 100:f(100);break;case 104:f(104);break;case 108:f(108);break;case 113:f(113);break;case 117:f(117);break;case 118:f(118);break;case 121:f(121);break;case 123:f(123);break;case 126:f(126);break;case 132:f(132);break;case 141:f(141);break;case 143:f(143);break;case 145:f(145);break;case 146:f(146);break;case 155:f(155);break;case 157:f(157);break;case 158:f(158);break;case 159:f(159);break;case 167:f(167);break;case 169:f(169);break;case 173:f(173);break;case 175:f(175);break;case 176:f(176);break;case 181:f(181);break;case 193:f(193);break;case 195:f(195);break;case 196:f(196);break;case 215:f(215);break;case 219:f(219);break;case 231:f(231);break;case 232:f(232);break;case 243:f(243);break;case 244:f(244);break;case 249:f(249);break;case 261:f(261);break;case 265:f(265);break;case 68:f(68);break;case 69:f(69);break;case 77:f(77);break;case 88:f(88);break;case 91:f(91);break;case 98:f(98);break;case 103:f(103);break;case 105:f(105);break;case 106:f(106);break;case 107:f(107);break;case 114:f(114);break;case 115:f(115);break;case 116:f(116);break;case 119:f(119);break;case 124:f(124);break;case 129:f(129);break;case 130:f(130);break;case 131:f(131);break;case 140:f(140);break;case 147:f(147);break;case 148:f(148);break;case 154:f(154);break;case 160:f(160);break;case 165:f(165);break;case 177:f(177);break;case 179:f(179);break;case 180:f(180);break;case 186:f(186);break;case 197:f(197);break;case 201:f(201);break;case 207:f(207);break;case 208:f(208);break;case 211:f(211);break;case 213:f(213);break;case 214:f(214);break;case 221:f(221);break;case 222:f(222);break;case 224:f(224);break;case 230:f(230);break;case 238:f(238);break;case 239:f(239);break;case 245:f(245);break;case 248:f(248);break;case 251:f(251);break;case 255:f(255);break;case 257:f(257);break;case 269:f(269);break;case 67:f(67);break;case 76:f(76);break;case 78:f(78);break;case 80:f(80);break;case 81:f(81);break;case 86:f(86);break;case 93:f(93);break;case 96:f(96);break;case 97:f(97);break;case 99:f(99);break;case 101:f(101);break;case 120:f(120);break;case 127:f(127);break;case 128:f(128);break;case 136:f(136);break;case 149:f(149);break;case 150:f(150);break;case 156:f(156);break;case 166:f(166);break;case 187:f(187);break;case 194:f(194);break;case 198:f(198);break;case 217:f(217);break;case 220:f(220);break;case 223:f(223);break;case 229:f(229);break;case 235:f(235);break;case 246:f(246);break;case 247:f(247);break;case 252:f(252);break;case 256:f(256);break;case 258:f(258);break;case 262:f(262);break;case 92:f(92);break;case 171:f(171);break;default:f(216)}E.endNonterminal(\"NCName\",g)}function f(e){y==e?(l(),E.terminal(i.TOKEN[y],b,w>x?x:w),m=b,g=w,y=0):d(b,w,0,y,e)}function l(){g!=b&&(m=g,g=b,E.whitespace(m,g))}function c(e){var t;for(;;){t=C(e);if(t!=28)break}return t}function h(e){y==0&&(y=c(e),b=T,w=N)}function p(e){y==0&&(y=C(e),b=T,w=N)}function d(e,t,r,i,s){throw new n.ParseException(e,t,r,i,s)}function C(e){var t=!1;T=N;var n=N,r=i.INITIAL[e],s=0;for(var o=r&4095;o!=0;){var u,a=n<x?S.charCodeAt(n):0;++n;if(a<128)u=i.MAP0[a];else if(a<55296){var f=a>>4;u=i.MAP1[(a&15)+i.MAP1[(f&31)+i.MAP1[f>>5]]]}else{if(a<56320){var f=n<x?S.charCodeAt(n):0;f>=56320&&f<57344&&(++n,a=((a&1023)<<10)+(f&1023)+65536,t=!0)}var l=0,c=5;for(var h=3;;h=c+l>>1){if(i.MAP2[h]>a)c=h-1;else{if(!(i.MAP2[6+h]<a)){u=i.MAP2[12+h];break}l=h+1}if(l>c){u=0;break}}}s=o;var p=(u<<12)+o-1;o=i.TRANSITION[(p&15)+i.TRANSITION[p>>4]],o>4095&&(r=o,o&=4095,N=n)}r>>=12;if(r==0){N=n-1;var f=N<x?S.charCodeAt(N):0;return f>=56320&&f<57344&&--N,d(T,N,s,-1,-1)}if(t)for(var v=r>>9;v>0;--v){--N;var f=N<x?S.charCodeAt(N):0;f>=56320&&f<57344&&--N}else N-=r>>9;return(r&511)-1}r(e,t);var n=this;this.ParseException=function(e,t,n,r,i){var s=e,o=t,u=n,a=r,f=i;this.getBegin=function(){return s},this.getEnd=function(){return o},this.getState=function(){return u},this.getExpected=function(){return f},this.getOffending=function(){return a},this.getMessage=function(){return a<0?\"lexical analysis failed\":\"syntax error\"}},this.getInput=function(){return S},this.getOffendingToken=function(e){var t=e.getOffending();return t>=0?i.TOKEN[t]:null},this.getExpectedTokenSet=function(e){var t;return e.getExpected()<0?t=i.getTokenSet(-e.getState()):t=[i.TOKEN[e.getExpected()]],t},this.getErrorMessage=function(e){var t=this.getExpectedTokenSet(e),n=this.getOffendingToken(e),r=S.substring(0,e.getBegin()),i=r.split(\"\\n\"),s=i.length,o=i[s-1].length+1,u=e.getEnd()-e.getBegin();return e.getMessage()+(n==null?\"\":\", found \"+n)+\"\\nwhile expecting \"+(t.length==1?t[0]:\"[\"+t.join(\", \")+\"]\")+\"\\n\"+(u==0||n!=null?\"\":\"after successfully scanning \"+u+\" characters beginning \")+\"at line \"+s+\", column \"+o+\":\\n...\"+S.substring(e.getBegin(),Math.min(S.length,e.getBegin()+64))+\"...\"},this.parse_start=function(){E.startNonterminal(\"start\",g),h(14);switch(y){case 55:f(55);break;case 54:f(54);break;case 56:f(56);break;case 40:f(40);break;case 42:f(42);break;case 41:f(41);break;case 35:f(35);break;case 38:f(38);break;case 274:f(274);break;case 271:f(271);break;case 39:f(39);break;case 43:f(43);break;case 49:f(49);break;case 62:f(62);break;case 63:f(63);break;case 46:f(46);break;case 48:f(48);break;case 53:f(53);break;case 51:f(51);break;case 34:f(34);break;case 273:f(273);break;case 2:f(2);break;case 1:f(1);break;case 3:f(3);break;case 12:f(12);break;case 13:f(13);break;case 15:f(15);break;case 16:f(16);break;case 17:f(17);break;case 5:f(5);break;case 6:f(6);break;case 4:f(4);break;case 33:f(33);break;default:o()}E.endNonterminal(\"start\",g)},this.parse_StartTag=function(){E.startNonterminal(\"StartTag\",g),h(8);switch(y){case 58:f(58);break;case 50:f(50);break;case 27:f(27);break;case 57:f(57);break;case 35:f(35);break;case 38:f(38);break;default:f(33)}E.endNonterminal(\"StartTag\",g)},this.parse_TagContent=function(){E.startNonterminal(\"TagContent\",g),p(11);switch(y){case 23:f(23);break;case 6:f(6);break;case 7:f(7);break;case 55:f(55);break;case 54:f(54);break;case 18:f(18);break;case 29:f(29);break;case 272:f(272);break;case 275:f(275);break;case 271:f(271);break;default:f(33)}E.endNonterminal(\"TagContent\",g)},this.parse_AposAttr=function(){E.startNonterminal(\"AposAttr\",g),p(10);switch(y){case 20:f(20);break;case 25:f(25);break;case 18:f(18);break;case 29:f(29);break;case 272:f(272);break;case 275:f(275);break;case 271:f(271);break;case 38:f(38);break;default:f(33)}E.endNonterminal(\"AposAttr\",g)},this.parse_QuotAttr=function(){E.startNonterminal(\"QuotAttr\",g),p(9);switch(y){case 19:f(19);break;case 24:f(24);break;case 18:f(18);break;case 29:f(29);break;case 272:f(272);break;case 275:f(275);break;case 271:f(271);break;case 35:f(35);break;default:f(33)}E.endNonterminal(\"QuotAttr\",g)},this.parse_CData=function(){E.startNonterminal(\"CData\",g),p(1);switch(y){case 11:f(11);break;case 64:f(64);break;default:f(33)}E.endNonterminal(\"CData\",g)},this.parse_XMLComment=function(){E.startNonterminal(\"XMLComment\",g),p(0);switch(y){case 9:f(9);break;case 47:f(47);break;default:f(33)}E.endNonterminal(\"XMLComment\",g)},this.parse_PI=function(){E.startNonterminal(\"PI\",g),p(3);switch(y){case 10:f(10);break;case 59:f(59);break;case 60:f(60);break;default:f(33)}E.endNonterminal(\"PI\",g)},this.parse_Pragma=function(){E.startNonterminal(\"Pragma\",g),p(2);switch(y){case 8:f(8);break;case 36:f(36);break;case 37:f(37);break;default:f(33)}E.endNonterminal(\"Pragma\",g)},this.parse_Comment=function(){E.startNonterminal(\"Comment\",g),p(4);switch(y){case 52:f(52);break;case 41:f(41);break;case 30:f(30);break;default:f(33)}E.endNonterminal(\"Comment\",g)},this.parse_CommentDoc=function(){E.startNonterminal(\"CommentDoc\",g),p(5);switch(y){case 31:f(31);break;case 32:f(32);break;case 52:f(52);break;case 41:f(41);break;default:f(33)}E.endNonterminal(\"CommentDoc\",g)},this.parse_QuotString=function(){E.startNonterminal(\"QuotString\",g),p(6);switch(y){case 18:f(18);break;case 29:f(29);break;case 19:f(19);break;case 21:f(21);break;case 35:f(35);break;default:f(33)}E.endNonterminal(\"QuotString\",g)},this.parse_AposString=function(){E.startNonterminal(\"AposString\",g),p(7);switch(y){case 18:f(18);break;case 29:f(29);break;case 20:f(20);break;case 22:f(22);break;case 38:f(38);break;default:f(33)}E.endNonterminal(\"AposString\",g)},this.parse_Prefix=function(){E.startNonterminal(\"Prefix\",g),h(13),l(),a(),E.endNonterminal(\"Prefix\",g)},this.parse__EQName=function(){E.startNonterminal(\"_EQName\",g),h(12),l(),o(),E.endNonterminal(\"_EQName\",g)};var v,m,g,y,b,w,E,S,x,T,N};r.getTokenSet=function(e){var t=[],n=e<0?-e:INITIAL[e]&4095;for(var i=0;i<276;i+=32){var s=i,o=(i>>5)*2062+n-1,u=o>>2,a=u>>2,f=r.EXPECTED[(o&3)+r.EXPECTED[(u&3)+r.EXPECTED[(a&3)+r.EXPECTED[a>>2]]]];for(;f!=0;f>>>=1,++s)(f&1)!=0&&t.push(r.TOKEN[s])}return t},r.MAP0=[66,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,27,31,31,31,31,31,31,31,31,31,31,32,31,31,33,31,31,31,31,31,31,34,35,36,35,31,35,37,38,39,40,41,42,43,44,45,31,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,31,61,62,63,64,35],r.MAP1=[108,124,214,214,214,214,214,214,214,214,214,214,214,214,214,214,156,181,181,181,181,181,214,215,213,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,247,261,277,293,309,347,363,379,416,416,416,408,331,323,331,323,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,433,433,433,433,433,433,433,316,331,331,331,331,331,331,331,331,394,416,416,417,415,416,416,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,416,330,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,331,416,66,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,18,18,18,18,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,27,31,31,31,31,31,31,31,31,31,31,31,31,31,31,35,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,32,31,31,33,31,31,31,31,31,31,34,35,36,35,31,35,37,38,39,40,41,42,43,44,45,31,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,31,61,62,63,64,35,35,35,35,35,35,35,35,35,35,35,35,31,31,35,35,35,35,35,35,35,65,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65,65],r.MAP2=[57344,63744,64976,65008,65536,983040,63743,64975,65007,65533,983039,1114111,35,31,35,31,31,35],r.INITIAL=[1,2,36867,45060,5,6,7,8,9,10,11,12,13,14,15],r.TRANSITION=[17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22908,18836,17152,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,17365,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,17470,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,18157,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,17848,17880,18731,17918,36551,17292,17934,17979,18727,18023,36545,18621,18039,18056,18072,18117,18143,18173,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17687,18805,18421,18437,18101,17393,18489,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,18579,21711,17152,19008,19233,20367,19008,28684,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,17365,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,17470,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,18157,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,17848,17880,18731,17918,36551,17292,17934,17979,18727,18023,36545,18621,18039,18056,18072,18117,18143,18173,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17687,18805,18421,18437,18101,17393,18489,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,20116,18836,18637,19008,19233,21267,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,18763,18778,18794,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,18821,22923,18906,19008,19233,17431,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18937,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,19054,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,18953,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21843,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21696,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22429,20131,18720,19008,19233,20367,19008,17173,23559,36437,17330,17349,18921,17189,17208,17281,20355,18087,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,21242,19111,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,19024,18836,18609,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,19081,22444,18987,19008,19233,20367,19008,19065,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21992,22007,18987,19008,19233,20367,19008,18690,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22414,18836,18987,19008,19233,30651,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,19138,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,19280,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,19172,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21783,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,19218,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21651,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,19249,19265,19307,18888,27857,30536,24401,31444,23357,18888,19351,18888,18890,27211,19370,27211,27211,19392,24401,31911,24401,24401,25467,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,28537,19440,24401,24401,24401,24401,24036,17994,24060,18888,18888,18888,18890,19468,27211,27211,27211,27211,19484,35367,19520,24401,24401,24401,19628,18888,29855,18888,18888,23086,27211,19538,27211,27211,30756,24012,24401,19560,24401,24401,26750,18888,18888,19327,27855,27211,27211,19580,17590,24017,24401,24401,19600,25665,18888,18888,28518,27211,27212,24016,19620,19868,28435,25722,18889,19644,27211,32888,35852,19868,31018,19694,19376,19717,22215,19735,22098,19751,35203,19776,19797,19817,19840,25783,31738,24135,19701,19856,31015,23516,31008,28311,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21768,18836,19307,18888,27857,27904,24401,29183,28015,18888,18888,18888,18890,27211,27211,27211,27211,19888,24401,24401,24401,24401,22953,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,28537,19440,24401,24401,24401,24401,24036,18881,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22399,18836,19918,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21666,18836,19307,18888,27857,27525,24401,29183,21467,18888,18888,18888,18890,27211,27211,27211,27211,19946,24401,24401,24401,24401,32382,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,28537,19998,24401,24401,24401,24401,31500,18467,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,20021,24401,24401,24401,24401,24401,34271,18888,18888,18888,18888,23086,27211,27211,27211,27211,32926,29908,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,20050,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,20101,19039,20191,20412,20903,17569,20309,20872,25633,20623,20505,20218,20242,17189,17208,17281,20355,20265,20306,20328,20383,22490,20796,20619,21354,20654,20410,20956,21232,20765,17421,20535,17192,18127,22459,20312,25531,22470,20309,20428,18964,20466,20491,21342,21070,20521,20682,17714,18326,17543,17559,17585,22497,20559,19504,20279,20575,20290,20475,20604,20639,20226,20670,17661,21190,17703,21176,17730,19494,20698,20711,22480,21046,21116,18971,21130,20727,20755,17675,17753,17832,17590,25518,20394,20781,20831,20202,20847,21401,17292,17934,17979,18549,20863,20588,25542,20888,20919,18072,18117,20935,20972,21032,21062,21086,18239,21102,18563,21146,21162,21206,18351,20949,20902,18340,21222,21258,21283,18360,20249,17405,21295,21311,21327,20739,20343,21370,21386,21417,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21977,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,21452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,21504,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,36501,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,28674,21946,17617,36473,18223,17237,17477,19152,17860,17892,17675,17753,17832,21575,21534,17481,19156,17864,18731,17918,36551,17292,17934,21560,30628,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21798,18836,21612,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21636,18836,18987,19008,19233,17902,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21753,19096,21903,19008,19233,20367,19008,19291,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,17379,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,21931,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,18280,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21962,18594,18987,19008,19233,22043,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21681,21858,18987,19008,19233,20367,19008,21544,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,30613,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,31500,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,32319,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,21431,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,22231,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,30613,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,31500,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,31181,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,21431,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,31678,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,31500,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,31181,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,21431,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,30613,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,33588,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,31181,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,21431,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,35019,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22248,24401,24401,24401,24401,30613,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,31500,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,31181,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,21431,24401,24401,24401,24401,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22324,18836,22059,18888,27857,30501,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,34365,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22354,18836,18987,19008,19233,20367,19008,17173,27086,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,19930,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21828,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22309,22513,18987,19008,19233,20367,19008,19122,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,22544,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22608,18836,22988,23004,27585,23020,23036,23067,22087,18888,18888,18888,23083,27211,27211,27211,23102,22121,24401,24401,24401,23122,31386,26154,19674,18888,28119,28232,19424,23705,27211,27211,23142,23173,23189,23212,24401,24401,23246,34427,31693,23262,18888,23290,23308,27783,27620,23327,35263,35107,33383,23346,18193,23393,32748,23968,24401,23414,35153,23463,18888,33913,23442,23482,27211,27211,23532,23552,21431,23575,24401,24401,23604,26095,23635,23657,18888,33482,23685,33251,27211,22187,18851,23721,35536,24401,18887,23750,32641,27211,23769,23787,20080,33012,24384,25659,18888,18889,27211,27211,19719,23889,23803,31018,18890,27211,31833,19406,19447,23086,23330,19828,28224,31826,23823,26917,34978,23850,26493,25782,23878,23914,23516,31008,22105,19419,27963,19659,29781,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22623,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,30613,18888,18888,18888,18888,28909,25783,27211,27211,27211,34048,23933,22164,24401,24401,24401,28409,23949,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,31181,26583,18888,18888,18888,35585,23984,27211,27211,27211,24005,22201,24033,24401,24401,24401,24052,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,26496,24076,24126,24151,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22638,18836,22059,19678,27857,24185,24401,24201,24217,26592,18888,18888,18890,24252,24268,27211,27211,22121,24287,24303,24401,24401,30613,19781,35432,36007,32649,18888,25783,24322,28966,23771,27211,35072,22164,24358,32106,26829,24400,31500,31693,18888,18888,18888,24801,18890,27211,27211,27211,27211,24418,19484,24401,24401,24401,24401,20167,31181,18888,18888,18888,27833,23086,27211,27211,33540,27211,30756,21431,24401,24401,22972,24401,26095,18888,36131,18888,27855,27211,24440,27211,22187,22968,24401,24459,24401,31699,28454,18888,34528,34570,35779,24478,24402,24494,25659,18888,36228,27211,27211,24515,30981,23734,31018,18890,27211,31833,19406,19447,23086,23330,24538,31017,27856,31741,30059,23377,24563,19837,25782,19760,31015,23516,25374,22105,19419,29793,24579,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22653,18836,22059,25756,19982,34097,23196,29183,24614,24110,23641,24673,26103,24697,24443,24713,28558,22121,24748,24462,24764,23398,30613,18888,18888,18888,18888,24798,25783,27211,27211,27211,34232,35072,22164,24401,24401,24401,33302,31500,22559,24106,24232,18888,18888,34970,24817,30411,27211,27211,32484,19484,29750,35127,24401,24401,19872,31181,24852,18888,18888,24871,29221,27211,27211,32072,27211,30756,34441,24401,24401,31571,24401,26095,33141,27802,27011,27855,25295,25607,24888,22187,22968,19195,34593,24906,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,18888,33663,27211,27211,24924,24947,23588,31018,18890,27211,31833,22135,19447,23086,23330,19828,30904,31042,24972,19840,25e3,31738,30898,25782,19760,31015,23516,31008,22105,19419,25016,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22668,18836,25041,25057,31320,25073,25089,25105,22087,34796,24236,36138,34870,34125,25121,23106,35497,22248,36613,25137,30671,27365,30613,25153,26447,25199,25233,22574,23274,25249,25265,25281,25318,25344,25360,25400,25428,25452,26731,25504,31693,23669,25558,27407,25575,28599,25934,25599,27211,28180,27304,25623,25839,25649,24401,34820,25681,25698,22586,27775,30190,25745,25778,25799,25817,28995,33569,30756,21518,33443,25837,25855,25893,26095,31254,26677,30136,27855,25930,25950,27211,22187,22968,25966,25986,24401,23428,27763,36330,26959,26002,26029,26045,26085,26119,26170,26203,26222,26239,30527,26372,26274,28404,31018,33757,27211,34262,26316,36729,26345,26366,35337,31017,26388,26407,30954,26350,33861,26434,26463,26479,26512,23516,33189,26531,26547,27963,31293,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22683,18836,26568,26181,26608,34097,26643,29183,22087,26669,18888,18888,18890,26693,27211,27211,27211,22121,26720,24401,24401,24401,30613,18888,18888,18888,18888,26774,25783,27211,27211,27211,26619,35072,22164,24401,24401,24401,21596,31500,31693,18888,18888,33978,18888,18890,27211,27211,25801,27211,27211,19484,24401,24401,24401,26792,24401,31181,18888,18888,18888,35464,23086,27211,27211,27211,26809,30756,21431,24401,24401,24401,26828,26095,18888,18888,18888,27855,27211,27211,27211,22187,22968,24401,24401,24401,18887,18888,18888,27211,27211,35779,20080,24402,19868,25659,31948,18889,35707,27211,19719,26845,19868,31018,18890,27211,31833,19406,19447,23086,23330,26905,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,24984,31088,19419,26945,27651,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22698,18836,26999,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,23051,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,27033,24401,24401,24401,24401,24036,31693,18888,18888,27056,18888,18890,27211,27211,30320,27211,27211,27075,24401,24401,29032,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,33986,27855,27211,27211,27102,17590,24017,24401,24401,27123,27144,36254,27162,27210,27228,28500,18187,34842,33426,27244,35980,27277,27302,27320,36048,34013,20999,31882,21478,27895,27356,30287,27381,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,26329,30087,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,27406,27423,27445,35294,27461,22087,18888,18888,30140,18890,27211,27211,27989,27211,22121,24401,24401,25682,24401,18866,18888,18888,18888,18888,18888,34042,27211,27211,27211,27211,29700,22164,24401,24401,24401,24401,27128,31693,27477,18888,18888,18888,18890,27194,27211,27211,27211,27211,19484,35299,24401,24401,24401,24401,19628,18888,18888,18888,27059,23086,27211,27211,27211,33366,30756,24012,24401,24401,24401,35044,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,20815,27211,30818,19960,33969,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22713,18836,22059,27496,27516,27541,35231,27557,22087,29662,26292,23292,27573,24836,27601,27211,27636,22121,35544,27686,24401,27721,18866,18888,27799,18888,27818,22071,27853,32260,27211,26013,27873,27920,22164,29419,24401,29946,33413,26742,27751,26881,18888,18888,27261,36776,27936,27211,27211,27211,27988,28005,28031,28052,24401,24401,28069,28088,28135,25488,28152,26069,28167,27211,28340,24657,28196,30756,31523,24401,28212,34176,36174,24956,28248,28266,28290,21488,33077,28327,28356,17590,20986,23126,28391,28425,28102,28451,28470,28490,28516,28534,20034,33728,25868,25659,18888,18889,27211,27211,19719,23889,19868,30241,28274,28553,28574,19406,28590,23086,23330,19828,19452,28615,28660,26147,25783,31738,19837,25782,19760,29613,35958,29276,22105,19419,27963,23157,28700,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,18888,27857,34097,24401,29183,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,22528,18888,18888,18888,18888,18890,27333,27211,27211,27211,27211,19484,30853,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22728,18836,28747,28782,28817,28841,28857,28880,28896,24161,28943,32011,36261,27340,28961,29492,28982,29011,24522,29027,25436,29048,23051,27500,29090,29110,30713,18888,23512,29130,25183,27211,29155,28927,27033,29173,23230,24401,29199,35373,31693,18888,18888,25583,32629,29218,27211,27211,31461,30692,29237,27075,24401,24401,24401,29262,29302,19628,18888,34329,18888,18888,23086,27211,29329,27211,27211,30756,24012,35933,24401,24401,24401,27705,31612,18888,18888,29346,29374,27211,35650,17590,21436,29393,24401,25970,18887,33895,18888,27211,32528,27212,24016,32769,19868,25659,18888,26889,27211,27211,29412,23889,24371,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31768,19840,25783,31738,19837,29435,29508,31102,29550,29606,22105,30300,29462,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22743,18836,22059,29629,29473,34097,33285,29183,29651,27254,18888,29678,33329,32535,27211,29694,29716,22121,19202,24401,32742,29741,18866,26776,33921,28474,18888,18888,25783,29766,27211,29809,27211,35072,22164,35825,24401,29828,24401,24036,36769,25217,18888,18888,29848,18890,27211,29871,27211,26258,27211,29894,24401,29929,24401,36587,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,29725,29962,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18473,18888,18888,19584,27211,27212,24016,29982,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19902,19447,32052,19544,19828,29998,30097,30031,19840,25783,30047,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,30075,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22758,18836,30121,30156,30206,30257,30273,30336,22087,35624,32837,25762,18890,29878,34934,26812,27211,22121,24931,23223,29202,24401,18866,34373,30352,18888,18888,18888,23447,24828,27211,27211,27211,35072,30370,35052,24401,24401,24401,24036,29523,18888,18888,27146,18888,31308,30386,27211,27211,30405,30558,19484,30427,24401,24401,29938,35686,19628,28766,30447,34506,35614,23086,28731,30482,30517,30552,30756,24012,20156,30574,30598,30667,26283,33464,28945,27670,30687,32915,33504,25328,17590,23963,20450,33837,21016,32397,26300,30708,30729,27885,30748,21588,36373,30779,26653,24628,33220,32514,30806,31835,25412,25906,26515,18890,28825,31833,26133,19447,28304,31730,23834,26057,30869,30885,32181,30920,30942,32797,25782,30970,31015,23516,31008,30997,31034,27963,19659,29450,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22773,18836,31058,31074,32463,31125,31141,31197,22087,18888,29534,35471,36738,27211,24342,31213,24424,22121,24401,20175,31229,31917,27736,31245,34334,27175,18888,29094,27286,27211,31278,31336,27211,31355,31371,24401,31402,31418,24401,31437,31693,18888,31619,32841,18888,18890,27211,27211,31460,31477,27211,19484,24401,24401,31497,36581,24401,33020,18888,18888,18888,18888,30007,27211,27211,27211,27211,31516,32310,24401,24401,24401,24401,31539,18888,28762,18888,24651,35740,27211,27211,28644,31565,35796,24401,24401,19318,32188,18888,24334,28366,27212,29966,29832,19868,25659,18888,18889,27211,27211,19719,31587,19868,31635,32435,33693,30105,31663,20005,31715,31757,31784,31812,30015,31851,31878,25783,31898,19837,25782,19760,31015,23516,31008,22105,19419,27963,31933,30221,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22788,18836,22059,25729,30466,31968,24306,31984,32e3,32807,35160,27017,29590,34941,19801,29377,33700,22121,27040,30431,29396,28864,29565,18888,18888,18888,32027,18888,25783,27211,27211,23698,27211,35072,22164,24401,24401,30845,24401,24036,32045,18888,26929,18888,18888,18890,27211,31481,32068,27211,27211,32088,24401,33058,32122,24401,24401,33736,18888,18888,33162,18888,23086,27211,27211,29484,27211,28375,32144,24401,24401,33831,24401,26750,18888,18888,18888,27855,27211,27211,27211,36704,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,33107,22171,33224,24271,32169,31017,27856,31741,19840,25783,31738,30234,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,32204,32232,32252,32677,33295,29074,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,23619,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,32276,24401,24401,24401,24401,24036,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,32299,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,33886,18889,36065,27211,19719,35326,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22803,18836,32335,31647,34666,32351,32367,32417,22087,18888,32433,19335,32451,27211,32479,27107,32500,22121,24401,32551,20085,32572,18866,22287,23753,18888,18888,32602,32665,27211,32693,27211,26972,32713,32729,24401,32764,24401,25877,32785,34768,18888,27390,32823,24594,24855,32857,24890,32878,32904,27211,32942,32977,24401,33e3,29313,24401,30790,26206,27666,33904,18888,23086,36353,27211,33036,27211,30756,24012,32153,24401,33056,24401,35861,18888,18888,30354,27972,27211,27211,33800,17590,20145,24401,24401,34638,20811,18888,18888,33074,27211,27212,36167,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,34616,24169,33093,33123,33157,27856,31741,23862,26552,34302,19837,25782,19760,31015,23516,31008,33178,19973,27963,23497,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22818,18836,33205,28113,33240,34097,33275,29183,22087,33318,35438,18888,18890,33345,26391,33382,27211,22121,33399,28072,33442,24401,18866,22232,18888,33459,18888,18888,33480,33498,25175,27211,27211,26704,22164,24775,35239,24401,24401,25914,29580,18888,18888,31109,25211,33520,33539,27211,27211,33556,36284,19484,33585,24401,24401,33604,32556,19628,18888,18888,31262,33658,23086,27211,27211,33679,27211,30756,24012,24401,24401,33716,24401,26854,27480,18888,33752,27855,33259,34701,27211,17590,32102,24782,23807,24401,18887,18888,18888,27211,27211,27212,33773,36105,19868,25659,18888,23368,27211,29157,19719,23889,34454,29286,18890,33794,25302,33816,19447,34079,33853,31862,31017,27856,31741,33877,28920,33937,19837,30461,34002,22276,36041,34029,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22833,18836,34064,32616,34113,34141,34157,34192,34208,32216,36013,31549,31952,34224,34248,34287,29330,34350,34389,34413,34481,26793,18866,26187,29635,22293,18888,36654,25783,34522,34544,34566,25821,35072,22164,34586,34609,34632,19604,24036,36644,36674,24681,18888,32401,34654,31339,34682,34698,27211,34717,34753,28053,34812,34836,24401,33619,19628,34858,32236,34906,24598,33523,27612,34890,34922,24732,29246,36717,33634,34465,32984,34168,26750,34957,18888,18888,34994,35010,27211,33040,17590,29913,35035,24401,36304,25482,30171,35883,35068,35088,26627,20441,31173,35123,35143,35176,24640,30492,29358,19719,35192,35219,25384,28801,35255,35279,32586,34496,23086,23330,29061,31017,27856,31741,19840,25783,31738,24547,25164,35315,31796,35353,34316,22105,19419,27963,24091,28630,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22848,18836,22059,34782,34088,35389,21008,35405,35421,35454,18888,18888,23466,35487,27211,27211,27211,35513,31154,24401,24401,24401,35560,18888,26863,36664,35601,24872,25783,30389,23536,26250,35647,35666,22164,19522,19564,30582,35682,27697,35575,29114,18888,18888,18888,18890,27211,35702,27211,27211,27211,35723,24401,35527,24401,24401,24401,19628,30184,18888,18888,18888,23086,35739,27211,27211,27211,29139,22938,24401,24401,24401,24401,23898,35756,18888,18888,25025,35778,27211,27211,17590,20064,35795,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,23917,18890,34550,31833,22262,19447,23086,23330,26418,31017,27856,31741,19840,25783,35812,19837,27187,35841,33135,23516,31008,22105,22148,28712,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22863,18836,22059,35877,28723,34097,31164,29183,22087,26758,18888,22592,18890,23989,27211,29812,27211,22121,33778,24401,31421,24401,18866,18888,18888,26872,18888,18888,25783,27211,30732,27211,27211,35072,22164,24401,24908,24401,24401,24036,31693,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22878,18836,22059,27837,27857,35899,24401,35915,22087,18888,18888,18888,18890,27211,27211,27211,27211,22121,24401,24401,24401,24401,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,31602,18888,18888,18888,18888,26223,27211,27211,27211,27211,27211,19484,35931,24401,24401,24401,24401,19628,18888,28136,18888,18888,35949,27211,32862,27211,32697,30756,24012,24401,32283,24401,32128,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22893,18836,22059,35974,34882,34097,33960,29183,35996,18888,23311,18888,36029,27211,27211,36064,36081,22121,24401,24401,36104,33950,18866,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,35072,22164,24401,24401,24401,24401,24036,36121,18888,25559,18888,18888,18890,27211,27211,30313,27211,27211,36154,24401,24401,34397,24401,24401,19628,28250,18888,18888,18888,23086,30926,27211,27211,27211,26983,24012,33642,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22339,18836,22059,19354,27857,36190,24401,36206,22087,18888,18888,18888,18007,27211,27211,27211,24724,22121,24401,24401,24401,30827,18866,18888,36222,18888,28795,18888,25783,35100,27211,27429,27211,35072,22164,30836,24401,24499,24401,24036,31693,18888,36244,18888,18888,18890,27211,36088,27211,27211,27211,19484,24401,28036,24401,24401,24401,19628,18888,18888,35631,18888,35762,27211,27211,36277,27211,34730,24012,24401,24401,36300,24401,36320,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,25712,18888,18888,36346,27211,27212,19184,24402,19868,25659,32029,18889,27211,33359,19719,23889,36369,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22384,18836,36389,19008,19233,20367,36434,17173,17595,36437,17330,17349,18921,17189,17208,17281,20355,36453,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,20362,21726,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,22369,18836,18987,19008,19233,20367,19008,21737,30763,36437,17330,17349,18921,17189,17208,17281,20355,17949,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21813,18836,36489,19008,19233,20367,19008,17173,17737,36437,17330,17349,18921,17189,17208,17281,20355,17768,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,20543,22022,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21828,18836,18987,19008,19233,20367,19008,17173,30763,36437,17330,17349,18921,17189,17208,17281,20355,36517,17308,17327,17346,18918,18452,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,18127,21873,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,21828,18836,19307,18888,27857,30756,24401,29183,28015,18888,18888,18888,18890,27211,27211,27211,27211,36567,24401,24401,24401,24401,22953,18888,18888,18888,18888,18888,25783,27211,27211,27211,27211,28537,36603,24401,24401,24401,24401,24036,18881,18888,18888,18888,18888,18890,27211,27211,27211,27211,27211,19484,24401,24401,24401,24401,24401,19628,18888,18888,18888,18888,23086,27211,27211,27211,27211,30756,24012,24401,24401,24401,24401,26750,18888,18888,18888,27855,27211,27211,27211,17590,24017,24401,24401,24401,18887,18888,18888,27211,27211,27212,24016,24402,19868,25659,18888,18889,27211,27211,19719,23889,19868,31018,18890,27211,31833,19406,19447,23086,23330,19828,31017,27856,31741,19840,25783,31738,19837,25782,19760,31015,23516,31008,22105,19419,27963,19659,27951,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,36629,36690,18720,19008,19233,20367,19008,17454,17595,36437,17330,17349,18921,17189,17208,17281,20355,17223,17308,17327,17346,18918,36754,21880,18649,18665,19006,17265,22033,20765,17421,20535,17192,20362,21726,17311,18658,18999,19008,17447,32952,17497,17520,17251,36411,17782,20682,17714,18326,17543,17559,17585,21887,17504,17527,17258,36418,21915,21940,17611,36467,18217,17633,17661,21190,17703,21176,17730,34737,21946,17617,36473,18223,36531,17477,19152,17860,17892,17675,17753,17832,17590,21620,17481,19156,17864,18731,17918,36551,17292,17934,17979,18727,18681,18405,18621,18039,18056,18072,18117,18143,18706,18052,18209,18250,18239,18266,17963,18296,18312,18376,17807,36403,19232,17796,17163,30642,18392,17816,32961,17645,18805,18421,18437,18519,17393,18747,18505,18535,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,17590,0,94242,0,118820,0,2211840,102439,0,0,106538,98347,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2482176,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,18,18,24,24,27,27,27,2207744,2404352,2412544,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,3104768,2605056,2207744,2207744,2207744,2207744,2207744,2207744,2678784,2207744,2695168,2207744,2703360,2207744,2711552,2752512,2207744,0,0,0,0,0,0,2166784,0,0,0,0,0,0,2158592,2158592,3170304,3174400,2158592,0,139,0,2158592,2158592,2158592,2158592,2158592,2424832,2158592,2158592,2158592,2748416,2756608,2777088,2801664,2158592,2158592,2158592,2863104,2891776,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3104768,2158592,2158592,2158592,2158592,2158592,2158592,2207744,2785280,2207744,2809856,2207744,2207744,2842624,2207744,2207744,2207744,2899968,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2473984,2207744,2207744,2494464,2207744,2207744,2207744,2523136,2158592,2404352,2412544,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2564096,2158592,2158592,2605056,2158592,2158592,2158592,2158592,2158592,2158592,2678784,2158592,2695168,2158592,2703360,2158592,2711552,2752512,2158592,2158592,2785280,2158592,2158592,2785280,2158592,2809856,2158592,2158592,2842624,2158592,2158592,2158592,2899968,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,18,0,0,0,0,0,0,0,2211840,0,0,641,0,2158592,0,0,0,0,0,0,0,0,2211840,0,0,32768,0,2158592,0,2158592,2158592,2158592,2383872,2158592,2158592,2158592,2158592,3006464,2383872,2207744,2207744,2207744,2207744,2158877,2158877,2158877,2158877,0,0,0,2158877,2572573,2158877,2158877,0,2207744,2207744,2596864,2207744,2207744,2207744,2207744,2207744,2207744,2641920,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,167936,0,0,2162688,0,0,3104768,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,0,0,0,2146304,2146304,2224128,2224128,2232320,2232320,2232320,641,0,0,0,0,0,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2531328,2158592,2158592,2158592,2158592,2158592,2617344,2158592,2158592,2158592,2158592,2441216,2445312,2158592,2158592,2158592,2158592,2158592,2158592,2502656,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2580480,2158592,2158592,2158592,2158592,2621440,2158592,2580480,2158592,2158592,2158592,2158592,2621440,2158592,2158592,2158592,2158592,2158592,2158592,2699264,2158592,2158592,2158592,2158592,2158592,2748416,2756608,2777088,2801664,2207744,2863104,2891776,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,3018752,2207744,3043328,2207744,2207744,2207744,2207744,3080192,2207744,2207744,3112960,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,172310,279,0,2162688,0,0,2207744,2207744,2207744,3186688,2207744,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2158592,2158592,2158592,2404352,2412544,2158592,2510848,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2584576,2158592,2609152,2158592,2158592,2629632,2158592,2158592,2158592,2686976,2158592,2715648,2158592,2158592,3121152,2158592,2158592,2158592,3149824,2158592,2158592,3170304,3174400,2158592,2367488,2207744,2207744,2207744,2207744,2158592,2158592,2158592,2158592,0,0,0,2158592,2572288,2158592,2158592,0,2207744,2207744,2207744,2433024,2207744,2453504,2461696,2207744,2207744,2207744,2207744,2207744,2207744,2510848,2207744,2207744,2207744,2207744,2207744,2531328,2207744,2207744,2207744,2207744,2207744,2617344,2207744,2207744,2207744,2207744,2158592,2158592,2158592,2158592,0,0,0,2158592,2572288,2158592,2158592,1508,2715648,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2867200,2207744,2904064,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2580480,2207744,2207744,2207744,2207744,2621440,2207744,2207744,2207744,3149824,2207744,2207744,3170304,3174400,2207744,0,0,0,0,0,0,0,0,0,0,138,2158592,2158592,2158592,2404352,2412544,2707456,2732032,2207744,2207744,2207744,2822144,2826240,2207744,2895872,2207744,2207744,2924544,2207744,2207744,2973696,2207744,0,0,0,0,0,0,2166784,0,0,0,0,0,285,2158592,2158592,3112960,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3186688,2158592,2207744,2207744,2158592,2158592,2158592,2158592,2158592,0,0,0,2158592,2158592,2158592,2158592,0,0,2535424,2543616,2158592,2158592,2158592,0,0,0,2158592,2158592,2158592,2990080,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2572288,2981888,2207744,2207744,3002368,2207744,3047424,3063808,3076096,2207744,2207744,2207744,2207744,2207744,2207744,2207744,3203072,2708960,2732032,2158592,2158592,2158592,2822144,2827748,2158592,2895872,2158592,2158592,2924544,2158592,2158592,2973696,2158592,2981888,2158592,2158592,3002368,2158592,3047424,3063808,3076096,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3203072,2981888,2158592,2158592,3003876,2158592,3047424,3063808,3076096,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3203072,2207744,2207744,2207744,2207744,2207744,2424832,2207744,2207744,2207744,2207744,2207744,2207744,2207744,20480,0,0,0,0,0,2162688,20480,0,2523136,2527232,2158592,2158592,2576384,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2908160,2527232,2207744,2207744,2576384,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2908160,2207744,0,0,0,0,0,0,2166784,0,0,0,0,0,286,2158592,2158592,0,0,2158592,2158592,2158592,2158592,2633728,2658304,0,0,2740224,2744320,0,2834432,2207744,2207744,2977792,2207744,2207744,2207744,2207744,3039232,2207744,2207744,2207744,2207744,2207744,2207744,3158016,0,0,29315,0,0,0,0,45,45,45,45,45,933,45,45,45,45,442,45,45,45,45,45,45,45,45,45,67,67,2494464,2158592,2158592,2158592,2524757,2527232,2158592,2158592,2576384,2158592,2158592,2158592,2158592,2158592,2158592,1504,2158592,2498560,2158592,2158592,2158592,2158592,2568192,2158592,2592768,2625536,2158592,2158592,2674688,2736128,2158592,2158592,0,2158592,2912256,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3108864,2158592,2158592,3133440,3145728,3153920,2375680,2379776,2207744,2207744,2420736,2207744,2449408,2207744,2207744,2207744,2498560,2207744,2207744,2207744,2207744,2568192,2207744,0,0,0,0,0,0,2166784,0,0,0,0,0,551,2158592,2158592,2158592,2158592,2207744,2506752,2207744,2207744,2207744,2207744,2207744,2158592,2506752,0,2020,2158592,2592768,2625536,2207744,2207744,2674688,2736128,2207744,2207744,2207744,2912256,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,542,0,544,2207744,3108864,2207744,2207744,3133440,3145728,3153920,2375680,2379776,2158592,2158592,2420736,2158592,2449408,2158592,2158592,2158592,2158592,2158592,3186688,2158592,0,641,0,0,0,0,0,0,2367488,2158592,2498560,2158592,2158592,1621,2158592,2158592,2568192,2158592,2592768,2625536,2158592,2158592,2674688,0,0,0,0,0,1608,97,97,97,97,97,97,97,97,97,97,1107,97,97,1110,97,97,3133440,3145728,3153920,2158592,2408448,2416640,2158592,2465792,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3014656,2158592,2158592,3051520,2158592,2158592,3100672,2158592,2158592,3121152,2158592,2158592,2158592,3149824,2416640,2207744,2465792,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2633728,2658304,2740224,2744320,2834432,2949120,2158592,2985984,2158592,2998272,2158592,2158592,2158592,3129344,2207744,2408448,2949120,2207744,2985984,2207744,2998272,2207744,2207744,2207744,3129344,2158592,2408448,2416640,2158592,2465792,2158592,2158592,2158592,2158592,2158592,3186688,2158592,0,32768,0,0,0,0,0,0,2367488,2949120,2158592,2985984,2158592,2998272,2158592,2158592,2158592,3129344,2158592,2158592,2478080,2158592,2158592,2158592,2535424,2543616,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3117056,2207744,2207744,2478080,2207744,2207744,2207744,2207744,2699264,2207744,2207744,2207744,2207744,2207744,2748416,2756608,2777088,2801664,2207744,2207744,2158877,2158877,2158877,2158877,2158877,0,0,0,2158877,2158877,2158877,2158877,0,0,2535709,2543901,2158877,2158877,2158877,0,0,0,2158877,2158877,2158877,2990365,2158877,2158877,2158730,2158730,2158730,2158730,2158730,2572426,2207744,2535424,2543616,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,3117056,2158592,2158592,2478080,2207744,2207744,2990080,2207744,2207744,2158592,2158592,2482176,2158592,2158592,0,0,0,2158592,2158592,2158592,0,2158592,2908160,2158592,2158592,2158592,2977792,2158592,2158592,2158592,2158592,3039232,2158592,2158592,3010560,2207744,2428928,2207744,2514944,2207744,2588672,2207744,2838528,2207744,2207744,2207744,3010560,2158592,2428928,2158592,2514944,0,0,2158592,2588672,2158592,0,2838528,2158592,2158592,2158592,3010560,2158592,2506752,2158592,18,0,0,0,0,0,0,0,2211840,0,0,0,0,2158592,0,0,29315,922,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,1539,45,3006464,2383872,0,2020,2158592,2158592,2158592,2158592,3006464,2158592,2637824,2953216,2158592,2207744,2637824,2953216,2207744,0,0,2158592,2637824,2953216,2158592,2539520,2158592,2539520,2207744,0,0,2539520,2158592,2158592,2158592,2158592,2207744,2506752,2207744,2207744,2207744,2207744,2207744,2158592,2506752,0,0,2158592,2207744,0,2158592,2158592,2207744,0,2158592,2158592,2207744,0,2158592,2965504,2965504,2965504,0,0,0,0,0,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2474269,2158877,2158877,0,0,2158877,2158877,2158877,2158877,2634013,2658589,0,0,2740509,2744605,0,2834717,40976,18,36884,45078,24,28,90143,94242,118820,102439,106538,98347,118820,118820,118820,40976,18,18,36884,0,0,0,24,24,24,27,27,27,27,90143,0,0,86016,0,0,2211840,102439,0,0,0,98347,0,2158592,2158592,2158592,2158592,2158592,3158016,0,2375680,2379776,2158592,2158592,2420736,2158592,2449408,2158592,2158592,0,94242,0,0,0,2211840,102439,0,0,106538,98347,135,2158592,2158592,2158592,2158592,2158592,2158592,2564096,2158592,2158592,2158592,2158592,2158592,2596864,2158592,2158592,2158592,2158592,2158592,2158592,2641920,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2781184,2793472,2494464,2158592,2158592,2158592,2523136,2527232,2158592,2158592,2576384,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,18,18,24,0,27,27,0,2158592,2498560,2158592,2158592,0,2158592,2158592,2568192,2158592,2592768,2625536,2158592,2158592,2674688,0,0,0,0,0,2211840,0,0,0,0,0,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2473984,2158592,2158592,2494464,2158592,2158592,2158592,3006464,2383872,0,0,2158592,2158592,2158592,2158592,3006464,2158592,2637824,2953216,2158592,2207744,2637824,2953216,40976,18,36884,45078,24,27,147488,94242,147456,147488,106538,98347,0,0,147456,40976,18,18,36884,0,45078,0,24,24,24,27,27,27,27,0,81920,0,94242,0,0,0,2211840,0,0,0,106538,98347,0,2158592,2158592,2158592,2158592,2158592,2158592,2428928,2158592,2514944,2158592,2588672,2158592,2838528,2158592,2158592,40976,18,151573,45078,24,27,90143,94242,0,102439,106538,98347,0,0,0,40976,18,18,36884,0,45078,0,24,24,24,27,27,27,27,90143,0,0,1315,0,97,97,97,97,97,97,97,97,97,97,1487,97,18,131427,0,0,0,0,0,0,362,0,0,365,29315,367,0,0,29315,0,0,0,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,130,94242,0,0,0,2211840,102439,0,0,106538,98347,0,2158592,2158592,2158592,2158592,2158592,2158592,3096576,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2207744,2207744,2158592,18,0,0,0,0,0,0,0,2211840,0,0,0,0,2158592,644,2207744,2207744,2207744,3186688,2207744,0,1080,0,1084,0,1088,0,0,0,0,0,0,0,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2531466,2158730,2158730,2158730,2158730,2158730,2617482,0,94242,0,0,0,2211840,102439,0,0,106538,98347,0,2158592,2158592,2158592,2158592,2158592,2781184,2793472,2158592,2818048,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,40976,18,36884,45078,24,27,90143,159779,159744,102439,159779,98347,0,0,159744,40976,18,18,36884,0,45078,0,2224253,172032,2224253,2232448,2232448,172032,2232448,90143,0,0,2170880,0,0,550,829,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,18,18,124,124,127,127,127,40976,18,36884,45078,25,29,90143,94242,0,102439,106538,98347,0,0,163931,40976,18,18,36884,0,45078,249856,24,24,24,27,27,27,27,90143,0,0,2170880,0,0,827,0,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,4243810,4243810,24,24,27,27,27,2207744,0,0,0,0,0,0,2166784,0,0,0,0,57344,286,2158592,2158592,2158592,2158592,2707456,2732032,2158592,2158592,2158592,2822144,2826240,2158592,2895872,2158592,2158592,2924544,2158592,2158592,2973696,2158592,2207744,2207744,2207744,3186688,2207744,0,0,0,0,0,0,53248,0,0,0,0,0,97,97,97,97,97,1613,97,97,97,97,97,97,1495,97,97,97,97,97,97,97,97,97,566,97,97,97,97,97,97,2207744,0,0,0,0,0,0,2166784,546,0,0,0,0,286,2158592,2158592,2158592,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,17,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,20480,120,121,18,18,36884,0,45078,0,24,24,24,27,27,27,27,90143,0,0,2170880,0,53248,550,0,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,196608,18,266240,24,24,27,27,27,0,94242,0,0,0,38,102439,0,0,106538,98347,0,45,45,45,45,45,45,45,1535,45,45,45,45,45,45,45,1416,45,45,45,45,45,45,45,45,424,45,45,45,45,45,45,45,45,45,405,45,45,45,45,45,45,45,45,45,45,45,45,45,199,45,45,67,67,67,67,67,491,67,67,67,67,67,67,67,67,67,67,67,1766,67,67,67,1767,67,24850,24850,12564,12564,0,0,2166784,546,0,53531,53531,0,286,97,97,0,0,97,97,97,97,97,97,0,0,97,97,0,97,97,97,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,743,57889,0,2170880,0,0,550,0,97,97,97,97,97,97,97,97,97,45,45,45,45,45,45,45,45,1856,45,1858,1859,67,67,67,1009,67,67,67,67,67,67,67,67,67,67,67,1021,67,67,67,67,67,25398,0,13112,0,54074,0,0,0,0,0,0,0,0,0,2367773,2158877,2158877,2158877,2158877,2158877,2158877,2699549,2158877,2158877,2158877,2158877,2158877,2748701,2756893,2777373,2801949,97,1115,97,97,97,97,97,97,97,97,97,97,97,97,97,97,857,97,67,67,67,67,67,1258,67,67,67,67,67,67,67,67,67,67,67,1826,67,97,97,97,97,97,97,1338,97,97,97,97,97,97,97,97,97,97,97,97,97,870,97,97,67,67,67,1463,67,67,67,67,67,67,67,67,67,67,67,67,67,1579,67,67,97,97,97,1518,97,97,97,97,97,97,97,97,97,97,97,97,97,904,905,97,97,97,97,1620,97,97,97,97,97,97,97,97,97,97,97,0,921,0,0,0,0,0,0,45,1679,67,67,67,1682,67,67,67,67,67,67,67,67,67,1690,67,0,0,97,97,97,97,45,45,67,67,0,0,97,97,45,45,45,669,45,45,45,45,45,45,45,45,45,45,45,45,189,45,45,45,1748,45,45,45,1749,1750,45,45,45,45,45,45,45,45,67,67,67,67,1959,67,67,67,67,1768,67,67,67,67,67,67,67,67,97,97,97,97,97,97,97,97,97,1791,97,97,97,97,97,97,97,97,45,45,45,45,45,45,1802,67,1817,67,67,67,67,67,67,1823,67,67,67,67,97,97,97,97,0,0,0,97,97,97,97,0,97,97,97,97,1848,45,45,45,45,45,45,45,45,45,45,45,659,45,45,45,45,45,45,45,1863,67,67,67,67,67,67,67,67,67,67,67,67,495,67,67,67,67,67,1878,97,97,97,97,0,0,0,97,97,97,97,0,0,97,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,45,45,45,45,45,45,67,67,67,67,97,97,97,97,0,0,0,1973,97,97,97,0,97,97,97,97,97,97,97,97,97,97,97,97,97,1165,97,1167,67,24850,24850,12564,12564,0,0,2166784,0,0,53531,53531,0,286,97,97,0,0,97,97,97,97,97,97,0,0,97,97,1789,97,0,94242,0,0,0,2211840,102439,0,0,106538,98347,136,2158592,2158592,2158592,2158592,2158592,3158016,229376,2375680,2379776,2158592,2158592,2420736,2158592,2449408,2158592,2158592,67,24850,24850,12564,12564,0,0,280,547,0,53531,53531,0,286,97,97,0,0,97,97,97,97,97,97,0,1788,97,97,0,97,2024,97,45,45,45,45,45,45,67,67,67,67,67,67,67,67,235,67,67,67,67,67,57889,547,547,0,0,550,0,97,97,97,97,97,97,97,97,97,45,45,45,1799,45,45,45,67,67,67,67,67,25398,0,13112,0,54074,0,0,1092,0,0,0,0,0,97,97,97,97,1612,97,97,97,97,1616,97,1297,1472,0,0,0,0,1303,1474,0,0,0,0,1309,1476,0,0,0,0,97,97,97,1481,97,97,97,97,97,97,1488,97,0,1474,0,1476,0,97,97,97,97,97,97,97,97,97,97,97,607,97,97,97,97,40976,18,36884,45078,26,30,90143,94242,0,102439,106538,98347,0,0,213080,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,143448,40976,18,18,36884,0,45078,0,24,24,24,27,27,27,27,0,0,0,0,97,97,97,97,1482,97,1483,97,97,97,97,97,97,1326,97,97,1329,1330,97,97,97,97,97,97,1159,1160,97,97,97,97,97,97,97,97,590,97,97,97,97,97,97,97,0,94242,0,0,0,2211974,102439,0,0,106538,98347,0,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2474122,2158730,2158730,2494602,2158730,2158730,2158730,2809994,2158730,2158730,2842762,2158730,2158730,2158730,2900106,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3014794,2158730,2158730,3051658,2158730,2158730,3100810,2158730,2158730,2158730,2158730,3096714,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2207744,2207744,2207744,2207744,2207744,2572288,2207744,2207744,2207744,2207744,541,541,543,543,0,0,2166784,0,548,549,549,0,286,2158877,2158877,2158877,2863389,2892061,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,3186973,2158877,0,0,0,0,0,0,0,0,2367626,2158877,2404637,2412829,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2564381,2158877,2158877,2605341,2158877,2158877,2158877,2158877,2158877,2158877,2679069,2158877,2695453,2158877,2703645,2158877,2711837,2752797,2158877,0,2158877,2158877,2158877,2384010,2158730,2158730,2158730,2158730,3006602,2383872,2207744,2207744,2207744,2207744,2207744,2207744,3096576,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,0,0,0,2162688,0,0,2158877,2785565,2158877,2810141,2158877,2158877,2842909,2158877,2158877,2158877,2900253,2158877,2158877,2158877,2158877,2158877,2531613,2158877,2158877,2158877,2158877,2158877,2617629,2158877,2158877,2158877,2158877,2158730,2818186,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3105053,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,0,0,0,0,0,97,97,97,1611,97,97,97,97,97,97,97,1496,97,97,1499,97,97,97,97,97,2441354,2445450,2158730,2158730,2158730,2158730,2158730,2158730,2502794,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2433162,2158730,2453642,2461834,2158730,2158730,2158730,2158730,2158730,2158730,2580618,2158730,2158730,2158730,2158730,2621578,2158730,2158730,2158730,2158730,2158730,2158730,2699402,2158730,2158730,2158730,2158730,2678922,2158730,2695306,2158730,2703498,2158730,2711690,2752650,2158730,2158730,2785418,2158730,2158730,2158730,3113098,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3186826,2158730,2207744,2207744,2207744,2207744,2781184,2793472,2207744,2818048,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,541,0,543,2158877,2502941,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2580765,2158877,2158877,2158877,2158877,2621725,2158877,3019037,2158877,3043613,2158877,2158877,2158877,2158877,3080477,2158877,2158877,3113245,2158877,2158877,2158877,2158877,0,2158877,2908445,2158877,2158877,2158877,2978077,2158877,2158877,2158877,2158877,3039517,2158877,2158730,2510986,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2584714,2158730,2609290,2158730,2158730,2629770,2158730,2158730,2158730,2388106,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2605194,2158730,2158730,2158730,2158730,2687114,2158730,2715786,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2867338,2158730,2904202,2158730,2158730,2158730,2642058,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2781322,2793610,2158730,3121290,2158730,2158730,2158730,3149962,2158730,2158730,3170442,3174538,2158730,2367488,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2441216,2445312,2207744,2207744,2207744,2207744,2207744,2207744,2502656,2158877,2433309,2158877,2453789,2461981,2158877,2158877,2158877,2158877,2158877,2158877,2511133,2158877,2158877,2158877,2158877,2584861,2158877,2609437,2158877,2158877,2629917,2158877,2158877,2158877,2687261,2158877,2715933,2158877,2158730,2158730,2973834,2158730,2982026,2158730,2158730,3002506,2158730,3047562,3063946,3076234,2158730,2158730,2158730,2158730,2207744,2506752,2207744,2207744,2207744,2207744,2207744,2158877,2507037,0,0,2158877,2158730,2158730,2158730,3203210,2207744,2207744,2207744,2207744,2207744,2424832,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2564096,2207744,2207744,2207744,2707741,2732317,2158877,2158877,2158877,2822429,2826525,2158877,2896157,2158877,2158877,2924829,2158877,2158877,2973981,2158877,18,0,0,0,0,0,0,0,2211840,0,0,642,0,2158592,0,45,1529,45,45,45,45,45,45,45,45,45,45,45,45,45,1755,45,67,67,2982173,2158877,2158877,3002653,2158877,3047709,3064093,3076381,2158877,2158877,2158877,2158877,2158877,2158877,2158877,3203357,2523274,2527370,2158730,2158730,2576522,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2908298,2494749,2158877,2158877,2158877,2523421,2527517,2158877,2158877,2576669,2158877,2158877,2158877,2158877,2158877,2158877,0,40976,0,18,18,4321280,2224253,2232448,4329472,2232448,2158730,2498698,2158730,2158730,2158730,2158730,2568330,2158730,2592906,2625674,2158730,2158730,2674826,2736266,2158730,2158730,2158730,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2158730,2912394,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3109002,2158730,2158730,3133578,3145866,3154058,2375680,2207744,3108864,2207744,2207744,3133440,3145728,3153920,2375965,2380061,2158877,2158877,2421021,2158877,2449693,2158877,2158877,2158877,3117341,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3104906,2158730,2158730,2158730,2158730,2158730,2158730,2158877,2498845,2158877,2158877,0,2158877,2158877,2568477,2158877,2593053,2625821,2158877,2158877,2674973,0,0,0,0,97,97,1480,97,97,97,97,97,1485,97,97,97,0,97,97,1729,97,1731,97,97,97,97,97,97,97,311,97,97,97,97,97,97,97,97,1520,97,97,1523,97,97,1526,97,2736413,2158877,2158877,0,2158877,2912541,2158877,2158877,2158877,2158877,2158877,2158877,2158877,3109149,2158877,2158877,3014941,2158877,2158877,3051805,2158877,2158877,3100957,2158877,2158877,3121437,2158877,2158877,2158877,3150109,3133725,3146013,3154205,2158730,2408586,2416778,2158730,2465930,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3018890,2158730,3043466,2158730,2158730,2158730,2158730,3080330,2633866,2658442,2740362,2744458,2834570,2949258,2158730,2986122,2158730,2998410,2158730,2158730,2158730,3129482,2207744,2408448,2949120,2207744,2985984,2207744,2998272,2207744,2207744,2207744,3129344,2158877,2408733,2416925,2158877,2466077,2158877,2158877,3170589,3174685,2158877,0,0,0,2158730,2158730,2158730,2158730,2158730,2424970,2158730,2158730,2158730,2158730,2707594,2732170,2158730,2158730,2158730,2822282,2826378,2158730,2896010,2158730,2158730,2924682,2949405,2158877,2986269,2158877,2998557,2158877,2158877,2158877,3129629,2158730,2158730,2478218,2158730,2158730,2158730,2535562,2543754,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,2158730,3117194,2207744,2207744,2478080,2207744,2207744,2207744,2207744,3014656,2207744,2207744,3051520,2207744,2207744,3100672,2207744,2207744,3121152,2207744,2207744,2207744,2207744,2207744,2584576,2207744,2609152,2207744,2207744,2629632,2207744,2207744,2207744,2686976,2207744,2207744,2535424,2543616,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,3117056,2158877,2158877,2478365,0,2158877,2158877,2158877,2158877,2158877,2158877,2158730,2158730,2482314,2158730,2158730,2158730,2158730,2158730,2158730,2207744,2207744,2207744,2387968,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,823,0,825,2158730,2158730,2158730,2990218,2158730,2158730,2207744,2207744,2482176,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,0,0,0,2162688,135,0,2207744,2207744,2990080,2207744,2207744,2158877,2158877,2482461,2158877,2158877,0,0,0,2158877,2158877,2158877,2158877,2158877,2158730,2429066,2158730,2515082,2158730,2588810,2158730,2838666,2158730,2158730,2158730,3010698,2207744,2428928,2207744,2514944,2207744,2588672,2207744,2838528,2207744,2207744,2207744,3010560,2158877,2429213,2158877,2515229,0,0,2158877,2588957,2158877,0,2838813,2158877,2158877,2158877,3010845,2158730,2506890,2158730,2158730,2158730,2748554,2756746,2777226,2801802,2158730,2158730,2158730,2863242,2891914,2158730,2158730,2158730,2158730,2158730,2158730,2564234,2158730,2158730,2158730,2158730,2158730,2597002,2158730,2158730,2158730,3006464,2384157,0,0,2158877,2158877,2158877,2158877,3006749,2158730,2637962,2953354,2158730,2207744,2637824,2953216,2207744,0,0,2158877,2638109,2953501,2158877,2539658,2158730,2539520,2207744,0,0,2539805,2158877,2158730,2158730,2158730,2977930,2158730,2158730,2158730,2158730,3039370,2158730,2158730,2158730,2158730,2158730,2158730,3158154,2207744,0,2158877,2158730,2207744,0,2158877,2158730,2207744,0,2158877,2965642,2965504,2965789,0,0,0,0,1315,0,0,0,0,97,97,97,97,97,97,97,1484,97,97,97,97,2158592,18,0,122880,0,0,0,77824,0,2211840,0,0,0,0,2158592,0,356,0,0,0,0,0,0,28809,0,139,45,45,45,45,45,45,1751,45,45,45,45,45,45,45,67,67,1427,67,67,67,67,67,1432,67,67,67,3104768,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,122880,0,0,0,0,1315,0,0,0,0,97,97,97,97,97,97,1322,550,0,286,0,2158592,2158592,2158592,2158592,2158592,2424832,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,18,18,24,24,4329472,27,27,2207744,2207744,2977792,2207744,2207744,2207744,2207744,3039232,2207744,2207744,2207744,2207744,2207744,2207744,3158016,542,0,0,0,542,0,544,0,0,0,544,0,550,0,0,0,0,0,97,97,1610,97,97,97,97,97,97,97,97,898,97,97,97,97,97,97,97,0,94242,0,0,0,2211840,0,0,0,0,0,0,2158592,2158592,2158592,2158592,2158592,2424832,2158592,2158592,2158592,2158592,2158592,2158592,40976,18,36884,45078,24,27,90143,94242,237568,102439,106538,98347,0,0,20480,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,192512,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,94,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,96,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,12378,40976,18,18,36884,0,45078,0,24,24,24,126,126,126,126,90143,0,0,2170880,0,0,0,0,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,20480,40976,0,18,18,24,24,27,27,27,40976,18,36884,45078,24,27,90143,94242,241664,102439,106538,98347,0,0,20568,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,200797,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,20480,40976,18,36884,45078,24,27,90143,94242,0,0,0,44,0,0,20575,40976,18,36884,45078,24,27,90143,94242,0,41,41,41,0,0,1126400,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,0,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,89,40976,18,18,36884,0,45078,0,24,24,24,27,131201,27,27,90143,0,0,2170880,0,0,550,0,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2441216,2445312,2158592,2158592,2158592,2158592,2158592,0,94242,0,0,208896,2211840,102439,0,0,106538,98347,0,2158592,2158592,2158592,2158592,2158592,3186688,2158592,0,0,0,0,0,0,0,0,2367488,32768,0,0,0,0,0,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2433024,2158592,2453504,2461696,2158592,2158592,2158592,2158592,2158592,2158592,2510848,2158592,2158592,2158592,2158592,40976,18,36884,245783,24,27,90143,94242,0,102439,106538,98347,0,0,20480,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,221184,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,180224,40976,18,18,36884,155648,45078,0,24,24,217088,27,27,27,217088,90143,0,0,2170880,0,0,828,0,2158592,2158592,2158592,2387968,2158592,2158592,2158592,2158592,2158592,2158592,2207744,2207744,2207744,2387968,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,0,0,0,2162688,233472,0,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,45,45,718,45,45,45,45,45,45,45,45,45,727,131427,0,0,0,0,362,0,365,28809,367,139,45,45,45,45,45,45,1808,45,45,45,45,67,67,67,67,67,67,67,97,97,0,0,97,67,24850,24850,12564,12564,0,57889,0,0,0,53531,53531,367,286,97,97,0,0,97,97,97,97,97,97,1787,0,97,97,0,97,97,97,45,45,45,45,2029,45,67,67,67,67,2033,57889,0,0,54074,54074,550,0,97,97,97,97,97,97,97,97,97,45,1798,45,45,1800,45,45,0,1472,0,0,0,0,0,1474,0,0,0,0,0,1476,0,0,0,0,1315,0,0,0,0,97,97,97,97,1320,97,97,0,0,97,97,97,97,1786,97,0,0,97,97,0,1790,1527,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,663,67,24850,24850,12564,12564,0,57889,281,0,0,53531,53531,367,286,97,97,0,0,97,97,97,1785,97,97,0,0,97,97,0,97,97,1979,97,97,45,45,1983,45,1984,45,45,45,45,45,652,45,45,45,45,45,45,45,45,45,45,690,45,45,694,45,45,40976,19,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,262144,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,46,67,98,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,45,67,97,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,258048,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,1122423,40976,18,36884,45078,24,27,90143,94242,0,1114152,1114152,1114152,0,0,1114112,40976,18,36884,45078,24,27,90143,94242,37,102439,106538,98347,0,0,204800,40976,18,36884,45078,24,27,90143,94242,0,102439,106538,98347,0,0,57436,40976,18,36884,45078,24,27,33,33,0,33,33,33,0,0,0,40976,18,18,36884,0,45078,0,124,124,124,127,127,127,127,90143,0,0,2170880,0,0,550,0,2158877,2158877,2158877,2388253,2158877,2158877,2158877,2158877,2158877,2781469,2793757,2158877,2818333,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2867485,2158877,2904349,2158877,2158877,2158877,2158877,2158877,2158877,2158877,3096861,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2158877,2441501,2445597,2158877,2158877,2158877,2158877,2158877,40976,122,123,36884,0,45078,0,24,24,24,27,27,27,27,90143,0,921,29315,0,0,0,0,45,45,45,45,45,45,45,45,936,2158592,4243810,0,0,0,0,0,0,0,2211840,0,0,0,0,2158592,0,921,29315,0,0,0,0,45,45,45,45,45,45,45,935,45,45,45,715,45,45,45,45,45,45,45,723,45,45,45,45,45,1182,45,45,45,45,45,45,45,45,45,45,430,45,45,45,45,45,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,47,68,99,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,48,69,100,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,49,70,101,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,50,71,102,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,51,72,103,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,52,73,104,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,53,74,105,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,54,75,106,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,55,76,107,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,56,77,108,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,57,78,109,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,58,79,110,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,59,80,111,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,60,81,112,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,61,82,113,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,62,83,114,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,63,84,115,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,64,85,116,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,65,86,117,40976,18,36884,45078,24,27,90143,94242,38,102439,106538,98347,66,87,118,40976,18,36884,45078,24,27,90143,94242,118820,102439,106538,98347,118820,118820,118820,40976,18,18,0,0,45078,0,24,24,24,27,27,27,27,90143,0,0,1314,0,0,0,0,0,0,97,97,97,97,97,1321,97,18,131427,0,0,0,0,0,0,362,0,0,365,0,367,0,0,1315,0,97,97,97,97,97,97,97,97,97,97,97,97,97,1360,97,97,131,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,145,149,45,45,45,45,45,174,45,179,45,185,45,188,45,45,202,67,255,67,67,269,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,97,292,296,97,97,97,97,97,321,97,326,97,332,97,18,131427,0,0,0,0,0,0,362,0,0,365,29315,367,646,335,97,97,349,97,97,0,40976,0,18,18,24,24,27,27,27,437,45,45,45,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,523,67,67,67,67,67,67,67,67,67,67,67,67,511,67,67,67,97,97,97,620,97,97,97,97,97,97,97,97,97,97,97,97,97,1501,1502,97,793,67,67,796,67,67,67,67,67,67,67,67,67,67,808,67,0,0,97,97,97,97,45,45,67,67,0,0,97,97,2052,67,67,67,67,813,67,67,67,67,67,67,67,25398,542,13112,544,57889,0,0,54074,54074,550,830,97,97,97,97,97,97,97,97,97,315,97,97,97,97,97,97,841,97,97,97,97,97,97,97,97,97,854,97,97,97,97,97,97,589,97,97,97,97,97,97,97,97,97,867,97,97,97,97,97,97,97,891,97,97,894,97,97,97,97,97,97,97,97,97,97,906,45,937,45,45,940,45,45,45,45,45,45,948,45,45,45,45,45,734,735,67,737,67,738,67,740,67,67,67,45,967,45,45,45,45,45,45,45,45,45,45,45,45,45,45,435,45,45,45,980,45,45,45,45,45,45,45,45,45,45,45,45,45,415,45,45,67,67,1024,67,67,67,67,67,67,67,67,67,67,67,67,67,97,97,97,67,67,67,67,67,25398,1081,13112,1085,54074,1089,0,0,0,0,0,0,363,0,28809,0,139,45,45,45,45,45,45,1674,45,45,45,45,45,45,45,45,67,1913,67,1914,67,67,67,1918,67,67,97,97,97,97,1118,97,97,97,97,97,97,97,97,97,97,97,630,97,97,97,97,97,1169,97,97,97,97,97,0,921,0,1175,0,0,0,0,45,45,45,45,45,45,1534,45,45,45,45,45,1538,45,45,45,45,1233,45,45,45,45,45,45,67,67,67,67,67,67,67,67,742,67,45,45,1191,45,45,45,45,45,45,45,45,45,45,45,45,45,454,67,67,67,67,1243,67,67,67,67,67,67,67,67,67,67,67,1251,67,0,0,97,97,97,97,45,45,67,67,2050,0,97,97,45,45,45,732,45,45,67,67,67,67,67,67,67,67,67,67,67,67,97,97,67,67,67,1284,67,67,67,67,67,67,67,67,67,67,67,67,772,67,67,67,1293,67,67,67,67,67,67,0,0,0,0,0,0,0,0,0,0,368,2158592,2158592,2158592,2404352,2412544,1323,97,97,97,97,97,97,97,97,97,97,97,1331,97,97,97,0,97,97,97,97,97,97,97,97,97,97,97,1737,97,1364,97,97,97,97,97,97,97,97,97,97,97,97,1373,97,18,131427,0,0,0,0,0,0,362,0,0,365,29315,367,647,45,45,1387,45,45,1391,45,45,45,45,45,45,45,45,45,45,410,45,45,45,45,45,1400,45,45,45,45,45,45,45,45,45,45,1407,45,45,45,45,45,941,45,943,45,45,45,45,45,45,951,45,67,1438,67,67,67,67,67,67,67,67,67,67,1447,67,67,67,67,67,67,782,67,67,67,67,67,67,67,67,67,756,67,67,67,67,67,67,97,1491,97,97,97,97,97,97,97,97,97,97,1500,97,97,97,0,97,97,97,97,97,97,97,97,97,97,1736,97,45,45,1541,45,45,45,45,45,45,45,45,45,45,45,45,45,677,45,45,67,1581,67,67,67,67,67,67,67,67,67,67,67,67,67,67,791,792,67,67,67,67,1598,67,1600,67,67,67,67,67,67,67,67,1472,97,97,97,1727,97,97,97,97,97,97,97,97,97,97,97,97,97,1513,97,97,67,67,97,1879,97,1881,97,0,1884,0,97,97,97,97,0,0,97,97,97,97,97,0,0,0,1842,97,97,67,67,67,67,67,97,97,97,97,1928,0,0,0,97,97,97,97,97,97,45,45,45,45,45,1903,45,45,45,67,67,67,67,97,97,97,97,1971,0,0,97,97,97,97,0,97,97,97,97,97,97,97,97,97,0,0,0,45,45,45,1381,45,45,45,45,1976,97,97,97,97,97,45,45,45,45,45,45,45,45,45,45,45,45,1747,809,67,67,67,67,67,67,67,67,67,67,67,25398,542,13112,544,97,907,97,97,97,97,97,97,97,97,97,97,97,638,0,0,0,0,1478,97,97,97,97,97,97,97,97,97,97,97,1150,97,97,97,97,67,67,67,67,1244,67,67,67,67,67,67,67,67,67,67,67,477,67,67,67,67,67,67,1294,67,67,67,67,0,0,0,0,0,0,0,0,0,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1324,97,97,97,97,97,97,97,97,97,97,97,97,97,0,0,0,1374,97,97,97,97,0,1175,0,45,45,45,45,45,45,45,45,945,45,45,45,45,45,45,45,45,1908,45,45,1910,45,67,67,67,67,67,67,67,67,1919,67,0,0,97,97,97,97,45,2048,67,2049,0,0,97,2051,45,45,45,939,45,45,45,45,45,45,45,45,45,45,45,45,397,45,45,45,1921,67,67,1923,67,97,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,45,1947,45,1935,0,0,0,97,1939,97,97,1941,97,45,45,45,45,45,45,382,389,45,45,45,45,45,45,45,45,1810,45,45,1812,67,67,67,67,67,256,67,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,336,97,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,131427,0,0,0,0,362,0,365,28809,367,139,45,45,371,373,45,45,45,955,45,45,45,45,45,45,45,45,45,45,45,45,413,45,45,45,457,459,67,67,67,67,67,67,67,67,473,67,478,67,67,482,67,67,485,67,67,67,67,67,67,67,67,67,67,67,67,67,97,1828,97,554,556,97,97,97,97,97,97,97,97,570,97,575,97,97,579,97,97,582,97,97,97,97,97,97,97,97,97,97,97,97,97,330,97,97,67,746,67,67,67,67,67,67,67,67,67,758,67,67,67,67,67,67,67,1575,67,67,67,67,67,67,67,67,493,67,67,67,67,67,67,67,97,97,844,97,97,97,97,97,97,97,97,97,856,97,97,97,0,97,97,97,97,97,97,97,97,1735,97,97,97,0,97,97,97,97,97,97,97,1642,97,1644,97,97,890,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,0,67,67,67,67,1065,1066,67,67,67,67,67,67,67,67,67,67,532,67,67,67,67,67,67,67,1451,67,67,67,67,67,67,67,67,67,67,67,67,67,496,67,67,97,97,1505,97,97,97,97,97,97,97,97,97,97,97,97,97,593,97,97,0,1474,0,1476,0,97,97,97,97,97,97,97,97,97,97,1617,97,97,1635,0,1637,97,97,97,97,97,97,97,97,97,97,97,885,97,97,97,97,67,67,1704,67,67,67,67,97,97,97,97,97,97,97,97,97,565,572,97,97,97,97,97,97,97,97,1832,0,97,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,1946,45,45,67,67,67,67,67,97,1926,97,1927,97,0,0,0,97,97,1934,2043,0,0,97,97,97,2047,45,45,67,67,0,1832,97,97,45,45,45,981,45,45,45,45,45,45,45,45,45,45,45,45,1227,45,45,45,131427,0,0,0,0,362,0,365,28809,367,139,45,45,372,45,45,45,45,1661,1662,45,45,45,45,45,1666,45,45,45,45,45,1673,45,1675,45,45,45,45,45,45,45,67,1426,67,67,67,67,67,67,67,67,67,67,1275,67,67,67,67,67,45,418,45,45,420,45,45,423,45,45,45,45,45,45,45,45,959,45,45,962,45,45,45,45,458,67,67,67,67,67,67,67,67,67,67,67,67,67,67,483,67,67,67,67,504,67,67,506,67,67,509,67,67,67,67,67,67,67,528,67,67,67,67,67,67,67,67,1287,67,67,67,67,67,67,67,555,97,97,97,97,97,97,97,97,97,97,97,97,97,97,580,97,97,97,97,601,97,97,603,97,97,606,97,97,97,97,97,97,848,97,97,97,97,97,97,97,97,97,1498,97,97,97,97,97,97,45,45,714,45,45,45,45,45,45,45,45,45,45,45,45,45,989,990,45,67,67,67,67,67,1011,67,67,67,67,1015,67,67,67,67,67,67,67,753,67,67,67,67,67,67,67,67,467,67,67,67,67,67,67,67,45,45,1179,45,45,45,45,45,45,45,45,45,45,45,45,45,1003,1004,67,1217,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,728,67,1461,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1034,67,97,1516,97,97,97,97,97,97,97,97,97,97,97,97,97,97,871,97,67,67,67,1705,67,67,67,97,97,97,97,97,97,97,97,97,567,97,97,97,97,97,97,97,97,97,97,1715,97,97,97,97,97,97,97,97,97,0,0,0,45,45,1380,45,45,45,45,45,67,67,97,97,97,97,97,0,0,0,97,1887,97,97,0,0,97,97,97,0,97,97,97,97,97,2006,45,45,1907,45,45,45,45,45,67,67,67,67,67,67,67,67,67,1920,67,97,0,2035,97,97,97,97,97,45,45,45,45,67,67,67,1428,67,67,67,67,67,67,1435,67,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,146,45,152,45,45,165,45,175,45,180,45,45,187,190,195,45,203,254,257,262,67,270,67,67,0,24850,12564,0,0,0,281,28809,53531,97,97,97,293,97,299,97,97,312,97,322,97,327,97,97,334,337,342,97,350,97,97,0,40976,0,18,18,24,24,27,27,27,67,484,67,67,67,67,67,67,67,67,67,67,67,67,67,499,97,581,97,97,97,97,97,97,97,97,97,97,97,97,97,596,648,45,650,45,651,45,653,45,45,45,657,45,45,45,45,45,45,1954,67,67,67,1958,67,67,67,67,67,67,67,768,67,67,67,67,67,67,67,67,769,67,67,67,67,67,67,67,680,45,45,45,45,45,45,45,45,688,689,691,45,45,45,45,45,983,45,45,45,45,45,45,45,45,45,45,947,45,45,45,45,952,45,45,698,699,45,45,702,703,45,45,45,45,45,45,45,711,744,67,67,67,67,67,67,67,67,67,757,67,67,67,67,761,67,67,67,67,765,67,767,67,67,67,67,67,67,67,67,775,776,778,67,67,67,67,67,67,785,786,67,67,789,790,67,67,67,67,67,67,1442,67,67,67,67,67,67,67,67,67,97,97,97,1775,97,97,97,67,67,67,67,67,798,67,67,67,802,67,67,67,67,67,67,67,67,1465,67,67,1468,67,67,1471,67,67,810,67,67,67,67,67,67,67,67,67,821,25398,542,13112,544,57889,0,0,54074,54074,550,0,833,97,835,97,836,97,838,97,97,0,0,97,97,97,2002,97,97,97,97,97,45,45,45,45,45,1740,45,45,45,1744,45,45,45,97,842,97,97,97,97,97,97,97,97,97,855,97,97,97,97,0,1717,1718,97,97,97,97,97,1722,97,0,0,859,97,97,97,97,863,97,865,97,97,97,97,97,97,97,97,604,97,97,97,97,97,97,97,873,874,876,97,97,97,97,97,97,883,884,97,97,887,888,97,18,131427,0,0,0,0,0,0,362,225280,0,365,0,367,0,45,45,45,1531,45,45,45,45,45,45,45,45,45,45,45,1199,45,45,45,45,45,97,97,908,97,97,97,97,97,97,97,97,97,919,638,0,0,0,0,2158877,2158877,2158877,2158877,2158877,2425117,2158877,2158877,2158877,2158877,2158877,2158877,2597149,2158877,2158877,2158877,2158877,2158877,2158877,2642205,2158877,2158877,2158877,2158877,2158877,3158301,0,2375818,2379914,2158730,2158730,2420874,2158730,2449546,2158730,2158730,953,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,965,978,45,45,45,45,45,45,985,45,45,45,45,45,45,45,45,971,45,45,45,45,45,45,45,67,67,67,67,67,1027,67,1029,67,67,67,67,67,67,67,67,67,1455,67,67,67,67,67,67,67,1077,1078,67,67,25398,0,13112,0,54074,0,0,0,0,0,0,0,0,366,0,139,2158730,2158730,2158730,2404490,2412682,1113,97,97,97,97,97,97,1121,97,1123,97,97,97,97,97,97,0,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1540,1155,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,615,1168,97,97,1171,1172,97,97,0,921,0,1175,0,0,0,0,45,45,45,45,45,1533,45,45,45,45,45,45,45,45,45,1663,45,45,45,45,45,45,45,45,45,183,45,45,45,45,201,45,45,45,1219,45,45,45,45,45,45,45,1226,45,45,45,45,45,168,45,45,45,45,45,45,45,45,45,45,427,45,45,45,45,45,45,45,1231,45,45,45,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,67,1242,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1046,67,67,1254,67,1256,67,67,67,67,67,67,67,67,67,67,67,67,806,807,67,67,97,1336,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1111,97,97,97,97,97,1351,97,97,97,1354,97,97,97,1359,97,97,97,0,97,97,97,97,1640,97,97,97,97,97,97,97,897,97,97,97,902,97,97,97,97,97,97,97,97,1366,97,97,97,97,97,97,97,1371,97,97,97,0,97,97,97,1730,97,97,97,97,97,97,97,97,915,97,97,97,97,0,360,0,67,67,67,1440,67,67,67,67,67,67,67,67,67,67,67,67,1017,67,1019,67,67,67,67,67,1453,67,67,67,67,67,67,67,67,67,67,1459,97,97,97,1493,97,97,97,97,97,97,97,97,97,97,97,97,97,1525,97,97,97,97,97,97,1507,97,97,97,97,97,97,97,97,97,97,1514,67,67,67,67,1584,67,67,67,67,67,1590,67,67,67,67,67,67,67,783,67,67,67,788,67,67,67,67,67,67,67,67,67,1599,1601,67,67,67,1604,67,1606,1607,67,1472,0,1474,0,1476,0,97,97,97,97,97,97,1614,97,97,97,97,45,45,1850,45,45,45,45,1855,45,45,45,45,45,1222,45,45,45,45,45,45,45,45,45,1229,97,1618,97,97,97,97,97,97,97,1625,97,97,97,97,97,0,1175,0,45,45,45,45,45,45,45,45,447,45,45,45,45,45,67,67,1633,97,97,0,97,97,97,97,97,97,97,97,1643,1645,97,97,0,0,97,97,1784,97,97,97,0,0,97,97,0,97,1894,1895,97,1897,97,45,45,45,45,45,45,45,45,45,656,45,45,45,45,45,45,97,1648,97,1650,1651,97,0,45,45,45,1654,45,45,45,45,45,169,45,45,45,45,45,45,45,45,45,45,658,45,45,45,45,664,45,45,1659,45,45,45,45,45,45,45,45,45,45,45,45,45,1187,45,45,1669,45,45,45,45,45,45,45,45,45,45,45,45,45,45,67,1005,67,67,1681,67,67,67,67,67,67,67,1686,67,67,67,67,67,67,67,784,67,67,67,67,67,67,67,67,1055,67,67,67,67,1060,67,67,97,97,1713,97,0,97,97,97,97,97,97,97,97,97,0,0,0,1378,45,45,45,45,45,45,45,408,45,45,45,45,45,45,45,45,1547,45,1549,45,45,45,45,45,97,97,1780,0,97,97,97,97,97,97,0,0,97,97,0,97,97,97,45,45,2027,2028,45,45,67,67,2031,2032,67,45,45,1804,45,45,45,45,45,45,45,45,67,67,67,67,67,67,1917,67,67,67,67,67,67,67,1819,67,67,67,67,67,67,67,67,97,97,97,1708,97,97,97,97,97,45,45,1862,67,67,67,67,67,67,67,67,67,67,67,67,67,497,67,67,67,1877,97,97,97,97,97,0,0,0,97,97,97,97,0,0,97,97,97,97,97,1839,0,0,97,97,97,97,1936,0,0,97,97,97,97,97,97,1943,1944,1945,45,45,45,45,670,45,45,45,45,674,45,45,45,45,678,45,1948,45,1950,45,45,45,45,1955,1956,1957,67,67,67,1960,67,1962,67,67,67,67,1967,1968,1969,97,0,0,0,97,97,1974,97,0,1936,0,97,97,97,97,97,97,45,45,45,45,45,45,45,45,1906,0,1977,97,97,97,97,45,45,45,45,45,45,45,45,45,45,45,1746,45,45,45,45,2011,67,67,2013,67,67,67,2017,97,97,0,0,2021,97,8192,97,97,2025,45,45,45,45,45,45,67,67,67,67,67,1916,67,67,67,67,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,140,45,45,45,1180,45,45,45,45,1184,45,45,45,45,45,45,45,387,45,392,45,45,396,45,45,399,45,45,67,207,67,67,67,67,67,67,236,67,67,67,67,67,67,67,800,67,67,67,67,67,67,67,67,67,1603,67,67,67,67,67,0,97,97,287,97,97,97,97,97,97,316,97,97,97,97,97,97,0,45,45,45,45,45,45,45,1656,1657,45,376,45,45,45,45,45,388,45,45,45,45,45,45,45,45,1406,45,45,45,45,45,45,45,67,67,67,67,462,67,67,67,67,67,474,67,67,67,67,67,67,67,817,67,67,67,67,25398,542,13112,544,97,97,97,97,559,97,97,97,97,97,571,97,97,97,97,97,97,896,97,97,97,900,97,97,97,97,97,97,912,914,97,97,97,97,97,0,0,0,45,45,45,45,45,45,45,45,391,45,45,45,45,45,45,45,45,713,45,45,45,45,45,45,45,45,45,45,45,45,45,45,662,45,1140,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,636,67,67,1283,67,67,67,67,67,67,67,67,67,67,67,67,67,513,67,67,1363,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,889,97,97,97,1714,0,97,97,97,97,97,97,97,97,97,0,0,926,45,45,45,45,45,45,45,45,672,45,45,45,45,45,45,45,45,686,45,45,45,45,45,45,45,45,944,45,45,45,45,45,45,45,45,1676,45,45,45,45,45,45,67,97,97,97,1833,0,97,97,97,97,97,0,0,0,97,97,97,97,97,97,45,45,45,45,1902,45,45,45,45,45,957,45,45,45,45,961,45,963,45,45,45,67,97,2034,0,97,97,97,97,97,2040,45,45,45,2042,67,67,67,67,67,67,1574,67,67,67,67,67,1578,67,67,67,67,67,67,799,67,67,67,804,67,67,67,67,67,67,67,1298,0,0,0,1304,0,0,0,1310,132,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,45,45,1414,45,45,45,45,45,45,45,45,45,45,428,45,45,45,45,45,57889,0,0,54074,54074,550,831,97,97,97,97,97,97,97,97,97,568,97,97,97,97,578,97,45,45,968,45,45,45,45,45,45,45,45,45,45,45,45,45,1228,45,45,67,67,67,67,67,25398,1082,13112,1086,54074,1090,0,0,0,0,0,0,364,0,0,0,139,2158592,2158592,2158592,2404352,2412544,67,67,67,67,1464,67,67,67,67,67,67,67,67,67,67,67,510,67,67,67,67,97,97,97,97,1519,97,97,97,97,97,97,97,97,97,97,97,918,97,0,0,0,0,1528,45,45,45,45,45,45,45,45,45,45,45,45,45,45,976,45,1554,45,45,45,45,45,45,45,45,1562,45,45,1565,45,45,45,45,683,45,45,45,687,45,45,692,45,45,45,45,45,1953,45,67,67,67,67,67,67,67,67,67,1014,67,67,67,67,67,67,1568,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,0,67,67,67,67,67,1585,67,67,67,67,67,67,67,67,67,1594,97,97,1649,97,97,97,0,45,45,1653,45,45,45,45,45,45,383,45,45,45,45,45,45,45,45,45,986,45,45,45,45,45,45,45,45,1670,45,1672,45,45,45,45,45,45,45,45,45,45,67,736,67,67,67,67,67,741,67,67,67,1680,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1074,67,67,67,1692,67,67,67,67,67,67,67,1697,67,1699,67,67,67,67,67,67,1012,67,67,67,67,67,67,67,67,67,468,475,67,67,67,67,67,67,1769,67,67,67,67,67,67,67,97,97,97,97,97,97,97,624,97,97,97,97,97,97,634,97,97,1792,97,97,97,97,97,97,97,45,45,45,45,45,45,45,958,45,45,45,45,45,45,964,45,150,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,977,204,45,67,67,67,217,67,67,67,67,67,67,67,67,67,67,787,67,67,67,67,67,67,67,67,67,67,271,67,0,24850,12564,0,0,0,0,28809,53531,97,97,97,97,351,97,0,40976,0,18,18,24,24,27,27,27,45,45,938,45,45,45,45,45,45,45,45,45,45,45,45,45,1398,45,45,45,153,45,161,45,45,45,45,45,45,45,45,45,45,45,45,660,661,45,45,205,45,67,67,67,67,220,67,228,67,67,67,67,67,67,67,0,0,0,0,0,280,94,0,0,67,67,67,67,67,272,67,0,24850,12564,0,0,0,0,28809,53531,97,97,97,97,352,97,0,40976,0,18,18,24,24,27,27,27,45,439,45,45,45,45,45,445,45,45,45,452,45,45,67,67,212,216,67,67,67,67,67,241,67,246,67,252,67,67,486,67,67,67,67,67,67,67,494,67,67,67,67,67,67,67,1245,67,67,67,67,67,67,67,67,1013,67,67,1016,67,67,67,67,67,521,67,67,525,67,67,67,67,67,531,67,67,67,538,67,0,0,2046,97,97,97,45,45,67,67,0,0,97,97,45,45,45,1192,45,45,45,45,45,45,45,45,45,45,45,45,1418,45,45,1421,97,97,583,97,97,97,97,97,97,97,591,97,97,97,97,97,97,913,97,97,97,97,97,97,0,0,0,45,45,45,45,45,45,45,1384,97,618,97,97,622,97,97,97,97,97,628,97,97,97,635,97,18,131427,0,0,0,639,0,132,362,0,0,365,29315,367,0,921,29315,0,0,0,0,45,45,45,45,932,45,45,45,45,45,1544,45,45,45,45,45,1550,45,45,45,45,45,1194,45,1196,45,45,45,45,45,45,45,45,999,45,45,45,45,45,67,67,45,45,667,45,45,45,45,45,45,45,45,45,45,45,45,45,1408,45,45,45,696,45,45,45,701,45,45,45,45,45,45,45,45,710,45,45,45,1220,45,45,45,45,45,45,45,45,45,45,45,45,194,45,45,45,729,45,45,45,45,45,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,797,67,67,67,67,67,67,805,67,67,67,67,67,67,67,1587,67,1589,67,67,67,67,67,67,67,67,1763,67,67,67,67,67,67,67,0,0,0,0,0,0,2162968,0,0,67,67,67,67,67,814,816,67,67,67,67,67,25398,542,13112,544,67,67,1008,67,67,67,67,67,67,67,67,67,67,67,1020,67,0,97,45,67,0,97,45,67,0,97,45,67,97,0,0,97,97,97,97,97,45,45,45,45,67,67,67,67,1429,67,1430,67,67,67,67,67,1062,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,518,1076,67,67,67,67,25398,0,13112,0,54074,0,0,0,0,0,0,0,0,28809,0,139,45,45,45,45,45,97,97,97,97,1102,97,97,97,97,97,97,97,97,97,97,97,1124,97,1126,97,97,1114,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1112,97,97,1156,97,97,97,97,97,97,97,97,97,97,97,97,97,594,97,97,97,97,1170,97,97,97,97,0,921,0,0,0,0,0,0,45,45,45,45,1532,45,45,45,45,1536,45,45,45,45,45,172,45,45,45,45,45,45,45,45,45,45,706,45,45,709,45,45,1177,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1202,45,1204,45,45,45,45,45,45,45,45,45,45,45,45,1215,45,45,45,1232,45,45,45,45,45,45,45,67,1237,67,67,67,67,67,67,1053,1054,67,67,67,67,67,67,1061,67,67,1282,67,67,67,67,67,67,67,67,67,1289,67,67,67,1292,97,97,97,97,1339,97,97,97,97,97,97,1344,97,97,97,97,45,1849,45,1851,45,45,45,45,45,45,45,45,721,45,45,45,45,45,726,45,1385,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1188,45,45,1401,1402,45,45,45,45,1405,45,45,45,45,45,45,45,45,1752,45,45,45,45,45,67,67,1410,45,45,45,1413,45,1415,45,45,45,45,45,45,1419,45,45,45,45,1806,45,45,45,45,45,45,67,67,67,67,67,67,67,97,97,2019,0,97,67,67,67,1452,67,67,67,67,67,67,67,67,1457,67,67,67,67,67,67,1259,67,67,67,67,67,67,1264,67,67,1460,67,1462,67,67,67,67,67,67,1466,67,67,67,67,67,67,67,67,1588,67,67,67,67,67,67,67,0,1300,0,0,0,1306,0,0,0,97,97,97,1506,97,97,97,97,97,97,97,97,1512,97,97,97,0,1728,97,97,97,97,97,97,97,97,97,97,97,901,97,97,97,97,1515,97,1517,97,97,97,97,97,97,1521,97,97,97,97,97,97,0,45,1652,45,45,45,1655,45,45,45,45,45,1542,45,45,45,45,45,45,45,45,45,45,45,45,45,1552,1553,45,45,45,1556,45,45,45,45,45,45,45,45,45,45,45,45,45,693,45,45,45,67,67,67,67,1572,67,67,67,67,1576,67,67,67,67,67,67,67,67,1602,67,67,1605,67,67,67,0,67,1582,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1580,67,67,1596,67,67,67,67,67,67,67,67,67,67,67,67,67,0,542,0,544,67,67,67,67,1759,67,67,67,67,67,67,67,67,67,67,67,533,67,67,67,67,67,67,67,1770,67,67,67,67,67,97,97,97,97,97,97,1777,97,97,97,1793,97,97,97,97,97,45,45,45,45,45,45,45,998,45,45,1001,1002,45,45,67,67,45,1861,45,67,67,67,67,67,67,67,67,1871,67,1873,1874,67,0,97,45,67,0,97,45,67,16384,97,45,67,97,0,0,0,1473,0,1082,0,0,0,1475,0,1086,0,0,0,1477,1876,67,97,97,97,97,97,1883,0,1885,97,97,97,1889,0,0,0,286,0,0,0,286,0,2367488,2158592,2158592,2158592,2158592,2158592,2158592,0,40976,0,18,18,24,24,126,126,126,2053,0,2055,45,67,0,97,45,67,0,97,45,67,97,0,0,97,97,97,2039,97,45,45,45,45,67,67,67,67,67,226,67,67,67,67,67,67,67,67,1246,67,67,1249,1250,67,67,67,132,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,141,45,45,45,1403,45,45,45,45,45,45,45,45,45,45,45,45,1186,45,45,1189,45,45,155,45,45,45,45,45,45,45,45,45,191,45,45,45,45,700,45,45,45,45,45,45,45,45,45,45,45,1753,45,45,45,67,67,45,45,67,208,67,67,67,222,67,67,67,67,67,67,67,67,67,1764,67,67,67,67,67,67,67,258,67,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,288,97,97,97,302,97,97,97,97,97,97,97,97,97,627,97,97,97,97,97,97,338,97,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,131427,0,0,0,0,362,0,365,28809,367,139,45,370,45,45,45,45,716,45,45,45,45,45,722,45,45,45,45,45,45,1912,67,67,67,67,67,67,67,67,67,819,67,67,25398,542,13112,544,45,403,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1409,45,67,67,67,67,489,67,67,67,67,67,67,67,67,67,67,67,771,67,67,67,67,520,67,67,67,67,67,67,67,67,67,67,67,534,67,67,67,67,67,67,1271,67,67,67,1274,67,67,67,1279,67,67,24850,24850,12564,12564,0,57889,0,0,0,53531,53531,367,286,97,553,97,97,97,97,586,97,97,97,97,97,97,97,97,97,97,97,1138,97,97,97,97,617,97,97,97,97,97,97,97,97,97,97,97,631,97,97,97,0,1834,97,97,97,97,97,0,0,0,97,97,97,97,97,353,0,40976,0,18,18,24,24,27,27,27,45,45,668,45,45,45,45,45,45,45,45,45,45,45,45,45,724,45,45,45,45,45,682,45,45,45,45,45,45,45,45,45,45,45,45,45,949,45,45,45,67,67,747,748,67,67,67,67,755,67,67,67,67,67,67,67,0,0,0,1302,0,0,0,1308,0,67,794,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1701,67,97,97,97,845,846,97,97,97,97,853,97,97,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,97,97,892,97,97,97,97,97,97,97,97,97,97,97,97,97,610,97,97,45,992,45,45,45,45,45,45,45,45,45,45,45,45,67,67,67,1239,67,67,67,1063,67,67,67,67,67,1068,67,67,67,67,67,67,67,0,0,1301,0,0,0,1307,0,0,97,1141,97,97,97,97,97,97,97,97,97,97,97,1152,97,97,0,0,97,97,2001,0,97,2003,97,97,97,45,45,45,1739,45,45,45,1742,45,45,45,45,45,97,97,97,97,1157,97,97,97,97,97,1162,97,97,97,97,97,97,1145,97,97,97,97,97,1151,97,97,97,1253,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,539,45,1423,45,45,67,67,67,67,67,67,67,1431,67,67,67,67,67,67,67,1695,67,67,67,67,67,1700,67,1702,67,67,1439,67,67,67,67,67,67,67,67,67,67,67,67,67,514,67,67,97,97,1492,97,97,97,97,97,97,97,97,97,97,97,97,97,611,97,97,1703,67,67,67,67,67,67,97,97,97,97,97,97,97,97,97,852,97,97,97,97,97,97,45,1949,45,1951,45,45,45,67,67,67,67,67,67,67,1961,67,0,97,45,67,0,97,2060,2061,0,2062,45,67,97,0,0,2036,97,97,97,97,45,45,45,45,67,67,67,67,67,223,67,67,237,67,67,67,67,67,67,67,1272,67,67,67,67,67,67,67,67,507,67,67,67,67,67,67,67,1963,67,67,67,97,97,97,97,0,1972,0,97,97,97,1975,0,921,29315,0,0,0,0,45,45,45,931,45,45,45,45,45,407,45,45,45,45,45,45,45,45,45,417,45,45,1989,67,67,67,67,67,67,67,67,67,67,67,1996,97,18,131427,0,0,360,0,0,0,362,0,0,365,29315,367,0,921,29315,0,0,0,0,45,45,930,45,45,45,45,45,45,444,45,45,45,45,45,45,45,67,67,97,97,1998,0,97,97,97,0,97,97,97,97,97,45,45,45,45,45,45,1985,45,1986,45,45,45,156,45,45,170,45,45,45,45,45,45,45,45,45,45,675,45,45,45,45,679,131427,0,358,0,0,362,0,365,28809,367,139,45,45,45,45,45,381,45,45,45,45,45,45,45,45,45,400,45,45,419,45,45,45,45,45,45,45,45,45,45,45,45,436,67,67,67,67,67,505,67,67,67,67,67,67,67,67,67,67,820,67,25398,542,13112,544,67,67,522,67,67,67,67,67,529,67,67,67,67,67,67,67,0,1299,0,0,0,1305,0,0,0,97,97,619,97,97,97,97,97,626,97,97,97,97,97,97,97,1105,97,97,97,97,1109,97,97,97,67,67,67,67,749,67,67,67,67,67,67,67,67,67,760,67,0,97,45,67,2058,97,45,67,0,97,45,67,97,0,0,97,97,97,97,97,45,45,45,2041,67,67,67,67,67,780,67,67,67,67,67,67,67,67,67,67,67,67,67,516,67,67,97,97,97,878,97,97,97,97,97,97,97,97,97,97,97,97,97,1629,97,0,45,979,45,45,45,45,984,45,45,45,45,45,45,45,45,45,1198,45,45,45,45,45,45,67,1023,67,67,67,67,1028,67,67,67,67,67,67,67,67,67,470,67,67,67,67,67,67,67,67,67,67,67,25398,0,13112,0,54074,0,0,0,1094,0,0,0,1092,1315,0,0,0,0,97,97,97,97,97,97,97,97,97,1486,97,1489,97,97,97,1117,97,97,97,97,1122,97,97,97,97,97,97,97,1146,97,97,97,97,97,97,97,97,881,97,97,97,886,97,97,97,1311,0,0,0,0,0,0,0,0,97,97,97,97,97,97,97,1615,97,97,97,97,97,1619,97,97,97,97,97,97,97,97,97,97,97,97,1631,97,97,1847,97,45,45,45,45,1852,45,45,45,45,45,45,45,1235,45,45,45,67,67,67,67,67,1868,67,67,67,1872,67,67,67,67,67,97,97,97,97,1882,0,0,0,97,97,97,97,0,1891,67,67,67,67,67,97,97,97,97,97,1929,0,0,97,97,97,97,97,97,45,1900,45,1901,45,45,45,1905,45,67,2054,97,45,67,0,97,45,67,0,97,45,67,97,0,0,97,2037,2038,97,97,45,45,45,45,67,67,67,67,1867,67,67,67,67,67,67,67,67,67,1774,97,97,97,97,97,97,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,142,45,45,45,1412,45,45,45,45,45,45,45,45,45,45,45,45,432,45,45,45,45,45,157,45,45,171,45,45,45,182,45,45,45,45,200,45,45,45,1543,45,45,45,45,45,45,45,45,1551,45,45,45,45,1181,45,45,45,45,45,45,45,45,45,45,45,1211,45,45,45,1214,45,45,45,67,209,67,67,67,224,67,67,238,67,67,67,249,67,0,97,2056,2057,0,2059,45,67,0,97,45,67,97,0,0,1937,97,97,97,97,97,97,45,45,45,45,45,45,1741,45,45,45,45,45,45,67,67,67,267,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,289,97,97,97,304,97,97,318,97,97,97,329,97,97,0,0,97,1783,97,97,97,97,0,0,97,97,0,97,97,97,45,2026,45,45,45,45,67,2030,67,67,67,67,67,67,1041,67,67,67,67,67,67,67,67,67,1044,67,67,67,67,67,67,97,97,347,97,97,97,0,40976,0,18,18,24,24,27,27,27,45,666,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1420,45,57889,0,0,54074,54074,550,0,97,97,97,97,97,97,97,97,840,67,1007,67,67,67,67,67,67,67,67,67,67,67,67,67,67,759,67,67,67,67,67,67,67,1052,67,67,67,67,67,67,67,67,67,67,1031,67,67,67,67,67,97,97,97,1101,97,97,97,97,97,97,97,97,97,97,97,97,592,97,97,97,1190,45,45,45,45,45,1195,45,1197,45,45,45,45,1201,45,45,45,45,1952,45,45,67,67,67,67,67,67,67,67,67,67,67,67,250,67,67,67,1255,67,1257,67,67,67,67,1261,67,67,67,67,67,67,67,67,1685,67,67,67,67,67,67,67,0,24851,12565,0,0,0,0,28809,53532,67,67,1267,67,67,67,67,67,67,1273,67,67,67,67,67,67,67,67,1696,67,67,67,67,67,67,67,0,0,0,0,0,0,2162688,0,0,1281,67,67,67,67,1285,67,67,67,67,67,67,67,67,67,67,1070,67,67,67,67,67,1335,97,1337,97,97,97,97,1341,97,97,97,97,97,97,97,97,882,97,97,97,97,97,97,97,1347,97,97,97,97,97,97,1353,97,97,97,97,97,97,1361,97,18,131427,0,638,0,0,0,0,362,0,0,365,29315,367,0,544,0,550,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2473984,2158592,2158592,2158592,2990080,2158592,2158592,2207744,2207744,2482176,2207744,2207744,2207744,2207744,2207744,2207744,2207744,0,0,0,0,0,0,2162688,0,53530,97,97,97,1365,97,97,97,97,97,97,97,97,97,97,97,97,608,97,97,97,45,45,1424,45,1425,67,67,67,67,67,67,67,67,67,67,67,1058,67,67,67,67,45,1555,45,45,1557,45,45,45,45,45,45,45,45,45,45,45,707,45,45,45,45,67,67,1570,67,67,67,67,67,67,67,67,67,67,67,67,67,773,67,67,1595,67,67,1597,67,67,67,67,67,67,67,67,67,67,67,0,0,0,0,0,0,0,0,0,0,139,2158592,2158592,2158592,2404352,2412544,97,97,97,1636,97,97,97,1639,97,97,1641,97,97,97,97,97,97,1173,0,921,0,0,0,0,0,0,45,67,67,67,1693,67,67,67,67,67,67,67,1698,67,67,67,67,67,67,67,1773,67,97,97,97,97,97,97,97,625,97,97,97,97,97,97,97,97,850,97,97,97,97,97,97,97,97,880,97,97,97,97,97,97,97,97,1106,97,97,97,97,97,97,97,1860,45,45,67,67,1865,67,67,67,67,1870,67,67,67,67,1875,67,67,97,97,1880,97,97,0,0,0,97,97,1888,97,0,0,0,1938,97,97,97,97,97,45,45,45,45,45,45,1854,45,45,45,45,45,45,45,1909,45,45,1911,67,67,67,67,67,67,67,67,67,67,1248,67,67,67,67,67,67,1922,67,67,1924,97,97,97,97,97,0,0,0,97,97,97,97,97,1898,45,45,45,45,45,45,1904,45,45,67,67,67,67,97,97,97,97,0,0,16384,97,97,97,97,0,97,97,97,97,97,97,97,97,97,0,1724,2008,2009,45,45,67,67,67,2014,2015,67,67,97,97,0,0,97,97,97,0,97,97,97,97,97,45,45,45,45,45,45,45,45,45,45,45,45,45,2022,0,2023,97,97,45,45,45,45,45,45,67,67,67,67,67,67,1869,67,67,67,67,67,67,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,147,151,154,45,162,45,45,176,178,181,45,45,45,192,196,45,45,45,45,2012,67,67,67,67,67,67,2018,97,0,0,97,1978,97,97,97,1982,45,45,45,45,45,45,45,45,45,972,973,45,45,45,45,45,67,259,263,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,97,294,298,301,97,309,97,97,323,325,328,97,97,97,97,97,560,97,97,97,569,97,97,97,97,97,97,306,97,97,97,97,97,97,97,97,97,1624,97,97,97,97,97,97,97,0,921,0,1175,0,0,0,0,45,339,343,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,67,67,503,67,67,67,67,67,67,67,67,67,512,67,67,519,97,97,600,97,97,97,97,97,97,97,97,97,609,97,97,616,45,649,45,45,45,45,45,654,45,45,45,45,45,45,45,45,1393,45,45,45,45,45,45,45,45,1209,45,45,45,45,45,45,45,67,763,67,67,67,67,67,67,67,67,770,67,67,67,774,67,0,2045,97,97,97,97,45,45,67,67,0,0,97,97,45,45,45,994,45,45,45,45,45,45,45,45,45,45,67,67,213,67,219,67,67,232,67,242,67,247,67,67,67,779,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1018,67,67,67,67,811,67,67,67,67,67,67,67,67,67,25398,542,13112,544,57889,0,0,54074,54074,550,0,97,834,97,97,97,97,97,839,97,18,131427,0,638,0,0,0,0,362,0,0,365,29315,367,645,97,97,861,97,97,97,97,97,97,97,97,868,97,97,97,872,97,97,877,97,97,97,97,97,97,97,97,97,97,97,97,97,613,97,97,97,97,97,909,97,97,97,97,97,97,97,97,97,0,0,0,18,18,24,24,27,27,27,1036,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1047,67,67,67,1050,67,67,67,67,67,67,67,67,67,67,67,67,1033,67,67,67,97,97,1130,97,97,97,97,97,97,97,97,97,97,97,97,97,638,0,0,67,67,67,1295,67,67,67,0,0,0,0,0,0,0,0,0,97,1317,97,97,97,97,97,97,1375,97,97,97,0,0,0,45,1379,45,45,45,45,45,45,422,45,45,45,429,431,45,45,45,45,0,1090,0,0,97,1479,97,97,97,97,97,97,97,97,97,97,1357,97,97,97,97,97,97,97,97,97,1716,97,97,97,97,97,97,97,97,97,1723,0,921,29315,0,0,0,0,45,929,45,45,45,45,45,45,45,1392,45,45,45,45,45,45,45,45,45,960,45,45,45,45,45,45,97,97,97,1738,45,45,45,45,45,45,45,1743,45,45,45,45,166,45,45,45,45,184,186,45,45,197,45,45,97,1779,0,0,97,97,97,97,97,97,0,0,97,97,0,97,18,131427,0,638,0,0,0,0,362,0,640,365,29315,367,0,921,29315,0,0,0,0,45,45,45,45,45,45,45,45,45,45,1537,45,45,45,45,45,1803,45,45,45,45,45,1809,45,45,45,67,67,67,1814,67,67,67,67,67,67,1821,67,67,67,67,67,67,97,97,97,97,97,0,0,0,97,97,97,97,0,0,67,67,67,1818,67,67,67,67,67,1824,67,67,67,97,97,97,97,97,0,0,0,97,97,97,97,1890,0,1829,97,97,0,0,97,97,1836,97,97,0,0,0,97,97,97,97,1981,45,45,45,45,45,45,45,45,45,1987,1845,97,97,97,45,45,45,45,45,1853,45,45,45,1857,45,45,45,67,1864,67,1866,67,67,67,67,67,67,67,67,67,97,97,97,97,97,97,97,1710,1711,67,67,97,97,97,97,97,0,0,0,1886,97,97,97,0,0,97,97,97,97,1838,0,0,0,97,1843,97,0,1893,97,97,97,97,97,45,45,45,45,45,45,45,45,45,45,1745,45,45,67,67,67,67,67,97,97,97,97,97,0,0,1931,97,97,97,97,97,588,97,97,97,97,97,97,97,97,97,97,629,97,97,97,97,97,67,2044,0,97,97,97,97,45,45,67,67,0,0,97,97,45,45,45,1660,45,45,45,45,45,45,45,45,45,45,45,45,453,45,455,67,67,67,67,268,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,348,97,97,97,0,40976,0,18,18,24,24,27,27,27,131427,0,359,0,0,362,0,365,28809,367,139,45,45,45,45,45,421,45,45,45,45,45,45,45,434,45,45,695,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1667,45,0,921,29315,0,925,0,0,45,45,45,45,45,45,45,45,45,1811,45,67,67,67,67,67,67,1037,67,1039,67,67,67,67,67,67,67,67,67,67,67,67,1277,67,67,67,67,67,67,67,67,25398,0,13112,0,54074,0,0,0,1095,0,0,0,1096,97,97,97,97,97,97,97,97,97,97,97,97,869,97,97,97,97,97,97,1131,97,1133,97,97,97,97,97,97,97,97,97,97,1370,97,97,97,97,97,1312,0,0,0,0,1096,0,0,0,97,97,97,97,97,97,97,1327,97,97,97,97,97,1332,97,97,97,1830,97,0,0,97,97,97,97,97,0,0,0,97,97,97,1896,97,97,45,45,45,45,45,45,45,45,45,1548,45,45,45,45,45,45,133,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,45,380,45,45,45,45,45,45,45,45,45,45,401,45,45,158,45,45,45,45,45,45,45,45,45,45,45,45,45,1200,45,45,45,45,206,67,67,67,67,67,225,67,67,67,67,67,67,67,67,754,67,67,67,67,67,67,67,57889,0,0,54074,54074,550,832,97,97,97,97,97,97,97,97,97,1342,97,97,97,97,97,97,67,67,67,67,67,25398,1083,13112,1087,54074,1091,0,0,0,0,0,0,1316,0,831,97,97,97,97,97,97,97,1174,921,0,1175,0,0,0,0,45,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,45,148,67,67,264,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,97,295,97,97,97,97,313,97,97,97,97,331,333,97,18,131427,356,638,0,0,0,0,362,0,0,365,0,367,0,45,45,1530,45,45,45,45,45,45,45,45,45,45,45,45,988,45,45,45,97,344,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,402,404,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1756,67,438,45,45,45,45,45,45,45,45,449,450,45,45,45,67,67,214,218,221,67,229,67,67,243,245,248,67,67,67,67,67,488,490,67,67,67,67,67,67,67,67,67,67,67,1071,67,1073,67,67,67,67,67,524,67,67,67,67,67,67,67,67,535,536,67,67,67,67,67,67,1683,1684,67,67,67,67,1688,1689,67,67,67,67,67,67,1586,67,67,67,67,67,67,67,67,67,469,67,67,67,67,67,67,97,97,97,585,587,97,97,97,97,97,97,97,97,97,97,97,1163,97,97,97,97,97,97,97,621,97,97,97,97,97,97,97,97,632,633,97,97,0,0,1782,97,97,97,97,97,0,0,97,97,0,97,712,45,45,45,717,45,45,45,45,45,45,45,45,725,45,45,45,163,167,173,177,45,45,45,45,45,193,45,45,45,45,982,45,45,45,45,45,45,987,45,45,45,45,45,1558,45,1560,45,45,45,45,45,45,45,45,704,705,45,45,45,45,45,45,45,45,731,45,45,45,67,67,67,67,67,739,67,67,67,67,67,67,273,0,24850,12564,0,0,0,0,28809,53531,67,67,67,764,67,67,67,67,67,67,67,67,67,67,67,67,1290,67,67,67,67,67,67,812,67,67,67,67,818,67,67,67,25398,542,13112,544,57889,0,0,54074,54074,550,0,97,97,97,97,97,837,97,97,97,97,97,602,97,97,97,97,97,97,97,97,97,97,1137,97,97,97,97,97,97,97,97,97,862,97,97,97,97,97,97,97,97,97,97,97,1627,97,97,97,0,97,97,97,97,910,97,97,97,97,916,97,97,97,0,0,0,97,97,1940,97,97,1942,45,45,45,45,45,45,385,45,45,45,45,395,45,45,45,45,966,45,969,45,45,45,45,45,45,45,45,45,45,975,45,45,45,406,45,45,45,45,45,45,45,45,45,45,45,45,974,45,45,45,67,67,67,67,1010,67,67,67,67,67,67,67,67,67,67,67,1262,67,67,67,67,67,67,67,67,67,1040,67,1042,67,1045,67,67,67,67,67,67,67,97,1706,97,97,97,1709,97,97,97,67,67,67,67,1051,67,67,67,67,67,1057,67,67,67,67,67,67,67,1443,67,67,1446,67,67,67,67,67,67,67,1297,0,0,0,1303,0,0,0,1309,67,67,67,67,1079,25398,0,13112,0,54074,0,0,0,0,0,0,0,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2207744,2207744,2207744,2207744,2207744,2572288,2207744,2207744,2207744,1098,97,97,97,97,97,1104,97,97,97,97,97,97,97,97,97,1356,97,97,97,97,97,97,1128,97,97,97,97,97,97,1134,97,1136,97,1139,97,97,97,97,97,97,1622,97,97,97,97,97,97,97,97,0,921,0,0,0,1176,0,646,45,67,67,67,1268,67,67,67,67,67,67,67,67,67,67,67,67,1469,67,67,67,97,1348,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1127,97,67,1569,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1448,1449,67,1816,67,67,67,67,67,67,67,67,67,1825,67,67,1827,97,97,0,1781,97,97,97,97,97,97,0,0,97,97,0,97,97,97,1831,0,0,97,97,97,97,97,0,0,0,97,97,97,1980,97,45,45,45,45,45,45,45,45,45,45,1395,45,45,45,45,45,97,1846,97,97,45,45,45,45,45,45,45,45,45,45,45,45,1212,45,45,45,45,45,45,2010,45,67,67,67,67,67,2016,67,97,97,0,0,97,97,97,0,97,97,97,97,97,45,45,2007,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,143,45,45,45,1671,45,45,45,45,45,45,45,45,45,45,45,67,1813,67,67,1815,45,45,67,210,67,67,67,67,67,67,239,67,67,67,67,67,67,67,1454,67,67,67,67,67,67,67,67,67,1445,67,67,67,67,67,67,97,97,290,97,97,97,97,97,97,319,97,97,97,97,97,97,303,97,97,317,97,97,97,97,97,97,305,97,97,97,97,97,97,97,97,97,899,97,97,97,97,97,97,375,45,45,45,379,45,45,390,45,45,394,45,45,45,45,45,443,45,45,45,45,45,45,45,45,67,67,67,67,67,461,67,67,67,465,67,67,476,67,67,480,67,67,67,67,67,67,1694,67,67,67,67,67,67,67,67,67,1288,67,67,67,67,67,67,500,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1075,97,97,97,558,97,97,97,562,97,97,573,97,97,577,97,97,97,97,97,895,97,97,97,97,97,97,903,97,97,97,0,97,97,1638,97,97,97,97,97,97,97,97,1646,597,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1334,45,681,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1396,45,45,1399,45,45,730,45,45,45,45,67,67,67,67,67,67,67,67,67,67,1434,67,67,67,67,67,67,750,67,67,67,67,67,67,67,67,67,67,1456,67,67,67,67,67,45,45,993,45,45,45,45,45,45,45,45,45,45,45,67,67,1238,67,67,1006,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1280,1048,1049,67,67,67,67,67,67,67,67,67,67,1059,67,67,67,67,67,67,1286,67,67,67,67,67,67,67,1291,67,97,97,1100,97,97,97,97,97,97,97,97,97,97,97,97,97,638,0,920,97,97,1142,1143,97,97,97,97,97,97,97,97,97,97,1153,97,97,97,97,97,1158,97,97,97,1161,97,97,97,97,1166,97,97,97,97,97,1325,97,97,97,97,97,97,97,97,97,97,1328,97,97,97,97,97,97,97,45,1218,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1678,45,45,45,67,67,67,67,67,1269,67,67,67,67,67,67,67,67,1278,67,67,67,67,67,67,1761,67,67,67,67,67,67,67,67,67,530,67,67,67,67,67,67,97,97,1349,97,97,97,97,97,97,97,97,1358,97,97,97,97,97,97,1623,97,97,97,97,97,97,97,97,0,921,0,0,926,0,0,0,45,45,1411,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1754,45,45,67,67,1301,0,1307,0,1313,97,97,97,97,97,97,97,97,97,97,97,21054,97,97,97,97,67,1757,67,67,67,1760,67,67,67,67,67,67,67,67,67,67,1467,67,67,67,67,67,1778,97,0,0,97,97,97,97,97,97,0,0,97,97,0,97,97,97,97,97,1352,97,97,97,97,97,97,97,97,97,97,1511,97,97,97,97,97,67,67,67,67,67,1820,67,1822,67,67,67,67,67,97,97,97,97,97,0,0,0,97,1933,97,1892,97,97,97,97,97,97,1899,45,45,45,45,45,45,45,45,1664,45,45,45,45,45,45,45,45,1546,45,45,45,45,45,45,45,45,1208,45,45,45,45,45,45,45,45,1224,45,45,45,45,45,45,45,45,673,45,45,45,45,45,45,45,67,67,67,67,67,1925,97,97,97,97,0,0,0,97,97,97,97,97,623,97,97,97,97,97,97,97,97,97,97,307,97,97,97,97,97,97,97,97,97,1796,97,45,45,45,45,45,45,45,970,45,45,45,45,45,45,45,45,1417,45,45,45,45,45,45,45,67,1964,67,67,97,97,97,97,0,0,0,97,97,97,97,0,97,97,97,97,97,97,1721,97,97,0,0,1997,97,0,0,2e3,97,97,0,97,97,97,97,97,45,45,45,45,733,45,67,67,67,67,67,67,67,67,67,67,803,67,67,67,67,67,0,94242,0,0,0,38,102439,0,0,106538,98347,28809,45,45,144,45,45,45,1805,45,1807,45,45,45,45,45,67,67,67,67,67,67,231,67,67,67,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,45,45,67,211,67,67,67,67,230,234,240,244,67,67,67,67,67,67,464,67,67,67,67,67,67,479,67,67,67,260,67,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,97,291,97,97,97,97,310,314,320,324,97,97,97,97,97,97,1367,97,97,97,97,97,97,97,97,97,1355,97,97,97,97,97,97,1362,340,97,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,131427,0,0,360,0,362,0,365,28809,367,139,369,45,45,45,374,67,67,460,67,67,67,67,466,67,67,67,67,67,67,67,67,801,67,67,67,67,67,67,67,67,67,487,67,67,67,67,67,67,67,67,67,67,498,67,67,67,67,67,67,1772,67,67,97,97,97,97,97,97,97,0,921,922,1175,0,0,0,0,45,67,502,67,67,67,67,67,67,67,508,67,67,67,515,517,67,67,67,67,67,97,97,97,97,97,0,0,0,1932,97,97,0,1999,97,97,97,0,97,97,2004,2005,97,45,45,45,45,1193,45,45,45,45,45,45,45,45,45,45,45,676,45,45,45,45,67,24850,24850,12564,12564,0,57889,0,0,0,53531,53531,367,286,552,97,97,97,97,97,1377,0,0,45,45,45,45,45,45,45,45,655,45,45,45,45,45,45,45,97,97,557,97,97,97,97,563,97,97,97,97,97,97,97,97,1135,97,97,97,97,97,97,97,97,97,584,97,97,97,97,97,97,97,97,97,97,595,97,97,97,97,97,911,97,97,97,97,97,97,97,638,0,0,0,0,1315,0,0,0,0,97,97,97,1319,97,97,97,0,97,97,97,97,97,97,1733,97,97,97,97,97,97,1340,97,97,97,1343,97,97,1345,97,1346,97,599,97,97,97,97,97,97,97,605,97,97,97,612,614,97,97,97,97,97,1794,97,97,97,45,45,45,45,45,45,45,1207,45,45,45,45,45,45,1213,45,45,745,67,67,67,67,751,67,67,67,67,67,67,67,67,67,67,1577,67,67,67,67,67,762,67,67,67,67,766,67,67,67,67,67,67,67,67,67,67,1765,67,67,67,67,67,777,67,67,781,67,67,67,67,67,67,67,67,67,67,67,67,1592,1593,67,67,97,843,97,97,97,97,849,97,97,97,97,97,97,97,97,97,1510,97,97,97,97,97,97,97,860,97,97,97,97,864,97,97,97,97,97,97,97,97,97,1797,45,45,45,45,1801,45,97,875,97,97,879,97,97,97,97,97,97,97,97,97,97,97,1522,97,97,97,97,97,991,45,45,45,45,996,45,45,45,45,45,45,45,45,67,67,215,67,67,67,67,233,67,67,67,67,251,253,1022,67,67,67,1026,67,67,67,67,67,67,67,67,67,67,1035,67,67,1038,67,67,67,67,67,67,67,67,67,67,67,67,67,1458,67,67,67,67,67,1064,67,67,67,1067,67,67,67,67,1072,67,67,67,67,67,67,1296,0,0,0,0,0,0,0,0,0,2367488,2158592,2158592,2158592,2158592,2158592,2158592,67,67,67,67,67,25398,0,13112,0,54074,0,0,0,0,1096,0,921,29315,0,0,0,0,928,45,45,45,45,45,934,45,45,45,164,45,45,45,45,45,45,45,45,45,198,45,45,45,378,45,45,45,45,45,45,393,45,45,45,398,45,97,97,1116,97,97,97,1120,97,97,97,97,97,97,97,97,97,1147,1148,97,97,97,97,97,97,97,1129,97,97,1132,97,97,97,97,97,97,97,97,97,97,97,1626,97,97,97,97,0,45,1178,45,45,45,45,45,45,45,45,45,1185,45,45,45,45,441,45,45,45,45,45,45,451,45,45,67,67,67,67,67,227,67,67,67,67,67,67,67,67,1260,67,67,67,1263,67,67,1265,1203,45,45,1205,45,1206,45,45,45,45,45,45,45,45,45,1216,67,1266,67,67,67,67,67,67,67,67,67,1276,67,67,67,67,67,67,492,67,67,67,67,67,67,67,67,67,471,67,67,67,67,481,67,45,1386,45,1389,45,45,45,45,1394,45,45,45,1397,45,45,45,45,995,45,997,45,45,45,45,45,45,45,67,67,67,67,1915,67,67,67,67,67,1422,45,45,45,67,67,67,67,67,67,67,67,67,1433,67,1436,67,67,67,67,1441,67,67,67,1444,67,67,67,67,67,67,67,0,24850,12564,0,0,0,281,28809,53531,97,97,97,97,1494,97,97,97,1497,97,97,97,97,97,97,97,1368,97,97,97,97,97,97,97,97,851,97,97,97,97,97,97,97,67,67,67,1571,67,67,67,67,67,67,67,67,67,67,67,67,25398,542,13112,544,67,67,1583,67,67,67,67,67,67,67,67,1591,67,67,67,67,67,67,752,67,67,67,67,67,67,67,67,67,1056,67,67,67,67,67,67,97,1634,97,0,97,97,97,97,97,97,97,97,97,97,97,97,1125,97,97,97,1647,97,97,97,97,97,0,45,45,45,45,45,45,45,45,45,1183,45,45,45,45,45,45,45,45,45,409,45,45,45,45,45,45,1658,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1668,1712,97,97,97,0,97,97,97,97,97,97,97,97,97,0,0,1835,97,97,97,97,0,0,0,97,97,1844,97,97,1726,0,97,97,97,97,97,1732,97,1734,97,97,97,97,97,300,97,308,97,97,97,97,97,97,97,97,866,97,97,97,97,97,97,97,67,67,67,1758,67,67,67,1762,67,67,67,67,67,67,67,67,1043,67,67,67,67,67,67,67,67,67,67,67,67,1771,67,67,67,97,97,97,97,97,1776,97,97,97,97,297,97,97,97,97,97,97,97,97,97,97,97,1108,97,97,97,97,67,67,67,1966,97,97,97,1970,0,0,0,97,97,97,97,0,97,97,97,1720,97,97,97,97,97,0,0,97,97,97,1837,97,0,1840,1841,97,97,97,1988,45,67,67,67,67,67,67,67,67,67,1994,1995,67,97,97,97,97,97,1103,97,97,97,97,97,97,97,97,97,97,917,97,97,0,0,0,67,67,265,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,345,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,131427,0,0,0,361,362,0,365,28809,367,139,45,45,45,45,45,671,45,45,45,45,45,45,45,45,45,45,411,45,45,414,45,45,45,45,377,45,45,45,386,45,45,45,45,45,45,45,45,45,1223,45,45,45,45,45,45,45,45,45,426,45,45,433,45,45,45,67,67,67,67,67,463,67,67,67,472,67,67,67,67,67,67,67,527,67,67,67,67,67,67,537,67,540,24850,24850,12564,12564,0,57889,0,0,0,53531,53531,367,286,97,97,97,97,97,1119,97,97,97,97,97,97,97,97,97,97,1509,97,97,97,97,97,97,97,97,564,97,97,97,97,97,97,97,637,18,131427,0,0,0,0,0,0,362,0,0,365,29315,367,0,921,29315,0,0,0,927,45,45,45,45,45,45,45,45,45,1234,45,45,45,45,67,67,67,67,1240,45,697,45,45,45,45,45,45,45,45,45,45,708,45,45,45,45,1221,45,45,45,45,1225,45,45,45,45,45,45,384,45,45,45,45,45,45,45,45,45,1210,45,45,45,45,45,45,67,67,795,67,67,67,67,67,67,67,67,67,67,67,67,67,1470,67,67,67,67,67,67,67,815,67,67,67,67,67,67,25398,542,13112,544,97,97,97,893,97,97,97,97,97,97,97,97,97,97,97,97,1164,97,97,97,67,67,67,1025,67,67,67,67,67,67,67,67,67,67,67,67,1687,67,67,67,67,67,67,67,67,67,25398,0,13112,0,54074,0,0,0,0,0,1097,1241,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1450,45,45,1388,45,1390,45,45,45,45,45,45,45,45,45,45,45,1236,67,67,67,67,67,1437,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1472,1490,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1503,67,67,67,67,67,97,97,97,97,97,0,1930,0,97,97,97,97,97,847,97,97,97,97,97,97,97,97,97,858,67,67,1965,67,97,97,97,97,0,0,0,97,97,97,97,0,97,97,1719,97,97,97,97,97,97,0,0,0,45,45,45,45,1382,45,1383,45,45,45,159,45,45,45,45,45,45,45,45,45,45,45,45,45,1563,45,45,45,45,45,67,261,67,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,341,97,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,97,1099,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1333,97,1230,45,45,45,45,45,45,45,45,45,45,67,67,67,67,67,67,1992,67,1993,67,67,67,97,97,45,45,160,45,45,45,45,45,45,45,45,45,45,45,45,45,1665,45,45,45,45,45,131427,357,0,0,0,362,0,365,28809,367,139,45,45,45,45,45,684,45,45,45,45,45,45,45,45,45,45,412,45,45,45,416,45,45,45,440,45,45,45,45,45,45,45,45,45,45,45,67,67,1990,67,1991,67,67,67,67,67,67,67,97,97,1707,97,97,97,97,97,97,501,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,1691,67,67,67,67,67,526,67,67,67,67,67,67,67,67,67,67,1030,67,1032,67,67,67,67,598,97,97,97,97,97,97,97,97,97,97,97,97,97,97,97,1632,0,921,29315,923,0,0,0,45,45,45,45,45,45,45,45,45,1404,45,45,45,45,45,45,45,45,45,425,45,45,45,45,45,45,67,67,67,67,67,25398,0,13112,0,54074,0,0,1093,0,0,0,0,0,97,1609,97,97,97,97,97,97,97,97,97,1369,97,97,97,1372,97,97,67,67,266,67,67,67,67,0,24850,12564,0,0,0,0,28809,53531,97,346,97,97,97,97,0,40976,0,18,18,24,24,27,27,27,665,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,1677,45,45,45,45,67,45,45,954,45,956,45,45,45,45,45,45,45,45,45,45,45,1545,45,45,45,45,45,45,45,45,45,448,45,45,45,45,67,456,67,67,67,67,67,1270,67,67,67,67,67,67,67,67,67,67,1069,67,67,67,67,67,67,97,97,97,1350,97,97,97,97,97,97,97,97,97,97,97,97,1524,97,97,97,97,97,97,97,1376,0,0,0,45,45,45,45,45,45,45,45,1559,1561,45,45,45,1564,45,1566,1567,45,67,67,67,67,67,1573,67,67,67,67,67,67,67,67,67,67,1247,67,67,67,67,67,1252,97,1725,97,0,97,97,97,97,97,97,97,97,97,97,97,97,1628,97,1630,0,0,94242,0,0,0,2211840,0,1118208,0,0,0,0,2158592,2158731,2158592,2158592,2158592,3117056,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,3018752,2158592,3043328,2158592,2158592,2158592,2158592,3080192,2158592,2158592,3112960,2158592,2158592,2158592,2158592,2158592,2158878,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2605056,2158592,2158592,2207744,0,542,0,544,0,0,2166784,0,0,0,550,0,0,2158592,2158592,2686976,2158592,2715648,2158592,2158592,2158592,2158592,2158592,2158592,2158592,2867200,2158592,2904064,2158592,2158592,2158592,2158592,2158592,2158592,2158592,0,94242,0,0,0,2211840,0,0,1130496,0,0,0,2158592,2158592,2158592,2158592,2158592,3186688,2158592,0,0,139,0,0,0,139,0,2367488,2207744,0,0,0,0,176128,0,2166784,0,0,0,0,0,286,2158592,2158592,3170304,3174400,2158592,0,0,0,2158592,2158592,2158592,2158592,2158592,2424832,2158592,2158592,2158592,1508,2158592,2908160,2158592,2158592,2158592,2977792,2158592,2158592,2158592,2158592,3039232,2158592,2158592,2158592,2158592,2158592,2158592,3158016,67,24850,24850,12564,12564,0,0,0,0,0,53531,53531,0,286,97,97,97,97,97,1144,97,97,97,97,97,97,97,97,97,97,1149,97,97,97,97,1154,57889,0,0,0,0,550,0,97,97,97,97,97,97,97,97,97,561,97,97,97,97,97,97,576,97,97,139264,139264,139264,139264,139264,139264,139264,139264,139264,139264,139264,139264,0,0,139264,0,921,29315,0,0,926,0,45,45,45,45,45,45,45,45,45,719,720,45,45,45,45,45,45,45,45,685,45,45,45,45,45,45,45,45,45,942,45,45,946,45,45,45,950,45,45,0,2146304,2146304,0,0,0,0,2224128,2224128,2224128,2232320,2232320,2232320,2232320,0,0,1301,0,0,0,0,0,1307,0,0,0,0,0,1313,0,0,0,0,0,0,0,97,97,1318,97,97,97,97,97,97,1795,97,97,45,45,45,45,45,45,45,446,45,45,45,45,45,45,67,67,2158592,2146304,0,0,0,0,0,0,0,2211840,0,0,0,0,2158592,0,921,29315,0,924,0,0,45,45,45,45,45,45,45,45,45,1e3,45,45,45,45,67,67],r.EXPECTED=[290,300,304,353,296,309,305,319,315,324,328,352,354,334,338,330,320,345,349,293,358,362,341,366,312,370,374,378,382,386,390,394,398,737,402,634,439,604,634,634,634,634,408,634,634,634,404,634,634,634,457,634,634,963,634,634,413,634,634,634,634,634,634,634,663,418,422,903,902,426,431,548,634,437,521,919,443,615,409,449,455,624,731,751,634,461,465,672,470,469,474,481,485,477,489,493,629,542,497,505,603,602,991,648,510,804,634,515,958,526,525,530,768,634,546,552,711,710,593,558,562,618,566,570,574,578,582,586,590,608,612,660,822,821,634,622,596,444,628,533,724,633,640,653,647,652,536,1008,451,450,445,657,670,676,685,689,693,697,701,704,707,715,719,798,815,634,723,762,996,634,728,969,730,735,908,634,741,679,889,511,747,634,750,755,499,666,499,501,759,772,776,780,634,787,784,797,802,809,808,427,814,1006,517,634,519,853,634,813,850,793,634,819,826,833,832,837,843,847,857,861,863,867,871,875,879,883,643,887,539,980,979,634,893,944,634,900,896,634,907,933,506,912,917,828,433,636,635,554,961,923,930,927,937,941,634,634,634,974,948,952,985,913,968,967,743,634,973,839,634,978,599,634,984,989,765,444,995,1e3,634,1003,790,955,1012,681,634,634,634,634,634,414,1016,1020,1024,1085,1027,1090,1090,1046,1080,1137,1108,1215,1049,1032,1039,1085,1085,1085,1085,1058,1062,1068,1085,1086,1090,1090,1091,1072,1064,1107,1090,1090,1090,1118,1123,1138,1078,1074,1084,1085,1085,1085,1087,1090,1062,1052,1060,1114,1062,1104,1085,1085,1090,1090,1028,1122,1063,1128,1139,1127,1158,1085,1085,1151,1090,1090,1090,1095,1090,1132,1073,1136,1143,1061,1150,1085,1155,1098,1101,1146,1162,1169,1101,1185,1151,1090,1110,1173,1054,1087,1109,1177,1165,1089,1204,1184,1107,1189,1193,1088,1197,1180,1201,1208,1042,1212,1219,1223,1227,1231,1235,1245,1777,1527,1686,1686,1238,1686,1254,1686,1686,1686,1294,1669,1686,1686,1686,1322,1625,1534,1268,1624,1275,1281,1443,1292,1300,1686,1686,1686,1350,1826,1306,1686,1686,1240,2032,1317,1321,1686,1686,1253,1686,1326,1686,1686,1686,1418,1709,1446,1686,1686,1686,1492,1686,1295,1447,1686,1686,1258,1686,1736,1686,1686,1520,1355,1686,1288,1348,1361,1686,1359,1686,1364,1498,1368,1302,1362,1381,1389,1395,1486,1686,1371,1377,1370,1686,1375,1382,1384,1402,1408,1385,1383,1619,1413,1423,1428,1433,1686,1686,1270,1686,1338,1686,1440,1686,1686,1686,1499,1465,1686,1686,1686,1639,1473,1884,1686,1686,1293,1864,1686,1686,1296,1321,1483,1686,1686,1686,1646,1686,1748,1496,1686,1418,1675,1686,1418,1702,1686,1418,1981,1686,1429,1409,1427,1504,1692,1686,1686,1313,1448,1651,1508,1686,1686,1340,1686,1903,1686,1686,1435,1513,1686,1283,1287,1519,1686,1524,1363,1568,1938,1539,1566,1579,1479,1533,1538,1553,1544,1552,1557,1563,1574,1557,1583,1589,1590,1759,1594,1603,1607,1611,1686,1436,1514,1686,1434,1656,1686,1434,1680,1686,1453,1686,1686,1686,1559,1617,1686,1770,1418,1623,1769,1629,1686,1515,1335,1686,1285,1686,1671,1921,1650,1686,1686,1344,1308,1666,1686,1686,1686,1659,1685,1686,1686,1686,1686,1241,1686,1686,1844,1691,1686,1630,1977,1970,1362,1686,1686,1686,1693,1698,1686,1686,1686,1697,1686,1764,1715,1686,1634,1638,1686,1599,1585,1686,1271,1686,1269,1686,1721,1686,1686,1354,1686,1801,1686,1799,1686,1640,1686,1686,1461,1686,1686,1732,1686,1944,1686,1740,1686,1746,1415,1396,1686,1598,1547,1417,1597,1416,1577,1546,1397,1577,1547,1548,1570,1398,1753,1686,1652,1509,1686,1686,1686,1757,1686,1419,1686,1763,1418,1768,1781,1686,1686,1686,1705,1686,2048,1792,1686,1686,1686,1735,1686,1797,1686,1686,1404,1686,1639,1815,1686,1686,1418,2017,1820,1686,1686,1803,1686,1686,1686,1736,1489,1686,1686,1825,1338,1260,1263,1686,1686,1785,1686,1686,1728,1686,1686,1749,1497,1830,1830,1262,1248,1261,1329,1260,1264,1329,1248,1249,1259,1540,1849,1842,1686,1686,1835,1686,1686,1816,1686,1686,1831,1882,1848,1686,1686,1686,1774,2071,1854,1686,1686,1469,1884,1686,1821,1859,1686,1686,1350,1883,1686,1686,1686,1781,1391,1875,1686,1686,1613,1644,1686,1686,1889,1686,1686,1662,1884,1686,1885,1890,1686,1686,1686,1894,1686,1686,1678,1686,1907,1686,1686,1529,1914,1686,1838,1686,1686,1881,1686,1686,1872,1876,1836,1919,1686,1837,1692,1910,1686,1925,1928,1742,1686,1811,1811,1930,1810,1929,1935,1928,1900,1942,1867,1868,1931,1035,1788,1948,1952,1956,1960,1964,1686,1976,1686,1686,1686,2065,1686,1992,2037,1686,1686,1998,2009,1972,2002,1686,1686,1686,2077,1300,2023,1686,1686,1686,1807,2031,1686,1686,1686,1860,1500,2032,1686,1686,1686,2083,1686,2036,1686,1277,1276,2042,1877,1686,1686,2041,1686,1686,2027,2037,2012,1686,2012,1855,1850,1686,2046,1686,1686,2054,1996,1686,1897,1309,2059,2052,1686,2058,1686,1686,2081,1686,1717,1477,1686,1331,1686,1686,1687,1686,1860,1681,1686,1686,1686,1966,1724,1686,1686,1686,1984,2015,1686,1686,1686,1988,1686,2063,1686,1686,1686,2005,1686,1727,1686,1686,1711,1457,2069,1686,1686,1686,2019,2075,1686,1686,1915,1686,1686,1793,1874,1686,1686,1491,1362,1449,1686,1686,1460,2098,2087,2091,2095,2184,2102,2113,2780,2117,2134,2142,2281,2146,2146,2146,2304,2296,2181,2639,2591,2872,2592,2873,2313,2195,2200,2281,2146,2273,2226,2204,2152,2219,2276,2167,2177,2276,2235,2276,2276,2230,2281,2276,2296,2276,2293,2276,2276,2276,2276,2234,2276,2311,2314,2210,2199,2217,2222,2276,2276,2276,2240,2276,2294,2276,2276,2173,2276,2198,2281,2281,2281,2281,2282,2146,2146,2146,2146,2205,2146,2204,2248,2276,2235,2276,2297,2276,2276,2276,2277,2256,2281,2283,2146,2146,2146,2275,2276,2295,2276,2276,2293,2146,2304,2264,2269,2221,2276,2276,2276,2293,2295,2276,2276,2276,2295,2263,2205,2268,2220,2172,2276,2276,2276,2296,2276,2276,2296,2294,2276,2276,2278,2281,2281,2280,2281,2281,2281,2283,2206,2223,2276,2276,2279,2281,2281,2146,2273,2276,2276,2281,2281,2281,2276,2292,2276,2298,2225,2276,2298,2169,2224,2292,2298,2171,2229,2281,2281,2171,2236,2281,2281,2281,2146,2275,2225,2292,2299,2276,2229,2281,2146,2276,2290,2297,2283,2146,2146,2274,2224,2227,2298,2225,2297,2276,2230,2170,2230,2282,2146,2147,2151,2156,2288,2276,2230,2303,2308,2236,2284,2228,2318,2318,2318,2326,2335,2339,2343,2349,2416,2693,2357,2592,2109,2592,2592,2162,2943,2823,2646,2592,2361,2592,2122,2592,2592,2122,2470,2592,2592,2592,2109,2107,2592,2592,2592,2123,2592,2592,2592,2125,2592,2413,2592,2592,2592,2127,2592,2592,2414,2592,2592,2592,2130,2952,2592,2594,2592,2592,2212,2609,2252,2592,2592,2592,2446,2434,2592,2592,2592,2212,2446,2450,2456,2431,2435,2592,2592,2243,2478,2448,2439,2946,2592,2592,2592,2368,2809,2813,2450,2441,2212,2812,2449,2440,2947,2592,2592,2592,2345,2451,2457,2948,2592,2124,2592,2592,2650,2823,2449,2455,2946,2592,2128,2592,2592,2649,2952,2592,2810,2448,2461,2991,2467,2592,2592,2329,2817,2474,2990,2466,2592,2592,2373,2447,2992,2469,2592,2592,2592,2373,2447,2477,2468,2592,2592,2353,2469,2592,2495,2592,2592,2415,2483,2592,2415,2496,2592,2592,2352,2592,2592,2352,2352,2469,2592,2592,2363,2331,2494,2592,2592,2592,2375,2592,2375,2415,2504,2592,2592,2367,2372,2503,2592,2592,2592,2389,2418,2415,2592,2592,2373,2592,2592,2592,2593,2732,2417,2415,2592,2417,2520,2592,2592,2592,2390,2521,2521,2592,2592,2592,2401,2599,2585,2526,2531,2120,2592,2212,2426,2450,2463,2948,2592,2592,2592,2213,2389,2527,2532,2121,2542,2551,2105,2592,2213,2592,2592,2592,2558,2538,2544,2553,2557,2537,2543,2552,2421,2572,2576,2546,2543,2547,2592,2592,2373,2615,2575,2545,2105,2592,2244,2479,2592,2129,2592,2592,2628,2690,2469,2562,2566,2592,2592,2592,2415,2928,2934,2401,2570,2574,2564,2572,2585,2590,2592,2592,2585,2965,2592,2592,2592,2445,2251,2592,2592,2592,2474,2592,2609,2892,2592,2362,2592,2592,2138,2851,2159,2592,2592,2592,2509,2888,2892,2592,2592,2592,2490,2418,2891,2592,2592,2376,2592,2592,2374,2592,2889,2388,2592,2373,2373,2890,2592,2592,2387,2592,2887,2505,2892,2592,2373,2610,2388,2592,2592,2376,2373,2592,2887,2891,2592,2374,2592,2592,2608,2159,2614,2620,2592,2592,2394,2594,2887,2399,2592,2887,2397,2508,2374,2507,2592,2375,2592,2592,2592,2595,2508,2506,2592,2506,2505,2505,2592,2507,2637,2505,2592,2592,2401,2661,2592,2643,2592,2592,2417,2592,2655,2592,2592,2592,2510,2414,2656,2592,2592,2592,2516,2592,2593,2660,2665,2880,2592,2592,2592,2522,2767,2666,2881,2592,2592,2420,2571,2696,2592,2592,2592,2580,2572,2686,2632,2698,2592,2383,2514,2592,2163,2932,2465,2685,2631,2697,2592,2388,2592,2592,2212,2604,2671,2632,2678,2592,2401,2405,2409,2592,2592,2592,2679,2592,2592,2592,2592,2108,2677,2591,2592,2592,2592,2419,2592,2683,2187,2191,2469,2671,2189,2467,2592,2401,2629,2633,2702,2468,2592,2592,2421,2536,2703,2469,2592,2592,2422,2573,2593,2672,2467,2592,2402,2406,2592,2402,2979,2592,2592,2626,2673,2467,2592,2446,2259,2947,2592,2377,2709,2592,2592,2522,2862,2713,2468,2592,2592,2581,2572,2562,2374,2374,2592,2376,2721,2724,2592,2592,2624,2373,2731,2592,2592,2592,2626,2732,2592,2592,2592,2755,2656,2726,2736,2741,2592,2486,2593,2381,2592,2727,2737,2742,2715,2747,2753,2592,2498,2469,2873,2743,2592,2592,2592,2791,2759,2763,2592,2592,2627,2704,2592,2592,2522,2789,2593,2761,2753,2592,2498,2863,2592,2592,2767,2592,2592,2592,2792,2789,2592,2592,2592,2803,2126,2592,2592,2592,2811,2122,2592,2592,2592,2834,2777,2592,2592,2592,2848,2936,2591,2489,2797,2592,2592,2670,2631,2490,2798,2592,2592,2592,2963,2807,2592,2592,2592,2965,2838,2592,2592,2592,2975,2330,2818,2829,2592,2498,2939,2592,2498,2592,2791,2331,2819,2830,2592,2592,2592,2982,2834,2817,2828,2106,2592,2592,2592,2405,2405,2817,2828,2592,2592,2415,2849,2842,2592,2522,2773,2592,2522,2868,2592,2580,2600,2586,2137,2850,2843,2592,2592,2855,2937,2844,2592,2592,2592,2987,2936,2591,2592,2592,2684,2630,2592,2856,2938,2592,2592,2860,2939,2592,2592,2872,2592,2861,2591,2592,2592,2887,2616,2592,2867,2592,2592,2708,2592,2498,2469,2498,2497,2785,2773,2499,2783,2770,2877,2877,2877,2772,2592,2592,2345,2885,2592,2592,2592,2715,2762,2515,2896,2592,2592,2715,2917,2516,2897,2592,2592,2592,2901,2906,2911,2592,2592,2956,2960,2715,2902,2907,2912,2593,2916,2920,2820,2922,2822,2592,2592,2715,2927,2921,2821,2106,2592,2592,2974,2408,2321,2821,2106,2592,2592,2983,2592,2593,2404,2408,2592,2592,2717,2749,2716,2928,2322,2822,2593,2926,2919,2820,2934,2823,2592,2592,2592,2651,2824,2592,2592,2592,2130,2952,2592,2592,2592,2592,2964,2592,2592,2716,2748,2592,2969,2592,2592,2716,2918,2368,2970,2592,2592,2592,2403,2407,2592,2592,2787,2211,2404,2409,2592,2592,2802,2837,2987,2592,2592,2592,2809,2427,2592,2793,2592,2592,2809,2447,1073741824,2147483648,539754496,542375936,402653184,554434560,571736064,545521856,268451840,335544320,268693630,512,2048,256,1024,0,1024,0,1073741824,2147483648,0,0,0,8388608,0,0,1073741824,1073741824,0,2147483648,537133056,4194304,1048576,268435456,-1073741824,0,0,0,1048576,0,0,0,1572864,0,0,0,4194304,0,134217728,16777216,0,0,32,64,98304,0,33554432,8388608,192,67108864,67108864,67108864,67108864,16,32,4,0,8192,196608,196608,229376,80,4096,524288,8388608,0,0,32,128,256,24576,24600,24576,24576,2,24576,24576,24576,24584,24592,24576,24578,24576,24578,24576,24576,16,512,2048,2048,256,4096,32768,1048576,4194304,67108864,134217728,268435456,262144,134217728,0,128,128,64,16384,16384,16384,67108864,32,32,4,4,4096,262144,134217728,0,0,0,2,0,8192,131072,131072,4096,4096,4096,4096,24576,24576,24576,8,8,24576,24576,16384,16384,16384,24576,24584,24576,24576,24576,16384,24576,536870912,262144,0,0,32,2048,8192,4,4096,4096,4096,786432,8388608,16777216,0,128,16384,16384,16384,32768,65536,2097152,32,32,32,32,4,4,4,4,4,4096,67108864,67108864,67108864,24576,24576,24576,24576,0,16384,16384,16384,16384,67108864,67108864,8,67108864,24576,8,8,8,24576,24576,24576,24578,24576,24576,24576,2,2,2,16384,67108864,67108864,67108864,32,67108864,8,8,24576,2048,2147483648,536870912,262144,262144,262144,67108864,8,24576,16384,32768,1048576,4194304,25165824,67108864,24576,32770,2,4,112,512,98304,524288,50,402653186,1049090,1049091,10,66,100925514,10,66,12582914,0,0,-1678194207,-1678194207,-1041543218,0,32768,0,0,32,65536,268435456,1,1,513,1048577,0,12582912,0,0,0,4,1792,0,0,0,7,29360128,0,0,0,8,0,0,0,12,1,1,0,0,-604102721,-604102721,4194304,8388608,0,0,0,31,925600,997981306,997981306,997981306,0,0,2048,8388608,0,0,1,2,4,32,64,512,8192,0,0,0,245760,997720064,0,0,0,32,0,0,0,3,12,16,32,8,112,3072,12288,16384,32768,65536,131072,7864320,16777216,973078528,0,0,65536,131072,3670016,4194304,16777216,33554432,2,8,48,2048,8192,16384,32768,65536,131072,524288,131072,524288,3145728,4194304,16777216,33554432,65536,131072,2097152,4194304,16777216,33554432,134217728,268435456,536870912,0,0,0,1024,0,8,48,2048,8192,65536,33554432,268435456,536870912,65536,268435456,536870912,0,0,32768,0,0,126,623104,65011712,0,32,65536,536870912,0,0,65536,524288,0,32,65536,0,0,0,2048,0,0,0,15482,245760,-604102721,0,0,0,18913,33062912,925600,-605028352,0,0,0,65536,31,8096,131072,786432,3145728,3145728,12582912,50331648,134217728,268435456,160,256,512,7168,131072,786432,131072,786432,1048576,2097152,12582912,16777216,268435456,1073741824,2147483648,12582912,16777216,33554432,268435456,1073741824,2147483648,3,12,16,160,256,7168,786432,1048576,12582912,16777216,268435456,1073741824,0,8,16,32,128,256,512,7168,786432,1048576,2097152,0,1,2,8,16,7168,786432,1048576,8388608,16777216,16777216,1073741824,0,0,0,0,1,0,0,8,32,128,256,7168,8,32,0,3072,0,8,32,3072,4096,524288,8,32,0,0,3072,4096,0,2048,524288,8388608,8,2048,0,0,1,12,256,4096,32768,262144,1048576,4194304,67108864,0,2048,0,2048,2048,1073741824,-58805985,-58805985,-58805985,0,0,262144,0,0,32,4194304,16777216,134217728,4382,172032,-58982400,0,0,2,28,256,4096,8192,8192,32768,131072,262144,524288,1,2,12,256,4096,0,0,4194304,67108864,134217728,805306368,1073741824,0,0,1,2,12,16,256,4096,1048576,67108864,134217728,268435456,0,512,1048576,4194304,201326592,1879048192,0,0,12,256,4096,134217728,268435456,536870912,12,256,268435456,536870912,0,12,256,0,0,1,32,64,512,0,0,205236961,205236961,0,0,0,1,96,640,1,10976,229376,204996608,0,640,2048,8192,229376,1572864,1572864,2097152,201326592,0,0,0,64,512,2048,229376,1572864,201326592,1572864,201326592,0,0,1,4382,0,1,32,2048,65536,131072,1572864,201326592,131072,1572864,134217728,0,0,524288,524288,0,0,0,-68582786,-68582786,-68582786,0,0,2097152,524288,0,524288,0,0,65536,131072,1572864,0,0,2,4,0,0,65011712,-134217728,0,0,0,0,2,4,120,512,-268435456,0,0,0,2,8,48,64,2048,8192,98304,524288,2097152,4194304,25165824,33554432,134217728,268435456,2147483648,0,0,25165824,33554432,134217728,1879048192,2147483648,0,0,4,112,512,622592,65011712,134217728,-268435456,16777216,33554432,134217728,1610612736,0,0,0,64,98304,524288,4194304,16777216,33554432,0,98304,524288,16777216,33554432,0,65536,524288,33554432,536870912,1073741824,0,65536,524288,536870912,1073741824,0,0,65536,524288,536870912,0,524288,0,524288,524288,1048576,2086666240,2147483648,0,-1678194207,0,0,0,8,32,2048,524288,8388608,0,0,33062912,436207616,2147483648,0,0,32,64,2432,16384,32768,32768,524288,3145728,4194304,25165824,25165824,167772160,268435456,2147483648,0,32,64,384,2048,16384,32768,1048576,2097152,4194304,25165824,32,64,128,256,2048,16384,2048,16384,1048576,4194304,16777216,33554432,134217728,536870912,1073741824,0,0,2048,16384,4194304,16777216,33554432,134217728,805306368,0,0,16777216,134217728,268435456,2147483648,0,622592,622592,622592,8807,8807,434791,0,0,16777216,0,0,0,7,608,8192,0,0,0,3,4,96,512,32,64,8192,0,0,16777216,134217728,0,0,2,4,8192,16384,65536,2097152,33554432,268435456],r.TOKEN=[\"(0)\",\"ModuleDecl\",\"Annotation\",\"OptionDecl\",\"Operator\",\"Variable\",\"Tag\",\"EndTag\",\"PragmaContents\",\"DirCommentContents\",\"DirPIContents\",\"CDataSectionContents\",\"AttrTest\",\"Wildcard\",\"EQName\",\"IntegerLiteral\",\"DecimalLiteral\",\"DoubleLiteral\",\"PredefinedEntityRef\",\"'\\\"\\\"'\",\"EscapeApos\",\"QuotChar\",\"AposChar\",\"ElementContentChar\",\"QuotAttrContentChar\",\"AposAttrContentChar\",\"NCName\",\"QName\",\"S\",\"CharRef\",\"CommentContents\",\"DocTag\",\"DocCommentContents\",\"EOF\",\"'!'\",\"'\\\"'\",\"'#'\",\"'#)'\",\"''''\",\"'('\",\"'(#'\",\"'(:'\",\"'(:~'\",\"')'\",\"'*'\",\"'*'\",\"','\",\"'-->'\",\"'.'\",\"'/'\",\"'/>'\",\"':'\",\"':)'\",\"';'\",\"'<!--'\",\"'<![CDATA['\",\"'<?'\",\"'='\",\"'>'\",\"'?'\",\"'?>'\",\"'NaN'\",\"'['\",\"']'\",\"']]>'\",\"'after'\",\"'all'\",\"'allowing'\",\"'ancestor'\",\"'ancestor-or-self'\",\"'and'\",\"'any'\",\"'append'\",\"'array'\",\"'as'\",\"'ascending'\",\"'at'\",\"'attribute'\",\"'base-uri'\",\"'before'\",\"'boundary-space'\",\"'break'\",\"'by'\",\"'case'\",\"'cast'\",\"'castable'\",\"'catch'\",\"'check'\",\"'child'\",\"'collation'\",\"'collection'\",\"'comment'\",\"'constraint'\",\"'construction'\",\"'contains'\",\"'content'\",\"'context'\",\"'continue'\",\"'copy'\",\"'copy-namespaces'\",\"'count'\",\"'decimal-format'\",\"'decimal-separator'\",\"'declare'\",\"'default'\",\"'delete'\",\"'descendant'\",\"'descendant-or-self'\",\"'descending'\",\"'diacritics'\",\"'different'\",\"'digit'\",\"'distance'\",\"'div'\",\"'document'\",\"'document-node'\",\"'element'\",\"'else'\",\"'empty'\",\"'empty-sequence'\",\"'encoding'\",\"'end'\",\"'entire'\",\"'eq'\",\"'every'\",\"'exactly'\",\"'except'\",\"'exit'\",\"'external'\",\"'first'\",\"'following'\",\"'following-sibling'\",\"'for'\",\"'foreach'\",\"'foreign'\",\"'from'\",\"'ft-option'\",\"'ftand'\",\"'ftnot'\",\"'ftor'\",\"'function'\",\"'ge'\",\"'greatest'\",\"'group'\",\"'grouping-separator'\",\"'gt'\",\"'idiv'\",\"'if'\",\"'import'\",\"'in'\",\"'index'\",\"'infinity'\",\"'inherit'\",\"'insensitive'\",\"'insert'\",\"'instance'\",\"'integrity'\",\"'intersect'\",\"'into'\",\"'is'\",\"'item'\",\"'json'\",\"'json-item'\",\"'key'\",\"'language'\",\"'last'\",\"'lax'\",\"'le'\",\"'least'\",\"'let'\",\"'levels'\",\"'loop'\",\"'lowercase'\",\"'lt'\",\"'minus-sign'\",\"'mod'\",\"'modify'\",\"'module'\",\"'most'\",\"'namespace'\",\"'namespace-node'\",\"'ne'\",\"'next'\",\"'no'\",\"'no-inherit'\",\"'no-preserve'\",\"'node'\",\"'nodes'\",\"'not'\",\"'object'\",\"'occurs'\",\"'of'\",\"'on'\",\"'only'\",\"'option'\",\"'or'\",\"'order'\",\"'ordered'\",\"'ordering'\",\"'paragraph'\",\"'paragraphs'\",\"'parent'\",\"'pattern-separator'\",\"'per-mille'\",\"'percent'\",\"'phrase'\",\"'position'\",\"'preceding'\",\"'preceding-sibling'\",\"'preserve'\",\"'previous'\",\"'processing-instruction'\",\"'relationship'\",\"'rename'\",\"'replace'\",\"'return'\",\"'returning'\",\"'revalidation'\",\"'same'\",\"'satisfies'\",\"'schema'\",\"'schema-attribute'\",\"'schema-element'\",\"'score'\",\"'self'\",\"'sensitive'\",\"'sentence'\",\"'sentences'\",\"'skip'\",\"'sliding'\",\"'some'\",\"'stable'\",\"'start'\",\"'stemming'\",\"'stop'\",\"'strict'\",\"'strip'\",\"'structured-item'\",\"'switch'\",\"'text'\",\"'then'\",\"'thesaurus'\",\"'times'\",\"'to'\",\"'treat'\",\"'try'\",\"'tumbling'\",\"'type'\",\"'typeswitch'\",\"'union'\",\"'unique'\",\"'unordered'\",\"'updating'\",\"'uppercase'\",\"'using'\",\"'validate'\",\"'value'\",\"'variable'\",\"'version'\",\"'weight'\",\"'when'\",\"'where'\",\"'while'\",\"'wildcards'\",\"'window'\",\"'with'\",\"'without'\",\"'word'\",\"'words'\",\"'xquery'\",\"'zero-digit'\",\"'{'\",\"'{{'\",\"'|'\",\"'}'\",\"'}}'\"]},{}],2:[function(e,t,n){var r=e(\"./XQueryTokenizer\").XQueryTokenizer,i=function(e){var t=e;this.tokens=[],this.reset=function(){t=t,this.tokens=[]},this.startNonterminal=function(){},this.endNonterminal=function(){},this.terminal=function(e,n,r){this.tokens.push({name:e,value:t.substring(n,r)})},this.whitespace=function(e,n){this.tokens.push({name:\"WS\",value:t.substring(e,n)})}},s=\"after|ancestor|ancestor-or-self|and|as|ascending|attribute|before|case|cast|castable|child|collation|comment|copy|count|declare|default|delete|descendant|descendant-or-self|descending|div|document|document-node|element|else|empty|empty-sequence|end|eq|every|except|first|following|following-sibling|for|function|ge|group|gt|idiv|if|import|insert|instance|intersect|into|is|item|last|le|let|lt|mod|modify|module|namespace|namespace-node|ne|node|only|or|order|ordered|parent|preceding|preceding-sibling|processing-instruction|rename|replace|return|satisfies|schema-attribute|schema-element|self|some|stable|start|switch|text|to|treat|try|typeswitch|union|unordered|validate|where|with|xquery|contains|paragraphs|sentences|times|words|by|collectionreturn|variable|version|option|when|encoding|toswitch|catch|tumbling|sliding|window|at|using|stemming|collection|schema|while|on|nodes|index|external|then|in|updating|value|of|containsbreak|loop|continue|exit|returning|append|json|position|strict\".split(\"|\"),o=s.map(function(e){return{name:\"'\"+e+\"'\",token:\"keyword\"}}),u=s.map(function(e){return{name:\"'\"+e+\"'\",token:\"text\",next:function(e){e.pop()}}}),a=\"constant.language\",f=\"constant\",l=\"comment\",c=\"xml-pe\",h=\"constant.buildin\",p=function(e){return\"'\"+e+\"'\"},d={start:[{name:p(\"(#\"),token:h,next:function(e){e.push(\"Pragma\")}},{name:p(\"(:\"),token:\"comment\",next:function(e){e.push(\"Comment\")}},{name:p(\"(:~\"),token:\"comment.doc\",next:function(e){e.push(\"CommentDoc\")}},{name:p(\"<!--\"),token:l,next:function(e){e.push(\"XMLComment\")}},{name:p(\"<?\"),token:c,next:function(e){e.push(\"PI\")}},{name:p(\"''\"),token:\"string\",next:function(e){e.push(\"AposString\")}},{name:p('\"'),token:\"string\",next:function(e){e.push(\"QuotString\")}},{name:\"Annotation\",token:\"support.function\"},{name:\"ModuleDecl\",token:\"keyword\",next:function(e){e.push(\"Prefix\")}},{name:\"OptionDecl\",token:\"keyword\",next:function(e){e.push(\"_EQName\")}},{name:\"AttrTest\",token:\"support.type\"},{name:\"Variable\",token:\"variable\"},{name:p(\"<![CDATA[\"),token:a,next:function(e){e.push(\"CData\")}},{name:\"IntegerLiteral\",token:f},{name:\"DecimalLiteral\",token:f},{name:\"DoubleLiteral\",token:f},{name:\"Operator\",token:\"keyword.operator\"},{name:\"EQName\",token:function(e){return s.indexOf(e)!==-1?\"keyword\":\"support.function\"}},{name:p(\"(\"),token:\"lparen\"},{name:p(\")\"),token:\"rparen\"},{name:\"Tag\",token:\"meta.tag\",next:function(e){e.push(\"StartTag\")}},{name:p(\"}\"),token:\"text\",next:function(e){e.length>1&&e.pop()}},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}].concat(o),_EQName:[{name:\"EQName\",token:\"text\",next:function(e){e.pop()}}].concat(u),Prefix:[{name:\"NCName\",token:\"text\",next:function(e){e.pop()}}].concat(u),StartTag:[{name:p(\">\"),token:\"meta.tag\",next:function(e){e.push(\"TagContent\")}},{name:\"QName\",token:\"entity.other.attribute-name\"},{name:p(\"=\"),token:\"text\"},{name:p(\"''\"),token:\"string\",next:function(e){e.push(\"AposAttr\")}},{name:p('\"'),token:\"string\",next:function(e){e.push(\"QuotAttr\")}},{name:p(\"/>\"),token:\"meta.tag.r\",next:function(e){e.pop()}}],TagContent:[{name:\"ElementContentChar\",token:\"text\"},{name:p(\"<![CDATA[\"),token:a,next:function(e){e.push(\"CData\")}},{name:p(\"<!--\"),token:l,next:function(e){e.push(\"XMLComment\")}},{name:\"Tag\",token:\"meta.tag\",next:function(e){e.push(\"StartTag\")}},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"text\"},{name:p(\"}}\"),token:\"text\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}},{name:\"EndTag\",token:\"meta.tag\",next:function(e){e.pop(),e.pop()}}],AposAttr:[{name:p(\"''\"),token:\"string\",next:function(e){e.pop()}},{name:\"EscapeApos\",token:\"constant.language.escape\"},{name:\"AposAttrContentChar\",token:\"string\"},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"string\"},{name:p(\"}}\"),token:\"string\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}],QuotAttr:[{name:p('\"'),token:\"string\",next:function(e){e.pop()}},{name:\"EscapeQuot\",token:\"constant.language.escape\"},{name:\"QuotAttrContentChar\",token:\"string\"},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:p(\"{{\"),token:\"string\"},{name:p(\"}}\"),token:\"string\"},{name:p(\"{\"),token:\"text\",next:function(e){e.push(\"start\")}}],Pragma:[{name:\"PragmaContents\",token:h},{name:p(\"#\"),token:h},{name:p(\"#)\"),token:h,next:function(e){e.pop()}}],Comment:[{name:\"CommentContents\",token:\"comment\"},{name:p(\"(:\"),token:\"comment\",next:function(e){e.push(\"Comment\")}},{name:p(\":)\"),token:\"comment\",next:function(e){e.pop()}}],CommentDoc:[{name:\"DocCommentContents\",token:\"comment.doc\"},{name:\"DocTag\",token:\"comment.doc.tag\"},{name:p(\"(:\"),token:\"comment.doc\",next:function(e){e.push(\"CommentDoc\")}},{name:p(\":)\"),token:\"comment.doc\",next:function(e){e.pop()}}],XMLComment:[{name:\"DirCommentContents\",token:l},{name:p(\"-->\"),token:l,next:function(e){e.pop()}}],CData:[{name:\"CDataSectionContents\",token:a},{name:p(\"]]>\"),token:a,next:function(e){e.pop()}}],PI:[{name:\"DirPIContents\",token:c},{name:p(\"?\"),token:c},{name:p(\"?>\"),token:c,next:function(e){e.pop()}}],AposString:[{name:p(\"''\"),token:\"string\",next:function(e){e.pop()}},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:\"EscapeApos\",token:\"constant.language.escape\"},{name:\"AposChar\",token:\"string\"}],QuotString:[{name:p('\"'),token:\"string\",next:function(e){e.pop()}},{name:\"PredefinedEntityRef\",token:\"constant.language.escape\"},{name:\"CharRef\",token:\"constant.language.escape\"},{name:\"EscapeQuot\",token:\"constant.language.escape\"},{name:\"QuotChar\",token:\"string\"}]};n.XQueryLexer=function(){function e(e){e=e.slice(0).sort();var t,n,r;t=e[0],r=t.length,n=e.pop();while(r&&n.indexOf(t)===-1)t=t.substring(0,--r);return t}this.tokens=[],this.getLineTokens=function(t,n,s){n=n===\"start\"||!n?'[\"start\"]':n;var o=JSON.parse(n),u=new i(t),a=new r(t,u),f=[];for(;;){var l=o[o.length-1];try{u.tokens=[],a[\"parse_\"+l]();var c=null;u.tokens.length>1&&u.tokens[0].name===\"WS\"&&(f.push({type:\"text\",value:u.tokens[0].value}),u.tokens.splice(0,1));var h=u.tokens[0],p=d[l];for(var v=0;v<p.length;v++){var m=d[l][v];if(typeof m.name==\"function\"&&m.name(h)||m.name===h.name){c=m;break}}if(h.name===\"EOF\")break;if(h.value===\"\")throw\"Encountered empty string lexical rule.\";f.push({type:c===null?\"text\":typeof c.token==\"function\"?c.token(h.value):c.token,value:h.value}),c&&c.next&&c.next(o)}catch(g){if(g instanceof a.ParseException){var y=0;for(var b=0;b<f.length;b++)y+=f[b].value.length;return f.push({type:\"text\",value:t.substring(y)}),{tokens:f,state:JSON.stringify([\"start\"])}}throw g}}if(this.tokens[s]!==undefined){var w=this.lines[s],E=e([t,w]),S=w.length-t.length,x=0,T=0;for(var b=0;b<f.length;b++){var N=f[b];for(var C=0;C<this.tokens[s].length;C++){var k=this.tokens[s][C];if(T+N.value.length<=E.length&&k.sc===T&&k.ec===T+N.value.length||k.sc===T+S&&k.ec===T+N.value.length+S)x=b,N.type=k.type}T+=N.value.length}}return{tokens:f,state:JSON.stringify(o)}}}},{\"./XQueryTokenizer\":1}]},{},[2])(2)}),define(\"ace/snippets\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/lib/lang\",\"ace/range\",\"ace/anchor\",\"ace/keyboard/hash_handler\",\"ace/tokenizer\",\"ace/lib/dom\",\"ace/editor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./lib/lang\"),o=e(\"./range\").Range,u=e(\"./anchor\").Anchor,a=e(\"./keyboard/hash_handler\").HashHandler,f=e(\"./tokenizer\").Tokenizer,l=o.comparePoints,c=function(){this.snippetMap={},this.snippetNameMap={}};(function(){r.implement(this,i),this.getTokenizer=function(){function e(e,t,n){return e=e.substr(1),/^\\d+$/.test(e)&&!n.inFormatString?[{tabstopId:parseInt(e,10)}]:[{text:e}]}function t(e){return\"(?:[^\\\\\\\\\"+e+\"]|\\\\\\\\.)\"}return c.$tokenizer=new f({start:[{regex:/:/,onMatch:function(e,t,n){return n.length&&n[0].expectIf?(n[0].expectIf=!1,n[0].elseBranch=n[0],[n[0]]):\":\"}},{regex:/\\\\./,onMatch:function(e,t,n){var r=e[1];return r==\"}\"&&n.length?e=r:\"`$\\\\\".indexOf(r)!=-1?e=r:n.inFormatString&&(r==\"n\"?e=\"\\n\":r==\"t\"?e=\"\\n\":\"ulULE\".indexOf(r)!=-1&&(e={changeCase:r,local:r>\"a\"})),[e]}},{regex:/}/,onMatch:function(e,t,n){return[n.length?n.shift():e]}},{regex:/\\$(?:\\d+|\\w+)/,onMatch:e},{regex:/\\$\\{[\\dA-Z_a-z]+/,onMatch:function(t,n,r){var i=e(t.substr(1),n,r);return r.unshift(i[0]),i},next:\"snippetVar\"},{regex:/\\n/,token:\"newline\",merge:!1}],snippetVar:[{regex:\"\\\\|\"+t(\"\\\\|\")+\"*\\\\|\",onMatch:function(e,t,n){n[0].choices=e.slice(1,-1).split(\",\")},next:\"start\"},{regex:\"/(\"+t(\"/\")+\"+)/(?:(\"+t(\"/\")+\"*)/)(\\\\w*):?\",onMatch:function(e,t,n){var r=n[0];return r.fmtString=e,e=this.splitRegex.exec(e),r.guard=e[1],r.fmt=e[2],r.flag=e[3],\"\"},next:\"start\"},{regex:\"`\"+t(\"`\")+\"*`\",onMatch:function(e,t,n){return n[0].code=e.splice(1,-1),\"\"},next:\"start\"},{regex:\"\\\\?\",onMatch:function(e,t,n){n[0]&&(n[0].expectIf=!0)},next:\"start\"},{regex:\"([^:}\\\\\\\\]|\\\\\\\\.)*:?\",token:\"\",next:\"start\"}],formatString:[{regex:\"/(\"+t(\"/\")+\"+)/\",token:\"regex\"},{regex:\"\",onMatch:function(e,t,n){n.inFormatString=!0},next:\"start\"}]}),c.prototype.getTokenizer=function(){return c.$tokenizer},c.$tokenizer},this.tokenizeTmSnippet=function(e,t){return this.getTokenizer().getLineTokens(e,t).tokens.map(function(e){return e.value||e})},this.$getDefaultValue=function(e,t){if(/^[A-Z]\\d+$/.test(t)){var n=t.substr(1);return(this.variables[t[0]+\"__\"]||{})[n]}if(/^\\d+$/.test(t))return(this.variables.__||{})[t];t=t.replace(/^TM_/,\"\");if(!e)return;var r=e.session;switch(t){case\"CURRENT_WORD\":var i=r.getWordRange();case\"SELECTION\":case\"SELECTED_TEXT\":return r.getTextRange(i);case\"CURRENT_LINE\":return r.getLine(e.getCursorPosition().row);case\"PREV_LINE\":return r.getLine(e.getCursorPosition().row-1);case\"LINE_INDEX\":return e.getCursorPosition().column;case\"LINE_NUMBER\":return e.getCursorPosition().row+1;case\"SOFT_TABS\":return r.getUseSoftTabs()?\"YES\":\"NO\";case\"TAB_SIZE\":return r.getTabSize();case\"FILENAME\":case\"FILEPATH\":return\"\";case\"FULLNAME\":return\"Ace\"}},this.variables={},this.getVariableValue=function(e,t){return this.variables.hasOwnProperty(t)?this.variables[t](e,t)||\"\":this.$getDefaultValue(e,t)||\"\"},this.tmStrFormat=function(e,t,n){var r=t.flag||\"\",i=t.guard;i=new RegExp(i,r.replace(/[^gi]/,\"\"));var s=this.tokenizeTmSnippet(t.fmt,\"formatString\"),o=this,u=e.replace(i,function(){o.variables.__=arguments;var e=o.resolveVariables(s,n),t=\"E\";for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"object\"){e[r]=\"\";if(i.changeCase&&i.local){var u=e[r+1];u&&typeof u==\"string\"&&(i.changeCase==\"u\"?e[r]=u[0].toUpperCase():e[r]=u[0].toLowerCase(),e[r+1]=u.substr(1))}else i.changeCase&&(t=i.changeCase)}else t==\"U\"?e[r]=i.toUpperCase():t==\"L\"&&(e[r]=i.toLowerCase())}return e.join(\"\")});return this.variables.__=null,u},this.resolveVariables=function(e,t){function o(t){var n=e.indexOf(t,r+1);n!=-1&&(r=n)}var n=[];for(var r=0;r<e.length;r++){var i=e[r];if(typeof i==\"string\")n.push(i);else{if(typeof i!=\"object\")continue;if(i.skip)o(i);else{if(i.processed<r)continue;if(i.text){var s=this.getVariableValue(t,i.text);s&&i.fmtString&&(s=this.tmStrFormat(s,i)),i.processed=r,i.expectIf==null?s&&(n.push(s),o(i)):s?i.skip=i.elseBranch:o(i)}else i.tabstopId!=null?n.push(i):i.changeCase!=null&&n.push(i)}}}return n},this.insertSnippetForSelection=function(e,t){function f(e){var t=[];for(var n=0;n<e.length;n++){var r=e[n];if(typeof r==\"object\"){if(a[r.tabstopId])continue;var i=e.lastIndexOf(r,n-1);r=t[i]||{tabstopId:r.tabstopId}}t[n]=r}return t}var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=e.session.getTabString(),s=r.match(/^\\s*/)[0];n.column<s.length&&(s=s.slice(0,n.column));var o=this.tokenizeTmSnippet(t);o=this.resolveVariables(o,e),o=o.map(function(e){return e==\"\\n\"?e+s:typeof e==\"string\"?e.replace(/\\t/g,i):e});var u=[];o.forEach(function(e,t){if(typeof e!=\"object\")return;var n=e.tabstopId,r=u[n];r||(r=u[n]=[],r.index=n,r.value=\"\");if(r.indexOf(e)!==-1)return;r.push(e);var i=o.indexOf(e,t+1);if(i===-1)return;var s=o.slice(t+1,i),a=s.some(function(e){return typeof e==\"object\"});a&&!r.value?r.value=s:s.length&&(!r.value||typeof r.value!=\"string\")&&(r.value=s.join(\"\"))}),u.forEach(function(e){e.length=0});var a={};for(var l=0;l<o.length;l++){var c=o[l];if(typeof c!=\"object\")continue;var p=c.tabstopId,d=o.indexOf(c,l+1);if(a[p]){a[p]===c&&(a[p]=null);continue}var v=u[p],m=typeof v.value==\"string\"?[v.value]:f(v.value);m.unshift(l+1,Math.max(0,d-l)),m.push(c),a[p]=c,o.splice.apply(o,m),v.indexOf(c)===-1&&v.push(c)}var g=0,y=0,b=\"\";o.forEach(function(e){typeof e==\"string\"?(e[0]===\"\\n\"?(y=e.length-1,g++):y+=e.length,b+=e):e.start?e.end={row:g,column:y}:e.start={row:g,column:y}});var w=e.getSelectionRange(),E=e.session.replace(w,b),S=new h(e),x=e.inVirtualSelectionMode&&e.selection.index;S.addTabstops(u,w.start,E,x)},this.insertSnippet=function(e,t){var n=this;if(e.inVirtualSelectionMode)return n.insertSnippetForSelection(e,t);e.forEachSelection(function(){n.insertSnippetForSelection(e,t)},null,{keepOrder:!0}),e.tabstopManager&&e.tabstopManager.tabNext()},this.$getScope=function(e){var t=e.session.$mode.$id||\"\";t=t.split(\"/\").pop();if(t===\"html\"||t===\"php\"){t===\"php\"&&!e.session.$mode.inlinePhp&&(t=\"html\");var n=e.getCursorPosition(),r=e.session.getState(n.row);typeof r==\"object\"&&(r=r[0]),r.substring&&(r.substring(0,3)==\"js-\"?t=\"javascript\":r.substring(0,4)==\"css-\"?t=\"css\":r.substring(0,4)==\"php-\"&&(t=\"php\"))}return t},this.getActiveScopes=function(e){var t=this.$getScope(e),n=[t],r=this.snippetMap;return r[t]&&r[t].includeScopes&&n.push.apply(n,r[t].includeScopes),n.push(\"_\"),n},this.expandWithTab=function(e,t){var n=this,r=e.forEachSelection(function(){return n.expandSnippetForSelection(e,t)},null,{keepOrder:!0});return r&&e.tabstopManager&&e.tabstopManager.tabNext(),r},this.expandSnippetForSelection=function(e,t){var n=e.getCursorPosition(),r=e.session.getLine(n.row),i=r.substring(0,n.column),s=r.substr(n.column),o=this.snippetMap,u;return this.getActiveScopes(e).some(function(e){var t=o[e];return t&&(u=this.findMatchingSnippet(t,i,s)),!!u},this),u?t&&t.dryRun?!0:(e.session.doc.removeInLine(n.row,n.column-u.replaceBefore.length,n.column+u.replaceAfter.length),this.variables.M__=u.matchBefore,this.variables.T__=u.matchAfter,this.insertSnippetForSelection(e,u.content),this.variables.M__=this.variables.T__=null,!0):!1},this.findMatchingSnippet=function(e,t,n){for(var r=e.length;r--;){var i=e[r];if(i.startRe&&!i.startRe.test(t))continue;if(i.endRe&&!i.endRe.test(n))continue;if(!i.startRe&&!i.endRe)continue;return i.matchBefore=i.startRe?i.startRe.exec(t):[\"\"],i.matchAfter=i.endRe?i.endRe.exec(n):[\"\"],i.replaceBefore=i.triggerRe?i.triggerRe.exec(t)[0]:\"\",i.replaceAfter=i.endTriggerRe?i.endTriggerRe.exec(n)[0]:\"\",i}},this.snippetMap={},this.snippetNameMap={},this.register=function(e,t){function o(e){return e&&!/^\\^?\\(.*\\)\\$?$|^\\\\b$/.test(e)&&(e=\"(?:\"+e+\")\"),e||\"\"}function u(e,t,n){return e=o(e),t=o(t),n?(e=t+e,e&&e[e.length-1]!=\"$\"&&(e+=\"$\")):(e+=t,e&&e[0]!=\"^\"&&(e=\"^\"+e)),new RegExp(e)}function a(e){e.scope||(e.scope=t||\"_\"),t=e.scope,n[t]||(n[t]=[],r[t]={});var o=r[t];if(e.name){var a=o[e.name];a&&i.unregister(a),o[e.name]=e}n[t].push(e),e.tabTrigger&&!e.trigger&&(!e.guard&&/^\\w/.test(e.tabTrigger)&&(e.guard=\"\\\\b\"),e.trigger=s.escapeRegExp(e.tabTrigger)),e.startRe=u(e.trigger,e.guard,!0),e.triggerRe=new RegExp(e.trigger,\"\",!0),e.endRe=u(e.endTrigger,e.endGuard,!0),e.endTriggerRe=new RegExp(e.endTrigger,\"\",!0)}var n=this.snippetMap,r=this.snippetNameMap,i=this;e.content?a(e):Array.isArray(e)&&e.forEach(a),this._signal(\"registerSnippets\",{scope:t})},this.unregister=function(e,t){function i(e){var i=r[e.scope||t];if(i&&i[e.name]){delete i[e.name];var s=n[e.scope||t],o=s&&s.indexOf(e);o>=0&&s.splice(o,1)}}var n=this.snippetMap,r=this.snippetNameMap;e.content?i(e):Array.isArray(e)&&e.forEach(i)},this.parseSnippetFile=function(e){e=e.replace(/\\r/g,\"\");var t=[],n={},r=/^#.*|^({[\\s\\S]*})\\s*$|^(\\S+) (.*)$|^((?:\\n*\\t.*)+)/gm,i;while(i=r.exec(e)){if(i[1])try{n=JSON.parse(i[1]),t.push(n)}catch(s){}if(i[4])n.content=i[4].replace(/^\\t/gm,\"\"),t.push(n),n={};else{var o=i[2],u=i[3];if(o==\"regex\"){var a=/\\/((?:[^\\/\\\\]|\\\\.)*)|$/g;n.guard=a.exec(u)[1],n.trigger=a.exec(u)[1],n.endTrigger=a.exec(u)[1],n.endGuard=a.exec(u)[1]}else o==\"snippet\"?(n.tabTrigger=u.match(/^\\S*/)[0],n.name||(n.name=u)):n[o]=u}}return t},this.getSnippetByName=function(e,t){var n=this.snippetNameMap,r;return this.getActiveScopes(t).some(function(t){var i=n[t];return i&&(r=i[e]),!!r},this),r}}).call(c.prototype);var h=function(e){if(e.tabstopManager)return e.tabstopManager;e.tabstopManager=this,this.$onChange=this.onChange.bind(this),this.$onChangeSelection=s.delayedCall(this.onChangeSelection.bind(this)).schedule,this.$onChangeSession=this.onChangeSession.bind(this),this.$onAfterExec=this.onAfterExec.bind(this),this.attach(e)};(function(){this.attach=function(e){this.index=0,this.ranges=[],this.tabstops=[],this.$openTabstops=null,this.selectedTabstop=null,this.editor=e,this.editor.on(\"change\",this.$onChange),this.editor.on(\"changeSelection\",this.$onChangeSelection),this.editor.on(\"changeSession\",this.$onChangeSession),this.editor.commands.on(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.detach=function(){this.tabstops.forEach(this.removeTabstopMarkers,this),this.ranges=null,this.tabstops=null,this.selectedTabstop=null,this.editor.removeListener(\"change\",this.$onChange),this.editor.removeListener(\"changeSelection\",this.$onChangeSelection),this.editor.removeListener(\"changeSession\",this.$onChangeSession),this.editor.commands.removeListener(\"afterExec\",this.$onAfterExec),this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.tabstopManager=null,this.editor=null},this.onChange=function(e){var t=e.data.range,n=e.data.action[0]==\"r\",r=t.start,i=t.end,s=r.row,o=i.row,u=o-s,a=i.column-r.column;n&&(u=-u,a=-a);if(!this.$inChange&&n){var f=this.selectedTabstop,c=f&&!f.some(function(e){return l(e.start,r)<=0&&l(e.end,i)>=0});if(c)return this.detach()}var h=this.ranges;for(var p=0;p<h.length;p++){var d=h[p];if(d.end.row<r.row)continue;if(n&&l(r,d.start)<0&&l(i,d.end)>0){this.removeRange(d),p--;continue}d.start.row==s&&d.start.column>r.column&&(d.start.column+=a),d.end.row==s&&d.end.column>=r.column&&(d.end.column+=a),d.start.row>=s&&(d.start.row+=u),d.end.row>=s&&(d.end.row+=u),l(d.start,d.end)>0&&this.removeRange(d)}h.length||this.detach()},this.updateLinkedFields=function(){var e=this.selectedTabstop;if(!e||!e.hasLinkedRanges)return;this.$inChange=!0;var n=this.editor.session,r=n.getTextRange(e.firstNonLinked);for(var i=e.length;i--;){var s=e[i];if(!s.linked)continue;var o=t.snippetManager.tmStrFormat(r,s.original);n.replace(s,o)}this.$inChange=!1},this.onAfterExec=function(e){e.command&&!e.command.readOnly&&this.updateLinkedFields()},this.onChangeSelection=function(){if(!this.editor)return;var e=this.editor.selection.lead,t=this.editor.selection.anchor,n=this.editor.selection.isEmpty();for(var r=this.ranges.length;r--;){if(this.ranges[r].linked)continue;var i=this.ranges[r].contains(e.row,e.column),s=n||this.ranges[r].contains(t.row,t.column);if(i&&s)return}this.detach()},this.onChangeSession=function(){this.detach()},this.tabNext=function(e){var t=this.tabstops.length,n=this.index+(e||1);n=Math.min(Math.max(n,1),t),n==t&&(n=0),this.selectTabstop(n),n===0&&this.detach()},this.selectTabstop=function(e){this.$openTabstops=null;var t=this.tabstops[this.index];t&&this.addTabstopMarkers(t),this.index=e,t=this.tabstops[this.index];if(!t||!t.length)return;this.selectedTabstop=t;if(!this.editor.inVirtualSelectionMode){var n=this.editor.multiSelect;n.toSingleRange(t.firstNonLinked.clone());for(var r=t.length;r--;){if(t.hasLinkedRanges&&t[r].linked)continue;n.addRange(t[r].clone(),!0)}n.ranges[0]&&n.addRange(n.ranges[0].clone())}else this.editor.selection.setRange(t.firstNonLinked);this.editor.keyBinding.addKeyboardHandler(this.keyboardHandler)},this.addTabstops=function(e,t,n){this.$openTabstops||(this.$openTabstops=[]);if(!e[0]){var r=o.fromPoints(n,n);v(r.start,t),v(r.end,t),e[0]=[r],e[0].index=0}var i=this.index,s=[i+1,0],u=this.ranges;e.forEach(function(e,n){var r=this.$openTabstops[n]||e;for(var i=e.length;i--;){var a=e[i],f=o.fromPoints(a.start,a.end||a.start);d(f.start,t),d(f.end,t),f.original=a,f.tabstop=r,u.push(f),r!=e?r.unshift(f):r[i]=f,a.fmtString?(f.linked=!0,r.hasLinkedRanges=!0):r.firstNonLinked||(r.firstNonLinked=f)}r.firstNonLinked||(r.hasLinkedRanges=!1),r===e&&(s.push(r),this.$openTabstops[n]=r),this.addTabstopMarkers(r)},this),s.length>2&&(this.tabstops.length&&s.push(s.splice(2,1)[0]),this.tabstops.splice.apply(this.tabstops,s))},this.addTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){e.markerId||(e.markerId=t.addMarker(e,\"ace_snippet-marker\",\"text\"))})},this.removeTabstopMarkers=function(e){var t=this.editor.session;e.forEach(function(e){t.removeMarker(e.markerId),e.markerId=null})},this.removeRange=function(e){var t=e.tabstop.indexOf(e);e.tabstop.splice(t,1),t=this.ranges.indexOf(e),this.ranges.splice(t,1),this.editor.session.removeMarker(e.markerId),e.tabstop.length||(t=this.tabstops.indexOf(e.tabstop),t!=-1&&this.tabstops.splice(t,1),this.tabstops.length||this.detach())},this.keyboardHandler=new a,this.keyboardHandler.bindKeys({Tab:function(e){if(t.snippetManager&&t.snippetManager.expandWithTab(e))return;e.tabstopManager.tabNext(1)},\"Shift-Tab\":function(e){e.tabstopManager.tabNext(-1)},Esc:function(e){e.tabstopManager.detach()},Return:function(e){return!1}})}).call(h.prototype);var p={};p.onChange=u.prototype.onChange,p.setPosition=function(e,t){this.pos.row=e,this.pos.column=t},p.update=function(e,t,n){this.$insertRight=n,this.pos=e,this.onChange(t)};var d=function(e,t){e.row==0&&(e.column+=t.column),e.row+=t.row},v=function(e,t){e.row==t.row&&(e.column-=t.column),e.row-=t.row};e(\"./lib/dom\").importCssString(\".ace_snippet-marker {    -moz-box-sizing: border-box;    box-sizing: border-box;    background: rgba(194, 193, 208, 0.09);    border: 1px dotted rgba(211, 208, 235, 0.62);    position: absolute;}\"),t.snippetManager=new c;var m=e(\"./editor\").Editor;(function(){this.insertSnippet=function(e,n){return t.snippetManager.insertSnippet(this,e,n)},this.expandSnippet=function(e){return t.snippetManager.expandWithTab(this,e)}}).call(m.prototype)}),define(\"ace/autocomplete\",[\"require\",\"exports\",\"module\",\"ace/keyboard/hash_handler\",\"ace/autocomplete/popup\",\"ace/autocomplete/util\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/snippets\"],function(e,t,n){var r=e(\"./keyboard/hash_handler\").HashHandler,i=e(\"./autocomplete/popup\").AcePopup,s=e(\"./autocomplete/util\"),o=e(\"./lib/event\"),u=e(\"./lib/lang\"),a=e(\"./snippets\").snippetManager,f=function(){this.autoInsert=!0,this.autoSelect=!0,this.keyboardHandler=new r,this.keyboardHandler.bindKeys(this.commands),this.blurListener=this.blurListener.bind(this),this.changeListener=this.changeListener.bind(this),this.mousedownListener=this.mousedownListener.bind(this),this.mousewheelListener=this.mousewheelListener.bind(this),this.changeTimer=u.delayedCall(function(){this.updateCompletions(!0)}.bind(this))};(function(){this.gatherCompletionsId=0,this.$init=function(){this.popup=new i(document.body||document.documentElement),this.popup.on(\"click\",function(e){this.insertMatch(),e.stop()}.bind(this)),this.popup.focus=this.editor.focus.bind(this.editor)},this.openPopup=function(e,t,n){this.popup||this.$init(),this.popup.setData(this.completions.filtered);var r=e.renderer;this.popup.setRow(this.autoSelect?0:-1);if(!n){this.popup.setTheme(e.getTheme()),this.popup.setFontSize(e.getFontSize());var i=r.layerConfig.lineHeight,s=r.$cursorLayer.getPixelPosition(this.base,!0);s.left-=this.popup.getTextLeftOffset();var o=e.container.getBoundingClientRect();s.top+=o.top-r.layerConfig.offset,s.left+=o.left-e.renderer.scrollLeft,s.left+=r.$gutterLayer.gutterWidth,this.popup.show(s,i)}},this.detach=function(){this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler),this.editor.off(\"changeSelection\",this.changeListener),this.editor.off(\"blur\",this.blurListener),this.editor.off(\"mousedown\",this.mousedownListener),this.editor.off(\"mousewheel\",this.mousewheelListener),this.changeTimer.cancel(),this.popup&&this.popup.isOpen&&(this.gatherCompletionsId=this.gatherCompletionsId+1),this.popup&&this.popup.hide(),this.activated=!1,this.completions=this.base=null},this.changeListener=function(e){var t=this.editor.selection.lead;(t.row!=this.base.row||t.column<this.base.column)&&this.detach(),this.activated?this.changeTimer.schedule():this.detach()},this.blurListener=function(){var e=document.activeElement;e!=this.editor.textInput.getElement()&&e.parentNode!=this.popup.container&&this.detach()},this.mousedownListener=function(e){this.detach()},this.mousewheelListener=function(e){this.detach()},this.goTo=function(e){var t=this.popup.getRow(),n=this.popup.session.getLength()-1;switch(e){case\"up\":t=t<=0?n:t-1;break;case\"down\":t=t>=n?-1:t+1;break;case\"start\":t=0;break;case\"end\":t=n}this.popup.setRow(t)},this.insertMatch=function(e){e||(e=this.popup.getData(this.popup.getRow()));if(!e)return!1;if(e.completer&&e.completer.insertMatch)e.completer.insertMatch(this.editor);else{if(this.completions.filterText){var t=this.editor.selection.getAllRanges();for(var n=0,r;r=t[n];n++)r.start.column-=this.completions.filterText.length,this.editor.session.remove(r)}e.snippet?a.insertSnippet(this.editor,e.snippet):this.editor.execCommand(\"insertstring\",e.value||e)}this.detach()},this.commands={Up:function(e){e.completer.goTo(\"up\")},Down:function(e){e.completer.goTo(\"down\")},\"Ctrl-Up|Ctrl-Home\":function(e){e.completer.goTo(\"start\")},\"Ctrl-Down|Ctrl-End\":function(e){e.completer.goTo(\"end\")},Esc:function(e){e.completer.detach()},Space:function(e){e.completer.detach(),e.insert(\" \")},Return:function(e){return e.completer.insertMatch()},\"Shift-Return\":function(e){e.completer.insertMatch(!0)},Tab:function(e){var t=e.completer.insertMatch();if(!!t||!!e.tabstopManager)return t;e.completer.goTo(\"down\")},PageUp:function(e){e.completer.popup.gotoPageUp()},PageDown:function(e){e.completer.popup.gotoPageDown()}},this.gatherCompletions=function(e,t){var n=e.getSession(),r=e.getCursorPosition(),i=n.getLine(r.row),o=s.retrievePrecedingIdentifier(i,r.column);this.base=e.getCursorPosition(),this.base.column-=o.length;var u=[],a=e.completers.length;return e.completers.forEach(function(i,f){i.getCompletions(e,n,r,o,function(r,i){r||(u=u.concat(i));var o=e.getCursorPosition(),f=n.getLine(o.row);t(null,{prefix:s.retrievePrecedingIdentifier(f,o.column,i[0]&&i[0].identifierRegex),matches:u,finished:--a===0})})}),!0},this.showPopup=function(e){this.editor&&this.detach(),this.activated=!0,this.editor=e,e.completer!=this&&(e.completer&&e.completer.detach(),e.completer=this),e.keyBinding.addKeyboardHandler(this.keyboardHandler),e.on(\"changeSelection\",this.changeListener),e.on(\"blur\",this.blurListener),e.on(\"mousedown\",this.mousedownListener),e.on(\"mousewheel\",this.mousewheelListener),this.updateCompletions()},this.updateCompletions=function(e){if(e&&this.base&&this.completions){var t=this.editor.getCursorPosition(),n=this.editor.session.getTextRange({start:this.base,end:t});if(n==this.completions.filterText)return;this.completions.setFilter(n);if(!this.completions.filtered.length)return this.detach();if(this.completions.filtered.length==1&&this.completions.filtered[0].value==n&&!this.completions.filtered[0].snippet)return this.detach();this.openPopup(this.editor,n,e);return}var r=this.gatherCompletionsId;this.gatherCompletions(this.editor,function(t,n){var i=function(){if(!n.finished)return;return this.detach()}.bind(this),s=n.prefix,o=n&&n.matches;if(!o||!o.length)return i();if(s.indexOf(n.prefix)!==0||r!=this.gatherCompletionsId)return;this.completions=new l(o),this.completions.setFilter(s);var u=this.completions.filtered;if(!u.length)return i();if(u.length==1&&u[0].value==s&&!u[0].snippet)return i();if(this.autoInsert&&u.length==1)return this.insertMatch(u[0]);this.openPopup(this.editor,s,e)}.bind(this))},this.cancelContextMenu=function(){var e=function(t){this.editor.off(\"nativecontextmenu\",e),t&&t.domEvent&&o.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on(\"nativecontextmenu\",e)}}).call(f.prototype),f.startCommand={name:\"startAutocomplete\",exec:function(e){e.completer||(e.completer=new f),e.completer.autoInsert=e.completer.autoSelect=!0,e.completer.showPopup(e),e.completer.cancelContextMenu()},bindKey:\"Ctrl-Space|Ctrl-Shift-Space|Alt-Space\"};var l=function(e,t,n){this.all=e,this.filtered=e,this.filterText=t||\"\"};(function(){this.setFilter=function(e){if(e.length>this.filterText&&e.lastIndexOf(this.filterText,0)===0)var t=this.filtered;else var t=this.all;this.filterText=e,t=this.filterCompletions(t,this.filterText),t=t.sort(function(e,t){return t.exactMatch-e.exactMatch||t.score-e.score});var n=null;t=t.filter(function(e){var t=e.value||e.caption||e.snippet;return t===n?!1:(n=t,!0)}),this.filtered=t},this.filterCompletions=function(e,t){var n=[],r=t.toUpperCase(),i=t.toLowerCase();e:for(var s=0,o;o=e[s];s++){var u=o.value||o.caption||o.snippet;if(!u)continue;var a=-1,f=0,l=0,c,h;for(var p=0;p<t.length;p++){var d=u.indexOf(i[p],a+1),v=u.indexOf(r[p],a+1);c=d>=0?v<0||d<v?d:v:v;if(c<0)continue e;h=c-a-1,h>0&&(a===-1&&(l+=10),l+=h),f|=1<<c,a=c}o.matchMask=f,o.exactMatch=l?0:1,o.score=(o.score||0)-l,n.push(o)}return n}}).call(l.prototype),t.Autocomplete=f,t.FilteredList=l}),define(\"ace/autocomplete/popup\",[\"require\",\"exports\",\"module\",\"ace/edit_session\",\"ace/virtual_renderer\",\"ace/editor\",\"ace/range\",\"ace/lib/event\",\"ace/lib/lang\",\"ace/lib/dom\"],function(e,t,n){var r=e(\"../edit_session\").EditSession,i=e(\"../virtual_renderer\").VirtualRenderer,s=e(\"../editor\").Editor,o=e(\"../range\").Range,u=e(\"../lib/event\"),a=e(\"../lib/lang\"),f=e(\"../lib/dom\"),l=function(e){var t=new i(e);t.$maxLines=4;var n=new s(t);return n.setHighlightActiveLine(!1),n.setShowPrintMargin(!1),n.renderer.setShowGutter(!1),n.renderer.setHighlightGutterLine(!1),n.$mouseHandler.$focusWaitTimout=0,n},c=function(e){var t=f.createElement(\"div\"),n=new l(t);e&&e.appendChild(t),t.style.display=\"none\",n.renderer.content.style.cursor=\"default\",n.renderer.setStyle(\"ace_autocomplete\"),n.setOption(\"displayIndentGuides\",!1);var r=function(){};n.focus=r,n.$isFocused=!0,n.renderer.$cursorLayer.restartTimer=r,n.renderer.$cursorLayer.element.style.opacity=0,n.renderer.$maxLines=8,n.renderer.$keepTextAreaAtCursor=!1,n.setHighlightActiveLine(!1),n.session.highlight(\"\"),n.session.$searchHighlight.clazz=\"ace_highlight-marker\",n.on(\"mousedown\",function(e){var t=e.getDocumentPosition();n.selection.moveToPosition(t),c.start.row=c.end.row=t.row,e.stop()});var i,s=new o(-1,0,-1,Infinity),c=new o(-1,0,-1,Infinity);c.id=n.session.addMarker(c,\"ace_active-line\",\"fullLine\"),n.setSelectOnHover=function(e){e?s.id&&(n.session.removeMarker(s.id),s.id=null):s.id=n.session.addMarker(s,\"ace_line-hover\",\"fullLine\")},n.setSelectOnHover(!1),n.on(\"mousemove\",function(e){if(!i){i=e;return}if(i.x==e.x&&i.y==e.y)return;i=e,i.scrollTop=n.renderer.scrollTop;var t=i.getDocumentPosition().row;s.start.row!=t&&(s.id||n.setRow(t),p(t))}),n.renderer.on(\"beforeRender\",function(){if(i&&s.start.row!=-1){i.$pos=null;var e=i.getDocumentPosition().row;s.id||n.setRow(e),p(e,!0)}}),n.renderer.on(\"afterRender\",function(){var e=n.getRow(),t=n.renderer.$textLayer,r=t.element.childNodes[e-t.config.firstRow];if(r==t.selectedNode)return;t.selectedNode&&f.removeCssClass(t.selectedNode,\"ace_selected\"),t.selectedNode=r,r&&f.addCssClass(r,\"ace_selected\")});var h=function(){p(-1)},p=function(e,t){e!==s.start.row&&(s.start.row=s.end.row=e,t||n.session._emit(\"changeBackMarker\"),n._emit(\"changeHoverMarker\"))};n.getHoveredRow=function(){return s.start.row},u.addListener(n.container,\"mouseout\",h),n.on(\"hide\",h),n.on(\"changeSelection\",h),n.session.doc.getLength=function(){return n.data.length},n.session.doc.getLine=function(e){var t=n.data[e];return typeof t==\"string\"?t:t&&t.value||\"\"};var d=n.session.bgTokenizer;return d.$tokenizeRow=function(e){var t=n.data[e],r=[];if(!t)return r;typeof t==\"string\"&&(t={value:t}),t.caption||(t.caption=t.value);var i=-1,s,o;for(var e=0;e<t.caption.length;e++)o=t.caption[e],s=t.matchMask&1<<e?1:0,i!==s?(r.push({type:t.className||\"\"+(s?\"completion-highlight\":\"\"),value:o}),i=s):r[r.length-1].value+=o;if(t.meta){var u=n.renderer.$size.scrollerWidth/n.renderer.layerConfig.characterWidth;t.meta.length+t.caption.length<u-2&&r.push({type:\"rightAlignedText\",value:t.meta})}return r},d.$updateOnChange=r,d.start=r,n.session.$computeWidth=function(){return this.screenWidth=0},n.isOpen=!1,n.isTopdown=!1,n.data=[],n.setData=function(e){n.data=e||[],n.setValue(a.stringRepeat(\"\\n\",e.length),-1),n.setRow(0)},n.getData=function(e){return n.data[e]},n.getRow=function(){return c.start.row},n.setRow=function(e){e=Math.max(-1,Math.min(this.data.length,e)),c.start.row!=e&&(n.selection.clearSelection(),c.start.row=c.end.row=e||0,n.session._emit(\"changeBackMarker\"),n.moveCursorTo(e||0,0),n.isOpen&&n._signal(\"select\"))},n.on(\"changeSelection\",function(){n.isOpen&&n.setRow(n.selection.lead.row)}),n.hide=function(){this.container.style.display=\"none\",this._signal(\"hide\"),n.isOpen=!1},n.show=function(e,t,r){var s=this.container,o=window.innerHeight,u=window.innerWidth,a=this.renderer,f=a.$maxLines*t*1.4,l=e.top+this.$borderSize;l+f>o-t&&!r?(s.style.top=\"\",s.style.bottom=o-l+\"px\",n.isTopdown=!1):(l+=t,s.style.top=l+\"px\",s.style.bottom=\"\",n.isTopdown=!0),s.style.display=\"\",this.renderer.$textLayer.checkForSizeChanges();var c=e.left;c+s.offsetWidth>u&&(c=u-s.offsetWidth),s.style.left=c+\"px\",this._signal(\"show\"),i=null,n.isOpen=!0},n.getTextLeftOffset=function(){return this.$borderSize+this.renderer.$padding+this.$imageSize},n.$imageSize=0,n.$borderSize=1,n};f.importCssString(\".ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {    background-color: #CAD6FA;    z-index: 1;}.ace_editor.ace_autocomplete .ace_line-hover {    border: 1px solid #abbffe;    margin-top: -1px;    background: rgba(233,233,253,0.4);}.ace_editor.ace_autocomplete .ace_line-hover {    position: absolute;    z-index: 2;}.ace_editor.ace_autocomplete .ace_scroller {   background: none;   border: none;   box-shadow: none;}.ace_rightAlignedText {    color: gray;    display: inline-block;    position: absolute;    right: 4px;    text-align: right;    z-index: -1;}.ace_editor.ace_autocomplete .ace_completion-highlight{    color: #000;    text-shadow: 0 0 0.01em;}.ace_editor.ace_autocomplete {    width: 280px;    z-index: 200000;    background: #fbfbfb;    color: #444;    border: 1px lightgray solid;    position: fixed;    box-shadow: 2px 3px 5px rgba(0,0,0,.2);    line-height: 1.4;}\"),t.AcePopup=c}),define(\"ace/autocomplete/util\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.parForEach=function(e,t,n){var r=0,i=e.length;i===0&&n();for(var s=0;s<i;s++)t(e[s],function(e,t){r++,r===i&&n(e,t)})};var r=/[a-zA-Z_0-9\\$\\-\\u00A2-\\uFFFF]/;t.retrievePrecedingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t-1;s>=0;s--){if(!n.test(e[s]))break;i.push(e[s])}return i.reverse().join(\"\")},t.retrieveFollowingIdentifier=function(e,t,n){n=n||r;var i=[];for(var s=t;s<e.length;s++){if(!n.test(e[s]))break;i.push(e[s])}return i}}),define(\"ace/autocomplete/text_completer\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){function s(e,t){var n=e.getTextRange(r.fromPoints({row:0,column:0},t));return n.split(i).length-1}function o(e,t){var n=s(e,t),r=e.getValue().split(i),o=Object.create(null),u=r[n];return r.forEach(function(e,t){if(!e||e===u)return;var i=Math.abs(n-t),s=r.length-i;o[e]?o[e]=Math.max(s,o[e]):o[e]=s}),o}var r=e(\"../range\").Range,i=/[^a-zA-Z_0-9\\$\\-\\u00C0-\\u1FFF\\u2C00-\\uD7FF\\w]+/;t.getCompletions=function(e,t,n,r,i){var s=o(t,n,r),u=Object.keys(s);i(null,u.map(function(e){return{name:e,value:e,score:s[e],meta:\"local\"}}))}}),define(\"ace/ext/language_tools\",[\"require\",\"exports\",\"module\",\"ace/snippets\",\"ace/autocomplete\",\"ace/config\",\"ace/autocomplete/util\",\"ace/autocomplete/text_completer\",\"ace/editor\"],function(e,t,n){var r=e(\"../snippets\").snippetManager,i=e(\"../autocomplete\").Autocomplete,s=e(\"../config\"),o=e(\"../autocomplete/util\"),u=e(\"../autocomplete/text_completer\"),a={getCompletions:function(e,t,n,r,i){var s=e.session.getState(n.row),o=t.$mode.getCompletions(s,t,n,r);i(null,o)}},f={getCompletions:function(e,t,n,i,s){var o=r.snippetMap,u=[];r.getActiveScopes(e).forEach(function(e){var t=o[e]||[];for(var n=t.length;n--;){var r=t[n],i=r.name||r.tabTrigger;if(!i)continue;u.push({caption:i,snippet:r.content,meta:r.tabTrigger&&!r.name?r.tabTrigger+\"\\u21e5 \":\"snippet\"})}},this),s(null,u)}},l=[f,u,a];t.addCompleter=function(e){l.push(e)},t.textCompleter=u,t.keyWordCompleter=a,t.snippetCompleter=f;var c={name:\"expandSnippet\",exec:function(e){var t=r.expandWithTab(e);t||e.execCommand(\"indent\")},bindKey:\"Tab\"},h=function(e,t){p(t.session.$mode)},p=function(e){var t=e.$id;r.files||(r.files={}),d(t),e.modes&&e.modes.forEach(p)},d=function(e){if(!e||r.files[e])return;var t=e.replace(\"mode\",\"snippets\");r.files[e]={},s.loadModule(t,function(t){t&&(r.files[e]=t,!t.snippets&&t.snippetText&&(t.snippets=r.parseSnippetFile(t.snippetText)),r.register(t.snippets||[],t.scope),t.includeScopes&&(r.snippetMap[t.scope].includeScopes=t.includeScopes,t.includeScopes.forEach(function(e){d(\"ace/mode/\"+e)})))})},v=function(e){var t=e.editor,n=e.args||\"\",r=t.getCursorPosition(),s=t.session.getLine(r.row),u=t.completer&&t.completer.activated,a=o.retrievePrecedingIdentifier(s,r.column);l.forEach(function(e){e.identifierRegexps&&e.identifierRegexps.forEach(function(e){a||(a=o.retrievePrecedingIdentifier(s,r.column,e))})}),e.command.name===\"backspace\"&&!a?u&&t.completer.detach():e.command.name===\"insertstring\"&&(a&&!u?(t.completer||(t.completer=new i,t.completer.autoSelect=!1,t.completer.autoInsert=!1),t.completer.showPopup(t)):!a&&u&&t.completer.detach())},m=e(\"../editor\").Editor;e(\"../config\").defineOptions(m.prototype,\"editor\",{enableBasicAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.addCommand(i.startCommand)):this.commands.removeCommand(i.startCommand)},value:!1},enableLiveAutocompletion:{set:function(e){e?(this.completers=Array.isArray(e)?e:l,this.commands.on(\"afterExec\",v)):this.commands.removeListener(\"afterExec\",v)},value:!1},enableSnippets:{set:function(e){e?(this.commands.addCommand(c),this.on(\"changeMode\",h),h(null,this)):(this.commands.removeCommand(c),this.off(\"changeMode\",h))},value:!1}})})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/mode-yaml.js",
    "content": "define(\"ace/mode/yaml\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text\",\"ace/mode/yaml_highlight_rules\",\"ace/mode/matching_brace_outdent\",\"ace/mode/folding/coffee\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text\").Mode,s=e(\"./yaml_highlight_rules\").YamlHighlightRules,o=e(\"./matching_brace_outdent\").MatchingBraceOutdent,u=e(\"./folding/coffee\").FoldMode,a=function(){this.HighlightRules=s,this.$outdent=new o,this.foldingRules=new u};r.inherits(a,i),function(){this.lineCommentStart=\"#\",this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t);if(e==\"start\"){var i=t.match(/^.*[\\{\\(\\[]\\s*$/);i&&(r+=n)}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.$id=\"ace/mode/yaml\"}.call(a.prototype),t.Mode=a}),define(\"ace/mode/yaml_highlight_rules\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/text_highlight_rules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"./text_highlight_rules\").TextHighlightRules,s=function(){this.$rules={start:[{token:\"comment\",regex:\"#.*$\"},{token:\"list.markup\",regex:/^(?:-{3}|\\.{3})\\s*(?=#|$)/},{token:\"list.markup\",regex:/^\\s*[\\-?](?:$|\\s)/},{token:\"constant\",regex:\"!![\\\\w//]+\"},{token:\"constant.language\",regex:\"[&\\\\*][a-zA-Z0-9-_]+\"},{token:[\"meta.tag\",\"keyword\"],regex:/^(\\s*\\w.*?)(\\:(?:\\s+|$))/},{token:[\"meta.tag\",\"keyword\"],regex:/(\\w+?)(\\s*\\:(?:\\s+|$))/},{token:\"keyword.operator\",regex:\"<<\\\\w*:\\\\w*\"},{token:\"keyword.operator\",regex:\"-\\\\s*(?=[{])\"},{token:\"string\",regex:'[\"](?:(?:\\\\\\\\.)|(?:[^\"\\\\\\\\]))*?[\"]'},{token:\"string\",regex:\"[|>][-+\\\\d\\\\s]*$\",next:\"qqstring\"},{token:\"string\",regex:\"['](?:(?:\\\\\\\\.)|(?:[^'\\\\\\\\]))*?[']\"},{token:\"constant.numeric\",regex:/(\\b|[+\\-\\.])[\\d_]+(?:(?:\\.[\\d_]*)?(?:[eE][+\\-]?[\\d_]+)?)/},{token:\"constant.numeric\",regex:/[+\\-]?\\.inf\\b|NaN\\b|0x[\\dA-Fa-f_]+|0b[10_]+/},{token:\"constant.language.boolean\",regex:\"(?:true|false|TRUE|FALSE|True|False|yes|no)\\\\b\"},{token:\"paren.lparen\",regex:\"[[({]\"},{token:\"paren.rparen\",regex:\"[\\\\])}]\"}],qqstring:[{token:\"string\",regex:\"(?=(?:(?:\\\\\\\\.)|(?:[^:]))*?:)\",next:\"start\"},{token:\"string\",regex:\".+\"}]}};r.inherits(s,i),t.YamlHighlightRules=s}),define(\"ace/mode/matching_brace_outdent\",[\"require\",\"exports\",\"module\",\"ace/range\"],function(e,t,n){var r=e(\"../range\").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\\s+$/.test(e)?/^\\s*\\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\\s*\\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define(\"ace/mode/folding/coffee\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/mode/folding/fold_mode\",\"ace/range\"],function(e,t,n){var r=e(\"../../lib/oop\"),i=e(\"./fold_mode\").FoldMode,s=e(\"../../range\").Range,o=t.FoldMode=function(){};r.inherits(o,i),function(){this.getFoldWidgetRange=function(e,t,n){var r=this.indentationBlock(e,n);if(r)return r;var i=/\\S/,o=e.getLine(n),u=o.search(i);if(u==-1||o[u]!=\"#\")return;var a=o.length,f=e.getLength(),l=n,c=n;while(++n<f){o=e.getLine(n);var h=o.search(i);if(h==-1)continue;if(o[h]!=\"#\")break;c=n}if(c>l){var p=e.getLine(c).length;return new s(l,a,c,p)}},this.getFoldWidget=function(e,t,n){var r=e.getLine(n),i=r.search(/\\S/),s=e.getLine(n+1),o=e.getLine(n-1),u=o.search(/\\S/),a=s.search(/\\S/);if(i==-1)return e.foldWidgets[n-1]=u!=-1&&u<a?\"start\":\"\",\"\";if(u==-1){if(i==a&&r[i]==\"#\"&&s[i]==\"#\")return e.foldWidgets[n-1]=\"\",e.foldWidgets[n+1]=\"\",\"start\"}else if(u==i&&r[i]==\"#\"&&o[i]==\"#\"&&e.getLine(n-2).search(/\\S/)==-1)return e.foldWidgets[n-1]=\"start\",e.foldWidgets[n+1]=\"\",\"\";return u!=-1&&u<i?e.foldWidgets[n-1]=\"start\":e.foldWidgets[n-1]=\"\",i<a?\"start\":\"\"}}.call(o.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/abap.js",
    "content": "define(\"ace/snippets/abap\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"abap\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/actionscript.js",
    "content": "define(\"ace/snippets/actionscript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet main\\n\tpackage {\\n\t\timport flash.display.*;\\n\t\timport flash.Events.*;\\n\t\\n\t\tpublic class Main extends Sprite {\\n\t\t\tpublic function Main (\t) {\\n\t\t\t\ttrace(\"start\");\\n\t\t\t\tstage.scaleMode = StageScaleMode.NO_SCALE;\\n\t\t\t\tstage.addEventListener(Event.RESIZE, resizeListener);\\n\t\t\t}\\n\t\\n\t\t\tprivate function resizeListener (e:Event):void {\\n\t\t\t\ttrace(\"The application window changed size!\");\\n\t\t\t\ttrace(\"New width:  \" + stage.stageWidth);\\n\t\t\t\ttrace(\"New height: \" + stage.stageHeight);\\n\t\t\t}\\n\t\\n\t\t}\\n\t\\n\t}\\nsnippet class\\n\t${1:public|internal} class ${2:name} ${3:extends } {\\n\t\tpublic function $2 (\t) {\\n\t\t\t(\"start\");\\n\t\t}\\n\t}\\nsnippet all\\n\tpackage name {\\n\\n\t\t${1:public|internal|final} class ${2:name} ${3:extends } {\\n\t\t\tprivate|public| static const FOO = \"abc\";\\n\t\t\tprivate|public| static var BAR = \"abc\";\\n\\n\t\t\t// class initializer - no JIT !! one time setup\\n\t\t\tif Cababilities.os == \"Linux|MacOS\" {\\n\t\t\t\tFOO = \"other\";\\n\t\t\t}\\n\\n\t\t\t// constructor:\\n\t\t\tpublic function $2 (\t){\\n\t\t\t\tsuper2();\\n\t\t\t\ttrace(\"start\");\\n\t\t\t}\\n\t\t\tpublic function name (a, b...){\\n\t\t\t\tsuper.name(..);\\n\t\t\t\tlable:break\\n\t\t\t}\\n\t\t}\\n\t}\\n\\n\tfunction A(){\\n\t\t// A can only be accessed within this file\\n\t}\\nsnippet switch\\n\tswitch(${1}){\\n\t\tcase ${2}:\\n\t\t\t${3}\\n\t\tbreak;\\n\t\tdefault:\\n\t}\\nsnippet case\\n\t\tcase ${1}:\\n\t\t\t${2}\\n\t\tbreak;\\nsnippet package\\n\tpackage ${1:package}{\\n\t\t${2}\\n\t}\\nsnippet wh\\n\twhile ${1:cond}{\\n\t\t${2}\\n\t}\\nsnippet do\\n\tdo {\\n\t\t${2}\\n\t} while (${1:cond})\\nsnippet while\\n\twhile ${1:cond}{\\n\t\t${2}\\n\t}\\nsnippet for enumerate names\\n\tfor (${1:var} in ${2:object}){\\n\t\t${3}\\n\t}\\nsnippet for enumerate values\\n\tfor each (${1:var} in ${2:object}){\\n\t\t${3}\\n\t}\\nsnippet get_set\\n\tfunction get ${1:name} {\\n\t\treturn ${2}\\n\t}\\n\tfunction set $1 (newValue) {\\n\t\t${3}\\n\t}\\nsnippet interface\\n\tinterface name {\\n\t\tfunction method(${1}):${2:returntype};\\n\t}\\nsnippet try\\n\ttry {\\n\t\t${1}\\n\t} catch (error:ErrorType) {\\n\t\t${2}\\n\t} finally {\\n\t\t${3}\\n\t}\\n# For Loop (same as c.snippet)\\nsnippet for for (..) {..}\\n\tfor (${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\\n\t\t${4:/* code */}\\n\t}\\n# Custom For Loop\\nsnippet forr\\n\tfor (${1:i} = ${2:0}; ${3:$1 < 10}; $1${4:++}) {\\n\t\t${5:/* code */}\\n\t}\\n# If Condition\\nsnippet if\\n\tif (${1:/* condition */}) {\\n\t\t${2:/* code */}\\n\t}\\nsnippet el\\n\telse {\\n\t\t${1}\\n\t}\\n# Ternary conditional\\nsnippet t\\n\t${1:/* condition */} ? ${2:a} : ${3:b}\\nsnippet fun\\n\tfunction ${1:function_name}(${2})${3}\\n\t{\\n\t\t${4:/* code */}\\n\t}\\n# FlxSprite (usefull when using the flixel library)\\nsnippet FlxSprite\\n\tpackage\\n\t{\\n\t\timport org.flixel.*\\n\\n\t\tpublic class ${1:ClassName} extends ${2:FlxSprite}\\n\t\t{\\n\t\t\tpublic function $1(${3: X:Number, Y:Number}):void\\n\t\t\t{\\n\t\t\t\tsuper(X,Y);\\n\t\t\t\t${4: //code...}\\n\t\t\t}\\n\\n\t\t\toverride public function update():void\\n\t\t\t{\\n\t\t\t\tsuper.update();\\n\t\t\t\t${5: //code...}\\n\t\t\t}\\n\t\t}\\n\t}\\n\\n',t.scope=\"actionscript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ada.js",
    "content": "define(\"ace/snippets/ada\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"ada\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/apache_conf.js",
    "content": "define(\"ace/snippets/apache_conf\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"apache_conf\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/applescript.js",
    "content": "define(\"ace/snippets/applescript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"applescript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/asciidoc.js",
    "content": "define(\"ace/snippets/asciidoc\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"asciidoc\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/assembly_x86.js",
    "content": "define(\"ace/snippets/assembly_x86\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"assembly_x86\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/autohotkey.js",
    "content": "define(\"ace/snippets/autohotkey\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"autohotkey\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/batchfile.js",
    "content": "define(\"ace/snippets/batchfile\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"batchfile\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/c9search.js",
    "content": "define(\"ace/snippets/c9search\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"c9search\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/c_cpp.js",
    "content": "define(\"ace/snippets/c_cpp\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"## STL Collections\\n# std::array\\nsnippet array\\n\tstd::array<${1:T}, ${2:N}> ${3};${4}\\n# std::vector\\nsnippet vector\\n\tstd::vector<${1:T}> ${2};${3}\\n# std::deque\\nsnippet deque\\n\tstd::deque<${1:T}> ${2};${3}\\n# std::forward_list\\nsnippet flist\\n\tstd::forward_list<${1:T}> ${2};${3}\\n# std::list\\nsnippet list\\n\tstd::list<${1:T}> ${2};${3}\\n# std::set\\nsnippet set\\n\tstd::set<${1:T}> ${2};${3}\\n# std::map\\nsnippet map\\n\tstd::map<${1:Key}, ${2:T}> ${3};${4}\\n# std::multiset\\nsnippet mset\\n\tstd::multiset<${1:T}> ${2};${3}\\n# std::multimap\\nsnippet mmap\\n\tstd::multimap<${1:Key}, ${2:T}> ${3};${4}\\n# std::unordered_set\\nsnippet uset\\n\tstd::unordered_set<${1:T}> ${2};${3}\\n# std::unordered_map\\nsnippet umap\\n\tstd::unordered_map<${1:Key}, ${2:T}> ${3};${4}\\n# std::unordered_multiset\\nsnippet umset\\n\tstd::unordered_multiset<${1:T}> ${2};${3}\\n# std::unordered_multimap\\nsnippet ummap\\n\tstd::unordered_multimap<${1:Key}, ${2:T}> ${3};${4}\\n# std::stack\\nsnippet stack\\n\tstd::stack<${1:T}> ${2};${3}\\n# std::queue\\nsnippet queue\\n\tstd::queue<${1:T}> ${2};${3}\\n# std::priority_queue\\nsnippet pqueue\\n\tstd::priority_queue<${1:T}> ${2};${3}\\n##\\n## Access Modifiers\\n# private\\nsnippet pri\\n\tprivate\\n# protected\\nsnippet pro\\n\tprotected\\n# public\\nsnippet pub\\n\tpublic\\n# friend\\nsnippet fr\\n\tfriend\\n# mutable\\nsnippet mu\\n\tmutable\\n## \\n## Class\\n# class\\nsnippet cl\\n\tclass ${1:`Filename('$1', 'name')`} \\n\t{\\n\tpublic:\\n\t\t$1(${2});\\n\t\t~$1();\\n\\n\tprivate:\\n\t\t${3:/* data */}\\n\t};\\n# member function implementation\\nsnippet mfun\\n\t${4:void} ${1:`Filename('$1', 'ClassName')`}::${2:memberFunction}(${3}) {\\n\t\t${5:/* code */}\\n\t}\\n# namespace\\nsnippet ns\\n\tnamespace ${1:`Filename('', 'my')`} {\\n\t\t${2}\\n\t} /* namespace $1 */\\n##\\n## Input/Output\\n# std::cout\\nsnippet cout\\n\tstd::cout << ${1} << std::endl;${2}\\n# std::cin\\nsnippet cin\\n\tstd::cin >> ${1};${2}\\n##\\n## Iteration\\n# for i \\nsnippet fori\\n\tfor (int ${2:i} = 0; $2 < ${1:count}; $2${3:++}) {\\n\t\t${4:/* code */}\\n\t}${5}\\n\\n# foreach\\nsnippet fore\\n\tfor (${1:auto} ${2:i} : ${3:container}) {\\n\t\t${4:/* code */}\\n\t}${5}\\n# iterator\\nsnippet iter\\n\tfor (${1:std::vector}<${2:type}>::${3:const_iterator} ${4:i} = ${5:container}.begin(); $4 != $5.end(); ++$4) {\\n\t\t${6}\\n\t}${7}\\n\\n# auto iterator\\nsnippet itera\\n\tfor (auto ${1:i} = $1.begin(); $1 != $1.end(); ++$1) {\\n\t\t${2:std::cout << *$1 << std::endl;}\\n\t}${3}\\n##\\n## Lambdas\\n# lamda (one line)\\nsnippet ld\\n\t[${1}](${2}){${3:/* code */}}${4}\\n# lambda (multi-line)\\nsnippet lld\\n\t[${1}](${2}){\\n\t\t${3:/* code */}\\n\t}${4}\\n\",t.scope=\"c_cpp\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/cirru.js",
    "content": "define(\"ace/snippets/cirru\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"cirru\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/clojure.js",
    "content": "define(\"ace/snippets/clojure\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet comm\\n\t(comment\\n\t  ${1}\\n\t  )\\nsnippet condp\\n\t(condp ${1:pred} ${2:expr}\\n\t  ${3})\\nsnippet def\\n\t(def ${1})\\nsnippet defm\\n\t(defmethod ${1:multifn} \"${2:doc-string}\" ${3:dispatch-val} [${4:args}]\\n\t  ${5})\\nsnippet defmm\\n\t(defmulti ${1:name} \"${2:doc-string}\" ${3:dispatch-fn})\\nsnippet defma\\n\t(defmacro ${1:name} \"${2:doc-string}\" ${3:dispatch-fn})\\nsnippet defn\\n\t(defn ${1:name} \"${2:doc-string}\" [${3:arg-list}]\\n\t  ${4})\\nsnippet defp\\n\t(defprotocol ${1:name}\\n\t  ${2})\\nsnippet defr\\n\t(defrecord ${1:name} [${2:fields}]\\n\t  ${3:protocol}\\n\t  ${4})\\nsnippet deft\\n\t(deftest ${1:name}\\n\t    (is (= ${2:assertion})))\\n\t  ${3})\\nsnippet is\\n\t(is (= ${1} ${2}))\\nsnippet defty\\n\t(deftype ${1:Name} [${2:fields}]\\n\t  ${3:Protocol}\\n\t  ${4})\\nsnippet doseq\\n\t(doseq [${1:elem} ${2:coll}]\\n\t  ${3})\\nsnippet fn\\n\t(fn [${1:arg-list}] ${2})\\nsnippet if\\n\t(if ${1:test-expr}\\n\t  ${2:then-expr}\\n\t  ${3:else-expr})\\nsnippet if-let \\n\t(if-let [${1:result} ${2:test-expr}]\\n\t\t(${3:then-expr} $1)\\n\t\t(${4:else-expr}))\\nsnippet imp\\n\t(:import [${1:package}])\\n\t& {:keys [${1:keys}] :or {${2:defaults}}}\\nsnippet let\\n\t(let [${1:name} ${2:expr}]\\n\t\t${3})\\nsnippet letfn\\n\t(letfn [(${1:name) [${2:args}]\\n\t          ${3})])\\nsnippet map\\n\t(map ${1:func} ${2:coll})\\nsnippet mapl\\n\t(map #(${1:lambda}) ${2:coll})\\nsnippet met\\n\t(${1:name} [${2:this} ${3:args}]\\n\t  ${4})\\nsnippet ns\\n\t(ns ${1:name}\\n\t  ${2})\\nsnippet dotimes\\n\t(dotimes [_ 10]\\n\t  (time\\n\t    (dotimes [_ ${1:times}]\\n\t      ${2})))\\nsnippet pmethod\\n\t(${1:name} [${2:this} ${3:args}])\\nsnippet refer\\n\t(:refer-clojure :exclude [${1}])\\nsnippet require\\n\t(:require [${1:namespace} :as [${2}]])\\nsnippet use\\n\t(:use [${1:namespace} :only [${2}]])\\nsnippet print\\n\t(println ${1})\\nsnippet reduce\\n\t(reduce ${1:(fn [p n] ${3})} ${2})\\nsnippet when\\n\t(when ${1:test} ${2:body})\\nsnippet when-let\\n\t(when-let [${1:result} ${2:test}]\\n\t\t${3:body})\\n',t.scope=\"clojure\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/cobol.js",
    "content": "define(\"ace/snippets/cobol\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"cobol\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/coffee.js",
    "content": "define(\"ace/snippets/coffee\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# Closure loop\\nsnippet forindo\\n\tfor ${1:name} in ${2:array}\\n\t\tdo ($1) ->\\n\t\t\t${3:// body}\\n# Array comprehension\\nsnippet fora\\n\tfor ${1:name} in ${2:array}\\n\t\t${3:// body...}\\n# Object comprehension\\nsnippet foro\\n\tfor ${1:key}, ${2:value} of ${3:object}\\n\t\t${4:// body...}\\n# Range comprehension (inclusive)\\nsnippet forr\\n\tfor ${1:name} in [${2:start}..${3:finish}]\\n\t\t${4:// body...}\\nsnippet forrb\\n\tfor ${1:name} in [${2:start}..${3:finish}] by ${4:step}\\n\t\t${5:// body...}\\n# Range comprehension (exclusive)\\nsnippet forrex\\n\tfor ${1:name} in [${2:start}...${3:finish}]\\n\t\t${4:// body...}\\nsnippet forrexb\\n\tfor ${1:name} in [${2:start}...${3:finish}] by ${4:step}\\n\t\t${5:// body...}\\n# Function\\nsnippet fun\\n\t(${1:args}) ->\\n\t\t${2:// body...}\\n# Function (bound)\\nsnippet bfun\\n\t(${1:args}) =>\\n\t\t${2:// body...}\\n# Class\\nsnippet cla class ..\\n\tclass ${1:`substitute(Filename(), '\\\\(_\\\\|^\\\\)\\\\(.\\\\)', '\\\\u\\\\2', 'g')`}\\n\t\t${2}\\nsnippet cla class .. constructor: ..\\n\tclass ${1:`substitute(Filename(), '\\\\(_\\\\|^\\\\)\\\\(.\\\\)', '\\\\u\\\\2', 'g')`}\\n\t\tconstructor: (${2:args}) ->\\n\t\t\t${3}\\n\\n\t\t${4}\\nsnippet cla class .. extends ..\\n\tclass ${1:`substitute(Filename(), '\\\\(_\\\\|^\\\\)\\\\(.\\\\)', '\\\\u\\\\2', 'g')`} extends ${2:ParentClass}\\n\t\t${3}\\nsnippet cla class .. extends .. constructor: ..\\n\tclass ${1:`substitute(Filename(), '\\\\(_\\\\|^\\\\)\\\\(.\\\\)', '\\\\u\\\\2', 'g')`} extends ${2:ParentClass}\\n\t\tconstructor: (${3:args}) ->\\n\t\t\t${4}\\n\\n\t\t${5}\\n# If\\nsnippet if\\n\tif ${1:condition}\\n\t\t${2:// body...}\\n# If __ Else\\nsnippet ife\\n\tif ${1:condition}\\n\t\t${2:// body...}\\n\telse\\n\t\t${3:// body...}\\n# Else if\\nsnippet elif\\n\telse if ${1:condition}\\n\t\t${2:// body...}\\n# Ternary If\\nsnippet ifte\\n\tif ${1:condition} then ${2:value} else ${3:other}\\n# Unless\\nsnippet unl\\n\t${1:action} unless ${2:condition}\\n# Switch\\nsnippet swi\\n\tswitch ${1:object}\\n\t\twhen ${2:value}\\n\t\t\t${3:// body...}\\n\\n# Log\\nsnippet log\\n\tconsole.log ${1}\\n# Try __ Catch\\nsnippet try\\n\ttry\\n\t\t${1}\\n\tcatch ${2:error}\\n\t\t${3}\\n# Require\\nsnippet req\\n\t${2:$1} = require '${1:sys}'${3}\\n# Export\\nsnippet exp\\n\t${1:root} = exports ? this\\n\",t.scope=\"coffee\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/coldfusion.js",
    "content": "define(\"ace/snippets/coldfusion\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"coldfusion\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/csharp.js",
    "content": "define(\"ace/snippets/csharp\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"csharp\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/css.js",
    "content": "define(\"ace/snippets/css\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet .\\n\t${1} {\\n\t\t${2}\\n\t}\\nsnippet !\\n\t !important\\nsnippet bdi:m+\\n\t-moz-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};\\nsnippet bdi:m\\n\t-moz-border-image: ${1};\\nsnippet bdrz:m\\n\t-moz-border-radius: ${1};\\nsnippet bxsh:m+\\n\t-moz-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};\\nsnippet bxsh:m\\n\t-moz-box-shadow: ${1};\\nsnippet bdi:w+\\n\t-webkit-border-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};\\nsnippet bdi:w\\n\t-webkit-border-image: ${1};\\nsnippet bdrz:w\\n\t-webkit-border-radius: ${1};\\nsnippet bxsh:w+\\n\t-webkit-box-shadow: ${1:0} ${2:0} ${3:0} #${4:000};\\nsnippet bxsh:w\\n\t-webkit-box-shadow: ${1};\\nsnippet @f\\n\t@font-face {\\n\t\tfont-family: ${1};\\n\t\tsrc: url(${2});\\n\t}\\nsnippet @i\\n\t@import url(${1});\\nsnippet @m\\n\t@media ${1:print} {\\n\t\t${2}\\n\t}\\nsnippet bg+\\n\tbackground: #${1:FFF} url(${2}) ${3:0} ${4:0} ${5:no-repeat};\\nsnippet bga\\n\tbackground-attachment: ${1};\\nsnippet bga:f\\n\tbackground-attachment: fixed;\\nsnippet bga:s\\n\tbackground-attachment: scroll;\\nsnippet bgbk\\n\tbackground-break: ${1};\\nsnippet bgbk:bb\\n\tbackground-break: bounding-box;\\nsnippet bgbk:c\\n\tbackground-break: continuous;\\nsnippet bgbk:eb\\n\tbackground-break: each-box;\\nsnippet bgcp\\n\tbackground-clip: ${1};\\nsnippet bgcp:bb\\n\tbackground-clip: border-box;\\nsnippet bgcp:cb\\n\tbackground-clip: content-box;\\nsnippet bgcp:nc\\n\tbackground-clip: no-clip;\\nsnippet bgcp:pb\\n\tbackground-clip: padding-box;\\nsnippet bgc\\n\tbackground-color: #${1:FFF};\\nsnippet bgc:t\\n\tbackground-color: transparent;\\nsnippet bgi\\n\tbackground-image: url(${1});\\nsnippet bgi:n\\n\tbackground-image: none;\\nsnippet bgo\\n\tbackground-origin: ${1};\\nsnippet bgo:bb\\n\tbackground-origin: border-box;\\nsnippet bgo:cb\\n\tbackground-origin: content-box;\\nsnippet bgo:pb\\n\tbackground-origin: padding-box;\\nsnippet bgpx\\n\tbackground-position-x: ${1};\\nsnippet bgpy\\n\tbackground-position-y: ${1};\\nsnippet bgp\\n\tbackground-position: ${1:0} ${2:0};\\nsnippet bgr\\n\tbackground-repeat: ${1};\\nsnippet bgr:n\\n\tbackground-repeat: no-repeat;\\nsnippet bgr:x\\n\tbackground-repeat: repeat-x;\\nsnippet bgr:y\\n\tbackground-repeat: repeat-y;\\nsnippet bgr:r\\n\tbackground-repeat: repeat;\\nsnippet bgz\\n\tbackground-size: ${1};\\nsnippet bgz:a\\n\tbackground-size: auto;\\nsnippet bgz:ct\\n\tbackground-size: contain;\\nsnippet bgz:cv\\n\tbackground-size: cover;\\nsnippet bg\\n\tbackground: ${1};\\nsnippet bg:ie\\n\tfilter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='${1}',sizingMethod='${2:crop}');\\nsnippet bg:n\\n\tbackground: none;\\nsnippet bd+\\n\tborder: ${1:1px} ${2:solid} #${3:000};\\nsnippet bdb+\\n\tborder-bottom: ${1:1px} ${2:solid} #${3:000};\\nsnippet bdbc\\n\tborder-bottom-color: #${1:000};\\nsnippet bdbi\\n\tborder-bottom-image: url(${1});\\nsnippet bdbi:n\\n\tborder-bottom-image: none;\\nsnippet bdbli\\n\tborder-bottom-left-image: url(${1});\\nsnippet bdbli:c\\n\tborder-bottom-left-image: continue;\\nsnippet bdbli:n\\n\tborder-bottom-left-image: none;\\nsnippet bdblrz\\n\tborder-bottom-left-radius: ${1};\\nsnippet bdbri\\n\tborder-bottom-right-image: url(${1});\\nsnippet bdbri:c\\n\tborder-bottom-right-image: continue;\\nsnippet bdbri:n\\n\tborder-bottom-right-image: none;\\nsnippet bdbrrz\\n\tborder-bottom-right-radius: ${1};\\nsnippet bdbs\\n\tborder-bottom-style: ${1};\\nsnippet bdbs:n\\n\tborder-bottom-style: none;\\nsnippet bdbw\\n\tborder-bottom-width: ${1};\\nsnippet bdb\\n\tborder-bottom: ${1};\\nsnippet bdb:n\\n\tborder-bottom: none;\\nsnippet bdbk\\n\tborder-break: ${1};\\nsnippet bdbk:c\\n\tborder-break: close;\\nsnippet bdcl\\n\tborder-collapse: ${1};\\nsnippet bdcl:c\\n\tborder-collapse: collapse;\\nsnippet bdcl:s\\n\tborder-collapse: separate;\\nsnippet bdc\\n\tborder-color: #${1:000};\\nsnippet bdci\\n\tborder-corner-image: url(${1});\\nsnippet bdci:c\\n\tborder-corner-image: continue;\\nsnippet bdci:n\\n\tborder-corner-image: none;\\nsnippet bdf\\n\tborder-fit: ${1};\\nsnippet bdf:c\\n\tborder-fit: clip;\\nsnippet bdf:of\\n\tborder-fit: overwrite;\\nsnippet bdf:ow\\n\tborder-fit: overwrite;\\nsnippet bdf:r\\n\tborder-fit: repeat;\\nsnippet bdf:sc\\n\tborder-fit: scale;\\nsnippet bdf:sp\\n\tborder-fit: space;\\nsnippet bdf:st\\n\tborder-fit: stretch;\\nsnippet bdi\\n\tborder-image: url(${1}) ${2:0} ${3:0} ${4:0} ${5:0} ${6:stretch} ${7:stretch};\\nsnippet bdi:n\\n\tborder-image: none;\\nsnippet bdl+\\n\tborder-left: ${1:1px} ${2:solid} #${3:000};\\nsnippet bdlc\\n\tborder-left-color: #${1:000};\\nsnippet bdli\\n\tborder-left-image: url(${1});\\nsnippet bdli:n\\n\tborder-left-image: none;\\nsnippet bdls\\n\tborder-left-style: ${1};\\nsnippet bdls:n\\n\tborder-left-style: none;\\nsnippet bdlw\\n\tborder-left-width: ${1};\\nsnippet bdl\\n\tborder-left: ${1};\\nsnippet bdl:n\\n\tborder-left: none;\\nsnippet bdlt\\n\tborder-length: ${1};\\nsnippet bdlt:a\\n\tborder-length: auto;\\nsnippet bdrz\\n\tborder-radius: ${1};\\nsnippet bdr+\\n\tborder-right: ${1:1px} ${2:solid} #${3:000};\\nsnippet bdrc\\n\tborder-right-color: #${1:000};\\nsnippet bdri\\n\tborder-right-image: url(${1});\\nsnippet bdri:n\\n\tborder-right-image: none;\\nsnippet bdrs\\n\tborder-right-style: ${1};\\nsnippet bdrs:n\\n\tborder-right-style: none;\\nsnippet bdrw\\n\tborder-right-width: ${1};\\nsnippet bdr\\n\tborder-right: ${1};\\nsnippet bdr:n\\n\tborder-right: none;\\nsnippet bdsp\\n\tborder-spacing: ${1};\\nsnippet bds\\n\tborder-style: ${1};\\nsnippet bds:ds\\n\tborder-style: dashed;\\nsnippet bds:dtds\\n\tborder-style: dot-dash;\\nsnippet bds:dtdtds\\n\tborder-style: dot-dot-dash;\\nsnippet bds:dt\\n\tborder-style: dotted;\\nsnippet bds:db\\n\tborder-style: double;\\nsnippet bds:g\\n\tborder-style: groove;\\nsnippet bds:h\\n\tborder-style: hidden;\\nsnippet bds:i\\n\tborder-style: inset;\\nsnippet bds:n\\n\tborder-style: none;\\nsnippet bds:o\\n\tborder-style: outset;\\nsnippet bds:r\\n\tborder-style: ridge;\\nsnippet bds:s\\n\tborder-style: solid;\\nsnippet bds:w\\n\tborder-style: wave;\\nsnippet bdt+\\n\tborder-top: ${1:1px} ${2:solid} #${3:000};\\nsnippet bdtc\\n\tborder-top-color: #${1:000};\\nsnippet bdti\\n\tborder-top-image: url(${1});\\nsnippet bdti:n\\n\tborder-top-image: none;\\nsnippet bdtli\\n\tborder-top-left-image: url(${1});\\nsnippet bdtli:c\\n\tborder-corner-image: continue;\\nsnippet bdtli:n\\n\tborder-corner-image: none;\\nsnippet bdtlrz\\n\tborder-top-left-radius: ${1};\\nsnippet bdtri\\n\tborder-top-right-image: url(${1});\\nsnippet bdtri:c\\n\tborder-top-right-image: continue;\\nsnippet bdtri:n\\n\tborder-top-right-image: none;\\nsnippet bdtrrz\\n\tborder-top-right-radius: ${1};\\nsnippet bdts\\n\tborder-top-style: ${1};\\nsnippet bdts:n\\n\tborder-top-style: none;\\nsnippet bdtw\\n\tborder-top-width: ${1};\\nsnippet bdt\\n\tborder-top: ${1};\\nsnippet bdt:n\\n\tborder-top: none;\\nsnippet bdw\\n\tborder-width: ${1};\\nsnippet bd\\n\tborder: ${1};\\nsnippet bd:n\\n\tborder: none;\\nsnippet b\\n\tbottom: ${1};\\nsnippet b:a\\n\tbottom: auto;\\nsnippet bxsh+\\n\tbox-shadow: ${1:0} ${2:0} ${3:0} #${4:000};\\nsnippet bxsh\\n\tbox-shadow: ${1};\\nsnippet bxsh:n\\n\tbox-shadow: none;\\nsnippet bxz\\n\tbox-sizing: ${1};\\nsnippet bxz:bb\\n\tbox-sizing: border-box;\\nsnippet bxz:cb\\n\tbox-sizing: content-box;\\nsnippet cps\\n\tcaption-side: ${1};\\nsnippet cps:b\\n\tcaption-side: bottom;\\nsnippet cps:t\\n\tcaption-side: top;\\nsnippet cl\\n\tclear: ${1};\\nsnippet cl:b\\n\tclear: both;\\nsnippet cl:l\\n\tclear: left;\\nsnippet cl:n\\n\tclear: none;\\nsnippet cl:r\\n\tclear: right;\\nsnippet cp\\n\tclip: ${1};\\nsnippet cp:a\\n\tclip: auto;\\nsnippet cp:r\\n\tclip: rect(${1:0} ${2:0} ${3:0} ${4:0});\\nsnippet c\\n\tcolor: #${1:000};\\nsnippet ct\\n\tcontent: ${1};\\nsnippet ct:a\\n\tcontent: attr(${1});\\nsnippet ct:cq\\n\tcontent: close-quote;\\nsnippet ct:c\\n\tcontent: counter(${1});\\nsnippet ct:cs\\n\tcontent: counters(${1});\\nsnippet ct:ncq\\n\tcontent: no-close-quote;\\nsnippet ct:noq\\n\tcontent: no-open-quote;\\nsnippet ct:n\\n\tcontent: normal;\\nsnippet ct:oq\\n\tcontent: open-quote;\\nsnippet coi\\n\tcounter-increment: ${1};\\nsnippet cor\\n\tcounter-reset: ${1};\\nsnippet cur\\n\tcursor: ${1};\\nsnippet cur:a\\n\tcursor: auto;\\nsnippet cur:c\\n\tcursor: crosshair;\\nsnippet cur:d\\n\tcursor: default;\\nsnippet cur:ha\\n\tcursor: hand;\\nsnippet cur:he\\n\tcursor: help;\\nsnippet cur:m\\n\tcursor: move;\\nsnippet cur:p\\n\tcursor: pointer;\\nsnippet cur:t\\n\tcursor: text;\\nsnippet d\\n\tdisplay: ${1};\\nsnippet d:mib\\n\tdisplay: -moz-inline-box;\\nsnippet d:mis\\n\tdisplay: -moz-inline-stack;\\nsnippet d:b\\n\tdisplay: block;\\nsnippet d:cp\\n\tdisplay: compact;\\nsnippet d:ib\\n\tdisplay: inline-block;\\nsnippet d:itb\\n\tdisplay: inline-table;\\nsnippet d:i\\n\tdisplay: inline;\\nsnippet d:li\\n\tdisplay: list-item;\\nsnippet d:n\\n\tdisplay: none;\\nsnippet d:ri\\n\tdisplay: run-in;\\nsnippet d:tbcp\\n\tdisplay: table-caption;\\nsnippet d:tbc\\n\tdisplay: table-cell;\\nsnippet d:tbclg\\n\tdisplay: table-column-group;\\nsnippet d:tbcl\\n\tdisplay: table-column;\\nsnippet d:tbfg\\n\tdisplay: table-footer-group;\\nsnippet d:tbhg\\n\tdisplay: table-header-group;\\nsnippet d:tbrg\\n\tdisplay: table-row-group;\\nsnippet d:tbr\\n\tdisplay: table-row;\\nsnippet d:tb\\n\tdisplay: table;\\nsnippet ec\\n\tempty-cells: ${1};\\nsnippet ec:h\\n\tempty-cells: hide;\\nsnippet ec:s\\n\tempty-cells: show;\\nsnippet exp\\n\texpression()\\nsnippet fl\\n\tfloat: ${1};\\nsnippet fl:l\\n\tfloat: left;\\nsnippet fl:n\\n\tfloat: none;\\nsnippet fl:r\\n\tfloat: right;\\nsnippet f+\\n\tfont: ${1:1em} ${2:Arial},${3:sans-serif};\\nsnippet fef\\n\tfont-effect: ${1};\\nsnippet fef:eb\\n\tfont-effect: emboss;\\nsnippet fef:eg\\n\tfont-effect: engrave;\\nsnippet fef:n\\n\tfont-effect: none;\\nsnippet fef:o\\n\tfont-effect: outline;\\nsnippet femp\\n\tfont-emphasize-position: ${1};\\nsnippet femp:a\\n\tfont-emphasize-position: after;\\nsnippet femp:b\\n\tfont-emphasize-position: before;\\nsnippet fems\\n\tfont-emphasize-style: ${1};\\nsnippet fems:ac\\n\tfont-emphasize-style: accent;\\nsnippet fems:c\\n\tfont-emphasize-style: circle;\\nsnippet fems:ds\\n\tfont-emphasize-style: disc;\\nsnippet fems:dt\\n\tfont-emphasize-style: dot;\\nsnippet fems:n\\n\tfont-emphasize-style: none;\\nsnippet fem\\n\tfont-emphasize: ${1};\\nsnippet ff\\n\tfont-family: ${1};\\nsnippet ff:c\\n\tfont-family: ${1:'Monotype Corsiva','Comic Sans MS'},cursive;\\nsnippet ff:f\\n\tfont-family: ${1:Capitals,Impact},fantasy;\\nsnippet ff:m\\n\tfont-family: ${1:Monaco,'Courier New'},monospace;\\nsnippet ff:ss\\n\tfont-family: ${1:Helvetica,Arial},sans-serif;\\nsnippet ff:s\\n\tfont-family: ${1:Georgia,'Times New Roman'},serif;\\nsnippet fza\\n\tfont-size-adjust: ${1};\\nsnippet fza:n\\n\tfont-size-adjust: none;\\nsnippet fz\\n\tfont-size: ${1};\\nsnippet fsm\\n\tfont-smooth: ${1};\\nsnippet fsm:aw\\n\tfont-smooth: always;\\nsnippet fsm:a\\n\tfont-smooth: auto;\\nsnippet fsm:n\\n\tfont-smooth: never;\\nsnippet fst\\n\tfont-stretch: ${1};\\nsnippet fst:c\\n\tfont-stretch: condensed;\\nsnippet fst:e\\n\tfont-stretch: expanded;\\nsnippet fst:ec\\n\tfont-stretch: extra-condensed;\\nsnippet fst:ee\\n\tfont-stretch: extra-expanded;\\nsnippet fst:n\\n\tfont-stretch: normal;\\nsnippet fst:sc\\n\tfont-stretch: semi-condensed;\\nsnippet fst:se\\n\tfont-stretch: semi-expanded;\\nsnippet fst:uc\\n\tfont-stretch: ultra-condensed;\\nsnippet fst:ue\\n\tfont-stretch: ultra-expanded;\\nsnippet fs\\n\tfont-style: ${1};\\nsnippet fs:i\\n\tfont-style: italic;\\nsnippet fs:n\\n\tfont-style: normal;\\nsnippet fs:o\\n\tfont-style: oblique;\\nsnippet fv\\n\tfont-variant: ${1};\\nsnippet fv:n\\n\tfont-variant: normal;\\nsnippet fv:sc\\n\tfont-variant: small-caps;\\nsnippet fw\\n\tfont-weight: ${1};\\nsnippet fw:b\\n\tfont-weight: bold;\\nsnippet fw:br\\n\tfont-weight: bolder;\\nsnippet fw:lr\\n\tfont-weight: lighter;\\nsnippet fw:n\\n\tfont-weight: normal;\\nsnippet f\\n\tfont: ${1};\\nsnippet h\\n\theight: ${1};\\nsnippet h:a\\n\theight: auto;\\nsnippet l\\n\tleft: ${1};\\nsnippet l:a\\n\tleft: auto;\\nsnippet lts\\n\tletter-spacing: ${1};\\nsnippet lh\\n\tline-height: ${1};\\nsnippet lisi\\n\tlist-style-image: url(${1});\\nsnippet lisi:n\\n\tlist-style-image: none;\\nsnippet lisp\\n\tlist-style-position: ${1};\\nsnippet lisp:i\\n\tlist-style-position: inside;\\nsnippet lisp:o\\n\tlist-style-position: outside;\\nsnippet list\\n\tlist-style-type: ${1};\\nsnippet list:c\\n\tlist-style-type: circle;\\nsnippet list:dclz\\n\tlist-style-type: decimal-leading-zero;\\nsnippet list:dc\\n\tlist-style-type: decimal;\\nsnippet list:d\\n\tlist-style-type: disc;\\nsnippet list:lr\\n\tlist-style-type: lower-roman;\\nsnippet list:n\\n\tlist-style-type: none;\\nsnippet list:s\\n\tlist-style-type: square;\\nsnippet list:ur\\n\tlist-style-type: upper-roman;\\nsnippet lis\\n\tlist-style: ${1};\\nsnippet lis:n\\n\tlist-style: none;\\nsnippet mb\\n\tmargin-bottom: ${1};\\nsnippet mb:a\\n\tmargin-bottom: auto;\\nsnippet ml\\n\tmargin-left: ${1};\\nsnippet ml:a\\n\tmargin-left: auto;\\nsnippet mr\\n\tmargin-right: ${1};\\nsnippet mr:a\\n\tmargin-right: auto;\\nsnippet mt\\n\tmargin-top: ${1};\\nsnippet mt:a\\n\tmargin-top: auto;\\nsnippet m\\n\tmargin: ${1};\\nsnippet m:4\\n\tmargin: ${1:0} ${2:0} ${3:0} ${4:0};\\nsnippet m:3\\n\tmargin: ${1:0} ${2:0} ${3:0};\\nsnippet m:2\\n\tmargin: ${1:0} ${2:0};\\nsnippet m:0\\n\tmargin: 0;\\nsnippet m:a\\n\tmargin: auto;\\nsnippet mah\\n\tmax-height: ${1};\\nsnippet mah:n\\n\tmax-height: none;\\nsnippet maw\\n\tmax-width: ${1};\\nsnippet maw:n\\n\tmax-width: none;\\nsnippet mih\\n\tmin-height: ${1};\\nsnippet miw\\n\tmin-width: ${1};\\nsnippet op\\n\topacity: ${1};\\nsnippet op:ie\\n\tfilter: progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100});\\nsnippet op:ms\\n\t-ms-filter: 'progid:DXImageTransform.Microsoft.Alpha(Opacity=${1:100})';\\nsnippet orp\\n\torphans: ${1};\\nsnippet o+\\n\toutline: ${1:1px} ${2:solid} #${3:000};\\nsnippet oc\\n\toutline-color: ${1:#000};\\nsnippet oc:i\\n\toutline-color: invert;\\nsnippet oo\\n\toutline-offset: ${1};\\nsnippet os\\n\toutline-style: ${1};\\nsnippet ow\\n\toutline-width: ${1};\\nsnippet o\\n\toutline: ${1};\\nsnippet o:n\\n\toutline: none;\\nsnippet ovs\\n\toverflow-style: ${1};\\nsnippet ovs:a\\n\toverflow-style: auto;\\nsnippet ovs:mq\\n\toverflow-style: marquee;\\nsnippet ovs:mv\\n\toverflow-style: move;\\nsnippet ovs:p\\n\toverflow-style: panner;\\nsnippet ovs:s\\n\toverflow-style: scrollbar;\\nsnippet ovx\\n\toverflow-x: ${1};\\nsnippet ovx:a\\n\toverflow-x: auto;\\nsnippet ovx:h\\n\toverflow-x: hidden;\\nsnippet ovx:s\\n\toverflow-x: scroll;\\nsnippet ovx:v\\n\toverflow-x: visible;\\nsnippet ovy\\n\toverflow-y: ${1};\\nsnippet ovy:a\\n\toverflow-y: auto;\\nsnippet ovy:h\\n\toverflow-y: hidden;\\nsnippet ovy:s\\n\toverflow-y: scroll;\\nsnippet ovy:v\\n\toverflow-y: visible;\\nsnippet ov\\n\toverflow: ${1};\\nsnippet ov:a\\n\toverflow: auto;\\nsnippet ov:h\\n\toverflow: hidden;\\nsnippet ov:s\\n\toverflow: scroll;\\nsnippet ov:v\\n\toverflow: visible;\\nsnippet pb\\n\tpadding-bottom: ${1};\\nsnippet pl\\n\tpadding-left: ${1};\\nsnippet pr\\n\tpadding-right: ${1};\\nsnippet pt\\n\tpadding-top: ${1};\\nsnippet p\\n\tpadding: ${1};\\nsnippet p:4\\n\tpadding: ${1:0} ${2:0} ${3:0} ${4:0};\\nsnippet p:3\\n\tpadding: ${1:0} ${2:0} ${3:0};\\nsnippet p:2\\n\tpadding: ${1:0} ${2:0};\\nsnippet p:0\\n\tpadding: 0;\\nsnippet pgba\\n\tpage-break-after: ${1};\\nsnippet pgba:aw\\n\tpage-break-after: always;\\nsnippet pgba:a\\n\tpage-break-after: auto;\\nsnippet pgba:l\\n\tpage-break-after: left;\\nsnippet pgba:r\\n\tpage-break-after: right;\\nsnippet pgbb\\n\tpage-break-before: ${1};\\nsnippet pgbb:aw\\n\tpage-break-before: always;\\nsnippet pgbb:a\\n\tpage-break-before: auto;\\nsnippet pgbb:l\\n\tpage-break-before: left;\\nsnippet pgbb:r\\n\tpage-break-before: right;\\nsnippet pgbi\\n\tpage-break-inside: ${1};\\nsnippet pgbi:a\\n\tpage-break-inside: auto;\\nsnippet pgbi:av\\n\tpage-break-inside: avoid;\\nsnippet pos\\n\tposition: ${1};\\nsnippet pos:a\\n\tposition: absolute;\\nsnippet pos:f\\n\tposition: fixed;\\nsnippet pos:r\\n\tposition: relative;\\nsnippet pos:s\\n\tposition: static;\\nsnippet q\\n\tquotes: ${1};\\nsnippet q:en\\n\tquotes: '\\\\201C' '\\\\201D' '\\\\2018' '\\\\2019';\\nsnippet q:n\\n\tquotes: none;\\nsnippet q:ru\\n\tquotes: '\\\\00AB' '\\\\00BB' '\\\\201E' '\\\\201C';\\nsnippet rz\\n\tresize: ${1};\\nsnippet rz:b\\n\tresize: both;\\nsnippet rz:h\\n\tresize: horizontal;\\nsnippet rz:n\\n\tresize: none;\\nsnippet rz:v\\n\tresize: vertical;\\nsnippet r\\n\tright: ${1};\\nsnippet r:a\\n\tright: auto;\\nsnippet tbl\\n\ttable-layout: ${1};\\nsnippet tbl:a\\n\ttable-layout: auto;\\nsnippet tbl:f\\n\ttable-layout: fixed;\\nsnippet tal\\n\ttext-align-last: ${1};\\nsnippet tal:a\\n\ttext-align-last: auto;\\nsnippet tal:c\\n\ttext-align-last: center;\\nsnippet tal:l\\n\ttext-align-last: left;\\nsnippet tal:r\\n\ttext-align-last: right;\\nsnippet ta\\n\ttext-align: ${1};\\nsnippet ta:c\\n\ttext-align: center;\\nsnippet ta:l\\n\ttext-align: left;\\nsnippet ta:r\\n\ttext-align: right;\\nsnippet td\\n\ttext-decoration: ${1};\\nsnippet td:l\\n\ttext-decoration: line-through;\\nsnippet td:n\\n\ttext-decoration: none;\\nsnippet td:o\\n\ttext-decoration: overline;\\nsnippet td:u\\n\ttext-decoration: underline;\\nsnippet te\\n\ttext-emphasis: ${1};\\nsnippet te:ac\\n\ttext-emphasis: accent;\\nsnippet te:a\\n\ttext-emphasis: after;\\nsnippet te:b\\n\ttext-emphasis: before;\\nsnippet te:c\\n\ttext-emphasis: circle;\\nsnippet te:ds\\n\ttext-emphasis: disc;\\nsnippet te:dt\\n\ttext-emphasis: dot;\\nsnippet te:n\\n\ttext-emphasis: none;\\nsnippet th\\n\ttext-height: ${1};\\nsnippet th:a\\n\ttext-height: auto;\\nsnippet th:f\\n\ttext-height: font-size;\\nsnippet th:m\\n\ttext-height: max-size;\\nsnippet th:t\\n\ttext-height: text-size;\\nsnippet ti\\n\ttext-indent: ${1};\\nsnippet ti:-\\n\ttext-indent: -9999px;\\nsnippet tj\\n\ttext-justify: ${1};\\nsnippet tj:a\\n\ttext-justify: auto;\\nsnippet tj:d\\n\ttext-justify: distribute;\\nsnippet tj:ic\\n\ttext-justify: inter-cluster;\\nsnippet tj:ii\\n\ttext-justify: inter-ideograph;\\nsnippet tj:iw\\n\ttext-justify: inter-word;\\nsnippet tj:k\\n\ttext-justify: kashida;\\nsnippet tj:t\\n\ttext-justify: tibetan;\\nsnippet to+\\n\ttext-outline: ${1:0} ${2:0} #${3:000};\\nsnippet to\\n\ttext-outline: ${1};\\nsnippet to:n\\n\ttext-outline: none;\\nsnippet tr\\n\ttext-replace: ${1};\\nsnippet tr:n\\n\ttext-replace: none;\\nsnippet tsh+\\n\ttext-shadow: ${1:0} ${2:0} ${3:0} #${4:000};\\nsnippet tsh\\n\ttext-shadow: ${1};\\nsnippet tsh:n\\n\ttext-shadow: none;\\nsnippet tt\\n\ttext-transform: ${1};\\nsnippet tt:c\\n\ttext-transform: capitalize;\\nsnippet tt:l\\n\ttext-transform: lowercase;\\nsnippet tt:n\\n\ttext-transform: none;\\nsnippet tt:u\\n\ttext-transform: uppercase;\\nsnippet tw\\n\ttext-wrap: ${1};\\nsnippet tw:no\\n\ttext-wrap: none;\\nsnippet tw:n\\n\ttext-wrap: normal;\\nsnippet tw:s\\n\ttext-wrap: suppress;\\nsnippet tw:u\\n\ttext-wrap: unrestricted;\\nsnippet t\\n\ttop: ${1};\\nsnippet t:a\\n\ttop: auto;\\nsnippet va\\n\tvertical-align: ${1};\\nsnippet va:bl\\n\tvertical-align: baseline;\\nsnippet va:b\\n\tvertical-align: bottom;\\nsnippet va:m\\n\tvertical-align: middle;\\nsnippet va:sub\\n\tvertical-align: sub;\\nsnippet va:sup\\n\tvertical-align: super;\\nsnippet va:tb\\n\tvertical-align: text-bottom;\\nsnippet va:tt\\n\tvertical-align: text-top;\\nsnippet va:t\\n\tvertical-align: top;\\nsnippet v\\n\tvisibility: ${1};\\nsnippet v:c\\n\tvisibility: collapse;\\nsnippet v:h\\n\tvisibility: hidden;\\nsnippet v:v\\n\tvisibility: visible;\\nsnippet whsc\\n\twhite-space-collapse: ${1};\\nsnippet whsc:ba\\n\twhite-space-collapse: break-all;\\nsnippet whsc:bs\\n\twhite-space-collapse: break-strict;\\nsnippet whsc:k\\n\twhite-space-collapse: keep-all;\\nsnippet whsc:l\\n\twhite-space-collapse: loose;\\nsnippet whsc:n\\n\twhite-space-collapse: normal;\\nsnippet whs\\n\twhite-space: ${1};\\nsnippet whs:n\\n\twhite-space: normal;\\nsnippet whs:nw\\n\twhite-space: nowrap;\\nsnippet whs:pl\\n\twhite-space: pre-line;\\nsnippet whs:pw\\n\twhite-space: pre-wrap;\\nsnippet whs:p\\n\twhite-space: pre;\\nsnippet wid\\n\twidows: ${1};\\nsnippet w\\n\twidth: ${1};\\nsnippet w:a\\n\twidth: auto;\\nsnippet wob\\n\tword-break: ${1};\\nsnippet wob:ba\\n\tword-break: break-all;\\nsnippet wob:bs\\n\tword-break: break-strict;\\nsnippet wob:k\\n\tword-break: keep-all;\\nsnippet wob:l\\n\tword-break: loose;\\nsnippet wob:n\\n\tword-break: normal;\\nsnippet wos\\n\tword-spacing: ${1};\\nsnippet wow\\n\tword-wrap: ${1};\\nsnippet wow:no\\n\tword-wrap: none;\\nsnippet wow:n\\n\tword-wrap: normal;\\nsnippet wow:s\\n\tword-wrap: suppress;\\nsnippet wow:u\\n\tword-wrap: unrestricted;\\nsnippet z\\n\tz-index: ${1};\\nsnippet z:a\\n\tz-index: auto;\\nsnippet zoo\\n\tzoom: 1;\\n\",t.scope=\"css\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/curly.js",
    "content": "define(\"ace/snippets/curly\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"curly\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/d.js",
    "content": "define(\"ace/snippets/d\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"d\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/dart.js",
    "content": "define(\"ace/snippets/dart\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet lib\\n\tlibrary ${1};\\n\t${2}\\nsnippet im\\n\timport '${1}';\\n\t${2}\\nsnippet pa\\n\tpart '${1}';\\n\t${2}\\nsnippet pao\\n\tpart of ${1};\\n\t${2}\\nsnippet main\\n\tvoid main() {\\n\t  ${1:/* code */}\\n\t}\\nsnippet st\\n\tstatic ${1}\\nsnippet fi\\n\tfinal ${1}\\nsnippet re\\n\treturn ${1}\\nsnippet br\\n\tbreak;\\nsnippet th\\n\tthrow ${1}\\nsnippet cl\\n\tclass ${1:`Filename(\\\"\\\", \\\"untitled\\\")`} ${2}\\nsnippet imp\\n\timplements ${1}\\nsnippet ext\\n\textends ${1}\\nsnippet if\\n\tif (${1:true}) {\\n\t  ${2}\\n\t}\\nsnippet ife\\n\tif (${1:true}) {\\n\t  ${2}\\n\t} else {\\n\t  ${3}\\n\t}\\nsnippet el\\n\telse\\nsnippet sw\\n\tswitch (${1}) {\\n\t  ${2}\\n\t}\\nsnippet cs\\n\tcase ${1}:\\n\t  ${2}\\nsnippet de\\n\tdefault:\\n\t  ${1}\\nsnippet for\\n\tfor (var ${2:i} = 0, len = ${1:things}.length; $2 < len; ${3:++}$2) {\\n\t  ${4:$1[$2]}\\n\t}\\nsnippet fore\\n\tfor (final ${2:item} in ${1:itemList}) {\\n\t  ${3:/* code */}\\n\t}\\nsnippet wh\\n\twhile (${1:/* condition */}) {\\n\t  ${2:/* code */}\\n\t}\\nsnippet dowh\\n\tdo {\\n\t  ${2:/* code */}\\n\t} while (${1:/* condition */});\\nsnippet as\\n\tassert(${1:/* condition */});\\nsnippet try\\n\ttry {\\n\t  ${2}\\n\t} catch (${1:Exception e}) {\\n\t}\\nsnippet tryf\\n\ttry {\\n\t  ${2}\\n\t} catch (${1:Exception e}) {\\n\t} finally {\\n\t}\\n\",t.scope=\"dart\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/diff.js",
    "content": "define(\"ace/snippets/diff\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# DEP-3 (http://dep.debian.net/deps/dep3/) style patch header\\nsnippet header DEP-3 style header\\n\tDescription: ${1}\\n\tOrigin: ${2:vendor|upstream|other}, ${3:url of the original patch}\\n\tBug: ${4:url in upstream bugtracker}\\n\tForwarded: ${5:no|not-needed|url}\\n\tAuthor: ${6:`g:snips_author`}\\n\tReviewed-by: ${7:name and email}\\n\tLast-Update: ${8:`strftime(\"%Y-%m-%d\")`}\\n\tApplied-Upstream: ${9:upstream version|url|commit}\\n\\n',t.scope=\"diff\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/django.js",
    "content": "define(\"ace/snippets/django\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# Model Fields\\n\\n# Note: Optional arguments are using defaults that match what Django will use\\n# as a default, e.g. with max_length fields.  Doing this as a form of self\\n# documentation and to make it easy to know whether you should override the\\n# default or not.\\n\\n# Note: Optional arguments that are booleans will use the opposite since you\\n# can either not specify them, or override them, e.g. auto_now_add=False.\\n\\nsnippet auto\\n\t${1:FIELDNAME} = models.AutoField(${2})\\nsnippet bool\\n\t${1:FIELDNAME} = models.BooleanField(${2:default=True})\\nsnippet char\\n\t${1:FIELDNAME} = models.CharField(max_length=${2}${3:, blank=True})\\nsnippet comma\\n\t${1:FIELDNAME} = models.CommaSeparatedIntegerField(max_length=${2}${3:, blank=True})\\nsnippet date\\n\t${1:FIELDNAME} = models.DateField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})\\nsnippet datetime\\n\t${1:FIELDNAME} = models.DateTimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})\\nsnippet decimal\\n\t${1:FIELDNAME} = models.DecimalField(max_digits=${2}, decimal_places=${3})\\nsnippet email\\n\t${1:FIELDNAME} = models.EmailField(max_length=${2:75}${3:, blank=True})\\nsnippet file\\n\t${1:FIELDNAME} = models.FileField(upload_to=${2:path/for/upload}${3:, max_length=100})\\nsnippet filepath\\n\t${1:FIELDNAME} = models.FilePathField(path=${2:\\\"/abs/path/to/dir\\\"}${3:, max_length=100}${4:, match=\\\"*.ext\\\"}${5:, recursive=True}${6:, blank=True, })\\nsnippet float\\n\t${1:FIELDNAME} = models.FloatField(${2})\\nsnippet image\\n\t${1:FIELDNAME} = models.ImageField(upload_to=${2:path/for/upload}${3:, height_field=height, width_field=width}${4:, max_length=100})\\nsnippet int\\n\t${1:FIELDNAME} = models.IntegerField(${2})\\nsnippet ip\\n\t${1:FIELDNAME} = models.IPAddressField(${2})\\nsnippet nullbool\\n\t${1:FIELDNAME} = models.NullBooleanField(${2})\\nsnippet posint\\n\t${1:FIELDNAME} = models.PositiveIntegerField(${2})\\nsnippet possmallint\\n\t${1:FIELDNAME} = models.PositiveSmallIntegerField(${2})\\nsnippet slug\\n\t${1:FIELDNAME} = models.SlugField(max_length=${2:50}${3:, blank=True})\\nsnippet smallint\\n\t${1:FIELDNAME} = models.SmallIntegerField(${2})\\nsnippet text\\n\t${1:FIELDNAME} = models.TextField(${2:blank=True})\\nsnippet time\\n\t${1:FIELDNAME} = models.TimeField(${2:auto_now_add=True, auto_now=True}${3:, blank=True, null=True})\\nsnippet url\\n\t${1:FIELDNAME} = models.URLField(${2:verify_exists=False}${3:, max_length=200}${4:, blank=True})\\nsnippet xml\\n\t${1:FIELDNAME} = models.XMLField(schema_path=${2:None}${3:, blank=True})\\n# Relational Fields\\nsnippet fk\\n\t${1:FIELDNAME} = models.ForeignKey(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, to_field=''})\\nsnippet m2m\\n\t${1:FIELDNAME} = models.ManyToManyField(${2:OtherModel}${3:, related_name=''}${4:, limit_choices_to=}${5:, symmetrical=False}${6:, through=''}${7:, db_table=''})\\nsnippet o2o\\n\t${1:FIELDNAME} = models.OneToOneField(${2:OtherModel}${3:, parent_link=True}${4:, related_name=''}${5:, limit_choices_to=}${6:, to_field=''})\\n\\n# Code Skeletons\\n\\nsnippet form\\n\tclass ${1:FormName}(forms.Form):\\n\t\t\\\"\\\"\\\"${2:docstring}\\\"\\\"\\\"\\n\t\t${3}\\n\\nsnippet model\\n\tclass ${1:ModelName}(models.Model):\\n\t\t\\\"\\\"\\\"${2:docstring}\\\"\\\"\\\"\\n\t\t${3}\\n\t\t\\n\t\tclass Meta:\\n\t\t\t${4}\\n\t\t\\n\t\tdef __unicode__(self):\\n\t\t\t${5}\\n\t\t\\n\t\tdef save(self, force_insert=False, force_update=False):\\n\t\t\t${6}\\n\t\t\\n\t\t@models.permalink\\n\t\tdef get_absolute_url(self):\\n\t\t\treturn ('${7:view_or_url_name}' ${8})\\n\\nsnippet modeladmin\\n\tclass ${1:ModelName}Admin(admin.ModelAdmin):\\n\t\t${2}\\n\t\\n\tadmin.site.register($1, $1Admin)\\n\t\\nsnippet tabularinline\\n\tclass ${1:ModelName}Inline(admin.TabularInline):\\n\t\tmodel = $1\\n\\nsnippet stackedinline\\n\tclass ${1:ModelName}Inline(admin.StackedInline):\\n\t\tmodel = $1\\n\\nsnippet r2r\\n\treturn render_to_response('${1:template.html}', {\\n\t\t\t${2}\\n\t\t}${3:, context_instance=RequestContext(request)}\\n\t)\\n\",t.scope=\"django\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/dockerfile.js",
    "content": "define(\"ace/snippets/dockerfile\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"dockerfile\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/dot.js",
    "content": "define(\"ace/snippets/dot\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"dot\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ejs.js",
    "content": "define(\"ace/snippets/ejs\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"ejs\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/erlang.js",
    "content": "define(\"ace/snippets/erlang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# module and export all\\nsnippet mod\\n\t-module(${1:`Filename('', 'my')`}).\\n\t\\n\t-compile([export_all]).\\n\t\\n\tstart() ->\\n\t    ${2}\\n\t\\n\tstop() ->\\n\t    ok.\\n# define directive\\nsnippet def\\n\t-define(${1:macro}, ${2:body}).${3}\\n# export directive\\nsnippet exp\\n\t-export([${1:function}/${2:arity}]).\\n# include directive\\nsnippet inc\\n\t-include(\\\"${1:file}\\\").${2}\\n# behavior directive\\nsnippet beh\\n\t-behaviour(${1:behaviour}).${2}\\n# if expression\\nsnippet if\\n\tif\\n\t    ${1:guard} ->\\n\t        ${2:body}\\n\tend\\n# case expression\\nsnippet case\\n\tcase ${1:expression} of\\n\t    ${2:pattern} ->\\n\t        ${3:body};\\n\tend\\n# anonymous function\\nsnippet fun\\n\tfun (${1:Parameters}) -> ${2:body} end${3}\\n# try...catch\\nsnippet try\\n\ttry\\n\t    ${1}\\n\tcatch\\n\t    ${2:_:_} -> ${3:got_some_exception}\\n\tend\\n# record directive\\nsnippet rec\\n\t-record(${1:record}, {\\n\t    ${2:field}=${3:value}}).${4}\\n# todo comment\\nsnippet todo\\n\t%% TODO: ${1}\\n## Snippets below (starting with '%') are in EDoc format.\\n## See http://www.erlang.org/doc/apps/edoc/chapter.html#id56887 for more details\\n# doc comment\\nsnippet %d\\n\t%% @doc ${1}\\n# end of doc comment\\nsnippet %e\\n\t%% @end\\n# specification comment\\nsnippet %s\\n\t%% @spec ${1}\\n# private function marker\\nsnippet %p\\n\t%% @private\\n# OTP application\\nsnippet application\\n\t-module(${1:`Filename('', 'my')`}).\\n\\n\t-behaviour(application).\\n\\n\t-export([start/2, stop/1]).\\n\\n\tstart(_Type, _StartArgs) ->\\n\t    case ${2:root_supervisor}:start_link() of\\n\t        {ok, Pid} ->\\n\t            {ok, Pid};\\n\t        Other ->\\n\t\t          {error, Other}\\n\t    end.\\n\\n\tstop(_State) ->\\n\t    ok.\t\\n# OTP supervisor\\nsnippet supervisor\\n\t-module(${1:`Filename('', 'my')`}).\\n\\n\t-behaviour(supervisor).\\n\\n\t%% API\\n\t-export([start_link/0]).\\n\\n\t%% Supervisor callbacks\\n\t-export([init/1]).\\n\\n\t-define(SERVER, ?MODULE).\\n\\n\tstart_link() ->\\n\t    supervisor:start_link({local, ?SERVER}, ?MODULE, []).\\n\\n\tinit([]) ->\\n\t    Server = {${2:my_server}, {$2, start_link, []},\\n\t      permanent, 2000, worker, [$2]},\\n\t    Children = [Server],\\n\t    RestartStrategy = {one_for_one, 0, 1},\\n\t    {ok, {RestartStrategy, Children}}.\\n# OTP gen_server\\nsnippet gen_server\\n\t-module(${1:`Filename('', 'my')`}).\\n\\n\t-behaviour(gen_server).\\n\\n\t%% API\\n\t-export([\\n\t         start_link/0\\n\t        ]).\\n\\n\t%% gen_server callbacks\\n\t-export([init/1, handle_call/3, handle_cast/2, handle_info/2,\\n\t         terminate/2, code_change/3]).\\n\\n\t-define(SERVER, ?MODULE).\\n\\n\t-record(state, {}).\\n\\n\t%%%===================================================================\\n\t%%% API\\n\t%%%===================================================================\\n\\n\tstart_link() ->\\n\t    gen_server:start_link({local, ?SERVER}, ?MODULE, [], []).\\n\\n\t%%%===================================================================\\n\t%%% gen_server callbacks\\n\t%%%===================================================================\\n\\n\tinit([]) ->\\n\t    {ok, #state{}}.\\n\\n\thandle_call(_Request, _From, State) ->\\n\t    Reply = ok,\\n\t    {reply, Reply, State}.\\n\\n\thandle_cast(_Msg, State) ->\\n\t    {noreply, State}.\\n\\n\thandle_info(_Info, State) ->\\n\t    {noreply, State}.\\n\\n\tterminate(_Reason, _State) ->\\n\t    ok.\\n\\n\tcode_change(_OldVsn, State, _Extra) ->\\n\t    {ok, State}.\\n\\n\t%%%===================================================================\\n\t%%% Internal functions\\n\t%%%===================================================================\\n\\n\",t.scope=\"erlang\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/forth.js",
    "content": "define(\"ace/snippets/forth\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"forth\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ftl.js",
    "content": "define(\"ace/snippets/ftl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"ftl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/gherkin.js",
    "content": "define(\"ace/snippets/gherkin\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"gherkin\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/glsl.js",
    "content": "define(\"ace/snippets/glsl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"glsl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/golang.js",
    "content": "define(\"ace/snippets/golang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"golang\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/groovy.js",
    "content": "define(\"ace/snippets/groovy\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"groovy\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/haml.js",
    "content": "define(\"ace/snippets/haml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet t\\n\t%table\\n\t\t%tr\\n\t\t\t%th\\n\t\t\t\t${1:headers}\\n\t\t%tr\\n\t\t\t%td\\n\t\t\t\t${2:headers}\\nsnippet ul\\n\t%ul\\n\t\t%li\\n\t\t\t${1:item}\\n\t\t%li\\nsnippet =rp\\n\t= render :partial => '${1:partial}'\\nsnippet =rpl\\n\t= render :partial => '${1:partial}', :locals => {}\\nsnippet =rpc\\n\t= render :partial => '${1:partial}', :collection => @$1\\n\\n\",t.scope=\"haml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/handlebars.js",
    "content": "define(\"ace/snippets/handlebars\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"handlebars\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/haskell.js",
    "content": "define(\"ace/snippets/haskell\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet lang\\n\t{-# LANGUAGE ${1:OverloadedStrings} #-}\\nsnippet info\\n\t-- |\\n\t-- Module      :  ${1:Module.Namespace}\\n\t-- Copyright   :  ${2:Author} ${3:2011-2012}\\n\t-- License     :  ${4:BSD3}\\n\t--\\n\t-- Maintainer  :  ${5:email@something.com}\\n\t-- Stability   :  ${6:experimental}\\n\t-- Portability :  ${7:unknown}\\n\t--\\n\t-- ${8:Description}\\n\t--\\nsnippet import\\n\timport           ${1:Data.Text}\\nsnippet import2\\n\timport           ${1:Data.Text} (${2:head})\\nsnippet importq\\n\timport qualified ${1:Data.Text} as ${2:T}\\nsnippet inst\\n\tinstance ${1:Monoid} ${2:Type} where\\n\t\t${3}\\nsnippet type\\n\ttype ${1:Type} = ${2:Type}\\nsnippet data\\n\tdata ${1:Type} = ${2:$1} ${3:Int}\\nsnippet newtype\\n\tnewtype ${1:Type} = ${2:$1} ${3:Int}\\nsnippet class\\n\tclass ${1:Class} a where\\n\t\t${2}\\nsnippet module\\n\tmodule `substitute(substitute(expand('%:r'), '[/\\\\\\\\]','.','g'),'^\\\\%(\\\\l*\\\\.\\\\)\\\\?','','')` (\\n\t)\twhere\\n\t`expand('%') =~ 'Main' ? \\\"\\\\n\\\\nmain = do\\\\n  print \\\\\\\"hello world\\\\\\\"\\\" : \\\"\\\"`\\n\\nsnippet const\\n\t${1:name} :: ${2:a}\\n\t$1 = ${3:undefined}\\nsnippet fn\\n\t${1:fn} :: ${2:a} -> ${3:a}\\n\t$1 ${4} = ${5:undefined}\\nsnippet fn2\\n\t${1:fn} :: ${2:a} -> ${3:a} -> ${4:a}\\n\t$1 ${5} = ${6:undefined}\\nsnippet ap\\n\t${1:map} ${2:fn} ${3:list}\\nsnippet do\\n\tdo\\n\t\t\\nsnippet \\u03bb\\n\t\\\\${1:x} -> ${2}\\nsnippet \\\\\\n\t\\\\${1:x} -> ${2}\\nsnippet <-\\n\t${1:a} <- ${2:m a}\\nsnippet \\u2190\\n\t${1:a} <- ${2:m a}\\nsnippet ->\\n\t${1:m a} -> ${2:a}\\nsnippet \\u2192\\n\t${1:m a} -> ${2:a}\\nsnippet tup\\n\t(${1:a}, ${2:b})\\nsnippet tup2\\n\t(${1:a}, ${2:b}, ${3:c})\\nsnippet tup3\\n\t(${1:a}, ${2:b}, ${3:c}, ${4:d})\\nsnippet rec\\n\t${1:Record} { ${2:recFieldA} = ${3:undefined}\\n\t\t\t\t, ${4:recFieldB} = ${5:undefined}\\n\t\t\t\t}\\nsnippet case\\n\tcase ${1:something} of\\n\t\t${2} -> ${3}\\nsnippet let\\n\tlet ${1} = ${2}\\n\tin ${3}\\nsnippet where\\n\twhere\\n\t\t${1:fn} = ${2:undefined}\\n\",t.scope=\"haskell\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/haxe.js",
    "content": "define(\"ace/snippets/haxe\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"haxe\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/html.js",
    "content": "define(\"ace/snippets/html\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# Some useful Unicode entities\\n# Non-Breaking Space\\nsnippet nbs\\n\t&nbsp;\\n# \\u2190\\nsnippet left\\n\t&#x2190;\\n# \\u2192\\nsnippet right\\n\t&#x2192;\\n# \\u2191\\nsnippet up\\n\t&#x2191;\\n# \\u2193\\nsnippet down\\n\t&#x2193;\\n# \\u21a9\\nsnippet return\\n\t&#x21A9;\\n# \\u21e4\\nsnippet backtab\\n\t&#x21E4;\\n# \\u21e5\\nsnippet tab\\n\t&#x21E5;\\n# \\u21e7\\nsnippet shift\\n\t&#x21E7;\\n# \\u2303\\nsnippet ctrl\\n\t&#x2303;\\n# \\u2305\\nsnippet enter\\n\t&#x2305;\\n# \\u2318\\nsnippet cmd\\n\t&#x2318;\\n# \\u2325\\nsnippet option\\n\t&#x2325;\\n# \\u2326\\nsnippet delete\\n\t&#x2326;\\n# \\u232b\\nsnippet backspace\\n\t&#x232B;\\n# \\u238b\\nsnippet esc\\n\t&#x238B;\\n# Generic Doctype\\nsnippet doctype HTML 4.01 Strict\\n\t<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\\n\t\"http://www.w3.org/TR/html4/strict.dtd\">\\nsnippet doctype HTML 4.01 Transitional\\n\t<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\\n\t\"http://www.w3.org/TR/html4/loose.dtd\">\\nsnippet doctype HTML 5\\n\t<!DOCTYPE HTML>\\nsnippet doctype XHTML 1.0 Frameset\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\\nsnippet doctype XHTML 1.0 Strict\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\\nsnippet doctype XHTML 1.0 Transitional\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\nsnippet doctype XHTML 1.1\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\\n\t\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\\n# HTML Doctype 4.01 Strict\\nsnippet docts\\n\t<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\\n\t\"http://www.w3.org/TR/html4/strict.dtd\">\\n# HTML Doctype 4.01 Transitional\\nsnippet doct\\n\t<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\\n\t\"http://www.w3.org/TR/html4/loose.dtd\">\\n# HTML Doctype 5\\nsnippet doct5\\n\t<!DOCTYPE HTML>\\n# XHTML Doctype 1.0 Frameset\\nsnippet docxf\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\\n# XHTML Doctype 1.0 Strict\\nsnippet docxs\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\\n# XHTML Doctype 1.0 Transitional\\nsnippet docxt\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\\n# XHTML Doctype 1.1\\nsnippet docx\\n\t<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\"\\n\t\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\\n# Attributes\\nsnippet attr\\n\t${1:attribute}=\"${2:property}\"\\nsnippet attr+\\n\t${1:attribute}=\"${2:property}\" attr+${3}\\nsnippet .\\n\tclass=\"${1}\"${2}\\nsnippet #\\n\tid=\"${1}\"${2}\\nsnippet alt\\n\talt=\"${1}\"${2}\\nsnippet charset\\n\tcharset=\"${1:utf-8}\"${2}\\nsnippet data\\n\tdata-${1}=\"${2:$1}\"${3}\\nsnippet for\\n\tfor=\"${1}\"${2}\\nsnippet height\\n\theight=\"${1}\"${2}\\nsnippet href\\n\thref=\"${1:#}\"${2}\\nsnippet lang\\n\tlang=\"${1:en}\"${2}\\nsnippet media\\n\tmedia=\"${1}\"${2}\\nsnippet name\\n\tname=\"${1}\"${2}\\nsnippet rel\\n\trel=\"${1}\"${2}\\nsnippet scope\\n\tscope=\"${1:row}\"${2}\\nsnippet src\\n\tsrc=\"${1}\"${2}\\nsnippet title=\\n\ttitle=\"${1}\"${2}\\nsnippet type\\n\ttype=\"${1}\"${2}\\nsnippet value\\n\tvalue=\"${1}\"${2}\\nsnippet width\\n\twidth=\"${1}\"${2}\\n# Elements\\nsnippet a\\n\t<a href=\"${1:#}\">${2:$1}</a>\\nsnippet a.\\n\t<a class=\"${1}\" href=\"${2:#}\">${3:$1}</a>\\nsnippet a#\\n\t<a id=\"${1}\" href=\"${2:#}\">${3:$1}</a>\\nsnippet a:ext\\n\t<a href=\"http://${1:example.com}\">${2:$1}</a>\\nsnippet a:mail\\n\t<a href=\"mailto:${1:joe@example.com}?subject=${2:feedback}\">${3:email me}</a>\\nsnippet abbr\\n\t<abbr title=\"${1}\">${2}</abbr>\\nsnippet address\\n\t<address>\\n\t\t${1}\\n\t</address>\\nsnippet area\\n\t<area shape=\"${1:rect}\" coords=\"${2}\" href=\"${3}\" alt=\"${4}\" />\\nsnippet area+\\n\t<area shape=\"${1:rect}\" coords=\"${2}\" href=\"${3}\" alt=\"${4}\" />\\n\tarea+${5}\\nsnippet area:c\\n\t<area shape=\"circle\" coords=\"${1}\" href=\"${2}\" alt=\"${3}\" />\\nsnippet area:d\\n\t<area shape=\"default\" coords=\"${1}\" href=\"${2}\" alt=\"${3}\" />\\nsnippet area:p\\n\t<area shape=\"poly\" coords=\"${1}\" href=\"${2}\" alt=\"${3}\" />\\nsnippet area:r\\n\t<area shape=\"rect\" coords=\"${1}\" href=\"${2}\" alt=\"${3}\" />\\nsnippet article\\n\t<article>\\n\t\t${1}\\n\t</article>\\nsnippet article.\\n\t<article class=\"${1}\">\\n\t\t${2}\\n\t</article>\\nsnippet article#\\n\t<article id=\"${1}\">\\n\t\t${2}\\n\t</article>\\nsnippet aside\\n\t<aside>\\n\t\t${1}\\n\t</aside>\\nsnippet aside.\\n\t<aside class=\"${1}\">\\n\t\t${2}\\n\t</aside>\\nsnippet aside#\\n\t<aside id=\"${1}\">\\n\t\t${2}\\n\t</aside>\\nsnippet audio\\n\t<audio src=\"${1}>${2}</audio>\\nsnippet b\\n\t<b>${1}</b>\\nsnippet base\\n\t<base href=\"${1}\" target=\"${2}\" />\\nsnippet bdi\\n\t<bdi>${1}</bdo>\\nsnippet bdo\\n\t<bdo dir=\"${1}\">${2}</bdo>\\nsnippet bdo:l\\n\t<bdo dir=\"ltr\">${1}</bdo>\\nsnippet bdo:r\\n\t<bdo dir=\"rtl\">${1}</bdo>\\nsnippet blockquote\\n\t<blockquote>\\n\t\t${1}\\n\t</blockquote>\\nsnippet body\\n\t<body>\\n\t\t${1}\\n\t</body>\\nsnippet br\\n\t<br />${1}\\nsnippet button\\n\t<button type=\"${1:submit}\">${2}</button>\\nsnippet button.\\n\t<button class=\"${1:button}\" type=\"${2:submit}\">${3}</button>\\nsnippet button#\\n\t<button id=\"${1}\" type=\"${2:submit}\">${3}</button>\\nsnippet button:s\\n\t<button type=\"submit\">${1}</button>\\nsnippet button:r\\n\t<button type=\"reset\">${1}</button>\\nsnippet canvas\\n\t<canvas>\\n\t\t${1}\\n\t</canvas>\\nsnippet caption\\n\t<caption>${1}</caption>\\nsnippet cite\\n\t<cite>${1}</cite>\\nsnippet code\\n\t<code>${1}</code>\\nsnippet col\\n\t<col />${1}\\nsnippet col+\\n\t<col />\\n\tcol+${1}\\nsnippet colgroup\\n\t<colgroup>\\n\t\t${1}\\n\t</colgroup>\\nsnippet colgroup+\\n\t<colgroup>\\n\t\t<col />\\n\t\tcol+${1}\\n\t</colgroup>\\nsnippet command\\n\t<command type=\"command\" label=\"${1}\" icon=\"${2}\" />\\nsnippet command:c\\n\t<command type=\"checkbox\" label=\"${1}\" icon=\"${2}\" />\\nsnippet command:r\\n\t<command type=\"radio\" radiogroup=\"${1}\" label=\"${2}\" icon=\"${3}\" />\\nsnippet datagrid\\n\t<datagrid>\\n\t\t${1}\\n\t</datagrid>\\nsnippet datalist\\n\t<datalist>\\n\t\t${1}\\n\t</datalist>\\nsnippet datatemplate\\n\t<datatemplate>\\n\t\t${1}\\n\t</datatemplate>\\nsnippet dd\\n\t<dd>${1}</dd>\\nsnippet dd.\\n\t<dd class=\"${1}\">${2}</dd>\\nsnippet dd#\\n\t<dd id=\"${1}\">${2}</dd>\\nsnippet del\\n\t<del>${1}</del>\\nsnippet details\\n\t<details>${1}</details>\\nsnippet dfn\\n\t<dfn>${1}</dfn>\\nsnippet dialog\\n\t<dialog>\\n\t\t${1}\\n\t</dialog>\\nsnippet div\\n\t<div>\\n\t\t${1}\\n\t</div>\\nsnippet div.\\n\t<div class=\"${1}\">\\n\t\t${2}\\n\t</div>\\nsnippet div#\\n\t<div id=\"${1}\">\\n\t\t${2}\\n\t</div>\\nsnippet dl\\n\t<dl>\\n\t\t${1}\\n\t</dl>\\nsnippet dl.\\n\t<dl class=\"${1}\">\\n\t\t${2}\\n\t</dl>\\nsnippet dl#\\n\t<dl id=\"${1}\">\\n\t\t${2}\\n\t</dl>\\nsnippet dl+\\n\t<dl>\\n\t\t<dt>${1}</dt>\\n\t\t<dd>${2}</dd>\\n\t\tdt+${3}\\n\t</dl>\\nsnippet dt\\n\t<dt>${1}</dt>\\nsnippet dt.\\n\t<dt class=\"${1}\">${2}</dt>\\nsnippet dt#\\n\t<dt id=\"${1}\">${2}</dt>\\nsnippet dt+\\n\t<dt>${1}</dt>\\n\t<dd>${2}</dd>\\n\tdt+${3}\\nsnippet em\\n\t<em>${1}</em>\\nsnippet embed\\n\t<embed src=${1} type=\"${2} />\\nsnippet fieldset\\n\t<fieldset>\\n\t\t${1}\\n\t</fieldset>\\nsnippet fieldset.\\n\t<fieldset class=\"${1}\">\\n\t\t${2}\\n\t</fieldset>\\nsnippet fieldset#\\n\t<fieldset id=\"${1}\">\\n\t\t${2}\\n\t</fieldset>\\nsnippet fieldset+\\n\t<fieldset>\\n\t\t<legend><span>${1}</span></legend>\\n\t\t${2}\\n\t</fieldset>\\n\tfieldset+${3}\\nsnippet figcaption\\n\t<figcaption>${1}</figcaption>\\nsnippet figure\\n\t<figure>${1}</figure>\\nsnippet footer\\n\t<footer>\\n\t\t${1}\\n\t</footer>\\nsnippet footer.\\n\t<footer class=\"${1}\">\\n\t\t${2}\\n\t</footer>\\nsnippet footer#\\n\t<footer id=\"${1}\">\\n\t\t${2}\\n\t</footer>\\nsnippet form\\n\t<form action=\"${1}\" method=\"${2:get}\" accept-charset=\"utf-8\">\\n\t\t${3}\\n\t</form>\\nsnippet form.\\n\t<form class=\"${1}\" action=\"${2}\" method=\"${3:get}\" accept-charset=\"utf-8\">\\n\t\t${4}\\n\t</form>\\nsnippet form#\\n\t<form id=\"${1}\" action=\"${2}\" method=\"${3:get}\" accept-charset=\"utf-8\">\\n\t\t${4}\\n\t</form>\\nsnippet h1\\n\t<h1>${1}</h1>\\nsnippet h1.\\n\t<h1 class=\"${1}\">${2}</h1>\\nsnippet h1#\\n\t<h1 id=\"${1}\">${2}</h1>\\nsnippet h2\\n\t<h2>${1}</h2>\\nsnippet h2.\\n\t<h2 class=\"${1}\">${2}</h2>\\nsnippet h2#\\n\t<h2 id=\"${1}\">${2}</h2>\\nsnippet h3\\n\t<h3>${1}</h3>\\nsnippet h3.\\n\t<h3 class=\"${1}\">${2}</h3>\\nsnippet h3#\\n\t<h3 id=\"${1}\">${2}</h3>\\nsnippet h4\\n\t<h4>${1}</h4>\\nsnippet h4.\\n\t<h4 class=\"${1}\">${2}</h4>\\nsnippet h4#\\n\t<h4 id=\"${1}\">${2}</h4>\\nsnippet h5\\n\t<h5>${1}</h5>\\nsnippet h5.\\n\t<h5 class=\"${1}\">${2}</h5>\\nsnippet h5#\\n\t<h5 id=\"${1}\">${2}</h5>\\nsnippet h6\\n\t<h6>${1}</h6>\\nsnippet h6.\\n\t<h6 class=\"${1}\">${2}</h6>\\nsnippet h6#\\n\t<h6 id=\"${1}\">${2}</h6>\\nsnippet head\\n\t<head>\\n\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\\n\\n\t\t<title>${1:`substitute(Filename(\\'\\', \\'Page Title\\'), \\'^.\\', \\'\\\\u&\\', \\'\\')`}</title>\\n\t\t${2}\\n\t</head>\\nsnippet header\\n\t<header>\\n\t\t${1}\\n\t</header>\\nsnippet header.\\n\t<header class=\"${1}\">\\n\t\t${2}\\n\t</header>\\nsnippet header#\\n\t<header id=\"${1}\">\\n\t\t${2}\\n\t</header>\\nsnippet hgroup\\n\t<hgroup>\\n\t\t${1}\\n\t</hgroup>\\nsnippet hgroup.\\n\t<hgroup class=\"${1}>\\n\t\t${2}\\n\t</hgroup>\\nsnippet hr\\n\t<hr />${1}\\nsnippet html\\n\t<html>\\n\t${1}\\n\t</html>\\nsnippet xhtml\\n\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\\n\t${1}\\n\t</html>\\nsnippet html5\\n\t<!DOCTYPE html>\\n\t<html>\\n\t\t<head>\\n\t\t\t<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />\\n\t\t\t<title>${1:`substitute(Filename(\\'\\', \\'Page Title\\'), \\'^.\\', \\'\\\\u&\\', \\'\\')`}</title>\\n\t\t\t${2:meta}\\n\t\t</head>\\n\t\t<body>\\n\t\t\t${3:body}\\n\t\t</body>\\n\t</html>\\nsnippet i\\n\t<i>${1}</i>\\nsnippet iframe\\n\t<iframe src=\"${1}\" frameborder=\"0\"></iframe>${2}\\nsnippet iframe.\\n\t<iframe class=\"${1}\" src=\"${2}\" frameborder=\"0\"></iframe>${3}\\nsnippet iframe#\\n\t<iframe id=\"${1}\" src=\"${2}\" frameborder=\"0\"></iframe>${3}\\nsnippet img\\n\t<img src=\"${1}\" alt=\"${2}\" />${3}\\nsnippet img.\\n\t<img class=\"${1}\" src=\"${2}\" alt=\"${3}\" />${4}\\nsnippet img#\\n\t<img id=\"${1}\" src=\"${2}\" alt=\"${3}\" />${4}\\nsnippet input\\n\t<input type=\"${1:text/submit/hidden/button/image}\" name=\"${2}\" id=\"${3:$2}\" value=\"${4}\" />${5}\\nsnippet input.\\n\t<input class=\"${1}\" type=\"${2:text/submit/hidden/button/image}\" name=\"${3}\" id=\"${4:$3}\" value=\"${5}\" />${6}\\nsnippet input:text\\n\t<input type=\"text\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:submit\\n\t<input type=\"submit\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:hidden\\n\t<input type=\"hidden\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:button\\n\t<input type=\"button\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:image\\n\t<input type=\"image\" name=\"${1}\" id=\"${2:$1}\" src=\"${3}\" alt=\"${4}\" />${5}\\nsnippet input:checkbox\\n\t<input type=\"checkbox\" name=\"${1}\" id=\"${2:$1}\" />${3}\\nsnippet input:radio\\n\t<input type=\"radio\" name=\"${1}\" id=\"${2:$1}\" />${3}\\nsnippet input:color\\n\t<input type=\"color\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:date\\n\t<input type=\"date\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:datetime\\n\t<input type=\"datetime\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:datetime-local\\n\t<input type=\"datetime-local\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:email\\n\t<input type=\"email\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:file\\n\t<input type=\"file\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:month\\n\t<input type=\"month\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:number\\n\t<input type=\"number\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:password\\n\t<input type=\"password\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:range\\n\t<input type=\"range\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:reset\\n\t<input type=\"reset\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:search\\n\t<input type=\"search\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:time\\n\t<input type=\"time\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:url\\n\t<input type=\"url\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet input:week\\n\t<input type=\"week\" name=\"${1}\" id=\"${2:$1}\" value=\"${3}\" />${4}\\nsnippet ins\\n\t<ins>${1}</ins>\\nsnippet kbd\\n\t<kbd>${1}</kbd>\\nsnippet keygen\\n\t<keygen>${1}</keygen>\\nsnippet label\\n\t<label for=\"${2:$1}\">${1}</label>\\nsnippet label:i\\n\t<label for=\"${2:$1}\">${1}</label>\\n\t<input type=\"${3:text/submit/hidden/button}\" name=\"${4:$2}\" id=\"${5:$2}\" value=\"${6}\" />${7}\\nsnippet label:s\\n\t<label for=\"${2:$1}\">${1}</label>\\n\t<select name=\"${3:$2}\" id=\"${4:$2}\">\\n\t\t<option value=\"${5}\">${6:$5}</option>\\n\t</select>\\nsnippet legend\\n\t<legend>${1}</legend>\\nsnippet legend+\\n\t<legend><span>${1}</span></legend>\\nsnippet li\\n\t<li>${1}</li>\\nsnippet li.\\n\t<li class=\"${1}\">${2}</li>\\nsnippet li+\\n\t<li>${1}</li>\\n\tli+${2}\\nsnippet lia\\n\t<li><a href=\"${2:#}\">${1}</a></li>\\nsnippet lia+\\n\t<li><a href=\"${2:#}\">${1}</a></li>\\n\tlia+${3}\\nsnippet link\\n\t<link rel=\"${1}\" href=\"${2}\" title=\"${3}\" type=\"${4}\" />${5}\\nsnippet link:atom\\n\t<link rel=\"alternate\" href=\"${1:atom.xml}\" title=\"Atom\" type=\"application/atom+xml\" />${2}\\nsnippet link:css\\n\t<link rel=\"stylesheet\" href=\"${2:style.css}\" type=\"text/css\" media=\"${3:all}\" />${4}\\nsnippet link:favicon\\n\t<link rel=\"shortcut icon\" href=\"${1:favicon.ico}\" type=\"image/x-icon\" />${2}\\nsnippet link:rss\\n\t<link rel=\"alternate\" href=\"${1:rss.xml}\" title=\"RSS\" type=\"application/atom+xml\" />${2}\\nsnippet link:touch\\n\t<link rel=\"apple-touch-icon\" href=\"${1:favicon.png}\" />${2}\\nsnippet map\\n\t<map name=\"${1}\">\\n\t\t${2}\\n\t</map>\\nsnippet map.\\n\t<map class=\"${1}\" name=\"${2}\">\\n\t\t${3}\\n\t</map>\\nsnippet map#\\n\t<map name=\"${1}\" id=\"${2:$1}>\\n\t\t${3}\\n\t</map>\\nsnippet map+\\n\t<map name=\"${1}\">\\n\t\t<area shape=\"${2}\" coords=\"${3}\" href=\"${4}\" alt=\"${5}\" />${6}\\n\t</map>${7}\\nsnippet mark\\n\t<mark>${1}</mark>\\nsnippet menu\\n\t<menu>\\n\t\t${1}\\n\t</menu>\\nsnippet menu:c\\n\t<menu type=\"context\">\\n\t\t${1}\\n\t</menu>\\nsnippet menu:t\\n\t<menu type=\"toolbar\">\\n\t\t${1}\\n\t</menu>\\nsnippet meta\\n\t<meta http-equiv=\"${1}\" content=\"${2}\" />${3}\\nsnippet meta:compat\\n\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=${1:7,8,edge}\" />${3}\\nsnippet meta:refresh\\n\t<meta http-equiv=\"refresh\" content=\"text/html;charset=UTF-8\" />${3}\\nsnippet meta:utf\\n\t<meta http-equiv=\"content-type\" content=\"text/html;charset=UTF-8\" />${3}\\nsnippet meter\\n\t<meter>${1}</meter>\\nsnippet nav\\n\t<nav>\\n\t\t${1}\\n\t</nav>\\nsnippet nav.\\n\t<nav class=\"${1}\">\\n\t\t${2}\\n\t</nav>\\nsnippet nav#\\n\t<nav id=\"${1}\">\\n\t\t${2}\\n\t</nav>\\nsnippet noscript\\n\t<noscript>\\n\t\t${1}\\n\t</noscript>\\nsnippet object\\n\t<object data=\"${1}\" type=\"${2}\">\\n\t\t${3}\\n\t</object>${4}\\n# Embed QT Movie\\nsnippet movie\\n\t<object width=\"$2\" height=\"$3\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"\\n\t codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\">\\n\t\t<param name=\"src\" value=\"$1\" />\\n\t\t<param name=\"controller\" value=\"$4\" />\\n\t\t<param name=\"autoplay\" value=\"$5\" />\\n\t\t<embed src=\"${1:movie.mov}\"\\n\t\t\twidth=\"${2:320}\" height=\"${3:240}\"\\n\t\t\tcontroller=\"${4:true}\" autoplay=\"${5:true}\"\\n\t\t\tscale=\"tofit\" cache=\"true\"\\n\t\t\tpluginspage=\"http://www.apple.com/quicktime/download/\" />\\n\t</object>${6}\\nsnippet ol\\n\t<ol>\\n\t\t${1}\\n\t</ol>\\nsnippet ol.\\n\t<ol class=\"${1}>\\n\t\t${2}\\n\t</ol>\\nsnippet ol#\\n\t<ol id=\"${1}>\\n\t\t${2}\\n\t</ol>\\nsnippet ol+\\n\t<ol>\\n\t\t<li>${1}</li>\\n\t\tli+${2}\\n\t</ol>\\nsnippet opt\\n\t<option value=\"${1}\">${2:$1}</option>\\nsnippet opt+\\n\t<option value=\"${1}\">${2:$1}</option>\\n\topt+${3}\\nsnippet optt\\n\t<option>${1}</option>\\nsnippet optgroup\\n\t<optgroup>\\n\t\t<option value=\"${1}\">${2:$1}</option>\\n\t\topt+${3}\\n\t</optgroup>\\nsnippet output\\n\t<output>${1}</output>\\nsnippet p\\n\t<p>${1}</p>\\nsnippet param\\n\t<param name=\"${1}\" value=\"${2}\" />${3}\\nsnippet pre\\n\t<pre>\\n\t\t${1}\\n\t</pre>\\nsnippet progress\\n\t<progress>${1}</progress>\\nsnippet q\\n\t<q>${1}</q>\\nsnippet rp\\n\t<rp>${1}</rp>\\nsnippet rt\\n\t<rt>${1}</rt>\\nsnippet ruby\\n\t<ruby>\\n\t\t<rp><rt>${1}</rt></rp>\\n\t</ruby>\\nsnippet s\\n\t<s>${1}</s>\\nsnippet samp\\n\t<samp>\\n\t\t${1}\\n\t</samp>\\nsnippet script\\n\t<script type=\"text/javascript\" charset=\"utf-8\">\\n\t\t${1}\\n\t</script>\\nsnippet scriptsrc\\n\t<script src=\"${1}.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\\nsnippet section\\n\t<section>\\n\t\t${1}\\n\t</section>\\nsnippet section.\\n\t<section class=\"${1}\">\\n\t\t${2}\\n\t</section>\\nsnippet section#\\n\t<section id=\"${1}\">\\n\t\t${2}\\n\t</section>\\nsnippet select\\n\t<select name=\"${1}\" id=\"${2:$1}\">\\n\t\t${3}\\n\t</select>\\nsnippet select.\\n\t<select name=\"${1}\" id=\"${2:$1}\" class=\"${3}>\\n\t\t${4}\\n\t</select>\\nsnippet select+\\n\t<select name=\"${1}\" id=\"${2:$1}\">\\n\t\t<option value=\"${3}\">${4:$3}</option>\\n\t\topt+${5}\\n\t</select>\\nsnippet small\\n\t<small>${1}</small>\\nsnippet source\\n\t<source src=\"${1}\" type=\"${2}\" media=\"${3}\" />\\nsnippet span\\n\t<span>${1}</span>\\nsnippet strong\\n\t<strong>${1}</strong>\\nsnippet style\\n\t<style type=\"text/css\" media=\"${1:all}\">\\n\t\t${2}\\n\t</style>\\nsnippet sub\\n\t<sub>${1}</sub>\\nsnippet summary\\n\t<summary>\\n\t\t${1}\\n\t</summary>\\nsnippet sup\\n\t<sup>${1}</sup>\\nsnippet table\\n\t<table border=\"${1:0}\">\\n\t\t${2}\\n\t</table>\\nsnippet table.\\n\t<table class=\"${1}\" border=\"${2:0}\">\\n\t\t${3}\\n\t</table>\\nsnippet table#\\n\t<table id=\"${1}\" border=\"${2:0}\">\\n\t\t${3}\\n\t</table>\\nsnippet tbody\\n\t<tbody>\\n\t\t${1}\\n\t</tbody>\\nsnippet td\\n\t<td>${1}</td>\\nsnippet td.\\n\t<td class=\"${1}\">${2}</td>\\nsnippet td#\\n\t<td id=\"${1}\">${2}</td>\\nsnippet td+\\n\t<td>${1}</td>\\n\ttd+${2}\\nsnippet textarea\\n\t<textarea name=\"${1}\" id=${2:$1} rows=\"${3:8}\" cols=\"${4:40}\">${5}</textarea>${6}\\nsnippet tfoot\\n\t<tfoot>\\n\t\t${1}\\n\t</tfoot>\\nsnippet th\\n\t<th>${1}</th>\\nsnippet th.\\n\t<th class=\"${1}\">${2}</th>\\nsnippet th#\\n\t<th id=\"${1}\">${2}</th>\\nsnippet th+\\n\t<th>${1}</th>\\n\tth+${2}\\nsnippet thead\\n\t<thead>\\n\t\t${1}\\n\t</thead>\\nsnippet time\\n\t<time datetime=\"${1}\" pubdate=\"${2:$1}>${3:$1}</time>\\nsnippet title\\n\t<title>${1:`substitute(Filename(\\'\\', \\'Page Title\\'), \\'^.\\', \\'\\\\u&\\', \\'\\')`}</title>\\nsnippet tr\\n\t<tr>\\n\t\t${1}\\n\t</tr>\\nsnippet tr+\\n\t<tr>\\n\t\t<td>${1}</td>\\n\t\ttd+${2}\\n\t</tr>\\nsnippet track\\n\t<track src=\"${1}\" srclang=\"${2}\" label=\"${3}\" default=\"${4:default}>${5}</track>${6}\\nsnippet ul\\n\t<ul>\\n\t\t${1}\\n\t</ul>\\nsnippet ul.\\n\t<ul class=\"${1}\">\\n\t\t${2}\\n\t</ul>\\nsnippet ul#\\n\t<ul id=\"${1}\">\\n\t\t${2}\\n\t</ul>\\nsnippet ul+\\n\t<ul>\\n\t\t<li>${1}</li>\\n\t\tli+${2}\\n\t</ul>\\nsnippet var\\n\t<var>${1}</var>\\nsnippet video\\n\t<video src=\"${1} height=\"${2}\" width=\"${3}\" preload=\"${5:none}\" autoplay=\"${6:autoplay}>${7}</video>${8}\\nsnippet wbr\\n\t<wbr />${1}\\n',t.scope=\"html\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/html_completions.js",
    "content": "define(\"ace/snippets/html_completions\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"html_completions\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/html_ruby.js",
    "content": "define(\"ace/snippets/html_ruby\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"html_ruby\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ini.js",
    "content": "define(\"ace/snippets/ini\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"ini\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/jack.js",
    "content": "define(\"ace/snippets/jack\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"jack\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/jade.js",
    "content": "define(\"ace/snippets/jade\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"jade\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/java.js",
    "content": "define(\"ace/snippets/java\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='## Access Modifiers\\nsnippet po\\n\tprotected\\nsnippet pu\\n\tpublic\\nsnippet pr\\n\tprivate\\n##\\n## Annotations\\nsnippet before\\n\t@Before\\n\tstatic void ${1:intercept}(${2:args}) { ${3} }\\nsnippet mm\\n\t@ManyToMany\\n\t${1}\\nsnippet mo\\n\t@ManyToOne\\n\t${1}\\nsnippet om\\n\t@OneToMany${1:(cascade=CascadeType.ALL)}\\n\t${2}\\nsnippet oo\\n\t@OneToOne\\n\t${1}\\n##\\n## Basic Java packages and import\\nsnippet im\\n\timport\\nsnippet j.b\\n\tjava.beans.\\nsnippet j.i\\n\tjava.io.\\nsnippet j.m\\n\tjava.math.\\nsnippet j.n\\n\tjava.net.\\nsnippet j.u\\n\tjava.util.\\n##\\n## Class\\nsnippet cl\\n\tclass ${1:`Filename(\"\", \"untitled\")`} ${2}\\nsnippet in\\n\tinterface ${1:`Filename(\"\", \"untitled\")`} ${2:extends Parent}${3}\\nsnippet tc\\n\tpublic class ${1:`Filename()`} extends ${2:TestCase}\\n##\\n## Class Enhancements\\nsnippet ext\\n\textends \\nsnippet imp\\n\timplements\\n##\\n## Comments\\nsnippet /*\\n\t/*\\n\t * ${1}\\n\t */\\n##\\n## Constants\\nsnippet co\\n\tstatic public final ${1:String} ${2:var} = ${3};${4}\\nsnippet cos\\n\tstatic public final String ${1:var} = \"${2}\";${3}\\n##\\n## Control Statements\\nsnippet case\\n\tcase ${1}:\\n\t\t${2}\\nsnippet def\\n\tdefault:\\n\t\t${2}\\nsnippet el\\n\telse\\nsnippet elif\\n\telse if (${1}) ${2}\\nsnippet if\\n\tif (${1}) ${2}\\nsnippet sw\\n\tswitch (${1}) {\\n\t\t${2}\\n\t}\\n##\\n## Create a Method\\nsnippet m\\n\t${1:void} ${2:method}(${3}) ${4:throws }${5}\\n##\\n## Create a Variable\\nsnippet v\\n\t${1:String} ${2:var}${3: = null}${4};${5}\\n##\\n## Enhancements to Methods, variables, classes, etc.\\nsnippet ab\\n\tabstract\\nsnippet fi\\n\tfinal\\nsnippet st\\n\tstatic\\nsnippet sy\\n\tsynchronized\\n##\\n## Error Methods\\nsnippet err\\n\tSystem.err.print(\"${1:Message}\");\\nsnippet errf\\n\tSystem.err.printf(\"${1:Message}\", ${2:exception});\\nsnippet errln\\n\tSystem.err.println(\"${1:Message}\");\\n##\\n## Exception Handling\\nsnippet as\\n\tassert ${1:test} : \"${2:Failure message}\";${3}\\nsnippet ca\\n\tcatch(${1:Exception} ${2:e}) ${3}\\nsnippet thr\\n\tthrow\\nsnippet ths\\n\tthrows\\nsnippet try\\n\ttry {\\n\t\t${3}\\n\t} catch(${1:Exception} ${2:e}) {\\n\t}\\nsnippet tryf\\n\ttry {\\n\t\t${3}\\n\t} catch(${1:Exception} ${2:e}) {\\n\t} finally {\\n\t}\\n##\\n## Find Methods\\nsnippet findall\\n\tList<${1:listName}> ${2:items} = ${1}.findAll();${3}\\nsnippet findbyid\\n\t${1:var} ${2:item} = ${1}.findById(${3});${4}\\n##\\n## Javadocs\\nsnippet /**\\n\t/**\\n\t * ${1}\\n\t */\\nsnippet @au\\n\t@author `system(\"grep \\\\`id -un\\\\` /etc/passwd | cut -d \\\\\":\\\\\" -f5 | cut -d \\\\\",\\\\\" -f1\")`\\nsnippet @br\\n\t@brief ${1:Description}\\nsnippet @fi\\n\t@file ${1:`Filename()`}.java\\nsnippet @pa\\n\t@param ${1:param}\\nsnippet @re\\n\t@return ${1:param}\\n##\\n## Logger Methods\\nsnippet debug\\n\tLogger.debug(${1:param});${2}\\nsnippet error\\n\tLogger.error(${1:param});${2}\\nsnippet info\\n\tLogger.info(${1:param});${2}\\nsnippet warn\\n\tLogger.warn(${1:param});${2}\\n##\\n## Loops\\nsnippet enfor\\n\tfor (${1} : ${2}) ${3}\\nsnippet for\\n\tfor (${1}; ${2}; ${3}) ${4}\\nsnippet wh\\n\twhile (${1}) ${2}\\n##\\n## Main method\\nsnippet main\\n\tpublic static void main (String[] args) {\\n\t\t${1:/* code */}\\n\t}\\n##\\n## Print Methods\\nsnippet print\\n\tSystem.out.print(\"${1:Message}\");\\nsnippet printf\\n\tSystem.out.printf(\"${1:Message}\", ${2:args});\\nsnippet println\\n\tSystem.out.println(${1});\\n##\\n## Render Methods\\nsnippet ren\\n\trender(${1:param});${2}\\nsnippet rena\\n\trenderArgs.put(\"${1}\", ${2});${3}\\nsnippet renb\\n\trenderBinary(${1:param});${2}\\nsnippet renj\\n\trenderJSON(${1:param});${2}\\nsnippet renx\\n\trenderXml(${1:param});${2}\\n##\\n## Setter and Getter Methods\\nsnippet set\\n\t${1:public} void set${3:}(${2:String} ${4:}){\\n\t\tthis.$4 = $4;\\n\t}\\nsnippet get\\n\t${1:public} ${2:String} get${3:}(){\\n\t\treturn this.${4:};\\n\t}\\n##\\n## Terminate Methods or Loops\\nsnippet re\\n\treturn\\nsnippet br\\n\tbreak;\\n##\\n## Test Methods\\nsnippet t\\n\tpublic void test${1:Name}() throws Exception {\\n\t\t${2}\\n\t}\\nsnippet test\\n\t@Test\\n\tpublic void test${1:Name}() throws Exception {\\n\t\t${2}\\n\t}\\n##\\n## Utils\\nsnippet Sc\\n\tScanner\\n##\\n## Miscellaneous\\nsnippet action\\n\tpublic static void ${1:index}(${2:args}) { ${3} }\\nsnippet rnf\\n\tnotFound(${1:param});${2}\\nsnippet rnfin\\n\tnotFoundIfNull(${1:param});${2}\\nsnippet rr\\n\tredirect(${1:param});${2}\\nsnippet ru\\n\tunauthorized(${1:param});${2}\\nsnippet unless\\n\t(unless=${1:param});${2}\\n',t.scope=\"java\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/javascript.js",
    "content": "define(\"ace/snippets/javascript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# Prototype\\nsnippet proto\\n\t${1:class_name}.prototype.${2:method_name} = function(${3:first_argument}) {\\n\t\t${4:// body...}\\n\t};\\n# Function\\nsnippet fun\\n\tfunction ${1?:function_name}(${2:argument}) {\\n\t\t${3:// body...}\\n\t}\\n# Anonymous Function\\nregex /((=)\\\\s*|(:)\\\\s*|(\\\\()|\\\\b)/f/(\\\\))?/\\nsnippet f\\n\tfunction${M1?: ${1:functionName}}($2) {\\n\t\t${0:$TM_SELECTED_TEXT}\\n\t}${M2?;}${M3?,}${M4?)}\\n# Immediate function\\ntrigger \\\\(?f\\\\(\\nendTrigger \\\\)?\\nsnippet f(\\n\t(function(${1}) {\\n\t\t${0:${TM_SELECTED_TEXT:/* code */}}\\n\t}(${1}));\\n# if\\nsnippet if\\n\tif (${1:true}) {\\n\t\t${0}\\n\t}\\n# if ... else\\nsnippet ife\\n\tif (${1:true}) {\\n\t\t${2}\\n\t} else {\\n\t\t${0}\\n\t}\\n# tertiary conditional\\nsnippet ter\\n\t${1:/* condition */} ? ${2:a} : ${3:b}\\n# switch\\nsnippet switch\\n\tswitch (${1:expression}) {\\n\t\tcase \\'${3:case}\\':\\n\t\t\t${4:// code}\\n\t\t\tbreak;\\n\t\t${5}\\n\t\tdefault:\\n\t\t\t${2:// code}\\n\t}\\n# case\\nsnippet case\\n\tcase \\'${1:case}\\':\\n\t\t${2:// code}\\n\t\tbreak;\\n\t${3}\\n\\n# while (...) {...}\\nsnippet wh\\n\twhile (${1:/* condition */}) {\\n\t\t${0:/* code */}\\n\t}\\n# try\\nsnippet try\\n\ttry {\\n\t\t${0:/* code */}\\n\t} catch (e) {}\\n# do...while\\nsnippet do\\n\tdo {\\n\t\t${2:/* code */}\\n\t} while (${1:/* condition */});\\n# Object Method\\nsnippet :f\\nregex /([,{[])|^\\\\s*/:f/\\n\t${1:method_name}: function(${2:attribute}) {\\n\t\t${0}\\n\t}${3:,}\\n# setTimeout function\\nsnippet setTimeout\\nregex /\\\\b/st|timeout|setTimeo?u?t?/\\n\tsetTimeout(function() {${3:$TM_SELECTED_TEXT}}, ${1:10});\\n# Get Elements\\nsnippet gett\\n\tgetElementsBy${1:TagName}(\\'${2}\\')${3}\\n# Get Element\\nsnippet get\\n\tgetElementBy${1:Id}(\\'${2}\\')${3}\\n# console.log (Firebug)\\nsnippet cl\\n\tconsole.log(${1});\\n# return\\nsnippet ret\\n\treturn ${1:result}\\n# for (property in object ) { ... }\\nsnippet fori\\n\tfor (var ${1:prop} in ${2:Things}) {\\n\t\t${0:$2[$1]}\\n\t}\\n# hasOwnProperty\\nsnippet has\\n\thasOwnProperty(${1})\\n# docstring\\nsnippet /**\\n\t/**\\n\t * ${1:description}\\n\t *\\n\t */\\nsnippet @par\\nregex /^\\\\s*\\\\*\\\\s*/@(para?m?)?/\\n\t@param {${1:type}} ${2:name} ${3:description}\\nsnippet @ret\\n\t@return {${1:type}} ${2:description}\\n# JSON.parse\\nsnippet jsonp\\n\tJSON.parse(${1:jstr});\\n# JSON.stringify\\nsnippet jsons\\n\tJSON.stringify(${1:object});\\n# self-defining function\\nsnippet sdf\\n\tvar ${1:function_name} = function(${2:argument}) {\\n\t\t${3:// initial code ...}\\n\\n\t\t$1 = function($2) {\\n\t\t\t${4:// main code}\\n\t\t};\\n\t}\\n# singleton\\nsnippet sing\\n\tfunction ${1:Singleton} (${2:argument}) {\\n\t\t// the cached instance\\n\t\tvar instance;\\n\\n\t\t// rewrite the constructor\\n\t\t$1 = function $1($2) {\\n\t\t\treturn instance;\\n\t\t};\\n\t\t\\n\t\t// carry over the prototype properties\\n\t\t$1.prototype = this;\\n\\n\t\t// the instance\\n\t\tinstance = new $1();\\n\\n\t\t// reset the constructor pointer\\n\t\tinstance.constructor = $1;\\n\\n\t\t${3:// code ...}\\n\\n\t\treturn instance;\\n\t}\\n# class\\nsnippet class\\nregex /^\\\\s*/clas{0,2}/\\n\tvar ${1:class} = function(${20}) {\\n\t\t$40$0\\n\t};\\n\t\\n\t(function() {\\n\t\t${60:this.prop = \"\"}\\n\t}).call(${1:class}.prototype);\\n\t\\n\texports.${1:class} = ${1:class};\\n# \\nsnippet for-\\n\tfor (var ${1:i} = ${2:Things}.length; ${1:i}--; ) {\\n\t\t${0:${2:Things}[${1:i}];}\\n\t}\\n# for (...) {...}\\nsnippet for\\n\tfor (var ${1:i} = 0; $1 < ${2:Things}.length; $1++) {\\n\t\t${3:$2[$1]}$0\\n\t}\\n# for (...) {...} (Improved Native For-Loop)\\nsnippet forr\\n\tfor (var ${1:i} = ${2:Things}.length - 1; $1 >= 0; $1--) {\\n\t\t${3:$2[$1]}$0\\n\t}\\n\\n\\n#modules\\nsnippet def\\n\tdefine(function(require, exports, module) {\\n\t\"use strict\";\\n\tvar ${1/.*\\\\///} = require(\"${1}\");\\n\t\\n\t$TM_SELECTED_TEXT\\n\t});\\nsnippet req\\nguard ^\\\\s*\\n\tvar ${1/.*\\\\///} = require(\"${1}\");\\n\t$0\\nsnippet requ\\nguard ^\\\\s*\\n\tvar ${1/.*\\\\/(.)/\\\\u$1/} = require(\"${1}\").${1/.*\\\\/(.)/\\\\u$1/};\\n\t$0\\n',t.scope=\"javascript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/json.js",
    "content": "define(\"ace/snippets/json\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"json\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/jsoniq.js",
    "content": "define(\"ace/snippets/jsoniq\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet for\\n\tfor $${1:item} in ${2:expr}\\nsnippet return\\n\treturn ${1:expr}\\nsnippet import\\n\timport module namespace ${1:ns} = \"${2:http://www.example.com/}\";\\nsnippet some\\n\tsome $${1:varname} in ${2:expr} satisfies ${3:expr}\\nsnippet every\\n\tevery $${1:varname} in ${2:expr} satisfies ${3:expr}\\nsnippet if\\n\tif(${1:true}) then ${2:expr} else ${3:true}\\nsnippet switch\\n\tswitch(${1:\"foo\"})\\n\tcase ${2:\"foo\"}\\n\treturn ${3:true}\\n\tdefault return ${4:false}\\nsnippet try\\n\ttry { ${1:expr} } catch ${2:*} { ${3:expr} }\\nsnippet tumbling\\n\tfor tumbling window $${1:varname} in ${2:expr}\\n\tstart at $${3:start} when ${4:expr}\\n\tend at $${5:end} when ${6:expr}\\n\treturn ${7:expr}\\nsnippet sliding\\n\tfor sliding window $${1:varname} in ${2:expr}\\n\tstart at $${3:start} when ${4:expr}\\n\tend at $${5:end} when ${6:expr}\\n\treturn ${7:expr}\\nsnippet let\\n\tlet $${1:varname} := ${2:expr}\\nsnippet group\\n\tgroup by $${1:varname} := ${2:expr}\\nsnippet order\\n\torder by ${1:expr} ${2:descending}\\nsnippet stable\\n\tstable order by ${1:expr}\\nsnippet count\\n\tcount $${1:varname}\\nsnippet ordered\\n\tordered { ${1:expr} }\\nsnippet unordered\\n\tunordered { ${1:expr} }\\nsnippet treat \\n\ttreat as ${1:expr}\\nsnippet castable\\n\tcastable as ${1:atomicType}\\nsnippet cast\\n\tcast as ${1:atomicType}\\nsnippet typeswitch\\n\ttypeswitch(${1:expr})\\n\tcase ${2:type}  return ${3:expr}\\n\tdefault return ${4:expr}\\nsnippet var\\n\tdeclare variable $${1:varname} := ${2:expr};\\nsnippet fn\\n\tdeclare function ${1:ns}:${2:name}(){\\n\t${3:expr}\\n\t};\\nsnippet module\\n\tmodule namespace ${1:ns} = \"${2:http://www.example.com}\";\\n',t.scope=\"jsoniq\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/jsp.js",
    "content": "define(\"ace/snippets/jsp\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet @page\\n\t<%@page contentType=\"text/html\" pageEncoding=\"UTF-8\"%>\\nsnippet jstl\\n\t<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\" %>\\n\t<%@ taglib uri=\"http://java.sun.com/jsp/jstl/functions\" prefix=\"fn\" %>\\nsnippet jstl:c\\n\t<%@ taglib uri=\"http://java.sun.com/jsp/jstl/core\" prefix=\"c\" %>\\nsnippet jstl:fn\\n\t<%@ taglib uri=\"http://java.sun.com/jsp/jstl/functions\" prefix=\"fn\" %>\\nsnippet cpath\\n\t${pageContext.request.contextPath}\\nsnippet cout\\n\t<c:out value=\"${1}\" default=\"${2}\" />\\nsnippet cset\\n\t<c:set var=\"${1}\" value=\"${2}\" />\\nsnippet cremove\\n\t<c:remove var=\"${1}\" scope=\"${2:page}\" />\\nsnippet ccatch\\n\t<c:catch var=\"${1}\" />\\nsnippet cif\\n\t<c:if test=\"${${1}}\">\\n\t\t${2}\\n\t</c:if>\\nsnippet cchoose\\n\t<c:choose>\\n\t\t${1}\\n\t</c:choose>\\nsnippet cwhen\\n\t<c:when test=\"${${1}}\">\\n\t\t${2}\\n\t</c:when>\\nsnippet cother\\n\t<c:otherwise>\\n\t\t${1}\\n\t</c:otherwise>\\nsnippet cfore\\n\t<c:forEach items=\"${${1}}\" var=\"${2}\" varStatus=\"${3}\">\\n\t\t${4:<c:out value=\"$2\" />}\\n\t</c:forEach>\\nsnippet cfort\\n\t<c:set var=\"${1}\">${2:item1,item2,item3}</c:set>\\n\t<c:forTokens var=\"${3}\" items=\"${$1}\" delims=\"${4:,}\">\\n\t\t${5:<c:out value=\"$3\" />}\\n\t</c:forTokens>\\nsnippet cparam\\n\t<c:param name=\"${1}\" value=\"${2}\" />\\nsnippet cparam+\\n\t<c:param name=\"${1}\" value=\"${2}\" />\\n\tcparam+${3}\\nsnippet cimport\\n\t<c:import url=\"${1}\" />\\nsnippet cimport+\\n\t<c:import url=\"${1}\">\\n\t\t<c:param name=\"${2}\" value=\"${3}\" />\\n\t\tcparam+${4}\\n\t</c:import>\\nsnippet curl\\n\t<c:url value=\"${1}\" var=\"${2}\" />\\n\t<a href=\"${$2}\">${3}</a>\\nsnippet curl+\\n\t<c:url value=\"${1}\" var=\"${2}\">\\n\t\t<c:param name=\"${4}\" value=\"${5}\" />\\n\t\tcparam+${6}\\n\t</c:url>\\n\t<a href=\"${$2}\">${3}</a>\\nsnippet credirect\\n\t<c:redirect url=\"${1}\" />\\nsnippet contains\\n\t${fn:contains(${1:string}, ${2:substr})}\\nsnippet contains:i\\n\t${fn:containsIgnoreCase(${1:string}, ${2:substr})}\\nsnippet endswith\\n\t${fn:endsWith(${1:string}, ${2:suffix})}\\nsnippet escape\\n\t${fn:escapeXml(${1:string})}\\nsnippet indexof\\n\t${fn:indexOf(${1:string}, ${2:substr})}\\nsnippet join\\n\t${fn:join(${1:collection}, ${2:delims})}\\nsnippet length\\n\t${fn:length(${1:collection_or_string})}\\nsnippet replace\\n\t${fn:replace(${1:string}, ${2:substr}, ${3:replace})}\\nsnippet split\\n\t${fn:split(${1:string}, ${2:delims})}\\nsnippet startswith\\n\t${fn:startsWith(${1:string}, ${2:prefix})}\\nsnippet substr\\n\t${fn:substring(${1:string}, ${2:begin}, ${3:end})}\\nsnippet substr:a\\n\t${fn:substringAfter(${1:string}, ${2:substr})}\\nsnippet substr:b\\n\t${fn:substringBefore(${1:string}, ${2:substr})}\\nsnippet lc\\n\t${fn:toLowerCase(${1:string})}\\nsnippet uc\\n\t${fn:toUpperCase(${1:string})}\\nsnippet trim\\n\t${fn:trim(${1:string})}\\n',t.scope=\"jsp\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/jsx.js",
    "content": "define(\"ace/snippets/jsx\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"jsx\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/julia.js",
    "content": "define(\"ace/snippets/julia\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"julia\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/latex.js",
    "content": "define(\"ace/snippets/latex\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"latex\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/less.js",
    "content": "define(\"ace/snippets/less\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"less\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/liquid.js",
    "content": "define(\"ace/snippets/liquid\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"liquid\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/lisp.js",
    "content": "define(\"ace/snippets/lisp\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"lisp\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/livescript.js",
    "content": "define(\"ace/snippets/livescript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"livescript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/logiql.js",
    "content": "define(\"ace/snippets/logiql\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"logiql\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/lsl.js",
    "content": "define(\"ace/snippets/lsl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet @\\n\t@${1:label};\\nsnippet CAMERA_ACTIVE\\n\tCAMERA_ACTIVE, ${1:integer isActive}, $0\\nsnippet CAMERA_BEHINDNESS_ANGLE\\n\tCAMERA_BEHINDNESS_ANGLE, ${1:float degrees}, $0\\nsnippet CAMERA_BEHINDNESS_LAG\\n\tCAMERA_BEHINDNESS_LAG, ${1:float seconds}, $0\\nsnippet CAMERA_DISTANCE\\n\tCAMERA_DISTANCE, ${1:float meters}, $0\\nsnippet CAMERA_FOCUS\\n\tCAMERA_FOCUS, ${1:vector position}, $0\\nsnippet CAMERA_FOCUS_LAG\\n\tCAMERA_FOCUS_LAG, ${1:float seconds}, $0\\nsnippet CAMERA_FOCUS_LOCKED\\n\tCAMERA_FOCUS_LOCKED, ${1:integer isLocked}, $0\\nsnippet CAMERA_FOCUS_OFFSET\\n\tCAMERA_FOCUS_OFFSET, ${1:vector meters}, $0\\nsnippet CAMERA_FOCUS_THRESHOLD\\n\tCAMERA_FOCUS_THRESHOLD, ${1:float meters}, $0\\nsnippet CAMERA_PITCH\\n\tCAMERA_PITCH, ${1:float degrees}, $0\\nsnippet CAMERA_POSITION\\n\tCAMERA_POSITION, ${1:vector position}, $0\\nsnippet CAMERA_POSITION_LAG\\n\tCAMERA_POSITION_LAG, ${1:float seconds}, $0\\nsnippet CAMERA_POSITION_LOCKED\\n\tCAMERA_POSITION_LOCKED, ${1:integer isLocked}, $0\\nsnippet CAMERA_POSITION_THRESHOLD\\n\tCAMERA_POSITION_THRESHOLD, ${1:float meters}, $0\\nsnippet CHARACTER_AVOIDANCE_MODE\\n\tCHARACTER_AVOIDANCE_MODE, ${1:integer flags}, $0\\nsnippet CHARACTER_DESIRED_SPEED\\n\tCHARACTER_DESIRED_SPEED, ${1:float speed}, $0\\nsnippet CHARACTER_DESIRED_TURN_SPEED\\n\tCHARACTER_DESIRED_TURN_SPEED, ${1:float speed}, $0\\nsnippet CHARACTER_LENGTH\\n\tCHARACTER_LENGTH, ${1:float length}, $0\\nsnippet CHARACTER_MAX_TURN_RADIUS\\n\tCHARACTER_MAX_TURN_RADIUS, ${1:float radius}, $0\\nsnippet CHARACTER_ORIENTATION\\n\tCHARACTER_ORIENTATION, ${1:integer orientation}, $0\\nsnippet CHARACTER_RADIUS\\n\tCHARACTER_RADIUS, ${1:float radius}, $0\\nsnippet CHARACTER_STAY_WITHIN_PARCEL\\n\tCHARACTER_STAY_WITHIN_PARCEL, ${1:boolean stay}, $0\\nsnippet CHARACTER_TYPE\\n\tCHARACTER_TYPE, ${1:integer type}, $0\\nsnippet HTTP_BODY_MAXLENGTH\\n\tHTTP_BODY_MAXLENGTH, ${1:integer length}, $0\\nsnippet HTTP_CUSTOM_HEADER\\n\tHTTP_CUSTOM_HEADER, ${1:string name}, ${2:string value}, $0\\nsnippet HTTP_METHOD\\n\tHTTP_METHOD, ${1:string method}, $0\\nsnippet HTTP_MIMETYPE\\n\tHTTP_MIMETYPE, ${1:string mimeType}, $0\\nsnippet HTTP_PRAGMA_NO_CACHE\\n\tHTTP_PRAGMA_NO_CACHE, ${1:integer send_header}, $0\\nsnippet HTTP_VERBOSE_THROTTLE\\n\tHTTP_VERBOSE_THROTTLE, ${1:integer noisy}, $0\\nsnippet HTTP_VERIFY_CERT\\n\tHTTP_VERIFY_CERT, ${1:integer verify}, $0\\nsnippet RC_DATA_FLAGS\\n\tRC_DATA_FLAGS, ${1:integer flags}, $0\\nsnippet RC_DETECT_PHANTOM\\n\tRC_DETECT_PHANTOM, ${1:integer dectedPhantom}, $0\\nsnippet RC_MAX_HITS\\n\tRC_MAX_HITS, ${1:integer maxHits}, $0\\nsnippet RC_REJECT_TYPES\\n\tRC_REJECT_TYPES, ${1:integer filterMask}, $0\\nsnippet at_rot_target\\n\tat_rot_target(${1:integer handle}, ${2:rotation targetrot}, ${3:rotation ourrot})\\n\t{\\n\t\t$0\\n\t}\\nsnippet at_target\\n\tat_target(${1:integer tnum}, ${2:vector targetpos}, ${3:vector ourpos})\\n\t{\\n\t\t$0\\n\t}\\nsnippet attach\\n\tattach(${1:key id})\\n\t{\\n\t\t$0\\n\t}\\nsnippet changed\\n\tchanged(${1:integer change})\\n\t{\\n\t\t$0\\n\t}\\nsnippet collision\\n\tcollision(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet collision_end\\n\tcollision_end(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet collision_start\\n\tcollision_start(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet control\\n\tcontrol(${1:key id}, ${2:integer level}, ${3:integer edge})\\n\t{\\n\t\t$0\\n\t}\\nsnippet dataserver\\n\tdataserver(${1:key query_id}, ${2:string data})\\n\t{\\n\t\t$0\\n\t}\\nsnippet do\\n\tdo\\n\t{\\n\t\t$0\\n\t}\\n\twhile (${1:condition});\\nsnippet else\\n\telse\\n\t{\\n\t\t$0\\n\t}\\nsnippet email\\n\temail(${1:string time}, ${2:string address}, ${3:string subject}, ${4:string message}, ${5:integer num_left})\\n\t{\\n\t\t$0\\n\t}\\nsnippet for\\n\tfor (${1:start}; ${3:condition}; ${3:step})\\n\t{\\n\t\t$0\\n\t}\\nsnippet http_request\\n\thttp_request(${1:key request_id}, ${2:string method}, ${3:string body})\\n\t{\\n\t\t$0\\n\t}\\nsnippet http_response\\n\thttp_response(${1:key request_id}, ${2:integer status}, ${3:list metadata}, ${4:string body})\\n\t{\\n\t\t$0\\n\t}\\nsnippet if\\n\tif (${1:condition})\\n\t{\\n\t\t$0\\n\t}\\nsnippet jump\\n\tjump ${1:label};\\nsnippet land_collision\\n\tland_collision(${1:vector pos})\\n\t{\\n\t\t$0\\n\t}\\nsnippet land_collision_end\\n\tland_collision_end(${1:vector pos})\\n\t{\\n\t\t$0\\n\t}\\nsnippet land_collision_start\\n\tland_collision_start(${1:vector pos})\\n\t{\\n\t\t$0\\n\t}\\nsnippet link_message\\n\tlink_message(${1:integer sender_num}, ${2:integer num}, ${3:string str}, ${4:key id})\\n\t{\\n\t\t$0\\n\t}\\nsnippet listen\\n\tlisten(${1:integer channel}, ${2:string name}, ${3:key id}, ${4:string message})\\n\t{\\n\t\t$0\\n\t}\\nsnippet llAbs\\n\tllAbs(${1:integer val})\\nsnippet llAcos\\n\tllAcos(${1:float val})\\nsnippet llAddToLandBanList\\n\tllAddToLandBanList(${1:key agent}, ${2:float hours});\\nsnippet llAddToLandPassList\\n\tllAddToLandPassList(${1:key agent}, ${2:float hours});\\nsnippet llAdjustSoundVolume\\n\tllAdjustSoundVolume(${1:float volume});\\nsnippet llAllowInventoryDrop\\n\tllAllowInventoryDrop(${1:integer add});\\nsnippet llAngleBetween\\n\tllAngleBetween(${1:rotation a}, ${2:rotation b})\\nsnippet llApplyImpulse\\n\tllApplyImpulse(${1:vector force}, ${2:integer local});\\nsnippet llApplyRotationalImpulse\\n\tllApplyRotationalImpulse(${1:vector force}, ${2:integer local});\\nsnippet llAsin\\n\tllAsin(${1:float val})\\nsnippet llAtan2\\n\tllAtan2(${1:float y}, ${2:float x})\\nsnippet llAttachToAvatar\\n\tllAttachToAvatar(${1:integer attach_point});\\nsnippet llAttachToAvatarTemp\\n\tllAttachToAvatarTemp(${1:integer attach_point});\\nsnippet llAvatarOnLinkSitTarget\\n\tllAvatarOnLinkSitTarget(${1:integer link})\\nsnippet llAvatarOnSitTarget\\n\tllAvatarOnSitTarget()\\nsnippet llAxes2Rot\\n\tllAxes2Rot(${1:vector fwd}, ${2:vector left}, ${3:vector up})\\nsnippet llAxisAngle2Rot\\n\tllAxisAngle2Rot(${1:vector axis}, ${2:float angle})\\nsnippet llBase64ToInteger\\n\tllBase64ToInteger(${1:string str})\\nsnippet llBase64ToString\\n\tllBase64ToString(${1:string str})\\nsnippet llBreakAllLinks\\n\tllBreakAllLinks();\\nsnippet llBreakLink\\n\tllBreakLink(${1:integer link});\\nsnippet llCastRay\\n\tllCastRay(${1:vector start}, ${2:vector end}, ${3:list options});\\nsnippet llCeil\\n\tllCeil(${1:float val})\\nsnippet llClearCameraParams\\n\tllClearCameraParams();\\nsnippet llClearLinkMedia\\n\tllClearLinkMedia(${1:integer link}, ${2:integer face});\\nsnippet llClearPrimMedia\\n\tllClearPrimMedia(${1:integer face});\\nsnippet llCloseRemoteDataChannel\\n\tllCloseRemoteDataChannel(${1:key channel});\\nsnippet llCollisionFilter\\n\tllCollisionFilter(${1:string name}, ${2:key id}, ${3:integer accept});\\nsnippet llCollisionSound\\n\tllCollisionSound(${1:string impact_sound}, ${2:float impact_volume});\\nsnippet llCos\\n\tllCos(${1:float theta})\\nsnippet llCreateCharacter\\n\tllCreateCharacter(${1:list options});\\nsnippet llCreateLink\\n\tllCreateLink(${1:key target}, ${2:integer parent});\\nsnippet llCSV2List\\n\tllCSV2List(${1:string src})\\nsnippet llDeleteCharacter\\n\tllDeleteCharacter();\\nsnippet llDeleteSubList\\n\tllDeleteSubList(${1:list src}, ${2:integer start}, ${3:integer end})\\nsnippet llDeleteSubString\\n\tllDeleteSubString(${1:string src}, ${2:integer start}, ${3:integer end})\\nsnippet llDetachFromAvatar\\n\tllDetachFromAvatar();\\nsnippet llDetectedGrab\\n\tllDetectedGrab(${1:integer number})\\nsnippet llDetectedGroup\\n\tllDetectedGroup(${1:integer number})\\nsnippet llDetectedKey\\n\tllDetectedKey(${1:integer number})\\nsnippet llDetectedLinkNumber\\n\tllDetectedLinkNumber(${1:integer number})\\nsnippet llDetectedName\\n\tllDetectedName(${1:integer number})\\nsnippet llDetectedOwner\\n\tllDetectedOwner(${1:integer number})\\nsnippet llDetectedPos\\n\tllDetectedPosl(${1:integer number})\\nsnippet llDetectedRot\\n\tllDetectedRot(${1:integer number})\\nsnippet llDetectedTouchBinormal\\n\tllDetectedTouchBinormal(${1:integer number})\\nsnippet llDetectedTouchFace\\n\tllDetectedTouchFace(${1:integer number})\\nsnippet llDetectedTouchNormal\\n\tllDetectedTouchNormal(${1:integer number})\\nsnippet llDetectedTouchPos\\n\tllDetectedTouchPos(${1:integer number})\\nsnippet llDetectedTouchST\\n\tllDetectedTouchST(${1:integer number})\\nsnippet llDetectedTouchUV\\n\tllDetectedTouchUV(${1:integer number})\\nsnippet llDetectedType\\n\tllDetectedType(${1:integer number})\\nsnippet llDetectedVel\\n\tllDetectedVel(${1:integer number})\\nsnippet llDialog\\n\tllDialog(${1:key agent}, ${2:string message}, ${3:list buttons}, ${4:integer channel});\\nsnippet llDie\\n\tllDie();\\nsnippet llDumpList2String\\n\tllDumpList2String(${1:list src}, ${2:string separator})\\nsnippet llEdgeOfWorld\\n\tllEdgeOfWorld(${1:vector pos}, ${2:vector dir})\\nsnippet llEjectFromLand\\n\tllEjectFromLand(${1:key agent});\\nsnippet llEmail\\n\tllEmail(${1:string address}, ${2:string subject}, ${3:string message});\\nsnippet llEscapeURL\\n\tllEscapeURL(${1:string url})\\nsnippet llEuler2Rot\\n\tllEuler2Rot(${1:vector v})\\nsnippet llExecCharacterCmd\\n\tllExecCharacterCmd(${1:integer command}, ${2:list options});\\nsnippet llEvade\\n\tllEvade(${1:key target}, ${2:list options});\\nsnippet llFabs\\n\tllFabs(${1:float val})\\nsnippet llFleeFrom\\n\tllFleeFrom(${1:vector position}, ${2:float distance}, ${3:list options});\\nsnippet llFloor\\n\tllFloor(${1:float val})\\nsnippet llForceMouselook\\n\tllForceMouselook(${1:integer mouselook});\\nsnippet llFrand\\n\tllFrand(${1:float mag})\\nsnippet llGenerateKey\\n\tllGenerateKey()\\nsnippet llGetAccel\\n\tllGetAccel()\\nsnippet llGetAgentInfo\\n\tllGetAgentInfo(${1:key id})\\nsnippet llGetAgentLanguage\\n\tllGetAgentLanguage(${1:key agent})\\nsnippet llGetAgentList\\n\tllGetAgentList(${1:integer scope}, ${2:list options})\\nsnippet llGetAgentSize\\n\tllGetAgentSize(${1:key agent})\\nsnippet llGetAlpha\\n\tllGetAlpha(${1:integer face})\\nsnippet llGetAndResetTime\\n\tllGetAndResetTime()\\nsnippet llGetAnimation\\n\tllGetAnimation(${1:key id})\\nsnippet llGetAnimationList\\n\tllGetAnimationList(${1:key agent})\\nsnippet llGetAnimationOverride\\n\tllGetAnimationOverride(${1:string anim_state})\\nsnippet llGetAttached\\n\tllGetAttached()\\nsnippet llGetBoundingBox\\n\tllGetBoundingBox(${1:key object})\\nsnippet llGetCameraPos\\n\tllGetCameraPos()\\nsnippet llGetCameraRot\\n\tllGetCameraRot()\\nsnippet llGetCenterOfMass\\n\tllGetCenterOfMass()\\nsnippet llGetClosestNavPoint\\n\tllGetClosestNavPoint(${1:vector point}, ${2:list options})\\nsnippet llGetColor\\n\tllGetColor(${1:integer face})\\nsnippet llGetCreator\\n\tllGetCreator()\\nsnippet llGetDate\\n\tllGetDate()\\nsnippet llGetDisplayName\\n\tllGetDisplayName(${1:key id})\\nsnippet llGetEnergy\\n\tllGetEnergy()\\nsnippet llGetEnv\\n\tllGetEnv(${1:string name})\\nsnippet llGetForce\\n\tllGetForce()\\nsnippet llGetFreeMemory\\n\tllGetFreeMemory()\\nsnippet llGetFreeURLs\\n\tllGetFreeURLs()\\nsnippet llGetGeometricCenter\\n\tllGetGeometricCenter()\\nsnippet llGetGMTclock\\n\tllGetGMTclock()\\nsnippet llGetHTTPHeader\\n\tllGetHTTPHeader(${1:key request_id}, ${2:string header})\\nsnippet llGetInventoryCreator\\n\tllGetInventoryCreator(${1:string item})\\nsnippet llGetInventoryKey\\n\tllGetInventoryKey(${1:string name})\\nsnippet llGetInventoryName\\n\tllGetInventoryName(${1:integer type}, ${2:integer number})\\nsnippet llGetInventoryNumber\\n\tllGetInventoryNumber(${1:integer type})\\nsnippet llGetInventoryPermMask\\n\tllGetInventoryPermMask(${1:string item}, ${2:integer mask})\\nsnippet llGetInventoryType\\n\tllGetInventoryType(${1:string name})\\nsnippet llGetKey\\n\tllGetKey()\\nsnippet llGetLandOwnerAt\\n\tllGetLandOwnerAt(${1:vector pos})\\nsnippet llGetLinkKey\\n\tllGetLinkKey(${1:integer link})\\nsnippet llGetLinkMedia\\n\tllGetLinkMedia(${1:integer link}, ${2:integer face}, ${3:list params})\\nsnippet llGetLinkName\\n\tllGetLinkName(${1:integer link})\\nsnippet llGetLinkNumber\\n\tllGetLinkNumber()\\nsnippet llGetLinkNumberOfSides\\n\tllGetLinkNumberOfSides(${1:integer link})\\nsnippet llGetLinkPrimitiveParams\\n\tllGetLinkPrimitiveParams(${1:integer link}, ${2:list params})\\nsnippet llGetListEntryType\\n\tllGetListEntryType(${1:list src}, ${2:integer index})\\nsnippet llGetListLength\\n\tllGetListLength(${1:list src})\\nsnippet llGetLocalPos\\n\tllGetLocalPos()\\nsnippet llGetLocalRot\\n\tllGetLocalRot()\\nsnippet llGetMass\\n\tllGetMass()\\nsnippet llGetMassMKS\\n\tllGetMassMKS()\\nsnippet llGetMaxScaleFactor\\n\tllGetMaxScaleFactor()\\nsnippet llGetMemoryLimit\\n\tllGetMemoryLimit()\\nsnippet llGetMinScaleFactor\\n\tllGetMinScaleFactor()\\nsnippet llGetNextEmail\\n\tllGetNextEmail(${1:string address}, ${2:string subject});\\nsnippet llGetNotecardLine\\n\tllGetNotecardLine(${1:string name}, ${2:integer line})\\nsnippet llGetNumberOfNotecardLines\\n\tllGetNumberOfNotecardLines(${1:string name})\\nsnippet llGetNumberOfPrims\\n\tllGetNumberOfPrims()\\nsnippet llGetNumberOfSides\\n\tllGetNumberOfSides()\\nsnippet llGetObjectDesc\\n\tllGetObjectDesc()\\nsnippet llGetObjectDetails\\n\tllGetObjectDetails(${1:key id}, ${2:list params})\\nsnippet llGetObjectMass\\n\tllGetObjectMass(${1:key id})\\nsnippet llGetObjectName\\n\tllGetObjectName()\\nsnippet llGetObjectPermMask\\n\tllGetObjectPermMask(${1:integer mask})\\nsnippet llGetObjectPrimCount\\n\tllGetObjectPrimCount(${1:key prim})\\nsnippet llGetOmega\\n\tllGetOmega()\\nsnippet llGetOwner\\n\tllGetOwner()\\nsnippet llGetOwnerKey\\n\tllGetOwnerKey(${1:key id})\\nsnippet llGetParcelDetails\\n\tllGetParcelDetails(${1:vector pos}, ${2:list params})\\nsnippet llGetParcelFlags\\n\tllGetParcelFlags(${1:vector pos})\\nsnippet llGetParcelMaxPrims\\n\tllGetParcelMaxPrims(${1:vector pos}, ${2:integer sim_wide})\\nsnippet llGetParcelMusicURL\\n\tllGetParcelMusicURL()\\nsnippet llGetParcelPrimCount\\n\tllGetParcelPrimCount(${1:vector pos}, ${2:integer category}, ${3:integer sim_wide})\\nsnippet llGetParcelPrimOwners\\n\tllGetParcelPrimOwners(${1:vector pos})\\nsnippet llGetPermissions\\n\tllGetPermissions()\\nsnippet llGetPermissionsKey\\n\tllGetPermissionsKey()\\nsnippet llGetPhysicsMaterial\\n\tllGetPhysicsMaterial()\\nsnippet llGetPos\\n\tllGetPos()\\nsnippet llGetPrimitiveParams\\n\tllGetPrimitiveParams(${1:list params})\\nsnippet llGetPrimMediaParams\\n\tllGetPrimMediaParams(${1:integer face}, ${2:list params})\\nsnippet llGetRegionAgentCount\\n\tllGetRegionAgentCount()\\nsnippet llGetRegionCorner\\n\tllGetRegionCorner()\\nsnippet llGetRegionFlags\\n\tllGetRegionFlags()\\nsnippet llGetRegionFPS\\n\tllGetRegionFPS()\\nsnippet llGetRegionName\\n\tllGetRegionName()\\nsnippet llGetRegionTimeDilation\\n\tllGetRegionTimeDilation()\\nsnippet llGetRootPosition\\n\tllGetRootPosition()\\nsnippet llGetRootRotation\\n\tllGetRootRotation()\\nsnippet llGetRot\\n\tllGetRot()\\nsnippet llGetScale\\n\tllGetScale()\\nsnippet llGetScriptName\\n\tllGetScriptName()\\nsnippet llGetScriptState\\n\tllGetScriptState(${1:string script})\\nsnippet llGetSimStats\\n\tllGetSimStats(${1:integer stat_type})\\nsnippet llGetSimulatorHostname\\n\tllGetSimulatorHostname()\\nsnippet llGetSPMaxMemory\\n\tllGetSPMaxMemory()\\nsnippet llGetStartParameter\\n\tllGetStartParameter()\\nsnippet llGetStaticPath\\n\tllGetStaticPath(${1:vector start}, ${2:vector end}, ${3:float radius}, ${4:list params})\\nsnippet llGetStatus\\n\tllGetStatus(${1:integer status})\\nsnippet llGetSubString\\n\tllGetSubString(${1:string src}, ${2:integer start}, ${3:integer end})\\nsnippet llGetSunDirection\\n\tllGetSunDirection()\\nsnippet llGetTexture\\n\tllGetTexture(${1:integer face})\\nsnippet llGetTextureOffset\\n\tllGetTextureOffset(${1:integer face})\\nsnippet llGetTextureRot\\n\tllGetTextureRot(${1:integer face})\\nsnippet llGetTextureScale\\n\tllGetTextureScale(${1:integer face})\\nsnippet llGetTime\\n\tllGetTime()\\nsnippet llGetTimeOfDay\\n\tllGetTimeOfDay()\\nsnippet llGetTimestamp\\n\tllGetTimestamp()\\nsnippet llGetTorque\\n\tllGetTorque()\\nsnippet llGetUnixTime\\n\tllGetUnixTime()\\nsnippet llGetUsedMemory\\n\tllGetUsedMemory()\\nsnippet llGetUsername\\n\tllGetUsername(${1:key id})\\nsnippet llGetVel\\n\tllGetVel()\\nsnippet llGetWallclock\\n\tllGetWallclock()\\nsnippet llGiveInventory\\n\tllGiveInventory(${1:key destination}, ${2:string inventory});\\nsnippet llGiveInventoryList\\n\tllGiveInventoryList(${1:key target}, ${2:string folder}, ${3:list inventory});\\nsnippet llGiveMoney\\n\tllGiveMoney(${1:key destination}, ${2:integer amount})\\nsnippet llGround\\n\tllGround(${1:vector offset})\\nsnippet llGroundContour\\n\tllGroundContour(${1:vector offset})\\nsnippet llGroundNormal\\n\tllGroundNormal(${1:vector offset})\\nsnippet llGroundRepel\\n\tllGroundRepel(${1:float height}, ${2:integer water}, ${3:float tau});\\nsnippet llGroundSlope\\n\tllGroundSlope(${1:vector offset})\\nsnippet llHTTPRequest\\n\tllHTTPRequest(${1:string url}, ${2:list parameters}, ${3:string body})\\nsnippet llHTTPResponse\\n\tllHTTPResponse(${1:key request_id}, ${2:integer status}, ${3:string body});\\nsnippet llInsertString\\n\tllInsertString(${1:string dst}, ${2:integer pos}, ${3:string src})\\nsnippet llInstantMessage\\n\tllInstantMessage(${1:key user}, ${2:string message});\\nsnippet llIntegerToBase64\\n\tllIntegerToBase64(${1:integer number})\\nsnippet llJson2List\\n\tllJson2List(${1:string json})\\nsnippet llJsonGetValue\\n\tllJsonGetValue(${1:string json}, ${2:list specifiers})\\nsnippet llJsonSetValue\\n\tllJsonSetValue(${1:string json}, ${2:list specifiers}, ${3:string newValue})\\nsnippet llJsonValueType\\n\tllJsonValueType(${1:string json}, ${2:list specifiers})\\nsnippet llKey2Name\\n\tllKey2Name(${1:key id})\\nsnippet llLinkParticleSystem\\n\tllLinkParticleSystem(${1:integer link}, ${2:list rules});\\nsnippet llLinkSitTarget\\n\tllLinkSitTarget(${1:integer link}, ${2:vector offset}, ${3:rotation rot});\\nsnippet llList2CSV\\n\tllList2CSV(${1:list src})\\nsnippet llList2Float\\n\tllList2Float(${1:list src}, ${2:integer index})\\nsnippet llList2Integer\\n\tllList2Integer(${1:list src}, ${2:integer index})\\nsnippet llList2Json\\n\tllList2Json(${1:string type}, ${2:list values})\\nsnippet llList2Key\\n\tllList2Key(${1:list src}, ${2:integer index})\\nsnippet llList2List\\n\tllList2List(${1:list src}, ${2:integer start}, ${3:integer end})\\nsnippet llList2ListStrided\\n\tllList2ListStrided(${1:list src}, ${2:integer start}, ${3:integer end}, ${4:integer stride})\\nsnippet llList2Rot\\n\tllList2Rot(${1:list src}, ${2:integer index})\\nsnippet llList2String\\n\tllList2String(${1:list src}, ${2:integer index})\\nsnippet llList2Vector\\n\tllList2Vector(${1:list src}, ${2:integer index})\\nsnippet llListen\\n\tllListen(${1:integer channel}, ${2:string name}, ${3:key id}, ${4:string msg})\\nsnippet llListenControl\\n\tllListenControl(${1:integer handle}, ${2:integer active});\\nsnippet llListenRemove\\n\tllListenRemove(${1:integer handle});\\nsnippet llListFindList\\n\tllListFindList(${1:list src}, ${2:list test})\\nsnippet llListInsertList\\n\tllListInsertList(${1:list dest}, ${2:list src}, ${3:integer start})\\nsnippet llListRandomize\\n\tllListRandomize(${1:list src}, ${2:integer stride})\\nsnippet llListReplaceList\\n\tllListReplaceList(${1:list dest}, ${2:list src}, ${3:integer start}, ${4:integer end})\\nsnippet llListSort\\n\tllListSort(${1:list src}, ${2:integer stride}, ${3:integer ascending})\\nsnippet llListStatistics\\n\tllListStatistics(${1:integer operation}, ${2:list src})\\nsnippet llLoadURL\\n\tllLoadURL(${1:key agent}, ${2:string message}, ${3:string url});\\nsnippet llLog\\n\tllLog(${1:float val})\\nsnippet llLog10\\n\tllLog10(${1:float val})\\nsnippet llLookAt\\n\tllLookAt(${1:vector target}, ${2:float strength}, ${3:float damping});\\nsnippet llLoopSound\\n\tllLoopSound(${1:string sound}, ${2:float volume});\\nsnippet llLoopSoundMaster\\n\tllLoopSoundMaster(${1:string sound}, ${2:float volume});\\nsnippet llLoopSoundSlave\\n\tllLoopSoundSlave(${1:string sound}, ${2:float volume});\\nsnippet llManageEstateAccess\\n\tllManageEstateAccess(${1:integer action}, ${2:key agent})\\nsnippet llMapDestination\\n\tllMapDestination(${1:string simname}, ${2:vector pos}, ${3:vector look_at});\\nsnippet llMD5String\\n\tllMD5String(${1:string src}, ${2:integer nonce})\\nsnippet llMessageLinked\\n\tllMessageLinked(${1:integer link}, ${2:integer num}, ${3:string str}, ${4:key id});\\nsnippet llMinEventDelay\\n\tllMinEventDelay(${1:float delay});\\nsnippet llModifyLand\\n\tllModifyLand(${1:integer action}, ${2:integer brush});\\nsnippet llModPow\\n\tllModPow(${1:integer a}, ${2:integer b}, ${3:integer c})\\nsnippet llMoveToTarget\\n\tllMoveToTarget(${1:vector target}, ${2:float tau});\\nsnippet llNavigateTo\\n\tllNavigateTo(${1:vector pos}, ${2:list options});\\nsnippet llOffsetTexture\\n\tllOffsetTexture(${1:float u}, ${2:float v}, ${3:integer face});\\nsnippet llOpenRemoteDataChannel\\n\tllOpenRemoteDataChannel();\\nsnippet llOverMyLand\\n\tllOverMyLand(${1:key id})\\nsnippet llOwnerSay\\n\tllOwnerSay(${1:string msg});\\nsnippet llParcelMediaCommandList\\n\tllParcelMediaCommandList(${1:list commandList});\\nsnippet llParcelMediaQuery\\n\tllParcelMediaQuery(${1:list query})\\nsnippet llParseString2List\\n\tllParseString2List(${1:string src}, ${2:list separators}, ${3:list spacers})\\nsnippet llParseStringKeepNulls\\n\tllParseStringKeepNulls(${1:string src}, ${2:list separators}, ${3:list spacers})\\nsnippet llParticleSystem\\n\tllParticleSystem(${1:list rules});\\nsnippet llPassCollisions\\n\tllPassCollisions(${1:integer pass});\\nsnippet llPassTouches\\n\tllPassTouches(${1:integer pass});\\nsnippet llPatrolPoints\\n\tllPatrolPoints(${1:list patrolPoints}, ${2:list options});\\nsnippet llPlaySound\\n\tllPlaySound(${1:string sound}, ${2:float volume});\\nsnippet llPlaySoundSlave\\n\tllPlaySoundSlave(${1:string sound}, ${2:float volume});\\nsnippet llPow\\n\tllPow(${1:float base}, ${2:float exponent})\\nsnippet llPreloadSound\\n\tllPreloadSound(${1:string sound});\\nsnippet llPursue\\n\tllPursue(${1:key target}, ${2:list options});\\nsnippet llPushObject\\n\tllPushObject(${1:key target}, ${2:vector impulse}, ${3:vector ang_impulse}, ${4:integer local});\\nsnippet llRegionSay\\n\tllRegionSay(${1:integer channel}, ${2:string msg});\\nsnippet llRegionSayTo\\n\tllRegionSayTo(${1:key target}, ${2:integer channel}, ${3:string msg});\\nsnippet llReleaseControls\\n\tllReleaseControls();\\nsnippet llReleaseURL\\n\tllReleaseURL(${1:string url});\\nsnippet llRemoteDataReply\\n\tllRemoteDataReply(${1:key channel}, ${2:key message_id}, ${3:string sdata}, ${4:integer idata});\\nsnippet llRemoteLoadScriptPin\\n\tllRemoteLoadScriptPin(${1:key target}, ${2:string name}, ${3:integer pin}, ${4:integer running}, ${5:integer start_param});\\nsnippet llRemoveFromLandBanList\\n\tllRemoveFromLandBanList(${1:key agent});\\nsnippet llRemoveFromLandPassList\\n\tllRemoveFromLandPassList(${1:key agent});\\nsnippet llRemoveInventory\\n\tllRemoveInventory(${1:string item});\\nsnippet llRemoveVehicleFlags\\n\tllRemoveVehicleFlags(${1:integer flags});\\nsnippet llRequestAgentData\\n\tllRequestAgentData(${1:key id}, ${2:integer data})\\nsnippet llRequestDisplayName\\n\tllRequestDisplayName(${1:key id})\\nsnippet llRequestInventoryData\\n\tllRequestInventoryData(${1:string name})\\nsnippet llRequestPermissions\\n\tllRequestPermissions(${1:key agent}, ${2:integer permissions})\\nsnippet llRequestSecureURL\\n\tllRequestSecureURL()\\nsnippet llRequestSimulatorData\\n\tllRequestSimulatorData(${1:string region}, ${2:integer data})\\nsnippet llRequestURL\\n\tllRequestURL()\\nsnippet llRequestUsername\\n\tllRequestUsername(${1:key id})\\nsnippet llResetAnimationOverride\\n\tllResetAnimationOverride(${1:string anim_state});\\nsnippet llResetLandBanList\\n\tllResetLandBanList();\\nsnippet llResetLandPassList\\n\tllResetLandPassList();\\nsnippet llResetOtherScript\\n\tllResetOtherScript(${1:string name});\\nsnippet llResetScript\\n\tllResetScript();\\nsnippet llResetTime\\n\tllResetTime();\\nsnippet llReturnObjectsByID\\n\tllReturnObjectsByID(${1:list objects})\\nsnippet llReturnObjectsByOwner\\n\tllReturnObjectsByOwner(${1:key owner}, ${2:integer scope})\\nsnippet llRezAtRoot\\n\tllRezAtRoot(${1:string inventory}, ${2:vector position}, ${3:vector velocity}, ${4:rotation rot}, ${5:integer param});\\nsnippet llRezObject\\n\tllRezObject(${1:string inventory}, ${2:vector pos}, ${3:vector vel}, ${4:rotation rot}, ${5:integer param});\\nsnippet llRot2Angle\\n\tllRot2Angle(${1:rotation rot})\\nsnippet llRot2Axis\\n\tllRot2Axis(${1:rotation rot})\\nsnippet llRot2Euler\\n\tllRot2Euler(${1:rotation quat})\\nsnippet llRot2Fwd\\n\tllRot2Fwd(${1:rotation q})\\nsnippet llRot2Left\\n\tllRot2Left(${1:rotation q})\\nsnippet llRot2Up\\n\tllRot2Up(${1:rotation q})\\nsnippet llRotateTexture\\n\tllRotateTexture(${1:float angle}, ${2:integer face});\\nsnippet llRotBetween\\n\tllRotBetween(${1:vector start}, ${2:vector end})\\nsnippet llRotLookAt\\n\tllRotLookAt(${1:rotation target_direction}, ${2:float strength}, ${3:float damping});\\nsnippet llRotTarget\\n\tllRotTarget(${1:rotation rot}, ${2:float error})\\nsnippet llRotTargetRemove\\n\tllRotTargetRemove(${1:integer handle});\\nsnippet llRound\\n\tllRound(${1:float val})\\nsnippet llSameGroup\\n\tllSameGroup(${1:key group})\\nsnippet llSay\\n\tllSay(${1:integer channel}, ${2:string msg});\\nsnippet llScaleByFactor\\n\tllScaleByFactor(${1:float scaling_factor})\\nsnippet llScaleTexture\\n\tllScaleTexture(${1:float u}, ${2:float v}, ${3:integer face});\\nsnippet llScriptDanger\\n\tllScriptDanger(${1:vector pos})\\nsnippet llScriptProfiler\\n\tllScriptProfiler(${1:integer flags});\\nsnippet llSendRemoteData\\n\tllSendRemoteData(${1:key channel}, ${2:string dest}, ${3:integer idata}, ${4:string sdata})\\nsnippet llSensor\\n\tllSensor(${1:string name}, ${2:key id}, ${3:integer type}, ${4:float range}, ${5:float arc});\\nsnippet llSensorRepeat\\n\tllSensorRepeat(${1:string name}, ${2:key id}, ${3:integer type}, ${4:float range}, ${5:float arc}, ${6:float rate});\\nsnippet llSetAlpha\\n\tllSetAlpha(${1:float alpha}, ${2:integer face});\\nsnippet llSetAngularVelocity\\n\tllSetAngularVelocity(${1:vector force}, ${2:integer local});\\nsnippet llSetAnimationOverride\\n\tllSetAnimationOverride(${1:string anim_state}, ${2:string anim})\\nsnippet llSetBuoyancy\\n\tllSetBuoyancy(${1:float buoyancy});\\nsnippet llSetCameraAtOffset\\n\tllSetCameraAtOffset(${1:vector offset});\\nsnippet llSetCameraEyeOffset\\n\tllSetCameraEyeOffset(${1:vector offset});\\nsnippet llSetCameraParams\\n\tllSetCameraParams(${1:list rules});\\nsnippet llSetClickAction\\n\tllSetClickAction(${1:integer action});\\nsnippet llSetColor\\n\tllSetColor(${1:vector color}, ${2:integer face});\\nsnippet llSetContentType\\n\tllSetContentType(${1:key request_id}, ${2:integer content_type});\\nsnippet llSetDamage\\n\tllSetDamage(${1:float damage});\\nsnippet llSetForce\\n\tllSetForce(${1:vector force}, ${2:integer local});\\nsnippet llSetForceAndTorque\\n\tllSetForceAndTorque(${1:vector force}, ${2:vector torque}, ${3:integer local});\\nsnippet llSetHoverHeight\\n\tllSetHoverHeight(${1:float height}, ${2:integer water}, ${3:float tau});\\nsnippet llSetKeyframedMotion\\n\tllSetKeyframedMotion(${1:list keyframes}, ${2:list options});\\nsnippet llSetLinkAlpha\\n\tllSetLinkAlpha(${1:integer link}, ${2:float alpha}, ${3:integer face});\\nsnippet llSetLinkCamera\\n\tllSetLinkCamera(${1:integer link}, ${2:vector eye}, ${3:vector at});\\nsnippet llSetLinkColor\\n\tllSetLinkColor(${1:integer link}, ${2:vector color}, ${3:integer face});\\nsnippet llSetLinkMedia\\n\tllSetLinkMedia(${1:integer link}, ${2:integer face}, ${3:list params});\\nsnippet llSetLinkPrimitiveParams\\n\tllSetLinkPrimitiveParams(${1:integer link}, ${2:list rules});\\nsnippet llSetLinkPrimitiveParamsFast\\n\tllSetLinkPrimitiveParamsFast(${1:integer link}, ${2:list rules});\\nsnippet llSetLinkTexture\\n\tllSetLinkTexture(${1:integer link}, ${2:string texture}, ${3:integer face});\\nsnippet llSetLinkTextureAnim\\n\tllSetLinkTextureAnim(${1:integer link}, ${2:integer mode}, ${3:integer face}, ${4:integer sizex}, ${5:integer sizey}, ${6:float start}, ${7:float length}, ${8:float rate});\\nsnippet llSetLocalRot\\n\tllSetLocalRot(${1:rotation rot});\\nsnippet llSetMemoryLimit\\n\tllSetMemoryLimit(${1:integer limit})\\nsnippet llSetObjectDesc\\n\tllSetObjectDesc(${1:string description});\\nsnippet llSetObjectName\\n\tllSetObjectName(${1:string name});\\nsnippet llSetParcelMusicURL\\n\tllSetParcelMusicURL(${1:string url});\\nsnippet llSetPayPrice\\n\tllSetPayPrice(${1:integer price}, [${2:integer price_button_a}, ${3:integer price_button_b}, ${4:integer price_button_c}, ${5:integer price_button_d}]);\\nsnippet llSetPhysicsMaterial\\n\tllSetPhysicsMaterial(${1:integer mask}, ${2:float gravity_multiplier}, ${3:float restitution}, ${4:float friction}, ${5:float density});\\nsnippet llSetPos\\n\tllSetPos(${1:vector pos});\\nsnippet llSetPrimitiveParams\\n\tllSetPrimitiveParams(${1:list rules});\\nsnippet llSetPrimMediaParams\\n\tllSetPrimMediaParams(${1:integer face}, ${2:list params});\\nsnippet llSetRegionPos\\n\tllSetRegionPos(${1:vector position})\\nsnippet llSetRemoteScriptAccessPin\\n\tllSetRemoteScriptAccessPin(${1:integer pin});\\nsnippet llSetRot\\n\tllSetRot(${1:rotation rot});\\nsnippet llSetScale\\n\tllSetScale(${1:vector size});\\nsnippet llSetScriptState\\n\tllSetScriptState(${1:string name}, ${2:integer run});\\nsnippet llSetSitText\\n\tllSetSitText(${1:string text});\\nsnippet llSetSoundQueueing\\n\tllSetSoundQueueing(${1:integer queue});\\nsnippet llSetSoundRadius\\n\tllSetSoundRadius(${1:float radius});\\nsnippet llSetStatus\\n\tllSetStatus(${1:integer status}, ${2:integer value});\\nsnippet llSetText\\n\tllSetText(${1:string text}, ${2:vector color}, ${3:float alpha});\\nsnippet llSetTexture\\n\tllSetTexture(${1:string texture}, ${2:integer face});\\nsnippet llSetTextureAnim\\n\tllSetTextureAnim(${1:integer mode}, ${2:integer face}, ${3:integer sizex}, ${4:integer sizey}, ${5:float start}, ${6:float length}, ${7:float rate});\\nsnippet llSetTimerEvent\\n\tllSetTimerEvent(${1:float sec});\\nsnippet llSetTorque\\n\tllSetTorque(${1:vector torque}, ${2:integer local});\\nsnippet llSetTouchText\\n\tllSetTouchText(${1:string text});\\nsnippet llSetVehicleFlags\\n\tllSetVehicleFlags(${1:integer flags});\\nsnippet llSetVehicleFloatParam\\n\tllSetVehicleFloatParam(${1:integer param}, ${2:float value});\\nsnippet llSetVehicleRotationParam\\n\tllSetVehicleRotationParam(${1:integer param}, ${2:rotation rot});\\nsnippet llSetVehicleType\\n\tllSetVehicleType(${1:integer type});\\nsnippet llSetVehicleVectorParam\\n\tllSetVehicleVectorParam(${1:integer param}, ${2:vector vec});\\nsnippet llSetVelocity\\n\tllSetVelocity(${1:vector force}, ${2:integer local});\\nsnippet llSHA1String\\n\tllSHA1String(${1:string src})\\nsnippet llShout\\n\tllShout(${1:integer channel}, ${2:string msg});\\nsnippet llSin\\n\tllSin(${1:float theta})\\nsnippet llSitTarget\\n\tllSitTarget(${1:vector offset}, ${2:rotation rot});\\nsnippet llSleep\\n\tllSleep(${1:float sec});\\nsnippet llSqrt\\n\tllSqrt(${1:float val})\\nsnippet llStartAnimation\\n\tllStartAnimation(${1:string anim});\\nsnippet llStopAnimation\\n\tllStopAnimation(${1:string anim});\\nsnippet llStopHover\\n\tllStopHover();\\nsnippet llStopLookAt\\n\tllStopLookAt();\\nsnippet llStopMoveToTarget\\n\tllStopMoveToTarget();\\nsnippet llStopSound\\n\tllStopSound();\\nsnippet llStringLength\\n\tllStringLength(${1:string str})\\nsnippet llStringToBase64\\n\tllStringToBase64(${1:string str})\\nsnippet llStringTrim\\n\tllStringTrim(${1:string src}, ${2:integer type})\\nsnippet llSubStringIndex\\n\tllSubStringIndex(${1:string source}, ${2:string pattern})\\nsnippet llTakeControls\\n\tllTakeControls(${1:integer controls}, ${2:integer accept}, ${3:integer pass_on});\\nsnippet llTan\\n\tllTan(${1:float theta})\\nsnippet llTarget\\n\tllTarget(${1:vector position}, ${2:float range})\\nsnippet llTargetOmega\\n\tllTargetOmega(${1:vector axis}, ${2:float spinrate}, ${3:float gain});\\nsnippet llTargetRemove\\n\tllTargetRemove(${1:integer handle});\\nsnippet llTeleportAgent\\n\tllTeleportAgent(${1:key agent}, ${2:string landmark}, ${3:vector position}, ${4:vector look_at});\\nsnippet llTeleportAgentGlobalCoords\\n\tllTeleportAgentGlobalCoords(${1:key agent}, ${2:vector global_coordinates}, ${3:vector region_coordinates}, ${4:vector look_at});\\nsnippet llTeleportAgentHome\\n\tllTeleportAgentHome(${1:key agent});\\nsnippet llTextBox\\n\tllTextBox(${1:key agent}, ${2:string message}, ${3:integer channel});\\nsnippet llToLower\\n\tllToLower(${1:string src})\\nsnippet llToUpper\\n\tllToUpper(${1:string src})\\nsnippet llTransferLindenDollars\\n\tllTransferLindenDollars(${1:key destination}, ${2:integer amount})\\nsnippet llTriggerSound\\n\tllTriggerSound(${1:string sound}, ${2:float volume});\\nsnippet llTriggerSoundLimited\\n\tllTriggerSoundLimited(${1:string sound}, ${2:float volume}, ${3:vector top_north_east}, ${4:vector bottom_south_west});\\nsnippet llUnescapeURL\\n\tllUnescapeURL(${1:string url})\\nsnippet llUnSit\\n\tllUnSit(${1:key id});\\nsnippet llUpdateCharacter\\n\tllUpdateCharacter(${1:list options})\\nsnippet llVecDist\\n\tllVecDist(${1:vector vec_a}, ${2:vector vec_b})\\nsnippet llVecMag\\n\tllVecMag(${1:vector vec})\\nsnippet llVecNorm\\n\tllVecNorm(${1:vector vec})\\nsnippet llVolumeDetect\\n\tllVolumeDetect(${1:integer detect});\\nsnippet llWanderWithin\\n\tllWanderWithin(${1:vector origin}, ${2:vector dist}, ${3:list options});\\nsnippet llWater\\n\tllWater(${1:vector offset});\\nsnippet llWhisper\\n\tllWhisper(${1:integer channel}, ${2:string msg});\\nsnippet llWind\\n\tllWind(${1:vector offset});\\nsnippet llXorBase64\\n\tllXorBase64(${1:string str1}, ${2:string str2})\\nsnippet money\\n\tmoney(${1:key id}, ${2:integer amount})\\n\t{\\n\t\t$0\\n\t}\\nsnippet object_rez\\n\tobject_rez(${1:key id})\\n\t{\\n\t\t$0\\n\t}\\nsnippet on_rez\\n\ton_rez(${1:integer start_param})\\n\t{\\n\t\t$0\\n\t}\\nsnippet path_update\\n\tpath_update(${1:integer type}, ${2:list reserved})\\n\t{\\n\t\t$0\\n\t}\\nsnippet remote_data\\n\tremote_data(${1:integer event_type}, ${2:key channel}, ${3:key message_id}, ${4:string sender}, ${5:integer idata}, ${6:string sdata})\\n\t{\\n\t\t$0\\n\t}\\nsnippet run_time_permissions\\n\trun_time_permissions(${1:integer perm})\\n\t{\\n\t\t$0\\n\t}\\nsnippet sensor\\n\tsensor(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet state\\n\tstate ${1:name}\\nsnippet touch\\n\ttouch(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet touch_end\\n\ttouch_end(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet touch_start\\n\ttouch_start(${1:integer index})\\n\t{\\n\t\t$0\\n\t}\\nsnippet transaction_result\\n\ttransaction_result(${1:key id}, ${2:integer success}, ${3:string data})\\n\t{\\n\t\t$0\\n\t}\\nsnippet while\\n\twhile (${1:condition})\\n\t{\\n\t\t$0\\n\t}\\n\",t.scope=\"lsl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/lua.js",
    "content": "define(\"ace/snippets/lua\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet #!\\n\t#!/usr/bin/env lua\\n\t$1\\nsnippet local\\n\tlocal ${1:x} = ${2:1}\\nsnippet fun\\n\tfunction ${1:fname}(${2:...})\\n\t\t${3:-- body}\\n\tend\\nsnippet for\\n\tfor ${1:i}=${2:1},${3:10} do\\n\t\t${4:print(i)}\\n\tend\\nsnippet forp\\n\tfor ${1:i},${2:v} in pairs(${3:table_name}) do\\n\t   ${4:-- body}\\n\tend\\nsnippet fori\\n\tfor ${1:i},${2:v} in ipairs(${3:table_name}) do\\n\t   ${4:-- body}\\n\tend\\n\",t.scope=\"lua\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/luapage.js",
    "content": "define(\"ace/snippets/luapage\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"luapage\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/lucene.js",
    "content": "define(\"ace/snippets/lucene\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"lucene\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/makefile.js",
    "content": "define(\"ace/snippets/makefile\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet ifeq\\n\tifeq (${1:cond0},${2:cond1})\\n\t\t${3:code}\\n\tendif\\n\",t.scope=\"makefile\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/markdown.js",
    "content": "define(\"ace/snippets/markdown\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# Markdown\\n\\n# Includes octopress (http://octopress.org/) snippets\\n\\nsnippet [\\n\t[${1:text}](http://${2:address} \"${3:title}\")\\nsnippet [*\\n\t[${1:link}](${2:`@*`} \"${3:title}\")${4}\\n\\nsnippet [:\\n\t[${1:id}]: http://${2:url} \"${3:title}\"\\nsnippet [:*\\n\t[${1:id}]: ${2:`@*`} \"${3:title}\"\\n\\nsnippet ![\\n\t![${1:alttext}](${2:/images/image.jpg} \"${3:title}\")\\nsnippet ![*\\n\t![${1:alt}](${2:`@*`} \"${3:title}\")${4}\\n\\nsnippet ![:\\n\t![${1:id}]: ${2:url} \"${3:title}\"\\nsnippet ![:*\\n\t![${1:id}]: ${2:`@*`} \"${3:title}\"\\n\\nsnippet ===\\nregex /^/=+/=*//\\n\t${PREV_LINE/./=/g}\\n\t\\n\t${0}\\nsnippet ---\\nregex /^/-+/-*//\\n\t${PREV_LINE/./-/g}\\n\t\\n\t${0}\\nsnippet blockquote\\n\t{% blockquote %}\\n\t${1:quote}\\n\t{% endblockquote %}\\n\\nsnippet blockquote-author\\n\t{% blockquote ${1:author}, ${2:title} %}\\n\t${3:quote}\\n\t{% endblockquote %}\\n\\nsnippet blockquote-link\\n\t{% blockquote ${1:author} ${2:URL} ${3:link_text} %}\\n\t${4:quote}\\n\t{% endblockquote %}\\n\\nsnippet bt-codeblock-short\\n\t```\\n\t${1:code_snippet}\\n\t```\\n\\nsnippet bt-codeblock-full\\n\t``` ${1:language} ${2:title} ${3:URL} ${4:link_text}\\n\t${5:code_snippet}\\n\t```\\n\\nsnippet codeblock-short\\n\t{% codeblock %}\\n\t${1:code_snippet}\\n\t{% endcodeblock %}\\n\\nsnippet codeblock-full\\n\t{% codeblock ${1:title} lang:${2:language} ${3:URL} ${4:link_text} %}\\n\t${5:code_snippet}\\n\t{% endcodeblock %}\\n\\nsnippet gist-full\\n\t{% gist ${1:gist_id} ${2:filename} %}\\n\\nsnippet gist-short\\n\t{% gist ${1:gist_id} %}\\n\\nsnippet img\\n\t{% img ${1:class} ${2:URL} ${3:width} ${4:height} ${5:title_text} ${6:alt_text} %}\\n\\nsnippet youtube\\n\t{% youtube ${1:video_id} %}\\n\\n# The quote should appear only once in the text. It is inherently part of it.\\n# See http://octopress.org/docs/plugins/pullquote/ for more info.\\n\\nsnippet pullquote\\n\t{% pullquote %}\\n\t${1:text} {\" ${2:quote} \"} ${3:text}\\n\t{% endpullquote %}\\n',t.scope=\"markdown\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/matlab.js",
    "content": "define(\"ace/snippets/matlab\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"matlab\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/mel.js",
    "content": "define(\"ace/snippets/mel\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"mel\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/mushcode.js",
    "content": "define(\"ace/snippets/mushcode\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"mushcode\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/mushcode_high_rules.js",
    "content": "define(\"ace/snippets/mushcode_high_rules\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"mushcode_high_rules\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/mysql.js",
    "content": "define(\"ace/snippets/mysql\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"mysql\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/nix.js",
    "content": "define(\"ace/snippets/nix\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"nix\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/objectivec.js",
    "content": "define(\"ace/snippets/objectivec\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"objectivec\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ocaml.js",
    "content": "define(\"ace/snippets/ocaml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"ocaml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/pascal.js",
    "content": "define(\"ace/snippets/pascal\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"pascal\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/perl.js",
    "content": "define(\"ace/snippets/perl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# #!/usr/bin/perl\\nsnippet #!\\n\t#!/usr/bin/env perl\\n\\n# Hash Pointer\\nsnippet .\\n\t =>\\n# Function\\nsnippet sub\\n\tsub ${1:function_name} {\\n\t\t${2:#body ...}\\n\t}\\n# Conditional\\nsnippet if\\n\tif (${1}) {\\n\t\t${2:# body...}\\n\t}\\n# Conditional if..else\\nsnippet ife\\n\tif (${1}) {\\n\t\t${2:# body...}\\n\t}\\n\telse {\\n\t\t${3:# else...}\\n\t}\\n# Conditional if..elsif..else\\nsnippet ifee\\n\tif (${1}) {\\n\t\t${2:# body...}\\n\t}\\n\telsif (${3}) {\\n\t\t${4:# elsif...}\\n\t}\\n\telse {\\n\t\t${5:# else...}\\n\t}\\n# Conditional One-line\\nsnippet xif\\n\t${1:expression} if ${2:condition};${3}\\n# Unless conditional\\nsnippet unless\\n\tunless (${1}) {\\n\t\t${2:# body...}\\n\t}\\n# Unless conditional One-line\\nsnippet xunless\\n\t${1:expression} unless ${2:condition};${3}\\n# Try/Except\\nsnippet eval\\n\tlocal $@;\\n\teval {\\n\t\t${1:# do something risky...}\\n\t};\\n\tif (my $e = $@) {\\n\t\t${2:# handle failure...}\\n\t}\\n# While Loop\\nsnippet wh\\n\twhile (${1}) {\\n\t\t${2:# body...}\\n\t}\\n# While Loop One-line\\nsnippet xwh\\n\t${1:expression} while ${2:condition};${3}\\n# C-style For Loop\\nsnippet cfor\\n\tfor (my $${2:var} = 0; $$2 < ${1:count}; $$2${3:++}) {\\n\t\t${4:# body...}\\n\t}\\n# For loop one-line\\nsnippet xfor\\n\t${1:expression} for @${2:array};${3}\\n# Foreach Loop\\nsnippet for\\n\tforeach my $${1:x} (@${2:array}) {\\n\t\t${3:# body...}\\n\t}\\n# Foreach Loop One-line\\nsnippet fore\\n\t${1:expression} foreach @${2:array};${3}\\n# Package\\nsnippet package\\n\tpackage ${1:`substitute(Filename('', 'Page Title'), '^.', '\\\\u&', '')`};\\n\\n\t${2}\\n\\n\t1;\\n\\n\t__END__\\n# Package syntax perl >= 5.14\\nsnippet packagev514\\n\tpackage ${1:`substitute(Filename('', 'Page Title'), '^.', '\\\\u&', '')`} ${2:0.99};\\n\\n\t${3}\\n\\n\t1;\\n\\n\t__END__\\n#moose\\nsnippet moose\\n\tuse Moose;\\n\tuse namespace::autoclean;\\n\t${1:#}BEGIN {extends '${2:ParentClass}'};\\n\\n\t${3}\\n# parent\\nsnippet parent\\n\tuse parent qw(${1:Parent Class});\\n# Read File\\nsnippet slurp\\n\tmy $${1:var} = do { local $/; open my $file, '<', \\\"${2:file}\\\"; <$file> };\\n\t${3}\\n# strict warnings\\nsnippet strwar\\n\tuse strict;\\n\tuse warnings;\\n# older versioning with perlcritic bypass\\nsnippet vers\\n\t## no critic\\n\tour $VERSION = '${1:version}';\\n\teval $VERSION;\\n\t## use critic\\n# new 'switch' like feature\\nsnippet switch\\n\tuse feature 'switch';\\n\\n# Anonymous subroutine\\nsnippet asub\\n\tsub {\\n\t \t${1:# body }\\n\t}\\n\\n\\n\\n# Begin block\\nsnippet begin\\n\tBEGIN {\\n\t\t${1:# begin body}\\n\t}\\n\\n# call package function with some parameter\\nsnippet pkgmv\\n\t__PACKAGE__->${1:package_method}(${2:var})\\n\\n# call package function without a parameter\\nsnippet pkgm\\n\t__PACKAGE__->${1:package_method}()\\n\\n# call package \\\"get_\\\" function without a parameter\\nsnippet pkget\\n\t__PACKAGE__->get_${1:package_method}()\\n\\n# call package function with a parameter\\nsnippet pkgetv\\n\t__PACKAGE__->get_${1:package_method}(${2:var})\\n\\n# complex regex\\nsnippet qrx\\n\tqr/\\n\t     ${1:regex}\\n\t/xms\\n\\n#simpler regex\\nsnippet qr/\\n\tqr/${1:regex}/x\\n\\n#given\\nsnippet given\\n\tgiven ($${1:var}) {\\n\t\t${2:# cases}\\n\t\t${3:# default}\\n\t}\\n\\n# switch-like case\\nsnippet when\\n\twhen (${1:case}) {\\n\t\t${2:# body}\\n\t}\\n\\n# hash slice\\nsnippet hslice\\n\t@{ ${1:hash}  }{ ${2:array} }\\n\\n\\n# map\\nsnippet map\\n\tmap {  ${2: body }    }  ${1: @array } ;\\n\\n\\n\\n# Pod stub\\nsnippet ppod\\n\t=head1 NAME\\n\\n\t${1:ClassName} - ${2:ShortDesc}\\n\\n\t=head1 SYNOPSIS\\n\\n\t  use $1;\\n\\n\t  ${3:# synopsis...}\\n\\n\t=head1 DESCRIPTION\\n\\n\t${4:# longer description...}\\n\\n\\n\t=head1 INTERFACE\\n\\n\\n\t=head1 DEPENDENCIES\\n\\n\\n\t=head1 SEE ALSO\\n\\n\\n# Heading for a subroutine stub\\nsnippet psub\\n\t=head2 ${1:MethodName}\\n\\n\t${2:Summary....}\\n\\n# Heading for inline subroutine pod\\nsnippet psubi\\n\t=head2 ${1:MethodName}\\n\\n\t${2:Summary...}\\n\\n\\n\t=cut\\n# inline documented subroutine\\nsnippet subpod\\n\t=head2 $1\\n\\n\tSummary of $1\\n\\n\t=cut\\n\\n\tsub ${1:subroutine_name} {\\n\t\t${2:# body...}\\n\t}\\n# Subroutine signature\\nsnippet parg\\n\t=over 2\\n\\n\t=item\\n\tArguments\\n\\n\\n\t=over 3\\n\\n\t=item\\n\tC<${1:DataStructure}>\\n\\n\t  ${2:Sample}\\n\\n\\n\t=back\\n\\n\\n\t=item\\n\tReturn\\n\\n\t=over 3\\n\\n\\n\t=item\\n\tC<${3:...return data}>\\n\\n\\n\t=back\\n\\n\\n\t=back\\n\\n\\n\\n# Moose has\\nsnippet has\\n\thas ${1:attribute} => (\\n\t\tis\t    => '${2:ro|rw}',\\n\t\tisa \t=> '${3:Str|Int|HashRef|ArrayRef|etc}',\\n\t\tdefault => sub {\\n\t\t\t${4:defaultvalue}\\n\t\t},\\n\t\t${5:# other attributes}\\n\t);\\n\\n\\n# override\\nsnippet override\\n\toverride ${1:attribute} => sub {\\n\t\t${2:# my $self = shift;};\\n\t\t${3:# my ($self, $args) = @_;};\\n\t};\\n\\n\\n# use test classes\\nsnippet tuse\\n\tuse Test::More;\\n\tuse Test::Deep; # (); # uncomment to stop prototype errors\\n\tuse Test::Exception;\\n\\n# local test lib\\nsnippet tlib\\n\tuse lib qw{ ./t/lib };\\n\\n#test methods\\nsnippet tmeths\\n\t$ENV{TEST_METHOD} = '${1:regex}';\\n\\n# runtestclass\\nsnippet trunner\\n\tuse ${1:test_class};\\n\t$1->runtests();\\n\\n# Test::Class-style test\\nsnippet tsub\\n\tsub t${1:number}_${2:test_case} :Test(${3:num_of_tests}) {\\n\t\tmy $self = shift;\\n\t\t${4:#  body}\\n\\n\t}\\n\\n# Test::Routine-style test\\nsnippet trsub\\n\ttest ${1:test_name} => { description => '${2:Description of test.}'} => sub {\\n\t\tmy ($self) = @_;\\n\t\t${3:# test code}\\n\t};\\n\\n#prep test method\\nsnippet tprep\\n\tsub prep${1:number}_${2:test_case} :Test(startup) {\\n\t\tmy $self = shift;\\n\t\t${4:#  body}\\n\t}\\n\\n# cause failures to print stack trace\\nsnippet debug_trace\\n\tuse Carp; # 'verbose';\\n\t# cloak \\\"die\\\"\\n\t# warn \\\"warning\\\"\\n\t$SIG{'__DIE__'} = sub {\\n\t\trequire Carp; Carp::confess\\n\t};\\n\\n\",t.scope=\"perl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/pgsql.js",
    "content": "define(\"ace/snippets/pgsql\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"pgsql\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/php.js",
    "content": "define(\"ace/snippets/php\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet <?\\n\t<?php\\n\\n\t${1}\\nsnippet ec\\n\techo ${1};\\nsnippet <?e\\n\t<?php echo ${1} ?>\\n# this one is for php5.4\\nsnippet <?=\\n\t<?=${1}?>\\nsnippet ns\\n\tnamespace ${1:Foo\\\\Bar\\\\Baz};\\n\t${2}\\nsnippet use\\n\tuse ${1:Foo\\\\Bar\\\\Baz};\\n\t${2}\\nsnippet c\\n\t${1:abstract }class ${2:$FILENAME}\\n\t{\\n\t\t${3}\\n\t}\\nsnippet i\\n\tinterface ${1:$FILENAME}\\n\t{\\n\t\t${2}\\n\t}\\nsnippet t.\\n\t$this->${1}\\nsnippet f\\n\tfunction ${1:foo}(${2:array }${3:$bar})\\n\t{\\n\t\t${4}\\n\t}\\n# method\\nsnippet m\\n\t${1:abstract }${2:protected}${3: static} function ${4:foo}(${5:array }${6:$bar})\\n\t{\\n\t\t${7}\\n\t}\\n# setter method\\nsnippet sm \\n\t/**\\n\t * Sets the value of ${1:foo}\\n\t *\\n\t * @param ${2:$1} $$1 ${3:description}\\n\t *\\n\t * @return ${4:$FILENAME}\\n\t */\\n\t${5:public} function set${6:$2}(${7:$2 }$$1)\\n\t{\\n\t\t$this->${8:$1} = $$1;\\n\t\treturn $this;\\n\t}${9}\\n# getter method\\nsnippet gm\\n\t/**\\n\t * Gets the value of ${1:foo}\\n\t *\\n\t * @return ${2:$1}\\n\t */\\n\t${3:public} function get${4:$2}()\\n\t{\\n\t\treturn $this->${5:$1};\\n\t}${6}\\n#setter\\nsnippet $s\\n\t${1:$foo}->set${2:Bar}(${3});\\n#getter\\nsnippet $g\\n\t${1:$foo}->get${2:Bar}();\\n\\n# Tertiary conditional\\nsnippet =?:\\n\t$${1:foo} = ${2:true} ? ${3:a} : ${4};\\nsnippet ?:\\n\t${1:true} ? ${2:a} : ${3}\\n\\nsnippet C\\n\t$_COOKIE['${1:variable}']${2}\\nsnippet E\\n\t$_ENV['${1:variable}']${2}\\nsnippet F\\n\t$_FILES['${1:variable}']${2}\\nsnippet G\\n\t$_GET['${1:variable}']${2}\\nsnippet P\\n\t$_POST['${1:variable}']${2}\\nsnippet R\\n\t$_REQUEST['${1:variable}']${2}\\nsnippet S\\n\t$_SERVER['${1:variable}']${2}\\nsnippet SS\\n\t$_SESSION['${1:variable}']${2}\\n\t\\n# the following are old ones\\nsnippet inc\\n\tinclude '${1:file}';${2}\\nsnippet inc1\\n\tinclude_once '${1:file}';${2}\\nsnippet req\\n\trequire '${1:file}';${2}\\nsnippet req1\\n\trequire_once '${1:file}';${2}\\n# Start Docblock\\nsnippet /*\\n\t/**\\n\t * ${1}\\n\t */\\n# Class - post doc\\nsnippet doc_cp\\n\t/**\\n\t * ${1:undocumented class}\\n\t *\\n\t * @package ${2:default}\\n\t * @subpackage ${3:default}\\n\t * @author ${4:`g:snips_author`}\\n\t */${5}\\n# Class Variable - post doc\\nsnippet doc_vp\\n\t/**\\n\t * ${1:undocumented class variable}\\n\t *\\n\t * @var ${2:string}\\n\t */${3}\\n# Class Variable\\nsnippet doc_v\\n\t/**\\n\t * ${3:undocumented class variable}\\n\t *\\n\t * @var ${4:string}\\n\t */\\n\t${1:var} $${2};${5}\\n# Class\\nsnippet doc_c\\n\t/**\\n\t * ${3:undocumented class}\\n\t *\\n\t * @package ${4:default}\\n\t * @subpackage ${5:default}\\n\t * @author ${6:`g:snips_author`}\\n\t */\\n\t${1:}class ${2:}\\n\t{\\n\t\t${7}\\n\t} // END $1class $2\\n# Constant Definition - post doc\\nsnippet doc_dp\\n\t/**\\n\t * ${1:undocumented constant}\\n\t */${2}\\n# Constant Definition\\nsnippet doc_d\\n\t/**\\n\t * ${3:undocumented constant}\\n\t */\\n\tdefine(${1}, ${2});${4}\\n# Function - post doc\\nsnippet doc_fp\\n\t/**\\n\t * ${1:undocumented function}\\n\t *\\n\t * @return ${2:void}\\n\t * @author ${3:`g:snips_author`}\\n\t */${4}\\n# Function signature\\nsnippet doc_s\\n\t/**\\n\t * ${4:undocumented function}\\n\t *\\n\t * @return ${5:void}\\n\t * @author ${6:`g:snips_author`}\\n\t */\\n\t${1}function ${2}(${3});${7}\\n# Function\\nsnippet doc_f\\n\t/**\\n\t * ${4:undocumented function}\\n\t *\\n\t * @return ${5:void}\\n\t * @author ${6:`g:snips_author`}\\n\t */\\n\t${1}function ${2}(${3})\\n\t{${7}\\n\t}\\n# Header\\nsnippet doc_h\\n\t/**\\n\t * ${1}\\n\t *\\n\t * @author ${2:`g:snips_author`}\\n\t * @version ${3:$Id$}\\n\t * @copyright ${4:$2}, `strftime('%d %B, %Y')`\\n\t * @package ${5:default}\\n\t */\\n\t\\n# Interface\\nsnippet interface\\n\t/**\\n\t * ${2:undocumented class}\\n\t *\\n\t * @package ${3:default}\\n\t * @author ${4:`g:snips_author`}\\n\t */\\n\tinterface ${1:$FILENAME}\\n\t{\\n\t\t${5}\\n\t}\\n# class ...\\nsnippet class\\n\t/**\\n\t * ${1}\\n\t */\\n\tclass ${2:$FILENAME}\\n\t{\\n\t\t${3}\\n\t\t/**\\n\t\t * ${4}\\n\t\t */\\n\t\t${5:public} function ${6:__construct}(${7:argument})\\n\t\t{\\n\t\t\t${8:// code...}\\n\t\t}\\n\t}\\n# define(...)\\nsnippet def\\n\tdefine('${1}'${2});${3}\\n# defined(...)\\nsnippet def?\\n\t${1}defined('${2}')${3}\\nsnippet wh\\n\twhile (${1:/* condition */}) {\\n\t\t${2:// code...}\\n\t}\\n# do ... while\\nsnippet do\\n\tdo {\\n\t\t${2:// code... }\\n\t} while (${1:/* condition */});\\nsnippet if\\n\tif (${1:/* condition */}) {\\n\t\t${2:// code...}\\n\t}\\nsnippet ifil\\n\t<?php if (${1:/* condition */}): ?>\\n\t\t${2:<!-- code... -->}\\n\t<?php endif; ?>\\nsnippet ife\\n\tif (${1:/* condition */}) {\\n\t\t${2:// code...}\\n\t} else {\\n\t\t${3:// code...}\\n\t}\\n\t${4}\\nsnippet ifeil\\n\t<?php if (${1:/* condition */}): ?>\\n\t\t${2:<!-- html... -->}\\n\t<?php else: ?>\\n\t\t${3:<!-- html... -->}\\n\t<?php endif; ?>\\n\t${4}\\nsnippet else\\n\telse {\\n\t\t${1:// code...}\\n\t}\\nsnippet elseif\\n\telseif (${1:/* condition */}) {\\n\t\t${2:// code...}\\n\t}\\nsnippet switch\\n\tswitch ($${1:variable}) {\\n\t\tcase '${2:value}':\\n\t\t\t${3:// code...}\\n\t\t\tbreak;\\n\t\t${5}\\n\t\tdefault:\\n\t\t\t${4:// code...}\\n\t\t\tbreak;\\n\t}\\nsnippet case\\n\tcase '${1:value}':\\n\t\t${2:// code...}\\n\t\tbreak;${3}\\nsnippet for\\n\tfor ($${2:i} = 0; $$2 < ${1:count}; $$2${3:++}) {\\n\t\t${4: // code...}\\n\t}\\nsnippet foreach\\n\tforeach ($${1:variable} as $${2:value}) {\\n\t\t${3:// code...}\\n\t}\\nsnippet foreachil\\n\t<?php foreach ($${1:variable} as $${2:value}): ?>\\n\t\t${3:<!-- html... -->}\\n\t<?php endforeach; ?>\\nsnippet foreachk\\n\tforeach ($${1:variable} as $${2:key} => $${3:value}) {\\n\t\t${4:// code...}\\n\t}\\nsnippet foreachkil\\n\t<?php foreach ($${1:variable} as $${2:key} => $${3:value}): ?>\\n\t\t${4:<!-- html... -->}\\n\t<?php endforeach; ?>\\n# $... = array (...)\\nsnippet array\\n\t$${1:arrayName} = array('${2}' => ${3});${4}\\nsnippet try\\n\ttry {\\n\t\t${2}\\n\t} catch (${1:Exception} $e) {\\n\t}\\n# lambda with closure\\nsnippet lambda\\n\t${1:static }function (${2:args}) use (${3:&$x, $y /*put vars in scope (closure) */}) {\\n\t\t${4}\\n\t};\\n# pre_dump();\\nsnippet pd\\n\techo '<pre>'; var_dump(${1}); echo '</pre>';\\n# pre_dump(); die();\\nsnippet pdd\\n\techo '<pre>'; var_dump(${1}); echo '</pre>'; die(${2:});\\nsnippet vd\\n\tvar_dump(${1});\\nsnippet vdd\\n\tvar_dump(${1}); die(${2:});\\nsnippet http_redirect\\n\theader (\\\"HTTP/1.1 301 Moved Permanently\\\"); \\n\theader (\\\"Location: \\\".URL); \\n\texit();\\n# Getters & Setters\\nsnippet gs\\n\t/**\\n\t * Gets the value of ${1:foo}\\n\t *\\n\t * @return ${2:$1}\\n\t */\\n\tpublic function get${3:$2}()\\n\t{\\n\t\treturn $this->${4:$1};\\n\t}\\n\\n\t/**\\n\t * Sets the value of $1\\n\t *\\n\t * @param $2 $$1 ${5:description}\\n\t *\\n\t * @return ${6:$FILENAME}\\n\t */\\n\tpublic function set$3(${7:$2 }$$1)\\n\t{\\n\t\t$this->$4 = $$1;\\n\t\treturn $this;\\n\t}${8}\\n# anotation, get, and set, useful for doctrine\\nsnippet ags\\n\t/**\\n\t * ${1:description}\\n\t * \\n\t * @${7}\\n\t */\\n\t${2:protected} $${3:foo};\\n\\n\tpublic function get${4:$3}()\\n\t{\\n\t\treturn $this->$3;\\n\t}\\n\\n\tpublic function set$4(${5:$4 }$${6:$3})\\n\t{\\n\t\t$this->$3 = $$6;\\n\t\treturn $this;\\n\t}\\nsnippet rett\\n\treturn true;\\nsnippet retf\\n\treturn false;\\n\",t.scope=\"php\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/plain_text.js",
    "content": "define(\"ace/snippets/plain_text\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"plain_text\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/powershell.js",
    "content": "define(\"ace/snippets/powershell\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"powershell\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/prolog.js",
    "content": "define(\"ace/snippets/prolog\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"prolog\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/properties.js",
    "content": "define(\"ace/snippets/properties\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"properties\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/protobuf.js",
    "content": "define(\"ace/snippets/protobuf\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"protobuf\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/python.js",
    "content": "define(\"ace/snippets/python\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet #!\\n\t#!/usr/bin/env python\\nsnippet imp\\n\timport ${1:module}\\nsnippet from\\n\tfrom ${1:package} import ${2:module}\\n# Module Docstring\\nsnippet docs\\n\t\\'\\'\\'\\n\tFile: ${1:FILENAME:file_name}\\n\tAuthor: ${2:author}\\n\tDescription: ${3}\\n\t\\'\\'\\'\\nsnippet wh\\n\twhile ${1:condition}:\\n\t\t${2:# TODO: write code...}\\n# dowh - does the same as do...while in other languages\\nsnippet dowh\\n\twhile True:\\n\t\t${1:# TODO: write code...}\\n\t\tif ${2:condition}:\\n\t\t\tbreak\\nsnippet with\\n\twith ${1:expr} as ${2:var}:\\n\t\t${3:# TODO: write code...}\\n# New Class\\nsnippet cl\\n\tclass ${1:ClassName}(${2:object}):\\n\t\t\"\"\"${3:docstring for $1}\"\"\"\\n\t\tdef __init__(self, ${4:arg}):\\n\t\t\t${5:super($1, self).__init__()}\\n\t\t\tself.$4 = $4\\n\t\t\t${6}\\n# New Function\\nsnippet def\\n\tdef ${1:fname}(${2:`indent(\\'.\\') ? \\'self\\' : \\'\\'`}):\\n\t\t\"\"\"${3:docstring for $1}\"\"\"\\n\t\t${4:# TODO: write code...}\\nsnippet deff\\n\tdef ${1:fname}(${2:`indent(\\'.\\') ? \\'self\\' : \\'\\'`}):\\n\t\t${3:# TODO: write code...}\\n# New Method\\nsnippet defs\\n\tdef ${1:mname}(self, ${2:arg}):\\n\t\t${3:# TODO: write code...}\\n# New Property\\nsnippet property\\n\tdef ${1:foo}():\\n\t\tdoc = \"${2:The $1 property.}\"\\n\t\tdef fget(self):\\n\t\t\t${3:return self._$1}\\n\t\tdef fset(self, value):\\n\t\t\t${4:self._$1 = value}\\n# Ifs\\nsnippet if\\n\tif ${1:condition}:\\n\t\t${2:# TODO: write code...}\\nsnippet el\\n\telse:\\n\t\t${1:# TODO: write code...}\\nsnippet ei\\n\telif ${1:condition}:\\n\t\t${2:# TODO: write code...}\\n# For\\nsnippet for\\n\tfor ${1:item} in ${2:items}:\\n\t\t${3:# TODO: write code...}\\n# Encodes\\nsnippet cutf8\\n\t# -*- coding: utf-8 -*-\\nsnippet clatin1\\n\t# -*- coding: latin-1 -*-\\nsnippet cascii\\n\t# -*- coding: ascii -*-\\n# Lambda\\nsnippet ld\\n\t${1:var} = lambda ${2:vars} : ${3:action}\\nsnippet .\\n\tself.\\nsnippet try Try/Except\\n\ttry:\\n\t\t${1:# TODO: write code...}\\n\texcept ${2:Exception}, ${3:e}:\\n\t\t${4:raise $3}\\nsnippet try Try/Except/Else\\n\ttry:\\n\t\t${1:# TODO: write code...}\\n\texcept ${2:Exception}, ${3:e}:\\n\t\t${4:raise $3}\\n\telse:\\n\t\t${5:# TODO: write code...}\\nsnippet try Try/Except/Finally\\n\ttry:\\n\t\t${1:# TODO: write code...}\\n\texcept ${2:Exception}, ${3:e}:\\n\t\t${4:raise $3}\\n\tfinally:\\n\t\t${5:# TODO: write code...}\\nsnippet try Try/Except/Else/Finally\\n\ttry:\\n\t\t${1:# TODO: write code...}\\n\texcept ${2:Exception}, ${3:e}:\\n\t\t${4:raise $3}\\n\telse:\\n\t\t${5:# TODO: write code...}\\n\tfinally:\\n\t\t${6:# TODO: write code...}\\n# if __name__ == \\'__main__\\':\\nsnippet ifmain\\n\tif __name__ == \\'__main__\\':\\n\t\t${1:main()}\\n# __magic__\\nsnippet _\\n\t__${1:init}__${2}\\n# python debugger (pdb)\\nsnippet pdb\\n\timport pdb; pdb.set_trace()\\n# ipython debugger (ipdb)\\nsnippet ipdb\\n\timport ipdb; ipdb.set_trace()\\n# ipython debugger (pdbbb)\\nsnippet pdbbb\\n\timport pdbpp; pdbpp.set_trace()\\nsnippet pprint\\n\timport pprint; pprint.pprint(${1})${2}\\nsnippet \"\\n\t\"\"\"\\n\t${1:doc}\\n\t\"\"\"\\n# test function/method\\nsnippet test\\n\tdef test_${1:description}(${2:self}):\\n\t\t${3:# TODO: write code...}\\n# test case\\nsnippet testcase\\n\tclass ${1:ExampleCase}(unittest.TestCase):\\n\t\t\\n\t\tdef test_${2:description}(self):\\n\t\t\t${3:# TODO: write code...}\\nsnippet fut\\n\tfrom __future__ import ${1}\\n#getopt\\nsnippet getopt\\n\ttry:\\n\t\t# Short option syntax: \"hv:\"\\n\t\t# Long option syntax: \"help\" or \"verbose=\"\\n\t\topts, args = getopt.getopt(sys.argv[1:], \"${1:short_options}\", [${2:long_options}])\\n\t\\n\texcept getopt.GetoptError, err:\\n\t\t# Print debug info\\n\t\tprint str(err)\\n\t\t${3:error_action}\\n\\n\tfor option, argument in opts:\\n\t\tif option in (\"-h\", \"--help\"):\\n\t\t\t${4}\\n\t\telif option in (\"-v\", \"--verbose\"):\\n\t\t\tverbose = argument\\n',t.scope=\"python\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/r.js",
    "content": "define(\"ace/snippets/r\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet #!\\n\t#!/usr/bin/env Rscript\\n\\n# includes\\nsnippet lib\\n\tlibrary(${1:package})\\nsnippet req\\n\trequire(${1:package})\\nsnippet source\\n\tsource(\\'${1:file}\\')\\n\\n# conditionals\\nsnippet if\\n\tif (${1:condition}) {\\n\t\t${2:code}\\n\t}\\nsnippet el\\n\telse {\\n\t\t${1:code}\\n\t}\\nsnippet ei\\n\telse if (${1:condition}) {\\n\t\t${2:code}\\n\t}\\n\\n# functions\\nsnippet fun\\n\t${1:name} = function (${2:variables}) {\\n\t\t${3:code}\\n\t}\\nsnippet ret\\n\treturn(${1:code})\\n\\n# dataframes, lists, etc\\nsnippet df\\n\t${1:name}[${2:rows}, ${3:cols}]\\nsnippet c\\n\tc(${1:items})\\nsnippet li\\n\tlist(${1:items})\\nsnippet mat\\n\tmatrix(${1:data}, nrow=${2:rows}, ncol=${3:cols})\\n\\n# apply functions\\nsnippet apply\\n\tapply(${1:array}, ${2:margin}, ${3:function})\\nsnippet lapply\\n\tlapply(${1:list}, ${2:function})\\nsnippet sapply\\n\tlapply(${1:list}, ${2:function})\\nsnippet vapply\\n\tvapply(${1:list}, ${2:function}, ${3:type})\\nsnippet mapply\\n\tmapply(${1:function}, ${2:...})\\nsnippet tapply\\n\ttapply(${1:vector}, ${2:index}, ${3:function})\\nsnippet rapply\\n\trapply(${1:list}, ${2:function})\\n\\n# plyr functions\\nsnippet dd\\n\tddply(${1:frame}, ${2:variables}, ${3:function})\\nsnippet dl\\n\tdlply(${1:frame}, ${2:variables}, ${3:function})\\nsnippet da\\n\tdaply(${1:frame}, ${2:variables}, ${3:function})\\nsnippet d_\\n\td_ply(${1:frame}, ${2:variables}, ${3:function})\\n\\nsnippet ad\\n\tadply(${1:array}, ${2:margin}, ${3:function})\\nsnippet al\\n\talply(${1:array}, ${2:margin}, ${3:function})\\nsnippet aa\\n\taaply(${1:array}, ${2:margin}, ${3:function})\\nsnippet a_\\n\ta_ply(${1:array}, ${2:margin}, ${3:function})\\n\\nsnippet ld\\n\tldply(${1:list}, ${2:function})\\nsnippet ll\\n\tllply(${1:list}, ${2:function})\\nsnippet la\\n\tlaply(${1:list}, ${2:function})\\nsnippet l_\\n\tl_ply(${1:list}, ${2:function})\\n\\nsnippet md\\n\tmdply(${1:matrix}, ${2:function})\\nsnippet ml\\n\tmlply(${1:matrix}, ${2:function})\\nsnippet ma\\n\tmaply(${1:matrix}, ${2:function})\\nsnippet m_\\n\tm_ply(${1:matrix}, ${2:function})\\n\\n# plot functions\\nsnippet pl\\n\tplot(${1:x}, ${2:y})\\nsnippet ggp\\n\tggplot(${1:data}, aes(${2:aesthetics}))\\nsnippet img\\n\t${1:(jpeg,bmp,png,tiff)}(filename=\"${2:filename}\", width=${3}, height=${4}, unit=\"${5}\")\\n\t${6:plot}\\n\tdev.off()\\n\\n# statistical test functions\\nsnippet fis\\n\tfisher.test(${1:x}, ${2:y})\\nsnippet chi\\n\tchisq.test(${1:x}, ${2:y})\\nsnippet tt\\n\tt.test(${1:x}, ${2:y})\\nsnippet wil\\n\twilcox.test(${1:x}, ${2:y})\\nsnippet cor\\n\tcor.test(${1:x}, ${2:y})\\nsnippet fte\\n\tvar.test(${1:x}, ${2:y})\\nsnippet kvt \\n\tkv.test(${1:x}, ${2:y})\\n',t.scope=\"r\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/rdoc.js",
    "content": "define(\"ace/snippets/rdoc\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"rdoc\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/rhtml.js",
    "content": "define(\"ace/snippets/rhtml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"rhtml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/ruby.js",
    "content": "define(\"ace/snippets/ruby\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='########################################\\n# Ruby snippets - for Rails, see below #\\n########################################\\n\\n# encoding for Ruby 1.9\\nsnippet enc\\n\t# encoding: utf-8\\n\\n# #!/usr/bin/env ruby\\nsnippet #!\\n\t#!/usr/bin/env ruby\\n\t# encoding: utf-8\\n\\n# New Block\\nsnippet =b\\n\t=begin rdoc\\n\t\t${1}\\n\t=end\\nsnippet y\\n\t:yields: ${1:arguments}\\nsnippet rb\\n\t#!/usr/bin/env ruby -wKU\\nsnippet beg\\n\tbegin\\n\t\t${3}\\n\trescue ${1:Exception} => ${2:e}\\n\tend\\n\\nsnippet req require\\n\trequire \"${1}\"${2}\\nsnippet #\\n\t# =>\\nsnippet end\\n\t__END__\\nsnippet case\\n\tcase ${1:object}\\n\twhen ${2:condition}\\n\t\t${3}\\n\tend\\nsnippet when\\n\twhen ${1:condition}\\n\t\t${2}\\nsnippet def\\n\tdef ${1:method_name}\\n\t\t${2}\\n\tend\\nsnippet deft\\n\tdef test_${1:case_name}\\n\t\t${2}\\n\tend\\nsnippet if\\n\tif ${1:condition}\\n\t\t${2}\\n\tend\\nsnippet ife\\n\tif ${1:condition}\\n\t\t${2}\\n\telse\\n\t\t${3}\\n\tend\\nsnippet elsif\\n\telsif ${1:condition}\\n\t\t${2}\\nsnippet unless\\n\tunless ${1:condition}\\n\t\t${2}\\n\tend\\nsnippet while\\n\twhile ${1:condition}\\n\t\t${2}\\n\tend\\nsnippet for\\n\tfor ${1:e} in ${2:c}\\n\t\t${3}\\n\tend\\nsnippet until\\n\tuntil ${1:condition}\\n\t\t${2}\\n\tend\\nsnippet cla class .. end\\n\tclass ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`}\\n\t\t${2}\\n\tend\\nsnippet cla class .. initialize .. end\\n\tclass ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`}\\n\t\tdef initialize(${2:args})\\n\t\t\t${3}\\n\t\tend\\n\tend\\nsnippet cla class .. < ParentClass .. initialize .. end\\n\tclass ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`} < ${2:ParentClass}\\n\t\tdef initialize(${3:args})\\n\t\t\t${4}\\n\t\tend\\n\tend\\nsnippet cla ClassName = Struct .. do .. end\\n\t${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`} = Struct.new(:${2:attr_names}) do\\n\t\tdef ${3:method_name}\\n\t\t\t${4}\\n\t\tend\\n\tend\\nsnippet cla class BlankSlate .. initialize .. end\\n\tclass ${1:BlankSlate}\\n\t\tinstance_methods.each { |meth| undef_method(meth) unless meth =~ /\\\\A__/ }\\n\tend\\nsnippet cla class << self .. end\\n\tclass << ${1:self}\\n\t\t${2}\\n\tend\\n# class .. < DelegateClass .. initialize .. end\\nsnippet cla-\\n\tclass ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`} < DelegateClass(${2:ParentClass})\\n\t\tdef initialize(${3:args})\\n\t\t\tsuper(${4:del_obj})\\n\\n\t\t\t${5}\\n\t\tend\\n\tend\\nsnippet mod module .. end\\n\tmodule ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`}\\n\t\t${2}\\n\tend\\nsnippet mod module .. module_function .. end\\n\tmodule ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`}\\n\t\tmodule_function\\n\\n\t\t${2}\\n\tend\\nsnippet mod module .. ClassMethods .. end\\n\tmodule ${1:`substitute(Filename(), \\'\\\\(_\\\\|^\\\\)\\\\(.\\\\)\\', \\'\\\\u\\\\2\\', \\'g\\')`}\\n\t\tmodule ClassMethods\\n\t\t\t${2}\\n\t\tend\\n\\n\t\tmodule InstanceMethods\\n\\n\t\tend\\n\\n\t\tdef self.included(receiver)\\n\t\t\treceiver.extend         ClassMethods\\n\t\t\treceiver.send :include, InstanceMethods\\n\t\tend\\n\tend\\n# attr_reader\\nsnippet r\\n\tattr_reader :${1:attr_names}\\n# attr_writer\\nsnippet w\\n\tattr_writer :${1:attr_names}\\n# attr_accessor\\nsnippet rw\\n\tattr_accessor :${1:attr_names}\\nsnippet atp\\n\tattr_protected :${1:attr_names}\\nsnippet ata\\n\tattr_accessible :${1:attr_names}\\n# include Enumerable\\nsnippet Enum\\n\tinclude Enumerable\\n\\n\tdef each(&block)\\n\t\t${1}\\n\tend\\n# include Comparable\\nsnippet Comp\\n\tinclude Comparable\\n\\n\tdef <=>(other)\\n\t\t${1}\\n\tend\\n# extend Forwardable\\nsnippet Forw-\\n\textend Forwardable\\n# def self\\nsnippet defs\\n\tdef self.${1:class_method_name}\\n\t\t${2}\\n\tend\\n# def method_missing\\nsnippet defmm\\n\tdef method_missing(meth, *args, &blk)\\n\t\t${1}\\n\tend\\nsnippet defd\\n\tdef_delegator :${1:@del_obj}, :${2:del_meth}, :${3:new_name}\\nsnippet defds\\n\tdef_delegators :${1:@del_obj}, :${2:del_methods}\\nsnippet am\\n\talias_method :${1:new_name}, :${2:old_name}\\nsnippet app\\n\tif __FILE__ == $PROGRAM_NAME\\n\t\t${1}\\n\tend\\n# usage_if()\\nsnippet usai\\n\tif ARGV.${1}\\n\t\tabort \"Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}\"${3}\\n\tend\\n# usage_unless()\\nsnippet usau\\n\tunless ARGV.${1}\\n\t\tabort \"Usage: #{$PROGRAM_NAME} ${2:ARGS_GO_HERE}\"${3}\\n\tend\\nsnippet array\\n\tArray.new(${1:10}) { |${2:i}| ${3} }\\nsnippet hash\\n\tHash.new { |${1:hash}, ${2:key}| $1[$2] = ${3} }\\nsnippet file File.foreach() { |line| .. }\\n\tFile.foreach(${1:\"path/to/file\"}) { |${2:line}| ${3} }\\nsnippet file File.read()\\n\tFile.read(${1:\"path/to/file\"})${2}\\nsnippet Dir Dir.global() { |file| .. }\\n\tDir.glob(${1:\"dir/glob/*\"}) { |${2:file}| ${3} }\\nsnippet Dir Dir[\"..\"]\\n\tDir[${1:\"glob/**/*.rb\"}]${2}\\nsnippet dir\\n\tFilename.dirname(__FILE__)\\nsnippet deli\\n\tdelete_if { |${1:e}| ${2} }\\nsnippet fil\\n\tfill(${1:range}) { |${2:i}| ${3} }\\n# flatten_once()\\nsnippet flao\\n\tinject(Array.new) { |${1:arr}, ${2:a}| $1.push(*$2)}${3}\\nsnippet zip\\n\tzip(${1:enums}) { |${2:row}| ${3} }\\n# downto(0) { |n| .. }\\nsnippet dow\\n\tdownto(${1:0}) { |${2:n}| ${3} }\\nsnippet ste\\n\tstep(${1:2}) { |${2:n}| ${3} }\\nsnippet tim\\n\ttimes { |${1:n}| ${2} }\\nsnippet upt\\n\tupto(${1:1.0/0.0}) { |${2:n}| ${3} }\\nsnippet loo\\n\tloop { ${1} }\\nsnippet ea\\n\teach { |${1:e}| ${2} }\\nsnippet ead\\n\teach do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet eab\\n\teach_byte { |${1:byte}| ${2} }\\nsnippet eac- each_char { |chr| .. }\\n\teach_char { |${1:chr}| ${2} }\\nsnippet eac- each_cons(..) { |group| .. }\\n\teach_cons(${1:2}) { |${2:group}| ${3} }\\nsnippet eai\\n\teach_index { |${1:i}| ${2} }\\nsnippet eaid\\n\teach_index do |${1:i}|\\n\t\t${2}\\n\tend\\nsnippet eak\\n\teach_key { |${1:key}| ${2} }\\nsnippet eakd\\n\teach_key do |${1:key}|\\n\t\t${2}\\n\tend\\nsnippet eal\\n\teach_line { |${1:line}| ${2} }\\nsnippet eald\\n\teach_line do |${1:line}|\\n\t\t${2}\\n\tend\\nsnippet eap\\n\teach_pair { |${1:name}, ${2:val}| ${3} }\\nsnippet eapd\\n\teach_pair do |${1:name}, ${2:val}|\\n\t\t${3}\\n\tend\\nsnippet eas-\\n\teach_slice(${1:2}) { |${2:group}| ${3} }\\nsnippet easd-\\n\teach_slice(${1:2}) do |${2:group}|\\n\t\t${3}\\n\tend\\nsnippet eav\\n\teach_value { |${1:val}| ${2} }\\nsnippet eavd\\n\teach_value do |${1:val}|\\n\t\t${2}\\n\tend\\nsnippet eawi\\n\teach_with_index { |${1:e}, ${2:i}| ${3} }\\nsnippet eawid\\n\teach_with_index do |${1:e},${2:i}|\\n\t\t${3}\\n\tend\\nsnippet reve\\n\treverse_each { |${1:e}| ${2} }\\nsnippet reved\\n\treverse_each do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet inj\\n\tinject(${1:init}) { |${2:mem}, ${3:var}| ${4} }\\nsnippet injd\\n\tinject(${1:init}) do |${2:mem}, ${3:var}|\\n\t\t${4}\\n\tend\\nsnippet map\\n\tmap { |${1:e}| ${2} }\\nsnippet mapd\\n\tmap do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet mapwi-\\n\tenum_with_index.map { |${1:e}, ${2:i}| ${3} }\\nsnippet sor\\n\tsort { |a, b| ${1} }\\nsnippet sorb\\n\tsort_by { |${1:e}| ${2} }\\nsnippet ran\\n\tsort_by { rand }\\nsnippet all\\n\tall? { |${1:e}| ${2} }\\nsnippet any\\n\tany? { |${1:e}| ${2} }\\nsnippet cl\\n\tclassify { |${1:e}| ${2} }\\nsnippet col\\n\tcollect { |${1:e}| ${2} }\\nsnippet cold\\n\tcollect do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet det\\n\tdetect { |${1:e}| ${2} }\\nsnippet detd\\n\tdetect do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet fet\\n\tfetch(${1:name}) { |${2:key}| ${3} }\\nsnippet fin\\n\tfind { |${1:e}| ${2} }\\nsnippet find\\n\tfind do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet fina\\n\tfind_all { |${1:e}| ${2} }\\nsnippet finad\\n\tfind_all do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet gre\\n\tgrep(${1:/pattern/}) { |${2:match}| ${3} }\\nsnippet sub\\n\t${1:g}sub(${2:/pattern/}) { |${3:match}| ${4} }\\nsnippet sca\\n\tscan(${1:/pattern/}) { |${2:match}| ${3} }\\nsnippet scad\\n\tscan(${1:/pattern/}) do |${2:match}|\\n\t\t${3}\\n\tend\\nsnippet max\\n\tmax { |a, b| ${1} }\\nsnippet min\\n\tmin { |a, b| ${1} }\\nsnippet par\\n\tpartition { |${1:e}| ${2} }\\nsnippet pard\\n\tpartition do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet rej\\n\treject { |${1:e}| ${2} }\\nsnippet rejd\\n\treject do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet sel\\n\tselect { |${1:e}| ${2} }\\nsnippet seld\\n\tselect do |${1:e}|\\n\t\t${2}\\n\tend\\nsnippet lam\\n\tlambda { |${1:args}| ${2} }\\nsnippet doo\\n\tdo\\n\t\t${1}\\n\tend\\nsnippet dov\\n\tdo |${1:variable}|\\n\t\t${2}\\n\tend\\nsnippet :\\n\t:${1:key} => ${2:\"value\"}${3}\\nsnippet ope\\n\topen(${1:\"path/or/url/or/pipe\"}, \"${2:w}\") { |${3:io}| ${4} }\\n# path_from_here()\\nsnippet fpath\\n\tFile.join(File.dirname(__FILE__), *%2[${1:rel path here}])${2}\\n# unix_filter {}\\nsnippet unif\\n\tARGF.each_line${1} do |${2:line}|\\n\t\t${3}\\n\tend\\n# option_parse {}\\nsnippet optp\\n\trequire \"optparse\"\\n\\n\toptions = {${1:default => \"args\"}}\\n\\n\tARGV.options do |opts|\\n\t\topts.banner = \"Usage: #{File.basename($PROGRAM_NAME)}\\nsnippet opt\\n\topts.on( \"-${1:o}\", \"--${2:long-option-name}\", ${3:String},\\n\t         \"${4:Option description.}\") do |${5:opt}|\\n\t\t${6}\\n\tend\\nsnippet tc\\n\trequire \"test/unit\"\\n\\n\trequire \"${1:library_file_name}\"\\n\\n\tclass Test${2:$1} < Test::Unit::TestCase\\n\t\tdef test_${3:case_name}\\n\t\t\t${4}\\n\t\tend\\n\tend\\nsnippet ts\\n\trequire \"test/unit\"\\n\\n\trequire \"tc_${1:test_case_file}\"\\n\trequire \"tc_${2:test_case_file}\"${3}\\nsnippet as\\n\tassert ${1:test}, \"${2:Failure message.}\"${3}\\nsnippet ase\\n\tassert_equal ${1:expected}, ${2:actual}${3}\\nsnippet asne\\n\tassert_not_equal ${1:unexpected}, ${2:actual}${3}\\nsnippet asid\\n\tassert_in_delta ${1:expected_float}, ${2:actual_float}, ${3:2 ** -20}${4}\\nsnippet asio\\n\tassert_instance_of ${1:ExpectedClass}, ${2:actual_instance}${3}\\nsnippet asko\\n\tassert_kind_of ${1:ExpectedKind}, ${2:actual_instance}${3}\\nsnippet asn\\n\tassert_nil ${1:instance}${2}\\nsnippet asnn\\n\tassert_not_nil ${1:instance}${2}\\nsnippet asm\\n\tassert_match /${1:expected_pattern}/, ${2:actual_string}${3}\\nsnippet asnm\\n\tassert_no_match /${1:unexpected_pattern}/, ${2:actual_string}${3}\\nsnippet aso\\n\tassert_operator ${1:left}, :${2:operator}, ${3:right}${4}\\nsnippet asr\\n\tassert_raise ${1:Exception} { ${2} }\\nsnippet asrd\\n\tassert_raise ${1:Exception} do\\n\t\t${2}\\n\tend\\nsnippet asnr\\n\tassert_nothing_raised ${1:Exception} { ${2} }\\nsnippet asnrd\\n\tassert_nothing_raised ${1:Exception} do\\n\t\t${2}\\n\tend\\nsnippet asrt\\n\tassert_respond_to ${1:object}, :${2:method}${3}\\nsnippet ass assert_same(..)\\n\tassert_same ${1:expected}, ${2:actual}${3}\\nsnippet ass assert_send(..)\\n\tassert_send [${1:object}, :${2:message}, ${3:args}]${4}\\nsnippet asns\\n\tassert_not_same ${1:unexpected}, ${2:actual}${3}\\nsnippet ast\\n\tassert_throws :${1:expected} { ${2} }\\nsnippet astd\\n\tassert_throws :${1:expected} do\\n\t\t${2}\\n\tend\\nsnippet asnt\\n\tassert_nothing_thrown { ${1} }\\nsnippet asntd\\n\tassert_nothing_thrown do\\n\t\t${1}\\n\tend\\nsnippet fl\\n\tflunk \"${1:Failure message.}\"${2}\\n# Benchmark.bmbm do .. end\\nsnippet bm-\\n\tTESTS = ${1:10_000}\\n\tBenchmark.bmbm do |results|\\n\t\t${2}\\n\tend\\nsnippet rep\\n\tresults.report(\"${1:name}:\") { TESTS.times { ${2} }}\\n# Marshal.dump(.., file)\\nsnippet Md\\n\tFile.open(${1:\"path/to/file.dump\"}, \"wb\") { |${2:file}| Marshal.dump(${3:obj}, $2) }${4}\\n# Mashal.load(obj)\\nsnippet Ml\\n\tFile.open(${1:\"path/to/file.dump\"}, \"rb\") { |${2:file}| Marshal.load($2) }${3}\\n# deep_copy(..)\\nsnippet deec\\n\tMarshal.load(Marshal.dump(${1:obj_to_copy}))${2}\\nsnippet Pn-\\n\tPStore.new(${1:\"file_name.pstore\"})${2}\\nsnippet tra\\n\ttransaction(${1:true}) { ${2} }\\n# xmlread(..)\\nsnippet xml-\\n\tREXML::Document.new(File.read(${1:\"path/to/file\"}))${2}\\n# xpath(..) { .. }\\nsnippet xpa\\n\telements.each(${1:\"//Xpath\"}) do |${2:node}|\\n\t\t${3}\\n\tend\\n# class_from_name()\\nsnippet clafn\\n\tsplit(\"::\").inject(Object) { |par, const| par.const_get(const) }\\n# singleton_class()\\nsnippet sinc\\n\tclass << self; self end\\nsnippet nam\\n\tnamespace :${1:`Filename()`} do\\n\t\t${2}\\n\tend\\nsnippet tas\\n\tdesc \"${1:Task description}\"\\n\ttask :${2:task_name => [:dependent, :tasks]} do\\n\t\t${3}\\n\tend\\n# block\\nsnippet b\\n\t{ |${1:var}| ${2} }\\nsnippet begin\\n\tbegin\\n\t\traise \\'A test exception.\\'\\n\trescue Exception => e\\n\t\tputs e.message\\n\t\tputs e.backtrace.inspect\\n\telse\\n\t\t# other exception\\n\tensure\\n\t\t# always executed\\n\tend\\n\\n#debugging\\nsnippet debug\\n\trequire \\'ruby-debug\\'; debugger; true;\\nsnippet pry\\n\trequire \\'pry\\'; binding.pry\\n\\n#############################################\\n# Rails snippets - for pure Ruby, see above #\\n#############################################\\nsnippet art\\n\tassert_redirected_to ${1::action => \"${2:index}\"}\\nsnippet artnp\\n\tassert_redirected_to ${1:parent}_${2:child}_path(${3:@$1}, ${4:@$2})\\nsnippet artnpp\\n\tassert_redirected_to ${1:parent}_${2:child}_path(${3:@$1})\\nsnippet artp\\n\tassert_redirected_to ${1:model}_path(${2:@$1})\\nsnippet artpp\\n\tassert_redirected_to ${1:model}s_path\\nsnippet asd\\n\tassert_difference \"${1:Model}.${2:count}\", $1 do\\n\t\t${3}\\n\tend\\nsnippet asnd\\n\tassert_no_difference \"${1:Model}.${2:count}\" do\\n\t\t${3}\\n\tend\\nsnippet asre\\n\tassert_response :${1:success}, @response.body${2}\\nsnippet asrj\\n\tassert_rjs :${1:replace}, \"${2:dom id}\"\\nsnippet ass assert_select(..)\\n\tassert_select \\'${1:path}\\', :${2:text} => \\'${3:inner_html\\' ${4:do}\\nsnippet bf\\n\tbefore_filter :${1:method}\\nsnippet bt\\n\tbelongs_to :${1:association}\\nsnippet crw\\n\tcattr_accessor :${1:attr_names}\\nsnippet defcreate\\n\tdef create\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.new(params[:$1])\\n\\n\t\trespond_to do |wants|\\n\t\t\tif @$1.save\\n\t\t\t\tflash[:notice] = \\'$2 was successfully created.\\'\\n\t\t\t\twants.html { redirect_to(@$1) }\\n\t\t\t\twants.xml  { render :xml => @$1, :status => :created, :location => @$1 }\\n\t\t\telse\\n\t\t\t\twants.html { render :action => \"new\" }\\n\t\t\t\twants.xml  { render :xml => @$1.errors, :status => :unprocessable_entity }\\n\t\t\tend\\n\t\tend\\n\tend${3}\\nsnippet defdestroy\\n\tdef destroy\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])\\n\t\t@$1.destroy\\n\\n\t\trespond_to do |wants|\\n\t\t\twants.html { redirect_to($1s_url) }\\n\t\t\twants.xml  { head :ok }\\n\t\tend\\n\tend${3}\\nsnippet defedit\\n\tdef edit\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])\\n\tend\\nsnippet defindex\\n\tdef index\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.all\\n\\n\t\trespond_to do |wants|\\n\t\t\twants.html # index.html.erb\\n\t\t\twants.xml  { render :xml => @$1s }\\n\t\tend\\n\tend${3}\\nsnippet defnew\\n\tdef new\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.new\\n\\n\t\trespond_to do |wants|\\n\t\t\twants.html # new.html.erb\\n\t\t\twants.xml  { render :xml => @$1 }\\n\t\tend\\n\tend${3}\\nsnippet defshow\\n\tdef show\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])\\n\\n\t\trespond_to do |wants|\\n\t\t\twants.html # show.html.erb\\n\t\t\twants.xml  { render :xml => @$1 }\\n\t\tend\\n\tend${3}\\nsnippet defupdate\\n\tdef update\\n\t\t@${1:model_class_name} = ${2:ModelClassName}.find(params[:id])\\n\\n\t\trespond_to do |wants|\\n\t\t\tif @$1.update_attributes(params[:$1])\\n\t\t\t\tflash[:notice] = \\'$2 was successfully updated.\\'\\n\t\t\t\twants.html { redirect_to(@$1) }\\n\t\t\t\twants.xml  { head :ok }\\n\t\t\telse\\n\t\t\t\twants.html { render :action => \"edit\" }\\n\t\t\t\twants.xml  { render :xml => @$1.errors, :status => :unprocessable_entity }\\n\t\t\tend\\n\t\tend\\n\tend${3}\\nsnippet flash\\n\tflash[:${1:notice}] = \"${2}\"\\nsnippet habtm\\n\thas_and_belongs_to_many :${1:object}, :join_table => \"${2:table_name}\", :foreign_key => \"${3}_id\"${4}\\nsnippet hm\\n\thas_many :${1:object}\\nsnippet hmd\\n\thas_many :${1:other}s, :class_name => \"${2:$1}\", :foreign_key => \"${3:$1}_id\", :dependent => :destroy${4}\\nsnippet hmt\\n\thas_many :${1:object}, :through => :${2:object}\\nsnippet ho\\n\thas_one :${1:object}\\nsnippet i18\\n\tI18n.t(\\'${1:type.key}\\')${2}\\nsnippet ist\\n\t<%= image_submit_tag(\"${1:agree.png}\", :id => \"${2:id}\"${3} %>\\nsnippet log\\n\tRails.logger.${1:debug} ${2}\\nsnippet log2\\n\tRAILS_DEFAULT_LOGGER.${1:debug} ${2}\\nsnippet logd\\n\tlogger.debug { \"${1:message}\" }${2}\\nsnippet loge\\n\tlogger.error { \"${1:message}\" }${2}\\nsnippet logf\\n\tlogger.fatal { \"${1:message}\" }${2}\\nsnippet logi\\n\tlogger.info { \"${1:message}\" }${2}\\nsnippet logw\\n\tlogger.warn { \"${1:message}\" }${2}\\nsnippet mapc\\n\t${1:map}.${2:connect} \\'${3:controller/:action/:id}\\'\\nsnippet mapca\\n\t${1:map}.catch_all \"*${2:anything}\", :controller => \"${3:default}\", :action => \"${4:error}\"${5}\\nsnippet mapr\\n\t${1:map}.resource :${2:resource}\\nsnippet maprs\\n\t${1:map}.resources :${2:resource}\\nsnippet mapwo\\n\t${1:map}.with_options :${2:controller} => \\'${3:thing}\\' do |$3|\\n\t\t${4}\\n\tend\\nsnippet mbs\\n\tbefore_save :${1:method}\\nsnippet mcht\\n\tchange_table :${1:table_name} do |t|\\n\t\t${2}\\n\tend\\nsnippet mp\\n\tmap(&:${1:id})\\nsnippet mrw\\n\tmattr_accessor :${1:attr_names}\\nsnippet oa\\n\torder(\"${1:field}\")\\nsnippet od\\n\torder(\"${1:field} DESC\")\\nsnippet pa\\n\tparams[:${1:id}]${2}\\nsnippet ra\\n\trender :action => \"${1:action}\"\\nsnippet ral\\n\trender :action => \"${1:action}\", :layout => \"${2:layoutname}\"\\nsnippet rest\\n\trespond_to do |wants|\\n\t\twants.${1:html} { ${2} }\\n\tend\\nsnippet rf\\n\trender :file => \"${1:filepath}\"\\nsnippet rfu\\n\trender :file => \"${1:filepath}\", :use_full_path => ${2:false}\\nsnippet ri\\n\trender :inline => \"${1:<%= \\'hello\\' %>}\"\\nsnippet ril\\n\trender :inline => \"${1:<%= \\'hello\\' %>}\", :locals => { ${2::name} => \"${3:value}\"${4} }\\nsnippet rit\\n\trender :inline => \"${1:<%= \\'hello\\' %>}\", :type => ${2::rxml}\\nsnippet rjson\\n\trender :json => ${1:text to render}\\nsnippet rl\\n\trender :layout => \"${1:layoutname}\"\\nsnippet rn\\n\trender :nothing => ${1:true}\\nsnippet rns\\n\trender :nothing => ${1:true}, :status => ${2:401}\\nsnippet rp\\n\trender :partial => \"${1:item}\"\\nsnippet rpc\\n\trender :partial => \"${1:item}\", :collection => ${2:@$1s}\\nsnippet rpl\\n\trender :partial => \"${1:item}\", :locals => { :${2:$1} => ${3:@$1}\\nsnippet rpo\\n\trender :partial => \"${1:item}\", :object => ${2:@$1}\\nsnippet rps\\n\trender :partial => \"${1:item}\", :status => ${2:500}\\nsnippet rt\\n\trender :text => \"${1:text to render}\"\\nsnippet rtl\\n\trender :text => \"${1:text to render}\", :layout => \"${2:layoutname}\"\\nsnippet rtlt\\n\trender :text => \"${1:text to render}\", :layout => ${2:true}\\nsnippet rts\\n\trender :text => \"${1:text to render}\", :status => ${2:401}\\nsnippet ru\\n\trender :update do |${1:page}|\\n\t\t$1.${2}\\n\tend\\nsnippet rxml\\n\trender :xml => ${1:text to render}\\nsnippet sc\\n\tscope :${1:name}, :where(:@${2:field} => ${3:value})\\nsnippet sl\\n\tscope :${1:name}, lambda do |${2:value}|\\n\t\twhere(\"${3:field = ?}\", ${4:bind var})\\n\tend\\nsnippet sha1\\n\tDigest::SHA1.hexdigest(${1:string})\\nsnippet sweeper\\n\tclass ${1:ModelClassName}Sweeper < ActionController::Caching::Sweeper\\n\t\tobserve $1\\n\\n\t\tdef after_save(${2:model_class_name})\\n\t\t\texpire_cache($2)\\n\t\tend\\n\\n\t\tdef after_destroy($2)\\n\t\t\texpire_cache($2)\\n\t\tend\\n\\n\t\tdef expire_cache($2)\\n\t\t\texpire_page\\n\t\tend\\n\tend\\nsnippet tcb\\n\tt.boolean :${1:title}\\n\t${2}\\nsnippet tcbi\\n\tt.binary :${1:title}, :limit => ${2:2}.megabytes\\n\t${3}\\nsnippet tcd\\n\tt.decimal :${1:title}, :precision => ${2:10}, :scale => ${3:2}\\n\t${4}\\nsnippet tcda\\n\tt.date :${1:title}\\n\t${2}\\nsnippet tcdt\\n\tt.datetime :${1:title}\\n\t${2}\\nsnippet tcf\\n\tt.float :${1:title}\\n\t${2}\\nsnippet tch\\n\tt.change :${1:name}, :${2:string}, :${3:limit} => ${4:80}\\n\t${5}\\nsnippet tci\\n\tt.integer :${1:title}\\n\t${2}\\nsnippet tcl\\n\tt.integer :lock_version, :null => false, :default => 0\\n\t${1}\\nsnippet tcr\\n\tt.references :${1:taggable}, :polymorphic => { :default => \\'${2:Photo}\\' }\\n\t${3}\\nsnippet tcs\\n\tt.string :${1:title}\\n\t${2}\\nsnippet tct\\n\tt.text :${1:title}\\n\t${2}\\nsnippet tcti\\n\tt.time :${1:title}\\n\t${2}\\nsnippet tcts\\n\tt.timestamp :${1:title}\\n\t${2}\\nsnippet tctss\\n\tt.timestamps\\n\t${1}\\nsnippet va\\n\tvalidates_associated :${1:attribute}\\nsnippet vao\\n\tvalidates_acceptance_of :${1:terms}\\nsnippet vc\\n\tvalidates_confirmation_of :${1:attribute}\\nsnippet ve\\n\tvalidates_exclusion_of :${1:attribute}, :in => ${2:%w( mov avi )}\\nsnippet vf\\n\tvalidates_format_of :${1:attribute}, :with => /${2:regex}/\\nsnippet vi\\n\tvalidates_inclusion_of :${1:attribute}, :in => %w(${2: mov avi })\\nsnippet vl\\n\tvalidates_length_of :${1:attribute}, :within => ${2:3}..${3:20}\\nsnippet vn\\n\tvalidates_numericality_of :${1:attribute}\\nsnippet vpo\\n\tvalidates_presence_of :${1:attribute}\\nsnippet vu\\n\tvalidates_uniqueness_of :${1:attribute}\\nsnippet wants\\n\twants.${1:js|xml|html} { ${2} }\\nsnippet wc\\n\twhere(${1:\"conditions\"}${2:, bind_var})\\nsnippet wh\\n\twhere(${1:field} => ${2:value})\\nsnippet xdelete\\n\txhr :delete, :${1:destroy}, :id => ${2:1}${3}\\nsnippet xget\\n\txhr :get, :${1:show}, :id => ${2:1}${3}\\nsnippet xpost\\n\txhr :post, :${1:create}, :${2:object} => { ${3} }\\nsnippet xput\\n\txhr :put, :${1:update}, :id => ${2:1}, :${3:object} => { ${4} }${5}\\nsnippet test\\n\ttest \"should ${1:do something}\" do\\n\t\t${2}\\n\tend\\n#migrations\\nsnippet mac\\n\tadd_column :${1:table_name}, :${2:column_name}, :${3:data_type}\\nsnippet mrc\\n\tremove_column :${1:table_name}, :${2:column_name}\\nsnippet mrnc\\n\trename_column :${1:table_name}, :${2:old_column_name}, :${3:new_column_name}\\nsnippet mcc\\n\tchange_column :${1:table}, :${2:column}, :${3:type}\\nsnippet mccc\\n\tt.column :${1:title}, :${2:string}\\nsnippet mct\\n\tcreate_table :${1:table_name} do |t|\\n\t\tt.column :${2:name}, :${3:type}\\n\tend\\nsnippet migration\\n\tclass ${1:class_name} < ActiveRecord::Migration\\n\t\tdef self.up\\n\t\t\t${2}\\n\t\tend\\n\\n\t\tdef self.down\\n\t\tend\\n\tend\\n\\nsnippet trc\\n\tt.remove :${1:column}\\nsnippet tre\\n\tt.rename :${1:old_column_name}, :${2:new_column_name}\\n\t${3}\\nsnippet tref\\n\tt.references :${1:model}\\n\\n#rspec\\nsnippet it\\n\tit \"${1:spec_name}\" do\\n\t\t${2}\\n\tend\\nsnippet itp\\n\tit \"${1:spec_name}\"\\n\t${2}\\nsnippet desc\\n\tdescribe ${1:class_name} do\\n\t\t${2}\\n\tend\\nsnippet cont\\n\tcontext \"${1:message}\" do\\n\t\t${2}\\n\tend\\nsnippet bef\\n\tbefore :${1:each} do\\n\t\t${2}\\n\tend\\nsnippet aft\\n\tafter :${1:each} do\\n\t\t${2}\\n\tend\\n',t.scope=\"ruby\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/rust.js",
    "content": "define(\"ace/snippets/rust\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"rust\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/sass.js",
    "content": "define(\"ace/snippets/sass\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"sass\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/scad.js",
    "content": "define(\"ace/snippets/scad\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"scad\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/scala.js",
    "content": "define(\"ace/snippets/scala\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"scala\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/scheme.js",
    "content": "define(\"ace/snippets/scheme\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"scheme\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/scss.js",
    "content": "define(\"ace/snippets/scss\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"scss\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/sh.js",
    "content": "define(\"ace/snippets/sh\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# Shebang. Executing bash via /usr/bin/env makes scripts more portable.\\nsnippet #!\\n\t#!/usr/bin/env bash\\n\t\\nsnippet if\\n\tif [[ ${1:condition} ]]; then\\n\t\t${2:#statements}\\n\tfi\\nsnippet elif\\n\telif [[ ${1:condition} ]]; then\\n\t\t${2:#statements}\\nsnippet for\\n\tfor (( ${2:i} = 0; $2 < ${1:count}; $2++ )); do\\n\t\t${3:#statements}\\n\tdone\\nsnippet fori\\n\tfor ${1:needle} in ${2:haystack} ; do\\n\t\t${3:#statements}\\n\tdone\\nsnippet wh\\n\twhile [[ ${1:condition} ]]; do\\n\t\t${2:#statements}\\n\tdone\\nsnippet until\\n\tuntil [[ ${1:condition} ]]; do\\n\t\t${2:#statements}\\n\tdone\\nsnippet case\\n\tcase ${1:word} in\\n\t\t${2:pattern})\\n\t\t\t${3};;\\n\tesac\\nsnippet go \\n\twhile getopts \\'${1:o}\\' ${2:opts} \\n\tdo \\n\t\tcase $$2 in\\n\t\t${3:o0})\\n\t\t\t${4:#staments};;\\n\t\tesac\\n\tdone\\n# Set SCRIPT_DIR variable to directory script is located.\\nsnippet sdir\\n\tSCRIPT_DIR=\"$( cd \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd )\"\\n# getopt\\nsnippet getopt\\n\t__ScriptVersion=\"${1:version}\"\\n\\n\t#===  FUNCTION  ================================================================\\n\t#         NAME:  usage\\n\t#  DESCRIPTION:  Display usage information.\\n\t#===============================================================================\\n\tfunction usage ()\\n\t{\\n\t\t\tcat <<- EOT\\n\\n\t  Usage :  $${0:0} [options] [--] \\n\\n\t  Options: \\n\t  -h|help       Display this message\\n\t  -v|version    Display script version\\n\\n\t\t\tEOT\\n\t}    # ----------  end of function usage  ----------\\n\\n\t#-----------------------------------------------------------------------\\n\t#  Handle command line arguments\\n\t#-----------------------------------------------------------------------\\n\\n\twhile getopts \":hv\" opt\\n\tdo\\n\t  case $opt in\\n\\n\t\th|help     )  usage; exit 0   ;;\\n\\n\t\tv|version  )  echo \"$${0:0} -- Version $__ScriptVersion\"; exit 0   ;;\\n\\n\t\t\\\\? )  echo -e \"\\\\n  Option does not exist : $OPTARG\\\\n\"\\n\t\t\t  usage; exit 1   ;;\\n\\n\t  esac    # --- end of case ---\\n\tdone\\n\tshift $(($OPTIND-1))\\n\\n',t.scope=\"sh\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/sjs.js",
    "content": "define(\"ace/snippets/sjs\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"sjs\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/smarty.js",
    "content": "define(\"ace/snippets/smarty\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"smarty\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/snippets.js",
    "content": "define(\"ace/snippets/snippets\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# snippets for making snippets :)\\nsnippet snip\\n\tsnippet ${1:trigger}\\n\t\t${2}\\nsnippet msnip\\n\tsnippet ${1:trigger} ${2:description}\\n\t\t${3}\\nsnippet v\\n\t{VISUAL}\\n\",t.scope=\"snippets\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/soy_template.js",
    "content": "define(\"ace/snippets/soy_template\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"soy_template\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/space.js",
    "content": "define(\"ace/snippets/space\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"space\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/sql.js",
    "content": "define(\"ace/snippets/sql\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"snippet tbl\\n\tcreate table ${1:table} (\\n\t\t${2:columns}\\n\t);\\nsnippet col\\n\t${1:name}\t${2:type}\t${3:default ''}\t${4:not null}\\nsnippet ccol\\n\t${1:name}\tvarchar2(${2:size})\t${3:default ''}\t${4:not null}\\nsnippet ncol\\n\t${1:name}\tnumber\t${3:default 0}\t${4:not null}\\nsnippet dcol\\n\t${1:name}\tdate\t${3:default sysdate}\t${4:not null}\\nsnippet ind\\n\tcreate index ${3:$1_$2} on ${1:table}(${2:column});\\nsnippet uind\\n\tcreate unique index ${1:name} on ${2:table}(${3:column});\\nsnippet tblcom\\n\tcomment on table ${1:table} is '${2:comment}';\\nsnippet colcom\\n\tcomment on column ${1:table}.${2:column} is '${3:comment}';\\nsnippet addcol\\n\talter table ${1:table} add (${2:column} ${3:type});\\nsnippet seq\\n\tcreate sequence ${1:name} start with ${2:1} increment by ${3:1} minvalue ${4:1};\\nsnippet s*\\n\tselect * from ${1:table}\\n\",t.scope=\"sql\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/stylus.js",
    "content": "define(\"ace/snippets/stylus\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"stylus\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/svg.js",
    "content": "define(\"ace/snippets/svg\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"svg\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/tcl.js",
    "content": "define(\"ace/snippets/tcl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"# #!/usr/bin/env tclsh\\nsnippet #!\\n\t#!/usr/bin/env tclsh\\n\t\\n# Process\\nsnippet pro\\n\tproc ${1:function_name} {${2:args}} {\\n\t\t${3:#body ...}\\n\t}\\n#xif\\nsnippet xif\\n\t${1:expr}? ${2:true} : ${3:false}\\n# Conditional\\nsnippet if\\n\tif {${1}} {\\n\t\t${2:# body...}\\n\t}\\n# Conditional if..else\\nsnippet ife\\n\tif {${1}} {\\n\t\t${2:# body...}\\n\t} else {\\n\t\t${3:# else...}\\n\t}\\n# Conditional if..elsif..else\\nsnippet ifee\\n\tif {${1}} {\\n\t\t${2:# body...}\\n\t} elseif {${3}} {\\n\t\t${4:# elsif...}\\n\t} else {\\n\t\t${5:# else...}\\n\t}\\n# If catch then\\nsnippet ifc\\n\tif { [catch {${1:#do something...}} ${2:err}] } {\\n\t\t${3:# handle failure...}\\n\t}\\n# Catch\\nsnippet catch\\n\tcatch {${1}} ${2:err} ${3:options}\\n# While Loop\\nsnippet wh\\n\twhile {${1}} {\\n\t\t${2:# body...}\\n\t}\\n# For Loop\\nsnippet for\\n\tfor {set ${2:var} 0} {$$2 < ${1:count}} {${3:incr} $2} {\\n\t\t${4:# body...}\\n\t}\\n# Foreach Loop\\nsnippet fore\\n\tforeach ${1:x} {${2:#list}} {\\n\t\t${3:# body...}\\n\t}\\n# after ms script...\\nsnippet af\\n\tafter ${1:ms} ${2:#do something}\\n# after cancel id\\nsnippet afc\\n\tafter cancel ${1:id or script}\\n# after idle\\nsnippet afi\\n\tafter idle ${1:script}\\n# after info id\\nsnippet afin\\n\tafter info ${1:id}\\n# Expr\\nsnippet exp\\n\texpr {${1:#expression here}}\\n# Switch\\nsnippet sw\\n\tswitch ${1:var} {\\n\t\t${3:pattern 1} {\\n\t\t\t${4:#do something}\\n\t\t}\\n\t\tdefault {\\n\t\t\t${2:#do something}\\n\t\t}\\n\t}\\n# Case\\nsnippet ca\\n\t${1:pattern} {\\n\t\t${2:#do something}\\n\t}${3}\\n# Namespace eval\\nsnippet ns\\n\tnamespace eval ${1:path} {${2:#script...}}\\n# Namespace current\\nsnippet nsc\\n\tnamespace current\\n\",t.scope=\"tcl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/tex.js",
    "content": "define(\"ace/snippets/tex\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"#PREAMBLE\\n#newcommand\\nsnippet nc\\n\t\\\\newcommand{\\\\${1:cmd}}[${2:opt}]{${3:realcmd}}${4}\\n#usepackage\\nsnippet up\\n\t\\\\usepackage[${1:[options}]{${2:package}}\\n#newunicodechar\\nsnippet nuc\\n\t\\\\newunicodechar{${1}}{${2:\\\\ensuremath}${3:tex-substitute}}}\\n#DeclareMathOperator\\nsnippet dmo\\n\t\\\\DeclareMathOperator{${1}}{${2}}\\n\\n#DOCUMENT\\n# \\\\begin{}...\\\\end{}\\nsnippet begin\\n\t\\\\begin{${1:env}}\\n\t\t${2}\\n\t\\\\end{$1}\\n# Tabular\\nsnippet tab\\n\t\\\\begin{${1:tabular}}{${2:c}}\\n\t${3}\\n\t\\\\end{$1}\\nsnippet thm\\n\t\\\\begin[${1:author}]{${2:thm}}\\n\t${3}\\n\t\\\\end{$1}\\nsnippet center\\n\t\\\\begin{center}\\n\t\t${1}\\n\t\\\\end{center}\\n# Align(ed)\\nsnippet ali\\n\t\\\\begin{align${1:ed}}\\n\t\t${2}\\n\t\\\\end{align$1}\\n# Gather(ed)\\nsnippet gat\\n\t\\\\begin{gather${1:ed}}\\n\t\t${2}\\n\t\\\\end{gather$1}\\n# Equation\\nsnippet eq\\n\t\\\\begin{equation}\\n\t\t${1}\\n\t\\\\end{equation}\\n# Equation\\nsnippet eq*\\n\t\\\\begin{equation*}\\n\t\t${1}\\n\t\\\\end{equation*}\\n# Unnumbered Equation\\nsnippet \\\\\\n\t\\\\[\\n\t\t${1}\\n\t\\\\]\\n# Enumerate\\nsnippet enum\\n\t\\\\begin{enumerate}\\n\t\t\\\\item ${1}\\n\t\\\\end{enumerate}\\n# Itemize\\nsnippet itemize\\n\t\\\\begin{itemize}\\n\t\t\\\\item ${1}\\n\t\\\\end{itemize}\\n# Description\\nsnippet desc\\n\t\\\\begin{description}\\n\t\t\\\\item[${1}] ${2}\\n\t\\\\end{description}\\n# Matrix\\nsnippet mat\\n\t\\\\begin{${1:p/b/v/V/B/small}matrix}\\n\t\t${2}\\n\t\\\\end{$1matrix}\\n# Cases\\nsnippet cas\\n\t\\\\begin{cases}\\n\t\t${1:equation}, &\\\\text{ if }${2:case}\\\\\\\\\\n\t\t${3}\\n\t\\\\end{cases}\\n# Split\\nsnippet spl\\n\t\\\\begin{split}\\n\t\t${1}\\n\t\\\\end{split}\\n# Part\\nsnippet part\\n\t\\\\part{${1:part name}} % (fold)\\n\t\\\\label{prt:${2:$1}}\\n\t${3}\\n\t% part $2 (end)\\n# Chapter\\nsnippet cha\\n\t\\\\chapter{${1:chapter name}}\\n\t\\\\label{cha:${2:$1}}\\n\t${3}\\n# Section\\nsnippet sec\\n\t\\\\section{${1:section name}}\\n\t\\\\label{sec:${2:$1}}\\n\t${3}\\n# Sub Section\\nsnippet sub\\n\t\\\\subsection{${1:subsection name}}\\n\t\\\\label{sub:${2:$1}}\\n\t${3}\\n# Sub Sub Section\\nsnippet subs\\n\t\\\\subsubsection{${1:subsubsection name}}\\n\t\\\\label{ssub:${2:$1}}\\n\t${3}\\n# Paragraph\\nsnippet par\\n\t\\\\paragraph{${1:paragraph name}}\\n\t\\\\label{par:${2:$1}}\\n\t${3}\\n# Sub Paragraph\\nsnippet subp\\n\t\\\\subparagraph{${1:subparagraph name}}\\n\t\\\\label{subp:${2:$1}}\\n\t${3}\\n#References\\nsnippet itd\\n\t\\\\item[${1:description}] ${2:item}\\nsnippet figure\\n\t${1:Figure}~\\\\ref{${2:fig:}}${3}\\nsnippet table\\n\t${1:Table}~\\\\ref{${2:tab:}}${3}\\nsnippet listing\\n\t${1:Listing}~\\\\ref{${2:list}}${3}\\nsnippet section\\n\t${1:Section}~\\\\ref{${2:sec:}}${3}\\nsnippet page\\n\t${1:page}~\\\\pageref{${2}}${3}\\nsnippet index\\n\t\\\\index{${1:index}}${2}\\n#Citations\\nsnippet cite\\n\t\\\\cite[${1}]{${2}}${3}\\nsnippet fcite\\n\t\\\\footcite[${1}]{${2}}${3}\\n#Formating text: italic, bold, underline, small capital, emphase ..\\nsnippet it\\n\t\\\\textit{${1:text}}\\nsnippet bf\\n\t\\\\textbf{${1:text}}\\nsnippet under\\n\t\\\\underline{${1:text}}\\nsnippet emp\\n\t\\\\emph{${1:text}}\\nsnippet sc\\n\t\\\\textsc{${1:text}}\\n#Choosing font\\nsnippet sf\\n\t\\\\textsf{${1:text}}\\nsnippet rm\\n\t\\\\textrm{${1:text}}\\nsnippet tt\\n\t\\\\texttt{${1:text}}\\n#misc\\nsnippet ft\\n\t\\\\footnote{${1:text}}\\nsnippet fig\\n\t\\\\begin{figure}\\n\t\\\\begin{center}\\n\t    \\\\includegraphics[scale=${1}]{Figures/${2}}\\n\t\\\\end{center}\\n\t\\\\caption{${3}}\\n\t\\\\label{fig:${4}}\\n\t\\\\end{figure}\\nsnippet tikz\\n\t\\\\begin{figure}\\n\t\\\\begin{center}\\n\t\\\\begin{tikzpicture}[scale=${1:1}]\\n\t\t${2}\\n\t\\\\end{tikzpicture}\\n\t\\\\end{center}\\n\t\\\\caption{${3}}\\n\t\\\\label{fig:${4}}\\n\t\\\\end{figure}\\n#math\\nsnippet stackrel\\n\t\\\\stackrel{${1:above}}{${2:below}} ${3}\\nsnippet frac\\n\t\\\\frac{${1:num}}{${2:denom}}\\nsnippet sum\\n\t\\\\sum^{${1:n}}_{${2:i=1}}{${3}}\",t.scope=\"tex\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/text.js",
    "content": "define(\"ace/snippets/text\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"text\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/textile.js",
    "content": "define(\"ace/snippets/textile\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# Jekyll post header\\nsnippet header\\n\t---\\n\ttitle: ${1:title}\\n\tlayout: post\\n\tdate: ${2:date} ${3:hour:minute:second} -05:00\\n\t---\\n\\n# Image\\nsnippet img\\n\t!${1:url}(${2:title}):${3:link}!\\n\\n# Table\\nsnippet |\\n\t|${1}|${2}\\n\\n# Link\\nsnippet link\\n\t\"${1:link text}\":${2:url}\\n\\n# Acronym\\nsnippet (\\n\t(${1:Expand acronym})${2}\\n\\n# Footnote\\nsnippet fn\\n\t[${1:ref number}] ${3}\\n\\n\tfn$1. ${2:footnote}\\n\t\\n',t.scope=\"textile\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/toml.js",
    "content": "define(\"ace/snippets/toml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"toml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/twig.js",
    "content": "define(\"ace/snippets/twig\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"twig\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/typescript.js",
    "content": "define(\"ace/snippets/typescript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"typescript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/vala.js",
    "content": "define(\"ace/snippets/vala\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippets=[{content:\"case ${1:condition}:\\n\t$0\\n\tbreak;\\n\",name:\"case\",scope:\"vala\",tabTrigger:\"case\"},{content:\"/**\\n * ${6}\\n */\\n${1:public} class ${2:MethodName}${3: : GLib.Object} {\\n\\n\t/**\\n\t * ${7}\\n\t */\\n\tpublic ${2}(${4}) {\\n\t\t${5}\\n\t}\\n\\n\t$0\\n}\",name:\"class\",scope:\"vala\",tabTrigger:\"class\"},{content:\"(${1}) => {\\n\t${0}\\n}\\n\",name:\"closure\",scope:\"vala\",tabTrigger:\"=>\"},{content:\"/*\\n * $0\\n */\",name:\"Comment (multiline)\",scope:\"vala\",tabTrigger:\"/*\"},{content:\"Console.WriteLine($1);\\n$0\",name:\"Console.WriteLine (writeline)\",scope:\"vala\",tabTrigger:\"writeline\"},{content:'[DBus(name = \"$0\")]',name:\"DBus annotation\",scope:\"vala\",tabTrigger:\"[DBus\"},{content:\"delegate ${1:void} ${2:DelegateName}($0);\",name:\"delegate\",scope:\"vala\",tabTrigger:\"delegate\"},{content:\"do {\\n\t$0\\n} while ($1);\\n\",name:\"do while\",scope:\"vala\",tabTrigger:\"dowhile\"},{content:\"/**\\n * $0\\n */\",name:\"DocBlock\",scope:\"vala\",tabTrigger:\"/**\"},{content:\"else if ($1) {\\n\t$0\\n}\\n\",name:\"else if (elseif)\",scope:\"vala\",tabTrigger:\"elseif\"},{content:\"else {\\n\t$0\\n}\",name:\"else\",scope:\"vala\",tabTrigger:\"else\"},{content:\"enum {$1:EnumName} {\\n\t$0\\n}\",name:\"enum\",scope:\"vala\",tabTrigger:\"enum\"},{content:\"public errordomain ${1:Error} {\\n\t$0\\n}\",name:\"error domain\",scope:\"vala\",tabTrigger:\"errordomain\"},{content:\"for ($1;$2;$3) {\\n\t$0\\n}\",name:\"for\",scope:\"vala\",tabTrigger:\"for\"},{content:\"foreach ($1 in $2) {\\n\t$0\\n}\",name:\"foreach\",scope:\"vala\",tabTrigger:\"foreach\"},{content:\"Gee.ArrayList<${1:G}>($0);\",name:\"Gee.ArrayList\",scope:\"vala\",tabTrigger:\"ArrayList\"},{content:\"Gee.HashMap<${1:K},${2:V}>($0);\",name:\"Gee.HashMap\",scope:\"vala\",tabTrigger:\"HashMap\"},{content:\"Gee.HashSet<${1:G}>($0);\",name:\"Gee.HashSet\",scope:\"vala\",tabTrigger:\"HashSet\"},{content:\"if ($1) {\\n\t$0\\n}\",name:\"if\",scope:\"vala\",tabTrigger:\"if\"},{content:\"interface ${1:InterfaceName}{$2: : SuperInterface} {\\n\t$0\\n}\",name:\"interface\",scope:\"vala\",tabTrigger:\"interface\"},{content:\"public static int main(string [] argv) {\\n\t${0}\\n\treturn 0;\\n}\",name:\"Main function\",scope:\"vala\",tabTrigger:\"main\"},{content:\"namespace $1 {\\n\t$0\\n}\\n\",name:\"namespace (ns)\",scope:\"vala\",tabTrigger:\"ns\"},{content:\"stdout.printf($0);\",name:\"printf\",scope:\"vala\",tabTrigger:\"printf\"},{content:\"${1:public} ${2:Type} ${3:Name} {\\n\tset {\\n\t\t$0\\n\t}\\n\tget {\\n\\n\t}\\n}\",name:\"property (prop)\",scope:\"vala\",tabTrigger:\"prop\"},{content:\"${1:public} ${2:Type} ${3:Name} {\\n\tget {\\n\t\t$0\\n\t}\\n}\",name:\"read-only property (roprop)\",scope:\"vala\",tabTrigger:\"roprop\"},{content:'@\"${1:\\\\$var}\"',name:\"String template (@)\",scope:\"vala\",tabTrigger:\"@\"},{content:\"struct ${1:StructName} {\\n\t$0\\n}\",name:\"struct\",scope:\"vala\",tabTrigger:\"struct\"},{content:\"switch ($1) {\\n\t$0\\n}\",name:\"switch\",scope:\"vala\",tabTrigger:\"switch\"},{content:\"try {\\n\t$2\\n} catch (${1:Error} e) {\\n\t$0\\n}\",name:\"try/catch\",scope:\"vala\",tabTrigger:\"try\"},{content:'\"\"\"$0\"\"\";',name:'Verbatim string (\"\"\")',scope:\"vala\",tabTrigger:\"verbatim\"},{content:\"while ($1) {\\n\t$0\\n}\",name:\"while\",scope:\"vala\",tabTrigger:\"while\"}],t.scope=\"\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/vbscript.js",
    "content": "define(\"ace/snippets/vbscript\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"vbscript\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/velocity.js",
    "content": "define(\"ace/snippets/velocity\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='# macro\\nsnippet #macro\\n\t#macro ( ${1:macroName} ${2:\\\\$var1, [\\\\$var2, ...]} )\\n\t\t${3:## macro code}\\n\t#end\\n# foreach\\nsnippet #foreach\\n\t#foreach ( ${1:\\\\$item} in ${2:\\\\$collection} )\\n\t\t${3:## foreach code}\\n\t#end\\n# if\\nsnippet #if\\n\t#if ( ${1:true} )\\n\t\t${0}\\n\t#end\\n# if ... else\\nsnippet #ife\\n\t#if ( ${1:true} )\\n\t\t${2}\\n\t#else\\n\t\t${0}\\n\t#end\\n#import\\nsnippet #import\\n\t#import ( \"${1:path/to/velocity/format}\" )\\n# set\\nsnippet #set\\n\t#set ( $${1:var} = ${0} )\\n',t.scope=\"velocity\",t.includeScopes=[\"html\",\"javascript\",\"css\"]})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/verilog.js",
    "content": "define(\"ace/snippets/verilog\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"verilog\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/vhdl.js",
    "content": "define(\"ace/snippets/vhdl\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"vhdl\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/xml.js",
    "content": "define(\"ace/snippets/xml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"xml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/xquery.js",
    "content": "define(\"ace/snippets/xquery\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText='snippet for\\n\tfor $${1:item} in ${2:expr}\\nsnippet return\\n\treturn ${1:expr}\\nsnippet import\\n\timport module namespace ${1:ns} = \"${2:http://www.example.com/}\";\\nsnippet some\\n\tsome $${1:varname} in ${2:expr} satisfies ${3:expr}\\nsnippet every\\n\tevery $${1:varname} in ${2:expr} satisfies ${3:expr}\\nsnippet if\\n\tif(${1:true}) then ${2:expr} else ${3:true}\\nsnippet switch\\n\tswitch(${1:\"foo\"})\\n\tcase ${2:\"foo\"}\\n\treturn ${3:true}\\n\tdefault return ${4:false}\\nsnippet try\\n\ttry { ${1:expr} } catch ${2:*} { ${3:expr} }\\nsnippet tumbling\\n\tfor tumbling window $${1:varname} in ${2:expr}\\n\tstart at $${3:start} when ${4:expr}\\n\tend at $${5:end} when ${6:expr}\\n\treturn ${7:expr}\\nsnippet sliding\\n\tfor sliding window $${1:varname} in ${2:expr}\\n\tstart at $${3:start} when ${4:expr}\\n\tend at $${5:end} when ${6:expr}\\n\treturn ${7:expr}\\nsnippet let\\n\tlet $${1:varname} := ${2:expr}\\nsnippet group\\n\tgroup by $${1:varname} := ${2:expr}\\nsnippet order\\n\torder by ${1:expr} ${2:descending}\\nsnippet stable\\n\tstable order by ${1:expr}\\nsnippet count\\n\tcount $${1:varname}\\nsnippet ordered\\n\tordered { ${1:expr} }\\nsnippet unordered\\n\tunordered { ${1:expr} }\\nsnippet treat \\n\ttreat as ${1:expr}\\nsnippet castable\\n\tcastable as ${1:atomicType}\\nsnippet cast\\n\tcast as ${1:atomicType}\\nsnippet typeswitch\\n\ttypeswitch(${1:expr})\\n\tcase ${2:type}  return ${3:expr}\\n\tdefault return ${4:expr}\\nsnippet var\\n\tdeclare variable $${1:varname} := ${2:expr};\\nsnippet fn\\n\tdeclare function ${1:ns}:${2:name}(){\\n\t${3:expr}\\n\t};\\nsnippet module\\n\tmodule namespace ${1:ns} = \"${2:http://www.example.com}\";\\n',t.scope=\"xquery\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/snippets/yaml.js",
    "content": "define(\"ace/snippets/yaml\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.snippetText=\"\",t.scope=\"yaml\"})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-ambiance.js",
    "content": "define(\"ace/theme/ambiance\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-ambiance\",t.cssText=\".ace-ambiance .ace_gutter {background-color: #3d3d3d;background-image: -moz-linear-gradient(left, #3D3D3D, #333);background-image: -ms-linear-gradient(left, #3D3D3D, #333);background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#3D3D3D), to(#333));background-image: -webkit-linear-gradient(left, #3D3D3D, #333);background-image: -o-linear-gradient(left, #3D3D3D, #333);background-image: linear-gradient(left, #3D3D3D, #333);background-repeat: repeat-x;border-right: 1px solid #4d4d4d;text-shadow: 0px 1px 1px #4d4d4d;color: #222;}.ace-ambiance .ace_gutter-layer {background: repeat left top;}.ace-ambiance .ace_gutter-active-line {background-color: #3F3F3F;}.ace-ambiance .ace_fold-widget {text-align: center;}.ace-ambiance .ace_fold-widget:hover {color: #777;}.ace-ambiance .ace_fold-widget.ace_start,.ace-ambiance .ace_fold-widget.ace_end,.ace-ambiance .ace_fold-widget.ace_closed{background: none;border: none;box-shadow: none;}.ace-ambiance .ace_fold-widget.ace_start:after {content: '\\u25be'}.ace-ambiance .ace_fold-widget.ace_end:after {content: '\\u25b4'}.ace-ambiance .ace_fold-widget.ace_closed:after {content: '\\u2023'}.ace-ambiance .ace_print-margin {border-left: 1px dotted #2D2D2D;right: 0;background: #262626;}.ace-ambiance .ace_scroller {-webkit-box-shadow: inset 0 0 10px black;-moz-box-shadow: inset 0 0 10px black;-o-box-shadow: inset 0 0 10px black;box-shadow: inset 0 0 10px black;}.ace-ambiance {color: #E6E1DC;background-color: #202020;}.ace-ambiance .ace_cursor {border-left: 1px solid #7991E8;}.ace-ambiance .ace_overwrite-cursors .ace_cursor {border: 1px solid #FFE300;background: #766B13;}.ace-ambiance.normal-mode .ace_cursor-layer {z-index: 0;}.ace-ambiance .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20);}.ace-ambiance .ace_marker-layer .ace_selected-word {border-radius: 4px;border: 8px solid #3f475d;box-shadow: 0 0 4px black;}.ace-ambiance .ace_marker-layer .ace_step {background: rgb(198, 219, 174);}.ace-ambiance .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25);}.ace-ambiance .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031);}.ace-ambiance .ace_invisible {color: #333;}.ace-ambiance .ace_paren {color: #24C2C7;}.ace-ambiance .ace_keyword {color: #cda869;}.ace-ambiance .ace_keyword.ace_operator {color: #fa8d6a;}.ace-ambiance .ace_punctuation.ace_operator {color: #fa8d6a;}.ace-ambiance .ace_identifier {}.ace-ambiance .ace-statement {color: #cda869;}.ace-ambiance .ace_constant {color: #CF7EA9;}.ace-ambiance .ace_constant.ace_language {color: #CF7EA9;}.ace-ambiance .ace_constant.ace_library {}.ace-ambiance .ace_constant.ace_numeric {color: #78CF8A;}.ace-ambiance .ace_invalid {text-decoration: underline;}.ace-ambiance .ace_invalid.ace_illegal {color:#F8F8F8;background-color: rgba(86, 45, 86, 0.75);}.ace-ambiance .ace_invalid,.ace-ambiance .ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1;}.ace-ambiance .ace_support {color: #9B859D;}.ace-ambiance .ace_support.ace_function {color: #DAD085;}.ace-ambiance .ace_function.ace_buildin {color: #9b859d;}.ace-ambiance .ace_string {color: #8f9d6a;}.ace-ambiance .ace_string.ace_regexp {color: #DAD085;}.ace-ambiance .ace_comment {font-style: italic;color: #555;}.ace-ambiance .ace_comment.ace_doc {}.ace-ambiance .ace_comment.ace_doc.ace_tag {color: #666;font-style: normal;}.ace-ambiance .ace_definition,.ace-ambiance .ace_type {color: #aac6e3;}.ace-ambiance .ace_variable {color: #9999cc;}.ace-ambiance .ace_variable.ace_language {color: #9b859d;}.ace-ambiance .ace_xml-pe {color: #494949;}.ace-ambiance .ace_gutter-layer,.ace-ambiance .ace_text-layer {background-image: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC\\\");}.ace-ambiance .ace_indent-guide {background: url(\\\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQUFD4z6Crq/sfAAuYAuYl+7lfAAAAAElFTkSuQmCC\\\") right repeat-y;}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-chaos.js",
    "content": "define(\"ace/theme/chaos\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-chaos\",t.cssText=\".ace-chaos .ace_gutter {background: #141414;color: #595959;border-right: 1px solid #282828;}.ace-chaos .ace_gutter-cell.ace_warning {background-image: none;background: #FC0;border-left: none;padding-left: 0;color: #000;}.ace-chaos .ace_gutter-cell.ace_error {background-position: -6px center;background-image: none;background: #F10;border-left: none;padding-left: 0;color: #000;}.ace-chaos .ace_print-margin {border-left: 1px solid #555;right: 0;background: #1D1D1D;}.ace-chaos {background-color: #161616;color: #E6E1DC;}.ace-chaos .ace_cursor {border-left: 2px solid #FFFFFF;}.ace-chaos .ace_cursor.ace_overwrite {border-left: 0px;border-bottom: 1px solid #FFFFFF;}.ace-chaos .ace_marker-layer .ace_selection {background: #494836;}.ace-chaos .ace_marker-layer .ace_step {background: rgb(198, 219, 174);}.ace-chaos .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #FCE94F;}.ace-chaos .ace_marker-layer .ace_active-line {background: #333;}.ace-chaos .ace_gutter-active-line {background-color: #222;}.ace-chaos .ace_invisible {color: #404040;}.ace-chaos .ace_keyword {color:#00698F;}.ace-chaos .ace_keyword.ace_operator {color:#FF308F;}.ace-chaos .ace_constant {color:#1EDAFB;}.ace-chaos .ace_constant.ace_language {color:#FDC251;}.ace-chaos .ace_constant.ace_library {color:#8DFF0A;}.ace-chaos .ace_constant.ace_numeric {color:#58C554;}.ace-chaos .ace_invalid {color:#FFFFFF;background-color:#990000;}.ace-chaos .ace_invalid.ace_deprecated {color:#FFFFFF;background-color:#990000;}.ace-chaos .ace_support {color: #999;}.ace-chaos .ace_support.ace_function {color:#00AEEF;}.ace-chaos .ace_function {color:#00AEEF;}.ace-chaos .ace_string {color:#58C554;}.ace-chaos .ace_comment {color:#555;font-style:italic;padding-bottom: 0px;}.ace-chaos .ace_variable {color:#997744;}.ace-chaos .ace_meta.ace_tag {color:#BE53E6;}.ace-chaos .ace_entity.ace_other.ace_attribute-name {color:#FFFF89;}.ace-chaos .ace_markup.ace_underline {text-decoration: underline;}.ace-chaos .ace_fold-widget {text-align: center;}.ace-chaos .ace_fold-widget:hover {color: #777;}.ace-chaos .ace_fold-widget.ace_start,.ace-chaos .ace_fold-widget.ace_end,.ace-chaos .ace_fold-widget.ace_closed{background: none;border: none;box-shadow: none;}.ace-chaos .ace_fold-widget.ace_start:after {content: '\\u25be'}.ace-chaos .ace_fold-widget.ace_end:after {content: '\\u25b4'}.ace-chaos .ace_fold-widget.ace_closed:after {content: '\\u2023'}.ace-chaos .ace_indent-guide {border-right:1px dotted #333;margin-right:-1px;}.ace-chaos .ace_fold { background: #222; border-radius: 3px; color: #7AF; border: none; }.ace-chaos .ace_fold:hover {background: #CCC; color: #000;}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-chrome.js",
    "content": "define(\"ace/theme/chrome\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-chrome\",t.cssText='.ace-chrome .ace_gutter {background: #ebebeb;color: #333;overflow : hidden;}.ace-chrome .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-chrome {background-color: #FFFFFF;color: black;}.ace-chrome .ace_cursor {color: black;}.ace-chrome .ace_invisible {color: rgb(191, 191, 191);}.ace-chrome .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-chrome .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-chrome .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-chrome .ace_invalid {background-color: rgb(153, 0, 0);color: white;}.ace-chrome .ace_fold {}.ace-chrome .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-chrome .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-chrome .ace_support.ace_type,.ace-chrome .ace_support.ace_class.ace-chrome .ace_support.ace_other {color: rgb(109, 121, 222);}.ace-chrome .ace_variable.ace_parameter {font-style:italic;color:#FD971F;}.ace-chrome .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-chrome .ace_comment {color: #236e24;}.ace-chrome .ace_comment.ace_doc {color: #236e24;}.ace-chrome .ace_comment.ace_doc.ace_tag {color: #236e24;}.ace-chrome .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-chrome .ace_variable {color: rgb(49, 132, 149);}.ace-chrome .ace_xml-pe {color: rgb(104, 104, 91);}.ace-chrome .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-chrome .ace_heading {color: rgb(12, 7, 255);}.ace-chrome .ace_list {color:rgb(185, 6, 144);}.ace-chrome .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-chrome .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-chrome .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-chrome .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-chrome .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-chrome .ace_gutter-active-line {background-color : #dcdcdc;}.ace-chrome .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-chrome .ace_storage,.ace-chrome .ace_keyword,.ace-chrome .ace_meta.ace_tag {color: rgb(147, 15, 128);}.ace-chrome .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-chrome .ace_string {color: #1A1AA6;}.ace-chrome .ace_entity.ace_other.ace_attribute-name {color: #994409;}.ace-chrome .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-cloud9_day.js",
    "content": "define(\"ace/theme/cloud9_day\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-cloud9-day\",t.cssText='.ace-cloud9-day .ace_gutter {background: #ECECEC;color: #333;}.ace-cloud9-day .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-cloud9-day .ace_fold {background-color: #6B72E6;}.ace-cloud9-day {background-color: #F8F8F8;color: black;}.ace-cloud9-day .ace_cursor {color: black;}.ace-cloud9-day .ace_invisible {color: rgb(191, 191, 191);}.ace-cloud9-day .ace_storage,.ace-cloud9-day .ace_keyword {color: blue;}.ace-cloud9-day .ace_constant {color: rgb(197, 6, 11);}.ace-cloud9-day .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-cloud9-day .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-cloud9-day .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-cloud9-day .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-cloud9-day .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-cloud9-day .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-cloud9-day .ace_support.ace_type,.ace-cloud9-day .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-cloud9-day .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-cloud9-day .ace_string {color: rgb(3, 106, 7);}.ace-cloud9-day .ace_comment {color: rgb(76, 136, 107);}.ace-cloud9-day .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-cloud9-day .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-cloud9-day .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-cloud9-day .ace_variable {color: rgb(49, 132, 149);}.ace-cloud9-day .ace_xml-pe {color: rgb(104, 104, 91);}.ace-cloud9-day .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-cloud9-day .ace_heading {color: rgb(12, 7, 255);}.ace-cloud9-day .ace_list {color:rgb(185, 6, 144);}.ace-cloud9-day .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-cloud9-day .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-cloud9-day .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-cloud9-day.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;border-radius: 2px;}.ace-cloud9-day .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-cloud9-day .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-cloud9-day .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-cloud9-day .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-cloud9-day .ace_gutter-active-line {background-color : #dcdcdc;}.ace-cloud9-day .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-cloud9-day .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-cloud9_night.js",
    "content": "define(\"ace/theme/cloud9_night\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-cloud9-night\",t.cssText=\".ace-cloud9-night .ace_gutter {background: #303130;color: #eee}.ace-cloud9-night .ace_print-margin {width: 1px;background: #222}.ace-cloud9-night {background-color: #181818;color: #EBEBEB}.ace-cloud9-night .ace_cursor {color: #9F9F9F}.ace-cloud9-night .ace_marker-layer .ace_selection {background: #424242}.ace-cloud9-night.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #000000;border-radius: 2px}.ace-cloud9-night .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-cloud9-night .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #888888}.ace-cloud9-night .ace_marker-layer .ace_highlight {border: 1px solid rgb(110, 119, 0);border-bottom: 0;box-shadow: inset 0 -1px rgb(110, 119, 0);margin: -1px 0 0 -1px;background: rgba(255, 235, 0, 0.1);}.ace-cloud9-night .ace_marker-layer .ace_active-line {background: #292929}.ace-cloud9-night .ace_gutter-active-line {background-color: #3D3D3D}.ace-cloud9-night .ace_stack {background-color: rgb(66, 90, 44)}.ace-cloud9-night .ace_marker-layer .ace_selected-word {border: 1px solid #888888}.ace-cloud9-night .ace_invisible {color: #343434}.ace-cloud9-night .ace_keyword,.ace-cloud9-night .ace_meta,.ace-cloud9-night .ace_storage,.ace-cloud9-night .ace_storage.ace_type,.ace-cloud9-night .ace_support.ace_type {color: #C397D8}.ace-cloud9-night .ace_keyword.ace_operator {color: #70C0B1}.ace-cloud9-night .ace_constant.ace_character,.ace-cloud9-night .ace_constant.ace_language,.ace-cloud9-night .ace_constant.ace_numeric,.ace-cloud9-night .ace_keyword.ace_other.ace_unit,.ace-cloud9-night .ace_support.ace_constant,.ace-cloud9-night .ace_variable.ace_parameter {color: #E78C45}.ace-cloud9-night .ace_constant.ace_other {color: #EEEEEE}.ace-cloud9-night .ace_invalid {color: #CED2CF;background-color: #DF5F5F}.ace-cloud9-night .ace_invalid.ace_deprecated {color: #CED2CF;background-color: #B798BF}.ace-cloud9-night .ace_fold {background-color: #7AA6DA;border-color: #DEDEDE}.ace-cloud9-night .ace_entity.ace_name.ace_function,.ace-cloud9-night .ace_support.ace_function,.ace-cloud9-night .ace_variable {color: #7AA6DA}.ace-cloud9-night .ace_support.ace_class,.ace-cloud9-night .ace_support.ace_type {color: #E7C547}.ace-cloud9-night .ace_heading,.ace-cloud9-night .ace_markup.ace_heading,.ace-cloud9-night .ace_string {color: #B9CA4A}.ace-cloud9-night .ace_entity.ace_name.ace_tag,.ace-cloud9-night .ace_entity.ace_other.ace_attribute-name,.ace-cloud9-night .ace_meta.ace_tag,.ace-cloud9-night .ace_string.ace_regexp,.ace-cloud9-night .ace_variable {color: #D54E53}.ace-cloud9-night .ace_comment {color: #969896}.ace-cloud9-night .ace_c9searchresults.ace_keyword {color: #C2C280;}.ace-cloud9-night .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-cloud9_night_low_color.js",
    "content": "define(\"ace/theme/cloud9_night_low_color\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-cloud9-night-low-color\",t.cssText=\".ace-cloud9-night-low-color .ace_gutter {background: #303130;color: #eee}.ace-cloud9-night-low-color .ace_print-margin {width: 1px;background: #222}.ace-cloud9-night-low-color {background-color: #181818;color: #EBEBEB}.ace-cloud9-night-low-color .ace_cursor {color: #9F9F9F}.ace-cloud9-night-low-color .ace_marker-layer .ace_selection {background: #424242}.ace-cloud9-night-low-color.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #000000;border-radius: 2px}.ace-cloud9-night-low-color .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-cloud9-night-low-color .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #888888}.ace-cloud9-night-low-color .ace_marker-layer .ace_highlight {border: 1px solid rgb(110, 119, 0);border-bottom: 0;box-shadow: inset 0 -1px rgb(110, 119, 0);margin: -1px 0 0 -1px;background: rgba(255, 235, 0, 0.1);}.ace-cloud9-night-low-color .ace_marker-layer .ace_active-line {background: #292929}.ace-cloud9-night-low-color .ace_gutter-active-line {background-color: #3D3D3D}.ace-cloud9-night-low-color .ace_stack {background-color: rgb(66, 90, 44)}.ace-cloud9-night-low-color .ace_marker-layer .ace_selected-word {border: 1px solid #888888}.ace-cloud9-night-low-color .ace_invisible {color: #343434}.ace-cloud9-night-low-color .ace_keyword,.ace-cloud9-night-low-color .ace_meta,.ace-cloud9-night-low-color .ace_storage {color: #C397D8}.ace-cloud9-night-low-color .ace_keyword.ace_operator {color: #70C0B1}.ace-cloud9-night-low-color .ace_constant.ace_character,.ace-cloud9-night-low-color .ace_constant.ace_language,.ace-cloud9-night-low-color .ace_constant.ace_numeric,.ace-cloud9-night-low-color .ace_keyword.ace_other.ace_unit {color: #B9CA4A}.ace-cloud9-night-low-color .ace_constant.ace_other {color: #EEEEEE}.ace-cloud9-night-low-color .ace_invalid {color: #CED2CF;background-color: #DF5F5F}.ace-cloud9-night-low-color .ace_invalid.ace_deprecated {color: #CED2CF;background-color: #B798BF}.ace-cloud9-night-low-color .ace_fold {background-color: #7AA6DA;border-color: #DEDEDE}.ace-cloud9-night-low-color .ace_entity.ace_name.ace_function,.ace-cloud9-night-low-color .ace_support.ace_function,.ace-cloud9-night-low-color .ace_variable:not(.ace_parameter),.ace-cloud9-night-low-color .ace_constant:not(.ace_numeric) {color: #7AA6DA}.ace-cloud9-night-low-color .ace_support.ace_class,.ace-cloud9-night-low-color .ace_support.ace_type {color: #E7C547}.ace-cloud9-night-low-color .ace_heading,.ace-cloud9-night-low-color .ace_markup.ace_heading,.ace-cloud9-night-low-color .ace_string {color: #B9CA4A}.ace-cloud9-night-low-color .ace_comment {color: #969896}.ace-cloud9-night-low-color .ace_c9searchresults.ace_keyword {color: #C2C280;}.ace-cloud9-night-low-color .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-clouds.js",
    "content": "define(\"ace/theme/clouds\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-clouds\",t.cssText='.ace-clouds .ace_gutter {background: #ebebeb;color: #333}.ace-clouds .ace_print-margin {width: 1px;background: #e8e8e8}.ace-clouds {background-color: #FFFFFF;color: #000000}.ace-clouds .ace_cursor {color: #000000}.ace-clouds .ace_marker-layer .ace_selection {background: #BDD5FC}.ace-clouds.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;border-radius: 2px}.ace-clouds .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-clouds .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-clouds .ace_marker-layer .ace_active-line {background: #FFFBD1}.ace-clouds .ace_gutter-active-line {background-color : #dcdcdc}.ace-clouds .ace_marker-layer .ace_selected-word {border: 1px solid #BDD5FC}.ace-clouds .ace_invisible {color: #BFBFBF}.ace-clouds .ace_keyword,.ace-clouds .ace_meta,.ace-clouds .ace_support.ace_constant.ace_property-value {color: #AF956F}.ace-clouds .ace_keyword.ace_operator {color: #484848}.ace-clouds .ace_keyword.ace_other.ace_unit {color: #96DC5F}.ace-clouds .ace_constant.ace_language {color: #39946A}.ace-clouds .ace_constant.ace_numeric {color: #46A609}.ace-clouds .ace_constant.ace_character.ace_entity {color: #BF78CC}.ace-clouds .ace_invalid {background-color: #FF002A}.ace-clouds .ace_fold {background-color: #AF956F;border-color: #000000}.ace-clouds .ace_storage,.ace-clouds .ace_support.ace_class,.ace-clouds .ace_support.ace_function,.ace-clouds .ace_support.ace_other,.ace-clouds .ace_support.ace_type {color: #C52727}.ace-clouds .ace_string {color: #5D90CD}.ace-clouds .ace_comment {color: #BCC8BA}.ace-clouds .ace_entity.ace_name.ace_tag,.ace-clouds .ace_entity.ace_other.ace_attribute-name {color: #606060}.ace-clouds .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-clouds_midnight.js",
    "content": "define(\"ace/theme/clouds_midnight\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-clouds-midnight\",t.cssText=\".ace-clouds-midnight .ace_gutter {background: #232323;color: #929292}.ace-clouds-midnight .ace_print-margin {width: 1px;background: #232323}.ace-clouds-midnight {background-color: #191919;color: #929292}.ace-clouds-midnight .ace_cursor {color: #7DA5DC}.ace-clouds-midnight .ace_marker-layer .ace_selection {background: #000000}.ace-clouds-midnight.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #191919;border-radius: 2px}.ace-clouds-midnight .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-clouds-midnight .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-clouds-midnight .ace_marker-layer .ace_active-line {background: rgba(215, 215, 215, 0.031)}.ace-clouds-midnight .ace_gutter-active-line {background-color: rgba(215, 215, 215, 0.031)}.ace-clouds-midnight .ace_marker-layer .ace_selected-word {border: 1px solid #000000}.ace-clouds-midnight .ace_invisible {color: #BFBFBF}.ace-clouds-midnight .ace_keyword,.ace-clouds-midnight .ace_meta,.ace-clouds-midnight .ace_support.ace_constant.ace_property-value {color: #927C5D}.ace-clouds-midnight .ace_keyword.ace_operator {color: #4B4B4B}.ace-clouds-midnight .ace_keyword.ace_other.ace_unit {color: #366F1A}.ace-clouds-midnight .ace_constant.ace_language {color: #39946A}.ace-clouds-midnight .ace_constant.ace_numeric {color: #46A609}.ace-clouds-midnight .ace_constant.ace_character.ace_entity {color: #A165AC}.ace-clouds-midnight .ace_invalid {color: #FFFFFF;background-color: #E92E2E}.ace-clouds-midnight .ace_fold {background-color: #927C5D;border-color: #929292}.ace-clouds-midnight .ace_storage,.ace-clouds-midnight .ace_support.ace_class,.ace-clouds-midnight .ace_support.ace_function,.ace-clouds-midnight .ace_support.ace_other,.ace-clouds-midnight .ace_support.ace_type {color: #E92E2E}.ace-clouds-midnight .ace_string {color: #5D90CD}.ace-clouds-midnight .ace_comment {color: #3C403B}.ace-clouds-midnight .ace_entity.ace_name.ace_tag,.ace-clouds-midnight .ace_entity.ace_other.ace_attribute-name {color: #606060}.ace-clouds-midnight .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-cobalt.js",
    "content": "define(\"ace/theme/cobalt\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-cobalt\",t.cssText=\".ace-cobalt .ace_gutter {background: #011e3a;color: #fff}.ace-cobalt .ace_print-margin {width: 1px;background: #011e3a}.ace-cobalt {background-color: #002240;color: #FFFFFF}.ace-cobalt .ace_cursor {color: #FFFFFF}.ace-cobalt .ace_marker-layer .ace_selection {background: rgba(179, 101, 57, 0.75)}.ace-cobalt.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002240;border-radius: 2px}.ace-cobalt .ace_marker-layer .ace_step {background: rgb(127, 111, 19)}.ace-cobalt .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.15)}.ace-cobalt .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.35)}.ace-cobalt .ace_gutter-active-line {background-color: rgba(0, 0, 0, 0.35)}.ace-cobalt .ace_marker-layer .ace_selected-word {border: 1px solid rgba(179, 101, 57, 0.75)}.ace-cobalt .ace_invisible {color: rgba(255, 255, 255, 0.15)}.ace-cobalt .ace_keyword,.ace-cobalt .ace_meta {color: #FF9D00}.ace-cobalt .ace_constant,.ace-cobalt .ace_constant.ace_character,.ace-cobalt .ace_constant.ace_character.ace_escape,.ace-cobalt .ace_constant.ace_other {color: #FF628C}.ace-cobalt .ace_invalid {color: #F8F8F8;background-color: #800F00}.ace-cobalt .ace_support {color: #80FFBB}.ace-cobalt .ace_support.ace_constant {color: #EB939A}.ace-cobalt .ace_fold {background-color: #FF9D00;border-color: #FFFFFF}.ace-cobalt .ace_support.ace_function {color: #FFB054}.ace-cobalt .ace_storage {color: #FFEE80}.ace-cobalt .ace_entity {color: #FFDD00}.ace-cobalt .ace_string {color: #3AD900}.ace-cobalt .ace_string.ace_regexp {color: #80FFC2}.ace-cobalt .ace_comment {font-style: italic;color: #0088FF}.ace-cobalt .ace_heading,.ace-cobalt .ace_markup.ace_heading {color: #C8E4FD;background-color: #001221}.ace-cobalt .ace_list,.ace-cobalt .ace_markup.ace_list {background-color: #130D26}.ace-cobalt .ace_variable {color: #CCCCCC}.ace-cobalt .ace_variable.ace_language {color: #FF80E1}.ace-cobalt .ace_meta.ace_tag {color: #9EFFFF}.ace-cobalt .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHCLSvkPAAP3AgSDTRd4AAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-crimson_editor.js",
    "content": "define(\"ace/theme/crimson_editor\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssText='.ace-crimson-editor .ace_gutter {background: #ebebeb;color: #333;overflow : hidden;}.ace-crimson-editor .ace_gutter-layer {width: 100%;text-align: right;}.ace-crimson-editor .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-crimson-editor {background-color: #FFFFFF;color: rgb(64, 64, 64);}.ace-crimson-editor .ace_cursor {color: black;}.ace-crimson-editor .ace_invisible {color: rgb(191, 191, 191);}.ace-crimson-editor .ace_identifier {color: black;}.ace-crimson-editor .ace_keyword {color: blue;}.ace-crimson-editor .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-crimson-editor .ace_constant.ace_language {color: rgb(255, 156, 0);}.ace-crimson-editor .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-crimson-editor .ace_invalid {text-decoration: line-through;color: rgb(224, 0, 0);}.ace-crimson-editor .ace_fold {}.ace-crimson-editor .ace_support.ace_function {color: rgb(192, 0, 0);}.ace-crimson-editor .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-crimson-editor .ace_support.ace_type,.ace-crimson-editor .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-crimson-editor .ace_keyword.ace_operator {color: rgb(49, 132, 149);}.ace-crimson-editor .ace_string {color: rgb(128, 0, 128);}.ace-crimson-editor .ace_comment {color: rgb(76, 136, 107);}.ace-crimson-editor .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-crimson-editor .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-crimson-editor .ace_constant.ace_numeric {color: rgb(0, 0, 64);}.ace-crimson-editor .ace_variable {color: rgb(0, 64, 128);}.ace-crimson-editor .ace_xml-pe {color: rgb(104, 104, 91);}.ace-crimson-editor .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-crimson-editor .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-crimson-editor .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-crimson-editor .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-crimson-editor .ace_marker-layer .ace_active-line {background: rgb(232, 242, 254);}.ace-crimson-editor .ace_gutter-active-line {background-color : #dcdcdc;}.ace-crimson-editor .ace_meta.ace_tag {color:rgb(28, 2, 255);}.ace-crimson-editor .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-crimson-editor .ace_string.ace_regex {color: rgb(192, 0, 192);}.ace-crimson-editor .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}',t.cssClass=\"ace-crimson-editor\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-dawn.js",
    "content": "define(\"ace/theme/dawn\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-dawn\",t.cssText=\".ace-dawn .ace_gutter {background: #ebebeb;color: #333}.ace-dawn .ace_print-margin {width: 1px;background: #e8e8e8}.ace-dawn {background-color: #F9F9F9;color: #080808}.ace-dawn .ace_cursor {color: #000000}.ace-dawn .ace_marker-layer .ace_selection {background: rgba(39, 95, 255, 0.30)}.ace-dawn.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #F9F9F9;border-radius: 2px}.ace-dawn .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-dawn .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(75, 75, 126, 0.50)}.ace-dawn .ace_marker-layer .ace_active-line {background: rgba(36, 99, 180, 0.12)}.ace-dawn .ace_gutter-active-line {background-color : #dcdcdc}.ace-dawn .ace_marker-layer .ace_selected-word {border: 1px solid rgba(39, 95, 255, 0.30)}.ace-dawn .ace_invisible {color: rgba(75, 75, 126, 0.50)}.ace-dawn .ace_keyword,.ace-dawn .ace_meta {color: #794938}.ace-dawn .ace_constant,.ace-dawn .ace_constant.ace_character,.ace-dawn .ace_constant.ace_character.ace_escape,.ace-dawn .ace_constant.ace_other {color: #811F24}.ace-dawn .ace_invalid.ace_illegal {text-decoration: underline;font-style: italic;color: #F8F8F8;background-color: #B52A1D}.ace-dawn .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #B52A1D}.ace-dawn .ace_support {color: #691C97}.ace-dawn .ace_support.ace_constant {color: #B4371F}.ace-dawn .ace_fold {background-color: #794938;border-color: #080808}.ace-dawn .ace_list,.ace-dawn .ace_markup.ace_list,.ace-dawn .ace_support.ace_function {color: #693A17}.ace-dawn .ace_storage {font-style: italic;color: #A71D5D}.ace-dawn .ace_string {color: #0B6125}.ace-dawn .ace_string.ace_regexp {color: #CF5628}.ace-dawn .ace_comment {font-style: italic;color: #5A525F}.ace-dawn .ace_heading,.ace-dawn .ace_markup.ace_heading {color: #19356D}.ace-dawn .ace_variable {color: #234A97}.ace-dawn .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLh/5+x/AAizA4hxNNsZAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-dreamweaver.js",
    "content": "define(\"ace/theme/dreamweaver\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-dreamweaver\",t.cssText='.ace-dreamweaver .ace_gutter {background: #e8e8e8;color: #333;}.ace-dreamweaver .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-dreamweaver {background-color: #FFFFFF;color: black;}.ace-dreamweaver .ace_fold {background-color: #757AD8;}.ace-dreamweaver .ace_cursor {color: black;}.ace-dreamweaver .ace_invisible {color: rgb(191, 191, 191);}.ace-dreamweaver .ace_storage,.ace-dreamweaver .ace_keyword {color: blue;}.ace-dreamweaver .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-dreamweaver .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-dreamweaver .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-dreamweaver .ace_invalid {background-color: rgb(153, 0, 0);color: white;}.ace-dreamweaver .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-dreamweaver .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-dreamweaver .ace_support.ace_type,.ace-dreamweaver .ace_support.ace_class {color: #009;}.ace-dreamweaver .ace_support.ace_php_tag {color: #f00;}.ace-dreamweaver .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-dreamweaver .ace_string {color: #00F;}.ace-dreamweaver .ace_comment {color: rgb(76, 136, 107);}.ace-dreamweaver .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-dreamweaver .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-dreamweaver .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-dreamweaver .ace_variable {color: #06F}.ace-dreamweaver .ace_xml-pe {color: rgb(104, 104, 91);}.ace-dreamweaver .ace_entity.ace_name.ace_function {color: #00F;}.ace-dreamweaver .ace_heading {color: rgb(12, 7, 255);}.ace-dreamweaver .ace_list {color:rgb(185, 6, 144);}.ace-dreamweaver .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-dreamweaver .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-dreamweaver .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-dreamweaver .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-dreamweaver .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-dreamweaver .ace_gutter-active-line {background-color : #DCDCDC;}.ace-dreamweaver .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-dreamweaver .ace_meta.ace_tag {color:#009;}.ace-dreamweaver .ace_meta.ace_tag.ace_anchor {color:#060;}.ace-dreamweaver .ace_meta.ace_tag.ace_form {color:#F90;}.ace-dreamweaver .ace_meta.ace_tag.ace_image {color:#909;}.ace-dreamweaver .ace_meta.ace_tag.ace_script {color:#900;}.ace-dreamweaver .ace_meta.ace_tag.ace_style {color:#909;}.ace-dreamweaver .ace_meta.ace_tag.ace_table {color:#099;}.ace-dreamweaver .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-dreamweaver .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-eclipse.js",
    "content": "define(\"ace/theme/eclipse\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssText='.ace-eclipse .ace_gutter {background: #ebebeb;border-right: 1px solid rgb(159, 159, 159);color: rgb(136, 136, 136);}.ace-eclipse .ace_print-margin {width: 1px;background: #ebebeb;}.ace-eclipse {background-color: #FFFFFF;color: black;}.ace-eclipse .ace_fold {background-color: rgb(60, 76, 114);}.ace-eclipse .ace_cursor {color: black;}.ace-eclipse .ace_storage,.ace-eclipse .ace_keyword,.ace-eclipse .ace_variable {color: rgb(127, 0, 85);}.ace-eclipse .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-eclipse .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-eclipse .ace_function {color: rgb(60, 76, 114);}.ace-eclipse .ace_string {color: rgb(42, 0, 255);}.ace-eclipse .ace_comment {color: rgb(113, 150, 130);}.ace-eclipse .ace_comment.ace_doc {color: rgb(63, 95, 191);}.ace-eclipse .ace_comment.ace_doc.ace_tag {color: rgb(127, 159, 191);}.ace-eclipse .ace_constant.ace_numeric {color: darkblue;}.ace-eclipse .ace_tag {color: rgb(25, 118, 116);}.ace-eclipse .ace_type {color: rgb(127, 0, 127);}.ace-eclipse .ace_xml-pe {color: rgb(104, 104, 91);}.ace-eclipse .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-eclipse .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-eclipse .ace_meta.ace_tag {color:rgb(25, 118, 116);}.ace-eclipse .ace_invisible {color: #ddd;}.ace-eclipse .ace_entity.ace_other.ace_attribute-name {color:rgb(127, 0, 127);}.ace-eclipse .ace_marker-layer .ace_step {background: rgb(255, 255, 0);}.ace-eclipse .ace_active-line {background: rgb(232, 242, 254);}.ace-eclipse .ace_gutter-active-line {background-color : #DADADA;}.ace-eclipse .ace_marker-layer .ace_selected-word {border: 1px solid rgb(181, 213, 255);}.ace-eclipse .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}',t.cssClass=\"ace-eclipse\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-github.js",
    "content": "define(\"ace/theme/github\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-github\",t.cssText='/* CSS style content from github\\'s default pygments highlighter template.Cursor and selection styles from textmate.css. */.ace-github .ace_gutter {background: #e8e8e8;color: #AAA;}.ace-github  {background: #fff;color: #000;}.ace-github .ace_keyword {font-weight: bold;}.ace-github .ace_string {color: #D14;}.ace-github .ace_variable.ace_class {color: teal;}.ace-github .ace_constant.ace_numeric {color: #099;}.ace-github .ace_constant.ace_buildin {color: #0086B3;}.ace-github .ace_support.ace_function {color: #0086B3;}.ace-github .ace_comment {color: #998;font-style: italic;}.ace-github .ace_variable.ace_language  {color: #0086B3;}.ace-github .ace_paren {font-weight: bold;}.ace-github .ace_boolean {font-weight: bold;}.ace-github .ace_string.ace_regexp {color: #009926;font-weight: normal;}.ace-github .ace_variable.ace_instance {color: teal;}.ace-github .ace_constant.ace_language {font-weight: bold;}.ace-github .ace_cursor {color: black;}.ace-github .ace_marker-layer .ace_active-line {background: rgb(255, 255, 204);}.ace-github .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-github.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;border-radius: 2px;}/* bold keywords cause cursor issues for some fonts *//* this disables bold style for editor and keeps for static highlighter */.ace-github.ace_nobold .ace_line > span {font-weight: normal !important;}.ace-github .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-github .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-github .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-github .ace_gutter-active-line {background-color : rgba(0, 0, 0, 0.07);}.ace-github .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-github .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-github .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-idle_fingers.js",
    "content": "define(\"ace/theme/idle_fingers\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-idle-fingers\",t.cssText=\".ace-idle-fingers .ace_gutter {background: #3b3b3b;color: #fff}.ace-idle-fingers .ace_print-margin {width: 1px;background: #3b3b3b}.ace-idle-fingers {background-color: #323232;color: #FFFFFF}.ace-idle-fingers .ace_cursor {color: #91FF00}.ace-idle-fingers .ace_marker-layer .ace_selection {background: rgba(90, 100, 126, 0.88)}.ace-idle-fingers.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #323232;border-radius: 2px}.ace-idle-fingers .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-idle-fingers .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-idle-fingers .ace_marker-layer .ace_active-line {background: #353637}.ace-idle-fingers .ace_gutter-active-line {background-color: #353637}.ace-idle-fingers .ace_marker-layer .ace_selected-word {border: 1px solid rgba(90, 100, 126, 0.88)}.ace-idle-fingers .ace_invisible {color: #404040}.ace-idle-fingers .ace_keyword,.ace-idle-fingers .ace_meta {color: #CC7833}.ace-idle-fingers .ace_constant,.ace-idle-fingers .ace_constant.ace_character,.ace-idle-fingers .ace_constant.ace_character.ace_escape,.ace-idle-fingers .ace_constant.ace_other,.ace-idle-fingers .ace_support.ace_constant {color: #6C99BB}.ace-idle-fingers .ace_invalid {color: #FFFFFF;background-color: #FF0000}.ace-idle-fingers .ace_fold {background-color: #CC7833;border-color: #FFFFFF}.ace-idle-fingers .ace_support.ace_function {color: #B83426}.ace-idle-fingers .ace_variable.ace_parameter {font-style: italic}.ace-idle-fingers .ace_string {color: #A5C261}.ace-idle-fingers .ace_string.ace_regexp {color: #CCCC33}.ace-idle-fingers .ace_comment {font-style: italic;color: #BC9458}.ace-idle-fingers .ace_meta.ace_tag {color: #FFE5BB}.ace-idle-fingers .ace_entity.ace_name {color: #FFC66D}.ace-idle-fingers .ace_collab.ace_user1 {color: #323232;background-color: #FFF980}.ace-idle-fingers .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMwMjLyZYiPj/8PAAreAwAI1+g0AAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-katzenmilch.js",
    "content": "define(\"ace/theme/katzenmilch\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-katzenmilch\",t.cssText=\".ace-katzenmilch .ace_gutter,/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: ) */.ace-katzenmilch .ace_gutter {background: #e8e8e8;color: #333}.ace-katzenmilch .ace_print-margin {width: 1px;background: #e8e8e8}.ace-katzenmilch {background-color: #f3f2f3;color: rgba(15, 0, 9, 1.0)}.ace-katzenmilch .ace_cursor {border-left: 2px solid #100011}.ace-katzenmilch .ace_overwrite-cursors .ace_cursor {border-left: 0px;border-bottom: 1px solid #100011}.ace-katzenmilch .ace_marker-layer .ace_selection {background: rgba(100, 5, 208, 0.27)}.ace-katzenmilch.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #f3f2f3;border-radius: 2px}.ace-katzenmilch .ace_marker-layer .ace_step {background: rgb(198, 219, 174)}.ace-katzenmilch .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #000000}.ace-katzenmilch .ace_marker-layer .ace_active-line {background: rgb(232, 242, 254)}.ace-katzenmilch .ace_gutter-active-line {background-color: rgb(232, 242, 254)}.ace-katzenmilch .ace_marker-layer .ace_selected-word {border: 1px solid rgba(100, 5, 208, 0.27)}.ace-katzenmilch .ace_fold {background-color: rgba(2, 95, 73, 0.97);border-color: rgba(15, 0, 9, 1.0)}.ace-katzenmilch .ace_keyword {color: #674Aa8;rbackground-color: rgba(163, 170, 216, 0.055)}.ace-katzenmilch .ace_constant.ace_language {color: #7D7e52;rbackground-color: rgba(189, 190, 130, 0.059)}.ace-katzenmilch .ace_constant.ace_numeric {color: rgba(79, 130, 123, 0.93);rbackground-color: rgba(119, 194, 187, 0.059)}.ace-katzenmilch .ace_constant.ace_character,.ace-katzenmilch .ace_constant.ace_other {color: rgba(2, 95, 105, 1.0);rbackground-color: rgba(127, 34, 153, 0.063)}.ace-katzenmilch .ace_support.ace_function {color: #9D7e62;rbackground-color: rgba(189, 190, 130, 0.039)}.ace-katzenmilch .ace_support.ace_class {color: rgba(239, 106, 167, 1.0);rbackground-color: rgba(239, 106, 167, 0.063)}.ace-katzenmilch .ace_storage {color: rgba(123, 92, 191, 1.0);rbackground-color: rgba(139, 93, 223, 0.051)}.ace-katzenmilch .ace_invalid {color: #DFDFD5;rbackground-color: #CC1B27}.ace-katzenmilch .ace_string {color: #5a5f9b;rbackground-color: rgba(170, 175, 219, 0.035)}.ace-katzenmilch .ace_comment {font-style: italic;color: rgba(64, 79, 80, 0.67);rbackground-color: rgba(95, 15, 255, 0.0078)}.ace-katzenmilch .ace_entity.ace_name.ace_function,.ace-katzenmilch .ace_variable {color: rgba(2, 95, 73, 0.97);rbackground-color: rgba(34, 255, 73, 0.12)}.ace-katzenmilch .ace_variable.ace_language {color: #316fcf;rbackground-color: rgba(58, 175, 255, 0.039)}.ace-katzenmilch .ace_variable.ace_parameter {font-style: italic;color: rgba(51, 150, 159, 0.87);rbackground-color: rgba(5, 214, 249, 0.043)}.ace-katzenmilch .ace_entity.ace_other.ace_attribute-name {color: rgba(73, 70, 194, 0.93);rbackground-color: rgba(73, 134, 194, 0.035)}.ace-katzenmilch .ace_entity.ace_name.ace_tag {color: #3976a2;rbackground-color: rgba(73, 166, 210, 0.039)}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-kr.js",
    "content": "define(\"ace/theme/kr_theme\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-kr-theme\",t.cssText=\".ace-kr-theme .ace_gutter {background: #1c1917;color: #FCFFE0}.ace-kr-theme .ace_print-margin {width: 1px;background: #1c1917}.ace-kr-theme {background-color: #0B0A09;color: #FCFFE0}.ace-kr-theme .ace_cursor {color: #FF9900}.ace-kr-theme .ace_marker-layer .ace_selection {background: rgba(170, 0, 255, 0.45)}.ace-kr-theme.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #0B0A09;border-radius: 2px}.ace-kr-theme .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-kr-theme .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 177, 111, 0.32)}.ace-kr-theme .ace_marker-layer .ace_active-line {background: #38403D}.ace-kr-theme .ace_gutter-active-line {background-color : #38403D}.ace-kr-theme .ace_marker-layer .ace_selected-word {border: 1px solid rgba(170, 0, 255, 0.45)}.ace-kr-theme .ace_invisible {color: rgba(255, 177, 111, 0.32)}.ace-kr-theme .ace_keyword,.ace-kr-theme .ace_meta {color: #949C8B}.ace-kr-theme .ace_constant,.ace-kr-theme .ace_constant.ace_character,.ace-kr-theme .ace_constant.ace_character.ace_escape,.ace-kr-theme .ace_constant.ace_other {color: rgba(210, 117, 24, 0.76)}.ace-kr-theme .ace_invalid {color: #F8F8F8;background-color: #A41300}.ace-kr-theme .ace_support {color: #9FC28A}.ace-kr-theme .ace_support.ace_constant {color: #C27E66}.ace-kr-theme .ace_fold {background-color: #949C8B;border-color: #FCFFE0}.ace-kr-theme .ace_support.ace_function {color: #85873A}.ace-kr-theme .ace_storage {color: #FFEE80}.ace-kr-theme .ace_string {color: rgba(164, 161, 181, 0.8)}.ace-kr-theme .ace_string.ace_regexp {color: rgba(125, 255, 192, 0.65)}.ace-kr-theme .ace_comment {font-style: italic;color: #706D5B}.ace-kr-theme .ace_variable {color: #D1A796}.ace-kr-theme .ace_list,.ace-kr-theme .ace_markup.ace_list {background-color: #0F0040}.ace-kr-theme .ace_variable.ace_language {color: #FF80E1}.ace-kr-theme .ace_meta.ace_tag {color: #BABD9C}.ace-kr-theme .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-kr_theme.js",
    "content": "/* ***** BEGIN LICENSE BLOCK *****\n * Version: MPL 1.1/GPL 2.0/LGPL 2.1\n *\n * The contents of this file are subject to the Mozilla Public License Version\n * 1.1 (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n * http://www.mozilla.org/MPL/\n *\n * Software distributed under the License is distributed on an \"AS IS\" basis,\n * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License\n * for the specific language governing rights and limitations under the\n * License.\n *\n * The Original Code is Ajax.org Code Editor (ACE).\n *\n * The Initial Developer of the Original Code is\n * Ajax.org B.V.\n * Portions created by the Initial Developer are Copyright (C) 2010\n * the Initial Developer. All Rights Reserved.\n *\n * Contributor(s):\n *      Fabian Jakobs <fabian AT ajax DOT org>\n *\n * Alternatively, the contents of this file may be used under the terms of\n * either the GNU General Public License Version 2 or later (the \"GPL\"), or\n * the GNU Lesser General Public License Version 2.1 or later (the \"LGPL\"),\n * in which case the provisions of the GPL or the LGPL are applicable instead\n * of those above. If you wish to allow use of your version of this file only\n * under the terms of either the GPL or the LGPL, and not to allow others to\n * use your version of this file under the terms of the MPL, indicate your\n * decision by deleting the provisions above and replace them with the notice\n * and other provisions required by the GPL or the LGPL. If you do not delete\n * the provisions above, a recipient may use your version of this file under\n * the terms of any one of the MPL, the GPL or the LGPL.\n *\n * ***** END LICENSE BLOCK ***** */\n\ndefine('ace/theme/kr_theme', ['require', 'exports', 'module', 'ace/lib/dom'], function(require, exports, module) {\n\nexports.isDark = true;\nexports.cssClass = \"ace-kr-theme\";\nexports.cssText = \"\\\n.ace-kr-theme .ace_editor {\\\n  border: 2px solid rgb(159, 159, 159);\\\n}\\\n\\\n.ace-kr-theme .ace_editor.ace_focus {\\\n  border: 2px solid #327fbd;\\\n}\\\n\\\n.ace-kr-theme .ace_gutter {\\\n  background: #e8e8e8;\\\n  color: #333;\\\n}\\\n\\\n.ace-kr-theme .ace_print_margin {\\\n  width: 1px;\\\n  background: #e8e8e8;\\\n}\\\n\\\n.ace-kr-theme .ace_scroller {\\\n  background-color: #0B0A09;\\\n}\\\n\\\n.ace-kr-theme .ace_text-layer {\\\n  cursor: text;\\\n  color: #FCFFE0;\\\n}\\\n\\\n.ace-kr-theme .ace_cursor {\\\n  border-left: 2px solid #FF9900;\\\n}\\\n\\\n.ace-kr-theme .ace_cursor.ace_overwrite {\\\n  border-left: 0px;\\\n  border-bottom: 1px solid #FF9900;\\\n}\\\n\\\n.ace-kr-theme .ace_marker-layer .ace_selection {\\\n  background: rgba(170, 0, 255, 0.45);\\\n}\\\n\\\n.ace-kr-theme.multiselect .ace_selection.start {\\\n  box-shadow: 0 0 3px 0px #0B0A09;\\\n  border-radius: 2px;\\\n}\\\n\\\n.ace-kr-theme .ace_marker-layer .ace_step {\\\n  background: rgb(102, 82, 0);\\\n}\\\n\\\n.ace-kr-theme .ace_marker-layer .ace_bracket {\\\n  margin: -1px 0 0 -1px;\\\n  border: 1px solid rgba(255, 177, 111, 0.32);\\\n}\\\n\\\n.ace-kr-theme .ace_marker-layer .ace_active_line {\\\n  background: #38403D;\\\n}\\\n\\\n.ace-kr-theme .ace_gutter_active_line {\\\n  background-color : #dcdcdc;\\\n}\\\n\\\n.ace-kr-theme .ace_marker-layer .ace_selected_word {\\\n  border: 1px solid rgba(170, 0, 255, 0.45);\\\n}\\\n\\\n.ace-kr-theme .ace_invisible {\\\n  color: rgba(255, 177, 111, 0.32);\\\n}\\\n\\\n.ace-kr-theme .ace_keyword, .ace-kr-theme .ace_meta {\\\n  color:#949C8B;\\\n}\\\n\\\n.ace-kr-theme .ace_constant, .ace-kr-theme .ace_constant.ace_other {\\\n  color:rgba(210, 117, 24, 0.76);\\\n}\\\n\\\n.ace-kr-theme .ace_constant.ace_character,  {\\\n  color:rgba(210, 117, 24, 0.76);\\\n}\\\n\\\n.ace-kr-theme .ace_constant.ace_character.ace_escape,  {\\\n  color:rgba(210, 117, 24, 0.76);\\\n}\\\n\\\n.ace-kr-theme .ace_invalid {\\\n  color:#F8F8F8;\\\nbackground-color:#A41300;\\\n}\\\n\\\n.ace-kr-theme .ace_support {\\\n  color:#9FC28A;\\\n}\\\n\\\n.ace-kr-theme .ace_support.ace_constant {\\\n  color:#C27E66;\\\n}\\\n\\\n.ace-kr-theme .ace_fold {\\\n    background-color: #949C8B;\\\n    border-color: #FCFFE0;\\\n}\\\n\\\n.ace-kr-theme .ace_support.ace_function {\\\n  color:#85873A;\\\n}\\\n\\\n.ace-kr-theme .ace_storage {\\\n  color:#FFEE80;\\\n}\\\n\\\n.ace-kr-theme .ace_string.ace_regexp {\\\n  color:rgba(125, 255, 192, 0.65);\\\n}\\\n\\\n.ace-kr-theme .ace_comment {\\\n  font-style:italic;\\\ncolor:#706D5B;\\\n}\\\n\\\n.ace-kr-theme .ace_variable {\\\n  color:#D1A796;\\\n}\\\n\\\n.ace-kr-theme .ace_variable.ace_language {\\\n  color:#FF80E1;\\\n}\\\n\\\n.ace-kr-theme .ace_meta.ace_tag {\\\n  color:#BABD9C;\\\n}\\\n\\\n.ace-kr-theme .ace_markup.ace_underline {\\\n    text-decoration:underline;\\\n}\\\n\\\n.ace-kr-theme .ace_markup.ace_list {\\\n  background-color:#0F0040;\\\n}\";\n\n    var dom = require(\"../lib/dom\");\n    dom.importCssString(exports.cssText, exports.cssClass);\n});\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-kuroir.js",
    "content": "define(\"ace/theme/kuroir\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-kuroir\",t.cssText=\"/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: 467560D0-6ACE-4409-82FD-4791420837AC) */.ace-kuroir .ace_gutter {background: #e8e8e8;color: #333;}.ace-kuroir .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-kuroir {background-color: #E8E9E8;color: #363636;}.ace-kuroir .ace_cursor {color: #202020;}.ace-kuroir .ace_marker-layer .ace_selection {background: rgba(245, 170, 0, 0.57);}.ace-kuroir.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #E8E9E8;border-radius: 2px;}.ace-kuroir .ace_marker-layer .ace_step {background: rgb(198, 219, 174);}.ace-kuroir .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(0, 0, 0, 0.29);}.ace-kuroir .ace_marker-layer .ace_active-line {background: rgba(203, 220, 47, 0.22);}.ace-kuroir .ace_gutter-active-line {background-color: rgba(203, 220, 47, 0.22);}.ace-kuroir .ace_marker-layer .ace_selected-word {border: 1px solid rgba(245, 170, 0, 0.57);}.ace-kuroir .ace_fold {border-color: #363636;}.ace-kuroir .ace_constant{color:#CD6839;}.ace-kuroir .ace_constant.ace_numeric{color:#9A5925;}.ace-kuroir .ace_support{color:#104E8B;}.ace-kuroir .ace_support.ace_function{color:#005273;}.ace-kuroir .ace_support.ace_constant{color:#CF6A4C;}.ace-kuroir .ace_storage{color:#A52A2A;}.ace-kuroir .ace_invalid.ace_illegal{color:#FD1224;background-color:rgba(255, 6, 0, 0.15);}.ace-kuroir .ace_invalid.ace_deprecated{text-decoration:underline;font-style:italic;color:#FD1732;background-color:#E8E9E8;}.ace-kuroir .ace_string{color:#639300;}.ace-kuroir .ace_string.ace_regexp{color:#417E00;background-color:#C9D4BE;}.ace-kuroir .ace_comment{color:rgba(148, 148, 148, 0.91);background-color:rgba(220, 220, 220, 0.56);}.ace-kuroir .ace_variable{color:#009ACD;}.ace-kuroir .ace_meta.ace_tag{color:#005273;}.ace-kuroir .ace_markup.ace_heading{color:#B8012D;background-color:rgba(191, 97, 51, 0.051);}.ace-kuroir .ace_markup.ace_list{color:#8F5B26;}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-merbivore.js",
    "content": "define(\"ace/theme/merbivore\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-merbivore\",t.cssText=\".ace-merbivore .ace_gutter {background: #202020;color: #E6E1DC}.ace-merbivore .ace_print-margin {width: 1px;background: #555651}.ace-merbivore {background-color: #161616;color: #E6E1DC}.ace-merbivore .ace_cursor {color: #FFFFFF}.ace-merbivore .ace_marker-layer .ace_selection {background: #454545}.ace-merbivore.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #161616;border-radius: 2px}.ace-merbivore .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-merbivore .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-merbivore .ace_marker-layer .ace_active-line {background: #333435}.ace-merbivore .ace_gutter-active-line {background-color: #333435}.ace-merbivore .ace_marker-layer .ace_selected-word {border: 1px solid #454545}.ace-merbivore .ace_invisible {color: #404040}.ace-merbivore .ace_entity.ace_name.ace_tag,.ace-merbivore .ace_keyword,.ace-merbivore .ace_meta,.ace-merbivore .ace_meta.ace_tag,.ace-merbivore .ace_storage,.ace-merbivore .ace_support.ace_function {color: #FC6F09}.ace-merbivore .ace_constant,.ace-merbivore .ace_constant.ace_character,.ace-merbivore .ace_constant.ace_character.ace_escape,.ace-merbivore .ace_constant.ace_other,.ace-merbivore .ace_support.ace_type {color: #1EDAFB}.ace-merbivore .ace_constant.ace_character.ace_escape {color: #519F50}.ace-merbivore .ace_constant.ace_language {color: #FDC251}.ace-merbivore .ace_constant.ace_library,.ace-merbivore .ace_string,.ace-merbivore .ace_support.ace_constant {color: #8DFF0A}.ace-merbivore .ace_constant.ace_numeric {color: #58C554}.ace-merbivore .ace_invalid {color: #FFFFFF;background-color: #990000}.ace-merbivore .ace_fold {background-color: #FC6F09;border-color: #E6E1DC}.ace-merbivore .ace_comment {font-style: italic;color: #AD2EA4}.ace-merbivore .ace_entity.ace_other.ace_attribute-name {color: #FFFF89}.ace-merbivore .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQFxf3ZXB1df0PAAdsAmERTkEHAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-merbivore_soft.js",
    "content": "define(\"ace/theme/merbivore_soft\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-merbivore-soft\",t.cssText=\".ace-merbivore-soft .ace_gutter {background: #262424;color: #E6E1DC}.ace-merbivore-soft .ace_print-margin {width: 1px;background: #262424}.ace-merbivore-soft {background-color: #1C1C1C;color: #E6E1DC}.ace-merbivore-soft .ace_cursor {color: #FFFFFF}.ace-merbivore-soft .ace_marker-layer .ace_selection {background: #494949}.ace-merbivore-soft.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #1C1C1C;border-radius: 2px}.ace-merbivore-soft .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-merbivore-soft .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-merbivore-soft .ace_marker-layer .ace_active-line {background: #333435}.ace-merbivore-soft .ace_gutter-active-line {background-color: #333435}.ace-merbivore-soft .ace_marker-layer .ace_selected-word {border: 1px solid #494949}.ace-merbivore-soft .ace_invisible {color: #404040}.ace-merbivore-soft .ace_entity.ace_name.ace_tag,.ace-merbivore-soft .ace_keyword,.ace-merbivore-soft .ace_meta,.ace-merbivore-soft .ace_meta.ace_tag,.ace-merbivore-soft .ace_storage {color: #FC803A}.ace-merbivore-soft .ace_constant,.ace-merbivore-soft .ace_constant.ace_character,.ace-merbivore-soft .ace_constant.ace_character.ace_escape,.ace-merbivore-soft .ace_constant.ace_other,.ace-merbivore-soft .ace_support.ace_type {color: #68C1D8}.ace-merbivore-soft .ace_constant.ace_character.ace_escape {color: #B3E5B4}.ace-merbivore-soft .ace_constant.ace_language {color: #E1C582}.ace-merbivore-soft .ace_constant.ace_library,.ace-merbivore-soft .ace_string,.ace-merbivore-soft .ace_support.ace_constant {color: #8EC65F}.ace-merbivore-soft .ace_constant.ace_numeric {color: #7FC578}.ace-merbivore-soft .ace_invalid,.ace-merbivore-soft .ace_invalid.ace_deprecated {color: #FFFFFF;background-color: #FE3838}.ace-merbivore-soft .ace_fold {background-color: #FC803A;border-color: #E6E1DC}.ace-merbivore-soft .ace_comment,.ace-merbivore-soft .ace_meta {font-style: italic;color: #AC4BB8}.ace-merbivore-soft .ace_entity.ace_other.ace_attribute-name {color: #EAF1A3}.ace-merbivore-soft .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWOQkpLyZfD09PwPAAfYAnaStpHRAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-mono_industrial.js",
    "content": "define(\"ace/theme/mono_industrial\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-mono-industrial\",t.cssText=\".ace-mono-industrial .ace_gutter {background: #1d2521;color: #C5C9C9}.ace-mono-industrial .ace_print-margin {width: 1px;background: #555651}.ace-mono-industrial {background-color: #222C28;color: #FFFFFF}.ace-mono-industrial .ace_cursor {color: #FFFFFF}.ace-mono-industrial .ace_marker-layer .ace_selection {background: rgba(145, 153, 148, 0.40)}.ace-mono-industrial.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #222C28;border-radius: 2px}.ace-mono-industrial .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-mono-industrial .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(102, 108, 104, 0.50)}.ace-mono-industrial .ace_marker-layer .ace_active-line {background: rgba(12, 13, 12, 0.25)}.ace-mono-industrial .ace_gutter-active-line {background-color: rgba(12, 13, 12, 0.25)}.ace-mono-industrial .ace_marker-layer .ace_selected-word {border: 1px solid rgba(145, 153, 148, 0.40)}.ace-mono-industrial .ace_invisible {color: rgba(102, 108, 104, 0.50)}.ace-mono-industrial .ace_string {background-color: #151C19;color: #FFFFFF}.ace-mono-industrial .ace_keyword,.ace-mono-industrial .ace_meta {color: #A39E64}.ace-mono-industrial .ace_constant,.ace-mono-industrial .ace_constant.ace_character,.ace-mono-industrial .ace_constant.ace_character.ace_escape,.ace-mono-industrial .ace_constant.ace_numeric,.ace-mono-industrial .ace_constant.ace_other {color: #E98800}.ace-mono-industrial .ace_entity.ace_name.ace_function,.ace-mono-industrial .ace_keyword.ace_operator,.ace-mono-industrial .ace_variable {color: #A8B3AB}.ace-mono-industrial .ace_invalid {color: #FFFFFF;background-color: rgba(153, 0, 0, 0.68)}.ace-mono-industrial .ace_support.ace_constant {color: #C87500}.ace-mono-industrial .ace_fold {background-color: #A8B3AB;border-color: #FFFFFF}.ace-mono-industrial .ace_support.ace_function {color: #588E60}.ace-mono-industrial .ace_entity.ace_name,.ace-mono-industrial .ace_support.ace_class,.ace-mono-industrial .ace_support.ace_type {color: #5778B6}.ace-mono-industrial .ace_storage {color: #C23B00}.ace-mono-industrial .ace_variable.ace_language,.ace-mono-industrial .ace_variable.ace_parameter {color: #648BD2}.ace-mono-industrial .ace_comment {color: #666C68;background-color: #151C19}.ace-mono-industrial .ace_entity.ace_other.ace_attribute-name {color: #909993}.ace-mono-industrial .ace_entity.ace_name.ace_tag {color: #A65EFF}.ace-mono-industrial .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNQ1NbwZfALD/4PAAlTArlEC4r/AAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-monokai.js",
    "content": "define(\"ace/theme/monokai\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-monokai\",t.cssText=\".ace-monokai .ace_gutter {background: #2F3129;color: #8F908A}.ace-monokai .ace_print-margin {width: 1px;background: #555651}.ace-monokai {background-color: #272822;color: #F8F8F2}.ace-monokai .ace_cursor {color: #F8F8F0}.ace-monokai .ace_marker-layer .ace_selection {background: #49483E}.ace-monokai.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #272822;border-radius: 2px}.ace-monokai .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-monokai .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #49483E}.ace-monokai .ace_marker-layer .ace_active-line {background: #202020}.ace-monokai .ace_gutter-active-line {background-color: #272727}.ace-monokai .ace_marker-layer .ace_selected-word {border: 1px solid #49483E}.ace-monokai .ace_invisible {color: #52524d}.ace-monokai .ace_entity.ace_name.ace_tag,.ace-monokai .ace_keyword,.ace-monokai .ace_meta.ace_tag,.ace-monokai .ace_storage {color: #F92672}.ace-monokai .ace_punctuation,.ace-monokai .ace_punctuation.ace_tag {color: #fff}.ace-monokai .ace_constant.ace_character,.ace-monokai .ace_constant.ace_language,.ace-monokai .ace_constant.ace_numeric,.ace-monokai .ace_constant.ace_other {color: #AE81FF}.ace-monokai .ace_invalid {color: #F8F8F0;background-color: #F92672}.ace-monokai .ace_invalid.ace_deprecated {color: #F8F8F0;background-color: #AE81FF}.ace-monokai .ace_support.ace_constant,.ace-monokai .ace_support.ace_function {color: #66D9EF}.ace-monokai .ace_fold {background-color: #A6E22E;border-color: #F8F8F2}.ace-monokai .ace_storage.ace_type,.ace-monokai .ace_support.ace_class,.ace-monokai .ace_support.ace_type {font-style: italic;color: #66D9EF}.ace-monokai .ace_entity.ace_name.ace_function,.ace-monokai .ace_entity.ace_other,.ace-monokai .ace_entity.ace_other.ace_attribute-name,.ace-monokai .ace_variable {color: #A6E22E}.ace-monokai .ace_variable.ace_parameter {font-style: italic;color: #FD971F}.ace-monokai .ace_string {color: #E6DB74}.ace-monokai .ace_comment {color: #75715E}.ace-monokai .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-pastel_on_dark.js",
    "content": "define(\"ace/theme/pastel_on_dark\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-pastel-on-dark\",t.cssText=\".ace-pastel-on-dark .ace_gutter {background: #353030;color: #8F938F}.ace-pastel-on-dark .ace_print-margin {width: 1px;background: #353030}.ace-pastel-on-dark {background-color: #2C2828;color: #8F938F}.ace-pastel-on-dark .ace_cursor {color: #A7A7A7}.ace-pastel-on-dark .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20)}.ace-pastel-on-dark.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #2C2828;border-radius: 2px}.ace-pastel-on-dark .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-pastel-on-dark .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25)}.ace-pastel-on-dark .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031)}.ace-pastel-on-dark .ace_gutter-active-line {background-color: rgba(255, 255, 255, 0.031)}.ace-pastel-on-dark .ace_marker-layer .ace_selected-word {border: 1px solid rgba(221, 240, 255, 0.20)}.ace-pastel-on-dark .ace_invisible {color: rgba(255, 255, 255, 0.25)}.ace-pastel-on-dark .ace_keyword,.ace-pastel-on-dark .ace_meta {color: #757aD8}.ace-pastel-on-dark .ace_constant,.ace-pastel-on-dark .ace_constant.ace_character,.ace-pastel-on-dark .ace_constant.ace_character.ace_escape,.ace-pastel-on-dark .ace_constant.ace_other {color: #4FB7C5}.ace-pastel-on-dark .ace_keyword.ace_operator {color: #797878}.ace-pastel-on-dark .ace_constant.ace_character {color: #AFA472}.ace-pastel-on-dark .ace_constant.ace_language {color: #DE8E30}.ace-pastel-on-dark .ace_constant.ace_numeric {color: #CCCCCC}.ace-pastel-on-dark .ace_invalid,.ace-pastel-on-dark .ace_invalid.ace_illegal {color: #F8F8F8;background-color: rgba(86, 45, 86, 0.75)}.ace-pastel-on-dark .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1}.ace-pastel-on-dark .ace_fold {background-color: #757aD8;border-color: #8F938F}.ace-pastel-on-dark .ace_support.ace_function {color: #AEB2F8}.ace-pastel-on-dark .ace_string {color: #66A968}.ace-pastel-on-dark .ace_string.ace_regexp {color: #E9C062}.ace-pastel-on-dark .ace_comment {color: #A6C6FF}.ace-pastel-on-dark .ace_variable {color: #BEBF55}.ace-pastel-on-dark .ace_variable.ace_language {color: #C1C144}.ace-pastel-on-dark .ace_xml-pe {color: #494949}.ace-pastel-on-dark .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYIiPj/8PAARgAh2NTMh8AAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-solarized_dark.js",
    "content": "define(\"ace/theme/solarized_dark\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-solarized-dark\",t.cssText=\".ace-solarized-dark .ace_gutter {background: #01313f;color: #d0edf7}.ace-solarized-dark .ace_print-margin {width: 1px;background: #33555E}.ace-solarized-dark {background-color: #002B36;color: #93A1A1}.ace-solarized-dark .ace_entity.ace_other.ace_attribute-name,.ace-solarized-dark .ace_storage {color: #93A1A1}.ace-solarized-dark .ace_cursor,.ace-solarized-dark .ace_string.ace_regexp {color: #D30102}.ace-solarized-dark .ace_marker-layer .ace_active-line,.ace-solarized-dark .ace_marker-layer .ace_selection {background: rgba(255, 255, 255, 0.1)}.ace-solarized-dark.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002B36;border-radius: 2px}.ace-solarized-dark .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-solarized-dark .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_gutter-active-line {background-color: #0d3440}.ace-solarized-dark .ace_marker-layer .ace_selected-word {border: 1px solid #073642}.ace-solarized-dark .ace_invisible {color: rgba(147, 161, 161, 0.50)}.ace-solarized-dark .ace_keyword,.ace-solarized-dark .ace_meta,.ace-solarized-dark .ace_support.ace_class,.ace-solarized-dark .ace_support.ace_type {color: #859900}.ace-solarized-dark .ace_constant.ace_character,.ace-solarized-dark .ace_constant.ace_other {color: #CB4B16}.ace-solarized-dark .ace_constant.ace_language {color: #B58900}.ace-solarized-dark .ace_constant.ace_numeric {color: #D33682}.ace-solarized-dark .ace_fold {background-color: #268BD2;border-color: #93A1A1}.ace-solarized-dark .ace_entity.ace_name.ace_function,.ace-solarized-dark .ace_entity.ace_name.ace_tag,.ace-solarized-dark .ace_support.ace_function,.ace-solarized-dark .ace_variable,.ace-solarized-dark .ace_variable.ace_language {color: #268BD2}.ace-solarized-dark .ace_string {color: #2AA198}.ace-solarized-dark .ace_comment {font-style: italic;color: #657B83}.ace-solarized-dark .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNg0Db1ZVCxc/sPAAd4AlUHlLenAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-solarized_light.js",
    "content": "define(\"ace/theme/solarized_light\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-solarized-light\",t.cssText=\".ace-solarized-light .ace_gutter {background: #fbf1d3;color: #333}.ace-solarized-light .ace_print-margin {width: 1px;background: #e8e8e8}.ace-solarized-light {background-color: #FDF6E3;color: #586E75}.ace-solarized-light .ace_cursor {color: #000000}.ace-solarized-light .ace_marker-layer .ace_selection {background: rgba(7, 54, 67, 0.09)}.ace-solarized-light.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FDF6E3;border-radius: 2px}.ace-solarized-light .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-solarized-light .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(147, 161, 161, 0.50)}.ace-solarized-light .ace_marker-layer .ace_active-line {background: #EEE8D5}.ace-solarized-light .ace_gutter-active-line {background-color : #EDE5C1}.ace-solarized-light .ace_marker-layer .ace_selected-word {border: 1px solid #073642}.ace-solarized-light .ace_invisible {color: rgba(147, 161, 161, 0.50)}.ace-solarized-light .ace_keyword,.ace-solarized-light .ace_meta,.ace-solarized-light .ace_support.ace_class,.ace-solarized-light .ace_support.ace_type {color: #859900}.ace-solarized-light .ace_constant.ace_character,.ace-solarized-light .ace_constant.ace_other {color: #CB4B16}.ace-solarized-light .ace_constant.ace_language {color: #B58900}.ace-solarized-light .ace_constant.ace_numeric {color: #D33682}.ace-solarized-light .ace_fold {background-color: #268BD2;border-color: #586E75}.ace-solarized-light .ace_entity.ace_name.ace_function,.ace-solarized-light .ace_entity.ace_name.ace_tag,.ace-solarized-light .ace_support.ace_function,.ace-solarized-light .ace_variable,.ace-solarized-light .ace_variable.ace_language {color: #268BD2}.ace-solarized-light .ace_storage {color: #073642}.ace-solarized-light .ace_string {color: #2AA198}.ace-solarized-light .ace_string.ace_regexp {color: #D30102}.ace-solarized-light .ace_comment,.ace-solarized-light .ace_entity.ace_other.ace_attribute-name {color: #93A1A1}.ace-solarized-light .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHjy8NJ/AAjgA5fzQUmBAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-terminal.js",
    "content": "define(\"ace/theme/terminal\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-terminal-theme\",t.cssText=\".ace-terminal-theme .ace_gutter {background: #1a0005;color: steelblue}.ace-terminal-theme .ace_print-margin {width: 1px;background: #1a1a1a}.ace-terminal-theme {background-color: black;color: #DEDEDE}.ace-terminal-theme .ace_cursor {color: #9F9F9F}.ace-terminal-theme .ace_marker-layer .ace_selection {background: #424242}.ace-terminal-theme.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px black;border-radius: 2px}.ace-terminal-theme .ace_marker-layer .ace_step {background: rgb(0, 0, 0)}.ace-terminal-theme .ace_marker-layer .ace_bracket {background: #090;}.ace-terminal-theme .ace_marker-layer .ace_bracket-start {background: #090;}.ace-terminal-theme .ace_marker-layer .ace_bracket-unmatched {margin: -1px 0 0 -1px;border: 1px solid #900}.ace-terminal-theme .ace_marker-layer .ace_active-line {background: #2A2A2A}.ace-terminal-theme .ace_gutter-active-line {background-color: #2A112A}.ace-terminal-theme .ace_marker-layer .ace_selected-word {border: 1px solid #424242}.ace-terminal-theme .ace_invisible {color: #343434}.ace-terminal-theme .ace_keyword,.ace-terminal-theme .ace_meta,.ace-terminal-theme .ace_storage,.ace-terminal-theme .ace_storage.ace_type,.ace-terminal-theme .ace_support.ace_type {color: tomato}.ace-terminal-theme .ace_keyword.ace_operator {color: deeppink}.ace-terminal-theme .ace_constant.ace_character,.ace-terminal-theme .ace_constant.ace_language,.ace-terminal-theme .ace_constant.ace_numeric,.ace-terminal-theme .ace_keyword.ace_other.ace_unit,.ace-terminal-theme .ace_support.ace_constant,.ace-terminal-theme .ace_variable.ace_parameter {color: #E78C45}.ace-terminal-theme .ace_constant.ace_other {color: gold}.ace-terminal-theme .ace_invalid {color: yellow;background-color: red}.ace-terminal-theme .ace_invalid.ace_deprecated {color: #CED2CF;background-color: #B798BF}.ace-terminal-theme .ace_fold {background-color: #7AA6DA;border-color: #DEDEDE}.ace-terminal-theme .ace_entity.ace_name.ace_function,.ace-terminal-theme .ace_support.ace_function,.ace-terminal-theme .ace_variable {color: #7AA6DA}.ace-terminal-theme .ace_support.ace_class,.ace-terminal-theme .ace_support.ace_type {color: #E7C547}.ace-terminal-theme .ace_heading,.ace-terminal-theme .ace_string {color: #B9CA4A}.ace-terminal-theme .ace_entity.ace_name.ace_tag,.ace-terminal-theme .ace_entity.ace_other.ace_attribute-name,.ace-terminal-theme .ace_meta.ace_tag,.ace-terminal-theme .ace_string.ace_regexp,.ace-terminal-theme .ace_variable {color: #D54E53}.ace-terminal-theme .ace_comment {color: orangered}.ace-terminal-theme .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYLBWV/8PAAK4AYnhiq+xAAAAAElFTkSuQmCC) right repeat-y;}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-textmate.js",
    "content": "define(\"ace/theme/textmate\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-tm\",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;border-radius: 2px;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==\") right repeat-y;}';var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-tomorrow.js",
    "content": "define(\"ace/theme/tomorrow\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-tomorrow\",t.cssText=\".ace-tomorrow .ace_gutter {background: #f6f6f6;color: #4D4D4C}.ace-tomorrow .ace_print-margin {width: 1px;background: #f6f6f6}.ace-tomorrow {background-color: #FFFFFF;color: #4D4D4C}.ace-tomorrow .ace_cursor {color: #AEAFAD}.ace-tomorrow .ace_marker-layer .ace_selection {background: #D6D6D6}.ace-tomorrow.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;border-radius: 2px}.ace-tomorrow .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-tomorrow .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #D1D1D1}.ace-tomorrow .ace_marker-layer .ace_active-line {background: #EFEFEF}.ace-tomorrow .ace_gutter-active-line {background-color : #dcdcdc}.ace-tomorrow .ace_marker-layer .ace_selected-word {border: 1px solid #D6D6D6}.ace-tomorrow .ace_invisible {color: #D1D1D1}.ace-tomorrow .ace_keyword,.ace-tomorrow .ace_meta,.ace-tomorrow .ace_storage,.ace-tomorrow .ace_storage.ace_type,.ace-tomorrow .ace_support.ace_type {color: #8959A8}.ace-tomorrow .ace_keyword.ace_operator {color: #3E999F}.ace-tomorrow .ace_constant.ace_character,.ace-tomorrow .ace_constant.ace_language,.ace-tomorrow .ace_constant.ace_numeric,.ace-tomorrow .ace_keyword.ace_other.ace_unit,.ace-tomorrow .ace_support.ace_constant,.ace-tomorrow .ace_variable.ace_parameter {color: #F5871F}.ace-tomorrow .ace_constant.ace_other {color: #666969}.ace-tomorrow .ace_invalid {color: #FFFFFF;background-color: #C82829}.ace-tomorrow .ace_invalid.ace_deprecated {color: #FFFFFF;background-color: #8959A8}.ace-tomorrow .ace_fold {background-color: #4271AE;border-color: #4D4D4C}.ace-tomorrow .ace_entity.ace_name.ace_function,.ace-tomorrow .ace_support.ace_function,.ace-tomorrow .ace_variable {color: #4271AE}.ace-tomorrow .ace_support.ace_class,.ace-tomorrow .ace_support.ace_type {color: #C99E00}.ace-tomorrow .ace_heading,.ace-tomorrow .ace_markup.ace_heading,.ace-tomorrow .ace_string {color: #718C00}.ace-tomorrow .ace_entity.ace_name.ace_tag,.ace-tomorrow .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow .ace_meta.ace_tag,.ace-tomorrow .ace_string.ace_regexp,.ace-tomorrow .ace_variable {color: #C82829}.ace-tomorrow .ace_comment {color: #8E908C}.ace-tomorrow .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bdu3f/BwAlfgctduB85QAAAABJRU5ErkJggg==) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-tomorrow_night.js",
    "content": "define(\"ace/theme/tomorrow_night\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-tomorrow-night\",t.cssText=\".ace-tomorrow-night .ace_gutter {background: #25282c;color: #C5C8C6}.ace-tomorrow-night .ace_print-margin {width: 1px;background: #25282c}.ace-tomorrow-night {background-color: #1D1F21;color: #C5C8C6}.ace-tomorrow-night .ace_cursor {color: #AEAFAD}.ace-tomorrow-night .ace_marker-layer .ace_selection {background: #373B41}.ace-tomorrow-night.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #1D1F21;border-radius: 2px}.ace-tomorrow-night .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-tomorrow-night .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #4B4E55}.ace-tomorrow-night .ace_marker-layer .ace_active-line {background: #282A2E}.ace-tomorrow-night .ace_gutter-active-line {background-color: #282A2E}.ace-tomorrow-night .ace_marker-layer .ace_selected-word {border: 1px solid #373B41}.ace-tomorrow-night .ace_invisible {color: #4B4E55}.ace-tomorrow-night .ace_keyword,.ace-tomorrow-night .ace_meta,.ace-tomorrow-night .ace_storage,.ace-tomorrow-night .ace_storage.ace_type,.ace-tomorrow-night .ace_support.ace_type {color: #B294BB}.ace-tomorrow-night .ace_keyword.ace_operator {color: #8ABEB7}.ace-tomorrow-night .ace_constant.ace_character,.ace-tomorrow-night .ace_constant.ace_language,.ace-tomorrow-night .ace_constant.ace_numeric,.ace-tomorrow-night .ace_keyword.ace_other.ace_unit,.ace-tomorrow-night .ace_support.ace_constant,.ace-tomorrow-night .ace_variable.ace_parameter {color: #DE935F}.ace-tomorrow-night .ace_constant.ace_other {color: #CED1CF}.ace-tomorrow-night .ace_invalid {color: #CED2CF;background-color: #DF5F5F}.ace-tomorrow-night .ace_invalid.ace_deprecated {color: #CED2CF;background-color: #B798BF}.ace-tomorrow-night .ace_fold {background-color: #81A2BE;border-color: #C5C8C6}.ace-tomorrow-night .ace_entity.ace_name.ace_function,.ace-tomorrow-night .ace_support.ace_function,.ace-tomorrow-night .ace_variable {color: #81A2BE}.ace-tomorrow-night .ace_support.ace_class,.ace-tomorrow-night .ace_support.ace_type {color: #F0C674}.ace-tomorrow-night .ace_heading,.ace-tomorrow-night .ace_markup.ace_heading,.ace-tomorrow-night .ace_string {color: #B5BD68}.ace-tomorrow-night .ace_entity.ace_name.ace_tag,.ace-tomorrow-night .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow-night .ace_meta.ace_tag,.ace-tomorrow-night .ace_string.ace_regexp,.ace-tomorrow-night .ace_variable {color: #CC6666}.ace-tomorrow-night .ace_comment {color: #969896}.ace-tomorrow-night .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYHB3d/8PAAOIAdULw8qMAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-tomorrow_night_blue.js",
    "content": "define(\"ace/theme/tomorrow_night_blue\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-tomorrow-night-blue\",t.cssText=\".ace-tomorrow-night-blue .ace_gutter {background: #00204b;color: #7388b5}.ace-tomorrow-night-blue .ace_print-margin {width: 1px;background: #00204b}.ace-tomorrow-night-blue {background-color: #002451;color: #FFFFFF}.ace-tomorrow-night-blue .ace_constant.ace_other,.ace-tomorrow-night-blue .ace_cursor {color: #FFFFFF}.ace-tomorrow-night-blue .ace_marker-layer .ace_selection {background: #003F8E}.ace-tomorrow-night-blue.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #002451;border-radius: 2px}.ace-tomorrow-night-blue .ace_marker-layer .ace_step {background: rgb(127, 111, 19)}.ace-tomorrow-night-blue .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404F7D}.ace-tomorrow-night-blue .ace_marker-layer .ace_active-line {background: #00346E}.ace-tomorrow-night-blue .ace_gutter-active-line {background-color: #022040}.ace-tomorrow-night-blue .ace_marker-layer .ace_selected-word {border: 1px solid #003F8E}.ace-tomorrow-night-blue .ace_invisible {color: #404F7D}.ace-tomorrow-night-blue .ace_keyword,.ace-tomorrow-night-blue .ace_meta,.ace-tomorrow-night-blue .ace_storage,.ace-tomorrow-night-blue .ace_storage.ace_type,.ace-tomorrow-night-blue .ace_support.ace_type {color: #EBBBFF}.ace-tomorrow-night-blue .ace_keyword.ace_operator {color: #99FFFF}.ace-tomorrow-night-blue .ace_constant.ace_character,.ace-tomorrow-night-blue .ace_constant.ace_language,.ace-tomorrow-night-blue .ace_constant.ace_numeric,.ace-tomorrow-night-blue .ace_keyword.ace_other.ace_unit,.ace-tomorrow-night-blue .ace_support.ace_constant,.ace-tomorrow-night-blue .ace_variable.ace_parameter {color: #FFC58F}.ace-tomorrow-night-blue .ace_invalid {color: #FFFFFF;background-color: #F99DA5}.ace-tomorrow-night-blue .ace_invalid.ace_deprecated {color: #FFFFFF;background-color: #EBBBFF}.ace-tomorrow-night-blue .ace_fold {background-color: #BBDAFF;border-color: #FFFFFF}.ace-tomorrow-night-blue .ace_entity.ace_name.ace_function,.ace-tomorrow-night-blue .ace_support.ace_function,.ace-tomorrow-night-blue .ace_variable {color: #BBDAFF}.ace-tomorrow-night-blue .ace_support.ace_class,.ace-tomorrow-night-blue .ace_support.ace_type {color: #FFEEAD}.ace-tomorrow-night-blue .ace_heading,.ace-tomorrow-night-blue .ace_markup.ace_heading,.ace-tomorrow-night-blue .ace_string {color: #D1F1A9}.ace-tomorrow-night-blue .ace_entity.ace_name.ace_tag,.ace-tomorrow-night-blue .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow-night-blue .ace_meta.ace_tag,.ace-tomorrow-night-blue .ace_string.ace_regexp,.ace-tomorrow-night-blue .ace_variable {color: #FF9DA4}.ace-tomorrow-night-blue .ace_comment {color: #7285B7}.ace-tomorrow-night-blue .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYJDzqfwPAANXAeNsiA+ZAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-tomorrow_night_bright.js",
    "content": "define(\"ace/theme/tomorrow_night_bright\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-tomorrow-night-bright\",t.cssText=\".ace-tomorrow-night-bright .ace_gutter {background: #1a1a1a;color: #DEDEDE}.ace-tomorrow-night-bright .ace_print-margin {width: 1px;background: #1a1a1a}.ace-tomorrow-night-bright {background-color: #000000;color: #DEDEDE}.ace-tomorrow-night-bright .ace_cursor {color: #9F9F9F}.ace-tomorrow-night-bright .ace_marker-layer .ace_selection {background: #424242}.ace-tomorrow-night-bright.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #000000;border-radius: 2px}.ace-tomorrow-night-bright .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-tomorrow-night-bright .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #888888}.ace-tomorrow-night-bright .ace_marker-layer .ace_highlight {border: 1px solid rgb(110, 119, 0);border-bottom: 0;box-shadow: inset 0 -1px rgb(110, 119, 0);margin: -1px 0 0 -1px;background: rgba(255, 235, 0, 0.1);}.ace-tomorrow-night-bright .ace_marker-layer .ace_active-line {background: #2A2A2A}.ace-tomorrow-night-bright .ace_gutter-active-line {background-color: #2A2A2A}.ace-tomorrow-night-bright .ace_stack {background-color: rgb(66, 90, 44)}.ace-tomorrow-night-bright .ace_marker-layer .ace_selected-word {border: 1px solid #888888}.ace-tomorrow-night-bright .ace_invisible {color: #343434}.ace-tomorrow-night-bright .ace_keyword,.ace-tomorrow-night-bright .ace_meta,.ace-tomorrow-night-bright .ace_storage,.ace-tomorrow-night-bright .ace_storage.ace_type,.ace-tomorrow-night-bright .ace_support.ace_type {color: #C397D8}.ace-tomorrow-night-bright .ace_keyword.ace_operator {color: #70C0B1}.ace-tomorrow-night-bright .ace_constant.ace_character,.ace-tomorrow-night-bright .ace_constant.ace_language,.ace-tomorrow-night-bright .ace_constant.ace_numeric,.ace-tomorrow-night-bright .ace_keyword.ace_other.ace_unit,.ace-tomorrow-night-bright .ace_support.ace_constant,.ace-tomorrow-night-bright .ace_variable.ace_parameter {color: #E78C45}.ace-tomorrow-night-bright .ace_constant.ace_other {color: #EEEEEE}.ace-tomorrow-night-bright .ace_invalid {color: #CED2CF;background-color: #DF5F5F}.ace-tomorrow-night-bright .ace_invalid.ace_deprecated {color: #CED2CF;background-color: #B798BF}.ace-tomorrow-night-bright .ace_fold {background-color: #7AA6DA;border-color: #DEDEDE}.ace-tomorrow-night-bright .ace_entity.ace_name.ace_function,.ace-tomorrow-night-bright .ace_support.ace_function,.ace-tomorrow-night-bright .ace_variable {color: #7AA6DA}.ace-tomorrow-night-bright .ace_support.ace_class,.ace-tomorrow-night-bright .ace_support.ace_type {color: #E7C547}.ace-tomorrow-night-bright .ace_heading,.ace-tomorrow-night-bright .ace_markup.ace_heading,.ace-tomorrow-night-bright .ace_string {color: #B9CA4A}.ace-tomorrow-night-bright .ace_entity.ace_name.ace_tag,.ace-tomorrow-night-bright .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow-night-bright .ace_meta.ace_tag,.ace-tomorrow-night-bright .ace_string.ace_regexp,.ace-tomorrow-night-bright .ace_variable {color: #D54E53}.ace-tomorrow-night-bright .ace_comment {color: #969896}.ace-tomorrow-night-bright .ace_c9searchresults.ace_keyword {color: #C2C280;}.ace-tomorrow-night-bright .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYFBXV/8PAAJoAXX4kT2EAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-tomorrow_night_eighties.js",
    "content": "define(\"ace/theme/tomorrow_night_eighties\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-tomorrow-night-eighties\",t.cssText=\".ace-tomorrow-night-eighties .ace_gutter {background: #272727;color: #CCC}.ace-tomorrow-night-eighties .ace_print-margin {width: 1px;background: #272727}.ace-tomorrow-night-eighties {background-color: #2D2D2D;color: #CCCCCC}.ace-tomorrow-night-eighties .ace_constant.ace_other,.ace-tomorrow-night-eighties .ace_cursor {color: #CCCCCC}.ace-tomorrow-night-eighties .ace_marker-layer .ace_selection {background: #515151}.ace-tomorrow-night-eighties.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #2D2D2D;border-radius: 2px}.ace-tomorrow-night-eighties .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-tomorrow-night-eighties .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #6A6A6A}.ace-tomorrow-night-bright .ace_stack {background: rgb(66, 90, 44)}.ace-tomorrow-night-eighties .ace_marker-layer .ace_active-line {background: #393939}.ace-tomorrow-night-eighties .ace_gutter-active-line {background-color: #393939}.ace-tomorrow-night-eighties .ace_marker-layer .ace_selected-word {border: 1px solid #515151}.ace-tomorrow-night-eighties .ace_invisible {color: #6A6A6A}.ace-tomorrow-night-eighties .ace_keyword,.ace-tomorrow-night-eighties .ace_meta,.ace-tomorrow-night-eighties .ace_storage,.ace-tomorrow-night-eighties .ace_storage.ace_type,.ace-tomorrow-night-eighties .ace_support.ace_type {color: #CC99CC}.ace-tomorrow-night-eighties .ace_keyword.ace_operator {color: #66CCCC}.ace-tomorrow-night-eighties .ace_constant.ace_character,.ace-tomorrow-night-eighties .ace_constant.ace_language,.ace-tomorrow-night-eighties .ace_constant.ace_numeric,.ace-tomorrow-night-eighties .ace_keyword.ace_other.ace_unit,.ace-tomorrow-night-eighties .ace_support.ace_constant,.ace-tomorrow-night-eighties .ace_variable.ace_parameter {color: #F99157}.ace-tomorrow-night-eighties .ace_invalid {color: #CDCDCD;background-color: #F2777A}.ace-tomorrow-night-eighties .ace_invalid.ace_deprecated {color: #CDCDCD;background-color: #CC99CC}.ace-tomorrow-night-eighties .ace_fold {background-color: #6699CC;border-color: #CCCCCC}.ace-tomorrow-night-eighties .ace_entity.ace_name.ace_function,.ace-tomorrow-night-eighties .ace_support.ace_function,.ace-tomorrow-night-eighties .ace_variable {color: #6699CC}.ace-tomorrow-night-eighties .ace_support.ace_class,.ace-tomorrow-night-eighties .ace_support.ace_type {color: #FFCC66}.ace-tomorrow-night-eighties .ace_heading,.ace-tomorrow-night-eighties .ace_markup.ace_heading,.ace-tomorrow-night-eighties .ace_string {color: #99CC99}.ace-tomorrow-night-eighties .ace_comment {color: #999999}.ace-tomorrow-night-eighties .ace_entity.ace_name.ace_tag,.ace-tomorrow-night-eighties .ace_entity.ace_other.ace_attribute-name,.ace-tomorrow-night-eighties .ace_meta.ace_tag,.ace-tomorrow-night-eighties .ace_variable {color: #F2777A}.ace-tomorrow-night-eighties .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ09NrYAgMjP4PAAtGAwchHMyAAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-twilight.js",
    "content": "define(\"ace/theme/twilight\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-twilight\",t.cssText=\".ace-twilight .ace_gutter {background: #232323;color: #E2E2E2}.ace-twilight .ace_print-margin {width: 1px;background: #232323}.ace-twilight {background-color: #141414;color: #F8F8F8}.ace-twilight .ace_cursor {color: #A7A7A7}.ace-twilight .ace_marker-layer .ace_selection {background: rgba(221, 240, 255, 0.20)}.ace-twilight.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #141414;border-radius: 2px}.ace-twilight .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-twilight .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgba(255, 255, 255, 0.25)}.ace-twilight .ace_marker-layer .ace_active-line {background: rgba(255, 255, 255, 0.031)}.ace-twilight .ace_gutter-active-line {background-color: rgba(255, 255, 255, 0.031)}.ace-twilight .ace_marker-layer .ace_selected-word {border: 1px solid rgba(221, 240, 255, 0.20)}.ace-twilight .ace_invisible {color: rgba(255, 255, 255, 0.25)}.ace-twilight .ace_keyword,.ace-twilight .ace_meta {color: #CDA869}.ace-twilight .ace_constant,.ace-twilight .ace_constant.ace_character,.ace-twilight .ace_constant.ace_character.ace_escape,.ace-twilight .ace_constant.ace_other,.ace-twilight .ace_heading,.ace-twilight .ace_markup.ace_heading,.ace-twilight .ace_support.ace_constant {color: #CF6A4C}.ace-twilight .ace_invalid.ace_illegal {color: #F8F8F8;background-color: rgba(86, 45, 86, 0.75)}.ace-twilight .ace_invalid.ace_deprecated {text-decoration: underline;font-style: italic;color: #D2A8A1}.ace-twilight .ace_support {color: #9B859D}.ace-twilight .ace_fold {background-color: #AC885B;border-color: #F8F8F8}.ace-twilight .ace_support.ace_function {color: #DAD085}.ace-twilight .ace_list,.ace-twilight .ace_markup.ace_list,.ace-twilight .ace_storage {color: #F9EE98}.ace-twilight .ace_entity.ace_name.ace_function,.ace-twilight .ace_meta.ace_tag,.ace-twilight .ace_variable {color: #AC885B}.ace-twilight .ace_string {color: #8F9D6A}.ace-twilight .ace_string.ace_regexp {color: #E9C062}.ace-twilight .ace_comment {font-style: italic;color: #5F5A60}.ace-twilight .ace_variable {color: #7587A6}.ace-twilight .ace_xml-pe {color: #494949}.ace-twilight .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWMQERFpYLC1tf0PAAgOAnPnhxyiAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-vibrant_ink.js",
    "content": "define(\"ace/theme/vibrant_ink\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!0,t.cssClass=\"ace-vibrant-ink\",t.cssText=\".ace-vibrant-ink .ace_gutter {background: #1a1a1a;color: #BEBEBE}.ace-vibrant-ink .ace_print-margin {width: 1px;background: #1a1a1a}.ace-vibrant-ink {background-color: #0F0F0F;color: #FFFFFF}.ace-vibrant-ink .ace_cursor {color: #FFFFFF}.ace-vibrant-ink .ace_marker-layer .ace_selection {background: #6699CC}.ace-vibrant-ink.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #0F0F0F;border-radius: 2px}.ace-vibrant-ink .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-vibrant-ink .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #404040}.ace-vibrant-ink .ace_marker-layer .ace_active-line {background: #333333}.ace-vibrant-ink .ace_gutter-active-line {background-color: #333333}.ace-vibrant-ink .ace_marker-layer .ace_selected-word {border: 1px solid #6699CC}.ace-vibrant-ink .ace_invisible {color: #404040}.ace-vibrant-ink .ace_keyword,.ace-vibrant-ink .ace_meta {color: #FF6600}.ace-vibrant-ink .ace_constant,.ace-vibrant-ink .ace_constant.ace_character,.ace-vibrant-ink .ace_constant.ace_character.ace_escape,.ace-vibrant-ink .ace_constant.ace_other {color: #339999}.ace-vibrant-ink .ace_constant.ace_numeric {color: #99CC99}.ace-vibrant-ink .ace_invalid,.ace-vibrant-ink .ace_invalid.ace_deprecated {color: #CCFF33;background-color: #000000}.ace-vibrant-ink .ace_fold {background-color: #FFCC00;border-color: #FFFFFF}.ace-vibrant-ink .ace_entity.ace_name.ace_function,.ace-vibrant-ink .ace_support.ace_function,.ace-vibrant-ink .ace_variable {color: #FFCC00}.ace-vibrant-ink .ace_variable.ace_parameter {font-style: italic}.ace-vibrant-ink .ace_string {color: #66FF00}.ace-vibrant-ink .ace_string.ace_regexp {color: #44B4CC}.ace-vibrant-ink .ace_comment {color: #9933CC}.ace-vibrant-ink .ace_entity.ace_other.ace_attribute-name {font-style: italic;color: #99CC99}.ace-vibrant-ink .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWNgYGBgYNDTc/oPAALPAZ7hxlbYAAAAAElFTkSuQmCC) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/theme-xcode.js",
    "content": "define(\"ace/theme/xcode\",[\"require\",\"exports\",\"module\",\"ace/lib/dom\"],function(e,t,n){t.isDark=!1,t.cssClass=\"ace-xcode\",t.cssText=\"/* THIS THEME WAS AUTOGENERATED BY Theme.tmpl.css (UUID: EE3AD170-2B7F-4DE1-B724-C75F13FE0085) */.ace-xcode .ace_gutter {background: #e8e8e8;color: #333}.ace-xcode .ace_print-margin {width: 1px;background: #e8e8e8}.ace-xcode {background-color: #FFFFFF;color: #000000}.ace-xcode .ace_cursor {color: #000000}.ace-xcode .ace_marker-layer .ace_selection {background: #B5D5FF}.ace-xcode.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;border-radius: 2px}.ace-xcode .ace_marker-layer .ace_step {background: rgb(198, 219, 174)}.ace-xcode .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-xcode .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_gutter-active-line {background-color: rgba(0, 0, 0, 0.071)}.ace-xcode .ace_marker-layer .ace_selected-word {border: 1px solid #B5D5FF}.ace-xcode .ace_constant.ace_language,.ace-xcode .ace_keyword,.ace-xcode .ace_meta,.ace-xcode .ace_variable.ace_language {color: #C800A4}.ace-xcode .ace_invisible {color: #BFBFBF}.ace-xcode .ace_constant.ace_character,.ace-xcode .ace_constant.ace_other {color: #275A5E}.ace-xcode .ace_constant.ace_numeric {color: #3A00DC}.ace-xcode .ace_entity.ace_other.ace_attribute-name,.ace-xcode .ace_support.ace_constant,.ace-xcode .ace_support.ace_function {color: #450084}.ace-xcode .ace_fold {background-color: #C800A4;border-color: #000000}.ace-xcode .ace_entity.ace_name.ace_tag,.ace-xcode .ace_support.ace_class,.ace-xcode .ace_support.ace_type {color: #790EAD}.ace-xcode .ace_storage {color: #C900A4}.ace-xcode .ace_string {color: #DF0002}.ace-xcode .ace_comment {color: #008E00}.ace-xcode .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==) right repeat-y}\";var r=e(\"../lib/dom\");r.importCssString(t.cssText,t.cssClass)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-coffee.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/coffee/coffee-script\",[\"require\",\"exports\",\"module\",\"ace/mode/coffee/lexer\",\"ace/mode/coffee/parser\",\"ace/mode/coffee/nodes\"],function(e,t,n){var r=e(\"./lexer\").Lexer,i=e(\"./parser\"),s=new r;i.lexer={lex:function(){var e,t;return t=this.tokens[this.pos++],t?(e=t[0],this.yytext=t[1],this.yylloc=t[2],this.yylineno=this.yylloc.first_line):e=\"\",e},setInput:function(e){return this.tokens=e,this.pos=0},upcomingInput:function(){return\"\"}},i.yy=e(\"./nodes\"),t.parse=function(e){return i.parse(s.tokenize(e))}}),define(\"ace/mode/coffee/lexer\",[\"require\",\"exports\",\"module\",\"ace/mode/coffee/rewriter\",\"ace/mode/coffee/helpers\"],function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1};et=e(\"./rewriter\"),F=et.Rewriter,w=et.INVERSES,tt=e(\"./helpers\"),V=tt.count,Y=tt.starts,X=tt.compact,K=tt.last,G=tt.repeat,$=tt.invertLiterate,Q=tt.locationDataToString,Z=tt.throwSyntaxError,t.Lexer=k=function(){function e(){}return e.prototype.tokenize=function(e,t){var n,r,i,s;t==null&&(t={}),this.literate=t.literate,this.indent=0,this.baseIndent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],this.chunkLine=t.line||0,this.chunkColumn=t.column||0,e=this.clean(e),r=0;while(this.chunk=e.slice(r))n=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.heredocToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken(),s=this.getLineAndColumnFromChunk(n),this.chunkLine=s[0],this.chunkColumn=s[1],r+=n;return this.closeIndentation(),(i=this.ends.pop())&&this.error(\"missing \"+i),t.rewrite===!1?this.tokens:(new F).rewrite(this.tokens)},e.prototype.clean=function(e){return e.charCodeAt(0)===r&&(e=e.slice(1)),e=e.replace(/\\r/g,\"\").replace(U,\"\"),W.test(e)&&(e=\"\\n\"+e,this.chunkLine--),this.literate&&(e=$(e)),e},e.prototype.identifierToken=function(){var e,t,n,r,i,s,o,l,c,h,p,d,v,m;return(o=y.exec(this.chunk))?(s=o[0],r=o[1],e=o[2],i=r.length,l=void 0,r===\"own\"&&this.tag()===\"FOR\"?(this.token(\"OWN\",r),r.length):(n=e||(c=K(this.tokens))&&((d=c[0])===\".\"||d===\"?.\"||d===\"::\"||d===\"?::\"||!c.spaced&&c[0]===\"@\"),h=\"IDENTIFIER\",!n&&(nt.call(x,r)>=0||nt.call(f,r)>=0)&&(h=r.toUpperCase(),h===\"WHEN\"&&(v=this.tag(),nt.call(T,v)>=0)?h=\"LEADING_WHEN\":h===\"FOR\"?this.seenFor=!0:h===\"UNLESS\"?h=\"IF\":nt.call(z,h)>=0?h=\"UNARY\":nt.call(B,h)>=0&&(h!==\"INSTANCEOF\"&&this.seenFor?(h=\"FOR\"+h,this.seenFor=!1):(h=\"RELATION\",this.value()===\"!\"&&(l=this.tokens.pop(),r=\"!\"+r)))),nt.call(S,r)>=0&&(n?(h=\"IDENTIFIER\",r=new String(r),r.reserved=!0):nt.call(j,r)>=0&&this.error('reserved word \"'+r+'\"')),n||(nt.call(u,r)>=0&&(r=a[r]),h=function(){switch(r){case\"!\":return\"UNARY\";case\"==\":case\"!=\":return\"COMPARE\";case\"&&\":case\"||\":return\"LOGIC\";case\"true\":case\"false\":return\"BOOL\";case\"break\":case\"continue\":return\"STATEMENT\";default:return h}}()),p=this.token(h,r,0,i),l&&(m=[l[2].first_line,l[2].first_column],p[2].first_line=m[0],p[2].first_column=m[1]),e&&(t=s.lastIndexOf(\":\"),this.token(\":\",\":\",t,e.length)),s.length)):0},e.prototype.numberToken=function(){var e,t,n,r,i;if(!(n=D.exec(this.chunk)))return 0;r=n[0],/^0[BOX]/.test(r)?this.error(\"radix prefix '\"+r+\"' must be lowercase\"):/E/.test(r)&&!/^0x/.test(r)?this.error(\"exponential notation '\"+r+\"' must be indicated with a lowercase 'e'\"):/^0\\d*[89]/.test(r)?this.error(\"decimal literal '\"+r+\"' must not be prefixed with '0'\"):/^0\\d+/.test(r)&&this.error(\"octal literal '\"+r+\"' must be prefixed with '0o'\"),t=r.length;if(i=/^0o([0-7]+)/.exec(r))r=\"0x\"+parseInt(i[1],8).toString(16);if(e=/^0b([01]+)/.exec(r))r=\"0x\"+parseInt(e[1],2).toString(16);return this.token(\"NUMBER\",r,0,t),t},e.prototype.stringToken=function(){var e,t,n,r;switch(t=this.chunk.charAt(0)){case\"'\":n=q.exec(this.chunk)[0];break;case'\"':n=this.balancedString(this.chunk,'\"')}return n?(r=this.removeNewlines(n.slice(1,-1)),t==='\"'&&0<n.indexOf(\"#{\",1)?this.interpolateString(r,{strOffset:1,lexedLength:n.length}):this.token(\"STRING\",t+this.escapeLines(r)+t,0,n.length),(e=/^(?:\\\\.|[^\\\\])*\\\\(?:0[0-7]|[1-7])/.test(n))&&this.error(\"octal escape sequences \"+n+\" are not allowed\"),n.length):0},e.prototype.heredocToken=function(){var e,t,n,r;return(n=p.exec(this.chunk))?(t=n[0],r=t.charAt(0),e=this.sanitizeHeredoc(n[2],{quote:r,indent:null}),r==='\"'&&0<=e.indexOf(\"#{\")?this.interpolateString(e,{heredoc:!0,strOffset:3,lexedLength:t.length}):this.token(\"STRING\",this.makeString(e,r,!0),0,t.length),t.length):0},e.prototype.commentToken=function(){var e,t,n;return(n=this.chunk.match(l))?(e=n[0],t=n[1],t&&this.token(\"HERECOMMENT\",this.sanitizeHeredoc(t,{herecomment:!0,indent:G(\" \",this.indent)}),0,e.length),e.length):0},e.prototype.jsToken=function(){var e,t;return this.chunk.charAt(0)!==\"`\"||!(e=E.exec(this.chunk))?0:(this.token(\"JS\",(t=e[0]).slice(1,-1),0,t.length),t.length)},e.prototype.regexToken=function(){var e,t,n,r,i,s,o;return this.chunk.charAt(0)!==\"/\"?0:(n=m.exec(this.chunk))?(t=this.heregexToken(n),t):(r=K(this.tokens),r&&(s=r[0],nt.call(r.spaced?M:_,s)>=0)?0:(n=H.exec(this.chunk))?(o=n,n=o[0],i=o[1],e=o[2],i.slice(0,2)===\"/*\"&&this.error(\"regular expressions cannot begin with `*`\"),i===\"//\"&&(i=\"/(?:)/\"),this.token(\"REGEX\",\"\"+i+e,0,n.length),n.length):0)},e.prototype.heregexToken=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m;i=e[0],t=e[1],n=e[2];if(0>t.indexOf(\"#{\"))return u=this.escapeLines(t.replace(g,\"$1$2\").replace(/\\//g,\"\\\\/\"),!0),u.match(/^\\*/)&&this.error(\"regular expressions cannot begin with `*`\"),this.token(\"REGEX\",\"/\"+(u||\"(?:)\")+\"/\"+n,0,i.length),i.length;this.token(\"IDENTIFIER\",\"RegExp\",0,0),this.token(\"CALL_START\",\"(\",0,0),l=[],d=this.interpolateString(t,{regex:!0});for(h=0,p=d.length;h<p;h++){f=d[h],a=f[0],c=f[1];if(a===\"TOKENS\")l.push.apply(l,c);else if(a===\"NEOSTRING\"){if(!(c=c.replace(g,\"$1$2\")))continue;c=c.replace(/\\\\/g,\"\\\\\\\\\"),f[0]=\"STRING\",f[1]=this.makeString(c,'\"',!0),l.push(f)}else this.error(\"Unexpected \"+a);o=K(this.tokens),s=[\"+\",\"+\"],s[2]=o[2],l.push(s)}return l.pop(),((v=l[0])!=null?v[0]:void 0)!==\"STRING\"&&(this.token(\"STRING\",'\"\"',0,0),this.token(\"+\",\"+\",0,0)),(m=this.tokens).push.apply(m,l),n&&(r=i.lastIndexOf(n),this.token(\",\",\",\",r,0),this.token(\"STRING\",'\"'+n+'\"',r,n.length)),this.token(\")\",\")\",i.length-1,0),i.length},e.prototype.lineToken=function(){var e,t,n,r,i;if(!(n=O.exec(this.chunk)))return 0;t=n[0],this.seenFor=!1,i=t.length-1-t.lastIndexOf(\"\\n\"),r=this.unfinished();if(i-this.indebt===this.indent)return r?this.suppressNewlines():this.newlineToken(0),t.length;if(i>this.indent){if(r)return this.indebt=i-this.indent,this.suppressNewlines(),t.length;if(!this.tokens.length)return this.baseIndent=this.indent=i,t.length;e=i-this.indent+this.outdebt,this.token(\"INDENT\",e,t.length-i,i),this.indents.push(e),this.ends.push(\"OUTDENT\"),this.outdebt=this.indebt=0}else i<this.baseIndent?this.error(\"missing indentation\",t.length):(this.indebt=0,this.outdentToken(this.indent-i,r,t.length));return this.indent=i,t.length},e.prototype.outdentToken=function(e,t,n){var r,i;while(e>0)i=this.indents.length-1,this.indents[i]===void 0?e=0:this.indents[i]===this.outdebt?(e-=this.outdebt,this.outdebt=0):this.indents[i]<this.outdebt?(this.outdebt-=this.indents[i],e-=this.indents[i]):(r=this.indents.pop()+this.outdebt,e-=r,this.outdebt=0,this.pair(\"OUTDENT\"),this.token(\"OUTDENT\",r,0,n));r&&(this.outdebt-=e);while(this.value()===\";\")this.tokens.pop();return this.tag()!==\"TERMINATOR\"&&!t&&this.token(\"TERMINATOR\",\"\\n\",n,0),this},e.prototype.whitespaceToken=function(){var e,t,n;return!(e=W.exec(this.chunk))&&!(t=this.chunk.charAt(0)===\"\\n\")?0:(n=K(this.tokens),n&&(n[e?\"spaced\":\"newLine\"]=!0),e?e[0].length:0)},e.prototype.newlineToken=function(e){while(this.value()===\";\")this.tokens.pop();return this.tag()!==\"TERMINATOR\"&&this.token(\"TERMINATOR\",\"\\n\",e,0),this},e.prototype.suppressNewlines=function(){return this.value()===\"\\\\\"&&this.tokens.pop(),this},e.prototype.literalToken=function(){var e,t,n,r,i,u,a,f;(e=P.exec(this.chunk))?(r=e[0],o.test(r)&&this.tagParameters()):r=this.chunk.charAt(0),n=r,t=K(this.tokens);if(r===\"=\"&&t){!t[1].reserved&&(i=t[1],nt.call(S,i)>=0)&&this.error('reserved word \"'+this.value()+\"\\\" can't be assigned\");if((u=t[1])===\"||\"||u===\"&&\")return t[0]=\"COMPOUND_ASSIGN\",t[1]+=\"=\",r.length}if(r===\";\")this.seenFor=!1,n=\"TERMINATOR\";else if(nt.call(L,r)>=0)n=\"MATH\";else if(nt.call(c,r)>=0)n=\"COMPARE\";else if(nt.call(h,r)>=0)n=\"COMPOUND_ASSIGN\";else if(nt.call(z,r)>=0)n=\"UNARY\";else if(nt.call(I,r)>=0)n=\"SHIFT\";else if(nt.call(C,r)>=0||r===\"?\"&&(t!=null?t.spaced:void 0))n=\"LOGIC\";else if(t&&!t.spaced)if(r===\"(\"&&(a=t[0],nt.call(s,a)>=0))t[0]===\"?\"&&(t[0]=\"FUNC_EXIST\"),n=\"CALL_START\";else if(r===\"[\"&&(f=t[0],nt.call(b,f)>=0)){n=\"INDEX_START\";switch(t[0]){case\"?\":t[0]=\"INDEX_SOAK\"}}switch(r){case\"(\":case\"{\":case\"[\":this.ends.push(w[r]);break;case\")\":case\"}\":case\"]\":this.pair(r)}return this.token(n,r),r.length},e.prototype.sanitizeHeredoc=function(e,t){var n,r,i,s,o;i=t.indent,r=t.herecomment;if(r){d.test(e)&&this.error('block comment cannot contain \"*/\", starting');if(e.indexOf(\"\\n\")<0)return e}else while(s=v.exec(e)){n=s[1];if(i===null||0<(o=n.length)&&o<i.length)i=n}return i&&(e=e.replace(RegExp(\"\\\\n\"+i,\"g\"),\"\\n\")),r||(e=e.replace(/^\\n/,\"\")),e},e.prototype.tagParameters=function(){var e,t,n,r;if(this.tag()!==\")\")return this;t=[],r=this.tokens,e=r.length,r[--e][0]=\"PARAM_END\";while(n=r[--e])switch(n[0]){case\")\":t.push(n);break;case\"(\":case\"CALL_START\":if(!t.length)return n[0]===\"(\"?(n[0]=\"PARAM_START\",this):this;t.pop()}return this},e.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},e.prototype.balancedString=function(e,t){var n,r,i,s,o,u,a,f;n=0,u=[t];for(r=a=1,f=e.length;1<=f?a<f:a>f;r=1<=f?++a:--a){if(n){--n;continue}switch(i=e.charAt(r)){case\"\\\\\":++n;continue;case t:u.pop();if(!u.length)return e.slice(0,+r+1||9e9);t=u[u.length-1];continue}t!==\"}\"||i!=='\"'&&i!==\"'\"?t===\"}\"&&i===\"/\"&&(s=m.exec(e.slice(r))||H.exec(e.slice(r)))?n+=s[0].length-1:t===\"}\"&&i===\"{\"?u.push(t=\"}\"):t==='\"'&&o===\"#\"&&i===\"{\"&&u.push(t=\"}\"):u.push(t=i),o=i}return this.error(\"missing \"+u.pop()+\", starting\")},e.prototype.interpolateString=function(t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O;n==null&&(n={}),s=n.heredoc,b=n.regex,v=n.offsetInChunk,E=n.strOffset,c=n.lexedLength,v=v||0,E=E||0,c=c||t.length,T=[],m=0,o=-1;while(l=t.charAt(o+=1)){if(l===\"\\\\\"){o+=1;continue}if(l!==\"#\"||t.charAt(o+1)!==\"{\"||!(i=this.balancedString(t.slice(o+1),\"}\")))continue;m<o&&T.push(this.makeToken(\"NEOSTRING\",t.slice(m,o),E+m)),u=i.slice(1,-1);if(u.length){L=this.getLineAndColumnFromChunk(E+o+1),h=L[0],r=L[1],d=(new e).tokenize(u,{line:h,column:r,rewrite:!1}),y=d.pop(),((A=d[0])!=null?A[0]:void 0)===\"TERMINATOR\"&&(y=d.shift());if(f=d.length)f>1&&(d.unshift(this.makeToken(\"(\",\"(\",E+o+1,0)),d.push(this.makeToken(\")\",\")\",E+o+1+u.length,0))),T.push([\"TOKENS\",d])}o+=i.length,m=o+1}o>m&&m<t.length&&T.push(this.makeToken(\"NEOSTRING\",t.slice(m),E+m));if(b)return T;if(!T.length)return this.token(\"STRING\",'\"\"',v,c);T[0][0]!==\"NEOSTRING\"&&T.unshift(this.makeToken(\"NEOSTRING\",\"\",v)),(a=T.length>1)&&this.token(\"(\",\"(\",v,0);for(o=C=0,k=T.length;C<k;o=++C)x=T[o],S=x[0],N=x[1],o&&(o&&(g=this.token(\"+\",\"+\")),p=S===\"TOKENS\"?N[0]:x,g[2]={first_line:p[2].first_line,first_column:p[2].first_column,last_line:p[2].first_line,last_column:p[2].first_column}),S===\"TOKENS\"?(O=this.tokens).push.apply(O,N):S===\"NEOSTRING\"?(x[0]=\"STRING\",x[1]=this.makeString(N,'\"',s),this.tokens.push(x)):this.error(\"Unexpected \"+S);return a&&(w=this.makeToken(\")\",\")\",v+c,0),w.stringEnd=!0,this.tokens.push(w)),T},e.prototype.pair=function(e){var t,n;return e!==(n=K(this.ends))?(\"OUTDENT\"!==n&&this.error(\"unmatched \"+e),this.indent-=t=K(this.indents),this.outdentToken(t,!0),this.pair(e)):this.ends.pop()},e.prototype.getLineAndColumnFromChunk=function(e){var t,n,r,i;return e===0?[this.chunkLine,this.chunkColumn]:(e>=this.chunk.length?i=this.chunk:i=this.chunk.slice(0,+(e-1)+1||9e9),n=V(i,\"\\n\"),t=this.chunkColumn,n>0?(r=i.split(\"\\n\"),t=K(r).length):t+=i.length,[this.chunkLine+n,t])},e.prototype.makeToken=function(e,t,n,r){var i,s,o,u,a;return n==null&&(n=0),r==null&&(r=t.length),s={},u=this.getLineAndColumnFromChunk(n),s.first_line=u[0],s.first_column=u[1],i=Math.max(0,r-1),a=this.getLineAndColumnFromChunk(n+i),s.last_line=a[0],s.last_column=a[1],o=[e,t,s],o},e.prototype.token=function(e,t,n,r){var i;return i=this.makeToken(e,t,n,r),this.tokens.push(i),i},e.prototype.tag=function(e,t){var n;return(n=K(this.tokens,e))&&(t?n[0]=t:n[0])},e.prototype.value=function(e,t){var n;return(n=K(this.tokens,e))&&(t?n[1]=t:n[1])},e.prototype.unfinished=function(){var e;return N.test(this.chunk)||(e=this.tag())===\"\\\\\"||e===\".\"||e===\"?.\"||e===\"?::\"||e===\"UNARY\"||e===\"MATH\"||e===\"+\"||e===\"-\"||e===\"SHIFT\"||e===\"RELATION\"||e===\"COMPARE\"||e===\"LOGIC\"||e===\"THROW\"||e===\"EXTENDS\"},e.prototype.removeNewlines=function(e){return e.replace(/^\\s*\\n\\s*/,\"\").replace(/([^\\\\]|\\\\\\\\)\\s*\\n\\s*$/,\"$1\")},e.prototype.escapeLines=function(e,t){return e=e.replace(/\\\\[^\\S\\n]*(\\n|\\\\)\\s*/g,function(e,t){return t===\"\\n\"?\"\":e}),t?e.replace(A,\"\\\\n\"):e.replace(/\\s*\\n\\s*/g,\" \")},e.prototype.makeString=function(e,t,n){return e?(e=e.replace(RegExp(\"\\\\\\\\(\"+t+\"|\\\\\\\\)\",\"g\"),function(e,n){return n===t?n:e}),e=e.replace(RegExp(\"\"+t,\"g\"),\"\\\\$&\"),t+this.escapeLines(e,n)+t):t+t},e.prototype.error=function(e,t){var n,r,i;return t==null&&(t=0),i=this.getLineAndColumnFromChunk(t),r=i[0],n=i[1],Z(e,{first_line:r,first_column:n})},e}(),x=[\"true\",\"false\",\"null\",\"this\",\"new\",\"delete\",\"typeof\",\"in\",\"instanceof\",\"return\",\"throw\",\"break\",\"continue\",\"debugger\",\"if\",\"else\",\"switch\",\"for\",\"while\",\"do\",\"try\",\"catch\",\"finally\",\"class\",\"extends\",\"super\"],f=[\"undefined\",\"then\",\"unless\",\"until\",\"loop\",\"of\",\"by\",\"when\"],a={and:\"&&\",or:\"||\",is:\"==\",isnt:\"!=\",not:\"!\",yes:\"true\",no:\"false\",on:\"true\",off:\"false\"},u=function(){var e;e=[];for(J in a)e.push(J);return e}(),f=f.concat(u),j=[\"case\",\"default\",\"function\",\"var\",\"void\",\"with\",\"const\",\"let\",\"enum\",\"export\",\"import\",\"native\",\"__hasProp\",\"__extends\",\"__slice\",\"__bind\",\"__indexOf\",\"implements\",\"interface\",\"package\",\"private\",\"protected\",\"public\",\"static\",\"yield\"],R=[\"arguments\",\"eval\"],S=x.concat(j).concat(R),t.RESERVED=j.concat(x).concat(f).concat(R),t.STRICT_PROSCRIBED=R,r=65279,y=/^([$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*)([^\\n\\S]*:(?!:))?/,D=/^0b[01]+|^0o[0-7]+|^0x[\\da-f]+|^\\d*\\.?\\d+(?:e[+-]?\\d+)?/i,p=/^(\"\"\"|''')((?:\\\\[\\s\\S]|[^\\\\])*?)(?:\\n[^\\n\\S]*)?\\1/,P=/^(?:[-=]>|[-+*\\/%<>&|^!?=]=|>>>=?|([-+:])\\1|([&|<>])\\2=?|\\?(\\.|::)|\\.{2,3})/,W=/^[^\\n\\S]+/,l=/^###([^#][\\s\\S]*?)(?:###[^\\n\\S]*|###$)|^(?:\\s*#(?!##[^#]).*)+/,o=/^[-=]>/,O=/^(?:\\n[^\\n\\S]*)+/,q=/^'[^\\\\']*(?:\\\\[\\s\\S][^\\\\']*)*'/,E=/^`[^\\\\`]*(?:\\\\.[^\\\\`]*)*`/,H=/^(\\/(?![\\s=])[^[\\/\\n\\\\]*(?:(?:\\\\[\\s\\S]|\\[[^\\]\\n\\\\]*(?:\\\\[\\s\\S][^\\]\\n\\\\]*)*])[^[\\/\\n\\\\]*)*\\/)([imgy]{0,4})(?!\\w)/,m=/^\\/{3}((?:\\\\?[\\s\\S])+?)\\/{3}([imgy]{0,4})(?!\\w)/,g=/((?:\\\\\\\\)+)|\\\\(\\s|\\/)|\\s+(?:#.*)?/g,A=/\\n/g,v=/\\n+([^\\n\\S]*)/g,d=/\\*\\//,N=/^\\s*(?:,|\\??\\.(?![.\\d])|::)/,U=/\\s+$/,h=[\"-=\",\"+=\",\"/=\",\"*=\",\"%=\",\"||=\",\"&&=\",\"?=\",\"<<=\",\">>=\",\">>>=\",\"&=\",\"^=\",\"|=\"],z=[\"!\",\"~\",\"NEW\",\"TYPEOF\",\"DELETE\",\"DO\"],C=[\"&&\",\"||\",\"&\",\"|\",\"^\"],I=[\"<<\",\">>\",\">>>\"],c=[\"==\",\"!=\",\"<\",\">\",\"<=\",\">=\"],L=[\"*\",\"/\",\"%\"],B=[\"IN\",\"OF\",\"INSTANCEOF\"],i=[\"TRUE\",\"FALSE\"],M=[\"NUMBER\",\"REGEX\",\"BOOL\",\"NULL\",\"UNDEFINED\",\"++\",\"--\"],_=M.concat(\")\",\"}\",\"THIS\",\"IDENTIFIER\",\"STRING\",\"]\"),s=[\"IDENTIFIER\",\"STRING\",\"REGEX\",\")\",\"]\",\"}\",\"?\",\"::\",\"@\",\"THIS\",\"SUPER\"],b=s.concat(\"NUMBER\",\"BOOL\",\"NULL\",\"UNDEFINED\"),T=[\"INDENT\",\"OUTDENT\",\"TERMINATOR\"]}),define(\"ace/mode/coffee/rewriter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},x=[].slice;m=function(e,t){var n;return n=[e,t],n.generated=!0,n},t.Rewriter=function(){function e(){}return e.prototype.rewrite=function(e){return this.tokens=e,this.removeLeadingNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.normalizeLines(),this.tagPostfixConditionals(),this.addImplicitBracesAndParens(),this.addLocationDataToGeneratedTokens(),this.tokens},e.prototype.scanTokens=function(e){var t,n,r;r=this.tokens,t=0;while(n=r[t])t+=e.call(this,n,t,r);return!0},e.prototype.detectEnd=function(e,t,n){var r,i,s,a,f;s=this.tokens,r=0;while(i=s[e]){if(r===0&&t.call(this,i,e))return n.call(this,i,e);if(!i||r<0)return n.call(this,i,e-1);if(a=i[0],S.call(u,a)>=0)r+=1;else if(f=i[0],S.call(o,f)>=0)r-=1;e+=1}return e-1},e.prototype.removeLeadingNewlines=function(){var e,t,n,r,i;i=this.tokens;for(e=n=0,r=i.length;n<r;e=++n){t=i[e][0];if(t!==\"TERMINATOR\")break}if(e)return this.tokens.splice(0,e)},e.prototype.closeOpenCalls=function(){var e,t;return t=function(e,t){var n;return(n=e[0])===\")\"||n===\"CALL_END\"||e[0]===\"OUTDENT\"&&this.tag(t-1)===\")\"},e=function(e,t){return this.tokens[e[0]===\"OUTDENT\"?t-1:t][0]=\"CALL_END\"},this.scanTokens(function(n,r){return n[0]===\"CALL_START\"&&this.detectEnd(r+1,t,e),1})},e.prototype.closeOpenIndexes=function(){var e,t;return t=function(e,t){var n;return(n=e[0])===\"]\"||n===\"INDEX_END\"},e=function(e,t){return e[0]=\"INDEX_END\"},this.scanTokens(function(n,r){return n[0]===\"INDEX_START\"&&this.detectEnd(r+1,t,e),1})},e.prototype.matchTags=function(){var e,t,n,r,i,s,o;t=arguments[0],r=2<=arguments.length?x.call(arguments,1):[],e=0;for(n=i=0,s=r.length;0<=s?i<s:i>s;n=0<=s?++i:--i){while(this.tag(t+n+e)===\"HERECOMMENT\")e+=2;if(r[n]==null)continue;typeof r[n]==\"string\"&&(r[n]=[r[n]]);if(o=this.tag(t+n+e),S.call(r[n],o)<0)return!1}return!0},e.prototype.looksObjectish=function(e){return this.matchTags(e,\"@\",null,\":\")||this.matchTags(e,null,\":\")},e.prototype.findTagsBackwards=function(e,t){var n,r,i,s,a,f,l;n=[];while(e>=0&&(n.length||(s=this.tag(e),S.call(t,s)<0)&&((a=this.tag(e),S.call(u,a)<0)||this.tokens[e].generated)&&(f=this.tag(e),S.call(p,f)<0)))(r=this.tag(e),S.call(o,r)>=0)&&n.push(this.tag(e)),(i=this.tag(e),S.call(u,i)>=0)&&n.length&&n.pop(),e-=1;return l=this.tag(e),S.call(t,l)>=0},e.prototype.addImplicitBracesAndParens=function(){var e;return e=[],this.scanTokens(function(t,n,r){var s,h,d,v,g,y,b,w,E,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R;H=t[0],T=(N=n>0?r[n-1]:[])[0],E=(n<r.length-1?r[n+1]:[])[0],O=function(){return e[e.length-1]},M=n,v=function(e){return n-M+e},g=function(){var e,t;return(e=O())!=null?(t=e[2])!=null?t.ours:void 0:void 0},y=function(){var e;return g()&&((e=O())!=null?e[0]:void 0)===\"(\"},w=function(){var e;return g()&&((e=O())!=null?e[0]:void 0)===\"{\"},b=function(){var e;return g&&((e=O())!=null?e[0]:void 0)===\"CONTROL\"},_=function(t){var i;i=t!=null?t:n,e.push([\"(\",i,{ours:!0}]),r.splice(i,0,m(\"CALL_START\",\"(\"));if(t==null)return n+=1},h=function(){return e.pop(),r.splice(n,0,m(\"CALL_END\",\")\")),n+=1},s=function(){while(y())h()},D=function(t,i){var s;i==null&&(i=!0),s=t!=null?t:n,e.push([\"{\",s,{sameLine:!0,startsLine:i,ours:!0}]),r.splice(s,0,m(\"{\",m(new String(\"{\"))));if(t==null)return n+=1},d=function(t){return t=t!=null?t:n,e.pop(),r.splice(t,0,m(\"}\",\"}\")),n+=1};if(!y()||H!==\"IF\"&&H!==\"TRY\"&&H!==\"FINALLY\"&&H!==\"CATCH\"&&H!==\"CLASS\"&&H!==\"SWITCH\"){if(H===\"INDENT\"&&g()){if(T!==\"=>\"&&T!==\"->\"&&T!==\"[\"&&T!==\"(\"&&T!==\",\"&&T!==\"{\"&&T!==\"TRY\"&&T!==\"ELSE\"&&T!==\"=\")while(y())h();return b()&&e.pop(),e.push([H,n]),v(1)}if(S.call(u,H)>=0)return e.push([H,n]),v(1);if(S.call(o,H)>=0){while(g())y()?h():w()?d():e.pop();e.pop()}if((S.call(l,H)>=0&&t.spaced&&!t.stringEnd||H===\"?\"&&n>0&&!r[n-1].spaced)&&(S.call(a,E)>=0||S.call(c,E)>=0&&((B=r[n+1])!=null?!B.spaced:!void 0)&&((j=r[n+1])!=null?!j.newLine:!void 0)))return H===\"?\"&&(H=t[0]=\"FUNC_EXIST\"),_(n+1),v(2);if(S.call(l,H)>=0&&this.matchTags(n+1,\"INDENT\",null,\":\")&&!this.findTagsBackwards(n,[\"CLASS\",\"EXTENDS\",\"IF\",\"CATCH\",\"SWITCH\",\"LEADING_WHEN\",\"FOR\",\"WHILE\",\"UNTIL\"]))return _(n+1),e.push([\"INDENT\",n+2]),v(3);if(H===\":\"){this.tag(n-2)===\"@\"?C=n-2:C=n-1;while(this.tag(C-2)===\"HERECOMMENT\")C-=2;P=C===0||(F=this.tag(C-1),S.call(p,F)>=0)||r[C-1].newLine;if(O()){I=O(),A=I[0],L=I[1];if((A===\"{\"||A===\"INDENT\"&&this.tag(L-1)===\"{\")&&(P||this.tag(C-1)===\",\"||this.tag(C-1)===\"{\"))return v(1)}return D(C,!!P),v(2)}if(y()&&S.call(i,H)>=0){if(T===\"OUTDENT\")return h(),v(1);if(N.newLine)return s(),v(1)}w()&&S.call(p,H)>=0&&(O()[2].sameLine=!1);if(S.call(f,H)>=0)while(g()){q=O(),A=q[0],L=q[1],R=q[2],k=R.sameLine,P=R.startsLine;if(y()&&T!==\",\")h();else if(w()&&k&&!P)d();else{if(!w()||H!==\"TERMINATOR\"||T===\",\"||!!P&&!!this.looksObjectish(n+1))break;d()}}if(H===\",\"&&!this.looksObjectish(n+1)&&w()&&(E!==\"TERMINATOR\"||!this.looksObjectish(n+2))){x=E===\"OUTDENT\"?1:0;while(w())d(n+x)}return v(1)}return e.push([\"CONTROL\",n,{ours:!0}]),v(1)})},e.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(e,t,n){var r,i,s,o,u,a;return e[2]?1:!e.generated&&!e.explicit?1:(e[0]===\"{\"&&(s=(u=n[t+1])!=null?u[2]:void 0)?(i=s.first_line,r=s.first_column):(o=(a=n[t-1])!=null?a[2]:void 0)?(i=o.last_line,r=o.last_column):i=r=0,e[2]={first_line:i,first_column:r,last_line:i,last_column:r},1)})},e.prototype.normalizeLines=function(){var e,t,n,r,o;return o=n=r=null,t=function(e,t){var n,r,u,a;return e[1]!==\";\"&&(n=e[0],S.call(d,n)>=0)&&!(e[0]===\"TERMINATOR\"&&(r=this.tag(t+1),S.call(s,r)>=0))&&(e[0]!==\"ELSE\"||o===\"THEN\")&&((u=e[0])!==\"CATCH\"&&u!==\"FINALLY\"||o!==\"->\"&&o!==\"=>\")||(a=e[0],S.call(i,a)>=0)&&this.tokens[t-1].newLine},e=function(e,t){return this.tokens.splice(this.tag(t-1)===\",\"?t-1:t,0,r)},this.scanTokens(function(i,u,a){var f,l,c,h,p,d;l=i[0];if(l===\"TERMINATOR\"){if(this.tag(u+1)===\"ELSE\"&&this.tag(u-1)!==\"OUTDENT\")return a.splice.apply(a,[u,1].concat(x.call(this.indentation()))),1;if(h=this.tag(u+1),S.call(s,h)>=0)return a.splice(u,1),0}if(l===\"CATCH\")for(f=c=1;c<=2;f=++c){if((p=this.tag(u+f))!==\"OUTDENT\"&&p!==\"TERMINATOR\"&&p!==\"FINALLY\")continue;return a.splice.apply(a,[u+f,0].concat(x.call(this.indentation()))),2+f}return S.call(v,l)>=0&&this.tag(u+1)!==\"INDENT\"&&(l!==\"ELSE\"||this.tag(u+1)!==\"IF\")?(o=l,d=this.indentation(!0),n=d[0],r=d[1],o===\"THEN\"&&(n.fromThen=!0),a.splice(u+1,0,n),this.detectEnd(u+2,t,e),l===\"THEN\"&&a.splice(u,1),1):1})},e.prototype.tagPostfixConditionals=function(){var e,t,n;return n=null,t=function(e,t){var n,r;return r=e[0],n=this.tokens[t-1][0],r===\"TERMINATOR\"||r===\"INDENT\"&&S.call(v,n)<0},e=function(e,t){if(e[0]!==\"INDENT\"||e.generated&&!e.fromThen)return n[0]=\"POST_\"+n[0]},this.scanTokens(function(r,i){return r[0]!==\"IF\"?1:(n=r,this.detectEnd(i+1,t,e),1)})},e.prototype.indentation=function(e){var t,n;return e==null&&(e=!1),t=[\"INDENT\",2],n=[\"OUTDENT\",2],e&&(t.generated=n.generated=!0),e||(t.explicit=n.explicit=!0),[t,n]},e.prototype.generate=m,e.prototype.tag=function(e){var t;return(t=this.tokens[e])!=null?t[0]:void 0},e}(),r=[[\"(\",\")\"],[\"[\",\"]\"],[\"{\",\"}\"],[\"INDENT\",\"OUTDENT\"],[\"CALL_START\",\"CALL_END\"],[\"PARAM_START\",\"PARAM_END\"],[\"INDEX_START\",\"INDEX_END\"]],t.INVERSES=h={},u=[],o=[];for(b=0,w=r.length;b<w;b++)E=r[b],g=E[0],y=E[1],u.push(h[y]=g),o.push(h[g]=y);s=[\"CATCH\",\"THEN\",\"ELSE\",\"FINALLY\"].concat(o),l=[\"IDENTIFIER\",\"SUPER\",\")\",\"CALL_END\",\"]\",\"INDEX_END\",\"@\",\"THIS\"],a=[\"IDENTIFIER\",\"NUMBER\",\"STRING\",\"JS\",\"REGEX\",\"NEW\",\"PARAM_START\",\"CLASS\",\"IF\",\"TRY\",\"SWITCH\",\"THIS\",\"BOOL\",\"NULL\",\"UNDEFINED\",\"UNARY\",\"SUPER\",\"THROW\",\"@\",\"->\",\"=>\",\"[\",\"(\",\"{\",\"--\",\"++\"],c=[\"+\",\"-\"],f=[\"POST_IF\",\"FOR\",\"WHILE\",\"UNTIL\",\"WHEN\",\"BY\",\"LOOP\",\"TERMINATOR\"],v=[\"ELSE\",\"->\",\"=>\",\"TRY\",\"FINALLY\",\"THEN\"],d=[\"TERMINATOR\",\"CATCH\",\"FINALLY\",\"ELSE\",\"OUTDENT\",\"LEADING_WHEN\"],p=[\"TERMINATOR\",\"INDENT\",\"OUTDENT\"],i=[\".\",\"?.\",\"::\",\"?::\"]}),define(\"ace/mode/coffee/helpers\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r,i,s,o,u,a,f;t.starts=function(e,t,n){return t===e.substr(n,t.length)},t.ends=function(e,t,n){var r;return r=t.length,t===e.substr(e.length-r-(n||0),r)},t.repeat=u=function(e,t){var n;n=\"\";while(t>0)t&1&&(n+=e),t>>>=1,e+=e;return n},t.compact=function(e){var t,n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],t&&i.push(t);return i},t.count=function(e,t){var n,r;n=r=0;if(!t.length)return 1/0;while(r=1+e.indexOf(t,r))n++;return n},t.merge=function(e,t){return i(i({},e),t)},i=t.extend=function(e,t){var n,r;for(n in t)r=t[n],e[n]=r;return e},t.flatten=s=function(e){var t,n,r,i;n=[];for(r=0,i=e.length;r<i;r++)t=e[r],t instanceof Array?n=n.concat(s(t)):n.push(t);return n},t.del=function(e,t){var n;return n=e[t],delete e[t],n},t.last=o=function(e,t){return e[e.length-(t||0)-1]},t.some=(f=Array.prototype.some)!=null?f:function(e){var t,n,r;for(n=0,r=this.length;n<r;n++){t=this[n];if(e(t))return!0}return!1},t.invertLiterate=function(e){var t,n,r;return r=!0,n=function(){var n,i,s,o;s=e.split(\"\\n\"),o=[];for(n=0,i=s.length;n<i;n++)t=s[n],r&&/^([ ]{4}|[ ]{0,3}\\t)/.test(t)?o.push(t):(r=/^\\s*$/.test(t))?o.push(t):o.push(\"# \"+t);return o}(),n.join(\"\\n\")},r=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},t.addLocationDataFn=function(e,t){return function(n){return typeof n==\"object\"&&!!n.updateLocationDataIfMissing&&n.updateLocationDataIfMissing(r(e,t)),n}},t.locationDataToString=function(e){var t;return\"2\"in e&&\"first_line\"in e[2]?t=e[2]:\"first_line\"in e&&(t=e),t?\"\"+(t.first_line+1)+\":\"+(t.first_column+1)+\"-\"+(\"\"+(t.last_line+1)+\":\"+(t.last_column+1)):\"No location data\"},t.baseFileName=function(e,t,n){var r,i;return t==null&&(t=!1),n==null&&(n=!1),i=n?/\\\\|\\//:/\\//,r=e.split(i),e=r[r.length-1],t&&e.indexOf(\".\")>=0?(r=e.split(\".\"),r.pop(),r[r.length-1]===\"coffee\"&&r.length>1&&r.pop(),r.join(\".\")):e},t.isCoffee=function(e){return/\\.((lit)?coffee|coffee\\.md)$/.test(e)},t.isLiterate=function(e){return/\\.(litcoffee|coffee\\.md)$/.test(e)},t.throwSyntaxError=function(e,t){var n;throw t.last_line==null&&(t.last_line=t.first_line),t.last_column==null&&(t.last_column=t.first_column),n=new SyntaxError(e),n.location=t,n.toString=a,n.stack=n.toString(),n},t.updateSyntaxError=function(e,t,n){return e.toString===a&&(e.code||(e.code=t),e.filename||(e.filename=n),e.stack=e.toString()),e},a=function(){var e,t,n,r,i,s,o,a,f,l,c,h,p;if(!this.code||!this.location)return Error.prototype.toString.call(this);h=this.location,o=h.first_line,s=h.first_column,f=h.last_line,a=h.last_column,f==null&&(f=o),a==null&&(a=s),i=this.filename||\"[stdin]\",e=this.code.split(\"\\n\")[o],c=s,r=o===f?a+1:e.length,l=u(\" \",c)+u(\"^\",r-c),typeof process!=\"undefined\"&&process!==null&&(n=process.stdout.isTTY&&!process.env.NODE_DISABLE_COLORS);if((p=this.colorful)!=null?p:n)t=function(e){return\"\u001b[1;31m\"+e+\"\u001b[0m\"},e=e.slice(0,c)+t(e.slice(c,r))+e.slice(r),l=t(l);return\"\"+i+\":\"+(o+1)+\":\"+(s+1)+\": error: \"+this.message+\"\\n\"+e+\"\\n\"+l}}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/mode/coffee/parser\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){this.yy={}}var i={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Line:5,TERMINATOR:6,Expression:7,Statement:8,Return:9,Comment:10,STATEMENT:11,Value:12,Invocation:13,Code:14,Operation:15,Assign:16,If:17,Try:18,While:19,For:20,Switch:21,Class:22,Throw:23,Block:24,INDENT:25,OUTDENT:26,Identifier:27,IDENTIFIER:28,AlphaNumeric:29,NUMBER:30,STRING:31,Literal:32,JS:33,REGEX:34,DEBUGGER:35,UNDEFINED:36,NULL:37,BOOL:38,Assignable:39,\"=\":40,AssignObj:41,ObjAssignable:42,\":\":43,ThisProperty:44,RETURN:45,HERECOMMENT:46,PARAM_START:47,ParamList:48,PARAM_END:49,FuncGlyph:50,\"->\":51,\"=>\":52,OptComma:53,\",\":54,Param:55,ParamVar:56,\"...\":57,Array:58,Object:59,Splat:60,SimpleAssignable:61,Accessor:62,Parenthetical:63,Range:64,This:65,\".\":66,\"?.\":67,\"::\":68,\"?::\":69,Index:70,INDEX_START:71,IndexValue:72,INDEX_END:73,INDEX_SOAK:74,Slice:75,\"{\":76,AssignList:77,\"}\":78,CLASS:79,EXTENDS:80,OptFuncExist:81,Arguments:82,SUPER:83,FUNC_EXIST:84,CALL_START:85,CALL_END:86,ArgList:87,THIS:88,\"@\":89,\"[\":90,\"]\":91,RangeDots:92,\"..\":93,Arg:94,SimpleArgs:95,TRY:96,Catch:97,FINALLY:98,CATCH:99,THROW:100,\"(\":101,\")\":102,WhileSource:103,WHILE:104,WHEN:105,UNTIL:106,Loop:107,LOOP:108,ForBody:109,FOR:110,ForStart:111,ForSource:112,ForVariables:113,OWN:114,ForValue:115,FORIN:116,FOROF:117,BY:118,SWITCH:119,Whens:120,ELSE:121,When:122,LEADING_WHEN:123,IfBlock:124,IF:125,POST_IF:126,UNARY:127,\"-\":128,\"+\":129,\"--\":130,\"++\":131,\"?\":132,MATH:133,SHIFT:134,COMPARE:135,LOGIC:136,RELATION:137,COMPOUND_ASSIGN:138,$accept:0,$end:1},terminals_:{2:\"error\",6:\"TERMINATOR\",11:\"STATEMENT\",25:\"INDENT\",26:\"OUTDENT\",28:\"IDENTIFIER\",30:\"NUMBER\",31:\"STRING\",33:\"JS\",34:\"REGEX\",35:\"DEBUGGER\",36:\"UNDEFINED\",37:\"NULL\",38:\"BOOL\",40:\"=\",43:\":\",45:\"RETURN\",46:\"HERECOMMENT\",47:\"PARAM_START\",49:\"PARAM_END\",51:\"->\",52:\"=>\",54:\",\",57:\"...\",66:\".\",67:\"?.\",68:\"::\",69:\"?::\",71:\"INDEX_START\",73:\"INDEX_END\",74:\"INDEX_SOAK\",76:\"{\",78:\"}\",79:\"CLASS\",80:\"EXTENDS\",83:\"SUPER\",84:\"FUNC_EXIST\",85:\"CALL_START\",86:\"CALL_END\",88:\"THIS\",89:\"@\",90:\"[\",91:\"]\",93:\"..\",96:\"TRY\",98:\"FINALLY\",99:\"CATCH\",100:\"THROW\",101:\"(\",102:\")\",104:\"WHILE\",105:\"WHEN\",106:\"UNTIL\",108:\"LOOP\",110:\"FOR\",114:\"OWN\",116:\"FORIN\",117:\"FOROF\",118:\"BY\",119:\"SWITCH\",121:\"ELSE\",123:\"LEADING_WHEN\",125:\"IF\",126:\"POST_IF\",127:\"UNARY\",128:\"-\",129:\"+\",130:\"--\",131:\"++\",132:\"?\",133:\"MATH\",134:\"SHIFT\",135:\"COMPARE\",136:\"LOGIC\",137:\"RELATION\",138:\"COMPOUND_ASSIGN\"},productions_:[0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[32,1],[16,3],[16,4],[16,5],[41,1],[41,3],[41,5],[41,1],[42,1],[42,1],[42,1],[9,2],[9,1],[10,1],[14,5],[14,2],[50,1],[50,1],[53,0],[53,1],[48,0],[48,1],[48,3],[48,4],[48,6],[55,1],[55,2],[55,3],[56,1],[56,1],[56,1],[56,1],[60,2],[61,1],[61,2],[61,2],[61,1],[39,1],[39,1],[39,1],[12,1],[12,1],[12,1],[12,1],[12,1],[62,2],[62,2],[62,2],[62,2],[62,1],[62,1],[70,3],[70,2],[72,1],[72,1],[59,4],[77,0],[77,1],[77,3],[77,4],[77,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[81,0],[81,1],[82,2],[82,4],[65,1],[65,1],[44,2],[58,2],[58,4],[92,1],[92,1],[64,5],[75,3],[75,2],[75,2],[75,1],[87,1],[87,3],[87,4],[87,4],[87,6],[94,1],[94,1],[95,1],[95,3],[18,2],[18,3],[18,4],[18,5],[97,3],[97,3],[97,2],[23,2],[63,3],[63,5],[103,2],[103,4],[103,2],[103,4],[19,2],[19,2],[19,2],[19,1],[107,2],[107,2],[20,2],[20,2],[20,2],[109,2],[109,2],[111,2],[111,3],[115,1],[115,1],[115,1],[115,1],[113,1],[113,3],[112,2],[112,2],[112,4],[112,4],[112,4],[112,6],[112,6],[21,5],[21,7],[21,4],[21,6],[120,1],[120,2],[122,3],[122,4],[124,3],[124,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]],performAction:function(e,t,n,r,i,s,o){var u=s.length-1;switch(i){case 1:return this.$=r.addLocationDataFn(o[u],o[u])(new r.Block);case 2:return this.$=s[u];case 3:this.$=r.addLocationDataFn(o[u],o[u])(r.Block.wrap([s[u]]));break;case 4:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-2].push(s[u]));break;case 5:this.$=s[u-1];break;case 6:this.$=s[u];break;case 7:this.$=s[u];break;case 8:this.$=s[u];break;case 9:this.$=s[u];break;case 10:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 11:this.$=s[u];break;case 12:this.$=s[u];break;case 13:this.$=s[u];break;case 14:this.$=s[u];break;case 15:this.$=s[u];break;case 16:this.$=s[u];break;case 17:this.$=s[u];break;case 18:this.$=s[u];break;case 19:this.$=s[u];break;case 20:this.$=s[u];break;case 21:this.$=s[u];break;case 22:this.$=s[u];break;case 23:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Block);break;case 24:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-1]);break;case 25:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 26:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 27:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 28:this.$=s[u];break;case 29:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 30:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 31:this.$=r.addLocationDataFn(o[u],o[u])(new r.Literal(s[u]));break;case 32:this.$=r.addLocationDataFn(o[u],o[u])(new r.Undefined);break;case 33:this.$=r.addLocationDataFn(o[u],o[u])(new r.Null);break;case 34:this.$=r.addLocationDataFn(o[u],o[u])(new r.Bool(s[u]));break;case 35:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Assign(s[u-2],s[u]));break;case 36:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Assign(s[u-3],s[u]));break;case 37:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Assign(s[u-4],s[u-1]));break;case 38:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 39:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Assign(r.addLocationDataFn(o[u-2])(new r.Value(s[u-2])),s[u],\"object\"));break;case 40:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Assign(r.addLocationDataFn(o[u-4])(new r.Value(s[u-4])),s[u-1],\"object\"));break;case 41:this.$=s[u];break;case 42:this.$=s[u];break;case 43:this.$=s[u];break;case 44:this.$=s[u];break;case 45:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Return(s[u]));break;case 46:this.$=r.addLocationDataFn(o[u],o[u])(new r.Return);break;case 47:this.$=r.addLocationDataFn(o[u],o[u])(new r.Comment(s[u]));break;case 48:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Code(s[u-3],s[u],s[u-1]));break;case 49:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Code([],s[u],s[u-1]));break;case 50:this.$=r.addLocationDataFn(o[u],o[u])(\"func\");break;case 51:this.$=r.addLocationDataFn(o[u],o[u])(\"boundfunc\");break;case 52:this.$=s[u];break;case 53:this.$=s[u];break;case 54:this.$=r.addLocationDataFn(o[u],o[u])([]);break;case 55:this.$=r.addLocationDataFn(o[u],o[u])([s[u]]);break;case 56:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-2].concat(s[u]));break;case 57:this.$=r.addLocationDataFn(o[u-3],o[u])(s[u-3].concat(s[u]));break;case 58:this.$=r.addLocationDataFn(o[u-5],o[u])(s[u-5].concat(s[u-2]));break;case 59:this.$=r.addLocationDataFn(o[u],o[u])(new r.Param(s[u]));break;case 60:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Param(s[u-1],null,!0));break;case 61:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Param(s[u-2],s[u]));break;case 62:this.$=s[u];break;case 63:this.$=s[u];break;case 64:this.$=s[u];break;case 65:this.$=s[u];break;case 66:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Splat(s[u-1]));break;case 67:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 68:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u-1].add(s[u]));break;case 69:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Value(s[u-1],[].concat(s[u])));break;case 70:this.$=s[u];break;case 71:this.$=s[u];break;case 72:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 73:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 74:this.$=s[u];break;case 75:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 76:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 77:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 78:this.$=s[u];break;case 79:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Access(s[u]));break;case 80:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Access(s[u],\"soak\"));break;case 81:this.$=r.addLocationDataFn(o[u-1],o[u])([r.addLocationDataFn(o[u-1])(new r.Access(new r.Literal(\"prototype\"))),r.addLocationDataFn(o[u])(new r.Access(s[u]))]);break;case 82:this.$=r.addLocationDataFn(o[u-1],o[u])([r.addLocationDataFn(o[u-1])(new r.Access(new r.Literal(\"prototype\"),\"soak\")),r.addLocationDataFn(o[u])(new r.Access(s[u]))]);break;case 83:this.$=r.addLocationDataFn(o[u],o[u])(new r.Access(new r.Literal(\"prototype\")));break;case 84:this.$=s[u];break;case 85:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-1]);break;case 86:this.$=r.addLocationDataFn(o[u-1],o[u])(r.extend(s[u],{soak:!0}));break;case 87:this.$=r.addLocationDataFn(o[u],o[u])(new r.Index(s[u]));break;case 88:this.$=r.addLocationDataFn(o[u],o[u])(new r.Slice(s[u]));break;case 89:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Obj(s[u-2],s[u-3].generated));break;case 90:this.$=r.addLocationDataFn(o[u],o[u])([]);break;case 91:this.$=r.addLocationDataFn(o[u],o[u])([s[u]]);break;case 92:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-2].concat(s[u]));break;case 93:this.$=r.addLocationDataFn(o[u-3],o[u])(s[u-3].concat(s[u]));break;case 94:this.$=r.addLocationDataFn(o[u-5],o[u])(s[u-5].concat(s[u-2]));break;case 95:this.$=r.addLocationDataFn(o[u],o[u])(new r.Class);break;case 96:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Class(null,null,s[u]));break;case 97:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Class(null,s[u]));break;case 98:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Class(null,s[u-1],s[u]));break;case 99:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Class(s[u]));break;case 100:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Class(s[u-1],null,s[u]));break;case 101:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Class(s[u-2],s[u]));break;case 102:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Class(s[u-3],s[u-1],s[u]));break;case 103:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Call(s[u-2],s[u],s[u-1]));break;case 104:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Call(s[u-2],s[u],s[u-1]));break;case 105:this.$=r.addLocationDataFn(o[u],o[u])(new r.Call(\"super\",[new r.Splat(new r.Literal(\"arguments\"))]));break;case 106:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Call(\"super\",s[u]));break;case 107:this.$=r.addLocationDataFn(o[u],o[u])(!1);break;case 108:this.$=r.addLocationDataFn(o[u],o[u])(!0);break;case 109:this.$=r.addLocationDataFn(o[u-1],o[u])([]);break;case 110:this.$=r.addLocationDataFn(o[u-3],o[u])(s[u-2]);break;case 111:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(new r.Literal(\"this\")));break;case 112:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(new r.Literal(\"this\")));break;case 113:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Value(r.addLocationDataFn(o[u-1])(new r.Literal(\"this\")),[r.addLocationDataFn(o[u])(new r.Access(s[u]))],\"this\"));break;case 114:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Arr([]));break;case 115:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Arr(s[u-2]));break;case 116:this.$=r.addLocationDataFn(o[u],o[u])(\"inclusive\");break;case 117:this.$=r.addLocationDataFn(o[u],o[u])(\"exclusive\");break;case 118:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Range(s[u-3],s[u-1],s[u-2]));break;case 119:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Range(s[u-2],s[u],s[u-1]));break;case 120:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Range(s[u-1],null,s[u]));break;case 121:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Range(null,s[u],s[u-1]));break;case 122:this.$=r.addLocationDataFn(o[u],o[u])(new r.Range(null,null,s[u]));break;case 123:this.$=r.addLocationDataFn(o[u],o[u])([s[u]]);break;case 124:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-2].concat(s[u]));break;case 125:this.$=r.addLocationDataFn(o[u-3],o[u])(s[u-3].concat(s[u]));break;case 126:this.$=r.addLocationDataFn(o[u-3],o[u])(s[u-2]);break;case 127:this.$=r.addLocationDataFn(o[u-5],o[u])(s[u-5].concat(s[u-2]));break;case 128:this.$=s[u];break;case 129:this.$=s[u];break;case 130:this.$=s[u];break;case 131:this.$=r.addLocationDataFn(o[u-2],o[u])([].concat(s[u-2],s[u]));break;case 132:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Try(s[u]));break;case 133:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Try(s[u-1],s[u][0],s[u][1]));break;case 134:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Try(s[u-2],null,null,s[u]));break;case 135:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Try(s[u-3],s[u-2][0],s[u-2][1],s[u]));break;case 136:this.$=r.addLocationDataFn(o[u-2],o[u])([s[u-1],s[u]]);break;case 137:this.$=r.addLocationDataFn(o[u-2],o[u])([r.addLocationDataFn(o[u-1])(new r.Value(s[u-1])),s[u]]);break;case 138:this.$=r.addLocationDataFn(o[u-1],o[u])([null,s[u]]);break;case 139:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Throw(s[u]));break;case 140:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Parens(s[u-1]));break;case 141:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Parens(s[u-2]));break;case 142:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.While(s[u]));break;case 143:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.While(s[u-2],{guard:s[u]}));break;case 144:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.While(s[u],{invert:!0}));break;case 145:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.While(s[u-2],{invert:!0,guard:s[u]}));break;case 146:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u-1].addBody(s[u]));break;case 147:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u].addBody(r.addLocationDataFn(o[u-1])(r.Block.wrap([s[u-1]]))));break;case 148:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u].addBody(r.addLocationDataFn(o[u-1])(r.Block.wrap([s[u-1]]))));break;case 149:this.$=r.addLocationDataFn(o[u],o[u])(s[u]);break;case 150:this.$=r.addLocationDataFn(o[u-1],o[u])((new r.While(r.addLocationDataFn(o[u-1])(new r.Literal(\"true\")))).addBody(s[u]));break;case 151:this.$=r.addLocationDataFn(o[u-1],o[u])((new r.While(r.addLocationDataFn(o[u-1])(new r.Literal(\"true\")))).addBody(r.addLocationDataFn(o[u])(r.Block.wrap([s[u]]))));break;case 152:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.For(s[u-1],s[u]));break;case 153:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.For(s[u-1],s[u]));break;case 154:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.For(s[u],s[u-1]));break;case 155:this.$=r.addLocationDataFn(o[u-1],o[u])({source:r.addLocationDataFn(o[u])(new r.Value(s[u]))});break;case 156:this.$=r.addLocationDataFn(o[u-1],o[u])(function(){return s[u].own=s[u-1].own,s[u].name=s[u-1][0],s[u].index=s[u-1][1],s[u]}());break;case 157:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u]);break;case 158:this.$=r.addLocationDataFn(o[u-2],o[u])(function(){return s[u].own=!0,s[u]}());break;case 159:this.$=s[u];break;case 160:this.$=s[u];break;case 161:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 162:this.$=r.addLocationDataFn(o[u],o[u])(new r.Value(s[u]));break;case 163:this.$=r.addLocationDataFn(o[u],o[u])([s[u]]);break;case 164:this.$=r.addLocationDataFn(o[u-2],o[u])([s[u-2],s[u]]);break;case 165:this.$=r.addLocationDataFn(o[u-1],o[u])({source:s[u]});break;case 166:this.$=r.addLocationDataFn(o[u-1],o[u])({source:s[u],object:!0});break;case 167:this.$=r.addLocationDataFn(o[u-3],o[u])({source:s[u-2],guard:s[u]});break;case 168:this.$=r.addLocationDataFn(o[u-3],o[u])({source:s[u-2],guard:s[u],object:!0});break;case 169:this.$=r.addLocationDataFn(o[u-3],o[u])({source:s[u-2],step:s[u]});break;case 170:this.$=r.addLocationDataFn(o[u-5],o[u])({source:s[u-4],guard:s[u-2],step:s[u]});break;case 171:this.$=r.addLocationDataFn(o[u-5],o[u])({source:s[u-4],step:s[u-2],guard:s[u]});break;case 172:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Switch(s[u-3],s[u-1]));break;case 173:this.$=r.addLocationDataFn(o[u-6],o[u])(new r.Switch(s[u-5],s[u-3],s[u-1]));break;case 174:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Switch(null,s[u-1]));break;case 175:this.$=r.addLocationDataFn(o[u-5],o[u])(new r.Switch(null,s[u-3],s[u-1]));break;case 176:this.$=s[u];break;case 177:this.$=r.addLocationDataFn(o[u-1],o[u])(s[u-1].concat(s[u]));break;case 178:this.$=r.addLocationDataFn(o[u-2],o[u])([[s[u-1],s[u]]]);break;case 179:this.$=r.addLocationDataFn(o[u-3],o[u])([[s[u-2],s[u-1]]]);break;case 180:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.If(s[u-1],s[u],{type:s[u-2]}));break;case 181:this.$=r.addLocationDataFn(o[u-4],o[u])(s[u-4].addElse(r.addLocationDataFn(o[u-2],o[u])(new r.If(s[u-1],s[u],{type:s[u-2]}))));break;case 182:this.$=s[u];break;case 183:this.$=r.addLocationDataFn(o[u-2],o[u])(s[u-2].addElse(s[u]));break;case 184:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.If(s[u],r.addLocationDataFn(o[u-2])(r.Block.wrap([s[u-2]])),{type:s[u-1],statement:!0}));break;case 185:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.If(s[u],r.addLocationDataFn(o[u-2])(r.Block.wrap([s[u-2]])),{type:s[u-1],statement:!0}));break;case 186:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(s[u-1],s[u]));break;case 187:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"-\",s[u]));break;case 188:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"+\",s[u]));break;case 189:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"--\",s[u]));break;case 190:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"++\",s[u]));break;case 191:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"--\",s[u-1],null,!0));break;case 192:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Op(\"++\",s[u-1],null,!0));break;case 193:this.$=r.addLocationDataFn(o[u-1],o[u])(new r.Existence(s[u-1]));break;case 194:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(\"+\",s[u-2],s[u]));break;case 195:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(\"-\",s[u-2],s[u]));break;case 196:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(s[u-1],s[u-2],s[u]));break;case 197:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(s[u-1],s[u-2],s[u]));break;case 198:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(s[u-1],s[u-2],s[u]));break;case 199:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Op(s[u-1],s[u-2],s[u]));break;case 200:this.$=r.addLocationDataFn(o[u-2],o[u])(function(){return s[u-1].charAt(0)===\"!\"?(new r.Op(s[u-1].slice(1),s[u-2],s[u])).invert():new r.Op(s[u-1],s[u-2],s[u])}());break;case 201:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Assign(s[u-2],s[u],s[u-1]));break;case 202:this.$=r.addLocationDataFn(o[u-4],o[u])(new r.Assign(s[u-4],s[u-1],s[u-3]));break;case 203:this.$=r.addLocationDataFn(o[u-3],o[u])(new r.Assign(s[u-3],s[u],s[u-2]));break;case 204:this.$=r.addLocationDataFn(o[u-2],o[u])(new r.Extends(s[u-2],s[u]))}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[3]},{1:[2,2],6:[1,72]},{1:[2,3],6:[2,3],26:[2,3],102:[2,3]},{1:[2,6],6:[2,6],26:[2,6],102:[2,6],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,7],6:[2,7],26:[2,7],102:[2,7],103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,11],6:[2,11],25:[2,11],26:[2,11],49:[2,11],54:[2,11],57:[2,11],62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,11],74:[1,96],78:[2,11],81:87,84:[1,89],85:[2,107],86:[2,11],91:[2,11],93:[2,11],102:[2,11],104:[2,11],105:[2,11],106:[2,11],110:[2,11],118:[2,11],126:[2,11],128:[2,11],129:[2,11],132:[2,11],133:[2,11],134:[2,11],135:[2,11],136:[2,11],137:[2,11]},{1:[2,12],6:[2,12],25:[2,12],26:[2,12],49:[2,12],54:[2,12],57:[2,12],62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],73:[2,12],74:[1,96],78:[2,12],81:97,84:[1,89],85:[2,107],86:[2,12],91:[2,12],93:[2,12],102:[2,12],104:[2,12],105:[2,12],106:[2,12],110:[2,12],118:[2,12],126:[2,12],128:[2,12],129:[2,12],132:[2,12],133:[2,12],134:[2,12],135:[2,12],136:[2,12],137:[2,12]},{1:[2,13],6:[2,13],25:[2,13],26:[2,13],49:[2,13],54:[2,13],57:[2,13],73:[2,13],78:[2,13],86:[2,13],91:[2,13],93:[2,13],102:[2,13],104:[2,13],105:[2,13],106:[2,13],110:[2,13],118:[2,13],126:[2,13],128:[2,13],129:[2,13],132:[2,13],133:[2,13],134:[2,13],135:[2,13],136:[2,13],137:[2,13]},{1:[2,14],6:[2,14],25:[2,14],26:[2,14],49:[2,14],54:[2,14],57:[2,14],73:[2,14],78:[2,14],86:[2,14],91:[2,14],93:[2,14],102:[2,14],104:[2,14],105:[2,14],106:[2,14],110:[2,14],118:[2,14],126:[2,14],128:[2,14],129:[2,14],132:[2,14],133:[2,14],134:[2,14],135:[2,14],136:[2,14],137:[2,14]},{1:[2,15],6:[2,15],25:[2,15],26:[2,15],49:[2,15],54:[2,15],57:[2,15],73:[2,15],78:[2,15],86:[2,15],91:[2,15],93:[2,15],102:[2,15],104:[2,15],105:[2,15],106:[2,15],110:[2,15],118:[2,15],126:[2,15],128:[2,15],129:[2,15],132:[2,15],133:[2,15],134:[2,15],135:[2,15],136:[2,15],137:[2,15]},{1:[2,16],6:[2,16],25:[2,16],26:[2,16],49:[2,16],54:[2,16],57:[2,16],73:[2,16],78:[2,16],86:[2,16],91:[2,16],93:[2,16],102:[2,16],104:[2,16],105:[2,16],106:[2,16],110:[2,16],118:[2,16],126:[2,16],128:[2,16],129:[2,16],132:[2,16],133:[2,16],134:[2,16],135:[2,16],136:[2,16],137:[2,16]},{1:[2,17],6:[2,17],25:[2,17],26:[2,17],49:[2,17],54:[2,17],57:[2,17],73:[2,17],78:[2,17],86:[2,17],91:[2,17],93:[2,17],102:[2,17],104:[2,17],105:[2,17],106:[2,17],110:[2,17],118:[2,17],126:[2,17],128:[2,17],129:[2,17],132:[2,17],133:[2,17],134:[2,17],135:[2,17],136:[2,17],137:[2,17]},{1:[2,18],6:[2,18],25:[2,18],26:[2,18],49:[2,18],54:[2,18],57:[2,18],73:[2,18],78:[2,18],86:[2,18],91:[2,18],93:[2,18],102:[2,18],104:[2,18],105:[2,18],106:[2,18],110:[2,18],118:[2,18],126:[2,18],128:[2,18],129:[2,18],132:[2,18],133:[2,18],134:[2,18],135:[2,18],136:[2,18],137:[2,18]},{1:[2,19],6:[2,19],25:[2,19],26:[2,19],49:[2,19],54:[2,19],57:[2,19],73:[2,19],78:[2,19],86:[2,19],91:[2,19],93:[2,19],102:[2,19],104:[2,19],105:[2,19],106:[2,19],110:[2,19],118:[2,19],126:[2,19],128:[2,19],129:[2,19],132:[2,19],133:[2,19],134:[2,19],135:[2,19],136:[2,19],137:[2,19]},{1:[2,20],6:[2,20],25:[2,20],26:[2,20],49:[2,20],54:[2,20],57:[2,20],73:[2,20],78:[2,20],86:[2,20],91:[2,20],93:[2,20],102:[2,20],104:[2,20],105:[2,20],106:[2,20],110:[2,20],118:[2,20],126:[2,20],128:[2,20],129:[2,20],132:[2,20],133:[2,20],134:[2,20],135:[2,20],136:[2,20],137:[2,20]},{1:[2,21],6:[2,21],25:[2,21],26:[2,21],49:[2,21],54:[2,21],57:[2,21],73:[2,21],78:[2,21],86:[2,21],91:[2,21],93:[2,21],102:[2,21],104:[2,21],105:[2,21],106:[2,21],110:[2,21],118:[2,21],126:[2,21],128:[2,21],129:[2,21],132:[2,21],133:[2,21],134:[2,21],135:[2,21],136:[2,21],137:[2,21]},{1:[2,22],6:[2,22],25:[2,22],26:[2,22],49:[2,22],54:[2,22],57:[2,22],73:[2,22],78:[2,22],86:[2,22],91:[2,22],93:[2,22],102:[2,22],104:[2,22],105:[2,22],106:[2,22],110:[2,22],118:[2,22],126:[2,22],128:[2,22],129:[2,22],132:[2,22],133:[2,22],134:[2,22],135:[2,22],136:[2,22],137:[2,22]},{1:[2,8],6:[2,8],26:[2,8],102:[2,8],104:[2,8],106:[2,8],110:[2,8],126:[2,8]},{1:[2,9],6:[2,9],26:[2,9],102:[2,9],104:[2,9],106:[2,9],110:[2,9],126:[2,9]},{1:[2,10],6:[2,10],26:[2,10],102:[2,10],104:[2,10],106:[2,10],110:[2,10],126:[2,10]},{1:[2,74],6:[2,74],25:[2,74],26:[2,74],40:[1,99],49:[2,74],54:[2,74],57:[2,74],66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],73:[2,74],74:[2,74],78:[2,74],84:[2,74],85:[2,74],86:[2,74],91:[2,74],93:[2,74],102:[2,74],104:[2,74],105:[2,74],106:[2,74],110:[2,74],118:[2,74],126:[2,74],128:[2,74],129:[2,74],132:[2,74],133:[2,74],134:[2,74],135:[2,74],136:[2,74],137:[2,74]},{1:[2,75],6:[2,75],25:[2,75],26:[2,75],49:[2,75],54:[2,75],57:[2,75],66:[2,75],67:[2,75],68:[2,75],69:[2,75],71:[2,75],73:[2,75],74:[2,75],78:[2,75],84:[2,75],85:[2,75],86:[2,75],91:[2,75],93:[2,75],102:[2,75],104:[2,75],105:[2,75],106:[2,75],110:[2,75],118:[2,75],126:[2,75],128:[2,75],129:[2,75],132:[2,75],133:[2,75],134:[2,75],135:[2,75],136:[2,75],137:[2,75]},{1:[2,76],6:[2,76],25:[2,76],26:[2,76],49:[2,76],54:[2,76],57:[2,76],66:[2,76],67:[2,76],68:[2,76],69:[2,76],71:[2,76],73:[2,76],74:[2,76],78:[2,76],84:[2,76],85:[2,76],86:[2,76],91:[2,76],93:[2,76],102:[2,76],104:[2,76],105:[2,76],106:[2,76],110:[2,76],118:[2,76],126:[2,76],128:[2,76],129:[2,76],132:[2,76],133:[2,76],134:[2,76],135:[2,76],136:[2,76],137:[2,76]},{1:[2,77],6:[2,77],25:[2,77],26:[2,77],49:[2,77],54:[2,77],57:[2,77],66:[2,77],67:[2,77],68:[2,77],69:[2,77],71:[2,77],73:[2,77],74:[2,77],78:[2,77],84:[2,77],85:[2,77],86:[2,77],91:[2,77],93:[2,77],102:[2,77],104:[2,77],105:[2,77],106:[2,77],110:[2,77],118:[2,77],126:[2,77],128:[2,77],129:[2,77],132:[2,77],133:[2,77],134:[2,77],135:[2,77],136:[2,77],137:[2,77]},{1:[2,78],6:[2,78],25:[2,78],26:[2,78],49:[2,78],54:[2,78],57:[2,78],66:[2,78],67:[2,78],68:[2,78],69:[2,78],71:[2,78],73:[2,78],74:[2,78],78:[2,78],84:[2,78],85:[2,78],86:[2,78],91:[2,78],93:[2,78],102:[2,78],104:[2,78],105:[2,78],106:[2,78],110:[2,78],118:[2,78],126:[2,78],128:[2,78],129:[2,78],132:[2,78],133:[2,78],134:[2,78],135:[2,78],136:[2,78],137:[2,78]},{1:[2,105],6:[2,105],25:[2,105],26:[2,105],49:[2,105],54:[2,105],57:[2,105],66:[2,105],67:[2,105],68:[2,105],69:[2,105],71:[2,105],73:[2,105],74:[2,105],78:[2,105],82:100,84:[2,105],85:[1,101],86:[2,105],91:[2,105],93:[2,105],102:[2,105],104:[2,105],105:[2,105],106:[2,105],110:[2,105],118:[2,105],126:[2,105],128:[2,105],129:[2,105],132:[2,105],133:[2,105],134:[2,105],135:[2,105],136:[2,105],137:[2,105]},{6:[2,54],25:[2,54],27:105,28:[1,71],44:106,48:102,49:[2,54],54:[2,54],55:103,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{24:111,25:[1,112]},{7:113,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:115,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:116,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:117,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{12:118,13:119,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,58:45,59:46,61:121,63:23,64:24,65:25,76:[1,68],83:[1,26],88:[1,56],89:[1,57],90:[1,55],101:[1,54]},{1:[2,71],6:[2,71],25:[2,71],26:[2,71],40:[2,71],49:[2,71],54:[2,71],57:[2,71],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,71],74:[2,71],78:[2,71],80:[1,125],84:[2,71],85:[2,71],86:[2,71],91:[2,71],93:[2,71],102:[2,71],104:[2,71],105:[2,71],106:[2,71],110:[2,71],118:[2,71],126:[2,71],128:[2,71],129:[2,71],130:[1,122],131:[1,123],132:[2,71],133:[2,71],134:[2,71],135:[2,71],136:[2,71],137:[2,71],138:[1,124]},{1:[2,182],6:[2,182],25:[2,182],26:[2,182],49:[2,182],54:[2,182],57:[2,182],73:[2,182],78:[2,182],86:[2,182],91:[2,182],93:[2,182],102:[2,182],104:[2,182],105:[2,182],106:[2,182],110:[2,182],118:[2,182],121:[1,126],126:[2,182],128:[2,182],129:[2,182],132:[2,182],133:[2,182],134:[2,182],135:[2,182],136:[2,182],137:[2,182]},{24:127,25:[1,112]},{24:128,25:[1,112]},{1:[2,149],6:[2,149],25:[2,149],26:[2,149],49:[2,149],54:[2,149],57:[2,149],73:[2,149],78:[2,149],86:[2,149],91:[2,149],93:[2,149],102:[2,149],104:[2,149],105:[2,149],106:[2,149],110:[2,149],118:[2,149],126:[2,149],128:[2,149],129:[2,149],132:[2,149],133:[2,149],134:[2,149],135:[2,149],136:[2,149],137:[2,149]},{24:129,25:[1,112]},{7:130,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,131],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,95],6:[2,95],12:118,13:119,24:132,25:[1,112],26:[2,95],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:120,44:61,49:[2,95],54:[2,95],57:[2,95],58:45,59:46,61:134,63:23,64:24,65:25,73:[2,95],76:[1,68],78:[2,95],80:[1,133],83:[1,26],86:[2,95],88:[1,56],89:[1,57],90:[1,55],91:[2,95],93:[2,95],101:[1,54],102:[2,95],104:[2,95],105:[2,95],106:[2,95],110:[2,95],118:[2,95],126:[2,95],128:[2,95],129:[2,95],132:[2,95],133:[2,95],134:[2,95],135:[2,95],136:[2,95],137:[2,95]},{7:135,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,46],6:[2,46],7:136,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,46],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,46],103:37,104:[2,46],106:[2,46],107:38,108:[1,65],109:39,110:[2,46],111:67,119:[1,40],124:35,125:[1,62],126:[2,46],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,47],6:[2,47],25:[2,47],26:[2,47],54:[2,47],78:[2,47],102:[2,47],104:[2,47],106:[2,47],110:[2,47],126:[2,47]},{1:[2,72],6:[2,72],25:[2,72],26:[2,72],40:[2,72],49:[2,72],54:[2,72],57:[2,72],66:[2,72],67:[2,72],68:[2,72],69:[2,72],71:[2,72],73:[2,72],74:[2,72],78:[2,72],84:[2,72],85:[2,72],86:[2,72],91:[2,72],93:[2,72],102:[2,72],104:[2,72],105:[2,72],106:[2,72],110:[2,72],118:[2,72],126:[2,72],128:[2,72],129:[2,72],132:[2,72],133:[2,72],134:[2,72],135:[2,72],136:[2,72],137:[2,72]},{1:[2,73],6:[2,73],25:[2,73],26:[2,73],40:[2,73],49:[2,73],54:[2,73],57:[2,73],66:[2,73],67:[2,73],68:[2,73],69:[2,73],71:[2,73],73:[2,73],74:[2,73],78:[2,73],84:[2,73],85:[2,73],86:[2,73],91:[2,73],93:[2,73],102:[2,73],104:[2,73],105:[2,73],106:[2,73],110:[2,73],118:[2,73],126:[2,73],128:[2,73],129:[2,73],132:[2,73],133:[2,73],134:[2,73],135:[2,73],136:[2,73],137:[2,73]},{1:[2,28],6:[2,28],25:[2,28],26:[2,28],49:[2,28],54:[2,28],57:[2,28],66:[2,28],67:[2,28],68:[2,28],69:[2,28],71:[2,28],73:[2,28],74:[2,28],78:[2,28],84:[2,28],85:[2,28],86:[2,28],91:[2,28],93:[2,28],102:[2,28],104:[2,28],105:[2,28],106:[2,28],110:[2,28],118:[2,28],126:[2,28],128:[2,28],129:[2,28],132:[2,28],133:[2,28],134:[2,28],135:[2,28],136:[2,28],137:[2,28]},{1:[2,29],6:[2,29],25:[2,29],26:[2,29],49:[2,29],54:[2,29],57:[2,29],66:[2,29],67:[2,29],68:[2,29],69:[2,29],71:[2,29],73:[2,29],74:[2,29],78:[2,29],84:[2,29],85:[2,29],86:[2,29],91:[2,29],93:[2,29],102:[2,29],104:[2,29],105:[2,29],106:[2,29],110:[2,29],118:[2,29],126:[2,29],128:[2,29],129:[2,29],132:[2,29],133:[2,29],134:[2,29],135:[2,29],136:[2,29],137:[2,29]},{1:[2,30],6:[2,30],25:[2,30],26:[2,30],49:[2,30],54:[2,30],57:[2,30],66:[2,30],67:[2,30],68:[2,30],69:[2,30],71:[2,30],73:[2,30],74:[2,30],78:[2,30],84:[2,30],85:[2,30],86:[2,30],91:[2,30],93:[2,30],102:[2,30],104:[2,30],105:[2,30],106:[2,30],110:[2,30],118:[2,30],126:[2,30],128:[2,30],129:[2,30],132:[2,30],133:[2,30],134:[2,30],135:[2,30],136:[2,30],137:[2,30]},{1:[2,31],6:[2,31],25:[2,31],26:[2,31],49:[2,31],54:[2,31],57:[2,31],66:[2,31],67:[2,31],68:[2,31],69:[2,31],71:[2,31],73:[2,31],74:[2,31],78:[2,31],84:[2,31],85:[2,31],86:[2,31],91:[2,31],93:[2,31],102:[2,31],104:[2,31],105:[2,31],106:[2,31],110:[2,31],118:[2,31],126:[2,31],128:[2,31],129:[2,31],132:[2,31],133:[2,31],134:[2,31],135:[2,31],136:[2,31],137:[2,31]},{1:[2,32],6:[2,32],25:[2,32],26:[2,32],49:[2,32],54:[2,32],57:[2,32],66:[2,32],67:[2,32],68:[2,32],69:[2,32],71:[2,32],73:[2,32],74:[2,32],78:[2,32],84:[2,32],85:[2,32],86:[2,32],91:[2,32],93:[2,32],102:[2,32],104:[2,32],105:[2,32],106:[2,32],110:[2,32],118:[2,32],126:[2,32],128:[2,32],129:[2,32],132:[2,32],133:[2,32],134:[2,32],135:[2,32],136:[2,32],137:[2,32]},{1:[2,33],6:[2,33],25:[2,33],26:[2,33],49:[2,33],54:[2,33],57:[2,33],66:[2,33],67:[2,33],68:[2,33],69:[2,33],71:[2,33],73:[2,33],74:[2,33],78:[2,33],84:[2,33],85:[2,33],86:[2,33],91:[2,33],93:[2,33],102:[2,33],104:[2,33],105:[2,33],106:[2,33],110:[2,33],118:[2,33],126:[2,33],128:[2,33],129:[2,33],132:[2,33],133:[2,33],134:[2,33],135:[2,33],136:[2,33],137:[2,33]},{1:[2,34],6:[2,34],25:[2,34],26:[2,34],49:[2,34],54:[2,34],57:[2,34],66:[2,34],67:[2,34],68:[2,34],69:[2,34],71:[2,34],73:[2,34],74:[2,34],78:[2,34],84:[2,34],85:[2,34],86:[2,34],91:[2,34],93:[2,34],102:[2,34],104:[2,34],105:[2,34],106:[2,34],110:[2,34],118:[2,34],126:[2,34],128:[2,34],129:[2,34],132:[2,34],133:[2,34],134:[2,34],135:[2,34],136:[2,34],137:[2,34]},{4:137,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,138],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:139,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,111],6:[2,111],25:[2,111],26:[2,111],49:[2,111],54:[2,111],57:[2,111],66:[2,111],67:[2,111],68:[2,111],69:[2,111],71:[2,111],73:[2,111],74:[2,111],78:[2,111],84:[2,111],85:[2,111],86:[2,111],91:[2,111],93:[2,111],102:[2,111],104:[2,111],105:[2,111],106:[2,111],110:[2,111],118:[2,111],126:[2,111],128:[2,111],129:[2,111],132:[2,111],133:[2,111],134:[2,111],135:[2,111],136:[2,111],137:[2,111]},{1:[2,112],6:[2,112],25:[2,112],26:[2,112],27:145,28:[1,71],49:[2,112],54:[2,112],57:[2,112],66:[2,112],67:[2,112],68:[2,112],69:[2,112],71:[2,112],73:[2,112],74:[2,112],78:[2,112],84:[2,112],85:[2,112],86:[2,112],91:[2,112],93:[2,112],102:[2,112],104:[2,112],105:[2,112],106:[2,112],110:[2,112],118:[2,112],126:[2,112],128:[2,112],129:[2,112],132:[2,112],133:[2,112],134:[2,112],135:[2,112],136:[2,112],137:[2,112]},{25:[2,50]},{25:[2,51]},{1:[2,67],6:[2,67],25:[2,67],26:[2,67],40:[2,67],49:[2,67],54:[2,67],57:[2,67],66:[2,67],67:[2,67],68:[2,67],69:[2,67],71:[2,67],73:[2,67],74:[2,67],78:[2,67],80:[2,67],84:[2,67],85:[2,67],86:[2,67],91:[2,67],93:[2,67],102:[2,67],104:[2,67],105:[2,67],106:[2,67],110:[2,67],118:[2,67],126:[2,67],128:[2,67],129:[2,67],130:[2,67],131:[2,67],132:[2,67],133:[2,67],134:[2,67],135:[2,67],136:[2,67],137:[2,67],138:[2,67]},{1:[2,70],6:[2,70],25:[2,70],26:[2,70],40:[2,70],49:[2,70],54:[2,70],57:[2,70],66:[2,70],67:[2,70],68:[2,70],69:[2,70],71:[2,70],73:[2,70],74:[2,70],78:[2,70],80:[2,70],84:[2,70],85:[2,70],86:[2,70],91:[2,70],93:[2,70],102:[2,70],104:[2,70],105:[2,70],106:[2,70],110:[2,70],118:[2,70],126:[2,70],128:[2,70],129:[2,70],130:[2,70],131:[2,70],132:[2,70],133:[2,70],134:[2,70],135:[2,70],136:[2,70],137:[2,70],138:[2,70]},{7:146,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:147,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:148,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:150,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:149,25:[1,112],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{27:155,28:[1,71],44:156,58:157,59:158,64:151,76:[1,68],89:[1,109],90:[1,55],113:152,114:[1,153],115:154},{112:159,116:[1,160],117:[1,161]},{6:[2,90],10:165,25:[2,90],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:163,42:164,44:168,46:[1,44],54:[2,90],77:162,78:[2,90],89:[1,109]},{1:[2,26],6:[2,26],25:[2,26],26:[2,26],43:[2,26],49:[2,26],54:[2,26],57:[2,26],66:[2,26],67:[2,26],68:[2,26],69:[2,26],71:[2,26],73:[2,26],74:[2,26],78:[2,26],84:[2,26],85:[2,26],86:[2,26],91:[2,26],93:[2,26],102:[2,26],104:[2,26],105:[2,26],106:[2,26],110:[2,26],118:[2,26],126:[2,26],128:[2,26],129:[2,26],132:[2,26],133:[2,26],134:[2,26],135:[2,26],136:[2,26],137:[2,26]},{1:[2,27],6:[2,27],25:[2,27],26:[2,27],43:[2,27],49:[2,27],54:[2,27],57:[2,27],66:[2,27],67:[2,27],68:[2,27],69:[2,27],71:[2,27],73:[2,27],74:[2,27],78:[2,27],84:[2,27],85:[2,27],86:[2,27],91:[2,27],93:[2,27],102:[2,27],104:[2,27],105:[2,27],106:[2,27],110:[2,27],118:[2,27],126:[2,27],128:[2,27],129:[2,27],132:[2,27],133:[2,27],134:[2,27],135:[2,27],136:[2,27],137:[2,27]},{1:[2,25],6:[2,25],25:[2,25],26:[2,25],40:[2,25],43:[2,25],49:[2,25],54:[2,25],57:[2,25],66:[2,25],67:[2,25],68:[2,25],69:[2,25],71:[2,25],73:[2,25],74:[2,25],78:[2,25],80:[2,25],84:[2,25],85:[2,25],86:[2,25],91:[2,25],93:[2,25],102:[2,25],104:[2,25],105:[2,25],106:[2,25],110:[2,25],116:[2,25],117:[2,25],118:[2,25],126:[2,25],128:[2,25],129:[2,25],130:[2,25],131:[2,25],132:[2,25],133:[2,25],134:[2,25],135:[2,25],136:[2,25],137:[2,25],138:[2,25]},{1:[2,5],5:169,6:[2,5],7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[2,5],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],102:[2,5],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,193],6:[2,193],25:[2,193],26:[2,193],49:[2,193],54:[2,193],57:[2,193],73:[2,193],78:[2,193],86:[2,193],91:[2,193],93:[2,193],102:[2,193],104:[2,193],105:[2,193],106:[2,193],110:[2,193],118:[2,193],126:[2,193],128:[2,193],129:[2,193],132:[2,193],133:[2,193],134:[2,193],135:[2,193],136:[2,193],137:[2,193]},{7:170,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:171,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:172,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:173,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:174,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:175,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:176,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:177,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,148],6:[2,148],25:[2,148],26:[2,148],49:[2,148],54:[2,148],57:[2,148],73:[2,148],78:[2,148],86:[2,148],91:[2,148],93:[2,148],102:[2,148],104:[2,148],105:[2,148],106:[2,148],110:[2,148],118:[2,148],126:[2,148],128:[2,148],129:[2,148],132:[2,148],133:[2,148],134:[2,148],135:[2,148],136:[2,148],137:[2,148]},{1:[2,153],6:[2,153],25:[2,153],26:[2,153],49:[2,153],54:[2,153],57:[2,153],73:[2,153],78:[2,153],86:[2,153],91:[2,153],93:[2,153],102:[2,153],104:[2,153],105:[2,153],106:[2,153],110:[2,153],118:[2,153],126:[2,153],128:[2,153],129:[2,153],132:[2,153],133:[2,153],134:[2,153],135:[2,153],136:[2,153],137:[2,153]},{7:178,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,147],6:[2,147],25:[2,147],26:[2,147],49:[2,147],54:[2,147],57:[2,147],73:[2,147],78:[2,147],86:[2,147],91:[2,147],93:[2,147],102:[2,147],104:[2,147],105:[2,147],106:[2,147],110:[2,147],118:[2,147],126:[2,147],128:[2,147],129:[2,147],132:[2,147],133:[2,147],134:[2,147],135:[2,147],136:[2,147],137:[2,147]},{1:[2,152],6:[2,152],25:[2,152],26:[2,152],49:[2,152],54:[2,152],57:[2,152],73:[2,152],78:[2,152],86:[2,152],91:[2,152],93:[2,152],102:[2,152],104:[2,152],105:[2,152],106:[2,152],110:[2,152],118:[2,152],126:[2,152],128:[2,152],129:[2,152],132:[2,152],133:[2,152],134:[2,152],135:[2,152],136:[2,152],137:[2,152]},{82:179,85:[1,101]},{1:[2,68],6:[2,68],25:[2,68],26:[2,68],40:[2,68],49:[2,68],54:[2,68],57:[2,68],66:[2,68],67:[2,68],68:[2,68],69:[2,68],71:[2,68],73:[2,68],74:[2,68],78:[2,68],80:[2,68],84:[2,68],85:[2,68],86:[2,68],91:[2,68],93:[2,68],102:[2,68],104:[2,68],105:[2,68],106:[2,68],110:[2,68],118:[2,68],126:[2,68],128:[2,68],129:[2,68],130:[2,68],131:[2,68],132:[2,68],133:[2,68],134:[2,68],135:[2,68],136:[2,68],137:[2,68],138:[2,68]},{85:[2,108]},{27:180,28:[1,71]},{27:181,28:[1,71]},{1:[2,83],6:[2,83],25:[2,83],26:[2,83],27:182,28:[1,71],40:[2,83],49:[2,83],54:[2,83],57:[2,83],66:[2,83],67:[2,83],68:[2,83],69:[2,83],71:[2,83],73:[2,83],74:[2,83],78:[2,83],80:[2,83],84:[2,83],85:[2,83],86:[2,83],91:[2,83],93:[2,83],102:[2,83],104:[2,83],105:[2,83],106:[2,83],110:[2,83],118:[2,83],126:[2,83],128:[2,83],129:[2,83],130:[2,83],131:[2,83],132:[2,83],133:[2,83],134:[2,83],135:[2,83],136:[2,83],137:[2,83],138:[2,83]},{27:183,28:[1,71]},{1:[2,84],6:[2,84],25:[2,84],26:[2,84],40:[2,84],49:[2,84],54:[2,84],57:[2,84],66:[2,84],67:[2,84],68:[2,84],69:[2,84],71:[2,84],73:[2,84],74:[2,84],78:[2,84],80:[2,84],84:[2,84],85:[2,84],86:[2,84],91:[2,84],93:[2,84],102:[2,84],104:[2,84],105:[2,84],106:[2,84],110:[2,84],118:[2,84],126:[2,84],128:[2,84],129:[2,84],130:[2,84],131:[2,84],132:[2,84],133:[2,84],134:[2,84],135:[2,84],136:[2,84],137:[2,84],138:[2,84]},{7:185,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],57:[1,189],58:45,59:46,61:34,63:23,64:24,65:25,72:184,75:186,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],92:187,93:[1,188],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{70:190,71:[1,95],74:[1,96]},{82:191,85:[1,101]},{1:[2,69],6:[2,69],25:[2,69],26:[2,69],40:[2,69],49:[2,69],54:[2,69],57:[2,69],66:[2,69],67:[2,69],68:[2,69],69:[2,69],71:[2,69],73:[2,69],74:[2,69],78:[2,69],80:[2,69],84:[2,69],85:[2,69],86:[2,69],91:[2,69],93:[2,69],102:[2,69],104:[2,69],105:[2,69],106:[2,69],110:[2,69],118:[2,69],126:[2,69],128:[2,69],129:[2,69],130:[2,69],131:[2,69],132:[2,69],133:[2,69],134:[2,69],135:[2,69],136:[2,69],137:[2,69],138:[2,69]},{6:[1,193],7:192,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,194],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,106],6:[2,106],25:[2,106],26:[2,106],49:[2,106],54:[2,106],57:[2,106],66:[2,106],67:[2,106],68:[2,106],69:[2,106],71:[2,106],73:[2,106],74:[2,106],78:[2,106],84:[2,106],85:[2,106],86:[2,106],91:[2,106],93:[2,106],102:[2,106],104:[2,106],105:[2,106],106:[2,106],110:[2,106],118:[2,106],126:[2,106],128:[2,106],129:[2,106],132:[2,106],133:[2,106],134:[2,106],135:[2,106],136:[2,106],137:[2,106]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],86:[1,195],87:196,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],49:[1,198],53:200,54:[1,199]},{6:[2,55],25:[2,55],26:[2,55],49:[2,55],54:[2,55]},{6:[2,59],25:[2,59],26:[2,59],40:[1,202],49:[2,59],54:[2,59],57:[1,201]},{6:[2,62],25:[2,62],26:[2,62],40:[2,62],49:[2,62],54:[2,62],57:[2,62]},{6:[2,63],25:[2,63],26:[2,63],40:[2,63],49:[2,63],54:[2,63],57:[2,63]},{6:[2,64],25:[2,64],26:[2,64],40:[2,64],49:[2,64],54:[2,64],57:[2,64]},{6:[2,65],25:[2,65],26:[2,65],40:[2,65],49:[2,65],54:[2,65],57:[2,65]},{27:145,28:[1,71]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:141,88:[1,56],89:[1,57],90:[1,55],91:[1,140],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,49],6:[2,49],25:[2,49],26:[2,49],49:[2,49],54:[2,49],57:[2,49],73:[2,49],78:[2,49],86:[2,49],91:[2,49],93:[2,49],102:[2,49],104:[2,49],105:[2,49],106:[2,49],110:[2,49],118:[2,49],126:[2,49],128:[2,49],129:[2,49],132:[2,49],133:[2,49],134:[2,49],135:[2,49],136:[2,49],137:[2,49]},{4:204,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,203],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,186],6:[2,186],25:[2,186],26:[2,186],49:[2,186],54:[2,186],57:[2,186],73:[2,186],78:[2,186],86:[2,186],91:[2,186],93:[2,186],102:[2,186],103:82,104:[2,186],105:[2,186],106:[2,186],109:83,110:[2,186],111:67,118:[2,186],126:[2,186],128:[2,186],129:[2,186],132:[1,73],133:[2,186],134:[2,186],135:[2,186],136:[2,186],137:[2,186]},{103:85,104:[1,63],106:[1,64],109:86,110:[1,66],111:67,126:[1,84]},{1:[2,187],6:[2,187],25:[2,187],26:[2,187],49:[2,187],54:[2,187],57:[2,187],73:[2,187],78:[2,187],86:[2,187],91:[2,187],93:[2,187],102:[2,187],103:82,104:[2,187],105:[2,187],106:[2,187],109:83,110:[2,187],111:67,118:[2,187],126:[2,187],128:[2,187],129:[2,187],132:[1,73],133:[2,187],134:[2,187],135:[2,187],136:[2,187],137:[2,187]},{1:[2,188],6:[2,188],25:[2,188],26:[2,188],49:[2,188],54:[2,188],57:[2,188],73:[2,188],78:[2,188],86:[2,188],91:[2,188],93:[2,188],102:[2,188],103:82,104:[2,188],105:[2,188],106:[2,188],109:83,110:[2,188],111:67,118:[2,188],126:[2,188],128:[2,188],129:[2,188],132:[1,73],133:[2,188],134:[2,188],135:[2,188],136:[2,188],137:[2,188]},{1:[2,189],6:[2,189],25:[2,189],26:[2,189],49:[2,189],54:[2,189],57:[2,189],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,189],74:[2,71],78:[2,189],84:[2,71],85:[2,71],86:[2,189],91:[2,189],93:[2,189],102:[2,189],104:[2,189],105:[2,189],106:[2,189],110:[2,189],118:[2,189],126:[2,189],128:[2,189],129:[2,189],132:[2,189],133:[2,189],134:[2,189],135:[2,189],136:[2,189],137:[2,189]},{62:88,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:87,84:[1,89],85:[2,107]},{62:98,66:[1,90],67:[1,91],68:[1,92],69:[1,93],70:94,71:[1,95],74:[1,96],81:97,84:[1,89],85:[2,107]},{66:[2,74],67:[2,74],68:[2,74],69:[2,74],71:[2,74],74:[2,74],84:[2,74],85:[2,74]},{1:[2,190],6:[2,190],25:[2,190],26:[2,190],49:[2,190],54:[2,190],57:[2,190],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,190],74:[2,71],78:[2,190],84:[2,71],85:[2,71],86:[2,190],91:[2,190],93:[2,190],102:[2,190],104:[2,190],105:[2,190],106:[2,190],110:[2,190],118:[2,190],126:[2,190],128:[2,190],129:[2,190],132:[2,190],133:[2,190],134:[2,190],135:[2,190],136:[2,190],137:[2,190]},{1:[2,191],6:[2,191],25:[2,191],26:[2,191],49:[2,191],54:[2,191],57:[2,191],73:[2,191],78:[2,191],86:[2,191],91:[2,191],93:[2,191],102:[2,191],104:[2,191],105:[2,191],106:[2,191],110:[2,191],118:[2,191],126:[2,191],128:[2,191],129:[2,191],132:[2,191],133:[2,191],134:[2,191],135:[2,191],136:[2,191],137:[2,191]},{1:[2,192],6:[2,192],25:[2,192],26:[2,192],49:[2,192],54:[2,192],57:[2,192],73:[2,192],78:[2,192],86:[2,192],91:[2,192],93:[2,192],102:[2,192],104:[2,192],105:[2,192],106:[2,192],110:[2,192],118:[2,192],126:[2,192],128:[2,192],129:[2,192],132:[2,192],133:[2,192],134:[2,192],135:[2,192],136:[2,192],137:[2,192]},{6:[1,207],7:205,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,206],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:208,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{24:209,25:[1,112],125:[1,210]},{1:[2,132],6:[2,132],25:[2,132],26:[2,132],49:[2,132],54:[2,132],57:[2,132],73:[2,132],78:[2,132],86:[2,132],91:[2,132],93:[2,132],97:211,98:[1,212],99:[1,213],102:[2,132],104:[2,132],105:[2,132],106:[2,132],110:[2,132],118:[2,132],126:[2,132],128:[2,132],129:[2,132],132:[2,132],133:[2,132],134:[2,132],135:[2,132],136:[2,132],137:[2,132]},{1:[2,146],6:[2,146],25:[2,146],26:[2,146],49:[2,146],54:[2,146],57:[2,146],73:[2,146],78:[2,146],86:[2,146],91:[2,146],93:[2,146],102:[2,146],104:[2,146],105:[2,146],106:[2,146],110:[2,146],118:[2,146],126:[2,146],128:[2,146],129:[2,146],132:[2,146],133:[2,146],134:[2,146],135:[2,146],136:[2,146],137:[2,146]},{1:[2,154],6:[2,154],25:[2,154],26:[2,154],49:[2,154],54:[2,154],57:[2,154],73:[2,154],78:[2,154],86:[2,154],91:[2,154],93:[2,154],102:[2,154],104:[2,154],105:[2,154],106:[2,154],110:[2,154],118:[2,154],126:[2,154],128:[2,154],129:[2,154],132:[2,154],133:[2,154],134:[2,154],135:[2,154],136:[2,154],137:[2,154]},{25:[1,214],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{120:215,122:216,123:[1,217]},{1:[2,96],6:[2,96],25:[2,96],26:[2,96],49:[2,96],54:[2,96],57:[2,96],73:[2,96],78:[2,96],86:[2,96],91:[2,96],93:[2,96],102:[2,96],104:[2,96],105:[2,96],106:[2,96],110:[2,96],118:[2,96],126:[2,96],128:[2,96],129:[2,96],132:[2,96],133:[2,96],134:[2,96],135:[2,96],136:[2,96],137:[2,96]},{7:218,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,99],6:[2,99],24:219,25:[1,112],26:[2,99],49:[2,99],54:[2,99],57:[2,99],66:[2,71],67:[2,71],68:[2,71],69:[2,71],71:[2,71],73:[2,99],74:[2,71],78:[2,99],80:[1,220],84:[2,71],85:[2,71],86:[2,99],91:[2,99],93:[2,99],102:[2,99],104:[2,99],105:[2,99],106:[2,99],110:[2,99],118:[2,99],126:[2,99],128:[2,99],129:[2,99],132:[2,99],133:[2,99],134:[2,99],135:[2,99],136:[2,99],137:[2,99]},{1:[2,139],6:[2,139],25:[2,139],26:[2,139],49:[2,139],54:[2,139],57:[2,139],73:[2,139],78:[2,139],86:[2,139],91:[2,139],93:[2,139],102:[2,139],103:82,104:[2,139],105:[2,139],106:[2,139],109:83,110:[2,139],111:67,118:[2,139],126:[2,139],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,45],6:[2,45],26:[2,45],102:[2,45],103:82,104:[2,45],106:[2,45],109:83,110:[2,45],111:67,126:[2,45],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,72],102:[1,221]},{4:222,5:3,7:4,8:5,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,128],25:[2,128],54:[2,128],57:[1,224],91:[2,128],92:223,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,114],6:[2,114],25:[2,114],26:[2,114],40:[2,114],49:[2,114],54:[2,114],57:[2,114],66:[2,114],67:[2,114],68:[2,114],69:[2,114],71:[2,114],73:[2,114],74:[2,114],78:[2,114],84:[2,114],85:[2,114],86:[2,114],91:[2,114],93:[2,114],102:[2,114],104:[2,114],105:[2,114],106:[2,114],110:[2,114],116:[2,114],117:[2,114],118:[2,114],126:[2,114],128:[2,114],129:[2,114],132:[2,114],133:[2,114],134:[2,114],135:[2,114],136:[2,114],137:[2,114]},{6:[2,52],25:[2,52],53:225,54:[1,226],91:[2,52]},{6:[2,123],25:[2,123],26:[2,123],54:[2,123],86:[2,123],91:[2,123]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:227,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,129],25:[2,129],26:[2,129],54:[2,129],86:[2,129],91:[2,129]},{1:[2,113],6:[2,113],25:[2,113],26:[2,113],40:[2,113],43:[2,113],49:[2,113],54:[2,113],57:[2,113],66:[2,113],67:[2,113],68:[2,113],69:[2,113],71:[2,113],73:[2,113],74:[2,113],78:[2,113],80:[2,113],84:[2,113],85:[2,113],86:[2,113],91:[2,113],93:[2,113],102:[2,113],104:[2,113],105:[2,113],106:[2,113],110:[2,113],116:[2,113],117:[2,113],118:[2,113],126:[2,113],128:[2,113],129:[2,113],130:[2,113],131:[2,113],132:[2,113],133:[2,113],134:[2,113],135:[2,113],136:[2,113],137:[2,113],138:[2,113]},{24:228,25:[1,112],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,142],6:[2,142],25:[2,142],26:[2,142],49:[2,142],54:[2,142],57:[2,142],73:[2,142],78:[2,142],86:[2,142],91:[2,142],93:[2,142],102:[2,142],103:82,104:[1,63],105:[1,229],106:[1,64],109:83,110:[1,66],111:67,118:[2,142],126:[2,142],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,144],6:[2,144],25:[2,144],26:[2,144],49:[2,144],54:[2,144],57:[2,144],73:[2,144],78:[2,144],86:[2,144],91:[2,144],93:[2,144],102:[2,144],103:82,104:[1,63],105:[1,230],106:[1,64],109:83,110:[1,66],111:67,118:[2,144],126:[2,144],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,150],6:[2,150],25:[2,150],26:[2,150],49:[2,150],54:[2,150],57:[2,150],73:[2,150],78:[2,150],86:[2,150],91:[2,150],93:[2,150],102:[2,150],104:[2,150],105:[2,150],106:[2,150],110:[2,150],118:[2,150],126:[2,150],128:[2,150],129:[2,150],132:[2,150],133:[2,150],134:[2,150],135:[2,150],136:[2,150],137:[2,150]},{1:[2,151],6:[2,151],25:[2,151],26:[2,151],49:[2,151],54:[2,151],57:[2,151],73:[2,151],78:[2,151],86:[2,151],91:[2,151],93:[2,151],102:[2,151],103:82,104:[1,63],105:[2,151],106:[1,64],109:83,110:[1,66],111:67,118:[2,151],126:[2,151],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,155],6:[2,155],25:[2,155],26:[2,155],49:[2,155],54:[2,155],57:[2,155],73:[2,155],78:[2,155],86:[2,155],91:[2,155],93:[2,155],102:[2,155],104:[2,155],105:[2,155],106:[2,155],110:[2,155],118:[2,155],126:[2,155],128:[2,155],129:[2,155],132:[2,155],133:[2,155],134:[2,155],135:[2,155],136:[2,155],137:[2,155]},{116:[2,157],117:[2,157]},{27:155,28:[1,71],44:156,58:157,59:158,76:[1,68],89:[1,109],90:[1,110],113:231,115:154},{54:[1,232],116:[2,163],117:[2,163]},{54:[2,159],116:[2,159],117:[2,159]},{54:[2,160],116:[2,160],117:[2,160]},{54:[2,161],116:[2,161],117:[2,161]},{54:[2,162],116:[2,162],117:[2,162]},{1:[2,156],6:[2,156],25:[2,156],26:[2,156],49:[2,156],54:[2,156],57:[2,156],73:[2,156],78:[2,156],86:[2,156],91:[2,156],93:[2,156],102:[2,156],104:[2,156],105:[2,156],106:[2,156],110:[2,156],118:[2,156],126:[2,156],128:[2,156],129:[2,156],132:[2,156],133:[2,156],134:[2,156],135:[2,156],136:[2,156],137:[2,156]},{7:233,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:234,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],53:235,54:[1,236],78:[2,52]},{6:[2,91],25:[2,91],26:[2,91],54:[2,91],78:[2,91]},{6:[2,38],25:[2,38],26:[2,38],43:[1,237],54:[2,38],78:[2,38]},{6:[2,41],25:[2,41],26:[2,41],54:[2,41],78:[2,41]},{6:[2,42],25:[2,42],26:[2,42],43:[2,42],54:[2,42],78:[2,42]},{6:[2,43],25:[2,43],26:[2,43],43:[2,43],54:[2,43],78:[2,43]},{6:[2,44],25:[2,44],26:[2,44],43:[2,44],54:[2,44],78:[2,44]},{1:[2,4],6:[2,4],26:[2,4],102:[2,4]},{1:[2,194],6:[2,194],25:[2,194],26:[2,194],49:[2,194],54:[2,194],57:[2,194],73:[2,194],78:[2,194],86:[2,194],91:[2,194],93:[2,194],102:[2,194],103:82,104:[2,194],105:[2,194],106:[2,194],109:83,110:[2,194],111:67,118:[2,194],126:[2,194],128:[2,194],129:[2,194],132:[1,73],133:[1,76],134:[2,194],135:[2,194],136:[2,194],137:[2,194]},{1:[2,195],6:[2,195],25:[2,195],26:[2,195],49:[2,195],54:[2,195],57:[2,195],73:[2,195],78:[2,195],86:[2,195],91:[2,195],93:[2,195],102:[2,195],103:82,104:[2,195],105:[2,195],106:[2,195],109:83,110:[2,195],111:67,118:[2,195],126:[2,195],128:[2,195],129:[2,195],132:[1,73],133:[1,76],134:[2,195],135:[2,195],136:[2,195],137:[2,195]},{1:[2,196],6:[2,196],25:[2,196],26:[2,196],49:[2,196],54:[2,196],57:[2,196],73:[2,196],78:[2,196],86:[2,196],91:[2,196],93:[2,196],102:[2,196],103:82,104:[2,196],105:[2,196],106:[2,196],109:83,110:[2,196],111:67,118:[2,196],126:[2,196],128:[2,196],129:[2,196],132:[1,73],133:[2,196],134:[2,196],135:[2,196],136:[2,196],137:[2,196]},{1:[2,197],6:[2,197],25:[2,197],26:[2,197],49:[2,197],54:[2,197],57:[2,197],73:[2,197],78:[2,197],86:[2,197],91:[2,197],93:[2,197],102:[2,197],103:82,104:[2,197],105:[2,197],106:[2,197],109:83,110:[2,197],111:67,118:[2,197],126:[2,197],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[2,197],135:[2,197],136:[2,197],137:[2,197]},{1:[2,198],6:[2,198],25:[2,198],26:[2,198],49:[2,198],54:[2,198],57:[2,198],73:[2,198],78:[2,198],86:[2,198],91:[2,198],93:[2,198],102:[2,198],103:82,104:[2,198],105:[2,198],106:[2,198],109:83,110:[2,198],111:67,118:[2,198],126:[2,198],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,198],136:[2,198],137:[1,80]},{1:[2,199],6:[2,199],25:[2,199],26:[2,199],49:[2,199],54:[2,199],57:[2,199],73:[2,199],78:[2,199],86:[2,199],91:[2,199],93:[2,199],102:[2,199],103:82,104:[2,199],105:[2,199],106:[2,199],109:83,110:[2,199],111:67,118:[2,199],126:[2,199],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[2,199],137:[1,80]},{1:[2,200],6:[2,200],25:[2,200],26:[2,200],49:[2,200],54:[2,200],57:[2,200],73:[2,200],78:[2,200],86:[2,200],91:[2,200],93:[2,200],102:[2,200],103:82,104:[2,200],105:[2,200],106:[2,200],109:83,110:[2,200],111:67,118:[2,200],126:[2,200],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[2,200],136:[2,200],137:[2,200]},{1:[2,185],6:[2,185],25:[2,185],26:[2,185],49:[2,185],54:[2,185],57:[2,185],73:[2,185],78:[2,185],86:[2,185],91:[2,185],93:[2,185],102:[2,185],103:82,104:[1,63],105:[2,185],106:[1,64],109:83,110:[1,66],111:67,118:[2,185],126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,184],6:[2,184],25:[2,184],26:[2,184],49:[2,184],54:[2,184],57:[2,184],73:[2,184],78:[2,184],86:[2,184],91:[2,184],93:[2,184],102:[2,184],103:82,104:[1,63],105:[2,184],106:[1,64],109:83,110:[1,66],111:67,118:[2,184],126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,103],6:[2,103],25:[2,103],26:[2,103],49:[2,103],54:[2,103],57:[2,103],66:[2,103],67:[2,103],68:[2,103],69:[2,103],71:[2,103],73:[2,103],74:[2,103],78:[2,103],84:[2,103],85:[2,103],86:[2,103],91:[2,103],93:[2,103],102:[2,103],104:[2,103],105:[2,103],106:[2,103],110:[2,103],118:[2,103],126:[2,103],128:[2,103],129:[2,103],132:[2,103],133:[2,103],134:[2,103],135:[2,103],136:[2,103],137:[2,103]},{1:[2,79],6:[2,79],25:[2,79],26:[2,79],40:[2,79],49:[2,79],54:[2,79],57:[2,79],66:[2,79],67:[2,79],68:[2,79],69:[2,79],71:[2,79],73:[2,79],74:[2,79],78:[2,79],80:[2,79],84:[2,79],85:[2,79],86:[2,79],91:[2,79],93:[2,79],102:[2,79],104:[2,79],105:[2,79],106:[2,79],110:[2,79],118:[2,79],126:[2,79],128:[2,79],129:[2,79],130:[2,79],131:[2,79],132:[2,79],133:[2,79],134:[2,79],135:[2,79],136:[2,79],137:[2,79],138:[2,79]},{1:[2,80],6:[2,80],25:[2,80],26:[2,80],40:[2,80],49:[2,80],54:[2,80],57:[2,80],66:[2,80],67:[2,80],68:[2,80],69:[2,80],71:[2,80],73:[2,80],74:[2,80],78:[2,80],80:[2,80],84:[2,80],85:[2,80],86:[2,80],91:[2,80],93:[2,80],102:[2,80],104:[2,80],105:[2,80],106:[2,80],110:[2,80],118:[2,80],126:[2,80],128:[2,80],129:[2,80],130:[2,80],131:[2,80],132:[2,80],133:[2,80],134:[2,80],135:[2,80],136:[2,80],137:[2,80],138:[2,80]},{1:[2,81],6:[2,81],25:[2,81],26:[2,81],40:[2,81],49:[2,81],54:[2,81],57:[2,81],66:[2,81],67:[2,81],68:[2,81],69:[2,81],71:[2,81],73:[2,81],74:[2,81],78:[2,81],80:[2,81],84:[2,81],85:[2,81],86:[2,81],91:[2,81],93:[2,81],102:[2,81],104:[2,81],105:[2,81],106:[2,81],110:[2,81],118:[2,81],126:[2,81],128:[2,81],129:[2,81],130:[2,81],131:[2,81],132:[2,81],133:[2,81],134:[2,81],135:[2,81],136:[2,81],137:[2,81],138:[2,81]},{1:[2,82],6:[2,82],25:[2,82],26:[2,82],40:[2,82],49:[2,82],54:[2,82],57:[2,82],66:[2,82],67:[2,82],68:[2,82],69:[2,82],71:[2,82],73:[2,82],74:[2,82],78:[2,82],80:[2,82],84:[2,82],85:[2,82],86:[2,82],91:[2,82],93:[2,82],102:[2,82],104:[2,82],105:[2,82],106:[2,82],110:[2,82],118:[2,82],126:[2,82],128:[2,82],129:[2,82],130:[2,82],131:[2,82],132:[2,82],133:[2,82],134:[2,82],135:[2,82],136:[2,82],137:[2,82],138:[2,82]},{73:[1,238]},{57:[1,189],73:[2,87],92:239,93:[1,188],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{73:[2,88]},{7:240,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,73:[2,122],76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{11:[2,116],28:[2,116],30:[2,116],31:[2,116],33:[2,116],34:[2,116],35:[2,116],36:[2,116],37:[2,116],38:[2,116],45:[2,116],46:[2,116],47:[2,116],51:[2,116],52:[2,116],73:[2,116],76:[2,116],79:[2,116],83:[2,116],88:[2,116],89:[2,116],90:[2,116],96:[2,116],100:[2,116],101:[2,116],104:[2,116],106:[2,116],108:[2,116],110:[2,116],119:[2,116],125:[2,116],127:[2,116],128:[2,116],129:[2,116],130:[2,116],131:[2,116]},{11:[2,117],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],73:[2,117],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{1:[2,86],6:[2,86],25:[2,86],26:[2,86],40:[2,86],49:[2,86],54:[2,86],57:[2,86],66:[2,86],67:[2,86],68:[2,86],69:[2,86],71:[2,86],73:[2,86],74:[2,86],78:[2,86],80:[2,86],84:[2,86],85:[2,86],86:[2,86],91:[2,86],93:[2,86],102:[2,86],104:[2,86],105:[2,86],106:[2,86],110:[2,86],118:[2,86],126:[2,86],128:[2,86],129:[2,86],130:[2,86],131:[2,86],132:[2,86],133:[2,86],134:[2,86],135:[2,86],136:[2,86],137:[2,86],138:[2,86]},{1:[2,104],6:[2,104],25:[2,104],26:[2,104],49:[2,104],54:[2,104],57:[2,104],66:[2,104],67:[2,104],68:[2,104],69:[2,104],71:[2,104],73:[2,104],74:[2,104],78:[2,104],84:[2,104],85:[2,104],86:[2,104],91:[2,104],93:[2,104],102:[2,104],104:[2,104],105:[2,104],106:[2,104],110:[2,104],118:[2,104],126:[2,104],128:[2,104],129:[2,104],132:[2,104],133:[2,104],134:[2,104],135:[2,104],136:[2,104],137:[2,104]},{1:[2,35],6:[2,35],25:[2,35],26:[2,35],49:[2,35],54:[2,35],57:[2,35],73:[2,35],78:[2,35],86:[2,35],91:[2,35],93:[2,35],102:[2,35],103:82,104:[2,35],105:[2,35],106:[2,35],109:83,110:[2,35],111:67,118:[2,35],126:[2,35],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:241,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:242,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,109],6:[2,109],25:[2,109],26:[2,109],49:[2,109],54:[2,109],57:[2,109],66:[2,109],67:[2,109],68:[2,109],69:[2,109],71:[2,109],73:[2,109],74:[2,109],78:[2,109],84:[2,109],85:[2,109],86:[2,109],91:[2,109],93:[2,109],102:[2,109],104:[2,109],105:[2,109],106:[2,109],110:[2,109],118:[2,109],126:[2,109],128:[2,109],129:[2,109],132:[2,109],133:[2,109],134:[2,109],135:[2,109],136:[2,109],137:[2,109]},{6:[2,52],25:[2,52],53:243,54:[1,226],86:[2,52]},{6:[2,128],25:[2,128],26:[2,128],54:[2,128],57:[1,244],86:[2,128],91:[2,128],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{50:245,51:[1,58],52:[1,59]},{6:[2,53],25:[2,53],26:[2,53],27:105,28:[1,71],44:106,55:246,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[1,247],25:[1,248]},{6:[2,60],25:[2,60],26:[2,60],49:[2,60],54:[2,60]},{7:249,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,23],6:[2,23],25:[2,23],26:[2,23],49:[2,23],54:[2,23],57:[2,23],73:[2,23],78:[2,23],86:[2,23],91:[2,23],93:[2,23],98:[2,23],99:[2,23],102:[2,23],104:[2,23],105:[2,23],106:[2,23],110:[2,23],118:[2,23],121:[2,23],123:[2,23],126:[2,23],128:[2,23],129:[2,23],132:[2,23],133:[2,23],134:[2,23],135:[2,23],136:[2,23],137:[2,23]},{6:[1,72],26:[1,250]},{1:[2,201],6:[2,201],25:[2,201],26:[2,201],49:[2,201],54:[2,201],57:[2,201],73:[2,201],78:[2,201],86:[2,201],91:[2,201],93:[2,201],102:[2,201],103:82,104:[2,201],105:[2,201],106:[2,201],109:83,110:[2,201],111:67,118:[2,201],126:[2,201],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:251,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:252,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,204],6:[2,204],25:[2,204],26:[2,204],49:[2,204],54:[2,204],57:[2,204],73:[2,204],78:[2,204],86:[2,204],91:[2,204],93:[2,204],102:[2,204],103:82,104:[2,204],105:[2,204],106:[2,204],109:83,110:[2,204],111:67,118:[2,204],126:[2,204],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,183],6:[2,183],25:[2,183],26:[2,183],49:[2,183],54:[2,183],57:[2,183],73:[2,183],78:[2,183],86:[2,183],91:[2,183],93:[2,183],102:[2,183],104:[2,183],105:[2,183],106:[2,183],110:[2,183],118:[2,183],126:[2,183],128:[2,183],129:[2,183],132:[2,183],133:[2,183],134:[2,183],135:[2,183],136:[2,183],137:[2,183]},{7:253,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,133],6:[2,133],25:[2,133],26:[2,133],49:[2,133],54:[2,133],57:[2,133],73:[2,133],78:[2,133],86:[2,133],91:[2,133],93:[2,133],98:[1,254],102:[2,133],104:[2,133],105:[2,133],106:[2,133],110:[2,133],118:[2,133],126:[2,133],128:[2,133],129:[2,133],132:[2,133],133:[2,133],134:[2,133],135:[2,133],136:[2,133],137:[2,133]},{24:255,25:[1,112]},{24:258,25:[1,112],27:256,28:[1,71],59:257,76:[1,68]},{120:259,122:216,123:[1,217]},{26:[1,260],121:[1,261],122:262,123:[1,217]},{26:[2,176],121:[2,176],123:[2,176]},{7:264,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],95:263,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,97],6:[2,97],24:265,25:[1,112],26:[2,97],49:[2,97],54:[2,97],57:[2,97],73:[2,97],78:[2,97],86:[2,97],91:[2,97],93:[2,97],102:[2,97],103:82,104:[1,63],105:[2,97],106:[1,64],109:83,110:[1,66],111:67,118:[2,97],126:[2,97],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,100],6:[2,100],25:[2,100],26:[2,100],49:[2,100],54:[2,100],57:[2,100],73:[2,100],78:[2,100],86:[2,100],91:[2,100],93:[2,100],102:[2,100],104:[2,100],105:[2,100],106:[2,100],110:[2,100],118:[2,100],126:[2,100],128:[2,100],129:[2,100],132:[2,100],133:[2,100],134:[2,100],135:[2,100],136:[2,100],137:[2,100]},{7:266,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,140],6:[2,140],25:[2,140],26:[2,140],49:[2,140],54:[2,140],57:[2,140],66:[2,140],67:[2,140],68:[2,140],69:[2,140],71:[2,140],73:[2,140],74:[2,140],78:[2,140],84:[2,140],85:[2,140],86:[2,140],91:[2,140],93:[2,140],102:[2,140],104:[2,140],105:[2,140],106:[2,140],110:[2,140],118:[2,140],126:[2,140],128:[2,140],129:[2,140],132:[2,140],133:[2,140],134:[2,140],135:[2,140],136:[2,140],137:[2,140]},{6:[1,72],26:[1,267]},{7:268,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,66],11:[2,117],25:[2,66],28:[2,117],30:[2,117],31:[2,117],33:[2,117],34:[2,117],35:[2,117],36:[2,117],37:[2,117],38:[2,117],45:[2,117],46:[2,117],47:[2,117],51:[2,117],52:[2,117],54:[2,66],76:[2,117],79:[2,117],83:[2,117],88:[2,117],89:[2,117],90:[2,117],91:[2,66],96:[2,117],100:[2,117],101:[2,117],104:[2,117],106:[2,117],108:[2,117],110:[2,117],119:[2,117],125:[2,117],127:[2,117],128:[2,117],129:[2,117],130:[2,117],131:[2,117]},{6:[1,270],25:[1,271],91:[1,269]},{6:[2,53],7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[2,53],26:[2,53],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],86:[2,53],88:[1,56],89:[1,57],90:[1,55],91:[2,53],94:272,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,52],25:[2,52],26:[2,52],53:273,54:[1,226]},{1:[2,180],6:[2,180],25:[2,180],26:[2,180],49:[2,180],54:[2,180],57:[2,180],73:[2,180],78:[2,180],86:[2,180],91:[2,180],93:[2,180],102:[2,180],104:[2,180],105:[2,180],106:[2,180],110:[2,180],118:[2,180],121:[2,180],126:[2,180],128:[2,180],129:[2,180],132:[2,180],133:[2,180],134:[2,180],135:[2,180],136:[2,180],137:[2,180]},{7:274,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:275,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{116:[2,158],117:[2,158]},{27:155,28:[1,71],44:156,58:157,59:158,76:[1,68],89:[1,109],90:[1,110],115:276},{1:[2,165],6:[2,165],25:[2,165],26:[2,165],49:[2,165],54:[2,165],57:[2,165],73:[2,165],78:[2,165],86:[2,165],91:[2,165],93:[2,165],102:[2,165],103:82,104:[2,165],105:[1,277],106:[2,165],109:83,110:[2,165],111:67,118:[1,278],126:[2,165],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,166],6:[2,166],25:[2,166],26:[2,166],49:[2,166],54:[2,166],57:[2,166],73:[2,166],78:[2,166],86:[2,166],91:[2,166],93:[2,166],102:[2,166],103:82,104:[2,166],105:[1,279],106:[2,166],109:83,110:[2,166],111:67,118:[2,166],126:[2,166],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,281],25:[1,282],78:[1,280]},{6:[2,53],10:165,25:[2,53],26:[2,53],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:283,42:164,44:168,46:[1,44],78:[2,53],89:[1,109]},{7:284,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,285],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,85],6:[2,85],25:[2,85],26:[2,85],40:[2,85],49:[2,85],54:[2,85],57:[2,85],66:[2,85],67:[2,85],68:[2,85],69:[2,85],71:[2,85],73:[2,85],74:[2,85],78:[2,85],80:[2,85],84:[2,85],85:[2,85],86:[2,85],91:[2,85],93:[2,85],102:[2,85],104:[2,85],105:[2,85],106:[2,85],110:[2,85],118:[2,85],126:[2,85],128:[2,85],129:[2,85],130:[2,85],131:[2,85],132:[2,85],133:[2,85],134:[2,85],135:[2,85],136:[2,85],137:[2,85],138:[2,85]},{7:286,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,73:[2,120],76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{73:[2,121],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,36],6:[2,36],25:[2,36],26:[2,36],49:[2,36],54:[2,36],57:[2,36],73:[2,36],78:[2,36],86:[2,36],91:[2,36],93:[2,36],102:[2,36],103:82,104:[2,36],105:[2,36],106:[2,36],109:83,110:[2,36],111:67,118:[2,36],126:[2,36],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{26:[1,287],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,270],25:[1,271],86:[1,288]},{6:[2,66],25:[2,66],26:[2,66],54:[2,66],86:[2,66],91:[2,66]},{24:289,25:[1,112]},{6:[2,56],25:[2,56],26:[2,56],49:[2,56],54:[2,56]},{27:105,28:[1,71],44:106,55:290,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[2,54],25:[2,54],26:[2,54],27:105,28:[1,71],44:106,48:291,54:[2,54],55:103,56:104,58:107,59:108,76:[1,68],89:[1,109],90:[1,110]},{6:[2,61],25:[2,61],26:[2,61],49:[2,61],54:[2,61],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,24],6:[2,24],25:[2,24],26:[2,24],49:[2,24],54:[2,24],57:[2,24],73:[2,24],78:[2,24],86:[2,24],91:[2,24],93:[2,24],98:[2,24],99:[2,24],102:[2,24],104:[2,24],105:[2,24],106:[2,24],110:[2,24],118:[2,24],121:[2,24],123:[2,24],126:[2,24],128:[2,24],129:[2,24],132:[2,24],133:[2,24],134:[2,24],135:[2,24],136:[2,24],137:[2,24]},{26:[1,292],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,203],6:[2,203],25:[2,203],26:[2,203],49:[2,203],54:[2,203],57:[2,203],73:[2,203],78:[2,203],86:[2,203],91:[2,203],93:[2,203],102:[2,203],103:82,104:[2,203],105:[2,203],106:[2,203],109:83,110:[2,203],111:67,118:[2,203],126:[2,203],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{24:293,25:[1,112],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{24:294,25:[1,112]},{1:[2,134],6:[2,134],25:[2,134],26:[2,134],49:[2,134],54:[2,134],57:[2,134],73:[2,134],78:[2,134],86:[2,134],91:[2,134],93:[2,134],102:[2,134],104:[2,134],105:[2,134],106:[2,134],110:[2,134],118:[2,134],126:[2,134],128:[2,134],129:[2,134],132:[2,134],133:[2,134],134:[2,134],135:[2,134],136:[2,134],137:[2,134]},{24:295,25:[1,112]},{24:296,25:[1,112]},{1:[2,138],6:[2,138],25:[2,138],26:[2,138],49:[2,138],54:[2,138],57:[2,138],73:[2,138],78:[2,138],86:[2,138],91:[2,138],93:[2,138],98:[2,138],102:[2,138],104:[2,138],105:[2,138],106:[2,138],110:[2,138],118:[2,138],126:[2,138],128:[2,138],129:[2,138],132:[2,138],133:[2,138],134:[2,138],135:[2,138],136:[2,138],137:[2,138]},{26:[1,297],121:[1,298],122:262,123:[1,217]},{1:[2,174],6:[2,174],25:[2,174],26:[2,174],49:[2,174],54:[2,174],57:[2,174],73:[2,174],78:[2,174],86:[2,174],91:[2,174],93:[2,174],102:[2,174],104:[2,174],105:[2,174],106:[2,174],110:[2,174],118:[2,174],126:[2,174],128:[2,174],129:[2,174],132:[2,174],133:[2,174],134:[2,174],135:[2,174],136:[2,174],137:[2,174]},{24:299,25:[1,112]},{26:[2,177],121:[2,177],123:[2,177]},{24:300,25:[1,112],54:[1,301]},{25:[2,130],54:[2,130],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,98],6:[2,98],25:[2,98],26:[2,98],49:[2,98],54:[2,98],57:[2,98],73:[2,98],78:[2,98],86:[2,98],91:[2,98],93:[2,98],102:[2,98],104:[2,98],105:[2,98],106:[2,98],110:[2,98],118:[2,98],126:[2,98],128:[2,98],129:[2,98],132:[2,98],133:[2,98],134:[2,98],135:[2,98],136:[2,98],137:[2,98]},{1:[2,101],6:[2,101],24:302,25:[1,112],26:[2,101],49:[2,101],54:[2,101],57:[2,101],73:[2,101],78:[2,101],86:[2,101],91:[2,101],93:[2,101],102:[2,101],103:82,104:[1,63],105:[2,101],106:[1,64],109:83,110:[1,66],111:67,118:[2,101],126:[2,101],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{102:[1,303]},{91:[1,304],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,115],6:[2,115],25:[2,115],26:[2,115],40:[2,115],49:[2,115],54:[2,115],57:[2,115],66:[2,115],67:[2,115],68:[2,115],69:[2,115],71:[2,115],73:[2,115],74:[2,115],78:[2,115],84:[2,115],85:[2,115],86:[2,115],91:[2,115],93:[2,115],102:[2,115],104:[2,115],105:[2,115],106:[2,115],110:[2,115],116:[2,115],117:[2,115],118:[2,115],126:[2,115],128:[2,115],129:[2,115],132:[2,115],133:[2,115],134:[2,115],135:[2,115],136:[2,115],137:[2,115]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],94:305,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:197,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,60:144,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],87:306,88:[1,56],89:[1,57],90:[1,55],94:142,96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[2,124],25:[2,124],26:[2,124],54:[2,124],86:[2,124],91:[2,124]},{6:[1,270],25:[1,271],26:[1,307]},{1:[2,143],6:[2,143],25:[2,143],26:[2,143],49:[2,143],54:[2,143],57:[2,143],73:[2,143],78:[2,143],86:[2,143],91:[2,143],93:[2,143],102:[2,143],103:82,104:[1,63],105:[2,143],106:[1,64],109:83,110:[1,66],111:67,118:[2,143],126:[2,143],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,145],6:[2,145],25:[2,145],26:[2,145],49:[2,145],54:[2,145],57:[2,145],73:[2,145],78:[2,145],86:[2,145],91:[2,145],93:[2,145],102:[2,145],103:82,104:[1,63],105:[2,145],106:[1,64],109:83,110:[1,66],111:67,118:[2,145],126:[2,145],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{116:[2,164],117:[2,164]},{7:308,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:309,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:310,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,89],6:[2,89],25:[2,89],26:[2,89],40:[2,89],49:[2,89],54:[2,89],57:[2,89],66:[2,89],67:[2,89],68:[2,89],69:[2,89],71:[2,89],73:[2,89],74:[2,89],78:[2,89],84:[2,89],85:[2,89],86:[2,89],91:[2,89],93:[2,89],102:[2,89],104:[2,89],105:[2,89],106:[2,89],110:[2,89],116:[2,89],117:[2,89],118:[2,89],126:[2,89],128:[2,89],129:[2,89],132:[2,89],133:[2,89],134:[2,89],135:[2,89],136:[2,89],137:[2,89]},{10:165,27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:311,42:164,44:168,46:[1,44],89:[1,109]},{6:[2,90],10:165,25:[2,90],26:[2,90],27:166,28:[1,71],29:167,30:[1,69],31:[1,70],41:163,42:164,44:168,46:[1,44],54:[2,90],77:312,89:[1,109]},{6:[2,92],25:[2,92],26:[2,92],54:[2,92],78:[2,92]},{6:[2,39],25:[2,39],26:[2,39],54:[2,39],78:[2,39],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{7:313,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{73:[2,119],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,37],6:[2,37],25:[2,37],26:[2,37],49:[2,37],54:[2,37],57:[2,37],73:[2,37],78:[2,37],86:[2,37],91:[2,37],93:[2,37],102:[2,37],104:[2,37],105:[2,37],106:[2,37],110:[2,37],118:[2,37],126:[2,37],128:[2,37],129:[2,37],132:[2,37],133:[2,37],134:[2,37],135:[2,37],136:[2,37],137:[2,37]},{1:[2,110],6:[2,110],25:[2,110],26:[2,110],49:[2,110],54:[2,110],57:[2,110],66:[2,110],67:[2,110],68:[2,110],69:[2,110],71:[2,110],73:[2,110],74:[2,110],78:[2,110],84:[2,110],85:[2,110],86:[2,110],91:[2,110],93:[2,110],102:[2,110],104:[2,110],105:[2,110],106:[2,110],110:[2,110],118:[2,110],126:[2,110],128:[2,110],129:[2,110],132:[2,110],133:[2,110],134:[2,110],135:[2,110],136:[2,110],137:[2,110]},{1:[2,48],6:[2,48],25:[2,48],26:[2,48],49:[2,48],54:[2,48],57:[2,48],73:[2,48],78:[2,48],86:[2,48],91:[2,48],93:[2,48],102:[2,48],104:[2,48],105:[2,48],106:[2,48],110:[2,48],118:[2,48],126:[2,48],128:[2,48],129:[2,48],132:[2,48],133:[2,48],134:[2,48],135:[2,48],136:[2,48],137:[2,48]},{6:[2,57],25:[2,57],26:[2,57],49:[2,57],54:[2,57]},{6:[2,52],25:[2,52],26:[2,52],53:314,54:[1,199]},{1:[2,202],6:[2,202],25:[2,202],26:[2,202],49:[2,202],54:[2,202],57:[2,202],73:[2,202],78:[2,202],86:[2,202],91:[2,202],93:[2,202],102:[2,202],104:[2,202],105:[2,202],106:[2,202],110:[2,202],118:[2,202],126:[2,202],128:[2,202],129:[2,202],132:[2,202],133:[2,202],134:[2,202],135:[2,202],136:[2,202],137:[2,202]},{1:[2,181],6:[2,181],25:[2,181],26:[2,181],49:[2,181],54:[2,181],57:[2,181],73:[2,181],78:[2,181],86:[2,181],91:[2,181],93:[2,181],102:[2,181],104:[2,181],105:[2,181],106:[2,181],110:[2,181],118:[2,181],121:[2,181],126:[2,181],128:[2,181],129:[2,181],132:[2,181],133:[2,181],134:[2,181],135:[2,181],136:[2,181],137:[2,181]},{1:[2,135],6:[2,135],25:[2,135],26:[2,135],49:[2,135],54:[2,135],57:[2,135],73:[2,135],78:[2,135],86:[2,135],91:[2,135],93:[2,135],102:[2,135],104:[2,135],105:[2,135],106:[2,135],110:[2,135],118:[2,135],126:[2,135],128:[2,135],129:[2,135],132:[2,135],133:[2,135],134:[2,135],135:[2,135],136:[2,135],137:[2,135]},{1:[2,136],6:[2,136],25:[2,136],26:[2,136],49:[2,136],54:[2,136],57:[2,136],73:[2,136],78:[2,136],86:[2,136],91:[2,136],93:[2,136],98:[2,136],102:[2,136],104:[2,136],105:[2,136],106:[2,136],110:[2,136],118:[2,136],126:[2,136],128:[2,136],129:[2,136],132:[2,136],133:[2,136],134:[2,136],135:[2,136],136:[2,136],137:[2,136]},{1:[2,137],6:[2,137],25:[2,137],26:[2,137],49:[2,137],54:[2,137],57:[2,137],73:[2,137],78:[2,137],86:[2,137],91:[2,137],93:[2,137],98:[2,137],102:[2,137],104:[2,137],105:[2,137],106:[2,137],110:[2,137],118:[2,137],126:[2,137],128:[2,137],129:[2,137],132:[2,137],133:[2,137],134:[2,137],135:[2,137],136:[2,137],137:[2,137]},{1:[2,172],6:[2,172],25:[2,172],26:[2,172],49:[2,172],54:[2,172],57:[2,172],73:[2,172],78:[2,172],86:[2,172],91:[2,172],93:[2,172],102:[2,172],104:[2,172],105:[2,172],106:[2,172],110:[2,172],118:[2,172],126:[2,172],128:[2,172],129:[2,172],132:[2,172],133:[2,172],134:[2,172],135:[2,172],136:[2,172],137:[2,172]},{24:315,25:[1,112]},{26:[1,316]},{6:[1,317],26:[2,178],121:[2,178],123:[2,178]},{7:318,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{1:[2,102],6:[2,102],25:[2,102],26:[2,102],49:[2,102],54:[2,102],57:[2,102],73:[2,102],78:[2,102],86:[2,102],91:[2,102],93:[2,102],102:[2,102],104:[2,102],105:[2,102],106:[2,102],110:[2,102],118:[2,102],126:[2,102],128:[2,102],129:[2,102],132:[2,102],133:[2,102],134:[2,102],135:[2,102],136:[2,102],137:[2,102]},{1:[2,141],6:[2,141],25:[2,141],26:[2,141],49:[2,141],54:[2,141],57:[2,141],66:[2,141],67:[2,141],68:[2,141],69:[2,141],71:[2,141],73:[2,141],74:[2,141],78:[2,141],84:[2,141],85:[2,141],86:[2,141],91:[2,141],93:[2,141],102:[2,141],104:[2,141],105:[2,141],106:[2,141],110:[2,141],118:[2,141],126:[2,141],128:[2,141],129:[2,141],132:[2,141],133:[2,141],134:[2,141],135:[2,141],136:[2,141],137:[2,141]},{1:[2,118],6:[2,118],25:[2,118],26:[2,118],49:[2,118],54:[2,118],57:[2,118],66:[2,118],67:[2,118],68:[2,118],69:[2,118],71:[2,118],73:[2,118],74:[2,118],78:[2,118],84:[2,118],85:[2,118],86:[2,118],91:[2,118],93:[2,118],102:[2,118],104:[2,118],105:[2,118],106:[2,118],110:[2,118],118:[2,118],126:[2,118],128:[2,118],129:[2,118],132:[2,118],133:[2,118],134:[2,118],135:[2,118],136:[2,118],137:[2,118]},{6:[2,125],25:[2,125],26:[2,125],54:[2,125],86:[2,125],91:[2,125]},{6:[2,52],25:[2,52],26:[2,52],53:319,54:[1,226]},{6:[2,126],25:[2,126],26:[2,126],54:[2,126],86:[2,126],91:[2,126]},{1:[2,167],6:[2,167],25:[2,167],26:[2,167],49:[2,167],54:[2,167],57:[2,167],73:[2,167],78:[2,167],86:[2,167],91:[2,167],93:[2,167],102:[2,167],103:82,104:[2,167],105:[2,167],106:[2,167],109:83,110:[2,167],111:67,118:[1,320],126:[2,167],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,169],6:[2,169],25:[2,169],26:[2,169],49:[2,169],54:[2,169],57:[2,169],73:[2,169],78:[2,169],86:[2,169],91:[2,169],93:[2,169],102:[2,169],103:82,104:[2,169],105:[1,321],106:[2,169],109:83,110:[2,169],111:67,118:[2,169],126:[2,169],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,168],6:[2,168],25:[2,168],26:[2,168],49:[2,168],54:[2,168],57:[2,168],73:[2,168],78:[2,168],86:[2,168],91:[2,168],93:[2,168],102:[2,168],103:82,104:[2,168],105:[2,168],106:[2,168],109:83,110:[2,168],111:67,118:[2,168],126:[2,168],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[2,93],25:[2,93],26:[2,93],54:[2,93],78:[2,93]},{6:[2,52],25:[2,52],26:[2,52],53:322,54:[1,236]},{26:[1,323],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,247],25:[1,248],26:[1,324]},{26:[1,325]},{1:[2,175],6:[2,175],25:[2,175],26:[2,175],49:[2,175],54:[2,175],57:[2,175],73:[2,175],78:[2,175],86:[2,175],91:[2,175],93:[2,175],102:[2,175],104:[2,175],105:[2,175],106:[2,175],110:[2,175],118:[2,175],126:[2,175],128:[2,175],129:[2,175],132:[2,175],133:[2,175],134:[2,175],135:[2,175],136:[2,175],137:[2,175]},{26:[2,179],121:[2,179],123:[2,179]},{25:[2,131],54:[2,131],103:82,104:[1,63],106:[1,64],109:83,110:[1,66],111:67,126:[1,81],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[1,270],25:[1,271],26:[1,326]},{7:327,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{7:328,8:114,9:18,10:19,11:[1,20],12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:60,28:[1,71],29:47,30:[1,69],31:[1,70],32:22,33:[1,48],34:[1,49],35:[1,50],36:[1,51],37:[1,52],38:[1,53],39:21,44:61,45:[1,43],46:[1,44],47:[1,27],50:28,51:[1,58],52:[1,59],58:45,59:46,61:34,63:23,64:24,65:25,76:[1,68],79:[1,41],83:[1,26],88:[1,56],89:[1,57],90:[1,55],96:[1,36],100:[1,42],101:[1,54],103:37,104:[1,63],106:[1,64],107:38,108:[1,65],109:39,110:[1,66],111:67,119:[1,40],124:35,125:[1,62],127:[1,29],128:[1,30],129:[1,31],130:[1,32],131:[1,33]},{6:[1,281],25:[1,282],26:[1,329]},{6:[2,40],25:[2,40],26:[2,40],54:[2,40],78:[2,40]},{6:[2,58],25:[2,58],26:[2,58],49:[2,58],54:[2,58]},{1:[2,173],6:[2,173],25:[2,173],26:[2,173],49:[2,173],54:[2,173],57:[2,173],73:[2,173],78:[2,173],86:[2,173],91:[2,173],93:[2,173],102:[2,173],104:[2,173],105:[2,173],106:[2,173],110:[2,173],118:[2,173],126:[2,173],128:[2,173],129:[2,173],132:[2,173],133:[2,173],134:[2,173],135:[2,173],136:[2,173],137:[2,173]},{6:[2,127],25:[2,127],26:[2,127],54:[2,127],86:[2,127],91:[2,127]},{1:[2,170],6:[2,170],25:[2,170],26:[2,170],49:[2,170],54:[2,170],57:[2,170],73:[2,170],78:[2,170],86:[2,170],91:[2,170],93:[2,170],102:[2,170],103:82,104:[2,170],105:[2,170],106:[2,170],109:83,110:[2,170],111:67,118:[2,170],126:[2,170],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{1:[2,171],6:[2,171],25:[2,171],26:[2,171],49:[2,171],54:[2,171],57:[2,171],73:[2,171],78:[2,171],86:[2,171],91:[2,171],93:[2,171],102:[2,171],103:82,104:[2,171],105:[2,171],106:[2,171],109:83,110:[2,171],111:67,118:[2,171],126:[2,171],128:[1,75],129:[1,74],132:[1,73],133:[1,76],134:[1,77],135:[1,78],136:[1,79],137:[1,80]},{6:[2,94],25:[2,94],26:[2,94],54:[2,94],78:[2,94]}],defaultActions:{58:[2,50],59:[2,51],89:[2,108],186:[2,88]},parseError:function(e,t){if(!t.recoverable){var n=new Error(e);throw n.location=t.loc,n}this.trace(e)},parse:function(e){function t(e){i.length=i.length-2*e,s.length=s.length-e,o.length=o.length-e}function n(){var e;return e=r.lexer.lex()||p,typeof e!=\"number\"&&(e=r.symbols_[e]||e),e}var r=this,i=[0],s=[null],o=[],u=this.table,a=\"\",f=0,l=0,c=0,h=2,p=1;this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,this.yy.parser=this,typeof this.lexer.yylloc==\"undefined\"&&(this.lexer.yylloc={});var d=this.lexer.yylloc;o.push(d);var v=this.lexer.options&&this.lexer.options.ranges;typeof this.yy.parseError==\"function\"?this.parseError=this.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;var m,g,y,b,w,E,S={},x,T,N,C;for(;;){y=i[i.length-1];if(this.defaultActions[y])b=this.defaultActions[y];else{if(m===null||typeof m==\"undefined\")m=n();b=u[y]&&u[y][m]}if(typeof b==\"undefined\"||!b.length||!b[0]){var k=\"\";C=[];for(x in u[y])this.terminals_[x]&&x>h&&C.push(\"'\"+this.terminals_[x]+\"'\");this.lexer.showPosition?k=\"Expecting \"+C.join(\", \")+\", got '\"+(this.terminals_[m]||m)+\"'\":k=\"Unexpected \"+(m==p?\"end of input\":\"'\"+(this.terminals_[m]||m)+\"'\"),this.lexer.yylloc.first_line!==d.first_line&&(d=this.lexer.yylloc),this.parseError(k,{text:this.lexer.match,token:this.terminals_[m]||m,line:this.lexer.yylineno,loc:d,expected:C})}if(b[0]instanceof Array&&b.length>1)throw new Error(\"Parse Error: multiple actions possible at state: \"+y+\", token: \"+m);switch(b[0]){case 1:i.push(m),s.push(this.lexer.yytext),o.push(this.lexer.yylloc),i.push(b[1]),m=null,g?(m=g,g=null):(l=this.lexer.yyleng,a=this.lexer.yytext,f=this.lexer.yylineno,d=this.lexer.yylloc,c>0&&c--);break;case 2:T=this.productions_[b[1]][1],S.$=s[s.length-T],S._$={first_line:o[o.length-(T||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(T||1)].first_column,last_column:o[o.length-1].last_column},v&&(S._$.range=[o[o.length-(T||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.call(S,a,l,f,this.yy,b[1],s,o);if(typeof E!=\"undefined\")return E;T&&(i=i.slice(0,-1*T*2),s=s.slice(0,-1*T),o=o.slice(0,-1*T)),i.push(this.productions_[b[1]][0]),s.push(S.$),o.push(S._$),N=u[i[i.length-2]][i[i.length-1]],i.push(N);break;case 3:return!0}}return!0}};undefined,r.prototype=i,i.Parser=r,n.exports=new r}),define(\"ace/mode/coffee_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/coffee/coffee-script\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../worker/mirror\").Mirror,s=e(\"../mode/coffee/coffee-script\");window.addEventListener=function(){};var o=t.Worker=function(e){i.call(this,e),this.setTimeout(250)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue();try{s.parse(e).compile()}catch(t){var n=t.location;n&&this.sender.emit(\"error\",{row:n.first_line,column:n.first_column,endRow:n.last_line,endColumn:n.last_column,text:t.message,type:\"error\"});return}this.sender.emit(\"ok\")}}.call(o.prototype)}),define(\"ace/mode/coffee/nodes\",[\"require\",\"exports\",\"module\",\"ace/mode/coffee/scope\",\"ace/mode/coffee/lexer\",\"ace/mode/coffee/helpers\"],function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p,d,v,m,g,y,b,w,E,S,x,T,N,C,k,L,A,O,M,_,D,P,H,B,j,F,I,q,R,U,z,W,X,V,$,J,K,Q,G,Y,Z,et,tt,nt,rt,it,st,ot,ut,at,ft,lt,ct,ht,pt,dt,vt,mt,gt,yt,bt,wt,Et,St,xt={}.hasOwnProperty,Tt=function(e,t){function n(){this.constructor=e}for(var r in t)xt.call(t,r)&&(e[r]=t[r]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},Nt=[].indexOf||function(e){for(var t=0,n=this.length;t<n;t++)if(t in this&&this[t]===e)return t;return-1},Ct=[].slice;Error.stackTraceLimit=Infinity,W=e(\"./scope\").Scope,Et=e(\"./lexer\"),I=Et.RESERVED,z=Et.STRICT_PROSCRIBED,St=e(\"./helpers\"),rt=St.compact,ut=St.flatten,ot=St.extend,pt=St.merge,it=St.del,gt=St.starts,st=St.ends,ct=St.last,mt=St.some,nt=St.addLocationDataFn,ht=St.locationDataToString,yt=St.throwSyntaxError,t.extend=ot,t.addLocationDataFn=nt,tt=function(){return!0},D=function(){return!1},K=function(){return this},_=function(){return this.negated=!this.negated,this},t.CodeFragment=c=function(){function e(e,t){var n;this.code=\"\"+t,this.locationData=e!=null?e.locationData:void 0,this.type=(e!=null?(n=e.constructor)!=null?n.name:void 0:void 0)||\"unknown\"}return e.prototype.toString=function(){return\"\"+this.code+(this.locationData?\": \"+ht(this.locationData):\"\")},e}(),at=function(e){var t;return function(){var n,r,i;i=[];for(n=0,r=e.length;n<r;n++)t=e[n],i.push(t.code);return i}().join(\"\")},t.Base=o=function(){function e(){}return e.prototype.compile=function(e,t){return at(this.compileToFragments(e,t))},e.prototype.compileToFragments=function(e,t){var n;return e=ot({},e),t&&(e.level=t),n=this.unfoldSoak(e)||this,n.tab=e.indent,e.level===A||!n.isStatement(e)?n.compileNode(e):n.compileClosure(e)},e.prototype.compileClosure=function(e){var t,n,i,s,o;(s=this.jumps())&&s.error(\"cannot use a pure statement in an expression\"),e.sharedScope=!0,i=new l([],u.wrap([this])),t=[];if((n=this.contains(ft))||this.contains(lt))t=[new O(\"this\")],n?(o=\"apply\",t.push(new O(\"arguments\"))):o=\"call\",i=new Z(i,[new r(new O(o))]);return(new a(i,t)).compileNode(e)},e.prototype.cache=function(e,t,n){var r,i;return this.isComplex()?(r=new O(n||e.scope.freeVariable(\"ref\")),i=new s(r,this),t?[i.compileToFragments(e,t),[this.makeCode(r.value)]]:[i,r]):(r=t?this.compileToFragments(e,t):this,[r,r])},e.prototype.cacheToCodeFragments=function(e){return[at(e[0]),at(e[1])]},e.prototype.makeReturn=function(e){var t;return t=this.unwrapAll(),e?new a(new O(\"\"+e+\".push\"),[t]):new R(t)},e.prototype.contains=function(e){var t;return t=void 0,this.traverseChildren(!1,function(n){if(e(n))return t=n,!1}),t},e.prototype.lastNonComment=function(e){var t;t=e.length;while(t--)if(!(e[t]instanceof h))return e[t];return null},e.prototype.toString=function(e,t){var n;return e==null&&(e=\"\"),t==null&&(t=this.constructor.name),n=\"\\n\"+e+t,this.soak&&(n+=\"?\"),this.eachChild(function(t){return n+=t.toString(e+J)}),n},e.prototype.eachChild=function(e){var t,n,r,i,s,o,u,a;if(!this.children)return this;u=this.children;for(r=0,s=u.length;r<s;r++){t=u[r];if(this[t]){a=ut([this[t]]);for(i=0,o=a.length;i<o;i++){n=a[i];if(e(n)===!1)return this}}}return this},e.prototype.traverseChildren=function(e,t){return this.eachChild(function(n){var r;r=t(n);if(r!==!1)return n.traverseChildren(e,t)})},e.prototype.invert=function(){return new B(\"!\",this)},e.prototype.unwrapAll=function(){var e;e=this;while(e!==(e=e.unwrap()))continue;return e},e.prototype.children=[],e.prototype.isStatement=D,e.prototype.jumps=D,e.prototype.isComplex=tt,e.prototype.isChainable=D,e.prototype.isAssignable=D,e.prototype.unwrap=K,e.prototype.unfoldSoak=D,e.prototype.assigns=D,e.prototype.updateLocationDataIfMissing=function(e){return this.locationData?this:(this.locationData=e,this.eachChild(function(t){return t.updateLocationDataIfMissing(e)}))},e.prototype.error=function(e){return yt(e,this.locationData)},e.prototype.makeCode=function(e){return new c(this,e)},e.prototype.wrapInBraces=function(e){return[].concat(this.makeCode(\"(\"),e,this.makeCode(\")\"))},e.prototype.joinFragmentArrays=function(e,t){var n,r,i,s,o;n=[];for(i=s=0,o=e.length;s<o;i=++s)r=e[i],i&&n.push(this.makeCode(t)),n=n.concat(r);return n},e}(),t.Block=u=function(e){function t(e){this.expressions=rt(ut(e||[]))}return Tt(t,e),t.prototype.children=[\"expressions\"],t.prototype.push=function(e){return this.expressions.push(e),this},t.prototype.pop=function(){return this.expressions.pop()},t.prototype.unshift=function(e){return this.expressions.unshift(e),this},t.prototype.unwrap=function(){return this.expressions.length===1?this.expressions[0]:this},t.prototype.isEmpty=function(){return!this.expressions.length},t.prototype.isStatement=function(e){var t,n,r,i;i=this.expressions;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.isStatement(e))return!0}return!1},t.prototype.jumps=function(e){var t,n,r,i,s;s=this.expressions;for(r=0,i=s.length;r<i;r++){t=s[r];if(n=t.jumps(e))return n}},t.prototype.makeReturn=function(e){var t,n;n=this.expressions.length;while(n--){t=this.expressions[n];if(!(t instanceof h)){this.expressions[n]=t.makeReturn(e),t instanceof R&&!t.expression&&this.expressions.splice(n,1);break}}return this},t.prototype.compileToFragments=function(e,n){return e==null&&(e={}),e.scope?t.__super__.compileToFragments.call(this,e,n):this.compileRoot(e)},t.prototype.compileNode=function(e){var n,r,i,s,o,u,a,f,l;this.tab=e.indent,u=e.level===A,r=[],l=this.expressions;for(s=a=0,f=l.length;a<f;s=++a)o=l[s],o=o.unwrapAll(),o=o.unfoldSoak(e)||o,o instanceof t?r.push(o.compileNode(e)):u?(o.front=!0,i=o.compileToFragments(e),o.isStatement(e)||(i.unshift(this.makeCode(\"\"+this.tab)),i.push(this.makeCode(\";\"))),r.push(i)):r.push(o.compileToFragments(e,C));return u?this.spaced?[].concat(this.joinFragmentArrays(r,\"\\n\\n\"),this.makeCode(\"\\n\")):this.joinFragmentArrays(r,\"\\n\"):(r.length?n=this.joinFragmentArrays(r,\", \"):n=[this.makeCode(\"void 0\")],r.length>1&&e.level>=C?this.wrapInBraces(n):n)},t.prototype.compileRoot=function(e){var t,n,r,i,s,o,u,a,f,l;e.indent=e.bare?\"\":J,e.level=A,this.spaced=!0,e.scope=new W(null,this,null),l=e.locals||[];for(a=0,f=l.length;a<f;a++)i=l[a],e.scope.parameter(i);return s=[],e.bare||(o=function(){var e,n,i,s;i=this.expressions,s=[];for(r=e=0,n=i.length;e<n;r=++e){t=i[r];if(!(t.unwrap()instanceof h))break;s.push(t)}return s}.call(this),u=this.expressions.slice(o.length),this.expressions=o,o.length&&(s=this.compileNode(pt(e,{indent:\"\"})),s.push(this.makeCode(\"\\n\"))),this.expressions=u),n=this.compileWithDeclarations(e),e.bare?n:[].concat(s,this.makeCode(\"(function() {\\n\"),n,this.makeCode(\"\\n}).call(this);\\n\"))},t.prototype.compileWithDeclarations=function(e){var t,n,r,i,s,o,u,a,f,l,c,p,d,v;i=[],o=[],p=this.expressions;for(s=l=0,c=p.length;l<c;s=++l){r=p[s],r=r.unwrap();if(!(r instanceof h||r instanceof O))break}return e=pt(e,{level:A}),s&&(u=this.expressions.splice(s,9e9),d=[this.spaced,!1],f=d[0],this.spaced=d[1],v=[this.compileNode(e),f],i=v[0],this.spaced=v[1],this.expressions=u),o=this.compileNode(e),a=e.scope,a.expressions===this&&(n=e.scope.hasDeclarations(),t=a.hasAssignments,n||t?(s&&i.push(this.makeCode(\"\\n\")),i.push(this.makeCode(\"\"+this.tab+\"var \")),n&&i.push(this.makeCode(a.declaredVariables().join(\", \"))),t&&(n&&i.push(this.makeCode(\",\\n\"+(this.tab+J))),i.push(this.makeCode(a.assignedVariables().join(\",\\n\"+(this.tab+J))))),i.push(this.makeCode(\";\\n\"+(this.spaced?\"\\n\":\"\")))):i.length&&o.length&&i.push(this.makeCode(\"\\n\"))),i.concat(o)},t.wrap=function(e){return e.length===1&&e[0]instanceof t?e[0]:new t(e)},t}(o),t.Literal=O=function(e){function t(e){this.value=e}return Tt(t,e),t.prototype.makeReturn=function(){return this.isStatement()?this:t.__super__.makeReturn.apply(this,arguments)},t.prototype.isAssignable=function(){return g.test(this.value)},t.prototype.isStatement=function(){var e;return(e=this.value)===\"break\"||e===\"continue\"||e===\"debugger\"},t.prototype.isComplex=D,t.prototype.assigns=function(e){return e===this.value},t.prototype.jumps=function(e){if(this.value===\"break\"&&!((e!=null?e.loop:void 0)||(e!=null?e.block:void 0)))return this;if(this.value===\"continue\"&&(e!=null?!e.loop:!void 0))return this},t.prototype.compileNode=function(e){var t,n,r;return n=this.value===\"this\"?((r=e.scope.method)!=null?r.bound:void 0)?e.scope.method.context:this.value:this.value.reserved?'\"'+this.value+'\"':this.value,t=this.isStatement()?\"\"+this.tab+n+\";\":n,[this.makeCode(t)]},t.prototype.toString=function(){return' \"'+this.value+'\"'},t}(o),t.Undefined=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Tt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(e){return[this.makeCode(e.level>=T?\"(void 0)\":\"void 0\")]},t}(o),t.Null=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return Tt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode(\"null\")]},t}(o),t.Bool=function(e){function t(e){this.val=e}return Tt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode(this.val)]},t}(o),t.Return=R=function(e){function t(e){e&&!e.unwrap().isUndefined&&(this.expression=e)}return Tt(t,e),t.prototype.children=[\"expression\"],t.prototype.isStatement=tt,t.prototype.makeReturn=K,t.prototype.jumps=K,t.prototype.compileToFragments=function(e,n){var r,i;return r=(i=this.expression)!=null?i.makeReturn():void 0,!r||r instanceof t?t.__super__.compileToFragments.call(this,e,n):r.compileToFragments(e,n)},t.prototype.compileNode=function(e){var t;return t=[],t.push(this.makeCode(this.tab+(\"return\"+(this.expression?\" \":\"\")))),this.expression&&(t=t.concat(this.expression.compileToFragments(e,L))),t.push(this.makeCode(\";\")),t},t}(o),t.Value=Z=function(e){function t(e,n,r){return!n&&e instanceof t?e:(this.base=e,this.properties=n||[],r&&(this[r]=!0),this)}return Tt(t,e),t.prototype.children=[\"base\",\"properties\"],t.prototype.add=function(e){return this.properties=this.properties.concat(e),this},t.prototype.hasProperties=function(){return!!this.properties.length},t.prototype.bareLiteral=function(e){return!this.properties.length&&this.base instanceof e},t.prototype.isArray=function(){return this.bareLiteral(i)},t.prototype.isRange=function(){return this.bareLiteral(q)},t.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()},t.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()},t.prototype.isSimpleNumber=function(){return this.bareLiteral(O)&&U.test(this.base.value)},t.prototype.isString=function(){return this.bareLiteral(O)&&w.test(this.base.value)},t.prototype.isRegex=function(){return this.bareLiteral(O)&&b.test(this.base.value)},t.prototype.isAtomic=function(){var e,t,n,r;r=this.properties.concat(this.base);for(t=0,n=r.length;t<n;t++){e=r[t];if(e.soak||e instanceof a)return!1}return!0},t.prototype.isNotCallable=function(){return this.isSimpleNumber()||this.isString()||this.isRegex()||this.isArray()||this.isRange()||this.isSplice()||this.isObject()},t.prototype.isStatement=function(e){return!this.properties.length&&this.base.isStatement(e)},t.prototype.assigns=function(e){return!this.properties.length&&this.base.assigns(e)},t.prototype.jumps=function(e){return!this.properties.length&&this.base.jumps(e)},t.prototype.isObject=function(e){return this.properties.length?!1:this.base instanceof H&&(!e||this.base.generated)},t.prototype.isSplice=function(){return ct(this.properties)instanceof X},t.prototype.looksStatic=function(e){var t;return this.base.value===e&&this.properties.length&&((t=this.properties[0].name)!=null?t.value:void 0)!==\"prototype\"},t.prototype.unwrap=function(){return this.properties.length?this:this.base},t.prototype.cacheReference=function(e){var n,r,i,o;return i=ct(this.properties),this.properties.length<2&&!this.base.isComplex()&&(i!=null?!i.isComplex():!void 0)?[this,this]:(n=new t(this.base,this.properties.slice(0,-1)),n.isComplex()&&(r=new O(e.scope.freeVariable(\"base\")),n=new t(new F(new s(r,n)))),i?(i.isComplex()&&(o=new O(e.scope.freeVariable(\"name\")),i=new x(new s(o,i.index)),o=new x(o)),[n.add(i),new t(r||n.base,[o||i])]):[n,r])},t.prototype.compileNode=function(e){var t,n,r,i,s;this.base.front=this.front,r=this.properties,t=this.base.compileToFragments(e,r.length?T:null),(this.base instanceof F||r.length)&&U.test(at(t))&&t.push(this.makeCode(\".\"));for(i=0,s=r.length;i<s;i++)n=r[i],t.push.apply(t,n.compileToFragments(e));return t},t.prototype.unfoldSoak=function(e){return this.unfoldedSoak!=null?this.unfoldedSoak:this.unfoldedSoak=function(n){return function(){var r,i,o,u,a,f,l,c,h,d;if(o=n.base.unfoldSoak(e))return(h=o.body.properties).push.apply(h,n.properties),o;d=n.properties;for(i=l=0,c=d.length;l<c;i=++l){u=d[i];if(!u.soak)continue;return u.soak=!1,r=new t(n.base,n.properties.slice(0,i)),f=new t(n.base,n.properties.slice(i)),r.isComplex()&&(a=new O(e.scope.freeVariable(\"ref\")),r=new F(new s(a,r)),f.base=a),new E(new p(r),f,{soak:!0})}return!1}}(this)()},t}(o),t.Comment=h=function(e){function t(e){this.comment=e}return Tt(t,e),t.prototype.isStatement=tt,t.prototype.makeReturn=K,t.prototype.compileNode=function(e,t){var n,r;return r=this.comment.replace(/^(\\s*)#/gm,\"$1 *\"),n=\"/*\"+dt(r,this.tab)+(Nt.call(r,\"\\n\")>=0?\"\\n\"+this.tab:\"\")+\" */\",(t||e.level)===A&&(n=e.indent+n),[this.makeCode(\"\\n\"),this.makeCode(n)]},t}(o),t.Call=a=function(e){function t(e,t,n){this.args=t!=null?t:[],this.soak=n,this.isNew=!1,this.isSuper=e===\"super\",this.variable=this.isSuper?null:e,e instanceof Z&&e.isNotCallable()&&e.error(\"literal is not a function\")}return Tt(t,e),t.prototype.children=[\"variable\",\"args\"],t.prototype.newInstance=function(){var e,n;return e=((n=this.variable)!=null?n.base:void 0)||this.variable,e instanceof t&&!e.isNew?e.newInstance():this.isNew=!0,this},t.prototype.superReference=function(e){var t,n;return n=e.scope.namedMethod(),(n!=null?n.klass:void 0)?(t=[new r(new O(\"__super__\"))],n[\"static\"]&&t.push(new r(new O(\"constructor\"))),t.push(new r(new O(n.name))),(new Z(new O(n.klass),t)).compile(e)):(n!=null?n.ctor:void 0)?\"\"+n.name+\".__super__.constructor\":this.error(\"cannot call super outside of an instance method.\")},t.prototype.superThis=function(e){var t;return t=e.scope.method,t&&!t.klass&&t.context||\"this\"},t.prototype.unfoldSoak=function(e){var n,r,i,s,o,u,a,f,l;if(this.soak){if(this.variable){if(r=bt(e,this,\"variable\"))return r;f=(new Z(this.variable)).cacheReference(e),i=f[0],o=f[1]}else i=new O(this.superReference(e)),o=new Z(i);return o=new t(o,this.args),o.isNew=this.isNew,i=new O(\"typeof \"+i.compile(e)+' === \"function\"'),new E(i,new Z(o),{soak:!0})}n=this,s=[];for(;;){if(n.variable instanceof t){s.push(n),n=n.variable;continue}if(!(n.variable instanceof Z))break;s.push(n);if(!((n=n.variable.base)instanceof t))break}l=s.reverse();for(u=0,a=l.length;u<a;u++)n=l[u],r&&(n.variable instanceof t?n.variable=r:n.variable.base=r),r=bt(e,n,\"variable\");return r},t.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,l;(f=this.variable)!=null&&(f.front=this.front),i=V.compileSplattedArray(e,this.args,!0);if(i.length)return this.compileSplat(e,i);r=[],l=this.args;for(n=u=0,a=l.length;u<a;n=++u)t=l[n],n&&r.push(this.makeCode(\", \")),r.push.apply(r,t.compileToFragments(e,C));return s=[],this.isSuper?(o=this.superReference(e)+(\".call(\"+this.superThis(e)),r.length&&(o+=\", \"),s.push(this.makeCode(o))):(this.isNew&&s.push(this.makeCode(\"new \")),s.push.apply(s,this.variable.compileToFragments(e,T)),s.push(this.makeCode(\"(\"))),s.push.apply(s,r),s.push(this.makeCode(\")\")),s},t.prototype.compileSplat=function(e,t){var n,r,i,s,o,u;return this.isSuper?[].concat(this.makeCode(\"\"+this.superReference(e)+\".apply(\"+this.superThis(e)+\", \"),t,this.makeCode(\")\")):this.isNew?(s=this.tab+J,[].concat(this.makeCode(\"(function(func, args, ctor) {\\n\"+s+\"ctor.prototype = func.prototype;\\n\"+s+\"var child = new ctor, result = func.apply(child, args);\\n\"+s+\"return Object(result) === result ? result : child;\\n\"+this.tab+\"})(\"),this.variable.compileToFragments(e,C),this.makeCode(\", \"),t,this.makeCode(\", function(){})\"))):(n=[],r=new Z(this.variable),(o=r.properties.pop())&&r.isComplex()?(u=e.scope.freeVariable(\"ref\"),n=n.concat(this.makeCode(\"(\"+u+\" = \"),r.compileToFragments(e,C),this.makeCode(\")\"),o.compileToFragments(e))):(i=r.compileToFragments(e,T),U.test(at(i))&&(i=this.wrapInBraces(i)),o?(u=at(i),i.push.apply(i,o.compileToFragments(e))):u=\"null\",n=n.concat(i)),n=n.concat(this.makeCode(\".apply(\"+u+\", \"),t,this.makeCode(\")\")))},t}(o),t.Extends=d=function(e){function t(e,t){this.child=e,this.parent=t}return Tt(t,e),t.prototype.children=[\"child\",\"parent\"],t.prototype.compileToFragments=function(e){return(new a(new Z(new O(wt(\"extends\"))),[this.child,this.parent])).compileToFragments(e)},t}(o),t.Access=r=function(e){function t(e,t){this.name=e,this.name.asKey=!0,this.soak=t===\"soak\"}return Tt(t,e),t.prototype.children=[\"name\"],t.prototype.compileToFragments=function(e){var t;return t=this.name.compileToFragments(e),g.test(at(t))?t.unshift(this.makeCode(\".\")):(t.unshift(this.makeCode(\"[\")),t.push(this.makeCode(\"]\"))),t},t.prototype.isComplex=D,t}(o),t.Index=x=function(e){function t(e){this.index=e}return Tt(t,e),t.prototype.children=[\"index\"],t.prototype.compileToFragments=function(e){return[].concat(this.makeCode(\"[\"),this.index.compileToFragments(e,L),this.makeCode(\"]\"))},t.prototype.isComplex=function(){return this.index.isComplex()},t}(o),t.Range=q=function(e){function t(e,t,n){this.from=e,this.to=t,this.exclusive=n===\"exclusive\",this.equals=this.exclusive?\"\":\"=\"}return Tt(t,e),t.prototype.children=[\"from\",\"to\"],t.prototype.compileVariables=function(e){var t,n,r,i,s;e=pt(e,{top:!0}),n=this.cacheToCodeFragments(this.from.cache(e,C)),this.fromC=n[0],this.fromVar=n[1],r=this.cacheToCodeFragments(this.to.cache(e,C)),this.toC=r[0],this.toVar=r[1];if(t=it(e,\"step\"))i=this.cacheToCodeFragments(t.cache(e,C)),this.step=i[0],this.stepVar=i[1];s=[this.fromVar.match(P),this.toVar.match(P)],this.fromNum=s[0],this.toNum=s[1];if(this.stepVar)return this.stepNum=this.stepVar.match(P)},t.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d;return this.fromVar||this.compileVariables(e),e.index?(u=this.fromNum&&this.toNum,s=it(e,\"index\"),o=it(e,\"name\"),f=o&&o!==s,h=\"\"+s+\" = \"+this.fromC,this.toC!==this.toVar&&(h+=\", \"+this.toC),this.step!==this.stepVar&&(h+=\", \"+this.step),p=[\"\"+s+\" <\"+this.equals,\"\"+s+\" >\"+this.equals],a=p[0],i=p[1],n=this.stepNum?vt(this.stepNum[0])>0?\"\"+a+\" \"+this.toVar:\"\"+i+\" \"+this.toVar:u?(d=[vt(this.fromNum[0]),vt(this.toNum[0])],r=d[0],c=d[1],d,r<=c?\"\"+a+\" \"+c:\"\"+i+\" \"+c):(t=this.stepVar?\"\"+this.stepVar+\" > 0\":\"\"+this.fromVar+\" <= \"+this.toVar,\"\"+t+\" ? \"+a+\" \"+this.toVar+\" : \"+i+\" \"+this.toVar),l=this.stepVar?\"\"+s+\" += \"+this.stepVar:u?f?r<=c?\"++\"+s:\"--\"+s:r<=c?\"\"+s+\"++\":\"\"+s+\"--\":f?\"\"+t+\" ? ++\"+s+\" : --\"+s:\"\"+t+\" ? \"+s+\"++ : \"+s+\"--\",f&&(h=\"\"+o+\" = \"+h),f&&(l=\"\"+o+\" = \"+l),[this.makeCode(\"\"+h+\"; \"+n+\"; \"+l)]):this.compileArray(e)},t.prototype.compileArray=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v;if(this.fromNum&&this.toNum&&Math.abs(this.fromNum-this.toNum)<=20)return f=function(){v=[];for(var e=p=+this.fromNum,t=+this.toNum;p<=t?e<=t:e>=t;p<=t?e++:e--)v.push(e);return v}.apply(this),this.exclusive&&f.pop(),[this.makeCode(\"[\"+f.join(\", \")+\"]\")];o=this.tab+J,s=e.scope.freeVariable(\"i\"),l=e.scope.freeVariable(\"results\"),a=\"\\n\"+o+l+\" = [];\",this.fromNum&&this.toNum?(e.index=s,n=at(this.compileNode(e))):(c=\"\"+s+\" = \"+this.fromC+(this.toC!==this.toVar?\", \"+this.toC:\"\"),r=\"\"+this.fromVar+\" <= \"+this.toVar,n=\"var \"+c+\"; \"+r+\" ? \"+s+\" <\"+this.equals+\" \"+this.toVar+\" : \"+s+\" >\"+this.equals+\" \"+this.toVar+\"; \"+r+\" ? \"+s+\"++ : \"+s+\"--\"),u=\"{ \"+l+\".push(\"+s+\"); }\\n\"+o+\"return \"+l+\";\\n\"+e.indent,i=function(e){return e!=null?e.contains(ft):void 0};if(i(this.from)||i(this.to))t=\", arguments\";return[this.makeCode(\"(function() {\"+a+\"\\n\"+o+\"for (\"+n+\")\"+u+\"}).apply(this\"+(t!=null?t:\"\")+\")\")]},t}(o),t.Slice=X=function(e){function t(e){this.range=e,t.__super__.constructor.call(this)}return Tt(t,e),t.prototype.children=[\"range\"],t.prototype.compileNode=function(e){var t,n,r,i,s,o,u;u=this.range,s=u.to,r=u.from,i=r&&r.compileToFragments(e,L)||[this.makeCode(\"0\")];if(s){t=s.compileToFragments(e,L),n=at(t);if(!!this.range.exclusive||+n!==-1)o=\", \"+(this.range.exclusive?n:U.test(n)?\"\"+(+n+1):(t=s.compileToFragments(e,T),\"+\"+at(t)+\" + 1 || 9e9\"))}return[this.makeCode(\".slice(\"+at(i)+(o||\"\")+\")\")]},t}(o),t.Obj=H=function(e){function t(e,t){this.generated=t!=null?t:!1,this.objects=this.properties=e||[]}return Tt(t,e),t.prototype.children=[\"properties\"],t.prototype.compileNode=function(e){var t,n,r,i,o,u,a,f,l,c,p,d,v;l=this.properties;if(!l.length)return[this.makeCode(this.front?\"({})\":\"{}\")];if(this.generated)for(c=0,d=l.length;c<d;c++)a=l[c],a instanceof Z&&a.error(\"cannot have an implicit value in an implicit object\");r=e.indent+=J,u=this.lastNonComment(this.properties),t=[];for(n=p=0,v=l.length;p<v;n=++p)f=l[n],o=n===l.length-1?\"\":f===u||f instanceof h?\"\\n\":\",\\n\",i=f instanceof h?\"\":r,f instanceof s&&f.variable instanceof Z&&f.variable.hasProperties()&&f.variable.error(\"Invalid object key\"),f instanceof Z&&f[\"this\"]&&(f=new s(f.properties[0].name,f,\"object\")),f instanceof h||(f instanceof s||(f=new s(f,f,\"object\")),(f.variable.base||f.variable).asKey=!0),i&&t.push(this.makeCode(i)),t.push.apply(t,f.compileToFragments(e,A)),o&&t.push(this.makeCode(o));return t.unshift(this.makeCode(\"{\"+(l.length&&\"\\n\"))),t.push(this.makeCode(\"\"+(l.length&&\"\\n\"+this.tab)+\"}\")),this.front?this.wrapInBraces(t):t},t.prototype.assigns=function(e){var t,n,r,i;i=this.properties;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.assigns(e))return!0}return!1},t}(o),t.Arr=i=function(e){function t(e){this.objects=e||[]}return Tt(t,e),t.prototype.children=[\"objects\"],t.prototype.compileNode=function(e){var t,n,r,i,s,o,u;if(!this.objects.length)return[this.makeCode(\"[]\")];e.indent+=J,t=V.compileSplattedArray(e,this.objects);if(t.length)return t;t=[],n=function(){var t,n,r,i;r=this.objects,i=[];for(t=0,n=r.length;t<n;t++)s=r[t],i.push(s.compileToFragments(e,C));return i}.call(this);for(i=o=0,u=n.length;o<u;i=++o)r=n[i],i&&t.push(this.makeCode(\", \")),t.push.apply(t,r);return at(t).indexOf(\"\\n\")>=0?(t.unshift(this.makeCode(\"[\\n\"+e.indent)),t.push(this.makeCode(\"\\n\"+this.tab+\"]\"))):(t.unshift(this.makeCode(\"[\")),t.push(this.makeCode(\"]\"))),t},t.prototype.assigns=function(e){var t,n,r,i;i=this.objects;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.assigns(e))return!0}return!1},t}(o),t.Class=f=function(e){function t(e,t,n){this.variable=e,this.parent=t,this.body=n!=null?n:new u,this.boundFuncs=[],this.body.classBody=!0}return Tt(t,e),t.prototype.children=[\"variable\",\"parent\",\"body\"],t.prototype.determineName=function(){var e,t;return this.variable?(e=(t=ct(this.variable.properties))?t instanceof r&&t.name.value:this.variable.base.value,Nt.call(z,e)>=0&&this.variable.error(\"class variable name may not be \"+e),e&&(e=g.test(e)&&e)):null},t.prototype.setContext=function(e){return this.body.traverseChildren(!1,function(t){if(t.classBody)return!1;if(t instanceof O&&t.value===\"this\")return t.value=e;if(t instanceof l){t.klass=e;if(t.bound)return t.context=e}})},t.prototype.addBoundFunctions=function(e){var t,n,i,s,o;o=this.boundFuncs;for(i=0,s=o.length;i<s;i++)t=o[i],n=(new Z(new O(\"this\"),[new r(t)])).compile(e),this.ctor.body.unshift(new O(\"\"+n+\" = \"+wt(\"bind\")+\"(\"+n+\", this)\"))},t.prototype.addProperties=function(e,t,n){var i,o,u,a,f;return f=e.base.properties.slice(0),u=function(){var e;e=[];while(i=f.shift())i instanceof s&&(o=i.variable.base,delete i.context,a=i.value,o.value===\"constructor\"?(this.ctor&&i.error(\"cannot define more than one constructor in a class\"),a.bound&&i.error(\"cannot define a constructor as a bound function\"),a instanceof l?i=this.ctor=a:(this.externalCtor=n.classScope.freeVariable(\"class\"),i=new s(new O(this.externalCtor),a))):i.variable[\"this\"]?a[\"static\"]=!0:(i.variable=new Z(new O(t),[new r(new O(\"prototype\")),new r(o)]),a instanceof l&&a.bound&&(this.boundFuncs.push(o),a.bound=!1))),e.push(i);return e}.call(this),rt(u)},t.prototype.walkBody=function(e,n){return this.traverseChildren(!1,function(r){return function(i){var o,a,f,l,c,h,p;o=!0;if(i instanceof t)return!1;if(i instanceof u){p=a=i.expressions;for(f=c=0,h=p.length;c<h;f=++c)l=p[f],l instanceof s&&l.variable.looksStatic(e)?l.value[\"static\"]=!0:l instanceof Z&&l.isObject(!0)&&(o=!1,a[f]=r.addProperties(l,e,n));i.expressions=a=ut(a)}return o&&!(i instanceof t)}}(this))},t.prototype.hoistDirectivePrologue=function(){var e,t,n;t=0,e=this.body.expressions;while((n=e[t])&&n instanceof h||n instanceof Z&&n.isString())++t;return this.directives=e.splice(0,t)},t.prototype.ensureConstructor=function(e){return this.ctor||(this.ctor=new l,this.externalCtor?this.ctor.body.push(new O(\"\"+this.externalCtor+\".apply(this, arguments)\")):this.parent&&this.ctor.body.push(new O(\"\"+e+\".__super__.constructor.apply(this, arguments)\")),this.ctor.body.makeReturn(),this.body.expressions.unshift(this.ctor)),this.ctor.ctor=this.ctor.name=e,this.ctor.klass=null,this.ctor.noReturn=!0},t.prototype.compileNode=function(e){var t,n,r,i,o,f,c,h,p;return(i=this.body.jumps())&&i.error(\"Class bodies cannot contain pure statements\"),(n=this.body.contains(ft))&&n.error(\"Class bodies shouldn't reference arguments\"),c=this.determineName()||\"_Class\",c.reserved&&(c=\"_\"+c),f=new O(c),r=new l([],u.wrap([this.body])),t=[],e.classScope=r.makeScope(e.scope),this.hoistDirectivePrologue(),this.setContext(c),this.walkBody(c,e),this.ensureConstructor(c),this.addBoundFunctions(e),this.body.spaced=!0,this.body.expressions.push(f),this.parent&&(h=new O(e.classScope.freeVariable(\"super\",!1)),this.body.expressions.unshift(new d(f,h)),r.params.push(new j(h)),t.push(this.parent)),(p=this.body.expressions).unshift.apply(p,this.directives),o=new F(new a(r,t)),this.variable&&(o=new s(this.variable,o)),o.compileToFragments(e)},t}(o),t.Assign=s=function(e){function t(e,t,n,r){var i,s,o;this.variable=e,this.value=t,this.context=n,this.param=r&&r.param,this.subpattern=r&&r.subpattern,i=(o=s=this.variable.unwrapAll().value,Nt.call(z,o)>=0),i&&this.context!==\"object\"&&this.variable.error('variable name may not be \"'+s+'\"')}return Tt(t,e),t.prototype.children=[\"variable\",\"value\"],t.prototype.isStatement=function(e){return(e!=null?e.level:void 0)===A&&this.context!=null&&Nt.call(this.context,\"?\")>=0},t.prototype.assigns=function(e){return this[this.context===\"object\"?\"value\":\"variable\"].assigns(e)},t.prototype.unfoldSoak=function(e){return bt(e,this,\"variable\")},t.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,c;if(r=this.variable instanceof Z){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(e);if(this.variable.isSplice())return this.compileSplice(e);if((a=this.context)===\"||=\"||a===\"&&=\"||a===\"?=\")return this.compileConditional(e)}n=this.variable.compileToFragments(e,C),s=at(n);if(!this.context){u=this.variable.unwrapAll(),u.isAssignable()||this.variable.error('\"'+this.variable.compile(e)+'\" cannot be assigned');if(typeof u.hasProperties==\"function\"?!u.hasProperties():!void 0)this.param?e.scope.add(s,\"var\"):e.scope.find(s)}return this.value instanceof l&&(i=M.exec(s))&&(i[2]&&(this.value.klass=i[1]),this.value.name=(f=(c=i[3])!=null?c:i[4])!=null?f:i[5]),o=this.value.compileToFragments(e,C),this.context===\"object\"?n.concat(this.makeCode(\": \"),o):(t=n.concat(this.makeCode(\" \"+(this.context||\"=\")+\" \"),o),e.level<=C?t:this.wrapInBraces(t))},t.prototype.compilePatternMatch=function(e){var n,i,s,o,u,a,f,l,c,h,p,d,v,m,y,b,w,E,S,T,N,L,M,_,D,P,H,B;b=e.level===A,E=this.value,p=this.variable.base.objects;if(!(d=p.length))return s=E.compileToFragments(e),e.level>=k?this.wrapInBraces(s):s;f=this.variable.isObject();if(!b||d!==1||(h=p[0])instanceof V){S=E.compileToFragments(e,C),T=at(S),i=[],y=!1;if(!g.test(T)||this.variable.assigns(T))i.push([this.makeCode(\"\"+(v=e.scope.freeVariable(\"ref\"))+\" = \")].concat(Ct.call(S))),S=[this.makeCode(v)],T=v;for(u=N=0,L=p.length;N<L;u=++N)h=p[u],a=u,f&&(h instanceof t?(P=h,H=P.variable,a=H.base,h=P.value):h.base instanceof F?(B=(new Z(h.unwrapAll())).cacheReference(e),h=B[0],a=B[1]):a=h[\"this\"]?h.properties[0].name:h),!y&&h instanceof V?(c=h.name.unwrap().value,h=h.unwrap(),w=\"\"+d+\" <= \"+T+\".length ? \"+wt(\"slice\")+\".call(\"+T+\", \"+u,(m=d-u-1)?(l=e.scope.freeVariable(\"i\"),w+=\", \"+l+\" = \"+T+\".length - \"+m+\") : (\"+l+\" = \"+u+\", [])\"):w+=\") : []\",w=new O(w),y=\"\"+l+\"++\"):(c=h.unwrap().value,h instanceof V&&h.error(\"multiple splats are disallowed in an assignment\"),typeof a==\"number\"?(a=new O(y||a),n=!1):n=f&&g.test(a.unwrap().value||0),w=new Z(new O(T),[new(n?r:x)(a)])),c!=null&&Nt.call(I,c)>=0&&h.error(\"assignment to a reserved word: \"+h.compile(e)),i.push((new t(h,w,null,{param:this.param,subpattern:!0})).compileToFragments(e,C));return!b&&!this.subpattern&&i.push(S),o=this.joinFragmentArrays(i,\", \"),e.level<C?o:this.wrapInBraces(o)}return h instanceof t?(M=h,_=M.variable,a=_.base,h=M.value):a=f?h[\"this\"]?h.properties[0].name:h:new O(0),n=g.test(a.unwrap().value||0),E=new Z(E),E.properties.push(new(n?r:x)(a)),(D=h.unwrap().value,Nt.call(I,D)>=0)&&h.error(\"assignment to a reserved word: \"+h.compile(e)),(new t(h,E,null,{param:this.param})).compileToFragments(e,A)},t.prototype.compileConditional=function(e){var n,r,i,s;return s=this.variable.cacheReference(e),r=s[0],i=s[1],!r.properties.length&&r.base instanceof O&&r.base.value!==\"this\"&&!e.scope.check(r.base.value)&&this.variable.error('the variable \"'+r.base.value+\"\\\" can't be assigned with \"+this.context+\" because it has not been declared before\"),Nt.call(this.context,\"?\")>=0?(e.isExistentialEquals=!0,(new E(new p(r),i,{type:\"if\"})).addElse(new t(i,this.value,\"=\")).compileToFragments(e)):(n=(new B(this.context.slice(0,-1),r,new t(i,this.value,\"=\"))).compileToFragments(e),e.level<=C?n:this.wrapInBraces(n))},t.prototype.compileSplice=function(e){var t,n,r,i,s,o,u,a,f,l,c,h;return l=this.variable.properties.pop().range,r=l.from,u=l.to,n=l.exclusive,o=this.variable.compile(e),r?(c=this.cacheToCodeFragments(r.cache(e,k)),i=c[0],s=c[1]):i=s=\"0\",u?r instanceof Z&&r.isSimpleNumber()&&u instanceof Z&&u.isSimpleNumber()?(u=u.compile(e)-s,n||(u+=1)):(u=u.compile(e,T)+\" - \"+s,n||(u+=\" + 1\")):u=\"9e9\",h=this.value.cache(e,C),a=h[0],f=h[1],t=[].concat(this.makeCode(\"[].splice.apply(\"+o+\", [\"+i+\", \"+u+\"].concat(\"),a,this.makeCode(\")), \"),f),e.level>A?this.wrapInBraces(t):t},t}(o),t.Code=l=function(e){function t(e,t,n){this.params=e||[],this.body=t||new u,this.bound=n===\"boundfunc\"}return Tt(t,e),t.prototype.children=[\"params\",\"body\"],t.prototype.isStatement=function(){return!!this.ctor},t.prototype.jumps=D,t.prototype.makeScope=function(e){return new W(e,this.body,this)},t.prototype.compileNode=function(e){var n,r,o,f,l,c,h,p,d,v,m,g,y,b,w,S,x,N,C,k,L,A,M,_,D,P,H,F,I,q,R,U,z;this.bound&&((F=e.scope.method)!=null?F.bound:void 0)&&(this.context=e.scope.method.context);if(this.bound&&!this.context)return this.context=\"_this\",w=new t([new j(new O(this.context))],new u([this])),r=new a(w,[new O(\"this\")]),r.updateLocationDataIfMissing(this.locationData),r.compileNode(e);e.scope=it(e,\"classScope\")||this.makeScope(e.scope),e.scope.shared=it(e,\"sharedScope\"),e.indent+=J,delete e.bare,delete e.isExistentialEquals,d=[],f=[],I=this.params;for(S=0,k=I.length;S<k;S++)p=I[S],e.scope.parameter(p.asReference(e));q=this.params;for(x=0,L=q.length;x<L;x++){p=q[x];if(!p.splat)continue;R=this.params;for(N=0,A=R.length;N<A;N++)h=R[N].name,h[\"this\"]&&(h=h.properties[0].name),h.value&&e.scope.add(h.value,\"var\",!0);m=new s(new Z(new i(function(){var t,n,r,i;r=this.params,i=[];for(t=0,n=r.length;t<n;t++)h=r[t],i.push(h.asReference(e));return i}.call(this))),new Z(new O(\"arguments\")));break}U=this.params;for(C=0,M=U.length;C<M;C++)p=U[C],p.isComplex()?(y=v=p.asReference(e),p.value&&(y=new B(\"?\",v,p.value)),f.push(new s(new Z(p.name),y,\"=\",{param:!0}))):(v=p,p.value&&(c=new O(v.name.value+\" == null\"),y=new s(new Z(p.name),p.value,\"=\"),f.push(new E(c,y)))),m||d.push(v);b=this.body.isEmpty(),m&&f.unshift(m),f.length&&(z=this.body.expressions).unshift.apply(z,f);for(l=P=0,_=d.length;P<_;l=++P)h=d[l],d[l]=h.compileToFragments(e),e.scope.parameter(at(d[l]));g=[],this.eachParamName(function(e,t){return Nt.call(g,e)>=0&&t.error(\"multiple parameters named '\"+e+\"'\"),g.push(e)}),!b&&!this.noReturn&&this.body.makeReturn(),o=\"function\",this.ctor&&(o+=\" \"+this.name),o+=\"(\",n=[this.makeCode(o)];for(l=H=0,D=d.length;H<D;l=++H)h=d[l],l&&n.push(this.makeCode(\", \")),n.push.apply(n,h);return n.push(this.makeCode(\") {\")),this.body.isEmpty()||(n=n.concat(this.makeCode(\"\\n\"),this.body.compileWithDeclarations(e),this.makeCode(\"\\n\"+this.tab))),n.push(this.makeCode(\"}\")),this.ctor?[this.makeCode(this.tab)].concat(Ct.call(n)):this.front||e.level>=T?this.wrapInBraces(n):n},t.prototype.eachParamName=function(e){var t,n,r,i,s;i=this.params,s=[];for(n=0,r=i.length;n<r;n++)t=i[n],s.push(t.eachName(e));return s},t.prototype.traverseChildren=function(e,n){if(e)return t.__super__.traverseChildren.call(this,e,n)},t}(o),t.Param=j=function(e){function t(e,t,n){var r;this.name=e,this.value=t,this.splat=n,(r=e=this.name.unwrapAll().value,Nt.call(z,r)>=0)&&this.name.error('parameter name \"'+e+'\" is not allowed')}return Tt(t,e),t.prototype.children=[\"name\",\"value\"],t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e,C)},t.prototype.asReference=function(e){var t;return this.reference?this.reference:(t=this.name,t[\"this\"]?(t=t.properties[0].name,t.value.reserved&&(t=new O(e.scope.freeVariable(t.value)))):t.isComplex()&&(t=new O(e.scope.freeVariable(\"arg\"))),t=new Z(t),this.splat&&(t=new V(t)),t.updateLocationDataIfMissing(this.locationData),this.reference=t)},t.prototype.isComplex=function(){return this.name.isComplex()},t.prototype.eachName=function(e,t){var n,r,i,o,u,a;t==null&&(t=this.name),n=function(t){var n;n=t.properties[0].name;if(!n.value.reserved)return e(n.value,n)};if(t instanceof O)return e(t.value,t);if(t instanceof Z)return n(t);a=t.objects;for(o=0,u=a.length;o<u;o++)i=a[o],i instanceof s?this.eachName(e,i.value.unwrap()):i instanceof V?(r=i.name.unwrap(),e(r.value,r)):i instanceof Z?i.isArray()||i.isObject()?this.eachName(e,i.base):i[\"this\"]?n(i):e(i.base.value,i.base):i.error(\"illegal parameter \"+i.compile())},t}(o),t.Splat=V=function(e){function t(e){this.name=e.compile?e:new O(e)}return Tt(t,e),t.prototype.children=[\"name\"],t.prototype.isAssignable=tt,t.prototype.assigns=function(e){return this.name.assigns(e)},t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e)},t.prototype.unwrap=function(){return this.name},t.compileSplattedArray=function(e,n,r){var i,s,o,u,a,f,l,c,h,p;l=-1;while((c=n[++l])&&!(c instanceof t))continue;if(l>=n.length)return[];if(n.length===1)return c=n[0],a=c.compileToFragments(e,C),r?a:[].concat(c.makeCode(\"\"+wt(\"slice\")+\".call(\"),a,c.makeCode(\")\"));i=n.slice(l);for(f=h=0,p=i.length;h<p;f=++h)c=i[f],o=c.compileToFragments(e,C),i[f]=c instanceof t?[].concat(c.makeCode(\"\"+wt(\"slice\")+\".call(\"),o,c.makeCode(\")\")):[].concat(c.makeCode(\"[\"),o,c.makeCode(\"]\"));return l===0?(c=n[0],u=c.joinFragmentArrays(i.slice(1),\", \"),i[0].concat(c.makeCode(\".concat(\"),u,c.makeCode(\")\"))):(s=function(){var t,r,i,s;i=n.slice(0,l),s=[];for(t=0,r=i.length;t<r;t++)c=i[t],s.push(c.compileToFragments(e,C));return s}(),s=n[0].joinFragmentArrays(s,\", \"),u=n[l].joinFragmentArrays(i,\", \"),[].concat(n[0].makeCode(\"[\"),s,n[l].makeCode(\"].concat(\"),u,ct(n).makeCode(\")\")))},t}(o),t.While=et=function(e){function t(e,t){this.condition=(t!=null?t.invert:void 0)?e.invert():e,this.guard=t!=null?t.guard:void 0}return Tt(t,e),t.prototype.children=[\"condition\",\"guard\",\"body\"],t.prototype.isStatement=tt,t.prototype.makeReturn=function(e){return e?t.__super__.makeReturn.apply(this,arguments):(this.returns=!this.jumps({loop:!0}),this)},t.prototype.addBody=function(e){return this.body=e,this},t.prototype.jumps=function(){var e,t,n,r,i;e=this.body.expressions;if(!e.length)return!1;for(r=0,i=e.length;r<i;r++){n=e[r];if(t=n.jumps({loop:!0}))return t}return!1},t.prototype.compileNode=function(e){var t,n,r,i;return e.indent+=J,i=\"\",n=this.body,n.isEmpty()?n=this.makeCode(\"\"):(this.returns&&(n.makeReturn(r=e.scope.freeVariable(\"results\")),i=\"\"+this.tab+r+\" = [];\\n\"),this.guard&&(n.expressions.length>1?n.expressions.unshift(new E((new F(this.guard)).invert(),new O(\"continue\"))):this.guard&&(n=u.wrap([new E(this.guard,n)]))),n=[].concat(this.makeCode(\"\\n\"),n.compileToFragments(e,A),this.makeCode(\"\\n\"+this.tab))),t=[].concat(this.makeCode(i+this.tab+\"while (\"),this.condition.compileToFragments(e,L),this.makeCode(\") {\"),n,this.makeCode(\"}\")),this.returns&&t.push(this.makeCode(\"\\n\"+this.tab+\"return \"+r+\";\")),t},t}(o),t.Op=B=function(e){function t(e,t,r,i){if(e===\"in\")return new S(t,r);if(e===\"do\")return this.generateDo(t);if(e===\"new\"){if(t instanceof a&&!t[\"do\"]&&!t.isNew)return t.newInstance();if(t instanceof l&&t.bound||t[\"do\"])t=new F(t)}return this.operator=n[e]||e,this.first=t,this.second=r,this.flip=!!i,this}var n,r;return Tt(t,e),n={\"==\":\"===\",\"!=\":\"!==\",of:\"in\"},r={\"!==\":\"===\",\"===\":\"!==\"},t.prototype.children=[\"first\",\"second\"],t.prototype.isSimpleNumber=D,t.prototype.isUnary=function(){return!this.second},t.prototype.isComplex=function(){var e;return!this.isUnary()||(e=this.operator)!==\"+\"&&e!==\"-\"||this.first.isComplex()},t.prototype.isChainable=function(){var e;return(e=this.operator)===\"<\"||e===\">\"||e===\">=\"||e===\"<=\"||e===\"===\"||e===\"!==\"},t.prototype.invert=function(){var e,n,i,s,o;if(this.isChainable()&&this.first.isChainable()){e=!0,n=this;while(n&&n.operator)e&&(e=n.operator in r),n=n.first;if(!e)return(new F(this)).invert();n=this;while(n&&n.operator)n.invert=!n.invert,n.operator=r[n.operator],n=n.first;return this}return(s=r[this.operator])?(this.operator=s,this.first.unwrap()instanceof t&&this.first.invert(),this):this.second?(new F(this)).invert():this.operator===\"!\"&&(i=this.first.unwrap())instanceof t&&((o=i.operator)===\"!\"||o===\"in\"||o===\"instanceof\")?i:new t(\"!\",this)},t.prototype.unfoldSoak=function(e){var t;return((t=this.operator)===\"++\"||t===\"--\"||t===\"delete\")&&bt(e,this,\"first\")},t.prototype.generateDo=function(e){var t,n,r,i,o,u,f,c;i=[],n=e instanceof s&&(o=e.value.unwrap())instanceof l?o:e,c=n.params||[];for(u=0,f=c.length;u<f;u++)r=c[u],r.value?(i.push(r.value),delete r.value):i.push(r);return t=new a(e,i),t[\"do\"]=!0,t},t.prototype.compileNode=function(e){var t,n,r,i;return n=this.isChainable()&&this.first.isChainable(),n||(this.first.front=this.front),this.operator===\"delete\"&&e.scope.check(this.first.unwrapAll().value)&&this.error(\"delete operand may not be argument or var\"),((r=this.operator)===\"--\"||r===\"++\")&&(i=this.first.unwrapAll().value,Nt.call(z,i)>=0)&&this.error('cannot increment/decrement \"'+this.first.unwrapAll().value+'\"'),this.isUnary()?this.compileUnary(e):n?this.compileChain(e):this.operator===\"?\"?this.compileExistence(e):(t=[].concat(this.first.compileToFragments(e,k),this.makeCode(\" \"+this.operator+\" \"),this.second.compileToFragments(e,k)),e.level<=k?t:this.wrapInBraces(t))},t.prototype.compileChain=function(e){var t,n,r,i;return i=this.first.second.cache(e),this.first.second=i[0],r=i[1],n=this.first.compileToFragments(e,k),t=n.concat(this.makeCode(\" \"+(this.invert?\"&&\":\"||\")+\" \"),r.compileToFragments(e),this.makeCode(\" \"+this.operator+\" \"),this.second.compileToFragments(e,k)),this.wrapInBraces(t)},t.prototype.compileExistence=function(e){var t,n;return this.first.isComplex()?(n=new O(e.scope.freeVariable(\"ref\")),t=new F(new s(n,this.first))):(t=this.first,n=t),(new E(new p(t),n,{type:\"if\"})).addElse(this.second).compileToFragments(e)},t.prototype.compileUnary=function(e){var n,r,i;r=[],n=this.operator,r.push([this.makeCode(n)]);if(n===\"!\"&&this.first instanceof p)return this.first.negated=!this.first.negated,this.first.compileToFragments(e);if(e.level>=T)return(new F(this)).compileToFragments(e);i=n===\"+\"||n===\"-\",(n===\"new\"||n===\"typeof\"||n===\"delete\"||i&&this.first instanceof t&&this.first.operator===n)&&r.push([this.makeCode(\" \")]);if(i&&this.first instanceof t||n===\"new\"&&this.first.isStatement(e))this.first=new F(this.first);return r.push(this.first.compileToFragments(e,k)),this.flip&&r.reverse(),this.joinFragmentArrays(r,\"\")},t.prototype.toString=function(e){return t.__super__.toString.call(this,e,this.constructor.name+\" \"+this.operator)},t}(o),t.In=S=function(e){function t(e,t){this.object=e,this.array=t}return Tt(t,e),t.prototype.children=[\"object\",\"array\"],t.prototype.invert=_,t.prototype.compileNode=function(e){var t,n,r,i,s;if(this.array instanceof Z&&this.array.isArray()){s=this.array.base.objects;for(r=0,i=s.length;r<i;r++){n=s[r];if(n instanceof V){t=!0;break}continue}if(!t)return this.compileOrTest(e)}return this.compileLoopTest(e)},t.prototype.compileOrTest=function(e){var t,n,r,i,s,o,u,a,f,l,c,h;if(this.array.base.objects.length===0)return[this.makeCode(\"\"+!!this.negated)];l=this.object.cache(e,k),o=l[0],s=l[1],c=this.negated?[\" !== \",\" && \"]:[\" === \",\" || \"],t=c[0],n=c[1],u=[],h=this.array.base.objects;for(r=a=0,f=h.length;a<f;r=++a)i=h[r],r&&u.push(this.makeCode(n)),u=u.concat(r?s:o,this.makeCode(t),i.compileToFragments(e,T));return e.level<k?u:this.wrapInBraces(u)},t.prototype.compileLoopTest=function(e){var t,n,r,i;return i=this.object.cache(e,C),r=i[0],n=i[1],t=[].concat(this.makeCode(wt(\"indexOf\")+\".call(\"),this.array.compileToFragments(e,C),this.makeCode(\", \"),n,this.makeCode(\") \"+(this.negated?\"< 0\":\">= 0\"))),at(r)===at(n)?t:(t=r.concat(this.makeCode(\", \"),t),e.level<C?t:this.wrapInBraces(t))},t.prototype.toString=function(e){return t.__super__.toString.call(this,e,this.constructor.name+(this.negated?\"!\":\"\"))},t}(o),t.Try=G=function(e){function t(e,t,n,r){this.attempt=e,this.errorVariable=t,this.recovery=n,this.ensure=r}return Tt(t,e),t.prototype.children=[\"attempt\",\"recovery\",\"ensure\"],t.prototype.isStatement=tt,t.prototype.jumps=function(e){var t;return this.attempt.jumps(e)||((t=this.recovery)!=null?t.jumps(e):void 0)},t.prototype.makeReturn=function(e){return this.attempt&&(this.attempt=this.attempt.makeReturn(e)),this.recovery&&(this.recovery=this.recovery.makeReturn(e)),this},t.prototype.compileNode=function(e){var t,n,r,i;return e.indent+=J,i=this.attempt.compileToFragments(e,A),t=this.recovery?(r=new O(\"_error\"),this.errorVariable?this.recovery.unshift(new s(this.errorVariable,r)):void 0,[].concat(this.makeCode(\" catch (\"),r.compileToFragments(e),this.makeCode(\") {\\n\"),this.recovery.compileToFragments(e,A),this.makeCode(\"\\n\"+this.tab+\"}\"))):!this.ensure&&!this.recovery?[this.makeCode(\" catch (_error) {}\")]:[],n=this.ensure?[].concat(this.makeCode(\" finally {\\n\"),this.ensure.compileToFragments(e,A),this.makeCode(\"\\n\"+this.tab+\"}\")):[],[].concat(this.makeCode(\"\"+this.tab+\"try {\\n\"),i,this.makeCode(\"\\n\"+this.tab+\"}\"),t,n)},t}(o),t.Throw=Q=function(e){function t(e){this.expression=e}return Tt(t,e),t.prototype.children=[\"expression\"],t.prototype.isStatement=tt,t.prototype.jumps=D,t.prototype.makeReturn=K,t.prototype.compileNode=function(e){return[].concat(this.makeCode(this.tab+\"throw \"),this.expression.compileToFragments(e),this.makeCode(\";\"))},t}(o),t.Existence=p=function(e){function t(e){this.expression=e}return Tt(t,e),t.prototype.children=[\"expression\"],t.prototype.invert=_,t.prototype.compileNode=function(e){var t,n,r,i;return this.expression.front=this.front,r=this.expression.compile(e,k),g.test(r)&&!e.scope.check(r)?(i=this.negated?[\"===\",\"||\"]:[\"!==\",\"&&\"],t=i[0],n=i[1],r=\"typeof \"+r+\" \"+t+' \"undefined\" '+n+\" \"+r+\" \"+t+\" null\"):r=\"\"+r+\" \"+(this.negated?\"==\":\"!=\")+\" null\",[this.makeCode(e.level<=N?r:\"(\"+r+\")\")]},t}(o),t.Parens=F=function(e){function t(e){this.body=e}return Tt(t,e),t.prototype.children=[\"body\"],t.prototype.unwrap=function(){return this.body},t.prototype.isComplex=function(){return this.body.isComplex()},t.prototype.compileNode=function(e){var t,n,r;return n=this.body.unwrap(),n instanceof Z&&n.isAtomic()?(n.front=this.front,n.compileToFragments(e)):(r=n.compileToFragments(e,L),t=e.level<k&&(n instanceof B||n instanceof a||n instanceof v&&n.returns),t?r:this.wrapInBraces(r))},t}(o),t.For=v=function(e){function t(e,t){var n;this.source=t.source,this.guard=t.guard,this.step=t.step,this.name=t.name,this.index=t.index,this.body=u.wrap([e]),this.own=!!t.own,this.object=!!t.object,this.object&&(n=[this.index,this.name],this.name=n[0],this.index=n[1]),this.index instanceof Z&&this.index.error(\"index cannot be a pattern matching expression\"),this.range=this.source instanceof Z&&this.source.base instanceof q&&!this.source.properties.length,this.pattern=this.name instanceof Z,this.range&&this.index&&this.index.error(\"indexes do not apply to range loops\"),this.range&&this.pattern&&this.name.error(\"cannot pattern match over range loops\"),this.own&&!this.object&&this.name.error(\"cannot use own with for-in\"),this.returns=!1}return Tt(t,e),t.prototype.children=[\"body\",\"source\",\"guard\",\"step\"],t.prototype.compileNode=function(e){var t,n,r,i,o,a,f,l,c,h,p,d,v,m,y,b,w,S,x,T,N,k,L,M,_,D,H,B,j,I,q,U,z,W;return t=u.wrap([this.body]),S=(z=ct(t.expressions))!=null?z.jumps():void 0,S&&S instanceof R&&(this.returns=!1),H=this.range?this.source.base:this.source,D=e.scope,T=this.name&&this.name.compile(e,C),m=this.index&&this.index.compile(e,C),T&&!this.pattern&&D.find(T),m&&D.find(m),this.returns&&(_=D.freeVariable(\"results\")),y=this.object&&m||D.freeVariable(\"i\"),b=this.range&&T||m||y,w=b!==y?\"\"+b+\" = \":\"\",this.step&&!this.range&&(W=this.cacheToCodeFragments(this.step.cache(e,C)),B=W[0],I=W[1],j=I.match(P)),this.pattern&&(T=y),U=\"\",p=\"\",f=\"\",d=this.tab+J,this.range?h=H.compileToFragments(pt(e,{index:y,name:T,step:this.step})):(q=this.source.compile(e,C),(T||this.own)&&!g.test(q)&&(f+=\"\"+this.tab+(k=D.freeVariable(\"ref\"))+\" = \"+q+\";\\n\",q=k),T&&!this.pattern&&(N=\"\"+T+\" = \"+q+\"[\"+b+\"]\"),this.object||(B!==I&&(f+=\"\"+this.tab+B+\";\\n\"),this.step&&j&&(c=vt(j[0])<0)||(x=D.freeVariable(\"len\")),o=\"\"+w+y+\" = 0, \"+x+\" = \"+q+\".length\",a=\"\"+w+y+\" = \"+q+\".length - 1\",r=\"\"+y+\" < \"+x,i=\"\"+y+\" >= 0\",this.step?(j?c&&(r=i,o=a):(r=\"\"+I+\" > 0 ? \"+r+\" : \"+i,o=\"(\"+I+\" > 0 ? (\"+o+\") : \"+a+\")\"),v=\"\"+y+\" += \"+I):v=\"\"+(b!==y?\"++\"+y:\"\"+y+\"++\"),h=[this.makeCode(\"\"+o+\"; \"+r+\"; \"+w+v)])),this.returns&&(L=\"\"+this.tab+_+\" = [];\\n\",M=\"\\n\"+this.tab+\"return \"+_+\";\",t.makeReturn(_)),this.guard&&(t.expressions.length>1?t.expressions.unshift(new E((new F(this.guard)).invert(),new O(\"continue\"))):this.guard&&(t=u.wrap([new E(this.guard,t)]))),this.pattern&&t.expressions.unshift(new s(this.name,new O(\"\"+q+\"[\"+b+\"]\"))),l=[].concat(this.makeCode(f),this.pluckDirectCall(e,t)),N&&(U=\"\\n\"+d+N+\";\"),this.object&&(h=[this.makeCode(\"\"+b+\" in \"+q)],this.own&&(p=\"\\n\"+d+\"if (!\"+wt(\"hasProp\")+\".call(\"+q+\", \"+b+\")) continue;\")),n=t.compileToFragments(pt(e,{indent:d}),A),n&&n.length>0&&(n=[].concat(this.makeCode(\"\\n\"),n,this.makeCode(\"\\n\"))),[].concat(l,this.makeCode(\"\"+(L||\"\")+this.tab+\"for (\"),h,this.makeCode(\") {\"+p+U),n,this.makeCode(\"\"+this.tab+\"}\"+(M||\"\")))},t.prototype.pluckDirectCall=function(e,t){var n,r,i,o,u,f,c,h,p,d,v,m,g,y,b,w;r=[],d=t.expressions;for(u=h=0,p=d.length;h<p;u=++h){i=d[u],i=i.unwrapAll();if(!(i instanceof a))continue;c=(v=i.variable)!=null?v.unwrapAll():void 0;if(!(c instanceof l||c instanceof Z&&((m=c.base)!=null?m.unwrapAll():void 0)instanceof l&&c.properties.length===1&&((g=(y=c.properties[0].name)!=null?y.value:void 0)===\"call\"||g===\"apply\")))continue;o=((b=c.base)!=null?b.unwrapAll():void 0)||c,f=new O(e.scope.freeVariable(\"fn\")),n=new Z(f),c.base&&(w=[n,c],c.base=w[0],n=w[1]),t.expressions[u]=new a(n,i.args),r=r.concat(this.makeCode(this.tab),(new s(f,o)).compileToFragments(e,A),this.makeCode(\";\\n\"))}return r},t}(et),t.Switch=$=function(e){function t(e,t,n){this.subject=e,this.cases=t,this.otherwise=n}return Tt(t,e),t.prototype.children=[\"subject\",\"cases\",\"otherwise\"],t.prototype.isStatement=tt,t.prototype.jumps=function(e){var t,n,r,i,s,o,u,a;e==null&&(e={block:!0}),o=this.cases;for(i=0,s=o.length;i<s;i++){u=o[i],n=u[0],t=u[1];if(r=t.jumps(e))return r}return(a=this.otherwise)!=null?a.jumps(e):void 0},t.prototype.makeReturn=function(e){var t,n,r,i,s;i=this.cases;for(n=0,r=i.length;n<r;n++)t=i[n],t[1].makeReturn(e);return e&&(this.otherwise||(this.otherwise=new u([new O(\"void 0\")]))),(s=this.otherwise)!=null&&s.makeReturn(e),this},t.prototype.compileNode=function(e){var t,n,r,i,s,o,u,a,f,l,c,h,p,d,v,m;a=e.indent+J,f=e.indent=a+J,o=[].concat(this.makeCode(this.tab+\"switch (\"),this.subject?this.subject.compileToFragments(e,L):this.makeCode(\"false\"),this.makeCode(\") {\\n\")),d=this.cases;for(u=l=0,h=d.length;l<h;u=++l){v=d[u],i=v[0],t=v[1],m=ut([i]);for(c=0,p=m.length;c<p;c++)r=m[c],this.subject||(r=r.invert()),o=o.concat(this.makeCode(a+\"case \"),r.compileToFragments(e,L),this.makeCode(\":\\n\"));(n=t.compileToFragments(e,A)).length>0&&(o=o.concat(n,this.makeCode(\"\\n\")));if(u===this.cases.length-1&&!this.otherwise)break;s=this.lastNonComment(t.expressions);if(s instanceof R||s instanceof O&&s.jumps()&&s.value!==\"debugger\")continue;o.push(r.makeCode(f+\"break;\\n\"))}return this.otherwise&&this.otherwise.expressions.length&&o.push.apply(o,[this.makeCode(a+\"default:\\n\")].concat(Ct.call(this.otherwise.compileToFragments(e,A)),[this.makeCode(\"\\n\")])),o.push(this.makeCode(this.tab+\"}\")),o},t}(o),t.If=E=function(e){function t(e,t,n){this.body=t,n==null&&(n={}),this.condition=n.type===\"unless\"?e.invert():e,this.elseBody=null,this.isChain=!1,this.soak=n.soak}return Tt(t,e),t.prototype.children=[\"condition\",\"body\",\"elseBody\"],t.prototype.bodyNode=function(){var e;return(e=this.body)!=null?e.unwrap():void 0},t.prototype.elseBodyNode=function(){var e;return(e=this.elseBody)!=null?e.unwrap():void 0},t.prototype.addElse=function(e){return this.isChain?this.elseBodyNode().addElse(e):(this.isChain=e instanceof t,this.elseBody=this.ensureBlock(e),this.elseBody.updateLocationDataIfMissing(e.locationData)),this},t.prototype.isStatement=function(e){var t;return(e!=null?e.level:void 0)===A||this.bodyNode().isStatement(e)||((t=this.elseBodyNode())!=null?t.isStatement(e):void 0)},t.prototype.jumps=function(e){var t;return this.body.jumps(e)||((t=this.elseBody)!=null?t.jumps(e):void 0)},t.prototype.compileNode=function(e){return this.isStatement(e)?this.compileStatement(e):this.compileExpression(e)},t.prototype.makeReturn=function(e){return e&&(this.elseBody||(this.elseBody=new u([new O(\"void 0\")]))),this.body&&(this.body=new u([this.body.makeReturn(e)])),this.elseBody&&(this.elseBody=new u([this.elseBody.makeReturn(e)])),this},t.prototype.ensureBlock=function(e){return e instanceof u?e:new u([e])},t.prototype.compileStatement=function(e){var n,r,i,s,o,u,a;return i=it(e,\"chainChild\"),o=it(e,\"isExistentialEquals\"),o?(new t(this.condition.invert(),this.elseBodyNode(),{type:\"if\"})).compileToFragments(e):(a=e.indent+J,s=this.condition.compileToFragments(e,L),r=this.ensureBlock(this.body).compileToFragments(pt(e,{indent:a})),u=[].concat(this.makeCode(\"if (\"),s,this.makeCode(\") {\\n\"),r,this.makeCode(\"\\n\"+this.tab+\"}\")),i||u.unshift(this.makeCode(this.tab)),this.elseBody?(n=u.concat(this.makeCode(\" else \")),this.isChain?(e.chainChild=!0,n=n.concat(this.elseBody.unwrap().compileToFragments(e,A))):n=n.concat(this.makeCode(\"{\\n\"),this.elseBody.compileToFragments(pt(e,{indent:a}),A),this.makeCode(\"\\n\"+this.tab+\"}\")),n):u)},t.prototype.compileExpression=function(e){var t,n,r,i;return r=this.condition.compileToFragments(e,N),n=this.bodyNode().compileToFragments(e,C),t=this.elseBodyNode()?this.elseBodyNode().compileToFragments(e,C):[this.makeCode(\"void 0\")],i=r.concat(this.makeCode(\" ? \"),n,this.makeCode(\" : \"),t),e.level>=N?this.wrapInBraces(i):i},t.prototype.unfoldSoak=function(){return this.soak&&this},t}(o),Y={\"extends\":function(){return\"function(child, parent) { for (var key in parent) { if (\"+wt(\"hasProp\")+\".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }\"},bind:function(){return\"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }\"},indexOf:function(){return\"[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }\"},hasProp:function(){return\"{}.hasOwnProperty\"},slice:function(){return\"[].slice\"}},A=1,L=2,C=3,N=4,k=5,T=6,J=\"  \",y=\"[$A-Za-z_\\\\x7f-\\\\uffff][$\\\\w\\\\x7f-\\\\uffff]*\",g=RegExp(\"^\"+y+\"$\"),U=/^[+-]?\\d+$/,m=/^[+-]?0x[\\da-f]+/i,P=/^[+-]?(?:0x[\\da-f]+|\\d*\\.?\\d+(?:e[+-]?\\d+)?)$/i,M=RegExp(\"^(\"+y+\")(\\\\.prototype)?(?:\\\\.(\"+y+\")|\\\\[(\\\"(?:[^\\\\\\\\\\\"\\\\r\\\\n]|\\\\\\\\.)*\\\"|'(?:[^\\\\\\\\'\\\\r\\\\n]|\\\\\\\\.)*')\\\\]|\\\\[(0x[\\\\da-fA-F]+|\\\\d*\\\\.?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\])$\"),w=/^['\"]/,b=/^\\//,wt=function(e){var t;return t=\"__\"+e,W.root.assign(t,Y[e]()),t},dt=function(e,t){return e=e.replace(/\\n/g,\"$&\"+t),e.replace(/\\s+$/,\"\")},vt=function(e){return e==null?0:e.match(m)?parseInt(e,16):parseFloat(e)},ft=function(e){return e instanceof O&&e.value===\"arguments\"&&!e.asKey},lt=function(e){return e instanceof O&&e.value===\"this\"&&!e.asKey||e instanceof l&&e.bound||e instanceof a&&e.isSuper},bt=function(e,t,n){var r;if(!(r=t[n].unfoldSoak(e)))return;return t[n]=r.body,r.body=new Z(t),r}}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/mode/coffee/scope\",[\"require\",\"exports\",\"module\",\"ace/mode/coffee/helpers\"],function(e,t,n){var r,i,s,o;o=e(\"./helpers\"),i=o.extend,s=o.last,t.Scope=r=function(){function e(t,n,r){this.parent=t,this.expressions=n,this.method=r,this.variables=[{name:\"arguments\",type:\"arguments\"}],this.positions={},this.parent||(e.root=this)}return e.root=null,e.prototype.add=function(e,t,n){return this.shared&&!n?this.parent.add(e,t,n):Object.prototype.hasOwnProperty.call(this.positions,e)?this.variables[this.positions[e]].type=t:this.positions[e]=this.variables.push({name:e,type:t})-1},e.prototype.namedMethod=function(){var e;return((e=this.method)!=null?e.name:void 0)||!this.parent?this.method:this.parent.namedMethod()},e.prototype.find=function(e){return this.check(e)?!0:(this.add(e,\"var\"),!1)},e.prototype.parameter=function(e){if(this.shared&&this.parent.check(e,!0))return;return this.add(e,\"param\")},e.prototype.check=function(e){var t;return!!(this.type(e)||((t=this.parent)!=null?t.check(e):void 0))},e.prototype.temporary=function(e,t){return e.length>1?\"_\"+e+(t>1?t-1:\"\"):\"_\"+(t+parseInt(e,36)).toString(36).replace(/\\d/g,\"a\")},e.prototype.type=function(e){var t,n,r,i;i=this.variables;for(n=0,r=i.length;n<r;n++){t=i[n];if(t.name===e)return t.type}return null},e.prototype.freeVariable=function(e,t){var n,r;t==null&&(t=!0),n=0;while(this.check(r=this.temporary(e,n)))n++;return t&&this.add(r,\"var\",!0),r},e.prototype.assign=function(e,t){return this.add(e,{value:t,assigned:!0},!0),this.hasAssignments=!0},e.prototype.hasDeclarations=function(){return!!this.declaredVariables().length},e.prototype.declaredVariables=function(){var e,t,n,r,i,s;e=[],t=[],s=this.variables;for(r=0,i=s.length;r<i;r++)n=s[r],n.type===\"var\"&&(n.name.charAt(0)===\"_\"?t:e).push(n.name);return e.sort().concat(t.sort())},e.prototype.assignedVariables=function(){var e,t,n,r,i;r=this.variables,i=[];for(t=0,n=r.length;t<n;t++)e=r[t],e.type.assigned&&i.push(\"\"+e.name+\" = \"+e.type.value);return i},e}()}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-css.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/css_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/worker/mirror\",\"ace/mode/css/csslint\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"../worker/mirror\").Mirror,o=e(\"./css/csslint\").CSSLint,u=t.Worker=function(e){s.call(this,e),this.setTimeout(400),this.ruleset=null,this.setDisabledRules(\"ids\"),this.setInfoRules(\"adjoining-classes|qualified-headings|zero-units|gradients|import|outline-none\")};r.inherits(u,s),function(){this.setInfoRules=function(e){typeof e==\"string\"&&(e=e.split(\"|\")),this.infoRules=i.arrayToMap(e),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.setDisabledRules=function(e){if(!e)this.ruleset=null;else{typeof e==\"string\"&&(e=e.split(\"|\"));var t={};o.getRules().forEach(function(e){t[e.id]=!0}),e.forEach(function(e){delete t[e]}),this.ruleset=t}this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.onUpdate=function(){var e=this.doc.getValue();if(!e)return this.sender.emit(\"csslint\",[]);var t=this.infoRules,n=o.verify(e,this.ruleset);this.sender.emit(\"csslint\",n.messages.map(function(e){return{row:e.line-1,column:e.col-1,text:e.message,type:t[e.rule.id]?\"info\":e.type,rule:e.rule.name}}))}}.call(u.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/mode/css/csslint\",[\"require\",\"exports\",\"module\"],function(require,exports,module){function Reporter(e,t){this.messages=[],this.stats=[],this.lines=e,this.ruleset=t}var parserlib={};(function(){function e(){this._listeners={}}function t(e){this._input=e.replace(/\\n\\r?/g,\"\\n\"),this._line=1,this._col=1,this._cursor=0}function n(e,t,n){this.col=n,this.line=t,this.message=e}function r(e,t,n,r){this.col=n,this.line=t,this.text=e,this.type=r}function i(e,n){this._reader=e?new t(e.toString()):null,this._token=null,this._tokenData=n,this._lt=[],this._ltIndex=0,this._ltIndexCache=[]}e.prototype={constructor:e,addListener:function(e,t){this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t)},fire:function(e){typeof e==\"string\"&&(e={type:e}),typeof e.target!=\"undefined\"&&(e.target=this);if(typeof e.type==\"undefined\")throw new Error(\"Event object missing 'type' property.\");if(this._listeners[e.type]){var t=this._listeners[e.type].concat();for(var n=0,r=t.length;n<r;n++)t[n].call(this,e)}},removeListener:function(e,t){if(this._listeners[e]){var n=this._listeners[e];for(var r=0,i=n.length;r<i;r++)if(n[r]===t){n.splice(r,1);break}}}},t.prototype={constructor:t,getCol:function(){return this._col},getLine:function(){return this._line},eof:function(){return this._cursor==this._input.length},peek:function(e){var t=null;return e=typeof e==\"undefined\"?1:e,this._cursor<this._input.length&&(t=this._input.charAt(this._cursor+e-1)),t},read:function(){var e=null;return this._cursor<this._input.length&&(this._input.charAt(this._cursor)==\"\\n\"?(this._line++,this._col=1):this._col++,e=this._input.charAt(this._cursor++)),e},mark:function(){this._bookmark={cursor:this._cursor,line:this._line,col:this._col}},reset:function(){this._bookmark&&(this._cursor=this._bookmark.cursor,this._line=this._bookmark.line,this._col=this._bookmark.col,delete this._bookmark)},readTo:function(e){var t=\"\",n;while(t.length<e.length||t.lastIndexOf(e)!=t.length-e.length){n=this.read();if(!n)throw new Error('Expected \"'+e+'\" at line '+this._line+\", col \"+this._col+\".\");t+=n}return t},readWhile:function(e){var t=\"\",n=this.read();while(n!==null&&e(n))t+=n,n=this.read();return t},readMatch:function(e){var t=this._input.substring(this._cursor),n=null;return typeof e==\"string\"?t.indexOf(e)===0&&(n=this.readCount(e.length)):e instanceof RegExp&&e.test(t)&&(n=this.readCount(RegExp.lastMatch.length)),n},readCount:function(e){var t=\"\";while(e--)t+=this.read();return t}},n.prototype=new Error,r.fromToken=function(e){return new r(e.value,e.startLine,e.startCol)},r.prototype={constructor:r,valueOf:function(){return this.toString()},toString:function(){return this.text}},i.createTokenData=function(e){var t=[],n={},r=e.concat([]),i=0,s=r.length+1;r.UNKNOWN=-1,r.unshift({name:\"EOF\"});for(;i<s;i++)t.push(r[i].name),r[r[i].name]=i,r[i].text&&(n[r[i].text]=i);return r.name=function(e){return t[e]},r.type=function(e){return n[e]},r},i.prototype={constructor:i,match:function(e,t){e instanceof Array||(e=[e]);var n=this.get(t),r=0,i=e.length;while(r<i)if(n==e[r++])return!0;return this.unget(),!1},mustMatch:function(e,t){var r;e instanceof Array||(e=[e]);if(!this.match.apply(this,arguments))throw r=this.LT(1),new n(\"Expected \"+this._tokenData[e[0]].name+\" at line \"+r.startLine+\", col \"+r.startCol+\".\",r.startLine,r.startCol)},advance:function(e,t){while(this.LA(0)!==0&&!this.match(e,t))this.get();return this.LA(0)},get:function(e){var t=this._tokenData,n=this._reader,r,i=0,s=t.length,o=!1,u,a;if(this._lt.length&&this._ltIndex>=0&&this._ltIndex<this._lt.length){i++,this._token=this._lt[this._ltIndex++],a=t[this._token.type];while(a.channel!==undefined&&e!==a.channel&&this._ltIndex<this._lt.length)this._token=this._lt[this._ltIndex++],a=t[this._token.type],i++;if((a.channel===undefined||e===a.channel)&&this._ltIndex<=this._lt.length)return this._ltIndexCache.push(i),this._token.type}return u=this._getToken(),u.type>-1&&!t[u.type].hide&&(u.channel=t[u.type].channel,this._token=u,this._lt.push(u),this._ltIndexCache.push(this._lt.length-this._ltIndex+i),this._lt.length>5&&this._lt.shift(),this._ltIndexCache.length>5&&this._ltIndexCache.shift(),this._ltIndex=this._lt.length),a=t[u.type],a&&(a.hide||a.channel!==undefined&&e!==a.channel)?this.get(e):u.type},LA:function(e){var t=e,n;if(e>0){if(e>5)throw new Error(\"Too much lookahead.\");while(t)n=this.get(),t--;while(t<e)this.unget(),t++}else if(e<0){if(!this._lt[this._ltIndex+e])throw new Error(\"Too much lookbehind.\");n=this._lt[this._ltIndex+e].type}else n=this._token.type;return n},LT:function(e){return this.LA(e),this._lt[this._ltIndex+e-1]},peek:function(){return this.LA(1)},token:function(){return this._token},tokenName:function(e){return e<0||e>this._tokenData.length?\"UNKNOWN_TOKEN\":this._tokenData[e].name},tokenType:function(e){return this._tokenData[e]||-1},unget:function(){if(!this._ltIndexCache.length)throw new Error(\"Too much lookahead.\");this._ltIndex-=this._ltIndexCache.pop(),this._token=this._lt[this._ltIndex-1]}},parserlib.util={StringReader:t,SyntaxError:n,SyntaxUnit:r,EventTarget:e,TokenStreamBase:i}})(),function(){function Combinator(e,t,n){SyntaxUnit.call(this,e,t,n,Parser.COMBINATOR_TYPE),this.type=\"unknown\",/^\\s+$/.test(e)?this.type=\"descendant\":e==\">\"?this.type=\"child\":e==\"+\"?this.type=\"adjacent-sibling\":e==\"~\"&&(this.type=\"sibling\")}function MediaFeature(e,t){SyntaxUnit.call(this,\"(\"+e+(t!==null?\":\"+t:\"\")+\")\",e.startLine,e.startCol,Parser.MEDIA_FEATURE_TYPE),this.name=e,this.value=t}function MediaQuery(e,t,n,r,i){SyntaxUnit.call(this,(e?e+\" \":\"\")+(t?t:\"\")+(t&&n.length>0?\" and \":\"\")+n.join(\" and \"),r,i,Parser.MEDIA_QUERY_TYPE),this.modifier=e,this.mediaType=t,this.features=n}function Parser(e){EventTarget.call(this),this.options=e||{},this._tokenStream=null}function PropertyName(e,t,n,r){SyntaxUnit.call(this,e,n,r,Parser.PROPERTY_NAME_TYPE),this.hack=t}function PropertyValue(e,t,n){SyntaxUnit.call(this,e.join(\" \"),t,n,Parser.PROPERTY_VALUE_TYPE),this.parts=e}function PropertyValueIterator(e){this._i=0,this._parts=e.parts,this._marks=[],this.value=e}function PropertyValuePart(text,line,col){SyntaxUnit.call(this,text,line,col,Parser.PROPERTY_VALUE_PART_TYPE),this.type=\"unknown\";var temp;if(/^([+\\-]?[\\d\\.]+)([a-z]+)$/i.test(text)){this.type=\"dimension\",this.value=+RegExp.$1,this.units=RegExp.$2;switch(this.units.toLowerCase()){case\"em\":case\"rem\":case\"ex\":case\"px\":case\"cm\":case\"mm\":case\"in\":case\"pt\":case\"pc\":case\"ch\":case\"vh\":case\"vw\":case\"vm\":this.type=\"length\";break;case\"deg\":case\"rad\":case\"grad\":this.type=\"angle\";break;case\"ms\":case\"s\":this.type=\"time\";break;case\"hz\":case\"khz\":this.type=\"frequency\";break;case\"dpi\":case\"dpcm\":this.type=\"resolution\"}}else/^([+\\-]?[\\d\\.]+)%$/i.test(text)?(this.type=\"percentage\",this.value=+RegExp.$1):/^([+\\-]?\\d+)$/i.test(text)?(this.type=\"integer\",this.value=+RegExp.$1):/^([+\\-]?[\\d\\.]+)$/i.test(text)?(this.type=\"number\",this.value=+RegExp.$1):/^#([a-f0-9]{3,6})/i.test(text)?(this.type=\"color\",temp=RegExp.$1,temp.length==3?(this.red=parseInt(temp.charAt(0)+temp.charAt(0),16),this.green=parseInt(temp.charAt(1)+temp.charAt(1),16),this.blue=parseInt(temp.charAt(2)+temp.charAt(2),16)):(this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16))):/^rgb\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*\\)/i.test(text)?(this.type=\"color\",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3):/^rgb\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)/i.test(text)?(this.type=\"color\",this.red=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/100):/^rgba\\(\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*(\\d+)\\s*,\\s*([\\d\\.]+)\\s*\\)/i.test(text)?(this.type=\"color\",this.red=+RegExp.$1,this.green=+RegExp.$2,this.blue=+RegExp.$3,this.alpha=+RegExp.$4):/^rgba\\(\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*([\\d\\.]+)\\s*\\)/i.test(text)?(this.type=\"color\",this.red=+RegExp.$1*255/100,this.green=+RegExp.$2*255/100,this.blue=+RegExp.$3*255/100,this.alpha=+RegExp.$4):/^hsl\\(\\s*(\\d+)\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*\\)/i.test(text)?(this.type=\"color\",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100):/^hsla\\(\\s*(\\d+)\\s*,\\s*(\\d+)%\\s*,\\s*(\\d+)%\\s*,\\s*([\\d\\.]+)\\s*\\)/i.test(text)?(this.type=\"color\",this.hue=+RegExp.$1,this.saturation=+RegExp.$2/100,this.lightness=+RegExp.$3/100,this.alpha=+RegExp.$4):/^url\\([\"']?([^\\)\"']+)[\"']?\\)/i.test(text)?(this.type=\"uri\",this.uri=RegExp.$1):/^([^\\(]+)\\(/i.test(text)?(this.type=\"function\",this.name=RegExp.$1,this.value=text):/^[\"'][^\"']*[\"']/.test(text)?(this.type=\"string\",this.value=eval(text)):Colors[text.toLowerCase()]?(this.type=\"color\",temp=Colors[text.toLowerCase()].substring(1),this.red=parseInt(temp.substring(0,2),16),this.green=parseInt(temp.substring(2,4),16),this.blue=parseInt(temp.substring(4,6),16)):/^[\\,\\/]$/.test(text)?(this.type=\"operator\",this.value=text):/^[a-z\\-\\u0080-\\uFFFF][a-z0-9\\-\\u0080-\\uFFFF]*$/i.test(text)&&(this.type=\"identifier\",this.value=text)}function Selector(e,t,n){SyntaxUnit.call(this,e.join(\" \"),t,n,Parser.SELECTOR_TYPE),this.parts=e,this.specificity=Specificity.calculate(this)}function SelectorPart(e,t,n,r,i){SyntaxUnit.call(this,n,r,i,Parser.SELECTOR_PART_TYPE),this.elementName=e,this.modifiers=t}function SelectorSubPart(e,t,n,r){SyntaxUnit.call(this,e,n,r,Parser.SELECTOR_SUB_PART_TYPE),this.type=t,this.args=[]}function Specificity(e,t,n,r){this.a=e,this.b=t,this.c=n,this.d=r}function isHexDigit(e){return e!==null&&h.test(e)}function isDigit(e){return e!==null&&/\\d/.test(e)}function isWhitespace(e){return e!==null&&/\\s/.test(e)}function isNewLine(e){return e!==null&&nl.test(e)}function isNameStart(e){return e!==null&&/[a-z_\\u0080-\\uFFFF\\\\]/i.test(e)}function isNameChar(e){return e!==null&&(isNameStart(e)||/[0-9\\-\\\\]/.test(e))}function isIdentStart(e){return e!==null&&(isNameStart(e)||/\\-\\\\/.test(e))}function mix(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}function TokenStream(e){TokenStreamBase.call(this,e,Tokens)}function ValidationError(e,t,n){this.col=n,this.line=t,this.message=e}var EventTarget=parserlib.util.EventTarget,TokenStreamBase=parserlib.util.TokenStreamBase,StringReader=parserlib.util.StringReader,SyntaxError=parserlib.util.SyntaxError,SyntaxUnit=parserlib.util.SyntaxUnit,Colors={aliceblue:\"#f0f8ff\",antiquewhite:\"#faebd7\",aqua:\"#00ffff\",aquamarine:\"#7fffd4\",azure:\"#f0ffff\",beige:\"#f5f5dc\",bisque:\"#ffe4c4\",black:\"#000000\",blanchedalmond:\"#ffebcd\",blue:\"#0000ff\",blueviolet:\"#8a2be2\",brown:\"#a52a2a\",burlywood:\"#deb887\",cadetblue:\"#5f9ea0\",chartreuse:\"#7fff00\",chocolate:\"#d2691e\",coral:\"#ff7f50\",cornflowerblue:\"#6495ed\",cornsilk:\"#fff8dc\",crimson:\"#dc143c\",cyan:\"#00ffff\",darkblue:\"#00008b\",darkcyan:\"#008b8b\",darkgoldenrod:\"#b8860b\",darkgray:\"#a9a9a9\",darkgrey:\"#a9a9a9\",darkgreen:\"#006400\",darkkhaki:\"#bdb76b\",darkmagenta:\"#8b008b\",darkolivegreen:\"#556b2f\",darkorange:\"#ff8c00\",darkorchid:\"#9932cc\",darkred:\"#8b0000\",darksalmon:\"#e9967a\",darkseagreen:\"#8fbc8f\",darkslateblue:\"#483d8b\",darkslategray:\"#2f4f4f\",darkslategrey:\"#2f4f4f\",darkturquoise:\"#00ced1\",darkviolet:\"#9400d3\",deeppink:\"#ff1493\",deepskyblue:\"#00bfff\",dimgray:\"#696969\",dimgrey:\"#696969\",dodgerblue:\"#1e90ff\",firebrick:\"#b22222\",floralwhite:\"#fffaf0\",forestgreen:\"#228b22\",fuchsia:\"#ff00ff\",gainsboro:\"#dcdcdc\",ghostwhite:\"#f8f8ff\",gold:\"#ffd700\",goldenrod:\"#daa520\",gray:\"#808080\",grey:\"#808080\",green:\"#008000\",greenyellow:\"#adff2f\",honeydew:\"#f0fff0\",hotpink:\"#ff69b4\",indianred:\"#cd5c5c\",indigo:\"#4b0082\",ivory:\"#fffff0\",khaki:\"#f0e68c\",lavender:\"#e6e6fa\",lavenderblush:\"#fff0f5\",lawngreen:\"#7cfc00\",lemonchiffon:\"#fffacd\",lightblue:\"#add8e6\",lightcoral:\"#f08080\",lightcyan:\"#e0ffff\",lightgoldenrodyellow:\"#fafad2\",lightgray:\"#d3d3d3\",lightgrey:\"#d3d3d3\",lightgreen:\"#90ee90\",lightpink:\"#ffb6c1\",lightsalmon:\"#ffa07a\",lightseagreen:\"#20b2aa\",lightskyblue:\"#87cefa\",lightslategray:\"#778899\",lightslategrey:\"#778899\",lightsteelblue:\"#b0c4de\",lightyellow:\"#ffffe0\",lime:\"#00ff00\",limegreen:\"#32cd32\",linen:\"#faf0e6\",magenta:\"#ff00ff\",maroon:\"#800000\",mediumaquamarine:\"#66cdaa\",mediumblue:\"#0000cd\",mediumorchid:\"#ba55d3\",mediumpurple:\"#9370d8\",mediumseagreen:\"#3cb371\",mediumslateblue:\"#7b68ee\",mediumspringgreen:\"#00fa9a\",mediumturquoise:\"#48d1cc\",mediumvioletred:\"#c71585\",midnightblue:\"#191970\",mintcream:\"#f5fffa\",mistyrose:\"#ffe4e1\",moccasin:\"#ffe4b5\",navajowhite:\"#ffdead\",navy:\"#000080\",oldlace:\"#fdf5e6\",olive:\"#808000\",olivedrab:\"#6b8e23\",orange:\"#ffa500\",orangered:\"#ff4500\",orchid:\"#da70d6\",palegoldenrod:\"#eee8aa\",palegreen:\"#98fb98\",paleturquoise:\"#afeeee\",palevioletred:\"#d87093\",papayawhip:\"#ffefd5\",peachpuff:\"#ffdab9\",peru:\"#cd853f\",pink:\"#ffc0cb\",plum:\"#dda0dd\",powderblue:\"#b0e0e6\",purple:\"#800080\",red:\"#ff0000\",rosybrown:\"#bc8f8f\",royalblue:\"#4169e1\",saddlebrown:\"#8b4513\",salmon:\"#fa8072\",sandybrown:\"#f4a460\",seagreen:\"#2e8b57\",seashell:\"#fff5ee\",sienna:\"#a0522d\",silver:\"#c0c0c0\",skyblue:\"#87ceeb\",slateblue:\"#6a5acd\",slategray:\"#708090\",slategrey:\"#708090\",snow:\"#fffafa\",springgreen:\"#00ff7f\",steelblue:\"#4682b4\",tan:\"#d2b48c\",teal:\"#008080\",thistle:\"#d8bfd8\",tomato:\"#ff6347\",turquoise:\"#40e0d0\",violet:\"#ee82ee\",wheat:\"#f5deb3\",white:\"#ffffff\",whitesmoke:\"#f5f5f5\",yellow:\"#ffff00\",yellowgreen:\"#9acd32\",activeBorder:\"Active window border.\",activecaption:\"Active window caption.\",appworkspace:\"Background color of multiple document interface.\",background:\"Desktop background.\",buttonface:\"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.\",buttonhighlight:\"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",buttonshadow:\"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.\",buttontext:\"Text on push buttons.\",captiontext:\"Text in caption, size box, and scrollbar arrow box.\",graytext:\"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.\",greytext:\"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.\",highlight:\"Item(s) selected in a control.\",highlighttext:\"Text of item(s) selected in a control.\",inactiveborder:\"Inactive window border.\",inactivecaption:\"Inactive window caption.\",inactivecaptiontext:\"Color of text in an inactive caption.\",infobackground:\"Background color for tooltip controls.\",infotext:\"Text color for tooltip controls.\",menu:\"Menu background.\",menutext:\"Text in menus.\",scrollbar:\"Scroll bar gray area.\",threeddarkshadow:\"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",threedface:\"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",threedhighlight:\"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",threedlightshadow:\"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",threedshadow:\"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.\",window:\"Window background.\",windowframe:\"Window frame.\",windowtext:\"Text in windows.\"};Combinator.prototype=new SyntaxUnit,Combinator.prototype.constructor=Combinator,MediaFeature.prototype=new SyntaxUnit,MediaFeature.prototype.constructor=MediaFeature,MediaQuery.prototype=new SyntaxUnit,MediaQuery.prototype.constructor=MediaQuery,Parser.DEFAULT_TYPE=0,Parser.COMBINATOR_TYPE=1,Parser.MEDIA_FEATURE_TYPE=2,Parser.MEDIA_QUERY_TYPE=3,Parser.PROPERTY_NAME_TYPE=4,Parser.PROPERTY_VALUE_TYPE=5,Parser.PROPERTY_VALUE_PART_TYPE=6,Parser.SELECTOR_TYPE=7,Parser.SELECTOR_PART_TYPE=8,Parser.SELECTOR_SUB_PART_TYPE=9,Parser.prototype=function(){var e=new EventTarget,t,n={constructor:Parser,DEFAULT_TYPE:0,COMBINATOR_TYPE:1,MEDIA_FEATURE_TYPE:2,MEDIA_QUERY_TYPE:3,PROPERTY_NAME_TYPE:4,PROPERTY_VALUE_TYPE:5,PROPERTY_VALUE_PART_TYPE:6,SELECTOR_TYPE:7,SELECTOR_PART_TYPE:8,SELECTOR_SUB_PART_TYPE:9,_stylesheet:function(){var e=this._tokenStream,t=null,n,r,i;this.fire(\"startstylesheet\"),this._charset(),this._skipCruft();while(e.peek()==Tokens.IMPORT_SYM)this._import(),this._skipCruft();while(e.peek()==Tokens.NAMESPACE_SYM)this._namespace(),this._skipCruft();i=e.peek();while(i>Tokens.EOF){try{switch(i){case Tokens.MEDIA_SYM:this._media(),this._skipCruft();break;case Tokens.PAGE_SYM:this._page(),this._skipCruft();break;case Tokens.FONT_FACE_SYM:this._font_face(),this._skipCruft();break;case Tokens.KEYFRAMES_SYM:this._keyframes(),this._skipCruft();break;case Tokens.VIEWPORT_SYM:this._viewport(),this._skipCruft();break;case Tokens.UNKNOWN_SYM:e.get();if(!!this.options.strict)throw new SyntaxError(\"Unknown @ rule.\",e.LT(0).startLine,e.LT(0).startCol);this.fire({type:\"error\",error:null,message:\"Unknown @ rule: \"+e.LT(0).value+\".\",line:e.LT(0).startLine,col:e.LT(0).startCol}),n=0;while(e.advance([Tokens.LBRACE,Tokens.RBRACE])==Tokens.LBRACE)n++;while(n)e.advance([Tokens.RBRACE]),n--;break;case Tokens.S:this._readWhitespace();break;default:if(!this._ruleset())switch(i){case Tokens.CHARSET_SYM:throw r=e.LT(1),this._charset(!1),new SyntaxError(\"@charset not allowed here.\",r.startLine,r.startCol);case Tokens.IMPORT_SYM:throw r=e.LT(1),this._import(!1),new SyntaxError(\"@import not allowed here.\",r.startLine,r.startCol);case Tokens.NAMESPACE_SYM:throw r=e.LT(1),this._namespace(!1),new SyntaxError(\"@namespace not allowed here.\",r.startLine,r.startCol);default:e.get(),this._unexpectedToken(e.token())}}}catch(s){if(!(s instanceof SyntaxError&&!this.options.strict))throw s;this.fire({type:\"error\",error:s,message:s.message,line:s.line,col:s.col})}i=e.peek()}i!=Tokens.EOF&&this._unexpectedToken(e.token()),this.fire(\"endstylesheet\")},_charset:function(e){var t=this._tokenStream,n,r,i,s;t.match(Tokens.CHARSET_SYM)&&(i=t.token().startLine,s=t.token().startCol,this._readWhitespace(),t.mustMatch(Tokens.STRING),r=t.token(),n=r.value,this._readWhitespace(),t.mustMatch(Tokens.SEMICOLON),e!==!1&&this.fire({type:\"charset\",charset:n,line:i,col:s}))},_import:function(e){var t=this._tokenStream,n,r,i,s=[];t.mustMatch(Tokens.IMPORT_SYM),i=t.token(),this._readWhitespace(),t.mustMatch([Tokens.STRING,Tokens.URI]),r=t.token().value.replace(/(?:url\\()?[\"']([^\"']+)[\"']\\)?/,\"$1\"),this._readWhitespace(),s=this._media_query_list(),t.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:\"import\",uri:r,media:s,line:i.startLine,col:i.startCol})},_namespace:function(e){var t=this._tokenStream,n,r,i,s;t.mustMatch(Tokens.NAMESPACE_SYM),n=t.token().startLine,r=t.token().startCol,this._readWhitespace(),t.match(Tokens.IDENT)&&(i=t.token().value,this._readWhitespace()),t.mustMatch([Tokens.STRING,Tokens.URI]),s=t.token().value.replace(/(?:url\\()?[\"']([^\"']+)[\"']\\)?/,\"$1\"),this._readWhitespace(),t.mustMatch(Tokens.SEMICOLON),this._readWhitespace(),e!==!1&&this.fire({type:\"namespace\",prefix:i,uri:s,line:n,col:r})},_media:function(){var e=this._tokenStream,t,n,r;e.mustMatch(Tokens.MEDIA_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),r=this._media_query_list(),e.mustMatch(Tokens.LBRACE),this._readWhitespace(),this.fire({type:\"startmedia\",media:r,line:t,col:n});for(;;)if(e.peek()==Tokens.PAGE_SYM)this._page();else if(e.peek()==Tokens.FONT_FACE_SYM)this._font_face();else if(!this._ruleset())break;e.mustMatch(Tokens.RBRACE),this._readWhitespace(),this.fire({type:\"endmedia\",media:r,line:t,col:n})},_media_query_list:function(){var e=this._tokenStream,t=[];this._readWhitespace(),(e.peek()==Tokens.IDENT||e.peek()==Tokens.LPAREN)&&t.push(this._media_query());while(e.match(Tokens.COMMA))this._readWhitespace(),t.push(this._media_query());return t},_media_query:function(){var e=this._tokenStream,t=null,n=null,r=null,i=[];e.match(Tokens.IDENT)&&(n=e.token().value.toLowerCase(),n!=\"only\"&&n!=\"not\"?(e.unget(),n=null):r=e.token()),this._readWhitespace(),e.peek()==Tokens.IDENT?(t=this._media_type(),r===null&&(r=e.token())):e.peek()==Tokens.LPAREN&&(r===null&&(r=e.LT(1)),i.push(this._media_expression()));if(t===null&&i.length===0)return null;this._readWhitespace();while(e.match(Tokens.IDENT))e.token().value.toLowerCase()!=\"and\"&&this._unexpectedToken(e.token()),this._readWhitespace(),i.push(this._media_expression());return new MediaQuery(n,t,i,r.startLine,r.startCol)},_media_type:function(){return this._media_feature()},_media_expression:function(){var e=this._tokenStream,t=null,n,r=null;return e.mustMatch(Tokens.LPAREN),t=this._media_feature(),this._readWhitespace(),e.match(Tokens.COLON)&&(this._readWhitespace(),n=e.LT(1),r=this._expression()),e.mustMatch(Tokens.RPAREN),this._readWhitespace(),new MediaFeature(t,r?new SyntaxUnit(r,n.startLine,n.startCol):null)},_media_feature:function(){var e=this._tokenStream;return e.mustMatch(Tokens.IDENT),SyntaxUnit.fromToken(e.token())},_page:function(){var e=this._tokenStream,t,n,r=null,i=null;e.mustMatch(Tokens.PAGE_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),e.match(Tokens.IDENT)&&(r=e.token().value,r.toLowerCase()===\"auto\"&&this._unexpectedToken(e.token())),e.peek()==Tokens.COLON&&(i=this._pseudo_page()),this._readWhitespace(),this.fire({type:\"startpage\",id:r,pseudo:i,line:t,col:n}),this._readDeclarations(!0,!0),this.fire({type:\"endpage\",id:r,pseudo:i,line:t,col:n})},_margin:function(){var e=this._tokenStream,t,n,r=this._margin_sym();return r?(t=e.token().startLine,n=e.token().startCol,this.fire({type:\"startpagemargin\",margin:r,line:t,col:n}),this._readDeclarations(!0),this.fire({type:\"endpagemargin\",margin:r,line:t,col:n}),!0):!1},_margin_sym:function(){var e=this._tokenStream;return e.match([Tokens.TOPLEFTCORNER_SYM,Tokens.TOPLEFT_SYM,Tokens.TOPCENTER_SYM,Tokens.TOPRIGHT_SYM,Tokens.TOPRIGHTCORNER_SYM,Tokens.BOTTOMLEFTCORNER_SYM,Tokens.BOTTOMLEFT_SYM,Tokens.BOTTOMCENTER_SYM,Tokens.BOTTOMRIGHT_SYM,Tokens.BOTTOMRIGHTCORNER_SYM,Tokens.LEFTTOP_SYM,Tokens.LEFTMIDDLE_SYM,Tokens.LEFTBOTTOM_SYM,Tokens.RIGHTTOP_SYM,Tokens.RIGHTMIDDLE_SYM,Tokens.RIGHTBOTTOM_SYM])?SyntaxUnit.fromToken(e.token()):null},_pseudo_page:function(){var e=this._tokenStream;return e.mustMatch(Tokens.COLON),e.mustMatch(Tokens.IDENT),e.token().value},_font_face:function(){var e=this._tokenStream,t,n;e.mustMatch(Tokens.FONT_FACE_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),this.fire({type:\"startfontface\",line:t,col:n}),this._readDeclarations(!0),this.fire({type:\"endfontface\",line:t,col:n})},_viewport:function(){var e=this._tokenStream,t,n;e.mustMatch(Tokens.VIEWPORT_SYM),t=e.token().startLine,n=e.token().startCol,this._readWhitespace(),this.fire({type:\"startviewport\",line:t,col:n}),this._readDeclarations(!0),this.fire({type:\"endviewport\",line:t,col:n})},_operator:function(e){var t=this._tokenStream,n=null;if(t.match([Tokens.SLASH,Tokens.COMMA])||e&&t.match([Tokens.PLUS,Tokens.STAR,Tokens.MINUS]))n=t.token(),this._readWhitespace();return n?PropertyValuePart.fromToken(n):null},_combinator:function(){var e=this._tokenStream,t=null,n;return e.match([Tokens.PLUS,Tokens.GREATER,Tokens.TILDE])&&(n=e.token(),t=new Combinator(n.value,n.startLine,n.startCol),this._readWhitespace()),t},_unary_operator:function(){var e=this._tokenStream;return e.match([Tokens.MINUS,Tokens.PLUS])?e.token().value:null},_property:function(){var e=this._tokenStream,t=null,n=null,r,i,s,o;return e.peek()==Tokens.STAR&&this.options.starHack&&(e.get(),i=e.token(),n=i.value,s=i.startLine,o=i.startCol),e.match(Tokens.IDENT)&&(i=e.token(),r=i.value,r.charAt(0)==\"_\"&&this.options.underscoreHack&&(n=\"_\",r=r.substring(1)),t=new PropertyName(r,n,s||i.startLine,o||i.startCol),this._readWhitespace()),t},_ruleset:function(){var e=this._tokenStream,t,n;try{n=this._selectors_group()}catch(r){if(r instanceof SyntaxError&&!this.options.strict){this.fire({type:\"error\",error:r,message:r.message,line:r.line,col:r.col}),t=e.advance([Tokens.RBRACE]);if(t!=Tokens.RBRACE)throw r;return!0}throw r}return n&&(this.fire({type:\"startrule\",selectors:n,line:n[0].line,col:n[0].col}),this._readDeclarations(!0),this.fire({type:\"endrule\",selectors:n,line:n[0].line,col:n[0].col})),n},_selectors_group:function(){var e=this._tokenStream,t=[],n;n=this._selector();if(n!==null){t.push(n);while(e.match(Tokens.COMMA))this._readWhitespace(),n=this._selector(),n!==null?t.push(n):this._unexpectedToken(e.LT(1))}return t.length?t:null},_selector:function(){var e=this._tokenStream,t=[],n=null,r=null,i=null;n=this._simple_selector_sequence();if(n===null)return null;t.push(n);do{r=this._combinator();if(r!==null)t.push(r),n=this._simple_selector_sequence(),n===null?this._unexpectedToken(e.LT(1)):t.push(n);else{if(!this._readWhitespace())break;i=new Combinator(e.token().value,e.token().startLine,e.token().startCol),r=this._combinator(),n=this._simple_selector_sequence(),n===null?r!==null&&this._unexpectedToken(e.LT(1)):(r!==null?t.push(r):t.push(i),t.push(n))}}while(!0);return new Selector(t,t[0].line,t[0].col)},_simple_selector_sequence:function(){var e=this._tokenStream,t=null,n=[],r=\"\",i=[function(){return e.match(Tokens.HASH)?new SelectorSubPart(e.token().value,\"id\",e.token().startLine,e.token().startCol):null},this._class,this._attrib,this._pseudo,this._negation],s=0,o=i.length,u=null,a=!1,f,l;f=e.LT(1).startLine,l=e.LT(1).startCol,t=this._type_selector(),t||(t=this._universal()),t!==null&&(r+=t);for(;;){if(e.peek()===Tokens.S)break;while(s<o&&u===null)u=i[s++].call(this);if(u===null){if(r===\"\")return null;break}s=0,n.push(u),r+=u.toString(),u=null}return r!==\"\"?new SelectorPart(t,n,r,f,l):null},_type_selector:function(){var e=this._tokenStream,t=this._namespace_prefix(),n=this._element_name();return n?(t&&(n.text=t+n.text,n.col-=t.length),n):(t&&(e.unget(),t.length>1&&e.unget()),null)},_class:function(){var e=this._tokenStream,t;return e.match(Tokens.DOT)?(e.mustMatch(Tokens.IDENT),t=e.token(),new SelectorSubPart(\".\"+t.value,\"class\",t.startLine,t.startCol-1)):null},_element_name:function(){var e=this._tokenStream,t;return e.match(Tokens.IDENT)?(t=e.token(),new SelectorSubPart(t.value,\"elementName\",t.startLine,t.startCol)):null},_namespace_prefix:function(){var e=this._tokenStream,t=\"\";if(e.LA(1)===Tokens.PIPE||e.LA(2)===Tokens.PIPE)e.match([Tokens.IDENT,Tokens.STAR])&&(t+=e.token().value),e.mustMatch(Tokens.PIPE),t+=\"|\";return t.length?t:null},_universal:function(){var e=this._tokenStream,t=\"\",n;return n=this._namespace_prefix(),n&&(t+=n),e.match(Tokens.STAR)&&(t+=\"*\"),t.length?t:null},_attrib:function(){var e=this._tokenStream,t=null,n,r;return e.match(Tokens.LBRACKET)?(r=e.token(),t=r.value,t+=this._readWhitespace(),n=this._namespace_prefix(),n&&(t+=n),e.mustMatch(Tokens.IDENT),t+=e.token().value,t+=this._readWhitespace(),e.match([Tokens.PREFIXMATCH,Tokens.SUFFIXMATCH,Tokens.SUBSTRINGMATCH,Tokens.EQUALS,Tokens.INCLUDES,Tokens.DASHMATCH])&&(t+=e.token().value,t+=this._readWhitespace(),e.mustMatch([Tokens.IDENT,Tokens.STRING]),t+=e.token().value,t+=this._readWhitespace()),e.mustMatch(Tokens.RBRACKET),new SelectorSubPart(t+\"]\",\"attribute\",r.startLine,r.startCol)):null},_pseudo:function(){var e=this._tokenStream,t=null,n=\":\",r,i;return e.match(Tokens.COLON)&&(e.match(Tokens.COLON)&&(n+=\":\"),e.match(Tokens.IDENT)?(t=e.token().value,r=e.token().startLine,i=e.token().startCol-n.length):e.peek()==Tokens.FUNCTION&&(r=e.LT(1).startLine,i=e.LT(1).startCol-n.length,t=this._functional_pseudo()),t&&(t=new SelectorSubPart(n+t,\"pseudo\",r,i))),t},_functional_pseudo:function(){var e=this._tokenStream,t=null;return e.match(Tokens.FUNCTION)&&(t=e.token().value,t+=this._readWhitespace(),t+=this._expression(),e.mustMatch(Tokens.RPAREN),t+=\")\"),t},_expression:function(){var e=this._tokenStream,t=\"\";while(e.match([Tokens.PLUS,Tokens.MINUS,Tokens.DIMENSION,Tokens.NUMBER,Tokens.STRING,Tokens.IDENT,Tokens.LENGTH,Tokens.FREQ,Tokens.ANGLE,Tokens.TIME,Tokens.RESOLUTION,Tokens.SLASH]))t+=e.token().value,t+=this._readWhitespace();return t.length?t:null},_negation:function(){var e=this._tokenStream,t,n,r=\"\",i,s=null;return e.match(Tokens.NOT)&&(r=e.token().value,t=e.token().startLine,n=e.token().startCol,r+=this._readWhitespace(),i=this._negation_arg(),r+=i,r+=this._readWhitespace(),e.match(Tokens.RPAREN),r+=e.token().value,s=new SelectorSubPart(r,\"not\",t,n),s.args.push(i)),s},_negation_arg:function(){var e=this._tokenStream,t=[this._type_selector,this._universal,function(){return e.match(Tokens.HASH)?new SelectorSubPart(e.token().value,\"id\",e.token().startLine,e.token().startCol):null},this._class,this._attrib,this._pseudo],n=null,r=0,i=t.length,s,o,u,a;o=e.LT(1).startLine,u=e.LT(1).startCol;while(r<i&&n===null)n=t[r].call(this),r++;return n===null&&this._unexpectedToken(e.LT(1)),n.type==\"elementName\"?a=new SelectorPart(n,[],n.toString(),o,u):a=new SelectorPart(null,[n],n.toString(),o,u),a},_declaration:function(){var e=this._tokenStream,t=null,n=null,r=null,i=null,s=null,o=\"\";t=this._property();if(t!==null){e.mustMatch(Tokens.COLON),this._readWhitespace(),n=this._expr(),(!n||n.length===0)&&this._unexpectedToken(e.LT(1)),r=this._prio(),o=t.toString();if(this.options.starHack&&t.hack==\"*\"||this.options.underscoreHack&&t.hack==\"_\")o=t.text;try{this._validateProperty(o,n)}catch(u){s=u}return this.fire({type:\"property\",property:t,value:n,important:r,line:t.line,col:t.col,invalid:s}),!0}return!1},_prio:function(){var e=this._tokenStream,t=e.match(Tokens.IMPORTANT_SYM);return this._readWhitespace(),t},_expr:function(e){var t=this._tokenStream,n=[],r=null,i=null;r=this._term();if(r!==null){n.push(r);do{i=this._operator(e),i&&n.push(i),r=this._term();if(r===null)break;n.push(r)}while(!0)}return n.length>0?new PropertyValue(n,n[0].line,n[0].col):null},_term:function(){var e=this._tokenStream,t=null,n=null,r,i,s;return t=this._unary_operator(),t!==null&&(i=e.token().startLine,s=e.token().startCol),e.peek()==Tokens.IE_FUNCTION&&this.options.ieFilters?(n=this._ie_function(),t===null&&(i=e.token().startLine,s=e.token().startCol)):e.match([Tokens.NUMBER,Tokens.PERCENTAGE,Tokens.LENGTH,Tokens.ANGLE,Tokens.TIME,Tokens.FREQ,Tokens.STRING,Tokens.IDENT,Tokens.URI,Tokens.UNICODE_RANGE])?(n=e.token().value,t===null&&(i=e.token().startLine,s=e.token().startCol),this._readWhitespace()):(r=this._hexcolor(),r===null?(t===null&&(i=e.LT(1).startLine,s=e.LT(1).startCol),n===null&&(e.LA(3)==Tokens.EQUALS&&this.options.ieFilters?n=this._ie_function():n=this._function())):(n=r.value,t===null&&(i=r.startLine,s=r.startCol))),n!==null?new PropertyValuePart(t!==null?t+n:n,i,s):null},_function:function(){var e=this._tokenStream,t=null,n=null,r;if(e.match(Tokens.FUNCTION)){t=e.token().value,this._readWhitespace(),n=this._expr(!0),t+=n;if(this.options.ieFilters&&e.peek()==Tokens.EQUALS)do{this._readWhitespace()&&(t+=e.token().value),e.LA(0)==Tokens.COMMA&&(t+=e.token().value),e.match(Tokens.IDENT),t+=e.token().value,e.match(Tokens.EQUALS),t+=e.token().value,r=e.peek();while(r!=Tokens.COMMA&&r!=Tokens.S&&r!=Tokens.RPAREN)e.get(),t+=e.token().value,r=e.peek()}while(e.match([Tokens.COMMA,Tokens.S]));e.match(Tokens.RPAREN),t+=\")\",this._readWhitespace()}return t},_ie_function:function(){var e=this._tokenStream,t=null,n=null,r;if(e.match([Tokens.IE_FUNCTION,Tokens.FUNCTION])){t=e.token().value;do{this._readWhitespace()&&(t+=e.token().value),e.LA(0)==Tokens.COMMA&&(t+=e.token().value),e.match(Tokens.IDENT),t+=e.token().value,e.match(Tokens.EQUALS),t+=e.token().value,r=e.peek();while(r!=Tokens.COMMA&&r!=Tokens.S&&r!=Tokens.RPAREN)e.get(),t+=e.token().value,r=e.peek()}while(e.match([Tokens.COMMA,Tokens.S]));e.match(Tokens.RPAREN),t+=\")\",this._readWhitespace()}return t},_hexcolor:function(){var e=this._tokenStream,t=null,n;if(e.match(Tokens.HASH)){t=e.token(),n=t.value;if(!/#[a-f0-9]{3,6}/i.test(n))throw new SyntaxError(\"Expected a hex color but found '\"+n+\"' at line \"+t.startLine+\", col \"+t.startCol+\".\",t.startLine,t.startCol);this._readWhitespace()}return t},_keyframes:function(){var e=this._tokenStream,t,n,r,i=\"\";e.mustMatch(Tokens.KEYFRAMES_SYM),t=e.token(),/^@\\-([^\\-]+)\\-/.test(t.value)&&(i=RegExp.$1),this._readWhitespace(),r=this._keyframe_name(),this._readWhitespace(),e.mustMatch(Tokens.LBRACE),this.fire({type:\"startkeyframes\",name:r,prefix:i,line:t.startLine,col:t.startCol}),this._readWhitespace(),n=e.peek();while(n==Tokens.IDENT||n==Tokens.PERCENTAGE)this._keyframe_rule(),this._readWhitespace(),n=e.peek();this.fire({type:\"endkeyframes\",name:r,prefix:i,line:t.startLine,col:t.startCol}),this._readWhitespace(),e.mustMatch(Tokens.RBRACE)},_keyframe_name:function(){var e=this._tokenStream,t;return e.mustMatch([Tokens.IDENT,Tokens.STRING]),SyntaxUnit.fromToken(e.token())},_keyframe_rule:function(){var e=this._tokenStream,t,n=this._key_list();this.fire({type:\"startkeyframerule\",keys:n,line:n[0].line,col:n[0].col}),this._readDeclarations(!0),this.fire({type:\"endkeyframerule\",keys:n,line:n[0].line,col:n[0].col})},_key_list:function(){var e=this._tokenStream,t,n,r=[];r.push(this._key()),this._readWhitespace();while(e.match(Tokens.COMMA))this._readWhitespace(),r.push(this._key()),this._readWhitespace();return r},_key:function(){var e=this._tokenStream,t;if(e.match(Tokens.PERCENTAGE))return SyntaxUnit.fromToken(e.token());if(e.match(Tokens.IDENT)){t=e.token();if(/from|to/i.test(t.value))return SyntaxUnit.fromToken(t);e.unget()}this._unexpectedToken(e.LT(1))},_skipCruft:function(){while(this._tokenStream.match([Tokens.S,Tokens.CDO,Tokens.CDC]));},_readDeclarations:function(e,t){var n=this._tokenStream,r;this._readWhitespace(),e&&n.mustMatch(Tokens.LBRACE),this._readWhitespace();try{for(;;){if(!(n.match(Tokens.SEMICOLON)||t&&this._margin())){if(!this._declaration())break;if(!n.match(Tokens.SEMICOLON))break}this._readWhitespace()}n.mustMatch(Tokens.RBRACE),this._readWhitespace()}catch(i){if(!(i instanceof SyntaxError&&!this.options.strict))throw i;this.fire({type:\"error\",error:i,message:i.message,line:i.line,col:i.col}),r=n.advance([Tokens.SEMICOLON,Tokens.RBRACE]);if(r==Tokens.SEMICOLON)this._readDeclarations(!1,t);else if(r!=Tokens.RBRACE)throw i}},_readWhitespace:function(){var e=this._tokenStream,t=\"\";while(e.match(Tokens.S))t+=e.token().value;return t},_unexpectedToken:function(e){throw new SyntaxError(\"Unexpected token '\"+e.value+\"' at line \"+e.startLine+\", col \"+e.startCol+\".\",e.startLine,e.startCol)},_verifyEnd:function(){this._tokenStream.LA(1)!=Tokens.EOF&&this._unexpectedToken(this._tokenStream.LT(1))},_validateProperty:function(e,t){Validation.validate(e,t)},parse:function(e){this._tokenStream=new TokenStream(e,Tokens),this._stylesheet()},parseStyleSheet:function(e){return this.parse(e)},parseMediaQuery:function(e){this._tokenStream=new TokenStream(e,Tokens);var t=this._media_query();return this._verifyEnd(),t},parsePropertyValue:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._expr();return this._readWhitespace(),this._verifyEnd(),t},parseRule:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._ruleset();return this._readWhitespace(),this._verifyEnd(),t},parseSelector:function(e){this._tokenStream=new TokenStream(e,Tokens),this._readWhitespace();var t=this._selector();return this._readWhitespace(),this._verifyEnd(),t},parseStyleAttribute:function(e){e+=\"}\",this._tokenStream=new TokenStream(e,Tokens),this._readDeclarations()}};for(t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e}();var Properties={\"align-items\":\"flex-start | flex-end | center | baseline | stretch\",\"align-content\":\"flex-start | flex-end | center | space-between | space-around | stretch\",\"align-self\":\"auto | flex-start | flex-end | center | baseline | stretch\",\"-webkit-align-items\":\"flex-start | flex-end | center | baseline | stretch\",\"-webkit-align-content\":\"flex-start | flex-end | center | space-between | space-around | stretch\",\"-webkit-align-self\":\"auto | flex-start | flex-end | center | baseline | stretch\",\"alignment-adjust\":\"auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | <percentage> | <length>\",\"alignment-baseline\":\"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",animation:1,\"animation-delay\":{multi:\"<time>\",comma:!0},\"animation-direction\":{multi:\"normal | alternate\",comma:!0},\"animation-duration\":{multi:\"<time>\",comma:!0},\"animation-iteration-count\":{multi:\"<number> | infinite\",comma:!0},\"animation-name\":{multi:\"none | <ident>\",comma:!0},\"animation-play-state\":{multi:\"running | paused\",comma:!0},\"animation-timing-function\":1,\"-moz-animation-delay\":{multi:\"<time>\",comma:!0},\"-moz-animation-direction\":{multi:\"normal | alternate\",comma:!0},\"-moz-animation-duration\":{multi:\"<time>\",comma:!0},\"-moz-animation-iteration-count\":{multi:\"<number> | infinite\",comma:!0},\"-moz-animation-name\":{multi:\"none | <ident>\",comma:!0},\"-moz-animation-play-state\":{multi:\"running | paused\",comma:!0},\"-ms-animation-delay\":{multi:\"<time>\",comma:!0},\"-ms-animation-direction\":{multi:\"normal | alternate\",comma:!0},\"-ms-animation-duration\":{multi:\"<time>\",comma:!0},\"-ms-animation-iteration-count\":{multi:\"<number> | infinite\",comma:!0},\"-ms-animation-name\":{multi:\"none | <ident>\",comma:!0},\"-ms-animation-play-state\":{multi:\"running | paused\",comma:!0},\"-webkit-animation-delay\":{multi:\"<time>\",comma:!0},\"-webkit-animation-direction\":{multi:\"normal | alternate\",comma:!0},\"-webkit-animation-duration\":{multi:\"<time>\",comma:!0},\"-webkit-animation-iteration-count\":{multi:\"<number> | infinite\",comma:!0},\"-webkit-animation-name\":{multi:\"none | <ident>\",comma:!0},\"-webkit-animation-play-state\":{multi:\"running | paused\",comma:!0},\"-o-animation-delay\":{multi:\"<time>\",comma:!0},\"-o-animation-direction\":{multi:\"normal | alternate\",comma:!0},\"-o-animation-duration\":{multi:\"<time>\",comma:!0},\"-o-animation-iteration-count\":{multi:\"<number> | infinite\",comma:!0},\"-o-animation-name\":{multi:\"none | <ident>\",comma:!0},\"-o-animation-play-state\":{multi:\"running | paused\",comma:!0},appearance:\"icon | window | desktop | workspace | document | tooltip | dialog | button | push-button | hyperlink | radio-button | checkbox | menu-item | tab | menu | menubar | pull-down-menu | pop-up-menu | list-menu | radio-group | checkbox-group | outline-tree | range | field | combo-box | signature | password | normal | none | inherit\",azimuth:function(e){var t=\"<angle> | leftwards | rightwards | inherit\",n=\"left-side | far-left | left | center-left | center | center-right | right | far-right | right-side\",r=!1,i=!1,s;ValidationTypes.isAny(e,t)||(ValidationTypes.isAny(e,\"behind\")&&(r=!0,i=!0),ValidationTypes.isAny(e,n)&&(i=!0,r||ValidationTypes.isAny(e,\"behind\")));if(e.hasNext())throw s=e.next(),i?new ValidationError(\"Expected end of value but found '\"+s+\"'.\",s.line,s.col):new ValidationError(\"Expected (<'azimuth'>) but found '\"+s+\"'.\",s.line,s.col)},\"backface-visibility\":\"visible | hidden\",background:1,\"background-attachment\":{multi:\"<attachment>\",comma:!0},\"background-clip\":{multi:\"<box>\",comma:!0},\"background-color\":\"<color> | inherit\",\"background-image\":{multi:\"<bg-image>\",comma:!0},\"background-origin\":{multi:\"<box>\",comma:!0},\"background-position\":{multi:\"<bg-position>\",comma:!0},\"background-repeat\":{multi:\"<repeat-style>\"},\"background-size\":{multi:\"<bg-size>\",comma:!0},\"baseline-shift\":\"baseline | sub | super | <percentage> | <length>\",behavior:1,binding:1,bleed:\"<length>\",\"bookmark-label\":\"<content> | <attr> | <string>\",\"bookmark-level\":\"none | <integer>\",\"bookmark-state\":\"open | closed\",\"bookmark-target\":\"none | <uri> | <attr>\",border:\"<border-width> || <border-style> || <color>\",\"border-bottom\":\"<border-width> || <border-style> || <color>\",\"border-bottom-color\":\"<color> | inherit\",\"border-bottom-left-radius\":\"<x-one-radius>\",\"border-bottom-right-radius\":\"<x-one-radius>\",\"border-bottom-style\":\"<border-style>\",\"border-bottom-width\":\"<border-width>\",\"border-collapse\":\"collapse | separate | inherit\",\"border-color\":{multi:\"<color> | inherit\",max:4},\"border-image\":1,\"border-image-outset\":{multi:\"<length> | <number>\",max:4},\"border-image-repeat\":{multi:\"stretch | repeat | round\",max:2},\"border-image-slice\":function(e){var t=!1,n=\"<number> | <percentage>\",r=!1,i=0,s=4,o;ValidationTypes.isAny(e,\"fill\")&&(r=!0,t=!0);while(e.hasNext()&&i<s){t=ValidationTypes.isAny(e,n);if(!t)break;i++}r?t=!0:ValidationTypes.isAny(e,\"fill\");if(e.hasNext())throw o=e.next(),t?new ValidationError(\"Expected end of value but found '\"+o+\"'.\",o.line,o.col):new ValidationError(\"Expected ([<number> | <percentage>]{1,4} && fill?) but found '\"+o+\"'.\",o.line,o.col)},\"border-image-source\":\"<image> | none\",\"border-image-width\":{multi:\"<length> | <percentage> | <number> | auto\",max:4},\"border-left\":\"<border-width> || <border-style> || <color>\",\"border-left-color\":\"<color> | inherit\",\"border-left-style\":\"<border-style>\",\"border-left-width\":\"<border-width>\",\"border-radius\":function(e){var t=!1,n=\"<length> | <percentage> | inherit\",r=!1,i=!1,s=0,o=8,u;while(e.hasNext()&&s<o){t=ValidationTypes.isAny(e,n);if(!t){if(!(e.peek()==\"/\"&&s>0&&!r))break;r=!0,o=s+5,e.next()}s++}if(e.hasNext())throw u=e.next(),t?new ValidationError(\"Expected end of value but found '\"+u+\"'.\",u.line,u.col):new ValidationError(\"Expected (<'border-radius'>) but found '\"+u+\"'.\",u.line,u.col)},\"border-right\":\"<border-width> || <border-style> || <color>\",\"border-right-color\":\"<color> | inherit\",\"border-right-style\":\"<border-style>\",\"border-right-width\":\"<border-width>\",\"border-spacing\":{multi:\"<length> | inherit\",max:2},\"border-style\":{multi:\"<border-style>\",max:4},\"border-top\":\"<border-width> || <border-style> || <color>\",\"border-top-color\":\"<color> | inherit\",\"border-top-left-radius\":\"<x-one-radius>\",\"border-top-right-radius\":\"<x-one-radius>\",\"border-top-style\":\"<border-style>\",\"border-top-width\":\"<border-width>\",\"border-width\":{multi:\"<border-width>\",max:4},bottom:\"<margin-width> | inherit\",\"-moz-box-align\":\"start | end | center | baseline | stretch\",\"-moz-box-decoration-break\":\"slice |clone\",\"-moz-box-direction\":\"normal | reverse | inherit\",\"-moz-box-flex\":\"<number>\",\"-moz-box-flex-group\":\"<integer>\",\"-moz-box-lines\":\"single | multiple\",\"-moz-box-ordinal-group\":\"<integer>\",\"-moz-box-orient\":\"horizontal | vertical | inline-axis | block-axis | inherit\",\"-moz-box-pack\":\"start | end | center | justify\",\"-webkit-box-align\":\"start | end | center | baseline | stretch\",\"-webkit-box-decoration-break\":\"slice |clone\",\"-webkit-box-direction\":\"normal | reverse | inherit\",\"-webkit-box-flex\":\"<number>\",\"-webkit-box-flex-group\":\"<integer>\",\"-webkit-box-lines\":\"single | multiple\",\"-webkit-box-ordinal-group\":\"<integer>\",\"-webkit-box-orient\":\"horizontal | vertical | inline-axis | block-axis | inherit\",\"-webkit-box-pack\":\"start | end | center | justify\",\"box-shadow\":function(e){var t=!1,n;if(!ValidationTypes.isAny(e,\"none\"))Validation.multiProperty(\"<shadow>\",e,!0,Infinity);else if(e.hasNext())throw n=e.next(),new ValidationError(\"Expected end of value but found '\"+n+\"'.\",n.line,n.col)},\"box-sizing\":\"content-box | border-box | inherit\",\"break-after\":\"auto | always | avoid | left | right | page | column | avoid-page | avoid-column\",\"break-before\":\"auto | always | avoid | left | right | page | column | avoid-page | avoid-column\",\"break-inside\":\"auto | avoid | avoid-page | avoid-column\",\"caption-side\":\"top | bottom | inherit\",clear:\"none | right | left | both | inherit\",clip:1,color:\"<color> | inherit\",\"color-profile\":1,\"column-count\":\"<integer> | auto\",\"column-fill\":\"auto | balance\",\"column-gap\":\"<length> | normal\",\"column-rule\":\"<border-width> || <border-style> || <color>\",\"column-rule-color\":\"<color>\",\"column-rule-style\":\"<border-style>\",\"column-rule-width\":\"<border-width>\",\"column-span\":\"none | all\",\"column-width\":\"<length> | auto\",columns:1,content:1,\"counter-increment\":1,\"counter-reset\":1,crop:\"<shape> | auto\",cue:\"cue-after | cue-before | inherit\",\"cue-after\":1,\"cue-before\":1,cursor:1,direction:\"ltr | rtl | inherit\",display:\"inline | block | list-item | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | grid | inline-grid | none | inherit | -moz-box | -moz-inline-block | -moz-inline-box | -moz-inline-grid | -moz-inline-stack | -moz-inline-table | -moz-grid | -moz-grid-group | -moz-grid-line | -moz-groupbox | -moz-deck | -moz-popup | -moz-stack | -moz-marker | -webkit-box | -webkit-inline-box | -ms-flexbox | -ms-inline-flexbox | flex | -webkit-flex | inline-flex | -webkit-inline-flex\",\"dominant-baseline\":1,\"drop-initial-after-adjust\":\"central | middle | after-edge | text-after-edge | ideographic | alphabetic | mathematical | <percentage> | <length>\",\"drop-initial-after-align\":\"baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",\"drop-initial-before-adjust\":\"before-edge | text-before-edge | central | middle | hanging | mathematical | <percentage> | <length>\",\"drop-initial-before-align\":\"caps-height | baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical\",\"drop-initial-size\":\"auto | line | <length> | <percentage>\",\"drop-initial-value\":\"initial | <integer>\",elevation:\"<angle> | below | level | above | higher | lower | inherit\",\"empty-cells\":\"show | hide | inherit\",filter:1,fit:\"fill | hidden | meet | slice\",\"fit-position\":1,flex:\"none | [ <flex-grow> <flex-shrink>? || <flex-basis>\",\"flex-basis\":\"<width>\",\"flex-direction\":\"row | row-reverse | column | column-reverse\",\"flex-flow\":\"<flex-direction> || <flex-wrap>\",\"flex-grow\":\"<number>\",\"flex-shrink\":\"<number>\",\"flex-wrap\":\"nowrap | wrap | wrap-reverse\",\"-webkit-flex\":\"none | [ <flex-grow> <flex-shrink>? || <flex-basis>\",\"-webkit-flex-basis\":\"<width>\",\"-webkit-flex-direction\":\"row | row-reverse | column | column-reverse\",\"-webkit-flex-flow\":\"<flex-direction> || <flex-wrap>\",\"-webkit-flex-grow\":\"<number>\",\"-webkit-flex-shrink\":\"<number>\",\"-webkit-flex-wrap\":\"nowrap | wrap | wrap-reverse\",\"-ms-flex\":\"[[ <number> <number>? ] || [ <length> || <percentage> || auto ] ] | none\",\"-ms-flex-align\":\"start | end | center | stretch | baseline\",\"-ms-flex-direction\":\"row | column | row-reverse | column-reverse | inherit\",\"-ms-flex-order\":\"<number>\",\"-ms-flex-pack\":\"start | end | center | justify\",\"-ms-flex-wrap\":\"nowrap | wrap | wrap-reverse\",\"float\":\"left | right | none | inherit\",\"float-offset\":1,font:1,\"font-family\":1,\"font-size\":\"<absolute-size> | <relative-size> | <length> | <percentage> | inherit\",\"font-size-adjust\":\"<number> | none | inherit\",\"font-stretch\":\"normal | ultra-condensed | extra-condensed | condensed | semi-condensed | semi-expanded | expanded | extra-expanded | ultra-expanded | inherit\",\"font-style\":\"normal | italic | oblique | inherit\",\"font-variant\":\"normal | small-caps | inherit\",\"font-weight\":\"normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit\",\"grid-cell-stacking\":\"columns | rows | layer\",\"grid-column\":1,\"grid-columns\":1,\"grid-column-align\":\"start | end | center | stretch\",\"grid-column-sizing\":1,\"grid-column-span\":\"<integer>\",\"grid-flow\":\"none | rows | columns\",\"grid-layer\":\"<integer>\",\"grid-row\":1,\"grid-rows\":1,\"grid-row-align\":\"start | end | center | stretch\",\"grid-row-span\":\"<integer>\",\"grid-row-sizing\":1,\"hanging-punctuation\":1,height:\"<margin-width> | inherit\",\"hyphenate-after\":\"<integer> | auto\",\"hyphenate-before\":\"<integer> | auto\",\"hyphenate-character\":\"<string> | auto\",\"hyphenate-lines\":\"no-limit | <integer>\",\"hyphenate-resource\":1,hyphens:\"none | manual | auto\",icon:1,\"image-orientation\":\"angle | auto\",\"image-rendering\":1,\"image-resolution\":1,\"inline-box-align\":\"initial | last | <integer>\",\"justify-content\":\"flex-start | flex-end | center | space-between | space-around\",\"-webkit-justify-content\":\"flex-start | flex-end | center | space-between | space-around\",left:\"<margin-width> | inherit\",\"letter-spacing\":\"<length> | normal | inherit\",\"line-height\":\"<number> | <length> | <percentage> | normal | inherit\",\"line-break\":\"auto | loose | normal | strict\",\"line-stacking\":1,\"line-stacking-ruby\":\"exclude-ruby | include-ruby\",\"line-stacking-shift\":\"consider-shifts | disregard-shifts\",\"line-stacking-strategy\":\"inline-line-height | block-line-height | max-height | grid-height\",\"list-style\":1,\"list-style-image\":\"<uri> | none | inherit\",\"list-style-position\":\"inside | outside | inherit\",\"list-style-type\":\"disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | lower-alpha | upper-alpha | none | inherit\",margin:{multi:\"<margin-width> | inherit\",max:4},\"margin-bottom\":\"<margin-width> | inherit\",\"margin-left\":\"<margin-width> | inherit\",\"margin-right\":\"<margin-width> | inherit\",\"margin-top\":\"<margin-width> | inherit\",mark:1,\"mark-after\":1,\"mark-before\":1,marks:1,\"marquee-direction\":1,\"marquee-play-count\":1,\"marquee-speed\":1,\"marquee-style\":1,\"max-height\":\"<length> | <percentage> | none | inherit\",\"max-width\":\"<length> | <percentage> | none | inherit\",\"min-height\":\"<length> | <percentage> | inherit\",\"min-width\":\"<length> | <percentage> | inherit\",\"move-to\":1,\"nav-down\":1,\"nav-index\":1,\"nav-left\":1,\"nav-right\":1,\"nav-up\":1,opacity:\"<number> | inherit\",order:\"<integer>\",\"-webkit-order\":\"<integer>\",orphans:\"<integer> | inherit\",outline:1,\"outline-color\":\"<color> | invert | inherit\",\"outline-offset\":1,\"outline-style\":\"<border-style> | inherit\",\"outline-width\":\"<border-width> | inherit\",overflow:\"visible | hidden | scroll | auto | inherit\",\"overflow-style\":1,\"overflow-wrap\":\"normal | break-word\",\"overflow-x\":1,\"overflow-y\":1,padding:{multi:\"<padding-width> | inherit\",max:4},\"padding-bottom\":\"<padding-width> | inherit\",\"padding-left\":\"<padding-width> | inherit\",\"padding-right\":\"<padding-width> | inherit\",\"padding-top\":\"<padding-width> | inherit\",page:1,\"page-break-after\":\"auto | always | avoid | left | right | inherit\",\"page-break-before\":\"auto | always | avoid | left | right | inherit\",\"page-break-inside\":\"auto | avoid | inherit\",\"page-policy\":1,pause:1,\"pause-after\":1,\"pause-before\":1,perspective:1,\"perspective-origin\":1,phonemes:1,pitch:1,\"pitch-range\":1,\"play-during\":1,\"pointer-events\":\"auto | none | visiblePainted | visibleFill | visibleStroke | visible | painted | fill | stroke | all | inherit\",position:\"static | relative | absolute | fixed | inherit\",\"presentation-level\":1,\"punctuation-trim\":1,quotes:1,\"rendering-intent\":1,resize:1,rest:1,\"rest-after\":1,\"rest-before\":1,richness:1,right:\"<margin-width> | inherit\",rotation:1,\"rotation-point\":1,\"ruby-align\":1,\"ruby-overhang\":1,\"ruby-position\":1,\"ruby-span\":1,size:1,speak:\"normal | none | spell-out | inherit\",\"speak-header\":\"once | always | inherit\",\"speak-numeral\":\"digits | continuous | inherit\",\"speak-punctuation\":\"code | none | inherit\",\"speech-rate\":1,src:1,stress:1,\"string-set\":1,\"table-layout\":\"auto | fixed | inherit\",\"tab-size\":\"<integer> | <length>\",target:1,\"target-name\":1,\"target-new\":1,\"target-position\":1,\"text-align\":\"left | right | center | justify | inherit\",\"text-align-last\":1,\"text-decoration\":1,\"text-emphasis\":1,\"text-height\":1,\"text-indent\":\"<length> | <percentage> | inherit\",\"text-justify\":\"auto | none | inter-word | inter-ideograph | inter-cluster | distribute | kashida\",\"text-outline\":1,\"text-overflow\":1,\"text-rendering\":\"auto | optimizeSpeed | optimizeLegibility | geometricPrecision | inherit\",\"text-shadow\":1,\"text-transform\":\"capitalize | uppercase | lowercase | none | inherit\",\"text-wrap\":\"normal | none | avoid\",top:\"<margin-width> | inherit\",\"-ms-touch-action\":\"auto | none | pan-x | pan-y\",\"touch-action\":\"auto | none | pan-x | pan-y\",transform:1,\"transform-origin\":1,\"transform-style\":1,transition:1,\"transition-delay\":1,\"transition-duration\":1,\"transition-property\":1,\"transition-timing-function\":1,\"unicode-bidi\":\"normal | embed | isolate | bidi-override | isolate-override | plaintext | inherit\",\"user-modify\":\"read-only | read-write | write-only | inherit\",\"user-select\":\"none | text | toggle | element | elements | all | inherit\",\"vertical-align\":\"auto | use-script | baseline | sub | super | top | text-top | central | middle | bottom | text-bottom | <percentage> | <length>\",visibility:\"visible | hidden | collapse | inherit\",\"voice-balance\":1,\"voice-duration\":1,\"voice-family\":1,\"voice-pitch\":1,\"voice-pitch-range\":1,\"voice-rate\":1,\"voice-stress\":1,\"voice-volume\":1,volume:1,\"white-space\":\"normal | pre | nowrap | pre-wrap | pre-line | inherit | -pre-wrap | -o-pre-wrap | -moz-pre-wrap | -hp-pre-wrap\",\"white-space-collapse\":1,widows:\"<integer> | inherit\",width:\"<length> | <percentage> | auto | inherit\",\"word-break\":\"normal | keep-all | break-all\",\"word-spacing\":\"<length> | normal | inherit\",\"word-wrap\":\"normal | break-word\",\"writing-mode\":\"horizontal-tb | vertical-rl | vertical-lr | lr-tb | rl-tb | tb-rl | bt-rl | tb-lr | bt-lr | lr-bt | rl-bt | lr | rl | tb | inherit\",\"z-index\":\"<integer> | auto | inherit\",zoom:\"<number> | <percentage> | normal\"};PropertyName.prototype=new SyntaxUnit,PropertyName.prototype.constructor=PropertyName,PropertyName.prototype.toString=function(){return(this.hack?this.hack:\"\")+this.text},PropertyValue.prototype=new SyntaxUnit,PropertyValue.prototype.constructor=PropertyValue,PropertyValueIterator.prototype.count=function(){return this._parts.length},PropertyValueIterator.prototype.isFirst=function(){return this._i===0},PropertyValueIterator.prototype.hasNext=function(){return this._i<this._parts.length},PropertyValueIterator.prototype.mark=function(){this._marks.push(this._i)},PropertyValueIterator.prototype.peek=function(e){return this.hasNext()?this._parts[this._i+(e||0)]:null},PropertyValueIterator.prototype.next=function(){return this.hasNext()?this._parts[this._i++]:null},PropertyValueIterator.prototype.previous=function(){return this._i>0?this._parts[--this._i]:null},PropertyValueIterator.prototype.restore=function(){this._marks.length&&(this._i=this._marks.pop())},PropertyValuePart.prototype=new SyntaxUnit,PropertyValuePart.prototype.constructor=PropertyValuePart,PropertyValuePart.fromToken=function(e){return new PropertyValuePart(e.value,e.startLine,e.startCol)};var Pseudos={\":first-letter\":1,\":first-line\":1,\":before\":1,\":after\":1};Pseudos.ELEMENT=1,Pseudos.CLASS=2,Pseudos.isElement=function(e){return e.indexOf(\"::\")===0||Pseudos[e.toLowerCase()]==Pseudos.ELEMENT},Selector.prototype=new SyntaxUnit,Selector.prototype.constructor=Selector,SelectorPart.prototype=new SyntaxUnit,SelectorPart.prototype.constructor=SelectorPart,SelectorSubPart.prototype=new SyntaxUnit,SelectorSubPart.prototype.constructor=SelectorSubPart,Specificity.prototype={constructor:Specificity,compare:function(e){var t=[\"a\",\"b\",\"c\",\"d\"],n,r;for(n=0,r=t.length;n<r;n++){if(this[t[n]]<e[t[n]])return-1;if(this[t[n]]>e[t[n]])return 1}return 0},valueOf:function(){return this.a*1e3+this.b*100+this.c*10+this.d},toString:function(){return this.a+\",\"+this.b+\",\"+this.c+\",\"+this.d}},Specificity.calculate=function(e){function t(e){var n,r,i,a,f=e.elementName?e.elementName.text:\"\",l;f&&f.charAt(f.length-1)!=\"*\"&&u++;for(n=0,i=e.modifiers.length;n<i;n++){l=e.modifiers[n];switch(l.type){case\"class\":case\"attribute\":o++;break;case\"id\":s++;break;case\"pseudo\":Pseudos.isElement(l.text)?u++:o++;break;case\"not\":for(r=0,a=l.args.length;r<a;r++)t(l.args[r])}}}var n,r,i,s=0,o=0,u=0;for(n=0,r=e.parts.length;n<r;n++)i=e.parts[n],i instanceof SelectorPart&&t(i);return new Specificity(0,s,o,u)};var h=/^[0-9a-fA-F]$/,nonascii=/^[\\u0080-\\uFFFF]$/,nl=/\\n|\\r\\n|\\r|\\f/;TokenStream.prototype=mix(new TokenStreamBase,{_getToken:function(e){var t,n=this._reader,r=null,i=n.getLine(),s=n.getCol();t=n.read();while(t){switch(t){case\"/\":n.peek()==\"*\"?r=this.commentToken(t,i,s):r=this.charToken(t,i,s);break;case\"|\":case\"~\":case\"^\":case\"$\":case\"*\":n.peek()==\"=\"?r=this.comparisonToken(t,i,s):r=this.charToken(t,i,s);break;case'\"':case\"'\":r=this.stringToken(t,i,s);break;case\"#\":isNameChar(n.peek())?r=this.hashToken(t,i,s):r=this.charToken(t,i,s);break;case\".\":isDigit(n.peek())?r=this.numberToken(t,i,s):r=this.charToken(t,i,s);break;case\"-\":n.peek()==\"-\"?r=this.htmlCommentEndToken(t,i,s):isNameStart(n.peek())?r=this.identOrFunctionToken(t,i,s):r=this.charToken(t,i,s);break;case\"!\":r=this.importantToken(t,i,s);break;case\"@\":r=this.atRuleToken(t,i,s);break;case\":\":r=this.notToken(t,i,s);break;case\"<\":r=this.htmlCommentStartToken(t,i,s);break;case\"U\":case\"u\":if(n.peek()==\"+\"){r=this.unicodeRangeToken(t,i,s);break};default:isDigit(t)?r=this.numberToken(t,i,s):isWhitespace(t)?r=this.whitespaceToken(t,i,s):isIdentStart(t)?r=this.identOrFunctionToken(t,i,s):r=this.charToken(t,i,s)}break}return!r&&t===null&&(r=this.createToken(Tokens.EOF,null,i,s)),r},createToken:function(e,t,n,r,i){var s=this._reader;return i=i||{},{value:t,type:e,channel:i.channel,hide:i.hide||!1,startLine:n,startCol:r,endLine:s.getLine(),endCol:s.getCol()}},atRuleToken:function(e,t,n){var r=e,i=this._reader,s=Tokens.CHAR,o=!1,u,a;i.mark(),u=this.readName(),r=e+u,s=Tokens.type(r.toLowerCase());if(s==Tokens.CHAR||s==Tokens.UNKNOWN)r.length>1?s=Tokens.UNKNOWN_SYM:(s=Tokens.CHAR,r=e,i.reset());return this.createToken(s,r,t,n)},charToken:function(e,t,n){var r=Tokens.type(e);return r==-1&&(r=Tokens.CHAR),this.createToken(r,e,t,n)},commentToken:function(e,t,n){var r=this._reader,i=this.readComment(e);return this.createToken(Tokens.COMMENT,i,t,n)},comparisonToken:function(e,t,n){var r=this._reader,i=e+r.read(),s=Tokens.type(i)||Tokens.CHAR;return this.createToken(s,i,t,n)},hashToken:function(e,t,n){var r=this._reader,i=this.readName(e);return this.createToken(Tokens.HASH,i,t,n)},htmlCommentStartToken:function(e,t,n){var r=this._reader,i=e;return r.mark(),i+=r.readCount(3),i==\"<!--\"?this.createToken(Tokens.CDO,i,t,n):(r.reset(),this.charToken(e,t,n))},htmlCommentEndToken:function(e,t,n){var r=this._reader,i=e;return r.mark(),i+=r.readCount(2),i==\"-->\"?this.createToken(Tokens.CDC,i,t,n):(r.reset(),this.charToken(e,t,n))},identOrFunctionToken:function(e,t,n){var r=this._reader,i=this.readName(e),s=Tokens.IDENT;return r.peek()==\"(\"?(i+=r.read(),i.toLowerCase()==\"url(\"?(s=Tokens.URI,i=this.readURI(i),i.toLowerCase()==\"url(\"&&(s=Tokens.FUNCTION)):s=Tokens.FUNCTION):r.peek()==\":\"&&i.toLowerCase()==\"progid\"&&(i+=r.readTo(\"(\"),s=Tokens.IE_FUNCTION),this.createToken(s,i,t,n)},importantToken:function(e,t,n){var r=this._reader,i=e,s=Tokens.CHAR,o,u;r.mark(),u=r.read();while(u){if(u==\"/\"){if(r.peek()!=\"*\")break;o=this.readComment(u);if(o===\"\")break}else{if(!isWhitespace(u)){if(/i/i.test(u)){o=r.readCount(8),/mportant/i.test(o)&&(i+=u+o,s=Tokens.IMPORTANT_SYM);break}break}i+=u+this.readWhitespace()}u=r.read()}return s==Tokens.CHAR?(r.reset(),this.charToken(e,t,n)):this.createToken(s,i,t,n)},notToken:function(e,t,n){var r=this._reader,i=e;return r.mark(),i+=r.readCount(4),i.toLowerCase()==\":not(\"?this.createToken(Tokens.NOT,i,t,n):(r.reset(),this.charToken(e,t,n))},numberToken:function(e,t,n){var r=this._reader,i=this.readNumber(e),s,o=Tokens.NUMBER,u=r.peek();return isIdentStart(u)?(s=this.readName(r.read()),i+=s,/^em$|^ex$|^px$|^gd$|^rem$|^vw$|^vh$|^vm$|^ch$|^cm$|^mm$|^in$|^pt$|^pc$/i.test(s)?o=Tokens.LENGTH:/^deg|^rad$|^grad$/i.test(s)?o=Tokens.ANGLE:/^ms$|^s$/i.test(s)?o=Tokens.TIME:/^hz$|^khz$/i.test(s)?o=Tokens.FREQ:/^dpi$|^dpcm$/i.test(s)?o=Tokens.RESOLUTION:o=Tokens.DIMENSION):u==\"%\"&&(i+=r.read(),o=Tokens.PERCENTAGE),this.createToken(o,i,t,n)},stringToken:function(e,t,n){var r=e,i=e,s=this._reader,o=e,u=Tokens.STRING,a=s.read();while(a){i+=a;if(a==r&&o!=\"\\\\\")break;if(isNewLine(s.peek())&&a!=\"\\\\\"){u=Tokens.INVALID;break}o=a,a=s.read()}return a===null&&(u=Tokens.INVALID),this.createToken(u,i,t,n)},unicodeRangeToken:function(e,t,n){var r=this._reader,i=e,s,o=Tokens.CHAR;return r.peek()==\"+\"&&(r.mark(),i+=r.read(),i+=this.readUnicodeRangePart(!0),i.length==2?r.reset():(o=Tokens.UNICODE_RANGE,i.indexOf(\"?\")==-1&&r.peek()==\"-\"&&(r.mark(),s=r.read(),s+=this.readUnicodeRangePart(!1),s.length==1?r.reset():i+=s))),this.createToken(o,i,t,n)},whitespaceToken:function(e,t,n){var r=this._reader,i=e+this.readWhitespace();return this.createToken(Tokens.S,i,t,n)},readUnicodeRangePart:function(e){var t=this._reader,n=\"\",r=t.peek();while(isHexDigit(r)&&n.length<6)t.read(),n+=r,r=t.peek();if(e)while(r==\"?\"&&n.length<6)t.read(),n+=r,r=t.peek();return n},readWhitespace:function(){var e=this._reader,t=\"\",n=e.peek();while(isWhitespace(n))e.read(),t+=n,n=e.peek();return t},readNumber:function(e){var t=this._reader,n=e,r=e==\".\",i=t.peek();while(i){if(isDigit(i))n+=t.read();else{if(i!=\".\")break;if(r)break;r=!0,n+=t.read()}i=t.peek()}return n},readString:function(){var e=this._reader,t=e.read(),n=t,r=t,i=e.peek();while(i){i=e.read(),n+=i;if(i==t&&r!=\"\\\\\")break;if(isNewLine(e.peek())&&i!=\"\\\\\"){n=\"\";break}r=i,i=e.peek()}return i===null&&(n=\"\"),n},readURI:function(e){var t=this._reader,n=e,r=\"\",i=t.peek();t.mark();while(i&&isWhitespace(i))t.read(),i=t.peek();i==\"'\"||i=='\"'?r=this.readString():r=this.readURL(),i=t.peek();while(i&&isWhitespace(i))t.read(),i=t.peek();return r===\"\"||i!=\")\"?(n=e,t.reset()):n+=r+t.read(),n},readURL:function(){var e=this._reader,t=\"\",n=e.peek();while(/^[!#$%&\\\\*-~]$/.test(n))t+=e.read(),n=e.peek();return t},readName:function(e){var t=this._reader,n=e||\"\",r=t.peek();for(;;)if(r==\"\\\\\")n+=this.readEscape(t.read()),r=t.peek();else{if(!r||!isNameChar(r))break;n+=t.read(),r=t.peek()}return n},readEscape:function(e){var t=this._reader,n=e||\"\",r=0,i=t.peek();if(isHexDigit(i))do n+=t.read(),i=t.peek();while(i&&isHexDigit(i)&&++r<6);return n.length==3&&/\\s/.test(i)||n.length==7||n.length==1?t.read():i=\"\",n+i},readComment:function(e){var t=this._reader,n=e||\"\",r=t.read();if(r==\"*\"){while(r){n+=r;if(n.length>2&&r==\"*\"&&t.peek()==\"/\"){n+=t.read();break}r=t.read()}return n}return\"\"}});var Tokens=[{name:\"CDO\"},{name:\"CDC\"},{name:\"S\",whitespace:!0},{name:\"COMMENT\",comment:!0,hide:!0,channel:\"comment\"},{name:\"INCLUDES\",text:\"~=\"},{name:\"DASHMATCH\",text:\"|=\"},{name:\"PREFIXMATCH\",text:\"^=\"},{name:\"SUFFIXMATCH\",text:\"$=\"},{name:\"SUBSTRINGMATCH\",text:\"*=\"},{name:\"STRING\"},{name:\"IDENT\"},{name:\"HASH\"},{name:\"IMPORT_SYM\",text:\"@import\"},{name:\"PAGE_SYM\",text:\"@page\"},{name:\"MEDIA_SYM\",text:\"@media\"},{name:\"FONT_FACE_SYM\",text:\"@font-face\"},{name:\"CHARSET_SYM\",text:\"@charset\"},{name:\"NAMESPACE_SYM\",text:\"@namespace\"},{name:\"VIEWPORT_SYM\",text:[\"@viewport\",\"@-ms-viewport\"]},{name:\"UNKNOWN_SYM\"},{name:\"KEYFRAMES_SYM\",text:[\"@keyframes\",\"@-webkit-keyframes\",\"@-moz-keyframes\",\"@-o-keyframes\"]},{name:\"IMPORTANT_SYM\"},{name:\"LENGTH\"},{name:\"ANGLE\"},{name:\"TIME\"},{name:\"FREQ\"},{name:\"DIMENSION\"},{name:\"PERCENTAGE\"},{name:\"NUMBER\"},{name:\"URI\"},{name:\"FUNCTION\"},{name:\"UNICODE_RANGE\"},{name:\"INVALID\"},{name:\"PLUS\",text:\"+\"},{name:\"GREATER\",text:\">\"},{name:\"COMMA\",text:\",\"},{name:\"TILDE\",text:\"~\"},{name:\"NOT\"},{name:\"TOPLEFTCORNER_SYM\",text:\"@top-left-corner\"},{name:\"TOPLEFT_SYM\",text:\"@top-left\"},{name:\"TOPCENTER_SYM\",text:\"@top-center\"},{name:\"TOPRIGHT_SYM\",text:\"@top-right\"},{name:\"TOPRIGHTCORNER_SYM\",text:\"@top-right-corner\"},{name:\"BOTTOMLEFTCORNER_SYM\",text:\"@bottom-left-corner\"},{name:\"BOTTOMLEFT_SYM\",text:\"@bottom-left\"},{name:\"BOTTOMCENTER_SYM\",text:\"@bottom-center\"},{name:\"BOTTOMRIGHT_SYM\",text:\"@bottom-right\"},{name:\"BOTTOMRIGHTCORNER_SYM\",text:\"@bottom-right-corner\"},{name:\"LEFTTOP_SYM\",text:\"@left-top\"},{name:\"LEFTMIDDLE_SYM\",text:\"@left-middle\"},{name:\"LEFTBOTTOM_SYM\",text:\"@left-bottom\"},{name:\"RIGHTTOP_SYM\",text:\"@right-top\"},{name:\"RIGHTMIDDLE_SYM\",text:\"@right-middle\"},{name:\"RIGHTBOTTOM_SYM\",text:\"@right-bottom\"},{name:\"RESOLUTION\",state:\"media\"},{name:\"IE_FUNCTION\"},{name:\"CHAR\"},{name:\"PIPE\",text:\"|\"},{name:\"SLASH\",text:\"/\"},{name:\"MINUS\",text:\"-\"},{name:\"STAR\",text:\"*\"},{name:\"LBRACE\",text:\"{\"},{name:\"RBRACE\",text:\"}\"},{name:\"LBRACKET\",text:\"[\"},{name:\"RBRACKET\",text:\"]\"},{name:\"EQUALS\",text:\"=\"},{name:\"COLON\",text:\":\"},{name:\"SEMICOLON\",text:\";\"},{name:\"LPAREN\",text:\"(\"},{name:\"RPAREN\",text:\")\"},{name:\"DOT\",text:\".\"}];(function(){var e=[],t={};Tokens.UNKNOWN=-1,Tokens.unshift({name:\"EOF\"});for(var n=0,r=Tokens.length;n<r;n++){e.push(Tokens[n].name),Tokens[Tokens[n].name]=n;if(Tokens[n].text)if(Tokens[n].text instanceof Array)for(var i=0;i<Tokens[n].text.length;i++)t[Tokens[n].text[i]]=n;else t[Tokens[n].text]=n}Tokens.name=function(t){return e[t]},Tokens.type=function(e){return t[e]||-1}})();var Validation={validate:function(e,t){var n=e.toString().toLowerCase(),r=t.parts,i=new PropertyValueIterator(t),s=Properties[n],o,u,a,f,l,c,h,p,d,v,m;if(!s){if(n.indexOf(\"-\")!==0)throw new ValidationError(\"Unknown property '\"+e+\"'.\",e.line,e.col)}else typeof s!=\"number\"&&(typeof s==\"string\"?s.indexOf(\"||\")>-1?this.groupProperty(s,i):this.singleProperty(s,i,1):s.multi?this.multiProperty(s.multi,i,s.comma,s.max||Infinity):typeof s==\"function\"&&s(i))},singleProperty:function(e,t,n,r){var i=!1,s=t.value,o=0,u;while(t.hasNext()&&o<n){i=ValidationTypes.isAny(t,e);if(!i)break;o++}if(!i)throw t.hasNext()&&!t.isFirst()?(u=t.peek(),new ValidationError(\"Expected end of value but found '\"+u+\"'.\",u.line,u.col)):new ValidationError(\"Expected (\"+e+\") but found '\"+s+\"'.\",s.line,s.col);if(t.hasNext())throw u=t.next(),new ValidationError(\"Expected end of value but found '\"+u+\"'.\",u.line,u.col)},multiProperty:function(e,t,n,r){var i=!1,s=t.value,o=0,u=!1,a;while(t.hasNext()&&!i&&o<r){if(!ValidationTypes.isAny(t,e))break;o++;if(!t.hasNext())i=!0;else if(n){if(t.peek()!=\",\")break;a=t.next()}}if(!i)throw t.hasNext()&&!t.isFirst()?(a=t.peek(),new ValidationError(\"Expected end of value but found '\"+a+\"'.\",a.line,a.col)):(a=t.previous(),n&&a==\",\"?new ValidationError(\"Expected end of value but found '\"+a+\"'.\",a.line,a.col):new ValidationError(\"Expected (\"+e+\") but found '\"+s+\"'.\",s.line,s.col));if(t.hasNext())throw a=t.next(),new ValidationError(\"Expected end of value but found '\"+a+\"'.\",a.line,a.col)},groupProperty:function(e,t,n){var r=!1,i=t.value,s=e.split(\"||\").length,o={count:0},u=!1,a,f;while(t.hasNext()&&!r){a=ValidationTypes.isAnyOfGroup(t,e);if(!a)break;if(o[a])break;o[a]=1,o.count++,u=!0;if(o.count==s||!t.hasNext())r=!0}if(!r)throw u&&t.hasNext()?(f=t.peek(),new ValidationError(\"Expected end of value but found '\"+f+\"'.\",f.line,f.col)):new ValidationError(\"Expected (\"+e+\") but found '\"+i+\"'.\",i.line,i.col);if(t.hasNext())throw f=t.next(),new ValidationError(\"Expected end of value but found '\"+f+\"'.\",f.line,f.col)}};ValidationError.prototype=new Error;var ValidationTypes={isLiteral:function(e,t){var n=e.text.toString().toLowerCase(),r=t.split(\" | \"),i,s,o=!1;for(i=0,s=r.length;i<s&&!o;i++)n==r[i].toLowerCase()&&(o=!0);return o},isSimple:function(e){return!!this.simple[e]},isComplex:function(e){return!!this.complex[e]},isAny:function(e,t){var n=t.split(\" | \"),r,i,s=!1;for(r=0,i=n.length;r<i&&!s&&e.hasNext();r++)s=this.isType(e,n[r]);return s},isAnyOfGroup:function(e,t){var n=t.split(\" || \"),r,i,s=!1;for(r=0,i=n.length;r<i&&!s;r++)s=this.isType(e,n[r]);return s?n[r-1]:!1},isType:function(e,t){var n=e.peek(),r=!1;return t.charAt(0)!=\"<\"?(r=this.isLiteral(n,t),r&&e.next()):this.simple[t]?(r=this.simple[t](n),r&&e.next()):r=this.complex[t](e),r},simple:{\"<absolute-size>\":function(e){return ValidationTypes.isLiteral(e,\"xx-small | x-small | small | medium | large | x-large | xx-large\")},\"<attachment>\":function(e){return ValidationTypes.isLiteral(e,\"scroll | fixed | local\")},\"<attr>\":function(e){return e.type==\"function\"&&e.name==\"attr\"},\"<bg-image>\":function(e){return this[\"<image>\"](e)||this[\"<gradient>\"](e)||e==\"none\"},\"<gradient>\":function(e){return e.type==\"function\"&&/^(?:\\-(?:ms|moz|o|webkit)\\-)?(?:repeating\\-)?(?:radial\\-|linear\\-)?gradient/i.test(e)},\"<box>\":function(e){return ValidationTypes.isLiteral(e,\"padding-box | border-box | content-box\")},\"<content>\":function(e){return e.type==\"function\"&&e.name==\"content\"},\"<relative-size>\":function(e){return ValidationTypes.isLiteral(e,\"smaller | larger\")},\"<ident>\":function(e){return e.type==\"identifier\"},\"<length>\":function(e){return e.type==\"function\"&&/^(?:\\-(?:ms|moz|o|webkit)\\-)?calc/i.test(e)?!0:e.type==\"length\"||e.type==\"number\"||e.type==\"integer\"||e==\"0\"},\"<color>\":function(e){return e.type==\"color\"||e==\"transparent\"},\"<number>\":function(e){return e.type==\"number\"||this[\"<integer>\"](e)},\"<integer>\":function(e){return e.type==\"integer\"},\"<line>\":function(e){return e.type==\"integer\"},\"<angle>\":function(e){return e.type==\"angle\"},\"<uri>\":function(e){return e.type==\"uri\"},\"<image>\":function(e){return this[\"<uri>\"](e)},\"<percentage>\":function(e){return e.type==\"percentage\"||e==\"0\"},\"<border-width>\":function(e){return this[\"<length>\"](e)||ValidationTypes.isLiteral(e,\"thin | medium | thick\")},\"<border-style>\":function(e){return ValidationTypes.isLiteral(e,\"none | hidden | dotted | dashed | solid | double | groove | ridge | inset | outset\")},\"<margin-width>\":function(e){return this[\"<length>\"](e)||this[\"<percentage>\"](e)||ValidationTypes.isLiteral(e,\"auto\")},\"<padding-width>\":function(e){return this[\"<length>\"](e)||this[\"<percentage>\"](e)},\"<shape>\":function(e){return e.type==\"function\"&&(e.name==\"rect\"||e.name==\"inset-rect\")},\"<time>\":function(e){return e.type==\"time\"}},complex:{\"<bg-position>\":function(e){var t=this,n=!1,r=\"<percentage> | <length>\",i=\"left | right\",s=\"top | bottom\",o=0,u=function(){return e.hasNext()&&e.peek()!=\",\"};while(e.peek(o)&&e.peek(o)!=\",\")o++;return o<3?ValidationTypes.isAny(e,i+\" | center | \"+r)?(n=!0,ValidationTypes.isAny(e,s+\" | center | \"+r)):ValidationTypes.isAny(e,s)&&(n=!0,ValidationTypes.isAny(e,i+\" | center\")):ValidationTypes.isAny(e,i)?ValidationTypes.isAny(e,s)?(n=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,r)&&(ValidationTypes.isAny(e,s)?(n=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,\"center\")&&(n=!0)):ValidationTypes.isAny(e,s)?ValidationTypes.isAny(e,i)?(n=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,r)&&(ValidationTypes.isAny(e,i)?(n=!0,ValidationTypes.isAny(e,r)):ValidationTypes.isAny(e,\"center\")&&(n=!0)):ValidationTypes.isAny(e,\"center\")&&ValidationTypes.isAny(e,i+\" | \"+s)&&(n=!0,ValidationTypes.isAny(e,r)),n},\"<bg-size>\":function(e){var t=this,n=!1,r=\"<percentage> | <length> | auto\",i,s,o;return ValidationTypes.isAny(e,\"cover | contain\")?n=!0:ValidationTypes.isAny(e,r)&&(n=!0,ValidationTypes.isAny(e,r)),n},\"<repeat-style>\":function(e){var t=!1,n=\"repeat | space | round | no-repeat\",r;return e.hasNext()&&(r=e.next(),ValidationTypes.isLiteral(r,\"repeat-x | repeat-y\")?t=!0:ValidationTypes.isLiteral(r,n)&&(t=!0,e.hasNext()&&ValidationTypes.isLiteral(e.peek(),n)&&e.next())),t},\"<shadow>\":function(e){var t=!1,n=0,r=!1,i=!1,s;if(e.hasNext()){ValidationTypes.isAny(e,\"inset\")&&(r=!0),ValidationTypes.isAny(e,\"<color>\")&&(i=!0);while(ValidationTypes.isAny(e,\"<length>\")&&n<4)n++;e.hasNext()&&(i||ValidationTypes.isAny(e,\"<color>\"),r||ValidationTypes.isAny(e,\"inset\")),t=n>=2&&n<=4}return t},\"<x-one-radius>\":function(e){var t=!1,n=\"<length> | <percentage> | inherit\";return ValidationTypes.isAny(e,n)&&(t=!0,ValidationTypes.isAny(e,n)),t}}};parserlib.css={Colors:Colors,Combinator:Combinator,Parser:Parser,PropertyName:PropertyName,PropertyValue:PropertyValue,PropertyValuePart:PropertyValuePart,MediaFeature:MediaFeature,MediaQuery:MediaQuery,Selector:Selector,SelectorPart:SelectorPart,SelectorSubPart:SelectorSubPart,Specificity:Specificity,TokenStream:TokenStream,Tokens:Tokens,ValidationError:ValidationError}}(),function(){for(var e in parserlib)exports[e]=parserlib[e]}();var CSSLint=function(){function e(e,t){var n,i=e&&e.match(r),s=i&&i[1];return s&&(n={\"true\":2,\"\":1,\"false\":0,2:2,1:1,0:0},s.toLowerCase().split(\",\").forEach(function(e){var r=e.split(\":\"),i=r[0]||\"\",s=r[1]||\"\";t[i.trim()]=n[s.trim()]})),t}var t=[],n=[],r=/\\/\\*csslint([^\\*]*)\\*\\//,i=new parserlib.util.EventTarget;return i.version=\"@VERSION@\",i.addRule=function(e){t.push(e),t[e.id]=e},i.clearRules=function(){t=[]},i.getRules=function(){return[].concat(t).sort(function(e,t){return e.id>t.id?1:0})},i.getRuleset=function(){var e={},n=0,r=t.length;while(n<r)e[t[n++].id]=1;return e},i.addFormatter=function(e){n[e.id]=e},i.getFormatter=function(e){return n[e]},i.format=function(e,t,n,r){var i=this.getFormatter(n),s=null;return i&&(s=i.startFormat(),s+=i.formatResults(e,t,r||{}),s+=i.endFormat()),s},i.hasFormat=function(e){return n.hasOwnProperty(e)},i.verify=function(n,i){var s=0,o=t.length,u,a,f,l=new parserlib.css.Parser({starHack:!0,ieFilters:!0,underscoreHack:!0,strict:!1});a=n.replace(/\\n\\r?/g,\"$split$\").split(\"$split$\"),i||(i=this.getRuleset()),r.test(n)&&(i=e(n,i)),u=new Reporter(a,i),i.errors=2;for(s in i)i.hasOwnProperty(s)&&i[s]&&t[s]&&t[s].init(l,u);try{l.parse(n)}catch(c){u.error(\"Fatal error, cannot continue: \"+c.message,c.line,c.col,{})}return f={messages:u.messages,stats:u.stats,ruleset:u.ruleset},f.messages.sort(function(e,t){return e.rollup&&!t.rollup?1:!e.rollup&&t.rollup?-1:e.line-t.line}),f},i}();Reporter.prototype={constructor:Reporter,error:function(e,t,n,r){this.messages.push({type:\"error\",line:t,col:n,message:e,evidence:this.lines[t-1],rule:r||{}})},warn:function(e,t,n,r){this.report(e,t,n,r)},report:function(e,t,n,r){this.messages.push({type:this.ruleset[r.id]==2?\"error\":\"warning\",line:t,col:n,message:e,evidence:this.lines[t-1],rule:r})},info:function(e,t,n,r){this.messages.push({type:\"info\",line:t,col:n,message:e,evidence:this.lines[t-1],rule:r})},rollupError:function(e,t){this.messages.push({type:\"error\",rollup:!0,message:e,rule:t})},rollupWarn:function(e,t){this.messages.push({type:\"warning\",rollup:!0,message:e,rule:t})},stat:function(e,t){this.stats[e]=t}},CSSLint._Reporter=Reporter,CSSLint.Util={mix:function(e,t){var n;for(n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return n},indexOf:function(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},forEach:function(e,t){if(e.forEach)return e.forEach(t);for(var n=0,r=e.length;n<r;n++)t(e[n],n,e)}},CSSLint.addRule({id:\"adjoining-classes\",name:\"Disallow adjoining classes\",desc:\"Don't use adjoining classes.\",browsers:\"IE6\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(r){var i=r.selectors,s,o,u,a,f,l,c;for(f=0;f<i.length;f++){s=i[f];for(l=0;l<s.parts.length;l++){o=s.parts[l];if(o.type==e.SELECTOR_PART_TYPE){a=0;for(c=0;c<o.modifiers.length;c++)u=o.modifiers[c],u.type==\"class\"&&a++,a>1&&t.report(\"Don't use adjoining classes.\",o.line,o.col,n)}}}})}}),CSSLint.addRule({id:\"box-model\",name:\"Beware of broken box size\",desc:\"Don't use width or height when using padding or border.\",browsers:\"All\",init:function(e,t){function n(){u={},a=!1}function r(){var e,n;if(!a){if(u.height)for(e in o)o.hasOwnProperty(e)&&u[e]&&(n=u[e].value,(e!=\"padding\"||n.parts.length!==2||n.parts[0].value!==0)&&t.report(\"Using height with \"+e+\" can sometimes make elements larger than you expect.\",u[e].line,u[e].col,i));if(u.width)for(e in s)s.hasOwnProperty(e)&&u[e]&&(n=u[e].value,(e!=\"padding\"||n.parts.length!==2||n.parts[1].value!==0)&&t.report(\"Using width with \"+e+\" can sometimes make elements larger than you expect.\",u[e].line,u[e].col,i))}}var i=this,s={border:1,\"border-left\":1,\"border-right\":1,padding:1,\"padding-left\":1,\"padding-right\":1},o={border:1,\"border-bottom\":1,\"border-top\":1,padding:1,\"padding-bottom\":1,\"padding-top\":1},u,a=!1;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"startpage\",n),e.addListener(\"startpagemargin\",n),e.addListener(\"startkeyframerule\",n),e.addListener(\"property\",function(e){var t=e.property.text.toLowerCase();o[t]||s[t]?!/^0\\S*$/.test(e.value)&&(t!=\"border\"||e.value!=\"none\")&&(u[t]={line:e.property.line,col:e.property.col,value:e.value}):/^(width|height)/i.test(t)&&/^(length|percentage)/.test(e.value.parts[0].type)?u[t]=1:t==\"box-sizing\"&&(a=!0)}),e.addListener(\"endrule\",r),e.addListener(\"endfontface\",r),e.addListener(\"endpage\",r),e.addListener(\"endpagemargin\",r),e.addListener(\"endkeyframerule\",r)}}),CSSLint.addRule({id:\"box-sizing\",name:\"Disallow use of box-sizing\",desc:\"The box-sizing properties isn't supported in IE6 and IE7.\",browsers:\"IE6, IE7\",tags:[\"Compatibility\"],init:function(e,t){var n=this;e.addListener(\"property\",function(e){var r=e.property.text.toLowerCase();r==\"box-sizing\"&&t.report(\"The box-sizing property isn't supported in IE6 and IE7.\",e.line,e.col,n)})}}),CSSLint.addRule({id:\"bulletproof-font-face\",name:\"Use the bulletproof @font-face syntax\",desc:\"Use the bulletproof @font-face syntax to avoid 404's in old IE (http://www.fontspring.com/blog/the-new-bulletproof-font-face-syntax).\",browsers:\"All\",init:function(e,t){var n=this,r=0,i=!1,s=!0,o=!1,u,a;e.addListener(\"startfontface\",function(e){i=!0}),e.addListener(\"property\",function(e){if(!i)return;var t=e.property.toString().toLowerCase(),n=e.value.toString();u=e.line,a=e.col;if(t===\"src\"){var r=/^\\s?url\\(['\"].+\\.eot\\?.*['\"]\\)\\s*format\\(['\"]embedded-opentype['\"]\\).*$/i;!n.match(r)&&s?(o=!0,s=!1):n.match(r)&&!s&&(o=!1)}}),e.addListener(\"endfontface\",function(e){i=!1,o&&t.report(\"@font-face declaration doesn't follow the fontspring bulletproof syntax.\",u,a,n)})}}),CSSLint.addRule({id:\"compatible-vendor-prefixes\",name:\"Require compatible vendor prefixes\",desc:\"Include all compatible vendor prefixes to reach a wider range of users.\",browsers:\"All\",init:function(e,t){var n=this,r,i,s,o,u,a,f,l=!1,c=Array.prototype.push,h=[];r={animation:\"webkit moz\",\"animation-delay\":\"webkit moz\",\"animation-direction\":\"webkit moz\",\"animation-duration\":\"webkit moz\",\"animation-fill-mode\":\"webkit moz\",\"animation-iteration-count\":\"webkit moz\",\"animation-name\":\"webkit moz\",\"animation-play-state\":\"webkit moz\",\"animation-timing-function\":\"webkit moz\",appearance:\"webkit moz\",\"border-end\":\"webkit moz\",\"border-end-color\":\"webkit moz\",\"border-end-style\":\"webkit moz\",\"border-end-width\":\"webkit moz\",\"border-image\":\"webkit moz o\",\"border-radius\":\"webkit\",\"border-start\":\"webkit moz\",\"border-start-color\":\"webkit moz\",\"border-start-style\":\"webkit moz\",\"border-start-width\":\"webkit moz\",\"box-align\":\"webkit moz ms\",\"box-direction\":\"webkit moz ms\",\"box-flex\":\"webkit moz ms\",\"box-lines\":\"webkit ms\",\"box-ordinal-group\":\"webkit moz ms\",\"box-orient\":\"webkit moz ms\",\"box-pack\":\"webkit moz ms\",\"box-sizing\":\"webkit moz\",\"box-shadow\":\"webkit moz\",\"column-count\":\"webkit moz ms\",\"column-gap\":\"webkit moz ms\",\"column-rule\":\"webkit moz ms\",\"column-rule-color\":\"webkit moz ms\",\"column-rule-style\":\"webkit moz ms\",\"column-rule-width\":\"webkit moz ms\",\"column-width\":\"webkit moz ms\",hyphens:\"epub moz\",\"line-break\":\"webkit ms\",\"margin-end\":\"webkit moz\",\"margin-start\":\"webkit moz\",\"marquee-speed\":\"webkit wap\",\"marquee-style\":\"webkit wap\",\"padding-end\":\"webkit moz\",\"padding-start\":\"webkit moz\",\"tab-size\":\"moz o\",\"text-size-adjust\":\"webkit ms\",transform:\"webkit moz ms o\",\"transform-origin\":\"webkit moz ms o\",transition:\"webkit moz o\",\"transition-delay\":\"webkit moz o\",\"transition-duration\":\"webkit moz o\",\"transition-property\":\"webkit moz o\",\"transition-timing-function\":\"webkit moz o\",\"user-modify\":\"webkit moz\",\"user-select\":\"webkit moz ms\",\"word-break\":\"epub ms\",\"writing-mode\":\"epub ms\"};for(s in r)if(r.hasOwnProperty(s)){o=[],u=r[s].split(\" \");for(a=0,f=u.length;a<f;a++)o.push(\"-\"+u[a]+\"-\"+s);r[s]=o,c.apply(h,o)}e.addListener(\"startrule\",function(){i=[]}),e.addListener(\"startkeyframes\",function(e){l=e.prefix||!0}),e.addListener(\"endkeyframes\",function(e){l=!1}),e.addListener(\"property\",function(e){var t=e.property;CSSLint.Util.indexOf(h,t.text)>-1&&(!l||typeof l!=\"string\"||t.text.indexOf(\"-\"+l+\"-\")!==0)&&i.push(t)}),e.addListener(\"endrule\",function(e){if(!i.length)return;var s={},o,u,a,f,l,c,h,p,d,v;for(o=0,u=i.length;o<u;o++){a=i[o];for(f in r)r.hasOwnProperty(f)&&(l=r[f],CSSLint.Util.indexOf(l,a.text)>-1&&(s[f]||(s[f]={full:l.slice(0),actual:[],actualNodes:[]}),CSSLint.Util.indexOf(s[f].actual,a.text)===-1&&(s[f].actual.push(a.text),s[f].actualNodes.push(a))))}for(f in s)if(s.hasOwnProperty(f)){c=s[f],h=c.full,p=c.actual;if(h.length>p.length)for(o=0,u=h.length;o<u;o++)d=h[o],CSSLint.Util.indexOf(p,d)===-1&&(v=p.length===1?p[0]:p.length==2?p.join(\" and \"):p.join(\", \"),t.report(\"The property \"+d+\" is compatible with \"+v+\" and should be included as well.\",c.actualNodes[0].line,c.actualNodes[0].col,n))}})}}),CSSLint.addRule({id:\"display-property-grouping\",name:\"Require properties appropriate for display\",desc:\"Certain properties shouldn't be used with certain display property values.\",browsers:\"All\",init:function(e,t){function n(e,n,r){u[e]&&(typeof o[e]!=\"string\"||u[e].value.toLowerCase()!=o[e])&&t.report(r||e+\" can't be used with display: \"+n+\".\",u[e].line,u[e].col,s)}function r(){u={}}function i(){var e=u.display?u.display.value:null;if(e)switch(e){case\"inline\":n(\"height\",e),n(\"width\",e),n(\"margin\",e),n(\"margin-top\",e),n(\"margin-bottom\",e),n(\"float\",e,\"display:inline has no effect on floated elements (but may be used to fix the IE6 double-margin bug).\");break;case\"block\":n(\"vertical-align\",e);break;case\"inline-block\":n(\"float\",e);break;default:e.indexOf(\"table-\")===0&&(n(\"margin\",e),n(\"margin-left\",e),n(\"margin-right\",e),n(\"margin-top\",e),n(\"margin-bottom\",e),n(\"float\",e))}}var s=this,o={display:1,\"float\":\"none\",height:1,width:1,margin:1,\"margin-left\":1,\"margin-right\":1,\"margin-bottom\":1,\"margin-top\":1,padding:1,\"padding-left\":1,\"padding-right\":1,\"padding-bottom\":1,\"padding-top\":1,\"vertical-align\":1},u;e.addListener(\"startrule\",r),e.addListener(\"startfontface\",r),e.addListener(\"startkeyframerule\",r),e.addListener(\"startpagemargin\",r),e.addListener(\"startpage\",r),e.addListener(\"property\",function(e){var t=e.property.text.toLowerCase();o[t]&&(u[t]={value:e.value.text,line:e.property.line,col:e.property.col})}),e.addListener(\"endrule\",i),e.addListener(\"endfontface\",i),e.addListener(\"endkeyframerule\",i),e.addListener(\"endpagemargin\",i),e.addListener(\"endpage\",i)}}),CSSLint.addRule({id:\"duplicate-background-images\",name:\"Disallow duplicate background images\",desc:\"Every background-image should be unique. Use a common class for e.g. sprites.\",browsers:\"All\",init:function(e,t){var n=this,r={};e.addListener(\"property\",function(e){var i=e.property.text,s=e.value,o,u;if(i.match(/background/i))for(o=0,u=s.parts.length;o<u;o++)s.parts[o].type==\"uri\"&&(typeof r[s.parts[o].uri]==\"undefined\"?r[s.parts[o].uri]=e:t.report(\"Background image '\"+s.parts[o].uri+\"' was used multiple times, first declared at line \"+r[s.parts[o].uri].line+\", col \"+r[s.parts[o].uri].col+\".\",e.line,e.col,n))})}}),CSSLint.addRule({id:\"duplicate-properties\",name:\"Disallow duplicate properties\",desc:\"Duplicate properties must appear one after the other.\",browsers:\"All\",init:function(e,t){function n(e){i={}}var r=this,i,s;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"startpage\",n),e.addListener(\"startpagemargin\",n),e.addListener(\"startkeyframerule\",n),e.addListener(\"property\",function(e){var n=e.property,o=n.text.toLowerCase();i[o]&&(s!=o||i[o]==e.value.text)&&t.report(\"Duplicate property '\"+e.property+\"' found.\",e.line,e.col,r),i[o]=e.value.text,s=o})}}),CSSLint.addRule({id:\"empty-rules\",name:\"Disallow empty rules\",desc:\"Rules without any properties specified should be removed.\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"startrule\",function(){r=0}),e.addListener(\"property\",function(){r++}),e.addListener(\"endrule\",function(e){var i=e.selectors;r===0&&t.report(\"Rule is empty.\",i[0].line,i[0].col,n)})}}),CSSLint.addRule({id:\"errors\",name:\"Parsing Errors\",desc:\"This rule looks for recoverable syntax errors.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"error\",function(e){t.error(e.message,e.line,e.col,n)})}}),CSSLint.addRule({id:\"fallback-colors\",name:\"Require fallback colors\",desc:\"For older browsers that don't support RGBA, HSL, or HSLA, provide a fallback color.\",browsers:\"IE6,IE7,IE8\",init:function(e,t){function n(e){o={},i=null}var r=this,i,s={color:1,background:1,\"border-color\":1,\"border-top-color\":1,\"border-right-color\":1,\"border-bottom-color\":1,\"border-left-color\":1,border:1,\"border-top\":1,\"border-right\":1,\"border-bottom\":1,\"border-left\":1,\"background-color\":1},o;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"startpage\",n),e.addListener(\"startpagemargin\",n),e.addListener(\"startkeyframerule\",n),e.addListener(\"property\",function(e){var n=e.property,o=n.text.toLowerCase(),u=e.value.parts,a=0,f=\"\",l=u.length;if(s[o])while(a<l)u[a].type==\"color\"&&(\"alpha\"in u[a]||\"hue\"in u[a]?(/([^\\)]+)\\(/.test(u[a])&&(f=RegExp.$1.toUpperCase()),(!i||i.property.text.toLowerCase()!=o||i.colorType!=\"compat\")&&t.report(\"Fallback \"+o+\" (hex or RGB) should precede \"+f+\" \"+o+\".\",e.line,e.col,r)):e.colorType=\"compat\"),a++;i=e})}}),CSSLint.addRule({id:\"floats\",name:\"Disallow too many floats\",desc:\"This rule tests if the float property is used too many times\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"property\",function(e){e.property.text.toLowerCase()==\"float\"&&e.value.text.toLowerCase()!=\"none\"&&r++}),e.addListener(\"endstylesheet\",function(){t.stat(\"floats\",r),r>=10&&t.rollupWarn(\"Too many floats (\"+r+\"), you're probably using them for layout. Consider using a grid system instead.\",n)})}}),CSSLint.addRule({id:\"font-faces\",name:\"Don't use too many web fonts\",desc:\"Too many different web fonts in the same stylesheet.\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"startfontface\",function(){r++}),e.addListener(\"endstylesheet\",function(){r>5&&t.rollupWarn(\"Too many @font-face declarations (\"+r+\").\",n)})}}),CSSLint.addRule({id:\"font-sizes\",name:\"Disallow too many font sizes\",desc:\"Checks the number of font-size declarations.\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"property\",function(e){e.property==\"font-size\"&&r++}),e.addListener(\"endstylesheet\",function(){t.stat(\"font-sizes\",r),r>=10&&t.rollupWarn(\"Too many font-size declarations (\"+r+\"), abstraction needed.\",n)})}}),CSSLint.addRule({id:\"gradients\",name:\"Require all gradient definitions\",desc:\"When using a vendor-prefixed gradient, make sure to use them all.\",browsers:\"All\",init:function(e,t){var n=this,r;e.addListener(\"startrule\",function(){r={moz:0,webkit:0,oldWebkit:0,o:0}}),e.addListener(\"property\",function(e){/\\-(moz|o|webkit)(?:\\-(?:linear|radial))\\-gradient/i.test(e.value)?r[RegExp.$1]=1:/\\-webkit\\-gradient/i.test(e.value)&&(r.oldWebkit=1)}),e.addListener(\"endrule\",function(e){var i=[];r.moz||i.push(\"Firefox 3.6+\"),r.webkit||i.push(\"Webkit (Safari 5+, Chrome)\"),r.oldWebkit||i.push(\"Old Webkit (Safari 4+, Chrome)\"),r.o||i.push(\"Opera 11.1+\"),i.length&&i.length<4&&t.report(\"Missing vendor-prefixed CSS gradients for \"+i.join(\", \")+\".\",e.selectors[0].line,e.selectors[0].col,n)})}}),CSSLint.addRule({id:\"ids\",name:\"Disallow IDs in selectors\",desc:\"Selectors should not contain IDs.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(r){var i=r.selectors,s,o,u,a,f,l,c;for(f=0;f<i.length;f++){s=i[f],a=0;for(l=0;l<s.parts.length;l++){o=s.parts[l];if(o.type==e.SELECTOR_PART_TYPE)for(c=0;c<o.modifiers.length;c++)u=o.modifiers[c],u.type==\"id\"&&a++}a==1?t.report(\"Don't use IDs in selectors.\",s.line,s.col,n):a>1&&t.report(a+\" IDs in the selector, really?\",s.line,s.col,n)}})}}),CSSLint.addRule({id:\"import\",name:\"Disallow @import\",desc:\"Don't use @import, use <link> instead.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"import\",function(e){t.report(\"@import prevents parallel downloads, use <link> instead.\",e.line,e.col,n)})}}),CSSLint.addRule({id:\"important\",name:\"Disallow !important\",desc:\"Be careful when using !important declaration\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"property\",function(e){e.important===!0&&(r++,t.report(\"Use of !important\",e.line,e.col,n))}),e.addListener(\"endstylesheet\",function(){t.stat(\"important\",r),r>=10&&t.rollupWarn(\"Too many !important declarations (\"+r+\"), try to use less than 10 to avoid specificity issues.\",n)})}}),CSSLint.addRule({id:\"known-properties\",name:\"Require use of known properties\",desc:\"Properties should be known (listed in CSS3 specification) or be a vendor-prefixed property.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"property\",function(e){var r=e.property.text.toLowerCase();e.invalid&&t.report(e.invalid.message,e.line,e.col,n)})}}),CSSLint.addRule({id:\"outline-none\",name:\"Disallow outline: none\",desc:\"Use of outline: none or outline: 0 should be limited to :focus rules.\",browsers:\"All\",tags:[\"Accessibility\"],init:function(e,t){function n(e){e.selectors?s={line:e.line,col:e.col,selectors:e.selectors,propCount:0,outline:!1}:s=null}function r(e){s&&s.outline&&(s.selectors.toString().toLowerCase().indexOf(\":focus\")==-1?t.report(\"Outlines should only be modified using :focus.\",s.line,s.col,i):s.propCount==1&&t.report(\"Outlines shouldn't be hidden unless other visual changes are made.\",s.line,s.col,i))}var i=this,s;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"startpage\",n),e.addListener(\"startpagemargin\",n),e.addListener(\"startkeyframerule\",n),e.addListener(\"property\",function(e){var t=e.property.text.toLowerCase(),n=e.value;s&&(s.propCount++,t==\"outline\"&&(n==\"none\"||n==\"0\")&&(s.outline=!0))}),e.addListener(\"endrule\",r),e.addListener(\"endfontface\",r),e.addListener(\"endpage\",r),e.addListener(\"endpagemargin\",r),e.addListener(\"endkeyframerule\",r)}}),CSSLint.addRule({id:\"overqualified-elements\",name:\"Disallow overqualified elements\",desc:\"Don't use classes or IDs with elements (a.foo or a#foo).\",browsers:\"All\",init:function(e,t){var n=this,r={};e.addListener(\"startrule\",function(i){var s=i.selectors,o,u,a,f,l,c;for(f=0;f<s.length;f++){o=s[f];for(l=0;l<o.parts.length;l++){u=o.parts[l];if(u.type==e.SELECTOR_PART_TYPE)for(c=0;c<u.modifiers.length;c++)a=u.modifiers[c],u.elementName&&a.type==\"id\"?t.report(\"Element (\"+u+\") is overqualified, just use \"+a+\" without element name.\",u.line,u.col,n):a.type==\"class\"&&(r[a]||(r[a]=[]),r[a].push({modifier:a,part:u}))}}}),e.addListener(\"endstylesheet\",function(){var e;for(e in r)r.hasOwnProperty(e)&&r[e].length==1&&r[e][0].part.elementName&&t.report(\"Element (\"+r[e][0].part+\") is overqualified, just use \"+r[e][0].modifier+\" without element name.\",r[e][0].part.line,r[e][0].part.col,n)})}}),CSSLint.addRule({id:\"qualified-headings\",name:\"Disallow qualified headings\",desc:\"Headings should not be qualified (namespaced).\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(r){var i=r.selectors,s,o,u,a;for(u=0;u<i.length;u++){s=i[u];for(a=0;a<s.parts.length;a++)o=s.parts[a],o.type==e.SELECTOR_PART_TYPE&&o.elementName&&/h[1-6]/.test(o.elementName.toString())&&a>0&&t.report(\"Heading (\"+o.elementName+\") should not be qualified.\",o.line,o.col,n)}})}}),CSSLint.addRule({id:\"regex-selectors\",name:\"Disallow selectors that look like regexs\",desc:\"Selectors that look like regular expressions are slow and should be avoided.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(r){var i=r.selectors,s,o,u,a,f,l;for(a=0;a<i.length;a++){s=i[a];for(f=0;f<s.parts.length;f++){o=s.parts[f];if(o.type==e.SELECTOR_PART_TYPE)for(l=0;l<o.modifiers.length;l++)u=o.modifiers[l],u.type==\"attribute\"&&/([\\~\\|\\^\\$\\*]=)/.test(u)&&t.report(\"Attribute selectors with \"+RegExp.$1+\" are slow!\",u.line,u.col,n)}}})}}),CSSLint.addRule({id:\"rules-count\",name:\"Rules Count\",desc:\"Track how many rules there are.\",browsers:\"All\",init:function(e,t){var n=this,r=0;e.addListener(\"startrule\",function(){r++}),e.addListener(\"endstylesheet\",function(){t.stat(\"rule-count\",r)})}}),CSSLint.addRule({id:\"selector-max-approaching\",name:\"Warn when approaching the 4095 selector limit for IE\",desc:\"Will warn when selector count is >= 3800 selectors.\",browsers:\"IE\",init:function(e,t){var n=this,r=0;e.addListener(\"startrule\",function(e){r+=e.selectors.length}),e.addListener(\"endstylesheet\",function(){r>=3800&&t.report(\"You have \"+r+\" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.\",0,0,n)})}}),CSSLint.addRule({id:\"selector-max\",name:\"Error when past the 4095 selector limit for IE\",desc:\"Will error when selector count is > 4095.\",browsers:\"IE\",init:function(e,t){var n=this,r=0;e.addListener(\"startrule\",function(e){r+=e.selectors.length}),e.addListener(\"endstylesheet\",function(){r>4095&&t.report(\"You have \"+r+\" selectors. Internet Explorer supports a maximum of 4095 selectors per stylesheet. Consider refactoring.\",0,0,n)})}}),CSSLint.addRule({id:\"shorthand\",name:\"Require shorthand properties\",desc:\"Use shorthand properties where possible.\",browsers:\"All\",init:function(e,t){function n(e){f={}}function r(e){var n,r,s,o;for(n in l)if(l.hasOwnProperty(n)){o=0;for(r=0,s=l[n].length;r<s;r++)o+=f[l[n][r]]?1:0;o==l[n].length&&t.report(\"The properties \"+l[n].join(\", \")+\" can be replaced by \"+n+\".\",e.line,e.col,i)}}var i=this,s,o,u,a={},f,l={margin:[\"margin-top\",\"margin-bottom\",\"margin-left\",\"margin-right\"],padding:[\"padding-top\",\"padding-bottom\",\"padding-left\",\"padding-right\"]};for(s in l)if(l.hasOwnProperty(s))for(o=0,u=l[s].length;o<u;o++)a[l[s][o]]=s;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"property\",function(e){var t=e.property.toString().toLowerCase(),n=e.value.parts[0].value;a[t]&&(f[t]=1)}),e.addListener(\"endrule\",r),e.addListener(\"endfontface\",r)}}),CSSLint.addRule({id:\"star-property-hack\",name:\"Disallow properties with a star prefix\",desc:\"Checks for the star property hack (targets IE6/7)\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"property\",function(e){var r=e.property;r.hack==\"*\"&&t.report(\"Property with star prefix found.\",e.property.line,e.property.col,n)})}}),CSSLint.addRule({id:\"text-indent\",name:\"Disallow negative text-indent\",desc:\"Checks for text indent less than -99px\",browsers:\"All\",init:function(e,t){function n(e){s=!1,o=\"inherit\"}function r(e){s&&o!=\"ltr\"&&t.report(\"Negative text-indent doesn't work well with RTL. If you use text-indent for image replacement explicitly set direction for that item to ltr.\",s.line,s.col,i)}var i=this,s,o;e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"property\",function(e){var t=e.property.toString().toLowerCase(),n=e.value;t==\"text-indent\"&&n.parts[0].value<-99?s=e.property:t==\"direction\"&&n==\"ltr\"&&(o=\"ltr\")}),e.addListener(\"endrule\",r),e.addListener(\"endfontface\",r)}}),CSSLint.addRule({id:\"underscore-property-hack\",name:\"Disallow properties with an underscore prefix\",desc:\"Checks for the underscore property hack (targets IE6)\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"property\",function(e){var r=e.property;r.hack==\"_\"&&t.report(\"Property with underscore prefix found.\",e.property.line,e.property.col,n)})}}),CSSLint.addRule({id:\"unique-headings\",name:\"Headings should only be defined once\",desc:\"Headings should be defined only once.\",browsers:\"All\",init:function(e,t){var n=this,r={h1:0,h2:0,h3:0,h4:0,h5:0,h6:0};e.addListener(\"startrule\",function(e){var i=e.selectors,s,o,u,a,f;for(a=0;a<i.length;a++){s=i[a],o=s.parts[s.parts.length-1];if(o.elementName&&/(h[1-6])/i.test(o.elementName.toString())){for(f=0;f<o.modifiers.length;f++)if(o.modifiers[f].type==\"pseudo\"){u=!0;break}u||(r[RegExp.$1]++,r[RegExp.$1]>1&&t.report(\"Heading (\"+o.elementName+\") has already been defined.\",o.line,o.col,n))}}}),e.addListener(\"endstylesheet\",function(e){var i,s=[];for(i in r)r.hasOwnProperty(i)&&r[i]>1&&s.push(r[i]+\" \"+i+\"s\");s.length&&t.rollupWarn(\"You have \"+s.join(\", \")+\" defined in this stylesheet.\",n)})}}),CSSLint.addRule({id:\"universal-selector\",name:\"Disallow universal selector\",desc:\"The universal selector (*) is known to be slow.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(e){var r=e.selectors,i,s,o,u,a,f;for(u=0;u<r.length;u++)i=r[u],s=i.parts[i.parts.length-1],s.elementName==\"*\"&&t.report(n.desc,s.line,s.col,n)})}}),CSSLint.addRule({id:\"unqualified-attributes\",name:\"Disallow unqualified attribute selectors\",desc:\"Unqualified attribute selectors are known to be slow.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"startrule\",function(r){var i=r.selectors,s,o,u,a,f,l;for(a=0;a<i.length;a++){s=i[a],o=s.parts[s.parts.length-1];if(o.type==e.SELECTOR_PART_TYPE)for(l=0;l<o.modifiers.length;l++)u=o.modifiers[l],u.type==\"attribute\"&&(!o.elementName||o.elementName==\"*\")&&t.report(n.desc,o.line,o.col,n)}})}}),CSSLint.addRule({id:\"vendor-prefix\",name:\"Require standard property with vendor prefix\",desc:\"When using a vendor-prefixed property, make sure to include the standard one.\",browsers:\"All\",init:function(e,t){function n(){s={},o=1}function r(e){var n,r,o,a,f,l,c=[];for(n in s)u[n]&&c.push({actual:n,needed:u[n]});for(r=0,o=c.length;r<o;r++)f=c[r].needed,l=c[r].actual,s[f]?s[f][0].pos<s[l][0].pos&&t.report(\"Standard property '\"+f+\"' should come after vendor-prefixed property '\"+l+\"'.\",s[l][0].name.line,s[l][0].name.col,i):t.report(\"Missing standard property '\"+f+\"' to go along with '\"+l+\"'.\",s[l][0].name.line,s[l][0].name.col,i)}var i=this,s,o,u={\"-webkit-border-radius\":\"border-radius\",\"-webkit-border-top-left-radius\":\"border-top-left-radius\",\"-webkit-border-top-right-radius\":\"border-top-right-radius\",\"-webkit-border-bottom-left-radius\":\"border-bottom-left-radius\",\"-webkit-border-bottom-right-radius\":\"border-bottom-right-radius\",\"-o-border-radius\":\"border-radius\",\"-o-border-top-left-radius\":\"border-top-left-radius\",\"-o-border-top-right-radius\":\"border-top-right-radius\",\"-o-border-bottom-left-radius\":\"border-bottom-left-radius\",\"-o-border-bottom-right-radius\":\"border-bottom-right-radius\",\"-moz-border-radius\":\"border-radius\",\"-moz-border-radius-topleft\":\"border-top-left-radius\",\"-moz-border-radius-topright\":\"border-top-right-radius\",\"-moz-border-radius-bottomleft\":\"border-bottom-left-radius\",\"-moz-border-radius-bottomright\":\"border-bottom-right-radius\",\"-moz-column-count\":\"column-count\",\"-webkit-column-count\":\"column-count\",\"-moz-column-gap\":\"column-gap\",\"-webkit-column-gap\":\"column-gap\",\"-moz-column-rule\":\"column-rule\",\"-webkit-column-rule\":\"column-rule\",\"-moz-column-rule-style\":\"column-rule-style\",\"-webkit-column-rule-style\":\"column-rule-style\",\"-moz-column-rule-color\":\"column-rule-color\",\"-webkit-column-rule-color\":\"column-rule-color\",\"-moz-column-rule-width\":\"column-rule-width\",\"-webkit-column-rule-width\":\"column-rule-width\",\"-moz-column-width\":\"column-width\",\"-webkit-column-width\":\"column-width\",\"-webkit-column-span\":\"column-span\",\"-webkit-columns\":\"columns\",\"-moz-box-shadow\":\"box-shadow\",\"-webkit-box-shadow\":\"box-shadow\",\"-moz-transform\":\"transform\",\"-webkit-transform\":\"transform\",\"-o-transform\":\"transform\",\"-ms-transform\":\"transform\",\"-moz-transform-origin\":\"transform-origin\",\"-webkit-transform-origin\":\"transform-origin\",\"-o-transform-origin\":\"transform-origin\",\"-ms-transform-origin\":\"transform-origin\",\"-moz-box-sizing\":\"box-sizing\",\"-webkit-box-sizing\":\"box-sizing\",\"-moz-user-select\":\"user-select\",\"-khtml-user-select\":\"user-select\",\"-webkit-user-select\":\"user-select\"};e.addListener(\"startrule\",n),e.addListener(\"startfontface\",n),e.addListener(\"startpage\",n),e.addListener(\"startpagemargin\",n),e.addListener(\"startkeyframerule\",n),e.addListener(\"property\",function(e){var t=e.property.text.toLowerCase();s[t]||(s[t]=[]),s[t].push({name:e.property,value:e.value,pos:o++})}),e.addListener(\"endrule\",r),e.addListener(\"endfontface\",r),e.addListener(\"endpage\",r),e.addListener(\"endpagemargin\",r),e.addListener(\"endkeyframerule\",r)}}),CSSLint.addRule({id:\"zero-units\",name:\"Disallow units for 0 values\",desc:\"You don't need to specify units when a value is 0.\",browsers:\"All\",init:function(e,t){var n=this;e.addListener(\"property\",function(e){var r=e.value.parts,i=0,s=r.length;while(i<s)(r[i].units||r[i].type==\"percentage\")&&r[i].value===0&&r[i].type!=\"time\"&&t.report(\"Values of 0 shouldn't have units specified.\",r[i].line,r[i].col,n),i++})}}),function(){var e=function(e){return!e||e.constructor!==String?\"\":e.replace(/[\\\"&><]/g,function(e){switch(e){case'\"':return\"&quot;\";case\"&\":return\"&amp;\";case\"<\":return\"&lt;\";case\">\":return\"&gt;\"}})};CSSLint.addFormatter({id:\"checkstyle-xml\",name:\"Checkstyle XML format\",startFormat:function(){return'<?xml version=\"1.0\" encoding=\"utf-8\"?><checkstyle>'},endFormat:function(){return\"</checkstyle>\"},readError:function(t,n){return'<file name=\"'+e(t)+'\"><error line=\"0\" column=\"0\" severty=\"error\" message=\"'+e(n)+'\"></error></file>'},formatResults:function(t,n,r){var i=t.messages,s=[],o=function(e){return!!e&&\"name\"in e?\"net.csslint.\"+e.name.replace(/\\s/g,\"\"):\"\"};return i.length>0&&(s.push('<file name=\"'+n+'\">'),CSSLint.Util.forEach(i,function(t,n){t.rollup||s.push('<error line=\"'+t.line+'\" column=\"'+t.col+'\" severity=\"'+t.type+'\"'+' message=\"'+e(t.message)+'\" source=\"'+o(t.rule)+'\"/>')}),s.push(\"</file>\")),s.join(\"\")}})}(),CSSLint.addFormatter({id:\"compact\",name:\"Compact, 'porcelain' format\",startFormat:function(){return\"\"},endFormat:function(){return\"\"},formatResults:function(e,t,n){var r=e.messages,i=\"\";n=n||{};var s=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return r.length===0?n.quiet?\"\":t+\": Lint Free!\":(CSSLint.Util.forEach(r,function(e,n){e.rollup?i+=t+\": \"+s(e.type)+\" - \"+e.message+\"\\n\":i+=t+\": \"+\"line \"+e.line+\", col \"+e.col+\", \"+s(e.type)+\" - \"+e.message+\" (\"+e.rule.id+\")\\n\"}),i)}}),CSSLint.addFormatter({id:\"csslint-xml\",name:\"CSSLint XML format\",startFormat:function(){return'<?xml version=\"1.0\" encoding=\"utf-8\"?><csslint>'},endFormat:function(){return\"</csslint>\"},formatResults:function(e,t,n){var r=e.messages,i=[],s=function(e){return!e||e.constructor!==String?\"\":e.replace(/\\\"/g,\"'\").replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")};return r.length>0&&(i.push('<file name=\"'+t+'\">'),CSSLint.Util.forEach(r,function(e,t){e.rollup?i.push('<issue severity=\"'+e.type+'\" reason=\"'+s(e.message)+'\" evidence=\"'+s(e.evidence)+'\"/>'):i.push('<issue line=\"'+e.line+'\" char=\"'+e.col+'\" severity=\"'+e.type+'\"'+' reason=\"'+s(e.message)+'\" evidence=\"'+s(e.evidence)+'\"/>')}),i.push(\"</file>\")),i.join(\"\")}}),CSSLint.addFormatter({id:\"junit-xml\",name:\"JUNIT XML format\",startFormat:function(){return'<?xml version=\"1.0\" encoding=\"utf-8\"?><testsuites>'},endFormat:function(){return\"</testsuites>\"},formatResults:function(e,t,n){var r=e.messages,i=[],s={error:0,failure:0},o=function(e){return!!e&&\"name\"in e?\"net.csslint.\"+e.name.replace(/\\s/g,\"\"):\"\"},u=function(e){return!e||e.constructor!==String?\"\":e.replace(/\\\"/g,\"'\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")};return r.length>0&&(r.forEach(function(e,t){var n=e.type===\"warning\"?\"error\":e.type;e.rollup||(i.push('<testcase time=\"0\" name=\"'+o(e.rule)+'\">'),i.push(\"<\"+n+' message=\"'+u(e.message)+'\"><![CDATA['+e.line+\":\"+e.col+\":\"+u(e.evidence)+\"]]></\"+n+\">\"),i.push(\"</testcase>\"),s[n]+=1)}),i.unshift('<testsuite time=\"0\" tests=\"'+r.length+'\" skipped=\"0\" errors=\"'+s.error+'\" failures=\"'+s.failure+'\" package=\"net.csslint\" name=\"'+t+'\">'),i.push(\"</testsuite>\")),i.join(\"\")}}),CSSLint.addFormatter({id:\"lint-xml\",name:\"Lint XML format\",startFormat:function(){return'<?xml version=\"1.0\" encoding=\"utf-8\"?><lint>'},endFormat:function(){return\"</lint>\"},formatResults:function(e,t,n){var r=e.messages,i=[],s=function(e){return!e||e.constructor!==String?\"\":e.replace(/\\\"/g,\"'\").replace(/&/g,\"&amp;\").replace(/</g,\"&lt;\").replace(/>/g,\"&gt;\")};return r.length>0&&(i.push('<file name=\"'+t+'\">'),CSSLint.Util.forEach(r,function(e,t){e.rollup?i.push('<issue severity=\"'+e.type+'\" reason=\"'+s(e.message)+'\" evidence=\"'+s(e.evidence)+'\"/>'):i.push('<issue line=\"'+e.line+'\" char=\"'+e.col+'\" severity=\"'+e.type+'\"'+' reason=\"'+s(e.message)+'\" evidence=\"'+s(e.evidence)+'\"/>')}),i.push(\"</file>\")),i.join(\"\")}}),CSSLint.addFormatter({id:\"text\",name:\"Plain Text\",startFormat:function(){return\"\"},endFormat:function(){return\"\"},formatResults:function(e,t,n){var r=e.messages,i=\"\";n=n||{};if(r.length===0)return n.quiet?\"\":\"\\n\\ncsslint: No errors in \"+t+\".\";i=\"\\n\\ncsslint: There are \"+r.length+\" problems in \"+t+\".\";var s=t.lastIndexOf(\"/\"),o=t;return s===-1&&(s=t.lastIndexOf(\"\\\\\")),s>-1&&(o=t.substring(s+1)),CSSLint.Util.forEach(r,function(e,t){i=i+\"\\n\\n\"+o,e.rollup?(i+=\"\\n\"+(t+1)+\": \"+e.type,i+=\"\\n\"+e.message):(i+=\"\\n\"+(t+1)+\": \"+e.type+\" at line \"+e.line+\", col \"+e.col,i+=\"\\n\"+e.message,i+=\"\\n\"+e.evidence)}),i}}),exports.CSSLint=CSSLint}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-html.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/html_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/lang\",\"ace/worker/mirror\",\"ace/mode/html/saxparser\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../lib/lang\"),s=e(\"../worker/mirror\").Mirror,o=e(\"./html/saxparser\").SAXParser,u={\"expected-doctype-but-got-start-tag\":\"info\",\"expected-doctype-but-got-chars\":\"info\",\"non-html-root\":\"info\"},a=t.Worker=function(e){s.call(this,e),this.setTimeout(400),this.context=null};r.inherits(a,s),function(){this.setOptions=function(e){this.context=e.context},this.onUpdate=function(){var e=this.doc.getValue();if(!e)return;var t=new o,n=[],r=function(){};t.contentHandler={startDocument:r,endDocument:r,startElement:r,endElement:r,characters:r},t.errorHandler={error:function(e,t,r){n.push({row:t.line,column:t.column,text:e,type:u[r]||\"error\"})}},this.context?t.parseFragment(e,this.context):t.parse(e),this.sender.emit(\"error\",n)}}.call(a.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/mode/html/saxparser\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports=function r(t,n,i){function s(u,a){if(!n[u]){if(!t[u]){var f=typeof e==\"function\"&&e;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error(\"Cannot find module '\"+u+\"'\")}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return s(n?n:e)},l,l.exports,r,t,n,i)}return n[u].exports}var o=typeof e==\"function\"&&e;for(var u=0;u<i.length;u++)s(i[u]);return s}({1:[function(e,t,n){function r(e){if(e.namespaceURI===\"http://www.w3.org/1999/xhtml\")return e.localName===\"applet\"||e.localName===\"caption\"||e.localName===\"marquee\"||e.localName===\"object\"||e.localName===\"table\"||e.localName===\"td\"||e.localName===\"th\";if(e.namespaceURI===\"http://www.w3.org/1998/Math/MathML\")return e.localName===\"mi\"||e.localName===\"mo\"||e.localName===\"mn\"||e.localName===\"ms\"||e.localName===\"mtext\"||e.localName===\"annotation-xml\";if(e.namespaceURI===\"http://www.w3.org/2000/svg\")return e.localName===\"foreignObject\"||e.localName===\"desc\"||e.localName===\"title\"}function i(e){return r(e)||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"ol\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"ul\"}function s(e){return e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"table\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"html\"}function o(e){return e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"tbody\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"tfoot\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"thead\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"html\"}function u(e){return e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"tr\"||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"html\"}function a(e){return r(e)||e.namespaceURI===\"http://www.w3.org/1999/xhtml\"&&e.localName===\"button\"}function f(e){return(e.namespaceURI!==\"http://www.w3.org/1999/xhtml\"||e.localName!==\"optgroup\")&&(e.namespaceURI!==\"http://www.w3.org/1999/xhtml\"||e.localName!==\"option\")}function l(){this.elements=[],this.rootNode=null,this.headElement=null,this.bodyElement=null}l.prototype._inScope=function(e,t){for(var n=this.elements.length-1;n>=0;n--){var r=this.elements[n];if(r.localName===e)return!0;if(t(r))return!1}},l.prototype.push=function(e){this.elements.push(e)},l.prototype.pushHtmlElement=function(e){this.rootNode=e.node,this.push(e)},l.prototype.pushHeadElement=function(e){this.headElement=e.node,this.push(e)},l.prototype.pushBodyElement=function(e){this.bodyElement=e.node,this.push(e)},l.prototype.pop=function(){return this.elements.pop()},l.prototype.remove=function(e){this.elements.splice(this.elements.indexOf(e),1)},l.prototype.popUntilPopped=function(e){var t;do t=this.pop();while(t.localName!=e)},l.prototype.popUntilTableScopeMarker=function(){while(!s(this.top))this.pop()},l.prototype.popUntilTableBodyScopeMarker=function(){while(!o(this.top))this.pop()},l.prototype.popUntilTableRowScopeMarker=function(){while(!u(this.top))this.pop()},l.prototype.item=function(e){return this.elements[e]},l.prototype.contains=function(e){return this.elements.indexOf(e)!==-1},l.prototype.inScope=function(e){return this._inScope(e,r)},l.prototype.inListItemScope=function(e){return this._inScope(e,i)},l.prototype.inTableScope=function(e){return this._inScope(e,s)},l.prototype.inButtonScope=function(e){return this._inScope(e,a)},l.prototype.inSelectScope=function(e){return this._inScope(e,f)},l.prototype.hasNumberedHeaderElementInScope=function(){for(var e=this.elements.length-1;e>=0;e--){var t=this.elements[e];if(t.isNumberedHeader())return!0;if(r(t))return!1}},l.prototype.furthestBlockForFormattingElement=function(e){var t=null;for(var n=this.elements.length-1;n>=0;n--){var r=this.elements[n];if(r.node===e)break;r.isSpecial()&&(t=r)}return t},l.prototype.findIndex=function(e){for(var t=this.elements.length-1;t>=0;t--)if(this.elements[t].localName==e)return t;return-1},l.prototype.remove_openElements_until=function(e){var t=!1,n;while(!t)n=this.elements.pop(),t=e(n);return n},Object.defineProperty(l.prototype,\"top\",{get:function(){return this.elements[this.elements.length-1]}}),Object.defineProperty(l.prototype,\"length\",{get:function(){return this.elements.length}}),n.ElementStack=l},{}],2:[function(e,t,n){function r(e){return e>=\"0\"&&e<=\"9\"||e>=\"a\"&&e<=\"z\"||e>=\"A\"&&e<=\"Z\"}function i(e){return e>=\"0\"&&e<=\"9\"||e>=\"a\"&&e<=\"f\"||e>=\"A\"&&e<=\"F\"}function s(e){return e>=\"0\"&&e<=\"9\"}var o=e(\"html5-entities\"),u=e(\"./InputStream\").InputStream,a={};Object.keys(o).forEach(function(e){for(var t=0;t<e.length;t++)a[e.substring(0,t+1)]=!0});var f={};f.consumeEntity=function(e,t,n){var f=\"\",l=\"\",c=e.char();if(c===u.EOF)return!1;l+=c;if(c==\"\t\"||c==\"\\n\"||c==\"\u000b\"||c==\" \"||c==\"<\"||c==\"&\")return e.unget(l),!1;if(n===c)return e.unget(l),!1;if(c==\"#\"){c=e.shift(1);if(c===u.EOF)return t._parseError(\"expected-numeric-entity-but-got-eof\"),e.unget(l),!1;l+=c;var h=10,p=s;if(c==\"x\"||c==\"X\"){h=16,p=i,c=e.shift(1);if(c===u.EOF)return t._parseError(\"expected-numeric-entity-but-got-eof\"),e.unget(l),!1;l+=c}if(p(c)){var d=\"\";while(c!==u.EOF&&p(c))d+=c,c=e.char();d=parseInt(d,h);var v=this.replaceEntityNumbers(d);v&&(t._parseError(\"invalid-numeric-entity-replaced\"),d=v);if(d>65535&&d<=1114111){d-=65536;var m=((1047552&d)>>10)+55296,g=(1023&d)+56320;f=String.fromCharCode(m,g)}else f=String.fromCharCode(d);return c!==\";\"&&(t._parseError(\"numeric-entity-without-semicolon\"),e.unget(c)),f}return e.unget(l),t._parseError(\"expected-numeric-entity\"),!1}if(c>=\"a\"&&c<=\"z\"||c>=\"A\"&&c<=\"Z\"){var y=\"\";while(a[l]){o[l]&&(y=l);if(c==\";\")break;c=e.char();if(c===u.EOF)break;l+=c}return y?(f=o[y],c===\";\"||!n||!r(c)&&c!==\"=\"?(l.length>y.length&&e.unget(l.substring(y.length)),c!==\";\"&&t._parseError(\"named-entity-without-semicolon\"),f):(e.unget(l),!1)):(t._parseError(\"expected-named-entity\"),e.unget(l),!1)}},f.replaceEntityNumbers=function(e){switch(e){case 0:return 65533;case 19:return 16;case 128:return 8364;case 129:return 129;case 130:return 8218;case 131:return 402;case 132:return 8222;case 133:return 8230;case 134:return 8224;case 135:return 8225;case 136:return 710;case 137:return 8240;case 138:return 352;case 139:return 8249;case 140:return 338;case 141:return 141;case 142:return 381;case 143:return 143;case 144:return 144;case 145:return 8216;case 146:return 8217;case 147:return 8220;case 148:return 8221;case 149:return 8226;case 150:return 8211;case 151:return 8212;case 152:return 732;case 153:return 8482;case 154:return 353;case 155:return 8250;case 156:return 339;case 157:return 157;case 158:return 382;case 159:return 376;default:if(e>=55296&&e<=57343||e>1114111)return 65533;if(e>=1&&e<=8||e>=14&&e<=31||e>=127&&e<=159||e>=64976&&e<=65007||e==11||e==65534||e==131070||e==3145726||e==196607||e==262142||e==262143||e==327678||e==327679||e==393214||e==393215||e==458750||e==458751||e==524286||e==524287||e==589822||e==589823||e==655358||e==655359||e==720894||e==720895||e==786430||e==786431||e==851966||e==851967||e==917502||e==917503||e==983038||e==983039||e==1048574||e==1048575||e==1114110||e==1114111)return e}},n.EntityParser=f},{\"./InputStream\":3,\"html5-entities\":12}],3:[function(e,t,n){function r(){this.data=\"\",this.start=0,this.committed=0,this.eof=!1,this.lastLocation={line:0,column:0}}r.EOF=-1,r.DRAIN=-2,r.prototype={slice:function(){if(this.start>=this.data.length){if(!this.eof)throw r.DRAIN;return r.EOF}return this.data.slice(this.start,this.data.length)},\"char\":function(){if(!this.eof&&this.start>=this.data.length-1)throw r.DRAIN;if(this.start>=this.data.length)return r.EOF;var e=this.data[this.start++];return e===\"\\r\"&&(e=\"\\n\"),e},advance:function(e){this.start+=e;if(this.start>=this.data.length){if(!this.eof)throw r.DRAIN;return r.EOF}this.committed>this.data.length/2&&(this.lastLocation=this.location(),this.data=this.data.slice(this.committed),this.start=this.start-this.committed,this.committed=0)},matchWhile:function(e){if(this.eof&&this.start>=this.data.length)return\"\";var t=new RegExp(\"^\"+e+\"+\"),n=t.exec(this.slice());if(n){if(!this.eof&&n[0].length==this.data.length-this.start)throw r.DRAIN;return this.advance(n[0].length),n[0]}return\"\"},matchUntil:function(e){var t,n;n=this.slice();if(n===r.EOF)return\"\";if(t=(new RegExp(e+(this.eof?\"|$\":\"\"))).exec(n)){var i=this.data.slice(this.start,this.start+t.index);return this.advance(t.index),i.replace(/\\r/g,\"\\n\").replace(/\\n{2,}/g,\"\\n\")}throw r.DRAIN},append:function(e){this.data+=e},shift:function(e){if(!this.eof&&this.start+e>=this.data.length)throw r.DRAIN;if(this.eof&&this.start>=this.data.length)return r.EOF;var t=this.data.slice(this.start,this.start+e).toString();return this.advance(Math.min(e,this.data.length-this.start)),t},peek:function(e){if(!this.eof&&this.start+e>=this.data.length)throw r.DRAIN;return this.eof&&this.start>=this.data.length?r.EOF:this.data.slice(this.start,Math.min(this.start+e,this.data.length)).toString()},length:function(){return this.data.length-this.start-1},unget:function(e){if(e===r.EOF)return;this.start-=e.length},undo:function(){this.start=this.committed},commit:function(){this.committed=this.start},location:function(){var e=this.lastLocation.line,t=this.lastLocation.column,n=this.data.slice(0,this.committed),r=n.match(/\\n/g),i=r?e+r.length:e,s=r?n.length-n.lastIndexOf(\"\\n\")-1:t+n.length;return{line:i,column:s}}},n.InputStream=r},{}],4:[function(e,t,n){function r(e,t,n,r){this.localName=t,this.namespaceURI=e,this.attributes=n,this.node=r}function i(e,t){for(var n=0;n<e.attributes.length;n++)if(e.attributes[n].nodeName==t)return e.attributes[n].nodeValue;return null}var s={\"http://www.w3.org/1999/xhtml\":[\"address\",\"applet\",\"area\",\"article\",\"aside\",\"base\",\"basefont\",\"bgsound\",\"blockquote\",\"body\",\"br\",\"button\",\"caption\",\"center\",\"col\",\"colgroup\",\"dd\",\"details\",\"dir\",\"div\",\"dl\",\"dt\",\"embed\",\"fieldset\",\"figcaption\",\"figure\",\"footer\",\"form\",\"frame\",\"frameset\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"header\",\"hgroup\",\"hr\",\"html\",\"iframe\",\"img\",\"input\",\"isindex\",\"li\",\"link\",\"listing\",\"main\",\"marquee\",\"menu\",\"menuitem\",\"meta\",\"nav\",\"noembed\",\"noframes\",\"noscript\",\"object\",\"ol\",\"p\",\"param\",\"plaintext\",\"pre\",\"script\",\"section\",\"select\",\"source\",\"style\",\"summary\",\"table\",\"tbody\",\"td\",\"textarea\",\"tfoot\",\"th\",\"thead\",\"title\",\"tr\",\"track\",\"ul\",\"wbr\",\"xmp\"],\"http://www.w3.org/1998/Math/MathML\":[\"mi\",\"mo\",\"mn\",\"ms\",\"mtext\",\"annotation-xml\"],\"http://www.w3.org/2000/svg\":[\"foreignObject\",\"desc\",\"title\"]};r.prototype.isSpecial=function(){return this.namespaceURI in s&&s[this.namespaceURI].indexOf(this.localName)>-1},r.prototype.isFosterParenting=function(){return this.namespaceURI===\"http://www.w3.org/1999/xhtml\"?this.localName===\"table\"||this.localName===\"tbody\"||this.localName===\"tfoot\"||this.localName===\"thead\"||this.localName===\"tr\":!1},r.prototype.isNumberedHeader=function(){return this.namespaceURI===\"http://www.w3.org/1999/xhtml\"?this.localName===\"h1\"||this.localName===\"h2\"||this.localName===\"h3\"||this.localName===\"h4\"||this.localName===\"h5\"||this.localName===\"h6\":!1},r.prototype.isForeign=function(){return this.namespaceURI!=\"http://www.w3.org/1999/xhtml\"},r.prototype.isHtmlIntegrationPoint=function(){if(this.namespaceURI===\"http://www.w3.org/1998/Math/MathML\"){if(this.localName!==\"annotation-xml\")return!1;var e=i(this,\"encoding\");return e?(e=e.toLowerCase(),e===\"text/html\"||e===\"application/xhtml+xml\"):!1}return this.namespaceURI===\"http://www.w3.org/2000/svg\"?this.localName===\"foreignObject\"||this.localName===\"desc\"||this.localName===\"title\":!1},r.prototype.isMathMLTextIntegrationPoint=function(){return this.namespaceURI===\"http://www.w3.org/1998/Math/MathML\"?this.localName===\"mi\"||this.localName===\"mo\"||this.localName===\"mn\"||this.localName===\"ms\"||this.localName===\"mtext\":!1},n.StackItem=r},{}],5:[function(e,t,n){function r(e){return e===\" \"||e===\"\\n\"||e===\"\t\"||e===\"\\r\"||e===\"\\f\"}function i(e){return e>=\"A\"&&e<=\"Z\"||e>=\"a\"&&e<=\"z\"}function s(e){this._tokenHandler=e,this._state=s.DATA,this._inputStream=new o,this._currentToken=null,this._temporaryBuffer=\"\",this._additionalAllowedCharacter=\"\"}var o=e(\"./InputStream\").InputStream,u=e(\"./EntityParser\").EntityParser;s.prototype._parseError=function(e,t){this._tokenHandler.parseError(e,t)},s.prototype._emitToken=function(e){if(e.type===\"StartTag\")for(var t=1;t<e.data.length;t++)e.data[t].nodeName||e.data.splice(t--,1);else e.type===\"EndTag\"&&(e.selfClosing&&this._parseError(\"self-closing-flag-on-end-tag\"),e.data.length!==0&&this._parseError(\"attributes-in-end-tag\"));this._tokenHandler.processToken(e),e.type===\"StartTag\"&&e.selfClosing&&!this._tokenHandler.isSelfClosingFlagAcknowledged()&&this._parseError(\"non-void-element-with-trailing-solidus\",{name:e.name})},s.prototype._emitCurrentToken=function(){this._state=s.DATA,this._emitToken(this._currentToken)},s.prototype._currentAttribute=function(){return this._currentToken.data[this._currentToken.data.length-1]},s.prototype.setState=function(e){this._state=e},s.prototype.tokenize=function(e){function t(e){var t=e.char();if(t===o.EOF)return wt._emitToken({type:\"EOF\",data:null}),!1;if(t===\"&\")wt.setState(n);else if(t===\"<\")wt.setState(B);else if(t===\"\\0\")wt._emitToken({type:\"Characters\",data:t}),e.commit();else{var r=e.matchUntil(\"&|<|\\0\");wt._emitToken({type:\"Characters\",data:t+r}),e.commit()}return!0}function n(e){var n=u.consumeEntity(e,wt);return wt.setState(t),wt._emitToken({type:\"Characters\",data:n||\"&\"}),!0}function a(e){var t=e.char();if(t===o.EOF)return wt._emitToken({type:\"EOF\",data:null}),!1;if(t===\"&\")wt.setState(f);else if(t===\"<\")wt.setState(p);else if(t===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit();else{var n=e.matchUntil(\"&|<|\\0\");wt._emitToken({type:\"Characters\",data:t+n}),e.commit()}return!0}function f(e){var t=u.consumeEntity(e,wt);return wt.setState(a),wt._emitToken({type:\"Characters\",data:t||\"&\"}),!0}function l(e){var t=e.char();if(t===o.EOF)return wt._emitToken({type:\"EOF\",data:null}),!1;if(t===\"<\")wt.setState(m);else if(t===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit();else{var n=e.matchUntil(\"<|\\0\");wt._emitToken({type:\"Characters\",data:t+n})}return!0}function c(e){var t=e.char();if(t===o.EOF)return wt._emitToken({type:\"EOF\",data:null}),!1;if(t===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit();else{var n=e.matchUntil(\"\\0\");wt._emitToken({type:\"Characters\",data:t+n})}return!0}function h(e){var t=e.char();if(t===o.EOF)return wt._emitToken({type:\"EOF\",data:null}),!1;if(t===\"<\")wt.setState(b);else if(t===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit();else{var n=e.matchUntil(\"<|\\0\");wt._emitToken({type:\"Characters\",data:t+n})}return!0}function p(e){var t=e.char();return t===\"/\"?(this._temporaryBuffer=\"\",wt.setState(d)):(wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(t),wt.setState(a)),!0}function d(e){var t=e.char();return i(t)?(this._temporaryBuffer+=t,wt.setState(v)):(wt._emitToken({type:\"Characters\",data:\"</\"}),e.unget(t),wt.setState(a)),!0}function v(e){var n=wt._currentToken&&wt._currentToken.name===this._temporaryBuffer.toLowerCase(),s=e.char();return r(s)&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt.setState(I)):s===\"/\"&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt.setState(J)):s===\">\"&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt._emitCurrentToken(),wt.setState(t)):i(s)?(this._temporaryBuffer+=s,e.commit()):(wt._emitToken({type:\"Characters\",data:\"</\"+this._temporaryBuffer}),e.unget(s),wt.setState(a)),!0}function m(e){var t=e.char();return t===\"/\"?(this._temporaryBuffer=\"\",wt.setState(g)):(wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(t),wt.setState(l)),!0}function g(e){var t=e.char();return i(t)?(this._temporaryBuffer+=t,wt.setState(y)):(wt._emitToken({type:\"Characters\",data:\"</\"}),e.unget(t),wt.setState(l)),!0}function y(e){var n=wt._currentToken&&wt._currentToken.name===this._temporaryBuffer.toLowerCase(),s=e.char();return r(s)&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt.setState(I)):s===\"/\"&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt.setState(J)):s===\">\"&&n?(wt._currentToken={type:\"EndTag\",name:this._temporaryBuffer,data:[],selfClosing:!1},wt._emitCurrentToken(),wt.setState(t)):i(s)?(this._temporaryBuffer+=s,e.commit()):(wt._emitToken({type:\"Characters\",data:\"</\"+this._temporaryBuffer}),e.unget(s),wt.setState(l)),!0}function b(e){var t=e.char();return t===\"/\"?(this._temporaryBuffer=\"\",wt.setState(w)):t===\"!\"?(wt._emitToken({type:\"Characters\",data:\"<!\"}),wt.setState(S)):(wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(t),wt.setState(h)),!0}function w(e){var t=e.char();return i(t)?(this._temporaryBuffer+=t,wt.setState(E)):(wt._emitToken({type:\"Characters\",data:\"</\"}),e.unget(t),wt.setState(h)),!0}function E(e){var t=wt._currentToken&&wt._currentToken.name===this._temporaryBuffer.toLowerCase(),n=e.char();return r(n)&&t?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt.setState(I)):n===\"/\"&&t?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt.setState(J)):n===\">\"&&t?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt._emitCurrentToken()):i(n)?(this._temporaryBuffer+=n,e.commit()):(wt._emitToken({type:\"Characters\",data:\"</\"+this._temporaryBuffer}),e.unget(n),wt.setState(h)),!0}function S(e){var t=e.char();return t===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(x)):(e.unget(t),wt.setState(h)),!0}function x(e){var t=e.char();return t===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(C)):(e.unget(t),wt.setState(h)),!0}function T(e){var n=e.char();if(n===o.EOF)e.unget(n),wt.setState(t);else if(n===\"-\")wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(N);else if(n===\"<\")wt.setState(k);else if(n===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit();else{var r=e.matchUntil(\"<|-|\\0\");wt._emitToken({type:\"Characters\",data:n+r})}return!0}function N(e){var n=e.char();return n===o.EOF?(e.unget(n),wt.setState(t)):n===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(C)):n===\"<\"?wt.setState(k):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),wt.setState(T)):(wt._emitToken({type:\"Characters\",data:n}),wt.setState(T)),!0}function C(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-script\"),e.unget(n),wt.setState(t)):n===\"<\"?wt.setState(k):n===\">\"?(wt._emitToken({type:\"Characters\",data:\">\"}),wt.setState(h)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),wt.setState(T)):(wt._emitToken({type:\"Characters\",data:n}),wt.setState(T)),!0}function k(e){var t=e.char();return t===\"/\"?(this._temporaryBuffer=\"\",wt.setState(L)):i(t)?(wt._emitToken({type:\"Characters\",data:\"<\"+t}),this._temporaryBuffer=t,wt.setState(O)):(wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(t),wt.setState(T)),!0}function L(e){var t=e.char();return i(t)?(this._temporaryBuffer=t,wt.setState(A)):(wt._emitToken({type:\"Characters\",data:\"</\"}),e.unget(t),wt.setState(T)),!0}function A(e){var n=wt._currentToken&&wt._currentToken.name===this._temporaryBuffer.toLowerCase(),s=e.char();return r(s)&&n?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt.setState(I)):s===\"/\"&&n?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt.setState(J)):s===\">\"&&n?(wt._currentToken={type:\"EndTag\",name:\"script\",data:[],selfClosing:!1},wt.setState(t),wt._emitCurrentToken()):i(s)?(this._temporaryBuffer+=s,e.commit()):(wt._emitToken({type:\"Characters\",data:\"</\"+this._temporaryBuffer}),e.unget(s),wt.setState(T)),!0}function O(e){var t=e.char();return r(t)||t===\"/\"||t===\">\"?(wt._emitToken({type:\"Characters\",data:t}),this._temporaryBuffer.toLowerCase()===\"script\"?wt.setState(M):wt.setState(T)):i(t)?(wt._emitToken({type:\"Characters\",data:t}),this._temporaryBuffer+=t,e.commit()):(e.unget(t),wt.setState(T)),!0}function M(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-script\"),e.unget(n),wt.setState(t)):n===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(_)):n===\"<\"?(wt._emitToken({type:\"Characters\",data:\"<\"}),wt.setState(P)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),e.commit()):(wt._emitToken({type:\"Characters\",data:n}),e.commit()),!0}function _(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-script\"),e.unget(n),wt.setState(t)):n===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),wt.setState(D)):n===\"<\"?(wt._emitToken({type:\"Characters\",data:\"<\"}),wt.setState(P)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),wt.setState(M)):(wt._emitToken({type:\"Characters\",data:n}),wt.setState(M)),!0}function D(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-script\"),e.unget(n),wt.setState(t)):n===\"-\"?(wt._emitToken({type:\"Characters\",data:\"-\"}),e.commit()):n===\"<\"?(wt._emitToken({type:\"Characters\",data:\"<\"}),wt.setState(P)):n===\">\"?(wt._emitToken({type:\"Characters\",data:\">\"}),wt.setState(h)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._emitToken({type:\"Characters\",data:\"�\"}),wt.setState(M)):(wt._emitToken({type:\"Characters\",data:n}),wt.setState(M)),!0}function P(e){var t=e.char();return t===\"/\"?(wt._emitToken({type:\"Characters\",data:\"/\"}),this._temporaryBuffer=\"\",wt.setState(H)):(e.unget(t),wt.setState(M)),!0}function H(e){var t=e.char();return r(t)||t===\"/\"||t===\">\"?(wt._emitToken({type:\"Characters\",data:t}),this._temporaryBuffer.toLowerCase()===\"script\"?wt.setState(T):wt.setState(M)):i(t)?(wt._emitToken({type:\"Characters\",data:t}),this._temporaryBuffer+=t,e.commit()):(e.unget(t),wt.setState(M)),!0}function B(e){var n=e.char();return n===o.EOF?(wt._parseError(\"bare-less-than-sign-at-eof\"),wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(n),wt.setState(t)):i(n)?(wt._currentToken={type:\"StartTag\",name:n.toLowerCase(),data:[]},wt.setState(F)):n===\"!\"?wt.setState(Q):n===\"/\"?wt.setState(j):n===\">\"?(wt._parseError(\"expected-tag-name-but-got-right-bracket\"),wt._emitToken({type:\"Characters\",data:\"<>\"}),wt.setState(t)):n===\"?\"?(wt._parseError(\"expected-tag-name-but-got-question-mark\"),e.unget(n),wt.setState(K)):(wt._parseError(\"expected-tag-name\"),wt._emitToken({type:\"Characters\",data:\"<\"}),e.unget(n),wt.setState(t)),!0}function j(e){var n=e.char();return n===o.EOF?(wt._parseError(\"expected-closing-tag-but-got-eof\"),wt._emitToken({type:\"Characters\",data:\"</\"}),e.unget(n),wt.setState(t)):i(n)?(wt._currentToken={type:\"EndTag\",name:n.toLowerCase(),data:[]},wt.setState(F)):n===\">\"?(wt._parseError(\"expected-closing-tag-but-got-right-bracket\"),wt.setState(t)):(wt._parseError(\"expected-closing-tag-but-got-char\",{data:n}),e.unget(n),wt.setState(K)),!0}function F(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-tag-name\"),e.unget(n),wt.setState(t)):r(n)?wt.setState(I):i(n)?wt._currentToken.name+=n.toLowerCase():n===\">\"?wt._emitCurrentToken():n===\"/\"?wt.setState(J):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.name+=\"�\"):wt._currentToken.name+=n,e.commit(),!0}function I(e){var n=e.char();if(n===o.EOF)wt._parseError(\"expected-attribute-name-but-got-eof\"),e.unget(n),wt.setState(t);else{if(r(n))return!0;i(n)?(wt._currentToken.data.push({nodeName:n.toLowerCase(),nodeValue:\"\"}),wt.setState(q)):n===\">\"?wt._emitCurrentToken():n===\"/\"?wt.setState(J):n===\"'\"||n==='\"'||n===\"=\"||n===\"<\"?(wt._parseError(\"invalid-character-in-attribute-name\"),wt._currentToken.data.push({nodeName:n,nodeValue:\"\"}),wt.setState(q)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data.push({nodeName:\"�\",nodeValue:\"\"})):(wt._currentToken.data.push({nodeName:n,nodeValue:\"\"}),wt.setState(q))}return!0}function q(e){var n=e.char(),s=!0,u=!1;n===o.EOF?(wt._parseError(\"eof-in-attribute-name\"),e.unget(n),wt.setState(t),u=!0):n===\"=\"?wt.setState(U):i(n)?(wt._currentAttribute().nodeName+=n.toLowerCase(),s=!1):n===\">\"?u=!0:r(n)?wt.setState(R):n===\"/\"?wt.setState(J):n===\"'\"||n==='\"'?(wt._parseError(\"invalid-character-in-attribute-name\"),wt._currentAttribute().nodeName+=n,s=!1):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentAttribute().nodeName+=\"�\"):(wt._currentAttribute().nodeName+=n,s=!1);if(s){var a=wt._currentToken.data,f=a[a.length-1];for(var l=a.length-2;l>=0;l--)if(f.nodeName===a[l].nodeName){wt._parseError(\"duplicate-attribute\",{name:f.nodeName}),f.nodeName=null;break}u&&wt._emitCurrentToken()}else e.commit();return!0}function R(e){var n=e.char();if(n===o.EOF)wt._parseError(\"expected-end-of-tag-but-got-eof\"),e.unget(n),wt.setState(t);else{if(r(n))return!0;n===\"=\"?wt.setState(U):n===\">\"?wt._emitCurrentToken():i(n)?(wt._currentToken.data.push({nodeName:n,nodeValue:\"\"}),wt.setState(q)):n===\"/\"?wt.setState(J):n===\"'\"||n==='\"'||n===\"<\"?(wt._parseError(\"invalid-character-after-attribute-name\"),wt._currentToken.data.push({nodeName:n,nodeValue:\"\"}),wt.setState(q)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data.push({nodeName:\"�\",nodeValue:\"\"})):(wt._currentToken.data.push({nodeName:n,nodeValue:\"\"}),wt.setState(q))}return!0}function U(e){var n=e.char();if(n===o.EOF)wt._parseError(\"expected-attribute-value-but-got-eof\"),e.unget(n),wt.setState(t);else{if(r(n))return!0;n==='\"'?wt.setState(z):n===\"&\"?(wt.setState(X),e.unget(n)):n===\"'\"?wt.setState(W):n===\">\"?(wt._parseError(\"expected-attribute-value-but-got-right-bracket\"),wt._emitCurrentToken()):n===\"=\"||n===\"<\"||n===\"`\"?(wt._parseError(\"unexpected-character-in-unquoted-attribute-value\"),wt._currentAttribute().nodeValue+=n,wt.setState(X)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentAttribute().nodeValue+=\"�\"):(wt._currentAttribute().nodeValue+=n,wt.setState(X))}return!0}function z(e){var n=e.char();if(n===o.EOF)wt._parseError(\"eof-in-attribute-value-double-quote\"),e.unget(n),wt.setState(t);else if(n==='\"')wt.setState($);else if(n===\"&\")this._additionalAllowedCharacter='\"',wt.setState(V);else if(n===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._currentAttribute().nodeValue+=\"�\";else{var r=e.matchUntil('[\\0\"&]');n+=r,wt._currentAttribute().nodeValue+=n}return!0}function W(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-attribute-value-single-quote\"),e.unget(n),wt.setState(t)):n===\"'\"?wt.setState($):n===\"&\"?(this._additionalAllowedCharacter=\"'\",wt.setState(V)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentAttribute().nodeValue+=\"�\"):wt._currentAttribute().nodeValue+=n+e.matchUntil(\"\\0|['&]\"),!0}function X(e){var n=e.char();if(n===o.EOF)wt._parseError(\"eof-after-attribute-value\"),e.unget(n),wt.setState(t);else if(r(n))wt.setState(I);else if(n===\"&\")this._additionalAllowedCharacter=\">\",wt.setState(V);else if(n===\">\")wt._emitCurrentToken();else if(n==='\"'||n===\"'\"||n===\"=\"||n===\"`\"||n===\"<\")wt._parseError(\"unexpected-character-in-unquoted-attribute-value\"),wt._currentAttribute().nodeValue+=n,e.commit();else if(n===\"\\0\")wt._parseError(\"invalid-codepoint\"),wt._currentAttribute().nodeValue+=\"�\";else{var i=e.matchUntil(\"\\0|[\t\\n\u000b\\f \\r&<>\\\"'=`]\");i===o.EOF&&(wt._parseError(\"eof-in-attribute-value-no-quotes\"),wt._emitCurrentToken()),e.commit(),wt._currentAttribute().nodeValue+=n+i}return!0}function V(e){var t=u.consumeEntity(e,wt,this._additionalAllowedCharacter);return this._currentAttribute().nodeValue+=t||\"&\",this._additionalAllowedCharacter==='\"'?wt.setState(z):this._additionalAllowedCharacter===\"'\"?wt.setState(W):this._additionalAllowedCharacter===\">\"&&wt.setState(X),!0}function $(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-after-attribute-value\"),e.unget(n),wt.setState(t)):r(n)?wt.setState(I):n===\">\"?(wt.setState(t),wt._emitCurrentToken()):n===\"/\"?wt.setState(J):(wt._parseError(\"unexpected-character-after-attribute-value\"),e.unget(n),wt.setState(I)),!0}function J(e){var n=e.char();return n===o.EOF?(wt._parseError(\"unexpected-eof-after-solidus-in-tag\"),e.unget(n),wt.setState(t)):n===\">\"?(wt._currentToken.selfClosing=!0,wt.setState(t),wt._emitCurrentToken()):(wt._parseError(\"unexpected-character-after-solidus-in-tag\"),e.unget(n),wt.setState(I)),!0}function K(e){var n=e.matchUntil(\">\");return n=n.replace(/\\u0000/g,\"�\"),e.char(),wt._emitToken({type:\"Comment\",data:n}),wt.setState(t),!0}function Q(e){var t=e.shift(2);if(t===\"--\")wt._currentToken={type:\"Comment\",data:\"\"},wt.setState(Y);else{var n=e.shift(5);if(n===o.EOF||t===o.EOF)return wt._parseError(\"expected-dashes-or-doctype\"),wt.setState(K),e.unget(t),!0;t+=n,t.toUpperCase()===\"DOCTYPE\"?(wt._currentToken={type:\"Doctype\",name:\"\",publicId:null,systemId:null,forceQuirks:!1},wt.setState(it)):wt._tokenHandler.isCdataSectionAllowed()&&t===\"[CDATA[\"?wt.setState(G):(wt._parseError(\"expected-dashes-or-doctype\"),e.unget(t),wt.setState(K))}return!0}function G(e){var n=e.matchUntil(\"]]>\");return e.shift(3),n&&wt._emitToken({type:\"Characters\",data:n}),wt.setState(t),!0}function Y(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\"-\"?wt.setState(Z):n===\">\"?(wt._parseError(\"incorrect-comment\"),wt._emitToken(wt._currentToken),wt.setState(t)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data+=\"�\"):(wt._currentToken.data+=n,wt.setState(et)),!0}function Z(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\"-\"?wt.setState(nt):n===\">\"?(wt._parseError(\"incorrect-comment\"),wt._emitToken(wt._currentToken),wt.setState(t)):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data+=\"�\"):(wt._currentToken.data+=\"-\"+n,wt.setState(et)),!0}function et(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\"-\"?wt.setState(tt):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data+=\"�\"):(wt._currentToken.data+=n,e.commit()),!0}function tt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment-end-dash\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\"-\"?wt.setState(nt):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data+=\"-�\",wt.setState(et)):(wt._currentToken.data+=\"-\"+n+e.matchUntil(\"\\0|-\"),e.char()),!0}function nt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment-double-dash\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\">\"?(wt._emitToken(wt._currentToken),wt.setState(t)):n===\"!\"?(wt._parseError(\"unexpected-bang-after-double-dash-in-comment\"),wt.setState(rt)):n===\"-\"?(wt._parseError(\"unexpected-dash-after-double-dash-in-comment\"),wt._currentToken.data+=n):n===\"\\0\"?(wt._parseError(\"invalid-codepoint\"),wt._currentToken.data+=\"--�\",wt.setState(et)):(wt._parseError(\"unexpected-char-in-comment\"),wt._currentToken.data+=\"--\"+n,wt.setState(et)),!0}function rt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-comment-end-bang-state\"),wt._emitToken(wt._currentToken),e.unget(n),wt.setState(t)):n===\">\"?(wt._emitToken(wt._currentToken),wt.setState(t)):n===\"-\"?(wt._currentToken.data+=\"--!\",wt.setState(tt)):(wt._currentToken.data+=\"--!\"+n,wt.setState(et)),!0}function it(e){var n=e.char();return n===o.EOF?(wt._parseError(\"expected-doctype-name-but-got-eof\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):r(n)?wt.setState(st):(wt._parseError(\"need-space-after-doctype\"),e.unget(n),wt.setState(st)),!0}function st(e){var n=e.char();return n===o.EOF?(wt._parseError(\"expected-doctype-name-but-got-eof\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):r(n)||(n===\">\"?(wt._parseError(\"expected-doctype-name-but-got-right-bracket\"),wt._currentToken.forceQuirks=!0,wt.setState(t),wt._emitCurrentToken()):(i(n)&&(n=n.toLowerCase()),wt._currentToken.name=n,wt.setState(ot))),!0}function ot(e){var n=e.char();return n===o.EOF?(wt._currentToken.forceQuirks=!0,e.unget(n),wt._parseError(\"eof-in-doctype-name\"),wt.setState(t),wt._emitCurrentToken()):r(n)?wt.setState(ut):n===\">\"?(wt.setState(t),wt._emitCurrentToken()):(i(n)&&(n=n.toLowerCase()),wt._currentToken.name+=n,e.commit()),!0}function ut(e){var n=e.char();if(n===o.EOF)wt._currentToken.forceQuirks=!0,e.unget(n),wt._parseError(\"eof-in-doctype\"),wt.setState(t),wt._emitCurrentToken();else if(!r(n))if(n===\">\")wt.setState(t),wt._emitCurrentToken();else{if([\"p\",\"P\"].indexOf(n)>-1){var i=[[\"u\",\"U\"],[\"b\",\"B\"],[\"l\",\"L\"],[\"i\",\"I\"],[\"c\",\"C\"]],s=i.every(function(t){return n=e.char(),t.indexOf(n)>-1});if(s)return wt.setState(at),!0}else if([\"s\",\"S\"].indexOf(n)>-1){var i=[[\"y\",\"Y\"],[\"s\",\"S\"],[\"t\",\"T\"],[\"e\",\"E\"],[\"m\",\"M\"]],s=i.every(function(t){return n=e.char(),t.indexOf(n)>-1});if(s)return wt.setState(dt),!0}e.unget(n),wt._currentToken.forceQuirks=!0,n===o.EOF?(wt._parseError(\"eof-in-doctype\"),e.unget(n),wt.setState(t),wt._emitCurrentToken()):(wt._parseError(\"expected-space-or-right-bracket-in-doctype\",{data:n}),wt.setState(bt))}return!0}function at(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):r(n)?wt.setState(ft):n===\"'\"||n==='\"'?(wt._parseError(\"unexpected-char-in-doctype\"),e.unget(n),wt.setState(ft)):(e.unget(n),wt.setState(ft)),!0}function ft(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):r(n)||(n==='\"'?(wt._currentToken.publicId=\"\",wt.setState(lt)):n===\"'\"?(wt._currentToken.publicId=\"\",wt.setState(ct)):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(t),wt._emitCurrentToken()):(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(bt))),!0}function lt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):n==='\"'?wt.setState(ht):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(t),wt._emitCurrentToken()):wt._currentToken.publicId+=n,!0}function ct(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,e.unget(n),wt.setState(t),wt._emitCurrentToken()):n===\"'\"?wt.setState(ht):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(t),wt._emitCurrentToken()):wt._currentToken.publicId+=n,!0}function ht(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):r(n)?wt.setState(pt):n===\">\"?(wt.setState(t),wt._emitCurrentToken()):n==='\"'?(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.systemId=\"\",wt.setState(mt)):n===\"'\"?(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.systemId=\"\",wt.setState(gt)):(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(bt)),!0}function pt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):r(n)||(n===\">\"?(wt._emitCurrentToken(),wt.setState(t)):n==='\"'?(wt._currentToken.systemId=\"\",wt.setState(mt)):n===\"'\"?(wt._currentToken.systemId=\"\",wt.setState(gt)):(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(bt))),!0}function dt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):r(n)?wt.setState(vt):n===\"'\"||n==='\"'?(wt._parseError(\"unexpected-char-in-doctype\"),e.unget(n),wt.setState(vt)):(e.unget(n),wt.setState(vt)),!0}function vt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):r(n)||(n==='\"'?(wt._currentToken.systemId=\"\",wt.setState(mt)):n===\"'\"?(wt._currentToken.systemId=\"\",wt.setState(gt)):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),wt.setState(t)):(wt._parseError(\"unexpected-char-in-doctype\"),wt._currentToken.forceQuirks=!0,wt.setState(bt))),!0}function mt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):n==='\"'?wt.setState(yt):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),wt.setState(t)):wt._currentToken.systemId+=n,!0}function gt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):n===\"'\"?wt.setState(yt):n===\">\"?(wt._parseError(\"unexpected-end-of-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),wt.setState(t)):wt._currentToken.systemId+=n,!0}function yt(e){var n=e.char();return n===o.EOF?(wt._parseError(\"eof-in-doctype\"),wt._currentToken.forceQuirks=!0,wt._emitCurrentToken(),e.unget(n),wt.setState(t)):r(n)||(n===\">\"?(wt._emitCurrentToken(),wt.setState(t)):(wt._parseError(\"unexpected-char-in-doctype\"),wt.setState(bt))),!0}function bt(e){var n=e.char();return n===o.EOF?(e.unget(n),wt._emitCurrentToken(),wt.setState(t)):n===\">\"&&(wt._emitCurrentToken(),wt.setState(t)),!0}s.DATA=t,s.RCDATA=a,s.RAWTEXT=l,s.SCRIPT_DATA=h,s.PLAINTEXT=c,this._state=s.DATA,this._inputStream.append(e),this._tokenHandler.startTokenization(this),this._inputStream.eof=!0;var wt=this;while(this._state.call(this,this._inputStream));},Object.defineProperty(s.prototype,\"lineNumber\",{get:function(){return this._inputStream.location().line}}),Object.defineProperty(s.prototype,\"columnNumber\",{get:function(){return this._inputStream.location().column}}),n.Tokenizer=s},{\"./EntityParser\":2,\"./InputStream\":3}],6:[function(e,t,n){function r(e){return e===\" \"||e===\"\\n\"||e===\"\t\"||e===\"\\r\"||e===\"\\f\"}function i(e){return r(e)||e===\"�\"}function s(e){for(var t=0;t<e.length;t++){var n=e[t];if(!r(n))return!1}return!0}function o(e){for(var t=0;t<e.length;t++){var n=e[t];if(!i(n))return!1}return!0}function u(e,t){for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n];if(r.nodeName===t)return r}return null}function a(e){this.characters=e,this.current=0,this.end=this.characters.length}function f(){this.tokenizer=null,this.errorHandler=null,this.scriptingEnabled=!1,this.document=null,this.head=null,this.form=null,this.openElements=new m,this.activeFormattingElements=[],this.insertionMode=null,this.insertionModeName=\"\",this.originalInsertionMode=\"\",this.inQuirksMode=!1,this.compatMode=\"no quirks\",this.framesetOk=!0,this.redirectAttachToFosterParent=!1,this.selfClosingFlagAcknowledged=!1,this.context=\"\",this.pendingTableCharacters=[],this.shouldSkipLeadingNewline=!1;var e=this,t=this.insertionModes={};t.base={end_tag_handlers:{\"-default\":\"endTagOther\"},start_tag_handlers:{\"-default\":\"startTagOther\"},processEOF:function(){e.generateImpliedEndTags(),e.openElements.length>2?e.parseError(\"expected-closing-tag-but-got-eof\"):e.openElements.length==2&&e.openElements.item(1).localName!=\"body\"?e.parseError(\"expected-closing-tag-but-got-eof\"):e.context&&e.openElements.length>1},processComment:function(t){e.insertComment(t,e.currentStackItem().node)},processDoctype:function(t,n,r,i){e.parseError(\"unexpected-doctype\")},processStartTag:function(e,t,n){if(this[this.start_tag_handlers[e]])this[this.start_tag_handlers[e]](e,t,n);else{if(!this[this.start_tag_handlers[\"-default\"]])throw new Error(\"No handler found for \"+e);this[this.start_tag_handlers[\"-default\"]](e,t,n)}},processEndTag:function(e){if(this[this.end_tag_handlers[e]])this[this.end_tag_handlers[e]](e);else{if(!this[this.end_tag_handlers[\"-default\"]])throw new Error(\"No handler found for \"+e);this[this.end_tag_handlers[\"-default\"]](e)}},startTagHtml:function(e,n){t.inBody.startTagHtml(e,n)}},t.initial=Object.create(t.base),t.initial.processEOF=function(){e.parseError(\"expected-doctype-but-got-eof\"),this.anythingElse(),e.insertionMode.processEOF()},t.initial.processComment=function(t){e.insertComment(t,e.document)},t.initial.processDoctype=function(t,n,r,i){function s(e){return n.toLowerCase().indexOf(e)===0}e.insertDoctype(t||\"\",n||\"\",r||\"\"),i||t!=\"html\"||n!=null&&([\"+//silmaril//dtd html pro v0r11 19970101//\",\"-//advasoft ltd//dtd html 3.0 aswedit + extensions//\",\"-//as//dtd html 3.0 aswedit + extensions//\",\"-//ietf//dtd html 2.0 level 1//\",\"-//ietf//dtd html 2.0 level 2//\",\"-//ietf//dtd html 2.0 strict level 1//\",\"-//ietf//dtd html 2.0 strict level 2//\",\"-//ietf//dtd html 2.0 strict//\",\"-//ietf//dtd html 2.0//\",\"-//ietf//dtd html 2.1e//\",\"-//ietf//dtd html 3.0//\",\"-//ietf//dtd html 3.0//\",\"-//ietf//dtd html 3.2 final//\",\"-//ietf//dtd html 3.2//\",\"-//ietf//dtd html 3//\",\"-//ietf//dtd html level 0//\",\"-//ietf//dtd html level 0//\",\"-//ietf//dtd html level 1//\",\"-//ietf//dtd html level 1//\",\"-//ietf//dtd html level 2//\",\"-//ietf//dtd html level 2//\",\"-//ietf//dtd html level 3//\",\"-//ietf//dtd html level 3//\",\"-//ietf//dtd html strict level 0//\",\"-//ietf//dtd html strict level 0//\",\"-//ietf//dtd html strict level 1//\",\"-//ietf//dtd html strict level 1//\",\"-//ietf//dtd html strict level 2//\",\"-//ietf//dtd html strict level 2//\",\"-//ietf//dtd html strict level 3//\",\"-//ietf//dtd html strict level 3//\",\"-//ietf//dtd html strict//\",\"-//ietf//dtd html strict//\",\"-//ietf//dtd html strict//\",\"-//ietf//dtd html//\",\"-//ietf//dtd html//\",\"-//ietf//dtd html//\",\"-//metrius//dtd metrius presentational//\",\"-//microsoft//dtd internet explorer 2.0 html strict//\",\"-//microsoft//dtd internet explorer 2.0 html//\",\"-//microsoft//dtd internet explorer 2.0 tables//\",\"-//microsoft//dtd internet explorer 3.0 html strict//\",\"-//microsoft//dtd internet explorer 3.0 html//\",\"-//microsoft//dtd internet explorer 3.0 tables//\",\"-//netscape comm. corp.//dtd html//\",\"-//netscape comm. corp.//dtd strict html//\",\"-//o'reilly and associates//dtd html 2.0//\",\"-//o'reilly and associates//dtd html extended 1.0//\",\"-//spyglass//dtd html 2.0 extended//\",\"-//sq//dtd html 2.0 hotmetal + extensions//\",\"-//sun microsystems corp.//dtd hotjava html//\",\"-//sun microsystems corp.//dtd hotjava strict html//\",\"-//w3c//dtd html 3 1995-03-24//\",\"-//w3c//dtd html 3.2 draft//\",\"-//w3c//dtd html 3.2 final//\",\"-//w3c//dtd html 3.2//\",\"-//w3c//dtd html 3.2s draft//\",\"-//w3c//dtd html 4.0 frameset//\",\"-//w3c//dtd html 4.0 transitional//\",\"-//w3c//dtd html experimental 19960712//\",\"-//w3c//dtd html experimental 970421//\",\"-//w3c//dtd w3 html//\",\"-//w3o//dtd w3 html 3.0//\",\"-//webtechs//dtd mozilla html 2.0//\",\"-//webtechs//dtd mozilla html//\",\"html\"].some(s)||[\"-//w3o//dtd w3 html strict 3.0//en//\",\"-/w3c/dtd html 4.0 transitional/en\",\"html\"].indexOf(n.toLowerCase())>-1||r==null&&[\"-//w3c//dtd html 4.01 transitional//\",\"-//w3c//dtd html 4.01 frameset//\"].some(s))||r!=null&&r.toLowerCase()==\"http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd\"?(e.compatMode=\"quirks\",e.parseError(\"quirky-doctype\")):n!=null&&([\"-//w3c//dtd xhtml 1.0 transitional//\",\"-//w3c//dtd xhtml 1.0 frameset//\"].some(s)||r!=null&&[\"-//w3c//dtd html 4.01 transitional//\",\"-//w3c//dtd html 4.01 frameset//\"].indexOf(n.toLowerCase())>-1)?(e.compatMode=\"limited quirks\",e.parseError(\"almost-standards-doctype\")):n==\"-//W3C//DTD HTML 4.0//EN\"&&(r==null||r==\"http://www.w3.org/TR/REC-html40/strict.dtd\")||n==\"-//W3C//DTD HTML 4.01//EN\"&&(r==null||r==\"http://www.w3.org/TR/html4/strict.dtd\")||n==\"-//W3C//DTD XHTML 1.0 Strict//EN\"&&r==\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"||n==\"-//W3C//DTD XHTML 1.1//EN\"&&r==\"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\"||(r!=null&&r!=\"about:legacy-compat\"||n!=null)&&e.parseError(\"unknown-doctype\"),e.setInsertionMode(\"beforeHTML\")},t.initial.processCharacters=function(t){t.skipLeadingWhitespace();if(!t.length)return;e.parseError(\"expected-doctype-but-got-chars\"),this.anythingElse(),e.insertionMode.processCharacters(t)},t.initial.processStartTag=function(t,n,r){e.parseError(\"expected-doctype-but-got-start-tag\",{name:t}),this.anythingElse(),e.insertionMode.processStartTag(t,n,r)},t.initial.processEndTag=function(t){e.parseError(\"expected-doctype-but-got-end-tag\",{name:t}),this.anythingElse(),e.insertionMode.processEndTag(t)},t.initial.anythingElse=function(){e.compatMode=\"quirks\",e.setInsertionMode(\"beforeHTML\")},t.beforeHTML=Object.create(t.base),t.beforeHTML.start_tag_handlers={html:\"startTagHtml\",\"-default\":\"startTagOther\"},t.beforeHTML.processEOF=function(){this.anythingElse(),e.insertionMode.processEOF()},t.beforeHTML.processComment=function(t){e.insertComment(t,e.document)},t.beforeHTML.processCharacters=function(t){t.skipLeadingWhitespace();if(!t.length)return;this.anythingElse(),e.insertionMode.processCharacters(t)},t.beforeHTML.startTagHtml=function(t,n,r){e.insertHtmlElement(n),e.setInsertionMode(\"beforeHead\")},t.beforeHTML.startTagOther=function(t,n,r){this.anythingElse(),e.insertionMode.processStartTag(t,n,r)},t.beforeHTML.processEndTag=function(t){this.anythingElse(),e.insertionMode.processEndTag(t)},t.beforeHTML.anythingElse=function(){e.insertHtmlElement(),e.setInsertionMode(\"beforeHead\")},t.afterAfterBody=Object.create(t.base),t.afterAfterBody.start_tag_handlers={html:\"startTagHtml\",\"-default\":\"startTagOther\"},t.afterAfterBody.processComment=function(t){e.insertComment(t,e.document)},t.afterAfterBody.processDoctype=function(e){t.inBody.processDoctype(e)},t.afterAfterBody.startTagHtml=function(e,n){t.inBody.startTagHtml(e,n)},t.afterAfterBody.startTagOther=function(t,n,r){e.parseError(\"unexpected-start-tag\",{name:t}),e.setInsertionMode(\"inBody\"),e.insertionMode.processStartTag(t,n,r)},t.afterAfterBody.endTagOther=function(t){e.parseError(\"unexpected-end-tag\",{name:t}),e.setInsertionMode(\"inBody\"),e.insertionMode.processEndTag(t)},t.afterAfterBody.processCharacters=function(n){if(!s(n.characters))return e.parseError(\"unexpected-char-after-body\"),e.setInsertionMode(\"inBody\"),e.insertionMode.processCharacters(n);t.inBody.processCharacters(n)},t.afterBody=Object.create(t.base),t.afterBody.end_tag_handlers={html:\"endTagHtml\",\"-default\":\"endTagOther\"},t.afterBody.processComment=function(t){e.insertComment(t,e.openElements.rootNode)},t.afterBody.processCharacters=function(n){if(!s(n.characters))return e.parseError(\"unexpected-char-after-body\"),e.setInsertionMode(\"inBody\"),e.insertionMode.processCharacters(n);t.inBody.processCharacters(n)},t.afterBody.processStartTag=function(t,n,r){e.parseError(\"unexpected-start-tag-after-body\",{name:t}),e.setInsertionMode(\"inBody\"),e.insertionMode.processStartTag(t,n,r)},t.afterBody.endTagHtml=function(t){e.context?e.parseError(\"end-html-in-innerhtml\"):e.setInsertionMode(\"afterAfterBody\")},t.afterBody.endTagOther=function(t){e.parseError(\"unexpected-end-tag-after-body\",{name:t}),e.setInsertionMode(\"inBody\"),e.insertionMode.processEndTag(t)},t.afterFrameset=Object.create(t.base),t.afterFrameset.start_tag_handlers={html:\"startTagHtml\",noframes:\"startTagNoframes\",\"-default\":\"startTagOther\"},t.afterFrameset.end_tag_handlers={html:\"endTagHtml\",\"-default\":\"endTagOther\"},t.afterFrameset.processCharacters=function(t){var n=t.takeRemaining(),i=\"\";for(var s=0;s<n.length;s++){var o=n[s];r(o)&&(i+=o)}i&&e.insertText(i),i.length<n.length&&e.parseError(\"expected-eof-but-got-char\")},t.afterFrameset.startTagNoframes=function(e,n){t.inHead.processStartTag(e,n)},t.afterFrameset.startTagOther=function(t,n){e.parseError(\"unexpected-start-tag-after-frameset\",{name:t})},t.afterFrameset.endTagHtml=function(t){e.setInsertionMode(\"afterAfterFrameset\")},t.afterFrameset.endTagOther=function(t){e.parseError(\"unexpected-end-tag-after-frameset\",{name:t})},t.beforeHead=Object.create(t.base),t.beforeHead.start_tag_handlers={html:\"startTagHtml\",head:\"startTagHead\",\"-default\":\"startTagOther\"},t.beforeHead.end_tag_handlers={html:\"endTagImplyHead\",head:\"endTagImplyHead\",body:\"endTagImplyHead\",br:\"endTagImplyHead\",\"-default\":\"endTagOther\"},t.beforeHead.processEOF=function(){this.startTagHead(\"head\",[]),e.insertionMode.processEOF()},t.beforeHead.processCharacters=function(t){t.skipLeadingWhitespace();if(!t.length)return;this.startTagHead(\"head\",[]),e.insertionMode.processCharacters(t)},t.beforeHead.startTagHead=function(t,n){e.insertHeadElement(n),e.setInsertionMode(\"inHead\")},t.beforeHead.startTagOther=function(t,n,r){this.startTagHead(\"head\",[]),e.insertionMode.processStartTag(t,n,r)},t.beforeHead.endTagImplyHead=function(t){this.startTagHead(\"head\",[]),e.insertionMode.processEndTag(t)},t.beforeHead.endTagOther=function(t){e.parseError(\"end-tag-after-implied-root\",{name:t})},t.inHead=Object.create(t.base),t.inHead.start_tag_handlers={html:\"startTagHtml\",head:\"startTagHead\",title:\"startTagTitle\",script:\"startTagScript\",style:\"startTagNoFramesStyle\",noscript:\"startTagNoScript\",noframes:\"startTagNoFramesStyle\",base:\"startTagBaseBasefontBgsoundLink\",basefont:\"startTagBaseBasefontBgsoundLink\",bgsound:\"startTagBaseBasefontBgsoundLink\",link:\"startTagBaseBasefontBgsoundLink\",meta:\"startTagMeta\",\"-default\":\"startTagOther\"},t.inHead.end_tag_handlers={head:\"endTagHead\",html:\"endTagHtmlBodyBr\",body:\"endTagHtmlBodyBr\",br:\"endTagHtmlBodyBr\",\"-default\":\"endTagOther\"},t.inHead.processEOF=function(){var t=e.currentStackItem().localName;[\"title\",\"style\",\"script\"].indexOf(t)!=-1&&(e.parseError(\"expected-named-closing-tag-but-got-eof\",{name:t}),e.popElement()),this.anythingElse(),e.insertionMode.processEOF()},t.inHead.processCharacters=function(t){var n=t.takeLeadingWhitespace();n&&e.insertText(n);if(!t.length)return;this.anythingElse(),e.insertionMode.processCharacters(t)},t.inHead.startTagHtml=function(e,n){t.inBody.processStartTag(e,n)},t.inHead.startTagHead=function(t,n){e.parseError(\"two-heads-are-not-better-than-one\")},t.inHead.startTagTitle=function(t,n){e.processGenericRCDATAStartTag(t,n)},t.inHead.startTagNoScript=function(t,n){if(e.scriptingEnabled)return e.processGenericRawTextStartTag(t,n);e.insertElement(t,n),e.setInsertionMode(\"inHeadNoscript\")},t.inHead.startTagNoFramesStyle=function(t,n){e.processGenericRawTextStartTag(t,n)},t.inHead.startTagScript=function(t,n){e.insertElement(t,n),e.tokenizer.setState(v.SCRIPT_DATA),e.originalInsertionMode=e.insertionModeName,e.setInsertionMode(\"text\")},t.inHead.startTagBaseBasefontBgsoundLink=function(t,n){e.insertSelfClosingElement(t,n)},t.inHead.startTagMeta=function(t,n){e.insertSelfClosingElement(t,n)},t.inHead.startTagOther=function(t,n,r){this.anythingElse(),e.insertionMode.processStartTag(t,n,r)},t.inHead.endTagHead=function(t){e.openElements.item(e.openElements.length-1).localName==\"head\"?e.openElements.pop():e.parseError(\"unexpected-end-tag\",{name:\"head\"}),e.setInsertionMode(\"afterHead\")},t.inHead.endTagHtmlBodyBr=function(t){this.anythingElse(),e.insertionMode.processEndTag(t)},t.inHead.endTagOther=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.inHead.anythingElse=function(){this.endTagHead(\"head\")},t.afterHead=Object.create(t.base),t.afterHead.start_tag_handlers={html:\"startTagHtml\",head:\"startTagHead\",body:\"startTagBody\",frameset:\"startTagFrameset\",base:\"startTagFromHead\",link:\"startTagFromHead\",meta:\"startTagFromHead\",script:\"startTagFromHead\",style:\"startTagFromHead\",title:\"startTagFromHead\",\"-default\":\"startTagOther\"},t.afterHead.end_tag_handlers={body:\"endTagBodyHtmlBr\",html:\"endTagBodyHtmlBr\",br:\"endTagBodyHtmlBr\",\"-default\":\"endTagOther\"},t.afterHead.processEOF=function(){this.anythingElse(),e.insertionMode.processEOF()},t.afterHead.processCharacters=function(t){var n=t.takeLeadingWhitespace();n&&e.insertText(n);if(!t.length)return;this.anythingElse(),e.insertionMode.processCharacters(t)},t.afterHead.startTagHtml=function(e,n){t.inBody.processStartTag(e,n)},t.afterHead.startTagBody=function(t,n){e.framesetOk=!1,e.insertBodyElement(n),e.setInsertionMode(\"inBody\")},t.afterHead.startTagFrameset=function(t,n){e.insertElement(t,n),e.setInsertionMode(\"inFrameset\")},t.afterHead.startTagFromHead=function(n,r,i){e.parseError(\"unexpected-start-tag-out-of-my-head\",{name:n}),e.openElements.push(e.head),t.inHead.processStartTag(n,r,i),e.openElements.remove(e.head)},t.afterHead.startTagHead=function(t,n,r){e.parseError(\"unexpected-start-tag\",{name:t})},t.afterHead.startTagOther=function(t,n,r){this.anythingElse(),e.insertionMode.processStartTag(t,n,r)},t.afterHead.endTagBodyHtmlBr=function(t){this.anythingElse(),e.insertionMode.processEndTag(t)},t.afterHead.endTagOther=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.afterHead.anythingElse=function(){e.insertBodyElement([]),e.setInsertionMode(\"inBody\"),e.framesetOk=!0},t.inBody=Object.create(t.base),t.inBody.start_tag_handlers={html:\"startTagHtml\",head:\"startTagMisplaced\",base:\"startTagProcessInHead\",basefont:\"startTagProcessInHead\",bgsound:\"startTagProcessInHead\",link:\"startTagProcessInHead\",meta:\"startTagProcessInHead\",noframes:\"startTagProcessInHead\",script:\"startTagProcessInHead\",style:\"startTagProcessInHead\",title:\"startTagProcessInHead\",body:\"startTagBody\",form:\"startTagForm\",plaintext:\"startTagPlaintext\",a:\"startTagA\",button:\"startTagButton\",xmp:\"startTagXmp\",table:\"startTagTable\",hr:\"startTagHr\",image:\"startTagImage\",input:\"startTagInput\",textarea:\"startTagTextarea\",select:\"startTagSelect\",isindex:\"startTagIsindex\",applet:\"startTagAppletMarqueeObject\",marquee:\"startTagAppletMarqueeObject\",object:\"startTagAppletMarqueeObject\",li:\"startTagListItem\",dd:\"startTagListItem\",dt:\"startTagListItem\",address:\"startTagCloseP\",article:\"startTagCloseP\",aside:\"startTagCloseP\",blockquote:\"startTagCloseP\",center:\"startTagCloseP\",details:\"startTagCloseP\",dir:\"startTagCloseP\",div:\"startTagCloseP\",dl:\"startTagCloseP\",fieldset:\"startTagCloseP\",figcaption:\"startTagCloseP\",figure:\"startTagCloseP\",footer:\"startTagCloseP\",header:\"startTagCloseP\",hgroup:\"startTagCloseP\",main:\"startTagCloseP\",menu:\"startTagCloseP\",nav:\"startTagCloseP\",ol:\"startTagCloseP\",p:\"startTagCloseP\",section:\"startTagCloseP\",summary:\"startTagCloseP\",ul:\"startTagCloseP\",listing:\"startTagPreListing\",pre:\"startTagPreListing\",b:\"startTagFormatting\",big:\"startTagFormatting\",code:\"startTagFormatting\",em:\"startTagFormatting\",font:\"startTagFormatting\",i:\"startTagFormatting\",s:\"startTagFormatting\",small:\"startTagFormatting\",strike:\"startTagFormatting\",strong:\"startTagFormatting\",tt:\"startTagFormatting\",u:\"startTagFormatting\",nobr:\"startTagNobr\",area:\"startTagVoidFormatting\",br:\"startTagVoidFormatting\",embed:\"startTagVoidFormatting\",img:\"startTagVoidFormatting\",keygen:\"startTagVoidFormatting\",wbr:\"startTagVoidFormatting\",param:\"startTagParamSourceTrack\",source:\"startTagParamSourceTrack\",track:\"startTagParamSourceTrack\",iframe:\"startTagIFrame\",noembed:\"startTagRawText\",noscript:\"startTagRawText\",h1:\"startTagHeading\",h2:\"startTagHeading\",h3:\"startTagHeading\",h4:\"startTagHeading\",h5:\"startTagHeading\",h6:\"startTagHeading\",caption:\"startTagMisplaced\",col:\"startTagMisplaced\",colgroup:\"startTagMisplaced\",frame:\"startTagMisplaced\",frameset:\"startTagFrameset\",tbody:\"startTagMisplaced\",td:\"startTagMisplaced\",tfoot:\"startTagMisplaced\",th:\"startTagMisplaced\",thead:\"startTagMisplaced\",tr:\"startTagMisplaced\",option:\"startTagOptionOptgroup\",optgroup:\"startTagOptionOptgroup\",math:\"startTagMath\",svg:\"startTagSVG\",rt:\"startTagRpRt\",rp:\"startTagRpRt\",\"-default\":\"startTagOther\"},t.inBody.end_tag_handlers={p:\"endTagP\",body:\"endTagBody\",html:\"endTagHtml\",address:\"endTagBlock\",article:\"endTagBlock\",aside:\"endTagBlock\",blockquote:\"endTagBlock\",button:\"endTagBlock\",center:\"endTagBlock\",details:\"endTagBlock\",dir:\"endTagBlock\",div:\"endTagBlock\",dl:\"endTagBlock\",fieldset:\"endTagBlock\",figcaption:\"endTagBlock\",figure:\"endTagBlock\",footer:\"endTagBlock\",header:\"endTagBlock\",hgroup:\"endTagBlock\",listing:\"endTagBlock\",main:\"endTagBlock\",menu:\"endTagBlock\",nav:\"endTagBlock\",ol:\"endTagBlock\",pre:\"endTagBlock\",section:\"endTagBlock\",summary:\"endTagBlock\",ul:\"endTagBlock\",form:\"endTagForm\",applet:\"endTagAppletMarqueeObject\",marquee:\"endTagAppletMarqueeObject\",object:\"endTagAppletMarqueeObject\",dd:\"endTagListItem\",dt:\"endTagListItem\",li:\"endTagListItem\",h1:\"endTagHeading\",h2:\"endTagHeading\",h3:\"endTagHeading\",h4:\"endTagHeading\",h5:\"endTagHeading\",h6:\"endTagHeading\",a:\"endTagFormatting\",b:\"endTagFormatting\",big:\"endTagFormatting\",code:\"endTagFormatting\",em:\"endTagFormatting\",font:\"endTagFormatting\",i:\"endTagFormatting\",nobr:\"endTagFormatting\",s:\"endTagFormatting\",small:\"endTagFormatting\",strike:\"endTagFormatting\",strong:\"endTagFormatting\",tt:\"endTagFormatting\",u:\"endTagFormatting\",br:\"endTagBr\",\"-default\":\"endTagOther\"},t.inBody.processCharacters=function(t){e.shouldSkipLeadingNewline&&(e.shouldSkipLeadingNewline=!1,t.skipAtMostOneLeadingNewline()),e.reconstructActiveFormattingElements();var n=t.takeRemaining();n=n.replace(/\\u0000/g,function(t,n){return e.parseError(\"invalid-codepoint\"),\"\"});if(!n)return;e.insertText(n),e.framesetOk&&!o(n)&&(e.framesetOk=!1)},t.inBody.startTagHtml=function(t,n){e.parseError(\"non-html-root\"),e.addAttributesToElement(e.openElements.rootNode,n)},t.inBody.startTagProcessInHead=function(e,n){t.inHead.processStartTag(e,n)},t.inBody.startTagBody=function(t,n){e.parseError(\"unexpected-start-tag\",{name:\"body\"}),e.openElements.length==1||e.openElements.item(1).localName!=\"body\"?c.ok(e.context):(e.framesetOk=!1,e.addAttributesToElement(e.openElements.bodyElement,n))},t.inBody.startTagFrameset=function(t,n){e.parseError(\"unexpected-start-tag\",{name:\"frameset\"});if(e.openElements.length==1||e.openElements.item(1).localName!=\"body\")c.ok(e.context);else if(e.framesetOk){e.detachFromParent(e.openElements.bodyElement);while(e.openElements.length>1)e.openElements.pop();e.insertElement(t,n),e.setInsertionMode(\"inFrameset\")}},t.inBody.startTagCloseP=function(t,n){e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertElement(t,n)},t.inBody.startTagPreListing=function(t,n){e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertElement(t,n),e.framesetOk=!1,e.shouldSkipLeadingNewline=!0},t.inBody.startTagForm=function(t,n){e.form?e.parseError(\"unexpected-start-tag\",{name:t}):(e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertElement(t,n),e.form=e.currentStackItem())},t.inBody.startTagRpRt=function(t,n){e.openElements.inScope(\"ruby\")&&(e.generateImpliedEndTags(),e.currentStackItem().localName!=\"ruby\"&&e.parseError(\"unexpected-start-tag\",{name:t})),e.insertElement(t,n)},t.inBody.startTagListItem=function(t,n){var r={li:[\"li\"],dd:[\"dd\",\"dt\"],dt:[\"dd\",\"dt\"]},i=r[t],s=e.openElements;for(var o=s.length-1;o>=0;o--){var u=s.item(o);if(i.indexOf(u.localName)!=-1){e.insertionMode.processEndTag(u.localName);break}if(u.isSpecial()&&u.localName!==\"p\"&&u.localName!==\"address\"&&u.localName!==\"div\")break}e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertElement(t,n),e.framesetOk=!1},t.inBody.startTagPlaintext=function(t,n){e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertElement(t,n),e.tokenizer.setState(v.PLAINTEXT)},t.inBody.startTagHeading=function(t,n){e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.currentStackItem().isNumberedHeader()&&(e.parseError(\"unexpected-start-tag\",{name:t}),e.popElement()),e.insertElement(t,n)},t.inBody.startTagA=function(t,n){var r=e.elementInActiveFormattingElements(\"a\");r&&(e.parseError(\"unexpected-start-tag-implies-end-tag\",{startName:\"a\",endName:\"a\"}),e.adoptionAgencyEndTag(\"a\"),e.openElements.contains(r)&&e.openElements.remove(r),e.removeElementFromActiveFormattingElements(r)),e.reconstructActiveFormattingElements(),e.insertFormattingElement(t,n)},t.inBody.startTagFormatting=function(t,n){e.reconstructActiveFormattingElements(),e.insertFormattingElement(t,n)},t.inBody.startTagNobr=function(t,n){e.reconstructActiveFormattingElements(),e.openElements.inScope(\"nobr\")&&(e.parseError(\"unexpected-start-tag-implies-end-tag\",{startName:\"nobr\",endName:\"nobr\"}),this.processEndTag(\"nobr\"),e.reconstructActiveFormattingElements()),e.insertFormattingElement(t,n)},t.inBody.startTagButton=function(t,n){e.openElements.inScope(\"button\")?(e.parseError(\"unexpected-start-tag-implies-end-tag\",{startName:\"button\",endName:\"button\"}),this.processEndTag(\"button\"),e.insertionMode.processStartTag(t,n)):(e.framesetOk=!1,e.reconstructActiveFormattingElements(),e.insertElement(t,n))},t.inBody.startTagAppletMarqueeObject=function(t,n){e.reconstructActiveFormattingElements(),e.insertElement(t,n),e.activeFormattingElements.push(y),e.framesetOk=!1},t.inBody.endTagAppletMarqueeObject=function(t){e.openElements.inScope(t)?(e.generateImpliedEndTags(),e.currentStackItem().localName!=t&&e.parseError(\"end-tag-too-early\",{name:t}),e.openElements.popUntilPopped(t),e.clearActiveFormattingElements()):e.parseError(\"unexpected-end-tag\",{name:t})},t.inBody.startTagXmp=function(t,n){e.openElements.inButtonScope(\"p\")&&this.processEndTag(\"p\"),e.reconstructActiveFormattingElements(),e.processGenericRawTextStartTag(t,n),e.framesetOk=!1},t.inBody.startTagTable=function(t,n){e.compatMode!==\"quirks\"&&e.openElements.inButtonScope(\"p\")&&this.processEndTag(\"p\"),e.insertElement(t,n),e.setInsertionMode(\"inTable\"),e.framesetOk=!1},t.inBody.startTagVoidFormatting=function(t,n){e.reconstructActiveFormattingElements(),e.insertSelfClosingElement(t,n),e.framesetOk=!1},t.inBody.startTagParamSourceTrack=function(t,n){e.insertSelfClosingElement(t,n)},t.inBody.startTagHr=function(t,n){e.openElements.inButtonScope(\"p\")&&this.endTagP(\"p\"),e.insertSelfClosingElement(t,n),e.framesetOk=!1},t.inBody.startTagImage=function(t,n){e.parseError(\"unexpected-start-tag-treated-as\",{originalName:\"image\",newName:\"img\"}),this.processStartTag(\"img\",n)},t.inBody.startTagInput=function(t,n){var r=e.framesetOk;this.startTagVoidFormatting(t,n);for(var i in n)if(n[i].nodeName==\"type\"){n[i].nodeValue.toLowerCase()==\"hidden\"&&(e.framesetOk=r);break}},t.inBody.startTagIsindex=function(t,n){e.parseError(\"deprecated-tag\",{name:\"isindex\"}),e.selfClosingFlagAcknowledged=!0;if(e.form)return;var r=[],i=[],s=\"This is a searchable index. Enter search keywords: \";for(var o in n)switch(n[o].nodeName){case\"action\":r.push({nodeName:\"action\",nodeValue:n[o].nodeValue});break;case\"prompt\":s=n[o].nodeValue;break;case\"name\":break;default:i.push({nodeName:n[o].nodeName,nodeValue:n[o].nodeValue})}i.push({nodeName:\"name\",nodeValue:\"isindex\"}),this.processStartTag(\"form\",r),this.processStartTag(\"hr\"),this.processStartTag(\"label\"),this.processCharacters(new a(s)),this.processStartTag(\"input\",i),this.processEndTag(\"label\"),this.processStartTag(\"hr\"),this.processEndTag(\"form\")},t.inBody.startTagTextarea=function(t,n){e.insertElement(t,n),e.tokenizer.setState(v.RCDATA),e.originalInsertionMode=e.insertionModeName,e.shouldSkipLeadingNewline=!0,e.framesetOk=!1,e.setInsertionMode(\"text\")},t.inBody.startTagIFrame=function(t,n){e.framesetOk=!1,this.startTagRawText(t,n)},t.inBody.startTagRawText=function(t,n){e.processGenericRawTextStartTag(t,n)},t.inBody.startTagSelect=function(t,n){e.reconstructActiveFormattingElements(),e.insertElement(t,n),e.framesetOk=!1;var r=e.insertionModeName;r==\"inTable\"||r==\"inCaption\"||r==\"inColumnGroup\"||r==\"inTableBody\"||r==\"inRow\"||r==\"inCell\"?e.setInsertionMode(\"inSelectInTable\"):e.setInsertionMode(\"inSelect\")},t.inBody.startTagMisplaced=function(t,n){e.parseError(\"unexpected-start-tag-ignored\",{name:t})},t.inBody.endTagMisplaced=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.inBody.endTagBr=function(t){e.parseError(\"unexpected-end-tag-treated-as\",{originalName:\"br\",newName:\"br element\"}),e.reconstructActiveFormattingElements(),e.insertElement(t,[]),e.popElement()},t.inBody.startTagOptionOptgroup=function(t,n){e.currentStackItem().localName==\"option\"&&e.popElement(),e.reconstructActiveFormattingElements(),e.insertElement(t,n)},t.inBody.startTagOther=function(t,n){e.reconstructActiveFormattingElements(),e.insertElement(t,n)},t.inBody.endTagOther=function(t){var n;for(var r=e.openElements.length-1;r>0;r--){n=e.openElements.item(r);if(n.localName==t){e.generateImpliedEndTags(t),e.currentStackItem().localName!=t&&e.parseError(\"unexpected-end-tag\",{name:t}),e.openElements.remove_openElements_until(function(e){return e===n});break}if(n.isSpecial()){e.parseError(\"unexpected-end-tag\",{name:t});break}}},t.inBody.startTagMath=function(t,n,r){e.reconstructActiveFormattingElements(),n=e.adjustMathMLAttributes(n),n=e.adjustForeignAttributes(n),e.insertForeignElement(t,n,\"http://www.w3.org/1998/Math/MathML\",r)},t.inBody.startTagSVG=function(t,n,r){e.reconstructActiveFormattingElements(),n=e.adjustSVGAttributes(n),n=e.adjustForeignAttributes(n),e.insertForeignElement(t,n,\"http://www.w3.org/2000/svg\",r)},t.inBody.endTagP=function(t){e.openElements.inButtonScope(\"p\")?(e.generateImpliedEndTags(\"p\"),e.currentStackItem().localName!=\"p\"&&e.parseError(\"unexpected-implied-end-tag\",{name:\"p\"}),e.openElements.popUntilPopped(t)):(e.parseError(\"unexpected-end-tag\",{name:\"p\"}),this.startTagCloseP(\"p\",[]),this.endTagP(\"p\"))},t.inBody.endTagBody=function(t){if(!e.openElements.inScope(\"body\")){e.parseError(\"unexpected-end-tag\",{name:t});return}e.currentStackItem().localName!=\"body\"&&e.parseError(\"expected-one-end-tag-but-got-another\",{expectedName:e.currentStackItem().localName,gotName:t}),e.setInsertionMode(\"afterBody\")},t.inBody.endTagHtml=function(t){if(!e.openElements.inScope(\"body\")){e.parseError(\"unexpected-end-tag\",{name:t});return}e.currentStackItem().localName!=\"body\"&&e.parseError(\"expected-one-end-tag-but-got-another\",{expectedName:e.currentStackItem().localName,gotName:t}),e.setInsertionMode(\"afterBody\"),e.insertionMode.processEndTag(t)},t.inBody.endTagBlock=function(t){e.openElements.inScope(t)?(e.generateImpliedEndTags(),e.currentStackItem().localName!=t&&e.parseError(\"end-tag-too-early\",{name:t}),e.openElements.popUntilPopped(t)):e.parseError(\"unexpected-end-tag\",{name:t})},t.inBody.endTagForm=function(t){var n=e.form;e.form=null,!n||!e.openElements.inScope(t)?e.parseError(\"unexpected-end-tag\",{name:t}):(e.generateImpliedEndTags(),e.currentStackItem()!=n&&e.parseError(\"end-tag-too-early-ignored\",{name:\"form\"}),e.openElements.remove(n))},t.inBody.endTagListItem=function(t){e.openElements.inListItemScope(t)?(e.generateImpliedEndTags(t),e.currentStackItem().localName!=t&&e.parseError(\"end-tag-too-early\",{name:t}),e.openElements.popUntilPopped(t)):e.parseError(\"unexpected-end-tag\",{name:t})},t.inBody.endTagHeading=function(t){if(!e.openElements.hasNumberedHeaderElementInScope()){e.parseError(\"unexpected-end-tag\",{name:t});return}e.generateImpliedEndTags(),e.currentStackItem().localName!=t&&e.parseError(\"end-tag-too-early\",{name:t}),e.openElements.remove_openElements_until(function(e){return e.isNumberedHeader()})},t.inBody.endTagFormatting=function(t,n){e.adoptionAgencyEndTag(t)||this.endTagOther(t,n)},t.inCaption=Object.create(t.base),t.inCaption.start_tag_handlers={html:\"startTagHtml\",caption:\"startTagTableElement\",col:\"startTagTableElement\",colgroup:\"startTagTableElement\",tbody:\"startTagTableElement\",td:\"startTagTableElement\",tfoot:\"startTagTableElement\",thead:\"startTagTableElement\",tr:\"startTagTableElement\",\"-default\":\"startTagOther\"},t.inCaption.end_tag_handlers={caption:\"endTagCaption\",table:\"endTagTable\",body:\"endTagIgnore\",col:\"endTagIgnore\",colgroup:\"endTagIgnore\",html:\"endTagIgnore\",tbody:\"endTagIgnore\",td:\"endTagIgnore\",tfood:\"endTagIgnore\",thead:\"endTagIgnore\",tr:\"endTagIgnore\",\"-default\":\"endTagOther\"},t.inCaption.processCharacters=function(e){t.inBody.processCharacters(e)},t.inCaption.startTagTableElement=function(t,n){e.parseError(\"unexpected-end-tag\",{name:t});var r=!e.openElements.inTableScope(\"caption\");e.insertionMode.processEndTag(\"caption\"),r||e.insertionMode.processStartTag(t,n)},t.inCaption.startTagOther=function(e,n,r){t.inBody.processStartTag(e,n,r)},t.inCaption.endTagCaption=function(t){e.openElements.inTableScope(\"caption\")?(e.generateImpliedEndTags(),e.currentStackItem().localName!=\"caption\"&&e.parseError(\"expected-one-end-tag-but-got-another\",{gotName:\"caption\",expectedName:e.currentStackItem().localName}),e.openElements.popUntilPopped(\"caption\"),e.clearActiveFormattingElements(),e.setInsertionMode(\"inTable\")):(c.ok(e.context),e.parseError(\"unexpected-end-tag\",{name:t}))},t.inCaption.endTagTable=function(t){e.parseError(\"unexpected-end-table-in-caption\");var n=!e.openElements.inTableScope(\"caption\");e.insertionMode.processEndTag(\"caption\"),n||e.insertionMode.processEndTag(t)},t.inCaption.endTagIgnore=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.inCaption.endTagOther=function(e){t.inBody.processEndTag(e)},t.inCell=Object.create(t.base),t.inCell.start_tag_handlers={html:\"startTagHtml\",caption:\"startTagTableOther\",col:\"startTagTableOther\",colgroup:\"startTagTableOther\",tbody:\"startTagTableOther\",td:\"startTagTableOther\",tfoot:\"startTagTableOther\",th:\"startTagTableOther\",thead:\"startTagTableOther\",tr:\"startTagTableOther\",\"-default\":\"startTagOther\"},t.inCell.end_tag_handlers={td:\"endTagTableCell\",th:\"endTagTableCell\",body:\"endTagIgnore\",caption:\"endTagIgnore\",col:\"endTagIgnore\",colgroup:\"endTagIgnore\",html:\"endTagIgnore\",table:\"endTagImply\",tbody:\"endTagImply\",tfoot:\"endTagImply\",thead:\"endTagImply\",tr:\"endTagImply\",\"-default\":\"endTagOther\"},t.inCell.processCharacters=function(e){t.inBody.processCharacters(e)},t.inCell.startTagTableOther=function(t,n,r){e.openElements.inTableScope(\"td\")||e.openElements.inTableScope(\"th\")?(this.closeCell(),e.insertionMode.processStartTag(t,n,r)):e.parseError(\"unexpected-start-tag\",{name:t})},t.inCell.startTagOther=function(e,n,r){t.inBody.processStartTag(e,n,r)},t.inCell.endTagTableCell=function(t){e.openElements.inTableScope(t)?(e.generateImpliedEndTags(t),e.currentStackItem().localName!=t.toLowerCase()?(e.parseError(\"unexpected-cell-end-tag\",{name:t}),e.openElements.popUntilPopped(t)):e.popElement(),e.clearActiveFormattingElements(),e.setInsertionMode(\"inRow\")):e.parseError(\"unexpected-end-tag\",{name:t})},t.inCell.endTagIgnore=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.inCell.endTagImply=function(t){e.openElements.inTableScope(t)?(this.closeCell(),e.insertionMode.processEndTag(t)):e.parseError(\"unexpected-end-tag\",{name:t})},t.inCell.endTagOther=function(e){t.inBody.processEndTag(e)},t.inCell.closeCell=function(){e.openElements.inTableScope(\"td\")?this.endTagTableCell(\"td\"):e.openElements.inTableScope(\"th\")&&this.endTagTableCell(\"th\")},t.inColumnGroup=Object.create(t.base),t.inColumnGroup.start_tag_handlers={html:\"startTagHtml\",col:\"startTagCol\",\"-default\":\"startTagOther\"},t.inColumnGroup.end_tag_handlers={colgroup:\"endTagColgroup\",col:\"endTagCol\",\"-default\":\"endTagOther\"},t.inColumnGroup.ignoreEndTagColgroup=function(){return e.currentStackItem().localName==\"html\"},t.inColumnGroup.processCharacters=function(t){var n=t.takeLeadingWhitespace();n&&e.insertText(n);if(!t.length)return;var r=this.ignoreEndTagColgroup();this.endTagColgroup(\"colgroup\"),r||e.insertionMode.processCharacters(t)},t.inColumnGroup.startTagCol=function(t,n){e.insertSelfClosingElement(t,n)},t.inColumnGroup.startTagOther=function(t,n,r){var i=this.ignoreEndTagColgroup();this.endTagColgroup(\"colgroup\"),i||e.insertionMode.processStartTag(t,n,r)},t.inColumnGroup.endTagColgroup=function(t){this.ignoreEndTagColgroup()?(c.ok(e.context),e.parseError(\"unexpected-end-tag\",{name:t})):(e.popElement(),e.setInsertionMode(\"inTable\"))},t.inColumnGroup.endTagCol=function(t){e.parseError(\"no-end-tag\",{name:\"col\"})},t.inColumnGroup.endTagOther=function(t){var n=this.ignoreEndTagColgroup();this.endTagColgroup(\"colgroup\"),n||e.insertionMode.processEndTag(t)},t.inForeignContent=Object.create(t.base),t.inForeignContent.processStartTag=function(t,n,r){if([\"b\",\"big\",\"blockquote\",\"body\",\"br\",\"center\",\"code\",\"dd\",\"div\",\"dl\",\"dt\",\"em\",\"embed\",\"h1\",\"h2\",\"h3\",\"h4\",\"h5\",\"h6\",\"head\",\"hr\",\"i\",\"img\",\"li\",\"listing\",\"menu\",\"meta\",\"nobr\",\"ol\",\"p\",\"pre\",\"ruby\",\"s\",\"small\",\"span\",\"strong\",\"strike\",\"sub\",\"sup\",\"table\",\"tt\",\"u\",\"ul\",\"var\"].indexOf(t)!=-1||t==\"font\"&&n.some(function(e){return[\"color\",\"face\",\"size\"].indexOf(e.nodeName)>=0})){e.parseError(\"unexpected-html-element-in-foreign-content\",{name:t});while(e.currentStackItem().isForeign()&&!e.currentStackItem().isHtmlIntegrationPoint()&&!e.currentStackItem().isMathMLTextIntegrationPoint())e.openElements.pop();e.insertionMode.processStartTag(t,n,r);return}e.currentStackItem().namespaceURI==\"http://www.w3.org/1998/Math/MathML\"&&(n=e.adjustMathMLAttributes(n)),e.currentStackItem().namespaceURI==\"http://www.w3.org/2000/svg\"&&(t=e.adjustSVGTagNameCase(t),n=e.adjustSVGAttributes(n)),n=e.adjustForeignAttributes(n),e.insertForeignElement(t,n,e.currentStackItem().namespaceURI,r)},t.inForeignContent.processEndTag=function(t){var n=e.currentStackItem(),r=e.openElements.length-1;n.localName.toLowerCase()!=t&&e.parseError(\"unexpected-end-tag\",{name:t});for(;;){if(r===0)break;if(n.localName.toLowerCase()==t){while(e.openElements.pop()!=n);break}r-=1,n=e.openElements.item(r);if(n.isForeign())continue;e.insertionMode.processEndTag(t);break}},t.inForeignContent.processCharacters=function(t){var n=t.takeRemaining();n=n.replace(/\\u0000/g,function(t,n){return e.parseError(\"invalid-codepoint\"),\"�\"}),e.framesetOk&&!o(n)&&(e.framesetOk=!1),e.insertText(n)},t.inHeadNoscript=Object.create(t.base),t.inHeadNoscript.start_tag_handlers={html:\"startTagHtml\",basefont:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",bgsound:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",link:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",meta:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",noframes:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",style:\"startTagBasefontBgsoundLinkMetaNoframesStyle\",head:\"startTagHeadNoscript\",noscript:\"startTagHeadNoscript\",\"-default\":\"startTagOther\"},t.inHeadNoscript.end_tag_handlers={noscript:\"endTagNoscript\",br:\"endTagBr\",\"-default\":\"endTagOther\"},t.inHeadNoscript.processCharacters=function(t){var n=t.takeLeadingWhitespace();n&&e.insertText(n);if(!t.length)return;e.parseError(\"unexpected-char-in-frameset\"),this.anythingElse(),e.insertionMode.processCharacters(t)},t.inHeadNoscript.processComment=function(e){t.inHead.processComment(e)},t.inHeadNoscript.startTagBasefontBgsoundLinkMetaNoframesStyle=function(e,n){t.inHead.processStartTag(e,n)},t.inHeadNoscript.startTagHeadNoscript=function(t,n){e.parseError(\"unexpected-start-tag-in-frameset\",{name:t})},t.inHeadNoscript.startTagOther=function(t,n){e.parseError(\"unexpected-start-tag-in-frameset\",{name:t}),this.anythingElse(),e.insertionMode.processStartTag(t,n)},t.inHeadNoscript.endTagBr=function(t,n){e.parseError(\"unexpected-end-tag-in-frameset\",{name:t}),this.anythingElse(),e.insertionMode.processEndTag(t,n)},t.inHeadNoscript.endTagNoscript=function(t,n){e.popElement(),e.setInsertionMode(\"inHead\")},t.inHeadNoscript.endTagOther=function(t,n){e.parseError(\"unexpected-end-tag-in-frameset\",{name:t})},t.inHeadNoscript.anythingElse=function(){e.popElement(),e.setInsertionMode(\"inHead\")},t.inFrameset=Object.create(t.base),t.inFrameset.start_tag_handlers={html:\"startTagHtml\",frameset:\"startTagFrameset\",frame:\"startTagFrame\",noframes:\"startTagNoframes\",\"-default\":\"startTagOther\"},t.inFrameset.end_tag_handlers={frameset:\"endTagFrameset\",noframes:\"endTagNoframes\",\"-default\":\"endTagOther\"},t.inFrameset.processCharacters=function(t){e.parseError(\"unexpected-char-in-frameset\")},t.inFrameset.startTagFrameset=function(t,n){e.insertElement(t,n)},t.inFrameset.startTagFrame=function(t,n){e.insertSelfClosingElement(t,n)},t.inFrameset.startTagNoframes=function(e,n){t.inBody.processStartTag(e,n)},t.inFrameset.startTagOther=function(t,n){e.parseError(\"unexpected-start-tag-in-frameset\",{name:t})},t.inFrameset.endTagFrameset=function(t,n){e.currentStackItem().localName==\"html\"?e.parseError(\"unexpected-frameset-in-frameset-innerhtml\"):e.popElement(),!e.context&&e.currentStackItem().localName!=\"frameset\"&&e.setInsertionMode(\"afterFrameset\")},t.inFrameset.endTagNoframes=function(e){t.inBody.processEndTag(e)},t.inFrameset.endTagOther=function(t){e.parseError(\"unexpected-end-tag-in-frameset\",{name:t})},t.inTable=Object.create(t.base),t.inTable.start_tag_handlers={html:\"startTagHtml\",caption:\"startTagCaption\",colgroup:\"startTagColgroup\",col:\"startTagCol\",table:\"startTagTable\",tbody:\"startTagRowGroup\",tfoot:\"startTagRowGroup\",thead:\"startTagRowGroup\",td:\"startTagImplyTbody\",th:\"startTagImplyTbody\",tr:\"startTagImplyTbody\",style:\"startTagStyleScript\",script:\"startTagStyleScript\",input:\"startTagInput\",form:\"startTagForm\",\"-default\":\"startTagOther\"},t.inTable.end_tag_handlers={table:\"endTagTable\",body:\"endTagIgnore\",caption:\"endTagIgnore\",col:\"endTagIgnore\",colgroup:\"endTagIgnore\",html:\"endTagIgnore\",tbody:\"endTagIgnore\",td:\"endTagIgnore\",tfoot:\"endTagIgnore\",th:\"endTagIgnore\",thead:\"endTagIgnore\",tr:\"endTagIgnore\",\"-default\":\"endTagOther\"},t.inTable.processCharacters=function(n){if(e.currentStackItem().isFosterParenting()){var r=e.insertionModeName;e.setInsertionMode(\"inTableText\"),e.originalInsertionMode=r,e.insertionMode.processCharacters(n)}else e.redirectAttachToFosterParent=!0,t.inBody.processCharacters(n),e.redirectAttachToFosterParent=!1},t.inTable.startTagCaption=function(t,n){e.openElements.popUntilTableScopeMarker(),e.activeFormattingElements.push(y),e.insertElement(t,n),e.setInsertionMode(\"inCaption\")},t.inTable.startTagColgroup=function(t,n){e.openElements.popUntilTableScopeMarker(),e.insertElement(t,n),e.setInsertionMode(\"inColumnGroup\")},t.inTable.startTagCol=function(t,n){this.startTagColgroup(\"colgroup\",[]),e.insertionMode.processStartTag(t,n)},t.inTable.startTagRowGroup=function(t,n){e.openElements.popUntilTableScopeMarker(),e.insertElement(t,n),e.setInsertionMode(\"inTableBody\")},t.inTable.startTagImplyTbody=function(t,n){this.startTagRowGroup(\"tbody\",[]),e.insertionMode.processStartTag(t,n)},t.inTable.startTagTable=function(t,n){e.parseError(\"unexpected-start-tag-implies-end-tag\",{startName:\"table\",endName:\"table\"}),e.insertionMode.processEndTag(\"table\"),e.context||e.insertionMode.processStartTag(t,n)},t.inTable.startTagStyleScript=function(e,n){t.inHead.processStartTag(e,n)},t.inTable.startTagInput=function(t,n){for(var r in n)if(n[r].nodeName.toLowerCase()==\"type\"){if(n[r].nodeValue.toLowerCase()==\"hidden\"){e.parseError(\"unexpected-hidden-input-in-table\"),e.insertElement(t,n),e.openElements.pop();return}break}this.startTagOther(t,n)},t.inTable.startTagForm=function(t,n){e.parseError(\"unexpected-form-in-table\"),e.form||(e.insertElement(t,n),e.form=e.currentStackItem(),e.openElements.pop())},t.inTable.startTagOther=function(n,r,i){e.parseError(\"unexpected-start-tag-implies-table-voodoo\",{name:n}),e.redirectAttachToFosterParent=!0,t.inBody.processStartTag(n,r,i),e.redirectAttachToFosterParent=!1},t.inTable.endTagTable=function(t){e.openElements.inTableScope(t)?(e.generateImpliedEndTags(),e.currentStackItem().localName!=t&&e.parseError(\"end-tag-too-early-named\",{gotName:\"table\",expectedName:e.currentStackItem().localName}),e.openElements.popUntilPopped(\"table\"),e.resetInsertionMode()):(c.ok(e.context),e.parseError(\"unexpected-end-tag\",{name:t}))},t.inTable.endTagIgnore=function(t){e.parseError(\"unexpected-end-tag\",{name:t})},t.inTable.endTagOther=function(n){e.parseError(\"unexpected-end-tag-implies-table-voodoo\",{name:n}),e.redirectAttachToFosterParent=!0,t.inBody.processEndTag(n),e.redirectAttachToFosterParent=!1},t.inTableText=Object.create(t.base),t.inTableText.flushCharacters=function(){var t=e.pendingTableCharacters.join(\"\");s(t)?e.insertText(t):(e.redirectAttachToFosterParent=!0,e.reconstructActiveFormattingElements(),e.insertText(t),e.framesetOk=!1,e.redirectAttachToFosterParent=!1),e.pendingTableCharacters=[]},t.inTableText.processComment=function(t){this.flushCharacters(),e.setInsertionMode(e.originalInsertionMode),e.insertionMode.processComment(t)},t.inTableText.processEOF=function(t){this.flushCharacters(),e.setInsertionMode(e.originalInsertionMode),e.insertionMode.processEOF()},t.inTableText.processCharacters=function(t){var n=t.takeRemaining();n=n.replace(/\\u0000/g,function(t,n){return e.parseError(\"invalid-codepoint\"),\"\"});if(!n)return;e.pendingTableCharacters.push(n)},t.inTableText.processStartTag=function(t,n,r){this.flushCharacters(),e.setInsertionMode(e.originalInsertionMode),e.insertionMode.processStartTag(t,n,r)},t.inTableText.processEndTag=function(t,n){this.flushCharacters(),e.setInsertionMode(e.originalInsertionMode),e.insertionMode.processEndTag(t,n)},t.inTableBody=Object.create(t.base),t.inTableBody.start_tag_handlers={html:\"startTagHtml\",tr:\"startTagTr\",td:\"startTagTableCell\",th:\"startTagTableCell\",caption:\"startTagTableOther\",col:\"startTagTableOther\",colgroup:\"startTagTableOther\",tbody:\"startTagTableOther\",tfoot:\"startTagTableOther\",thead:\"startTagTableOther\",\"-default\":\"startTagOther\"},t.inTableBody.end_tag_handlers={table:\"endTagTable\",tbody:\"endTagTableRowGroup\",tfoot:\"endTagTableRowGroup\",thead:\"endTagTableRowGroup\",body:\"endTagIgnore\",caption:\"endTagIgnore\",col:\"endTagIgnore\",colgroup:\"endTagIgnore\",html:\"endTagIgnore\",td:\"endTagIgnore\",th:\"endTagIgnore\",tr:\"endTagIgnore\",\"-default\":\"endTagOther\"},t.inTableBody.processCharacters=function(e){t.inTable.processCharacters(e)},t.inTableBody.startTagTr=function(t,n){e.openElements.popUntilTableBodyScopeMarker(),e.insertElement(t,n),e.setInsertionMode(\"inRow\")},t.inTableBody.startTagTableCell=function(t,n){e.parseError(\"unexpected-cell-in-table-body\",{name:t}),this.startTagTr(\"tr\",[]),e.insertionMode.processStartTag(t,n)},t.inTableBody.startTagTableOther=function(t,n){e.openElements.inTableScope(\"tbody\")||e.openElements.inTableScope(\"thead\")||e.openElements.inTableScope(\"tfoot\")?(e.openElements.popUntilTableBodyScopeMarker(),this.endTagTableRowGroup(e.currentStackItem().localName),e.insertionMode.processStartTag(t,n)):e.parseError(\"unexpected-start-tag\",{name:t})},t.inTableBody.startTagOther=function(e,n){t.inTable.processStartTag(e,n)},t.inTableBody.endTagTableRowGroup=function(t){e.openElements.inTableScope(t)?(e.openElements.popUntilTableBodyScopeMarker(),e.popElement(),e.setInsertionMode(\"inTable\")):e.parseError(\"unexpected-end-tag-in-table-body\",{name:t})},t.inTableBody.endTagTable=function(t){e.openElements.inTableScope(\"tbody\")||e.openElements.inTableScope(\"thead\")||e.openElements.inTableScope(\"tfoot\")?(e.openElements.popUntilTableBodyScopeMarker(),this.endTagTableRowGroup(e.currentStackItem().localName),e.insertionMode.processEndTag(t)):e.parseError(\"unexpected-end-tag\",{name:t})},t.inTableBody.endTagIgnore=function(t){e.parseError(\"unexpected-end-tag-in-table-body\",{name:t})},t.inTableBody.endTagOther=function(e){t.inTable.processEndTag(e)},t.inSelect=Object.create(t.base),t.inSelect.start_tag_handlers={html:\"startTagHtml\",option:\"startTagOption\",optgroup:\"startTagOptgroup\",select:\"startTagSelect\",input:\"startTagInput\",keygen:\"startTagInput\",textarea:\"startTagInput\",script:\"startTagScript\",\"-default\":\"startTagOther\"},t.inSelect.end_tag_handlers={option:\"endTagOption\",optgroup:\"endTagOptgroup\",select:\"endTagSelect\",caption:\"endTagTableElements\",table:\"endTagTableElements\",tbody:\"endTagTableElements\",tfoot:\"endTagTableElements\",thead:\"endTagTableElements\",tr:\"endTagTableElements\",td:\"endTagTableElements\",th:\"endTagTableElements\",\"-default\":\"endTagOther\"},t.inSelect.processCharacters=function(t){var n=t.takeRemaining();n=n.replace(/\\u0000/g,function(t,n){return e.parseError(\"invalid-codepoint\"),\"\"});if(!n)return;e.insertText(n)},t.inSelect.startTagOption=function(t,n){e.currentStackItem().localName==\"option\"&&e.popElement(),e.insertElement(t,n)},t.inSelect.startTagOptgroup=function(t,n){e.currentStackItem().localName==\"option\"&&e.popElement(),e.currentStackItem().localName==\"optgroup\"&&e.popElement(),e.insertElement(t,n)},t.inSelect.endTagOption=function(t){if(e.currentStackItem().localName!==\"option\"){e.parseError(\"unexpected-end-tag-in-select\",{name:t});return}e.popElement()},t.inSelect.endTagOptgroup=function(t){e.currentStackItem().localName==\"option\"&&e.openElements.item(e.openElements.length-2).localName==\"optgroup\"&&e.popElement(),e.currentStackItem().localName==\"optgroup\"?e.popElement():e.parseError(\"unexpected-end-tag-in-select\",{name:\"optgroup\"})},t.inSelect.startTagSelect=function(t){e.parseError(\"unexpected-select-in-select\"),this.endTagSelect(\"select\")},t.inSelect.endTagSelect=function(t){e.openElements.inTableScope(\"select\")?(e.openElements.popUntilPopped(\"select\"),e.resetInsertionMode()):e.parseError(\"unexpected-end-tag\",{name:t})},t.inSelect.startTagInput=function(t,n){e.parseError(\"unexpected-input-in-select\"),e.openElements.inSelectScope(\"select\")&&(this.endTagSelect(\"select\"),e.insertionMode.processStartTag(t,n))},t.inSelect.startTagScript=function(e,n){t.inHead.processStartTag(e,n)},t.inSelect.endTagTableElements=function(t){e.parseError(\"unexpected-end-tag-in-select\",{name:t}),e.openElements.inTableScope(t)&&(this.endTagSelect(\"select\"),e.insertionMode.processEndTag(t))},t.inSelect.startTagOther=function(t,n){e.parseError(\"unexpected-start-tag-in-select\",{name:t})},t.inSelect.endTagOther=function(t){e.parseError(\"unexpected-end-tag-in-select\",{name:t})},t.inSelectInTable=Object.create(t.base),t.inSelectInTable.start_tag_handlers={caption:\"startTagTable\",table:\"startTagTable\",tbody:\"startTagTable\",tfoot:\"startTagTable\",thead:\"startTagTable\",tr:\"startTagTable\",td:\"startTagTable\",th:\"startTagTable\",\"-default\":\"startTagOther\"},t.inSelectInTable.end_tag_handlers={caption:\"endTagTable\",table:\"endTagTable\",tbody:\"endTagTable\",tfoot:\"endTagTable\",thead:\"endTagTable\",tr:\"endTagTable\",td:\"endTagTable\",th:\"endTagTable\",\"-default\":\"endTagOther\"},t.inSelectInTable.processCharacters=function(e){t.inSelect.processCharacters(e)},t.inSelectInTable.startTagTable=function(t,n){e.parseError(\"unexpected-table-element-start-tag-in-select-in-table\",{name:t}),this.endTagOther(\"select\"),e.insertionMode.processStartTag(t,n)},t.inSelectInTable.startTagOther=function(e,n,r){t.inSelect.processStartTag(e,n,r)},t.inSelectInTable.endTagTable=function(t){e.parseError(\"unexpected-table-element-end-tag-in-select-in-table\",{name:t}),e.openElements.inTableScope(t)&&(this.endTagOther(\"select\"),e.insertionMode.processEndTag(t))},t.inSelectInTable.endTagOther=function(e){t.inSelect.processEndTag(e)},t.inRow=Object.create(t.base),t.inRow.start_tag_handlers={html:\"startTagHtml\",td:\"startTagTableCell\",th:\"startTagTableCell\",caption:\"startTagTableOther\",col:\"startTagTableOther\",colgroup:\"startTagTableOther\",tbody:\"startTagTableOther\",tfoot:\"startTagTableOther\",thead:\"startTagTableOther\",tr:\"startTagTableOther\",\"-default\":\"startTagOther\"},t.inRow.end_tag_handlers={tr:\"endTagTr\",table:\"endTagTable\",tbody:\"endTagTableRowGroup\",tfoot:\"endTagTableRowGroup\",thead:\"endTagTableRowGroup\",body:\"endTagIgnore\",caption:\"endTagIgnore\",col:\"endTagIgnore\",colgroup:\"endTagIgnore\",html:\"endTagIgnore\",td:\"endTagIgnore\",th:\"endTagIgnore\",\"-default\":\"endTagOther\"},t.inRow.processCharacters=function(e){t.inTable.processCharacters(e)},t.inRow.startTagTableCell=function(t,n){e.openElements.popUntilTableRowScopeMarker(),e.insertElement(t,n),e.setInsertionMode(\"inCell\"),e.activeFormattingElements.push(y)},t.inRow.startTagTableOther=function(t,n){var r=this.ignoreEndTagTr();this.endTagTr(\"tr\"),r||e.insertionMode.processStartTag(t,n)},t.inRow.startTagOther=function(e,n,r){t.inTable.processStartTag(e,n,r)},t.inRow.endTagTr=function(t){this.ignoreEndTagTr()?(c.ok(e.context),e.parseError(\"unexpected-end-tag\",{name:t})):(e.openElements.popUntilTableRowScopeMarker(),e.popElement(),e.setInsertionMode(\"inTableBody\"))},t.inRow.endTagTable=function(t){var n=this.ignoreEndTagTr();this.endTagTr(\"tr\"),n||e.insertionMode.processEndTag(t)},t.inRow.endTagTableRowGroup=function(t){e.openElements.inTableScope(t)?(this.endTagTr(\"tr\"),e.insertionMode.processEndTag(t)):e.parseError(\"unexpected-end-tag\",{name:t})},t.inRow.endTagIgnore=function(t){e.parseError(\"unexpected-end-tag-in-table-row\",{name:t})},t.inRow.endTagOther=function(e){t.inTable.processEndTag(e)},t.inRow.ignoreEndTagTr=function(){return!e.openElements.inTableScope(\"tr\")},t.afterAfterFrameset=Object.create(t.base),t.afterAfterFrameset.start_tag_handlers={html:\"startTagHtml\",noframes:\"startTagNoFrames\",\"-default\":\"startTagOther\"},t.afterAfterFrameset.processEOF=function(){},t.afterAfterFrameset.processComment=function(t){e.insertComment(t,e.document)},t.afterAfterFrameset.processCharacters=function(t){var n=t.takeRemaining(),i=\"\";for(var s=0;s<n.length;s++){var o=n[s];r(o)&&(i+=o)}i&&(e.reconstructActiveFormattingElements(),e.insertText(i)),i.length<n.length&&e.parseError(\"expected-eof-but-got-char\")},t.afterAfterFrameset.startTagNoFrames=function(e,n){t.inHead.processStartTag(e,n)},t.afterAfterFrameset.startTagOther=function(t,n,r){e.parseError(\"expected-eof-but-got-start-tag\",{name:t})},t.afterAfterFrameset.processEndTag=function(t,n){e.parseError(\"expected-eof-but-got-end-tag\",{name:t})},t.text=Object.create(t.base),t.text.start_tag_handlers={\"-default\":\"startTagOther\"},t.text.end_tag_handlers={script:\"endTagScript\",\"-default\":\"endTagOther\"},t.text.processCharacters=function(t){e.shouldSkipLeadingNewline&&(e.shouldSkipLeadingNewline=!1,t.skipAtMostOneLeadingNewline());var n=t.takeRemaining();if(!n)return;e.insertText(n)},t.text.processEOF=function(){e.parseError(\"expected-named-closing-tag-but-got-eof\",{name:e.currentStackItem().localName}),e.openElements.pop(),e.setInsertionMode(e.originalInsertionMode),e.insertionMode.processEOF()},t.text.startTagOther=function(e){throw\"Tried to process start tag \"+e+\" in RCDATA/RAWTEXT mode\"},t.text.endTagScript=function(t){var n=e.openElements.pop();c.ok(n.localName==\"script\"),e.setInsertionMode(e.originalInsertionMode)},t.text.endTagOther=function(t){e.openElements.pop(),e.setInsertionMode(e.originalInsertionMode)}}function l(e,t){return e.replace(new RegExp(\"{[0-9a-z-]+}\",\"gi\"),function(e){return t[e.slice(1,-1)]||e})}var c=e(\"assert\"),h=e(\"./messages.json\"),p=e(\"./constants\"),d=e(\"events\").EventEmitter,v=e(\"./Tokenizer\").Tokenizer,m=e(\"./ElementStack\").ElementStack,g=e(\"./StackItem\").StackItem,y={};a.prototype.skipAtMostOneLeadingNewline=function(){this.characters[this.current]===\"\\n\"&&this.current++},a.prototype.skipLeadingWhitespace=function(){while(r(this.characters[this.current]))if(++this.current==this.end)return},a.prototype.skipLeadingNonWhitespace=function(){while(!r(this.characters[this.current]))if(++this.current==this.end)return},a.prototype.takeRemaining=function(){return this.characters.substring(this.current)},a.prototype.takeLeadingWhitespace=function(){var e=this.current;return this.skipLeadingWhitespace(),e===this.current?\"\":this.characters.substring(e,this.current-e)},Object.defineProperty(a.prototype,\"length\",{get:function(){return this.end-this.current}}),f.prototype.setInsertionMode=function(e){this.insertionMode=this.insertionModes[e],this.insertionModeName=e},f.prototype.adoptionAgencyEndTag=function(e){function t(e){return e===i}var n=8,r=3,i,s=0;while(s++<n){i=this.elementInActiveFormattingElements(e);if(!i||this.openElements.contains(i)&&!this.openElements.inScope(i.localName))return this.parseError(\"adoption-agency-1.1\",{name:e}),!1;if(!this.openElements.contains(i))return this.parseError(\"adoption-agency-1.2\",{name:e}),this.removeElementFromActiveFormattingElements(i),!0;this.openElements.inScope(i.localName)||this.parseError(\"adoption-agency-4.4\",{name:e}),i!=this.currentStackItem()&&this.parseError(\"adoption-agency-1.3\",{name:e});var o=this.openElements.furthestBlockForFormattingElement(i.node);if(!o)return this.openElements.remove_openElements_until(t),this.removeElementFromActiveFormattingElements(i),!0;var u=this.openElements.elements.indexOf(i),a=this.openElements.item(u-1),f=this.activeFormattingElements.indexOf(i),l=o,c=o,h=this.openElements.elements.indexOf(l),p=0;while(p++<r){h-=1,l=this.openElements.item(h);if(this.activeFormattingElements.indexOf(l)<0){this.openElements.elements.splice(h,1);continue}if(l==i)break;c==o&&(f=this.activeFormattingElements.indexOf(l)+1);var d=this.createElement(l.namespaceURI,l.localName,l.attributes),v=new g(l.namespaceURI,l.localName,l.attributes,d);this.activeFormattingElements[this.activeFormattingElements.indexOf(l)]=v,this.openElements.elements[this.openElements.elements.indexOf(l)]=v,l=v,this.detachFromParent(c.node),this.attachNode(c.node,l.node),c=l}this.detachFromParent(c.node),a.isFosterParenting()?this.insertIntoFosterParent(c.node):this.attachNode(c.node,a.node);var d=this.createElement(\"http://www.w3.org/1999/xhtml\",i.localName,i.attributes),m=new g(i.namespaceURI,i.localName,i.attributes,d);this.reparentChildren(o.node,d),this.attachNode(d,o.node),this.removeElementFromActiveFormattingElements(i),this.activeFormattingElements.splice(Math.min(f,this.activeFormattingElements.length),0,m),this.openElements.remove(i),this.openElements.elements.splice(this.openElements.elements.indexOf(o)+1,0,m)}return!0},f.prototype.start=function(){throw\"Not mplemented\"},f.prototype.startTokenization=function(e){this.tokenizer=e,this.compatMode=\"no quirks\",this.originalInsertionMode=\"initial\",this.framesetOk=!0,this.openElements=new m,this.activeFormattingElements=[],this.start();if(this.context){switch(this.context){case\"title\":case\"textarea\":this.tokenizer.setState(v.RCDATA);break;case\"style\":case\"xmp\":case\"iframe\":case\"noembed\":case\"noframes\":this.tokenizer.setState(v.RAWTEXT);break;case\"script\":this.tokenizer.setState(v.SCRIPT_DATA);break;case\"noscript\":this.scriptingEnabled&&this.tokenizer.setState(v.RAWTEXT);break;case\"plaintext\":this.tokenizer.setState(v.PLAINTEXT)}this.insertHtmlElement(),this.resetInsertionMode()}else this.setInsertionMode(\"initial\")},f.prototype.processToken=function(e){this.selfClosingFlagAcknowledged=!1;var t=this.openElements.top||null,n;!t||!t.isForeign()||t.isMathMLTextIntegrationPoint()&&(e.type==\"StartTag\"&&!(e.name in{mglyph:0,malignmark:0})||e.type===\"Characters\")||t.namespaceURI==\"http://www.w3.org/1998/Math/MathML\"&&t.localName==\"annotation-xml\"&&e.type==\"StartTag\"&&e.name==\"svg\"||t.isHtmlIntegrationPoint()&&e.type in{StartTag:0,Characters:0}||e.type==\"EOF\"?n=this.insertionMode:n=this.insertionModes.inForeignContent;switch(e.type){case\"Characters\":var r=new a(e.data);n.processCharacters(r);break;case\"Comment\":n.processComment(e.data);break;case\"StartTag\":n.processStartTag(e.name,e.data,e.selfClosing);break;case\"EndTag\":n.processEndTag(e.name);break;case\"Doctype\":n.processDoctype(e.name,e.publicId,e.systemId,e.forceQuirks);break;case\"EOF\":n.processEOF()}},f.prototype.isCdataSectionAllowed=function(){return this.openElements.length>0&&this.currentStackItem().isForeign()},f.prototype.isSelfClosingFlagAcknowledged=function(){return this.selfClosingFlagAcknowledged},f.prototype.createElement=function(e,t,n){throw new Error(\"Not implemented\")},f.prototype.attachNode=function(e,t){throw new Error(\"Not implemented\")},f.prototype.attachNodeToFosterParent=function(e,t,n){throw new Error(\"Not implemented\")},f.prototype.detachFromParent=function(e){throw new Error(\"Not implemented\")},f.prototype.addAttributesToElement=function(e,t){throw new Error(\"Not implemented\")},f.prototype.insertHtmlElement=function(e){var t=this.createElement(\"http://www.w3.org/1999/xhtml\",\"html\",e);return this.attachNode(t,this.document),this.openElements.pushHtmlElement(new g(\"http://www.w3.org/1999/xhtml\",\"html\",e,t)),t},f.prototype.insertHeadElement=function(e){var t=this.createElement(\"http://www.w3.org/1999/xhtml\",\"head\",e);return this.head=new g(\"http://www.w3.org/1999/xhtml\",\"head\",e,t),this.attachNode(t,this.openElements.top.node),this.openElements.pushHeadElement(this.head),t},f.prototype.insertBodyElement=function(e){var t=this.createElement(\"http://www.w3.org/1999/xhtml\",\"body\",e);return this.attachNode(t,this.openElements.top.node),this.openElements.pushBodyElement(new g(\"http://www.w3.org/1999/xhtml\",\"body\",e,t)),t},f.prototype.insertIntoFosterParent=function(e){var t=this.openElements.findIndex(\"table\"),n=this.openElements.item(t).node;if(t===0)return this.attachNode(e,n);this.attachNodeToFosterParent(e,n,this.openElements.item(t-1).node)},f.prototype.insertElement=function(e,t,n,r){n||(n=\"http://www.w3.org/1999/xhtml\");var i=this.createElement(n,e,t);this.shouldFosterParent()?this.insertIntoFosterParent(i):this.attachNode(i,this.openElements.top.node),r||this.openElements.push(new g(n,e,t,i))},f.prototype.insertFormattingElement=function(e,t){this.insertElement(e,t,\"http://www.w3.org/1999/xhtml\"),this.appendElementToActiveFormattingElements(this.currentStackItem())},f.prototype.insertSelfClosingElement=function(e,t){this.selfClosingFlagAcknowledged=!0,this.insertElement(e,t,\"http://www.w3.org/1999/xhtml\",!0)},f.prototype.insertForeignElement=function(e,t,n,r){r&&(this.selfClosingFlagAcknowledged=!0),this.insertElement(e,t,n,r)},f.prototype.insertComment=function(e,t){throw new Error(\"Not implemented\")},f.prototype.insertDoctype=function(e,t,n){throw new Error(\"Not implemented\")},f.prototype.insertText=function(e){throw new Error(\"Not implemented\")},f.prototype.currentStackItem=function(){return this.openElements.top},f.prototype.popElement=function(){return this.openElements.pop()},f.prototype.shouldFosterParent=function(){return this.redirectAttachToFosterParent&&this.currentStackItem().isFosterParenting()},f.prototype.generateImpliedEndTags=function(e){var t=this.openElements.top.localName;[\"dd\",\"dt\",\"li\",\"option\",\"optgroup\",\"p\",\"rp\",\"rt\"].indexOf(t)!=-1&&t!=e&&(this.popElement(),this.generateImpliedEndTags(e))},f.prototype.reconstructActiveFormattingElements=function(){if(this.activeFormattingElements.length===0)return;var e=this.activeFormattingElements.length-1,t=this.activeFormattingElements[e];if(t==y||this.openElements.contains(t))return;while(t!=y&&!this.openElements.contains(t)){e-=1,t=this.activeFormattingElements[e];if(!t)break}for(;;){e+=1,t=this.activeFormattingElements[e],this.insertElement(t.localName,t.attributes);var n=this.currentStackItem();this.activeFormattingElements[e]=n;if(n==this.activeFormattingElements[this.activeFormattingElements.length-1])break}},f.prototype.ensureNoahsArkCondition=function(e){var t=3;if(this.activeFormattingElements.length<t)return;var n=[],r=e.attributes.length;for(var i=this.activeFormattingElements.length-1;i>=0;i--){var s=this.activeFormattingElements[i];if(s===y)break;if(e.localName!==s.localName||e.namespaceURI!==s.namespaceURI)continue;if(s.attributes.length!=r)continue;n.push(s)}if(n.length<t)return;var o=[],a=e.attributes;for(var i=0;i<a.length;i++){var f=a[i];for(var l=0;l<n.length;l++){var s=n[l],c=u(s,f.nodeName);c&&c.nodeValue===f.nodeValue&&o.push(s)}if(o.length<t)return;n=o,o=[]}for(var i=t-1;i<n.length;i++)this.removeElementFromActiveFormattingElements(n[i])},f.prototype.appendElementToActiveFormattingElements=function(e){this.ensureNoahsArkCondition(e),this.activeFormattingElements.push(e)},f.prototype.removeElementFromActiveFormattingElements=function(e){var t=this.activeFormattingElements.indexOf(e);t>=0&&this.activeFormattingElements.splice(t,1)},f.prototype.elementInActiveFormattingElements=function(e){var t=this.activeFormattingElements;for(var n=t.length-1;n>=0;n--){if(t[n]==y)break;if(t[n].localName==e)return t[n]}return!1},f.prototype.clearActiveFormattingElements=function(){while(this.activeFormattingElements.length!==0&&this.activeFormattingElements.pop()!=y);},f.prototype.reparentChildren=function(e,t){throw new Error(\"Not implemented\")},f.prototype.setFragmentContext=function(e){this.context=e},f.prototype.parseError=function(e,t){if(!this.errorHandler)return;var n=l(h[e],t);this.errorHandler.error(n,this.tokenizer._inputStream.location(),e)},f.prototype.resetInsertionMode=function(){var e=!1,t=null;for(var n=this.openElements.length-1;n>=0;n--){t=this.openElements.item(n),n===0&&(c.ok(this.context),e=!0,t=new g(\"http://www.w3.org/1999/xhtml\",this.context,[],null));if(t.namespaceURI===\"http://www.w3.org/1999/xhtml\"){if(t.localName===\"select\")return this.setInsertionMode(\"inSelect\");if(t.localName===\"td\"||t.localName===\"th\")return this.setInsertionMode(\"inCell\");if(t.localName===\"tr\")return this.setInsertionMode(\"inRow\");if(t.localName===\"tbody\"||t.localName===\"thead\"||t.localName===\"tfoot\")return this.setInsertionMode(\"inTableBody\");if(t.localName===\"caption\")return this.setInsertionMode(\"inCaption\");if(t.localName===\"colgroup\")return this.setInsertionMode(\"inColumnGroup\");if(t.localName===\"table\")return this.setInsertionMode(\"inTable\");if(t.localName===\"head\"&&!e)return this.setInsertionMode(\"inHead\");if(t.localName===\"body\")return this.setInsertionMode(\"inBody\");if(t.localName===\"frameset\")return this.setInsertionMode(\"inFrameset\");if(t.localName===\"html\")return this.openElements.headElement?this.setInsertionMode(\"afterHead\"):this.setInsertionMode(\"beforeHead\")}if(e)return this.setInsertionMode(\"inBody\")}},f.prototype.processGenericRCDATAStartTag=function(e,t){this.insertElement(e,t),this.tokenizer.setState(v.RCDATA),this.originalInsertionMode=this.insertionModeName,this.setInsertionMode(\"text\")},f.prototype.processGenericRawTextStartTag=function(e,t){this.insertElement(e,t),this.tokenizer.setState(v.RAWTEXT),this.originalInsertionMode=this.insertionModeName,this.setInsertionMode(\"text\")},f.prototype.adjustMathMLAttributes=function(e){return e.forEach(function(e){e.namespaceURI=\"http://www.w3.org/1998/Math/MathML\",p.MATHMLAttributeMap[e.nodeName]&&(e.nodeName=p.MATHMLAttributeMap[e.nodeName])}),e},f.prototype.adjustSVGTagNameCase=function(e){return p.SVGTagMap[e]||e},f.prototype.adjustSVGAttributes=function(e){return e.forEach(function(e){e.namespaceURI=\"http://www.w3.org/2000/svg\",p.SVGAttributeMap[e.nodeName]&&(e.nodeName=p.SVGAttributeMap[e.nodeName])}),e},f.prototype.adjustForeignAttributes=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=p.ForeignAttributeMap[n.nodeName];r&&(n.nodeName=r.localName,n.prefix=r.prefix,n.namespaceURI=r.namespaceURI)}return e},n.TreeBuilder=f},{\"./ElementStack\":1,\"./StackItem\":4,\"./Tokenizer\":5,\"./constants\":7,\"./messages.json\":8,assert:13,events:16}],7:[function(e,t,n){n.SVGTagMap={altglyph:\"altGlyph\",altglyphdef:\"altGlyphDef\",altglyphitem:\"altGlyphItem\",animatecolor:\"animateColor\",animatemotion:\"animateMotion\",animatetransform:\"animateTransform\",clippath:\"clipPath\",feblend:\"feBlend\",fecolormatrix:\"feColorMatrix\",fecomponenttransfer:\"feComponentTransfer\",fecomposite:\"feComposite\",feconvolvematrix:\"feConvolveMatrix\",fediffuselighting:\"feDiffuseLighting\",fedisplacementmap:\"feDisplacementMap\",fedistantlight:\"feDistantLight\",feflood:\"feFlood\",fefunca:\"feFuncA\",fefuncb:\"feFuncB\",fefuncg:\"feFuncG\",fefuncr:\"feFuncR\",fegaussianblur:\"feGaussianBlur\",feimage:\"feImage\",femerge:\"feMerge\",femergenode:\"feMergeNode\",femorphology:\"feMorphology\",feoffset:\"feOffset\",fepointlight:\"fePointLight\",fespecularlighting:\"feSpecularLighting\",fespotlight:\"feSpotLight\",fetile:\"feTile\",feturbulence:\"feTurbulence\",foreignobject:\"foreignObject\",glyphref:\"glyphRef\",lineargradient:\"linearGradient\",radialgradient:\"radialGradient\",textpath:\"textPath\"},n.MATHMLAttributeMap={definitionurl:\"definitionURL\"},n.SVGAttributeMap={attributename:\"attributeName\",attributetype:\"attributeType\",basefrequency:\"baseFrequency\",baseprofile:\"baseProfile\",calcmode:\"calcMode\",clippathunits:\"clipPathUnits\",contentscripttype:\"contentScriptType\",contentstyletype:\"contentStyleType\",diffuseconstant:\"diffuseConstant\",edgemode:\"edgeMode\",externalresourcesrequired:\"externalResourcesRequired\",filterres:\"filterRes\",filterunits:\"filterUnits\",glyphref:\"glyphRef\",gradienttransform:\"gradientTransform\",gradientunits:\"gradientUnits\",kernelmatrix:\"kernelMatrix\",kernelunitlength:\"kernelUnitLength\",keypoints:\"keyPoints\",keysplines:\"keySplines\",keytimes:\"keyTimes\",lengthadjust:\"lengthAdjust\",limitingconeangle:\"limitingConeAngle\",markerheight:\"markerHeight\",markerunits:\"markerUnits\",markerwidth:\"markerWidth\",maskcontentunits:\"maskContentUnits\",maskunits:\"maskUnits\",numoctaves:\"numOctaves\",pathlength:\"pathLength\",patterncontentunits:\"patternContentUnits\",patterntransform:\"patternTransform\",patternunits:\"patternUnits\",pointsatx:\"pointsAtX\",pointsaty:\"pointsAtY\",pointsatz:\"pointsAtZ\",preservealpha:\"preserveAlpha\",preserveaspectratio:\"preserveAspectRatio\",primitiveunits:\"primitiveUnits\",refx:\"refX\",refy:\"refY\",repeatcount:\"repeatCount\",repeatdur:\"repeatDur\",requiredextensions:\"requiredExtensions\",requiredfeatures:\"requiredFeatures\",specularconstant:\"specularConstant\",specularexponent:\"specularExponent\",spreadmethod:\"spreadMethod\",startoffset:\"startOffset\",stddeviation:\"stdDeviation\",stitchtiles:\"stitchTiles\",surfacescale:\"surfaceScale\",systemlanguage:\"systemLanguage\",tablevalues:\"tableValues\",targetx:\"targetX\",targety:\"targetY\",textlength:\"textLength\",viewbox:\"viewBox\",viewtarget:\"viewTarget\",xchannelselector:\"xChannelSelector\",ychannelselector:\"yChannelSelector\",zoomandpan:\"zoomAndPan\"},n.ForeignAttributeMap={\"xlink:actuate\":{prefix:\"xlink\",localName:\"actuate\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:arcrole\":{prefix:\"xlink\",localName:\"arcrole\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:href\":{prefix:\"xlink\",localName:\"href\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:role\":{prefix:\"xlink\",localName:\"role\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:show\":{prefix:\"xlink\",localName:\"show\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:title\":{prefix:\"xlink\",localName:\"title\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xlink:type\":{prefix:\"xlink\",localName:\"title\",namespaceURI:\"http://www.w3.org/1999/xlink\"},\"xml:base\":{prefix:\"xml\",localName:\"base\",namespaceURI:\"http://www.w3.org/XML/1998/namespace\"},\"xml:lang\":{prefix:\"xml\",localName:\"lang\",namespaceURI:\"http://www.w3.org/XML/1998/namespace\"},\"xml:space\":{prefix:\"xml\",localName:\"space\",namespaceURI:\"http://www.w3.org/XML/1998/namespace\"},xmlns:{prefix:null,localName:\"xmlns\",namespaceURI:\"http://www.w3.org/2000/xmlns/\"},\"xmlns:xlink\":{prefix:\"xmlns\",localName:\"xlink\",namespaceURI:\"http://www.w3.org/2000/xmlns/\"}}},{}],8:[function(e,t,n){t.exports={\"null-character\":\"Null character in input stream, replaced with U+FFFD.\",\"invalid-codepoint\":\"Invalid codepoint in stream\",\"incorrectly-placed-solidus\":\"Solidus (/) incorrectly placed in tag.\",\"incorrect-cr-newline-entity\":\"Incorrect CR newline entity, replaced with LF.\",\"illegal-windows-1252-entity\":\"Entity used with illegal number (windows-1252 reference).\",\"cant-convert-numeric-entity\":\"Numeric entity couldn't be converted to character (codepoint U+{charAsInt}).\",\"invalid-numeric-entity-replaced\":\"Numeric entity represents an illegal codepoint. Expanded to the C1 controls range.\",\"numeric-entity-without-semicolon\":\"Numeric entity didn't end with ';'.\",\"expected-numeric-entity-but-got-eof\":\"Numeric entity expected. Got end of file instead.\",\"expected-numeric-entity\":\"Numeric entity expected but none found.\",\"named-entity-without-semicolon\":\"Named entity didn't end with ';'.\",\"expected-named-entity\":\"Named entity expected. Got none.\",\"attributes-in-end-tag\":\"End tag contains unexpected attributes.\",\"self-closing-flag-on-end-tag\":\"End tag contains unexpected self-closing flag.\",\"bare-less-than-sign-at-eof\":\"End of file after <.\",\"expected-tag-name-but-got-right-bracket\":\"Expected tag name. Got '>' instead.\",\"expected-tag-name-but-got-question-mark\":\"Expected tag name. Got '?' instead. (HTML doesn't support processing instructions.)\",\"expected-tag-name\":\"Expected tag name. Got something else instead.\",\"expected-closing-tag-but-got-right-bracket\":\"Expected closing tag. Got '>' instead. Ignoring '</>'.\",\"expected-closing-tag-but-got-eof\":\"Expected closing tag. Unexpected end of file.\",\"expected-closing-tag-but-got-char\":\"Expected closing tag. Unexpected character '{data}' found.\",\"eof-in-tag-name\":\"Unexpected end of file in the tag name.\",\"expected-attribute-name-but-got-eof\":\"Unexpected end of file. Expected attribute name instead.\",\"eof-in-attribute-name\":\"Unexpected end of file in attribute name.\",\"invalid-character-in-attribute-name\":\"Invalid character in attribute name.\",\"duplicate-attribute\":\"Dropped duplicate attribute '{name}' on tag.\",\"expected-end-of-tag-but-got-eof\":\"Unexpected end of file. Expected = or end of tag.\",\"expected-attribute-value-but-got-eof\":\"Unexpected end of file. Expected attribute value.\",\"expected-attribute-value-but-got-right-bracket\":\"Expected attribute value. Got '>' instead.\",\"unexpected-character-in-unquoted-attribute-value\":\"Unexpected character in unquoted attribute\",\"invalid-character-after-attribute-name\":\"Unexpected character after attribute name.\",\"unexpected-character-after-attribute-value\":\"Unexpected character after attribute value.\",\"eof-in-attribute-value-double-quote\":'Unexpected end of file in attribute value (\").',\"eof-in-attribute-value-single-quote\":\"Unexpected end of file in attribute value (').\",\"eof-in-attribute-value-no-quotes\":\"Unexpected end of file in attribute value.\",\"eof-after-attribute-value\":\"Unexpected end of file after attribute value.\",\"unexpected-eof-after-solidus-in-tag\":\"Unexpected end of file in tag. Expected >.\",\"unexpected-character-after-solidus-in-tag\":\"Unexpected character after / in tag. Expected >.\",\"expected-dashes-or-doctype\":\"Expected '--' or 'DOCTYPE'. Not found.\",\"unexpected-bang-after-double-dash-in-comment\":\"Unexpected ! after -- in comment.\",\"incorrect-comment\":\"Incorrect comment.\",\"eof-in-comment\":\"Unexpected end of file in comment.\",\"eof-in-comment-end-dash\":\"Unexpected end of file in comment (-).\",\"unexpected-dash-after-double-dash-in-comment\":\"Unexpected '-' after '--' found in comment.\",\"eof-in-comment-double-dash\":\"Unexpected end of file in comment (--).\",\"eof-in-comment-end-bang-state\":\"Unexpected end of file in comment.\",\"unexpected-char-in-comment\":\"Unexpected character in comment found.\",\"need-space-after-doctype\":\"No space after literal string 'DOCTYPE'.\",\"expected-doctype-name-but-got-right-bracket\":\"Unexpected > character. Expected DOCTYPE name.\",\"expected-doctype-name-but-got-eof\":\"Unexpected end of file. Expected DOCTYPE name.\",\"eof-in-doctype-name\":\"Unexpected end of file in DOCTYPE name.\",\"eof-in-doctype\":\"Unexpected end of file in DOCTYPE.\",\"expected-space-or-right-bracket-in-doctype\":\"Expected space or '>'. Got '{data}'.\",\"unexpected-end-of-doctype\":\"Unexpected end of DOCTYPE.\",\"unexpected-char-in-doctype\":\"Unexpected character in DOCTYPE.\",\"eof-in-bogus-doctype\":\"Unexpected end of file in bogus doctype.\",\"eof-in-innerhtml\":\"Unexpected EOF in inner html mode.\",\"unexpected-doctype\":\"Unexpected DOCTYPE. Ignored.\",\"non-html-root\":\"html needs to be the first start tag.\",\"expected-doctype-but-got-eof\":\"Unexpected End of file. Expected DOCTYPE.\",\"unknown-doctype\":\"Erroneous DOCTYPE. Expected <!DOCTYPE html>.\",\"quirky-doctype\":\"Quirky doctype. Expected <!DOCTYPE html>.\",\"almost-standards-doctype\":\"Almost standards mode doctype. Expected <!DOCTYPE html>.\",\"obsolete-doctype\":\"Obsolete doctype. Expected <!DOCTYPE html>.\",\"expected-doctype-but-got-chars\":\"Non-space characters found without seeing a doctype first. Expected e.g. <!DOCTYPE html>.\",\"expected-doctype-but-got-start-tag\":\"Start tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.\",\"expected-doctype-but-got-end-tag\":\"End tag seen without seeing a doctype first. Expected e.g. <!DOCTYPE html>.\",\"end-tag-after-implied-root\":\"Unexpected end tag ({name}) after the (implied) root element.\",\"expected-named-closing-tag-but-got-eof\":\"Unexpected end of file. Expected end tag ({name}).\",\"two-heads-are-not-better-than-one\":\"Unexpected start tag head in existing head. Ignored.\",\"unexpected-end-tag\":\"Unexpected end tag ({name}). Ignored.\",\"unexpected-implied-end-tag\":\"End tag {name} implied, but there were open elements.\",\"unexpected-start-tag-out-of-my-head\":\"Unexpected start tag ({name}) that can be in head. Moved.\",\"unexpected-start-tag\":\"Unexpected start tag ({name}).\",\"missing-end-tag\":\"Missing end tag ({name}).\",\"missing-end-tags\":\"Missing end tags ({name}).\",\"unexpected-start-tag-implies-end-tag\":\"Unexpected start tag ({startName}) implies end tag ({endName}).\",\"unexpected-start-tag-treated-as\":\"Unexpected start tag ({originalName}). Treated as {newName}.\",\"deprecated-tag\":\"Unexpected start tag {name}. Don't use it!\",\"unexpected-start-tag-ignored\":\"Unexpected start tag {name}. Ignored.\",\"expected-one-end-tag-but-got-another\":\"Unexpected end tag ({gotName}). Missing end tag ({expectedName}).\",\"end-tag-too-early\":\"End tag ({name}) seen too early. Expected other end tag.\",\"end-tag-too-early-named\":\"Unexpected end tag ({gotName}). Expected end tag ({expectedName}.\",\"end-tag-too-early-ignored\":\"End tag ({name}) seen too early. Ignored.\",\"adoption-agency-1.1\":\"End tag ({name}) violates step 1, paragraph 1 of the adoption agency algorithm.\",\"adoption-agency-1.2\":\"End tag ({name}) violates step 1, paragraph 2 of the adoption agency algorithm.\",\"adoption-agency-1.3\":\"End tag ({name}) violates step 1, paragraph 3 of the adoption agency algorithm.\",\"adoption-agency-4.4\":\"End tag ({name}) violates step 4, paragraph 4 of the adoption agency algorithm.\",\"unexpected-end-tag-treated-as\":\"Unexpected end tag ({originalName}). Treated as {newName}.\",\"no-end-tag\":\"This element ({name}) has no end tag.\",\"unexpected-implied-end-tag-in-table\":\"Unexpected implied end tag ({name}) in the table phase.\",\"unexpected-implied-end-tag-in-table-body\":\"Unexpected implied end tag ({name}) in the table body phase.\",\"unexpected-char-implies-table-voodoo\":\"Unexpected non-space characters in table context caused voodoo mode.\",\"unexpected-hidden-input-in-table\":\"Unexpected input with type hidden in table context.\",\"unexpected-form-in-table\":\"Unexpected form in table context.\",\"unexpected-start-tag-implies-table-voodoo\":\"Unexpected start tag ({name}) in table context caused voodoo mode.\",\"unexpected-end-tag-implies-table-voodoo\":\"Unexpected end tag ({name}) in table context caused voodoo mode.\",\"unexpected-cell-in-table-body\":\"Unexpected table cell start tag ({name}) in the table body phase.\",\"unexpected-cell-end-tag\":\"Got table cell end tag ({name}) while required end tags are missing.\",\"unexpected-end-tag-in-table-body\":\"Unexpected end tag ({name}) in the table body phase. Ignored.\",\"unexpected-implied-end-tag-in-table-row\":\"Unexpected implied end tag ({name}) in the table row phase.\",\"unexpected-end-tag-in-table-row\":\"Unexpected end tag ({name}) in the table row phase. Ignored.\",\"unexpected-select-in-select\":\"Unexpected select start tag in the select phase treated as select end tag.\",\"unexpected-input-in-select\":\"Unexpected input start tag in the select phase.\",\"unexpected-start-tag-in-select\":\"Unexpected start tag token ({name}) in the select phase. Ignored.\",\"unexpected-end-tag-in-select\":\"Unexpected end tag ({name}) in the select phase. Ignored.\",\"unexpected-table-element-start-tag-in-select-in-table\":\"Unexpected table element start tag ({name}) in the select in table phase.\",\"unexpected-table-element-end-tag-in-select-in-table\":\"Unexpected table element end tag ({name}) in the select in table phase.\",\"unexpected-char-after-body\":\"Unexpected non-space characters in the after body phase.\",\"unexpected-start-tag-after-body\":\"Unexpected start tag token ({name}) in the after body phase.\",\"unexpected-end-tag-after-body\":\"Unexpected end tag token ({name}) in the after body phase.\",\"unexpected-char-in-frameset\":\"Unepxected characters in the frameset phase. Characters ignored.\",\"unexpected-start-tag-in-frameset\":\"Unexpected start tag token ({name}) in the frameset phase. Ignored.\",\"unexpected-frameset-in-frameset-innerhtml\":\"Unexpected end tag token (frameset in the frameset phase (innerHTML).\",\"unexpected-end-tag-in-frameset\":\"Unexpected end tag token ({name}) in the frameset phase. Ignored.\",\"unexpected-char-after-frameset\":\"Unexpected non-space characters in the after frameset phase. Ignored.\",\"unexpected-start-tag-after-frameset\":\"Unexpected start tag ({name}) in the after frameset phase. Ignored.\",\"unexpected-end-tag-after-frameset\":\"Unexpected end tag ({name}) in the after frameset phase. Ignored.\",\"expected-eof-but-got-char\":\"Unexpected non-space characters. Expected end of file.\",\"expected-eof-but-got-start-tag\":\"Unexpected start tag ({name}). Expected end of file.\",\"expected-eof-but-got-end-tag\":\"Unexpected end tag ({name}). Expected end of file.\",\"unexpected-end-table-in-caption\":\"Unexpected end table tag in caption. Generates implied end caption.\",\"end-html-in-innerhtml\":\"Unexpected html end tag in inner html mode.\",\"eof-in-table\":\"Unexpected end of file. Expected table content.\",\"eof-in-script\":\"Unexpected end of file. Expected script content.\",\"non-void-element-with-trailing-solidus\":\"Trailing solidus not allowed on element {name}.\",\"unexpected-html-element-in-foreign-content\":'HTML start tag \"{name}\" in a foreign namespace context.',\"unexpected-start-tag-in-table\":\"Unexpected {name}. Expected table content.\"}},{}],9:[function(e,t,n){function r(){this.contentHandler=null,this._errorHandler=null,this._treeBuilder=new i,this._tokenizer=new s(this._treeBuilder),this._scriptingEnabled=!1}var i=e(\"./SAXTreeBuilder\").SAXTreeBuilder,s=e(\"../Tokenizer\").Tokenizer,o=e(\"./TreeParser\").TreeParser;r.prototype.parse=function(e){this._tokenizer.tokenize(e);var t=this._treeBuilder.document;t&&(new o(this.contentHandler)).parse(t)},r.prototype.parseFragment=function(e,t){this._treeBuilder.setFragmentContext(t),this._tokenizer.tokenize(e);var n=this._treeBuilder.getFragment();n&&(new o(this.contentHandler)).parse(n)},Object.defineProperty(r.prototype,\"scriptingEnabled\",{get:function(){return this._scriptingEnabled},set:function(e){this._scriptingEnabled=e,this._treeBuilder.scriptingEnabled=e}}),Object.defineProperty(r.prototype,\"errorHandler\",{get:function(){return this._errorHandler},set:function(e){this._errorHandler=e,this._treeBuilder.errorHandler=e}}),n.SAXParser=r},{\"../Tokenizer\":5,\"./SAXTreeBuilder\":10,\"./TreeParser\":11}],10:[function(e,t,n){function r(){b.call(this)}function i(e,t){for(var n=0;n<e.attributes.length;n++){var r=e.attributes[n];if(r.nodeName===t)return r.nodeValue}}function s(e){e?(this.columnNumber=e.columnNumber,this.lineNumber=e.lineNumber):(this.columnNumber=-1,this.lineNumber=-1),this.parentNode=null,this.nextSibling=null,this.firstChild=null}function o(e){s.call(this,e),this.lastChild=null,this._endLocator=null}function u(e){o.call(this,e),this.nodeType=w.DOCUMENT}function a(){o.call(this,new Locator),this.nodeType=w.DOCUMENT_FRAGMENT}function f(e,t,n,r,i,s){o.call(this,e),this.uri=t,this.localName=n,this.qName=r,this.attributes=i,this.prefixMappings=s,this.nodeType=w.ELEMENT}function l(e,t){s.call(this,e),this.data=t,this.nodeType=w.CHARACTERS}function c(e,t){s.call(this,e),this.data=t,this.nodeType=w.IGNORABLE_WHITESPACE}function h(e,t){s.call(this,e),this.data=t,this.nodeType=w.COMMENT}function p(e){o.call(this,e),this.nodeType=w.CDATA}function d(e){o.call(this),this.name=e,this.nodeType=w.ENTITY}function v(e){s.call(this),this.name=e,this.nodeType=w.SKIPPED_ENTITY}function m(e,t){s.call(this),this.target=e,this.data=t}function g(e,t,n){o.call(this),this.name=e,this.publicIdentifier=t,this.systemIdentifier=n,this.nodeType=w.DTD}var y=e(\"util\"),b=e(\"../TreeBuilder\").TreeBuilder;y.inherits(r,b),r.prototype.start=function(e){this.document=new u(this.tokenizer)},r.prototype.end=function(){this.document.endLocator=this.tokenizer},r.prototype.insertDoctype=function(e,t,n){var r=new g(this.tokenizer,e,t,n);r.endLocator=this.tokenizer,this.document.appendChild(r)},r.prototype.createElement=function(e,t,n){var r=new f(this.tokenizer,e,t,t,n||[]);return r},r.prototype.insertComment=function(e,t){t||(t=this.currentStackItem());var n=new h(this.tokenizer,e);t.appendChild(n)},r.prototype.appendCharacters=function(e,t){var n=new l(this.tokenizer,t);e.appendChild(n)},r.prototype.insertText=function(e){if(this.redirectAttachToFosterParent&&this.openElements.top.isFosterParenting()){var t=this.openElements.findIndex(\"table\"),n=this.openElements.item(t),r=n.node;if(t===0)return this.appendCharacters(r,e);var i=new l(this.tokenizer,e),s=r.parentNode;if(s){s.insertBetween(i,r.previousSibling,r);return}var o=this.openElements.item(t-1).node;o.appendChild(i);return}this.appendCharacters(this.currentStackItem().node,e)},r.prototype.attachNode=function(e,t){t.appendChild(e)},r.prototype.attachNodeToFosterParent=function(e,t,n){var r=t.parentNode;r?r.insertBetween(e,t.previousSibling,t):n.appendChild(e)},r.prototype.detachFromParent=function(e){e.detach()},r.prototype.reparentChildren=function(e,t){t.appendChildren(e.firstChild)},r.prototype.getFragment=function(){var e=new a;return this.reparentChildren(this.openElements.rootNode,e),e},r.prototype.addAttributesToElement=function(e,t){for(var n=0;n<t.length;n++){var r=t[n];i(e,r.nodeName)||e.attributes.push(r)}};var w={CDATA:1,CHARACTERS:2,COMMENT:3,DOCUMENT:4,DOCUMENT_FRAGMENT:5,DTD:6,ELEMENT:7,ENTITY:8,IGNORABLE_WHITESPACE:9,PROCESSING_INSTRUCTION:10,SKIPPED_ENTITY:11};s.prototype.visit=function(e){throw new Error(\"Not Implemented\")},s.prototype.revisit=function(e){return},s.prototype.detach=function(){this.parentNode!==null&&(this.parentNode.removeChild(this),this.parentNode=null)},Object.defineProperty(s.prototype,\"previousSibling\",{get:function(){var e=null,t=this.parentNode.firstChild;for(;;){if(this==t)return e;e=t,t=t.nextSibling}}}),o.prototype=Object.create(s.prototype),o.prototype.insertBefore=function(e,t){if(!t)return this.appendChild(e);e.detach(),e.parentNode=this;if(this.firstChild==t)e.nextSibling=t,this.firstChild=e;else{var n=this.firstChild,r=this.firstChild.nextSibling;while(r!=t)n=r,r=r.nextSibling;n.nextSibling=e,e.nextSibling=r}return e},o.prototype.insertBetween=function(e,t,n){return n?(e.detach(),e.parentNode=this,e.nextSibling=n,t?t.nextSibling=e:firstChild=e,e):this.appendChild(e)},o.prototype.appendChild=function(e){return e.detach(),e.parentNode=this,this.firstChild?this.lastChild.nextSibling=e:this.firstChild=e,this.lastChild=e,e},o.prototype.appendChildren=function(e){var t=e.firstChild;if(!t)return;var n=e;this.firstChild?this.lastChild.nextSibling=t:this.firstChild=t,this.lastChild=n.lastChild;do t.parentNode=this;while(t=t.nextSibling);n.firstChild=null,n.lastChild=null},o.prototype.removeChild=function(e){if(this.firstChild==e)this.firstChild=e.nextSibling,this.lastChild==e&&(this.lastChild=null);else{var t=this.firstChild,n=this.firstChild.nextSibling;while(n!=e)t=n,n=n.nextSibling;t.nextSibling=e.nextSibling,this.lastChild==e&&(this.lastChild=t)}return e.parentNode=null,e},Object.defineProperty(o.prototype,\"endLocator\",{get:function(){return this._endLocator},set:function(e){this._endLocator={lineNumber:e.lineNumber,columnNumber:e.columnNumber}}}),u.prototype=Object.create(o.prototype),u.prototype.visit=function(e){e.startDocument(this)},u.prototype.revisit=function(e){e.endDocument(this.endLocator)},a.prototype=Object.create(o.prototype),a.prototype.visit=function(e){},f.prototype=Object.create(o.prototype),f.prototype.visit=function(e){if(this.prefixMappings)for(var t in prefixMappings){var n=prefixMappings[t];e.startPrefixMapping(n.getPrefix(),n.getUri(),this)}e.startElement(this.uri,this.localName,this.qName,this.attributes,this)},f.prototype.revisit=function(e){e.endElement(this.uri,this.localName,this.qName,this.endLocator);if(this.prefixMappings)for(var t in prefixMappings){var n=prefixMappings[t];e.endPrefixMapping(n.getPrefix(),this.endLocator)}},l.prototype=Object.create(s.prototype),l.prototype.visit=function(e){e.characters(this.data,0,this.data.length,this)},c.prototype=Object.create(s.prototype),c.prototype.visit=function(e){e.ignorableWhitespace(this.data,0,this.data.length,this)},h.prototype=Object.create(s.prototype),h.prototype.visit=function(e){e.comment(this.data,0,this.data.length,this)},p.prototype=Object.create(o.prototype),p.prototype.visit=function(e){e.startCDATA(this)},p.prototype.revisit=function(e){e.endCDATA(this.endLocator)},d.prototype=Object.create(o.prototype),d.prototype.visit=function(e){e.startEntity(this.name,this)},d.prototype.revisit=function(e){e.endEntity(this.name)},v.prototype=Object.create(s.prototype),v.prototype.visit=function(e){e.skippedEntity(this.name,this)},m.prototype=Object.create(s.prototype),m.prototype.visit=function(e){e.processingInstruction(this.target,this.data,this)},m.prototype.getNodeType=function(){return w.PROCESSING_INSTRUCTION},g.prototype=Object.create(o.prototype),g.prototype.visit=function(e){e.startDTD(this.name,this.publicIdentifier,this.systemIdentifier,this)},g.prototype.revisit=function(e){e.endDTD()},n.SAXTreeBuilder=r},{\"../TreeBuilder\":6,util:20}],11:[function(e,t,n){function r(e,t){this.contentHandler,this.lexicalHandler,this.locatorDelegate;if(!e)throw new IllegalArgumentException(\"contentHandler was null.\");this.contentHandler=e,t?this.lexicalHandler=t:this.lexicalHandler=new i}function i(){}r.prototype.parse=function(e){this.contentHandler.documentLocator=this;var t=e,n;for(;;){t.visit(this);if(n=t.firstChild){t=n;continue}for(;;){t.revisit(this);if(t==e)return;if(n=t.nextSibling){t=n;break}t=t.parentNode}}},r.prototype.characters=function(e,t,n,r){this.locatorDelegate=r,this.contentHandler.characters(e,t,n)},r.prototype.endDocument=function(e){this.locatorDelegate=e,this.contentHandler.endDocument()},r.prototype.endElement=function(e,t,n,r){this.locatorDelegate=r,this.contentHandler.endElement(e,t,n)},r.prototype.endPrefixMapping=function(e,t){this.locatorDelegate=t,this.contentHandler.endPrefixMapping(e)},r.prototype.ignorableWhitespace=function(e,t,n,r){this.locatorDelegate=r,this.contentHandler.ignorableWhitespace(e,t,n)},r.prototype.processingInstruction=function(e,t,n){this.locatorDelegate=n,this.contentHandler.processingInstruction(e,t)},r.prototype.skippedEntity=function(e,t){this.locatorDelegate=t,this.contentHandler.skippedEntity(e)},r.prototype.startDocument=function(e){this.locatorDelegate=e,this.contentHandler.startDocument()},r.prototype.startElement=function(e,t,n,r,i){this.locatorDelegate=i,this.contentHandler.startElement(e,t,n,r)},r.prototype.startPrefixMapping=function(e,t,n){this.locatorDelegate=n,this.contentHandler.startPrefixMapping(e,t)},r.prototype.comment=function(e,t,n,r){this.locatorDelegate=r,this.lexicalHandler.comment(e,t,n)},r.prototype.endCDATA=function(e){this.locatorDelegate=e,this.lexicalHandler.endCDATA()},r.prototype.endDTD=function(e){this.locatorDelegate=e,this.lexicalHandler.endDTD()},r.prototype.endEntity=function(e,t){this.locatorDelegate=t,this.lexicalHandler.endEntity(e)},r.prototype.startCDATA=function(e){this.locatorDelegate=e,this.lexicalHandler.startCDATA()},r.prototype.startDTD=function(e,t,n,r){this.locatorDelegate=r,this.lexicalHandler.startDTD(e,t,n)},r.prototype.startEntity=function(e,t){this.locatorDelegate=t,this.lexicalHandler.startEntity(e)},Object.defineProperty(r.prototype,\"columnNumber\",{get:function(){return this.locatorDelegate?this.locatorDelegate.columnNumber:-1}}),Object.defineProperty(r.prototype,\"lineNumber\",{get:function(){return this.locatorDelegate?this.locatorDelegate.lineNumber:-1}}),i.prototype.comment=function(){},i.prototype.endCDATA=function(){},i.prototype.endDTD=function(){},i.prototype.endEntity=function(){},i.prototype.startCDATA=function(){},i.prototype.startDTD=function(){},i.prototype.startEntity=function(){},n.TreeParser=r},{}],12:[function(e,t,n){t.exports={\"Aacute;\":\"Á\",Aacute:\"Á\",\"aacute;\":\"á\",aacute:\"á\",\"Abreve;\":\"Ă\",\"abreve;\":\"ă\",\"ac;\":\"∾\",\"acd;\":\"∿\",\"acE;\":\"∾̳\",\"Acirc;\":\"Â\",Acirc:\"Â\",\"acirc;\":\"â\",acirc:\"â\",\"acute;\":\"´\",acute:\"´\",\"Acy;\":\"А\",\"acy;\":\"а\",\"AElig;\":\"Æ\",AElig:\"Æ\",\"aelig;\":\"æ\",aelig:\"æ\",\"af;\":\"⁡\",\"Afr;\":\"𝔄\",\"afr;\":\"𝔞\",\"Agrave;\":\"À\",Agrave:\"À\",\"agrave;\":\"à\",agrave:\"à\",\"alefsym;\":\"ℵ\",\"aleph;\":\"ℵ\",\"Alpha;\":\"Α\",\"alpha;\":\"α\",\"Amacr;\":\"Ā\",\"amacr;\":\"ā\",\"amalg;\":\"⨿\",\"amp;\":\"&\",amp:\"&\",\"AMP;\":\"&\",AMP:\"&\",\"andand;\":\"⩕\",\"And;\":\"⩓\",\"and;\":\"∧\",\"andd;\":\"⩜\",\"andslope;\":\"⩘\",\"andv;\":\"⩚\",\"ang;\":\"∠\",\"ange;\":\"⦤\",\"angle;\":\"∠\",\"angmsdaa;\":\"⦨\",\"angmsdab;\":\"⦩\",\"angmsdac;\":\"⦪\",\"angmsdad;\":\"⦫\",\"angmsdae;\":\"⦬\",\"angmsdaf;\":\"⦭\",\"angmsdag;\":\"⦮\",\"angmsdah;\":\"⦯\",\"angmsd;\":\"∡\",\"angrt;\":\"∟\",\"angrtvb;\":\"⊾\",\"angrtvbd;\":\"⦝\",\"angsph;\":\"∢\",\"angst;\":\"Å\",\"angzarr;\":\"⍼\",\"Aogon;\":\"Ą\",\"aogon;\":\"ą\",\"Aopf;\":\"𝔸\",\"aopf;\":\"𝕒\",\"apacir;\":\"⩯\",\"ap;\":\"≈\",\"apE;\":\"⩰\",\"ape;\":\"≊\",\"apid;\":\"≋\",\"apos;\":\"'\",\"ApplyFunction;\":\"⁡\",\"approx;\":\"≈\",\"approxeq;\":\"≊\",\"Aring;\":\"Å\",Aring:\"Å\",\"aring;\":\"å\",aring:\"å\",\"Ascr;\":\"𝒜\",\"ascr;\":\"𝒶\",\"Assign;\":\"≔\",\"ast;\":\"*\",\"asymp;\":\"≈\",\"asympeq;\":\"≍\",\"Atilde;\":\"Ã\",Atilde:\"Ã\",\"atilde;\":\"ã\",atilde:\"ã\",\"Auml;\":\"Ä\",Auml:\"Ä\",\"auml;\":\"ä\",auml:\"ä\",\"awconint;\":\"∳\",\"awint;\":\"⨑\",\"backcong;\":\"≌\",\"backepsilon;\":\"϶\",\"backprime;\":\"‵\",\"backsim;\":\"∽\",\"backsimeq;\":\"⋍\",\"Backslash;\":\"∖\",\"Barv;\":\"⫧\",\"barvee;\":\"⊽\",\"barwed;\":\"⌅\",\"Barwed;\":\"⌆\",\"barwedge;\":\"⌅\",\"bbrk;\":\"⎵\",\"bbrktbrk;\":\"⎶\",\"bcong;\":\"≌\",\"Bcy;\":\"Б\",\"bcy;\":\"б\",\"bdquo;\":\"„\",\"becaus;\":\"∵\",\"because;\":\"∵\",\"Because;\":\"∵\",\"bemptyv;\":\"⦰\",\"bepsi;\":\"϶\",\"bernou;\":\"ℬ\",\"Bernoullis;\":\"ℬ\",\"Beta;\":\"Β\",\"beta;\":\"β\",\"beth;\":\"ℶ\",\"between;\":\"≬\",\"Bfr;\":\"𝔅\",\"bfr;\":\"𝔟\",\"bigcap;\":\"⋂\",\"bigcirc;\":\"◯\",\"bigcup;\":\"⋃\",\"bigodot;\":\"⨀\",\"bigoplus;\":\"⨁\",\"bigotimes;\":\"⨂\",\"bigsqcup;\":\"⨆\",\"bigstar;\":\"★\",\"bigtriangledown;\":\"▽\",\"bigtriangleup;\":\"△\",\"biguplus;\":\"⨄\",\"bigvee;\":\"⋁\",\"bigwedge;\":\"⋀\",\"bkarow;\":\"⤍\",\"blacklozenge;\":\"⧫\",\"blacksquare;\":\"▪\",\"blacktriangle;\":\"▴\",\"blacktriangledown;\":\"▾\",\"blacktriangleleft;\":\"◂\",\"blacktriangleright;\":\"▸\",\"blank;\":\"␣\",\"blk12;\":\"▒\",\"blk14;\":\"░\",\"blk34;\":\"▓\",\"block;\":\"█\",\"bne;\":\"=⃥\",\"bnequiv;\":\"≡⃥\",\"bNot;\":\"⫭\",\"bnot;\":\"⌐\",\"Bopf;\":\"𝔹\",\"bopf;\":\"𝕓\",\"bot;\":\"⊥\",\"bottom;\":\"⊥\",\"bowtie;\":\"⋈\",\"boxbox;\":\"⧉\",\"boxdl;\":\"┐\",\"boxdL;\":\"╕\",\"boxDl;\":\"╖\",\"boxDL;\":\"╗\",\"boxdr;\":\"┌\",\"boxdR;\":\"╒\",\"boxDr;\":\"╓\",\"boxDR;\":\"╔\",\"boxh;\":\"─\",\"boxH;\":\"═\",\"boxhd;\":\"┬\",\"boxHd;\":\"╤\",\"boxhD;\":\"╥\",\"boxHD;\":\"╦\",\"boxhu;\":\"┴\",\"boxHu;\":\"╧\",\"boxhU;\":\"╨\",\"boxHU;\":\"╩\",\"boxminus;\":\"⊟\",\"boxplus;\":\"⊞\",\"boxtimes;\":\"⊠\",\"boxul;\":\"┘\",\"boxuL;\":\"╛\",\"boxUl;\":\"╜\",\"boxUL;\":\"╝\",\"boxur;\":\"└\",\"boxuR;\":\"╘\",\"boxUr;\":\"╙\",\"boxUR;\":\"╚\",\"boxv;\":\"│\",\"boxV;\":\"║\",\"boxvh;\":\"┼\",\"boxvH;\":\"╪\",\"boxVh;\":\"╫\",\"boxVH;\":\"╬\",\"boxvl;\":\"┤\",\"boxvL;\":\"╡\",\"boxVl;\":\"╢\",\"boxVL;\":\"╣\",\"boxvr;\":\"├\",\"boxvR;\":\"╞\",\"boxVr;\":\"╟\",\"boxVR;\":\"╠\",\"bprime;\":\"‵\",\"breve;\":\"˘\",\"Breve;\":\"˘\",\"brvbar;\":\"¦\",brvbar:\"¦\",\"bscr;\":\"𝒷\",\"Bscr;\":\"ℬ\",\"bsemi;\":\"⁏\",\"bsim;\":\"∽\",\"bsime;\":\"⋍\",\"bsolb;\":\"⧅\",\"bsol;\":\"\\\\\",\"bsolhsub;\":\"⟈\",\"bull;\":\"•\",\"bullet;\":\"•\",\"bump;\":\"≎\",\"bumpE;\":\"⪮\",\"bumpe;\":\"≏\",\"Bumpeq;\":\"≎\",\"bumpeq;\":\"≏\",\"Cacute;\":\"Ć\",\"cacute;\":\"ć\",\"capand;\":\"⩄\",\"capbrcup;\":\"⩉\",\"capcap;\":\"⩋\",\"cap;\":\"∩\",\"Cap;\":\"⋒\",\"capcup;\":\"⩇\",\"capdot;\":\"⩀\",\"CapitalDifferentialD;\":\"ⅅ\",\"caps;\":\"∩︀\",\"caret;\":\"⁁\",\"caron;\":\"ˇ\",\"Cayleys;\":\"ℭ\",\"ccaps;\":\"⩍\",\"Ccaron;\":\"Č\",\"ccaron;\":\"č\",\"Ccedil;\":\"Ç\",Ccedil:\"Ç\",\"ccedil;\":\"ç\",ccedil:\"ç\",\"Ccirc;\":\"Ĉ\",\"ccirc;\":\"ĉ\",\"Cconint;\":\"∰\",\"ccups;\":\"⩌\",\"ccupssm;\":\"⩐\",\"Cdot;\":\"Ċ\",\"cdot;\":\"ċ\",\"cedil;\":\"¸\",cedil:\"¸\",\"Cedilla;\":\"¸\",\"cemptyv;\":\"⦲\",\"cent;\":\"¢\",cent:\"¢\",\"centerdot;\":\"·\",\"CenterDot;\":\"·\",\"cfr;\":\"𝔠\",\"Cfr;\":\"ℭ\",\"CHcy;\":\"Ч\",\"chcy;\":\"ч\",\"check;\":\"✓\",\"checkmark;\":\"✓\",\"Chi;\":\"Χ\",\"chi;\":\"χ\",\"circ;\":\"ˆ\",\"circeq;\":\"≗\",\"circlearrowleft;\":\"↺\",\"circlearrowright;\":\"↻\",\"circledast;\":\"⊛\",\"circledcirc;\":\"⊚\",\"circleddash;\":\"⊝\",\"CircleDot;\":\"⊙\",\"circledR;\":\"®\",\"circledS;\":\"Ⓢ\",\"CircleMinus;\":\"⊖\",\"CirclePlus;\":\"⊕\",\"CircleTimes;\":\"⊗\",\"cir;\":\"○\",\"cirE;\":\"⧃\",\"cire;\":\"≗\",\"cirfnint;\":\"⨐\",\"cirmid;\":\"⫯\",\"cirscir;\":\"⧂\",\"ClockwiseContourIntegral;\":\"∲\",\"CloseCurlyDoubleQuote;\":\"”\",\"CloseCurlyQuote;\":\"’\",\"clubs;\":\"♣\",\"clubsuit;\":\"♣\",\"colon;\":\":\",\"Colon;\":\"∷\",\"Colone;\":\"⩴\",\"colone;\":\"≔\",\"coloneq;\":\"≔\",\"comma;\":\",\",\"commat;\":\"@\",\"comp;\":\"∁\",\"compfn;\":\"∘\",\"complement;\":\"∁\",\"complexes;\":\"ℂ\",\"cong;\":\"≅\",\"congdot;\":\"⩭\",\"Congruent;\":\"≡\",\"conint;\":\"∮\",\"Conint;\":\"∯\",\"ContourIntegral;\":\"∮\",\"copf;\":\"𝕔\",\"Copf;\":\"ℂ\",\"coprod;\":\"∐\",\"Coproduct;\":\"∐\",\"copy;\":\"©\",copy:\"©\",\"COPY;\":\"©\",COPY:\"©\",\"copysr;\":\"℗\",\"CounterClockwiseContourIntegral;\":\"∳\",\"crarr;\":\"↵\",\"cross;\":\"✗\",\"Cross;\":\"⨯\",\"Cscr;\":\"𝒞\",\"cscr;\":\"𝒸\",\"csub;\":\"⫏\",\"csube;\":\"⫑\",\"csup;\":\"⫐\",\"csupe;\":\"⫒\",\"ctdot;\":\"⋯\",\"cudarrl;\":\"⤸\",\"cudarrr;\":\"⤵\",\"cuepr;\":\"⋞\",\"cuesc;\":\"⋟\",\"cularr;\":\"↶\",\"cularrp;\":\"⤽\",\"cupbrcap;\":\"⩈\",\"cupcap;\":\"⩆\",\"CupCap;\":\"≍\",\"cup;\":\"∪\",\"Cup;\":\"⋓\",\"cupcup;\":\"⩊\",\"cupdot;\":\"⊍\",\"cupor;\":\"⩅\",\"cups;\":\"∪︀\",\"curarr;\":\"↷\",\"curarrm;\":\"⤼\",\"curlyeqprec;\":\"⋞\",\"curlyeqsucc;\":\"⋟\",\"curlyvee;\":\"⋎\",\"curlywedge;\":\"⋏\",\"curren;\":\"¤\",curren:\"¤\",\"curvearrowleft;\":\"↶\",\"curvearrowright;\":\"↷\",\"cuvee;\":\"⋎\",\"cuwed;\":\"⋏\",\"cwconint;\":\"∲\",\"cwint;\":\"∱\",\"cylcty;\":\"⌭\",\"dagger;\":\"†\",\"Dagger;\":\"‡\",\"daleth;\":\"ℸ\",\"darr;\":\"↓\",\"Darr;\":\"↡\",\"dArr;\":\"⇓\",\"dash;\":\"‐\",\"Dashv;\":\"⫤\",\"dashv;\":\"⊣\",\"dbkarow;\":\"⤏\",\"dblac;\":\"˝\",\"Dcaron;\":\"Ď\",\"dcaron;\":\"ď\",\"Dcy;\":\"Д\",\"dcy;\":\"д\",\"ddagger;\":\"‡\",\"ddarr;\":\"⇊\",\"DD;\":\"ⅅ\",\"dd;\":\"ⅆ\",\"DDotrahd;\":\"⤑\",\"ddotseq;\":\"⩷\",\"deg;\":\"°\",deg:\"°\",\"Del;\":\"∇\",\"Delta;\":\"Δ\",\"delta;\":\"δ\",\"demptyv;\":\"⦱\",\"dfisht;\":\"⥿\",\"Dfr;\":\"𝔇\",\"dfr;\":\"𝔡\",\"dHar;\":\"⥥\",\"dharl;\":\"⇃\",\"dharr;\":\"⇂\",\"DiacriticalAcute;\":\"´\",\"DiacriticalDot;\":\"˙\",\"DiacriticalDoubleAcute;\":\"˝\",\"DiacriticalGrave;\":\"`\",\"DiacriticalTilde;\":\"˜\",\"diam;\":\"⋄\",\"diamond;\":\"⋄\",\"Diamond;\":\"⋄\",\"diamondsuit;\":\"♦\",\"diams;\":\"♦\",\"die;\":\"¨\",\"DifferentialD;\":\"ⅆ\",\"digamma;\":\"ϝ\",\"disin;\":\"⋲\",\"div;\":\"÷\",\"divide;\":\"÷\",divide:\"÷\",\"divideontimes;\":\"⋇\",\"divonx;\":\"⋇\",\"DJcy;\":\"Ђ\",\"djcy;\":\"ђ\",\"dlcorn;\":\"⌞\",\"dlcrop;\":\"⌍\",\"dollar;\":\"$\",\"Dopf;\":\"𝔻\",\"dopf;\":\"𝕕\",\"Dot;\":\"¨\",\"dot;\":\"˙\",\"DotDot;\":\"⃜\",\"doteq;\":\"≐\",\"doteqdot;\":\"≑\",\"DotEqual;\":\"≐\",\"dotminus;\":\"∸\",\"dotplus;\":\"∔\",\"dotsquare;\":\"⊡\",\"doublebarwedge;\":\"⌆\",\"DoubleContourIntegral;\":\"∯\",\"DoubleDot;\":\"¨\",\"DoubleDownArrow;\":\"⇓\",\"DoubleLeftArrow;\":\"⇐\",\"DoubleLeftRightArrow;\":\"⇔\",\"DoubleLeftTee;\":\"⫤\",\"DoubleLongLeftArrow;\":\"⟸\",\"DoubleLongLeftRightArrow;\":\"⟺\",\"DoubleLongRightArrow;\":\"⟹\",\"DoubleRightArrow;\":\"⇒\",\"DoubleRightTee;\":\"⊨\",\"DoubleUpArrow;\":\"⇑\",\"DoubleUpDownArrow;\":\"⇕\",\"DoubleVerticalBar;\":\"∥\",\"DownArrowBar;\":\"⤓\",\"downarrow;\":\"↓\",\"DownArrow;\":\"↓\",\"Downarrow;\":\"⇓\",\"DownArrowUpArrow;\":\"⇵\",\"DownBreve;\":\"̑\",\"downdownarrows;\":\"⇊\",\"downharpoonleft;\":\"⇃\",\"downharpoonright;\":\"⇂\",\"DownLeftRightVector;\":\"⥐\",\"DownLeftTeeVector;\":\"⥞\",\"DownLeftVectorBar;\":\"⥖\",\"DownLeftVector;\":\"↽\",\"DownRightTeeVector;\":\"⥟\",\"DownRightVectorBar;\":\"⥗\",\"DownRightVector;\":\"⇁\",\"DownTeeArrow;\":\"↧\",\"DownTee;\":\"⊤\",\"drbkarow;\":\"⤐\",\"drcorn;\":\"⌟\",\"drcrop;\":\"⌌\",\"Dscr;\":\"𝒟\",\"dscr;\":\"𝒹\",\"DScy;\":\"Ѕ\",\"dscy;\":\"ѕ\",\"dsol;\":\"⧶\",\"Dstrok;\":\"Đ\",\"dstrok;\":\"đ\",\"dtdot;\":\"⋱\",\"dtri;\":\"▿\",\"dtrif;\":\"▾\",\"duarr;\":\"⇵\",\"duhar;\":\"⥯\",\"dwangle;\":\"⦦\",\"DZcy;\":\"Џ\",\"dzcy;\":\"џ\",\"dzigrarr;\":\"⟿\",\"Eacute;\":\"É\",Eacute:\"É\",\"eacute;\":\"é\",eacute:\"é\",\"easter;\":\"⩮\",\"Ecaron;\":\"Ě\",\"ecaron;\":\"ě\",\"Ecirc;\":\"Ê\",Ecirc:\"Ê\",\"ecirc;\":\"ê\",ecirc:\"ê\",\"ecir;\":\"≖\",\"ecolon;\":\"≕\",\"Ecy;\":\"Э\",\"ecy;\":\"э\",\"eDDot;\":\"⩷\",\"Edot;\":\"Ė\",\"edot;\":\"ė\",\"eDot;\":\"≑\",\"ee;\":\"ⅇ\",\"efDot;\":\"≒\",\"Efr;\":\"𝔈\",\"efr;\":\"𝔢\",\"eg;\":\"⪚\",\"Egrave;\":\"È\",Egrave:\"È\",\"egrave;\":\"è\",egrave:\"è\",\"egs;\":\"⪖\",\"egsdot;\":\"⪘\",\"el;\":\"⪙\",\"Element;\":\"∈\",\"elinters;\":\"⏧\",\"ell;\":\"ℓ\",\"els;\":\"⪕\",\"elsdot;\":\"⪗\",\"Emacr;\":\"Ē\",\"emacr;\":\"ē\",\"empty;\":\"∅\",\"emptyset;\":\"∅\",\"EmptySmallSquare;\":\"◻\",\"emptyv;\":\"∅\",\"EmptyVerySmallSquare;\":\"▫\",\"emsp13;\":\" \",\"emsp14;\":\" \",\"emsp;\":\" \",\"ENG;\":\"Ŋ\",\"eng;\":\"ŋ\",\"ensp;\":\" \",\"Eogon;\":\"Ę\",\"eogon;\":\"ę\",\"Eopf;\":\"𝔼\",\"eopf;\":\"𝕖\",\"epar;\":\"⋕\",\"eparsl;\":\"⧣\",\"eplus;\":\"⩱\",\"epsi;\":\"ε\",\"Epsilon;\":\"Ε\",\"epsilon;\":\"ε\",\"epsiv;\":\"ϵ\",\"eqcirc;\":\"≖\",\"eqcolon;\":\"≕\",\"eqsim;\":\"≂\",\"eqslantgtr;\":\"⪖\",\"eqslantless;\":\"⪕\",\"Equal;\":\"⩵\",\"equals;\":\"=\",\"EqualTilde;\":\"≂\",\"equest;\":\"≟\",\"Equilibrium;\":\"⇌\",\"equiv;\":\"≡\",\"equivDD;\":\"⩸\",\"eqvparsl;\":\"⧥\",\"erarr;\":\"⥱\",\"erDot;\":\"≓\",\"escr;\":\"ℯ\",\"Escr;\":\"ℰ\",\"esdot;\":\"≐\",\"Esim;\":\"⩳\",\"esim;\":\"≂\",\"Eta;\":\"Η\",\"eta;\":\"η\",\"ETH;\":\"Ð\",ETH:\"Ð\",\"eth;\":\"ð\",eth:\"ð\",\"Euml;\":\"Ë\",Euml:\"Ë\",\"euml;\":\"ë\",euml:\"ë\",\"euro;\":\"€\",\"excl;\":\"!\",\"exist;\":\"∃\",\"Exists;\":\"∃\",\"expectation;\":\"ℰ\",\"exponentiale;\":\"ⅇ\",\"ExponentialE;\":\"ⅇ\",\"fallingdotseq;\":\"≒\",\"Fcy;\":\"Ф\",\"fcy;\":\"ф\",\"female;\":\"♀\",\"ffilig;\":\"ﬃ\",\"fflig;\":\"ﬀ\",\"ffllig;\":\"ﬄ\",\"Ffr;\":\"𝔉\",\"ffr;\":\"𝔣\",\"filig;\":\"ﬁ\",\"FilledSmallSquare;\":\"◼\",\"FilledVerySmallSquare;\":\"▪\",\"fjlig;\":\"fj\",\"flat;\":\"♭\",\"fllig;\":\"ﬂ\",\"fltns;\":\"▱\",\"fnof;\":\"ƒ\",\"Fopf;\":\"𝔽\",\"fopf;\":\"𝕗\",\"forall;\":\"∀\",\"ForAll;\":\"∀\",\"fork;\":\"⋔\",\"forkv;\":\"⫙\",\"Fouriertrf;\":\"ℱ\",\"fpartint;\":\"⨍\",\"frac12;\":\"½\",frac12:\"½\",\"frac13;\":\"⅓\",\"frac14;\":\"¼\",frac14:\"¼\",\"frac15;\":\"⅕\",\"frac16;\":\"⅙\",\"frac18;\":\"⅛\",\"frac23;\":\"⅔\",\"frac25;\":\"⅖\",\"frac34;\":\"¾\",frac34:\"¾\",\"frac35;\":\"⅗\",\"frac38;\":\"⅜\",\"frac45;\":\"⅘\",\"frac56;\":\"⅚\",\"frac58;\":\"⅝\",\"frac78;\":\"⅞\",\"frasl;\":\"⁄\",\"frown;\":\"⌢\",\"fscr;\":\"𝒻\",\"Fscr;\":\"ℱ\",\"gacute;\":\"ǵ\",\"Gamma;\":\"Γ\",\"gamma;\":\"γ\",\"Gammad;\":\"Ϝ\",\"gammad;\":\"ϝ\",\"gap;\":\"⪆\",\"Gbreve;\":\"Ğ\",\"gbreve;\":\"ğ\",\"Gcedil;\":\"Ģ\",\"Gcirc;\":\"Ĝ\",\"gcirc;\":\"ĝ\",\"Gcy;\":\"Г\",\"gcy;\":\"г\",\"Gdot;\":\"Ġ\",\"gdot;\":\"ġ\",\"ge;\":\"≥\",\"gE;\":\"≧\",\"gEl;\":\"⪌\",\"gel;\":\"⋛\",\"geq;\":\"≥\",\"geqq;\":\"≧\",\"geqslant;\":\"⩾\",\"gescc;\":\"⪩\",\"ges;\":\"⩾\",\"gesdot;\":\"⪀\",\"gesdoto;\":\"⪂\",\"gesdotol;\":\"⪄\",\"gesl;\":\"⋛︀\",\"gesles;\":\"⪔\",\"Gfr;\":\"𝔊\",\"gfr;\":\"𝔤\",\"gg;\":\"≫\",\"Gg;\":\"⋙\",\"ggg;\":\"⋙\",\"gimel;\":\"ℷ\",\"GJcy;\":\"Ѓ\",\"gjcy;\":\"ѓ\",\"gla;\":\"⪥\",\"gl;\":\"≷\",\"glE;\":\"⪒\",\"glj;\":\"⪤\",\"gnap;\":\"⪊\",\"gnapprox;\":\"⪊\",\"gne;\":\"⪈\",\"gnE;\":\"≩\",\"gneq;\":\"⪈\",\"gneqq;\":\"≩\",\"gnsim;\":\"⋧\",\"Gopf;\":\"𝔾\",\"gopf;\":\"𝕘\",\"grave;\":\"`\",\"GreaterEqual;\":\"≥\",\"GreaterEqualLess;\":\"⋛\",\"GreaterFullEqual;\":\"≧\",\"GreaterGreater;\":\"⪢\",\"GreaterLess;\":\"≷\",\"GreaterSlantEqual;\":\"⩾\",\"GreaterTilde;\":\"≳\",\"Gscr;\":\"𝒢\",\"gscr;\":\"ℊ\",\"gsim;\":\"≳\",\"gsime;\":\"⪎\",\"gsiml;\":\"⪐\",\"gtcc;\":\"⪧\",\"gtcir;\":\"⩺\",\"gt;\":\">\",gt:\">\",\"GT;\":\">\",GT:\">\",\"Gt;\":\"≫\",\"gtdot;\":\"⋗\",\"gtlPar;\":\"⦕\",\"gtquest;\":\"⩼\",\"gtrapprox;\":\"⪆\",\"gtrarr;\":\"⥸\",\"gtrdot;\":\"⋗\",\"gtreqless;\":\"⋛\",\"gtreqqless;\":\"⪌\",\"gtrless;\":\"≷\",\"gtrsim;\":\"≳\",\"gvertneqq;\":\"≩︀\",\"gvnE;\":\"≩︀\",\"Hacek;\":\"ˇ\",\"hairsp;\":\" \",\"half;\":\"½\",\"hamilt;\":\"ℋ\",\"HARDcy;\":\"Ъ\",\"hardcy;\":\"ъ\",\"harrcir;\":\"⥈\",\"harr;\":\"↔\",\"hArr;\":\"⇔\",\"harrw;\":\"↭\",\"Hat;\":\"^\",\"hbar;\":\"ℏ\",\"Hcirc;\":\"Ĥ\",\"hcirc;\":\"ĥ\",\"hearts;\":\"♥\",\"heartsuit;\":\"♥\",\"hellip;\":\"…\",\"hercon;\":\"⊹\",\"hfr;\":\"𝔥\",\"Hfr;\":\"ℌ\",\"HilbertSpace;\":\"ℋ\",\"hksearow;\":\"⤥\",\"hkswarow;\":\"⤦\",\"hoarr;\":\"⇿\",\"homtht;\":\"∻\",\"hookleftarrow;\":\"↩\",\"hookrightarrow;\":\"↪\",\"hopf;\":\"𝕙\",\"Hopf;\":\"ℍ\",\"horbar;\":\"―\",\"HorizontalLine;\":\"─\",\"hscr;\":\"𝒽\",\"Hscr;\":\"ℋ\",\"hslash;\":\"ℏ\",\"Hstrok;\":\"Ħ\",\"hstrok;\":\"ħ\",\"HumpDownHump;\":\"≎\",\"HumpEqual;\":\"≏\",\"hybull;\":\"⁃\",\"hyphen;\":\"‐\",\"Iacute;\":\"Í\",Iacute:\"Í\",\"iacute;\":\"í\",iacute:\"í\",\"ic;\":\"⁣\",\"Icirc;\":\"Î\",Icirc:\"Î\",\"icirc;\":\"î\",icirc:\"î\",\"Icy;\":\"И\",\"icy;\":\"и\",\"Idot;\":\"İ\",\"IEcy;\":\"Е\",\"iecy;\":\"е\",\"iexcl;\":\"¡\",iexcl:\"¡\",\"iff;\":\"⇔\",\"ifr;\":\"𝔦\",\"Ifr;\":\"ℑ\",\"Igrave;\":\"Ì\",Igrave:\"Ì\",\"igrave;\":\"ì\",igrave:\"ì\",\"ii;\":\"ⅈ\",\"iiiint;\":\"⨌\",\"iiint;\":\"∭\",\"iinfin;\":\"⧜\",\"iiota;\":\"℩\",\"IJlig;\":\"Ĳ\",\"ijlig;\":\"ĳ\",\"Imacr;\":\"Ī\",\"imacr;\":\"ī\",\"image;\":\"ℑ\",\"ImaginaryI;\":\"ⅈ\",\"imagline;\":\"ℐ\",\"imagpart;\":\"ℑ\",\"imath;\":\"ı\",\"Im;\":\"ℑ\",\"imof;\":\"⊷\",\"imped;\":\"Ƶ\",\"Implies;\":\"⇒\",\"incare;\":\"℅\",\"in;\":\"∈\",\"infin;\":\"∞\",\"infintie;\":\"⧝\",\"inodot;\":\"ı\",\"intcal;\":\"⊺\",\"int;\":\"∫\",\"Int;\":\"∬\",\"integers;\":\"ℤ\",\"Integral;\":\"∫\",\"intercal;\":\"⊺\",\"Intersection;\":\"⋂\",\"intlarhk;\":\"⨗\",\"intprod;\":\"⨼\",\"InvisibleComma;\":\"⁣\",\"InvisibleTimes;\":\"⁢\",\"IOcy;\":\"Ё\",\"iocy;\":\"ё\",\"Iogon;\":\"Į\",\"iogon;\":\"į\",\"Iopf;\":\"𝕀\",\"iopf;\":\"𝕚\",\"Iota;\":\"Ι\",\"iota;\":\"ι\",\"iprod;\":\"⨼\",\"iquest;\":\"¿\",iquest:\"¿\",\"iscr;\":\"𝒾\",\"Iscr;\":\"ℐ\",\"isin;\":\"∈\",\"isindot;\":\"⋵\",\"isinE;\":\"⋹\",\"isins;\":\"⋴\",\"isinsv;\":\"⋳\",\"isinv;\":\"∈\",\"it;\":\"⁢\",\"Itilde;\":\"Ĩ\",\"itilde;\":\"ĩ\",\"Iukcy;\":\"І\",\"iukcy;\":\"і\",\"Iuml;\":\"Ï\",Iuml:\"Ï\",\"iuml;\":\"ï\",iuml:\"ï\",\"Jcirc;\":\"Ĵ\",\"jcirc;\":\"ĵ\",\"Jcy;\":\"Й\",\"jcy;\":\"й\",\"Jfr;\":\"𝔍\",\"jfr;\":\"𝔧\",\"jmath;\":\"ȷ\",\"Jopf;\":\"𝕁\",\"jopf;\":\"𝕛\",\"Jscr;\":\"𝒥\",\"jscr;\":\"𝒿\",\"Jsercy;\":\"Ј\",\"jsercy;\":\"ј\",\"Jukcy;\":\"Є\",\"jukcy;\":\"є\",\"Kappa;\":\"Κ\",\"kappa;\":\"κ\",\"kappav;\":\"ϰ\",\"Kcedil;\":\"Ķ\",\"kcedil;\":\"ķ\",\"Kcy;\":\"К\",\"kcy;\":\"к\",\"Kfr;\":\"𝔎\",\"kfr;\":\"𝔨\",\"kgreen;\":\"ĸ\",\"KHcy;\":\"Х\",\"khcy;\":\"х\",\"KJcy;\":\"Ќ\",\"kjcy;\":\"ќ\",\"Kopf;\":\"𝕂\",\"kopf;\":\"𝕜\",\"Kscr;\":\"𝒦\",\"kscr;\":\"𝓀\",\"lAarr;\":\"⇚\",\"Lacute;\":\"Ĺ\",\"lacute;\":\"ĺ\",\"laemptyv;\":\"⦴\",\"lagran;\":\"ℒ\",\"Lambda;\":\"Λ\",\"lambda;\":\"λ\",\"lang;\":\"⟨\",\"Lang;\":\"⟪\",\"langd;\":\"⦑\",\"langle;\":\"⟨\",\"lap;\":\"⪅\",\"Laplacetrf;\":\"ℒ\",\"laquo;\":\"«\",laquo:\"«\",\"larrb;\":\"⇤\",\"larrbfs;\":\"⤟\",\"larr;\":\"←\",\"Larr;\":\"↞\",\"lArr;\":\"⇐\",\"larrfs;\":\"⤝\",\"larrhk;\":\"↩\",\"larrlp;\":\"↫\",\"larrpl;\":\"⤹\",\"larrsim;\":\"⥳\",\"larrtl;\":\"↢\",\"latail;\":\"⤙\",\"lAtail;\":\"⤛\",\"lat;\":\"⪫\",\"late;\":\"⪭\",\"lates;\":\"⪭︀\",\"lbarr;\":\"⤌\",\"lBarr;\":\"⤎\",\"lbbrk;\":\"❲\",\"lbrace;\":\"{\",\"lbrack;\":\"[\",\"lbrke;\":\"⦋\",\"lbrksld;\":\"⦏\",\"lbrkslu;\":\"⦍\",\"Lcaron;\":\"Ľ\",\"lcaron;\":\"ľ\",\"Lcedil;\":\"Ļ\",\"lcedil;\":\"ļ\",\"lceil;\":\"⌈\",\"lcub;\":\"{\",\"Lcy;\":\"Л\",\"lcy;\":\"л\",\"ldca;\":\"⤶\",\"ldquo;\":\"“\",\"ldquor;\":\"„\",\"ldrdhar;\":\"⥧\",\"ldrushar;\":\"⥋\",\"ldsh;\":\"↲\",\"le;\":\"≤\",\"lE;\":\"≦\",\"LeftAngleBracket;\":\"⟨\",\"LeftArrowBar;\":\"⇤\",\"leftarrow;\":\"←\",\"LeftArrow;\":\"←\",\"Leftarrow;\":\"⇐\",\"LeftArrowRightArrow;\":\"⇆\",\"leftarrowtail;\":\"↢\",\"LeftCeiling;\":\"⌈\",\"LeftDoubleBracket;\":\"⟦\",\"LeftDownTeeVector;\":\"⥡\",\"LeftDownVectorBar;\":\"⥙\",\"LeftDownVector;\":\"⇃\",\"LeftFloor;\":\"⌊\",\"leftharpoondown;\":\"↽\",\"leftharpoonup;\":\"↼\",\"leftleftarrows;\":\"⇇\",\"leftrightarrow;\":\"↔\",\"LeftRightArrow;\":\"↔\",\"Leftrightarrow;\":\"⇔\",\"leftrightarrows;\":\"⇆\",\"leftrightharpoons;\":\"⇋\",\"leftrightsquigarrow;\":\"↭\",\"LeftRightVector;\":\"⥎\",\"LeftTeeArrow;\":\"↤\",\"LeftTee;\":\"⊣\",\"LeftTeeVector;\":\"⥚\",\"leftthreetimes;\":\"⋋\",\"LeftTriangleBar;\":\"⧏\",\"LeftTriangle;\":\"⊲\",\"LeftTriangleEqual;\":\"⊴\",\"LeftUpDownVector;\":\"⥑\",\"LeftUpTeeVector;\":\"⥠\",\"LeftUpVectorBar;\":\"⥘\",\"LeftUpVector;\":\"↿\",\"LeftVectorBar;\":\"⥒\",\"LeftVector;\":\"↼\",\"lEg;\":\"⪋\",\"leg;\":\"⋚\",\"leq;\":\"≤\",\"leqq;\":\"≦\",\"leqslant;\":\"⩽\",\"lescc;\":\"⪨\",\"les;\":\"⩽\",\"lesdot;\":\"⩿\",\"lesdoto;\":\"⪁\",\"lesdotor;\":\"⪃\",\"lesg;\":\"⋚︀\",\"lesges;\":\"⪓\",\"lessapprox;\":\"⪅\",\"lessdot;\":\"⋖\",\"lesseqgtr;\":\"⋚\",\"lesseqqgtr;\":\"⪋\",\"LessEqualGreater;\":\"⋚\",\"LessFullEqual;\":\"≦\",\"LessGreater;\":\"≶\",\"lessgtr;\":\"≶\",\"LessLess;\":\"⪡\",\"lesssim;\":\"≲\",\"LessSlantEqual;\":\"⩽\",\"LessTilde;\":\"≲\",\"lfisht;\":\"⥼\",\"lfloor;\":\"⌊\",\"Lfr;\":\"𝔏\",\"lfr;\":\"𝔩\",\"lg;\":\"≶\",\"lgE;\":\"⪑\",\"lHar;\":\"⥢\",\"lhard;\":\"↽\",\"lharu;\":\"↼\",\"lharul;\":\"⥪\",\"lhblk;\":\"▄\",\"LJcy;\":\"Љ\",\"ljcy;\":\"љ\",\"llarr;\":\"⇇\",\"ll;\":\"≪\",\"Ll;\":\"⋘\",\"llcorner;\":\"⌞\",\"Lleftarrow;\":\"⇚\",\"llhard;\":\"⥫\",\"lltri;\":\"◺\",\"Lmidot;\":\"Ŀ\",\"lmidot;\":\"ŀ\",\"lmoustache;\":\"⎰\",\"lmoust;\":\"⎰\",\"lnap;\":\"⪉\",\"lnapprox;\":\"⪉\",\"lne;\":\"⪇\",\"lnE;\":\"≨\",\"lneq;\":\"⪇\",\"lneqq;\":\"≨\",\"lnsim;\":\"⋦\",\"loang;\":\"⟬\",\"loarr;\":\"⇽\",\"lobrk;\":\"⟦\",\"longleftarrow;\":\"⟵\",\"LongLeftArrow;\":\"⟵\",\"Longleftarrow;\":\"⟸\",\"longleftrightarrow;\":\"⟷\",\"LongLeftRightArrow;\":\"⟷\",\"Longleftrightarrow;\":\"⟺\",\"longmapsto;\":\"⟼\",\"longrightarrow;\":\"⟶\",\"LongRightArrow;\":\"⟶\",\"Longrightarrow;\":\"⟹\",\"looparrowleft;\":\"↫\",\"looparrowright;\":\"↬\",\"lopar;\":\"⦅\",\"Lopf;\":\"𝕃\",\"lopf;\":\"𝕝\",\"loplus;\":\"⨭\",\"lotimes;\":\"⨴\",\"lowast;\":\"∗\",\"lowbar;\":\"_\",\"LowerLeftArrow;\":\"↙\",\"LowerRightArrow;\":\"↘\",\"loz;\":\"◊\",\"lozenge;\":\"◊\",\"lozf;\":\"⧫\",\"lpar;\":\"(\",\"lparlt;\":\"⦓\",\"lrarr;\":\"⇆\",\"lrcorner;\":\"⌟\",\"lrhar;\":\"⇋\",\"lrhard;\":\"⥭\",\"lrm;\":\"‎\",\"lrtri;\":\"⊿\",\"lsaquo;\":\"‹\",\"lscr;\":\"𝓁\",\"Lscr;\":\"ℒ\",\"lsh;\":\"↰\",\"Lsh;\":\"↰\",\"lsim;\":\"≲\",\"lsime;\":\"⪍\",\"lsimg;\":\"⪏\",\"lsqb;\":\"[\",\"lsquo;\":\"‘\",\"lsquor;\":\"‚\",\"Lstrok;\":\"Ł\",\"lstrok;\":\"ł\",\"ltcc;\":\"⪦\",\"ltcir;\":\"⩹\",\"lt;\":\"<\",lt:\"<\",\"LT;\":\"<\",LT:\"<\",\"Lt;\":\"≪\",\"ltdot;\":\"⋖\",\"lthree;\":\"⋋\",\"ltimes;\":\"⋉\",\"ltlarr;\":\"⥶\",\"ltquest;\":\"⩻\",\"ltri;\":\"◃\",\"ltrie;\":\"⊴\",\"ltrif;\":\"◂\",\"ltrPar;\":\"⦖\",\"lurdshar;\":\"⥊\",\"luruhar;\":\"⥦\",\"lvertneqq;\":\"≨︀\",\"lvnE;\":\"≨︀\",\"macr;\":\"¯\",macr:\"¯\",\"male;\":\"♂\",\"malt;\":\"✠\",\"maltese;\":\"✠\",\"Map;\":\"⤅\",\"map;\":\"↦\",\"mapsto;\":\"↦\",\"mapstodown;\":\"↧\",\"mapstoleft;\":\"↤\",\"mapstoup;\":\"↥\",\"marker;\":\"▮\",\"mcomma;\":\"⨩\",\"Mcy;\":\"М\",\"mcy;\":\"м\",\"mdash;\":\"—\",\"mDDot;\":\"∺\",\"measuredangle;\":\"∡\",\"MediumSpace;\":\" \",\"Mellintrf;\":\"ℳ\",\"Mfr;\":\"𝔐\",\"mfr;\":\"𝔪\",\"mho;\":\"℧\",\"micro;\":\"µ\",micro:\"µ\",\"midast;\":\"*\",\"midcir;\":\"⫰\",\"mid;\":\"∣\",\"middot;\":\"·\",middot:\"·\",\"minusb;\":\"⊟\",\"minus;\":\"−\",\"minusd;\":\"∸\",\"minusdu;\":\"⨪\",\"MinusPlus;\":\"∓\",\"mlcp;\":\"⫛\",\"mldr;\":\"…\",\"mnplus;\":\"∓\",\"models;\":\"⊧\",\"Mopf;\":\"𝕄\",\"mopf;\":\"𝕞\",\"mp;\":\"∓\",\"mscr;\":\"𝓂\",\"Mscr;\":\"ℳ\",\"mstpos;\":\"∾\",\"Mu;\":\"Μ\",\"mu;\":\"μ\",\"multimap;\":\"⊸\",\"mumap;\":\"⊸\",\"nabla;\":\"∇\",\"Nacute;\":\"Ń\",\"nacute;\":\"ń\",\"nang;\":\"∠⃒\",\"nap;\":\"≉\",\"napE;\":\"⩰̸\",\"napid;\":\"≋̸\",\"napos;\":\"ŉ\",\"napprox;\":\"≉\",\"natural;\":\"♮\",\"naturals;\":\"ℕ\",\"natur;\":\"♮\",\"nbsp;\":\" \",nbsp:\" \",\"nbump;\":\"≎̸\",\"nbumpe;\":\"≏̸\",\"ncap;\":\"⩃\",\"Ncaron;\":\"Ň\",\"ncaron;\":\"ň\",\"Ncedil;\":\"Ņ\",\"ncedil;\":\"ņ\",\"ncong;\":\"≇\",\"ncongdot;\":\"⩭̸\",\"ncup;\":\"⩂\",\"Ncy;\":\"Н\",\"ncy;\":\"н\",\"ndash;\":\"–\",\"nearhk;\":\"⤤\",\"nearr;\":\"↗\",\"neArr;\":\"⇗\",\"nearrow;\":\"↗\",\"ne;\":\"≠\",\"nedot;\":\"≐̸\",\"NegativeMediumSpace;\":\"​\",\"NegativeThickSpace;\":\"​\",\"NegativeThinSpace;\":\"​\",\"NegativeVeryThinSpace;\":\"​\",\"nequiv;\":\"≢\",\"nesear;\":\"⤨\",\"nesim;\":\"≂̸\",\"NestedGreaterGreater;\":\"≫\",\"NestedLessLess;\":\"≪\",\"NewLine;\":\"\\n\",\"nexist;\":\"∄\",\"nexists;\":\"∄\",\"Nfr;\":\"𝔑\",\"nfr;\":\"𝔫\",\"ngE;\":\"≧̸\",\"nge;\":\"≱\",\"ngeq;\":\"≱\",\"ngeqq;\":\"≧̸\",\"ngeqslant;\":\"⩾̸\",\"nges;\":\"⩾̸\",\"nGg;\":\"⋙̸\",\"ngsim;\":\"≵\",\"nGt;\":\"≫⃒\",\"ngt;\":\"≯\",\"ngtr;\":\"≯\",\"nGtv;\":\"≫̸\",\"nharr;\":\"↮\",\"nhArr;\":\"⇎\",\"nhpar;\":\"⫲\",\"ni;\":\"∋\",\"nis;\":\"⋼\",\"nisd;\":\"⋺\",\"niv;\":\"∋\",\"NJcy;\":\"Њ\",\"njcy;\":\"њ\",\"nlarr;\":\"↚\",\"nlArr;\":\"⇍\",\"nldr;\":\"‥\",\"nlE;\":\"≦̸\",\"nle;\":\"≰\",\"nleftarrow;\":\"↚\",\"nLeftarrow;\":\"⇍\",\"nleftrightarrow;\":\"↮\",\"nLeftrightarrow;\":\"⇎\",\"nleq;\":\"≰\",\"nleqq;\":\"≦̸\",\"nleqslant;\":\"⩽̸\",\"nles;\":\"⩽̸\",\"nless;\":\"≮\",\"nLl;\":\"⋘̸\",\"nlsim;\":\"≴\",\"nLt;\":\"≪⃒\",\"nlt;\":\"≮\",\"nltri;\":\"⋪\",\"nltrie;\":\"⋬\",\"nLtv;\":\"≪̸\",\"nmid;\":\"∤\",\"NoBreak;\":\"⁠\",\"NonBreakingSpace;\":\" \",\"nopf;\":\"𝕟\",\"Nopf;\":\"ℕ\",\"Not;\":\"⫬\",\"not;\":\"¬\",not:\"¬\",\"NotCongruent;\":\"≢\",\"NotCupCap;\":\"≭\",\"NotDoubleVerticalBar;\":\"∦\",\"NotElement;\":\"∉\",\"NotEqual;\":\"≠\",\"NotEqualTilde;\":\"≂̸\",\"NotExists;\":\"∄\",\"NotGreater;\":\"≯\",\"NotGreaterEqual;\":\"≱\",\"NotGreaterFullEqual;\":\"≧̸\",\"NotGreaterGreater;\":\"≫̸\",\"NotGreaterLess;\":\"≹\",\"NotGreaterSlantEqual;\":\"⩾̸\",\"NotGreaterTilde;\":\"≵\",\"NotHumpDownHump;\":\"≎̸\",\"NotHumpEqual;\":\"≏̸\",\"notin;\":\"∉\",\"notindot;\":\"⋵̸\",\"notinE;\":\"⋹̸\",\"notinva;\":\"∉\",\"notinvb;\":\"⋷\",\"notinvc;\":\"⋶\",\"NotLeftTriangleBar;\":\"⧏̸\",\"NotLeftTriangle;\":\"⋪\",\"NotLeftTriangleEqual;\":\"⋬\",\"NotLess;\":\"≮\",\"NotLessEqual;\":\"≰\",\"NotLessGreater;\":\"≸\",\"NotLessLess;\":\"≪̸\",\"NotLessSlantEqual;\":\"⩽̸\",\"NotLessTilde;\":\"≴\",\"NotNestedGreaterGreater;\":\"⪢̸\",\"NotNestedLessLess;\":\"⪡̸\",\"notni;\":\"∌\",\"notniva;\":\"∌\",\"notnivb;\":\"⋾\",\"notnivc;\":\"⋽\",\"NotPrecedes;\":\"⊀\",\"NotPrecedesEqual;\":\"⪯̸\",\"NotPrecedesSlantEqual;\":\"⋠\",\"NotReverseElement;\":\"∌\",\"NotRightTriangleBar;\":\"⧐̸\",\"NotRightTriangle;\":\"⋫\",\"NotRightTriangleEqual;\":\"⋭\",\"NotSquareSubset;\":\"⊏̸\",\"NotSquareSubsetEqual;\":\"⋢\",\"NotSquareSuperset;\":\"⊐̸\",\"NotSquareSupersetEqual;\":\"⋣\",\"NotSubset;\":\"⊂⃒\",\"NotSubsetEqual;\":\"⊈\",\"NotSucceeds;\":\"⊁\",\"NotSucceedsEqual;\":\"⪰̸\",\"NotSucceedsSlantEqual;\":\"⋡\",\"NotSucceedsTilde;\":\"≿̸\",\"NotSuperset;\":\"⊃⃒\",\"NotSupersetEqual;\":\"⊉\",\"NotTilde;\":\"≁\",\"NotTildeEqual;\":\"≄\",\"NotTildeFullEqual;\":\"≇\",\"NotTildeTilde;\":\"≉\",\"NotVerticalBar;\":\"∤\",\"nparallel;\":\"∦\",\"npar;\":\"∦\",\"nparsl;\":\"⫽⃥\",\"npart;\":\"∂̸\",\"npolint;\":\"⨔\",\"npr;\":\"⊀\",\"nprcue;\":\"⋠\",\"nprec;\":\"⊀\",\"npreceq;\":\"⪯̸\",\"npre;\":\"⪯̸\",\"nrarrc;\":\"⤳̸\",\"nrarr;\":\"↛\",\"nrArr;\":\"⇏\",\"nrarrw;\":\"↝̸\",\"nrightarrow;\":\"↛\",\"nRightarrow;\":\"⇏\",\"nrtri;\":\"⋫\",\"nrtrie;\":\"⋭\",\"nsc;\":\"⊁\",\"nsccue;\":\"⋡\",\"nsce;\":\"⪰̸\",\"Nscr;\":\"𝒩\",\"nscr;\":\"𝓃\",\"nshortmid;\":\"∤\",\"nshortparallel;\":\"∦\",\"nsim;\":\"≁\",\"nsime;\":\"≄\",\"nsimeq;\":\"≄\",\"nsmid;\":\"∤\",\"nspar;\":\"∦\",\"nsqsube;\":\"⋢\",\"nsqsupe;\":\"⋣\",\"nsub;\":\"⊄\",\"nsubE;\":\"⫅̸\",\"nsube;\":\"⊈\",\"nsubset;\":\"⊂⃒\",\"nsubseteq;\":\"⊈\",\"nsubseteqq;\":\"⫅̸\",\"nsucc;\":\"⊁\",\"nsucceq;\":\"⪰̸\",\"nsup;\":\"⊅\",\"nsupE;\":\"⫆̸\",\"nsupe;\":\"⊉\",\"nsupset;\":\"⊃⃒\",\"nsupseteq;\":\"⊉\",\"nsupseteqq;\":\"⫆̸\",\"ntgl;\":\"≹\",\"Ntilde;\":\"Ñ\",Ntilde:\"Ñ\",\"ntilde;\":\"ñ\",ntilde:\"ñ\",\"ntlg;\":\"≸\",\"ntriangleleft;\":\"⋪\",\"ntrianglelefteq;\":\"⋬\",\"ntriangleright;\":\"⋫\",\"ntrianglerighteq;\":\"⋭\",\"Nu;\":\"Ν\",\"nu;\":\"ν\",\"num;\":\"#\",\"numero;\":\"№\",\"numsp;\":\" \",\"nvap;\":\"≍⃒\",\"nvdash;\":\"⊬\",\"nvDash;\":\"⊭\",\"nVdash;\":\"⊮\",\"nVDash;\":\"⊯\",\"nvge;\":\"≥⃒\",\"nvgt;\":\">⃒\",\"nvHarr;\":\"⤄\",\"nvinfin;\":\"⧞\",\"nvlArr;\":\"⤂\",\"nvle;\":\"≤⃒\",\"nvlt;\":\"<⃒\",\"nvltrie;\":\"⊴⃒\",\"nvrArr;\":\"⤃\",\"nvrtrie;\":\"⊵⃒\",\"nvsim;\":\"∼⃒\",\"nwarhk;\":\"⤣\",\"nwarr;\":\"↖\",\"nwArr;\":\"⇖\",\"nwarrow;\":\"↖\",\"nwnear;\":\"⤧\",\"Oacute;\":\"Ó\",Oacute:\"Ó\",\"oacute;\":\"ó\",oacute:\"ó\",\"oast;\":\"⊛\",\"Ocirc;\":\"Ô\",Ocirc:\"Ô\",\"ocirc;\":\"ô\",ocirc:\"ô\",\"ocir;\":\"⊚\",\"Ocy;\":\"О\",\"ocy;\":\"о\",\"odash;\":\"⊝\",\"Odblac;\":\"Ő\",\"odblac;\":\"ő\",\"odiv;\":\"⨸\",\"odot;\":\"⊙\",\"odsold;\":\"⦼\",\"OElig;\":\"Œ\",\"oelig;\":\"œ\",\"ofcir;\":\"⦿\",\"Ofr;\":\"𝔒\",\"ofr;\":\"𝔬\",\"ogon;\":\"˛\",\"Ograve;\":\"Ò\",Ograve:\"Ò\",\"ograve;\":\"ò\",ograve:\"ò\",\"ogt;\":\"⧁\",\"ohbar;\":\"⦵\",\"ohm;\":\"Ω\",\"oint;\":\"∮\",\"olarr;\":\"↺\",\"olcir;\":\"⦾\",\"olcross;\":\"⦻\",\"oline;\":\"‾\",\"olt;\":\"⧀\",\"Omacr;\":\"Ō\",\"omacr;\":\"ō\",\"Omega;\":\"Ω\",\"omega;\":\"ω\",\"Omicron;\":\"Ο\",\"omicron;\":\"ο\",\"omid;\":\"⦶\",\"ominus;\":\"⊖\",\"Oopf;\":\"𝕆\",\"oopf;\":\"𝕠\",\"opar;\":\"⦷\",\"OpenCurlyDoubleQuote;\":\"“\",\"OpenCurlyQuote;\":\"‘\",\"operp;\":\"⦹\",\"oplus;\":\"⊕\",\"orarr;\":\"↻\",\"Or;\":\"⩔\",\"or;\":\"∨\",\"ord;\":\"⩝\",\"order;\":\"ℴ\",\"orderof;\":\"ℴ\",\"ordf;\":\"ª\",ordf:\"ª\",\"ordm;\":\"º\",ordm:\"º\",\"origof;\":\"⊶\",\"oror;\":\"⩖\",\"orslope;\":\"⩗\",\"orv;\":\"⩛\",\"oS;\":\"Ⓢ\",\"Oscr;\":\"𝒪\",\"oscr;\":\"ℴ\",\"Oslash;\":\"Ø\",Oslash:\"Ø\",\"oslash;\":\"ø\",oslash:\"ø\",\"osol;\":\"⊘\",\"Otilde;\":\"Õ\",Otilde:\"Õ\",\"otilde;\":\"õ\",otilde:\"õ\",\"otimesas;\":\"⨶\",\"Otimes;\":\"⨷\",\"otimes;\":\"⊗\",\"Ouml;\":\"Ö\",Ouml:\"Ö\",\"ouml;\":\"ö\",ouml:\"ö\",\"ovbar;\":\"⌽\",\"OverBar;\":\"‾\",\"OverBrace;\":\"⏞\",\"OverBracket;\":\"⎴\",\"OverParenthesis;\":\"⏜\",\"para;\":\"¶\",para:\"¶\",\"parallel;\":\"∥\",\"par;\":\"∥\",\"parsim;\":\"⫳\",\"parsl;\":\"⫽\",\"part;\":\"∂\",\"PartialD;\":\"∂\",\"Pcy;\":\"П\",\"pcy;\":\"п\",\"percnt;\":\"%\",\"period;\":\".\",\"permil;\":\"‰\",\"perp;\":\"⊥\",\"pertenk;\":\"‱\",\"Pfr;\":\"𝔓\",\"pfr;\":\"𝔭\",\"Phi;\":\"Φ\",\"phi;\":\"φ\",\"phiv;\":\"ϕ\",\"phmmat;\":\"ℳ\",\"phone;\":\"☎\",\"Pi;\":\"Π\",\"pi;\":\"π\",\"pitchfork;\":\"⋔\",\"piv;\":\"ϖ\",\"planck;\":\"ℏ\",\"planckh;\":\"ℎ\",\"plankv;\":\"ℏ\",\"plusacir;\":\"⨣\",\"plusb;\":\"⊞\",\"pluscir;\":\"⨢\",\"plus;\":\"+\",\"plusdo;\":\"∔\",\"plusdu;\":\"⨥\",\"pluse;\":\"⩲\",\"PlusMinus;\":\"±\",\"plusmn;\":\"±\",plusmn:\"±\",\"plussim;\":\"⨦\",\"plustwo;\":\"⨧\",\"pm;\":\"±\",\"Poincareplane;\":\"ℌ\",\"pointint;\":\"⨕\",\"popf;\":\"𝕡\",\"Popf;\":\"ℙ\",\"pound;\":\"£\",pound:\"£\",\"prap;\":\"⪷\",\"Pr;\":\"⪻\",\"pr;\":\"≺\",\"prcue;\":\"≼\",\"precapprox;\":\"⪷\",\"prec;\":\"≺\",\"preccurlyeq;\":\"≼\",\"Precedes;\":\"≺\",\"PrecedesEqual;\":\"⪯\",\"PrecedesSlantEqual;\":\"≼\",\"PrecedesTilde;\":\"≾\",\"preceq;\":\"⪯\",\"precnapprox;\":\"⪹\",\"precneqq;\":\"⪵\",\"precnsim;\":\"⋨\",\"pre;\":\"⪯\",\"prE;\":\"⪳\",\"precsim;\":\"≾\",\"prime;\":\"′\",\"Prime;\":\"″\",\"primes;\":\"ℙ\",\"prnap;\":\"⪹\",\"prnE;\":\"⪵\",\"prnsim;\":\"⋨\",\"prod;\":\"∏\",\"Product;\":\"∏\",\"profalar;\":\"⌮\",\"profline;\":\"⌒\",\"profsurf;\":\"⌓\",\"prop;\":\"∝\",\"Proportional;\":\"∝\",\"Proportion;\":\"∷\",\"propto;\":\"∝\",\"prsim;\":\"≾\",\"prurel;\":\"⊰\",\"Pscr;\":\"𝒫\",\"pscr;\":\"𝓅\",\"Psi;\":\"Ψ\",\"psi;\":\"ψ\",\"puncsp;\":\" \",\"Qfr;\":\"𝔔\",\"qfr;\":\"𝔮\",\"qint;\":\"⨌\",\"qopf;\":\"𝕢\",\"Qopf;\":\"ℚ\",\"qprime;\":\"⁗\",\"Qscr;\":\"𝒬\",\"qscr;\":\"𝓆\",\"quaternions;\":\"ℍ\",\"quatint;\":\"⨖\",\"quest;\":\"?\",\"questeq;\":\"≟\",\"quot;\":'\"',quot:'\"',\"QUOT;\":'\"',QUOT:'\"',\"rAarr;\":\"⇛\",\"race;\":\"∽̱\",\"Racute;\":\"Ŕ\",\"racute;\":\"ŕ\",\"radic;\":\"√\",\"raemptyv;\":\"⦳\",\"rang;\":\"⟩\",\"Rang;\":\"⟫\",\"rangd;\":\"⦒\",\"range;\":\"⦥\",\"rangle;\":\"⟩\",\"raquo;\":\"»\",raquo:\"»\",\"rarrap;\":\"⥵\",\"rarrb;\":\"⇥\",\"rarrbfs;\":\"⤠\",\"rarrc;\":\"⤳\",\"rarr;\":\"→\",\"Rarr;\":\"↠\",\"rArr;\":\"⇒\",\"rarrfs;\":\"⤞\",\"rarrhk;\":\"↪\",\"rarrlp;\":\"↬\",\"rarrpl;\":\"⥅\",\"rarrsim;\":\"⥴\",\"Rarrtl;\":\"⤖\",\"rarrtl;\":\"↣\",\"rarrw;\":\"↝\",\"ratail;\":\"⤚\",\"rAtail;\":\"⤜\",\"ratio;\":\"∶\",\"rationals;\":\"ℚ\",\"rbarr;\":\"⤍\",\"rBarr;\":\"⤏\",\"RBarr;\":\"⤐\",\"rbbrk;\":\"❳\",\"rbrace;\":\"}\",\"rbrack;\":\"]\",\"rbrke;\":\"⦌\",\"rbrksld;\":\"⦎\",\"rbrkslu;\":\"⦐\",\"Rcaron;\":\"Ř\",\"rcaron;\":\"ř\",\"Rcedil;\":\"Ŗ\",\"rcedil;\":\"ŗ\",\"rceil;\":\"⌉\",\"rcub;\":\"}\",\"Rcy;\":\"Р\",\"rcy;\":\"р\",\"rdca;\":\"⤷\",\"rdldhar;\":\"⥩\",\"rdquo;\":\"”\",\"rdquor;\":\"”\",\"rdsh;\":\"↳\",\"real;\":\"ℜ\",\"realine;\":\"ℛ\",\"realpart;\":\"ℜ\",\"reals;\":\"ℝ\",\"Re;\":\"ℜ\",\"rect;\":\"▭\",\"reg;\":\"®\",reg:\"®\",\"REG;\":\"®\",REG:\"®\",\"ReverseElement;\":\"∋\",\"ReverseEquilibrium;\":\"⇋\",\"ReverseUpEquilibrium;\":\"⥯\",\"rfisht;\":\"⥽\",\"rfloor;\":\"⌋\",\"rfr;\":\"𝔯\",\"Rfr;\":\"ℜ\",\"rHar;\":\"⥤\",\"rhard;\":\"⇁\",\"rharu;\":\"⇀\",\"rharul;\":\"⥬\",\"Rho;\":\"Ρ\",\"rho;\":\"ρ\",\"rhov;\":\"ϱ\",\"RightAngleBracket;\":\"⟩\",\"RightArrowBar;\":\"⇥\",\"rightarrow;\":\"→\",\"RightArrow;\":\"→\",\"Rightarrow;\":\"⇒\",\"RightArrowLeftArrow;\":\"⇄\",\"rightarrowtail;\":\"↣\",\"RightCeiling;\":\"⌉\",\"RightDoubleBracket;\":\"⟧\",\"RightDownTeeVector;\":\"⥝\",\"RightDownVectorBar;\":\"⥕\",\"RightDownVector;\":\"⇂\",\"RightFloor;\":\"⌋\",\"rightharpoondown;\":\"⇁\",\"rightharpoonup;\":\"⇀\",\"rightleftarrows;\":\"⇄\",\"rightleftharpoons;\":\"⇌\",\"rightrightarrows;\":\"⇉\",\"rightsquigarrow;\":\"↝\",\"RightTeeArrow;\":\"↦\",\"RightTee;\":\"⊢\",\"RightTeeVector;\":\"⥛\",\"rightthreetimes;\":\"⋌\",\"RightTriangleBar;\":\"⧐\",\"RightTriangle;\":\"⊳\",\"RightTriangleEqual;\":\"⊵\",\"RightUpDownVector;\":\"⥏\",\"RightUpTeeVector;\":\"⥜\",\"RightUpVectorBar;\":\"⥔\",\"RightUpVector;\":\"↾\",\"RightVectorBar;\":\"⥓\",\"RightVector;\":\"⇀\",\"ring;\":\"˚\",\"risingdotseq;\":\"≓\",\"rlarr;\":\"⇄\",\"rlhar;\":\"⇌\",\"rlm;\":\"‏\",\"rmoustache;\":\"⎱\",\"rmoust;\":\"⎱\",\"rnmid;\":\"⫮\",\"roang;\":\"⟭\",\"roarr;\":\"⇾\",\"robrk;\":\"⟧\",\"ropar;\":\"⦆\",\"ropf;\":\"𝕣\",\"Ropf;\":\"ℝ\",\"roplus;\":\"⨮\",\"rotimes;\":\"⨵\",\"RoundImplies;\":\"⥰\",\"rpar;\":\")\",\"rpargt;\":\"⦔\",\"rppolint;\":\"⨒\",\"rrarr;\":\"⇉\",\"Rrightarrow;\":\"⇛\",\"rsaquo;\":\"›\",\"rscr;\":\"𝓇\",\"Rscr;\":\"ℛ\",\"rsh;\":\"↱\",\"Rsh;\":\"↱\",\"rsqb;\":\"]\",\"rsquo;\":\"’\",\"rsquor;\":\"’\",\"rthree;\":\"⋌\",\"rtimes;\":\"⋊\",\"rtri;\":\"▹\",\"rtrie;\":\"⊵\",\"rtrif;\":\"▸\",\"rtriltri;\":\"⧎\",\"RuleDelayed;\":\"⧴\",\"ruluhar;\":\"⥨\",\"rx;\":\"℞\",\"Sacute;\":\"Ś\",\"sacute;\":\"ś\",\"sbquo;\":\"‚\",\"scap;\":\"⪸\",\"Scaron;\":\"Š\",\"scaron;\":\"š\",\"Sc;\":\"⪼\",\"sc;\":\"≻\",\"sccue;\":\"≽\",\"sce;\":\"⪰\",\"scE;\":\"⪴\",\"Scedil;\":\"Ş\",\"scedil;\":\"ş\",\"Scirc;\":\"Ŝ\",\"scirc;\":\"ŝ\",\"scnap;\":\"⪺\",\"scnE;\":\"⪶\",\"scnsim;\":\"⋩\",\"scpolint;\":\"⨓\",\"scsim;\":\"≿\",\"Scy;\":\"С\",\"scy;\":\"с\",\"sdotb;\":\"⊡\",\"sdot;\":\"⋅\",\"sdote;\":\"⩦\",\"searhk;\":\"⤥\",\"searr;\":\"↘\",\"seArr;\":\"⇘\",\"searrow;\":\"↘\",\"sect;\":\"§\",sect:\"§\",\"semi;\":\";\",\"seswar;\":\"⤩\",\"setminus;\":\"∖\",\"setmn;\":\"∖\",\"sext;\":\"✶\",\"Sfr;\":\"𝔖\",\"sfr;\":\"𝔰\",\"sfrown;\":\"⌢\",\"sharp;\":\"♯\",\"SHCHcy;\":\"Щ\",\"shchcy;\":\"щ\",\"SHcy;\":\"Ш\",\"shcy;\":\"ш\",\"ShortDownArrow;\":\"↓\",\"ShortLeftArrow;\":\"←\",\"shortmid;\":\"∣\",\"shortparallel;\":\"∥\",\"ShortRightArrow;\":\"→\",\"ShortUpArrow;\":\"↑\",\"shy;\":\"­\",shy:\"­\",\"Sigma;\":\"Σ\",\"sigma;\":\"σ\",\"sigmaf;\":\"ς\",\"sigmav;\":\"ς\",\"sim;\":\"∼\",\"simdot;\":\"⩪\",\"sime;\":\"≃\",\"simeq;\":\"≃\",\"simg;\":\"⪞\",\"simgE;\":\"⪠\",\"siml;\":\"⪝\",\"simlE;\":\"⪟\",\"simne;\":\"≆\",\"simplus;\":\"⨤\",\"simrarr;\":\"⥲\",\"slarr;\":\"←\",\"SmallCircle;\":\"∘\",\"smallsetminus;\":\"∖\",\"smashp;\":\"⨳\",\"smeparsl;\":\"⧤\",\"smid;\":\"∣\",\"smile;\":\"⌣\",\"smt;\":\"⪪\",\"smte;\":\"⪬\",\"smtes;\":\"⪬︀\",\"SOFTcy;\":\"Ь\",\"softcy;\":\"ь\",\"solbar;\":\"⌿\",\"solb;\":\"⧄\",\"sol;\":\"/\",\"Sopf;\":\"𝕊\",\"sopf;\":\"𝕤\",\"spades;\":\"♠\",\"spadesuit;\":\"♠\",\"spar;\":\"∥\",\"sqcap;\":\"⊓\",\"sqcaps;\":\"⊓︀\",\"sqcup;\":\"⊔\",\"sqcups;\":\"⊔︀\",\"Sqrt;\":\"√\",\"sqsub;\":\"⊏\",\"sqsube;\":\"⊑\",\"sqsubset;\":\"⊏\",\"sqsubseteq;\":\"⊑\",\"sqsup;\":\"⊐\",\"sqsupe;\":\"⊒\",\"sqsupset;\":\"⊐\",\"sqsupseteq;\":\"⊒\",\"square;\":\"□\",\"Square;\":\"□\",\"SquareIntersection;\":\"⊓\",\"SquareSubset;\":\"⊏\",\"SquareSubsetEqual;\":\"⊑\",\"SquareSuperset;\":\"⊐\",\"SquareSupersetEqual;\":\"⊒\",\"SquareUnion;\":\"⊔\",\"squarf;\":\"▪\",\"squ;\":\"□\",\"squf;\":\"▪\",\"srarr;\":\"→\",\"Sscr;\":\"𝒮\",\"sscr;\":\"𝓈\",\"ssetmn;\":\"∖\",\"ssmile;\":\"⌣\",\"sstarf;\":\"⋆\",\"Star;\":\"⋆\",\"star;\":\"☆\",\"starf;\":\"★\",\"straightepsilon;\":\"ϵ\",\"straightphi;\":\"ϕ\",\"strns;\":\"¯\",\"sub;\":\"⊂\",\"Sub;\":\"⋐\",\"subdot;\":\"⪽\",\"subE;\":\"⫅\",\"sube;\":\"⊆\",\"subedot;\":\"⫃\",\"submult;\":\"⫁\",\"subnE;\":\"⫋\",\"subne;\":\"⊊\",\"subplus;\":\"⪿\",\"subrarr;\":\"⥹\",\"subset;\":\"⊂\",\"Subset;\":\"⋐\",\"subseteq;\":\"⊆\",\"subseteqq;\":\"⫅\",\"SubsetEqual;\":\"⊆\",\"subsetneq;\":\"⊊\",\"subsetneqq;\":\"⫋\",\"subsim;\":\"⫇\",\"subsub;\":\"⫕\",\"subsup;\":\"⫓\",\"succapprox;\":\"⪸\",\"succ;\":\"≻\",\"succcurlyeq;\":\"≽\",\"Succeeds;\":\"≻\",\"SucceedsEqual;\":\"⪰\",\"SucceedsSlantEqual;\":\"≽\",\"SucceedsTilde;\":\"≿\",\"succeq;\":\"⪰\",\"succnapprox;\":\"⪺\",\"succneqq;\":\"⪶\",\"succnsim;\":\"⋩\",\"succsim;\":\"≿\",\"SuchThat;\":\"∋\",\"sum;\":\"∑\",\"Sum;\":\"∑\",\"sung;\":\"♪\",\"sup1;\":\"¹\",sup1:\"¹\",\"sup2;\":\"²\",sup2:\"²\",\"sup3;\":\"³\",sup3:\"³\",\"sup;\":\"⊃\",\"Sup;\":\"⋑\",\"supdot;\":\"⪾\",\"supdsub;\":\"⫘\",\"supE;\":\"⫆\",\"supe;\":\"⊇\",\"supedot;\":\"⫄\",\"Superset;\":\"⊃\",\"SupersetEqual;\":\"⊇\",\"suphsol;\":\"⟉\",\"suphsub;\":\"⫗\",\"suplarr;\":\"⥻\",\"supmult;\":\"⫂\",\"supnE;\":\"⫌\",\"supne;\":\"⊋\",\"supplus;\":\"⫀\",\"supset;\":\"⊃\",\"Supset;\":\"⋑\",\"supseteq;\":\"⊇\",\"supseteqq;\":\"⫆\",\"supsetneq;\":\"⊋\",\"supsetneqq;\":\"⫌\",\"supsim;\":\"⫈\",\"supsub;\":\"⫔\",\"supsup;\":\"⫖\",\"swarhk;\":\"⤦\",\"swarr;\":\"↙\",\"swArr;\":\"⇙\",\"swarrow;\":\"↙\",\"swnwar;\":\"⤪\",\"szlig;\":\"ß\",szlig:\"ß\",\"Tab;\":\"\t\",\"target;\":\"⌖\",\"Tau;\":\"Τ\",\"tau;\":\"τ\",\"tbrk;\":\"⎴\",\"Tcaron;\":\"Ť\",\"tcaron;\":\"ť\",\"Tcedil;\":\"Ţ\",\"tcedil;\":\"ţ\",\"Tcy;\":\"Т\",\"tcy;\":\"т\",\"tdot;\":\"⃛\",\"telrec;\":\"⌕\",\"Tfr;\":\"𝔗\",\"tfr;\":\"𝔱\",\"there4;\":\"∴\",\"therefore;\":\"∴\",\"Therefore;\":\"∴\",\"Theta;\":\"Θ\",\"theta;\":\"θ\",\"thetasym;\":\"ϑ\",\"thetav;\":\"ϑ\",\"thickapprox;\":\"≈\",\"thicksim;\":\"∼\",\"ThickSpace;\":\"  \",\"ThinSpace;\":\" \",\"thinsp;\":\" \",\"thkap;\":\"≈\",\"thksim;\":\"∼\",\"THORN;\":\"Þ\",THORN:\"Þ\",\"thorn;\":\"þ\",thorn:\"þ\",\"tilde;\":\"˜\",\"Tilde;\":\"∼\",\"TildeEqual;\":\"≃\",\"TildeFullEqual;\":\"≅\",\"TildeTilde;\":\"≈\",\"timesbar;\":\"⨱\",\"timesb;\":\"⊠\",\"times;\":\"×\",times:\"×\",\"timesd;\":\"⨰\",\"tint;\":\"∭\",\"toea;\":\"⤨\",\"topbot;\":\"⌶\",\"topcir;\":\"⫱\",\"top;\":\"⊤\",\"Topf;\":\"𝕋\",\"topf;\":\"𝕥\",\"topfork;\":\"⫚\",\"tosa;\":\"⤩\",\"tprime;\":\"‴\",\"trade;\":\"™\",\"TRADE;\":\"™\",\"triangle;\":\"▵\",\"triangledown;\":\"▿\",\"triangleleft;\":\"◃\",\"trianglelefteq;\":\"⊴\",\"triangleq;\":\"≜\",\"triangleright;\":\"▹\",\"trianglerighteq;\":\"⊵\",\"tridot;\":\"◬\",\"trie;\":\"≜\",\"triminus;\":\"⨺\",\"TripleDot;\":\"⃛\",\"triplus;\":\"⨹\",\"trisb;\":\"⧍\",\"tritime;\":\"⨻\",\"trpezium;\":\"⏢\",\"Tscr;\":\"𝒯\",\"tscr;\":\"𝓉\",\"TScy;\":\"Ц\",\"tscy;\":\"ц\",\"TSHcy;\":\"Ћ\",\"tshcy;\":\"ћ\",\"Tstrok;\":\"Ŧ\",\"tstrok;\":\"ŧ\",\"twixt;\":\"≬\",\"twoheadleftarrow;\":\"↞\",\"twoheadrightarrow;\":\"↠\",\"Uacute;\":\"Ú\",Uacute:\"Ú\",\"uacute;\":\"ú\",uacute:\"ú\",\"uarr;\":\"↑\",\"Uarr;\":\"↟\",\"uArr;\":\"⇑\",\"Uarrocir;\":\"⥉\",\"Ubrcy;\":\"Ў\",\"ubrcy;\":\"ў\",\"Ubreve;\":\"Ŭ\",\"ubreve;\":\"ŭ\",\"Ucirc;\":\"Û\",Ucirc:\"Û\",\"ucirc;\":\"û\",ucirc:\"û\",\"Ucy;\":\"У\",\"ucy;\":\"у\",\"udarr;\":\"⇅\",\"Udblac;\":\"Ű\",\"udblac;\":\"ű\",\"udhar;\":\"⥮\",\"ufisht;\":\"⥾\",\"Ufr;\":\"𝔘\",\"ufr;\":\"𝔲\",\"Ugrave;\":\"Ù\",Ugrave:\"Ù\",\"ugrave;\":\"ù\",ugrave:\"ù\",\"uHar;\":\"⥣\",\"uharl;\":\"↿\",\"uharr;\":\"↾\",\"uhblk;\":\"▀\",\"ulcorn;\":\"⌜\",\"ulcorner;\":\"⌜\",\"ulcrop;\":\"⌏\",\"ultri;\":\"◸\",\"Umacr;\":\"Ū\",\"umacr;\":\"ū\",\"uml;\":\"¨\",uml:\"¨\",\"UnderBar;\":\"_\",\"UnderBrace;\":\"⏟\",\"UnderBracket;\":\"⎵\",\"UnderParenthesis;\":\"⏝\",\"Union;\":\"⋃\",\"UnionPlus;\":\"⊎\",\"Uogon;\":\"Ų\",\"uogon;\":\"ų\",\"Uopf;\":\"𝕌\",\"uopf;\":\"𝕦\",\"UpArrowBar;\":\"⤒\",\"uparrow;\":\"↑\",\"UpArrow;\":\"↑\",\"Uparrow;\":\"⇑\",\"UpArrowDownArrow;\":\"⇅\",\"updownarrow;\":\"↕\",\"UpDownArrow;\":\"↕\",\"Updownarrow;\":\"⇕\",\"UpEquilibrium;\":\"⥮\",\"upharpoonleft;\":\"↿\",\"upharpoonright;\":\"↾\",\"uplus;\":\"⊎\",\"UpperLeftArrow;\":\"↖\",\"UpperRightArrow;\":\"↗\",\"upsi;\":\"υ\",\"Upsi;\":\"ϒ\",\"upsih;\":\"ϒ\",\"Upsilon;\":\"Υ\",\"upsilon;\":\"υ\",\"UpTeeArrow;\":\"↥\",\"UpTee;\":\"⊥\",\"upuparrows;\":\"⇈\",\"urcorn;\":\"⌝\",\"urcorner;\":\"⌝\",\"urcrop;\":\"⌎\",\"Uring;\":\"Ů\",\"uring;\":\"ů\",\"urtri;\":\"◹\",\"Uscr;\":\"𝒰\",\"uscr;\":\"𝓊\",\"utdot;\":\"⋰\",\"Utilde;\":\"Ũ\",\"utilde;\":\"ũ\",\"utri;\":\"▵\",\"utrif;\":\"▴\",\"uuarr;\":\"⇈\",\"Uuml;\":\"Ü\",Uuml:\"Ü\",\"uuml;\":\"ü\",uuml:\"ü\",\"uwangle;\":\"⦧\",\"vangrt;\":\"⦜\",\"varepsilon;\":\"ϵ\",\"varkappa;\":\"ϰ\",\"varnothing;\":\"∅\",\"varphi;\":\"ϕ\",\"varpi;\":\"ϖ\",\"varpropto;\":\"∝\",\"varr;\":\"↕\",\"vArr;\":\"⇕\",\"varrho;\":\"ϱ\",\"varsigma;\":\"ς\",\"varsubsetneq;\":\"⊊︀\",\"varsubsetneqq;\":\"⫋︀\",\"varsupsetneq;\":\"⊋︀\",\"varsupsetneqq;\":\"⫌︀\",\"vartheta;\":\"ϑ\",\"vartriangleleft;\":\"⊲\",\"vartriangleright;\":\"⊳\",\"vBar;\":\"⫨\",\"Vbar;\":\"⫫\",\"vBarv;\":\"⫩\",\"Vcy;\":\"В\",\"vcy;\":\"в\",\"vdash;\":\"⊢\",\"vDash;\":\"⊨\",\"Vdash;\":\"⊩\",\"VDash;\":\"⊫\",\"Vdashl;\":\"⫦\",\"veebar;\":\"⊻\",\"vee;\":\"∨\",\"Vee;\":\"⋁\",\"veeeq;\":\"≚\",\"vellip;\":\"⋮\",\"verbar;\":\"|\",\"Verbar;\":\"‖\",\"vert;\":\"|\",\"Vert;\":\"‖\",\"VerticalBar;\":\"∣\",\"VerticalLine;\":\"|\",\"VerticalSeparator;\":\"❘\",\"VerticalTilde;\":\"≀\",\"VeryThinSpace;\":\" \",\"Vfr;\":\"𝔙\",\"vfr;\":\"𝔳\",\"vltri;\":\"⊲\",\"vnsub;\":\"⊂⃒\",\"vnsup;\":\"⊃⃒\",\"Vopf;\":\"𝕍\",\"vopf;\":\"𝕧\",\"vprop;\":\"∝\",\"vrtri;\":\"⊳\",\"Vscr;\":\"𝒱\",\"vscr;\":\"𝓋\",\"vsubnE;\":\"⫋︀\",\"vsubne;\":\"⊊︀\",\"vsupnE;\":\"⫌︀\",\"vsupne;\":\"⊋︀\",\"Vvdash;\":\"⊪\",\"vzigzag;\":\"⦚\",\"Wcirc;\":\"Ŵ\",\"wcirc;\":\"ŵ\",\"wedbar;\":\"⩟\",\"wedge;\":\"∧\",\"Wedge;\":\"⋀\",\"wedgeq;\":\"≙\",\"weierp;\":\"℘\",\"Wfr;\":\"𝔚\",\"wfr;\":\"𝔴\",\"Wopf;\":\"𝕎\",\"wopf;\":\"𝕨\",\"wp;\":\"℘\",\"wr;\":\"≀\",\"wreath;\":\"≀\",\"Wscr;\":\"𝒲\",\"wscr;\":\"𝓌\",\"xcap;\":\"⋂\",\"xcirc;\":\"◯\",\"xcup;\":\"⋃\",\"xdtri;\":\"▽\",\"Xfr;\":\"𝔛\",\"xfr;\":\"𝔵\",\"xharr;\":\"⟷\",\"xhArr;\":\"⟺\",\"Xi;\":\"Ξ\",\"xi;\":\"ξ\",\"xlarr;\":\"⟵\",\"xlArr;\":\"⟸\",\"xmap;\":\"⟼\",\"xnis;\":\"⋻\",\"xodot;\":\"⨀\",\"Xopf;\":\"𝕏\",\"xopf;\":\"𝕩\",\"xoplus;\":\"⨁\",\"xotime;\":\"⨂\",\"xrarr;\":\"⟶\",\"xrArr;\":\"⟹\",\"Xscr;\":\"𝒳\",\"xscr;\":\"𝓍\",\"xsqcup;\":\"⨆\",\"xuplus;\":\"⨄\",\"xutri;\":\"△\",\"xvee;\":\"⋁\",\"xwedge;\":\"⋀\",\"Yacute;\":\"Ý\",Yacute:\"Ý\",\"yacute;\":\"ý\",yacute:\"ý\",\"YAcy;\":\"Я\",\"yacy;\":\"я\",\"Ycirc;\":\"Ŷ\",\"ycirc;\":\"ŷ\",\"Ycy;\":\"Ы\",\"ycy;\":\"ы\",\"yen;\":\"¥\",yen:\"¥\",\"Yfr;\":\"𝔜\",\"yfr;\":\"𝔶\",\"YIcy;\":\"Ї\",\"yicy;\":\"ї\",\"Yopf;\":\"𝕐\",\"yopf;\":\"𝕪\",\"Yscr;\":\"𝒴\",\"yscr;\":\"𝓎\",\"YUcy;\":\"Ю\",\"yucy;\":\"ю\",\"yuml;\":\"ÿ\",yuml:\"ÿ\",\"Yuml;\":\"Ÿ\",\"Zacute;\":\"Ź\",\"zacute;\":\"ź\",\"Zcaron;\":\"Ž\",\"zcaron;\":\"ž\",\"Zcy;\":\"З\",\"zcy;\":\"з\",\"Zdot;\":\"Ż\",\"zdot;\":\"ż\",\"zeetrf;\":\"ℨ\",\"ZeroWidthSpace;\":\"​\",\"Zeta;\":\"Ζ\",\"zeta;\":\"ζ\",\"zfr;\":\"𝔷\",\"Zfr;\":\"ℨ\",\"ZHcy;\":\"Ж\",\"zhcy;\":\"ж\",\"zigrarr;\":\"⇝\",\"zopf;\":\"𝕫\",\"Zopf;\":\"ℤ\",\"Zscr;\":\"𝒵\",\"zscr;\":\"𝓏\",\"zwj;\":\"‍\",\"zwnj;\":\"‌\"}},{}],13:[function(e,t,n){function r(e,t){return p.isUndefined(t)?\"\"+t:p.isNumber(t)&&(isNaN(t)||!isFinite(t))?t.toString():p.isFunction(t)||p.isRegExp(t)?t.toString():t}function i(e,t){return p.isString(e)?e.length<t?e:e.slice(0,t):e}function s(e){return i(JSON.stringify(e.actual,r),128)+\" \"+e.operator+\" \"+i(JSON.stringify(e.expected,r),128)}function o(e,t,n,r,i){throw new m.AssertionError({message:n,actual:e,expected:t,operator:r,stackStartFunction:i})}function u(e,t){e||o(e,!0,t,\"==\",m.ok)}function a(e,t){if(e===t)return!0;if(p.isBuffer(e)&&p.isBuffer(t)){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return p.isDate(e)&&p.isDate(t)?e.getTime()===t.getTime():p.isRegExp(e)&&p.isRegExp(t)?e.source===t.source&&e.global===t.global&&e.multiline===t.multiline&&e.lastIndex===t.lastIndex&&e.ignoreCase===t.ignoreCase:!p.isObject(e)&&!p.isObject(t)?e==t:l(e,t)}function f(e){return Object.prototype.toString.call(e)==\"[object Arguments]\"}function l(e,t){if(p.isNullOrUndefined(e)||p.isNullOrUndefined(t))return!1;if(e.prototype!==t.prototype)return!1;if(f(e))return f(t)?(e=d.call(e),t=d.call(t),a(e,t)):!1;try{var n=g(e),r=g(t),i,s}catch(o){return!1}if(n.length!=r.length)return!1;n.sort(),r.sort();for(s=n.length-1;s>=0;s--)if(n[s]!=r[s])return!1;for(s=n.length-1;s>=0;s--){i=n[s];if(!a(e[i],t[i]))return!1}return!0}function c(e,t){return!e||!t?!1:Object.prototype.toString.call(t)==\"[object RegExp]\"?t.test(e):e instanceof t?!0:t.call({},e)===!0?!0:!1}function h(e,t,n,r){var i;p.isString(n)&&(r=n,n=null);try{t()}catch(s){i=s}r=(n&&n.name?\" (\"+n.name+\").\":\".\")+(r?\" \"+r:\".\"),e&&!i&&o(i,n,\"Missing expected exception\"+r),!e&&c(i,n)&&o(i,n,\"Got unwanted exception\"+r);if(e&&i&&n&&!c(i,n)||!e&&i)throw i}var p=e(\"util/\"),d=Array.prototype.slice,v=Object.prototype.hasOwnProperty,m=t.exports=u;m.AssertionError=function(e){this.name=\"AssertionError\",this.actual=e.actual,this.expected=e.expected,this.operator=e.operator,e.message?(this.message=e.message,this.generatedMessage=!1):(this.message=s(this),this.generatedMessage=!0);var t=e.stackStartFunction||o;if(Error.captureStackTrace)Error.captureStackTrace(this,t);else{var n=new Error;if(n.stack){var r=n.stack,i=t.name,u=r.indexOf(\"\\n\"+i);if(u>=0){var a=r.indexOf(\"\\n\",u+1);r=r.substring(a+1)}this.stack=r}}},p.inherits(m.AssertionError,Error),m.fail=o,m.ok=u,m.equal=function(e,t,n){e!=t&&o(e,t,n,\"==\",m.equal)},m.notEqual=function(e,t,n){e==t&&o(e,t,n,\"!=\",m.notEqual)},m.deepEqual=function(e,t,n){a(e,t)||o(e,t,n,\"deepEqual\",m.deepEqual)},m.notDeepEqual=function(e,t,n){a(e,t)&&o(e,t,n,\"notDeepEqual\",m.notDeepEqual)},m.strictEqual=function(e,t,n){e!==t&&o(e,t,n,\"===\",m.strictEqual)},m.notStrictEqual=function(e,t,n){e===t&&o(e,t,n,\"!==\",m.notStrictEqual)},m.throws=function(e,t,n){h.apply(this,[!0].concat(d.call(arguments)))},m.doesNotThrow=function(e,t){h.apply(this,[!1].concat(d.call(arguments)))},m.ifError=function(e){if(e)throw e};var g=Object.keys||function(e){var t=[];for(var n in e)v.call(e,n)&&t.push(n);return t}},{\"util/\":15}],14:[function(e,t,n){t.exports=function(e){return e&&typeof e==\"object\"&&typeof e.copy==\"function\"&&typeof e.fill==\"function\"&&typeof e.readUInt8==\"function\"}},{}],15:[function(e,t,n){(function(t,r){function i(e,t){var r={seen:[],stylize:o};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),v(t)?r.showHidden=t:t&&n._extend(r,t),E(r.showHidden)&&(r.showHidden=!1),E(r.depth)&&(r.depth=2),E(r.colors)&&(r.colors=!1),E(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),a(r,e,r.depth)}function s(e,t){var n=i.styles[t];return n?\"\u001b[\"+i.colors[n][0]+\"m\"+e+\"\u001b[\"+i.colors[n][1]+\"m\":e}function o(e,t){return e}function u(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function a(e,t,r){if(e.customInspect&&t&&C(t.inspect)&&t.inspect!==n.inspect&&(!t.constructor||t.constructor.prototype!==t)){var i=t.inspect(r,e);return b(i)||(i=a(e,i,r)),i}var s=f(e,t);if(s)return s;var o=Object.keys(t),v=u(o);e.showHidden&&(o=Object.getOwnPropertyNames(t));if(N(t)&&(o.indexOf(\"message\")>=0||o.indexOf(\"description\")>=0))return l(t);if(o.length===0){if(C(t)){var m=t.name?\": \"+t.name:\"\";return e.stylize(\"[Function\"+m+\"]\",\"special\")}if(S(t))return e.stylize(RegExp.prototype.toString.call(t),\"regexp\");if(T(t))return e.stylize(Date.prototype.toString.call(t),\"date\");if(N(t))return l(t)}var g=\"\",y=!1,w=[\"{\",\"}\"];d(t)&&(y=!0,w=[\"[\",\"]\"]);if(C(t)){var E=t.name?\": \"+t.name:\"\";g=\" [Function\"+E+\"]\"}S(t)&&(g=\" \"+RegExp.prototype.toString.call(t)),T(t)&&(g=\" \"+Date.prototype.toUTCString.call(t)),N(t)&&(g=\" \"+l(t));if(o.length!==0||!!y&&t.length!=0){if(r<0)return S(t)?e.stylize(RegExp.prototype.toString.call(t),\"regexp\"):e.stylize(\"[Object]\",\"special\");e.seen.push(t);var x;return y?x=c(e,t,r,v,o):x=o.map(function(n){return h(e,t,r,v,n,y)}),e.seen.pop(),p(x,g,w)}return w[0]+g+w[1]}function f(e,t){if(E(t))return e.stylize(\"undefined\",\"undefined\");if(b(t)){var n=\"'\"+JSON.stringify(t).replace(/^\"|\"$/g,\"\").replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"')+\"'\";return e.stylize(n,\"string\")}if(y(t))return e.stylize(\"\"+t,\"number\");if(v(t))return e.stylize(\"\"+t,\"boolean\");if(m(t))return e.stylize(\"null\",\"null\")}function l(e){return\"[\"+Error.prototype.toString.call(e)+\"]\"}function c(e,t,n,r,i){var s=[];for(var o=0,u=t.length;o<u;++o)M(t,String(o))?s.push(h(e,t,n,r,String(o),!0)):s.push(\"\");return i.forEach(function(i){i.match(/^\\d+$/)||s.push(h(e,t,n,r,i,!0))}),s}function h(e,t,n,r,i,s){var o,u,f;f=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]},f.get?f.set?u=e.stylize(\"[Getter/Setter]\",\"special\"):u=e.stylize(\"[Getter]\",\"special\"):f.set&&(u=e.stylize(\"[Setter]\",\"special\")),M(r,i)||(o=\"[\"+i+\"]\"),u||(e.seen.indexOf(f.value)<0?(m(n)?u=a(e,f.value,null):u=a(e,f.value,n-1),u.indexOf(\"\\n\")>-1&&(s?u=u.split(\"\\n\").map(function(e){return\"  \"+e}).join(\"\\n\").substr(2):u=\"\\n\"+u.split(\"\\n\").map(function(e){return\"   \"+e}).join(\"\\n\"))):u=e.stylize(\"[Circular]\",\"special\"));if(E(o)){if(s&&i.match(/^\\d+$/))return u;o=JSON.stringify(\"\"+i),o.match(/^\"([a-zA-Z_][a-zA-Z_0-9]*)\"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,\"name\")):(o=o.replace(/'/g,\"\\\\'\").replace(/\\\\\"/g,'\"').replace(/(^\"|\"$)/g,\"'\"),o=e.stylize(o,\"string\"))}return o+\": \"+u}function p(e,t,n){var r=0,i=e.reduce(function(e,t){return r++,t.indexOf(\"\\n\")>=0&&r++,e+t.replace(/\\u001b\\[\\d\\d?m/g,\"\").length+1},0);return i>60?n[0]+(t===\"\"?\"\":t+\"\\n \")+\" \"+e.join(\",\\n  \")+\" \"+n[1]:n[0]+t+\" \"+e.join(\", \")+\" \"+n[1]}function d(e){return Array.isArray(e)}function v(e){return typeof e==\"boolean\"}function m(e){return e===null}function g(e){return e==null}function y(e){return typeof e==\"number\"}function b(e){return typeof e==\"string\"}function w(e){return typeof e==\"symbol\"}function E(e){return e===void 0}function S(e){return x(e)&&L(e)===\"[object RegExp]\"}function x(e){return typeof e==\"object\"&&e!==null}function T(e){return x(e)&&L(e)===\"[object Date]\"}function N(e){return x(e)&&(L(e)===\"[object Error]\"||e instanceof Error)}function C(e){return typeof e==\"function\"}function k(e){return e===null||typeof e==\"boolean\"||typeof e==\"number\"||typeof e==\"string\"||typeof e==\"symbol\"||typeof e==\"undefined\"}function L(e){return Object.prototype.toString.call(e)}function A(e){return e<10?\"0\"+e.toString(10):e.toString(10)}function O(){var e=new Date,t=[A(e.getHours()),A(e.getMinutes()),A(e.getSeconds())].join(\":\");return[e.getDate(),H[e.getMonth()],t].join(\" \")}function M(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var _=/%[sdj%]/g;n.format=function(e){if(!b(e)){var t=[];for(var n=0;n<arguments.length;n++)t.push(i(arguments[n]));return t.join(\" \")}var n=1,r=arguments,s=r.length,o=String(e).replace(_,function(e){if(e===\"%%\")return\"%\";if(n>=s)return e;switch(e){case\"%s\":return String(r[n++]);case\"%d\":return Number(r[n++]);case\"%j\":try{return JSON.stringify(r[n++])}catch(t){return\"[Circular]\"};default:return e}});for(var u=r[n];n<s;u=r[++n])m(u)||!x(u)?o+=\" \"+u:o+=\" \"+i(u);return o},n.deprecate=function(e,i){function s(){if(!o){if(t.throwDeprecation)throw new Error(i);t.traceDeprecation?console.trace(i):console.error(i),o=!0}return e.apply(this,arguments)}if(E(r.process))return function(){return n.deprecate(e,i).apply(this,arguments)};if(t.noDeprecation===!0)return e;var o=!1;return s};var D={},P;n.debuglog=function(e){E(P)&&(P=t.env.NODE_DEBUG||\"\"),e=e.toUpperCase();if(!D[e])if((new RegExp(\"\\\\b\"+e+\"\\\\b\",\"i\")).test(P)){var r=t.pid;D[e]=function(){var t=n.format.apply(n,arguments);console.error(\"%s %d: %s\",e,r,t)}}else D[e]=function(){};return D[e]},n.inspect=i,i.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},i.styles={special:\"cyan\",number:\"yellow\",\"boolean\":\"yellow\",\"undefined\":\"grey\",\"null\":\"bold\",string:\"green\",date:\"magenta\",regexp:\"red\"},n.isArray=d,n.isBoolean=v,n.isNull=m,n.isNullOrUndefined=g,n.isNumber=y,n.isString=b,n.isSymbol=w,n.isUndefined=E,n.isRegExp=S,n.isObject=x,n.isDate=T,n.isError=N,n.isFunction=C,n.isPrimitive=k,n.isBuffer=e(\"./support/isBuffer\");var H=[\"Jan\",\"Feb\",\"Mar\",\"Apr\",\"May\",\"Jun\",\"Jul\",\"Aug\",\"Sep\",\"Oct\",\"Nov\",\"Dec\"];n.log=function(){console.log(\"%s - %s\",O(),n.format.apply(n,arguments))},n.inherits=e(\"inherits\"),n._extend=function(e,t){if(!t||!x(t))return e;var n=Object.keys(t),r=n.length;while(r--)e[n[r]]=t[n[r]];return e}}).call(this,e(\"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js\"),typeof self!=\"undefined\"?self:typeof window!=\"undefined\"?window:{})},{\"./support/isBuffer\":14,\"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js\":18,inherits:17}],16:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||undefined}function i(e){return typeof e==\"function\"}function s(e){return typeof e==\"number\"}function o(e){return typeof e==\"object\"&&e!==null}function u(e){return e===void 0}t.exports=r,r.EventEmitter=r,r.prototype._events=undefined,r.prototype._maxListeners=undefined,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError(\"n must be a positive number\");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,s,a,f;this._events||(this._events={});if(e===\"error\")if(!this._events.error||o(this._events.error)&&!this._events.error.length)throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified \"error\" event.');n=this._events[e];if(u(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];n.apply(this,s)}else if(o(n)){r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];f=n.slice(),r=f.length;for(a=0;a<r;a++)f[a].apply(this,s)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError(\"listener must be a function\");this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t;if(o(this._events[e])&&!this._events[e].warned){var n;u(this._maxListeners)?n=r.defaultMaxListeners:n=this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[e].length),console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError(\"listener must be a function\");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,s,u;if(!i(t))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[e])return this;n=this._events[e],s=n.length,r=-1;if(n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit(\"removeListener\",e,t);else if(o(n)){for(u=s;u-->0;)if(n[u]===t||n[u].listener&&n[u].listener===t){r=u;break}if(r<0)return this;n.length===1?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit(\"removeListener\",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(t in this._events){if(t===\"removeListener\")continue;this.removeAllListeners(t)}return this.removeAllListeners(\"removeListener\"),this._events={},this}n=this._events[e];if(i(n))this.removeListener(e,n);else while(n.length)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return!this._events||!this._events[e]?t=[]:i(this._events[e])?t=[this._events[e]]:t=this._events[e].slice(),t},r.listenerCount=function(e,t){var n;return!e._events||!e._events[t]?n=0:i(e._events[t])?n=1:n=e._events[t].length,n}},{}],17:[function(e,t,n){typeof Object.create==\"function\"?t.exports=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})}:t.exports=function(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}},{}],18:[function(e,t,n){function r(){}var i=t.exports={};i.nextTick=function(){var e=typeof window!=\"undefined\"&&window.setImmediate,t=typeof window!=\"undefined\"&&window.postMessage&&window.addEventListener;if(e)return function(e){return window.setImmediate(e)};if(t){var n=[];return window.addEventListener(\"message\",function(e){var t=e.source;if((t===window||t===null)&&e.data===\"process-tick\"){e.stopPropagation();if(n.length>0){var r=n.shift();r()}}},!0),function(e){n.push(e),window.postMessage(\"process-tick\",\"*\")}}return function(e){setTimeout(e,0)}}(),i.title=\"browser\",i.browser=!0,i.env={},i.argv=[],i.on=r,i.once=r,i.off=r,i.emit=r,i.binding=function(e){throw new Error(\"process.binding is not supported\")},i.cwd=function(){return\"/\"},i.chdir=function(e){throw new Error(\"process.chdir is not supported\")}},{}],19:[function(e,t,n){t.exports=e(14)},{}],20:[function(e,t,n){t.exports=e(15)},{\"./support/isBuffer\":19,\"/usr/local/lib/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js\":18,inherits:17}]},{},[9])(9)}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-javascript.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/javascript_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/javascript/jshint\"],function(require,exports,module){function startRegex(e){return RegExp(\"^(\"+e.join(\"|\")+\")\")}var oop=require(\"../lib/oop\"),Mirror=require(\"../worker/mirror\").Mirror,lint=require(\"./javascript/jshint\").JSHINT,disabledWarningsRe=startRegex([\"Bad for in variable '(.+)'.\",'Missing \"use strict\"']),errorsRe=startRegex([\"Unexpected\",\"Expected \",\"Confusing (plus|minus)\",\"\\\\{a\\\\} unterminated regular expression\",\"Unclosed \",\"Unmatched \",\"Unbegun comment\",\"Bad invocation\",\"Missing space after\",\"Missing operator at\"]),infoRe=startRegex([\"Expected an assignment\",\"Bad escapement of EOL\",\"Unexpected comma\",\"Unexpected space\",\"Missing radix parameter.\",\"A leading decimal point can\",\"\\\\['{a}'\\\\] is better written in dot notation.\",\"'{a}' used out of scope\"]),JavaScriptWorker=exports.JavaScriptWorker=function(e){Mirror.call(this,e),this.setTimeout(500),this.setOptions()};oop.inherits(JavaScriptWorker,Mirror),function(){this.setOptions=function(e){this.options=e||{esnext:!0,moz:!0,devel:!0,browser:!0,node:!0,laxcomma:!0,laxbreak:!0,lastsemic:!0,onevar:!1,passfail:!1,maxerr:100,expr:!0,multistr:!0,globalstrict:!0},this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.changeOptions=function(e){oop.mixin(this.options,e),this.doc.getValue()&&this.deferredUpdate.schedule(100)},this.isValidJS=function(str){try{eval(\"throw 0;\"+str)}catch(e){if(e===0)return!0}return!1},this.onUpdate=function(){var e=this.doc.getValue();e=e.replace(/^#!.*\\n/,\"\\n\");if(!e){this.sender.emit(\"jslint\",[]);return}var t=[],n=this.isValidJS(e)?\"warning\":\"error\";lint(e,this.options);var r=lint.errors,i=!1;for(var s=0;s<r.length;s++){var o=r[s];if(!o)continue;var u=o.raw,a=\"warning\";if(u==\"Missing semicolon.\"){var f=o.evidence.substr(o.character);f=f.charAt(f.search(/\\S/)),n==\"error\"&&f&&/[\\w\\d{(['\"]/.test(f)?(o.reason='Missing \";\" before statement',a=\"error\"):a=\"info\"}else{if(disabledWarningsRe.test(u))continue;infoRe.test(u)?a=\"info\":errorsRe.test(u)?(i=!0,a=n):u==\"'{a}' is not defined.\"?a=\"warning\":u==\"'{a}' is defined but never used.\"&&(a=\"info\")}t.push({row:o.line-1,column:o.character-1,text:o.reason,type:a,raw:u}),i}this.sender.emit(\"jslint\",t)}}.call(JavaScriptWorker.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/javascript/jshint\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports=function r(t,n,i){function s(u,a){if(!n[u]){if(!t[u]){var f=typeof e==\"function\"&&e;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error(\"Cannot find module '\"+u+\"'\")}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return s(n?n:e)},l,l.exports,r,t,n,i)}return n[u].exports}var o=typeof e==\"function\"&&e;for(var u=0;u<i.length;u++)s(i[u]);return s}({1:[function(e,t,n){var r=[];for(var i=0;i<128;i++)r[i]=i===36||i>=65&&i<=90||i===95||i>=97&&i<=122;var s=[];for(var i=0;i<128;i++)s[i]=r[i]||i>=48&&i<=57;t.exports={asciiIdentifierStartTable:r,asciiIdentifierPartTable:s}},{}],2:[function(e,t,n){(function(){var e=this,r=e._,i={},s=Array.prototype,o=Object.prototype,u=Function.prototype,a=s.push,f=s.slice,l=s.concat,c=o.toString,h=o.hasOwnProperty,p=s.forEach,d=s.map,v=s.reduce,m=s.reduceRight,g=s.filter,y=s.every,b=s.some,w=s.indexOf,E=s.lastIndexOf,S=Array.isArray,x=Object.keys,T=u.bind,N=function(e){if(e instanceof N)return e;if(!(this instanceof N))return new N(e);this._wrapped=e};typeof n!=\"undefined\"?(typeof t!=\"undefined\"&&t.exports&&(n=t.exports=N),n._=N):e._=N,N.VERSION=\"1.4.4\";var C=N.each=N.forEach=function(e,t,n){if(e==null)return;if(p&&e.forEach===p)e.forEach(t,n);else if(e.length===+e.length){for(var r=0,s=e.length;r<s;r++)if(t.call(n,e[r],r,e)===i)return}else for(var o in e)if(N.has(e,o)&&t.call(n,e[o],o,e)===i)return};N.map=N.collect=function(e,t,n){var r=[];return e==null?r:d&&e.map===d?e.map(t,n):(C(e,function(e,i,s){r[r.length]=t.call(n,e,i,s)}),r)};var k=\"Reduce of empty array with no initial value\";N.reduce=N.foldl=N.inject=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(v&&e.reduce===v)return r&&(t=N.bind(t,r)),i?e.reduce(t,n):e.reduce(t);C(e,function(e,s,o){i?n=t.call(r,n,e,s,o):(n=e,i=!0)});if(!i)throw new TypeError(k);return n},N.reduceRight=N.foldr=function(e,t,n,r){var i=arguments.length>2;e==null&&(e=[]);if(m&&e.reduceRight===m)return r&&(t=N.bind(t,r)),i?e.reduceRight(t,n):e.reduceRight(t);var s=e.length;if(s!==+s){var o=N.keys(e);s=o.length}C(e,function(u,a,f){a=o?o[--s]:--s,i?n=t.call(r,n,e[a],a,f):(n=e[a],i=!0)});if(!i)throw new TypeError(k);return n},N.find=N.detect=function(e,t,n){var r;return L(e,function(e,i,s){if(t.call(n,e,i,s))return r=e,!0}),r},N.filter=N.select=function(e,t,n){var r=[];return e==null?r:g&&e.filter===g?e.filter(t,n):(C(e,function(e,i,s){t.call(n,e,i,s)&&(r[r.length]=e)}),r)},N.reject=function(e,t,n){return N.filter(e,function(e,r,i){return!t.call(n,e,r,i)},n)},N.every=N.all=function(e,t,n){t||(t=N.identity);var r=!0;return e==null?r:y&&e.every===y?e.every(t,n):(C(e,function(e,s,o){if(!(r=r&&t.call(n,e,s,o)))return i}),!!r)};var L=N.some=N.any=function(e,t,n){t||(t=N.identity);var r=!1;return e==null?r:b&&e.some===b?e.some(t,n):(C(e,function(e,s,o){if(r||(r=t.call(n,e,s,o)))return i}),!!r)};N.contains=N.include=function(e,t){return e==null?!1:w&&e.indexOf===w?e.indexOf(t)!=-1:L(e,function(e){return e===t})},N.invoke=function(e,t){var n=f.call(arguments,2),r=N.isFunction(t);return N.map(e,function(e){return(r?t:e[t]).apply(e,n)})},N.pluck=function(e,t){return N.map(e,function(e){return e[t]})},N.where=function(e,t,n){return N.isEmpty(t)?n?null:[]:N[n?\"find\":\"filter\"](e,function(e){for(var n in t)if(t[n]!==e[n])return!1;return!0})},N.findWhere=function(e,t){return N.where(e,t,!0)},N.max=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.max.apply(Math,e);if(!t&&N.isEmpty(e))return-Infinity;var r={computed:-Infinity,value:-Infinity};return C(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o>=r.computed&&(r={value:e,computed:o})}),r.value},N.min=function(e,t,n){if(!t&&N.isArray(e)&&e[0]===+e[0]&&e.length<65535)return Math.min.apply(Math,e);if(!t&&N.isEmpty(e))return Infinity;var r={computed:Infinity,value:Infinity};return C(e,function(e,i,s){var o=t?t.call(n,e,i,s):e;o<r.computed&&(r={value:e,computed:o})}),r.value},N.shuffle=function(e){var t,n=0,r=[];return C(e,function(e){t=N.random(n++),r[n-1]=r[t],r[t]=e}),r};var A=function(e){return N.isFunction(e)?e:function(t){return t[e]}};N.sortBy=function(e,t,n){var r=A(t);return N.pluck(N.map(e,function(e,t,i){return{value:e,index:t,criteria:r.call(n,e,t,i)}}).sort(function(e,t){var n=e.criteria,r=t.criteria;if(n!==r){if(n>r||n===void 0)return 1;if(n<r||r===void 0)return-1}return e.index<t.index?-1:1}),\"value\")};var O=function(e,t,n,r){var i={},s=A(t||N.identity);return C(e,function(t,o){var u=s.call(n,t,o,e);r(i,u,t)}),i};N.groupBy=function(e,t,n){return O(e,t,n,function(e,t,n){(N.has(e,t)?e[t]:e[t]=[]).push(n)})},N.countBy=function(e,t,n){return O(e,t,n,function(e,t){N.has(e,t)||(e[t]=0),e[t]++})},N.sortedIndex=function(e,t,n,r){n=n==null?N.identity:A(n);var i=n.call(r,t),s=0,o=e.length;while(s<o){var u=s+o>>>1;n.call(r,e[u])<i?s=u+1:o=u}return s},N.toArray=function(e){return e?N.isArray(e)?f.call(e):e.length===+e.length?N.map(e,N.identity):N.values(e):[]},N.size=function(e){return e==null?0:e.length===+e.length?e.length:N.keys(e).length},N.first=N.head=N.take=function(e,t,n){return e==null?void 0:t!=null&&!n?f.call(e,0,t):e[0]},N.initial=function(e,t,n){return f.call(e,0,e.length-(t==null||n?1:t))},N.last=function(e,t,n){return e==null?void 0:t!=null&&!n?f.call(e,Math.max(e.length-t,0)):e[e.length-1]},N.rest=N.tail=N.drop=function(e,t,n){return f.call(e,t==null||n?1:t)},N.compact=function(e){return N.filter(e,N.identity)};var M=function(e,t,n){return C(e,function(e){N.isArray(e)?t?a.apply(n,e):M(e,t,n):n.push(e)}),n};N.flatten=function(e,t){return M(e,t,[])},N.without=function(e){return N.difference(e,f.call(arguments,1))},N.uniq=N.unique=function(e,t,n,r){N.isFunction(t)&&(r=n,n=t,t=!1);var i=n?N.map(e,n,r):e,s=[],o=[];return C(i,function(n,r){if(t?!r||o[o.length-1]!==n:!N.contains(o,n))o.push(n),s.push(e[r])}),s},N.union=function(){return N.uniq(l.apply(s,arguments))},N.intersection=function(e){var t=f.call(arguments,1);return N.filter(N.uniq(e),function(e){return N.every(t,function(t){return N.indexOf(t,e)>=0})})},N.difference=function(e){var t=l.apply(s,f.call(arguments,1));return N.filter(e,function(e){return!N.contains(t,e)})},N.zip=function(){var e=f.call(arguments),t=N.max(N.pluck(e,\"length\")),n=new Array(t);for(var r=0;r<t;r++)n[r]=N.pluck(e,\"\"+r);return n},N.object=function(e,t){if(e==null)return{};var n={};for(var r=0,i=e.length;r<i;r++)t?n[e[r]]=t[r]:n[e[r][0]]=e[r][1];return n},N.indexOf=function(e,t,n){if(e==null)return-1;var r=0,i=e.length;if(n){if(typeof n!=\"number\")return r=N.sortedIndex(e,t),e[r]===t?r:-1;r=n<0?Math.max(0,i+n):n}if(w&&e.indexOf===w)return e.indexOf(t,n);for(;r<i;r++)if(e[r]===t)return r;return-1},N.lastIndexOf=function(e,t,n){if(e==null)return-1;var r=n!=null;if(E&&e.lastIndexOf===E)return r?e.lastIndexOf(t,n):e.lastIndexOf(t);var i=r?n:e.length;while(i--)if(e[i]===t)return i;return-1},N.range=function(e,t,n){arguments.length<=1&&(t=e||0,e=0),n=arguments[2]||1;var r=Math.max(Math.ceil((t-e)/n),0),i=0,s=new Array(r);while(i<r)s[i++]=e,e+=n;return s},N.bind=function(e,t){if(e.bind===T&&T)return T.apply(e,f.call(arguments,1));var n=f.call(arguments,2);return function(){return e.apply(t,n.concat(f.call(arguments)))}},N.partial=function(e){var t=f.call(arguments,1);return function(){return e.apply(this,t.concat(f.call(arguments)))}},N.bindAll=function(e){var t=f.call(arguments,1);return t.length===0&&(t=N.functions(e)),C(t,function(t){e[t]=N.bind(e[t],e)}),e},N.memoize=function(e,t){var n={};return t||(t=N.identity),function(){var r=t.apply(this,arguments);return N.has(n,r)?n[r]:n[r]=e.apply(this,arguments)}},N.delay=function(e,t){var n=f.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},N.defer=function(e){return N.delay.apply(N,[e,1].concat(f.call(arguments,1)))},N.throttle=function(e,t){var n,r,i,s,o=0,u=function(){o=new Date,i=null,s=e.apply(n,r)};return function(){var a=new Date,f=t-(a-o);return n=this,r=arguments,f<=0?(clearTimeout(i),i=null,o=a,s=e.apply(n,r)):i||(i=setTimeout(u,f)),s}},N.debounce=function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},N.once=function(e){var t=!1,n;return function(){return t?n:(t=!0,n=e.apply(this,arguments),e=null,n)}},N.wrap=function(e,t){return function(){var n=[e];return a.apply(n,arguments),t.apply(this,n)}},N.compose=function(){var e=arguments;return function(){var t=arguments;for(var n=e.length-1;n>=0;n--)t=[e[n].apply(this,t)];return t[0]}},N.after=function(e,t){return e<=0?t():function(){if(--e<1)return t.apply(this,arguments)}},N.keys=x||function(e){if(e!==Object(e))throw new TypeError(\"Invalid object\");var t=[];for(var n in e)N.has(e,n)&&(t[t.length]=n);return t},N.values=function(e){var t=[];for(var n in e)N.has(e,n)&&t.push(e[n]);return t},N.pairs=function(e){var t=[];for(var n in e)N.has(e,n)&&t.push([n,e[n]]);return t},N.invert=function(e){var t={};for(var n in e)N.has(e,n)&&(t[e[n]]=n);return t},N.functions=N.methods=function(e){var t=[];for(var n in e)N.isFunction(e[n])&&t.push(n);return t.sort()},N.extend=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)e[n]=t[n]}),e},N.pick=function(e){var t={},n=l.apply(s,f.call(arguments,1));return C(n,function(n){n in e&&(t[n]=e[n])}),t},N.omit=function(e){var t={},n=l.apply(s,f.call(arguments,1));for(var r in e)N.contains(n,r)||(t[r]=e[r]);return t},N.defaults=function(e){return C(f.call(arguments,1),function(t){if(t)for(var n in t)e[n]==null&&(e[n]=t[n])}),e},N.clone=function(e){return N.isObject(e)?N.isArray(e)?e.slice():N.extend({},e):e},N.tap=function(e,t){return t(e),e};var _=function(e,t,n,r){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;e instanceof N&&(e=e._wrapped),t instanceof N&&(t=t._wrapped);var i=c.call(e);if(i!=c.call(t))return!1;switch(i){case\"[object String]\":return e==String(t);case\"[object Number]\":return e!=+e?t!=+t:e==0?1/e==1/t:e==+t;case\"[object Date]\":case\"[object Boolean]\":return+e==+t;case\"[object RegExp]\":return e.source==t.source&&e.global==t.global&&e.multiline==t.multiline&&e.ignoreCase==t.ignoreCase}if(typeof e!=\"object\"||typeof t!=\"object\")return!1;var s=n.length;while(s--)if(n[s]==e)return r[s]==t;n.push(e),r.push(t);var o=0,u=!0;if(i==\"[object Array]\"){o=e.length,u=o==t.length;if(u)while(o--)if(!(u=_(e[o],t[o],n,r)))break}else{var a=e.constructor,f=t.constructor;if(a!==f&&!(N.isFunction(a)&&a instanceof a&&N.isFunction(f)&&f instanceof f))return!1;for(var l in e)if(N.has(e,l)){o++;if(!(u=N.has(t,l)&&_(e[l],t[l],n,r)))break}if(u){for(l in t)if(N.has(t,l)&&!(o--))break;u=!o}}return n.pop(),r.pop(),u};N.isEqual=function(e,t){return _(e,t,[],[])},N.isEmpty=function(e){if(e==null)return!0;if(N.isArray(e)||N.isString(e))return e.length===0;for(var t in e)if(N.has(e,t))return!1;return!0},N.isElement=function(e){return!!e&&e.nodeType===1},N.isArray=S||function(e){return c.call(e)==\"[object Array]\"},N.isObject=function(e){return e===Object(e)},C([\"Arguments\",\"Function\",\"String\",\"Number\",\"Date\",\"RegExp\"],function(e){N[\"is\"+e]=function(t){return c.call(t)==\"[object \"+e+\"]\"}}),N.isArguments(arguments)||(N.isArguments=function(e){return!!e&&!!N.has(e,\"callee\")}),typeof /./!=\"function\"&&(N.isFunction=function(e){return typeof e==\"function\"}),N.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},N.isNaN=function(e){return N.isNumber(e)&&e!=+e},N.isBoolean=function(e){return e===!0||e===!1||c.call(e)==\"[object Boolean]\"},N.isNull=function(e){return e===null},N.isUndefined=function(e){return e===void 0},N.has=function(e,t){return h.call(e,t)},N.noConflict=function(){return e._=r,this},N.identity=function(e){return e},N.times=function(e,t,n){var r=Array(e);for(var i=0;i<e;i++)r[i]=t.call(n,i);return r},N.random=function(e,t){return t==null&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))};var D={escape:{\"&\":\"&amp;\",\"<\":\"&lt;\",\">\":\"&gt;\",'\"':\"&quot;\",\"'\":\"&#x27;\",\"/\":\"&#x2F;\"}};D.unescape=N.invert(D.escape);var P={escape:new RegExp(\"[\"+N.keys(D.escape).join(\"\")+\"]\",\"g\"),unescape:new RegExp(\"(\"+N.keys(D.unescape).join(\"|\")+\")\",\"g\")};N.each([\"escape\",\"unescape\"],function(e){N[e]=function(t){return t==null?\"\":(\"\"+t).replace(P[e],function(t){return D[e][t]})}}),N.result=function(e,t){if(e==null)return null;var n=e[t];return N.isFunction(n)?n.call(e):n},N.mixin=function(e){C(N.functions(e),function(t){var n=N[t]=e[t];N.prototype[t]=function(){var e=[this._wrapped];return a.apply(e,arguments),I.call(this,n.apply(N,e))}})};var H=0;N.uniqueId=function(e){var t=++H+\"\";return e?e+t:t},N.templateSettings={evaluate:/<%([\\s\\S]+?)%>/g,interpolate:/<%=([\\s\\S]+?)%>/g,escape:/<%-([\\s\\S]+?)%>/g};var B=/(.)^/,j={\"'\":\"'\",\"\\\\\":\"\\\\\",\"\\r\":\"r\",\"\\n\":\"n\",\"\t\":\"t\",\"\\u2028\":\"u2028\",\"\\u2029\":\"u2029\"},F=/\\\\|'|\\r|\\n|\\t|\\u2028|\\u2029/g;N.template=function(e,t,n){var r;n=N.defaults({},n,N.templateSettings);var i=new RegExp([(n.escape||B).source,(n.interpolate||B).source,(n.evaluate||B).source].join(\"|\")+\"|$\",\"g\"),s=0,o=\"__p+='\";e.replace(i,function(t,n,r,i,u){return o+=e.slice(s,u).replace(F,function(e){return\"\\\\\"+j[e]}),n&&(o+=\"'+\\n((__t=(\"+n+\"))==null?'':_.escape(__t))+\\n'\"),r&&(o+=\"'+\\n((__t=(\"+r+\"))==null?'':__t)+\\n'\"),i&&(o+=\"';\\n\"+i+\"\\n__p+='\"),s=u+t.length,t}),o+=\"';\\n\",n.variable||(o=\"with(obj||{}){\\n\"+o+\"}\\n\"),o=\"var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\\n\"+o+\"return __p;\\n\";try{r=new Function(n.variable||\"obj\",\"_\",o)}catch(u){throw u.source=o,u}if(t)return r(t,N);var a=function(e){return r.call(this,e,N)};return a.source=\"function(\"+(n.variable||\"obj\")+\"){\\n\"+o+\"}\",a},N.chain=function(e){return N(e).chain()};var I=function(e){return this._chain?N(e).chain():e};N.mixin(N),C([\"pop\",\"push\",\"reverse\",\"shift\",\"sort\",\"splice\",\"unshift\"],function(e){var t=s[e];N.prototype[e]=function(){var n=this._wrapped;return t.apply(n,arguments),(e==\"shift\"||e==\"splice\")&&n.length===0&&delete n[0],I.call(this,n)}}),C([\"concat\",\"join\",\"slice\"],function(e){var t=s[e];N.prototype[e]=function(){return I.call(this,t.apply(this._wrapped,arguments))}}),N.extend(N.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}).call(this)},{}],3:[function(e,t,n){var r=e(\"underscore\"),i=e(\"events\"),s=e(\"./vars.js\"),o=e(\"./messages.js\"),u=e(\"./lex.js\").Lexer,a=e(\"./reg.js\"),f=e(\"./state.js\").state,l=e(\"./style.js\"),c=function(){function e(e,t){return e=e.trim(),/^[+-]W\\d{3}$/g.test(e)?!0:Ot[e]===undefined&&At[e]===undefined&&t.type!==\"jslint\"&&!Dt[e]?(E(\"E001\",t,e),!1):!0}function t(e){return Object.prototype.toString.call(e)===\"[object String]\"}function n(e,t){return e?!e.identifier||e.value!==t?!1:!0:!1}function h(e){if(!e.reserved)return!1;var t=e.meta;if(t&&t.isFutureReservedWord&&f.option.inES5()){if(!t.es5)return!1;if(t.strictOnly&&!f.option.strict&&!f.directive[\"use strict\"])return!1;if(e.isProperty)return!1}return!0}function p(e,t){return e.replace(/\\{([^{}]*)\\}/g,function(e,n){var r=t[n];return typeof r==\"string\"||typeof r==\"number\"?r:e})}function d(e,t){Object.keys(t).forEach(function(n){if(c.blacklist.hasOwnProperty(n))return;e[n]=t[n]})}function v(){f.option.esnext&&d(Jt,s.newEcmaIdentifiers),f.option.couch&&d(Jt,s.couch),f.option.rhino&&d(Jt,s.rhino),f.option.shelljs&&(d(Jt,s.shelljs),d(Jt,s.node)),f.option.typed&&d(Jt,s.typed),f.option.phantom&&d(Jt,s.phantom),f.option.prototypejs&&d(Jt,s.prototypejs),f.option.node&&(d(Jt,s.node),d(Jt,s.typed)),f.option.devel&&d(Jt,s.devel),f.option.dojo&&d(Jt,s.dojo),f.option.browser&&(d(Jt,s.browser),d(Jt,s.typed)),f.option.nonstandard&&d(Jt,s.nonstandard),f.option.jquery&&d(Jt,s.jquery),f.option.mootools&&d(Jt,s.mootools),f.option.worker&&d(Jt,s.worker),f.option.wsh&&d(Jt,s.wsh),f.option.globalstrict&&f.option.strict!==!1&&(f.option.strict=!0),f.option.yui&&d(Jt,s.yui),f.option.mocha&&d(Jt,s.mocha),f.option.inMoz=function(e){return f.option.moz},f.option.inESNext=function(e){return f.option.moz||f.option.esnext},f.option.inES5=function(){return!f.option.es3},f.option.inES3=function(e){return e?!f.option.moz&&!f.option.esnext&&f.option.es3:f.option.es3}}function m(e,t,n){var r=Math.floor(t/f.lines.length*100),i=o.errors[e].desc;throw{name:\"JSHintError\",line:t,character:n,message:i+\" (\"+r+\"% scanned).\",raw:i,code:e}}function g(e,t,n,r){return c.undefs.push([e,t,n,r])}function y(){var e=f.ignoredLines;if(r.isEmpty(e))return;c.errors=r.reject(c.errors,function(t){return e[t.line]})}function b(e,t,n,r,i,s){var u,a,l,h;if(/^W\\d{3}$/.test(e)){if(f.ignored[e])return;h=o.warnings[e]}else/E\\d{3}/.test(e)?h=o.errors[e]:/I\\d{3}/.test(e)&&(h=o.info[e]);return t=t||f.tokens.next,t.id===\"(end)\"&&(t=f.tokens.curr),a=t.line||0,u=t.from||0,l={id:\"(error)\",raw:h.desc,code:h.code,evidence:f.lines[a-1]||\"\",line:a,character:u,scope:c.scope,a:n,b:r,c:i,d:s},l.reason=p(h.desc,l),c.errors.push(l),y(),c.errors.length>=f.option.maxerr&&m(\"E043\",a,u),l}function w(e,t,n,r,i,s,o){return b(e,{line:t,from:n},r,i,s,o)}function E(e,t,n,r,i,s){b(e,t,n,r,i,s)}function S(e,t,n,r,i,s,o){return E(e,{line:t,from:n},r,i,s,o)}function x(e,t){var n;return n={id:\"(internal)\",elem:e,value:t},c.internals.push(n),n}function T(e,t){t=t||{};var n=t.type,i=t.token,s=t.islet;n===\"exception\"&&r.has(jt[\"(context)\"],e)&&jt[e]!==!0&&!f.option.node&&b(\"W002\",f.tokens.next,e),r.has(jt,e)&&!jt[\"(global)\"]&&(jt[e]===!0?f.option.latedef&&(f.option.latedef===!0&&r.contains([jt[e],n],\"unction\")||!r.contains([jt[e],n],\"unction\"))&&b(\"W003\",f.tokens.next,e):((!f.option.shadow||r.contains([\"inner\",\"outer\"],f.option.shadow))&&n!==\"exception\"||jt[\"(blockscope)\"].getlabel(e))&&b(\"W004\",f.tokens.next,e)),jt[\"(context)\"]&&r.has(jt[\"(context)\"],e)&&n!==\"function\"&&f.option.shadow===\"outer\"&&b(\"W123\",f.tokens.next,e),s?jt[\"(blockscope)\"].current.add(e,n,f.tokens.curr):(jt[\"(blockscope)\"].shadow(e),jt[e]=n,i&&(jt[\"(tokens)\"][e]=i),pt(jt,e,{unused:t.unused||!1}),jt[\"(global)\"]?(It[e]=jt,r.has(qt,e)&&(f.option.latedef&&(f.option.latedef===!0&&r.contains([jt[e],n],\"unction\")||!r.contains([jt[e],n],\"unction\"))&&b(\"W003\",f.tokens.next,e),delete qt[e])):Kt[e]=jt)}function N(){var t=f.tokens.next,n=t.body.match(/(-\\s+)?[^\\s,:]+(?:\\s*:\\s*(-\\s+)?[^\\s,]+)?/g),i={};if(t.type===\"globals\"){n.forEach(function(e){e=e.split(\":\");var t=(e[0]||\"\").trim(),n=(e[1]||\"\").trim();t.charAt(0)===\"-\"?(t=t.slice(1),n=!1,c.blacklist[t]=t,delete Jt[t]):i[t]=n===\"true\"}),d(Jt,i);for(var s in i)r.has(i,s)&&(Pt[s]=t)}t.type===\"exported\"&&n.forEach(function(e){Ht[e]=!0}),t.type===\"members\"&&(Vt=Vt||{},n.forEach(function(e){var t=e.charAt(0),n=e.charAt(e.length-1);t===n&&(t==='\"'||t===\"'\")&&(e=e.substr(1,e.length-2).replace('\\\\\"','\"')),Vt[e]=!1}));var o=[\"maxstatements\",\"maxparams\",\"maxdepth\",\"maxcomplexity\",\"maxerr\",\"maxlen\",\"indent\"];if(t.type===\"jshint\"||t.type===\"jslint\")n.forEach(function(n){n=n.split(\":\");var r=(n[0]||\"\").trim(),i=(n[1]||\"\").trim();if(!e(r,t))return;if(o.indexOf(r)>=0){if(i!==\"false\"){i=+i;if(typeof i!=\"number\"||!isFinite(i)||i<=0||Math.floor(i)!==i){E(\"E032\",t,n[1].trim());return}f.option[r]=i}else f.option[r]=r===\"indent\"?4:!1;return}if(r===\"validthis\"){if(jt[\"(global)\"])return void E(\"E009\");if(i!==\"true\"&&i!==\"false\")return void E(\"E002\",t);f.option.validthis=i===\"true\";return}if(r===\"quotmark\"){switch(i){case\"true\":case\"false\":f.option.quotmark=i===\"true\";break;case\"double\":case\"single\":f.option.quotmark=i;break;default:E(\"E002\",t)}return}if(r===\"shadow\"){switch(i){case\"true\":f.option.shadow=!0;break;case\"outer\":f.option.shadow=\"outer\";break;case\"false\":case\"inner\":f.option.shadow=\"inner\";break;default:E(\"E002\",t)}return}if(r===\"unused\"){switch(i){case\"true\":f.option.unused=!0;break;case\"false\":f.option.unused=!1;break;case\"vars\":case\"strict\":f.option.unused=i;break;default:E(\"E002\",t)}return}if(r===\"latedef\"){switch(i){case\"true\":f.option.latedef=!0;break;case\"false\":f.option.latedef=!1;break;case\"nofunc\":f.option.latedef=\"nofunc\";break;default:E(\"E002\",t)}return}if(r===\"ignore\"){switch(i){case\"start\":f.ignoreLinterErrors=!0;break;case\"end\":f.ignoreLinterErrors=!1;break;case\"line\":f.ignoredLines[t.line]=!0,y();break;default:E(\"E002\",t)}return}var s=/^([+-])(W\\d{3})$/g.exec(r);if(s){f.ignored[s[2]]=s[1]===\"-\";return}var u;if(i===\"true\"||i===\"false\"){t.type===\"jslint\"?(u=_t[r]||r,f.option[u]=i===\"true\",Mt[u]!==undefined&&(f.option[u]=!f.option[u])):f.option[r]=i===\"true\",r===\"newcap\"&&(f.option[\"(explicitNewcap)\"]=!0);return}E(\"E002\",t)}),v()}function C(e){var t=e||0,n=0,r;while(n<=t)r=zt[n],r||(r=zt[n]=Wt.token()),n+=1;return r}function k(e,t){switch(f.tokens.curr.id){case\"(number)\":f.tokens.next.id===\".\"&&b(\"W005\",f.tokens.curr);break;case\"-\":(f.tokens.next.id===\"-\"||f.tokens.next.id===\"--\")&&b(\"W006\");break;case\"+\":(f.tokens.next.id===\"+\"||f.tokens.next.id===\"++\")&&b(\"W007\")}if(f.tokens.curr.type===\"(string)\"||f.tokens.curr.identifier)Ct=f.tokens.curr.value;e&&f.tokens.next.id!==e&&(t?f.tokens.next.id===\"(end)\"?E(\"E019\",t,t.id):E(\"E020\",f.tokens.next,e,t.id,t.line,f.tokens.next.value):(f.tokens.next.type!==\"(identifier)\"||f.tokens.next.value!==e)&&b(\"W116\",f.tokens.next,e,f.tokens.next.value)),f.tokens.prev=f.tokens.curr,f.tokens.curr=f.tokens.next;for(;;){f.tokens.next=zt.shift()||Wt.token(),f.tokens.next||m(\"E041\",f.tokens.curr.line);if(f.tokens.next.id===\"(end)\"||f.tokens.next.id===\"(error)\")return;f.tokens.next.check&&f.tokens.next.check();if(f.tokens.next.isSpecial)N();else if(f.tokens.next.id!==\"(endline)\")break}}function L(e){return e.infix||!e.identifier&&!!e.led}function A(){var e=f.tokens.curr,t=f.tokens.next;return t.id===\";\"||t.id===\"}\"||t.id===\":\"?!0:L(t)===L(e)||e.id===\"yield\"&&f.option.inMoz(!0)?e.line!==t.line:!1}function O(e,t){var n,r=!1,i=!1,s=!1;!t&&f.tokens.next.value===\"let\"&&C(0).value===\"(\"&&(f.option.inMoz(!0)||b(\"W118\",f.tokens.next,\"let expressions\"),s=!0,jt[\"(blockscope)\"].stack(),k(\"let\"),k(\"(\"),f.syntax.let.fud.call(f.syntax.let.fud,!1),k(\")\")),f.tokens.next.id===\"(end)\"&&E(\"E006\",f.tokens.curr),f.option.asi&&(f.tokens.curr.id===\"[\"||f.tokens.curr.id===\"(\"||f.tokens.curr.id===\"/\")&&f.tokens.prev.line<f.tokens.curr.line&&b(\"W014\",f.tokens.curr,f.tokens.curr.id),k(),t&&(Ct=\"anonymous\",jt[\"(verb)\"]=f.tokens.curr.value);if(t===!0&&f.tokens.curr.fud)n=f.tokens.curr.fud();else{f.tokens.curr.nud?n=f.tokens.curr.nud():E(\"E030\",f.tokens.curr,f.tokens.curr.id);while(e<f.tokens.next.lbp&&!A())r=f.tokens.curr.value===\"Array\",i=f.tokens.curr.value===\"Object\",n&&(n.value||n.first&&n.first.value)&&(n.value!==\"new\"||n.first&&n.first.value&&n.first.value===\".\")&&(r=!1,n.value!==f.tokens.curr.value&&(i=!1)),k(),r&&f.tokens.curr.id===\"(\"&&f.tokens.next.id===\")\"&&b(\"W009\",f.tokens.curr),i&&f.tokens.curr.id===\"(\"&&f.tokens.next.id===\")\"&&b(\"W010\",f.tokens.curr),n&&f.tokens.curr.led?n=f.tokens.curr.led(n):E(\"E033\",f.tokens.curr,f.tokens.curr.id)}return s&&jt[\"(blockscope)\"].unstack(),n}function M(e,t){e=e||f.tokens.curr,t=t||f.tokens.next,!f.option.laxbreak&&e.line!==t.line&&b(\"W014\",t,t.value)}function _(e){e=e||f.tokens.curr,e.line!==f.tokens.next.line&&b(\"E022\",e,e.value)}function D(e,t){e.line!==t.line&&(f.option.laxcomma||(P.first&&(b(\"I001\"),P.first=!1),b(\"W014\",e,t.value)))}function P(e){e=e||{},e.peek?D(f.tokens.prev,f.tokens.curr):(D(f.tokens.curr,f.tokens.next),k(\",\"));if(f.tokens.next.identifier&&(!e.property||!f.option.inES5()))switch(f.tokens.next.value){case\"break\":case\"case\":case\"catch\":case\"continue\":case\"default\":case\"do\":case\"else\":case\"finally\":case\"for\":case\"if\":case\"in\":case\"instanceof\":case\"return\":case\"switch\":case\"throw\":case\"try\":case\"var\":case\"let\":case\"while\":case\"with\":return E(\"E024\",f.tokens.next,f.tokens.next.value),!1}if(f.tokens.next.type===\"(punctuator)\")switch(f.tokens.next.value){case\"}\":case\"]\":case\",\":if(e.allowTrailing)return!0;case\")\":return E(\"E024\",f.tokens.next,f.tokens.next.value),!1}return!0}function H(e,t){var n=f.syntax[e];if(!n||typeof n!=\"object\")f.syntax[e]=n={id:e,lbp:t,value:e};return n}function B(e){return H(e,0)}function j(e,t){var n=B(e);return n.identifier=n.reserved=!0,n.fud=t,n}function F(e,t){var n=j(e,t);return n.block=!0,n}function I(e){var t=e.id.charAt(0);if(t>=\"a\"&&t<=\"z\"||t>=\"A\"&&t<=\"Z\")e.identifier=e.reserved=!0;return e}function q(e,t){var n=H(e,150);return I(n),n.nud=typeof t==\"function\"?t:function(){this.right=O(150),this.arity=\"unary\";if(this.id===\"++\"||this.id===\"--\")f.option.plusplus?b(\"W016\",this,this.id):this.right&&(!this.right.identifier||h(this.right))&&this.right.id!==\".\"&&this.right.id!==\"[\"&&b(\"W017\",this);return this},n}function R(e,t){var n=B(e);return n.type=e,n.nud=t,n}function U(e,t){var n=R(e,t);return n.identifier=!0,n.reserved=!0,n}function z(e,t){var n=R(e,t&&t.nud||function(){return this});return t=t||{},t.isFutureReservedWord=!0,n.value=e,n.identifier=!0,n.reserved=!0,n.meta=t,n}function W(e,t){return U(e,function(){return typeof t==\"function\"&&t(this),this})}function X(e,t,n,r){var i=H(e,n);return I(i),i.infix=!0,i.led=function(i){return r||M(f.tokens.prev,f.tokens.curr),e===\"in\"&&i.id===\"!\"&&b(\"W018\",i,\"!\"),typeof t==\"function\"?t(i,this):(this.left=i,this.right=O(n),this)},i}function V(e){var t=H(e,42);return t.led=function(e){return f.option.inESNext()||b(\"W104\",f.tokens.curr,\"arrow function syntax (=>)\"),M(f.tokens.prev,f.tokens.curr),this.left=e,this.right=mt(undefined,undefined,!1,e),this},t}function $(e,t){var r=H(e,100);return r.led=function(e){M(f.tokens.prev,f.tokens.curr);var r=O(100);return n(e,\"NaN\")||n(r,\"NaN\")?b(\"W019\",this):t&&t.apply(this,[e,r]),(!e||!r)&&m(\"E041\",f.tokens.curr.line),e.id===\"!\"&&b(\"W018\",e,\"!\"),r.id===\"!\"&&b(\"W018\",r,\"!\"),this.left=e,this.right=r,this},r}function J(e){return e&&(e.type===\"(number)\"&&+e.value===0||e.type===\"(string)\"&&e.value===\"\"||e.type===\"null\"&&!f.option.eqnull||e.type===\"true\"||e.type===\"false\"||e.type===\"undefined\")}function K(e,t){if(f.option.notypeof)return!1;if(!e||!t)return!1;var n=[\"undefined\",\"object\",\"boolean\",\"number\",\"string\",\"function\",\"xml\",\"object\",\"unknown\"];return t.type===\"(identifier)\"&&t.value===\"typeof\"&&e.type===\"(string)\"?!r.contains(n,e.value):!1}function Q(e){function t(e){if(typeof e!=\"object\")return;return e.right===\"prototype\"?e:t(e.left)}function n(e){while(!e.identifier&&typeof e.left==\"object\")e=e.left;if(e.identifier&&r.indexOf(e.value)>=0)return e.value}var r=[\"Array\",\"ArrayBuffer\",\"Boolean\",\"Collator\",\"DataView\",\"Date\",\"DateTimeFormat\",\"Error\",\"EvalError\",\"Float32Array\",\"Float64Array\",\"Function\",\"Infinity\",\"Intl\",\"Int16Array\",\"Int32Array\",\"Int8Array\",\"Iterator\",\"Number\",\"NumberFormat\",\"Object\",\"RangeError\",\"ReferenceError\",\"RegExp\",\"StopIteration\",\"String\",\"SyntaxError\",\"TypeError\",\"Uint16Array\",\"Uint32Array\",\"Uint8Array\",\"Uint8ClampedArray\",\"URIError\"],i=t(e);if(i)return n(i)}function G(e,t,n){var r=X(e,typeof t==\"function\"?t:function(e,t){t.left=e;if(e){if(f.option.freeze){var n=Q(e);n&&b(\"W121\",e,n)}Jt[e.value]===!1&&Kt[e.value][\"(global)\"]===!0?b(\"W020\",e):e[\"function\"]&&b(\"W021\",e,e.value),jt[e.value]===\"const\"&&E(\"E013\",e,e.value);if(e.id===\".\")return e.left?e.left.value===\"arguments\"&&!f.directive[\"use strict\"]&&b(\"E031\",t):b(\"E031\",t),t.right=O(10),t;if(e.id===\"[\")return f.tokens.curr.left.first?f.tokens.curr.left.first.forEach(function(e){e&&jt[e.value]===\"const\"&&E(\"E013\",e,e.value)}):e.left?e.left.value===\"arguments\"&&!f.directive[\"use strict\"]&&b(\"E031\",t):b(\"E031\",t),t.right=O(10),t;if(e.identifier&&!h(e))return jt[e.value]===\"exception\"&&b(\"W022\",e),t.right=O(10),t;e===f.syntax[\"function\"]&&b(\"W023\",f.tokens.curr)}E(\"E031\",t)},n);return r.exps=!0,r.assign=!0,r}function Y(e,t,n){var r=H(e,n);return I(r),r.led=typeof t==\"function\"?t:function(e){return f.option.bitwise&&b(\"W016\",this,this.id),this.left=e,this.right=O(n),this},r}function Z(e){return G(e,function(e,t){f.option.bitwise&&b(\"W016\",t,t.id);if(e)return e.id===\".\"||e.id===\"[\"||e.identifier&&!h(e)?(O(10),t):(e===f.syntax[\"function\"]&&b(\"W023\",f.tokens.curr),t);E(\"E031\",t)},20)}function et(e){var t=H(e,150);return t.led=function(e){return f.option.plusplus?b(\"W016\",this,this.id):(!e.identifier||h(e))&&e.id!==\".\"&&e.id!==\"[\"&&b(\"W017\",this),this.left=e,this},t}function tt(e,t){if(!f.tokens.next.identifier)return;k();var n=f.tokens.curr,r=f.tokens.curr.value;return h(n)?t&&f.option.inES5()?r:e&&r===\"undefined\"?r:(b(\"W024\",f.tokens.curr,f.tokens.curr.id),r):r}function nt(e,t){var n=tt(e,t);if(n)return n;f.tokens.curr.id===\"function\"&&f.tokens.next.id===\"(\"?b(\"W025\"):E(\"E030\",f.tokens.next,f.tokens.next.value)}function rt(e){var t=0,n;if(f.tokens.next.id!==\";\"||$t)return;for(;;){do n=C(t),t+=1;while(n.id!=\"(end)\"&&n.id===\"(comment)\");if(n.reach)return;if(n.id!==\"(endline)\"){if(n.id===\"function\"){f.option.latedef===!0&&b(\"W026\",n);break}b(\"W027\",n,n.value,e);break}}}function it(){var e,t=Ut,n,i=Kt,s=f.tokens.next;if(s.id===\";\"){k(\";\");return}var o=h(s);o&&s.meta&&s.meta.isFutureReservedWord&&C().id===\":\"&&(b(\"W024\",s,s.id),o=!1);if(r.has([\"[\",\"{\"],s.value)&&on().isDestAssign){f.option.inESNext()||b(\"W104\",f.tokens.curr,\"destructuring expression\"),e=wt(),e.forEach(function(e){g(jt,\"W117\",e.token,e.id)}),k(\"=\"),Et(e,O(10,!0)),k(\";\");return}s.identifier&&!o&&C().id===\":\"&&(k(),k(\":\"),Kt=Object.create(i),T(s.value,{type:\"label\"}),!f.tokens.next.labelled&&f.tokens.next.value!==\"{\"&&b(\"W028\",f.tokens.next,s.value,f.tokens.next.value),f.tokens.next.label=s.value,s=f.tokens.next);if(s.id===\"{\"){var u=jt[\"(verb)\"]===\"case\"&&f.tokens.curr.value===\":\";ut(!0,!0,!1,!1,u);return}return n=O(0,!0),n&&(!n.identifier||n.value!==\"function\")&&n.type!==\"(punctuator)\"&&!f.directive[\"use strict\"]&&f.option.globalstrict&&f.option.strict&&b(\"E007\"),s.block||(!f.option.expr&&(!n||!n.exps)?b(\"W030\",f.tokens.curr):f.option.nonew&&n&&n.left&&n.id===\"(\"&&n.left.id===\"new\"&&b(\"W031\",s),f.tokens.next.id!==\";\"?f.option.asi||(!f.option.lastsemic||f.tokens.next.id!==\"}\"||f.tokens.next.line!==f.tokens.curr.line)&&w(\"W033\",f.tokens.curr.line,f.tokens.curr.character):k(\";\")),Ut=t,Kt=i,n}function st(e){var t=[],n;while(!f.tokens.next.reach&&f.tokens.next.id!==\"(end)\")f.tokens.next.id===\";\"?(n=C(),(!n||n.id!==\"(\"&&n.id!==\"[\")&&b(\"W032\"),k(\";\")):t.push(it(e===f.tokens.next.line));return t}function ot(){var e,t,n;for(;;){if(f.tokens.next.id===\"(string)\"){t=C(0);if(t.id===\"(endline)\"){e=1;do n=C(e),e+=1;while(n.id===\"(endline)\");if(n.id!==\";\"){if(n.id!==\"(string)\"&&n.id!==\"(number)\"&&n.id!==\"(regexp)\"&&n.identifier!==!0&&n.id!==\"}\")break;b(\"W033\",f.tokens.next)}else t=n}else if(t.id===\"}\")b(\"W033\",t);else if(t.id!==\";\")break;k(),f.directive[f.tokens.curr.value]&&b(\"W034\",f.tokens.curr,f.tokens.curr.value),f.tokens.curr.value===\"use strict\"&&(f.option[\"(explicitNewcap)\"]||(f.option.newcap=!0),f.option.undef=!0),f.directive[f.tokens.curr.value]=!0,t.id===\";\"&&k(\";\");continue}break}}function ut(e,t,n,i,s){var o,u=Rt,a=Ut,l,c=Kt,h,p,d;Rt=e;if(!e||!f.option.funcscope)Kt=Object.create(Kt);h=f.tokens.next;var v=jt[\"(metrics)\"];v.nestedBlockDepth+=1,v.verifyMaxNestedBlockDepthPerFunction();if(f.tokens.next.id===\"{\"){k(\"{\"),jt[\"(blockscope)\"].stack(),p=f.tokens.curr.line;if(f.tokens.next.id!==\"}\"){Ut+=f.option.indent;while(!e&&f.tokens.next.from>Ut)Ut+=f.option.indent;if(n){l={};for(d in f.directive)r.has(f.directive,d)&&(l[d]=f.directive[d]);ot(),f.option.strict&&jt[\"(context)\"][\"(global)\"]&&!l[\"use strict\"]&&!f.directive[\"use strict\"]&&b(\"E007\")}o=st(p),v.statementCount+=o.length,n&&(f.directive=l),Ut-=f.option.indent}k(\"}\",h),jt[\"(blockscope)\"].unstack(),Ut=a}else if(!e)if(n){l={},t&&!i&&!f.option.inMoz(!0)&&E(\"W118\",f.tokens.curr,\"function closure expressions\");if(!t)for(d in f.directive)r.has(f.directive,d)&&(l[d]=f.directive[d]);O(10),f.option.strict&&jt[\"(context)\"][\"(global)\"]&&!l[\"use strict\"]&&!f.directive[\"use strict\"]&&b(\"E007\")}else E(\"E021\",f.tokens.next,\"{\",f.tokens.next.value);else jt[\"(nolet)\"]=!0,(!t||f.option.curly)&&b(\"W116\",f.tokens.next,\"{\",f.tokens.next.value),$t=!0,Ut+=f.option.indent,o=[it()],Ut-=f.option.indent,$t=!1,delete jt[\"(nolet)\"];switch(jt[\"(verb)\"]){case\"break\":case\"continue\":case\"return\":case\"throw\":if(s)break;default:jt[\"(verb)\"]=null}if(!e||!f.option.funcscope)Kt=c;return Rt=u,e&&f.option.noempty&&(!o||o.length===0)&&b(\"W035\"),v.nestedBlockDepth-=1,o}function at(e){Vt&&typeof Vt[e]!=\"boolean\"&&b(\"W036\",f.tokens.curr,e),typeof Xt[e]==\"number\"?Xt[e]+=1:Xt[e]=1}function ft(e){var t=e.value,n=Object.getOwnPropertyDescriptor(qt,t);n?n.value.push(e.line):qt[t]=[e.line]}function lt(){var e={};e.exps=!0,jt[\"(comparray)\"].stack();var t=!1;return f.tokens.next.value!==\"for\"&&(t=!0,f.option.inMoz(!0)||b(\"W116\",f.tokens.next,\"for\",f.tokens.next.value),jt[\"(comparray)\"].setState(\"use\"),e.right=O(10)),k(\"for\"),f.tokens.next.value===\"each\"&&(k(\"each\"),f.option.inMoz(!0)||b(\"W118\",f.tokens.curr,\"for each\")),k(\"(\"),jt[\"(comparray)\"].setState(\"define\"),e.left=O(130),r.contains([\"in\",\"of\"],f.tokens.next.value)?k():E(\"E045\",f.tokens.curr),jt[\"(comparray)\"].setState(\"generate\"),O(10),k(\")\"),f.tokens.next.value===\"if\"&&(k(\"if\"),k(\"(\"),jt[\"(comparray)\"].setState(\"filter\"),e.filter=O(10),k(\")\")),t||(jt[\"(comparray)\"].setState(\"use\"),e.right=O(10)),k(\"]\"),jt[\"(comparray)\"].unstack(),e}function ct(){var e=tt(!1,!0);return e||(f.tokens.next.id===\"(string)\"?(e=f.tokens.next.value,k()):f.tokens.next.id===\"(number)\"&&(e=f.tokens.next.value.toString(),k())),e===\"hasOwnProperty\"&&b(\"W001\"),e}function ht(e){var t,n,i=[],s,o=[],u,a=!1;if(e){if(Array.isArray(e)){for(var l in e){t=e[l];if(t.value===\"...\"){f.option.inESNext()||b(\"W104\",t,\"spread/rest operator\");continue}t.value!==\",\"&&(i.push(t.value),T(t.value,{type:\"unused\",token:t}))}return i}if(e.identifier===!0)return T(e.value,{type:\"unused\",token:e}),[e]}n=f.tokens.next,k(\"(\");if(f.tokens.next.id===\")\"){k(\")\");return}for(;;){if(r.contains([\"{\",\"[\"],f.tokens.next.id)){o=wt();for(u in o)u=o[u],u.id&&(i.push(u.id),T(u.id,{type:\"unused\",token:u.token}))}else f.tokens.next.value===\"...\"?(f.option.inESNext()||b(\"W104\",f.tokens.next,\"spread/rest operator\"),k(\"...\"),s=nt(!0),i.push(s),T(s,{type:\"unused\",token:f.tokens.curr})):(s=nt(!0),i.push(s),T(s,{type:\"unused\",token:f.tokens.curr}));a&&f.tokens.next.id!==\"=\"&&E(\"E051\",f.tokens.current),f.tokens.next.id===\"=\"&&(f.option.inESNext()||b(\"W119\",f.tokens.next,\"default parameters\"),k(\"=\"),a=!0,O(10));if(f.tokens.next.id!==\",\")return k(\")\",n),i;P()}}function pt(e,t,n){e[\"(properties)\"][t]||(e[\"(properties)\"][t]={unused:!1}),r.extend(e[\"(properties)\"][t],n)}function dt(e,t,n){return e[\"(properties)\"][t]?e[\"(properties)\"][t][n]||null:null}function vt(e,t,n,i){var s={\"(name)\":e,\"(breakage)\":0,\"(loopage)\":0,\"(scope)\":n,\"(tokens)\":{},\"(properties)\":{},\"(catch)\":!1,\"(global)\":!1,\"(line)\":null,\"(character)\":null,\"(metrics)\":null,\"(statement)\":null,\"(context)\":null,\"(blockscope)\":null,\"(comparray)\":null,\"(generator)\":null,\"(params)\":null};return t&&r.extend(s,{\"(line)\":t.line,\"(character)\":t.character,\"(metrics)\":gt(t)}),r.extend(s,i),s[\"(context)\"]&&(s[\"(blockscope)\"]=s[\"(context)\"][\"(blockscope)\"],s[\"(comparray)\"]=s[\"(context)\"][\"(comparray)\"]),s}function mt(e,t,n,i){var s,o=f.option,u=f.ignored,a=Kt;return f.option=Object.create(f.option),f.ignored=Object.create(f.ignored),Kt=Object.create(Kt),jt=vt(e||'\"'+Ct+'\"',f.tokens.next,Kt,{\"(statement)\":t,\"(context)\":jt,\"(generator)\":n?!0:null}),s=jt,f.tokens.curr.funct=jt,Ft.push(jt),e&&T(e,{type:\"function\"}),jt[\"(params)\"]=ht(i),jt[\"(metrics)\"].verifyMaxParametersPerFunction(jt[\"(params)\"]),c.undefs=r.filter(c.undefs,function(e){return!r.contains(r.union(i),e[2])}),ut(!1,!0,!0,i?!0:!1),!f.option.noyield&&n&&jt[\"(generator)\"]!==\"yielded\"&&b(\"W124\",f.tokens.curr),jt[\"(metrics)\"].verifyMaxStatementsPerFunction(),jt[\"(metrics)\"].verifyMaxComplexityPerFunction(),jt[\"(unusedOption)\"]=f.option.unused,Kt=a,f.option=o,f.ignored=u,jt[\"(last)\"]=f.tokens.curr.line,jt[\"(lastcharacter)\"]=f.tokens.curr.character,r.map(Object.keys(jt),function(e){if(e[0]===\"(\")return;jt[\"(blockscope)\"].unshadow(e)}),jt=jt[\"(context)\"],s}function gt(e){return{statementCount:0,nestedBlockDepth:-1,ComplexityCount:1,verifyMaxStatementsPerFunction:function(){f.option.maxstatements&&this.statementCount>f.option.maxstatements&&b(\"W071\",e,this.statementCount)},verifyMaxParametersPerFunction:function(t){t=t||[],f.option.maxparams&&t.length>f.option.maxparams&&b(\"W072\",e,t.length)},verifyMaxNestedBlockDepthPerFunction:function(){f.option.maxdepth&&this.nestedBlockDepth>0&&this.nestedBlockDepth===f.option.maxdepth+1&&b(\"W073\",null,this.nestedBlockDepth)},verifyMaxComplexityPerFunction:function(){var t=f.option.maxcomplexity,n=this.ComplexityCount;t&&n>t&&b(\"W074\",e,n)}}}function yt(){jt[\"(metrics)\"].ComplexityCount+=1}function bt(e){var t,n;e&&(t=e.id,n=e.paren,t===\",\"&&(e=e.exprs[e.exprs.length-1])&&(t=e.id,n=n||e.paren));switch(t){case\"=\":case\"+=\":case\"-=\":case\"*=\":case\"%=\":case\"&=\":case\"|=\":case\"^=\":case\"/=\":!n&&!f.option.boss&&b(\"W084\")}}function wt(){var e,t,n=[];f.option.inESNext()||b(\"W104\",f.tokens.curr,\"destructuring expression\");var i=function(){var e;if(r.contains([\"[\",\"{\"],f.tokens.next.value)){t=wt();for(var s in t)s=t[s],n.push({id:s.id,token:s.token})}else f.tokens.next.value===\",\"?n.push({id:null,token:f.tokens.curr}):f.tokens.next.value===\"(\"?(k(\"(\"),i(),k(\")\")):(e=nt(),e&&n.push({id:e,token:f.tokens.curr}))};if(f.tokens.next.value===\"[\"){k(\"[\"),i();while(f.tokens.next.value!==\"]\")k(\",\"),i();k(\"]\")}else if(f.tokens.next.value===\"{\"){k(\"{\"),e=nt(),f.tokens.next.value===\":\"?(k(\":\"),i()):n.push({id:e,token:f.tokens.curr});while(f.tokens.next.value!==\"}\")k(\",\"),e=nt(),f.tokens.next.value===\":\"?(k(\":\"),i()):n.push({id:e,token:f.tokens.curr});k(\"}\")}return n}function Et(e,t){var n=t.first;if(!n)return;r.zip(e,Array.isArray(n)?n:[n]).forEach(function(e){var t=e[0],n=e[1];t&&n?t.first=n:t&&t.first&&!n&&b(\"W080\",t.first,t.first.value)})}function St(e){return f.option.inESNext()||b(\"W104\",f.tokens.curr,\"class\"),e?(this.name=nt(),T(this.name,{type:\"unused\",token:f.tokens.curr})):f.tokens.next.identifier&&f.tokens.next.value!==\"extends\"&&(this.name=nt()),xt(this),this}function xt(e){var t=f.directive[\"use strict\"];f.tokens.next.value===\"extends\"&&(k(\"extends\"),e.heritage=O(10)),f.directive[\"use strict\"]=!0,k(\"{\"),e.body=f.syntax[\"{\"].nud(!0),f.directive[\"use strict\"]=t}function Tt(){var e=on();e.notJson?(!f.option.inESNext()&&e.isDestAssign&&b(\"W104\",f.tokens.curr,\"destructuring assignment\"),st()):(f.option.laxbreak=!0,f.jsonMode=!0,Nt())}function Nt(){function e(){var e={},t=f.tokens.next;k(\"{\");if(f.tokens.next.id!==\"}\")for(;;){if(f.tokens.next.id===\"(end)\")E(\"E026\",f.tokens.next,t.line);else{if(f.tokens.next.id===\"}\"){b(\"W094\",f.tokens.curr);break}f.tokens.next.id===\",\"?E(\"E028\",f.tokens.next):f.tokens.next.id!==\"(string)\"&&b(\"W095\",f.tokens.next,f.tokens.next.value)}e[f.tokens.next.value]===!0?b(\"W075\",f.tokens.next,f.tokens.next.value):f.tokens.next.value===\"__proto__\"&&!f.option.proto||f.tokens.next.value===\"__iterator__\"&&!f.option.iterator?b(\"W096\",f.tokens.next,f.tokens.next.value):e[f.tokens.next.value]=!0,k(),k(\":\"),Nt();if(f.tokens.next.id!==\",\")break;k(\",\")}k(\"}\")}function t(){var e=f.tokens.next;k(\"[\");if(f.tokens.next.id!==\"]\")for(;;){if(f.tokens.next.id===\"(end)\")E(\"E027\",f.tokens.next,e.line);else{if(f.tokens.next.id===\"]\"){b(\"W094\",f.tokens.curr);break}f.tokens.next.id===\",\"&&E(\"E028\",f.tokens.next)}Nt();if(f.tokens.next.id!==\",\")break;k(\",\")}k(\"]\")}switch(f.tokens.next.id){case\"{\":e();break;case\"[\":t();break;case\"true\":case\"false\":case\"null\":case\"(number)\":case\"(string)\":k();break;case\"-\":k(\"-\"),k(\"(number)\");break;default:E(\"E003\",f.tokens.next)}}var Ct,kt,Lt={\"<\":!0,\"<=\":!0,\"==\":!0,\"===\":!0,\"!==\":!0,\"!=\":!0,\">\":!0,\">=\":!0,\"+\":!0,\"-\":!0,\"*\":!0,\"/\":!0,\"%\":!0},At={asi:!0,bitwise:!0,boss:!0,browser:!0,camelcase:!0,couch:!0,curly:!0,debug:!0,devel:!0,dojo:!0,eqeqeq:!0,eqnull:!0,notypeof:!0,es3:!0,es5:!0,esnext:!0,moz:!0,evil:!0,expr:!0,forin:!0,funcscope:!0,globalstrict:!0,immed:!0,iterator:!0,jquery:!0,lastsemic:!0,laxbreak:!0,laxcomma:!0,loopfunc:!0,mootools:!0,multistr:!0,freeze:!0,newcap:!0,noarg:!0,node:!0,noempty:!0,nonbsp:!0,nonew:!0,nonstandard:!0,phantom:!0,plusplus:!0,proto:!0,prototypejs:!0,rhino:!0,shelljs:!0,typed:!0,undef:!0,scripturl:!0,strict:!0,sub:!0,supernew:!0,validthis:!0,withstmt:!0,worker:!0,wsh:!0,yui:!0,mocha:!0,noyield:!0,onecase:!0,regexp:!0,regexdash:!0},Ot={maxlen:!1,indent:!1,maxerr:!1,predef:!1,globals:!1,quotmark:!1,scope:!1,maxstatements:!1,maxdepth:!1,maxparams:!1,maxcomplexity:!1,shadow:!1,unused:!0,latedef:!1,ignore:!1},Mt={bitwise:!0,forin:!0,newcap:!0,plusplus:!0,regexp:!0,undef:!0,eqeqeq:!0,strict:!0},_t={eqeq:\"eqeqeq\",windows:\"wsh\",sloppy:\"strict\"},Dt={nomen:!0,onevar:!0,passfail:!0,white:!0,gcl:!0,smarttabs:!0,trailing:!0},Pt,Ht,Bt=[\"closure\",\"exception\",\"global\",\"label\",\"outer\",\"unused\",\"var\"],jt,Ft,It,qt,Rt,Ut,zt,Wt,Xt,Vt,$t,Jt,Kt,Qt,Gt,Yt,Zt=[],en=new i.EventEmitter;R(\"(number)\",function(){return this}),R(\"(string)\",function(){return this}),R(\"(template)\",function(){return this}),f.syntax[\"(identifier)\"]={type:\"(identifier)\",lbp:0,identifier:!0,nud:function(){var e=this.value,t=Kt[e],n,r;typeof t==\"function\"?t=undefined:!jt[\"(blockscope)\"].current.has(e)&&typeof t==\"boolean\"&&(n=jt,jt=Ft[0],T(e,{type:\"var\"}),t=jt,jt=n),r=jt[\"(blockscope)\"].getlabel(e);if(jt===t||r)switch(r?r[e][\"(type)\"]:jt[e]){case\"unused\":r?r[e][\"(type)\"]=\"var\":jt[e]=\"var\";break;case\"unction\":r?r[e][\"(type)\"]=\"function\":jt[e]=\"function\",this[\"function\"]=!0;break;case\"const\":pt(jt,e,{unused:!1});break;case\"function\":this[\"function\"]=!0;break;case\"label\":b(\"W037\",f.tokens.curr,e)}else if(jt[\"(global)\"])typeof Jt[e]!=\"boolean\"&&(Ct!==\"typeof\"&&Ct!==\"delete\"||f.tokens.next&&(f.tokens.next.value===\".\"||f.tokens.next.value===\"[\"))&&(jt[\"(comparray)\"].check(e)||g(jt,\"W117\",f.tokens.curr,e)),ft(f.tokens.curr);else switch(jt[e]){case\"closure\":case\"function\":case\"var\":case\"unused\":b(\"W038\",f.tokens.curr,e);break;case\"label\":b(\"W037\",f.tokens.curr,e);break;case\"outer\":case\"global\":break;default:if(t===!0)jt[e]=!0;else if(t===null)b(\"W039\",f.tokens.curr,e),ft(f.tokens.curr);else if(typeof t!=\"object\")(Ct!==\"typeof\"&&Ct!==\"delete\"||f.tokens.next&&(f.tokens.next.value===\".\"||f.tokens.next.value===\"[\"))&&g(jt,\"W117\",f.tokens.curr,e),jt[e]=!0,ft(f.tokens.curr);else switch(t[e]){case\"function\":case\"unction\":this[\"function\"]=!0,t[e]=\"closure\",jt[e]=t[\"(global)\"]?\"global\":\"outer\";break;case\"var\":case\"unused\":t[e]=\"closure\",jt[e]=t[\"(global)\"]?\"global\":\"outer\";break;case\"const\":pt(t,e,{unused:!1});break;case\"closure\":jt[e]=t[\"(global)\"]?\"global\":\"outer\";break;case\"label\":b(\"W037\",f.tokens.curr,e)}}return this},led:function(){E(\"E033\",f.tokens.next,f.tokens.next.value)}},R(\"(regexp)\",function(){return this}),B(\"(endline)\"),B(\"(begin)\"),B(\"(end)\").reach=!0,B(\"(error)\").reach=!0,B(\"}\").reach=!0,B(\")\"),B(\"]\"),B('\"').reach=!0,B(\"'\").reach=!0,B(\";\"),B(\":\").reach=!0,B(\"#\"),U(\"else\"),U(\"case\").reach=!0,U(\"catch\"),U(\"default\").reach=!0,U(\"finally\"),W(\"arguments\",function(e){f.directive[\"use strict\"]&&jt[\"(global)\"]&&b(\"E008\",e)}),W(\"eval\"),W(\"false\"),W(\"Infinity\"),W(\"null\"),W(\"this\",function(e){f.directive[\"use strict\"]&&!f.option.validthis&&(jt[\"(statement)\"]&&jt[\"(name)\"].charAt(0)>\"Z\"||jt[\"(global)\"])&&b(\"W040\",e)}),W(\"true\"),W(\"undefined\"),G(\"=\",\"assign\",20),G(\"+=\",\"assignadd\",20),G(\"-=\",\"assignsub\",20),G(\"*=\",\"assignmult\",20),G(\"/=\",\"assigndiv\",20).nud=function(){E(\"E014\")},G(\"%=\",\"assignmod\",20),Z(\"&=\",\"assignbitand\",20),Z(\"|=\",\"assignbitor\",20),Z(\"^=\",\"assignbitxor\",20),Z(\"<<=\",\"assignshiftleft\",20),Z(\">>=\",\"assignshiftright\",20),Z(\">>>=\",\"assignshiftrightunsigned\",20),X(\",\",function(e,t){var n;t.exprs=[e];if(!P({peek:!0}))return t;for(;;){if(!(n=O(10)))break;t.exprs.push(n);if(f.tokens.next.value!==\",\"||!P())break}return t},10,!0),X(\"?\",function(e,t){return yt(),t.left=e,t.right=O(10),k(\":\"),t[\"else\"]=O(10),t},30);var tn=40;X(\"||\",function(e,t){return yt(),t.left=e,t.right=O(tn),t},tn),X(\"&&\",\"and\",50),Y(\"|\",\"bitor\",70),Y(\"^\",\"bitxor\",80),Y(\"&\",\"bitand\",90),$(\"==\",function(e,t){var n=f.option.eqnull&&(e.value===\"null\"||t.value===\"null\");switch(!0){case!n&&f.option.eqeqeq:this.from=this.character,b(\"W116\",this,\"===\",\"==\");break;case J(e):b(\"W041\",this,\"===\",e.value);break;case J(t):b(\"W041\",this,\"===\",t.value);break;case K(t,e):b(\"W122\",this,t.value);break;case K(e,t):b(\"W122\",this,e.value)}return this}),$(\"===\",function(e,t){return K(t,e)?b(\"W122\",this,t.value):K(e,t)&&b(\"W122\",this,e.value),this}),$(\"!=\",function(e,t){var n=f.option.eqnull&&(e.value===\"null\"||t.value===\"null\");return!n&&f.option.eqeqeq?(this.from=this.character,b(\"W116\",this,\"!==\",\"!=\")):J(e)?b(\"W041\",this,\"!==\",e.value):J(t)?b(\"W041\",this,\"!==\",t.value):K(t,e)?b(\"W122\",this,t.value):K(e,t)&&b(\"W122\",this,e.value),this}),$(\"!==\",function(e,t){return K(t,e)?b(\"W122\",this,t.value):K(e,t)&&b(\"W122\",this,e.value),this}),$(\"<\"),$(\">\"),$(\"<=\"),$(\">=\"),Y(\"<<\",\"shiftleft\",120),Y(\">>\",\"shiftright\",120),Y(\">>>\",\"shiftrightunsigned\",120),X(\"in\",\"in\",120),X(\"instanceof\",\"instanceof\",120),X(\"+\",function(e,t){var n=O(130);return e&&n&&e.id===\"(string)\"&&n.id===\"(string)\"?(e.value+=n.value,e.character=n.character,!f.option.scripturl&&a.javascriptURL.test(e.value)&&b(\"W050\",e),e):(t.left=e,t.right=n,t)},130),q(\"+\",\"num\"),q(\"+++\",function(){return b(\"W007\"),this.right=O(150),this.arity=\"unary\",this}),X(\"+++\",function(e){return b(\"W007\"),this.left=e,this.right=O(130),this},130),X(\"-\",\"sub\",130),q(\"-\",\"neg\"),q(\"---\",function(){return b(\"W006\"),this.right=O(150),this.arity=\"unary\",this}),X(\"---\",function(e){return b(\"W006\"),this.left=e,this.right=O(130),this},130),X(\"*\",\"mult\",140),X(\"/\",\"div\",140),X(\"%\",\"mod\",140),et(\"++\",\"postinc\"),q(\"++\",\"preinc\"),f.syntax[\"++\"].exps=!0,et(\"--\",\"postdec\"),q(\"--\",\"predec\"),f.syntax[\"--\"].exps=!0,q(\"delete\",function(){var e=O(10);return(!e||e.id!==\".\"&&e.id!==\"[\")&&b(\"W051\"),this.first=e,this}).exps=!0,q(\"~\",function(){return f.option.bitwise&&b(\"W052\",this,\"~\"),O(150),this}),q(\"...\",function(){return f.option.inESNext()||b(\"W104\",this,\"spread/rest operator\"),f.tokens.next.identifier||E(\"E030\",f.tokens.next,f.tokens.next.value),O(150),this}),q(\"!\",function(){return this.right=O(150),this.arity=\"unary\",this.right||m(\"E041\",this.line||0),Lt[this.right.id]===!0&&b(\"W018\",this,\"!\"),this}),q(\"typeof\",\"typeof\"),q(\"new\",function(){var e=O(155),t;if(e&&e.id!==\"function\")if(e.identifier){e[\"new\"]=!0;switch(e.value){case\"Number\":case\"String\":case\"Boolean\":case\"Math\":case\"JSON\":b(\"W053\",f.tokens.prev,e.value);break;case\"Function\":f.option.evil||b(\"W054\");break;case\"Date\":case\"RegExp\":case\"this\":break;default:e.id!==\"function\"&&(t=e.value.substr(0,1),f.option.newcap&&(t<\"A\"||t>\"Z\")&&!r.has(It,e.value)&&b(\"W055\",f.tokens.curr))}}else e.id!==\".\"&&e.id!==\"[\"&&e.id!==\"(\"&&b(\"W056\",f.tokens.curr);else f.option.supernew||b(\"W057\",this);return f.tokens.next.id!==\"(\"&&!f.option.supernew&&b(\"W058\",f.tokens.curr,f.tokens.curr.value),this.first=e,this}),f.syntax[\"new\"].exps=!0,q(\"void\").exps=!0,X(\".\",function(e,t){var n=nt(!1,!0);return typeof n==\"string\"&&at(n),t.left=e,t.right=n,n&&n===\"hasOwnProperty\"&&f.tokens.next.value===\"=\"&&b(\"W001\"),!e||e.value!==\"arguments\"||n!==\"callee\"&&n!==\"caller\"?!f.option.evil&&e&&e.value===\"document\"&&(n===\"write\"||n===\"writeln\")&&b(\"W060\",e):f.option.noarg?b(\"W059\",e,n):f.directive[\"use strict\"]&&E(\"E008\"),!f.option.evil&&(n===\"eval\"||n===\"execScript\")&&b(\"W061\"),t},160,!0),X(\"(\",function(e,t){f.option.immed&&e&&!e.immed&&e.id===\"function\"&&b(\"W062\");var n=0,r=[];e&&e.type===\"(identifier)\"&&e.value.match(/^[A-Z]([A-Z0-9_$]*[a-z][A-Za-z0-9_$]*)?$/)&&\"Number String Boolean Date Object Error\".indexOf(e.value)===-1&&(e.value===\"Math\"?b(\"W063\",e):f.option.newcap&&b(\"W064\",e));if(f.tokens.next.id!==\")\")for(;;){r[r.length]=O(10),n+=1;if(f.tokens.next.id!==\",\")break;P()}return k(\")\"),typeof e==\"object\"&&(f.option.inES3()&&e.value===\"parseInt\"&&n===1&&b(\"W065\",f.tokens.curr),f.option.evil||(e.value===\"eval\"||e.value===\"Function\"||e.value===\"execScript\"?(b(\"W061\",e),r[0]&&[0].id===\"(string)\"&&x(e,r[0].value)):!r[0]||r[0].id!==\"(string)\"||e.value!==\"setTimeout\"&&e.value!==\"setInterval\"?r[0]&&r[0].id===\"(string)\"&&e.value===\".\"&&e.left.value===\"window\"&&(e.right===\"setTimeout\"||e.right===\"setInterval\")&&(b(\"W066\",e),x(e,r[0].value)):(b(\"W066\",e),x(e,r[0].value))),!e.identifier&&e.id!==\".\"&&e.id!==\"[\"&&e.id!==\"(\"&&e.id!==\"&&\"&&e.id!==\"||\"&&e.id!==\"?\"&&b(\"W067\",e)),t.left=e,t},155,!0).exps=!0,q(\"(\",function(){var e,t=[],n,i,s=0,o,u=1;do n=C(s),n.value===\"(\"?u+=1:n.value===\")\"&&(u-=1),s+=1,i=C(s);while((u!==0||n.value!==\")\")&&i.value!==\"=>\"&&i.value!==\";\"&&i.type!==\"(end)\");f.tokens.next.id===\"function\"&&(f.tokens.next.immed=!0);var a=[];if(f.tokens.next.id!==\")\")for(;;){if(i.value===\"=>\"&&r.contains([\"{\",\"[\"],f.tokens.next.value)){e=f.tokens.next,e.left=wt(),t.push(e);for(var l in e.left)a.push(e.left[l].token)}else a.push(O(10));if(f.tokens.next.id!==\",\")break;P()}k(\")\",this),f.option.immed&&a[0]&&a[0].id===\"function\"&&f.tokens.next.id!==\"(\"&&(f.tokens.next.id!==\".\"||C().value!==\"call\"&&C().value!==\"apply\")&&b(\"W068\",this);if(f.tokens.next.value===\"=>\")return a;if(!a.length)return;return a.length>1?(o=Object.create(f.syntax[\",\"]),o.exprs=a):o=a[0],o&&(o.paren=!0),o}),V(\"=>\"),X(\"[\",function(e,t){var n=O(10),r;return n&&n.type===\"(string)\"&&(!f.option.evil&&(n.value===\"eval\"||n.value===\"execScript\")&&b(\"W061\",t),at(n.value),!f.option.sub&&a.identifier.test(n.value)&&(r=f.syntax[n.value],(!r||!h(r))&&b(\"W069\",f.tokens.prev,n.value))),k(\"]\",t),n&&n.value===\"hasOwnProperty\"&&f.tokens.next.value===\"=\"&&b(\"W001\"),t.left=e,t.right=n,t},160,!0),q(\"[\",function(){var e=on(!0);if(e.isCompArray)return f.option.inESNext()||b(\"W119\",f.tokens.curr,\"array comprehension\"),lt();e.isDestAssign&&!f.option.inESNext()&&b(\"W104\",f.tokens.curr,\"destructuring assignment\");var t=f.tokens.curr.line!==f.tokens.next.line;this.first=[],t&&(Ut+=f.option.indent,f.tokens.next.from===Ut+f.option.indent&&(Ut+=f.option.indent));while(f.tokens.next.id!==\"(end)\"){while(f.tokens.next.id===\",\")f.option.inES5()||b(\"W070\"),k(\",\");if(f.tokens.next.id===\"]\")break;this.first.push(O(10));if(f.tokens.next.id!==\",\")break;P({allowTrailing:!0});if(f.tokens.next.id===\"]\"&&!f.option.inES5(!0)){b(\"W070\",f.tokens.curr);break}}return t&&(Ut-=f.option.indent),k(\"]\",this),this},160),function(e){e.nud=function(e){function t(e,t){h[e]&&r.has(h,e)?b(\"W075\",f.tokens.next,u):h[e]={},h[e].basic=!0,h[e].basictkn=t}function n(e,t){h[e]&&r.has(h,e)?(h[e].basic||h[e].setter)&&b(\"W075\",f.tokens.next,u):h[e]={},h[e].setter=!0,h[e].setterToken=t}function i(e){h[e]&&r.has(h,e)?(h[e].basic||h[e].getter)&&b(\"W075\",f.tokens.next,u):h[e]={},h[e].getter=!0,h[e].getterToken=f.tokens.curr}var s,o,u,a,l,c,h={},p=\"\";s=f.tokens.curr.line!==f.tokens.next.line,s&&(Ut+=f.option.indent,f.tokens.next.from===Ut+f.option.indent&&(Ut+=f.option.indent));for(;;){if(f.tokens.next.id===\"}\")break;e&&f.tokens.next.value===\"static\"&&(k(\"static\"),p=\"static \");if(f.tokens.next.value===\"get\"&&C().id!==\":\")k(\"get\"),f.option.inES5(!e)||E(\"E034\"),u=ct(),!u&&!f.option.inESNext()&&E(\"E035\"),e&&u===\"constructor\"&&E(\"E049\",f.tokens.next,\"class getter method\",u),u&&i(p+u),l=f.tokens.next,o=mt(),a=o[\"(params)\"],u&&a&&b(\"W076\",l,a[0],u);else if(f.tokens.next.value===\"set\"&&C().id!==\":\")k(\"set\"),f.option.inES5(!e)||E(\"E034\"),u=ct(),!u&&!f.option.inESNext()&&E(\"E035\"),e&&u===\"constructor\"&&E(\"E049\",f.tokens.next,\"class setter method\",u),u&&n(p+u,f.tokens.next),l=f.tokens.next,o=mt(),a=o[\"(params)\"],u&&(!a||a.length!==1)&&b(\"W077\",l,u);else{c=!1,f.tokens.next.value===\"*\"&&f.tokens.next.type===\"(punctuator)\"&&(f.option.inESNext()||b(\"W104\",f.tokens.next,\"generator functions\"),k(\"*\"),c=!0),u=ct(),t(p+u,f.tokens.next);if(typeof u!=\"string\")break;f.tokens.next.value===\"(\"?(f.option.inESNext()||b(\"W104\",f.tokens.curr,\"concise methods\"),mt(u,undefined,c)):e||(k(\":\"),O(10))}e&&u===\"prototype\"&&E(\"E049\",f.tokens.next,\"class method\",u),at(u);if(e){p=\"\";continue}if(f.tokens.next.id!==\",\")break;P({allowTrailing:!0,property:!0}),f.tokens.next.id===\",\"?b(\"W070\",f.tokens.curr):f.tokens.next.id===\"}\"&&!f.option.inES5(!0)&&b(\"W070\",f.tokens.curr)}s&&(Ut-=f.option.indent),k(\"}\",this);if(f.option.inES5())for(var d in h)r.has(h,d)&&h[d].setter&&!h[d].getter&&b(\"W078\",h[d].setterToken);return this},e.fud=function(){E(\"E036\",f.tokens.curr)}}(B(\"{\"));var nn=j(\"const\",function(e){var t,n,i;f.option.inESNext()||b(\"W104\",f.tokens.curr,\"const\"),this.first=[];for(;;){var s=[];r.contains([\"{\",\"[\"],f.tokens.next.value)?(t=wt(),i=!1):(t=[{id:nt(),token:f.tokens.curr}],i=!0);for(var o in t)t.hasOwnProperty(o)&&(o=t[o],jt[o.id]===\"const\"&&b(\"E011\",null,o.id),jt[\"(global)\"]&&Jt[o.id]===!1&&b(\"W079\",o.token,o.id),o.id&&(T(o.id,{token:o.token,type:\"const\",unused:!0}),s.push(o.token)));if(e)break;this.first=this.first.concat(s),f.tokens.next.id!==\"=\"&&b(\"E012\",f.tokens.curr,f.tokens.curr.value),f.tokens.next.id===\"=\"&&(k(\"=\"),f.tokens.next.id===\"undefined\"&&b(\"W080\",f.tokens.prev,f.tokens.prev.value),C(0).id===\"=\"&&f.tokens.next.identifier&&b(\"W120\",f.tokens.next,f.tokens.next.value),n=O(10),i?t[0].first=n:Et(s,n));if(f.tokens.next.id!==\",\")break;P()}return this});nn.exps=!0;var rn=j(\"var\",function(e){var t,n,i;this.first=[];for(;;){var s=[];r.contains([\"{\",\"[\"],f.tokens.next.value)?(t=wt(),n=!1):(t=[{id:nt(),token:f.tokens.curr}],n=!0);for(var o in t)t.hasOwnProperty(o)&&(o=t[o],f.option.inESNext()&&jt[o.id]===\"const\"&&b(\"E011\",null,o.id),jt[\"(global)\"]&&Jt[o.id]===!1&&b(\"W079\",o.token,o.id),o.id&&(T(o.id,{type:\"unused\",token:o.token}),s.push(o.token)));if(e)break;this.first=this.first.concat(s),f.tokens.next.id===\"=\"&&(k(\"=\"),f.tokens.next.id===\"undefined\"&&b(\"W080\",f.tokens.prev,f.tokens.prev.value),C(0).id===\"=\"&&f.tokens.next.identifier&&b(\"W120\",f.tokens.next,f.tokens.next.value),i=O(10),n?t[0].first=i:Et(s,i));if(f.tokens.next.id!==\",\")break;P()}return this});rn.exps=!0;var sn=j(\"let\",function(e){var t,n,i,s;f.option.inESNext()||b(\"W104\",f.tokens.curr,\"let\"),f.tokens.next.value===\"(\"?(f.option.inMoz(!0)||b(\"W118\",f.tokens.next,\"let block\"),k(\"(\"),jt[\"(blockscope)\"].stack(),s=!0):jt[\"(nolet)\"]&&E(\"E048\",f.tokens.curr),this.first=[];for(;;){var o=[];r.contains([\"{\",\"[\"],f.tokens.next.value)?(t=wt(),n=!1):(t=[{id:nt(),token:f.tokens.curr.value}],n=!0);for(var u in t)t.hasOwnProperty(u)&&(u=t[u],f.option.inESNext()&&jt[u.id]===\"const\"&&b(\"E011\",null,u.id),jt[\"(global)\"]&&Jt[u.id]===!1&&b(\"W079\",u.token,u.id),u.id&&!jt[\"(nolet)\"]&&(T(u.id,{type:\"unused\",token:u.token,islet:!0}),o.push(u.token)));if(e)break;this.first=this.first.concat(o),f.tokens.next.id===\"=\"&&(k(\"=\"),f.tokens.next.id===\"undefined\"&&b(\"W080\",f.tokens.prev,f.tokens.prev.value),C(0).id===\"=\"&&f.tokens.next.identifier&&b(\"W120\",f.tokens.next,f.tokens.next.value),i=O(10),n?t[0].first=i:Et(o,i));if(f.tokens.next.id!==\",\")break;P()}return s&&(k(\")\"),ut(!0,!0),this.block=!0,jt[\"(blockscope)\"].unstack()),this});sn.exps=!0,F(\"class\",function(){return St.call(this,!0)}),F(\"function\",function(){var e=!1;f.tokens.next.value===\"*\"&&(k(\"*\"),f.option.inESNext(!0)?e=!0:b(\"W119\",f.tokens.curr,\"function*\")),Rt&&b(\"W082\",f.tokens.curr);var t=nt();return jt[t]===\"const\"&&b(\"E011\",null,t),T(t,{type:\"unction\",token:f.tokens.curr}),mt(t,{statement:!0},e),f.tokens.next.id===\"(\"&&f.tokens.next.line===f.tokens.curr.line&&E(\"E039\"),this}),q(\"function\",function(){var e=!1;f.tokens.next.value===\"*\"&&(f.option.inESNext()||b(\"W119\",f.tokens.curr,\"function*\"),k(\"*\"),e=!0);var t=tt();return mt(t,undefined,e),!f.option.loopfunc&&jt[\"(loopage)\"]&&b(\"W083\"),this}),F(\"if\",function(){var e=f.tokens.next;return yt(),f.condition=!0,k(\"(\"),bt(O(0)),k(\")\",e),f.condition=!1,ut(!0,!0),f.tokens.next.id===\"else\"&&(k(\"else\"),f.tokens.next.id===\"if\"||f.tokens.next.id===\"switch\"?it(!0):ut(!0,!0)),this}),F(\"try\",function(){function e(){var e=Kt,t;k(\"catch\"),k(\"(\"),Kt=Object.create(e),t=f.tokens.next.value,f.tokens.next.type!==\"(identifier)\"&&(t=null,b(\"E030\",f.tokens.next,t)),k(),jt=vt(\"(catch)\",f.tokens.next,Kt,{\"(context)\":jt,\"(breakage)\":jt[\"(breakage)\"],\"(loopage)\":jt[\"(loopage)\"],\"(statement)\":!1,\"(catch)\":!0}),t&&T(t,{type:\"exception\"}),f.tokens.next.value===\"if\"&&(f.option.inMoz(!0)||b(\"W118\",f.tokens.curr,\"catch filter\"),k(\"if\"),O(0)),k(\")\"),f.tokens.curr.funct=jt,Ft.push(jt),ut(!1),Kt=e,jt[\"(last)\"]=f.tokens.curr.line,jt[\"(lastcharacter)\"]=f.tokens.curr.character,jt=jt[\"(context)\"]}var t;ut(!0);while(f.tokens.next.id===\"catch\")yt(),t&&!f.option.inMoz(!0)&&b(\"W118\",f.tokens.next,\"multiple catch blocks\"),e(),t=!0;if(f.tokens.next.id===\"finally\"){k(\"finally\"),ut(!0);return}return t||E(\"E021\",f.tokens.next,\"catch\",f.tokens.next.value),this}),F(\"while\",function(){var e=f.tokens.next;return jt[\"(breakage)\"]+=1,jt[\"(loopage)\"]+=1,yt(),k(\"(\"),bt(O(0)),k(\")\",e),ut(!0,!0),jt[\"(breakage)\"]-=1,jt[\"(loopage)\"]-=1,this}).labelled=!0,F(\"with\",function(){var e=f.tokens.next;return f.directive[\"use strict\"]?E(\"E010\",f.tokens.curr):f.option.withstmt||b(\"W085\",f.tokens.curr),k(\"(\"),O(0),k(\")\",e),ut(!0,!0),this}),F(\"switch\",function(){var e=f.tokens.next,t=!1,n=!1;jt[\"(breakage)\"]+=1,k(\"(\"),bt(O(0)),k(\")\",e),e=f.tokens.next,k(\"{\"),f.tokens.next.from===Ut&&(n=!0),n||(Ut+=f.option.indent),this.cases=[];for(;;)switch(f.tokens.next.id){case\"case\":switch(jt[\"(verb)\"]){case\"yield\":case\"break\":case\"case\":case\"continue\":case\"return\":case\"switch\":case\"throw\":break;default:a.fallsThrough.test(f.lines[f.tokens.next.line-2])||b(\"W086\",f.tokens.curr,\"case\")}k(\"case\"),this.cases.push(O(0)),yt(),t=!0,k(\":\"),jt[\"(verb)\"]=\"case\";break;case\"default\":switch(jt[\"(verb)\"]){case\"yield\":case\"break\":case\"continue\":case\"return\":case\"throw\":break;default:this.cases.length&&(a.fallsThrough.test(f.lines[f.tokens.next.line-2])||b(\"W086\",f.tokens.curr,\"default\"))}k(\"default\"),t=!0,k(\":\");break;case\"}\":n||(Ut-=f.option.indent),k(\"}\",e),jt[\"(breakage)\"]-=1,jt[\"(verb)\"]=undefined;return;case\"(end)\":E(\"E023\",f.tokens.next,\"}\");return;default:Ut+=f.option.indent;if(t)switch(f.tokens.curr.id){case\",\":E(\"E040\");return;case\":\":t=!1,st();break;default:E(\"E025\",f.tokens.curr);return}else{if(f.tokens.curr.id!==\":\"){E(\"E021\",f.tokens.next,\"case\",f.tokens.next.value);return}k(\":\"),E(\"E024\",f.tokens.curr,\":\"),st()}Ut-=f.option.indent}}).labelled=!0,j(\"debugger\",function(){return f.option.debug||b(\"W087\",this),this}).exps=!0,function(){var e=j(\"do\",function(){jt[\"(breakage)\"]+=1,jt[\"(loopage)\"]+=1,yt(),this.first=ut(!0,!0),k(\"while\");var e=f.tokens.next;return k(\"(\"),bt(O(0)),k(\")\",e),jt[\"(breakage)\"]-=1,jt[\"(loopage)\"]-=1,this});e.labelled=!0,e.exps=!0}(),F(\"for\",function(){var e,t=f.tokens.next,n=!1,i=null;t.value===\"each\"&&(i=t,k(\"each\"),f.option.inMoz(!0)||b(\"W118\",f.tokens.curr,\"for each\")),jt[\"(breakage)\"]+=1,jt[\"(loopage)\"]+=1,yt(),k(\"(\");var s,o=0,u=[\"in\",\"of\"];do s=C(o),++o;while(!r.contains(u,s.value)&&s.value!==\";\"&&s.type!==\"(end)\");if(r.contains(u,s.value)){!f.option.inESNext()&&s.value===\"of\"&&E(\"W104\",s,\"for of\");if(f.tokens.next.id===\"var\")k(\"var\"),f.syntax[\"var\"].fud.call(f.syntax[\"var\"].fud,!0);else if(f.tokens.next.id===\"let\")k(\"let\"),n=!0,jt[\"(blockscope)\"].stack(),f.syntax.let.fud.call(f.syntax.let.fud,!0);else if(!f.tokens.next.identifier)E(\"E030\",f.tokens.next,f.tokens.next.type),k();else{switch(jt[f.tokens.next.value]){case\"unused\":jt[f.tokens.next.value]=\"var\";break;case\"var\":break;default:jt[\"(blockscope)\"].getlabel(f.tokens.next.value)||b(\"W088\",f.tokens.next,f.tokens.next.value)}k()}k(s.value),O(20),k(\")\",t),e=ut(!0,!0),f.option.forin&&e&&(e.length>1||typeof e[0]!=\"object\"||e[0].value!==\"if\")&&b(\"W089\",this),jt[\"(breakage)\"]-=1,jt[\"(loopage)\"]-=1}else{i&&E(\"E045\",i);if(f.tokens.next.id!==\";\")if(f.tokens.next.id===\"var\")k(\"var\"),f.syntax[\"var\"].fud.call(f.syntax[\"var\"].fud);else if(f.tokens.next.id===\"let\")k(\"let\"),n=!0,jt[\"(blockscope)\"].stack(),f.syntax.let.fud.call(f.syntax.let.fud);else for(;;){O(0,\"for\");if(f.tokens.next.id!==\",\")break;P()}_(f.tokens.curr),k(\";\"),f.tokens.next.id!==\";\"&&bt(O(0)),_(f.tokens.curr),k(\";\"),f.tokens.next.id===\";\"&&E(\"E021\",f.tokens.next,\")\",\";\");if(f.tokens.next.id!==\")\")for(;;){O(0,\"for\");if(f.tokens.next.id!==\",\")break;P()}k(\")\",t),ut(!0,!0),jt[\"(breakage)\"]-=1,jt[\"(loopage)\"]-=1}return n&&jt[\"(blockscope)\"].unstack(),this}).labelled=!0,j(\"break\",function(){var e=f.tokens.next.value;return jt[\"(breakage)\"]===0&&b(\"W052\",f.tokens.next,this.value),f.option.asi||_(this),f.tokens.next.id!==\";\"&&!f.tokens.next.reach&&f.tokens.curr.line===f.tokens.next.line&&(jt[e]!==\"label\"?b(\"W090\",f.tokens.next,e):Kt[e]!==jt&&b(\"W091\",f.tokens.next,e),this.first=f.tokens.next,k()),rt(\"break\"),this}).exps=!0,j(\"continue\",function(){var e=f.tokens.next.value;return jt[\"(breakage)\"]===0&&b(\"W052\",f.tokens.next,this.value),f.option.asi||_(this),f.tokens.next.id!==\";\"&&!f.tokens.next.reach?f.tokens.curr.line===f.tokens.next.line&&(jt[e]!==\"label\"?b(\"W090\",f.tokens.next,e):Kt[e]!==jt&&b(\"W091\",f.tokens.next,e),this.first=f.tokens.next,k()):jt[\"(loopage)\"]||b(\"W052\",f.tokens.next,this.value),rt(\"continue\"),this}).exps=!0,j(\"return\",function(){return this.line===f.tokens.next.line?f.tokens.next.id!==\";\"&&!f.tokens.next.reach&&(this.first=O(0),this.first&&this.first.type===\"(punctuator)\"&&this.first.value===\"=\"&&!this.first.paren&&!f.option.boss&&w(\"W093\",this.first.line,this.first.character)):f.tokens.next.type===\"(punctuator)\"&&[\"[\",\"{\",\"+\",\"-\"].indexOf(f.tokens.next.value)>-1&&_(this),rt(\"return\"),this}).exps=!0,function(e){e.exps=!0,e.lbp=25}(q(\"yield\",function(){var e=f.tokens.prev;return f.option.inESNext(!0)&&!jt[\"(generator)\"]?(\"(catch)\"!==jt[\"(name)\"]||!jt[\"(context)\"][\"(generator)\"])&&E(\"E046\",f.tokens.curr,\"yield\"):f.option.inESNext()||b(\"W104\",f.tokens.curr,\"yield\"),jt[\"(generator)\"]=\"yielded\",this.line===f.tokens.next.line||!f.option.inMoz(!0)?(f.tokens.next.id!==\";\"&&!f.tokens.next.reach&&f.tokens.next.nud&&(M(f.tokens.curr,f.tokens.next),this.first=O(10),this.first.type===\"(punctuator)\"&&this.first.value===\"=\"&&!this.first.paren&&!f.option.boss&&w(\"W093\",this.first.line,this.first.character)),f.option.inMoz(!0)&&f.tokens.next.id!==\")\"&&(e.lbp>30||!e.assign&&!A()||e.id===\"yield\")&&E(\"E050\",this)):f.option.asi||_(this),this})),j(\"throw\",function(){return _(this),this.first=O(20),rt(\"throw\"),this}).exps=!0,j(\"import\",function(){f.option.inESNext()||b(\"W119\",f.tokens.curr,\"import\");if(f.tokens.next.type===\"(string)\")return k(\"(string)\"),this;if(f.tokens.next.identifier)this.name=nt(),T(this.name,{type:\"unused\",token:f.tokens.curr});else{k(\"{\");for(;;){if(f.tokens.next.value===\"}\"){k(\"}\");break}var e;f.tokens.next.type===\"default\"?(e=\"default\",k(\"default\")):e=nt(),f.tokens.next.value===\"as\"&&(k(\"as\"),e=nt()),T(e,{type:\"unused\",token:f.tokens.curr});if(f.tokens.next.value!==\",\"){if(f.tokens.next.value===\"}\"){k(\"}\");break}E(\"E024\",f.tokens.next,f.tokens.next.value);break}k(\",\")}}return k(\"from\"),k(\"(string)\"),this}).exps=!0,j(\"export\",function(){f.option.inESNext()||b(\"W119\",f.tokens.curr,\"export\");if(f.tokens.next.type===\"default\"){k(\"default\");if(f.tokens.next.id===\"function\"||f.tokens.next.id===\"class\")this.block=!0;return this.exportee=O(10),this}if(f.tokens.next.value===\"{\"){k(\"{\");for(;;){Ht[nt()]=!0;if(f.tokens.next.value!==\",\"){if(f.tokens.next.value===\"}\"){k(\"}\");break}E(\"E024\",f.tokens.next,f.tokens.next.value);break}k(\",\")}return this}return f.tokens.next.id===\"var\"?(k(\"var\"),Ht[f.tokens.next.value]=!0,f.syntax[\"var\"].fud.call(f.syntax[\"var\"].fud)):f.tokens.next.id===\"let\"?(k(\"let\"),Ht[f.tokens.next.value]=!0,f.syntax.let.fud.call(f.syntax.let.fud)):f.tokens.next.id===\"const\"?(k(\"const\"),Ht[f.tokens.next.value]=!0,f.syntax[\"const\"].fud.call(f.syntax[\"const\"].fud)):f.tokens.next.id===\"function\"?(this.block=!0,k(\"function\"),Ht[f.tokens.next.value]=!0,f.syntax[\"function\"].fud()):f.tokens.next.id===\"class\"?(this.block=!0,k(\"class\"),Ht[f.tokens.next.value]=!0,f.syntax[\"class\"].fud()):E(\"E024\",f.tokens.next,f.tokens.next.value),this}).exps=!0,z(\"abstract\"),z(\"boolean\"),z(\"byte\"),z(\"char\"),z(\"class\",{es5:!0,nud:St}),z(\"double\"),z(\"enum\",{es5:!0}),z(\"export\",{es5:!0}),z(\"extends\",{es5:!0}),z(\"final\"),z(\"float\"),z(\"goto\"),z(\"implements\",{es5:!0,strictOnly:!0}),z(\"import\",{es5:!0}),z(\"int\"),z(\"interface\",{es5:!0,strictOnly:!0}),z(\"long\"),z(\"native\"),z(\"package\",{es5:!0,strictOnly:!0}),z(\"private\",{es5:!0,strictOnly:!0}),z(\"protected\",{es5:!0,strictOnly:!0}),z(\"public\",{es5:!0,strictOnly:!0}),z(\"short\"),z(\"static\",{es5:!0,strictOnly:!0}),z(\"super\",{es5:!0}),z(\"synchronized\"),z(\"throws\"),z(\"transient\"),z(\"volatile\");var on=function(){var e,t,n=-1,i=0,s={};r.contains([\"[\",\"{\"],f.tokens.curr.value)&&(i+=1);do{e=n===-1?f.tokens.next:C(n),t=C(n+1),n+=1,r.contains([\"[\",\"{\"],e.value)?i+=1:r.contains([\"]\",\"}\"],e.value)&&(i-=1);if(e.identifier&&e.value===\"for\"&&i===1){s.isCompArray=!0,s.notJson=!0;break}if(r.contains([\"}\",\"]\"],e.value)&&t.value===\"=\"&&i===0){s.isDestAssign=!0,s.notJson=!0;break}e.value===\";\"&&(s.isBlock=!0,s.notJson=!0)}while(i>0&&e.id!==\"(end)\"&&n<15);return s},un=function(){function e(e){var t=s.variables.filter(function(t){if(t.value===e)return t.undef=!1,e}).length;return t!==0}function t(e){var t=s.variables.filter(function(t){if(t.value===e&&!t.undef)return t.unused===!0&&(t.unused=!1),e}).length;return t===0}var n=function(){this.mode=\"use\",this.variables=[]},i=[],s;return{stack:function(){s=new n,i.push(s)},unstack:function(){s.variables.filter(function(e){e.unused&&b(\"W098\",e.token,e.value),e.undef&&g(e.funct,\"W117\",e.token,e.value)}),i.splice(-1,1),s=i[i.length-1]},setState:function(e){r.contains([\"use\",\"define\",\"generate\",\"filter\"],e)&&(s.mode=e)},check:function(n){if(!s)return;return s&&s.mode===\"use\"?(t(n)&&s.variables.push({funct:jt,token:f.tokens.curr,value:n,undef:!0,unused:!1}),!0):s&&s.mode===\"define\"?(e(n)||s.variables.push({funct:jt,token:f.tokens.curr,value:n,undef:!1,unused:!0}),!0):s&&s.mode===\"generate\"?(g(jt,\"W117\",f.tokens.curr,n),!0):s&&s.mode===\"filter\"?(t(n)&&g(jt,\"W117\",f.tokens.curr,n),!0):!1}}},an=function(){function e(){for(var e in t)if(t[e][\"(type)\"]===\"unused\"&&f.option.unused){var n=t[e][\"(token)\"],r=n.line,i=n.character;w(\"W098\",r,i,e)}}var t={},n=[t];return{stack:function(){t={},n.push(t)},unstack:function(){e(),n.splice(n.length-1,1),t=r.last(n)},getlabel:function(e){for(var t=n.length-1;t>=0;--t)if(r.has(n[t],e)&&!n[t][e][\"(shadowed)\"])return n[t]},shadow:function(e){for(var t=n.length-1;t>=0;t--)r.has(n[t],e)&&(n[t][e][\"(shadowed)\"]=!0)},unshadow:function(e){for(var t=n.length-1;t>=0;t--)r.has(n[t],e)&&(n[t][e][\"(shadowed)\"]=!1)},current:{has:function(e){return r.has(t,e)},add:function(e,n,r){t[e]={\"(type)\":n,\"(token)\":r,\"(shadowed)\":!1}}}}},fn=function(n,i,o){function a(e,t){if(!e)return;!Array.isArray(e)&&typeof e==\"object\"&&(e=Object.keys(e)),e.forEach(t)}var l,h,p,g,y={},E={};i=r.clone(i),f.reset(),i&&i.scope?c.scope=i.scope:(c.errors=[],c.undefs=[],c.internals=[],c.blacklist={},c.scope=\"(main)\"),Jt=Object.create(null),d(Jt,s.ecmaIdentifiers),d(Jt,s.reservedVars),d(Jt,o||{}),Pt=Object.create(null),Ht=Object.create(null);if(i){a(i.predef||null,function(e){var t,n;e[0]===\"-\"?(t=e.slice(1),c.blacklist[t]=t):(n=Object.getOwnPropertyDescriptor(i.predef,e),Jt[e]=n?n.value:!1)}),a(i.exported||null,function(e){Ht[e]=!0}),delete i.predef,delete i.exported,g=Object.keys(i);for(p=0;p<g.length;p++)/^-W\\d{3}$/g.test(g[p])?E[g[p].slice(1)]=!0:(y[g[p]]=i[g[p]],g[p]===\"newcap\"&&i[g[p]]===!1&&(y[\"(explicitNewcap)\"]=!0))}f.option=y,f.ignored=E,f.option.indent=f.option.indent||4,f.option.maxerr=f.option.maxerr||50,Ut=1,It=Object.create(Jt),Kt=It,jt=vt(\"(global)\",null,Kt,{\"(global)\":!0,\"(blockscope)\":an(),\"(comparray)\":un(),\"(metrics)\":gt(f.tokens.next)}),Ft=[jt],Yt=[],Qt=null,Xt={},Vt=null,qt={},Rt=!1,zt=[],Gt=[];if(!t(n)&&!Array.isArray(n))return S(\"E004\",0),!1;kt={get isJSON(){return f.jsonMode},getOption:function(e){return f.option[e]||null},getCache:function(e){return f.cache[e]},setCache:function(e,t){f.cache[e]=t},warn:function(e,t){w.apply(null,[e,t.line,t.char].concat(t.data))},on:function(e,t){e.split(\" \").forEach(function(e){en.on(e,t)}.bind(this))}},en.removeAllListeners(),(Zt||[]).forEach(function(e){e(kt)}),f.tokens.prev=f.tokens.curr=f.tokens.next=f.syntax[\"(begin)\"],Wt=new u(n),Wt.on(\"warning\",function(e){w.apply(null,[e.code,e.line,e.character].concat(e.data))}),Wt.on(\"error\",function(e){S.apply(null,[e.code,e.line,e.character].concat(e.data))}),Wt.on(\"fatal\",function(e){m(\"E041\",e.line,e.from)}),Wt.on(\"Identifier\",function(e){en.emit(\"Identifier\",e)}),Wt.on(\"String\",function(e){en.emit(\"String\",e)}),Wt.on(\"Number\",function(e){en.emit(\"Number\",e)}),Wt.start();for(var x in i)r.has(i,x)&&e(x,f.tokens.curr);v(),d(Jt,o||{}),P.first=!0;try{k();switch(f.tokens.next.id){case\"{\":case\"[\":Tt();break;default:ot(),f.directive[\"use strict\"]&&!f.option.globalstrict&&!f.option.node&&!f.option.phantom&&b(\"W097\",f.tokens.prev),st()}k(f.tokens.next&&f.tokens.next.value!==\".\"?\"(end)\":undefined),jt[\"(blockscope)\"].unstack();var T=function(e,t){do{if(typeof t[e]==\"string\")return t[e]===\"unused\"?t[e]=\"var\":t[e]===\"unction\"&&(t[e]=\"closure\"),!0;t=t[\"(context)\"]}while(t);return!1},N=function(e,t){if(!qt[e])return;var n=[];for(var r=0;r<qt[e].length;r+=1)qt[e][r]!==t&&n.push(qt[e][r]);n.length===0?delete qt[e]:qt[e]=n},C=function(e,t,n,r){var i=t.line,s=t.character;r===undefined&&(r=f.option.unused),r===!0&&(r=\"last-param\");var o={vars:[\"var\"],\"last-param\":[\"var\",\"param\"],strict:[\"var\",\"param\",\"last-param\"]};r&&o[r]&&o[r].indexOf(n)!==-1&&w(\"W098\",i,s,e),Gt.push({name:e,line:i,character:s})},L=function(e,t){var n=e[t],i=e[\"(tokens)\"][t];if(t.charAt(0)===\"(\")return;if(n!==\"unused\"&&n!==\"unction\"&&n!==\"const\")return;if(e[\"(params)\"]&&e[\"(params)\"].indexOf(t)!==-1)return;if(e[\"(global)\"]&&r.has(Ht,t))return;if(n===\"const\"&&!dt(e,t,\"unused\"))return;C(t,i,\"var\")};for(l=0;l<c.undefs.length;l+=1)h=c.undefs[l].slice(0),T(h[2].value,h[0])?N(h[2].value,h[2].line):f.option.undef&&b.apply(b,h.slice(1));Ft.forEach(function(e){if(e[\"(unusedOption)\"]===!1)return;for(var t in e)r.has(e,t)&&L(e,t);if(!e[\"(params)\"])return;var n=e[\"(params)\"].slice(),i=n.pop(),s,o;while(i){s=e[i],o=e[\"(unusedOption)\"]||f.option.unused,o=o===!0?\"last-param\":o;if(i===\"undefined\")return;if(s===\"unused\"||s===\"unction\")C(i,e[\"(tokens)\"][i],\"param\",e[\"(unusedOption)\"]);else if(o===\"last-param\")return;i=n.pop()}});for(var A in Pt)r.has(Pt,A)&&!r.has(It,A)&&!r.has(Ht,A)&&C(A,Pt[A],\"var\")}catch(O){if(!O||O.name!==\"JSHintError\")throw O;var M=f.tokens.next||{};c.errors.push({scope:\"(main)\",raw:O.raw,code:O.code,reason:O.message,line:O.line||M.line,character:O.character||M.from},null)}if(c.scope===\"(main)\"){i=i||{};for(l=0;l<c.internals.length;l+=1)h=c.internals[l],i.scope=h.elem,fn(h.value,i,o)}return c.errors.length===0};return fn.addModule=function(e){Zt.push(e)},fn.addModule(l.register),fn.data=function(){var e={functions:[],options:f.option},t=[],n=[],i,s,o,u,a,l;fn.errors.length&&(e.errors=fn.errors),f.jsonMode&&(e.json=!0);for(a in qt)r.has(qt,a)&&t.push({name:a,line:qt[a]});t.length>0&&(e.implieds=t),Yt.length>0&&(e.urls=Yt),l=Object.keys(Kt),l.length>0&&(e.globals=l);for(o=1;o<Ft.length;o+=1){s=Ft[o],i={};for(u=0;u<Bt.length;u+=1)i[Bt[u]]=[];for(u=0;u<Bt.length;u+=1)i[Bt[u]].length===0&&delete i[Bt[u]];i.name=s[\"(name)\"],i.param=s[\"(params)\"],i.line=s[\"(line)\"],i.character=s[\"(character)\"],i.last=s[\"(last)\"],i.lastcharacter=s[\"(lastcharacter)\"],i.metrics={complexity:s[\"(metrics)\"].ComplexityCount,parameters:(s[\"(params)\"]||[]).length,statements:s[\"(metrics)\"].statementCount},e.functions.push(i)}Gt.length>0&&(e.unused=Gt),n=[];for(a in Xt)if(typeof Xt[a]==\"number\"){e.member=Xt;break}return e},fn.jshint=fn,fn}();typeof n==\"object\"&&n&&(n.JSHINT=c)},{\"./lex.js\":4,\"./messages.js\":5,\"./reg.js\":6,\"./state.js\":7,\"./style.js\":8,\"./vars.js\":9,events:10,underscore:2}],4:[function(e,t,n){function r(){var e=[];return{push:function(t){e.push(t)},check:function(){for(var t=0;t<e.length;++t)e[t]();e.splice(0,e.length)}}}function i(e){var t=e;typeof t==\"string\"&&(t=t.replace(/\\r\\n/g,\"\\n\").replace(/\\r/g,\"\\n\").split(\"\\n\")),t[0]&&t[0].substr(0,2)===\"#!\"&&(t[0].indexOf(\"node\")!==-1&&(a.option.node=!0),t[0]=\"\"),this.emitter=new o.EventEmitter,this.source=e,this.setLines(t),this.prereg=!0,this.line=0,this.char=1,this.from=1,this.input=\"\",this.inComment=!1;for(var n=0;n<a.option.indent;n+=1)a.tab+=\" \"}var s=e(\"underscore\"),o=e(\"events\"),u=e(\"./reg.js\"),a=e(\"./state.js\").state,f=e(\"../data/ascii-identifier-data.js\"),l=f.asciiIdentifierStartTable,c=f.asciiIdentifierPartTable,h={Identifier:1,Punctuator:2,NumericLiteral:3,StringLiteral:4,Comment:5,Keyword:6,NullLiteral:7,BooleanLiteral:8,RegExp:9,TemplateLiteral:10};i.prototype={_lines:[],getLines:function(){return this._lines=a.lines,this._lines},setLines:function(e){this._lines=e,a.lines=this._lines},peek:function(e){return this.input.charAt(e||0)},skip:function(e){e=e||1,this.char+=e,this.input=this.input.slice(e)},on:function(e,t){e.split(\" \").forEach(function(e){this.emitter.on(e,t)}.bind(this))},trigger:function(){this.emitter.emit.apply(this.emitter,Array.prototype.slice.call(arguments))},triggerAsync:function(e,t,n,r){n.push(function(){r()&&this.trigger(e,t)}.bind(this))},scanPunctuator:function(){var e=this.peek(),t,n,r;switch(e){case\".\":if(/^[0-9]$/.test(this.peek(1)))return null;if(this.peek(1)===\".\"&&this.peek(2)===\".\")return{type:h.Punctuator,value:\"...\"};case\"(\":case\")\":case\";\":case\",\":case\"{\":case\"}\":case\"[\":case\"]\":case\":\":case\"~\":case\"?\":return{type:h.Punctuator,value:e};case\"#\":return{type:h.Punctuator,value:e};case\"\":return null}return t=this.peek(1),n=this.peek(2),r=this.peek(3),e===\">\"&&t===\">\"&&n===\">\"&&r===\"=\"?{type:h.Punctuator,value:\">>>=\"}:e===\"=\"&&t===\"=\"&&n===\"=\"?{type:h.Punctuator,value:\"===\"}:e===\"!\"&&t===\"=\"&&n===\"=\"?{type:h.Punctuator,value:\"!==\"}:e===\">\"&&t===\">\"&&n===\">\"?{type:h.Punctuator,value:\">>>\"}:e===\"<\"&&t===\"<\"&&n===\"=\"?{type:h.Punctuator,value:\"<<=\"}:e===\">\"&&t===\">\"&&n===\"=\"?{type:h.Punctuator,value:\">>=\"}:e===\"=\"&&t===\">\"?{type:h.Punctuator,value:e+t}:e===t&&\"+-<>&|\".indexOf(e)>=0?{type:h.Punctuator,value:e+t}:\"<>=!+-*%&|^\".indexOf(e)>=0?t===\"=\"?{type:h.Punctuator,value:e+t}:{type:h.Punctuator,value:e}:e===\"/\"?t===\"=\"&&/\\/=(?!(\\S*\\/[gim]?))/.test(this.input)?{type:h.Punctuator,value:\"/=\"}:{type:h.Punctuator,value:\"/\"}:null},scanComments:function(){function e(e,t,n){var r=[\"jshint\",\"jslint\",\"members\",\"member\",\"globals\",\"global\",\"exported\"],i=!1,s=e+t,o=\"plain\";return n=n||{},n.isMultiline&&(s+=\"*/\"),r.forEach(function(n){if(i)return;if(e===\"//\"&&n!==\"jshint\")return;t.substr(0,n.length)===n&&(i=!0,e+=n,t=t.substr(n.length)),!i&&t.charAt(0)===\" \"&&t.substr(1,n.length)===n&&(i=!0,e=e+\" \"+n,t=t.substr(n.length+1));if(!i)return;switch(n){case\"member\":o=\"members\";break;case\"global\":o=\"globals\";break;default:o=n}}),{type:h.Comment,commentType:o,value:s,body:t,isSpecial:i,isMultiline:n.isMultiline||!1,isMalformed:n.isMalformed||!1}}var t=this.peek(),n=this.peek(1),r=this.input.substr(2),i=this.line,s=this.char;if(t===\"*\"&&n===\"/\")return this.trigger(\"error\",{code:\"E018\",line:i,character:s}),this.skip(2),null;if(t!==\"/\"||n!==\"*\"&&n!==\"/\")return null;if(n===\"/\")return this.skip(this.input.length),e(\"//\",r);var o=\"\";if(n===\"*\"){this.inComment=!0,this.skip(2);while(this.peek()!==\"*\"||this.peek(1)!==\"/\")if(this.peek()===\"\"){o+=\"\\n\";if(!this.nextLine())return this.trigger(\"error\",{code:\"E017\",line:i,character:s}),this.inComment=!1,e(\"/*\",o,{isMultiline:!0,isMalformed:!0})}else o+=this.peek(),this.skip();return this.skip(2),this.inComment=!1,e(\"/*\",o,{isMultiline:!0})}},scanKeyword:function(){var e=/^[a-zA-Z_$][a-zA-Z0-9_$]*/.exec(this.input),t=[\"if\",\"in\",\"do\",\"var\",\"for\",\"new\",\"try\",\"let\",\"this\",\"else\",\"case\",\"void\",\"with\",\"enum\",\"while\",\"break\",\"catch\",\"throw\",\"const\",\"yield\",\"class\",\"super\",\"return\",\"typeof\",\"delete\",\"switch\",\"export\",\"import\",\"default\",\"finally\",\"extends\",\"function\",\"continue\",\"debugger\",\"instanceof\"];return e&&t.indexOf(e[0])>=0?{type:h.Keyword,value:e[0]}:null},scanIdentifier:function(){function e(e){return e>256}function t(e){return e>256}function n(e){return/^[0-9a-fA-F]$/.test(e)}var r=\"\",i=0,s,o,u=function(){i+=1;if(this.peek(i)!==\"u\")return null;var e=this.peek(i+1),r=this.peek(i+2),s=this.peek(i+3),o=this.peek(i+4),u;return n(e)&&n(r)&&n(s)&&n(o)?(u=parseInt(e+r+s+o,16),c[u]||t(u)?(i+=5,\"\\\\u\"+e+r+s+o):null):null}.bind(this),a=function(){var t=this.peek(i),n=t.charCodeAt(0);return n===92?u():n<128?l[n]?(i+=1,t):null:e(n)?(i+=1,t):null}.bind(this),f=function(){var e=this.peek(i),n=e.charCodeAt(0);return n===92?u():n<128?c[n]?(i+=1,e):null:t(n)?(i+=1,e):null}.bind(this);o=a();if(o===null)return null;r=o;for(;;){o=f();if(o===null)break;r+=o}switch(r){case\"true\":case\"false\":s=h.BooleanLiteral;break;case\"null\":s=h.NullLiteral;break;default:s=h.Identifier}return{type:s,value:r}},scanNumericLiteral:function(){function e(e){return/^[0-9]$/.test(e)}function t(e){return/^[0-7]$/.test(e)}function n(e){return/^[0-9a-fA-F]$/.test(e)}function r(e){return e===\"$\"||e===\"_\"||e===\"\\\\\"||e>=\"a\"&&e<=\"z\"||e>=\"A\"&&e<=\"Z\"}var i=0,s=\"\",o=this.input.length,u=this.peek(i),a;if(u!==\".\"&&!e(u))return null;if(u!==\".\"){s=this.peek(i),i+=1,u=this.peek(i);if(s===\"0\"){if(u===\"x\"||u===\"X\"){i+=1,s+=u;while(i<o){u=this.peek(i);if(!n(u))break;s+=u,i+=1}if(s.length<=2)return{type:h.NumericLiteral,value:s,isMalformed:!0};if(i<o){u=this.peek(i);if(r(u))return null}return{type:h.NumericLiteral,value:s,base:16,isMalformed:!1}}if(t(u)){i+=1,s+=u,a=!1;while(i<o){u=this.peek(i);if(e(u))a=!0;else if(!t(u))break;s+=u,i+=1}if(i<o){u=this.peek(i);if(r(u))return null}return{type:h.NumericLiteral,value:s,base:8,isMalformed:!1}}e(u)&&(i+=1,s+=u)}while(i<o){u=this.peek(i);if(!e(u))break;s+=u,i+=1}}if(u===\".\"){s+=u,i+=1;while(i<o){u=this.peek(i);if(!e(u))break;s+=u,i+=1}}if(u===\"e\"||u===\"E\"){s+=u,i+=1,u=this.peek(i);if(u===\"+\"||u===\"-\")s+=this.peek(i),i+=1;u=this.peek(i);if(!e(u))return null;s+=u,i+=1;while(i<o){u=this.peek(i);if(!e(u))break;s+=u,i+=1}}if(i<o){u=this.peek(i);if(r(u))return null}return{type:h.NumericLiteral,value:s,base:10,isMalformed:!isFinite(s)}},scanTemplateLiteral:function(){if(!a.option.esnext||this.peek()!==\"`\")return null;var e=this.line,t=this.char,n=1,r=\"\";this.skip();while(this.peek()!==\"`\"){while(this.peek()===\"\"){if(!this.nextLine())return this.trigger(\"error\",{code:\"E052\",line:e,character:t}),{type:h.TemplateLiteral,value:r,isUnclosed:!0};r+=\"\\n\"}var i=this.peek();this.skip(n),r+=i}return this.skip(),{type:h.TemplateLiteral,value:r,isUnclosed:!1}},scanStringLiteral:function(e){var t=this.peek();if(t!=='\"'&&t!==\"'\")return null;this.triggerAsync(\"warning\",{code:\"W108\",line:this.line,character:this.char},e,function(){return a.jsonMode&&t!=='\"'});var n=\"\",r=this.line,i=this.char,s=!1;this.skip();e:while(this.peek()!==t){while(this.peek()===\"\"){s?(s=!1,this.triggerAsync(\"warning\",{code:\"W043\",line:this.line,character:this.char},e,function(){return!a.option.multistr}),this.triggerAsync(\"warning\",{code:\"W042\",line:this.line,character:this.char},e,function(){return a.jsonMode&&a.option.multistr})):this.trigger(\"warning\",{code:\"W112\",line:this.line,character:this.char});if(!this.nextLine())return this.trigger(\"error\",{code:\"E029\",line:r,character:i}),{type:h.StringLiteral,value:n,isUnclosed:!0,quote:t};if(this.peek()==t)break e}s=!1;var o=this.peek(),u=1;o<\" \"&&this.trigger(\"warning\",{code:\"W113\",line:this.line,character:this.char,data:[\"<non-printable>\"]});if(o===\"\\\\\"){this.skip(),o=this.peek();switch(o){case\"'\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\'\"]},e,function(){return a.jsonMode});break;case\"b\":o=\"\\\\b\";break;case\"f\":o=\"\\\\f\";break;case\"n\":o=\"\\\\n\";break;case\"r\":o=\"\\\\r\";break;case\"t\":o=\"\\\\t\";break;case\"0\":o=\"\\\\0\";var f=parseInt(this.peek(1),10);this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},e,function(){return f>=0&&f<=7&&a.directive[\"use strict\"]});break;case\"u\":o=String.fromCharCode(parseInt(this.input.substr(1,4),16)),u=5;break;case\"v\":this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\v\"]},e,function(){return a.jsonMode}),o=\"\u000b\";break;case\"x\":var l=parseInt(this.input.substr(1,2),16);this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"\\\\x-\"]},e,function(){return a.jsonMode}),o=String.fromCharCode(l),u=3;break;case\"\\\\\":o=\"\\\\\\\\\";break;case'\"':o='\\\\\"';break;case\"/\":break;case\"\":s=!0,o=\"\";break;case\"!\":if(n.slice(n.length-2)===\"<\")break;default:this.trigger(\"warning\",{code:\"W044\",line:this.line,character:this.char})}}n+=o,this.skip(u)}return this.skip(),{type:h.StringLiteral,value:n,isUnclosed:!1,quote:t}},scanRegExp:function(){var e=0,t=this.input.length,n=this.peek(),r=n,i=\"\",s=[],o=!1,u=!1,a,f=function(){n<\" \"&&(o=!0,this.trigger(\"warning\",{code:\"W048\",line:this.line,character:this.char})),n===\"<\"&&(o=!0,this.trigger(\"warning\",{code:\"W049\",line:this.line,character:this.char,data:[n]}))}.bind(this);if(!this.prereg||n!==\"/\")return null;e+=1,a=!1;while(e<t){n=this.peek(e),r+=n,i+=n;if(u){n===\"]\"&&(this.peek(e-1)!==\"\\\\\"||this.peek(e-2)===\"\\\\\")&&(u=!1),n===\"\\\\\"&&(e+=1,n=this.peek(e),i+=n,r+=n,f()),e+=1;continue}if(n===\"\\\\\"){e+=1,n=this.peek(e),i+=n,r+=n,f();if(n===\"/\"){e+=1;continue}if(n===\"[\"){e+=1;continue}}if(n===\"[\"){u=!0,e+=1;continue}if(n===\"/\"){i=i.substr(0,i.length-1),a=!0,e+=1;break}e+=1}if(!a)return this.trigger(\"error\",{code:\"E015\",line:this.line,character:this.from}),void this.trigger(\"fatal\",{line:this.line,from:this.from});while(e<t){n=this.peek(e);if(!/[gim]/.test(n))break;s.push(n),r+=n,e+=1}try{new RegExp(i,s.join(\"\"))}catch(l){o=!0,this.trigger(\"error\",{code:\"E016\",line:this.line,character:this.char,data:[l.message]})}return{type:h.RegExp,value:r,flags:s,isMalformed:o}},scanNonBreakingSpaces:function(){return a.option.nonbsp?this.input.search(/(\\u00A0)/):-1},scanUnsafeChars:function(){return this.input.search(u.unsafeChars)},next:function(e){this.from=this.char;var t;if(/\\s/.test(this.peek())){t=this.char;while(/\\s/.test(this.peek()))this.from+=1,this.skip()}var n=this.scanComments()||this.scanStringLiteral(e)||this.scanTemplateLiteral();return n?n:(n=this.scanRegExp()||this.scanPunctuator()||this.scanKeyword()||this.scanIdentifier()||this.scanNumericLiteral(),n?(this.skip(n.value.length),n):null)},nextLine:function(){var e;if(this.line>=this.getLines().length)return!1;this.input=this.getLines()[this.line],this.line+=1,this.char=1,this.from=1;var t=this.input.trim(),n=function(){return s.some(arguments,function(e){return t.indexOf(e)===0})},r=function(){return s.some(arguments,function(e){return t.indexOf(e,t.length-e.length)!==-1})};a.ignoreLinterErrors===!0&&!n(\"/*\",\"//\")&&!r(\"*/\")&&(this.input=\"\"),e=this.scanNonBreakingSpaces(),e>=0&&this.trigger(\"warning\",{code:\"W125\",line:this.line,character:e+1}),this.input=this.input.replace(/\\t/g,a.tab),e=this.scanUnsafeChars(),e>=0&&this.trigger(\"warning\",{code:\"W100\",line:this.line,character:e});if(a.option.maxlen&&a.option.maxlen<this.input.length){var i=this.inComment||n.call(t,\"//\")||n.call(t,\"/*\"),o=!i||!u.maxlenException.test(t);o&&this.trigger(\"warning\",{code:\"W101\",line:this.line,character:this.input.length})}return!0},start:function(){this.nextLine()},token:function(){function e(e,t){if(!e.reserved)return!1;var n=e.meta;if(n&&n.isFutureReservedWord&&a.option.inES5()){if(!n.es5)return!1;if(n.strictOnly&&!a.option.strict&&!a.directive[\"use strict\"])return!1;if(t)return!1}return!0}var t=r(),n,i=function(n,r,i){var o;n!==\"(endline)\"&&n!==\"(end)\"&&(this.prereg=!1);if(n===\"(punctuator)\"){switch(r){case\".\":case\")\":case\"~\":case\"#\":case\"]\":this.prereg=!1;break;default:this.prereg=!0}o=Object.create(a.syntax[r]||a.syntax[\"(error)\"])}if(n===\"(identifier)\"){if(r===\"return\"||r===\"case\"||r===\"typeof\")this.prereg=!0;s.has(a.syntax,r)&&(o=Object.create(a.syntax[r]||a.syntax[\"(error)\"]),e(o,i&&n===\"(identifier)\")||(o=null))}return o||(o=Object.create(a.syntax[n])),o.identifier=n===\"(identifier)\",o.type=o.type||n,o.value=r,o.line=this.line,o.character=this.char,o.from=this.from,i&&o.identifier&&(o.isProperty=i),o.check=t.check,o}.bind(this);for(;;){if(!this.input.length)return i(this.nextLine()?\"(endline)\":\"(end)\",\"\");n=this.next(t);if(!n){this.input.length&&(this.trigger(\"error\",{code:\"E024\",line:this.line,character:this.char,data:[this.peek()]}),this.input=\"\");continue}switch(n.type){case h.StringLiteral:return this.triggerAsync(\"String\",{line:this.line,\"char\":this.char,from:this.from,value:n.value,quote:n.quote},t,function(){return!0}),i(\"(string)\",n.value);case h.TemplateLiteral:return this.trigger(\"Template\",{line:this.line,\"char\":this.char,from:this.from,value:n.value}),i(\"(template)\",n.value);case h.Identifier:this.trigger(\"Identifier\",{line:this.line,\"char\":this.char,from:this.form,name:n.value,isProperty:a.tokens.curr.id===\".\"});case h.Keyword:case h.NullLiteral:case h.BooleanLiteral:return i(\"(identifier)\",n.value,a.tokens.curr.id===\".\");case h.NumericLiteral:return n.isMalformed&&this.trigger(\"warning\",{code:\"W045\",line:this.line,character:this.char,data:[n.value]}),this.triggerAsync(\"warning\",{code:\"W114\",line:this.line,character:this.char,data:[\"0x-\"]},t,function(){return n.base===16&&a.jsonMode}),this.triggerAsync(\"warning\",{code:\"W115\",line:this.line,character:this.char},t,function(){return a.directive[\"use strict\"]&&n.base===8}),this.trigger(\"Number\",{line:this.line,\"char\":this.char,from:this.from,value:n.value,base:n.base,isMalformed:n.malformed}),i(\"(number)\",n.value);case h.RegExp:return i(\"(regexp)\",n.value);case h.Comment:a.tokens.curr.comment=!0;if(n.isSpecial)return{id:\"(comment)\",value:n.value,body:n.body,type:n.commentType,isSpecial:n.isSpecial,line:this.line,character:this.char,from:this.from};break;case\"\":break;default:return i(\"(punctuator)\",n.value)}}}},n.Lexer=i},{\"../data/ascii-identifier-data.js\":1,\"./reg.js\":6,\"./state.js\":7,events:10,underscore:2}],5:[function(e,t,n){var r=e(\"underscore\"),i={E001:\"Bad option: '{a}'.\",E002:\"Bad option value.\",E003:\"Expected a JSON value.\",E004:\"Input is neither a string nor an array of strings.\",E005:\"Input is empty.\",E006:\"Unexpected early end of program.\",E007:'Missing \"use strict\" statement.',E008:\"Strict violation.\",E009:\"Option 'validthis' can't be used in a global scope.\",E010:\"'with' is not allowed in strict mode.\",E011:\"const '{a}' has already been declared.\",E012:\"const '{a}' is initialized to 'undefined'.\",E013:\"Attempting to override '{a}' which is a constant.\",E014:\"A regular expression literal can be confused with '/='.\",E015:\"Unclosed regular expression.\",E016:\"Invalid regular expression.\",E017:\"Unclosed comment.\",E018:\"Unbegun comment.\",E019:\"Unmatched '{a}'.\",E020:\"Expected '{a}' to match '{b}' from line {c} and instead saw '{d}'.\",E021:\"Expected '{a}' and instead saw '{b}'.\",E022:\"Line breaking error '{a}'.\",E023:\"Missing '{a}'.\",E024:\"Unexpected '{a}'.\",E025:\"Missing ':' on a case clause.\",E026:\"Missing '}' to match '{' from line {a}.\",E027:\"Missing ']' to match '[' from line {a}.\",E028:\"Illegal comma.\",E029:\"Unclosed string.\",E030:\"Expected an identifier and instead saw '{a}'.\",E031:\"Bad assignment.\",E032:\"Expected a small integer or 'false' and instead saw '{a}'.\",E033:\"Expected an operator and instead saw '{a}'.\",E034:\"get/set are ES5 features.\",E035:\"Missing property name.\",E036:\"Expected to see a statement and instead saw a block.\",E037:null,E038:null,E039:\"Function declarations are not invocable. Wrap the whole function invocation in parens.\",E040:\"Each value should have its own case label.\",E041:\"Unrecoverable syntax error.\",E042:\"Stopping.\",E043:\"Too many errors.\",E044:null,E045:\"Invalid for each loop.\",E046:\"A yield statement shall be within a generator function (with syntax: `function*`)\",E047:null,E048:\"Let declaration not directly within block.\",E049:\"A {a} cannot be named '{b}'.\",E050:\"Mozilla requires the yield expression to be parenthesized here.\",E051:\"Regular parameters cannot come after default parameters.\",E052:\"Unclosed template literal.\"},s={W001:\"'hasOwnProperty' is a really bad name.\",W002:\"Value of '{a}' may be overwritten in IE 8 and earlier.\",W003:\"'{a}' was used before it was defined.\",W004:\"'{a}' is already defined.\",W005:\"A dot following a number can be confused with a decimal point.\",W006:\"Confusing minuses.\",W007:\"Confusing plusses.\",W008:\"A leading decimal point can be confused with a dot: '{a}'.\",W009:\"The array literal notation [] is preferable.\",W010:\"The object literal notation {} is preferable.\",W011:null,W012:null,W013:null,W014:\"Bad line breaking before '{a}'.\",W015:null,W016:\"Unexpected use of '{a}'.\",W017:\"Bad operand.\",W018:\"Confusing use of '{a}'.\",W019:\"Use the isNaN function to compare with NaN.\",W020:\"Read only.\",W021:\"'{a}' is a function.\",W022:\"Do not assign to the exception parameter.\",W023:\"Expected an identifier in an assignment and instead saw a function invocation.\",W024:\"Expected an identifier and instead saw '{a}' (a reserved word).\",W025:\"Missing name in function declaration.\",W026:\"Inner functions should be listed at the top of the outer function.\",W027:\"Unreachable '{a}' after '{b}'.\",W028:\"Label '{a}' on {b} statement.\",W030:\"Expected an assignment or function call and instead saw an expression.\",W031:\"Do not use 'new' for side effects.\",W032:\"Unnecessary semicolon.\",W033:\"Missing semicolon.\",W034:'Unnecessary directive \"{a}\".',W035:\"Empty block.\",W036:\"Unexpected /*member '{a}'.\",W037:\"'{a}' is a statement label.\",W038:\"'{a}' used out of scope.\",W039:\"'{a}' is not allowed.\",W040:\"Possible strict violation.\",W041:\"Use '{a}' to compare with '{b}'.\",W042:\"Avoid EOL escaping.\",W043:\"Bad escaping of EOL. Use option multistr if needed.\",W044:\"Bad or unnecessary escaping.\",W045:\"Bad number '{a}'.\",W046:\"Don't use extra leading zeros '{a}'.\",W047:\"A trailing decimal point can be confused with a dot: '{a}'.\",W048:\"Unexpected control character in regular expression.\",W049:\"Unexpected escaped character '{a}' in regular expression.\",W050:\"JavaScript URL.\",W051:\"Variables should not be deleted.\",W052:\"Unexpected '{a}'.\",W053:\"Do not use {a} as a constructor.\",W054:\"The Function constructor is a form of eval.\",W055:\"A constructor name should start with an uppercase letter.\",W056:\"Bad constructor.\",W057:\"Weird construction. Is 'new' necessary?\",W058:\"Missing '()' invoking a constructor.\",W059:\"Avoid arguments.{a}.\",W060:\"document.write can be a form of eval.\",W061:\"eval can be harmful.\",W062:\"Wrap an immediate function invocation in parens to assist the reader in understanding that the expression is the result of a function, and not the function itself.\",W063:\"Math is not a function.\",W064:\"Missing 'new' prefix when invoking a constructor.\",W065:\"Missing radix parameter.\",W066:\"Implied eval. Consider passing a function instead of a string.\",W067:\"Bad invocation.\",W068:\"Wrapping non-IIFE function literals in parens is unnecessary.\",W069:\"['{a}'] is better written in dot notation.\",W070:\"Extra comma. (it breaks older versions of IE)\",W071:\"This function has too many statements. ({a})\",W072:\"This function has too many parameters. ({a})\",W073:\"Blocks are nested too deeply. ({a})\",W074:\"This function's cyclomatic complexity is too high. ({a})\",W075:\"Duplicate key '{a}'.\",W076:\"Unexpected parameter '{a}' in get {b} function.\",W077:\"Expected a single parameter in set {a} function.\",W078:\"Setter is defined without getter.\",W079:\"Redefinition of '{a}'.\",W080:\"It's not necessary to initialize '{a}' to 'undefined'.\",W081:null,W082:\"Function declarations should not be placed in blocks. Use a function expression or move the statement to the top of the outer function.\",W083:\"Don't make functions within a loop.\",W084:\"Assignment in conditional expression\",W085:\"Don't use 'with'.\",W086:\"Expected a 'break' statement before '{a}'.\",W087:\"Forgotten 'debugger' statement?\",W088:\"Creating global 'for' variable. Should be 'for (var {a} ...'.\",W089:\"The body of a for in should be wrapped in an if statement to filter unwanted properties from the prototype.\",W090:\"'{a}' is not a statement label.\",W091:\"'{a}' is out of scope.\",W093:\"Did you mean to return a conditional instead of an assignment?\",W094:\"Unexpected comma.\",W095:\"Expected a string and instead saw {a}.\",W096:\"The '{a}' key may produce unexpected results.\",W097:'Use the function form of \"use strict\".',W098:\"'{a}' is defined but never used.\",W099:null,W100:\"This character may get silently deleted by one or more browsers.\",W101:\"Line is too long.\",W102:null,W103:\"The '{a}' property is deprecated.\",W104:\"'{a}' is available in ES6 (use esnext option) or Mozilla JS extensions (use moz).\",W105:\"Unexpected {a} in '{b}'.\",W106:\"Identifier '{a}' is not in camel case.\",W107:\"Script URL.\",W108:\"Strings must use doublequote.\",W109:\"Strings must use singlequote.\",W110:\"Mixed double and single quotes.\",W112:\"Unclosed string.\",W113:\"Control character in string: {a}.\",W114:\"Avoid {a}.\",W115:\"Octal literals are not allowed in strict mode.\",W116:\"Expected '{a}' and instead saw '{b}'.\",W117:\"'{a}' is not defined.\",W118:\"'{a}' is only available in Mozilla JavaScript extensions (use moz option).\",W119:\"'{a}' is only available in ES6 (use esnext option).\",W120:\"You might be leaking a variable ({a}) here.\",W121:\"Extending prototype of native object: '{a}'.\",W122:\"Invalid typeof value '{a}'\",W123:\"'{a}' is already defined in outer scope.\",W124:\"A generator function shall contain a yield statement.\",W125:\"This line contains non-breaking spaces: http://jshint.com/doc/options/#nonbsp\"},o={I001:\"Comma warnings can be turned off with 'laxcomma'.\",I002:null,I003:\"ES5 option is now set per default\"};n.errors={},n.warnings={},n.info={},r.each(i,function(e,t){n.errors[t]={code:t,desc:e}}),r.each(s,function(e,t){n.warnings[t]={code:t,desc:e}}),r.each(o,function(e,t){n.info[t]={code:t,desc:e}})},{underscore:2}],6:[function(e,t,n){\"use string\";n.unsafeString=/@cc|<\\/?|script|\\]\\s*\\]|<\\s*!|&lt/i,n.unsafeChars=/[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,n.needEsc=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/,n.needEscGlobal=/[\\u0000-\\u001f&<\"\\/\\\\\\u007f-\\u009f\\u00ad\\u0600-\\u0604\\u070f\\u17b4\\u17b5\\u200c-\\u200f\\u2028-\\u202f\\u2060-\\u206f\\ufeff\\ufff0-\\uffff]/g,n.starSlash=/\\*\\//,n.identifier=/^([a-zA-Z_$][a-zA-Z0-9_$]*)$/,n.javascriptURL=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\\s*:/i,n.fallsThrough=/^\\s*\\/\\*\\s*falls?\\sthrough\\s*\\*\\/\\s*$/,n.maxlenException=/^(?:(?:\\/\\/|\\/\\*|\\*) ?)?[^ ]+$/},{}],7:[function(e,t,n){var r={syntax:{},reset:function(){this.tokens={prev:null,next:null,curr:null},this.option={},this.ignored={},this.directive={},this.jsonMode=!1,this.jsonWarnings=[],this.lines=[],this.tab=\"\",this.cache={},this.ignoredLines={},this.ignoreLinterErrors=!1}};n.state=r},{}],8:[function(e,t,n){n.register=function(e){e.on(\"Identifier\",function(t){if(e.getOption(\"proto\"))return;t.name===\"__proto__\"&&e.warn(\"W103\",{line:t.line,\"char\":t.char,data:[t.name]})}),e.on(\"Identifier\",function(t){if(e.getOption(\"iterator\"))return;t.name===\"__iterator__\"&&e.warn(\"W104\",{line:t.line,\"char\":t.char,data:[t.name]})}),e.on(\"Identifier\",function(t){if(!e.getOption(\"camelcase\"))return;t.name.replace(/^_+|_+$/g,\"\").indexOf(\"_\")>-1&&!t.name.match(/^[A-Z0-9_]*$/)&&e.warn(\"W106\",{line:t.line,\"char\":t.from,data:[t.name]})}),e.on(\"String\",function(t){var n=e.getOption(\"quotmark\"),r;if(!n)return;n===\"single\"&&t.quote!==\"'\"&&(r=\"W109\"),n===\"double\"&&t.quote!=='\"'&&(r=\"W108\"),n===!0&&(e.getCache(\"quotmark\")||e.setCache(\"quotmark\",t.quote),e.getCache(\"quotmark\")!==t.quote&&(r=\"W110\")),r&&e.warn(r,{line:t.line,\"char\":t.char})}),e.on(\"Number\",function(t){t.value.charAt(0)===\".\"&&e.warn(\"W008\",{line:t.line,\"char\":t.char,data:[t.value]}),t.value.substr(t.value.length-1)===\".\"&&e.warn(\"W047\",{line:t.line,\"char\":t.char,data:[t.value]}),/^00+/.test(t.value)&&e.warn(\"W046\",{line:t.line,\"char\":t.char,data:[t.value]})}),e.on(\"String\",function(t){var n=/^(?:javascript|jscript|ecmascript|vbscript|mocha|livescript)\\s*:/i;if(e.getOption(\"scripturl\"))return;n.test(t.value)&&e.warn(\"W107\",{line:t.line,\"char\":t.char})})}},{}],9:[function(e,t,n){n.reservedVars={arguments:!1,NaN:!1},n.ecmaIdentifiers={Array:!1,Boolean:!1,Date:!1,decodeURI:!1,decodeURIComponent:!1,encodeURI:!1,encodeURIComponent:!1,Error:!1,eval:!1,EvalError:!1,Function:!1,hasOwnProperty:!1,isFinite:!1,isNaN:!1,JSON:!1,Math:!1,Number:!1,Object:!1,parseInt:!1,parseFloat:!1,RangeError:!1,ReferenceError:!1,RegExp:!1,String:!1,SyntaxError:!1,TypeError:!1,URIError:!1},n.newEcmaIdentifiers={Set:!1,Map:!1,WeakMap:!1,WeakSet:!1,Proxy:!1,Promise:!1},n.browser={Audio:!1,Blob:!1,addEventListener:!1,applicationCache:!1,atob:!1,blur:!1,btoa:!1,CanvasGradient:!1,CanvasPattern:!1,CanvasRenderingContext2D:!1,clearInterval:!1,clearTimeout:!1,close:!1,closed:!1,CustomEvent:!1,DOMParser:!1,defaultStatus:!1,document:!1,Element:!1,ElementTimeControl:!1,event:!1,FileReader:!1,FormData:!1,focus:!1,frames:!1,getComputedStyle:!1,HTMLElement:!1,HTMLAnchorElement:!1,HTMLBaseElement:!1,HTMLBlockquoteElement:!1,HTMLBodyElement:!1,HTMLBRElement:!1,HTMLButtonElement:!1,HTMLCanvasElement:!1,HTMLDirectoryElement:!1,HTMLDivElement:!1,HTMLDListElement:!1,HTMLFieldSetElement:!1,HTMLFontElement:!1,HTMLFormElement:!1,HTMLFrameElement:!1,HTMLFrameSetElement:!1,HTMLHeadElement:!1,HTMLHeadingElement:!1,HTMLHRElement:!1,HTMLHtmlElement:!1,HTMLIFrameElement:!1,HTMLImageElement:!1,HTMLInputElement:!1,HTMLIsIndexElement:!1,HTMLLabelElement:!1,HTMLLayerElement:!1,HTMLLegendElement:!1,HTMLLIElement:!1,HTMLLinkElement:!1,HTMLMapElement:!1,HTMLMenuElement:!1,HTMLMetaElement:!1,HTMLModElement:!1,HTMLObjectElement:!1,HTMLOListElement:!1,HTMLOptGroupElement:!1,HTMLOptionElement:!1,HTMLParagraphElement:!1,HTMLParamElement:!1,HTMLPreElement:!1,HTMLQuoteElement:!1,HTMLScriptElement:!1,HTMLSelectElement:!1,HTMLStyleElement:!1,HTMLTableCaptionElement:!1,HTMLTableCellElement:!1,HTMLTableColElement:!1,HTMLTableElement:!1,HTMLTableRowElement:!1,HTMLTableSectionElement:!1,HTMLTextAreaElement:!1,HTMLTitleElement:!1,HTMLUListElement:!1,HTMLVideoElement:!1,history:!1,Image:!1,length:!1,localStorage:!1,location:!1,matchMedia:!1,MessageChannel:!1,MessageEvent:!1,MessagePort:!1,MouseEvent:!1,moveBy:!1,moveTo:!1,MutationObserver:!1,name:!1,Node:!1,NodeFilter:!1,NodeList:!1,navigator:!1,onbeforeunload:!0,onblur:!0,onerror:!0,onfocus:!0,onload:!0,onresize:!0,onunload:!0,open:!1,openDatabase:!1,opener:!1,Option:!1,parent:!1,print:!1,removeEventListener:!1,resizeBy:!1,resizeTo:!1,screen:!1,scroll:!1,scrollBy:!1,scrollTo:!1,sessionStorage:!1,setInterval:!1,setTimeout:!1,SharedWorker:!1,status:!1,SVGAElement:!1,SVGAltGlyphDefElement:!1,SVGAltGlyphElement:!1,SVGAltGlyphItemElement:!1,SVGAngle:!1,SVGAnimateColorElement:!1,SVGAnimateElement:!1,SVGAnimateMotionElement:!1,SVGAnimateTransformElement:!1,SVGAnimatedAngle:!1,SVGAnimatedBoolean:!1,SVGAnimatedEnumeration:!1,SVGAnimatedInteger:!1,SVGAnimatedLength:!1,SVGAnimatedLengthList:!1,SVGAnimatedNumber:!1,SVGAnimatedNumberList:!1,SVGAnimatedPathData:!1,SVGAnimatedPoints:!1,SVGAnimatedPreserveAspectRatio:!1,SVGAnimatedRect:!1,SVGAnimatedString:!1,SVGAnimatedTransformList:!1,SVGAnimationElement:!1,SVGCSSRule:!1,SVGCircleElement:!1,SVGClipPathElement:!1,SVGColor:!1,SVGColorProfileElement:!1,SVGColorProfileRule:!1,SVGComponentTransferFunctionElement:!1,SVGCursorElement:!1,SVGDefsElement:!1,SVGDescElement:!1,SVGDocument:!1,SVGElement:!1,SVGElementInstance:!1,SVGElementInstanceList:!1,SVGEllipseElement:!1,SVGExternalResourcesRequired:!1,SVGFEBlendElement:!1,SVGFEColorMatrixElement:!1,SVGFEComponentTransferElement:!1,SVGFECompositeElement:!1,SVGFEConvolveMatrixElement:!1,SVGFEDiffuseLightingElement:!1,SVGFEDisplacementMapElement:!1,SVGFEDistantLightElement:!1,SVGFEFloodElement:!1,SVGFEFuncAElement:!1,SVGFEFuncBElement:!1,SVGFEFuncGElement:!1,SVGFEFuncRElement:!1,SVGFEGaussianBlurElement:!1,SVGFEImageElement:!1,SVGFEMergeElement:!1,SVGFEMergeNodeElement:!1,SVGFEMorphologyElement:!1,SVGFEOffsetElement:!1,SVGFEPointLightElement:!1,SVGFESpecularLightingElement:!1,SVGFESpotLightElement:!1,SVGFETileElement:!1,SVGFETurbulenceElement:!1,SVGFilterElement:!1,SVGFilterPrimitiveStandardAttributes:!1,SVGFitToViewBox:!1,SVGFontElement:!1,SVGFontFaceElement:!1,SVGFontFaceFormatElement:!1,SVGFontFaceNameElement:!1,SVGFontFaceSrcElement:!1,SVGFontFaceUriElement:!1,SVGForeignObjectElement:!1,SVGGElement:!1,SVGGlyphElement:!1,SVGGlyphRefElement:!1,SVGGradientElement:!1,SVGHKernElement:!1,SVGICCColor:!1,SVGImageElement:!1,SVGLangSpace:!1,SVGLength:!1,SVGLengthList:!1,SVGLineElement:!1,SVGLinearGradientElement:!1,SVGLocatable:!1,SVGMPathElement:!1,SVGMarkerElement:!1,SVGMaskElement:!1,SVGMatrix:!1,SVGMetadataElement:!1,SVGMissingGlyphElement:!1,SVGNumber:!1,SVGNumberList:!1,SVGPaint:!1,SVGPathElement:!1,SVGPathSeg:!1,SVGPathSegArcAbs:!1,SVGPathSegArcRel:!1,SVGPathSegClosePath:!1,SVGPathSegCurvetoCubicAbs:!1,SVGPathSegCurvetoCubicRel:!1,SVGPathSegCurvetoCubicSmoothAbs:!1,SVGPathSegCurvetoCubicSmoothRel:!1,SVGPathSegCurvetoQuadraticAbs:!1,SVGPathSegCurvetoQuadraticRel:!1,SVGPathSegCurvetoQuadraticSmoothAbs:!1,SVGPathSegCurvetoQuadraticSmoothRel:!1,SVGPathSegLinetoAbs:!1,SVGPathSegLinetoHorizontalAbs:!1,SVGPathSegLinetoHorizontalRel:!1,SVGPathSegLinetoRel:!1,SVGPathSegLinetoVerticalAbs:!1,SVGPathSegLinetoVerticalRel:!1,SVGPathSegList:!1,SVGPathSegMovetoAbs:!1,SVGPathSegMovetoRel:!1,SVGPatternElement:!1,SVGPoint:!1,SVGPointList:!1,SVGPolygonElement:!1,SVGPolylineElement:!1,SVGPreserveAspectRatio:!1,SVGRadialGradientElement:!1,SVGRect:!1,SVGRectElement:!1,SVGRenderingIntent:!1,SVGSVGElement:!1,SVGScriptElement:!1,SVGSetElement:!1,SVGStopElement:!1,SVGStringList:!1,SVGStylable:!1,SVGStyleElement:!1,SVGSwitchElement:!1,SVGSymbolElement:!1,SVGTRefElement:!1,SVGTSpanElement:!1,SVGTests:!1,SVGTextContentElement:!1,SVGTextElement:!1,SVGTextPathElement:!1,SVGTextPositioningElement:!1,SVGTitleElement:!1,SVGTransform:!1,SVGTransformList:!1,SVGTransformable:!1,SVGURIReference:!1,SVGUnitTypes:!1,SVGUseElement:!1,SVGVKernElement:!1,SVGViewElement:!1,SVGViewSpec:!1,SVGZoomAndPan:!1,TimeEvent:!1,top:!1,URL:!1,WebSocket:!1,window:!1,Worker:!1,XMLHttpRequest:!1,XMLSerializer:!1,XPathEvaluator:!1,XPathException:!1,XPathExpression:!1,XPathNamespace:!1,XPathNSResolver:!1,XPathResult:!1},n.devel={alert:!1,confirm:!1,console:!1,Debug:!1,opera:!1,prompt:!1},n.worker={importScripts:!0,postMessage:!0,self:!0},n.nonstandard={escape:!1,unescape:!1},n.couch={require:!1,respond:!1,getRow:!1,emit:!1,send:!1,start:!1,sum:!1,log:!1,exports:!1,module:!1,provides:!1},n.node={__filename:!1,__dirname:!1,GLOBAL:!1,global:!1,module:!1,require:!1,Buffer:!0,console:!0,exports:!0,process:!0,setTimeout:!0,clearTimeout:!0,setInterval:!0,clearInterval:!0,setImmediate:!0,clearImmediate:!0},n.phantom={phantom:!0,require:!0,WebPage:!0,console:!0,exports:!0},n.rhino={defineClass:!1,deserialize:!1,gc:!1,help:!1,importClass:!1,importPackage:!1,java:!1,load:!1,loadClass:!1,Packages:!1,print:!1,quit:!1,readFile:!1,readUrl:!1,runCommand:!1,seal:!1,serialize:!1,spawn:!1,sync:!1,toint32:!1,version:!1},n.shelljs={target:!1,echo:!1,exit:!1,cd:!1,pwd:!1,ls:!1,find:!1,cp:!1,rm:!1,mv:!1,mkdir:!1,test:!1,cat:!1,sed:!1,grep:!1,which:!1,dirs:!1,pushd:!1,popd:!1,env:!1,exec:!1,chmod:!1,config:!1,error:!1,tempdir:!1},n.typed={ArrayBuffer:!1,ArrayBufferView:!1,DataView:!1,Float32Array:!1,Float64Array:!1,Int16Array:!1,Int32Array:!1,Int8Array:!1,Uint16Array:!1,Uint32Array:!1,Uint8Array:!1,Uint8ClampedArray:!1},n.wsh={ActiveXObject:!0,Enumerator:!0,GetObject:!0,ScriptEngine:!0,ScriptEngineBuildVersion:!0,ScriptEngineMajorVersion:!0,ScriptEngineMinorVersion:!0,VBArray:!0,WSH:!0,WScript:!0,XDomainRequest:!0},n.dojo={dojo:!1,dijit:!1,dojox:!1,define:!1,require:!1},n.jquery={$:!1,jQuery:!1},n.mootools={$:!1,$$:!1,Asset:!1,Browser:!1,Chain:!1,Class:!1,Color:!1,Cookie:!1,Core:!1,Document:!1,DomReady:!1,DOMEvent:!1,DOMReady:!1,Drag:!1,Element:!1,Elements:!1,Event:!1,Events:!1,Fx:!1,Group:!1,Hash:!1,HtmlTable:!1,Iframe:!1,IframeShim:!1,InputValidator:!1,instanceOf:!1,Keyboard:!1,Locale:!1,Mask:!1,MooTools:!1,Native:!1,Options:!1,OverText:!1,Request:!1,Scroller:!1,Slick:!1,Slider:!1,Sortables:!1,Spinner:!1,Swiff:!1,Tips:!1,Type:!1,typeOf:!1,URI:!1,Window:!1},n.prototypejs={$:!1,$$:!1,$A:!1,$F:!1,$H:!1,$R:!1,$break:!1,$continue:!1,$w:!1,Abstract:!1,Ajax:!1,Class:!1,Enumerable:!1,Element:!1,Event:!1,Field:!1,Form:!1,Hash:!1,Insertion:!1,ObjectRange:!1,PeriodicalExecuter:!1,Position:!1,Prototype:!1,Selector:!1,Template:!1,Toggle:!1,Try:!1,Autocompleter:!1,Builder:!1,Control:!1,Draggable:!1,Draggables:!1,Droppables:!1,Effect:!1,Sortable:!1,SortableObserver:!1,Sound:!1,Scriptaculous:!1},n.yui={YUI:!1,Y:!1,YUI_config:!1},n.mocha={describe:!1,it:!1,before:!1,after:!1,beforeEach:!1,afterEach:!1,suite:!1,test:!1,setup:!1,teardown:!1}},{}],10:[function(e,t,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||undefined}function i(e){return typeof e==\"function\"}function s(e){return typeof e==\"number\"}function o(e){return typeof e==\"object\"&&e!==null}function u(e){return e===void 0}t.exports=r,r.EventEmitter=r,r.prototype._events=undefined,r.prototype._maxListeners=undefined,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(e){if(!s(e)||e<0||isNaN(e))throw TypeError(\"n must be a positive number\");return this._maxListeners=e,this},r.prototype.emit=function(e){var t,n,r,s,a,f;this._events||(this._events={});if(e===\"error\")if(!this._events.error||o(this._events.error)&&!this._events.error.length)throw t=arguments[1],t instanceof Error?t:TypeError('Uncaught, unspecified \"error\" event.');n=this._events[e];if(u(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];n.apply(this,s)}else if(o(n)){r=arguments.length,s=new Array(r-1);for(a=1;a<r;a++)s[a-1]=arguments[a];f=n.slice(),r=f.length;for(a=0;a<r;a++)f[a].apply(this,s)}return!0},r.prototype.addListener=function(e,t){var n;if(!i(t))throw TypeError(\"listener must be a function\");this._events||(this._events={}),this._events.newListener&&this.emit(\"newListener\",e,i(t.listener)?t.listener:t),this._events[e]?o(this._events[e])?this._events[e].push(t):this._events[e]=[this._events[e],t]:this._events[e]=t;if(o(this._events[e])&&!this._events[e].warned){var n;u(this._maxListeners)?n=r.defaultMaxListeners:n=this._maxListeners,n&&n>0&&this._events[e].length>n&&(this._events[e].warned=!0,console.error(\"(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.\",this._events[e].length),console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(e,t){function n(){this.removeListener(e,n),r||(r=!0,t.apply(this,arguments))}if(!i(t))throw TypeError(\"listener must be a function\");var r=!1;return n.listener=t,this.on(e,n),this},r.prototype.removeListener=function(e,t){var n,r,s,u;if(!i(t))throw TypeError(\"listener must be a function\");if(!this._events||!this._events[e])return this;n=this._events[e],s=n.length,r=-1;if(n===t||i(n.listener)&&n.listener===t)delete this._events[e],this._events.removeListener&&this.emit(\"removeListener\",e,t);else if(o(n)){for(u=s;u-->0;)if(n[u]===t||n[u].listener&&n[u].listener===t){r=u;break}if(r<0)return this;n.length===1?(n.length=0,delete this._events[e]):n.splice(r,1),this._events.removeListener&&this.emit(\"removeListener\",e,t)}return this},r.prototype.removeAllListeners=function(e){var t,n;if(!this._events)return this;if(!this._events.removeListener)return arguments.length===0?this._events={}:this._events[e]&&delete this._events[e],this;if(arguments.length===0){for(t in this._events){if(t===\"removeListener\")continue;this.removeAllListeners(t)}return this.removeAllListeners(\"removeListener\"),this._events={},this}n=this._events[e];if(i(n))this.removeListener(e,n);else while(n.length)this.removeListener(e,n[n.length-1]);return delete this._events[e],this},r.prototype.listeners=function(e){var t;return!this._events||!this._events[e]?t=[]:i(this._events[e])?t=[this._events[e]]:t=this._events[e].slice(),t},r.listenerCount=function(e,t){var n;return!e._events||!e._events[t]?n=0:i(e._events[t])?n=1:n=e._events[t].length,n}},{}]},{},[3])(3)}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-json.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/json_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/json/json_parse\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../worker/mirror\").Mirror,s=e(\"./json/json_parse\"),o=t.JsonWorker=function(e){i.call(this,e),this.setTimeout(200)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue();try{var t=s(e)}catch(n){var r=this.doc.indexToPosition(n.at-1);this.sender.emit(\"error\",{row:r.row,column:r.column,text:n.message,type:\"error\"});return}this.sender.emit(\"ok\")}}.call(o.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/json/json_parse\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r,i,s={'\"':'\"',\"\\\\\":\"\\\\\",\"/\":\"/\",b:\"\\b\",f:\"\\f\",n:\"\\n\",r:\"\\r\",t:\"\t\"},o,u=function(e){throw{name:\"SyntaxError\",message:e,at:r,text:o}},a=function(e){return e&&e!==i&&u(\"Expected '\"+e+\"' instead of '\"+i+\"'\"),i=o.charAt(r),r+=1,i},f=function(){var e,t=\"\";i===\"-\"&&(t=\"-\",a(\"-\"));while(i>=\"0\"&&i<=\"9\")t+=i,a();if(i===\".\"){t+=\".\";while(a()&&i>=\"0\"&&i<=\"9\")t+=i}if(i===\"e\"||i===\"E\"){t+=i,a();if(i===\"-\"||i===\"+\")t+=i,a();while(i>=\"0\"&&i<=\"9\")t+=i,a()}e=+t;if(!isNaN(e))return e;u(\"Bad number\")},l=function(){var e,t,n=\"\",r;if(i==='\"')while(a()){if(i==='\"')return a(),n;if(i===\"\\\\\"){a();if(i===\"u\"){r=0;for(t=0;t<4;t+=1){e=parseInt(a(),16);if(!isFinite(e))break;r=r*16+e}n+=String.fromCharCode(r)}else{if(typeof s[i]!=\"string\")break;n+=s[i]}}else n+=i}u(\"Bad string\")},c=function(){while(i&&i<=\" \")a()},h=function(){switch(i){case\"t\":return a(\"t\"),a(\"r\"),a(\"u\"),a(\"e\"),!0;case\"f\":return a(\"f\"),a(\"a\"),a(\"l\"),a(\"s\"),a(\"e\"),!1;case\"n\":return a(\"n\"),a(\"u\"),a(\"l\"),a(\"l\"),null}u(\"Unexpected '\"+i+\"'\")},p,d=function(){var e=[];if(i===\"[\"){a(\"[\"),c();if(i===\"]\")return a(\"]\"),e;while(i){e.push(p()),c();if(i===\"]\")return a(\"]\"),e;a(\",\"),c()}}u(\"Bad array\")},v=function(){var e,t={};if(i===\"{\"){a(\"{\"),c();if(i===\"}\")return a(\"}\"),t;while(i){e=l(),c(),a(\":\"),Object.hasOwnProperty.call(t,e)&&u('Duplicate key \"'+e+'\"'),t[e]=p(),c();if(i===\"}\")return a(\"}\"),t;a(\",\"),c()}}u(\"Bad object\")};return p=function(){c();switch(i){case\"{\":return v();case\"[\":return d();case'\"':return l();case\"-\":return f();default:return i>=\"0\"&&i<=\"9\"?f():h()}},function(e,t){var n;return o=e,r=0,i=\" \",n=p(),c(),i&&u(\"Syntax error\"),typeof t==\"function\"?function s(e,n){var r,i,o=e[n];if(o&&typeof o==\"object\")for(r in o)Object.hasOwnProperty.call(o,r)&&(i=s(o,r),i!==undefined?o[r]=i:delete o[r]);return t.call(e,n,o)}({\"\":n},\"\"):n}}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-lua.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/lua_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/lua/luaparse\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../worker/mirror\").Mirror,s=e(\"../mode/lua/luaparse\"),o=t.Worker=function(e){i.call(this,e),this.setTimeout(500)};r.inherits(o,i),function(){this.onUpdate=function(){var e=this.doc.getValue();try{s.parse(e)}catch(t){t instanceof SyntaxError&&this.sender.emit(\"error\",{row:t.line-1,column:t.column,text:t.message,type:\"error\"});return}this.sender.emit(\"ok\")}}.call(o.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/lua/luaparse\",[\"require\",\"exports\",\"module\"],function(e,t,n){(function(e,n,r){r(t)})(this,\"luaparse\",function(e){function t(e){if(Jt){var t=$t.pop();t.complete(),bt.locations&&(e.loc=t.loc),bt.ranges&&(e.range=t.range)}return e}function n(e,t,n){for(var r=0,i=e.length;r<i;r++)if(e[r][t]===n)return r;return-1}function r(e){var t=Dt.call(arguments,1);return e=e.replace(/%(\\d)/g,function(e,n){return\"\"+t[n-1]||\"\"}),e}function i(){var e=Dt.call(arguments),t={},n,r;for(var i=0,s=e.length;i<s;i++){n=e[i];for(r in n)n.hasOwnProperty(r)&&(t[r]=n[r])}return t}function s(e){var t=r.apply(null,Dt.call(arguments,1)),n,i;throw\"undefined\"!=typeof e.line?(i=e.range[0]-e.lineStart,n=new SyntaxError(r(\"[%1:%2] %3\",e.line,i,t)),n.line=e.line,n.index=e.range[0],n.column=i):(i=Bt-zt+1,n=new SyntaxError(r(\"[%1:%2] %3\",Ut,i,t)),n.index=Bt,n.line=Ut,n.column=i),n}function o(e,t){s(t,Mt.expectedToken,e,t.value)}function u(e,t){\"undefined\"==typeof t&&(t=It.value);if(\"undefined\"!=typeof e.type){var n;switch(e.type){case xt:n=\"string\";break;case Tt:n=\"keyword\";break;case Nt:n=\"identifier\";break;case Ct:n=\"number\";break;case kt:n=\"symbol\";break;case Lt:n=\"boolean\";break;case At:return s(e,Mt.unexpected,\"symbol\",\"nil\",t)}return s(e,Mt.unexpected,n,e.value,t)}return s(e,Mt.unexpected,\"symbol\",e,t)}function a(){f();while(45===yt.charCodeAt(Bt)&&45===yt.charCodeAt(Bt+1))b(),f();if(Bt>=wt)return{type:St,value:\"<eof>\",line:Ut,lineStart:zt,range:[Bt,Bt]};var e=yt.charCodeAt(Bt),t=yt.charCodeAt(Bt+1);Rt=Bt;if(L(e))return l();switch(e){case 39:case 34:return p();case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return v();case 46:if(C(t))return v();if(46===t)return 46===yt.charCodeAt(Bt+2)?h():c(\"..\");return c(\".\");case 61:if(61===t)return c(\"==\");return c(\"=\");case 62:if(61===t)return c(\">=\");return c(\">\");case 60:if(61===t)return c(\"<=\");return c(\"<\");case 126:if(61===t)return c(\"~=\");return s({},Mt.expected,\"=\",\"~\");case 58:if(58===t)return c(\"::\");return c(\":\");case 91:if(91===t||61===t)return d();return c(\"[\");case 42:case 47:case 94:case 37:case 44:case 123:case 125:case 93:case 40:case 41:case 59:case 35:case 45:case 43:return c(yt.charAt(Bt))}return u(yt.charAt(Bt))}function f(){while(Bt<wt){var e=yt.charCodeAt(Bt);if(T(e))Bt++;else{if(!N(e))break;Ut++,zt=++Bt}}}function l(){var e,t;while(A(yt.charCodeAt(++Bt)));return e=yt.slice(Rt,Bt),O(e)?t=Tt:\"true\"===e||\"false\"===e?(t=Lt,e=\"true\"===e):\"nil\"===e?(t=At,e=null):t=Nt,{type:t,value:e,line:Ut,lineStart:zt,range:[Rt,Bt]}}function c(e){return Bt+=e.length,{type:kt,value:e,line:Ut,lineStart:zt,range:[Rt,Bt]}}function h(){return Bt+=3,{type:Ot,value:\"...\",line:Ut,lineStart:zt,range:[Rt,Bt]}}function p(){var e=yt.charCodeAt(Bt++),t=Bt,n=\"\",r;while(Bt<wt){r=yt.charCodeAt(Bt++);if(e===r)break;if(92===r)n+=yt.slice(t,Bt-1)+y(),t=Bt;else if(Bt>=wt||N(r))n+=yt.slice(t,Bt-1),s({},Mt.unfinishedString,n+String.fromCharCode(r))}return n+=yt.slice(t,Bt-1),{type:xt,value:n,line:Ut,lineStart:zt,range:[Rt,Bt]}}function d(){var e=w();return!1===e&&s(jt,Mt.expected,\"[\",jt.value),{type:xt,value:e,line:Ut,lineStart:zt,range:[Rt,Bt]}}function v(){var e=yt.charAt(Bt),t=yt.charAt(Bt+1),n=\"0\"===e&&\"xX\".indexOf(t||null)>=0?m():g();return{type:Ct,value:n,line:Ut,lineStart:zt,range:[Rt,Bt]}}function m(){var e=0,t=1,n=1,r,i,o,u;u=Bt+=2,k(yt.charCodeAt(Bt))||s({},Mt.malformedNumber,yt.slice(Rt,Bt));while(k(yt.charCodeAt(Bt)))Bt++;r=parseInt(yt.slice(u,Bt),16);if(\".\"===yt.charAt(Bt)){i=++Bt;while(k(yt.charCodeAt(Bt)))Bt++;e=yt.slice(i,Bt),e=i===Bt?0:parseInt(e,16)/Math.pow(16,Bt-i)}if(\"pP\".indexOf(yt.charAt(Bt)||null)>=0){Bt++,\"+-\".indexOf(yt.charAt(Bt)||null)>=0&&(n=\"+\"===yt.charAt(Bt++)?1:-1),o=Bt,C(yt.charCodeAt(Bt))||s({},Mt.malformedNumber,yt.slice(Rt,Bt));while(C(yt.charCodeAt(Bt)))Bt++;t=yt.slice(o,Bt),t=Math.pow(2,t*n)}return(r+e)*t}function g(){while(C(yt.charCodeAt(Bt)))Bt++;if(\".\"===yt.charAt(Bt)){Bt++;while(C(yt.charCodeAt(Bt)))Bt++}if(\"eE\".indexOf(yt.charAt(Bt)||null)>=0){Bt++,\"+-\".indexOf(yt.charAt(Bt)||null)>=0&&Bt++,C(yt.charCodeAt(Bt))||s({},Mt.malformedNumber,yt.slice(Rt,Bt));while(C(yt.charCodeAt(Bt)))Bt++}return parseFloat(yt.slice(Rt,Bt))}function y(){var e=Bt;switch(yt.charAt(Bt)){case\"n\":return Bt++,\"\\n\";case\"r\":return Bt++,\"\\r\";case\"t\":return Bt++,\"\t\";case\"v\":return Bt++,\"\u000b\";case\"b\":return Bt++,\"\\b\";case\"f\":return Bt++,\"\\f\";case\"z\":return Bt++,f(),\"\";case\"x\":if(k(yt.charCodeAt(Bt+1))&&k(yt.charCodeAt(Bt+2)))return Bt+=3,\"\\\\\"+yt.slice(e,Bt);return\"\\\\\"+yt.charAt(Bt++);default:if(C(yt.charCodeAt(Bt))){while(C(yt.charCodeAt(++Bt)));return\"\\\\\"+yt.slice(e,Bt)}return yt.charAt(Bt++)}}function b(){Rt=Bt,Bt+=2;var e=yt.charAt(Bt),t=\"\",n=!1,r=Bt,i=zt,s=Ut;\"[\"===e&&(t=w(),!1===t?t=e:n=!0);if(!n){while(Bt<wt){if(N(yt.charCodeAt(Bt)))break;Bt++}bt.comments&&(t=yt.slice(r,Bt))}if(bt.comments){var o=_t.comment(t,yt.slice(Rt,Bt));bt.locations&&(o.loc={start:{line:s,column:Rt-i},end:{line:Ut,column:Bt-zt}}),bt.ranges&&(o.range=[Rt,Bt]),qt.push(o)}}function w(){var e=0,t=\"\",n=!1,r,i;Bt++;while(\"=\"===yt.charAt(Bt+e))e++;if(\"[\"!==yt.charAt(Bt+e))return!1;Bt+=e+1,N(yt.charCodeAt(Bt))&&(Ut++,zt=Bt++),i=Bt;while(Bt<wt){r=yt.charAt(Bt++),N(r.charCodeAt(0))&&(Ut++,zt=Bt);if(\"]\"===r){n=!0;for(var s=0;s<e;s++)\"=\"!==yt.charAt(Bt+s)&&(n=!1);\"]\"!==yt.charAt(Bt+e)&&(n=!1)}if(n)break}return t+=yt.slice(i,Bt-1),Bt+=e+1,t}function E(){Ft=jt,jt=It,It=a()}function S(e){return e===jt.value?(E(),!0):!1}function x(e){e===jt.value?E():s(jt,Mt.expected,e,jt.value)}function T(e){return 9===e||32===e||11===e||12===e}function N(e){return 10===e||13===e}function C(e){return e>=48&&e<=57}function k(e){return e>=48&&e<=57||e>=97&&e<=102||e>=65&&e<=70}function L(e){return e>=65&&e<=90||e>=97&&e<=122||95===e}function A(e){return e>=65&&e<=90||e>=97&&e<=122||95===e||e>=48&&e<=57}function O(e){switch(e.length){case 2:return\"do\"===e||\"if\"===e||\"in\"===e||\"or\"===e;case 3:return\"and\"===e||\"end\"===e||\"for\"===e||\"not\"===e;case 4:return\"else\"===e||\"goto\"===e||\"then\"===e;case 5:return\"break\"===e||\"local\"===e||\"until\"===e||\"while\"===e;case 6:return\"elseif\"===e||\"repeat\"===e||\"return\"===e;case 8:return\"function\"===e}return!1}function M(e){return kt===e.type?\"#-\".indexOf(e.value)>=0:Tt===e.type?\"not\"===e.value:!1}function _(e){switch(e.type){case\"CallExpression\":case\"TableCallExpression\":case\"StringCallExpression\":return!0}return!1}function D(e){if(St===e.type)return!0;if(Tt!==e.type)return!1;switch(e.value){case\"else\":case\"elseif\":case\"end\":case\"until\":return!0;default:return!1}}function P(){Wt.push(Array.apply(null,Wt[Xt++]))}function H(){Wt.pop(),Xt--}function B(e){if(-1!==Ht(Wt[Xt],e))return;Wt[Xt].push(e)}function j(e){B(e.name),F(e,!0)}function F(e,t){!t&&-1===n(Vt,\"name\",e.name)&&Vt.push(e),e.isLocal=t}function I(e){return-1!==Ht(Wt[Xt],e)}function q(){return new R(jt)}function R(e){bt.locations&&(this.loc={start:{line:e.line,column:e.range[0]-e.lineStart},end:{line:0,column:0}}),bt.ranges&&(this.range=[e.range[0],0])}function U(){Jt&&$t.push(q())}function z(e){Jt&&$t.push(e)}function W(){E(),U();var e=X();return St!==jt.type&&u(jt),Jt&&!e.length&&(Ft=jt),t(_t.chunk(e))}function X(e){var t=[],n;bt.scope&&P();while(!D(jt)){if(\"return\"===jt.value){t.push(V());break}n=V(),n&&t.push(n)}return bt.scope&&H(),t}function V(){U();if(Tt===jt.type)switch(jt.value){case\"local\":return E(),nt();case\"if\":return E(),et();case\"return\":return E(),Z();case\"function\":E();var e=ot();return st(e);case\"while\":return E(),G();case\"for\":return E(),tt();case\"repeat\":return E(),Y();case\"break\":return E(),J();case\"do\":return E(),Q();case\"goto\":return E(),K()}if(kt===jt.type&&S(\"::\"))return $();Jt&&$t.pop();if(S(\";\"))return;return rt()}function $(){var e=jt.value,n=it();return bt.scope&&(B(\"::\"+e+\"::\"),F(n,!0)),x(\"::\"),t(_t.labelStatement(n))}function J(){return t(_t.breakStatement())}function K(){var e=jt.value,n=it();return bt.scope&&(n.isLabel=I(\"::\"+e+\"::\")),t(_t.gotoStatement(n))}function Q(){var e=X();return x(\"end\"),t(_t.doStatement(e))}function G(){var e=ft();x(\"do\");var n=X();return x(\"end\"),t(_t.whileStatement(e,n))}function Y(){var e=X();x(\"until\");var n=ft();return t(_t.repeatStatement(n,e))}function Z(){var e=[];if(\"end\"!==jt.value){var n=at();null!=n&&e.push(n);while(S(\",\"))n=ft(),e.push(n);S(\";\")}return t(_t.returnStatement(e))}function et(){var e=[],n,r,i;Jt&&(i=$t[$t.length-1],$t.push(i)),n=ft(),x(\"then\"),r=X(),e.push(t(_t.ifClause(n,r))),Jt&&(i=q());while(S(\"elseif\"))z(i),n=ft(),x(\"then\"),r=X(),e.push(t(_t.elseifClause(n,r))),Jt&&(i=q());return S(\"else\")&&(Jt&&(i=new R(Ft),$t.push(i)),r=X(),e.push(t(_t.elseClause(r)))),x(\"end\"),t(_t.ifStatement(e))}function tt(){var e=it(),n;bt.scope&&j(e);if(S(\"=\")){var r=ft();x(\",\");var i=ft(),s=S(\",\")?ft():null;return x(\"do\"),n=X(),x(\"end\"),t(_t.forNumericStatement(e,r,i,s,n))}var o=[e];while(S(\",\"))e=it(),bt.scope&&j(e),o.push(e);x(\"in\");var u=[];do{var a=ft();u.push(a)}while(S(\",\"));return x(\"do\"),n=X(),x(\"end\"),t(_t.forGenericStatement(o,u,n))}function nt(){var e;if(Nt===jt.type){var n=[],r=[];do e=it(),n.push(e);while(S(\",\"));if(S(\"=\"))do{var i=ft();r.push(i)}while(S(\",\"));if(bt.scope)for(var s=0,u=n.length;s<u;s++)j(n[s]);return t(_t.localStatement(n,r))}if(S(\"function\"))return e=it(),bt.scope&&j(e),st(e,!0);o(\"<name>\",jt)}function rt(){var e=jt,n,r;Jt&&(r=q()),n=ht();if(null==n)return u(jt);if(\",=\".indexOf(jt.value)>=0){var i=[n],s=[],a;while(S(\",\"))a=ht(),null==a&&o(\"<expression>\",jt),i.push(a);x(\"=\");do a=ft(),s.push(a);while(S(\",\"));return z(r),t(_t.assignmentStatement(i,s))}return _(n)?(z(r),t(_t.callStatement(n))):u(e)}function it(){U();var e=jt.value;return Nt!==jt.type&&o(\"<name>\",jt),E(),t(_t.identifier(e))}function st(e,n){var r=[];x(\"(\");if(!S(\")\"))for(;;)if(Nt===jt.type){var i=it();bt.scope&&j(i),r.push(i);if(S(\",\"))continue;if(S(\")\"))break}else{if(Ot===jt.type){r.push(dt()),x(\")\");break}o(\"<name> or '...'\",jt)}var s=X();return x(\"end\"),n=n||!1,t(_t.functionStatement(e,r,n,s))}function ot(){var e,n,r;Jt&&(r=q()),e=it(),bt.scope&&F(e,!1);while(S(\".\"))z(r),n=it(),bt.scope&&F(n,!1),e=t(_t.memberExpression(e,\".\",n));return S(\":\")&&(z(r),n=it(),bt.scope&&F(n,!1),e=t(_t.memberExpression(e,\":\",n))),e}function ut(){var e=[],n,r;for(;;){U();if(kt===jt.type&&S(\"[\"))n=ft(),x(\"]\"),x(\"=\"),r=ft(),e.push(t(_t.tableKey(n,r)));else if(Nt===jt.type)n=ft(),S(\"=\")?(r=ft(),e.push(t(_t.tableKeyString(n,r)))):e.push(t(_t.tableValue(n)));else{if(null==(r=at())){$t.pop();break}e.push(t(_t.tableValue(r)))}if(\",;\".indexOf(jt.value)>=0){E();continue}if(\"}\"===jt.value)break}return x(\"}\"),t(_t.tableConstructorExpression(e))}function at(){var e=ct(0);return e}function ft(){var e=at();if(null!=e)return e;o(\"<expression>\",jt)}function lt(e){var t=e.charCodeAt(0),n=e.length;if(1===n)switch(t){case 94:return 10;case 42:case 47:case 37:return 7;case 43:case 45:return 6;case 60:case 62:return 3}else if(2===n)switch(t){case 46:return 5;case 60:case 62:case 61:case 126:return 3;case 111:return 1}else if(97===t&&\"and\"===e)return 2;return 0}function ct(e){var n=jt.value,r,i;Jt&&(i=q());if(M(jt)){U(),E();var s=ct(8);s==null&&o(\"<expression>\",jt),r=t(_t.unaryExpression(n,s))}null==r&&(r=dt(),null==r&&(r=ht()));if(null==r)return null;var u;for(;;){n=jt.value,u=kt===jt.type||Tt===jt.type?lt(n):0;if(u===0||u<=e)break;(\"^\"===n||\"..\"===n)&&u--,E();var a=ct(u);null==a&&o(\"<expression>\",jt),Jt&&$t.push(i),r=t(_t.binaryExpression(n,r,a))}return r}function ht(){var e,n,r,i;Jt&&(r=q());if(Nt===jt.type)n=jt.value,e=it(),bt.scope&&F(e,i=I(n));else{if(!S(\"(\"))return null;e=ft(),x(\")\"),bt.scope&&(i=e.isLocal)}var s,o;for(;;)if(kt===jt.type)switch(jt.value){case\"[\":z(r),E(),s=ft(),e=t(_t.indexExpression(e,s)),x(\"]\");break;case\".\":z(r),E(),o=it(),bt.scope&&F(o,i),e=t(_t.memberExpression(e,\".\",o));break;case\":\":z(r),E(),o=it(),bt.scope&&F(o,i),e=t(_t.memberExpression(e,\":\",o)),z(r),e=pt(e);break;case\"(\":case\"{\":z(r),e=pt(e);break;default:return e}else{if(xt!==jt.type)break;z(r),e=pt(e)}return e}function pt(e){if(kt===jt.type)switch(jt.value){case\"(\":E();var n=[],r=at();null!=r&&n.push(r);while(S(\",\"))r=ft(),n.push(r);return x(\")\"),t(_t.callExpression(e,n));case\"{\":U(),E();var i=ut();return t(_t.tableCallExpression(e,i))}else if(xt===jt.type)return t(_t.stringCallExpression(e,dt()));o(\"function arguments\",jt)}function dt(){var e=xt|Ct|Lt|At|Ot,n=jt.value,r=jt.type,i;Jt&&(i=q());if(r&e){z(i);var s=yt.slice(jt.range[0],jt.range[1]);return E(),t(_t.literal(r,n,s))}if(Tt===r&&\"function\"===n)return z(i),E(),st(null);if(S(\"{\"))return z(i),ut()}function vt(t,n){return\"undefined\"==typeof n&&\"object\"==typeof t&&(n=t,t=undefined),n||(n={}),yt=t||\"\",bt=i(Et,n),Bt=0,Ut=1,zt=0,wt=yt.length,Wt=[[]],Xt=0,Vt=[],$t=[],bt.comments&&(qt=[]),bt.wait?e:gt()}function mt(t){return yt+=String(t),wt=yt.length,e}function gt(e){\"undefined\"!=typeof e&&mt(e),wt=yt.length,Jt=bt.locations||bt.ranges,It=a();var t=W();bt.comments&&(t.comments=qt),bt.scope&&(t.globals=Vt);if($t.length>0)throw new Error(\"Location tracking failed. This is most likely a bug in luaparse\");return t}e.version=\"0.1.4\";var yt,bt,wt,Et=e.defaultOptions={wait:!1,comments:!0,scope:!1,locations:!1,ranges:!1},St=1,xt=2,Tt=4,Nt=8,Ct=16,kt=32,Lt=64,At=128,Ot=256;e.tokenTypes={EOF:St,StringLiteral:xt,Keyword:Tt,Identifier:Nt,NumericLiteral:Ct,Punctuator:kt,BooleanLiteral:Lt,NilLiteral:At,VarargLiteral:Ot};var Mt=e.errors={unexpected:\"Unexpected %1 '%2' near '%3'\",expected:\"'%1' expected near '%2'\",expectedToken:\"%1 expected near '%2'\",unfinishedString:\"unfinished string near '%1'\",malformedNumber:\"malformed number near '%1'\"},_t=e.ast={labelStatement:function(e){return{type:\"LabelStatement\",label:e}},breakStatement:function(){return{type:\"BreakStatement\"}},gotoStatement:function(e){return{type:\"GotoStatement\",label:e}},returnStatement:function(e){return{type:\"ReturnStatement\",arguments:e}},ifStatement:function(e){return{type:\"IfStatement\",clauses:e}},ifClause:function(e,t){return{type:\"IfClause\",condition:e,body:t}},elseifClause:function(e,t){return{type:\"ElseifClause\",condition:e,body:t}},elseClause:function(e){return{type:\"ElseClause\",body:e}},whileStatement:function(e,t){return{type:\"WhileStatement\",condition:e,body:t}},doStatement:function(e){return{type:\"DoStatement\",body:e}},repeatStatement:function(e,t){return{type:\"RepeatStatement\",condition:e,body:t}},localStatement:function(e,t){return{type:\"LocalStatement\",variables:e,init:t}},assignmentStatement:function(e,t){return{type:\"AssignmentStatement\",variables:e,init:t}},callStatement:function(e){return{type:\"CallStatement\",expression:e}},functionStatement:function(e,t,n,r){return{type:\"FunctionDeclaration\",identifier:e,isLocal:n,parameters:t,body:r}},forNumericStatement:function(e,t,n,r,i){return{type:\"ForNumericStatement\",variable:e,start:t,end:n,step:r,body:i}},forGenericStatement:function(e,t,n){return{type:\"ForGenericStatement\",variables:e,iterators:t,body:n}},chunk:function(e){return{type:\"Chunk\",body:e}},identifier:function(e){return{type:\"Identifier\",name:e}},literal:function(e,t,n){return e=e===xt?\"StringLiteral\":e===Ct?\"NumericLiteral\":e===Lt?\"BooleanLiteral\":e===At?\"NilLiteral\":\"VarargLiteral\",{type:e,value:t,raw:n}},tableKey:function(e,t){return{type:\"TableKey\",key:e,value:t}},tableKeyString:function(e,t){return{type:\"TableKeyString\",key:e,value:t}},tableValue:function(e){return{type:\"TableValue\",value:e}},tableConstructorExpression:function(e){return{type:\"TableConstructorExpression\",fields:e}},binaryExpression:function(e,t,n){var r=\"and\"===e||\"or\"===e?\"LogicalExpression\":\"BinaryExpression\";return{type:r,operator:e,left:t,right:n}},unaryExpression:function(e,t){return{type:\"UnaryExpression\",operator:e,argument:t}},memberExpression:function(e,t,n){return{type:\"MemberExpression\",indexer:t,identifier:n,base:e}},indexExpression:function(e,t){return{type:\"IndexExpression\",base:e,index:t}},callExpression:function(e,t){return{type:\"CallExpression\",base:e,arguments:t}},tableCallExpression:function(e,t){return{type:\"TableCallExpression\",base:e,arguments:t}},stringCallExpression:function(e,t){return{type:\"StringCallExpression\",base:e,argument:t}},comment:function(e,t){return{type:\"Comment\",value:e,raw:t}}},Dt=Array.prototype.slice,Pt=Object.prototype.toString,Ht=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},Bt,jt,Ft,It,qt,Rt,Ut,zt;e.lex=a;var Wt,Xt,Vt,$t=[],Jt;R.prototype.complete=function(){bt.locations&&(this.loc.end.line=Ft.line,this.loc.end.column=Ft.range[1]-Ft.lineStart),bt.ranges&&(this.range[1]=Ft.range[1])},e.parse=vt,e.write=mt,e.end=gt})}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-php.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/php_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/php/php\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../worker/mirror\").Mirror,s=e(\"./php/php\").PHP,o=t.PhpWorker=function(e){i.call(this,e),this.setTimeout(500)};r.inherits(o,i),function(){this.setOptions=function(e){this.inlinePhp=e&&e.inline},this.onUpdate=function(){var e=this.doc.getValue(),t=[];this.inlinePhp&&(e=\"<?\"+e+\"?>\");var n=s.Lexer(e,{short_open_tag:1});try{new s.Parser(n)}catch(r){t.push({row:r.line-1,column:null,text:r.message.charAt(0).toUpperCase()+r.message.substring(1),type:\"error\"})}t.length?this.sender.emit(\"error\",t):this.sender.emit(\"ok\")}}.call(o.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/php/php\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={Constants:{}};r.Constants.T_INCLUDE=262,r.Constants.T_INCLUDE_ONCE=261,r.Constants.T_EVAL=260,r.Constants.T_REQUIRE=259,r.Constants.T_REQUIRE_ONCE=258,r.Constants.T_LOGICAL_OR=263,r.Constants.T_LOGICAL_XOR=264,r.Constants.T_LOGICAL_AND=265,r.Constants.T_PRINT=266,r.Constants.T_PLUS_EQUAL=277,r.Constants.T_MINUS_EQUAL=276,r.Constants.T_MUL_EQUAL=275,r.Constants.T_DIV_EQUAL=274,r.Constants.T_CONCAT_EQUAL=273,r.Constants.T_MOD_EQUAL=272,r.Constants.T_AND_EQUAL=271,r.Constants.T_OR_EQUAL=270,r.Constants.T_XOR_EQUAL=269,r.Constants.T_SL_EQUAL=268,r.Constants.T_SR_EQUAL=267,r.Constants.T_BOOLEAN_OR=278,r.Constants.T_BOOLEAN_AND=279,r.Constants.T_IS_EQUAL=283,r.Constants.T_IS_NOT_EQUAL=282,r.Constants.T_IS_IDENTICAL=281,r.Constants.T_IS_NOT_IDENTICAL=280,r.Constants.T_IS_SMALLER_OR_EQUAL=285,r.Constants.T_IS_GREATER_OR_EQUAL=284,r.Constants.T_SL=287,r.Constants.T_SR=286,r.Constants.T_INSTANCEOF=288,r.Constants.T_INC=297,r.Constants.T_DEC=296,r.Constants.T_INT_CAST=295,r.Constants.T_DOUBLE_CAST=294,r.Constants.T_STRING_CAST=293,r.Constants.T_ARRAY_CAST=292,r.Constants.T_OBJECT_CAST=291,r.Constants.T_BOOL_CAST=290,r.Constants.T_UNSET_CAST=289,r.Constants.T_NEW=299,r.Constants.T_CLONE=298,r.Constants.T_EXIT=300,r.Constants.T_IF=301,r.Constants.T_ELSEIF=302,r.Constants.T_ELSE=303,r.Constants.T_ENDIF=304,r.Constants.T_LNUMBER=305,r.Constants.T_DNUMBER=306,r.Constants.T_STRING=307,r.Constants.T_STRING_VARNAME=308,r.Constants.T_VARIABLE=309,r.Constants.T_NUM_STRING=310,r.Constants.T_INLINE_HTML=311,r.Constants.T_CHARACTER=312,r.Constants.T_BAD_CHARACTER=313,r.Constants.T_ENCAPSED_AND_WHITESPACE=314,r.Constants.T_CONSTANT_ENCAPSED_STRING=315,r.Constants.T_ECHO=316,r.Constants.T_DO=317,r.Constants.T_WHILE=318,r.Constants.T_ENDWHILE=319,r.Constants.T_FOR=320,r.Constants.T_ENDFOR=321,r.Constants.T_FOREACH=322,r.Constants.T_ENDFOREACH=323,r.Constants.T_DECLARE=324,r.Constants.T_ENDDECLARE=325,r.Constants.T_AS=326,r.Constants.T_SWITCH=327,r.Constants.T_ENDSWITCH=328,r.Constants.T_CASE=329,r.Constants.T_DEFAULT=330,r.Constants.T_BREAK=331,r.Constants.T_CONTINUE=332,r.Constants.T_GOTO=333,r.Constants.T_FUNCTION=334,r.Constants.T_CONST=335,r.Constants.T_RETURN=336,r.Constants.T_TRY=337,r.Constants.T_CATCH=338,r.Constants.T_THROW=339,r.Constants.T_USE=340,r.Constants.T_GLOBAL=341,r.Constants.T_STATIC=347,r.Constants.T_ABSTRACT=346,r.Constants.T_FINAL=345,r.Constants.T_PRIVATE=344,r.Constants.T_PROTECTED=343,r.Constants.T_PUBLIC=342,r.Constants.T_VAR=348,r.Constants.T_UNSET=349,r.Constants.T_ISSET=350,r.Constants.T_EMPTY=351,r.Constants.T_HALT_COMPILER=352,r.Constants.T_CLASS=353,r.Constants.T_TRAIT=382,r.Constants.T_INTERFACE=354,r.Constants.T_EXTENDS=355,r.Constants.T_IMPLEMENTS=356,r.Constants.T_OBJECT_OPERATOR=357,r.Constants.T_DOUBLE_ARROW=358,r.Constants.T_LIST=359,r.Constants.T_ARRAY=360,r.Constants.T_CLASS_C=361,r.Constants.T_TRAIT_C=381,r.Constants.T_METHOD_C=362,r.Constants.T_FUNC_C=363,r.Constants.T_LINE=364,r.Constants.T_FILE=365,r.Constants.T_COMMENT=366,r.Constants.T_DOC_COMMENT=367,r.Constants.T_OPEN_TAG=368,r.Constants.T_OPEN_TAG_WITH_ECHO=369,r.Constants.T_CLOSE_TAG=370,r.Constants.T_WHITESPACE=371,r.Constants.T_START_HEREDOC=372,r.Constants.T_END_HEREDOC=373,r.Constants.T_DOLLAR_OPEN_CURLY_BRACES=374,r.Constants.T_CURLY_OPEN=375,r.Constants.T_PAAMAYIM_NEKUDOTAYIM=376,r.Constants.T_DOUBLE_COLON=376,r.Constants.T_NAMESPACE=377,r.Constants.T_NS_C=378,r.Constants.T_DIR=379,r.Constants.T_NS_SEPARATOR=380,r.Lexer=function(e,t){var n,i=function(e){if(e.match(/\\n/)!==null){var t=e.substring(0,1);e=\"[\"+e.split(/\\n/).join(t+\",\"+t)+'].join(\"\\\\n\")'}return e},s,o=t===undefined||/^(on|true|1)$/i.test(t.short_open_tag)?/(\\<\\?php\\s|\\<\\?|\\<\\%|\\<script language\\=('|\")?php('|\")?\\>)/i:/(\\<\\?php\\s|<\\?=|\\<script language\\=('|\")?php('|\")?\\>)/i,u=t===undefined||/^(on|true|1)$/i.test(t.short_open_tag)?/^(\\<\\?php\\s|\\<\\?|\\<\\%|\\<script language\\=('|\")?php('|\")?\\>)/i:/^(\\<\\?php\\s|<\\?=|\\<script language\\=('|\")?php('|\")?\\>)/i,a=[{value:r.Constants.T_NAMESPACE,re:/^namespace(?=\\s)/i},{value:r.Constants.T_USE,re:/^use(?=\\s)/i},{value:r.Constants.T_ABSTRACT,re:/^abstract(?=\\s)/i},{value:r.Constants.T_IMPLEMENTS,re:/^implements(?=\\s)/i},{value:r.Constants.T_INTERFACE,re:/^interface(?=\\s)/i},{value:r.Constants.T_CONST,re:/^const(?=\\s)/i},{value:r.Constants.T_STATIC,re:/^static(?=\\s)/i},{value:r.Constants.T_FINAL,re:/^final(?=\\s)/i},{value:r.Constants.T_VAR,re:/^var(?=\\s)/i},{value:r.Constants.T_GLOBAL,re:/^global(?=\\s)/i},{value:r.Constants.T_CLONE,re:/^clone(?=\\s)/i},{value:r.Constants.T_THROW,re:/^throw(?=\\s)/i},{value:r.Constants.T_EXTENDS,re:/^extends(?=\\s)/i},{value:r.Constants.T_AND_EQUAL,re:/^&=/},{value:r.Constants.T_AS,re:/^as(?=\\s)/i},{value:r.Constants.T_ARRAY_CAST,re:/^\\(array\\)/i},{value:r.Constants.T_BOOL_CAST,re:/^\\((bool|boolean)\\)/i},{value:r.Constants.T_DOUBLE_CAST,re:/^\\((real|float|double)\\)/i},{value:r.Constants.T_INT_CAST,re:/^\\((int|integer)\\)/i},{value:r.Constants.T_OBJECT_CAST,re:/^\\(object\\)/i},{value:r.Constants.T_STRING_CAST,re:/^\\(string\\)/i},{value:r.Constants.T_UNSET_CAST,re:/^\\(unset\\)/i},{value:r.Constants.T_TRY,re:/^try(?=\\s*{)/i},{value:r.Constants.T_CATCH,re:/^catch(?=\\s*\\()/i},{value:r.Constants.T_INSTANCEOF,re:/^instanceof(?=\\s)/i},{value:r.Constants.T_LOGICAL_OR,re:/^or(?=\\s)/i},{value:r.Constants.T_LOGICAL_AND,re:/^and(?=\\s)/i},{value:r.Constants.T_LOGICAL_XOR,re:/^xor(?=\\s)/i},{value:r.Constants.T_BOOLEAN_AND,re:/^&&/},{value:r.Constants.T_BOOLEAN_OR,re:/^\\|\\|/},{value:r.Constants.T_CONTINUE,re:/^continue(?=\\s|;)/i},{value:r.Constants.T_BREAK,re:/^break(?=\\s|;)/i},{value:r.Constants.T_ENDDECLARE,re:/^enddeclare(?=\\s|;)/i},{value:r.Constants.T_ENDFOR,re:/^endfor(?=\\s|;)/i},{value:r.Constants.T_ENDFOREACH,re:/^endforeach(?=\\s|;)/i},{value:r.Constants.T_ENDIF,re:/^endif(?=\\s|;)/i},{value:r.Constants.T_ENDSWITCH,re:/^endswitch(?=\\s|;)/i},{value:r.Constants.T_ENDWHILE,re:/^endwhile(?=\\s|;)/i},{value:r.Constants.T_CASE,re:/^case(?=\\s)/i},{value:r.Constants.T_DEFAULT,re:/^default(?=\\s|:)/i},{value:r.Constants.T_SWITCH,re:/^switch(?=[ (])/i},{value:r.Constants.T_EXIT,re:/^(exit|die)(?=[ \\(;])/i},{value:r.Constants.T_CLOSE_TAG,re:/^(\\?\\>|\\%\\>|\\<\\/script\\>)\\s?\\s?/i,func:function(e){return c=!1,e}},{value:r.Constants.T_DOUBLE_ARROW,re:/^\\=\\>/},{value:r.Constants.T_DOUBLE_COLON,re:/^\\:\\:/},{value:r.Constants.T_METHOD_C,re:/^__METHOD__/},{value:r.Constants.T_LINE,re:/^__LINE__/},{value:r.Constants.T_FILE,re:/^__FILE__/},{value:r.Constants.T_FUNC_C,re:/^__FUNCTION__/},{value:r.Constants.T_NS_C,re:/^__NAMESPACE__/},{value:r.Constants.T_TRAIT_C,re:/^__TRAIT__/},{value:r.Constants.T_DIR,re:/^__DIR__/},{value:r.Constants.T_CLASS_C,re:/^__CLASS__/},{value:r.Constants.T_INC,re:/^\\+\\+/},{value:r.Constants.T_DEC,re:/^\\-\\-/},{value:r.Constants.T_CONCAT_EQUAL,re:/^\\.\\=/},{value:r.Constants.T_DIV_EQUAL,re:/^\\/\\=/},{value:r.Constants.T_XOR_EQUAL,re:/^\\^\\=/},{value:r.Constants.T_MUL_EQUAL,re:/^\\*\\=/},{value:r.Constants.T_MOD_EQUAL,re:/^\\%\\=/},{value:r.Constants.T_SL_EQUAL,re:/^<<=/},{value:r.Constants.T_START_HEREDOC,re:/^<<<[A-Z_0-9]+\\s/i,func:function(e){return n=e.substring(3,e.length-1),e}},{value:r.Constants.T_SL,re:/^<</},{value:r.Constants.T_IS_SMALLER_OR_EQUAL,re:/^<=/},{value:r.Constants.T_SR_EQUAL,re:/^>>=/},{value:r.Constants.T_SR,re:/^>>/},{value:r.Constants.T_IS_GREATER_OR_EQUAL,re:/^>=/},{value:r.Constants.T_OR_EQUAL,re:/^\\|\\=/},{value:r.Constants.T_PLUS_EQUAL,re:/^\\+\\=/},{value:r.Constants.T_MINUS_EQUAL,re:/^-\\=/},{value:r.Constants.T_OBJECT_OPERATOR,re:/^\\-\\>/i},{value:r.Constants.T_CLASS,re:/^class(?=[\\s\\{])/i,afterWhitespace:!0},{value:r.Constants.T_TRAIT,re:/^trait(?=[\\s]+[A-Za-z])/i},{value:r.Constants.T_PUBLIC,re:/^public(?=[\\s])/i},{value:r.Constants.T_PRIVATE,re:/^private(?=[\\s])/i},{value:r.Constants.T_PROTECTED,re:/^protected(?=[\\s])/i},{value:r.Constants.T_ARRAY,re:/^array(?=\\s*?\\()/i},{value:r.Constants.T_EMPTY,re:/^empty(?=[ \\(])/i},{value:r.Constants.T_ISSET,re:/^isset(?=[ \\(])/i},{value:r.Constants.T_UNSET,re:/^unset(?=[ \\(])/i},{value:r.Constants.T_RETURN,re:/^return(?=[ \"'(;])/i},{value:r.Constants.T_FUNCTION,re:/^function(?=[ \"'(;])/i},{value:r.Constants.T_ECHO,re:/^echo(?=[ \"'(;])/i},{value:r.Constants.T_LIST,re:/^list(?=\\s*?\\()/i},{value:r.Constants.T_PRINT,re:/^print(?=[ \"'(;])/i},{value:r.Constants.T_INCLUDE,re:/^include(?=[ \"'(;])/i},{value:r.Constants.T_INCLUDE_ONCE,re:/^include_once(?=[ \"'(;])/i},{value:r.Constants.T_REQUIRE,re:/^require(?=[ \"'(;])/i},{value:r.Constants.T_REQUIRE_ONCE,re:/^require_once(?=[ \"'(;])/i},{value:r.Constants.T_NEW,re:/^new(?=[ ])/i},{value:r.Constants.T_COMMENT,re:/^\\/\\*([\\S\\s]*?)(?:\\*\\/|$)/},{value:r.Constants.T_COMMENT,re:/^\\/\\/.*(\\s)?/},{value:r.Constants.T_COMMENT,re:/^\\#.*(\\s)?/},{value:r.Constants.T_ELSEIF,re:/^elseif(?=[\\s(])/i},{value:r.Constants.T_GOTO,re:/^goto(?=[\\s(])/i},{value:r.Constants.T_ELSE,re:/^else(?=[\\s{:])/i},{value:r.Constants.T_IF,re:/^if(?=[\\s(])/i},{value:r.Constants.T_DO,re:/^do(?=[ {])/i},{value:r.Constants.T_WHILE,re:/^while(?=[ (])/i},{value:r.Constants.T_FOREACH,re:/^foreach(?=[ (])/i},{value:r.Constants.T_ISSET,re:/^isset(?=[ (])/i},{value:r.Constants.T_IS_IDENTICAL,re:/^===/},{value:r.Constants.T_IS_EQUAL,re:/^==/},{value:r.Constants.T_IS_NOT_IDENTICAL,re:/^\\!==/},{value:r.Constants.T_IS_NOT_EQUAL,re:/^(\\!=|\\<\\>)/},{value:r.Constants.T_FOR,re:/^for(?=[ (])/i},{value:r.Constants.T_DNUMBER,re:/^[0-9]*\\.[0-9]+([eE][-]?[0-9]*)?/},{value:r.Constants.T_LNUMBER,re:/^(0x[0-9A-F]+|[0-9]+)/i},{value:r.Constants.T_OPEN_TAG_WITH_ECHO,re:/^(\\<\\?=|\\<\\%=)/i},{value:r.Constants.T_OPEN_TAG,re:u},{value:r.Constants.T_VARIABLE,re:/^\\$[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*/},{value:r.Constants.T_WHITESPACE,re:/^\\s+/},{value:r.Constants.T_CONSTANT_ENCAPSED_STRING,re:/^(\"(?:[^\"\\\\]|\\\\[\\s\\S])*\"|'(?:[^'\\\\]|\\\\[\\s\\S])*')/,func:function(e,t){var n=0,i,s=0;if(e.substring(0,1)===\"'\")return e;var o=e.match(/(?:[^\\\\]|\\\\.)*[^\\\\]\\$[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*/g);if(o!==null){while(e.length>0){i=e.length,o=e.match(/^[\\[\\]\\;\\:\\?\\(\\)\\!\\.\\,\\>\\<\\=\\+\\-\\/\\*\\|\\&\\@\\^\\%\\\"\\'\\{\\}]/),o!==null&&(f.push(o[0]),e=e.substring(1),n>0&&o[0]===\"}\"&&n--,o[0]===\"[\"&&s++,o[0]===\"]\"&&s--),o=e.match(/^\\$[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*/);if(o!==null){f.push([parseInt(r.Constants.T_VARIABLE,10),o[0],l]),e=e.substring(o[0].length),o=e.match(/^(\\-\\>)\\s*([a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*)\\s*(\\()/),o!==null&&(f.push([parseInt(r.Constants.T_OBJECT_OPERATOR,10),o[1],l]),f.push([parseInt(r.Constants.T_STRING,10),o[2],l]),o[3]&&f.push(o[3]),e=e.substring(o[0].length));if(e.match(/^\\[/g)!==null)continue}var u;n>0?u=/^([^\\\\\\$\"{}\\]\\(\\)\\->]|\\\\.)+/g:u=/^([^\\\\\\$\"{]|\\\\.|{[^\\$]|\\$(?=[^a-zA-Z_\\x7f-\\uffff]))+/g;var a,c;while((o=e.match(u))!==null){if(e.length===1)throw new Error(o);a=0,n>0?(c=o[0].match(/^[\\[\\]\\;\\:\\?\\(\\)\\!\\.\\,\\>\\<\\=\\+\\-\\/\\*\\|\\&\\{\\}\\@\\^\\%\\$\\~]/))?f.push(c[0]):a=r.Constants.T_STRING:a=r.Constants.T_ENCAPSED_AND_WHITESPACE,a&&f.push([parseInt(a,10),o[0].replace(/\\n/g,\"\\\\n\").replace(/\\r/g,\"\"),l]),l+=o[0].split(\"\\n\").length-1,e=e.substring(o[0].length)}n>0&&e.match(/^\\->/)!==null&&(f.push([parseInt(r.Constants.T_OBJECT_OPERATOR,10),\"->\",l]),e=e.substring(2)),e.match(/^{\\$/)!==null&&(f.push([parseInt(r.Constants.T_CURLY_OPEN,10),\"{\",l]),e=e.substring(1),n++);if(i===e.length&&(o=e.match(/^(([^\\\\]|\\\\.)*?[^\\\\]\\$[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*)/g))!==null)return}return undefined}return e=e.replace(/\\r/g,\"\"),e}},{value:r.Constants.T_NS_SEPARATOR,re:/^\\\\(?=[a-zA-Z_])/},{value:r.Constants.T_STRING,re:/^[a-zA-Z_\\x7f-\\uffff][a-zA-Z0-9_\\x7f-\\uffff]*/},{value:-1,re:/^[\\[\\]\\;\\:\\?\\(\\)\\!\\.\\,\\>\\<\\=\\+\\-\\/\\*\\|\\&\\{\\}\\@\\^\\%\\\"\\'\\$\\~]/}],f=[],l=1,c=!1,h=!0;if(e===null)return f;typeof e!=\"string\"&&(e=e.toString());while(e.length>0&&h===!0)if(c===!0)if(n!==undefined){var p=new RegExp(\"([\\\\S\\\\s]*?)(\\\\r\\\\n|\\\\n|\\\\r)(\"+n+\")(;|\\\\r\\\\n|\\\\n)\",\"i\"),d=e.match(p);d!==null&&(f.push([parseInt(r.Constants.T_ENCAPSED_AND_WHITESPACE,10),d[1].replace(/^\\n/g,\"\").replace(/\\\\\\$/g,\"$\")+\"\\n\",l]),l+=d[1].split(\"\\n\").length,f.push([parseInt(r.Constants.T_END_HEREDOC,10),d[3],l]),e=e.substring(d[1].length+d[2].length+d[3].length),n=undefined);if(d===null)throw Error(\"sup\")}else h=a.some(function(t){if(t.afterWhitespace===!0){var n=f[f.length-1];if(!Array.isArray(n)||n[0]!==r.Constants.T_WHITESPACE&&n[0]!==r.Constants.T_OPEN_TAG&&n[0]!==r.Constants.T_COMMENT)return!1}var i=e.match(t.re);if(i!==null){if(t.value!==-1){var s=i[0];t.func!==undefined&&(s=t.func(s,t)),s!==undefined&&(f.push([parseInt(t.value,10),s,l]),l+=s.split(\"\\n\").length-1)}else f.push(i[0]);return e=e.substring(i[0].length),!0}return!1});else{var d=o.exec(e);if(d===null)return f.push([parseInt(r.Constants.T_INLINE_HTML,10),e.replace(/^\\n/,\"\"),l]),f;if(d.index>0){var v=e.substring(0,d.index);f.push([parseInt(r.Constants.T_INLINE_HTML,10),v,l]),l+=v.split(\"\\n\").length-1,e=e.substring(d.index)}c=!0}return f},r.Parser=function(e,t){var n=this.yybase,i=this.yydefault,s=this.yycheck,o=this.yyaction,u=this.yylen,a=this.yygbase,f=this.yygcheck,l=this.yyp,c=this.yygoto,h=this.yylhs,p=this.terminals,d=this.translate,v=this.yygdefault;this.pos=-1,this.line=1,this.tokenMap=this.createTokenMap(),this.dropTokens={},this.dropTokens[r.Constants.T_WHITESPACE]=1,this.dropTokens[r.Constants.T_OPEN_TAG]=1;var m=[];e.forEach(function(e,t){typeof e==\"object\"&&e[0]===r.Constants.T_OPEN_TAG_WITH_ECHO?(m.push([r.Constants.T_OPEN_TAG,e[1],e[2]]),m.push([r.Constants.T_ECHO,e[1],e[2]])):m.push(e)}),this.tokens=m;var g=this.TOKEN_NONE;this.startAttributes={startLine:1},this.endAttributes={};var y=[this.startAttributes],b=0,w=[b];this.yyastk=[],this.stackPos=0;var E,S;for(;;){if(n[b]===0)E=i[b];else{g===this.TOKEN_NONE&&(S=this.getNextToken(),g=S>=0&&S<this.TOKEN_MAP_SIZE?d[S]:this.TOKEN_INVALID,y[this.stackPos]=this.startAttributes);if(((E=n[b]+g)>=0&&E<this.YYLAST&&s[E]===g||b<this.YY2TBLSTATE&&(E=n[b+this.YYNLSTATES]+g)>=0&&E<this.YYLAST&&s[E]===g)&&(E=o[E])!==this.YYDEFAULT)if(E>0){++this.stackPos,w[this.stackPos]=b=E,this.yyastk[this.stackPos]=this.tokenValue,y[this.stackPos]=this.startAttributes,g=this.TOKEN_NONE;if(E<this.YYNLSTATES)continue;E-=this.YYNLSTATES}else E=-E;else E=i[b]}for(;;){if(E===0)return this.yyval;if(E===this.YYUNEXPECTED){if(t!==!0){var x=[];for(var T=0;T<this.TOKEN_MAP_SIZE;++T)if((E=n[b]+T)>=0&&E<this.YYLAST&&s[E]==T||b<this.YY2TBLSTATE&&(E=n[b+this.YYNLSTATES]+T)&&E<this.YYLAST&&s[E]==T)if(o[E]!=this.YYUNEXPECTED){if(x.length==4){x=[];break}x.push(this.terminals[T])}var N=\"\";throw x.length&&(N=\", expecting \"+x.join(\" or \")),new r.ParseError(\"syntax error, unexpected \"+p[g]+N,this.startAttributes.startLine)}return this.startAttributes.startLine}for(var C in this.endAttributes)y[this.stackPos-u[E]][C]=this.endAttributes[C];try{this[\"yyn\"+E](y[this.stackPos-u[E]])}catch(k){throw k}this.stackPos-=u[E],E=h[E],(l=a[E]+w[this.stackPos])>=0&&l<this.YYGLAST&&f[l]===E?b=c[l]:b=v[E],++this.stackPos,w[this.stackPos]=b,this.yyastk[this.stackPos]=this.yyval,y[this.stackPos]=this.startAttributes;if(b<this.YYNLSTATES)break;E=b-this.YYNLSTATES}}},r.ParseError=function(e,t){this.message=e,this.line=t},r.Parser.prototype.MODIFIER_PUBLIC=1,r.Parser.prototype.MODIFIER_PROTECTED=2,r.Parser.prototype.MODIFIER_PRIVATE=4,r.Parser.prototype.MODIFIER_STATIC=8,r.Parser.prototype.MODIFIER_ABSTRACT=16,r.Parser.prototype.MODIFIER_FINAL=32,r.Parser.prototype.getNextToken=function(){this.startAttributes={},this.endAttributes={};var e,t;while(this.tokens[++this.pos]!==undefined){e=this.tokens[this.pos];if(typeof e==\"string\")return this.startAttributes.startLine=this.line,this.endAttributes.endLine=this.line,'b\"'===e?(this.tokenValue='b\"','\"'.charCodeAt(0)):(this.tokenValue=e,e.charCodeAt(0));this.line+=(t=e[1].match(/\\n/g))===null?0:t.length;if(r.Constants.T_COMMENT===e[0])Array.isArray(this.startAttributes.comments)||(this.startAttributes.comments=[]),this.startAttributes.comments.push({type:\"comment\",comment:e[1],line:e[2]});else if(r.Constants.T_DOC_COMMENT===e[0])this.startAttributes.comments.push(new PHPParser_Comment_Doc(e[1],e[2]));else if(this.dropTokens[e[0]]===undefined)return this.tokenValue=e[1],this.startAttributes.startLine=e[2],this.endAttributes.endLine=this.line,this.tokenMap[e[0]]}return this.startAttributes.startLine=this.line,0},r.Parser.prototype.tokenName=function(e){var t=[\"T_INCLUDE\",\"T_INCLUDE_ONCE\",\"T_EVAL\",\"T_REQUIRE\",\"T_REQUIRE_ONCE\",\"T_LOGICAL_OR\",\"T_LOGICAL_XOR\",\"T_LOGICAL_AND\",\"T_PRINT\",\"T_PLUS_EQUAL\",\"T_MINUS_EQUAL\",\"T_MUL_EQUAL\",\"T_DIV_EQUAL\",\"T_CONCAT_EQUAL\",\"T_MOD_EQUAL\",\"T_AND_EQUAL\",\"T_OR_EQUAL\",\"T_XOR_EQUAL\",\"T_SL_EQUAL\",\"T_SR_EQUAL\",\"T_BOOLEAN_OR\",\"T_BOOLEAN_AND\",\"T_IS_EQUAL\",\"T_IS_NOT_EQUAL\",\"T_IS_IDENTICAL\",\"T_IS_NOT_IDENTICAL\",\"T_IS_SMALLER_OR_EQUAL\",\"T_IS_GREATER_OR_EQUAL\",\"T_SL\",\"T_SR\",\"T_INSTANCEOF\",\"T_INC\",\"T_DEC\",\"T_INT_CAST\",\"T_DOUBLE_CAST\",\"T_STRING_CAST\",\"T_ARRAY_CAST\",\"T_OBJECT_CAST\",\"T_BOOL_CAST\",\"T_UNSET_CAST\",\"T_NEW\",\"T_CLONE\",\"T_EXIT\",\"T_IF\",\"T_ELSEIF\",\"T_ELSE\",\"T_ENDIF\",\"T_LNUMBER\",\"T_DNUMBER\",\"T_STRING\",\"T_STRING_VARNAME\",\"T_VARIABLE\",\"T_NUM_STRING\",\"T_INLINE_HTML\",\"T_CHARACTER\",\"T_BAD_CHARACTER\",\"T_ENCAPSED_AND_WHITESPACE\",\"T_CONSTANT_ENCAPSED_STRING\",\"T_ECHO\",\"T_DO\",\"T_WHILE\",\"T_ENDWHILE\",\"T_FOR\",\"T_ENDFOR\",\"T_FOREACH\",\"T_ENDFOREACH\",\"T_DECLARE\",\"T_ENDDECLARE\",\"T_AS\",\"T_SWITCH\",\"T_ENDSWITCH\",\"T_CASE\",\"T_DEFAULT\",\"T_BREAK\",\"T_CONTINUE\",\"T_GOTO\",\"T_FUNCTION\",\"T_CONST\",\"T_RETURN\",\"T_TRY\",\"T_CATCH\",\"T_THROW\",\"T_USE\",\"T_INSTEADOF\",\"T_GLOBAL\",\"T_STATIC\",\"T_ABSTRACT\",\"T_FINAL\",\"T_PRIVATE\",\"T_PROTECTED\",\"T_PUBLIC\",\"T_VAR\",\"T_UNSET\",\"T_ISSET\",\"T_EMPTY\",\"T_HALT_COMPILER\",\"T_CLASS\",\"T_TRAIT\",\"T_INTERFACE\",\"T_EXTENDS\",\"T_IMPLEMENTS\",\"T_OBJECT_OPERATOR\",\"T_DOUBLE_ARROW\",\"T_LIST\",\"T_ARRAY\",\"T_CALLABLE\",\"T_CLASS_C\",\"T_TRAIT_C\",\"T_METHOD_C\",\"T_FUNC_C\",\"T_LINE\",\"T_FILE\",\"T_COMMENT\",\"T_DOC_COMMENT\",\"T_OPEN_TAG\",\"T_OPEN_TAG_WITH_ECHO\",\"T_CLOSE_TAG\",\"T_WHITESPACE\",\"T_START_HEREDOC\",\"T_END_HEREDOC\",\"T_DOLLAR_OPEN_CURLY_BRACES\",\"T_CURLY_OPEN\",\"T_PAAMAYIM_NEKUDOTAYIM\",\"T_DOUBLE_COLON\",\"T_NAMESPACE\",\"T_NS_C\",\"T_DIR\",\"T_NS_SEPARATOR\"],n=\"UNKNOWN\";return t.some(function(t){return r.Constants[t]===e?(n=t,!0):!1}),n},r.Parser.prototype.createTokenMap=function(){var e={},t,n,i=r.Constants.T_PAAMAYIM_NEKUDOTAYIM;for(n=256;n<1e3;++n)i===n?e[n]=this.T_PAAMAYIM_NEKUDOTAYIM:r.Constants.T_OPEN_TAG_WITH_ECHO===n?e[n]=r.Constants.T_ECHO:r.Constants.T_CLOSE_TAG===n?e[n]=59:\"UNKNOWN\"!==(t=this.tokenName(n))&&(e[n]=this[t]);return e};var i=function(){this.yyval=this.yyastk[this.stackPos-0]};r.Parser.prototype.MakeArray=function(e){return Array.isArray(e)?e:[e]},r.Parser.prototype.parseString=function(e){var t=0;return\"b\"===e[0]&&(t=1),\"'\"===e[t]?e=e.replace([\"\\\\\\\\\",\"\\\\'\"],[\"\\\\\",\"'\"]):e=this.parseEscapeSequences(e,'\"'),e},r.Parser.prototype.parseEscapeSequences=function(e,t){undefined!==t&&(e=e.replace(new RegExp(\"\\\\\"+t,\"g\"),t));var n={\"\\\\\":\"\\\\\",$:\"$\",n:\"\\n\",r:\"\\r\",t:\"\t\",f:\"\\f\",v:\"\u000b\",e:\"\u001b\"};return e.replace(/~\\\\\\\\([\\\\\\\\$nrtfve]|[xX][0-9a-fA-F]{1,2}|[0-7]{1,3})~/g,function(e){var t=e[1];return n[t]!==undefined?n[t]:\"x\"===t[0]||\"X\"===t[0]?chr(hexdec(t)):chr(octdec(t))})},r.Parser.prototype.TOKEN_NONE=-1,r.Parser.prototype.TOKEN_INVALID=149,r.Parser.prototype.TOKEN_MAP_SIZE=384,r.Parser.prototype.YYLAST=913,r.Parser.prototype.YY2TBLSTATE=328,r.Parser.prototype.YYGLAST=415,r.Parser.prototype.YYNLSTATES=544,r.Parser.prototype.YYUNEXPECTED=32767,r.Parser.prototype.YYDEFAULT=-32766,r.Parser.prototype.YYERRTOK=256,r.Parser.prototype.T_INCLUDE=257,r.Parser.prototype.T_INCLUDE_ONCE=258,r.Parser.prototype.T_EVAL=259,r.Parser.prototype.T_REQUIRE=260,r.Parser.prototype.T_REQUIRE_ONCE=261,r.Parser.prototype.T_LOGICAL_OR=262,r.Parser.prototype.T_LOGICAL_XOR=263,r.Parser.prototype.T_LOGICAL_AND=264,r.Parser.prototype.T_PRINT=265,r.Parser.prototype.T_PLUS_EQUAL=266,r.Parser.prototype.T_MINUS_EQUAL=267,r.Parser.prototype.T_MUL_EQUAL=268,r.Parser.prototype.T_DIV_EQUAL=269,r.Parser.prototype.T_CONCAT_EQUAL=270,r.Parser.prototype.T_MOD_EQUAL=271,r.Parser.prototype.T_AND_EQUAL=272,r.Parser.prototype.T_OR_EQUAL=273,r.Parser.prototype.T_XOR_EQUAL=274,r.Parser.prototype.T_SL_EQUAL=275,r.Parser.prototype.T_SR_EQUAL=276,r.Parser.prototype.T_BOOLEAN_OR=277,r.Parser.prototype.T_BOOLEAN_AND=278,r.Parser.prototype.T_IS_EQUAL=279,r.Parser.prototype.T_IS_NOT_EQUAL=280,r.Parser.prototype.T_IS_IDENTICAL=281,r.Parser.prototype.T_IS_NOT_IDENTICAL=282,r.Parser.prototype.T_IS_SMALLER_OR_EQUAL=283,r.Parser.prototype.T_IS_GREATER_OR_EQUAL=284,r.Parser.prototype.T_SL=285,r.Parser.prototype.T_SR=286,r.Parser.prototype.T_INSTANCEOF=287,r.Parser.prototype.T_INC=288,r.Parser.prototype.T_DEC=289,r.Parser.prototype.T_INT_CAST=290,r.Parser.prototype.T_DOUBLE_CAST=291,r.Parser.prototype.T_STRING_CAST=292,r.Parser.prototype.T_ARRAY_CAST=293,r.Parser.prototype.T_OBJECT_CAST=294,r.Parser.prototype.T_BOOL_CAST=295,r.Parser.prototype.T_UNSET_CAST=296,r.Parser.prototype.T_NEW=297,r.Parser.prototype.T_CLONE=298,r.Parser.prototype.T_EXIT=299,r.Parser.prototype.T_IF=300,r.Parser.prototype.T_ELSEIF=301,r.Parser.prototype.T_ELSE=302,r.Parser.prototype.T_ENDIF=303,r.Parser.prototype.T_LNUMBER=304,r.Parser.prototype.T_DNUMBER=305,r.Parser.prototype.T_STRING=306,r.Parser.prototype.T_STRING_VARNAME=307,r.Parser.prototype.T_VARIABLE=308,r.Parser.prototype.T_NUM_STRING=309,r.Parser.prototype.T_INLINE_HTML=310,r.Parser.prototype.T_CHARACTER=311,r.Parser.prototype.T_BAD_CHARACTER=312,r.Parser.prototype.T_ENCAPSED_AND_WHITESPACE=313,r.Parser.prototype.T_CONSTANT_ENCAPSED_STRING=314,r.Parser.prototype.T_ECHO=315,r.Parser.prototype.T_DO=316,r.Parser.prototype.T_WHILE=317,r.Parser.prototype.T_ENDWHILE=318,r.Parser.prototype.T_FOR=319,r.Parser.prototype.T_ENDFOR=320,r.Parser.prototype.T_FOREACH=321,r.Parser.prototype.T_ENDFOREACH=322,r.Parser.prototype.T_DECLARE=323,r.Parser.prototype.T_ENDDECLARE=324,r.Parser.prototype.T_AS=325,r.Parser.prototype.T_SWITCH=326,r.Parser.prototype.T_ENDSWITCH=327,r.Parser.prototype.T_CASE=328,r.Parser.prototype.T_DEFAULT=329,r.Parser.prototype.T_BREAK=330,r.Parser.prototype.T_CONTINUE=331,r.Parser.prototype.T_GOTO=332,r.Parser.prototype.T_FUNCTION=333,r.Parser.prototype.T_CONST=334,r.Parser.prototype.T_RETURN=335,r.Parser.prototype.T_TRY=336,r.Parser.prototype.T_CATCH=337,r.Parser.prototype.T_THROW=338,r.Parser.prototype.T_USE=339,r.Parser.prototype.T_INSTEADOF=340,r.Parser.prototype.T_GLOBAL=341,r.Parser.prototype.T_STATIC=342,r.Parser.prototype.T_ABSTRACT=343,r.Parser.prototype.T_FINAL=344,r.Parser.prototype.T_PRIVATE=345,r.Parser.prototype.T_PROTECTED=346,r.Parser.prototype.T_PUBLIC=347,r.Parser.prototype.T_VAR=348,r.Parser.prototype.T_UNSET=349,r.Parser.prototype.T_ISSET=350,r.Parser.prototype.T_EMPTY=351,r.Parser.prototype.T_HALT_COMPILER=352,r.Parser.prototype.T_CLASS=353,r.Parser.prototype.T_TRAIT=354,r.Parser.prototype.T_INTERFACE=355,r.Parser.prototype.T_EXTENDS=356,r.Parser.prototype.T_IMPLEMENTS=357,r.Parser.prototype.T_OBJECT_OPERATOR=358,r.Parser.prototype.T_DOUBLE_ARROW=359,r.Parser.prototype.T_LIST=360,r.Parser.prototype.T_ARRAY=361,r.Parser.prototype.T_CALLABLE=362,r.Parser.prototype.T_CLASS_C=363,r.Parser.prototype.T_TRAIT_C=364,r.Parser.prototype.T_METHOD_C=365,r.Parser.prototype.T_FUNC_C=366,r.Parser.prototype.T_LINE=367,r.Parser.prototype.T_FILE=368,r.Parser.prototype.T_COMMENT=369,r.Parser.prototype.T_DOC_COMMENT=370,r.Parser.prototype.T_OPEN_TAG=371,r.Parser.prototype.T_OPEN_TAG_WITH_ECHO=372,r.Parser.prototype.T_CLOSE_TAG=373,r.Parser.prototype.T_WHITESPACE=374,r.Parser.prototype.T_START_HEREDOC=375,r.Parser.prototype.T_END_HEREDOC=376,r.Parser.prototype.T_DOLLAR_OPEN_CURLY_BRACES=377,r.Parser.prototype.T_CURLY_OPEN=378,r.Parser.prototype.T_PAAMAYIM_NEKUDOTAYIM=379,r.Parser.prototype.T_NAMESPACE=380,r.Parser.prototype.T_NS_C=381,r.Parser.prototype.T_DIR=382,r.Parser.prototype.T_NS_SEPARATOR=383,r.Parser.prototype.terminals=[\"$EOF\",\"error\",\"T_INCLUDE\",\"T_INCLUDE_ONCE\",\"T_EVAL\",\"T_REQUIRE\",\"T_REQUIRE_ONCE\",\"','\",\"T_LOGICAL_OR\",\"T_LOGICAL_XOR\",\"T_LOGICAL_AND\",\"T_PRINT\",\"'='\",\"T_PLUS_EQUAL\",\"T_MINUS_EQUAL\",\"T_MUL_EQUAL\",\"T_DIV_EQUAL\",\"T_CONCAT_EQUAL\",\"T_MOD_EQUAL\",\"T_AND_EQUAL\",\"T_OR_EQUAL\",\"T_XOR_EQUAL\",\"T_SL_EQUAL\",\"T_SR_EQUAL\",\"'?'\",\"':'\",\"T_BOOLEAN_OR\",\"T_BOOLEAN_AND\",\"'|'\",\"'^'\",\"'&'\",\"T_IS_EQUAL\",\"T_IS_NOT_EQUAL\",\"T_IS_IDENTICAL\",\"T_IS_NOT_IDENTICAL\",\"'<'\",\"T_IS_SMALLER_OR_EQUAL\",\"'>'\",\"T_IS_GREATER_OR_EQUAL\",\"T_SL\",\"T_SR\",\"'+'\",\"'-'\",\"'.'\",\"'*'\",\"'/'\",\"'%'\",\"'!'\",\"T_INSTANCEOF\",\"'~'\",\"T_INC\",\"T_DEC\",\"T_INT_CAST\",\"T_DOUBLE_CAST\",\"T_STRING_CAST\",\"T_ARRAY_CAST\",\"T_OBJECT_CAST\",\"T_BOOL_CAST\",\"T_UNSET_CAST\",\"'@'\",\"'['\",\"T_NEW\",\"T_CLONE\",\"T_EXIT\",\"T_IF\",\"T_ELSEIF\",\"T_ELSE\",\"T_ENDIF\",\"T_LNUMBER\",\"T_DNUMBER\",\"T_STRING\",\"T_STRING_VARNAME\",\"T_VARIABLE\",\"T_NUM_STRING\",\"T_INLINE_HTML\",\"T_ENCAPSED_AND_WHITESPACE\",\"T_CONSTANT_ENCAPSED_STRING\",\"T_ECHO\",\"T_DO\",\"T_WHILE\",\"T_ENDWHILE\",\"T_FOR\",\"T_ENDFOR\",\"T_FOREACH\",\"T_ENDFOREACH\",\"T_DECLARE\",\"T_ENDDECLARE\",\"T_AS\",\"T_SWITCH\",\"T_ENDSWITCH\",\"T_CASE\",\"T_DEFAULT\",\"T_BREAK\",\"T_CONTINUE\",\"T_GOTO\",\"T_FUNCTION\",\"T_CONST\",\"T_RETURN\",\"T_TRY\",\"T_CATCH\",\"T_THROW\",\"T_USE\",\"T_INSTEADOF\",\"T_GLOBAL\",\"T_STATIC\",\"T_ABSTRACT\",\"T_FINAL\",\"T_PRIVATE\",\"T_PROTECTED\",\"T_PUBLIC\",\"T_VAR\",\"T_UNSET\",\"T_ISSET\",\"T_EMPTY\",\"T_HALT_COMPILER\",\"T_CLASS\",\"T_TRAIT\",\"T_INTERFACE\",\"T_EXTENDS\",\"T_IMPLEMENTS\",\"T_OBJECT_OPERATOR\",\"T_DOUBLE_ARROW\",\"T_LIST\",\"T_ARRAY\",\"T_CALLABLE\",\"T_CLASS_C\",\"T_TRAIT_C\",\"T_METHOD_C\",\"T_FUNC_C\",\"T_LINE\",\"T_FILE\",\"T_START_HEREDOC\",\"T_END_HEREDOC\",\"T_DOLLAR_OPEN_CURLY_BRACES\",\"T_CURLY_OPEN\",\"T_PAAMAYIM_NEKUDOTAYIM\",\"T_NAMESPACE\",\"T_NS_C\",\"T_DIR\",\"T_NS_SEPARATOR\",\"';'\",\"'{'\",\"'}'\",\"'('\",\"')'\",\"'$'\",\"']'\",\"'`'\",\"'\\\"'\",\"???\"],r.Parser.prototype.translate=[0,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,47,148,149,145,46,30,149,143,144,44,41,7,42,43,45,149,149,149,149,149,149,149,149,149,149,25,140,35,12,37,24,59,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,60,149,146,29,149,147,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,141,28,142,49,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,1,2,3,4,5,6,8,9,10,11,13,14,15,16,17,18,19,20,21,22,23,26,27,31,32,33,34,36,38,39,40,48,50,51,52,53,54,55,56,57,58,61,62,63,64,65,66,67,68,69,70,71,72,73,74,149,149,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,149,149,149,149,149,149,131,132,133,134,135,136,137,138,139],r.Parser.prototype.yyaction=[61,62,363,63,64,-32766,-32766,-32766,509,65,708,709,710,707,706,705,-32766,-32766,-32766,-32766,-32766,-32766,132,-32766,-32766,-32766,-32766,-32766,-32767,-32767,-32767,-32767,-32766,335,-32766,-32766,-32766,-32766,-32766,66,67,351,663,664,40,68,548,69,232,233,70,71,72,73,74,75,76,77,30,246,78,336,364,-112,0,469,833,834,365,641,890,436,590,41,835,53,27,366,294,367,687,368,921,369,923,922,370,-32766,-32766,-32766,42,43,371,339,126,44,372,337,79,297,349,292,293,-32766,918,-32766,-32766,373,374,375,376,377,391,199,361,338,573,613,378,379,380,381,845,839,840,841,842,836,837,253,-32766,87,88,89,391,843,838,338,597,519,128,80,129,273,332,257,261,47,673,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,799,247,884,108,109,110,226,247,21,-32766,310,-32766,-32766,-32766,642,548,-32766,-32766,-32766,-32766,56,353,-32766,-32766,-32766,55,-32766,-32766,-32766,-32766,-32766,58,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766,-32766,557,-32766,-32766,518,-32766,548,890,-32766,390,-32766,228,252,-32766,-32766,-32766,-32766,-32766,275,-32766,234,-32766,587,588,-32766,-32766,-32766,-32766,-32766,-32766,-32766,46,236,-32766,-32766,281,-32766,682,348,-32766,390,-32766,346,333,521,-32766,-32766,-32766,271,911,262,237,446,911,-32766,894,59,700,358,135,548,123,538,35,-32766,333,122,-32766,-32766,-32766,271,-32766,124,-32766,692,-32766,-32766,-32766,-32766,700,273,22,-32766,-32766,-32766,-32766,239,-32766,-32766,612,-32766,548,134,-32766,390,-32766,462,354,-32766,-32766,-32766,-32766,-32766,227,-32766,238,-32766,845,542,-32766,856,611,200,-32766,-32766,-32766,259,280,-32766,-32766,201,-32766,855,129,-32766,390,130,202,333,206,-32766,-32766,-32766,271,-32766,-32766,-32766,125,601,-32766,136,299,700,489,28,548,105,106,107,-32766,498,499,-32766,-32766,-32766,207,-32766,133,-32766,525,-32766,-32766,-32766,-32766,663,664,527,-32766,-32766,-32766,-32766,528,-32766,-32766,610,-32766,548,427,-32766,390,-32766,532,539,-32766,-32766,-32766,-32766,-32766,240,-32766,247,-32766,697,543,-32766,554,523,608,-32766,-32766,-32766,686,535,-32766,-32766,54,-32766,57,60,-32766,390,246,-155,278,345,-32766,-32766,-32766,506,347,-152,471,402,403,-32766,405,404,272,493,416,548,318,417,505,-32766,517,548,-32766,-32766,-32766,549,-32766,562,-32766,916,-32766,-32766,-32766,-32766,564,826,848,-32766,-32766,-32766,-32766,694,-32766,-32766,485,-32766,548,487,-32766,390,-32766,504,802,-32766,-32766,-32766,-32766,-32766,279,-32766,911,-32766,502,492,-32766,413,483,269,-32766,-32766,-32766,243,337,-32766,-32766,418,-32766,454,229,-32766,390,274,373,374,344,-32766,-32766,-32766,360,614,-32766,573,613,378,379,-274,548,615,-332,844,-32766,258,51,-32766,-32766,-32766,270,-32766,346,-32766,52,-32766,260,0,-32766,-333,-32766,-32766,-32766,-32766,-32766,-32766,205,-32766,-32766,49,-32766,548,424,-32766,390,-32766,-266,264,-32766,-32766,-32766,-32766,-32766,409,-32766,343,-32766,265,312,-32766,470,513,-275,-32766,-32766,-32766,920,337,-32766,-32766,530,-32766,531,600,-32766,390,592,373,374,578,581,-32766,-32766,644,629,-32766,573,613,378,379,635,548,636,576,627,-32766,625,693,-32766,-32766,-32766,691,-32766,591,-32766,582,-32766,203,204,-32766,584,583,-32766,-32766,-32766,-32766,586,599,-32766,-32766,589,-32766,690,558,-32766,390,197,683,919,86,520,522,-32766,524,833,834,529,533,-32766,534,537,541,835,48,111,112,113,114,115,116,117,118,119,120,121,127,31,633,337,330,634,585,-32766,32,291,337,330,478,373,374,917,291,891,889,875,373,374,553,613,378,379,737,739,887,553,613,378,379,824,451,675,839,840,841,842,836,837,320,895,277,885,23,33,843,838,556,277,337,330,-32766,34,-32766,555,291,36,37,38,373,374,39,45,50,81,82,83,84,553,613,378,379,-32767,-32767,-32767,-32767,103,104,105,106,107,337,85,131,137,337,138,198,224,225,277,373,374,-332,230,373,374,24,337,231,573,613,378,379,573,613,378,379,373,374,235,248,249,250,337,251,0,573,613,378,379,276,329,331,373,374,-32766,337,574,490,792,337,609,573,613,378,379,373,374,25,300,373,374,319,337,795,573,613,378,379,573,613,378,379,373,374,516,355,359,445,482,796,507,573,613,378,379,508,548,337,890,775,791,337,604,803,808,806,698,373,374,888,807,373,374,-32766,-32766,-32766,573,613,378,379,573,613,378,379,873,832,804,872,851,-32766,809,-32766,-32766,-32766,-32766,805,20,26,29,298,480,515,770,778,827,457,0,900,455,774,0,0,0,874,870,886,823,915,852,869,488,0,391,793,0,338,0,0,0,340,0,273],r.Parser.prototype.yycheck=[2,3,4,5,6,8,9,10,70,11,104,105,106,107,108,109,8,9,10,8,9,24,60,26,27,28,29,30,31,32,33,34,24,7,26,27,28,29,30,41,42,7,123,124,7,47,70,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,144,0,75,68,69,70,25,72,70,74,7,76,77,78,79,7,81,142,83,70,85,72,73,88,8,9,10,92,93,94,95,7,97,98,95,100,7,7,103,104,24,142,26,27,105,106,111,112,113,136,7,7,139,114,115,116,117,122,123,132,125,126,127,128,129,130,131,8,8,9,10,136,137,138,139,140,141,25,143,141,145,142,147,148,24,72,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,144,48,72,44,45,46,30,48,144,64,72,8,9,10,140,70,8,9,10,74,60,25,77,78,79,60,81,24,83,26,85,60,24,88,26,27,28,92,93,94,64,140,97,98,70,100,70,72,103,104,74,145,7,77,78,79,111,81,7,83,30,85,140,140,88,8,9,10,92,93,94,133,134,97,98,145,100,140,7,103,104,24,139,96,141,140,141,111,101,75,75,30,70,75,64,70,60,110,121,12,70,141,25,143,74,96,141,77,78,79,101,81,141,83,140,85,140,141,88,110,145,144,92,93,94,64,7,97,98,142,100,70,141,103,104,74,145,141,77,78,79,111,81,7,83,30,85,132,25,88,132,142,12,92,93,94,120,60,97,98,12,100,148,141,103,104,141,12,96,12,140,141,111,101,8,9,10,141,25,64,90,91,110,65,66,70,41,42,43,74,65,66,77,78,79,12,81,25,83,25,85,140,141,88,123,124,25,92,93,94,64,25,97,98,142,100,70,120,103,104,74,25,25,77,78,79,111,81,30,83,48,85,140,141,88,140,141,30,92,93,94,140,141,97,98,60,100,60,60,103,104,61,72,75,70,140,141,111,67,70,87,99,70,70,64,70,72,102,89,70,70,71,70,70,74,70,70,77,78,79,70,81,70,83,70,85,140,141,88,70,144,70,92,93,94,64,70,97,98,72,100,70,72,103,104,74,72,72,77,78,79,111,81,75,83,75,85,89,86,88,79,101,118,92,93,94,87,95,97,98,87,100,87,87,103,104,118,105,106,95,140,141,111,95,115,64,114,115,116,117,135,70,115,120,132,74,120,140,77,78,79,119,81,139,83,140,85,120,-1,88,120,140,141,92,93,94,64,121,97,98,121,100,70,122,103,104,74,135,135,77,78,79,111,81,139,83,139,85,135,135,88,135,135,135,92,93,94,142,95,97,98,140,100,140,140,103,104,140,105,106,140,140,141,111,140,140,64,114,115,116,117,140,70,140,140,140,74,140,140,77,78,79,140,81,140,83,140,85,41,42,88,140,140,141,92,93,94,140,140,97,98,140,100,140,140,103,104,60,140,142,141,141,141,111,141,68,69,141,141,72,141,141,141,76,12,13,14,15,16,17,18,19,20,21,22,23,141,143,142,95,96,142,140,141,143,101,95,96,142,105,106,142,101,142,142,142,105,106,114,115,116,117,50,51,142,114,115,116,117,142,123,142,125,126,127,128,129,130,131,142,136,142,144,143,137,138,142,136,95,96,143,143,145,142,101,143,143,143,105,106,143,143,143,143,143,143,143,114,115,116,117,35,36,37,38,39,40,41,42,43,95,143,143,143,95,143,143,143,143,136,105,106,120,143,105,106,144,95,143,114,115,116,117,114,115,116,117,105,106,143,143,143,143,95,143,-1,114,115,116,117,143,143,143,105,106,143,95,142,80,146,95,142,114,115,116,117,105,106,144,144,105,106,144,95,142,114,115,116,117,114,115,116,117,105,106,82,144,144,144,144,142,84,114,115,116,117,144,70,95,72,144,144,95,142,144,146,144,142,105,106,146,144,105,106,8,9,10,114,115,116,117,114,115,116,117,144,144,144,144,144,24,104,26,27,28,29,144,144,144,144,144,144,144,144,144,144,144,-1,144,144,144,-1,-1,-1,146,146,146,146,146,146,146,146,-1,136,147,-1,139,-1,-1,-1,143,-1,145],r.Parser.prototype.yybase=[0,574,581,623,655,2,718,402,747,659,672,688,743,701,705,483,483,483,483,483,351,356,366,366,367,366,344,-2,-2,-2,200,200,231,231,231,231,231,231,231,231,200,231,451,482,532,316,370,115,146,285,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,401,44,474,429,476,481,487,488,739,740,741,734,733,416,736,539,541,342,542,543,552,557,559,536,567,737,755,569,735,738,123,123,123,123,123,123,123,123,123,122,11,336,336,336,336,336,336,336,336,336,336,336,336,336,336,336,227,227,173,577,577,577,577,577,577,577,577,577,577,577,79,178,846,8,-3,-3,-3,-3,642,706,706,706,706,157,179,242,431,431,360,431,525,368,767,767,767,767,767,767,767,767,767,767,767,767,350,375,315,315,652,652,-81,-81,-81,-81,251,185,188,184,-62,348,195,195,195,408,392,410,1,192,129,129,129,-24,-24,-24,-24,499,-24,-24,-24,113,108,108,12,161,349,526,271,398,529,438,130,206,265,427,76,414,427,288,295,76,166,44,262,422,141,491,372,494,413,71,92,93,267,135,100,34,415,745,746,742,-38,420,-10,135,147,744,498,107,26,493,144,377,363,369,332,363,400,377,588,377,376,377,360,37,582,376,377,374,376,388,363,364,412,369,377,441,443,390,106,332,377,390,377,400,64,590,591,323,592,589,593,649,608,362,500,399,407,620,625,636,365,354,614,524,425,359,355,423,570,578,357,406,414,394,352,403,531,433,403,653,434,385,417,411,444,310,318,501,425,668,757,380,637,684,403,609,387,87,325,638,382,403,639,403,696,503,615,403,697,384,435,425,352,352,352,700,66,699,583,702,707,704,748,721,749,584,750,358,583,722,751,682,215,613,422,436,389,447,221,257,752,403,403,506,499,403,395,685,397,426,753,392,391,647,683,403,418,754,221,723,587,724,450,568,507,648,509,327,725,353,497,610,454,622,455,461,404,510,373,732,612,247,361,664,463,405,692,641,464,465,511,343,437,335,409,396,665,293,467,468,472,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,0,0,0,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,0,0,0,0,0,0,0,0,0,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,123,767,767,767,767,767,767,767,767,767,767,767,123,123,123,123,123,123,123,123,0,129,129,129,129,-94,-94,-94,767,767,767,767,767,767,0,0,0,0,0,0,0,0,0,0,0,0,-94,-94,129,129,767,767,-24,-24,-24,-24,-24,108,108,108,-24,108,145,145,145,108,108,108,100,100,0,0,0,0,0,0,0,145,0,0,0,376,0,0,0,145,260,260,221,260,260,135,0,0,425,376,0,364,376,0,0,0,0,0,0,531,0,87,637,241,425,0,0,0,0,0,0,0,425,289,289,306,0,358,0,0,0,306,241,0,0,221],r.Parser.prototype.yydefault=[3,32767,32767,1,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,104,96,110,95,106,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,358,358,122,122,122,122,122,122,122,122,316,32767,32767,32767,32767,32767,32767,32767,32767,32767,173,173,173,32767,348,348,348,348,348,348,348,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,363,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,232,233,235,236,172,125,349,362,171,199,201,250,200,177,182,183,184,185,186,187,188,189,190,191,192,176,229,228,197,313,313,316,32767,32767,32767,32767,32767,32767,32767,32767,198,202,204,203,219,220,217,218,175,221,222,223,224,157,157,157,357,357,32767,357,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,158,32767,211,212,276,276,117,117,117,117,117,32767,32767,32767,32767,284,32767,32767,32767,32767,32767,286,32767,32767,206,207,205,32767,32767,32767,32767,32767,32767,32767,32767,32767,285,32767,32767,32767,32767,32767,32767,32767,32767,334,321,272,32767,32767,32767,265,32767,107,109,32767,32767,32767,32767,302,339,32767,32767,32767,17,32767,32767,32767,370,334,32767,32767,19,32767,32767,32767,32767,227,32767,338,332,32767,32767,32767,32767,32767,32767,63,32767,32767,32767,32767,32767,63,281,63,32767,63,32767,315,287,32767,63,74,32767,72,32767,32767,76,32767,63,93,93,254,315,54,63,254,63,32767,32767,32767,32767,4,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,267,32767,323,32767,337,336,324,32767,265,32767,215,194,266,32767,196,32767,32767,270,273,32767,32767,32767,134,32767,268,180,32767,32767,32767,32767,365,32767,32767,174,32767,32767,32767,130,32767,61,332,32767,32767,355,32767,32767,332,269,208,209,210,32767,121,32767,310,32767,32767,32767,32767,32767,32767,327,32767,333,32767,32767,32767,32767,111,32767,302,32767,32767,32767,75,32767,32767,178,126,32767,32767,364,32767,32767,32767,320,32767,32767,32767,32767,32767,62,32767,32767,77,32767,32767,32767,32767,332,32767,32767,32767,115,32767,169,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,32767,332,32767,32767,32767,32767,32767,32767,32767,4,32767,151,32767,32767,32767,32767,32767,32767,32767,25,25,3,137,3,137,25,101,25,25,137,93,93,25,25,25,144,25,25,25,25,25,25,25,25],r.Parser.prototype.yygoto=[141,141,173,173,173,173,173,173,173,173,141,173,142,143,144,148,153,155,181,175,172,172,172,172,174,174,174,174,174,174,174,168,169,170,171,179,757,758,392,760,781,782,783,784,785,786,787,789,725,145,146,147,149,150,151,152,154,177,178,180,196,208,209,210,211,212,213,214,215,217,218,219,220,244,245,266,267,268,430,431,432,182,183,184,185,186,187,188,189,190,191,192,156,157,158,159,176,160,194,161,162,163,164,195,165,193,139,166,167,452,452,452,452,452,452,452,452,452,452,452,453,453,453,453,453,453,453,453,453,453,453,551,551,551,464,491,394,394,394,394,394,394,394,394,394,394,394,394,394,394,394,394,394,394,407,552,552,552,810,810,662,662,662,662,662,594,283,595,510,399,399,567,679,632,849,850,863,660,714,426,222,622,622,622,622,223,617,623,494,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,395,465,472,514,904,398,398,425,425,459,425,419,322,421,421,393,396,412,422,428,460,463,473,481,501,5,476,284,327,1,15,2,6,7,550,550,550,8,9,10,668,16,11,17,12,18,13,19,14,704,328,881,881,643,628,626,626,624,626,526,401,652,647,847,847,847,847,847,847,847,847,847,847,847,437,438,441,447,477,479,497,290,910,910,400,400,486,880,880,263,913,910,303,255,723,306,822,821,306,896,896,896,861,304,323,410,913,913,897,316,420,769,658,559,879,671,536,324,466,565,311,311,311,801,241,676,496,439,440,442,444,448,475,631,858,311,285,286,603,495,712,0,406,321,0,0,0,314,0,0,429,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,411],r.Parser.prototype.yygcheck=[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,35,35,35,35,35,35,35,35,35,35,35,86,86,86,86,86,86,86,86,86,86,86,6,6,6,21,21,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,35,71,7,7,7,35,35,35,35,35,35,35,29,44,29,35,86,86,12,12,12,12,12,12,12,12,75,40,35,35,35,35,40,35,35,35,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,82,36,36,36,104,82,82,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,13,42,42,42,2,13,2,13,13,5,5,5,13,13,13,54,13,13,13,13,13,13,13,13,67,67,83,83,5,5,5,5,5,5,5,5,5,5,93,93,93,93,93,93,93,93,93,93,93,52,52,52,52,52,52,52,4,105,105,89,89,94,84,84,92,105,105,26,92,71,4,91,91,4,84,84,84,97,30,70,30,105,105,102,27,30,72,50,10,84,55,46,9,30,11,90,90,90,80,30,56,30,85,85,85,85,85,85,43,96,90,44,44,34,77,69,-1,4,90,-1,-1,-1,4,-1,-1,4,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,71],r.Parser.prototype.yygbase=[0,0,-286,0,10,239,130,154,0,-10,25,-23,-29,-289,0,-30,0,0,0,0,0,83,0,0,0,0,245,84,-11,142,-28,0,0,0,-13,-88,-42,0,0,0,-344,0,-38,-12,-188,0,23,0,0,0,66,0,247,0,205,24,-18,0,0,0,0,0,0,0,0,0,0,13,0,-15,85,74,70,0,0,148,0,-14,0,0,-6,0,-35,11,47,278,-77,0,0,44,68,43,38,72,94,0,-16,109,0,0,0,0,87,0,170,34,0],r.Parser.prototype.yygdefault=[-32768,362,3,546,382,570,571,572,307,305,560,566,467,4,568,140,295,575,296,500,577,414,579,580,308,309,415,315,216,593,503,313,596,357,602,301,449,383,350,461,221,423,456,630,282,638,540,646,649,450,657,352,433,434,667,672,677,680,334,325,474,684,685,256,689,511,512,703,242,711,317,724,342,788,790,397,408,484,797,326,800,384,385,386,387,435,818,815,289,866,287,443,254,853,468,356,903,862,288,388,389,302,898,341,905,912,458],r.Parser.prototype.yylhs=[0,1,2,2,4,4,3,3,3,3,3,3,3,3,3,8,8,10,10,10,10,9,9,11,13,13,14,14,14,14,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,33,33,34,27,27,30,30,6,7,7,7,37,37,37,38,38,41,41,39,39,42,42,22,22,29,29,32,32,31,31,43,23,23,23,23,44,44,45,45,46,46,20,20,16,16,47,18,18,48,17,17,19,19,36,36,49,49,50,50,51,51,51,51,52,52,53,53,54,54,24,24,55,55,55,25,25,56,56,40,40,57,57,57,57,62,62,63,63,64,64,64,64,65,66,66,61,61,58,58,60,60,68,68,67,67,67,67,67,67,59,59,69,69,26,26,21,21,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,71,77,77,79,79,80,81,81,81,81,81,81,86,86,35,35,35,72,72,87,87,82,82,88,88,88,88,88,73,73,73,76,76,76,78,78,93,93,93,93,93,93,93,93,93,93,93,93,93,93,12,12,12,12,12,12,74,74,74,74,94,94,96,96,95,95,97,97,28,28,28,28,99,99,98,98,98,98,98,100,100,84,84,89,89,83,83,101,101,101,101,90,90,90,90,85,85,91,91,91,70,70,102,102,102,75,75,103,103,104,104,104,104,92,92,92,92,105,105,105,105,105,105,105,106,106,106],r.Parser.prototype.yylen=[1,1,2,0,1,3,1,1,1,1,3,5,4,3,3,3,1,1,3,2,4,3,1,3,2,0,1,1,1,1,3,7,10,5,7,9,5,2,3,2,3,2,3,3,3,3,1,2,5,7,8,10,5,1,5,3,3,2,1,2,8,1,3,0,1,9,7,6,5,1,2,2,0,2,0,2,0,2,1,3,1,4,1,4,1,4,1,3,3,3,4,4,5,0,2,4,3,1,1,1,4,0,2,5,0,2,6,0,2,0,3,1,0,1,3,3,5,0,1,1,1,1,0,1,3,1,2,3,1,1,2,4,3,1,1,3,2,0,3,3,8,3,1,3,0,2,4,5,4,4,3,1,1,1,3,1,1,0,1,1,2,1,1,1,1,1,1,1,3,1,3,3,1,0,1,1,6,3,4,4,1,2,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,5,4,4,4,2,2,4,2,2,2,2,2,2,2,2,2,2,2,1,4,3,3,2,9,10,3,0,4,1,3,2,4,6,8,4,4,4,1,1,1,2,3,1,1,1,1,1,1,0,3,3,4,4,0,2,3,0,1,1,0,3,1,1,1,1,1,1,1,1,1,1,1,3,2,1,1,3,2,2,4,3,1,3,3,3,0,2,0,1,3,1,3,1,1,1,1,1,6,4,3,6,4,4,4,1,3,1,2,1,1,4,1,3,6,4,4,4,4,1,4,0,1,1,3,1,3,1,1,4,0,0,2,3,1,3,1,4,2,2,2,1,2,1,4,3,3,3,6,3,1,1,1],r.Parser.prototype.yyn0=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn1=function(e){this.yyval=this.Stmt_Namespace_postprocess(this.yyastk[this.stackPos-0])},r.Parser.prototype.yyn2=function(e){Array.isArray(this.yyastk[this.stackPos-0])?this.yyval=this.yyastk[this.stackPos-1].concat(this.yyastk[this.stackPos-0]):(this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1])},r.Parser.prototype.yyn3=function(e){this.yyval=[]},r.Parser.prototype.yyn4=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn5=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn6=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn7=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn8=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn9=function(e){this.yyval=this.Node_Stmt_HaltCompiler(e)},r.Parser.prototype.yyn10=function(e){this.yyval=this.Node_Stmt_Namespace(this.Node_Name(this.yyastk[this.stackPos-1],e),null,e)},r.Parser.prototype.yyn11=function(e){this.yyval=this.Node_Stmt_Namespace(this.Node_Name(this.yyastk[this.stackPos-3],e),this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn12=function(e){this.yyval=this.Node_Stmt_Namespace(null,this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn13=function(e){this.yyval=this.Node_Stmt_Use(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn14=function(e){this.yyval=this.Node_Stmt_Const(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn15=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn16=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn17=function(e){this.yyval=this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[this.stackPos-0],e),null,e)},r.Parser.prototype.yyn18=function(e){this.yyval=this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[this.stackPos-2],e),this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn19=function(e){this.yyval=this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[this.stackPos-0],e),null,e)},r.Parser.prototype.yyn20=function(e){this.yyval=this.Node_Stmt_UseUse(this.Node_Name(this.yyastk[this.stackPos-2],e),this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn21=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn22=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn23=function(e){this.yyval=this.Node_Const(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn24=function(e){Array.isArray(this.yyastk[this.stackPos-0])?this.yyval=this.yyastk[this.stackPos-1].concat(this.yyastk[this.stackPos-0]):(this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1])},r.Parser.prototype.yyn25=function(e){this.yyval=[]},r.Parser.prototype.yyn26=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn27=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn28=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn29=function(e){throw new Error(\"__halt_compiler() can only be used from the outermost scope\")},r.Parser.prototype.yyn30=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn31=function(e){this.yyval=this.Node_Stmt_If(this.yyastk[this.stackPos-4],{stmts:Array.isArray(this.yyastk[this.stackPos-2])?this.yyastk[this.stackPos-2]:[this.yyastk[this.stackPos-2]],elseifs:this.yyastk[this.stackPos-1],Else:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn32=function(e){this.yyval=this.Node_Stmt_If(this.yyastk[this.stackPos-7],{stmts:this.yyastk[this.stackPos-4],elseifs:this.yyastk[this.stackPos-3],\"else\":this.yyastk[this.stackPos-2]},e)},r.Parser.prototype.yyn33=function(e){this.yyval=this.Node_Stmt_While(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn34=function(e){this.yyval=this.Node_Stmt_Do(this.yyastk[this.stackPos-2],Array.isArray(this.yyastk[this.stackPos-5])?this.yyastk[this.stackPos-5]:[this.yyastk[this.stackPos-5]],e)},r.Parser.prototype.yyn35=function(e){this.yyval=this.Node_Stmt_For({init:this.yyastk[this.stackPos-6],cond:this.yyastk[this.stackPos-4],loop:this.yyastk[this.stackPos-2],stmts:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn36=function(e){this.yyval=this.Node_Stmt_Switch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn37=function(e){this.yyval=this.Node_Stmt_Break(null,e)},r.Parser.prototype.yyn38=function(e){this.yyval=this.Node_Stmt_Break(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn39=function(e){this.yyval=this.Node_Stmt_Continue(null,e)},r.Parser.prototype.yyn40=function(e){this.yyval=this.Node_Stmt_Continue(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn41=function(e){this.yyval=this.Node_Stmt_Return(null,e)},r.Parser.prototype.yyn42=function(e){this.yyval=this.Node_Stmt_Return(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn43=function(e){this.yyval=this.Node_Stmt_Global(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn44=function(e){this.yyval=this.Node_Stmt_Static(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn45=function(e){this.yyval=this.Node_Stmt_Echo(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn46=function(e){this.yyval=this.Node_Stmt_InlineHTML(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn47=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn48=function(e){this.yyval=this.Node_Stmt_Unset(this.yyastk[this.stackPos-2],e)},r.Parser.prototype.yyn49=function(e){this.yyval=this.Node_Stmt_Foreach(this.yyastk[this.stackPos-4],this.yyastk[this.stackPos-2],{keyVar:null,byRef:!1,stmts:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn50=function(e){this.yyval=this.Node_Stmt_Foreach(this.yyastk[this.stackPos-5],this.yyastk[this.stackPos-2],{keyVar:null,byRef:!0,stmts:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn51=function(e){this.yyval=this.Node_Stmt_Foreach(this.yyastk[this.stackPos-7],this.yyastk[this.stackPos-2],{keyVar:this.yyastk[this.stackPos-5],byRef:this.yyastk[this.stackPos-3],stmts:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn52=function(e){this.yyval=this.Node_Stmt_Declare(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn53=function(e){this.yyval=[]},r.Parser.prototype.yyn54=function(e){this.yyval=this.Node_Stmt_TryCatch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn55=function(e){this.yyval=this.Node_Stmt_Throw(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn56=function(e){this.yyval=this.Node_Stmt_Goto(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn57=function(e){this.yyval=this.Node_Stmt_Label(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn58=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn59=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn60=function(e){this.yyval=this.Node_Stmt_Catch(this.yyastk[this.stackPos-5],this.yyastk[this.stackPos-4].substring(1),this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn61=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn62=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn63=function(e){this.yyval=!1},r.Parser.prototype.yyn64=function(e){this.yyval=!0},r.Parser.prototype.yyn65=function(e){this.yyval=this.Node_Stmt_Function(this.yyastk[this.stackPos-6],{byRef:this.yyastk[this.stackPos-7],params:this.yyastk[this.stackPos-4],stmts:this.yyastk[this.stackPos-1]},e)},r.Parser.prototype.yyn66=function(e){this.yyval=this.Node_Stmt_Class(this.yyastk[this.stackPos-5],{type:this.yyastk[this.stackPos-6],Extends:this.yyastk[this.stackPos-4],Implements:this.yyastk[this.stackPos-3],stmts:this.yyastk[this.stackPos-1]},e)},r.Parser.prototype.yyn67=function(e){this.yyval=this.Node_Stmt_Interface(this.yyastk[this.stackPos-4],{Extends:this.yyastk[this.stackPos-3],stmts:this.yyastk[this.stackPos-1]},e)},r.Parser.prototype.yyn68=function(e){this.yyval=this.Node_Stmt_Trait(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn69=function(e){this.yyval=0},r.Parser.prototype.yyn70=function(e){this.yyval=this.MODIFIER_ABSTRACT},r.Parser.prototype.yyn71=function(e){this.yyval=this.MODIFIER_FINAL},r.Parser.prototype.yyn72=function(e){this.yyval=null},r.Parser.prototype.yyn73=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn74=function(e){this.yyval=[]},r.Parser.prototype.yyn75=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn76=function(e){this.yyval=[]},r.Parser.prototype.yyn77=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn78=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn79=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn80=function(e){this.yyval=Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn81=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn82=function(e){this.yyval=Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn83=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn84=function(e){this.yyval=Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn85=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn86=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn87=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn88=function(e){this.yyval=this.Node_Stmt_DeclareDeclare(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn89=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn90=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn91=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn92=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn93=function(e){this.yyval=[]},r.Parser.prototype.yyn94=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn95=function(e){this.yyval=this.Node_Stmt_Case(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn96=function(e){this.yyval=this.Node_Stmt_Case(null,this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn97=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn98=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn99=function(e){this.yyval=Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn100=function(e){this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn101=function(e){this.yyval=[]},r.Parser.prototype.yyn102=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn103=function(e){this.yyval=this.Node_Stmt_ElseIf(this.yyastk[this.stackPos-2],Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]],e)},r.Parser.prototype.yyn104=function(e){this.yyval=[]},r.Parser.prototype.yyn105=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn106=function(e){this.yyval=this.Node_Stmt_ElseIf(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn107=function(e){this.yyval=null},r.Parser.prototype.yyn108=function(e){this.yyval=this.Node_Stmt_Else(Array.isArray(this.yyastk[this.stackPos-0])?this.yyastk[this.stackPos-0]:[this.yyastk[this.stackPos-0]],e)},r.Parser.prototype.yyn109=function(e){this.yyval=null},r.Parser.prototype.yyn110=function(e){this.yyval=this.Node_Stmt_Else(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn111=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn112=function(e){this.yyval=[]},r.Parser.prototype.yyn113=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn114=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn115=function(e){this.yyval=this.Node_Param(this.yyastk[this.stackPos-0].substring(1),null,this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn116=function(e){this.yyval=this.Node_Param(this.yyastk[this.stackPos-2].substring(1),this.yyastk[this.stackPos-0],this.yyastk[this.stackPos-4],this.yyastk[this.stackPos-3],e)},r.Parser.prototype.yyn117=function(e){this.yyval=null},r.Parser.prototype.yyn118=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn119=function(e){this.yyval=\"array\"},r.Parser.prototype.yyn120=function(e){this.yyval=\"callable\"},r.Parser.prototype.yyn121=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn122=function(e){this.yyval=[]},r.Parser.prototype.yyn123=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn124=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn125=function(e){this.yyval=this.Node_Arg(this.yyastk[this.stackPos-0],!1,e)},r.Parser.prototype.yyn126=function(e){this.yyval=this.Node_Arg(this.yyastk[this.stackPos-0],!0,e)},r.Parser.prototype.yyn127=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn128=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn129=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0].substring(1),e)},r.Parser.prototype.yyn130=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn131=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn132=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn133=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn134=function(e){this.yyval=this.Node_Stmt_StaticVar(this.yyastk[this.stackPos-0].substring(1),null,e)},r.Parser.prototype.yyn135=function(e){this.yyval=this.Node_Stmt_StaticVar(this.yyastk[this.stackPos-2].substring(1),this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn136=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn137=function(e){this.yyval=[]},r.Parser.prototype.yyn138=function(e){this.yyval=this.Node_Stmt_Property(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn139=function(e){this.yyval=this.Node_Stmt_ClassConst(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn140=function(e){this.yyval=this.Node_Stmt_ClassMethod(this.yyastk[this.stackPos-4],{type:this.yyastk[this.stackPos-7],byRef:this.yyastk[this.stackPos-5],params:this.yyastk[this.stackPos-2],stmts:this.yyastk[this.stackPos-0]},e)},r.Parser.prototype.yyn141=function(e){this.yyval=this.Node_Stmt_TraitUse(this.yyastk[this.stackPos-1],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn142=function(e){this.yyval=[]},r.Parser.prototype.yyn143=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn144=function(e){this.yyval=[]},r.Parser.prototype.yyn145=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn146=function(e){this.yyval=this.Node_Stmt_TraitUseAdaptation_Precedence(this.yyastk[this.stackPos-3][0],this.yyastk[this.stackPos-3][1],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn147=function(e){this.yyval=this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[this.stackPos-4][0],this.yyastk[this.stackPos-4][1],this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn148=function(e){this.yyval=this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[this.stackPos-3][0],this.yyastk[this.stackPos-3][1],this.yyastk[this.stackPos-1],null,e)},r.Parser.prototype.yyn149=function(e){this.yyval=this.Node_Stmt_TraitUseAdaptation_Alias(this.yyastk[this.stackPos-3][0],this.yyastk[this.stackPos-3][1],null,this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn150=function(e){this.yyval=array(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0])},r.Parser.prototype.yyn151=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn152=function(e){this.yyval=array(null,this.yyastk[this.stackPos-0])},r.Parser.prototype.yyn153=function(e){this.yyval=null},r.Parser.prototype.yyn154=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn155=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn156=function(e){this.yyval=this.MODIFIER_PUBLIC},r.Parser.prototype.yyn157=function(e){this.yyval=this.MODIFIER_PUBLIC},r.Parser.prototype.yyn158=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn159=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn160=function(e){this.Stmt_Class_verifyModifier(this.yyastk[this.stackPos-1],this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]|this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn161=function(e){this.yyval=this.MODIFIER_PUBLIC},r.Parser.prototype.yyn162=function(e){this.yyval=this.MODIFIER_PROTECTED},r.Parser.prototype.yyn163=function(e){this.yyval=this.MODIFIER_PRIVATE},r.Parser.prototype.yyn164=function(e){this.yyval=this.MODIFIER_STATIC},r.Parser.prototype.yyn165=function(e){this.yyval=this.MODIFIER_ABSTRACT},r.Parser.prototype.yyn166=function(e){this.yyval=this.MODIFIER_FINAL},r.Parser.prototype.yyn167=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn168=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn169=function(e){this.yyval=this.Node_Stmt_PropertyProperty(this.yyastk[this.stackPos-0].substring(1),null,e)},r.Parser.prototype.yyn170=function(e){this.yyval=this.Node_Stmt_PropertyProperty(this.yyastk[this.stackPos-2].substring(1),this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn171=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn172=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn173=function(e){this.yyval=[]},r.Parser.prototype.yyn174=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn175=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn176=function(e){this.yyval=this.Node_Expr_AssignList(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn177=function(e){this.yyval=this.Node_Expr_Assign(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn178=function(e){this.yyval=this.Node_Expr_AssignRef(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn179=function(e){this.yyval=this.Node_Expr_AssignRef(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn180=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn181=function(e){this.yyval=this.Node_Expr_Clone(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn182=function(e){this.yyval=this.Node_Expr_AssignPlus(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn183=function(e){this.yyval=this.Node_Expr_AssignMinus(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn184=function(e){this.yyval=this.Node_Expr_AssignMul(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn185=function(e){this.yyval=this.Node_Expr_AssignDiv(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn186=function(e){this.yyval=this.Node_Expr_AssignConcat(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn187=function(e){this.yyval=this.Node_Expr_AssignMod(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn188=function(e){this.yyval=this.Node_Expr_AssignBitwiseAnd(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn189=function(e){this.yyval=this.Node_Expr_AssignBitwiseOr(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn190=function(e){this.yyval=this.Node_Expr_AssignBitwiseXor(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn191=function(e){this.yyval=this.Node_Expr_AssignShiftLeft(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn192=function(e){this.yyval=this.Node_Expr_AssignShiftRight(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn193=function(e){this.yyval=this.Node_Expr_PostInc(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn194=function(e){this.yyval=this.Node_Expr_PreInc(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn195=function(e){this.yyval=this.Node_Expr_PostDec(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn196=function(e){this.yyval=this.Node_Expr_PreDec(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn197=function(e){this.yyval=this.Node_Expr_BooleanOr(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn198=function(e){this.yyval=this.Node_Expr_BooleanAnd(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn199=function(e){this.yyval=this.Node_Expr_LogicalOr(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn200=function(e){this.yyval=this.Node_Expr_LogicalAnd(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn201=function(e){this.yyval=this.Node_Expr_LogicalXor(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn202=function(e){this.yyval=this.Node_Expr_BitwiseOr(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn203=function(e){this.yyval=this.Node_Expr_BitwiseAnd(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn204=function(e){this.yyval=this.Node_Expr_BitwiseXor(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn205=function(e){this.yyval=this.Node_Expr_Concat(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn206=function(e){this.yyval=this.Node_Expr_Plus(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn207=function(e){this.yyval=this.Node_Expr_Minus(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn208=function(e){this.yyval=this.Node_Expr_Mul(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn209=function(e){this.yyval=this.Node_Expr_Div(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn210=function(e){this.yyval=this.Node_Expr_Mod(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn211=function(e){this.yyval=this.Node_Expr_ShiftLeft(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn212=function(e){this.yyval=this.Node_Expr_ShiftRight(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn213=function(e){this.yyval=this.Node_Expr_UnaryPlus(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn214=function(e){this.yyval=this.Node_Expr_UnaryMinus(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn215=function(e){this.yyval=this.Node_Expr_BooleanNot(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn216=function(e){this.yyval=this.Node_Expr_BitwiseNot(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn217=function(e){this.yyval=this.Node_Expr_Identical(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn218=function(e){this.yyval=this.Node_Expr_NotIdentical(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn219=function(e){this.yyval=this.Node_Expr_Equal(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn220=function(e){this.yyval=this.Node_Expr_NotEqual(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn221=function(e){this.yyval=this.Node_Expr_Smaller(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn222=function(e){this.yyval=this.Node_Expr_SmallerOrEqual(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn223=function(e){this.yyval=this.Node_Expr_Greater(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn224=function(e){this.yyval=this.Node_Expr_GreaterOrEqual(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn225=function(e){this.yyval=this.Node_Expr_Instanceof(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn226=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn227=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn228=function(e){this.yyval=this.Node_Expr_Ternary(this.yyastk[this.stackPos-4],this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn229=function(e){this.yyval=this.Node_Expr_Ternary(this.yyastk[this.stackPos-3],null,this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn230=function(e){this.yyval=this.Node_Expr_Isset(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn231=function(e){this.yyval=this.Node_Expr_Empty(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn232=function(e){this.yyval=this.Node_Expr_Include(this.yyastk[this.stackPos-0],\"Node_Expr_Include\",e)},r.Parser.prototype.yyn233=function(e){this.yyval=this.Node_Expr_Include(this.yyastk[this.stackPos-0],\"Node_Expr_IncludeOnce\",e)},r.Parser.prototype.yyn234=function(e){this.yyval=this.Node_Expr_Eval(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn235=function(e){this.yyval=this.Node_Expr_Include(this.yyastk[this.stackPos-0],\"Node_Expr_Require\",e)},r.Parser.prototype.yyn236=function(e){this.yyval=this.Node_Expr_Include(this.yyastk[this.stackPos-0],\"Node_Expr_RequireOnce\",e)},r.Parser.prototype.yyn237=function(e){this.yyval=this.Node_Expr_Cast_Int(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn238=function(e){this.yyval=this.Node_Expr_Cast_Double(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn239=function(e){this.yyval=this.Node_Expr_Cast_String(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn240=function(e){this.yyval=this.Node_Expr_Cast_Array(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn241=function(e){this.yyval=this.Node_Expr_Cast_Object(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn242=function(e){this.yyval=this.Node_Expr_Cast_Bool(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn243=function(e){this.yyval=this.Node_Expr_Cast_Unset(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn244=function(e){this.yyval=this.Node_Expr_Exit(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn245=function(e){this.yyval=this.Node_Expr_ErrorSuppress(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn246=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn247=function(e){this.yyval=this.Node_Expr_Array(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn248=function(e){this.yyval=this.Node_Expr_Array(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn249=function(e){this.yyval=this.Node_Expr_ShellExec(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn250=function(e){this.yyval=this.Node_Expr_Print(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn251=function(e){this.yyval=this.Node_Expr_Closure({\"static\":!1,byRef:this.yyastk[this.stackPos-7],params:this.yyastk[this.stackPos-5],uses:this.yyastk[this.stackPos-3],stmts:this.yyastk[this.stackPos-1]},e)},r.Parser.prototype.yyn252=function(e){this.yyval=this.Node_Expr_Closure({\"static\":!0,byRef:this.yyastk[this.stackPos-7],params:this.yyastk[this.stackPos-5],uses:this.yyastk[this.stackPos-3],stmts:this.yyastk[this.stackPos-1]},e)},r.Parser.prototype.yyn253=function(e){this.yyval=this.Node_Expr_New(this.yyastk[this.stackPos-1],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn254=function(e){this.yyval=[]},r.Parser.prototype.yyn255=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn256=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn257=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn258=function(e){this.yyval=this.Node_Expr_ClosureUse(this.yyastk[this.stackPos-0].substring(1),this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn259=function(e){this.yyval=this.Node_Expr_FuncCall(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn260=function(e){this.yyval=this.Node_Expr_StaticCall(this.yyastk[this.stackPos-5],this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn261=function(e){this.yyval=this.Node_Expr_StaticCall(this.yyastk[this.stackPos-7],this.yyastk[this.stackPos-4],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn262=function(e){if(this.yyastk[this.stackPos-3].type===\"Node_Expr_StaticPropertyFetch\")this.yyval=this.Node_Expr_StaticCall(this.yyastk[this.stackPos-3].Class,this.Node_Expr_Variable(this.yyastk[this.stackPos-3].name,e),this.yyastk[this.stackPos-1],e);else{if(this.yyastk[this.stackPos-3].type!==\"Node_Expr_ArrayDimFetch\")throw new Exception;var t=this.yyastk[this.stackPos-3];while(t.variable.type===\"Node_Expr_ArrayDimFetch\")t=t.variable;this.yyval=this.Node_Expr_StaticCall(t.variable.Class,this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e),t.variable=this.Node_Expr_Variable(t.variable.name,e)}},r.Parser.prototype.yyn263=function(e){this.yyval=this.Node_Expr_FuncCall(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn264=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn265=function(e){this.yyval=this.Node_Name(\"static\",e)},r.Parser.prototype.yyn266=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn267=function(e){this.yyval=this.Node_Name(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn268=function(e){this.yyval=this.Node_Name_FullyQualified(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn269=function(e){this.yyval=this.Node_Name_Relative(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn270=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn271=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn272=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn273=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn274=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn275=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn276=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn277=function(e){this.yyval=this.Node_Expr_PropertyFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn278=function(e){this.yyval=this.Node_Expr_PropertyFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn279=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn280=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn281=function(e){this.yyval=null},r.Parser.prototype.yyn282=function(e){this.yyval=null},r.Parser.prototype.yyn283=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn284=function(e){this.yyval=[]},r.Parser.prototype.yyn285=function(e){this.yyval=[this.Scalar_String_parseEscapeSequences(this.yyastk[this.stackPos-0],\"`\")]},r.Parser.prototype.yyn286=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn287=function(e){this.yyval=[]},r.Parser.prototype.yyn288=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn289=function(e){this.yyval=this.Node_Scalar_LNumber(this.Scalar_LNumber_parse(this.yyastk[this.stackPos-0]),e)},r.Parser.prototype.yyn290=function(e){this.yyval=this.Node_Scalar_DNumber(this.Scalar_DNumber_parse(this.yyastk[this.stackPos-0]),e)},r.Parser.prototype.yyn291=function(e){this.yyval=this.Scalar_String_create(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn292=function(e){this.yyval={type:\"Node_Scalar_LineConst\",attributes:e}},r.Parser.prototype.yyn293=function(e){this.yyval={type:\"Node_Scalar_FileConst\",attributes:e}},r.Parser.prototype.yyn294=function(e){this.yyval={type:\"Node_Scalar_DirConst\",attributes:e}},r.Parser.prototype.yyn295=function(e){this.yyval={type:\"Node_Scalar_ClassConst\",attributes:e}},r.Parser.prototype.yyn296=function(e){this.yyval={type:\"Node_Scalar_TraitConst\",attributes:e}},r.Parser.prototype.yyn297=function(e){this.yyval={type:\"Node_Scalar_MethodConst\",attributes:e}},r.Parser.prototype.yyn298=function(e){this.yyval={type:\"Node_Scalar_FuncConst\",attributes:e}},r.Parser.prototype.yyn299=function(e){this.yyval={type:\"Node_Scalar_NSConst\",attributes:e}},r.Parser.prototype.yyn300=function(e){this.yyval=this.Node_Scalar_String(this.Scalar_String_parseDocString(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-1]),e)},r.Parser.prototype.yyn301=function(e){this.yyval=this.Node_Scalar_String(\"\",e)},r.Parser.prototype.yyn302=function(e){this.yyval=this.Node_Expr_ConstFetch(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn303=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn304=function(e){this.yyval=this.Node_Expr_ClassConstFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn305=function(e){this.yyval=this.Node_Expr_UnaryPlus(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn306=function(e){this.yyval=this.Node_Expr_UnaryMinus(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn307=function(e){this.yyval=this.Node_Expr_Array(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn308=function(e){this.yyval=this.Node_Expr_Array(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn309=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn310=function(e){this.yyval=this.Node_Expr_ClassConstFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn311=function(e){this.yyval=this.Node_Scalar_Encapsed(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn312=function(e){this.yyval=this.Node_Scalar_Encapsed(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn313=function(e){this.yyval=[]},r.Parser.prototype.yyn314=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn315=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn316=function(){this.yyval=this.yyastk[this.stackPos]},r.Parser.prototype.yyn317=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn318=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn319=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],this.yyastk[this.stackPos-2],!1,e)},r.Parser.prototype.yyn320=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],null,!1,e)},r.Parser.prototype.yyn321=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn322=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn323=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn324=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn325=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-4],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn326=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn327=function(e){this.yyval=this.Node_Expr_PropertyFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn328=function(e){this.yyval=this.Node_Expr_MethodCall(this.yyastk[this.stackPos-5],this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn329=function(e){this.yyval=this.Node_Expr_FuncCall(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn330=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn331=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn332=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn333=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn334=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn335=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn336=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn337=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn338=function(e){this.yyval=this.Node_Expr_StaticPropertyFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn339=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn340=function(e){this.yyval=this.Node_Expr_StaticPropertyFetch(this.yyastk[this.stackPos-2],this.yyastk[this.stackPos-0].substring(1),e)},r.Parser.prototype.yyn341=function(e){this.yyval=this.Node_Expr_StaticPropertyFetch(this.yyastk[this.stackPos-5],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn342=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn343=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn344=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn345=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.yyastk[this.stackPos-3],this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn346=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0].substring(1),e)},r.Parser.prototype.yyn347=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn348=function(e){this.yyval=null},r.Parser.prototype.yyn349=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn350=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn351=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn352=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn353=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn354=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn355=function(e){this.yyval=this.yyastk[this.stackPos-0]},r.Parser.prototype.yyn356=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn357=function(e){this.yyval=null},r.Parser.prototype.yyn358=function(e){this.yyval=[]},r.Parser.prototype.yyn359=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn360=function(e){this.yyastk[this.stackPos-2].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-2]},r.Parser.prototype.yyn361=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn362=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],this.yyastk[this.stackPos-2],!1,e)},r.Parser.prototype.yyn363=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],null,!1,e)},r.Parser.prototype.yyn364=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],this.yyastk[this.stackPos-3],!0,e)},r.Parser.prototype.yyn365=function(e){this.yyval=this.Node_Expr_ArrayItem(this.yyastk[this.stackPos-0],null,!0,e)},r.Parser.prototype.yyn366=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn367=function(e){this.yyastk[this.stackPos-1].push(this.yyastk[this.stackPos-0]),this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn368=function(e){this.yyval=[this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn369=function(e){this.yyval=[this.yyastk[this.stackPos-1],this.yyastk[this.stackPos-0]]},r.Parser.prototype.yyn370=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0].substring(1),e)},r.Parser.prototype.yyn371=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.Node_Expr_Variable(this.yyastk[this.stackPos-3].substring(1),e),this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn372=function(e){this.yyval=this.Node_Expr_PropertyFetch(this.Node_Expr_Variable(this.yyastk[this.stackPos-2].substring(1),e),this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn373=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn374=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-1],e)},r.Parser.prototype.yyn375=function(e){this.yyval=this.Node_Expr_ArrayDimFetch(this.Node_Expr_Variable(this.yyastk[this.stackPos-4],e),this.yyastk[this.stackPos-2],e)},r.Parser.prototype.yyn376=function(e){this.yyval=this.yyastk[this.stackPos-1]},r.Parser.prototype.yyn377=function(e){this.yyval=this.Node_Scalar_String(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn378=function(e){this.yyval=this.Node_Scalar_String(this.yyastk[this.stackPos-0],e)},r.Parser.prototype.yyn379=function(e){this.yyval=this.Node_Expr_Variable(this.yyastk[this.stackPos-0].substring(1),e)},r.Parser.prototype.Stmt_Namespace_postprocess=function(e){return e},r.Parser.prototype.Node_Stmt_Echo=function(){return{type:\"Node_Stmt_Echo\",exprs:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_If=function(){return{type:\"Node_Stmt_If\",cond:arguments[0],stmts:arguments[1].stmts,elseifs:arguments[1].elseifs,Else:arguments[1].Else||null,attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_For=function(){return{type:\"Node_Stmt_For\",init:arguments[0].init,cond:arguments[0].cond,loop:arguments[0].loop,stmts:arguments[0].stmts,attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Function=function(){return{type:\"Node_Stmt_Function\",name:arguments[0],byRef:arguments[1].byRef,params:arguments[1].params,stmts:arguments[1].stmts,attributes:arguments[2]}},r.Parser.prototype.Stmt_Class_verifyModifier=function(){},r.Parser.prototype.Node_Stmt_Namespace=function(){return{type:\"Node_Stmt_Namespace\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Use=function(){return{type:\"Node_Stmt_Use\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_UseUse=function(){return{type:\"Node_Stmt_UseUse\",name:arguments[0],as:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_TraitUseAdaptation_Precedence=function(){return{type:\"Node_Stmt_TraitUseAdaptation_Precedence\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_TraitUseAdaptation_Alias=function(){return{type:\"Node_Stmt_TraitUseAdaptation_Alias\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Trait=function(){return{type:\"Node_Stmt_Trait\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_TraitUse=function(){return{type:\"Node_Stmt_TraitUse\",name:arguments[0],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Class=function(){return{type:\"Node_Stmt_Class\",name:arguments[0],Type:arguments[1].type,Extends:arguments[1].Extends,Implements:arguments[1].Implements,stmts:arguments[1].stmts,attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_ClassMethod=function(){return{type:\"Node_Stmt_ClassMethod\",name:arguments[0],Type:arguments[1].type,byRef:arguments[1].byRef,params:arguments[1].params,stmts:arguments[1].stmts,attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_ClassConst=function(){return{type:\"Node_Stmt_ClassConst\",consts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Interface=function(){return{type:\"Node_Stmt_Interface\",name:arguments[0],Extends:arguments[1].Extends,stmts:arguments[1].stmts,attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Throw=function(){return{type:\"Node_Stmt_Throw\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Catch=function(){return{type:\"Node_Stmt_Catch\",Type:arguments[0],variable:arguments[1],stmts:arguments[2],attributes:arguments[3]}},r.Parser.prototype.Node_Stmt_TryCatch=function(){return{type:\"Node_Stmt_TryCatch\",stmts:arguments[0],catches:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Foreach=function(){return{type:\"Node_Stmt_Foreach\",expr:arguments[0],valueVar:arguments[1],keyVar:arguments[2].keyVar,byRef:arguments[2].byRef,stmts:arguments[2].stmts,attributes:arguments[3]}},r.Parser.prototype.Node_Stmt_While=function(){return{type:\"Node_Stmt_While\",cond:arguments[0],stmts:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Do=function(){return{type:\"Node_Stmt_Do\",cond:arguments[0],stmts:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Break=function(){return{type:\"Node_Stmt_Break\",num:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Continue=function(){return{type:\"Node_Stmt_Continue\",num:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Return=function(){return{type:\"Node_Stmt_Return\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Case=function(){return{type:\"Node_Stmt_Case\",cond:arguments[0],stmts:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Switch=function(){return{type:\"Node_Stmt_Switch\",cond:arguments[0],cases:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Else=function(){return{type:\"Node_Stmt_Else\",stmts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_ElseIf=function(){return{type:\"Node_Stmt_ElseIf\",cond:arguments[0],stmts:arguments[1],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_InlineHTML=function(){return{type:\"Node_Stmt_InlineHTML\",value:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_StaticVar=function(){return{type:\"Node_Stmt_StaticVar\",name:arguments[0],def:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Static=function(){return{type:\"Node_Stmt_Static\",vars:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_Global=function(){return{type:\"Node_Stmt_Global\",vars:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Stmt_PropertyProperty=function(){return{type:\"Node_Stmt_PropertyProperty\",name:arguments[0],def:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Property=function(){return{type:\"Node_Stmt_Property\",Type:arguments[0],props:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Stmt_Unset=function(){return{type:\"Node_Stmt_Unset\",variables:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Variable=function(e){return{type:\"Node_Expr_Variable\",name:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_FuncCall=function(){return{type:\"Node_Expr_FuncCall\",func:arguments[0],args:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_MethodCall=function(){return{type:\"Node_Expr_MethodCall\",variable:arguments[0],name:arguments[1],args:arguments[2],attributes:arguments[3]}},r.Parser.prototype.Node_Expr_StaticCall=function(){return{type:\"Node_Expr_StaticCall\",Class:arguments[0],func:arguments[1],args:arguments[2],attributes:arguments[3]}},r.Parser.prototype.Node_Expr_Ternary=function(){return{type:\"Node_Expr_Ternary\",cond:arguments[0],If:arguments[1],Else:arguments[2],attributes:arguments[3]}},r.Parser.prototype.Node_Expr_AssignList=function(){return{type:\"Node_Expr_AssignList\",assignList:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Assign=function(){return{type:\"Node_Expr_Assign\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignConcat=function(){return{type:\"Node_Expr_AssignConcat\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignMinus=function(){return{type:\"Node_Expr_AssignMinus\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignPlus=function(){return{type:\"Node_Expr_AssignPlus\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignDiv=function(){return{type:\"Node_Expr_AssignDiv\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignRef=function(){return{type:\"Node_Expr_AssignRef\",variable:arguments[0],refVar:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignMul=function(){return{type:\"Node_Expr_AssignMul\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_AssignMod=function(){return{type:\"Node_Expr_AssignMod\",variable:arguments[0],expr:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Plus=function(){return{type:\"Node_Expr_Plus\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Minus=function(){return{type:\"Node_Expr_Minus\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Mul=function(){return{type:\"Node_Expr_Mul\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Div=function(){return{type:\"Node_Expr_Div\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Mod=function(){return{type:\"Node_Expr_Mod\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Greater=function(){return{type:\"Node_Expr_Greater\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Equal=function(){return{type:\"Node_Expr_Equal\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_NotEqual=function(){return{type:\"Node_Expr_NotEqual\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Identical=function(){return{type:\"Node_Expr_Identical\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_NotIdentical=function(){return{type:\"Node_Expr_NotIdentical\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_GreaterOrEqual=function(){return{type:\"Node_Expr_GreaterOrEqual\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_SmallerOrEqual=function(){return{type:\"Node_Expr_SmallerOrEqual\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Concat=function(){return{type:\"Node_Expr_Concat\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Smaller=function(){return{type:\"Node_Expr_Smaller\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_PostInc=function(){return{type:\"Node_Expr_PostInc\",variable:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_PostDec=function(){return{type:\"Node_Expr_PostDec\",variable:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_PreInc=function(){return{type:\"Node_Expr_PreInc\",variable:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_PreDec=function(){return{type:\"Node_Expr_PreDec\",variable:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Include=function(){return{expr:arguments[0],type:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_ArrayDimFetch=function(){return{type:\"Node_Expr_ArrayDimFetch\",variable:arguments[0],dim:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_StaticPropertyFetch=function(){return{type:\"Node_Expr_StaticPropertyFetch\",Class:arguments[0],name:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_ClassConstFetch=function(){return{type:\"Node_Expr_ClassConstFetch\",Class:arguments[0],name:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_StaticPropertyFetch=function(){return{type:\"Node_Expr_StaticPropertyFetch\",Class:arguments[0],name:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_ConstFetch=function(){return{type:\"Node_Expr_ConstFetch\",name:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_ArrayItem=function(){return{type:\"Node_Expr_ArrayItem\",value:arguments[0],key:arguments[1],byRef:arguments[2],attributes:arguments[3]}},r.Parser.prototype.Node_Expr_Array=function(){return{type:\"Node_Expr_Array\",items:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_PropertyFetch=function(){return{type:\"Node_Expr_PropertyFetch\",variable:arguments[0],name:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_New=function(){return{type:\"Node_Expr_New\",Class:arguments[0],args:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Print=function(){return{type:\"Node_Expr_Print\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Exit=function(){return{type:\"Node_Expr_Exit\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_Bool=function(){return{type:\"Node_Expr_Cast_Bool\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_Int=function(){return{type:\"Node_Expr_Cast_Int\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_String=function(){return{type:\"Node_Expr_Cast_String\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_Double=function(){return{type:\"Node_Expr_Cast_Double\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_Array=function(){return{type:\"Node_Expr_Cast_Array\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Cast_Object=function(){return{type:\"Node_Expr_Cast_Object\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_ErrorSuppress=function(){return{type:\"Node_Expr_ErrorSuppress\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Isset=function(){return{type:\"Node_Expr_Isset\",variables:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_UnaryMinus=function(){return{type:\"Node_Expr_UnaryMinus\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_UnaryPlus=function(){return{type:\"Node_Expr_UnaryPlus\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_Empty=function(){return{type:\"Node_Expr_Empty\",variable:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_BooleanOr=function(){return{type:\"Node_Expr_BooleanOr\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_LogicalOr=function(){return{type:\"Node_Expr_LogicalOr\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_LogicalAnd=function(){return{type:\"Node_Expr_LogicalAnd\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_LogicalXor=function(){return{type:\"Node_Expr_LogicalXor\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_BitwiseAnd=function(){return{type:\"Node_Expr_BitwiseAnd\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_BitwiseOr=function(){return{type:\"Node_Expr_BitwiseOr\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_BitwiseXor=function(){return{type:\"Node_Expr_BitwiseXor\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_BitwiseNot=function(){return{type:\"Node_Expr_BitwiseNot\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_BooleanNot=function(){return{type:\"Node_Expr_BooleanNot\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Expr_BooleanAnd=function(){return{type:\"Node_Expr_BooleanAnd\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Instanceof=function(){return{type:\"Node_Expr_Instanceof\",left:arguments[0],right:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Expr_Clone=function(){return{type:\"Node_Expr_Clone\",expr:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Scalar_LNumber_parse=function(e){return e},r.Parser.prototype.Scalar_DNumber_parse=function(e){return e},r.Parser.prototype.Scalar_String_parseDocString=function(){return'\"'+arguments[1].replace(/([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"/g,'$1\\\\\"')+'\"'},r.Parser.prototype.Node_Scalar_String=function(){return{type:\"Node_Scalar_String\",value:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Scalar_String_create=function(){return{type:\"Node_Scalar_String\",value:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Scalar_LNumber=function(){return{type:\"Node_Scalar_LNumber\",value:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Scalar_DNumber=function(){return{type:\"Node_Scalar_DNumber\",value:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Scalar_Encapsed=function(){return{type:\"Node_Scalar_Encapsed\",parts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Name=function(){return{type:\"Node_Name\",parts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Name_FullyQualified=function(){return{type:\"Node_Name_FullyQualified\",parts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Name_Relative=function(){return{type:\"Node_Name_Relative\",parts:arguments[0],attributes:arguments[1]}},r.Parser.prototype.Node_Param=function(){return{type:\"Node_Param\",name:arguments[0],def:arguments[1],Type:arguments[2],byRef:arguments[3],attributes:arguments[4]}},r.Parser.prototype.Node_Arg=function(){return{type:\"Node_Name\",value:arguments[0],byRef:arguments[1],attributes:arguments[2]}},r.Parser.prototype.Node_Const=function(){return{type:\"Node_Const\",name:arguments[0],value:arguments[1],attributes:arguments[2]}},t.PHP=r}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-ace/src/main/resources/org/uberfire/ext/widgets/common/public/ace/worker-xquery.js",
    "content": "\"no use strict\";(function(e){if(typeof e.window!=\"undefined\"&&e.document)return;e.console=function(){var e=Array.prototype.slice.call(arguments,0);postMessage({type:\"log\",data:e})},e.console.error=e.console.warn=e.console.log=e.console.trace=e.console,e.window=e,e.ace=e,e.onerror=function(e,t,n,r,i){console.error(\"Worker \"+(i?i.stack:e))},e.normalizeModule=function(t,n){if(n.indexOf(\"!\")!==-1){var r=n.split(\"!\");return e.normalizeModule(t,r[0])+\"!\"+e.normalizeModule(t,r[1])}if(n.charAt(0)==\".\"){var i=t.split(\"/\").slice(0,-1).join(\"/\");n=(i?i+\"/\":\"\")+n;while(n.indexOf(\".\")!==-1&&s!=n){var s=n;n=n.replace(/^\\.\\//,\"\").replace(/\\/\\.\\//,\"/\").replace(/[^\\/]+\\/\\.\\.\\//,\"\")}}return n},e.require=function(t,n){n||(n=t,t=null);if(!n.charAt)throw new Error(\"worker.js require() accepts only (parentId, id) as arguments\");n=e.normalizeModule(t,n);var r=e.require.modules[n];if(r)return r.initialized||(r.initialized=!0,r.exports=r.factory().exports),r.exports;var i=n.split(\"/\");if(!e.require.tlns)return console.log(\"unable to load \"+n);i[0]=e.require.tlns[i[0]]||i[0];var s=i.join(\"/\")+\".js\";return e.require.id=n,importScripts(s),e.require(t,n)},e.require.modules={},e.require.tlns={},e.define=function(t,n,r){arguments.length==2?(r=n,typeof t!=\"string\"&&(n=t,t=e.require.id)):arguments.length==1&&(r=t,n=[],t=e.require.id),n.length||(n=[\"require\",\"exports\",\"module\"]);if(t.indexOf(\"text!\")===0)return;var i=function(n){return e.require(t,n)};e.require.modules[t]={exports:{},factory:function(){var e=this,t=r.apply(this,n.map(function(t){switch(t){case\"require\":return i;case\"exports\":return e.exports;case\"module\":return e;default:return i(t)}}));return t&&(e.exports=t),e}}},e.define.amd={},e.initBaseUrls=function(e){require.tlns=e},e.initSender=function(){var t=e.require(\"ace/lib/event_emitter\").EventEmitter,n=e.require(\"ace/lib/oop\"),r=function(){};return function(){n.implement(this,t),this.callback=function(e,t){postMessage({type:\"call\",id:t,data:e})},this.emit=function(e,t){postMessage({type:\"event\",name:e,data:t})}}.call(r.prototype),new r};var t=e.main=null,n=e.sender=null;e.onmessage=function(r){var i=r.data;if(i.command){if(!t[i.command])throw new Error(\"Unknown command:\"+i.command);t[i.command].apply(t,i.args)}else if(i.init){initBaseUrls(i.tlns),require(\"ace/lib/es5-shim\"),n=e.sender=initSender();var s=require(i.module)[i.classname];t=e.main=new s(n)}else i.event&&n&&n._signal(i.event,i.data)}})(this),define(\"ace/mode/xquery_worker\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/worker/mirror\",\"ace/mode/xquery/xqlint\",\"ace/mode/xquery/modules\"],function(e,t,n){var r=e(\"../lib/oop\"),i=e(\"../worker/mirror\").Mirror,s=e(\"./xquery/xqlint\"),o=s.XQLint,u=e(\"./xquery/modules\").Modules,a=function(e){return function(t){var n=e,r=n[t],i={},s={};return r.functions.forEach(function(e){s[t+\"#\"+e.name+\"#\"+e.arity]={params:[]},e.parameters.forEach(function(n){s[t+\"#\"+e.name+\"#\"+e.arity].params.push(\"$\"+n.name)})}),r.variables.forEach(function(e){var n=e.name.substring(e.name.indexOf(\":\")+1);i[t+\"#\"+n]={type:\"VarDecl\",annotations:[]}}),{variables:i,functions:s}}},f=t.XQueryWorker=function(e){i.call(this,e),this.setTimeout(200),this.opts={styleCheck:!1},this.availableModuleNamespaces=Object.keys(u),this.moduleResolver=a(u);var t=this;this.sender.on(\"complete\",function(e){if(t.xqlint){var n={line:e.data.pos.row,col:e.data.pos.column},r=t.xqlint.getCompletions(n);t.sender.emit(\"complete\",r)}}),this.sender.on(\"setAvailableModuleNamespaces\",function(e){t.availableModuleNamespaces=e.data}),this.sender.on(\"setModuleResolver\",function(e){t.moduleResolver=a(e.data)})};r.inherits(f,i),function(){this.onUpdate=function(){this.sender.emit(\"start\");var e=this.doc.getValue(),t=s.createStaticContext();this.moduleResolver&&t.setModuleResolver(this.moduleResolver),this.availableModuleNamespaces&&(t.availableModuleNamespaces=this.availableModuleNamespaces);var n={styleCheck:this.styleCheck,staticContext:t};this.xqlint=new o(e,n),this.sender.emit(\"markers\",this.xqlint.getMarkers())}}.call(f.prototype)}),define(\"ace/lib/oop\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define(\"ace/worker/mirror\",[\"require\",\"exports\",\"module\",\"ace/document\",\"ace/lib/lang\"],function(e,t,n){var r=e(\"../document\").Document,i=e(\"../lib/lang\"),s=t.Mirror=function(e){this.sender=e;var t=this.doc=new r(\"\"),n=this.deferredUpdate=i.delayedCall(this.onUpdate.bind(this)),s=this;e.on(\"change\",function(e){t.applyDeltas(e.data);if(s.$timeout)return n.schedule(s.$timeout);s.onUpdate()})};(function(){this.$timeout=500,this.setTimeout=function(e){this.$timeout=e},this.setValue=function(e){this.doc.setValue(e),this.deferredUpdate.schedule(this.$timeout)},this.getValue=function(e){this.sender.callback(this.doc.getValue(),e)},this.onUpdate=function(){},this.isPending=function(){return this.deferredUpdate.isPending()}}).call(s.prototype)}),define(\"ace/document\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\",\"ace/range\",\"ace/anchor\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=e(\"./range\").Range,o=e(\"./anchor\").Anchor,u=function(e){this.$lines=[],e.length===0?this.$lines=[\"\"]:Array.isArray(e)?this._insertLines(0,e):this.insert({row:0,column:0},e)};(function(){r.implement(this,i),this.setValue=function(e){var t=this.getLength();this.remove(new s(0,0,t,this.getLine(t-1).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new o(this,e,t)},\"aaa\".split(/a/).length===0?this.$split=function(e){return e.replace(/\\r\\n|\\r/g,\"\\n\").split(\"\\n\")}:this.$split=function(e){return e.split(/\\r\\n|\\r|\\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\\r\\n|\\r|\\n)/m);this.$autoNewLine=t?t[1]:\"\\n\",this._signal(\"changeNewLineMode\")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case\"windows\":return\"\\r\\n\";case\"unix\":return\"\\n\";default:return this.$autoNewLine||\"\\n\"}},this.$autoNewLine=\"\",this.$newLineMode=\"auto\",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal(\"changeNewLineMode\")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e==\"\\r\\n\"||e==\"\\r\"||e==\"\\n\"},this.getLine=function(e){return this.$lines[e]||\"\"},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){if(e.start.row==e.end.row)return this.getLine(e.start.row).substring(e.start.column,e.end.column);var t=this.getLines(e.start.row,e.end.row);t[0]=(t[0]||\"\").substring(e.start.column);var n=t.length-1;return e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column)),t.join(this.getNewLineCharacter())},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):e.row<0&&(e.row=0),e},this.insert=function(e,t){if(!t||t.length===0)return e;e=this.$clipPosition(e),this.getLength()<=1&&this.$detectNewLine(t);var n=this.$split(t),r=n.splice(0,1)[0],i=n.length==0?null:n.splice(n.length-1,1)[0];return e=this.insertInLine(e,r),i!==null&&(e=this.insertNewLine(e),e=this._insertLines(e.row,n),e=this.insertInLine(e,i||\"\")),e},this.insertLines=function(e,t){return e>=this.getLength()?this.insert({row:e,column:0},\"\\n\"+t.join(\"\\n\")):this._insertLines(Math.max(e,0),t)},this._insertLines=function(e,t){if(t.length==0)return{row:e,column:0};while(t.length>61440){var n=this._insertLines(e,t.slice(0,61440));t=t.slice(61440),e=n.row}var r=[e,0];r.push.apply(r,t),this.$lines.splice.apply(this.$lines,r);var i=new s(e,0,e+t.length,0),o={action:\"insertLines\",range:i,lines:t};return this._signal(\"change\",{data:o}),i.end},this.insertNewLine=function(e){e=this.$clipPosition(e);var t=this.$lines[e.row]||\"\";this.$lines[e.row]=t.substring(0,e.column),this.$lines.splice(e.row+1,0,t.substring(e.column,t.length));var n={row:e.row+1,column:0},r={action:\"insertText\",range:s.fromPoints(e,n),text:this.getNewLineCharacter()};return this._signal(\"change\",{data:r}),n},this.insertInLine=function(e,t){if(t.length==0)return e;var n=this.$lines[e.row]||\"\";this.$lines[e.row]=n.substring(0,e.column)+t+n.substring(e.column);var r={row:e.row,column:e.column+t.length},i={action:\"insertText\",range:s.fromPoints(e,r),text:t};return this._signal(\"change\",{data:i}),r},this.remove=function(e){e instanceof s||(e=s.fromPoints(e.start,e.end)),e.start=this.$clipPosition(e.start),e.end=this.$clipPosition(e.end);if(e.isEmpty())return e.start;var t=e.start.row,n=e.end.row;if(e.isMultiLine()){var r=e.start.column==0?t:t+1,i=n-1;e.end.column>0&&this.removeInLine(n,0,e.end.column),i>=r&&this._removeLines(r,i),r!=t&&(this.removeInLine(t,e.start.column,this.getLine(t).length),this.removeNewLine(e.start.row))}else this.removeInLine(t,e.start.column,e.end.column);return e.start},this.removeInLine=function(e,t,n){if(t==n)return;var r=new s(e,t,e,n),i=this.getLine(e),o=i.substring(t,n),u=i.substring(0,t)+i.substring(n,i.length);this.$lines.splice(e,1,u);var a={action:\"removeText\",range:r,text:o};return this._signal(\"change\",{data:a}),r.start},this.removeLines=function(e,t){return e<0||t>=this.getLength()?this.remove(new s(e,0,t+1,0)):this._removeLines(e,t)},this._removeLines=function(e,t){var n=new s(e,0,t+1,0),r=this.$lines.splice(e,t-e+1),i={action:\"removeLines\",range:n,nl:this.getNewLineCharacter(),lines:r};return this._signal(\"change\",{data:i}),r},this.removeNewLine=function(e){var t=this.getLine(e),n=this.getLine(e+1),r=new s(e,t.length,e+1,0),i=t+n;this.$lines.splice(e,2,i);var o={action:\"removeText\",range:r,text:this.getNewLineCharacter()};this._signal(\"change\",{data:o})},this.replace=function(e,t){e instanceof s||(e=s.fromPoints(e.start,e.end));if(t.length==0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);if(t)var n=this.insert(e.start,t);else n=e.start;return n},this.applyDeltas=function(e){for(var t=0;t<e.length;t++){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this.insertLines(r.start.row,n.lines):n.action==\"insertText\"?this.insert(r.start,n.text):n.action==\"removeLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"removeText\"&&this.remove(r)}},this.revertDeltas=function(e){for(var t=e.length-1;t>=0;t--){var n=e[t],r=s.fromPoints(n.range.start,n.range.end);n.action==\"insertLines\"?this._removeLines(r.start.row,r.end.row-1):n.action==\"insertText\"?this.remove(r):n.action==\"removeLines\"?this._insertLines(r.start.row,n.lines):n.action==\"removeText\"&&this.insert(r.start,n.text)}},this.indexToPosition=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length;for(var i=t||0,s=n.length;i<s;i++){e-=n[i].length+r;if(e<0)return{row:i,column:e+n[i].length+r}}return{row:s-1,column:n[s-1].length}},this.positionToIndex=function(e,t){var n=this.$lines||this.getAllLines(),r=this.getNewLineCharacter().length,i=0,s=Math.min(e.row,n.length);for(var o=t||0;o<s;++o)i+=n[o].length+r;return i+e.column}}).call(u.prototype),t.Document=u}),define(\"ace/lib/es5-shim\",[\"require\",\"exports\",\"module\"],function(e,t,n){function r(){}function i(e){try{return Object.defineProperty(e,\"sentinel\",{}),\"sentinel\"in e}catch(t){}}function s(e){return e=+e,e!==e?e=0:e!==0&&e!==1/0&&e!==-1/0&&(e=(e>0||-1)*Math.floor(Math.abs(e))),e}function o(e){var t=typeof e;return e===null||t===\"undefined\"||t===\"boolean\"||t===\"number\"||t===\"string\"}function u(e){var t,n,r;if(o(e))return e;n=e.valueOf;if(typeof n==\"function\"){t=n.call(e);if(o(t))return t}r=e.toString;if(typeof r==\"function\"){t=r.call(e);if(o(t))return t}throw new TypeError}Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if(typeof t!=\"function\")throw new TypeError(\"Function.prototype.bind called on incompatible \"+t);var n=c.call(arguments,1),i=function(){if(this instanceof i){var r=t.apply(this,n.concat(c.call(arguments)));return Object(r)===r?r:this}return t.apply(e,n.concat(c.call(arguments)))};return t.prototype&&(r.prototype=t.prototype,i.prototype=new r,r.prototype=null),i});var a=Function.prototype.call,f=Array.prototype,l=Object.prototype,c=f.slice,h=a.bind(l.toString),p=a.bind(l.hasOwnProperty),d,v,m,g,y;if(y=p(l,\"__defineGetter__\"))d=a.bind(l.__defineGetter__),v=a.bind(l.__defineSetter__),m=a.bind(l.__lookupGetter__),g=a.bind(l.__lookupSetter__);if([1,2].splice(0).length!=2)if(!function(){function e(e){var t=new Array(e+2);return t[0]=t[1]=0,t}var t=[],n;t.splice.apply(t,e(20)),t.splice.apply(t,e(26)),n=t.length,t.splice(5,0,\"XXX\"),n+1==t.length;if(n+1==t.length)return!0}())Array.prototype.splice=function(e,t){var n=this.length;e>0?e>n&&(e=n):e==void 0?e=0:e<0&&(e=Math.max(n+e,0)),e+t<n||(t=n-e);var r=this.slice(e,e+t),i=c.call(arguments,2),s=i.length;if(e===n)s&&this.push.apply(this,i);else{var o=Math.min(t,n-e),u=e+o,a=u+s-o,f=n-u,l=n-o;if(a<u)for(var h=0;h<f;++h)this[a+h]=this[u+h];else if(a>u)for(h=f;h--;)this[a+h]=this[u+h];if(s&&e===l)this.length=l,this.push.apply(this,i);else{this.length=l+s;for(h=0;h<s;++h)this[e+h]=i[h]}}return r};else{var b=Array.prototype.splice;Array.prototype.splice=function(e,t){return arguments.length?b.apply(this,[e===void 0?0:e,t===void 0?this.length-e:t].concat(c.call(arguments,2))):[]}}Array.isArray||(Array.isArray=function(e){return h(e)==\"[object Array]\"});var w=Object(\"a\"),E=w[0]!=\"a\"||!(0 in w);Array.prototype.forEach||(Array.prototype.forEach=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=arguments[1],i=-1,s=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError;while(++i<s)i in n&&e.call(r,n[i],i,t)}),Array.prototype.map||(Array.prototype.map=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=Array(r),s=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var o=0;o<r;o++)o in n&&(i[o]=e.call(s,n[o],o,t));return i}),Array.prototype.filter||(Array.prototype.filter=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=[],s,o=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var u=0;u<r;u++)u in n&&(s=n[u],e.call(o,s,u,t)&&i.push(s));return i}),Array.prototype.every||(Array.prototype.every=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&!e.call(i,n[s],s,t))return!1;return!0}),Array.prototype.some||(Array.prototype.some=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0,i=arguments[1];if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");for(var s=0;s<r;s++)if(s in n&&e.call(i,n[s],s,t))return!0;return!1}),Array.prototype.reduce||(Array.prototype.reduce=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduce of empty array with no initial value\");var i=0,s;if(arguments.length>=2)s=arguments[1];else do{if(i in n){s=n[i++];break}if(++i>=r)throw new TypeError(\"reduce of empty array with no initial value\")}while(!0);for(;i<r;i++)i in n&&(s=e.call(void 0,s,n[i],i,t));return s}),Array.prototype.reduceRight||(Array.prototype.reduceRight=function(e){var t=F(this),n=E&&h(this)==\"[object String]\"?this.split(\"\"):t,r=n.length>>>0;if(h(e)!=\"[object Function]\")throw new TypeError(e+\" is not a function\");if(!r&&arguments.length==1)throw new TypeError(\"reduceRight of empty array with no initial value\");var i,s=r-1;if(arguments.length>=2)i=arguments[1];else do{if(s in n){i=n[s--];break}if(--s<0)throw new TypeError(\"reduceRight of empty array with no initial value\")}while(!0);do s in this&&(i=e.call(void 0,i,n[s],s,t));while(s--);return i});if(!Array.prototype.indexOf||[0,1].indexOf(1,2)!=-1)Array.prototype.indexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=0;arguments.length>1&&(r=s(arguments[1])),r=r>=0?r:Math.max(0,n+r);for(;r<n;r++)if(r in t&&t[r]===e)return r;return-1};if(!Array.prototype.lastIndexOf||[0,1].lastIndexOf(0,-3)!=-1)Array.prototype.lastIndexOf=function(e){var t=E&&h(this)==\"[object String]\"?this.split(\"\"):F(this),n=t.length>>>0;if(!n)return-1;var r=n-1;arguments.length>1&&(r=Math.min(r,s(arguments[1]))),r=r>=0?r:n-Math.abs(r);for(;r>=0;r--)if(r in t&&e===t[r])return r;return-1};Object.getPrototypeOf||(Object.getPrototypeOf=function(e){return e.__proto__||(e.constructor?e.constructor.prototype:l)});if(!Object.getOwnPropertyDescriptor){var S=\"Object.getOwnPropertyDescriptor called on a non-object: \";Object.getOwnPropertyDescriptor=function(e,t){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(S+e);if(!p(e,t))return;var n,r,i;n={enumerable:!0,configurable:!0};if(y){var s=e.__proto__;e.__proto__=l;var r=m(e,t),i=g(e,t);e.__proto__=s;if(r||i)return r&&(n.get=r),i&&(n.set=i),n}return n.value=e[t],n}}Object.getOwnPropertyNames||(Object.getOwnPropertyNames=function(e){return Object.keys(e)});if(!Object.create){var x;Object.prototype.__proto__===null?x=function(){return{__proto__:null}}:x=function(){var e={};for(var t in e)e[t]=null;return e.constructor=e.hasOwnProperty=e.propertyIsEnumerable=e.isPrototypeOf=e.toLocaleString=e.toString=e.valueOf=e.__proto__=null,e},Object.create=function(e,t){var n;if(e===null)n=x();else{if(typeof e!=\"object\")throw new TypeError(\"typeof prototype[\"+typeof e+\"] != 'object'\");var r=function(){};r.prototype=e,n=new r,n.__proto__=e}return t!==void 0&&Object.defineProperties(n,t),n}}if(Object.defineProperty){var T=i({}),N=typeof document==\"undefined\"||i(document.createElement(\"div\"));if(!T||!N)var C=Object.defineProperty}if(!Object.defineProperty||C){var k=\"Property description must be an object: \",L=\"Object.defineProperty called on non-object: \",A=\"getters & setters can not be defined on this javascript engine\";Object.defineProperty=function(e,t,n){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(L+e);if(typeof n!=\"object\"&&typeof n!=\"function\"||n===null)throw new TypeError(k+n);if(C)try{return C.call(Object,e,t,n)}catch(r){}if(p(n,\"value\"))if(y&&(m(e,t)||g(e,t))){var i=e.__proto__;e.__proto__=l,delete e[t],e[t]=n.value,e.__proto__=i}else e[t]=n.value;else{if(!y)throw new TypeError(A);p(n,\"get\")&&d(e,t,n.get),p(n,\"set\")&&v(e,t,n.set)}return e}}Object.defineProperties||(Object.defineProperties=function(e,t){for(var n in t)p(t,n)&&Object.defineProperty(e,n,t[n]);return e}),Object.seal||(Object.seal=function(e){return e}),Object.freeze||(Object.freeze=function(e){return e});try{Object.freeze(function(){})}catch(O){Object.freeze=function(e){return function(t){return typeof t==\"function\"?t:e(t)}}(Object.freeze)}Object.preventExtensions||(Object.preventExtensions=function(e){return e}),Object.isSealed||(Object.isSealed=function(e){return!1}),Object.isFrozen||(Object.isFrozen=function(e){return!1}),Object.isExtensible||(Object.isExtensible=function(e){if(Object(e)===e)throw new TypeError;var t=\"\";while(p(e,t))t+=\"?\";e[t]=!0;var n=p(e,t);return delete e[t],n});if(!Object.keys){var M=!0,_=[\"toString\",\"toLocaleString\",\"valueOf\",\"hasOwnProperty\",\"isPrototypeOf\",\"propertyIsEnumerable\",\"constructor\"],D=_.length;for(var P in{toString:null})M=!1;Object.keys=function I(e){if(typeof e!=\"object\"&&typeof e!=\"function\"||e===null)throw new TypeError(\"Object.keys called on a non-object\");var I=[];for(var t in e)p(e,t)&&I.push(t);if(M)for(var n=0,r=D;n<r;n++){var i=_[n];p(e,i)&&I.push(i)}return I}}Date.now||(Date.now=function(){return(new Date).getTime()});var H=\"\t\\n\u000b\\f\\r   ᠎             　\\u2028\\u2029﻿\";if(!String.prototype.trim||H.trim()){H=\"[\"+H+\"]\";var B=new RegExp(\"^\"+H+H+\"*\"),j=new RegExp(H+H+\"*$\");String.prototype.trim=function(){return String(this).replace(B,\"\").replace(j,\"\")}}var F=function(e){if(e==null)throw new TypeError(\"can't convert \"+e+\" to object\");return Object(e)}}),define(\"ace/range\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return\"Range: [\"+this.start.row+\"/\"+this.start.column+\"] -> [\"+this.end.row+\"/\"+this.end.column+\"]\"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e==\"object\"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e==\"object\"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?t<this.start.column?-1:t>this.end.column?1:0:e<this.start.row?-1:e>this.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.row<e)var n={row:e,column:0};if(this.start.row>t)var r={row:t+1,column:0};else if(this.start.row<e)var r={row:e,column:0};return i.fromPoints(r||this.start,n||this.end)},this.extend=function(e,t){var n=this.compare(e,t);if(n==0)return this;if(n==-1)var r={row:e,column:t};else var s={row:e,column:t};return i.fromPoints(r||this.start,s||this.end)},this.isEmpty=function(){return this.start.row===this.end.row&&this.start.column===this.end.column},this.isMultiLine=function(){return this.start.row!==this.end.row},this.clone=function(){return i.fromPoints(this.start,this.end)},this.collapseRows=function(){return this.end.column==0?new i(this.start.row,0,Math.max(this.start.row,this.end.row-1),0):new i(this.start.row,0,this.end.row,0)},this.toScreenRange=function(e){var t=e.documentToScreenPosition(this.start),n=e.documentToScreenPosition(this.end);return new i(t.row,t.column,n.row,n.column)},this.moveBy=function(e,t){this.start.row+=e,this.start.column+=t,this.end.row+=e,this.end.column+=t}}).call(i.prototype),i.fromPoints=function(e,t){return new i(e.row,e.column,t.row,t.column)},i.comparePoints=r,i.comparePoints=function(e,t){return e.row-t.row||e.column-t.column},t.Range=i}),define(\"ace/anchor\",[\"require\",\"exports\",\"module\",\"ace/lib/oop\",\"ace/lib/event_emitter\"],function(e,t,n){var r=e(\"./lib/oop\"),i=e(\"./lib/event_emitter\").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n==\"undefined\"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){r.implement(this,i),this.getPosition=function(){return this.$clipPositionToDocument(this.row,this.column)},this.getDocument=function(){return this.document},this.$insertRight=!1,this.onChange=function(e){var t=e.data,n=t.range;if(n.start.row==n.end.row&&n.start.row!=this.row)return;if(n.start.row>this.row)return;if(n.start.row==this.row&&n.start.column>this.column)return;var r=this.row,i=this.column,s=n.start,o=n.end;if(t.action===\"insertText\")if(s.row===r&&s.column<=i){if(s.column!==i||!this.$insertRight)s.row===o.row?i+=o.column-s.column:(i-=s.column,r+=o.row-s.row)}else s.row!==o.row&&s.row<r&&(r+=o.row-s.row);else t.action===\"insertLines\"?(s.row!==r||i!==0||!this.$insertRight)&&s.row<=r&&(r+=o.row-s.row):t.action===\"removeText\"?s.row===r&&s.column<i?o.column>=i?i=s.column:i=Math.max(0,i-(o.column-s.column)):s.row!==o.row&&s.row<r?(o.row===r&&(i=Math.max(0,i-o.column)+s.column),r-=o.row-s.row):o.row===r&&(r-=o.row-s.row,i=Math.max(0,i-o.column)+s.column):t.action==\"removeLines\"&&s.row<=r&&(o.row<=r?r-=o.row-s.row:(r=s.row,i=0));this.setPosition(r,i,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal(\"change\",{old:i,value:r})},this.detach=function(){this.document.removeEventListener(\"change\",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on(\"change\",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define(\"ace/lib/lang\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.last=function(e){return e[e.length-1]},t.stringReverse=function(e){return e.split(\"\").reverse().join(\"\")},t.stringRepeat=function(e,t){var n=\"\";while(t>0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\\s\\s*/,i=/\\s\\s*$/;t.stringTrimLeft=function(e){return e.replace(r,\"\")},t.stringTrimRight=function(e){return e.replace(i,\"\")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;n<r;n++)e[n]&&typeof e[n]==\"object\"?t[n]=this.copyObject(e[n]):t[n]=e[n];return t},t.deepCopy=function(e){if(typeof e!=\"object\"||!e)return e;var n=e.constructor;if(n===RegExp)return e;var r=n();for(var i in e)typeof e[i]==\"object\"?r[i]=t.deepCopy(e[i]):r[i]=e[i];return r},t.arrayToMap=function(e){var t={};for(var n=0;n<e.length;n++)t[e[n]]=1;return t},t.createMap=function(e){var t=Object.create(null);for(var n in e)t[n]=e[n];return t},t.arrayRemove=function(e,t){for(var n=0;n<=e.length;n++)t===e[n]&&e.splice(n,1)},t.escapeRegExp=function(e){return e.replace(/([.*+?^${}()|[\\]\\/\\\\])/g,\"\\\\$1\")},t.escapeHTML=function(e){return e.replace(/&/g,\"&#38;\").replace(/\"/g,\"&#34;\").replace(/'/g,\"&#39;\").replace(/</g,\"&#60;\")},t.getMatchOffsets=function(e,t){var n=[];return e.replace(t,function(e){n.push({offset:arguments[arguments.length-2],length:e.length})}),n},t.deferredCall=function(e){var t=null,n=function(){t=null,e()},r=function(e){return r.cancel(),t=setTimeout(n,e||0),r};return r.schedule=r,r.call=function(){return this.cancel(),e(),r},r.cancel=function(){return clearTimeout(t),t=null,r},r.isPending=function(){return t},r},t.delayedCall=function(e,t){var n=null,r=function(){n=null,e()},i=function(e){n==null&&(n=setTimeout(r,e||t))};return i.delay=function(e){n&&clearTimeout(n),n=setTimeout(r,e||t)},i.schedule=i,i.call=function(){this.cancel(),e()},i.cancel=function(){n&&clearTimeout(n),n=null},i.isPending=function(){return n},i}}),define(\"ace/mode/xquery/xqlint\",[\"require\",\"exports\",\"module\"],function(e,t,n){n.exports=function r(t,n,i){function s(u,a){if(!n[u]){if(!t[u]){var f=typeof e==\"function\"&&e;if(!a&&f)return f(u,!0);if(o)return o(u,!0);throw new Error(\"Cannot find module '\"+u+\"'\")}var l=n[u]={exports:{}};t[u][0].call(l.exports,function(e){var n=t[u][1][e];return s(n?n:e)},l,l.exports,r,t,n,i)}return n[u].exports}var o=typeof e==\"function\"&&e;for(var u=0;u<i.length;u++)s(i[u]);return s}({1:[function(e,t,n){var r={},i={};r.prototype=new Error,i.prototype=new Error,n.StaticError=r.prototype.constructor=function(e,t,n){this.getCode=function(){return e},this.getMessage=function(){return t},this.getPos=function(){return n}},n.StaticWarning=i.prototype.constructor=function(e,t,n){this.getCode=function(){return e},this.getMessage=function(){return t},this.getPos=function(){return n}}},{}],2:[function(e,t,n){var r=e(\"../tree_ops\").TreeOps,i=e(\"./errors\"),s=i.StaticWarning;n.ModuleDecl=function(e,t,n){var i=\"\";return{NCName:function(e){i=r.flatten(e)},URILiteral:function(s){s=r.flatten(s),s=s.substring(1,s.length-1),e.apply(function(){t.moduleNamespace=s,t.addNamespace(s,i,n.pos,\"moduleDecl\")})}}},n.ModuleImport=function(e,t,n){var i=\"\",s;return{NCName:function(e){i=r.flatten(e)},URILiteral:function(o){if(s!==undefined)return;o=r.flatten(o),o=o.substring(1,o.length-1),s=o,e.apply(function(){t.importModule(o,i,n.pos)})}}},n.SchemaImport=function(e,t,n){var i=\"\",s;return{SchemaPrefix:function(t){var n=function(){this.NCName=function(e){i=r.flatten(e)}};e.visitChildren(t,new n)},URILiteral:function(o){if(s!==undefined)return;o=r.flatten(o),o=o.substring(1,o.length-1),s=o,e.apply(function(){t.addNamespace(o,i,n.pos,\"schema\")})}}},n.DefaultNamespaceDecl=function(e,t,n){var i=!1,o=\"\";return{TOKEN:function(e){i=i?!0:e.value===\"function\"},URILiteral:function(u){o=r.flatten(u),o=o.substring(1,o.length-1),i?t.defaultFunctionNamespace=o:(e.apply(function(){throw new s(\"Avoid default element namespace declarations.\",n.pos)}),t.defaultElementNamespace=o)}}},n.NamespaceDecl=function(e,t,n){var i=\"\";return{NCName:function(e){i=r.flatten(e)},URILiteral:function(s){s=r.flatten(s),s=s.substring(1,s.length-1),e.apply(function(){t.addNamespace(s,i,n.pos,\"declare\")})}}},n.VarHandler=function(e,t,n){var i=function(i){var s=r.flatten(i);e.apply(function(){var e=t.resolveQName(s,i.pos);t.addVariable(e,n.name,i.pos)})};return{ExprSingle:function(){return!0},VarValue:function(){return!0},VarDefaultValue:function(){return!0},VarName:i,EQName:i}},n.VarRefHandler=function(e,t,n){return{VarName:function(i){var s=r.flatten(i);e.apply(function(){var e=t.resolveQName(s,n.pos);e.uri!==\"\"&&(t.root.namespaces[e.uri].used=!0),t.addVarRef(e,i.pos)})}}}},{\"../tree_ops\":10,\"./errors\":1}],3:[function(e,t,n){n.StaticContext=function(t,n){var r=e(\"../tree_ops\").TreeOps,i=e(\"./errors\"),s=i.StaticError,o=i.StaticWarning,u={sl:0,sc:0,el:0,ec:0},a={},f=function(e){return e.uri+\"#\"+e.name},l=function(e,t){return f(e)+\"#\"+t};t||(a[\"http://jsoniq.org/functions\"]={prefix:\"jn\",pos:u,type:\"module\",override:!0},a[\"http://www.w3.org/2005/xpath-functions\"]={prefix:\"fn\",pos:u,type:\"module\",override:!0},a[\"http://www.w3.org/2005/xquery-local-functions\"]={prefix:\"local\",pos:u,type:\"declare\",override:!0},a[\"http://www.w3.org/2001/XMLSchema-instance\"]={prefix:\"xsi\",pos:u,type:\"declare\"},a[\"http://www.w3.org/2001/XMLSchema\"]={prefix:\"xs\",pos:u,type:\"declare\"},a[\"http://www.w3.org/XML/1998/namespace\"]={prefix:\"xml\",pos:u,type:\"declare\"},a[\"http://zorba.io/annotations\"]={prefix:\"an\",pos:u,type:\"declare\",override:!0},a[\"http://www.w3.org/2005/xqt-errors\"]={prefix:\"err\",pos:u,type:\"declare\",override:!0},a[\"http://zorba.io/errors\"]={prefix:\"zerr\",pos:u,type:\"declare\",override:!0});var c={parent:t,children:[],pos:n,setModuleResolver:function(e){return this.root.moduleResolver=e,this},moduleNamespace:\"\",defaultFunctionNamespace:\"\",defaultElementNamespace:\"\",namespaces:a,availableModuleNamespaces:[],importModule:function(e,t,n){this.root.addNamespace(e,t,n,\"module\");if(this.root.moduleResolver)try{var i=this.root.moduleResolver(e,[]);r.concat(this.variables,i.variables),r.concat(this.functions,i.functions)}catch(o){throw new s(\"XQST0059\",'module \"'+e+'\" not found: '+o,n)}return this},getAvailableModuleNamespaces:function(){return this.root.availableModuleNamespaces},getPrefixByNamespace:function(e){return this.root.namespaces[e].prefix},addNamespace:function(e,t,n,r){if(t===\"\"&&r===\"module\")throw new o(\"W01\",\"Avoid this type of import. Use import module namespace instead\");if(e===\"\")throw new s(\"XQST0088\",\"empty target namespace in module import or module declaration\",n);var i=this.getNamespace(e);if(i&&i.type===r&&r!==\"declare\"&&!i.override)throw new s(\"XQST0047\",'\"'+e+'\": duplicate target namespace',n);i=this.getNamespaceByPrefix(t);if(i&&!i.override)throw new s(\"XQST0033\",'\"'+t+'\": namespace prefix already bound to \"'+i.uri+'\"',n);i=this.namespaces[e],this.namespaces[e]={prefix:t,pos:n,type:r};if(i)throw new o(\"W02\",'\"'+e+'\" already bound to the \"'+i.prefix+'\" prefix',n)},getNamespaces:function(){return this.root.namespaces},getNamespace:function(e){var t=this;while(t){var n=t.namespaces[e];if(n)return n;t=t.parent}},getNamespaceByPrefix:function(e){var t=function(t){var r=n.namespaces[t];if(r.prefix===e)throw r.uri=t,r},n=this;while(n){try{Object.keys(n.namespaces).forEach(t)}catch(r){return r}n=n.parent}},resolveQName:function(e,t){var n={uri:\"\",prefix:\"\",name:\"\"},r;if(e.substring(0,2)===\"Q{\")r=e.indexOf(\"}\"),n.uri=e.substring(2,r),n.name=e.substring(r+1);else{r=e.indexOf(\":\"),n.prefix=e.substring(0,r);var i=this.getNamespaceByPrefix(n.prefix);if(!i&&n.prefix!==\"\")throw new s(\"XPST0081\",'\"'+n.prefix+'\": can not expand prefix of lexical QName to namespace URI',t);i&&(n.uri=i.uri),n.name=e.substring(r+1)}return n},variables:{},varRefs:{},addVariable:function(e,t,n){if(t!==\"VarDecl\"||this.moduleNamespace===\"\"||this.moduleNamespace===e.uri||e.uri===\"\"&&this.defaultFunctionNamespace===this.moduleNamespace){var r=f(e);if(t===\"VarDecl\"&&this.variables[r])throw new s(\"XQST0049\",'\"'+e.name+'\": duplicate variable declaration',n);return this.variables[r]={type:t,pos:n,qname:e},this}throw new s(\"XQST0048\",'\"'+e.prefix+\":\"+e.name+'\": Qname not library namespace',n)},getVariables:function(){var e={},t=this,n=function(n){e[n]||(e[n]=t.variables[n])};while(t)Object.keys(t.variables).forEach(n),t=t.parent;return e},getVariable:function(e){var t=f(e),n=this;while(n){if(n.variables[t])return n.variables[t];n=n.parent}},addVarRef:function(e,t){var n=this.getVariable(e);if(!n&&(e.uri===\"\"||this.root.moduleResolver))throw new s(\"XPST0008\",'\"'+e.name+'\": undeclared variable',t);var r=f(e);this.varRefs[r]=!0},functions:{},getFunctions:function(){return this.root.functions},getFunction:function(e,t){var n=l(e,t),r=this;while(r){if(r.functions[n])return r.functions[n];r=r.parent}},addFunction:function(e,t,n){var r=n.length;if(this.moduleNamespace===\"\"||this.moduleNamespace===e.uri||e.uri===\"\"&&this.defaultFunctionNamespace===this.moduleNamespace){var i=l(e,r);if(this.functions[i])throw new s(\"XQST0034\",'\"'+e.name+'\": duplicate function declaration',t);return this.functions[i]={pos:t,params:n},this}throw new s(\"XQST0048\",'\"'+e.prefix+\":\"+e.name+'\": Qname not library namespace',t)}};return c.root=t?t.root:c,c}},{\"../tree_ops\":10,\"./errors\":1}],4:[function(e,t,n){n.Translator=function(t,n){var r=e(\"./errors\"),i=r.StaticError,s=r.StaticWarning,o=e(\"../tree_ops\").TreeOps,u=e(\"./static_context\").StaticContext,a=e(\"./handlers\"),f=function(e,t){var n;return t.length===0?e:(e.children.forEach(function(e){e.name===t[0]&&(n=f(e,t.slice(1)))}),n)},l=[];this.apply=function(e){try{e()}catch(t){if(t instanceof i)c(t);else{if(!(t instanceof s))throw t;h(t.getCode(),t.getMessage(),t.getPos())}}};var c=function(e){l.push({pos:e.getPos(),type:\"error\",level:\"error\",message:\"[\"+e.getCode()+\"] \"+e.getMessage()})},h=function(e,t,n){l.push({pos:n,type:\"warning\",level:\"warning\",message:\"[\"+e+\"] \"+t})};this.getMarkers=function(){return l};var p=this;t.pos=n.pos;var d=t,v=function(e){d=new u(d,e),d.parent.children.push(d)},m=function(e){e!==undefined&&(d.pos.el=e.el,d.pos.ec=e.ec),Object.keys(d.varRefs).forEach(function(e){d.variables[e]||(d.parent.varRefs[e]=!0)}),Object.keys(d.variables).forEach(function(e){!d.varRefs[e]&&d.variables[e].type!==\"GroupingVariable\"&&h(\"W03\",'Unused variable \"$'+d.variables[e].qname.name+'\"',d.variables[e].pos)}),d=d.parent};this.visitOnly=function(e,t){e.children.forEach(function(e){t.indexOf(e.name)!==-1&&p.visit(e)})},this.getFirstChild=function(e,t){var n;return e.children.forEach(function(e){e.name===t&&n===undefined&&(n=e)}),n},this.ModuleDecl=function(e){return this.visitChildren(e,a.ModuleDecl(p,t,e)),!0},this.Prolog=function(e){return this.visitOnly(e,[\"DefaultNamespaceDecl\",\"Setter\",\"NamespaceDecl\",\"Import\"]),n.index.forEach(function(e){if(e.name===\"VarDecl\")e.children.forEach(function(n){n.name===\"VarName\"&&p.apply(function(){var r=o.flatten(n),i=t.resolveQName(r,n.pos);t.addVariable(i,e.name,n.pos)})});else if(e.name===\"FunctionDecl\"){var n,r,i=[];e.children.forEach(function(e){e.name===\"EQName\"?(n=e,r=e.pos):e.name===\"ParamList\"&&e.children.forEach(function(e){e.name===\"Param\"&&i.push(o.flatten(e))})}),p.apply(function(){n=o.flatten(n),n=t.resolveQName(n,r),t.addFunction(n,r,i)})}}),this.visitOnly(e,[\"ContextItemDecl\",\"AnnotatedDecl\",\"OptionDecl\"]),!0},this.ModuleImport=function(e){return this.visitChildren(e,a.ModuleImport(p,t,e)),!0},this.SchemaImport=function(e){return this.visitChildren(e,a.SchemaImport(p,t,e)),!0},this.DefaultNamespaceDecl=function(e){return this.visitChildren(e,a.DefaultNamespaceDecl(p,t,e)),!0},this.NamespaceDecl=function(e){return this.visitChildren(e,a.NamespaceDecl(p,t,e)),!0};var g={};this.AnnotatedDecl=function(e){return g=[],this.visitChildren(e,a.NamespaceDecl(p,t,e)),!0},this.Annotation=function(e){return this.visitChildren(e,{EQName:function(e){var t=o.flatten(e);p.apply(function(){var n=d.resolveQName(t,e.pos);g[n.uri+\"#\"+n.name]=[]})}}),!0},this.VarDecl=function(e){try{var n=p.getFirstChild(e,\"VarName\"),r=o.flatten(n),i=d.resolveQName(r,n.pos),s=t.getVariable(i);s&&(s.annotations=g)}catch(u){}return this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),!0},this.FunctionDecl=function(e){var t=f(e,[\"ReturnType\"]);t||h(\"W05\",\"Untyped return value\",e.pos);var n=!1;return e.children.forEach(function(e){if(e.name===\"TOKEN\"&&e.value===\"external\")return n=!0,!1}),n||(v(e.pos),this.visitChildren(e),m()),!0},this.VarRef=function(e){return this.visitChildren(e,a.VarRefHandler(p,d,e)),!0},this.Param=function(e){var t=f(e,[\"TypeDeclaration\"]);return t||h(\"W05\",\"Untyped function parameter\",e.pos),this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.InlineFunctionExpr=function(e){return v(e.pos),this.visitChildren(e),m(),!0};var y=[],b=function(e){v(e.pos),y.push(0),p.visitChildren(e);for(var t=1;t<=y[y.length-1];t++)m(e.pos);y.pop(),m()};this.StatementsAndOptionalExpr=function(e){return b(e),!0},this.StatementsAndExpr=function(e){return b(e),!0},this.BlockStatement=function(e){return b(e),!0},this.VarDeclStatement=function(e){v(e.pos),y[y.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e))};var w=[];this.FLWORExpr=function(e){v(e.pos),w.push(0),this.visitChildren(e);for(var t=1;t<=w[w.length-1];t++)m(e.pos);return w.pop(),m(),!0},this.ForBinding=function(e){return this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.LetBinding=function(e){this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e))},this.GroupingSpec=function(e){var t=!1;e.children.forEach(function(e){if(e.value===\":=\")return t=!0,!1});if(t){var n=e.children[0];return this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),v(e.pos),w[w.length-1]++,this.visitChildren(n,a.VarHandler(p,d,n)),!0}},this.TumblingWindowClause=function(e){return this.visitOnly(e,[\"ExprSingle\"]),v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e)),this.visitOnly(e,[\"WindowStartCondition\",\"WindowEndCondition\"]),!0},this.WindowVars=function(e){return v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.SlidingWindowClause=function(e){return this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e)),this.visitOnly(e,[\"WindowStartCondition\",\"WindowEndCondition\"]),!0},this.PositionalVar=function(e){return this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.PositionalVar=function(e){return this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.CurrentItem=function(e){return this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.PreviousItem=function(e){return this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.NextItem=function(e){return this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.CountClause=function(e){return v(e.pos),w[w.length-1]++,this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.CaseClause=function(e){return v(e.pos),this.visitChildren(e,a.VarHandler(p,d,e)),this.visitOnly(e,[\"ExprSingle\"]),m(),!0},this.TransformExpr=function(e){return v(e.pos),this.visitChildren(e),m(),!0},this.TransformSpec=function(e){return this.visitOnly(e,[\"ExprSingle\",\"VarValue\",\"VarDefaultValue\"]),this.visitChildren(e,a.VarHandler(p,d,e)),!0},this.QuantifiedExpr=function(e){return v(e.pos),m(),!0},this.FunctionCall=function(e){try{var n=p.getFirstChild(e,\"EQName\");n=o.flatten(n);var r=t.resolveQName(n,e.pos);t.namespaces[r.uri].used=!0}catch(i){}},this.visit=function(e){var t=e.name,n=!1;typeof this[t]==\"function\"&&(n=this[t](e)===!0),n||this.visitChildren(e)},this.visitChildren=function(e,t){for(var n=0;n<e.children.length;n++){var r=e.children[n];t!==undefined&&typeof t[r.name]==\"function\"?t[r.name](r):this.visit(r)}},this.visit(n),Object.keys(t.variables).forEach(function(e){!t.varRefs[e]&&(t.variables[e].annotations[\"http://www.w3.org/2005/xpath-functions#private\"]||t.moduleNamespace===\"\")&&t.variables[e].pos&&h(\"W03\",'Unused variable \"'+t.variables[e].qname.name+'\"',t.variables[e].pos)}),Object.keys(t.namespaces).forEach(function(e){var n=t.namespaces[e];n.used===undefined&&!n.override&&n.type===\"module\"&&h(\"W04\",'Unused module \"'+e+'\"',n.pos)})}},{\"../tree_ops\":10,\"./errors\":1,\"./handlers\":2,\"./static_context\":3}],5:[function(e,t,n){function r(e,t,n){n=n||o;var r=[];for(var i=t-1;i>=0;i--){if(!n.test(e[i]))break;r.push(e[i])}return r.reverse().join(\"\")}function i(e,t){var n=0,r=e.length-1,i=Math.floor((r+n)/2);while(r>n&&i>=0&&e[i].indexOf(t)!==0)t<e[i]?r=i-1:t>e[i]&&(n=i+1),i=Math.floor((r+r)/2);while(i>0&&e[i-1].indexOf(t)===0)i--;return i>=0?i:0}var s=e(\"../tree_ops\").TreeOps,o=/[a-zA-Z_0-9\\$]/,u=/[a-zA-Z_0-9\\/\\.:\\-#]/,a=\"-._A-Za-z0-9:·À-ÖØ-öø-˿̀-ͽͿ-῿‌‍‿⁀⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�\",f=\"[\"+a+\"]\",l=new RegExp(f),c={LetBinding:\"Let binding\",Param:\"Function parameter\",QuantifiedExpr:\"Quantified expression binding\",VarDeclStatement:\"Local variable\",ForBinding:\"For binding\",TumblingWindowClause:\"Tumbling window binding\",WindowVars:\"Window variable\",SlidingWindowClause:\"Sliding window binding\",PositionalVar:\"Positional variable\",CurrentItem:\"Current item\",PreviousItem:\"Previous item\",NextItem:\"Next item\",CountClause:\"Count binding\",GroupingVariable:\"Grouping variable\",VarDecl:\"Module variable\"},h=function(e,t){t.sort();var n=i(t,e),r=[];for(var s=n;s<t.length&&t[s].indexOf(e)===0;s++)r.push(t[s]);return r},p=function(e,t,n){var r=e.indexOf(\":\");if(r===-1){var i=[],s=n.getNamespaces();Object.keys(s).forEach(function(e){s[e].type===\"module\"&&i.push(s[e].prefix)});var o=h(e,i),u=function(e){return{name:e+\":\",value:e+\":\",meta:\"prefix\"}};return o.map(u)}return[]},d=function(e,t,n){var r=[],i=n.getFunctions(),s=\"\",o=\"\",u=e,a=e.indexOf(\":\");if(a!==-1){o=e.substring(0,a),u=e.substring(a+1);var f=n.getNamespaceByPrefix(o);f&&(s=n.getNamespaceByPrefix(o).uri)}Object.keys(i).forEach(function(e){var t=i[e],s=e.substring(0,e.indexOf(\"#\")),o=e.substring(e.indexOf(\"#\")+1);o=o.substring(0,o.indexOf(\"#\")),s!==\"\"&&(o=n.getNamespaces()[s].prefix+\":\"+o),o+=\"(\",o+=t.params.join(\", \"),o+=\")\",r.push(o)});var l=h(e,r),c=function(e){return{name:e,value:e,meta:\"function\"}};return l.map(c)},v=function(e,t,n){var r=\"\",i=\"\",s=e.indexOf(\":\");s!==-1&&(i=e.substring(0,s),r=n.getNamespaceByPrefix(i).uri);var o=n.getVariables(),u=[],a={};Object.keys(o).forEach(function(e){var t=e.indexOf(\"#\"),r=e.substring(0,t),i=e.substring(t+1);r!==\"\"?(u.push(n.getPrefixByNamespace(r)+\":\"+i),a[n.getPrefixByNamespace(r)+\":\"+i]=o[e].type):(u.push(i),a[i]=o[e].type)});var f=h(e,u),l=function(e){return{name:\"$\"+e,value:\"$\"+e,meta:c[a[e]]}};return f.map(l)},m=function(e,t,n){var i=r(e,t.col,l),s=e.substring(0,t.col-(i.length===0?0:i.length)),o=s[s.length-1]===\"$\";return o?v(i,t,n):i!==\"\"?d(i,t,n).concat(p(i,t,n)):v(i,t,n).concat(d(i,t,n)).concat(p(i,t,n))},g=function(e,t,n){var i=r(e,t.col,u),s=h(i,n.getAvailableModuleNamespaces()),o=function(e){return{name:e,value:e,meta:\"module\"}};return s.map(o)};n.complete=function(e,t,n,r){var i=e.split(\"\\n\")[r.line],o=s.findNode(t,r),u=s.findNode(n,r);return u=u?u:n,o&&o.name===\"URILiteral\"&&o.getParent&&o.getParent.name===\"ModuleImport\"?g(i,r,u):m(i,r,u)}},{\"../tree_ops\":10}],6:[function(e,t,n){n.StyleChecker=function(e,t){var n=\"    \",r=[];this.getMarkers=function(){return r},this.WS=function(e){var t=e.value.split(\"\\n\");return t.forEach(function(i,s){var o=s===0,u=s===t.length-1;/\\r$/.test(i)&&r.push({pos:{sl:e.pos.sl+s,el:e.pos.sl+s,sc:i.length-1,ec:i.length},type:\"warning\",level:\"warning\",message:\"[SW01] Detected CRLF\"});var a=i.match(/\\t+/);a!==null&&r.push({pos:{sl:e.pos.sl+s,el:e.pos.sl+s,sc:a.index,ec:a.index+a[0].length},type:\"warning\",level:\"warning\",message:\"[SW02] Tabs detected\"});if(!o&&u){a=i.match(/^\\ +/);if(a!==null){var f=a[0].length%n.length;f!==0&&r.push({pos:{sl:e.pos.sl+s,el:e.pos.sl+s,sc:a.index,ec:a.index+a[0].length},type:\"warning\",level:\"warning\",message:\"[SW03] Unexcepted indentation of \"+a[0].length})}}}),!0},this.visit=function(e,t){var n=e.name,r=!1;typeof this[n]==\"function\"&&(r=this[n](e,t)===!0),r||this.visitChildren(e)},this.visitChildren=function(e,t){for(var n=0;n<e.children.length;n++){var r=e.children[n];t!==undefined&&typeof t[r.name]==\"function\"?t[r.name](r):this.visit(r)}},t.split(\"\\n\").forEach(function(e,t){var n=e.match(/\\ +$/);n&&r.push({pos:{sl:t,el:t,sc:n.index,ec:n.index+n[0].length},type:\"warning\",level:\"warning\",message:\"[SW04] Trailing whitespace\"})}),this.visit(e)}},{}],7:[function(e,t,n){n.JSONParseTreeHandler=function(e){function t(e){return{name:e,children:[],getParent:null,pos:{sl:0,sc:0,el:0,ec:0}}}function n(e){var n=t(e);u===null?(u=n,u.index=[],a=n):(n.getParent=a,a.children.push(n),a=a.children[a.children.length-1])}function r(){if(a.children.length>0){var e=a.children[0],t=null;for(var n=a.children.length-1;n>=0;n--){t=a.children[n];if(t.pos.el!==0||t.pos.ec!==0)break}a.pos.sl=e.pos.sl,a.pos.sc=e.pos.sc,a.pos.el=t.pos.el,a.pos.ec=t.pos.ec}a.name===\"FunctionName\"&&(a.name=\"EQName\"),a.name===\"EQName\"&&a.value===undefined&&(a.value=a.children[0].value,a.children.pop()),s.indexOf(a.name)!==-1&&u.index.push(a),a.getParent!==null&&(a=a.getParent);if(a.children.length>0){var r=a.children[a.children.length-1];r.children.length===1&&o.indexOf(r.name)!==-1&&(a.children[a.children.length-1]=r.children[0])}}function i(e,t,n){var r=n-l;a.value=f.substring(0,r),f=f.substring(r),l=n;var i=h,s=c,o=i+a.value.split(\"\\n\").length-1,u=a.value.lastIndexOf(\"\\n\"),p=u===-1?s+a.value.length:a.value.substring(u+1).length;h=o,c=p,a.pos.sl=i,a.pos.sc=s,a.pos.el=o,a.pos.ec=p}var s=[\"VarDecl\",\"FunctionDecl\"],o=[\"OrExpr\",\"AndExpr\",\"ComparisonExpr\",\"StringConcatExpr\",\"RangeExpr\",\"UnionExpr\",\"IntersectExceptExpr\",\"InstanceofExpr\",\"TreatExpr\",\"CastableExpr\",\"CastExpr\",\"UnaryExpr\",\"ValueExpr\",\"FTContainsExpr\",\"SimpleMapExpr\",\"PathExpr\",\"RelativePathExpr\",\"PostfixExpr\",\"StepExpr\"],u=null,a=null,f=e,l=0,c=0,h=0;this.closeParseTree=function(){while(a.getParent!==null)r();r()},this.peek=function(){return a},this.getParseTree=function(){return u},this.reset=function(){},this.startNonterminal=function(e,t){n(e,t)},this.endNonterminal=function(){r()},this.terminal=function(e,t,s){e=e.substring(0,1)===\"'\"&&e.substring(e.length-1)===\"'\"?\"TOKEN\":e,n(e,t),i(a,t,s),r()},this.whitespace=function(e,t){var s=\"WS\";n(s,e),i(a,e,t),r()}}},{}],8:[function(e,t,n){var r=n.JSONiqParser=function i(e,t){function n(e,t){sc=t,uc=e,ac=e.length,r(0,0,0)}function r(e,t,n){Vl=t,$l=t,Jl=e,Kl=t,Ql=n,Gl=0,lc=n,tc=-1,oc={},sc.reset(uc)}function s(){sc.startNonterminal(\"Module\",$l);switch(Jl){case 170:jl(169);break;default:Xl=Jl}(Xl==64682||Xl==137898)&&o(),Bl(279);switch(Jl){case 185:jl(144);break;default:Xl=Jl}switch(Xl){case 95929:Pl(),u();break;default:Pl(),Qa()}sc.endNonterminal(\"Module\",$l)}function o(){sc.startNonterminal(\"VersionDecl\",$l),Ml(170),Bl(118);switch(Jl){case 126:Ml(126),Bl(17),Ml(11);break;default:Ml(269),Bl(17),Ml(11),Bl(111),Jl==126&&(Ml(126),Bl(17),Ml(11))}Bl(29),Pl(),l(),sc.endNonterminal(\"VersionDecl\",$l)}function u(){sc.startNonterminal(\"LibraryModule\",$l),a(),Bl(140),Pl(),f(),sc.endNonterminal(\"LibraryModule\",$l)}function a(){sc.startNonterminal(\"ModuleDecl\",$l),Ml(185),Bl(64),Ml(187),Bl(241),Pl(),Ja(),Bl(30),Ml(61),Bl(15),Ml(7),Bl(29),Pl(),l(),sc.endNonterminal(\"ModuleDecl\",$l)}function f(){sc.startNonterminal(\"Prolog\",$l);for(;;){Bl(279);switch(Jl){case 109:jl(208);break;case 155:jl(170);break;default:Xl=Jl}if(Xl!=43117&&Xl!=44141&&Xl!=50797&&Xl!=53869&&Xl!=54893&&Xl!=56429&&Xl!=73325&&Xl!=94875&&Xl!=95853&&Xl!=106093&&Xl!=115821&&Xl!=117403)break;switch(Jl){case 109:jl(199);break;default:Xl=Jl}if(Xl==56429){Xl=Ul(0,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{M(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(0,$l,Xl)}}switch(Xl){case-1:Pl(),O();break;case 95853:Pl(),A();break;case 155:Pl(),N();break;case 73325:Pl(),_();break;default:Pl(),c()}Bl(29),Pl(),l()}for(;;){Bl(279);switch(Jl){case 109:jl(201);break;default:Xl=Jl}if(Xl!=17005&&Xl!=49261&&Xl!=52333&&Xl!=75373&&Xl!=80493&&Xl!=83565&&Xl!=104045&&Xl!=134765&&Xl!=137325)break;switch(Jl){case 109:jl(197);break;default:Xl=Jl}switch(Xl){case 52333:Pl(),q();break;case 104045:Pl(),K();break;default:Pl(),D()}Bl(29),Pl(),l()}sc.endNonterminal(\"Prolog\",$l)}function l(){sc.startNonterminal(\"Separator\",$l),Ml(54),sc.endNonterminal(\"Separator\",$l)}function c(){sc.startNonterminal(\"Setter\",$l);switch(Jl){case 109:jl(195);break;default:Xl=Jl}if(Xl==56429){Xl=Ul(1,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{d(),Xl=-2}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),b(),Xl=-6}catch(f){Xl=-9}}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(1,$l,Xl)}}switch(Xl){case 44141:h();break;case-2:p();break;case 43117:v();break;case 50797:m();break;case 106093:g();break;case-6:y();break;case 115821:Bo();break;case 53869:w();break;default:x()}sc.endNonterminal(\"Setter\",$l)}function h(){sc.startNonterminal(\"BoundarySpaceDecl\",$l),Ml(109),Bl(36),Ml(86),Bl(135);switch(Jl){case 218:Ml(218);break;default:Ml(246)}sc.endNonterminal(\"BoundarySpaceDecl\",$l)}function p(){sc.startNonterminal(\"DefaultCollationDecl\",$l),Ml(109),Bl(49),Ml(110),Bl(41),Ml(95),Bl(15),Ml(7),sc.endNonterminal(\"DefaultCollationDecl\",$l)}function d(){_l(109),Bl(49),_l(110),Bl(41),_l(95),Bl(15),_l(7)}function v(){sc.startNonterminal(\"BaseURIDecl\",$l),Ml(109),Bl(35),Ml(84),Bl(15),Ml(7),sc.endNonterminal(\"BaseURIDecl\",$l)}function m(){sc.startNonterminal(\"ConstructionDecl\",$l),Ml(109),Bl(44),Ml(99),Bl(135);switch(Jl){case 246:Ml(246);break;default:Ml(218)}sc.endNonterminal(\"ConstructionDecl\",$l)}function g(){sc.startNonterminal(\"OrderingModeDecl\",$l),Ml(109),Bl(71),Ml(207),Bl(133);switch(Jl){case 206:Ml(206);break;default:Ml(262)}sc.endNonterminal(\"OrderingModeDecl\",$l)}function y(){sc.startNonterminal(\"EmptyOrderDecl\",$l),Ml(109),Bl(49),Ml(110),Bl(70),Ml(205),Bl(52),Ml(124),Bl(123);switch(Jl){case 149:Ml(149);break;default:Ml(176)}sc.endNonterminal(\"EmptyOrderDecl\",$l)}function b(){_l(109),Bl(49),_l(110),Bl(70),_l(205),Bl(52),_l(124),Bl(123);switch(Jl){case 149:_l(149);break;default:_l(176)}}function w(){sc.startNonterminal(\"CopyNamespacesDecl\",$l),Ml(109),Bl(47),Ml(105),Bl(130),Pl(),E(),Bl(25),Ml(42),Bl(125),Pl(),S(),sc.endNonterminal(\"CopyNamespacesDecl\",$l)}function E(){sc.startNonterminal(\"PreserveMode\",$l);switch(Jl){case 218:Ml(218);break;default:Ml(193)}sc.endNonterminal(\"PreserveMode\",$l)}function S(){sc.startNonterminal(\"InheritMode\",$l);switch(Jl){case 159:Ml(159);break;default:Ml(192)}sc.endNonterminal(\"InheritMode\",$l)}function x(){sc.startNonterminal(\"DecimalFormatDecl\",$l),Ml(109),Bl(116);switch(Jl){case 107:Ml(107),Bl(247),Pl(),Wa();break;default:Ml(110),Bl(48),Ml(107)}for(;;){Bl(203);if(Jl==54)break;Pl(),T(),Bl(30),Ml(61),Bl(17),Ml(11)}sc.endNonterminal(\"DecimalFormatDecl\",$l)}function T(){sc.startNonterminal(\"DFPropertyName\",$l);switch(Jl){case 108:Ml(108);break;case 151:Ml(151);break;case 158:Ml(158);break;case 182:Ml(182);break;case 68:Ml(68);break;case 213:Ml(213);break;case 212:Ml(212);break;case 280:Ml(280);break;case 117:Ml(117);break;default:Ml(211)}sc.endNonterminal(\"DFPropertyName\",$l)}function N(){sc.startNonterminal(\"Import\",$l);switch(Jl){case 155:jl(128);break;default:Xl=Jl}switch(Xl){case 117403:C();break;default:L()}sc.endNonterminal(\"Import\",$l)}function C(){sc.startNonterminal(\"SchemaImport\",$l),Ml(155),Bl(75),Ml(229),Bl(139),Jl!=7&&(Pl(),k()),Bl(15),Ml(7),Bl(110);if(Jl==82){Ml(82),Bl(15),Ml(7);for(;;){Bl(105);if(Jl!=42)break;Ml(42),Bl(15),Ml(7)}}sc.endNonterminal(\"SchemaImport\",$l)}function k(){sc.startNonterminal(\"SchemaPrefix\",$l);switch(Jl){case 187:Ml(187),Bl(241),Pl(),Ja(),Bl(30),Ml(61);break;default:Ml(110),Bl(50),Ml(122),Bl(64),Ml(187)}sc.endNonterminal(\"SchemaPrefix\",$l)}function L(){sc.startNonterminal(\"ModuleImport\",$l),Ml(155),Bl(63),Ml(185),Bl(92),Jl==187&&(Ml(187),Bl(241),Pl(),Ja(),Bl(30),Ml(61)),Bl(15),Ml(7),Bl(110);if(Jl==82){Ml(82),Bl(15),Ml(7);for(;;){Bl(105);if(Jl!=42)break;Ml(42),Bl(15),Ml(7)}}sc.endNonterminal(\"ModuleImport\",$l)}function A(){sc.startNonterminal(\"NamespaceDecl\",$l),Ml(109),Bl(64),Ml(187),Bl(241),Pl(),Ja(),Bl(30),Ml(61),Bl(15),Ml(7),sc.endNonterminal(\"NamespaceDecl\",$l)}function O(){sc.startNonterminal(\"DefaultNamespaceDecl\",$l),Ml(109),Bl(49),Ml(110),Bl(117);switch(Jl){case 122:Ml(122);break;default:Ml(147)}Bl(64),Ml(187),Bl(15),Ml(7),sc.endNonterminal(\"DefaultNamespaceDecl\",$l)}function M(){_l(109),Bl(49),_l(110),Bl(117);switch(Jl){case 122:_l(122);break;default:_l(147)}Bl(64),_l(187),Bl(15),_l(7)}function _(){sc.startNonterminal(\"FTOptionDecl\",$l),Ml(109),Bl(55),Ml(143),Bl(83),Pl(),$u(),sc.endNonterminal(\"FTOptionDecl\",$l)}function D(){sc.startNonterminal(\"AnnotatedDecl\",$l),Ml(109);for(;;){Bl(193);if(Jl!=33&&Jl!=263)break;switch(Jl){case 263:Pl(),P();break;default:Pl(),H()}}switch(Jl){case 268:Pl(),j();break;case 147:Pl(),Al();break;case 96:Pl(),xa();break;case 157:Pl(),_a();break;default:Pl(),Da()}sc.endNonterminal(\"AnnotatedDecl\",$l)}function P(){sc.startNonterminal(\"CompatibilityAnnotation\",$l),Ml(263),sc.endNonterminal(\"CompatibilityAnnotation\",$l)}function H(){sc.startNonterminal(\"Annotation\",$l),Ml(33),Bl(247),Pl(),Wa(),Bl(194);if(Jl==35){Ml(35),Bl(191),Pl(),ci();for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(191),Pl(),ci()}Ml(38)}sc.endNonterminal(\"Annotation\",$l)}function B(){_l(33),Bl(247),Xa(),Bl(194);if(Jl==35){_l(35),Bl(191),hi();for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(191),hi()}_l(38)}}function j(){sc.startNonterminal(\"VarDecl\",$l),Ml(268),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(156),Jl==80&&(Pl(),xs()),Bl(108);switch(Jl){case 53:Ml(53),Bl(268),Pl(),F();break;default:Ml(134),Bl(106),Jl==53&&(Ml(53),Bl(268),Pl(),I())}sc.endNonterminal(\"VarDecl\",$l)}function F(){sc.startNonterminal(\"VarValue\",$l),Rf(),sc.endNonterminal(\"VarValue\",$l)}function I(){sc.startNonterminal(\"VarDefaultValue\",$l),Rf(),sc.endNonterminal(\"VarDefaultValue\",$l)}function q(){sc.startNonterminal(\"ContextItemDecl\",$l),Ml(109),Bl(46),Ml(102),Bl(58),Ml(167),Bl(156),Jl==80&&(Ml(80),Bl(255),Pl(),As()),Bl(108);switch(Jl){case 53:Ml(53),Bl(268),Pl(),F();break;default:Ml(134),Bl(106),Jl==53&&(Ml(53),Bl(268),Pl(),I())}sc.endNonterminal(\"ContextItemDecl\",$l)}function R(){sc.startNonterminal(\"ParamList\",$l),z();for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(21),Pl(),z()}sc.endNonterminal(\"ParamList\",$l)}function U(){W();for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(21),W()}}function z(){sc.startNonterminal(\"Param\",$l),Ml(31),Bl(247),Pl(),Wa(),Bl(152),Jl==80&&(Pl(),xs()),sc.endNonterminal(\"Param\",$l)}function W(){_l(31),Bl(247),Xa(),Bl(152),Jl==80&&Ts()}function X(){sc.startNonterminal(\"FunctionBody\",$l),$(),sc.endNonterminal(\"FunctionBody\",$l)}function V(){J()}function $(){sc.startNonterminal(\"EnclosedExpr\",$l),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"EnclosedExpr\",$l)}function J(){_l(281),Bl(268),G(),_l(287)}function K(){sc.startNonterminal(\"OptionDecl\",$l),Ml(109),Bl(69),Ml(203),Bl(247),Pl(),Wa(),Bl(17),Ml(11),sc.endNonterminal(\"OptionDecl\",$l)}function Q(){sc.startNonterminal(\"Expr\",$l),Rf();for(;;){if(Jl!=42)break;Ml(42),Bl(268),Pl(),Rf()}sc.endNonterminal(\"Expr\",$l)}function G(){Uf();for(;;){if(Jl!=42)break;_l(42),Bl(268),Uf()}}function Y(){sc.startNonterminal(\"FLWORExpr\",$l),et();for(;;){Bl(200);if(Jl==224||Jl==233)break;Pl(),nt()}Pl(),nn(),sc.endNonterminal(\"FLWORExpr\",$l)}function Z(){tt();for(;;){Bl(200);if(Jl==224||Jl==233)break;rt()}rn()}function et(){sc.startNonterminal(\"InitialClause\",$l);switch(Jl){case 139:case 142:jl(150);break;default:Xl=Jl}switch(Xl){case 16011:case 16014:it();break;case 177:dt();break;default:yt()}sc.endNonterminal(\"InitialClause\",$l)}function tt(){switch(Jl){case 139:case 142:jl(150);break;default:Xl=Jl}switch(Xl){case 16011:case 16014:st();break;case 177:vt();break;default:bt()}}function nt(){sc.startNonterminal(\"IntermediateClause\",$l);switch(Jl){case 272:Ft();break;case 150:qt();break;case 205:case 241:Jt();break;case 106:Bt();break;default:et()}sc.endNonterminal(\"IntermediateClause\",$l)}function rt(){switch(Jl){case 272:It();break;case 150:Rt();break;case 205:case 241:Kt();break;case 106:jt();break;default:tt()}}function it(){sc.startNonterminal(\"ForClause\",$l);switch(Jl){case 139:Ml(139);break;default:Ml(142)}Bl(21),Pl(),ot();for(;;){if(Jl!=42)break;Ml(42),Bl(21),Pl(),ot()}sc.endNonterminal(\"ForClause\",$l)}function st(){switch(Jl){case 139:_l(139);break;default:_l(142)}Bl(21),ut();for(;;){if(Jl!=42)break;_l(42),Bl(21),ut()}}function ot(){sc.startNonterminal(\"ForBinding\",$l),Ml(31),Bl(247),Pl(),Ei(),Bl(183),Jl==80&&(Pl(),xs()),Bl(174),Jl==73&&(Pl(),at()),Bl(159),Jl==82&&(Pl(),lt()),Bl(124),Jl==232&&(Pl(),ht()),Bl(56),Ml(156),Bl(268),Pl(),Rf(),sc.endNonterminal(\"ForBinding\",$l)}function ut(){_l(31),Bl(247),Si(),Bl(183),Jl==80&&Ts(),Bl(174),Jl==73&&ft(),Bl(159),Jl==82&&ct(),Bl(124),Jl==232&&pt(),Bl(56),_l(156),Bl(268),Uf()}function at(){sc.startNonterminal(\"AllowingEmpty\",$l),Ml(73),Bl(52),Ml(124),sc.endNonterminal(\"AllowingEmpty\",$l)}function ft(){_l(73),Bl(52),_l(124)}function lt(){sc.startNonterminal(\"PositionalVar\",$l),Ml(82),Bl(21),Ml(31),Bl(247),Pl(),Ei(),sc.endNonterminal(\"PositionalVar\",$l)}function ct(){_l(82),Bl(21),_l(31),Bl(247),Si()}function ht(){sc.startNonterminal(\"FTScoreVar\",$l),Ml(232),Bl(21),Ml(31),Bl(247),Pl(),Ei(),sc.endNonterminal(\"FTScoreVar\",$l)}function pt(){_l(232),Bl(21),_l(31),Bl(247),Si()}function dt(){sc.startNonterminal(\"LetClause\",$l),Ml(177),Bl(98),Pl(),mt();for(;;){if(Jl!=42)break;Ml(42),Bl(98),Pl(),mt()}sc.endNonterminal(\"LetClause\",$l)}function vt(){_l(177),Bl(98),gt();for(;;){if(Jl!=42)break;_l(42),Bl(98),gt()}}function mt(){sc.startNonterminal(\"LetBinding\",$l);switch(Jl){case 31:Ml(31),Bl(247),Pl(),Ei(),Bl(107),Jl==80&&(Pl(),xs());break;default:ht()}Bl(28),Ml(53),Bl(268),Pl(),Rf(),sc.endNonterminal(\"LetBinding\",$l)}function gt(){switch(Jl){case 31:_l(31),Bl(247),Si(),Bl(107),Jl==80&&Ts();break;default:pt()}Bl(28),_l(53),Bl(268),Uf()}function yt(){sc.startNonterminal(\"WindowClause\",$l);switch(Jl){case 139:Ml(139);break;default:Ml(142)}Bl(137);switch(Jl){case 257:Pl(),wt();break;default:Pl(),St()}sc.endNonterminal(\"WindowClause\",$l)}function bt(){switch(Jl){case 139:_l(139);break;default:_l(142)}Bl(137);switch(Jl){case 257:Et();break;default:xt()}}function wt(){sc.startNonterminal(\"TumblingWindowClause\",$l),Ml(257),Bl(87),Ml(275),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(112),Jl==80&&(Pl(),xs()),Bl(56),Ml(156),Bl(268),Pl(),Rf(),Pl(),Tt();if(Jl==127||Jl==202)Pl(),Ct();sc.endNonterminal(\"TumblingWindowClause\",$l)}function Et(){_l(257),Bl(87),_l(275),Bl(21),_l(31),Bl(247),Si(),Bl(112),Jl==80&&Ts(),Bl(56),_l(156),Bl(268),Uf(),Nt(),(Jl==127||Jl==202)&&kt()}function St(){sc.startNonterminal(\"SlidingWindowClause\",$l),Ml(239),Bl(87),Ml(275),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(112),Jl==80&&(Pl(),xs()),Bl(56),Ml(156),Bl(268),Pl(),Rf(),Pl(),Tt(),Pl(),Ct(),sc.endNonterminal(\"SlidingWindowClause\",$l)}function xt(){_l(239),Bl(87),_l(275),Bl(21),_l(31),Bl(247),Si(),Bl(112),Jl==80&&Ts(),Bl(56),_l(156),Bl(268),Uf(),Nt(),kt()}function Tt(){sc.startNonterminal(\"WindowStartCondition\",$l),Ml(242),Bl(182),Pl(),Lt(),Bl(85),Ml(271),Bl(268),Pl(),Rf(),sc.endNonterminal(\"WindowStartCondition\",$l)}function Nt(){_l(242),Bl(182),At(),Bl(85),_l(271),Bl(268),Uf()}function Ct(){sc.startNonterminal(\"WindowEndCondition\",$l),Jl==202&&Ml(202),Bl(53),Ml(127),Bl(182),Pl(),Lt(),Bl(85),Ml(271),Bl(268),Pl(),Rf(),sc.endNonterminal(\"WindowEndCondition\",$l)}function kt(){Jl==202&&_l(202),Bl(53),_l(127),Bl(182),At(),Bl(85),_l(271),Bl(268),Uf()}function Lt(){sc.startNonterminal(\"WindowVars\",$l),Jl==31&&(Ml(31),Bl(247),Pl(),Ot()),Bl(175),Jl==82&&(Pl(),lt()),Bl(162),Jl==219&&(Ml(219),Bl(21),Ml(31),Bl(247),Pl(),_t()),Bl(129),Jl==190&&(Ml(190),Bl(21),Ml(31),Bl(247),Pl(),Pt()),sc.endNonterminal(\"WindowVars\",$l)}function At(){Jl==31&&(_l(31),Bl(247),Mt()),Bl(175),Jl==82&&ct(),Bl(162),Jl==219&&(_l(219),Bl(21),_l(31),Bl(247),Dt()),Bl(129),Jl==190&&(_l(190),Bl(21),_l(31),Bl(247),Ht())}function Ot(){sc.startNonterminal(\"CurrentItem\",$l),Wa(),sc.endNonterminal(\"CurrentItem\",$l)}function Mt(){Xa()}function _t(){sc.startNonterminal(\"PreviousItem\",$l),Wa(),sc.endNonterminal(\"PreviousItem\",$l)}function Dt(){Xa()}function Pt(){sc.startNonterminal(\"NextItem\",$l),Wa(),sc.endNonterminal(\"NextItem\",$l)}function Ht(){Xa()}function Bt(){sc.startNonterminal(\"CountClause\",$l),Ml(106),Bl(21),Ml(31),Bl(247),Pl(),Ei(),sc.endNonterminal(\"CountClause\",$l)}function jt(){_l(106),Bl(21),_l(31),Bl(247),Si()}function Ft(){sc.startNonterminal(\"WhereClause\",$l),Ml(272),Bl(268),Pl(),Rf(),sc.endNonterminal(\"WhereClause\",$l)}function It(){_l(272),Bl(268),Uf()}function qt(){sc.startNonterminal(\"GroupByClause\",$l),Ml(150),Bl(37),Ml(88),Bl(268),Pl(),Ut(),sc.endNonterminal(\"GroupByClause\",$l)}function Rt(){_l(150),Bl(37),_l(88),Bl(268),zt()}function Ut(){sc.startNonterminal(\"GroupingSpecList\",$l),Wt();for(;;){Bl(202);if(Jl!=42)break;Ml(42),Bl(268),Pl(),Wt()}sc.endNonterminal(\"GroupingSpecList\",$l)}function zt(){Xt();for(;;){Bl(202);if(Jl!=42)break;_l(42),Bl(268),Xt()}}function Wt(){sc.startNonterminal(\"GroupingSpec\",$l);switch(Jl){case 31:jl(247);break;default:Xl=Jl}if(Xl==3103||Xl==36383||Xl==37407||Xl==37919||Xl==38431||Xl==38943||Xl==39967||Xl==40479||Xl==40991||Xl==41503||Xl==42015||Xl==42527||Xl==43039||Xl==43551||Xl==44063||Xl==44575||Xl==45599||Xl==46111||Xl==46623||Xl==47135||Xl==48159||Xl==48671||Xl==49695||Xl==50207||Xl==50719||Xl==52255||Xl==52767||Xl==53279||Xl==53791||Xl==54303||Xl==54815||Xl==55839||Xl==56351||Xl==56863||Xl==57375||Xl==57887||Xl==58399||Xl==60959||Xl==61471||Xl==61983||Xl==62495||Xl==63007||Xl==63519||Xl==64031||Xl==64543||Xl==65055||Xl==66079||Xl==66591||Xl==67615||Xl==68127||Xl==68639||Xl==69151||Xl==69663||Xl==70175||Xl==70687||Xl==71199||Xl==72735||Xl==73247||Xl==75295||Xl==75807||Xl==76831||Xl==77855||Xl==78367||Xl==78879||Xl==79391||Xl==79903||Xl==80415||Xl==82463||Xl==82975||Xl==83487||Xl==83999||Xl==84511||Xl==85023||Xl==85535||Xl==86047||Xl==86559||Xl==87071||Xl==88607||Xl==89119||Xl==89631||Xl==90655||Xl==91679||Xl==92703||Xl==93727||Xl==94239||Xl==94751||Xl==95775||Xl==96287||Xl==96799||Xl==99359||Xl==99871||Xl==100895||Xl==101407||Xl==103455||Xl==103967||Xl==104479||Xl==104991||Xl==105503||Xl==106015||Xl==107551||Xl==110623||Xl==111135||Xl==112671||Xl==113695||Xl==114207||Xl==114719||Xl==115231||Xl==115743||Xl==116767||Xl==117279||Xl==117791||Xl==118303||Xl==118815||Xl==119327||Xl==119839||Xl==122399||Xl==122911||Xl==123423||Xl==123935||Xl==125471||Xl==126495||Xl==127007||Xl==127519||Xl==129567||Xl==130079||Xl==130591||Xl==131103||Xl==131615||Xl==132127||Xl==132639||Xl==133151||Xl==134175||Xl==134687||Xl==136223||Xl==136735||Xl==137247||Xl==137759||Xl==139295||Xl==139807||Xl==141343){Xl=Ul(2,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{$t(),Bl(207);if(Jl==53||Jl==80)Jl==80&&Ts(),Bl(28),_l(53),Bl(268),Uf();Jl==95&&(_l(95),Bl(15),_l(7)),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(2,$l,Xl)}}switch(Xl){case-1:Vt(),Bl(207);if(Jl==53||Jl==80)Jl==80&&(Pl(),xs()),Bl(28),Ml(53),Bl(268),Pl(),Rf();Jl==95&&(Ml(95),Bl(15),Ml(7));break;default:Rf()}sc.endNonterminal(\"GroupingSpec\",$l)}function Xt(){switch(Jl){case 31:jl(247);break;default:Xl=Jl}if(Xl==3103||Xl==36383||Xl==37407||Xl==37919||Xl==38431||Xl==38943||Xl==39967||Xl==40479||Xl==40991||Xl==41503||Xl==42015||Xl==42527||Xl==43039||Xl==43551||Xl==44063||Xl==44575||Xl==45599||Xl==46111||Xl==46623||Xl==47135||Xl==48159||Xl==48671||Xl==49695||Xl==50207||Xl==50719||Xl==52255||Xl==52767||Xl==53279||Xl==53791||Xl==54303||Xl==54815||Xl==55839||Xl==56351||Xl==56863||Xl==57375||Xl==57887||Xl==58399||Xl==60959||Xl==61471||Xl==61983||Xl==62495||Xl==63007||Xl==63519||Xl==64031||Xl==64543||Xl==65055||Xl==66079||Xl==66591||Xl==67615||Xl==68127||Xl==68639||Xl==69151||Xl==69663||Xl==70175||Xl==70687||Xl==71199||Xl==72735||Xl==73247||Xl==75295||Xl==75807||Xl==76831||Xl==77855||Xl==78367||Xl==78879||Xl==79391||Xl==79903||Xl==80415||Xl==82463||Xl==82975||Xl==83487||Xl==83999||Xl==84511||Xl==85023||Xl==85535||Xl==86047||Xl==86559||Xl==87071||Xl==88607||Xl==89119||Xl==89631||Xl==90655||Xl==91679||Xl==92703||Xl==93727||Xl==94239||Xl==94751||Xl==95775||Xl==96287||Xl==96799||Xl==99359||Xl==99871||Xl==100895||Xl==101407||Xl==103455||Xl==103967||Xl==104479||Xl==104991||Xl==105503||Xl==106015||Xl==107551||Xl==110623||Xl==111135||Xl==112671||Xl==113695||Xl==114207||Xl==114719||Xl==115231||Xl==115743||Xl==116767||Xl==117279||Xl==117791||Xl==118303||Xl==118815||Xl==119327||Xl==119839||Xl==122399||Xl==122911||Xl==123423||Xl==123935||Xl==125471||Xl==126495||Xl==127007||Xl==127519||Xl==129567||Xl==130079||Xl==130591||Xl==131103||Xl==131615||Xl==132127||Xl==132639||Xl==133151||Xl==134175||Xl==134687||Xl==136223||Xl==136735||Xl==137247||Xl==137759||Xl==139295||Xl==139807||Xl==141343){Xl=Ul(2,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{$t(),Bl(207);if(Jl==53||Jl==80)Jl==80&&Ts(),Bl(28),_l(53),Bl(268),Uf();Jl==95&&(_l(95),Bl(15),_l(7)),Rl(2,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(2,t,-2)}}}switch(Xl){case-1:$t(),Bl(207);if(Jl==53||Jl==80)Jl==80&&Ts(),Bl(28),_l(53),Bl(268),Uf();Jl==95&&(_l(95),Bl(15),_l(7));break;case-3:break;default:Uf()}}function Vt(){sc.startNonterminal(\"GroupingVariable\",$l),Ml(31),Bl(247),Pl(),Ei(),sc.endNonterminal(\"GroupingVariable\",$l)}function $t(){_l(31),Bl(247),Si()}function Jt(){sc.startNonterminal(\"OrderByClause\",$l);switch(Jl){case 205:Ml(205),Bl(37),Ml(88);break;default:Ml(241),Bl(70),Ml(205),Bl(37),Ml(88)}Bl(268),Pl(),Qt(),sc.endNonterminal(\"OrderByClause\",$l)}function Kt(){switch(Jl){case 205:_l(205),Bl(37),_l(88);break;default:_l(241),Bl(70),_l(205),Bl(37),_l(88)}Bl(268),Gt()}function Qt(){sc.startNonterminal(\"OrderSpecList\",$l),Yt();for(;;){Bl(202);if(Jl!=42)break;Ml(42),Bl(268),Pl(),Yt()}sc.endNonterminal(\"OrderSpecList\",$l)}function Gt(){Zt();for(;;){Bl(202);if(Jl!=42)break;_l(42),Bl(268),Zt()}}function Yt(){sc.startNonterminal(\"OrderSpec\",$l),Rf(),Pl(),en(),sc.endNonterminal(\"OrderSpec\",$l)}function Zt(){Uf(),tn()}function en(){sc.startNonterminal(\"OrderModifier\",$l);if(Jl==81||Jl==114)switch(Jl){case 81:Ml(81);break;default:Ml(114)}Bl(206);if(Jl==124){Ml(124),Bl(123);switch(Jl){case 149:Ml(149);break;default:Ml(176)}}Bl(205),Jl==95&&(Ml(95),Bl(15),Ml(7)),sc.endNonterminal(\"OrderModifier\",$l)}function tn(){if(Jl==81||Jl==114)switch(Jl){case 81:_l(81);break;default:_l(114)}Bl(206);if(Jl==124){_l(124),Bl(123);switch(Jl){case 149:_l(149);break;default:_l(176)}}Bl(205),Jl==95&&(_l(95),Bl(15),_l(7))}function nn(){sc.startNonterminal(\"ReturnClause\",$l);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(268),Pl(),Rf(),sc.endNonterminal(\"ReturnClause\",$l)}function rn(){switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(268),Uf()}function sn(){sc.startNonterminal(\"QuantifiedExpr\",$l);switch(Jl){case 240:Ml(240);break;default:Ml(130)}Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(112),Jl==80&&(Pl(),xs()),Bl(56),Ml(156),Bl(268),Pl(),Rf();for(;;){if(Jl!=42)break;Ml(42),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(112),Jl==80&&(Pl(),xs()),Bl(56),Ml(156),Bl(268),Pl(),Rf()}Ml(228),Bl(268),Pl(),Rf(),sc.endNonterminal(\"QuantifiedExpr\",$l)}function on(){switch(Jl){case 240:_l(240);break;default:_l(130)}Bl(21),_l(31),Bl(247),Si(),Bl(112),Jl==80&&Ts(),Bl(56),_l(156),Bl(268),Uf();for(;;){if(Jl!=42)break;_l(42),Bl(21),_l(31),Bl(247),Si(),Bl(112),Jl==80&&Ts(),Bl(56),_l(156),Bl(268),Uf()}_l(228),Bl(268),Uf()}function un(){sc.startNonterminal(\"SwitchExpr\",$l),Ml(248),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38);for(;;){Bl(38),Pl(),fn();if(Jl!=89)break}Ml(110),Bl(136);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(268),Pl(),Rf(),sc.endNonterminal(\"SwitchExpr\",$l)}function an(){_l(248),Bl(22),_l(35),Bl(268),G(),_l(38);for(;;){Bl(38),ln();if(Jl!=89)break}_l(110),Bl(136);switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(268),Uf()}function fn(){sc.startNonterminal(\"SwitchCaseClause\",$l);for(;;){Ml(89),Bl(268),Pl(),cn();if(Jl!=89)break}switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(268),Pl(),Rf(),sc.endNonterminal(\"SwitchCaseClause\",$l)}function ln(){for(;;){_l(89),Bl(268),hn();if(Jl!=89)break}switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(268),Uf()}function cn(){sc.startNonterminal(\"SwitchCaseOperand\",$l),Rf(),sc.endNonterminal(\"SwitchCaseOperand\",$l)}function hn(){Uf()}function pn(){sc.startNonterminal(\"TypeswitchExpr\",$l),Ml(259),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38);for(;;){Bl(38),Pl(),vn();if(Jl!=89)break}Ml(110),Bl(149),Jl==31&&(Ml(31),Bl(247),Pl(),Ei()),Bl(136);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(268),Pl(),Rf(),sc.endNonterminal(\"TypeswitchExpr\",$l)}function dn(){_l(259),Bl(22),_l(35),Bl(268),G(),_l(38);for(;;){Bl(38),mn();if(Jl!=89)break}_l(110),Bl(149),Jl==31&&(_l(31),Bl(247),Si()),Bl(136);switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(268),Uf()}function vn(){sc.startNonterminal(\"CaseClause\",$l),Ml(89),Bl(259),Jl==31&&(Ml(31),Bl(247),Pl(),Ei(),Bl(33),Ml(80)),Bl(255),Pl(),gn();switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(268),Pl(),Rf(),sc.endNonterminal(\"CaseClause\",$l)}function mn(){_l(89),Bl(259),Jl==31&&(_l(31),Bl(247),Si(),Bl(33),_l(80)),Bl(255),yn();switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(268),Uf()}function gn(){sc.startNonterminal(\"SequenceTypeUnion\",$l),Ns();for(;;){Bl(163);if(Jl!=284)break;Ml(284),Bl(255),Pl(),Ns()}sc.endNonterminal(\"SequenceTypeUnion\",$l)}function yn(){Cs();for(;;){Bl(163);if(Jl!=284)break;_l(284),Bl(255),Cs()}}function bn(){sc.startNonterminal(\"IfExpr\",$l),Ml(154),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38),Bl(79),Ml(250),Bl(268),Pl(),Rf(),Ml(123),Bl(268),Pl(),Rf(),sc.endNonterminal(\"IfExpr\",$l)}function wn(){_l(154),Bl(22),_l(35),Bl(268),G(),_l(38),Bl(79),_l(250),Bl(268),Uf(),_l(123),Bl(268),Uf()}function En(){sc.startNonterminal(\"TryCatchExpr\",$l),xn();for(;;){Bl(39),Pl(),kn(),Bl(209);if(Jl!=92)break}sc.endNonterminal(\"TryCatchExpr\",$l)}function Sn(){Tn();for(;;){Bl(39),Ln(),Bl(209);if(Jl!=92)break}}function xn(){sc.startNonterminal(\"TryClause\",$l),Ml(256),Bl(89),Ml(281),Bl(268),Pl(),Nn(),Ml(287),sc.endNonterminal(\"TryClause\",$l)}function Tn(){_l(256),Bl(89),_l(281),Bl(268),Cn(),_l(287)}function Nn(){sc.startNonterminal(\"TryTargetExpr\",$l),Q(),sc.endNonterminal(\"TryTargetExpr\",$l)}function Cn(){G()}function kn(){sc.startNonterminal(\"CatchClause\",$l),Ml(92),Bl(250),Pl(),An(),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"CatchClause\",$l)}function Ln(){_l(92),Bl(250),On(),_l(281),Bl(268),G(),_l(287)}function An(){sc.startNonterminal(\"CatchErrorList\",$l),Kr();for(;;){Bl(138);if(Jl!=284)break;Ml(284),Bl(250),Pl(),Kr()}sc.endNonterminal(\"CatchErrorList\",$l)}function On(){Qr();for(;;){Bl(138);if(Jl!=284)break;_l(284),Bl(250),Qr()}}function Mn(){sc.startNonterminal(\"OrExpr\",$l),Dn();for(;;){if(Jl!=204)break;Ml(204),Bl(268),Pl(),Dn()}sc.endNonterminal(\"OrExpr\",$l)}function _n(){Pn();for(;;){if(Jl!=204)break;_l(204),Bl(268),Pn()}}function Dn(){sc.startNonterminal(\"AndExpr\",$l),Hn();for(;;){if(Jl!=76)break;Ml(76),Bl(268),Pl(),Hn()}sc.endNonterminal(\"AndExpr\",$l)}function Pn(){Bn();for(;;){if(Jl!=76)break;_l(76),Bl(268),Bn()}}function Hn(){sc.startNonterminal(\"NotExpr\",$l);for(;;){Bl(268);if(Jl!=196)break;Ml(196)}Pl(),jn(),sc.endNonterminal(\"NotExpr\",$l)}function Bn(){for(;;){Bl(268);if(Jl!=196)break;_l(196)}Fn()}function jn(){sc.startNonterminal(\"ComparisonExpr\",$l),In();if(Jl==27||Jl==55||Jl==58||Jl==59||Jl==61||Jl==62||Jl==63||Jl==64||Jl==129||Jl==148||Jl==152||Jl==166||Jl==175||Jl==181||Jl==189){switch(Jl){case 129:case 148:case 152:case 175:case 181:case 189:Pl(),vr();break;case 58:case 64:case 166:Pl(),gr();break;default:Pl(),pr()}Bl(267),Pl(),In()}sc.endNonterminal(\"ComparisonExpr\",$l)}function Fn(){qn();if(Jl==27||Jl==55||Jl==58||Jl==59||Jl==61||Jl==62||Jl==63||Jl==64||Jl==129||Jl==148||Jl==152||Jl==166||Jl==175||Jl==181||Jl==189){switch(Jl){case 129:case 148:case 152:case 175:case 181:case 189:mr();break;case 58:case 64:case 166:yr();break;default:dr()}Bl(267),qn()}}function In(){sc.startNonterminal(\"FTContainsExpr\",$l),Rn(),Jl==100&&(Ml(100),Bl(78),Ml(249),Bl(178),Pl(),ru(),Jl==277&&(Pl(),Ea())),sc.endNonterminal(\"FTContainsExpr\",$l)}function qn(){Un(),Jl==100&&(_l(100),Bl(78),_l(249),Bl(178),iu(),Jl==277&&Sa())}function Rn(){sc.startNonterminal(\"StringConcatExpr\",$l),zn();for(;;){if(Jl!=285)break;Ml(285),Bl(267),Pl(),zn()}sc.endNonterminal(\"StringConcatExpr\",$l)}function Un(){Wn();for(;;){if(Jl!=285)break;_l(285),Bl(267),Wn()}}function zn(){sc.startNonterminal(\"RangeExpr\",$l),Xn(),Jl==253&&(Ml(253),Bl(267),Pl(),Xn()),sc.endNonterminal(\"RangeExpr\",$l)}function Wn(){Vn(),Jl==253&&(_l(253),Bl(267),Vn())}function Xn(){sc.startNonterminal(\"AdditiveExpr\",$l),$n();for(;;){if(Jl!=41&&Jl!=43)break;switch(Jl){case 41:Ml(41);break;default:Ml(43)}Bl(267),Pl(),$n()}sc.endNonterminal(\"AdditiveExpr\",$l)}function Vn(){Jn();for(;;){if(Jl!=41&&Jl!=43)break;switch(Jl){case 41:_l(41);break;default:_l(43)}Bl(267),Jn()}}function $n(){sc.startNonterminal(\"MultiplicativeExpr\",$l),Kn();for(;;){if(Jl!=39&&Jl!=119&&Jl!=153&&Jl!=183)break;switch(Jl){case 39:Ml(39);break;case 119:Ml(119);break;case 153:Ml(153);break;default:Ml(183)}Bl(267),Pl(),Kn()}sc.endNonterminal(\"MultiplicativeExpr\",$l)}function Jn(){Qn();for(;;){if(Jl!=39&&Jl!=119&&Jl!=153&&Jl!=183)break;switch(Jl){case 39:_l(39);break;case 119:_l(119);break;case 153:_l(153);break;default:_l(183)}Bl(267),Qn()}}function Kn(){sc.startNonterminal(\"UnionExpr\",$l),Gn();for(;;){if(Jl!=260&&Jl!=284)break;switch(Jl){case 260:Ml(260);break;default:Ml(284)}Bl(267),Pl(),Gn()}sc.endNonterminal(\"UnionExpr\",$l)}function Qn(){Yn();for(;;){if(Jl!=260&&Jl!=284)break;switch(Jl){case 260:_l(260);break;default:_l(284)}Bl(267),Yn()}}function Gn(){sc.startNonterminal(\"IntersectExceptExpr\",$l),Zn();for(;;){Bl(223);if(Jl!=132&&Jl!=164)break;switch(Jl){case 164:Ml(164);break;default:Ml(132)}Bl(267),Pl(),Zn()}sc.endNonterminal(\"IntersectExceptExpr\",$l)}function Yn(){er();for(;;){Bl(223);if(Jl!=132&&Jl!=164)break;switch(Jl){case 164:_l(164);break;default:_l(132)}Bl(267),er()}}function Zn(){sc.startNonterminal(\"InstanceofExpr\",$l),tr(),Bl(224),Jl==162&&(Ml(162),Bl(67),Ml(200),Bl(255),Pl(),Ns()),sc.endNonterminal(\"InstanceofExpr\",$l)}function er(){nr(),Bl(224),Jl==162&&(_l(162),Bl(67),_l(200),Bl(255),Cs())}function tr(){sc.startNonterminal(\"TreatExpr\",$l),rr(),Bl(225),Jl==254&&(Ml(254),Bl(33),Ml(80),Bl(255),Pl(),Ns()),sc.endNonterminal(\"TreatExpr\",$l)}function nr(){ir(),Bl(225),Jl==254&&(_l(254),Bl(33),_l(80),Bl(255),Cs())}function rr(){sc.startNonterminal(\"CastableExpr\",$l),sr(),Bl(226),Jl==91&&(Ml(91),Bl(33),Ml(80),Bl(247),Pl(),Es()),sc.endNonterminal(\"CastableExpr\",$l)}function ir(){or(),Bl(226),Jl==91&&(_l(91),Bl(33),_l(80),Bl(247),Ss())}function sr(){sc.startNonterminal(\"CastExpr\",$l),ur(),Bl(228),Jl==90&&(Ml(90),Bl(33),Ml(80),Bl(247),Pl(),Es()),sc.endNonterminal(\"CastExpr\",$l)}function or(){ar(),Bl(228),Jl==90&&(_l(90),Bl(33),_l(80),Bl(247),Ss())}function ur(){sc.startNonterminal(\"UnaryExpr\",$l);for(;;){Bl(267);if(Jl!=41&&Jl!=43)break;switch(Jl){case 43:Ml(43);break;default:Ml(41)}}Pl(),fr(),sc.endNonterminal(\"UnaryExpr\",$l)}function ar(){for(;;){Bl(267);if(Jl!=41&&Jl!=43)break;switch(Jl){case 43:_l(43);break;default:_l(41)}}lr()}function fr(){sc.startNonterminal(\"ValueExpr\",$l);switch(Jl){case 266:jl(189);break;default:Xl=Jl}switch(Xl){case 89354:case 125706:case 132362:case 144138:br();break;case 36:xr();break;default:cr()}sc.endNonterminal(\"ValueExpr\",$l)}function lr(){switch(Jl){case 266:jl(189);break;default:Xl=Jl}switch(Xl){case 89354:case 125706:case 132362:case 144138:wr();break;case 36:Tr();break;default:hr()}}function cr(){sc.startNonterminal(\"SimpleMapExpr\",$l),kr();for(;;){if(Jl!=26)break;Ml(26),Bl(264),Pl(),kr()}sc.endNonterminal(\"SimpleMapExpr\",$l)}function hr(){Lr();for(;;){if(Jl!=26)break;_l(26),Bl(264),Lr()}}function pr(){sc.startNonterminal(\"GeneralComp\",$l);switch(Jl){case 61:Ml(61);break;case 27:Ml(27);break;case 55:Ml(55);break;case 59:Ml(59);break;case 62:Ml(62);break;default:Ml(63)}sc.endNonterminal(\"GeneralComp\",$l)}function dr(){switch(Jl){case 61:_l(61);break;case 27:_l(27);break;case 55:_l(55);break;case 59:_l(59);break;case 62:_l(62);break;default:_l(63)}}function vr(){sc.startNonterminal(\"ValueComp\",$l);switch(Jl){case 129:Ml(129);break;case 189:Ml(189);break;case 181:Ml(181);break;case 175:Ml(175);break;case 152:Ml(152);break;default:Ml(148)}sc.endNonterminal(\"ValueComp\",$l)}function mr(){switch(Jl){case 129:_l(129);break;case 189:_l(189);break;case 181:_l(181);break;case 175:_l(175);break;case 152:_l(152);break;default:_l(148)}}function gr(){sc.startNonterminal(\"NodeComp\",$l);switch(Jl){case 166:Ml(166);break;case 58:Ml(58);break;default:Ml(64)}sc.endNonterminal(\"NodeComp\",$l)}function yr(){switch(Jl){case 166:_l(166);break;case 58:_l(58);break;default:_l(64)}}function br(){sc.startNonterminal(\"ValidateExpr\",$l),Ml(266),Bl(176);if(Jl!=281)switch(Jl){case 258:Ml(258),Bl(247),Pl(),Co();break;default:Pl(),Er()}Bl(89),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"ValidateExpr\",$l)}function wr(){_l(266),Bl(176);if(Jl!=281)switch(Jl){case 258:_l(258),Bl(247),ko();break;default:Sr()}Bl(89),_l(281),Bl(268),G(),_l(287)}function Er(){sc.startNonterminal(\"ValidationMode\",$l);switch(Jl){case 174:Ml(174);break;default:Ml(245)}sc.endNonterminal(\"ValidationMode\",$l)}function Sr(){switch(Jl){case 174:_l(174);break;default:_l(245)}}function xr(){sc.startNonterminal(\"ExtensionExpr\",$l);for(;;){Pl(),Nr(),Bl(102);if(Jl!=36)break}Ml(281),Bl(276),Jl!=287&&(Pl(),Q()),Ml(287),sc.endNonterminal(\"ExtensionExpr\",$l)}function Tr(){for(;;){Cr(),Bl(102);if(Jl!=36)break}_l(281),Bl(276),Jl!=287&&G(),_l(287)}function Nr(){sc.startNonterminal(\"Pragma\",$l),Ml(36),Fl(244),Jl==21&&Ml(21),Wa(),Fl(10),Jl==21&&(Ml(21),Fl(0),Ml(1)),Fl(5),Ml(30),sc.endNonterminal(\"Pragma\",$l)}function Cr(){_l(36),Fl(244),Jl==21&&_l(21),Xa(),Fl(10),Jl==21&&(_l(21),Fl(0),_l(1)),Fl(5),_l(30)}function kr(){sc.startNonterminal(\"PathExpr\",$l);switch(Jl){case 47:Ml(47),Bl(290);switch(Jl){case 25:case 26:case 27:case 38:case 39:case 41:case 42:case 43:case 50:case 54:case 58:case 59:case 61:case 62:case 63:case 64:case 70:case 88:case 100:case 209:case 237:case 252:case 279:case 284:case 285:case 286:case 287:break;default:Pl(),Ar()}break;case 48:Ml(48),Bl(261),Pl(),Ar();break;default:Ar()}sc.endNonterminal(\"PathExpr\",$l)}function Lr(){switch(Jl){case 47:_l(47),Bl(290);switch(Jl){case 25:case 26:case 27:case 38:case 39:case 41:case 42:case 43:case 50:case 54:case 58:case 59:case 61:case 62:case 63:case 64:case 70:case 88:case 100:case 209:case 237:case 252:case 279:case 284:case 285:case 286:case 287:break;default:Or()}break;case 48:_l(48),Bl(261),Or();break;default:Or()}}function Ar(){sc.startNonterminal(\"RelativePathExpr\",$l),Gr();for(;;){switch(Jl){case 26:jl(266);break;default:Xl=Jl}if(Xl!=25&&Xl!=27&&Xl!=38&&Xl!=39&&Xl!=41&&Xl!=42&&Xl!=43&&Xl!=47&&Xl!=48&&Xl!=50&&Xl!=54&&Xl!=55&&Xl!=58&&Xl!=59&&Xl!=61&&Xl!=62&&Xl!=63&&Xl!=64&&Xl!=70&&Xl!=71&&Xl!=76&&Xl!=80&&Xl!=81&&Xl!=82&&Xl!=85&&Xl!=88&&Xl!=89&&Xl!=90&&Xl!=91&&Xl!=95&&Xl!=100&&Xl!=106&&Xl!=110&&Xl!=114&&Xl!=119&&Xl!=123&&Xl!=124&&Xl!=127&&Xl!=129&&Xl!=132&&Xl!=139&&Xl!=142&&Xl!=148&&Xl!=150&&Xl!=152&&Xl!=153&&Xl!=162&&Xl!=164&&Xl!=165&&Xl!=166&&Xl!=175&&Xl!=177&&Xl!=181&&Xl!=183&&Xl!=184&&Xl!=189&&Xl!=202&&Xl!=204&&Xl!=205&&Xl!=209&&Xl!=224&&Xl!=228&&Xl!=233&&Xl!=237&&Xl!=241&&Xl!=242&&Xl!=252&&Xl!=253&&Xl!=254&&Xl!=260&&Xl!=272&&Xl!=276&&Xl!=279&&Xl!=284&&Xl!=285&&Xl!=286&&Xl!=287&&Xl!=2586&&Xl!=23578&&Xl!=24090&&Xl!=24602&&Xl!=34330){Xl=Ul(3,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{switch(Jl){case 47:_l(47);break;case 48:_l(48);break;default:_l(26)}Bl(265),_r(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(3,$l,Xl)}}if(Xl!=-1&&Xl!=47&&Xl!=48&&Xl!=2586&&Xl!=23578&&Xl!=34330)break;switch(Jl){case 47:Ml(47);break;case 48:Ml(48);break;default:Ml(26)}Bl(265),Pl(),Mr()}sc.endNonterminal(\"RelativePathExpr\",$l)}function Or(){Yr();for(;;){switch(Jl){case 26:jl(266);break;default:Xl=Jl}if(Xl!=25&&Xl!=27&&Xl!=38&&Xl!=39&&Xl!=41&&Xl!=42&&Xl!=43&&Xl!=47&&Xl!=48&&Xl!=50&&Xl!=54&&Xl!=55&&Xl!=58&&Xl!=59&&Xl!=61&&Xl!=62&&Xl!=63&&Xl!=64&&Xl!=70&&Xl!=71&&Xl!=76&&Xl!=80&&Xl!=81&&Xl!=82&&Xl!=85&&Xl!=88&&Xl!=89&&Xl!=90&&Xl!=91&&Xl!=95&&Xl!=100&&Xl!=106&&Xl!=110&&Xl!=114&&Xl!=119&&Xl!=123&&Xl!=124&&Xl!=127&&Xl!=129&&Xl!=132&&Xl!=139&&Xl!=142&&Xl!=148&&Xl!=150&&Xl!=152&&Xl!=153&&Xl!=162&&Xl!=164&&Xl!=165&&Xl!=166&&Xl!=175&&Xl!=177&&Xl!=181&&Xl!=183&&Xl!=184&&Xl!=189&&Xl!=202&&Xl!=204&&Xl!=205&&Xl!=209&&Xl!=224&&Xl!=228&&Xl!=233&&Xl!=237&&Xl!=241&&Xl!=242&&Xl!=252&&Xl!=253&&Xl!=254&&Xl!=260&&Xl!=272&&Xl!=276&&Xl!=279&&Xl!=284&&Xl!=285&&Xl!=286&&Xl!=287&&Xl!=2586&&Xl!=23578&&Xl!=24090&&Xl!=24602&&Xl!=34330){Xl=Ul(3,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{switch(Jl){case 47:_l(47);break;case 48:_l(48);break;default:_l(26)}Bl(265),_r(),Rl(3,t,-1);continue}catch(a){Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(3,t,-2);break}}}if(Xl!=-1&&Xl!=47&&Xl!=48&&Xl!=2586&&Xl!=23578&&Xl!=34330)break;switch(Jl){case 47:_l(47);break;case 48:_l(48);break;default:_l(26)}Bl(265),_r()}}function Mr(){sc.startNonterminal(\"StepExpr\",$l);switch(Jl){case 83:jl(289);break;case 122:jl(288);break;case 187:case 220:jl(286);break;case 135:case 197:case 255:jl(238);break;case 97:case 120:case 206:case 249:case 262:jl(240);break;case 79:case 125:case 154:case 167:case 169:case 247:case 248:case 259:jl(231);break;case 74:case 75:case 94:case 112:case 113:case 137:case 138:case 210:case 216:case 217:case 234:jl(239);break;case 6:case 71:case 73:case 76:case 78:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 95:case 98:case 99:case 102:case 103:case 104:case 105:case 106:case 107:case 109:case 110:case 111:case 114:case 119:case 121:case 123:case 124:case 126:case 127:case 129:case 130:case 132:case 133:case 134:case 136:case 139:case 142:case 143:case 147:case 148:case 150:case 152:case 153:case 155:case 156:case 157:case 161:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 177:case 179:case 181:case 183:case 184:case 185:case 188:case 189:case 194:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 222:case 223:case 224:case 225:case 226:case 228:case 229:case 230:case 231:case 232:case 233:case 239:case 240:case 241:case 242:case 245:case 253:case 254:case 256:case 257:case 258:case 260:case 263:case 266:case 267:case 268:case 269:case 272:case 273:case 276:jl(235);break;default:Xl=Jl}if(Xl==12935||Xl==12997||Xl==13055||Xl==13447||Xl==13509||Xl==13567||Xl==13959||Xl==14021||Xl==14079||Xl==19591||Xl==19653||Xl==19711||Xl==20103||Xl==20165||Xl==20223||Xl==21127||Xl==21189||Xl==21247||Xl==21639||Xl==21701||Xl==21759||Xl==22151||Xl==22213||Xl==22271||Xl==24199||Xl==24261||Xl==24319||Xl==24711||Xl==24773||Xl==24831||Xl==25735||Xl==25797||Xl==25855||Xl==27783||Xl==27845||Xl==27903||Xl==28295||Xl==28357||Xl==28415||Xl==29831||Xl==29893||Xl==29951||Xl==30343||Xl==30405||Xl==30463||Xl==31367||Xl==31429||Xl==31487||Xl==31879||Xl==31941||Xl==31999||Xl==32391||Xl==32453||Xl==32511||Xl==32903||Xl==32965||Xl==33023||Xl==35463||Xl==35525||Xl==35583||Xl==35975||Xl==36037||Xl==36095||Xl==36435||Xl==36474||Xl==36487||Xl==36539||Xl==36549||Xl==36572||Xl==36607||Xl==38995||Xl==39034||Xl==39047||Xl==39099||Xl==39109||Xl==39132||Xl==39167||Xl==41043||Xl==41082||Xl==41095||Xl==41147||Xl==41157||Xl==41180||Xl==41215||Xl==41555||Xl==41594||Xl==41607||Xl==41659||Xl==41669||Xl==41692||Xl==41727||Xl==42067||Xl==42106||Xl==42119||Xl==42171||Xl==42181||Xl==42204||Xl==42239||Xl==43603||Xl==43642||Xl==43655||Xl==43707||Xl==43717||Xl==43740||Xl==43775||Xl==45191||Xl==45253||Xl==45311||Xl==45651||Xl==45690||Xl==45703||Xl==45755||Xl==45765||Xl==45788||Xl==45823||Xl==46163||Xl==46202||Xl==46215||Xl==46267||Xl==46277||Xl==46300||Xl==46335||Xl==46675||Xl==46714||Xl==46727||Xl==46779||Xl==46789||Xl==46812||Xl==46847||Xl==48723||Xl==48762||Xl==48775||Xl==48827||Xl==48837||Xl==48860||Xl==48895||Xl==51335||Xl==51397||Xl==51455||Xl==54355||Xl==54394||Xl==54407||Xl==54459||Xl==54469||Xl==54492||Xl==54527||Xl==56403||Xl==56442||Xl==56455||Xl==56507||Xl==56517||Xl==56540||Xl==56575||Xl==58451||Xl==58490||Xl==58503||Xl==58555||Xl==58565||Xl==58588||Xl==58623||Xl==61011||Xl==61050||Xl==61063||Xl==61115||Xl==61125||Xl==61148||Xl==61183||Xl==63059||Xl==63098||Xl==63111||Xl==63163||Xl==63173||Xl==63196||Xl==63231||Xl==63571||Xl==63610||Xl==63623||Xl==63675||Xl==63685||Xl==63708||Xl==63743||Xl==65107||Xl==65146||Xl==65159||Xl==65211||Xl==65221||Xl==65244||Xl==65279||Xl==66131||Xl==66170||Xl==66183||Xl==66235||Xl==66245||Xl==66268||Xl==66303||Xl==67667||Xl==67706||Xl==67719||Xl==67771||Xl==67781||Xl==67804||Xl==67839||Xl==71251||Xl==71290||Xl==71303||Xl==71355||Xl==71365||Xl==71388||Xl==71423||Xl==72787||Xl==72826||Xl==72839||Xl==72891||Xl==72901||Xl==72924||Xl==72959||Xl==75859||Xl==75898||Xl==75911||Xl==75963||Xl==75973||Xl==75996||Xl==76031||Xl==76883||Xl==76922||Xl==76935||Xl==76987||Xl==76997||Xl==77020||Xl==77055||Xl==77907||Xl==77946||Xl==77959||Xl==78011||Xl==78021||Xl==78044||Xl==78079||Xl==78419||Xl==78458||Xl==78471||Xl==78523||Xl==78533||Xl==78556||Xl==78591||Xl==83027||Xl==83066||Xl==83079||Xl==83131||Xl==83141||Xl==83164||Xl==83199||Xl==84051||Xl==84090||Xl==84103||Xl==84155||Xl==84165||Xl==84188||Xl==84223||Xl==84563||Xl==84602||Xl==84615||Xl==84667||Xl==84677||Xl==84700||Xl==84735||Xl==85075||Xl==85114||Xl==85127||Xl==85179||Xl==85189||Xl==85212||Xl==85247||Xl==89683||Xl==89722||Xl==89735||Xl==89787||Xl==89797||Xl==89820||Xl==89855||Xl==90707||Xl==90746||Xl==90759||Xl==90811||Xl==90821||Xl==90844||Xl==90879||Xl==92755||Xl==92794||Xl==92807||Xl==92859||Xl==92869||Xl==92892||Xl==92927||Xl==93779||Xl==93818||Xl==93831||Xl==93883||Xl==93893||Xl==93916||Xl==93951||Xl==94291||Xl==94330||Xl==94343||Xl==94395||Xl==94405||Xl==94428||Xl==94463||Xl==96851||Xl==96890||Xl==96903||Xl==96955||Xl==96965||Xl==96988||Xl==97023||Xl==103507||Xl==103546||Xl==103559||Xl==103611||Xl==103621||Xl==103644||Xl==103679||Xl==104531||Xl==104570||Xl==104583||Xl==104635||Xl==104645||Xl==104668||Xl==104703||Xl==105043||Xl==105082||Xl==105095||Xl==105147||Xl==105157||Xl==105180||Xl==105215||Xl==107143||Xl==107205||Xl==107263||Xl==114771||Xl==114810||Xl==114823||Xl==114875||Xl==114885||Xl==114908||Xl==114943||Xl==116819||Xl==116858||Xl==116871||Xl==116923||Xl==116933||Xl==116956||Xl==116991||Xl==119379||Xl==119418||Xl==119431||Xl==119483||Xl==119493||Xl==119516||Xl==119551||Xl==121479||Xl==121541||Xl==121599||Xl==123475||Xl==123514||Xl==123527||Xl==123579||Xl==123589||Xl==123612||Xl==123647||Xl==123987||Xl==124026||Xl==124039||Xl==124091||Xl==124101||Xl==124124||Xl==124159||Xl==129159||Xl==129221||Xl==129279||Xl==129619||Xl==129658||Xl==129671||Xl==129723||Xl==129733||Xl==129756||Xl==129791||Xl==130131||Xl==130170||Xl==130183||Xl==130235||Xl==130245||Xl==130268||Xl==130303||Xl==133203||Xl==133242||Xl==133255||Xl==133307||Xl==133317||Xl==133340||Xl==133375||Xl==139347||Xl==139386||Xl==139399||Xl==139451||Xl==139461||Xl==139484||Xl==139519||Xl==141395||Xl==141434||Xl==141447||Xl==141499||Xl==141509||Xl==141532||Xl==141567||Xl==142983||Xl==143045||Xl==143103||Xl==145543||Xl==145605||Xl==145663||Xl==146055||Xl==146117||Xl==146175||Xl==146567||Xl==146629||Xl==146687||Xl==147079||Xl==147141||Xl==147199){Xl=Ul(4,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Yr(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(4,$l,Xl)}}switch(Xl){case-1:case 8:case 9:case 10:case 11:case 31:case 32:case 33:case 35:case 55:case 56:case 60:case 69:case 281:case 283:case 3155:case 3194:case 9915:case 9948:case 14854:case 14919:case 14921:case 14922:case 14923:case 14924:case 14926:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14935:case 14937:case 14938:case 14939:case 14940:case 14942:case 14943:case 14945:case 14946:case 14947:case 14950:case 14951:case 14952:case 14953:case 14954:case 14955:case 14957:case 14958:case 14959:case 14960:case 14961:case 14962:case 14967:case 14968:case 14969:case 14970:case 14971:case 14972:case 14973:case 14974:case 14975:case 14977:case 14978:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14986:case 14987:case 14990:case 14991:case 14995:case 14996:case 14998:case 15e3:case 15001:case 15002:case 15003:case 15004:case 15005:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15015:case 15016:case 15017:case 15018:case 15021:case 15022:case 15023:case 15025:case 15027:case 15029:case 15031:case 15032:case 15033:case 15035:case 15036:case 15037:case 15042:case 15043:case 15045:case 15046:case 15050:case 15051:case 15052:case 15053:case 15054:case 15055:case 15058:case 15064:case 15065:case 15068:case 15070:case 15071:case 15072:case 15073:case 15074:case 15076:case 15077:case 15078:case 15079:case 15080:case 15081:case 15082:case 15087:case 15088:case 15089:case 15090:case 15093:case 15095:case 15096:case 15097:case 15101:case 15102:case 15103:case 15104:case 15105:case 15106:case 15107:case 15108:case 15110:case 15111:case 15114:case 15115:case 15116:case 15117:case 15120:case 15121:case 15124:case 17926:case 17991:case 17993:case 17994:case 17995:case 17996:case 17998:case 18e3:case 18001:case 18002:case 18004:case 18005:case 18006:case 18007:case 18009:case 18010:case 18011:case 18012:case 18014:case 18015:case 18018:case 18019:case 18022:case 18023:case 18024:case 18025:case 18026:case 18027:case 18029:case 18030:case 18031:case 18032:case 18033:case 18034:case 18039:case 18040:case 18043:case 18044:case 18046:case 18047:case 18049:case 18050:case 18052:case 18053:case 18054:case 18055:case 18056:case 18057:case 18058:case 18059:case 18062:case 18063:case 18067:case 18068:case 18070:case 18072:case 18073:case 18075:case 18076:case 18077:case 18081:case 18082:case 18083:case 18084:case 18085:case 18086:case 18088:case 18090:case 18093:case 18094:case 18095:case 18097:case 18099:case 18101:case 18103:case 18104:case 18105:case 18107:case 18109:case 18115:case 18117:case 18118:case 18122:case 18123:case 18124:case 18125:case 18126:case 18127:case 18130:case 18136:case 18137:case 18142:case 18143:case 18144:case 18145:case 18146:case 18148:case 18149:case 18152:case 18153:case 18154:case 18159:case 18160:case 18161:case 18162:case 18165:case 18173:case 18174:case 18175:case 18176:case 18177:case 18178:case 18180:case 18182:case 18183:case 18186:case 18187:case 18188:case 18189:case 18192:case 18193:case 18196:case 23175:case 23237:case 23295:case 37459:case 37498:case 37563:case 37596:case 37971:case 38010:case 38075:case 38108:case 38483:case 38522:case 38587:case 38620:case 40019:case 40058:case 40123:case 40156:case 40531:case 40570:case 42579:case 42618:case 42683:case 42716:case 43091:case 43130:case 43195:case 43228:case 44115:case 44154:case 44219:case 44252:case 44627:case 44666:case 44731:case 44764:case 47187:case 47226:case 47291:case 47324:case 48211:case 48250:case 48315:case 48348:case 49747:case 49786:case 49851:case 49884:case 50259:case 50298:case 50363:case 50396:case 50771:case 50810:case 50875:case 50908:case 52307:case 52346:case 52411:case 52444:case 52819:case 52858:case 52923:case 52956:case 53331:case 53370:case 53435:case 53468:case 53843:case 53882:case 53947:case 53980:case 54867:case 54906:case 54971:case 55004:case 55891:case 55930:case 55995:case 56028:case 56915:case 56954:case 57019:case 57052:case 57427:case 57466:case 57531:case 57564:case 57939:case 57978:case 58043:case 58076:case 61523:case 61562:case 61627:case 61660:case 62035:case 62074:case 62139:case 62172:case 62547:case 62586:case 62651:case 62684:case 64083:case 64122:case 64187:case 64220:case 64595:case 64634:case 64699:case 64732:case 66643:case 66682:case 66747:case 66780:case 68179:case 68218:case 68283:case 68316:case 68691:case 68730:case 68795:case 68828:case 69203:case 69242:case 69307:case 69340:case 69715:case 69754:case 69819:case 69852:case 70227:case 70266:case 70331:case 70364:case 70739:case 70778:case 70843:case 70876:case 73299:case 73338:case 73403:case 73436:case 75347:case 75386:case 75451:case 75484:case 78931:case 78970:case 79035:case 79068:case 79443:case 79482:case 79547:case 79580:case 79955:case 79994:case 80059:case 80092:case 80467:case 80506:case 80571:case 80604:case 82515:case 82554:case 82619:case 82652:case 83539:case 83578:case 83643:case 83676:case 85587:case 85626:case 85691:case 85724:case 86099:case 86138:case 86203:case 86236:case 86611:case 86650:case 87123:case 87162:case 87227:case 87260:case 88659:case 88698:case 88763:case 88796:case 89171:case 89210:case 89275:case 89308:case 91731:case 91770:case 91835:case 91868:case 94803:case 94842:case 94907:case 94940:case 95827:case 95866:case 95931:case 95964:case 96339:case 96378:case 96443:case 96476:case 99411:case 99450:case 99515:case 99548:case 99923:case 99962:case 100027:case 100060:case 100947:case 100986:case 101051:case 101084:case 101459:case 101498:case 101563:case 101596:case 104019:case 104058:case 104123:case 104156:case 105555:case 105594:case 105659:case 105692:case 106067:case 106106:case 106171:case 106204:case 107603:case 107642:case 107707:case 107740:case 110675:case 110714:case 110779:case 110812:case 111187:case 111226:case 111291:case 111324:case 112723:case 112762:case 112827:case 112860:case 113747:case 113786:case 113851:case 113884:case 114259:case 114298:case 114363:case 114396:case 115283:case 115322:case 115387:case 115420:case 115795:case 115834:case 115899:case 115932:case 117331:case 117370:case 117435:case 117468:case 117843:case 117882:case 117947:case 117980:case 118355:case 118394:case 118459:case 118492:case 118867:case 118906:case 118971:case 119004:case 119891:case 119930:case 119995:case 120028:case 122451:case 122490:case 122555:case 122588:case 122963:case 123002:case 123067:case 123100:case 125523:case 125562:case 125627:case 125660:case 126547:case 126586:case 127059:case 127098:case 127163:case 127196:case 127571:case 127610:case 127675:case 127708:case 130643:case 130682:case 130747:case 130780:case 131155:case 131194:case 131259:case 131292:case 131667:case 131706:case 131771:case 131804:case 132179:case 132218:case 132283:case 132316:case 132691:case 132730:case 132795:case 132828:case 134227:case 134266:case 134331:case 134364:case 134739:case 134778:case 134843:case 134876:case 136275:case 136314:case 136379:case 136412:case 136787:case 136826:case 136891:case 136924:case 137299:case 137338:case 137403:case 137436:case 137811:case 137850:case 137915:case 137948:case 139859:case 139898:case 139963:case 139996:case 143955:case 143969:case 143992:case 143994:case 144059:case 144078:case 144092:case 144121:case 144134:Gr();break;default:Dr()}sc.endNonterminal(\"StepExpr\",$l)}function _r(){switch(Jl){case 83:jl(289);break;case 122:jl(288);break;case 187:case 220:jl(286);break;case 135:case 197:case 255:jl(238);break;case 97:case 120:case 206:case 249:case 262:jl(240);break;case 79:case 125:case 154:case 167:case 169:case 247:case 248:case 259:jl(231);break;case 74:case 75:case 94:case 112:case 113:case 137:case 138:case 210:case 216:case 217:case 234:jl(239);break;case 6:case 71:case 73:case 76:case 78:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 95:case 98:case 99:case 102:case 103:case 104:case 105:case 106:case 107:case 109:case 110:case 111:case 114:case 119:case 121:case 123:case 124:case 126:case 127:case 129:case 130:case 132:case 133:case 134:case 136:case 139:case 142:case 143:case 147:case 148:case 150:case 152:case 153:case 155:case 156:case 157:case 161:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 177:case 179:case 181:case 183:case 184:case 185:case 188:case 189:case 194:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 222:case 223:case 224:case 225:case 226:case 228:case 229:case 230:case 231:case 232:case 233:case 239:case 240:case 241:case 242:case 245:case 253:case 254:case 256:case 257:case 258:case 260:case 263:case 266:case 267:case 268:case 269:case 272:case 273:case 276:jl(235);break;default:Xl=Jl}if(Xl==12935||Xl==12997||Xl==13055||Xl==13447||Xl==13509||Xl==13567||Xl==13959||Xl==14021||Xl==14079||Xl==19591||Xl==19653||Xl==19711||Xl==20103||Xl==20165||Xl==20223||Xl==21127||Xl==21189||Xl==21247||Xl==21639||Xl==21701||Xl==21759||Xl==22151||Xl==22213||Xl==22271||Xl==24199||Xl==24261||Xl==24319||Xl==24711||Xl==24773||Xl==24831||Xl==25735||Xl==25797||Xl==25855||Xl==27783||Xl==27845||Xl==27903||Xl==28295||Xl==28357||Xl==28415||Xl==29831||Xl==29893||Xl==29951||Xl==30343||Xl==30405||Xl==30463||Xl==31367||Xl==31429||Xl==31487||Xl==31879||Xl==31941||Xl==31999||Xl==32391||Xl==32453||Xl==32511||Xl==32903||Xl==32965||Xl==33023||Xl==35463||Xl==35525||Xl==35583||Xl==35975||Xl==36037||Xl==36095||Xl==36435||Xl==36474||Xl==36487||Xl==36539||Xl==36549||Xl==36572||Xl==36607||Xl==38995||Xl==39034||Xl==39047||Xl==39099||Xl==39109||Xl==39132||Xl==39167||Xl==41043||Xl==41082||Xl==41095||Xl==41147||Xl==41157||Xl==41180||Xl==41215||Xl==41555||Xl==41594||Xl==41607||Xl==41659||Xl==41669||Xl==41692||Xl==41727||Xl==42067||Xl==42106||Xl==42119||Xl==42171||Xl==42181||Xl==42204||Xl==42239||Xl==43603||Xl==43642||Xl==43655||Xl==43707||Xl==43717||Xl==43740||Xl==43775||Xl==45191||Xl==45253||Xl==45311||Xl==45651||Xl==45690||Xl==45703||Xl==45755||Xl==45765||Xl==45788||Xl==45823||Xl==46163||Xl==46202||Xl==46215||Xl==46267||Xl==46277||Xl==46300||Xl==46335||Xl==46675||Xl==46714||Xl==46727||Xl==46779||Xl==46789||Xl==46812||Xl==46847||Xl==48723||Xl==48762||Xl==48775||Xl==48827||Xl==48837||Xl==48860||Xl==48895||Xl==51335||Xl==51397||Xl==51455||Xl==54355||Xl==54394||Xl==54407||Xl==54459||Xl==54469||Xl==54492||Xl==54527||Xl==56403||Xl==56442||Xl==56455||Xl==56507||Xl==56517||Xl==56540||Xl==56575||Xl==58451||Xl==58490||Xl==58503||Xl==58555||Xl==58565||Xl==58588||Xl==58623||Xl==61011||Xl==61050||Xl==61063||Xl==61115||Xl==61125||Xl==61148||Xl==61183||Xl==63059||Xl==63098||Xl==63111||Xl==63163||Xl==63173||Xl==63196||Xl==63231||Xl==63571||Xl==63610||Xl==63623||Xl==63675||Xl==63685||Xl==63708||Xl==63743||Xl==65107||Xl==65146||Xl==65159||Xl==65211||Xl==65221||Xl==65244||Xl==65279||Xl==66131||Xl==66170||Xl==66183||Xl==66235||Xl==66245||Xl==66268||Xl==66303||Xl==67667||Xl==67706||Xl==67719||Xl==67771||Xl==67781||Xl==67804||Xl==67839||Xl==71251||Xl==71290||Xl==71303||Xl==71355||Xl==71365||Xl==71388||Xl==71423||Xl==72787||Xl==72826||Xl==72839||Xl==72891||Xl==72901||Xl==72924||Xl==72959||Xl==75859||Xl==75898||Xl==75911||Xl==75963||Xl==75973||Xl==75996||Xl==76031||Xl==76883||Xl==76922||Xl==76935||Xl==76987||Xl==76997||Xl==77020||Xl==77055||Xl==77907||Xl==77946||Xl==77959||Xl==78011||Xl==78021||Xl==78044||Xl==78079||Xl==78419||Xl==78458||Xl==78471||Xl==78523||Xl==78533||Xl==78556||Xl==78591||Xl==83027||Xl==83066||Xl==83079||Xl==83131||Xl==83141||Xl==83164||Xl==83199||Xl==84051||Xl==84090||Xl==84103||Xl==84155||Xl==84165||Xl==84188||Xl==84223||Xl==84563||Xl==84602||Xl==84615||Xl==84667||Xl==84677||Xl==84700||Xl==84735||Xl==85075||Xl==85114||Xl==85127||Xl==85179||Xl==85189||Xl==85212||Xl==85247||Xl==89683||Xl==89722||Xl==89735||Xl==89787||Xl==89797||Xl==89820||Xl==89855||Xl==90707||Xl==90746||Xl==90759||Xl==90811||Xl==90821||Xl==90844||Xl==90879||Xl==92755||Xl==92794||Xl==92807||Xl==92859||Xl==92869||Xl==92892||Xl==92927||Xl==93779||Xl==93818||Xl==93831||Xl==93883||Xl==93893||Xl==93916||Xl==93951||Xl==94291||Xl==94330||Xl==94343||Xl==94395||Xl==94405||Xl==94428||Xl==94463||Xl==96851||Xl==96890||Xl==96903||Xl==96955||Xl==96965||Xl==96988||Xl==97023||Xl==103507||Xl==103546||Xl==103559||Xl==103611||Xl==103621||Xl==103644||Xl==103679||Xl==104531||Xl==104570||Xl==104583||Xl==104635||Xl==104645||Xl==104668||Xl==104703||Xl==105043||Xl==105082||Xl==105095||Xl==105147||Xl==105157||Xl==105180||Xl==105215||Xl==107143||Xl==107205||Xl==107263||Xl==114771||Xl==114810||Xl==114823||Xl==114875||Xl==114885||Xl==114908||Xl==114943||Xl==116819||Xl==116858||Xl==116871||Xl==116923||Xl==116933||Xl==116956||Xl==116991||Xl==119379||Xl==119418||Xl==119431||Xl==119483||Xl==119493||Xl==119516||Xl==119551||Xl==121479||Xl==121541||Xl==121599||Xl==123475||Xl==123514||Xl==123527||Xl==123579||Xl==123589||Xl==123612||Xl==123647||Xl==123987||Xl==124026||Xl==124039||Xl==124091||Xl==124101||Xl==124124||Xl==124159||Xl==129159||Xl==129221||Xl==129279||Xl==129619||Xl==129658||Xl==129671||Xl==129723||Xl==129733||Xl==129756||Xl==129791||Xl==130131||Xl==130170||Xl==130183||Xl==130235||Xl==130245||Xl==130268||Xl==130303||Xl==133203||Xl==133242||Xl==133255||Xl==133307||Xl==133317||Xl==133340||Xl==133375||Xl==139347||Xl==139386||Xl==139399||Xl==139451||Xl==139461||Xl==139484||Xl==139519||Xl==141395||Xl==141434||Xl==141447||Xl==141499||Xl==141509||Xl==141532||Xl==141567||Xl==142983||Xl==143045||Xl==143103||Xl==145543||Xl==145605||Xl==145663||Xl==146055||Xl==146117||Xl==146175||Xl==146567||Xl==146629||Xl==146687||Xl==147079||Xl==147141||Xl==147199){Xl=Ul(4,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Yr(),Rl(4,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(4,t,-2)}}}switch(Xl){case-1:case 8:case 9:case 10:case 11:case 31:case 32:case 33:case 35:case 55:case 56:case 60:case 69:case 281:case 283:case 3155:case 3194:case 9915:case 9948:case 14854:case 14919:case 14921:case 14922:case 14923:case 14924:case 14926:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14935:case 14937:case 14938:case 14939:case 14940:case 14942:case 14943:case 14945:case 14946:case 14947:case 14950:case 14951:case 14952:case 14953:case 14954:case 14955:case 14957:case 14958:case 14959:case 14960:case 14961:case 14962:case 14967:case 14968:case 14969:case 14970:case 14971:case 14972:case 14973:case 14974:case 14975:case 14977:case 14978:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14986:case 14987:case 14990:case 14991:case 14995:case 14996:case 14998:case 15e3:case 15001:case 15002:case 15003:case 15004:case 15005:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15015:case 15016:case 15017:case 15018:case 15021:case 15022:case 15023:case 15025:case 15027:case 15029:case 15031:case 15032:case 15033:case 15035:case 15036:case 15037:case 15042:case 15043:case 15045:case 15046:case 15050:case 15051:case 15052:case 15053:case 15054:case 15055:case 15058:case 15064:case 15065:case 15068:case 15070:case 15071:case 15072:case 15073:case 15074:case 15076:case 15077:case 15078:case 15079:case 15080:case 15081:case 15082:case 15087:case 15088:case 15089:case 15090:case 15093:case 15095:case 15096:case 15097:case 15101:case 15102:case 15103:case 15104:case 15105:case 15106:case 15107:case 15108:case 15110:case 15111:case 15114:case 15115:case 15116:case 15117:case 15120:case 15121:case 15124:case 17926:case 17991:case 17993:case 17994:case 17995:case 17996:case 17998:case 18e3:case 18001:case 18002:case 18004:case 18005:case 18006:case 18007:case 18009:case 18010:case 18011:case 18012:case 18014:case 18015:case 18018:case 18019:case 18022:case 18023:case 18024:case 18025:case 18026:case 18027:case 18029:case 18030:case 18031:case 18032:case 18033:case 18034:case 18039:case 18040:case 18043:case 18044:case 18046:case 18047:case 18049:case 18050:case 18052:case 18053:case 18054:case 18055:case 18056:case 18057:case 18058:case 18059:case 18062:case 18063:case 18067:case 18068:case 18070:case 18072:case 18073:case 18075:case 18076:case 18077:case 18081:case 18082:case 18083:case 18084:case 18085:case 18086:case 18088:case 18090:case 18093:case 18094:case 18095:case 18097:case 18099:case 18101:case 18103:case 18104:case 18105:case 18107:case 18109:case 18115:case 18117:case 18118:case 18122:case 18123:case 18124:case 18125:case 18126:case 18127:case 18130:case 18136:case 18137:case 18142:case 18143:case 18144:case 18145:case 18146:case 18148:case 18149:case 18152:case 18153:case 18154:case 18159:case 18160:case 18161:case 18162:case 18165:case 18173:case 18174:case 18175:case 18176:case 18177:case 18178:case 18180:case 18182:case 18183:case 18186:case 18187:case 18188:case 18189:case 18192:case 18193:case 18196:case 23175:case 23237:case 23295:case 37459:case 37498:case 37563:case 37596:case 37971:case 38010:case 38075:case 38108:case 38483:case 38522:case 38587:case 38620:case 40019:case 40058:case 40123:case 40156:case 40531:case 40570:case 42579:case 42618:case 42683:case 42716:case 43091:case 43130:case 43195:case 43228:case 44115:case 44154:case 44219:case 44252:case 44627:case 44666:case 44731:case 44764:case 47187:case 47226:case 47291:case 47324:case 48211:case 48250:case 48315:case 48348:case 49747:case 49786:case 49851:case 49884:case 50259:case 50298:case 50363:case 50396:case 50771:case 50810:case 50875:case 50908:case 52307:case 52346:case 52411:case 52444:case 52819:case 52858:case 52923:case 52956:case 53331:case 53370:case 53435:case 53468:case 53843:case 53882:case 53947:case 53980:case 54867:case 54906:case 54971:case 55004:case 55891:case 55930:case 55995:case 56028:case 56915:case 56954:case 57019:case 57052:case 57427:case 57466:case 57531:case 57564:case 57939:case 57978:case 58043:case 58076:case 61523:case 61562:case 61627:case 61660:case 62035:case 62074:case 62139:case 62172:case 62547:case 62586:case 62651:case 62684:case 64083:case 64122:case 64187:case 64220:case 64595:case 64634:case 64699:case 64732:case 66643:case 66682:case 66747:case 66780:case 68179:case 68218:case 68283:case 68316:case 68691:case 68730:case 68795:case 68828:case 69203:case 69242:case 69307:case 69340:case 69715:case 69754:case 69819:case 69852:case 70227:case 70266:case 70331:case 70364:case 70739:case 70778:case 70843:case 70876:case 73299:case 73338:case 73403:case 73436:case 75347:case 75386:case 75451:case 75484:case 78931:case 78970:case 79035:case 79068:case 79443:case 79482:case 79547:case 79580:case 79955:case 79994:case 80059:case 80092:case 80467:case 80506:case 80571:case 80604:case 82515:case 82554:case 82619:case 82652:case 83539:case 83578:case 83643:case 83676:case 85587:case 85626:case 85691:case 85724:case 86099:case 86138:case 86203:case 86236:case 86611:case 86650:case 87123:case 87162:case 87227:case 87260:case 88659:case 88698:case 88763:case 88796:case 89171:case 89210:case 89275:case 89308:case 91731:case 91770:case 91835:case 91868:case 94803:case 94842:case 94907:case 94940:case 95827:case 95866:case 95931:case 95964:case 96339:case 96378:case 96443:case 96476:case 99411:case 99450:case 99515:case 99548:case 99923:case 99962:case 100027:case 100060:case 100947:case 100986:case 101051:case 101084:case 101459:case 101498:case 101563:case 101596:case 104019:case 104058:case 104123:case 104156:case 105555:case 105594:case 105659:case 105692:case 106067:case 106106:case 106171:case 106204:case 107603:case 107642:case 107707:case 107740:case 110675:case 110714:case 110779:case 110812:case 111187:case 111226:case 111291:case 111324:case 112723:case 112762:case 112827:case 112860:case 113747:case 113786:case 113851:case 113884:case 114259:case 114298:case 114363:case 114396:case 115283:case 115322:case 115387:case 115420:case 115795:case 115834:case 115899:case 115932:case 117331:case 117370:case 117435:case 117468:case 117843:case 117882:case 117947:case 117980:case 118355:case 118394:case 118459:case 118492:case 118867:case 118906:case 118971:case 119004:case 119891:case 119930:case 119995:case 120028:case 122451:case 122490:case 122555:case 122588:case 122963:case 123002:case 123067:case 123100:case 125523:case 125562:case 125627:case 125660:case 126547:case 126586:case 127059:case 127098:case 127163:case 127196:case 127571:case 127610:case 127675:case 127708:case 130643:case 130682:case 130747:case 130780:case 131155:case 131194:case 131259:case 131292:case 131667:case 131706:case 131771:case 131804:case 132179:case 132218:case 132283:case 132316:case 132691:case 132730:case 132795:case 132828:case 134227:case 134266:case 134331:case 134364:case 134739:case 134778:case 134843:case 134876:case 136275:case 136314:case 136379:case 136412:case 136787:case 136826:case 136891:case 136924:case 137299:case 137338:case 137403:case 137436:case 137811:case 137850:case 137915:case 137948:case 139859:case 139898:case 139963:case 139996:case 143955:case 143969:case 143992:case 143994:case 144059:case 144078:case 144092:case 144121:case 144134:Yr();break;case-3:break;default:Pr()}}function Dr(){sc.startNonterminal(\"AxisStep\",$l);switch(Jl){case 74:case 75:case 210:case 216:case 217:jl(233);break;default:Xl=Jl}switch(Xl){case 46:case 26698:case 26699:case 26834:case 26840:case 26841:Rr();break;default:Hr()}Bl(229),Pl(),ui(),sc.endNonterminal(\"AxisStep\",$l)}function Pr(){switch(Jl){case 74:case 75:case 210:case 216:case 217:jl(233);break;default:Xl=Jl}switch(Xl){case 46:case 26698:case 26699:case 26834:case 26840:case 26841:Ur();break;default:Br()}Bl(229),ai()}function Hr(){sc.startNonterminal(\"ForwardStep\",$l);switch(Jl){case 83:jl(237);break;case 94:case 112:case 113:case 137:case 138:case 234:jl(233);break;default:Xl=Jl}switch(Xl){case 26707:case 26718:case 26736:case 26737:case 26761:case 26762:case 26858:jr(),Bl(250),Pl(),$r();break;default:Ir()}sc.endNonterminal(\"ForwardStep\",$l)}function Br(){switch(Jl){case 83:jl(237);break;case 94:case 112:case 113:case 137:case 138:case 234:jl(233);break;default:Xl=Jl}switch(Xl){case 26707:case 26718:case 26736:case 26737:case 26761:case 26762:case 26858:Fr(),Bl(250),Jr();break;default:qr()}}function jr(){sc.startNonterminal(\"ForwardAxis\",$l);switch(Jl){case 94:Ml(94),Bl(27),Ml(52);break;case 112:Ml(112),Bl(27),Ml(52);break;case 83:Ml(83),Bl(27),Ml(52);break;case 234:Ml(234),Bl(27),Ml(52);break;case 113:Ml(113),Bl(27),Ml(52);break;case 138:Ml(138),Bl(27),Ml(52);break;default:Ml(137),Bl(27),Ml(52)}sc.endNonterminal(\"ForwardAxis\",$l)}function Fr(){switch(Jl){case 94:_l(94),Bl(27),_l(52);break;case 112:_l(112),Bl(27),_l(52);break;case 83:_l(83),Bl(27),_l(52);break;case 234:_l(234),Bl(27),_l(52);break;case 113:_l(113),Bl(27),_l(52);break;case 138:_l(138),Bl(27),_l(52);break;default:_l(137),Bl(27),_l(52)}}function Ir(){sc.startNonterminal(\"AbbrevForwardStep\",$l),Jl==67&&Ml(67),Bl(250),Pl(),$r(),sc.endNonterminal(\"AbbrevForwardStep\",$l)}function qr(){Jl==67&&_l(67),Bl(250),Jr()}function Rr(){sc.startNonterminal(\"ReverseStep\",$l);switch(Jl){case 46:Xr();break;default:zr(),Bl(250),Pl(),$r()}sc.endNonterminal(\"ReverseStep\",$l)}function Ur(){switch(Jl){case 46:Vr();break;default:Wr(),Bl(250),Jr()}}function zr(){sc.startNonterminal(\"ReverseAxis\",$l);switch(Jl){case 210:Ml(210),Bl(27),Ml(52);break;case 74:Ml(74),Bl(27),Ml(52);break;case 217:Ml(217),Bl(27),Ml(52);break;case 216:Ml(216),Bl(27),Ml(52);break;default:Ml(75),Bl(27),Ml(52)}sc.endNonterminal(\"ReverseAxis\",$l)}function Wr(){switch(Jl){case 210:_l(210),Bl(27),_l(52);break;case 74:_l(74),Bl(27),_l(52);break;case 217:_l(217),Bl(27),_l(52);break;case 216:_l(216),Bl(27),_l(52);break;default:_l(75),Bl(27),_l(52)}}function Xr(){sc.startNonterminal(\"AbbrevReverseStep\",$l),Ml(46),sc.endNonterminal(\"AbbrevReverseStep\",$l)}function Vr(){_l(46)}function $r(){sc.startNonterminal(\"NodeTest\",$l);switch(Jl){case 83:case 97:case 121:case 122:case 188:case 194:case 220:case 230:case 231:case 249:jl(232);break;default:Xl=Jl}switch(Xl){case 18003:case 18017:case 18041:case 18042:case 18108:case 18114:case 18140:case 18150:case 18151:case 18169:zs();break;default:Kr()}sc.endNonterminal(\"NodeTest\",$l)}function Jr(){switch(Jl){case 83:case 97:case 121:case 122:case 188:case 194:case 220:case 230:case 231:case 249:jl(232);break;default:Xl=Jl}switch(Xl){case 18003:case 18017:case 18041:case 18042:case 18108:case 18114:case 18140:case 18150:case 18151:case 18169:Ws();break;default:Qr()}}function Kr(){sc.startNonterminal(\"NameTest\",$l);switch(Jl){case 5:Ml(5);break;default:Wa()}sc.endNonterminal(\"NameTest\",$l)}function Qr(){switch(Jl){case 5:_l(5);break;default:Xa()}}function Gr(){sc.startNonterminal(\"PostfixExpr\",$l),vl();for(;;){Bl(236);if(Jl!=35&&Jl!=45&&Jl!=69)break;switch(Jl){case 69:jl(274);break;default:Xl=Jl}if(Xl==35397){Xl=Ul(5,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{li(),Xl=-1}catch(a){Xl=-4}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(5,$l,Xl)}}switch(Xl){case 35:Pl(),si();break;case 45:Pl(),Zr();break;case-4:Pl(),ti();break;case 35909:Pl(),ri();break;default:Pl(),fi()}}sc.endNonterminal(\"PostfixExpr\",$l)}function Yr(){ml();for(;;){Bl(236);if(Jl!=35&&Jl!=45&&Jl!=69)break;switch(Jl){case 69:jl(274);break;default:Xl=Jl}if(Xl==35397){Xl=Ul(5,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{li(),Rl(5,t,-1),Xl=-6}catch(a){Xl=-4,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(5,t,-4)}}}switch(Xl){case 35:oi();break;case 45:ei();break;case-4:ni();break;case 35909:ii();break;case-6:break;default:li()}}}function Zr(){sc.startNonterminal(\"ObjectLookup\",$l),Ml(45),Bl(252);switch(Jl){case 11:Ml(11);break;case 35:Pl(),xi();break;case 31:Pl(),bi();break;case 32:Pl(),Ni();break;default:Pl(),Ja()}sc.endNonterminal(\"ObjectLookup\",$l)}function ei(){_l(45),Bl(252);switch(Jl){case 11:_l(11);break;case 35:Ti();break;case 31:wi();break;case 32:Ci();break;default:Ka()}}function ti(){sc.startNonterminal(\"ArrayLookup\",$l),Ml(69),Bl(31),Ml(69),Bl(268),Pl(),Q(),Ml(70),Bl(32),Ml(70),sc.endNonterminal(\"ArrayLookup\",$l)}function ni(){_l(69),Bl(31),_l(69),Bl(268),G(),_l(70),Bl(32),_l(70)}function ri(){sc.startNonterminal(\"ArrayUnboxing\",$l),Ml(69),Bl(32),Ml(70),sc.endNonterminal(\"ArrayUnboxing\",$l)}function ii(){_l(69),Bl(32),_l(70)}function si(){sc.startNonterminal(\"ArgumentList\",$l),Ml(35),Bl(281);if(Jl!=38){Pl(),Di();for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(273),Pl(),Di()}}Ml(38),sc.endNonterminal(\"ArgumentList\",$l)}function oi(){_l(35),Bl(281);if(Jl!=38){Pi();for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(273),Pi()}}_l(38)}function ui(){sc.startNonterminal(\"PredicateList\",$l);for(;;){Bl(229);if(Jl!=69)break;Pl(),fi()}sc.endNonterminal(\"PredicateList\",$l)}function ai(){for(;;){Bl(229);if(Jl!=69)break;li()}}function fi(){sc.startNonterminal(\"Predicate\",$l),Ml(69),Bl(268),Pl(),Q(),Ml(70),sc.endNonterminal(\"Predicate\",$l)}function li(){_l(69),Bl(268),G(),_l(70)}function ci(){sc.startNonterminal(\"Literal\",$l);switch(Jl){case 11:Ml(11);break;case 135:case 255:pi();break;case 197:vi();break;default:gi()}sc.endNonterminal(\"Literal\",$l)}function hi(){switch(Jl){case 11:_l(11);break;case 135:case 255:di();break;case 197:mi();break;default:yi()}}function pi(){sc.startNonterminal(\"BooleanLiteral\",$l);switch(Jl){case 255:Ml(255);break;default:Ml(135)}sc.endNonterminal(\"BooleanLiteral\",$l)}function di(){switch(Jl){case 255:_l(255);break;default:_l(135)}}function vi(){sc.startNonterminal(\"NullLiteral\",$l),Ml(197),sc.endNonterminal(\"NullLiteral\",$l)}function mi(){_l(197)}function gi(){sc.startNonterminal(\"NumericLiteral\",$l);switch(Jl){case 8:Ml(8);break;case 9:Ml(9);break;default:Ml(10)}sc.endNonterminal(\"NumericLiteral\",$l)}function yi(){switch(Jl){case 8:_l(8);break;case 9:_l(9);break;default:_l(10)}}function bi(){sc.startNonterminal(\"VarRef\",$l),Ml(31),Bl(247),Pl(),Ei(),sc.endNonterminal(\"VarRef\",$l)}function wi(){_l(31),Bl(247),Si()}function Ei(){sc.startNonterminal(\"VarName\",$l),Wa(),sc.endNonterminal(\"VarName\",$l)}function Si(){Xa()}function xi(){sc.startNonterminal(\"ParenthesizedExpr\",$l),Ml(35),Bl(271),Jl!=38&&(Pl(),Q()),Ml(38),sc.endNonterminal(\"ParenthesizedExpr\",$l)}function Ti(){_l(35),Bl(271),Jl!=38&&G(),_l(38)}function Ni(){sc.startNonterminal(\"ContextItemExpr\",$l),Ml(32),sc.endNonterminal(\"ContextItemExpr\",$l)}function Ci(){_l(32)}function ki(){sc.startNonterminal(\"OrderedExpr\",$l),Ml(206),Bl(89),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"OrderedExpr\",$l)}function Li(){_l(206),Bl(89),_l(281),Bl(268),G(),_l(287)}function Ai(){sc.startNonterminal(\"UnorderedExpr\",$l),Ml(262),Bl(89),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"UnorderedExpr\",$l)}function Oi(){_l(262),Bl(89),_l(281),Bl(268),G(),_l(287)}function Mi(){sc.startNonterminal(\"FunctionCall\",$l),Va(),Bl(22),Pl(),si(),sc.endNonterminal(\"FunctionCall\",$l)}function _i(){$a(),Bl(22),oi()}function Di(){sc.startNonterminal(\"Argument\",$l);switch(Jl){case 65:Hi();break;default:Rf()}sc.endNonterminal(\"Argument\",$l)}function Pi(){switch(Jl){case 65:Bi();break;default:Uf()}}function Hi(){sc.startNonterminal(\"ArgumentPlaceholder\",$l),Ml(65),sc.endNonterminal(\"ArgumentPlaceholder\",$l)}function Bi(){_l(65)}function ji(){sc.startNonterminal(\"Constructor\",$l);switch(Jl){case 55:case 56:case 60:Ii();break;default:rs()}sc.endNonterminal(\"Constructor\",$l)}function Fi(){switch(Jl){case 55:case 56:case 60:qi();break;default:is()}}function Ii(){sc.startNonterminal(\"DirectConstructor\",$l);switch(Jl){case 55:Ri();break;case 56:Zi();break;default:ts()}sc.endNonterminal(\"DirectConstructor\",$l)}function qi(){switch(Jl){case 55:Ui();break;case 56:es();break;default:ns()}}function Ri(){sc.startNonterminal(\"DirElemConstructor\",$l),Ml(55),Fl(4),Ml(20),zi();switch(Jl){case 49:Ml(49);break;default:Ml(62);for(;;){Fl(196);if(Jl==57)break;Gi()}Ml(57),Fl(4),Ml(20),Fl(12),Jl==21&&Ml(21),Fl(8),Ml(62)}sc.endNonterminal(\"DirElemConstructor\",$l)}function Ui(){_l(55),Fl(4),_l(20),Wi();switch(Jl){case 49:_l(49);break;default:_l(62);for(;;){Fl(196);if(Jl==57)break;Yi()}_l(57),Fl(4),_l(20),Fl(12),Jl==21&&_l(21),Fl(8),_l(62)}}function zi(){sc.startNonterminal(\"DirAttributeList\",$l);for(;;){Fl(19);if(Jl!=21)break;Ml(21),Fl(93),Jl==20&&(Ml(20),Fl(11),Jl==21&&Ml(21),Fl(7),Ml(61),Fl(18),Jl==21&&Ml(21),Xi())}sc.endNonterminal(\"DirAttributeList\",$l)}function Wi(){for(;;){Fl(19);if(Jl!=21)break;_l(21),Fl(93),Jl==20&&(_l(20),Fl(11),Jl==21&&_l(21),Fl(7),_l(61),Fl(18),Jl==21&&_l(21),Vi())}}function Xi(){sc.startNonterminal(\"DirAttributeValue\",$l),Fl(14);switch(Jl){case 28:Ml(28);for(;;){Fl(186);if(Jl==28)break;switch(Jl){case 13:Ml(13);break;default:$i()}}Ml(28);break;default:Ml(34);for(;;){Fl(187);if(Jl==34)break;switch(Jl){case 14:Ml(14);break;default:Ki()}}Ml(34)}sc.endNonterminal(\"DirAttributeValue\",$l)}function Vi(){Fl(14);switch(Jl){case 28:_l(28);for(;;){Fl(186);if(Jl==28)break;switch(Jl){case 13:_l(13);break;default:Ji()}}_l(28);break;default:_l(34);for(;;){Fl(187);if(Jl==34)break;switch(Jl){case 14:_l(14);break;default:Qi()}}_l(34)}}function $i(){sc.startNonterminal(\"QuotAttrValueContent\",$l);switch(Jl){case 16:Ml(16);break;default:tl()}sc.endNonterminal(\"QuotAttrValueContent\",$l)}function Ji(){switch(Jl){case 16:_l(16);break;default:nl()}}function Ki(){sc.startNonterminal(\"AposAttrValueContent\",$l);switch(Jl){case 17:Ml(17);break;default:tl()}sc.endNonterminal(\"AposAttrValueContent\",$l)}function Qi(){switch(Jl){case 17:_l(17);break;default:nl()}}function Gi(){sc.startNonterminal(\"DirElemContent\",$l);switch(Jl){case 55:case 56:case 60:Ii();break;case 4:Ml(4);break;case 15:Ml(15);break;default:tl()}sc.endNonterminal(\"DirElemContent\",$l)}function Yi(){switch(Jl){case 55:case 56:case 60:qi();break;case 4:_l(4);break;case 15:_l(15);break;default:nl()}}function Zi(){sc.startNonterminal(\"DirCommentConstructor\",$l),Ml(56),Fl(1),Ml(2),Fl(6),Ml(44),sc.endNonterminal(\"DirCommentConstructor\",$l)}function es(){_l(56),Fl(1),_l(2),Fl(6),_l(44)}function ts(){sc.startNonterminal(\"DirPIConstructor\",$l),Ml(60),Fl(3),Ml(18),Fl(13),Jl==21&&(Ml(21),Fl(2),Ml(3)),Fl(9),Ml(66),sc.endNonterminal(\"DirPIConstructor\",$l)}function ns(){_l(60),Fl(3),_l(18),Fl(13),Jl==21&&(_l(21),Fl(2),_l(3)),Fl(9),_l(66)}function rs(){sc.startNonterminal(\"ComputedConstructor\",$l);switch(Jl){case 120:sl();break;case 122:ss();break;case 83:ul();break;case 187:us();break;case 249:pl();break;case 97:cl();break;default:fl()}sc.endNonterminal(\"ComputedConstructor\",$l)}function is(){switch(Jl){case 120:ol();break;case 122:os();break;case 83:al();break;case 187:as();break;case 249:dl();break;case 97:hl();break;default:ll()}}function ss(){sc.startNonterminal(\"CompElemConstructor\",$l),Ml(122),Bl(251);switch(Jl){case 281:Ml(281),Bl(268),Pl(),Q(),Ml(287);break;default:Pl(),Wa()}Bl(89),Ml(281),Bl(282),Jl!=287&&(Pl(),rl()),Ml(287),sc.endNonterminal(\"CompElemConstructor\",$l)}function os(){_l(122),Bl(251);switch(Jl){case 281:_l(281),Bl(268),G(),_l(287);break;default:Xa()}Bl(89),_l(281),Bl(282),Jl!=287&&il(),_l(287)}function us(){sc.startNonterminal(\"CompNamespaceConstructor\",$l),Ml(187),Bl(243);switch(Jl){case 281:Ml(281),Bl(268),Pl(),cs(),Ml(287);break;default:Pl(),fs()}Bl(89),Ml(281),Bl(268),Pl(),ps(),Ml(287),sc.endNonterminal(\"CompNamespaceConstructor\",$l)}function as(){_l(187),Bl(243);switch(Jl){case 281:_l(281),Bl(268),hs(),_l(287);break;default:ls()}Bl(89),_l(281),Bl(268),ds(),_l(287)}function fs(){sc.startNonterminal(\"Prefix\",$l),Ja(),sc.endNonterminal(\"Prefix\",$l)}function ls(){Ka()}function cs(){sc.startNonterminal(\"PrefixExpr\",$l),Q(),sc.endNonterminal(\"PrefixExpr\",$l)}function hs(){G()}function ps(){sc.startNonterminal(\"URIExpr\",$l),Q(),sc.endNonterminal(\"URIExpr\",$l)}function ds(){G()}function vs(){sc.startNonterminal(\"FunctionItemExpr\",$l);switch(Jl){case 147:jl(94);break;default:Xl=Jl}switch(Xl){case 33:case 18067:bs();break;default:gs()}sc.endNonterminal(\"FunctionItemExpr\",$l)}function ms(){switch(Jl){case 147:jl(94);break;default:Xl=Jl}switch(Xl){case 33:case 18067:ws();break;default:ys()}}function gs(){sc.startNonterminal(\"NamedFunctionRef\",$l),Wa(),Bl(20),Ml(29),Bl(16),Ml(8),sc.endNonterminal(\"NamedFunctionRef\",$l)}function ys(){Xa(),Bl(20),_l(29),Bl(16),_l(8)}function bs(){sc.startNonterminal(\"InlineFunctionExpr\",$l);for(;;){Bl(99);if(Jl!=33)break;Pl(),H()}Ml(147),Bl(22),Ml(35),Bl(97),Jl==31&&(Pl(),R()),Ml(38),Bl(113),Jl==80&&(Ml(80),Bl(255),Pl(),Ns()),Bl(89),Pl(),X(),sc.endNonterminal(\"InlineFunctionExpr\",$l)}function ws(){for(;;){Bl(99);if(Jl!=33)break;B()}_l(147),Bl(22),_l(35),Bl(97),Jl==31&&U(),_l(38),Bl(113),Jl==80&&(_l(80),Bl(255),Cs()),Bl(89),V()}function Es(){sc.startNonterminal(\"SingleType\",$l),To(),Bl(227),Jl==65&&Ml(65),sc.endNonterminal(\"SingleType\",$l)}function Ss(){No(),Bl(227),Jl==65&&_l(65)}function xs(){sc.startNonterminal(\"TypeDeclaration\",$l),Ml(80),Bl(255),Pl(),Ns(),sc.endNonterminal(\"TypeDeclaration\",$l)}function Ts(){_l(80),Bl(255),Cs()}function Ns(){sc.startNonterminal(\"SequenceType\",$l);switch(Jl){case 35:jl(260);break;case 125:jl(234);break;default:Xl=Jl}switch(Xl){case 18045:case 19491:Jl==125&&Ml(125),Bl(22),Ml(35),Bl(23),Ml(38);break;default:As(),Bl(230);switch(Jl){case 40:case 41:case 65:Pl(),ks();break;default:}}sc.endNonterminal(\"SequenceType\",$l)}function Cs(){switch(Jl){case 35:jl(260);break;case 125:jl(234);break;default:Xl=Jl}switch(Xl){case 18045:case 19491:Jl==125&&_l(125),Bl(22),_l(35),Bl(23),_l(38);break;default:Os(),Bl(230);switch(Jl){case 40:case 41:case 65:Ls();break;default:}}}function ks(){sc.startNonterminal(\"OccurrenceIndicator\",$l);switch(Jl){case 65:Ml(65);break;case 40:Ml(40);break;default:Ml(41)}sc.endNonterminal(\"OccurrenceIndicator\",$l)}function Ls(){switch(Jl){case 65:_l(65);break;case 40:_l(40);break;default:_l(41)}}function As(){sc.startNonterminal(\"ItemType\",$l);switch(Jl){case 79:case 83:case 97:case 121:case 122:case 147:case 167:case 169:case 188:case 194:case 198:case 220:case 230:case 231:case 247:case 249:jl(234);break;default:Xl=Jl}if(Xl==12879||Xl==12969||Xl==12998||Xl==13047||Xl==13903||Xl==13993||Xl==14022||Xl==14071||Xl==19535||Xl==19625||Xl==19654||Xl==19703||Xl==20047||Xl==20137||Xl==20166||Xl==20215||Xl==20559||Xl==20649||Xl==20678||Xl==20727||Xl==21071||Xl==21161||Xl==21190||Xl==21239||Xl==21583||Xl==21673||Xl==21702||Xl==21751||Xl==22095||Xl==22185||Xl==22214||Xl==22263||Xl==25679||Xl==25769||Xl==25798||Xl==25847||Xl==27215||Xl==27305||Xl==27334||Xl==27383||Xl==27727||Xl==27817||Xl==27846||Xl==27895||Xl==28239||Xl==28329||Xl==28358||Xl==28407||Xl==29775||Xl==29865||Xl==29894||Xl==29943||Xl==30287||Xl==30377||Xl==30406||Xl==30455||Xl==31311||Xl==31401||Xl==31430||Xl==31479||Xl==31823||Xl==31913||Xl==31942||Xl==31991||Xl==32335||Xl==32425||Xl==32454||Xl==32503||Xl==32847||Xl==32937||Xl==32966||Xl==33015||Xl==33359||Xl==33449||Xl==33478||Xl==33527||Xl==35919||Xl==36009||Xl==36038||Xl==36087||Xl==36431||Xl==36521||Xl==36550||Xl==36599||Xl==37455||Xl==37545||Xl==37574||Xl==37623||Xl==38991||Xl==39081||Xl==39110||Xl==39159||Xl==41039||Xl==41129||Xl==41158||Xl==41207||Xl==41551||Xl==41641||Xl==41670||Xl==41719||Xl==42063||Xl==42153||Xl==42182||Xl==42231||Xl==43599||Xl==43689||Xl==43718||Xl==43767||Xl==45647||Xl==45737||Xl==45766||Xl==45815||Xl==48719||Xl==48809||Xl==48838||Xl==48887||Xl==51279||Xl==51369||Xl==51398||Xl==51447||Xl==54351||Xl==54441||Xl==54470||Xl==54519||Xl==56399||Xl==56489||Xl==56518||Xl==56567||Xl==58447||Xl==58537||Xl==58566||Xl==58615||Xl==61007||Xl==61097||Xl==61126||Xl==61175||Xl==63055||Xl==63145||Xl==63174||Xl==63223||Xl==63567||Xl==63657||Xl==63686||Xl==63735||Xl==65103||Xl==65193||Xl==65222||Xl==65271||Xl==66127||Xl==66217||Xl==66246||Xl==66295||Xl==67663||Xl==67753||Xl==67782||Xl==67831||Xl==68687||Xl==68777||Xl==68806||Xl==68855||Xl==71247||Xl==71337||Xl==71366||Xl==71415||Xl==72783||Xl==72873||Xl==72902||Xl==72951||Xl==75855||Xl==75945||Xl==75974||Xl==76023||Xl==76879||Xl==76969||Xl==76998||Xl==77047||Xl==77903||Xl==77993||Xl==78022||Xl==78071||Xl==78415||Xl==78505||Xl==78534||Xl==78583||Xl==79951||Xl==80041||Xl==80070||Xl==80119||Xl==83023||Xl==83113||Xl==83142||Xl==83191||Xl==84047||Xl==84137||Xl==84166||Xl==84215||Xl==84559||Xl==84649||Xl==84678||Xl==84727||Xl==85071||Xl==85161||Xl==85190||Xl==85239||Xl==89679||Xl==89769||Xl==89798||Xl==89847||Xl==90703||Xl==90793||Xl==90822||Xl==90871||Xl==92751||Xl==92841||Xl==92870||Xl==92919||Xl==93775||Xl==93865||Xl==93894||Xl==93943||Xl==94287||Xl==94377||Xl==94406||Xl==94455||Xl==96847||Xl==96937||Xl==96966||Xl==97015||Xl==103503||Xl==103593||Xl==103622||Xl==103671||Xl==104527||Xl==104617||Xl==104646||Xl==104695||Xl==105039||Xl==105129||Xl==105158||Xl==105207||Xl==107087||Xl==107177||Xl==107206||Xl==107255||Xl==114767||Xl==114857||Xl==114886||Xl==114935||Xl==116815||Xl==116905||Xl==116934||Xl==116983||Xl==118863||Xl==118953||Xl==118982||Xl==119031||Xl==119375||Xl==119465||Xl==119494||Xl==119543||Xl==121423||Xl==121513||Xl==121542||Xl==121591||Xl==123471||Xl==123561||Xl==123590||Xl==123639||Xl==123983||Xl==124073||Xl==124102||Xl==124151||Xl==129103||Xl==129193||Xl==129222||Xl==129271||Xl==129615||Xl==129705||Xl==129734||Xl==129783||Xl==133199||Xl==133289||Xl==133318||Xl==133367||Xl==139343||Xl==139433||Xl==139462||Xl==139511||Xl==141391||Xl==141481||Xl==141510||Xl==141559||Xl==142927||Xl==143017||Xl==143046||Xl==143095||Xl==143951||Xl==144041||Xl==144070||Xl==144119||Xl==145487||Xl==145577||Xl==145606||Xl==145655||Xl==145999||Xl==146089||Xl==146118||Xl==146167||Xl==146511||Xl==146601||Xl==146630||Xl==146679||Xl==147023||Xl==147113||Xl==147142||Xl==147191){Xl=Ul(6,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Us(),Xl=-4}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),_s(),Xl=-6}catch(f){Xl=-7}}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(6,$l,Xl)}}switch(Xl){case 18003:case 18017:case 18041:case 18042:case 18108:case 18114:case 18140:case 18150:case 18151:case 18169:zs();break;case 18087:Ml(167),Bl(22),Ml(35),Bl(23),Ml(38);break;case 33:case 18067:Lo();break;case 35:Po();break;case-6:case 17999:case 18089:case 18118:Ms();break;case-7:case 18167:Ds();break;default:Rs()}sc.endNonterminal(\"ItemType\",$l)}function Os(){switch(Jl){case 79:case 83:case 97:case 121:case 122:case 147:case 167:case 169:case 188:case 194:case 198:case 220:case 230:case 231:case 247:case 249:jl(234);break;default:Xl=Jl}if(Xl==12879||Xl==12969||Xl==12998||Xl==13047||Xl==13903||Xl==13993||Xl==14022||Xl==14071||Xl==19535||Xl==19625||Xl==19654||Xl==19703||Xl==20047||Xl==20137||Xl==20166||Xl==20215||Xl==20559||Xl==20649||Xl==20678||Xl==20727||Xl==21071||Xl==21161||Xl==21190||Xl==21239||Xl==21583||Xl==21673||Xl==21702||Xl==21751||Xl==22095||Xl==22185||Xl==22214||Xl==22263||Xl==25679||Xl==25769||Xl==25798||Xl==25847||Xl==27215||Xl==27305||Xl==27334||Xl==27383||Xl==27727||Xl==27817||Xl==27846||Xl==27895||Xl==28239||Xl==28329||Xl==28358||Xl==28407||Xl==29775||Xl==29865||Xl==29894||Xl==29943||Xl==30287||Xl==30377||Xl==30406||Xl==30455||Xl==31311||Xl==31401||Xl==31430||Xl==31479||Xl==31823||Xl==31913||Xl==31942||Xl==31991||Xl==32335||Xl==32425||Xl==32454||Xl==32503||Xl==32847||Xl==32937||Xl==32966||Xl==33015||Xl==33359||Xl==33449||Xl==33478||Xl==33527||Xl==35919||Xl==36009||Xl==36038||Xl==36087||Xl==36431||Xl==36521||Xl==36550||Xl==36599||Xl==37455||Xl==37545||Xl==37574||Xl==37623||Xl==38991||Xl==39081||Xl==39110||Xl==39159||Xl==41039||Xl==41129||Xl==41158||Xl==41207||Xl==41551||Xl==41641||Xl==41670||Xl==41719||Xl==42063||Xl==42153||Xl==42182||Xl==42231||Xl==43599||Xl==43689||Xl==43718||Xl==43767||Xl==45647||Xl==45737||Xl==45766||Xl==45815||Xl==48719||Xl==48809||Xl==48838||Xl==48887||Xl==51279||Xl==51369||Xl==51398||Xl==51447||Xl==54351||Xl==54441||Xl==54470||Xl==54519||Xl==56399||Xl==56489||Xl==56518||Xl==56567||Xl==58447||Xl==58537||Xl==58566||Xl==58615||Xl==61007||Xl==61097||Xl==61126||Xl==61175||Xl==63055||Xl==63145||Xl==63174||Xl==63223||Xl==63567||Xl==63657||Xl==63686||Xl==63735||Xl==65103||Xl==65193||Xl==65222||Xl==65271||Xl==66127||Xl==66217||Xl==66246||Xl==66295||Xl==67663||Xl==67753||Xl==67782||Xl==67831||Xl==68687||Xl==68777||Xl==68806||Xl==68855||Xl==71247||Xl==71337||Xl==71366||Xl==71415||Xl==72783||Xl==72873||Xl==72902||Xl==72951||Xl==75855||Xl==75945||Xl==75974||Xl==76023||Xl==76879||Xl==76969||Xl==76998||Xl==77047||Xl==77903||Xl==77993||Xl==78022||Xl==78071||Xl==78415||Xl==78505||Xl==78534||Xl==78583||Xl==79951||Xl==80041||Xl==80070||Xl==80119||Xl==83023||Xl==83113||Xl==83142||Xl==83191||Xl==84047||Xl==84137||Xl==84166||Xl==84215||Xl==84559||Xl==84649||Xl==84678||Xl==84727||Xl==85071||Xl==85161||Xl==85190||Xl==85239||Xl==89679||Xl==89769||Xl==89798||Xl==89847||Xl==90703||Xl==90793||Xl==90822||Xl==90871||Xl==92751||Xl==92841||Xl==92870||Xl==92919||Xl==93775||Xl==93865||Xl==93894||Xl==93943||Xl==94287||Xl==94377||Xl==94406||Xl==94455||Xl==96847||Xl==96937||Xl==96966||Xl==97015||Xl==103503||Xl==103593||Xl==103622||Xl==103671||Xl==104527||Xl==104617||Xl==104646||Xl==104695||Xl==105039||Xl==105129||Xl==105158||Xl==105207||Xl==107087||Xl==107177||Xl==107206||Xl==107255||Xl==114767||Xl==114857||Xl==114886||Xl==114935||Xl==116815||Xl==116905||Xl==116934||Xl==116983||Xl==118863||Xl==118953||Xl==118982||Xl==119031||Xl==119375||Xl==119465||Xl==119494||Xl==119543||Xl==121423||Xl==121513||Xl==121542||Xl==121591||Xl==123471||Xl==123561||Xl==123590||Xl==123639||Xl==123983||Xl==124073||Xl==124102||Xl==124151||Xl==129103||Xl==129193||Xl==129222||Xl==129271||Xl==129615||Xl==129705||Xl==129734||Xl==129783||Xl==133199||Xl==133289||Xl==133318||Xl==133367||Xl==139343||Xl==139433||Xl==139462||Xl==139511||Xl==141391||Xl==141481||Xl==141510||Xl==141559||Xl==142927||Xl==143017||Xl==143046||Xl==143095||Xl==143951||Xl==144041||Xl==144070||Xl==144119||Xl==145487||Xl==145577||Xl==145606||Xl==145655||Xl==145999||Xl==146089||Xl==146118||Xl==146167||Xl==146511||Xl==146601||Xl==146630||Xl==146679||Xl==147023||Xl==147113||Xl==147142||Xl==147191){Xl=Ul(6,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Us(),Rl(6,t,-4),Xl=-8}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),_s(),Rl(6,t,-6),Xl=-8}catch(f){Xl=-7,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(6,t,-7)}}}}switch(Xl){case 18003:case 18017:case 18041:case 18042:case 18108:case 18114:case 18140:case 18150:case 18151:case 18169:Ws();break;case 18087:_l(167),Bl(22),_l(35),Bl(23),_l(38);break;case 33:case 18067:Ao();break;case 35:Ho();break;case-6:case 17999:case 18089:case 18118:_s();break;case-7:case 18167:Ps();break;case-8:break;default:Us()}}function Ms(){sc.startNonterminal(\"JSONTest\",$l);switch(Jl){case 169:Hs();break;case 198:js();break;default:Is()}sc.endNonterminal(\"JSONTest\",$l)}function _s(){switch(Jl){case 169:Bs();break;case 198:Fs();break;default:qs()}}function Ds(){sc.startNonterminal(\"StructuredItemTest\",$l),Ml(247),Bl(234),Jl==35&&(Ml(35),Bl(23),Ml(38)),sc.endNonterminal(\"StructuredItemTest\",$l)}function Ps(){_l(247),Bl(234),Jl==35&&(_l(35),Bl(23),_l(38))}function Hs(){sc.startNonterminal(\"JSONItemTest\",$l),Ml(169),Bl(234),Jl==35&&(Ml(35),Bl(23),Ml(38)),sc.endNonterminal(\"JSONItemTest\",$l)}function Bs(){_l(169),Bl(234),Jl==35&&(_l(35),Bl(23),_l(38))}function js(){sc.startNonterminal(\"JSONObjectTest\",$l),Ml(198),Bl(234),Jl==35&&(Ml(35),Bl(23),Ml(38)),sc.endNonterminal(\"JSONObjectTest\",$l)}function Fs(){_l(198),Bl(234),Jl==35&&(_l(35),Bl(23),_l(38))}function Is(){sc.startNonterminal(\"JSONArrayTest\",$l),Ml(79),Bl(234),Jl==35&&(Ml(35),Bl(23),Ml(38)),sc.endNonterminal(\"JSONArrayTest\",$l)}function qs(){_l(79),Bl(234),Jl==35&&(_l(35),Bl(23),_l(38))}function Rs(){sc.startNonterminal(\"AtomicOrUnionType\",$l),Wa(),sc.endNonterminal(\"AtomicOrUnionType\",$l)}function Us(){Xa()}function zs(){sc.startNonterminal(\"KindTest\",$l);switch(Jl){case 121:$s();break;case 122:co();break;case 83:ro();break;case 231:mo();break;case 230:uo();break;case 220:to();break;case 97:Gs();break;case 249:Ks();break;case 188:Zs();break;default:Xs()}sc.endNonterminal(\"KindTest\",$l)}function Ws(){switch(Jl){case 121:Js();break;case 122:ho();break;case 83:io();break;case 231:go();break;case 230:ao();break;case 220:no();break;case 97:Ys();break;case 249:Qs();break;case 188:eo();break;default:Vs()}}function Xs(){sc.startNonterminal(\"AnyKindTest\",$l),Ml(194),Bl(22),Ml(35),Bl(23),Ml(38),sc.endNonterminal(\"AnyKindTest\",$l)}function Vs(){_l(194),Bl(22),_l(35),Bl(23),_l(38)}function $s(){sc.startNonterminal(\"DocumentTest\",$l),Ml(121),Bl(22),Ml(35),Bl(153);if(Jl!=38)switch(Jl){case 122:Pl(),co();break;default:Pl(),mo()}Bl(23),Ml(38),sc.endNonterminal(\"DocumentTest\",$l)}function Js(){_l(121),Bl(22),_l(35),Bl(153);if(Jl!=38)switch(Jl){case 122:ho();break;default:go()}Bl(23),_l(38)}function Ks(){sc.startNonterminal(\"TextTest\",$l),Ml(249),Bl(22),Ml(35),Bl(23),Ml(38),sc.endNonterminal(\"TextTest\",$l)}function Qs(){_l(249),Bl(22),_l(35),Bl(23),_l(38)}function Gs(){sc.startNonterminal(\"CommentTest\",$l),Ml(97),Bl(22),Ml(35),Bl(23),Ml(38),sc.endNonterminal(\"CommentTest\",$l)}function Ys(){_l(97),Bl(22),_l(35),Bl(23),_l(38)}function Zs(){sc.startNonterminal(\"NamespaceNodeTest\",$l),Ml(188),Bl(22),Ml(35),Bl(23),Ml(38),sc.endNonterminal(\"NamespaceNodeTest\",$l)}function eo(){_l(188),Bl(22),_l(35),Bl(23),_l(38)}function to(){sc.startNonterminal(\"PITest\",$l),Ml(220),Bl(22),Ml(35),Bl(245);if(Jl!=38)switch(Jl){case 11:Ml(11);break;default:Pl(),Ja()}Bl(23),Ml(38),sc.endNonterminal(\"PITest\",$l)}function no(){_l(220),Bl(22),_l(35),Bl(245);if(Jl!=38)switch(Jl){case 11:_l(11);break;default:Ka()}Bl(23),_l(38)}function ro(){sc.startNonterminal(\"AttributeTest\",$l),Ml(83),Bl(22),Ml(35),Bl(256),Jl!=38&&(Pl(),so(),Bl(103),Jl==42&&(Ml(42),Bl(247),Pl(),Co())),Bl(23),Ml(38),sc.endNonterminal(\"AttributeTest\",$l)}function io(){_l(83),Bl(22),_l(35),Bl(256),Jl!=38&&(oo(),Bl(103),Jl==42&&(_l(42),Bl(247),ko())),Bl(23),_l(38)}function so(){sc.startNonterminal(\"AttribNameOrWildcard\",$l);switch(Jl){case 39:Ml(39);break;default:wo()}sc.endNonterminal(\"AttribNameOrWildcard\",$l)}function oo(){switch(Jl){case 39:_l(39);break;default:Eo()}}function uo(){sc.startNonterminal(\"SchemaAttributeTest\",$l),Ml(230),Bl(22),Ml(35),Bl(247),Pl(),fo(),Bl(23),Ml(38),sc.endNonterminal(\"SchemaAttributeTest\",$l)}function ao(){_l(230),Bl(22),_l(35),Bl(247),lo(),Bl(23),_l(38)}function fo(){sc.startNonterminal(\"AttributeDeclaration\",$l),wo(),sc.endNonterminal(\"AttributeDeclaration\",$l)}function lo(){Eo()}function co(){sc.startNonterminal(\"ElementTest\",$l),Ml(122),Bl(22),Ml(35),Bl(256),Jl!=38&&(Pl(),po(),Bl(103),Jl==42&&(Ml(42),Bl(247),Pl(),Co(),Bl(104),Jl==65&&Ml(65))),Bl(23),Ml(38),sc.endNonterminal(\"ElementTest\",$l)}function ho(){_l(122),Bl(22),_l(35),Bl(256),Jl!=38&&(vo(),Bl(103),Jl==42&&(_l(42),Bl(247),ko(),Bl(104),Jl==65&&_l(65))),Bl(23),_l(38)}function po(){sc.startNonterminal(\"ElementNameOrWildcard\",$l);switch(Jl){case 39:Ml(39);break;default:So()}sc.endNonterminal(\"ElementNameOrWildcard\",$l)}function vo(){switch(Jl){case 39:_l(39);break;default:xo()}}function mo(){sc.startNonterminal(\"SchemaElementTest\",$l),Ml(231),Bl(22),Ml(35),Bl(247),Pl(),yo(),Bl(23),Ml(38),sc.endNonterminal(\"SchemaElementTest\",$l)}function go(){_l(231),Bl(22),_l(35),Bl(247),bo(),Bl(23),_l(38)}function yo(){sc.startNonterminal(\"ElementDeclaration\",$l),So(),sc.endNonterminal(\"ElementDeclaration\",$l)}function bo(){xo()}function wo(){sc.startNonterminal(\"AttributeName\",$l),Wa(),sc.endNonterminal(\"AttributeName\",$l)}function Eo(){Xa()}function So(){sc.startNonterminal(\"ElementName\",$l),Wa(),sc.endNonterminal(\"ElementName\",$l)}function xo(){Xa()}function To(){sc.startNonterminal(\"SimpleTypeName\",$l),Co(),sc.endNonterminal(\"SimpleTypeName\",$l)}function No(){ko()}function Co(){sc.startNonterminal(\"TypeName\",$l),Wa(),sc.endNonterminal(\"TypeName\",$l)}function ko(){Xa()}function Lo(){sc.startNonterminal(\"FunctionTest\",$l);for(;;){Bl(99);if(Jl!=33)break;Pl(),H()}switch(Jl){case 147:jl(22);break;default:Xl=Jl}Xl=Ul(7,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Mo(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(7,$l,Xl)}switch(Xl){case-1:Pl(),Oo();break;default:Pl(),_o()}sc.endNonterminal(\"FunctionTest\",$l)}function Ao(){for(;;){Bl(99);if(Jl!=33)break;B()}switch(Jl){case 147:jl(22);break;default:Xl=Jl}Xl=Ul(7,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Mo(),Rl(7,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(7,t,-2)}}switch(Xl){case-1:Mo();break;case-3:break;default:Do()}}function Oo(){sc.startNonterminal(\"AnyFunctionTest\",$l),Ml(147),Bl(22),Ml(35),Bl(24),Ml(39),Bl(23),Ml(38),sc.endNonterminal(\"AnyFunctionTest\",$l)}function Mo(){_l(147),Bl(22),_l(35),Bl(24),_l(39),Bl(23),_l(38)}function _o(){sc.startNonterminal(\"TypedFunctionTest\",$l),Ml(147),Bl(22),Ml(35),Bl(260);if(Jl!=38){Pl(),Ns();for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(255),Pl(),Ns()}}Ml(38),Bl(33),Ml(80),Bl(255),Pl(),Ns(),sc.endNonterminal(\"TypedFunctionTest\",$l)}function Do(){_l(147),Bl(22),_l(35),Bl(260);if(Jl!=38){Cs();for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(255),Cs()}}_l(38),Bl(33),_l(80),Bl(255),Cs()}function Po(){sc.startNonterminal(\"ParenthesizedItemType\",$l),Ml(35),Bl(255),Pl(),As(),Bl(23),Ml(38),sc.endNonterminal(\"ParenthesizedItemType\",$l)}function Ho(){_l(35),Bl(255),Os(),Bl(23),_l(38)}function Bo(){sc.startNonterminal(\"RevalidationDecl\",$l),Ml(109),Bl(74),Ml(226),Bl(161);switch(Jl){case 245:Ml(245);break;case 174:Ml(174);break;default:Ml(238)}sc.endNonterminal(\"RevalidationDecl\",$l)}function jo(){sc.startNonterminal(\"InsertExprTargetChoice\",$l);switch(Jl){case 71:Ml(71);break;case 85:Ml(85);break;default:if(Jl==80){Ml(80),Bl(121);switch(Jl){case 136:Ml(136);break;default:Ml(173)}}Bl(57),Ml(165)}sc.endNonterminal(\"InsertExprTargetChoice\",$l)}function Fo(){switch(Jl){case 71:_l(71);break;case 85:_l(85);break;default:if(Jl==80){_l(80),Bl(121);switch(Jl){case 136:_l(136);break;default:_l(173)}}Bl(57),_l(165)}}function Io(){sc.startNonterminal(\"InsertExpr\",$l),Ml(161),Bl(131);switch(Jl){case 194:Ml(194);break;default:Ml(195)}Bl(268),Pl(),$o(),Pl(),jo(),Bl(268),Pl(),Ko(),sc.endNonterminal(\"InsertExpr\",$l)}function qo(){_l(161),Bl(131);switch(Jl){case 194:_l(194);break;default:_l(195)}Bl(268),Jo(),Fo(),Bl(268),Qo()}function Ro(){sc.startNonterminal(\"DeleteExpr\",$l),Ml(111),Bl(131);switch(Jl){case 194:Ml(194);break;default:Ml(195)}Bl(268),Pl(),Ko(),sc.endNonterminal(\"DeleteExpr\",$l)}function Uo(){_l(111),Bl(131);switch(Jl){case 194:_l(194);break;default:_l(195)}Bl(268),Qo()}function zo(){sc.startNonterminal(\"ReplaceExpr\",$l),Ml(223),Bl(132),Jl==267&&(Ml(267),Bl(67),Ml(200)),Bl(65),Ml(194),Bl(268),Pl(),Ko(),Ml(276),Bl(268),Pl(),Rf(),sc.endNonterminal(\"ReplaceExpr\",$l)}function Wo(){_l(223),Bl(132),Jl==267&&(_l(267),Bl(67),_l(200)),Bl(65),_l(194),Bl(268),Qo(),_l(276),Bl(268),Uf()}function Xo(){sc.startNonterminal(\"RenameExpr\",$l),Ml(222),Bl(65),Ml(194),Bl(268),Pl(),Ko(),Ml(80),Bl(268),Pl(),Go(),sc.endNonterminal(\"RenameExpr\",$l)}function Vo(){_l(222),Bl(65),_l(194),Bl(268),Qo(),_l(80),Bl(268),Yo()}function $o(){sc.startNonterminal(\"SourceExpr\",$l),Rf(),sc.endNonterminal(\"SourceExpr\",$l)}function Jo(){Uf()}function Ko(){sc.startNonterminal(\"TargetExpr\",$l),Rf(),sc.endNonterminal(\"TargetExpr\",$l)}function Qo(){Uf()}function Go(){sc.startNonterminal(\"NewNameExpr\",$l),Rf(),sc.endNonterminal(\"NewNameExpr\",$l)}function Yo(){Uf()}function Zo(){sc.startNonterminal(\"TransformExpr\",$l),Ml(104),Bl(21),Pl(),tu();for(;;){if(Jl!=42)break;Ml(42),Bl(21),Pl(),tu()}Ml(184),Bl(268),Pl(),Rf(),Ml(224),Bl(268),Pl(),Rf(),sc.endNonterminal(\"TransformExpr\",$l)}function eu(){_l(104),Bl(21),nu();for(;;){if(Jl!=42)break;_l(42),Bl(21),nu()}_l(184),Bl(268),Uf(),_l(224),Bl(268),Uf()}function tu(){sc.startNonterminal(\"TransformSpec\",$l),Ml(31),Bl(247),Pl(),Ei(),Bl(28),Ml(53),Bl(268),Pl(),Rf(),sc.endNonterminal(\"TransformSpec\",$l)}function nu(){_l(31),Bl(247),Si(),Bl(28),_l(53),Bl(268),Uf()}function ru(){sc.startNonterminal(\"FTSelection\",$l),uu();for(;;){Bl(213);switch(Jl){case 82:jl(160);break;default:Xl=Jl}if(Xl!=116&&Xl!=118&&Xl!=128&&Xl!=206&&Xl!=227&&Xl!=275&&Xl!=65106&&Xl!=123986)break;Pl(),Mu()}sc.endNonterminal(\"FTSelection\",$l)}function iu(){au();for(;;){Bl(213);switch(Jl){case 82:jl(160);break;default:Xl=Jl}if(Xl!=116&&Xl!=118&&Xl!=128&&Xl!=206&&Xl!=227&&Xl!=275&&Xl!=65106&&Xl!=123986)break;_u()}}function su(){sc.startNonterminal(\"FTWeight\",$l),Ml(270),Bl(89),Ml(281),Bl(268),Pl(),Q(),Ml(287),sc.endNonterminal(\"FTWeight\",$l)}function ou(){_l(270),Bl(89),_l(281),Bl(268),G(),_l(287)}function uu(){sc.startNonterminal(\"FTOr\",$l),fu();for(;;){if(Jl!=146)break;Ml(146),Bl(178),Pl(),fu()}sc.endNonterminal(\"FTOr\",$l)}function au(){lu();for(;;){if(Jl!=146)break;_l(146),Bl(178),lu()}}function fu(){sc.startNonterminal(\"FTAnd\",$l),cu();for(;;){if(Jl!=144)break;Ml(144),Bl(178),Pl(),cu()}sc.endNonterminal(\"FTAnd\",$l)}function lu(){hu();for(;;){if(Jl!=144)break;_l(144),Bl(178),hu()}}function cu(){sc.startNonterminal(\"FTMildNot\",$l),pu();for(;;){Bl(214);if(Jl!=196)break;Ml(196),Bl(56),Ml(156),Bl(178),Pl(),pu()}sc.endNonterminal(\"FTMildNot\",$l)}function hu(){du();for(;;){Bl(214);if(Jl!=196)break;_l(196),Bl(56),_l(156),Bl(178),du()}}function pu(){sc.startNonterminal(\"FTUnaryNot\",$l),Jl==145&&Ml(145),Bl(165),Pl(),vu(),sc.endNonterminal(\"FTUnaryNot\",$l)}function du(){Jl==145&&_l(145),Bl(165),mu()}function vu(){sc.startNonterminal(\"FTPrimaryWithOptions\",$l),gu(),Bl(215),Jl==265&&(Pl(),$u()),Jl==270&&(Pl(),su()),sc.endNonterminal(\"FTPrimaryWithOptions\",$l)}function mu(){yu(),Bl(215),Jl==265&&Ju(),Jl==270&&ou()}function gu(){sc.startNonterminal(\"FTPrimary\",$l);switch(Jl){case 35:Ml(35),Bl(178),Pl(),ru(),Ml(38);break;case 36:xu();break;default:bu(),Bl(217),Jl==199&&(Pl(),ku())}sc.endNonterminal(\"FTPrimary\",$l)}function yu(){switch(Jl){case 35:_l(35),Bl(178),iu(),_l(38);break;case 36:Tu();break;default:wu(),Bl(217),Jl==199&&Lu()}}function bu(){sc.startNonterminal(\"FTWords\",$l),Eu(),Bl(222);if(Jl==72||Jl==77||Jl==214)Pl(),Nu();sc.endNonterminal(\"FTWords\",$l)}function wu(){Su(),Bl(222),(Jl==72||Jl==77||Jl==214)&&Cu()}function Eu(){sc.startNonterminal(\"FTWordsValue\",$l);switch(Jl){case 11:Ml(11);break;default:Ml(281),Bl(268),Pl(),Q(),Ml(287)}sc.endNonterminal(\"FTWordsValue\",$l)}function Su(){switch(Jl){case 11:_l(11);break;default:_l(281),Bl(268),G(),_l(287)}}function xu(){sc.startNonterminal(\"FTExtensionSelection\",$l);for(;;){Pl(),Nr(),Bl(102);if(Jl!=36)break}Ml(281),Bl(185),Jl!=287&&(Pl(),ru()),Ml(287),sc.endNonterminal(\"FTExtensionSelection\",$l)}function Tu(){for(;;){Cr(),Bl(102);if(Jl!=36)break}_l(281),Bl(185),Jl!=287&&iu(),_l(287)}function Nu(){sc.startNonterminal(\"FTAnyallOption\",$l);switch(Jl){case 77:Ml(77),Bl(220),Jl==278&&Ml(278);break;case 72:Ml(72),Bl(221),Jl==279&&Ml(279);break;default:Ml(214)}sc.endNonterminal(\"FTAnyallOption\",$l)}function Cu(){switch(Jl){case 77:_l(77),Bl(220),Jl==278&&_l(278);break;case 72:_l(72),Bl(221),Jl==279&&_l(279);break;default:_l(214)}}function ku(){sc.startNonterminal(\"FTTimes\",$l),Ml(199),Bl(158),Pl(),Au(),Ml(252),sc.endNonterminal(\"FTTimes\",$l)}function Lu(){_l(199),Bl(158),Ou(),_l(252)}function Au(){sc.startNonterminal(\"FTRange\",$l);switch(Jl){case 131:Ml(131),Bl(267),Pl(),Xn();break;case 82:Ml(82),Bl(127);switch(Jl){case 176:Ml(176),Bl(267),Pl(),Xn();break;default:Ml(186),Bl(267),Pl(),Xn()}break;default:Ml(142),Bl(267),Pl(),Xn(),Ml(253),Bl(267),Pl(),Xn()}sc.endNonterminal(\"FTRange\",$l)}function Ou(){switch(Jl){case 131:_l(131),Bl(267),Vn();break;case 82:_l(82),Bl(127);switch(Jl){case 176:_l(176),Bl(267),Vn();break;default:_l(186),Bl(267),Vn()}break;default:_l(142),Bl(267),Vn(),_l(253),Bl(267),Vn()}}function Mu(){sc.startNonterminal(\"FTPosFilter\",$l);switch(Jl){case 206:Du();break;case 275:Hu();break;case 118:ju();break;case 116:case 227:Ru();break;default:Xu()}sc.endNonterminal(\"FTPosFilter\",$l)}function _u(){switch(Jl){case 206:Pu();break;case 275:Bu();break;case 118:Fu();break;case 116:case 227:Uu();break;default:Vu()}}function Du(){sc.startNonterminal(\"FTOrder\",$l),Ml(206),sc.endNonterminal(\"FTOrder\",$l)}function Pu(){_l(206)}function Hu(){sc.startNonterminal(\"FTWindow\",$l),Ml(275),Bl(267),Pl(),Xn(),Pl(),Iu(),sc.endNonterminal(\"FTWindow\",$l)}function Bu(){_l(275),Bl(267),Vn(),qu()}function ju(){sc.startNonterminal(\"FTDistance\",$l),Ml(118),Bl(158),Pl(),Au(),Pl(),Iu(),sc.endNonterminal(\"FTDistance\",$l)}function Fu(){_l(118),Bl(158),Ou(),qu()}function Iu(){sc.startNonterminal(\"FTUnit\",$l);switch(Jl){case 279:Ml(279);break;case 237:Ml(237);break;default:Ml(209)}sc.endNonterminal(\"FTUnit\",$l)}function qu(){switch(Jl){case 279:_l(279);break;case 237:_l(237);break;default:_l(209)}}function Ru(){sc.startNonterminal(\"FTScope\",$l);switch(Jl){case 227:Ml(227);break;default:Ml(116)}Bl(134),Pl(),zu(),sc.endNonterminal(\"FTScope\",$l)}function Uu(){switch(Jl){case 227:_l(227);break;default:_l(116)}Bl(134),Wu()}function zu(){sc.startNonterminal(\"FTBigUnit\",$l);switch(Jl){case 236:Ml(236);break;default:Ml(208)}sc.endNonterminal(\"FTBigUnit\",$l)}function Wu(){switch(Jl){case 236:_l(236);break;default:_l(208)}}function Xu(){sc.startNonterminal(\"FTContent\",$l);switch(Jl){case 82:Ml(82),Bl(119);switch(Jl){case 242:Ml(242);break;default:Ml(127)}break;default:Ml(128),Bl(45),Ml(101)}sc.endNonterminal(\"FTContent\",$l)}function Vu(){switch(Jl){case 82:_l(82),Bl(119);switch(Jl){case 242:_l(242);break;default:_l(127)}break;default:_l(128),Bl(45),_l(101)}}function $u(){sc.startNonterminal(\"FTMatchOptions\",$l);for(;;){Ml(265),Bl(204),Pl(),Ku(),Bl(215);if(Jl!=265)break}sc.endNonterminal(\"FTMatchOptions\",$l)}function Ju(){for(;;){_l(265),Bl(204),Qu(),Bl(215);if(Jl!=265)break}}function Ku(){sc.startNonterminal(\"FTMatchOption\",$l);switch(Jl){case 191:jl(177);break;default:Xl=Jl}switch(Xl){case 172:va();break;case 274:case 140479:ga();break;case 251:case 128703:ra();break;case 243:case 124607:ta();break;case 115:Zu();break;case 244:case 125119:fa();break;case 203:ba();break;default:Gu()}sc.endNonterminal(\"FTMatchOption\",$l)}function Qu(){switch(Jl){case 191:jl(177);break;default:Xl=Jl}switch(Xl){case 172:ma();break;case 274:case 140479:ya();break;case 251:case 128703:ia();break;case 243:case 124607:na();break;case 115:ea();break;case 244:case 125119:la();break;case 203:wa();break;default:Yu()}}function Gu(){sc.startNonterminal(\"FTCaseOption\",$l);switch(Jl){case 89:Ml(89),Bl(126);switch(Jl){case 160:Ml(160);break;default:Ml(235)}break;case 180:Ml(180);break;default:Ml(264)}sc.endNonterminal(\"FTCaseOption\",$l)}function Yu(){switch(Jl){case 89:_l(89),Bl(126);switch(Jl){case 160:_l(160);break;default:_l(235)}break;case 180:_l(180);break;default:_l(264)}}function Zu(){sc.startNonterminal(\"FTDiacriticsOption\",$l),Ml(115),Bl(126);switch(Jl){case 160:Ml(160);break;default:Ml(235)}sc.endNonterminal(\"FTDiacriticsOption\",$l)}function ea(){_l(115),Bl(126);switch(Jl){case 160:_l(160);break;default:_l(235)}}function ta(){sc.startNonterminal(\"FTStemOption\",$l);switch(Jl){case 243:Ml(243);break;default:Ml(191),Bl(76),Ml(243)}sc.endNonterminal(\"FTStemOption\",$l)}function na(){switch(Jl){case 243:_l(243);break;default:_l(191),Bl(76),_l(243)}}function ra(){sc.startNonterminal(\"FTThesaurusOption\",$l);switch(Jl){case 251:Ml(251),Bl(151);switch(Jl){case 82:Pl(),sa();break;case 110:Ml(110);break;default:Ml(35),Bl(114);switch(Jl){case 82:Pl(),sa();break;default:Ml(110)}for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(34),Pl(),sa()}Ml(38)}break;default:Ml(191),Bl(80),Ml(251)}sc.endNonterminal(\"FTThesaurusOption\",$l)}function ia(){switch(Jl){case 251:_l(251),Bl(151);switch(Jl){case 82:oa();break;case 110:_l(110);break;default:_l(35),Bl(114);switch(Jl){case 82:oa();break;default:_l(110)}for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(34),oa()}_l(38)}break;default:_l(191),Bl(80),_l(251)}}function sa(){sc.startNonterminal(\"FTThesaurusID\",$l),Ml(82),Bl(15),Ml(7),Bl(218),Jl==221&&(Ml(221),Bl(17),Ml(11)),Bl(216);switch(Jl){case 82:jl(184);break;case 142:jl(164);break;default:Xl=Jl}if(Xl==131||Xl==4238||Xl==90194||Xl==95314)Pl(),ua(),Bl(61),Ml(178);sc.endNonterminal(\"FTThesaurusID\",$l)}function oa(){_l(82),Bl(15),_l(7),Bl(218),Jl==221&&(_l(221),Bl(17),_l(11)),Bl(216);switch(Jl){case 82:jl(184);break;case 142:jl(164);break;default:Xl=Jl}if(Xl==131||Xl==4238||Xl==90194||Xl==95314)aa(),Bl(61),_l(178)}function ua(){sc.startNonterminal(\"FTLiteralRange\",$l);switch(Jl){case 131:Ml(131),Bl(16),Ml(8);break;case 82:Ml(82),Bl(127);switch(Jl){case 176:Ml(176),Bl(16),Ml(8);break;default:Ml(186),Bl(16),Ml(8)}break;default:Ml(142),Bl(16),Ml(8),Bl(81),Ml(253),Bl(16),Ml(8)}sc.endNonterminal(\"FTLiteralRange\",$l)}function aa(){switch(Jl){case 131:_l(131),Bl(16),_l(8);break;case 82:_l(82),Bl(127);switch(Jl){case 176:_l(176),Bl(16),_l(8);break;default:_l(186),Bl(16),_l(8)}break;default:_l(142),Bl(16),_l(8),Bl(81),_l(253),Bl(16),_l(8)}}function fa(){sc.startNonterminal(\"FTStopWordOption\",$l);switch(Jl){case 244:Ml(244),Bl(88),Ml(279),Bl(151);switch(Jl){case 110:Ml(110);for(;;){Bl(219);if(Jl!=132&&Jl!=260)break;Pl(),pa()}break;default:Pl(),ca();for(;;){Bl(219);if(Jl!=132&&Jl!=260)break;Pl(),pa()}}break;default:Ml(191),Bl(77),Ml(244),Bl(88),Ml(279)}sc.endNonterminal(\"FTStopWordOption\",$l)}function la(){switch(Jl){case 244:_l(244),Bl(88),_l(279),Bl(151);switch(Jl){case 110:_l(110);for(;;){Bl(219);if(Jl!=132&&Jl!=260)break;da()}break;default:ha();for(;;){Bl(219);if(Jl!=132&&Jl!=260)break;da()}}break;default:_l(191),Bl(77),_l(244),Bl(88),_l(279)}}function ca(){sc.startNonterminal(\"FTStopWords\",$l);switch(Jl){case 82:Ml(82),Bl(15),Ml(7);break;default:Ml(35),Bl(17),Ml(11);for(;;){Bl(103);if(Jl!=42)break;Ml(42),Bl(17),Ml(11)}Ml(38)}sc.endNonterminal(\"FTStopWords\",$l)}function ha(){switch(Jl){case 82:_l(82),Bl(15),_l(7);break;default:_l(35),Bl(17),_l(11);for(;;){Bl(103);if(Jl!=42)break;_l(42),Bl(17),_l(11)}_l(38)}}function pa(){sc.startNonterminal(\"FTStopWordsInclExcl\",$l);switch(Jl){case 260:Ml(260);break;default:Ml(132)}Bl(101),Pl(),ca(),sc.endNonterminal(\"FTStopWordsInclExcl\",$l)}function da(){switch(Jl){case 260:_l(260);break;default:_l(132)}Bl(101),ha()}function va(){sc.startNonterminal(\"FTLanguageOption\",$l),Ml(172),Bl(17),Ml(11),sc.endNonterminal(\"FTLanguageOption\",$l)}function ma(){_l(172),Bl(17),_l(11)}function ga(){sc.startNonterminal(\"FTWildCardOption\",$l);switch(Jl){case 274:Ml(274);break;default:Ml(191),Bl(86),Ml(274)}sc.endNonterminal(\"FTWildCardOption\",$l)}function ya(){switch(Jl){case 274:_l(274);break;default:_l(191),Bl(86),_l(274)}}function ba(){sc.startNonterminal(\"FTExtensionOption\",$l),Ml(203),Bl(247),Pl(),Wa(),Bl(17),Ml(11),sc.endNonterminal(\"FTExtensionOption\",$l)}function wa(){_l(203),Bl(247),Xa(),Bl(17),_l(11)}function Ea(){sc.startNonterminal(\"FTIgnoreOption\",$l),Ml(277),Bl(45),Ml(101),Bl(267),Pl(),Kn(),sc.endNonterminal(\"FTIgnoreOption\",$l)}function Sa(){_l(277),Bl(45),_l(101),Bl(267),Qn()}function xa(){sc.startNonterminal(\"CollectionDecl\",$l),Ml(96),Bl(247),Pl(),Wa(),Bl(109),Jl==80&&(Pl(),Ta()),sc.endNonterminal(\"CollectionDecl\",$l)}function Ta(){sc.startNonterminal(\"CollectionTypeDecl\",$l),Ml(80),Bl(198),Pl(),zs(),Bl(172),Jl!=54&&(Pl(),ks()),sc.endNonterminal(\"CollectionTypeDecl\",$l)}function Na(){sc.startNonterminal(\"IndexName\",$l),Wa(),sc.endNonterminal(\"IndexName\",$l)}function Ca(){sc.startNonterminal(\"IndexDomainExpr\",$l),kr(),sc.endNonterminal(\"IndexDomainExpr\",$l)}function ka(){sc.startNonterminal(\"IndexKeySpec\",$l),La(),Jl==80&&(Pl(),Aa()),Bl(155),Jl==95&&(Pl(),Ma()),sc.endNonterminal(\"IndexKeySpec\",$l)}function La(){sc.startNonterminal(\"IndexKeyExpr\",$l),kr(),sc.endNonterminal(\"IndexKeyExpr\",$l)}function Aa(){sc.startNonterminal(\"IndexKeyTypeDecl\",$l),Ml(80),Bl(247),Pl(),Oa(),Bl(190);if(Jl==40||Jl==41||Jl==65)Pl(),ks();sc.endNonterminal(\"IndexKeyTypeDecl\",$l)}function Oa(){sc.startNonterminal(\"AtomicType\",$l),Wa(),sc.endNonterminal(\"AtomicType\",$l)}function Ma(){sc.startNonterminal(\"IndexKeyCollation\",$l),Ml(95),Bl(15),Ml(7),sc.endNonterminal(\"IndexKeyCollation\",$l)}function _a(){sc.startNonterminal(\"IndexDecl\",$l),Ml(157),Bl(247),Pl(),Na(),Bl(68),Ml(201),Bl(66),Ml(195),Bl(264),Pl(),Ca(),Ml(88),Bl(264),Pl(),ka();for(;;){Bl(105);if(Jl!=42)break;Ml(42),Bl(264),Pl(),ka()}sc.endNonterminal(\"IndexDecl\",$l)}function Da(){sc.startNonterminal(\"ICDecl\",$l),Ml(163),Bl(43),Ml(98),Bl(247),Pl(),Wa(),Bl(122);switch(Jl){case 201:Pl(),Pa();break;default:Pl(),Fa()}sc.endNonterminal(\"ICDecl\",$l)}function Pa(){sc.startNonterminal(\"ICCollection\",$l),Ml(201),Bl(42),Ml(96),Bl(247),Pl(),Wa(),Bl(148);switch(Jl){case 31:Pl(),Ha();break;case 194:Pl(),Ba();break;default:Pl(),ja()}sc.endNonterminal(\"ICCollection\",$l)}function Ha(){sc.startNonterminal(\"ICCollSequence\",$l),bi(),Bl(40),Ml(93),Bl(268),Pl(),Rf(),sc.endNonterminal(\"ICCollSequence\",$l)}function Ba(){sc.startNonterminal(\"ICCollSequenceUnique\",$l),Ml(194),Bl(21),Pl(),bi(),Bl(40),Ml(93),Bl(82),Ml(261),Bl(60),Ml(171),Bl(264),Pl(),kr(),sc.endNonterminal(\"ICCollSequenceUnique\",$l)}function ja(){sc.startNonterminal(\"ICCollNode\",$l),Ml(140),Bl(65),Ml(194),Bl(21),Pl(),bi(),Bl(40),Ml(93),Bl(268),Pl(),Rf(),sc.endNonterminal(\"ICCollNode\",$l)}function Fa(){sc.startNonterminal(\"ICForeignKey\",$l),Ml(141),Bl(60),Ml(171),Bl(54),Pl(),Ia(),Pl(),qa(),sc.endNonterminal(\"ICForeignKey\",$l)}function Ia(){sc.startNonterminal(\"ICForeignKeySource\",$l),Ml(142),Bl(42),Pl(),Ra(),sc.endNonterminal(\"ICForeignKeySource\",$l)}function qa(){sc.startNonterminal(\"ICForeignKeyTarget\",$l),Ml(253),Bl(42),Pl(),Ra(),sc.endNonterminal(\"ICForeignKeyTarget\",$l)}function Ra(){sc.startNonterminal(\"ICForeignKeyValues\",$l),Ml(96),Bl(247),Pl(),Wa(),Bl(65),Ml(194),Bl(21),Pl(),bi(),Bl(60),Ml(171),Bl(264),Pl(),kr(),sc.endNonterminal(\"ICForeignKeyValues\",$l)}function Ua(){_l(37);for(;;){Fl(91);if(Jl==51)break;switch(Jl){case 24:_l(24);break;default:Ua()}}_l(51)}function za(){switch(Jl){case 22:_l(22);break;default:Ua()}}function Wa(){sc.startNonterminal(\"EQName\",$l),Fl(242);switch(Jl){case 83:Ml(83);break;case 97:Ml(97);break;case 121:Ml(121);break;case 122:Ml(122);break;case 125:Ml(125);break;case 147:Ml(147);break;case 154:Ml(154);break;case 167:Ml(167);break;case 188:Ml(188);break;case 194:Ml(194);break;case 220:Ml(220);break;case 230:Ml(230);break;case 231:Ml(231);break;case 248:Ml(248);break;case 249:Ml(249);break;case 259:Ml(259);break;case 79:Ml(79);break;case 169:Ml(169);break;case 247:Ml(247);break;default:Va()}sc.endNonterminal(\"EQName\",$l)}function Xa(){Fl(242);switch(Jl){case 83:_l(83);break;case 97:_l(97);break;case 121:_l(121);break;case 122:_l(122);break;case 125:_l(125);break;case 147:_l(147);break;case 154:_l(154);break;case 167:_l(167);break;case 188:_l(188);break;case 194:_l(194);break;case 220:_l(220);break;case 230:_l(230);break;case 231:_l(231);break;case 248:_l(248);break;case 249:_l(249);break;case 259:_l(259);break;case 79:_l(79);break;case 169:_l(169);break;case 247:_l(247);break;default:$a()}}function Va(){sc.startNonterminal(\"FunctionName\",$l);switch(Jl){case 6:Ml(6);break;case 71:Ml(71);break;case 74:Ml(74);break;case 75:Ml(75);break;case 76:Ml(76);break;case 80:Ml(80);break;case 81:Ml(81);break;case 85:Ml(85);break;case 89:Ml(89);break;case 90:Ml(90);break;case 91:Ml(91);break;case 94:Ml(94);break;case 95:Ml(95);break;case 104:Ml(104);break;case 106:Ml(106);break;case 109:Ml(109);break;case 110:Ml(110);break;case 111:Ml(111);break;case 112:Ml(112);break;case 113:Ml(113);break;case 114:Ml(114);break;case 119:Ml(119);break;case 120:Ml(120);break;case 123:Ml(123);break;case 124:Ml(124);break;case 127:Ml(127);break;case 129:Ml(129);break;case 130:Ml(130);break;case 132:Ml(132);break;case 136:Ml(136);break;case 137:Ml(137);break;case 138:Ml(138);break;case 139:Ml(139);break;case 148:Ml(148);break;case 150:Ml(150);break;case 152:Ml(152);break;case 153:Ml(153);break;case 155:Ml(155);break;case 161:Ml(161);break;case 162:Ml(162);break;case 164:Ml(164);break;case 165:Ml(165);break;case 166:Ml(166);break;case 173:Ml(173);break;case 175:Ml(175);break;case 177:Ml(177);break;case 181:Ml(181);break;case 183:Ml(183);break;case 184:Ml(184);break;case 185:Ml(185);break;case 187:Ml(187);break;case 189:Ml(189);break;case 202:Ml(202);break;case 204:Ml(204);break;case 205:Ml(205);break;case 206:Ml(206);break;case 210:Ml(210);break;case 216:Ml(216);break;case 217:Ml(217);break;case 222:Ml(222);break;case 223:Ml(223);break;case 224:Ml(224);break;case 228:Ml(228);break;case 234:Ml(234);break;case 240:Ml(240);break;case 241:Ml(241);break;case 242:Ml(242);break;case 253:Ml(253);break;case 254:Ml(254);break;case 256:Ml(256);break;case 260:Ml(260);break;case 262:Ml(262);break;case 266:Ml(266);break;case 272:Ml(272);break;case 276:Ml(276);break;case 170:Ml(170);break;case 73:Ml(73);break;case 82:Ml(82);break;case 84:Ml(84);break;case 86:Ml(86);break;case 87:Ml(87);break;case 92:Ml(92);break;case 99:Ml(99);break;case 102:Ml(102);break;case 103:Ml(103);break;case 105:Ml(105);break;case 107:Ml(107);break;case 126:Ml(126);break;case 133:Ml(133);break;case 134:Ml(134);break;case 143:Ml(143);break;case 156:Ml(156);break;case 157:Ml(157);break;case 163:Ml(163);break;case 174:Ml(174);break;case 195:Ml(195);break;case 203:Ml(203);break;case 207:Ml(207);break;case 226:Ml(226);break;case 229:Ml(229);break;case 232:Ml(232);break;case 239:Ml(239);break;case 245:Ml(245);break;case 257:Ml(257);break;case 258:Ml(258);break;case 263:Ml(263);break;case 267:Ml(267);break;case 268:Ml(268);break;case 269:Ml(269);break;case 273:Ml(273);break;case 98:Ml(98);break;case 179:Ml(179);break;case 225:Ml(225);break;case 78:Ml(78);break;case 135:Ml(135);break;case 142:Ml(142);break;case 197:Ml(197);break;case 168:Ml(168);break;case 198:Ml(198);break;case 233:Ml(233);break;default:Ml(255)}sc.endNonterminal(\"FunctionName\",$l)}function $a(){switch(Jl){case 6:_l(6);break;case 71:_l(71);break;case 74:_l(74);break;case 75:_l(75);break;case 76:_l(76);break;case 80:_l(80);break;case 81:_l(81);break;case 85:_l(85);break;case 89:_l(89);break;case 90:_l(90);break;case 91:_l(91);break;case 94:_l(94);break;case 95:_l(95);break;case 104:_l(104);break;case 106:_l(106);break;case 109:_l(109);break;case 110:_l(110);break;case 111:_l(111);break;case 112:_l(112);break;case 113:_l(113);break;case 114:_l(114);break;case 119:_l(119);break;case 120:_l(120);break;case 123:_l(123);break;case 124:_l(124);break;case 127:_l(127);break;case 129:_l(129);break;case 130:_l(130);break;case 132:_l(132);break;case 136:_l(136);break;case 137:_l(137);break;case 138:_l(138);break;case 139:_l(139);break;case 148:_l(148);break;case 150:_l(150);break;case 152:_l(152);break;case 153:_l(153);break;case 155:_l(155);break;case 161:_l(161);break;case 162:_l(162);break;case 164:_l(164);break;case 165:_l(165);break;case 166:_l(166);break;case 173:_l(173);break;case 175:_l(175);break;case 177:_l(177);break;case 181:_l(181);break;case 183:_l(183);break;case 184:_l(184);break;case 185:_l(185);break;case 187:_l(187);break;case 189:_l(189);break;case 202:_l(202);break;case 204:_l(204);break;case 205:_l(205);break;case 206:_l(206);break;case 210:_l(210);break;case 216:_l(216);break;case 217:_l(217);break;case 222:_l(222);break;case 223:_l(223);break;case 224:_l(224);break;case 228:_l(228);break;case 234:_l(234);break;case 240:_l(240);break;case 241:_l(241);break;case 242:_l(242);break;case 253:_l(253);break;case 254:_l(254);break;case 256:_l(256);break;case 260:_l(260);break;case 262:_l(262);break;case 266:_l(266);break;case 272:_l(272);break;case 276:_l(276);break;case 170:_l(170);break;case 73:_l(73);break;case 82:_l(82);break;case 84:_l(84);break;case 86:_l(86);break;case 87:_l(87);break;case 92:_l(92);break;case 99:_l(99);break;case 102:_l(102);break;case 103:_l(103);break;case 105:_l(105);break;case 107:_l(107);break;case 126:_l(126);break;case 133:_l(133);break;case 134:_l(134);break;case 143:_l(143);break;case 156:_l(156);break;case 157:_l(157);break;case 163:_l(163);break;case 174:_l(174);break;case 195:_l(195);break;case 203:_l(203);break;case 207:_l(207);break;case 226:_l(226);break;case 229:_l(229);break;case 232:_l(232);break;case 239:_l(239);break;case 245:_l(245);break;case 257:_l(257);break;case 258:_l(258);break;case 263:_l(263);break;case 267:_l(267);break;case 268:_l(268);break;case 269:_l(269);break;case 273:_l(273);break;case 98:_l(98);break;case 179:_l(179);break;case 225:_l(225);break;case 78:_l(78);break;case 135:_l(135);break;case 142:_l(142);break;case 197:_l(197);break;case 168:_l(168);break;case 198:_l(198);break;case 233:_l(233);break;default:_l(255)}}function Ja(){sc.startNonterminal(\"NCName\",$l);switch(Jl){case 19:Ml(19);break;case 71:Ml(71);break;case 76:Ml(76);break;case 80:Ml(80);break;case 81:Ml(81);break;case 85:Ml(85);break;case 89:Ml(89);break;case 90:Ml(90);break;case 91:Ml(91);break;case 95:Ml(95);break;case 106:Ml(106);break;case 110:Ml(110);break;case 114:Ml(114);break;case 119:Ml(119);break;case 123:Ml(123);break;case 124:Ml(124);break;case 127:Ml(127);break;case 129:Ml(129);break;case 132:Ml(132);break;case 139:Ml(139);break;case 148:Ml(148);break;case 150:Ml(150);break;case 152:Ml(152);break;case 153:Ml(153);break;case 162:Ml(162);break;case 164:Ml(164);break;case 165:Ml(165);break;case 166:Ml(166);break;case 175:Ml(175);break;case 177:Ml(177);break;case 181:Ml(181);break;case 183:Ml(183);break;case 184:Ml(184);break;case 189:Ml(189);break;case 202:Ml(202);break;case 204:Ml(204);break;case 205:Ml(205);break;case 224:Ml(224);break;case 228:Ml(228);break;case 241:Ml(241);break;case 242:Ml(242);break;case 253:Ml(253);break;case 254:Ml(254);break;case 260:Ml(260);break;case 272:Ml(272);break;case 276:Ml(276);break;case 74:Ml(74);break;case 75:Ml(75);break;case 83:Ml(83);break;case 94:Ml(94);break;case 97:Ml(97);break;case 104:Ml(104);break;case 109:Ml(109);break;case 111:Ml(111);break;case 112:Ml(112);break;case 113:Ml(113);break;case 120:Ml(120);break;case 121:Ml(121);break;case 122:Ml(122);break;case 125:Ml(125);break;case 130:Ml(130);break;case 136:Ml(136);break;case 137:Ml(137);break;case 138:Ml(138);break;case 147:Ml(147);break;case 154:Ml(154);break;case 155:Ml(155);break;case 161:Ml(161);break;case 167:Ml(167);break;case 173:Ml(173);break;case 185:Ml(185);break;case 187:Ml(187);break;case 188:Ml(188);break;case 194:Ml(194);break;case 206:Ml(206);break;case 210:Ml(210);break;case 216:Ml(216);break;case 217:Ml(217);break;case 220:Ml(220);break;case 222:Ml(222);break;case 223:Ml(223);break;case 230:Ml(230);break;case 231:Ml(231);break;case 234:Ml(234);break;case 240:Ml(240);break;case 248:Ml(248);break;case 249:Ml(249);break;case 256:Ml(256);break;case 259:Ml(259);break;case 262:Ml(262);break;case 266:Ml(266);break;case 268:Ml(268);break;case 170:Ml(170);break;case 73:Ml(73);break;case 82:Ml(82);break;case 84:Ml(84);break;case 86:Ml(86);break;case 87:Ml(87);break;case 92:Ml(92);break;case 99:Ml(99);break;case 102:Ml(102);break;case 103:Ml(103);break;case 105:Ml(105);break;case 107:Ml(107);break;case 126:Ml(126);break;case 133:Ml(133);break;case 134:Ml(134);break;case 143:Ml(143);break;case 156:Ml(156);break;case 157:Ml(157);break;case 163:Ml(163);break;case 174:Ml(174);break;case 195:Ml(195);break;case 203:Ml(203);break;case 207:Ml(207);break;case 226:Ml(226);break;case 229:Ml(229);break;case 232:Ml(232);break;case 239:Ml(239);break;case 245:Ml(245);break;case 257:Ml(257);break;case 258:Ml(258);break;case 263:Ml(263);break;case 267:Ml(267);break;case 269:Ml(269);break;case 273:Ml(273);break;case 98:Ml(98);break;case 179:Ml(179);break;case 225:Ml(225);break;case 78:Ml(78);break;case 135:Ml(135);break;case 142:Ml(142);break;case 197:Ml(197);break;case 168:Ml(168);break;case 198:Ml(198);break;case 233:Ml(233);break;default:Ml(255)}sc.endNonterminal(\"NCName\",$l)}function Ka(){switch(Jl){case 19:_l(19);break;case 71:_l(71);break;case 76:_l(76);break;case 80:_l(80);break;case 81:_l(81);break;case 85:_l(85);break;case 89:_l(89);break;case 90:_l(90);break;case 91:_l(91);break;case 95:_l(95);break;case 106:_l(106);break;case 110:_l(110);break;case 114:_l(114);break;case 119:_l(119);break;case 123:_l(123);break;case 124:_l(124);break;case 127:_l(127);break;case 129:_l(129);break;case 132:_l(132);break;case 139:_l(139);break;case 148:_l(148);break;case 150:_l(150);break;case 152:_l(152);break;case 153:_l(153);break;case 162:_l(162);break;case 164:_l(164);break;case 165:_l(165);break;case 166:_l(166);break;case 175:_l(175);break;case 177:_l(177);break;case 181:_l(181);break;case 183:_l(183);break;case 184:_l(184);break;case 189:_l(189);break;case 202:_l(202);break;case 204:_l(204);break;case 205:_l(205);break;case 224:_l(224);break;case 228:_l(228);break;case 241:_l(241);break;case 242:_l(242);break;case 253:_l(253);break;case 254:_l(254);break;case 260:_l(260);break;case 272:_l(272);break;case 276:_l(276);break;case 74:_l(74);break;case 75:_l(75);break;case 83:_l(83);break;case 94:_l(94);break;case 97:_l(97);break;case 104:_l(104);break;case 109:_l(109);break;case 111:_l(111);break;case 112:_l(112);break;case 113:_l(113);break;case 120:_l(120);break;case 121:_l(121);break;case 122:_l(122);break;case 125:_l(125);break;case 130:_l(130);break;case 136:_l(136);break;case 137:_l(137);break;case 138:_l(138);break;case 147:_l(147);break;case 154:_l(154);break;case 155:_l(155);break;case 161:_l(161);break;case 167:_l(167);break;case 173:_l(173);break;case 185:_l(185);break;case 187:_l(187);break;case 188:_l(188);break;case 194:_l(194);break;case 206:_l(206);break;case 210:_l(210);break;case 216:_l(216);break;case 217:_l(217);break;case 220:_l(220);break;case 222:_l(222);break;case 223:_l(223);break;case 230:_l(230);break;case 231:_l(231);break;case 234:_l(234);break;case 240:_l(240);break;case 248:_l(248);break;case 249:_l(249);break;case 256:_l(256);break;case 259:_l(259);break;case 262:_l(262);break;case 266:_l(266);break;case 268:_l(268);break;case 170:_l(170);break;case 73:_l(73);break;case 82:_l(82);break;case 84:_l(84);break;case 86:_l(86);break;case 87:_l(87);break;case 92:_l(92);break;case 99:_l(99);break;case 102:_l(102);break;case 103:_l(103);break;case 105:_l(105);break;case 107:_l(107);break;case 126:_l(126);break;case 133:_l(133);break;case 134:_l(134);break;case 143:_l(143);break;case 156:_l(156);break;case 157:_l(157);break;case 163:_l(163);break;case 174:_l(174);break;case 195:_l(195);break;case 203:_l(203);break;case 207:_l(207);break;case 226:_l(226);break;case 229:_l(229);break;case 232:_l(232);break;case 239:_l(239);break;case 245:_l(245);break;case 257:_l(257);break;case 258:_l(258);break;case 263:_l(263);break;case 267:_l(267);break;case 269:_l(269);break;case 273:_l(273);break;case 98:_l(98);break;case 179:_l(179);break;case 225:_l(225);break;case 78:_l(78);break;case 135:_l(135);break;case 142:_l(142);break;case 197:_l(197);break;case 168:_l(168);break;case 198:_l(198);break;case 233:_l(233);break;default:_l(255)}}function Qa(){sc.startNonterminal(\"MainModule\",$l),f(),Pl(),Ga(),sc.endNonterminal(\"MainModule\",$l)}function Ga(){sc.startNonterminal(\"Program\",$l),nf(),sc.endNonterminal(\"Program\",$l)}function Ya(){sc.startNonterminal(\"Statements\",$l);for(;;){Bl(285);switch(Jl){case 35:jl(271);break;case 36:Il(244);break;case 47:jl(287);break;case 48:jl(261);break;case 55:Il(4);break;case 56:Il(1);break;case 60:Il(3);break;case 69:jl(274);break;case 78:jl(270);break;case 133:jl(145);break;case 161:jl(277);break;case 177:jl(167);break;case 187:jl(248);break;case 196:jl(268);break;case 220:jl(246);break;case 223:jl(171);break;case 266:jl(189);break;case 281:jl(284);break;case 283:jl(275);break;case 31:case 33:jl(247);break;case 41:case 43:jl(267);break;case 83:case 122:jl(254);break;case 87:case 103:jl(143);break;case 97:case 249:jl(96);break;case 111:case 222:jl(262);break;case 139:case 142:jl(180);break;case 135:case 197:case 255:jl(212);break;case 104:case 130:case 240:case 268:jl(141);break;case 120:case 206:case 256:case 262:jl(146);break;case 8:case 9:case 10:case 11:case 32:jl(211);break;case 79:case 121:case 125:case 167:case 169:case 188:case 194:case 230:case 231:case 247:jl(20);break;case 6:case 71:case 73:case 74:case 75:case 76:case 80:case 81:case 82:case 84:case 85:case 86:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 105:case 106:case 107:case 109:case 110:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 132:case 134:case 136:case 137:case 138:case 143:case 147:case 148:case 150:case 152:case 153:case 154:case 155:case 156:case 157:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 241:case 242:case 245:case 248:case 253:case 254:case 257:case 258:case 259:case 260:case 263:case 267:case 269:case 272:case 273:case 276:jl(94);break;default:Xl=Jl}if(Xl!=25&&Xl!=54&&Xl!=287&&Xl!=12808&&Xl!=12809&&Xl!=12810&&Xl!=12811&&Xl!=12832&&Xl!=12847&&Xl!=12935&&Xl!=12997&&Xl!=13055&&Xl!=16140&&Xl!=21512&&Xl!=21513&&Xl!=21514&&Xl!=21515&&Xl!=21536&&Xl!=21551&&Xl!=21639&&Xl!=21701&&Xl!=21759&&Xl!=27656&&Xl!=27657&&Xl!=27658&&Xl!=27659&&Xl!=27680&&Xl!=27695&&Xl!=27783&&Xl!=27845&&Xl!=27903&&Xl!=91735&&Xl!=91751&&Xl!=115333&&Xl!=146952&&Xl!=146953&&Xl!=146954&&Xl!=146955&&Xl!=146976&&Xl!=146991&&Xl!=147079&&Xl!=147141&&Xl!=147199){Xl=Ul(8,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{of(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(8,$l,Xl)}}if(Xl!=-1&&Xl!=54&&Xl!=16140&&Xl!=27656&&Xl!=27657&&Xl!=27658&&Xl!=27659&&Xl!=27680&&Xl!=27695&&Xl!=27783&&Xl!=27845&&Xl!=27903&&Xl!=91735&&Xl!=91751&&Xl!=115333)break;Pl(),sf()}sc.endNonterminal(\"Statements\",$l)}function Za(){for(;;){Bl(285);switch(Jl){case 35:jl(271);break;case 36:Il(244);break;case 47:jl(287);break;case 48:jl(261);break;case 55:Il(4);break;case 56:Il(1);break;case 60:Il(3);break;case 69:jl(274);break;case 78:jl(270);break;case 133:jl(145);break;case 161:jl(277);break;case 177:jl(167);break;case 187:jl(248);break;case 196:jl(268);break;case 220:jl(246);break;case 223:jl(171);break;case 266:jl(189);break;case 281:jl(284);break;case 283:jl(275);break;case 31:case 33:jl(247);break;case 41:case 43:jl(267);break;case 83:case 122:jl(254);break;case 87:case 103:jl(143);break;case 97:case 249:jl(96);break;case 111:case 222:jl(262);break;case 139:case 142:jl(180);break;case 135:case 197:case 255:jl(212);break;case 104:case 130:case 240:case 268:jl(141);break;case 120:case 206:case 256:case 262:jl(146);break;case 8:case 9:case 10:case 11:case 32:jl(211);break;case 79:case 121:case 125:case 167:case 169:case 188:case 194:case 230:case 231:case 247:jl(20);break;case 6:case 71:case 73:case 74:case 75:case 76:case 80:case 81:case 82:case 84:case 85:case 86:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 105:case 106:case 107:case 109:case 110:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 132:case 134:case 136:case 137:case 138:case 143:case 147:case 148:case 150:case 152:case 153:case 154:case 155:case 156:case 157:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 241:case 242:case 245:case 248:case 253:case 254:case 257:case 258:case 259:case 260:case 263:case 267:case 269:case 272:case 273:case 276:jl(94);break;default:Xl=Jl}if(Xl!=25&&Xl!=54&&Xl!=287&&Xl!=12808&&Xl!=12809&&Xl!=12810&&Xl!=12811&&Xl!=12832&&Xl!=12847&&Xl!=12935&&Xl!=12997&&Xl!=13055&&Xl!=16140&&Xl!=21512&&Xl!=21513&&Xl!=21514&&Xl!=21515&&Xl!=21536&&Xl!=21551&&Xl!=21639&&Xl!=21701&&Xl!=21759&&Xl!=27656&&Xl!=27657&&Xl!=27658&&Xl!=27659&&Xl!=27680&&Xl!=27695&&Xl!=27783&&Xl!=27845&&Xl!=27903&&Xl!=91735&&Xl!=91751&&Xl!=115333&&Xl!=146952&&Xl!=146953&&Xl!=146954&&Xl!=146955&&Xl!=146976&&Xl!=146991&&Xl!=147079&&Xl!=147141&&Xl!=147199){Xl=Ul(8,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{of(),Rl(8,t,-1);continue}catch(a){Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(8,t,-2);break}}}if(Xl!=-1&&Xl!=54&&Xl!=16140&&Xl!=27656&&Xl!=27657&&Xl!=27658&&Xl!=27659&&Xl!=27680&&Xl!=27695&&Xl!=27783&&Xl!=27845&&Xl!=27903&&Xl!=91735&&Xl!=91751&&Xl!=115333)break;of()}}function ef(){sc.startNonterminal(\"StatementsAndExpr\",$l),Ya(),Pl(),Q(),sc.endNonterminal(\"StatementsAndExpr\",$l)}function tf(){Za(),G()}function nf(){sc.startNonterminal(\"StatementsAndOptionalExpr\",$l),Ya(),Jl!=25&&Jl!=287&&(Pl(),Q()),sc.endNonterminal(\"StatementsAndOptionalExpr\",$l)}function rf(){Za(),Jl!=25&&Jl!=287&&G()}function sf(){sc.startNonterminal(\"Statement\",$l);switch(Jl){case 133:jl(145);break;case 177:jl(167);break;case 256:jl(146);break;case 268:jl(141);break;case 281:jl(284);break;case 31:case 33:jl(247);break;case 87:case 103:jl(143);break;case 139:case 142:jl(180);break;case 154:case 248:case 259:case 273:jl(94);break;default:Xl=Jl}if(Xl!=6&&Xl!=8&&Xl!=9&&Xl!=10&&Xl!=11&&Xl!=32&&Xl!=35&&Xl!=36&&Xl!=41&&Xl!=43&&Xl!=47&&Xl!=48&&Xl!=54&&Xl!=55&&Xl!=56&&Xl!=60&&Xl!=69&&Xl!=71&&Xl!=73&&Xl!=74&&Xl!=75&&Xl!=76&&Xl!=78&&Xl!=79&&Xl!=80&&Xl!=81&&Xl!=82&&Xl!=83&&Xl!=84&&Xl!=85&&Xl!=86&&Xl!=89&&Xl!=90&&Xl!=91&&Xl!=92&&Xl!=94&&Xl!=95&&Xl!=97&&Xl!=98&&Xl!=99&&Xl!=102&&Xl!=104&&Xl!=105&&Xl!=106&&Xl!=107&&Xl!=109&&Xl!=110&&Xl!=111&&Xl!=112&&Xl!=113&&Xl!=114&&Xl!=119&&Xl!=120&&Xl!=121&&Xl!=122&&Xl!=123&&Xl!=124&&Xl!=125&&Xl!=126&&Xl!=127&&Xl!=129&&Xl!=130&&Xl!=132&&Xl!=134&&Xl!=135&&Xl!=136&&Xl!=137&&Xl!=138&&Xl!=143&&Xl!=147&&Xl!=148&&Xl!=150&&Xl!=152&&Xl!=153&&Xl!=155&&Xl!=156&&Xl!=157&&Xl!=161&&Xl!=162&&Xl!=163&&Xl!=164&&Xl!=165&&Xl!=166&&Xl!=167&&Xl!=168&&Xl!=169&&Xl!=170&&Xl!=173&&Xl!=174&&Xl!=175&&Xl!=179&&Xl!=181&&Xl!=183&&Xl!=184&&Xl!=185&&Xl!=187&&Xl!=188&&Xl!=189&&Xl!=194&&Xl!=195&&Xl!=196&&Xl!=197&&Xl!=198&&Xl!=202&&Xl!=203&&Xl!=204&&Xl!=205&&Xl!=206&&Xl!=207&&Xl!=210&&Xl!=216&&Xl!=217&&Xl!=220&&Xl!=222&&Xl!=223&&Xl!=224&&Xl!=225&&Xl!=226&&Xl!=228&&Xl!=229&&Xl!=230&&Xl!=231&&Xl!=232&&Xl!=233&&Xl!=234&&Xl!=239&&Xl!=240&&Xl!=241&&Xl!=242&&Xl!=245&&Xl!=247&&Xl!=249&&Xl!=253&&Xl!=254&&Xl!=255&&Xl!=257&&Xl!=258&&Xl!=260&&Xl!=262&&Xl!=263&&Xl!=266&&Xl!=267&&Xl!=269&&Xl!=272&&Xl!=276&&Xl!=283&&Xl!=10009&&Xl!=14935&&Xl!=14951&&Xl!=14981&&Xl!=14987&&Xl!=14990&&Xl!=15002&&Xl!=15025&&Xl!=15096&&Xl!=15104&&Xl!=15107&&Xl!=15116&&Xl!=15121&&Xl!=16011&&Xl!=16014&&Xl!=16049&&Xl!=16140&&Xl!=18007&&Xl!=18023&&Xl!=18053&&Xl!=18059&&Xl!=18062&&Xl!=18074&&Xl!=18097&&Xl!=18168&&Xl!=18176&&Xl!=18179&&Xl!=18188&&Xl!=91735&&Xl!=91751&&Xl!=115333&&Xl!=118961&&Xl!=122507&&Xl!=122510&&Xl!=131723&&Xl!=131726&&Xl!=144128&&Xl!=147225){Xl=Ul(9,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{af(),Xl=-1}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),lf(),Xl=-2}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),hf(),Xl=-3}catch(l){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Bf(),Xl=-12}catch(c){Xl=-13}}}}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(9,$l,Xl)}}switch(Xl){case-2:ff();break;case-3:cf();break;case 91735:pf();break;case 91751:vf();break;case 115333:gf();break;case 16011:case 16014:case 16049:case 118961:case 122507:case 122510:case 131723:case 131726:bf();break;case 18074:xf();break;case 18168:Nf();break;case 144128:Af();break;case 18179:Mf();break;case-12:case 16140:Hf();break;case-13:jf();break;case 54:If();break;default:uf()}sc.endNonterminal(\"Statement\",$l)}function of(){switch(Jl){case 133:jl(145);break;case 177:jl(167);break;case 256:jl(146);break;case 268:jl(141);break;case 281:jl(284);break;case 31:case 33:jl(247);break;case 87:case 103:jl(143);break;case 139:case 142:jl(180);break;case 154:case 248:case 259:case 273:jl(94);break;default:Xl=Jl}if(Xl!=6&&Xl!=8&&Xl!=9&&Xl!=10&&Xl!=11&&Xl!=32&&Xl!=35&&Xl!=36&&Xl!=41&&Xl!=43&&Xl!=47&&Xl!=48&&Xl!=54&&Xl!=55&&Xl!=56&&Xl!=60&&Xl!=69&&Xl!=71&&Xl!=73&&Xl!=74&&Xl!=75&&Xl!=76&&Xl!=78&&Xl!=79&&Xl!=80&&Xl!=81&&Xl!=82&&Xl!=83&&Xl!=84&&Xl!=85&&Xl!=86&&Xl!=89&&Xl!=90&&Xl!=91&&Xl!=92&&Xl!=94&&Xl!=95&&Xl!=97&&Xl!=98&&Xl!=99&&Xl!=102&&Xl!=104&&Xl!=105&&Xl!=106&&Xl!=107&&Xl!=109&&Xl!=110&&Xl!=111&&Xl!=112&&Xl!=113&&Xl!=114&&Xl!=119&&Xl!=120&&Xl!=121&&Xl!=122&&Xl!=123&&Xl!=124&&Xl!=125&&Xl!=126&&Xl!=127&&Xl!=129&&Xl!=130&&Xl!=132&&Xl!=134&&Xl!=135&&Xl!=136&&Xl!=137&&Xl!=138&&Xl!=143&&Xl!=147&&Xl!=148&&Xl!=150&&Xl!=152&&Xl!=153&&Xl!=155&&Xl!=156&&Xl!=157&&Xl!=161&&Xl!=162&&Xl!=163&&Xl!=164&&Xl!=165&&Xl!=166&&Xl!=167&&Xl!=168&&Xl!=169&&Xl!=170&&Xl!=173&&Xl!=174&&Xl!=175&&Xl!=179&&Xl!=181&&Xl!=183&&Xl!=184&&Xl!=185&&Xl!=187&&Xl!=188&&Xl!=189&&Xl!=194&&Xl!=195&&Xl!=196&&Xl!=197&&Xl!=198&&Xl!=202&&Xl!=203&&Xl!=204&&Xl!=205&&Xl!=206&&Xl!=207&&Xl!=210&&Xl!=216&&Xl!=217&&Xl!=220&&Xl!=222&&Xl!=223&&Xl!=224&&Xl!=225&&Xl!=226&&Xl!=228&&Xl!=229&&Xl!=230&&Xl!=231&&Xl!=232&&Xl!=233&&Xl!=234&&Xl!=239&&Xl!=240&&Xl!=241&&Xl!=242&&Xl!=245&&Xl!=247&&Xl!=249&&Xl!=253&&Xl!=254&&Xl!=255&&Xl!=257&&Xl!=258&&Xl!=260&&Xl!=262&&Xl!=263&&Xl!=266&&Xl!=267&&Xl!=269&&Xl!=272&&Xl!=276&&Xl!=283&&Xl!=10009&&Xl!=14935&&Xl!=14951&&Xl!=14981&&Xl!=14987&&Xl!=14990&&Xl!=15002&&Xl!=15025&&Xl!=15096&&Xl!=15104&&Xl!=15107&&Xl!=15116&&Xl!=15121&&Xl!=16011&&Xl!=16014&&Xl!=16049&&Xl!=16140&&Xl!=18007&&Xl!=18023&&Xl!=18053&&Xl!=18059&&Xl!=18062&&Xl!=18074&&Xl!=18097&&Xl!=18168&&Xl!=18176&&Xl!=18179&&Xl!=18188&&Xl!=91735&&Xl!=91751&&Xl!=115333&&Xl!=118961&&Xl!=122507&&Xl!=122510&&Xl!=131723&&Xl!=131726&&Xl!=144128&&Xl!=147225){Xl=Ul(9,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{af(),Rl(9,t,-1),Xl=-15}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),lf(),Rl(9,t,-2),Xl=-15}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),hf(),Rl(9,t,-3),Xl=-15}catch(l){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Bf(),Rl(9,t,-12),Xl=-15}catch(c){Xl=-13,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(9,t,-13)}}}}}}switch(Xl){case-2:lf();break;case-3:hf();break;case 91735:df();break;case 91751:mf();break;case 115333:yf();break;case 16011:case 16014:case 16049:case 118961:case 122507:case 122510:case 131723:case 131726:wf();break;case 18074:Tf();break;case 18168:Cf();break;case 144128:Of();break;case 18179:_f();break;case-12:case 16140:Bf();break;case-13:Ff();break;case 54:qf();break;case-15:break;default:af()}}function uf(){sc.startNonterminal(\"ApplyStatement\",$l),zf(),Ml(54),sc.endNonterminal(\"ApplyStatement\",$l)}function af(){Wf(),_l(54)}function ff(){sc.startNonterminal(\"AssignStatement\",$l),Ml(31),Bl(247),Pl(),Ei(),Bl(28),Ml(53),Bl(268),Pl(),Rf(),Ml(54),sc.endNonterminal(\"AssignStatement\",$l)}function lf(){_l(31),Bl(247),Si(),Bl(28),_l(53),Bl(268),Uf(),_l(54)}function cf(){sc.startNonterminal(\"BlockStatement\",$l),Ml(281),Bl(272),Pl(),sf(),Bl(282),Pl(),Ya(),Ml(287),sc.endNonterminal(\"BlockStatement\",$l)}function hf(){_l(281),Bl(272),of(),Bl(282),Za(),_l(287)}function pf(){sc.startNonterminal(\"BreakStatement\",$l),Ml(87),Bl(62),Ml(179),Bl(29),Ml(54),sc.endNonterminal(\"BreakStatement\",$l)}function df(){_l(87),Bl(62),_l(179),Bl(29),_l(54)}function vf(){sc.startNonterminal(\"ContinueStatement\",$l),Ml(103),Bl(62),Ml(179),Bl(29),Ml(54),sc.endNonterminal(\"ContinueStatement\",$l)}function mf(){_l(103),Bl(62),_l(179),Bl(29),_l(54)}function gf(){sc.startNonterminal(\"ExitStatement\",$l),Ml(133),Bl(73),Ml(225),Bl(268),Pl(),Rf(),Ml(54),sc.endNonterminal(\"ExitStatement\",$l)}function yf(){_l(133),Bl(73),_l(225),Bl(268),Uf(),_l(54)}function bf(){sc.startNonterminal(\"FLWORStatement\",$l),et();for(;;){Bl(200);if(Jl==224||Jl==233)break;Pl(),nt()}Pl(),Ef(),sc.endNonterminal(\"FLWORStatement\",$l)}function wf(){tt();for(;;){Bl(200);if(Jl==224||Jl==233)break;rt()}Sf()}function Ef(){sc.startNonterminal(\"ReturnStatement\",$l);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(272),Pl(),sf(),sc.endNonterminal(\"ReturnStatement\",$l)}function Sf(){switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(272),of()}function xf(){sc.startNonterminal(\"IfStatement\",$l),Ml(154),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38),Bl(79),Ml(250),Bl(272),Pl(),sf(),Bl(51),Ml(123),Bl(272),Pl(),sf(),sc.endNonterminal(\"IfStatement\",$l)}function Tf(){_l(154),Bl(22),_l(35),Bl(268),G(),_l(38),Bl(79),_l(250),Bl(272),of(),Bl(51),_l(123),Bl(272),of()}function Nf(){sc.startNonterminal(\"SwitchStatement\",$l),Ml(248),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38);for(;;){Bl(38),Pl(),kf(),Bl(115);if(Jl!=89)break}Ml(110),Bl(136);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(272),Pl(),sf(),sc.endNonterminal(\"SwitchStatement\",$l)}function Cf(){_l(248),Bl(22),_l(35),Bl(268),G(),_l(38);for(;;){Bl(38),Lf(),Bl(115);if(Jl!=89)break}_l(110),Bl(136);switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(272),of()}function kf(){sc.startNonterminal(\"SwitchCaseStatement\",$l);for(;;){Ml(89),Bl(268),Pl(),cn();if(Jl!=89)break}switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(272),Pl(),sf(),sc.endNonterminal(\"SwitchCaseStatement\",$l)}function Lf(){for(;;){_l(89),Bl(268),hn();if(Jl!=89)break}switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(272),of()}function Af(){sc.startNonterminal(\"TryCatchStatement\",$l),Ml(256),Bl(89),Pl(),cf();for(;;){Bl(39),Ml(92),Bl(250),Pl(),An(),Pl(),cf(),Bl(285);switch(Jl){case 92:jl(257);break;default:Xl=Jl}if(Xl!=2652&&Xl!=3164&&Xl!=36444&&Xl!=37468&&Xl!=37980&&Xl!=38492&&Xl!=39004&&Xl!=40028&&Xl!=40540&&Xl!=41052&&Xl!=41564&&Xl!=42076&&Xl!=42588&&Xl!=43100&&Xl!=43612&&Xl!=44124&&Xl!=44636&&Xl!=45660&&Xl!=46172&&Xl!=46684&&Xl!=47196&&Xl!=48220&&Xl!=48732&&Xl!=49756&&Xl!=50268&&Xl!=50780&&Xl!=52316&&Xl!=52828&&Xl!=53340&&Xl!=53852&&Xl!=54364&&Xl!=54876&&Xl!=55900&&Xl!=56412&&Xl!=56924&&Xl!=57436&&Xl!=57948&&Xl!=58460&&Xl!=61020&&Xl!=61532&&Xl!=62044&&Xl!=62556&&Xl!=63068&&Xl!=63580&&Xl!=64092&&Xl!=64604&&Xl!=65116&&Xl!=66140&&Xl!=66652&&Xl!=67676&&Xl!=68188&&Xl!=68700&&Xl!=69212&&Xl!=69724&&Xl!=70236&&Xl!=70748&&Xl!=71260&&Xl!=72796&&Xl!=73308&&Xl!=75356&&Xl!=75868&&Xl!=76892&&Xl!=77916&&Xl!=78428&&Xl!=78940&&Xl!=79452&&Xl!=79964&&Xl!=80476&&Xl!=82524&&Xl!=83036&&Xl!=83548&&Xl!=84060&&Xl!=84572&&Xl!=85084&&Xl!=85596&&Xl!=86108&&Xl!=86620&&Xl!=87132&&Xl!=88668&&Xl!=89180&&Xl!=89692&&Xl!=90716&&Xl!=91740&&Xl!=92764&&Xl!=93788&&Xl!=94300&&Xl!=94812&&Xl!=95836&&Xl!=96348&&Xl!=96860&&Xl!=99420&&Xl!=99932&&Xl!=100956&&Xl!=101468&&Xl!=103516&&Xl!=104028&&Xl!=104540&&Xl!=105052&&Xl!=105564&&Xl!=106076&&Xl!=107612&&Xl!=110684&&Xl!=111196&&Xl!=112732&&Xl!=113756&&Xl!=114268&&Xl!=114780&&Xl!=115292&&Xl!=115804&&Xl!=116828&&Xl!=117340&&Xl!=117852&&Xl!=118364&&Xl!=118876&&Xl!=119388&&Xl!=119900&&Xl!=122460&&Xl!=122972&&Xl!=123484&&Xl!=123996&&Xl!=125532&&Xl!=126556&&Xl!=127068&&Xl!=127580&&Xl!=129628&&Xl!=130140&&Xl!=130652&&Xl!=131164&&Xl!=131676&&Xl!=132188&&Xl!=132700&&Xl!=133212&&Xl!=134236&&Xl!=134748&&Xl!=136284&&Xl!=136796&&Xl!=137308&&Xl!=137820&&Xl!=139356&&Xl!=139868&&Xl!=141404)break}sc.endNonterminal(\"TryCatchStatement\",$l)}function Of(){_l(256),Bl(89),hf();for(;;){Bl(39),_l(92),Bl(250),On(),hf(),Bl(285);switch(Jl){case 92:jl(257);break;default:Xl=Jl}if(Xl!=2652&&Xl!=3164&&Xl!=36444&&Xl!=37468&&Xl!=37980&&Xl!=38492&&Xl!=39004&&Xl!=40028&&Xl!=40540&&Xl!=41052&&Xl!=41564&&Xl!=42076&&Xl!=42588&&Xl!=43100&&Xl!=43612&&Xl!=44124&&Xl!=44636&&Xl!=45660&&Xl!=46172&&Xl!=46684&&Xl!=47196&&Xl!=48220&&Xl!=48732&&Xl!=49756&&Xl!=50268&&Xl!=50780&&Xl!=52316&&Xl!=52828&&Xl!=53340&&Xl!=53852&&Xl!=54364&&Xl!=54876&&Xl!=55900&&Xl!=56412&&Xl!=56924&&Xl!=57436&&Xl!=57948&&Xl!=58460&&Xl!=61020&&Xl!=61532&&Xl!=62044&&Xl!=62556&&Xl!=63068&&Xl!=63580&&Xl!=64092&&Xl!=64604&&Xl!=65116&&Xl!=66140&&Xl!=66652&&Xl!=67676&&Xl!=68188&&Xl!=68700&&Xl!=69212&&Xl!=69724&&Xl!=70236&&Xl!=70748&&Xl!=71260&&Xl!=72796&&Xl!=73308&&Xl!=75356&&Xl!=75868&&Xl!=76892&&Xl!=77916&&Xl!=78428&&Xl!=78940&&Xl!=79452&&Xl!=79964&&Xl!=80476&&Xl!=82524&&Xl!=83036&&Xl!=83548&&Xl!=84060&&Xl!=84572&&Xl!=85084&&Xl!=85596&&Xl!=86108&&Xl!=86620&&Xl!=87132&&Xl!=88668&&Xl!=89180&&Xl!=89692&&Xl!=90716&&Xl!=91740&&Xl!=92764&&Xl!=93788&&Xl!=94300&&Xl!=94812&&Xl!=95836&&Xl!=96348&&Xl!=96860&&Xl!=99420&&Xl!=99932&&Xl!=100956&&Xl!=101468&&Xl!=103516&&Xl!=104028&&Xl!=104540&&Xl!=105052&&Xl!=105564&&Xl!=106076&&Xl!=107612&&Xl!=110684&&Xl!=111196&&Xl!=112732&&Xl!=113756&&Xl!=114268&&Xl!=114780&&Xl!=115292&&Xl!=115804&&Xl!=116828&&Xl!=117340&&Xl!=117852&&Xl!=118364&&Xl!=118876&&Xl!=119388&&Xl!=119900&&Xl!=122460&&Xl!=122972&&Xl!=123484&&Xl!=123996&&Xl!=125532&&Xl!=126556&&Xl!=127068&&Xl!=127580&&Xl!=129628&&Xl!=130140&&Xl!=130652&&Xl!=131164&&Xl!=131676&&Xl!=132188&&Xl!=132700&&Xl!=133212&&Xl!=134236&&Xl!=134748&&Xl!=136284&&Xl!=136796&&Xl!=137308&&Xl!=137820&&Xl!=139356&&Xl!=139868&&Xl!=141404)break}}function Mf(){sc.startNonterminal(\"TypeswitchStatement\",$l),Ml(259),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38);for(;;){Bl(38),Pl(),Df(),Bl(115);if(Jl!=89)break}Ml(110),Bl(149),Jl==31&&(Ml(31),Bl(247),Pl(),Ei()),Bl(136);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(272),Pl(),sf(),sc.endNonterminal(\"TypeswitchStatement\",$l)}function _f(){_l(259),Bl(22),_l(35),Bl(268),G(),_l(38);for(;;){Bl(38),Pf(),Bl(115);if(Jl!=89)break}_l(110),Bl(149),Jl==31&&(_l(31),Bl(247),Si()),Bl(136);switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(272),of()}function Df(){sc.startNonterminal(\"CaseStatement\",$l),Ml(89),Bl(259),Jl==31&&(Ml(31),Bl(247),Pl(),Ei(),Bl(33),Ml(80)),Bl(255),Pl(),Ns(),Bl(136);switch(Jl){case 224:Ml(224);break;default:Ml(233)}Bl(272),Pl(),sf(),sc.endNonterminal(\"CaseStatement\",$l)}function Pf(){_l(89),Bl(259),Jl==31&&(_l(31),Bl(247),Si(),Bl(33),_l(80)),Bl(255),Cs(),Bl(136);switch(Jl){case 224:_l(224);break;default:_l(233)}Bl(272),of()}function Hf(){sc.startNonterminal(\"VarDeclStatement\",$l);for(;;){Bl(100);if(Jl!=33)break;Pl(),H()}Ml(268),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(173),Jl==80&&(Pl(),xs()),Bl(154),Jl==53&&(Ml(53),Bl(268),Pl(),Rf());for(;;){if(Jl!=42)break;Ml(42),Bl(21),Ml(31),Bl(247),Pl(),Ei(),Bl(173),Jl==80&&(Pl(),xs()),Bl(154),Jl==53&&(Ml(53),Bl(268),Pl(),Rf())}Ml(54),sc.endNonterminal(\"VarDeclStatement\",$l)}function Bf(){for(;;){Bl(100);if(Jl!=33)break;B()}_l(268),Bl(21),_l(31),Bl(247),Si(),Bl(173),Jl==80&&Ts(),Bl(154),Jl==53&&(_l(53),Bl(268),Uf());for(;;){if(Jl!=42)break;_l(42),Bl(21),_l(31),Bl(247),Si(),Bl(173),Jl==80&&Ts(),Bl(154),Jl==53&&(_l(53),Bl(268),Uf())}_l(54)}function jf(){sc.startNonterminal(\"WhileStatement\",$l),Ml(273),Bl(22),Ml(35),Bl(268),Pl(),Q(),Ml(38),Bl(272),Pl(),sf(),sc.endNonterminal(\"WhileStatement\",$l)}function Ff(){_l(273),Bl(22),_l(35),Bl(268),G(),_l(38),Bl(272),of()}function If(){sc.startNonterminal(\"VoidStatement\",$l),Ml(54),sc.endNonterminal(\"VoidStatement\",$l)}function qf(){_l(54)}function Rf(){sc.startNonterminal(\"ExprSingle\",$l);switch(Jl){case 177:jl(167);break;case 256:jl(146);break;case 139:case 142:jl(180);break;case 154:case 248:case 259:jl(94);break;default:Xl=Jl}switch(Xl){case 16011:case 16014:case 16049:case 118961:case 122507:case 122510:case 131723:case 131726:Y();break;case 18074:bn();break;case 18168:un();break;case 144128:En();break;case 18179:pn();break;default:zf()}sc.endNonterminal(\"ExprSingle\",$l)}function Uf(){switch(Jl){case 177:jl(167);break;case 256:jl(146);break;case 139:case 142:jl(180);break;case 154:case 248:case 259:jl(94);break;default:Xl=Jl}switch(Xl){case 16011:case 16014:case 16049:case 118961:case 122507:case 122510:case 131723:case 131726:Z();break;case 18074:wn();break;case 18168:an();break;case 144128:Sn();break;case 18179:dn();break;default:Wf()}}function zf(){sc.startNonterminal(\"ExprSimple\",$l);switch(Jl){case 78:jl(270);break;case 161:jl(277);break;case 223:jl(171);break;case 111:case 222:jl(262);break;case 104:case 130:case 240:jl(141);break;default:Xl=Jl}if(Xl==17998||Xl==18031||Xl==18081||Xl==18142||Xl==99439||Xl==99489||Xl==99550||Xl==99951||Xl==100001||Xl==136927){Xl=Ul(10,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_n(),Xl=-2}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),qo(),Xl=-3}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Uo(),Xl=-4}catch(l){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Vo(),Xl=-5}catch(c){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Wo(),Xl=-6}catch(h){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Vf(),Xl=-8}catch(p){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Jf(),Xl=-9}catch(d){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Qf(),Xl=-10}catch(v){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Yf(),Xl=-11}catch(m){Xl=-12}}}}}}}}}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(10,$l,Xl)}}switch(Xl){case 16002:case 16112:sn();break;case-3:Io();break;case-4:Ro();break;case-5:Xo();break;case-6:case 99551:zo();break;case 15976:Zo();break;case-8:case 3183:case 4207:case 4719:case 5231:case 5743:case 15983:case 16495:case 17007:case 28271:case 28783:case 30831:case 35439:case 36463:case 37487:case 37999:case 38511:case 39023:case 40047:case 40559:case 41071:case 41583:case 42095:case 42607:case 43119:case 43631:case 44143:case 44655:case 45679:case 46191:case 46703:case 47215:case 48239:case 48751:case 49775:case 50287:case 50799:case 52335:case 52847:case 53359:case 53871:case 54383:case 54895:case 55919:case 56431:case 56943:case 57455:case 57967:case 58479:case 61039:case 61551:case 62063:case 62575:case 63087:case 63599:case 64111:case 64623:case 65135:case 66159:case 66671:case 67695:case 68207:case 68719:case 69231:case 69743:case 70255:case 70767:case 71279:case 72815:case 73327:case 75375:case 75887:case 76911:case 77935:case 78447:case 78959:case 79471:case 79983:case 80495:case 82543:case 83055:case 83567:case 84079:case 84591:case 85103:case 85615:case 86127:case 86639:case 87151:case 88687:case 89199:case 89711:case 90735:case 91759:case 92783:case 93807:case 94319:case 94831:case 95855:case 96367:case 96879:case 100975:case 101487:case 103535:case 104047:case 104559:case 105071:case 105583:case 106095:case 107631:case 110703:case 111215:case 112751:case 113775:case 114287:case 114799:case 115311:case 115823:case 116847:case 117359:case 117871:case 118383:case 118895:case 119407:case 119919:case 122479:case 122991:case 123503:case 124015:case 125551:case 126575:case 127087:case 127599:case 129647:case 130159:case 130671:case 131183:case 131695:case 132207:case 132719:case 133231:case 134255:case 134767:case 136303:case 136815:case 137327:case 137839:case 139375:case 139887:case 141423:case 143983:case 145007:Xf();break;case-9:case 3233:case 4257:case 4769:case 5281:case 5793:case 9889:case 16033:case 16545:case 17057:case 18593:case 21153:case 22177:case 24225:case 24737:case 28321:case 28833:case 30881:case 35489:case 36513:case 37537:case 38049:case 38561:case 39073:case 40097:case 40609:case 41121:case 41633:case 42145:case 42657:case 43169:case 43681:case 44193:case 44705:case 45729:case 46241:case 46753:case 47265:case 48289:case 48801:case 49825:case 50337:case 50849:case 52385:case 52897:case 53409:case 53921:case 54433:case 54945:case 55969:case 56481:case 56993:case 57505:case 58017:case 58529:case 61089:case 61601:case 62113:case 62625:case 63137:case 63649:case 64161:case 64673:case 65185:case 66209:case 66721:case 67745:case 68257:case 68769:case 69281:case 69793:case 70305:case 70817:case 71329:case 72865:case 73377:case 75425:case 75937:case 76961:case 77985:case 78497:case 79009:case 79521:case 80033:case 80545:case 82593:case 83105:case 83617:case 84129:case 84641:case 85153:case 85665:case 86177:case 86689:case 87201:case 88737:case 89249:case 89761:case 90785:case 91809:case 92833:case 93857:case 94369:case 94881:case 95905:case 96417:case 96929:case 100513:case 101025:case 101537:case 103585:case 104097:case 104609:case 105121:case 105633:case 106145:case 107681:case 110753:case 111265:case 112801:case 113825:case 114337:case 114849:case 115361:case 115873:case 116897:case 117409:case 117921:case 118433:case 118945:case 119457:case 119969:case 122529:case 123041:case 123553:case 124065:case 125601:case 126625:case 127137:case 127649:case 129697:case 130209:case 130721:case 131233:case 131745:case 132257:case 132769:case 133281:case 134305:case 134817:case 136353:case 136865:case 137377:case 137889:case 139425:case 139937:case 141473:case 144033:case 145057:$f();break;case-10:case 3294:case 4318:case 4830:case 5342:case 5854:case 16094:case 16606:case 17118:case 28382:case 28894:case 30942:case 35550:case 36574:case 37598:case 38110:case 38622:case 39134:case 40158:case 40670:case 41182:case 41694:case 42206:case 42718:case 43230:case 43742:case 44254:case 44766:case 45790:case 46302:case 46814:case 47326:case 48350:case 48862:case 49886:case 50398:case 50910:case 52446:case 52958:case 53470:case 53982:case 54494:case 55006:case 56030:case 56542:case 57054:case 57566:case 58078:case 58590:case 61150:case 61662:case 62174:case 62686:case 63198:case 63710:case 64222:case 64734:case 65246:case 66270:case 66782:case 67806:case 68318:case 68830:case 69342:case 69854:case 70366:case 70878:case 71390:case 72926:case 73438:case 75486:case 75998:case 77022:case 78046:case 78558:case 79070:case 79582:case 80094:case 80606:case 82654:case 83166:case 83678:case 84190:case 84702:case 85214:case 85726:case 86238:case 86750:case 87262:case 88798:case 89310:case 89822:case 90846:case 91870:case 92894:case 93918:case 94430:case 94942:case 95966:case 96478:case 96990:case 100062:case 101086:case 101598:case 103646:case 104158:case 104670:case 105182:case 105694:case 106206:case 107742:case 110814:case 111326:case 112862:case 113886:case 114398:case 114910:case 115422:case 115934:case 116958:case 117470:case 117982:case 118494:case 119006:case 119518:case 120030:case 122590:case 123102:case 123614:case 124126:case 125662:case 126686:case 127198:case 127710:case 129758:case 130270:case 130782:case 131294:case 131806:case 132318:case 132830:case 133342:case 134366:case 134878:case 136414:case 136926:case 137438:case 137950:case 139486:case 139998:case 141534:case 144094:case 145118:Kf();break;case-11:Gf();break;case-12:case 3150:case 4174:case 4686:case 5198:case 5710:case 15950:case 16462:case 16974:case 18510:case 21070:case 22094:case 24142:case 24654:case 28238:case 28750:case 30798:case 35406:case 36430:case 37454:case 37966:case 38478:case 38990:case 40014:case 40526:case 41038:case 41550:case 42062:case 42574:case 43086:case 43598:case 44110:case 44622:case 45646:case 46158:case 46670:case 47182:case 48206:case 48718:case 49742:case 50254:case 50766:case 52302:case 52814:case 53326:case 53838:case 54350:case 54862:case 55886:case 56398:case 56910:case 57422:case 57934:case 58446:case 61006:case 61518:case 62030:case 62542:case 63054:case 63566:case 64078:case 64590:case 65102:case 66126:case 66638:case 67662:case 68174:case 68686:case 69198:case 69710:case 70222:case 70734:case 71246:case 72782:case 73294:case 75342:case 75854:case 76878:case 77902:case 78414:case 78926:case 79438:case 79950:case 80462:case 82510:case 83022:case 83534:case 84046:case 84558:case 85070:case 85582:case 86094:case 86606:case 87118:case 88654:case 89166:case 89678:case 90702:case 91726:case 92750:case 93774:case 94286:case 94798:case 95822:case 96334:case 96846:case 99406:case 99918:case 100430:case 100942:case 101454:case 103502:case 104014:case 104526:case 105038:case 105550:case 106062:case 107598:case 110670:case 111182:case 112718:case 113742:case 114254:case 114766:case 115278:case 115790:case 116814:case 117326:case 117838:case 118350:case 118862:case 119374:case 119886:case 122446:case 122958:case 123470:case 123982:case 125518:case 126542:case 127054:case 127566:case 129614:case 130126:case 130638:case 131150:case 131662:case 132174:case 132686:case 133198:case 134222:case 134734:case 136270:case 136782:case 137294:case 137806:case 139342:case 139854:case 141390:case 143950:case 144974:Zf();break;default:Mn()}sc.endNonterminal(\"ExprSimple\",$l)}function Wf(){switch(Jl){case 78:jl(270);break;case 161:jl(277);break;case 223:jl(171);break;case 111:case 222:jl(262);break;case 104:case 130:case 240:jl(141);break;default:Xl=Jl}if(Xl==17998||Xl==18031||Xl==18081||Xl==18142||Xl==99439||Xl==99489||Xl==99550||Xl==99951||Xl==100001||Xl==136927){Xl=Ul(10,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_n(),Rl(10,t,-2),Xl=-13}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),qo(),Rl(10,t,-3),Xl=-13}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Uo(),Rl(10,t,-4),Xl=-13}catch(l){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Vo(),Rl(10,t,-5),Xl=-13}catch(c){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Wo(),Rl(10,t,-6),Xl=-13}catch(h){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Vf(),Rl(10,t,-8),Xl=-13}catch(p){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Jf(),Rl(10,t,-9),Xl=-13}catch(d){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Qf(),Rl(10,t,-10),Xl=-13}catch(v){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Yf(),Rl(10,t,-11),Xl=-13}catch(m){Xl=-12,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(10,t,-12)}}}}}}}}}}}switch(Xl){case 16002:case 16112:on();break;case-3:qo();break;case-4:Uo();break;case-5:Vo();break;case-6:case 99551:Wo();break;case 15976:eu();break;case-8:case 3183:case 4207:case 4719:case 5231:case 5743:case 15983:case 16495:case 17007:case 28271:case 28783:case 30831:case 35439:case 36463:case 37487:case 37999:case 38511:case 39023:case 40047:case 40559:case 41071:case 41583:case 42095:case 42607:case 43119:case 43631:case 44143:case 44655:case 45679:case 46191:case 46703:case 47215:case 48239:case 48751:case 49775:case 50287:case 50799:case 52335:case 52847:case 53359:case 53871:case 54383:case 54895:case 55919:case 56431:case 56943:case 57455:case 57967:case 58479:case 61039:case 61551:case 62063:case 62575:case 63087:case 63599:case 64111:case 64623:case 65135:case 66159:case 66671:case 67695:case 68207:case 68719:case 69231:case 69743:case 70255:case 70767:case 71279:case 72815:case 73327:case 75375:case 75887:case 76911:case 77935:case 78447:case 78959:case 79471:case 79983:case 80495:case 82543:case 83055:case 83567:case 84079:case 84591:case 85103:case 85615:case 86127:case 86639:case 87151:case 88687:case 89199:case 89711:case 90735:case 91759:case 92783:case 93807:case 94319:case 94831:case 95855:case 96367:case 96879:case 100975:case 101487:case 103535:case 104047:case 104559:case 105071:case 105583:case 106095:case 107631:case 110703:case 111215:case 112751:case 113775:case 114287:case 114799:case 115311:case 115823:case 116847:case 117359:case 117871:case 118383:case 118895:case 119407:case 119919:case 122479:case 122991:case 123503:case 124015:case 125551:case 126575:case 127087:case 127599:case 129647:case 130159:case 130671:case 131183:case 131695:case 132207:case 132719:case 133231:case 134255:case 134767:case 136303:case 136815:case 137327:case 137839:case 139375:case 139887:case 141423:case 143983:case 145007:Vf();break;case-9:case 3233:case 4257:case 4769:case 5281:case 5793:case 9889:case 16033:case 16545:case 17057:case 18593:case 21153:case 22177:case 24225:case 24737:case 28321:case 28833:case 30881:case 35489:case 36513:case 37537:case 38049:case 38561:case 39073:case 40097:case 40609:case 41121:case 41633:case 42145:case 42657:case 43169:case 43681:case 44193:case 44705:case 45729:case 46241:case 46753:case 47265:case 48289:case 48801:case 49825:case 50337:case 50849:case 52385:case 52897:case 53409:case 53921:case 54433:case 54945:case 55969:case 56481:case 56993:case 57505:case 58017:case 58529:case 61089:case 61601:case 62113:case 62625:case 63137:case 63649:case 64161:case 64673:case 65185:case 66209:case 66721:case 67745:case 68257:case 68769:case 69281:case 69793:case 70305:case 70817:case 71329:case 72865:case 73377:case 75425:case 75937:case 76961:case 77985:case 78497:case 79009:case 79521:case 80033:case 80545:case 82593:case 83105:case 83617:case 84129:case 84641:case 85153:case 85665:case 86177:case 86689:case 87201:case 88737:case 89249:case 89761:case 90785:case 91809:case 92833:case 93857:case 94369:case 94881:case 95905:case 96417:case 96929:case 100513:case 101025:case 101537:case 103585:case 104097:case 104609:case 105121:case 105633:case 106145:case 107681:case 110753:case 111265:case 112801:case 113825:case 114337:case 114849:case 115361:case 115873:case 116897:case 117409:case 117921:case 118433:case 118945:case 119457:case 119969:case 122529:case 123041:case 123553:case 124065:case 125601:case 126625:case 127137:case 127649:case 129697:case 130209:case 130721:case 131233:case 131745:case 132257:case 132769:case 133281:case 134305:case 134817:case 136353:case 136865:case 137377:case 137889:case 139425:case 139937:case 141473:case 144033:case 145057:Jf();break;case-10:case 3294:case 4318:case 4830:case 5342:case 5854:case 16094:case 16606:case 17118:case 28382:case 28894:case 30942:case 35550:case 36574:case 37598:case 38110:case 38622:case 39134:case 40158:case 40670:case 41182:case 41694:case 42206:case 42718:case 43230:case 43742:case 44254:case 44766:case 45790:case 46302:case 46814:case 47326:case 48350:case 48862:case 49886:case 50398:case 50910:case 52446:case 52958:case 53470:case 53982:case 54494:case 55006:case 56030:case 56542:case 57054:case 57566:case 58078:case 58590:case 61150:case 61662:case 62174:case 62686:case 63198:case 63710:case 64222:case 64734:case 65246:case 66270:case 66782:case 67806:case 68318:case 68830:case 69342:case 69854:case 70366:case 70878:case 71390:case 72926:case 73438:case 75486:case 75998:case 77022:case 78046:case 78558:case 79070:case 79582:case 80094:case 80606:case 82654:case 83166:case 83678:case 84190:case 84702:case 85214:case 85726:case 86238:case 86750:case 87262:case 88798:case 89310:case 89822:case 90846:case 91870:case 92894:case 93918:case 94430:case 94942:case 95966:case 96478:case 96990:case 100062:case 101086:case 101598:case 103646:case 104158:case 104670:case 105182:case 105694:case 106206:case 107742:case 110814:case 111326:case 112862:case 113886:case 114398:case 114910:case 115422:case 115934:case 116958:case 117470:case 117982:case 118494:case 119006:case 119518:case 120030:case 122590:case 123102:case 123614:case 124126:case 125662:case 126686:case 127198:case 127710:case 129758:case 130270:case 130782:case 131294:case 131806:case 132318:case 132830:case 133342:case 134366:case 134878:case 136414:case 136926:case 137438:case 137950:case 139486:case 139998:case 141534:case 144094:case 145118:Qf();break;case-11:Yf();break;case-12:case 3150:case 4174:case 4686:case 5198:case 5710:case 15950:case 16462:case 16974:case 18510:case 21070:case 22094:case 24142:case 24654:case 28238:case 28750:case 30798:case 35406:case 36430:case 37454:case 37966:case 38478:case 38990:case 40014:case 40526:case 41038:case 41550:case 42062:case 42574:case 43086:case 43598:case 44110:case 44622:case 45646:case 46158:case 46670:case 47182:case 48206:case 48718:case 49742:case 50254:case 50766:case 52302:case 52814:case 53326:case 53838:case 54350:case 54862:case 55886:case 56398:case 56910:case 57422:case 57934:case 58446:case 61006:case 61518:case 62030:case 62542:case 63054:case 63566:case 64078:case 64590:case 65102:case 66126:case 66638:case 67662:case 68174:case 68686:case 69198:case 69710:case 70222:case 70734:case 71246:case 72782:case 73294:case 75342:case 75854:case 76878:case 77902:case 78414:case 78926:case 79438:case 79950:case 80462:case 82510:case 83022:case 83534:case 84046:case 84558:case 85070:case 85582:case 86094:case 86606:case 87118:case 88654:case 89166:case 89678:case 90702:case 91726:case 92750:case 93774:case 94286:case 94798:case 95822:case 96334:case 96846:case 99406:case 99918:case 100430:case 100942:case 101454:case 103502:case 104014:case 104526:case 105038:case 105550:case 106062:case 107598:case 110670:case 111182:case 112718:case 113742:case 114254:case 114766:case 115278:case 115790:case 116814:case 117326:case 117838:case 118350:case 118862:case 119374:case 119886:case 122446:case 122958:case 123470:case 123982:case 125518:case 126542:case 127054:case 127566:case 129614:case 130126:case 130638:case 131150:case 131662:case 132174:case 132686:case 133198:case 134222:case 134734:case 136270:case 136782:case 137294:case 137806:case 139342:case 139854:case 141390:case 143950:case 144974:el();break;case-13:break;default:_n()}}function Xf(){sc.startNonterminal(\"JSONDeleteExpr\",$l),Ml(111),Bl(261);switch(Jl){case 168:jl(262);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(11,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(11,$l,Xl)}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&Ml(168),Bl(261),Pl(),Gr(),sc.endNonterminal(\"JSONDeleteExpr\",$l)}function Vf(){_l(111),Bl(261);switch(Jl){case 168:jl(262);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(11,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Rl(11,t,-1)}catch(a){Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(11,t,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(261),Yr()}function $f(){sc.startNonterminal(\"JSONInsertExpr\",$l);switch(Jl){case 161:jl(269);break;default:Xl=Jl}if(Xl!=9889){Xl=Ul(12,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(161),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(13,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Rl(13,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(13,f,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(268),Uf(),_l(165),Bl(268),Uf();switch(Jl){case 82:jl(72);break;default:Xl=Jl}if(Xl==110162){Xl=Ul(14,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(82),Bl(72),_l(215),Bl(268),Uf(),Rl(14,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(14,f,-2)}Xl=-2}}Xl==-1&&(_l(82),Bl(72),_l(215),Bl(268),Uf()),Xl=-1}catch(g){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(12,$l,Xl)}}switch(Xl){case-1:Ml(161),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(13,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Xl=-1}catch(m){Xl=-2}Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(13,$l,Xl)}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&Ml(168),Bl(268),Pl(),Rf(),Ml(165),Bl(268),Pl(),Rf();switch(Jl){case 82:jl(72);break;default:Xl=Jl}if(Xl==110162){Xl=Ul(14,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(82),Bl(72),_l(215),Bl(268),Uf(),Xl=-1}catch(m){Xl=-2}Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(14,$l,Xl)}}Xl==-1&&(Ml(82),Bl(72),Ml(215),Bl(268),Pl(),Rf());break;default:Ml(161),Bl(269);switch(Jl){case 168:jl(283);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(15,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Xl=-1}catch(m){Xl=-2}Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(15,$l,Xl)}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==9896||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&Ml(168),Bl(269),Pl(),El(),Ml(165),Bl(268),Pl(),Rf()}sc.endNonterminal(\"JSONInsertExpr\",$l)}function Jf(){switch(Jl){case 161:jl(269);break;default:Xl=Jl}if(Xl!=9889){Xl=Ul(12,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(161),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(13,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Rl(13,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(13,f,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(268),Uf(),_l(165),Bl(268),Uf();switch(Jl){case 82:jl(72);break;default:Xl=Jl}if(Xl==110162){Xl=Ul(14,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(82),Bl(72),_l(215),Bl(268),Uf(),Rl(14,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(14,f,-2)}Xl=-2}}Xl==-1&&(_l(82),Bl(72),_l(215),Bl(268),Uf()),Rl(12,t,-1),Xl=-3}catch(g){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(12,t,-2)}}}switch(Xl){case-1:_l(161),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(13,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Rl(13,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(13,f,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(268),Uf(),_l(165),Bl(268),Uf();switch(Jl){case 82:jl(72);break;default:Xl=Jl}if(Xl==110162){Xl=Ul(14,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(82),Bl(72),_l(215),Bl(268),Uf(),Rl(14,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(14,f,-2)}Xl=-2}}Xl==-1&&(_l(82),Bl(72),_l(215),Bl(268),Uf());break;case-3:break;default:_l(161),Bl(269);switch(Jl){case 168:jl(283);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(15,$l);if(Xl==0){var a=Vl,f=$l,l=Jl,c=Kl,h=Ql,p=Gl,d=Yl,v=Zl;try{_l(168),Rl(15,f,-1)}catch(m){Vl=a,$l=f,Jl=l,Jl==0?lc=f:(Kl=c,Ql=h,Gl=p,Gl==0?lc=h:(Yl=d,Zl=v,lc=v)),Rl(15,f,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==9896||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(269),Sl(),_l(165),Bl(268),Uf()}}function Kf(){sc.startNonterminal(\"JSONRenameExpr\",$l),Ml(222),Bl(261);switch(Jl){case 168:jl(262);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(16,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(16,$l,Xl)}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&Ml(168),Bl(261),Pl(),Gr(),Ml(80),Bl(268),Pl(),Rf(),sc.endNonterminal(\"JSONRenameExpr\",$l)}function Qf(){_l(222),Bl(261);switch(Jl){case 168:jl(262);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(16,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Rl(16,t,-1)}catch(a){Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(16,t,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(261),Yr(),_l(80),Bl(268),Uf()}function Gf(){sc.startNonterminal(\"JSONReplaceExpr\",$l),Ml(223),Bl(84),Ml(267),Bl(67),Ml(200),Bl(59),Ml(168),Bl(261),Pl(),Gr(),Ml(276),Bl(268),Pl(),Rf(),sc.endNonterminal(\"JSONReplaceExpr\",$l)}function Yf(){_l(223),Bl(84),_l(267),Bl(67),_l(200),Bl(59),_l(168),Bl(261),Yr(),_l(276),Bl(268),Uf()}function Zf(){sc.startNonterminal(\"JSONAppendExpr\",$l),Ml(78),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(17,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(17,$l,Xl)}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&Ml(168),Bl(268),Pl(),Rf(),Ml(165),Bl(268),Pl(),Rf(),sc.endNonterminal(\"JSONAppendExpr\",$l)}function el(){_l(78),Bl(268);switch(Jl){case 168:jl(270);break;default:Xl=Jl}if(Xl==18088){Xl=Ul(17,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(168),Rl(17,t,-1)}catch(a){Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(17,t,-2)}Xl=-2}}(Xl==-1||Xl==3240||Xl==4264||Xl==4776||Xl==5288||Xl==5800||Xl==16040||Xl==16552||Xl==17064||Xl==18600||Xl==21160||Xl==22184||Xl==24232||Xl==24744||Xl==28328||Xl==28840||Xl==30888||Xl==35496||Xl==36520||Xl==37544||Xl==38056||Xl==38568||Xl==39080||Xl==40104||Xl==40616||Xl==41128||Xl==41640||Xl==42152||Xl==42664||Xl==43176||Xl==43688||Xl==44200||Xl==44712||Xl==45736||Xl==46248||Xl==46760||Xl==47272||Xl==48296||Xl==48808||Xl==49832||Xl==50344||Xl==50856||Xl==52392||Xl==52904||Xl==53416||Xl==53928||Xl==54440||Xl==54952||Xl==55976||Xl==56488||Xl==57e3||Xl==57512||Xl==58024||Xl==58536||Xl==61096||Xl==61608||Xl==62120||Xl==62632||Xl==63144||Xl==63656||Xl==64168||Xl==64680||Xl==65192||Xl==66216||Xl==66728||Xl==67752||Xl==68264||Xl==68776||Xl==69288||Xl==69800||Xl==70312||Xl==70824||Xl==71336||Xl==72872||Xl==73384||Xl==75432||Xl==75944||Xl==76968||Xl==77992||Xl==78504||Xl==79016||Xl==79528||Xl==80040||Xl==80552||Xl==82600||Xl==83112||Xl==83624||Xl==84136||Xl==84648||Xl==85160||Xl==85672||Xl==86184||Xl==86696||Xl==87208||Xl==88744||Xl==89256||Xl==89768||Xl==90792||Xl==91816||Xl==92840||Xl==93864||Xl==94376||Xl==94888||Xl==95912||Xl==96424||Xl==96936||Xl==99496||Xl==100008||Xl==100520||Xl==101032||Xl==101544||Xl==103592||Xl==104104||Xl==104616||Xl==105128||Xl==105640||Xl==106152||Xl==107688||Xl==110760||Xl==111272||Xl==112808||Xl==113832||Xl==114344||Xl==114856||Xl==115368||Xl==115880||Xl==116904||Xl==117416||Xl==117928||Xl==118440||Xl==118952||Xl==119464||Xl==119976||Xl==122536||Xl==123048||Xl==123560||Xl==124072||Xl==125608||Xl==126632||Xl==127144||Xl==127656||Xl==129704||Xl==130216||Xl==130728||Xl==131240||Xl==131752||Xl==132264||Xl==132776||Xl==133288||Xl==134312||Xl==134824||Xl==136360||Xl==136872||Xl==137384||Xl==137896||Xl==139432||Xl==139944||Xl==141480||Xl==144040||Xl==145064)&&_l(168),Bl(268),Uf(),_l(165),Bl(268),Uf()}function tl(){sc.startNonterminal(\"CommonContent\",$l);switch(Jl){case 12:Ml(12);break;case 23:Ml(23);break;case 282:Ml(282);break;case 288:Ml(288);break;default:kl()}sc.endNonterminal(\"CommonContent\",$l)}function nl(){switch(Jl){case 12:_l(12);break;case 23:_l(23);break;case 282:_l(282);break;case 288:_l(288);break;default:Ll()}}function rl(){sc.startNonterminal(\"ContentExpr\",$l),ef(),sc.endNonterminal(\"ContentExpr\",$l)}function il(){tf()}function sl(){sc.startNonterminal(\"CompDocConstructor\",$l),Ml(120),Bl(89),Pl(),kl(),sc.endNonterminal(\"CompDocConstructor\",$l)}function ol(){_l(120),Bl(89),Ll()}function ul(){sc.startNonterminal(\"CompAttrConstructor\",$l),Ml(83),Bl(251);switch(Jl){case 281:Ml(281),Bl(268),Pl(),Q(),Ml(287);break;default:Pl(),Wa()}Bl(89);switch(Jl){case 281:jl(282);break;default:Xl=Jl}if(Xl==147225){Xl=Ul(18,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(281),Bl(90),_l(287),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(18,$l,Xl)}}switch(Xl){case-1:Ml(281),Bl(90),Ml(287);break;default:Pl(),kl()}sc.endNonterminal(\"CompAttrConstructor\",$l)}function al(){_l(83),Bl(251);switch(Jl){case 281:_l(281),Bl(268),G(),_l(287);break;default:Xa()}Bl(89);switch(Jl){case 281:jl(282);break;default:Xl=Jl}if(Xl==147225){Xl=Ul(18,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(281),Bl(90),_l(287),Rl(18,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(18,t,-2)}}}switch(Xl){case-1:_l(281),Bl(90),_l(287);break;case-3:break;default:Ll()}}function fl(){sc.startNonterminal(\"CompPIConstructor\",$l),Ml(220),Bl(243);switch(Jl){case 281:Ml(281),Bl(268),Pl(),Q(),Ml(287);break;default:Pl(),Ja()}Bl(89);switch(Jl){case 281:jl(282);break;default:Xl=Jl}if(Xl==147225){Xl=Ul(19,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(281),Bl(90),_l(287),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(19,$l,Xl)}}switch(Xl){case-1:Ml(281),Bl(90),Ml(287);break;default:Pl(),kl()}sc.endNonterminal(\"CompPIConstructor\",$l)}function ll(){_l(220),Bl(243);switch(Jl){case 281:_l(281),Bl(268),G(),_l(287);break;default:Ka()}Bl(89);switch(Jl){case 281:jl(282);break;default:Xl=Jl}if(Xl==147225){Xl=Ul(19,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{_l(281),Bl(90),_l(287),Rl(19,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(19,t,-2)}}}switch(Xl){case-1:_l(281),Bl(90),_l(287);break;case-3:break;default:Ll()}}function cl(){sc.startNonterminal(\"CompCommentConstructor\",$l),Ml(97),Bl(89),Pl(),kl(),sc.endNonterminal(\"CompCommentConstructor\",$l)}function hl(){_l(97),Bl(89),Ll()}function pl(){sc.startNonterminal(\"CompTextConstructor\",$l),Ml(249),Bl(89),Pl(),kl(),sc.endNonterminal(\"CompTextConstructor\",$l)}function dl(){_l(249),Bl(89),Ll()}function vl(){sc.startNonterminal(\"PrimaryExpr\",$l);switch(Jl){case 187:jl(248);break;case 220:jl(246);break;case 281:jl(284);break;case 83:case 122:jl(254);break;case 97:case 249:jl(96);break;case 120:case 206:case 262:jl(146);break;case 135:case 197:case 255:jl(238);break;case 6:case 71:case 73:case 74:case 75:case 76:case 78:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 103:case 104:case 105:case 106:case 107:case 109:case 110:case 111:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 130:case 132:case 133:case 134:case 136:case 137:case 138:case 139:case 142:case 143:case 148:case 150:case 152:case 153:case 155:case 156:case 157:case 161:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 177:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 222:case 223:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 240:case 241:case 242:case 245:case 253:case 254:case 256:case 257:case 258:case 260:case 263:case 266:case 267:case 268:case 269:case 272:case 273:case 276:jl(94);break;default:Xl=Jl}if(Xl==3353||Xl==4377||Xl==4889||Xl==5401||Xl==5913||Xl==16153||Xl==16665||Xl==17177||Xl==18055||Xl==18117||Xl==18175||Xl==18201||Xl==18713||Xl==21273||Xl==22297||Xl==24345||Xl==24857||Xl==28441||Xl==28953||Xl==31001||Xl==35609||Xl==36633||Xl==37657||Xl==38169||Xl==38681||Xl==39193||Xl==40217||Xl==40729||Xl==41241||Xl==41753||Xl==42265||Xl==42777||Xl==43289||Xl==43801||Xl==44313||Xl==44825||Xl==45849||Xl==46361||Xl==46873||Xl==47385||Xl==48409||Xl==48921||Xl==49945||Xl==50457||Xl==50969||Xl==52505||Xl==53017||Xl==53529||Xl==54041||Xl==54553||Xl==55065||Xl==56089||Xl==56601||Xl==57113||Xl==57625||Xl==58137||Xl==58649||Xl==61209||Xl==61721||Xl==62233||Xl==62745||Xl==63257||Xl==63769||Xl==64281||Xl==64793||Xl==65305||Xl==66329||Xl==66841||Xl==67865||Xl==68377||Xl==68889||Xl==69401||Xl==69913||Xl==70425||Xl==70937||Xl==71449||Xl==72985||Xl==73497||Xl==75545||Xl==76057||Xl==77081||Xl==78105||Xl==78617||Xl==79129||Xl==79641||Xl==80153||Xl==80665||Xl==82713||Xl==83225||Xl==83737||Xl==84249||Xl==84761||Xl==85273||Xl==85785||Xl==86297||Xl==86809||Xl==87321||Xl==88857||Xl==89369||Xl==89881||Xl==90905||Xl==91929||Xl==92953||Xl==93977||Xl==94489||Xl==95001||Xl==96025||Xl==96537||Xl==97049||Xl==99609||Xl==100121||Xl==100633||Xl==101145||Xl==101657||Xl==103705||Xl==104217||Xl==104729||Xl==105241||Xl==105753||Xl==106265||Xl==107801||Xl==110873||Xl==111385||Xl==112921||Xl==113945||Xl==114457||Xl==114969||Xl==115481||Xl==115993||Xl==117017||Xl==117529||Xl==118041||Xl==118553||Xl==119065||Xl==119577||Xl==120089||Xl==122649||Xl==123161||Xl==123673||Xl==124185||Xl==125721||Xl==126745||Xl==127257||Xl==127769||Xl==129817||Xl==130329||Xl==130841||Xl==131353||Xl==131865||Xl==132377||Xl==132889||Xl==133401||Xl==134425||Xl==134937||Xl==136473||Xl==136985||Xl==137497||Xl==138009||Xl==139545||Xl==140057||Xl==141593||Xl==144153||Xl==145177||Xl==147225){Xl=Ul(20,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{hi(),Xl=-1}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),_i(),Xl=-5}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Ll(),Xl=-10}catch(l){Xl=-11}}}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(20,$l,Xl)}}switch(Xl){case-1:case 8:case 9:case 10:case 11:case 12935:case 12997:case 13055:case 13447:case 13509:case 13567:case 13959:case 14021:case 14079:case 19591:case 19653:case 19711:case 20103:case 20165:case 20223:case 21127:case 21189:case 21247:case 21639:case 21701:case 21759:case 22151:case 22213:case 22271:case 23175:case 23237:case 23295:case 24199:case 24261:case 24319:case 24711:case 24773:case 24831:case 25735:case 25797:case 25855:case 27783:case 27845:case 27903:case 28295:case 28357:case 28415:case 29831:case 29893:case 29951:case 30343:case 30405:case 30463:case 31367:case 31429:case 31487:case 31879:case 31941:case 31999:case 32391:case 32453:case 32511:case 32903:case 32965:case 33023:case 35463:case 35525:case 35583:case 35975:case 36037:case 36095:case 36487:case 36549:case 36607:case 39047:case 39109:case 39167:case 41095:case 41157:case 41215:case 41607:case 41669:case 41727:case 42119:case 42181:case 42239:case 43655:case 43717:case 43775:case 45191:case 45253:case 45311:case 45703:case 45765:case 45823:case 46215:case 46277:case 46335:case 46727:case 46789:case 46847:case 48775:case 48837:case 48895:case 51335:case 51397:case 51455:case 54407:case 54469:case 54527:case 56455:case 56517:case 56575:case 58503:case 58565:case 58623:case 61063:case 61125:case 61183:case 63111:case 63173:case 63231:case 63623:case 63685:case 63743:case 65159:case 65221:case 65279:case 66183:case 66245:case 66303:case 67719:case 67781:case 67839:case 71303:case 71365:case 71423:case 72839:case 72901:case 72959:case 75911:case 75973:case 76031:case 76935:case 76997:case 77055:case 77959:case 78021:case 78079:case 78471:case 78533:case 78591:case 83079:case 83141:case 83199:case 84103:case 84165:case 84223:case 84615:case 84677:case 84735:case 85127:case 85189:case 85247:case 89735:case 89797:case 89855:case 90759:case 90821:case 90879:case 92807:case 92869:case 92927:case 93831:case 93893:case 93951:case 94343:case 94405:case 94463:case 96903:case 96965:case 97023:case 103559:case 103621:case 103679:case 104583:case 104645:case 104703:case 105095:case 105157:case 105215:case 107143:case 107205:case 107263:case 114823:case 114885:case 114943:case 116871:case 116933:case 116991:case 119431:case 119493:case 119551:case 121479:case 121541:case 121599:case 123527:case 123589:case 123647:case 124039:case 124101:case 124159:case 129159:case 129221:case 129279:case 129671:case 129733:case 129791:case 130183:case 130245:case 130303:case 133255:case 133317:case 133375:case 139399:case 139461:case 139519:case 141447:case 141509:case 141567:case 142983:case 143045:case 143103:case 145543:case 145605:case 145663:case 146055:case 146117:case 146175:case 146567:case 146629:case 146687:case 147079:case 147141:case 147199:ci();break;case 31:bi();break;case 35:xi();break;case 32:Ni();break;case-5:case 17926:case 17991:case 17993:case 17994:case 17995:case 17996:case 17998:case 18e3:case 18001:case 18002:case 18004:case 18005:case 18006:case 18007:case 18009:case 18010:case 18011:case 18012:case 18014:case 18015:case 18018:case 18019:case 18022:case 18023:case 18024:case 18025:case 18026:case 18027:case 18029:case 18030:case 18031:case 18032:case 18033:case 18034:case 18039:case 18040:case 18043:case 18044:case 18046:case 18047:case 18049:case 18050:case 18052:case 18053:case 18054:case 18056:case 18057:case 18058:case 18059:case 18062:case 18063:case 18068:case 18070:case 18072:case 18073:case 18075:case 18076:case 18077:case 18081:case 18082:case 18083:case 18084:case 18085:case 18086:case 18088:case 18090:case 18093:case 18094:case 18095:case 18097:case 18099:case 18101:case 18103:case 18104:case 18105:case 18107:case 18109:case 18115:case 18118:case 18122:case 18123:case 18124:case 18125:case 18126:case 18127:case 18130:case 18136:case 18137:case 18142:case 18143:case 18144:case 18145:case 18146:case 18148:case 18149:case 18152:case 18153:case 18154:case 18159:case 18160:case 18161:case 18162:case 18165:case 18173:case 18174:case 18176:case 18177:case 18178:case 18180:case 18182:case 18183:case 18186:case 18187:case 18188:case 18189:case 18192:case 18193:case 18196:Mi();break;case 144078:ki();break;case 144134:Ai();break;case 33:case 79:case 121:case 125:case 147:case 154:case 167:case 169:case 188:case 194:case 230:case 231:case 247:case 248:case 259:case 14854:case 14919:case 14921:case 14922:case 14923:case 14924:case 14926:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14935:case 14937:case 14938:case 14939:case 14940:case 14942:case 14943:case 14945:case 14946:case 14947:case 14950:case 14951:case 14952:case 14953:case 14954:case 14955:case 14957:case 14958:case 14959:case 14960:case 14961:case 14962:case 14967:case 14968:case 14970:case 14971:case 14972:case 14974:case 14975:case 14977:case 14978:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14986:case 14987:case 14990:case 14991:case 14996:case 14998:case 15e3:case 15001:case 15003:case 15004:case 15005:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15016:case 15018:case 15021:case 15022:case 15023:case 15025:case 15027:case 15029:case 15031:case 15032:case 15033:case 15035:case 15037:case 15043:case 15045:case 15046:case 15050:case 15051:case 15052:case 15053:case 15054:case 15055:case 15058:case 15064:case 15065:case 15068:case 15070:case 15071:case 15072:case 15073:case 15074:case 15076:case 15077:case 15080:case 15081:case 15082:case 15087:case 15088:case 15089:case 15090:case 15093:case 15097:case 15101:case 15102:case 15103:case 15104:case 15105:case 15106:case 15108:case 15110:case 15111:case 15114:case 15115:case 15116:case 15117:case 15120:case 15121:case 15124:vs();break;case-10:case 27929:kl();break;case-11:case 10009:bl();break;case 69:Nl();break;case 283:gl();break;default:ji()}sc.endNonterminal(\"PrimaryExpr\",$l)}function ml(){switch(Jl){case 187:jl(248);break;case 220:jl(246);break;case 281:jl(284);break;case 83:case 122:jl(254);break;case 97:case 249:jl(96);break;case 120:case 206:case 262:jl(146);break;case 135:case 197:case 255:jl(238);break;case 6:case 71:case 73:case 74:case 75:case 76:case 78:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 103:case 104:case 105:case 106:case 107:case 109:case 110:case 111:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 130:case 132:case 133:case 134:case 136:case 137:case 138:case 139:case 142:case 143:case 148:case 150:case 152:case 153:case 155:case 156:case 157:case 161:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 177:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 222:case 223:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 240:case 241:case 242:case 245:case 253:case 254:case 256:case 257:case 258:case 260:case 263:case 266:case 267:case 268:case 269:case 272:case 273:case 276:jl(94);break;default:Xl=Jl}if(Xl==3353||Xl==4377||Xl==4889||Xl==5401||Xl==5913||Xl==16153||Xl==16665||Xl==17177||Xl==18055||Xl==18117||Xl==18175||Xl==18201||Xl==18713||Xl==21273||Xl==22297||Xl==24345||Xl==24857||Xl==28441||Xl==28953||Xl==31001||Xl==35609||Xl==36633||Xl==37657||Xl==38169||Xl==38681||Xl==39193||Xl==40217||Xl==40729||Xl==41241||Xl==41753||Xl==42265||Xl==42777||Xl==43289||Xl==43801||Xl==44313||Xl==44825||Xl==45849||Xl==46361||Xl==46873||Xl==47385||Xl==48409||Xl==48921||Xl==49945||Xl==50457||Xl==50969||Xl==52505||Xl==53017||Xl==53529||Xl==54041||Xl==54553||Xl==55065||Xl==56089||Xl==56601||Xl==57113||Xl==57625||Xl==58137||Xl==58649||Xl==61209||Xl==61721||Xl==62233||Xl==62745||Xl==63257||Xl==63769||Xl==64281||Xl==64793||Xl==65305||Xl==66329||Xl==66841||Xl==67865||Xl==68377||Xl==68889||Xl==69401||Xl==69913||Xl==70425||Xl==70937||Xl==71449||Xl==72985||Xl==73497||Xl==75545||Xl==76057||Xl==77081||Xl==78105||Xl==78617||Xl==79129||Xl==79641||Xl==80153||Xl==80665||Xl==82713||Xl==83225||Xl==83737||Xl==84249||Xl==84761||Xl==85273||Xl==85785||Xl==86297||Xl==86809||Xl==87321||Xl==88857||Xl==89369||Xl==89881||Xl==90905||Xl==91929||Xl==92953||Xl==93977||Xl==94489||Xl==95001||Xl==96025||Xl==96537||Xl==97049||Xl==99609||Xl==100121||Xl==100633||Xl==101145||Xl==101657||Xl==103705||Xl==104217||Xl==104729||Xl==105241||Xl==105753||Xl==106265||Xl==107801||Xl==110873||Xl==111385||Xl==112921||Xl==113945||Xl==114457||Xl==114969||Xl==115481||Xl==115993||Xl==117017||Xl==117529||Xl==118041||Xl==118553||Xl==119065||Xl==119577||Xl==120089||Xl==122649||Xl==123161||Xl==123673||Xl==124185||Xl==125721||Xl==126745||Xl==127257||Xl==127769||Xl==129817||Xl==130329||Xl==130841||Xl==131353||Xl==131865||Xl==132377||Xl==132889||Xl==133401||Xl==134425||Xl==134937||Xl==136473||Xl==136985||Xl==137497||Xl==138009||Xl==139545||Xl==140057||Xl==141593||Xl==144153||Xl==145177||Xl==147225){Xl=Ul(20,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{hi(),Rl(20,t,-1),Xl=-14}catch(a){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),_i(),Rl(20,t,-5),Xl=-14}catch(f){try{Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Ll(),Rl(20,t,-10),Xl=-14}catch(l){Xl=-11,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(20,t,-11)}}}}}switch(Xl){case-1:case 8:case 9:case 10:case 11:case 12935:case 12997:case 13055:case 13447:case 13509:case 13567:case 13959:case 14021:case 14079:case 19591:case 19653:case 19711:case 20103:case 20165:case 20223:case 21127:case 21189:case 21247:case 21639:case 21701:case 21759:case 22151:case 22213:case 22271:case 23175:case 23237:case 23295:case 24199:case 24261:case 24319:case 24711:case 24773:case 24831:case 25735:case 25797:case 25855:case 27783:case 27845:case 27903:case 28295:case 28357:case 28415:case 29831:case 29893:case 29951:case 30343:case 30405:case 30463:case 31367:case 31429:case 31487:case 31879:case 31941:case 31999:case 32391:case 32453:case 32511:case 32903:case 32965:case 33023:case 35463:case 35525:case 35583:case 35975:case 36037:case 36095:case 36487:case 36549:case 36607:case 39047:case 39109:case 39167:case 41095:case 41157:case 41215:case 41607:case 41669:case 41727:case 42119:case 42181:case 42239:case 43655:case 43717:case 43775:case 45191:case 45253:case 45311:case 45703:case 45765:case 45823:case 46215:case 46277:case 46335:case 46727:case 46789:case 46847:case 48775:case 48837:case 48895:case 51335:case 51397:case 51455:case 54407:case 54469:case 54527:case 56455:case 56517:case 56575:case 58503:case 58565:case 58623:case 61063:case 61125:case 61183:case 63111:case 63173:case 63231:case 63623:case 63685:case 63743:case 65159:case 65221:case 65279:case 66183:case 66245:case 66303:case 67719:case 67781:case 67839:case 71303:case 71365:case 71423:case 72839:case 72901:case 72959:case 75911:case 75973:case 76031:case 76935:case 76997:case 77055:case 77959:case 78021:case 78079:case 78471:case 78533:case 78591:case 83079:case 83141:case 83199:case 84103:case 84165:case 84223:case 84615:case 84677:case 84735:case 85127:case 85189:case 85247:case 89735:case 89797:case 89855:case 90759:case 90821:case 90879:case 92807:case 92869:case 92927:case 93831:case 93893:case 93951:case 94343:case 94405:case 94463:case 96903:case 96965:case 97023:case 103559:case 103621:case 103679:case 104583:case 104645:case 104703:case 105095:case 105157:case 105215:case 107143:case 107205:case 107263:case 114823:case 114885:case 114943:case 116871:case 116933:case 116991:case 119431:case 119493:case 119551:case 121479:case 121541:case 121599:case 123527:case 123589:case 123647:case 124039:case 124101:case 124159:case 129159:case 129221:case 129279:case 129671:case 129733:case 129791:case 130183:case 130245:case 130303:case 133255:case 133317:case 133375:case 139399:case 139461:case 139519:case 141447:case 141509:case 141567:case 142983:case 143045:case 143103:case 145543:case 145605:case 145663:case 146055:case 146117:case 146175:case 146567:case 146629:case 146687:case 147079:case 147141:case 147199:hi();break;case 31:wi();break;case 35:Ti();break;case 32:Ci();break;case-5:case 17926:case 17991:case 17993:case 17994:case 17995:case 17996:case 17998:case 18e3:case 18001:case 18002:case 18004:case 18005:case 18006:case 18007:case 18009:case 18010:case 18011:case 18012:case 18014:case 18015:case 18018:case 18019:case 18022:case 18023:case 18024:case 18025:case 18026:case 18027:case 18029:case 18030:case 18031:case 18032:case 18033:case 18034:case 18039:case 18040:case 18043:case 18044:case 18046:case 18047:case 18049:case 18050:case 18052:case 18053:case 18054:case 18056:case 18057:case 18058:case 18059:case 18062:case 18063:case 18068:case 18070:case 18072:case 18073:case 18075:case 18076:case 18077:case 18081:case 18082:case 18083:case 18084:case 18085:case 18086:case 18088:case 18090:case 18093:case 18094:case 18095:case 18097:case 18099:case 18101:case 18103:case 18104:case 18105:case 18107:case 18109:case 18115:case 18118:case 18122:case 18123:case 18124:case 18125:case 18126:case 18127:case 18130:case 18136:case 18137:case 18142:case 18143:case 18144:case 18145:case 18146:case 18148:case 18149:case 18152:case 18153:case 18154:case 18159:case 18160:case 18161:case 18162:case 18165:case 18173:case 18174:case 18176:case 18177:case 18178:case 18180:case 18182:case 18183:case 18186:case 18187:case 18188:case 18189:case 18192:case 18193:case 18196:_i();break;case 144078:Li();break;case 144134:Oi();break;case 33:case 79:case 121:case 125:case 147:case 154:case 167:case 169:case 188:case 194:case 230:case 231:case 247:case 248:case 259:case 14854:case 14919:case 14921:case 14922:case 14923:case 14924:case 14926:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14935:case 14937:case 14938:case 14939:case 14940:case 14942:case 14943:case 14945:case 14946:case 14947:case 14950:case 14951:case 14952:case 14953:case 14954:case 14955:case 14957:case 14958:case 14959:case 14960:case 14961:case 14962:case 14967:case 14968:case 14970:case 14971:case 14972:case 14974:case 14975:case 14977:case 14978:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14986:case 14987:case 14990:case 14991:case 14996:case 14998:case 15e3:case 15001:case 15003:case 15004:case 15005:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15016:case 15018:case 15021:case 15022:case 15023:case 15025:case 15027:case 15029:case 15031:case 15032:case 15033:case 15035:case 15037:case 15043:case 15045:case 15046:case 15050:case 15051:case 15052:case 15053:case 15054:case 15055:case 15058:case 15064:case 15065:case 15068:case 15070:case 15071:case 15072:case 15073:case 15074:case 15076:case 15077:case 15080:case 15081:case 15082:case 15087:case 15088:case 15089:case 15090:case 15093:case 15097:case 15101:case 15102:case 15103:case 15104:case 15105:case 15106:case 15108:case 15110:case 15111:case 15114:case 15115:case 15116:case 15117:case 15120:case 15121:case 15124:ms();break;case-10:case 27929:Ll();break;case-11:case 10009:wl();break;case 69:Cl();break;case 283:yl();break;case-14:break;default:Fi()}}function gl(){sc.startNonterminal(\"JSONSimpleObjectUnion\",$l),Ml(283),Bl(275),Jl!=286&&(Pl(),Q()),Ml(286),sc.endNonterminal(\"JSONSimpleObjectUnion\",$l)}function yl(){_l(283),Bl(275),Jl!=286&&G(),_l(286)}function bl(){sc.startNonterminal(\"ObjectConstructor\",$l),Ml(281),Bl(278),Jl!=287&&(Pl(),El()),Ml(287),sc.endNonterminal(\"ObjectConstructor\",$l)}function wl(){_l(281),Bl(278),Jl!=287&&Sl(),_l(287)}function El(){sc.startNonterminal(\"PairConstructorList\",$l),xl();for(;;){if(Jl!=42)break;Ml(42),Bl(269),Pl(),xl()}sc.endNonterminal(\"PairConstructorList\",$l)}function Sl(){Tl();for(;;){if(Jl!=42)break;_l(42),Bl(269),Tl()}}function xl(){sc.startNonterminal(\"PairConstructor\",$l);switch(Jl){case 78:jl(280);break;case 161:jl(283);break;case 177:jl(179);break;case 187:jl(253);break;case 220:jl(249);break;case 223:jl(181);break;case 266:jl(192);break;case 83:case 122:jl(258);break;case 97:case 249:jl(147);break;case 111:case 222:jl(263);break;case 139:case 142:jl(188);break;case 104:case 130:case 240:jl(166);break;case 135:case 197:case 255:jl(210);break;case 120:case 206:case 256:case 262:jl(168);break;case 121:case 125:case 167:case 188:case 194:case 230:case 231:jl(95);break;case 71:case 73:case 74:case 75:case 76:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 103:case 105:case 106:case 107:case 109:case 110:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 132:case 133:case 134:case 136:case 137:case 138:case 143:case 147:case 148:case 150:case 152:case 153:case 154:case 155:case 156:case 157:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 241:case 242:case 245:case 248:case 253:case 254:case 257:case 258:case 259:case 260:case 263:case 267:case 268:case 269:case 272:case 273:case 276:jl(142);break;default:Xl=Jl}if(Xl==25735||Xl==25797||Xl==25855){Xl=Ul(21,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Uf(),Xl=-1}catch(a){Xl=-2}Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(21,$l,Xl)}}switch(Xl){case-2:case 19:case 25671:case 25673:case 25674:case 25675:case 25676:case 25678:case 25680:case 25681:case 25682:case 25683:case 25684:case 25685:case 25686:case 25687:case 25689:case 25690:case 25691:case 25692:case 25694:case 25695:case 25697:case 25698:case 25699:case 25702:case 25703:case 25704:case 25705:case 25706:case 25707:case 25709:case 25710:case 25711:case 25712:case 25713:case 25714:case 25719:case 25720:case 25721:case 25722:case 25723:case 25724:case 25725:case 25726:case 25727:case 25729:case 25730:case 25732:case 25733:case 25734:case 25736:case 25737:case 25738:case 25739:case 25742:case 25743:case 25747:case 25748:case 25750:case 25752:case 25753:case 25754:case 25755:case 25756:case 25757:case 25761:case 25762:case 25763:case 25764:case 25765:case 25766:case 25767:case 25768:case 25770:case 25773:case 25774:case 25775:case 25777:case 25779:case 25781:case 25783:case 25784:case 25785:case 25787:case 25788:case 25789:case 25794:case 25795:case 25798:case 25802:case 25803:case 25804:case 25805:case 25806:case 25807:case 25810:case 25816:case 25817:case 25820:case 25822:case 25823:case 25824:case 25825:case 25826:case 25828:case 25829:case 25830:case 25831:case 25832:case 25833:case 25834:case 25839:case 25840:case 25841:case 25842:case 25845:case 25848:case 25849:case 25853:case 25854:case 25856:case 25857:case 25858:case 25859:case 25860:case 25862:case 25863:case 25866:case 25867:case 25868:case 25869:case 25872:case 25873:case 25876:Ja();break;default:Rf()}Bl(26),Ml(50),Bl(268),Pl(),Rf(),sc.endNonterminal(\"PairConstructor\",$l)}function Tl(){switch(Jl){case 78:jl(280);break;case 161:jl(283);break;case 177:jl(179);break;case 187:jl(253);break;case 220:jl(249);break;case 223:jl(181);break;case 266:jl(192);break;case 83:case 122:jl(258);break;case 97:case 249:jl(147);break;case 111:case 222:jl(263);break;case 139:case 142:jl(188);break;case 104:case 130:case 240:jl(166);break;case 135:case 197:case 255:jl(210);break;case 120:case 206:case 256:case 262:jl(168);break;case 121:case 125:case 167:case 188:case 194:case 230:case 231:jl(95);break;case 71:case 73:case 74:case 75:case 76:case 80:case 81:case 82:case 84:case 85:case 86:case 87:case 89:case 90:case 91:case 92:case 94:case 95:case 98:case 99:case 102:case 103:case 105:case 106:case 107:case 109:case 110:case 112:case 113:case 114:case 119:case 123:case 124:case 126:case 127:case 129:case 132:case 133:case 134:case 136:case 137:case 138:case 143:case 147:case 148:case 150:case 152:case 153:case 154:case 155:case 156:case 157:case 162:case 163:case 164:case 165:case 166:case 168:case 170:case 173:case 174:case 175:case 179:case 181:case 183:case 184:case 185:case 189:case 195:case 198:case 202:case 203:case 204:case 205:case 207:case 210:case 216:case 217:case 224:case 225:case 226:case 228:case 229:case 232:case 233:case 234:case 239:case 241:case 242:case 245:case 248:case 253:case 254:case 257:case 258:case 259:case 260:case 263:case 267:case 268:case 269:case 272:case 273:case 276:jl(142);break;default:Xl=Jl}if(Xl==25735||Xl==25797||Xl==25855){Xl=Ul(21,$l);if(Xl==0){var e=Vl,t=$l,n=Jl,r=Kl,i=Ql,s=Gl,o=Yl,u=Zl;try{Uf(),Rl(21,t,-1),Xl=-3}catch(a){Xl=-2,Vl=e,$l=t,Jl=n,Jl==0?lc=t:(Kl=r,Ql=i,Gl=s,Gl==0?lc=i:(Yl=o,Zl=u,lc=u)),Rl(21,t,-2)}}}switch(Xl){case-2:case 19:case 25671:case 25673:case 25674:case 25675:case 25676:case 25678:case 25680:case 25681:case 25682:case 25683:case 25684:case 25685:case 25686:case 25687:case 25689:case 25690:case 25691:case 25692:case 25694:case 25695:case 25697:case 25698:case 25699:case 25702:case 25703:case 25704:case 25705:case 25706:case 25707:case 25709:case 25710:case 25711:case 25712:case 25713:case 25714:case 25719:case 25720:case 25721:case 25722:case 25723:case 25724:case 25725:case 25726:case 25727:case 25729:case 25730:case 25732:case 25733:case 25734:case 25736:case 25737:case 25738:case 25739:case 25742:case 25743:case 25747:case 25748:case 25750:case 25752:case 25753:case 25754:case 25755:case 25756:case 25757:case 25761:case 25762:case 25763:case 25764:case 25765:case 25766:case 25767:case 25768:case 25770:case 25773:case 25774:case 25775:case 25777:case 25779:case 25781:case 25783:case 25784:case 25785:case 25787:case 25788:case 25789:case 25794:case 25795:case 25798:case 25802:case 25803:case 25804:case 25805:case 25806:case 25807:case 25810:case 25816:case 25817:case 25820:case 25822:case 25823:case 25824:case 25825:case 25826:case 25828:case 25829:case 25830:case 25831:case 25832:case 25833:case 25834:case 25839:case 25840:case 25841:case 25842:case 25845:case 25848:case 25849:case 25853:case 25854:case 25856:case 25857:case 25858:case 25859:case 25860:case 25862:case 25863:case 25866:case 25867:case 25868:case 25869:case 25872:case 25873:case 25876:Ka();break;case-3:break;default:Uf()}Bl(26),_l(50),Bl(268),Uf()}function Nl(){sc.startNonterminal(\"ArrayConstructor\",$l),Ml(69),Bl(274),Jl!=70&&(Pl(),Q()),Ml(70),sc.endNonterminal(\"ArrayConstructor\",$l)}function Cl(){_l(69),Bl(274),Jl!=70&&G(),_l(70)}function kl(){sc.startNonterminal(\"BlockExpr\",$l),Ml(281),Bl(282),Pl(),nf(),Ml(287),sc.endNonterminal(\"BlockExpr\",$l)}function Ll(){_l(281),Bl(282),rf(),_l(287)}function Al(){sc.startNonterminal(\"FunctionDecl\",$l),Ml(147),Bl(247),Pl(),Wa(),Bl(22),Ml(35),Bl(97),Jl==31&&(Pl(),R()),Ml(38),Bl(157),Jl==80&&(Pl(),Ol()),Bl(120);switch(Jl){case 281:Ml(281),Bl(282),Pl(),nf(),Ml(287);break;default:Ml(134)}sc.endNonterminal(\"FunctionDecl\",$l)}function Ol(){sc.startNonterminal(\"ReturnType\",$l),Ml(80),Bl(255),Pl(),Ns(),sc.endNonterminal(\"ReturnType\",$l)}function Ml(e){Jl==e?(Pl(),sc.terminal(i.TOKEN[Jl],Kl,Ql>ac?ac:Ql),Vl=Kl,$l=Ql,Jl=Gl,Jl!=0&&(Kl=Yl,Ql=Zl,Gl=0)):ql(Kl,Ql,0,Jl,e)}function _l(e){Jl==e?(Vl=Kl,$l=Ql,Jl=Gl,Jl!=0&&(Kl=Yl,Ql=Zl,Gl=0)):ql(Kl,Ql,0,Jl,e)}function Dl(e){var t=Vl,n=$l,r=Jl,i=Kl,s=Ql;Jl=e,Kl=fc,Ql=lc,Gl=0,za(),Vl=t,$l=n,Jl=r,Jl!=0&&(Kl=i,Ql=s)}function Pl(){$l!=Kl&&(Vl=$l,$l=Kl,sc.whitespace(Vl,$l))}function Hl(e){var t;for(;;){t=zl(e);if(t!=22){if(t!=37)break;Dl(t)}}return t}function Bl(e){Jl==0&&(Jl=Hl(e),Kl=fc,Ql=lc)}function jl(e){Gl==0&&(Gl=Hl(e),Yl=fc,Zl=lc),Xl=Gl<<9|Jl}function Fl(e){Jl==0&&(Jl=zl(e),Kl=fc,Ql=lc)}function Il(e){Gl==0&&(Gl=zl(e),Yl=fc,Zl=lc),Xl=Gl<<9|Jl}function ql(e,t,n,r,i){throw t>tc&&(ec=e,tc=t,nc=n,rc=r,ic=i),new Wl.ParseException(ec,tc,nc,rc,ic)}function Rl(e,t,n){oc[(t<<5)+e]=n}function Ul(e,t){var n=oc[(t<<5)+e];return typeof n!=\"undefined\"?n:0}function zl(e){var t=!1;fc=lc;var n=lc,r=i.INITIAL[e],s=0;for(var o=r&8191;o!=0;){var u,a=n<ac?uc.charCodeAt(n):0;++n;if(a<128)u=i.MAP0[a];else if(a<55296){var f=a>>4;u=i.MAP1[(a&15)+i.MAP1[(f&31)+i.MAP1[f>>5]]]}else{if(a<56320){var f=n<ac?uc.charCodeAt(n):0;f>=56320&&f<57344&&(++n,a=((a&1023)<<10)+(f&1023)+65536,t=!0)}var l=0,c=5;for(var h=3;;h=c+l>>1){if(i.MAP2[h]>a)c=h-1;else{if(!(i.MAP2[6+h]<a)){u=i.MAP2[12+h];break}l=h+1}if(l>c){u=0;break}}}s=o;var p=(u<<13)+o-1;o=i.TRANSITION[(p&31)+i.TRANSITION[p>>5]],o>8191&&(r=o,o&=8191,lc=n)}r>>=13;if(r==0){lc=n-1;var f=lc<ac?uc.charCodeAt(lc):0;return f>=56320&&f<57344&&--lc,ql(fc,lc,s,-1,-1)}if(t)for(var d=r>>9;d>0;--d){--lc;var f=lc<ac?uc.charCodeAt(lc):0;f>=56320&&f<57344&&--lc}else lc-=r>>9;return(r&511)-1}n(e,t);var Wl=this;this.ParseException=function(e,t,n,r,i){var s=e,o=t,u=n,a=r,f=i;this.getBegin=function(){return s},this.getEnd=function(){return o},this.getState=function(){return u},this.getExpected=function(){return f},this.getOffending=function(){return a},this.getMessage=function(){return a<0?\"lexical analysis failed\":\"syntax error\"}},this.getInput=function(){return uc},this.getOffendingToken=function(e){var t=e.getOffending();return t>=0?i.TOKEN[t]:null},this.getExpectedTokenSet=function(e){var t;return e.getExpected()<0?t=i.getTokenSet(-e.getState()):t=[i.TOKEN[e.getExpected()]],t},this.getErrorMessage=function(e){var t=this.getExpectedTokenSet(e),n=this.getOffendingToken(e),r=uc.substring(0,e.getBegin()),i=r.split(\"\\n\"),s=i.length,o=i[s-1].length+1,u=e.getEnd()-e.getBegin();return e.getMessage()+(n==null?\"\":\", found \"+n)+\"\\nwhile expecting \"+(t.length==1?t[0]:\"[\"+t.join(\", \")+\"]\")+\"\\n\"+(u==0||n!=null?\"\":\"after successfully scanning \"+u+\" characters beginning \")+\"at line \"+s+\", column \"+o+\":\\n...\"+uc.substring(e.getBegin(),Math.min(uc.length,e.getBegin()+64))+\"...\"},this.parse_XQuery=function(){sc.startNonterminal(\"XQuery\",$l),Bl(279),Pl(),s(),Ml(25),sc.endNonterminal(\"XQuery\",$l)};var Xl,Vl,$l,Jl,Kl,Ql,Gl,Yl,Zl,ec,tc,nc,rc,ic,sc,oc,uc,ac,fc,lc};r.getTokenSet=function(e){var t=[],n=e<0?-e:INITIAL[e]&8191;for(var i=0;i<289;i+=32){var s=i,o=(i>>5)*4323+n-1,u=o>>2,a=u>>2,f=r.EXPECTED[(o&3)+r.EXPECTED[(u&3)+r.EXPECTED[(a&7)+r.EXPECTED[a>>3]]]];for(;f!=0;f>>>=1,++s)(f&1)!=0&&t.push(r.TOKEN[s])}return t},r.MAP0=[71,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,17,17,17,17,17,17,18,19,20,21,22,23,24,25,26,27,28,29,26,30,30,30,30,30,31,32,33,30,30,34,30,30,35,30,30,30,36,30,30,37,38,39,40,30,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,40,40],r.MAP1=[108,124,214,214,214,214,214,214,214,214,214,214,214,214,214,214,156,181,181,181,181,181,214,215,213,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,247,261,277,293,309,355,371,387,423,423,423,415,339,331,339,331,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,440,440,440,440,440,440,440,324,339,339,339,339,339,339,339,339,401,423,423,424,422,423,423,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,338,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,423,71,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,17,17,17,17,17,17,18,19,20,21,22,23,24,25,26,27,28,29,26,30,30,30,30,30,31,32,33,30,30,30,30,30,30,30,30,30,30,30,30,30,30,40,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,34,30,30,35,30,30,30,36,30,30,37,38,39,40,30,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,40,40,40,40,40,40,40,40,40,40,40,40,30,30,40,40,40,40,40,40,40,70,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,40,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70,70],r.MAP2=[57344,63744,64976,65008,65536,983040,63743,64975,65007,65533,983039,1114111,40,30,40,30,30,40],r.INITIAL=[1,24578,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,289,290,291],r.TRANSITION=[61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,18432,18517,18522,18517,18517,18484,18512,18452,18517,18554,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73090,22372,22399,61674,22448,61967,59516,61967,41832,61967,61967,55527,19522,30374,20913,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22538,61967,70056,61967,34633,62349,22589,41847,62466,62378,61967,59516,61967,22626,61967,61967,55527,19522,55520,41710,22665,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22724,61967,35451,61966,61947,33649,33678,20228,20251,22777,61967,20166,61967,22829,61967,61967,55527,19522,55520,38980,22868,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,21069,18745,27106,18633,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22927,61967,31390,22996,58037,23031,22589,71908,23095,23127,61967,59516,61967,74619,61967,61967,55527,19522,33749,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,23195,61967,73090,23262,33056,23232,23311,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,63256,23363,61967,61967,23400,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,23468,18928,23545,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,23577,61967,72464,61967,57684,23628,22589,72719,23725,23657,61967,59516,61967,23757,61967,61967,55527,19522,55520,19460,23796,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,23855,23948,23953,23941,24006,23911,23985,23879,24038,24068,61967,26764,61967,74619,61967,61967,55527,19522,55520,19508,18606,24136,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,24234,61967,31390,24372,69698,73090,24290,24311,24343,24413,61967,22488,61967,74619,61967,61967,55527,19522,55520,19508,18606,24481,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,24541,61967,31390,61967,61967,67560,24598,24727,24629,24659,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,24786,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,20332,24818,47893,47878,24849,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,72704,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,24917,61967,31390,22166,69121,24929,24961,24980,63830,25029,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,25081,61967,31390,61967,61967,73090,25120,40456,40441,25151,61967,59516,61967,74619,61967,61967,25386,70359,33542,44063,60878,74169,48358,73876,61967,61967,25392,25221,46058,56008,34317,59395,45145,35889,25258,33586,67359,61967,61967,74289,32691,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,34227,61967,61967,39423,61967,38058,59141,59141,42868,32848,52984,42485,53795,45145,38847,36411,45179,49739,61967,61967,31653,31517,54964,59141,46635,69258,52984,19712,25297,53636,36994,45179,49738,61967,35077,73614,59141,39309,52984,49561,45145,34410,45179,30090,25332,29726,25380,25434,58426,41951,25472,71032,68673,61967,25509,25555,25602,33496,25669,25747,56815,25790,25835,25867,25928,42600,26414,25960,26021,26093,26145,25698,41957,45600,50560,49862,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73577,26289,22949,26342,26374,61967,59516,61967,57530,61967,61967,55527,19522,60302,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,26446,61967,45837,61967,61967,73090,26514,26567,72558,26616,61967,59516,61967,43846,55593,61967,55527,19522,55520,41710,22665,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,26668,61967,31390,61967,61967,26680,22589,61967,26712,26744,61967,59516,61967,26814,61967,61967,25386,70359,27859,44063,61967,74169,61967,44524,61967,61967,25392,59141,46058,52984,34317,45145,45145,36983,45179,33586,26853,61967,61967,53249,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,45058,26893,61967,61967,23063,61967,25397,59141,59141,26933,52984,52984,42016,45145,45145,47967,45179,45179,58891,61967,61967,61967,31517,59141,59141,26972,52984,52984,27017,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,27055,61967,74626,39880,35594,36017,36045,36071,27139,27245,61967,29891,61967,74619,61967,61967,55527,29290,28935,28860,18606,27299,61967,70169,30458,18726,18778,19038,27395,27918,27454,29597,27486,59308,29378,28584,19146,19231,58583,74082,19266,19356,74753,19443,20085,28657,28641,27422,28779,28920,29492,29536,29518,28283,36556,19613,19681,19750,24509,29432,20022,19387,27518,29659,27577,20114,28406,28720,27638,28527,27732,27795,21982,20146,20198,19175,20445,20283,27891,27950,27982,59281,28751,28253,27763,28014,28075,20555,20624,28313,28345,28129,28191,28223,28377,28438,28497,28559,18808,20981,21038,18850,28616,27606,28689,29351,27669,18694,21298,21330,28811,28892,28967,28999,29031,21595,29063,29121,29095,29153,29185,27545,29217,29276,28841,28043,29322,29410,29464,28465,29568,29629,29691,28159,74475,29723,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,29758,61967,31390,19098,24381,27267,29803,29822,29771,29871,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,33022,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,29923,29951,19613,19681,29983,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,30024,21982,20146,20198,19175,20445,20283,30122,30300,20403,30275,30307,20410,20442,20477,20310,20555,20624,28313,28345,30181,20725,30247,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,61967,30339,30357,30406,30438,61967,59516,61967,74619,31473,61967,55527,19522,55520,30909,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,30490,61967,31390,61967,61967,73090,30561,30579,71270,30628,61967,59516,61967,74619,45464,61967,55527,19522,55520,21356,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,30683,61967,57342,61967,61967,73090,30735,30753,72498,30802,61967,59516,61967,74619,34645,61967,55527,19522,55520,19199,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,30855,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,30961,61967,31390,70791,61967,28097,22589,31007,32778,31050,61967,59516,61967,45974,61967,61967,55527,19522,36762,32200,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73090,22589,61967,21436,31117,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,61967,23060,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,50599,31344,61967,61967,23063,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,61967,31384,31517,59141,59141,34770,52984,52984,31422,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,49285,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,61967,23060,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,50599,31344,61967,61967,23063,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,61967,61967,31517,59141,59141,34770,52984,52984,31422,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,61967,27084,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,50599,31344,61967,61967,23063,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,61967,61967,31517,59141,59141,34770,52984,52984,31422,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,61967,23060,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,50599,31344,61967,61967,31460,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,61967,61967,31517,59141,59141,34770,52984,52984,31422,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,44659,61967,61967,25386,70359,33542,44780,61967,74169,61967,44652,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,61967,23060,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,50599,31344,61967,61967,23063,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,61967,61967,31517,59141,59141,34770,52984,52984,31422,45145,53636,45179,45179,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,71110,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,61383,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,31505,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,31550,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,60964,31586,31617,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,26782,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31685,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31722,61967,31390,61967,61967,73090,31797,31748,31850,31879,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,72035,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,31966,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73090,22589,61967,61967,31998,61967,59516,61967,74619,61967,61967,55527,19522,55520,41710,22665,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,32087,31390,61967,61967,73090,32050,32071,20592,32120,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,32172,21655,21713,21687,32267,21777,19818,32299,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73090,22589,61967,61967,31117,61967,59516,61967,74619,61967,61967,55527,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,32359,45328,32394,57696,65386,32464,32495,32603,32525,62034,70632,30651,32635,32733,19295,32810,32880,32912,32991,33054,74169,33088,33130,33163,45989,25392,59141,33241,52984,56024,45145,31428,36983,45179,70338,33310,32220,58099,27328,61967,33367,33433,25402,66092,33481,37911,33910,33528,47097,61157,33574,61753,33618,33731,31765,68742,23063,34945,33781,41368,33852,38560,52078,55949,33942,34017,27845,43023,34098,50430,34177,62248,57537,24258,43351,68443,56707,34259,34314,58276,34349,45145,34442,34495,72106,34542,34611,34677,34744,34815,73537,31252,34847,37261,34977,51083,35015,35053,31690,31518,35109,47283,58827,70275,61805,56796,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,52125,35177,35243,41332,35298,35365,33401,59626,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,35445,45328,61967,61967,73090,35483,35510,35542,35574,61967,59516,61967,61967,61967,61967,52163,48269,57216,35626,43781,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,31305,61967,62286,23060,35725,73613,59141,59141,35797,52984,52984,35865,45145,45145,35932,45179,45179,35986,31344,61967,61967,23063,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,58891,61967,36103,63318,36136,36230,59141,36264,52984,65801,36356,45145,56526,36406,45179,43758,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,51661,67812,57941,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,32555,45328,23279,73166,19759,36443,36474,36505,36536,61967,36588,43861,44539,61967,19114,23147,36656,71728,67332,56205,74169,36716,22176,36794,36860,61640,59141,37718,36917,44877,36960,45145,37285,37026,33586,37060,26257,59568,24165,65366,73613,59968,37108,65487,55372,37167,69268,48100,37236,42027,37317,51793,50599,31344,60141,48701,23063,61967,25397,36232,55772,35138,52984,37349,35822,45145,61129,47967,45179,37426,58891,37499,31352,26821,31517,59141,52867,34770,52984,65140,31422,45145,37532,45179,54511,64222,61967,37577,58139,70018,73537,39632,39346,19718,45146,72426,45179,37613,60044,26466,37665,72228,37750,37787,43916,37853,61967,26636,59141,37904,47945,63759,45179,37943,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,46610,37980,38036,33401,34463,61516,69e3,26222,38090,38162,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,20574,45328,40138,52640,73090,38225,38256,38355,38286,61967,59516,61967,61967,43783,43782,21897,47178,42577,38387,54918,38446,38323,74131,48917,73999,38531,47646,35413,41239,38592,38624,38676,54441,43934,47786,31305,33098,65307,23060,61967,32432,59141,59141,38728,52984,52984,38807,45145,45145,38879,45179,45179,38933,39012,37500,60946,23063,26901,68795,39058,45875,68127,39093,53596,39131,70917,45145,39189,51783,45179,39260,61967,61967,20661,34712,59141,55880,62878,52984,39341,39378,25477,34983,45179,73008,64222,55507,39422,66949,46044,39455,58464,39514,67447,49193,71504,47769,46339,61967,31518,59141,50203,41951,45145,50986,45368,35693,32088,59141,39625,59730,36324,45179,39664,39725,25715,52935,49718,39701,25709,53833,42807,67039,39770,59825,42895,63165,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,36624,45328,74527,70800,39828,39925,39956,40038,39986,40262,40070,40102,40232,40170,40202,40294,40326,40358,40390,24566,30703,43994,40488,40534,52510,26061,68036,51395,40569,51336,64180,42132,40638,40717,40782,40835,40894,40926,40999,54209,41068,41100,62097,41179,41211,56932,41271,41400,48763,41502,41574,41631,41663,41742,52524,31899,41801,34206,41879,70010,41911,41990,42059,68924,42102,66773,71709,41302,42222,71091,42269,48816,36745,65446,54064,55792,42347,55288,42379,42460,42517,42632,50968,42664,51055,42716,31312,50294,26394,59852,33883,68540,64439,48450,44990,55438,42792,39669,67971,68098,42839,42962,42994,43118,43206,43294,43383,43461,43514,43571,43622,38775,43727,37872,26048,59986,48995,50587,43815,45229,43893,43966,59711,44044,44095,71632,44151,44223,44306,61516,44366,44439,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,51178,45328,44497,25348,62514,44571,44602,44698,44632,64126,59516,61967,61967,43339,43324,26535,44730,34877,44812,42739,74169,42756,61967,21098,23677,57958,59141,55717,44874,44877,73292,45145,60675,45179,33586,31305,61967,61967,23060,61967,44909,59141,59141,44946,52984,52984,45022,45145,45145,45090,45179,45180,50599,31344,61967,61967,23063,64117,25397,72876,59141,35138,72356,52984,35822,45145,45144,47967,45179,45178,58891,61967,61967,61967,45212,59141,61245,34770,52984,35200,31422,45145,45277,45179,59465,64222,61967,61967,73614,59141,73537,52984,39346,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,45322,32088,33808,52287,37755,53634,45360,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,45400,45496,45554,45632,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,22633,61967,73090,45695,45716,45748,45779,61967,59516,61967,58581,61967,61967,25386,70359,33542,35954,59106,74169,61967,61967,45831,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,36815,55188,59141,59141,71414,52984,52984,55959,45145,45145,42027,45179,45179,49730,61967,31934,74576,68206,61967,45869,63370,59141,35138,36928,52984,35822,63942,45145,47967,53519,45179,34924,61967,63249,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,66882,45907,59141,47029,52984,49058,45145,27213,45179,48216,45943,42315,46021,71814,46090,46163,60837,46218,46315,19972,21122,46371,46469,46528,46580,65851,56815,46680,46730,56489,46791,46846,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,46927,46902,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,46759,61967,46959,61967,23764,29839,23331,47009,47061,47129,72801,61967,50682,51133,63558,61967,61967,25392,59141,47210,52984,26113,45145,65189,36983,45179,47262,67359,61967,61967,61967,54284,65706,59141,59141,49630,52984,52984,35211,45145,45145,55054,45179,45179,37467,24679,61967,61967,61967,23200,68018,59141,59141,36165,52984,52984,36289,45145,45145,35333,45179,45179,49739,61967,73744,61967,31517,59141,53759,46635,52984,26985,19712,45145,35319,45179,71373,49738,61967,48906,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,70672,40537,59141,50201,41956,53634,45179,65296,50129,68862,67432,45046,47315,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,68217,45328,74693,74678,30929,47371,47403,47485,47433,61967,33699,61967,22340,47517,43262,47623,47678,47738,64840,61967,32571,70485,47818,61967,47854,39738,49620,47925,47999,41147,38696,48070,48148,48204,48248,40417,49398,57662,48301,48335,59688,37703,52883,48407,62897,33278,48482,63058,66341,60365,69403,41599,48554,61967,61967,48631,48687,61967,63187,52035,68814,46400,64057,58479,48733,72392,46437,47706,63796,25758,48795,64755,48848,48880,48949,63657,37135,49042,34282,49090,30521,49165,49244,55096,49317,49371,49430,40121,49513,49593,49662,49771,69630,49831,38004,49942,43174,49974,44666,50017,50049,64416,70861,70987,41427,60737,24104,27348,59141,50201,41956,53634,45179,69465,46870,44119,60815,44761,50105,50184,53833,42237,47591,50235,50335,41957,55454,33401,34463,50378,50476,26222,26197,50529,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,73792,45328,61967,61967,73090,22589,44012,50631,50662,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,72319,67753,52984,50714,45145,48116,36983,59064,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,31554,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,19983,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,36607,61967,61967,61967,61967,73483,59141,59141,41129,52984,52984,38753,45145,45145,56129,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,19234,45328,50303,66566,50746,50775,50796,50828,50859,62276,59516,20856,58581,20933,23823,26310,50911,51025,68602,51165,30975,41036,51210,60514,32701,51265,51368,51427,51481,51527,51559,59764,43148,51632,51693,60460,61967,74328,24433,61967,73613,44334,46283,68455,49799,46131,36198,25896,66788,62981,51755,43695,65598,61967,51825,43086,48599,61967,25397,25440,69836,35138,63904,37394,35822,45145,51871,47967,45179,51903,49739,34571,31189,61967,31517,41354,59141,46635,51935,52984,61099,45145,53636,42190,45179,49738,51972,34579,35749,52025,63478,52067,52202,27199,27023,52110,71340,37948,61967,52157,46270,40803,41951,37808,44274,45368,32362,32088,59141,52195,49116,65552,35021,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,52234,65968,57194,52266,52364,52339,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61968,45328,67360,52396,38499,52429,52460,52556,52490,62403,59516,48375,61967,62398,24754,37633,66396,52588,52672,61967,52766,25088,36885,61967,30596,52827,53355,52915,52982,53018,65538,46548,53050,53187,53120,53219,53295,61967,52734,61967,73613,35392,53344,65487,37373,53387,69268,39157,42921,42027,53429,53512,49730,40967,31637,22594,25049,61967,46698,59141,53551,70734,53594,46117,37193,53628,66323,47967,53668,41452,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,53706,61967,31518,53753,67413,41951,53791,69776,45368,61967,32088,59141,50201,53827,38831,58320,56815,39725,25715,41958,47966,34066,50346,65910,45112,49886,53865,25698,41957,55454,33401,34463,45245,53921,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,53974,22305,54043,54096,54128,54159,54241,54189,72930,39856,54273,21006,22797,54316,54348,54410,54543,54605,62497,61005,50879,47545,56426,37076,54683,54738,67753,54770,55310,42428,35833,46186,68665,54819,64899,54881,61967,72837,61967,67016,54950,58717,65487,54996,25625,69268,55042,71226,42027,55086,55128,49730,61967,61967,61463,26861,55168,55220,59141,55262,58644,52984,55342,48432,45145,21256,55421,45179,59455,55486,55559,55625,38475,55680,55749,55857,43539,55925,55991,27700,56056,56115,54472,56161,68353,73974,52795,49481,37685,56237,59357,56309,62684,56366,53088,54573,56398,61967,74387,50152,56458,49693,38644,56083,56558,56627,70421,56666,59905,56739,44254,56771,49271,56852,56902,54787,45290,46814,26482,56964,61612,67127,57019,69570,58223,39570,33401,34463,61516,57051,57083,26197,57163,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,57248,63325,57336,73090,57374,57405,57467,57435,57499,19324,57569,20778,57635,57728,57805,57878,57910,57990,73755,58069,23693,22104,54004,32235,25392,58171,58255,60004,49910,61322,73267,58308,58352,58405,38414,61967,58511,58571,66547,58615,58693,58762,40685,58804,58923,43590,58964,59018,68269,39228,59058,39796,59096,60104,61967,61967,24202,25397,66700,59140,35138,33261,59174,35822,48522,47089,47967,73355,59210,49739,61967,59250,61967,31517,59141,59141,59340,52984,51940,59389,45145,40606,45179,45179,52618,42295,61967,51839,55230,63869,65149,72175,30529,45146,59427,45179,59497,61967,45911,63422,34145,44407,34395,56987,45368,59566,32088,59141,50201,41956,53634,45179,56577,47339,73498,67679,58870,53889,70446,59600,59658,39593,59796,25698,41957,55454,33401,34463,61516,59884,64496,26197,59937,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,32327,61967,60036,60076,60173,60204,60235,60267,22836,59516,61967,34700,40956,61967,27363,60334,58986,60433,56595,74169,22999,49460,32413,61967,43482,50073,51289,60546,51449,60601,60652,60707,60387,60788,60869,60910,31137,60996,61967,73613,59141,55809,65487,52984,67662,69268,45145,66019,42027,45179,39215,49730,61037,61967,20949,24449,31919,25397,61231,59141,32841,64341,52984,40595,58849,45145,47967,34903,45179,49739,55579,61967,68732,31517,59141,61277,67644,70519,52984,61316,21266,53636,45179,37454,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,60130,65237,59141,50203,41951,45145,50986,55136,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,67868,61354,31273,61435,61505,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,59516,61967,61548,42760,41769,45799,69947,61582,38901,61672,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,53721,61967,61967,61967,73613,59141,59141,73207,52984,52984,53397,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,61706,46635,35145,52984,19712,71458,53636,45179,61745,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,64983,50497,41956,61785,54498,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,22692,61967,33191,33209,61837,61864,61896,61927,22745,62820,19946,40862,64737,62e3,62066,62154,62186,62218,43781,54011,62318,62435,54906,73915,62546,62583,62645,58446,39482,50942,39390,45584,62716,62748,67359,72280,62801,40502,62780,47568,62852,59141,62943,63013,52984,63103,70927,25300,63135,35900,37028,63219,61967,66641,32664,61967,63288,63357,63402,63469,49543,51313,63510,63038,69345,51585,64202,49339,32943,49739,63554,32018,63590,39286,63644,63689,62122,63723,52984,27170,73307,53636,43679,63791,53480,25171,63828,66889,63862,33820,63901,58932,63936,59026,63974,25265,56820,64014,57603,59141,64050,48038,71305,53178,33985,73658,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,48172,71172,51723,64089,33390,47959,46247,64158,64254,33401,34463,61516,64313,64390,64471,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,63612,64557,64528,64589,64618,64650,64681,64713,60478,32760,33131,61967,43406,44842,43429,64787,39544,64872,64944,33335,48584,61967,53263,54635,65031,52850,25570,65112,44877,34377,65181,67214,41470,33586,58017,24695,65221,45449,24088,73613,69860,59141,58730,57131,52984,55010,67270,45145,49010,65269,45179,40750,61967,65339,24869,65418,43075,65478,25226,67619,41941,52986,52307,62670,45145,65519,65584,45179,65630,65679,52722,19637,20650,68e3,59141,65749,46635,73129,65795,19712,66033,53636,45179,65833,49738,73050,69509,73614,64999,65883,68939,46496,63071,42154,69414,53075,56820,22506,57757,59141,50203,41951,45145,50986,59218,60287,67507,63691,50201,42409,51600,50993,56188,21836,65763,58661,49212,51108,57773,65942,50266,33390,47959,40667,66e3,66065,66124,66189,66277,66373,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,21376,61967,23495,23513,66428,66459,66490,66522,38306,66614,40006,22557,30149,35656,66673,66742,66820,66852,66921,22075,66991,51233,67071,57278,57304,54706,67159,68149,54849,67191,67246,34043,67302,67392,67479,74237,67539,61967,58539,67592,67711,56694,66220,67785,56265,71202,56340,38119,50408,67844,67900,67941,30770,55648,68068,68181,59534,56870,67739,33449,62613,48020,57846,66245,68249,42930,68301,68333,63982,68385,69687,51993,61967,68417,68487,71788,74412,47230,68519,30055,42548,43651,68572,68634,42684,68705,54651,68774,68846,58772,68894,73433,66303,68971,53459,69053,56820,69153,64912,38193,69234,69300,69326,69377,69446,69497,67100,45663,53942,53151,71012,69541,43050,29244,69602,60569,72779,69662,25709,53833,34510,33390,47959,25698,64358,65647,69730,69808,69892,69924,26222,26197,69979,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,53312,61967,70050,73090,70088,70119,70215,70149,61967,22468,60496,41027,24192,61967,66959,70247,70307,70391,70478,74169,61967,31818,60928,48303,35765,59141,64281,70517,25637,48506,45145,70551,45179,70576,69110,70608,39026,49985,70664,61403,55893,70704,63437,51495,70832,70893,52950,70959,64818,40734,71064,71142,61473,66582,61967,61967,71268,62551,59141,59141,54378,52984,52984,63748,71302,45145,47967,71337,45179,58373,19649,61967,61967,32140,59141,59141,48974,52984,52984,27826,45145,53636,71372,45179,26165,61967,58119,56634,71405,61713,44397,34783,71446,38130,71490,41542,71536,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,71601,55389,37545,35266,25709,53833,34510,33390,47959,25698,41957,32959,71687,71760,61516,69e3,71871,71846,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,31085,71952,71903,22895,71940,46977,71984,72015,61967,59516,61967,61967,61967,61967,65717,44465,72067,44780,36104,30823,61967,61967,61967,72138,25803,59142,67753,72171,65080,59747,37204,71655,45179,72207,67359,61967,61967,72276,61550,73613,59141,72312,65487,52984,72351,69268,45145,72388,42027,45179,72424,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,52397,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,72458,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,60756,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,22964,61967,72496,72530,72590,72621,72652,72684,61967,59516,61967,61967,61967,61967,25386,72751,60620,69083,61967,74169,61967,61967,31070,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,72833,61967,72869,59141,59141,44181,52984,52984,62968,45145,45145,30076,45179,45179,49739,23368,61967,61967,31517,73394,39061,46635,72244,42070,19712,36314,49133,53674,45179,72908,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31685,61967,45328,61967,61967,73090,22589,25523,31221,45429,61967,18574,70183,61967,47822,26584,47453,45522,72962,44780,61967,23596,23420,73040,61967,61967,25392,23163,58202,26940,62911,45145,36684,36983,50444,47157,73082,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,35683,61967,25397,55825,59141,73122,46648,52984,46426,71236,45145,47967,67909,45179,49739,73161,61967,61967,31517,73198,59141,21922,52984,52984,21232,45145,53636,61185,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,22589,25523,31221,70763,61967,59516,37581,61967,61967,61967,64966,73239,36374,43234,59108,74169,61967,61967,61967,64018,25392,59141,65058,52984,63522,45145,45145,73339,45179,34124,52699,61967,61967,61967,31152,73613,55703,53562,65487,36186,56277,69268,66146,37821,42027,72097,60401,49730,19527,61967,61967,61967,61967,25397,73387,59141,57834,73426,52984,44971,56515,45145,42174,72992,45179,49739,61967,61967,61967,73465,59141,73530,46635,39099,52984,19712,66157,53636,45179,41533,49738,61967,57590,73614,59141,61284,52984,59178,45145,45146,45179,45179,73569,72139,44914,59141,57109,44191,45145,33969,45368,61967,73609,66710,69021,41956,69756,61199,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,31184,61967,45328,61967,61967,73090,73646,25523,31221,45429,61967,59516,61967,61967,61967,61967,25386,70359,33542,44780,61967,74169,61967,61967,61967,61967,25392,59141,67753,52984,44877,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31018,73719,69179,73690,73787,69202,73824,73856,61967,59516,61967,73908,61967,61967,55527,21623,36828,19508,18606,18665,61967,70169,30458,18726,18778,19038,73947,18928,19004,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,71562,71569,74031,74114,24997,74062,61967,59516,61967,74619,61967,74163,38964,19522,24885,19508,18606,18665,61967,70169,30458,18726,18778,19038,18896,18928,18960,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,29992,61967,61967,21447,74201,74220,22416,74269,61967,59516,61967,74321,23436,61967,41694,19522,55520,19508,18606,18665,61967,70169,30458,18726,18778,19038,74360,18928,74444,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,21595,21655,21713,21687,21745,21777,19818,21809,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,22337,61967,31390,61967,61967,73090,22589,61967,61967,74507,61967,59516,61967,61967,61967,61967,25386,70359,33542,44063,61967,74169,61967,61967,61967,61967,25392,59141,46058,52984,34317,45145,45145,36983,45179,33586,67359,61967,61967,61967,61967,73613,59141,59141,65487,52984,52984,69268,45145,45145,42027,45179,45179,49730,61967,61967,61967,61967,61967,25397,59141,59141,35138,52984,52984,35822,45145,45145,47967,45179,45179,49739,61967,61967,61967,31517,59141,59141,46635,52984,52984,19712,45145,53636,45179,45179,49738,61967,61967,73614,59141,61284,52984,59178,45145,45146,45179,45179,56820,61967,31518,59141,50203,41951,45145,50986,45368,61967,32088,59141,50201,41956,53634,45179,56815,39725,25715,41958,47966,35266,25709,53833,34510,33390,47959,25698,41957,55454,33401,34463,61516,69e3,26222,26197,25989,26254,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,62021,61967,25189,74559,39893,74608,61967,61967,61967,74619,61967,61967,55527,19522,55520,19508,18606,74658,61967,70169,30458,18726,18778,19038,73947,18928,19004,18916,18992,48655,19036,19070,19146,19231,58583,74082,19266,19356,74753,19443,19917,18745,27106,74847,18746,27107,30883,74757,19492,19559,36556,19613,19681,19750,24509,29432,20022,19387,19791,30215,19854,61068,30211,19850,19886,20015,20054,19411,21982,20146,20198,19175,20445,20283,20364,30300,20403,20371,30307,20410,20442,20477,20310,20555,20624,28313,28345,20693,20725,20757,20722,20810,28340,20888,19581,20981,21038,18850,21154,21201,21169,18833,18864,18694,21298,21330,21509,21408,21531,21479,21563,74725,21655,21713,21687,74789,21777,19818,74821,20837,55524,20506,21868,20523,21954,22014,22046,22136,22208,22240,22272,22302,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,61967,1,24578,3,0,0,0,0,0,0,0,180525,180525,180525,180525,0,188718,188718,188718,180525,180525,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,0,188718,180525,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,139264,147456,188718,188718,188718,188718,131072,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,188718,368,188718,180525,188718,188718,188718,188718,188718,1,24578,3,0,0,4366336,0,0,0,180525,188718,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,0,705,0,0,0,0,0,0,0,0,0,0,0,0,4857856,4874240,0,0,4923392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5480448,0,0,0,0,0,0,0,0,0,0,6299648,0,0,0,0,0,0,0,0,0,0,0,0,2088,0,0,0,4825088,0,0,0,0,0,0,0,0,0,5840896,5849088,0,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,0,5898240,5963776,0,0,6193152,0,0,5406720,6397952,5300224,5234688,5423104,0,0,0,0,5988352,0,0,6135808,6307840,0,5996544,4800512,0,5259264,0,5414912,5447680,0,0,5562368,5636096,5685248,0,5750784,5873664,0,0,0,0,5636096,5873664,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5177344,0,0,0,0,0,5242880,0,0,0,0,0,0,0,5341184,0,0,5873664,0,0,0,0,0,0,0,5480448,4358144,4358144,4358144,4358144,4857856,4874240,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5259264,4358144,4358144,4358144,915,915,915,0,0,0,0,0,0,5029888,5038080,0,0,5103616,5201920,0,0,0,0,0,0,0,0,0,0,0,0,0,6406144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4997120,4358144,4358144,5038080,4358144,4358144,4358144,5095424,5103616,4358144,4358144,5201920,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5890048,4358144,4358144,4358144,6029312,4358144,4358144,4358144,4358144,6160384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6406144,4358144,4358144,4358144,0,0,0,4890624,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,916,0,0,0,0,0,4857856,4874240,0,0,0,0,0,0,0,0,0,0,0,0,0,5259264,0,0,0,0,0,0,0,0,5414912,0,5447680,0,5464064,0,5480448,5562368,0,0,0,5636096,0,5685248,0,0,5750784,0,0,0,0,0,5873664,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,0,992,0,5464064,0,5480448,5562368,0,0,0,5636096,0,5685248,0,0,5750784,0,0,0,0,0,5873664,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5414912,4358144,5447680,4358144,5464064,4358144,5480448,5562368,4358144,4358144,4358144,5636096,4358144,5685248,4358144,4358144,5750784,4358144,4358144,4358144,4358144,4358144,5873664,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4923392,4358144,4358144,4358144,4358144,4358144,0,4923392,0,0,0,0,0,0,0,0,0,450560,450560,0,0,450560,450560,450560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,825,0,0,0,0,0,0,0,0,0,0,0,4366336,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5242880,0,0,0,0,0,0,0,0,6283264,6332416,0,0,0,5881856,0,5382144,0,0,0,0,0,0,6266880,4784128,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,368640,0,0,0,0,0,5603328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,340,341,0,0,0,4759552,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4825088,0,0,5177344,0,0,0,0,0,0,0,649,0,0,0,0,0,0,820,0,0,0,0,0,0,0,0,0,0,0,0,0,649,0,0,0,0,0,0,0,692,0,0,0,0,0,0,699,368,368,368,0,0,0,0,0,0,0,0,0,0,0,712,0,0,0,5701632,0,0,0,0,0,0,0,0,0,0,5808128,0,0,0,0,4792320,4833280,0,0,5701632,0,0,0,0,0,4358144,4358144,4358144,4825088,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6119424,4358144,6168576,4358144,4358144,4358144,4358144,6242304,4358144,6291456,4358144,6316032,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6463488,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,0,0,0,4956160,4964352,0,5341184,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5627904,5652480,4358144,5701632,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,303,0,304,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5627904,5652480,4358144,5701632,4358144,4358144,5808128,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2314,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6299648,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,5029888,5038080,0,0,5103616,5201920,0,0,0,0,0,0,0,0,0,0,0,0,0,6406144,5570560,5578752,0,5668864,0,0,5791744,0,0,0,0,0,0,0,0,0,6201344,6242304,6250496,0,0,0,0,6422528,0,0,0,0,0,0,0,0,0,0,0,2813,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2800,0,0,0,0,0,0,0,0,0,0,0,5619712,0,0,0,0,0,0,0,5726208,5758976,0,0,5791744,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6152192,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60689,57917,57917,0,0,6316032,0,0,0,0,5816320,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,320,0,4358144,4358144,6463488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4931584,4939776,0,0,0,0,0,0,5054464,0,0,0,0,0,0,0,0,0,0,6324224,0,0,5005312,0,0,0,512e4,5136384,0,0,0,0,0,0,0,0,0,0,6324224,4358144,4358144,0,0,0,5791744,5816320,0,5857280,0,0,0,0,0,0,0,0,0,0,0,0,0,6119424,0,6168576,0,0,0,0,0,6242304,0,6291456,0,6316032,0,0,0,6316032,0,0,0,0,0,0,0,0,0,6463488,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4931584,4939776,4358144,4358144,4358144,4358144,4358144,4358144,5054464,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6299648,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,4825088,0,0,0,0,0,0,0,722,0,724,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,741,0,0,0,0,0,0,0,0,0,0,3669,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,739,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5210112,4358144,4358144,4358144,4358144,5292032,4358144,4358144,4358144,4358144,5365760,4358144,4358144,4358144,5455872,4358144,4358144,4358144,4358144,4358144,5554176,5570560,5578752,5619712,5668864,4358144,4358144,4358144,5791744,5816320,4358144,5857280,4358144,4358144,4358144,5791744,5816320,4358144,5857280,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6119424,4358144,6168576,4358144,4358144,4358144,4358144,4358144,6242304,4358144,6291456,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6299648,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,915,915,915,4826003,915,915,915,915,915,915,6464403,0,0,0,0,991,991,991,991,991,991,991,991,991,991,991,4932575,4940767,991,991,991,991,991,991,5055455,991,0,0,0,0,6184960,5316608,0,0,5644288,0,0,0,0,0,0,0,0,0,0,6217728,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,303104,0,0,0,0,0,0,0,0,0,0,5390336,5308416,5488640,0,0,0,0,0,0,0,0,0,5070848,5431296,0,6430720,0,5160960,0,0,0,0,0,0,0,0,0,0,0,4784128,0,0,0,0,0,0,0,245760,0,0,0,245760,0,0,245760,245760,245760,0,0,0,0,0,245760,0,245760,245760,0,0,0,245760,245760,0,0,0,0,0,0,245760,0,0,0,0,0,0,245760,0,0,245760,0,0,245760,0,0,245760,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5799936,4358144,4358144,5881856,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6103040,4358144,4358144,4358144,6184960,4358144,4358144,6283264,4358144,4358144,6332416,4358144,4358144,4358144,6389760,4358144,4358144,6430720,6438912,4358144,4358144,4358144,6266880,6488064,0,0,0,6266880,6488064,0,0,0,0,0,0,0,0,0,0,0,0,344064,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,344064,0,4358144,4358144,6389760,4358144,4358144,6430720,6438912,0,0,0,0,0,0,4784128,0,0,0,4849664,0,0,0,0,0,4915200,0,4956160,4972544,0,0,0,0,0,0,5070848,0,0,0,0,0,0,0,5881856,0,0,0,0,0,0,0,0,0,6103040,0,0,0,6184960,0,0,0,6283264,0,0,6332416,0,0,0,6389760,0,0,6430720,6438912,4784128,4358144,4358144,4358144,4849664,4358144,4358144,4358144,4358144,4358144,4915200,4358144,4956160,4972544,4358144,4358144,4358144,4358144,4358144,4358144,5070848,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5218304,4358144,5267456,4358144,4358144,5308416,5316608,4358144,4358144,4358144,5431296,4358144,5488640,4358144,4358144,5488640,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5799936,4358144,4358144,5881856,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6103040,4358144,4358144,4358144,6184960,4358144,4358144,4358144,0,5013504,0,0,6053888,0,0,0,0,0,0,0,0,6012928,4358144,4358144,5013504,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6053888,4358144,4358144,4358144,0,0,0,0,5193728,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,5660672,5718016,0,5865472,0,0,0,0,6078464,0,0,6340608,0,6455296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,327,328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,581632,0,0,0,0,0,0,0,0,0,0,0,581632,0,0,0,0,0,6037504,6111232,0,0,0,5472256,0,0,0,6209536,0,0,0,0,0,0,0,0,0,0,0,6176768,0,0,0,0,0,0,0,0,0,0,2840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2850,0,0,0,0,0,2855,0,5824512,5865472,4358144,4358144,5922816,4358144,4358144,6021120,4358144,6037504,4358144,4358144,6078464,6111232,4358144,6176768,6209536,6234112,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,4841472,0,0,0,4898816,0,0,0,0,0,0,0,0,0,0,0,5111808,0,0,0,0,0,5283840,0,0,0,0,5472256,5521408,0,0,0,0,5595136,5709824,5718016,0,5824512,5865472,0,0,5922816,0,0,6021120,0,6037504,0,0,6078464,6111232,0,6176768,6209536,0,6234112,0,0,0,0,0,0,0,0,0,0,0,0,647,757,0,759,0,761,762,676,0,0,766,767,0,0,0,0,0,0,0,0,0,5595136,5709824,5718016,0,5824512,5865472,0,0,5922816,0,0,6021120,0,6037504,0,0,6078464,6111232,0,6176768,6209536,0,6234112,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,731,0,0,0,0,0,0,0,0,0,742,0,0,0,0,742,4358144,4358144,5595136,5709824,5718016,4358144,5824512,5865472,4358144,4358144,5922816,4358144,4358144,6021120,4358144,6037504,4358144,4358144,6078464,6111232,4358144,6176768,6209536,4358144,6234112,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,1066,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,662,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2356,0,0,0,0,0,0,0,0,0,0,0,5357568,0,5505024,0,0,0,0,0,5890048,0,0,0,6160384,0,5095424,5349376,0,5275648,0,0,0,0,0,0,4997120,0,0,0,0,0,0,0,0,0,0,755,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,776,0,0,0,5947392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6471680,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4997120,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6299648,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,1988,0,0,0,4825088,0,0,0,0,0,0,0,1287,0,0,0,0,0,0,0,0,0,0,0,0,0,1299,0,1177,0,0,0,0,0,0,0,0,0,0,0,3689,0,0,0,0,0,0,0,3696,0,0,0,0,0,0,0,0,0,0,0,529,4358144,4358144,4358144,4358144,6406144,0,0,0,0,0,0,0,0,4997120,0,0,5038080,0,0,0,5095424,5103616,0,0,5201920,0,0,0,0,0,0,0,0,0,0,0,5890048,0,0,0,6029312,0,0,0,0,6160384,0,0,0,0,0,5890048,0,0,0,6029312,0,0,0,0,6160384,0,0,0,0,0,0,0,6406144,0,0,0,0,0,0,0,0,4997120,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60363,57917,57917,57917,57917,57917,57917,57917,57917,57917,59997,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60389,57917,57917,57917,57917,57917,57917,57917,57917,0,6356992,0,0,0,0,0,0,0,0,5496832,0,0,0,0,0,5611520,0,0,0,0,0,4947968,5021696,5529600,0,0,5169152,0,0,0,4800512,4808704,4358144,4358144,4890624,4358144,4947968,4358144,4358144,4358144,5046272,4358144,4358144,4358144,4358144,5185536,4358144,5234688,5300224,4358144,4358144,5406720,5529600,4358144,4358144,4358144,5898240,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,491520,0,0,0,0,0,0,0,0,0,0,0,0,0,0,357,358,359,360,0,0,0,0,0,0,0,0,0,368,0,297,0,0,0,0,5898240,0,0,0,0,0,0,0,0,6307840,0,0,6356992,6381568,6397952,4800512,4808704,0,0,4890624,0,4947968,0,0,0,5046272,0,0,0,0,0,0,0,0,0,557056,557056,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2359296,420,420,0,0,0,0,4358144,4947968,4358144,4358144,4358144,5046272,4358144,4358144,4358144,4358144,5185536,4358144,5234688,5300224,4358144,4358144,5406720,5529600,4358144,4358144,4358144,4358144,5898240,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6307840,4358144,4358144,6356992,6381568,6397952,4800512,4808704,0,0,4890624,0,4947968,0,0,0,5046272,0,0,0,0,5185536,0,5234688,5300224,0,0,5406720,5529600,0,0,0,0,5898240,0,0,0,0,0,0,0,0,6307840,0,0,6356992,6381568,6397952,4800512,4808704,4358144,4358144,4890624,4358144,4358144,6356992,6381568,6397952,5021696,4358144,4358144,5021696,0,0,0,4980736,0,0,0,0,0,5373952,5734400,6045696,0,6258688,6447104,0,0,6127616,0,6348800,5906432,0,5537792,3681,4882432,0,0,0,0,0,0,0,0,5939200,0,0,5677056,6365184,4866048,0,6070272,5545984,5152768,0,0,6144e3,4358144,4866048,4882432,4358144,4980736,4358144,4358144,4358144,4358144,4358144,0,916,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,992,0,0,4358144,4358144,4358144,4358144,5324800,5373952,5537792,5545984,5734400,5971968,4358144,6045696,4358144,6070272,4358144,4358144,4358144,6348800,0,4866048,4882432,0,4980736,0,0,0,0,0,0,0,0,5324800,5586944,5734400,5971968,0,6045696,0,6070272,0,0,0,0,6348800,4358144,4866048,4882432,4358144,4980736,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5324800,5373952,5537792,5545984,5586944,5734400,5971968,0,6045696,0,6070272,0,0,0,0,6348800,0,4866048,4882432,0,4980736,0,0,0,0,0,0,0,0,5324800,5373952,5537792,5545984,4358144,6045696,4358144,6070272,4358144,4358144,4358144,4358144,6348800,4358144,6144e3,0,6144e3,0,4988928,5005312,0,0,0,0,5775360,0,0,0,3681,0,0,0,0,0,0,5693440,0,6496256,5144576,5136384,0,5914624,4358144,4358144,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,0,0,5005312,0,0,0,512e4,5136384,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,5914624,5914624,0,0,0,0,0,5513216,5783552,0,3681,0,0,0,0,0,0,3839,0,0,0,0,3843,0,0,0,0,0,0,0,0,3846,0,529,529,529,3848,529,529,529,3851,529,0,0,5013504,0,0,0,0,0,0,0,0,0,6053888,0,0,0,0,0,5013504,0,0,0,0,0,0,0,0,0,6053888,0,0,0,0,0,0,0,806,0,0,0,0,0,0,806,0,529,529,529,529,529,529,529,529,874,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60296,57894,5193728,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,5193728,0,0,0,0,0,0,0,0,0,0,0,0,0,5193728,0,0,0,0,0,0,0,0,0,5218304,0,0,0,0,5799936,0,5881856,0,0,0,0,0,0,0,0,6373376,6389760,0,0,6488064,6103040,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,5193728,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4907008,0,5079040,6094848,5742592,0,0,0,0,0,4358144,4907008,4358144,5079040,4358144,5226496,4358144,5742592,4358144,4358144,4358144,6094848,0,4907008,0,5079040,0,5226496,0,5742592,0,0,0,6094848,0,0,4907008,0,5079040,0,5226496,0,5742592,0,0,0,0,0,0,0,1194,0,0,0,1198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,1202,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1275,0,0,0,1279,6094848,0,4358144,4907008,4358144,5079040,4358144,5226496,4358144,5742592,4358144,4358144,4358144,6094848,4358144,5062656,0,0,0,0,0,4358144,5062656,4358144,4358144,4358144,4358144,4358144,0,5062656,0,0,0,0,0,0,0,352256,0,352256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1273,0,0,0,0,0,0,0,0,0,6225920,0,5062656,0,0,0,0,0,6225920,4358144,5062656,4358144,4358144,4358144,4358144,4358144,6225920,0,6086656,0,0,0,4816896,4358144,4358144,4358144,4358144,6086656,4816896,0,0,0,0,6086656,4816896,0,0,0,0,6086656,4816896,4358144,4358144,4358144,4358144,6086656,0,5087232,0,5931008,4358144,5332992,5980160,4358144,0,5332992,5980160,0,0,5332992,5980160,0,4358144,5332992,5980160,4358144,0,5439488,5128192,4358144,5128192,0,5128192,0,5128192,4358144,0,4358144,0,0,4358144,0,4358144,0,0,4358144,0,4358144,0,0,4358144,6004736,6004736,6004736,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,386,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,774,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,221654,221654,221654,470,470,470,470,470,470,470,470,470,470,470,221654,470,221654,221654,221654,470,221654,221654,221654,221654,221654,221654,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2359296,0,2359296,0,0,0,2359296,0,2359296,2359296,2359296,2359296,221654,221654,221654,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,703,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,425984,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3455,0,0,0,0,0,0,0,0,0,0,0,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,237568,303,0,307,237568,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,760,0,0,0,0,0,0,0,0,0,770,0,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2364,0,0,0,114688,0,0,0,0,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,383,0,0,0,0,307,0,0,4857856,4874240,0,0,4923392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5480448,0,0,0,0,0,0,0,0,0,352,353,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,297,0,0,4210980,24578,3,0,0,298,0,0,0,0,298,0,0,0,0,0,0,0,0,0,245760,0,0,0,0,0,0,0,0,0,0,0,0,665,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,681,682,0,0,245760,245760,0,4210980,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,664,0,794,0,0,0,0,0,0,0,798,0,0,0,0,807,0,0,746,0,0,0,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,680,0,0,0,0,0,1160,0,4857856,4874240,0,0,4923392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5480448,0,0,0,0,0,0,0,0,0,378,0,363,0,0,0,0,0,0,0,0,0,363,0,0,0,0,139264,147456,0,0,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,262144,0,0,0,0,0,0,0,0,0,0,0,0,376832,0,376832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,364,365,366,367,0,0,368,0,297,0,0,0,262144,262144,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1244,0,0,0,0,0,0,262144,0,262144,262144,0,0,0,0,0,0,0,0,0,0,0,262144,262144,0,262144,0,0,0,139264,147456,262144,0,0,0,0,0,0,0,1829,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,262144,0,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,262739,0,262739,0,0,262739,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,702,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1390,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,0,0,278528,278528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2417,0,0,0,0,0,0,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,278528,0,278528,278528,0,131072,278528,0,0,0,278528,0,0,0,0,0,0,278528,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,317,0,0,0,0,0,0,0,0,0,0,0,0,0,0,278528,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,771,0,0,771,0,0,0,0,0,771,771,0,830,0,0,0,0,0,0,0,0,418,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2803,0,0,0,0,0,0,1,24578,3,0,0,4366336,0,0,0,0,0,303,639,0,4268032,307,642,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1230,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2351104,0,0,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,1433,0,0,0,0,0,4857856,4874240,0,0,0,0,0,0,0,0,0,402,0,0,0,0,0,0,0,0,0,0,0,0,402,0,0,0,0,0,0,0,0,0,0,0,413,359,0,0,402,0,0,0,0,0,139264,147456,402,413,0,426,0,5750784,0,0,0,0,0,5873664,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,0,1528,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,286720,304,0,308,286720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1203,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,0,308,0,0,0,0,0,0,0,0,0,0,0,0,308,0,0,0,0,0,0,308,139264,287141,0,0,0,308,1,24578,3,0,0,4366336,0,0,0,0,0,303,66176,0,4268032,307,98947,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1317,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1235,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,308,0,308,0,0,0,0,122880,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,771,0,0,0,0,307,0,308,4857856,4874240,0,0,4923392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5480448,0,0,0,0,0,0,0,0,0,662,0,0,0,0,0,0,0,0,0,662,0,0,662,0,0,0,828,0,0,0,662,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,305,305,305,0,0,305,305,295217,305,305,305,305,305,305,305,305,305,295217,305,295217,295217,295217,295217,295217,295217,295217,305,0,305,0,305,305,305,295217,305,305,305,295217,295217,305,295217,305,305,305,305,305,295286,295217,295217,295217,295217,295217,295217,305,305,305,305,305,305,295286,295217,295217,295217,305,305,305,295286,139264,147456,295217,295217,305,305,305,305,305,295217,374,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,305,369,305,0,295217,305,295217,305,295217,305,131072,305,305,305,305,295217,305,305,305,305,305,305,295217,305,295217,295217,295217,305,305,305,305,305,305,305,305,305,305,305,305,305,295217,295217,295217,295217,295217,295217,305,305,305,305,295217,305,305,305,305,305,305,305,305,305,295217,305,295217,295217,295217,295217,295217,295217,295217,295217,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295286,295217,295217,295217,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1749,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3673,3674,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5840896,5849088,0,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,4399804,4399804,0,0,0,0,0,0,0,1829,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1842,0,0,0,0,0,0,0,0,0,703,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2415,0,0,0,0,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,319488,0,0,0,0,0,0,0,0,0,0,0,2841,0,0,0,0,2843,0,0,0,0,0,0,0,0,0,2852,0,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,319488,0,0,0,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,319488,0,0,0,0,319488,0,0,0,0,0,0,0,0,0,0,319488,0,0,0,319488,0,0,0,0,0,0,0,0,0,0,319488,0,0,0,0,0,0,0,0,0,319488,0,0,0,0,319488,0,0,0,0,0,319488,319488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,450560,450560,0,0,0,0,319488,319488,319488,0,24578,3,0,0,4366336,253952,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1832,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2382,0,0,0,0,2387,0,0,0,0,0,0,0,0,0,0,0,5840896,5849088,0,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,368,0,0,0,0,0,0,0,0,0,5857280,0,6463488,4939776,0,0,5455872,0,0,0,0,0,0,0,0,6062080,6463488,0,5398528,0,0,0,6479872,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,327680,0,0,0,0,0,0,0,0,0,0,1168,0,0,0,0,0,0,0,0,0,1178,0,0,0,0,0,0,0,1185,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,327680,327680,327680,0,0,0,0,0,0,0,0,0,0,327680,49724,0,0,0,0,0,0,0,49724,49724,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,327680,327680,327680,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2302,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1780,0,0,0,0,0,0,0,0,0,0,0,327680,327680,327680,327680,327680,327680,335872,327680,327680,327680,335872,327680,327680,327680,327680,327680,327680,0,0,0,0,0,0,0,0,0,49724,0,0,0,0,0,0,0,0,0,663,0,0,0,0,0,0,0,0,0,663,0,0,663,0,0,0,0,0,0,0,663,0,0,5750784,0,0,0,0,0,5873664,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,49152,992,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,344064,344064,344064,0,0,0,0,0,0,0,0,0,0,344064,344064,344064,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2319,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2326528,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,352256,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,352256,0,0,0,0,0,131072,0,0,0,0,0,352256,0,0,352256,352256,352256,0,352256,0,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,352256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,469,0,0,0,0,0,0,0,0,0,0,2335239,2335206,352256,352256,352256,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2377,0,0,2380,0,0,0,0,2385,0,0,0,0,0,2391,0,0,1,293,3,0,0,0,299,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1242,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,360448,360448,360448,0,0,0,0,0,0,0,0,0,0,360448,360448,360448,1,0,3,155943,155943,297,0,637,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3162,0,3163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212992,0,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,529,529,529,529,1379,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2471,2472,529,529,529,57944,57944,57944,57944,57944,57944,59007,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60756,57944,57944,57944,57944,57917,57917,60373,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59507,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,3430,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,405,0,0,0,0,0,0,0,0,0,333,0,0,3469,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1958,529,529,1961,529,529,529,529,529,3500,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2470,529,529,529,529,529,57917,57917,57917,57917,60926,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60395,57917,57917,0,0,0,0,3683,0,0,0,0,3688,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,57894,529,57894,529,529,57894,529,529,57917,57894,529,529,57894,57894,3704,529,529,529,3707,529,529,529,529,529,529,529,529,529,3715,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,58786,57894,57894,57894,58790,529,529,529,529,529,529,529,57894,61075,57894,57894,57894,61078,57894,57894,57894,57894,57894,57894,57894,57894,57894,61086,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59386,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58858,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,61115,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,61133,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61136,57944,57944,57944,57944,57944,57944,57944,57944,57944,61144,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60091,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,3681,0,0,3835,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1363,529,529,529,529,529,529,529,529,529,529,529,3857,529,529,529,3858,3859,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61219,57894,57894,57894,57894,61220,61221,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61238,57917,57917,57917,57917,57917,57917,59450,59451,57917,57917,57917,57917,59458,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59473,57917,57917,57917,61239,61240,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61257,57944,57944,57944,57944,61258,61259,57894,57894,57894,57894,57894,61311,57894,57894,57894,61315,57894,57917,57917,57917,57917,57917,57917,61321,57917,57917,57917,57917,57917,57917,61327,57917,57917,57917,61331,57917,57944,57944,57944,57944,0,0,529,529,57894,57894,57917,57917,57944,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,57944,57944,57944,57944,61337,57944,57944,57944,57944,57944,57944,61343,57944,57944,57944,61347,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,3838,0,0,3841,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,1350,529,529,529,529,529,529,1365,529,529,529,1370,529,0,0,0,0,4018,529,529,529,529,529,529,529,529,529,529,529,529,529,529,61377,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58848,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,57894,57894,57894,61393,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61409,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,3148,0,0,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,0,0,0,0,529,529,529,529,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,529,529,529,529,529,529,57894,57894,57917,57944,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1789,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,376832,376832,376832,0,0,0,0,0,0,0,0,0,0,0,0,742,662,0,0,529,844,529,529,529,859,529,529,529,529,529,529,529,529,529,529,0,0,0,0,0,422,422,422,422,598,598,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,422,0,422,0,0,422,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3216,3217,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,3946,529,529,529,529,529,529,3952,529,529,529,529,57894,57894,57894,57894,57894,57894,61305,57894,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,309,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3482,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,3950,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,393687,393687,393687,0,0,0,0,0,0,0,0,0,0,0,0,788,0,0,0,529,843,529,529,529,529,529,529,875,529,529,529,529,529,529,529,0,0,0,0,0,393687,0,393687,393687,393687,0,393687,393687,393687,393687,393687,393687,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,737,0,0,803,0,0,0,0,0,0,0,803,0,393687,393687,0,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3693,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,306,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,0,423,0,0,0,0,0,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,0,423,0,0,423,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,306,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4399804,4399804,4399804,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,750,423,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2853,2854,0,0,0,1153,1727,1728,0,0,0,1734,1735,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2388,0,0,0,0,0,2295,0,0,0,0,2297,1735,2298,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2416,0,0,0,0,0,529,529,529,2504,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58829,57894,57894,57894,57894,529,529,529,529,529,529,529,2504,2938,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60341,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,2593,3005,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60710,57917,57944,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,417792,310,311,0,0,0,0,0,0,0,1829,0,0,0,0,0,0,0,0,0,0,0,0,0,1837,0,0,0,0,0,0,0,0,0,0,0,0,5627904,5652480,0,5701632,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,417792,0,0,0,0,417792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,417792,0,0,417792,0,0,417792,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60362,57917,57917,57917,57917,57917,60367,57917,57917,57917,57917,57917,57917,60669,57917,57917,57917,57917,57917,57917,60677,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60703,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,417792,418102,417792,1,24578,3,0,0,4366972,0,0,0,0,0,303,304,311296,4268032,307,308,0,434176,0,0,0,0,0,0,0,0,0,0,0,0,450560,450560,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,450560,0,0,0,0,0,0,5840896,5849088,0,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,4399805,0,0,0,0,0,0,0,1829,0,0,0,0,0,0,0,0,0,0,0,1836,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3692,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,846,529,529,529,529,529,529,529,529,529,529,529,892,529,529,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,916,915,915,915,915,915,4858771,4875155,915,915,915,915,915,915,915,915,915,915,6300563,915,915,915,915,915,915,915,915,915,915,915,0,0,991,991,991,4826079,991,991,991,991,915,5751699,915,915,915,915,915,5874579,915,915,915,915,915,915,915,915,915,915,915,6275987,915,915,915,915,915,915,915,915,915,0,0,992,991,5465055,991,5481439,5563359,991,991,991,5637087,991,5686239,991,991,5751775,991,991,991,991,991,5874655,991,991,991,991,991,991,991,991,991,991,991,6276063,4358144,4358144,6463488,0,0,0,0,915,915,915,915,915,915,915,915,915,915,915,4932499,4940691,915,915,915,915,915,915,5055379,915,915,915,915,915,915,915,915,915,915,6325139,991,991,5006303,991,991,991,5120991,5137375,991,991,991,991,991,991,991,991,991,991,6325215,4359059,4359059,5817235,915,5858195,915,915,915,915,915,915,915,915,915,915,915,915,915,6120339,915,6169491,915,915,915,915,915,6243219,915,6292371,915,6316947,915,915,915,915,5890963,915,915,915,6030227,915,915,915,915,6161299,915,915,915,915,915,915,915,6407059,991,991,991,991,991,991,991,991,4998111,991,6317023,991,991,991,991,991,991,991,991,991,6464479,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4932499,4940691,4359059,4359059,4359059,4359059,4359059,4359059,5055379,4359059,4359059,4359059,4359059,4359059,4359059,5890963,4359059,4359059,4359059,6030227,4359059,4359059,4359059,4359059,6161299,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6407059,4358144,4358144,4358144,915,915,915,4890624,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60361,57917,57917,60364,60365,57917,57917,57917,57917,57917,60370,4359059,4359059,4359059,5792659,5817235,4359059,5858195,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6120339,4359059,6169491,4359059,4359059,4359059,4359059,4359059,6243219,4359059,6292371,4359059,4359059,4359059,4916115,4359059,4957075,4973459,4359059,4359059,4359059,4359059,4359059,4359059,5071763,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5219219,4359059,5268371,4359059,4359059,5309331,5317523,4359059,4359059,4359059,5432211,6316947,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6464403,4358144,4358144,4358144,4358144,4358144,915,915,915,915,915,0,0,0,0,0,0,0,0,4956160,4964352,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,60356,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60001,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,750,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,4358144,4358144,6389760,4358144,4358144,6430720,6438912,0,0,0,0,0,0,4785043,915,915,915,4850579,915,915,915,915,915,4916115,915,4957075,4973459,915,915,915,915,915,915,915,915,5260179,915,915,915,915,915,915,915,915,5415827,915,5448595,915,5464979,915,5481363,5563283,915,915,915,5637011,915,5686163,915,915,5071763,915,915,915,915,915,915,915,5219219,915,5268371,915,915,5309331,5317523,915,915,915,5432211,915,5489555,915,915,915,915,915,915,915,915,915,5800851,915,915,5882771,915,915,915,915,915,915,915,915,915,6103955,915,915,915,6185875,915,915,915,6284179,915,915,6333331,915,915,915,6390675,915,915,6431635,6439827,4359059,5489555,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5800851,4359059,4359059,5882771,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6103955,4359059,4359059,4359059,6185875,4359059,4359059,4359059,0,5013504,0,0,6053888,0,0,0,0,0,0,0,0,6012928,4358144,4358144,5013504,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6053888,4358144,4358144,6284179,4359059,4359059,6333331,4359059,4359059,4359059,6390675,4359059,4359059,6431635,6439827,4358144,4358144,4358144,6266880,6488064,915,915,915,6267795,6488979,0,0,0,0,0,0,0,0,0,0,0,0,540672,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,540672,0,5824512,5865472,4358144,4358144,5922816,4358144,4358144,6021120,4358144,6037504,4358144,4358144,6078464,6111232,4358144,6176768,6209536,6234112,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,915,915,4842387,915,915,915,915,6087571,4817887,991,991,991,991,6087647,4817811,4359059,4359059,4359059,4359059,6087571,0,5087232,0,5931008,4358144,5332992,5980160,4358144,915,5333907,5981075,915,991,5333983,5981151,915,4899731,915,915,915,915,915,915,915,915,915,915,915,5112723,915,915,915,915,915,5284755,915,915,915,915,5473171,5522323,915,915,915,915,5596051,5710739,5718931,915,5825427,5866387,915,915,5923731,915,915,6022035,915,6038419,915,915,6079379,6112147,915,6177683,6210451,915,6235027,915,915,915,915,915,915,915,0,0,991,991,991,991,991,6104031,991,991,991,6185951,991,991,991,6284255,991,991,6333407,991,991,991,6390751,991,991,6431711,6439903,4785043,4359059,4359059,4359059,4850579,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6300563,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4358144,4358144,4358144,4358144,4358144,915,915,915,915,915,0,0,0,0,0,0,0,4898816,0,5709824,0,0,0,5283840,0,0,0,0,5251072,0,6414336,5832704,0,5955584,0,0,4358144,4358144,4841472,4358144,4358144,4358144,4898816,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5111808,4358144,4358144,4358144,4358144,4358144,5283840,4358144,4358144,4358144,4358144,5472256,5521408,4358144,4358144,4358144,5595136,5709824,5718016,4358144,4842463,991,991,991,4899807,991,991,991,991,991,991,991,991,991,991,991,5112799,991,991,991,991,991,5284831,991,991,991,991,5473247,5522399,991,991,991,991,991,991,991,5211103,991,991,991,991,5293023,991,991,991,991,5366751,991,991,991,5456863,991,991,991,991,991,5555167,5571551,5579743,5620703,5669855,991,5596127,5710815,5719007,991,5825503,5866463,991,991,5923807,991,991,6022111,991,6038495,991,991,6079455,6112223,991,6177759,6210527,991,6235103,991,991,991,991,991,991,991,4359059,4359059,4359059,4359059,4359059,5194643,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4907008,0,5079040,6094848,5742592,0,0,0,0,0,4358144,4907008,4358144,5079040,4359059,4842387,4359059,4359059,4359059,4899731,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5112723,4359059,4359059,4359059,4359059,4359059,5284755,4359059,4359059,4359059,4359059,5473171,5522323,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5211027,4359059,4359059,4359059,4359059,5292947,4359059,4359059,4359059,4359059,5366675,4359059,4359059,4359059,5456787,4359059,4359059,4359059,4359059,4359059,5555091,5571475,5579667,5620627,5669779,4359059,4359059,5596051,5710739,5718931,4359059,5825427,5866387,4359059,4359059,5923731,4359059,4359059,6022035,4359059,6038419,4359059,4359059,6079379,6112147,4359059,6177683,6210451,4359059,6235027,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6275987,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4923392,4358144,4358144,4358144,4358144,4358144,915,4924307,915,915,915,915,4358144,4358144,4358144,4358144,6406144,915,915,915,915,915,915,915,915,4998035,915,915,5038995,915,915,915,5096339,5104531,915,915,5202835,915,915,915,915,915,915,915,915,915,915,915,915,5628819,5653395,915,5702547,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,5178259,915,915,915,915,915,5243795,915,915,915,915,915,915,915,5342099,991,5039071,991,991,991,5096415,5104607,991,991,5202911,991,991,991,991,991,991,991,991,991,991,991,5891039,991,991,991,6030303,991,991,991,991,6161375,991,991,991,5792735,5817311,991,5858271,991,991,991,991,991,991,991,991,991,991,991,991,991,6120415,991,6169567,991,991,991,991,991,6243295,991,6292447,991,991,5219295,991,5268447,991,991,5309407,5317599,991,991,991,5432287,991,5489631,991,991,991,991,991,991,991,991,991,5800927,991,991,5882847,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,5178335,991,991,991,991,991,5243871,991,991,991,991,991,991,991,5342175,991,4358144,6307840,4358144,4358144,6356992,6381568,6397952,4801427,4809619,915,915,4891539,915,4948883,915,915,915,5047187,915,915,915,915,5186451,915,5235603,5301139,915,915,5407635,5530515,915,915,915,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4358144,4358144,4358144,4358144,4358144,4358144,0,915,915,915,915,915,915,0,0,0,0,0,0,915,915,5899155,915,915,915,915,915,915,915,915,6308755,915,915,6357907,6382483,6398867,4801503,4809695,991,991,4891615,991,4948959,991,991,991,5047263,991,991,991,991,991,991,991,991,991,991,991,5628895,5653471,991,5702623,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,991,0,0,0,0,915,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5186527,991,5235679,5301215,991,991,5407711,5530591,991,991,991,991,5899231,991,991,991,991,991,991,991,991,6308831,991,991,6357983,6382559,6398943,4801427,4809619,4359059,4359059,4891539,4359059,4948883,4359059,4359059,4359059,5047187,4359059,4359059,4359059,4359059,5186451,4359059,5235603,5301139,4359059,4359059,5407635,5530515,4359059,4359059,4359059,4359059,5899155,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6308755,4359059,4359059,6357907,6382483,6398867,5021696,4358144,4358144,5022611,915,915,0,4980736,0,0,0,0,0,5373952,5734400,6045696,0,6258688,6447104,0,0,6127616,0,6348800,5906432,0,5537792,4358144,4358144,4358144,4358144,5324800,5373952,5537792,5545984,5734400,5971968,4358144,6045696,4358144,6070272,4358144,4358144,4358144,6348800,915,4866963,4883347,915,4981651,915,915,915,915,915,915,915,915,5325715,5587935,5735391,5972959,991,6046687,991,6071263,991,991,991,991,6349791,4359059,4866963,4883347,4359059,4981651,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5325715,5374867,5538707,5546899,5587859,5735315,5972883,915,6046611,915,6071187,915,915,915,915,6349715,991,4867039,4883423,991,4981727,991,991,991,991,991,991,991,991,5325791,5374943,5538783,5546975,4359059,6046611,4359059,6071187,4359059,4359059,4359059,4359059,6349715,4358144,6144e3,915,6144915,0,4988928,5005312,0,0,0,0,5775360,0,0,0,3681,0,0,0,0,0,0,5693440,0,6496256,5144576,5136384,0,5914624,4358144,4358144,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,915,915,5006227,915,915,915,5120915,5137299,5006227,4359059,4359059,4359059,5120915,5137299,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6325139,5914624,5915539,0,0,0,0,0,5513216,5783552,0,3681,0,0,0,0,3837,0,0,0,0,0,3842,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,3849,529,529,529,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,915,990,991,991,991,991,915,915,5014419,915,915,915,915,915,915,915,915,915,6054803,915,915,915,991,991,5014495,991,991,991,991,991,991,991,991,991,6054879,991,991,991,991,991,991,6407135,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4998035,4359059,4359059,5038995,4359059,4359059,4359059,5096339,5104531,4359059,4359059,5202835,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5415827,4359059,5448595,4359059,5464979,4359059,5481363,5563283,4359059,4359059,4359059,5637011,4359059,5686163,4359059,4359059,5751699,4359059,4359059,4359059,4359059,4359059,5874579,4359059,4359059,4359059,5014419,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,6054803,4359059,4359059,4359059,0,0,0,0,5193728,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4931584,4939776,4358144,4358144,4358144,4358144,4358144,4358144,5054464,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5193728,4358144,4358144,4358144,4358144,4358144,4358144,4358144,915,915,915,915,915,5194643,915,915,915,915,915,915,915,915,991,991,991,991,991,5194719,991,991,991,991,991,991,991,991,991,6300639,991,991,991,991,991,991,991,991,991,991,991,5809043,4359059,4359059,4359059,4826003,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5628819,5653395,4359059,5702547,4359059,4359059,5809043,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5178259,4359059,4359059,4359059,4359059,4359059,5243795,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5342099,4359059,4359059,4359059,4358144,5226496,4358144,5742592,4358144,4358144,4358144,6094848,915,4907923,915,5079955,915,5227411,915,5743507,915,915,915,6095763,915,991,4907999,991,5080031,991,5227487,991,5743583,991,991,991,991,991,4858847,4875231,991,991,991,991,991,991,991,991,991,991,991,991,991,5260255,991,991,991,991,991,991,991,991,5415903,991,5448671,6095839,991,4359059,4907923,4359059,5079955,4359059,5227411,4359059,5743507,4359059,4359059,4359059,6095763,4359059,5062656,0,0,0,0,0,4358144,5062656,4358144,4358144,4358144,4358144,4358144,915,5063571,915,915,915,5211027,915,915,915,915,5292947,915,915,915,915,5366675,915,915,915,5456787,915,915,915,915,915,5555091,5571475,5579667,5620627,5669779,915,915,915,5792659,915,915,915,6226835,991,5063647,991,991,991,991,991,6226911,4359059,5063571,4359059,4359059,4359059,4359059,4359059,6226835,0,6086656,0,0,0,4816896,4358144,4358144,4358144,4358144,6086656,4817811,6005651,6005727,6005651,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3465,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,450560,0,0,0,0,0,0,450560,0,0,450560,0,450560,450560,450560,450560,0,0,0,0,131072,0,0,0,0,0,0,450560,0,0,0,0,0,450560,0,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,450560,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,771,0,0,0,0,0,0,0,0,0,0,0,0,450560,450560,450560,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4399805,311296,4399805,0,0,0,311296,0,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6299648,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,304,0,0,308,0,0,0,308,0,0,0,4931584,0,0,0,0,0,0,0,0,0,0,0,0,5210112,0,5365760,0,5554176,0,0,6316032,0,196608,0,0,5816320,6291456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2359296,368,0,0,0,0,6316032,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6463488,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,304,0,0,308,0,0,0,4956160,4964352,0,0,0,0,0,0,57917,57917,60352,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60360,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,60027,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60751,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,4358144,4358144,6389760,4358144,4358144,6430720,6438912,916,0,0,0,916,0,4784128,0,0,0,4849664,0,0,0,0,0,4915200,0,4956160,4972544,0,0,0,0,0,0,0,0,0,666,0,645,0,0,0,0,0,0,796,0,0,0,0,0,0,0,0,0,0,805,0,810,5824512,5865472,4358144,4358144,5922816,4358144,4358144,6021120,4358144,6037504,4358144,4358144,6078464,6111232,4358144,6176768,6209536,6234112,4358144,4358144,4358144,4358144,4358144,4358144,4358144,916,0,0,0,4841472,0,0,0,0,0,0,0,5210112,0,0,0,0,5292032,0,0,0,0,5365760,0,0,0,5455872,0,0,0,0,0,5554176,5570560,5578752,5619712,5668864,0,0,0,5791744,5718016,0,5824512,5865472,0,0,5922816,0,0,6021120,0,6037504,0,0,6078464,6111232,0,6176768,6209536,0,6234112,0,0,0,0,0,0,0,992,0,0,0,992,0,4784128,0,0,0,4849664,0,0,0,0,0,4915200,0,4956160,4972544,0,0,0,0,0,0,5070848,0,0,0,0,0,0,0,5218304,0,5267456,0,0,5308416,5316608,0,0,0,5431296,0,5488640,0,0,0,0,0,0,0,0,0,5799936,0,0,5881856,0,0,0,0,0,0,0,0,459183,0,0,0,0,0,0,0,0,0,0,0,0,0,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,459224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1066,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459348,459224,459380,459224,459224,459380,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5767168,0,0,0,0,4857856,0,0,0,0,0,0,0,0,0,0,0,1,24578,3,0,0,0,0,507904,0,0,0,507904,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,507904,0,0,0,0,0,0,57917,60351,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60688,57917,57917,57917,57917,57917,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,507904,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1321,0,0,0,0,0,0,0,0,0,0,0,0,507904,507904,507904,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,442368,0,0,0,0,0,0,0,0,0,0,0,726,0,0,0,0,0,0,0,0,0,0,0,738,0,0,0,0,0,0,0,0,1,24578,3,0,0,0,0,0,516096,0,0,0,516096,0,0,0,0,0,0,516096,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1201,0,0,1204,1205,0,0,0,0,1209,0,0,0,368,368,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,516569,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2306,2307,0,0,0,0,0,0,0,0,0,0,0,516569,516569,516569,1,24578,0,0,0,4366336,0,0,548864,0,0,303,304,0,4268032,307,308,409600,0,0,0,0,0,0,0,0,0,0,0,0,1199,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,5914624,5914624,0,0,0,0,0,5513216,5783552,0,40960,0,0,0,0,0,0,0,0,0,6299648,0,0,0,0,0,0,0,0,0,0,0,5808128,4358144,4358144,4358144,4825088,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,483328,0,0,0,0,0,0,0,0,0,0,0,0,0,0,335,0,0,0,0,0,0,0,0,335,0,0,139264,147456,0,0,0,0,1,24578,4227366,0,0,0,0,0,0,300,0,0,0,300,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1208,0,1210,0,0,368,368,0,0,0,0,0,0,540672,0,0,540672,0,0,0,540672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2310144,0,368,0,0,0,0,0,0,0,1,24578,4227366,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1294,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,363,0,0,0,0,0,0,368,0,297,0,0,0,0,0,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1806,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1866,0,0,0,0,0,0,0,0,0,0,1,24578,3,155943,297,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2829,0,0,0,57894,57917,57894,57894,57894,57894,57894,57894,57894,57917,57917,57894,57894,57944,57894,57894,57894,57894,57894,57894,57894,57944,57944,57894,57894,57894,57894,57944,57944,57894,529,57894,57894,57894,57894,57894,57894,60623,57894,57894,60627,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60636,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,61317,57917,57917,61319,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,61333,1153,1727,0,0,0,0,1734,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3172,0,0,0,0,2295,0,0,0,0,2297,0,2298,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2827,0,0,0,0,0,0,0,0,0,0,2835,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,0,0,0,0,3005,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58948,57917,57917,57917,0,0,0,0,1829,0,0,0,0,0,0,0,2374,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,483328,0,0,0,0,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,445,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,0,0,0,1283,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,339,0,0,0,57895,57918,57895,57895,57895,57895,57895,57895,57895,57918,57918,57895,57895,57945,57895,57895,57895,57895,57895,57895,57895,57945,57945,57895,57895,57895,57895,57945,57945,57895,529,57895,57895,57895,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2326,2327,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2846,0,0,0,0,0,0,0,0,0,0,0,1,24578,3,155944,297,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3464,0,0,0,1,24578,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,573440,0,573440,573440,573440,0,573440,573440,573440,573440,573440,573440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2328,0,0,0,0,0,0,0,0,0,2337,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,573440,573440,573440,0,0,0,0,0,0,0,0,0,0,0,0,1260,0,0,0,0,1265,0,0,0,0,0,0,0,0,0,0,0,1277,0,0,0,0,0,0,0,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,573440,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2351,0,0,0,0,2355,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2406,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2330,0,0,0,0,0,0,0,0,0,0,0,6356992,3681,0,0,0,0,0,0,0,5496832,0,0,0,0,0,5611520,0,0,0,0,0,4947968,5021696,5529600,0,0,5169152,0,0,0,4800512,0,0,0,1,24578,3,0,0,4366336,0,0,0,0,0,638,304,0,4268032,641,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2816,0,0,2819,0,0,0,0,0,0,2825,0,0,0,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,581632,0,0,0,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,581632,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,581632,581632,581632,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2868,0,0,0,0,0,0,0,0,529,529,529,529,529,529,2880,529,529,3833,4882432,0,0,0,0,0,0,0,0,5939200,0,0,5677056,6365184,4866048,0,6070272,5545984,5152768,0,0,6144e3,4358144,4866048,4882432,4358144,4980736,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,499712,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1774,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1324,0,0,0,0,0,0,0,0,0,0,4358144,6045696,4358144,6070272,4358144,4358144,4358144,4358144,6348800,4358144,6144e3,0,6144e3,0,4988928,5005312,0,0,0,0,5775360,0,0,0,3932,0,0,0,0,0,0,5693440,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,5914624,5914624,0,0,0,0,0,5513216,5783552,0,3932,0,0,0,0,0,0,0,0,351,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,297,0,0,0,312,313,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3679,0,0,0,0,0,0,0,313,0,0,0,0,0,312,0,312,313,0,312,312,313,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1295,0,1175,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1888,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,0,0,0,0,131072,0,433,0,0,0,0,0,0,0,0,312,0,460,474,474,474,487,487,487,487,487,487,487,487,487,507,487,487,487,487,487,487,525,487,487,487,525,487,487,487,487,487,487,530,57896,530,57896,530,530,57896,530,530,57919,57896,530,530,57896,57896,57896,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,646,0,0,649,650,0,0,0,0,0,0,317,318,319,320,321,322,323,324,325,326,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1206,1207,0,0,0,0,0,368,368,0,0,0,57896,57919,57896,57896,57896,57896,57896,57896,57896,57919,57919,57896,57896,57946,57896,57896,57896,57896,57896,57896,57896,57946,57946,57896,57896,57896,57896,57946,57946,57896,530,57896,0,747,0,0,0,0,0,752,0,0,0,0,646,0,0,0,0,0,0,763,0,0,0,0,0,0,0,0,772,0,0,0,0,0,0,0,2346,0,0,0,0,0,2350,0,0,2352,0,0,0,0,2357,0,0,0,0,2362,0,0,0,0,0,0,0,0,0,1854,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1328,0,1330,0,0,1169,0,0,778,0,0,782,0,0,0,0,0,0,0,0,791,0,0,0,0,795,0,0,0,0,0,0,0,799,0,0,0,0,0,0,0,0,0,694,0,0,0,0,0,368,368,368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,540672,0,0,0,0,0,0,0,540672,0,0,0,0,0,0,0,0,835,795,0,0,0,0,0,839,840,0,0,0,0,795,529,529,849,853,529,529,865,529,529,529,881,529,886,529,894,529,529,529,0,2507,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59899,57894,57894,57894,57894,57894,57894,897,529,529,911,529,57894,57894,57894,58268,58272,57894,57894,58284,57894,57894,57894,58300,57894,58305,57894,58313,57894,58316,57894,57894,58330,57894,0,57917,57917,57917,58344,58348,57917,57917,58360,57917,57917,57917,58376,57917,58381,57917,58389,57917,58392,57917,57917,58406,57917,0,0,0,0,58305,57944,57944,57944,58419,58423,57944,57944,58435,57944,57944,57944,57944,57944,57944,57944,57944,60079,57944,57944,57944,57944,57944,60085,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,4153,0,0,0,529,529,529,529,529,57944,57944,58451,57944,58456,57944,58464,57944,58467,57944,57944,58481,57944,849,853,1143,897,529,529,0,58272,58268,58493,58316,57894,57894,155943,1153,0,0,1156,0,0,0,0,0,0,196608,0,0,0,106496,0,0,4284416,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5341184,0,5652480,0,1161,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,278528,0,0,0,0,1219,0,0,0,0,1224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1785,1786,1787,0,0,0,0,1247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,644,0,1281,0,0,0,0,0,0,0,0,0,0,1292,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1304,0,0,0,0,0,0,0,0,399,0,0,0,0,0,0,0,0,352,0,0,0,399,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,0,0,529,529,529,529,529,1414,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59889,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59389,57894,57894,57894,57894,57894,59396,57894,57894,57894,57894,57894,57894,57894,57894,59405,57894,1153,1727,0,0,0,0,1734,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1754,0,0,0,0,0,0,0,0,0,0,1197,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,1875,0,0,0,0,0,0,0,0,0,0,0,0,1887,0,0,0,1889,0,0,1890,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,529,529,529,529,529,1903,529,529,529,529,529,529,529,529,529,1916,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2489,529,529,529,2492,529,529,529,529,529,2497,529,529,529,529,57894,57894,57894,57894,59346,57894,57894,57894,57894,57894,57894,57894,57894,57894,59359,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,61104,57917,57917,57917,61107,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59446,57917,57917,57917,57917,57917,57917,57917,57917,57917,59459,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59542,57944,57944,57944,57944,57944,57944,57944,57944,57944,59555,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57944,57944,57944,57944,57944,57944,59614,57944,57944,57944,57944,57944,57944,59620,57944,57944,57944,57944,57944,57944,529,2285,529,529,529,57894,59634,57894,57894,57894,2294,0,0,0,0,0,0,245760,245760,245760,245760,245760,245760,0,0,0,0,0,0,0,245760,245760,245760,0,0,0,0,139264,147456,245760,245760,0,0,0,131072,0,0,0,0,245760,0,0,0,0,0,0,245760,0,245760,0,245760,0,0,0,0,0,0,0,0,0,0,0,0,697,698,0,368,368,368,0,0,0,0,0,0,0,0,0,710,0,0,0,0,2295,0,0,0,0,2297,0,2298,0,0,0,0,0,0,0,0,0,2304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,270336,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,2404,529,529,529,529,529,529,529,529,529,529,529,2434,529,529,2437,529,529,529,529,529,529,2445,529,529,529,529,529,529,529,529,529,529,529,3712,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3265,529,529,529,529,0,0,57894,57894,57894,57894,57894,529,529,529,529,529,529,2480,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2500,529,529,529,529,529,529,529,529,3257,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2938,0,57894,57894,57894,57894,57894,57894,57894,57894,59418,57894,57894,57894,57894,57894,57894,59424,57894,57894,57894,57894,57894,57894,50679,2089,57917,57917,57917,57917,57917,59440,57917,57917,57894,57894,59933,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59954,57917,57917,59957,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,60961,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60991,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,57917,59965,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59985,57917,57917,57917,57917,57917,57917,57917,57917,58965,0,58966,58967,57944,57944,57944,57944,57944,58974,57944,57944,57944,57944,58980,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,3931,3681,0,0,0,0,0,0,0,57944,60048,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60068,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59049,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,60879,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60892,57894,57894,57944,57944,57944,57944,57944,57944,60105,57944,57944,57944,57944,2765,529,529,529,529,60114,57894,57894,57894,57894,2775,2295,0,2776,2298,0,0,2778,0,0,0,0,0,0,0,2401,0,0,0,0,0,0,0,0,0,0,0,0,2411,0,0,0,0,0,0,0,0,0,0,0,0,2300,0,0,0,0,0,0,0,0,0,0,2310,0,0,0,0,0,0,0,0,529,2935,529,529,529,529,529,0,2938,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,60291,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60307,57894,57894,57894,57894,57894,57894,57894,60312,57894,57894,57894,57894,57894,57894,57894,60318,57894,57894,57894,57894,57894,57894,57894,60299,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,992,0,3005,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,60358,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60366,57917,57917,57917,57917,57917,57917,57917,58881,57917,57917,57917,58885,57917,57917,58896,57917,57917,58900,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60934,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60702,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57917,57917,57917,57917,60402,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60413,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,529,529,529,529,57944,57944,60423,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60431,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,0,0,57944,57944,57944,57944,57944,57944,60478,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,303,307,0,0,0,0,3147,0,0,0,0,0,0,0,2787,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3198,0,0,0,0,3203,3151,0,0,0,0,0,0,3156,0,0,0,0,0,0,0,0,0,0,0,0,0,3166,0,0,0,0,0,0,0,0,0,0,0,303,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,532480,0,0,0,0,0,0,0,0,0,3179,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3195,0,0,0,0,0,0,0,0,0,0,0,756,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,2877,2878,529,529,529,529,0,0,0,0,3208,3209,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3221,0,529,529,529,529,529,529,529,0,2938,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60655,57894,57894,57894,57894,57894,57894,57894,57894,0,0,57917,57917,529,529,529,529,529,3232,529,529,3236,529,529,529,529,529,529,529,529,529,529,3245,529,529,529,529,529,529,529,529,529,529,529,3252,57894,60644,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,3005,0,57917,57917,57917,57917,57917,58370,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,58412,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60057,57944,57944,57944,57944,57944,57944,60062,57944,60064,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,2766,529,529,529,57894,60115,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,2404,2405,0,0,2407,0,0,0,0,2412,0,0,0,0,0,0,0,0,0,0,57917,57917,57917,57917,60693,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,60418,57944,60419,57944,57944,57944,57944,57944,57944,60742,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61158,57944,57944,529,3418,529,57894,60765,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3436,0,0,0,0,0,0,0,0,0,0,0,3185,0,0,0,0,0,0,0,0,0,0,0,0,3197,0,0,0,0,0,0,0,529,529,529,529,529,529,529,3501,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3518,529,3520,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60319,57894,57894,57894,57894,4014,0,4016,0,529,4019,529,4021,529,529,529,529,529,529,529,529,529,529,529,57894,61378,57894,61380,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60334,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59431,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57894,57894,57894,57917,61394,57917,61396,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,61410,57944,61412,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,57894,57894,57894,57894,61452,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,61466,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60408,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60038,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61480,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,4154,0,4156,529,529,529,529,529,529,529,529,529,529,1909,529,529,529,529,529,529,529,529,529,1920,529,529,529,529,529,529,529,529,529,529,529,529,529,1425,529,529,529,529,58776,916,57894,57894,58781,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,0,314,315,316,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,0,245760,245760,0,0,0,429,131072,0,0,429,0,0,0,0,0,0,0,0,429,461,0,0,0,461,461,461,461,461,461,461,461,461,461,461,524,461,524,524,524,461,524,524,524,524,524,524,531,57897,531,57897,531,531,57897,531,531,57920,57897,531,531,57897,57897,57897,57920,57897,57897,57897,57897,57897,57897,57897,57920,57920,57897,57897,57947,57897,57897,57897,57897,57897,57897,57897,57947,57947,57897,57897,57897,57897,57947,57947,57897,622,57897,57974,57974,57974,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,417792,0,0,0,0,417792,0,0,0,0,0,0,311,0,311,0,0,0,57944,57944,57944,57944,57944,58460,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,303,0,0,0,0,0,0,645,0,0,0,805,0,810,0,796,0,822,0,0,0,0,0,0,0,0,0,645,0,0,0,0,0,0,0,0,0,2371,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3677,0,0,0,0,0,0,1846,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1846,0,0,0,0,0,0,0,0,0,0,0,3213,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,1349,529,529,529,1358,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1969,529,529,529,529,529,529,1976,529,529,529,529,529,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58938,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57894,57894,57894,59412,57894,57894,57894,57894,57894,57894,59420,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,1269,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59563,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,57917,59512,57917,57917,57917,57917,57917,57917,59520,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,1157,0,57944,57944,59608,57944,57944,57944,57944,57944,57944,59616,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,2294,0,0,0,0,0,0,417792,0,417792,0,0,0,0,311,0,0,0,0,0,417792,0,417792,0,0,0,0,139264,147456,417792,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,311,0,417792,417792,0,0,417792,417792,417792,417792,417792,417792,417792,417792,417792,417792,417792,418103,417792,417792,418102,418103,417792,417792,418102,417792,418102,417792,0,0,0,0,0,0,0,0,417792,0,0,0,417792,0,0,2805,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1188,0,0,0,2860,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,2879,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59866,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59355,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59430,57894,50679,2090,57917,57917,57917,57917,57917,57917,57917,57917,529,2883,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2473,529,529,529,529,2936,529,529,529,0,2938,0,0,0,0,57894,57894,57894,57894,57894,57894,60288,57894,57894,57894,57894,60292,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59955,57917,57917,57917,57917,57917,57917,57917,57917,57917,60377,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61132,57917,57917,57917,57944,57944,57944,57944,57944,0,3005,0,0,0,0,57917,57917,57917,57917,57917,57917,60355,57917,57917,57917,57917,60359,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58403,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60424,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60071,57944,57944,0,321,321,430,131072,432,434,430,439,432,439,0,317,456,456,456,457,462,475,475,475,488,488,488,488,488,488,488,488,488,488,509,509,522,522,523,523,509,523,523,523,509,523,523,523,523,523,523,532,57898,532,57898,532,532,57898,532,532,57921,57898,532,532,57898,57898,57921,57898,57898,57898,57898,57898,57898,57898,57921,57921,57898,57898,57948,57898,57898,57898,57898,57898,57898,57898,57948,57948,57898,57898,57898,57898,57948,57948,57898,623,57973,57973,57973,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4931584,0,0,0,0,0,0,0,0,0,0,0,0,5210112,0,5365760,0,5554176,0,686,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,702,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2303,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,329,330,331,332,0,0,0,0,0,0,0,0,0,0,898,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58317,57894,57894,57894,57894,0,57917,57917,57917,57917,57917,57917,57917,58924,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58951,57917,0,1217,1176,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1243,0,0,0,0,0,0,0,2810,0,0,0,0,0,2815,0,2817,2818,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,499712,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,1284,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1298,0,0,0,0,0,0,0,0,0,0,0,0,1858,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4358144,4359060,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,1310,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1327,0,0,0,0,0,0,0,0,0,0,1257,0,0,0,0,0,0,0,0,0,0,0,0,0,1272,0,1274,0,0,0,0,0,57894,57894,58798,57894,58803,57894,57894,58807,57894,57894,58810,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59897,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,58875,57917,57917,58879,57917,57917,57917,57917,57917,57917,57917,57917,58893,57917,58898,57917,57917,58902,57917,57917,58905,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60438,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58999,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59603,57944,1153,1727,0,0,0,0,1734,0,0,0,0,0,0,0,1744,1745,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1211,0,0,0,0,0,0,0,0,0,1308,0,529,529,529,1933,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1956,1957,529,529,529,529,529,529,529,529,529,529,2916,529,529,529,529,529,529,2923,529,529,529,529,529,529,529,529,529,529,2931,529,529,529,57894,57894,59376,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59399,59400,57894,57894,57894,57894,57894,57894,57894,0,2595,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58941,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59476,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59499,59500,57917,57917,57917,57917,57917,57917,57917,57917,57917,60672,57917,57917,60676,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60685,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,58969,57944,57944,58973,57944,57944,57944,57944,57944,57944,57944,57944,58987,57944,58992,57944,57944,58996,57944,57944,57944,57944,59545,57944,57944,57944,57944,57944,57944,57944,57944,57944,59557,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59572,57894,59905,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59918,57894,57894,57894,57894,57894,59922,59923,59924,57894,57894,57894,57894,57894,57894,57894,57894,57894,59352,57894,57894,57894,57894,57894,57894,57894,57894,57894,59363,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59914,57894,57894,57894,57894,57894,57894,57894,59920,57894,57894,57894,57894,57894,57894,57894,59926,57894,57894,57894,57894,57944,57944,57944,57944,57944,60077,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60090,57944,57944,57944,57944,57944,60094,60095,60096,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60454,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59627,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,2780,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2339,60398,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61256,57944,57944,57944,57944,57944,57944,57944,0,0,0,3180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,743,0,0,0,529,529,3419,57894,57894,60766,0,0,0,0,0,3428,0,0,0,0,0,0,0,3432,0,0,0,0,0,0,0,0,0,0,0,0,0,663,0,0,529,529,529,529,529,860,529,529,876,529,529,529,529,529,529,529,3497,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3512,3513,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3241,529,529,3244,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1914,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,58780,57894,57894,58784,57894,57894,57894,57894,57894,57894,57894,60896,57894,60898,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61112,57917,57917,60923,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60938,57917,60940,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60932,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59495,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,60980,57944,60982,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3832,0,529,529,3729,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59401,57894,57894,59404,57894,57894,61160,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3442,0,0,57894,61450,57894,61451,57894,57894,57894,61455,57894,57894,57894,57894,57894,57894,57894,57894,57917,61464,57917,61465,57917,57917,57917,61469,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60696,57917,57917,57917,60699,57917,60701,57917,57917,57917,57917,57917,57917,57917,57917,60706,57917,57917,57917,57917,57917,57944,57944,61478,57944,61479,57944,57944,57944,61483,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,2430,529,529,529,529,529,529,529,529,529,529,529,2442,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,4294,0,0,0,529,529,529,4297,57894,57894,57894,61643,57917,57917,57917,57917,57917,57917,59482,57917,57917,57917,59487,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60704,57917,57917,57917,57917,57917,57917,57917,57917,57944,61645,57944,57944,57944,61647,0,0,529,529,57894,57894,57917,57917,57944,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,529,529,529,529,529,529,529,3503,529,529,529,529,529,529,529,529,3511,529,529,529,529,529,529,529,529,529,529,529,529,529,3523,0,0,0,377,131072,0,435,377,0,0,0,446,452,0,0,0,377,463,476,476,476,489,489,489,489,489,489,489,489,489,489,510,510,510,510,510,510,510,510,510,510,510,510,510,510,510,510,510,533,57899,533,57899,533,533,57899,533,533,57922,57899,533,533,57899,57899,57899,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,666,0,0,669,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1233,1234,0,0,0,0,0,0,0,0,0,0,0,0,57899,57922,57899,57899,57899,57899,57899,57899,57899,57922,57922,57899,57899,57949,57899,57899,57899,57899,57899,57899,57899,57949,57949,57899,57899,57899,57899,57949,57949,57899,533,57899,58444,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1759,1760,0,1190,0,1192,1193,0,0,0,1195,1196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,2837,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2849,0,0,0,0,0,0,0,0,0,0,342,0,0,0,0,0,0,0,0,0,0,0,0,0,389,0,139264,147456,0,0,0,0,1334,1195,0,0,0,0,0,0,0,0,529,529,1343,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1369,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59865,57894,57894,59868,57894,57894,57894,57894,57894,57894,59876,57894,57894,57894,57894,58834,57894,57894,57894,57894,58839,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58864,57894,57894,57894,57894,50679,58776,992,57917,57917,58876,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58903,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60933,57917,60935,57917,57917,57917,57917,57917,57917,57917,60942,57917,57917,60944,57917,57917,57917,57917,57917,57917,57917,57917,58918,57917,57917,57917,57917,57917,57917,57917,58927,57917,57917,58929,57917,57917,57917,57917,58934,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58887,57917,57917,57917,57917,57917,57917,57917,57917,57917,58906,57917,57917,57917,57917,57917,57917,57917,57917,57917,529,529,529,1967,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59953,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61122,57917,57917,57917,57917,57917,57917,57917,57917,61130,57917,57917,57917,57917,57917,57917,57944,57944,57944,61135,57944,57894,57894,59410,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61121,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,60033,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60045,57944,57917,59510,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,1158,0,59606,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,2288,57894,57894,57894,57894,59637,2294,0,0,0,0,0,0,2342912,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,0,1155,0,2295,0,0,0,0,2297,0,2298,0,0,0,0,0,2301,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1814,0,0,0,0,0,0,0,0,0,529,529,2452,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2932,529,529,57894,57894,57894,57894,57894,59883,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60320,57894,57894,57894,59931,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,59952,57917,57917,57917,57917,59956,57917,57917,57917,57917,57917,57917,57917,57917,59452,57917,57917,57917,57917,57917,57917,57917,57917,57917,59463,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59474,57917,57917,60018,57917,60020,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,60035,57944,57944,57944,57944,60039,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59584,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59562,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59571,57944,57944,57944,60101,57944,60103,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,2775,2295,0,2776,2298,0,0,0,0,0,0,0,0,0,0,2865,0,0,0,0,0,0,0,0,0,2873,0,0,529,529,529,529,529,529,529,529,529,529,529,529,3261,529,529,529,529,529,529,529,529,529,529,529,529,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,60328,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,3005,0,57917,57917,0,3005,0,0,0,0,57917,57917,57917,60353,57917,60354,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58935,57917,57917,57917,57917,57917,57917,57917,58949,57917,57917,57917,3177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2393,529,529,3253,529,529,529,529,529,529,529,3259,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2938,0,57894,57894,57894,57894,57894,57894,57894,57894,58840,57894,57894,57894,57894,57894,57894,57894,58854,57894,57894,57894,57894,57894,57894,57894,57894,58866,58867,57894,57894,50679,58776,992,57894,57894,57894,57894,60645,57894,57894,57894,57894,57894,57894,57894,60651,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,3005,0,57917,57917,57917,57917,57917,58373,58375,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,58417,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61487,57944,57944,61489,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,4023,529,529,529,4027,529,529,529,529,529,57894,57894,57894,57894,57894,61382,57894,57894,57894,61386,57894,57894,57894,529,529,529,3730,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60640,57894,57894,57894,57894,57894,57944,61161,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3441,0,0,0,57944,57944,57944,57944,57944,57944,61264,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,1353,529,529,529,529,529,529,529,529,529,1372,57894,57894,57894,57917,57917,57917,57917,57917,57917,61399,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,61415,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59618,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,332,0,0,0,0,0,0,0,0,376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,332,0,139264,147456,0,0,0,0,0,0,0,0,693,0,0,0,0,0,0,368,368,368,0,0,0,0,0,706,0,0,0,0,0,0,0,0,0,0,311,311,311,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,212992,0,0,0,0,0,212992,212992,212992,0,0,0,0,131072,0,329,0,0,0,0,0,0,0,331,0,0,464,477,477,477,490,490,490,500,490,500,503,490,490,490,511,511,511,511,511,511,526,511,511,511,526,511,511,511,511,511,511,534,57900,534,57900,534,534,57900,534,534,57923,57900,534,534,57900,57900,57900,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,728,0,0,0,0,0,0,0,0,0,0,740,0,645,740,0,744,745,645,57900,57923,57900,57900,57900,57900,57900,57900,57900,57923,57923,57900,57900,57950,57900,57900,57900,57900,57900,57900,57900,57950,57950,57900,57900,57900,57900,57950,57950,57900,534,57900,685,0,0,0,689,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,0,0,0,707,708,0,0,0,0,0,714,0,0,0,718,0,720,0,0,0,0,0,0,727,0,729,730,0,0,733,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,328,328,377,0,0,0,0,0,0,0,0,0,0,0,0,779,780,0,0,0,0,0,0,0,0,0,790,0,792,0,0,0,730,0,0,0,0,0,0,0,0,0,0,804,0,809,0,812,0,0,0,0,0,0,792,0,804,0,818,0,730,0,0,812,824,0,0,826,0,0,824,824,0,0,0,792,0,0,0,0,0,0,751,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,769,730,0,0,773,0,0,0,0,0,0,659,660,0,0,0,0,0,0,0,0,0,0,671,672,0,0,0,0,0,0,0,0,0,0,0,684,0,0,0,836,0,0,0,0,0,0,0,790,0,0,0,836,529,529,850,529,856,529,529,871,529,529,882,529,887,529,529,896,899,904,529,912,529,57894,57894,57894,58269,57894,58275,57894,57894,58290,57894,57894,58301,57894,58306,57894,57894,58315,58318,58323,57894,58331,57894,0,57917,57917,57917,58345,57917,58351,57917,57917,58366,57917,57917,58377,57917,58382,57917,57917,58391,58394,58399,57917,58407,57917,0,0,0,0,58306,57944,57944,57944,58420,57944,58426,57944,57944,58441,57944,57944,58452,57944,58457,57944,57944,58466,58469,58474,57944,58482,57944,850,529,529,1144,904,529,0,57894,58269,57894,58494,58323,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1753,0,0,0,0,0,0,0,0,0,0,0,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,360448,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1251,0,0,1201,0,0,0,0,0,751,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1838,0,0,0,0,0,0,0,0,0,0,0,1282,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3702,0,529,57894,57894,57894,57894,57894,58804,57894,57894,57894,58809,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58826,57894,57894,57894,57894,57894,57894,57894,0,2596,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60415,57917,57917,57944,57944,57944,57944,57944,57944,57944,58952,57917,57917,57917,57917,57917,57917,58963,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58978,57944,57944,57944,57944,57944,57944,58993,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4092,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1978,529,529,529,529,529,529,529,529,58776,0,57894,59337,57894,57894,57894,57894,57894,58998,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59015,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59558,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59624,57944,57944,57944,1910,529,529,529,529,59353,57894,57894,57894,57894,0,0,59031,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59047,57944,57944,57944,57944,57944,57944,59058,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60890,57894,57894,57894,57894,1153,1727,0,0,0,0,1734,0,0,0,0,1741,0,1743,0,0,0,0,0,0,0,0,0,0,0,0,1756,0,0,0,0,0,0,0,0,0,754,0,0,0,0,0,0,0,0,0,0,764,0,0,665,768,0,0,0,0,0,775,0,0,0,0,1763,0,0,1766,1767,1768,0,1770,1771,0,0,0,1775,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1791,0,0,0,0,0,1797,0,0,1800,0,1802,0,0,0,0,0,1808,1809,0,0,0,0,0,1815,0,0,0,0,1820,1821,0,0,0,0,0,0,785,0,0,0,680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2311,0,0,0,0,0,0,0,0,0,0,0,1827,0,0,1829,0,0,0,0,0,0,0,0,1833,1834,1835,0,0,0,0,0,0,1841,0,1843,0,0,0,0,0,0,0,0,753,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1240,0,0,0,0,0,0,1874,0,0,0,0,0,0,1880,1881,0,0,0,0,0,0,0,0,0,0,0,1874,0,0,0,1892,1743,1743,1894,529,1896,529,1897,1898,529,1900,529,529,529,1904,529,529,529,529,529,529,529,529,529,1917,529,529,529,529,1921,529,529,529,529,1925,529,1927,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59864,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58851,57894,57894,58855,57894,57894,57894,57894,57894,58862,57894,57894,57894,58869,57894,50679,58776,992,1963,529,1965,529,1968,529,529,529,529,529,1975,529,529,1977,529,529,529,529,529,529,529,529,529,58776,0,59336,57894,59338,57894,59339,57894,59341,57894,59343,57894,57894,57894,59347,57894,57894,57894,57894,57894,57894,57894,57894,57894,59360,57894,57894,57894,57894,59364,57894,57894,57894,57894,59368,57894,59370,57894,57894,57894,57894,57894,57894,57894,58808,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58823,57894,57894,57894,57894,57894,57894,57894,58832,57894,59408,57894,59411,57894,57894,57894,57894,57894,59419,57894,57894,59421,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,59436,57917,59438,57917,59439,57917,59441,57917,57917,57917,57917,57917,60021,57917,57917,60024,60025,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60041,57944,60043,57944,57944,57944,0,0,0,4083,0,0,0,0,0,0,0,4090,0,0,529,529,529,529,4095,529,529,529,529,529,529,529,529,529,529,529,529,529,2892,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2465,529,529,529,529,529,529,529,529,529,529,529,529,529,59443,57917,57917,57917,59447,57917,57917,57917,57917,57917,57917,57917,57917,57917,59460,57917,57917,57917,57917,59464,57917,57917,57917,57917,59468,57917,59470,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,60960,57944,57944,57944,57944,60964,57944,57944,57944,57944,57944,57944,57944,60970,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60083,57944,57944,57944,57944,60088,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59013,57944,57944,57944,59017,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59508,57917,59511,57917,57917,57917,57917,57917,59519,57917,57917,59521,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,59532,57944,59534,57944,59535,57944,59537,57944,59539,57944,57944,57944,57944,57944,57944,57944,57944,60452,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60753,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59543,57944,57944,57944,57944,57944,57944,57944,57944,57944,59556,57944,57944,57944,57944,59560,57944,57944,57944,57944,59564,57944,59566,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59585,57944,57944,57944,57944,57944,57944,59592,57944,57944,57944,57944,57944,57944,57944,57944,59601,57944,57944,57944,57944,57944,57944,59576,59577,59579,57944,57944,57944,57944,57944,57944,57944,59587,59588,57944,57944,59590,57944,57944,59593,59594,57944,57944,57944,57944,57944,57944,57944,59602,57944,59604,57944,59607,57944,57944,57944,57944,57944,59615,57944,57944,59617,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,1955,529,2287,529,57894,59398,57894,59636,57894,2294,0,0,0,0,0,0,2351104,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,0,0,0,303,0,0,2295,0,0,0,0,2297,0,2298,0,0,0,0,0,0,0,0,0,0,2305,0,0,2308,2309,0,0,0,2313,0,0,0,0,0,0,0,0,0,802,0,0,0,0,0,0,0,0,0,802,0,0,802,0,0,0,0,0,0,0,802,0,0,0,0,0,1829,0,2370,0,0,0,0,0,0,0,2376,0,0,2379,0,0,0,0,2384,0,0,0,0,0,2390,0,2392,0,0,0,0,0,0,4268032,0,0,0,0,0,0,0,758,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,307,0,0,0,0,0,0,307,0,0,0,0,0,2422,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2438,529,2440,529,529,529,529,529,529,2448,529,2450,529,529,529,2477,2478,529,529,529,529,529,529,2485,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2499,529,529,529,0,0,0,0,57894,57894,59856,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,2502,2503,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59869,57894,59871,57894,57894,57894,57894,57894,57894,57894,2593,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59879,57894,59881,57894,57894,57894,57894,57894,57894,57894,59887,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60343,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59932,57894,57894,59935,59936,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59958,57917,59960,57917,57917,57917,57917,57917,58921,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58936,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60697,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,60030,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60433,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60051,57944,60053,57944,57944,57944,57944,57944,57944,57944,60059,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,4012,4013,57944,57944,57944,57944,57944,60104,57944,57944,60107,60108,57944,2440,529,2767,529,529,59871,57894,60116,57894,57894,2775,2295,0,2776,2298,0,0,0,0,0,0,0,0,0,0,3158,0,0,0,0,0,0,0,0,3164,0,0,0,0,0,0,0,0,0,0,0,0,0,3453,0,0,0,0,0,3456,0,3458,0,0,0,0,0,0,0,0,3466,0,529,529,529,529,529,2911,529,529,529,529,2915,529,529,529,2920,529,529,529,529,529,529,529,529,2928,529,529,529,529,529,529,529,2933,57894,57894,57894,57894,57894,60302,57894,60304,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60321,57894,57894,57894,57894,57894,57894,57894,61098,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58890,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58914,57917,57917,57917,57894,57894,60325,57894,57894,57894,60330,57894,57894,57894,57894,57894,57894,57894,57894,60338,57894,57894,57894,57894,57894,57894,57894,57894,60344,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,59950,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59962,57917,0,3005,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,60357,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60369,57917,57917,57917,57917,57917,60375,57917,57917,57917,57917,60378,57917,57917,60380,57917,60381,57917,57917,57917,57917,57917,57917,57917,57917,57917,60390,57917,57917,60394,57917,57917,57917,57917,57917,58369,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,3935,0,0,0,0,60371,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60388,57917,57917,57917,57917,60392,57917,57917,57917,60397,57944,60422,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60434,57944,60436,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,3146,0,0,3149,3150,57944,57944,57944,57944,60476,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,303,307,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1177,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,802,0,0,0,60740,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60747,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,4010,0,0,0,529,529,3498,529,529,529,529,529,529,529,3504,529,529,529,529,529,3510,529,529,529,529,529,529,529,529,529,529,3519,3521,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,59861,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59873,57894,57894,57894,57894,57894,57894,57894,57894,57894,61457,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,61471,57917,57917,57917,57917,57917,57917,57917,57917,59485,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60010,57917,57917,57917,57917,60014,57917,57917,3524,529,3526,3527,529,57894,57894,57894,57894,57894,57894,60878,57894,57894,57894,57894,57894,60882,57894,57894,57894,57894,57894,57894,57894,60888,57894,57894,57894,57894,57894,60894,57894,57894,60897,57894,57894,57894,57894,57894,57894,57894,57894,60904,60906,57894,57894,57894,57894,60910,57894,60912,60913,57894,57917,57917,57917,57917,57917,57917,60920,57917,57917,57917,57917,57917,57917,60022,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60037,57944,57944,60040,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,3824,0,0,0,0,0,0,0,0,0,3829,0,0,0,0,0,0,0,0,0,0,2403,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2360,0,0,0,0,0,0,0,57917,57917,60924,57917,57917,57917,57917,57917,57917,57917,60930,57917,57917,57917,57917,57917,60936,57917,57917,60939,57917,57917,57917,57917,57917,57917,57917,57917,60946,60948,57917,57917,57917,57917,57917,58960,57917,57917,57917,0,57894,57944,58968,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58982,58989,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60745,57944,57944,57944,60748,57944,60750,57944,57944,57944,57944,57944,57944,57944,57944,60755,57944,57944,57944,57944,57944,57917,57917,60952,57917,60954,60955,57917,57944,57944,57944,57944,57944,57944,60962,57944,57944,57944,57944,57944,60966,57944,57944,57944,57944,57944,57944,57944,60972,57944,57944,57944,57944,57944,57944,57944,57944,57944,58478,57944,57944,57944,1141,529,529,529,908,529,0,57894,58492,57894,57894,58327,57894,155943,1153,0,0,0,0,0,0,0,0,816,0,0,0,0,0,0,821,0,0,821,0,0,0,0,0,821,821,0,0,0,801,0,0,57944,60978,57944,57944,60981,57944,57944,57944,57944,57944,57944,57944,57944,60988,60990,57944,57944,57944,57944,60994,57944,60996,60997,57944,529,529,3656,57894,57894,61003,0,0,0,0,0,0,788,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,788,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,2882,0,0,0,0,3665,0,0,3668,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3675,0,0,0,0,0,0,0,0,0,0,0,789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,808,0,0,0,0,789,0,808,0,529,847,529,529,529,529,529,529,878,880,529,529,529,529,529,529,0,0,0,3682,0,3684,0,0,0,0,0,0,0,3691,0,0,0,3694,3695,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,1344,529,529,529,529,529,529,529,529,1357,529,529,529,529,1367,529,529,529,529,529,529,3706,529,529,529,529,529,529,529,3711,529,529,529,529,529,529,529,529,529,529,529,529,529,3721,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60294,57894,57894,60297,529,529,529,529,529,529,529,57894,57894,57894,61077,57894,57894,57894,57894,57894,57894,57894,61082,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59422,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,59437,57917,57917,57917,57917,57917,57917,57894,61093,57894,57894,57894,57894,57894,57894,57894,57894,61101,57894,57894,57894,57894,57894,57894,57917,57917,57917,61106,57917,57917,57917,57917,57917,57917,57917,61111,57917,57917,57917,57917,57917,57917,60403,57917,57917,57917,60406,60407,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,60417,57944,57944,57944,57944,57944,57944,57944,57944,57944,60427,57944,57944,57944,57944,57944,60432,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59589,57944,57944,57944,57944,57944,57944,57944,57944,59598,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61140,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61151,57944,57944,57944,57944,57944,57944,57944,57944,61159,57944,57944,57944,57944,57944,57944,57944,57944,60479,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,303,307,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,806,0,57944,57944,57944,57944,57944,61263,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,3929,3930,0,3681,0,0,0,0,0,3938,0,0,0,0,0,0,4268032,0,0,0,0,0,0,0,475136,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,736,0,0,0,0,0,0,0,0,0,0,57894,61307,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,61323,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60965,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59012,57944,57944,57944,57944,57944,57944,57944,59021,57944,57944,59023,57944,57944,57944,57944,59029,57944,57944,57944,57944,57944,57944,57944,57944,61339,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,4009,3681,0,0,0,0,0,0,0,0,1223,0,0,0,0,0,0,0,0,1232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,538,57904,538,57904,538,538,57904,538,538,57927,57904,538,538,57904,57904,57894,61391,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61407,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,0,0,0,0,0,57944,61423,57944,0,0,0,0,0,0,4085,0,0,0,0,0,0,0,529,529,529,529,529,529,4097,529,529,529,529,529,529,529,529,529,529,529,529,3861,529,529,529,529,529,57894,57894,57894,57894,57894,57894,61212,57894,57894,57894,57894,57894,57894,57894,57944,57944,57944,57944,57944,57944,61482,57944,57944,57944,57944,57944,57944,57944,57944,57944,4147,4148,0,0,0,4151,0,0,0,0,0,4157,4158,4159,529,529,529,0,0,0,0,57894,59855,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,60919,57917,57917,57917,57917,529,4162,529,4164,529,529,529,529,61513,61514,61515,57894,57894,57894,61518,57894,61520,57894,57894,57894,57894,61525,61526,61527,61528,57917,57917,57917,61531,57917,61533,57917,57917,57917,57917,57917,61118,57917,57917,57917,57917,57917,57917,57917,57917,61124,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60974,57944,57944,57917,57917,57917,61538,61539,61540,61541,57944,57944,57944,61544,57944,61546,57944,57944,57944,57944,61551,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,1907,1908,529,529,529,529,1915,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1930,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,4246,0,0,0,529,529,4251,529,529,529,4255,57894,57894,61601,57894,57894,57894,57894,57894,57894,60624,57894,60626,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,60921,57917,57917,57894,57894,61605,57894,57917,57917,61607,57917,57917,57917,61611,57917,57944,57944,61613,57944,57944,57944,61617,57944,0,0,0,0,0,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,58282,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,0,0,0,372,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,372,0,0,0,380,382,0,0,0,0,0,0,0,0,0,1255,0,0,0,750,1262,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,765,0,0,0,0,0,0,0,0,0,0,0,372,372,0,131072,372,0,334,440,372,440,0,0,440,440,440,458,440,0,0,0,440,497,497,497,497,497,497,497,497,497,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,440,535,57901,535,57901,535,535,57901,535,535,57924,57901,535,535,57901,57901,57901,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,751,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3463,0,0,0,0,57901,57924,57901,57901,57901,57901,57901,57901,57901,57924,57924,57901,57901,57951,57901,57901,57901,57901,57901,57901,57901,57951,57951,57901,57901,57901,57901,57951,57951,57901,535,57901,529,529,529,529,529,57894,57894,58261,57894,57894,57894,57894,57894,57894,58294,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,58337,57917,57917,57917,57917,57917,61242,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,61250,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,0,0,58445,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,303,0,0,0,0,0,0,789,0,0,0,0,808,0,0,0,0,0,0,0,0,0,0,0,694,0,0,789,0,0,0,0,808,57894,57894,58799,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,0,0,0,0,1877,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,3493,529,529,529,529,529,529,1966,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,59947,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60698,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57894,59409,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61246,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,2294,1728,59509,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61346,57944,57944,529,57894,0,0,0,4007,0,0,0,0,3681,0,0,0,0,59990,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,60073,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59605,0,0,2859,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,3948,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61572,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60401,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61255,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,3666,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,297,0,0,57944,57944,57944,57944,57944,57944,57944,61141,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,4250,529,529,529,529,529,529,61600,57894,57894,57894,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1831,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,229376,0,491520,524288,0,0,0,0,0,0,0,57894,57894,57894,57894,61606,57917,57917,57917,57917,57917,57917,57917,61612,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,58283,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,0,0,0,0,4296,529,529,529,61642,57894,57894,57894,61644,57917,57917,57917,57917,57917,58961,58962,57917,57917,0,57894,57944,57944,57944,57944,58972,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,4161,57917,61646,57944,57944,57944,0,0,529,529,57894,57894,57917,57917,57944,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,529,529,529,529,529,529,529,3710,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3720,529,529,529,529,529,3725,529,3727,0,0,0,0,131072,0,0,0,441,0,441,447,0,441,441,441,0,441,478,478,478,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,491,536,57902,536,57902,536,536,57902,536,536,57925,57902,536,536,57902,57902,57902,57925,57902,57902,57902,57902,57902,57902,57902,57925,57925,57902,57902,57952,57902,57902,57902,57902,57902,57902,57902,57952,57952,57902,57902,57902,57902,57952,57952,57902,536,57902,57902,57902,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,802,0,0,529,529,529,529,529,862,529,529,529,529,529,529,529,529,529,529,0,0,0,0,0,1285,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,309,0,0,0,2421,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2496,529,2498,529,529,529,0,0,0,3207,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,3495,529,529,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3433,0,0,0,3437,0,0,0,0,0,3443,0,0,0,0,0,0,4268032,0,0,0,0,0,0,0,499712,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3471,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3488,529,529,529,529,529,529,529,529,529,529,529,529,529,3240,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,529,3525,529,529,529,60872,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60889,57894,57894,57894,57894,57894,57894,57894,57894,59911,57894,57894,57894,57894,59916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59393,57894,57894,57894,57894,57894,57894,57894,57894,59402,57894,57894,57894,57894,57894,57894,57894,57894,57894,60899,57894,57894,57894,57894,57894,57894,57894,57894,57894,60908,57894,57894,60911,57894,57894,57894,60914,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58984,57944,57944,57944,57944,57944,57944,57944,60950,57917,57917,60953,57917,57917,57917,60956,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60973,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,4089,0,4091,0,529,529,529,529,529,4096,529,529,529,529,529,529,529,529,529,529,529,529,3506,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1950,529,529,529,529,529,529,529,529,1959,529,529,529,57944,57944,57944,57944,57944,57944,57944,60983,57944,57944,57944,57944,57944,57944,57944,57944,57944,60992,57944,57944,60995,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3439,0,0,0,0,0,529,3705,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3717,529,529,529,529,529,529,529,3722,529,3724,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,59860,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59872,57894,57894,57894,57894,57894,57894,57894,2594,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60008,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,529,529,529,529,529,529,529,57894,57894,61076,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61088,57894,57894,57894,57894,57894,57894,57894,57894,60648,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,2597,57917,57917,57894,57894,57894,61094,57894,61096,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,61105,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58928,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58947,57917,57917,57917,57917,57917,57917,57917,57917,61117,57917,57917,57917,57917,57917,57917,57917,57917,61123,57917,61125,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,61134,57944,57944,57944,4081,0,4082,0,0,0,0,0,0,0,0,0,0,0,529,4093,529,4094,529,529,529,4098,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,3681,0,0,0,3836,0,0,0,0,0,0,0,0,0,0,0,3844,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2444,529,529,529,529,2449,529,529,3854,529,529,529,529,529,529,529,529,3860,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61216,57894,57894,57894,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,651,0,57917,57917,57917,61241,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61254,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,3934,0,0,0,0,0,61260,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,3850,529,529,57894,61627,61628,57894,57894,57917,57917,61631,61632,57917,57917,57944,57944,61635,61636,57944,57944,0,0,0,0,529,529,529,529,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,529,529,4279,4280,529,529,57894,0,0,0,0,0,690,691,0,0,0,0,696,0,0,0,368,368,368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,548,57914,548,57914,548,548,57914,548,548,57937,57914,548,548,57914,57914,0,0,0,0,0,771,0,0,0,0,0,0,0,0,0,0,529,529,529,854,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3262,529,529,529,529,529,529,529,529,529,529,0,0,57894,57894,57894,57894,57894,529,529,529,529,913,57894,57894,57894,57894,58273,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58332,0,57917,57917,57917,57917,57917,57917,57917,59995,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59501,57917,57917,59504,57917,57917,57917,58349,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58408,0,0,0,0,57894,57944,57944,57944,57944,58424,57944,57944,57944,57944,57944,57944,57944,57944,57944,59046,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,58293,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,529,1409,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60308,57894,57894,57894,57894,60311,57894,57894,60313,57894,60314,57894,57894,57894,57894,57894,57894,57894,57894,57894,57944,57944,57944,59038,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60885,57894,57894,57894,57894,57894,57894,57894,57894,57894,57944,57944,57944,57944,57944,57944,57944,61265,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3847,529,529,529,529,529,529,529,3852,0,427,427,0,131072,427,0,0,0,427,0,448,0,0,0,0,427,336,479,479,479,492,492,492,492,492,492,492,492,492,492,512,520,520,520,520,520,520,527,520,520,520,527,520,520,520,520,520,520,537,57903,537,57903,537,537,57903,537,537,57926,57903,537,537,57903,57903,57903,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,841,0,0,529,529,529,529,529,864,529,529,529,529,529,529,529,529,529,529,57903,57926,57903,57903,57903,57903,57903,57903,57903,57926,57926,57903,57903,57953,57903,57903,57903,57903,57903,57903,57903,57953,57953,57903,57903,57903,57903,57953,57953,57903,537,57903,777,0,0,781,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,797,0,0,0,0,0,0,0,801,0,0,0,0,0,0,0,0,1254,0,0,0,0,0,0,0,0,0,0,0,1172,0,1174,0,0,0,0,0,0,0,0,0,0,0,1884,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,4026,529,4028,4029,529,4031,529,57894,57894,57894,57894,57894,57894,57894,57894,61385,57894,61387,61388,57894,0,0,0,0,837,797,0,0,837,0,0,0,0,0,0,0,529,529,529,529,857,529,866,529,529,529,529,529,529,529,529,529,529,529,529,1384,529,529,529,529,529,529,529,1393,529,529,1395,529,529,529,529,1400,529,529,529,529,529,529,529,914,57894,57894,57894,57894,57894,58276,57894,58285,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58333,0,57917,57917,57917,57917,57917,57917,57917,60023,57917,57917,57917,57944,57944,57944,57944,57944,57944,60032,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60044,57944,57944,57917,58352,57917,58361,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58409,0,0,0,0,57894,57944,57944,57944,57944,57944,58427,57944,58436,57944,57944,57944,57944,57944,57944,57944,57944,60743,57944,57944,57944,57944,57944,57944,57944,60749,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59054,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,0,0,1249,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,803,0,0,0,0,0,0,0,0,1311,0,0,0,0,0,0,0,0,1316,0,0,0,0,0,0,0,0,1326,0,0,0,0,0,0,0,0,0,0,0,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,344064,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,1412,529,529,1416,529,529,529,529,529,1423,529,529,529,1430,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61102,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58792,57894,57894,57894,57894,57894,57894,57894,57894,57894,58811,57894,57894,57894,57894,57894,57894,57894,57894,57894,58821,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59888,57894,57894,57894,59891,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60907,57894,57894,57894,57894,57894,57894,57894,57917,60915,57917,57917,57917,57917,57917,57917,57917,57917,58916,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58946,57917,57917,58950,57917,57917,57917,57917,57917,59449,57917,57917,57917,57917,57917,57917,57917,57917,57917,59461,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58931,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58957,57917,57917,57917,58964,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58981,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,3927,0,0,0,0,0,3681,0,0,0,3936,0,0,0,57944,59e3,57944,57944,57944,57944,57944,57944,57944,57944,57944,59010,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60752,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59041,57944,57944,59045,57944,57944,57944,57944,57944,59052,57944,57944,57944,59059,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58309,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,0,1824,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1277,0,0,0,0,1848,1849,0,1851,0,0,0,0,0,0,0,0,0,0,0,0,0,1865,0,1867,0,0,0,0,0,0,0,0,0,0,0,1226,0,0,0,0,1231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,734,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,1971,529,529,529,529,529,529,529,529,529,529,1981,1983,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,57917,59946,57917,59948,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60678,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60691,57894,57894,57894,57894,57894,59414,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59425,59427,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,58883,57917,57917,57917,58892,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59978,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,59610,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59621,59623,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,1221,0,0,0,0,0,1227,0,1229,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2383,0,0,0,0,0,0,0,0,0,0,2340,0,0,0,2343,0,0,0,0,0,2349,0,0,0,0,0,0,0,0,0,0,0,0,2359,0,0,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4857856,4874240,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5259264,2367,0,0,0,0,0,0,0,0,0,0,0,0,2375,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2358,0,0,0,0,0,0,0,0,2366,57894,57894,57894,59934,57894,57894,57894,0,0,0,0,57917,57917,57917,57917,57917,57917,59949,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59961,57917,57917,57917,57917,57917,59480,59481,59483,57917,57917,57917,57917,57917,57917,57917,59491,59492,57917,59494,57917,57917,59497,59498,57917,57917,57917,57917,57917,57917,57917,59506,57917,57944,57944,57944,57944,57944,57944,57944,60106,57944,57944,57944,2441,529,529,529,529,59872,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,2791,0,0,0,0,0,0,0,0,0,0,0,2801,0,0,0,0,0,0,0,0,0,2807,0,0,0,0,0,0,2811,0,0,0,0,0,0,0,0,0,0,0,0,0,2824,0,0,0,0,0,0,0,2832,0,0,0,0,2834,0,0,0,0,0,0,0,0,0,0,0,0,0,2844,2845,0,0,2848,0,0,2851,0,0,0,0,0,0,0,0,0,0,3184,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1301,0,0,0,0,1306,0,0,0,0,0,0,2861,0,0,0,0,0,0,0,0,0,0,0,0,0,2871,0,0,0,0,529,2875,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,60289,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61225,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59528,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,2934,529,529,529,529,529,529,0,0,0,0,0,0,57894,60284,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60654,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,57917,57917,57894,57894,60326,57894,57894,57894,57894,57894,57894,60333,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60342,57894,57894,57894,60345,57894,57894,57894,57894,57894,57894,57894,57894,57894,61100,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60410,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57917,57917,57917,60374,57917,57917,57917,57917,57917,57917,57917,60379,57917,57917,57917,57917,57917,57917,57917,60385,57917,57917,57917,57917,57917,57917,57917,60393,57917,57917,57917,57917,57917,57917,57917,60694,57917,57917,57917,57917,57917,57917,57917,60700,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,61248,57944,57944,57944,61251,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,60400,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60409,57917,57917,57917,60412,57917,57917,57917,57917,57917,57917,57944,60416,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,3823,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3459,0,0,0,0,0,0,0,0,0,57944,57944,57944,57944,57944,57944,60450,57944,57944,57944,57944,57944,57944,57944,60458,57944,57944,57944,57944,57944,57944,60465,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60058,57944,57944,57944,57944,57944,57944,57944,57944,60065,57944,60067,57944,60070,57944,57944,57944,57944,57944,57944,60474,57944,57944,57944,60477,57944,57944,57944,57944,57944,57944,3137,529,529,529,529,60484,57894,57894,57894,57894,0,0,0,0,3145,0,0,0,0,0,0,0,0,0,1769,0,0,1772,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1790,0,0,0,0,0,3155,0,0,0,0,0,0,3159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3173,3174,0,0,0,0,0,0,1253,0,0,0,1258,0,0,0,0,0,0,0,0,0,1175,0,0,0,0,0,0,0,0,0,0,0,0,3214,0,0,0,0,0,0,0,0,0,0,0,0,0,3223,529,529,529,529,529,0,3205,0,0,0,0,3210,0,0,0,3212,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,3225,529,529,529,0,0,0,0,59854,57894,57894,57894,57894,57894,57894,57894,59862,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60653,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,57917,57917,529,529,529,3230,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3246,3247,529,529,529,529,3250,529,529,529,529,529,529,529,529,529,1382,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1987,58776,0,57894,57894,57894,57894,57894,57894,57894,529,529,529,529,529,3255,529,529,529,3258,529,3260,529,529,529,529,529,529,529,3264,529,529,529,529,529,0,0,57894,57894,57894,60616,57894,57894,57894,57894,57894,57894,60900,57894,57894,60902,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,60916,57917,57917,57917,57917,57917,57917,57917,57917,57917,61245,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,57894,57894,57894,57894,60621,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60637,60638,57894,57894,57894,57894,60641,57894,57894,57894,57894,57894,57894,57894,59350,59351,57894,57894,57894,57894,59358,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59373,57894,57917,60665,57917,57917,57917,57917,57917,60670,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60686,60687,57917,57917,57917,57917,60690,57917,57917,57917,57917,57944,57944,57944,57944,61543,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,529,529,529,529,4022,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,61381,57894,57894,57894,57894,57894,57894,57894,57894,57894,58842,57894,57894,58849,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58863,57894,57894,57894,57894,57894,50679,58776,992,57944,57944,60714,57944,57944,57944,57944,57944,60719,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60735,60736,57944,57944,57944,57944,60739,529,529,529,57894,57894,57894,3423,0,0,3426,3427,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1840,0,0,0,0,0,1845,0,3468,0,0,0,0,3472,0,0,0,0,3477,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,3492,529,529,529,529,3496,529,529,529,529,529,529,529,3502,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3516,529,529,529,529,529,529,529,529,529,529,529,1383,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1405,57944,57944,61261,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3845,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,3507,529,3509,529,529,529,529,529,529,3515,529,529,3517,529,529,529,529,529,529,0,0,0,0,3940,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61390,57894,61392,57917,57917,57917,57917,57917,57917,57917,57917,61401,57917,61403,61404,57917,61406,57917,61408,57944,57944,57944,57944,57944,57944,57944,57944,61417,57944,61419,61420,57944,57944,57944,57944,57944,57944,57944,57944,61340,57944,61342,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,3183,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,381,0,384,0,0,0,384,61422,57944,61424,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3955,529,57894,57894,57894,57894,57894,57894,57894,57894,529,529,4217,529,4218,529,529,529,57894,57894,57894,57894,57894,57894,61568,57894,61569,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,61576,57917,61577,57917,57917,57917,57917,57917,59516,59517,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60084,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59018,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,57944,57944,57944,57944,57944,57944,61584,57944,61585,57944,57944,57944,57944,0,0,0,0,0,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61087,57894,57894,57894,57894,57894,57894,57894,57894,57917,57944,57944,57944,57944,0,0,529,529,57894,57894,57917,57917,57944,57944,4309,4310,61655,61656,61657,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,529,529,529,529,529,529,529,57894,57894,57894,57894,61517,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,61530,57917,57917,57917,57917,57917,57917,57917,57917,61244,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,2294,0,57904,57927,57904,57904,57904,57904,57904,57904,57904,57927,57927,57904,57904,57954,57904,57904,57904,57904,57904,57904,57904,57954,57954,57904,57904,57904,57904,57954,57954,57904,538,57904,57904,57904,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,1200,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,57894,57894,57894,57894,58836,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,0,408,0,0,0,0,0,0,0,0,0,0,0,0,0,0,408,0,0,0,0,0,0,0,384,0,139264,147456,0,408,0,0,0,131072,0,0,0,442,0,442,0,453,442,442,442,0,442,480,480,480,493,493,493,493,493,493,493,493,493,493,493,493,493,493,493,493,493,539,57905,539,57905,539,539,57905,539,539,57928,57905,539,539,57905,57905,57905,57928,57905,57905,57905,57905,57905,57905,57905,57928,57928,57905,57905,57955,57905,57905,57905,57905,57905,57905,57905,57955,57955,57905,57905,57905,57905,57955,57955,57905,539,57905,57905,57905,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,1228,0,0,0,0,0,0,0,0,1237,0,0,0,0,0,0,0,0,0,900,529,529,529,529,57894,57894,58262,57894,57894,57894,58278,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58319,57894,57894,57894,57894,0,57917,57917,58338,57917,57917,57917,57917,58878,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58909,58911,57917,57917,57917,57917,57917,57917,57917,57917,60405,57917,57917,57917,57917,57917,57917,57917,57917,60411,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61156,57944,57944,57944,57944,57917,57917,58354,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58395,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,58413,57944,57944,57944,58429,57944,57944,57944,57944,57944,57944,57944,57944,57944,60453,57944,57944,57944,57944,60457,57944,57944,57944,60462,57944,57944,57944,57944,57944,57944,57944,57944,60470,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60721,57944,57944,60725,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60734,57944,57944,57944,57944,57944,57944,57944,57944,57944,3922,529,61267,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,1225,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1246,0,1162,0,0,0,0,0,0,0,0,0,1169,1170,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,333,334,0,0,0,0,0,0,0,0,0,0,0,0,0,1252,0,0,0,0,0,0,0,0,0,1263,1264,0,0,0,0,0,1170,0,0,0,0,0,0,0,0,0,0,0,1259,0,0,0,0,0,0,1267,0,0,0,0,1271,0,0,0,0,0,0,0,0,0,0,0,1240,0,0,0,0,0,0,529,1341,529,529,529,529,529,529,529,529,529,529,1354,1361,529,529,529,529,529,529,529,529,529,529,529,1422,529,529,529,529,529,529,58776,916,57894,57894,57894,58782,57894,57894,57894,57894,57894,57894,57894,57894,57894,59886,57894,57894,57894,57894,57894,57894,57894,57894,59893,57894,59895,57894,59898,57894,57894,57894,57894,57894,57894,57894,57894,57894,58841,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58857,57894,57894,57894,57894,57894,57894,58868,57894,50679,58776,992,1374,529,1376,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1396,529,1398,529,529,529,529,529,529,529,529,529,1418,529,529,529,529,529,529,1429,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58789,57894,529,529,1411,529,529,529,529,529,529,529,529,529,529,529,1426,529,529,529,58776,916,57894,58779,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58844,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58861,57894,57894,57894,57894,57894,57894,50679,58776,992,57894,58793,58800,57894,57894,57894,57894,57894,57894,57894,57894,58813,57894,58815,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59362,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58835,57894,58837,57894,57894,57894,57894,57894,57894,57894,58850,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58865,57894,57894,57894,50679,58776,992,57917,58874,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58888,58895,57917,57917,57917,57917,57917,57917,57917,57917,58908,57917,58910,57917,57917,57917,57917,57917,57917,57917,57917,59996,57917,57917,57917,57917,57917,60002,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61127,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,59002,57944,59004,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59025,57944,59027,57944,57944,57944,0,0,0,0,0,0,0,0,0,4088,0,0,0,0,529,529,529,529,529,529,529,529,4099,529,4101,529,529,4103,529,57944,57944,57944,57944,59040,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59055,57944,57944,57944,529,1354,529,1411,529,529,58793,57894,57894,58850,57894,57894,57894,57894,57894,57894,57894,61313,57894,57894,57894,61316,57917,57917,57917,57917,61320,57917,57917,57917,57917,57917,57917,57917,57917,57917,61329,57917,57917,57917,61332,57944,57944,57944,57944,57944,59546,59547,57944,57944,57944,57944,59554,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59569,57944,57944,57944,57944,57944,57944,57944,57944,57944,60055,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59595,59596,57944,57944,57944,57944,57944,57944,57944,57944,0,0,2316,0,2317,0,0,0,0,0,0,0,0,2325,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3220,0,0,0,529,3224,529,529,529,529,57917,59991,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60003,57917,57917,57917,57917,57917,57917,57917,60009,57917,57917,57917,57917,57917,57917,57917,60015,57944,60074,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60086,57944,57944,57944,57944,57944,57944,57944,60092,57944,57944,57944,57944,57944,57944,57944,60098,57894,57894,57894,57894,60301,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60348,57894,57894,0,3152,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3165,0,0,0,0,0,0,0,0,0,0,0,0,2814,0,0,0,0,0,0,0,0,2822,0,0,0,2826,0,0,0,2830,0,0,529,529,3229,529,529,529,529,529,529,3237,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2468,529,529,529,529,529,529,529,529,529,57894,57894,57894,60620,57894,57894,57894,57894,57894,57894,60628,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59896,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57944,57944,57944,57944,57944,57944,57944,60718,57944,57944,57944,57944,57944,57944,60726,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,4004,0,4006,0,0,0,0,0,3681,0,0,0,0,0,0,3470,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,890,529,529,3728,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60661,57894,0,0,57917,57917,529,529,4163,529,4165,529,529,529,57894,57894,57894,57894,57894,57894,57894,61519,57894,61521,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,61532,57917,61534,57917,57917,61581,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61083,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59915,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59927,57894,57894,57894,61626,57894,57894,57894,57894,57917,61630,57917,57917,57917,57917,57944,61634,57944,57944,57944,57944,0,0,0,0,529,529,529,529,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,529,4278,529,529,529,529,57894,342,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3176,0,0,0,0,131072,0,0,0,0,0,0,449,0,0,0,0,0,465,481,481,481,465,465,465,465,465,465,465,465,465,465,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,513,540,57906,540,57906,540,540,57906,540,540,57929,57906,540,540,57906,57906,57906,1,24578,3,155943,156283,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,1315,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2331,0,0,0,0,2335,0,0,0,0,57906,57929,57906,57906,57906,57906,57906,57906,57906,57929,57929,57906,57906,57956,57906,57906,57906,57906,57906,57906,57906,57956,57956,57906,57906,57906,57906,57956,57956,57906,540,57906,57917,57917,58355,57917,57917,58371,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,58430,57944,57944,57944,57944,57944,57944,57944,57944,57944,60480,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,328,403,0,0,0,0,0,0,0,0,0,0,328,0,0,0,0,0,0,0,0,58446,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1752,0,0,0,0,0,0,0,0,0,0,0,2790,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1839,0,0,0,0,0,0,0,0,0,0,1191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,3182,0,0,0,0,0,0,0,3188,0,3190,0,0,0,3194,0,0,0,0,0,3199,0,0,3202,0,0,0,0,0,1337,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,1355,529,529,529,529,529,529,529,529,529,529,529,529,1385,529,529,529,1389,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2921,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1946,529,529,529,529,529,1953,529,529,529,529,529,529,529,529,1962,529,529,529,529,1413,529,529,529,529,529,1421,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61226,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59462,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57894,58794,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59903,59904,58833,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58852,57894,57894,57894,57894,57894,58860,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,57917,58955,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58983,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60746,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60730,57944,57944,60733,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59042,57944,57944,57944,57944,57944,59050,57944,57944,57944,57944,57944,57944,57944,529,1355,529,529,1720,529,58794,57894,57894,57894,59069,57894,57894,57894,57894,57894,57894,61097,57894,61099,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,61110,57917,57917,57917,57917,57917,57917,57917,57944,60957,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59022,57944,57944,57944,57944,57944,57944,57944,57944,1153,0,0,1730,0,0,0,0,1737,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1755,0,0,0,1758,0,0,0,0,0,0,1255,1829,0,0,0,0,1262,1262,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1166,1300,0,0,0,0,0,0,1307,0,1761,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1776,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,361,362,0,0,0,0,0,0,0,368,0,297,0,0,529,1931,529,529,529,529,529,529,529,529,1942,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1394,529,529,529,529,529,529,529,529,529,529,59374,57894,57894,57894,57894,57894,57894,57894,57894,59385,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,2091,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,59548,57944,57944,57944,57944,57944,57944,57944,57944,57944,59559,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59570,57944,57944,57944,57944,57944,57944,57944,57944,57944,60720,57944,60723,57944,57944,57944,57944,60728,57944,57944,57944,60731,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,3138,529,529,529,57894,60485,57894,57894,57894,0,0,3143,3144,0,0,0,0,0,0,57944,57944,57944,57944,57944,57944,59581,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60069,57944,57944,57944,57944,57944,529,529,529,529,529,2479,529,529,529,529,2484,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1952,529,529,529,529,529,529,529,529,529,529,57894,59880,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59929,57894,59964,57917,57917,57917,57917,59969,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,60047,57944,57944,57944,57944,60052,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60442,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,3429,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1781,0,0,0,0,0,0,0,0,0,0,529,529,529,3499,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2930,529,529,529,529,529,57917,57917,57917,60925,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59988,57917,57917,61092,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57894,57894,57894,57917,57917,57917,57917,61397,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,61413,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,0,0,0,3925,0,0,3928,0,0,0,0,3681,3933,0,0,0,0,0,0,57917,61580,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61588,0,0,0,0,0,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,61081,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61091,343,344,345,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,343,297,0,0,0,0,0,0,1286,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1212,368,368,0,0,1215,0,390,391,393,344,0,0,0,0,0,0,343,0,0,0,0,343,0,0,0,344,0,0,0,0,0,0,0,0,0,0,0,0,2867,2817,0,0,0,0,0,2872,0,0,0,529,529,529,529,529,529,529,2881,529,0,0,390,0,0,0,0,0,0,0,0,344,0,0,0,390,0,0,0,0,0,344,390,0,0,0,139264,147456,0,0,0,425,0,0,0,0,131072,0,436,343,0,0,0,0,454,0,0,0,343,0,482,482,482,482,498,498,498,498,498,498,498,498,498,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,482,541,57907,541,57907,541,541,57907,541,541,57930,57907,541,541,57907,57907,57907,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,1859,1860,0,1861,1862,0,0,0,0,0,0,0,0,0,0,0,1871,0,0,57907,57930,57907,57907,57907,57907,57907,57907,57907,57930,57930,57907,57943,57957,57943,57943,57943,57943,57943,57943,57943,57957,57957,57943,57943,57943,57943,57957,57957,57943,541,57907,715,0,717,0,0,0,0,0,0,0,725,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1868,0,0,0,0,0,0,0,0,0,0,0,815,0,798,0,0,817,0,668,0,794,0,0,0,0,0,817,794,0,817,815,0,0,829,0,0,0,664,832,0,794,0,0,0,0,0,838,0,0,0,0,798,664,842,0,529,845,529,529,529,861,529,529,877,529,529,529,529,891,529,529,529,0,0,0,2509,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59877,57894,529,529,909,529,529,57894,57894,58263,57894,57894,57894,58280,57894,57894,58296,57894,57894,57894,57894,58310,57894,57894,57894,57894,58328,57894,57894,0,57917,57917,58339,57917,57917,57917,57917,58959,57917,57917,57917,57917,0,58834,57944,57944,58970,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58997,57944,57944,57944,57944,57944,57944,57944,57944,60426,57944,57944,60429,60430,57944,57944,57944,57944,57944,60435,57944,60437,57944,57944,57944,57944,60441,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61145,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60463,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,58356,57917,57917,58372,57917,57917,57917,57917,58386,57917,57917,57917,57917,58404,57917,57917,0,0,0,0,57894,57944,57944,58414,57944,57944,57944,58431,57944,57944,57944,57944,57944,57944,57944,57944,57944,60744,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60754,57944,57944,60757,57944,57944,60760,58447,57944,57944,57944,57944,58461,57944,57944,57944,57944,58479,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,303,0,0,0,0,0,0,1312,0,0,0,0,0,0,0,0,1318,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3193,0,0,0,0,0,0,0,3200,0,0,0,0,0,0,1336,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,1356,529,529,529,529,529,529,529,529,529,529,529,529,1386,529,529,529,529,1391,529,529,529,529,529,529,529,529,529,1399,529,529,529,1406,529,529,529,529,529,1380,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1404,57894,58795,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58819,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61236,57917,57917,57917,57917,57917,57944,59033,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,1717,529,1719,529,529,59066,57894,57894,59068,57894,57894,57894,57894,57894,57894,58838,57894,57894,57894,58845,58847,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58870,50679,58776,992,0,1762,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1779,0,0,1782,0,1784,0,0,0,0,0,0,0,0,0,0,1290,1291,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1181,0,0,0,0,0,0,0,0,529,529,529,529,1902,529,529,529,529,529,529,529,529,1913,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2897,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,59345,57894,57894,57894,57894,57894,57894,57894,57894,59356,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59428,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59445,57917,57917,57917,57917,57917,57917,57917,57917,59456,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59531,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59541,57944,57944,57944,57944,57944,57944,57944,57944,59552,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60439,57944,57944,57944,57944,57944,57944,57944,60444,57944,57944,57944,57944,57944,57944,57944,57944,59582,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,3655,529,57894,61002,57894,0,0,0,0,0,0,0,2399,0,0,0,0,0,0,0,0,0,0,0,0,0,2410,0,0,0,0,0,0,0,0,0,0,0,0,0,1885,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,0,0,0,0,0,529,529,529,2427,2428,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3248,529,529,529,529,529,529,529,529,529,529,529,2476,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2495,529,529,529,529,529,529,529,0,2938,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,60290,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58843,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,57894,57894,57894,57894,57894,59908,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59928,57894,57894,57894,57894,57894,57894,59349,57894,57894,57894,57894,57894,57894,57894,57894,57894,59361,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61237,57917,57917,57917,57917,57917,60017,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,60029,57944,60031,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60727,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,57944,60100,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,3160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,2783,0,2785,0,0,2788,0,0,0,0,0,0,2793,0,0,0,2796,0,0,0,0,0,0,0,0,0,0,0,0,0,2792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,401408,0,0,0,0,0,0,0,0,0,0,2806,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2820,0,2821,0,2823,0,0,0,0,0,0,0,0,0,0,0,2323,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2336,0,0,0,2857,0,0,0,0,0,2863,0,0,0,0,2866,0,0,0,0,0,0,0,0,0,2874,0,529,529,529,529,529,529,529,529,529,529,529,529,1912,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,58787,57894,57894,57894,529,529,529,529,529,2885,529,529,2888,2889,529,529,529,529,529,2894,529,2896,529,529,529,529,2900,529,529,529,529,529,529,529,529,529,529,529,529,2486,529,529,529,529,529,2490,2491,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2893,529,2895,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1945,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2463,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2906,529,529,529,529,529,529,529,529,2914,529,529,529,529,529,529,2922,529,529,529,529,529,2927,529,529,529,529,529,529,529,529,529,529,529,529,2918,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1919,529,529,529,529,529,529,529,529,529,529,529,529,60298,57894,57894,57894,57894,57894,60303,57894,60305,57894,57894,57894,57894,60309,57894,57894,57894,57894,57894,57894,57894,57894,57894,60315,57894,57894,57894,57894,57894,57894,57894,57894,57894,59912,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,2090,57917,57917,57917,57917,57917,57917,57917,57917,57894,60324,57894,57894,57894,57894,57894,57894,60332,57894,57894,57894,57894,57894,60337,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58818,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58853,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,57917,60372,57917,57917,57917,57917,60376,57917,57917,57917,57917,57917,57917,57917,57917,57917,60382,57917,57917,57917,57917,57917,57917,57917,57917,57917,60391,57917,57917,57917,57917,57917,57917,57917,57944,57944,60958,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60975,57944,57917,60399,57917,57917,57917,57917,57917,60404,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60036,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60447,57944,57944,57944,57944,57944,57944,57944,57944,57944,60456,57944,57944,57944,57944,57944,57944,60464,57944,57944,57944,57944,57944,60469,57944,57944,57944,57944,57944,529,529,3819,57894,57894,61165,3822,0,0,0,0,3826,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1176,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,3254,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3263,529,529,3266,529,529,3269,0,0,60614,57894,57894,57894,57894,57894,57894,57894,59382,57894,57894,57894,59387,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59395,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60646,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60656,57894,57894,60659,57894,57894,60662,0,0,60663,57917,57917,57917,57917,59448,57917,57917,57917,57917,59454,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59465,57917,57917,57917,57917,59469,57917,57917,57917,57917,57917,57917,57917,57917,60695,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60705,57917,57917,60708,57917,57917,60711,60712,3417,529,529,60764,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3434,3435,0,0,0,0,3440,0,0,0,0,0,0,0,0,1288,0,0,0,0,1293,0,0,0,0,1296,0,0,0,0,0,0,0,0,0,0,0,0,1308,529,529,529,529,529,57894,57894,60874,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60891,57894,60893,57894,57894,57894,57894,57894,57894,61222,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61235,57917,57917,57917,57917,57917,57917,57917,57917,59971,57917,59973,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60414,57917,57917,57917,57944,57944,57944,57944,57944,57944,60420,60977,57944,57944,57944,57944,57944,57944,57944,60984,57944,57944,60986,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,3827,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1175,0,0,0,0,1180,0,0,0,0,0,0,0,0,0,3661,0,3663,0,0,0,3667,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,3226,529,529,529,529,529,529,529,3708,3709,529,529,529,529,3713,3714,529,529,529,529,529,3718,529,529,529,529,529,529,529,3723,529,529,529,529,529,529,529,529,1939,529,529,529,1944,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2925,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,61095,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,61108,61109,57917,57917,57917,57917,61113,61114,57944,57944,61137,61138,57944,57944,57944,57944,61142,61143,57944,57944,57944,57944,57944,61147,57944,57944,57944,57944,57944,57944,57944,57944,61153,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60987,57944,60989,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3681,0,3834,0,0,0,0,0,3840,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2439,529,529,2443,529,529,529,2447,529,529,529,529,529,3855,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61217,57894,57894,57894,57894,57894,57894,59380,59381,59383,57894,57894,57894,57894,57894,57894,57894,59391,59392,57894,59394,57894,57894,59397,59398,57894,57894,57894,57894,57894,57894,57894,59406,57894,57894,57894,61309,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61325,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,60963,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60976,57894,57894,57894,57917,57917,61395,57917,57917,57917,57917,61400,57917,57917,57917,57917,61405,57917,57917,57917,57944,57944,61411,57944,57944,57944,57944,61416,57944,57944,57944,57944,61421,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,529,529,529,4252,4253,529,529,57894,57894,57894,61602,61603,57894,57894,57894,57917,57917,57917,61608,61609,57917,57917,57917,57944,57944,57944,61614,61615,57944,57944,57944,0,0,0,0,0,529,529,529,529,529,529,57894,57894,57894,57894,57894,60877,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59353,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59371,59372,57894,57894,57917,57944,57944,57944,57944,0,0,529,529,57894,57894,57917,57917,57944,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,4319,4320,61665,61666,61667,0,529,529,529,529,529,529,529,529,61565,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61573,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58385,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,346,347,348,349,350,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,297,0,0,0,0,0,0,1313,0,0,0,0,0,0,0,0,0,1319,1280,0,1303,1322,0,1325,0,0,1239,0,0,0,0,0,1333,0,0,1216,1333,1340,529,529,529,529,1346,529,529,529,529,1352,529,529,529,529,529,529,529,529,529,529,1373,0,0,0,0,0,394,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,516096,0,0,0,0,0,350,131072,348,0,350,349,348,349,0,348,349,349,349,459,466,483,483,483,494,494,494,494,501,494,494,501,501,501,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,514,542,57908,542,57908,542,542,57908,542,542,57931,57908,542,542,57908,57908,57908,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,647,0,0,0,0,652,57908,57931,57908,57908,57908,57908,57908,57908,57908,57931,57931,57908,57908,57958,57908,57908,57908,57908,57908,57908,57908,57958,57958,57908,57908,57908,57908,57958,57958,57908,542,57908,653,654,655,656,657,658,0,0,0,0,0,0,0,0,0,0,0,0,0,0,673,674,0,676,677,0,0,0,0,0,683,0,0,0,0,0,0,4268782,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2828,0,0,0,0,0,716,0,0,719,0,721,0,723,0,0,0,0,0,0,0,0,0,0,0,735,0,0,0,0,0,0,0,0,0,0,0,0,3186,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,3489,529,529,529,529,529,529,529,529,0,0,0,0,783,784,0,786,787,0,0,0,0,786,0,0,793,0,0,0,0,0,0,0,0,0,800,0,0,0,0,0,0,0,0,0,1801,0,0,0,0,0,0,0,0,0,0,0,1813,0,0,0,0,0,0,0,0,0,0,0,304,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,313,312,0,0,0,312,312,313,313,811,0,0,692,0,0,0,786,0,0,0,0,0,0,0,0,767,823,0,0,0,0,0,0,827,699,0,0,831,0,0,0,0,0,0,0,3474,3475,0,0,0,0,3480,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,3949,529,3951,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,833,0,0,0,692,699,0,0,692,831,831,0,0,0,0,0,529,529,851,855,858,529,867,529,529,529,883,885,888,529,529,529,0,0,0,0,57894,57894,57894,57894,59858,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59921,57894,57894,57894,57894,59925,57894,57894,57894,57894,57894,59930,901,905,529,529,529,57894,57894,57894,58270,58274,58277,57894,58286,57894,57894,57894,58302,58304,58307,57894,57894,57894,58320,58324,57894,57894,57894,0,57917,57917,57917,58346,58350,58353,57917,58362,57917,57917,57917,58378,58380,58383,57917,57917,57917,58396,58400,57917,57917,57917,0,0,0,0,58411,57944,57944,57944,58421,58425,58428,57944,58437,57944,57944,57944,57944,57944,57944,57944,57944,61484,57944,61486,57944,57944,61488,57944,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,1348,529,529,529,529,529,1360,529,529,529,529,529,529,529,529,57944,57944,58453,58455,58458,57944,57944,57944,58471,58475,57944,57944,57944,851,1142,529,901,905,1146,0,58491,58270,57894,58320,58324,58496,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1748,1749,0,0,0,0,0,0,0,0,0,0,0,0,0,262144,0,0,0,0,0,0,262144,262144,262144,0,0,0,0,0,0,0,0,0,1189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1202,0,0,0,0,0,0,0,0,0,0,0,368,368,1213,0,0,0,0,0,0,1798,0,0,0,0,0,0,0,0,0,0,0,0,1811,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3187,0,0,0,0,3192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3215,0,0,3218,0,0,0,0,0,0,0,3222,529,529,529,529,529,529,529,529,529,1378,529,529,529,1381,529,529,529,529,529,529,529,1388,529,529,1392,529,529,529,529,529,529,529,529,529,529,529,1403,529,529,529,529,529,529,529,1417,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61459,57894,57894,61461,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61473,57917,57917,61475,57917,529,1410,529,529,529,529,529,529,529,529,529,529,1424,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60335,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60346,57894,57894,57894,57894,57894,57917,57917,57917,58958,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61150,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59006,57944,57944,57944,59009,57944,57944,57944,57944,57944,57944,57944,59016,57944,57944,59020,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,2777,0,0,0,0,59032,57944,57944,59039,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59053,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60884,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58814,58816,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60631,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59919,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,1792,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1819,0,0,0,0,0,0,0,0,1853,0,0,0,0,0,0,1751,0,0,0,0,0,0,0,0,0,0,1869,1870,0,0,0,1873,0,0,0,1826,0,1828,0,0,0,1830,0,748,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5627904,0,0,0,1876,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1760,0,0,0,0,0,0,529,1895,529,529,529,0,0,0,0,57894,57894,57894,59857,57894,59859,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,61229,57917,57917,57917,61232,57917,57917,57917,57917,57917,57917,57917,57917,57917,529,529,529,1901,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1923,529,529,529,529,529,529,529,529,529,529,529,1943,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1984,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,529,529,1932,529,529,529,1936,529,529,1941,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3267,529,529,0,0,57894,57894,57894,57894,57894,57894,57894,59344,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59366,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60903,57894,60905,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59974,57917,57917,57917,57917,57917,57917,59979,57917,59981,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61247,57944,57944,57944,57944,57944,57944,57944,61252,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,2775,2295,0,2776,2298,0,0,0,0,0,0,57894,59375,57894,57894,57894,59379,57894,57894,59384,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60658,57894,57894,57894,57894,0,0,57917,57917,57917,59444,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59466,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58387,57917,57917,57917,57917,58405,57917,57917,0,0,0,0,57894,57944,57944,58415,57944,57944,57944,57944,57944,57944,59475,57917,57917,57917,59479,57917,57917,59484,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60707,57917,57917,57917,57917,57944,57944,57944,59575,57944,57944,59580,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59026,57944,57944,57944,57944,0,0,2296,0,1157,0,0,0,0,2299,0,1162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1187,0,2474,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1407,57894,57894,57894,59906,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,57917,57917,57944,57944,57944,57944,57944,57944,57944,60078,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,3654,529,529,61001,57894,57894,0,0,0,0,0,2808,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2831,0,0,0,0,0,0,4785119,991,991,991,4850655,991,991,991,991,991,4916191,991,4957151,4973535,991,991,991,991,991,991,5071839,991,991,991,991,991,991,991,991,991,0,915,4359059,4359059,4359059,4359059,4359059,4858771,4875155,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,4359059,5260179,529,529,529,529,2937,529,529,0,0,0,2939,0,1990,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60632,57894,57894,60635,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,0,3006,0,2090,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58913,57917,57917,57917,57917,60713,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60737,57944,57944,57944,57944,57944,57944,57944,57944,57944,60080,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60466,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,3425,0,0,0,0,0,0,0,0,0,3431,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2409,0,0,0,0,0,0,0,0,0,0,0,2419,0,0,3662,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1822,0,61306,57894,57894,57894,57894,57894,61312,57894,57894,57894,57894,57917,57917,57917,61318,57917,57917,57917,57917,61322,57917,57917,57917,57917,57917,61328,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,4212,0,529,529,529,529,57944,61334,57944,57944,57944,57944,61338,57944,57944,57944,57944,57944,61344,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,4011,0,0,0,0,0,0,1879,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1865,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,4032,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61103,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58897,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58930,57917,58932,57917,57917,57917,57917,57917,57917,57917,58945,57917,57917,57917,57917,57917,57917,57894,57894,57894,57917,57917,57917,57917,57917,61398,57917,57917,57917,61402,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,61414,57944,57944,57944,61418,57944,57944,57944,0,0,0,0,0,0,0,4086,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,4100,529,529,529,529,529,529,529,529,529,529,3238,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3251,529,529,529,529,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,4247,0,4249,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,61079,61080,57894,57894,57894,57894,61084,61085,57894,57894,57894,57894,57894,61089,57894,57894,57894,57894,57917,57944,57944,57944,57944,0,0,529,529,57894,57894,57917,57917,57944,57944,0,529,57894,57917,57944,4314,4315,61660,61661,61662,0,529,57894,57917,57944,0,529,529,529,529,529,529,529,1906,529,529,529,529,529,529,529,529,529,1918,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3863,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58817,57894,57894,57894,58820,57894,57894,57894,57894,57894,57894,57894,58827,57894,57894,58831,57894,57894,0,0,392,0,0,0,396,392,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3462,0,0,0,0,0,351,0,410,0,0,0,0,0,0,0,0,0,0,0,0,410,0,0,0,0,0,0,410,0,351,0,139264,147456,0,0,0,0,0,0,0,0,2320,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2333,0,0,0,0,0,0,0,0,0,0,3451,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2332,0,0,0,0,0,0,0,0,0,0,0,131072,0,437,0,0,0,0,450,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,508,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,515,543,57909,543,57909,543,543,57909,543,543,57932,57909,543,543,57909,57909,57932,57909,57909,57909,57909,57909,57909,57909,57932,57932,57909,57909,57959,57909,57909,57909,57909,57909,57909,57909,57959,57959,57909,57909,57909,57909,57959,57959,57909,624,57909,57975,57975,57975,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,3671,3672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,385024,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,529,529,910,529,529,57894,57894,58264,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58311,57894,57894,57894,57894,58329,57894,57894,0,57917,57917,58340,57917,57917,57917,57917,59514,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59525,59527,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59011,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59591,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58462,57944,57944,57944,57944,58480,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1746,1747,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1169,1170,0,0,0,0,0,0,1302,0,0,0,0,0,0,57894,58796,57894,57894,57894,57894,58806,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58822,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61224,57894,57894,57894,57894,57917,57917,57917,57917,57917,61230,57917,57917,57917,61234,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58877,57917,57917,57917,57917,57917,57917,57917,57917,57917,58891,57917,57917,57917,57917,58901,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58398,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,58917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58939,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,58976,57944,57944,57944,57944,57944,58988,57944,57944,57944,57944,57944,57944,57917,57917,58956,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,58971,57944,57944,57944,57944,57944,57944,57944,57944,57944,58985,57944,57944,57944,57944,58995,57944,57944,57944,57944,57944,57944,57944,57944,57944,60985,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3830,0,3831,0,0,0,0,57944,59034,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59051,57944,57944,57944,57944,57944,57944,529,1357,529,529,529,529,58796,57894,57894,57894,57894,57894,57894,57894,57894,61223,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,61231,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60931,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60941,57917,57917,57917,57917,57917,57917,57917,57917,57917,1153,0,0,1731,0,0,0,0,1738,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1183,0,0,0,0,0,0,0,0,0,0,1764,0,0,0,0,0,0,0,0,0,0,0,0,1777,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1277,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2353,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,57895,529,57895,529,529,57895,529,529,57918,57895,529,529,57895,57895,1823,0,0,0,0,0,0,0,1259,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1211,0,368,368,0,1214,0,0,1732,0,0,0,0,0,0,1739,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2315,0,0,0,0,0,0,6463488,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4931584,4939776,0,0,0,0,0,0,5054464,0,0,0,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60368,57917,57917,57917,57917,57917,59994,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60007,57917,57917,57917,57917,57917,60011,60012,60013,57917,57917,57917,57917,57917,57917,57917,59518,57917,57917,57917,57917,57917,57917,59524,57917,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,59536,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60428,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61148,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,2454,529,529,529,529,529,529,2459,529,2461,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2924,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2912,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,0,57894,57894,57894,57894,57894,0,0,2597,0,0,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58912,57917,57917,57917,58915,57917,3939,0,0,0,0,0,529,3942,529,529,3944,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,61301,57894,57894,61303,57894,57894,57894,1,24578,3,155943,156283,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1886,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,57944,57944,61335,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,2347,2348,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2312,0,0,0,0,0,0,0,4015,0,4017,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,749,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1872,0,57917,57917,58357,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,58432,57944,57944,57944,57944,57944,57944,57944,57944,57944,61341,57944,57944,57944,57944,57944,57944,57944,529,57894,0,4005,0,0,4008,0,0,0,3681,0,0,0,0,0,0,0,0,1310,0,529,529,1342,529,1345,529,529,529,529,529,529,529,529,1359,529,1364,529,529,1368,529,529,1371,0,1163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,221654,221654,529,529,529,2909,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,0,57894,57894,57894,57894,60617,57944,57944,57944,57944,57944,57944,57944,60451,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59597,57944,57944,59600,57944,57944,57944,57944,57917,61116,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60969,57944,57944,57944,57944,57944,57944,57944,0,0,0,353,131072,0,0,353,399,0,399,0,0,399,399,399,353,399,0,0,0,399,399,399,399,399,502,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,399,544,57910,544,57910,544,544,57910,544,544,57933,57910,544,544,57910,57910,57910,57933,57910,57910,57910,57910,57910,57910,57910,57933,57933,57910,57910,57960,57910,57910,57910,57910,57910,57910,57910,57960,57960,57910,57910,57910,57910,57960,57960,57910,544,57910,57910,57910,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,245760,245760,245760,245760,245760,245760,245760,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,342,0,0,813,814,0,0,0,0,0,0,768,0,0,819,0,0,665,0,0,0,819,0,0,0,0,0,0,0,0,0,0,0,0,212992,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,675,0,0,0,0,0,0,0,0,0,0,834,0,0,0,0,0,0,814,0,0,0,0,0,0,0,529,529,852,529,529,529,868,872,529,529,529,529,529,893,895,529,529,529,529,529,529,529,1937,1938,1940,529,529,529,529,529,529,529,1948,1949,529,1951,529,529,1954,1955,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60295,57894,57894,529,906,529,529,529,57894,57894,58265,58271,57894,57894,57894,58287,58291,57894,57894,57894,57894,57894,58312,58314,57894,57894,58325,57894,57894,57894,0,57917,57917,58341,58347,57917,57917,57917,58363,58367,57917,57917,57917,57917,57917,58388,58390,57917,57917,58401,57917,57917,57917,0,0,0,0,57894,57944,57944,58416,58422,57944,57944,57944,58438,58442,57944,57944,57944,57944,57944,58463,58465,57944,57944,58476,57944,57944,57944,852,529,895,529,906,529,0,57894,58271,58314,57894,58325,57894,155943,1153,0,303,0,0,0,0,0,0,2786,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2798,0,0,0,0,0,2802,0,0,0,0,0,0,0,0,661,662,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1817,0,0,0,0,0,0,0,0,0,1218,0,1220,0,1222,0,0,0,0,0,0,0,0,0,0,0,0,0,1236,0,1238,0,0,0,0,0,0,1245,0,0,0,0,0,307,0,0,0,0,0,0,0,0,0,0,0,0,307,0,0,0,0,0,0,307,237985,147456,0,0,0,307,1,24578,3,0,0,4366336,0,0,0,0,0,65536,304,0,4268032,98304,308,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,663,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1250,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1278,0,0,0,0,0,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,307,0,307,0,0,0,0,0,0,0,0,0,0,0,0,1171,1172,1173,1174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,415,0,0,0,0,0,0,415,139264,147456,0,0,0,424,0,0,1335,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2446,529,529,529,529,529,1375,1377,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1401,529,529,529,0,0,2508,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59870,57894,57894,59874,57894,57894,57894,59878,529,529,529,529,529,1415,529,529,529,529,529,529,529,529,1427,1428,529,529,58776,916,57894,57894,57894,57894,58783,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,57917,59945,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60681,57917,57917,60684,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,59003,59005,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59030,57944,57944,57944,57944,57944,57944,57944,59044,57944,57944,57944,57944,57944,57944,57944,57944,59056,59057,57944,57944,529,529,1718,529,529,1721,57894,57894,59067,57894,57894,59070,0,1847,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1794,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1810,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,0,0,0,0,0,0,0,0,0,713,0,529,1899,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1924,529,529,529,529,529,529,529,0,2938,0,0,0,0,57894,57894,57894,60286,57894,60287,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59357,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58856,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,529,1964,529,529,529,1970,529,529,529,529,529,529,529,529,529,1979,529,529,529,529,1985,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,57917,59944,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59530,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59342,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59367,57894,57894,57894,57894,57894,57894,57894,0,0,0,0,59943,57917,57917,57917,57917,57917,57917,57917,59951,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59457,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60683,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59407,57894,57894,57894,59413,57894,57894,57894,57894,57894,57894,57894,57894,57894,59423,57894,57894,57894,57894,59429,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,59442,57917,57917,57917,59513,57917,57917,57917,57917,57917,57917,57917,57917,57917,59523,57917,57917,57917,57917,59529,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,59538,57944,57944,57944,57944,57944,57944,57944,57944,57944,61485,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,2429,529,529,529,529,529,529,529,529,529,529,529,2441,529,529,529,529,529,529,529,529,529,57944,57944,59609,57944,57944,57944,57944,57944,57944,57944,57944,57944,59619,57944,57944,57944,57944,59625,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,2809,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,418,418,0,0,0,0,2394,0,2396,2397,2398,0,2400,0,0,0,0,0,0,0,0,0,0,2408,0,0,0,0,2413,2414,0,0,0,0,0,2418,0,0,0,0,0,0,2836,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,347,0,0,0,0,0,0,0,0,0,0,2424,529,529,529,529,529,529,2431,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2466,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2455,529,529,529,529,529,529,529,529,2462,529,2464,529,2467,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3508,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1982,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,529,2475,529,529,529,529,529,2481,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3268,529,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,59907,57894,57894,57894,57894,57894,59913,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58859,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,0,2781,2782,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1276,0,0,0,0,0,0,2833,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2847,0,0,0,0,0,0,0,0,0,0,0,354,355,356,0,0,0,0,0,0,0,0,0,0,0,0,0,368,0,297,0,0,529,529,529,529,529,529,2886,529,529,529,529,529,2891,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2898,529,529,529,529,529,529,529,2903,529,529,529,529,529,2907,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3726,529,57894,57894,57894,60300,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60316,57894,57894,57894,57894,57894,57894,57894,0,0,0,2598,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61131,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,60448,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60072,57944,57944,0,3178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,352256,352256,529,3228,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,0,57894,60615,57894,57894,57894,60618,57894,60619,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59902,57894,57894,57917,57917,57917,60667,57917,60668,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59986,57917,57917,57917,57917,57917,57944,57944,57944,57944,60716,57944,60717,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60093,57944,57944,57944,57944,60097,57944,57944,0,0,0,3445,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1331,0,0,0,529,529,529,529,529,57894,60873,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59900,57894,57894,57894,57894,57894,57894,57944,57944,57944,61336,57944,57944,57944,57944,57944,57944,57944,57944,57944,61345,57944,57944,57944,529,57894,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,2402,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,678,0,0,0,0,0,0,57894,57894,57894,57894,57894,61453,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,61467,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58884,57917,57917,57917,57917,57917,57917,58899,57917,57917,57917,58904,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60026,57944,57944,57944,57944,57944,57944,57944,60034,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,303,307,0,0,0,0,0,0,0,0,57944,57944,57944,57944,57944,61481,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,4155,0,529,529,529,529,529,529,529,529,529,1419,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,58788,57894,57894,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,4245,0,0,0,0,529,529,529,529,529,4254,529,57894,57894,57894,57894,57894,57894,57894,59885,57894,57894,57894,57894,57894,57894,59890,57894,59892,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61462,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61476,57894,61604,57894,57894,57917,57917,57917,57917,57917,61610,57917,57917,57944,57944,57944,57944,57944,61616,57944,57944,0,0,4275,0,4277,529,529,529,529,529,529,57894,57894,57894,57894,60876,57894,57894,57894,57894,60880,57894,57894,57894,57894,57894,57894,57894,60886,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60649,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,3005,0,57917,57917,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,0,0,4295,0,529,529,529,529,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,4276,0,529,529,529,529,529,529,57894,354,0,0,0,0,0,397,398,400,401,0,0,0,0,0,0,0,0,0,0,0,400,401,0,0,406,0,0,0,0,0,371,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,379,0,0,0,0,371,0,388,0,379,409,0,400,401,0,0,371,0,0,354,0,0,0,371,0,412,414,0,371,401,0,0,371,379,0,139264,147456,401,412,0,0,0,131072,0,438,0,443,0,443,0,414,443,443,443,0,467,0,0,0,495,495,495,495,495,495,495,495,495,495,516,516,516,516,516,516,516,528,516,516,516,528,516,516,516,516,516,516,545,57911,545,57911,545,545,57911,545,545,57934,57911,545,545,57911,57911,57934,57911,57911,57911,57911,57911,57911,57911,57934,57934,57911,57911,57961,57911,57911,57911,57911,57911,57911,57911,57961,57961,57911,57911,57911,57911,57961,57961,57911,625,57911,57976,57976,57976,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,644,0,0,0,0,0,0,0,0,0,0,682,0,0,0,0,0,0,681,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2794,2795,0,2797,0,2799,0,0,0,0,0,0,0,0,2804,529,529,529,529,529,57894,57894,58266,57894,57894,57894,57894,57894,57894,58297,58299,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,58342,57917,57917,57917,57917,59515,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59526,57917,57917,57917,57917,57917,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58484,529,529,529,529,1145,914,0,57894,57894,57894,57894,58495,58333,155943,1153,0,0,0,0,58448,58450,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,1742,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,3491,529,529,529,529,529,529,0,0,0,0,0,1164,0,0,1166,0,0,0,0,0,0,0,0,0,0,0,0,1179,0,0,0,0,0,0,0,0,0,0,0,648,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3716,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3243,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,0,0,0,0,1312,1338,1339,0,1312,529,529,529,529,529,529,1347,529,529,529,1351,529,529,1362,529,529,1366,529,529,529,529,529,529,529,529,529,1420,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58846,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,58776,992,57894,57894,58801,57894,57894,58805,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58824,57894,57894,57894,58828,57894,57894,57894,57894,57894,57894,57894,60331,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60639,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,58919,57917,57917,57917,58923,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58943,57917,57917,57917,57917,57917,57917,57917,0,1793,0,1795,0,0,0,1799,0,0,0,1803,0,0,0,1807,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3486,0,529,529,529,529,529,529,529,529,529,529,57944,57944,57944,57944,57944,57944,57944,59549,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59567,59568,57944,57944,57944,57944,57944,529,3818,529,57894,61164,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1816,0,0,0,0,0,0,0,0,0,0,0,0,2318,0,2319,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2334,0,0,0,0,0,0,0,0,0,1855,0,1857,0,0,0,0,0,0,0,1864,0,0,0,0,0,0,0,0,0,0,0,0,0,312,411,313,0,0,0,0,0,0,313,416,0,0,139264,147456,0,0,0,0,0,0,0,0,0,1259,0,0,0,0,0,0,0,0,0,0,2378,0,0,0,0,0,0,0,0,0,0,2389,0,0,0,0,0,0,0,0,2838,0,0,0,0,0,2842,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2856,2420,0,0,2423,0,529,529,2426,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,57917,57917,59992,59993,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60004,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58889,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61129,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,60016,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,60028,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59626,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,57944,57944,60075,60076,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60087,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61490,0,0,4149,4150,0,0,0,0,0,0,0,529,529,529,4160,529,60099,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,2768,2769,57894,57894,57894,60117,60118,0,0,1732,0,0,1739,0,0,0,0,0,0,0,0,0,1882,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,863,529,529,529,529,529,529,529,529,529,529,529,529,2908,529,529,529,529,529,529,529,529,529,529,2919,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,61210,57894,57894,57894,61213,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60329,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60347,57894,57894,57894,57944,57944,57944,57944,57944,60449,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60461,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61146,57944,57944,57944,57944,57944,57944,57944,57944,61152,57944,61154,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,3256,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,0,2508,57894,57894,57894,57894,57894,57894,57894,57894,61314,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61330,57917,57917,57944,57944,57894,57894,61308,57894,61310,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61324,57917,61326,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,61545,57944,61547,57944,57944,57944,57944,0,0,0,0,0,0,0,0,0,0,4214,529,529,529,61449,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61463,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59488,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60384,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60396,57917,61477,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,4152,0,0,0,0,529,529,529,529,529,529,529,529,529,1974,529,529,529,529,529,529,1980,529,529,529,529,529,529,58776,1989,57894,57894,57894,57894,57894,59340,57894,529,529,529,529,529,4166,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61522,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59455,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60387,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,61535,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61548,57944,57944,57944,0,4208,0,0,0,0,0,0,0,0,529,529,4215,529,529,529,529,529,529,529,1972,1973,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,0,57894,57894,57894,57894,57894,57894,57894,0,0,2597,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59959,57917,57917,59963,4216,529,529,529,529,529,529,529,57894,57894,61566,57894,61567,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,61574,57917,61575,57917,57917,57917,57917,57917,57917,57917,57917,60671,57917,60674,57917,57917,57917,57917,60679,57917,57917,57917,60682,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,6e4,57917,57917,57917,57917,60005,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59489,57917,57917,57917,57917,57917,59496,57917,57917,57917,57917,57917,57917,57917,57917,59505,57917,57917,57917,57917,57944,57944,61582,57944,61583,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,58279,57894,57894,58295,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,413,0,0,0,131072,0,357,0,0,0,0,0,359,0,0,0,0,0,484,484,484,0,0,0,0,0,0,0,0,0,0,517,521,521,521,521,521,517,521,521,521,517,521,521,521,521,521,521,546,57912,546,57912,546,546,57912,546,546,57935,57912,546,546,57912,57912,57935,57912,57912,57912,57912,57912,57912,57912,57935,57935,57912,57912,57962,57912,57912,57912,57912,57912,57912,57912,57962,57962,57912,57912,57912,57912,57962,57962,57912,626,57912,57977,57977,57977,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,645,0,0,0,0,0,0,0,0,0,0,1856,0,0,0,0,0,0,0,1863,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,341,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2329,0,0,0,0,0,0,0,0,0,0,0,0,0,687,688,0,0,0,0,0,0,0,0,0,0,0,368,368,368,0,0,0,0,0,0,0,0,709,0,0,0,0,0,0,0,0,0,2321,2322,0,2324,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2338,0,0,0,0,796,0,0,0,0,0,0,0,0,645,0,0,796,529,848,529,529,529,529,869,873,879,529,884,529,529,529,529,529,529,529,529,529,2458,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3719,529,529,529,529,529,529,529,529,529,902,529,529,529,529,57894,57894,58267,57894,57894,57894,57894,58288,58292,58298,57894,58303,57894,57894,57894,57894,57894,58321,57894,57894,57894,57894,0,57917,57917,58343,57917,57917,57917,57917,59968,57917,59970,57917,57917,57917,57917,57917,57917,57917,59976,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59493,57917,57917,57917,57917,57917,57917,57917,57917,59502,57917,57917,57917,57917,57917,57917,57917,57917,58364,58368,58374,57917,58379,57917,57917,57917,57917,57917,58397,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,58418,57944,57944,57944,57944,58439,58443,58449,57944,58454,57944,57944,57944,57944,57944,58472,57944,57944,57944,57944,529,529,529,902,529,529,0,57894,57894,57894,58321,57894,57894,155943,1153,0,303,0,0,0,0,0,0,3181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,3227,307,0,0,0,0,0,0,0,0,1167,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1184,0,0,0,0,0,0,0,0,3211,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,870,529,529,529,529,529,889,529,529,529,1216,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1239,0,0,0,0,0,0,0,0,0,0,1883,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,4024,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,61383,57894,57894,57894,57894,57894,57894,1280,0,0,0,0,0,0,0,0,1289,0,0,0,0,0,0,0,0,0,1297,0,0,1167,0,0,0,1303,0,1305,0,0,0,0,0,0,0,3686,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3699,3700,0,0,0,0,529,529,4020,529,529,529,529,4025,529,529,529,529,4030,529,529,57894,57894,61379,57894,57894,57894,57894,61384,57894,57894,57894,57894,61389,1408,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1431,58776,916,58778,57894,57894,57894,57894,57894,58785,57894,57894,57894,57894,58791,58873,57917,57917,57917,57917,57917,58880,57917,57917,57917,57917,58886,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58907,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,58975,57944,57944,57944,58979,57944,57944,58990,57944,57944,58994,57944,57944,57944,57917,57917,57917,58920,57917,57917,57917,57917,58925,57917,57917,57917,57917,57917,57917,57917,57917,57917,58933,57917,57917,57917,58940,58942,57917,57917,57917,57917,57917,57917,57917,57917,57917,59453,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59471,59472,57917,57917,57917,57944,59001,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59014,57944,57944,57944,57944,59019,57944,57944,57944,57944,57944,59024,57944,57944,57944,59028,57944,57944,57944,57944,57944,57944,57944,57944,58468,57944,57944,57944,57944,529,529,529,898,529,529,0,57894,57894,57894,58317,57894,57894,155943,1153,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,389,57944,59035,59037,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59060,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60883,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61227,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60680,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,1153,0,0,0,1732,0,0,0,0,1739,0,0,0,0,0,0,0,0,0,0,1750,1751,0,0,0,0,0,1757,0,0,0,0,0,0,0,0,3687,0,0,0,3690,0,0,0,0,0,0,0,0,3698,0,0,0,0,0,0,3701,0,3703,529,0,0,0,0,1796,0,0,0,0,0,0,0,1804,1805,0,0,0,0,0,0,1812,0,0,0,0,0,0,0,0,0,0,0,0,335872,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,335872,0,0,0,0,0,0,1878,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1891,0,1893,1869,529,529,529,529,529,529,529,529,529,2483,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2494,529,529,529,529,529,529,529,0,0,2508,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59388,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61228,57917,57917,57917,57917,57917,57917,57917,61233,57917,57917,57917,57917,57917,57917,57917,57917,529,529,529,529,529,529,1905,529,529,529,529,1911,529,529,529,529,529,529,529,529,529,529,1922,529,529,529,529,1926,529,529,529,529,529,529,529,529,2457,529,529,529,2460,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,916,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59348,57894,57894,57894,57894,59354,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59365,57894,57894,57894,57894,59369,57894,57894,57894,57894,57894,57894,57894,57894,61456,57894,61458,57894,57894,61460,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,61470,57917,61472,57917,57917,61474,57917,57917,57944,57944,59544,57944,57944,57944,57944,59550,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59561,57944,57944,57944,57944,59565,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,57894,57894,3924,0,0,0,3926,0,0,0,0,0,0,3681,0,0,0,0,3937,0,0,57944,57944,57944,57944,59578,57944,57944,57944,59583,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60066,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59612,59613,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,2284,529,2286,529,529,59633,57894,59635,57894,57894,0,0,0,0,0,0,3448,3449,0,3450,0,3452,0,0,0,0,3454,0,0,0,0,0,0,0,0,0,0,0,3454,0,0,0,0,0,0,0,2864,0,0,0,0,0,0,0,0,0,2870,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,529,2435,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1387,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1402,529,0,2341,2342,0,0,2344,2345,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2365,0,0,0,0,0,0,3473,0,0,0,0,3478,3479,0,3481,0,0,3484,0,0,0,3487,529,529,529,529,529,529,3494,529,529,529,0,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,59863,57894,57894,57894,57894,59867,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58812,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58825,57894,57894,57894,57894,58830,57894,57894,57894,0,0,0,2369,0,0,0,0,0,0,0,2373,0,0,0,0,0,0,0,2381,0,0,0,0,2386,0,0,0,0,0,0,0,0,0,0,2372,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,335,336,337,0,0,0,0,0,57917,57917,57917,59967,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59977,57917,57917,57917,59980,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59522,57917,57917,57917,57917,57917,57917,57917,57917,57894,57944,59533,57944,57944,57944,57944,57944,57944,57944,59540,57917,57917,57917,60019,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60042,57944,57944,60046,57944,57944,57944,60050,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60060,57944,57944,57944,60063,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,3139,529,529,57894,57894,60486,57894,57894,0,0,0,0,0,0,0,0,0,0,57944,57944,57944,60102,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,2779,0,0,0,0,0,2862,0,0,0,0,0,0,0,0,0,0,2869,0,0,0,0,0,0,529,529,2876,529,529,529,529,529,529,529,529,529,529,529,2890,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1986,529,58776,1990,57894,57894,57894,57894,57894,57894,57894,529,529,529,529,2884,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2899,529,529,529,529,2902,529,529,2904,529,2905,60323,57894,57894,60327,57894,57894,57894,57894,57894,57894,57894,57894,57894,60336,57894,57894,57894,60339,60340,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60629,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60642,57894,57894,57894,57944,57944,57944,57944,57944,57944,57944,60425,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60440,57944,57944,57944,57944,60443,57944,57944,57944,57944,57944,57944,57944,57944,58470,57944,57944,57944,57944,529,529,529,900,529,529,0,57894,57894,57894,58319,57894,57894,295,1153,0,0,1157,0,60445,57944,60446,57944,57944,57944,57944,57944,57944,57944,57944,57944,60455,57944,57944,60459,57944,57944,57944,57944,57944,57944,57944,57944,57944,60468,57944,57944,57944,60471,60472,57944,57944,57944,57944,57944,57944,57944,59008,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,3660,0,0,3153,3154,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3171,0,0,0,0,0,0,0,0,0,2839,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2361,0,2363,0,0,0,0,3204,0,3206,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3219,0,0,0,0,0,0,529,529,529,529,529,529,529,529,2432,529,529,529,529,2436,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2487,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2501,529,529,529,529,3231,529,3234,529,529,529,529,3239,529,529,529,3242,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3864,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60622,57894,60625,57894,57894,57894,57894,60630,57894,57894,57894,60633,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60643,57894,57894,57894,57894,57894,57894,59909,59910,57894,57894,57894,57894,57894,57894,59917,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60634,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60692,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60709,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,0,0,0,0,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61090,57894,57944,60741,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60758,57944,57944,57944,57944,57944,57944,57944,57944,58473,57944,57944,57944,57944,529,529,529,903,529,529,0,57894,57894,57894,58322,57894,57894,155943,1153,0,0,0,0,1733,0,0,0,0,1740,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,352256,0,352256,352256,0,0,0,0,0,3444,0,0,3446,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3457,0,0,3460,0,3461,0,0,0,0,0,0,0,0,0,0,2310144,0,0,0,0,0,0,0,2310144,2310144,0,0,0,0,0,0,0,0,0,2310144,0,0,0,2310144,0,0,0,0,0,2310144,0,0,2310144,0,0,2310144,0,2310144,2310144,0,2310144,0,2310144,2310144,0,529,529,529,529,529,57894,57894,57894,60875,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60887,57894,57894,57894,57894,57894,57894,57894,57894,57894,60306,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,60895,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60909,57894,57894,57894,57894,57894,57917,57917,57917,60917,57917,57917,57917,57917,57917,57917,57917,57917,60929,57917,57917,57917,57917,57917,57917,57917,57917,60937,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59975,57917,57917,57917,57917,57917,57917,57917,57917,59982,57917,59984,57917,59987,57917,57917,57917,57917,57917,57917,60951,57917,57917,57917,57917,57917,57944,57944,57944,60959,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60971,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59553,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60732,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60979,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60993,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,3825,0,0,0,0,0,3828,0,0,0,0,0,0,0,0,0,0,0,0,0,3664,0,0,0,0,0,0,0,3670,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3196,0,0,0,0,0,3201,0,0,57944,57944,57944,57944,61139,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61149,57944,57944,57944,57944,57944,57944,61155,57944,61157,57944,57944,57944,0,0,0,0,0,4084,0,0,4087,0,0,0,0,0,529,529,529,529,529,529,529,529,529,529,529,4102,529,529,4104,3853,529,529,529,529,529,529,529,529,529,529,529,529,529,3862,529,529,529,57894,57894,57894,57894,57894,61211,57894,57894,57894,61215,57894,57894,57894,57894,57894,57894,57894,60647,57894,57894,57894,60650,57894,60652,57894,57894,57894,57894,57894,57894,57894,57894,60657,57894,57894,57894,57894,57894,0,0,57917,57917,57944,57944,57944,57944,61262,57944,57944,57944,57944,529,529,57894,57894,0,0,0,0,0,0,0,0,0,0,0,3681,0,0,0,0,0,0,0,0,0,0,2789,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,319488,319488,0,0,0,0,0,0,529,529,529,529,529,529,529,4168,57894,57894,57894,61516,57894,57894,57894,57894,57894,57894,57894,57894,61524,57894,57917,57917,57917,61529,57917,57917,57917,57917,57917,57917,57917,57917,61119,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60967,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,57917,61537,57917,57944,57944,57944,61542,57944,57944,57944,57944,57944,57944,57944,57944,61550,57944,0,0,0,0,0,4209,4210,4211,0,4213,529,529,529,529,529,529,529,529,2482,529,529,529,529,529,529,529,2488,529,529,529,529,529,529,2493,529,529,529,529,529,529,529,529,529,529,529,1910,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1928,1929,529,529,529,529,529,529,4219,4220,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,61570,61571,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,61578,61579,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,61586,61587,57944,57944,0,0,0,0,4248,0,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,58281,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,57917,57944,57944,57944,57944,4304,0,529,4305,57894,61650,57917,61651,57944,61652,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,57894,57917,57944,0,529,529,529,529,529,529,529,2456,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,3249,529,529,529,529,529,529,0,0,0,0,0,395,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,303,0,0,0,0,428,428,0,131072,428,0,0,0,428,0,0,455,0,0,0,428,0,485,485,485,0,0,362,362,362,362,504,362,362,362,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,485,547,57913,547,57913,547,547,57913,547,547,57936,57913,547,547,57913,57913,57913,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4276224,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,737,0,0,0,0,0,0,0,0,0,57913,57936,57913,57913,57913,57913,57913,57913,57913,57936,57936,57913,57913,57963,57913,57913,57913,57913,57913,57913,57913,57963,57963,57913,57913,57913,57913,57963,57963,57913,547,57913,529,907,529,529,529,57894,57894,57894,57894,57894,57894,57894,58289,57894,57894,57894,57894,57894,58308,57894,57894,57894,57894,58326,57894,57894,57894,0,57917,57917,57917,57917,57917,57917,57917,60927,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60945,57917,60947,57917,57917,57917,57917,57917,58365,57917,57917,57917,57917,57917,58384,57917,57917,57917,57917,58402,57917,57917,57917,0,0,0,0,58308,57944,57944,57944,57944,57944,57944,57944,58440,57944,57944,57944,57944,57944,57944,57944,59043,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,57917,57917,57917,57917,57944,57944,57944,57944,58459,57944,57944,57944,57944,58477,57944,57944,57944,529,529,529,529,907,529,0,57894,57894,57894,57894,58326,57894,155943,1153,0,1154,0,0,0,0,0,0,3685,0,0,0,0,0,0,0,0,0,0,0,0,0,3697,0,0,0,0,0,0,0,0,0,0,529,529,529,3943,529,529,529,529,3947,529,529,529,529,529,3953,529,529,529,57894,57894,57894,61302,57894,57894,57894,57894,1159,0,0,0,0,0,1165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1241,0,0,0,0,0,57894,58797,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60322,57894,58953,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,58977,57944,57944,57944,58986,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59048,57944,57944,57944,57944,57944,57944,57944,57944,529,1358,529,529,529,529,58797,57894,57894,57894,57894,57894,0,0,0,0,0,1765,0,0,0,0,0,0,0,1773,0,0,0,0,0,0,0,0,0,1783,0,0,0,0,0,0,0,0,0,0,695,0,0,0,0,368,368,368,0,0,704,0,0,0,0,0,0,0,711,0,0,0,0,0,0,0,0,1850,0,1852,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3678,0,0,0,0,0,529,529,529,529,1934,529,529,529,529,529,529,529,529,529,529,529,1947,529,529,529,529,529,529,529,529,529,529,529,529,1960,529,529,529,0,2506,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59875,57894,57894,57894,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,648,0,0,0,0,0,0,0,0,540672,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,329,0,0,375,375,407,0,57894,57894,57894,59377,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59390,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59403,57894,57894,57894,57894,57894,57894,57894,60901,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,60918,57917,57917,57917,57917,60922,57894,57894,57894,57894,57894,59415,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59426,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,59972,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59467,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59477,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59490,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59503,57917,57917,57917,57917,57917,57917,57917,60928,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60943,57917,57917,57917,57917,57917,57917,57917,57917,57917,61120,57917,57917,57917,57917,57917,57917,61126,57917,61128,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60968,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59573,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59586,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59599,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60081,60082,57944,57944,57944,57944,57944,57944,60089,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,0,57894,57894,57894,57894,57894,57894,295,1153,0,0,0,0,57944,57944,57944,59611,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,59622,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,3941,529,529,529,529,3945,529,529,529,529,529,529,529,529,529,3954,529,529,61300,57894,57894,57894,57894,61304,57894,57894,57894,57894,57894,57894,59416,59417,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,50679,0,57917,57917,57917,57917,57917,57917,57917,57917,57917,59486,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59983,57917,57917,57917,57917,57917,57917,57917,57917,0,2395,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,507904,507904,57917,57917,59966,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60949,57944,57944,60049,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60759,57944,60421,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60473,529,529,529,529,529,3233,529,3235,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,1990,57894,57894,57894,57894,57894,57894,57894,57917,57917,60666,57917,57917,57917,57917,57917,57917,60673,57917,60675,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60386,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,60715,57944,57944,57944,57944,57944,57944,60722,57944,60724,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60729,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3438,0,0,0,0,0,0,0,0,0,0,2334720,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,0,0,529,529,529,3856,529,529,529,529,529,529,529,529,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61218,57894,57894,57894,57894,57894,57894,61454,57894,57894,57894,57894,57894,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,61468,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58991,57944,57944,57944,57944,57944,529,529,529,529,529,529,4167,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,61523,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59998,59999,57917,57917,57917,57917,57917,57917,60006,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58393,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57917,61536,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,61549,57944,57944,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,2913,529,529,2917,529,529,529,529,529,529,529,529,529,2926,529,529,529,2929,529,529,529,529,529,529,529,529,529,529,529,3505,529,529,529,529,529,529,529,529,529,3514,529,529,529,529,529,529,529,529,3522,529,57894,57894,57894,61629,57894,57917,57917,57917,57917,61633,57917,57944,57944,57944,57944,61637,57944,0,0,0,0,529,529,529,529,57894,57894,57894,57894,57917,57917,57917,57917,57917,57917,57917,57917,57944,57944,57944,57944,57944,57944,57944,57944,4274,0,0,0,0,529,529,529,529,4281,529,57894,0,0,0,0,363,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,262739,0,0,0,0,373,373,0,131072,373,0,0,0,373,0,0,0,0,0,0,373,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,378,0,0,0,0,0,0,0,0,0,57914,57937,57914,57914,57914,57914,57914,57914,57914,57937,57937,57914,57914,57964,57914,57914,57914,57914,57914,57914,57914,57964,57964,57914,57914,57914,57914,57964,57964,57914,548,57914,57914,57914,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4276224,0,0,0,0,0,0,0,1270,0,0,0,0,0,0,0,0,0,0,57917,57917,58358,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,58433,57944,57944,57944,57944,57944,57944,57944,57944,59551,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60467,57944,57944,57944,57944,57944,57944,57944,57944,1309,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3467,57894,57894,57894,58802,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,57917,60664,57944,59036,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60881,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60310,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,0,0,1825,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1788,0,0,0,529,529,529,529,529,1935,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,1397,529,529,529,529,529,529,57894,57894,57894,57894,59378,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,59901,57894,57894,57894,57917,57917,57917,59478,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,59989,57917,57917,57944,59574,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60738,57944,0,0,0,0,0,3447,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,304,0,0,0,0,364,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,516569,516569,0,0,364,0,0,0,0,0,0,0,0,0,0,0,0,364,0,365,0,0,0,0,364,0,0,0,139264,147456,0,0,0,0,0,0,0,0,393687,0,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,393687,0,0,0,0,0,131072,0,0,0,444,0,444,0,365,444,444,444,0,468,0,0,0,496,496,499,499,499,499,499,505,506,499,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,549,57915,549,57915,549,549,57915,549,549,57938,57915,549,549,57915,57915,57938,57915,57915,57915,57915,57915,57915,57915,57938,57938,57915,57915,57965,57915,57915,57915,57915,57915,57915,57915,57965,57965,57915,57915,57915,57915,57965,57965,57915,627,57915,57978,57978,57978,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4276224,1261,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,308,0,0,0,0,0,0,308,0,0,0,903,529,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58322,57894,57894,57894,57894,0,57917,57917,57917,57917,57917,57917,57917,61243,57917,57917,57917,57917,57944,57944,57944,57944,57944,61249,57944,57944,57944,61253,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,58483,529,854,529,529,529,913,0,58273,57894,57894,57894,57894,58332,155943,1153,0,0,0,0,0,2368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1844,0,0,0,0,0,0,0,0,529,2425,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2469,529,529,529,529,529,529,57944,57944,60475,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,529,529,529,529,57894,57894,57894,57894,57894,0,0,0,0,0,0,0,0,0,0,0,664,0,0,667,668,0,0,0,0,0,0,0,0,0,0,679,0,0,0,0,0,57917,57917,58359,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,0,0,0,0,57894,57944,57944,57944,57944,57944,57944,58434,57944,57944,57944,57944,57944,57944,57944,57944,60054,57944,60056,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60460,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,0,1248,0,0,0,0,0,0,0,1256,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3170,0,0,0,0,3175,0,1153,0,1729,0,0,0,0,1736,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,0,0,529,529,529,2505,0,0,0,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60317,57894,57894,57894,57894,57894,57894,0,0,0,0,2784,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,320,0,0,0,0,529,529,529,529,529,529,529,2887,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,58776,1991,57894,57894,57894,57894,57894,57894,57894,529,908,529,529,529,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,58327,57894,57894,57894,0,57917,57917,57917,57917,57917,57917,58922,57917,57917,58926,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58937,57917,57917,58944,57917,57917,57917,57917,57917,57917,57917,57917,58882,57917,57917,57917,57917,57917,58894,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,60383,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,57917,58954,57917,57917,57917,57917,57917,57917,57917,57917,0,57894,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,60061,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,57944,529,2451,529,2453,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2901,529,529,529,529,529,529,57894,57894,57894,57894,59882,57894,59884,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60660,57894,57894,0,0,57917,57917,0,2858,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,529,529,529,2433,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,61209,57894,57894,57894,57894,57894,57894,57894,61214,57894,57894,57894,57894,57894,529,529,529,529,2910,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,529,2938,0,57894,57894,57894,57894,57894,529,529,529,57894,57894,57894,0,3424,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,139264,147456,0,0,0,422,3680,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,529,529,529,529,529,529,0,0,0,0,131072,0,0,0,0,0,0,451,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3676,0,0,0,0,0,0,0,0,0,0,0,0,0,2310144,0,0,2310144,0,0,0,0,0,0,0,2310144,0,2310144,0,0,0,0,0,0,2310144,2310563,2310563,0,2310144,0,0,0,0,0,2310144,0,0,0,0,0,0,0,0,0,0,2310144,0,0,0,0,0,0,2310144,0,0,0,0,0,0,0,0,0,0,2812,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1182,0,0,0,0,1186,0,0,2310144,0,0,0,2310563,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,338,0,0,0,0,0,0,2310144,0,0,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310741,2310144,2310741,2310144,2310144,2310741,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4276224,1261,0,0,0,0,0,0,1269,0,0,0,0,0,0,0,0,0,0,0,0,2318336,0,0,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1329,0,0,1332,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,0,0,0,0,0,0,4857856,4874240,0,0,0,0,0,0,0,0,0,3157,0,0,0,0,3161,0,0,0,0,0,0,0,3167,3168,3169,0,0,0,0,0,0,0,0,0,0,1314,0,0,0,0,0,1181,0,1320,0,0,0,0,0,0,0,0,0,1306,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,469,2335206,2335206,2335206,469,469,469,469,469,469,469,469,469,469,2335239,2335239,2335239,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4284416,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5341184,0,5652480,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,2335239,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1266,1268,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2342912,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,368,368,0,0,0,0,0,0,0,420,0,0,0,0,0,0,0,0,0,0,0,0,2359296,0,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,2359296,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1778,0,0,0,0,0,0,0,0,0,0,0,0,0,2359296,2359296,2359296,1,24578,3,0,0,4366336,0,0,0,0,0,303,304,0,4268032,307,308,0,0,0,0,0,0,0,0,0,0,0,0,0,4284416,0,0,0,0,0,0,466944,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2367488,0,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1818,0,0,0,0,0,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6275072,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,0,915,0,0,0,0,0,4857856,4874240,0,0,0,0,0,0,0,0,0,3476,0,0,0,0,0,0,3483,0,0,3485,0,0,529,529,3490,529,529,529,529,529,529,529,0,0,0,0,0,0,57894,57894,60285,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,57894,60293,57894,57894,57894,57894,0,5750784,0,0,0,0,0,5873664,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,0,991,4359059,5333907,5981075,4359059,0,5439488,5128192,4358144,5129107,915,5129183,991,5129107,4359059,0,4358144,915,991,4359059,0,4358144,915,991,4359059,0,4358144,915,991,4359059,6004736,6004736,0,0,0,1,24578,3,155943,155943,297,0,0,0,0,0,303,304,0,0,307,308,0,0,0,0,0,0,0,0,0,0,0,0,375,0,0,376,0,0,0,0,0,329,376,332,375,0,0,0,0,0,0,0,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,212992,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2354,0,0,0,0,0,0,0,0,0,0,0,0,0,212992,212992,212992,0,0,0,0,0,4366336,0,0,0,0,0,0,0,0,4268032,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,370,0,0,0,417792,0,0,0,0,0,5840896,5849088,0,0,0,0,0,0,0,0,0,0,0,0,6275072,0,0,0,0,0,0,0,0,0,0,0,0,404,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,335,0,0,0,0,0,0,0,0,0,0,0,335,385,387,0,0,4882432,0,0,0,0,0,0,0,0,5939200,0,0,5677056,6365184,4866048,0,6070272,5545984,5152768,0,0,6144e3,4358144,4866048,4882432,4358144,4980736,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5177344,4358144,4358144,4358144,4358144,4358144,5242880,4358144,4358144,4358144,4358144,4358144,4358144,4358144,5341184,4358144,4358144,4358144,4358144,6045696,4358144,6070272,4358144,4358144,4358144,4358144,6348800,4358144,6144e3,0,6144e3,0,4988928,5005312,0,0,0,0,5775360,0,0,0,0,0,0,0,0,0,0,5693440,5005312,4358144,4358144,4358144,512e4,5136384,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,4358144,6324224,5914624,5914624,0,0,0,0,0,5513216,5783552,0,0,0,0,0,0,0,0,0,0,6299648,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4825088,0,0,0,0],r.EXPECTED=[338,346,354,643,1667,362,993,370,376,384,457,464,421,392,905,405,418,429,683,461,437,445,472,410,480,1434,488,507,515,523,531,539,547,555,563,571,579,1039,664,971,598,598,597,883,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,589,1845,606,614,622,637,1159,672,2252,451,1636,691,654,706,1194,715,729,944,1366,737,1224,1357,1868,759,772,790,805,858,811,1898,1255,819,827,835,2141,1209,843,1935,851,873,891,899,1712,913,930,938,1362,952,960,968,979,981,1412,989,1001,1447,1016,1329,764,1024,1032,1051,1059,1067,1075,1083,1090,1098,1575,1106,1114,1122,1130,2068,1145,777,1153,1179,1167,2093,1514,1175,1187,2238,719,721,1697,1520,1517,1785,1202,1427,1558,1217,1232,1891,1240,1248,1263,1271,1279,1287,1461,1800,1307,1315,1323,1337,1345,797,742,1374,1382,585,1397,751,1352,1405,1297,1299,1929,1420,1763,1997,1442,1455,1469,2231,1477,1485,2046,2224,1493,1500,1508,598,2283,1528,2209,1536,1544,1008,1552,1682,2187,1137,1566,2138,1583,1598,1606,1043,1571,1614,1622,1630,1719,1644,1652,782,1660,1675,1690,1705,1727,1815,1735,1743,1751,1759,1771,1779,1793,1808,1823,1831,499,1839,1853,1861,2089,1876,397,629,1884,494,679,1906,1914,659,1590,1922,1990,698,1943,2040,1951,2108,1959,2156,1967,1975,1983,922,2005,2013,2025,2033,2054,2062,865,649,2076,2084,880,2101,2173,2116,2017,747,1389,2124,2132,1293,2149,2164,2181,2195,2203,2217,2246,2260,2268,2276,598,598,598,598,2169,598,920,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,598,709,2291,2295,2302,2302,2302,2297,2301,2302,2308,2306,2319,2312,2316,2323,2326,2330,2334,2338,2342,2346,2352,2352,3896,2351,2405,2352,2352,3897,2352,2352,5138,3782,3361,2526,2416,2416,2416,2475,2531,2531,2396,2516,2516,2516,2516,2524,2403,2352,2352,2352,2352,2352,2410,3782,2516,2516,2516,2427,2431,2352,2352,2352,2352,5037,4578,4790,4660,3361,3361,3361,3361,2415,2416,2416,2416,2417,2531,2531,2531,2495,2416,2416,2529,2531,2531,2531,2531,2531,2374,2516,2516,2496,2516,2516,2516,2516,2516,2376,3402,2416,2416,2531,2531,2531,2531,2531,2450,2516,2516,2516,2516,2517,2442,2352,2352,2352,4920,2761,2766,2352,2352,2352,4992,3361,3361,3361,3361,2414,2416,2416,2416,2416,2416,2421,2352,5036,2352,2829,3361,3361,3361,2488,2516,2516,2516,2516,2384,2352,2352,3158,2531,2531,2497,2516,2516,2382,2352,2352,2352,5037,4615,2352,2352,2352,4519,2352,2352,2352,3029,5036,4991,3361,3361,2414,2416,2416,2494,2531,2496,2516,2516,2454,2352,3882,4993,3361,2526,2527,2531,2532,2516,2464,3880,2830,2473,2528,2423,2516,2479,2486,2415,2530,2498,2506,3360,2416,2531,2516,4992,2473,2448,2515,2484,2473,2493,2503,3399,2513,2399,2521,2536,2540,2544,2548,2552,2556,2557,2557,2558,2562,2566,2557,2572,2568,2576,2580,2584,2588,2592,2596,2600,2604,2611,2352,2352,2352,2618,2352,2352,2352,5085,2352,2352,2352,2352,3168,2637,3849,2352,2353,2352,2352,2352,2352,2352,2352,2352,2352,4089,2663,2666,2669,2673,2677,2681,3991,2689,2352,2352,2352,2352,2352,2695,2703,3159,2709,2713,2352,2717,2721,2460,2352,2352,4582,4588,5123,4592,4599,3130,4274,3674,2723,2728,3992,2690,2352,2352,2358,2352,2352,2364,2352,2352,2352,4714,3949,2352,2352,2352,4537,2784,2352,2352,2352,2507,4646,2352,2352,2352,2630,2352,4452,2352,2352,2743,2747,2352,2352,2352,4538,2751,2352,2352,4614,4609,2352,2352,2352,2352,3782,2352,2352,4993,2776,2352,2352,2352,2352,3913,2780,2352,2352,4687,2352,2352,2352,3242,4732,2352,4610,2788,2352,2352,2352,2352,2352,2347,4696,2802,3554,2807,2352,2352,2352,2352,2352,4602,3509,2352,2352,2352,4661,2819,2352,2352,2352,2352,2352,2818,3617,2352,2834,4661,2847,2352,2352,2352,3002,3779,2352,2352,2352,3014,2352,2352,2352,2352,4081,3811,2352,3819,5010,2352,2352,2352,4784,2352,2352,2352,3140,2352,2352,3813,3183,5009,2352,2352,2352,4783,2352,2352,2352,3480,3485,2352,2352,2352,3839,2352,2352,2352,4464,3070,2352,2352,4771,3227,2866,2870,2352,2352,4742,4158,2352,2352,2352,4743,2791,2876,2352,3093,2870,2352,3797,4905,2352,2792,2352,2352,4904,2352,4478,4703,4241,2457,2457,2457,4703,4106,4242,4242,4242,4681,2902,4476,4241,4726,4243,4105,4477,4170,4167,4169,2906,2917,2936,2938,2942,2942,2945,2352,3221,2952,2974,2980,5136,2984,2352,2992,3405,2352,2352,4823,2352,4772,3955,4903,2352,2352,4965,2352,2352,2352,4713,4974,2986,4283,2352,3222,4906,2352,4040,2352,2352,5014,2352,2352,2352,2352,2352,3688,2352,2352,3e3,4196,3006,3010,3019,3570,4123,2918,3024,2352,2352,2352,3589,3034,2352,2352,2438,2352,2352,2352,3359,3361,2352,4683,3045,3181,3050,2352,2768,2352,2366,2352,2352,2352,2352,2352,2352,4373,4847,4756,2352,4862,3758,3020,2352,2352,3056,4228,2352,2352,2352,2352,3061,4906,2352,2352,2352,2352,2818,4906,2352,3784,3057,2352,2352,2352,4116,3069,2697,3074,2352,2386,2352,3796,4431,4865,3235,2352,4111,3080,2352,2352,2352,2352,2352,2354,2352,2352,3088,2352,2352,2352,2352,2352,3087,3092,2352,2352,3148,3119,2877,3125,2352,2352,2352,2352,2829,3361,3361,3361,3999,3129,2352,2352,2352,2877,3125,2352,2406,4093,3924,5109,4416,3439,3510,3769,2638,2352,4999,4455,3150,2882,3136,2640,4755,3145,4428,2970,3154,2352,3163,3167,2352,2970,3154,2352,2444,3173,2352,2625,2352,3698,2352,2352,2352,2352,2352,4355,2352,2352,3815,2639,4216,2607,3179,3187,2352,3460,3174,2352,3192,2352,3459,3188,3156,3204,4491,3211,4155,2352,3219,4153,4157,3255,3226,4670,3232,4156,3239,3256,4154,3548,3247,3271,3317,3317,3260,3264,3268,3275,3279,3283,3316,3313,3301,3305,3306,3310,3321,3325,3327,4192,3331,3292,3335,3353,4027,5129,3970,3365,3369,3373,3377,3381,3381,3382,2352,2352,4073,2352,4991,3386,3432,3500,3446,3396,3412,4095,3419,3423,4351,2827,3356,2724,3431,2825,2352,2654,4038,4028,4176,2837,3440,4940,4241,3028,4201,3452,3458,3464,5074,3473,3481,2352,2352,2352,4735,3490,2352,2352,2731,4325,3781,2434,2736,2352,2457,3540,4293,4512,2352,2352,3504,3509,3505,2352,2352,2352,2352,2352,3872,2352,3745,3388,3498,4300,4267,3532,4189,4302,3539,4505,4512,2352,2796,2352,2352,2352,2352,2732,4457,3587,3561,4970,3803,2352,3541,3595,2352,2798,4906,4953,2922,2927,4595,2932,3026,2352,2352,4310,2352,2352,3822,2352,2854,4228,2352,2352,2352,2976,2859,2352,4310,2352,2352,3534,2352,2352,3605,4907,3824,2352,3534,2352,4159,2352,4990,2352,4324,4304,2352,4322,2352,3614,2352,2896,2352,3253,4476,4240,2352,2459,4811,3106,2891,2352,3468,3108,2633,3107,3440,3440,3440,4811,3467,3108,3108,3108,3621,3439,3466,3440,4812,2892,3440,4968,4983,4985,3628,3629,3624,3633,2352,2352,2871,5105,2352,2352,2352,2352,4868,3860,2352,2352,2352,2988,3663,3667,2352,4081,3672,2352,4765,4769,3295,4825,3678,3686,3825,3693,3702,3706,3727,3634,3710,3715,3725,3731,2352,2352,2877,3141,2352,2352,2352,3135,4082,3673,2352,3736,2352,2632,3740,3749,3688,3753,3762,3766,2352,3297,3773,2352,2898,4680,3829,3882,2352,2352,2352,3913,2855,2352,2352,2352,3065,2352,2352,2352,2352,2823,2352,2352,2352,4081,3672,2352,4767,2691,2352,3289,3789,3689,2975,3801,2352,2352,5068,3895,2352,3013,5017,2352,2352,2352,2352,3013,2352,5101,2352,2352,2352,2352,2352,3807,3836,2352,2352,2352,2352,2352,4869,2352,3097,3221,3105,2639,2352,3001,3112,3888,3859,2352,2352,2352,2352,3865,2352,3130,3601,2352,2352,2352,3594,2352,2830,3361,3361,2489,2416,2416,2448,4261,3876,2352,2352,3083,2352,2352,2352,4e3,2352,2352,2352,5034,3927,3895,2352,2352,3785,3887,2352,2352,3041,2352,3433,2352,4556,2388,3926,3894,2352,2352,3925,3901,3250,3682,3912,2352,2352,3918,2352,3924,3454,4178,3792,2352,3931,2352,3902,3895,2352,4142,3348,3959,4654,4030,2655,4055,3965,3965,4653,4653,4030,4030,4030,4031,3964,4652,3965,4654,3969,3965,4030,2352,2352,3523,3527,2352,2352,2352,2352,3574,2352,2352,2352,2352,3831,3996,4004,4008,4012,4016,4017,4021,4025,4044,4050,4054,4914,4060,4064,3528,4080,4071,2913,4562,4078,4086,2352,2352,4515,4099,4103,2352,2352,2954,4110,2352,2352,3600,2352,2352,4159,3583,4235,4120,2352,2352,2352,3476,2352,2352,2352,4354,2352,2352,2352,2352,3347,2352,4991,4748,4134,2352,2480,2352,2352,2352,4139,2352,3207,4651,2352,2352,2352,2508,4647,4149,2352,2352,2621,2352,2367,4163,4174,4182,4186,4946,4200,2352,2352,2762,4135,2352,4354,2352,3349,4195,2352,4205,3861,4215,4029,4221,3175,4248,2352,2352,4637,4228,2352,2352,2352,2352,4226,2352,2352,3616,3469,3880,4697,2737,2772,4227,3227,4233,4379,2406,2911,4260,4239,4247,2352,2352,4252,2352,2352,2352,4465,4906,3743,2685,2909,4259,4222,4265,2352,3361,2489,2371,2531,2380,2499,2392,4271,2352,2352,4271,2352,2352,4280,2352,3493,2352,2352,2352,2352,3494,3732,2352,5045,3228,2684,2862,4584,4708,2352,3552,3582,3558,4255,4720,2352,3565,3920,2352,2352,4126,2352,2803,3348,2352,3590,2352,2352,2352,2352,3039,2352,2352,5150,2849,2352,2352,2352,4636,4125,4805,2705,4287,4291,5162,2352,5163,4330,2928,4314,4320,4490,4337,4337,4367,4329,2928,2928,2928,4056,4549,4336,4348,3855,4549,4550,4032,4334,4548,4341,4546,4345,4359,4363,4366,2352,2352,2352,3888,3870,2352,2352,2352,4371,4377,4145,4383,3195,4387,4391,4395,4399,4402,4406,4409,4410,4414,2352,2352,3832,2352,2352,2352,2352,3581,2352,4420,4425,4207,4211,4435,5117,2352,3638,3642,3646,3650,3654,3658,3662,4443,2840,4449,5144,4462,4469,3775,2352,3696,2352,4297,2843,4308,4489,4549,4475,3046,4482,2352,2352,2352,4421,4486,4495,4499,4437,4503,3130,4152,4509,3942,4523,2352,2352,2352,3030,4524,2352,2352,3908,2644,2352,4229,2652,2659,2352,4528,4532,4536,2352,2352,4543,4554,4209,3198,2923,4560,3131,3286,2850,2352,3711,4906,2352,2352,4772,3035,2365,2352,4570,2352,2352,2352,2352,2352,4574,3286,4791,2352,2352,2352,2626,4607,2352,3718,2352,3533,3609,2352,3535,2352,2881,4456,2886,2890,3408,2352,2888,4614,4609,4619,2352,2810,5061,4628,4635,4641,3215,4624,2352,2352,2352,2509,3155,4658,2352,2812,4665,4674,3130,3519,2352,3843,2352,3853,3681,3878,2352,2352,2958,4754,2352,2963,3756,2967,4276,4165,4701,4707,3794,2352,3888,4712,4730,4734,4739,4747,3157,4756,2352,4752,5019,4780,5006,2352,4788,3668,4763,4471,4799,3426,3721,4622,4622,4631,3392,4803,4809,4809,4816,4908,2647,4820,4830,4908,3846,2648,4837,2467,2469,4843,3391,2352,3883,4678,2352,2352,2352,3243,2352,3866,2352,2352,2352,3568,2654,2753,4217,4851,4855,4859,4873,4877,4881,4885,4888,4892,4896,4900,2352,2352,2352,2352,3784,3015,2352,2352,4912,3001,3339,3343,4918,4924,3200,4642,4930,4934,2352,2994,4458,4938,3577,2352,3888,4718,2352,3784,4724,2352,2352,3918,2352,3937,3946,3783,3953,2996,4944,2352,2352,3610,4950,2738,4316,3914,5055,4959,3948,2360,4682,2352,2352,4074,2352,4439,3437,3560,3444,4980,4989,2352,2352,3596,4997,3337,3341,3914,3933,4926,3214,5003,2352,2352,2352,4566,2352,2352,2352,2352,3514,3518,2352,2352,5023,2352,2352,2352,2352,2352,5027,2352,3889,2352,2352,4761,2352,3888,4776,3610,5041,3390,5049,5054,5059,5065,5072,5078,2352,2352,5082,2739,3960,5089,4690,5098,2352,2352,2352,2352,3984,2352,2352,4130,2352,2352,2352,2352,2352,2699,2352,2352,3977,4065,2352,2352,2352,2872,5113,2352,3890,4795,3392,3720,3169,2959,4763,3052,3448,4976,3121,2814,2352,2352,2352,4668,2352,2352,2352,2352,5031,5115,2352,2352,3414,5043,2352,2352,4066,5094,2352,2352,4445,4115,4839,2352,2352,2614,2352,4694,2352,2352,2352,5093,2352,5121,4833,2353,4961,2352,2352,3415,2352,2352,4514,2975,2352,4036,3433,5107,3115,2352,2352,4692,2352,2352,5091,2352,3912,3486,3895,4046,2352,2948,2352,3168,3906,2352,3254,4144,2352,3168,3545,2352,2352,2352,2352,2352,4603,5127,5133,4925,2352,2352,4067,2352,2352,4539,2752,2352,2352,2352,2757,3101,2352,4066,5142,2352,3100,3907,3426,5148,2352,5156,2352,5154,2352,5160,2753,3427,3076,2753,2352,3940,4826,4955,2352,3974,2352,2352,4757,3981,5050,3988,5167,5172,6366,6369,5182,5208,5230,5230,5224,6372,5193,5230,5230,5230,5230,6374,5201,5230,5230,5231,5190,5204,5207,5219,5215,5229,5223,5228,5230,5212,6374,5230,5235,5248,5249,5249,5245,5238,5253,5241,5257,5264,5271,5267,5260,5275,5281,5278,5285,5283,5287,5291,5168,5172,7462,5302,5325,5325,5325,5175,5323,5325,5325,5325,5325,5324,5325,5308,5314,5325,6062,5325,7497,5325,6243,5325,5325,5325,5327,5330,6892,6892,6893,5447,5432,5434,5434,5460,5365,5344,5359,5434,5434,5371,5375,5325,5325,5173,5325,6242,7516,5366,6892,5397,5405,5447,5447,5531,5434,5325,5364,5371,7023,7464,7466,5325,5325,5325,5328,5325,7029,5412,6059,5365,5371,6892,6892,6892,6892,5447,6892,6894,5447,5447,5447,5449,5434,5365,5373,5439,5406,7465,5304,5325,5174,5892,6415,5325,7032,5325,6064,5373,5464,5325,5325,5294,6251,6892,5445,5447,5447,5459,5434,5434,5370,5374,5325,5325,7202,5325,5325,5325,5882,5434,5434,5476,5376,5696,6140,5696,7271,5325,5365,5365,6892,6892,6892,6895,5534,5325,6061,5325,5325,5451,5325,5325,5365,5365,5365,5373,6892,6892,6892,5446,5447,5447,5447,5448,5434,5434,5434,5370,5449,5434,5434,5435,5325,5325,5325,5336,5340,7226,6892,5447,5447,5434,5434,5434,5434,5365,6892,5446,5448,5434,5365,5372,6892,6892,6892,5444,5447,5447,5447,5447,5434,5452,5364,5373,5446,5459,5362,5478,5450,5482,5486,5485,5484,5483,5325,5490,6205,7342,5501,5524,5494,5498,5580,5580,5580,5580,7344,5512,5518,5528,5548,5552,5580,5580,5580,5556,5562,5560,5566,5651,5575,5579,5555,5587,5584,5601,5608,5521,5615,5612,5626,5630,5630,5632,5634,5638,5642,5646,5504,5650,5514,5604,5655,5659,5663,5667,5665,5673,5669,5677,5681,5325,6422,5325,6607,6913,7034,6219,5975,5325,5325,7251,6734,7034,6607,5695,5325,5325,7252,6735,5702,5325,5325,5325,5337,5325,7143,5352,5325,5325,5325,6872,6065,5325,5325,5325,5346,5325,5325,6766,5593,7349,5325,5325,7306,5325,5325,5317,5743,5325,5325,5326,5325,6971,5774,5751,5325,5758,6647,5986,5778,5783,5782,5787,5791,5792,5796,5797,5801,5805,5806,5817,5810,5812,5816,5812,5811,5821,5824,5325,5325,7322,5325,5325,5401,5721,5325,5325,5325,5350,5830,5835,5325,5325,5326,5686,5690,6503,5543,6605,5325,5325,5327,6468,5842,5325,5325,5704,5900,5325,5325,5846,5853,5325,5325,5178,5874,6652,5884,5325,5325,5325,5354,7479,5885,5310,5325,5325,7355,5325,5325,6420,5900,5325,5325,5325,5376,5330,5907,5177,5325,5919,5946,5926,5934,5177,5927,5935,5325,5325,5325,5377,5945,5941,5928,5936,5950,5325,5325,5325,5382,6265,5720,5325,5325,5348,5325,5325,7351,6426,7166,5965,5971,5928,5983,7315,5991,5185,5392,7316,5973,5186,5393,5990,5928,5983,5325,5325,7355,6024,6030,6678,5719,5325,5325,5349,6043,5898,5325,5325,5325,5469,7460,5995,5393,5325,5325,7374,6244,5325,5325,6825,5352,7313,5990,5928,5996,5177,6e3,5721,5325,5325,5355,6434,5325,5325,5363,5365,5365,6915,6004,6243,5325,5325,7472,5325,5325,7478,5325,5327,5333,7488,5972,5929,5392,5325,5325,5325,7199,6915,5967,5973,5930,5393,5991,5929,5392,5325,5327,5838,6218,6242,5325,5325,6023,6029,5325,5325,5325,5746,5734,6030,5325,5325,5325,5753,6744,5325,5325,5325,5754,5325,6221,5325,7194,6018,5325,5325,5325,5767,5325,7193,6035,5325,5325,5379,7486,7202,5325,5325,7201,5325,6418,6416,5325,5328,6927,6218,5325,5325,6427,6819,6418,5325,5325,5325,5901,7500,5325,5176,5325,5325,5347,5325,5325,5325,5915,6056,6075,6079,6082,6084,6084,6088,6088,6090,6092,6092,6092,6092,6092,6093,6097,5325,5329,7488,6838,6758,5177,5325,5325,5383,6857,6312,5325,5325,5325,5952,5325,7097,6101,5766,7112,7161,6117,5325,5330,5295,6252,6061,6140,5325,5325,5325,5966,6107,5325,5325,6109,5826,6110,5325,7174,5325,5325,5425,6244,7172,6122,5325,5325,5455,7485,7492,5325,5325,6425,5325,5325,5325,5979,6102,5767,5325,6127,5325,6606,7110,5325,5330,5732,5736,7532,5325,6132,5325,6139,5325,6679,6155,6161,5325,5325,5507,5325,5325,5325,6245,7179,6162,5325,5325,5325,6004,5903,6157,5325,5325,5569,6701,5886,5325,5325,5325,6008,6757,6504,5325,5325,5618,6423,5330,6172,6187,6178,5393,5760,6173,6188,6715,5761,6174,6189,6716,7012,5325,5325,5325,6017,5690,6970,5325,5325,5622,5325,6183,6193,6715,5325,5330,6720,6908,5325,7e3,6184,6194,6202,6202,5325,5325,5325,6023,5325,6210,6209,5325,5330,6985,7033,5325,6228,5325,5325,5325,6060,5325,5325,6103,5768,6127,5325,5330,6985,7539,6677,6840,5325,5325,5622,7353,5297,6185,6258,5173,6259,5325,5325,5325,6061,6876,5754,6251,6193,6197,5325,5753,6250,6186,6196,5325,6102,6421,5325,6605,5325,6913,6063,6679,5325,6195,5173,5325,5325,5325,6062,5325,5325,5176,5325,6900,5296,6253,6196,5325,5325,5325,6065,7306,6257,6198,5325,5325,5325,6168,6263,6840,5325,5325,5683,5687,5691,5325,6269,6281,6198,5325,5325,5848,6271,6283,5325,5331,7234,6916,6236,5325,5325,6814,5173,6063,5683,7243,5325,5335,5339,7225,5325,6606,6913,6291,5325,6061,5325,5348,7242,6274,5325,5325,5684,5688,6758,7361,5325,5325,5325,6219,6220,7122,6421,6604,6914,6062,5325,6679,6065,6279,6275,5325,5337,7257,6585,5325,5325,7123,6422,5377,5325,7488,6837,5325,5325,5325,5848,6272,7361,7359,5325,5325,6148,7122,6421,5325,6149,7361,5325,5377,7358,7362,5325,6147,7362,5325,5377,7358,7362,5325,7356,7123,6422,7356,7360,5325,5346,5325,5379,5325,6971,6220,6220,6220,5325,5350,5325,5325,5977,6661,7359,5325,5325,7244,6421,7355,6151,5325,5325,6150,5325,5325,7357,7361,5325,7355,7359,5325,5325,6147,7362,5325,6287,7355,6222,7042,5325,7042,5325,6420,5325,6221,6420,6220,6851,6851,5325,5325,5697,5325,5332,5325,5325,6068,5856,5325,6134,6971,5325,5325,5325,6220,6606,6297,6504,5325,5353,6432,5325,5364,5365,5365,5365,5365,7486,6221,6915,6307,6322,6331,6328,6335,6338,6344,6340,6348,6350,6350,6348,6354,6359,6359,6359,6359,6355,5697,7351,6441,5177,5325,5325,5698,5325,5325,5325,6163,6840,5507,5325,5364,5365,6892,5440,7466,5325,5325,7173,5325,5325,7195,5177,5325,6387,5325,5325,5745,6986,6426,5325,7140,5325,6409,6455,5325,6449,5325,5376,5325,5325,5325,6433,5325,5325,5325,6241,5325,6439,6443,5325,5325,5766,5325,5325,5325,6222,6915,6038,5325,5325,5698,5330,6644,5325,5325,5329,5325,5377,6447,5325,5325,5325,6269,6281,5325,6453,5325,5325,5768,5325,5325,5325,6607,7154,6713,7103,5325,5384,5388,5392,5325,6942,5863,7155,6714,6714,5325,5325,5325,6315,5864,5400,6179,5325,5384,6858,6162,5325,5325,6241,6378,5325,6220,5325,5325,7329,7333,7152,5868,5868,5325,5325,5325,6421,5325,7330,7334,5865,5869,5325,5325,5325,6424,6065,7331,7335,5866,5870,5325,5325,5325,6428,6442,5325,5325,5325,6508,6607,5325,6840,5508,5325,5325,5325,6389,7331,6474,5867,7362,5325,5325,6148,5325,6212,5325,5325,5859,6013,6479,5176,5325,5325,5878,5380,5325,6063,5325,6483,5325,5427,5325,5325,6145,5325,6633,6489,6494,5325,5454,7484,6244,6214,5325,5325,6604,5698,6299,5698,6299,5325,5325,5902,6156,6162,6389,6500,5325,5325,5325,6522,6061,6509,6244,5325,5325,6212,5325,6604,6461,6607,5325,5325,5325,6523,5325,6514,5325,5325,5958,5325,6607,5325,6872,5325,5767,5767,5767,5767,6870,5766,5325,5768,6870,6871,5325,5325,5325,6612,6519,5325,7123,6231,5325,6527,5325,6234,6531,6537,6545,7221,6549,6553,6553,6555,6559,6559,6559,6559,6564,6563,6566,6570,6571,6571,6571,6571,6565,6575,5325,5325,5325,6632,5571,5428,5325,5325,5325,6657,7487,5325,6222,6837,5325,6289,5325,5922,6803,5177,5325,6877,5325,5325,5921,7362,5325,7392,5325,5472,5325,5325,6470,5325,7362,5325,5325,6865,5325,6884,5325,6885,6602,5325,5325,5325,6678,5325,6613,6603,5325,5508,5325,5325,5953,5325,5325,5325,6618,5325,6923,6600,5325,6614,5325,5325,5325,6869,5325,6425,5727,6383,5379,5325,7488,6219,6220,5325,5325,6459,7351,5325,6837,5325,6628,5325,6638,5895,5325,5537,5325,6607,6167,6914,6651,5325,5325,6224,5325,6656,6656,5325,5685,5689,6749,6665,7390,5325,5325,6006,7129,6672,6667,5325,5325,6063,5325,5325,5325,5330,6903,5325,6838,6420,6291,6065,6064,5325,6424,5325,5325,5325,6022,6223,6676,5325,5325,6063,5327,6069,6694,6688,6910,6700,6244,5325,5325,6063,6064,5683,7243,6424,6217,6382,5325,5696,6490,5325,5325,5325,6582,6290,6877,5325,6065,6634,6510,5870,6705,6684,6908,5325,5696,6623,5391,5325,6215,5327,5325,5696,7307,5325,5708,5399,5719,5378,5325,6971,5325,7488,6606,6721,6909,5325,5325,5325,6899,5325,6901,6905,6909,5325,6904,6908,5325,5325,6135,5325,6288,5325,5324,5922,5325,5325,6064,5325,5325,5325,5335,6907,5325,5325,5325,6900,7305,6841,6906,6910,5325,5325,5325,6877,5324,5326,5325,5325,5325,6903,6726,5325,5325,5325,6911,5331,6316,5325,5325,5325,6915,5325,6903,6910,5325,5325,6211,5472,5325,6242,5325,5325,5325,6902,6906,5325,6725,5325,5325,6217,5325,6242,5325,5329,5378,5325,5325,5325,7170,5325,7487,6837,5325,6291,5325,5325,5325,5325,7387,5325,5325,6221,6244,7487,5325,5325,5325,6918,7487,5325,5325,7486,5325,7487,5325,5325,7487,6220,6065,6730,6734,5325,5745,5733,5737,5325,6739,6748,5325,5747,5735,5739,6871,6244,5325,6067,5325,5325,6485,5401,6243,6065,7269,5325,5754,5298,6186,6259,7036,6324,6754,6762,6770,5413,6774,6778,6782,6787,6787,6787,6783,6791,6791,6791,6793,6795,6795,6795,6795,6799,6802,5325,5325,6244,5325,5325,6971,5325,5325,5915,5326,5325,6807,6217,5325,5325,6310,5325,5325,7370,5325,5325,6314,6318,6832,5325,5325,6813,6118,5325,5325,5325,6971,6607,6061,7277,5325,6839,6123,6222,5325,5325,5325,6983,6987,5325,6818,5325,5325,6363,5325,5325,5325,6533,6820,5325,5325,5325,6992,5571,6830,5325,6831,5325,5765,5544,5772,5837,6809,5325,5325,6398,5325,5325,6836,6846,6837,6141,6222,5325,5325,6416,6840,5325,6863,5325,5325,5325,6999,6859,5325,5325,5325,7013,6541,6839,6222,5325,5825,5325,5325,5471,5325,5325,5381,5385,5389,5393,5382,5386,5390,5177,5325,6889,5387,5391,5325,5848,6317,5325,5325,5325,6914,5325,6292,5325,6876,5325,5325,5325,7241,6273,7362,5325,5325,5325,6212,6808,6218,5325,5325,6417,5325,6417,5325,5325,6416,5325,6242,5325,7036,5325,5325,6971,6838,6420,7486,5325,5325,7458,5976,5325,5766,5325,5877,5379,6219,5325,6221,6219,5325,5325,5325,7098,6496,5325,5325,5325,7020,7253,6140,5325,5325,6419,5325,7089,7232,6916,7095,6928,5325,5325,5325,7123,6424,5325,6604,5975,5325,5325,7452,5389,5393,5325,5325,5325,5725,5325,6222,5325,5325,6420,5379,5974,5325,5325,5325,7201,5325,5325,7201,5325,6915,6849,5325,5325,6620,6624,5392,5325,5878,5380,6540,5325,6244,5325,7488,5325,6840,5325,7504,5325,5325,6460,7352,5325,6134,6934,5325,5883,5325,5325,5330,7267,5325,6133,6933,5325,5886,5325,5888,5325,7487,6604,6291,5325,7503,5325,5325,6465,5325,6938,5325,6219,6221,5325,6916,6039,5325,5325,5831,6214,6605,7503,5325,5325,6509,5325,6219,6222,5330,5325,5325,6066,6971,6948,5325,5325,6515,5325,5325,5325,6606,6947,5325,5325,5914,5325,7487,6605,7121,6971,5325,5325,7121,5913,7487,6605,5913,6404,6605,5914,5914,5325,5325,7121,5325,6413,5325,5383,5387,5391,5325,5914,6952,7487,6405,6954,6954,6954,6954,6971,5325,5325,7488,6958,6964,5325,5325,6521,6593,5325,7351,5325,5325,6591,6140,6976,7036,6420,5196,5325,6980,5197,6991,7351,6996,7004,7010,7017,7040,7046,7050,7062,7053,7056,7058,7066,7076,7076,7075,7068,7070,7071,7080,7080,7080,7080,7081,7085,5325,5325,6604,7526,5325,7374,6960,7362,5325,5325,7351,5325,6911,6062,6679,5325,5330,7350,6060,6238,5325,5325,5175,5325,5325,6605,5376,5325,6435,5325,5325,6608,5385,7104,5325,5327,5325,5910,5325,6420,5325,6604,5325,5325,5325,5453,5325,7120,5325,5325,6622,5390,5177,5325,7127,5325,5325,6631,7306,6007,5325,5325,5325,7203,5325,5325,5325,7134,5325,7159,7352,5325,6913,5325,5915,5325,5325,7121,6420,6417,5325,6420,7091,5325,7301,5976,6240,6921,6220,5325,5325,6646,5325,5347,5325,7165,5327,6484,5325,5325,5849,6732,6140,5325,7178,6641,7186,7179,7399,7187,5325,5325,5325,6246,7180,7400,6162,5325,5325,6589,6587,5325,5325,5325,7312,5940,5927,6900,6958,7191,5325,5915,5913,5325,5913,5325,5325,7121,7353,6911,5325,5325,6765,6401,6922,6221,5325,5325,6824,5325,5335,7207,7182,5714,5336,7208,5711,5715,5337,7209,5712,5393,5338,7181,5713,5177,7373,6959,6244,5325,6971,7458,7354,6912,5325,6416,7296,5976,5325,5176,5325,5960,6052,5325,6919,6220,5325,5921,7332,6475,5868,7213,5596,5714,5325,5325,5325,7314,5334,5338,7214,5597,5714,6842,6841,6971,5325,5954,5325,5325,6842,5325,6418,6420,7091,5325,5954,5325,7320,7026,5325,5325,5325,7452,5389,7218,5325,5325,5325,7456,5340,5597,7285,5325,5325,7284,5325,5325,5325,7488,5325,5325,6841,6971,7199,5325,5325,5325,7313,6417,5325,7230,5325,5961,5325,5326,7242,5325,7026,5325,5325,7238,7263,7248,5325,5325,6838,5325,5325,5325,5887,5334,7262,7258,5324,7354,5325,5325,6984,7538,5325,5325,7006,5976,6420,7275,6917,5325,5325,6839,5325,6921,5325,5325,5325,7503,7291,5325,5325,5325,7520,7509,7281,5325,5325,5325,6839,5507,7290,6140,5325,5325,6840,5325,7289,6735,5325,6841,6424,5325,5325,5330,6943,7267,5325,6416,5325,5978,6671,6666,7362,7295,5325,5325,5376,6971,6631,7300,5325,5325,6841,5325,5325,5325,5959,5325,6632,7307,5325,5325,5325,6841,6216,6381,5173,5325,5325,5958,6606,5325,7305,5325,5325,6048,6915,5325,5697,5325,6012,5973,6030,5325,6632,6918,5325,5325,6841,6971,5325,6425,5325,6068,6918,5953,6140,5325,7311,5952,6918,5325,5325,6853,5325,5953,6140,5325,5325,6871,5325,5767,5953,6140,6918,5376,5325,6577,6140,5325,6017,5325,5325,5379,5325,5325,5325,7306,6916,5698,5332,5325,6917,6578,5697,5325,5325,6876,6293,5696,5325,5698,5696,7326,5325,7350,7339,7350,5325,6213,5467,7137,5325,7146,5331,5325,7123,7380,6103,5768,5325,6128,5325,6606,5325,5330,6706,6710,6909,7149,6211,7348,7367,5420,7378,7384,5423,5320,7396,7404,7407,7410,7414,7417,7419,7417,7423,7424,7429,7428,7424,7433,7434,7434,7435,7441,7439,7445,7449,5325,6022,6028,5177,5325,5325,5325,5696,6918,6523,6595,5325,7033,5325,6972,6915,5325,5325,5325,6878,5325,6215,5325,5621,7352,5325,5325,5325,7527,5540,7363,7470,5325,5325,7476,7483,5325,5325,5325,6882,6062,7493,5325,5325,5325,6882,6915,6595,6420,6841,5325,6047,5325,5325,5380,5325,6877,5325,7354,5325,6826,5325,5729,7508,7514,5325,6060,5325,6870,5173,5325,7509,6291,5325,5325,6917,5325,5326,7521,7510,5325,6060,5766,5325,5766,5325,6872,6870,5325,5325,5325,6604,5365,5365,6594,6421,6425,5325,5325,6102,7525,5351,6840,5325,6062,6841,5325,6013,7460,6031,5325,5326,5731,6393,7532,5325,5325,5325,6967,6416,5728,5732,6394,7533,5729,6391,5738,6291,5730,6392,7531,5325,6063,6062,5325,5325,5325,5334,6595,6422,6426,5325,5325,5325,6932,5177,5333,5325,6066,5325,5325,6915,5325,5325,6216,5325,5325,6877,7351,5325,6913,5325,6677,5325,6061,5325,6069,6683,6688,7525,6742,5325,5325,6941,5862,7532,6870,5325,6140,5590,6596,6423,5325,6070,6695,6689,5325,6215,5325,5325,6983,7537,5325,5325,5325,6063,6826,5352,5325,6071,6696,6690,5734,5738,5325,5325,7035,5325,5325,7488,5738,5325,6140,6872,5325,5325,6920,6750,6912,6423,5325,5325,7090,6214,5325,6912,7033,5325,6303,5325,5698,5333,6917,5325,6114,5325,5325,5410,5417,6987,5325,5325,5325,7102,7108,6877,7352,5325,5325,7114,5388,5325,7115,5325,5325,7116,5325,7114,5325,5325,5325,7130,6971,5325,2,4,8,262144,262144,1048576,1073741824,0,0,0,2147483648,0,0,0,-1979711488,4194560,4196352,270532608,2097152,4194304,8388608,234881024,268435456,37748736,-1606418432,541065216,541065216,-2143289344,-2143289344,4194304,513,32768,0,0,-2143289344,-2143289344,-2143289344,4194304,4194304,4196352,-1606418432,541065216,-2143289344,4194304,4194304,-2143289088,4196352,-1606418432,-1606418432,541065216,4194304,4198144,4194304,4196352,276901888,8540160,8425488,4194304,4194304,4194304,16777216,4194304,541065216,4194304,4194304,4194304,4194304,4194432,541065216,37748736,742391808,239075328,239075328,171966464,775946240,4718592,64,4718592,171966464,239075328,171966464,775946240,171966464,171966464,171966464,171966464,239075328,239075328,775946240,775946240,2097216,4720640,541589504,4194368,-2143285440,-1606414528,-1606414528,541589504,541589504,4194400,4194368,541065312,541065280,-2143289280,-2142763008,541589504,541065280,4194368,-2143285440,-2143285408,-2143285408,-2143285440,-2143285440,-2143285440,-2143285440,-2142761152,-1606414528,-2143285440,-2143285440,-1605890240,-2142761152,-2109731008,776470528,-1908404416,775946304,775946304,-1908404416,2,4,8,64,128,512,1024,2048,0,256,2048,2048,2048,2048,8192,8392704,0,0,-570425344,32505856,16384,1536,1792,0,2147483648,65536,65536,4224,65536,16777216,16777216,0,0,0,0,1,0,0,0,2,0,0,0,3,4,16,224,256,512,32768,96,96,0,0,0,1073741824,0,0,16384,0,0,0,118,577408,22020096,0,1536,64,524352,0,0,524288,524288,524288,524288,0,524352,524288,524288,524288,64,64,64,0,0,0,8,0,0,0,12,32,64,1024,2048,57344,262144,50331648,268435456,1073741824,2147483648,0,0,64,64,262144,1048576,4194304,16777216,33554432,268435456,0,128,128,128,128,0,8388608,4096,4096,4096,4096,29696,4096,1536,1024,0,-2113929216,100663296,100663296,4224,0,0,262144,33554432,134217728,0,0,96,64,524352,524352,524352,524352,0,64,64,128,128,128,64,64,64,96,96,96,96,524352,524352,0,0,0,15,208,15360,96,524352,524352,524352,524288,64,64,128,2048,64,0,0,32768,50331648,268435456,0,0,524352,524288,524288,64,64,96,524288,64,96,524352,0,524288,64,96,0,4096,536870912,1073741824,1056,262176,1048608,2097184,4194336,536870944,32,32,4,1073872896,32,0,32,0,0,8388608,1073741824,0,1073872896,40,262176,32,32,41,96,32,34,34,32,32,32,40,96,160,40,48,1120,96,0,64,524352,524288,64,0,0,2101248,0,0,3751936,0,0,5242880,0,0,4195360,6291488,2097184,2097184,4194336,4194336,4194336,32,56,262184,40,262184,40,262184,40,40,40,4195104,40,40,262176,32,128,256,2048,262144,524288,96,6292512,4195360,2097184,6292512,32,32,32,32,56,0,4,262184,32,32,32,512,2048,262144,0,65536,65536,131072,262144,2097152,8388608,40,4196128,32,262184,32,42,224,34,42,32,327155712,1056,1056,2098208,42,1056,4194336,32,262144,524288,0,0,16777216,0,0,4457568,-326784344,-322851160,-322851160,-322698144,-322698144,-322698144,-322698144,-322695456,-322695456,-322695456,-322695456,-322597152,-320598176,-322597152,-322597144,-321548576,-320598168,-322597144,-322588952,-321548568,-322588952,-321548568,-322597144,96,32,32,40,1120,40,262176,42,106,293601323,293601323,293863467,293699627,293617707,293716011,293702203,293702203,293702203,293702203,293702267,297896507,293964347,297896507,293702203,293702203,297896507,293964347,297896507,-322597144,-37744981,-322597144,-321548568,-37482773,0,0,1,4,8,32,64,512,2048,16384,67108864,0,48,0,0,0,64,0,0,0,318767104,0,0,1,4096,0,32,64,65536,393216,10485760,16777216,33554432,1073741824,2147483648,0,33554432,268435456,536870912,2147483648,0,0,0,262144,65536,0,0,1,2,12,16,64,128,1024,2048,4096,8192,65536,131072,0,262144,262144,0,0,2,8,16,64,262656,262144,0,0,2,12,64,262144,328192,0,0,2,204,768,-2147483646,0,0,0,1024,0,0,524288,5242880,0,0,2,65536,201330721,201330721,201330721,-2111369023,-2111360575,-2111369023,-2111369023,-2111369023,-2111369023,-1977151295,-1977151293,-1910042431,-1893265183,-2111368509,-1893265183,-1893265183,-1893265183,-553689472,-553656704,-553689472,-553656704,-553689472,-553689472,-553656704,-553656704,-553689472,-553689472,-553656704,-553656704,-553656704,-553656704,-553656672,-553656664,-553656672,-553656672,-553656672,-553656672,-553656670,-553656608,-553656672,-553656672,-553656672,-553656664,-536912159,-553656671,-536879391,-536879391,0,0,0,1040,1040,262656,0,0,0,1536,0,328192,0,0,2,67108864,0,0,458880,2097152,-1845493760,462976,-2113929216,0,0,4,8,256,471424,0,-2113929216,0,0,67108864,0,0,134217728,128,256,3584,16384,32768,524288,4194304,33554432,134217728,536870912,0,0,-1912602624,18874368,463488,0,0,134217728,4096,0,0,104e4,15728640,-570425344,0,0,0,2014,0,0,0,128,196608,2097152,8388608,536870912,0,0,201326592,0,0,0,1998,518144,8388608,0,256,12288,0,0,486539264,0,0,33554432,268435456,0,0,167772160,234881024,0,0,4,16,0,196608,786432,1048576,2097152,4194304,8388608,134217728,268435456,4194304,8388608,503316480,1073741824,2147483648,0,7168,16384,32768,196608,786432,0,128,512,7168,16384,2147483648,16777216,0,0,4,64,128,8388608,0,512,0,0,1,1,0,234881024,128,512,3072,16384,32768,4096,16384,131072,524288,1048576,2097152,0,0,0,62,64,128,234881024,268435456,1073741824,2147483648,-2147418112,5242880,-1842937664,16384,32768,131072,524288,1048576,8388608,33554432,201326592,268435456,1073741824,0,1048576,4194304,268435456,131072,2097152,0,0,7,27756528,-503316480,0,0,512,3072,16384,131072,1048576,4194304,2147483648,0,0,0,512,3072,131072,524288,1048576,524288,1048576,4194304,134217728,2147483648,0,0,524288,4194304,2147483648,0,0,536870912,0,0,16384,18432,67108864,1073741824,16384,8192,0,0,8192,18952,0,65,100663298,18952,1024,65,1024,1024,0,0,0,16,0,0,0,4,0,0,0,6,56,128,2101248,524288,1024,268436480,1024,19017,-1744550912,8388624,8388624,-1739308032,-1739308032,-1739308032,-1739308032,-1736162288,-1736162288,-1736162288,-1736162288,-7868466,-7868466,-7868466,-7868466,-7868450,-7868450,-7868450,-7868450,-7868450,65,0,2,33554432,0,0,1024,5521408,-1744830464,0,0,-1744830464,0,0,1040,8667136,-1744830464,0,0,0,9216,-67108864,0,0,0,13312,0,4096,2097152,0,0,278528,0,0,0,16384,32768,0,16,8388608,0,0,0,12288,5242880,2147483648,0,0,8,512,2048,131072,536870912,0,518144,8388608,50331648,201326592,805306368,-1073741824,805306368,-1073741824,0,0,0,18432,72,0,0,0,24576,204,768,1024,10240,16384,32768,50331648,67108864,134217728,805306368,0,768,1024,2048,8192,16384,32768,458752,8388608,50331648,67108864,16384,32768,458752,50331648,67108864,536870912,1073741824,0,0,134217728,805306368,1073741824,0,0,536870912,1073741824,0,208,0,0,0,32768,0,0,0,65536,0,0,0,131072,0,0,0,48,25165824,16384,67108864,268435456,0,0,1073741824,16384,0,0,16384,2097152,0,1572864,0,0,0,134217728,0,0,0,7,16,64,128,512,2048,8192,16384,458752,16384,458752,50331648,67108864,805306368,1073741824,16,0,0,1048576,4194304,33554432,4,8,128,512,2048,196608,262144,33554432,536870912,0,8,512,2048,196608,262144,50331648,536870912,1073741824,512,0,0,4096,1048576,0,0,0,393216,0,64,256,8192,2097152,2147483648,0,64,64,16392,268435456,0,537395200,537395200,0,0,1073741824,18432,0,0,8,16,512,402653184,0,0,0,537395200,0,32768,0,2048,0,4212736,4212736,4212736,537395200,4212736,1082130432,537427968,4212736,51380242,51380242,22038531,22366211,22366211,22366211,55592978,22366219,22366211,22366219,22366227,55592978,55592978,55592978,55592978,324028498,55592978,55592978,1062785014,1062785014,1062785014,0,1062785014,1062785014,1062785014,1062785014,16384,32768,268435456,0,0,1075838976,2097152,2097152,268435456,4194432,3145728,541065216,541065216,541065216,541065216,4096,0,8,0,1,0,67108864,1073741824,0,0,557056,0,0,16,64,128,3072,4096,8192,65536,18,17825792,33554432,0,1,67174400,33554432,268435456,0,268435456,0,346112,0,0,11,0,82,301989888,0,0,0,2048,0,0,0,4096,0,0,8192,0,0,0,44,64576,577408,22020096,1040187392,0,0,0,393744,0,256,0,8192,2097152,0,2147483648,0,0,327680,0,0,18,33554432,80,268435456,0,0,19,0,0,524288,0,64,0,2097152,0,16,33554432,0,2,0,65536,201326592,2147483648,256,1536,16384,32768,524288,0,256,8192,2097152,1,0,0,65536,262144,1048576,256,1536,32768,524288,0,4194304,134217728,536870912,0,4194304,131072,1536,32768,524288,134217728,268435456,2147483648,0,0,0,64,1536,32768,524288,4194304,0,1536,32768,0,0,16384,1073741824,0,0,32,512,2048,32768,0,1073741824,0,67174400,8,8,0,0,60,64576,8,268435456,134217728,131072,128,536870912,0,0,8,131072,4194304,-2146430976,16908320,547389524,547389524,547389524,555909216,555909216,555909216,555909216,564297840,564297844,564297844,564297844,564297844,564297844,1001055742,1001055742,1001056254,1001055742,1001056254,1001056254,1001055742,1001055742,1001056254,1001056254,1001056254,1001056254,1001056254,1001056254,0,0,64,128,8388608,0,84,2129920,8388608,16777216,0,0,9728,268435456,0,0,2048,32768,262144,524288,8388608,0,0,1280,2809856,58720256,939524096,0,0,0,524288,0,0,0,28,0,254,1792,2809856,58720256,939524096,0,939524096,0,0,64,2048,16384,32768,262144,50331648,4096,1048576,2147483648,0,2,4,16,64,128,256,0,20,64,32768,65536,2490368,16777216,33554432,0,0,16,33554432,2147483648,163840,0,0,0,1007232,52,0,0,0,104e4,64,128,1280,24576,163840,524288,2097152,58720256,402653184,536870912,128,1792,24576,163840,524288,25165824,0,0,0,1048576,4194304,0,56,128,1280,8192,524288,16384,131072,524288,58720256,402653184,0,56,128,1792,8192,16384,131072,256,262144,524288,33554432,134217728,2,4,24,32,128,1792,8192,524288,16777216,33554432,67108864,134217728,805306368,1073741824,2147483648,4,8,16,1024,16777216,4,8,16,402653184,0,8,256,512,2048,8192,32768,8388608,0,0,67108866,12,4,16384,0,0,4194304,2147483648,0,65536,67108864,0,0,0,131584,268435460,32768,8192,2048,16384,67108864,134217728,268435456,8192,3670016,2048,8192,0,65536,0,65536,8192,8192,34816,9216,29712,29712,29712,29840,536900624,29712,29840,29840,4224144,144384,144384,144384,-754647956,144384,144384,144384,144384,-754647956,-754647956,-754647956,-754647956,-754647940,-754647940,-754647940,-754647940,-754516884,-754647956,-754516884,-754516884,0,0,0,1052672,2,67108864,12,16384,0,65536,34816,0,0,0,1114112,44,64576,319029248,-1073741824,0,0,60,0,0,0,2097152,0,0,319160320,0,0,0,3670016,28672,0,0,0,4194304,0,0,0,8192,268435456,16,0,128,536870912,4194304,131072,0,131072,0,0,131072,1024,2048,61440,262144,318767104,-1073741824,318767104,-1073741824,0,0,112,25165824,28,0,0,0,8388608,0,0,393216,0,0,0,16777216,2147483648,0,24576,0,0,116,0,0,12,16,32,64,64,64,64,32,96,96,1,0,0,2,4,8,16,512,1024,16777216,33554432,402653184,0,0,0,262144,0,0,0,128,0,0,0,192,0,0,0,254,2,67108864,16384,0,65536,16384,32768,50331648,268435456,2147483648,0,0,50331648,268435456,0,2,4,112,128,256,0,524288,536870912,0,0,0,33554432,268435456,268435456,268435456,268435456,32,524288,1048576,33554432,67108864,134217728,67108864,134217728,536870912,0,2,4,134217728,268435456,0,0,0,29696,0,256,0,2048,256,262144,2113536,0,2,8,64,128,1024,4096,0,256,0,0,32,128,0,2097152,135790592,0,2,12,192,768,256,32768,0,0,128,131072,256,262144,0,0,220,0,0,0,32768,2097152,0,2,16,1048576,128,128,128,0,2097152,0,0,8388608,8388608,4096,0,0,0,32,0,0,2147483648,2097152,0,0,512,131072,4,0,0,33554624,4,131585,0,131585,4,393745,1610612736,1610612736,393753,393753,393753,393753,0,135790592,131585,131585,805708305,805708305,1879450129,1879450129,-483948553,-475559945,-483948553,-483948553,-475559945,1879450129,1879450129,1879450129,1879450129,805708561,-475559945,-475559945,-475559945,-475559945,-215504905,-475559945,-207116297,-207116297,-207116297,0,4096,4194304,1,512,32768,0,2113536,0,0,520,0,65,401936,805306368,0,0,0,393752,0,1879048192,0,0,1024,585,0,0,8,64,0,0,402192,0,0,0,33554432,0,0,7,19367920,-503316480,0,0,0,50331648,0,19376112,-234881024,0,2,301989888,0,3,22020096,0,1,285212672,0,0,33554432,33554432,8192,0,2048,16384,32768,524288,1048576,4194304,16777216,27764720,-234881024,0,0,1024,278528,24,0,0,0,167772160,8704,268435456,0,0,1998,59238400,-67108864,0,7,16,480,1536,32768,65536,393216,2097152,33554432,536870912,-1073741824,0,0,67108864,134217728,0,0,2048,131072,524288,4194304,8192,268435456,0,0,2048,4194304,0,0,16,224,256,1536,32768,65536,256,512,1024,32768,65536,192,0,0,131072,131072,131072,134217736,32768,131072,262144,2097152,16777216,4096,1,512,32768,0,0,513,32768,0,192,131072,0,4,8,512,2048,0,0,131072,2097152,16777216,0,4,8,2048,8192,32768,512,32768,131072,2097152,8388608,4,16,224,512,32768,4,524288,134217728,0,8388608,0,64,0,4096,32768,0,0,29824,536870912,16,192,32768,8388608,16777216,1073741824,0,0,2,4,16,192,32768,0,4096,0,128,0,16384,64,128,0,0,16384,16,64,128,8388608,0,0,4,0,0,128,512,3072,4096,16384,32768,4,128,0,0,32768,8388608,8388608,33554432,2147483648,0,4,16,32,64,128,256,1536,2048,16384,4096,0,33554432,0,4,32,32,524320,32,33554436,262144,33554432,0,0,0,256,0,0,0,512,2048,131072,33554432,536870912,0,0,0,528,2,2048,32768,0,4,268435456,0,2,4,32,524288,2,33554436,0,0,32768,268435456,33554436,4224,4224,0,8,16,402653184,536870912,0,0,96,2260992,262400,65536,65536,65536,10878976,16777216,33554432,536870912,4224,-1072627712,805306384,-1342177264,-1070006272,-1070006272,-1069989376,-1069989376,-1069989376,-1069989360,-1065795072,-1061600768,-1069989376,-258932720,-258932720,-258932720,-258932720,-225378288,-258932720,-225378288,1260767,1260767,34815199,1260767,1260767,34815199,34815199,1260767,34815199,1260767,169032927,169032927,169032927,169032927,1242774751,169032927,169032927,-1978450721,169032927,-1978450721,169032927,-1978450721,-1978450721,-225231649,-1173144353,-225231649,-225231649,-91013921,0,8,64,2048,16,536870912,0,0,524288,1048576,2097152,4194304,128,128,2048,2048,2048,0,7946240,12140544,0,0,524288,3145728,0,9502720,1610612736,0,0,0,32505856,208,15360,1245184,0,0,0,268435456,0,0,0,15,9633792,0,0,3670016,0,0,16384,0,67108864,0,0,536870912,131072,0,80,128,7168,8192,196608,1048576,196608,1048576,0,0,524288,134217728,1,2,12,80,128,0,3145728,0,0,0,3735552,8192,65536,131072,1048576,0,0,128,1024,4096,8192,0,0],r.TOKEN=[\"(0)\",\"PragmaContents\",\"DirCommentContents\",\"DirPIContents\",\"CDataSection\",\"Wildcard\",\"EQName\",\"URILiteral\",\"IntegerLiteral\",\"DecimalLiteral\",\"DoubleLiteral\",\"StringLiteral\",\"PredefinedEntityRef\",\"'\\\"\\\"'\",\"EscapeApos\",\"ElementContentChar\",\"QuotAttrContentChar\",\"AposAttrContentChar\",\"PITarget\",\"NCName\",\"QName\",\"S\",\"S\",\"CharRef\",\"CommentContents\",\"EOF\",\"'!'\",\"'!='\",\"'\\\"'\",\"'#'\",\"'#)'\",\"'$'\",\"'$$'\",\"'%'\",\"''''\",\"'('\",\"'(#'\",\"'(:'\",\"')'\",\"'*'\",\"'*'\",\"'+'\",\"','\",\"'-'\",\"'-->'\",\"'.'\",\"'..'\",\"'/'\",\"'//'\",\"'/>'\",\"':'\",\"':)'\",\"'::'\",\"':='\",\"';'\",\"'<'\",\"'<!--'\",\"'</'\",\"'<<'\",\"'<='\",\"'<?'\",\"'='\",\"'>'\",\"'>='\",\"'>>'\",\"'?'\",\"'?>'\",\"'@'\",\"'NaN'\",\"'['\",\"']'\",\"'after'\",\"'all'\",\"'allowing'\",\"'ancestor'\",\"'ancestor-or-self'\",\"'and'\",\"'any'\",\"'append'\",\"'array'\",\"'as'\",\"'ascending'\",\"'at'\",\"'attribute'\",\"'base-uri'\",\"'before'\",\"'boundary-space'\",\"'break'\",\"'by'\",\"'case'\",\"'cast'\",\"'castable'\",\"'catch'\",\"'check'\",\"'child'\",\"'collation'\",\"'collection'\",\"'comment'\",\"'constraint'\",\"'construction'\",\"'contains'\",\"'content'\",\"'context'\",\"'continue'\",\"'copy'\",\"'copy-namespaces'\",\"'count'\",\"'decimal-format'\",\"'decimal-separator'\",\"'declare'\",\"'default'\",\"'delete'\",\"'descendant'\",\"'descendant-or-self'\",\"'descending'\",\"'diacritics'\",\"'different'\",\"'digit'\",\"'distance'\",\"'div'\",\"'document'\",\"'document-node'\",\"'element'\",\"'else'\",\"'empty'\",\"'empty-sequence'\",\"'encoding'\",\"'end'\",\"'entire'\",\"'eq'\",\"'every'\",\"'exactly'\",\"'except'\",\"'exit'\",\"'external'\",\"'false'\",\"'first'\",\"'following'\",\"'following-sibling'\",\"'for'\",\"'foreach'\",\"'foreign'\",\"'from'\",\"'ft-option'\",\"'ftand'\",\"'ftnot'\",\"'ftor'\",\"'function'\",\"'ge'\",\"'greatest'\",\"'group'\",\"'grouping-separator'\",\"'gt'\",\"'idiv'\",\"'if'\",\"'import'\",\"'in'\",\"'index'\",\"'infinity'\",\"'inherit'\",\"'insensitive'\",\"'insert'\",\"'instance'\",\"'integrity'\",\"'intersect'\",\"'into'\",\"'is'\",\"'item'\",\"'json'\",\"'json-item'\",\"'jsoniq'\",\"'key'\",\"'language'\",\"'last'\",\"'lax'\",\"'le'\",\"'least'\",\"'let'\",\"'levels'\",\"'loop'\",\"'lowercase'\",\"'lt'\",\"'minus-sign'\",\"'mod'\",\"'modify'\",\"'module'\",\"'most'\",\"'namespace'\",\"'namespace-node'\",\"'ne'\",\"'next'\",\"'no'\",\"'no-inherit'\",\"'no-preserve'\",\"'node'\",\"'nodes'\",\"'not'\",\"'null'\",\"'object'\",\"'occurs'\",\"'of'\",\"'on'\",\"'only'\",\"'option'\",\"'or'\",\"'order'\",\"'ordered'\",\"'ordering'\",\"'paragraph'\",\"'paragraphs'\",\"'parent'\",\"'pattern-separator'\",\"'per-mille'\",\"'percent'\",\"'phrase'\",\"'position'\",\"'preceding'\",\"'preceding-sibling'\",\"'preserve'\",\"'previous'\",\"'processing-instruction'\",\"'relationship'\",\"'rename'\",\"'replace'\",\"'return'\",\"'returning'\",\"'revalidation'\",\"'same'\",\"'satisfies'\",\"'schema'\",\"'schema-attribute'\",\"'schema-element'\",\"'score'\",\"'select'\",\"'self'\",\"'sensitive'\",\"'sentence'\",\"'sentences'\",\"'skip'\",\"'sliding'\",\"'some'\",\"'stable'\",\"'start'\",\"'stemming'\",\"'stop'\",\"'strict'\",\"'strip'\",\"'structured-item'\",\"'switch'\",\"'text'\",\"'then'\",\"'thesaurus'\",\"'times'\",\"'to'\",\"'treat'\",\"'true'\",\"'try'\",\"'tumbling'\",\"'type'\",\"'typeswitch'\",\"'union'\",\"'unique'\",\"'unordered'\",\"'updating'\",\"'uppercase'\",\"'using'\",\"'validate'\",\"'value'\",\"'variable'\",\"'version'\",\"'weight'\",\"'when'\",\"'where'\",\"'while'\",\"'wildcards'\",\"'window'\",\"'with'\",\"'without'\",\"'word'\",\"'words'\",\"'zero-digit'\",\"'{'\",\"'{{'\",\"'{|'\",\"'|'\",\"'||'\",\"'|}'\",\"'}'\",\"'}}'\"]},{}],9:[function(e,t,n){var r=n.XQueryParser=function i(e,t){function n(e,t){$l=t,Kl=e,Ql=e.length,r(0,0,0)}function r(e,t,n){Pl=t,Hl=t,Bl=e,jl=t,Fl=n,Il=0,Yl=n,zl=-1,Jl={},$l.reset(Kl)}function s(){$l.startNonterminal(\"Module\",Hl);switch(Bl){case 274:Nl(199);break;default:Dl=Bl}(Dl==64274||Dl==134930)&&o(),Tl(275);switch(Bl){case 182:Nl(194);break;default:Dl=Bl}switch(Dl){case 94390:Sl(),u();break;default:Sl(),Fa()}$l.endNonterminal(\"Module\",Hl)}function o(){$l.startNonterminal(\"VersionDecl\",Hl),bl(274),Tl(116);switch(Bl){case 125:bl(125),Tl(17),bl(11);break;default:bl(263),Tl(17),bl(11),Tl(109),Bl==125&&(bl(125),Tl(17),bl(11))}Tl(28),Sl(),l(),$l.endNonterminal(\"VersionDecl\",Hl)}function u(){$l.startNonterminal(\"LibraryModule\",Hl),a(),Tl(138),Sl(),f(),$l.endNonterminal(\"LibraryModule\",Hl)}function a(){$l.startNonterminal(\"ModuleDecl\",Hl),bl(182),Tl(61),bl(184),Tl(249),Sl(),Ba(),Tl(29),bl(60),Tl(15),bl(7),Tl(28),Sl(),l(),$l.endNonterminal(\"ModuleDecl\",Hl)}function f(){$l.startNonterminal(\"Prolog\",Hl);for(;;){Tl(275);switch(Bl){case 108:Nl(214);break;case 153:Nl(202);break;default:Dl=Bl}if(Dl!=42604&&Dl!=43628&&Dl!=50284&&Dl!=53356&&Dl!=54380&&Dl!=55916&&Dl!=72300&&Dl!=93337&&Dl!=94316&&Dl!=104044&&Dl!=113772&&Dl!=115353)break;switch(Bl){case 108:Nl(179);break;default:Dl=Bl}if(Dl==55916){Dl=Ol(0,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{M(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(0,Hl,Dl)}}switch(Dl){case-1:Sl(),O();break;case 94316:Sl(),A();break;case 153:Sl(),N();break;case 72300:Sl(),_();break;default:Sl(),c()}Tl(28),Sl(),l()}for(;;){Tl(275);switch(Bl){case 108:Nl(211);break;default:Dl=Bl}if(Dl!=16492&&Dl!=48748&&Dl!=51820&&Dl!=74348&&Dl!=79468&&Dl!=82540&&Dl!=101996&&Dl!=131692&&Dl!=134252)break;switch(Bl){case 108:Nl(175);break;default:Dl=Bl}switch(Dl){case 51820:Sl(),q();break;case 101996:Sl(),K();break;default:Sl(),D()}Tl(28),Sl(),l()}$l.endNonterminal(\"Prolog\",Hl)}function l(){$l.startNonterminal(\"Separator\",Hl),bl(53),$l.endNonterminal(\"Separator\",Hl)}function c(){$l.startNonterminal(\"Setter\",Hl);switch(Bl){case 108:Nl(172);break;default:Dl=Bl}if(Dl==55916){Dl=Ol(1,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{d(),Dl=-2}catch(a){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),b(),Dl=-6}catch(f){Dl=-9}}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(1,Hl,Dl)}}switch(Dl){case 43628:h();break;case-2:p();break;case 42604:v();break;case 50284:m();break;case 104044:g();break;case-6:y();break;case 113772:To();break;case 53356:w();break;default:x()}$l.endNonterminal(\"Setter\",Hl)}function h(){$l.startNonterminal(\"BoundarySpaceDecl\",Hl),bl(108),Tl(33),bl(85),Tl(133);switch(Bl){case 214:bl(214);break;default:bl(241)}$l.endNonterminal(\"BoundarySpaceDecl\",Hl)}function p(){$l.startNonterminal(\"DefaultCollationDecl\",Hl),bl(108),Tl(46),bl(109),Tl(38),bl(94),Tl(15),bl(7),$l.endNonterminal(\"DefaultCollationDecl\",Hl)}function d(){wl(108),Tl(46),wl(109),Tl(38),wl(94),Tl(15),wl(7)}function v(){$l.startNonterminal(\"BaseURIDecl\",Hl),bl(108),Tl(32),bl(83),Tl(15),bl(7),$l.endNonterminal(\"BaseURIDecl\",Hl)}function m(){$l.startNonterminal(\"ConstructionDecl\",Hl),bl(108),Tl(41),bl(98),Tl(133);switch(Bl){case 241:bl(241);break;default:bl(214)}$l.endNonterminal(\"ConstructionDecl\",Hl)}function g(){$l.startNonterminal(\"OrderingModeDecl\",Hl),bl(108),Tl(68),bl(203),Tl(131);switch(Bl){case 202:bl(202);break;default:bl(256)}$l.endNonterminal(\"OrderingModeDecl\",Hl)}function y(){$l.startNonterminal(\"EmptyOrderDecl\",Hl),bl(108),Tl(46),bl(109),Tl(67),bl(201),Tl(49),bl(123),Tl(121);switch(Bl){case 147:bl(147);break;default:bl(173)}$l.endNonterminal(\"EmptyOrderDecl\",Hl)}function b(){wl(108),Tl(46),wl(109),Tl(67),wl(201),Tl(49),wl(123),Tl(121);switch(Bl){case 147:wl(147);break;default:wl(173)}}function w(){$l.startNonterminal(\"CopyNamespacesDecl\",Hl),bl(108),Tl(44),bl(104),Tl(128),Sl(),E(),Tl(25),bl(41),Tl(123),Sl(),S(),$l.endNonterminal(\"CopyNamespacesDecl\",Hl)}function E(){$l.startNonterminal(\"PreserveMode\",Hl);switch(Bl){case 214:bl(214);break;default:bl(190)}$l.endNonterminal(\"PreserveMode\",Hl)}function S(){$l.startNonterminal(\"InheritMode\",Hl);switch(Bl){case 157:bl(157);break;default:bl(189)}$l.endNonterminal(\"InheritMode\",Hl)}function x(){$l.startNonterminal(\"DecimalFormatDecl\",Hl),bl(108),Tl(114);switch(Bl){case 106:bl(106),Tl(255),Sl(),_a();break;default:bl(109),Tl(45),bl(106)}for(;;){Tl(181);if(Bl==53)break;Sl(),T(),Tl(29),bl(60),Tl(17),bl(11)}$l.endNonterminal(\"DecimalFormatDecl\",Hl)}function T(){$l.startNonterminal(\"DFPropertyName\",Hl);switch(Bl){case 107:bl(107);break;case 149:bl(149);break;case 156:bl(156);break;case 179:bl(179);break;case 67:bl(67);break;case 209:bl(209);break;case 208:bl(208);break;case 275:bl(275);break;case 116:bl(116);break;default:bl(207)}$l.endNonterminal(\"DFPropertyName\",Hl)}function N(){$l.startNonterminal(\"Import\",Hl);switch(Bl){case 153:Nl(126);break;default:Dl=Bl}switch(Dl){case 115353:C();break;default:L()}$l.endNonterminal(\"Import\",Hl)}function C(){$l.startNonterminal(\"SchemaImport\",Hl),bl(153),Tl(73),bl(225),Tl(137),Bl!=7&&(Sl(),k()),Tl(15),bl(7),Tl(108);if(Bl==81){bl(81),Tl(15),bl(7);for(;;){Tl(103);if(Bl!=41)break;bl(41),Tl(15),bl(7)}}$l.endNonterminal(\"SchemaImport\",Hl)}function k(){$l.startNonterminal(\"SchemaPrefix\",Hl);switch(Bl){case 184:bl(184),Tl(249),Sl(),Ba(),Tl(29),bl(60);break;default:bl(109),Tl(47),bl(121),Tl(61),bl(184)}$l.endNonterminal(\"SchemaPrefix\",Hl)}function L(){$l.startNonterminal(\"ModuleImport\",Hl),bl(153),Tl(60),bl(182),Tl(90),Bl==184&&(bl(184),Tl(249),Sl(),Ba(),Tl(29),bl(60)),Tl(15),bl(7),Tl(108);if(Bl==81){bl(81),Tl(15),bl(7);for(;;){Tl(103);if(Bl!=41)break;bl(41),Tl(15),bl(7)}}$l.endNonterminal(\"ModuleImport\",Hl)}function A(){$l.startNonterminal(\"NamespaceDecl\",Hl),bl(108),Tl(61),bl(184),Tl(249),Sl(),Ba(),Tl(29),bl(60),Tl(15),bl(7),$l.endNonterminal(\"NamespaceDecl\",Hl)}function O(){$l.startNonterminal(\"DefaultNamespaceDecl\",Hl),bl(108),Tl(46),bl(109),Tl(115);switch(Bl){case 121:bl(121);break;default:bl(145)}Tl(61),bl(184),Tl(15),bl(7),$l.endNonterminal(\"DefaultNamespaceDecl\",Hl)}function M(){wl(108),Tl(46),wl(109),Tl(115);switch(Bl){case 121:wl(121);break;default:wl(145)}Tl(61),wl(184),Tl(15),wl(7)}function _(){$l.startNonterminal(\"FTOptionDecl\",Hl),bl(108),Tl(52),bl(141),Tl(81),Sl(),Hu(),$l.endNonterminal(\"FTOptionDecl\",Hl)}function D(){$l.startNonterminal(\"AnnotatedDecl\",Hl),bl(108);for(;;){Tl(170);if(Bl!=32&&Bl!=257)break;switch(Bl){case 257:Sl(),P();break;default:Sl(),H()}}switch(Bl){case 262:Sl(),j();break;case 145:Sl(),gl();break;case 95:Sl(),ca();break;case 155:Sl(),wa();break;default:Sl(),Ea()}$l.endNonterminal(\"AnnotatedDecl\",Hl)}function P(){$l.startNonterminal(\"CompatibilityAnnotation\",Hl),bl(257),$l.endNonterminal(\"CompatibilityAnnotation\",Hl)}function H(){$l.startNonterminal(\"Annotation\",Hl),bl(32),Tl(255),Sl(),_a(),Tl(171);if(Bl==34){bl(34),Tl(154),Sl(),ri();for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(154),Sl(),ri()}bl(37)}$l.endNonterminal(\"Annotation\",Hl)}function B(){wl(32),Tl(255),Da(),Tl(171);if(Bl==34){wl(34),Tl(154),ii();for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(154),ii()}wl(37)}}function j(){$l.startNonterminal(\"VarDecl\",Hl),bl(262),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(147),Bl==79&&(Sl(),cs()),Tl(106);switch(Bl){case 52:bl(52),Tl(267),Sl(),F();break;default:bl(133),Tl(104),Bl==52&&(bl(52),Tl(267),Sl(),I())}$l.endNonterminal(\"VarDecl\",Hl)}function F(){$l.startNonterminal(\"VarValue\",Hl),Af(),$l.endNonterminal(\"VarValue\",Hl)}function I(){$l.startNonterminal(\"VarDefaultValue\",Hl),Af(),$l.endNonterminal(\"VarDefaultValue\",Hl)}function q(){$l.startNonterminal(\"ContextItemDecl\",Hl),bl(108),Tl(43),bl(101),Tl(55),bl(165),Tl(147),Bl==79&&(bl(79),Tl(260),Sl(),gs()),Tl(106);switch(Bl){case 52:bl(52),Tl(267),Sl(),F();break;default:bl(133),Tl(104),Bl==52&&(bl(52),Tl(267),Sl(),I())}$l.endNonterminal(\"ContextItemDecl\",Hl)}function R(){$l.startNonterminal(\"ParamList\",Hl),z();for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(21),Sl(),z()}$l.endNonterminal(\"ParamList\",Hl)}function U(){W();for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(21),W()}}function z(){$l.startNonterminal(\"Param\",Hl),bl(31),Tl(255),Sl(),_a(),Tl(143),Bl==79&&(Sl(),cs()),$l.endNonterminal(\"Param\",Hl)}function W(){wl(31),Tl(255),Da(),Tl(143),Bl==79&&hs()}function X(){$l.startNonterminal(\"FunctionBody\",Hl),$(),$l.endNonterminal(\"FunctionBody\",Hl)}function V(){J()}function $(){$l.startNonterminal(\"EnclosedExpr\",Hl),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"EnclosedExpr\",Hl)}function J(){wl(276),Tl(267),G(),wl(282)}function K(){$l.startNonterminal(\"OptionDecl\",Hl),bl(108),Tl(66),bl(199),Tl(255),Sl(),_a(),Tl(17),bl(11),$l.endNonterminal(\"OptionDecl\",Hl)}function Q(){$l.startNonterminal(\"Expr\",Hl),Af();for(;;){if(Bl!=41)break;bl(41),Tl(267),Sl(),Af()}$l.endNonterminal(\"Expr\",Hl)}function G(){Of();for(;;){if(Bl!=41)break;wl(41),Tl(267),Of()}}function Y(){$l.startNonterminal(\"FLWORExpr\",Hl),et();for(;;){Tl(173);if(Bl==220)break;Sl(),nt()}Sl(),nn(),$l.endNonterminal(\"FLWORExpr\",Hl)}function Z(){tt();for(;;){Tl(173);if(Bl==220)break;rt()}rn()}function et(){$l.startNonterminal(\"InitialClause\",Hl);switch(Bl){case 137:Nl(141);break;default:Dl=Bl}switch(Dl){case 16009:it();break;case 174:dt();break;default:yt()}$l.endNonterminal(\"InitialClause\",Hl)}function tt(){switch(Bl){case 137:Nl(141);break;default:Dl=Bl}switch(Dl){case 16009:st();break;case 174:vt();break;default:bt()}}function nt(){$l.startNonterminal(\"IntermediateClause\",Hl);switch(Bl){case 137:case 174:et();break;case 266:Ft();break;case 148:qt();break;case 105:Bt();break;default:Jt()}$l.endNonterminal(\"IntermediateClause\",Hl)}function rt(){switch(Bl){case 137:case 174:tt();break;case 266:It();break;case 148:Rt();break;case 105:jt();break;default:Kt()}}function it(){$l.startNonterminal(\"ForClause\",Hl),bl(137),Tl(21),Sl(),ot();for(;;){if(Bl!=41)break;bl(41),Tl(21),Sl(),ot()}$l.endNonterminal(\"ForClause\",Hl)}function st(){wl(137),Tl(21),ut();for(;;){if(Bl!=41)break;wl(41),Tl(21),ut()}}function ot(){$l.startNonterminal(\"ForBinding\",Hl),bl(31),Tl(255),Sl(),fi(),Tl(164),Bl==79&&(Sl(),cs()),Tl(158),Bl==72&&(Sl(),at()),Tl(150),Bl==81&&(Sl(),lt()),Tl(122),Bl==228&&(Sl(),ht()),Tl(53),bl(154),Tl(267),Sl(),Af(),$l.endNonterminal(\"ForBinding\",Hl)}function ut(){wl(31),Tl(255),li(),Tl(164),Bl==79&&hs(),Tl(158),Bl==72&&ft(),Tl(150),Bl==81&&ct(),Tl(122),Bl==228&&pt(),Tl(53),wl(154),Tl(267),Of()}function at(){$l.startNonterminal(\"AllowingEmpty\",Hl),bl(72),Tl(49),bl(123),$l.endNonterminal(\"AllowingEmpty\",Hl)}function ft(){wl(72),Tl(49),wl(123)}function lt(){$l.startNonterminal(\"PositionalVar\",Hl),bl(81),Tl(21),bl(31),Tl(255),Sl(),fi(),$l.endNonterminal(\"PositionalVar\",Hl)}function ct(){wl(81),Tl(21),wl(31),Tl(255),li()}function ht(){$l.startNonterminal(\"FTScoreVar\",Hl),bl(228),Tl(21),bl(31),Tl(255),Sl(),fi(),$l.endNonterminal(\"FTScoreVar\",Hl)}function pt(){wl(228),Tl(21),wl(31),Tl(255),li()}function dt(){$l.startNonterminal(\"LetClause\",Hl),bl(174),Tl(96),Sl(),mt();for(;;){if(Bl!=41)break;bl(41),Tl(96),Sl(),mt()}$l.endNonterminal(\"LetClause\",Hl)}function vt(){wl(174),Tl(96),gt();for(;;){if(Bl!=41)break;wl(41),Tl(96),gt()}}function mt(){$l.startNonterminal(\"LetBinding\",Hl);switch(Bl){case 31:bl(31),Tl(255),Sl(),fi(),Tl(105),Bl==79&&(Sl(),cs());break;default:ht()}Tl(27),bl(52),Tl(267),Sl(),Af(),$l.endNonterminal(\"LetBinding\",Hl)}function gt(){switch(Bl){case 31:wl(31),Tl(255),li(),Tl(105),Bl==79&&hs();break;default:pt()}Tl(27),wl(52),Tl(267),Of()}function yt(){$l.startNonterminal(\"WindowClause\",Hl),bl(137),Tl(135);switch(Bl){case 251:Sl(),wt();break;default:Sl(),St()}$l.endNonterminal(\"WindowClause\",Hl)}function bt(){wl(137),Tl(135);switch(Bl){case 251:Et();break;default:xt()}}function wt(){$l.startNonterminal(\"TumblingWindowClause\",Hl),bl(251),Tl(85),bl(269),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(110),Bl==79&&(Sl(),cs()),Tl(53),bl(154),Tl(267),Sl(),Af(),Sl(),Tt();if(Bl==126||Bl==198)Sl(),Ct();$l.endNonterminal(\"TumblingWindowClause\",Hl)}function Et(){wl(251),Tl(85),wl(269),Tl(21),wl(31),Tl(255),li(),Tl(110),Bl==79&&hs(),Tl(53),wl(154),Tl(267),Of(),Nt(),(Bl==126||Bl==198)&&kt()}function St(){$l.startNonterminal(\"SlidingWindowClause\",Hl),bl(234),Tl(85),bl(269),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(110),Bl==79&&(Sl(),cs()),Tl(53),bl(154),Tl(267),Sl(),Af(),Sl(),Tt(),Sl(),Ct(),$l.endNonterminal(\"SlidingWindowClause\",Hl)}function xt(){wl(234),Tl(85),wl(269),Tl(21),wl(31),Tl(255),li(),Tl(110),Bl==79&&hs(),Tl(53),wl(154),Tl(267),Of(),Nt(),kt()}function Tt(){$l.startNonterminal(\"WindowStartCondition\",Hl),bl(237),Tl(163),Sl(),Lt(),Tl(83),bl(265),Tl(267),Sl(),Af(),$l.endNonterminal(\"WindowStartCondition\",Hl)}function Nt(){wl(237),Tl(163),At(),Tl(83),wl(265),Tl(267),Of()}function Ct(){$l.startNonterminal(\"WindowEndCondition\",Hl),Bl==198&&bl(198),Tl(50),bl(126),Tl(163),Sl(),Lt(),Tl(83),bl(265),Tl(267),Sl(),Af(),$l.endNonterminal(\"WindowEndCondition\",Hl)}function kt(){Bl==198&&wl(198),Tl(50),wl(126),Tl(163),At(),Tl(83),wl(265),Tl(267),Of()}function Lt(){$l.startNonterminal(\"WindowVars\",Hl),Bl==31&&(bl(31),Tl(255),Sl(),Ot()),Tl(159),Bl==81&&(Sl(),lt()),Tl(153),Bl==215&&(bl(215),Tl(21),bl(31),Tl(255),Sl(),_t()),Tl(127),Bl==187&&(bl(187),Tl(21),bl(31),Tl(255),Sl(),Pt()),$l.endNonterminal(\"WindowVars\",Hl)}function At(){Bl==31&&(wl(31),Tl(255),Mt()),Tl(159),Bl==81&&ct(),Tl(153),Bl==215&&(wl(215),Tl(21),wl(31),Tl(255),Dt()),Tl(127),Bl==187&&(wl(187),Tl(21),wl(31),Tl(255),Ht())}function Ot(){$l.startNonterminal(\"CurrentItem\",Hl),_a(),$l.endNonterminal(\"CurrentItem\",Hl)}function Mt(){Da()}function _t(){$l.startNonterminal(\"PreviousItem\",Hl),_a(),$l.endNonterminal(\"PreviousItem\",Hl)}function Dt(){Da()}function Pt(){$l.startNonterminal(\"NextItem\",Hl),_a(),$l.endNonterminal(\"NextItem\",Hl)}function Ht(){Da()}function Bt(){$l.startNonterminal(\"CountClause\",Hl),bl(105),Tl(21),bl(31),Tl(255),Sl(),fi(),$l.endNonterminal(\"CountClause\",Hl)}function jt(){wl(105),Tl(21),wl(31),Tl(255),li()}function Ft(){$l.startNonterminal(\"WhereClause\",Hl),bl(266),Tl(267),Sl(),Af(),$l.endNonterminal(\"WhereClause\",Hl)}function It(){wl(266),Tl(267),Of()}function qt(){$l.startNonterminal(\"GroupByClause\",Hl),bl(148),Tl(34),bl(87),Tl(267),Sl(),Ut(),$l.endNonterminal(\"GroupByClause\",Hl)}function Rt(){wl(148),Tl(34),wl(87),Tl(267),zt()}function Ut(){$l.startNonterminal(\"GroupingSpecList\",Hl),Wt();for(;;){Tl(176);if(Bl!=41)break;bl(41),Tl(267),Sl(),Wt()}$l.endNonterminal(\"GroupingSpecList\",Hl)}function zt(){Xt();for(;;){Tl(176);if(Bl!=41)break;wl(41),Tl(267),Xt()}}function Wt(){$l.startNonterminal(\"GroupingSpec\",Hl);switch(Bl){case 31:Nl(255);break;default:Dl=Bl}if(Dl==3103||Dl==35871||Dl==36895||Dl==37407||Dl==37919||Dl==38431||Dl==39455||Dl==39967||Dl==40479||Dl==40991||Dl==41503||Dl==42015||Dl==42527||Dl==43039||Dl==43551||Dl==44063||Dl==45087||Dl==45599||Dl==46111||Dl==46623||Dl==47647||Dl==48159||Dl==49183||Dl==49695||Dl==50207||Dl==51743||Dl==52255||Dl==52767||Dl==53279||Dl==53791||Dl==54303||Dl==55327||Dl==55839||Dl==56351||Dl==56863||Dl==57375||Dl==57887||Dl==60447||Dl==60959||Dl==61471||Dl==61983||Dl==62495||Dl==63007||Dl==63519||Dl==64031||Dl==64543||Dl==65567||Dl==66079||Dl==67103||Dl==67615||Dl==68127||Dl==68639||Dl==69151||Dl==69663||Dl==70175||Dl==72223||Dl==74271||Dl==74783||Dl==75807||Dl==76831||Dl==77343||Dl==77855||Dl==78367||Dl==78879||Dl==79391||Dl==81439||Dl==81951||Dl==82463||Dl==82975||Dl==83487||Dl==83999||Dl==84511||Dl==85023||Dl==85535||Dl==87071||Dl==87583||Dl==88095||Dl==89119||Dl==90143||Dl==91167||Dl==92191||Dl==92703||Dl==93215||Dl==94239||Dl==94751||Dl==95263||Dl==97823||Dl==98335||Dl==99359||Dl==101407||Dl==101919||Dl==102431||Dl==102943||Dl==103455||Dl==103967||Dl==105503||Dl==108575||Dl==109087||Dl==110623||Dl==111647||Dl==112159||Dl==112671||Dl==113183||Dl==113695||Dl==114719||Dl==115231||Dl==115743||Dl==116255||Dl==116767||Dl==117279||Dl==119839||Dl==120351||Dl==120863||Dl==121375||Dl==122911||Dl==123935||Dl==124447||Dl==124959||Dl==127007||Dl==127519||Dl==128031||Dl==128543||Dl==129055||Dl==129567||Dl==130079||Dl==131103||Dl==131615||Dl==133151||Dl==133663||Dl==134175||Dl==134687||Dl==136223||Dl==136735||Dl==138271||Dl==140319){Dl=Ol(2,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{$t(),Tl(183);if(Bl==52||Bl==79)Bl==79&&hs(),Tl(27),wl(52),Tl(267),Of();Bl==94&&(wl(94),Tl(15),wl(7)),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(2,Hl,Dl)}}switch(Dl){case-1:Vt(),Tl(183);if(Bl==52||Bl==79)Bl==79&&(Sl(),cs()),Tl(27),bl(52),Tl(267),Sl(),Af();Bl==94&&(bl(94),Tl(15),bl(7));break;default:Af()}$l.endNonterminal(\"GroupingSpec\",Hl)}function Xt(){switch(Bl){case 31:Nl(255);break;default:Dl=Bl}if(Dl==3103||Dl==35871||Dl==36895||Dl==37407||Dl==37919||Dl==38431||Dl==39455||Dl==39967||Dl==40479||Dl==40991||Dl==41503||Dl==42015||Dl==42527||Dl==43039||Dl==43551||Dl==44063||Dl==45087||Dl==45599||Dl==46111||Dl==46623||Dl==47647||Dl==48159||Dl==49183||Dl==49695||Dl==50207||Dl==51743||Dl==52255||Dl==52767||Dl==53279||Dl==53791||Dl==54303||Dl==55327||Dl==55839||Dl==56351||Dl==56863||Dl==57375||Dl==57887||Dl==60447||Dl==60959||Dl==61471||Dl==61983||Dl==62495||Dl==63007||Dl==63519||Dl==64031||Dl==64543||Dl==65567||Dl==66079||Dl==67103||Dl==67615||Dl==68127||Dl==68639||Dl==69151||Dl==69663||Dl==70175||Dl==72223||Dl==74271||Dl==74783||Dl==75807||Dl==76831||Dl==77343||Dl==77855||Dl==78367||Dl==78879||Dl==79391||Dl==81439||Dl==81951||Dl==82463||Dl==82975||Dl==83487||Dl==83999||Dl==84511||Dl==85023||Dl==85535||Dl==87071||Dl==87583||Dl==88095||Dl==89119||Dl==90143||Dl==91167||Dl==92191||Dl==92703||Dl==93215||Dl==94239||Dl==94751||Dl==95263||Dl==97823||Dl==98335||Dl==99359||Dl==101407||Dl==101919||Dl==102431||Dl==102943||Dl==103455||Dl==103967||Dl==105503||Dl==108575||Dl==109087||Dl==110623||Dl==111647||Dl==112159||Dl==112671||Dl==113183||Dl==113695||Dl==114719||Dl==115231||Dl==115743||Dl==116255||Dl==116767||Dl==117279||Dl==119839||Dl==120351||Dl==120863||Dl==121375||Dl==122911||Dl==123935||Dl==124447||Dl==124959||Dl==127007||Dl==127519||Dl==128031||Dl==128543||Dl==129055||Dl==129567||Dl==130079||Dl==131103||Dl==131615||Dl==133151||Dl==133663||Dl==134175||Dl==134687||Dl==136223||Dl==136735||Dl==138271||Dl==140319){Dl=Ol(2,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{$t(),Tl(183);if(Bl==52||Bl==79)Bl==79&&hs(),Tl(27),wl(52),Tl(267),Of();Bl==94&&(wl(94),Tl(15),wl(7)),Al(2,t,-1),Dl=-3}catch(a){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(2,t,-2)}}}switch(Dl){case-1:$t(),Tl(183);if(Bl==52||Bl==79)Bl==79&&hs(),Tl(27),wl(52),Tl(267),Of();Bl==94&&(wl(94),Tl(15),wl(7));break;case-3:break;default:Of()}}function Vt(){$l.startNonterminal(\"GroupingVariable\",Hl),bl(31),Tl(255),Sl(),fi(),$l.endNonterminal(\"GroupingVariable\",Hl)}function $t(){wl(31),Tl(255),li()}function Jt(){$l.startNonterminal(\"OrderByClause\",Hl);switch(Bl){case 201:bl(201),Tl(34),bl(87);break;default:bl(236),Tl(67),bl(201),Tl(34),bl(87)}Tl(267),Sl(),Qt(),$l.endNonterminal(\"OrderByClause\",Hl)}function Kt(){switch(Bl){case 201:wl(201),Tl(34),wl(87);break;default:wl(236),Tl(67),wl(201),Tl(34),wl(87)}Tl(267),Gt()}function Qt(){$l.startNonterminal(\"OrderSpecList\",Hl),Yt();for(;;){Tl(176);if(Bl!=41)break;bl(41),Tl(267),Sl(),Yt()}$l.endNonterminal(\"OrderSpecList\",Hl)}function Gt(){Zt();for(;;){Tl(176);if(Bl!=41)break;wl(41),Tl(267),Zt()}}function Yt(){$l.startNonterminal(\"OrderSpec\",Hl),Af(),Sl(),en(),$l.endNonterminal(\"OrderSpec\",Hl)}function Zt(){Of(),tn()}function en(){$l.startNonterminal(\"OrderModifier\",Hl);if(Bl==80||Bl==113)switch(Bl){case 80:bl(80);break;default:bl(113)}Tl(180);if(Bl==123){bl(123),Tl(121);switch(Bl){case 147:bl(147);break;default:bl(173)}}Tl(177),Bl==94&&(bl(94),Tl(15),bl(7)),$l.endNonterminal(\"OrderModifier\",Hl)}function tn(){if(Bl==80||Bl==113)switch(Bl){case 80:wl(80);break;default:wl(113)}Tl(180);if(Bl==123){wl(123),Tl(121);switch(Bl){case 147:wl(147);break;default:wl(173)}}Tl(177),Bl==94&&(wl(94),Tl(15),wl(7))}function nn(){$l.startNonterminal(\"ReturnClause\",Hl),bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"ReturnClause\",Hl)}function rn(){wl(220),Tl(267),Of()}function sn(){$l.startNonterminal(\"QuantifiedExpr\",Hl);switch(Bl){case 235:bl(235);break;default:bl(129)}Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(110),Bl==79&&(Sl(),cs()),Tl(53),bl(154),Tl(267),Sl(),Af();for(;;){if(Bl!=41)break;bl(41),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(110),Bl==79&&(Sl(),cs()),Tl(53),bl(154),Tl(267),Sl(),Af()}bl(224),Tl(267),Sl(),Af(),$l.endNonterminal(\"QuantifiedExpr\",Hl)}function on(){switch(Bl){case 235:wl(235);break;default:wl(129)}Tl(21),wl(31),Tl(255),li(),Tl(110),Bl==79&&hs(),Tl(53),wl(154),Tl(267),Of();for(;;){if(Bl!=41)break;wl(41),Tl(21),wl(31),Tl(255),li(),Tl(110),Bl==79&&hs(),Tl(53),wl(154),Tl(267),Of()}wl(224),Tl(267),Of()}function un(){$l.startNonterminal(\"SwitchExpr\",Hl),bl(243),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37);for(;;){Tl(35),Sl(),fn();if(Bl!=88)break}bl(109),Tl(70),bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"SwitchExpr\",Hl)}function an(){wl(243),Tl(22),wl(34),Tl(267),G(),wl(37);for(;;){Tl(35),ln();if(Bl!=88)break}wl(109),Tl(70),wl(220),Tl(267),Of()}function fn(){$l.startNonterminal(\"SwitchCaseClause\",Hl);for(;;){bl(88),Tl(267),Sl(),cn();if(Bl!=88)break}bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"SwitchCaseClause\",Hl)}function ln(){for(;;){wl(88),Tl(267),hn();if(Bl!=88)break}wl(220),Tl(267),Of()}function cn(){$l.startNonterminal(\"SwitchCaseOperand\",Hl),Af(),$l.endNonterminal(\"SwitchCaseOperand\",Hl)}function hn(){Of()}function pn(){$l.startNonterminal(\"TypeswitchExpr\",Hl),bl(253),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37);for(;;){Tl(35),Sl(),vn();if(Bl!=88)break}bl(109),Tl(95),Bl==31&&(bl(31),Tl(255),Sl(),fi()),Tl(70),bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"TypeswitchExpr\",Hl)}function dn(){wl(253),Tl(22),wl(34),Tl(267),G(),wl(37);for(;;){Tl(35),mn();if(Bl!=88)break}wl(109),Tl(95),Bl==31&&(wl(31),Tl(255),li()),Tl(70),wl(220),Tl(267),Of()}function vn(){$l.startNonterminal(\"CaseClause\",Hl),bl(88),Tl(262),Bl==31&&(bl(31),Tl(255),Sl(),fi(),Tl(30),bl(79)),Tl(260),Sl(),gn(),bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"CaseClause\",Hl)}function mn(){wl(88),Tl(262),Bl==31&&(wl(31),Tl(255),li(),Tl(30),wl(79)),Tl(260),yn(),wl(220),Tl(267),Of()}function gn(){$l.startNonterminal(\"SequenceTypeUnion\",Hl),ps();for(;;){Tl(134);if(Bl!=279)break;bl(279),Tl(260),Sl(),ps()}$l.endNonterminal(\"SequenceTypeUnion\",Hl)}function yn(){ds();for(;;){Tl(134);if(Bl!=279)break;wl(279),Tl(260),ds()}}function bn(){$l.startNonterminal(\"IfExpr\",Hl),bl(152),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37),Tl(77),bl(245),Tl(267),Sl(),Af(),bl(122),Tl(267),Sl(),Af(),$l.endNonterminal(\"IfExpr\",Hl)}function wn(){wl(152),Tl(22),wl(34),Tl(267),G(),wl(37),Tl(77),wl(245),Tl(267),Of(),wl(122),Tl(267),Of()}function En(){$l.startNonterminal(\"TryCatchExpr\",Hl),xn();for(;;){Tl(36),Sl(),kn(),Tl(184);if(Bl!=91)break}$l.endNonterminal(\"TryCatchExpr\",Hl)}function Sn(){Tn();for(;;){Tl(36),Ln(),Tl(184);if(Bl!=91)break}}function xn(){$l.startNonterminal(\"TryClause\",Hl),bl(250),Tl(87),bl(276),Tl(267),Sl(),Nn(),bl(282),$l.endNonterminal(\"TryClause\",Hl)}function Tn(){wl(250),Tl(87),wl(276),Tl(267),Cn(),wl(282)}function Nn(){$l.startNonterminal(\"TryTargetExpr\",Hl),Q(),$l.endNonterminal(\"TryTargetExpr\",Hl)}function Cn(){G()}function kn(){$l.startNonterminal(\"CatchClause\",Hl),bl(91),Tl(257),Sl(),An(),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"CatchClause\",Hl)}function Ln(){wl(91),Tl(257),On(),wl(276),Tl(267),G(),wl(282)}function An(){$l.startNonterminal(\"CatchErrorList\",Hl),$r();for(;;){Tl(136);if(Bl!=279)break;bl(279),Tl(257),Sl(),$r()}$l.endNonterminal(\"CatchErrorList\",Hl)}function On(){Jr();for(;;){Tl(136);if(Bl!=279)break;wl(279),Tl(257),Jr()}}function Mn(){$l.startNonterminal(\"OrExpr\",Hl),Dn();for(;;){if(Bl!=200)break;bl(200),Tl(267),Sl(),Dn()}$l.endNonterminal(\"OrExpr\",Hl)}function _n(){Pn();for(;;){if(Bl!=200)break;wl(200),Tl(267),Pn()}}function Dn(){$l.startNonterminal(\"AndExpr\",Hl),Hn();for(;;){if(Bl!=75)break;bl(75),Tl(267),Sl(),Hn()}$l.endNonterminal(\"AndExpr\",Hl)}function Pn(){Bn();for(;;){if(Bl!=75)break;wl(75),Tl(267),Bn()}}function Hn(){$l.startNonterminal(\"ComparisonExpr\",Hl),jn();if(Bl==27||Bl==54||Bl==57||Bl==58||Bl==60||Bl==61||Bl==62||Bl==63||Bl==128||Bl==146||Bl==150||Bl==164||Bl==172||Bl==178||Bl==186){switch(Bl){case 128:case 146:case 150:case 172:case 178:case 186:Sl(),pr();break;case 57:case 63:case 164:Sl(),vr();break;default:Sl(),cr()}Tl(267),Sl(),jn()}$l.endNonterminal(\"ComparisonExpr\",Hl)}function Bn(){Fn();if(Bl==27||Bl==54||Bl==57||Bl==58||Bl==60||Bl==61||Bl==62||Bl==63||Bl==128||Bl==146||Bl==150||Bl==164||Bl==172||Bl==178||Bl==186){switch(Bl){case 128:case 146:case 150:case 172:case 178:case 186:dr();break;case 57:case 63:case 164:mr();break;default:hr()}Tl(267),Fn()}}function jn(){$l.startNonterminal(\"FTContainsExpr\",Hl),In(),Bl==99&&(bl(99),Tl(76),bl(244),Tl(162),Sl(),Xo(),Bl==271&&(Sl(),fa())),$l.endNonterminal(\"FTContainsExpr\",Hl)}function Fn(){qn(),Bl==99&&(wl(99),Tl(76),wl(244),Tl(162),Vo(),Bl==271&&la())}function In(){$l.startNonterminal(\"StringConcatExpr\",Hl),Rn();for(;;){if(Bl!=280)break;bl(280),Tl(267),Sl(),Rn()}$l.endNonterminal(\"StringConcatExpr\",Hl)}function qn(){Un();for(;;){if(Bl!=280)break;wl(280),Tl(267),Un()}}function Rn(){$l.startNonterminal(\"RangeExpr\",Hl),zn(),Bl==248&&(bl(248),Tl(267),Sl(),zn()),$l.endNonterminal(\"RangeExpr\",Hl)}function Un(){Wn(),Bl==248&&(wl(248),Tl(267),Wn())}function zn(){$l.startNonterminal(\"AdditiveExpr\",Hl),Xn();for(;;){if(Bl!=40&&Bl!=42)break;switch(Bl){case 40:bl(40);break;default:bl(42)}Tl(267),Sl(),Xn()}$l.endNonterminal(\"AdditiveExpr\",Hl)}function Wn(){Vn();for(;;){if(Bl!=40&&Bl!=42)break;switch(Bl){case 40:wl(40);break;default:wl(42)}Tl(267),Vn()}}function Xn(){$l.startNonterminal(\"MultiplicativeExpr\",Hl),$n();for(;;){if(Bl!=38&&Bl!=118&&Bl!=151&&Bl!=180)break;switch(Bl){case 38:bl(38);break;case 118:bl(118);break;case 151:bl(151);break;default:bl(180)}Tl(267),Sl(),$n()}$l.endNonterminal(\"MultiplicativeExpr\",Hl)}function Vn(){Jn();for(;;){if(Bl!=38&&Bl!=118&&Bl!=151&&Bl!=180)break;switch(Bl){case 38:wl(38);break;case 118:wl(118);break;case 151:wl(151);break;default:wl(180)}Tl(267),Jn()}}function $n(){$l.startNonterminal(\"UnionExpr\",Hl),Kn();for(;;){if(Bl!=254&&Bl!=279)break;switch(Bl){case 254:bl(254);break;default:bl(279)}Tl(267),Sl(),Kn()}$l.endNonterminal(\"UnionExpr\",Hl)}function Jn(){Qn();for(;;){if(Bl!=254&&Bl!=279)break;switch(Bl){case 254:wl(254);break;default:wl(279)}Tl(267),Qn()}}function Kn(){$l.startNonterminal(\"IntersectExceptExpr\",Hl),Gn();for(;;){Tl(223);if(Bl!=131&&Bl!=162)break;switch(Bl){case 162:bl(162);break;default:bl(131)}Tl(267),Sl(),Gn()}$l.endNonterminal(\"IntersectExceptExpr\",Hl)}function Qn(){Yn();for(;;){Tl(223);if(Bl!=131&&Bl!=162)break;switch(Bl){case 162:wl(162);break;default:wl(131)}Tl(267),Yn()}}function Gn(){$l.startNonterminal(\"InstanceofExpr\",Hl),Zn(),Tl(224),Bl==160&&(bl(160),Tl(64),bl(196),Tl(260),Sl(),ps()),$l.endNonterminal(\"InstanceofExpr\",Hl)}function Yn(){er(),Tl(224),Bl==160&&(wl(160),Tl(64),wl(196),Tl(260),ds())}function Zn(){$l.startNonterminal(\"TreatExpr\",Hl),tr(),Tl(225),Bl==249&&(bl(249),Tl(30),bl(79),Tl(260),Sl(),ps()),$l.endNonterminal(\"TreatExpr\",Hl)}function er(){nr(),Tl(225),Bl==249&&(wl(249),Tl(30),wl(79),Tl(260),ds())}function tr(){$l.startNonterminal(\"CastableExpr\",Hl),rr(),Tl(226),Bl==90&&(bl(90),Tl(30),bl(79),Tl(255),Sl(),fs()),$l.endNonterminal(\"CastableExpr\",Hl)}function nr(){ir(),Tl(226),Bl==90&&(wl(90),Tl(30),wl(79),Tl(255),ls())}function rr(){$l.startNonterminal(\"CastExpr\",Hl),sr(),Tl(228),Bl==89&&(bl(89),Tl(30),bl(79),Tl(255),Sl(),fs()),$l.endNonterminal(\"CastExpr\",Hl)}function ir(){or(),Tl(228),Bl==89&&(wl(89),Tl(30),wl(79),Tl(255),ls())}function sr(){$l.startNonterminal(\"UnaryExpr\",Hl);for(;;){Tl(267);if(Bl!=40&&Bl!=42)break;switch(Bl){case 42:bl(42);break;default:bl(40)}}Sl(),ur(),$l.endNonterminal(\"UnaryExpr\",Hl)}function or(){for(;;){Tl(267);if(Bl!=40&&Bl!=42)break;switch(Bl){case 42:wl(42);break;default:wl(40)}}ar()}function ur(){$l.startNonterminal(\"ValueExpr\",Hl);switch(Bl){case 260:Nl(248);break;default:Dl=Bl}switch(Dl){case 87812:case 123140:case 129284:case 141572:gr();break;case 35:Er();break;default:fr()}$l.endNonterminal(\"ValueExpr\",Hl)}function ar(){switch(Bl){case 260:Nl(248);break;default:Dl=Bl}switch(Dl){case 87812:case 123140:case 129284:case 141572:yr();break;case 35:Sr();break;default:lr()}}function fr(){$l.startNonterminal(\"SimpleMapExpr\",Hl),Nr();for(;;){if(Bl!=26)break;bl(26),Tl(266),Sl(),Nr()}$l.endNonterminal(\"SimpleMapExpr\",Hl)}function lr(){Cr();for(;;){if(Bl!=26)break;wl(26),Tl(266),Cr()}}function cr(){$l.startNonterminal(\"GeneralComp\",Hl);switch(Bl){case 60:bl(60);break;case 27:bl(27);break;case 54:bl(54);break;case 58:bl(58);break;case 61:bl(61);break;default:bl(62)}$l.endNonterminal(\"GeneralComp\",Hl)}function hr(){switch(Bl){case 60:wl(60);break;case 27:wl(27);break;case 54:wl(54);break;case 58:wl(58);break;case 61:wl(61);break;default:wl(62)}}function pr(){$l.startNonterminal(\"ValueComp\",Hl);switch(Bl){case 128:bl(128);break;case 186:bl(186);break;case 178:bl(178);break;case 172:bl(172);break;case 150:bl(150);break;default:bl(146)}$l.endNonterminal(\"ValueComp\",Hl)}function dr(){switch(Bl){case 128:wl(128);break;case 186:wl(186);break;case 178:wl(178);break;case 172:wl(172);break;case 150:wl(150);break;default:wl(146)}}function vr(){$l.startNonterminal(\"NodeComp\",Hl);switch(Bl){case 164:bl(164);break;case 57:bl(57);break;default:bl(63)}$l.endNonterminal(\"NodeComp\",Hl)}function mr(){switch(Bl){case 164:wl(164);break;case 57:wl(57);break;default:wl(63)}}function gr(){$l.startNonterminal(\"ValidateExpr\",Hl),bl(260),Tl(160);if(Bl!=276)switch(Bl){case 252:bl(252),Tl(255),Sl(),po();break;default:Sl(),br()}Tl(87),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"ValidateExpr\",Hl)}function yr(){wl(260),Tl(160);if(Bl!=276)switch(Bl){case 252:wl(252),Tl(255),vo();break;default:wr()}Tl(87),wl(276),Tl(267),G(),wl(282)}function br(){$l.startNonterminal(\"ValidationMode\",Hl);switch(Bl){case 171:bl(171);break;default:bl(240)}$l.endNonterminal(\"ValidationMode\",Hl)}function wr(){switch(Bl){case 171:wl(171);break;default:wl(240)}}function Er(){$l.startNonterminal(\"ExtensionExpr\",Hl);for(;;){Sl(),xr(),Tl(100);if(Bl!=35)break}bl(276),Tl(274),Bl!=282&&(Sl(),Q()),bl(282),$l.endNonterminal(\"ExtensionExpr\",Hl)}function Sr(){for(;;){Tr(),Tl(100);if(Bl!=35)break}wl(276),Tl(274),Bl!=282&&G(),wl(282)}function xr(){$l.startNonterminal(\"Pragma\",Hl),bl(35),Cl(252),Bl==21&&bl(21),_a(),Cl(10),Bl==21&&(bl(21),Cl(0),bl(1)),Cl(5),bl(30),$l.endNonterminal(\"Pragma\",Hl)}function Tr(){wl(35),Cl(252),Bl==21&&wl(21),Da(),Cl(10),Bl==21&&(wl(21),Cl(0),wl(1)),Cl(5),wl(30)}function Nr(){$l.startNonterminal(\"PathExpr\",Hl);switch(Bl){case 46:bl(46),Tl(286);switch(Bl){case 25:case 26:case 27:case 37:case 38:case 40:case 41:case 42:case 49:case 53:case 57:case 58:case 60:case 61:case 62:case 63:case 69:case 87:case 99:case 205:case 232:case 247:case 273:case 279:case 280:case 281:case 282:break;default:Sl(),kr()}break;case 47:bl(47),Tl(265),Sl(),kr();break;default:kr()}$l.endNonterminal(\"PathExpr\",Hl)}function Cr(){switch(Bl){case 46:wl(46),Tl(286);switch(Bl){case 25:case 26:case 27:case 37:case 38:case 40:case 41:case 42:case 49:case 53:case 57:case 58:case 60:case 61:case 62:case 63:case 69:case 87:case 99:case 205:case 232:case 247:case 273:case 279:case 280:case 281:case 282:break;default:Lr()}break;case 47:wl(47),Tl(265),Lr();break;default:Lr()}}function kr(){$l.startNonterminal(\"RelativePathExpr\",Hl),Ar();for(;;){switch(Bl){case 26:Nl(266);break;default:Dl=Bl}if(Dl!=25&&Dl!=27&&Dl!=37&&Dl!=38&&Dl!=40&&Dl!=41&&Dl!=42&&Dl!=46&&Dl!=47&&Dl!=49&&Dl!=53&&Dl!=54&&Dl!=57&&Dl!=58&&Dl!=60&&Dl!=61&&Dl!=62&&Dl!=63&&Dl!=69&&Dl!=70&&Dl!=75&&Dl!=79&&Dl!=80&&Dl!=81&&Dl!=84&&Dl!=87&&Dl!=88&&Dl!=89&&Dl!=90&&Dl!=94&&Dl!=99&&Dl!=105&&Dl!=109&&Dl!=113&&Dl!=118&&Dl!=122&&Dl!=123&&Dl!=126&&Dl!=128&&Dl!=131&&Dl!=137&&Dl!=146&&Dl!=148&&Dl!=150&&Dl!=151&&Dl!=160&&Dl!=162&&Dl!=163&&Dl!=164&&Dl!=172&&Dl!=174&&Dl!=178&&Dl!=180&&Dl!=181&&Dl!=186&&Dl!=198&&Dl!=200&&Dl!=201&&Dl!=205&&Dl!=220&&Dl!=224&&Dl!=232&&Dl!=236&&Dl!=237&&Dl!=247&&Dl!=248&&Dl!=249&&Dl!=254&&Dl!=266&&Dl!=270&&Dl!=273&&Dl!=279&&Dl!=280&&Dl!=281&&Dl!=282&&Dl!=23578&&Dl!=24090){Dl=Ol(3,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{switch(Bl){case 46:wl(46);break;case 47:wl(47);break;default:wl(26)}Tl(265),Or(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(3,Hl,Dl)}}if(Dl!=-1&&Dl!=46&&Dl!=47)break;switch(Bl){case 46:bl(46);break;case 47:bl(47);break;default:bl(26)}Tl(265),Sl(),Ar()}$l.endNonterminal(\"RelativePathExpr\",Hl)}function Lr(){Or();for(;;){switch(Bl){case 26:Nl(266);break;default:Dl=Bl}if(Dl!=25&&Dl!=27&&Dl!=37&&Dl!=38&&Dl!=40&&Dl!=41&&Dl!=42&&Dl!=46&&Dl!=47&&Dl!=49&&Dl!=53&&Dl!=54&&Dl!=57&&Dl!=58&&Dl!=60&&Dl!=61&&Dl!=62&&Dl!=63&&Dl!=69&&Dl!=70&&Dl!=75&&Dl!=79&&Dl!=80&&Dl!=81&&Dl!=84&&Dl!=87&&Dl!=88&&Dl!=89&&Dl!=90&&Dl!=94&&Dl!=99&&Dl!=105&&Dl!=109&&Dl!=113&&Dl!=118&&Dl!=122&&Dl!=123&&Dl!=126&&Dl!=128&&Dl!=131&&Dl!=137&&Dl!=146&&Dl!=148&&Dl!=150&&Dl!=151&&Dl!=160&&Dl!=162&&Dl!=163&&Dl!=164&&Dl!=172&&Dl!=174&&Dl!=178&&Dl!=180&&Dl!=181&&Dl!=186&&Dl!=198&&Dl!=200&&Dl!=201&&Dl!=205&&Dl!=220&&Dl!=224&&Dl!=232&&Dl!=236&&Dl!=237&&Dl!=247&&Dl!=248&&Dl!=249&&Dl!=254&&Dl!=266&&Dl!=270&&Dl!=273&&Dl!=279&&Dl!=280&&Dl!=281&&Dl!=282&&Dl!=23578&&Dl!=24090){Dl=Ol(3,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{switch(Bl){case 46:wl(46);break;case 47:wl(47);break;default:wl(26)}Tl(265),Or(),Al(3,t,-1);continue}catch(a){Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(3,t,-2);break}}}if(Dl!=-1&&Dl!=46&&Dl!=47)break;switch(Bl){case 46:wl(46);break;case 47:wl(47);break;default:wl(26)}Tl(265),Or()}}function Ar(){$l.startNonterminal(\"StepExpr\",Hl);switch(Bl){case 82:Nl(285);break;case 121:Nl(283);break;case 184:case 216:Nl(282);break;case 96:case 119:case 202:case 244:case 256:Nl(247);break;case 78:case 124:case 152:case 165:case 167:case 242:case 243:case 253:Nl(240);break;case 73:case 74:case 93:case 111:case 112:case 135:case 136:case 206:case 212:case 213:case 229:Nl(246);break;case 6:case 70:case 72:case 75:case 77:case 79:case 80:case 81:case 83:case 84:case 85:case 86:case 88:case 89:case 90:case 91:case 94:case 97:case 98:case 101:case 102:case 103:case 104:case 105:case 106:case 108:case 109:case 110:case 113:case 118:case 120:case 122:case 123:case 125:case 126:case 128:case 129:case 131:case 132:case 133:case 134:case 137:case 141:case 145:case 146:case 148:case 150:case 151:case 153:case 154:case 155:case 159:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 174:case 176:case 178:case 180:case 181:case 182:case 185:case 186:case 191:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 218:case 219:case 220:case 221:case 222:case 224:case 225:case 226:case 227:case 228:case 234:case 235:case 236:case 237:case 240:case 248:case 249:case 250:case 251:case 252:case 254:case 257:case 260:case 261:case 262:case 263:case 266:case 267:case 270:case 274:Nl(244);break;default:Dl=Bl}if(Dl==35922||Dl==35961||Dl==36024||Dl==36056||Dl==38482||Dl==38521||Dl==38584||Dl==38616||Dl==40530||Dl==40569||Dl==40632||Dl==40664||Dl==41042||Dl==41081||Dl==41144||Dl==41176||Dl==41554||Dl==41593||Dl==41656||Dl==41688||Dl==43090||Dl==43129||Dl==43192||Dl==43224||Dl==45138||Dl==45177||Dl==45240||Dl==45272||Dl==45650||Dl==45689||Dl==45752||Dl==45784||Dl==46162||Dl==46201||Dl==46264||Dl==46296||Dl==48210||Dl==48249||Dl==48312||Dl==48344||Dl==53842||Dl==53881||Dl==53944||Dl==53976||Dl==55890||Dl==55929||Dl==55992||Dl==56024||Dl==57938||Dl==57977||Dl==58040||Dl==58072||Dl==60498||Dl==60537||Dl==60600||Dl==60632||Dl==62546||Dl==62585||Dl==62648||Dl==62680||Dl==63058||Dl==63097||Dl==63160||Dl==63192||Dl==64594||Dl==64633||Dl==64696||Dl==64728||Dl==65618||Dl==65657||Dl==65720||Dl==65752||Dl==67154||Dl==67193||Dl==67256||Dl==67288||Dl==70226||Dl==70265||Dl==70328||Dl==70360||Dl==74834||Dl==74873||Dl==74936||Dl==74968||Dl==75858||Dl==75897||Dl==75960||Dl==75992||Dl==76882||Dl==76921||Dl==76984||Dl==77016||Dl==77394||Dl==77433||Dl==77496||Dl==77528||Dl==82002||Dl==82041||Dl==82104||Dl==82136||Dl==83026||Dl==83065||Dl==83128||Dl==83160||Dl==83538||Dl==83577||Dl==83640||Dl==83672||Dl==84050||Dl==84089||Dl==84152||Dl==84184||Dl==88146||Dl==88185||Dl==88248||Dl==88280||Dl==89170||Dl==89209||Dl==89272||Dl==89304||Dl==91218||Dl==91257||Dl==91320||Dl==91352||Dl==92242||Dl==92281||Dl==92344||Dl==92376||Dl==92754||Dl==92793||Dl==92856||Dl==92888||Dl==95314||Dl==95353||Dl==95416||Dl==95448||Dl==101458||Dl==101497||Dl==101560||Dl==101592||Dl==102482||Dl==102521||Dl==102584||Dl==102616||Dl==102994||Dl==103033||Dl==103096||Dl==103128||Dl==112722||Dl==112761||Dl==112824||Dl==112856||Dl==114770||Dl==114809||Dl==114872||Dl==114904||Dl==120914||Dl==120953||Dl==121016||Dl==121048||Dl==121426||Dl==121465||Dl==121528||Dl==121560||Dl==127058||Dl==127097||Dl==127160||Dl==127192||Dl==127570||Dl==127609||Dl==127672||Dl==127704||Dl==130130||Dl==130169||Dl==130232||Dl==130264||Dl==136274||Dl==136313||Dl==136376||Dl==136408||Dl==138322||Dl==138361||Dl==138424||Dl==138456){Dl=Ol(4,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Qr(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(4,Hl,Dl)}}switch(Dl){case-1:case 8:case 9:case 10:case 11:case 31:case 32:case 34:case 44:case 54:case 55:case 59:case 68:case 276:case 278:case 3154:case 3193:case 9912:case 9944:case 14854:case 14918:case 14920:case 14921:case 14922:case 14923:case 14925:case 14926:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14936:case 14937:case 14938:case 14939:case 14941:case 14942:case 14944:case 14945:case 14946:case 14949:case 14950:case 14951:case 14952:case 14953:case 14954:case 14956:case 14957:case 14958:case 14959:case 14960:case 14961:case 14966:case 14967:case 14968:case 14969:case 14970:case 14971:case 14972:case 14973:case 14974:case 14976:case 14977:case 14979:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14989:case 14993:case 14994:case 14996:case 14998:case 14999:case 15e3:case 15001:case 15002:case 15003:case 15007:case 15008:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15015:case 15018:case 15019:case 15020:case 15022:case 15024:case 15026:case 15028:case 15029:case 15030:case 15032:case 15033:case 15034:case 15039:case 15040:case 15042:case 15046:case 15047:case 15048:case 15049:case 15050:case 15051:case 15054:case 15060:case 15061:case 15064:case 15066:case 15067:case 15068:case 15069:case 15070:case 15072:case 15073:case 15074:case 15075:case 15076:case 15077:case 15082:case 15083:case 15084:case 15085:case 15088:case 15090:case 15091:case 15092:case 15096:case 15097:case 15098:case 15099:case 15100:case 15101:case 15102:case 15104:case 15105:case 15108:case 15109:case 15110:case 15111:case 15114:case 15115:case 15118:case 15122:case 17414:case 17478:case 17480:case 17481:case 17482:case 17483:case 17485:case 17487:case 17488:case 17489:case 17491:case 17492:case 17493:case 17494:case 17496:case 17497:case 17498:case 17499:case 17501:case 17502:case 17505:case 17506:case 17509:case 17510:case 17511:case 17512:case 17513:case 17514:case 17516:case 17517:case 17518:case 17519:case 17520:case 17521:case 17526:case 17527:case 17530:case 17531:case 17533:case 17534:case 17536:case 17537:case 17539:case 17540:case 17541:case 17542:case 17543:case 17544:case 17545:case 17549:case 17553:case 17554:case 17556:case 17558:case 17559:case 17561:case 17562:case 17563:case 17567:case 17568:case 17569:case 17570:case 17571:case 17572:case 17574:case 17578:case 17579:case 17580:case 17582:case 17584:case 17586:case 17588:case 17589:case 17590:case 17592:case 17594:case 17600:case 17602:case 17606:case 17607:case 17608:case 17609:case 17610:case 17611:case 17614:case 17620:case 17621:case 17626:case 17627:case 17628:case 17629:case 17630:case 17632:case 17633:case 17636:case 17637:case 17642:case 17643:case 17644:case 17645:case 17648:case 17656:case 17657:case 17658:case 17659:case 17660:case 17662:case 17664:case 17665:case 17668:case 17669:case 17670:case 17671:case 17674:case 17675:case 17678:case 17682:case 36946:case 36985:case 37048:case 37080:case 37458:case 37497:case 37560:case 37592:case 37970:case 38009:case 38072:case 38104:case 39506:case 39545:case 39608:case 39640:case 40018:case 40057:case 42066:case 42105:case 42168:case 42200:case 42578:case 42617:case 42680:case 42712:case 43602:case 43641:case 43704:case 43736:case 44114:case 44153:case 44216:case 44248:case 46674:case 46713:case 46776:case 46808:case 47698:case 47737:case 47800:case 47832:case 49234:case 49273:case 49336:case 49368:case 49746:case 49785:case 49848:case 49880:case 50258:case 50297:case 50360:case 50392:case 51794:case 51833:case 51896:case 51928:case 52306:case 52345:case 52408:case 52440:case 52818:case 52857:case 52920:case 52952:case 53330:case 53369:case 53432:case 53464:case 54354:case 54393:case 54456:case 54488:case 55378:case 55417:case 55480:case 55512:case 56402:case 56441:case 56504:case 56536:case 56914:case 56953:case 57016:case 57048:case 57426:case 57465:case 57528:case 57560:case 61010:case 61049:case 61112:case 61144:case 61522:case 61561:case 61624:case 61656:case 62034:case 62073:case 62136:case 62168:case 63570:case 63609:case 63672:case 63704:case 64082:case 64121:case 64184:case 64216:case 66130:case 66169:case 66232:case 66264:case 67666:case 67705:case 67768:case 67800:case 68178:case 68217:case 68280:case 68312:case 68690:case 68729:case 68792:case 68824:case 69202:case 69241:case 69304:case 69336:case 69714:case 69753:case 69816:case 69848:case 72274:case 72313:case 72376:case 72408:case 74322:case 74361:case 74424:case 74456:case 77906:case 77945:case 78008:case 78040:case 78418:case 78457:case 78520:case 78552:case 78930:case 78969:case 79032:case 79064:case 79442:case 79481:case 79544:case 79576:case 81490:case 81529:case 81592:case 81624:case 82514:case 82553:case 82616:case 82648:case 84562:case 84601:case 84664:case 84696:case 85074:case 85113:case 85176:case 85208:case 85586:case 85625:case 87122:case 87161:case 87224:case 87256:case 87634:case 87673:case 87736:case 87768:case 90194:case 90233:case 90296:case 90328:case 93266:case 93305:case 93368:case 93400:case 94290:case 94329:case 94392:case 94424:case 94802:case 94841:case 94904:case 94936:case 97874:case 97913:case 97976:case 98008:case 98386:case 98425:case 98488:case 98520:case 99410:case 99449:case 99512:case 99544:case 101970:case 102009:case 102072:case 102104:case 103506:case 103545:case 103608:case 103640:case 104018:case 104057:case 104120:case 104152:case 105554:case 105593:case 105656:case 105688:case 108626:case 108665:case 108728:case 108760:case 109138:case 109177:case 109240:case 109272:case 110674:case 110713:case 110776:case 110808:case 111698:case 111737:case 111800:case 111832:case 112210:case 112249:case 112312:case 112344:case 113234:case 113273:case 113336:case 113368:case 113746:case 113785:case 113848:case 113880:case 115282:case 115321:case 115384:case 115416:case 115794:case 115833:case 115896:case 115928:case 116306:case 116345:case 116408:case 116440:case 116818:case 116857:case 116920:case 116952:case 117330:case 117369:case 117432:case 117464:case 119890:case 119929:case 119992:case 120024:case 120402:case 120441:case 120504:case 120536:case 122962:case 123001:case 123064:case 123096:case 123986:case 124025:case 124498:case 124537:case 124600:case 124632:case 125010:case 125049:case 125112:case 125144:case 128082:case 128121:case 128184:case 128216:case 128594:case 128633:case 128696:case 128728:case 129106:case 129145:case 129208:case 129240:case 129618:case 129657:case 129720:case 129752:case 131154:case 131193:case 131256:case 131288:case 131666:case 131705:case 131768:case 131800:case 133202:case 133241:case 133304:case 133336:case 133714:case 133753:case 133816:case 133848:case 134226:case 134265:case 134328:case 134360:case 134738:case 134777:case 134840:case 134872:case 136786:case 136825:case 136888:case 136920:case 140370:case 140409:case 140472:case 140504:case 141394:case 141408:case 141431:case 141433:case 141496:case 141514:case 141528:case 141556:case 141568:Kr();break;default:Mr()}$l.endNonterminal(\"StepExpr\",Hl)}function Or(){switch(Bl){case 82:Nl(285);break;case 121:Nl(283);break;case 184:case 216:Nl(282);break;case 96:case 119:case 202:case 244:case 256:Nl(247);break;case 78:case 124:case 152:case 165:case 167:case 242:case 243:case 253:Nl(240);break;case 73:case 74:case 93:case 111:case 112:case 135:case 136:case 206:case 212:case 213:case 229:Nl(246);break;case 6:case 70:case 72:case 75:case 77:case 79:case 80:case 81:case 83:case 84:case 85:case 86:case 88:case 89:case 90:case 91:case 94:case 97:case 98:case 101:case 102:case 103:case 104:case 105:case 106:case 108:case 109:case 110:case 113:case 118:case 120:case 122:case 123:case 125:case 126:case 128:case 129:case 131:case 132:case 133:case 134:case 137:case 141:case 145:case 146:case 148:case 150:case 151:case 153:case 154:case 155:case 159:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 174:case 176:case 178:case 180:case 181:case 182:case 185:case 186:case 191:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 218:case 219:case 220:case 221:case 222:case 224:case 225:case 226:case 227:case 228:case 234:case 235:case 236:case 237:case 240:case 248:case 249:case 250:case 251:case 252:case 254:case 257:case 260:case 261:case 262:case 263:case 266:case 267:case 270:case 274:Nl(244);break;default:Dl=Bl}if(Dl==35922||Dl==35961||Dl==36024||Dl==36056||Dl==38482||Dl==38521||Dl==38584||Dl==38616||Dl==40530||Dl==40569||Dl==40632||Dl==40664||Dl==41042||Dl==41081||Dl==41144||Dl==41176||Dl==41554||Dl==41593||Dl==41656||Dl==41688||Dl==43090||Dl==43129||Dl==43192||Dl==43224||Dl==45138||Dl==45177||Dl==45240||Dl==45272||Dl==45650||Dl==45689||Dl==45752||Dl==45784||Dl==46162||Dl==46201||Dl==46264||Dl==46296||Dl==48210||Dl==48249||Dl==48312||Dl==48344||Dl==53842||Dl==53881||Dl==53944||Dl==53976||Dl==55890||Dl==55929||Dl==55992||Dl==56024||Dl==57938||Dl==57977||Dl==58040||Dl==58072||Dl==60498||Dl==60537||Dl==60600||Dl==60632||Dl==62546||Dl==62585||Dl==62648||Dl==62680||Dl==63058||Dl==63097||Dl==63160||Dl==63192||Dl==64594||Dl==64633||Dl==64696||Dl==64728||Dl==65618||Dl==65657||Dl==65720||Dl==65752||Dl==67154||Dl==67193||Dl==67256||Dl==67288||Dl==70226||Dl==70265||Dl==70328||Dl==70360||Dl==74834||Dl==74873||Dl==74936||Dl==74968||Dl==75858||Dl==75897||Dl==75960||Dl==75992||Dl==76882||Dl==76921||Dl==76984||Dl==77016||Dl==77394||Dl==77433||Dl==77496||Dl==77528||Dl==82002||Dl==82041||Dl==82104||Dl==82136||Dl==83026||Dl==83065||Dl==83128||Dl==83160||Dl==83538||Dl==83577||Dl==83640||Dl==83672||Dl==84050||Dl==84089||Dl==84152||Dl==84184||Dl==88146||Dl==88185||Dl==88248||Dl==88280||Dl==89170||Dl==89209||Dl==89272||Dl==89304||Dl==91218||Dl==91257||Dl==91320||Dl==91352||Dl==92242||Dl==92281||Dl==92344||Dl==92376||Dl==92754||Dl==92793||Dl==92856||Dl==92888||Dl==95314||Dl==95353||Dl==95416||Dl==95448||Dl==101458||Dl==101497||Dl==101560||Dl==101592||Dl==102482||Dl==102521||Dl==102584||Dl==102616||Dl==102994||Dl==103033||Dl==103096||Dl==103128||Dl==112722||Dl==112761||Dl==112824||Dl==112856||Dl==114770||Dl==114809||Dl==114872||Dl==114904||Dl==120914||Dl==120953||Dl==121016||Dl==121048||Dl==121426||Dl==121465||Dl==121528||Dl==121560||Dl==127058||Dl==127097||Dl==127160||Dl==127192||Dl==127570||Dl==127609||Dl==127672||Dl==127704||Dl==130130||Dl==130169||Dl==130232||Dl==130264||Dl==136274||Dl==136313||Dl==136376||Dl==136408||Dl==138322||Dl==138361||Dl==138424||Dl==138456){Dl=Ol(4,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Qr(),Al(4,t,-1),Dl=-3}catch(a){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(4,t,-2)}}}switch(Dl){case-1:case 8:case 9:case 10:case 11:case 31:case 32:case 34:case 44:case 54:case 55:case 59:case 68:case 276:case 278:case 3154:case 3193:case 9912:case 9944:case 14854:case 14918:case 14920:case 14921:case 14922:case 14923:case 14925:case 14926:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14936:case 14937:case 14938:case 14939:case 14941:case 14942:case 14944:case 14945:case 14946:case 14949:case 14950:case 14951:case 14952:case 14953:case 14954:case 14956:case 14957:case 14958:case 14959:case 14960:case 14961:case 14966:case 14967:case 14968:case 14969:case 14970:case 14971:case 14972:case 14973:case 14974:case 14976:case 14977:case 14979:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14989:case 14993:case 14994:case 14996:case 14998:case 14999:case 15e3:case 15001:case 15002:case 15003:case 15007:case 15008:case 15009:case 15010:case 15011:case 15012:case 15013:case 15014:case 15015:case 15018:case 15019:case 15020:case 15022:case 15024:case 15026:case 15028:case 15029:case 15030:case 15032:case 15033:case 15034:case 15039:case 15040:case 15042:case 15046:case 15047:case 15048:case 15049:case 15050:case 15051:case 15054:case 15060:case 15061:case 15064:case 15066:case 15067:case 15068:case 15069:case 15070:case 15072:case 15073:case 15074:case 15075:case 15076:case 15077:case 15082:case 15083:case 15084:case 15085:case 15088:case 15090:case 15091:case 15092:case 15096:case 15097:case 15098:case 15099:case 15100:case 15101:case 15102:case 15104:case 15105:case 15108:case 15109:case 15110:case 15111:case 15114:case 15115:case 15118:case 15122:case 17414:case 17478:case 17480:case 17481:case 17482:case 17483:case 17485:case 17487:case 17488:case 17489:case 17491:case 17492:case 17493:case 17494:case 17496:case 17497:case 17498:case 17499:case 17501:case 17502:case 17505:case 17506:case 17509:case 17510:case 17511:case 17512:case 17513:case 17514:case 17516:case 17517:case 17518:case 17519:case 17520:case 17521:case 17526:case 17527:case 17530:case 17531:case 17533:case 17534:case 17536:case 17537:case 17539:case 17540:case 17541:case 17542:case 17543:case 17544:case 17545:case 17549:case 17553:case 17554:case 17556:case 17558:case 17559:case 17561:case 17562:case 17563:case 17567:case 17568:case 17569:case 17570:case 17571:case 17572:case 17574:case 17578:case 17579:case 17580:case 17582:case 17584:case 17586:case 17588:case 17589:case 17590:case 17592:case 17594:case 17600:case 17602:case 17606:case 17607:case 17608:case 17609:case 17610:case 17611:case 17614:case 17620:case 17621:case 17626:case 17627:case 17628:case 17629:case 17630:case 17632:case 17633:case 17636:case 17637:case 17642:case 17643:case 17644:case 17645:case 17648:case 17656:case 17657:case 17658:case 17659:case 17660:case 17662:case 17664:case 17665:case 17668:case 17669:case 17670:case 17671:case 17674:case 17675:case 17678:case 17682:case 36946:case 36985:case 37048:case 37080:case 37458:case 37497:case 37560:case 37592:case 37970:case 38009:case 38072:case 38104:case 39506:case 39545:case 39608:case 39640:case 40018:case 40057:case 42066:case 42105:case 42168:case 42200:case 42578:case 42617:case 42680:case 42712:case 43602:case 43641:case 43704:case 43736:case 44114:case 44153:case 44216:case 44248:case 46674:case 46713:case 46776:case 46808:case 47698:case 47737:case 47800:case 47832:case 49234:case 49273:case 49336:case 49368:case 49746:case 49785:case 49848:case 49880:case 50258:case 50297:case 50360:case 50392:case 51794:case 51833:case 51896:case 51928:case 52306:case 52345:case 52408:case 52440:case 52818:case 52857:case 52920:case 52952:case 53330:case 53369:case 53432:case 53464:case 54354:case 54393:case 54456:case 54488:case 55378:case 55417:case 55480:case 55512:case 56402:case 56441:case 56504:case 56536:case 56914:case 56953:case 57016:case 57048:case 57426:case 57465:case 57528:case 57560:case 61010:case 61049:case 61112:case 61144:case 61522:case 61561:case 61624:case 61656:case 62034:case 62073:case 62136:case 62168:case 63570:case 63609:case 63672:case 63704:case 64082:case 64121:case 64184:case 64216:case 66130:case 66169:case 66232:case 66264:case 67666:case 67705:case 67768:case 67800:case 68178:case 68217:case 68280:case 68312:case 68690:case 68729:case 68792:case 68824:case 69202:case 69241:case 69304:case 69336:case 69714:case 69753:case 69816:case 69848:case 72274:case 72313:case 72376:case 72408:case 74322:case 74361:case 74424:case 74456:case 77906:case 77945:case 78008:case 78040:case 78418:case 78457:case 78520:case 78552:case 78930:case 78969:case 79032:case 79064:case 79442:case 79481:case 79544:case 79576:case 81490:case 81529:case 81592:case 81624:case 82514:case 82553:case 82616:case 82648:case 84562:case 84601:case 84664:case 84696:case 85074:case 85113:case 85176:case 85208:case 85586:case 85625:case 87122:case 87161:case 87224:case 87256:case 87634:case 87673:case 87736:case 87768:case 90194:case 90233:case 90296:case 90328:case 93266:case 93305:case 93368:case 93400:case 94290:case 94329:case 94392:case 94424:case 94802:case 94841:case 94904:case 94936:case 97874:case 97913:case 97976:case 98008:case 98386:case 98425:case 98488:case 98520:case 99410:case 99449:case 99512:case 99544:case 101970:case 102009:case 102072:case 102104:case 103506:case 103545:case 103608:case 103640:case 104018:case 104057:case 104120:case 104152:case 105554:case 105593:case 105656:case 105688:case 108626:case 108665:case 108728:case 108760:case 109138:case 109177:case 109240:case 109272:case 110674:case 110713:case 110776:case 110808:case 111698:case 111737:case 111800:case 111832:case 112210:case 112249:case 112312:case 112344:case 113234:case 113273:case 113336:case 113368:case 113746:case 113785:case 113848:case 113880:case 115282:case 115321:case 115384:case 115416:case 115794:case 115833:case 115896:case 115928:case 116306:case 116345:case 116408:case 116440:case 116818:case 116857:case 116920:case 116952:case 117330:case 117369:case 117432:case 117464:case 119890:case 119929:case 119992:case 120024:case 120402:case 120441:case 120504:case 120536:case 122962:case 123001:case 123064:case 123096:case 123986:case 124025:case 124498:case 124537:case 124600:case 124632:case 125010:case 125049:case 125112:case 125144:case 128082:case 128121:case 128184:case 128216:case 128594:case 128633:case 128696:case 128728:case 129106:case 129145:case 129208:case 129240:case 129618:case 129657:case 129720:case 129752:case 131154:case 131193:case 131256:case 131288:case 131666:case 131705:case 131768:case 131800:case 133202:case 133241:case 133304:case 133336:case 133714:case 133753:case 133816:case 133848:case 134226:case 134265:case 134328:case 134360:case 134738:case 134777:case 134840:case 134872:case 136786:case 136825:case 136888:case 136920:case 140370:case 140409:case 140472:case 140504:case 141394:case 141408:case 141431:case 141433:case 141496:case 141514:case 141528:case 141556:case 141568:Qr();break;case-3:break;default:_r()}}function Mr(){$l.startNonterminal(\"AxisStep\",Hl);switch(Bl){case 73:case 74:case 206:case 212:case 213:Nl(242);break;default:Dl=Bl}switch(Dl){case 45:case 26185:case 26186:case 26318:case 26324:case 26325:Ir();break;default:Dr()}Tl(238),Sl(),Zr(),$l.endNonterminal(\"AxisStep\",Hl)}function _r(){switch(Bl){case 73:case 74:case 206:case 212:case 213:Nl(242);break;default:Dl=Bl}switch(Dl){case 45:case 26185:case 26186:case 26318:case 26324:case 26325:qr();break;default:Pr()}Tl(238),ei()}function Dr(){$l.startNonterminal(\"ForwardStep\",Hl);switch(Bl){case 82:Nl(245);break;case 93:case 111:case 112:case 135:case 136:case 229:Nl(242);break;default:Dl=Bl}switch(Dl){case 26194:case 26205:case 26223:case 26224:case 26247:case 26248:case 26341:Hr(),Tl(257),Sl(),Xr();break;default:jr()}$l.endNonterminal(\"ForwardStep\",Hl)}function Pr(){switch(Bl){case 82:Nl(245);break;case 93:case 111:case 112:case 135:case 136:case 229:Nl(242);break;default:Dl=Bl}switch(Dl){case 26194:case 26205:case 26223:case 26224:case 26247:case 26248:case 26341:Br(),Tl(257),Vr();break;default:Fr()}}function Hr(){$l.startNonterminal(\"ForwardAxis\",Hl);switch(Bl){case 93:bl(93),Tl(26),bl(51);break;case 111:bl(111),Tl(26),bl(51);break;case 82:bl(82),Tl(26),bl(51);break;case 229:bl(229),Tl(26),bl(51);break;case 112:bl(112),Tl(26),bl(51);break;case 136:bl(136),Tl(26),bl(51);break;default:bl(135),Tl(26),bl(51)}$l.endNonterminal(\"ForwardAxis\",Hl)}function Br(){switch(Bl){case 93:wl(93),Tl(26),wl(51);break;case 111:wl(111),Tl(26),wl(51);break;case 82:wl(82),Tl(26),wl(51);break;case 229:wl(229),Tl(26),wl(51);break;case 112:wl(112),Tl(26),wl(51);break;case 136:wl(136),Tl(26),wl(51);break;default:wl(135),Tl(26),wl(51)}}function jr(){$l.startNonterminal(\"AbbrevForwardStep\",Hl),Bl==66&&bl(66),Tl(257),Sl(),Xr(),$l.endNonterminal(\"AbbrevForwardStep\",Hl)}function Fr(){Bl==66&&wl(66),Tl(257),Vr()}function Ir(){$l.startNonterminal(\"ReverseStep\",Hl);switch(Bl){case 45:zr();break;default:Rr(),Tl(257),Sl(),Xr()}$l.endNonterminal(\"ReverseStep\",Hl)}function qr(){switch(Bl){case 45:Wr();break;default:Ur(),Tl(257),Vr()}}function Rr(){$l.startNonterminal(\"ReverseAxis\",Hl);switch(Bl){case 206:bl(206),Tl(26),bl(51);break;case 73:bl(73),Tl(26),bl(51);break;case 213:bl(213),Tl(26),bl(51);break;case 212:bl(212),Tl(26),bl(51);break;default:bl(74),Tl(26),bl(51)}$l.endNonterminal(\"ReverseAxis\",Hl)}function Ur(){switch(Bl){case 206:wl(206),Tl(26),wl(51);break;case 73:wl(73),Tl(26),wl(51);break;case 213:wl(213),Tl(26),wl(51);break;case 212:wl(212),Tl(26),wl(51);break;default:wl(74),Tl(26),wl(51)}}function zr(){$l.startNonterminal(\"AbbrevReverseStep\",Hl),bl(45),$l.endNonterminal(\"AbbrevReverseStep\",Hl)}function Wr(){wl(45)}function Xr(){$l.startNonterminal(\"NodeTest\",Hl);switch(Bl){case 82:case 96:case 120:case 121:case 185:case 191:case 216:case 226:case 227:case 244:Nl(241);break;default:Dl=Bl}switch(Dl){case 17490:case 17504:case 17528:case 17529:case 17593:case 17599:case 17624:case 17634:case 17635:case 17652:Ms();break;default:$r()}$l.endNonterminal(\"NodeTest\",Hl)}function Vr(){switch(Bl){case 82:case 96:case 120:case 121:case 185:case 191:case 216:case 226:case 227:case 244:Nl(241);break;default:Dl=Bl}switch(Dl){case 17490:case 17504:case 17528:case 17529:case 17593:case 17599:case 17624:case 17634:case 17635:case 17652:_s();break;default:Jr()}}function $r(){$l.startNonterminal(\"NameTest\",Hl);switch(Bl){case 5:bl(5);break;default:_a()}$l.endNonterminal(\"NameTest\",Hl)}function Jr(){switch(Bl){case 5:wl(5);break;default:Da()}}function Kr(){$l.startNonterminal(\"PostfixExpr\",Hl),rl();for(;;){Tl(241);if(Bl!=34&&Bl!=68)break;switch(Bl){case 68:Sl(),ti();break;default:Sl(),Gr()}}$l.endNonterminal(\"PostfixExpr\",Hl)}function Qr(){il();for(;;){Tl(241);if(Bl!=34&&Bl!=68)break;switch(Bl){case 68:ni();break;default:Yr()}}}function Gr(){$l.startNonterminal(\"ArgumentList\",Hl),bl(34),Tl(276);if(Bl!=37){Sl(),Ei();for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(271),Sl(),Ei()}}bl(37),$l.endNonterminal(\"ArgumentList\",Hl)}function Yr(){wl(34),Tl(276);if(Bl!=37){Si();for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(271),Si()}}wl(37)}function Zr(){$l.startNonterminal(\"PredicateList\",Hl);for(;;){Tl(238);if(Bl!=68)break;Sl(),ti()}$l.endNonterminal(\"PredicateList\",Hl)}function ei(){for(;;){Tl(238);if(Bl!=68)break;ni()}}function ti(){$l.startNonterminal(\"Predicate\",Hl),bl(68),Tl(267),Sl(),Q(),bl(69),$l.endNonterminal(\"Predicate\",Hl)}function ni(){wl(68),Tl(267),G(),wl(69)}function ri(){$l.startNonterminal(\"Literal\",Hl);switch(Bl){case 11:bl(11);break;default:si()}$l.endNonterminal(\"Literal\",Hl)}function ii(){switch(Bl){case 11:wl(11);break;default:oi()}}function si(){$l.startNonterminal(\"NumericLiteral\",Hl);switch(Bl){case 8:bl(8);break;case 9:bl(9);break;default:bl(10)}$l.endNonterminal(\"NumericLiteral\",Hl)}function oi(){switch(Bl){case 8:wl(8);break;case 9:wl(9);break;default:wl(10)}}function ui(){$l.startNonterminal(\"VarRef\",Hl),bl(31),Tl(255),Sl(),fi(),$l.endNonterminal(\"VarRef\",Hl)}function ai(){wl(31),Tl(255),li()}function fi(){$l.startNonterminal(\"VarName\",Hl),_a(),$l.endNonterminal(\"VarName\",Hl)}function li(){Da()}function ci(){$l.startNonterminal(\"ParenthesizedExpr\",Hl),bl(34),Tl(269),Bl!=37&&(Sl(),Q()),bl(37),$l.endNonterminal(\"ParenthesizedExpr\",Hl)}function hi(){wl(34),Tl(269),Bl!=37&&G(),wl(37)}function pi(){$l.startNonterminal(\"ContextItemExpr\",Hl),bl(44),$l.endNonterminal(\"ContextItemExpr\",Hl)}function di(){wl(44)}function vi(){$l.startNonterminal(\"OrderedExpr\",Hl),bl(202),Tl(87),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"OrderedExpr\",Hl)}function mi(){wl(202),Tl(87),wl(276),Tl(267),G(),wl(282)}function gi(){$l.startNonterminal(\"UnorderedExpr\",Hl),bl(256),Tl(87),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"UnorderedExpr\",Hl)}function yi(){wl(256),Tl(87),wl(276),Tl(267),G(),wl(282)}function bi(){$l.startNonterminal(\"FunctionCall\",Hl),Pa(),Tl(22),Sl(),Gr(),$l.endNonterminal(\"FunctionCall\",Hl)}function wi(){Ha(),Tl(22),Yr()}function Ei(){$l.startNonterminal(\"Argument\",Hl);switch(Bl){case 64:xi();break;default:Af()}$l.endNonterminal(\"Argument\",Hl)}function Si(){switch(Bl){case 64:Ti();break;default:Of()}}function xi(){$l.startNonterminal(\"ArgumentPlaceholder\",Hl),bl(64),$l.endNonterminal(\"ArgumentPlaceholder\",Hl)}function Ti(){wl(64)}function Ni(){$l.startNonterminal(\"Constructor\",Hl);switch(Bl){case 54:case 55:case 59:ki();break;default:Xi()}$l.endNonterminal(\"Constructor\",Hl)}function Ci(){switch(Bl){case 54:case 55:case 59:Li();break;default:Vi()}}function ki(){$l.startNonterminal(\"DirectConstructor\",Hl);switch(Bl){case 54:Ai();break;case 55:Ri();break;default:zi()}$l.endNonterminal(\"DirectConstructor\",Hl)}function Li(){switch(Bl){case 54:Oi();break;case 55:Ui();break;default:Wi()}}function Ai(){$l.startNonterminal(\"DirElemConstructor\",Hl),bl(54),Cl(4),bl(20),Mi();switch(Bl){case 48:bl(48);break;default:bl(61);for(;;){Cl(174);if(Bl==56)break;Ii()}bl(56),Cl(4),bl(20),Cl(12),Bl==21&&bl(21),Cl(8),bl(61)}$l.endNonterminal(\"DirElemConstructor\",Hl)}function Oi(){wl(54),Cl(4),wl(20),_i();switch(Bl){case 48:wl(48);break;default:wl(61);for(;;){Cl(174);if(Bl==56)break;qi()}wl(56),Cl(4),wl(20),Cl(12),Bl==21&&wl(21),Cl(8),wl(61)}}function Mi(){$l.startNonterminal(\"DirAttributeList\",Hl);for(;;){Cl(19);if(Bl!=21)break;bl(21),Cl(91),Bl==20&&(bl(20),Cl(11),Bl==21&&bl(21),Cl(7),bl(60),Cl(18),Bl==21&&bl(21),Di())}$l.endNonterminal(\"DirAttributeList\",Hl)}function _i(){for(;;){Cl(19);if(Bl!=21)break;wl(21),Cl(91),Bl==20&&(wl(20),Cl(11),Bl==21&&wl(21),Cl(7),wl(60),Cl(18),Bl==21&&wl(21),Pi())}}function Di(){$l.startNonterminal(\"DirAttributeValue\",Hl),Cl(14);switch(Bl){case 28:bl(28);for(;;){Cl(167);if(Bl==28)break;switch(Bl){case 13:bl(13);break;default:Hi()}}bl(28);break;default:bl(33);for(;;){Cl(168);if(Bl==33)break;switch(Bl){case 14:bl(14);break;default:ji()}}bl(33)}$l.endNonterminal(\"DirAttributeValue\",Hl)}function Pi(){Cl(14);switch(Bl){case 28:wl(28);for(;;){Cl(167);if(Bl==28)break;switch(Bl){case 13:wl(13);break;default:Bi()}}wl(28);break;default:wl(33);for(;;){Cl(168);if(Bl==33)break;switch(Bl){case 14:wl(14);break;default:Fi()}}wl(33)}}function Hi(){$l.startNonterminal(\"QuotAttrValueContent\",Hl);switch(Bl){case 16:bl(16);break;default:zf()}$l.endNonterminal(\"QuotAttrValueContent\",Hl)}function Bi(){switch(Bl){case 16:wl(16);break;default:Wf()}}function ji(){$l.startNonterminal(\"AposAttrValueContent\",Hl);switch(Bl){case 17:bl(17);break;default:zf()}$l.endNonterminal(\"AposAttrValueContent\",Hl)}function Fi(){switch(Bl){case 17:wl(17);break;default:Wf()}}function Ii(){$l.startNonterminal(\"DirElemContent\",Hl);switch(Bl){case 54:case 55:case 59:ki();break;case 4:bl(4);break;case 15:bl(15);break;default:zf()}$l.endNonterminal(\"DirElemContent\",Hl)}function qi(){switch(Bl){case 54:case 55:case 59:Li();break;case 4:wl(4);break;case 15:wl(15);break;default:Wf()}}function Ri(){$l.startNonterminal(\"DirCommentConstructor\",Hl),bl(55),Cl(1),bl(2),Cl(6),bl(43),$l.endNonterminal(\"DirCommentConstructor\",Hl)}function Ui(){wl(55),Cl(1),wl(2),Cl(6),wl(43)}function zi(){$l.startNonterminal(\"DirPIConstructor\",Hl),bl(59),Cl(3),bl(18),Cl(13),Bl==21&&(bl(21),Cl(2),bl(3)),Cl(9),bl(65),$l.endNonterminal(\"DirPIConstructor\",Hl)}function Wi(){wl(59),Cl(3),wl(18),Cl(13),Bl==21&&(wl(21),Cl(2),wl(3)),Cl(9),wl(65)}function Xi(){$l.startNonterminal(\"ComputedConstructor\",Hl);switch(Bl){case 119:$f();break;case 121:$i();break;case 82:Kf();break;case 184:Ki();break;case 244:tl();break;case 96:Zf();break;default:Gf()}$l.endNonterminal(\"ComputedConstructor\",Hl)}function Vi(){switch(Bl){case 119:Jf();break;case 121:Ji();break;case 82:Qf();break;case 184:Qi();break;case 244:nl();break;case 96:el();break;default:Yf()}}function $i(){$l.startNonterminal(\"CompElemConstructor\",Hl),bl(121),Tl(258);switch(Bl){case 276:bl(276),Tl(267),Sl(),Q(),bl(282);break;default:Sl(),_a()}Tl(87),bl(276),Tl(277),Bl!=282&&(Sl(),Xf()),bl(282),$l.endNonterminal(\"CompElemConstructor\",Hl)}function Ji(){wl(121),Tl(258);switch(Bl){case 276:wl(276),Tl(267),G(),wl(282);break;default:Da()}Tl(87),wl(276),Tl(277),Bl!=282&&Vf(),wl(282)}function Ki(){$l.startNonterminal(\"CompNamespaceConstructor\",Hl),bl(184),Tl(251);switch(Bl){case 276:bl(276),Tl(267),Sl(),Zi(),bl(282);break;default:Sl(),Gi()}Tl(87),bl(276),Tl(267),Sl(),ts(),bl(282),$l.endNonterminal(\"CompNamespaceConstructor\",Hl)}function Qi(){wl(184),Tl(251);switch(Bl){case 276:wl(276),Tl(267),es(),wl(282);break;default:Yi()}Tl(87),wl(276),Tl(267),ns(),wl(282)}function Gi(){$l.startNonterminal(\"Prefix\",Hl),Ba(),$l.endNonterminal(\"Prefix\",Hl)}function Yi(){ja()}function Zi(){$l.startNonterminal(\"PrefixExpr\",Hl),Q(),$l.endNonterminal(\"PrefixExpr\",Hl)}function es(){G()}function ts(){$l.startNonterminal(\"URIExpr\",Hl),Q(),$l.endNonterminal(\"URIExpr\",Hl)}function ns(){G()}function rs(){$l.startNonterminal(\"FunctionItemExpr\",Hl);switch(Bl){case 145:Nl(92);break;default:Dl=Bl}switch(Dl){case 32:case 17553:us();break;default:ss()}$l.endNonterminal(\"FunctionItemExpr\",Hl)}function is(){switch(Bl){case 145:Nl(92);break;default:Dl=Bl}switch(Dl){case 32:case 17553:as();break;default:os()}}function ss(){$l.startNonterminal(\"NamedFunctionRef\",Hl),_a(),Tl(20),bl(29),Tl(16),bl(8),$l.endNonterminal(\"NamedFunctionRef\",Hl)}function os(){Da(),Tl(20),wl(29),Tl(16),wl(8)}function us(){$l.startNonterminal(\"InlineFunctionExpr\",Hl);for(;;){Tl(97);if(Bl!=32)break;Sl(),H()}bl(145),Tl(22),bl(34),Tl(94),Bl==31&&(Sl(),R()),bl(37),Tl(111),Bl==79&&(bl(79),Tl(260),Sl(),ps()),Tl(87),Sl(),X(),$l.endNonterminal(\"InlineFunctionExpr\",Hl)}function as(){for(;;){Tl(97);if(Bl!=32)break;B()}wl(145),Tl(22),wl(34),Tl(94),Bl==31&&U(),wl(37),Tl(111),Bl==79&&(wl(79),Tl(260),ds()),Tl(87),V()}function fs(){$l.startNonterminal(\"SingleType\",Hl),co(),Tl(227),Bl==64&&bl(64),$l.endNonterminal(\"SingleType\",Hl)}function ls(){ho(),Tl(227),Bl==64&&wl(64)}function cs(){$l.startNonterminal(\"TypeDeclaration\",Hl),bl(79),Tl(260),Sl(),ps(),$l.endNonterminal(\"TypeDeclaration\",Hl)}function hs(){wl(79),Tl(260),ds()}function ps(){$l.startNonterminal(\"SequenceType\",Hl);switch(Bl){case 124:Nl(243);break;default:Dl=Bl}switch(Dl){case 17532:bl(124),Tl(22),bl(34),Tl(23),bl(37);break;default:gs(),Tl(239);switch(Bl){case 39:case 40:case 64:Sl(),vs();break;default:}}$l.endNonterminal(\"SequenceType\",Hl)}function ds(){switch(Bl){case 124:Nl(243);break;default:Dl=Bl}switch(Dl){case 17532:wl(124),Tl(22),wl(34),Tl(23),wl(37);break;default:ys(),Tl(239);switch(Bl){case 39:case 40:case 64:ms();break;default:}}}function vs(){$l.startNonterminal(\"OccurrenceIndicator\",Hl);switch(Bl){case 64:bl(64);break;case 39:bl(39);break;default:bl(40)}$l.endNonterminal(\"OccurrenceIndicator\",Hl)}function ms(){switch(Bl){case 64:wl(64);break;case 39:wl(39);break;default:wl(40)}}function gs(){$l.startNonterminal(\"ItemType\",Hl);switch(Bl){case 78:case 82:case 96:case 120:case 121:case 145:case 165:case 167:case 185:case 191:case 194:case 216:case 226:case 227:case 242:case 244:Nl(243);break;default:Dl=Bl}switch(Dl){case 17490:case 17504:case 17528:case 17529:case 17593:case 17599:case 17624:case 17634:case 17635:case 17652:Ms();break;case 17573:bl(165),Tl(22),bl(34),Tl(23),bl(37);break;case 32:case 17553:mo();break;case 34:So();break;case 17486:case 17575:case 17602:bs();break;case 17650:Es();break;default:As()}$l.endNonterminal(\"ItemType\",Hl)}function ys(){switch(Bl){case 78:case 82:case 96:case 120:case 121:case 145:case 165:case 167:case 185:case 191:case 194:case 216:case 226:case 227:case 242:case 244:Nl(243);break;default:Dl=Bl}switch(Dl){case 17490:case 17504:case 17528:case 17529:case 17593:case 17599:case 17624:case 17634:case 17635:case 17652:_s();break;case 17573:wl(165),Tl(22),wl(34),Tl(23),wl(37);break;case 32:case 17553:go();break;case 34:xo();break;case 17486:case 17575:case 17602:ws();break;case 17650:Ss();break;default:Os()}}function bs(){$l.startNonterminal(\"JSONTest\",Hl);switch(Bl){case 167:xs();break;case 194:Ns();break;default:ks()}$l.endNonterminal(\"JSONTest\",Hl)}function ws(){switch(Bl){case 167:Ts();break;case 194:Cs();break;default:Ls()}}function Es(){$l.startNonterminal(\"StructuredItemTest\",Hl),bl(242),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"StructuredItemTest\",Hl)}function Ss(){wl(242),Tl(22),wl(34),Tl(23),wl(37)}function xs(){$l.startNonterminal(\"JSONItemTest\",Hl),bl(167),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"JSONItemTest\",Hl)}function Ts(){wl(167),Tl(22),wl(34),Tl(23),wl(37)}function Ns(){$l.startNonterminal(\"JSONObjectTest\",Hl),bl(194),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"JSONObjectTest\",Hl)}function Cs(){wl(194),Tl(22),wl(34),Tl(23),wl(37)}function ks(){$l.startNonterminal(\"JSONArrayTest\",Hl),bl(78),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"JSONArrayTest\",Hl)}function Ls(){wl(78),Tl(22),wl(34),Tl(23),wl(37)}function As(){$l.startNonterminal(\"AtomicOrUnionType\",Hl),_a(),$l.endNonterminal(\"AtomicOrUnionType\",Hl)}function Os(){Da()}function Ms(){$l.startNonterminal(\"KindTest\",Hl);switch(Bl){case 120:Hs();break;case 121:Zs();break;case 82:Xs();break;case 227:ro();break;case 226:Ks();break;case 216:zs();break;case 96:Is();break;case 244:js();break;case 185:Rs();break;default:Ds()}$l.endNonterminal(\"KindTest\",Hl)}function _s(){switch(Bl){case 120:Bs();break;case 121:eo();break;case 82:Vs();break;case 227:io();break;case 226:Qs();break;case 216:Ws();break;case 96:qs();break;case 244:Fs();break;case 185:Us();break;default:Ps()}}function Ds(){$l.startNonterminal(\"AnyKindTest\",Hl),bl(191),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"AnyKindTest\",Hl)}function Ps(){wl(191),Tl(22),wl(34),Tl(23),wl(37)}function Hs(){$l.startNonterminal(\"DocumentTest\",Hl),bl(120),Tl(22),bl(34),Tl(144);if(Bl!=37)switch(Bl){case 121:Sl(),Zs();break;default:Sl(),ro()}Tl(23),bl(37),$l.endNonterminal(\"DocumentTest\",Hl)}function Bs(){wl(120),Tl(22),wl(34),Tl(144);if(Bl!=37)switch(Bl){case 121:eo();break;default:io()}Tl(23),wl(37)}function js(){$l.startNonterminal(\"TextTest\",Hl),bl(244),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"TextTest\",Hl)}function Fs(){wl(244),Tl(22),wl(34),Tl(23),wl(37)}function Is(){$l.startNonterminal(\"CommentTest\",Hl),bl(96),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"CommentTest\",Hl)}function qs(){wl(96),Tl(22),wl(34),Tl(23),wl(37)}function Rs(){$l.startNonterminal(\"NamespaceNodeTest\",Hl),bl(185),Tl(22),bl(34),Tl(23),bl(37),$l.endNonterminal(\"NamespaceNodeTest\",Hl)}function Us(){wl(185),Tl(22),wl(34),Tl(23),wl(37)}function zs(){$l.startNonterminal(\"PITest\",Hl),bl(216),Tl(22),bl(34),Tl(253);if(Bl!=37)switch(Bl){case 11:bl(11);break;default:Sl(),Ba()}Tl(23),bl(37),$l.endNonterminal(\"PITest\",Hl)}function Ws(){wl(216),Tl(22),wl(34),Tl(253);if(Bl!=37)switch(Bl){case 11:wl(11);break;default:ja()}Tl(23),wl(37)}function Xs(){$l.startNonterminal(\"AttributeTest\",Hl),bl(82),Tl(22),bl(34),Tl(261),Bl!=37&&(Sl(),$s(),Tl(101),Bl==41&&(bl(41),Tl(255),Sl(),po())),Tl(23),bl(37),$l.endNonterminal(\"AttributeTest\",Hl)}function Vs(){wl(82),Tl(22),wl(34),Tl(261),Bl!=37&&(Js(),Tl(101),Bl==41&&(wl(41),Tl(255),vo())),Tl(23),wl(37)}function $s(){$l.startNonterminal(\"AttribNameOrWildcard\",Hl);switch(Bl){case 38:bl(38);break;default:uo()}$l.endNonterminal(\"AttribNameOrWildcard\",Hl)}function Js(){switch(Bl){case 38:wl(38);break;default:ao()}}function Ks(){$l.startNonterminal(\"SchemaAttributeTest\",Hl),bl(226),Tl(22),bl(34),Tl(255),Sl(),Gs(),Tl(23),bl(37),$l.endNonterminal(\"SchemaAttributeTest\",Hl)}function Qs(){wl(226),Tl(22),wl(34),Tl(255),Ys(),Tl(23),wl(37)}function Gs(){$l.startNonterminal(\"AttributeDeclaration\",Hl),uo(),$l.endNonterminal(\"AttributeDeclaration\",Hl)}function Ys(){ao()}function Zs(){$l.startNonterminal(\"ElementTest\",Hl),bl(121),Tl(22),bl(34),Tl(261),Bl!=37&&(Sl(),to(),Tl(101),Bl==41&&(bl(41),Tl(255),Sl(),po(),Tl(102),Bl==64&&bl(64))),Tl(23),bl(37),$l.endNonterminal(\"ElementTest\",Hl)}function eo(){wl(121),Tl(22),wl(34),Tl(261),Bl!=37&&(no(),Tl(101),Bl==41&&(wl(41),Tl(255),vo(),Tl(102),Bl==64&&wl(64))),Tl(23),wl(37)}function to(){$l.startNonterminal(\"ElementNameOrWildcard\",Hl);switch(Bl){case 38:bl(38);break;default:fo()}$l.endNonterminal(\"ElementNameOrWildcard\",Hl)}function no(){switch(Bl){case 38:wl(38);break;default:lo()}}function ro(){$l.startNonterminal(\"SchemaElementTest\",Hl),bl(227),Tl(22),bl(34),Tl(255),Sl(),so(),Tl(23),bl(37),$l.endNonterminal(\"SchemaElementTest\",Hl)}function io(){wl(227),Tl(22),wl(34),Tl(255),oo(),Tl(23),wl(37)}function so(){$l.startNonterminal(\"ElementDeclaration\",Hl),fo(),$l.endNonterminal(\"ElementDeclaration\",Hl)}function oo(){lo()}function uo(){$l.startNonterminal(\"AttributeName\",Hl),_a(),$l.endNonterminal(\"AttributeName\",Hl)}function ao(){Da()}function fo(){$l.startNonterminal(\"ElementName\",Hl),_a(),$l.endNonterminal(\"ElementName\",Hl)}function lo(){Da()}function co(){$l.startNonterminal(\"SimpleTypeName\",Hl),po(),$l.endNonterminal(\"SimpleTypeName\",Hl)}function ho(){vo()}function po(){$l.startNonterminal(\"TypeName\",Hl),_a(),$l.endNonterminal(\"TypeName\",Hl)}function vo(){Da()}function mo(){$l.startNonterminal(\"FunctionTest\",Hl);for(;;){Tl(97);if(Bl!=32)break;Sl(),H()}switch(Bl){case 145:Nl(22);break;default:Dl=Bl}Dl=Ol(5,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{bo(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(5,Hl,Dl)}switch(Dl){case-1:Sl(),yo();break;default:Sl(),wo()}$l.endNonterminal(\"FunctionTest\",Hl)}function go(){for(;;){Tl(97);if(Bl!=32)break;B()}switch(Bl){case 145:Nl(22);break;default:Dl=Bl}Dl=Ol(5,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{bo(),Al(5,t,-1),Dl=-3}catch(a){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(5,t,-2)}}switch(Dl){case-1:bo();break;case-3:break;default:Eo()}}function yo(){$l.startNonterminal(\"AnyFunctionTest\",Hl),bl(145),Tl(22),bl(34),Tl(24),bl(38),Tl(23),bl(37),$l.endNonterminal(\"AnyFunctionTest\",Hl)}function bo(){wl(145),Tl(22),wl(34),Tl(24),wl(38),Tl(23),wl(37)}function wo(){$l.startNonterminal(\"TypedFunctionTest\",Hl),bl(145),Tl(22),bl(34),Tl(263);if(Bl!=37){Sl(),ps();for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(260),Sl(),ps()}}bl(37),Tl(30),bl(79),Tl(260),Sl(),ps(),$l.endNonterminal(\"TypedFunctionTest\",Hl)}function Eo(){wl(145),Tl(22),wl(34),Tl(263);if(Bl!=37){ds();for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(260),ds()}}wl(37),Tl(30),wl(79),Tl(260),ds()}function So(){$l.startNonterminal(\"ParenthesizedItemType\",Hl),bl(34),Tl(260),Sl(),gs(),Tl(23),bl(37),$l.endNonterminal(\"ParenthesizedItemType\",Hl)}function xo(){wl(34),Tl(260),ys(),Tl(23),wl(37)}function To(){$l.startNonterminal(\"RevalidationDecl\",Hl),bl(108),Tl(72),bl(222),Tl(152);switch(Bl){case 240:bl(240);break;case 171:bl(171);break;default:bl(233)}$l.endNonterminal(\"RevalidationDecl\",Hl)}function No(){$l.startNonterminal(\"InsertExprTargetChoice\",Hl);switch(Bl){case 70:bl(70);break;case 84:bl(84);break;default:if(Bl==79){bl(79),Tl(119);switch(Bl){case 134:bl(134);break;default:bl(170)}}Tl(54),bl(163)}$l.endNonterminal(\"InsertExprTargetChoice\",Hl)}function Co(){switch(Bl){case 70:wl(70);break;case 84:wl(84);break;default:if(Bl==79){wl(79),Tl(119);switch(Bl){case 134:wl(134);break;default:wl(170)}}Tl(54),wl(163)}}function ko(){$l.startNonterminal(\"InsertExpr\",Hl),bl(159),Tl(129);switch(Bl){case 191:bl(191);break;default:bl(192)}Tl(267),Sl(),Ho(),Sl(),No(),Tl(267),Sl(),jo(),$l.endNonterminal(\"InsertExpr\",Hl)}function Lo(){wl(159),Tl(129);switch(Bl){case 191:wl(191);break;default:wl(192)}Tl(267),Bo(),Co(),Tl(267),Fo()}function Ao(){$l.startNonterminal(\"DeleteExpr\",Hl),bl(110),Tl(129);switch(Bl){case 191:bl(191);break;default:bl(192)}Tl(267),Sl(),jo(),$l.endNonterminal(\"DeleteExpr\",Hl)}function Oo(){wl(110),Tl(129);switch(Bl){case 191:wl(191);break;default:wl(192)}Tl(267),Fo()}function Mo(){$l.startNonterminal(\"ReplaceExpr\",Hl),bl(219),Tl(130),Bl==261&&(bl(261),Tl(64),bl(196)),Tl(62),bl(191),Tl(267),Sl(),jo(),bl(270),Tl(267),Sl(),Af(),$l.endNonterminal(\"ReplaceExpr\",Hl)}function _o(){wl(219),Tl(130),Bl==261&&(wl(261),Tl(64),wl(196)),Tl(62),wl(191),Tl(267),Fo(),wl(270),Tl(267),Of()}function Do(){$l.startNonterminal(\"RenameExpr\",Hl),bl(218),Tl(62),bl(191),Tl(267),Sl(),jo(),bl(79),Tl(267),Sl(),Io(),$l.endNonterminal(\"RenameExpr\",Hl)}function Po(){wl(218),Tl(62),wl(191),Tl(267),Fo(),wl(79),Tl(267),qo()}function Ho(){$l.startNonterminal(\"SourceExpr\",Hl),Af(),$l.endNonterminal(\"SourceExpr\",Hl)}function Bo(){Of()}function jo(){$l.startNonterminal(\"TargetExpr\",Hl),Af(),$l.endNonterminal(\"TargetExpr\",Hl)}function Fo(){Of()}function Io(){$l.startNonterminal(\"NewNameExpr\",Hl),Af(),$l.endNonterminal(\"NewNameExpr\",Hl)}function qo(){Of()}function Ro(){$l.startNonterminal(\"TransformExpr\",Hl),bl(103),Tl(21),Sl(),zo();for(;;){if(Bl!=41)break;bl(41),Tl(21),Sl(),zo()}bl(181),Tl(267),Sl(),Af(),bl(220),Tl(267),Sl(),Af(),$l.endNonterminal(\"TransformExpr\",Hl)}function Uo(){wl(103),Tl(21),Wo();for(;;){if(Bl!=41)break;wl(41),Tl(21),Wo()}wl(181),Tl(267),Of(),wl(220),Tl(267),Of()}function zo(){$l.startNonterminal(\"TransformSpec\",Hl),bl(31),Tl(255),Sl(),fi(),Tl(27),bl(52),Tl(267),Sl(),Af(),$l.endNonterminal(\"TransformSpec\",Hl)}function Wo(){wl(31),Tl(255),li(),Tl(27),wl(52),Tl(267),Of()}function Xo(){$l.startNonterminal(\"FTSelection\",Hl),Ko();for(;;){Tl(212);switch(Bl){case 81:Nl(151);break;default:Dl=Bl}if(Dl!=115&&Dl!=117&&Dl!=127&&Dl!=202&&Dl!=223&&Dl!=269&&Dl!=64593&&Dl!=121425)break;Sl(),bu()}$l.endNonterminal(\"FTSelection\",Hl)}function Vo(){Qo();for(;;){Tl(212);switch(Bl){case 81:Nl(151);break;default:Dl=Bl}if(Dl!=115&&Dl!=117&&Dl!=127&&Dl!=202&&Dl!=223&&Dl!=269&&Dl!=64593&&Dl!=121425)break;wu()}}function $o(){$l.startNonterminal(\"FTWeight\",Hl),bl(264),Tl(87),bl(276),Tl(267),Sl(),Q(),bl(282),$l.endNonterminal(\"FTWeight\",Hl)}function Jo(){wl(264),Tl(87),wl(276),Tl(267),G(),wl(282)}function Ko(){$l.startNonterminal(\"FTOr\",Hl),Go();for(;;){if(Bl!=144)break;bl(144),Tl(162),Sl(),Go()}$l.endNonterminal(\"FTOr\",Hl)}function Qo(){Yo();for(;;){if(Bl!=144)break;wl(144),Tl(162),Yo()}}function Go(){$l.startNonterminal(\"FTAnd\",Hl),Zo();for(;;){if(Bl!=142)break;bl(142),Tl(162),Sl(),Zo()}$l.endNonterminal(\"FTAnd\",Hl)}function Yo(){eu();for(;;){if(Bl!=142)break;wl(142),Tl(162),eu()}}function Zo(){$l.startNonterminal(\"FTMildNot\",Hl),tu();for(;;){Tl(213);if(Bl!=193)break;bl(193),Tl(53),bl(154),Tl(162),Sl(),tu()}$l.endNonterminal(\"FTMildNot\",Hl)}function eu(){nu();for(;;){Tl(213);if(Bl!=193)break;wl(193),Tl(53),wl(154),Tl(162),nu()}}function tu(){$l.startNonterminal(\"FTUnaryNot\",Hl),Bl==143&&bl(143),Tl(155),Sl(),ru(),$l.endNonterminal(\"FTUnaryNot\",Hl)}function nu(){Bl==143&&wl(143),Tl(155),iu()}function ru(){$l.startNonterminal(\"FTPrimaryWithOptions\",Hl),su(),Tl(215),Bl==259&&(Sl(),Hu()),Bl==264&&(Sl(),$o()),$l.endNonterminal(\"FTPrimaryWithOptions\",Hl)}function iu(){ou(),Tl(215),Bl==259&&Bu(),Bl==264&&Jo()}function su(){$l.startNonterminal(\"FTPrimary\",Hl);switch(Bl){case 34:bl(34),Tl(162),Sl(),Xo(),bl(37);break;case 35:cu();break;default:uu(),Tl(216),Bl==195&&(Sl(),vu())}$l.endNonterminal(\"FTPrimary\",Hl)}function ou(){switch(Bl){case 34:wl(34),Tl(162),Vo(),wl(37);break;case 35:hu();break;default:au(),Tl(216),Bl==195&&mu()}}function uu(){$l.startNonterminal(\"FTWords\",Hl),fu(),Tl(222);if(Bl==71||Bl==76||Bl==210)Sl(),pu();$l.endNonterminal(\"FTWords\",Hl)}function au(){lu(),Tl(222),(Bl==71||Bl==76||Bl==210)&&du()}function fu(){$l.startNonterminal(\"FTWordsValue\",Hl);switch(Bl){case 11:bl(11);break;default:bl(276),Tl(267),Sl(),Q(),bl(282)}$l.endNonterminal(\"FTWordsValue\",Hl)}function lu(){switch(Bl){case 11:wl(11);break;default:wl(276),Tl(267),G(),wl(282)}}function cu(){$l.startNonterminal(\"FTExtensionSelection\",Hl);for(;;){Sl(),xr(),Tl(100);if(Bl!=35)break}bl(276),Tl(166),Bl!=282&&(Sl(),Xo()),bl(282),$l.endNonterminal(\"FTExtensionSelection\",Hl)}function hu(){for(;;){Tr(),Tl(100);if(Bl!=35)break}wl(276),Tl(166),Bl!=282&&Vo(),wl(282)}function pu(){$l.startNonterminal(\"FTAnyallOption\",Hl);switch(Bl){case 76:bl(76),Tl(219),Bl==272&&bl(272);break;case 71:bl(71),Tl(220),Bl==273&&bl(273);break;default:bl(210)}$l.endNonterminal(\"FTAnyallOption\",Hl)}function du(){switch(Bl){case 76:wl(76),Tl(219),Bl==272&&wl(272);break;case 71:wl(71),Tl(220),Bl==273&&wl(273);break;default:wl(210)}}function vu(){$l.startNonterminal(\"FTTimes\",Hl),bl(195),Tl(149),Sl(),gu(),bl(247),$l.endNonterminal(\"FTTimes\",Hl)}function mu(){wl(195),Tl(149),yu(),wl(247)}function gu(){$l.startNonterminal(\"FTRange\",Hl);switch(Bl){case 130:bl(130),Tl(267),Sl(),zn();break;case 81:bl(81),Tl(125);switch(Bl){case 173:bl(173),Tl(267),Sl(),zn();break;default:bl(183),Tl(267),Sl(),zn()}break;default:bl(140),Tl(267),Sl(),zn(),bl(248),Tl(267),Sl(),zn()}$l.endNonterminal(\"FTRange\",Hl)}function yu(){switch(Bl){case 130:wl(130),Tl(267),Wn();break;case 81:wl(81),Tl(125);switch(Bl){case 173:wl(173),Tl(267),Wn();break;default:wl(183),Tl(267),Wn()}break;default:wl(140),Tl(267),Wn(),wl(248),Tl(267),Wn()}}function bu(){$l.startNonterminal(\"FTPosFilter\",Hl);switch(Bl){case 202:Eu();break;case 269:xu();break;case 117:Nu();break;case 115:case 223:Au();break;default:Du()}$l.endNonterminal(\"FTPosFilter\",Hl)}function wu(){switch(Bl){case 202:Su();break;case 269:Tu();break;case 117:Cu();break;case 115:case 223:Ou();break;default:Pu()}}function Eu(){$l.startNonterminal(\"FTOrder\",Hl),bl(202),$l.endNonterminal(\"FTOrder\",Hl)}function Su(){wl(202)}function xu(){$l.startNonterminal(\"FTWindow\",Hl),bl(269),Tl(267),Sl(),zn(),Sl(),ku(),$l.endNonterminal(\"FTWindow\",Hl)}function Tu(){wl(269),Tl(267),Wn(),Lu()}function Nu(){$l.startNonterminal(\"FTDistance\",Hl),bl(117),Tl(149),Sl(),gu(),Sl(),ku(),$l.endNonterminal(\"FTDistance\",Hl)}function Cu(){wl(117),Tl(149),yu(),Lu()}function ku(){$l.startNonterminal(\"FTUnit\",Hl);switch(Bl){case 273:bl(273);break;case 232:bl(232);break;default:bl(205)}$l.endNonterminal(\"FTUnit\",Hl)}function Lu(){switch(Bl){case 273:wl(273);break;case 232:wl(232);break;default:wl(205)}}function Au(){$l.startNonterminal(\"FTScope\",Hl);switch(Bl){case 223:bl(223);break;default:bl(115)}Tl(132),Sl(),Mu(),$l.endNonterminal(\"FTScope\",Hl)}function Ou(){switch(Bl){case 223:wl(223);break;default:wl(115)}Tl(132),_u()}function Mu(){$l.startNonterminal(\"FTBigUnit\",Hl);switch(Bl){case 231:bl(231);break;default:bl(204)}$l.endNonterminal(\"FTBigUnit\",Hl)}function _u(){switch(Bl){case 231:wl(231);break;default:wl(204)}}function Du(){$l.startNonterminal(\"FTContent\",Hl);switch(Bl){case 81:bl(81),Tl(117);switch(Bl){case 237:bl(237);break;default:bl(126)}break;default:bl(127),Tl(42),bl(100)}$l.endNonterminal(\"FTContent\",Hl)}function Pu(){switch(Bl){case 81:wl(81),Tl(117);switch(Bl){case 237:wl(237);break;default:wl(126)}break;default:wl(127),Tl(42),wl(100)}}function Hu(){$l.startNonterminal(\"FTMatchOptions\",Hl);for(;;){bl(259),Tl(182),Sl(),ju(),Tl(215);if(Bl!=259)break}$l.endNonterminal(\"FTMatchOptions\",Hl)}function Bu(){for(;;){wl(259),Tl(182),Fu(),Tl(215);if(Bl!=259)break}}function ju(){$l.startNonterminal(\"FTMatchOption\",Hl);switch(Bl){case 188:Nl(161);break;default:Dl=Bl}switch(Dl){case 169:ra();break;case 268:case 137404:sa();break;case 246:case 126140:Xu();break;case 238:case 122044:zu();break;case 114:Ru();break;case 239:case 122556:Gu();break;case 199:ua();break;default:Iu()}$l.endNonterminal(\"FTMatchOption\",Hl)}function Fu(){switch(Bl){case 188:Nl(161);break;default:Dl=Bl}switch(Dl){case 169:ia();break;case 268:case 137404:oa();break;case 246:case 126140:Vu();break;case 238:case 122044:Wu();break;case 114:Uu();break;case 239:case 122556:Yu();break;case 199:aa();break;default:qu()}}function Iu(){$l.startNonterminal(\"FTCaseOption\",Hl);switch(Bl){case 88:bl(88),Tl(124);switch(Bl){case 158:bl(158);break;default:bl(230)}break;case 177:bl(177);break;default:bl(258)}$l.endNonterminal(\"FTCaseOption\",Hl)}function qu(){switch(Bl){case 88:wl(88),Tl(124);switch(Bl){case 158:wl(158);break;default:wl(230)}break;case 177:wl(177);break;default:wl(258)}}function Ru(){$l.startNonterminal(\"FTDiacriticsOption\",Hl),bl(114),Tl(124);switch(Bl){case 158:bl(158);break;default:bl(230)}$l.endNonterminal(\"FTDiacriticsOption\",Hl)}function Uu(){wl(114),Tl(124);switch(Bl){case 158:wl(158);break;default:wl(230)}}function zu(){$l.startNonterminal(\"FTStemOption\",Hl);switch(Bl){case 238:bl(238);break;default:bl(188),Tl(74),bl(238)}$l.endNonterminal(\"FTStemOption\",Hl)}function Wu(){switch(Bl){case 238:wl(238);break;default:wl(188),Tl(74),wl(238)}}function Xu(){$l.startNonterminal(\"FTThesaurusOption\",Hl);switch(Bl){case 246:bl(246),Tl(142);switch(Bl){case 81:Sl(),$u();break;case 109:bl(109);break;default:bl(34),Tl(112);switch(Bl){case 81:Sl(),$u();break;default:bl(109)}for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(31),Sl(),$u()}bl(37)}break;default:bl(188),Tl(78),bl(246)}$l.endNonterminal(\"FTThesaurusOption\",Hl)}function Vu(){switch(Bl){case 246:wl(246),Tl(142);switch(Bl){case 81:Ju();break;case 109:wl(109);break;default:wl(34),Tl(112);switch(Bl){case 81:Ju();break;default:wl(109)}for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(31),Ju()}wl(37)}break;default:wl(188),Tl(78),wl(246)}}function $u(){$l.startNonterminal(\"FTThesaurusID\",Hl),bl(81),Tl(15),bl(7),Tl(221),Bl==217&&(bl(217),Tl(17),bl(11)),Tl(217);switch(Bl){case 81:Nl(165);break;default:Dl=Bl}if(Dl==130||Dl==140||Dl==88657||Dl==93777)Sl(),Ku(),Tl(58),bl(175);$l.endNonterminal(\"FTThesaurusID\",Hl)}function Ju(){wl(81),Tl(15),wl(7),Tl(221),Bl==217&&(wl(217),Tl(17),wl(11)),Tl(217);switch(Bl){case 81:Nl(165);break;default:Dl=Bl}if(Dl==130||Dl==140||Dl==88657||Dl==93777)Qu(),Tl(58),wl(175)}function Ku(){$l.startNonterminal(\"FTLiteralRange\",Hl);switch(Bl){case 130:bl(130),Tl(16),bl(8);break;case 81:bl(81),Tl(125);switch(Bl){case 173:bl(173),Tl(16),bl(8);break;default:bl(183),Tl(16),bl(8)}break;default:bl(140),Tl(16),bl(8),Tl(79),bl(248),Tl(16),bl(8)}$l.endNonterminal(\"FTLiteralRange\",Hl)}function Qu(){switch(Bl){case 130:wl(130),Tl(16),wl(8);break;case 81:wl(81),Tl(125);switch(Bl){case 173:wl(173),Tl(16),wl(8);break;default:wl(183),Tl(16),wl(8)}break;default:wl(140),Tl(16),wl(8),Tl(79),wl(248),Tl(16),wl(8)}}function Gu(){$l.startNonterminal(\"FTStopWordOption\",Hl);switch(Bl){case 239:bl(239),Tl(86),bl(273),Tl(142);switch(Bl){case 109:bl(109);for(;;){Tl(218);if(Bl!=131&&Bl!=254)break;Sl(),ta()}break;default:Sl(),Zu();for(;;){Tl(218);if(Bl!=131&&Bl!=254)break;Sl(),ta()}}break;default:bl(188),Tl(75),bl(239),Tl(86),bl(273)}$l.endNonterminal(\"FTStopWordOption\",Hl)}function Yu(){switch(Bl){case 239:wl(239),Tl(86),wl(273),Tl(142);switch(Bl){case 109:wl(109);for(;;){Tl(218);if(Bl!=131&&Bl!=254)break;na()}break;default:ea();for(;;){Tl(218);if(Bl!=131&&Bl!=254)break;na()}}break;default:wl(188),Tl(75),wl(239),Tl(86),wl(273)}}function Zu(){$l.startNonterminal(\"FTStopWords\",Hl);switch(Bl){case 81:bl(81),Tl(15),bl(7);break;default:bl(34),Tl(17),bl(11);for(;;){Tl(101);if(Bl!=41)break;bl(41),Tl(17),bl(11)}bl(37)}$l.endNonterminal(\"FTStopWords\",Hl)}function ea(){switch(Bl){case 81:wl(81),Tl(15),wl(7);break;default:wl(34),Tl(17),wl(11);for(;;){Tl(101);if(Bl!=41)break;wl(41),Tl(17),wl(11)}wl(37)}}function ta(){$l.startNonterminal(\"FTStopWordsInclExcl\",Hl);switch(Bl){case 254:bl(254);break;default:bl(131)}Tl(99),Sl(),Zu(),$l.endNonterminal(\"FTStopWordsInclExcl\",Hl)}function na(){switch(Bl){case 254:wl(254);break;default:wl(131)}Tl(99),ea()}function ra(){$l.startNonterminal(\"FTLanguageOption\",Hl),bl(169),Tl(17),bl(11),$l.endNonterminal(\"FTLanguageOption\",Hl)}function ia(){wl(169),Tl(17),wl(11)}function sa(){$l.startNonterminal(\"FTWildCardOption\",Hl);switch(Bl){case 268:bl(268);break;default:bl(188),Tl(84),bl(268)}$l.endNonterminal(\"FTWildCardOption\",Hl)}function oa(){switch(Bl){case 268:wl(268);break;default:wl(188),Tl(84),wl(268)}}function ua(){$l.startNonterminal(\"FTExtensionOption\",Hl),bl(199),Tl(255),Sl(),_a(),Tl(17),bl(11),$l.endNonterminal(\"FTExtensionOption\",Hl)}function aa(){wl(199),Tl(255),Da(),Tl(17),wl(11)}function fa(){$l.startNonterminal(\"FTIgnoreOption\",Hl),bl(271),Tl(42),bl(100),Tl(267),Sl(),$n(),$l.endNonterminal(\"FTIgnoreOption\",Hl)}function la(){wl(271),Tl(42),wl(100),Tl(267),Jn()}function ca(){$l.startNonterminal(\"CollectionDecl\",Hl),bl(95),Tl(255),Sl(),_a(),Tl(107),Bl==79&&(Sl(),ha()),$l.endNonterminal(\"CollectionDecl\",Hl)}function ha(){$l.startNonterminal(\"CollectionTypeDecl\",Hl),bl(79),Tl(178),Sl(),Ms(),Tl(156),Bl!=53&&(Sl(),vs()),$l.endNonterminal(\"CollectionTypeDecl\",Hl)}function pa(){$l.startNonterminal(\"IndexName\",Hl),_a(),$l.endNonterminal(\"IndexName\",Hl)}function da(){$l.startNonterminal(\"IndexDomainExpr\",Hl),Nr(),$l.endNonterminal(\"IndexDomainExpr\",Hl)}function va(){$l.startNonterminal(\"IndexKeySpec\",Hl),ma(),Bl==79&&(Sl(),ga()),Tl(146),Bl==94&&(Sl(),ba()),$l.endNonterminal(\"IndexKeySpec\",Hl)}function ma(){$l.startNonterminal(\"IndexKeyExpr\",Hl),Nr(),$l.endNonterminal(\"IndexKeyExpr\",Hl)}function ga(){$l.startNonterminal(\"IndexKeyTypeDecl\",Hl),bl(79),Tl(255),Sl(),ya(),Tl(169);if(Bl==39||Bl==40||Bl==64)Sl(),vs();$l.endNonterminal(\"IndexKeyTypeDecl\",Hl)}function ya(){$l.startNonterminal(\"AtomicType\",Hl),_a(),$l.endNonterminal(\"AtomicType\",Hl)}function ba(){$l.startNonterminal(\"IndexKeyCollation\",Hl),bl(94),Tl(15),bl(7),$l.endNonterminal(\"IndexKeyCollation\",Hl)}function wa(){$l.startNonterminal(\"IndexDecl\",Hl),bl(155),Tl(255),Sl(),pa(),Tl(65),bl(197),Tl(63),bl(192),Tl(266),Sl(),da(),bl(87),Tl(266),Sl(),va();for(;;){Tl(103);if(Bl!=41)break;bl(41),Tl(266),Sl(),va()}$l.endNonterminal(\"IndexDecl\",Hl)}function Ea(){$l.startNonterminal(\"ICDecl\",Hl),bl(161),Tl(40),bl(97),Tl(255),Sl(),_a(),Tl(120);switch(Bl){case 197:Sl(),Sa();break;default:Sl(),Ca()}$l.endNonterminal(\"ICDecl\",Hl)}function Sa(){$l.startNonterminal(\"ICCollection\",Hl),bl(197),Tl(39),bl(95),Tl(255),Sl(),_a(),Tl(140);switch(Bl){case 31:Sl(),xa();break;case 191:Sl(),Ta();break;default:Sl(),Na()}$l.endNonterminal(\"ICCollection\",Hl)}function xa(){$l.startNonterminal(\"ICCollSequence\",Hl),ui(),Tl(37),bl(92),Tl(267),Sl(),Af(),$l.endNonterminal(\"ICCollSequence\",Hl)}function Ta(){$l.startNonterminal(\"ICCollSequenceUnique\",Hl),bl(191),Tl(21),Sl(),ui(),Tl(37),bl(92),Tl(80),bl(255),Tl(57),bl(168),Tl(266),Sl(),Nr(),$l.endNonterminal(\"ICCollSequenceUnique\",Hl)}function Na(){$l.startNonterminal(\"ICCollNode\",Hl),bl(138),Tl(62),bl(191),Tl(21),Sl(),ui(),Tl(37),bl(92),Tl(267),Sl(),Af(),$l.endNonterminal(\"ICCollNode\",Hl)}function Ca(){$l.startNonterminal(\"ICForeignKey\",Hl),bl(139),Tl(57),bl(168),Tl(51),Sl(),ka(),Sl(),La(),$l.endNonterminal(\"ICForeignKey\",Hl)}function ka(){$l.startNonterminal(\"ICForeignKeySource\",Hl),bl(140),Tl(39),Sl(),Aa(),$l.endNonterminal(\"ICForeignKeySource\",Hl)}function La(){$l.startNonterminal(\"ICForeignKeyTarget\",Hl),bl(248),Tl(39),Sl(),Aa(),$l.endNonterminal(\"ICForeignKeyTarget\",Hl)}function Aa(){$l.startNonterminal(\"ICForeignKeyValues\",Hl),bl(95),Tl(255),Sl(),_a(),Tl(62),bl(191),Tl(21),Sl(),ui(),Tl(57),bl(168),Tl(266),Sl(),Nr(),$l.endNonterminal(\"ICForeignKeyValues\",Hl)}function Oa(){wl(36);for(;;){Cl(89);if(Bl==50)break;switch(Bl){case 24:wl(24);break;default:Oa()}}wl(50)}function Ma(){switch(Bl){case 22:wl(22);break;default:Oa()}}function _a(){$l.startNonterminal(\"EQName\",Hl),Cl(250);switch(Bl){case 82:bl(82);break;case 96:bl(96);break;case 120:bl(120);break;case 121:bl(121);break;case 124:bl(124);break;case 145:bl(145);break;case 152:bl(152);break;case 165:bl(165);break;case 185:bl(185);break;case 191:bl(191);break;case 216:bl(216);break;case 226:bl(226);break;case 227:bl(227);break;case 243:bl(243);break;case 244:bl(244);break;case 253:bl(253);break;case 78:bl(78);break;case 167:bl(167);break;case 242:bl(242);break;default:Pa()}$l.endNonterminal(\"EQName\",Hl)}function Da(){Cl(250);switch(Bl){case 82:wl(82);break;case 96:wl(96);break;case 120:wl(120);break;case 121:wl(121);break;case 124:wl(124);break;case 145:wl(145);break;case 152:wl(152);break;case 165:wl(165);break;case 185:wl(185);break;case 191:wl(191);break;case 216:wl(216);break;case 226:wl(226);break;case 227:wl(227);break;case 243:wl(243);break;case 244:wl(244);break;case 253:wl(253);break;case 78:wl(78);break;case 167:wl(167);break;case 242:wl(242);break;default:Ha()}}function Pa(){$l.startNonterminal(\"FunctionName\",Hl);switch(Bl){case 6:bl(6);break;case 70:bl(70);break;case 73:bl(73);break;case 74:bl(74);break;case 75:bl(75);break;case 79:bl(79);break;case 80:bl(80);break;case 84:bl(84);break;case 88:bl(88);break;case 89:bl(89);break;case 90:bl(90);break;case 93:bl(93);break;case 94:bl(94);break;case 103:bl(103);break;case 105:bl(105);break;case 108:bl(108);break;case 109:bl(109);break;case 110:bl(110);break;case 111:bl(111);break;case 112:bl(112);break;case 113:bl(113);break;case 118:bl(118);break;case 119:bl(119);break;case 122:bl(122);break;case 123:bl(123);break;case 126:bl(126);break;case 128:bl(128);break;case 129:bl(129);break;case 131:bl(131);break;case 134:bl(134);break;case 135:bl(135);break;case 136:bl(136);break;case 137:bl(137);break;case 146:bl(146);break;case 148:bl(148);break;case 150:bl(150);break;case 151:bl(151);break;case 153:bl(153);break;case 159:bl(159);break;case 160:bl(160);break;case 162:bl(162);break;case 163:bl(163);break;case 164:bl(164);break;case 170:bl(170);break;case 172:bl(172);break;case 174:bl(174);break;case 178:bl(178);break;case 180:bl(180);break;case 181:bl(181);break;case 182:bl(182);break;case 184:bl(184);break;case 186:bl(186);break;case 198:bl(198);break;case 200:bl(200);break;case 201:bl(201);break;case 202:bl(202);break;case 206:bl(206);break;case 212:bl(212);break;case 213:bl(213);break;case 218:bl(218);break;case 219:bl(219);break;case 220:bl(220);break;case 224:bl(224);break;case 229:bl(229);break;case 235:bl(235);break;case 236:bl(236);break;case 237:bl(237);break;case 248:bl(248);break;case 249:bl(249);break;case 250:bl(250);break;case 254:bl(254);break;case 256:bl(256);break;case 260:bl(260);break;case 266:bl(266);break;case 270:bl(270);break;case 274:bl(274);break;case 72:bl(72);break;case 81:bl(81);break;case 83:bl(83);break;case 85:bl(85);break;case 86:bl(86);break;case 91:bl(91);break;case 98:bl(98);break;case 101:bl(101);break;case 102:bl(102);break;case 104:bl(104);break;case 106:bl(106);break;case 125:bl(125);break;case 132:bl(132);break;case 133:bl(133);break;case 141:bl(141);break;case 154:bl(154);break;case 155:bl(155);break;case 161:bl(161);break;case 171:bl(171);break;case 192:bl(192);break;case 199:bl(199);break;case 203:bl(203);break;case 222:bl(222);break;case 225:bl(225);break;case 228:bl(228);break;case 234:bl(234);break;case 240:bl(240);break;case 251:bl(251);break;case 252:bl(252);break;case 257:bl(257);break;case 261:bl(261);break;case 262:bl(262);break;case 263:bl(263);break;case 267:bl(267);break;case 97:bl(97);break;case 176:bl(176);break;case 221:bl(221);break;case 77:bl(77);break;case 166:bl(166);break;default:bl(194)}$l.endNonterminal(\"FunctionName\",Hl)}function Ha(){switch(Bl){case 6:wl(6);break;case 70:wl(70);break;case 73:wl(73);break;case 74:wl(74);break;case 75:wl(75);break;case 79:wl(79);break;case 80:wl(80);break;case 84:wl(84);break;case 88:wl(88);break;case 89:wl(89);break;case 90:wl(90);break;case 93:wl(93);break;case 94:wl(94);break;case 103:wl(103);break;case 105:wl(105);break;case 108:wl(108);break;case 109:wl(109);break;case 110:wl(110);break;case 111:wl(111);break;case 112:wl(112);break;case 113:wl(113);break;case 118:wl(118);break;case 119:wl(119);break;case 122:wl(122);break;case 123:wl(123);break;case 126:wl(126);break;case 128:wl(128);break;case 129:wl(129);break;case 131:wl(131);break;case 134:wl(134);break;case 135:wl(135);break;case 136:wl(136);break;case 137:wl(137);break;case 146:wl(146);break;case 148:wl(148);break;case 150:wl(150);break;case 151:wl(151);break;case 153:wl(153);break;case 159:wl(159);break;case 160:wl(160);break;case 162:wl(162);break;case 163:wl(163);break;case 164:wl(164);break;case 170:wl(170);break;case 172:wl(172);break;case 174:wl(174);break;case 178:wl(178);break;case 180:wl(180);break;case 181:wl(181);break;case 182:wl(182);break;case 184:wl(184);break;case 186:wl(186);break;case 198:wl(198);break;case 200:wl(200);break;case 201:wl(201);break;case 202:wl(202);break;case 206:wl(206);break;case 212:wl(212);break;case 213:wl(213);break;case 218:wl(218);break;case 219:wl(219);break;case 220:wl(220);break;case 224:wl(224);break;case 229:wl(229);break;case 235:wl(235);break;case 236:wl(236);break;case 237:wl(237);break;case 248:wl(248);break;case 249:wl(249);break;case 250:wl(250);break;case 254:wl(254);break;case 256:wl(256);break;case 260:wl(260);break;case 266:wl(266);break;case 270:wl(270);break;case 274:wl(274);break;case 72:wl(72);break;case 81:wl(81);break;case 83:wl(83);break;case 85:wl(85);break;case 86:wl(86);break;case 91:wl(91);break;case 98:wl(98);break;case 101:wl(101);break;case 102:wl(102);break;case 104:wl(104);break;case 106:wl(106);break;case 125:wl(125);break;case 132:wl(132);break;case 133:wl(133);break;case 141:wl(141);break;case 154:wl(154);break;case 155:wl(155);break;case 161:wl(161);break;case 171:wl(171);break;case 192:wl(192);break;case 199:wl(199);break;case 203:wl(203);break;case 222:wl(222);break;case 225:wl(225);break;case 228:wl(228);break;case 234:wl(234);break;case 240:wl(240);break;case 251:wl(251);break;case 252:wl(252);break;case 257:wl(257);break;case 261:wl(261);break;case 262:wl(262);break;case 263:wl(263);break;case 267:wl(267);break;case 97:wl(97);break;case 176:wl(176);break;case 221:wl(221);break;case 77:wl(77);break;case 166:wl(166);break;default:wl(194)}}function Ba(){$l.startNonterminal(\"NCName\",Hl);switch(Bl){case 19:bl(19);break;case 70:bl(70);break;case 75:bl(75);break;case 79:bl(79);break;case 80:bl(80);break;case 84:bl(84);break;case 88:bl(88);break;case 89:bl(89);break;case 90:bl(90);break;case 94:bl(94);break;case 105:bl(105);break;case 109:bl(109);break;case 113:bl(113);break;case 118:bl(118);break;case 122:bl(122);break;case 123:bl(123);break;case 126:bl(126);break;case 128:bl(128);break;case 131:bl(131);break;case 137:bl(137);break;case 146:bl(146);break;case 148:bl(148);break;case 150:bl(150);break;case 151:bl(151);break;case 160:bl(160);break;case 162:bl(162);break;case 163:bl(163);break;case 164:bl(164);break;case 172:bl(172);break;case 174:bl(174);break;case 178:bl(178);break;case 180:bl(180);break;case 181:bl(181);break;case 186:bl(186);break;case 198:bl(198);break;case 200:bl(200);break;case 201:bl(201);break;case 220:bl(220);break;case 224:bl(224);break;case 236:bl(236);break;case 237:bl(237);break;case 248:bl(248);break;case 249:bl(249);break;case 254:bl(254);break;case 266:bl(266);break;case 270:bl(270);break;case 73:bl(73);break;case 74:bl(74);break;case 82:bl(82);break;case 93:bl(93);break;case 96:bl(96);break;case 103:bl(103);break;case 108:bl(108);break;case 110:bl(110);break;case 111:bl(111);break;case 112:bl(112);break;case 119:bl(119);break;case 120:bl(120);break;case 121:bl(121);break;case 124:bl(124);break;case 129:bl(129);break;case 134:bl(134);break;case 135:bl(135);break;case 136:bl(136);break;case 145:bl(145);break;case 152:bl(152);break;case 153:bl(153);break;case 159:bl(159);break;case 165:bl(165);break;case 170:bl(170);break;case 182:bl(182);break;case 184:bl(184);break;case 185:bl(185);break;case 191:bl(191);break;case 202:bl(202);break;case 206:bl(206);break;case 212:bl(212);break;case 213:bl(213);break;case 216:bl(216);break;case 218:bl(218);break;case 219:bl(219);break;case 226:bl(226);break;case 227:bl(227);break;case 229:bl(229);break;case 235:bl(235);break;case 243:bl(243);break;case 244:bl(244);break;case 250:bl(250);break;case 253:bl(253);break;case 256:bl(256);break;case 260:bl(260);break;case 262:bl(262);break;case 274:bl(274);break;case 72:bl(72);break;case 81:bl(81);break;case 83:bl(83);break;case 85:bl(85);break;case 86:bl(86);break;case 91:bl(91);break;case 98:bl(98);break;case 101:bl(101);break;case 102:bl(102);break;case 104:bl(104);break;case 106:bl(106);break;case 125:bl(125);break;case 132:bl(132);break;case 133:bl(133);break;case 141:bl(141);break;case 154:bl(154);break;case 155:bl(155);break;case 161:bl(161);break;case 171:bl(171);break;case 192:bl(192);break;case 199:bl(199);break;case 203:bl(203);break;case 222:bl(222);break;case 225:bl(225);break;case 228:bl(228);break;case 234:bl(234);break;case 240:bl(240);break;case 251:bl(251);break;case 252:bl(252);break;case 257:bl(257);break;case 261:bl(261);break;case 263:bl(263);break;case 267:bl(267);break;case 97:bl(97);break;case 176:bl(176);break;case 221:bl(221);break;case 77:bl(77);break;case 166:bl(166);break;default:bl(194)}$l.endNonterminal(\"NCName\",Hl)}function ja(){switch(Bl){case 19:wl(19);break;case 70:wl(70);break;case 75:wl(75);break;case 79:wl(79);break;case 80:wl(80);break;case 84:wl(84);break;case 88:wl(88);break;case 89:wl(89);break;case 90:wl(90);break;case 94:wl(94);break;case 105:wl(105);break;case 109:wl(109);break;case 113:wl(113);break;case 118:wl(118);break;case 122:wl(122);break;case 123:wl(123);break;case 126:wl(126);break;case 128:wl(128);break;case 131:wl(131);break;case 137:wl(137);break;case 146:wl(146);break;case 148:wl(148);break;case 150:wl(150);break;case 151:wl(151);break;case 160:wl(160);break;case 162:wl(162);break;case 163:wl(163);break;case 164:wl(164);break;case 172:wl(172);break;case 174:wl(174);break;case 178:wl(178);break;case 180:wl(180);break;case 181:wl(181);break;case 186:wl(186);break;case 198:wl(198);break;case 200:wl(200);break;case 201:wl(201);break;case 220:wl(220);break;case 224:wl(224);break;case 236:wl(236);break;case 237:wl(237);break;case 248:wl(248);break;case 249:wl(249);break;case 254:wl(254);break;case 266:wl(266);break;case 270:wl(270);break;case 73:wl(73);break;case 74:wl(74);break;case 82:wl(82);break;case 93:wl(93);break;case 96:wl(96);break;case 103:wl(103);break;case 108:wl(108);break;case 110:wl(110);break;case 111:wl(111);break;case 112:wl(112);break;case 119:wl(119);break;case 120:wl(120);break;case 121:wl(121);break;case 124:wl(124);break;case 129:wl(129);break;case 134:wl(134);break;case 135:wl(135);break;case 136:wl(136);break;case 145:wl(145);break;case 152:wl(152);break;case 153:wl(153);break;case 159:wl(159);break;case 165:wl(165);break;case 170:wl(170);break;case 182:wl(182);break;case 184:wl(184);break;case 185:wl(185);break;case 191:wl(191);break;case 202:wl(202);break;case 206:wl(206);break;case 212:wl(212);break;case 213:wl(213);break;case 216:wl(216);break;case 218:wl(218);break;case 219:wl(219);break;case 226:wl(226);break;case 227:wl(227);break;case 229:wl(229);break;case 235:wl(235);break;case 243:wl(243);break;case 244:wl(244);break;case 250:wl(250);break;case 253:wl(253);break;case 256:wl(256);break;case 260:wl(260);break;case 262:wl(262);break;case 274:wl(274);break;case 72:wl(72);break;case 81:wl(81);break;case 83:wl(83);break;case 85:wl(85);break;case 86:wl(86);break;case 91:wl(91);break;case 98:wl(98);break;case 101:wl(101);break;case 102:wl(102);break;case 104:wl(104);break;case 106:wl(106);break;case 125:wl(125);break;case 132:wl(132);break;case 133:wl(133);break;case 141:wl(141);break;case 154:wl(154);break;case 155:wl(155);break;case 161:wl(161);break;case 171:wl(171);break;case 192:wl(192);break;case 199:wl(199);break;case 203:wl(203);break;case 222:wl(222);break;case 225:wl(225);break;case 228:wl(228);break;case 234:wl(234);break;case 240:wl(240);break;case 251:wl(251);break;case 252:wl(252);break;case 257:wl(257);break;case 261:wl(261);break;case 263:wl(263);break;case 267:wl(267);break;case 97:wl(97);break;case 176:wl(176);break;case 221:wl(221);break;case 77:wl(77);break;case 166:wl(166);break;default:wl(194)}}function Fa(){$l.startNonterminal(\"MainModule\",Hl),f(),Sl(),Ia(),$l.endNonterminal(\"MainModule\",Hl)}function Ia(){$l.startNonterminal(\"Program\",Hl),Wa(),$l.endNonterminal(\"Program\",Hl)}function qa(){$l.startNonterminal(\"Statements\",Hl);for(;;){Tl(278);switch(Bl){case 34:Nl(269);break;case 35:kl(252);break;case 46:Nl(284);break;case 47:Nl(265);break;case 54:kl(4);break;case 55:kl(1);break;case 59:kl(3);break;case 66:Nl(257);break;case 68:Nl(272);break;case 77:Nl(200);break;case 82:Nl(281);break;case 121:Nl(280);break;case 132:Nl(203);break;case 137:Nl(208);break;case 174:Nl(205);break;case 218:Nl(206);break;case 219:Nl(207);break;case 260:Nl(210);break;case 276:Nl(277);break;case 278:Nl(273);break;case 5:case 45:Nl(186);break;case 31:case 32:Nl(255);break;case 40:case 42:Nl(267);break;case 86:case 102:Nl(201);break;case 110:case 159:Nl(209);break;case 184:case 216:Nl(268);break;case 103:case 129:case 235:case 262:Nl(197);break;case 8:case 9:case 10:case 11:case 44:Nl(192);break;case 78:case 124:case 165:case 167:case 242:Nl(191);break;case 96:case 119:case 202:case 244:case 250:case 256:Nl(204);break;case 73:case 74:case 93:case 111:case 112:case 135:case 136:case 206:case 212:case 213:case 229:Nl(198);break;case 6:case 70:case 72:case 75:case 79:case 80:case 81:case 83:case 84:case 85:case 88:case 89:case 90:case 91:case 94:case 97:case 98:case 101:case 104:case 105:case 106:case 108:case 109:case 113:case 118:case 120:case 122:case 123:case 125:case 126:case 128:case 131:case 133:case 134:case 141:case 145:case 146:case 148:case 150:case 151:case 152:case 153:case 154:case 155:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 176:case 178:case 180:case 181:case 182:case 185:case 186:case 191:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 220:case 221:case 222:case 224:case 225:case 226:case 227:case 228:case 234:case 236:case 237:case 240:case 243:case 248:case 249:case 251:case 252:case 253:case 254:case 257:case 261:case 263:case 266:case 267:case 270:case 274:Nl(195);break;default:Dl=Bl}if(Dl!=25&&Dl!=53&&Dl!=282&&Dl!=12805&&Dl!=12806&&Dl!=12808&&Dl!=12809&&Dl!=12810&&Dl!=12811&&Dl!=12844&&Dl!=12845&&Dl!=12846&&Dl!=12870&&Dl!=12872&&Dl!=12873&&Dl!=12874&&Dl!=12875&&Dl!=12877&&Dl!=12878&&Dl!=12879&&Dl!=12880&&Dl!=12881&&Dl!=12882&&Dl!=12883&&Dl!=12884&&Dl!=12885&&Dl!=12886&&Dl!=12888&&Dl!=12889&&Dl!=12890&&Dl!=12891&&Dl!=12893&&Dl!=12894&&Dl!=12896&&Dl!=12897&&Dl!=12898&&Dl!=12901&&Dl!=12902&&Dl!=12903&&Dl!=12904&&Dl!=12905&&Dl!=12906&&Dl!=12908&&Dl!=12909&&Dl!=12910&&Dl!=12911&&Dl!=12912&&Dl!=12913&&Dl!=12918&&Dl!=12919&&Dl!=12920&&Dl!=12921&&Dl!=12922&&Dl!=12923&&Dl!=12924&&Dl!=12925&&Dl!=12926&&Dl!=12928&&Dl!=12929&&Dl!=12931&&Dl!=12932&&Dl!=12933&&Dl!=12934&&Dl!=12935&&Dl!=12936&&Dl!=12937&&Dl!=12941&&Dl!=12945&&Dl!=12946&&Dl!=12948&&Dl!=12950&&Dl!=12951&&Dl!=12952&&Dl!=12953&&Dl!=12954&&Dl!=12955&&Dl!=12959&&Dl!=12960&&Dl!=12961&&Dl!=12962&&Dl!=12963&&Dl!=12964&&Dl!=12965&&Dl!=12966&&Dl!=12967&&Dl!=12970&&Dl!=12971&&Dl!=12972&&Dl!=12974&&Dl!=12976&&Dl!=12978&&Dl!=12980&&Dl!=12981&&Dl!=12982&&Dl!=12984&&Dl!=12985&&Dl!=12986&&Dl!=12991&&Dl!=12992&&Dl!=12994&&Dl!=12998&&Dl!=12999&&Dl!=13e3&&Dl!=13001&&Dl!=13002&&Dl!=13003&&Dl!=13006&&Dl!=13012&&Dl!=13013&&Dl!=13016&&Dl!=13018&&Dl!=13019&&Dl!=13020&&Dl!=13021&&Dl!=13022&&Dl!=13024&&Dl!=13025&&Dl!=13026&&Dl!=13027&&Dl!=13028&&Dl!=13029&&Dl!=13034&&Dl!=13035&&Dl!=13036&&Dl!=13037&&Dl!=13040&&Dl!=13042&&Dl!=13043&&Dl!=13044&&Dl!=13048&&Dl!=13049&&Dl!=13050&&Dl!=13051&&Dl!=13052&&Dl!=13053&&Dl!=13054&&Dl!=13056&&Dl!=13057&&Dl!=13060&&Dl!=13061&&Dl!=13062&&Dl!=13063&&Dl!=13066&&Dl!=13067&&Dl!=13070&&Dl!=13074&&Dl!=16134&&Dl!=20997&&Dl!=20998&&Dl!=21e3&&Dl!=21001&&Dl!=21002&&Dl!=21003&&Dl!=21036&&Dl!=21037&&Dl!=21038&&Dl!=21062&&Dl!=21064&&Dl!=21065&&Dl!=21066&&Dl!=21067&&Dl!=21069&&Dl!=21070&&Dl!=21071&&Dl!=21072&&Dl!=21073&&Dl!=21074&&Dl!=21075&&Dl!=21076&&Dl!=21077&&Dl!=21078&&Dl!=21080&&Dl!=21081&&Dl!=21082&&Dl!=21083&&Dl!=21085&&Dl!=21086&&Dl!=21088&&Dl!=21089&&Dl!=21090&&Dl!=21093&&Dl!=21094&&Dl!=21095&&Dl!=21096&&Dl!=21097&&Dl!=21098&&Dl!=21100&&Dl!=21101&&Dl!=21102&&Dl!=21103&&Dl!=21104&&Dl!=21105&&Dl!=21110&&Dl!=21111&&Dl!=21112&&Dl!=21113&&Dl!=21114&&Dl!=21115&&Dl!=21116&&Dl!=21117&&Dl!=21118&&Dl!=21120&&Dl!=21121&&Dl!=21123&&Dl!=21124&&Dl!=21125&&Dl!=21126&&Dl!=21127&&Dl!=21128&&Dl!=21129&&Dl!=21133&&Dl!=21137&&Dl!=21138&&Dl!=21140&&Dl!=21142&&Dl!=21143&&Dl!=21144&&Dl!=21145&&Dl!=21146&&Dl!=21147&&Dl!=21151&&Dl!=21152&&Dl!=21153&&Dl!=21154&&Dl!=21155&&Dl!=21156&&Dl!=21157&&Dl!=21158&&Dl!=21159&&Dl!=21162&&Dl!=21163&&Dl!=21164&&Dl!=21166&&Dl!=21168&&Dl!=21170&&Dl!=21172&&Dl!=21173&&Dl!=21174&&Dl!=21176&&Dl!=21177&&Dl!=21178&&Dl!=21183&&Dl!=21184&&Dl!=21186&&Dl!=21190&&Dl!=21191&&Dl!=21192&&Dl!=21193&&Dl!=21194&&Dl!=21195&&Dl!=21198&&Dl!=21204&&Dl!=21205&&Dl!=21208&&Dl!=21210&&Dl!=21211&&Dl!=21212&&Dl!=21213&&Dl!=21214&&Dl!=21216&&Dl!=21217&&Dl!=21218&&Dl!=21219&&Dl!=21220&&Dl!=21221&&Dl!=21226&&Dl!=21227&&Dl!=21228&&Dl!=21229&&Dl!=21232&&Dl!=21234&&Dl!=21235&&Dl!=21236&&Dl!=21240&&Dl!=21241&&Dl!=21242&&Dl!=21243&&Dl!=21244&&Dl!=21245&&Dl!=21246&&Dl!=21248&&Dl!=21249&&Dl!=21252&&Dl!=21253&&Dl!=21254&&Dl!=21255&&Dl!=21258&&Dl!=21259&&Dl!=21262&&Dl!=21266&&Dl!=27141&&Dl!=27142&&Dl!=27144&&Dl!=27145&&Dl!=27146&&Dl!=27147&&Dl!=27180&&Dl!=27181&&Dl!=27182&&Dl!=27206&&Dl!=27208&&Dl!=27209&&Dl!=27210&&Dl!=27211&&Dl!=27213&&Dl!=27214&&Dl!=27215&&Dl!=27216&&Dl!=27217&&Dl!=27218&&Dl!=27219&&Dl!=27220&&Dl!=27221&&Dl!=27222&&Dl!=27224&&Dl!=27225&&Dl!=27226&&Dl!=27227&&Dl!=27229&&Dl!=27230&&Dl!=27232&&Dl!=27233&&Dl!=27234&&Dl!=27237&&Dl!=27238&&Dl!=27239&&Dl!=27240&&Dl!=27241&&Dl!=27242&&Dl!=27244&&Dl!=27245&&Dl!=27246&&Dl!=27247&&Dl!=27248&&Dl!=27249&&Dl!=27254&&Dl!=27255&&Dl!=27256&&Dl!=27257&&Dl!=27258&&Dl!=27259&&Dl!=27260&&Dl!=27261&&Dl!=27262&&Dl!=27264&&Dl!=27265&&Dl!=27267&&Dl!=27268&&Dl!=27269&&Dl!=27270&&Dl!=27271&&Dl!=27272&&Dl!=27273&&Dl!=27277&&Dl!=27281&&Dl!=27282&&Dl!=27284&&Dl!=27286&&Dl!=27287&&Dl!=27288&&Dl!=27289&&Dl!=27290&&Dl!=27291&&Dl!=27295&&Dl!=27296&&Dl!=27297&&Dl!=27298&&Dl!=27299&&Dl!=27300&&Dl!=27301&&Dl!=27302&&Dl!=27303&&Dl!=27306&&Dl!=27307&&Dl!=27308&&Dl!=27310&&Dl!=27312&&Dl!=27314&&Dl!=27316&&Dl!=27317&&Dl!=27318&&Dl!=27320&&Dl!=27321&&Dl!=27322&&Dl!=27327&&Dl!=27328&&Dl!=27330&&Dl!=27334&&Dl!=27335&&Dl!=27336&&Dl!=27337&&Dl!=27338&&Dl!=27339&&Dl!=27342&&Dl!=27348&&Dl!=27349&&Dl!=27352&&Dl!=27354&&Dl!=27355&&Dl!=27356&&Dl!=27357&&Dl!=27358&&Dl!=27360&&Dl!=27361&&Dl!=27362&&Dl!=27363&&Dl!=27364&&Dl!=27365&&Dl!=27370&&Dl!=27371&&Dl!=27372&&Dl!=27373&&Dl!=27376&&Dl!=27378&&Dl!=27379&&Dl!=27380&&Dl!=27384&&Dl!=27385&&Dl!=27386&&Dl!=27387&&Dl!=27388&&Dl!=27389&&Dl!=27390&&Dl!=27392&&Dl!=27393&&Dl!=27396&&Dl!=27397&&Dl!=27398&&Dl!=27399&&Dl!=27402&&Dl!=27403&&Dl!=27406&&Dl!=27410&&Dl!=90198&&Dl!=90214&&Dl!=113284&&Dl!=144389&&Dl!=144390&&Dl!=144392&&Dl!=144393&&Dl!=144394&&Dl!=144395&&Dl!=144428&&Dl!=144429&&Dl!=144430&&Dl!=144454&&Dl!=144456&&Dl!=144457&&Dl!=144458&&Dl!=144459&&Dl!=144461&&Dl!=144462&&Dl!=144463&&Dl!=144464&&Dl!=144465&&Dl!=144466&&Dl!=144467&&Dl!=144468&&Dl!=144469&&Dl!=144470&&Dl!=144472&&Dl!=144473&&Dl!=144474&&Dl!=144475&&Dl!=144477&&Dl!=144478&&Dl!=144480&&Dl!=144481&&Dl!=144482&&Dl!=144485&&Dl!=144486&&Dl!=144487&&Dl!=144488&&Dl!=144489&&Dl!=144490&&Dl!=144492&&Dl!=144493&&Dl!=144494&&Dl!=144495&&Dl!=144496&&Dl!=144497&&Dl!=144502&&Dl!=144503&&Dl!=144504&&Dl!=144505&&Dl!=144506&&Dl!=144507&&Dl!=144508&&Dl!=144509&&Dl!=144510&&Dl!=144512&&Dl!=144513&&Dl!=144515&&Dl!=144516&&Dl!=144517&&Dl!=144518&&Dl!=144519&&Dl!=144520&&Dl!=144521&&Dl!=144525&&Dl!=144529&&Dl!=144530&&Dl!=144532&&Dl!=144534&&Dl!=144535&&Dl!=144536&&Dl!=144537&&Dl!=144538&&Dl!=144539&&Dl!=144543&&Dl!=144544&&Dl!=144545&&Dl!=144546&&Dl!=144547&&Dl!=144548&&Dl!=144549&&Dl!=144550&&Dl!=144551&&Dl!=144554&&Dl!=144555&&Dl!=144556&&Dl!=144558&&Dl!=144560&&Dl!=144562&&Dl!=144564&&Dl!=144565&&Dl!=144566&&Dl!=144568&&Dl!=144569&&Dl!=144570&&Dl!=144575&&Dl!=144576&&Dl!=144578&&Dl!=144582&&Dl!=144583&&Dl!=144584&&Dl!=144585&&Dl!=144586&&Dl!=144587&&Dl!=144590&&Dl!=144596&&Dl!=144597&&Dl!=144600&&Dl!=144602&&Dl!=144603&&Dl!=144604&&Dl!=144605&&Dl!=144606&&Dl!=144608&&Dl!=144609&&Dl!=144610&&Dl!=144611&&Dl!=144612&&Dl!=144613&&Dl!=144618&&Dl!=144619&&Dl!=144620&&Dl!=144621&&Dl!=144624&&Dl!=144626&&Dl!=144627&&Dl!=144628&&Dl!=144632&&Dl!=144633&&Dl!=144634&&Dl!=144635&&Dl!=144636&&Dl!=144637&&Dl!=144638&&Dl!=144640&&Dl!=144641&&Dl!=144644&&Dl!=144645&&Dl!=144646&&Dl!=144647&&Dl!=144650&&Dl!=144651&&Dl!=144654&&Dl!=144658){Dl=Ol(6,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{$a(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(6,Hl,Dl)}}if(Dl!=-1&&Dl!=53&&Dl!=16134&&Dl!=27141&&Dl!=27142&&Dl!=27144&&Dl!=27145&&Dl!=27146&&Dl!=27147&&Dl!=27180&&Dl!=27181&&Dl!=27182&&Dl!=27206&&Dl!=27208&&Dl!=27209&&Dl!=27210&&Dl!=27211&&Dl!=27213&&Dl!=27214&&Dl!=27215&&Dl!=27216&&Dl!=27217&&Dl!=27218&&Dl!=27219&&Dl!=27220&&Dl!=27221&&Dl!=27222&&Dl!=27224&&Dl!=27225&&Dl!=27226&&Dl!=27227&&Dl!=27229&&Dl!=27230&&Dl!=27232&&Dl!=27233&&Dl!=27234&&Dl!=27237&&Dl!=27238&&Dl!=27239&&Dl!=27240&&Dl!=27241&&Dl!=27242&&Dl!=27244&&Dl!=27245&&Dl!=27246&&Dl!=27247&&Dl!=27248&&Dl!=27249&&Dl!=27254&&Dl!=27255&&Dl!=27256&&Dl!=27257&&Dl!=27258&&Dl!=27259&&Dl!=27260&&Dl!=27261&&Dl!=27262&&Dl!=27264&&Dl!=27265&&Dl!=27267&&Dl!=27268&&Dl!=27269&&Dl!=27270&&Dl!=27271&&Dl!=27272&&Dl!=27273&&Dl!=27277&&Dl!=27281&&Dl!=27282&&Dl!=27284&&Dl!=27286&&Dl!=27287&&Dl!=27288&&Dl!=27289&&Dl!=27290&&Dl!=27291&&Dl!=27295&&Dl!=27296&&Dl!=27297&&Dl!=27298&&Dl!=27299&&Dl!=27300&&Dl!=27301&&Dl!=27302&&Dl!=27303&&Dl!=27306&&Dl!=27307&&Dl!=27308&&Dl!=27310&&Dl!=27312&&Dl!=27314&&Dl!=27316&&Dl!=27317&&Dl!=27318&&Dl!=27320&&Dl!=27321&&Dl!=27322&&Dl!=27327&&Dl!=27328&&Dl!=27330&&Dl!=27334&&Dl!=27335&&Dl!=27336&&Dl!=27337&&Dl!=27338&&Dl!=27339&&Dl!=27342&&Dl!=27348&&Dl!=27349&&Dl!=27352&&Dl!=27354&&Dl!=27355&&Dl!=27356&&Dl!=27357&&Dl!=27358&&Dl!=27360&&Dl!=27361&&Dl!=27362&&Dl!=27363&&Dl!=27364&&Dl!=27365&&Dl!=27370&&Dl!=27371&&Dl!=27372&&Dl!=27373&&Dl!=27376&&Dl!=27378&&Dl!=27379&&Dl!=27380&&Dl!=27384&&Dl!=27385&&Dl!=27386&&Dl!=27387&&Dl!=27388&&Dl!=27389&&Dl!=27390&&Dl!=27392&&Dl!=27393&&Dl!=27396&&Dl!=27397&&Dl!=27398&&Dl!=27399&&Dl!=27402&&Dl!=27403&&Dl!=27406&&Dl!=27410&&Dl!=90198&&Dl!=90214&&Dl!=113284)break;Sl(),Va()}$l.endNonterminal(\"Statements\",Hl)}function Ra(){for(;;){Tl(278);switch(Bl){case 34:Nl(269);break;case 35:kl(252);break;case 46:Nl(284);break;case 47:Nl(265);break;case 54:kl(4);break;case 55:kl(1);break;case 59:kl(3);break;case 66:Nl(257);break;case 68:Nl(272);break;case 77:Nl(200);break;case 82:Nl(281);break;case 121:Nl(280);break;case 132:Nl(203);break;case 137:Nl(208);break;case 174:Nl(205);break;case 218:Nl(206);break;case 219:Nl(207);break;case 260:Nl(210);break;case 276:Nl(277);break;case 278:Nl(273);break;case 5:case 45:Nl(186);break;case 31:case 32:Nl(255);break;case 40:case 42:Nl(267);break;case 86:case 102:Nl(201);break;case 110:case 159:Nl(209);break;case 184:case 216:Nl(268);break;case 103:case 129:case 235:case 262:Nl(197);break;case 8:case 9:case 10:case 11:case 44:Nl(192);break;case 78:case 124:case 165:case 167:case 242:Nl(191);break;case 96:case 119:case 202:case 244:case 250:case 256:Nl(204);break;case 73:case 74:case 93:case 111:case 112:case 135:case 136:case 206:case 212:case 213:case 229:Nl(198);break;case 6:case 70:case 72:case 75:case 79:case 80:case 81:case 83:case 84:case 85:case 88:case 89:case 90:case 91:case 94:case 97:case 98:case 101:case 104:case 105:case 106:case 108:case 109:case 113:case 118:case 120:case 122:case 123:case 125:case 126:case 128:case 131:case 133:case 134:case 141:case 145:case 146:case 148:case 150:case 151:case 152:case 153:case 154:case 155:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 176:case 178:case 180:case 181:case 182:case 185:case 186:case 191:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 220:case 221:case 222:case 224:case 225:case 226:case 227:case 228:case 234:case 236:case 237:case 240:case 243:case 248:case 249:case 251:case 252:case 253:case 254:case 257:case 261:case 263:case 266:case 267:case 270:case 274:Nl(195);break;default:Dl=Bl}if(Dl!=25&&Dl!=53&&Dl!=282&&Dl!=12805&&Dl!=12806&&Dl!=12808&&Dl!=12809&&Dl!=12810&&Dl!=12811&&Dl!=12844&&Dl!=12845&&Dl!=12846&&Dl!=12870&&Dl!=12872&&Dl!=12873&&Dl!=12874&&Dl!=12875&&Dl!=12877&&Dl!=12878&&Dl!=12879&&Dl!=12880&&Dl!=12881&&Dl!=12882&&Dl!=12883&&Dl!=12884&&Dl!=12885&&Dl!=12886&&Dl!=12888&&Dl!=12889&&Dl!=12890&&Dl!=12891&&Dl!=12893&&Dl!=12894&&Dl!=12896&&Dl!=12897&&Dl!=12898&&Dl!=12901&&Dl!=12902&&Dl!=12903&&Dl!=12904&&Dl!=12905&&Dl!=12906&&Dl!=12908&&Dl!=12909&&Dl!=12910&&Dl!=12911&&Dl!=12912&&Dl!=12913&&Dl!=12918&&Dl!=12919&&Dl!=12920&&Dl!=12921&&Dl!=12922&&Dl!=12923&&Dl!=12924&&Dl!=12925&&Dl!=12926&&Dl!=12928&&Dl!=12929&&Dl!=12931&&Dl!=12932&&Dl!=12933&&Dl!=12934&&Dl!=12935&&Dl!=12936&&Dl!=12937&&Dl!=12941&&Dl!=12945&&Dl!=12946&&Dl!=12948&&Dl!=12950&&Dl!=12951&&Dl!=12952&&Dl!=12953&&Dl!=12954&&Dl!=12955&&Dl!=12959&&Dl!=12960&&Dl!=12961&&Dl!=12962&&Dl!=12963&&Dl!=12964&&Dl!=12965&&Dl!=12966&&Dl!=12967&&Dl!=12970&&Dl!=12971&&Dl!=12972&&Dl!=12974&&Dl!=12976&&Dl!=12978&&Dl!=12980&&Dl!=12981&&Dl!=12982&&Dl!=12984&&Dl!=12985&&Dl!=12986&&Dl!=12991&&Dl!=12992&&Dl!=12994&&Dl!=12998&&Dl!=12999&&Dl!=13e3&&Dl!=13001&&Dl!=13002&&Dl!=13003&&Dl!=13006&&Dl!=13012&&Dl!=13013&&Dl!=13016&&Dl!=13018&&Dl!=13019&&Dl!=13020&&Dl!=13021&&Dl!=13022&&Dl!=13024&&Dl!=13025&&Dl!=13026&&Dl!=13027&&Dl!=13028&&Dl!=13029&&Dl!=13034&&Dl!=13035&&Dl!=13036&&Dl!=13037&&Dl!=13040&&Dl!=13042&&Dl!=13043&&Dl!=13044&&Dl!=13048&&Dl!=13049&&Dl!=13050&&Dl!=13051&&Dl!=13052&&Dl!=13053&&Dl!=13054&&Dl!=13056&&Dl!=13057&&Dl!=13060&&Dl!=13061&&Dl!=13062&&Dl!=13063&&Dl!=13066&&Dl!=13067&&Dl!=13070&&Dl!=13074&&Dl!=16134&&Dl!=20997&&Dl!=20998&&Dl!=21e3&&Dl!=21001&&Dl!=21002&&Dl!=21003&&Dl!=21036&&Dl!=21037&&Dl!=21038&&Dl!=21062&&Dl!=21064&&Dl!=21065&&Dl!=21066&&Dl!=21067&&Dl!=21069&&Dl!=21070&&Dl!=21071&&Dl!=21072&&Dl!=21073&&Dl!=21074&&Dl!=21075&&Dl!=21076&&Dl!=21077&&Dl!=21078&&Dl!=21080&&Dl!=21081&&Dl!=21082&&Dl!=21083&&Dl!=21085&&Dl!=21086&&Dl!=21088&&Dl!=21089&&Dl!=21090&&Dl!=21093&&Dl!=21094&&Dl!=21095&&Dl!=21096&&Dl!=21097&&Dl!=21098&&Dl!=21100&&Dl!=21101&&Dl!=21102&&Dl!=21103&&Dl!=21104&&Dl!=21105&&Dl!=21110&&Dl!=21111&&Dl!=21112&&Dl!=21113&&Dl!=21114&&Dl!=21115&&Dl!=21116&&Dl!=21117&&Dl!=21118&&Dl!=21120&&Dl!=21121&&Dl!=21123&&Dl!=21124&&Dl!=21125&&Dl!=21126&&Dl!=21127&&Dl!=21128&&Dl!=21129&&Dl!=21133&&Dl!=21137&&Dl!=21138&&Dl!=21140&&Dl!=21142&&Dl!=21143&&Dl!=21144&&Dl!=21145&&Dl!=21146&&Dl!=21147&&Dl!=21151&&Dl!=21152&&Dl!=21153&&Dl!=21154&&Dl!=21155&&Dl!=21156&&Dl!=21157&&Dl!=21158&&Dl!=21159&&Dl!=21162&&Dl!=21163&&Dl!=21164&&Dl!=21166&&Dl!=21168&&Dl!=21170&&Dl!=21172&&Dl!=21173&&Dl!=21174&&Dl!=21176&&Dl!=21177&&Dl!=21178&&Dl!=21183&&Dl!=21184&&Dl!=21186&&Dl!=21190&&Dl!=21191&&Dl!=21192&&Dl!=21193&&Dl!=21194&&Dl!=21195&&Dl!=21198&&Dl!=21204&&Dl!=21205&&Dl!=21208&&Dl!=21210&&Dl!=21211&&Dl!=21212&&Dl!=21213&&Dl!=21214&&Dl!=21216&&Dl!=21217&&Dl!=21218&&Dl!=21219&&Dl!=21220&&Dl!=21221&&Dl!=21226&&Dl!=21227&&Dl!=21228&&Dl!=21229&&Dl!=21232&&Dl!=21234&&Dl!=21235&&Dl!=21236&&Dl!=21240&&Dl!=21241&&Dl!=21242&&Dl!=21243&&Dl!=21244&&Dl!=21245&&Dl!=21246&&Dl!=21248&&Dl!=21249&&Dl!=21252&&Dl!=21253&&Dl!=21254&&Dl!=21255&&Dl!=21258&&Dl!=21259&&Dl!=21262&&Dl!=21266&&Dl!=27141&&Dl!=27142&&Dl!=27144&&Dl!=27145&&Dl!=27146&&Dl!=27147&&Dl!=27180&&Dl!=27181&&Dl!=27182&&Dl!=27206&&Dl!=27208&&Dl!=27209&&Dl!=27210&&Dl!=27211&&Dl!=27213&&Dl!=27214&&Dl!=27215&&Dl!=27216&&Dl!=27217&&Dl!=27218&&Dl!=27219&&Dl!=27220&&Dl!=27221&&Dl!=27222&&Dl!=27224&&Dl!=27225&&Dl!=27226&&Dl!=27227&&Dl!=27229&&Dl!=27230&&Dl!=27232&&Dl!=27233&&Dl!=27234&&Dl!=27237&&Dl!=27238&&Dl!=27239&&Dl!=27240&&Dl!=27241&&Dl!=27242&&Dl!=27244&&Dl!=27245&&Dl!=27246&&Dl!=27247&&Dl!=27248&&Dl!=27249&&Dl!=27254&&Dl!=27255&&Dl!=27256&&Dl!=27257&&Dl!=27258&&Dl!=27259&&Dl!=27260&&Dl!=27261&&Dl!=27262&&Dl!=27264&&Dl!=27265&&Dl!=27267&&Dl!=27268&&Dl!=27269&&Dl!=27270&&Dl!=27271&&Dl!=27272&&Dl!=27273&&Dl!=27277&&Dl!=27281&&Dl!=27282&&Dl!=27284&&Dl!=27286&&Dl!=27287&&Dl!=27288&&Dl!=27289&&Dl!=27290&&Dl!=27291&&Dl!=27295&&Dl!=27296&&Dl!=27297&&Dl!=27298&&Dl!=27299&&Dl!=27300&&Dl!=27301&&Dl!=27302&&Dl!=27303&&Dl!=27306&&Dl!=27307&&Dl!=27308&&Dl!=27310&&Dl!=27312&&Dl!=27314&&Dl!=27316&&Dl!=27317&&Dl!=27318&&Dl!=27320&&Dl!=27321&&Dl!=27322&&Dl!=27327&&Dl!=27328&&Dl!=27330&&Dl!=27334&&Dl!=27335&&Dl!=27336&&Dl!=27337&&Dl!=27338&&Dl!=27339&&Dl!=27342&&Dl!=27348&&Dl!=27349&&Dl!=27352&&Dl!=27354&&Dl!=27355&&Dl!=27356&&Dl!=27357&&Dl!=27358&&Dl!=27360&&Dl!=27361&&Dl!=27362&&Dl!=27363&&Dl!=27364&&Dl!=27365&&Dl!=27370&&Dl!=27371&&Dl!=27372&&Dl!=27373&&Dl!=27376&&Dl!=27378&&Dl!=27379&&Dl!=27380&&Dl!=27384&&Dl!=27385&&Dl!=27386&&Dl!=27387&&Dl!=27388&&Dl!=27389&&Dl!=27390&&Dl!=27392&&Dl!=27393&&Dl!=27396&&Dl!=27397&&Dl!=27398&&Dl!=27399&&Dl!=27402&&Dl!=27403&&Dl!=27406&&Dl!=27410&&Dl!=90198&&Dl!=90214&&Dl!=113284&&Dl!=144389&&Dl!=144390&&Dl!=144392&&Dl!=144393&&Dl!=144394&&Dl!=144395&&Dl!=144428&&Dl!=144429&&Dl!=144430&&Dl!=144454&&Dl!=144456&&Dl!=144457&&Dl!=144458&&Dl!=144459&&Dl!=144461&&Dl!=144462&&Dl!=144463&&Dl!=144464&&Dl!=144465&&Dl!=144466&&Dl!=144467&&Dl!=144468&&Dl!=144469&&Dl!=144470&&Dl!=144472&&Dl!=144473&&Dl!=144474&&Dl!=144475&&Dl!=144477&&Dl!=144478&&Dl!=144480&&Dl!=144481&&Dl!=144482&&Dl!=144485&&Dl!=144486&&Dl!=144487&&Dl!=144488&&Dl!=144489&&Dl!=144490&&Dl!=144492&&Dl!=144493&&Dl!=144494&&Dl!=144495&&Dl!=144496&&Dl!=144497&&Dl!=144502&&Dl!=144503&&Dl!=144504&&Dl!=144505&&Dl!=144506&&Dl!=144507&&Dl!=144508&&Dl!=144509&&Dl!=144510&&Dl!=144512&&Dl!=144513&&Dl!=144515&&Dl!=144516&&Dl!=144517&&Dl!=144518&&Dl!=144519&&Dl!=144520&&Dl!=144521&&Dl!=144525&&Dl!=144529&&Dl!=144530&&Dl!=144532&&Dl!=144534&&Dl!=144535&&Dl!=144536&&Dl!=144537&&Dl!=144538&&Dl!=144539&&Dl!=144543&&Dl!=144544&&Dl!=144545&&Dl!=144546&&Dl!=144547&&Dl!=144548&&Dl!=144549&&Dl!=144550&&Dl!=144551&&Dl!=144554&&Dl!=144555&&Dl!=144556&&Dl!=144558&&Dl!=144560&&Dl!=144562&&Dl!=144564&&Dl!=144565&&Dl!=144566&&Dl!=144568&&Dl!=144569&&Dl!=144570&&Dl!=144575&&Dl!=144576&&Dl!=144578&&Dl!=144582&&Dl!=144583&&Dl!=144584&&Dl!=144585&&Dl!=144586&&Dl!=144587&&Dl!=144590&&Dl!=144596&&Dl!=144597&&Dl!=144600&&Dl!=144602&&Dl!=144603&&Dl!=144604&&Dl!=144605&&Dl!=144606&&Dl!=144608&&Dl!=144609&&Dl!=144610&&Dl!=144611&&Dl!=144612&&Dl!=144613&&Dl!=144618&&Dl!=144619&&Dl!=144620&&Dl!=144621&&Dl!=144624&&Dl!=144626&&Dl!=144627&&Dl!=144628&&Dl!=144632&&Dl!=144633&&Dl!=144634&&Dl!=144635&&Dl!=144636&&Dl!=144637&&Dl!=144638&&Dl!=144640&&Dl!=144641&&Dl!=144644&&Dl!=144645&&Dl!=144646&&Dl!=144647&&Dl!=144650&&Dl!=144651&&Dl!=144654&&Dl!=144658){Dl=Ol(6,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{$a(),Al(6,t,-1);continue}catch(a){Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(6,t,-2);break}}}if(Dl!=-1&&Dl!=53&&Dl!=16134&&Dl!=27141&&Dl!=27142&&Dl!=27144&&Dl!=27145&&Dl!=27146&&Dl!=27147&&Dl!=27180&&Dl!=27181&&Dl!=27182&&Dl!=27206&&Dl!=27208&&Dl!=27209&&Dl!=27210&&Dl!=27211&&Dl!=27213&&Dl!=27214&&Dl!=27215&&Dl!=27216&&Dl!=27217&&Dl!=27218&&Dl!=27219&&Dl!=27220&&Dl!=27221&&Dl!=27222&&Dl!=27224&&Dl!=27225&&Dl!=27226&&Dl!=27227&&Dl!=27229&&Dl!=27230&&Dl!=27232&&Dl!=27233&&Dl!=27234&&Dl!=27237&&Dl!=27238&&Dl!=27239&&Dl!=27240&&Dl!=27241&&Dl!=27242&&Dl!=27244&&Dl!=27245&&Dl!=27246&&Dl!=27247&&Dl!=27248&&Dl!=27249&&Dl!=27254&&Dl!=27255&&Dl!=27256&&Dl!=27257&&Dl!=27258&&Dl!=27259&&Dl!=27260&&Dl!=27261&&Dl!=27262&&Dl!=27264&&Dl!=27265&&Dl!=27267&&Dl!=27268&&Dl!=27269&&Dl!=27270&&Dl!=27271&&Dl!=27272&&Dl!=27273&&Dl!=27277&&Dl!=27281&&Dl!=27282&&Dl!=27284&&Dl!=27286&&Dl!=27287&&Dl!=27288&&Dl!=27289&&Dl!=27290&&Dl!=27291&&Dl!=27295&&Dl!=27296&&Dl!=27297&&Dl!=27298&&Dl!=27299&&Dl!=27300&&Dl!=27301&&Dl!=27302&&Dl!=27303&&Dl!=27306&&Dl!=27307&&Dl!=27308&&Dl!=27310&&Dl!=27312&&Dl!=27314&&Dl!=27316&&Dl!=27317&&Dl!=27318&&Dl!=27320&&Dl!=27321&&Dl!=27322&&Dl!=27327&&Dl!=27328&&Dl!=27330&&Dl!=27334&&Dl!=27335&&Dl!=27336&&Dl!=27337&&Dl!=27338&&Dl!=27339&&Dl!=27342&&Dl!=27348&&Dl!=27349&&Dl!=27352&&Dl!=27354&&Dl!=27355&&Dl!=27356&&Dl!=27357&&Dl!=27358&&Dl!=27360&&Dl!=27361&&Dl!=27362&&Dl!=27363&&Dl!=27364&&Dl!=27365&&Dl!=27370&&Dl!=27371&&Dl!=27372&&Dl!=27373&&Dl!=27376&&Dl!=27378&&Dl!=27379&&Dl!=27380&&Dl!=27384&&Dl!=27385&&Dl!=27386&&Dl!=27387&&Dl!=27388&&Dl!=27389&&Dl!=27390&&Dl!=27392&&Dl!=27393&&Dl!=27396&&Dl!=27397&&Dl!=27398&&Dl!=27399&&Dl!=27402&&Dl!=27403&&Dl!=27406&&Dl!=27410&&Dl!=90198&&Dl!=90214&&Dl!=113284)break;$a()}}function Ua(){$l.startNonterminal(\"StatementsAndExpr\",Hl),qa(),Sl(),Q(),$l.endNonterminal(\"StatementsAndExpr\",Hl)}function za(){Ra(),G()}function Wa(){$l.startNonterminal(\"StatementsAndOptionalExpr\",Hl),qa(),Bl!=25&&Bl!=282&&(Sl(),Q()),$l.endNonterminal(\"StatementsAndOptionalExpr\",Hl)}function Xa(){Ra(),Bl!=25&&Bl!=282&&G()}function Va(){$l.startNonterminal(\"Statement\",Hl);switch(Bl){case 132:Nl(189);break;case 137:Nl(196);break;case 174:Nl(193);break;case 250:Nl(190);break;case 262:Nl(187);break;case 276:Nl(277);break;case 31:case 32:Nl(255);break;case 86:case 102:Nl(188);break;case 152:case 243:case 253:case 267:Nl(185);break;default:Dl=Bl}if(Dl==2836||Dl==3103||Dl==3104||Dl==3348||Dl==4372||Dl==4884||Dl==5396||Dl==5908||Dl==16148||Dl==16660||Dl==17675||Dl==17684||Dl==18196||Dl==20756||Dl==21780||Dl==22804||Dl==23316||Dl==23828||Dl==24340||Dl==27412||Dl==27924||Dl==28436||Dl==30484||Dl==34068||Dl==35092||Dl==35871||Dl==35872||Dl==36116||Dl==36895||Dl==36896||Dl==37140||Dl==37407||Dl==37408||Dl==37652||Dl==37919||Dl==37920||Dl==38164||Dl==38431||Dl==38432||Dl==38676||Dl==39455||Dl==39456||Dl==39700||Dl==39967||Dl==39968||Dl==40212||Dl==40479||Dl==40480||Dl==40724||Dl==40991||Dl==40992||Dl==41236||Dl==41503||Dl==41504||Dl==41748||Dl==42015||Dl==42016||Dl==42260||Dl==42527||Dl==42528||Dl==42772||Dl==43039||Dl==43040||Dl==43284||Dl==43551||Dl==43552||Dl==43796||Dl==44063||Dl==44064||Dl==44308||Dl==45087||Dl==45088||Dl==45332||Dl==45599||Dl==45600||Dl==45844||Dl==46111||Dl==46112||Dl==46356||Dl==46623||Dl==46624||Dl==46868||Dl==47647||Dl==47648||Dl==47892||Dl==48159||Dl==48160||Dl==48404||Dl==49183||Dl==49184||Dl==49428||Dl==49695||Dl==49696||Dl==49940||Dl==50207||Dl==50208||Dl==50452||Dl==51743||Dl==51744||Dl==51988||Dl==52255||Dl==52256||Dl==52500||Dl==52767||Dl==52768||Dl==53012||Dl==53279||Dl==53280||Dl==53524||Dl==53791||Dl==53792||Dl==54036||Dl==54303||Dl==54304||Dl==54548||Dl==55327||Dl==55328||Dl==55572||Dl==55839||Dl==55840||Dl==56084||Dl==56351||Dl==56352||Dl==56596||Dl==56863||Dl==56864||Dl==57108||Dl==57375||Dl==57376||Dl==57620||Dl==57887||Dl==57888||Dl==58132||Dl==60447||Dl==60448||Dl==60692||Dl==60959||Dl==60960||Dl==61204||Dl==61471||Dl==61472||Dl==61716||Dl==61983||Dl==61984||Dl==62228||Dl==62495||Dl==62496||Dl==62740||Dl==63007||Dl==63008||Dl==63252||Dl==63519||Dl==63520||Dl==63764||Dl==64031||Dl==64032||Dl==64276||Dl==64543||Dl==64544||Dl==64788||Dl==65567||Dl==65568||Dl==65812||Dl==66079||Dl==66080||Dl==66324||Dl==67103||Dl==67104||Dl==67348||Dl==67615||Dl==67616||Dl==67860||Dl==68127||Dl==68128||Dl==68372||Dl==68639||Dl==68640||Dl==68884||Dl==69151||Dl==69152||Dl==69396||Dl==69663||Dl==69664||Dl==69908||Dl==70175||Dl==70176||Dl==70420||Dl==72223||Dl==72224||Dl==72468||Dl==74271||Dl==74272||Dl==74516||Dl==74783||Dl==74784||Dl==75028||Dl==75807||Dl==75808||Dl==76052||Dl==76831||Dl==76832||Dl==77076||Dl==77343||Dl==77344||Dl==77588||Dl==77855||Dl==77856||Dl==78100||Dl==78367||Dl==78368||Dl==78612||Dl==78879||Dl==78880||Dl==79124||Dl==79391||Dl==79392||Dl==79636||Dl==81439||Dl==81440||Dl==81684||Dl==81951||Dl==81952||Dl==82196||Dl==82463||Dl==82464||Dl==82708||Dl==82975||Dl==82976||Dl==83220||Dl==83487||Dl==83488||Dl==83732||Dl==83999||Dl==84e3||Dl==84244||Dl==84511||Dl==84512||Dl==84756||Dl==85023||Dl==85024||Dl==85268||Dl==85535||Dl==85536||Dl==85780||Dl==87071||Dl==87072||Dl==87316||Dl==87583||Dl==87584||Dl==87828||Dl==88095||Dl==88096||Dl==88340||Dl==89119||Dl==89120||Dl==89364||Dl==90143||Dl==90144||Dl==90388||Dl==91167||Dl==91168||Dl==91412||Dl==92191||Dl==92192||Dl==92436||Dl==92703||Dl==92704||Dl==92948||Dl==93215||Dl==93216||Dl==93460||Dl==94239||Dl==94240||Dl==94484||Dl==94751||Dl==94752||Dl==94996||Dl==95263||Dl==95264||Dl==95508||Dl==97823||Dl==97824||Dl==98068||Dl==98335||Dl==98336||Dl==98580||Dl==99359||Dl==99360||Dl==99604||Dl==101407||Dl==101408||Dl==101652||Dl==101919||Dl==101920||Dl==102164||Dl==102431||Dl==102432||Dl==102676||Dl==102943||Dl==102944||Dl==103188||Dl==103455||Dl==103456||Dl==103700||Dl==103967||Dl==103968||Dl==104212||Dl==105503||Dl==105504||Dl==105748||Dl==108575||Dl==108576||Dl==108820||Dl==109087||Dl==109088||Dl==109332||Dl==110623||Dl==110624||Dl==110868||Dl==111647||Dl==111648||Dl==111892||Dl==112159||Dl==112160||Dl==112404||Dl==112671||Dl==112672||Dl==112916||Dl==113183||Dl==113184||Dl==113428||Dl==113695||Dl==113696||Dl==113940||Dl==114719||Dl==114720||Dl==114964||Dl==115231||Dl==115232||Dl==115476||Dl==115743||Dl==115744||Dl==115988||Dl==116255||Dl==116256||Dl==116500||Dl==116767||Dl==116768||Dl==117012||Dl==117279||Dl==117280||Dl==117524||Dl==119839||Dl==119840||Dl==120084||Dl==120351||Dl==120352||Dl==120596||Dl==120863||Dl==120864||Dl==121108||Dl==121375||Dl==121376||Dl==121620||Dl==122911||Dl==122912||Dl==123156||Dl==123935||Dl==123936||Dl==124180||Dl==124447||Dl==124448||Dl==124692||Dl==124959||Dl==124960||Dl==125204||Dl==127007||Dl==127008||Dl==127252||Dl==127519||Dl==127520||Dl==127764||Dl==128031||Dl==128032||Dl==128276||Dl==128543||Dl==128544||Dl==128788||Dl==129055||Dl==129056||Dl==129300||Dl==129567||Dl==129568||Dl==129812||Dl==130079||Dl==130080||Dl==130324||Dl==131103||Dl==131104||Dl==131348||Dl==131615||Dl==131616||Dl==131860||Dl==133151||Dl==133152||Dl==133396||Dl==133663||Dl==133664||Dl==133908||Dl==134175||Dl==134176||Dl==134420||Dl==134687||Dl==134688||Dl==134932||Dl==136223||Dl==136224||Dl==136468||Dl==136735||Dl==136736||Dl==136980||Dl==138271||Dl==138272||Dl==138516||Dl==140319||Dl==140320||Dl==140564||Dl==141588||Dl==142612||Dl==144660){Dl=Ol(7,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Ka(),Dl=-1}catch(a){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Ga(),Dl=-2}catch(f){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Za(),Dl=-3}catch(l){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Tf(),Dl=-12}catch(c){Dl=-13}}}}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(7,Hl,Dl)}}switch(Dl){case-2:Qa();break;case-3:Ya();break;case 90198:ef();break;case 90214:nf();break;case 113284:sf();break;case 16009:case 16046:case 116910:case 119945:case 128649:uf();break;case 17560:cf();break;case 17651:pf();break;case 141562:gf();break;case 17661:bf();break;case-12:case 16134:xf();break;case-13:Nf();break;case 53:kf();break;default:Ja()}$l.endNonterminal(\"Statement\",Hl)}function $a(){switch(Bl){case 132:Nl(189);break;case 137:Nl(196);break;case 174:Nl(193);break;case 250:Nl(190);break;case 262:Nl(187);break;case 276:Nl(277);break;case 31:case 32:Nl(255);break;case 86:case 102:Nl(188);break;case 152:case 243:case 253:case 267:Nl(185);break;default:Dl=Bl}if(Dl==2836||Dl==3103||Dl==3104||Dl==3348||Dl==4372||Dl==4884||Dl==5396||Dl==5908||Dl==16148||Dl==16660||Dl==17675||Dl==17684||Dl==18196||Dl==20756||Dl==21780||Dl==22804||Dl==23316||Dl==23828||Dl==24340||Dl==27412||Dl==27924||Dl==28436||Dl==30484||Dl==34068||Dl==35092||Dl==35871||Dl==35872||Dl==36116||Dl==36895||Dl==36896||Dl==37140||Dl==37407||Dl==37408||Dl==37652||Dl==37919||Dl==37920||Dl==38164||Dl==38431||Dl==38432||Dl==38676||Dl==39455||Dl==39456||Dl==39700||Dl==39967||Dl==39968||Dl==40212||Dl==40479||Dl==40480||Dl==40724||Dl==40991||Dl==40992||Dl==41236||Dl==41503||Dl==41504||Dl==41748||Dl==42015||Dl==42016||Dl==42260||Dl==42527||Dl==42528||Dl==42772||Dl==43039||Dl==43040||Dl==43284||Dl==43551||Dl==43552||Dl==43796||Dl==44063||Dl==44064||Dl==44308||Dl==45087||Dl==45088||Dl==45332||Dl==45599||Dl==45600||Dl==45844||Dl==46111||Dl==46112||Dl==46356||Dl==46623||Dl==46624||Dl==46868||Dl==47647||Dl==47648||Dl==47892||Dl==48159||Dl==48160||Dl==48404||Dl==49183||Dl==49184||Dl==49428||Dl==49695||Dl==49696||Dl==49940||Dl==50207||Dl==50208||Dl==50452||Dl==51743||Dl==51744||Dl==51988||Dl==52255||Dl==52256||Dl==52500||Dl==52767||Dl==52768||Dl==53012||Dl==53279||Dl==53280||Dl==53524||Dl==53791||Dl==53792||Dl==54036||Dl==54303||Dl==54304||Dl==54548||Dl==55327||Dl==55328||Dl==55572||Dl==55839||Dl==55840||Dl==56084||Dl==56351||Dl==56352||Dl==56596||Dl==56863||Dl==56864||Dl==57108||Dl==57375||Dl==57376||Dl==57620||Dl==57887||Dl==57888||Dl==58132||Dl==60447||Dl==60448||Dl==60692||Dl==60959||Dl==60960||Dl==61204||Dl==61471||Dl==61472||Dl==61716||Dl==61983||Dl==61984||Dl==62228||Dl==62495||Dl==62496||Dl==62740||Dl==63007||Dl==63008||Dl==63252||Dl==63519||Dl==63520||Dl==63764||Dl==64031||Dl==64032||Dl==64276||Dl==64543||Dl==64544||Dl==64788||Dl==65567||Dl==65568||Dl==65812||Dl==66079||Dl==66080||Dl==66324||Dl==67103||Dl==67104||Dl==67348||Dl==67615||Dl==67616||Dl==67860||Dl==68127||Dl==68128||Dl==68372||Dl==68639||Dl==68640||Dl==68884||Dl==69151||Dl==69152||Dl==69396||Dl==69663||Dl==69664||Dl==69908||Dl==70175||Dl==70176||Dl==70420||Dl==72223||Dl==72224||Dl==72468||Dl==74271||Dl==74272||Dl==74516||Dl==74783||Dl==74784||Dl==75028||Dl==75807||Dl==75808||Dl==76052||Dl==76831||Dl==76832||Dl==77076||Dl==77343||Dl==77344||Dl==77588||Dl==77855||Dl==77856||Dl==78100||Dl==78367||Dl==78368||Dl==78612||Dl==78879||Dl==78880||Dl==79124||Dl==79391||Dl==79392||Dl==79636||Dl==81439||Dl==81440||Dl==81684||Dl==81951||Dl==81952||Dl==82196||Dl==82463||Dl==82464||Dl==82708||Dl==82975||Dl==82976||Dl==83220||Dl==83487||Dl==83488||Dl==83732||Dl==83999||Dl==84e3||Dl==84244||Dl==84511||Dl==84512||Dl==84756||Dl==85023||Dl==85024||Dl==85268||Dl==85535||Dl==85536||Dl==85780||Dl==87071||Dl==87072||Dl==87316||Dl==87583||Dl==87584||Dl==87828||Dl==88095||Dl==88096||Dl==88340||Dl==89119||Dl==89120||Dl==89364||Dl==90143||Dl==90144||Dl==90388||Dl==91167||Dl==91168||Dl==91412||Dl==92191||Dl==92192||Dl==92436||Dl==92703||Dl==92704||Dl==92948||Dl==93215||Dl==93216||Dl==93460||Dl==94239||Dl==94240||Dl==94484||Dl==94751||Dl==94752||Dl==94996||Dl==95263||Dl==95264||Dl==95508||Dl==97823||Dl==97824||Dl==98068||Dl==98335||Dl==98336||Dl==98580||Dl==99359||Dl==99360||Dl==99604||Dl==101407||Dl==101408||Dl==101652||Dl==101919||Dl==101920||Dl==102164||Dl==102431||Dl==102432||Dl==102676||Dl==102943||Dl==102944||Dl==103188||Dl==103455||Dl==103456||Dl==103700||Dl==103967||Dl==103968||Dl==104212||Dl==105503||Dl==105504||Dl==105748||Dl==108575||Dl==108576||Dl==108820||Dl==109087||Dl==109088||Dl==109332||Dl==110623||Dl==110624||Dl==110868||Dl==111647||Dl==111648||Dl==111892||Dl==112159||Dl==112160||Dl==112404||Dl==112671||Dl==112672||Dl==112916||Dl==113183||Dl==113184||Dl==113428||Dl==113695||Dl==113696||Dl==113940||Dl==114719||Dl==114720||Dl==114964||Dl==115231||Dl==115232||Dl==115476||Dl==115743||Dl==115744||Dl==115988||Dl==116255||Dl==116256||Dl==116500||Dl==116767||Dl==116768||Dl==117012||Dl==117279||Dl==117280||Dl==117524||Dl==119839||Dl==119840||Dl==120084||Dl==120351||Dl==120352||Dl==120596||Dl==120863||Dl==120864||Dl==121108||Dl==121375||Dl==121376||Dl==121620||Dl==122911||Dl==122912||Dl==123156||Dl==123935||Dl==123936||Dl==124180||Dl==124447||Dl==124448||Dl==124692||Dl==124959||Dl==124960||Dl==125204||Dl==127007||Dl==127008||Dl==127252||Dl==127519||Dl==127520||Dl==127764||Dl==128031||Dl==128032||Dl==128276||Dl==128543||Dl==128544||Dl==128788||Dl==129055||Dl==129056||Dl==129300||Dl==129567||Dl==129568||Dl==129812||Dl==130079||Dl==130080||Dl==130324||Dl==131103||Dl==131104||Dl==131348||Dl==131615||Dl==131616||Dl==131860||Dl==133151||Dl==133152||Dl==133396||Dl==133663||Dl==133664||Dl==133908||Dl==134175||Dl==134176||Dl==134420||Dl==134687||Dl==134688||Dl==134932||Dl==136223||Dl==136224||Dl==136468||Dl==136735||Dl==136736||Dl==136980||Dl==138271||Dl==138272||Dl==138516||Dl==140319||Dl==140320||Dl==140564||Dl==141588||Dl==142612||Dl==144660){Dl=Ol(7,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Ka(),Al(7,t,-1),Dl=-15}catch(a){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Ga(),Al(7,t,-2),Dl=-15}catch(f){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Za(),Al(7,t,-3),Dl=-15}catch(l){try{Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Tf(),Al(7,t,-12),Dl=-15}catch(c){Dl=-13,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(7,t,-13)}}}}}}switch(Dl){case-2:Ga();break;case-3:Za();break;case 90198:tf();break;case 90214:rf();break;case 113284:of();break;case 16009:case 16046:case 116910:case 119945:case 128649:af();break;case 17560:hf();break;case 17651:df();break;case 141562:yf();break;case 17661:wf();break;case-12:case 16134:Tf();break;case-13:Cf();break;case 53:Lf();break;case-15:break;default:Ka()}}function Ja(){$l.startNonterminal(\"ApplyStatement\",Hl),Mf(),bl(53),$l.endNonterminal(\"ApplyStatement\",Hl)}function Ka(){_f(),wl(53)}function Qa(){$l.startNonterminal(\"AssignStatement\",Hl),bl(31),Tl(255),Sl(),fi(),Tl(27),bl(52),Tl(267),Sl(),Af(),bl(53),$l.endNonterminal(\"AssignStatement\",Hl)}function Ga(){wl(31),Tl(255),li(),Tl(27),wl(52),Tl(267),Of(),wl(53)}function Ya(){$l.startNonterminal(\"BlockStatement\",Hl),bl(276),Tl(277),Sl(),qa(),bl(282),$l.endNonterminal(\"BlockStatement\",Hl)}function Za(){wl(276),Tl(277),Ra(),wl(282)}function ef(){$l.startNonterminal(\"BreakStatement\",Hl),bl(86),Tl(59),bl(176),Tl(28),bl(53),$l.endNonterminal(\"BreakStatement\",Hl)}function tf(){wl(86),Tl(59),wl(176),Tl(28),wl(53)}function nf(){$l.startNonterminal(\"ContinueStatement\",Hl),bl(102),Tl(59),bl(176),Tl(28),bl(53),$l.endNonterminal(\"ContinueStatement\",Hl)}function rf(){wl(102),Tl(59),wl(176),Tl(28),wl(53)}function sf(){$l.startNonterminal(\"ExitStatement\",Hl),bl(132),Tl(71),bl(221),Tl(267),Sl(),Af(),bl(53),$l.endNonterminal(\"ExitStatement\",Hl)}function of(){wl(132),Tl(71),wl(221),Tl(267),Of(),wl(53)}function uf(){$l.startNonterminal(\"FLWORStatement\",Hl),et();for(;;){Tl(173);if(Bl==220)break;Sl(),nt()}Sl(),ff(),$l.endNonterminal(\"FLWORStatement\",Hl)}function af(){tt();for(;;){Tl(173);if(Bl==220)break;rt()}lf()}function ff(){$l.startNonterminal(\"ReturnStatement\",Hl),bl(220),Tl(270),Sl(),Va(),$l.endNonterminal(\"ReturnStatement\",Hl)}function lf(){wl(220),Tl(270),$a()}function cf(){$l.startNonterminal(\"IfStatement\",Hl),bl(152),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37),Tl(77),bl(245),Tl(270),Sl(),Va(),Tl(48),bl(122),Tl(270),Sl(),Va(),$l.endNonterminal(\"IfStatement\",Hl)}function hf(){wl(152),Tl(22),wl(34),Tl(267),G(),wl(37),Tl(77),wl(245),Tl(270),$a(),Tl(48),wl(122),Tl(270),$a()}function pf(){$l.startNonterminal(\"SwitchStatement\",Hl),bl(243),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37);for(;;){Tl(35),Sl(),vf(),Tl(113);if(Bl!=88)break}bl(109),Tl(70),bl(220),Tl(270),Sl(),Va(),$l.endNonterminal(\"SwitchStatement\",Hl)}function df(){wl(243),Tl(22),wl(34),Tl(267),G(),wl(37);for(;;){Tl(35),mf(),Tl(113);if(Bl!=88)break}wl(109),Tl(70),wl(220),Tl(270),$a()}function vf(){$l.startNonterminal(\"SwitchCaseStatement\",Hl);for(;;){bl(88),Tl(267),Sl(),cn();if(Bl!=88)break}bl(220),Tl(270),Sl(),Va(),$l.endNonterminal(\"SwitchCaseStatement\",Hl)}function mf(){for(;;){wl(88),Tl(267),hn();if(Bl!=88)break}wl(220),Tl(270),$a()}function gf(){$l.startNonterminal(\"TryCatchStatement\",Hl),bl(250),Tl(87),Sl(),Ya();for(;;){Tl(36),bl(91),Tl(257),Sl(),An(),Sl(),Ya(),Tl(278);switch(Bl){case 91:Nl(279);break;default:Dl=Bl}if(Dl==38491||Dl==45659||Dl==46171||Dl==60507||Dl==65627||Dl==67163||Dl==74843||Dl==76891||Dl==77403||Dl==82011||Dl==83035||Dl==84059||Dl==88155||Dl==91227||Dl==92251||Dl==95323||Dl==102491||Dl==127067||Dl==127579||Dl==130139){Dl=Ol(8,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Tl(36),wl(91),Tl(257),On(),Za(),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(8,Hl,Dl)}}if(Dl!=-1&&Dl!=2651&&Dl!=3163&&Dl!=35931&&Dl!=36955&&Dl!=37467&&Dl!=37979&&Dl!=39515&&Dl!=40027&&Dl!=40539&&Dl!=41051&&Dl!=41563&&Dl!=42075&&Dl!=42587&&Dl!=43099&&Dl!=43611&&Dl!=44123&&Dl!=45147&&Dl!=46683&&Dl!=47707&&Dl!=48219&&Dl!=49243&&Dl!=49755&&Dl!=50267&&Dl!=51803&&Dl!=52315&&Dl!=52827&&Dl!=53339&&Dl!=53851&&Dl!=54363&&Dl!=55387&&Dl!=55899&&Dl!=56411&&Dl!=56923&&Dl!=57435&&Dl!=57947&&Dl!=61019&&Dl!=61531&&Dl!=62043&&Dl!=62555&&Dl!=63067&&Dl!=63579&&Dl!=64091&&Dl!=64603&&Dl!=66139&&Dl!=67675&&Dl!=68187&&Dl!=68699&&Dl!=69211&&Dl!=69723&&Dl!=70235&&Dl!=72283&&Dl!=74331&&Dl!=75867&&Dl!=77915&&Dl!=78427&&Dl!=78939&&Dl!=79451&&Dl!=81499&&Dl!=82523&&Dl!=83547&&Dl!=84571&&Dl!=85083&&Dl!=85595&&Dl!=87131&&Dl!=87643&&Dl!=89179&&Dl!=90203&&Dl!=92763&&Dl!=93275&&Dl!=94299&&Dl!=94811&&Dl!=97883&&Dl!=98395&&Dl!=99419&&Dl!=101467&&Dl!=101979&&Dl!=103003&&Dl!=103515&&Dl!=104027&&Dl!=105563&&Dl!=108635&&Dl!=109147&&Dl!=110683&&Dl!=111707&&Dl!=112219&&Dl!=112731&&Dl!=113243&&Dl!=113755&&Dl!=114779&&Dl!=115291&&Dl!=115803&&Dl!=116315&&Dl!=116827&&Dl!=117339&&Dl!=119899&&Dl!=120411&&Dl!=120923&&Dl!=121435&&Dl!=122971&&Dl!=123995&&Dl!=124507&&Dl!=125019&&Dl!=128091&&Dl!=128603&&Dl!=129115&&Dl!=129627&&Dl!=131163&&Dl!=131675&&Dl!=133211&&Dl!=133723&&Dl!=134235&&Dl!=134747&&Dl!=136283&&Dl!=136795&&Dl!=138331&&Dl!=140379)break}$l.endNonterminal(\"TryCatchStatement\",Hl)}function yf(){wl(250),Tl(87),Za(),Tl(36),wl(91),Tl(257),On(),Za();for(;;){Tl(278);switch(Bl){case 91:Nl(279);break;default:Dl=Bl}if(Dl==38491||Dl==45659||Dl==46171||Dl==60507||Dl==65627||Dl==67163||Dl==74843||Dl==76891||Dl==77403||Dl==82011||Dl==83035||Dl==84059||Dl==88155||Dl==91227||Dl==92251||Dl==95323||Dl==102491||Dl==127067||Dl==127579||Dl==130139){Dl=Ol(8,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{Tl(36),wl(91),Tl(257),On(),Za(),Al(8,t,-1);continue}catch(a){Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(8,t,-2);break}}}if(Dl!=-1&&Dl!=2651&&Dl!=3163&&Dl!=35931&&Dl!=36955&&Dl!=37467&&Dl!=37979&&Dl!=39515&&Dl!=40027&&Dl!=40539&&Dl!=41051&&Dl!=41563&&Dl!=42075&&Dl!=42587&&Dl!=43099&&Dl!=43611&&Dl!=44123&&Dl!=45147&&Dl!=46683&&Dl!=47707&&Dl!=48219&&Dl!=49243&&Dl!=49755&&Dl!=50267&&Dl!=51803&&Dl!=52315&&Dl!=52827&&Dl!=53339&&Dl!=53851&&Dl!=54363&&Dl!=55387&&Dl!=55899&&Dl!=56411&&Dl!=56923&&Dl!=57435&&Dl!=57947&&Dl!=61019&&Dl!=61531&&Dl!=62043&&Dl!=62555&&Dl!=63067&&Dl!=63579&&Dl!=64091&&Dl!=64603&&Dl!=66139&&Dl!=67675&&Dl!=68187&&Dl!=68699&&Dl!=69211&&Dl!=69723&&Dl!=70235&&Dl!=72283&&Dl!=74331&&Dl!=75867&&Dl!=77915&&Dl!=78427&&Dl!=78939&&Dl!=79451&&Dl!=81499&&Dl!=82523&&Dl!=83547&&Dl!=84571&&Dl!=85083&&Dl!=85595&&Dl!=87131&&Dl!=87643&&Dl!=89179&&Dl!=90203&&Dl!=92763&&Dl!=93275&&Dl!=94299&&Dl!=94811&&Dl!=97883&&Dl!=98395&&Dl!=99419&&Dl!=101467&&Dl!=101979&&Dl!=103003&&Dl!=103515&&Dl!=104027&&Dl!=105563&&Dl!=108635&&Dl!=109147&&Dl!=110683&&Dl!=111707&&Dl!=112219&&Dl!=112731&&Dl!=113243&&Dl!=113755&&Dl!=114779&&Dl!=115291&&Dl!=115803&&Dl!=116315&&Dl!=116827&&Dl!=117339&&Dl!=119899&&Dl!=120411&&Dl!=120923&&Dl!=121435&&Dl!=122971&&Dl!=123995&&Dl!=124507&&Dl!=125019&&Dl!=128091&&Dl!=128603&&Dl!=129115&&Dl!=129627&&Dl!=131163&&Dl!=131675&&Dl!=133211&&Dl!=133723&&Dl!=134235&&Dl!=134747&&Dl!=136283&&Dl!=136795&&Dl!=138331&&Dl!=140379)break;Tl(36),wl(91),Tl(257),On(),Za()}}function bf(){$l.startNonterminal(\"TypeswitchStatement\",Hl),bl(253),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37);for(;;){Tl(35),Sl(),Ef(),Tl(113);if(Bl!=88)break}bl(109),Tl(95),Bl==31&&(bl(31),Tl(255),Sl(),fi()),Tl(70),bl(220),Tl(270),Sl(),Va(),$l.endNonterminal(\"TypeswitchStatement\",Hl)}function wf(){wl(253),Tl(22),wl(34),Tl(267),G(),wl(37);for(;;){Tl(35),Sf(),Tl(113);if(Bl!=88)break}wl(109),Tl(95),Bl==31&&(wl(31),Tl(255),li()),Tl(70),wl(220),Tl(270),$a()}function Ef(){$l.startNonterminal(\"CaseStatement\",Hl),bl(88),Tl(262),Bl==31&&(bl(31),Tl(255),Sl(),fi(),Tl(30),bl(79)),Tl(260),Sl(),ps(),Tl(70),bl(220),Tl(270),Sl(),Va(),$l.endNonterminal(\"CaseStatement\",Hl)}function Sf(){wl(88),Tl(262),Bl==31&&(wl(31),Tl(255),li(),Tl(30),wl(79)),Tl(260),ds(),Tl(70),wl(220),Tl(270),$a()}function xf(){$l.startNonterminal(\"VarDeclStatement\",Hl);for(;;){Tl(98);if(Bl!=32)break;Sl(),H()}bl(262),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(157),Bl==79&&(Sl(),cs()),Tl(145),Bl==52&&(bl(52),Tl(267),Sl(),Af());for(;;){if(Bl!=41)break;bl(41),Tl(21),bl(31),Tl(255),Sl(),fi(),Tl(157),Bl==79&&(Sl(),cs()),Tl(145),Bl==52&&(bl(52),Tl(267),Sl(),Af())}bl(53),$l.endNonterminal(\"VarDeclStatement\",Hl)}function Tf(){for(;;){Tl(98);if(Bl!=32)break;B()}wl(262),Tl(21),wl(31),Tl(255),li(),Tl(157),Bl==79&&hs(),Tl(145),Bl==52&&(wl(52),Tl(267),Of());for(;;){if(Bl!=41)break;wl(41),Tl(21),wl(31),Tl(255),li(),Tl(157),Bl==79&&hs(),Tl(145),Bl==52&&(wl(52),Tl(267),Of())}wl(53)}function Nf(){$l.startNonterminal(\"WhileStatement\",Hl),bl(267),Tl(22),bl(34),Tl(267),Sl(),Q(),bl(37),Tl(270),Sl(),Va(),$l.endNonterminal(\"WhileStatement\",Hl)}function Cf(){wl(267),Tl(22),wl(34),Tl(267),G(),wl(37),Tl(270),$a()}function kf(){$l.startNonterminal(\"VoidStatement\",Hl),bl(53),$l.endNonterminal(\"VoidStatement\",Hl)}function Lf(){wl(53)}function Af(){$l.startNonterminal(\"ExprSingle\",Hl);switch(Bl){case 137:Nl(236);break;case 174:Nl(233);break;case 250:Nl(232);break;case 152:case 243:case 253:Nl(229);break;default:Dl=Bl}switch(Dl){case 16009:case 16046:case 116910:case 119945:case 128649:Y();break;case 17560:bn();break;case 17651:un();break;case 141562:En();break;case 17661:pn();break;default:Mf()}$l.endNonterminal(\"ExprSingle\",Hl)}function Of(){switch(Bl){case 137:Nl(236);break;case 174:Nl(233);break;case 250:Nl(232);break;case 152:case 243:case 253:Nl(229);break;default:Dl=Bl}switch(Dl){case 16009:case 16046:case 116910:case 119945:case 128649:Z();break;case 17560:wn();break;case 17651:an();break;case 141562:Sn();break;case 17661:dn();break;default:_f()}}function Mf(){$l.startNonterminal(\"ExprSimple\",Hl);switch(Bl){case 77:Nl(231);break;case 218:Nl(234);break;case 219:Nl(235);break;case 110:case 159:Nl(237);break;case 103:case 129:case 235:Nl(230);break;default:Dl=Bl}if(Dl==133851){Dl=Ol(9,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{_o(),Dl=-6}catch(a){Dl=-11}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(9,Hl,Dl)}}switch(Dl){case 16001:case 16107:sn();break;case 97951:case 98463:ko();break;case 97902:case 98414:Ao();break;case 98010:Do();break;case-6:case 98011:Mo();break;case 15975:Ro();break;case 85102:Df();break;case 85151:Hf();break;case 85210:jf();break;case-11:If();break;case 85069:Rf();break;default:Mn()}$l.endNonterminal(\"ExprSimple\",Hl)}function _f(){switch(Bl){case 77:Nl(231);break;case 218:Nl(234);break;case 219:Nl(235);break;case 110:case 159:Nl(237);break;case 103:case 129:case 235:Nl(230);break;default:Dl=Bl}if(Dl==133851){Dl=Ol(9,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{_o(),Al(9,t,-6),Dl=-13}catch(a){Dl=-11,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(9,t,-11)}}}switch(Dl){case 16001:case 16107:on();break;case 97951:case 98463:Lo();break;case 97902:case 98414:Oo();break;case 98010:Po();break;case-6:case 98011:_o();break;case 15975:Uo();break;case 85102:Pf();break;case 85151:Bf();break;case 85210:Ff();break;case-11:qf();break;case 85069:Uf();break;case-13:break;default:_n()}}function Df(){$l.startNonterminal(\"JSONDeleteExpr\",Hl),bl(110),Tl(56),bl(166),Tl(264),Sl(),Kr(),$l.endNonterminal(\"JSONDeleteExpr\",Hl)}function Pf(){wl(110),Tl(56),wl(166),Tl(264),Qr()}function Hf(){$l.startNonterminal(\"JSONInsertExpr\",Hl);switch(Bl){case 159:Nl(56);break;default:Dl=Bl}Dl=Ol(10,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(159),Tl(56),wl(166),Tl(267),Of(),wl(163),Tl(267),Of();switch(Bl){case 81:Nl(69);break;default:Dl=Bl}if(Dl==108113){Dl=Ol(11,Hl);if(Dl==0){var a=Pl,f=Hl,l=Bl,c=jl,h=Fl,p=Il,d=ql,v=Rl;try{wl(81),Tl(69),wl(211),Tl(267),Of(),Al(11,f,-1)}catch(m){Pl=a,Hl=f,Bl=l,Bl==0?Yl=f:(jl=c,Fl=h,Il=p,Il==0?Yl=h:(ql=d,Rl=v,Yl=v)),Al(11,f,-2)}Dl=-2}}Dl==-1&&(wl(81),Tl(69),wl(211),Tl(267),Of()),Dl=-1}catch(g){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(10,Hl,Dl)}switch(Dl){case-1:bl(159),Tl(56),bl(166),Tl(267),Sl(),Af(),bl(163),Tl(267),Sl(),Af();switch(Bl){case 81:Nl(69);break;default:Dl=Bl}if(Dl==108113){Dl=Ol(11,Hl);if(Dl==0){var a=Pl,f=Hl,l=Bl,c=jl,h=Fl,p=Il,d=ql,v=Rl;try{wl(81),Tl(69),wl(211),Tl(267),Of(),Dl=-1}catch(m){Dl=-2}Pl=a,Hl=f,Bl=l,Bl==0?Yl=f:(jl=c,Fl=h,Il=p,Il==0?Yl=h:(ql=d,Rl=v,Yl=v)),Al(11,Hl,Dl)}}Dl==-1&&(bl(81),Tl(69),bl(211),Tl(267),Sl(),Af());break;default:bl(159),Tl(56),bl(166),Tl(267),Sl(),fl(),bl(163),Tl(267),Sl(),Af()}$l.endNonterminal(\"JSONInsertExpr\",Hl)}function Bf(){switch(Bl){case 159:Nl(56);break;default:Dl=Bl}Dl=Ol(10,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(159),Tl(56),wl(166),Tl(267),Of(),wl(163),Tl(267),Of();switch(Bl){case 81:Nl(69);break;default:Dl=Bl}if(Dl==108113){Dl=Ol(11,Hl);if(Dl==0){var a=Pl,f=Hl,l=Bl,c=jl,h=Fl,p=Il,d=ql,v=Rl;try{wl(81),Tl(69),wl(211),Tl(267),Of(),Al(11,f,-1)}catch(m){Pl=a,Hl=f,Bl=l,Bl==0?Yl=f:(jl=c,Fl=h,Il=p,Il==0?Yl=h:(ql=d,Rl=v,Yl=v)),Al(11,f,-2)}Dl=-2}}Dl==-1&&(wl(81),Tl(69),wl(211),Tl(267),Of()),Al(10,t,-1),Dl=-3}catch(g){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(10,t,-2)}}switch(Dl){case-1:wl(159),Tl(56),wl(166),Tl(267),Of(),wl(163),Tl(267),Of();switch(Bl){case 81:Nl(69);break;default:Dl=Bl}if(Dl==108113){Dl=Ol(11,Hl);if(Dl==0){var a=Pl,f=Hl,l=Bl,c=jl,h=Fl,p=Il,d=ql,v=Rl;try{wl(81),Tl(69),wl(211),Tl(267),Of(),Al(11,f,-1)}catch(m){Pl=a,Hl=f,Bl=l,Bl==0?Yl=f:(jl=c,Fl=h,Il=p,Il==0?Yl=h:(ql=d,Rl=v,Yl=v)),Al(11,f,-2)}Dl=-2}}Dl==-1&&(wl(81),Tl(69),wl(211),Tl(267),Of());break;case-3:break;default:wl(159),Tl(56),wl(166),Tl(267),ll(),wl(163),Tl(267),Of()}}function jf(){$l.startNonterminal(\"JSONRenameExpr\",Hl),bl(218),Tl(56),bl(166),Tl(264),Sl(),Kr(),bl(79),Tl(267),Sl(),Af(),$l.endNonterminal(\"JSONRenameExpr\",Hl)}function Ff(){wl(218),Tl(56),wl(166),Tl(264),Qr(),wl(79),Tl(267),Of()}function If(){$l.startNonterminal(\"JSONReplaceExpr\",Hl),bl(219),Tl(82),bl(261),Tl(64),bl(196),Tl(56),bl(166),Tl(264),Sl(),Kr(),bl(270),Tl(267),Sl(),Af(),$l.endNonterminal(\"JSONReplaceExpr\",Hl)}function qf(){wl(219),Tl(82),wl(261),Tl(64),wl(196),Tl(56),wl(166),Tl(264),Qr(),wl(270),Tl(267),Of()}function Rf(){$l.startNonterminal(\"JSONAppendExpr\",Hl),bl(77),Tl(56),bl(166),Tl(267),Sl(),Af(),bl(163),Tl(267),Sl(),Af(),$l.endNonterminal(\"JSONAppendExpr\",Hl)}function Uf(){wl(77),Tl(56),wl(166),Tl(267),Of(),wl(163),Tl(267),Of()}function zf(){$l.startNonterminal(\"CommonContent\",Hl);switch(Bl){case 12:bl(12);break;case 23:bl(23);break;case 277:bl(277);break;case 283:bl(283);break;default:vl()}$l.endNonterminal(\"CommonContent\",Hl)}function Wf(){switch(Bl){case 12:wl(12);break;case 23:wl(23);break;case 277:wl(277);break;case 283:wl(283);break;default:ml()}}function Xf(){$l.startNonterminal(\"ContentExpr\",Hl),Ua(),$l.endNonterminal(\"ContentExpr\",Hl)}function Vf(){za()}function $f(){$l.startNonterminal(\"CompDocConstructor\",Hl),bl(119),Tl(87),Sl(),vl(),$l.endNonterminal(\"CompDocConstructor\",Hl)}function Jf(){wl(119),Tl(87),ml()}function Kf(){$l.startNonterminal(\"CompAttrConstructor\",Hl),bl(82),Tl(258);switch(Bl){case 276:bl(276),Tl(267),Sl(),Q(),bl(282);break;default:Sl(),_a()}Tl(87);switch(Bl){case 276:Nl(277);break;default:Dl=Bl}if(Dl==144660){Dl=Ol(12,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(276),Tl(88),wl(282),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(12,Hl,Dl)}}switch(Dl){case-1:bl(276),Tl(88),bl(282);break;default:Sl(),vl()}$l.endNonterminal(\"CompAttrConstructor\",Hl)}function Qf(){wl(82),Tl(258);switch(Bl){case 276:wl(276),Tl(267),G(),wl(282);break;default:Da()}Tl(87);switch(Bl){case 276:Nl(277);break;default:Dl=Bl}if(Dl==144660){Dl=Ol(12,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(276),Tl(88),wl(282),Al(12,t,-1),Dl=-3}catch(a){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(12,t,-2)}}}switch(Dl){case-1:wl(276),Tl(88),wl(282);break;case-3:break;default:ml()}}function Gf(){$l.startNonterminal(\"CompPIConstructor\",Hl),bl(216),Tl(251);switch(Bl){case 276:bl(276),Tl(267),Sl(),Q(),bl(282);break;default:Sl(),Ba()}Tl(87);switch(Bl){case 276:Nl(277);break;default:Dl=Bl}if(Dl==144660){Dl=Ol(13,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(276),Tl(88),wl(282),Dl=-1}catch(a){Dl=-2}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(13,Hl,Dl)}}switch(Dl){case-1:bl(276),Tl(88),bl(282);break;default:Sl(),vl()}$l.endNonterminal(\"CompPIConstructor\",Hl)}function Yf(){wl(216),Tl(251);switch(Bl){case 276:wl(276),Tl(267),G(),wl(282);break;default:ja()}Tl(87);switch(Bl){case 276:Nl(277);break;default:Dl=Bl}if(Dl==144660){Dl=Ol(13,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{wl(276),Tl(88),wl(282),Al(13,t,-1),Dl=-3}catch(a){Dl=-2,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(13,t,-2)}}}switch(Dl){case-1:wl(276),Tl(88),wl(282);break;case-3:break;default:ml()}}function Zf(){$l.startNonterminal(\"CompCommentConstructor\",Hl),bl(96),Tl(87),Sl(),vl(),$l.endNonterminal(\"CompCommentConstructor\",Hl)}function el(){wl(96),Tl(87),ml()}function tl(){$l.startNonterminal(\"CompTextConstructor\",Hl),bl(244),Tl(87),Sl(),vl(),$l.endNonterminal(\"CompTextConstructor\",Hl)}function nl(){wl(244),Tl(87),ml()}function rl(){$l.startNonterminal(\"PrimaryExpr\",Hl);switch(Bl){case 184:Nl(256);break;case 216:Nl(254);break;case 276:Nl(277);break;case 82:case 121:Nl(259);break;case 96:case 244:Nl(93);break;case 119:case 202:case 256:Nl(139);break;case 6:case 70:case 72:case 73:case 74:case 75:case 77:case 79:case 80:case 81:case 83:case 84:case 85:case 86:case 88:case 89:case 90:case 91:case 93:case 94:case 97:case 98:case 101:case 102:case 103:case 104:case 105:case 106:case 108:case 109:case 110:case 111:case 112:case 113:case 118:case 122:case 123:case 125:case 126:case 128:case 129:case 131:case 132:case 133:case 134:case 135:case 136:case 137:case 141:case 146:case 148:case 150:case 151:case 153:case 154:case 155:case 159:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 174:case 176:case 178:case 180:case 181:case 182:case 186:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 206:case 212:case 213:case 218:case 219:case 220:case 221:case 222:case 224:case 225:case 228:case 229:case 234:case 235:case 236:case 237:case 240:case 248:case 249:case 250:case 251:case 252:case 254:case 257:case 260:case 261:case 262:case 263:case 266:case 267:case 270:case 274:Nl(92);break;default:Dl=Bl}if(Dl==2836||Dl==3348||Dl==4372||Dl==4884||Dl==5396||Dl==5908||Dl==16148||Dl==16660||Dl==17684||Dl==18196||Dl==20756||Dl==21780||Dl==22804||Dl==23316||Dl==23828||Dl==24340||Dl==27924||Dl==28436||Dl==30484||Dl==34068||Dl==35092||Dl==36116||Dl==37140||Dl==37652||Dl==38164||Dl==38676||Dl==39700||Dl==40212||Dl==40724||Dl==41236||Dl==41748||Dl==42260||Dl==42772||Dl==43284||Dl==43796||Dl==44308||Dl==45332||Dl==45844||Dl==46356||Dl==46868||Dl==47892||Dl==48404||Dl==49428||Dl==49940||Dl==50452||Dl==51988||Dl==52500||Dl==53012||Dl==53524||Dl==54036||Dl==54548||Dl==55572||Dl==56084||Dl==56596||Dl==57108||Dl==57620||Dl==58132||Dl==60692||Dl==61204||Dl==61716||Dl==62228||Dl==62740||Dl==63252||Dl==63764||Dl==64276||Dl==64788||Dl==65812||Dl==66324||Dl==67348||Dl==67860||Dl==68372||Dl==68884||Dl==69396||Dl==69908||Dl==70420||Dl==72468||Dl==74516||Dl==75028||Dl==76052||Dl==77076||Dl==77588||Dl==78100||Dl==78612||Dl==79124||Dl==79636||Dl==81684||Dl==82196||Dl==82708||Dl==83220||Dl==83732||Dl==84244||Dl==84756||Dl==85268||Dl==85780||Dl==87316||Dl==87828||Dl==88340||Dl==89364||Dl==90388||Dl==91412||Dl==92436||Dl==92948||Dl==93460||Dl==94484||Dl==94996||Dl==95508||Dl==98068||Dl==98580||Dl==99604||Dl==101652||Dl==102164||Dl==102676||Dl==103188||Dl==103700||Dl==104212||Dl==105748||Dl==108820||Dl==109332||Dl==110868||Dl==111892||Dl==112404||Dl==112916||Dl==113428||Dl==113940||Dl==114964||Dl==115476||Dl==115988||Dl==116500||Dl==117012||Dl==117524||Dl==120084||Dl==120596||Dl==121108||Dl==121620||Dl==123156||Dl==124180||Dl==124692||Dl==125204||Dl==127252||Dl==127764||Dl==128276||Dl==128788||Dl==129300||Dl==129812||Dl==130324||Dl==131348||Dl==131860||Dl==133396||Dl==133908||Dl==134420||Dl==134932||Dl==136468||Dl==136980||Dl==138516||Dl==140564||Dl==141588||Dl==142612||Dl==144660){Dl=Ol(14,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{ml(),Dl=-10}catch(a){Dl=-11}Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(14,Hl,Dl)}}switch(Dl){case 8:case 9:case 10:case 11:ri();break;case 31:ui();break;case 34:ci();break;case 44:pi();break;case 17414:case 17478:case 17480:case 17481:case 17482:case 17483:case 17485:case 17487:case 17488:case 17489:case 17491:case 17492:case 17493:case 17494:case 17496:case 17497:case 17498:case 17499:case 17501:case 17502:case 17505:case 17506:case 17509:case 17510:case 17511:case 17512:case 17513:case 17514:case 17516:case 17517:case 17518:case 17519:case 17520:case 17521:case 17526:case 17527:case 17530:case 17531:case 17533:case 17534:case 17536:case 17537:case 17539:case 17540:case 17541:case 17542:case 17543:case 17544:case 17545:case 17549:case 17554:case 17556:case 17558:case 17559:case 17561:case 17562:case 17563:case 17567:case 17568:case 17569:case 17570:case 17571:case 17572:case 17574:case 17578:case 17579:case 17580:case 17582:case 17584:case 17586:case 17588:case 17589:case 17590:case 17592:case 17594:case 17600:case 17602:case 17606:case 17607:case 17608:case 17609:case 17610:case 17611:case 17614:case 17620:case 17621:case 17626:case 17627:case 17628:case 17629:case 17630:case 17632:case 17633:case 17636:case 17637:case 17642:case 17643:case 17644:case 17645:case 17648:case 17656:case 17657:case 17658:case 17659:case 17660:case 17662:case 17664:case 17665:case 17668:case 17669:case 17670:case 17671:case 17674:case 17675:case 17678:case 17682:bi();break;case 141514:vi();break;case 141568:gi();break;case 32:case 78:case 120:case 124:case 145:case 152:case 165:case 167:case 185:case 191:case 226:case 227:case 242:case 243:case 253:case 14854:case 14918:case 14920:case 14921:case 14922:case 14923:case 14925:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14936:case 14937:case 14938:case 14939:case 14941:case 14942:case 14944:case 14945:case 14946:case 14949:case 14950:case 14951:case 14952:case 14953:case 14954:case 14956:case 14957:case 14958:case 14959:case 14960:case 14961:case 14966:case 14967:case 14969:case 14970:case 14971:case 14973:case 14974:case 14976:case 14977:case 14979:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14989:case 14994:case 14996:case 14998:case 14999:case 15001:case 15002:case 15003:case 15007:case 15008:case 15009:case 15010:case 15011:case 15012:case 15014:case 15018:case 15019:case 15020:case 15022:case 15024:case 15026:case 15028:case 15029:case 15030:case 15032:case 15034:case 15040:case 15042:case 15046:case 15047:case 15048:case 15049:case 15050:case 15051:case 15054:case 15060:case 15061:case 15064:case 15066:case 15067:case 15068:case 15069:case 15070:case 15072:case 15073:case 15076:case 15077:case 15082:case 15083:case 15084:case 15085:case 15088:case 15092:case 15096:case 15097:case 15098:case 15099:case 15100:case 15102:case 15104:case 15105:case 15108:case 15109:case 15110:case 15111:case 15114:case 15115:case 15118:case 15122:rs();break;case-10:case 27412:vl();break;case-11:ul();break;case 68:pl();break;case 278:sl();break;default:Ni()}$l.endNonterminal(\"PrimaryExpr\",Hl)}function il(){switch(Bl){case 184:Nl(256);break;case 216:Nl(254);break;case 276:Nl(277);break;case 82:case 121:Nl(259);break;case 96:case 244:Nl(93);break;case 119:case 202:case 256:Nl(139);break;case 6:case 70:case 72:case 73:case 74:case 75:case 77:case 79:case 80:case 81:case 83:case 84:case 85:case 86:case 88:case 89:case 90:case 91:case 93:case 94:case 97:case 98:case 101:case 102:case 103:case 104:case 105:case 106:case 108:case 109:case 110:case 111:case 112:case 113:case 118:case 122:case 123:case 125:case 126:case 128:case 129:case 131:case 132:case 133:case 134:case 135:case 136:case 137:case 141:case 146:case 148:case 150:case 151:case 153:case 154:case 155:case 159:case 160:case 161:case 162:case 163:case 164:case 166:case 170:case 171:case 172:case 174:case 176:case 178:case 180:case 181:case 182:case 186:case 192:case 194:case 198:case 199:case 200:case 201:case 203:case 206:case 212:case 213:case 218:case 219:case 220:case 221:case 222:case 224:case 225:case 228:case 229:case 234:case 235:case 236:case 237:case 240:case 248:case 249:case 250:case 251:case 252:case 254:case 257:case 260:case 261:case 262:case 263:case 266:case 267:case 270:case 274:Nl(92);break;default:Dl=Bl}if(Dl==2836||Dl==3348||Dl==4372||Dl==4884||Dl==5396||Dl==5908||Dl==16148||Dl==16660||Dl==17684||Dl==18196||Dl==20756||Dl==21780||Dl==22804||Dl==23316||Dl==23828||Dl==24340||Dl==27924||Dl==28436||Dl==30484||Dl==34068||Dl==35092||Dl==36116||Dl==37140||Dl==37652||Dl==38164||Dl==38676||Dl==39700||Dl==40212||Dl==40724||Dl==41236||Dl==41748||Dl==42260||Dl==42772||Dl==43284||Dl==43796||Dl==44308||Dl==45332||Dl==45844||Dl==46356||Dl==46868||Dl==47892||Dl==48404||Dl==49428||Dl==49940||Dl==50452||Dl==51988||Dl==52500||Dl==53012||Dl==53524||Dl==54036||Dl==54548||Dl==55572||Dl==56084||Dl==56596||Dl==57108||Dl==57620||Dl==58132||Dl==60692||Dl==61204||Dl==61716||Dl==62228||Dl==62740||Dl==63252||Dl==63764||Dl==64276||Dl==64788||Dl==65812||Dl==66324||Dl==67348||Dl==67860||Dl==68372||Dl==68884||Dl==69396||Dl==69908||Dl==70420||Dl==72468||Dl==74516||Dl==75028||Dl==76052||Dl==77076||Dl==77588||Dl==78100||Dl==78612||Dl==79124||Dl==79636||Dl==81684||Dl==82196||Dl==82708||Dl==83220||Dl==83732||Dl==84244||Dl==84756||Dl==85268||Dl==85780||Dl==87316||Dl==87828||Dl==88340||Dl==89364||Dl==90388||Dl==91412||Dl==92436||Dl==92948||Dl==93460||Dl==94484||Dl==94996||Dl==95508||Dl==98068||Dl==98580||Dl==99604||Dl==101652||Dl==102164||Dl==102676||Dl==103188||Dl==103700||Dl==104212||Dl==105748||Dl==108820||Dl==109332||Dl==110868||Dl==111892||Dl==112404||Dl==112916||Dl==113428||Dl==113940||Dl==114964||Dl==115476||Dl==115988||Dl==116500||Dl==117012||Dl==117524||Dl==120084||Dl==120596||Dl==121108||Dl==121620||Dl==123156||Dl==124180||Dl==124692||Dl==125204||Dl==127252||Dl==127764||Dl==128276||Dl==128788||Dl==129300||Dl==129812||Dl==130324||Dl==131348||Dl==131860||Dl==133396||Dl==133908||Dl==134420||Dl==134932||Dl==136468||Dl==136980||Dl==138516||Dl==140564||Dl==141588||Dl==142612||Dl==144660){Dl=Ol(14,Hl);if(Dl==0){var e=Pl,t=Hl,n=Bl,r=jl,i=Fl,s=Il,o=ql,u=Rl;try{ml(),Al(14,t,-10),Dl=-14}catch(a){Dl=-11,Pl=e,Hl=t,Bl=n,Bl==0?Yl=t:(jl=r,Fl=i,Il=s,Il==0?Yl=i:(ql=o,Rl=u,Yl=u)),Al(14,t,-11)}}}switch(Dl){case 8:case 9:case 10:case 11:ii();break;case 31:ai();break;case 34:hi();break;case 44:di();break;case 17414:case 17478:case 17480:case 17481:case 17482:case 17483:case 17485:case 17487:case 17488:case 17489:case 17491:case 17492:case 17493:case 17494:case 17496:case 17497:case 17498:case 17499:case 17501:case 17502:case 17505:case 17506:case 17509:case 17510:case 17511:case 17512:case 17513:case 17514:case 17516:case 17517:case 17518:case 17519:case 17520:case 17521:case 17526:case 17527:case 17530:case 17531:case 17533:case 17534:case 17536:case 17537:case 17539:case 17540:case 17541:case 17542:case 17543:case 17544:case 17545:case 17549:case 17554:case 17556:case 17558:case 17559:case 17561:case 17562:case 17563:case 17567:case 17568:case 17569:case 17570:case 17571:case 17572:case 17574:case 17578:case 17579:case 17580:case 17582:case 17584:case 17586:case 17588:case 17589:case 17590:case 17592:case 17594:case 17600:case 17602:case 17606:case 17607:case 17608:case 17609:case 17610:case 17611:case 17614:case 17620:case 17621:case 17626:case 17627:case 17628:case 17629:case 17630:case 17632:case 17633:case 17636:case 17637:case 17642:case 17643:case 17644:case 17645:case 17648:case 17656:case 17657:case 17658:case 17659:case 17660:case 17662:case 17664:case 17665:case 17668:case 17669:case 17670:case 17671:case 17674:case 17675:case 17678:case 17682:wi();break;case 141514:mi();break;case 141568:yi();break;case 32:case 78:case 120:case 124:case 145:case 152:case 165:case 167:case 185:case 191:case 226:case 227:case 242:case 243:case 253:case 14854:case 14918:case 14920:case 14921:case 14922:case 14923:case 14925:case 14927:case 14928:case 14929:case 14930:case 14931:case 14932:case 14933:case 14934:case 14936:case 14937:case 14938:case 14939:case 14941:case 14942:case 14944:case 14945:case 14946:case 14949:case 14950:case 14951:case 14952:case 14953:case 14954:case 14956:case 14957:case 14958:case 14959:case 14960:case 14961:case 14966:case 14967:case 14969:case 14970:case 14971:case 14973:case 14974:case 14976:case 14977:case 14979:case 14980:case 14981:case 14982:case 14983:case 14984:case 14985:case 14989:case 14994:case 14996:case 14998:case 14999:case 15001:case 15002:case 15003:case 15007:case 15008:case 15009:case 15010:case 15011:case 15012:case 15014:case 15018:case 15019:case 15020:case 15022:case 15024:case 15026:case 15028:case 15029:case 15030:case 15032:case 15034:case 15040:case 15042:case 15046:case 15047:case 15048:case 15049:case 15050:case 15051:case 15054:case 15060:case 15061:case 15064:case 15066:case 15067:case 15068:case 15069:case 15070:case 15072:case 15073:case 15076:case 15077:case 15082:case 15083:case 15084:case 15085:case 15088:case 15092:case 15096:case 15097:case 15098:case 15099:case 15100:case 15102:case 15104:case 15105:case 15108:case 15109:case 15110:case 15111:case 15114:case 15115:case 15118:case 15122:is();break;case-10:case 27412:ml();break;case-11:al();break;case 68:dl();break;case 278:ol();break;case-14:break;default:Ci()}}function sl(){$l.startNonterminal(\"JSONSimpleObjectUnion\",Hl),bl(278),Tl(273),Bl!=281&&(Sl(),Q()),bl(281),$l.endNonterminal(\"JSONSimpleObjectUnion\",Hl)}function ol(){wl(278),Tl(273),Bl!=281&&G(),wl(281)}function ul(){$l.startNonterminal(\"ObjectConstructor\",Hl),bl(276),Tl(274),Bl!=282&&(Sl(),fl()),bl(282),$l.endNonterminal(\"ObjectConstructor\",Hl)}function al(){wl(276),Tl(274),Bl!=282&&ll(),wl(282)}function fl(){$l.startNonterminal(\"PairConstructorList\",Hl),cl();for(;;){if(Bl!=41)break;bl(41),Tl(267),Sl(),cl()}$l.endNonterminal(\"PairConstructorList\",Hl)}function ll(){hl();for(;;){if(Bl!=41)break;wl(41),Tl(267),hl()}}function cl(){$l.startNonterminal(\"PairConstructor\",Hl),Af(),bl(49),Tl(267),Sl(),Af(),$l.endNonterminal(\"PairConstructor\",Hl)}function hl(){Of(),wl(49),Tl(267),Of()}function pl(){$l.startNonterminal(\"ArrayConstructor\",Hl),bl(68),Tl(272),Bl!=69&&(Sl(),Q()),bl(69),$l.endNonterminal(\"ArrayConstructor\",Hl)}function dl(){wl(68),Tl(272),Bl!=69&&G(),wl(69)}function vl(){$l.startNonterminal(\"BlockExpr\",Hl),bl(276),Tl(277),Sl(),Wa(),bl(282),$l.endNonterminal(\"BlockExpr\",Hl)}function ml(){wl(276),Tl(277),Xa(),wl(282)}function gl(){$l.startNonterminal(\"FunctionDecl\",Hl),bl(145),Tl(255),Sl(),_a(),Tl(22),bl(34),Tl(94),Bl==31&&(Sl(),R()),bl(37),Tl(148),Bl==79&&(Sl(),yl()),Tl(118);switch(Bl){case 276:bl(276),Tl(277),Sl(),Wa(),bl(282);break;default:bl(133)}$l.endNonterminal(\"FunctionDecl\",Hl)}function yl(){$l.startNonterminal(\"ReturnType\",Hl),bl(79),Tl(260),Sl(),ps(),$l.endNonterminal(\"ReturnType\",Hl)}function bl(e){Bl==e?(Sl(),$l.terminal(i.TOKEN[Bl],jl,Fl>Ql?Ql:Fl),Pl=jl,Hl=Fl,Bl=Il,Bl!=0&&(jl=ql,Fl=Rl,Il=0)):Ll(jl,Fl,0,Bl,e)}function wl(e){Bl==e?(Pl=jl,Hl=Fl,Bl=Il,Bl!=0&&(jl=ql,Fl=Rl,Il=0)):Ll(jl,Fl,0,Bl,e)}function El(e){var t=Pl,n=Hl,r=Bl,i=jl,s=Fl;Bl=e,jl=Gl,Fl=Yl,Il=0,Ma(),Pl=t,Hl=n,Bl=r,Bl!=0&&(jl=i,Fl=s)}function Sl(){Hl!=jl&&(Pl=Hl,Hl=jl,$l.whitespace(Pl,Hl))}function xl(e){var t;for(;;){t=Ml(e);if(t!=22){if(t!=36)break;El(t)}}return t}function Tl(e){Bl==0&&(Bl=xl(e),jl=Gl,Fl=Yl)}function Nl(e){Il==0&&(Il=xl(e),ql=Gl,Rl=Yl),Dl=Il<<9|Bl}function Cl(e){Bl==0&&(Bl=Ml(e),jl=Gl,Fl=Yl)}function kl(e){Il==0&&(Il=Ml(e),ql=Gl,Rl=Yl),Dl=Il<<9|Bl}function Ll(e,t,n,r,i){throw t>zl&&(Ul=e,zl=t,Wl=n,Xl=r,Vl=i),new _l.ParseException(Ul,zl,Wl,Xl,Vl)}function Al(e,t,n){Jl[(t<<4)+e]=n}function Ol(e,t){var n=Jl[(t<<4)+e];return typeof n!=\"undefined\"?n:0}function Ml(e){var t=!1;Gl=Yl;var n=Yl,r=i.INITIAL[e],s=0;for(var o=r&4095;o!=0;){var u,a=n<Ql?Kl.charCodeAt(n):0;++n;if(a<128)u=i.MAP0[a];else if(a<55296){var f=a>>4;u=i.MAP1[(a&15)+i.MAP1[(f&31)+i.MAP1[f>>5]]]}else{if(a<56320){var f=n<Ql?Kl.charCodeAt(n):0;f>=56320&&f<57344&&(++n,a=((a&1023)<<10)+(f&1023)+65536,t=!0)}var l=0,c=5;for(var h=3;;h=c+l>>1){if(i.MAP2[h]>a)c=h-1;else{if(!(i.MAP2[6+h]<a)){u=i.MAP2[12+h];break}l=h+1}if(l>c){u=0;break}}}s=o;var p=(u<<12)+o-1;o=i.TRANSITION[(p&15)+i.TRANSITION[p>>4]],o>4095&&(r=o,o&=4095,Yl=n)}r>>=12;if(r==0){Yl=n-1;var f=Yl<Ql?Kl.charCodeAt(Yl):0;return f>=56320&&f<57344&&--Yl,Ll(Gl,Yl,s,-1,-1)}if(t)for(var d=r>>9;d>0;--d){--Yl;var f=Yl<Ql?Kl.charCodeAt(Yl):0;f>=56320&&f<57344&&--Yl}else Yl-=r>>9;return(r&511)-1}n(e,t);var _l=this;this.ParseException=function(e,t,n,r,i){var s=e,o=t,u=n,a=r,f=i;this.getBegin=function(){return s},this.getEnd=function(){return o},this.getState=function(){return u},this.getExpected=function(){return f},this.getOffending=function(){return a},this.getMessage=function(){return a<0?\"lexical analysis failed\":\"syntax error\"}},this.getInput=function(){return Kl},this.getOffendingToken=function(e){var t=e.getOffending();return t>=0?i.TOKEN[t]:null},this.getExpectedTokenSet=function(e){var t;return e.getExpected()<0?t=i.getTokenSet(-e.getState()):t=[i.TOKEN[e.getExpected()]],t},this.getErrorMessage=function(e){var t=this.getExpectedTokenSet(e),n=this.getOffendingToken(e),r=Kl.substring(0,e.getBegin()),i=r.split(\"\\n\"),s=i.length,o=i[s-1].length+1,u=e.getEnd()-e.getBegin();return e.getMessage()+(n==null?\"\":\", found \"+n)+\"\\nwhile expecting \"+(t.length==1?t[0]:\"[\"+t.join(\", \")+\"]\")+\"\\n\"+(u==0||n!=null?\"\":\"after successfully scanning \"+u+\" characters beginning \")+\"at line \"+s+\", column \"+o+\":\\n...\"+Kl.substring(e.getBegin(),Math.min(Kl.length,e.getBegin()+64))+\"...\"},this.parse_XQuery=function(){$l.startNonterminal(\"XQuery\",Hl),Tl(275),Sl(),s(),bl(25),$l.endNonterminal(\"XQuery\",Hl)};var Dl,Pl,Hl,Bl,jl,Fl,Il,ql,Rl,Ul,zl,Wl,Xl,Vl,$l,Jl,Kl,Ql,Gl,Yl};r.getTokenSet=function(e){var t=[],n=e<0?-e:INITIAL[e]&4095;for(var i=0;i<284;i+=32){var s=i,o=(i>>5)*3694+n-1,u=o>>1,a=u>>2,f=r.EXPECTED[(o&1)+r.EXPECTED[(u&3)+r.EXPECTED[(a&3)+r.EXPECTED[a>>2]]]];for(;f!=0;f>>>=1,++s)(f&1)!=0&&t.push(r.TOKEN[s])}return t},r.MAP0=[70,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,17,17,17,17,17,17,18,19,20,21,22,23,24,25,26,27,28,29,26,30,30,30,30,30,31,32,33,30,30,34,30,30,35,30,30,30,36,30,30,37,38,39,38,30,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,38,38],r.MAP1=[108,124,214,214,214,214,214,214,214,214,214,214,214,214,214,214,156,181,181,181,181,181,214,215,213,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,214,247,261,277,293,309,355,371,387,423,423,423,415,339,331,339,331,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,440,440,440,440,440,440,440,324,339,339,339,339,339,339,339,339,401,423,423,424,422,423,423,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,423,338,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,339,423,70,0,0,0,0,0,0,0,0,1,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,17,17,17,17,17,17,17,17,17,18,19,20,21,22,23,24,25,26,27,28,29,26,30,30,30,30,30,31,32,33,30,30,30,30,30,30,30,30,30,30,30,30,30,30,38,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,34,30,30,35,30,30,30,36,30,30,37,38,39,38,30,38,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,38,38,38,38,38,38,38,38,38,38,38,38,30,30,38,38,38,38,38,38,38,69,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,38,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69,69],r.MAP2=[57344,63744,64976,65008,65536,983040,63743,64975,65007,65533,983039,1114111,38,30,38,30,30,38],r.INITIAL=[1,12290,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287],r.TRANSITION=[42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,25651,25666,25670,25670,25670,18189,25670,25670,25670,25670,18201,25670,25670,25670,25670,18176,25670,25671,18217,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,18730,20976,20988,20999,21015,25420,18732,21040,42516,42516,42516,27632,42516,42516,51474,31122,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,21056,21084,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,23286,21107,42516,42516,42516,39416,42516,42516,43470,47286,25568,42516,42516,42516,42516,23672,41495,21126,21160,42516,42516,42516,27632,42516,42516,35938,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,25556,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21176,21248,42516,42516,42516,50595,42516,42516,42445,42516,25917,23619,21211,21279,21269,21226,21240,44419,21040,42516,42516,42516,27632,21302,42516,32247,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,19871,21321,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,21344,26008,18612,18632,18596,21349,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42510,42516,42516,42516,48894,42515,42516,51366,42516,21365,42504,21403,42515,21410,42516,27599,27612,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,21426,42516,42516,42516,22170,42516,42516,21445,42516,42516,21468,21481,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,24484,42516,42516,42516,42516,42516,42516,42517,21497,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,21513,25598,18486,18508,51408,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,25358,21538,42516,42516,42516,29996,42516,42516,26519,46446,25383,42516,42516,42516,42516,25736,28473,18232,21557,42516,42516,42516,27632,42516,42516,51474,21573,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,19060,21591,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,23074,23089,21619,21619,21619,21672,21614,21619,21624,23096,21640,21745,21688,21665,21655,21732,21703,21716,21040,42516,42516,42516,33326,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,21761,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,45317,42516,42516,42516,49458,21798,42516,22640,21804,25917,45316,42516,21821,21844,21828,21860,21869,21885,42516,42516,42516,29550,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,21901,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,21944,42516,42516,42516,48069,42516,42516,42516,26308,36543,25445,25454,21937,25455,21960,21985,21998,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,18888,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,26329,37275,42655,22014,22031,22014,22046,42653,22015,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,22071,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,26891,42516,42516,42516,48069,22092,42516,23653,22130,40293,22116,22186,22191,22191,22207,26888,44587,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,18247,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,35843,22232,22249,22232,22264,35841,22233,22289,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,46363,42516,33841,42516,34304,43899,22305,22071,36154,42516,42516,42516,42516,28243,22657,22322,22657,22657,22341,33347,46316,46316,39789,38147,35514,38147,38147,22359,22382,42516,42516,42516,42516,42516,28815,42516,22405,22426,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,47355,26569,42516,42516,42516,42516,42516,45225,42516,42516,32981,50880,22657,22657,22657,30360,22467,39622,46316,22501,46316,22343,36422,42625,38147,22520,38147,27826,41766,42516,42516,42516,42516,42516,49148,42516,23255,22657,44467,22657,22657,30361,22539,42077,46316,46316,46316,30525,38147,40186,38147,38147,34440,41769,42516,42516,20027,37487,42516,28242,22657,22657,36250,37745,46316,46316,44329,37798,38147,38147,43834,27827,30836,42516,42516,19405,22558,38368,22576,22657,40730,22597,46316,36583,22617,38147,40469,22638,42516,25905,42516,34153,22656,33064,46073,46316,22674,22710,27827,22690,51145,42516,32408,22729,37572,22752,32120,22683,29050,30609,22771,38961,22813,36803,22874,22893,22911,28238,43147,27775,22913,22451,22736,46400,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,50215,25917,42516,42516,42516,42516,42516,45715,23059,23112,42516,42516,42516,27632,42516,42516,37325,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,23128,46363,42516,42516,42516,34304,42516,42516,18360,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,22341,46316,46316,46316,39789,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,28815,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,23154,42516,42516,42516,46371,42516,42516,42516,42516,25917,35960,23175,23206,23195,23229,35959,23179,21040,42516,42516,42516,27632,42516,42516,51474,27227,42516,43023,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,23254,42516,42516,42516,48069,42516,42516,42516,19968,25917,42516,42516,42516,42516,42516,42762,23271,23302,42516,42516,42516,27632,42516,42516,21380,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,23318,46363,42516,42516,42516,34304,42516,42516,23344,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,22341,46316,46316,46316,39789,38147,38147,38147,38147,40896,23370,23409,42516,42516,42516,42516,38331,23429,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,23450,23383,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,50700,22540,46316,46316,46316,46316,47852,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,29796,22539,46316,46316,46316,46316,23533,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,48371,42516,42516,42516,31492,32078,42516,42516,23557,25917,18721,49121,23587,23594,23610,42516,43878,23635,23651,42516,42516,33439,23669,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,25038,24355,23991,25028,23804,18270,40105,18293,23688,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,23724,24084,23749,23789,24317,23827,23849,23904,24015,23917,23946,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,23969,24689,24310,25086,25092,23974,23990,24416,24845,24007,23833,24977,24993,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,24031,23930,24046,24073,24057,24100,24137,24664,24240,24198,24251,24225,24986,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,24267,24283,24299,24348,24333,24371,24167,24428,24402,23773,24444,24474,35639,19379,39467,19401,41728,19421,19500,24458,19544,24500,24558,24572,24588,24604,24182,24745,24620,24636,24767,19696,19712,19728,19753,19773,19830,19435,19514,24680,24514,19528,24705,24152,24757,19947,19984,20043,20080,20119,20157,20667,24542,24528,24731,24830,24209,24939,20235,20264,20301,24783,24799,24815,24715,24861,20381,20397,19814,23733,24877,24893,20503,25039,24968,23864,24927,24955,25015,20652,18443,23763,24386,25055,24651,25071,25108,25159,25175,25191,25243,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,27003,42516,42516,42516,48069,25296,42516,42516,25291,40518,25312,25320,25320,25320,25327,27168,25343,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25399,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,18963,25373,18652,18689,18711,18748,18695,25415,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,19337,25436,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,25471,25509,25525,20579,19301,19596,25541,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,25584,19614,19632,19650,25620,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,21541,28730,28739,28739,28739,28746,47533,25636,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,27653,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,25687,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51268,23158,42516,42516,42516,48069,42516,42516,42516,42516,25917,22795,25710,25710,25710,25717,23159,22797,21040,25733,42516,42516,27632,42516,42516,51474,42516,42516,44769,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,25752,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,26066,26075,42516,42516,42516,42907,42516,42516,42516,42516,25917,26405,25775,25775,25775,25782,28588,26407,25798,25814,42516,42516,27632,42516,42516,51474,42516,42516,23413,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,25831,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,25857,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,25891,42516,42516,42516,42516,48069,25942,42516,42516,28970,33768,42516,42516,42516,25933,25960,26180,25944,25980,42516,42516,42516,27632,42516,42516,51474,27927,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,25996,26028,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,42516,42516,42516,42516,42516,41865,26051,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,26178,42516,23255,22657,22657,22657,22657,22877,22539,46316,46316,46316,46316,32774,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,23464,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,22877,22539,46316,46316,46316,46316,32774,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,26196,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,22877,22539,46316,46316,46316,46316,32774,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,26115,26152,42516,42516,42516,42516,42516,26216,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,22877,22539,46316,46316,46316,46316,32774,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,31151,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,31154,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,22877,22539,46316,46316,46316,46316,32774,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,22786,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26258,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,48694,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,28605,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,47769,26274,26287,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,26303,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,26324,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,35004,26345,26373,26362,26396,35005,26346,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,37963,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,26423,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,42516,42516,42516,42516,42516,42516,42517,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,47727,42516,26460,26483,26467,42516,47735,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,26499,20264,20301,20317,20346,20333,20349,20365,26535,20397,20422,20606,20438,26551,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,29068,42516,42516,42516,51537,26585,26616,29663,26601,26633,26690,26699,26715,26730,26742,26758,26771,26099,19999,42516,26787,26162,26806,41856,26832,26883,26907,26946,30733,26962,26998,27019,27054,46783,31896,27070,46885,46348,36728,27120,42516,42516,34304,27137,37896,42516,27163,34995,39190,42516,27184,43650,22657,22657,22657,27203,27401,46316,46316,41985,48318,38147,38147,38147,37213,40896,22382,42516,27222,48046,42516,27243,27263,27280,42516,42516,27038,20763,27308,27328,22657,22657,27363,27386,27419,35266,46316,30482,27448,27495,27524,27566,38147,35889,38740,46095,27585,26152,27628,42516,45564,42516,47310,23487,42516,46936,27648,27669,27685,34339,22657,27729,22984,44673,27748,45967,46316,27773,39768,32782,27791,37607,38147,27824,22485,27843,27859,27882,27899,42516,27922,31758,27943,23255,33056,27962,22657,42185,33093,27982,30091,46316,35423,43042,32774,28017,38147,38147,42363,28033,23138,28062,40096,28115,41486,28137,21969,22956,28160,22657,46191,35558,28176,28197,32038,49740,47969,28214,27827,28233,42899,42516,21253,42516,38368,42934,43766,40730,37393,48025,36583,51021,44713,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,28260,28298,33550,28320,28341,28379,28401,28421,26921,40729,36585,44924,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,28445,42516,42516,51537,42516,42516,42516,42516,31409,28464,42516,28489,28496,28512,28528,28541,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,42942,46314,28557,30860,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,28583,23487,28604,45602,42516,42516,38368,22657,22657,22657,44648,28621,22541,46316,46316,46316,40008,44805,38147,38147,38147,38147,41449,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,35762,23510,42516,32305,42516,42516,28652,43395,23255,28671,22657,22657,22657,28690,28706,46316,46316,46316,37589,32774,28762,38147,38147,38147,44356,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,23013,26674,44310,41661,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,28784,42516,42516,51537,42516,28813,42516,28831,36313,28851,28860,28876,28891,28903,28919,28932,26099,42516,42516,33807,29427,42516,42516,28948,42516,28965,42516,42516,42516,25275,42516,28986,44283,46314,29021,22622,37863,32069,42516,29066,42516,34304,29084,49128,42516,45291,29103,36853,42516,39408,30216,37513,22657,22657,22657,29138,29162,46316,46316,48917,29187,29203,38147,38147,40896,22382,23471,42516,42516,37970,42516,41320,23487,39926,29222,42516,42516,38368,29257,38293,22657,29296,38374,29315,31567,38618,38779,46316,44805,42631,29346,29367,48610,38147,32923,26115,26152,42516,42516,35359,42516,36267,23487,42516,42516,42516,38370,22657,22657,38875,29587,30360,22540,46316,46316,49716,48753,22343,30533,38147,38147,47896,47206,27826,35762,29388,42516,42516,42516,29423,42516,29443,23255,22657,22657,22657,43545,22877,22539,46316,46316,49625,46316,32774,38147,38147,38147,29464,34440,41769,42516,42516,19074,42516,46902,29483,22657,45738,22657,46191,46316,28001,46316,32038,38147,48630,38147,27827,29518,29546,42516,39530,20864,38368,29566,29583,46250,46316,29603,36583,29623,29640,40469,42516,42516,42516,29661,38373,22657,29679,46316,51108,36586,38147,50541,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,29702,29722,29738,29754,28244,40729,36585,22448,28385,36584,34366,22755,31692,34720,29778,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,26790,42516,42516,51537,42516,29812,25227,42516,31450,29831,29840,29856,29871,29878,29894,29907,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,31072,31070,42516,32276,32283,40826,29686,35273,29923,34810,28721,42516,35352,29943,34304,42516,29968,36872,42516,42516,29988,30012,34471,30028,22581,34160,30064,24121,30107,48780,30128,30172,30191,29624,22523,47650,28217,40896,22382,42516,42516,42516,42735,42516,30232,23487,42516,42516,42516,27906,38368,22657,22657,22657,26867,38374,22541,46316,46316,46316,37425,44805,38147,38147,38147,38147,30252,50615,30272,30304,42516,42516,42516,30320,30338,23487,42516,42516,27104,21782,30358,30377,22657,22657,30395,30434,30481,30498,46316,46316,30515,51071,30551,30568,38147,38147,30585,35762,23510,42516,42516,42516,42516,42516,30625,23255,30648,22657,22657,30668,22877,30687,46316,46316,34855,46316,32837,38147,38147,43217,38147,34440,41769,45029,42516,30729,42516,21024,28242,29299,22657,30749,46191,50174,46316,30776,32038,38147,30812,48472,27827,22690,23708,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,37071,42516,42516,38373,22657,31523,46316,43307,36586,38147,39352,22690,34920,42516,38372,43148,46316,38137,38147,30829,36804,38368,28385,28404,30535,27085,28354,31634,30852,30600,30074,38197,42103,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,21805,30876,42516,51537,49762,30895,42516,30918,43094,30942,30951,30967,30982,30994,31010,31023,26099,42516,31039,39573,31055,20844,31088,31151,40795,31438,31118,31138,31170,31208,31224,31259,31325,39316,31341,31357,42305,39859,31243,31397,39944,31425,33906,31466,31484,36903,42516,42516,38844,42516,28243,31508,40831,43064,26242,31546,31583,49551,32501,35578,43001,31607,35023,30465,31623,22382,40777,39e3,31658,40711,31716,41838,31747,42230,41234,31783,31813,31829,31873,31912,31936,31952,31988,32019,35868,32054,38034,47598,32094,32110,32136,39813,32152,32186,47170,32233,26152,32263,42516,49503,42516,32299,32321,32337,32365,32386,32406,32424,22657,35078,32463,30760,22540,32487,46316,47681,50971,43200,30533,32517,38147,37625,38481,40265,32560,23510,18666,32576,32596,39698,32624,37664,32645,31965,32706,47478,32693,32731,32762,40433,46316,32798,32825,32774,32853,32872,49013,32893,32919,41769,42516,21429,46706,42516,42516,32939,25143,43551,27695,46191,47568,50517,33128,32038,44391,37914,44027,27827,22690,51501,22158,32960,23571,32997,33045,33080,33109,33144,33160,33196,33225,33259,33289,25257,41794,33305,33321,22943,47433,44826,33342,33363,33392,45913,37247,22690,23238,33434,38372,47456,46316,49977,38147,33455,33478,32944,28385,33515,33536,30206,38372,33571,38971,31372,39304,33587,33611,33627,33643,33674,33720,28385,36584,33273,33742,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,33784,42516,51537,33805,33823,29972,43389,33866,33897,42516,33882,33940,33947,33963,33976,26099,42516,42516,20279,27632,42516,42516,42516,42516,42516,41269,42516,41261,42516,41268,25123,41628,38176,37400,33992,34810,28721,42516,34012,42516,34304,34012,42516,42516,42516,34029,34013,37295,42516,28243,34045,22657,22657,22657,34069,34103,46316,46316,48318,47159,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,23487,42516,42516,45931,42516,38368,22657,22657,22657,44213,38374,22541,46316,46316,46316,42968,44805,38147,38147,38147,38147,34120,32923,26115,26152,42516,42516,42516,42516,42516,23487,42516,46602,42516,38370,22657,22657,30041,22657,30360,22540,46316,46316,42268,46316,22343,30533,38147,38147,44e3,38147,27826,35762,23510,42516,42516,42516,42516,42516,39273,23255,22657,22657,22657,37139,22877,22539,46316,46316,49643,46316,32774,38147,38147,38147,48815,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,46191,46316,46316,46316,32038,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,46733,42516,42516,42516,36647,22657,28384,27995,46316,49984,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,44874,43254,31692,29762,34139,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,38852,42516,42516,51280,34176,34185,34201,34208,34215,34231,34244,26099,42516,42516,42516,27632,42516,42516,34401,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,37878,42057,42516,42516,34304,42516,42516,42516,42516,34260,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,34278,42516,28081,38368,22657,22657,22657,22657,38374,42076,46316,46316,46316,46316,46212,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,47761,42516,34299,19108,42516,42516,19113,34320,22657,22657,34338,22657,30360,22540,46316,34104,46316,46316,22343,30533,38147,42837,38147,38147,27826,34355,42516,42516,42516,34399,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,38663,42516,34417,28242,22657,22657,38760,37745,46316,46316,50996,37798,38147,38147,38147,34438,22690,34456,18364,34487,34538,24114,31309,31274,34559,34565,27432,34581,44559,30458,34604,22076,42516,19757,34657,29792,34679,47804,33555,31559,34736,35451,34758,22690,41150,39051,35676,32439,38610,34776,34795,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,34833,34871,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,18277,42516,42516,34899,42516,42516,42516,36062,42516,36065,42516,42516,34947,34936,36697,22657,34963,27757,38148,48007,34986,42516,42516,29815,34304,21387,19116,42516,38636,42516,42516,42516,42516,28243,22657,22657,43325,22657,27401,46316,46316,30705,48318,38147,38147,38147,35021,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,35376,42516,35039,38368,22657,22657,22657,22657,50945,22541,46316,46316,46316,46316,38717,38147,38147,38147,38147,38147,41757,22444,42516,35059,42516,42516,42516,42516,42516,42516,42516,39196,38370,35077,22657,22657,22657,30360,46821,46316,46316,46316,46316,22343,23541,38147,38147,38147,38147,27826,41766,42516,42516,42516,50318,42516,42516,42516,23255,22657,22657,22657,46040,30361,22539,46316,46316,46316,34080,30525,38147,38147,38147,42204,34440,41769,42516,42516,46608,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,23434,42516,22428,38373,22657,28384,46316,46316,36586,38147,27827,35094,34920,22560,38372,50497,46316,40393,38147,43581,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,44978,42516,51537,30322,33499,42482,50012,50022,18763,18772,35115,35131,35143,35159,35172,26099,42516,42516,42516,36498,41847,42516,42516,42516,31671,41803,35188,36161,35205,35221,43491,35237,35256,29171,35289,37464,35305,42516,42516,42516,35339,42516,28090,35375,42516,42516,28949,35314,39266,28243,48989,48108,22657,35392,47509,37433,35422,34970,35439,27808,35467,38147,35501,35536,22382,42516,35594,39908,48509,34515,35614,42516,18299,18417,42516,35655,35672,48116,22657,43129,29280,37184,22541,48019,46316,38117,35692,47637,38147,35719,38147,35737,27472,35753,22444,42516,42516,42516,42516,35778,48535,35820,42516,42516,42516,23024,36244,22657,22657,29502,38418,35859,41980,46316,46316,48733,41934,49389,35884,38147,38147,40673,49832,35905,42516,36909,35924,35976,35997,18673,36033,34522,36081,47410,36098,36117,36141,36177,46316,36198,32809,43953,30446,38147,43626,42012,36214,36230,23328,20636,45205,36266,36283,36301,35981,36329,26662,46771,36350,36390,48253,35703,36411,36456,40231,38454,41461,37653,42516,42516,37028,36479,40577,43121,45398,22366,37772,48725,38205,36432,50457,40469,42516,25485,42516,36514,38373,22657,28384,46316,46316,36586,38147,27827,36626,36531,42516,28996,31885,36559,36579,36602,36619,36804,36642,28385,28404,30535,42423,49897,44263,36663,36694,43147,27775,22913,28244,40729,36585,22448,36713,36744,34366,22755,31692,28429,36774,36790,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,39935,42516,51537,42516,42516,42516,42516,25917,42516,29952,39942,19158,38671,36820,36833,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,44206,22657,27401,46316,46317,46316,48318,38147,38147,34588,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,19484,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,36849,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,36869,42516,42516,42516,42516,42516,42516,42516,42516,46294,22657,22657,22657,22657,30360,49232,46316,46316,46316,46316,22343,30796,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,46996,42516,51537,42516,23354,42516,42753,36888,36925,36938,36954,36961,36977,36993,37006,26099,42516,37022,42516,27632,42516,41516,26816,42516,42516,37044,42516,37049,18537,37065,37087,37117,44086,37200,37235,39844,33658,37263,42516,42516,35791,42516,42516,34914,28072,42516,37291,22389,37311,18926,37716,37348,43712,48153,37366,37382,46316,37416,40607,40193,49587,35520,37449,27508,37480,37934,42516,42516,42516,42516,41144,42516,42516,42516,42516,42516,38368,37503,36125,22657,37529,39594,37550,37566,48265,46316,37588,30713,29645,37605,37623,38799,38147,37641,22444,42516,42516,37688,42516,42516,49494,24999,42516,42516,42516,38370,22657,22657,29494,37704,37740,22540,46316,46316,40001,37761,37795,30533,38147,38147,37825,37814,37848,41766,42516,37894,42516,42516,51139,42516,42516,23255,22657,41398,22657,22657,30361,22539,42274,46316,46316,46316,30525,38147,37912,38147,38147,34440,41769,37930,36490,42516,34663,37950,28242,37986,22657,22657,46812,38013,46316,46316,45485,49261,38147,38147,48821,22690,49311,42516,42516,38050,38368,41404,22657,40730,47057,46316,36583,48937,38147,40469,42516,21575,42516,42516,38373,22657,38069,46316,45780,36586,38147,40463,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,38089,46273,22694,23034,40134,34366,22755,38105,38164,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,26200,42516,51537,42516,27946,42516,42516,47834,20951,20960,38221,38236,38243,38259,38272,26258,42516,38551,42516,27632,42516,34262,42516,42516,42516,38553,42516,38546,21091,38552,21774,38288,31700,35273,38309,34810,28721,42516,42516,38329,34304,42516,29241,23811,23953,42516,42516,42516,38347,38364,33022,22657,38390,38410,28636,46316,29607,39628,38434,42370,38147,48603,38470,47663,38504,38541,39253,39681,42516,42516,42516,42516,41197,42516,42516,42516,38368,31857,22657,38569,22657,38374,22541,38589,28198,46316,46316,44805,29206,27800,32877,38147,38147,32923,22444,42516,28144,42516,38634,42516,45188,42516,38652,42516,42516,38370,39723,22657,22657,38687,30379,22540,23043,46316,46316,38710,22895,30533,49398,38147,38147,38733,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,33462,42516,42516,42516,42516,38368,38756,22657,40730,38776,46316,36583,38795,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,38815,36586,49663,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,49485,38368,44256,40047,45820,38834,38868,32210,38891,28238,43147,27775,22913,28244,40729,36585,22448,28385,38914,38935,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,27187,42516,30926,42516,34543,38987,37672,39016,39067,39107,39092,39111,39076,39127,39140,26099,42516,25841,23701,20829,39222,20009,42516,39156,41252,39175,39212,32746,21195,39238,26847,39289,45668,39332,39368,34810,28721,32390,42516,42516,26444,30879,36010,28099,40787,39398,38525,26035,39432,39483,44460,39503,41633,22657,32003,22601,46316,49709,48318,47976,47889,30552,38147,33209,39523,39917,39159,42516,39546,42516,42516,40976,42516,42516,42516,39568,39487,37157,22657,39589,22657,38374,39610,45436,46316,39644,46316,44805,27542,39661,38313,38147,38147,32923,22444,42516,42516,42516,42516,30632,42516,42516,21187,39678,39697,39714,22657,22657,50559,22657,39739,39760,46316,46316,38818,46316,39784,39805,38147,38147,32856,38147,39829,41766,46006,39893,48391,49682,42516,39960,34641,39976,38394,40024,37997,33010,30361,22539,40063,40121,43817,40157,30525,40868,40175,40209,40247,34760,44916,20285,40281,34623,40309,51090,50324,48429,40325,40344,40364,39645,40409,40428,40449,38147,40485,49825,39382,22690,40506,42516,42516,22216,40534,39507,48098,30083,50926,38024,33595,45640,28567,40469,40559,42516,40087,26129,45371,31289,28384,40593,41927,40637,40665,40689,34614,41203,40707,27312,43148,48295,28405,40861,22683,50287,38368,40727,40746,40649,40767,40811,22827,40847,33407,49334,48207,33243,28244,40729,36585,22448,28385,36584,41673,40884,31692,28429,22929,40922,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,40951,51537,42516,42744,40972,42516,27292,40992,41001,41017,41032,41039,41055,41068,26099,20248,41084,41102,41129,21286,41166,42516,41182,41219,41286,31731,41302,41336,41352,41368,41384,34883,41420,41436,48349,41477,42516,42240,27121,34422,42516,41511,25267,41532,41575,42516,42516,41594,28243,22657,31843,41613,34053,27401,40159,35568,34847,41649,38147,27550,41689,41744,40896,22382,42516,26380,42516,41578,42516,44762,41785,42516,41828,27866,41270,19255,22657,41881,41897,22657,35406,41916,43971,44095,46316,46316,41950,22851,37219,42001,38147,29467,32923,42028,42044,42516,46644,19385,42516,42516,42516,42516,42516,34632,38370,22657,27339,43920,22657,30360,22540,46316,44514,36395,46316,22343,30533,38147,35478,49592,38147,27826,41766,42516,42516,21305,42516,31235,42516,42516,23255,22657,22657,22657,22657,20064,42074,46316,46316,46316,46316,42093,38147,38147,38147,38147,50734,41769,50664,35952,42516,42516,42516,41113,22657,42177,22657,45759,46316,43945,46316,45799,38147,45843,38147,27827,29041,42127,42516,42516,42516,48412,30671,22657,38073,44692,46316,33520,45533,38147,40469,42146,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,43588,34920,42516,42166,40348,33173,48271,42201,22683,42220,41559,42256,42290,42321,33756,44448,35547,42352,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,32531,22755,42386,28429,22929,42410,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,39045,51537,42516,42516,42439,19363,42461,42498,42516,31468,42533,42547,42563,42576,26099,42516,42516,25867,27632,42516,42516,42516,42592,26617,42516,42516,26436,25867,42516,30236,31920,49620,42612,36440,34810,28721,42516,42647,42516,34304,42516,44608,36046,42516,35598,42516,42516,36057,51481,44194,32471,36334,37148,42671,32033,42687,33121,42706,38488,30256,30569,29372,32199,42722,42778,42516,42799,42516,49524,50043,35835,42516,42516,42516,42516,38368,22657,22657,37175,22657,38374,22541,46316,46316,47563,46316,44805,38147,38147,38147,42836,38147,32923,42853,42888,35656,42516,42516,42516,50763,30902,39460,48700,42516,38370,22657,42923,22657,22657,37350,22540,46316,42958,46316,46316,27403,30533,38147,42991,38147,38147,27826,41766,42516,29233,42516,42516,42516,43017,42516,23255,22657,22657,49093,22657,22325,22539,46316,46316,43039,46316,30788,38147,38147,35485,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,36017,42516,42516,43058,22657,22657,40730,46316,46316,36583,38147,38147,48843,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,46409,43080,43110,32715,30112,30535,40935,43145,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,35061,42516,42516,42516,28279,28282,18254,28275,31684,43164,43182,29146,43216,43233,29330,43270,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,43287,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,43306,46316,46316,46316,46316,50852,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,43323,28384,43789,46316,36586,43341,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,50278,22100,42516,42516,50243,42516,29530,43375,33789,43361,43411,43418,43434,43447,26099,42516,33915,33924,27632,40956,43463,43486,41243,43507,26512,26972,26982,27147,41812,42783,43531,49966,43567,43604,44058,40078,42516,42516,42516,23213,43642,34502,43666,43684,38517,42516,42516,35323,43702,22657,43728,30048,43746,43782,42975,46316,43805,34708,43833,43850,27569,49274,49874,43871,42516,42516,42516,45270,35189,42516,42516,43894,43668,42516,42814,33726,22657,43915,22657,37724,49041,43936,46316,43969,46316,45680,43987,44022,33996,38147,38147,44043,44074,22444,42516,42516,19081,42516,44111,44127,42516,43290,44154,44166,44182,22657,37101,44229,44279,30652,44299,46316,42336,45461,44326,40412,44345,38147,44372,45987,44388,34123,41766,28121,42516,42516,24911,44407,50085,42516,44435,27732,44483,22975,22657,30361,22539,44504,42690,46316,46316,30525,28768,44537,44554,38147,40691,44575,42516,44603,44624,42516,42516,28242,44645,22657,22657,44664,44689,46316,46316,49378,44708,38147,38147,49798,22690,42516,44729,42516,42516,20056,22657,22657,34376,46316,51047,22477,38147,44538,40469,42516,22273,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,44749,26230,34694,49922,44785,36803,38372,46315,38146,47702,44821,44842,44862,21913,40729,36585,22448,28385,36584,40621,44890,44940,42111,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,46959,51537,45028,47264,44964,45002,45045,45083,45015,45108,45123,45139,45155,45168,26099,45184,28448,42516,28797,42516,42516,30342,42516,42516,45204,45221,31185,28655,31192,26648,48147,38948,50978,45241,34810,28721,45262,45286,25875,34304,35804,42516,42516,42516,42516,45307,45333,42516,45362,45387,27370,22657,22657,45422,45457,45477,46316,48318,45501,22713,45531,38147,40896,22382,41086,42516,42516,45549,45580,42516,42516,42516,42516,42516,41312,38368,32670,37166,22657,22657,33029,22541,45618,47052,46316,46316,45690,35721,38147,45637,38147,38147,45656,22444,42516,42516,45593,44733,42516,45600,35835,45706,27030,38348,45731,22657,22657,40543,26861,45754,45775,46316,46316,43191,44800,45796,45815,38147,38147,40256,45836,45859,28046,42867,49429,42516,25220,42516,19477,43271,20461,22657,22657,27347,45890,30361,22539,46316,48577,44521,46316,30525,38147,38147,46850,45910,34440,41769,42516,50831,45929,19737,42516,28242,22657,45947,43759,50887,46316,45965,46065,28181,38147,45983,46857,27827,22690,42516,42516,46003,44138,38368,22657,22657,40730,46316,46316,36583,38147,38147,29031,51383,46022,26136,47337,46039,22657,46056,46316,34383,36586,38147,46089,46111,34920,46149,46173,43148,46207,44846,46228,32903,36804,38368,46247,46266,45515,36803,38372,46315,38146,35099,35240,22504,22913,46289,46310,46333,36758,46387,47879,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,27247,51537,42516,42516,23393,42516,46425,46462,46474,46490,46505,46521,46537,46550,26099,46566,25493,25815,46587,26561,21328,46624,21598,42516,46636,46660,46669,46685,46722,46757,46799,32544,46837,46873,41704,47524,33832,37332,35627,34304,46901,42516,44629,46918,39031,46952,46975,47012,47022,48184,31972,27713,43730,47038,31642,47073,47098,47607,47121,47145,47186,47202,47222,47250,47280,47302,42058,42516,47326,47353,42516,42516,47371,47388,46928,47404,47426,47449,47472,29567,47494,47549,47584,47623,47679,36182,44805,36463,37832,40141,38147,32161,32170,47697,42516,45060,42596,50682,47718,42130,47751,46440,36515,21144,38370,47785,29270,22657,44488,47820,47850,47868,40376,46316,45441,47912,47938,47958,43617,38147,38919,47992,41766,29407,48041,42516,27096,48062,42516,50062,40568,48085,38573,48132,48169,30361,48200,48223,48241,48287,48311,47922,47129,22858,48334,43855,34440,40906,48365,50193,42516,22144,48387,48407,44243,48428,22657,49223,47234,48445,46316,47082,50795,48488,38147,33704,22690,42516,48504,48525,42516,20103,22966,48559,32447,40385,48575,48593,50156,48626,48646,48680,42516,33850,39552,21921,26930,48716,48749,48769,48802,45246,48837,48960,48859,48887,32658,28363,48910,33376,48933,48953,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,45621,46231,48976,39991,49005,49029,40039,49057,44903,22755,31692,28429,49073,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,49109,42516,42516,49144,42516,32608,18328,18337,49164,18337,18344,49180,49193,26099,42516,42516,42516,27632,20863,28835,42516,42516,42516,42516,28834,42516,20857,42516,28241,49209,31530,22841,49248,36678,30143,33493,42516,42516,34304,42516,42516,35043,49290,42516,42516,42516,38053,28243,49327,22657,22657,22658,49350,46316,46316,46316,31591,33687,38147,38147,38147,49366,49414,49451,42516,49474,49519,42516,42516,43686,45346,42516,46571,46157,38368,45949,40328,45406,25137,29005,22541,48786,34087,38601,49540,48459,38147,33697,39345,49573,33236,49608,22444,42516,19180,42516,50588,42516,42516,42516,18791,42516,42516,38370,38694,22657,22657,22657,30360,49641,32217,46316,46316,46316,22343,49659,38898,38147,38147,38147,27826,41766,46990,42516,49679,42516,42516,42516,42516,20094,31303,22657,22657,22657,30361,49698,46316,46316,46316,46316,30525,49732,38147,38147,38147,34440,35908,42516,42516,46023,49756,42516,29706,37130,22657,22657,39744,38128,46316,46316,49778,49814,38147,38147,49848,22690,22055,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,34322,43148,47105,28405,38446,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,49890,49913,49938,22448,28385,36584,34366,34779,33418,49954,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,5e4,50082,50038,50059,42516,32349,42516,20487,50078,34283,44986,50101,50114,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,50130,42394,35273,50148,34810,28721,42516,36285,32580,34304,42516,42516,42516,42516,42516,25759,42516,42516,28243,27704,22657,37534,22657,27401,50172,46316,38188,48318,29351,38147,30813,38147,40896,22382,42516,42516,42516,42516,42516,41597,42516,42516,42516,42476,42516,38368,22657,50132,22657,22657,38374,22541,46316,49557,46316,46316,44805,38147,38147,50449,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,50190,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,50209,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,50231,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,50266,42516,22306,42516,45067,50303,50340,42516,50365,50380,50394,50410,50423,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,45894,46314,50439,28325,41965,36365,42516,42516,42516,34304,42516,42516,42516,42516,25694,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,50473,42516,42516,42516,50491,22657,22657,22657,22657,30360,50513,46316,46316,46316,46316,22343,50533,38147,38147,38147,38147,27826,41766,42516,42516,29399,42516,42516,42516,42516,23255,22657,22657,50557,22657,50575,22539,46316,43245,46316,33180,30525,38147,47942,38147,38147,50611,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,26324,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,48543,50631,50644,26099,42516,42516,42516,27632,50660,42516,50680,42516,42516,42516,29122,42516,21452,29118,32973,50698,44948,35273,50716,34810,28721,42516,42516,42516,50750,27264,27883,43515,42516,42516,42516,42516,42516,28243,22657,43166,22657,49088,27401,46316,30696,30175,48318,38147,38147,50786,27533,40896,50811,50827,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,51530,42516,42516,42516,38370,22657,27966,22657,22657,27206,22540,46316,36563,46316,46316,48225,30533,38147,43345,38147,38147,27826,41766,21110,42516,42516,42516,42516,42516,42516,23255,36082,22657,22657,22657,30361,22539,50847,46316,46316,46316,30525,40490,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,42516,42516,42516,42516,46741,49861,51029,26099,24903,42516,42516,27632,42516,42516,20017,42516,42516,42516,42516,20023,42516,42516,50868,36101,46314,27462,29927,45874,41719,42516,29087,42516,34304,42516,42516,42516,42516,42516,42516,42516,42872,28243,22657,22657,22657,47797,27401,46316,46316,22542,48318,38147,38147,38147,27479,40896,22382,42516,50903,42516,42516,42516,42516,42516,42516,42150,42516,42516,38368,46183,22657,41900,22657,38374,22541,50922,46316,37779,46316,44805,36603,38147,38147,40222,38147,32923,22444,42516,50475,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,50942,22657,22657,30360,50961,30499,50994,46316,46316,22343,49789,39662,51012,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,48664,23255,22657,22657,32677,22657,28304,22539,46316,46316,51045,46316,51063,38147,38147,50725,38147,44006,41769,42516,42516,50906,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,48656,42516,42516,47372,42516,31381,22657,22657,34817,46316,46316,40751,38147,38147,40469,42516,42516,51087,42516,38373,28681,28384,46316,51106,36586,34742,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,51361,42516,42516,42516,42516,51537,42516,42516,42516,42516,25917,19962,42516,42516,42516,46741,49861,51029,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,28721,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,27401,46316,46316,46316,48318,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,46123,30288,30286,49299,30156,51124,22408,22410,49308,30152,46133,51161,51174,21040,42516,42516,42516,27632,42516,42516,31797,42516,42516,42516,42516,42516,42516,42516,32629,20505,20792,18990,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,51190,25598,18486,18508,19308,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,30409,42516,25917,39868,39877,51215,51230,51237,29448,51253,21040,42516,42516,42516,27632,42516,42516,51474,42516,42516,42516,23517,42516,42516,23514,32629,20505,21066,18953,21068,18866,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,18459,25598,18486,18508,51199,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,36374,42516,42516,42516,42516,31102,50349,51296,51323,51307,51330,32370,51346,21040,42516,42516,42516,27632,42516,42516,51474,51382,42516,26083,42516,42516,42516,26079,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,18315,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,51399,25598,18486,18508,21522,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,20235,20264,20301,20317,20346,20333,20349,20365,20381,20397,20422,20606,20438,20477,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,21141,42516,42516,42516,42516,48069,42516,42516,42516,42516,25917,42516,42516,42516,42516,42516,42516,42517,26099,42516,42516,42516,27632,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,28241,22657,46314,35273,38147,34810,46363,42516,42516,42516,34304,42516,42516,42516,42516,42516,42516,42516,42516,28243,22657,22657,22657,22657,22341,46316,46316,46316,39789,38147,38147,38147,38147,40896,22382,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38368,22657,22657,22657,22657,38374,22541,46316,46316,46316,46316,44805,38147,38147,38147,38147,38147,32923,22444,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,38370,22657,22657,22657,22657,30360,22540,46316,46316,46316,46316,22343,30533,38147,38147,38147,38147,27826,41766,42516,42516,42516,42516,42516,42516,42516,23255,22657,22657,22657,22657,30361,22539,46316,46316,46316,46316,30525,38147,38147,38147,38147,34440,41769,42516,42516,42516,42516,42516,28242,22657,22657,22657,37745,46316,46316,46316,37798,38147,38147,38147,27827,22690,42516,42516,42516,42516,38368,22657,22657,40730,46316,46316,36583,38147,38147,40469,42516,42516,42516,42516,38373,22657,28384,46316,46316,36586,38147,27827,22690,34920,42516,38372,43148,46316,28405,38147,22683,36804,38368,28385,28404,30535,36803,38372,46315,38146,28238,43147,27775,22913,28244,40729,36585,22448,28385,36584,34366,22755,31692,28429,22929,23e3,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,23494,42516,42516,45092,51424,51429,51429,51451,23492,51445,51467,42516,42516,42516,42516,42516,42516,51474,42516,42516,42516,42516,42516,42516,42516,32629,20505,21066,18953,21068,19019,18919,18270,40105,18293,51497,42516,42516,18360,42516,49435,42820,18380,18411,18395,18574,19226,18433,20169,51190,25598,18486,18508,19308,18465,25604,18492,18514,20728,18530,42516,30418,42516,42516,42516,50250,25964,50770,42516,18553,39446,18564,20175,20411,20131,20505,23879,18590,26008,18612,18632,18596,18470,18594,26012,18616,18636,20798,20741,20757,42516,18652,18689,18711,18748,18695,18788,42516,41546,48871,18807,18835,19802,18823,19840,25206,18851,18904,18942,18979,19680,19006,18851,18904,18942,18979,19680,19045,20750,46697,19097,19132,20936,31767,19148,19174,19196,20141,20921,19788,19212,19242,19278,25525,20579,19301,19596,19271,25518,20572,19294,19589,19324,19353,35639,19379,39467,19401,41728,19421,19500,24458,19544,19575,19614,19632,19650,19559,19612,19630,19648,19666,19029,19696,19712,19728,19753,19773,19830,19435,19449,19888,19905,19856,19887,19904,19921,19947,19984,20043,20080,20119,20157,20536,20191,20213,20542,20197,20219,19931,51517,20264,20301,20317,20346,20333,20349,20365,51553,20397,20422,20606,20438,20453,20503,21067,21068,20521,20558,20595,20622,20652,23888,18878,20683,20699,20715,20779,20814,20880,20890,20906,19463,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,42516,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,0,94506,90409,94506,94506,94506,94506,94506,94506,94506,94506,94506,365,94506,90409,94506,94506,94506,94506,94506,94506,94506,69632,73728,94506,94506,94506,94506,94506,65536,94506,12290,3,0,0,2183168,0,0,0,90409,94506,299,300,0,2134016,303,304,304,304,304,304,304,304,0,0,0,0,0,304,0,304,1,289,3,0,0,0,295,0,0,0,0,0,0,0,0,0,0,796,0,796,0,0,0,0,0,2424832,2433024,0,0,2457600,0,0,0,0,0,0,0,0,0,0,650,0,0,0,0,0,0,0,0,0,2904064,2908160,0,0,0,0,0,0,0,0,0,0,0,1685,1686,0,1688,0,0,0,0,3117056,0,0,0,0,0,0,0,365,365,0,0,0,0,0,0,448,0,0,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,474,559,582,559,582,559,559,582,0,0,0,2138112,0,0,0,0,0,0,0,0,0,0,0,0,0,2991,0,0,0,2772992,2805760,2830336,0,2863104,2920448,0,0,0,0,0,0,0,2805760,2920448,0,0,0,0,0,0,0,2732032,0,2179072,2179072,2179072,2179072,2424832,2433024,0,0,0,0,0,2920448,0,0,0,0,0,0,0,0,0,0,0,1702,0,1704,0,0,2179072,2830336,2179072,2179072,2863104,2179072,2179072,2179072,2179072,2920448,2179072,2179072,2179072,2179072,2179072,2179072,2126737,2126737,2126737,2126737,2126737,2593681,2126737,2126737,2126737,2126737,0,914,2125824,2125824,2125824,2125824,2125824,2424832,2433024,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,2125824,2125824,2125824,2125824,2723840,2125824,2732032,2772992,2125824,2125824,2125824,2805760,2125824,2830336,2125824,2125824,2863104,2125824,2125824,2125824,2125824,2920448,2125824,2125824,2125824,2125824,2125824,2920448,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3117056,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2457600,2125824,2125824,2125824,2125824,2183168,0,0,0,0,0,0,0,0,0,0,661,0,661,0,0,0,2408448,0,0,2584576,0,0,0,0,2838528,0,0,2838528,0,0,0,0,0,2179072,2179072,2179072,2408448,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2625536,2179072,2179072,0,2125824,2125824,2125824,2408448,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3125248,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2662400,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2801664,2813952,2125824,2125824,2801664,2813952,2125824,2838528,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2461696,0,0,0,0,0,0,0,0,0,0,0,0,2600960,0,0,0,0,0,0,2441,0,0,0,0,0,0,0,0,0,0,2493,2494,0,0,2497,0,2768896,2777088,2781184,0,2822144,0,0,2883584,0,0,0,0,0,0,0,0,0,0,0,0,3055616,0,0,0,3080192,3100672,3104768,0,0,0,0,3186688,0,0,0,0,0,0,0,307,204800,0,0,0,0,0,0,0,0,0,111051,111051,111051,111051,111051,111051,111051,111051,1,0,0,0,0,0,2797568,0,0,0,0,0,0,0,2850816,2867200,0,0,0,0,0,441,0,0,332,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,468,0,0,3133440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2131,0,0,0,0,0,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2461696,2465792,2179072,2768896,2777088,2781184,2797568,2822144,2179072,2179072,2179072,2883584,2179072,2912256,2179072,2179072,2179072,2179072,2179072,2179072,2523136,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2600960,0,0,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2461696,2465792,2125824,0,1142784,0,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2592768,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,24576,988,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2523136,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2600960,2125824,0,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,541,1272,541,541,541,541,2125824,2125824,2125824,2641920,2125824,2125824,2125824,2125824,2125824,2125824,2719744,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,2125824,2125824,2125824,2125824,2125824,2125824,299,0,0,0,299,0,300,0,0,0,2768896,2777088,2781184,2797568,2822144,2125824,2125824,2125824,2883584,2125824,2912256,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,2125824,2126812,2125824,2125824,2125824,2125824,2125824,2125824,3133440,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3207168,2125824,0,0,0,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,0,0,0,0,0,0,2510848,2514944,0,0,2125824,2125824,3133440,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3207168,2125824,2179072,2125824,0,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,300,0,0,0,0,0,0,2764,0,0,0,0,0,0,0,0,0,0,2059,2060,0,2062,2063,0,0,0,0,2605056,0,0,0,0,2887680,0,2924544,0,0,0,0,0,0,0,2108,0,0,0,0,0,0,0,0,0,0,0,0,0,1177,0,0,0,0,0,0,3162112,3170304,0,0,3219456,3035136,0,0,0,0,0,3072e3,3190784,0,0,0,0,0,0,0,0,2576384,0,0,0,0,0,0,0,334,0,0,334,0,0,334,0,0,0,0,0,0,0,2387968,0,0,0,0,0,0,0,0,0,0,0,2050,0,0,0,0,3121152,3141632,0,0,0,2924544,0,2682880,0,0,0,0,0,0,3112960,2387968,2924544,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3035136,2179072,2179072,3072e3,2179072,2179072,2179072,2179072,2699264,2179072,2715648,2179072,2723840,2179072,2732032,2772992,2179072,2179072,2179072,2805760,3121152,2179072,2179072,3141632,2179072,2179072,2179072,3170304,2179072,2179072,3190784,3194880,2179072,0,0,0,0,0,0,541,1734,541,541,541,541,541,541,1740,541,2125824,3190784,3194880,2125824,0,0,0,0,0,0,2387968,2125824,2125824,2125824,2420736,2125824,2125824,2125824,2125824,2125824,2453504,2125824,2473984,2125824,2736128,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2887680,2125824,2125824,2924544,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,0,2125824,2125824,2125824,2125824,2125824,3141632,2125824,2125824,2125824,3170304,2125824,2125824,3190784,3194880,2125824,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,299,0,300,3112960,3219456,2125824,2125824,3112960,3219456,2125824,2125824,3112960,3219456,0,0,0,0,0,0,0,347,0,405,0,0,0,0,0,405,3022848,0,0,3145728,0,3203072,0,0,0,0,0,0,0,0,0,0,0,2072,0,0,0,0,0,0,0,3067904,0,0,0,0,0,0,0,0,0,0,0,0,0,3003,0,0,0,0,0,2621440,0,3182592,2899968,0,2961408,0,0,2179072,2179072,2416640,2179072,2179072,2179072,2179072,2928640,2179072,2179072,2179072,2998272,2179072,2179072,2179072,2179072,3059712,2179072,2179072,2179072,2179072,3178496,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2494464,2125824,2125824,0,2179072,2125824,2125824,0,2179072,2125824,2125824,2985984,2985984,2985984,2985984,0,0,0,0,0,0,2490,0,0,0,0,0,0,0,0,0,335,0,0,0,0,0,0,2179072,2445312,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2551808,2179072,2179072,2179072,2179072,3178496,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2495377,2126737,2126737,2126737,2126737,2126737,3179409,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2495451,2126811,2895872,2916352,2179072,2179072,2945024,2179072,2179072,2994176,2179072,3002368,2179072,2179072,3022848,2179072,3067904,3084288,2125824,3096576,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3223552,0,0,2125824,2125824,2416640,3096576,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3223552,0,0,2125824,2125824,2416640,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3035136,2125824,2125824,3072e3,2125824,2125824,2125824,3121152,2125824,2125824,3141632,2125824,2125824,2125824,3170304,2125824,2125824,2125824,2125824,2445312,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2551808,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2637824,2125824,2125824,2125824,2125824,2727936,2752512,2125824,2125824,2125824,2125824,2842624,2846720,2842624,2846720,2125824,2895872,2916352,2125824,2125824,2945024,2125824,2125824,2994176,2125824,3002368,2125824,2125824,3022848,2125824,3067904,2125824,3067904,3084288,2125824,3096576,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3223552,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3039232,2125824,3063808,2125824,2125824,2125824,2125824,2125824,3100672,2547712,2596864,0,0,0,0,0,0,0,0,0,0,0,0,0,3178496,2670592,0,2744320,0,0,0,0,0,2928640,0,0,0,3059712,0,2543616,2666496,0,2633728,0,0,0,0,0,0,2494464,0,0,0,0,0,0,0,0,0,2780,0,0,0,0,2785,0,0,0,0,2957312,0,0,0,0,0,0,0,0,0,0,0,0,0,3188,0,0,0,0,3211264,0,0,0,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2494464,2179072,2179072,2179072,2707456,2179072,2736128,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2887680,2179072,2179072,2179072,2179072,2641920,2179072,2179072,2179072,2179072,2179072,2179072,2719744,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3137536,2126737,2126737,2499473,2126737,2126737,2126737,2556817,2565009,2179072,2514944,2179072,2179072,2179072,2543616,2547712,2179072,2179072,2596864,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3039232,2179072,3063808,2179072,2179072,2179072,2179072,3100672,2125824,2125824,2125824,2125824,2125824,3178496,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2494464,2125824,0,2125824,2125824,2125824,2125824,2125824,0,0,0,0,1080,1084,0,0,1088,2125824,2514944,2125824,2125824,2125824,2543616,2547712,2125824,2125824,2596864,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2928640,2125824,2125824,2125824,2998272,2125824,2125824,2125824,2125824,3059712,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3178496,2179072,2125824,2125824,2179072,2179072,2125824,2125824,2125824,2125824,0,2486272,0,0,0,0,0,2678784,2854912,3006464,2441216,0,0,0,0,0,0,0,0,0,2932736,2965504,0,0,3076096,0,0,0,0,0,444,0,0,0,0,0,0,0,0,0,0,407,0,0,0,0,0,0,2695168,3174400,2646016,2613248,2703360,0,0,0,0,2977792,0,0,3047424,3129344,0,0,0,0,0,645,0,0,648,649,0,0,0,0,0,0,0,725,0,0,0,0,0,0,0,0,0,743,0,0,0,0,0,0,0,0,0,0,0,0,2769,0,0,0,2981888,2396160,0,3153920,0,0,0,0,0,0,0,0,2740224,0,0,0,0,0,0,541,3027,541,541,541,541,541,541,541,541,541,2584,541,541,541,0,0,0,0,0,2793472,0,0,0,0,0,2469888,2506752,2756608,0,0,2580480,0,0,0,0,0,0,2517,0,0,0,0,0,0,0,0,541,541,541,3029,541,541,541,541,541,541,0,2396160,2400256,2179072,2179072,2441216,2179072,2469888,2179072,2179072,2179072,2519040,2179072,2179072,2179072,2179072,2179072,2179072,2801664,2813952,2179072,2838528,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2453504,2179072,2473984,2482176,2179072,2179072,2179072,2179072,2588672,2179072,2613248,2646016,2179072,2179072,2695168,2756608,2179072,2179072,2179072,2932736,2179072,2179072,2179072,2179072,2179072,3117056,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2584576,2179072,2179072,2125824,2125824,2125824,2519040,2125824,2125824,2125824,2125824,2588672,2125824,2613248,2646016,2125824,2125824,2695168,2756608,2125824,2125824,2125824,2125824,2932736,2125824,2125824,2125824,2125824,2125824,2932736,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3129344,2125824,2125824,3153920,3166208,3174400,2506752,2506752,2506752,0,3108864,3198976,0,0,3043328,0,3149824,2936832,0,2760704,3180,2437120,0,0,0,0,0,0,646,0,0,0,0,651,652,653,654,655,0,0,0,0,0,2953216,0,0,2826240,3158016,2428928,0,3018752,2764800,2572288,0,0,0,0,0,677,0,0,0,0,0,0,0,0,0,0,0,2741,0,0,0,0,0,3051520,2179072,2428928,2437120,2179072,2486272,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2654208,2678784,2760704,2764800,2854912,2969600,2179072,3006464,2179072,3018752,2179072,2179072,2179072,3149824,2125824,2428928,2437120,2969600,2125824,3006464,2125824,3018752,2125824,2125824,2125824,2125824,3149824,2125824,2428928,2437120,2125824,2486272,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2654208,2678784,2760704,2764800,2785280,2854912,2969600,2125824,3006464,2125824,3018752,2125824,2125824,2125824,2125824,3149824,2179072,3051520,2125824,3051520,2125824,3051520,0,2490368,2498560,0,0,0,0,2875392,0,0,0,3180,0,0,0,0,0,0,2834432,0,3227648,2568192,2564096,0,2940928,2179072,2179072,2498560,2179072,2179072,2179072,2555904,2564096,2179072,2179072,2179072,2617344,2179072,2179072,2179072,2179072,2179072,2179072,2662400,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3137536,2125824,2125824,2498560,2125824,2125824,2125824,2555904,2564096,2125824,2555904,2564096,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3137536,2940928,2940928,0,0,0,0,0,2748416,2879488,0,0,0,0,0,0,0,0,0,2519,0,0,0,0,0,541,2940928,0,0,0,0,0,2748416,2879488,0,3180,0,0,0,0,0,0,0,375,0,0,0,0,0,0,0,360,0,0,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2125824,0,2502656,0,0,3010560,0,0,0,0,0,0,0,0,2990080,2179072,2179072,2179072,3129344,2179072,2179072,3153920,3166208,3174400,2396160,2400256,2125824,2125824,2441216,2125824,2469888,2125824,2125824,2125824,2519040,2125824,2125824,2179072,2502656,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3010560,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2605056,2125824,2629632,2125824,2125824,2650112,2125824,2125824,2125824,2707456,2125824,2736128,2125824,2125824,2125824,2125824,2125824,2502656,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3010560,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3137536,2125824,2125824,2498560,2125824,2125824,2502656,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3010560,2125824,2125824,2125824,0,0,0,0,0,0,2739,0,0,0,0,0,0,0,2743,0,0,0,2592768,0,0,0,0,0,0,2179072,2179072,2179072,2179072,2179072,2592768,2179072,2179072,2179072,3129344,2179072,2179072,3153920,3166208,3174400,2397073,2401169,2126737,2126737,2442129,2126737,2470801,2125824,2125824,2449408,0,2535424,3031040,2859008,0,0,0,0,0,2179072,2449408,2179072,2535424,2179072,2609152,2179072,2859008,2179072,2179072,2179072,3031040,2125824,2449408,2125824,2535424,2125824,2609152,2125824,2859008,2125824,2125824,2125824,3031040,2125824,2125824,2449408,2125824,2535424,2125824,2609152,2125824,2859008,2125824,2125824,2125824,0,2179072,2125824,2125824,2457600,2179072,2179072,2179072,2179072,2457600,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,0,1727,0,0,1728,0,3031040,2125824,2527232,0,0,0,0,0,2179072,2527232,2179072,2179072,2179072,2179072,2179072,2125824,2126738,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3125248,2125824,2125824,2125824,2125824,2125824,2527232,2125824,2125824,2125824,2125824,2125824,3092480,2125824,2527232,2125824,2125824,2125824,2125824,2125824,3092480,0,0,0,0,0,693,0,0,0,0,0,0,365,365,365,0,0,0,0,0,707,708,0,0,0,0,0,714,0,0,0,0,0,0,703,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3020,3026944,0,0,0,2404352,2179072,2179072,2179072,2179072,3026944,2404352,2125824,2125824,2125824,2125824,3026944,0,2539520,0,2949120,2179072,2658304,2973696,2179072,2125824,2658304,2973696,2125824,2125824,2658304,2973696,2125824,0,2711552,256e4,2179072,256e4,2125824,256e4,2125824,0,2179072,2179072,2531328,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2605056,2179072,2629632,2179072,2179072,2650112,0,0,2809856,0,0,0,0,0,0,0,0,0,0,3088384,0,0,0,0,0,442,0,0,454,470,470,470,470,470,470,470,470,470,470,480,470,470,470,470,470,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,459,459,111051,459,459,459,459,459,459,459,459,459,111051,111051,111051,111051,111051,111051,111051,111051,111051,111051,459,111051,111051,111051,459,111051,111051,111051,111051,111051,0,0,0,0,0,0,0,0,0,2795,0,0,0,0,0,0,12290,3,0,0,2183168,0,0,0,0,0,299,300,0,2134016,303,304,2125824,1060,0,0,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,1060,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,662,0,662,0,0,0,0,303,118784,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2434,0,303,303,303,303,303,303,303,0,0,0,0,0,303,0,303,1,12290,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2155,0,12290,3,0,0,2183168,0,0,0,0,0,33403,300,0,2134016,49791,304,2105632,12290,3,0,0,294,0,0,0,0,294,0,0,0,0,0,0,0,2124,0,0,0,0,0,0,0,0,0,788,814,0,814,809,0,0,0,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,122880,0,0,0,122880,0,122880,122880,122880,0,0,0,0,0,122880,0,0,122880,0,0,0,0,0,0,0,0,122880,0,0,0,0,0,0,0,0,0,0,0,0,3002,0,0,0,0,0,0,0,0,122880,122880,122880,122880,122880,122880,122880,122880,122880,0,0,122880,0,0,0,0,0,0,0,0,0,0,712,0,0,0,716,0,0,0,147456,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2459,0,1092,0,2424832,2433024,0,0,2457600,0,0,0,0,0,0,0,0,0,0,728,0,0,0,0,0,1823,2125824,2125824,2125824,2408448,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,1919,2125824,2125824,2125824,0,0,0,131072,0,0,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,0,740,407,0,0,0,0,0,0,0,0,0,0,1158,0,0,0,0,0,0,131072,0,0,131072,131072,0,0,0,0,0,0,0,131072,0,0,131072,0,0,131072,0,0,0,0,135168,135168,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2756,0,0,0,0,135168,0,0,135168,0,0,0,0,0,0,0,0,0,0,735,0,797,0,0,0,0,0,0,0,135168,0,135168,135168,135168,135168,135168,135168,0,135168,135168,135168,135168,135168,135168,135168,0,0,0,0,0,135168,0,135168,1,12290,3,0,0,2183168,0,0,0,0,0,636,637,0,2134016,640,641,0,1361,2125824,2125824,2125824,2125824,2125824,2424832,2433024,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,987,2125824,2125824,2125824,2125824,0,304,139264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,225709,0,12290,3,0,0,2183168,0,0,0,0,0,299,33406,0,2134016,303,49794,0,61440,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3178,0,304,2424832,2433024,0,0,2457600,0,0,0,0,0,0,0,0,0,0,757,0,0,0,0,762,301,301,301,143661,371,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,301,143661,301,301,143661,301,301,301,143731,301,301,301,143731,69632,73728,301,301,143661,301,301,65536,301,301,301,301,301,143661,143661,143661,143661,143661,143661,143661,143661,143661,301,301,143661,301,301,301,301,301,301,301,301,301,366,301,0,143661,301,301,301,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,143661,301,301,301,143661,301,143661,143661,143661,143661,143661,143731,143661,143731,143731,143731,143731,143731,143731,143731,143661,143661,143661,143661,143661,143661,143661,143661,1,301,143661,301,143661,143661,143661,143661,143661,143661,301,0,301,0,301,301,301,301,301,301,301,301,301,143661,301,143661,143661,143661,143661,301,0,0,0,3117056,0,0,0,0,0,0,0,2200252,2200252,0,0,0,0,0,0,662,0,0,0,0,0,541,541,541,541,541,541,541,541,2168,541,541,541,0,0,0,0,0,155648,155648,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,325,0,0,0,0,155648,155648,0,155648,155648,155648,155648,155648,155648,155648,155648,155648,0,0,0,0,155648,0,0,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,155648,0,0,0,0,0,155648,0,155648,0,0,0,0,0,155648,0,0,0,0,0,155648,155648,0,155648,155648,0,12290,3,0,0,2183168,126976,0,0,0,0,299,300,0,2134016,303,304,0,0,0,3117056,0,0,0,0,0,0,0,365,0,0,0,0,0,0,0,3563,0,541,541,541,541,541,541,541,541,541,3209,541,541,541,541,541,159744,159744,159744,159744,0,0,159744,0,0,0,0,0,0,0,0,159744,0,0,0,0,0,0,0,159744,159744,159744,163840,159744,159744,159744,159744,159744,0,0,0,0,0,0,0,0,0,2805,0,541,541,541,541,541,0,25162,0,0,0,159744,0,0,0,25162,25162,25162,159744,25162,25162,25162,25162,25162,25162,25162,25162,159744,159744,159744,159744,25162,159744,25162,1,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,167936,1,167936,167936,167936,167936,0,0,167936,0,0,0,0,0,0,0,0,167936,167936,167936,167936,167936,167936,167936,167936,167936,0,0,0,0,0,0,0,0,0,2976,0,0,0,0,0,0,0,0,0,2138112,1183,0,0,0,0,0,0,0,0,0,0,0,0,3168,0,0,0,0,0,0,0,0,172032,0,172032,0,0,0,0,0,0,0,0,0,365,0,293,0,0,0,348,172032,172032,0,0,172032,0,0,172032,172032,0,172032,0,0,0,0,172032,172032,0,0,0,0,0,0,0,0,0,0,172032,0,0,0,0,0,0,2777,0,0,0,0,0,0,2784,0,0,0,0,0,0,2986,2987,0,2988,0,2990,0,0,0,0,0,0,0,69632,73728,0,135168,135168,0,0,65536,135168,172032,0,172032,172032,0,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,172032,0,0,0,0,0,0,0,0,0,3014,0,0,0,0,0,0,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,176128,1,176128,176128,176128,176128,0,0,176128,0,0,0,0,0,0,0,0,176128,176128,176128,176128,176128,176128,176128,176128,176128,0,0,0,0,0,0,0,0,0,3175,0,0,0,0,0,0,0,3,78115,78115,293,0,634,0,0,0,299,300,0,2134016,303,304,1164,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,361,541,541,1308,541,541,541,541,541,541,541,541,541,541,541,541,541,0,0,2242,0,914,563,563,563,563,563,563,563,563,563,563,563,563,563,563,0,0,587,587,587,1203,541,587,563,541,541,541,541,541,563,563,563,563,3070,563,563,563,563,3074,563,563,587,587,587,587,587,1079,0,0,0,0,0,0,0,0,0,0,1102,0,0,0,0,0,0,0,229376,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1134592,0,0,0,0,1691,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3201,563,563,587,587,587,587,0,0,0,0,0,0,0,0,0,0,541,541,541,541,3569,541,541,0,0,563,563,563,563,563,563,563,2251,563,563,563,563,563,563,587,3109,587,587,587,587,587,587,587,587,2407,587,587,587,587,587,2412,2413,563,563,2288,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3541,587,587,587,2375,587,587,587,587,587,587,587,587,587,587,587,587,587,1497,587,587,0,0,0,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1439,0,3007,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3317,541,541,541,541,3038,541,541,541,541,541,541,541,541,541,541,541,541,1300,541,541,541,563,563,563,3078,563,563,563,563,563,563,563,563,563,563,563,563,1401,563,563,563,587,587,587,587,3120,587,587,587,587,587,587,587,587,587,587,587,1042,587,587,587,587,0,3159,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,155648,3214,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1359,563,563,563,587,3259,587,587,587,3262,587,587,587,587,587,587,587,541,541,563,563,587,587,0,0,0,0,0,0,0,0,0,0,3609,541,541,541,587,587,3270,587,587,587,587,587,587,587,587,587,587,587,587,587,1498,587,587,541,541,541,3330,3331,541,541,541,541,541,541,541,541,563,563,563,563,3581,563,563,563,563,563,3349,563,563,563,563,563,563,563,563,563,587,587,587,587,587,587,587,587,0,541,541,541,3406,541,541,541,541,563,563,563,563,563,563,3415,563,0,587,587,587,587,587,291,1079,0,0,0,0,0,0,0,0,0,249856,249856,249856,249856,249856,249856,249856,249856,1,587,3431,587,587,587,587,587,587,3437,587,587,587,3441,587,541,563,563,3473,563,563,563,563,3478,563,563,563,563,3483,563,563,563,563,977,563,563,563,563,0,587,587,587,587,587,587,1931,587,587,587,587,587,587,587,587,587,2678,587,587,587,2681,587,587,0,0,3456,541,541,541,541,541,541,541,541,541,541,541,541,541,0,2586,0,541,3471,563,563,563,563,563,563,563,563,563,563,563,563,563,563,0,2327,563,3487,587,587,587,587,587,587,587,587,587,587,587,587,587,587,0,0,563,563,587,587,587,587,0,0,541,541,563,563,587,587,0,541,541,541,3205,541,541,541,541,541,541,541,3210,541,541,541,541,541,541,2816,541,541,2820,541,541,541,541,541,541,541,541,3041,541,541,541,541,541,541,541,541,2556,541,541,541,541,541,541,541,541,2233,541,541,541,541,541,0,0,563,587,0,541,563,587,0,541,563,587,0,541,563,587,0,0,0,0,0,0,0,0,0,3510,0,0,0,0,541,541,541,541,541,2165,541,541,541,541,541,541,541,541,3616,563,563,563,563,563,563,563,2265,563,563,563,563,2270,563,563,563,184932,184932,184932,184932,184932,184932,184932,0,0,0,0,0,184932,0,184932,1,12290,3,0,0,0,0,0,0,0,0,0,0,0,0,301,301,0,0,301,301,143661,301,301,301,301,301,301,301,301,301,301,301,143731,301,301,301,301,12290,3,78115,78115,293,0,0,0,0,0,299,300,0,2134016,303,304,587,0,0,188416,541,587,563,541,541,541,541,541,563,563,563,563,587,587,587,587,0,0,0,0,2731,0,0,0,0,305,0,0,0,0,0,0,0,0,0,0,0,0,0,249856,0,0,0,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,0,192972,0,1,0,0,0,0,0,192972,192972,192972,192972,192972,192972,192972,192972,192972,192972,0,0,192972,0,0,0,0,0,0,0,0,0,0,1145,365,365,0,0,1148,192972,192972,192972,0,192972,192972,192972,192972,192972,0,0,0,0,0,0,0,0,0,3304,0,3180,0,0,0,0,302,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,541,407,407,407,407,407,407,407,0,0,0,0,0,407,0,407,1,12290,3,0,0,0,0,0,0,0,0,0,0,0,118784,299,12290,3,78115,78115,293,0,0,0,0,0,299,300,0,302,303,304,587,0,0,740,541,587,563,541,541,541,541,541,563,563,563,563,587,587,587,587,0,0,2729,0,0,0,0,0,0,740,1184,0,0,0,0,1188,0,0,0,0,0,0,0,378,0,381,0,0,0,381,0,0,563,587,587,587,587,587,1079,1559,0,0,0,1565,0,0,0,1571,2034,0,0,0,0,1577,2036,0,0,0,0,0,0,0,397,0,0,0,0,0,397,0,0,0,0,0,1577,0,0,0,0,0,0,0,0,0,0,0,0,0,262144,0,0,0,0,0,1188,1669,0,0,0,0,0,0,0,0,0,0,0,0,3177,0,0,0,563,563,587,587,587,587,1559,2030,0,0,0,0,1565,2032,0,0,0,0,0,0,2997,0,0,0,0,0,0,0,0,0,0,1586,1587,0,0,0,0,0,0,0,0,1669,0,0,0,0,0,0,0,0,0,0,0,0,106496,0,0,0,0,0,0,2034,0,2036,0,0,0,0,0,0,0,0,0,0,0,0,0,1150976,0,0,0,0,0,563,563,563,563,2325,2652,0,0,0,0,587,587,587,587,587,587,587,587,587,587,587,587,587,2343,0,307,0,307,0,0,0,0,0,0,0,0,0,307,0,0,0,0,0,0,3011,0,0,0,0,3016,3017,0,3019,0,0,0,0,0,204800,204800,0,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,204800,205107,204800,204800,205106,205107,204800,205106,205106,204800,204800,0,0,0,0,0,0,0,0,0,122880,0,122880,122880,122880,122880,122880,12290,3,0,0,2183801,0,0,0,0,0,299,300,151552,2134016,303,304,0,212992,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,172032,0,0,151552,0,0,0,0,0,0,0,0,0,0,0,0,0,303,0,0,0,0,0,3117056,0,0,0,0,0,0,0,0,2200253,0,0,0,0,0,0,678,0,0,0,0,0,0,0,0,0,0,2977,0,0,0,0,0,0,914,2126737,2126737,2126737,2126737,2126737,2425745,2433937,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3138449,2126811,2126811,2499547,2126811,2126811,2126737,2724753,2126737,2732945,2773905,2126737,2126737,2126737,2806673,2126737,2831249,2126737,2126737,2864017,2126737,2126737,2126737,2126737,2126811,2126811,2126811,2126811,2126811,2593755,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3036123,2126811,2126811,3072987,2126811,2126811,2126811,3122139,2126811,2126737,2126737,2921361,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3117969,2126737,0,2126811,2126811,2126811,2126811,2126811,0,0,0,0,0,0,0,0,0,0,1190,0,0,0,0,0,2126811,2425819,2434011,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3126235,2126811,2126811,2126811,2126811,2126811,2626523,2126811,2126811,2126811,2126811,2126811,2126811,2700251,2126811,2716635,2126811,2724827,2126811,2733019,2773979,2126811,0,2502656,0,0,3010560,0,0,0,0,0,0,0,0,2990080,2179072,2179072,3125248,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2592768,2125824,2125824,2125824,2125824,2126811,2126811,2806747,2126811,2831323,2126811,2126811,2864091,2126811,2126811,2126811,2126811,2921435,2126811,2126811,2126811,0,2179072,2126811,2126737,2457600,2179072,2179072,2179072,2179072,2458513,2126737,2126737,2126737,2126737,2126737,2524049,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2601873,2126737,2126737,2458587,2126811,2126811,2126811,2126811,2183168,0,0,0,0,0,0,0,0,0,0,1206,0,1208,0,0,0,0,2126737,2126737,2126737,2409361,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,0,0,2126811,2126811,2126811,2409435,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2839515,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3118043,2126811,2126811,2126811,2126811,2126811,2126811,2126811,0,0,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2462609,2466705,2126737,2126737,2126737,2642833,2126737,2126737,2126737,2126737,2126737,2126737,2720657,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3040145,2126737,3064721,2126737,2126737,2126737,2126737,2126737,3101585,2769809,2778001,2782097,2798481,2823057,2126737,2126737,2126737,2884497,2126737,2913169,2126737,2126737,2126737,2126737,2126737,2126737,2626449,2126737,2126737,2126737,2126737,2126737,2126737,2700177,2126737,2716561,2126737,2126737,3134353,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3208081,2126737,0,0,0,0,0,0,3026,541,541,541,541,541,541,541,541,541,541,1352,541,541,541,541,541,0,0,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2462683,2466779,2126811,2126811,2126811,2126811,2126811,2929627,2126811,2126811,2126811,2999259,2126811,2126811,2126811,2126811,3060699,2126811,2126811,2126811,2126811,2454491,2126811,2474971,2483163,2126811,2126811,2126811,2126811,2126811,2126811,2532315,2126811,2126811,2126811,2446299,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2552795,2769883,2778075,2782171,2798555,2823131,2126811,2126811,2126811,2884571,2126811,2913243,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3130331,2126811,2126811,3154907,3167195,3175387,2506752,2507739,2507665,2126811,2126811,3134427,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3208155,2126811,2179072,2126811,2126811,2126811,2642907,2126811,2126811,2126811,2126811,2126811,2126811,2720731,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3040219,2126811,3064795,2126811,2126811,2126811,2126811,2126811,3101659,0,0,0,2388881,2126737,2126737,2126737,2421649,2126737,2126737,2126737,2126737,2126737,2454417,2126737,2474897,2483089,2126737,2126737,2126737,2126737,2126737,2126737,2532241,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2605969,2126737,2630545,2126737,2126737,2651025,2126737,2126737,2126737,2708369,2126737,2737041,2126737,2126737,2126737,2126737,2126737,2126737,2663313,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,0,0,988,2126811,2126811,2126811,2126811,3036049,2126737,2126737,3072913,2126737,2126737,2126737,3122065,2126737,2126737,3142545,2126737,2126737,2126737,3171217,2126737,2126737,2126737,2888593,2126737,2126737,2925457,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,986,2126811,2126811,2126811,2126811,2126811,2126811,2126737,3191697,3195793,2126737,0,0,0,0,0,0,2388955,2126811,2126811,2126811,2421723,2126811,2126811,2449408,0,2535424,3031040,2859008,0,0,0,0,0,2179072,2449408,2179072,2535424,2126811,2737115,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2888667,2126811,2126811,2925531,2126811,2126811,2126811,2126811,2126811,2585563,2126811,2126811,2126811,2126811,2126811,2618331,2126811,2126811,2126811,2126811,2126811,2126811,2606043,2126811,2630619,2126811,2126811,2651099,2126811,2126811,2126811,2708443,2126811,3142619,2126811,2126811,2126811,3171291,2126811,2126811,3191771,3195867,2126811,2179072,2126811,2126737,2179072,2179072,2179072,2637824,2179072,2179072,2179072,2179072,2727936,2752512,2179072,2179072,2179072,2842624,2846720,2179072,3112960,3219456,2126737,2126737,3113873,3220369,2126811,2126811,3113947,3220443,0,0,0,0,0,0,0,415,415,0,0,0,0,0,415,0,3096576,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3223552,0,0,2126737,2126737,2417553,2126737,2126737,2126737,2126737,2929553,2126737,2126737,2126737,2999185,2126737,2126737,2126737,2126737,3060625,2126737,2126737,2126737,2126737,2933649,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3130257,2126737,2126737,2126737,2519953,2126737,2126737,2126737,2126737,2589585,2126737,2614161,2646929,2126737,2126737,2696081,2757521,2126737,2446225,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2552721,2126737,2126737,2126737,2638737,2126737,2126737,2126737,2126737,2728849,2753425,2126737,2126737,2126737,2126737,2843537,2847633,2126737,2896785,2917265,2126737,2126737,2945937,2126737,2126737,2995089,2126737,3003281,2126737,2126737,3023761,2126737,3068817,3085201,2126737,3097489,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3224465,0,0,2126811,2126811,2417627,2843611,2847707,2126811,2896859,2917339,2126811,2126811,2946011,2126811,2126811,2995163,2126811,3003355,2126811,2126811,3023835,2126811,3068891,3085275,2126811,3097563,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3224539,2179072,2126811,2126737,2126737,2126737,3031953,2126737,2126811,2450395,2126811,2536411,2126811,2610139,2126811,2859995,2126811,2126811,2126811,2126811,2126811,2524123,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2601947,2126811,2515857,2126737,2126737,2126737,2544529,2548625,2126737,2126737,2597777,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2585489,2126737,2126737,2126737,2126737,2126737,2618257,2126811,2515931,2126811,2126811,2126811,2544603,2548699,2126811,2126811,2597851,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2655195,2679771,2761691,2765787,2786267,2855899,2970587,2126811,3007451,3154833,3167121,3175313,2397147,2401243,2126811,2126811,2442203,2126811,2470875,2126811,2126811,2126811,2520027,2126811,2126811,2126811,2126811,2126811,2638811,2126811,2126811,2126811,2126811,2728923,2753499,2126811,2126811,2126811,2126811,2126811,2126811,3179483,2179072,2126811,2126737,2179072,2179072,2126737,2126737,2126811,2126811,0,0,0,0,0,0,2510848,2514944,0,0,2678784,2760704,2764800,2854912,2969600,2179072,3006464,2179072,3018752,2179072,2179072,2179072,3149824,2126737,2429841,2438033,2126737,2487185,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2655121,2679697,2761617,2765713,2786193,2855825,2970513,2126737,3007377,2126737,3019665,2126737,2126737,2126737,2126737,3150737,2126811,2429915,2438107,2126811,2487259,2126811,2126811,2589659,2126811,2614235,2647003,2126811,2126811,2696155,2757595,2126811,2126811,2126811,2126811,2933723,2126811,2126811,2663387,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2802651,2814939,2126811,3019739,2126811,2126811,2126811,2126811,3150811,2179072,3051520,2126737,3052433,2126811,3052507,0,2490368,2498560,2126811,2556891,2565083,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3138523,2940928,2941841,2941915,0,0,0,0,0,2748416,2879488,0,3180,0,0,0,0,0,0,0,647,0,0,0,0,0,0,0,0,0,2467,0,0,2470,0,0,0,2179072,2502656,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3010560,2179072,2179072,2126737,2126737,2126811,2126811,0,2486272,0,0,0,0,0,2678784,2854912,3006464,2503569,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3011473,2126737,2126737,2126737,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2179072,2126811,2126737,2179072,2179072,2179072,2179072,2126737,2126737,2126737,2126737,2126811,2126811,2126811,2126811,0,0,0,0,0,0,0,0,0,0,0,2112,0,0,0,0,2503643,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,2126811,3011547,2126811,2126811,2126811,0,0,0,2179072,2126811,2126737,2179072,2179072,2179072,2179072,2179072,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2179072,2609152,2179072,2859008,2179072,2179072,2179072,3031040,2126737,2450321,2126737,2536337,2126737,2610065,2126737,2859921,3032027,2126811,2527232,0,0,0,0,0,2179072,2527232,2179072,2179072,2179072,2179072,2179072,2126737,2126737,2802577,2814865,2126737,2839441,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,2126737,3126161,2126737,2528145,2126737,2126737,2126737,2126737,2126737,3093393,2126811,2528219,2126811,2126811,2126811,2126811,2126811,3093467,0,0,0,0,0,782,0,0,0,0,0,0,541,843,541,541,541,541,541,1796,541,541,541,541,541,541,541,541,541,541,541,2822,541,541,541,541,3026944,0,0,0,2404352,2179072,2179072,2179072,2179072,3026944,2405265,2126737,2126737,2126737,2126737,3027857,2405339,2126811,2126811,2126811,2126811,3027931,0,2539520,0,2949120,2179072,2658304,2973696,2179072,2126737,2659217,2974609,2126737,2126811,2659291,2974683,2126811,0,2711552,256e4,2179072,2560913,2126737,2560987,2126811,0,2179072,2179072,3133440,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3207168,2179072,0,0,0,0,0,0,2464,0,0,0,0,0,0,0,0,0,324,398,0,0,0,324,0,2126737,2126811,0,2179072,2126737,2126811,0,2179072,2126737,2126811,2985984,2985984,2986897,2986971,0,0,0,0,0,0,3164,0,0,3167,0,0,0,0,0,0,0,1135,0,0,0,0,0,0,0,0,0,824,0,0,0,0,0,0,0,221184,221184,0,0,0,0,0,0,0,0,0,221184,221184,0,0,221184,221184,221184,0,0,0,0,0,0,0,221184,0,0,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,0,0,0,0,0,0,0,0,0,0,221184,0,221184,221184,221184,221184,221184,221184,221184,221184,221184,221184,1,12290,3,0,0,0,0,0,0,0,0,0,0,0,139264,300,0,303,0,0,0,303,0,304,0,0,0,304,0,0,0,304,69632,139682,0,0,0,0,0,65536,0,0,0,0,98304,0,0,0,53248,0,0,0,0,0,2662400,0,2813952,0,0,3133440,0,98304,0,0,0,0,0,0,0,0,0,0,0,0,111051,0,0,0,0,303,0,304,0,0,0,2473984,2478080,0,0,0,0,0,0,0,0,0,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,159744,163840,3121152,2179072,2179072,3141632,2179072,2179072,2179072,3170304,2179072,2179072,3190784,3194880,2179072,914,0,0,0,0,0,0,3172,3173,0,0,0,0,0,0,0,0,0,665,0,0,668,0,0,0,0,914,0,2387968,2125824,2125824,2125824,2420736,2125824,2125824,2125824,2125824,2125824,2453504,2125824,2473984,2482176,2125824,2125824,2125824,2125824,2125824,2125824,2531328,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2605056,2125824,3190784,3194880,2125824,988,0,0,0,988,0,2387968,2125824,2125824,2125824,2420736,2125824,0,2125824,2125824,2125824,2125824,2125824,0,0,0,299,0,0,0,303,0,0,0,303,119198,73728,0,0,0,0,0,65536,0,3096576,2179072,2179072,2179072,2179072,2179072,2179072,2179072,3223552,914,0,2125824,2125824,2416640,2125824,2125824,2125824,2125824,2125824,2125824,2625536,2125824,2125824,2125824,2125824,2125824,2125824,2699264,2125824,2715648,2125824,2723840,2125824,2732032,2772992,2125824,3084288,2125824,3096576,2125824,2125824,2125824,2125824,2125824,2125824,2125824,3223552,988,0,2125824,2125824,2416640,225890,225890,225890,225890,225890,225890,225890,225741,225741,225741,225741,225741,225906,225741,225906,1,12290,3,0,0,0,0,0,0,0,90409,90409,90409,90409,0,94506,94506,90409,90409,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,94506,1,2125824,237568,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,1222,0,0,0,0,0,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,249856,0,0,0,0,0,0,0,0,0,217088,0,0,0,0,0,0,0,0,0,0,0,0,0,304,0,0,2125824,241664,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,1236,0,0,0,0,0,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,254414,0,0,0,0,0,0,0,12290,0,0,0,2183168,0,0,270336,0,0,299,300,0,2134016,303,304,200704,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,687,2125824,0,2125824,2125824,2125824,2125824,2125824,0,0,180224,0,0,0,0,0,0,0,663,0,0,666,667,0,0,0,0,2940928,0,0,0,0,0,2748416,2879488,0,20480,0,0,0,0,0,0,0,679,0,0,0,0,0,0,0,0,0,1129,0,0,0,0,0,0,1,12290,2113826,0,0,0,0,0,0,296,0,0,0,296,0,0,0,0,0,0,3182,0,0,0,0,3187,0,0,0,0,0,0,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,266240,0,0,0,0,0,0,0,0,0,0,0,266240,0,0,0,0,0,0,0,0,0,0,1,0,0,0,266240,0,0,0,0,0,0,0,0,0,0,0,0,0,2662400,0,2813952,12290,2113826,0,0,2183168,0,0,0,0,0,299,300,0,2134016,303,304,2125824,245760,0,0,2179072,2125824,2125824,2179072,2179072,2179072,2179072,2179072,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2584576,2125824,2125824,2125824,2125824,2125824,2617344,2125824,2125824,2125824,2125824,2125824,245760,2125824,2125824,2125824,2125824,2125824,0,0,0,0,0,0,0,0,0,0,1245,0,0,0,0,0,274432,274432,274432,274432,274432,274432,274432,0,0,0,0,0,274432,0,274432,1,12290,3,0,0,0,0,0,253952,0,0,0,253952,0,0,0,0,0,0,0,0,0,0,0,0,0,1155072,0,0,0,0,0,0,12290,3,78115,78115,293,0,0,0,0,0,299,300,0,0,303,304,563,563,587,587,587,587,0,2030,0,0,0,0,0,2032,0,0,0,0,0,0,3196,0,0,0,0,0,0,0,0,0,0,3186,0,0,0,3189,0,0,0,0,2034,0,0,0,0,0,2036,0,0,0,0,0,0,0,695,0,0,0,0,365,365,365,0,0,2485,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,266240,0,0,0,1678,0,0,0,0,0,0,0,0,0,0,0,0,338,0,0,0,0,0,0,0,1669,0,0,0,0,0,0,0,0,2114,0,0,0,0,0,0,3395,541,541,541,541,3399,541,541,541,541,541,541,1346,541,541,541,541,541,541,1356,541,541,12290,3,78115,78456,293,0,0,0,0,0,299,300,0,0,303,304,541,588,564,564,564,564,564,564,564,588,588,588,541,588,588,588,588,588,588,588,588,564,564,541,564,588,564,588,1,0,0,0,0,2775,0,0,0,0,0,0,0,0,0,0,0,0,163840,0,0,0,1,12290,3,78116,293,0,0,0,0,0,0,0,0,0,0,0,0,167936,0,0,0,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,1,0,0,0,0,0,282624,282624,282624,282624,282624,282624,282624,282624,282624,282624,0,0,282624,0,0,0,0,0,0,0,0,0,0,1600,1601,0,0,0,0,282624,282624,282624,0,282624,282624,282624,282624,282624,0,0,0,0,0,0,0,0,0,254414,254414,254414,254414,254414,254414,254414,254414,1,2981888,2396160,0,3153920,3180,0,0,0,0,0,0,0,2740224,0,0,0,0,0,0,679,751,0,0,0,0,0,0,0,0,0,1144,0,365,365,0,1147,0,0,0,0,0,286720,286720,0,286720,286720,286720,286720,286720,286720,286720,286720,286720,0,0,0,0,0,0,0,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,286720,0,3108864,3198976,0,0,3043328,0,3149824,2936832,0,2760704,3305,2437120,0,0,0,0,0,0,680,0,0,0,0,0,0,0,0,0,300,0,0,0,0,0,0,0,0,0,0,2875392,0,0,0,3386,0,0,0,0,0,0,2834432,2940928,0,0,0,0,0,2748416,2879488,0,3386,0,0,0,0,0,0,0,709,0,0,0,0,0,0,0,0,0,2048,0,0,0,0,0,0,0,0,0,309,0,0,0,0,0,308,0,308,309,0,308,308,0,0,0,308,308,309,309,0,0,0,0,0,0,308,408,309,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,781,0,0,0,309,413,0,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,0,783,0,802,0,0,0,0,541,847,541,541,541,541,541,2830,2831,541,541,541,541,2834,541,541,541,541,541,541,541,3521,541,3523,541,541,3525,541,563,563,0,0,432,0,0,0,0,308,449,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,463,489,489,463,489,489,489,489,489,489,489,514,489,489,489,489,489,489,489,489,489,489,489,489,489,489,489,534,489,489,489,489,489,542,565,542,565,542,542,565,542,589,565,565,565,565,565,565,565,589,589,589,542,589,589,589,589,589,589,589,589,565,565,542,565,589,565,589,1,0,0,674,0,0,0,0,0,0,0,0,0,0,0,0,0,323,324,0,0,704,0,0,0,0,0,0,0,711,0,0,0,0,0,0,0,742,0,0,0,0,742,0,748,0,0,0,736,0,0,0,0,0,0,0,0,0,0,0,747,0,0,0,0,0,792,663,841,0,0,0,0,541,845,541,541,541,541,541,2217,541,541,541,541,541,541,541,541,541,541,541,1802,541,541,541,541,0,0,0,0,645,0,0,0,0,0,0,0,0,0,0,0,0,172032,0,0,0,0,0,0,0,0,765,0,0,768,0,0,0,0,774,0,0,778,0,0,0,0,0,0,3562,0,3564,541,541,541,541,541,541,541,541,541,3219,541,541,541,541,541,3224,0,0,785,0,0,0,0,789,0,0,0,0,0,0,0,793,0,0,736,0,793,0,0,0,0,648,0,0,0,0,0,0,0,807,808,0,0,0,0,808,0,0,807,0,0,0,0,0,755,0,0,816,817,0,0,0,793,0,0,0,0,0,0,0,0,0,0,0,0,221184,0,0,0,0,0,0,648,0,0,0,0,0,834,789,0,0,0,0,0,0,0,2139,0,0,0,0,0,0,0,0,0,1712,0,0,0,0,0,0,838,839,789,789,0,0,0,0,789,736,789,0,541,541,849,853,563,964,563,967,563,563,981,563,563,0,587,587,587,996,1e3,587,0,0,0,0,0,0,0,0,3180,3448,0,0,0,0,0,0,0,2465,0,0,0,0,0,0,0,0,0,2152,0,0,0,0,0,0,1093,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1135,0,0,0,0,1152,0,0,0,0,1157,0,0,0,0,0,0,0,822,0,816,0,664,0,0,0,0,0,0,0,0,1201,0,0,0,0,0,0,0,0,0,0,0,0,221184,0,221184,0,0,0,1253,0,0,0,0,0,0,0,0,0,0,0,0,0,339,340,341,541,541,1342,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2239,0,0,0,0,0,1596,0,0,0,0,0,0,0,0,0,0,0,0,233472,0,0,0,0,0,0,1640,0,0,0,0,0,0,0,0,0,0,0,0,354,355,356,357,1653,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1163,0,0,0,0,1669,0,0,0,0,0,0,1673,0,0,0,0,0,0,0,69632,73728,0,0,0,346,345,65536,344,0,1729,0,0,0,0,541,541,541,541,541,541,541,541,541,541,541,3327,541,541,1742,541,541,541,541,541,541,541,541,541,1755,541,541,541,541,541,541,541,2193,541,541,541,541,541,541,541,541,541,2557,541,541,541,541,541,541,541,541,541,1794,541,541,1797,541,541,541,541,541,541,541,541,541,541,1314,541,541,541,1318,541,541,1809,541,541,541,541,541,1814,541,541,541,541,541,541,541,1360,914,563,563,563,563,563,563,563,563,563,563,563,563,563,563,0,2328,1824,563,563,563,563,563,1831,563,563,563,563,563,1837,563,563,563,563,563,3093,563,563,563,563,563,563,563,563,563,3102,563,563,1892,563,563,563,563,563,563,563,563,563,563,1905,563,563,563,563,978,563,563,563,563,0,587,587,587,587,587,587,1997,587,587,587,587,587,587,587,587,587,1531,587,587,587,587,587,587,563,563,563,1910,563,563,563,563,563,563,563,26028,1920,587,587,587,0,1285,1469,1377,541,541,1339,541,541,563,563,1431,563,587,587,1927,587,587,587,587,587,1933,587,587,587,587,587,587,587,1529,587,587,587,587,587,587,587,587,1932,587,587,587,587,587,587,587,587,1494,587,587,587,587,587,587,587,587,587,1946,587,587,587,587,587,587,587,587,587,587,587,587,587,1513,587,587,563,563,2026,587,587,587,0,2030,0,0,0,0,0,2032,0,0,0,0,0,0,131072,0,131072,131072,131072,131072,0,131072,131072,131072,131072,131072,131072,131072,0,0,0,0,0,131072,0,131072,1,0,0,0,2042,0,0,0,0,0,0,0,0,0,0,0,0,365,365,365,0,0,2141,0,0,2148,0,0,0,0,0,0,0,0,0,0,0,0,237568,0,0,0,0,0,0,2140,541,541,541,541,541,541,541,541,541,541,541,2170,541,541,2173,541,541,541,541,541,541,2181,541,541,541,541,541,541,541,541,2841,541,541,541,541,541,541,541,541,1294,541,541,541,541,541,541,541,541,1327,541,541,541,1334,1336,541,541,541,541,2214,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2535,541,563,2258,563,563,563,563,563,563,2266,563,563,563,563,563,563,563,983,563,0,587,587,587,587,1001,587,563,2300,563,563,563,563,563,563,563,563,563,563,563,563,563,563,587,587,587,2345,587,587,587,587,587,587,2353,587,587,587,587,587,587,587,1950,587,587,587,587,587,587,587,587,1468,587,587,587,587,587,587,587,587,2387,587,587,587,587,587,587,587,587,587,587,587,587,587,587,541,587,563,2414,541,541,541,541,563,563,563,563,587,587,587,587,2030,0,2032,0,2034,0,2036,0,0,2428,0,0,0,0,0,0,0,0,0,0,1713,0,0,0,0,0,2436,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1179,2449,0,0,0,0,0,2453,0,0,0,0,0,0,0,0,0,0,1726,0,0,0,0,0,0,0,0,0,2477,0,0,0,0,0,0,0,0,0,0,0,0,245760,0,0,0,0,0,2501,0,0,0,0,0,0,0,0,0,0,0,0,0,386,338,0,541,541,541,2539,541,541,541,541,541,541,541,541,541,541,541,541,541,2198,541,541,0,0,0,563,563,563,563,563,563,563,563,563,2595,563,563,563,563,563,3238,563,563,563,563,563,563,563,563,563,563,2880,563,563,563,563,563,587,587,587,2661,587,587,587,587,587,587,587,587,587,587,587,2669,587,587,587,587,2714,587,587,587,587,587,587,541,587,563,541,541,2417,2418,563,563,2421,2422,587,587,2425,2426,0,1563,0,0,0,2735,0,0,0,0,0,0,2740,0,0,0,0,0,0,0,1102,1101,0,0,0,0,0,0,0,0,1724,0,0,0,0,0,0,0,0,1172,0,0,0,0,0,0,0,0,1187,0,0,0,0,0,0,1104,0,0,0,0,0,2763,0,0,0,0,0,0,0,0,0,0,0,2431,2432,0,0,0,0,0,0,0,0,2792,2793,0,0,0,0,0,0,0,0,0,0,2049,0,0,0,0,0,541,541,541,541,2829,541,541,541,541,541,541,541,541,541,541,2836,563,563,563,563,2876,563,563,563,563,563,563,563,563,563,563,563,0,2329,587,587,587,2884,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1874,587,587,2933,587,587,587,587,587,587,587,587,587,587,587,587,587,1536,587,587,2955,541,2957,563,2959,587,0,0,0,0,0,0,0,0,0,0,0,0,0,0,541,541,541,541,541,541,541,587,3442,0,3444,0,0,0,0,0,3180,0,0,0,0,3452,0,0,0,0,0,796,0,0,0,0,0,0,0,0,0,0,0,0,796,0,0,0,0,3454,0,541,3457,541,3459,541,541,541,541,541,541,541,541,541,541,541,541,2585,0,0,0,563,587,3488,587,3490,587,587,587,587,587,587,587,587,587,587,587,1047,587,587,587,587,587,0,0,0,3505,0,0,0,0,0,0,0,3512,0,0,541,541,541,541,541,541,3462,541,541,541,541,541,541,541,541,541,3334,541,541,541,563,563,563,541,541,541,3517,541,541,541,541,541,541,541,541,541,541,563,563,563,563,563,563,563,563,563,563,3530,563,563,563,563,563,563,563,563,563,563,563,587,587,587,587,587,587,587,587,3544,587,587,587,587,587,587,587,587,587,587,587,0,0,0,0,541,541,541,541,563,563,310,311,312,0,0,0,0,0,0,0,0,0,0,0,0,0,669,0,0,0,0,0,421,0,0,0,0,450,0,0,0,0,0,0,0,0,304,304,304,304,0,304,304,304,0,0,0,0,450,450,421,450,450,450,450,450,450,450,450,450,450,450,450,450,450,533,450,533,533,533,450,533,533,533,533,450,543,566,543,566,543,543,566,543,590,566,566,566,566,566,566,566,590,590,590,543,590,590,590,590,590,590,590,590,566,566,616,621,590,621,627,1,960,563,563,563,563,563,563,563,563,0,587,587,587,587,587,587,587,3136,587,587,3138,587,587,587,587,587,0,0,0,0,1657,0,0,0,0,0,0,0,0,0,0,0,0,254414,0,0,0,1676,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1211,541,541,541,1810,541,541,541,541,541,541,541,541,541,541,541,1360,914,563,563,563,563,563,563,563,563,563,563,563,563,563,1378,0,0,2486,0,0,0,0,0,0,0,0,0,0,0,0,0,694,0,0,541,541,541,541,2528,541,541,541,541,2532,541,541,541,541,541,541,541,541,3218,541,541,541,541,541,541,541,541,2583,541,541,541,541,0,2586,0,0,0,0,563,563,563,563,563,563,2592,563,563,563,563,2596,563,0,587,587,587,587,587,78115,1079,0,0,0,0,0,0,0,0,0,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,225741,0,0,0,0,0,0,0,2658,587,587,587,587,2662,587,587,587,587,587,587,587,587,587,587,2665,587,587,587,587,587,0,0,0,313,314,315,316,317,318,319,320,321,322,0,0,0,0,0,0,694,0,0,0,0,0,365,365,365,0,0,313,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2142208,0,0,316,0,0,0,0,0,0,0,0,0,0,0,0,0,730,0,0,0,423,431,433,422,431,0,313,431,451,464,464,464,464,464,464,464,464,464,464,464,464,464,464,464,464,464,464,464,485,490,490,501,490,490,490,490,490,490,490,490,516,516,529,529,530,530,530,530,530,530,530,530,530,530,530,516,530,530,530,530,530,544,567,544,567,544,544,567,544,591,567,567,567,567,567,567,567,591,591,591,613,591,591,591,591,591,591,591,614,615,615,613,615,614,615,614,1,734,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1238,0,0,0,0,767,0,0,0,0,0,0,0,0,0,0,0,0,266240,0,0,0,0,0,702,0,0,0,0,0,702,0,0,0,541,541,541,541,541,541,3322,541,541,541,541,541,541,541,541,1816,541,541,541,541,541,541,1360,563,563,563,968,563,563,563,563,563,0,587,587,587,587,587,587,587,3150,3151,3152,541,541,563,563,587,587,0,0,2963,0,0,0,0,0,0,0,0,3180,0,0,3389,0,0,0,0,0,1108,0,0,0,0,0,0,0,0,0,0,0,0,0,0,308,309,0,1150,1108,0,0,0,0,0,0,0,0,0,0,0,0,0,1119,0,0,1212,0,0,0,0,0,0,0,0,0,0,0,0,0,1225,0,0,0,0,0,797,0,0,0,0,0,0,0,0,0,0,0,0,797,0,1360,914,563,563,1364,563,563,1368,563,563,563,563,563,563,563,563,985,0,587,587,587,587,587,587,1382,563,1387,563,563,1391,563,563,1394,563,563,563,563,563,563,563,984,563,0,587,587,587,587,587,1004,587,1460,587,587,587,587,587,587,587,587,1474,587,1479,587,587,1483,587,587,1486,587,587,587,587,587,587,587,587,587,587,587,587,587,1939,587,587,0,1692,0,1694,0,0,0,0,0,0,1701,0,0,0,0,0,0,0,2442,0,0,0,0,0,0,0,0,0,1173,0,0,0,0,0,0,541,541,1745,541,541,541,541,541,541,541,541,541,1757,541,541,541,541,541,541,2192,541,541,2195,541,541,541,541,541,541,541,1798,541,541,541,541,541,541,1806,541,541,1792,1793,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2824,541,0,563,563,563,563,563,563,563,563,563,563,563,563,563,1840,563,0,587,587,587,587,587,78115,1079,0,0,1083,1087,0,0,1091,587,587,587,587,1948,587,587,587,587,587,587,587,587,587,587,587,1478,587,587,587,587,587,587,587,587,1961,587,587,587,587,587,587,587,587,587,587,587,1533,587,587,587,587,0,2034,0,2036,0,0,0,0,0,0,2430,0,0,0,0,0,0,0,2454,0,0,0,0,0,0,0,0,0,2429,0,0,0,0,0,0,0,0,0,2476,0,0,0,0,0,0,0,0,0,0,0,0,365,365,365,702,0,0,0,2502,2503,0,0,0,0,0,0,0,0,0,0,0,0,1147355,0,0,0,587,587,2700,587,587,587,587,587,587,587,587,587,587,587,587,587,2004,587,587,0,0,2802,0,0,0,0,0,0,0,2806,541,541,541,541,541,541,541,2204,541,541,541,541,541,541,541,541,541,2220,541,541,541,541,541,541,541,2956,563,2958,587,2960,0,0,0,0,0,2966,0,0,0,0,0,0,0,69632,73728,0,0,0,350,348,65536,0,0,0,0,2970,0,0,0,0,0,0,0,0,0,0,0,0,365,365,208896,0,3035,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1807,541,541,3050,3051,541,541,541,541,541,541,541,541,541,541,541,541,541,2223,2224,541,563,3090,563,3092,563,563,563,563,563,563,563,563,563,563,563,563,1415,563,563,563,3117,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1484,587,587,3132,587,3134,587,587,587,587,587,587,587,587,587,587,587,1937,1938,587,587,587,0,3192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,309,308,541,541,541,541,3228,541,541,541,541,563,563,563,563,563,563,563,563,563,945,563,563,563,563,587,3503,0,3504,0,0,0,0,0,0,0,0,0,0,0,541,541,541,541,2810,3515,541,3516,541,541,541,3520,541,541,541,541,541,541,541,563,3528,563,3529,563,563,563,3533,563,563,563,563,563,563,563,563,587,3542,587,3543,587,587,587,3547,587,587,587,587,587,587,587,587,0,0,0,0,3673,541,541,541,3675,563,563,3676,587,587,587,3678,0,0,541,541,563,563,587,587,0,541,541,3204,541,541,541,541,541,541,541,541,541,541,541,541,541,2238,2586,0,324,324,374,0,0,0,0,0,0,0,0,0,0,0,0,0,1133,0,0,0,0,434,374,0,439,445,0,452,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,465,491,491,502,491,491,491,491,491,491,491,491,517,517,517,517,517,517,517,517,517,517,517,517,517,517,517,517,545,568,545,568,545,545,568,545,592,568,568,568,568,568,568,568,592,592,592,545,592,592,592,592,592,592,592,592,568,568,545,568,592,568,592,1,587,587,587,1019,587,587,587,587,587,587,587,587,587,587,587,587,1052,587,587,587,1122,0,1124,1125,0,0,0,1127,1128,0,0,0,0,0,0,0,0,334,0,0,0,0,0,334,0,0,0,1166,1167,0,0,0,0,0,0,0,0,0,0,0,0,400,0,0,0,0,0,1228,0,0,0,0,1233,0,0,0,0,0,0,0,0,0,365,300,0,0,0,0,0,0,0,0,0,1241,0,0,0,0,1244,0,1194,0,1113,0,1250,1127,0,0,0,0,0,0,0,0,0,541,541,1274,541,541,541,541,541,541,2203,541,541,541,541,541,541,541,541,541,541,1329,541,541,541,541,541,541,541,1322,541,541,1324,541,541,541,1328,541,541,541,541,541,541,541,541,3522,541,541,541,541,541,563,563,3068,563,563,563,563,563,563,563,563,2603,563,563,563,563,563,563,563,1360,914,563,563,1365,563,563,563,563,563,563,563,563,563,563,563,587,3427,587,587,3429,563,563,563,1405,563,563,563,563,563,563,563,1414,563,563,1416,563,0,587,587,587,1051,587,78115,1079,0,0,0,0,0,0,0,0,1134592,0,0,0,0,0,0,1134592,0,0,0,0,563,563,1420,563,563,563,563,563,563,563,563,563,563,563,563,563,1437,563,563,563,563,563,1444,563,563,563,563,563,26028,1360,988,587,587,1457,587,0,0,0,0,0,0,0,3447,3180,0,0,0,0,0,0,0,1237,0,0,541,541,1273,541,1276,541,0,0,0,1656,0,0,0,0,0,0,0,0,0,0,0,0,541,846,541,541,587,587,587,1993,587,587,587,587,587,587,587,587,587,587,587,587,1496,587,587,587,563,2025,587,587,587,2029,0,2030,0,0,0,0,0,2032,0,0,0,0,0,0,1134592,0,0,0,0,0,0,0,0,0,0,1134592,0,0,0,2034,0,0,0,0,0,2036,0,0,0,0,0,2039,0,2078,0,0,0,0,0,0,0,0,0,0,0,0,0,0,331,0,0,0,0,2092,0,0,0,0,0,0,0,0,0,0,0,0,643,0,0,0,541,2172,541,541,541,541,541,541,541,541,541,541,541,541,541,541,0,0,0,541,2188,541,541,541,541,541,541,541,541,541,541,541,541,541,541,0,2240,541,541,541,541,2229,541,2231,541,541,541,541,541,541,541,0,0,0,0,0,0,1146880,0,1146880,0,0,0,0,0,0,0,0,2617344,0,0,0,0,0,2789376,0,0,0,563,563,563,563,563,563,563,563,563,2253,563,563,563,563,0,0,0,0,0,0,587,2654,587,587,587,587,587,587,3135,587,587,587,587,587,587,587,587,587,1530,587,587,587,587,587,587,2257,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1889,2273,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2272,563,563,563,563,2316,563,2318,563,563,563,563,563,563,563,0,0,0,0,0,0,587,587,587,587,587,587,587,587,587,587,587,587,587,587,541,563,2344,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1516,2360,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1517,587,587,587,587,2403,587,2405,587,587,587,587,587,587,587,541,587,0,0,0,0,0,0,0,3508,0,0,0,0,0,0,541,541,541,541,541,541,3400,541,541,541,2499,0,0,0,0,0,2504,0,0,0,0,0,0,0,0,0,0,2086,2087,0,0,0,0,541,541,2526,2527,541,541,541,541,541,541,541,541,541,541,541,541,541,2237,0,0,541,541,2566,541,541,541,541,541,541,541,541,541,541,541,541,541,541,3046,541,0,0,0,563,563,563,2590,563,2591,563,563,563,563,563,563,563,1411,563,563,563,563,563,563,563,563,1429,563,563,563,563,563,563,563,563,1916,563,563,26028,1921,587,587,587,0,0,0,2761,0,0,0,0,0,0,0,0,0,0,0,0,674,0,0,0,541,541,2837,541,541,541,541,541,541,541,2843,541,541,541,541,541,541,541,2232,541,541,2235,2236,541,541,0,0,563,563,563,2885,563,563,563,563,563,563,563,2891,563,563,563,563,0,0,2329,0,0,0,587,587,587,587,587,587,587,587,587,587,2341,587,587,587,2920,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1519,587,587,587,587,3373,587,587,541,541,563,563,587,587,0,0,0,0,0,0,0,0,0,2968,563,587,587,587,587,587,587,3493,587,587,587,587,587,587,587,587,1034,587,587,587,587,587,587,587,326,327,328,0,0,0,0,0,0,0,0,0,0,0,0,0,1161,0,0,0,0,0,325,373,328,372,0,0,0,0,0,0,0,0,0,0,2111,0,0,0,0,0,325,0,0,372,372,402,0,328,0,0,0,0,0,0,0,0,0,365,339,293,0,0,0,0,0,0,325,0,327,0,0,0,453,466,466,466,466,466,466,466,479,466,466,466,466,466,466,466,466,466,466,466,466,492,492,466,492,492,507,509,492,492,507,492,518,518,518,518,518,518,518,518,518,518,518,518,518,518,518,535,518,518,518,518,518,546,569,546,569,546,546,569,546,593,569,569,569,569,569,569,569,593,593,593,546,593,593,593,593,593,593,593,593,569,569,546,569,593,569,593,1,0,0,658,659,0,0,0,0,0,0,0,0,0,0,670,671,0,689,0,0,0,0,0,0,0,0,0,0,365,365,365,0,0,0,0,0,800,0,0,0,0,0,0,0,0,0,0,0,0,718,0,720,0,0,0,0,0,0,727,0,0,0,731,0,0,0,0,0,0,1159168,417,417,0,0,0,0,0,417,0,0,784,0,786,0,0,0,0,0,0,0,0,0,0,0,0,759,0,0,0,0,0,798,0,803,0,806,0,0,0,0,803,806,0,0,0,0,0,0,741,0,0,0,0,0,0,0,0,0,0,0,0,806,806,803,0,0,0,0,0,0,0,786,0,798,0,815,0,0,0,0,0,802,0,0,783,0,0,0,0,802,0,0,0,0,0,0,0,802,0,0,0,0,806,0,707,0,0,823,0,0,0,0,0,823,823,826,0,0,0,786,0,0,0,0,0,835,0,0,0,0,0,0,0,2480,0,0,0,0,0,0,0,0,0,1100,0,0,0,0,0,0,0,0,0,0,784,0,0,0,835,815,835,0,541,541,850,541,541,541,541,541,3052,541,541,541,541,541,541,541,541,3060,541,541,541,541,541,3217,541,541,541,541,541,541,541,3222,541,541,541,541,541,2529,541,541,541,541,541,541,541,541,541,541,541,3043,541,541,541,541,856,541,541,869,541,541,880,541,885,541,541,893,896,901,541,909,563,563,966,969,974,563,982,563,563,0,587,587,587,997,587,1003,587,587,1016,587,587,1027,587,1032,587,587,1040,1043,1048,587,1056,587,0,0,0,0,0,0,3507,0,0,0,0,0,0,0,541,541,541,541,541,3031,541,541,541,541,0,0,0,1110,0,0,0,0,0,0,0,1117,0,0,0,0,0,0,0,69632,73728,0,0,0,421,0,65536,0,0,1137,1138,0,0,0,0,1142,0,0,0,365,365,0,0,0,0,0,0,769,0,0,0,775,776,0,0,0,0,0,0,0,69632,73728,0,0,0,374,0,65536,0,0,1165,0,0,0,0,0,0,0,0,0,0,0,0,0,0,515,522,0,0,1182,741,0,0,0,1134,0,0,0,0,0,0,0,0,0,367,0,0,0,0,0,0,541,541,541,1281,541,541,541,541,541,541,1296,541,541,541,1301,541,541,541,541,541,3229,541,541,541,563,563,563,563,563,563,563,941,563,563,563,563,563,563,1360,914,563,563,563,563,563,563,563,563,563,563,1373,563,563,563,563,563,3249,563,3251,563,563,563,563,563,563,563,563,1852,563,563,563,563,563,563,563,563,563,563,1388,563,563,563,1393,563,563,563,563,563,563,563,563,1451,26028,1360,988,587,587,587,587,587,1485,587,587,587,587,587,587,587,587,587,587,587,587,587,1500,1540,587,587,0,541,587,563,541,541,541,541,541,563,563,563,563,563,563,3477,563,563,563,563,563,563,563,563,1396,563,563,563,563,563,563,563,0,0,1607,1608,1609,0,1611,1612,0,0,0,0,1617,0,0,0,0,0,0,770,0,0,773,0,0,777,0,0,0,0,0,0,796,0,0,0,0,0,541,541,541,541,541,541,563,563,563,563,563,563,933,563,563,947,563,563,563,563,0,0,1639,0,0,1642,0,1644,0,0,0,0,0,1650,1651,0,0,0,0,0,805,0,0,692,0,0,672,0,692,0,810,0,1667,0,0,1669,0,0,0,0,1671,1672,0,0,0,0,0,0,0,2491,2492,0,0,0,0,0,0,0,0,0,2686976,2736128,0,0,2531328,2707456,0,0,0,0,0,1708,0,0,1711,0,0,0,0,0,1715,0,0,0,0,0,0,2134016,0,0,0,0,0,0,0,0,1138688,0,1719,1720,0,0,0,0,0,0,0,0,0,0,0,0,1711,0,0,0,1731,1585,1585,1733,541,1735,541,1736,1737,541,1739,541,541,541,541,541,1310,541,541,541,541,541,541,541,1317,541,541,541,541,541,1748,541,541,541,541,541,541,541,541,541,1759,541,1743,541,541,541,541,541,541,541,541,541,1756,541,541,541,541,541,541,541,3333,541,541,541,541,541,563,563,563,922,926,563,563,563,563,563,563,952,563,957,1760,541,541,541,541,1764,541,1766,541,541,541,541,541,541,541,541,541,889,541,541,541,541,907,541,1774,1775,1777,541,541,541,541,541,541,541,1785,1786,1787,541,541,1790,1791,541,541,541,541,541,541,541,1799,541,541,541,1803,541,541,541,541,541,541,2530,541,541,541,541,541,541,541,541,541,541,1315,541,541,541,541,1320,541,541,541,541,1811,541,541,541,541,541,541,541,541,541,1822,1360,914,563,563,563,563,563,563,563,563,563,563,563,563,563,1379,0,1827,563,1829,563,1830,563,1832,563,1834,563,563,563,1838,563,563,563,563,1390,563,563,563,563,563,563,563,563,563,563,563,2652,0,587,587,587,563,1859,563,1861,563,563,563,563,563,563,563,563,1869,1870,1872,563,0,587,587,1042,587,587,78115,1079,0,0,0,0,0,0,0,0,307,307,307,0,0,0,0,0,1907,563,563,563,563,563,563,563,563,563,1918,26028,0,1923,587,1925,587,1926,587,1928,587,1930,587,587,587,1934,587,587,587,587,587,587,587,3366,587,587,587,587,3367,3368,587,587,587,587,587,1947,587,587,587,587,1951,587,587,587,587,1955,587,1957,587,587,1976,1977,1978,587,587,1981,1982,587,587,587,587,587,587,587,1999,2e3,587,587,587,587,587,587,587,2015,2016,2017,541,2019,541,541,563,2023,1990,587,587,587,1994,587,587,587,587,587,587,587,2003,587,587,587,0,1288,1472,1380,541,541,541,541,541,563,563,563,563,3475,563,563,563,563,563,563,563,563,563,563,2267,563,563,563,563,563,563,2024,563,1982,587,2028,587,0,2030,0,0,0,0,0,2032,0,0,0,0,0,0,2134016,0,0,0,0,0,0,0,746,0,0,0,0,0,2043,0,0,2046,2047,0,0,0,2051,0,0,0,0,0,0,800,0,0,0,0,0,0,0,800,0,0,0,0,541,541,541,541,2090,0,0,0,0,2094,0,0,0,0,0,0,0,0,0,0,0,2456,0,0,0,0,0,0,0,0,1669,0,0,0,0,0,0,0,2113,0,0,2116,0,0,2119,0,0,0,0,0,0,2126,0,2128,0,0,0,0,0,0,0,69632,73728,0,370,370,0,0,65536,370,0,0,0,0,2137,0,0,0,0,0,0,0,0,0,0,0,0,1159168,0,0,0,0,2047,0,2147,0,0,0,0,0,0,0,0,0,0,0,0,1103,1104,1105,1106,0,2158,0,0,541,541,541,541,541,541,541,541,541,541,541,541,541,3329,541,541,541,2174,541,2176,541,541,541,541,541,541,2184,541,2186,541,541,541,541,541,3332,541,541,541,541,541,541,541,563,563,563,3069,563,563,563,563,563,563,563,2212,541,541,541,541,541,541,2219,541,541,541,541,541,541,541,541,541,1312,541,541,541,541,541,541,563,563,2259,563,2261,563,563,563,563,563,563,2269,563,2271,563,563,563,563,1422,563,563,563,563,563,563,563,563,563,563,1438,587,587,2346,587,2348,587,587,587,587,587,587,2356,587,2358,587,587,0,0,0,3634,0,3636,541,541,541,541,541,541,541,563,563,921,563,563,563,563,940,944,950,563,955,563,563,2261,541,2416,541,541,563,2420,563,563,587,2424,587,587,2030,0,2032,0,0,0,2452,0,0,0,0,0,0,0,0,0,0,0,0,1132,0,0,0,0,0,2461,0,0,0,0,0,2466,0,2468,2469,0,0,0,0,0,0,0,69632,73728,0,420,420,0,0,65536,420,0,0,0,0,2488,0,0,0,0,0,0,0,0,0,0,0,0,2179072,2179072,2179072,2179072,0,0,0,0,2516,2468,0,0,0,0,0,2521,0,0,0,541,541,541,541,541,3321,541,541,541,3325,541,541,541,541,541,541,1749,541,541,541,541,541,541,541,541,541,541,2558,541,541,541,541,541,2563,541,541,541,2568,541,541,541,541,541,541,541,2575,541,541,541,541,541,541,2542,541,2544,541,541,541,541,541,541,541,541,563,3411,563,563,3413,563,563,563,541,541,541,541,2580,541,541,541,541,541,541,541,541,0,2586,0,0,0,0,0,812,0,809,792,0,0,814,0,667,0,788,0,0,0,563,563,563,563,563,563,563,563,2594,563,563,563,563,0,2652,0,0,0,0,587,587,587,587,587,587,587,587,587,587,587,587,2342,587,563,2624,563,563,563,563,2628,563,563,563,2633,563,563,563,563,563,563,2629,563,563,563,563,563,563,2636,563,563,563,563,2640,563,563,563,563,563,563,563,563,2646,563,563,563,563,0,2652,0,0,0,0,587,587,587,2656,587,2657,587,587,2660,587,587,587,587,587,587,587,587,587,587,587,587,587,2383,587,587,587,587,2672,587,2674,587,587,587,587,587,587,587,587,587,587,587,1970,587,587,587,587,587,2699,587,587,587,587,587,587,587,2706,587,587,587,587,587,587,587,3375,541,3376,563,3377,587,0,0,0,587,587,2712,587,587,587,587,587,587,587,587,541,587,563,541,541,541,541,563,563,2800,2801,0,0,0,0,0,0,0,0,0,541,541,541,541,541,541,541,541,541,3402,2992,0,0,0,0,0,0,0,0,0,0,0,2992,0,0,0,0,0,0,840,0,0,0,0,0,541,541,541,541,541,541,2166,541,541,541,541,541,0,3022,0,0,0,3025,541,541,541,541,541,541,3032,541,541,541,541,541,541,2570,541,541,541,541,2574,541,541,541,541,541,541,1286,541,541,541,541,541,541,541,541,541,541,1818,541,541,541,541,1360,541,541,3036,541,541,541,541,541,541,541,3042,541,541,541,541,541,541,541,2531,541,541,541,541,541,541,541,541,541,563,3230,563,563,563,3233,563,3048,541,541,541,541,541,541,541,541,541,541,3057,3059,541,541,541,541,541,541,2582,541,541,541,541,541,541,0,2586,0,3062,541,3064,3065,541,563,563,563,563,563,563,3072,563,563,563,563,563,1425,563,563,563,563,563,563,563,563,563,563,2889,563,563,563,563,563,563,563,3076,563,563,563,563,563,563,563,3082,563,563,563,563,563,3088,563,563,3091,563,563,563,563,563,563,563,563,3098,3100,563,563,563,563,563,3342,563,563,563,563,563,563,563,563,563,563,2645,563,563,563,563,563,563,563,3104,563,3106,3107,563,587,587,587,587,587,587,3114,587,587,587,0,1544,1545,1546,541,541,1548,541,541,563,563,1552,563,587,587,3118,587,587,587,587,587,587,587,3124,587,587,587,587,587,587,1998,587,587,587,587,587,587,587,587,587,3551,587,587,3553,587,0,0,3130,587,587,3133,587,587,587,587,587,587,587,587,3140,3142,587,587,0,0,3633,0,0,0,541,541,3638,541,541,541,3642,563,587,587,3146,587,3148,3149,587,541,587,563,541,3154,563,3156,587,3158,0,0,0,0,0,3181,0,3183,0,0,0,0,0,0,0,3190,0,0,0,3193,3194,0,0,0,0,0,0,0,0,0,0,0,0,2200252,2200252,2200252,0,563,563,563,563,3237,563,563,563,563,563,563,563,563,563,563,563,1400,563,563,563,563,563,563,563,3248,563,563,563,563,563,563,563,563,3256,563,563,563,563,563,3352,563,563,563,563,587,587,587,587,587,3358,563,563,563,587,587,587,3261,587,587,587,587,587,587,587,3266,587,0,0,0,0,0,3506,0,0,3509,0,0,0,0,0,541,541,541,541,3662,541,563,563,563,563,3666,563,0,3310,0,0,3313,0,0,0,0,0,0,0,0,0,0,0,0,2200253,151552,2200253,0,587,587,587,3372,587,587,587,541,541,563,563,587,587,0,0,0,0,0,0,0,0,2967,0,0,0,0,0,0,3383,3384,0,3180,0,0,0,0,0,3392,0,0,0,0,0,1097,0,0,0,0,0,0,0,0,0,0,331,382,384,0,0,0,563,3417,563,563,563,563,563,563,563,563,563,587,587,587,587,587,587,587,3115,587,587,587,587,587,587,3433,587,587,587,587,587,587,587,587,587,541,563,3472,563,3474,563,563,563,563,563,563,563,563,563,563,563,563,3243,563,563,563,3470,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3485,563,563,563,563,3532,563,563,563,563,563,563,563,563,563,587,587,3110,587,587,587,587,587,587,587,587,587,587,587,3546,587,587,587,587,587,587,587,587,587,3555,3556,0,0,0,3559,0,0,0,0,0,3565,3566,3567,541,541,541,3570,541,3572,541,541,541,541,3577,3578,3579,563,563,563,3582,563,3584,563,0,587,587,1044,587,587,291,1079,0,0,1082,1086,0,0,1090,563,563,563,3589,3590,3591,3592,587,587,587,3595,587,3597,587,587,587,587,587,1464,587,587,587,1473,587,587,587,587,587,587,1949,587,587,587,587,587,587,587,587,587,2949,587,587,587,541,587,563,587,3602,0,0,0,0,0,0,0,0,0,0,541,541,541,541,541,541,1738,541,541,541,563,3644,563,563,563,3648,563,587,587,3650,587,587,587,3654,587,0,0,0,0,0,0,0,0,3180,0,3449,0,0,0,0,0,0,0,69632,73728,266240,0,0,0,0,65536,0,0,0,0,329,330,0,0,0,0,0,0,0,0,0,0,0,349,0,0,0,0,0,369,0,0,0,0,0,0,0,0,0,0,0,0,0,0,686,0,0,0,0,369,0,0,0,377,379,0,0,0,0,0,0,0,0,1099,0,0,0,0,0,0,0,0,1115,0,0,0,0,0,0,0,0,0,3185,0,0,0,0,0,0,0,0,412,0,0,0,412,69632,73728,0,369,369,0,424,65536,369,0,0,0,369,424,499,503,499,499,508,499,499,499,508,499,424,424,0,330,424,0,0,424,424,0,0,0,0,0,0,0,0,1156,0,0,0,0,0,0,0,0,664,0,0,0,0,0,0,0,0,680,681,0,0,0,0,0,0,424,424,424,424,424,424,424,424,424,424,424,424,424,424,424,424,547,570,547,570,547,547,570,547,594,570,570,570,570,570,570,570,594,594,594,547,594,594,594,594,594,594,594,594,570,570,547,570,594,570,594,1,587,587,587,1020,587,587,587,587,587,587,587,587,587,587,587,587,1954,587,587,587,0,0,1109,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1215,0,0,0,0,0,0,0,0,0,0,0,1226,541,1279,541,541,541,541,541,1291,541,541,541,541,541,541,541,541,541,1351,541,541,541,541,541,541,1360,914,563,563,563,563,563,563,563,563,1371,563,563,563,563,563,563,2643,563,563,563,563,563,563,563,563,563,1866,563,563,563,563,563,563,1383,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2286,587,587,1992,587,587,587,587,587,587,587,587,587,587,587,587,587,2411,541,587,563,563,3677,587,587,587,0,0,541,541,563,563,587,587,0,541,3203,541,541,541,3206,541,541,541,541,541,541,541,541,541,541,1313,541,541,541,541,541,425,425,0,0,425,440,0,425,425,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,467,493,493,467,493,493,493,493,493,493,493,493,493,493,493,493,493,493,493,493,548,571,548,571,548,548,571,548,595,571,571,571,571,571,571,571,595,595,595,548,595,595,595,595,595,595,595,595,571,571,548,571,595,571,595,1,0,1213,0,0,0,0,0,0,0,0,0,0,0,0,0,0,732,0,0,0,0,0,1695,0,0,0,0,0,0,0,0,0,0,0,360,0,0,0,0,0,0,0,0,2093,0,0,0,0,0,0,0,0,0,0,0,365,365,0,0,0,2157,0,0,0,541,541,541,541,541,541,541,541,541,541,541,541,3328,541,2201,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2200,563,2415,541,541,541,2419,563,563,563,2423,587,587,587,0,0,0,0,0,0,541,541,541,541,541,541,541,563,3067,563,563,563,563,563,563,563,563,563,3253,563,563,563,563,563,563,0,2460,0,0,0,0,0,0,0,0,0,0,0,0,0,0,748,0,0,0,0,0,2791,0,0,0,0,0,0,0,0,0,0,0,365,365,1146,0,0,2943,587,587,587,587,587,587,587,587,587,587,587,587,541,587,563,541,541,0,0,0,0,2971,0,0,0,2975,0,0,0,0,0,2981,0,0,0,0,0,1128,0,0,0,0,0,1233,0,0,0,1265,0,0,0,2994,0,2996,0,0,0,0,0,0,0,0,3004,0,0,0,0,0,1169,0,1171,0,0,0,0,1176,0,0,0,0,0,0,1643,0,0,0,0,0,0,0,0,0,0,2520,0,0,0,0,541,0,0,0,0,3009,0,0,0,0,0,0,0,0,0,0,0,383,0,0,0,387,541,3063,541,541,541,3066,563,563,563,563,563,563,563,563,563,563,3083,563,563,563,563,563,563,563,3105,563,563,563,3108,587,587,587,587,587,587,587,587,587,1509,587,587,587,587,587,587,3144,587,587,3147,587,587,587,541,587,563,541,541,563,563,587,587,0,0,3295,0,0,0,0,0,0,0,0,2766,0,0,0,0,0,0,0,0,2151,0,0,0,0,0,0,0,0,2506,0,0,0,0,0,2512,0,0,0,0,0,0,3195,0,0,0,0,0,0,0,0,0,0,0,2782,0,0,0,0,541,541,541,541,3216,541,541,541,541,541,541,541,3221,541,3223,541,541,541,541,541,3408,541,541,3410,563,563,563,563,3414,563,563,563,563,1446,1447,563,563,563,26028,1360,988,587,587,587,587,587,587,3671,0,0,0,541,541,541,3674,563,563,563,563,563,587,587,3260,587,587,587,587,587,587,587,587,587,587,3274,587,587,587,587,587,587,3280,587,587,587,587,587,587,587,587,587,587,587,541,587,563,541,2722,563,3350,563,563,563,563,563,563,563,563,587,587,587,587,587,587,587,587,3655,587,587,587,587,3363,587,587,587,587,587,587,587,587,587,3369,587,0,0,0,541,587,563,541,541,541,541,541,563,563,563,563,563,3071,563,563,563,563,563,0,0,0,0,541,541,3660,3661,541,541,563,563,3664,3665,563,563,563,563,1423,563,563,1430,563,563,563,563,563,563,563,563,2631,563,563,563,563,563,563,563,587,587,3668,3669,587,587,0,0,0,0,541,541,541,541,563,563,563,924,928,931,563,939,563,563,563,954,956,959,0,0,690,691,0,0,0,0,696,0,0,0,365,365,365,0,0,0,0,0,1185,0,0,0,0,0,0,0,0,0,0,0,3180,0,0,0,0,0,0,829,0,0,0,0,0,0,0,0,0,758,0,0,0,0,0,0,758,0,0,0,0,0,758,758,910,541,563,563,563,563,927,563,563,563,563,563,563,563,563,563,1432,563,563,1436,563,563,563,983,0,587,587,587,587,1057,78115,1079,0,0,0,0,0,0,0,0,1220,0,0,0,0,0,0,0,0,0,282624,282624,282624,282624,282624,282624,282624,282624,587,1521,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1514,587,0,0,0,1721,0,0,0,0,0,0,0,0,0,0,0,0,1193,0,0,0,0,2040,0,0,0,0,0,0,0,0,0,0,0,0,0,0,749,0,2171,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2211,3288,541,3290,563,3292,587,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3514,468,468,468,486,494,494,486,494,494,494,494,494,494,494,494,519,527,527,527,527,527,527,527,527,527,527,527,527,527,527,527,536,527,527,527,527,527,549,572,549,572,549,549,572,549,596,572,572,572,572,572,572,572,596,596,596,549,596,596,596,596,596,596,596,596,572,572,549,572,596,572,596,1,795,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1652,0,818,0,0,0,795,0,0,818,0,0,0,0,0,818,818,0,0,0,0,795,0,0,0,0,0,0,836,791,0,0,836,857,541,865,541,541,541,541,541,541,541,541,541,541,541,541,541,541,3527,563,911,541,563,563,563,563,563,930,563,938,563,563,563,563,563,563,1850,563,563,563,563,563,563,563,563,563,0,587,587,587,587,587,587,587,1012,587,587,587,587,587,587,587,587,587,587,587,587,587,1058,984,0,587,587,587,1077,1058,78115,1079,0,0,0,0,0,0,0,0,1243,0,0,0,0,0,0,0,0,1259,0,0,0,1263,0,0,0,0,0,0,0,1139,1140,0,0,0,0,0,365,365,0,0,0,0,0,0,1113,0,0,0,0,0,0,0,0,0,0,2071,0,0,0,0,0,1180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1705,1340,541,541,1344,541,541,541,541,541,1350,541,541,541,1357,541,541,541,541,541,1812,541,541,541,541,541,541,541,541,541,1360,1403,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2638,563,563,1442,563,563,563,1449,563,563,26028,1360,988,587,587,587,587,587,587,3272,587,587,587,587,587,587,587,587,3278,587,587,1487,587,587,587,587,587,587,587,1495,587,587,587,587,587,587,2365,587,587,587,587,587,587,587,587,587,2691,587,587,587,587,587,587,587,587,587,1524,587,587,1528,587,587,587,587,587,1534,587,587,587,587,587,1492,587,587,587,587,587,587,587,587,587,587,1510,587,587,587,587,587,1541,587,587,0,541,587,563,541,541,541,541,541,563,563,563,563,563,3476,563,563,563,3480,563,563,563,563,563,563,2863,563,563,2867,563,563,563,563,563,563,1409,563,563,1413,563,563,563,563,563,563,1448,563,563,26028,1360,988,587,587,587,587,0,0,0,1595,0,0,0,0,0,0,0,0,0,0,0,0,1223,0,0,0,0,0,1655,0,0,0,0,0,0,0,0,0,1664,0,0,0,0,0,0,1126,0,0,0,1130,1131,0,0,0,0,0,0,0,2818048,2846720,0,2916352,0,0,3002368,0,0,1718,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2053,1702,0,0,0,0,0,541,541,541,541,541,541,541,541,541,541,3326,541,541,541,563,563,563,1893,563,563,563,563,563,563,1901,563,563,563,563,563,563,2887,563,563,563,2890,563,2892,563,563,563,587,1944,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1940,587,587,1974,587,587,587,587,1980,587,587,587,587,587,587,587,587,1989,2007,2009,587,587,587,587,587,541,587,563,541,541,541,541,563,563,563,563,587,587,587,587,2030,0,2032,0,0,2079,0,0,0,2082,0,0,0,0,0,2088,0,0,0,0,0,0,1141,0,1143,0,0,365,365,0,0,0,0,0,0,1154,0,0,0,0,0,1160,0,1162,0,2104,0,0,0,0,0,0,0,0,0,0,0,0,0,2115,0,0,0,0,0,1192,0,0,0,0,0,0,0,0,0,0,0,176128,176128,176128,176128,176128,176128,176128,0,0,563,563,563,563,563,563,2250,563,563,563,563,563,563,563,1851,563,563,563,563,1855,563,563,563,587,587,587,587,2349,587,587,587,587,587,587,587,587,587,587,587,1985,587,587,1988,587,2262,541,541,541,541,563,563,563,563,587,587,587,587,0,0,0,0,0,2732,0,2450,0,0,0,0,0,0,0,0,2455,0,0,2458,0,0,0,0,0,0,2134016,0,0,0,0,0,0,57344,0,0,0,0,0,0,2748,0,0,0,0,0,0,0,0,0,0,192972,192972,192972,192972,192972,192972,192972,0,0,0,0,2462,0,0,0,0,0,0,0,0,0,0,0,541,541,541,2809,541,2473,0,0,0,0,0,0,0,2481,0,0,0,2483,0,0,0,0,0,0,1170,0,0,0,0,0,0,0,0,0,0,2989,0,0,0,0,0,0,2500,0,0,0,0,0,0,0,0,0,0,2510,0,0,0,0,0,0,1186,0,0,0,1191,0,0,0,0,1107,0,0,0,0,0,0,0,0,0,0,0,758,0,0,0,0,0,0,0,2524,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2536,541,541,2552,541,541,541,541,541,541,541,541,541,541,541,541,541,905,541,541,2564,541,541,541,541,541,541,2571,541,541,541,541,541,541,541,541,541,1768,541,541,541,541,541,541,541,2578,541,541,541,2581,541,541,541,541,541,541,541,0,0,0,0,0,0,1203,0,0,0,0,0,0,0,0,0,0,813,0,0,0,0,0,0,0,0,563,2588,563,563,563,563,563,563,563,563,563,563,563,1903,1904,563,563,563,2611,563,563,563,563,563,563,2616,563,563,563,563,563,563,563,2622,587,587,587,587,2702,587,587,587,587,587,587,587,587,587,587,2710,587,587,587,2713,587,587,587,587,587,587,587,2718,2719,2720,541,541,541,541,541,2177,541,541,541,541,541,541,541,541,541,541,541,541,2845,541,541,541,2758,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2103,0,2773,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1120,0,0,0,2789,0,0,0,0,2794,0,0,0,2796,0,0,0,0,0,0,0,69632,73728,316,317,317,422,423,65536,430,541,541,541,541,2814,541,541,541,541,541,541,541,541,541,541,541,541,1333,541,541,541,541,541,2848,541,541,541,541,541,541,0,0,563,563,563,2856,563,0,587,587,1047,587,587,78115,1079,0,0,0,0,0,0,0,0,1159168,365,0,0,0,0,0,0,563,563,563,563,2861,563,563,563,563,563,563,563,563,563,563,563,2294,563,563,563,563,563,563,563,563,2897,563,563,563,563,563,563,0,0,587,587,587,587,587,587,587,2338,587,587,587,587,587,587,587,3122,587,587,587,587,587,587,587,587,1036,587,587,587,587,1054,587,587,2905,587,587,587,587,587,2910,587,587,587,587,587,587,587,587,587,1935,587,587,587,587,1941,587,3006,0,0,0,0,3010,0,0,0,0,3015,0,0,0,0,0,0,0,2749,0,0,0,0,0,0,0,0,0,697,698,0,365,365,365,0,3191,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2145,3300,0,0,0,0,0,0,0,0,0,0,3180,0,0,0,0,0,0,0,69632,73728,163840,0,0,0,0,65536,0,563,563,563,3340,563,563,563,563,563,563,563,563,563,563,563,563,2283,563,563,563,563,563,563,3351,563,563,563,563,563,563,587,587,587,587,587,587,587,587,587,587,587,587,587,3359,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1942,3370,587,587,587,587,587,587,541,541,563,563,587,587,0,0,0,0,3297,0,0,0,0,0,0,0,0,0,3394,0,541,541,541,541,541,541,541,541,541,541,541,541,3211,541,541,3486,587,587,587,587,587,587,587,587,3495,587,3497,3498,587,3500,587,0,0,0,541,587,563,541,541,541,904,541,563,563,563,977,3502,0,0,0,0,0,0,0,0,0,0,0,0,0,0,541,541,541,854,541,541,3612,541,3613,541,541,541,563,563,563,563,563,563,3619,563,0,996,1075,1041,587,587,78115,1079,0,0,1081,1085,0,0,1089,3620,563,563,563,563,587,587,587,587,587,587,3627,587,3628,587,587,0,3603,0,0,0,0,0,0,0,0,541,541,3610,541,563,563,587,587,587,587,0,0,541,541,563,563,587,587,3683,3684,3685,3686,0,541,563,587,0,541,563,587,0,541,563,587,0,0,0,0,0,0,0,0,3180,0,0,0,0,0,0,0,550,597,573,573,573,573,573,573,573,597,597,597,550,597,597,597,597,597,597,597,597,573,573,550,573,597,573,597,1,0,0,0,737,0,0,0,0,0,0,0,0,0,0,0,0,1237,0,0,0,0,0,2041,0,0,0,0,0,0,0,0,0,0,0,0,0,1194,1196,0,403,0,0,0,0,381,0,69632,73728,0,0,0,0,426,65536,0,0,0,0,0,1202,0,0,0,0,0,0,0,0,0,0,0,2444,2445,0,0,2448,426,426,0,0,426,0,446,426,426,469,469,469,476,469,469,469,469,469,469,469,469,469,476,469,469,469,469,469,469,469,469,483,469,495,495,469,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,495,538,551,574,551,574,551,551,574,551,598,574,574,574,574,574,574,574,598,598,598,551,598,598,598,598,598,598,598,598,574,574,551,574,598,574,598,1,0,0,0,0,660,661,0,0,0,0,0,0,0,0,0,0,0,3001,0,0,0,0,0,0,0,0,661,0,0,0,0,0,0,0,0,0,0,0,661,0,0,0,0,0,827,0,0,0,661,0,0,0,0,0,0,0,0,0,0,0,3176,0,0,0,0,0,0,0,729,0,742,661,0,0,0,0,0,541,844,541,541,541,541,541,2191,541,541,541,541,541,541,2197,541,2199,541,541,859,541,541,541,541,541,541,541,541,541,541,897,541,541,541,541,541,541,2817,541,2819,541,541,541,541,541,541,541,541,2572,541,541,541,541,541,541,541,541,1349,541,541,541,541,541,541,541,541,1752,541,541,541,541,541,541,541,541,1767,541,541,541,541,541,541,541,541,1782,541,541,541,541,541,541,541,541,1815,1817,541,541,541,541,541,1360,563,563,563,970,563,563,563,563,563,0,587,587,990,587,587,587,587,587,1526,587,587,587,587,587,587,587,587,587,587,1953,587,587,587,587,587,1006,587,587,587,587,587,587,587,587,587,587,1044,587,587,587,587,587,587,3285,587,587,587,587,587,587,541,587,563,1094,0,0,0,0,0,0,0,0,0,1101,1102,0,0,0,0,0,0,0,69632,73728,167936,0,0,0,0,65536,0,0,0,0,1229,0,0,0,0,0,0,0,0,0,0,0,0,1247,0,0,0,0,0,0,0,1102,0,0,0,0,1260,1261,0,0,1101,0,0,0,0,0,0,2134756,0,0,0,0,0,0,0,0,0,0,1116,0,0,0,0,0,541,1306,541,541,541,541,541,541,541,541,541,541,541,541,541,541,0,2241,1360,914,563,1363,563,563,563,563,563,563,563,563,563,563,563,1377,1384,563,563,563,563,563,563,563,563,563,1398,563,563,563,563,563,563,3079,563,563,563,563,563,563,563,563,563,0,587,587,989,587,587,587,1418,563,563,563,563,563,563,563,1431,563,563,563,563,563,563,563,1897,563,563,563,563,563,563,563,563,1395,563,563,563,563,563,563,563,587,587,1523,587,587,587,587,587,587,587,587,587,587,587,1537,587,0,0,0,541,587,563,541,541,541,1067,911,563,563,563,1072,563,587,587,1523,587,587,1079,0,0,0,0,0,0,0,0,0,0,2781,0,0,0,0,0,541,541,541,1746,1747,541,541,541,541,1754,541,541,541,541,541,541,541,1290,541,1295,541,541,1299,541,541,1302,541,541,541,541,1795,541,541,541,541,541,541,541,541,541,541,541,541,1335,541,541,541,1825,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1841,1842,563,563,563,563,1849,563,563,563,563,563,563,563,563,563,563,3347,563,563,563,563,3348,1890,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2649,587,1945,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2372,587,587,1959,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2384,2385,587,587,587,587,2012,587,587,541,587,563,541,541,541,541,563,563,587,587,2961,0,0,2964,2965,0,0,0,0,0,0,0,2505,0,0,0,0,0,0,0,0,0,387,0,0,0,0,0,387,0,0,0,2054,0,2055,0,0,0,0,0,0,0,0,0,2064,541,541,541,541,2216,541,541,541,541,541,541,2221,541,541,541,541,541,541,1285,1292,541,541,541,541,541,541,541,541,541,1800,541,541,541,1805,541,541,541,2226,541,541,541,541,541,541,541,541,541,541,541,541,0,0,563,563,563,563,563,563,563,563,2302,563,563,563,563,563,563,2307,563,563,563,563,563,563,3080,563,563,563,563,563,563,563,563,563,1883,563,563,563,563,563,563,563,2313,563,563,563,563,563,563,563,563,563,563,563,563,0,0,587,587,587,587,587,587,2389,587,587,587,587,587,587,2394,587,587,587,587,587,587,2377,587,587,587,587,587,587,587,587,587,1952,587,587,587,587,1956,587,587,2400,587,587,587,587,587,587,587,587,587,587,587,587,541,587,0,0,0,541,587,563,541,541,895,541,541,563,563,968,563,0,587,587,587,587,587,78115,1079,0,0,1082,1086,0,0,1090,0,2437,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1178,0,587,2671,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2931,587,0,0,0,2736,0,0,0,0,0,0,0,0,0,0,0,0,1588,1589,0,0,2787,0,0,0,0,0,0,0,0,0,0,0,2797,0,0,0,0,0,0,1204,0,0,0,0,0,0,0,0,0,0,1631,0,0,0,0,0,541,541,541,2813,541,541,541,541,541,541,2821,541,541,541,541,541,541,541,2555,541,541,541,541,541,541,541,2562,563,563,563,2860,563,563,563,563,563,563,2868,563,563,563,563,563,563,3094,563,563,3096,563,563,563,563,563,563,1880,1881,1882,563,563,1885,1886,563,563,563,0,0,3008,0,0,0,0,0,0,0,0,0,0,0,0,0,1197,0,0,541,541,3227,541,541,541,541,541,541,563,563,563,563,563,563,563,3073,563,563,563,3571,541,3573,541,541,541,563,563,563,563,563,563,563,3583,563,3585,0,0,0,0,541,3659,541,541,541,541,563,3663,563,563,563,563,563,1878,563,563,563,563,1884,563,563,563,563,563,563,2864,563,2866,563,563,563,563,563,563,563,3354,563,563,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,1057,587,3667,587,587,587,587,0,0,0,0,541,541,541,541,563,563,915,563,563,563,563,563,563,946,563,563,563,563,563,1427,563,563,563,563,563,563,563,563,563,563,3535,563,563,563,563,563,563,587,587,587,587,3112,587,587,587,587,3116,470,470,470,470,454,454,470,454,454,454,454,454,454,454,454,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,520,552,575,552,575,552,552,575,552,599,575,575,575,575,575,575,575,599,599,599,552,599,599,599,599,599,599,599,599,575,575,552,575,599,575,599,1,541,860,541,541,874,541,541,541,541,541,541,541,541,541,541,541,541,1770,541,541,541,1007,587,587,1021,587,587,587,587,587,587,587,587,587,587,587,587,1971,587,587,587,0,1123,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1184,1184,1251,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2156,0,0,0,1268,0,0,0,0,0,0,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1360,541,541,541,1323,541,541,541,541,541,541,541,541,541,541,541,541,541,2534,541,541,541,1341,541,541,541,541,541,1348,541,541,541,541,541,541,541,541,541,2234,541,541,541,541,0,0,1440,563,563,563,563,563,563,563,563,26028,1360,988,587,587,587,587,587,587,3365,587,587,587,587,587,587,587,587,587,2936,587,587,587,2939,587,2941,587,587,587,587,587,1525,587,587,587,587,587,1532,587,587,587,587,587,587,2392,587,587,587,587,587,587,587,587,587,1472,587,587,587,587,1482,587,563,587,587,587,1557,587,1079,0,1561,0,0,0,1567,0,0,0,0,0,0,1218,1219,0,0,0,0,0,0,0,0,0,1235,0,0,0,0,0,0,1573,0,0,0,1579,0,0,0,0,0,0,0,0,0,0,0,662,0,0,0,0,0,0,0,0,0,0,0,541,541,541,1779,541,541,541,541,541,541,541,541,541,541,541,541,541,2548,541,541,563,1843,563,563,563,563,563,563,563,563,563,1854,563,563,563,563,563,1879,563,563,563,563,563,563,563,563,563,563,3344,563,563,563,563,563,563,563,563,1865,563,563,563,563,563,563,563,2065,2066,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1210,0,2117,0,0,2120,2121,0,0,0,0,0,2127,0,0,0,0,0,0,0,2765,0,0,0,0,0,0,0,0,0,550,573,550,573,550,550,573,541,2213,541,541,541,541,2218,541,541,541,541,541,541,541,541,541,541,2182,541,541,541,541,541,2299,563,563,563,563,2304,563,563,563,563,563,563,563,563,563,563,1917,563,26028,0,587,587,587,2386,587,587,587,587,2391,587,587,587,587,587,587,587,587,587,587,2001,587,587,587,587,587,2006,541,541,541,3037,541,541,541,541,541,541,541,541,541,541,541,541,541,2846,541,541,563,563,3077,563,563,563,563,563,563,563,563,563,563,563,563,563,1887,1888,563,587,587,587,3119,587,587,587,587,587,587,587,587,587,587,587,587,1986,587,587,587,563,563,3247,563,563,563,563,563,563,563,563,563,563,563,563,563,2296,563,563,587,0,0,0,3445,0,0,0,0,3180,0,0,0,0,0,0,0,1242,0,0,0,0,0,0,0,0,0,380,0,0,0,0,0,0,0,0,541,541,541,541,3460,541,541,541,541,541,541,541,541,541,541,2207,541,541,541,541,541,563,587,587,587,587,3491,587,587,587,587,587,587,587,587,587,587,2354,587,587,587,587,587,587,563,563,563,563,3623,587,587,587,587,587,587,587,587,587,587,587,2395,587,587,587,587,587,3631,0,0,0,0,0,0,541,541,541,541,541,541,541,563,563,920,563,563,563,563,563,563,949,951,563,563,563,563,563,3421,563,563,563,3425,563,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3501,388,390,340,0,0,0,0,0,0,339,0,0,340,0,0,0,0,0,0,1598,0,0,0,0,0,0,0,0,1604,0,0,0,387,0,0,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,0,1217,0,0,0,0,0,0,0,1224,0,0,0,0,0,347,0,0,0,0,0,0,0,0,0,0,0,3316,0,0,0,0,0,0,435,339,0,0,447,0,0,471,471,471,471,471,471,471,471,471,553,576,553,576,553,553,576,471,482,471,471,471,500,477,500,500,500,500,500,500,500,500,471,471,477,471,471,471,471,471,471,471,471,471,471,471,481,481,471,482,471,471,553,600,576,576,576,576,576,576,576,600,600,600,553,600,600,600,600,600,600,600,600,576,576,553,576,600,576,600,1,0,0,750,0,0,0,0,0,0,0,0,0,0,0,0,0,1603,0,0,0,0,0,0,663,0,788,0,0,0,0,0,0,0,792,0,0,0,0,0,1231,0,0,0,0,0,0,0,0,0,0,0,2153,0,0,0,0,0,0,0,801,0,0,0,0,0,809,0,0,0,0,706,0,0,0,0,0,0,0,0,715,0,717,0,828,0,0,0,663,831,0,788,0,0,0,0,0,837,0,0,0,0,0,1597,0,0,0,577536,0,0,1602,0,0,0,0,0,0,1257,0,0,0,0,0,0,0,0,0,0,2508,0,0,0,0,0,541,861,541,541,875,541,541,541,541,888,541,541,541,541,906,541,541,541,541,541,3519,541,541,541,541,541,541,541,541,563,563,563,923,563,929,563,563,942,563,563,953,563,958,961,563,563,563,563,979,563,563,563,0,587,587,991,587,587,587,587,587,1962,587,587,587,587,587,587,587,587,587,587,3287,587,587,587,541,587,563,1008,587,587,1022,587,587,587,587,1035,587,587,587,587,1053,587,587,587,587,587,2945,587,587,2948,587,587,2951,587,2952,2953,2954,0,0,0,0,1216,0,0,0,0,1221,0,0,0,0,0,0,0,1258,0,0,0,0,0,0,0,0,0,365,299,0,0,0,0,0,0,1144,0,0,1256,0,0,0,0,0,0,0,0,1235,0,0,0,0,0,0,2891776,0,0,0,0,0,2392064,2412544,0,0,0,0,0,0,2123,0,0,0,0,0,0,0,0,0,0,2727936,0,0,0,3084288,0,0,0,1267,0,0,0,0,0,0,0,541,541,541,541,541,541,541,541,541,1741,541,541,541,1309,541,541,541,541,541,541,541,541,541,541,541,541,541,3045,541,3047,563,587,587,1556,587,587,1079,0,0,0,0,0,0,0,0,0,0,3e3,0,0,0,0,0,1621,0,0,1624,0,1626,0,0,0,0,0,0,0,0,0,0,0,3198,3199,0,0,0,0,0,0,0,1722,0,0,0,0,0,0,0,0,0,0,0,683,684,685,0,0,541,541,541,541,1780,541,541,541,541,541,541,541,541,541,541,541,541,1820,541,541,1360,0,563,563,563,563,563,563,563,563,563,563,1836,563,563,563,563,563,2263,563,563,563,563,563,563,563,563,563,563,1433,563,563,563,563,563,1875,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2872,1943,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2359,0,0,2135,0,0,0,0,0,0,0,0,0,0,0,0,0,1618,0,0,2146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2484,0,0,0,0,541,541,541,2163,2164,541,541,541,541,541,541,541,541,2180,541,541,541,541,2185,541,541,541,541,541,2228,541,541,541,541,541,541,541,541,541,541,0,0,563,563,563,563,2857,0,0,563,563,563,2247,563,2249,563,563,563,563,563,563,563,563,2320,563,563,563,563,563,0,0,563,563,563,2315,563,563,563,563,563,563,563,563,563,563,0,0,988,587,587,587,587,0,0,587,587,587,2334,587,2336,587,587,587,587,587,587,587,587,1965,1966,1968,587,587,587,587,587,587,587,587,2402,587,587,587,587,587,587,587,587,587,587,541,587,0,0,0,541,587,563,541,541,897,541,541,563,563,970,563,0,997,587,1076,1048,587,78115,1079,0,0,0,0,0,0,0,0,458,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,1147355,0,0,2438,0,0,0,0,0,0,2443,0,0,0,2446,2447,0,0,0,0,0,1610,0,0,1613,0,0,0,0,0,0,0,0,1584,0,0,0,0,0,0,0,0,1683,0,0,0,0,0,0,0,0,334,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1134,0,0,0,0,2487,0,0,0,0,0,0,0,0,0,0,0,2498,0,0,0,2515,0,0,0,0,0,0,0,0,0,2523,0,541,541,541,541,541,3576,563,563,563,3580,563,563,563,563,563,563,2290,563,563,563,563,563,563,563,563,563,1899,563,563,563,563,563,1906,2537,2538,541,541,541,541,541,2543,541,2545,541,541,541,541,2549,541,541,541,541,541,3614,3615,541,563,563,563,563,563,563,563,563,3424,563,563,587,587,587,587,587,563,563,2598,563,563,2601,2602,563,563,563,563,563,2607,563,2609,563,0,999,1039,587,1050,587,78115,1079,0,0,0,0,0,0,0,0,3184,0,0,0,0,0,0,0,0,2750,0,0,0,0,0,0,0,0,0,2732032,0,0,0,0,0,0,563,563,563,2613,563,563,563,563,563,563,563,563,2619,563,563,563,563,563,3624,587,587,587,587,587,587,587,587,587,587,1967,587,587,587,1972,587,587,563,2639,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1402,563,587,587,587,2673,587,2675,587,587,587,587,2679,587,587,587,587,587,587,2676,587,587,587,587,587,587,587,587,587,1469,1476,587,587,587,587,587,587,587,587,2685,587,587,587,587,587,587,587,587,2693,587,587,587,587,587,1979,587,587,587,587,587,587,587,587,587,587,2926,2927,587,587,587,587,2930,587,587,587,587,587,2701,587,587,587,587,2705,587,587,587,587,587,587,587,2378,2379,587,587,587,587,587,587,587,2406,587,587,2409,2410,587,587,2176,2348,0,2745,0,0,0,0,0,0,0,2751,2752,2753,0,0,0,0,0,0,0,69632,73728,172032,0,0,0,0,65536,0,2772,0,2774,0,0,0,0,2778,0,0,0,0,2783,0,0,2786,541,541,2828,541,541,541,541,541,541,541,541,541,541,541,541,541,1771,541,541,541,541,541,2838,541,541,541,541,541,541,541,541,541,541,541,541,541,3337,563,563,541,2847,541,541,2850,541,541,2853,541,0,0,2854,563,563,563,563,563,2277,563,563,2280,563,563,563,563,563,563,563,3081,563,563,563,563,563,563,563,563,3355,563,587,587,587,587,587,587,563,563,2875,563,563,563,563,563,563,563,563,563,563,563,563,563,2324,0,0,563,563,563,563,2886,563,563,563,563,563,563,563,563,563,563,563,2606,563,2608,563,563,563,563,563,2896,563,563,2899,563,563,2902,563,0,0,2903,587,587,587,587,587,3284,587,587,587,587,587,587,587,541,587,563,541,541,563,563,587,587,587,2921,587,587,2924,587,587,587,587,587,587,587,587,587,587,587,2666,587,587,587,587,0,0,0,0,0,2972,2973,0,0,0,0,2978,0,0,0,0,0,0,0,69632,73728,221184,0,0,0,0,65536,0,3021,0,0,3023,0,0,541,541,3028,541,541,541,541,541,541,541,541,2205,2206,541,541,541,541,541,541,0,0,3160,0,3162,0,0,0,3166,0,0,0,0,0,0,0,0,2518,0,0,0,0,0,0,541,541,541,541,3030,541,541,541,541,3034,3234,3235,563,563,563,563,3239,3240,563,563,563,563,563,3244,563,563,563,563,1445,563,563,563,563,26028,1360,988,587,1455,587,587,0,3632,0,0,0,0,541,541,541,541,541,3641,541,563,563,563,563,587,587,587,587,587,587,587,3263,3264,587,587,587,587,587,587,3435,587,587,587,587,587,587,587,541,563,3268,3269,587,587,587,587,587,3273,587,587,587,587,587,587,587,587,2393,587,587,587,587,587,587,587,3279,587,587,587,587,587,587,587,587,587,587,587,587,541,587,563,2721,541,0,0,0,3312,0,0,0,0,0,0,0,0,0,0,0,0,1633,0,0,0,541,3404,541,541,541,541,541,541,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3419,563,563,563,563,563,563,563,587,587,587,587,587,3113,587,587,587,587,587,0,3443,0,0,3446,0,0,0,3180,0,0,0,0,0,0,0,1583,0,1585,0,0,0,0,0,0,0,1106,0,0,0,0,0,0,0,0,0,756,0,0,0,0,0,0,0,0,541,541,3458,541,541,541,541,3463,541,541,541,541,3468,541,541,541,541,872,541,541,541,541,541,541,541,541,541,541,541,541,1316,541,541,541,563,587,587,3489,587,587,587,587,3494,587,587,587,587,3499,587,587,587,587,587,3364,587,587,587,587,587,587,587,587,587,587,2664,587,587,2667,2668,587,587,563,563,3645,3646,563,563,563,587,587,587,3651,3652,587,587,587,0,541,587,563,541,541,541,541,541,563,563,563,563,587,587,587,587,0,0,0,2730,0,0,563,587,0,541,563,587,3691,3692,3693,3694,0,541,563,587,0,0,0,0,0,0,0,0,3180,0,0,0,0,0,3453,342,343,344,345,346,0,0,0,0,0,0,0,0,0,0,0,713,0,0,0,0,0,0,0,391,0,0,0,0,0,0,0,0,0,0,0,0,1674,0,0,0,345,345,0,346,345,0,344,345,455,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,472,487,496,496,504,496,506,496,496,506,506,496,506,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,521,554,577,554,577,554,554,577,554,601,577,577,577,577,577,577,577,601,601,601,554,601,601,601,601,601,601,601,601,577,577,554,577,601,577,601,1,656,657,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1590,1591,672,673,0,675,676,0,0,0,0,0,682,0,0,0,0,0,0,0,2804,0,0,0,541,2808,541,541,541,0,0,0,0,692,0,0,0,0,0,0,699,365,365,365,0,0,0,0,0,1658,0,0,0,0,0,0,0,0,0,0,0,3180,0,0,0,3308,0,719,0,721,0,723,0,0,0,0,0,0,0,0,0,733,0,0,0,0,646,752,753,754,0,0,0,0,0,760,761,0,0,0,0,0,1680,0,0,0,0,0,0,0,0,0,0,0,3180,0,3306,0,0,763,764,675,0,0,0,0,0,0,0,0,0,0,779,780,0,0,0,0,0,1696,1697,1698,1699,0,0,0,0,0,0,0,0,755,0,0,0,0,0,0,0,0,772,0,0,0,0,0,0,0,0,782,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1601,0,0,761,0,0,787,0,0,0,0,0,0,0,0,0,794,675,723,0,692,811,0,0,0,0,761,0,0,0,0,0,0,0,1591,0,0,0,0,0,0,0,0,0,1662,0,0,0,0,0,0,0,0,754,820,821,0,0,0,0,0,0,754,0,0,825,699,0,0,0,830,0,0,0,832,0,0,0,692,699,0,0,692,830,830,0,0,0,0,0,0,0,0,0,692,541,541,851,855,858,541,866,541,541,541,881,883,886,541,541,541,898,902,541,541,541,541,541,2541,541,541,541,541,541,541,541,541,541,541,541,541,3044,541,541,541,563,563,563,971,975,563,563,563,563,0,587,587,587,998,1002,1005,587,1013,587,587,587,1028,1030,1033,587,587,587,1045,1049,587,587,587,587,587,1995,587,587,587,587,587,2002,587,587,587,587,587,587,2946,587,587,587,587,587,587,541,587,563,1073,0,998,587,1045,1049,1078,78115,1079,0,0,0,0,0,0,0,0,2779,0,0,0,0,0,0,0,0,303,303,303,303,0,303,303,303,0,0,0,0,1168,0,0,0,0,0,0,0,0,0,0,0,729,0,0,0,0,0,0,1199,0,0,0,0,0,0,0,0,0,0,1209,0,0,0,0,0,0,2912256,0,3207168,2465792,0,0,2719744,0,0,0,0,0,0,541,541,541,3397,541,541,541,541,3401,541,0,0,1214,0,0,0,0,0,0,0,0,0,0,0,0,0,1634,0,0,0,0,1254,0,0,0,0,0,0,0,0,0,0,0,0,0,1665,0,0,1321,541,541,541,541,541,541,541,541,541,541,1331,541,541,1338,541,541,541,541,873,541,541,541,541,541,541,541,541,541,541,541,541,1332,541,541,541,563,563,1443,563,563,563,563,563,563,26028,1360,988,587,587,587,587,587,587,3548,587,3550,587,587,3552,587,587,0,0,0,0,0,0,541,541,541,3639,3640,541,541,563,1501,587,587,1505,587,587,587,587,587,587,587,587,587,587,1515,587,0,0,0,541,587,563,541,541,899,541,541,563,563,972,563,0,1074,587,587,1052,587,78115,1079,0,0,0,0,0,0,0,0,2445312,0,2842624,0,0,0,2637824,0,587,1522,587,587,587,587,587,587,587,587,587,587,1535,587,587,587,587,587,2013,587,541,587,563,541,541,541,541,563,563,563,563,587,587,587,587,0,0,0,0,0,0,1666,0,1668,0,0,0,1670,0,748,0,0,0,0,0,0,0,0,3174,0,0,0,0,0,0,0,0,791,0,0,0,0,0,0,0,0,833,0,0,0,0,0,0,808,0,0,1693,0,0,0,0,0,0,1700,0,0,0,0,0,0,0,1660,1661,0,0,0,0,0,0,0,0,710,0,0,0,0,0,0,0,0,726,0,0,0,0,0,0,0,0,0,274432,274432,274432,0,274432,274432,274432,541,541,1762,541,541,541,541,541,541,541,541,1769,541,541,541,1773,541,541,1778,541,541,541,541,541,541,541,541,541,541,541,541,541,1788,541,541,0,563,1828,563,563,563,563,563,563,563,1835,563,563,563,563,563,563,3250,563,563,563,563,563,563,563,563,563,2321,563,563,563,563,0,0,563,1908,563,563,563,563,563,563,563,563,563,26028,0,587,1924,587,0,0,0,541,587,563,541,541,900,541,541,563,563,973,563,563,563,563,2262,563,563,563,563,563,563,563,563,563,563,563,1434,563,563,563,563,587,587,587,1960,587,587,587,1964,587,587,1969,587,587,587,587,587,587,2688,587,587,587,587,587,587,2695,587,587,563,563,587,587,587,587,0,0,0,2031,0,1082,0,0,0,2033,0,1086,0,0,0,2035,0,1090,0,0,0,2037,0,1094,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1620,2587,0,1825,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2610,2650,563,563,563,0,0,0,2653,0,1921,587,587,587,587,587,587,587,3549,587,587,587,587,587,587,0,0,3672,0,541,541,541,541,563,563,0,0,2969,0,0,0,0,0,0,0,0,0,0,0,0,0,2102,0,0,0,0,0,3161,0,0,0,0,0,0,0,0,0,0,0,0,1703,0,0,0,0,0,3319,541,541,541,541,541,541,541,3324,541,541,541,541,541,541,541,2832,541,541,541,541,541,541,541,541,541,2573,541,541,541,541,541,541,587,587,3361,587,587,587,587,587,587,587,587,587,587,587,587,587,2709,587,587,3379,0,0,3382,0,0,0,0,3180,3387,0,0,0,0,0,0,0,1682,0,1684,0,0,0,0,0,0,0,1114,0,0,0,0,1118,0,0,1121,541,541,541,541,3407,541,541,541,563,563,563,3412,563,563,563,563,563,2289,563,563,563,563,563,563,563,563,563,563,2605,563,563,563,563,563,3416,563,563,563,563,563,3422,563,563,563,563,587,587,587,3428,587,0,0,0,541,587,563,850,541,1066,901,541,923,563,1071,974,587,587,587,3432,587,587,587,587,587,3438,587,587,587,587,541,563,563,563,563,2276,563,563,563,563,563,563,2282,563,2284,563,2287,563,587,587,587,587,587,3492,587,587,587,3496,587,587,587,587,587,587,2704,587,587,587,587,587,587,587,587,587,1470,587,587,587,587,587,587,0,0,3657,0,541,541,541,541,541,541,563,563,563,563,563,563,936,563,563,563,563,563,563,563,563,587,3687,3688,3689,3690,0,541,563,587,0,541,563,587,0,0,0,0,0,0,0,0,3180,0,0,3450,3451,0,0,389,0,0,0,393,389,0,0,0,0,0,0,0,0,0,0,0,122880,0,0,0,0,0,0,0,405,0,347,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,0,1709,0,0,0,0,0,0,0,0,0,0,399,0,0,0,0,0,0,0,436,0,0,443,0,0,0,0,0,0,0,0,0,0,0,131072,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,522,522,522,522,522,0,0,0,0,0,0,0,0,0,522,522,522,522,522,522,522,522,522,555,578,555,578,555,555,578,555,602,578,578,578,578,578,578,578,602,602,602,555,602,602,602,602,602,602,602,602,578,578,617,622,602,622,628,1,0,0,0,751,0,0,0,0,0,0,0,0,0,0,0,0,2061,0,0,0,962,563,563,563,563,980,563,563,563,0,587,587,992,587,587,587,587,587,2350,587,587,587,587,587,587,587,587,587,587,1936,587,587,587,587,587,1107,0,0,0,0,1112,0,0,0,0,0,0,0,0,0,0,0,167936,167936,167936,167936,167936,167936,167936,1360,914,563,563,563,1366,563,563,563,563,563,563,563,563,563,1380,563,563,1404,563,563,563,563,563,563,563,563,563,563,563,563,563,2620,563,563,563,1441,563,563,563,563,563,563,563,26028,1360,988,587,587,587,1458,563,587,587,587,587,587,1079,0,1562,0,0,0,1568,0,0,0,0,0,0,1627,1628,1629,0,0,0,0,0,0,0,0,343,0,0,0,0,0,0,0,0,403,0,0,0,0,0,0,0,0,407,407,407,407,0,407,407,407,1574,0,0,0,1580,0,0,0,0,0,0,0,0,0,0,0,808,541,541,852,541,1605,0,0,0,0,0,0,0,0,0,0,0,0,0,1619,0,0,0,0,0,1723,0,0,0,0,0,0,0,0,0,0,0,2625536,0,2699264,2715648,0,1973,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2373,563,563,587,587,587,587,0,0,1563,0,0,0,0,0,1569,0,1575,0,1581,0,0,0,0,0,0,0,0,0,0,0,1262,0,0,0,0,0,0,0,0,1575,0,0,0,0,0,1581,0,0,0,0,0,0,0,2974,0,0,0,0,0,0,0,0,0,365,0,253952,0,0,0,0,541,541,541,2190,541,541,541,541,2194,541,2196,541,541,541,541,541,541,541,3039,541,541,541,541,541,541,541,541,541,887,541,541,541,541,541,541,563,563,2275,563,563,563,563,2279,563,2281,563,563,563,563,563,563,1896,563,563,563,563,563,563,563,563,563,1397,1399,563,563,563,563,563,587,587,2362,587,587,587,587,2366,587,2368,587,587,587,587,587,587,1465,587,587,587,587,587,587,1480,587,587,0,0,0,0,0,2489,0,0,0,0,0,0,0,0,0,0,0,196608,0,0,0,0,563,563,2625,563,563,563,563,563,563,563,563,563,563,563,563,563,2648,563,563,0,0,0,0,3024,0,541,541,541,541,541,541,541,541,541,541,541,1330,541,541,541,541,0,3380,0,0,0,0,0,0,3180,0,0,0,0,3391,0,0,0,0,0,328,0,69632,73728,0,0,0,0,0,65536,0,3393,0,0,0,0,0,541,3396,541,541,3398,541,541,541,541,541,541,541,3040,541,541,541,541,541,541,541,541,541,1783,541,541,541,541,1789,541,0,3455,541,541,541,541,541,541,541,541,541,541,541,541,541,541,563,563,563,541,862,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1319,541,541,912,563,563,563,563,563,563,935,563,563,563,563,563,563,563,2291,2292,563,563,563,563,563,563,563,2319,563,563,2322,2323,563,563,0,0,1009,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2697,1059,0,0,0,541,587,563,541,541,541,541,541,563,563,563,563,563,2614,563,563,563,563,563,563,563,563,563,563,3649,587,587,587,587,587,587,587,0,1095,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2513,0,0,1623,0,0,0,0,0,0,0,0,0,0,0,0,0,2130,0,2132,1826,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3258,541,3215,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1337,541,587,587,587,3271,587,587,587,587,587,587,587,587,587,587,587,587,2370,587,587,587,0,0,0,0,348,348,350,348,348,348,348,348,348,513,348,348,0,350,348,0,0,348,348,0,0,0,0,349,0,0,0,0,0,329,0,0,0,0,0,0,0,0,0,0,0,2509,0,0,0,0,348,348,348,348,348,348,348,348,348,348,348,348,348,348,348,348,556,579,556,579,556,556,579,556,603,579,579,579,579,579,579,579,603,603,603,556,603,603,603,603,603,603,603,603,579,579,556,579,603,579,603,1,0,0,0,0,722,0,724,0,0,0,0,0,0,0,0,0,299,0,0,0,0,0,0,0,0,0,0,739,0,0,0,0,0,0,0,0,0,0,0,836,541,541,541,541,0,0,0,766,0,0,0,771,0,0,0,0,0,0,0,0,0,1189,0,0,0,0,0,0,541,541,541,870,541,541,541,541,541,890,892,541,541,903,541,541,541,541,541,2569,541,541,541,541,541,541,541,541,541,541,541,541,2835,541,541,541,963,965,563,563,976,563,563,563,563,0,587,587,993,999,587,587,587,587,587,3374,587,541,541,563,563,587,587,0,0,0,0,0,0,3299,0,0,0,587,587,1017,587,587,587,587,587,1037,1039,587,587,1050,587,587,587,587,587,2364,587,587,2367,587,587,587,587,587,587,587,2677,587,587,587,587,587,587,2682,587,0,0,0,1151,0,1153,0,1155,0,0,0,0,0,0,0,0,0,1231,541,541,541,541,541,541,0,1181,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1636,0,0,1198,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1675,0,0,1266,0,0,0,0,0,0,0,1181,541,541,541,541,541,541,541,1326,541,541,541,541,541,541,541,1339,1305,1307,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1358,541,541,541,1343,541,541,541,541,541,541,541,541,1354,1355,541,541,541,541,541,541,2840,541,541,541,541,541,541,541,541,541,541,3056,541,3058,541,541,541,1360,914,563,563,563,563,1367,563,563,563,563,563,563,563,563,563,3242,563,563,563,563,563,563,563,563,563,1421,563,563,563,563,563,563,563,1435,563,563,563,563,563,2627,563,563,563,563,563,563,2635,563,563,563,1459,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2942,587,587,587,1489,1491,587,587,587,587,587,587,587,587,587,587,587,2707,2708,587,587,587,1554,587,1555,587,587,1558,1079,0,0,0,0,0,0,0,0,0,306,204800,204800,0,205106,204800,1,0,1677,0,0,1679,0,0,0,0,0,0,0,0,0,0,0,1159,0,0,0,0,541,541,541,541,1763,541,541,541,541,541,541,541,541,541,541,541,541,2208,541,541,541,0,563,563,563,563,563,563,563,1833,563,563,563,563,563,563,563,2879,563,563,563,563,563,563,563,563,2644,563,563,563,2647,563,563,563,1858,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1857,563,563,563,1909,563,563,563,563,1915,563,563,563,26028,0,587,587,587,587,587,2376,587,587,587,587,587,587,587,587,587,587,2717,541,587,563,541,541,587,587,587,587,1929,587,587,587,587,587,587,587,587,587,587,587,2938,587,587,587,587,587,1991,587,587,587,1996,587,587,587,587,587,587,587,587,2005,587,0,0,0,541,587,563,852,892,541,903,541,925,965,563,976,587,587,587,2011,587,587,587,541,587,563,541,541,541,541,563,563,916,563,563,563,932,563,563,563,563,563,563,563,1864,563,563,563,1868,563,563,1873,563,2077,0,0,0,0,0,0,0,0,2085,0,0,0,0,0,2089,0,0,2091,0,0,0,0,0,0,0,2099,0,0,0,0,0,0,0,3012,3013,0,0,0,0,3018,0,0,2133,2134,0,2136,0,0,0,0,0,0,0,0,0,0,2144,0,0,2149,2150,0,0,0,0,0,2154,0,0,0,0,0,0,0,2160,541,541,541,541,541,541,2167,541,541,541,541,541,541,1288,541,541,541,541,1298,541,541,541,541,541,541,1325,541,541,541,541,541,541,541,541,541,541,1801,541,541,541,541,541,2202,541,541,541,541,541,541,541,541,541,541,541,541,2209,541,541,541,541,541,2815,541,2818,541,541,541,541,2823,541,541,541,541,541,541,3409,541,563,563,563,563,563,563,563,563,3479,563,3481,3482,563,3484,563,541,541,541,2215,541,541,541,541,541,541,541,541,541,541,541,541,895,541,541,541,0,0,2244,563,563,563,563,563,563,563,2252,563,563,563,563,563,563,3534,563,3536,563,563,3538,563,563,587,587,563,563,2301,563,563,563,563,563,563,563,563,563,563,563,563,563,2893,563,563,0,0,2331,587,587,587,587,587,587,587,2339,587,587,587,587,587,587,2715,587,587,587,587,541,587,563,541,541,587,587,587,587,2363,587,587,587,587,587,587,2369,587,2371,587,2374,587,587,2388,587,587,587,587,587,587,587,587,587,587,587,587,587,2918,587,587,0,2474,0,0,0,0,0,0,0,0,0,2482,0,0,0,0,0,0,0,122880,122880,122880,122880,122880,0,122880,0,2105632,0,0,2514,0,0,0,0,0,0,0,0,0,2522,0,0,541,541,541,541,541,3461,541,541,541,3465,541,541,541,541,541,541,1287,541,541,541,541,541,541,541,541,541,541,2546,541,541,541,541,541,541,541,541,541,2540,541,541,541,541,541,541,541,541,541,541,541,541,2222,541,541,541,563,563,563,2599,563,563,563,563,563,2604,563,563,563,563,563,563,2278,563,563,563,563,563,563,563,563,563,2632,563,563,563,563,563,563,2670,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3143,587,587,587,587,2686,587,587,587,587,587,587,587,587,587,587,587,3125,587,587,587,587,541,541,2723,563,563,563,2725,587,587,587,2727,2728,0,0,0,0,0,0,0,172032,172032,172032,172032,172032,172032,172032,172032,1,0,0,2746,0,2747,0,0,0,0,0,0,0,0,0,0,0,1175,0,0,0,0,0,0,0,0,2762,0,0,0,0,0,0,0,0,0,0,0,1192,0,1195,0,0,2811,541,2812,541,541,541,541,541,541,541,541,541,541,541,541,541,1804,541,541,541,541,541,2849,541,541,541,541,541,0,0,563,563,563,563,563,563,563,563,563,563,563,563,2255,563,2858,563,2859,563,563,563,563,563,563,563,563,563,563,563,563,563,3086,563,563,587,587,2907,587,2908,587,587,587,587,587,587,587,587,587,587,587,3139,587,3141,587,587,0,0,0,2983,0,0,0,0,0,0,0,0,0,0,0,0,2073,0,0,0,0,0,3381,0,0,0,0,0,3180,0,0,0,3390,0,0,0,0,0,0,1659,0,0,0,0,0,0,0,0,0,0,114688,0,241664,258048,0,0,3430,587,587,587,587,587,587,587,587,587,3439,587,587,587,541,563,563,563,563,2303,563,563,563,563,563,563,563,563,563,563,563,26028,0,587,587,587,541,541,541,541,3518,541,541,541,541,541,541,541,541,541,563,563,563,3232,563,563,563,563,563,563,3531,563,563,563,563,563,563,563,563,563,563,587,587,587,3357,587,587,587,587,587,3545,587,587,587,587,587,587,587,587,587,587,0,0,0,0,0,0,3637,541,541,541,541,541,541,3643,563,563,563,563,3647,563,563,587,587,587,587,587,3653,587,587,0,0,0,0,3635,0,541,541,541,541,541,541,541,563,2724,563,563,587,2726,587,587,0,0,0,0,0,0,0,0,3607,0,541,541,541,541,0,3656,0,3658,541,541,541,541,541,541,563,563,563,563,563,563,937,563,563,563,563,563,563,563,0,0,0,0,394,395,0,396,0,0,0,0,0,396,0,0,0,0,0,331,332,333,0,0,0,0,0,0,0,0,0,560,583,560,583,560,560,583,401,0,0,0,0,0,368,376,404,0,0,0,0,0,368,0,0,396,0,0,0,0,0,351,0,0,368,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2744,409,411,0,0,368,376,0,69632,73728,0,0,0,0,427,65536,0,0,0,0,0,2044,2045,0,0,0,0,0,0,0,0,0,361,0,0,0,0,0,361,427,427,437,0,427,0,411,427,456,0,0,0,0,0,0,0,0,106496,0,106496,0,0,0,0,106496,396,0,409,0,497,497,0,497,497,497,497,497,497,497,497,523,523,523,523,523,456,456,456,456,531,456,456,532,456,523,537,523,523,523,537,523,523,523,523,539,557,580,557,580,557,557,580,557,604,580,580,580,580,580,580,580,604,604,604,557,604,604,604,604,604,604,604,604,580,580,618,623,604,623,629,1,0,0,0,643,0,0,0,0,0,0,0,0,0,0,0,0,2101,0,0,0,783,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2757,0,0,0,802,0,0,0,0,0,0,0,0,0,0,0,0,2129,0,0,0,587,587,587,1023,1025,587,587,587,587,587,587,587,587,587,587,587,3275,587,587,587,587,0,0,0,0,1096,0,0,1098,0,0,0,0,0,0,0,0,0,1630,0,0,0,0,0,1636,0,0,0,0,1111,0,0,0,0,0,0,0,0,0,0,0,1207,0,0,0,0,1098,1227,0,0,0,0,0,0,1234,0,0,0,0,0,0,0,0,155648,0,0,0,0,0,0,0,0,1239,0,0,0,0,0,0,0,0,0,0,1239,1248,0,0,0,0,0,0,1681,0,0,0,0,0,0,1687,0,1689,0,0,0,0,1239,1269,1270,0,1239,0,541,541,541,541,541,541,541,3207,3208,541,541,541,541,3212,3213,1278,541,541,541,1282,541,541,1293,541,541,1297,541,541,541,541,541,541,541,3054,541,541,541,541,541,541,541,541,541,1784,541,541,541,541,541,541,1360,914,563,563,563,563,563,563,563,1370,563,563,563,1374,563,563,563,563,1847,563,563,563,563,563,563,563,563,563,563,563,2308,563,563,563,563,1385,563,563,1389,563,563,563,563,563,563,563,563,563,563,563,563,2295,563,563,563,563,563,563,1406,563,563,563,1410,563,563,563,563,563,563,563,563,2901,563,563,0,0,587,587,587,587,587,587,1462,587,587,587,1466,587,587,1477,587,587,1481,587,587,587,587,587,3434,587,3436,587,587,587,587,587,587,541,563,587,1502,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3128,587,0,1622,0,0,0,0,0,0,0,0,0,0,0,0,1635,0,0,0,0,0,2067,0,0,0,0,0,0,0,0,0,2076,1637,0,0,0,1641,0,0,0,1645,0,0,0,1649,0,0,0,0,0,0,2056,0,2057,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1676,0,563,563,1844,563,563,563,563,563,563,563,563,563,563,563,563,563,3540,587,587,1958,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3127,587,3129,587,587,2010,587,587,587,587,1749,1940,1844,541,541,541,541,563,563,917,563,563,563,934,563,563,948,563,563,563,563,563,1895,563,563,563,1900,563,563,563,563,563,563,1914,563,563,563,563,26028,0,587,587,587,0,2118,0,0,0,0,0,0,2125,0,0,0,0,0,0,0,0,184726,184932,184932,184932,0,184932,184932,184932,0,0,2159,0,541,541,2162,541,541,541,541,541,541,541,541,541,541,2833,541,541,541,541,541,541,541,2227,541,541,541,541,541,541,541,541,541,541,541,0,0,563,2855,563,563,563,0,0,563,563,2246,563,563,563,563,563,563,563,563,563,563,563,3255,563,563,563,563,563,563,2314,563,563,563,563,563,563,563,563,563,563,563,0,0,587,2904,587,0,0,587,587,2333,587,587,587,587,587,587,587,587,587,587,587,3440,587,587,541,563,587,587,587,587,2390,587,587,587,587,587,587,587,587,587,587,587,2928,587,587,587,587,587,587,587,587,2401,587,587,587,587,587,587,587,587,587,587,587,541,587,0,0,0,541,587,563,1064,541,541,905,541,1069,563,563,978,541,541,541,2567,541,541,541,541,541,541,541,541,541,541,541,541,900,541,541,541,2698,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3277,587,587,0,2759,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1716,0,541,2827,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1758,541,563,2874,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2285,563,587,587,587,2923,587,587,587,587,587,587,587,587,587,587,587,587,2382,587,587,587,0,0,2993,0,0,0,0,0,0,0,0,0,0,0,0,0,2433,0,2435,3171,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2771,3202,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2577,3225,541,541,541,541,541,541,541,541,563,563,563,563,563,563,563,2888,563,563,563,563,563,563,563,563,3241,563,563,563,563,563,563,563,587,587,587,3282,587,587,587,587,587,587,587,587,587,541,587,563,2018,541,541,541,2022,563,541,3289,563,3291,587,3293,3294,0,0,0,0,3298,0,0,0,0,0,0,0,1134592,0,365,0,0,0,1134592,0,0,0,1134592,1134592,0,0,1134592,0,0,1134592,0,0,0,3311,0,0,0,0,3315,0,0,0,0,0,0,0,0,0,1725,0,0,0,0,0,0,3318,0,541,541,541,3320,541,541,541,3323,541,541,541,541,541,541,541,1751,541,541,541,541,541,541,541,541,541,2586,0,563,563,563,563,563,3338,563,563,563,3341,563,563,563,563,563,563,563,563,563,563,563,26028,1921,587,587,587,587,3360,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3554,0,0,3403,541,3405,541,541,541,541,541,563,563,563,563,563,563,563,563,563,563,3075,563,563,3418,563,3420,563,563,563,563,563,563,587,587,587,587,587,587,587,3596,587,3598,587,587,0,0,0,0,3560,0,0,0,0,541,541,541,541,541,541,541,541,541,2169,541,541,541,541,541,3574,541,541,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,1417,3586,563,563,563,587,587,587,587,587,587,587,587,587,587,3599,587,0,0,0,853,1e3,926,849,1065,894,541,541,922,1070,967,563,0,587,587,587,587,587,78115,0,0,0,0,0,0,0,0,0,365,0,305,0,0,0,0,3611,541,541,541,541,541,541,541,563,563,3617,563,3618,563,563,563,563,587,587,587,587,3594,587,587,587,587,587,587,587,541,541,563,563,587,587,3378,0,0,410,356,0,0,0,0,0,69632,73728,0,0,0,0,0,65536,0,0,0,0,0,2122,0,0,0,0,0,0,0,0,0,0,304,304,0,0,0,0,0,0,354,0,0,0,356,0,0,473,473,473,473,473,473,473,478,473,473,473,473,473,473,473,473,473,473,473,478,473,484,473,0,0,473,0,0,0,0,0,0,0,0,524,528,528,528,528,473,473,473,473,473,473,473,478,473,528,524,528,528,528,524,528,528,528,528,540,558,581,558,581,558,558,581,558,605,581,581,581,581,581,581,581,605,605,605,558,605,605,605,605,605,605,605,605,581,581,619,624,605,624,630,1,0,0,0,0,644,0,0,0,0,0,0,0,0,0,0,0,1606,0,0,0,0,688,0,0,0,0,0,0,0,0,0,0,0,365,365,365,0,0,0,0,0,2138,0,0,0,0,0,0,0,0,0,0,0,2768,0,0,0,0,0,0,0,738,0,0,0,644,738,0,744,745,644,0,0,0,0,0,0,790,0,0,0,0,0,0,0,0,0,2058,0,0,0,0,0,0,0,0,799,0,804,0,0,0,0,0,0,804,0,0,0,0,0,644,0,0,0,799,0,804,0,790,0,819,0,0,0,665,0,0,0,0,819,0,0,0,0,0,0,0,2473984,2478080,0,0,0,0,0,0,0,0,0,2767,0,0,0,0,0,0,0,644,0,0,0,0,0,0,0,0,790,0,0,0,0,0,0,0,3165,0,0,0,0,0,0,0,0,0,541,563,541,563,541,541,563,0,0,790,790,0,644,0,0,790,804,842,0,541,848,541,541,541,541,541,2839,541,541,541,2842,541,2844,541,541,541,541,541,541,879,541,884,541,891,541,894,541,541,908,541,541,867,871,877,541,882,541,541,541,541,541,899,541,541,541,541,541,541,2852,541,541,0,0,563,563,563,563,563,563,563,563,563,563,563,563,563,2256,563,563,563,972,563,563,563,563,563,0,587,587,995,587,587,587,587,587,2687,587,587,587,587,587,587,587,587,587,587,2937,587,587,587,587,587,587,587,1014,1018,1024,587,1029,587,587,587,587,587,1046,587,587,587,587,587,1026,587,1031,587,1038,587,1041,587,587,1055,587,1149,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2799,0,0,0,1200,0,0,0,0,0,1205,0,0,0,0,0,0,0,1714,0,0,0,0,0,0,0,0,0,2140,2141,0,0,2143,0,0,1099,0,0,0,1230,0,1232,0,0,0,0,0,0,0,0,0,351,352,353,0,0,0,0,1240,0,0,0,0,0,0,0,0,0,0,1246,0,1249,1200,0,0,0,0,0,2427,0,0,0,0,0,0,0,0,0,0,336,337,0,0,0,0,1230,1252,0,1255,0,0,0,0,0,1130,0,0,0,0,1264,0,0,1149,1264,0,1271,541,541,541,541,1277,1360,914,1362,563,563,563,563,563,1369,563,563,563,563,1375,563,563,563,563,1862,563,563,563,563,563,563,563,563,563,563,563,3084,563,563,563,563,563,563,563,1407,563,563,563,563,1412,563,563,563,563,563,563,563,2900,563,563,563,0,0,587,587,587,563,1419,563,563,563,1426,1428,563,563,563,563,563,563,563,563,563,3346,563,563,563,563,563,563,587,587,1461,587,587,587,587,1467,587,587,587,587,587,587,587,587,2663,587,587,587,587,587,587,587,587,587,1488,587,587,587,587,587,587,587,587,587,587,1499,587,587,587,587,1463,587,587,587,587,587,1475,587,587,587,587,587,587,2014,541,587,563,1791,541,2020,541,1886,563,587,587,1504,587,587,587,587,587,587,587,587,1511,587,587,587,1518,1520,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2396,2397,2398,587,587,1542,587,0,541,587,563,541,541,541,541,541,563,563,563,563,563,2862,563,2865,563,563,563,563,2870,563,563,563,563,587,587,587,587,587,1079,0,0,1563,0,0,0,1569,0,0,0,0,0,376,0,0,0,0,368,0,385,0,351,0,0,1575,0,0,0,1581,0,0,0,0,0,0,0,0,0,0,303,303,0,0,0,0,1592,1593,0,0,0,0,0,1599,0,0,0,0,0,0,0,0,0,2098,0,2100,0,0,0,0,0,1638,0,0,0,0,0,0,0,1646,1647,0,0,0,0,0,0,0,3197,0,0,0,0,0,0,3200,0,0,1654,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2038,0,1690,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3005,0,1706,1707,0,0,0,1710,0,0,0,0,0,1714,0,0,1717,0,0,1730,0,1732,1706,541,541,541,541,541,541,541,541,541,541,541,2547,541,541,541,541,541,1744,541,541,541,541,1750,541,541,541,541,541,541,541,541,541,541,3220,541,541,541,541,541,541,1761,541,541,541,541,1765,541,541,541,541,541,541,541,541,541,541,3335,541,541,563,563,563,541,1776,541,541,541,1781,541,541,541,541,541,541,541,541,541,541,541,2559,541,541,541,541,1808,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1360,914,563,563,563,563,563,563,563,563,563,563,563,563,1376,563,0,587,587,1046,587,587,78115,1079,0,0,0,0,0,0,0,0,225890,225890,225890,225890,225741,225890,225890,225890,0,563,563,563,563,563,563,563,563,563,563,563,563,1839,563,563,563,563,1877,563,563,563,563,563,563,563,563,563,563,563,2869,563,563,563,563,563,563,1845,563,563,563,563,563,563,563,563,563,563,1856,563,563,563,563,1894,563,563,563,1898,563,563,563,563,563,563,563,1450,563,26028,1360,988,1454,587,587,587,563,563,1860,563,563,563,563,563,563,563,563,563,563,1871,563,563,563,563,1911,1913,563,563,563,563,563,26028,0,587,587,587,587,587,1506,587,587,1508,587,587,587,1512,587,587,587,0,1286,1470,1378,541,541,541,1549,541,563,563,563,1553,563,1876,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2297,2298,563,563,587,2027,587,587,0,0,0,0,0,0,0,0,0,0,3511,0,3513,0,541,0,0,0,2080,2081,0,0,2083,2084,0,0,0,0,0,0,0,0,286720,0,0,0,0,0,0,0,0,0,286720,286720,0,286720,286720,1,0,0,0,2106,0,0,0,0,2109,2110,0,0,0,0,0,0,0,2069,0,0,0,0,0,0,0,0,0,541,564,541,564,541,541,564,541,541,541,541,2175,541,541,2179,541,541,541,2183,541,541,541,541,541,541,1347,541,541,541,541,541,541,541,541,541,563,563,3231,563,563,563,563,2225,541,541,541,541,2230,541,541,541,541,541,541,541,541,0,0,0,0,0,386,0,69632,73728,0,0,0,0,0,65536,0,2242,0,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2325,0,563,563,563,2260,563,563,2264,563,563,563,2268,563,563,563,563,563,587,587,3625,587,3626,587,587,587,587,587,587,1493,587,587,587,587,587,587,587,587,587,2380,587,587,587,587,587,587,2312,563,563,563,563,2317,563,563,563,563,563,563,563,563,0,0,0,0,0,0,587,587,2655,587,587,587,2329,0,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2680,587,587,587,587,587,587,2347,587,587,2351,587,587,587,2355,587,587,587,587,587,587,2925,587,587,587,587,587,587,587,587,587,1471,587,587,587,587,587,587,2399,587,587,587,587,2404,587,587,587,587,587,587,587,587,541,587,0,0,0,854,1001,927,541,541,541,541,910,563,563,563,563,563,1848,563,563,563,563,563,563,563,563,563,563,3097,563,3099,563,563,563,0,0,0,0,2439,0,0,0,0,0,0,0,0,0,0,0,1616,0,0,0,0,0,0,2475,0,0,0,2479,0,0,0,0,0,0,0,0,0,365,0,0,0,0,0,0,541,2525,541,541,541,541,541,541,541,541,541,541,2533,541,541,541,541,541,541,3053,541,541,3055,541,541,541,541,541,541,541,1311,541,541,541,541,541,541,541,541,541,1753,541,541,541,541,541,541,541,2551,541,541,2553,541,2554,541,541,541,541,541,541,541,2561,541,541,541,541,876,878,541,541,541,541,541,541,541,541,541,541,541,1353,541,541,541,541,541,2565,541,541,541,541,541,541,541,541,541,541,541,541,2576,541,541,541,541,1283,541,541,541,541,541,541,541,541,541,541,1304,0,0,0,563,563,2589,563,563,563,563,563,563,563,563,563,563,3537,563,563,3539,563,587,587,563,2597,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2326,0,563,563,2612,563,563,563,2615,563,563,2617,563,2618,563,563,563,563,563,2877,2878,563,563,563,563,2881,563,563,563,563,563,1863,563,563,563,563,563,563,563,563,563,563,3356,587,587,587,587,587,563,563,563,563,2626,563,563,2630,563,563,563,563,563,563,563,563,3345,563,563,563,563,563,563,563,563,563,563,563,2641,2642,563,563,563,563,563,563,563,563,563,563,26028,1360,988,587,587,587,587,2683,587,2684,587,587,587,587,587,587,587,587,2692,587,587,2696,587,0,0,0,1061,1062,1063,851,541,898,902,1068,924,563,971,975,2733,2734,0,0,2737,2738,0,0,0,0,0,0,0,0,0,0,306,307,0,0,0,0,0,2788,0,2790,0,0,0,0,0,0,0,0,0,0,0,0,2457,0,0,0,0,0,0,0,2803,0,0,0,0,0,0,541,541,541,541,541,541,541,3033,541,541,2826,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2825,2873,563,563,563,563,563,563,563,563,563,563,563,563,2883,563,563,563,563,1912,563,563,563,563,563,563,26028,0,587,587,587,587,587,2934,587,587,587,587,587,587,587,2940,587,587,587,587,2922,587,587,587,587,587,587,587,587,587,587,587,587,2932,0,2982,0,0,2984,0,0,0,0,0,0,0,0,0,0,0,1632,0,0,0,0,0,0,0,0,2995,0,0,2998,0,2999,0,0,0,0,0,0,0,2096,0,0,0,0,0,0,0,0,0,562,585,562,585,562,562,585,541,3049,541,541,541,541,541,541,541,541,541,541,541,541,541,3061,3089,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2621,563,3103,563,563,563,563,563,587,587,587,3111,587,587,587,587,587,587,1507,587,587,587,587,587,587,587,587,587,1983,1984,587,587,587,587,587,587,3131,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2929,587,587,587,587,3145,587,587,587,587,587,541,587,563,541,541,563,563,587,587,0,2962,0,0,0,0,0,0,0,0,0,2507,0,0,0,0,0,0,0,0,0,0,0,3163,0,0,0,0,0,0,0,3169,0,0,0,0,0,438,0,0,0,0,0,0,0,0,0,0,0,2142,0,0,0,0,541,3226,541,541,541,541,541,541,541,563,563,563,563,563,563,563,3095,563,563,563,563,563,563,563,563,2306,563,563,563,563,563,563,563,563,563,3236,563,563,563,563,563,563,563,563,563,563,563,563,563,2309,2310,2311,563,563,3246,563,563,563,563,563,563,3252,563,3254,563,563,563,563,563,1392,563,563,563,563,563,563,563,563,563,563,1853,563,563,563,563,563,563,563,563,587,587,587,587,587,587,587,587,587,3265,587,587,587,587,587,2703,587,587,587,587,587,587,587,587,587,587,2950,587,587,541,587,563,587,587,3281,587,3283,587,587,587,587,587,587,587,587,541,587,563,3153,541,3155,563,3157,587,0,0,0,3301,0,0,0,0,0,0,0,3180,0,0,0,0,0,0,0,3014656,3207168,0,2691072,0,0,3215360,0,0,3309,0,0,0,0,0,3314,0,0,0,0,0,0,0,0,0,365,0,0,0,0,131072,131072,563,563,3339,563,563,563,3343,563,563,563,563,563,563,563,563,563,26028,1360,988,587,587,1456,587,587,587,587,3362,587,587,587,587,587,587,587,587,587,587,587,587,3126,587,587,587,587,587,3371,587,587,587,587,541,541,563,563,587,587,0,0,0,3296,0,0,0,0,0,0,3557,3558,0,0,0,0,0,0,0,541,541,541,3568,541,541,541,541,541,1284,541,541,541,541,541,541,541,541,541,1303,563,563,3588,563,587,587,587,3593,587,587,587,587,587,587,587,587,2690,587,587,587,587,2694,587,587,3601,587,0,0,0,0,0,3604,3605,3606,0,3608,541,541,541,541,541,541,1813,541,541,541,541,1819,541,541,541,1360,563,3621,3622,563,563,587,587,587,587,587,587,587,587,587,3629,3630,563,563,587,587,587,587,3679,0,541,3680,563,3681,587,3682,0,541,541,541,541,1345,541,541,541,541,541,541,541,541,541,541,541,541,2560,541,541,541,358,359,0,0,0,0,0,0,0,365,0,293,0,0,0,0,0,0,306,0,0,0,0,0,0,0,0,0,0,1174,0,0,0,0,0,0,0,0,392,0,0,0,0,0,0,0,0,0,0,0,0,2495,0,0,0,474,474,474,488,0,0,488,359,359,359,510,359,359,359,359,474,559,606,582,582,582,582,582,582,582,606,606,606,559,606,606,606,606,606,606,606,606,582,582,559,582,606,582,606,1,541,541,868,541,541,541,541,541,541,541,541,541,541,904,541,541,541,541,541,2851,541,541,541,0,0,563,563,563,563,563,563,563,563,563,563,2254,563,563,563,587,1015,587,587,587,587,587,587,587,587,587,587,1051,587,587,587,587,587,2909,587,587,587,587,587,587,2917,587,587,587,587,587,1527,587,587,587,587,587,587,587,587,1538,1539,1197,0,0,0,0,0,0,0,1197,0,0,0,0,0,0,0,0,1134592,0,0,1134592,0,0,0,0,0,0,0,0,0,0,0,0,0,2980,0,0,541,541,1280,541,541,541,1289,541,541,541,541,541,541,541,541,541,541,3524,541,541,3526,563,563,1360,914,563,563,563,563,563,563,563,563,563,1372,563,563,563,1381,587,587,1543,0,1289,1473,1381,541,541,541,541,541,563,563,563,563,563,2898,563,563,563,563,563,0,0,587,587,587,587,587,587,2337,587,587,587,587,587,587,587,2352,587,587,587,587,2357,587,587,587,563,587,587,587,587,587,1079,0,0,0,1564,0,0,0,1570,0,0,0,0,0,2440,0,0,0,0,0,0,0,0,0,0,0,2871296,0,0,2424832,0,0,0,1576,0,0,0,1582,0,0,0,0,0,0,0,0,0,365,0,0,0,0,155648,0,0,1606,0,0,0,0,0,0,0,1614,1615,0,0,0,0,0,0,0,3385,3180,0,0,0,0,0,0,0,0,2097,0,0,0,0,0,0,0,0,2070,0,0,0,0,2074,0,0,0,0,0,0,1625,0,0,0,0,0,0,0,0,0,0,0,1648,0,0,0,0,563,1891,563,563,563,563,563,563,563,563,1902,563,563,563,563,563,1408,563,563,563,563,563,563,563,563,563,563,1867,563,563,563,563,563,587,1975,587,587,587,587,587,587,587,587,587,587,587,1987,587,587,587,587,1490,587,587,587,587,587,587,587,587,587,587,587,2381,587,587,587,587,2008,587,587,587,587,587,587,541,587,563,541,541,541,541,563,563,918,563,563,563,563,563,563,563,563,563,563,563,2634,563,563,563,563,0,2243,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2637,563,0,2330,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3276,587,587,587,0,0,2451,0,0,0,0,0,0,0,0,0,0,0,0,0,2471,0,2472,0,0,0,563,563,563,563,563,563,563,2593,563,563,563,563,563,1424,563,563,563,563,563,563,563,563,563,563,2293,563,563,563,563,563,563,587,2659,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2912,587,587,2916,587,587,587,587,0,0,0,0,0,2776,0,0,0,0,0,0,0,0,0,0,372,0,0,373,0,0,563,2895,563,563,563,563,563,563,563,563,563,0,0,587,587,587,587,2335,587,587,587,587,587,587,587,587,587,2947,587,587,587,587,587,541,587,563,587,2906,587,587,587,587,587,587,2913,587,2915,587,587,587,587,587,587,2935,587,587,587,587,587,587,587,587,587,2408,587,587,587,587,2177,2349,587,587,587,2944,587,587,587,587,587,587,587,587,587,541,587,563,563,563,563,563,563,563,587,587,587,541,587,587,587,0,541,587,563,541,1547,541,541,1550,563,1551,563,563,0,0,0,0,0,3561,0,0,0,541,541,541,541,541,541,541,541,3464,541,3466,3467,541,3469,541,541,541,541,3575,541,563,563,563,563,563,563,563,563,563,563,3423,563,563,563,3426,587,587,587,587,563,3587,563,563,587,587,587,587,587,587,587,587,587,587,587,3600,587,587,587,587,3670,587,0,0,0,0,541,541,541,541,563,563,919,925,563,563,563,563,943,563,563,563,563,563,563,3353,563,563,563,587,587,587,587,587,587,587,587,587,587,587,587,3267,0,0,360,0,0,0,0,0,0,365,0,293,0,0,0,0,0,0,331,0,0,0,0,0,0,0,331,0,0,69632,73728,0,419,419,0,0,65536,419,0,0,0,0,375,0,0,0,0,0,0,0,0,0,0,0,1663,0,0,0,0,0,0,360,0,0,0,0,0,0,0,0,0,0,0,0,0,2511,0,0,0,0,0,370,0,0,370,0,0,0,0,0,0,0,0,0,0,0,0,0,2496,0,0,560,607,583,583,583,583,583,583,583,607,607,607,560,607,607,607,607,607,607,607,607,583,583,560,583,607,583,607,1,541,863,541,541,541,541,541,541,541,541,541,541,541,541,541,541,1772,541,1010,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3123,587,587,587,587,587,587,587,563,1386,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2871,563,0,0,2760,0,0,0,0,0,0,0,0,0,0,0,0,0,2755,0,0,0,0,0,0,0,2985,0,0,0,0,0,0,0,0,0,0,406,0,0,0,0,0,0,0,0,0,3302,0,3303,0,0,0,0,3180,0,0,0,0,0,0,348,0,0,0,0,0,0,0,0,0,0,2801664,0,0,0,0,2142208,0,0,0,361,362,363,364,0,0,365,0,293,0,0,0,0,0,0,348,349,350,0,0,0,0,0,0,0,0,3180,0,3388,0,0,0,0,0,0,362,0,361,0,0,0,69632,73728,0,0,0,0,428,65536,0,0,0,0,0,2463,0,0,0,0,0,0,0,0,0,0,0,2807,541,541,541,541,428,428,0,0,428,0,362,428,457,0,0,0,0,0,0,0,0,1159168,0,1159168,0,0,0,0,1159168,0,0,0,0,498,498,0,505,505,505,505,511,512,505,505,525,525,525,525,525,457,457,457,457,457,457,457,457,457,525,525,525,525,525,525,525,525,525,561,584,561,584,561,561,584,561,608,584,584,584,584,584,584,584,608,608,608,561,608,608,608,608,608,608,608,608,584,584,620,625,608,625,631,1,563,563,563,973,563,563,563,563,563,0,587,587,587,587,587,587,1963,587,587,587,587,587,587,587,587,587,3137,587,587,587,587,587,587,587,0,2105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2052,0,0,0,0,0,541,2161,541,541,541,541,541,541,541,541,541,541,541,3336,541,563,563,563,0,0,563,2245,563,563,563,563,563,563,563,563,563,563,563,563,2882,563,563,563,0,0,587,2332,587,587,587,587,587,587,587,587,587,587,587,587,3286,587,587,587,587,541,587,563,2550,541,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2210,541,541,541,2579,541,541,541,541,541,541,541,541,541,541,0,0,0,0,0,0,2068,0,0,0,0,0,0,0,0,0,365,0,0,122880,122880,0,0,2711,587,587,587,587,587,587,587,587,587,587,541,587,563,541,541,541,2021,563,563,562,609,585,585,585,585,585,585,585,609,609,609,562,609,609,609,609,609,609,609,609,585,585,562,585,609,585,609,1,0,0,0,705,0,0,0,0,0,0,0,0,0,0,0,0,2742,0,0,0,0,735,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2075,0,541,864,541,541,541,541,541,541,541,541,541,541,541,541,541,541,2238,0,1011,587,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2689,587,587,587,587,587,587,587,587,2716,587,587,587,541,587,563,541,541,1136,0,0,0,0,0,0,0,0,0,0,365,365,0,0,0,0,0,0,2095,0,0,0,0,0,0,0,0,0,0,2375680,0,0,0,0,0,587,1503,587,587,587,587,587,587,587,587,587,587,587,587,587,587,2911,587,2914,587,587,587,587,2919,587,563,587,587,587,587,587,1079,1560,0,0,0,1566,0,0,0,1572,0,0,0,1578,0,0,0,0,0,0,0,0,0,0,0,0,2754,0,0,0,563,563,563,563,2600,563,563,563,563,563,563,563,563,563,563,563,26028,1922,587,587,587,0,0,0,0,647,0,0,0,0,0,0,743,541,541,541,541,541,541,2178,541,541,541,541,541,541,541,541,541,0,2242,563,563,563,563,563,0,0,1594,0,0,0,0,0,0,0,0,0,0,0,0,0,2770,0,0,563,563,563,1846,563,563,563,563,563,563,563,563,563,563,563,563,3085,563,3087,563,2187,541,2189,541,541,541,541,541,541,541,541,541,541,541,541,541,1821,541,1360,0,0,563,563,563,563,2248,563,563,563,563,563,563,563,563,563,2305,563,563,563,563,563,563,563,563,563,0,587,587,994,587,587,587,563,2274,563,563,563,563,563,563,563,563,563,563,563,563,563,563,2894,563,587,2361,587,587,587,587,587,587,587,587,587,587,587,587,587,587,3121,587,587,587,587,587,587,587,587,563,563,541,563,587,563,587,1,2623,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3101,563,563,563,563,2651,0,0,0,0,0,0,587,587,587,587,587,587,587,587,587,2340,587,587,587,587,0,0,3179,0,0,0,0,0,0,0,0,0,0,0,0,0,2798,0,0,3245,563,563,563,563,563,563,563,563,563,563,563,563,563,563,563,3257,563,1134592,0,1134592,0,0,0,1134592,1135008,1135008,0,0,0,0,0,1135008,0,0,0,0,0,2478,0,0,0,0,0,0,0,0,0,0,0,3180,0,0,3307,0,1134592,0,1134592,1134592,0,0,0,0,1135203,1135203,1135203,1135203,1134592,1135203,1135203,1135203,1135203,1135203,1135203,1135203,0,1134592,1134592,1134592,1134592,1135203,1134592,1135203,1,0,0,2125824,2125824,2125824,2125824,2125824,2424832,2433024,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,988,2125824,2125824,2125824,2125824,1147355,1147355,1147355,1147355,458,458,1147355,458,458,458,458,458,458,458,458,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,1147406,0,0,0,0,0,0,0,0,458,0,0,0,0,0,1147355,1147355,1147355,1147406,1147406,1147355,1147406,1147406,1,12290,3,0,0,0,0,249856,0,0,0,249856,0,0,0,0,0,0,0,69632,73728,0,0,0,0,425,65536,0,1159168,0,0,1159168,0,1159168,1159168,0,1159168,1159168,0,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,0,1159168,1159168,0,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,0,0,0,0,0,0,0,0,0,1159168,0,0,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1159168,1,12290,3,78115,293,0,0,0,0,0,0,0,0,0,0,0,0,131072,131072,0,0,1163264,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3170,0,913,2125824,2125824,2125824,2125824,2125824,2424832,2433024,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,2125824,0,0,1453,2125824,2125824,2125824,2125824,106496,0,106496,106496,0,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,106496,0,0,0,106496,0,0,106496,106496,106496,106496,106496,106496,106496,106496,106496,0,0,0,0,0,0,0,0,0,0,0,2183168,0,0,0,0,0,0,0,0,2134016,0,0,0,0,0,0,0,0,0,0,541,541,541,1275,541,541,0,0,0,3117056,0,0,0,0,0,0,0,0,0,0,0,0,2979,0,0,0,0,3108864,3198976,0,0,3043328,0,3149824,2936832,0,2760704,0,2437120,0,0,0,0,0,0,2107,0,0,0,0,0,0,0,0,0,365,0,293,0,0,0,0,0,0,0,0,2875392,0,0,0,0,0,0,0,0,0,0,2834432],r.EXPECTED=[1039,1047,1048,1046,1042,1052,1056,1060,1064,1068,1446,1074,2948,2053,1092,1446,2490,1670,1213,1080,1084,1085,1446,1089,1446,1446,2818,1098,1103,1108,1187,1181,1181,1114,1118,1446,1933,1123,1446,1136,1098,1098,1204,1108,1108,1171,1181,1181,1130,1134,1446,1446,1140,1446,1147,1098,1152,1108,1108,1109,1181,1181,1182,1158,1446,1446,1238,1668,1098,1148,1108,1108,1206,1181,1181,1165,1446,3130,2162,1098,1099,1108,1177,1181,1215,1219,2143,1136,1098,1186,1110,1181,1191,3130,2153,1099,1108,1180,1217,2659,2819,1197,1173,1201,1104,1235,1210,1224,1154,1228,1232,1168,1243,1247,1251,1255,1259,1261,1266,1262,1270,1274,1278,1282,1286,1290,1220,1295,1890,1296,1446,1446,1446,1446,1375,2489,1446,1446,1446,2385,1446,1446,1446,1446,1446,1446,1446,1446,1076,1446,1446,1446,1446,2986,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1300,1304,1305,1309,1405,1315,1318,1322,1326,1330,1446,1446,1804,1334,2315,1338,2350,1142,1143,1342,1346,1446,1446,2834,1352,1362,1369,1446,1126,1446,2386,1379,1446,1384,1390,1446,2987,2588,1396,2688,1457,1446,1518,1446,1446,2269,1446,1446,1446,1402,1446,1441,1897,1409,1413,1446,1447,1419,1446,1447,1419,1446,1446,1193,1446,2988,3136,2482,1446,2617,1425,1446,1448,1431,1446,1918,1446,2648,1436,1457,1348,1457,1380,1440,1446,1445,3050,1452,1446,1456,1311,1446,1916,2325,1463,2125,1347,1472,2317,1909,1478,3010,2343,2076,2746,2758,1482,2765,2077,1799,1486,2744,1493,1358,1446,1446,2131,1446,2559,1386,1365,1497,1501,1505,1509,1515,2369,1569,2450,1522,2538,1526,1530,1536,2479,2088,1457,1971,1540,1544,1548,1552,1557,1446,2103,1446,1532,1446,2479,2082,1563,1568,2137,1573,1577,3026,1446,1446,2116,1446,1446,3027,1446,1586,1938,1584,2123,1647,1590,1432,1594,1446,2517,1600,1446,2517,1600,1446,2872,1606,1612,1616,1620,1626,1446,1239,1633,1446,1596,1640,3118,2782,1645,1651,1863,1446,1863,1446,1602,1446,2675,2173,1655,2685,1559,1866,2685,3124,1659,1665,2904,2903,3055,2673,1674,1678,3047,2266,2239,1682,1686,1690,1694,1698,2892,1702,1715,1719,1723,1727,1731,1446,2332,1773,1737,1744,1748,1751,1755,1758,1446,1772,2979,1777,1781,2506,1788,1792,1635,1636,1446,2668,2874,1796,1808,2784,1815,1819,1823,2304,1828,1446,2430,1446,1446,2334,1853,2583,1834,1843,1446,2069,1446,1446,1954,1446,1446,2070,1446,1446,1622,1608,1847,1851,1857,1641,1871,1446,2225,1956,1446,2225,1956,1446,2374,1885,1876,1811,1446,1883,1446,1947,1889,1446,1511,1446,1291,2287,1894,1901,1906,1446,1906,1446,1913,1446,1740,1922,1446,1932,1733,1446,1932,1830,1094,1732,1446,1937,2066,2439,2671,1945,1942,2455,1489,2323,1951,1709,1711,1629,1161,1962,1968,1977,1980,1984,1446,1119,1994,1999,2003,2007,2011,2015,2019,2023,1986,1872,2093,1928,2028,2032,2036,1802,2040,1446,1446,2044,1580,2050,2059,2063,2074,2046,1446,2024,2081,1446,2086,1446,1446,1988,2092,2097,2109,2113,1446,2120,1446,1446,2129,1446,1558,2135,1446,1446,2141,2535,2866,2147,1446,1990,1446,1446,3096,1446,1446,3096,1446,1446,1466,2151,2157,2204,1458,2161,1446,2914,1446,1446,1764,1446,3053,2166,2170,1446,2182,1446,2187,1446,2916,1957,2192,2202,2305,1446,2210,2496,1824,3112,2217,1761,1459,1558,2224,2229,2841,2969,2682,2815,2233,2248,2236,2243,1837,1839,2247,2252,2100,1446,1446,1446,1446,2918,1766,2256,2260,2273,2277,2281,2284,1446,2889,1902,2985,2524,2433,2299,2576,2212,2213,2303,1415,1457,2309,1958,2321,2329,1446,2976,1446,1398,1446,1553,2338,2342,2751,1446,2347,2503,2354,2358,1558,2363,1446,1995,2368,1446,1421,2364,2373,2733,2378,2383,2390,3044,1446,2715,1446,1446,1860,1446,1446,1860,2719,2733,2397,2176,2401,1946,2461,1446,1446,2405,1446,1473,2717,2413,2417,2427,2437,3061,1446,2105,1446,1973,2407,2443,2447,2454,2459,2379,1446,2465,2472,2476,2486,2511,2494,2701,2409,2500,2510,2516,2521,2528,2220,2532,2542,2546,2198,2312,2550,2554,2563,2567,2571,2575,1446,2580,2592,2596,2600,2604,2608,2612,2616,1446,2621,2393,1372,2628,2632,2636,2640,2652,3103,1446,2708,2468,2656,2665,2679,2692,1558,2699,1446,2705,1446,2998,2712,1446,2723,2624,1768,1879,3159,1446,2205,2727,1446,1468,2732,1446,2206,2982,1446,3004,2737,2741,3109,2750,1446,2755,1446,1446,2762,1446,1446,2762,2769,3037,2775,2420,2779,1446,2788,1446,1446,2795,1446,1427,2801,3020,2805,2646,1446,2812,1446,2809,1446,3067,2853,2823,2643,2183,2827,2863,2512,2832,2838,1707,1070,2359,2845,2851,2857,1964,1474,3084,2557,2878,2955,3090,2882,2293,2295,2886,2896,2900,2908,2912,1446,1446,1446,2922,2926,2930,2934,2938,2942,2946,1446,2055,2952,1355,2791,2178,2959,1867,2963,1784,2967,1446,2973,2423,2992,2996,3002,1446,2728,1446,1446,3008,1446,3014,3018,1446,3024,2188,3031,3147,1446,1446,2694,1446,1446,2847,1446,1446,2695,3035,1446,3041,3078,3141,3059,1446,1446,3065,1446,1446,3065,1446,1446,3071,1446,3075,1925,3153,1446,1446,3082,1446,1564,3088,1446,1661,3094,3100,2195,3116,1446,3122,1446,3128,1446,3134,1705,3140,2586,2797,1446,3145,2771,1392,3151,1446,3157,2290,2828,2661,2869,2422,3106,2860,2263,1446,1446,1446,1446,1446,1446,1446,1446,1446,1446,1473,3163,3166,3170,3182,3186,3182,3189,3181,3182,3182,3182,3182,3177,3173,3193,3182,3197,3201,3204,3210,3214,3216,3206,3220,3224,3228,3232,3235,3239,3243,3729,3929,3929,3246,3929,3929,5383,3929,3929,3300,3929,3261,3562,3273,4078,3734,3929,3929,3929,3277,3287,3294,4847,3929,3250,3929,3929,3344,3929,4873,4873,4873,4873,3266,4873,4873,3564,3564,3567,3564,3564,3564,3564,3267,3256,3305,3562,3568,3335,4081,3929,3929,3929,3323,4919,3377,4693,3929,3252,3722,3750,3365,3315,3269,3334,4080,3732,3929,3929,3559,4873,5799,4692,3929,3929,3688,3929,3929,3560,4873,4873,4873,4195,4873,4873,4873,4874,3564,3267,3264,3331,3339,3929,3342,3929,3738,3256,3367,3317,3321,3560,4873,3564,3309,3256,3256,3365,3371,3564,3564,3564,3567,3256,3256,3256,3256,3327,4195,3564,3564,3564,3310,3365,3359,3929,3929,3813,3929,3564,3564,3564,3364,3929,5741,3559,4873,4194,3564,3564,3268,3256,4193,4873,3266,3564,3310,3256,3256,3256,3366,3348,3929,3929,3929,3505,3383,3256,3373,3766,3256,3384,3929,4872,4874,3564,3268,3256,3257,3373,4694,3929,3929,3929,3355,3566,3256,3321,4194,3565,3311,3560,3563,3384,3561,3319,3360,3388,3390,4109,3394,3401,3405,3429,3429,3429,3429,3424,3430,3412,3416,3420,3428,3434,3438,3442,3397,3446,3450,3453,3457,3460,3463,3465,3469,3473,3408,3477,3481,3485,3696,3498,4473,3929,3929,3929,3512,3511,3929,3929,3929,3517,4964,4966,3929,3523,3527,3929,3929,3929,3752,3534,3543,3929,3929,3850,3854,3578,3582,3586,3589,3590,3594,3597,3601,3604,3608,3611,3614,3618,3622,3626,4965,3648,3636,5178,3647,5820,3654,4257,3659,3929,3669,4219,3694,3703,3929,5714,3525,3929,3929,3929,3770,3790,3929,5539,3707,3929,3342,5695,3904,3929,3289,3290,3906,3929,4658,4464,5227,4306,3936,3718,3726,3743,3929,3375,3631,3929,3548,5050,5064,3749,3929,3929,3929,3836,3758,3298,3929,3929,3915,3927,4893,3528,3929,3929,3921,4548,5744,4281,3929,3929,3932,5019,3929,5587,5178,3929,3553,3557,3572,5826,3929,3929,4530,3789,3794,3929,3929,3972,4899,3798,3806,3929,3929,3972,5040,3817,3826,3929,3929,3972,5490,3785,3929,3929,3929,3869,4728,4203,3770,3790,4142,3929,3929,3929,3894,4001,3929,3929,3929,3929,3252,3798,4127,4203,3850,3854,4139,3744,3929,3929,3929,3844,5313,5832,4137,4141,3929,3650,3929,3929,4854,4858,4140,3929,3929,3929,3930,5557,3873,3929,3929,3883,3929,5107,3929,5107,4780,3929,4781,5020,3929,3929,3738,5109,3929,3290,3904,3940,3947,3946,3942,3951,3955,3956,3956,3960,3962,3963,3962,3967,3971,3929,3929,4017,4021,4708,3978,3988,3929,3683,3781,3802,3995,4392,3929,5597,5363,3530,3929,4135,4005,4013,3929,3929,4065,4070,4026,3929,3929,4026,3375,3929,3929,4049,4056,4576,3997,5403,5596,3929,3856,4795,3529,3929,3929,3929,3931,4061,3929,3929,3929,3972,4199,3911,3929,3929,3929,3974,5170,3929,3929,4704,3929,4075,5320,4248,5165,3855,4657,4085,3929,3690,4699,5178,3978,3251,3929,3929,4101,3929,5319,4247,5772,5010,4113,3981,3929,3929,4164,4148,4148,4120,3929,3929,4165,4115,4709,4132,3929,3929,4247,4459,5170,3929,3929,4706,3879,4572,4576,5321,4249,4655,3929,3929,4274,3929,3972,4146,4150,3929,3735,3929,3735,4154,4158,3929,3929,4396,3929,3929,3982,3929,3929,3929,4029,4107,3929,4706,3929,4366,4574,4181,5320,5850,4644,4180,5319,4886,4217,4208,4673,3929,3929,4424,5855,3279,5321,4215,3929,3766,4873,4873,3563,3564,4228,3929,4451,4182,4233,4305,4240,4273,4435,4246,4434,4245,4708,4241,3929,3699,4502,3698,4255,5609,4272,5609,4272,3699,5199,5610,4273,4253,3281,4246,4270,3929,3809,3929,4549,3737,3929,3896,3929,5021,3770,4271,3771,4182,5163,5161,3929,3283,5762,3710,4279,4279,4211,4127,4128,4405,3712,4286,3929,3929,3929,4052,3929,5548,3754,4301,3929,3842,3574,4534,4651,5125,3745,4537,4310,4314,4318,4319,4323,4327,4333,4334,4331,4338,4339,4339,4340,3929,3844,4827,3929,3846,3929,3929,4905,3929,3376,5780,4202,3929,3929,3929,4235,4524,5352,5187,4364,4473,3342,4273,3929,3888,5737,4840,4356,4374,4378,4842,5051,4864,3929,4387,4491,3929,4413,3929,3892,5107,3929,3665,3929,3929,4681,3640,4265,4472,3929,4802,3929,4518,3670,4266,4421,3929,4204,4203,3929,4718,4428,4432,3929,3929,3929,4451,4440,4445,3929,3929,4450,4541,4470,3929,3343,3929,3897,3929,4294,3929,4296,3929,5616,3929,5461,4463,3929,5347,4362,5468,4800,3929,3929,4457,4461,5243,3929,4484,3929,3931,5074,3929,3972,4166,4116,3929,3929,3929,4035,4737,3929,3929,3929,4505,3929,5347,4495,3929,3972,5410,5415,4015,4019,3929,3929,4457,4490,4499,3929,3929,3929,4624,5347,3929,4801,3929,3997,3929,5743,4160,3929,3929,3929,4628,3929,5704,4529,3929,3998,5353,5435,3929,5703,4528,3929,4e3,3929,3929,3999,3528,4505,5352,4800,3929,4007,4653,3929,4009,3929,4642,5697,3929,3929,3929,4695,4052,3929,3929,3929,4708,4545,3929,3929,3301,4450,3929,3929,3929,4734,3929,5303,3342,3929,4030,4480,3929,3929,3929,4516,4994,3894,3929,3895,3929,3929,3351,3892,3737,3735,3929,4039,3929,3929,4086,5090,3895,5020,3895,3737,5022,3736,3737,4554,4556,3929,3929,4638,4794,3929,3929,4668,4806,4689,3929,3929,3929,4752,4504,3929,3929,5097,4566,4022,5334,4383,5691,4570,4582,4586,4590,4594,4598,4602,4605,4608,4612,4614,4618,4634,4632,4634,4621,3929,3929,3929,4757,4725,4816,3929,4648,4662,4666,5081,4672,3929,5344,4398,4352,4678,3929,3929,4678,4687,5178,3929,3929,4745,4749,4210,3929,4965,4768,5739,3929,3929,3322,5689,3899,5181,4703,5110,5214,4713,4722,3929,4051,3558,3929,4028,4478,4500,3929,5400,4741,3929,3929,4780,3929,4780,4762,3929,3929,3929,4821,4756,4761,3929,3929,4818,4822,4505,3863,3867,3929,3341,3341,3929,4766,4294,3929,3899,3929,4066,3929,3929,4087,5091,3767,5433,4817,4683,4716,3929,5809,3929,4091,4095,3751,3972,4773,4777,3929,4107,3929,3929,4137,4141,4786,4775,3929,3929,4820,3910,4788,4777,3929,3929,4828,3972,3322,4792,3929,3929,4847,3929,5432,4816,4833,4799,3929,5147,3929,3929,4872,4873,4966,4295,4304,4814,4826,3929,3929,3929,4871,4674,3929,4708,3897,5180,5433,4832,3929,4159,3929,3377,3299,3929,4503,4708,3929,4837,3929,3929,3929,4913,5207,3929,3929,3929,4965,3929,5148,3929,4008,3929,4408,3929,4172,3929,4172,3900,5432,3628,3929,3929,3929,4856,4860,3844,5313,3929,3929,4982,3929,5086,3768,5434,3630,3929,4174,3929,4562,5312,3929,3929,3929,5003,4502,5148,4878,4885,4293,3929,3929,4296,3929,4296,3929,4229,5198,5520,3928,3929,3928,3897,4293,3929,3898,3929,5228,3899,3898,3929,4296,3929,5547,3519,4911,3929,5584,4917,3769,3929,3929,3929,4240,4273,3929,3779,3800,3744,4923,4927,4934,4935,4930,4939,4943,4949,4953,4945,4957,4957,4958,4962,3929,4247,4511,3929,3972,5871,3929,3983,3929,5572,5591,3929,4731,4359,5861,5581,4990,3929,3929,3929,5111,4846,5503,4707,5051,3929,4263,4465,3929,4282,3929,3929,3860,3929,5742,3929,3929,3737,3929,3894,5322,3929,5e3,5007,3507,3929,4290,3929,3929,4449,3929,5018,3929,3929,3642,5026,3929,3929,3929,5177,4628,3929,3300,3929,4346,3674,3681,3547,3929,3539,5030,5034,3929,3929,3929,5337,5040,3822,3929,3929,3641,5042,3929,3929,3929,5368,3643,3929,3929,3929,5405,5793,3929,3929,3929,5453,4626,3377,5052,3929,3929,3929,3721,4501,4368,3929,3546,3490,5496,5308,5793,3929,3929,5485,4370,3929,3929,5068,3972,5073,4863,3929,3513,4450,5122,3375,5406,3842,3929,3655,5793,3929,3739,4707,5781,3929,3990,3929,3929,4006,3299,4452,4369,3929,4439,4444,3929,3895,4547,3886,3929,5078,3929,3929,5048,5304,3929,5095,3929,5486,5051,4451,4368,3929,4474,4050,4057,4293,4450,3929,3929,5228,3929,5453,3929,3929,5072,4862,3929,5101,3929,3512,5742,3929,5241,5105,4986,3751,5323,3296,4502,4381,3929,4486,4034,3929,3684,3783,3744,5062,3929,3929,4209,3929,3929,3929,3560,3929,5118,3929,3929,5111,4852,4515,4382,5129,3929,4502,4176,3929,4350,5314,3549,3929,5797,3929,3929,3929,5526,5795,3929,3929,3929,5603,5136,5144,5227,4451,4236,3929,4975,3676,5063,4465,3744,4042,4464,5152,3929,4507,3865,3929,4121,5622,4297,4174,3342,5169,3342,5169,4514,3537,4561,4558,3929,4559,4453,3929,5213,4466,3929,4520,3929,3929,5170,4045,5196,5187,5174,4560,5185,4558,5193,5203,5211,5218,5221,5222,5226,3929,3929,3929,5725,3929,5232,4690,3929,4524,5352,3677,3929,3929,3929,5771,3929,5740,3929,4274,4848,5238,5247,5773,5254,5251,4704,3918,5260,5266,5262,5268,5272,5276,5280,5284,5287,5291,5294,5293,5298,5302,3929,3929,3929,5742,5425,3929,4694,5050,3546,3490,3494,3929,5318,3929,5327,3923,4464,4390,5227,3929,5816,5331,5341,3929,5782,3744,3929,4547,3770,3929,4547,3929,3736,5322,3929,5189,3929,3929,5189,5361,5367,3374,3929,4693,3929,3929,3829,3929,5372,3929,5411,3929,4704,4292,3929,3892,3929,3929,4517,5713,4819,4170,3929,5416,3991,3929,4708,4852,3929,4186,4190,3929,3765,3775,3800,5841,5084,3929,3929,5111,5157,3753,5377,5381,3929,3929,5117,3929,3929,5388,3821,3929,4708,5234,4550,3929,5393,5392,3929,4751,5041,3744,3929,3929,5048,5036,3929,5373,5397,4693,3501,3929,3929,3929,5766,4862,3929,3929,3929,5789,5048,4769,3378,3492,5429,4705,5779,3929,4781,4779,3929,4505,5110,3876,3929,3929,3929,5791,3972,5439,3839,3929,4815,3929,4778,5514,5443,3839,3929,4815,3929,5108,5841,5843,3929,3929,5139,3929,5050,5457,3492,4485,5465,3770,3878,3929,4821,3929,3929,4417,3929,3929,5472,5477,3929,4881,3929,5701,5473,5482,3929,3929,5140,3929,5478,3929,5420,3877,3546,5494,3714,3632,3929,5514,5508,3929,4907,5500,3929,4890,4880,3929,4193,4873,4873,4195,5742,3379,5773,3631,5525,3929,3929,3929,5870,5524,3760,3896,3929,5819,4519,5513,3488,5530,5351,3929,4708,4846,4159,3929,3929,3929,5155,5159,5336,5518,3761,3929,3929,5512,5536,4519,4522,3989,3929,3929,3929,4913,5518,3929,4964,4293,5179,5352,3929,3929,4125,3929,3929,4247,4402,4086,3353,3929,5556,5570,3929,5570,5578,3983,3929,5573,3929,4971,3751,3929,4253,3929,4261,5594,4522,3929,5601,3984,3929,5574,3929,4978,4224,3929,3929,5608,5571,5607,5351,5349,3929,3929,3929,5206,4827,3929,3929,4897,4901,5733,5834,3662,4782,5757,3879,5132,5614,5467,5620,5626,5630,5634,5638,5642,5646,5650,5654,5658,5662,5666,5670,5673,5677,5681,5685,3929,3929,5256,4275,5756,3929,3972,3929,4996,3929,5561,5708,5718,3929,5722,5729,3929,3888,3998,5749,3929,3929,3929,5311,3929,5731,5753,5459,3929,5014,4985,3929,4344,4461,3929,3875,5420,3929,3878,3929,3929,3929,3736,4071,4506,3929,3766,4521,4967,3929,3929,3929,5387,3820,5761,4485,3929,3929,5424,4691,5113,3998,3929,3929,5435,3873,3929,5112,5770,4234,5849,3929,3929,3929,5447,3929,5732,5805,3929,3972,4093,4097,3929,3905,3929,4408,3670,5786,3929,3929,3929,5447,4693,4517,5803,5807,3929,5046,5056,3929,4434,4245,3929,3770,5321,3929,3649,3929,3929,4977,4223,3929,5830,3929,3929,5450,5042,4423,5838,3929,3929,5507,4159,4423,5838,4248,5847,4578,5805,3929,4548,3929,3929,5813,4423,5854,3929,3929,5552,5542,5859,3929,3929,3929,5564,3929,5786,4235,3929,3929,5566,4810,4103,5807,3990,3929,5059,5357,3929,4549,3929,3929,4549,5416,3929,4674,3929,4868,5532,3929,3929,3929,5710,3929,3831,3998,3929,3929,5712,4818,3973,5866,3929,3929,5739,3929,3972,5865,3929,3929,5745,3929,4964,3929,5180,4523,5824,3832,3929,3929,3929,5777,5545,4965,3929,4409,3929,3675,3738,3973,3547,3929,3929,5841,3929,6277,6502,5875,6282,5878,6547,6266,5881,6546,5889,6232,5882,6232,5892,6221,6267,5888,5883,5884,6232,6232,6232,6232,6414,5887,5883,6232,5891,6232,6232,5894,6232,6232,5922,5937,5949,5938,5939,5949,5944,5950,5944,5944,5940,5944,5941,5952,5941,5944,5946,5945,5946,5946,5946,5946,5947,5941,5948,5952,5948,5944,5942,5954,5956,5958,5962,5960,5959,5964,5966,5967,5971,5967,5968,5967,5969,5974,5973,5976,5978,6293,5998,5875,6282,5896,6871,6437,6282,6321,6282,6282,6282,5917,6456,6456,6456,6456,5991,5906,6379,6455,5990,6019,5991,5904,5904,5904,6456,6456,5926,5899,6456,6456,5997,6282,6408,6410,6282,5932,6282,5933,6464,6024,6282,6282,6379,5924,6282,6282,5924,6282,6362,6010,5984,6282,6003,6282,6362,6282,6282,6282,6004,6456,5906,6455,5990,5904,5902,6456,6456,6456,5906,6457,6019,6019,5904,5904,6456,6456,6282,6282,6282,5980,5917,6456,6456,6456,6455,5905,6456,6445,5926,5926,5926,5926,6032,6032,6008,5932,6282,6282,6282,6434,6024,6282,6019,5904,6456,6282,5896,6873,6282,6282,6282,6474,5903,6457,6019,5904,6456,6229,5904,6456,6456,6456,6018,6457,6019,5991,5905,5906,6282,6282,6282,5984,6282,6282,6282,5925,6543,5905,6456,6456,6456,6282,5905,6229,5905,6229,5905,6282,6650,6437,6043,6515,6056,6672,6088,6052,6515,6520,6054,6060,6058,6515,6515,6083,6528,6101,6761,6518,6521,6516,6517,6063,6065,6068,6061,6057,6515,6515,6519,6515,6070,6072,6066,6515,6515,6515,6515,6125,6522,6074,6515,6515,6076,6515,6523,6079,6082,6515,6081,6055,6091,6089,6090,6093,6114,6092,6113,6114,6114,6114,6114,6115,6117,6116,6117,6117,6118,6119,6120,6121,6121,6095,6097,6099,6122,6123,6124,6524,5900,6515,6518,6103,6108,6110,6104,6105,6109,6106,6112,6121,6127,6129,6282,5899,6282,5925,6463,6321,6282,6294,6006,6378,6282,6508,6282,6449,6646,6218,6604,6282,6524,6291,6282,6774,6282,6270,6282,6282,6282,6e3,6e3,6027,6161,6282,6282,5895,6375,6282,6312,6230,6366,6265,5876,6282,6282,6282,6015,6406,6282,6284,6027,6027,6137,6282,6282,6379,6281,6372,6028,6159,6282,5899,6282,6282,6282,6573,6282,6282,6467,6282,6311,6312,6372,6282,6282,6282,6019,6019,5904,5904,5904,5904,5905,6456,6456,6031,6154,6158,6282,6149,6273,6282,6163,6282,6677,6280,6166,6279,6682,6685,6501,6173,6175,6178,6178,6178,6178,6176,6181,6180,6181,6181,6183,6181,6185,6187,6188,6188,6188,6194,6193,6194,6193,6193,6189,6191,6190,6190,6196,6196,6198,6203,6202,6204,6208,6203,6205,6199,6200,6210,6206,6212,6282,6282,5896,6282,6282,6282,6512,6282,6150,6135,6320,6500,6163,6282,6282,6282,6026,6282,6026,6166,6282,6282,6282,6027,6221,6282,6505,6282,6282,6282,6032,6238,6282,6241,6282,5899,6451,6282,5913,6669,6401,6238,6282,6282,6282,6037,6245,6282,6282,6282,6040,6282,6282,6225,6248,6282,6282,5916,6722,6377,6247,6249,6282,6282,5924,6370,6252,6253,6282,6282,5932,6282,6282,6530,5924,6254,6282,6282,6254,6282,6322,6228,6282,5933,6378,6282,6378,6282,6452,6282,6432,6317,6282,5917,6086,6725,6727,6216,6086,6726,6450,6231,5926,5933,6008,6008,6008,6282,6282,6282,5918,6282,6282,6282,5923,6309,6683,6282,6282,6282,6148,6216,6308,6310,6282,6282,6282,6149,6282,5903,6397,6605,6282,6282,5933,5933,5933,6780,6282,6282,6282,6229,6282,6282,6282,5933,5924,6316,5917,6723,6377,5916,6722,6323,6448,6454,6216,6332,6436,6683,6282,5917,6328,6465,6450,6217,6231,6160,6436,6683,6328,6448,6454,6216,6610,6436,6683,6282,6221,6602,6310,6282,5984,5899,5925,6229,6435,6500,6281,6722,6013,6465,6450,6160,6603,6683,6282,6282,6231,6218,6310,6282,5984,6282,6283,6043,5914,6282,5933,6328,6465,6450,6647,6604,6282,6e3,6282,6282,6283,6277,6707,6733,6282,6722,6465,6230,6396,6282,6282,6282,6235,6686,6282,6708,6281,6282,6e3,6437,6362,6338,6279,6282,6282,6283,6444,6145,6683,6282,6282,5933,6003,6282,6282,6282,6006,6375,6465,6708,6282,6005,6282,6282,6287,6289,6282,6548,6282,6282,5933,6282,6282,6282,6137,6282,6282,6020,6282,6375,6282,6282,6282,6281,6471,6218,6683,6282,6282,6282,6370,5984,6282,6010,6795,5984,5899,6282,6282,6661,6282,6e3,6137,6282,6282,6282,6282,5896,5914,6704,6273,5928,6340,6344,6503,6348,6349,6349,6350,6355,6352,6349,6349,6349,6349,6354,6355,6355,6355,6356,6357,6357,6357,6357,6357,6358,6359,6359,6359,6359,6383,6360,6382,6382,6382,6361,6282,6282,6282,6283,6043,5903,5897,6485,6376,6395,6425,6282,6282,6282,6293,6291,6338,6282,6282,6282,6284,6282,6282,6345,6282,6282,6291,6282,6282,6282,6230,5876,6282,6407,6282,6282,6282,6286,6282,6282,6037,6411,6417,6282,6282,5979,5903,6470,6313,6647,6281,6282,6282,6408,6416,6418,6282,6282,5979,6525,6458,6342,6422,6282,6282,6282,6288,6282,6664,6731,6282,6012,6e3,6282,6012,6335,6310,5985,6504,6282,6282,6273,6470,6372,6273,6504,6385,6282,6282,6412,6257,6598,6600,6282,6411,6413,6597,6599,6599,6282,6282,6282,6291,6410,6282,6322,6451,5926,5926,6008,6008,6008,5932,6236,6282,6282,6282,6292,5982,6282,6283,6442,6050,6013,6609,6259,6424,6310,6282,5919,5920,6282,6282,6011,5916,6282,6664,6282,6282,6023,6437,6459,5983,6013,6594,6700,6437,6282,6424,6437,6282,6282,6235,6480,6481,6282,6282,6133,6282,6282,6485,6376,6647,6282,6016,6282,6282,5933,6330,6454,6217,6683,6282,6282,6484,5917,5929,6011,6608,6259,6425,6282,6486,5983,6013,6594,6786,6437,6282,6282,6282,6294,6282,6283,6484,5917,5983,6013,6531,6471,6282,6282,6146,6683,6282,6282,6155,6282,6282,6385,6282,6322,6282,6282,6275,6493,5917,5983,6324,6259,6729,6282,6019,6019,6019,5991,5904,6277,5903,6531,6011,6148,6282,6282,6282,6234,6531,6282,6282,6282,6322,6282,6133,6372,6505,6282,6230,6282,6282,6171,6756,6531,6046,6834,6437,6282,6282,6285,6530,5924,6282,6684,6282,6149,6282,6282,6282,6325,6285,6530,6045,6159,6024,6046,6386,6282,6282,6282,6372,6282,6294,6282,6530,6464,6386,6282,6282,6215,6224,5933,5924,6410,6282,6040,6282,6482,6282,6282,6282,6531,6536,6024,6282,6282,6282,6370,5987,6282,6535,6282,6282,6227,6282,6282,6282,6378,6378,6378,6282,6452,5994,6282,6282,6282,6394,6282,6282,6282,6404,6539,6333,6683,6282,6020,6282,6282,6282,6341,6282,6570,6300,6569,6301,6370,6545,6300,6302,6303,6303,6303,6303,6303,6304,6551,6554,6552,6561,6552,6555,6563,6564,6563,6563,6563,6563,6564,6556,6557,6557,6557,6557,6558,6372,6273,6282,6282,6243,6282,6509,6566,6282,6282,6271,6213,6282,6283,6568,6282,6021,6041,6282,6027,6282,6321,6282,6006,6282,6282,6027,6462,6282,6282,6282,6572,6282,6168,6282,6575,6510,6282,6029,6282,6282,6282,6588,5907,5909,5911,6282,6036,6282,6282,6388,6407,5908,5910,6282,6282,6272,6282,6526,6282,5916,6322,6282,6378,6282,6020,6282,6278,6282,6282,6394,5924,6278,6282,6283,6502,6365,6282,6579,6282,6282,6275,6525,5914,5992,6371,6048,6365,6367,6369,6282,6282,6277,6531,6046,6275,6583,5993,6047,6256,6256,6366,6368,6282,6282,6452,6e3,6282,6282,6282,6408,6282,6027,6282,6372,6526,6282,5899,6539,6664,6682,6282,6282,6282,6146,6282,6482,6282,6006,6451,6282,6282,6282,5985,6458,6342,6313,6136,6152,6282,6037,6378,6282,6282,6282,6421,6584,6020,6437,6683,6282,6027,6321,6282,6451,6646,6152,6282,6282,6282,6410,6282,6282,6282,6375,6282,6e3,6526,6322,6533,6682,6282,6408,6282,6282,6282,6505,6282,6282,6278,6282,6282,6282,6143,6371,6472,6282,6282,6282,6423,6539,6437,6683,6282,6040,6148,6040,6149,6273,6229,6682,6282,6470,6282,6282,6283,6282,6282,6282,6524,6548,5933,6282,5933,6282,6434,6410,6282,6282,6434,6537,6282,6664,6491,6866,5876,6482,6491,6282,6282,6283,6410,6282,6427,6282,6282,5980,6011,6276,6037,6285,6038,6590,6783,6607,6612,6620,6619,6620,6620,6616,6620,6620,6618,6622,6620,6614,6613,6624,6627,6626,6627,6627,6628,6630,6630,6634,6630,6632,6631,6630,6630,6630,6636,6638,6638,6637,6637,6640,6641,6282,6132,6282,6282,5895,5924,5984,6282,6640,6637,6640,6640,6640,6640,6505,5903,6644,6331,6649,6282,6282,6229,5879,6282,6527,6653,6148,6282,6137,5924,6282,6282,6282,6230,6281,6282,6282,6306,6402,6433,6346,6656,6658,6549,6282,6282,6283,6475,6423,6282,6282,6282,6437,6682,5912,6668,6400,6282,6157,6282,6282,5896,6451,5980,5917,6029,6221,6281,6282,6282,6524,6282,6282,6282,5930,6664,6282,6264,6683,6694,6282,6282,6282,6452,6282,6282,6282,6285,5897,6453,6654,6282,6346,6295,6282,6282,6283,6582,6297,6282,6681,6282,6164,6024,6282,6133,6451,6282,5988,6281,6285,5980,6458,6371,6263,6647,6281,6282,6676,6282,6676,6514,5903,6680,6465,6489,5995,6282,6282,6283,6496,6085,6282,6513,6525,6679,6688,6688,6399,6713,6281,6282,6286,6282,6037,6282,6282,6282,5899,6691,6497,6724,6488,6734,6282,6282,6282,6498,6282,6282,6282,6255,6282,6283,6691,6696,6724,6488,6698,6331,6222,6282,6282,6282,6431,6296,6282,6282,6282,6499,6282,6282,5903,6464,6231,6734,6696,6134,6733,6281,6693,6282,6282,6434,6282,6282,6282,6277,6525,6531,6471,6218,6231,6490,6282,6282,6282,6504,6548,6282,6283,6278,6282,6275,6710,6733,6282,6169,6282,6282,6509,6003,6712,6282,6282,6282,6508,5899,6702,6490,6282,6282,6283,6861,6854,6033,6858,6646,6218,6604,6282,6282,6282,6577,6286,6282,6394,6282,6229,6019,6019,6019,6019,5904,6286,6282,6137,6282,6229,6282,6292,6229,6282,6282,6372,6505,6282,6437,6683,6282,6229,6146,6265,6282,6283,6525,5927,6539,6729,6683,6282,6282,6650,6282,6282,6283,6863,6364,6024,6282,6282,6283,6869,6282,6362,6282,6362,6363,6010,6592,5925,6719,6591,6593,6718,6721,5934,5934,5935,6469,6736,5934,5934,5934,6736,6738,6742,6740,6739,6744,6746,6751,6751,6752,6753,6747,6748,6748,6748,6749,6751,6751,6751,6753,6753,6753,6753,6758,6754,6755,6282,6282,6285,6282,6282,6282,6014,6760,5981,6007,6728,6282,6763,6282,6282,6285,6496,6531,6282,6283,6768,6770,6282,6282,6282,6539,6392,6282,6282,6392,6027,6156,6282,6282,6293,6586,6282,6373,6281,6285,6507,5903,6470,6326,6505,6659,6282,6234,6229,5879,6283,6496,6703,6776,6704,6777,6282,6282,6282,6548,6282,5918,6025,6282,6282,6026,6282,6286,6505,6394,6282,6291,6370,6282,6370,6282,6496,6085,6831,6147,6603,6683,6282,6380,6282,6282,6370,6282,6282,6282,6003,6282,6294,6336,6e3,6282,6239,6846,6282,6260,6282,6282,6282,6642,6379,6282,6505,6336,6283,6702,6782,6319,6218,6604,6282,6785,5999,6282,6269,6663,6282,6140,6282,6282,6393,6282,5982,6724,6319,6218,6604,6539,6310,6282,6282,6375,6370,6375,6788,6320,6310,6e3,6e3,6282,6282,6375,6548,6282,6282,6282,6275,6084,6447,6282,6788,6429,6683,6282,6282,6664,6683,6282,6273,6541,6148,6282,6394,6e3,6282,6274,6282,6003,6318,6429,6683,6282,6275,5898,5915,6282,6282,6370,6370,6370,6664,6282,6683,6282,6410,6282,6699,6282,6275,5901,5982,6724,6291,6282,6282,6531,6689,6282,6282,6220,6282,6537,6282,6282,6282,6664,6146,6282,6282,6434,6281,6282,6282,6282,6020,6282,6006,6410,6408,6282,6027,6282,6282,6250,6843,6434,6410,6282,6434,6410,6282,6408,6282,6322,6282,6410,6410,6027,6282,6275,6702,6231,6490,6146,6282,6146,6282,6282,6282,6671,6146,6410,6408,6408,6409,6409,6409,6409,6409,6282,6282,6282,6682,6282,6282,6285,6039,6216,6221,6281,6286,6282,6282,6790,6543,6282,6505,6003,6282,6559,6282,6282,6559,6508,6792,6282,6077,6139,6282,6282,6379,6374,6793,6806,6798,6798,6801,6799,6798,6799,6798,6797,6803,6808,6807,6808,6805,6808,6809,6810,6813,6814,6815,6816,6815,6818,6811,6813,6811,6813,6820,6822,6822,6821,6821,6824,6824,6824,6824,6821,6824,6824,6828,6825,6826,6282,6282,6282,6683,6282,6282,6689,6439,6282,6277,6715,6282,6282,6282,6510,6035,6282,6282,6282,6684,6282,6282,6282,6233,6282,6716,6282,6580,6419,6282,6836,6282,6281,6282,6282,6283,6293,6337,6282,6838,6840,6282,6282,6666,6282,6143,6292,6282,6282,6292,6282,6282,6282,6378,6845,6282,6282,6845,6282,6487,6282,6282,6391,6391,6651,6282,6282,6282,6730,6512,6282,6282,6282,6830,6853,5931,6141,6428,6602,6604,6282,6282,6409,6410,6282,6852,6854,6856,6450,6002,6282,6001,6003,6282,6645,6231,6281,6282,6282,6674,6282,6167,6282,6282,6e3,6282,6e3,6034,6282,6282,6282,6848,6282,6394,6683,6282,6282,5933,6003,5933,6003,6282,6830,6645,6231,6222,6487,6282,6024,6282,6282,6693,6282,6282,6282,6464,6861,6854,6009,6377,6525,5931,6011,6465,6282,6830,5885,6282,6282,6702,5931,6319,6436,6683,5916,6282,6282,5925,6282,6282,6448,6282,6282,6931,6282,6282,6451,6282,6282,6282,6860,6044,6011,6465,6449,6647,6310,6282,6282,6142,6436,6683,6282,6282,6732,5924,5984,6861,5983,6377,6454,5982,6321,6282,6294,6138,6282,6461,6151,6437,6282,6282,6732,6772,6860,5983,6465,6151,6437,6282,6865,6282,6282,6282,6860,6337,6437,6282,6282,6466,6282,6144,6436,6282,6282,6282,6868,6219,6282,6282,6282,6468,6282,6282,6732,6282,5916,6262,6299,6282,5918,5918,5918,6378,6282,6282,6526,6282,6148,6282,6283,6293,6586,6292,6502,6437,6282,6282,6282,6294,6282,6292,6294,6282,6282,6474,5980,6293,6291,6282,6282,6292,6502,6282,6278,6294,6282,6278,6282,6282,6765,6282,6229,6362,6282,6230,6320,6500,6282,6505,6282,6292,6502,6282,6505,6233,6282,6282,6293,6282,6282,6282,6474,6478,6291,6278,6282,6282,6292,6531,6536,6875,6255,6282,6282,6476,6282,6006,6255,6282,6006,6390,6282,6314,6049,6282,6877,6878,6881,6375,6880,5930,6282,6532,6542,6883,6596,6258,6885,6596,6595,6595,6886,6889,6595,6888,6890,6889,6892,6897,6893,6894,6895,6899,6900,6905,6905,6901,6902,6912,6903,6902,6906,6905,6906,6905,6906,6907,6909,6908,6910,6914,6908,6908,6922,6922,6921,6922,6923,6916,6917,6918,6920,6926,6925,6928,6460,6371,6282,6282,6482,5932,6321,6285,6282,6282,6494,6371,6930,6282,6282,6282,6505,6494,6371,6130,6282,6282,6282,6505,6506,6282,6282,6282,6312,6933,6282,6505,6935,6282,6282,6937,6282,6282,6767,6769,6290,6282,6282,6282,6505,6692,6011,6313,6291,6233,6282,6282,6508,6282,6282,6282,5916,6030,6282,6423,6170,6282,6282,6170,6011,6372,6282,5916,6282,6282,5915,6451,6440,6282,6282,5918,6322,6283,6939,6446,6705,6447,6291,6282,6282,6294,6282,6282,6282,6438,6282,6282,6511,6282,6282,6282,6842,6149,6282,6149,6282,6282,6779,6007,6728,6310,6282,6282,6319,6310,6282,6282,6363,6282,6692,6011,6372,5916,6282,5915,6282,6282,6511,6268,6286,6282,5924,6282,6282,6833,6282,6279,6398,6282,6282,6014,6282,6282,6282,6601,6282,6439,5933,6133,6282,6148,6282,6255,6282,5914,5931,6705,6282,6282,6850,6282,6850,6282,6372,6282,6372,6282,6149,6282,6505,5914,5931,6291,6282,6282,5982,6585,6282,6282,6660,6291,6043,5914,6291,6282,6282,6283,6043,5899,6282,6282,1048576,1073741824,2147483648,1075838976,2097152,2147483648,4194560,4196352,-2143289344,-2143289344,4194304,2147483648,37748736,541065216,541065216,-2143289344,4198144,4196352,276901888,8540160,4194304,1,4,16,64,0,48,64,32,64,64,96,0,59,140224,5505024,-1887436800,0,63,64,128,0,64,256,0,110,110,8425488,4194304,1024,0,128,128,512,512,1024,1024,2048,0,256,256,257,37748736,742391808,742391808,775946240,-1371537408,775946240,4718592,775946240,775946240,171966464,171966464,775946240,239075328,-1405091840,-1371537408,239075328,171966464,64,4718592,2097216,4720640,541589504,4194368,4194368,541065280,541589504,4194400,-2143289280,4194368,-2143285440,-2143285408,-2143285408,-2109730976,775946336,776470528,-2143285408,776470528,775946304,775946304,-1908404384,775946304,-1908404384,2,8,32,128,1024,4096,0,260,8392704,0,1856,64,524288,64,896,8192,67108864,2147483648,96,262144,262144,8192,0,288,8388608,0,384,0,512,2048,2048,4096,4096,8192,8192,16384,0,520,520,96,524288,524288,0,2432,2048,268435456,0,24576,0,32768,32768,65536,1048576,128,2048,12288,0,12289,0,16384,16384,32768,0,1864,2,16,1024,98304,131072,262144,1048576,512,5120,2,536936448,80,528,528,2097168,2097168,268435472,524304,1048592,2097168,24,560,48,2097680,1048592,3145744,1048592,20,560,48,3146256,2097552,3146256,28,16,8192,2,2098064,163577856,17,21,112,128,3584,8192,2228784,-161430188,-161430188,-161429680,-161430188,-161429676,-161430188,-161298576,-160299088,-161298576,-161298572,-160774288,-160299084,146804757,146812949,146862101,146863389,146863389,148960541,-161429740,-161429676,146863421,148960541,146863389,-161429676,-160905388,-161429676,-161429676,-161429675,-161349072,-161349072,-161347728,-161347728,-161298572,-161298572,-160774284,-161298572,16,262160,-18860267,-160774284,-18729163,0,58368,159383552,0,65536,2097152,8388608,33554432,0,66048,0,77824,524288,33554432,1024,262144,2097152,16777216,67108864,0,131072,524288,134217728,2147483648,1,32768,196608,0,131328,131072,16777216,100663296,-1073741824,164096,0,131584,2621440,0,139264,0,150528,0,235712,16777216,1073774592,1226014816,100665360,-2046818288,100665360,100665360,-2044196848,1091799136,1091799136,1091803360,1091799136,1158908e3,1158908001,1192462432,1192462448,1192462448,1870638912,1870655296,1870638912,1200851056,1200851056,1091799393,1870655296,1870655296,1870655312,1870655316,1870655312,1870655312,1870638928,1870655316,1870655316,1870655317,1870655316,1879043952,1870655348,1870655316,1879027568,1879043952,1879043956,0,284672,229440,1048576,2097152,67108864,134217728,8,4194304,16777216,2147483648,1224736768,0,503616,2048,100663296,0,524288,2097152,4194304,4194304,0,40,0,44,-2046820352,0,605503,231488,1090519040,1157627904,1191182336,9437184,231744,52e4,7864320,1862270976,0,867391,1862270976,1862270976,16252928,0,1048576,4194304,25165824,25165824,33554432,8192,98304,1048576,8388608,134217728,268435456,4194432,3145728,0,24,0,29,0,32,1,2,2,4,0,2147483648,2147483648,0,0,1,0,2,0,3,240,19456,262144,0,4,8,0,6,0,7,150994944,0,1049088,1049088,12845065,12845065,147193865,128,6144,4194304,251658240,536870912,1073741824,32768,131072,1048576,4096,83886080,117440512,0,3145728,16777216,134217728,0,2048,8192,229376,0,2304,1536,8192,1536,65536,4194304,67108864,536870912,9216,33554432,262144,134217728,1073741824,50331649,9476,512,8192,134218240,1050624,0,5242880,1275208192,4194312,4194312,4194344,4194312,541065224,4203820,-869654016,-869654016,1279402504,1279402504,2143549415,2143549415,2143549423,0,8388608,4096,4194304,8388608,16777216,33554432,-1946157056,0,8192,131072,0,1792,0,1024,8192,65536,0,1536,2147483648,2143549423,2143549423,2143549415,1,16777216,268435456,512,139264,2760704,-872415232,0,19947520,0,33554432,67108864,1073741824,1073741824,262144,7340032,-2030043136,0,331776,300,4203520,4333568,1275068416,0,16777216,16777216,0,999,259072,4194304,4194432,999,29619200,2113929216,0,58720256,1007,1007,0,67108864,402653184,536870912,2048,1048576,16777216,536870912,300,0,83886080,0,2097152,134217728,536870912,0,49152,0,57344,102,384,6,96,128,3072,16384,65536,524288,1048576,0,4096,262144,524288,96,96,64,384,512,4096,65536,131072,1024,65536,262144,131072,32768,256,384,8192,33554432,2147483648,1,6,8,8388608,96,384,104,104,0,134217728,6,32,256,512,65536,7340032,50331648,0,8396800,4,32,384,4,64,1024,2097152,268435456,1073741824,8,262144,512,0,8,8,16,0,9,0,12,0,15,16,16,17,20,16,20,48,16,28,0,16,32,0,21,53,4,256,1024,524288,536870912,256,65536,16777216,1073741824,2048,524288,32,4100,1024,134217728,1049088,270532608,2097152,2097152,0,23,5505537,5587457,5591557,147202057,5587457,13894153,-1881791493,-1881791493,0,134218752,5587465,5587457,13894153,13894153,81003049,4456448,8388608,5505024,0,134348800,134348800,82432,0,142606336,5,86528,41,75497472,81920,0,184549376,2,56,64,2048,262144,536870912,2048,134217728,-2113929216,16777216,1073743872,268435968,229376,25165824,92274688,25165824,100663296,402653184,1610612736,0,100663296,134217728,805306368,1073741824,8388608,268567040,16384,229376,4194304,117440512,2113544,68423701,-2079059883,-2079059947,85200917,68423701,68423765,68489237,68423701,68423701,72618005,68423701,68425749,68423703,85200919,69488664,69488664,70537244,70537245,70537245,-2076946339,-2076946403,70537245,70537309,70539293,-2022351745,-2022351617,-2022351745,-2022351617,-2022351617,0,243269632,256,32768,1048576,33554432,134217728,-2113929216,0,268435456,49152,266240,1048576,67108864,-2080374784,-2080374784,268288,0,301989888,0,318767104,282624,0,536870912,28,3145728,192,351232,7340032,5,16,1049104,12,3145728,13,0,1073741825,192,3072,20480,0,1073741824,0,262144,2621440,-1073741824,20480,65536,268435456,14,32,512,131072,268435456,192,1024,64,32768,33554432,268435456,4,128,3840,16384,262144,128,2097152,1073741824,4,2097152,4,50331648,67108864,128,50331648,1073741824,128,268435968,268435968,268436032,256,1536,2048,16384,98304,393216,524288,268435456,536870912,9216,0,4194304,50331648,2147483648,256,536871168,-1879046336,-1879046334,-1879046326,-1879046334,1073744256,-1879046334,-1879046326,-1845491902,-1878784182,268444480,268436288,268436288,268436289,268444480,268444480,2100318149,2100318149,2100326341,0,1090519040,2100326341,2100326341,1,16,536936448,576,0,832,8192,1,4036,19939328,2080374784,0,1,1024,768,8192,16384,19922944,2080374784,1,128,4096,3584,16384,524288,8,33554432,402653184,2048,3145728,128,131072,268500992,4243456,4096,1048588,0,1258292224,1124073472,1124073472,1124073488,1124073474,1124073472,1392574464,1124073472,1073754113,12289,1124073472,12289,12289,1098920193,1132474625,1098920209,1132474625,1132474625,1124085761,1124085761,1124085777,1258304513,1124085761,1400975617,2132360255,2132622399,2132360255,2132622399,2132622399,2141011263,0,2140749119,2141011263,2,16384,3145728,12545,25165824,268435456,12305,13313,12561,0,78081,327155712,605247,1058013184,1073741824,867647,1066401792,0,1,12288,256,8388608,1,30,32,1024,2048,339968,327680,524288,1,14,16,14,1024,16384,4194304,134217728,1,12,1024,8,134217728,8,536870912,9437184,0,68157440,137363456,0,137363456,66,66,100680704,25165824,26214400,92274688,25165952,93323264,92274688,92274688,92274720,93323264,25165890,100721928,100721928,100787464,100721664,100721664,100853e3,100721928,125977600,125846528,125846528,125846560,125977600,125977600,127026176,281843,281843,1330419,281843,126895104,125846528,1330419,1330419,72633587,5524723,72633587,92556531,93605107,93605107,5524723,5524723,39079155,97799411,127290611,127290611,131484915,0,17408,33554432,1073741824,58624,0,124160,189696,148480,50331648,2,112],r.TOKEN=[\"(0)\",\"PragmaContents\",\"DirCommentContents\",\"DirPIContents\",\"CDataSection\",\"Wildcard\",\"EQName\",\"URILiteral\",\"IntegerLiteral\",\"DecimalLiteral\",\"DoubleLiteral\",\"StringLiteral\",\"PredefinedEntityRef\",\"'\\\"\\\"'\",\"EscapeApos\",\"ElementContentChar\",\"QuotAttrContentChar\",\"AposAttrContentChar\",\"PITarget\",\"NCName\",\"QName\",\"S\",\"S\",\"CharRef\",\"CommentContents\",\"EOF\",\"'!'\",\"'!='\",\"'\\\"'\",\"'#'\",\"'#)'\",\"'$'\",\"'%'\",\"''''\",\"'('\",\"'(#'\",\"'(:'\",\"')'\",\"'*'\",\"'*'\",\"'+'\",\"','\",\"'-'\",\"'-->'\",\"'.'\",\"'..'\",\"'/'\",\"'//'\",\"'/>'\",\"':'\",\"':)'\",\"'::'\",\"':='\",\"';'\",\"'<'\",\"'<!--'\",\"'</'\",\"'<<'\",\"'<='\",\"'<?'\",\"'='\",\"'>'\",\"'>='\",\"'>>'\",\"'?'\",\"'?>'\",\"'@'\",\"'NaN'\",\"'['\",\"']'\",\"'after'\",\"'all'\",\"'allowing'\",\"'ancestor'\",\"'ancestor-or-self'\",\"'and'\",\"'any'\",\"'append'\",\"'array'\",\"'as'\",\"'ascending'\",\"'at'\",\"'attribute'\",\"'base-uri'\",\"'before'\",\"'boundary-space'\",\"'break'\",\"'by'\",\"'case'\",\"'cast'\",\"'castable'\",\"'catch'\",\"'check'\",\"'child'\",\"'collation'\",\"'collection'\",\"'comment'\",\"'constraint'\",\"'construction'\",\"'contains'\",\"'content'\",\"'context'\",\"'continue'\",\"'copy'\",\"'copy-namespaces'\",\"'count'\",\"'decimal-format'\",\"'decimal-separator'\",\"'declare'\",\"'default'\",\"'delete'\",\"'descendant'\",\"'descendant-or-self'\",\"'descending'\",\"'diacritics'\",\"'different'\",\"'digit'\",\"'distance'\",\"'div'\",\"'document'\",\"'document-node'\",\"'element'\",\"'else'\",\"'empty'\",\"'empty-sequence'\",\"'encoding'\",\"'end'\",\"'entire'\",\"'eq'\",\"'every'\",\"'exactly'\",\"'except'\",\"'exit'\",\"'external'\",\"'first'\",\"'following'\",\"'following-sibling'\",\"'for'\",\"'foreach'\",\"'foreign'\",\"'from'\",\"'ft-option'\",\"'ftand'\",\"'ftnot'\",\"'ftor'\",\"'function'\",\"'ge'\",\"'greatest'\",\"'group'\",\"'grouping-separator'\",\"'gt'\",\"'idiv'\",\"'if'\",\"'import'\",\"'in'\",\"'index'\",\"'infinity'\",\"'inherit'\",\"'insensitive'\",\"'insert'\",\"'instance'\",\"'integrity'\",\"'intersect'\",\"'into'\",\"'is'\",\"'item'\",\"'json'\",\"'json-item'\",\"'key'\",\"'language'\",\"'last'\",\"'lax'\",\"'le'\",\"'least'\",\"'let'\",\"'levels'\",\"'loop'\",\"'lowercase'\",\"'lt'\",\"'minus-sign'\",\"'mod'\",\"'modify'\",\"'module'\",\"'most'\",\"'namespace'\",\"'namespace-node'\",\"'ne'\",\"'next'\",\"'no'\",\"'no-inherit'\",\"'no-preserve'\",\"'node'\",\"'nodes'\",\"'not'\",\"'object'\",\"'occurs'\",\"'of'\",\"'on'\",\"'only'\",\"'option'\",\"'or'\",\"'order'\",\"'ordered'\",\"'ordering'\",\"'paragraph'\",\"'paragraphs'\",\"'parent'\",\"'pattern-separator'\",\"'per-mille'\",\"'percent'\",\"'phrase'\",\"'position'\",\"'preceding'\",\"'preceding-sibling'\",\"'preserve'\",\"'previous'\",\"'processing-instruction'\",\"'relationship'\",\"'rename'\",\"'replace'\",\"'return'\",\"'returning'\",\"'revalidation'\",\"'same'\",\"'satisfies'\",\"'schema'\",\"'schema-attribute'\",\"'schema-element'\",\"'score'\",\"'self'\",\"'sensitive'\",\"'sentence'\",\"'sentences'\",\"'skip'\",\"'sliding'\",\"'some'\",\"'stable'\",\"'start'\",\"'stemming'\",\"'stop'\",\"'strict'\",\"'strip'\",\"'structured-item'\",\"'switch'\",\"'text'\",\"'then'\",\"'thesaurus'\",\"'times'\",\"'to'\",\"'treat'\",\"'try'\",\"'tumbling'\",\"'type'\",\"'typeswitch'\",\"'union'\",\"'unique'\",\"'unordered'\",\"'updating'\",\"'uppercase'\",\"'using'\",\"'validate'\",\"'value'\",\"'variable'\",\"'version'\",\"'weight'\",\"'when'\",\"'where'\",\"'while'\",\"'wildcards'\",\"'window'\",\"'with'\",\"'without'\",\"'word'\",\"'words'\",\"'xquery'\",\"'zero-digit'\",\"'{'\",\"'{{'\",\"'{|'\",\"'|'\",\"'||'\",\"'|}'\",\"'}'\",\"'}}'\"]},{}],10:[function(e,t,n){n.TreeOps={flatten:function(e){var t=this,n=\"\";if(!e)throw new Error(\"Invalid node found\");return e.value===undefined?e.children.forEach(function(e){n+=t.flatten(e)}):n+=e.value,n},concat:function(e,t,n){var r=n?{}:e;n&&Object.keys(e).forEach(function(t){r[t]=e[t]});var i=Object.keys(t);return i.forEach(function(e){r[e]=t[e]}),r},removeParentPtr:function(e){e.getParent!==undefined&&delete e.getParent;for(var t in e.children){var n=e.children[t];this.removeParentPtr(n)}},inRange:function(e,t,n){if(e&&e.sl<=t.line&&t.line<=e.el){if(e.sl<t.line&&t.line<e.el)return!0;if(e.sl===t.line&&t.line<e.el)return e.sc<=t.col;if(e.sl===t.line&&e.el===t.line)return e.sc<=t.col&&t.col<=e.ec+(n?1:0);if(e.sl<t.line&&e.el===t.line)return t.col<=e.ec+(n?1:0)}},findNode:function(e,t){if(!e)return;var n=e.pos;if(this.inRange(n,t)===!0){for(var r in e.children){var i=e.children[r],s=this.findNode(i,t);if(s!==undefined)return s}return e}return},astAsXML:function(e,t){var n=\"\";t=t?t:\"\",e.value&&(n+=t+\"<\"+e.name+\">\"+e.value+\"</\"+e.name+\">\\n\"),n+=t+\"<\"+e.name+\">\\n\";var r=this;return e.children.forEach(function(e){n+=r.astAsXML(e,t+\"    \")}),n+=t+\"</\"+e.name+\">\\n\",n}}},{}],11:[function(e,t,n){var r=n.createStaticContext=function(){var t=e(\"./compiler/static_context\").StaticContext;return new t};n.XQLint=function(t,n){n=n?n:{};var i=e(\"./parsers/JSONiqParser\").JSONiqParser,s=e(\"./parsers/XQueryParser\").XQueryParser,o=e(\"./parsers/JSONParseTreeHandler\").JSONParseTreeHandler,u=e(\"./compiler/translator\").Translator,a=e(\"./formatter/style_checker\").StyleChecker,f=e(\"../lib/completion/completer\"),l=function(e,t){return e?(Object.keys(t).forEach(function(n){e[n]===undefined&&(e[n]=t[n])}),e):t};n=l(n,{styleCheck:!1});var c;this.getAST=function(){return c};var h=[];this.getMarkers=function(){return h},this.getErrors=function(){var e=[];return h.forEach(function(t){t.type===\"error\"&&e.push(t)}),e},this.getWarnings=function(){var e=[];return h.forEach(function(t){t.type===\"warning\"&&e.push(t)}),e},this.getCompletions=function(e){return f.complete(t,c,v,e)};var p=!1;this.hasSyntaxError=function(){return p};var d=function(e,t,n){var r=e.substring(0,t),i=e.substring(0,n),s=r.split(\"\\n\").length,o=t-r.lastIndexOf(\"\\n\"),u=i.split(\"\\n\").length,a=n-i.lastIndexOf(\"\\n\"),f={sl:s-1,sc:o-1,el:u-1,ec:a-1};return f},v=n.staticContext?n.staticContext:r(),m=n.fileName?n.fileName:\"\",g=m.substring(m.length-\".jq\".length).indexOf(\".jq\")!==-1&&t.indexOf(\"xquery version\")!==0||t.indexOf(\"jsoniq version\")===0,y=new o(t),b=g?new i(t,y):new s(t,y);try{b.parse_XQuery()}catch(w){if(!(w instanceof b.ParseException))throw w;p=!0,y.closeParseTree();var E=d(t,w.getBegin(),w.getEnd()),S=b.getErrorMessage(w);E.sc===E.ec&&E.ec++,h.push({pos:E,type:\"error\",level:\"error\",message:S})}c=y.getParseTree(),n.styleCheck&&(h=h.concat((new a(c,t)).getMarkers()));var x=new u(v,c);h=h.concat(x.getMarkers())}},{\"../lib/completion/completer\":5,\"./compiler/static_context\":3,\"./compiler/translator\":4,\"./formatter/style_checker\":6,\"./parsers/JSONParseTreeHandler\":7,\"./parsers/JSONiqParser\":8,\"./parsers/XQueryParser\":9}]},{},[11])(11)}),define(\"ace/mode/xquery/modules\",[\"require\",\"exports\",\"module\"],function(e,t,n){t.Modules={\"http://xbrl.io/modules/bizql/components\":{ns:\"http://xbrl.io/modules/bizql/components\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for retrieving components.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Components help organizing the facts contained in archives\\n in smaller parts that \"make sense\" together. A component is identified\\n with a CID (component ID).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A component is made of networks (see the networks module) and hypercubes\\n (see the hypercubes module).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve all components, all components belonging\\n to one or several archives. You can retrieve the CID of a component or retrieve\\n the components associated with a couple of CIDs.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/components\",prefix:\"components\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"cid\",qname:\"components:cid\",signature:\"($component-or-id as item()) as atomic\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized component id (CID). The input\\n can be either an CID, or an component object which contains an _id.</p>\\n',summary:\"<p>  Converts the input to a normalized component id (CID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"component-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an component object or an CID.</div>'}],returns:{type:\"atomic\",description:\"the normalized CID.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">components:INVALID_PARAMETER if the CID or component is not valid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"components-for-archives\",qname:\"components:components-for-archives\",signature:\"($archive-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all components that belong to the supplied archives.</p>\\n',summary:\"<p>  Retrieves all components that belong to the supplied archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"all components in the archive with this AID.\"},errors:[]},{isDocumented:!0,arity:0,name:\"components\",qname:\"components:components\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all components.</p>\\n',summary:\"<p>  Retrieves all components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all components.\"},errors:[]},{isDocumented:!0,arity:1,name:\"components\",qname:\"components:components\",signature:\"($component-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the components with the given CIDs.</p>\\n',summary:\"<p>  Retrieves the components with the given CIDs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"component-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the CIDs or the components themselves.</div>'}],returns:{type:\"object()*\",description:\"the components whose _id field matches one of these CIDs.\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-abstract-primary-items-in-hypercubes\",qname:\"components:num-abstract-primary-items-in-hypercubes\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) abstract primary items being\\n in a hypercube for each of the given components.\\n\",summary:\"<p> Return the number of (distinct) abstract primary items being\\n in a hypercube for each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concrete-primary-items-in-hypercubes\",qname:\"components:num-concrete-primary-items-in-hypercubes\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) concrete primary items being\\n in a hypercube for each of the given components.\\n\",summary:\"<p> Return the number of (distinct) concrete primary items being\\n in a hypercube for each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concrete-primary-items-not-in-hypercubes\",qname:\"components:num-concrete-primary-items-not-in-hypercubes\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) concrete primary items not being\\n in a hypercube for each of the given components.\\n\",summary:\"<p> Return the number of (distinct) concrete primary items not being\\n in a hypercube for each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-distinct-abstract-primary-items-not-in-hypercubes\",qname:\"components:num-distinct-abstract-primary-items-not-in-hypercubes\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) abstract primary items not being\\n in a hypercube for each of the given components.\\n\",summary:\"<p> Return the number of (distinct) abstract primary items not being\\n in a hypercube for each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-domains\",qname:\"components:num-domains\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) domains in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) domains in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of domains\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-explicit-dimensions\",qname:\"components:num-explicit-dimensions\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) explicit dimensions in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) explicit dimensions in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of dimensions\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-hypercubes\",qname:\"components:num-hypercubes\",signature:\"($components-or-ids as item()*) as integer*\",description:\" Return the number of hypercubes in each of the given components.\\n\",summary:\"<p> Return the number of hypercubes in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of hypercubes\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-members\",qname:\"components:num-members\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of (distinct) members in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) members in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of members\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-networks\",qname:\"components:num-networks\",signature:\"($components-or-ids) as integer*\",description:\" Return the number of networks in each of the given components.\\n\",summary:\"<p> Return the number of networks in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of networks\"},errors:[]}],variables:[{name:\"components:col\",type:\"xs:string\",description:\" Name of the collection the components are stored in.\\n\"},{name:\"components:ARCHIVE\",type:\"xs:string\",description:\" Name of the field pointing to the archive.\\n\"}]},\"http://jsound.io/modules/validate\":{ns:\"http://jsound.io/modules/validate\",description:\" JSound simple validator.\\n This is a JSONiq implemenation of the JSound (the schema for JSON) validator.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/fetch\",prefix:\"fetch\"},{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://jsound.io/modules/validate\",prefix:\"jsv\"},{uri:\"http://jsound.io/modules/validate/map\",prefix:\"map\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"jsd-valid\",qname:\"jsv:jsd-valid\",signature:\"($ns as string, $name as string, $instance as json-item()) as boolean\",description:\" Validates the $instance JSON item against the JSound type with name $name\\n and namespace $ns, from the JSound schema definition $jsd.\\n\",summary:\"<p> Validates the $instance JSON item against the JSound type with name $name\\n and namespace $ns, from the JSound schema definition $jsd.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"ns\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the namespace of the expected type</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the expected type</div>'},{name:\"instance\",type:\"json-item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the instance to be validated</div>'}],returns:{type:\"boolean\",description:\"true if the instance is valid, otherwise throws an error.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jsv:BadJSoundFormat If the schema is not a valid JSound schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jsv:Invalid If the instance does not conform to the JSound schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP0025 If the schema namespace URI cannot be resolved.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jn:JNDY0021 If the loaded schema is syntactically incorrect</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"jsd-valid\",qname:\"jsv:jsd-valid\",signature:\"($jsd as object(), $name as string, $ns as string, $instance as item()) as boolean\",description:\" Validates the $instance JSON item against the JSound type with name $name\\n and namespace $ns, from the JSound schema definition $jsd.\\n\",summary:\"<p> Validates the $instance JSON item against the JSound type with name $name\\n and namespace $ns, from the JSound schema definition $jsd.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"jsd\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the JSound schema as a JSON object to be validated against</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the expected type</div>'},{name:\"ns\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the namespace of the expected type</div>'},{name:\"instance\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the instance to be validated</div>'}],returns:{type:\"boolean\",description:\"true if the instance is valid, otherwise throws an error.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jsv:BadJSoundFormat If the schema is not a valid JSound schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jsv:Invalid If the instance does not conform to the JSound schema</xqdoc:error>']}],variables:[]},\"http://xbrl.io/modules/bizql/archives\":{ns:\"http://xbrl.io/modules/bizql/archives\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for retrieving metadata about archives.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Archives represent the granularity of \"report shipping\", i.e., an entity\\n reports one archive at a time. An archive is identified with an AID (archive ID).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Archives are made of reported facts (see facts module),\\n which are structured and organized in components (see components module).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve all archives, or a certain number of archives\\n with their AIDs, or obtain the AID of archives you already have. You can also retrieve\\n all archives submitted by one or several entities.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Archive information is stored in a MongoDB datasource called <b>xbrl</b>.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"aid\",qname:\"archives:aid\",signature:\"($archives-or-ids as item()*) as atomic*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized archive identifier (AID). The input\\n can be either a pure AID, or an archive object which contains an AID.</p>\\n',summary:\"<p>  Converts the input to a normalized archive identifier (AID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive objects or identifiers (AID).</div>'}],returns:{type:\"atomic*\",description:\"the normalized AIDs.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">archives:INVALID_PARAMETER if the AID or archive is not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"archives-for-entities\",qname:\"archives:archives-for-entities\",signature:\"($entities-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all archives created by the supplied entities.</p>\\n',summary:\"<p>  Return all archives created by the supplied entities.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> arbitrary number of entity objects or EIDs.</div>'}],returns:{type:\"object()*\",description:\"all archives created by these entities.\"},errors:[]},{isDocumented:!0,arity:0,name:\"archives\",qname:\"archives:archives\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all archives.</p>\\n',summary:\"<p>  Retrieves all archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all archives.\"},errors:[]},{isDocumented:!0,arity:1,name:\"archives\",qname:\"archives:archives\",signature:\"($archive-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the archives with the given AIDs.</p>\\n',summary:\"<p>  Retrieves the archives with the given AIDs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"the archives with the given AIDs the empty sequence if no archive was found or if the input is an empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"entities\",qname:\"archives:entities\",signature:\"($archives-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the entities that submitted the supplied archives.</p>\\n',summary:\"<p>  Returns the entities that submitted the supplied archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their identifiers (AID).</div>'}],returns:{type:\"object()*\",description:\"the submitting entities.\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-abstract-primary-items-in-hypercubes\",qname:\"archives:num-abstract-primary-items-in-hypercubes\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) abstract primary items being\\n in a hypercube for each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) abstract primary items being\\n in a hypercube for each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-components\",qname:\"archives:num-components\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of components of each of the given archives.\\n\",summary:\"<p> Return the number of components of each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of components\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concrete-primary-items-in-hypercubes\",qname:\"archives:num-concrete-primary-items-in-hypercubes\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) concrete primary items being\\n in a hypercube for each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) concrete primary items being\\n in a hypercube for each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concrete-primary-items-not-in-hypercubes\",qname:\"archives:num-concrete-primary-items-not-in-hypercubes\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) concrete primary items not being\\n in a hypercube for each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) concrete primary items not being\\n in a hypercube for each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-distinct-abstract-primary-items-not-in-hypercubes\",qname:\"archives:num-distinct-abstract-primary-items-not-in-hypercubes\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) abstract primary items not being\\n in a hypercube for each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) abstract primary items not being\\n in a hypercube for each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of primary items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-domains\",qname:\"archives:num-domains\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) domains in each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) domains in each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of domains\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-explicit-dimensions\",qname:\"archives:num-explicit-dimensions\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) explicit dimensions in each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) explicit dimensions in each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of dimensions\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-facts\",qname:\"archives:num-facts\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of facts of each of the given archives.\\n\",summary:\"<p> Return the number of facts of each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of facts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-footnotes\",qname:\"archives:num-footnotes\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of XBRL footnotes of each of the given archives.\\n\",summary:\"<p> Return the number of XBRL footnotes of each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of footnotes\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-hypercubes\",qname:\"archives:num-hypercubes\",signature:\"($archives-or-ids as item()*) as integer*\",description:\" Return the number of hypercubes in each of the given archives.\\n\",summary:\"<p> Return the number of hypercubes in each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of hypercubes\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-members\",qname:\"archives:num-members\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of (distinct) members in each of the given archives.\\n\",summary:\"<p> Return the number of (distinct) members in each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of members\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-networks\",qname:\"archives:num-networks\",signature:\"($archives-or-ids) as integer*\",description:\" Return the number of networks in each of the given archives.\\n\",summary:\"<p> Return the number of networks in each of the given archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of archives or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of networks\"},errors:[]}],variables:[{name:\"archives:col\",type:\"string\",description:\" Name of the collection the archives are stored in.\\n\"},{name:\"archives:ENTITY\",type:\"string\",description:\" Name of the field which points to the reporting entity.\\n\"}]},\"http://www.28msec.com/modules/xmlrpc\":{ns:\"http://www.28msec.com/modules/xmlrpc\",description:' XML RPC Client Module\\n This module provides the functions necessary to execute remote call\\n procedures using\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.xmlrpc.com/spec\" target=\"_blank\">XML-RPC</a>.\\n The application/mashup creator does not need to know the\\n specifics of <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.xmlrpc.com/spec\" target=\"_blank\">XML-RPC</a> to use this module.\\n Usage:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xmlrpc:invoke(\"http://www.advogato.org/XMLRPC\", \"test.sumprod\", (5, 7))</pre>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xmlrpc:invoke(\"http://www.advogato.org/XMLRPC\", \"test.capitalize\", \"HelloWorld\")</pre>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xmlrpc:invoice(\"http://www.example.com/XMLRPC\", \"test.foo\", (\"some-parameter\",\\n                      &lt;struct&gt;\\n                        &lt;member&gt;\\n                          &lt;name&gt;Foo&lt;/name&gt;\\n                          &lt;value&gt;&lt;string&gt;Bar&lt;/string&gt;&lt;/value&gt;\\n                        &lt;/member&gt;\\n                      &lt;/struct&gt;))</pre>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.xmlrpc.com/spec\" target=\"_blank\">XML-RPC Specification</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://en.wikipedia.org/wiki/XML-RPC\" target=\"_blank\">XML-RPC Wikipedia article</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon {william.candillon@28msec.com}</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"ann\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-client\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.28msec.com/modules/xmlrpc\",prefix:\"xmlrpc\"}],functions:[{isDocumented:!0,arity:2,name:\"invoke\",qname:\"xmlrpc:invoke\",signature:\"($endpoint-url as xs:string, $method as xs:string) as item()*\",description:\" Invoke a remote method without parameters.\\n Calling this function is equivalent to xmlrpc:invoke($url, $method, ())\\n\",summary:\"<p> Invoke a remote method without parameters.</p>\",annotation_str:\" %ann:sequential\",annotations:[{prefix:\"ann\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> URL of the XML-RPC server.</div>'},{name:\"method\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Name of the method to invoke.</div>'}],returns:{type:\"item()*\",description:\"Result of the method invocation.\"},errors:[]},{isDocumented:!0,arity:3,name:\"invoke\",qname:\"xmlrpc:invoke\",signature:\"($endpoint-url as xs:string, $method as xs:string, $parameters as item()*) as item()*\",description:\" Invoke a remote method with parameters.\\n\",summary:\"<p> Invoke a remote method with parameters.</p>\",annotation_str:\" %ann:sequential\",annotations:[{prefix:\"ann\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> URL of the XML-RPC server.</div>'},{name:\"method\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Name of the method to invoke.</div>'},{name:\"parameters\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Method parameters. Struct and Arrays need to follow XML-RPC format. Atomic types will be automatically convert to the proper XML-RPC data format.</div>'}],returns:{type:\"item()*\",description:\"Result of the method invocation.\"},errors:[]}],variables:[{name:\"xmlrpc:ERR_001\",type:\"xs:QName\",description:\" XML-RPC serialization error.\\n\"}]},\"http://zorba.io/modules/unordered-maps\":{ns:\"http://zorba.io/modules/unordered-maps\",description:' This module defines a set of functions for working with maps. A map\\n is identified by a string and can be created using the map:create function\\n and dropped using the map:drop function.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n It is possible to create persistent and transient maps. The lifetime of a\\n transient map is limited by the execution of the current query.\\n A persistent map lives until it is explicitly dropped.\\n Accordingly, it is also available to other requests.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:create(\"my-map\", [\"string\", \"integer\"], { \"persistent\" : false })</pre>\\n will create a transient map named my-map having two keys.\\n The types of the keys are string and integer.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The key of a particular entry in the map can consist of a tuple of\\n atomic values (called key attributes). The actual type of each attribute\\n is determined when the map is created. The value of each entry is a\\n sequence of items. If an item in this sequence is a object or array,\\n this item needs to belong to a collection, otherwise, an error is raised.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/unordered-maps\",prefix:\"map\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:0,name:\"available-maps\",qname:\"map:available-maps\",signature:\"() as string* external\",description:' The function returns a sequence of names of the maps that are\\n available (persistent and non-persistent). The sequence will be\\n empty if there are no maps.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> The function returns a sequence of names of the maps that are\\n available (persistent and non-persistent).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"string*\",description:\"A sequence of string, one for each available map, or an empty sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"create\",qname:\"map:create\",signature:\"($name as string, $key-types as item()) as empty-sequence() external\",description:' Create a persistent map with a given name and type identifiers for the key\\n attributes.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the map has only one key attribute, a single type identifier is given,\\n for more than one key attribute an array of type identifiers is given.\\n Calling this function is equivalent to calling create with the options\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">{ \"persistent\" : true }</code>\\n Note that the function is sequential and immediately creates the map.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Each key-type should be specified as string (e.g. \"integer\",\\n \"string\", \"boolean\", \"double\", or \"datetime\").\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:create(\"my-map\", \"string\")</pre> or\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:create(\"my-map\", [\"string\", \"integer\"])</pre>.\\n',summary:\"<p> Create a persistent map with a given name and type identifiers for the key\\n attributes.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map (the restrictions on collection names apply)</div>'},{name:\"key-types\",type:\"item()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately creates the corresponding map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if any of the key attribute types is not a subtype of anyAtomicType.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0001 if a map with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0043 if any of the given options has an invalid type</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create\",qname:\"map:create\",signature:\"($name as string, $key-types as item(), $options as object()) as empty-sequence() external\",description:' Create a map with a given name, type identifiers for the key attributes, and\\n options.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the map has only one key attribute, a single type identifier is given,\\n for more than one key attribute an array of type identifiers is given.\\n Currently only one option is supported: To create a transient map the object\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">{ \"persistent\" : false }</code>\\n has to be passed to the $options parameter.\\n Note that the function is sequential and immediately creates the map in the\\n store.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Note that a map cannot be created if it already exists in a parent context.\\n For example, a map that was created in an outer query cannot be\\n created again in an inner query executed using the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">reflection:eval-s</code> function.\\n',summary:\"<p> Create a map with a given name, type identifiers for the key attributes, and\\n options.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map (the restrictions on collection names apply)</div>'},{name:\"key-types\",type:\"item()\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object describing options for the map</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately creates the corresponding map but returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if any of the attribute types is not a subtype of anyAtomicType.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0001 if a map with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0043 if any of the given options has an invalid type</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete\",qname:\"map:delete\",signature:\"($name as string, $key as item()) as empty-sequence() external\",description:' Removes an entry identified by the given key from the map.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Note that it is possible to insert entries with empty key attributes.\\n However as the removing the entries is based on the \"eq\" comparison and\\n as \"eq\" with an empty sequence always return false, it is not possible\\n to delete these entries.\\n',summary:\"<p> Removes an entry identified by the given key from the map.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately deletes the entry into the map but returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"drop\",qname:\"map:drop\",signature:\"($name as string) as empty-sequence() external\",description:' Deletes the map with the given name.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Note that a map can only be dropped in the context it was created.\\n For example, a map that was created in an outer query cannot be\\n dropped in an inner query executed using the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">reflection:eval-s</code> function.\\n',summary:\"<p> Deletes the map with the given name.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map to drop</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately drops the map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get\",qname:\"map:get\",signature:\"($name as string, $key as item()) as item()* external\",description:' Returns the value of the entry with the given key from the map.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Note that it is possible to insert entries with empty key attributes.\\n However as the getting the entries is based on the \"eq\" comparison and\\n as \"eq\" with an empty sequence always return false, it is not possible\\n to retrieve these entries.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:get(\"my-map\", \"key\")</pre> or\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:get(\"my-map\", [ \"key1\", \"key2\" ])</pre>.\\n',summary:\"<p> Returns the value of the entry with the given key from the map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'}],returns:{type:\"item()*\",description:\"the value of the entry in the map identified by the given key. The empty-sequence will be returned if no entry with the given key is contained in the map.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"insert\",qname:\"map:insert\",signature:\"($name as string, $key as item(), $value as item()*) as empty-sequence() external\",description:' Inserts a new entry into the map with the given name.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n If an entry with the given key already exists in the map, the value\\n sequences of the existing entry and the sequence passed using $value\\n argument are concatenated.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If an item in the value sequence is an object or array, this\\n item needs to belong to a collection, otherwise, an an error\\n is raised.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Note that it is possible to insert entries with empty key attributes\\n or key attributes having the value <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">null</code>. However, as\\n the comparison with an empty sequence or null always returns false,\\n it is not possible to retrieve these entries.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:insert(\"my-map\", \"key\", \"value\")</pre> or\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:insert(\"my-map\", [ \"key1\", \"key2\" ] , (42, \"value\"))</pre>.\\n',summary:\"<p> Inserts a new entry into the map with the given name.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value of the entry to insert</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately inserts the entry into the map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1003 if the value to insert is an object or array it must belong to a collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"keys\",qname:\"map:keys\",signature:\"($name as string) as array()* external\",description:' Returns the keys of all entries of a map. The keys\\n are returned as sequence of arrays.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The following condition always holds:\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:size($name) eq count(map:keys($name))</tt>\\n',summary:\"<p> Returns the keys of all entries of a map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"array()*\",description:\"an sequence of arrays each array containing the values of all attributes of one key.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"options\",qname:\"map:options\",signature:\"($name as string) as object() external\",description:\" The function returns the options that were passed during creation or the\\n default options if no options were passed.\\n\",summary:\"<p> The function returns the options that were passed during creation or the\\n default options if no options were passed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"object()\",description:\"an options object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"size\",qname:\"map:size\",signature:\"($name as string) as integer external\",description:' Returns the number of entries in a map.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The following condition always holds:\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:size($name) eq count(map:keys($name))</tt>\\n',summary:\"<p> Returns the number of entries in a map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"integer\",description:\"the number of entries in the map.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']}],variables:[{name:\"map:PERSISTENT\",type:\"string\",description:\" Constant containing the field name of the options object\\n indiciating whether a map is persistent or transient.\\n\"}]},\"http://www.28msec.com/modules/assertion\":{ns:\"http://www.28msec.com/modules/assertion\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   This module provides a set of assertion functions.\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/assertion\",prefix:\"assertion\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"equals-deep\",qname:\"assertion:equals-deep\",signature:\"($expected as item()*, $actual as item()*) as item()*\",description:\" Asserts that two objects are deep-equal.\\n If they are not, an error containing the diff is raised.\\n\",summary:\"<p> Asserts that two objects are deep-equal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"expected\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> expected value</div>'},{name:\"actual\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> actual value</div>'}],returns:{type:\"item()*\",description:\"actual value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">assertion:A003 expected and actual value are not deep-equal</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"equals-general\",qname:\"assertion:equals-general\",signature:\"($expected as item()*, $actual as item()*) as item()*\",description:\" Asserts that two objects are equal (by general comarison).\\n If they are not, an error containing the diff is raised.\\n\",summary:\"<p> Asserts that two objects are equal (by general comarison).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"expected\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> expected value</div>'},{name:\"actual\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> actual value</div>'}],returns:{type:\"item()*\",description:\"actual value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">assertion:A002 expected and actual value are not equal</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"equals-value\",qname:\"assertion:equals-value\",signature:\"($expected as item()?, $actual as item()?) as item()?\",description:\" Asserts that two objects are equal (by value comparison).\\n If they are not, an error containing the diff is raised.\\n\",summary:\"<p> Asserts that two objects are equal (by value comparison).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"expected\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> expected value</div>'},{name:\"actual\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> actual value</div>'}],returns:{type:\"item()?\",description:\"actual value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">assertion:A001 expected and actual value are not equal</xqdoc:error>']}],variables:[{name:\"assertion:A001\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.28msec.com/modules/assertion\\\" and\\n local name 'A001'. 'equals-value' assertion failed.\\n\"},{name:\"assertion:A002\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.28msec.com/modules/assertion\\\" and\\n local name 'A002'. 'equals-general' assertion failed.\\n\"},{name:\"assertion:A003\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.28msec.com/modules/assertion\\\" and\\n local name 'A003'. 'equals-general' assertion failed.\\n\"}]},\"http://www.zorba-xquery.com/modules/image/basic\":{ns:\"http://www.zorba-xquery.com/modules/image/basic\",description:' This module provides function to do the following basic image operations:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>create empty images</li>\\n   <li>compare images</li>\\n   <li>compress image</li>\\n   <li>convert an image one format to another</li>\\n   <li>retrieve with, height, format, and exif information from an image</li>\\n </ul>\\n The following image formats are supported:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>GIF</li>\\n   <li>JPEG</li>\\n   <li>PNG</li>\\n   <li>TIFF</li>\\n   <li>BMP</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The errors raised by functions of this module have the namespace\\n <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Thomas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/image/basic\",prefix:\"basic\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/image/error\",prefix:\"ierr\"},{uri:\"http://www.zorba-xquery.com/modules/image/image\",prefix:\"image\"},{uri:\"http://www.w3.org/2000/svg\",prefix:\"svg\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"compress\",qname:\"basic:compress\",signature:\"($image as xs:base64Binary, $quality as xs:unsignedInt) as xs:base64Binary external\",description:\" Compresses the passed image.\\n Compressing means lowering the quality and reducing the size.\\n\",summary:\"<p> Compresses the passed image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image</div>'},{name:\"quality\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> compression level, 0 to 100</div>'}],returns:{type:\"xs:base64Binary\",description:\"the compressed image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"convert-svg-string\",qname:\"basic:convert-svg-string\",signature:\"($svg as xs:string, $format as xs:string) as xs:base64Binary\",description:\" Converts an SVG image to a supported image format.\\n\",summary:\"<p> Converts an SVG image to a supported image format.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"svg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image to convert as string</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> target format</div>'}],returns:{type:\"xs:base64Binary\",description:\"the resulting image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed SVG is invalid.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"convert-svg\",qname:\"basic:convert-svg\",signature:\"($svg as element(svg:svg), $format as xs:string) as xs:base64Binary\",description:\" Converts an SVG image to a supported image format.\\n\",summary:\"<p> Converts an SVG image to a supported image format.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"svg\",type:\"element(svg:svg)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image to convert</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> target format</div>'}],returns:{type:\"xs:base64Binary\",description:\"the resulting image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed SVG is invalid.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"convert\",qname:\"basic:convert\",signature:\"($image as xs:base64Binary, $format as xs:string) as xs:base64Binary\",description:\" Converts an image to another format.\\n\",summary:\"<p> Converts an image to another format.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the format (see supported formats above) of the resulting image.</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image with the same content as the passed image but with the specified file format.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 unsupported image format</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create\",qname:\"basic:create\",signature:\"($width as xs:unsignedInt, $height as xs:unsignedInt, $format as xs:string) as xs:base64Binary\",description:\" Creates an empty image with background color white.\\n\",summary:\"<p> Creates an empty image with background color white.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"width\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the width of the new image</div>'},{name:\"height\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the height of the new image</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the format of the new image</div>'}],returns:{type:\"xs:base64Binary\",description:\"newly created image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 unsupported image format</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"equals\",qname:\"basic:equals\",signature:\"($image1 as xs:base64Binary, $image2 as xs:base64Binary) as xs:boolean external\",description:\" Compares two images.\\n\",summary:\"<p> Compares two images.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image1\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> first image</div>'},{name:\"image2\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> second image</div>'}],returns:{type:\"xs:boolean\",description:\"True if the images are equal.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 one of the passed images is invalid.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"exif\",qname:\"basic:exif\",signature:\"($image as xs:base64Binary, $tag as xs:string) as xs:string? external\",description:\" Reads exif information from an image.\\n This function works for JPEG and TIFF images only.\\n It returns empty sequence if no exif information matching the passed tag is found.\\n\",summary:\"<p> Reads exif information from an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image</div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the field name we want read (e.g. DateTime).</div>'}],returns:{type:\"xs:string?\",description:\"exif field content\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"format\",qname:\"basic:format\",signature:\"($image as xs:base64Binary) as xs:string external\",description:\" Returns the format of the passed image.\\n\",summary:\"<p> Returns the format of the passed image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image</div>'}],returns:{type:\"xs:string\",description:\"the format\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"height\",qname:\"basic:height\",signature:\"($image as xs:base64Binary) as xs:unsignedInt external\",description:\" Returns the height of the passed image.\\n\",summary:\"<p> Returns the height of the passed image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image</div>'}],returns:{type:\"xs:unsignedInt\",description:\"the height in pixels\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"width\",qname:\"basic:width\",signature:\"($image as xs:base64Binary) as xs:unsignedInt external\",description:\" Returns the width of the passed image.\\n\",summary:\"<p> Returns the width of the passed image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image</div>'}],returns:{type:\"xs:unsignedInt\",description:\"the width in pixels\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>']}],variables:[]},\"http://api.28.io/indices\":{ns:\"http://api.28.io/indices\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/indices\",prefix:\"in\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://api.28.io/util\",prefix:\"util\"},{uri:\"http://api.28.io/validation\",prefix:\"validate\"}],functions:[{isDocumented:!1,arity:1,name:\"create-index\",qname:\"in:create-index\",signature:\"($new-index as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"new-index\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"delete-index\",qname:\"in:delete-index\",signature:\"($name) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:null,occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"dispatch\",qname:\"in:dispatch\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-index\",qname:\"in:get-index\",signature:\"($name as xs:string) as object()?\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"object()?\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"list-indices\",qname:\"in:list-indices\",signature:\"() as array()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"array()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"metadata\",qname:\"in:metadata\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"put-index\",qname:\"in:put-index\",signature:\"($name as xs:string, $new-index-obj as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"new-index-obj\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"refresh-index\",qname:\"in:refresh-index\",signature:\"($index as xs:string) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"index\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"validate-index\",qname:\"in:validate-index\",signature:\"($index as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]}],variables:[]},\"http://api.28.io/xdmview\":{ns:\"http://api.28.io/xdmview\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/model\",prefix:\"model\"},{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://www.zorba-xquery.com/schemas/xdm\",prefix:\"xdm\"},{uri:\"http://api.28.io/xdmview\",prefix:\"xdmview\"}],functions:[{isDocumented:!1,arity:1,name:\"show-namespaces\",qname:\"xdmview:show-namespaces\",signature:\"($namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"show-node\",qname:\"xdmview:show-node\",signature:\"($node, $namespaces, $include-noderef as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"},{name:\"include-noderef\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"show-nodes\",qname:\"xdmview:show-nodes\",signature:\"($nodes, $include-noderef as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"include-noderef\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/xqdoc/json\":{ns:\"http://www.zorba-xquery.com/modules/xqdoc/json\",description:' Convert an XQDoc document into an HTML document.\\n This module contains a single <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">convert()</code> function\\n that transform an XQDoc document into an HTML document.\\n Usage:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n let $xqdoc := xqdoc:xqdoc(\"http://expath.org/ns/file\")\\n return html:convert($xqdoc)\\n </pre>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon <a href=\"?anchor=\">wcandillon at gmail dot com</a></xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/xqdoc/json\",prefix:\"html\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"o\"},{uri:\"http://www.xqdoc.org/1.0\",prefix:\"xq\"}],functions:[{isDocumented:!1,arity:1,name:\"convert\",qname:\"html:convert\",signature:\"($xqdoc as element(xq:xqdoc)) as object()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xqdoc\",type:\"element(xq:xqdoc)\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"normalize-anchors\",qname:\"html:normalize-anchors\",signature:\"($node)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/math\":{ns:\"http://zorba.io/modules/math\",description:' Extensive math library.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu, Dan Muresan</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"W3Cmath\"},{uri:\"http://zorba.io/modules/math\",prefix:\"math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"acosh\",qname:\"math:acosh\",signature:\"($arg as double) as double external\",description:\" Inverse hyperbolic cosine.\\n\",summary:\"<p> Inverse hyperbolic cosine.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arg</div>'}],returns:{type:\"double\",description:\"the result of acosh(arg)\"},errors:[]},{isDocumented:!0,arity:1,name:\"asinh\",qname:\"math:asinh\",signature:\"($arg as double) as double external\",description:\" Calculate the inverse hyperbolic sine.\\n\",summary:\"<p> Calculate the inverse hyperbolic sine.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arg</div>'}],returns:{type:\"double\",description:\"the result of asinh(arg)\"},errors:[]},{isDocumented:!0,arity:1,name:\"atanh\",qname:\"math:atanh\",signature:\"($arg as double) as double external\",description:\" Calculate the hyperbolic tangent.\\n\",summary:\"<p> Calculate the hyperbolic tangent.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> must be in range -1 ... +1 (exclusive)</div>'}],returns:{type:\"double\",description:\"the result of atanh(arg)\"},errors:[]},{isDocumented:!0,arity:1,name:\"avedev\",qname:\"math:avedev\",signature:\"($numbers as double+) as double\",description:' Returns the average of the absolute deviations of data points from their mean.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the average of the absolute deviations of data points from their mean.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. Sequence can be of any length from 1 up.</div>'}],returns:{type:\"double\",description:\"The formula result\"},errors:[]},{isDocumented:!0,arity:1,name:\"cast-as-numeric\",qname:\"math:cast-as-numeric\",signature:\"($number as anyAtomicType) as anyAtomicType\",description:' Cast the anyAtomicType to a numeric type.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the value is already of a numeric type then nothing is changed.\\n Otherwise the value is casted to the numeric type that is most appropriate.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Cast the anyAtomicType to a numeric type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The parameter can be a number, string, boolean value.</div>'}],returns:{type:\"anyAtomicType\",description:\"The casted value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:VALUE_NOT_NUMERIC if the value cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"ceiling\",qname:\"math:ceiling\",signature:\"($number as double, $significance as double) as double\",description:' Returns number rounded up, away from zero, to the nearest multiple of significance.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Significance must have the same sign as number.\\n Number and significance must be of a numeric type or castable to numeric.\\n Significance must not be zero.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns number rounded up, away from zero, to the nearest multiple of significance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value you want to round.</div>'},{name:\"significance\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round.</div>'}],returns:{type:\"double\",description:\"The rounded value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if significance is zero or it doesn\\'t have the same sign as number.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"cosh\",qname:\"math:cosh\",signature:\"($arg as double) as double external\",description:' Returns the hyperbolic cosine of x.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the result it too large, INF is returned.\\n',summary:\"<p> Returns the hyperbolic cosine of x.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> must be smaller than 7.104760e+002</div>'}],returns:{type:\"double\",description:\"cosh(arg)\"},errors:[]},{isDocumented:!0,arity:1,name:\"deg-to-rad\",qname:\"math:deg-to-rad\",signature:\"($deg as double) as double\",description:' Convert angle from degrees to radians. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The parameter is first converted to value range of (-360, 360).\\n',summary:\"<p> Convert angle from degrees to radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"deg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> angle in degrees</div>'}],returns:{type:\"double\",description:\"value in radians (-2PI, 2PI)\"},errors:[]},{isDocumented:!0,arity:1,name:\"even\",qname:\"math:even\",signature:\"($number as double) as integer\",description:' Returns number rounded up to the nearest even integer.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Regardless of the sign of number, a value is rounded up when adjusted away from zero.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns number rounded up to the nearest even integer.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round.</div>'}],returns:{type:\"integer\",description:\"The rounded value casted as numeric type.\"},errors:[]},{isDocumented:!0,arity:1,name:\"fact\",qname:\"math:fact\",signature:\"($number as integer) as integer\",description:' Returns the factorial of a number.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the factorial of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The non-negative number you want the factorial of.</div>'}],returns:{type:\"integer\",description:\"Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the number is smaller than zero</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"factdouble\",qname:\"math:factdouble\",signature:\"($number as integer) as integer\",description:' Returns the double factorial of a number.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Computes the double factorial of n as n(n-2)(n-4)...<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the double factorial of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The positive integer value.</div>'}],returns:{type:\"integer\",description:\"The result as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the number is negative.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"floor\",qname:\"math:floor\",signature:\"($number as double, $significance as double) as double\",description:' Rounds number down, toward zero, to the nearest multiple of significance.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Significance must have the same sign as number.\\n Borrowed from excel module.\\n',summary:\"<p> Rounds number down, toward zero, to the nearest multiple of significance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value you want to round.</div>'},{name:\"significance\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round.</div>'}],returns:{type:\"double\",description:\"The rounded value as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if significance is zero or it doesn\\'t have the same sign as number.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"fmod\",qname:\"math:fmod\",signature:\"($x as double, $y as double) as double external\",description:\" Function performing the modulo operation between the two arguments.\\n\",summary:\"<p> Function performing the modulo operation between the two arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the x</div>'},{name:\"y\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the y</div>'}],returns:{type:\"double\",description:\"The remainder of x/y.\"},errors:[]},{isDocumented:!0,arity:1,name:\"frexp\",qname:\"math:frexp\",signature:\"($arg as double) as double+ external\",description:' Returns the argument split as mantissa and exponent.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The recombining formula is (mantissa * 2^exponent).\\n',summary:\"<p> Returns the argument split as mantissa and exponent.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the double to be split.</div>'}],returns:{type:\"double+\",description:\"A sequence of two doubles (mantissa, exponent)\"},errors:[]},{isDocumented:!0,arity:1,name:\"gcd\",qname:\"math:gcd\",signature:\"($numbers as integer+) as integer\",description:' Returns the greatest common divisor GCD of a sequence of integers.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The sequence can have one or more positive integers.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the greatest common divisor GCD of a sequence of integers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"integer\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of positive integers.</div>'}],returns:{type:\"integer\",description:\"The GCD as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if any number is smaller than zero.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"int\",qname:\"math:int\",signature:\"($number as double) as integer\",description:' Rounds a number down to the nearest integer.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Positive numbers are rounded toward zero, negative numbers are rounded away from zero.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Rounds a number down to the nearest integer.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be rounded.</div>'}],returns:{type:\"integer\",description:\"The rounded integer.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-a-number\",qname:\"math:is-a-number\",signature:\"($value as anyAtomicType) as boolean\",description:' Checks if the anyAtomicType argument is actually a numeric type\\n or can be converted to numeric.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Checks if the anyAtomicType argument is actually a numeric type\\n or can be converted to numeric.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Parameter to be checked.</div>'}],returns:{type:\"boolean\",description:\"true if the value can be casted to numeric.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is_inf\",qname:\"math:is_inf\",signature:\"($arg as double) as boolean external\",description:\" Checks if the double value is positive or negative infinite.\\n\",summary:\"<p> Checks if the double value is positive or negative infinite.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the double to be checked</div>'}],returns:{type:\"boolean\",description:\"boolean true if argument is pos INF or neg INF\"},errors:[]},{isDocumented:!0,arity:1,name:\"is_nan\",qname:\"math:is_nan\",signature:\"($arg as double) as boolean external\",description:\" Checks if the double value is Not a Number (NaN).\\n\",summary:\"<p> Checks if the double value is Not a Number (NaN).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arg</div>'}],returns:{type:\"boolean\",description:\"boolean true if the double is NaN\"},errors:[]},{isDocumented:!0,arity:2,name:\"large\",qname:\"math:large\",signature:\"($numbers as double+, $k as integer) as double\",description:' Returns the k-th largest value in a data set. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If n is the number of data points in a range,\\n   then LARGE(array,1) returns the largest value,\\n   and LARGE(array,n) returns the smallest value.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Returns the k-th largest value in a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers The sequence can be of any length, from 1 up.</div>'},{name:\"k\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position of largest value, with value from 1 to count of values</div>'}],returns:{type:\"double\",description:\"The k-th largest value as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sequence is empty or k is not a value between 1 and the size of the sequence</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"lcm\",qname:\"math:lcm\",signature:\"($numbers as integer+) as integer\",description:' Returns the least common multiple of integers.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n LCM for two numbers is computed by multiplying them and dividing with GCD.\\n The function is applied recursively replacing the first two numbers in the sequence with their LCM.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the least common multiple of integers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"integer\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of one or more positive integers.</div>'}],returns:{type:\"integer\",description:\"The LCM as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if any number is smaller than zero.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"ldexp\",qname:\"math:ldexp\",signature:\"($x as double, $i as integer) as double external\",description:' Computes a real number from the mantissa and exponent.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is (x * 2^i).\\n',summary:\"<p> Computes a real number from the mantissa and exponent.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the mantissa</div>'},{name:\"i\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the exponent</div>'}],returns:{type:\"double\",description:\"the computed real number\"},errors:[]},{isDocumented:!0,arity:1,name:\"median\",qname:\"math:median\",signature:\"($numbers as double*) as double\",description:' Returns the median of the given numbers. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The median is the number in the middle of a set of numbers.\\n Half the numbers have values that are greater than the median,\\n and half the numbers have values that are less than the median. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the median of the given numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'}],returns:{type:\"double\",description:\"for odd count of numbers return the number in the middle of the sorted sequence. For even count of numbers return the average of the two numbers in the middle.\"},errors:[]},{isDocumented:!0,arity:2,name:\"mod\",qname:\"math:mod\",signature:\"($number as double, $divisor as double) as double\",description:' Returns the remainder after number is divided by divisor.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The result has the same sign as divisor.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the remainder after number is divided by divisor.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number for which you want to find the remainder.</div>'},{name:\"divisor\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number by which you want to divide number. This cannot be zero.</div>'}],returns:{type:\"double\",description:\"The remainder from division as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:DIVIDE_BY_0 if divisor is zero after casting to numeric.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"mode\",qname:\"math:mode\",signature:\"($numbers as double*) as double\",description:' Returns the most frequently occurring, or repetitive, value in a sequence.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the most frequently occurring, or repetitive, value in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'}],returns:{type:\"double\",description:\"The most occuring number\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_INPUT if there are no duplicate numbers</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"modf\",qname:\"math:modf\",signature:\"($arg as double) as double+ external\",description:' Splits a floating-point value into fractional and integer parts.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Both the fraction and integer keep the original sign of the value.\\n',summary:\"<p> Splits a floating-point value into fractional and integer parts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the double to be split.</div>'}],returns:{type:\"double+\",description:\"A sequence of two doubles (fraction, integer)\"},errors:[]},{isDocumented:!0,arity:2,name:\"mround\",qname:\"math:mround\",signature:\"($number as decimal, $multiple as double) as double\",description:' Returns a number rounded to the desired multiple.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n MROUND rounds up, away from zero, if the remainder of dividing number by multiple\\n is greater than or equal to half the value of multiple.\\n MROUND is computed through math:floor function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns a number rounded to the desired multiple.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round,</div>'},{name:\"multiple\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round number.</div>'}],returns:{type:\"double\",description:\"The rounded number up to the desired multiple.\"},errors:[]},{isDocumented:!0,arity:1,name:\"odd\",qname:\"math:odd\",signature:\"($number as double) as integer\",description:' Returns number rounded up to the nearest odd integer, away from zero.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns number rounded up to the nearest odd integer, away from zero.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round.</div>'}],returns:{type:\"integer\",description:\"The odd integer.\"},errors:[]},{isDocumented:!0,arity:2,name:\"percentile\",qname:\"math:percentile\",signature:\"($numbers as double*, $k_at as double) as double\",description:' Returns the k-th percentile of values in a sequence.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If k is not a multiple of 1/(n - 1),\\n   PERCENTILE interpolates to determine the value at the k-th percentile.\\n The function is computed by (max-min)*k + min<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the k-th percentile of values in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'},{name:\"k_at\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the percentile, with value between 0 .. 1 inclusive</div>'}],returns:{type:\"double\",description:\"The computed percentile\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if percentile is not between 0 .. 1</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"percentrank\",qname:\"math:percentrank\",signature:\"($numbers as double*, $x as double) as double\",description:' Returns the rank of a value in a data set as a percentage of the data set.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If x does not match one of the values in array,\\n   PERCENTRANK interpolates to return the correct percentage rank. <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is uses: (RANK - 1) / (size - 1) .<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the rank of a value in a data set as a percentage of the data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value for which you want to know the rank</div>'}],returns:{type:\"double\",description:\"The percentage of rank.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sequence is zero length</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"prob\",qname:\"math:prob\",signature:\"($x_range as double+, $prob_range as double+, $range_lower_limit as double) as double\",description:' This is the same as math:prob#4, only that upper_limit is not specified.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The probability is computed only for range_lower_limit.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> This is the same as math:prob#4, only that upper_limit is not specified.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x_range\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.</div>'},{name:\"prob_range\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is a set of probabilities associated with values in x_range.</div>'},{name:\"range_lower_limit\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value for which you want a probability.</div>'}],returns:{type:\"double\",description:\"The probability of the range_lower_limit value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if any probability is not between 0 and 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sum of probabilities is not equal to 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if x_range and prob_range do not have the same number of values</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"prob\",qname:\"math:prob\",signature:\"($x_range as double+, $prob_range as double+, $range_lower_limit as double, $upper_limit as double) as double\",description:' Returns the probability that values in a range are between two limits.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the probability that values in a range are between two limits.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x_range\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.</div>'},{name:\"prob_range\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is a set of probabilities associated with values in x_range.</div>'},{name:\"range_lower_limit\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the lower bound on the value for which you want a probability.</div>'},{name:\"upper_limit\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the upper bound on the value for which you want a probability.</div>'}],returns:{type:\"double\",description:\"The probability of the entire range\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if any probability is not between 0 and 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sum of probabilities is not equal to 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if x_range and prob_range do not have the same number of values</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"product\",qname:\"math:product\",signature:\"($numbers as double*) as double\",description:' Multiplies all the numbers given as arguments and returns the product.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Multiplies all the numbers given as arguments and returns the product.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of arguments convertible to numeric types. The sequence can be of any length.</div>'}],returns:{type:\"double\",description:\"The multiplication result as numeric type.\"},errors:[]},{isDocumented:!0,arity:2,name:\"quartile\",qname:\"math:quartile\",signature:\"($numbers as double*, $quart as integer) as double\",description:' Returns the quartile of a data set. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the quartile of a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> sequence of numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"quart\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>one of the values 0, 1, 2, 3, 4 with meaning: <dt>0</dt> <dd> compute minimum value</dd> <dt>1</dt> <dd> compute first quartile (25th percentile)</dd> <dt>2</dt> <dd> compute median value (50th percentile)</dd> <dt>3</dt> <dd> compute third quartile (75th percentile)</dd> <dt>4</dt> <dd> compute maximum value</dd></dl></div>'}],returns:{type:\"double\",description:\"the computed quartile, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sequence is zero length or $quart is not one of the values 0,1,3,4</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"quotient\",qname:\"math:quotient\",signature:\"($numerator as double, $denominator as double) as integer\",description:' Returns the integer portion of a division.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the integer portion of a division.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numerator\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The divider.</div>'},{name:\"denominator\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The divisor. It cannot be zero.</div>'}],returns:{type:\"integer\",description:\"The result value as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:DIVIDE_BY_0 if denominator casted as numeric type has value zero.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"rad-to-deg\",qname:\"math:rad-to-deg\",signature:\"($rad as double) as double\",description:' Convert angle from radians to degrees. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Convert angle from radians to degrees.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"rad\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value in radians</div>'}],returns:{type:\"double\",description:\"value in degrees (-360, 360)\"},errors:[]},{isDocumented:!0,arity:2,name:\"rank\",qname:\"math:rank\",signature:\"($x as double, $numbers as double*) as double\",description:' This RANK function is same as the above, only that $order_ascending is set by default to false.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> This RANK function is same as the above, only that $order_ascending is set by default to false.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number whose rank you want to find.</div>'},{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length.</div>'}],returns:{type:\"double\",description:\"The rank of $x.\"},errors:[]},{isDocumented:!0,arity:3,name:\"rank\",qname:\"math:rank\",signature:\"($x as double, $numbers as double*, $order_ascending as boolean) as double\",description:' Returns the rank of a number in a list of numbers. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The rank of a number is its size relative to other values in a list.\\n (If you were to sort the list, the rank of the number would be its position.)\\n RANK gives duplicate numbers the same rank.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the rank of a number in a list of numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number whose rank you want to find.</div>'},{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of numbers. The sequence can be of any length.</div>'},{name:\"order_ascending\",type:\"boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>A boolean having the meaning: <dt>false</dt><dd>then rank the number as if the sequence was sorted in descending order.</dd> <dt>true</dt> <dd>then rank the number as if the sequence was sorted in ascending order.</dd></dl></div>'}],returns:{type:\"double\",description:\"The rank of $x.\"},errors:[]},{isDocumented:!0,arity:1,name:\"roman\",qname:\"math:roman\",signature:\"($number as integer) as string\",description:' Converts an Arabic numeral to roman, as text.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Only the classic format is supported (out of all formats Excel requires).\\n M is the largest digit, it represents 1000.\\n Numbers bigger than 2000 will be represented by a sequence of \"M\".\\n D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Converts an Arabic numeral to roman, as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A positive integer.</div>'}],returns:{type:\"string\",description:\"The roman string representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the input integer is negative</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"round\",qname:\"math:round\",signature:\"($number as double, $precision as integer) as double\",description:' Rounds a number to a specified number of digits.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If precision is greater than 0 (zero), then number is rounded\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded to the nearest integer.\\n If num_digits is less than 0, then number is rounded to the left of the decimal point.\\n The 0.5 is rounded away from zero. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Rounds a number to a specified number of digits.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round.</div>'},{name:\"precision\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"double\",description:\"The rounded number as numeric type.\"},errors:[]},{isDocumented:!0,arity:2,name:\"rounddown\",qname:\"math:rounddown\",signature:\"($number as double, $precision as integer) as double\",description:' Rounds a number down, toward zero.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If num_digits is greater than 0 (zero), then number is rounded down\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded down to the nearest integer.\\n If num_digits is less than 0, then number is rounded down to the left of the decimal point. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Rounds a number down, toward zero.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round</div>'},{name:\"precision\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"double\",description:\"the truncated number toward zero, as numeric type.\"},errors:[]},{isDocumented:!0,arity:2,name:\"roundup\",qname:\"math:roundup\",signature:\"($number as double, $precision as integer) as double\",description:' Rounds a number up, away from 0 (zero).<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If num_digits is greater than 0 (zero), then number is rounded down\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded down to the nearest integer.\\n If num_digits is less than 0, then number is rounded down to the left of the decimal point. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Rounds a number up, away from 0 (zero).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round</div>'},{name:\"precision\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"double\",description:\"The truncated number away from zero, as numeric type.\"},errors:[]},{isDocumented:!0,arity:1,name:\"sign\",qname:\"math:sign\",signature:\"($number as double) as integer\",description:' Determines the sign of a number. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Returns 1 if the number is positive, zero (0) if the number is 0,\\n and -1 if the number is negative.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Determines the sign of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument</div>'}],returns:{type:\"integer\",description:\"The sign as (-1, 0, 1).\"},errors:[]},{isDocumented:!0,arity:1,name:\"sinh\",qname:\"math:sinh\",signature:\"($arg as double) as double external\",description:\" Calculate the hyperbolic sine.\\n\",summary:\"<p> Calculate the hyperbolic sine.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arg</div>'}],returns:{type:\"double\",description:\"the result of sinh(arg)\"},errors:[]},{isDocumented:!0,arity:2,name:\"slope\",qname:\"math:slope\",signature:\"($known_y as double+, $known_x as double+) as double\",description:' Returns the slope of the linear regression line through data points in known_y\\'s and known_x\\'s.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The slope is the vertical distance divided by the horizontal distance between\\n   any two points on the line, which is the rate of change along the regression line.\\n It computes the formula:<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n where average_x and average_y are computed with AVERAGE function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the slope of the linear regression line through data points in known_y's and known_x's.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"known_y\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of y numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"known_x\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of x numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"The slope value, as numeric type\"},errors:[\"<xqdoc:error xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">math:INVALID_INPUT if there are different numbers of x's and y's or if the sequence is empty</xqdoc:error>\",'<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:DIVIDE_BY_0 if all x\\'s are equal</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"small\",qname:\"math:small\",signature:\"($numbers as double*, $k as integer) as double\",description:' This function computes the k-th smallest value in a data set. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Use this function to return values with a particular relative standing in a data set.\\n If n is the number of data points in array, SMALL(array,1) equals the smallest value,\\n   and SMALL(array,n) equals the largest value.\\n Borrowed from excel module.\\n',summary:\"<p> This function computes the k-th smallest value in a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"k\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The position (from the smallest) in the sequence of data to return. Must have value between 1 and size of sequence.</div>'}],returns:{type:\"double\",description:\"The k-th smallest value of $numbers.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if the sequence is zero length or $k is not a value between 1 and the size of sequence.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"sort-numbers\",qname:\"math:sort-numbers\",signature:\"($numbers as double*) as double*\",description:' Sorts a sequence of numbers or arguments castable to numeric.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n It first casts all arguments to numeric and then sorts ascending.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Helper function.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Sorts a sequence of numbers or arguments castable to numeric.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of arguments castable to numeric.</div>'}],returns:{type:\"double*\",description:\"The sorted sequence as numeric types.\"},errors:[]},{isDocumented:!0,arity:3,name:\"standardize\",qname:\"math:standardize\",signature:\"($x as double, $mean as double, $standard_dev as double) as double\",description:' Returns a normalized value from a distribution characterized by mean and standard_dev.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is (x - mean) / standard_dev .<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns a normalized value from a distribution characterized by mean and standard_dev.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value you want to normalize</div>'},{name:\"mean\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the arithmetic mean of the distribution.</div>'},{name:\"standard_dev\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the standard deviation of the distribution.</div>'}],returns:{type:\"double\",description:\"The normalized x, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if standard_dev is a value smaller than zero or equal</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"stdev\",qname:\"math:stdev\",signature:\"($numbers as double+) as double\",description:' Estimates standard deviation based on a sample. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The standard deviation is a measure of how widely values are dispersed\\n   from the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / (n-1) )    = sqrt ( VAR(numbers) )<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Estimates standard deviation based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"the standard deviation, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"stdeva\",qname:\"math:stdeva\",signature:\"($numbers as double+) as double\",description:' Estimates standard deviation based on a sample. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The standard deviation is a measure of how widely values are dispersed\\n   from the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / (n-1) )    = sqrt ( VARA(numbers) )<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Estimates standard deviation based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"the standard deviation, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"stdevp\",qname:\"math:stdevp\",signature:\"($numbers as double+) as double\",description:' Calculates standard deviation based on the entire population given as arguments. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The standard deviation is a measure of how widely values are dispersed from\\n   the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / n )    = sqrt ( VARP(numbers) )<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Calculates standard deviation based on the entire population given as arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"the standard deviation, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"stdevpa\",qname:\"math:stdevpa\",signature:\"($numbers as double+) as double\",description:' Calculates standard deviation based on the entire population given as arguments. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The standard deviation is a measure of how widely values are dispersed from\\n   the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / n )    = sqrt ( VARPA(numbers) )<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Calculates standard deviation based on the entire population given as arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"the standard deviation, as numeric type\"},errors:[]},{isDocumented:!0,arity:2,name:\"subtotal\",qname:\"math:subtotal\",signature:\"($function_num as integer, $numbers as double*) as double\",description:' Returns a subtotal in a sequence of numbers.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The function applied is given by $function_num.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns a subtotal in a sequence of numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"function_num\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>defines the function to be applied on sequence values. The possible values are: <dt>1 or 101</dt> <dd> AVERAGE</dd> <dt>2 or 102</dt> <dd> COUNT</dd> <dt>3 or 103</dt> <dd> COUNTA</dd> <dt>4 or 104</dt> <dd> MAX</dd> <dt>5 or 105</dt> <dd> MIN</dd> <dt>6 or 106</dt> <dd> PRODUCT</dd> <dt>7 or 107</dt> <dd> STDEV</dd> <dt>8 or 108</dt> <dd> STDEVP</dd> <dt>9 or 109</dt> <dd> SUM</dd> <dt>10 or 110</dt> <dd> VAR</dd> <dt>11 or 111</dt> <dd> VARP</dd></dl> In this implementation there is no difference between x and 10x.<br/></div>'},{name:\"numbers\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length.</div>'}],returns:{type:\"double\",description:\"The function result, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">* depends on the function called</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">math:INVALID_ARGUMENT if $function_num is not a value between 1 .. 11 or 101 .. 111</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"sumproduct\",qname:\"math:sumproduct\",signature:\"($array1 as double*, $array2 as double*) as double\",description:' Multiplies the elements on the same position in each sequence\\n and sums up the results.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers</div>'},{name:\"array2\",type:\"double\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers</div>'}],returns:{type:\"double\",description:\"the sum of products\"},errors:[]},{isDocumented:!0,arity:1,name:\"sumsq\",qname:\"math:sumsq\",signature:\"($numbers as double+) as double\",description:' Returns the sum of the squares of the arguments.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n It uses the sumproduct function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Returns the sum of the squares of the arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of one or more numbers</div>'}],returns:{type:\"double\",description:\"the sum of squared values, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"tanh\",qname:\"math:tanh\",signature:\"($arg as double) as double external\",description:\" Calculate the hyperbolic tangent.\\n\",summary:\"<p> Calculate the hyperbolic tangent.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arg</div>'}],returns:{type:\"double\",description:\"the result of tanh(arg)\"},errors:[]},{isDocumented:!0,arity:1,name:\"trunc\",qname:\"math:trunc\",signature:\"($number as double) as integer\",description:' Truncates a number to an integer by removing the fractional part of the number.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Truncates a number to an integer by removing the fractional part of the number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument .</div>'}],returns:{type:\"integer\",description:\"The integer value.\"},errors:[]},{isDocumented:!0,arity:2,name:\"trunc\",qname:\"math:trunc\",signature:\"($number as double, $precision as integer) as double\",description:' Truncates a number down to precision.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This behaves exactly like rounddown.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Truncates a number down to precision.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument castable to numeric type.</div>'},{name:\"precision\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep .</div>'}],returns:{type:\"double\",description:\"The integer value.\"},errors:[]},{isDocumented:!0,arity:1,name:\"var\",qname:\"math:var\",signature:\"($numbers as double+) as double\",description:' Estimates variance based on a sample.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / (n - 1).\\n average_x is computed with AVERAGE function.\\n n is the count of numbers from the sequence, excluding empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Estimates variance based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"The variance, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"vara\",qname:\"math:vara\",signature:\"($numbers as double+) as double\",description:' Estimates variance based on a sample.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / (n - 1).\\n average_x is computed with AVERAGE function.\\n n is the size of sequence, including empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Estimates variance based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"The variance, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"varp\",qname:\"math:varp\",signature:\"($numbers as double+) as double\",description:' Calculates variance based on the entire population.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / n.\\n average_x is computed with AVERAGE function.\\n n is the count of numbers from the sequence, excluding empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Calculates variance based on the entire population.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"The variance, as numeric type\"},errors:[]},{isDocumented:!0,arity:1,name:\"varpa\",qname:\"math:varpa\",signature:\"($numbers as double+) as double\",description:' Calculates variance based on the entire population.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / n.\\n average_x is computed with AVERAGE function.\\n n is the size of sequence, including empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Borrowed from excel module.\\n',summary:\"<p> Calculates variance based on the entire population.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"double\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"double\",description:\"The variance, as numeric type\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/oauth/error\":{ns:\"http://www.zorba-xquery.com/modules/oauth/error\",description:\" Module that defines the errors raised in Oauth modules.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Stephanie Russell</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/oauth/error\",prefix:\"oerr\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[],variables:[{name:\"oerr:errNS\",type:\"xs:string\",description:\" Errors namespace URI.\\n\"},{name:\"oerr:OC001\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.zorba-xquery.com/modules/oauth/errors\\\" and local name 'OC001'. This signing method is not implemented yet.\\n\"},{name:\"oerr:OC002\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.zorba-xquery.com/modules/oauth/errors\\\" and local name 'OC002'. This signing method is not supported.\\n\"},{name:\"oerr:OC003\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.zorba-xquery.com/modules/oauth/errors\\\" and local name 'OC003'. Http 401 error.\\n\"},{name:\"oerr:OC004\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.zorba-xquery.com/modules/oauth/errors\\\" and local name 'OC004'. Http 500 error.\\n\"},{name:\"oerr:OC005\",type:\"xs:QName\",description:\" xs:QName with namespace URI=\\\"http://www.zorba-xquery.com/modules/oauth/errors\\\" and local name 'OC004'. Http 500 error.\\n\"}]},\"http://jsoniq.org/functions\":{ns:\"http://jsoniq.org/functions\",description:' This module contains all of the functions defined by the JSONiq\\n specification (see http://jsoniq.org/).\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The module is always imported so you do not need to import it explicitly.\\n Also, you do not need to fully qualify a function to invoke it.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Markos Zaharioudakis, Matthias Brantner, Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://jsoniq.org/errors\",prefix:\"jerr\"},{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://jsoniq.org/types\",prefix:\"js\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"decode-from-roundtrip\",qname:\"jn:decode-from-roundtrip\",signature:\"($items as item()*) as item()* external\",description:' This function decodes non-JSON types previously encoded with\\n jn:encode-for-roundtrip.\\n Calling this version of the function is equivalent to calling the\\n 2 argument version of the function with the second argument\\n   { \"prefix\" : \"Q{http://jsoniq.org/roundtrip}\" }\\n',summary:\"<p> This function decodes non-JSON types previously encoded with\\n jn:encode-for-roundtrip.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items to be decoded.</div>'}],returns:{type:\"item()*\",description:\"the decoded items.\"},errors:[]},{isDocumented:!0,arity:2,name:\"decode-from-roundtrip\",qname:\"jn:decode-from-roundtrip\",signature:\"($items as item()*, $options as object()) as item()* external\",description:' This function decodes non-JSON types previously encoded with\\n jn:encode-for-roundtrip.\\n The $options parameter contains options for the decoding process.\\n Currently the only supported option is \"prefix\". It specifies the prefix\\n that determines if this function decodes an item.\\n Example:\\n   jn:decode-from-roundtrip(\\n     { \"nan\" : { \"pre-type\" : \"double\", \"pre-value\" : \"NaN\" } },\\n     { \"prefix\" : \"pre-\" }\\n   )\\n returns the same instance that would be constructed by\\n   { \"nan\" : double(\"NaN\") }\\n So\\n   let $decoded := jn:decode-from-roundtrip(\\n           { \"nan\" : { \"pre-type\" : \"double\", \"pre-value\" : \"NaN\" } },\\n           { \"prefix\" : \"pre-\" }\\n       )\\n   let $nan := $decoded(\"nan\")\\n   return\\n       ($nan instance of double, $nan)\\n returns\\n   true NaN\\n',summary:\"<p> This function decodes non-JSON types previously encoded with\\n jn:encode-for-roundtrip.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items to be decoded.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the decoding options.</div>'}],returns:{type:\"item()*\",description:\"the decoded items.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jerr:JNTY0023 if $options(\"prefix\") is not a string</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"encode-for-roundtrip\",qname:\"jn:encode-for-roundtrip\",signature:\"($items as item()*) as item()* external\",description:\" This function recursively encodes non-JSON types in such a way that they\\n can be serialized as JSON while keeping roundtrip capability.\\n\",summary:\"<p> This function recursively encodes non-JSON types in such a way that they\\n can be serialized as JSON while keeping roundtrip capability.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items to be encoded.</div>'}],returns:{type:\"item()*\",description:\"the encoded items.\"},errors:[]},{isDocumented:!0,arity:2,name:\"encode-for-roundtrip\",qname:\"jn:encode-for-roundtrip\",signature:\"($items as item()*, $options as object()) as item()* external\",description:' This function recursively encodes non-JSON types in such a way that they\\n can be serialized as JSON while keeping roundtrip capability.\\n Example:\\n   jn:encode-for-roundtrip(\\n     { \"nan\" : double(\"NaN\") },\\n     { \"prefix\" : \"pre-\" }\\n   )\\n returns\\n   { \"nan\" : { \"pre-type\" : \"double\", \"pre-value\" : \"NaN\" } }\\n',summary:\"<p> This function recursively encodes non-JSON types in such a way that they\\n can be serialized as JSON while keeping roundtrip capability.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items to be encoded.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the encoding options.</div>'}],returns:{type:\"item()*\",description:\"the encoded items.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jerr:JNTY0023 if $options(\"prefix\") is not a string</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"flatten\",qname:\"jn:flatten\",signature:\"($items as item()*) as item()* external\",description:' For each item in the given sequence, this function returns the item itself,\\n if it is not an array, or a sequence of items \"flattened-out\" from the array.\\n Flattening an array means replacing the array with its members, and recursively\\n flattening any arrays in the members sequence.\\n Note: The function is equivalent to\\n   define function jn:flatten($args as item()*)\\n   {\\n     for $arg in args\\n     return\\n       if ($arg instance of array())\\n       then\\n         for $value in $arg[]\\n         return\\n           if ($value instance of array())\\n           then jn:flatten($value[])\\n           else $value\\n       else\\n         $arg\\n   };\\n',summary:'<p> For each item in the given sequence, this function returns the item itself,\\n if it is not an array, or a sequence of items \"flattened-out\" from the array.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items</div>'}],returns:{type:\"item()*\",description:\"The flattened-out items of the arrays in $items.\"},errors:[]},{isDocumented:!0,arity:1,name:\"keys\",qname:\"jn:keys\",signature:\"($o as item()*) as string* external\",description:\" Returns the set of keys belonging to the objects found inside a given\\n sequence of items. The keys are returned in an implementation-defined\\n order. Duplicate keys are eliminated.\\n\",summary:\"<p> Returns the set of keys belonging to the objects found inside a given\\n sequence of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"o\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items. Only object items are actually processed; items of any other kind are simply skipped.</div>'}],returns:{type:\"string*\",description:\"The distinct keys of the objects in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"members\",qname:\"jn:members\",signature:\"($a as item()*) as item()* external\",description:\" Returns the items belonging to the arrays found inside a given sequence\\n of items. The items are returned in an implementation-defined order.\\n\",summary:\"<p> Returns the items belonging to the arrays found inside a given sequence\\n of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"a\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items. Only array items are actually processed; items of any other kind are simply skipped.</div>'}],returns:{type:\"item()*\",description:\"The members of the arrays in the input sequence.\"},errors:[]},{isDocumented:!0,arity:0,name:\"null\",qname:\"jn:null\",signature:\"() as js:null external\",description:\" Returns the JSON null.\\n\",summary:\"<p> Returns the JSON null.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"js:null\",description:\"The JSON null.\"},errors:[]},{isDocumented:!0,arity:1,name:\"parse-json\",qname:\"jn:parse-json\",signature:\"($j as string?) as json-item()* external\",description:\" This function parses a given string as JSON and returns a sequence\\n of Objects or Arrays.\\n Please note that this function allows to parse sequences of whitespace\\n separated objects and arrays.\\n\",summary:\"<p> This function parses a given string as JSON and returns a sequence\\n of Objects or Arrays.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"j\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string containing a valid JSON text.</div>'}],returns:{type:\"json-item()*\",description:\"A sequence of JSON Object or Array item.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jerr:JNDY0021 if the given string is not valid JSON.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse-json\",qname:\"jn:parse-json\",signature:\"($j as string?, $o as object()) as json-item()* external\",description:\" This function parses a given string as JSON and returns a sequence\\n of Objects or Arrays.\\n\",summary:\"<p> This function parses a given string as JSON and returns a sequence\\n of Objects or Arrays.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"j\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string containing a valid JSON text.</div>'},{name:\"o\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A JSON object defining options to configure the parser. Allowed options are <ul> <li>jsoniq-multiple-top-level-items: allow parsing of sequences of JSON Objects and Arrays (boolean; default: true)</li> <li>jsoniq-strip-top-level-array: if the top-level JSON item is an array, strip it and return its elements as multiple top-level items (boolean; default: false)</li> </ul></div>'}],returns:{type:\"json-item()*\",description:\"a sequence of JSON Object or Array item.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jerr:JNDY0021 if the given string is not valid JSON or if jsoniq-multiple-top-level-items is false and there is additional content after the first JSON Object or Array.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">jerr:JNTY0020 if the value for the option jsoniq-multiple-top-level-items is not of type boolean.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"project\",qname:\"jn:project\",signature:\"($items as item()*, $keys as string*) as item()* external\",description:' For each item in the given sequence, this function returns the item itself,\\n if it is not an object, or its \"projected\" copy if it is an object. Projecting\\n an object by a set of keys means creating a new object from the specified pairs\\n of the source object. Specifically, for each key in $keys, if the object has a\\n pair with that key, then a copy of that pair is included in the new object.\\n',summary:'<p> For each item in the given sequence, this function returns the item itself,\\n if it is not an object, or its \"projected\" copy if it is an object.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the pairs to include from each object in $items.</div>'}],returns:{type:\"item()*\",description:\"The projection of the original sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"size\",qname:\"jn:size\",signature:\"($a as array()?) as integer? external\",description:\" Returns the size of a JSON array, or the empty sequence if no array is given.\\n The size of an Array is the number of members contained within it.\\n\",summary:\"<p> Returns the size of a JSON array, or the empty sequence if no array is given.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"a\",type:\"array()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">rray A JSON array.</div>'}],returns:{type:\"integer?\",description:\"The number of items in $array, or the empty sequence if $array is empty.\"},errors:[]},{isDocumented:!0,arity:2,name:\"trim\",qname:\"jn:trim\",signature:\"($items as item()*, $keys as string*) as item()* external\",description:' For each item in the given sequence, this function returns the item itself,\\n if it is not an object, or its \"trimmed\" copy, if it is an object. Trimming\\n an object by a set of keys means creating a new object containing all the\\n pairs of the source object except the ones whose key appears in the given\\n set of keys.\\n',summary:'<p> For each item in the given sequence, this function returns the item itself,\\n if it is not an object, or its \"trimmed\" copy, if it is an object.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the pairs to exclude from each object in $items.</div>'}],returns:{type:\"item()*\",description:\"The trimmed version of the input sequence.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/xqdoc\":{ns:\"http://zorba.io/modules/xqdoc\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The goal of xqDoc is to provide a simple vendor neutral solution for\\n documenting XQuery modules, as well as tools to generate a user friendly\\n presentation of this documentation and cross referencing information.\\n Therefore, xqDoc proposes a new commenting convention that extends the\\n currently defined XQuery comment style. This convention is modeled\\n after Java\\'s Javadoc commenting style, and provides a simple, uniform\\n way to document XQuery source code. You can find more information about\\n xqDoc on the website of the <a href=\"http://xqdoc.org/\">xqDoc project</a>.\\n This library module provides XQDoc utility functions.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Generating a user friendly presentation of the documentation is\\n accomplished in the following steps:\\n <ol>\\n  <li>Module, variable, function, collection, and index declarations need\\n      to be commented using the xqDoc commenting conventions. For example,\\n      this module contains xqDoc-style comments</li>\\n  <li>A xqDoc-enabled processor can parse such documentation and generate\\n      a vendor neutral XML document which stores all the information about\\n      the code and the comments. Such a document adheres to the xqDoc\\n      Schema.</li>\\n  <li>The information of an XML document generated by the second step,\\n      can be transformed into arbitrary presentation formats\\n      (e.g. html).</li>\\n </ol>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module implements the first and second step of this process.\\n That is, Zorba can parse XQuery modules which are annotated with\\n xqDoc-style documentation and generate the vendor neutral\\n XML representation.\\n </p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://xqdoc.org/\" target=\"_blank\">xqDoc specification</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.zorba-xquery.com/tutorials/xqdoc.html\" target=\"_blank\">xqDoc tutorial with Zorba</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gabriel Petrovay</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/fetch\",prefix:\"fetch\"},{uri:\"http://zorba.io/modules/xqdoc-options\",prefix:\"opt\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/modules/xqdoc\",prefix:\"xqd\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"xqdoc-content\",qname:\"xqd:xqdoc-content\",signature:\"($module as xs:string) as element(*)\",description:\" Generated the an XQDoc XML document for the module provided\\n as parameter to this function.\\n\",summary:\"<p> Generated the an XQDoc XML document for the module provided\\n as parameter to this function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"module\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The module (as string) for which to generate the XQDoc documentation.</div>'}],returns:{type:\"element(*)\",description:'An element according to the xqdoc schema (<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/xqdoc.xsd</tt>).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr::ZXQD0002 if the xqdoc comments in the module contain invalid XML</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"xqdoc-content\",qname:\"xqd:xqdoc-content\",signature:\"($module as xs:string, $options as element(opt:enable)) as element(*)\",description:\" Generated the an XQDoc XML document for the module provided\\n as parameter to this function.\\n In comparison to the single parameter version, this function does not\\n generate XQDoc for all language components. By default, the\\n following components are deactivated: XQuery comments, import\\n statements, variable declarations, function declarations, collection\\n declarations,  and index declarations. The second parameter is used to\\n enable the XQDoc generation of those components.\\n\",summary:\"<p> Generated the an XQDoc XML document for the module provided\\n as parameter to this function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"module\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The module (as string) for which to generate the XQDoc documentation.</div>'},{name:\"options\",type:\"element(opt:enable)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> XQDoc generation options, e.g.: <pre> &lt;enable xmlns=\"http://zorba.io/modules/xqdoc-options\" comments=\"true\" functions=\"true\" indexes=\"true\" &gt; </pre></div>'}],returns:{type:\"element(*)\",description:'An element according to the xqdoc schema (<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/xqdoc.xsd</tt>).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr::ZXQD0002 if the xqdoc comments in the module contain invalid XML</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"xqdoc\",qname:\"xqd:xqdoc\",signature:\"($module-uri as xs:string) as element(*)\",description:\" Generates an XQDoc XML document for the module located\\n at the URI provided as parameter to this function.\\n\",summary:\"<p> Generates an XQDoc XML document for the module located\\n at the URI provided as parameter to this function.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"module-uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL of the module for which to generate XQDoc.</div>'}],returns:{type:\"element(*)\",description:'An element according to the xqdoc schema (<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/xqdoc.xsd</tt>).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr::ZXQD0002 if the xqdoc comments in the module contain invalid XML</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"xqdoc\",qname:\"xqd:xqdoc\",signature:\"($module-uri as xs:string, $options as element(opt:enable)) as element(*)\",description:\" Generates an XQDoc XML document for the module located\\n at the URI provided as parameter to this function.\\n In comparison to the single parameter version, this function does not\\n generate XQDoc for all language components. By default, the\\n following components are deactivated: XQuery comments, import\\n statements, variable declarations, function declarations, collection\\n declarations,  and index declarations. The second parameter is used to\\n enable the XQDoc generation of those components.\\n\",summary:\"<p> Generates an XQDoc XML document for the module located\\n at the URI provided as parameter to this function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"module-uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL of the module for which to generate XQDoc.</div>'},{name:\"options\",type:\"element(opt:enable)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> XQDoc generation options, e.g.: <pre> &lt;enable xmlns=\"http://zorba.io/modules/xqdoc-options\" comments=\"true\" functions=\"true\" indexes=\"true\" /&gt; </pre></div>'}],returns:{type:\"element(*)\",description:'An element according to the xqdoc schema (<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/xqdoc.xsd</tt>).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr::ZXQD0002 if the xqdoc comments in the module contain invalid XML</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/data-cleaning/character-based-string-similarity\":{ns:\"http://zorba.io/modules/data-cleaning/character-based-string-similarity\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides character-based string similarity functions\\n that view strings as sequences of characters, generally computing a similarity score\\n that corresponds to the cost of transforming one string into another.\\n These functions are particularly useful for matching near duplicate strings\\n in the presence of typographical errors. </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins and Diogo Simões</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/data-cleaning/character-based-string-similarity\",prefix:\"simc\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"edit-distance\",qname:\"simc:edit-distance\",signature:\"($s1 as xs:string, $s2 as xs:string) as xs:integer\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the edit distance between two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This distance, also refered to as the Levenshtein distance, is defined as the minimum number\\n of edits needed to transform one string into the other, with the allowable edit operations\\n being insertion, deletion, or substitution of a single character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">edit-distance(\"FLWOR\", \"FLOWER\")</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">2</pre></p>\\n',summary:\"<p>  Returns the edit distance between two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'}],returns:{type:\"xs:integer\",description:\"The edit distance between the two strings.\"},errors:[]},{isDocumented:!0,arity:4,name:\"jaro-winkler\",qname:\"simc:jaro-winkler\",signature:\"($s1 as xs:string, $s2 as xs:string, $prefix as xs:integer, $fact as xs:double) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Jaro-Winkler similarity coefficient between two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This similarity coefficient corresponds to an extension of the Jaro similarity coefficient that weights or\\n penalizes strings based on their similarity at the beginning of the string, up to a given prefix size.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">jaro-winkler(\"DWAYNE\", \"DUANE\", 4, 0.1 )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">0.8577777777777778</pre></p>\\n',summary:\"<p>  Returns the Jaro-Winkler similarity coefficient between two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"prefix\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when testing for equal prefixes in the strings.</div>'},{name:\"fact\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The weighting factor to consider when the input strings have equal prefixes.</div>'}],returns:{type:\"xs:double\",description:\"The Jaro-Winkler similarity coefficient between the two strings.\"},errors:[]},{isDocumented:!0,arity:2,name:\"jaro\",qname:\"simc:jaro\",signature:\"($s1 as xs:string, $s2 as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Jaro similarity coefficient between two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This similarity coefficient is based on the number of transposed characters and on a\\n weighted sum of the percentage of matched characters held within the strings. The higher\\n the Jaro-Winkler value is, the more similar the strings are. The coefficient is\\n normalized such that 0 equates to no similarity and 1 is an exact match.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">jaro(\"FLWOR Found.\", \"FLWOR Foundation\")</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">0.5853174603174603</pre></p>\\n',summary:\"<p>  Returns the Jaro similarity coefficient between two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'}],returns:{type:\"xs:double\",description:\"The Jaro similarity coefficient between the two strings.\"},errors:[]},{isDocumented:!0,arity:4,name:\"needleman-wunsch\",qname:\"simc:needleman-wunsch\",signature:\"($s1 as xs:string, $s2 as xs:string, $score as xs:integer, $penalty as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Needleman-Wunsch distance between two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Needleman-Wunsch distance is similar to the basic edit distance metric, adding a\\n variable cost adjustment to the cost of a gap (i.e., an insertion or deletion) in the\\n distance metric.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">needleman-wunsch(\"KAK\", \"KQRK\", 1, 1)</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">0</pre></p>\\n',summary:\"<p>  Returns the Needleman-Wunsch distance between two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"score\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The score value.</div>'},{name:\"penalty\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The penalty value.</div>'}],returns:{type:\"xs:double\",description:\"The Needleman-Wunsch distance between the two strings.\"},errors:[]},{isDocumented:!0,arity:4,name:\"smith-waterman\",qname:\"simc:smith-waterman\",signature:\"($s1 as xs:string, $s2 as xs:string, $score as xs:integer, $penalty as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Smith-Waterman distance between two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">smith-waterman(\"ACACACTA\", \"AGCACACA\", 2, 1)</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">12</pre></p>\\n',summary:\"<p>  Returns the Smith-Waterman distance between two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"score\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The score value.</div>'},{name:\"penalty\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The penalty value.</div>'}],returns:{type:\"xs:double\",description:\"The Smith-Waterman distance between the two strings.\"},errors:[]}],variables:[]},\"http://expath.org/ns/error\":{ns:\"http://expath.org/ns/error\",description:\" This module defines all errors for the http-client module.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Markus Pilman</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://expath.org/ns/error\",prefix:\"err\"}],functions:[],variables:[{name:\"err:errNS\",type:\"xs:string\",description:\" Error namespace URI.\\n\"},{name:\"err:HC001\",type:\"xs:QName\",description:\" An HTTP error occurred.\\n\"},{name:\"err:HC002\",type:\"xs:QName\",description:\" Error parsing the entity content as XML or HTML.\\n\"},{name:\"err:HC003\",type:\"xs:QName\",description:\" With a multipart response, the override-media-type must be either a multipart media type or application/octet-stream.\\n\"},{name:\"err:HC004\",type:\"xs:QName\",description:\" The src attribute on the body element is mutually exclusive with all other attribute (except the media-type).\\n\"},{name:\"err:HC005\",type:\"xs:QName\",description:\" The request element is not valid.\\n\"},{name:\"err:HC006\",type:\"xs:QName\",description:\" A timeout occurred waiting for the response.\\n\"},{name:\"err:HCV01\",type:\"xs:QName\",description:\" This error is not defined in the specification but used by the Zorba implementation.\\n It gets thrown when the user gives wrong arguments which are statically correct,\\n but make no sense (for example: http:send-request((), ())).\\n\"},{name:\"err:HCV02\",type:\"xs:QName\",description:\" Zorba specific error\\n This error is raised if trying to follow a redirect for a POST, PUT, or\\n DELETE request\\n\"}]},\"http://www.28msec.com/modules/s3\":{ns:\"http://www.28msec.com/modules/s3\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for managing S3 buckets and object.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It is not possible to access buckets whose names are not DNS-compliant. For\\n instance a bucket name which contains uppercase letters or is longer than 63\\n characters is not DNS-compliant. For additional details on bucket naming\\n conventions refer to\\n <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html\">\\n Bucket Restrictions and Limitations</a>.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Authentication</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For each functionality two methods are provided:\\n <ul>\\n   <li>one which allows to specify the credentials to use, by means of the\\n   optional $credentials parameter (named). If the parameter is not specified,\\n   the default credentials in the \"S3\" category will be used. If the parameter\\n   is specified it must be either a string or an object. If it is a string it\\n   will be interpreted as the name of a credentials in the \"S3\" category. If\\n   it is an object it must have the following structure:\\n   <ul>\\n     <li>accessKey: the AWS access key to use (string, mandatory).</li>\\n     <li>secretKey: the AWS secret key to use (string, mandatory).</li>\\n     <li>useHttps: whether to use secure HTTPS connections or not.\\n     (boolean, optional). The default is <code>false</code></li>\\n     <li>defaultBucket: the default bucket name (string, optional).</li>\\n   </ul>\\n   </li>\\n   <li>one which does not allow to specify which credentials to use.\\n   In this case the default credentials in the \"S3\" category will be used.</li>\\n </ul>\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The non side-effecting functions:\\n <ul>\\n   <li><a href=\"?anchor=list-buckets-0\">list-buckets#0</a></li>\\n   <li><a href=\"?anchor=list-buckets-1\">list-buckets#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-0\">list-bucket#0</a></li>\\n   <li><a href=\"?anchor=list-bucket-1\">list-bucket#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-2\">list-bucket#2</a></li>\\n   <li><a href=\"?anchor=list-bucket-3\">list-bucket#3</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-0\">list-bucket-versions#0</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-1\">list-bucket-versions#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-2\">list-bucket-versions#2</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-3\">list-bucket-versions#3</a></li>\\n   <li><a href=\"?anchor=read-text-1\">read-text#1</a></li>\\n   <li><a href=\"?anchor=read-text-2\">read-text#2</a></li>\\n   <li><a href=\"?anchor=read-binary-1\">read-binary#1</a></li>\\n   <li><a href=\"?anchor=read-binary-2\">read-binary#2</a></li>\\n   <li><a href=\"?anchor=read-object-1\">read-object#1</a></li>\\n   <li><a href=\"?anchor=read-object-2\">read-object#2</a></li>\\n   <li><a href=\"?anchor=object-metadata-1\">object-metadata#1</a></li>\\n   <li><a href=\"?anchor=object-metadata-2\">object-metadata#2</a></li>\\n   <li><a href=\"?anchor=object-torrent-1\">object-torrent#1</a></li>\\n   <li><a href=\"?anchor=object-torrent-2\">object-torrent#2</a></li>\\n   <li><a href=\"?anchor=object-permissions-1\">object-permissions#1</a></li>\\n   <li><a href=\"?anchor=object-permissions-2\">object-permissions#2</a></li>\\n </ul>\\n are declared deterministic, which means that their results could be cached\\n when invoked multiple times with the same arguments in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use the following alternative functions:\\n <ul>\\n   <li><a href=\"?anchor=list-buckets-nondeterministic-0\">list-buckets-nondeterministic#0</a></li>\\n   <li><a href=\"?anchor=list-buckets-nondeterministic-1\">list-buckets-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-nondeterministic-0\">list-bucket-nondeterministic#0</a></li>\\n   <li><a href=\"?anchor=list-bucket-nondeterministic-1\">list-bucket-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-nondeterministic-2\">list-bucket-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=list-bucket-nondeterministic-3\">list-bucket-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-nondeterministic-0\">list-bucket-versions-nondeterministic#0</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-nondeterministic-1\">list-bucket-versions-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-nondeterministic-2\">list-bucket-versions-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=list-bucket-versions-nondeterministic-3\">list-bucket-versions-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=read-text-nondeterministic-1\">read-text-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=read-text-nondeterministic-2\">read-text-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=read-binary-nondeterministic-1\">read-binary-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=read-binary-nondeterministic-2\">read-binary-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=read-object-nondeterministic-1\">read-object-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=read-object-nondeterministic-2\">read-object-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=object-metadata-nondeterministic-1\">object-metadata-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=object-metadata-nondeterministic-2\">object-metadata-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=object-torrent-nondeterministic-1\">object-torrent-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=object-torrent-nondeterministic-2\">object-torrent-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=object-permissions-nondeterministic-1\">object-permissions-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=object-permissions-nondeterministic-2\">object-permissions-nondeterministic#2</a></li>\\n </ul>\\n which have been declared as being non deterministic.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Alexander Kreutz</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/cryptography/hmac\",prefix:\"hmac\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"http\"},{uri:\"http://jsoniq.org/errors\",prefix:\"jerr\"},{uri:\"http://www.28msec.com/modules/s3\",prefix:\"s3\"},{uri:\"http://s3.amazonaws.com/doc/2006-03-01/\",prefix:\"s3s\"},{uri:\"http://www.28msec.com/modules/sleep\",prefix:\"sleep\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"copy-object\",qname:\"s3:copy-object\",signature:\"($s3-object-source as item(), $s3-object-target as item()) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Copies an object already stored on s3 into a target bucket using the\\n default credentials. If the target object already exists it will be overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The source object metadata is copied to the target object, unless new\\n metadata is specified. In this case the target object will possess only the\\n specified metadata.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Unless the permissions for the target are specified, the target object will\\n have the \"private\" ACL, that is, the owner gets FULL_CONTROL, and no one else\\n has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The source S3 object is specified through the $s3-object-source parameter.\\n Either a string or a JSON object can be used. If a string is specified, it is\\n interpreted as key for an object in the default bucket of the default\\n credentials. If no default bucket is present in the default credentials, the\\n <code>s3:BUCKET</code> error is raised. If a JSON object is used, it must have\\n the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be copied. If specified, only that particular version of the\\n   object will be copied.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The target S3 object is specified through the $s3-object-target parameter.\\n Either a string or a JSON object can be used. If a string is specified and the\\n default credentials contain a default bucket, the object will be copied in\\n the credentials default bucket. Otherwise, the object will be copied in the\\n source object bucket. If a JSON object is used, it must have the following\\n structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials contain a default bucket, the object will be\\n   copied in the credentials default bucket. Otherwise, the object will be\\n   copied in the source object bucket.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).\\n   If not specified, the source object metadata will be copied to the target\\n   object. Otherwise the target object metadata will be the specified one.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $s3-object-source :=\\n {\\n   \"key\" : \"test.xml\",\\n   \"bucket\": \"28msec\"\\n }\\n let $s3-object-target :=\\n {\\n   \"key\" : \"test-copy.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permisstion\": $s3:ACL-GRANT-PUBLIC-READ\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   }\\n }\\n return s3:copy-object($s3-object-source, $s3-object-target)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"sourceVersion\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\",\\n   \"version\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"lastModified\": \"2009-10-28T22:32:00\",\\n   \"eTag\": \"\\\\\"9b2cf535f27731c974343645a3985328\\\\\"\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>sourceVersion: the version of the copied object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When the soruce object is copied in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>version: the version of the copied object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When the soruce object is copied in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>lastModified: the last modification date of the target object. (dateTime, optional)</li>\\n   <li>eTag: the entity tag is a hash of the copeid object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n   <li>expiration: if the object expiration is configured (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html\">PUT Bucket lifecycle</a>),\\n   this field is present. It includes the expiry-date and rule-id key value\\n   pairs providing object expiration information. The value of rule-id is URL\\n   encoded.(string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Copies an object already stored on s3 into a target bucket using the\\n default credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object-source\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to copy from.</div>'},{name:\"s3-object-target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to write to.</div>'}],returns:{type:\"item()*\",description:\"the S3 copy result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"copy-object\",qname:\"s3:copy-object\",signature:\"($credentials as item()?, $s3-object-source as item(), $s3-object-target as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Copies an object already stored on S3 into a target bucket using the\\n specified credentials. If the target object already exists it will be overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The source object metadata is copied to the target object, unless new\\n metadata is specified. In this case the target object will possess only the\\n specified metadata.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Unless the permissions for the target are specified, the target object will\\n have the \"private\" ACL, that is, the owner gets FULL_CONTROL, and no one else\\n has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The source S3 object is specified through the $s3-object-source parameter.\\n Either a string or a JSON object can be used. If a string is specified, it is\\n interpreted as key for an object in the default bucket of the specified\\n credentials. If no default bucket is present in the specified credentials, the\\n <code>s3:BUCKET</code> error is raised. If a JSON object is used, it must have\\n the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be copied. If specified, only that particular version of the\\n   object will be copied.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The target S3 object is specified through the $s3-object-target parameter.\\n Either a string or a JSON object can be used. If a string is specified and the\\n specified credentials contain a default bucket, the object will be copied in\\n the credentials default bucket. Otherwise, the object will be copied in the\\n source object bucket. If a JSON object is used, it must have the following\\n structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials contain a default bucket, the object will be\\n   copied in the credentials default bucket. Otherwise, the object will be\\n   copied in the source object bucket.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).\\n   If not specified, the source object metadata will be copied to the target\\n   object. Otherwise the target object metadata will be the specified one.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $s3-object-source :=\\n {\\n   \"key\" : \"test.xml\",\\n   \"bucket\": \"28msec\"\\n }\\n let $s3-object-target :=\\n {\\n   \"key\" : \"test-copy.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permisstion\": $s3:ACL-GRANT-PUBLIC-READ\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   }\\n }\\n return s3:copy-object(\"credentials\", $s3-object-source, $s3-object-target)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"sourceVersion\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\",\\n   \"version\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"lastModified\": \"2009-10-28T22:32:00\",\\n   \"eTag\": \"\\\\\"9b2cf535f27731c974343645a3985328\\\\\"\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>sourceVersion: the version of the copied object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When the soruce object is copied in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>version: the version of the copied object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When the soruce object is copied in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>lastModified: the last modification date of the target object. (dateTime, optional)</li>\\n   <li>eTag: the entity tag is a hash of the copeid object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Copies an object already stored on S3 into a target bucket using the\\n specified credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object-source\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to copy from.</div>'},{name:\"s3-object-target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to write to.</div>'}],returns:{type:\"object()\",description:\"the S3 copy result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"create-bucket\",qname:\"s3:create-bucket\",signature:\"($bucket as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a bucket using the default S3 credentials. The bucket owner will\\n be the account of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The bucket is created with the S3 default bucket settings. Specifically,\\n it is created in the US Standard region and the default credentials\\n account becomes its owner. The bucket ACL permissions are set to \"private\",\\n that is, the owner gets FULL_CONTROL, whereas no one else has access rights.\\n The bucket name must comply with the following rules:\\n <ul>\\n   <li>bucket names must be no more than 255 characters long.</li>\\n   <li>bucket names must be a combination of uppercase letters, lowercase letters,\\n   numbers, periods (.), dashes (-) and underscores (_).</li>\\n </ul>\\n For more details, refer to the\\n <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html\">\\n Amazon S3 Bucket Restrictions</a> page.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the specified bucket already exists in the US Standard region and has\\n the same owner, its permissions settings are reset and its contents are\\n preserved. Otherwise, if the specified bucket already exists an s3:REQUEST\\n error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:create-bucket(\"28msec\");\\n </pre>\\n </p>\\n',summary:\"<p>  Creates a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket name.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"create-bucket\",qname:\"s3:create-bucket\",signature:\"($credentials as item()?, $bucket as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a bucket using the specified S3 credentials. The bucket owner will\\n be the account of the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The bucket is created with the S3 default bucket settings. Specifically,\\n it is created in the US Standard region and the specified credentials\\n account becomes its owner. The bucket ACL permissions are set to \"private\",\\n that is, the owner gets FULL_CONTROL, whereas no one else has access rights.\\n The bucket name must comply with the following rules:\\n <ul>\\n   <li>bucket names must be no more than 255 characters long.</li>\\n   <li>bucket names must be a combination of uppercase letters, lowercase letters,\\n   numbers, periods (.), dashes (-) and underscores (_).</li>\\n </ul>\\n For more details, refer to the\\n <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html\">\\n Amazon S3 Bucket Restrictions</a> page.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the specified bucket already exists in the US Standard region and has\\n the same owner, its permissions settings are reset and its contents are\\n preserved. Otherwise, if the specified bucket already exists an s3:REQUEST\\n error is raised.</p>\\n',summary:\"<p>  Creates a bucket using the specified S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket name.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-bucket\",qname:\"s3:delete-bucket\",signature:\"($bucket as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a bucket using the default S3 credentials. The bucket must be owned\\n by the account of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This operation will fail if the deleted bucket is not empty. All objects,\\n object versions, and delete markers have to be deleted beforehand using this\\n function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:delete-bucket(\"28msec\");\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket name.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-bucket\",qname:\"s3:delete-bucket\",signature:\"($credentials as item()?, $bucket as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a bucket using the specified S3 credentials. The bucket must be owned\\n by the account of the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This operation will fail if the deleted bucket is not empty. All objects,\\n object versions, and delete markers have to be deleted beforehand using this\\n function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:delete-bucket(\"credentials\", \"28msec\");\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes a bucket using the specified S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket name.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-object\",qname:\"s3:delete-object\",signature:\"($s3-object as item()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes an object or a specific object version from a bucket using the\\n default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If not specified, the\\n   null version of the object is removed, if there is one. To remove a specific\\n   version, this field must be specified.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the bucket is versioned a delete marker is inserted for the object. If\\n mfa-deletion is enabled you will not be able to delete an object through\\n this method. If the specified bucket exists, and the specified object does not\\n exist no errors will be raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:delete-object(\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes an object or a specific object version from a bucket using the\\n default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to delete.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-object\",qname:\"s3:delete-object\",signature:\"($credentials as item()?, $s3-object as item()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes an object or a specific object version from a bucket using the\\n specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If not specified, the\\n   null version of the object is removed, if there is one. To remove a specific\\n   version, this field must be specified.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the bucket is versioned a delete marker is inserted for the object. If\\n mfa-deletion is enabled you will not be able to delete an object through\\n this method. If the specified bucket exists, and the specified object does not\\n exist no errors will be raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:delete-object(\"credentials\",\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes an object or a specific object version from a bucket using the\\n specified S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to delete.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-bucket-nondeterministic\",qname:\"s3:list-bucket-nondeterministic\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in the default bucket of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-0\">list-bucket#0</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects in the default bucket of the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the list of objects in the default bucket of the default S3 credentials\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no default bucket is present in the default S3 credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-bucket-nondeterministic\",qname:\"s3:list-bucket-nondeterministic\",signature:\"($bucket as string?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-1\">list-bucket#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects in a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default S3 credentials will be listed.</div>'}],returns:{type:\"object()\",description:\"the list of the objects in the specified bucket.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-bucket-nondeterministic\",qname:\"s3:list-bucket-nondeterministic\",signature:\"($bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the default S3 credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-2\">list-bucket#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects in a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default S3 credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the default credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"list-bucket-nondeterministic\",qname:\"s3:list-bucket-nondeterministic\",signature:\"($credentials as item()?, $bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the specified credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-3\">list-bucket#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects in a bucket using the specified credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the specified credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-bucket-versions-nondeterministic\",qname:\"s3:list-bucket-versions-nondeterministic\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in the default bucket of the default S3\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-versions-0\">list-bucket-versions#0</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects versions in the default bucket of the default S3\\n credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the list of the object versions in the default bucket of the default S3 credentials\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no default bucket is present in the default S3 credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-bucket-versions-nondeterministic\",qname:\"s3:list-bucket-versions-nondeterministic\",signature:\"($bucket as string?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-versions-1\">list-bucket-versions#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default credentials will be listed.</div>'}],returns:{type:\"object()\",description:\"the list of the object versions in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-bucket-versions-nondeterministic\",qname:\"s3:list-bucket-versions-nondeterministic\",signature:\"($bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the default S3 credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-versions-2\">list-bucket-versions#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object versions in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the default credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"list-bucket-versions-nondeterministic\",qname:\"s3:list-bucket-versions-nondeterministic\",signature:\"($credentials as item()?, $bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the specified credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-bucket-versions-3\">list-bucket-versions#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the specified credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the specified credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-bucket-versions\",qname:\"s3:list-bucket-versions\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in the default bucket of the default S3\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-bucket-versions()\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"keyMarker\" : \"image.jpg\",\\n   \"versionIdMarker\" : \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"nextKeyMarker\": \"marker\",\\n   \"nextVersionIdMarker\": \"UIORUnfndfhnw89493jJFJ\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"revisions\":\\n   [\\n     {\\n       \"kind\": \"Version\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n       \"isLatest\": false,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     },\\n     {\\n       \"kind\": \"DeleteMarker\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"03jpff543dhffds434rfdsFDN943fdsFkdmqnh892\",\\n       \"isLatest\": true,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>keyMarker: indicates from which key in the listing begins\\n   (string, mandatory).</li>\\n   <li>versionMarker: indicates from which version  the listing begins\\n   (string, optional).</li>\\n   <li>nextKeyMarker: when the number of responses exceeds the value of maxKeys,\\n   nextKeyMarker specifies the first key not returned that satisfies the search\\n   criteria. Use this value for the keyMarker request parameter in a subsequent\\n   request. (string, optional)</li>\\n   <li>nextVersionMarker: when the number of responses exceeds the value of maxKeys,\\n   nextVersionIdMarker specifies the first object version not returned that\\n   satisfies the search criteria. Use this value for the versionMarker request\\n   parameter in a subsequent request. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>revisions: an array of objects listing the bucket object versions\\n   (array, mandatory). The fields of each contained object have the following\\n   meaning:\\n   <ul>\\n     <li>kind: the revision kind. One of \"Version\" or \"DeleteMarker\" (string,\\n     mandatory).</li>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>versionId: the object version id (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory for \"Version\" objects, not present for\\n     \"DeleteMarker\" objects).</li>\\n     <li>size: the object size in bytes (integer, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects versions in the default bucket of the default S3\\n credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the list of the object versions in the default bucket of the default S3 credentials\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no default bucket is present in the default S3 credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-bucket-versions\",qname:\"s3:list-bucket-versions\",signature:\"($bucket as string?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-bucket-versions(\"28msec\")\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"keyMarker\" : \"image.jpg\",\\n   \"versionIdMarker\" : \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"nextKeyMarker\": \"marker\",\\n   \"nextVersionIdMarker\": \"UIORUnfndfhnw89493jJFJ\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"revisions\":\\n   [\\n     {\\n       \"kind\": \"Version\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n       \"isLatest\": false,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     },\\n     {\\n       \"kind\": \"DeleteMarker\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"03jpff543dhffds434rfdsFDN943fdsFkdmqnh892\",\\n       \"isLatest\": true,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>keyMarker: indicates from which key in the listing begins\\n   (string, mandatory).</li>\\n   <li>versionMarker: indicates from which version  the listing begins\\n   (string, optional).</li>\\n   <li>nextKeyMarker: when the number of responses exceeds the value of maxKeys,\\n   nextKeyMarker specifies the first key not returned that satisfies the search\\n   criteria. Use this value for the keyMarker request parameter in a subsequent\\n   request. (string, optional)</li>\\n   <li>nextVersionMarker: when the number of responses exceeds the value of maxKeys,\\n   nextVersionIdMarker specifies the first object version not returned that\\n   satisfies the search criteria. Use this value for the versionMarker request\\n   parameter in a subsequent request. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>revisions: an array of objects listing the bucket object versions\\n   (array, mandatory). The fields of each contained object have the following\\n   meaning:\\n   <ul>\\n     <li>kind: the revision kind. One of \"Version\" or \"DeleteMarker\" (string,\\n     mandatory).</li>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>versionId: the object version id (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory for \"Version\" objects, not present for\\n     \"DeleteMarker\" objects).</li>\\n     <li>size: the object size in bytes (integer, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default credentials will be listed.</div>'}],returns:{type:\"object()\",description:\"the list of the object versions in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-bucket-versions\",qname:\"s3:list-bucket-versions\",signature:\"($bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the default S3 credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $options :=\\n {\\n   \"delimiter\": \"/\",\\n   \"maxKeys\": 2,\\n   \"keyMarker\": \"image.jpg\",\\n   \"versionIdMarker\" : \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\"\\n }\\n return s3:list-bucket-versions(\"28msec\", $options)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The options object must have the following structure:\\n <ul>\\n   <li>delimiter: the delimiter marks where the listed results stop. For example,\\n       a delimiter / lists all objects starting with $prefix plus arbitrary\\n       characters but not / (string, optional). Default is the empty string,\\n       that is, all objects are listed.</li>\\n   <li>keyMarker: specifies a key as starting point; following keys (lexicographically\\n       greater than the marker) in alphabetical order are listed (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n   <li>versionMarker: specifies the object version you want starting from;\\n       following revisions (newer than the marker) are listed (string, optional).\\n       By default all versions are listed. Empty string is not allowed.</li>\\n   <li>maxKeys: the maximum number of keys returned. If more keys than maxKeys\\n       can be fetched, the result contains <IsTruncated>true</IsTruncated>\\n       (integer, optional). Default is 1000.</li>\\n   <li>prefix: only keys starting with the prefix are returned (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"keyMarker\" : \"image.jpg\",\\n   \"versionIdMarker\" : \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"nextKeyMarker\": \"marker\",\\n   \"nextVersionIdMarker\": \"UIORUnfndfhnw89493jJFJ\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"revisions\":\\n   [\\n     {\\n       \"kind\": \"Version\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n       \"isLatest\": false,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     },\\n     {\\n       \"kind\": \"DeleteMarker\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"03jpff543dhffds434rfdsFDN943fdsFkdmqnh892\",\\n       \"isLatest\": true,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>keyMarker: indicates from which key in the listing begins\\n   (string, mandatory).</li>\\n   <li>versionMarker: indicates from which version  the listing begins\\n   (string, optional).</li>\\n   <li>nextKeyMarker: when the number of responses exceeds the value of maxKeys,\\n   nextKeyMarker specifies the first key not returned that satisfies the search\\n   criteria. Use this value for the keyMarker request parameter in a subsequent\\n   request. (string, optional)</li>\\n   <li>nextVersionMarker: when the number of responses exceeds the value of maxKeys,\\n   nextVersionIdMarker specifies the first object version not returned that\\n   satisfies the search criteria. Use this value for the versionMarker request\\n   parameter in a subsequent request. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>revisions: an array of objects listing the bucket object versions\\n   (array, mandatory). The fields of each contained object have the following\\n   meaning:\\n   <ul>\\n     <li>kind: the revision kind. One of \"Version\" or \"DeleteMarker\" (string,\\n     mandatory).</li>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>versionId: the object version id (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory for \"Version\" objects, not present for\\n     \"DeleteMarker\" objects).</li>\\n     <li>size: the object size in bytes (integer, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object versions in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the default credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"list-bucket-versions\",qname:\"s3:list-bucket-versions\",signature:\"($credentials as item()?, $bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects versions in a bucket using the specified credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $options :=\\n {\\n   \"delimiter\": \"/\",\\n   \"maxKeys\": 2,\\n   \"keyMarker\": \"image.jpg\",\\n   \"versionIdMarker\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\"\\n }\\n return s3:list-bucket-versions(\"credentials\", \"28msec\", $options)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The options object must have the following structure:\\n <ul>\\n   <li>delimiter: the delimiter marks where the listed results stop. For example,\\n       a delimiter / lists all objects starting with $prefix plus arbitrary\\n       characters but not / (string, optional). Default is the empty string,\\n       that is, all objects are listed.</li>\\n   <li>keyMarker: specifies a key as starting point; following keys (lexicographically\\n       greater than the marker) in alphabetical order are listed (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n   <li>versionMarker: specifies the object version you want starting from;\\n       following revisions (newer than the marker) are listed (string, optional).\\n       By default all versions are listed. Empty string is not allowed.</li>\\n   <li>maxKeys: the maximum number of keys returned. If more keys than maxKeys\\n       can be fetched, the result contains <IsTruncated>true</IsTruncated>\\n       (integer, optional). Default is 1000.</li>\\n   <li>prefix: only keys starting with the prefix are returned (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"keyMarker\" : \"image.jpg\",\\n   \"VersionIdMarker\" : \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n   \"nextKeyMarker\": \"marker\",\\n   \"nextVersionIdMarker\": \"UIORUnfndfhnw89493jJFJ\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"revisions\":\\n   [\\n     {\\n       \"kind\": \"Version\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"QUpfdndhfd8438MNFDN93jdnJFkdmqnh893\",\\n       \"isLatest\": false,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     },\\n     {\\n       \"kind\": \"DeleteMarker\",\\n       \"key\": \"image.jpg\",\\n       \"versionId\": \"03jpff543dhffds434rfdsFDN943fdsFkdmqnh892\",\\n       \"isLatest\": true,\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>keyMarker: indicates from which key in the listing begins\\n   (string, mandatory).</li>\\n   <li>versionMarker: indicates from which version  the listing begins\\n   (string, optional).</li>\\n   <li>nextKeyMarker: when the number of responses exceeds the value of maxKeys,\\n   nextKeyMarker specifies the first key not returned that satisfies the search\\n   criteria. Use this value for the keyMarker request parameter in a subsequent\\n   request. (string, optional)</li>\\n   <li>nextVersionMarker: when the number of responses exceeds the value of maxKeys,\\n   nextVersionIdMarker specifies the first object version not returned that\\n   satisfies the search criteria. Use this value for the versionMarker request\\n   parameter in a subsequent request. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>revisions: an array of objects listing the bucket object versions\\n   (array, mandatory). The fields of each contained object have the following\\n   meaning:\\n   <ul>\\n     <li>kind: the revision kind. One of \"Version\" or \"DeleteMarker\" (string,\\n     mandatory).</li>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>versionId: the object version id (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory for \"Version\" objects, not present for\\n     \"DeleteMarker\" objects).</li>\\n     <li>size: the object size in bytes (integer, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory for \"Version\" objects,\\n     not present for \"DeleteMarker\" objects).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects versions in a bucket using the specified credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the specified credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-bucket\",qname:\"s3:list-bucket\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in the default bucket of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-bucket(\"28msec\")\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"28msec\",\\n   \"prefix\": \"\",\\n   \"marker\" : \"\",\\n   \"nextMarker\": \"marker\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"\",\\n   \"isTruncated\": true,\\n   \"contents\":\\n   [\\n     {\\n       \"key\": \"image.jpg\",\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\"\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>marker: indicates where in the bucket listing begins (string, mandatory).</li>\\n   <li>nextMarker: when the response is truncated, you can use the key name\\n   in this field as marker in the subsequent request to get next set of objects.\\n   Amazon S3 lists objects in alphabetical order. This field is returned only\\n   if you have specified the delimiter request parameter. If the response does\\n   not include the nextMaker field and it is truncated, you can use the value\\n   of the last Key in the response as the marker in the subsequent request to\\n   get the next set of object keys. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>contents: an array of objects listing the bucket content  (array, mandatory).\\n   The fields of each contained object have the following meaning:\\n   <ul>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects in the default bucket of the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the list of objects in the default bucket of the default S3 credentials\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no default bucket is present in the default S3 credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-bucket\",qname:\"s3:list-bucket\",signature:\"($bucket as string?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-bucket(\"28msec\")\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"28msec\",\\n   \"prefix\": \"\",\\n   \"marker\" : \"\",\\n   \"nextMarker\": \"marker\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"\",\\n   \"isTruncated\": true,\\n   \"contents\":\\n   [\\n     {\\n       \"key\": \"image.jpg\",\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\"\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ]\\n }\\n </pre>\\n The meanings of the fields in the return object are the following:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>marker: indicates where in the bucket listing begins (string, mandatory).</li>\\n   <li>nextMarker: when the response is truncated, you can use the key name\\n   in this field as marker in the subsequent request to get next set of objects.\\n   Amazon S3 lists objects in alphabetical order. This field is returned only\\n   if you have specified the delimiter request parameter. If the response does\\n   not include the nextMaker field and it is truncated, you can use the value\\n   of the last Key in the response as the marker in the subsequent request to\\n   get the next set of object keys. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>contents: an array of objects listing the bucket content  (array, mandatory).\\n   The fields of each contained object have the following meaning:\\n   <ul>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects in a bucket using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default S3 credentials will be listed.</div>'}],returns:{type:\"object()\",description:\"the list of the objects in the specified bucket.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-bucket\",qname:\"s3:list-bucket\",signature:\"($bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the default S3 credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $options :=\\n {\\n   \"delimiter\": \"/\",\\n   \"marker\": \"\",\\n   \"maxKeys\": 1,\\n   \"prefix\": \"\"\\n }\\n return s3:list-bucket(\"credentials\", \"28msec\", $options)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The options object must have the following structure:\\n <ul>\\n   <li>delimiter: the delimiter marks where the listed results stop. For example,\\n       a delimiter / lists all objects starting with $prefix plus arbitrary\\n       characters but not / (string, optional). Default is the empty string,\\n       that is, all objects are listed.</li>\\n   <li>marker: specifies a key as starting point; following keys (lexicographically\\n       greater than the marker) in alphabetical order are listed (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n   <li>maxKeys: the maximum number of keys returned. If more keys than maxKeys\\n       can be fetched, the result contains <IsTruncated>true</IsTruncated>\\n       (integer, optional). Default is 1000.</li>\\n   <li>prefix: only keys starting with the prefix are returned (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"marker\" : \"\",\\n   \"nextMarker\": \"marker\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"contents\":\\n   [\\n     {\\n       \"key\": \"image.jpg\",\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\"\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>marker: indicates where in the bucket listing begins (string, mandatory).</li>\\n   <li>nextMarker: when the response is truncated, you can use the key name\\n   in this field as marker in the subsequent request to get next set of objects.\\n   Amazon S3 lists objects in alphabetical order. This field is returned only\\n   if you have specified the delimiter request parameter. If the response does\\n   not include the nextMaker field and it is truncated, you can use the value\\n   of the last Key in the response as the marker in the subsequent request to\\n   get the next set of object keys. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>contents: an array of objects listing the bucket content  (array, mandatory).\\n   The fields of each contained object have the following meaning:\\n   <ul>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects in a bucket using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the default S3 credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the default credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"list-bucket\",qname:\"s3:list-bucket\",signature:\"($credentials as item()?, $bucket as string?, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the objects in a bucket using the specified credentials.\\n This method allows the specification of additional listing options.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $options :=\\n {\\n   \"delimiter\": \"/\",\\n   \"marker\": \"\",\\n   \"maxKeys\": 1,\\n   \"prefix\": \"\"\\n }\\n return s3:list-bucket(\"credentials\", \"28msec\", $options)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The options object must have the following structure:\\n <ul>\\n   <li>delimiter: the delimiter marks where the listed results stop. For example,\\n       a delimiter / lists all objects starting with $prefix plus arbitrary\\n       characters but not / (string, optional). Default is the empty string,\\n       that is, all objects are listed.</li>\\n   <li>marker: specifies a key as starting point; following keys (lexicographically\\n       greater than the marker) in alphabetical order are listed (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n   <li>maxKeys: the maximum number of keys returned. If more keys than maxKeys\\n       can be fetched, the result contains <IsTruncated>true</IsTruncated>\\n       (integer, optional). Default is 1000.</li>\\n   <li>prefix: only keys starting with the prefix are returned (string, optional).\\n       Default is the empty string, that is, all objects are listed.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example result:\\n <pre>\\n {\\n   \"name\": \"bucket\",\\n   \"prefix\": \"\",\\n   \"marker\" : \"\",\\n   \"nextMarker\": \"marker\",\\n   \"maxKeys\": 1,\\n   \"delimiter\": \"/\",\\n   \"isTruncated\": true,\\n   \"contents\":\\n   [\\n     {\\n       \"key\": \"image.jpg\",\\n       \"lastModified\": \"2009-10-12T17:50:30.000Z\",\\n       \"eTag\": \"\\\\\"fba9dede5f27731c9771645a39863328\\\\\"\",\\n       \"size\": 434234,\\n       \"storageClass\": \"STANDARD\"\\n       \"owner\":\\n       {\\n         \"id\": \"75aa57f09aa0c8caeab4f8c24e99d10f8e7faeebf76c078efc7c6caea54ba06a\"\\n         \"displayName\": \"mtd@amazon.com\"\\n       }\\n     }\\n   ],\\n   \"commonPrefixes\": [\"photos/\"]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>name: the bucket name (string, mandatory).</li>\\n   <li>prefix: the used prefix (string, mandatory).</li>\\n   <li>marker: indicates where in the bucket listing begins (string, mandatory).</li>\\n   <li>nextMarker: when the response is truncated, you can use the key name\\n   in this field as marker in the subsequent request to get next set of objects.\\n   Amazon S3 lists objects in alphabetical order. This field is returned only\\n   if you have specified the delimiter request parameter. If the response does\\n   not include the nextMaker field and it is truncated, you can use the value\\n   of the last Key in the response as the marker in the subsequent request to\\n   get the next set of object keys. (string, optional)</li>\\n   <li>maxKeys: the maximum number of keys returned in the response body\\n   (integer, mandatory).</li>\\n   <li>delimiter: the used delimiter (string, optional).</li>\\n   <li>isTruncated: whether or not all of the results were returned. All of the\\n   results may not be returned if the number of results exceeds that specified\\n   by the maxKeys request parameter (boolean, mandatory).</li>\\n   <li>contents: an array of objects listing the bucket content  (array, mandatory).\\n   The fields of each contained object have the following meaning:\\n   <ul>\\n     <li>key: the object key (string, mandatory).</li>\\n     <li>lastModified: the object last modification date (dateTime, mandatory).</li>\\n     <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n     changes to the contents of an object, not its metadata. The eTag is determined\\n     when an object is created. For objects created by the PUT Object operation\\n     and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n     string representing the MD5 digest of the object data. For other objects,\\n     the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n     not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n     characters and/or will consist of less than 32 or more than 32 hexadecimal\\n     digits.(string, mandatory).</li>\\n     <li>storageClass: the object storage class. One of \"STANDARD\",\\n     \"REDUCED_REDUNDANCY\" or \"GLACIER\" (string, mandatory).</li>\\n     <li>owner: an object which specifies the owner of the object (object,\\n     optional). It has the following fields:\\n     <ul>\\n       <li>id: the user identifier of the object owner (string, mandatory).</li>\\n       <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n     </ul>\\n     </li>\\n   </ul>\\n   </li>\\n   <li>commonPrefixes: an array of strings which contains the list of the common\\n   prefixes. It can be present only when the delimiter request parameter is\\n   specified (array, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the objects in a bucket using the specified credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"bucket\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The bucket to list. If the empty sequence is given, the default bucket of the specified credentials will be listed.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The listing options.</div>'}],returns:{type:\"object()\",description:\"the list of the object in the specified bucket\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OPTIONS if the specified options are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-buckets-nondeterministic\",qname:\"s3:list-buckets-nondeterministic\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all buckets owned by the account of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-buckets-0\">list-buckets#0</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists all buckets owned by the account of the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the owned buckets list\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-buckets-nondeterministic\",qname:\"s3:list-buckets-nondeterministic\",signature:\"($credentials as item()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all buckets owned by the account of the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-buckets-1\">list-buckets#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists all buckets owned by the account of the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'}],returns:{type:\"object()\",description:\"the owned buckets list\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-buckets\",qname:\"s3:list-buckets\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all buckets owned by the account of the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-buckets()\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"owner\" :\\n   {\\n     \"id\": \"dfe08489302934392afe39239fe953039d9e2af0c94\",\\n     \"displayName\": \"28msec\"\\n   },\\n   \"buckets\" :\\n   [\\n     {\\n       \"name\": \"28msec\",\\n       \"creationDate\": \"2010-11-03T17:42:45.000Z\",\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>owner: an object which specifies the owner of the bucket (object,\\n   mandatory). It has the following fields:\\n   <ul>\\n     <li>id: the user identifier of the bucket owner (string, mandatory).</li>\\n     <li>displayName: the screen name of the bucket owner (string, mandatory).</li>\\n   </ul>\\n   </li>\\n   <li>buckets: an array which contains an object for each owned bucket\\n   (array, mandatory). Each object contains the following fields:\\n   <ul>\\n     <li>name: the bucket name (string, mandatory).</li>\\n     <li>creationDate: the bucket creation date. (dateTime, mandatory).</li>\\n   </ul>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all buckets owned by the account of the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the owned buckets list\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-buckets\",qname:\"s3:list-buckets\",signature:\"($credentials as item()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all buckets owned by the account of the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n s3:list-buckets(\"credentials\")\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"owner\" :\\n   {\\n     \"id\": \"dfe08489302934392afe39239fe953039d9e2af0c94\",\\n     \"displayName\": \"28msec\"\\n   },\\n   \"buckets\" :\\n   [\\n     {\\n       \"name\": \"28msec\",\\n       \"creationDate\": \"2010-11-03T17:42:45.000Z\",\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>owner: an object which specifies the owner of the bucket (object,\\n   mandatory). It has the following fields:\\n   <ul>\\n     <li>id: the user identifier of the bucket owner (string, mandatory).</li>\\n     <li>displayName: the screen name of the bucket owner (string, mandatory).</li>\\n   </ul>\\n   </li>\\n   <li>buckets: an array which contains an object for each owned bucket\\n   (array, mandatory). Each object contains the following fields:\\n   <ul>\\n     <li>name: the bucket name (string, mandatory).</li>\\n     <li>creationDate: the bucket creation date. (dateTime, mandatory).</li>\\n   </ul>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all buckets owned by the account of the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'}],returns:{type:\"object()\",description:\"the owned buckets list\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-metadata-nondeterministic\",qname:\"s3:object-metadata-nondeterministic\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an object metadata using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-metadata-1\">object-metadata#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves an object metadata using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the metadata for.</div>'}],returns:{type:\"object()\",description:\"the specified object metadata.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-metadata-nondeterministic\",qname:\"s3:object-metadata-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an object metadata using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-metadata-2\">object-metadata#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves an object metadata using the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the metadata for.</div>'}],returns:{type:\"object()\",description:\"the specified object metadata.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-metadata\",qname:\"s3:object-metadata\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an object metadata using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the metadata of the\\n   latest version of the object will be returned. If specified, only the\\n   metadata of that particular version of the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:metadata-object($object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   },\\n   \"missing-metadata\" : 1,\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n   \"restore\": \"x-amz-restore: ongoing-request=\\\\\"false\\\\\", expiry-date=\\\\\"Wed, 07 Nov 2012 00:00:00 GMT\\\\\"\"\\n   \"serverSideEncryption\": \"AES256\",\\n   \"lastModified\": \"Mon, 15 Oct 2012 21:58:07 GMT\",\\n   \"eTag\": \"1accb31fcf202eba0c0f41fa2f09b4d7\",\\n   \"mediaType\": \"text/plain\"\\n   \"length\": \"28\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, mandatory).</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>missing-metadata: the number of metadata entries that were not returned\\n   in the metadata object. This can happen if you create metadata using an API\\n   like SOAP that supports more flexible metadata than the REST API. (integer,\\n   optional).</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n   <li>expiration: if the object expiration is configured (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html\">PUT Bucket lifecycle</a>),\\n   this field is present. It includes the expiry-date and rule-id key value\\n   pairs providing object expiration information. The value of rule-id is URL\\n   encoded.(string, optional).</li>\\n   <li>restore: if the object is an archived object (an object whose storage\\n   class is Glacier), the response includes this header if either the archive\\n   restoration is in progress (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOSTrestore.html\">POST Object restore</a>),\\n   or an archive copy is already restored.(string, optional).</li>\\n   <li>serverSideEncryption: If the object is stored by using server-side\\n   encryption, the response includes this header with a value of the encryption\\n   algorithm that was used.(string, optional).</li>\\n   <li>lastModified: the date in which the object was last modified (dateTime,\\n   optional).</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. For objects created by the PUT Object operation\\n   and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n   string representing the MD5 digest of the object data. For other objects,\\n   the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n   not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n   characters and/or will consist of less than 32 or more than 32 hexadecimal\\n   digits.(string, optional).</li>\\n   <li>mediaType: the object media-type (string, mandatory).</li>\\n   <li>length: the object content length (integer, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves an object metadata using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the metadata for.</div>'}],returns:{type:\"object()\",description:\"the specified object metadata.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-metadata\",qname:\"s3:object-metadata\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an object metadata using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the metadata of the\\n   latest version of the object will be returned. If specified, only the\\n   metadata of that particular version of the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:metadata-object(\"credentials\", $object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   },\\n   \"missing-metadata\" : 1,\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n   \"restore\": \"x-amz-restore: ongoing-request=\\\\\"false\\\\\", expiry-date=\\\\\"Wed, 07 Nov 2012 00:00:00 GMT\\\\\"\"\\n   \"serverSideEncryption\": \"AES256\",\\n   \"lastModified\": \"Mon, 15 Oct 2012 21:58:07 GMT\",\\n   \"eTag\": \"1accb31fcf202eba0c0f41fa2f09b4d7\",\\n   \"mediaType\": \"text/plain\"\\n   \"length\": \"28\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, mandatory).</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>missing-metadata: the number of metadata entries that were not returned\\n   in the metadata object. This can happen if you create metadata using an API\\n   like SOAP that supports more flexible metadata than the REST API. (integer,\\n   optional).</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n   <li>expiration: if the object expiration is configured (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html\">PUT Bucket lifecycle</a>),\\n   this field is present. It includes the expiry-date and rule-id key value\\n   pairs providing object expiration information. The value of rule-id is URL\\n   encoded.(string, optional).</li>\\n   <li>restore: if the object is an archived object (an object whose storage\\n   class is Glacier), the response includes this header if either the archive\\n   restoration is in progress (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOSTrestore.html\">POST Object restore</a>),\\n   or an archive copy is already restored.(string, optional).</li>\\n   <li>serverSideEncryption: If the object is stored by using server-side\\n   encryption, the response includes this header with a value of the encryption\\n   algorithm that was used.(string, optional).</li>\\n   <li>lastModified: the date in which the object was last modified (dateTime,\\n   optional).</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. For objects created by the PUT Object operation\\n   and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n   string representing the MD5 digest of the object data. For other objects,\\n   the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n   not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n   characters and/or will consist of less than 32 or more than 32 hexadecimal\\n   digits.(string, optional).</li>\\n   <li>mediaType: the object media-type (string, mandatory).</li>\\n   <li>length: the object content length (integer, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves an object metadata using the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the metadata for.</div>'}],returns:{type:\"object()\",description:\"the specified object metadata.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-permissions-nondeterministic\",qname:\"s3:object-permissions-nondeterministic\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the access control list (ACL) of an S3 object using the default\\n S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-permissions-1\">object-permissions#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the access control list (ACL) of an S3 object using the default\\n S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the ACL for.</div>'}],returns:{type:\"object()\",description:\"the object ACL\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-permissions-nondeterministic\",qname:\"s3:object-permissions-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the access control list (ACL) of an S3 object using the specified\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-permissions-2\">object-permissions#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the access control list (ACL) of an S3 object using the specified\\n credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the ACL for.</div>'}],returns:{type:\"object()\",description:\"the object ACL\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-permissions\",qname:\"s3:object-permissions\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the access control list (ACL) of an S3 object using the default\\n S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:object-permissions($object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"owner\" :\\n   {\\n     \"id\" : \"ea3617f5543e366a51bf51f440c221410b8001c34744e9d3a81acb79cff9d2ed\",\\n     \"displayName\" : \"28msec\"\\n   },\\n   \"acl\" :\\n   [\\n     {\\n       \"grantee\" :\\n       {\\n         \"type\" : \"CanonicalUser\",\\n         \"id\" : \"ea3617f5543e366a51bf51f440c221410b8001c34744e9d3a81acb79cff9d2ed\",\\n         \"displayName\" : \"28msec\"\\n       },\\n       \"permission\" : \"FULL_CONTROL\"\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n <li>owner: an object which specifies the owner of the object (object,\\n mandatory). It has the following fields:\\n   <ul>\\n     <li>id: the user identifier of the object owner (string, mandatory).</li>\\n     <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n   </ul>\\n </li>\\n <li>acl: an array which contains an object for each grantee with the corresponding\\n ACL settings (array, mandatory). Each object contains the following fields:\\n   <ul>\\n     <li>grantee: specifies the permissions grantee (object, mandatory). It\\n     contains the following fields:\\n       <ul>\\n         <li>type: one of \"AmazonCustomerByEmail\", \"CanonicalUser\" or \"Group\".</li>\\n         <li>emailAddress: the customer email address (string, present in all\\n         and only AmazonCustomerByEmail grantees).</li>\\n         <li>id: the user identifier (string, present in all and only CanonicalUser\\n         grantees).</li>\\n         <li>displayName: the user screen name (string, present in all and only\\n         CanonicalUser grantees).</li>\\n         <li>URI: the group URI (string, present in all and only Group grantees).</li>\\n       </ul>\\n     </li>\\n     <li>permission: the granted permissions. One of \"READ\", \"WRITE\", \"READ_ACP\",\\n     \"WRITE_ACP\", \"FULL_CONTROL\". (string, mandatory).</li>\\n   </ul>\\n </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves the access control list (ACL) of an S3 object using the default\\n S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the ACL for.</div>'}],returns:{type:\"object()\",description:\"the object ACL\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-permissions\",qname:\"s3:object-permissions\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the access control list (ACL) of an S3 object using the specified\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials does not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:object-permissions(\"credentials\", $object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"owner\" :\\n   {\\n     \"id\" : \"ea3617f5543e366a51bf51f440c221410b8001c34744e9d3a81acb79cff9d2ed\",\\n     \"displayName\" : \"28msec\"\\n   },\\n   \"acl\" :\\n   [\\n     {\\n       \"grantee\" :\\n       {\\n         \"type\" : \"CanonicalUser\",\\n         \"id\" : \"ea3617f5543e366a51bf51f440c221410b8001c34744e9d3a81acb79cff9d2ed\",\\n         \"displayName\" : \"28msec\"\\n       },\\n       \"permission\" : \"FULL_CONTROL\"\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n <li>owner: an object which specifies the owner of the object (object,\\n mandatory). It has the following fields:\\n   <ul>\\n     <li>id: the user identifier of the object owner (string, mandatory).</li>\\n     <li>displayName: the screen name of the object owner (string, mandatory).</li>\\n   </ul>\\n </li>\\n <li>acl: an array which contains an object for each grantee with the corresponding\\n ACL settings (array, mandatory). Each object contains the following fields:\\n   <ul>\\n     <li>grantee: specifies the permissions grantee (object, mandatory). It contains\\n     the following fields:\\n       <ul>\\n         <li>type: one of \"AmazonCustomerByEmail\", \"CanonicalUser\" or \"Group\".</li>\\n         <li>emailAddress: the customer email address (string, present in all\\n         and only AmazonCustomerByEmail grantees).</li>\\n         <li>id: the user identifier (string, present in all and only CanonicalUser\\n         grantees).</li>\\n         <li>displayName: the user screen name (string, present in all and only\\n         CanonicalUser grantees).</li>\\n         <li>URI: the group URI (string, present in all and only Group grantees).</li>\\n       </ul>\\n     </li>\\n     <li>permission: the granted permissions. One of \"READ\", \"WRITE\", \"READ_ACP\",\\n     \"WRITE_ACP\", \"FULL_CONTROL\". (string, mandatory).</li>\\n   </ul>\\n </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves the access control list (ACL) of an S3 object using the specified\\n credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve the ACL for.</div>'}],returns:{type:\"object()\",description:\"the object ACL\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-torrent-nondeterministic\",qname:\"s3:object-torrent-nondeterministic\",signature:\"($s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a torrent file for a given object using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-torrent-1\">object-torrent#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns a torrent file for a given object using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to retrieve the torrent file for</div>'}],returns:{type:\"base64Binary\",description:\"the base64 encoded torrent file for the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-torrent-nondeterministic\",qname:\"s3:object-torrent-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a torrent file for a given object using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#object-torrent-2\">object-torrent#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns a torrent file for a given object using the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to retrieve the torrent file for</div>'}],returns:{type:\"base64Binary\",description:\"the base64 encoded torrent file of the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"object-torrent\",qname:\"s3:object-torrent\",signature:\"($s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a torrent file for a given object using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\"\\n }\\n return s3:object-torrent($object)\\n </pre>\\n </p>\\n',summary:\"<p>  Returns a torrent file for a given object using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to retrieve the torrent file for</div>'}],returns:{type:\"base64Binary\",description:\"the base64 encoded torrent file for the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"object-torrent\",qname:\"s3:object-torrent\",signature:\"($credentials as item()?, $s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a torrent file for a given object using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\"\\n }\\n return s3:object-torrent($object)\\n </pre>\\n </p>\\n',summary:\"<p>  Returns a torrent file for a given object using the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to retrieve the torrent file for</div>'}],returns:{type:\"base64Binary\",description:\"the base64 encoded torrent file of the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-binary-nondeterministic\",qname:\"s3:read-binary-nondeterministic\",signature:\"($s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the binary content of an S3 object using the default S3 credentials.\\n The object content is forced to be interpreted as binaryand will be returned\\n as a base64Binary item.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-binary-1\">read-binary#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the binary content of an S3 object using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"base64Binary\",description:\"the object or object version binary content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-binary-nondeterministic\",qname:\"s3:read-binary-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the binary content of an S3 object using the specified S3 credentials.\\n The object content is forced to be interpreted as binaryand will be returned\\n as a base64Binary item.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-binary-2\">read-binary#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the binary content of an S3 object using the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"base64Binary\",description:\"the object or object version binary content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-binary\",qname:\"s3:read-binary\",signature:\"($s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the binary content of an S3 object using the default S3 credentials.\\n The object content is forced to be interpreted as binaryand will be returned\\n as a base64Binary item.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-binary($object)\\n </pre>\\n </p>\\n',summary:\"<p>  Retrieves the binary content of an S3 object using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"base64Binary\",description:\"the object or object version binary content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-binary\",qname:\"s3:read-binary\",signature:\"($credentials as item()?, $s3-object as item()) as base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the binary content of an S3 object using the specified S3 credentials.\\n The object content is forced to be interpreted as binaryand will be returned\\n as a base64Binary item.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-binary(\"credentials\", $object)\\n </pre>\\n </p>\\n',summary:\"<p>  Retrieves the binary content of an S3 object using the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"base64Binary\",description:\"the object or object version binary content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-object-nondeterministic\",qname:\"s3:read-object-nondeterministic\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an S3 object using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-object-1\">read-object#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves an S3 object using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"object()\",description:\"the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-object-nondeterministic\",qname:\"s3:read-object-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an S3 object using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-object-2\">read-object#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves an S3 object using the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"object()\",description:\"the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-object\",qname:\"s3:read-object\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an S3 object using the default S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-object($object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   },\\n   \"missing-metadata\" : 1,\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n   \"restore\": \"x-amz-restore: ongoing-request=\\\\\"false\\\\\", expiry-date=\\\\\"Wed, 07 Nov 2012 00:00:00 GMT\\\\\"\"\\n   \"serverSideEncryption\": \"AES256\",\\n   \"lastModified\": \"Mon, 15 Oct 2012 21:58:07 GMT\",\\n   \"eTag\": \"1accb31fcf202eba0c0f41fa2f09b4d7\",\\n   \"mediaType\": \"text/plain\"\\n   \"length\": \"28\",\\n   \"content: \"1234567890123456789012345678\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, mandatory).</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>missing-metadata: the number of metadata entries that were not returned\\n   in the metadata object. This can happen if you create metadata using an API\\n   like SOAP that supports more flexible metadata than the REST API. (integer,\\n   optional).</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n   <li>expiration: if the object expiration is configured (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html\">PUT Bucket lifecycle</a>),\\n   this field is present. It includes the expiry-date and rule-id key value\\n   pairs providing object expiration information. The value of rule-id is URL\\n   encoded.(string, optional).</li>\\n   <li>restore: if the object is an archived object (an object whose storage\\n   class is Glacier), the response includes this header if either the archive\\n   restoration is in progress (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOSTrestore.html\">POST Object restore</a>),\\n   or an archive copy is already restored.(string, optional).</li>\\n   <li>serverSideEncryption: If the object is stored by using server-side\\n   encryption, the response includes this header with a value of the encryption\\n   algorithm that was used.(string, optional).</li>\\n   <li>lastModified: the date in which the object was last modified (dateTime,\\n   optional).</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. For objects created by the PUT Object operation\\n   and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n   string representing the MD5 digest of the object data. For other objects,\\n   the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n   not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n   characters and/or will consist of less than 32 or more than 32 hexadecimal\\n   digits.(string, optional).</li>\\n   <li>mediaType: the object media-type (string, mandatory).</li>\\n   <li>length: the object content length (integer, optional).</li>\\n   <li>content: the object content. (item, optional). The type of this field\\n   is determined by the media-type returned by the server. If the media-type\\n   indicates that the body content is textual, then the content has type string,\\n   base64Binary otherwise. Specifically, the body content is considered textual\\n   if and only if the MIME-type specified in the media-type is one of:\\n   <ul>\\n     <li>\"application/json\"</li>\\n     <li>\"application/x-javascript\"</li>\\n     <li>\"application/xml\"</li>\\n     <li>\"application/xml-external-parsed-entity\"</li>\\n   </ul>\\n   or if the MIME-type starts with \"text/\" or ends with \"+xml\".</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves an S3 object using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"object()\",description:\"the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-object\",qname:\"s3:read-object\",signature:\"($credentials as item()?, $s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves an S3 object using the specified S3 credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-object($object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"metadata\":\\n   {\\n     \"author\": \"28msec\"\\n   },\\n   \"missing-metadata\" : 1,\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 21 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"Rule for testfile.txt\\\\\"\"\\n   \"restore\": \"x-amz-restore: ongoing-request=\\\\\"false\\\\\", expiry-date=\\\\\"Wed, 07 Nov 2012 00:00:00 GMT\\\\\"\"\\n   \"serverSideEncryption\": \"AES256\",\\n   \"lastModified\": \"Mon, 15 Oct 2012 21:58:07 GMT\",\\n   \"eTag\": \"1accb31fcf202eba0c0f41fa2f09b4d7\",\\n   \"mediaType\": \"text/plain\"\\n   \"length\": \"28\",\\n   \"content: \"1234567890123456789012345678\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, mandatory).</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>missing-metadata: the number of metadata entries that were not returned\\n   in the metadata object. This can happen if you create metadata using an API\\n   like SOAP that supports more flexible metadata than the REST API. (integer,\\n   optional).</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be returned. If specified, only the\\n   permissions for that particular version of the object will be returned.</li>\\n   <li>expiration: if the object expiration is configured (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketPUTlifecycle.html\">PUT Bucket lifecycle</a>),\\n   this field is present. It includes the expiry-date and rule-id key value\\n   pairs providing object expiration information. The value of rule-id is URL\\n   encoded.(string, optional).</li>\\n   <li>restore: if the object is an archived object (an object whose storage\\n   class is Glacier), the response includes this header if either the archive\\n   restoration is in progress (see\\n   <a href=\"http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPOSTrestore.html\">POST Object restore</a>),\\n   or an archive copy is already restored.(string, optional).</li>\\n   <li>serverSideEncryption: If the object is stored by using server-side\\n   encryption, the response includes this header with a value of the encryption\\n   algorithm that was used.(string, optional).</li>\\n   <li>lastModified: the date in which the object was last modified (dateTime,\\n   optional).</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. For objects created by the PUT Object operation\\n   and the POST Object operation, the eTag is a quoted, 32-digit hexadecimal\\n   string representing the MD5 digest of the object data. For other objects,\\n   the eTag may or may not be an MD5 digest of the object data. If the eTag is\\n   not an MD5 digest of the object data, it will contain one or more non-hexadecimal\\n   characters and/or will consist of less than 32 or more than 32 hexadecimal\\n   digits.(string, optional).</li>\\n   <li>mediaType: the object media-type (string, mandatory).</li>\\n   <li>length: the object content length (integer, optional).</li>\\n   <li>content: the object content. (item, optional). The type of this field\\n   is determined by the media-type returned by the server. If the media-type\\n   indicates that the body content is textual,then the content has type string,\\n   base64Binary otherwise. Specifically, the body content is considered textual\\n   if and only if the MIME-type specified in the media-type is one of:\\n   <ul>\\n     <li>\"application/json\"</li>\\n     <li>\"application/x-javascript\"</li>\\n     <li>\"application/xml\"</li>\\n     <li>\"application/xml-external-parsed-entity\"</li>\\n   </ul>\\n   or if the MIME-type starts with \"text/\" or ends with \"+xml\".</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves an S3 object using the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"object()\",description:\"the specified object.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-text-nondeterministic\",qname:\"s3:read-text-nondeterministic\",signature:\"($s3-object as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the textual content of an S3 object using the default S3 credentials.\\n The object content is forced to be interpreted as textual, with a UTF-8 charset\\n and will be returned as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-text-1\">read-text#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the textual content of an S3 object using the default S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"string\",description:\"the object or object version textual content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-text-nondeterministic\",qname:\"s3:read-text-nondeterministic\",signature:\"($credentials as item()?, $s3-object as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the textual content of an S3 object using the specified S3 credentials.\\n The object content is forced to be interpreted as textual, with a UTF-8 charset\\n and will be returned as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#read-text-2\">read-text#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the textual content of an S3 object using the specified S3 credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"string\",description:\"the object or object version textual content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"read-text\",qname:\"s3:read-text\",signature:\"($s3-object as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the textual content of an S3 object using the default S3 credentials.\\n The object content is forced to be interpreted as textual, with a UTF-8 charset\\n and will be returned as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-text(\"credentials\", $object)\\n </pre>\\n </p>\\n',summary:\"<p>  Retrieves the textual content of an S3 object using the default S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"string\",description:\"the object or object version textual content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"read-text\",qname:\"s3:read-text\",signature:\"($credentials as item()?, $s3-object as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the textual content of an S3 object using the specified S3 credentials.\\n The object content is forced to be interpreted as textual, with a UTF-8 charset\\n and will be returned as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the latest version of\\n   the object will be returned. If specified, only that particular version of\\n   the object will be returned.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\"\\n }\\n return s3:read-text(\"credentials\", $object)\\n </pre>\\n </p>\\n',summary:\"<p>  Retrieves the textual content of an S3 object using the specified S3 credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version to retrieve.</div>'}],returns:{type:\"string\",description:\"the object or object version textual content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:RESPONSE the response received from S3 cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-object-permissions\",qname:\"s3:set-object-permissions\",signature:\"($s3-object as item()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the access control list (ACL) of an S3 object using the default S3\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be set. If specified, only the\\n   permissions for that particular version of the object will be set.</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\",\\n   \"permission\": $s3:ACL-GRANT-PUBLIC-READ\\n }\\n return s3:set-object-permissions($object)\\n </pre>\\n </p>\\n',summary:\"<p>  Sets the access control list (ACL) of an S3 object using the default S3\\n credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version and ACL to set.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set-object-permissions\",qname:\"s3:set-object-permissions\",signature:\"($credentials as item()?, $s3-object as item()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the access control list (ACL) of an S3 object using the specified S3\\n credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used. If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>version: the object version (string, optional). If versioning is enabled\\n   for the specified object and no version is specified the permissions for the\\n   latest version of the object will be set. If specified, only the\\n   permissions for that particular version of the object will be set.</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n let $object :=\\n {\\n   \"key\": \"object\",\\n   \"bucket\": \"28msec\",\\n   \"version\": \"3/L4kqtJlcpXroDTDmJ+rmSpXd3dIbrHY+MTRCxf3vjVBH40Nr8X8gdRQBpUMLUo\",\\n   \"permission\": $s3:ACL-GRANT-PUBLIC-READ\\n }\\n return s3:set-object-permissions($object)\\n </pre>\\n </p>\\n',summary:\"<p>  Sets the access control list (ACL) of an S3 object using the specified S3\\n credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object or object version and ACL to set.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"write-binary\",qname:\"s3:write-binary\",signature:\"($object as item(), $binary-content as base64Binary) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes a binary object in an S3 bucket using the default S3 credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. The object media-type will be set to \"binary/octet-stream\", no metadata will\\n be set for the object, the object will be stored on standard redundancy storage,\\n and the object permission will be set to \"private\", that is, the owner gets\\n FULL_CONTROL, and no one else has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"binary/octet-stream\" is used.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"mediaType\": \"application/octet-stream\"\\n }\\n s3:write-binary($s3-object, base64Binary(\"Mjhtc2Vj\"))\\n </pre>\\n Example Result:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The meaning of the fields in the result object is the following:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes a binary object in an S3 bucket using the default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"object\",type:\"item()\",occurrence:null,description:\"\"},{name:\"binary-content\",type:\"base64Binary\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"write-binary\",qname:\"s3:write-binary\",signature:\"($credentials as item()?, $object as item(), $binary-content as base64Binary) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes a binary object in an S3 bucket using the specified S3 credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. The object media-type will be set to \"binary/octet-stream\", no metadata will\\n be set for the object, the object will be stored on standard redundancy storage,\\n and the object permission will be set to \"private\", that is, the owner gets\\n FULL_CONTROL, and no one else has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"binary/octet-stream\" is used.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"mediaType\": \"application/octet-stream\"\\n }\\n s3:write-binary(\"credentials\", $s3-object, base64Binary(\"Mjhtc2Vj\"))\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes a binary object in an S3 bucket using the specified S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"object\",type:\"item()\",occurrence:null,description:\"\"},{name:\"binary-content\",type:\"base64Binary\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"write-object\",qname:\"s3:write-object\",signature:\"($s3-object as item()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes an object in an S3 bucket using the default S3 credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The object to write and its contents are specified through the $s3-object\\n parameter, which must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>content: the object content. It must either be a string or a base64Binary\\n   atomic. (item, mandatory).</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"text/plain\" is used if the content field is of type string, \"binary/octet-stream\"\\n   if it is of type base64Binary.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"content\": serialize({ \"Hello\": \"World\" }),\\n   \"mediaType\": \"application/xml\"\\n }\\n s3:write-object($s3-object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes an object in an S3 bucket using the default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"s3-object\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to write.</div>'}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"write-object\",qname:\"s3:write-object\",signature:\"($credentials as item()?, $s3-object as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes an object in an S3 bucket using the specified credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The object to write and its contents are specified through the $s3-object\\n parameter, which must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>content: the object content. It must either be a string or a base64Binary\\n   atomic. (item, mandatory).</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"text/plain\" is used if the content field is of type string, \"binary/octet-stream\"\\n   if it is of type base64Binary.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"content\": serialize({ \"Hello\": \"World\" }),\\n   \"mediaType\": \"application/xml\"\\n }\\n s3:write-object(\"s3\", $s3-object)\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes an object in an S3 bucket using the specified credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"s3-object\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The S3 object to write.</div>'}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"write-text\",qname:\"s3:write-text\",signature:\"($object as item(), $text-content as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes a textual object in an S3 bucket using the default S3 credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a string is specified, it is interpreted as\\n key for an object in the default bucket of the default credentials. If no default\\n bucket is present in the default credentials, the <code>s3:BUCKET</code> error\\n is raised. The object media-type will be set to \"text/plain\", no metadata will\\n be set for the object, the object will be stored on standard redundancy storage,\\n and the object permission will be set to \"private\", that is, the owner gets\\n FULL_CONTROL, and no one else has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the default credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"text/plain\" is used.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"mediaType\": \"text/xml\"\\n }\\n s3:write-text($s3-object, serialize(&lt;a/&gt;))\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes a textual object in an S3 bucket using the default S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"object\",type:\"item()\",occurrence:null,description:\"\"},{name:\"text-content\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The textual object content.</div>'}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the default S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"write-text\",qname:\"s3:write-text\",signature:\"($credentials as item()?, $object as item(), $text-content as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Writes a text object in an S3 bucket using the specified S3 credentials.\\n If the object already exists it is overwritten.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The S3 object is specified through the $s3-object parameter. Either a string\\n or a JSON object can be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a string is specified, it is interpreted as\\n key for an object in the default bucket of the specified credentials. If no default\\n bucket is present in the specified credentials, the <code>s3:BUCKET</code> error\\n is raised. The object media-type will be set to \"text/plain\", no metadata will\\n be set for the object, the object will be stored on standard redundancy storage,\\n and the object permission will be set to \"private\", that is, the owner gets\\n FULL_CONTROL, and no one else has access rights.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a JSON object is used, it must have the following structure:\\n <ul>\\n   <li>key: the object key (string, mandatory).</li>\\n   <li>bucket: the bucket name (string, optional). If this field is not present\\n   and the specified credentials do not have a default bucket, the\\n   <code>s3:BUCKET</code> error is raised.</li>\\n   <li>mediaType: the media-type of the object (string, optional). If not specified,\\n   \"text/plain\" is used.</li>\\n   <li>metadata: an object specifying additional metadata. Each metadata is a\\n   name-value pair and is represented as different fields (object, optional).</li>\\n   <li>permission: the permission to set (string, optional). It must be one of\\n   \"private\", \"public-read\", \"public-read-write\", \"authenticated-read\",\\n   \"bucket-owner-read\", \"bucket-owner-full-control\". For your convenience the\\n   following variables can be used: <code>$s3:ACL-GRANT-PRIVATE</code>,\\n   <code>$s3:ACL-GRANT-PUBLIC-READ</code>, <code>$s3:ACL-GRANT-PUBLIC-READ-WRITE</code>,\\n   <code>$s3:ACL-GRANT-AUTHENTICATED-READ</code>, <code>$s3:ACL-GRANT-BUCKET-OWNER-READ</code>,\\n   <code>$s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL</code>. If this field is not\\n   specified, the \"private\" ACL is used, that is, the owner gets FULL_CONTROL,\\n   and no one else has access rights.</li>\\n   <li>reducedRedundancy: whether to use reduced-redundancy or not (bool,\\n   optional). Default is false.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n variable $s3-object :=\\n {\\n   \"key\": \"test.xml\",\\n   \"bucket\": \"28msec\",\\n   \"permission\": $const:ACL-GRANT-PUBLIC-READ,\\n   \"metadata\": { \"author\": \"28msec\" },\\n   \"mediaType\": \"text/xml\"\\n }\\n s3:write-text(\"credentials\", $s3-object, serialize(&lt;a/&gt;))\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example return object:\\n <pre>\\n {\\n   \"expiration\": \"expiry-date=\\\\\"Fri, 23 Dec 2012 00:00:00 GMT\\\\\", rule-id=\\\\\"1\\\\\"\",\\n   \"version\": \"3GL4kqtJlcpXroDTDm3vjVBH40Nr8X8g\",\\n   \"eTag\": \"\\\\\"1b2cf535f27731c974343645a3985328\\\\\"\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields in the returned object have the following meanings:\\n <ul>\\n   <li>expiration: if the object expiration is configured, the response\\n   includes this header. It includes the expiry-date and rule-id key-value\\n   pairs providing object expiration information. The value of the rule-id is\\n   URL encoded. (string, optional)</li>\\n   <li>version: the version of the object. When you enable versioning,\\n   Amazon S3 generates a random number for objects added to a bucket. The value\\n   is UTF-8 encoded and URL ready. When you PUT an object in a bucket where\\n   versioning has been suspended, the version ID is always null. (string, optional)</li>\\n   <li>eTag: the entity tag is a hash of the object. The eTag only reflects\\n   changes to the contents of an object, not its metadata. The eTag is determined\\n   when an object is created. The eTag returned by this method is a quoted,\\n   32-digit hexadecimal string representing the MD5 digest of the object data.\\n   For other objects, the eTag may or may not be an MD5 digest of the object data.\\n   (string, optional).</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Writes a text object in an S3 bucket using the specified S3 credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials to use.</div>'},{name:\"object\",type:\"item()\",occurrence:null,description:\"\"},{name:\"text-content\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The textual object content.</div>'}],returns:{type:\"object()\",description:\"the S3 operation result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:CREDENTIALS if the specified S3 credentials cannot be found or are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:OBJECT if the object specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:BUCKET if no bucket has been specified and no default bucket is present in the used credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:HTTP an HTTP error occurred sending the request to S3</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">s3:REQUEST S3 refused to execute the request</xqdoc:error>']}],variables:[{name:\"s3:ACL-GRANT-PRIVATE\",type:\"item()*\",description:\" The private canned ACL. It is applicable to buckets and objects.\\n Owner gets FULL_CONTROL. No one else has access rights.\\n\"},{name:\"s3:ACL-GRANT-PUBLIC-READ\",type:\"item()*\",description:\" The public-read canned ACL. Applicable to buckets and objects.\\n Owner gets FULL_CONTROL. The AllUsers group gets READ access.\\n\"},{name:\"s3:ACL-GRANT-PUBLIC-READ-WRITE\",type:\"item()*\",description:\" The public-read-write canned ACL. Applicable to buckets and objects.\\n Owner gets FULL_CONTROL. The AllUsers group gets READ and WRITE access.\\n Granting this on a bucket is generally not recommended.\\n\"},{name:\"s3:ACL-GRANT-AUTHENTICATED-READ\",type:\"item()*\",description:\" The autenticated-read canned ACL. Applicable to buckets and objects.\\n Owner gets FULL_CONTROL. The AuthenticatedUsers group gets READ access.\\n\"},{name:\"s3:ACL-GRANT-BUCKET-OWNER-READ\",type:\"item()*\",description:\" The grant-bucket-owner-read canned ACL. Applicable to objects.\\n Object owner gets FULL_CONTROL. Bucket owner gets READ access.\\n If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.\\n\"},{name:\"s3:ACL-GRANT-BUCKET-OWNER-FULL-CONTROL\",type:\"item()*\",description:\" The grant-bucket-owner-full-control canned ACL. Applicable to objects.\\n Both the object owner and the bucket owner get FULL_CONTROL over the object.\\n If you specify this canned ACL when creating a bucket, Amazon S3 ignores it.\\n\"}]},\"http://api.28.io/authorization\":{ns:\"http://api.28.io/authorization\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/authorization\",prefix:\"authorization\"},{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/modules/hmac\",prefix:\"hmac\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-client\"},{uri:\"http://www.28msec.com/modules/project\",prefix:\"project\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"res\"}],functions:[{isDocumented:!1,arity:0,name:\"authorized\",qname:\"authorization:authorized\",signature:\"() as xs:boolean\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"html-do-login\",qname:\"authorization:html-do-login\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"html-show-login\",qname:\"authorization:html-show-login\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/store/static/integrity-constraints/dml\":{ns:\"http://zorba.io/modules/store/static/integrity-constraints/dml\",description:' This module defines a function to check if an integrity constraint is\\n satisfied.\\n The integrity constraint needs to be declared in the prolog of a module.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data Definition Facility</a>.\\n All the integrity constraints managed by this module have to be pre-declared\\n in the prolog of a module.\\n Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/store/static/integrity-constraints/dml\",prefix:\"icdml\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"check-integrity-constraint\",qname:\"icdml:check-integrity-constraint\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Checks if the specified constraints are valid in the database.\\n\",summary:\"<p> Checks if the specified constraints are valid in the database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the integrity constraint to check.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the constraints are valid; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0031 if the integrity constraint is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0032 if the integrity constraint is not available.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/excel/statistical\":{ns:\"http://zorba.io/modules/excel/statistical\",description:\" This is a library module offering a part of the set of statistical functions\\n defined by Microsoft Excel 2003.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528311033.aspx\" target=\"_blank\">Excel 2003 Documentation: Statistical Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/statistical\",prefix:\"excel\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"avedev\",qname:\"excel:avedev\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Returns the average of the absolute deviations of data points from their mean.\\n The formula is sum(abs(x - average_x))/n, where n is the count of x in the sequence.\\n\",summary:\"<p> Returns the average of the absolute deviations of data points from their mean.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. Sequence can be of any length from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The formula result\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"average\",qname:\"excel:average\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the average (arithmetic mean) of the arguments.\\n Arguments can be empty values, otherwise must be castable to numeric.\\n If sequence is empty then zero is returned.\\n The sequence can be of any length.\\n\",summary:\"<p> Returns the average (arithmetic mean) of the arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of numbers or empty values.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The sum of all numbers divided by the number of non-empty values.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"averagea\",qname:\"excel:averagea\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Calculates the average (arithmetic mean) of the values in the sequence of arguments.\\n Arguments can be of any type.\\n The numbers are added, and the sum is divided by the size of entire sequence.\\n\",summary:\"<p> Calculates the average (arithmetic mean) of the values in the sequence of arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values of any type. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The result\"},errors:[]},{isDocumented:!0,arity:1,name:\"count\",qname:\"excel:count\",signature:\"($numbers as xs:anyAtomicType*) as xs:integer\",description:\" Counts the number of cells that contain numbers or values castable to numeric.\\n\",summary:\"<p> Counts the number of cells that contain numbers or values castable to numeric.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of values, of any length.</div>'}],returns:{type:\"xs:integer\",description:\"The count of numbers.\"},errors:[]},{isDocumented:!0,arity:1,name:\"counta\",qname:\"excel:counta\",signature:\"($numbers as xs:anyAtomicType*) as xs:integer\",description:' Counts the number of values that are not empty.\\n Empty values are the one with string value \"\".\\n',summary:\"<p> Counts the number of values that are not empty.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values of any type, any length</div>'}],returns:{type:\"xs:integer\",description:\"The count of non-empty values\"},errors:[]},{isDocumented:!0,arity:1,name:\"countblank\",qname:\"excel:countblank\",signature:\"($cells as xs:anyAtomicType*) as xs:integer\",description:' Counts the empty values in a sequence.\\n The empty values are the ones with string value \"\".\\n The value 0 is not counted.\\n',summary:\"<p> Counts the empty values in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"cells\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, of any length</div>'}],returns:{type:\"xs:integer\",description:\"The count\"},errors:[]},{isDocumented:!0,arity:2,name:\"large\",qname:\"excel:large\",signature:\"($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType\",description:\" Returns the k-th largest value in a data set.\\n If n is the number of data points in a range,\\n   then LARGE(array,1) returns the largest value,\\n   and LARGE(array,n) returns the smallest value.\\n\",summary:\"<p> Returns the k-th largest value in a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'},{name:\"k\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position of largest value, with value from 1 to count of values</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The k-th largest value as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sequence is empty</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if k is not a value between 1 and the sequence size</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"max\",qname:\"excel:max\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the largest number in a sequence.\\n\",summary:\"<p> Returns the largest number in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The max\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"maxa\",qname:\"excel:maxa\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the largest value in a list of arguments.\\n In this implementation there is no difference between MAX and MAXA.\\n\",summary:\"<p> Returns the largest value in a list of arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The max\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"median\",qname:\"excel:median\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the median of the given numbers.\\n The median is the number in the middle of a set of numbers.\\n Half the numbers have values that are greater than the median,\\n and half the numbers have values that are less than the median.\\n\",summary:\"<p> Returns the median of the given numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"for odd count of numbers return the number in the middle of the sorted sequence. For even count of numbers return the average of the two numbers in the middle.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"min\",qname:\"excel:min\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the smallest number in a sequence.\\n\",summary:\"<p> Returns the smallest number in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The min\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"mina\",qname:\"excel:mina\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the smallest value in a list of arguments.\\n In this implementation there is no difference between MAX and MAXA.\\n\",summary:\"<p> Returns the smallest value in a list of arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The min\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"mode\",qname:\"excel:mode\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Returns the most frequently occurring, or repetitive, value in a sequence.\\n Arguments must be castable to numeric.\\n\",summary:\"<p> Returns the most frequently occurring, or repetitive, value in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The most occuring number\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">fn:QName(\"http://zorba.io/modules/excel/errors\", \"excel-err:NA\") if there are no duplicate numbers</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"percentile\",qname:\"excel:percentile\",signature:\"($numbers as xs:anyAtomicType*, $k_at as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns the k-th percentile of values in a sequence.\\n If k is not a multiple of 1/(n - 1),\\n   PERCENTILE interpolates to determine the value at the k-th percentile.\\n The function is computed by (max-min)*k + min\\n\",summary:\"<p> Returns the k-th percentile of values in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers, of any length</div>'},{name:\"k_at\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the percentile, with value between 0 .. 1 inclusive</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The computed percentile\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if percentile is not between 0 .. 1</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"percentrank\",qname:\"excel:percentrank\",signature:\"($numbers as xs:anyAtomicType*, $x as xs:anyAtomicType) as xs:decimal\",description:' Returns the rank of a value in a data set as a percentage of the data set.\\n If x does not match one of the values in array,\\n   PERCENTRANK interpolates to return the correct percentage rank. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is uses: (RANK - 1) / (size - 1) .\\n',summary:\"<p> Returns the rank of a value in a data set as a percentage of the data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"x\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value for which you want to know the rank</div>'}],returns:{type:\"xs:decimal\",description:\"The percentage of rank.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sequence is zero length</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"prob\",qname:\"excel:prob\",signature:\"($x_range as xs:anyAtomicType+, $prob_range as xs:anyAtomicType+, $range_lower_limit as xs:anyAtomicType) as xs:anyAtomicType\",description:\" This is the same as above, only that upper_limit is not specified.\\n The probability is computed only for range_lower_limit.\\n\",summary:\"<p> This is the same as above, only that upper_limit is not specified.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x_range\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.</div>'},{name:\"prob_range\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is a set of probabilities associated with values in x_range.</div>'},{name:\"range_lower_limit\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value for which you want a probability.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The probability of the range_lower_limit value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if any probability is not between 0 and 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sum of probabilities is not equal to 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if any parameter is not castable to numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if x_range and prob_range do not have the same number of values</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"prob\",qname:\"excel:prob\",signature:\"($x_range as xs:anyAtomicType+, $prob_range as xs:anyAtomicType+, $range_lower_limit as xs:anyAtomicType, $upper_limit as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns the probability that values in a range are between two limits.\\n\",summary:\"<p> Returns the probability that values in a range are between two limits.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x_range\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the range of numeric values of x with which there are associated probabilities. This does not need to be ordered.</div>'},{name:\"prob_range\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is a set of probabilities associated with values in x_range.</div>'},{name:\"range_lower_limit\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the lower bound on the value for which you want a probability.</div>'},{name:\"upper_limit\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the upper bound on the value for which you want a probability.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The probability of the entire range\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if any probability is not between 0 and 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sum of probabilities is not equal to 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if any parameter is not castable to numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if x_range and prob_range do not have the same number of values</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"quartile\",qname:\"excel:quartile\",signature:\"($numbers as xs:anyAtomicType*, $quart as xs:integer) as xs:anyAtomicType\",description:\" Returns the quartile of a data set.\\n\",summary:\"<p> Returns the quartile of a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> sequence of numbers or values castable to numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"quart\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>one of the values 0, 1, 2, 3, 4 with meaning: <dt>0</dt> <dd> compute minimum value</dd> <dt>1</dt> <dd> compute first quartile (25th percentile)</dd> <dt>2</dt> <dd> compute median value (50th percentile)</dd> <dt>3</dt> <dd> compute third quartile (75th percentile)</dd> <dt>4</dt> <dd> compute maximum value</dd></dl></div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the computed quartile, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sequence is zero length</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if $quart is not one of the values 0, 1, 2, 3, 4</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"rank\",qname:\"excel:rank\",signature:\"($x as xs:anyAtomicType, $numbers as xs:anyAtomicType*) as xs:decimal\",description:\" This RANK function is same as the above, only that $order_ascending is set by default to false.\\n\",summary:\"<p> This RANK function is same as the above, only that $order_ascending is set by default to false.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number whose rank you want to find.</div>'},{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numbers. The sequence can be of any length.</div>'}],returns:{type:\"xs:decimal\",description:\"The rank of $x.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"rank\",qname:\"excel:rank\",signature:\"($x as xs:anyAtomicType, $numbers as xs:anyAtomicType*, $order_ascending as xs:boolean) as xs:decimal\",description:\" Returns the rank of a number in a list of numbers.\\n The rank of a number is its size relative to other values in a list.\\n (If you were to sort the list, the rank of the number would be its position.)\\n RANK gives duplicate numbers the same rank.\\n\",summary:\"<p> Returns the rank of a number in a list of numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number whose rank you want to find.</div>'},{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of numbers or values castable to numbers. The sequence can be of any length.</div>'},{name:\"order_ascending\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>A boolean having the meaning: <dt>false</dt><dd>then rank the number as if the sequence was sorted in descending order.</dd> <dt>true</dt> <dd>then rank the number as if the sequence was sorted in ascending order.</dd></dl></div>'}],returns:{type:\"xs:decimal\",description:\"The rank of $x.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"slope\",qname:\"excel:slope\",signature:\"($known_y as xs:anyAtomicType+, $known_x as xs:anyAtomicType+) as xs:anyAtomicType\",description:' Returns the slope of the linear regression line through data points in known_y\\'s and known_x\\'s.\\n The slope is the vertical distance divided by the horizontal distance between\\n   any two points on the line, which is the rate of change along the regression line.\\n It computes the formula:<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n sum((x - average_x)(y - average_y)) / sum((x - average_x)^2)  <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n where average_x and average_y are computed with AVERAGE function.\\n',summary:\"<p> Returns the slope of the linear regression line through data points in known_y's and known_x's.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"known_y\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of y numbers. The sequence can be of any length, from 1 up.</div>'},{name:\"known_x\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of x numbers. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The slope value, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if any parameter cannot be casted to numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">fn:QName(\"http://zorba.io/modules/excel/errors\", \"excel-err:NA\") if there are different numbers of x\\'s and y\\'s</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">fn:QName(\"http://zorba.io/modules/excel/errors\", \"excel-err:NA\") if any sequence is empty</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Div0 if all x\\'s are equal</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"small\",qname:\"excel:small\",signature:\"($numbers as xs:anyAtomicType*, $k as xs:integer) as xs:anyAtomicType\",description:\" This function computes the k-th smallest value in a data set.\\n Use this function to return values with a particular relative standing in a data set.\\n If n is the number of data points in array, SMALL(array,1) equals the smallest value,\\n   and SMALL(array,n) equals the largest value.\\n\",summary:\"<p> This function computes the k-th smallest value in a data set.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'},{name:\"k\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The position (from the smallest) in the sequence of data to return. Must have value between 1 and size of sequence.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The k-th smallest value of $numbers.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the sequence is zero length.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if $k is not a value between 1 and the size of sequence.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"standardize\",qname:\"excel:standardize\",signature:\"($x as xs:anyAtomicType, $mean as xs:anyAtomicType, $standard_dev as xs:anyAtomicType) as xs:double\",description:' Returns a normalized value from a distribution characterized by mean and standard_dev.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is (x - mean) / standard_dev .\\n',summary:\"<p> Returns a normalized value from a distribution characterized by mean and standard_dev.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the value you want to normalize</div>'},{name:\"mean\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the arithmetic mean of the distribution.</div>'},{name:\"standard_dev\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the standard deviation of the distribution.</div>'}],returns:{type:\"xs:double\",description:\"The normalized x, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if any parameter cannot be casted to numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if standard_dev is a value smaller than zero or equal</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"var\",qname:\"excel:var\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:' Estimates variance based on a sample.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / (n - 1).<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n average_x is computed with AVERAGE function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n n is the count of numbers from the sequence, excluding empty values.\\n',summary:\"<p> Estimates variance based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The variance, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"vara\",qname:\"excel:vara\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:' Estimates variance based on a sample.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / (n - 1).<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n average_x is computed with AVERAGE function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n n is the size of sequence, including empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Estimates variance based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The variance, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"varp\",qname:\"excel:varp\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:' Calculates variance based on the entire population.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / n.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n average_x is computed with AVERAGE function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n n is the count of numbers from the sequence, excluding empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Calculates variance based on the entire population.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The variance, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"varpa\",qname:\"excel:varpa\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:' Calculates variance based on the entire population.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The formula is sum(x - average_x)^2 / n.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n average_x is computed with AVERAGE function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n n is the size of sequence, including empty values.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Calculates variance based on the entire population.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The variance, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/languages/xslt\":{ns:\"http://www.zorba-xquery.com/modules/languages/xslt\",description:' This module provides XSLT 1.0 transformation functionality.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For details on XSLT see\\n <a href=\"http://www.w3.org/TR/xslt\">XSLT 1.0 specification</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module implements the invoking of an XSLT transformation from XQuery\\n described in <a href=\"http://lists.w3.org/Archives/Member/w3c-xsl-wg/2008Apr/0052.html\">\\n    Michael Kay\\'s proposal</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre class=\"ace-static\" ace-mode=\"xquery\">import module namespace\\n        xslt = \"http://www.zorba-xquery.com/modules/languages/xslt\";\\n let $source :=\\n     &lt;catalog&gt;\\n         &lt;cd&gt;\\n           &lt;title&gt;Empire Burlesque&lt;/title&gt;\\n           &lt;artist&gt;Bob Dylan&lt;/artist&gt;\\n           &lt;country&gt;USA&lt;/country&gt;\\n           &lt;company&gt;Columbia&lt;/company&gt;\\n           &lt;price&gt;10.90&lt;/price&gt;\\n           &lt;year&gt;1985&lt;/year&gt;\\n         &lt;/cd&gt;\\n         &lt;cd&gt;\\n           &lt;title&gt;Hide your heart&lt;/title&gt;\\n           &lt;artist&gt;Bonnie Tyler&lt;/artist&gt;\\n           &lt;country&gt;UK&lt;/country&gt;\\n           &lt;company&gt;CBS Records&lt;/company&gt;\\n           &lt;price&gt;9.90&lt;/price&gt;\\n           &lt;year&gt;1988&lt;/year&gt;\\n         &lt;/cd&gt;\\n     &lt;/catalog&gt;\\n let $stylesheet :=\\n   &lt;xsl:stylesheet version=\"1.0\"\\n       xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"&gt;\\n     &lt;xsl:template match=\"/\"&gt;\\n       &lt;html&gt;\\n       &lt;body&gt;\\n       &lt;h2&gt;Music Collection&amp;lt;/h2&gt;\\n         &lt;table border=\"1\"&gt;\\n           &lt;tr bgcolor=\"lightblue\"&gt;\\n             &lt;th&gt;Title&amp;lt;/th&gt;\\n             &lt;th&gt;Artist&amp;lt;/th&gt;\\n           &lt;/tr&gt;\\n           &lt;xsl:for-each select=\"catalog/cd\"&gt;\\n            &lt;tr&gt;\\n              &lt;td&gt;&amp;lt;xsl:value-of select=\"title\"/&gt;&lt;/td&gt;\\n              &lt;td&gt;&amp;lt;xsl:value-of select=\"artist\"/&gt;&lt;/td&gt;\\n           &lt;/tr&gt;\\n           &lt;/xsl:for-each&gt;\\n         &lt;/table&gt;\\n       &lt;/body&gt;\\n       &lt;/html&gt;\\n     &lt;/xsl:template&gt;\\n   &lt;/xsl:stylesheet&gt;\\n return\\n   xslt:transform( $source, $stylesheet)</pre></p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.zorba-xquery.com/modules/languages/xslt\",prefix:\"xslt\"}],functions:[{isDocumented:!0,arity:2,name:\"transform\",qname:\"xslt:transform\",signature:\"($source as node(), $stylesheet as node()) as node() external\",description:'<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Invokes an XSLT transformation.</p>\\n',summary:\"<p>Invokes an XSLT transformation.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"source\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the input document to the transformation</div>'},{name:\"stylesheet\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the XSLT stylesheet module</div>'}],returns:{type:\"node()\",description:\"the result tree produced by the transformation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xslt:XSLT001 if $stylesheet is not a valid XSLT stylesheet</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xslt:XSLT002 if result can not be imported</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/data-cleaning/phonetic-string-similarity\":{ns:\"http://zorba.io/modules/data-cleaning/phonetic-string-similarity\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides phonetic string similarity functions, comparing strings with basis on how they sound.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">These metrics are particularly effective in matching names, since names are often spelled in different\\n ways that sound the same.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/data-cleaning/phonetic-string-similarity\",prefix:\"simp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"metaphone-key\",qname:\"simp:metaphone-key\",signature:\"($s1 as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Metaphone key for a given string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Metaphone algorithm produces variable length keys as its output, as opposed to Soundex\\'s fixed-length keys.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">metaphone-key(\"ALEKSANDER\")</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">\"ALKSNTR\"</pre></p>\\n',summary:\"<p>  Returns the Metaphone key for a given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string.</div>'}],returns:{type:\"xs:string\",description:\"The Metaphone key for the given input string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"metaphone\",qname:\"simp:metaphone\",signature:\"($s1 as xs:string, $s2 as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Checks if two strings have the same Metaphone key.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">metaphone(\"ALEKSANDER\", \"ALEXANDRE\")</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">true</pre></p>\\n',summary:\"<p>  Checks if two strings have the same Metaphone key.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'}],returns:{type:\"xs:boolean\",description:\"Returns true if both strings have the same Metaphone key and false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"soundex-key\",qname:\"simp:soundex-key\",signature:\"($s1 as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Soundex key for a given string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">soundex-key(\"Robert\")</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">\"R163\"</pre></p>\\n',summary:\"<p>  Returns the Soundex key for a given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string.</div>'}],returns:{type:\"xs:string\",description:\"The Soundex key for the given input string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"soundex\",qname:\"simp:soundex\",signature:\"($s1 as xs:string, $s2 as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Checks if two strings have the same Soundex key.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">soundex( \"Robert\" , \"Rupert\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">true</pre></p>\\n',summary:\"<p>  Checks if two strings have the same Soundex key.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'}],returns:{type:\"xs:boolean\",description:\"Returns true if both strings have the same Soundex key and false otherwise.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/collections\":{ns:\"http://www.28msec.com/modules/collections\",description:\" This module provides functions to work with collections. For example,\\n it contains functions to retrieve the content of a collection or the\\n names of all collections.\\n <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">The module is always imported so you don't need to import it explicitly.\\n Also, you don't need to fully qualify a function to invoke it.</p>\\n\",sees:[],authors:[],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:2,name:\"apply-insert\",qname:\"db:apply-insert\",signature:\"($name as string, $content as item()*) as item()* external\",description:\" This function does the same as the insert function and it immediately applies\\n the resulting pending updates and returns the items that have been inserted.\\n Note that each item in the content sequence is copied before insertion. This\\n function provides an efficient way to retrieve the actual copies that have\\n been inserted.\\n\",summary:\"<p> This function does the same as the insert function and it immediately applies\\n the resulting pending updates and returns the items that have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to which the items should be added.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequences of items whose copies should be added to the collection.</div>'}],returns:{type:\"item()*\",description:\"The result of the function is the sequence of items that have been inserted into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <tt>$name</tt> does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if any of the items in the $content do not match the expected type (as specified in the collection declaration) or are not XML documents, XML elements, JSON objects, or JSON arrays.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"available-collections\",qname:\"db:available-collections\",signature:\"() as string* external\",description:\" Return the names of all existing collections.\\n\",summary:\"<p> Return the names of all existing collections.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"string*\",description:\"The names of all existing collections.\"},errors:[]},{isDocumented:!0,arity:1,name:\"collection-name\",qname:\"db:collection-name\",signature:\"($o as item()) as string external\",description:\" The collection-name function returns the name of the containing collection\\n of the given item.\\n\",summary:\"<p> The collection-name function returns the name of the containing collection\\n of the given item.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"o\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item for which to get the name of the collection.</div>'}],returns:{type:\"string\",description:\"The name of the containing collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if the given item does not belong to a collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"collection\",qname:\"db:collection\",signature:\"($name as string) as item()* external\",description:' The collection function returns the sequence of items that belong\\n to the collection identified by the given name.\\n Please note that the order of the items returned is not deterministic,\\n i.e. it might change between invocations. You can use\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">db:collection($name, 0)</tt> to get a deterministic order.\\n',summary:\"<p> The collection function returns the sequence of items that belong\\n to the collection identified by the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'}],returns:{type:\"item()*\",description:\"The content of the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by $name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"collection\",qname:\"db:collection\",signature:\"($name as string, $skip as integer) as item()* external\",description:' The collection function returns the sequence of items that belong to\\n the collection identified\\n by the given name. The skip parameter allows to (efficiently) skip\\n a given number of items.\\n Note that the collections are generally unordered. However, there\\n is an implicit deterministic ordering (i.e. sorting by the _id field\\n in MongoDB) that is used by this function. This ordering is not present\\n for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">db:collection#1</tt> function. In order to return items with\\n a stable ordering, db:collection($name, 0) can be used.\\n',summary:\"<p> The collection function returns the sequence of items that belong to\\n the collection identified\\n by the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'},{name:\"skip\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of items to skip starting from the beginning.</div>'}],returns:{type:\"item()*\",description:'The content of the collection starting at the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$skip</tt>+1 item.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by $name does not exist</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"collection\",qname:\"db:collection\",signature:\"($name as string, $start as string, $skip as integer) as item()* external\",description:' The collection function returns the sequence of items that belong to\\n the collection identified\\n by the given name. The start parameter is a reference and determines\\n the first item to return. The skip parameter allows to (efficiently) skip\\n a given number of items starting at the item referenced by <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$start</tt>.\\n The start parameter is useful for efficiently implementing pagination.\\n Note that the collections are generally unordered. However, there\\n is an implicit deterministic ordering (i.e. sorting by the _id field\\n in MongoDB) that is used by this function. This ordering is not present\\n for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">db:collection#1</tt> function. In order to return items with\\n a stable ordering, db:collection($name, $start, 0) can be used.\\n Example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n import module namespace ref = \"http://zorba.io/modules/reference\";\\n let $ref := ref:reference(db:collection(\"test\", 1)[1])\\n return\\n   db:collection(\"test\", $ref, 1)\\n </pre>\\n',summary:\"<p> The collection function returns the sequence of items that belong to\\n the collection identified\\n by the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'},{name:\"start\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The reference to the first item to return.</div>'},{name:\"skip\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of collection items to skip.</div>'}],returns:{type:\"item()*\",description:'The content of the collection starting at the item referenced by <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$start</tt> and skipping <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$skip</tt> items.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <tt>$name</tt> does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 If the given reference $start is not a valid reference.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0066 if the given reference $start does not reference an item of this collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"create\",qname:\"db:create\",signature:\"($name as string) external\",description:' The create function is an updating function that creates\\n a new collection with the given name.\\n It is not possible to create collections that start with\\n \"system.\" or \"_28\" (zerr:ZDDY1000).\\n Collections are identified by a name (string). Names are not allowed to\\n contain the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$</tt> sign or exceed the length of 70 characters.\\n This is consistent with the restrictions for names of collections in MongoDB.\\n',summary:\"<p> The create function is an updating function that creates\\n a new collection with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to create.</div>'}],returns:{type:null,description:\"The result of the function is an empty XDM instance and a pending update list which, once applied, creates a collection with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0002 if a collection with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"create\",qname:\"db:create\",signature:\"($name as string, $content as item()*) external\",description:' The create function is an updating function which creates\\n a new collection with the given name. Moreover, it adds copies\\n of the sequence <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$content</tt> to the new collection.\\n It is not possible to create collections that start with\\n \"system.\" or \"_28\" (zerr:ZDDY1000).\\n Collections are identified by a name (string). Names are not allowed to\\n contain the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$</tt> sign or exceed the length of 70 characters.\\n This is consistent with the restrictions for names of collections in MongoDB.\\n',summary:\"<p> The create function is an updating function which creates\\n a new collection with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string of the collection to create.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequences of items that should be added to the new collection.</div>'}],returns:{type:null,description:\"The result of the function is an empty XDM instance and a pending update list which, once applied, creates a collection with the given name and inserts the given items into it.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0002 if a collection with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if any of the items in the $content do not match the expected type (as specified in the collection declaration) or are not XML documents, XML elements, JSON objects, or JSON arrays.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete\",qname:\"db:delete\",signature:\"($target as item()*) external\",description:\" The delete function is an updating function that deletes zero or more items\\n (JSON objects, JSON arrays, or XML nodes) from a collection.\\n Please note that the all of the items belong to the same collection\\n (zerr:ZDDY0011).\\n\",summary:\"<p> The delete function is an updating function that deletes zero or more items\\n (JSON objects, JSON arrays, or XML nodes) from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"target\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items that should be deleted from the containing collection.</div>'}],returns:{type:null,description:\"The result of this function is an empty XDM instance and a pending update list which, once applied, deletes the items from the collections.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <tt>$name</tt> does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if any item in the <tt>$target</tt> sequence is not a member of a collection or not all items belong to the same collection.</xqdoc:error>']},{isDocumented:!1,arity:1,name:\"drop\",qname:\"db:drop\",signature:\"($name as string) external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"edit\",qname:\"db:edit\",signature:\"($target as item(), $content as item()) external\",description:\" The edit function is an updating function that edits the first supplied\\n item so as to make it look exactly like a copy of the second supplied item,\\n while retaining its original identity.\\n\",summary:\"<p> The edit function is an updating function that edits the first supplied\\n item so as to make it look exactly like a copy of the second supplied item,\\n while retaining its original identity.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The target item, that must be edited.</div>'},{name:\"content\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content item, that serves as an edit goal.</div>'}],returns:{type:null,description:\"The result of the function is an empty XDM instance and a pending update list which, once applied, performs the edit.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0017 if the $target item is not a member of a collection.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0040 if the target cannot be updated to match the content (for example because the target is a node and the content is an object).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if $content does not match the expected type (as specified in the collection declaration) according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!1,arity:1,name:\"index-keys\",qname:\"db:index-keys\",signature:\"($index-name as string) as array()* external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index-name\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:\"array()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"insert\",qname:\"db:insert\",signature:\"($name as string, $content as item()*) external\",description:\" The insert function is an updating function that inserts copies of the given\\n items into a collection.\\n\",summary:\"<p> The insert function is an updating function that inserts copies of the given\\n items into a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to which the items should be added.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequences of items whose copies should be added.</div>'}],returns:{type:null,description:\"The result of the function is an empty XDM instance and a pending update list which, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <tt>$name</tt> does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if any of the items in the $content do not match the expected type (as specified in the collection declaration) or are not XML documents, XML elements, JSON objects, or JSON arrays.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-available-collection\",qname:\"db:is-available-collection\",signature:\"($name as string) as boolean external\",description:\" Determine if the collection with the given name exists.\\n\",summary:\"<p> Determine if the collection with the given name exists.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string of the collection in question.</div>'}],returns:{type:\"boolean\",description:\"true if collection with the given name exists, false otherwise.\"},errors:[]},{isDocumented:!1,arity:2,name:\"lookup\",qname:\"db:lookup\",signature:\"($index-name as string, $key as item()) as item()* external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index-name\",type:\"string\",occurrence:null,description:\"\"},{name:\"key\",type:\"item()\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"lookup\",qname:\"db:lookup\",signature:\"($index-name as string, $keys as item(), $skip as integer) as item()* external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index-name\",type:\"string\",occurrence:null,description:\"\"},{name:\"keys\",type:\"item()\",occurrence:null,description:\"\"},{name:\"skip\",type:\"integer\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"refresh\",qname:\"db:refresh\",signature:\"($index-name as string) external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"index-name\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"truncate\",qname:\"db:truncate\",signature:\"($name as string) external\",description:\" The truncate function is an updating function that deletes the\\n entire content of a given collection.\\n Please note that applying this function can not be undone in case\\n an error happens during the application of the containing PUL.\\n\",summary:\"<p> The truncate function is an updating function that deletes the\\n entire content of a given collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection whose content to delete.</div>'}],returns:{type:null,description:\"The result of this function is an empty XDM instance and a pending update list which, once applied, deletes the nodes.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <tt>$name</tt> does not exist.</xqdoc:error>']}],variables:[]},\"http://expath.org/ns/http-client\":{ns:\"http://expath.org/ns/http-client\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module provides an implementation of the\\n <a href=\"http://expath.org/modules/http-client/\">EXPath Http Client</a>.\\n It provides functions for making HTTP requests and is a superset of the\\n module specified by EXPath.\\n Specifically, it implements the <code>http:send-request()</code> functions\\n as specified by EXPath. Moreover, it adds an additional function\\n <code>http:read()</code> (with several arities for the sake of ease).\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n In general, both functions take a description of the HTTP request to make\\n as parameter, execute the request, and return a representation of the HTTP\\n response. For instance, in the following code snippet, we fetch the Zorba\\n home page:\\n </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">import module namespace http = \"http://expath.org/ns/http-client\";\\n http:send-request(\\n  &lt;http:request href=\"http://zorba.io\" method=\"get\" /&gt;\\n )\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The <code>http:send-request()</code> functions are declared as sequential.\\n Sequential functions are allowed to have side effects. For example, most probably,\\n an HTTP POST request is a request that has side effects because it adds/changes\\n a remote resource. Sequential functions are specified in the\\n <a href=\"http://zorba.io/documentation/2.9/zorba/scripting_tutorial.html\">XQuery Scripting Extension</a>.\\n In contrast, the http:read() functions are not declared as sequential -\\n they are declared as being non deterministic though, which\\n means that several calls may return different results.\\n HTTP requests performed using these functions are <b>not</b> allowed to have\\n side effects.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The response is returned as a sequence of one or more items. The first\\n one is an <code>http:response</code> element with quite the same\\n structure as an http:request, but without the content itself.\\n The content is returned as the second item (or several items in case of\\n a multipart response) as a string, a document node, or a binary item.\\n This depends on the content-type returned.\\n Specifically, the rules are as follows:\\n <ul>\\n  <li>A document node is returned if the media type has a MIME type of\\n     text/xml, application/xml, text/xml-external-parsed-entity, or\\n     application/xml-external-parsed-entity, as defined in [RFC 3023]\\n     (except that application/xml-dtd is considered a text media type).\\n     MIME types ending by +xml are also XML media types.</li>\\n  <li>A document node is returned if the media type has a MIME type of\\n      text/html. In order to be able to make HTML parseable, tidy is automatically\\n      invoked. If you want to prevent that, you can also set your own content-type\\n      by setting the override-media-type attribute in the request element.\\n       For tidying, the following <a href=\"http://tidy.sourceforge.net/docs/quickref.html\">options</a>\\n       will be used:\\n       <ul>\\n         <li>TidyXmlOut=yes</li>\\n         <li>TidyDoctypeMode=TidyDoctypeOmit</li>\\n         <li>TidyQuoteNbsp=yes</li>\\n         <li>TidyCharEncoding=\"utf8\"</li>\\n         <li>TidyNewline=\"LF\"</li>\\n       </ul>\\n  </li>\\n  <li>An xs:string item is returned if the media type has a text MIME type,\\n     i.e. beginning with text/.</li>\\n  <li>An xs:base64Binary item is returned for all the other media types.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The structure of a request element is defined in the schema that is imported\\n by this module. The details are described in the\\n <a href=\"http://expath.org/spec/http-client#d2e183\">specification</a>.\\n Analogously, the response element is also described in this\\n <a href=\"http://expath.org/spec/http-client#d2e491\">specification</a>.\\n </p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xquery-3/#FunctionDeclns\">XQuery 3.0: Function Declaration</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri, Markus Pilman</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://expath.org/ns/error\",prefix:\"err\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http\"},{uri:\"http://zorba.io/modules/http-client-wrapper\",prefix:\"http-wrapper\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"https\"},{uri:\"http://www.zorba-xquery.com/modules/converters/html\",prefix:\"tidy\"},{uri:\"http://www.zorba-xquery.com/modules/converters/html-options\",prefix:\"tidy-options\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"send-request\",qname:\"http:send-request\",signature:\"($request as element(*)) as item()+\",description:' Function for convenience.\\n Calling this function is equivalent to calling\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n http:send-request($request, (), ())\\n </code>\\n',summary:\"<p> Function for convenience.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> see request parameter of the sequential <a href=\"#send-request-3\">send-request</a> function with three parameters.</div>'}],returns:{type:\"item()+\",description:'see return value of the sequential <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#send-request-3\">send-request</a> function with three parameters.'},errors:[]},{isDocumented:!0,arity:2,name:\"send-request\",qname:\"http:send-request\",signature:\"($request as element(*)?, $href as xs:string?) as item()+\",description:' Function for convenience.\\n Calling this function is equivalent to calling\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n http:send-request($request, $href, ())\\n </code>\\n',summary:\"<p> Function for convenience.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> see request parameter of the sequential <a href=\"#send-request-3\">send-request</a> function with three parameters.</div>'},{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> see href parameter of the sequential <a href=\"#send-request-3\">send-request</a> function with three parameters.</div>'}],returns:{type:\"item()+\",description:'see return of <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#send-request-3\">send-request</a>'},errors:[]},{isDocumented:!0,arity:3,name:\"send-request\",qname:\"http:send-request\",signature:\"($request as element(*)?, $href as xs:string?, $bodies as item()*) as item()+\",description:' This function sends an HTTP request and returns the corresponding response.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function is declared as sequential (see XQuery Scripting).\\n Sequential functions are allowed to have side effects. For example, most probably,\\n an HTTP POST request is a request that has side effects because it adds/changes\\n a remote resource.\\n </p>\\n',summary:\"<p> This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Contains the various parameters of the request. See the <a href=\"http://expath.org/spec/http-client#d2e183\">specification</a>. for a full description of the structure of this element.</div>'},{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the HTTP or HTTPS URI to send the request to. It must be a valid xs:anyURI, but is declared as a string to be able to pass literal strings (without requiring to explicitly cast it to an xs:anyURI.)</div>'},{name:\"bodies\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()+\",description:'a sequence of items, where the first item is a element of type http:responseType. The response element is also described in the <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://expath.org/spec/http-client#d2e483\">specification</a>. If there is one (or several, in case of multipart) response body, the response bodies are the next items in the sequence.'},errors:[]}],variables:[]},\"http://zorba.io/modules/schema\":{ns:\"http://zorba.io/modules/schema\",description:\" This module provides function that are related to XML Schema support\\n in Zorba.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei, Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"is-validated\",qname:\"schema:is-validated\",signature:\"($node as node()) as xs:boolean external\",description:\" This function returns true if the given node has been validated,\\n and false otherwise.\\n\",summary:\"<p> This function returns true if the given node has been validated,\\n and false otherwise.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node item that should be checked for validation</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given node has been validated, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"schema-type\",qname:\"schema:schema-type\",signature:\"($item as item()) as xs:QName? external\",description:\" This function returns the name of the type of the item passed\\n as parameter.\\n\",summary:\"<p> This function returns the name of the type of the item passed\\n as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the item from which the name of the type should be returned.</div>'}],returns:{type:\"xs:QName?\",description:\"the name of the type (as QName) of the item passed as parameter.\"},errors:[]},{isDocumented:!0,arity:1,name:\"validate-in-place\",qname:\"schema:validate-in-place\",signature:\"($node as node()) external\",description:\" Updating function that validates the document in place. After the updating\\n query is applied the $node will contain the validated content.\\n\",summary:\"<p> Updating function that validates the document in place.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the document or element to be validated, otherwise error</div>'}],returns:{type:null,description:\"The result of the function is an empty XDM instance and a pending update list that consists the schema:validate-in-place($node)) primitive.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/mongodb\":{ns:\"http://www.28msec.com/modules/mongodb\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides a driver to access a\\n <a href=\"http://www.mongodb.org/\">MongoDB</a> database - similar to\\n drivers for other high-level languages like e.g.\\n <a href=\"http://api.mongodb.org/python/current/\">PyMongo</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Here is a simple example of how we can raise the salary of each\\n developer by 10%.\\n Starting with an <em>employees</em> collection in MongoDB that contains\\n <pre>\\n { \"name\" : \"Peter\", \"role\" : \"developer\" , \"salary\" : 80 }\\n { \"name\" : \"Paul\",  \"role\" : \"developer\" , \"salary\" : 75 }\\n { \"name\" : \"Mary\",  \"role\" : \"manager\"   , \"salary\" : 90 } </pre>\\n we can get a connection\\n <pre>\\n variable $conn := mongo:connect(\"hostname\", 27017, \"db\", \"user\", \"password\");\\n </pre>\\n run this update\\n <pre>\\n for $emp in mongo:find($conn, \"employees\")\\n where $emp(\"role\") = \"developer\"\\n let $salary := $emp(\"salary\")\\n return {\\n   replace value of json $emp(\"salary\") with $salary * 1.1;\\n   mongo:save($conn, \"employees\", $emp)\\n };\\n </pre>\\n and get the names and the current salaries using\\n <pre>\\n mongo:find($conn, \"employees\", {}, { \"_id\" : false, \"role\" : false }, {}) </pre>\\n In this query we have removed the <em>_id</em> and <em>role</em> fields from\\n the results and get\\n <pre>\\n { \"name\" : \"Peter\", \"salary\" : 88   }\\n { \"name\" : \"Paul\",  \"salary\" : 82.5 }\\n { \"name\" : \"Mary\",  \"salary\" : 90   }\\n </pre>\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The non side-effecting functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-0\">connect#0</a></li>\\n   <li><a href=\"?anchor=connect-1\">connect#1</a></li>\\n   <li><a href=\"?anchor=connect-2\">connect#2</a></li>\\n   <li><a href=\"?anchor=connect-5\">connect#5</a></li>\\n   <li><a href=\"?anchor=collection-names-1\">collection-names#1</a></li>\\n   <li><a href=\"?anchor=count-2\">count#2</a></li>\\n   <li><a href=\"?anchor=count-3\">count#3</a></li>\\n   <li><a href=\"?anchor=find-2\">find#2</a></li>\\n   <li><a href=\"?anchor=find-3\">find#3</a></li>\\n   <li><a href=\"?anchor=find-4\">find#4</a></li>\\n   <li><a href=\"?anchor=find-5\">find#5</a></li>\\n </ul>\\n are declared deterministic, which means that their results could be cached\\n when invoked multiple times with the same arguments in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use the following alternative functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-nondeterministic-0\">connect-nondeterministic#0</a></li>\\n   <li><a href=\"?anchor=connect-nondeterministic-1\">connect-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=connect-nondeterministic-2\">connect-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=connect-nondeterministic-5\">connect-nondeterministic#5</a></li>\\n   <li><a href=\"?anchor=collection-names-nondeterministic-1\">collection-names-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=count-nondeterministic-2\">count-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=count-nondeterministic-3\">count-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=find-nondeterministic-2\">find-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=find-nondeterministic-3\">find-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=find-nondeterministic-4\">find-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=find-nondeterministic-5\">find-nondeterministic#5</a></li>\\n </ul>\\n which have been declared as being non deterministic.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Three different functions have been defined to run mongo commands:\\n <ul>\\n   <li><a href=\"?anchor=run-cmd-2\">run-cmd#2</a></li>\\n   <li><a href=\"?anchor=run-cmd-nondeterministic-2\">run-cmd-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=run-cmd-deterministic-2\">run-cmd-deterministic#2</a></li>\\n </ul>\\n If your application depends on the ordering of side-effects from commands issued\\n through these functions you should use <a href=\"?anchor=run-cmd-2\">run-cmd#2</a>,\\n which has been declared as sequential.\\n For non-side-effecting commands you can also use\\n <a href=\"?anchor=run-cmd-nondeterministic-2\">run-cmd-nondeterministic#2</a> and\\n <a href=\"?anchor=run-cmd-deterministic-2\">run-cmd-deterministic#2</a>.\\n The results of commands executed by means of\\n <a href=\"?anchor=run-cmd-deterministic-2\">run-cmd-deterministic#2</a> (which is\\n declared <i>deterministic</i>) could be cached, whereas the results of\\n commands executed by means of\\n <a href=\"?anchor=run-cmd-nondeterministic-2\">run-cmd-nondeterministic#2</a> (which is\\n declared <i>non-deterministic</i>) are never cached.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://www.28msec.com/modules/mongodb/types\",prefix:\"m-schema\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"collection-names-nondeterministic\",qname:\"mongo:collection-names-nondeterministic\",signature:\"($db as xs:anyURI) as xs:string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Get a list of all the collection names in this database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#collection-names-1\">collection-names#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Get a list of all the collection names in this database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'}],returns:{type:\"xs:string*\",description:\"a list of the names of all collection in the given database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"collection-names\",qname:\"mongo:collection-names\",signature:\"($db as xs:anyURI) as xs:string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Get a list of all the collection names in this database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Get a list of all the collection names in this database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'}],returns:{type:\"xs:string*\",description:\"a list of the names of all collection in the given database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"connect-nondeterministic\",qname:\"mongo:connect-nondeterministic\",signature:\"() as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to this project\\'s default MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-0\">connect#0</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Connect to this project's default MongoDB database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect-nondeterministic\",qname:\"mongo:connect-nondeterministic\",signature:\"($connection-config as item()) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-1\">connect#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the connection specification.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO001 if the connection specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect-nondeterministic\",qname:\"mongo:connect-nondeterministic\",signature:\"($credentials-name as xs:string?, $options as object()) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-2\">connect#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials-name\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the credentials to use.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the credentials to use.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO001 if the connection specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"connect-nondeterministic\",qname:\"mongo:connect-nondeterministic\",signature:\"($host as xs:string, $port as xs:integer?, $db as xs:string, $user as xs:string?, $pass as xs:string?) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-5\">connect#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the host to connect to</div>'},{name:\"port\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the port to connect to</div>'},{name:\"db\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the database to connect to</div>'},{name:\"user\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the user used to authorize access to the db</div>'},{name:\"pass\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the password used to authorize access to the db</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"connect\",qname:\"mongo:connect\",signature:\"() as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to this project\\'s default MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Connect to this project's default MongoDB database.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect\",qname:\"mongo:connect\",signature:\"($connection-config as item()) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $connection-config parameter is used to specify the connection information.\\n If a string is used, then the function will interpret it as the name of\\n a credential in the MongoDB category.\\n If an object is used, then the function will open a connection using it.\\n The object structure is the following:\\n <ul>\\n   <li>host (string; mandatory)</li>\\n   <li>port (integer; default: 27017)</li>\\n   <li>db (string; mandatory)</li>\\n   <li>user (string)</li>\\n   <li>pass (string)</li>\\n   <li>timeout (decimal; default: 0)</li>\\n   <li>pre-digested (boolean; default: false)</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, using stored credential:\\n <pre>mongo:connect(\"credentials-name\")</pre>\\n <p>For example, specifying the connection information:</p>\\n <pre>mongo:connect(\\n   {\\n     \"host\": \"hostname\",\\n     \"port\": 11011,\\n     \"db\": \"mydb\",\\n     \"user\": \"myuser\"\\n     \"password: \"mypass\"\\n   })</pre>.\\n </p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the connection specification.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO001 if the connection specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect\",qname:\"mongo:connect\",signature:\"($credentials-name as xs:string?, $options as object()) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $credentials-name parameter is used to specify the connection information.\\n If empty a connection will be opened to the project default MongoDB database.\\n Otherwise, the function will use it to identify a credential in the MongoDB category.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The $options object can be used to specify connection options. The following\\n fields are supported:\\n <ul>\\n   <li>timeout (decimal; default: 0)</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, connecting to the project default MongoDB database:\\n <pre>mongo:connect((), {\"timeout\": 10})</pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, specifying the connection information:\\n <pre>mongo:connect(\"credentials-name\", {\"timeout\": 10})</pre>\\n </p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"credentials-name\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the credentials to use.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the credentials to use.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO001 if the connection specification is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"connect\",qname:\"mongo:connect\",signature:\"($host as xs:string, $port as xs:integer?, $db as xs:string, $user as xs:string?, $pass as xs:string?) as xs:anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connect to a MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Connect to a MongoDB database.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the host to connect to</div>'},{name:\"port\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the port to connect to</div>'},{name:\"db\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the database to connect to</div>'},{name:\"user\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the user used to authorize access to the db</div>'},{name:\"pass\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the password used to authorize access to the db</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for a connection to the MongoDB database.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO002 connection to MongoDB failed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO003 authentication to the MongoDB database failed</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"copy\",qname:\"mongo:copy\",signature:\"($db as xs:anyURI, $from-db as xs:string, $to-db as xs:string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Copies a MongoDB database. Be aware, you must call\\n this function on the admin database.</p>\\n',summary:\"<p>  Copies a MongoDB database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"from-db\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the source database</div>'},{name:\"to-db\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the target database</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if copy operation fails</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"count-nondeterministic\",qname:\"mongo:count-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string) as xs:integer external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Counts the number of documents in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#count-2\">count#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Counts the number of documents in the given collection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'}],returns:{type:\"xs:integer\",description:\"the said count\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"count-nondeterministic\",qname:\"mongo:count-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object()) as xs:integer external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Counts the number of documents satisfying the query in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#count-3\">count#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Counts the number of documents satisfying the query in the given collection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query specifying which objects to count</div>'}],returns:{type:\"xs:integer\",description:\"the said count\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"count\",qname:\"mongo:count\",signature:\"($db as xs:anyURI, $coll as xs:string) as xs:integer external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Counts the number of documents in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Counts the number of documents in the given collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'}],returns:{type:\"xs:integer\",description:\"the said count\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"count\",qname:\"mongo:count\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object()) as xs:integer external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Counts the number of documents satisfying the query in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Counts the number of documents satisfying the query in the given collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query specifying which objects to count</div>'}],returns:{type:\"xs:integer\",description:\"the said count\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"disconnect\",qname:\"mongo:disconnect\",signature:\"($db as xs:anyURI) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Disconnect from a MongoDB database.</p>\\n',summary:\"<p>  Disconnect from a MongoDB database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"drop-collection\",qname:\"mongo:drop-collection\",signature:\"($db as xs:anyURI, $coll as xs:string) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Drop a collection.</p>\\n',summary:\"<p>  Drop a collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"find-nondeterministic\",qname:\"mongo:find-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all objects of the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#find-2\">find#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns all objects of the given collection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'}],returns:{type:\"object()*\",description:\"all objects of the given collection\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"find-nondeterministic\",qname:\"mongo:find-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#find-3\">find#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"find-nondeterministic\",qname:\"mongo:find-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $options as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#find-4\">find#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation (see find#5 for available options)</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"find-nondeterministic\",qname:\"mongo:find-nondeterministic\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $projection as object(), $options as object()) as object()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#find-5\">find#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'},{name:\"projection\",type:\"object()\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query or projection could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"find\",qname:\"mongo:find\",signature:\"($db as xs:anyURI, $coll as xs:string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all objects of the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Returns all objects of the given collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'}],returns:{type:\"object()*\",description:\"all objects of the given collection\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"find\",qname:\"mongo:find\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"find\",qname:\"mongo:find\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $options as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation (see find#5 for available options)</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"find\",qname:\"mongo:find\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $projection as object(), $options as object()) as object()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a query operation on the given collection and\\n returns all matches.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Available options:\\n <ul>\\n   <li>to-return: the maximum number of objects to return (0 = unlimited)</li>\\n   <li>to-skip: start with the n-th object</li>\\n   <li>batch-size: the number of objects to return in one batch</li>\\n   <li>slave-ok: allow this query to be run against a replica secondary</li>\\n   <li>await-data: the server will block for some extra time before returning,\\n   waiting for more data to return</li>\\n   <li>partial-results: return partial results if some shards are down instead\\n   of returning an error</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Performs a query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'},{name:\"projection\",type:\"object()\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given query or projection could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-connected\",qname:\"mongo:is-connected\",signature:\"($db as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Checks if the given identifiers is valid and the corresponding\\n connection is open.</p>\\n',summary:\"<p>  Checks if the given identifiers is valid and the corresponding\\n connection is open.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given connection identifier is valid and the corresponding connection is open, false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"remove\",qname:\"mongo:remove\",signature:\"($db as xs:anyURI, $coll as xs:string, $remove as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a remove operation on the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The operation will be checked and an error is raised if\\n one of them fails.</p>\\n',summary:\"<p>  Performs a remove operation on the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"remove\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the remove command to be performed</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given document could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"remove\",qname:\"mongo:remove\",signature:\"($db as xs:anyURI, $coll as xs:string, $remove as object(), $options as object()) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs a remove operation on the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <ul>\\n   <li>safe: If to true, the operation will wait for a response from\\n    the database and an error is raised if the operation fails.\\n    Otherwise, the operation will not wait for a response.</li>\\n  <li>just-one: true if the operation should stop after a single match\\n    has been found and deleted</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Performs a remove operation on the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"remove\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the remove command to be performed</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given document could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"run-cmd-deterministic\",qname:\"mongo:run-cmd-deterministic\",signature:\"($db as xs:anyURI, $cmd as object()) as object() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a\\n <a href=\"http://docs.mongodb.org/manual/reference/commands/\">database command</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is marked as deterministic and should be used whenever the\\n specified command has no side-effects and result caching is desired.</p>\\n',summary:\"<p>  Executes a\\n  database command .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"cmd\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the database command to execute</div>'}],returns:{type:\"object()\",description:\"The result object. Typically has { ok : ..., errmsg : ... } fields set.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"run-cmd-nondeterministic\",qname:\"mongo:run-cmd-nondeterministic\",signature:\"($db as xs:anyURI, $cmd as object()) as object() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a\\n <a href=\"http://docs.mongodb.org/manual/reference/commands/\">database command</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is marked as non-deterministic and should be used whenever the\\n specified command has no side-effects and result caching is undesired.</p>\\n',summary:\"<p>  Executes a\\n  database command .</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"cmd\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the database command to execute</div>'}],returns:{type:\"object()\",description:\"The result object. Typically has { ok : ..., errmsg : ... } fields set.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"run-cmd\",qname:\"mongo:run-cmd\",signature:\"($db as xs:anyURI, $cmd as object()) as object() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a\\n <a href=\"http://docs.mongodb.org/manual/reference/commands/\">database command</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is marked as sequential and should be used whenever the\\n specified command has side-effects.</p>\\n',summary:\"<p>  Executes a\\n  database command .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"cmd\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the database command to execute</div>'}],returns:{type:\"object()\",description:\"The result object. Typically has { ok : ..., errmsg : ... } fields set.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if any mongodb error happens</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"save\",qname:\"mongo:save\",signature:\"($db as xs:anyURI, $coll as xs:string, $doc as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Save a sequence of documents in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a document to be save already has an \"_id\" field, then an\\n upsert operation is performed an any existing document with that\\n id will be overwritten. Otherwise, an insert operation is performed\\n and the \"_id\" generated for each document will be returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Each safe operation will be checked and an error is raised if\\n one of them fails.</p>\\n',summary:\"<p>  Save a sequence of documents in the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"doc\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the document to be saved or upserted</div>'}],returns:{type:\"empty-sequence()\",description:'the documents that have been inserted with \"_id\" fields.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given document could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"save\",qname:\"mongo:save\",signature:\"($db as xs:anyURI, $coll as xs:string, $doc as object(), $options as object()) as m-schema:oid? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Save a sequence of documents in the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a document to be saved already has an \"_id\" field, then an\\n upsert operation is performed and any existing document with that\\n id will be overwritten. Otherwise, an insert operation is performed.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the manipulate option is set to true, an \"_id\" field will be\\n added to the document. The new id will be returned. Otherwise,\\n the \"_id\" field will be added by the server.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the safe options is set to true, each operation will wait for a\\n response from the database and an error is raised if the operation\\n fails. Otherwise, the operation will not wait for a response.</p>\\n',summary:\"<p>  Save a sequence of documents in the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"doc\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the document to be saved or upserted</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"m-schema:oid?\",description:\"a generated OID if the manipulate option was set to true, the empty sequence otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given document could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"update\",qname:\"mongo:update\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $update as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs an update command on the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The operation will be checked and an error is raised if\\n one of them fails. Also, this function only modifies one\\n document matching the query and does not do any upserts.</p>\\n',summary:\"<p>  Performs an update command on the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query to select the objects that are updated</div>'},{name:\"update\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the update specification to be performed</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given objects could not be converted to BSON</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"update\",qname:\"mongo:update\",signature:\"($db as xs:anyURI, $coll as xs:string, $query as object(), $update as object(), $options as object()) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Performs an update operation on the given collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <ul>\\n   <li>safe: If to true, the operation will wait for a response from\\n    the database and an error is raised if the operation fails.\\n    Otherwise, the operation will not wait for a response.</li>\\n  <li>multi: indicates if all documents matching criteria should be updated\\n  rather than just one.</li>\\n  <li>upsert: if this should be an \"upsert\" operation; that is,\\n  if the record(s) do not exist, insert one. Upsert only inserts a single document.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Performs an update operation on the given collection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database connection identifier</div>'},{name:\"coll\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query to select the objects that are updated</div>'},{name:\"update\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the update specification to be performed</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side-effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO004 invalid database identifier</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO005 if any mongodb error happens</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mongo:MONGO006 if the given objects could not be converted to BSON</xqdoc:error>']}],variables:[]},\"http://jsoniq.org/function-library\":{ns:\"http://jsoniq.org/function-library\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides extensions to the JSONiq core function library.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The module is always imported so you do not need to import it explicitly.\\n Also, you do not need to fully qualify a function to invoke it.</p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://jsoniq.org/</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"libjn\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"accumulate\",qname:\"libjn:accumulate\",signature:\"($items as item()*) as object()\",description:\" This function dynamically builds an object, like the {||} syntax, except that\\n it does not throw an error upon pair collision. Instead, it accumulates them\\n into an array, if more than one.\\n\",summary:\"<p> This function dynamically builds an object, like the {||} syntax, except that\\n it does not throw an error upon pair collision.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items, the objects of which are going to be accumulated into a single object.</div>'}],returns:{type:\"object()\",description:\"The accumulated object.\"},errors:[]},{isDocumented:!0,arity:1,name:\"descendant-arrays\",qname:\"libjn:descendant-arrays\",signature:\"($items as item()*) as array()*\",description:\" This function returns all arrays contained at any depth within a sequence of items.\\n\",summary:\"<p> This function returns all arrays contained at any depth within a sequence of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'}],returns:{type:\"array()*\",description:\"The descendant arrays of the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"descendant-objects\",qname:\"libjn:descendant-objects\",signature:\"($items as item()*) as object()*\",description:\" This function returns all objects contained at any depth within a sequence of items.\\n\",summary:\"<p> This function returns all objects contained at any depth within a sequence of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'}],returns:{type:\"object()*\",description:\"The descendant objects of the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"descendant-pairs-priv\",qname:\"libjn:descendant-pairs-priv\",signature:\"($i as item()) as object()*\",description:\" Helper function for libjn:descendant-pairs()\\n\",summary:\"<p> Helper function for libjn:descendant-pairs()\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"i\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An item</div>'}],returns:{type:\"object()*\",description:\"The descendant pairs of the item\"},errors:[]},{isDocumented:!0,arity:1,name:\"descendant-pairs\",qname:\"libjn:descendant-pairs\",signature:\"($items as item()*) as object()*\",description:\" This function returns all pairs contained at any depth within an sequence of items.\\n\",summary:\"<p> This function returns all pairs contained at any depth within an sequence of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"All direct and indirect descendant pairs.\"},errors:[]},{isDocumented:!0,arity:1,name:\"intersect\",qname:\"libjn:intersect\",signature:\"($items as item()*) as object()\",description:\" This function returns the intersection of the objects contained in the\\n given sequence of items, aggregating values corresponding to the same key\\n into an array.\\n\",summary:\"<p> This function returns the intersection of the objects contained in the\\n given sequence of items, aggregating values corresponding to the same key\\n into an array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'}],returns:{type:\"object()\",description:\"The insersection of the objects contained in $items.\"},errors:[]},{isDocumented:!0,arity:1,name:\"values\",qname:\"libjn:values\",signature:\"($items as item()*) as item()*\",description:\" This functions returns all values of all objects contained in a sequence of items.\\n\",summary:\"<p> This functions returns all values of all objects contained in a sequence of items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of items.</div>'}],returns:{type:\"item()*\",description:\"The values inside the objects of the sequence.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/node-position\":{ns:\"http://zorba.io/modules/node-position\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides a function (np:node-position) that, given a node,\\n returns positional information about the node in the form of an xs:anyURI\\n item. The module also defines functions that use such positional information\\n to determine: (1) positional relationships between two nodes (e.g. if one\\n is the ancestor of another) and (2) positional properties of a single node\\n (e.g. its level in the tree).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Within this module, the term \"node position\" will be used to refer to an\\n xs:anyURI item that is returned by the np:node-position function.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/node-position\",prefix:\"np\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"ancestor-of\",qname:\"np:ancestor-of\",signature:\"($pos1 as xs:anyURI, $pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n an ancestor of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is an ancestor of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n an ancestor of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"pos2\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is an ancestor of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"attribute-of\",qname:\"np:attribute-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n an attribute of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is an attribute of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n an attribute of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential parent node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential attribute node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is an attribute of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"child-of\",qname:\"np:child-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n a child of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is a child of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n a child of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential parent node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential child node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is a child of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"descendant-of\",qname:\"np:descendant-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n a descendant of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is a descendant of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n a descendant of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential ancestor node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential descendant node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is a descendant of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"following-in-document-order-of\",qname:\"np:following-in-document-order-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n following in document order the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is following in document order the\\n first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about\\n the positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n following in document order the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is following in document order the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"following-of\",qname:\"np:following-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n following the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is following the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n following the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if node positions $n-pos1 and $n-pos2 belong to the same XML tree and $n-pos2 is following the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"following-sibling-of\",qname:\"np:following-sibling-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n a following-sibling of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is a following-sibling of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n a following-sibling of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding-sibling node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following-sibling node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is a following-sibling of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"in-collection\",qname:\"np:in-collection\",signature:\"($n-pos as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position belongs to a collection.</p>\\n',summary:\"<p>  Determines whether a node position belongs to a collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos belongs to a collection; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"in-same-collection-of\",qname:\"np:in-same-collection-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether two node positions belong to the same collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the two nodes belong to the same collection.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about\\n the positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether two node positions belong to the same collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the two nodes whose node positions are $n-pos1 and $n-pos2 belong to the same collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"in-same-tree-of\",qname:\"np:in-same-tree-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether two node positions belong to the same tree.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the two nodes belong to the same tree.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about\\n the positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether two node positions belong to the same tree.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the two nodes whose node positions are $n-pos1 and $n-pos2 belong to the same tree.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"in-subtree-of\",qname:\"np:in-subtree-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument belongs\\n to the subtree rooted at the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node belongs to the subtree rooted at the\\n first. Otherwise, the result of the function does not imply anything about\\n the positional relationship of the two nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function differs from np:descendant-of in the way it treats attribute\\n nodes. np:descendant-of follows the XQuery/XPath specification for the\\n descendant axis, and as a result, it does not consider attributes as\\n descendants of any nodes; it will always return false if $n-pos2 was\\n obtained from an attribute node.In contrast, np:in-subtree-of will return\\n true if $n-pos2 was obtained from an attribute node that appeared in the\\n subtree of the node that $n-pos1 was obtained from.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument belongs\\n to the subtree rooted at the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential subtree root node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential node in the subtree node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 belongs to the subtree rooted at the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-attribute\",qname:\"np:is-attribute\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to an attribute node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to an attribute node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to an attribute; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-comment\",qname:\"np:is-comment\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to a comment node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to a comment node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to an comment; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-document\",qname:\"np:is-document\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to a document node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to a document node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to a document; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-element\",qname:\"np:is-element\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to an element node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to an element node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to an element; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-processing-instruction\",qname:\"np:is-processing-instruction\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to an processing-instruction\\n node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to an processing-instruction\\n node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to a processing instruction; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-text\",qname:\"np:is-text\",signature:\"($n-pos1 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether a node position corresponds to a text node.</p>\\n',summary:\"<p>  Determines whether a node position corresponds to a text node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos corresponds to a text; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"level\",qname:\"np:level\",signature:\"($n-pos as xs:anyURI) as xs:integer external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Computes the level of a node position in its tree.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note: The root node of a tree is at level one.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The result of the function applies to the corresponding node as well,\\n that is, within the snapshot in which the position was computed, the node\\n level is the returned one.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The result of the function does not imply anything about the\\n node level in other snapshots.</p>\\n',summary:\"<p>  Computes the level of a node position in its tree.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node position of the node whose level should be determined.</div>'}],returns:{type:\"xs:integer\",description:\"the level in the tree of the node position $n-pos as xs:integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"node-position\",qname:\"np:node-position\",signature:\"($arg as node()) as xs:anyURI external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return a URI item containing positional information for a given node.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Within a snapshot, each has a different positional URI. However,\\n different nodes in different snapshots might have the same URI.</p>\\n',summary:\"<p>  Return a URI item containing positional information for a given node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node for which the positional information URI should be computed</div>'}],returns:{type:\"xs:anyURI\",description:\"the opaque positional information URI of the node.\"},errors:[]},{isDocumented:!0,arity:2,name:\"parent-of\",qname:\"np:parent-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n the parent of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is the parent of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n the parent of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential child node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential parent node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is the parent of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"preceding-in-document-order-of\",qname:\"np:preceding-in-document-order-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n preceding in document order the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is preceding in document order the\\n first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about\\n the positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n preceding in document order the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is preceding in document order the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"preceding-of\",qname:\"np:preceding-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n preceding the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is preceding the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n preceding the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if node positions $n-pos1 and $n-pos2 belong to the same XML tree and $n-pos2 is preceding the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"preceding-sibling-of\",qname:\"np:preceding-sibling-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether the node position given as second argument is\\n a preceding-sibling of the node position given as first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is a preceding-sibling of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether the node position given as second argument is\\n a preceding-sibling of the node position given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following-sibling node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding-sibling node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the node position $n-pos2 is a preceding-sibling of the node position $n-pos1; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"sibling-of\",qname:\"np:sibling-of\",signature:\"($n-pos1 as xs:anyURI, $n-pos2 as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Determines whether two node positions are siblings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the two positions were obtained within the same snapshot S, then the\\n result of the function applies to the corresponding nodes as well, that\\n is, within snapshot S, the second node is a sibling of the first.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Otherwise, the result of the function does not imply anything about the\\n positional relationship of the two nodes.</p>\\n',summary:\"<p>  Determines whether two node positions are siblings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"n-pos1\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'},{name:\"n-pos2\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a node position</div>'}],returns:{type:\"xs:boolean\",description:\"true if the two node positions $n-pos1 and $n-pos2 are siblings; false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 if one of the given URI is not a valid node position computed by the <tt>np:node-position</tt> function.</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/cryptography/hash\":{ns:\"http://www.zorba-xquery.com/modules/cryptography/hash\",description:\" This module provides functions that perform different hash operations.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gabriel Petrovay, Markus Pilman</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/cryptography/hash\",prefix:\"hash\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"hash-impl\",qname:\"hash:hash-impl\",signature:\"($value as xs:string, $alg as xs:string) as xs:string external\",description:\" This function computes a hash value of the string provided as parameter.\\n The function expects the hash algorithm to be used as parameter.\\n\",summary:\"<p> This function computes a hash value of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to be hashed.</div>'},{name:\"alg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The algorithm to use for this hashing operation. Currently only \"md5\" and \"sha1\" algorithms are available. If no valid algorithm name is given, md5 will be used.</div>'}],returns:{type:\"xs:string\",description:\"The hash of the provided string. In case SHA1 is used, the resulting hash value is base64 encoded.\"},errors:[]},{isDocumented:!0,arity:1,name:\"md5\",qname:\"hash:md5\",signature:\"($value as xs:string) as xs:string\",description:\" Computes the MD5 hash of the string provided as parameter.\\n\",summary:\"<p> Computes the MD5 hash of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to hash.</div>'}],returns:{type:\"xs:string\",description:\"The MD5 hash of the provided string.\"},errors:[]},{isDocumented:!0,arity:1,name:\"sha1\",qname:\"hash:sha1\",signature:\"($value as xs:string) as xs:string\",description:\" Computes the SHA1 hash of the string provided as parameter.\\n\",summary:\"<p> Computes the SHA1 hash of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to hash.</div>'}],returns:{type:\"xs:string\",description:\"The base64 encoded SHA1 hash of the provided string.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/excel/lookup\":{ns:\"http://zorba.io/modules/excel/lookup\",description:\" This module implements some Excel 2003 lookup functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528281033.aspx\" target=\"_blank\">Excel 2003 Documentation: Lookup Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/lookup\",prefix:\"excel\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"choose\",qname:\"excel:choose\",signature:\"($index_num as xs:integer, $values as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Uses index_num to return a value from the sequence of value arguments.\\n\",summary:\"<p> Uses index_num to return a value from the sequence of value arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The position in the sequence, 1 based.</div>'},{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of values.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The value at the index position.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if index is smaller than 1 or bigger than the size of sequence.</xqdoc:error>']},{isDocumented:!0,arity:30,name:\"choose\",qname:\"excel:choose\",signature:\"($index_num as xs:integer, $value_sequence1 as xs:anyAtomicType*, $value_sequence2 as xs:anyAtomicType*, $value_sequence3 as xs:anyAtomicType*, $value_sequence4 as xs:anyAtomicType*, $value_sequence5 as xs:anyAtomicType*, $value_sequence6 as xs:anyAtomicType*, $value_sequence7 as xs:anyAtomicType*, $value_sequence8 as xs:anyAtomicType*, $value_sequence9 as xs:anyAtomicType*, $value_sequence10 as xs:anyAtomicType*, $value_sequence11 as xs:anyAtomicType*, $value_sequence12 as xs:anyAtomicType*, $value_sequence13 as xs:anyAtomicType*, $value_sequence14 as xs:anyAtomicType*, $value_sequence15 as xs:anyAtomicType*, $value_sequence16 as xs:anyAtomicType*, $value_sequence17 as xs:anyAtomicType*, $value_sequence18 as xs:anyAtomicType*, $value_sequence19 as xs:anyAtomicType*, $value_sequence20 as xs:anyAtomicType*, $value_sequence21 as xs:anyAtomicType*, $value_sequence22 as xs:anyAtomicType*, $value_sequence23 as xs:anyAtomicType*, $value_sequence24 as xs:anyAtomicType*, $value_sequence25 as xs:anyAtomicType*, $value_sequence26 as xs:anyAtomicType*, $value_sequence27 as xs:anyAtomicType*, $value_sequence28 as xs:anyAtomicType*, $value_sequence29 as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" Uses index_num to return a sequence from the list of sequences.\\n Use CHOOSE to select one of up to 29 sequences based on the index number.\\n\",summary:\"<p> Uses index_num to return a sequence from the list of sequences.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position in the sequence, 1 based</div>'},{name:\"value_sequence1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence27\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence28\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'},{name:\"value_sequence29\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of values. Specify the empty sequence () if you don\\'t need it.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"The value at the index position\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if index is smaller than 1 or bigger than 29</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"hlookup\",qname:\"excel:hlookup\",signature:\"($lookup_value as xs:anyAtomicType, $table_array as xs:anyAtomicType+, $table_width as xs:integer, $table_height as xs:integer, $row_index_num as xs:integer) as xs:anyAtomicType\",description:\" Same as above, only that range_lookup is defaulted to true.\\n That is, this Hlookup looks for the approximate value\\n   and the first row must be ordered ascending.\\n\",summary:\"<p> Same as above, only that range_lookup is defaulted to true.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched. Allowed types are numeric, string, boolean. <p/> Boolean values are compared only with booleans. Numbers are compared only with numbers, if range_lookup is not zero. The other types are converted to string and compared to string value of all values.</div>'},{name:\"table_array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, row after row</div>'},{name:\"table_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"table_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows</div>'},{name:\"row_index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the row index, 1 based</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The value found, with original type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the array contains less elements than specified by table_height and table_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if row_index_num is outside the range 1 .. table_height</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup is true and the value searched is smaller than the first value in the header</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=false and the value cannot be found</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"hlookup\",qname:\"excel:hlookup\",signature:\"($lookup_value as xs:anyAtomicType, $table_array as xs:anyAtomicType+, $table_width as xs:integer, $table_height as xs:integer, $row_index_num as xs:integer, $range_lookup as xs:boolean) as xs:anyAtomicType\",description:' Searches for a value in the top row of an array of values,\\n   and then returns a value in the same column from a row you specify in the array.\\n <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Array is specified with 3 parameters:\\n <dt>table_array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>\\n <dt>table_width</dt> <dd>specifies the number of elements in a row</dd>\\n <dt>table_height</dt> <dd>specifies the number of rows</dd></dl>\\n The number of elements in table_array must be equal or more than table_width * table_height.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For wildchar matching, the XQuery regex matcher is used.\\n',summary:\"<p> Searches for a value in the top row of an array of values,\\n   and then returns a value in the same column from a row you specify in the array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched. Allowed types are numeric, string, boolean. <p/> Boolean values are compared only with booleans. Numbers are compared only with numbers, if range_lookup is not zero. The other types are converted to string and compared to string value of all values.</div>'},{name:\"table_array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, row after row</div>'},{name:\"table_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"table_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows</div>'},{name:\"row_index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the row index, 1 based</div>'},{name:\"range_lookup\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>specifies the algorithm to use: <dt>true</dt> <dd>find approximative match. First row of array must be sorted in ascending order.</dd> <dt>false</dt> <dd>find exact match, using xquery regex First row of array can be in any order. </dd></dl></div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The value found, with original type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the array contains less elements than specified by table_height and table_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if row_index_num is outside the range 1 .. table_height</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup is true and the value searched is smaller than the first value in the header</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=false and the value cannot be found</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"index\",qname:\"excel:index\",signature:\"($array as xs:anyAtomicType+, $array_height as xs:integer, $array_width as xs:integer, $row_num as xs:integer, $column_num as xs:integer) as xs:anyAtomicType+\",description:' Returns a value from within an array.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This is the Array form of the Excel Index function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Array is specified with 3 parameters:\\n <dt>array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>\\n <dt>array_height</dt> <dd>specifies the number of rows</dd>\\n <dt>array_width</dt> <dd>specifies the number of elements in a row</dd></dl>\\n The number of elements in array must be equal or more than array_width * array_height.\\n',summary:\"<p> Returns a value from within an array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, row after row</div>'},{name:\"array_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows</div>'},{name:\"array_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"row_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the row position of the value, 1 based</div>'},{name:\"column_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the column position of the value, 1 based</div>'}],returns:{type:\"xs:anyAtomicType+\",description:\"The value from x-y in the array\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the array contains less elements than specified by table_height and table_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Ref if row_num is outside the range</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"lookup\",qname:\"excel:lookup\",signature:\"($lookup_value as xs:anyAtomicType, $lookup_vector as xs:anyAtomicType+, $result_vector as xs:anyAtomicType+) as xs:anyAtomicType\",description:' The Vector form. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Looks in a sequence for a value\\n   and return a value from the same position in a second sequence.\\n If the value is not found, then it matches the largest value in lookup_vector\\n   that is less than or equal to lookup_value.\\n',summary:\"<p> The Vector form.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched</div>'},{name:\"lookup_vector\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to be searched, in ascending order.</div>'},{name:\"result_vector\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence containing the result values</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"a value from $result_vector\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA if lookup value is smaller than the first value in lookup_vector</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA if position found is outside the result range</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"lookup\",qname:\"excel:lookup\",signature:\"($lookup_value as xs:anyAtomicType, $array as xs:anyAtomicType+, $array_width as xs:integer, $array_height as xs:integer) as xs:anyAtomicType\",description:' The Array form.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n It looks in the first row or column of an array for the specified value\\n   and returns a value from the same position in the last row or column of the array.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If array covers an area that is wider than it is tall (more columns than rows),\\n   LOOKUP searches for lookup_value in the first row.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If array is square or is taller than it is wide (more rows than columns),\\n   LOOKUP searches in the first column.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The values in the first row or first column must be in ascending order.\\n',summary:\"<p> The Array form.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched. If the value is not found, then it matches the largest value in lookup_vector that is less than or equal to lookup_value.</div>'},{name:\"array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the array sequence, row after row</div>'},{name:\"array_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"array_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows in the array</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The corresponding value in the last row or column\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if array contains less values than specified by array_width and array_height or array_width = 0 or array_height = 0</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA if the lookup_value is smaller than the first value in the row or column</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"match\",qname:\"excel:match\",signature:\"($lookup_value as xs:anyAtomicType, $sequence as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Same as above, but match_type is defaulted to 1.\\n It finds the largest value that is less than or equal to lookup_value.\\n\",summary:\"<p> Same as above, but match_type is defaulted to 1.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value to be searched.</div>'},{name:\"sequence\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the vector where to search the value</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The position of found value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than the first value in sequence</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=0 and the value cannot be found</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"match\",qname:\"excel:match\",signature:\"($lookup_value as xs:anyAtomicType, $sequence as xs:anyAtomicType+, $match_type as xs:integer) as xs:anyAtomicType\",description:\" Returns the relative position of an item in a sequence that\\n   matches a specified value in a specified order.\\n Only for one dimensional vector.\\n\",summary:\"<p> Returns the relative position of an item in a sequence that\\n   matches a specified value in a specified order.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value to be searched.</div>'},{name:\"sequence\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the vector where to search the value</div>'},{name:\"match_type\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>specifies the algorithm used for searching. Possible values: <dt>1</dt> <dd> finds the largest value that is less than or equal to lookup_value. Sequence must be in ascending order.</dd> <dt>0</dt> <dd> finds the first value that is exactly equal to lookup_value. <p/> Sequence can be in any order.<p/> If lookup_value is boolean, then only booleans are compared.<p/> For other types, they are casted to string and then compared using xquery regular expressions. Lookup_value can be a xquery regular expression.</dd> <dt>-1</dt> <dd> finds the smallest value that is greater than or equal to lookup_value.<p/> Sequence must be in descending order.</dd></dl></div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The position of found value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA for match_type 1 or -1, the lookup_value is smaller or larger than the first value in sequence</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=0 and the value cannot be found</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"offset\",qname:\"excel:offset\",signature:\"($reference as xs:anyAtomicType+, $reference_height as xs:integer, $reference_width as xs:integer, $rows as xs:integer, $cols as xs:integer) as xs:anyAtomicType*\",description:\" Same as above, only that the sub-array is specified only by rows and cols relative position.\\n The sub-array height and width is computed to contain the remaining elements of the array.\\n\",summary:\"<p> Same as above, only that the sub-array is specified only by rows and cols relative position.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"reference\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the reference array</div>'},{name:\"reference_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows in the reference array</div>'},{name:\"reference_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of elements in the reference array row</div>'},{name:\"rows\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the relative row position where the sub-array starts. It must be a positive value, zero relative.</div>'},{name:\"cols\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the relative column position where the sub-array starts. It must be a positive value, zero relative.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"The sequence specifying the sub-array, row after row\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA rows or cols are negative</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA height or width are smaller than 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value reference array contains less elements than specified by reference_height and reference_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA the resulted sub-array is not completely contained inside reference array</xqdoc:error>']},{isDocumented:!0,arity:7,name:\"offset\",qname:\"excel:offset\",signature:\"($reference as xs:anyAtomicType+, $reference_height as xs:integer, $reference_width as xs:integer, $rows as xs:integer, $cols as xs:integer, $height as xs:integer, $width as xs:integer) as xs:anyAtomicType*\",description:\" Returns a sub-array from an array.\\n The inner array must be within the reference array\\n\",summary:\"<p> Returns a sub-array from an array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"reference\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the reference array</div>'},{name:\"reference_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows in the reference array</div>'},{name:\"reference_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of elements in the reference array row</div>'},{name:\"rows\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the relative row position where the sub-array starts. It must be a positive value, zero relative.</div>'},{name:\"cols\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the relative column position where the sub-array starts. It must be a positive value, zero relative.</div>'},{name:\"height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired height of sub-array. The sub-array must be inside the reference array.</div>'},{name:\"width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired width of sub-array. The sub-array must be inside the reference array.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"The sequence specifying the sub-array, row after row\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA rows or cols are negative</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA height or width are smaller than 1</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value reference array contains less elements than specified by reference_height and reference_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA the resulted sub-array is not completely contained inside reference array</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"transpose\",qname:\"excel:transpose\",signature:\"($array as xs:anyAtomicType+, $array_width as xs:integer, $array_height as xs:integer) as xs:anyAtomicType+\",description:\" Transposes an array. The rows become columns and vice versa.\\n\",summary:\"<p> Transposes an array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence specifying the array, row after row</div>'},{name:\"array_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of elements in a row</div>'},{name:\"array_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows in the array</div>'}],returns:{type:\"xs:anyAtomicType+\",description:\"The transposed array. It will be a sequence specifying an array, row after row. The result width is the input height. The result height is the input width.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value the array contains less elements than specified by array_width and array_height</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"vlookup\",qname:\"excel:vlookup\",signature:\"($lookup_value as xs:anyAtomicType, $table_array as xs:anyAtomicType+, $table_width as xs:integer, $table_height as xs:integer, $col_index_num as xs:integer) as xs:anyAtomicType\",description:\" Same as above, with range_lookup defaulted to true.\\n It finds the largest value that is less than or equal to lookup_value.\\n First column must be in ascending order.\\n\",summary:\"<p> Same as above, with range_lookup defaulted to true.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched. Allowed types are numeric, string, boolean. <p/> Boolean values are compared only with booleans. Numbers are compared only with numbers, if range_lookup is not zero. The other types are converted to string and compared to string value of all values.</div>'},{name:\"table_array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, row after row</div>'},{name:\"table_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"table_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows</div>'},{name:\"col_index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the row index, 1 based</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The value found, with original type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the array contains less elements than specified by table_height and table_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if col_index_num is outside the range 1 .. table_height</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup is true and the value searched is smaller than the first value in the first column</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=false and the value cannot be found</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"vlookup\",qname:\"excel:vlookup\",signature:\"($lookup_value as xs:anyAtomicType, $table_array as xs:anyAtomicType+, $table_width as xs:integer, $table_height as xs:integer, $col_index_num as xs:integer, $range_lookup as xs:boolean) as xs:anyAtomicType\",description:' Searches for a value in the first column of a table array\\n   and returns a value in the same row from another column in the table array.\\n <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Array is specified with 3 parameters:\\n <dt>table_array</dt> <dd>is a sequence of elements, first row first, then second row and so on</dd>\\n <dt>table_width</dt> <dd>specifies the number of elements in a row</dd>\\n <dt>table_height</dt> <dd>specifies the number of rows</dd></dl>\\n For wildchar matching, the XQuery regex matcher is used.\\n',summary:\"<p> Searches for a value in the first column of a table array\\n   and returns a value in the same row from another column in the table array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lookup_value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be searched. Allowed types are numeric, string, boolean. <p/> Boolean values are compared only with booleans. Numbers are compared only with numbers, if range_lookup is not zero. The other types are converted to string and compared to string value of all values.</div>'},{name:\"table_array\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values, row after row</div>'},{name:\"table_width\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of values in a row</div>'},{name:\"table_height\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of rows</div>'},{name:\"col_index_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the row index, 1 based</div>'},{name:\"range_lookup\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>specified the algorithm to use: <dt>true</dt> <dd> find approximative match. First column of array must be sorted in ascending order.</dd> <dt>false</dt> <dd> find exact match, using xquery regex. First column of array can be in any order.</dd></dl></div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The value found, with original type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the array contains less elements than specified by table_height and table_width</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if col_index_num is outside the range 1 .. table_height</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup is true and the value searched is smaller than the first value in the first column</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if range_lookup=false and the value cannot be found</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/datetime\":{ns:\"http://zorba.io/modules/datetime\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions to retrieve the current dateTime and to\\n parse dates and times.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In contrast to the current-dateTime functions specified in\\n <a href=\"http://www.w3.org/TR/xpath-functions-30/\">XQuery Functions and\\n Operators</a>, the functions in this module are nondeterministic, that is,\\n they do not return the current dateTime from the dynamic context, but return\\n the actual value.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dates and times are parsed according to the format given by\\n <a href=\"http://pubs.opengroup.org/onlinepubs/007904975/functions/strptime.html\">strptime</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">However, date and time values must be \"complete.\"</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For a date, the year and either month and day or day of the year must have\\n been parsed.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For a time, the hour must have been parsed.\\n (If either the minute, second, or timezone has not been parsed, they default\\n to 0.)</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For a dateTime, the parsing requirements of both date and time must be met.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When a locale is given,\\n it must be of the form {lang}[{sep}{country}[{encoding}]] where\\n {lang} is an ISO 639-1 2-letter or 639-2 3-letter language code,\\n {sep} is either \\'-\\' or \\'_\\',\\n {country} is an ISO 3166-1 2-letter country code,\\n and {encoding} is any string that begins with a \\'.\\'.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The {sep}, {country}, and {encoding} are optional;\\n {encoding} is always ignored.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Examples include: de, en-US, fr_CA, ru_RU.UTF-8.</p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.w3.org/TR/xpath-functions/#context</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/datetime\",prefix:\"datetime\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"current-date\",qname:\"datetime:current-date\",signature:\"() as xs:date external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gets the current date value in Universal time.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that this function is not stable: it returns the value of the date when\\n the function is invoked.</p>\\n',summary:\"<p>  Gets the current date value in Universal time.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:date\",description:\"the non-stable date value\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-dateTime\",qname:\"datetime:current-dateTime\",signature:\"() as xs:dateTimeStamp external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gets the current dateTime value in Universal time.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that this function is not stable: it returns the value of the date and\\n time when the function is invoked.</p>\\n',summary:\"<p>  Gets the current dateTime value in Universal time.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:dateTimeStamp\",description:\"the non-stable datetime value\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-time\",qname:\"datetime:current-time\",signature:\"() as xs:time external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the current time value in Universal time.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that this function is not stable: it returns the value of the time when\\n the function is invoked.</p>\\n',summary:\"<p>  Return the current time value in Universal time.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:time\",description:\"the non-stable time value\"},errors:[]},{isDocumented:!0,arity:1,name:\"millis-to-dateTime\",qname:\"datetime:millis-to-dateTime\",signature:\"($millis as xs:long) as xs:dateTime external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the given number of milliseconds since epoch into its corresponding\\n xs:dateTime.</p>\\n',summary:\"<p>  Converts the given number of milliseconds since epoch into its corresponding\\n xs:dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"millis\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of milliseconds since epoch.</div>'}],returns:{type:\"xs:dateTime\",description:\"Returns an xs:dateTime.\"},errors:[]},{isDocumented:!0,arity:2,name:\"parse-date\",qname:\"datetime:parse-date\",signature:\"($input as xs:string, $format as xs:string) as xs:date external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a date from a string in the current locale.</p>\\n',summary:\"<p>  Parses a date from a string in the current locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'}],returns:{type:\"xs:date\",description:\"Returns an xs:date.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if the date is incomplete.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"parse-date\",qname:\"datetime:parse-date\",signature:\"($input as xs:string, $format as xs:string, $locale as xs:string) as xs:date external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a date from a string in the given locale.</p>\\n',summary:\"<p>  Parses a date from a string in the given locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'},{name:\"locale\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The locale to use.</div>'}],returns:{type:\"xs:date\",description:\"Returns an xs:date.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if the date is incomplete.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_LOCALE if $locale is in an invalid format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNKNOWN_LOCALE if $locale is unknown.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNSUPPORTED_LOCALE if $locale is unsupported by the operating system.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse-dateTime\",qname:\"datetime:parse-dateTime\",signature:\"($input as xs:string, $format as xs:string) as xs:dateTime external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a dateTime from a string in the current locale.</p>\\n',summary:\"<p>  Parses a dateTime from a string in the current locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'}],returns:{type:\"xs:dateTime\",description:\"Returns an xs:dateTime.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if either the date or time is incomplete.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"parse-dateTime\",qname:\"datetime:parse-dateTime\",signature:\"($input as xs:string, $format as xs:string, $locale as xs:string) as xs:dateTime external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a dateTime from a string in the given locale.</p>\\n',summary:\"<p>  Parses a dateTime from a string in the given locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'},{name:\"locale\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The locale to use.</div>'}],returns:{type:\"xs:dateTime\",description:\"Returns an xs:dateTime.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if either the date or time is incomplete.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_LOCALE if $locale is in an invalid format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNKNOWN_LOCALE if $locale is unknown.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNSUPPORTED_LOCALE if $locale is unsupported by the operating system.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse-time\",qname:\"datetime:parse-time\",signature:\"($input as xs:string, $format as xs:string) as xs:time external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a time from a string in the current locale.</p>\\n',summary:\"<p>  Parses a time from a string in the current locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'}],returns:{type:\"xs:time\",description:\"Returns an xs:time.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if the hour has not been parsed.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"parse-time\",qname:\"datetime:parse-time\",signature:\"($input as xs:string, $format as xs:string, $locale as xs:string) as xs:time external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parses a time from a string in the given locale.</p>\\n',summary:\"<p>  Parses a time from a string in the given locale.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to parse.</div>'},{name:\"format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The format string containing zero or more conversion specifications and ordinary characters. All ordinary characters are matched exactly with the buffer; all whitespace characters match any amount of whitespace in the buffer.</div>'},{name:\"locale\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The locale to use.</div>'}],returns:{type:\"xs:time\",description:\"Returns an xs:time.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_SPECIFICATION if $format contains an invalid conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INSUFFICIENT_BUFFER if $input is insufficient for $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_VALUE if $input contains an invalid value for a conversion specification.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:LITERAL_MISMATCH if there is a literal characer mismatch between $input and $format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INCOMPLETE_DATE_OR_TIME if the hour has not been parsed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:INVALID_LOCALE if $locale is in an invalid format.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNKNOWN_LOCALE if $locale is unknown.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">datetime:UNSUPPORTED_LOCALE if $locale is unsupported by the operating system.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"timestamp\",qname:\"datetime:timestamp\",signature:\"() as xs:long external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gets the the number of milliseconds since epoch.</p>\\n',summary:\"<p>  Gets the the number of milliseconds since epoch.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:long\",description:\"the said number of milliseconds.\"},errors:[]},{isDocumented:!0,arity:0,name:\"utc-offset\",qname:\"datetime:utc-offset\",signature:\"() as xs:long external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gets the offset of the current timezone from Universal time.</p>\\n',summary:\"<p>  Gets the offset of the current timezone from Universal time.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:long\",description:\"the offset in seconds with positive values being east of the prime meridian.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/http/util/diagnostic\":{ns:\"http://www.28msec.com/modules/http/util/diagnostic\",description:\" This module provides utility functions to help with diagnostic analysis\\n / debugging of RESTful Apps or webapps.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://www.28msec.com/modules/http/util/diagnostic\",prefix:\"diagnostic\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.28msec.com/modules/http/util/multipart\",prefix:\"multipart\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"request\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"serialize-request-as-html\",qname:\"diagnostic:serialize-request-as-html\",signature:\"() as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of html elements listing all request\\n characteristics.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is helpful for debugging purposes. It can be used\\n to output request information within an HTML page.</p>\\n',summary:\"<p>  Returns a sequence of html elements listing all request\\n characteristics.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(*)*\",description:\"HTML elements describing the request\"},errors:[]},{isDocumented:!0,arity:0,name:\"serialize-request-as-txt\",qname:\"diagnostic:serialize-request-as-txt\",signature:\"() as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of xs:string listing all request\\n characteristics.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is helpful for debugging purposes. It can be used\\n to output request information as plan text.</p>\\n',summary:\"<p>  Returns a sequence of xs:string listing all request\\n characteristics.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"sequence of strings describing each characteristic of a request\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/credentials\":{ns:\"http://www.28msec.com/modules/credentials\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for storing credentials\\n using an AES-encrypted file the project configuration folder.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the credentials will be stored in the <tt>credentials</tt>\\n file in the <tt>config</tt> folder in the project root folder.\\n The credentials file is encrypted using 256bit AES encryption. The AES\\n key is computed using the project seed. If the project seed is changed the\\n credential store is re-encrypted transparently.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Each credential has an associated name and category.\\n Credentials can be retrieved specifying their name and category.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For each category, it is possible to specify the default credentials.\\n A category default credentials can then be easily retrieved. </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The name of credentials and categories can contain lowercase or\\n uppercase letters, digits, and the following special characters: \"_\" , \"-\",\\n \".\". Additionally it must not be empty and must start with a lowercase\\n or uppercase letter.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://jsoniq.org/errors\",prefix:\"jerr\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"add-credentials\",qname:\"credentials:add-credentials\",signature:\"($category as string, $name as string, $credentials as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds the given credentials to the credential store.\\n The credentials are not set as default.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If credentials  with the given name and category are already present an\\n error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:add-credentials(\"S3\", \"DataBucket\", { ... });\\n </pre>\\n </p>\\n',summary:\"<p>  Adds the given credentials to the credential store.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'},{name:\"credentials\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object containing the credentials data.</div>'}],returns:{type:\"object()\",description:\"the credential object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:EXIST if credentials with the given name and category are already present.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the specified credentials and category name correspond with the default MongoDB credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:TEST if a connection cannot be established using the specified credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"add-credentials\",qname:\"credentials:add-credentials\",signature:\"($category as string, $name as string, $credentials as object(), $default as boolean) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds the given credentials to the credential store,\\n either as default or not.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If credentials  with the given name and category are already present an\\n error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:add-credentials(\"S3\", \"DataBucket\", { ... }, true);\\n </pre>\\n </p>\\n',summary:\"<p>  Adds the given credentials to the credential store,\\n either as default or not.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'},{name:\"credentials\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object containing the credentials data.</div>'},{name:\"default\",type:\"boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether the credentials will be default or not.</div>'}],returns:{type:\"object()\",description:\"the credential object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:EXIST if credentials with the given name and category are already present.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if trying to add the default MongoDB credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:TEST if a connection cannot be established using the specified credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"credentials\",qname:\"credentials:credentials\",signature:\"($category as string) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the given category\\'s default credentials, if any.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If no default credentials are present for the given category\\n the empty sequence is returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:credentials(\"S3\")\\n </pre>\\n </p>\\n',summary:\"<p>  Returns the given category's default credentials, if any.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The category name.</div>'}],returns:{type:\"object()?\",description:\"The specified category default credentials, if any.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the specified category is MongoDB</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"credentials\",qname:\"credentials:credentials\",signature:\"($category as string, $name as string) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the specified credentials, if present in the credential store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the specified credentials are not present the empty sequence is returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:credentials(\"S3\", \"DataBucket\")\\n </pre>\\n </p>\\n',summary:\"<p>  Returns the specified credentials, if present in the credential store.</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'}],returns:{type:\"object()?\",description:\"The specified credentials, if present.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-categories\",qname:\"credentials:list-categories\",signature:\"() as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the credentials categories in the credentials store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If no credentials are stored the empty sequence is returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:list-categories()\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned array contains the name of each distinct credential category.</p>\\n',summary:\"<p>  Lists all the credentials categories in the credentials store.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"array()\",description:\"An array of all the distinct credentials categories in the credentials store.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-category-credentials\",qname:\"credentials:list-category-credentials\",signature:\"($category-name as string) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the credentials of the specified category in the\\n credentials store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If no credentials for the given category are stored the empty\\n sequence is returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:list-category-credentials(\"category-name\")\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned array contains one object for each credential. Each object has\\n the following structure:\\n <pre>\\n {\\n   \"category\": \"category-name\",\\n   \"name\": \"credential-name\",\\n   \"default\": true\\n }\\n </pre>\\n Specifically the fields of each object have the following meaning:\\n <ul>\\n  <li>category: the name of the credentials category (string)</li>\\n  <li>name: the name of the credentials (string)</li>\\n  <li>default: whether the credentials are the default credentials in\\n      their category (boolean)</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all the credentials of the specified category in the\\n credentials store.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"category-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'}],returns:{type:\"array()\",description:\"An array of all the credentials of the specified category in the credentials store.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"list-credentials\",qname:\"credentials:list-credentials\",signature:\"() as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the credentials in the credentials store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If no credentials are stored the empty sequence is returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:list-credentials()\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned array contains one object for each credential. Each object has\\n the following structure:\\n <pre>\\n {\\n   \"category\": \"category-name\",\\n   \"name\": \"credential-name\",\\n   \"default\": true\\n }\\n </pre>\\n Specifically the fields of each object have the following meaning:\\n <ul>\\n  <li>category: the name of the credentials category (string)</li>\\n  <li>name: the name of the credentials (string)</li>\\n  <li>default: whether the credentials are the default credentials in\\n      their category (boolean)</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all the credentials in the credentials store.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"array()\",description:\"An array of all credentials in the credentials store.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"make-default\",qname:\"credentials:make-default\",signature:\"($category as string, $name as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Makes the specified credentials the default for their category.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It is not allowed to call this method on credentials in the \"MongoDB\" category.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the specified credentials are not present an error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:make-default(\"S3\", \"DataBucket\");\\n </pre>\\n </p>\\n',summary:\"<p>  Makes the specified credentials the default for their category.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NOT-EXIST if no credentials with the given name and category are present.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the specified category is MongoDB</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"remove-credentials\",qname:\"credentials:remove-credentials\",signature:\"($category as string, $name as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Removes the specified credentials from the credential store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If no credentials with the given name and category are present\\n in the category store an error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:remove-credentials(\"S3\", \"DataBucket\");\\n </pre>\\n </p>\\n',summary:\"<p>  Removes the specified credentials from the credential store.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NOT-EXIST if no credentials with the given name and category exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the specified credentials and category name correspond with the default MongoDB credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"update-credentials\",qname:\"credentials:update-credentials\",signature:\"($category as string, $name as string, $new-default as boolean?, $new-name as string?, $new-credentials as object()?) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Updates the specified credentials in the credential store.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It is possible to specify whether the credentials should become or stop being the\\n default credentials in their category, rename the credentials or change the credentials\\n object. These three changes are specified by means of the $new-default, $new-name and\\n $new-credentials parameter. If the corresponding parameter is the empty sequence the\\n corresponding property will not be changed.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example the following query renames the \"DataBucket\" credentials in the \"S3\"\\n category as \"Bucket\":\\n <pre>\\n import module namespace credentials = \"http://www.28msec.com/modules/credentials\";\\n credentials:update-credentials(\"S3\", \"DataBucket\", (), \"Bucket\", () );\\n </pre>\\n </p>\\n',summary:\"<p>  Updates the specified credentials in the credential store.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"category\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials category name.</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The credentials name.</div>'},{name:\"new-default\",type:\"boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether the credentials should become/stop being the default credentials in their category. If it is an empty sequence the current default property will not be changed.</div>'},{name:\"new-name\",type:\"string\",occurrence:\"?\",description:\"\"},{name:\"new-credentials\",type:\"object()\",occurrence:\"?\",description:\"\"}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NOT-EXIST if credentials with the given name and category do not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:EXIST if credentials with the given new name and category are already present.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:NAME if the credentials or category name is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:MONGO-DEFAULT if the specified credentials or category name correspond with the default MongoDB credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:TEST if a connection cannot be established using the specified credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">credentials:CREDENTIALS-STORE if an internal error arises accessing the crendentials store</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/parallelism\":{ns:\"http://www.28msec.com/modules/parallelism\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for executing FLWOR queries in parallel.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">There are two kinds of parallel jobs: map jobs and shuffle jobs.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A map job runs a mapping function on the items of an input collection. The input\\n collection is chunked and the mapping function is called on each chunk in parallel.\\n The results are either inserted in a single collection, or on one ouptut collection\\n for each chunk.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A shuffle job shuffles the items of an input collection to several output collections.\\n The input collection is chunked and each chunk is processed in parallel.\\n The selection of the output collection for each item is done with a shuffling function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It is also possible to run a map or shuffle job on the output of another map or shuffle\\n job (piping).\\n Keep in mind though that if an intermediate output is in a\\n single collection, no chunking can be done: only the first job of the pipeline can chunk\\n its input.\\n Hence, for performance, it makes sense that all intermediate jobs\\n in the pipeline (except the last one, although not compulsory) output to automatically\\n generated temporary collections rather than a single collection. That way, the next job\\n can be executed on these collections in parallel.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Map jobs allow the parallel execution of \"simple\" FLWORs: a for on a big collection, let clauses,\\n small for clauses, where clauses.\\n Map-shuffle-map piping allows the parallel execution of FLWORs containing a group by clause.\\n Jobs can be composed in many ways, for example map-map-shuffle-map-shuffle-map. This way,\\n FLWORs with several group by clauses can be parallelized.\\n In some circumstances, FLWORs with order by clauses (using bucket sort) can also be\\n parallelized, but one should keep in mind that collections are not ordered so that\\n any ordering within a map job is susceptible to be lost in the output.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Julien Ribon</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/asynchronous-jobs\",prefix:\"job\"},{uri:\"http://www.28msec.com/modules/parallelism\",prefix:\"parallel\"},{uri:\"http://zorba.io/modules/random\",prefix:\"rand\"},{uri:\"http://www.28msec.com/modules/store\",prefix:\"store\"}],functions:[{isDocumented:!0,arity:1,name:\"job-statuses\",qname:\"parallel:job-statuses\",signature:\"($id as xs:string) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the statuses of the underlying asynchronous jobs, as an object\\n indicating the number of chunks in each status.</p>\\n',summary:\"<p>  Returns the statuses of the underlying asynchronous jobs, as an object\\n indicating the number of chunks in each status.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The id of the parallel job to query, as it was returned by map or shuffle.</div>'}],returns:{type:\"object()?\",description:\"The statuses of the underlying jobs. The empty sequence if the parallel job does not exist.\"},errors:[]},{isDocumented:!0,arity:2,name:\"map\",qname:\"parallel:map\",signature:\"($input as xs:string, $function as function (item()*) as item()*) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules a parallel map job on a collection or on the output of another\\n parallel job.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The name of the output collections are randomly generated (one for\\n each chunk and start with <tt>_28.temporary</tt>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example of usage:</p>\\n parallel:map(\"input\", my:function#1)\\n',summary:\"<p>  Schedules a parallel map job on a collection or on the output of another\\n parallel job.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to process, or the id of a parallel job of which the output will be taken.</div>'},{name:\"function\",type:\"function (item()*) as item()*\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the function which is run in parallel on the collection\\'s contents.</div>'}],returns:{type:\"xs:string\",description:\"A parallel job id that can be used to query the parallel job's properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JPDY0001 if the input is not an available collection or a parallel job id.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"map\",qname:\"parallel:map\",signature:\"($input as xs:string, $function as function (item()*) as item()*, $options as object()?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules a parallel map job on a collection or on the output of another\\n parallel job.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the parallel job. Allowed options are:\\n <ul>\\n   <li><tt>output-collection as string</tt>: the name of the collection in\\n     which the output of the executed query is stored. If not specified,\\n     the result of the query will be stored in a collection withing the\\n     MongoDB database associated with the project. The name of the\\n     collection is randomly generated and starts with <tt>_28.temporary</tt>\\n   </li>\\n   <li><tt>chunk-size</tt>: the size of the chunks the collection must be split\\n   into, if it is not already sharded (default: MongoDB sharding, or 1000).\\n   </li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example of usage:</p>\\n parallel:map(\"input\", my:function#1, { \"chunk-size\" : xs:int(1000) })\\n parallel:map(\"input\",\\n              my:function#1,\\n              {\\n                \"chunk-size\" : xs:int(1000),\\n                \"output-collection\" : output\"\\n              }\\n )\\n',summary:\"<p>  Schedules a parallel map job on a collection or on the output of another\\n parallel job.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to process, or the id of a parallel job of which the output will be taken.</div>'},{name:\"function\",type:\"function (item()*) as item()*\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The function which is run in parallel on the collection\\'s contents.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the parallel job.</div>'}],returns:{type:\"xs:string\",description:\"A parallel job id that can be used to query the parallel job's properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JPDY0001 if the input is not an available collection or a parallel job id.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"output-collections\",qname:\"parallel:output-collections\",signature:\"($id as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the output collections of the specified parallel job.</p>\\n',summary:\"<p>  Returns the output collections of the specified parallel job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The id of the parallel job to query, as it was returned by map or shuffle.</div>'}],returns:{type:\"xs:string*\",description:\"The names of the output collections to which the corresponding parallel job writes. The empty sequence if the job does not exist.\"},errors:[]},{isDocumented:!0,arity:1,name:\"results\",qname:\"parallel:results\",signature:\"($id as xs:string) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the results of the specified parallel job.</p>\\n',summary:\"<p>  Returns the results of the specified parallel job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The id of the parallel job to query, as it was returned by map or shuffle.</div>'}],returns:{type:\"item()*\",description:\"The structured items output by the corresponding parallel job. The empty sequence if the job does not exist.\"},errors:[]},{isDocumented:!0,arity:2,name:\"shuffle\",qname:\"parallel:shuffle\",signature:\"($input as xs:string, $function as function (item()) as xs:integer) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules a parallel shuffle job on a collection or on the output of another\\n parallel job.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The output collection for each item is determined by calling the shuffle function,\\n which gives an integer i. The i-th output collection\\n is then taken. If necessary, a modulo operation is done\\n to make sure that the integer is comprised between 1 and the number of output collections.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The name of the output collections are randomly generated (10 of them) and\\n start with <tt>_28.temporary</tt>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example of usage:</p>\\n parallel:shuffle(\"input\", my:function#1)\\n',summary:\"<p>  Schedules a parallel shuffle job on a collection or on the output of another\\n parallel job.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to process, or the id of a parallel job of which the output will be taken.</div>'},{name:\"function\",type:\"function (item()) as xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the function which is run on each item to determine where it is shuffled to.</div>'}],returns:{type:\"xs:string\",description:\"A parallel job id that can be used to query the parallel job's properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JPDY0001 if the input is not an available collection or a parallel job id.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"shuffle\",qname:\"parallel:shuffle\",signature:\"($input as item(), $function as function (item()) as xs:integer, $options as object()?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules a parallel shuffle job on a collection or on the output of another\\n parallel job.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The output collection for each item is determined by calling the shuffle function,\\n which gives an integer i. The i-th output collection\\n is then taken. If necessary, a modulo operation is done\\n to make sure that the integer is comprised between 1 and the number of output collections.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the parallel shuffle job. Allowed options are:\\n <ul>\\n   <li><tt>number-of-output-collections as integer</tt>: the number of output collections\\n     to automatically generate if none are provided. The default value is 10. An error is raised\\n     if the provided value is not positive.\\n   </li>\\n   <li><tt>output-collections as array</tt>: an array with the names of the collections in\\n     which the items of the input collections are shuffled. If not specified,\\n     these collections will be automatically generated (as many as specified in the\\n     <tt>number-of-output-collections</tt> option) in the\\n     MongoDB database associated with the project. The name of the\\n     collections are randomly generated and start with <tt>_28.temporary</tt>\\n   </li>\\n   <li><tt>chunk-size</tt>: the size of the chunks the collection must be split\\n   into, if it is not already sharded (default: MongoDB sharding, or 1000).\\n   </li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example of usage:</p>\\n parallel:shuffle(\"input\", my:function#1, { \"chunk-size\" : xs:int(1000) })\\n parallel:shuffle(\"input\",\\n                  my:function#1,\\n                  {\\n                    \"chunk-size\" : xs:int(1000),\\n                    \"output-collections\" : [ \"output1\", \"output2\" ]\\n                  }\\n )\\n parallel:shuffle(\"input\",\\n                  my:function#1,\\n                  {\\n                    \"number-of-output-collections\" : 20\\n                  }\\n )\\n',summary:\"<p>  Schedules a parallel shuffle job on a collection or on the output of another\\n parallel job.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to process, or the id of a parallel job of which the output will be taken.</div>'},{name:\"function\",type:\"function (item()) as xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the function which is run on each item to determine where it is shuffled to.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the parallel shuffle job.</div>'}],returns:{type:\"xs:string\",description:\"A parallel job id that can be used to query the parallel job's properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JPDY0001 if the input is not an available collection or a parallel job id.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCA0002 if number-of-output-collections is not a positive integer.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"status\",qname:\"parallel:status\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the general status of the parallel job.</p>\\n',summary:\"<p>  Returns the general status of the parallel job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> id of the parallel job to query, as it was returned by map or shuffle.</div>'}],returns:{type:\"xs:string?\",description:\"The status of the corresponding parallel job. The empty sequence if the job does not exist.\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/image/graphviz\":{ns:\"http://www.zorba-xquery.com/modules/image/graphviz\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Module that provides functions for generating SVG graphs.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The module provides two function for generating graphs given in the :\\n <ul><li>DOT language (see <a href=\"http://www.graphviz.org/\">\\n http://www.graphviz.org</a>)</li><li>or in the XML-based Graph eXchange\\n Language (see <a href=\"http://www.gupro.de/GXL/\">http://www.gupro.de/GXL/</a>),\\n respectively.</li></ul>\\n Both functions use the Graphviz Visualization Library in order to\\n layout and render the graphs. As a result, both return a sequence\\n of (document)-nodes (one for each input graph).\\n These nodes are instances of the Scalable Vector Graphics (SVG) format.\\n SVG is a language for describing two-dimensional graphics and\\n graphical applications in XML. More information about SVG can\\n be found at <a href=\"http://www.w3.org/Graphics/SVG/\">http://www.w3.org/Graphics/SVG/</a>.\\n As second parameters, both functions take a sequence of strings that\\n are parameters for the graph generation and rendering algorithms.\\n Currently, only the empty-sequence is allowed here.\\n These parameters exist for future use.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that this feature is only available on Unix-based\\n platforms (i.e. not on Windows).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.28msec.com/home/index\">28msec</a></xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/image/graphviz\",prefix:\"gr\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"dot\",qname:\"gr:dot\",signature:\"($dot as xs:string*, $params as xs:string*) as node()* external\",description:' Layout one ore more graphs given in the DOT language and render\\n them as SVG. For example,\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><code>\\n dot(\"digraph mygraph { p -&gt; q }\", ())\\n </code></p>\\n',summary:\"<p> Layout one ore more graphs given in the DOT language and render\\n them as SVG.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dot\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A dot description of the graph to render.</div>'},{name:\"params\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Parameters to configure the layout and rendering process. Currently, only the empty-sequence is allowed here.</div>'}],returns:{type:\"node()*\",description:\"A graph for each item in the sequence given using the first parameter. The result sequence consists of items which are instance of the SVG data model.\"},errors:[]},{isDocumented:!0,arity:2,name:\"gxl\",qname:\"gr:gxl\",signature:\"($gxl as node()*, $params as xs:string*) as node()* external\",description:\" Layout one ore more graphs given in the GXL language and render\\n them as SVG.\\n\",summary:\"<p> Layout one ore more graphs given in the GXL language and render\\n them as SVG.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"gxl\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A GXL description of the graph to render.</div>'},{name:\"params\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Parameters to configure the layout and rendering process. Currently, only the empty-sequence is allowed here.</div>'}],returns:{type:\"node()*\",description:\"A graph for each item in the sequence given using the first parameter. The result sequence consists of items which are instance of the SVG data model.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/data-cleaning/token-based-string-similarity\":{ns:\"http://zorba.io/modules/data-cleaning/token-based-string-similarity\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides token-based string similarity functions that view strings\\n as sets or multi-sets of tokens and use set-related properties to compute similarity scores.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens correspond to groups of characters extracted from the strings being compared, such as\\n individual words or character n-grams.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">These functions are particularly useful for matching near duplicate strings in cases where\\n typographical conventions often lead to rearrangement of words (e.g., \"John Smith\" versus \"Smith, John\").</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation,\\n although the module requires the trigonometic functions of XQuery 3.0 or a math extension\\n function such as sqrt($x as numeric) for computing the square root.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"math\"},{uri:\"http://zorba.io/modules/data-cleaning/set-similarity\",prefix:\"set\"},{uri:\"http://zorba.io/modules/data-cleaning/token-based-string-similarity\",prefix:\"simt\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"cosine-ngrams\",qname:\"simt:cosine-ngrams\",signature:\"($s1 as xs:string, $s2 as xs:string, $n as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of character n-grams extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The n-grams from each string are weighted according to their occurence frequency (i.e., weighted according to\\n the term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> cosine-ngrams(\"DWAYNE\", \"DUANE\", 2 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.2401922307076307 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of character n-grams extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"n\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when extracting n-grams.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets n-grams extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"cosine-tokens\",qname:\"simt:cosine-tokens\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings. The tokens\\n from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> cosine-tokens(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\" ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.408248290463863 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:2,name:\"cosine\",qname:\"simt:cosine\",signature:\"($desc1 as xs:string*, $desc2 as xs:string*) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Auxiliary function for computing the cosine similarity coefficient between strings,\\n using stringdescriptors based on sets of character n-grams or sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> cosine( (\"aa\",\"bb\") , (\"bb\",\"aa\")) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 1.0 </pre></p>\\n',summary:\"<p>  Auxiliary function for computing the cosine similarity coefficient between strings,\\n using stringdescriptors based on sets of character n-grams or sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"desc1\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The descriptor for the first string.</div>'},{name:\"desc2\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The descriptor for the second string.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the descriptors for the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"dice-ngrams\",qname:\"simt:dice-ngrams\",signature:\"($s1 as xs:string, $s2 as xs:string, $n as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Dice similarity coefficient between sets of character n-grams extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> dice-ngrams(\"DWAYNE\", \"DUANE\", 2 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.4615384615384616 </pre></p>\\n',summary:\"<p>  Returns the Dice similarity coefficient between sets of character n-grams extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"n\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when extracting n-grams.</div>'}],returns:{type:\"xs:double\",description:\"The Dice similarity coefficient between the sets of character n-grams extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"dice-tokens\",qname:\"simt:dice-tokens\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Dice similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> dice-tokens(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\" ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.4 </pre></p>\\n',summary:\"<p>  Returns the Dice similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The Dice similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"jaccard-ngrams\",qname:\"simt:jaccard-ngrams\",signature:\"($s1 as xs:string, $s2 as xs:string, $n as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Jaccard similarity coefficient between sets of character n-grams extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> jaccard-ngrams(\"DWAYNE\", \"DUANE\", 2 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.3 </pre></p>\\n',summary:\"<p>  Returns the Jaccard similarity coefficient between sets of character n-grams extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"n\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when extracting n-grams.</div>'}],returns:{type:\"xs:double\",description:\"The Jaccard similarity coefficient between the sets of character n-grams extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"jaccard-tokens\",qname:\"simt:jaccard-tokens\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Jaccard similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> jaccard-tokens(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\" ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.25 </pre></p>\\n',summary:\"<p>  Returns the Jaccard similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The Jaccard similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:2,name:\"ngrams\",qname:\"simt:ngrams\",signature:\"($s as xs:string, $n as xs:integer) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the individual character n-grams forming a string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> ngrams(\"FLWOR\", 2 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (\"_F\" , \"FL\" , \"LW\" , \"WO\" , \"LW\" , \"WO\" , \"OR\" , \"R_\") </pre></p>\\n',summary:\"<p>  Returns the individual character n-grams forming a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The input string.</div>'},{name:\"n\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when extracting n-grams.</div>'}],returns:{type:\"xs:string*\",description:\"The sequence of strings with the extracted n-grams.\"},errors:[]},{isDocumented:!0,arity:3,name:\"overlap-ngrams\",qname:\"simt:overlap-ngrams\",signature:\"($s1 as xs:string, $s2 as xs:string, $n as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the overlap similarity coefficient between sets of character n-grams extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> overlap-ngrams(\"DWAYNE\", \"DUANE\", 2 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.5 </pre></p>\\n',summary:\"<p>  Returns the overlap similarity coefficient between sets of character n-grams extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"n\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when extracting n-grams.</div>'}],returns:{type:\"xs:double\",description:\"The overlap similarity coefficient between the sets of character n-grams extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"overlap-tokens\",qname:\"simt:overlap-tokens\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the overlap similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> overlap-tokens(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\" ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.5 </pre></p>\\n',summary:\"<p>  Returns the overlap similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The overlap similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/image/paint\":{ns:\"http://www.zorba-xquery.com/modules/image/paint\",description:' This module provides a function to extend an image with additional shapes.\\n Fully supported image formats are:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>GIF</li>\\n   <li>JPEG</li>\\n   <li>PNG</li>\\n   <li>TIFF</li>\\n   <li>BMP</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The errors raised by functions of this module have the namespace\\n <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Thomas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/image/error\",prefix:\"ierr\"},{uri:\"http://www.zorba-xquery.com/modules/image/image\",prefix:\"img\"},{uri:\"http://www.zorba-xquery.com/modules/image/paint\",prefix:\"paint\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"paint\",qname:\"paint:paint\",signature:\"($image as xs:base64Binary, $shapes as element(*)*) as xs:base64Binary\",description:' Extends the passed image with a sequence of shapes.\\n The shapes are passed as a sequence of elements.\\n The possibilities for shape elements are:\\n    <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n      <li> line:\\n        <pre class=\"brush: xml\">\\n          &lt;img:line&gt;\\n            &lt;img:start&gt;&lt;img:x&gt;-20&lt;/img:x&gt;&lt;img:y&gt;-20&lt;/img:y&gt;&lt;/img:start&gt;\\n            &lt;img:end&gt;&lt;img:x&gt;80&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:end&gt;\\n          &lt;/img:line&gt;</pre>\\n      </li>\\n       <li> polyline:\\n         <pre class=\"brush: xml\">\\n           &lt;img:polyLine&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;200&lt;/img:x&gt;&lt;img:y&gt;200&lt;/img:y&gt;&lt;/point&gt;\\n           &lt;/img:polyLine&gt;\\n         </pre>\\n       </li>\\n       <li> stroked polyline:\\n         <pre class=\"brush: xml\">\\n           &lt;img:strokedPolyLine&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:strokeLength&gt;5&lt;/img:strokeLength&gt;&lt;img:gapLength&gt;2&lt;/img:gapLength&gt;\\n           &lt;/img:strokedPolyLine&gt;\\n         </pre>\\n       </li>\\n       <li> rectangle:\\n         <pre class=\"brush: xml\">\\n           &lt;img:rectangle&gt;\\n             &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;\\n             &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;\\n           &lt;/img:rectangle&gt;\\n         </pre>\\n       </li>\\n       <li> rounded rectangle:\\n         <pre class=\"brush: xml\">\\n           &lt;img:roundedRectangle&gt;\\n             &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;\\n             &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;\\n             &lt;img:cornerWidth&gt;10&lt;/img:cornerWidth&gt;&lt;img:cornerHeight&gt;10&lt;/img:cornerHeight&gt;\\n           &lt;/img:roundedRectangle&gt;\\n         </pre>\\n       </li>\\n       <li> circle:\\n         <pre class=\"brush: xml\">\\n           &lt;img:circle&gt;\\n             &lt;img:origin&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:origin&gt;\\n             &lt;img:perimeter&gt;5&lt;/img:perimeter&gt;\\n           &lt;/img:circle&gt;\\n         </pre>\\n       </li>\\n       <li> ellipse:\\n         <pre class=\"brush: xml\">\\n           &lt;img:ellipse&gt;\\n             &lt;img:origin&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:origin&gt;\\n             &lt;img:perimeterX&gt;30&lt;/img:perimeterX&gt;&lt;img:perimeterY&gt;20&lt;/img:perimeterY&gt;\\n           &lt;/img:ellipse&gt;\\n         </pre>\\n       </li>\\n       <li> arc:\\n         <pre class=\"brush: xml\">\\n           &lt;img:arc&gt;\\n             &lt;img:origin&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:origin&gt;\\n             &lt;img:perimeterX&gt;10&lt;/img:perimeterX&gt;&lt;img:perimeterY&gt;20&lt;/img:perimeterY&gt;\\n             &lt;img:startDegrees&gt;180&lt;/img:startDegrees&gt;&lt;img:endDegrees&gt;270&lt;/img:endDegrees&gt;\\n           &lt;/img:arc&gt;\\n         </pre>\\n       </li>\\n       <li> polygon:\\n         <pre class=\"brush: xml\">\\n           &lt;img:polygon&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;10&lt;/img:x&gt;&lt;img:y&gt;10&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;40&lt;/img:x&gt;&lt;img:y&gt;80&lt;/img:y&gt;&lt;/img:point&gt;\\n             &lt;img:point&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;30&lt;/img:y&gt;&lt;/img:point&gt;\\n           &lt;/img:polygon&gt;\\n         </pre>\\n       </li>\\n       <li> text:\\n         <pre class=\"brush: xml\">\\n           &lt;img:text&gt;\\n             &lt;img:origin&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:origin&gt;\\n             &lt;img:text&gt;Hello Zorba&lt;/img:text&gt;&lt;img:font&gt;&lt;/img:font&gt;&lt;img:font-size&gt;12&lt;/img:font-size&gt;\\n           &lt;/img:text&gt;\\n         </pre>\\n       </li>\\n     </ul>\\n Optionally, each of the shape elements can contain elements to define the stroke with, stroke color, fill color, and anti-aliasing.\\n E.g.:\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <pre class=\"brush: xml\">\\n     &lt;img:rectangle&gt;\\n       &lt;img:strokeWidth&gt;5&lt;/img:strokeWidth&gt;\\n       &lt;img:strokeColor&gt;#00AF00&lt;/img:strokeColor&gt;\\n       &lt;img:fillColor&gt;#A10000&lt;/img:fillColor&gt;\\n       &lt;img:antiAliasing&gt;true&lt;/img:antiAliasing&gt;\\n       &lt;img:upperLeft&gt;&lt;img:x&gt;20&lt;/img:x&gt;&lt;img:y&gt;20&lt;/img:y&gt;&lt;/img:upperLeft&gt;\\n       &lt;img:lowerRight&gt;&lt;img:x&gt;50&lt;/img:x&gt;&lt;img:y&gt;50&lt;/img:y&gt;&lt;/img:lowerRight&gt;\\n     &lt;/img:rectangle&gt;\\n   </pre>\\n  </p>\\n',summary:\"<p> Extends the passed image with a sequence of shapes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the passed image</div>'},{name:\"shapes\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the shapes</div>'}],returns:{type:\"xs:base64Binary\",description:\"image with additional shapes\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 the passed image is invalid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 one of the passed shape elements is invalid.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/fetch\":{ns:\"http://zorba.io/modules/fetch\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions to fetch the content of a resource identified\\n by a URI. For example, it fetches the content of file or http resources.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In order to retrieve such content, the functions use the\\n URI resolution and URL resolver process as documented at\\n <a href=\"../zorba/uriresolvers.html\">\\n URI Resolvers</a>.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/fetch\",prefix:\"fetch\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"content-binary\",qname:\"fetch:content-binary\",signature:\"($uri as xs:string) as xs:base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tries to fetch the resource referred to by the given URI and\\n returning it as base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It queries all URI mappers and resolvers with kind\\n <tt>EntityData::SOME_CONTENT</tt>.</p>\\n',summary:\"<p>  Tries to fetch the resource referred to by the given URI and\\n returning it as base64Binary.</p>\",annotation_str:\" %an:streamable\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"streamable\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the resource to fetch.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the resource referred to by the given URI as streamble base64Binary.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:URI_UNRESOLVED_OR_NOSTREAM if the URI could not be resolved or did not resolve to a <tt>StreamResource</tt>.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"content-binary\",qname:\"fetch:content-binary\",signature:\"($uri as xs:string, $entity-kind as xs:string) as xs:base64Binary external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tries to fetch the resource referred to by the given URI and\\n returning it as base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It queries all URI mappers and resolvers with kind the specified\\n entity kind.</p>\\n',summary:\"<p>  Tries to fetch the resource referred to by the given URI and\\n returning it as base64Binary.</p>\",annotation_str:\" %an:streamable\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"streamable\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the resource to fetch.</div>'},{name:\"entity-kind\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the kind of resource to fetch.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the resource referred to by the given URI as streamble base64Binary.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:URI_UNRESOLVED_OR_NOSTREAM if the URI could not be resolved or did not resolve to a <tt>StreamResource</tt>.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"content\",qname:\"fetch:content\",signature:\"($uri as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tries to fetch the resource referred to by the given URI.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It queries all URI mappers and resolvers with kind\\n <tt>EntityData::SOME_CONTENT</tt>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The content is assumed to be UTF-8 encoded.</p>\\n',summary:\"<p>  Tries to fetch the resource referred to by the given URI.</p>\",annotation_str:\" %an:streamable\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"streamable\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the resource to fetch.</div>'}],returns:{type:\"xs:string\",description:\"the resource referred to by the given URI as streamble string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:URI_UNRESOLVED_OR_NOSTREAM if the URI could not be resolved or did not resolve to a <tt>StreamResource</tt>.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"content\",qname:\"fetch:content\",signature:\"($uri as xs:string, $entity-kind as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tries to fetch the resource referred to by the given URI.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It queries all URI mappers and resolvers with kind the specified\\n entity kind.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The content is assumed to be UTF-8 encoded.</p>\\n',summary:\"<p>  Tries to fetch the resource referred to by the given URI.</p>\",annotation_str:\" %an:streamable\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"streamable\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the resource to fetch.</div>'},{name:\"entity-kind\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the kind of resource to fetch.</div>'}],returns:{type:\"xs:string\",description:\"the resource referred to by the given URI as streamble string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:URI_NOT_RESOLVED_OR_NOSTREAM if the URI could not be resolved or did not resolve to a <tt>StreamResource</tt>.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"content\",qname:\"fetch:content\",signature:\"($uri as xs:string, $entity-kind as xs:string, $encoding as xs:string) as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tries to fetch the resource referred to by the given URI.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It queries all URI mappers and resolvers with kind the specified\\n entity kind.</p>\\n',summary:\"<p>  Tries to fetch the resource referred to by the given URI.</p>\",annotation_str:\" %an:streamable\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"streamable\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the resource to fetch.</div>'},{name:\"entity-kind\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the kind of resource to fetch.</div>'},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the encoding of the content</div>'}],returns:{type:\"xs:string\",description:\"the resource referred to by the given URI as streamble string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:URI_UNRESOLVED_OR_NOSTREAM if the URI could not be resolved or did not resolve to a <tt>StreamResource</tt>.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:CHARSET_UNKNOWN if the given encoding is invalid or not supported.</xqdoc:error>']}],variables:[]},\"http://xbrl.io/modules/bizql/concept-maps\":{ns:\"http://xbrl.io/modules/bizql/concept-maps\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for storing, retrieving, and modifying\\n concept maps. Concept maps can be used in BizQL queries.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A concept map is a network of concepts that can be contained in a report schema.\\n It maps \"virtual\" concepts to reported concepts, which allows comparison across\\n archives that use different vocabularies (so-called extension facts).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve the concept map associated with each report\\n schema. You can also query for facts by making implicitly use of the mapping.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/concept-maps\",prefix:\"concept-maps\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/networks\",prefix:\"networks\"},{uri:\"http://xbrl.io/modules/bizql/report-schemas\",prefix:\"report-schemas\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"concept-maps\",qname:\"concept-maps:concept-maps\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all concept maps.</p>\\n',summary:\"<p>  Retrieves all concept maps.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all concept maps.\"},errors:[]},{isDocumented:!0,arity:1,name:\"concept-maps\",qname:\"concept-maps:concept-maps\",signature:\"($report-schemas-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the concept maps from the given report schemas.</p>\\n',summary:\"<p>  Return the concept maps from the given report schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"report-schemas-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"the concept maps from the report schemas.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts-for-archives-and-concepts\",qname:\"concept-maps:facts-for-archives-and-concepts\",signature:\"($archive-or-ids as item()*, $concepts as string*, $concept-maps as object()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Resolves the supplied concepts according to the supplied concept map.</p>\\n',summary:\"<p>  Resolves the supplied concepts according to the supplied concept map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or AIDs (or $concept-maps:ALL_OF_THEM to do no filter on archives).</div>'},{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of concept names (or $concept-maps:ALL_OF_THEM to do no filter on concepts).</div>'},{name:\"concept-maps\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of concept maps.</div>'}],returns:{type:\"object()*\",description:\"the resolved facts, with the concept name overriden with the new name.\"},errors:[]},{isDocumented:!0,arity:4,name:\"facts-for-archives-and-concepts\",qname:\"concept-maps:facts-for-archives-and-concepts\",signature:\"($archive-or-ids as item()*, $concepts as string*, $concept-maps as object()+, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Resolves the supplied concepts according to the supplied concept map.</p>\\n',summary:\"<p>  Resolves the supplied concepts according to the supplied concept map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or AIDs (or $concept-maps:ALL_OF_THEM to do no filter on archives).</div>'},{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of concept names (or $concept-maps:ALL_OF_THEM to do no filter on concepts).</div>'},{name:\"concept-maps\",type:\"object()\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of concept maps.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"the resolved facts, with the concept name overriden with the new name.\"},errors:[]}],variables:[{name:\"concept-maps:ALL_OF_THEM\",type:\"boolean\",description:\" Joker for all archives or all concepts.\\n\"}]},\"http://www.28msec.com/modules/http/cookie\":{ns:\"http://www.28msec.com/modules/http/cookie\",description:\" The Sausalito Cookie module provides function to manipulate\\n HTTP-Cookies.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/http/cookie\",prefix:\"cookie\"},{uri:\"http://www.28msec.com/modules/http/cookie\",prefix:\"cookie-schema\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://www.zorba-xquery.com/modules/cryptography/hmac\",prefix:\"sec\"},{uri:\"http://zorba.io/modules/uri\",prefix:\"uri\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"create-session\",qname:\"cookie:create-session\",signature:\"($sessionData as node()) as empty-sequence()\",description:' Creates a client-side cookie named \"_session\", containing the\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$sessionData</tt> node value together with its signature.\\n The signature is generated with the server\\'s private key.\\n',summary:'<p> Creates a client-side cookie named \"_session\", containing the\\n  $sessionData  node value together with its signature.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"sessionData\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The data to be used for the session.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:2,name:\"create-session\",qname:\"cookie:create-session\",signature:\"($sessionData as node(), $expires as xs:dateTime) as empty-sequence()\",description:' Creates a client-side cookie named \"_session\", containing the\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$sessionData</tt> node value together with its signature.\\n The signature is generated with the server\\'s private key.\\n The cookie is also set to expire on the date specified by\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$expires</tt>.\\n',summary:'<p> Creates a client-side cookie named \"_session\", containing the\\n  $sessionData  node value together with its signature.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"sessionData\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The data to be used for the session.</div>'},{name:\"expires\",type:\"xs:dateTime\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The expiration time of the cookie.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:3,name:\"create-session\",qname:\"cookie:create-session\",signature:\"($sessionData as node(), $expires as xs:dateTime?, $path as xs:string?) as empty-sequence()\",description:' Creates a client-side cookie named \"_session\", containing the\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$sessionData</tt> node value together with its signature.\\n The signature is generated with the server\\'s private key.\\n The cookie is also set to expire on the date specified by\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$expires</tt>. The cookie is only valid for the specified path.\\n',summary:'<p> Creates a client-side cookie named \"_session\", containing the\\n  $sessionData  node value together with its signature.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"sessionData\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The data to be used for the session.</div>'},{name:\"expires\",type:\"xs:dateTime\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The expiration time of the cookie.</div>'},{name:\"path\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The path of the URL for which the cookie is valid.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:0,name:\"delete-session\",qname:\"cookie:delete-session\",signature:\"() as empty-sequence()\",description:' Delete the \"_session\" cookie from the client. The next\\n user request will not receive a valid session cookie\\n anymore\\n',summary:'<p> Delete the \"_session\" cookie from the client.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:1,name:\"delete-session\",qname:\"cookie:delete-session\",signature:\"($path as xs:string?) as empty-sequence()\",description:' Delete the \"_session\" cookie from the client. The next\\n user request will not receive a valid session cookie\\n anymore\\n',summary:'<p> Delete the \"_session\" cookie from the client.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"path\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The path of the URL for which the cookie is valid.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:1,name:\"get\",qname:\"cookie:get\",signature:\"($name as xs:string?) as element(cookie:cookie)*\",description:' Returns the cookie in the request having the given name or the empty sequence\\n if no such cookie exists. The cookie format returned is:\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n &lt;cookie:cookie\\n   name=\"..\"&gt;...&lt;/cookie:cookie&gt;</tt>.\\n The content of the cookie element is the value of the cookie.\\n',summary:\"<p> Returns the cookie in the request having the given name or the empty sequence\\n if no such cookie exists.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the cookie that should be retrieved.</div>'}],returns:{type:\"element(cookie:cookie)*\",description:\"The cookie with the given name or the empty sequence if no cookie with the given name exist\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cookie:S003 if $decode evaluates to fn:true() and the value of the cookie cannot be parsed.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get\",qname:\"cookie:get\",signature:\"($name as xs:string?, $decode as xs:boolean) as element(cookie:cookie)*\",description:\" Returns the cookies in the request having the given name. If no name is given,\\n it returns all available cookies. If no cookie value decoding is wanted,\\n the user must specify a second argument that evaluates to fn:false().\\n\",summary:\"<p> Returns the cookies in the request having the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the cookie that should be retrieved</div>'},{name:\"decode\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Boolean to specify if cookie value decoding id needed</div>'}],returns:{type:\"element(cookie:cookie)*\",description:\"The cookie with the given name or the empty sequence if no cookie with the given name exist\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cookie:S003 if $decode evaluates to fn:true() and the value of the cookie cannot be parsed.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"session-data\",qname:\"cookie:session-data\",signature:\"() as node()\",description:' Reads the \"_session\" cookie in the request and verifies if the signature\\n matches the ad-hoc computed signature of the content of the session. If the\\n verification is successful, the function returns the session data. Otherwise,\\n an error is raised.\\n',summary:'<p> Reads the \"_session\" cookie in the request and verifies if the signature\\n matches the ad-hoc computed signature of the content of the session.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"node()\",description:\"The session data is returned if verification succesful.\"},errors:[]},{isDocumented:!0,arity:1,name:\"set\",qname:\"cookie:set\",signature:\"($cookie as element(cookie:cookie)) as empty-sequence()\",description:' Adds a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set-Cookie</tt> header to the response. This function is equivalent to\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cookie:set($cookie, fn:true())</tt>.\\n',summary:\"<p> Adds a  Set-Cookie  header to the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cookie\",type:\"element(cookie:cookie)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The XML representation of the cookie to be sent to the client.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cookie:S002 if the cookie is bigger than 4096 bytes.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set\",qname:\"cookie:set\",signature:\"($cookie as element(cookie:cookie), $encode as xs:boolean) as empty-sequence()\",description:' Adds a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set-Cookie</tt> header to the response.\\n The cookie parameter needs to adhere to the cookie schema. For example,\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n &lt;cookie:cookie\\n   name=\"xs:string\"\\n   expires=\"xs:datetime\"\\n   domain=\"xs:string\"\\n   path=\"xs:string\"\\n   secure=\"xs:boolean\"&gt;value&lt;/cookie:cookie&gt;\\n </tt>.\\n If the cookie parameter is not valid according to the schema, err:XQDY0027 is raised.\\n If $encode evaluates to fn:true(), then the child nodes of the cookie element will be\\n serialized using XML serialization (omitting the XML declaration). In order not to\\n break the cookie syntax, any occurence of whitespace or column in the value will be\\n encoded on the client using the URL encoding format. For this reason also the \\'%\\'\\n character will be encoded using the same format.\\n If $encode evaluates to fn:false(), the children nodes of the cookie element will be\\n serialized as text and no encoding will be performed whatsoever. It is the\\n responsibility of the caller to make sure the text serialization will not produce an\\n invalid cookie.\\n',summary:\"<p> Adds a  Set-Cookie  header to the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cookie\",type:\"element(cookie:cookie)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The cookie to send to the client</div>'},{name:\"encode\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> if encoding should be performed on the value or not</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cookie:S002 if the cookie is bigger than 4096 bytes.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"validate-session\",qname:\"cookie:validate-session\",signature:\"() as xs:boolean\",description:' Reads the \"_session\" cookie in the request and verifies if\\n the signature matches the ad-hoc computed signature of the\\n content of the session. The signature is generated with a\\n server private key. If no cookie named \"_session\" exists,\\n this function returns false.\\n',summary:'<p> Reads the \"_session\" cookie in the request and verifies if\\n the signature matches the ad-hoc computed signature of the\\n content of the session.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:'Returns <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</tt> if the session is valid, and and false otherwise.'},errors:[]}],variables:[]},\"http://www.28msec.com/modules/couchbase\":{ns:\"http://www.28msec.com/modules/couchbase\",description:' This module provides functionality to interact with the\\n Couchbase NoSQL database.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The module is built using the libcouchbase 2.0 C client library and\\n exposes most of its functionality in JSONiq.\\n Beyond just allowing for basic key-value store operations (e.g.\\n put-/get-text or put-/get-binary, this module also allows to work\\n with Couchbase views in order to allow for complex JSON query\\n operations.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cristi Dumitru</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/couchbase\",prefix:\"cb\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.zorba-xquery.com/modules/couchbase\",prefix:\"zcb\"}],functions:[{isDocumented:!0,arity:1,name:\"connect\",qname:\"cb:connect\",signature:\"($options as object()) as anyURI\",description:' Connect to the Couchbase server.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The input to the function is an object that contains the connection\\n information. Specifically, it allows for the following options:\\n <ul>\\n   <li><tt>host</tt>: the endpoint of the Couchbase server (mandatory)</li>\\n   <li><tt>user</tt>: the user used for connecting (optional)</li>\\n   <li><tt>password</tt>: the password used for connecting (optional)</li>\\n   <li><tt>bucket</tt>: name of an existing bucket (mandatory)</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $conn := cb:connect({\\n   \"host\" : \"192.168.1.56:8091\",\\n   \"username\" : (),\\n   \"password\" : (),\\n   \"bucket\" : \"default\"\\n });\\n </pre></li></ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that represents the connection.\\n This URI has to be passed to other functions of this module that require\\n the <tt>$conn</tt> parameter as a first argument.</p>\\n',summary:\"<p> Connect to the Couchbase server.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a object that contains the host, bucket, and authentication information.</div>'}],returns:{type:\"anyURI\",description:\"an identifier for the established connection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0001 if the connection to the given host/bucket could not be established.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0001 if mandatory connection information is missing.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if a given option is not supported.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"connect\",qname:\"cb:connect\",signature:\"($host as string, $username as string?, $password as string?, $bucket as string) as anyURI\",description:' Connect to the Couchbase server.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that represents the connection.\\n This URI has to be passed to other functions of this module that require\\n the <tt>$conn</tt> parameter as a first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $conn := cb:connect(\"192.168.1.56:8091\", (), (), \"default\");\\n </pre></li></ul></p>\\n',summary:\"<p> Connect to the Couchbase server.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> address of the couchbase server (mandatory) <code>\"192.168.1.56:8091\"</code></div>'},{name:\"username\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> username used for the connection</div>'},{name:\"password\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> password used for the connection</div>'},{name:\"bucket\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> name of the bucket to use (mandatory) <code>\"default\"</code></div>'}],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0001 if the connection to the given host/bucket could not be established.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create-view\",qname:\"cb:create-view\",signature:\"($conn as anyURI, $doc-name as string, $view-names as string*) as string*\",description:' Create a document and views.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the document already exists, it is replaced.\\n A document can hold several views that must be specified in the same call.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $views := cb:create-view($conn, \"zip\", (\"bystate\", \"bycity\"));\\n </pre></li></ul></p>\\n',summary:\"<p> Create a document and views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"doc-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the document to create</div>'},{name:\"view-names\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The names of the views to create in the document</div>'}],returns:{type:\"string*\",description:\"The paths for the views that have been created.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"create-view\",qname:\"cb:create-view\",signature:\"($conn as anyURI, $doc-name as string, $view-names as string*, $options as object()*) as string*\",description:' Create a document and views.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the document already exists, it is replaced.\\n A document can hold several views that must be specified in the same call.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>key</tt>: <tt>string</tt> name of the value that will be used\\n        as key in the view</li>\\n   <li><tt>values</tt>: <tt>string/array</tt> name of the value(s) that\\n        will be used as values in the view</li>\\n   <li><tt>function</tt>: <tt>javascript function</tt> the map function\\n        that will create the connection between key and value.<br/>\\n        If <tt>function</tt> is specified, the <tt>key</tt> and\\n        <tt>values</tt> options are ignored.</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $views := cb:create-view($conn, \"zip\", \"bystate\", { \"key\": \"doc.state\", \"values\" : [\"doc.pop\", \"doc.city\"] });\\n </pre></li>\\n <li><pre>\\n $views := cb:create-view($conn, \"zip\", \"bycity\", { \"function\": \"function(doc, meta) {  emit(doc.state, null); }\"});\\n </pre></li></ul></p>\\n',summary:\"<p> Create a document and views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"doc-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the document to create</div>'},{name:\"view-names\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The names of the views to create in the document</div>'},{name:\"options\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"string*\",description:\"The paths for the views that have been created.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0005 if the number of options doesn\\'t match the number of view-names.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0010 if any of the given options has an invalid type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-view\",qname:\"cb:delete-view\",signature:\"($conn as anyURI, $doc as string*) as string*\",description:' Delete a document and its views.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the document doesn\\'t exists, the function does nothing.\\n All the views hold in the document are deleted.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:delete-view($conn, \"zip\");\\n </pre></li></ul></p>\\n',summary:\"<p> Delete a document and its views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"doc\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">-name The name of the document to delete</div>'}],returns:{type:\"string*\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"flush\",qname:\"cb:flush\",signature:\"($conn as anyURI) as empty-sequence()\",description:' Remove all values and their keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:flush($conn);\\n </pre></li></ul></p>\\n',summary:\"<p> Remove all values and their keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get-binary\",qname:\"cb:get-binary\",signature:\"($conn as anyURI, $key as string*) as base64Binary*\",description:' Retrieve the values matching the given string keys, as base64Binary.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $result := cb:get-binary($conn, \"image\");\\n </pre></li></ul></p>\\n',summary:\"<p> Retrieve the values matching the given string keys, as base64Binary.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The requested keys</div>'}],returns:{type:\"base64Binary*\",description:\"A sequence of base64Binary values corresponding to the keys\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"get-binary\",qname:\"cb:get-binary\",signature:\"($conn as anyURI, $key as string*, $options as object()) as base64Binary*\",description:' Retrieve the values matching the given string keys, as base64Binary.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>expiration-time</tt>: <tt>integer</tt> value for refreshing the\\n        expiration time in seconds\\n       (default 0, which means values are kept indefinitely)</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $result := cb:get-binary($conn, \"image\",{ \"expiration-time\" : 60 * 60 });\\n </pre></li></ul></p>\\n',summary:\"<p> Retrieve the values matching the given string keys, as base64Binary.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The requested keys</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"base64Binary*\",description:\"A sequence of base64Binary values corresponding to the keys\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0009 if the given expiration time is not an integer.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get-text\",qname:\"cb:get-text\",signature:\"($conn as anyURI, $key as string*) as string*\",description:' Retrieve the values matching the given string keys, as string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $result := cb:get-text($conn, \"35040\");\\n </pre></li></ul></p>\\n',summary:\"<p> Retrieve the values matching the given string keys, as string.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The requested keys</div>'}],returns:{type:\"string*\",description:\"A sequence of string values corresponding to the keys\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"get-text\",qname:\"cb:get-text\",signature:\"($conn as anyURI, $key as string*, $options as object()) as string*\",description:' Retrieve the values matching the given string keys, as string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>expiration-time</tt>: <tt>integer</tt> value for refreshing the\\n        expiration time in seconds\\n       (default 0, which means values are kept indefinitely)</li>\\n   <li><tt>encoding</tt>: <tt>string</tt> name of the encoding of the\\n        returned string (default UTF-8)</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $result := cb:get-text($conn, \"35040\", { \"encoding\" : \"ASCII\" } );\\n </pre></li></ul></p>\\n',summary:\"<p> Retrieve the values matching the given string keys, as string.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The requested key</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"string*\",description:\"A sequence of string values corresponding to the keys\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0006 if the given encoding is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0009 if the given expiration time is not an integer.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put-binary\",qname:\"cb:put-binary\",signature:\"($conn as anyURI, $key as string*, $value as base64Binary*) as empty-sequence()\",description:' Store base64binary values along with their string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:put-binary($conn, \"image\",\\n   http:get-binary(\"http://localhost:8091/images/couchbase_logo.png\")[2]);\\n </pre></li></ul></p>\\n',summary:\"<p> Store base64binary values along with their string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys to store</div>'},{name:\"value\",type:\"base64Binary\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The base64 binary values to be stored</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"put-binary\",qname:\"cb:put-binary\",signature:\"($conn as anyURI, $key as string*, $value as base64Binary*, $options as object()) as empty-sequence()\",description:' Store base64Binary values along with their string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>expiration-time</tt>: <tt>integer</tt> value for refreshing the\\n        expiration time in seconds\\n       (default 0, which means values are kept indefinitely)</li>\\n   <li><tt>operation</tt>: <tt>add/replace/set/append/prepend</tt> type of\\n       operation</li>\\n   <li><tt>wait</tt>: <tt>persist/false</tt> if the system should wait for\\n        persistence of the keys</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:put-binary($conn, \"image\",\\n   http:get-binary(\"http://localhost:8091/images/couchbase_logo.png\")[2],\\n   { \"expiration-time\" : 60 * 60 * 24 });\\n </pre></li></ul></p>\\n',summary:\"<p> Store base64Binary values along with their string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys to store</div>'},{name:\"value\",type:\"base64Binary\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The base64Binary values to be stored</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0009 if the given expiration time is not an integer.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0011 if the stored Variable was not stored</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put-text\",qname:\"cb:put-text\",signature:\"($conn as anyURI, $key as string*, $value as string*) as empty-sequence()\",description:' Store string values along with their string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The values are stored with the UTF-8 encoding and a default\\n expiration time 0.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:put-text($conn, \"35040\", fn:serialize({\\n                      \"city\" : \"CALERA\",\\n                      \"loc\" : [ -86.755987, 33.1098 ],\\n                      \"pop\" : 4675,\\n                      \"state\" : \"AL\",\\n                      \"_id\" : \"35040\"\\n                    }));\\n </pre></li></ul></p>\\n',summary:\"<p> Store string values along with their string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys to store</div>'},{name:\"value\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string values to be stored.</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"put-text\",qname:\"cb:put-text\",signature:\"($conn as anyURI, $key as string*, $value as string*, $options as object()) as empty-sequence()\",description:' Store string values along with their string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>expiration-time</tt>: <tt>integer</tt> value for refreshing the\\n        expiration time in seconds\\n       (default 0, which means values are kept indefinitely)</li>\\n   <li><tt>encoding</tt>: <tt>string</tt> name of the encoding of the\\n        returned string (default UTF-8)</li>\\n   <li><tt>operation</tt>: <tt>add/replace/set/append/prepend</tt> type\\n        of operation</li>\\n   <li><tt>wait</tt>: <tt>persist/false</tt> if the system should wait for\\n        persistence of the keys</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:put-text($conn, \"35040\", fn:serialize({\\n                      \"city\" : \"CALERA\",\\n                      \"loc\" : [ -86.755987, 33.1098 ],\\n                      \"pop\" : 4675,\\n                      \"state\" : \"AL\",\\n                      \"_id\" : \"35040\"\\n                    }), { \"expiration-time\" : 60 * 60 * 24 });\\n </pre></li></ul></p>\\n',summary:\"<p> Store string values along with their string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys to store</div>'},{name:\"value\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string values to be stored</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0006 if the given encoding is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0009 if the given expiration time is not an integer.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0011 if the stored Variable was not stored</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"remove\",qname:\"cb:remove\",signature:\"($conn as anyURI, $key as string*) as empty-sequence()\",description:' Remove the values matching the given string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:remove($conn, \"35040\");\\n </pre></li></ul></p>\\n',summary:\"<p> Remove the values matching the given string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The requested keys to have their values removed</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"touch\",qname:\"cb:touch\",signature:\"($conn as anyURI, $key as string*, $exp-time as integer) as empty-sequence()\",description:' Refresh the expiration time of the given string keys.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n cb:touch($conn, \"35040\", 60 * 60 * 24);\\n </pre></li></ul></p>\\n',summary:\"<p> Refresh the expiration time of the given string keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"key\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys to touch</div>'},{name:\"exp-time\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> New expiration time in seconds</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"view\",qname:\"cb:view\",signature:\"($conn as anyURI, $path as string*) as object()*\",description:' Retrieve the content of existing views. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $results := cb:view($conn, \"_design/zip/_view/bystate\");\\n </pre></li></ul></p>\\n',summary:\"<p> Retrieve the content of existing views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"path\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The view path</div>'}],returns:{type:\"object()*\",description:\"information about the view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"view\",qname:\"cb:view\",signature:\"($conn as anyURI, $path as string*, $options as object()) as object()*\",description:' Retrieve the content of existing views.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <ul><li><pre>\\n $results := cb:view($conn, \"_design/zip/_view/bystate\", { \"limit\": 100 });\\n </pre></li></ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition, the function allows to specify several options:\\n <ul>\\n   <li><tt>encoding</tt>: <tt>string</tt> name of the encoding of the\\n        returned string (default UTF-8)</li>\\n   <li><tt>stale</tt>: if the system should wait for persistence of the keys\\n    <ul>\\n      <li><tt>ok</tt> the view is not updated</li>\\n      <li><tt>false</tt> the view is updated before the function view is\\n      executed, this options needs the key to be on disk before the call of\\n      the function.</li>\\n      <li><tt>update_after</tt> the view is updated after the call\\n      of the function.</li>\\n    </ul></li>\\n   <li><tt>limit</tt>: <tt>integer</tt> how many rows qill be shown\\n         (default all)</li>\\n </ul></p>\\n',summary:\"<p> Retrieve the content of existing views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection</div>'},{name:\"path\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The view path <code>\"_design/test/_view/vies\"</code></div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object with additional options</div>'}],returns:{type:\"object()*\",description:\"information about the view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">CB0007 if any of the options is not supported.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/random\":{ns:\"http://zorba.io/modules/random\",description:\" This module provides several functions for generating (pseudo-)random\\n numbers and strings.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner, Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/random\",prefix:\"r\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:2,name:\"random-between\",qname:\"r:random-between\",signature:\"($lower as integer, $upper as integer) as integer\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates one random number within a given range.\\n The function is nondeterministic.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function is based on <tt>r:random-between#3</tt>.\\n Specifically, it returns the value of invoking\\n <tt>r:random-betwen($lower, $upper, 1)</tt>.</p>\\n',summary:\"<p>  This function generates one random number within a given range.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"lower\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the lower bound for the random number</div>'},{name:\"upper\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the upper bound for the random number</div>'}],returns:{type:\"integer\",description:\"a random integer within the given range\"},errors:[]},{isDocumented:!0,arity:3,name:\"random-between\",qname:\"r:random-between\",signature:\"($lower as integer, $upper as integer, $num as integer) as integer*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates an arbitrary number of random numbers\\n within a given range. The function is nondeterministic because\\n the sequence is <b>not</b> repeatable.</p>\\n',summary:\"<p>  This function generates an arbitrary number of random numbers\\n within a given range.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"lower\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the lower bound for every value within the sequence</div>'},{name:\"upper\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the upper bound for every value within the sequence</div>'},{name:\"num\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the length of the sequence returned</div>'}],returns:{type:\"integer*\",description:'<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> pseudo-random integers within (and including) the range specified by <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> and <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upper</tt>. It returns <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt>-times <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> is equal to <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upper</tt> and the empty sequence if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> is negative.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">r:INVALID_ARGUMENT if <tt>$lower</tt> is greater than <tt>$upper</tt></xqdoc:error>']},{isDocumented:!0,arity:0,name:\"random\",qname:\"r:random\",signature:\"() as integer\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates one random number.\\n The function is nondeterministic.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function is based on <tt>r:random#1</tt>. Specifically, it\\n returns the value of invoking <tt>r:random(1)</tt>.</p>\\n',summary:\"<p>  This function generates one random number.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"integer\",description:\"a random integer\"},errors:[]},{isDocumented:!0,arity:1,name:\"random\",qname:\"r:random\",signature:\"($num as integer) as integer* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates an arbitrary number of random numbers.\\n The function is nondeterministic because the sequence is\\n <b>not</b> repeatable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">However, the function is based on posix function <tt>srand()</tt> and\\n <tt>rand()</tt>. Specifically, it invokes <tt>srand()</tt>\\n with some random number based on the current time\\n and then returns the values returned by invoking\\n <tt>rand()</tt> <tt>$num</tt>-times.</p>\\n',summary:\"<p>  This function generates an arbitrary number of random numbers.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"num\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the length of the sequence returned</div>'}],returns:{type:\"integer*\",description:'<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> random integers, or the empty sequence if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> is negative.'},errors:[]},{isDocumented:!0,arity:4,name:\"seeded-random-between\",qname:\"r:seeded-random-between\",signature:\"($seed as integer, $lower as integer, $upper as integer, $num as integer) as integer*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates an arbitrary number of pseudo-random numbers\\n within a given range. The sequence is repeatable by calling the\\n function with the same seed and boundaries.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function is based on the function <tt>r:seeded-random#2</tt>.\\n Specifically, its result is repeatable if called with the\\n same arguments.</p>\\n',summary:\"<p>  This function generates an arbitrary number of pseudo-random numbers\\n within a given range.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seed\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the initial seed value for the sequence</div>'},{name:\"lower\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the lower bound for every value within the sequence</div>'},{name:\"upper\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the upper bound for every value within the sequence</div>'},{name:\"num\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the length of the sequence returned</div>'}],returns:{type:\"integer*\",description:'<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> pseudo-random integers within (and including) the range specified by <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> and <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upper</tt>. It returns <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt>-times <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lower</tt> is equal to <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upper</tt> and the empty sequence if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> is negative.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZQXD0004 if the given seed is negative or great than the max value of <tt>unsigned int</tt> on the given platform.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">r:INVALID_ARGUMENT if <tt>$lower</tt> is greater than <tt>$upper</tt></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"seeded-random\",qname:\"r:seeded-random\",signature:\"($seed as integer, $num as integer) as integer* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function generates an arbitrary number of pseudo-random numbers.\\n The sequence is repeatable by calling the function with the same\\n seed.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function is based on posix function <tt>srand()</tt> and\\n <tt>rand()</tt>. Specifically, it invokes <tt>srand($seed)</tt>\\n and then returns the values returned by invoking <tt>rand()</tt>\\n <tt>$num</tt>-times.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sequences returned by this function are not thread-safe (i.e.\\n if multiple XQuery programs invoking this function are executed\\n concurrently in several threads). This is because the function is\\n based on <tt>srand()</tt> and <tt>rand()</tt>.</p>\\n',summary:\"<p>  This function generates an arbitrary number of pseudo-random numbers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seed\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the initial seed value for the sequence</div>'},{name:\"num\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the length of the sequence returned</div>'}],returns:{type:\"integer*\",description:'<tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> pseudo-random integers, or the empty sequence if <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$num</tt> is negative.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZQXD0004 if the given seed is negative or great than the max value of <tt>unsigned int</tt> on the given platform.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"uuid\",qname:\"r:uuid\",signature:\"() as string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns a uuid.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Note, that the function is not stable,\\n that is, it returns a different UUID everytime the function is invoked.</p>\\n',summary:\"<p>  This function returns a uuid.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"the generated UUID as string\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/http-client\":{ns:\"http://www.zorba-xquery.com/modules/http-client\",description:' <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Introduction</h1>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module provides provides simple functions for performing HTTP requests\\n (GET, POST, DELETE etc.), as well as a more flexible general\\n purpose function (<a href=\"?anchor=send-request-3\">send-request()</a>).\\n </p>\\n <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Examples of how to use this module</h1>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Simple GET Request</h4>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace http=\"http://www.zorba-xquery.com/modules/http-client\";\\n declare namespace svg=\"http://www.w3.org/2000/svg\";\\n http:get(\"http://www.w3.org/Graphics/SVG/svglogo.svg\")[2]/svg:svg/svg:title\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This example downloads an XML resource from the web (in this case,\\n an SVG file, which is an XML-based image format) and returns it as\\n a document node. Since the XML is in a namespace, we declare that\\n namespace; we can then perform a path expression directly on the\\n return value of http:get().\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Simple GET Request (retrieving XHTML)</h4>\\n   <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n   import module namespace http=\"http://www.zorba-xquery.com/modules/http-client\";\\n   declare namespace xhtml=\"http://www.w3.org/1999/xhtml\";\\n   http:get-node( \"http://www.w3.org\" )[2]//xhtml:body\\n   </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This example shows how to retrieve an XHTML resource. XHTML is\\n XML, so the http:get-node() function will return it as a document node\\n and you can operate on it with the full power of XQuery. As above, since this\\n XML is in a particular namespace, the above query defines that namespace\\n with the prefix \"xhtml\" so it can easily perform path expressions, etc.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Note: many webservers, include www.w3.org, return XHTML with the\\n HTTP Content-Type \"text/html\". Zorba cannot assume that \"text/html\"\\n is actually XHTML, and so http:get() would have returned raw text\\n rather than a document node. That is why the example above uses\\n http:get-node(), which overrides the server\\'s Content-Type and tells\\n Zorba to attempt to parse the result as XML.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Simple GET Request (retrieving HTML as text)</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Note that XQuery does <b>not</b> understand plain HTML, and so if the URL\\n you retrieve contains plain HTML data (not XHTML), it will be treated as\\n plain text as shown in the next example. If you want to operate on the HTML\\n with XQuery, you should use the HTML language module which can transform\\n HTML to XHTML. The HTML module is supported by the Zorba team, but it is\\n not a \"core module\", meaning that it is not shipped with every Zorba\\n installation and may not be available. See\\n <a href=\"http://www.zorba-xquery.com/site2/html/downloads.html\">the Zorba downloads\\n page</a> for information about obtaining this module if you do not\\n have it.</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace http=\"http://www.zorba-xquery.com/modules/http-client\";\\n http:get(\"http://www.example.com\")[2]\\n </pre>\\n returns\\n   <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xml\">\\n   &lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"&gt;\\n   &lt;html&gt;\\n     &lt;head&gt;\\n       &lt;meta http-equiv=\"Content-Type\"\\n       content=\"text/html; charset=utf-8\" /&gt;\\n       &lt;title&gt;Example Web Page&lt;/title&gt;\\n     &lt;/head&gt;\\n     &lt;body&gt;\\n       &lt;p&gt;You have reached this web page by typing \"example.com\",\\n       \"example.net\", or \"example.org\" into your web browser.&lt;/p&gt;\\n       &lt;p&gt;These domain names are reserved for use in documentation and are\\n       Not available for registration. See\\n       &lt;a href=\"http://www.rfc-editor.org/rfc/rfc2606.txt\"&gt;RFC 2606&lt;/a&gt;,\\n       Section 3.&lt;/p&gt;\\n     &lt;/body&gt;\\n   &lt;/html&gt;\\n   </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that the response data above is a simple\\n xs:string value containing the HTML data, not actual XML data. If you\\n executed the above query using the Zorba command-line client, you would\\n have actually seen data like the following:</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xml\">\\n   &amp;lt;!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"&amp;gt;\\n   &amp;lt;html&amp;gt;\\n      ...\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">because Zorba would attempt to serialize it as XML data, and would\\n escape all the raw angle brackets in the original xs:string.</p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Simple POST Request</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Here is a simple example which sends text content by making an HTTP POST\\n request.\\n </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace http=\"http://www.zorba-xquery.com/modules/http-client\";\\n http:post( \"...\", \"Hello World\" )\\n </pre>\\n <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"standard_return\">Return Values</h1>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Most functions in this module (all except\\n <a href=\"?anchor=options-1\">options()</a>) return one or more items.\\n (<a href=\"?anchor=head-1\">head()</a> returns exactly one.) For all of these,\\n the first item returned will be a &lt;http-schema:response&gt;\\n element, as seen in the examples above. This element has \"status\" and\\n \"message\" attributes, representing the result of the HTTP call. It\\n also has any number of &lt;http-schema:header&gt; child elements that\\n encode the HTTP headers returned by the HTTP server. Finally, it\\n will generally contain a &lt;http-schema:body&gt; child element with\\n a \"media-type\" attribute that identifies the content-type of the\\n result data.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The full schema of this &lt;http-schema:response&gt; element is\\n part of the <a href=\"http://expath.org/modules/http-client/\">EXPath\\n HTTP Client module</a>. You can see the schema\\n <a href=\"schemas/expath.org_ns_http-client.html\">here</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Any items in function return values after the initial\\n &lt;http-schema:response&gt; element are the body/bodies of the HTTP\\n response from the server. (MIME Multi-part responses will have\\n more than one body.) The type of these items depends on the\\n Content-Type for each body. Each item will be:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li>\\n    an element node, if the returned content type is one of:\\n    <ul>\\n      <li>text/xml</li>\\n      <li>application/xml</li>\\n      <li>text/xml-external-parsed-entity</li>\\n      <li>application/xml-external-parsed-entity</li>\\n      <li>or if the Content-Type ends with \"+xml\".</li>\\n    </ul>\\n  </li>\\n  <li>\\n    an xs:string, if the returned content type starts with \"text/\"\\n    and does not match the above XML content types strings, or if\\n    it is one of:\\n    <ul>\\n      <li>\"application/json\"</li>\\n      <li>\"application/x-javascript\"</li>\\n    </ul>\\n  </li>\\n  <li>xs:base64Binary for all other content types.</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This return value - a sequence of items comprising one\\n &lt;http-schema:response&gt; element followed by zero or more\\n response items - is referred to as the \"standard http-client\\n return type\" in the function declarations below.</p>\\n <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"url_string\">$href Arguments to Functions</h1>\\n All functions in this module accept a URL argument named $href. In\\n all cases, the value passed to $href must be a valid xs:anyURI.\\n However, all functions declare $href to be of type xs:string. This\\n is for convenience, since you can pass a string literal value (that\\n is, a URL in double-quotes spelled out explicitly in your query)\\n to an xs:string parameter.\\n <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"get_warning\">Important Notice Regarding get() Functions</h1>\\n All of the get() functions in this module -\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"?anchor=get-1\">get()</a>, <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"?anchor=get-node-1\">get-node()</a>,\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"?anchor=get-text-1\">get-text()</a>, and\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"?anchor=get-binary()\">get-binary()</a> - are declared to be\\n <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">nondeterministic</i>, which means that Zorba will not cache\\n their results. However, they are <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">not</b> declared to be\\n <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sequential</i>, which means that Zorba may re-order them\\n as part of its query optimization. According to the HTTP RFC,\\n GET requests should only return data, and should not have any\\n side-effects. However, in practice it is not uncommon for GET\\n requests to have side-effects. If your application depends on\\n the ordering of side-effects from making GET requests, you should\\n either use the more complex <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"?anchor=send-request-3\">send-request()</a>\\n function (which <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">is</b> declared <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sequential</i>), or alterately\\n wrap each call to get() in your own sequential function, to ensure\\n that Zorba does not place the GET requests out of order.\\n <h1 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"expath_relation\">Relation to the EXPath http-client module</h1>\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://expath.org/\">EXPath</a> defines its own http-client\\n module, which is available separately for Zorba as a non-core module.\\n There are two primary differences between EXPath\\'s http-client and\\n Zorba\\'s core http-client (this module):\\n <ol xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>EXPath defines only the send-request() function, although it\\n does include convenient 1- and 2-argument forms in addition to the\\n full 3-argument form. EXPath does not include the simpler get(),\\n post(), put(), delete(), head(), and options() functions defined by\\n this module.</li>\\n   <li>EXPath specifies that all HTML content returned from the\\n HTTP server will be <i>tidied up</i> into valid XML, and then parsed\\n into an element. As this required an additional third-party library\\n dependency, Zorba\\'s http-client module does not perform this tidying.\\n Instead, HTML content is returned as a string (with special XML\\n characters replaced with XML entity references, as shown in the\\n above examples).</li>\\n </ol>\\n See <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.expath.org/spec/http-client\">the full spec\\n of the EXPath http-client module</a> for more information.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xquery-11/#FunctionDeclns\">XQuery 1.1: Function Declaration</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Markus Pilman, Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://expath.org/ns/error\",prefix:\"error\"},{uri:\"http://www.zorba-xquery.com/modules/http-client\",prefix:\"http\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-schema\"},{uri:\"http://zorba.io/modules/http-client-wrapper\",prefix:\"http-wrapper\"},{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"json-http\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"libjn\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"ser\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"delete\",qname:\"http:delete\",signature:\"($href as xs:string) as item()+\",description:\" This function makes an HTTP DELETE request to a given URL.\\n\",summary:\"<p> This function makes an HTTP DELETE request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a DELETE request.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-binary\",qname:\"http:get-binary\",signature:\"($href as xs:string) as item()+\",description:\" This function makes a GET request on a given URL. All returned bodies\\n are forced to be interpreted as binary data, and will be returned\\n as xs:base64Binary items.\\n\",summary:\"<p> This function makes a GET request on a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-node\",qname:\"http:get-node\",signature:\"($href as xs:string) as item()+\",description:\" This function makes a GET request to a given URL. All returned bodies\\n are forced to be interpreted as XML and parsed into elements.\\n\",summary:\"<p> This function makes a GET request to a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-text\",qname:\"http:get-text\",signature:\"($href as xs:string) as item()+\",description:\" This function makes a GET request to a given URL. All returned bodies\\n are forced to be interpreted as plain strings, and will be returned\\n as xs:string items.\\n\",summary:\"<p> This function makes a GET request to a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get\",qname:\"http:get\",signature:\"($href as xs:string) as item()+\",description:\" This function makes a GET request to a given URL.\\n\",summary:\"<p> This function makes a GET request to a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"head\",qname:\"http:head\",signature:\"($href as xs:string) as item()\",description:\" This function makes an HTTP HEAD request on a given URL.\\n\",summary:\"<p> This function makes an HTTP HEAD request on a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"item()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a> (since HEAD never returns any body data, only the &lt;http-schema:response&gt; element will be returned).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"options\",qname:\"http:options\",signature:\"($href as xs:string) as xs:string*\",description:\" This function makes an HTTP OPTIONS request, which asks the server\\n which operations it supports.\\n\",summary:\"<p> This function makes an HTTP OPTIONS request, which asks the server\\n which operations it supports.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of xs:string values of the allowed operations.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"post\",qname:\"http:post\",signature:\"($href as xs:string, $body as item()) as item()+\",description:' This function makes an HTTP POST request to a given URL. If the body\\n passed to this function is an element, it will be serialized to XML\\n to be sent to the server, and the Content-Type sent to the server will\\n be \"text/xml\". Otherwise, the body will be converted to\\n a plain string, and the Content-Type will be \"text/plain\".\\n',summary:\"<p> This function makes an HTTP POST request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a POST request.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"post\",qname:\"http:post\",signature:\"($href as xs:string, $body as item(), $content-type as xs:string) as item()+\",description:' This function makes an HTTP POST request to a given URL. If the body\\n passed to this function is an element, it will be serialized\\n according to the $content-type parameter as follows:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li>If $content-type is \"text/xml\", \"application/xml\",\\n \"text/xml-external-parsed-entity\", or\\n \"application/xml-external-parsed-entity\", or if it ends with \"+xml\",\\n $body will be serialized to XML.</li>\\n  <li>If $content-type starts with \"text/html\", $body will be\\n serialized to HTML.</li>\\n  <li>Otherwise, $body will be serialized to text.</li>\\n </ul>\\n If $body is not an element, $body will be serialized to text\\n regardless of $content-type.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In any case, Content-Type of the request sent to the server will\\n be $content-type.</p>\\n',summary:\"<p> This function makes an HTTP POST request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server</div>'},{name:\"content-type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content type of the body as described above.</div>'}],returns:{type:\"item()+\",description:\"The first element of the result is the metadata (like headers, status etc), the next elements are the response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a POST request.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"put\",qname:\"http:put\",signature:\"($href as xs:string, $body as item()) as item()+\",description:' This function makes an HTTP PUT request to a given URL. If the body\\n passed to this function is an element, it will be serialized to XML\\n to be sent to the server, and the Content-Type sent to the server will\\n be \"text/xml\". Otherwise, the body will be converted to\\n a plain string, and the Content-Type will be \"text/plain\".\\n',summary:\"<p> This function makes an HTTP PUT request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a PUT request.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put\",qname:\"http:put\",signature:\"($href as xs:string, $body as item(), $content-type as xs:string) as item()+\",description:' This function makes an HTTP PUT request to a given URL. If the body\\n passed to this function is an element, it will be serialized\\n according to the $content-type parameter as follows:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li>If $content-type is \"text/xml\", \"application/xml\",\\n \"text/xml-external-parsed-entity\", or\\n \"application/xml-external-parsed-entity\", or if it ends with \"+xml\",\\n $body will be serialized to XML.</li>\\n  <li>If $content-type starts with \"text/html\", $body will be\\n serialized to HTML.</li>\\n  <li>Otherwise, $body will be serialized to text.</li>\\n </ul>\\n If $body is not an element, $body will be serialized to text\\n regardless of $content-type.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In any case, Content-Type of the request sent to the server will\\n be $content-type.</p>\\n',summary:\"<p> This function makes an HTTP PUT request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'},{name:\"content-type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content type of $body as described above.</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a PUT request.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"send-request\",qname:\"http:send-request\",signature:\"($request as element(http-schema:request)?, $href as xs:string?, $bodies as item()*) as item()+\",description:' This function sends an HTTP request and returns the corresponding response.\\n Its inputs, outputs, and behavior are identical to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://expath.org/spec/http-client\">EXPath http-client</a>\\'s\\n send-request() function (except that HTML responses are not tidied\\n into XML - see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#expath_relation\">the note above</a>). It\\n is provided here for use in Zorba installations that do not have\\n the EXPath module available. If you have the option of using the\\n EXPath module instead of this function, please do so, as it will\\n allow your application to be more interoperable between different\\n XQuery engines.\\n Full documentation of the $request parameter can be found in\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://expath.org/spec/http-client#d2e183\">the EXPath\\n specification</a>.\\n',summary:\"<p> This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(http-schema:request)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Contains the various parameters of the request (see above).</div>'},{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above). If this parameter is specified, it will override the \"href\" attribute of $request.</div>'},{name:\"bodies\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the request body content, for HTTP methods that can contain a body in the request (i.e. POST and PUT). It is an error if this param is not the empty sequence for methods</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC003 With a multipart response, the override-media-type must be either a multipart media type or application/octet-stream.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC004 The src attribute on the body element is mutually exclusive with all other attribute (except the media-type).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC005 The input request element is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a POST, PUT, or DELETE request</xqdoc:error>']}],variables:[]},\"http://xbrl.io/modules/bizql/profiles/sec/networks\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/networks\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying SEC networks in SEC filings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Networks are actually XBRL Components. In the SEC profiles, all XBRL networks\\n in an XBRL component must be consistent to each other. A way to look at it is that\\n the SEC Network can be identified with the XBRL presentation network it contains.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For XBRL-generic operations on XBRL components, use the\\n generic components module.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/components\",prefix:\"components\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/filings\",prefix:\"filings\"},{uri:\"http://xbrl.io/modules/bizql/hypercubes\",prefix:\"hypercubes\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://xbrl.io/modules/bizql/networks\",prefix:\"networks\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/core\",prefix:\"sec\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/networks\",prefix:\"sec-networks\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"abstracts\",qname:\"sec-networks:abstracts\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Abstracts contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Abstracts are XBRL abstract primary items that may or may not be associated\\n with a hypercube -- except those that are SEC LineItems (i.e., source of an all relation).</p>\\n',summary:\"<p>  Returns all SEC Abstracts contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Abstracts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"axes\",qname:\"sec-networks:axes\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Axes contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Axes are XBRL dimensions.</p>\\n',summary:\"<p>  Returns all SEC Axes contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Axes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"categories\",qname:\"sec-networks:categories\",signature:\"($networks-or-ids) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the categories of the supplied SEC networks (Statement, Disclosure, Document or Schedule).</p>\\n',summary:\"<p>  Return the categories of the supplied SEC networks (Statement, Disclosure, Document or Schedule).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"string*\",description:\"the category of each network.\"},errors:[]},{isDocumented:!0,arity:1,name:\"concepts\",qname:\"sec-networks:concepts\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Concepts contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Concepts are XBRL concrete primary items that may or may not be associated\\n with a hypercube.</p>\\n',summary:\"<p>  Returns all SEC Concepts contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Concepts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"disclosures\",qname:\"sec-networks:disclosures\",signature:\"($networks-or-ids as item()*) as string+\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the disclosures of the suplied networks.</p>\\n',summary:\"<p>  Returns the disclosures of the suplied networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"string+\",description:'the disclosure names, or \"UncategorizedInformation\" if none.'},errors:[]},{isDocumented:!0,arity:1,name:\"fact-tables\",qname:\"sec-networks:fact-tables\",signature:\"($networks-or-ids as item()*) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Network.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Network.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"array()\",description:\"a array populated with fact values.\"},errors:[]},{isDocumented:!0,arity:2,name:\"fact-tables\",qname:\"sec-networks:fact-tables\",signature:\"($networks-or-ids as item()*, $options as object()?) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Network.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Network.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"array()\",description:\"a array of arrays filled with fact values.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts\",qname:\"sec-networks:facts\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Network.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Network.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts\",qname:\"sec-networks:facts\",signature:\"($networks-or-ids as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Network.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Network.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"line-items-report-elements\",qname:\"sec-networks:line-items-report-elements\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC LineItems report elements contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This is not to be confused with the \"line items\" terminology, which includes all\\n SEC Abstracts and SEC Concepts.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC LineItems report elements are XBRL abstract primary items that are top-level in their\\n association with an XBRL hypercube (source of an all relation).</p>\\n',summary:\"<p>  Returns all SEC LineItems report elements contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC LineItems report elements.\"},errors:[]},{isDocumented:!0,arity:1,name:\"line-items\",qname:\"sec-networks:line-items\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Line Items (Concepts and Abstracts) contained in the\\n supplied SEC Networks. Not to be confused with the LineItems report element.</p>\\n',summary:\"<p>  Returns all SEC Line Items (Concepts and Abstracts) contained in the\\n supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Line Items.\"},errors:[]},{isDocumented:!0,arity:1,name:\"members\",qname:\"sec-networks:members\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Members contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Members are XBRL members that are in the transitive closure of SEC Axes\\n via the dimension-domain and domain-member relations.</p>\\n',summary:\"<p>  Returns all SEC Members contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Members.\"},errors:[]},{isDocumented:!0,arity:1,name:\"model-structures\",qname:\"sec-networks:model-structures\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Computes the model structure of the supplied SEC Network, which is a hierarchy\\n of SEC Report Elements (Tables, Axes, Members, LineItems, Abstracts, Concepts).</p>\\n',summary:\"<p>  Computes the model structure of the supplied SEC Network, which is a hierarchy\\n of SEC Report Elements (Tables, Axes, Members, LineItems, Abstracts, Concepts).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the model structures of these SEC Networks.\"},errors:[]},{isDocumented:!0,arity:1,name:\"networks-for-disclosures\",qname:\"sec-networks:networks-for-disclosures\",signature:\"($disclosures as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all SEC Networks that bear the supplied disclosures.</p>\\n',summary:\"<p>  Retrieves all SEC Networks that bear the supplied disclosures.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"disclosures\",type:\"string\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"all models that match one of the disclosures.\"},errors:[]},{isDocumented:!0,arity:2,name:\"networks-for-filings-and-categories\",qname:\"sec-networks:networks-for-filings-and-categories\",signature:\"($archive-or-ids as item()*, $categories as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all models that belong to the archives given as first\\n parameter and that match the supplied category.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A category can be any of \"Statement\", \"Disclosure\", \"Document\",\\n \"Schedule\", or \"Unknown\".</p>\\n',summary:\"<p>  Retrieves all models that belong to the archives given as first\\n parameter and that match the supplied category.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an arbitrary number of archive identifiers (AIDs) or archive objects.</div>'},{name:\"categories\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of categories.</div>'}],returns:{type:\"object()*\",description:\"all said models\"},errors:[]},{isDocumented:!0,arity:2,name:\"networks-for-filings-and-disclosures\",qname:\"sec-networks:networks-for-filings-and-disclosures\",signature:\"($archive-or-ids as item()*, $disclosures as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all models that belong to the archives given as first\\n parameter and that match the supplied disclosures.</p>\\n',summary:\"<p>  Retrieves all models that belong to the archives given as first\\n parameter and that match the supplied disclosures.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an arbitrary number of archive identifiers (AIDs) or archive objects.</div>'},{name:\"disclosures\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of disclosures.</div>'}],returns:{type:\"object()*\",description:\"all models in the archives and that match one of the disclosures.\"},errors:[]},{isDocumented:!0,arity:1,name:\"networks-for-filings\",qname:\"sec-networks:networks-for-filings\",signature:\"($archives-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all SEC Networks in a given filing.</p>\\n',summary:\"<p>  Retrieves all SEC Networks in a given filing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"all networks in the supplied filings.\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-abstracts\",qname:\"sec-networks:num-abstracts\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC Abstracts in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC Abstracts in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of abstracts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-axes\",qname:\"sec-networks:num-axes\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC Axes in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC Axes in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of axes\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concepts\",qname:\"sec-networks:num-concepts\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC Concepts in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC Concepts in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of concepts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-line-items\",qname:\"sec-networks:num-line-items\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC LineItems report elements in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC LineItems report elements in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of line items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-members\",qname:\"sec-networks:num-members\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC Members in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC Members in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of members\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-report-elements\",qname:\"sec-networks:num-report-elements\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of (distinct) SEC report elements in each of the given components.\\n\",summary:\"<p> Return the number of (distinct) SEC report elements in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of report elements\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-tables\",qname:\"sec-networks:num-tables\",signature:\"($networks-or-ids as item()*) as integer*\",description:\" Return the number of SEC Tables in each of the given components.\\n\",summary:\"<p> Return the number of SEC Tables in each of the given components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of components or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of tables\"},errors:[]},{isDocumented:!0,arity:1,name:\"populated-model-structures\",qname:\"sec-networks:populated-model-structures\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Networks and populates the model structures.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Networks and populates the model structures.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the populated model structures (Facts array fields).\"},errors:[]},{isDocumented:!0,arity:2,name:\"populated-model-structures\",qname:\"sec-networks:populated-model-structures\",signature:\"($networks-or-ids as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts belonging to the SEC Networks and populates the model structures.</p>\\n',summary:\"<p>  Retrieves all facts belonging to the SEC Networks and populates the model structures.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"the populated model structures (Facts array fields).\"},errors:[]},{isDocumented:!0,arity:1,name:\"sub-categories\",qname:\"sec-networks:sub-categories\",signature:\"($networks-or-ids) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the sub-categories of the supplied SEC networks (Detail, TextBlockLevel4, TextBLockLevel1to3).</p>\\n',summary:\"<p>  Return the sub-categories of the supplied SEC networks (Detail, TextBlockLevel4, TextBLockLevel1to3).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"string*\",description:\"the sub-category of each network.\"},errors:[]},{isDocumented:!0,arity:1,name:\"summaries\",qname:\"sec-networks:summaries\",signature:\"($networks-or-ids) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return summary information for the supplied SEC networks.</p>\\n',summary:\"<p>  Return summary information for the supplied SEC networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"one object per network, containing a summary.\"},errors:[]},{isDocumented:!0,arity:1,name:\"tables\",qname:\"sec-networks:tables\",signature:\"($networks-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Tables contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Tables are XBRL hypercubes.</p>\\n',summary:\"<p>  Returns all SEC Tables contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'}],returns:{type:\"object()*\",description:\"the SEC Tables.\"},errors:[]},{isDocumented:!0,arity:2,name:\"tables\",qname:\"sec-networks:tables\",signature:\"($networks-or-ids as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns all SEC Tables contained in the supplied SEC Networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Tables are XBRL hypercubes.</p>\\n',summary:\"<p>  Returns all SEC Tables contained in the supplied SEC Networks.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SEC Network objects, or their XBRL Component IDs.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"the SEC Tables.\"},errors:[]}],variables:[{name:\"sec-networks:BALANCE_SHEET\",type:\"xs:string\",description:\" Disclosure for the balance sheet.\\n\"},{name:\"sec-networks:BALANCE_SHEET_PARENTHETICAL\",type:\"xs:string\",description:\" Disclosure for the parenthetical balance sheet.\\n\"},{name:\"sec-networks:INCOME_STATEMENT\",type:\"xs:string\",description:\" Disclosure for the income statement.\\n\"},{name:\"sec-networks:INCOME_STATEMENT_PARENTHETICAL\",type:\"xs:string\",description:\" Disclosure for the parenthetical income statement.\\n\"},{name:\"sec-networks:STATEMENT_OF_COMPREHENSIVE_INCOME\",type:\"xs:string\",description:\" Disclosure for the statement of comprehensive income.\\n\"},{name:\"sec-networks:CASH_FLOW_STATEMENT\",type:\"xs:string\",description:\" Disclosure for the cash flow statement.\\n\"},{name:\"sec-networks:CASH_FLOW_STATEMENT_PARENTHETICAL\",type:\"xs:string\",description:\" Disclosure for the parenthetical cash flow statement.\\n\"},{name:\"sec-networks:DEFAULT_COMPONENT\",type:\"xs:string\",description:\" Disclosure for the default component.\\n\"},{name:\"sec-networks:DOCUMENT_AND_ENTITY_INFO\",type:\"xs:string\",description:\" Disclosure for the document and entity information\\n\"}]},\"http://www.28msec.com/modules/http/request\":{ns:\"http://www.28msec.com/modules/http/request\",description:' The Sausalito request module provides functions for accessing\\n information contained in the current HTTP request. For example,\\n the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">parameter-names</tt> function can be used to retrieve all\\n the names of the parameters contained in a request.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"request\"},{uri:\"http://www.zorba-xquery.com/modules/cryptography/hmac\",prefix:\"sec\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"binary-content\",qname:\"request:binary-content\",signature:\"() as xs:base64Binary external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as base64Binary.</p>\\n',summary:\"<p>  Returns the content of the request as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:base64Binary\",description:\"The content of the request as base64Binary.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-binary-content if the content contained in the body of the request cannot be treated as binary because it is a request with multipart or url-encoded content.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"binary-part\",qname:\"request:binary-part\",signature:\"($ref as xs:string) as xs:base64Binary external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> attribute returned by the <tt>request:parts</tt> function.</p>\\n',summary:\"<p>  Returns the value of a part as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'}],returns:{type:\"xs:base64Binary\",description:\"the value of the part as base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"content-length\",qname:\"request:content-length\",signature:\"() as xs:integer? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the length of the content in bytes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value returned corresponds to the value of the HTTP\\n content-length header. The function returns an empty sequence\\n if this header does not exist in the request or its value\\n could not be converted to item of type xs:integer</p>.\\n',summary:\"<p>  Returns the length of the content in bytes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:integer?\",description:\"The content-length in bytes of the content sent with this request or the empty sequence if the content-length header does not exist in the request.\"},errors:[]},{isDocumented:!0,arity:0,name:\"content-type\",qname:\"request:content-type\",signature:\"() as xs:string? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content-type of the data sent with this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that the content-type is only set for PUT and POST requests.</p>\\n',summary:\"<p>  Returns the content-type of the data sent with this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string?\",description:\"The content-type of the request if it is a PUT or POST request. Otherwise, it returns the empty sequence.\"},errors:[]},{isDocumented:!0,arity:0,name:\"header-accept\",qname:\"request:header-accept\",signature:\"() as element(request:accept)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the values of the HTTP ACCEPT header.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The data is returned as a sequence of elements with name\\n <tt>request:accept</tt> as shown in the following example.</p>\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  &lt;request:accept xmlns:request=\"http://www.28msec.com/modules/http/request\"&gt;\\n    &lt;request:type&gt;text&lt;/request:type&gt;\\n    &lt;request:subtype&gt;html&lt;/request:subtype&gt;\\n    &lt;request:quality&gt;1&lt;/request:quality&gt;\\n  &lt;/request:accept&gt;\\n  &lt;request:accept xmlns=\"http://www.28msec.com/modules/http/request\"&gt;\\n    &lt;request:type&gt;application&lt;/request:type&gt;\\n    &lt;request:quality&gt;0.9&lt;/request:quality&gt;\\n  &lt;/request:accept&gt;\\n </code>\\n',summary:\"<p>  Returns the values of the HTTP ACCEPT header.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(request:accept)*\",description:\"The header values of the header ACCEPT or the empty sequence if the header is not contained in the request. The order of the returned elements reflects the order of the components in the header.\"},errors:[]},{isDocumented:!0,arity:0,name:\"header-names\",qname:\"request:header-names\",signature:\"() as xs:string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of all the HTTP headers in this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Header fields are colon-separated name-value pairs, terminated\\n by a carriage return (CR) and line feed (LF) character sequence. The\\n names and values of each header are allowed to consist of US-ASCII\\n characters only.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The names of the headers are returned using upper-case letters.\\n If a header with the same name is contained multiple times in a request,\\n its name is only returned once. The order of the names in the resulting\\n sequence does not reflect the order of the headers in the request. If\\n a header does not have a value, it is as if the header does not exist\\n in the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that the header names user-agent and content-type are not\\n returned by this function. They are returned by the corresponding\\n functions of this module module\\n (e.g. <a href=\"#user-agent-0\">user-agent</a>).</p>\\n',summary:\"<p>  Returns the names of all the HTTP headers in this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"The names of the headers of this request or the empty sequence if no headers are contained in the request.\"},errors:[]},{isDocumented:!0,arity:1,name:\"header-value\",qname:\"request:header-value\",signature:\"($name as xs:string) as xs:string? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of the HTTP header with the given name.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Header fields are colon-separated name-value pairs, terminated\\n by a carriage return (CR) and line feed (LF) character sequence. The\\n names and values of each header are allowed to consist of US-ASCII\\n characters only.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that header names are considered case-insensitive.\\n Also note, that only one value is returned if multiple headers with the\\n same names exist in the request. This value is a comma-separated list\\n of the values of the headers in the order in which the headers appeared\\n in the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">All headers having a name that starts with SAUSALITO_ are reserved\\n and will not be returned by this function.</p>\\n',summary:\"<p>  Returns the value of the HTTP header with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The header name for which the value should be returned.</div>'}],returns:{type:\"xs:string?\",description:'The header value of the header with the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$name</tt> argument or the empty sequence if no header with that name is contained in the request.'},errors:[]},{isDocumented:!0,arity:0,name:\"method-delete\",qname:\"request:method-delete\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is DELETE.\\n\",summary:\"<p> Returns true if the HTTP method of this request is DELETE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is DELETE, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-get\",qname:\"request:method-get\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is GET.\\n\",summary:\"<p> Returns true if the HTTP method of this request is GET.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is GET, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-head\",qname:\"request:method-head\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is HEAD.\\n\",summary:\"<p> Returns true if the HTTP method of this request is HEAD.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is HEAD, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-options\",qname:\"request:method-options\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is OPTION.\\n\",summary:\"<p> Returns true if the HTTP method of this request is OPTION.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is OPTION, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-patch\",qname:\"request:method-patch\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is PATCH.\\n\",summary:\"<p> Returns true if the HTTP method of this request is PATCH.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is PATCH, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-post\",qname:\"request:method-post\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is POST.\\n\",summary:\"<p> Returns true if the HTTP method of this request is POST.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is POST, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-put\",qname:\"request:method-put\",signature:\"() as xs:boolean external\",description:\" Returns true if the HTTP method of this request is PUT.\\n\",summary:\"<p> Returns true if the HTTP method of this request is PUT.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is PUT, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method\",qname:\"request:method\",signature:\"() as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the HTTP method used to make this request.</p>\\n',summary:\"<p>  Returns the name of the HTTP method used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The request method used to make this request (i.e. GET, POST, PUT, DELETE or HEAD).\"},errors:[]},{isDocumented:!0,arity:0,name:\"parameter-names\",qname:\"request:parameter-names\",signature:\"() as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of the parameters contained in the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Also, the names of each parameter (after being precent-decoded) are\\n treated as UTF-8. Please see the <tt>http:parameter-names#1</tt> function\\n for retrieving parameter names submitted using a encoding other than UTF-8.\\n </p>\\n',summary:\"<p>  Returns the names of the parameters contained in the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"The names of all parameters in this request. The empty sequence is returned if there are none.\"},errors:[]},{isDocumented:!0,arity:1,name:\"parameter-names\",qname:\"request:parameter-names\",signature:\"($encoding as xs:string) as xs:string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of the parameters contained in the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:parameter-names#0</tt> function.\\n However, the names are treated (after precent-decoding) using the\\n given encoding supplied as parameter. For example, parameters might\\n be encoded using the ISO-8859-1 encoding.</p>\\n',summary:\"<p>  Returns the names of the parameters contained in the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the parameters in the request (e.g. ISO-8859-1).</div>'}],returns:{type:\"xs:string*\",description:\"The names of all parameters in this request. The empty sequence is returned if there are none.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"parameter-values\",qname:\"request:parameter-values\",signature:\"($name as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Also, the names and the values of each parameter (after being precent-decoded)\\n are treated as UTF-8. Please see the <tt>http:parameter-values#3</tt> function\\n for retrieving parameters submitted using a encoding other than UTF-8.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns the empty-sequence if no parameter with the\\n given name exists in this request. If you want the function to return\\n a default value other than the empty sequence, use the\\n <tt>http:parameter-values#2</tt> function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A URL could contain the following query string:\\n <tt>name1=value1&amp;name2=value2;name1=value3&amp;name3</tt>.\\n <tt>name1=value1&amp;name2=value2&amp;name1=value3&amp;name3</tt>.\\n The name value pairs in this query string are\\n <ul>\\n   <li> name: <tt>name1</tt>; values: <tt>value1</tt> and <tt>value3</tt></li>\\n   <li> name: <tt>name2</tt>; value: <tt>value2</tt></li>\\n   <li> name: <tt>name3</tt>; value: <tt/></li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The empty sequence is returned if no parameter exists with the given name.\"},errors:[]},{isDocumented:!0,arity:2,name:\"parameter-values\",qname:\"request:parameter-values\",signature:\"($name as xs:string, $default-values as xs:string*) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:parameter-values#1</tt> function.\\n However, instead of returning the empty-sequence as a default value it returns\\n the given default-values sequence if no parameter with the given name is found\\n in this request.</p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'},{name:\"default-values\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The sequence given as $default-values parameter is returned if no parameter exists with the given name.\"},errors:[]},{isDocumented:!0,arity:3,name:\"parameter-values\",qname:\"request:parameter-values\",signature:\"($name as xs:string, $default-values as xs:string*, $encoding as xs:string) as xs:string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:parameter-values#2</tt> function.\\n However, the names and values are treated (after precent-decoding) using the\\n given encoding supplied as third parameter. For example, parameters might\\n be encoded using the ISO-8859-1 encoding.</p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'},{name:\"default-values\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the parameters in the request (e.g. ISO-8859-1)</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The sequence given as $default-values parameter is returned if no parameter exists with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"parts\",qname:\"request:parts\",signature:\"() as element(request:multipart) external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the metadata of all parts contained in a multipart request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The data is returned as an element with name <tt>request:mulitpart</tt>\\n as shown in the following example.</p>\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  &lt;multipart xmlns=\"http://www.28msec.com/modules/http/request\"\\n    media-type=\"multipart/...; boundary=...\"&gt;\\n    &lt;header name=\"Content-Disposition\" value=\\'form-data; filename=\"...\"\\'/&gt;\\n    &lt;header name=\"Content-Type\" value=\"application/octet-stream\"/&gt;\\n    &lt;body filename=\"...\" src=\"...\"/&gt;\\n    &lt;header name=\"Content-Disposition\" value=\\'form-data; filename=\"...\"\\'/&gt;\\n    &lt;header name=\"Content-Type\" value=\"application/octet-stream\"/&gt;\\n    &lt;body filename=\"...\" src=\"...\"/&gt;\\n  &lt;/multipart&gt;\\n </code>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The <tt>media-type</tt> is the type of the content as given in the\\n request (i.e. it\\'s value is equal to the value returned by\\n <tt>request:header-values(\"Content-Type\")</tt>).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Within the <tt>multipart</tt> element is a sequence of\\n (<tt>header</tt>*,<tt>body</tt>) elements. Each such group corresponds to\\n one part. Every <tt>header</tt> belongs to a header for this part and the\\n <tt>body</tt> refers to the value of a part. The actual value of a part\\n can be retrieved by passing the value of the <tt>src</tt> attribute of\\n the <tt>body</tt> to the <tt>request:text-part</tt> or\\n <tt>request:binary-part</tt> functions. The other attributes of the\\n <tt>body</tt> element represent a parameter of the Content-Disposition\\n header as described in RFC 2183 (e.g. filename, name, creation-date).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that recursive multipart content is not supported.</p>\\n',summary:\"<p>  Returns the metadata of all parts contained in a multipart request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(request:multipart)\",description:\"a multipart element representing the meta data of the multipart content\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"path\",qname:\"request:path\",signature:\"() as xs:string\",description:\" Return the path component of the request URI. The path starts after the\\n host and ends before the query string starts.\\n\",summary:\"<p> Return the path component of the request URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The path component of the request URI\"},errors:[]},{isDocumented:!0,arity:0,name:\"query-string\",qname:\"request:query-string\",signature:\"() as xs:string external\",description:\" <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">Returns the query string that was used to make this request.</p>\\n <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">The query string contains the part of the request URL that\\n starts with the '?' character to the end or the starting of the\\n fragment (i.e. the '#' character).</p>\\n\",summary:\"<p>  Returns the query string that was used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The query string part of the request's URL\"},errors:[]},{isDocumented:!0,arity:0,name:\"remote-addr\",qname:\"request:remote-addr\",signature:\"() as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the IP address of the client to which this request\\n is connected.</p>\\n',summary:\"<p>  Returns the IP address of the client to which this request\\n is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The IP address on the client side to which this request is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"remote-port\",qname:\"request:remote-port\",signature:\"() as xs:int external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the port of the client to which this request is connected.</p>\\n',summary:\"<p>  Returns the port of the client to which this request is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:int\",description:\"The port on the client side to which this request is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"server-name\",qname:\"request:server-name\",signature:\"() as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the server name of the server running the application.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The web server\\'s hostname or IP address.</p>\\n',summary:\"<p>  Returns the server name of the server running the application.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The name of the server that runs the application accepting this request.\"},errors:[]},{isDocumented:!0,arity:0,name:\"server-port\",qname:\"request:server-port\",signature:\"() as xs:int external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the sever port to which the client making the current request\\n is connected.</p>\\n',summary:\"<p>  Returns the sever port to which the client making the current request\\n is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:int\",description:\"The server port to which the client is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"text-content\",qname:\"request:text-content\",signature:\"() as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the content of the request only\\n if the content-type refers to a type that can be treated\\n as text (e.g. text/* or application/xml). The function raises\\n an error if the content cannot be treated as text.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The text content is interpreted using the encoding/charset\\n that is specified in the Content-Type header of the request. If\\n no charset is specified, the default ISO-8859-1 is used. If a encoding\\n other than the specified or default one should be used, the\\n <tt>request:text-content#1</tt> function should be used.</p>\\n',summary:\"<p>  Returns the content of the request as string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The content of the request as a string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding specified in the Content-Type header is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the content contained in the body of the request cannot be treated as text.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-content\",qname:\"request:text-content\",signature:\"($overwrite-encoding as xs:string) as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as string interpreting\\n it with the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the content of the request only\\n if the content-type refers to a type that can be treated\\n as text (e.g. text/* or application/xml). The function raises\\n an error if the content cannot be treated as text.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The text content is interpreted using the given encoding/charset.\\n That is, the charset specified in the Content-Type header of the request\\n is ignored. An error is raised if the given encoding is invalid\\n or not supported.</p>\\n',summary:\"<p>  Returns the content of the request as string interpreting\\n it with the given encoding.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"overwrite-encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"The content of the request as a string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding specified in the Content-Type header or the $overwrite-encoding parameter is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the content contained in the body of the request cannot be treated as text.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-part\",qname:\"request:text-part\",signature:\"($ref as xs:string) as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as string</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> attribute returned by the <tt>request:parts</tt> function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value of the text part is interpreted using the encoding/charset\\n given in the headers of the part. If no encoding is given, the default\\n US-ASCII is assumed.</p>\\n',summary:\"<p>  Returns the value of a part as string \\n  A part is identified by a reference that is the value of a\\n  src  attribute returned by the  request:parts  function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'}],returns:{type:\"xs:string\",description:\"the value of the part as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding given in the headers of the part is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"text-part\",qname:\"request:text-part\",signature:\"($ref as xs:string, $overwrite-encoding as xs:string) as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as string interpreting\\n it with the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> attribute returned by the <tt>request:parts</tt> function.</p>\\n',summary:\"<p>  Returns the value of a part as string interpreting\\n it with the given encoding.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'},{name:\"overwrite-encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"the value of the part as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding given using the $overwrite-encoding parameter is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"uri\",qname:\"request:uri\",signature:\"() as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the URI that was used to make this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value returned contains the part of the URL starting\\n from the path to the end or the starting of the fragment (i.e.\\n the \\'#\\' character).</p>\\n',summary:\"<p>  Returns the URI that was used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The path and query string part of the request's URL\"},errors:[]},{isDocumented:!0,arity:0,name:\"user-agent\",qname:\"request:user-agent\",signature:\"() as xs:string? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the user agent that made to perform the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns the value of the User-Agent header\\n contained in the current request.</p>\\n',summary:\"<p>  Returns the user agent that made to perform the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string?\",description:\"The user agent used to perform this request of the empty sequence if there was no User-Agent header in the request.\"},errors:[]}],variables:[]},\"http://www.w3.org/2005/xpath-functions\":{ns:\"http://www.w3.org/2005/xpath-functions\",description:\" This module contains all the functions specified in the\\n W3C XPath and XQuery Functions and Operators 3.0.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.w3.org/TR/xpath-functions-30/</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">www.w3c.org</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[],functions:[{isDocumented:!0,arity:2,name:\"QName\",qname:\"fn:QName\",signature:\"($paramURI as xs:string?, $paramQName as xs:string) as xs:QName external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Constructs an <code>xs:QName</code> value given a namespace URI and a lexical\\n             QName.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"QName\" return-type=\"xs:QName\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"paramURI\" type=\"xs:string?\"/><arg name=\"paramQName\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The namespace URI in the returned QName is taken from <code>$paramURI</code>. If\\n                <code>$paramURI</code> is the zero-length string or the empty sequence, it represents\\n             \"no namespace\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The prefix (or absence of a prefix) in <code>$paramQName</code> is retained in the\\n             returned <code>xs:QName</code> value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The local name in the result is taken from the local part of\\n             <code>$paramQName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"CA\" code=\"0002\"/> if <code>$paramQName</code> does\\n             not have the correct lexical form for an instance of <code>xs:QName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"CA\" code=\"0002\"/> if <code>$paramURI</code> is the\\n             zero-length string or the empty sequence, and the value of <code>$paramQName</code>\\n             contains a colon (<code>:</code>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CA\" code=\"0002\"/> if <code>$paramURI</code> is not a valid URI (XML Namespaces 1.0) or\\n             IRI (XML Namespaces 1.1). </p></div>\\n',summary:\"<p>  Constructs an  xs:QName  value given a namespace URI and a lexical\\n             QName.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"paramURI\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"paramQName\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:QName\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"abs\",qname:\"fn:abs\",signature:\"($arg as numeric?) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the absolute value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"abs\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is negative the function returns <code>-$arg</code>, otherwise it\\n             returns <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For <code>xs:float</code> and <code>xs:double</code> arguments, if the argument is\\n             positive zero or negative zero, then positive zero is returned. If the argument is\\n             positive or negative infinity, positive infinity is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:abs(10.5)</code> returns <code>10.5</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:abs(-10.5)</code> returns <code>10.5</code>.</p></div>\\n',summary:\"<p>  Returns the absolute value of  $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"adjust-date-to-timezone\",qname:\"fn:adjust-date-to-timezone\",signature:\"($arg as xs:date?) as xs:date? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:date</code> value to a specific timezone, or to no timezone\\n             at all; the result is the date in the target timezone that contains the starting instant\\n             of the supplied date.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-date-to-timezone\" return-type=\"xs:date?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-date-to-timezone\" return-type=\"xs:date?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the local value of <code>$arg</code> without its timezone\\n             component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then the function returns the value of the expression:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Let <code>$dt</code> be the value of <code>fn:dateTime($arg,\\n                      xs:time(\\'00:00:00\\'))</code>.</p></item><item><p>Let <code>$adt</code> be the value of <code>fn:adjust-dateTime-to-timezone($dt,\\n                      $timezone)</code></p></item><item><p>The function returns the value of <code>xs:date($adt)</code></p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or is not an integral number\\n             of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:date  value to a specific timezone, or to no timezone\\n             at all; the result is the date in the target timezone that contains the starting instant\\n             of the supplied date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-date-to-timezone\",qname:\"fn:adjust-date-to-timezone\",signature:\"($arg as xs:date?, $timezone as xs:dayTimeDuration?) as xs:date? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:date</code> value to a specific timezone, or to no timezone\\n             at all; the result is the date in the target timezone that contains the starting instant\\n             of the supplied date.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-date-to-timezone\" return-type=\"xs:date?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-date-to-timezone\" return-type=\"xs:date?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the local value of <code>$arg</code> without its timezone\\n             component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then the function returns the value of the expression:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Let <code>$dt</code> be the value of <code>fn:dateTime($arg,\\n                      xs:time(\\'00:00:00\\'))</code>.</p></item><item><p>Let <code>$adt</code> be the value of <code>fn:adjust-dateTime-to-timezone($dt,\\n                      $timezone)</code></p></item><item><p>The function returns the value of <code>xs:date($adt)</code></p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or is not an integral number\\n             of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:date  value to a specific timezone, or to no timezone\\n             at all; the result is the date in the target timezone that contains the starting instant\\n             of the supplied date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"adjust-dateTime-to-timezone\",qname:\"fn:adjust-dateTime-to-timezone\",signature:\"($arg as xs:dateTime?) as xs:dateTime external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:dateTime</code> value to a specific timezone, or to no\\n             timezone at all.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-dateTime-to-timezone\" return-type=\"xs:dateTime?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-dateTime-to-timezone\" return-type=\"xs:dateTime?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the local value of <code>$arg</code> without its timezone\\n             component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then the result is the <code>xs:dateTime</code> value that is equal to\\n                <code>$arg</code> and that has a timezone component equal to\\n             <code>$timezone</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or is not an integral number\\n             of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:dateTime  value to a specific timezone, or to no\\n             timezone at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dateTime\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-dateTime-to-timezone\",qname:\"fn:adjust-dateTime-to-timezone\",signature:\"($arg as xs:dateTime?, $timezone as xs:dayTimeDuration?) as xs:dateTime external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:dateTime</code> value to a specific timezone, or to no\\n             timezone at all.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-dateTime-to-timezone\" return-type=\"xs:dateTime?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-dateTime-to-timezone\" return-type=\"xs:dateTime?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the local value of <code>$arg</code> without its timezone\\n             component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then the result is the <code>xs:dateTime</code> value that is equal to\\n                <code>$arg</code> and that has a timezone component equal to\\n             <code>$timezone</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or is not an integral number\\n             of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:dateTime  value to a specific timezone, or to no\\n             timezone at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dateTime\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"adjust-time-to-timezone\",qname:\"fn:adjust-time-to-timezone\",signature:\"($arg as xs:time?) as xs:time? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:time</code> value to a specific timezone, or to no timezone\\n             at all.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-time-to-timezone\" return-type=\"xs:time?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-time-to-timezone\" return-type=\"xs:time?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the localized value of <code>$arg</code> without its\\n             timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Let <code>$dt</code> be the <code>xs:dateTime</code> value\\n                      <code>fn:dateTime(xs:date(\\'1972-12-31\\'), $arg)</code>.</p></item><item><p>Let <code>$adt</code> be the value of <code>fn:adjust-dateTime-to-timezone($dt,\\n                      $timezone)</code>\\n                </p></item><item><p>The function returns the <code>xs:time</code> value\\n                   <code>xs:time($adt)</code>.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or if does not contain an\\n             integral number of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:time  value to a specific timezone, or to no timezone\\n             at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:time?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-time-to-timezone\",qname:\"fn:adjust-time-to-timezone\",signature:\"($arg as xs:time?, $timezone as xs:dayTimeDuration?) as xs:time? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Adjusts an <code>xs:time</code> value to a specific timezone, or to no timezone\\n             at all.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"adjust-time-to-timezone\" return-type=\"xs:time?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example><example role=\"signature\"><proto name=\"adjust-time-to-timezone\" return-type=\"xs:time?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/><arg name=\"timezone\" type=\"xs:dayTimeDuration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$timezone</code> is not specified, then the effective value of\\n                <code>$timezone</code> is the value of the implicit timezone in the dynamic\\n             context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> is the empty sequence, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             the empty sequence, then the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> does not have a timezone component and <code>$timezone</code> is\\n             not the empty sequence, then the result is <code>$arg</code> with <code>$timezone</code>\\n             as the timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is the empty\\n             sequence, then the result is the localized value of <code>$arg</code> without its\\n             timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$arg</code> has a timezone component and <code>$timezone</code> is not the\\n             empty sequence, then:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Let <code>$dt</code> be the <code>xs:dateTime</code> value\\n                      <code>fn:dateTime(xs:date(\\'1972-12-31\\'), $arg)</code>.</p></item><item><p>Let <code>$adt</code> be the value of <code>fn:adjust-dateTime-to-timezone($dt,\\n                      $timezone)</code>\\n                </p></item><item><p>The function returns the <code>xs:time</code> value\\n                   <code>xs:time($adt)</code>.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DT\" code=\"0003\"/> if <code>$timezone</code> is less\\n             than <code>-PT14H</code> or greater than <code>PT14H</code> or if does not contain an\\n             integral number of minutes.</p></div>\\n',summary:\"<p>  Adjusts an  xs:time  value to a specific timezone, or to no timezone\\n             at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:time?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"analyze-string\",qname:\"fn:analyze-string\",signature:\"($input as xs:string?, $pattern as xs:string) as element(fn:analyze-string-result) external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Analyzes a string using a regular expression, returning an XML structure that\\n             identifies which parts of the input string matched or failed to match the regular\\n             expression, and in the case of matched substrings, which substrings matched each\\n             capturing group in the regular expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"analyze-string\" return-type=\"element(fn:analyze-string-result)\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"analyze-string\" return-type=\"element(fn:analyze-string-result)\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same way as for the\\n                <code>fn:matches</code> function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence the function behaves as if\\n                <code>$input</code> were the zero-length string. In this situation the result will be\\n             an element node with no children.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an element node whose local name is\\n                <code>analyze-string-result</code>. This element and all its descendant elements have\\n             the namespace URI <code>http://www.w3.org/2005/xpath-functions</code>. The namespace\\n             prefix is <termref def=\"implementation-dependent\"/>. The children of this element are a\\n             sequence of <code>fn:match</code> and <code>fn:non-match</code> elements. This sequence\\n             is formed by breaking the <code>$input</code> string into a sequence of strings,\\n             returning any substring that matches <code>$pattern</code> as the content of a\\n                <code>match</code> element, and any intervening substring as the content of a\\n                <code>non-match</code> element.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the function starts at the beginning of the input string and attempts\\n             to find the first substring that matches the regular expression. If there are several\\n             matches, the first match is defined to be the one whose starting position comes first in\\n             the string. If several alternatives within the regular expression both match at the same\\n             position in the input string, then the match that is chosen is the first alternative\\n             that matches. For example, if the input string is <code>The quick brown fox jumps</code>\\n             and the regular expression is <code>jump|jumps</code>, then the match that is chosen is\\n                <code>jump</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Having found the first match, the instruction proceeds to find the second and subsequent\\n             matches by repeating the search, starting at the first <termref def=\"character\">character</termref> that was not included in the previous match.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The input string is thus partitioned into a sequence of substrings, some of which match\\n             the regular expression, others which do not match it. Each substring will contain at\\n             least one character. This sequence is represented in the result by the sequence of\\n                <code>fn:match</code> and <code>fn:non-match</code> children of the returned element\\n             node; the string value of the <code>fn:match</code> or <code>fn:non-match</code> element\\n             will be the corresponding substring of <code>$input</code>, and the string value of the\\n             returned element node will therefore be the same as <code>$input</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The content of an <code>fn:non-match</code> element is always a single text node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The content of a <code>fn:match</code> element, however, is in general a sequence of\\n             text nodes and <code>fn:group</code> element children. An <code>fn:group</code> element\\n             with a <code>nr</code> attribute having the integer value <var>N</var> identifies the\\n             substring captured by the <var>Nth</var> parenthesized sub-expression in the regular\\n             expression. For each capturing subexpression there will be at most one corresponding\\n                <code>fn:group</code> element in each <code>fn:match</code> element in the\\n             result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the function is called twice with the same arguments, it is <termref def=\"implementation-dependent\"/> whether the two calls return the same element node\\n             or distinct (but deep equal) element nodes. In this respect it is\\n             <termref def=\"nondeterministic\">nondeterministic</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"J\">The base URI of the element nodes in the result is\\n          <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A schema is defined for the structure of the returned element, containing the\\n             definitions below. The returned element and its descendants will have type annotations\\n             obtained by validating the returned element against this schema, unless the function is\\n             used in an environment where type annotations are not supported (for example, a Basic\\n             XSLT Processor), in which case the elements will all be annotated as\\n                <code>xs:untyped</code> and the attributes as <code>xs:untypedAtomic</code>.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p diff=\"add\" at=\"M\">A free-standing copy of this schema can be found at <loc xmlns:xlink=\"http://www.w3.org/1999/xlink\" href=\"analyze-string.xsd\" xlink:type=\"simple\" xlink:show=\"replace\" xlink:actuate=\"onRequest\">analyze-string.xsd</loc></p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <eg xml:space=\"preserve\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\\n &lt;xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\\n     targetNamespace=\"http://www.w3.org/2005/xpath-functions\"\\n     xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"\\n     elementFormDefault=\"qualified\"&gt;\\n     &lt;xs:element name=\"analyze-string-result\" type=\"fn:analyze-string-result-type\"/&gt;\\n     &lt;xs:element name=\"match\" type=\"fn:match-type\"/&gt;\\n     &lt;xs:element name=\"non-match\" type=\"xs:string\"/&gt;\\n     &lt;xs:element name=\"group\" type=\"fn:group-type\"/&gt;\\n     &lt;xs:complexType name=\"analyze-string-result-type\" mixed=\"true\"&gt;\\n         &lt;xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\"&gt;\\n             &lt;xs:element ref=\"fn:match\"/&gt;\\n             &lt;xs:element ref=\"fn:non-match\"/&gt;\\n         &lt;/xs:choice&gt;\\n     &lt;/xs:complexType&gt;\\n     &lt;xs:complexType name=\"match-type\" mixed=\"true\"&gt;\\n         &lt;xs:sequence&gt;\\n             &lt;xs:element ref=\"fn:group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/&gt;\\n         &lt;/xs:sequence&gt;\\n     &lt;/xs:complexType&gt;\\n     &lt;xs:complexType name=\"group-type\" mixed=\"true\"&gt;\\n         &lt;xs:sequence&gt;\\n             &lt;xs:element ref=\"fn:group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/&gt;\\n         &lt;/xs:sequence&gt;\\n         &lt;xs:attribute name=\"nr\" type=\"xs:positiveInteger\"/&gt;\\n     &lt;/xs:complexType&gt;\\n &lt;/xs:schema&gt;\\n </eg>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the supplied\\n                <code>$pattern</code> matches a zero-length string, that is, if <code>fn:matches(\"\",\\n                $pattern, $flags)</code> returns <code>true</code>.</p></div>\\n',summary:\"<p>  Analyzes a string using a regular expression, returning an XML structure that\\n             identifies which parts of the input string matched or failed to match the regular\\n             expression, and in the case of matched substrings, which substrings matched each\\n             capturing group in the regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"element(fn:analyze-string-result)\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"analyze-string\",qname:\"fn:analyze-string\",signature:\"($input as xs:string?, $pattern as xs:string, $flags as xs:string) as element(fn:analyze-string-result) external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Analyzes a string using a regular expression, returning an XML structure that\\n             identifies which parts of the input string matched or failed to match the regular\\n             expression, and in the case of matched substrings, which substrings matched each\\n             capturing group in the regular expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"analyze-string\" return-type=\"element(fn:analyze-string-result)\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"analyze-string\" return-type=\"element(fn:analyze-string-result)\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same way as for the\\n                <code>fn:matches</code> function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence the function behaves as if\\n                <code>$input</code> were the zero-length string. In this situation the result will be\\n             an element node with no children.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an element node whose local name is\\n                <code>analyze-string-result</code>. This element and all its descendant elements have\\n             the namespace URI <code>http://www.w3.org/2005/xpath-functions</code>. The namespace\\n             prefix is <termref def=\"implementation-dependent\"/>. The children of this element are a\\n             sequence of <code>fn:match</code> and <code>fn:non-match</code> elements. This sequence\\n             is formed by breaking the <code>$input</code> string into a sequence of strings,\\n             returning any substring that matches <code>$pattern</code> as the content of a\\n                <code>match</code> element, and any intervening substring as the content of a\\n                <code>non-match</code> element.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the function starts at the beginning of the input string and attempts\\n             to find the first substring that matches the regular expression. If there are several\\n             matches, the first match is defined to be the one whose starting position comes first in\\n             the string. If several alternatives within the regular expression both match at the same\\n             position in the input string, then the match that is chosen is the first alternative\\n             that matches. For example, if the input string is <code>The quick brown fox jumps</code>\\n             and the regular expression is <code>jump|jumps</code>, then the match that is chosen is\\n                <code>jump</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Having found the first match, the instruction proceeds to find the second and subsequent\\n             matches by repeating the search, starting at the first <termref def=\"character\">character</termref> that was not included in the previous match.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The input string is thus partitioned into a sequence of substrings, some of which match\\n             the regular expression, others which do not match it. Each substring will contain at\\n             least one character. This sequence is represented in the result by the sequence of\\n                <code>fn:match</code> and <code>fn:non-match</code> children of the returned element\\n             node; the string value of the <code>fn:match</code> or <code>fn:non-match</code> element\\n             will be the corresponding substring of <code>$input</code>, and the string value of the\\n             returned element node will therefore be the same as <code>$input</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The content of an <code>fn:non-match</code> element is always a single text node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The content of a <code>fn:match</code> element, however, is in general a sequence of\\n             text nodes and <code>fn:group</code> element children. An <code>fn:group</code> element\\n             with a <code>nr</code> attribute having the integer value <var>N</var> identifies the\\n             substring captured by the <var>Nth</var> parenthesized sub-expression in the regular\\n             expression. For each capturing subexpression there will be at most one corresponding\\n                <code>fn:group</code> element in each <code>fn:match</code> element in the\\n             result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the function is called twice with the same arguments, it is <termref def=\"implementation-dependent\"/> whether the two calls return the same element node\\n             or distinct (but deep equal) element nodes. In this respect it is\\n             <termref def=\"nondeterministic\">nondeterministic</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"J\">The base URI of the element nodes in the result is\\n          <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A schema is defined for the structure of the returned element, containing the\\n             definitions below. The returned element and its descendants will have type annotations\\n             obtained by validating the returned element against this schema, unless the function is\\n             used in an environment where type annotations are not supported (for example, a Basic\\n             XSLT Processor), in which case the elements will all be annotated as\\n                <code>xs:untyped</code> and the attributes as <code>xs:untypedAtomic</code>.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p diff=\"add\" at=\"M\">A free-standing copy of this schema can be found at <loc xmlns:xlink=\"http://www.w3.org/1999/xlink\" href=\"analyze-string.xsd\" xlink:type=\"simple\" xlink:show=\"replace\" xlink:actuate=\"onRequest\">analyze-string.xsd</loc></p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <eg xml:space=\"preserve\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\\n &lt;xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\\n     targetNamespace=\"http://www.w3.org/2005/xpath-functions\"\\n     xmlns:fn=\"http://www.w3.org/2005/xpath-functions\"\\n     elementFormDefault=\"qualified\"&gt;\\n     &lt;xs:element name=\"analyze-string-result\" type=\"fn:analyze-string-result-type\"/&gt;\\n     &lt;xs:element name=\"match\" type=\"fn:match-type\"/&gt;\\n     &lt;xs:element name=\"non-match\" type=\"xs:string\"/&gt;\\n     &lt;xs:element name=\"group\" type=\"fn:group-type\"/&gt;\\n     &lt;xs:complexType name=\"analyze-string-result-type\" mixed=\"true\"&gt;\\n         &lt;xs:choice minOccurs=\"0\" maxOccurs=\"unbounded\"&gt;\\n             &lt;xs:element ref=\"fn:match\"/&gt;\\n             &lt;xs:element ref=\"fn:non-match\"/&gt;\\n         &lt;/xs:choice&gt;\\n     &lt;/xs:complexType&gt;\\n     &lt;xs:complexType name=\"match-type\" mixed=\"true\"&gt;\\n         &lt;xs:sequence&gt;\\n             &lt;xs:element ref=\"fn:group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/&gt;\\n         &lt;/xs:sequence&gt;\\n     &lt;/xs:complexType&gt;\\n     &lt;xs:complexType name=\"group-type\" mixed=\"true\"&gt;\\n         &lt;xs:sequence&gt;\\n             &lt;xs:element ref=\"fn:group\" minOccurs=\"0\" maxOccurs=\"unbounded\"/&gt;\\n         &lt;/xs:sequence&gt;\\n         &lt;xs:attribute name=\"nr\" type=\"xs:positiveInteger\"/&gt;\\n     &lt;/xs:complexType&gt;\\n &lt;/xs:schema&gt;\\n </eg>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the supplied\\n                <code>$pattern</code> matches a zero-length string, that is, if <code>fn:matches(\"\",\\n                $pattern, $flags)</code> returns <code>true</code>.</p></div>\\n',summary:\"<p>  Analyzes a string using a regular expression, returning an XML structure that\\n             identifies which parts of the input string matched or failed to match the regular\\n             expression, and in the case of matched substrings, which substrings matched each\\n             capturing group in the regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"flags\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"element(fn:analyze-string-result)\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"available-environment-variables\",qname:\"fn:available-environment-variables\",signature:\"() as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a list of environment variable names that are suitable for passing to\\n                <code>fn:environment-variable</code>, as a (possibly empty) sequence of strings.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"available-environment-variables\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tenvironment variables.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of strings, being the names of the environment variables\\n             in the dynamic context in some <termref def=\"implementation-dependent\">implementation-dependent</termref> order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is <termref def=\"dt-deterministic\">deterministic</termref>: that is, the\\n             set of available environment variables does not vary during evaluation.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a list of strings, containing no duplicates.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">It is intended that the strings in this list should be suitable for passing to\\n                <code>fn:environment-variable</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See also the note on security under the definition of the\\n                <code>fn:environment-variable</code> function. If access to environment variables has\\n             been disabled, <code>fn:available-environment-variables</code> always returns the empty\\n             sequence.</p></div>\\n',summary:\"<p>  Returns a list of environment variable names that are suitable for passing to\\n                 fn:environment-variable , as a (possibly empty) sequence of strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"available-environment-variables\",qname:\"fn:available-environment-variables\",signature:\"() as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a list of environment variable names that are suitable for passing to\\n                <code>fn:environment-variable</code>, as a (possibly empty) sequence of strings.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"available-environment-variables\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tenvironment variables.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of strings, being the names of the environment variables\\n             in the dynamic context in some <termref def=\"implementation-dependent\">implementation-dependent</termref> order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is <termref def=\"dt-deterministic\">deterministic</termref>: that is, the\\n             set of available environment variables does not vary during evaluation.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a list of strings, containing no duplicates.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">It is intended that the strings in this list should be suitable for passing to\\n                <code>fn:environment-variable</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See also the note on security under the definition of the\\n                <code>fn:environment-variable</code> function. If access to environment variables has\\n             been disabled, <code>fn:available-environment-variables</code> always returns the empty\\n             sequence.</p></div>\\n',summary:\"<p>  Returns a list of environment variable names that are suitable for passing to\\n                 fn:environment-variable , as a (possibly empty) sequence of strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"avg\",qname:\"fn:avg\",signature:\"($arg as xs:anyAtomicType*) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the average of the values in the input sequence <code>$arg</code>, that\\n             is, the sum of the values divided by the number of values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"avg\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> contains values of type <code>xs:untypedAtomic</code> they are cast\\n             to <code>xs:double</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Duration values must either all be <code>xs:yearMonthDuration</code> values or must all\\n             be <code>xs:dayTimeDuration</code> values. For numeric values, the numeric promotion\\n             rules defined in <specref ref=\"op.numeric\"/> are used to promote all values to a single\\n             common type. After these operations, <code>$arg</code> must contain items of a single\\n             type, which must be one of the four numeric types, <code>xs:yearMonthDuration</code> or\\n                <code>xs:dayTimeDuration</code> or one if its subtypes.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the average of the values as <code>sum($arg) div\\n             count($arg)</code>; but the implementation may use an otherwise equivalent algorithm\\n             that avoids arithmetic overflow.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns the average of the values in the input sequence  $arg , that\\n             is, the sum of the values divided by the number of values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"base-uri\",qname:\"fn:base-uri\",signature:\"() as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the base URI of a node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"base-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"base-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The zero-argument version of the function returns the base URI of the\\n             context node: it is equivalent to calling <code>fn:base-uri(.)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The single-argument version of the function behaves as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item>If <code>$arg</code> is the empty sequence, the function returns the empty\\n                sequence.</item><item>Otherwise, the function returns the value of the <code>dm:base-uri</code> accessor\\n                applied to the node <code>$arg</code>. This accessor is defined, for each kind of\\n                node, in the XDM specification (See <xspecref spec=\"DM30\" ref=\"dm-base-uri\"/>).</item></olist><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">As explained in XDM, document, element and processing-instruction nodes have a\\n             base-uri property which may be empty. The base-uri property for all other node kinds is\\n             the empty sequence. The dm:base-uri accessor returns the base-uri property of a node if\\n             it exists and is non-empty; otherwise it returns the result of applying the dm:base-uri\\n             accessor to its parent, recursively. If the node does not have a parent, or if the\\n             recursive ascent up the ancestor chain encounters a parentless node whose base-uri\\n             property is empty, the empty sequence is returned. In the case of namespace nodes,\\n             however, the result is always an empty sequence -- it does not depend on the base URI of\\n             the parent element.</note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See also <code>fn:static-base-uri</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the base URI of a node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"base-uri\",qname:\"fn:base-uri\",signature:\"($arg as node()?) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the base URI of a node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"base-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"base-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The zero-argument version of the function returns the base URI of the\\n             context node: it is equivalent to calling <code>fn:base-uri(.)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The single-argument version of the function behaves as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item>If <code>$arg</code> is the empty sequence, the function returns the empty\\n                sequence.</item><item>Otherwise, the function returns the value of the <code>dm:base-uri</code> accessor\\n                applied to the node <code>$arg</code>. This accessor is defined, for each kind of\\n                node, in the XDM specification (See <xspecref spec=\"DM30\" ref=\"dm-base-uri\"/>).</item></olist><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">As explained in XDM, document, element and processing-instruction nodes have a\\n             base-uri property which may be empty. The base-uri property for all other node kinds is\\n             the empty sequence. The dm:base-uri accessor returns the base-uri property of a node if\\n             it exists and is non-empty; otherwise it returns the result of applying the dm:base-uri\\n             accessor to its parent, recursively. If the node does not have a parent, or if the\\n             recursive ascent up the ancestor chain encounters a parentless node whose base-uri\\n             property is empty, the empty sequence is returned. In the case of namespace nodes,\\n             however, the result is always an empty sequence -- it does not depend on the base URI of\\n             the parent element.</note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See also <code>fn:static-base-uri</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the base URI of a node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"boolean\",qname:\"fn:boolean\",signature:\"($arg as item()*) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Computes the effective boolean value of the sequence <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"boolean\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function computes the effective boolean value of a sequence, defined according to\\n             the following rules. See also <xspecref spec=\"XP30\" ref=\"id-ebv\"/>.</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If <code>$arg</code> is the empty sequence, <code>fn:boolean</code> returns\\n                      <code>false</code>.</p></item><item><p>If <code>$arg</code> is a sequence whose first item is a node,\\n                      <code>fn:boolean</code> returns <code>true</code>.</p></item><item><p>If <code>$arg</code> is a singleton value of type <code>xs:boolean</code> or a\\n                   derived from <code>xs:boolean</code>, <code>fn:boolean</code> returns\\n                      <code>$arg</code>.</p></item><item><p>If <code>$arg</code> is a singleton value of type <code>xs:string</code> or a type\\n                   derived from <code>xs:string</code>, <code>xs:anyURI</code> or a type derived from\\n                      <code>xs:anyURI</code> or <code>xs:untypedAtomic</code>,\\n                      <code>fn:boolean</code> returns <code>false</code> if the operand value has\\n                   zero length; otherwise it returns <code>true</code>.</p></item><item><p>If <code>$arg</code> is a singleton value of any numeric type or a type derived\\n                   from a numeric type, <code>fn:boolean</code> returns <code>false</code> if the\\n                   operand value is <code>NaN</code> or is numerically equal to zero; otherwise it\\n                   returns <code>true</code>.</p></item><item><p>In all other cases, <code>fn:boolean</code> raises a type error <errorref class=\"RG\" code=\"0006\"/>.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">The static semantics of this function are described in [Formal\\n             Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of this function is not necessarily the same as <code>$arg cast as\\n                xs:boolean</code>. For example, <code>fn:boolean(\"false\")</code> returns the value\\n                <code>true</code> whereas <code>\"false\" cast as xs:boolean</code> (which can also be\\n             written <code>xs:boolean(\"false\")</code>) returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">let <code>$abc</code> := <code>(\"a\", \"b\", \"\")</code></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><code>fn:boolean($abc)</code> raises a type error <errorref class=\"RG\" code=\"0006\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:boolean($abc[1])</code> returns <code>true()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:boolean($abc[0])</code> returns <code>false()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:boolean($abc[3])</code> returns <code>false()</code>.</p></div>\\n',summary:\"<p>  Computes the effective boolean value of the sequence  $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"ceiling\",qname:\"fn:ceiling\",signature:\"($arg as numeric?) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds <code>$arg</code> upwards to a whole number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"ceiling\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the smallest (closest to negative infinity) number with no\\n             fractional part that is not less than the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For <code>xs:float</code> and <code>xs:double</code> arguments, if the argument is\\n             positive zero, then positive zero is returned. If the argument is negative zero, then\\n             negative zero is returned. If the argument is less than zero and greater than -1,\\n             negative zero is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:ceiling(10.5)</code> returns <code>11</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:ceiling(-10.5)</code> returns <code>-10</code>.</p></div>\\n',summary:\"<p>  Rounds  $arg  upwards to a whole number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"codepoint-equal\",qname:\"fn:codepoint-equal\",signature:\"($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:boolean? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if two strings are equal, considered codepoint-by-codepoint.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"codepoint-equal\" return-type=\"xs:boolean?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"comparand1\" type=\"xs:string?\"/><arg name=\"comparand2\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If either argument is the empty sequence, the function returns the empty sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns <code>true</code> or <code>false</code> depending on\\n             whether the value of <code>$comparand1</code> is equal to the value of\\n                <code>$comparand2</code>, according to the Unicode codepoint collation\\n                (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function allows <code>xs:anyURI</code> values to be compared without having to\\n             specify the Unicode codepoint collation.</p></div>\\n',summary:\"<p>  Returns true if two strings are equal, considered codepoint-by-codepoint.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"comparand1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"comparand2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"codepoints-to-string\",qname:\"fn:codepoints-to-string\",signature:\"($arg as xs:integer*) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Creates an <code>xs:string</code> from a sequence of <termref def=\"codepoint\">codepoints</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"codepoints-to-string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:integer*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the string made up from the <termref def=\"character\">characters</termref> whose Unicode <termref def=\"codepoint\">codepoints</termref> are\\n             supplied in <code>$arg</code>. This will be the zero-length string if <code>$arg</code>\\n             is the empty sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <errorref class=\"CH\" code=\"0001\"/> if any of the codepoints in\\n                <code>$arg</code> is not a permitted XML character.</p></div>\\n',summary:\"<p>  Creates an  xs:string  from a sequence of  codepoints .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:integer\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"codepoints-to-string\",qname:\"fn:codepoints-to-string\",signature:\"($arg as xs:integer*) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Creates an <code>xs:string</code> from a sequence of <termref def=\"codepoint\">codepoints</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"codepoints-to-string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:integer*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the string made up from the <termref def=\"character\">characters</termref> whose Unicode <termref def=\"codepoint\">codepoints</termref> are\\n             supplied in <code>$arg</code>. This will be the zero-length string if <code>$arg</code>\\n             is the empty sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <errorref class=\"CH\" code=\"0001\"/> if any of the codepoints in\\n                <code>$arg</code> is not a permitted XML character.</p></div>\\n',summary:\"<p>  Creates an  xs:string  from a sequence of  codepoints .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:integer\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"collection\",qname:\"fn:collection\",signature:\"() as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of nodes representing a collection of documents indentified\\n             by a collection URI; or a default collection if no URI is supplied.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"collection\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"collection\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable node collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function takes an <code>xs:string</code> as argument and returns a sequence of\\n             nodes obtained by interpreting <code>$arg</code> as an <code>xs:anyURI</code> and\\n             resolving it according to the mapping specified in <term>Available node collections</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <term>Available node collections</term> provides a mapping from this string to a sequence\\n             of nodes, the function returns that sequence. If <term>Available node collections</term> maps\\n             the string to an empty sequence, then the function returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not specified, the function returns the sequence of the nodes in\\n             the default node collection in the dynamic context. See <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">By default, this function is <termref def=\"deterministic\">deterministic</termref>.\\n             This means that repeated\\n             calls on the function with the same argument will return the same result. However, for\\n             performance reasons, implementations may provide a user option to evaluate the function\\n             without a guarantee of determinism. The manner in which any such option is provided is\\n                <termref def=\"implementation-defined\"/>. If the user has not selected such an option,\\n             a call to this function must either return a deterministic result or must raise a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error\\n                <errorref class=\"DC\" code=\"0003\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">There is no requirement that the returned nodes should be in document\\n             order, nor is there a requirement that the result should contain no duplicates.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied and the\\n             value of the default collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if <term>available\\n                node collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of nodes representing a collection of documents indentified\\n             by a collection URI; or a default collection if no URI is supplied.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"collection\",qname:\"fn:collection\",signature:\"($arg as xs:string?) as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of nodes representing a collection of documents indentified\\n             by a collection URI; or a default collection if no URI is supplied.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"collection\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"collection\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable node collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function takes an <code>xs:string</code> as argument and returns a sequence of\\n             nodes obtained by interpreting <code>$arg</code> as an <code>xs:anyURI</code> and\\n             resolving it according to the mapping specified in <term>Available node collections</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <term>Available node collections</term> provides a mapping from this string to a sequence\\n             of nodes, the function returns that sequence. If <term>Available node collections</term> maps\\n             the string to an empty sequence, then the function returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not specified, the function returns the sequence of the nodes in\\n             the default node collection in the dynamic context. See <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">By default, this function is <termref def=\"deterministic\">deterministic</termref>.\\n             This means that repeated\\n             calls on the function with the same argument will return the same result. However, for\\n             performance reasons, implementations may provide a user option to evaluate the function\\n             without a guarantee of determinism. The manner in which any such option is provided is\\n                <termref def=\"implementation-defined\"/>. If the user has not selected such an option,\\n             a call to this function must either return a deterministic result or must raise a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error\\n                <errorref class=\"DC\" code=\"0003\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">There is no requirement that the returned nodes should be in document\\n             order, nor is there a requirement that the result should contain no duplicates.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied and the\\n             value of the default collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if <term>available\\n                node collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of nodes representing a collection of documents indentified\\n             by a collection URI; or a default collection if no URI is supplied.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"compare\",qname:\"fn:compare\",signature:\"($comparand1 as xs:string?, $comparand2 as xs:string?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns -1, 0, or 1, depending on whether <code>$comparand1</code> collates\\n             before, equal to, or after <code>$comparand2</code> according to the rules of a selected\\n             collation.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"compare\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"comparand1\" type=\"xs:string?\"/><arg name=\"comparand2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"compare\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"comparand1\" type=\"xs:string?\"/><arg name=\"comparand2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns -1, 0, or 1, depending on whether the value of the <code>$comparand1</code> is\\n             respectively less than, equal to, or greater than the value of <code>$comparand2</code>,\\n             according to the rules of the collation that is used. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If either <code>$comparand1</code> or <code>$comparand2</code> is the empty sequence,\\n             the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function, called with the first signature, defines the semantics of the \"eq\", \"ne\",\\n             \"gt\", \"lt\", \"le\" and \"ge\" operators on <code>xs:string</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'abc\\', \\'abc\\')</code> returns <code>0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strasse\\', \\'Straße\\')</code> returns <code>0</code>. <emph>(Assuming the default collation includes provisions that equate\\n                      <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>). Otherwise, the returned value depends on the\\n                   semantics of the default collation.).</emph></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strasse\\', \\'Straße\\',\\n                   \\'http://example.com/deutsch\\')</code> returns <code>0</code>. <emph>(Assuming the collation identified by the URI\\n                      <code>http://example.com/deutsch</code> includes provisions that equate\\n                      <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>). Otherwise, the returned value depends on the\\n                   semantics of that collation.).</emph></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strassen\\', \\'Straße\\')</code> returns <code>1</code>. <emph>(Assuming the default collation includes provisions that treat\\n                   differences between <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>) with less strength than the differences between the\\n                   base characters, such as the final <quote>n</quote>. ).</emph></p></div>\\n',summary:\"<p>  Returns -1, 0, or 1, depending on whether  $comparand1  collates\\n             before, equal to, or after  $comparand2  according to the rules of a selected\\n             collation.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"comparand1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"comparand2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"compare\",qname:\"fn:compare\",signature:\"($comparand1 as xs:string?, $comparand2 as xs:string?, $collation as xs:string) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns -1, 0, or 1, depending on whether <code>$comparand1</code> collates\\n             before, equal to, or after <code>$comparand2</code> according to the rules of a selected\\n             collation.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"compare\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"comparand1\" type=\"xs:string?\"/><arg name=\"comparand2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"compare\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"comparand1\" type=\"xs:string?\"/><arg name=\"comparand2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns -1, 0, or 1, depending on whether the value of the <code>$comparand1</code> is\\n             respectively less than, equal to, or greater than the value of <code>$comparand2</code>,\\n             according to the rules of the collation that is used. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If either <code>$comparand1</code> or <code>$comparand2</code> is the empty sequence,\\n             the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function, called with the first signature, defines the semantics of the \"eq\", \"ne\",\\n             \"gt\", \"lt\", \"le\" and \"ge\" operators on <code>xs:string</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'abc\\', \\'abc\\')</code> returns <code>0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strasse\\', \\'Straße\\')</code> returns <code>0</code>. <emph>(Assuming the default collation includes provisions that equate\\n                      <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>). Otherwise, the returned value depends on the\\n                   semantics of the default collation.).</emph></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strasse\\', \\'Straße\\',\\n                   \\'http://example.com/deutsch\\')</code> returns <code>0</code>. <emph>(Assuming the collation identified by the URI\\n                      <code>http://example.com/deutsch</code> includes provisions that equate\\n                      <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>). Otherwise, the returned value depends on the\\n                   semantics of that collation.).</emph></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:compare(\\'Strassen\\', \\'Straße\\')</code> returns <code>1</code>. <emph>(Assuming the default collation includes provisions that treat\\n                   differences between <quote>ss</quote> and the (German) character <quote>ß</quote>\\n                      (<quote>sharp-s</quote>) with less strength than the differences between the\\n                   base characters, such as the final <quote>n</quote>. ).</emph></p></div>\\n',summary:\"<p>  Returns -1, 0, or 1, depending on whether  $comparand1  collates\\n             before, equal to, or after  $comparand2  according to the rules of a selected\\n             collation.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"comparand1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"comparand2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"concat\",qname:\"fn:concat\",signature:\"($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the concatenation of the string values of the arguments.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n          The two-argument form of this function defines the semantics of the \"||\" operator.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"concat\" return-type=\"xs:string\" isOp=\"yes\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:anyAtomicType?\"/><arg name=\"arg2\" type=\"xs:anyAtomicType?\"/><arg name=\"...\" type=\"xs:anyAtomicType?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function accepts two or more <code>xs:anyAtomicType</code> arguments and casts each\\n             one to <code>xs:string</code>. The function returns the <code>xs:string</code> that is\\n             the concatenation of the values of its arguments after conversion. If any argument is\\n             the empty sequence, that argument is treated as the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E19\">The <code>fn:concat</code> function is specified to allow two or\\n             more arguments, which are concatenated together. This is the only function specified in\\n             this document that allows a variable number of arguments. This capability is retained\\n             for compatibility with <bibref ref=\"xpath\"/>. </p></div>\\n',summary:\"<p>  Returns the concatenation of the string values of the arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"contains\",qname:\"fn:contains\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"contains\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"contains\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> is the zero-length string, the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> contains (at the beginning, at the end, or anywhere within) at\\n             least one sequence of collation units that provides a <term>minimal match</term> to the\\n             collation units in the value of <code>$arg2</code>, according to the collation that is\\n             used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"contains\",qname:\"fn:contains\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"contains\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"contains\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> is the zero-length string, the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> contains (at the beginning, at the end, or anywhere within) at\\n             least one sequence of collation units that provides a <term>minimal match</term> to the\\n             collation units in the value of <code>$arg2</code>, according to the collation that is\\n             used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"count\",qname:\"fn:count\",signature:\"($arg as item()*) as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of items in a sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"count\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the number of items in the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns 0 if <code>$arg</code> is the empty sequence.</p></div>\\n',summary:\"<p>  Returns the number of items in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-date\",qname:\"fn:current-date\",signature:\"() as xs:date external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the current date.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"current-date\" return-type=\"xs:date\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>xs:date(fn:current-dateTime())</code>. This is an <code>xs:date</code>\\n             (with timezone) that is current at some time during the evaluation of a query or\\n             transformation in which <code>fn:current-date</code> is executed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\"/>. The precise instant during the query or\\n             transformation represented by the value of <code>fn:current-date</code> is <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The returned date will always have an associated timezone, which will always be the same\\n             as the implicit timezone in the dynamic context</p></div>\\n',summary:\"<p>  Returns the current date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:date\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-dateTime\",qname:\"fn:current-dateTime\",signature:\"() as xs:dateTimeStamp external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the current date and time (with timezone).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"current-dateTime\" return-type=\"xs:dateTimeStamp\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the current dateTime (with timezone) from the dynamic context. (See <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.) This is an\\n                <code>xs:dateTime</code> that is current at some time during the evaluation of a\\n             query or transformation in which <code>fn:current-dateTime</code> is executed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\"/>. The precise instant during the query or\\n             transformation represented by the value of <code>fn:current-dateTime()</code> is\\n                <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A\">If the implementation supports data types from XSD 1.1 then the\\n             returned value will be an instance of <code>xs:dateTimeStamp</code>. Otherwise, the only\\n             guarantees are that it will be an instance of <code>xs:dateTime</code> and will have a\\n             timezone component.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The returned <code>xs:dateTime</code> will always have an associated timezone, which\\n             will always be the same as the implicit timezone in the dynamic context</p></div>\\n',summary:\"<p>  Returns the current date and time (with timezone).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:dateTimeStamp\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-time\",qname:\"fn:current-time\",signature:\"() as xs:time external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the current time.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"current-time\" return-type=\"xs:time\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>xs:time(fn:current-dateTime())</code>. This is an <code>xs:time</code>\\n             (with timezone) that is current at some time during the evaluation of a query or\\n             transformation in which <code>fn:current-time</code> is executed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\"/>. The precise instant during the query or\\n             transformation represented by the value of <code>fn:current-time()</code> is <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The returned time will always have an associated timezone, which will always be the same\\n             as the implicit timezone in the dynamic context</p></div>\\n',summary:\"<p>  Returns the current time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:time\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"data\",qname:\"fn:data\",signature:\"() as xs:anyAtomicType* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the result of atomizing a sequence, that is, replacing all nodes in the\\n             sequence by their typed values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"data\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"data\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The result of <code>fn:data</code> is the sequence of atomic values produced by\\n             applying the following rules to each item in <code>$arg</code>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the item is an atomic value, it is appended to the result sequence.</p></item><item><p> If the item is a node, the typed value of the node is appended to the result\\n                   sequence. The typed value is a sequence of zero or more atomic values:\\n                   specifically, the result of the <code>dm:typed-value</code> accessor as defined in\\n                      <bibref ref=\"xpath-datamodel-30\"/> (See <xspecref spec=\"DM30\" ref=\"dm-typed-value\"/>).</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0012\" type=\"type\"/> if an item in the\\n             sequence <code>$arg</code> is a node that does not have a typed value. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0013\" type=\"dynamic\"/>\\n             if an item in the sequence <code>$arg</code> is a function item. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised\\n             if <code>$arg</code> is omitted\\n             and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p></div>\\n',summary:\"<p>  Returns the result of atomizing a sequence, that is, replacing all nodes in the\\n             sequence by their typed values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"data\",qname:\"fn:data\",signature:\"($arg as item()*) as xs:anyAtomicType* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the result of atomizing a sequence, that is, replacing all nodes in the\\n             sequence by their typed values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"data\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"data\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The result of <code>fn:data</code> is the sequence of atomic values produced by\\n             applying the following rules to each item in <code>$arg</code>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the item is an atomic value, it is appended to the result sequence.</p></item><item><p> If the item is a node, the typed value of the node is appended to the result\\n                   sequence. The typed value is a sequence of zero or more atomic values:\\n                   specifically, the result of the <code>dm:typed-value</code> accessor as defined in\\n                      <bibref ref=\"xpath-datamodel-30\"/> (See <xspecref spec=\"DM30\" ref=\"dm-typed-value\"/>).</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0012\" type=\"type\"/> if an item in the\\n             sequence <code>$arg</code> is a node that does not have a typed value. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0013\" type=\"dynamic\"/>\\n             if an item in the sequence <code>$arg</code> is a function item. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised\\n             if <code>$arg</code> is omitted\\n             and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p></div>\\n',summary:\"<p>  Returns the result of atomizing a sequence, that is, replacing all nodes in the\\n             sequence by their typed values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"dateTime\",qname:\"fn:dateTime\",signature:\"($arg1 as xs:date?, $arg2 as xs:time?) as xs:dateTime? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns an <code>xs:dateTime</code> value created by combining an\\n                <code>xs:date</code> and an <code>xs:time</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"dateTime\" return-type=\"xs:dateTime?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:date?\"/><arg name=\"arg2\" type=\"xs:time?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If either <code>$arg1</code> or <code>$arg2</code> is the empty sequence the function\\n             returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:dateTime</code> whose date component is\\n             equal to <code>$arg1</code> and whose time component is equal to <code>$arg2</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The timezone of the result is computed as follows:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If neither argument has a timezone, the result has no timezone.</p></item><item><p>If exactly one of the arguments has a timezone, or if both arguments have the same\\n                   timezone, the result has this timezone.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0008\"/> if the two arguments both have\\n             timezones and the timezones are different. </p></div>\\n',summary:\"<p>  Returns an  xs:dateTime  value created by combining an\\n                 xs:date  and an  xs:time .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:date\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dateTime?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"day-from-date\",qname:\"fn:day-from-date\",signature:\"($arg as xs:date?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the day component of an <code>xs:date</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"day-from-date\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> between 1 and 31, both\\n             inclusive, representing the day component in the localized value of\\n             <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:day-from-date(xs:date(\"1999-05-31-05:00\"))</code> returns <code>31</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:day-from-date(xs:date(\"2000-01-01+05:00\"))</code> returns <code>1</code>.</p></div>\\n',summary:\"<p>  Returns the day component of an  xs:date .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"days-from-duration\",qname:\"fn:days-from-duration\",signature:\"($arg as xs:duration?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of days in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"days-from-duration\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the days\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:dayTimeDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the days component as described in\\n                <specref ref=\"canonical-dayTimeDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:days-from-duration(xs:dayTimeDuration(\"P3DT10H\"))</code> returns <code>3</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:days-from-duration(xs:dayTimeDuration(\"P3DT55H\"))</code> returns <code>5</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:days-from-duration(xs:yearMonthDuration(\"P3Y5M\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the number of days in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"deep-equal\",qname:\"fn:deep-equal\",signature:\"($parameter1 as item()*, $parameter2 as item()*) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> This function assesses whether two sequences are deep-equal to each other. To\\n             be deep-equal, they must contain items that are pairwise deep-equal; and for two items\\n             to be deep-equal, they must either be atomic values that compare equal, or nodes of the\\n             same kind, with the same name, whose children are deep-equal.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"deep-equal\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"parameter1\" type=\"item()*\"/><arg name=\"parameter2\" type=\"item()*\"/></proto></example><example role=\"signature\"><proto name=\"deep-equal\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"parameter1\" type=\"item()*\"/><arg name=\"parameter2\" type=\"item()*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$collation</code> argument identifies a collation which is used at all levels\\n             of recursion when strings are compared (but not when names are compared), according to\\n             the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are both empty, the function returns <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are of different lengths, the function returns\\n             <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are of the same length, the function returns <code>true</code> if\\n             and only if every item in the sequence <code>$parameter1</code> is deep-equal to the\\n             item at the same position in the sequence <code>$parameter2</code>. The rules for\\n             deciding whether two items are deep-equal follow.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Call the two items <code>$i1</code> and <code>$i2</code> respectively.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$i1</code> and <code>$i2</code> are both atomic values, they are deep-equal if\\n             and only if <code>($i1 eq $i2)</code> is <code>true</code>, or if both values are\\n                <code>NaN</code>. If the <code>eq</code> operator is not defined for <code>$i1</code>\\n             and <code>$i2</code>, the function returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If one of the pair <code>$i1</code> or <code>$i2</code> is an atomic value and the\\n             other is not,\\n             <!--<phrase diff=\"add\" at=\"MAP\">or if one is a node and the other is not, </phrase>-->\\n             the function returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$i1</code> and <code>$i2</code> are both nodes, they are compared as described\\n             below:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the two nodes are of different kinds, the result is <code>false</code>.</p></item><item><p>If the two nodes are both document nodes then they are deep-equal if and only if\\n                   the sequence <code>$i1/(*|text())</code> is deep-equal to the sequence\\n                      <code>$i2/(*|text())</code>.</p></item><item><p> If the two nodes are both element nodes then they are deep-equal if and only if\\n                   all of the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><!-- bug 17252 --><p diff=\"chg\" at=\"L\">Either both nodes are both annotated as having simple content or both nodes are\\n                         annotated as having complex content. For this purpose \"simple content\" means either a simple\\n                      type or a complex type with simple content; \"complex content\" means a complex type whose variety\\n                      is mixed, element-only, or empty.</p><note diff=\"add\" at=\"L\"><p>It is a consequence of this rule that validating a document\\n                      <var>D</var> against a schema will usually (but not necessarily) result in a document that is not deep-equal\\n                         to <var>D</var>. The exception is when the schema allows all elements to have mixed content.</p></note></item><item><p>The two nodes have the same number of attributes, and for every attribute\\n                            <code>$a1</code> in <code>$i1/@*</code> there exists an attribute\\n                            <code>$a2</code> in <code>$i2/@*</code> such that <code>$a1</code> and\\n                            <code>$a2</code> are deep-equal.</p></item><item><p> One of the following conditions holds:</p><ulist><item><p>Both element nodes are annotated as having simple content\\n                               <phrase diff=\"add\" at=\"L\">(as defined in 3(b) above)</phrase>, and\\n                               the typed value of <code>$i1</code> is deep-equal to the typed value\\n                               of <code>$i2</code>.</p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety element-only, and the sequence <code>$i1/*</code> is\\n                               deep-equal to the sequence <code>$i2/*</code>.</phrase></p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety mixed</phrase>, and the sequence <code>$i1/(*|text())</code> is\\n                               deep-equal to the sequence <code>$i2/(*|text())</code>.</p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety empty</phrase>.</p></item></ulist></item></olist></item><item><p>If the two nodes are both attribute nodes then they are deep-equal if and only if\\n                   both the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><p>The typed value of <code>$i1</code> is deep-equal to the typed value of\\n                            <code>$i2</code>.</p></item></olist></item><item><p> If the two nodes are both processing instruction nodes<phrase diff=\"del\" at=\"A-E42\"> or namespace bindings</phrase>, then they are deep-equal if and\\n                   only if both the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><p>The string value of <code>$i1</code> is equal to the string value of\\n                            <code>$i2</code>.</p></item></olist></item><item><p diff=\"add\" at=\"A-E42\"> If the two nodes are both namespace nodes, then they are deep-equal if and only\\n                   if both the following conditions are satisfied:</p><olist><item><p diff=\"add\" at=\"A-E42\">The two nodes either have the same name or are both nameless, that is\\n                            <code>fn:deep-equal(node-name($i1), node-name($i2))</code>.</p></item><item><p diff=\"add\" at=\"A-E42\">The string value of <code>$i1</code> is equal to the string value of\\n                            <code>$i2</code> when compared using the Unicode codepoint collation.</p></item></olist></item><item><p>If the two nodes are both text nodes or comment nodes, then they are deep-equal if\\n                   and only if their string-values are equal.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0015\" type=\"type\"/>\\n             if either input sequence contains a function item.\\n             <!--<phrase diff=\"add\" at=\"MAP\">that is not a map</phrase>,-->\\n          </p></div>\\n',summary:\"<p>   This function assesses whether two sequences are deep-equal to each other.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"parameter1\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"parameter2\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"deep-equal\",qname:\"fn:deep-equal\",signature:\"($parameter1 as item()*, $parameter2 as item()*, $collation as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> This function assesses whether two sequences are deep-equal to each other. To\\n             be deep-equal, they must contain items that are pairwise deep-equal; and for two items\\n             to be deep-equal, they must either be atomic values that compare equal, or nodes of the\\n             same kind, with the same name, whose children are deep-equal.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"deep-equal\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"parameter1\" type=\"item()*\"/><arg name=\"parameter2\" type=\"item()*\"/></proto></example><example role=\"signature\"><proto name=\"deep-equal\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"parameter1\" type=\"item()*\"/><arg name=\"parameter2\" type=\"item()*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$collation</code> argument identifies a collation which is used at all levels\\n             of recursion when strings are compared (but not when names are compared), according to\\n             the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are both empty, the function returns <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are of different lengths, the function returns\\n             <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the two sequences are of the same length, the function returns <code>true</code> if\\n             and only if every item in the sequence <code>$parameter1</code> is deep-equal to the\\n             item at the same position in the sequence <code>$parameter2</code>. The rules for\\n             deciding whether two items are deep-equal follow.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Call the two items <code>$i1</code> and <code>$i2</code> respectively.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$i1</code> and <code>$i2</code> are both atomic values, they are deep-equal if\\n             and only if <code>($i1 eq $i2)</code> is <code>true</code>, or if both values are\\n                <code>NaN</code>. If the <code>eq</code> operator is not defined for <code>$i1</code>\\n             and <code>$i2</code>, the function returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If one of the pair <code>$i1</code> or <code>$i2</code> is an atomic value and the\\n             other is not,\\n             <!--<phrase diff=\"add\" at=\"MAP\">or if one is a node and the other is not, </phrase>-->\\n             the function returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$i1</code> and <code>$i2</code> are both nodes, they are compared as described\\n             below:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the two nodes are of different kinds, the result is <code>false</code>.</p></item><item><p>If the two nodes are both document nodes then they are deep-equal if and only if\\n                   the sequence <code>$i1/(*|text())</code> is deep-equal to the sequence\\n                      <code>$i2/(*|text())</code>.</p></item><item><p> If the two nodes are both element nodes then they are deep-equal if and only if\\n                   all of the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><!-- bug 17252 --><p diff=\"chg\" at=\"L\">Either both nodes are both annotated as having simple content or both nodes are\\n                         annotated as having complex content. For this purpose \"simple content\" means either a simple\\n                      type or a complex type with simple content; \"complex content\" means a complex type whose variety\\n                      is mixed, element-only, or empty.</p><note diff=\"add\" at=\"L\"><p>It is a consequence of this rule that validating a document\\n                      <var>D</var> against a schema will usually (but not necessarily) result in a document that is not deep-equal\\n                         to <var>D</var>. The exception is when the schema allows all elements to have mixed content.</p></note></item><item><p>The two nodes have the same number of attributes, and for every attribute\\n                            <code>$a1</code> in <code>$i1/@*</code> there exists an attribute\\n                            <code>$a2</code> in <code>$i2/@*</code> such that <code>$a1</code> and\\n                            <code>$a2</code> are deep-equal.</p></item><item><p> One of the following conditions holds:</p><ulist><item><p>Both element nodes are annotated as having simple content\\n                               <phrase diff=\"add\" at=\"L\">(as defined in 3(b) above)</phrase>, and\\n                               the typed value of <code>$i1</code> is deep-equal to the typed value\\n                               of <code>$i2</code>.</p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety element-only, and the sequence <code>$i1/*</code> is\\n                               deep-equal to the sequence <code>$i2/*</code>.</phrase></p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety mixed</phrase>, and the sequence <code>$i1/(*|text())</code> is\\n                               deep-equal to the sequence <code>$i2/(*|text())</code>.</p></item><item><p>Both element nodes have a type annotation that is <phrase diff=\"chg\" at=\"L\">a complex type with\\n                               variety empty</phrase>.</p></item></ulist></item></olist></item><item><p>If the two nodes are both attribute nodes then they are deep-equal if and only if\\n                   both the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><p>The typed value of <code>$i1</code> is deep-equal to the typed value of\\n                            <code>$i2</code>.</p></item></olist></item><item><p> If the two nodes are both processing instruction nodes<phrase diff=\"del\" at=\"A-E42\"> or namespace bindings</phrase>, then they are deep-equal if and\\n                   only if both the following conditions are satisfied:</p><olist><item><p>The two nodes have the same name, that is <code>(node-name($i1) eq\\n                            node-name($i2))</code>.</p></item><item><p>The string value of <code>$i1</code> is equal to the string value of\\n                            <code>$i2</code>.</p></item></olist></item><item><p diff=\"add\" at=\"A-E42\"> If the two nodes are both namespace nodes, then they are deep-equal if and only\\n                   if both the following conditions are satisfied:</p><olist><item><p diff=\"add\" at=\"A-E42\">The two nodes either have the same name or are both nameless, that is\\n                            <code>fn:deep-equal(node-name($i1), node-name($i2))</code>.</p></item><item><p diff=\"add\" at=\"A-E42\">The string value of <code>$i1</code> is equal to the string value of\\n                            <code>$i2</code> when compared using the Unicode codepoint collation.</p></item></olist></item><item><p>If the two nodes are both text nodes or comment nodes, then they are deep-equal if\\n                   and only if their string-values are equal.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0015\" type=\"type\"/>\\n             if either input sequence contains a function item.\\n             <!--<phrase diff=\"add\" at=\"MAP\">that is not a map</phrase>,-->\\n          </p></div>\\n',summary:\"<p>   This function assesses whether two sequences are deep-equal to each other.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"parameter1\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"parameter2\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"default-collation\",qname:\"fn:default-collation\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of the default collation property from the static context.\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"default-collation\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of the default collation property from the static context. Components\\n             of the static context are discussed in <xspecref spec=\"XP30\" ref=\"id-xp-static-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The default collation property can never be absent. If it is not explicitly defined, a\\n             system defined default can be invoked. If this is not provided, the Unicode codepoint\\n             collation (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>) is\\n             used. </p></div>\\n',summary:\"<p>  Returns the value of the default collation property from the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-values\",qname:\"fn:distinct-values\",signature:\"($arg as xs:anyAtomicType*) as xs:anyAtomicType* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the values that appear in a sequence, with duplicates eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"distinct-values\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"distinct-values\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the sequence that results from removing from <code>$arg</code> all\\n             but one of a set of values that are equal to one another. Values are compared using the\\n                <code>eq</code> operator, subject to the caveats defined below.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Values of type <code>xs:untypedAtomic</code> are compared as if they were of type\\n                <code>xs:string</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Values that cannot be compared, because the <code>eq</code> operator is not defined for\\n             their types, are considered to be distinct.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. This collation is used when string comparison is\\n             required.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For <code>xs:float</code> and <code>xs:double</code> values, positive zero is equal to\\n             negative zero and, although <code>NaN</code> does not equal itself, if <code>$arg</code>\\n             contains multiple <code>NaN</code> values a single <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>xs:dateTime</code>, <code>xs:date</code> or <code>xs:time</code> values do not\\n             have a timezone, they are considered to have the implicit timezone provided by the\\n             dynamic context for the purpose of comparison. Note that <code>xs:dateTime</code>,\\n                <code>xs:date</code> or <code>xs:time</code> values can compare equal even if their\\n             timezones are different.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The order in which the sequence of values is returned is <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Which value of a set of values that compare equal is returned is <termref def=\"implementation-dependent\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">The static type of the result is a sequence of prime types as defined\\n             in [Formal Semantics].</p><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E44\">\\n             <p>If the input sequence contains values of different numeric types that differ from\\n                each other by small amounts, then the eq operator is not transitive, because of\\n                rounding effects occurring during type promotion. In the situation where the input\\n                contains three values <code>A</code>, <code>B</code>, and <code>C</code> such that\\n                   <code>A eq B</code>, <code>B eq C</code>, but <code>A ne C</code>, then the number\\n                of items in the result of the function (as well as the choice of which items are\\n                returned) is <termref def=\"implementation-dependent\"/>, subject only to the\\n                constraints that (a) no two items in the result sequence compare equal to each other,\\n                and (b) every input item that does not appear in the result sequence compares equal\\n                to some item that does appear in the result sequence.</p>\\n             <p>For example, this arises when computing:</p>\\n             <eg xml:space=\"preserve\">    distinct-values(\\n             (xs:float(\\'1.0\\'),\\n             xs:decimal(\\'1.0000000000100000000001\\',\\n             xs:double( \\'1.00000000001\\'))</eg>\\n             <p>because the values of type <code>xs:float</code> and <code>xs:double</code> both\\n                compare equal to the value of type <code>xs:decimal</code> but not equal to each\\n                other. </p>\\n          </change><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p></div>\\n',summary:\"<p>  Returns the values that appear in a sequence, with duplicates eliminated.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"distinct-values\",qname:\"fn:distinct-values\",signature:\"($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the values that appear in a sequence, with duplicates eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"distinct-values\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"distinct-values\" return-type=\"xs:anyAtomicType*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the sequence that results from removing from <code>$arg</code> all\\n             but one of a set of values that are equal to one another. Values are compared using the\\n                <code>eq</code> operator, subject to the caveats defined below.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Values of type <code>xs:untypedAtomic</code> are compared as if they were of type\\n                <code>xs:string</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Values that cannot be compared, because the <code>eq</code> operator is not defined for\\n             their types, are considered to be distinct.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. This collation is used when string comparison is\\n             required.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For <code>xs:float</code> and <code>xs:double</code> values, positive zero is equal to\\n             negative zero and, although <code>NaN</code> does not equal itself, if <code>$arg</code>\\n             contains multiple <code>NaN</code> values a single <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>xs:dateTime</code>, <code>xs:date</code> or <code>xs:time</code> values do not\\n             have a timezone, they are considered to have the implicit timezone provided by the\\n             dynamic context for the purpose of comparison. Note that <code>xs:dateTime</code>,\\n                <code>xs:date</code> or <code>xs:time</code> values can compare equal even if their\\n             timezones are different.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The order in which the sequence of values is returned is <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Which value of a set of values that compare equal is returned is <termref def=\"implementation-dependent\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">The static type of the result is a sequence of prime types as defined\\n             in [Formal Semantics].</p><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E44\">\\n             <p>If the input sequence contains values of different numeric types that differ from\\n                each other by small amounts, then the eq operator is not transitive, because of\\n                rounding effects occurring during type promotion. In the situation where the input\\n                contains three values <code>A</code>, <code>B</code>, and <code>C</code> such that\\n                   <code>A eq B</code>, <code>B eq C</code>, but <code>A ne C</code>, then the number\\n                of items in the result of the function (as well as the choice of which items are\\n                returned) is <termref def=\"implementation-dependent\"/>, subject only to the\\n                constraints that (a) no two items in the result sequence compare equal to each other,\\n                and (b) every input item that does not appear in the result sequence compares equal\\n                to some item that does appear in the result sequence.</p>\\n             <p>For example, this arises when computing:</p>\\n             <eg xml:space=\"preserve\">    distinct-values(\\n             (xs:float(\\'1.0\\'),\\n             xs:decimal(\\'1.0000000000100000000001\\',\\n             xs:double( \\'1.00000000001\\'))</eg>\\n             <p>because the values of type <code>xs:float</code> and <code>xs:double</code> both\\n                compare equal to the value of type <code>xs:decimal</code> but not equal to each\\n                other. </p>\\n          </change><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p></div>\\n',summary:\"<p>  Returns the values that appear in a sequence, with duplicates eliminated.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"doc-available\",qname:\"fn:doc-available\",signature:\"($uri as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">The function returns true if and only if the function\\n             call <code>fn:doc($uri)</code> would return a document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"doc-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"uri\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable documents, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">If <code>$uri</code> is an empty sequence, this function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">If a call on <code>fn:doc($uri)</code> would return a document\\n             node, this function returns <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0005\"/> if\\n                <code>$uri</code> is not a valid URI according to the rules applied by the\\n             implementation of <code>fn:doc</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">Otherwise, this function returns <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If this function returns <code>true</code>, then calling <code>fn:doc($uri)</code>\\n             within the same <termref def=\"execution-scope\"/> must return a document node. However,\\n             if nondeterministic processing has been selected for the <code>fn:doc</code> function,\\n             this guarantee is lost.</p></div>\\n',summary:\"<p>  The function returns true if and only if the function\\n             call  fn:doc($uri)  would return a document node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"doc\",qname:\"fn:doc\",signature:\"($uri as xs:string?) as document()? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E26\">Retrieves a document using a URI supplied as an\\n                <code>xs:string</code>, and returns the corresponding document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"doc\" return-type=\"document-node()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"uri\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable documents, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$uri</code> is the empty sequence, the result is an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E26\">If <code>$uri</code> is a relative URI reference, it is resolved\\n             relative to the value of the <phrase diff=\"chg\" at=\"L\">Static Base URI property from the static context</phrase>. The resulting\\n             absolute URI is promoted to an <code>xs:string</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E26\">If the <term>Available documents</term> described in <xspecref spec=\"XP30\" ref=\"eval_context\"/> provides a mapping from this string to a document\\n             node, the function returns that document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E26\">The URI may include a fragment identifier.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">By default, this function is <termref def=\"deterministic\">deterministic</termref>. Two calls on this function\\n             return the same document node if the same URI Reference (after resolution to an absolute\\n             URI Reference) is supplied to both calls. Thus, the following expression (if it does not\\n             raise an error) will always be true:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">doc(\"foo.xml\") is doc(\"foo.xml\")</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">However, for performance reasons, implementations may provide a user option to evaluate\\n             the function without a guarantee of determinism. The manner in which any such option is\\n             provided is implementation-defined. If the user has not selected such an option, a call\\n             of the function must either return a deterministic result or must raise a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error\\n                <errorref class=\"DC\" code=\"0003\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p>If <code>$uri</code> is read from a source document, it is generally appropriate to\\n                resolve it relative to the base URI property of the relevant node in the source\\n                document. This can be achieved by calling the <code>fn:resolve-uri</code> function,\\n                and passing the resulting absolute URI as an argument to the <code>fn:doc</code>\\n                function.</p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If two calls to this function supply different absolute URI References as arguments, the\\n             same document node may be returned if the implementation can determine that the two\\n             arguments refer to the same resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> By defining the semantics of this function in terms of a string-to-document-node\\n             mapping in the dynamic context, the specification is acknowledging that the results of\\n             this function are outside the purview of the language specification itself, and depend\\n             entirely on the run-time environment in which the expression is evaluated. This run-time\\n             environment includes not only an unpredictable collection of resources (\"the web\"), but\\n             configurable machinery for locating resources and turning their contents into document\\n             nodes within the XPath data model. Both the set of resources that are reachable, and the\\n             mechanisms by which those resources are parsed and validated, are <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> One possible processing model for this function is as follows. The resource identified\\n             by the URI Reference is retrieved. If the resource cannot be retrieved, a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is\\n             raised <errorref class=\"DC\" code=\"0002\"/>. The data resulting from the retrieval action\\n             is then parsed as an XML document and a tree is constructed in accordance with the\\n                <bibref ref=\"xpath-datamodel-30\"/>. If the top-level media type is known and is\\n             \"text\", the content is parsed in the same way as if the media type were text/xml;\\n             otherwise, it is parsed in the same way as if the media type were application/xml. If\\n             the contents cannot be parsed successfully, a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/>. Otherwise, the result of the function is the document node at the root\\n             of the resulting tree. This tree is then optionally validated against a schema.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Various aspects of this processing are <termref def=\"implementation-defined\"/>.\\n             Implementations may provide external configuration options that allow any aspect of the\\n             processing to be controlled by the user. In particular:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>The set of URI schemes that the implementation recognizes is\\n                   implementation-defined. Implementations may allow the mapping of URIs to resources\\n                   to be configured by the user, using mechanisms such as catalogs or user-written\\n                   URI handlers.</p></item><item><p>The handling of non-XML media types is implementation-defined. Implementations may\\n                   allow instances of the data model to be constructed from non-XML resources, under\\n                   user control.</p></item><item><p>It is <termref def=\"implementation-defined\"/> whether DTD validation and/or schema\\n                   validation is applied to the source document.</p></item><item><p>Implementations may provide user-defined error handling options that allow\\n                   processing to continue following an error in retrieving a resource, or in parsing\\n                   and validating its content. When errors have been handled in this way, the\\n                   function may return either an empty sequence, or a fallback document provided by\\n                   the error handler.</p></item><item><p>Implementations may provide user options that relax the requirement for the\\n                   function to return deterministic results.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E26\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"DC\" code=\"0005\"/> if <code>$uri</code> is not a valid URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if the\\n                <term>available documents</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if the resource cannot be\\n             retrieved or cannot be parsed successfully as XML.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0003\"/> if the implementation is not able\\n             to guarantee that the result of the function will be deterministic, and the user has not\\n             indicated that an unstable result is acceptable.</p></div>\\n',summary:\"<p>  Retrieves a document using a URI supplied as an\\n                 xs:string , and returns the corresponding document node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"document()?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"document-uri\",qname:\"fn:document-uri\",signature:\"() as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the URI of a resource where a document can be found, if available.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"document-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"document-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not a document node, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of the <code>document-uri</code> accessor\\n             applied to <code>$arg</code>, as defined in <bibref ref=\"xpath-datamodel-30\"/> (See\\n                <xspecref spec=\"DM30\" ref=\"DocumentNodeAccessors\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the URI of a resource where a document can be found, if available.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"document-uri\",qname:\"fn:document-uri\",signature:\"($arg as node()?) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the URI of a resource where a document can be found, if available.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"document-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"document-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not a document node, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of the <code>document-uri</code> accessor\\n             applied to <code>$arg</code>, as defined in <bibref ref=\"xpath-datamodel-30\"/> (See\\n                <xspecref spec=\"DM30\" ref=\"DocumentNodeAccessors\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the URI of a resource where a document can be found, if available.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"element-with-id\",qname:\"fn:element-with-id\",signature:\"($arg as xs:string*) as element(*)* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\"> Returns the sequence of element nodes that have an\\n                <code>ID</code> value matching the value of one or more of the <code>IDREF</code>\\n             values supplied in <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"element-with-id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"element-with-id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\">\\n             <note><p>The effect of this function is identical to <function>fn:id</function> in respect\\n                   of elements that have an attribute with the <code>is-id</code> property. However,\\n                   it behaves differently in respect of element nodes with the <code>is-id</code>\\n                   property. Whereas the <code>fn:id</code>, for legacy reasons, returns the element\\n                   that has the <code>is-id</code> property, this parent returns the element\\n                   identified by the ID, which is the parent of the element having the\\n                      <code>is-id</code> property.</p></note>\\n             <p>The function returns a sequence, in document order with duplicates eliminated,\\n                containing every element node <code>E</code> that satisfies all the following\\n                conditions:</p>\\n             <olist><item><p>\\n                      <code>E</code> is in the target document. The target document is the document\\n                      containing <code>$node</code>, or the document containing the context item\\n                         (<code>.</code>) if the second argument is omitted. The behavior of the\\n                      function if <code>$node</code> is omitted is exactly the same as if the context\\n                      item had been passed as <code>$node</code>.</p></item><item><p><code>E</code> has an <code>ID</code> value equal to one of the candidate\\n                         <code>IDREF</code> values, where:</p><ulist><item><p> An element has an <code>ID</code> value equal to <code>V</code> if\\n                            either or both of the following conditions are true:</p><ulist><item><p>The element has an child element node whose <code>is-id</code>\\n                                  property (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and\\n                                  whose typed value is equal to <code>V</code> under the rules of the\\n                                     <code>eq</code> operator using the Unicode code point collation\\n                                     (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item><item><p>The element has an attribute node whose <code>is-id</code> property\\n                                  (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and whose\\n                                  typed value is equal to <code>V</code> under the rules of the\\n                                     <code>eq</code> operator using the Unicode code point collation\\n                                     (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were\\n                            of type <code>IDREFS</code>, that is, each <code>xs:string</code> in\\n                               <code>$arg</code> is treated as a whitespace-separated sequence of\\n                            tokens, each acting as an <code>IDREF</code>. These tokens are then\\n                            included in the list of candidate <code>IDREF</code>s. If any of the\\n                            tokens is not a lexically valid <code>IDREF</code> (that is, if it is not\\n                            lexically an <code>xs:NCName</code>), it is ignored. Formally, the\\n                            candidate <code>IDREF</code> values are the strings in the sequence given\\n                            by the expression:</p><eg xml:space=\"preserve\">for $s in $arg return\\n    fn:tokenize(fn:normalize-space($s), \\' \\')[. castable as xs:IDREF]</eg></item></ulist></item><item><p> If several elements have the same <code>ID</code> value, then <code>E</code>\\n                      is the one that is first in document order.</p></item></olist>\\n          </change><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\">\\n             <p>A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                   <code>$node</code>, or the context item if the second argument is omitted, is a\\n                   node in a tree whose root is not a document node.</p>\\n             <p>The following errors may be raised when <code>$node</code> is omitted:</p>\\n             <ul><li><p>If the context\\n                   item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                   <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                   node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul>\\n          </change></div>\\n',summary:\"<p>   Returns the sequence of element nodes that have an\\n                 ID  value matching the value of one or more of the  IDREF \\n             values supplied in  $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"element-with-id\",qname:\"fn:element-with-id\",signature:\"($arg as xs:string*, $node as node()) as element(*)* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\"> Returns the sequence of element nodes that have an\\n                <code>ID</code> value matching the value of one or more of the <code>IDREF</code>\\n             values supplied in <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"element-with-id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"element-with-id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\">\\n             <note><p>The effect of this function is identical to <function>fn:id</function> in respect\\n                   of elements that have an attribute with the <code>is-id</code> property. However,\\n                   it behaves differently in respect of element nodes with the <code>is-id</code>\\n                   property. Whereas the <code>fn:id</code>, for legacy reasons, returns the element\\n                   that has the <code>is-id</code> property, this parent returns the element\\n                   identified by the ID, which is the parent of the element having the\\n                      <code>is-id</code> property.</p></note>\\n             <p>The function returns a sequence, in document order with duplicates eliminated,\\n                containing every element node <code>E</code> that satisfies all the following\\n                conditions:</p>\\n             <olist><item><p>\\n                      <code>E</code> is in the target document. The target document is the document\\n                      containing <code>$node</code>, or the document containing the context item\\n                         (<code>.</code>) if the second argument is omitted. The behavior of the\\n                      function if <code>$node</code> is omitted is exactly the same as if the context\\n                      item had been passed as <code>$node</code>.</p></item><item><p><code>E</code> has an <code>ID</code> value equal to one of the candidate\\n                         <code>IDREF</code> values, where:</p><ulist><item><p> An element has an <code>ID</code> value equal to <code>V</code> if\\n                            either or both of the following conditions are true:</p><ulist><item><p>The element has an child element node whose <code>is-id</code>\\n                                  property (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and\\n                                  whose typed value is equal to <code>V</code> under the rules of the\\n                                     <code>eq</code> operator using the Unicode code point collation\\n                                     (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item><item><p>The element has an attribute node whose <code>is-id</code> property\\n                                  (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and whose\\n                                  typed value is equal to <code>V</code> under the rules of the\\n                                     <code>eq</code> operator using the Unicode code point collation\\n                                     (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were\\n                            of type <code>IDREFS</code>, that is, each <code>xs:string</code> in\\n                               <code>$arg</code> is treated as a whitespace-separated sequence of\\n                            tokens, each acting as an <code>IDREF</code>. These tokens are then\\n                            included in the list of candidate <code>IDREF</code>s. If any of the\\n                            tokens is not a lexically valid <code>IDREF</code> (that is, if it is not\\n                            lexically an <code>xs:NCName</code>), it is ignored. Formally, the\\n                            candidate <code>IDREF</code> values are the strings in the sequence given\\n                            by the expression:</p><eg xml:space=\"preserve\">for $s in $arg return\\n    fn:tokenize(fn:normalize-space($s), \\' \\')[. castable as xs:IDREF]</eg></item></ulist></item><item><p> If several elements have the same <code>ID</code> value, then <code>E</code>\\n                      is the one that is first in document order.</p></item></olist>\\n          </change><change xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"A-E31\">\\n             <p>A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                   <code>$node</code>, or the context item if the second argument is omitted, is a\\n                   node in a tree whose root is not a document node.</p>\\n             <p>The following errors may be raised when <code>$node</code> is omitted:</p>\\n             <ul><li><p>If the context\\n                   item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                   <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                   node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul>\\n          </change></div>\\n',summary:\"<p>   Returns the sequence of element nodes that have an\\n                 ID  value matching the value of one or more of the  IDREF \\n             values supplied in  $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"node\",type:\"node()\",occurrence:null,description:\"\"}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"empty\",qname:\"fn:empty\",signature:\"($arg as item()*) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the argument is the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"empty\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns\\n                <code>true</code>; otherwise, the function returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:empty((1,2,3)[10])</code> returns <code>true()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:empty(fn:remove((\"hello\", \"world\"), 1))</code> returns <code>false()</code>.</p></div>\\n',summary:\"<p>  Returns true if the argument is the empty sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"encode-for-uri\",qname:\"fn:encode-for-uri\",signature:\"($uri-part as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Encodes reserved characters in a string that is intended to be used in the path\\n             segment of a URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"encode-for-uri\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"uri-part\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$uri-part</code> is the empty sequence, the function returns the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function applies the URI escaping rules defined in section 2 of <bibref ref=\"rfc3986\"/> to the <code>xs:string</code> supplied as <code>$uri-part</code>. The\\n             effect of the function is to escape reserved characters. Each such character in the\\n             string is replaced with its percent-encoded form as described in <bibref ref=\"rfc3986\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Since <bibref ref=\"rfc3986\"/> recommends that, for consistency, URI producers and\\n             normalizers should use uppercase hexadecimal digits for all percent-encodings, this\\n             function must always generate hexadecimal values using the upper-case letters A-F.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All characters are escaped except those identified as \"unreserved\" by <bibref ref=\"rfc3986\"/>, that is the upper- and lower-case letters A-Z, the digits 0-9,\\n             HYPHEN-MINUS (\"-\"), LOW LINE (\"_\"), FULL STOP \".\", and TILDE \"~\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function escapes URI delimiters and therefore cannot be used indiscriminately to\\n             encode \"invalid\" characters in a path segment.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is invertible but not idempotent. This is because a string containing a\\n             percent character will be modified by applying the function: for example\\n                <code>100%</code> becomes <code>100%25</code>, while <code>100%25</code> becomes\\n                <code>100%2525</code>.</p></div>\\n',summary:\"<p>  Encodes reserved characters in a string that is intended to be used in the path\\n             segment of a URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri-part\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"ends-with\",qname:\"fn:ends-with\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             trailing substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"ends-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"ends-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>. If the value of <code>$arg1</code> is the zero-length string and\\n             the value of <code>$arg2</code> is not the zero-length string, then the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> starts with a sequence of collation units that provides a\\n                <term>match</term> to the collation units of <code>$arg2</code> according to the\\n             collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p>\\n                <term>Match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             trailing substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"ends-with\",qname:\"fn:ends-with\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             trailing substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"ends-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"ends-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>. If the value of <code>$arg1</code> is the zero-length string and\\n             the value of <code>$arg2</code> is not the zero-length string, then the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> starts with a sequence of collation units that provides a\\n                <term>match</term> to the collation units of <code>$arg2</code> according to the\\n             collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p>\\n                <term>Match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             trailing substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"environment-variable\",qname:\"fn:environment-variable\",signature:\"($arg as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of a system environment variable, if it exists.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"environment-variable\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"name\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tenvironment variables.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The set of available <xtermref spec=\"XP30\" ref=\"dt-environment-variables\">environment variables</xtermref>\\n             is a set of (name, value) pairs forming part\\n             of the dynamic context, in which the name is unique within the set of pairs. The name\\n             and value are arbitrary strings.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the <code>$name</code> argument matches the name of one of these pairs, the function\\n             returns the corresponding value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If there is no environment variable with a matching name, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used for matching names is <termref def=\"implementation-defined\"/>, but\\n             must be the same as the collation used to ensure that the names of all environment\\n             variables are unique.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The function is <termref def=\"dt-deterministic\">deterministic</termref>,\\n             which means that if it is called several times\\n          within the same <termref def=\"dt-execution-scope\">execution scope</termref>, with the same arguments,\\n             it must return the same result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">On many platforms, the term \"environment variable\" has a natural meaning in terms of\\n             facilities provided by the operating system. This interpretation of the concept does not\\n             exclude other interpretations, such as a mapping to a set of configuration parameters in\\n             a database system.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Environment variable names are usually case sensitive. Names are usually of the form\\n                <code>(letter|_) (letter|_|digit)*</code>, but this varies by platform.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">On some platforms, there may sometimes be multiple environment variables with the same name;\\n             in this case, it is implementation-dependent as to which is returned; see for example\\n                <bibref ref=\"POSIX.1-2008\"/> (Chapter 8, Environment Variables).\\n             Implementations <rfc2119>may</rfc2119> use prefixes or other naming conventions\\n             to disambiguate the names.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The requirement to ensure that the function is deterministic means in practice that\\n          the implementation must make a snapshot of the environment variables at some time\\n          during execution, and return values obtained from this snapshot, rather than using\\n          live values that are subject to change at any time.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Operating system environment variables may be associated with a particular process,\\n          while queries and stylesheets may execute across multiple processes (or multiple machines).\\n          In such circumstances implementations <rfc2119>may</rfc2119> choose to provide access\\n          to the environment variables associated with the process in which the query or stylesheet\\n          processing was initiated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Security advice: Queries from untrusted sources should not be permitted unrestricted\\n             access to environment variables. For example, the name of the account under which the\\n             query is running may be useful information to a would-be intruder. An implementation may\\n             therefore choose to restrict access to the environment, or may provide a facility to\\n             make <code>fn:environment-variable</code> always return the empty sequence.</p></div>\\n',summary:\"<p>  Returns the value of a system environment variable, if it exists.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"environment-variable\",qname:\"fn:environment-variable\",signature:\"($name as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of a system environment variable, if it exists.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"environment-variable\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"name\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tenvironment variables.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The set of available <xtermref spec=\"XP30\" ref=\"dt-environment-variables\">environment variables</xtermref>\\n             is a set of (name, value) pairs forming part\\n             of the dynamic context, in which the name is unique within the set of pairs. The name\\n             and value are arbitrary strings.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the <code>$name</code> argument matches the name of one of these pairs, the function\\n             returns the corresponding value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If there is no environment variable with a matching name, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used for matching names is <termref def=\"implementation-defined\"/>, but\\n             must be the same as the collation used to ensure that the names of all environment\\n             variables are unique.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The function is <termref def=\"dt-deterministic\">deterministic</termref>,\\n             which means that if it is called several times\\n          within the same <termref def=\"dt-execution-scope\">execution scope</termref>, with the same arguments,\\n             it must return the same result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">On many platforms, the term \"environment variable\" has a natural meaning in terms of\\n             facilities provided by the operating system. This interpretation of the concept does not\\n             exclude other interpretations, such as a mapping to a set of configuration parameters in\\n             a database system.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Environment variable names are usually case sensitive. Names are usually of the form\\n                <code>(letter|_) (letter|_|digit)*</code>, but this varies by platform.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">On some platforms, there may sometimes be multiple environment variables with the same name;\\n             in this case, it is implementation-dependent as to which is returned; see for example\\n                <bibref ref=\"POSIX.1-2008\"/> (Chapter 8, Environment Variables).\\n             Implementations <rfc2119>may</rfc2119> use prefixes or other naming conventions\\n             to disambiguate the names.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The requirement to ensure that the function is deterministic means in practice that\\n          the implementation must make a snapshot of the environment variables at some time\\n          during execution, and return values obtained from this snapshot, rather than using\\n          live values that are subject to change at any time.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Operating system environment variables may be associated with a particular process,\\n          while queries and stylesheets may execute across multiple processes (or multiple machines).\\n          In such circumstances implementations <rfc2119>may</rfc2119> choose to provide access\\n          to the environment variables associated with the process in which the query or stylesheet\\n          processing was initiated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Security advice: Queries from untrusted sources should not be permitted unrestricted\\n             access to environment variables. For example, the name of the account under which the\\n             query is running may be useful information to a would-be intruder. An implementation may\\n             therefore choose to restrict access to the environment, or may provide a facility to\\n             make <code>fn:environment-variable</code> always return the empty sequence.</p></div>\\n',summary:\"<p>  Returns the value of a system environment variable, if it exists.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"error\",qname:\"fn:error\",signature:\"() as none external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the <code>fn:error</code> function raises an application-defined\\n             error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/><arg name=\"error-object\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function never returns a value. Instead it always raises an error. The effect of\\n             the error is identical to the effect of dynamic errors raised implicitly, for example\\n             when an incorrect argument is supplied to a function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The parameters to the <code>fn:error</code> function supply information that is\\n             associated with the error condition and that is made available to a caller that asks for\\n             information about the error. The error may be caught either by the host language (using\\n             a try/catch construct in XSLT or XQuery, for example), or by the calling application or\\n             external processing environment. The way in which error information is returned to the\\n             external processing environment is <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>fn:error</code> is called with no arguments, then its behavior is the same as\\n             the function call: </p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:error(fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')) </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$code</code> is the empty sequence then the effective value is the\\n                <code>xs:QName</code> constructed by:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">There are three pieces of information that may be associated with an error:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>The <code>$code</code> is an error code that distinguishes this error from others.\\n                   It is an <code>xs:QName</code>; the namespace URI conventionally identifies the\\n                   component, subsystem, or authority responsible for defining the meaning of the\\n                   error code, while the local part identifies the specific error condition. The\\n                   namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is used for errors\\n                   defined in this specification; other namespace URIs may be used for errors defined\\n                   by the application.</p><p>If the external processing environment expects the error code to be returned as a\\n                   URI or a string rather than as an <code>xs:QName</code>, then an error code with\\n                   namespace URI <code>NS</code> and local part <code>LP</code> will be returned in\\n                   the form <code>NS#LP</code>. The namespace URI part of the error code should\\n                   therefore not include a fragment identifier.</p></item><item><p>The <code>$description</code> is a natural-language description of the error\\n                   condition.</p></item><item><p>The <code>$error-object</code> is an arbitrary value used to convey additional\\n                   information about the error, and may be used in any way the application\\n                   chooses.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function always raises a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error. By default, it raises <errorref class=\"ER\" code=\"0000\"/></p></div>\\n',summary:\"<p>  Calling the  fn:error  function raises an application-defined\\n             error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"none\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"error\",qname:\"fn:error\",signature:\"($code as xs:QName) as none external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the <code>fn:error</code> function raises an application-defined\\n             error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/><arg name=\"error-object\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function never returns a value. Instead it always raises an error. The effect of\\n             the error is identical to the effect of dynamic errors raised implicitly, for example\\n             when an incorrect argument is supplied to a function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The parameters to the <code>fn:error</code> function supply information that is\\n             associated with the error condition and that is made available to a caller that asks for\\n             information about the error. The error may be caught either by the host language (using\\n             a try/catch construct in XSLT or XQuery, for example), or by the calling application or\\n             external processing environment. The way in which error information is returned to the\\n             external processing environment is <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>fn:error</code> is called with no arguments, then its behavior is the same as\\n             the function call: </p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:error(fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')) </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$code</code> is the empty sequence then the effective value is the\\n                <code>xs:QName</code> constructed by:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">There are three pieces of information that may be associated with an error:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>The <code>$code</code> is an error code that distinguishes this error from others.\\n                   It is an <code>xs:QName</code>; the namespace URI conventionally identifies the\\n                   component, subsystem, or authority responsible for defining the meaning of the\\n                   error code, while the local part identifies the specific error condition. The\\n                   namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is used for errors\\n                   defined in this specification; other namespace URIs may be used for errors defined\\n                   by the application.</p><p>If the external processing environment expects the error code to be returned as a\\n                   URI or a string rather than as an <code>xs:QName</code>, then an error code with\\n                   namespace URI <code>NS</code> and local part <code>LP</code> will be returned in\\n                   the form <code>NS#LP</code>. The namespace URI part of the error code should\\n                   therefore not include a fragment identifier.</p></item><item><p>The <code>$description</code> is a natural-language description of the error\\n                   condition.</p></item><item><p>The <code>$error-object</code> is an arbitrary value used to convey additional\\n                   information about the error, and may be used in any way the application\\n                   chooses.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function always raises a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error. By default, it raises <errorref class=\"ER\" code=\"0000\"/></p></div>\\n',summary:\"<p>  Calling the  fn:error  function raises an application-defined\\n             error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"code\",type:\"xs:QName\",occurrence:null,description:\"\"}],returns:{type:\"none\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"error\",qname:\"fn:error\",signature:\"($code as xs:QName?, $description as xs:string) as none external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the <code>fn:error</code> function raises an application-defined\\n             error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/><arg name=\"error-object\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function never returns a value. Instead it always raises an error. The effect of\\n             the error is identical to the effect of dynamic errors raised implicitly, for example\\n             when an incorrect argument is supplied to a function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The parameters to the <code>fn:error</code> function supply information that is\\n             associated with the error condition and that is made available to a caller that asks for\\n             information about the error. The error may be caught either by the host language (using\\n             a try/catch construct in XSLT or XQuery, for example), or by the calling application or\\n             external processing environment. The way in which error information is returned to the\\n             external processing environment is <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>fn:error</code> is called with no arguments, then its behavior is the same as\\n             the function call: </p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:error(fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')) </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$code</code> is the empty sequence then the effective value is the\\n                <code>xs:QName</code> constructed by:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">There are three pieces of information that may be associated with an error:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>The <code>$code</code> is an error code that distinguishes this error from others.\\n                   It is an <code>xs:QName</code>; the namespace URI conventionally identifies the\\n                   component, subsystem, or authority responsible for defining the meaning of the\\n                   error code, while the local part identifies the specific error condition. The\\n                   namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is used for errors\\n                   defined in this specification; other namespace URIs may be used for errors defined\\n                   by the application.</p><p>If the external processing environment expects the error code to be returned as a\\n                   URI or a string rather than as an <code>xs:QName</code>, then an error code with\\n                   namespace URI <code>NS</code> and local part <code>LP</code> will be returned in\\n                   the form <code>NS#LP</code>. The namespace URI part of the error code should\\n                   therefore not include a fragment identifier.</p></item><item><p>The <code>$description</code> is a natural-language description of the error\\n                   condition.</p></item><item><p>The <code>$error-object</code> is an arbitrary value used to convey additional\\n                   information about the error, and may be used in any way the application\\n                   chooses.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function always raises a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error. By default, it raises <errorref class=\"ER\" code=\"0000\"/></p></div>\\n',summary:\"<p>  Calling the  fn:error  function raises an application-defined\\n             error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"code\",type:\"xs:QName\",occurrence:\"?\",description:\"\"},{name:\"description\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"none\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"error\",qname:\"fn:error\",signature:\"($code as xs:QName?, $description as xs:string, $error-object as item()*) as none external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the <code>fn:error</code> function raises an application-defined\\n             error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"error\" return-type=\"none\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"code\" type=\"xs:QName?\"/><arg name=\"description\" type=\"xs:string\"/><arg name=\"error-object\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function never returns a value. Instead it always raises an error. The effect of\\n             the error is identical to the effect of dynamic errors raised implicitly, for example\\n             when an incorrect argument is supplied to a function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The parameters to the <code>fn:error</code> function supply information that is\\n             associated with the error condition and that is made available to a caller that asks for\\n             information about the error. The error may be caught either by the host language (using\\n             a try/catch construct in XSLT or XQuery, for example), or by the calling application or\\n             external processing environment. The way in which error information is returned to the\\n             external processing environment is <termref def=\"implementation-dependent\"/></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>fn:error</code> is called with no arguments, then its behavior is the same as\\n             the function call: </p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:error(fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')) </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$code</code> is the empty sequence then the effective value is the\\n                <code>xs:QName</code> constructed by:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:QName(\\'http://www.w3.org/2005/xqt-errors\\', \\'err:FOER0000\\')</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">There are three pieces of information that may be associated with an error:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>The <code>$code</code> is an error code that distinguishes this error from others.\\n                   It is an <code>xs:QName</code>; the namespace URI conventionally identifies the\\n                   component, subsystem, or authority responsible for defining the meaning of the\\n                   error code, while the local part identifies the specific error condition. The\\n                   namespace URI <code>http://www.w3.org/2005/xqt-errors</code> is used for errors\\n                   defined in this specification; other namespace URIs may be used for errors defined\\n                   by the application.</p><p>If the external processing environment expects the error code to be returned as a\\n                   URI or a string rather than as an <code>xs:QName</code>, then an error code with\\n                   namespace URI <code>NS</code> and local part <code>LP</code> will be returned in\\n                   the form <code>NS#LP</code>. The namespace URI part of the error code should\\n                   therefore not include a fragment identifier.</p></item><item><p>The <code>$description</code> is a natural-language description of the error\\n                   condition.</p></item><item><p>The <code>$error-object</code> is an arbitrary value used to convey additional\\n                   information about the error, and may be used in any way the application\\n                   chooses.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function always raises a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error. By default, it raises <errorref class=\"ER\" code=\"0000\"/></p></div>\\n',summary:\"<p>  Calling the  fn:error  function raises an application-defined\\n             error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"code\",type:\"xs:QName\",occurrence:\"?\",description:\"\"},{name:\"description\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"error-object\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"none\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"escape-html-uri\",qname:\"fn:escape-html-uri\",signature:\"($uri as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Escapes a URI in the same way that HTML user agents handle attribute values\\n             expected to contain URIs.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"escape-html-uri\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"uri\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$uri</code> is the empty sequence, the function returns the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function escapes all <termref def=\"character\">characters</termref> except\\n             printable characters of the US-ASCII coded character set, specifically the <termref def=\"codepoint\">codepoints</termref> between 32 and 126 (decimal) inclusive. Each\\n             character in <code>$uri</code> to be escaped is replaced by an escape sequence, which is\\n             formed by encoding the character as a sequence of octets in UTF-8, and then representing\\n             each of these octets in the form %HH, where HH is the hexadecimal representation of the\\n             octet. This function must always generate hexadecimal values using the upper-case\\n             letters A-F.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The behavior of this function corresponds to the recommended handling of non-ASCII\\n             characters in URI attribute values as described in <bibref ref=\"HTML40\"/> Appendix\\n             B.2.1.</p></div>\\n',summary:\"<p>  Escapes a URI in the same way that HTML user agents handle attribute values\\n             expected to contain URIs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exactly-one\",qname:\"fn:exactly-one\",signature:\"($arg as item()*) as item() external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>$arg</code> if it contains exactly one item. Otherwise, raises an\\n             error. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"exactly-one\" return-type=\"item()\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Except in error cases, the function returns <code>$arg</code> unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0005\"/> if <code>$arg</code> is an empty\\n             sequence or a sequence containing more than one item.</p></div>\\n',summary:\"<p>  Returns  $arg  if it contains exactly one item.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exists\",qname:\"fn:exists\",signature:\"($arg as item()*) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the argument is a non-empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"exists\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a non-empty sequence, the function returns\\n                <code>true</code>; otherwise, the function returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:exists(fn:remove((\"hello\"), 1))</code> returns <code>false()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:exists(fn:remove((\"hello\", \"world\"), 1))</code> returns <code>true()</code>.</p></div>\\n',summary:\"<p>  Returns true if the argument is a non-empty sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"false\",qname:\"fn:false\",signature:\"() as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the <code>xs:boolean</code> value <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"false\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result is equivalent to <code>xs:boolean(\"0\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:false()</code> returns <code>xs:boolean(0)</code>.</p></div>\\n',summary:\"<p>  Returns the  xs:boolean  value  false .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"filter\",qname:\"fn:filter\",signature:\"($seq as item()*, $f as function (item()) as xs:boolean) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns those items from the sequence <var>$seq</var> for which the supplied\\n             function <var>$f</var> returns true.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"filter\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"item()*\"/><arg name=\"f\" type=\"function(item()) as xs:boolean\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function is equivalent to the following implementation in XQuery:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n declare function fn:filter(\\n         $seq as item()*,\\n         $f as function(item()) as xs:boolean)\\n         as item()* {\\n   if (fn:empty($seq))\\n   then ()\\n   else ( fn:head($seq)[$f(.) eq fn:true()],\\n          fn:filter(fn:tail($seq), $f)\\n        )\\n };</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">or its equivalent in XSLT:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n &lt;xsl:function name=\"fn:filter\" as=\"item()*\"&gt;\\n   &lt;xsl:param name=\"seq\" as=\"item()*\"/&gt;\\n   &lt;xsl:param name=\"f\" as=\"function(item()) as xs:boolean\"/&gt;\\n   &lt;xsl:if test=\"fn:exists($seq)\"&gt;\\n     &lt;xsl:sequence select=\"fn:head($seq)[$f(.) eq fn:true()], fn:filter(fn:tail($seq), $f)\"/&gt;\\n   &lt;/xsl:if&gt;\\n &lt;/xsl:function&gt;\\n          </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">As a consequence of the function signature and the function calling\\n             rules, a type error occurs if the supplied function <var>$f</var> returns anything other\\n             than a single <code>xs:boolean</code> item; there is no conversion to an effective\\n             boolean value.</p></div>\\n',summary:\"<p>  Returns those items from the sequence  $seq  for which the supplied\\n             function  $f  returns true.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"f\",type:\"function (item()) as xs:boolean\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"floor\",qname:\"fn:floor\",signature:\"($arg as numeric?) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds <code>$arg</code> downwards to a whole number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"floor\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the largest (closest to positive infinity) number with no\\n             fractional part that is not greater than the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For <code>xs:float</code> and <code>xs:double</code> arguments, if the argument is\\n             positive zero, then positive zero is returned. If the argument is negative zero, then\\n             negative zero is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:floor(10.5)</code> returns <code>10</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:floor(-10.5)</code> returns <code>-11</code>.</p></div>\\n',summary:\"<p>  Rounds  $arg  downwards to a whole number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"fold-left\",qname:\"fn:fold-left\",signature:\"($seq as item()*, $zero as item()*, $f as function (item()*, item()) as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Processes the supplied sequence from left to right, applying the supplied\\n             function repeatedly to each item in turn, together with an accumulated result value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"fold-left\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"item()*\"/><arg name=\"zero\" type=\"item()*\"/><arg name=\"f\" type=\"function(item()*, item()) as item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function is equivalent to the following implementation in XQuery:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n declare function fn:fold-left(\\n         $seq as item()*\\n         $zero as item()*,\\n         $f as function(item()*, item()) as item()*)\\n         as item()* {\\n   if (fn:empty($seq))\\n   then $zero\\n   else fn:fold-left(fn:tail($seq), $f($zero, fn:head($seq)), $f)\\n };</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">or its equivalent in XSLT:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n &lt;xsl:function name=\"fn:fold-left\" as=\"item()*\"&gt;\\n   &lt;xsl:param name=\"seq\" as=\"item()*\"/&gt;\\n   &lt;xsl:param name=\"zero\" as=\"item()*\"/&gt;\\n   &lt;xsl:param name=\"f\" as=\"function(item()*, item()) as item()*\"/&gt;\\n   &lt;xsl:choose&gt;\\n     &lt;xsl:when test=\"fn:empty($seq)\"&gt;\\n       &lt;xsl:sequence select=\"$zero\"/&gt;\\n     &lt;/xsl:when&gt;\\n     &lt;xsl:otherwise&gt;\\n       &lt;xsl:sequence select=\"fn:fold-left(fn:tail($seq), $f($zero, fn:head($seq)), $f)\"/&gt;\\n     &lt;/xsl:otherwise&gt;\\n   &lt;/xsl:choose&gt;\\n &lt;/xsl:function&gt;\\n          </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">As a consequence of the function signature and the function calling\\n             rules, a type error occurs if the supplied function <var>$f</var> cannot be applied to\\n             two arguments, where the first argument is either the value of <var>$zero</var> or the\\n             result of a previous application of <var>$f</var>, and the second is <var>$seq</var> or\\n             any trailing subsequence of <var>$seq</var>.</p></div>\\n',summary:\"<p>  Processes the supplied sequence from left to right, applying the supplied\\n             function repeatedly to each item in turn, together with an accumulated result value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"zero\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"f\",type:\"function (item()*, item()) as item()*\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"fold-right\",qname:\"fn:fold-right\",signature:\"($seq as item()*, $zero as item()*, $f as function (item()*, item()) as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Processes the supplied sequence from right to left, applying the supplied\\n             function repeatedly to each item in turn, together with an accumulated result value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"fold-right\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"item()*\"/><arg name=\"zero\" type=\"item()*\"/><arg name=\"f\" type=\"function(item()*, item()) as item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function is equivalent to the following implementation in XQuery:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n declare function fn:fold-right(\\n         $seq as item()*,\\n         $zero as item()*,\\n         $f as function(item(), item()*) as item()*)\\n         as item()* {\\n   if (fn:empty($seq))\\n   then $zero\\n   else $f(fn:head($seq), fn:fold-right(fn:tail($seq), $zero, $f))\\n };</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">or its equivalent in XSLT:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n &lt;xsl:function name=\"fn:fold-right\" as=\"item()*\"&gt;\\n   &lt;xsl:param name=\"seq\" as=\"item()*\"/&gt;\\n   &lt;xsl:param name=\"zero\" as=\"item()*\"/&gt;\\n   &lt;xsl:param name=\"f\" as=\"function(item(), item()*) as item()*\"/&gt;\\n   &lt;xsl:choose&gt;\\n     &lt;xsl:when test=\"fn:empty($seq)\"&gt;\\n       &lt;xsl:sequence select=\"$zero\"/&gt;\\n     &lt;/xsl:when&gt;\\n     &lt;xsl:otherwise&gt;\\n       &lt;xsl:sequence select=\"$f(fn:head($seq), fn:fold-right(fn:tail($seq), $zero, $f))\"/&gt;\\n     &lt;/xsl:otherwise&gt;\\n   &lt;/xsl:choose&gt;\\n &lt;/xsl:function&gt;\\n          </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">As a consequence of the function signature and the function calling\\n             rules, a type error occurs if the supplied function <var>$f</var> cannot be applied to\\n             two arguments, where the first argument is any item in the sequence <var>$seq</var>, and\\n             the second is either the value of <var>$zero</var> or the result of a previous\\n             application of <var>$f</var>.</p></div>\\n',summary:\"<p>  Processes the supplied sequence from right to left, applying the supplied\\n             function repeatedly to each item in turn, together with an accumulated result value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"zero\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"f\",type:\"function (item()*, item()) as item()*\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"for-each-pair\",qname:\"fn:for-each-pair\",signature:\"($seq1 as item()*, $seq2 as item()*, $f as function (item(), item()) as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Applies the function item <var>$f</var> to successive pairs of items taken one\\n             from <var>$seq1</var> and one from <var>$seq2</var>, returning the concatenation of the\\n             resulting sequences in order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"for-each-pair\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq1\" type=\"item()*\"/><arg name=\"seq2\" type=\"item()*\"/><arg name=\"f\" type=\"function(item(), item()) as item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function is equivalent to the following implementation in XQuery:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n declare function fn:for-each-pair($seq1, $seq2, $f)\\n {\\n    if(fn:exists($seq1) and fn:exists($seq2))\\n    then (\\n      $f(fn:head($seq1), fn:head($seq2)),\\n      fn:for-each-pair(fn:tail($seq1), fn:tail($seq2), $f)\\n    )\\n    else ()\\n };</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">or its equivalent in XSLT:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n &lt;xsl:function name=\"fn:for-each-pair\"&gt;\\n   &lt;xsl:param name=\"seq1/&gt;\\n   &lt;xsl:param name=\"seq2/&gt;\\n   &lt;xsl:param name=\"f\"/&gt;\\n   &lt;xsl:if test=\"fn:exists($seq1) and fn:exists($seq2)\"&gt;\\n     &lt;xsl:sequence select=\"$f(fn:head($seq1), fn:head($seq2))\"/&gt;\\n     &lt;xsl:sequence select=\"fn:for-each-pair(fn:tail($seq1), fn:tail($seq2), $f)\"/&gt;\\n   &lt;/xsl:if&gt;\\n &lt;/xsl:function&gt;\\n          </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:for-each-pair((\"a\", \"b\", \"c\"), (\"x\", \"y\", \"z\"), concat#2)</code> returns <code>(\"ax\", \"by\", \"cz\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:for-each-pair(1 to 5, 1 to 5, function($a, $b){10*$a + $b}</code> returns <code>(11, 22, 33, 44, 55)</code>.</p></div>\\n',summary:\"<p>  Applies the function item  $f  to successive pairs of items taken one\\n             from  $seq1  and one from  $seq2 , returning the concatenation of the\\n             resulting sequences in order.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"seq2\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"f\",type:\"function (item(), item()) as item()*\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"for-each\",qname:\"fn:for-each\",signature:\"($seq as item()*, $f as function (item()) as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Applies the function item <var>$f</var> to every item from the sequence\\n                <var>$seq</var> in turn, returning the concatenation of the resulting sequences in\\n             order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"for-each\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"item()*\"/><arg name=\"f\" type=\"function(item()) as item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function is equivalent to the following implementation in XQuery:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n declare function fn:for-each($seq, $f) {\\n   if (fn:empty($seq))\\n   then ()\\n   else ($f(fn:head($seq)), fn:for-each(fn:tail($seq), $f))\\n };</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">or its equivalent in XSLT:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n &lt;xsl:function name=\"fn:for-each\"&gt;\\n   &lt;xsl:param name=\"seq\"/&gt;\\n   &lt;xsl:param name=\"f\"/&gt;\\n   &lt;xsl:if test=\"fn:exists($seq)\"&gt;\\n     &lt;xsl:sequence select=\"$f(fn:head($seq)), fn:for-each(fn:tail($seq), $f)\"/&gt;\\n   &lt;/xsl:if&gt;\\n &lt;/xsl:function&gt;\\n          </eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function call <code>fn:for-each($SEQ, $F)</code> is equivalent to the expression\\n                <code>for $i in $SEQ return $F($i)</code><phrase diff=\"add\" at=\"G\">, assuming that\\n                ordering mode is <code>ordered</code>.</phrase></p></div>\\n',summary:\"<p>  Applies the function item  $f  to every item from the sequence\\n                 $seq  in turn, returning the concatenation of the resulting sequences in\\n             order.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"f\",type:\"function (item()) as item()*\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"format-date\",qname:\"fn:format-date\",signature:\"($value as xs:date?, $picture as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:date</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-date\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:date?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-date\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:date?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:date  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:date\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:5,name:\"format-date\",qname:\"fn:format-date\",signature:\"($value as xs:date?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:date</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-date\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:date?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-date\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:date?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:date  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:date\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"language\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"calendar\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"place\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"format-dateTime\",qname:\"fn:format-dateTime\",signature:\"($value as xs:dateTime?, $picture as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:dateTime</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-dateTime\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:dateTime?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-dateTime\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:dateTime?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:dateTime  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:5,name:\"format-dateTime\",qname:\"fn:format-dateTime\",signature:\"($value as xs:dateTime?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:dateTime</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-dateTime\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:dateTime?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-dateTime\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:dateTime?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:dateTime  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"language\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"calendar\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"place\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"format-integer\",qname:\"fn:format-integer\",signature:\"($value as xs:integer?, $picture as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Formats an integer according to a given picture string, using the conventions\\n             of a given natural language if specified.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-integer\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:integer?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-integer\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:integer?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"lang\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault language.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$value</code> is an empty sequence, the function returns a zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In all other cases, the <code>$picture</code> argument describes the format in which\\n                <code>$value</code> is output.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The rules that follow describe how non-negative numbers are output. If the value of\\n                <code>$value</code> is negative, the rules below are applied to the absolute value of\\n                <code>$value</code>, and a minus sign is prepended to the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"L\">The value of <code>$picture</code> consists of a primary format token,\\n             optionally followed\\n             by a format modifier. The primary format token is always present and <rfc2119>must not</rfc2119>\\n             be zero-length. If the string contains one or more semicolons then everything that\\n             precedes the last semicolon is taken as the primary format token and everything\\n             that follows is taken as the format modifier; if the string contains no\\n             semicolon then the entire picture is taken as the primary format token, and the\\n             format modifier is taken to be absent (which is equivalent to supplying a\\n             zero-length string).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The primary format token is classified as one of the following:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>A <var>decimal-digit-pattern</var> made up of <var>optional-digit-signs</var>,\\n                      <var>mandatory-digit-signs</var>, and <var>grouping-separator-signs</var>.</p><ulist><item><p>The <var>optional-digit-sign</var> is the character \"#\".</p></item><item><p>A <var>mandatory-digit-sign</var> is a <termref def=\"character\">character</termref> in Unicode category Nd. All\\n                            <var>mandatory-digit-signs</var> within the format token <rfc2119>must</rfc2119> be from the\\n                         same digit family, where a digit family is a sequence of ten consecutive\\n                         characters in Unicode category Nd, having digit values 0 through 9. Within\\n                         the format token, these digits are interchangeable: a three-digit number may\\n                         thus be indicated equivalently by <code>000</code>, <code>001</code>, or\\n                            <code>999</code>.</p></item><item><p>a <var>grouping-separator-sign</var> is a non-alphanumeric character, that\\n                         is a <termref def=\"character\">character</termref> whose Unicode category is\\n                         other than Nd, Nl, No, Lu, Ll, Lt, Lm or Lo.</p></item></ulist><p diff=\"chg\" at=\"L\">If the primary format token contains at least one Unicode digit\\n                   then it is taken as a decimal digit pattern, and in this case it <rfc2119>must</rfc2119>\\n                   match the regular expression <code>^((\\\\p{Nd}|#|[^\\\\p{N}\\\\p{L}])+?)$</code>. If it contains\\n                   a digit but does not match this pattern, a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error\\n                   is raised <errorref class=\"DF\" code=\"1310\"/>.</p><note><p diff=\"add\" at=\"L\">If a semicolon is to be used as a grouping separator, then the primary\\n                format token as a whole must be followed by another semicolon, to ensure that\\n                the grouping separator is not mistaken as a separator between the primary format\\n                token and the format modifier.</p></note><p>There <rfc2119>must</rfc2119> be at least one <var>mandatory-digit-sign</var>. There may be zero or\\n                   more <var>optional-digit-signs</var>, and (if present) these <rfc2119>must</rfc2119> precede all\\n                      <var>mandatory-digit-signs</var>. There may be zero or more\\n                      <var>grouping-separator-signs</var>. A <var>grouping-separator-sign</var> <rfc2119>must\\n                   not</rfc2119> appear at the start or end of the <var>decimal-digit-pattern</var>, nor\\n                   adjacent to another <var>grouping-separator-sign</var>.</p><p>The corresponding output format is a decimal number, using this digit family, with\\n                   at least as many digits as there are <var>mandatory-digit-signs</var> in the\\n                   format token. Thus, a format token <code>1</code> generates the sequence <code>0 1\\n                      2 ... 10 11 12 ...</code>, and a format token <code>01</code> (or equivalently,\\n                      <code>00</code> or <code>99</code>) generates the sequence <code>00 01 02 ...\\n                      09 10 11 12 ... 99 100 101</code>. A format token of <code>&amp;#x661;</code>\\n                   (Arabic-Indic digit one) generates the sequence <code>١</code> then <code>٢</code>\\n                   then <code>٣</code> ...</p><p>The <var>grouping-separator-signs</var> are handled as follows. The position of\\n                   grouping separators within the format token, counting backwards from the last\\n                   digit, indicates the position of grouping separators to appear within the\\n                   formatted number, and the character used as the <var>grouping-separator-sign</var>\\n                   within the format token indicates the character to be used as the corresponding\\n                   grouping separator in the formatted number. If <var>grouping-separator-signs</var>\\n                   appear at regular intervals within the format token, that is if the same grouping\\n                   separator appears at positions forming a sequence <var>N</var>, 2<var>N</var>,\\n                      3<var>N</var>, ... for some integer value <var>N</var> (including the case\\n                   where there is only one number in the list), then the sequence is extrapolated to\\n                   the left, so grouping separators will be used in the formatted number at every\\n                   multiple of <var>N</var>. For example, if the format token is <code>0\\'000</code>\\n                   then the number one million will be formatted as <code>1\\'000\\'000</code>, while the\\n                   number fifteen will be formatted as <code>0\\'015</code>.</p><p>The only purpose of <var>optional-digit-signs</var> is to mark the position of\\n                      <var>grouping-separator-signs</var>. For example, if the format token is\\n                      <code>#\\'##0</code> then the number one million will be formatted as\\n                      <code>1\\'000\\'000</code>, while the number fifteen will be formatted as\\n                      <code>15</code>. A grouping separator is included in the formatted number only\\n                   if there is a digit to its left, which will only be the case if either (a) the\\n                   number is large enough to require that digit, or (b) the number of\\n                      <var>mandatory-digit-signs</var> in the format token requires insignificant\\n                   leading zeros to be present.</p><note><p>Numbers will never be truncated. Given the <var>decimal-digit-pattern</var>\\n                      <code>01</code>, the number three hundred will be output as <code>300</code>,\\n                      despite the absence of any <var>optional-digit-sign</var>.</p></note></item><item><p>The format token <code>A</code>, which generates the sequence <code>A B C ... Z AA AB\\n                      AC...</code>.</p></item><item><p>The format token <code>a</code>, which generates the sequence <code>a b c ... z aa ab\\n                      ac...</code>.</p></item><item><p>The format token <code>i</code>, which generates the sequence <code>i ii iii iv v vi vii\\n                      viii ix x ...</code>.</p></item><item><p>The format token <code>I</code>, which generates the sequence <code>I II III IV V VI VII\\n                      VIII IX X ...</code>.</p></item><item><p>The format token <code>w</code>, which generates numbers written as lower-case words, for\\n                   example in English, <code>one two three four ...</code>\\n                </p></item><item><p>The format token <code>W</code>, which generates numbers written as upper-case words, for\\n                   example in English, <code>ONE TWO THREE FOUR ...</code>\\n                </p></item><item><p>The format token <code>Ww</code>, which generates numbers written as title-case words, for\\n                   example in English, <code>One Two Three Four ...</code>\\n                </p></item><item><p>Any other format token, which indicates a numbering sequence in which that token\\n                   represents the number 1 (one) (but see the note below).\\n                   <!-- Where possible (given the constraint that format tokens\\n \t\t\t\t\t\tmust be alphanumeric, and that they must be distinct) the format token\\n \t\t\t\t\t\tused to represent a numbering sequence should be the same as the representation\\n \t\t\t\t\t\tof the number 1 (one) in that sequence.-->\\n                   It is <termref def=\"implementation-defined\">implementation-defined</termref> which\\n                   numbering sequences, additional to those listed above, are supported. If an\\n                   implementation does not support a numbering sequence represented by the given\\n                   token, it <rfc2119>must</rfc2119> use a format token of <code>1</code>.</p><note><p>In some traditional numbering sequences additional signs are added to denote\\n                      that the letters should be interpreted as numbers; these are not included in\\n                      the format token. An example (see also the example below) is classical Greek\\n                      where a <emph>dexia keraia</emph> (x0374, ʹ) and sometimes an <emph>aristeri keraia</emph>\\n                      (x0375, ͵) is added.</p></note></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For all format tokens other than the first kind above (one that consists of decimal\\n             digits), there <rfc2119>may</rfc2119> be <termref def=\"implementation-defined\">implementation-defined</termref> lower and upper bounds on the range of numbers that\\n             can be formatted using this format token; indeed, for some numbering sequences there may\\n             be intrinsic limits. For example, the format token <code>&amp;#x2460;</code> (circled\\n             digit one, ①) has a range <phrase diff=\"chg\" at=\"M\">imposed by the Unicode character repertoire — 1 to 20 in\\n             Unicode versions prior to 4.0, increased in subsequent versions</phrase>. For\\n             the numbering sequences described above any upper bound imposed by the implementation\\n                <rfc2119>must not</rfc2119> be less than 1000 (one thousand) and any lower bound must\\n             not be greater than 1. Numbers that fall outside this range <rfc2119>must</rfc2119> be\\n             formatted using the format token <code>1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The above expansions of numbering sequences for format tokens such as <code>a</code> and\\n                <code>i</code> are indicative but not prescriptive. There are various conventions in\\n             use for how alphabetic sequences continue when the alphabet is exhausted, and differing\\n             conventions for how roman numerals are written (for example, <code>IV</code> versus\\n                <code>IIII</code> as the representation of the number 4). Sometimes alphabetic\\n             sequences are used that omit letters such as <code>i</code> and <code>o</code>. This\\n             specification does not prescribe the detail of any sequence other than those sequences\\n             consisting entirely of decimal digits.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Many numbering sequences are language-sensitive. This applies especially to the sequence\\n             selected by the tokens <code>w</code>, <code>W</code> and <code>Ww</code>. It also\\n             applies to other sequences, for example different languages using the Cyrillic alphabet\\n             use different sequences of characters, each starting with the letter #x410 (Cyrillic\\n             capital letter A). In such cases, the <code>$lang</code> argument specifies which\\n             language\\'s conventions are to be used. <phrase diff=\"chg\" at=\"L\">If the argument\\n             is specified, the value <rfc2119>should</rfc2119> be either an empty sequence\\n             or a value that would be valid for the <code>xml:lang</code> attribute (see <bibref ref=\"REC-xml\"/>).\\n             Note that this permits the identification of sublanguages based on country codes (from ISO 3166-1)\\n             as well as identification of dialects and regions within a country.</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The set of languages\\n             for which numbering is supported is <termref def=\"implementation-defined\"/>.\\n             If the <code>$lang</code> argument is absent,\\n             or is set to an empty sequence, or is invalid, or is not a language supported by the\\n             implementation, then the number is formatted using <phrase diff=\"chg\" at=\"K\">the\\n             default language from the dynamic context</phrase>.\\n             </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The format modifier <phrase diff=\"chg\" at=\"L\"><rfc2119>must</rfc2119>\\n             be a string that matches the regular expression <code diff=\"chg\" at=\"M\">^([co](\\\\(.+\\\\))?)?[at]?$</code>. </phrase>\\n             That is, if it is present it must consist of one <phrase diff=\"add\" at=\"G\">or more</phrase> of\\n             the following, in <phrase diff=\"del\" at=\"K\">any</phrase> order:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p diff=\"chg\" at=\"G\">either <code>c</code> or <code>o</code>, optionally followed by\\n                   a sequence of characters enclosed between parentheses, to indicate cardinal or\\n                   ordinal numbering respectively, the default being cardinal numbering</p></item><item><p diff=\"chg\" at=\"G\">either <code>a</code> or <code>t</code>, to indicate alphabetic\\n                   or traditional numbering respectively, the default being <termref def=\"implementation-defined\">implementation-defined</termref>.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the <code>o</code> modifier is present, this indicates a request to output ordinal\\n             numbers rather than cardinal numbers. For example, in English, when used with the format\\n             token <code>1</code>, this outputs the sequence <code>1st 2nd 3rd 4th ...</code>, and\\n             when used with the format token <code>w</code> outputs the sequence <code>first second\\n             third fourth ...</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The string of characters between the parentheses, if present, is used to\\n          select between other possible variations of cardinal or ordinal numbering sequences.\\n          The interpretation of this string is <termref def=\"implemementation-defined\">implementation-defined</termref>. No error occurs\\n          if the implementation does not define any interpretation for the defined string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For example, in some languages, ordinal numbers vary depending on the grammatical context:\\n             they may have different genders and may decline with the noun that they qualify.\\n             In such cases the string appearing in parentheses after the letter <code>o</code> may be\\n             used to indicate the variation of the ordinal number required. The way in which the\\n             variation is indicated will depend on the conventions of the language. For inflected\\n             languages that vary the ending of the word, the <rfc2119>recommended</rfc2119> approach is to indicate the\\n             required ending, preceded by a hyphen: for example in German, appropriate values are\\n                <code>o(-e)</code>, <code>o(-er)</code>, <code>o(-es)</code>, <code>o(-en)</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">It is <termref def=\"implementation-defined\">implementation-defined</termref> what\\n             combinations of values of the format token, the language, and the cardinal/ordinal\\n             modifier are supported. If ordinal numbering is not supported for the combination of the\\n             format token, the language, and the string appearing in parentheses, the request is\\n             ignored and cardinal numbers are generated instead.</p><example xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><head>Ordinal Numbering in Italian</head><p>The specification <code>\"1;o(-º)\"</code> with <code>$lang</code> equal to\\n                   <code>it</code>, if supported, should produce the sequence:</p><eg xml:space=\"preserve\">1º 2º 3º 4º ...</eg><p>The specification <code>\"Ww;o\"</code> with <code>$lang</code> equal to\\n                   <code>it</code>, if supported, should produce the sequence:</p><eg xml:space=\"preserve\">Primo Secondo Terzo Quarto Quinto ...</eg></example><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <phrase diff=\"chg\" at=\"G\">use of the <code>a</code> or <code>t</code>\\n                modifier</phrase> disambiguates between numbering sequences that use letters. In many\\n             languages there are two commonly used numbering sequences that use letters. One\\n             numbering sequence assigns numeric values to letters in alphabetic sequence, and the\\n             other assigns numeric values to each letter in some other manner traditional in that\\n             language. In English, these would correspond to the numbering sequences specified by the\\n             format tokens <code>a</code> and <code>i</code>. In some languages, the first member of\\n             each sequence is the same, and so the format token alone would be ambiguous. <phrase diff=\"chg\" at=\"G\">In the absence of the <code>a</code> or <code>t</code> modifier,\\n                the default is <termref def=\"implementation-defined\">implementation-defined</termref></phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DF\" code=\"1310\"/> if the format token is invalid,\\n             that is, if it violates any mandatory rules (indicated by an emphasized <rfc2119>must</rfc2119>\\n             or <rfc2119>required</rfc2119> keyword in the above rules). For example, the error is raised if\\n             the primary format token contains a digit but does not match the required regular expression.</p></div>\\n',summary:\"<p>  Formats an integer according to a given picture string, using the conventions\\n             of a given natural language if specified.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:integer\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"format-integer\",qname:\"fn:format-integer\",signature:\"($value as xs:integer?, $picture as xs:string, $language as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Formats an integer according to a given picture string, using the conventions\\n             of a given natural language if specified.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-integer\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:integer?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-integer\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:integer?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"lang\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault language.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$value</code> is an empty sequence, the function returns a zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In all other cases, the <code>$picture</code> argument describes the format in which\\n                <code>$value</code> is output.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The rules that follow describe how non-negative numbers are output. If the value of\\n                <code>$value</code> is negative, the rules below are applied to the absolute value of\\n                <code>$value</code>, and a minus sign is prepended to the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"L\">The value of <code>$picture</code> consists of a primary format token,\\n             optionally followed\\n             by a format modifier. The primary format token is always present and <rfc2119>must not</rfc2119>\\n             be zero-length. If the string contains one or more semicolons then everything that\\n             precedes the last semicolon is taken as the primary format token and everything\\n             that follows is taken as the format modifier; if the string contains no\\n             semicolon then the entire picture is taken as the primary format token, and the\\n             format modifier is taken to be absent (which is equivalent to supplying a\\n             zero-length string).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The primary format token is classified as one of the following:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>A <var>decimal-digit-pattern</var> made up of <var>optional-digit-signs</var>,\\n                      <var>mandatory-digit-signs</var>, and <var>grouping-separator-signs</var>.</p><ulist><item><p>The <var>optional-digit-sign</var> is the character \"#\".</p></item><item><p>A <var>mandatory-digit-sign</var> is a <termref def=\"character\">character</termref> in Unicode category Nd. All\\n                            <var>mandatory-digit-signs</var> within the format token <rfc2119>must</rfc2119> be from the\\n                         same digit family, where a digit family is a sequence of ten consecutive\\n                         characters in Unicode category Nd, having digit values 0 through 9. Within\\n                         the format token, these digits are interchangeable: a three-digit number may\\n                         thus be indicated equivalently by <code>000</code>, <code>001</code>, or\\n                            <code>999</code>.</p></item><item><p>a <var>grouping-separator-sign</var> is a non-alphanumeric character, that\\n                         is a <termref def=\"character\">character</termref> whose Unicode category is\\n                         other than Nd, Nl, No, Lu, Ll, Lt, Lm or Lo.</p></item></ulist><p diff=\"chg\" at=\"L\">If the primary format token contains at least one Unicode digit\\n                   then it is taken as a decimal digit pattern, and in this case it <rfc2119>must</rfc2119>\\n                   match the regular expression <code>^((\\\\p{Nd}|#|[^\\\\p{N}\\\\p{L}])+?)$</code>. If it contains\\n                   a digit but does not match this pattern, a <phrase diff=\"add\" at=\"L\">dynamic</phrase> error\\n                   is raised <errorref class=\"DF\" code=\"1310\"/>.</p><note><p diff=\"add\" at=\"L\">If a semicolon is to be used as a grouping separator, then the primary\\n                format token as a whole must be followed by another semicolon, to ensure that\\n                the grouping separator is not mistaken as a separator between the primary format\\n                token and the format modifier.</p></note><p>There <rfc2119>must</rfc2119> be at least one <var>mandatory-digit-sign</var>. There may be zero or\\n                   more <var>optional-digit-signs</var>, and (if present) these <rfc2119>must</rfc2119> precede all\\n                      <var>mandatory-digit-signs</var>. There may be zero or more\\n                      <var>grouping-separator-signs</var>. A <var>grouping-separator-sign</var> <rfc2119>must\\n                   not</rfc2119> appear at the start or end of the <var>decimal-digit-pattern</var>, nor\\n                   adjacent to another <var>grouping-separator-sign</var>.</p><p>The corresponding output format is a decimal number, using this digit family, with\\n                   at least as many digits as there are <var>mandatory-digit-signs</var> in the\\n                   format token. Thus, a format token <code>1</code> generates the sequence <code>0 1\\n                      2 ... 10 11 12 ...</code>, and a format token <code>01</code> (or equivalently,\\n                      <code>00</code> or <code>99</code>) generates the sequence <code>00 01 02 ...\\n                      09 10 11 12 ... 99 100 101</code>. A format token of <code>&amp;#x661;</code>\\n                   (Arabic-Indic digit one) generates the sequence <code>١</code> then <code>٢</code>\\n                   then <code>٣</code> ...</p><p>The <var>grouping-separator-signs</var> are handled as follows. The position of\\n                   grouping separators within the format token, counting backwards from the last\\n                   digit, indicates the position of grouping separators to appear within the\\n                   formatted number, and the character used as the <var>grouping-separator-sign</var>\\n                   within the format token indicates the character to be used as the corresponding\\n                   grouping separator in the formatted number. If <var>grouping-separator-signs</var>\\n                   appear at regular intervals within the format token, that is if the same grouping\\n                   separator appears at positions forming a sequence <var>N</var>, 2<var>N</var>,\\n                      3<var>N</var>, ... for some integer value <var>N</var> (including the case\\n                   where there is only one number in the list), then the sequence is extrapolated to\\n                   the left, so grouping separators will be used in the formatted number at every\\n                   multiple of <var>N</var>. For example, if the format token is <code>0\\'000</code>\\n                   then the number one million will be formatted as <code>1\\'000\\'000</code>, while the\\n                   number fifteen will be formatted as <code>0\\'015</code>.</p><p>The only purpose of <var>optional-digit-signs</var> is to mark the position of\\n                      <var>grouping-separator-signs</var>. For example, if the format token is\\n                      <code>#\\'##0</code> then the number one million will be formatted as\\n                      <code>1\\'000\\'000</code>, while the number fifteen will be formatted as\\n                      <code>15</code>. A grouping separator is included in the formatted number only\\n                   if there is a digit to its left, which will only be the case if either (a) the\\n                   number is large enough to require that digit, or (b) the number of\\n                      <var>mandatory-digit-signs</var> in the format token requires insignificant\\n                   leading zeros to be present.</p><note><p>Numbers will never be truncated. Given the <var>decimal-digit-pattern</var>\\n                      <code>01</code>, the number three hundred will be output as <code>300</code>,\\n                      despite the absence of any <var>optional-digit-sign</var>.</p></note></item><item><p>The format token <code>A</code>, which generates the sequence <code>A B C ... Z AA AB\\n                      AC...</code>.</p></item><item><p>The format token <code>a</code>, which generates the sequence <code>a b c ... z aa ab\\n                      ac...</code>.</p></item><item><p>The format token <code>i</code>, which generates the sequence <code>i ii iii iv v vi vii\\n                      viii ix x ...</code>.</p></item><item><p>The format token <code>I</code>, which generates the sequence <code>I II III IV V VI VII\\n                      VIII IX X ...</code>.</p></item><item><p>The format token <code>w</code>, which generates numbers written as lower-case words, for\\n                   example in English, <code>one two three four ...</code>\\n                </p></item><item><p>The format token <code>W</code>, which generates numbers written as upper-case words, for\\n                   example in English, <code>ONE TWO THREE FOUR ...</code>\\n                </p></item><item><p>The format token <code>Ww</code>, which generates numbers written as title-case words, for\\n                   example in English, <code>One Two Three Four ...</code>\\n                </p></item><item><p>Any other format token, which indicates a numbering sequence in which that token\\n                   represents the number 1 (one) (but see the note below).\\n                   <!-- Where possible (given the constraint that format tokens\\n \t\t\t\t\t\tmust be alphanumeric, and that they must be distinct) the format token\\n \t\t\t\t\t\tused to represent a numbering sequence should be the same as the representation\\n \t\t\t\t\t\tof the number 1 (one) in that sequence.-->\\n                   It is <termref def=\"implementation-defined\">implementation-defined</termref> which\\n                   numbering sequences, additional to those listed above, are supported. If an\\n                   implementation does not support a numbering sequence represented by the given\\n                   token, it <rfc2119>must</rfc2119> use a format token of <code>1</code>.</p><note><p>In some traditional numbering sequences additional signs are added to denote\\n                      that the letters should be interpreted as numbers; these are not included in\\n                      the format token. An example (see also the example below) is classical Greek\\n                      where a <emph>dexia keraia</emph> (x0374, ʹ) and sometimes an <emph>aristeri keraia</emph>\\n                      (x0375, ͵) is added.</p></note></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For all format tokens other than the first kind above (one that consists of decimal\\n             digits), there <rfc2119>may</rfc2119> be <termref def=\"implementation-defined\">implementation-defined</termref> lower and upper bounds on the range of numbers that\\n             can be formatted using this format token; indeed, for some numbering sequences there may\\n             be intrinsic limits. For example, the format token <code>&amp;#x2460;</code> (circled\\n             digit one, ①) has a range <phrase diff=\"chg\" at=\"M\">imposed by the Unicode character repertoire — 1 to 20 in\\n             Unicode versions prior to 4.0, increased in subsequent versions</phrase>. For\\n             the numbering sequences described above any upper bound imposed by the implementation\\n                <rfc2119>must not</rfc2119> be less than 1000 (one thousand) and any lower bound must\\n             not be greater than 1. Numbers that fall outside this range <rfc2119>must</rfc2119> be\\n             formatted using the format token <code>1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The above expansions of numbering sequences for format tokens such as <code>a</code> and\\n                <code>i</code> are indicative but not prescriptive. There are various conventions in\\n             use for how alphabetic sequences continue when the alphabet is exhausted, and differing\\n             conventions for how roman numerals are written (for example, <code>IV</code> versus\\n                <code>IIII</code> as the representation of the number 4). Sometimes alphabetic\\n             sequences are used that omit letters such as <code>i</code> and <code>o</code>. This\\n             specification does not prescribe the detail of any sequence other than those sequences\\n             consisting entirely of decimal digits.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Many numbering sequences are language-sensitive. This applies especially to the sequence\\n             selected by the tokens <code>w</code>, <code>W</code> and <code>Ww</code>. It also\\n             applies to other sequences, for example different languages using the Cyrillic alphabet\\n             use different sequences of characters, each starting with the letter #x410 (Cyrillic\\n             capital letter A). In such cases, the <code>$lang</code> argument specifies which\\n             language\\'s conventions are to be used. <phrase diff=\"chg\" at=\"L\">If the argument\\n             is specified, the value <rfc2119>should</rfc2119> be either an empty sequence\\n             or a value that would be valid for the <code>xml:lang</code> attribute (see <bibref ref=\"REC-xml\"/>).\\n             Note that this permits the identification of sublanguages based on country codes (from ISO 3166-1)\\n             as well as identification of dialects and regions within a country.</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The set of languages\\n             for which numbering is supported is <termref def=\"implementation-defined\"/>.\\n             If the <code>$lang</code> argument is absent,\\n             or is set to an empty sequence, or is invalid, or is not a language supported by the\\n             implementation, then the number is formatted using <phrase diff=\"chg\" at=\"K\">the\\n             default language from the dynamic context</phrase>.\\n             </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The format modifier <phrase diff=\"chg\" at=\"L\"><rfc2119>must</rfc2119>\\n             be a string that matches the regular expression <code diff=\"chg\" at=\"M\">^([co](\\\\(.+\\\\))?)?[at]?$</code>. </phrase>\\n             That is, if it is present it must consist of one <phrase diff=\"add\" at=\"G\">or more</phrase> of\\n             the following, in <phrase diff=\"del\" at=\"K\">any</phrase> order:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p diff=\"chg\" at=\"G\">either <code>c</code> or <code>o</code>, optionally followed by\\n                   a sequence of characters enclosed between parentheses, to indicate cardinal or\\n                   ordinal numbering respectively, the default being cardinal numbering</p></item><item><p diff=\"chg\" at=\"G\">either <code>a</code> or <code>t</code>, to indicate alphabetic\\n                   or traditional numbering respectively, the default being <termref def=\"implementation-defined\">implementation-defined</termref>.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the <code>o</code> modifier is present, this indicates a request to output ordinal\\n             numbers rather than cardinal numbers. For example, in English, when used with the format\\n             token <code>1</code>, this outputs the sequence <code>1st 2nd 3rd 4th ...</code>, and\\n             when used with the format token <code>w</code> outputs the sequence <code>first second\\n             third fourth ...</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The string of characters between the parentheses, if present, is used to\\n          select between other possible variations of cardinal or ordinal numbering sequences.\\n          The interpretation of this string is <termref def=\"implemementation-defined\">implementation-defined</termref>. No error occurs\\n          if the implementation does not define any interpretation for the defined string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For example, in some languages, ordinal numbers vary depending on the grammatical context:\\n             they may have different genders and may decline with the noun that they qualify.\\n             In such cases the string appearing in parentheses after the letter <code>o</code> may be\\n             used to indicate the variation of the ordinal number required. The way in which the\\n             variation is indicated will depend on the conventions of the language. For inflected\\n             languages that vary the ending of the word, the <rfc2119>recommended</rfc2119> approach is to indicate the\\n             required ending, preceded by a hyphen: for example in German, appropriate values are\\n                <code>o(-e)</code>, <code>o(-er)</code>, <code>o(-es)</code>, <code>o(-en)</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">It is <termref def=\"implementation-defined\">implementation-defined</termref> what\\n             combinations of values of the format token, the language, and the cardinal/ordinal\\n             modifier are supported. If ordinal numbering is not supported for the combination of the\\n             format token, the language, and the string appearing in parentheses, the request is\\n             ignored and cardinal numbers are generated instead.</p><example xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><head>Ordinal Numbering in Italian</head><p>The specification <code>\"1;o(-º)\"</code> with <code>$lang</code> equal to\\n                   <code>it</code>, if supported, should produce the sequence:</p><eg xml:space=\"preserve\">1º 2º 3º 4º ...</eg><p>The specification <code>\"Ww;o\"</code> with <code>$lang</code> equal to\\n                   <code>it</code>, if supported, should produce the sequence:</p><eg xml:space=\"preserve\">Primo Secondo Terzo Quarto Quinto ...</eg></example><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <phrase diff=\"chg\" at=\"G\">use of the <code>a</code> or <code>t</code>\\n                modifier</phrase> disambiguates between numbering sequences that use letters. In many\\n             languages there are two commonly used numbering sequences that use letters. One\\n             numbering sequence assigns numeric values to letters in alphabetic sequence, and the\\n             other assigns numeric values to each letter in some other manner traditional in that\\n             language. In English, these would correspond to the numbering sequences specified by the\\n             format tokens <code>a</code> and <code>i</code>. In some languages, the first member of\\n             each sequence is the same, and so the format token alone would be ambiguous. <phrase diff=\"chg\" at=\"G\">In the absence of the <code>a</code> or <code>t</code> modifier,\\n                the default is <termref def=\"implementation-defined\">implementation-defined</termref></phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DF\" code=\"1310\"/> if the format token is invalid,\\n             that is, if it violates any mandatory rules (indicated by an emphasized <rfc2119>must</rfc2119>\\n             or <rfc2119>required</rfc2119> keyword in the above rules). For example, the error is raised if\\n             the primary format token contains a digit but does not match the required regular expression.</p></div>\\n',summary:\"<p>  Formats an integer according to a given picture string, using the conventions\\n             of a given natural language if specified.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:integer\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"language\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"format-number\",qname:\"fn:format-number\",signature:\"($value as numeric?, $picture as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing a number formatted according to a given picture\\n             string, taking account of decimal formats specified in the static context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-number\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"numeric?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-number\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"numeric?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"decimal-format-name\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdecimal formats, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"K\">The effect of the two-argument form of the function is equivalent to calling\\n          the three-argument form with an empty sequence as the value of the third argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function formats <code>$value</code> as a string using the <termref def=\"dt-picture-string\">picture string</termref> specified by the\\n                <code>$picture</code> argument and the decimal-format named by the\\n                <code>$decimal-format-name</code> argument, or the default decimal-format, if there\\n             is no <code>$decimal-format-name</code> argument. The syntax of the picture string is\\n             described in <specref ref=\"syntax-of-picture-string\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$value</code> argument may be of any numeric data type\\n             (<code>xs:double</code>, <code>xs:float</code>, <code>xs:decimal</code>, or their\\n             subtypes including <code>xs:integer</code>). Note that if an <code>xs:decimal</code> is\\n             supplied, it is not automatically promoted to an <code>xs:double</code>, as such\\n             promotion can involve a loss of precision.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the supplied value of the <code>$value</code> argument is an empty sequence, the\\n             function behaves as if the supplied value were the <code>xs:double</code> value\\n                <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$decimal-format-name</code>,\\n             <phrase diff=\"add\" at=\"K\">if present and non-empty, </phrase>\\n             <rfc2119>must</rfc2119> <phrase diff=\"chg\" at=\"L\">be a string which after removal of leading and trailing whitespace is in the form of an\\n             an <code>EQName</code> as defined in the XPath 3.0 grammar, that is one of the following</phrase>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>A lexical QName, which is expanded using the\\n                <phrase diff=\"chg\" at=\"J\">statically known namespaces</phrase>.\\n                The default namespace is not used (no prefix means no namespace).</p></item><item><p diff=\"add\" at=\"L\">A <code>URIQualifiedName</code> using the syntax <code>Q{uri}local</code>,\\n             where the URI can be zero-length to indicate a name in no namespace.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"K\">The decimal format that is used is the decimal format\\n          in the static context whose name matches <code>$decimal-format-name</code> if supplied,\\n          or the default decimal format in the static context otherwise.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The evaluation of the <function>format-number</function> function takes place in two\\n             phases, an analysis phase described in <specref ref=\"analysing-picture-string\"/> and a\\n             formatting phase described in <specref ref=\"formatting-the-number\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The analysis phase takes as its inputs the <termref def=\"dt-picture-string\">picture\\n                string</termref> and the variables derived from the relevant decimal format in the\\n             static context, and produces as its output a number of variables with defined values.\\n             The formatting phase takes as its inputs the number to be formatted and the variables\\n             produced by the analysis phase, and produces as its output a string containing a\\n             formatted representation of the number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is the formatted string representation of the supplied\\n             number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DF\" code=\"1280\"/> if the name specified as the\\n                <code>$decimal-format-name</code> argument is\\n             <phrase diff=\"chg\" at=\"L\">neither a valid lexical QName nor a valid <code>URIQualifiedName</code></phrase>, or if it\\n             uses a prefix <phrase diff=\"add\" at=\"J\">that is not found in the statically known namespaces</phrase>, or if the static\\n             context does not contain a declaration of a decimal-format with a matching expanded\\n             QName. If the processor is able to detect the error statically (for example, when the\\n             argument is supplied as a string literal), then the processor <rfc2119>may</rfc2119>\\n             optionally signal this as a static error.</p></div>\\n',summary:\"<p>  Returns a string containing a number formatted according to a given picture\\n             string, taking account of decimal formats specified in the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"numeric\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"format-number\",qname:\"fn:format-number\",signature:\"($value as numeric?, $picture as xs:string, $decimal-format-name as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing a number formatted according to a given picture\\n             string, taking account of decimal formats specified in the static context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-number\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"numeric?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-number\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"numeric?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"decimal-format-name\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdecimal formats, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"K\">The effect of the two-argument form of the function is equivalent to calling\\n          the three-argument form with an empty sequence as the value of the third argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function formats <code>$value</code> as a string using the <termref def=\"dt-picture-string\">picture string</termref> specified by the\\n                <code>$picture</code> argument and the decimal-format named by the\\n                <code>$decimal-format-name</code> argument, or the default decimal-format, if there\\n             is no <code>$decimal-format-name</code> argument. The syntax of the picture string is\\n             described in <specref ref=\"syntax-of-picture-string\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$value</code> argument may be of any numeric data type\\n             (<code>xs:double</code>, <code>xs:float</code>, <code>xs:decimal</code>, or their\\n             subtypes including <code>xs:integer</code>). Note that if an <code>xs:decimal</code> is\\n             supplied, it is not automatically promoted to an <code>xs:double</code>, as such\\n             promotion can involve a loss of precision.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the supplied value of the <code>$value</code> argument is an empty sequence, the\\n             function behaves as if the supplied value were the <code>xs:double</code> value\\n                <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$decimal-format-name</code>,\\n             <phrase diff=\"add\" at=\"K\">if present and non-empty, </phrase>\\n             <rfc2119>must</rfc2119> <phrase diff=\"chg\" at=\"L\">be a string which after removal of leading and trailing whitespace is in the form of an\\n             an <code>EQName</code> as defined in the XPath 3.0 grammar, that is one of the following</phrase>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>A lexical QName, which is expanded using the\\n                <phrase diff=\"chg\" at=\"J\">statically known namespaces</phrase>.\\n                The default namespace is not used (no prefix means no namespace).</p></item><item><p diff=\"add\" at=\"L\">A <code>URIQualifiedName</code> using the syntax <code>Q{uri}local</code>,\\n             where the URI can be zero-length to indicate a name in no namespace.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"K\">The decimal format that is used is the decimal format\\n          in the static context whose name matches <code>$decimal-format-name</code> if supplied,\\n          or the default decimal format in the static context otherwise.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The evaluation of the <function>format-number</function> function takes place in two\\n             phases, an analysis phase described in <specref ref=\"analysing-picture-string\"/> and a\\n             formatting phase described in <specref ref=\"formatting-the-number\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The analysis phase takes as its inputs the <termref def=\"dt-picture-string\">picture\\n                string</termref> and the variables derived from the relevant decimal format in the\\n             static context, and produces as its output a number of variables with defined values.\\n             The formatting phase takes as its inputs the number to be formatted and the variables\\n             produced by the analysis phase, and produces as its output a string containing a\\n             formatted representation of the number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is the formatted string representation of the supplied\\n             number.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DF\" code=\"1280\"/> if the name specified as the\\n                <code>$decimal-format-name</code> argument is\\n             <phrase diff=\"chg\" at=\"L\">neither a valid lexical QName nor a valid <code>URIQualifiedName</code></phrase>, or if it\\n             uses a prefix <phrase diff=\"add\" at=\"J\">that is not found in the statically known namespaces</phrase>, or if the static\\n             context does not contain a declaration of a decimal-format with a matching expanded\\n             QName. If the processor is able to detect the error statically (for example, when the\\n             argument is supplied as a string literal), then the processor <rfc2119>may</rfc2119>\\n             optionally signal this as a static error.</p></div>\\n',summary:\"<p>  Returns a string containing a number formatted according to a given picture\\n             string, taking account of decimal formats specified in the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"numeric\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"decimal-format-name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"format-time\",qname:\"fn:format-time\",signature:\"($value as xs:time?, $picture as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:time</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-time\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:time?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-time\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:time?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:time  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:time\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:5,name:\"format-time\",qname:\"fn:format-time\",signature:\"($value as xs:time?, $picture as xs:string, $language as xs:string?, $calendar as xs:string?, $place as xs:string?) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string containing an <code>xs:time</code> value formatted for display.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"format-time\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:time?\"/><arg name=\"picture\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"format-time\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"xs:time?\"/><arg name=\"picture\" type=\"xs:string\"/><arg name=\"language\" type=\"xs:string?\"/><arg name=\"calendar\" type=\"xs:string?\"/><arg name=\"place\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tdefault calendar, and default language, and default place, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The five-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone, and namespaces.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">See <specref ref=\"rules-for-datetime-formatting\"/>.</p></div>\\n',summary:\"<p>  Returns a string containing an  xs:time  value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:time\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"language\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"calendar\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"place\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"function-arity\",qname:\"fn:function-arity\",signature:\"($func as function (*)) as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the arity of the function identified by a function item.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"function-arity\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"func\" type=\"function(*)\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:function-arity</code> function returns the arity (number of arguments) of\\n             the function identified by <code>$func</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:function-arity(fn:substring#2)</code> returns <code>2</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:function-arity(function($node){name($node)})</code> returns <code>1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>let $initial := fn:substring(?, 1, 1) return fn:function-arity($initial)</code> returns <code>1</code>.</p></div>\\n',summary:\"<p>  Returns the arity of the function identified by a function item.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"func\",type:\"function (*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"generate-id\",qname:\"fn:generate-id\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function returns a string that uniquely identifies a given node. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"generate-id\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"generate-id\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is the empty sequence, the result is the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns a string that uniquely identifies a given node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The returned identifier <rfc2119>must</rfc2119> consist of ASCII alphanumeric characters\\n             and <rfc2119>must</rfc2119> start with an alphabetic character. Thus, the string is\\n             syntactically an XML name.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">An implementation is free to generate an identifier in any convenient way provided that\\n             it always generates the same identifier for the same node and that different identifiers\\n             are always generated from different nodes. An implementation is under no obligation to\\n             generate the same identifiers each time a document is transformed or queried.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  This function returns a string that uniquely identifies a given node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"generate-id\",qname:\"fn:generate-id\",signature:\"($arg as node()?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function returns a string that uniquely identifies a given node. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"generate-id\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"generate-id\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is the empty sequence, the result is the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns a string that uniquely identifies a given node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The returned identifier <rfc2119>must</rfc2119> consist of ASCII alphanumeric characters\\n             and <rfc2119>must</rfc2119> start with an alphabetic character. Thus, the string is\\n             syntactically an XML name.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">An implementation is free to generate an identifier in any convenient way provided that\\n             it always generates the same identifier for the same node and that different identifiers\\n             are always generated from different nodes. An implementation is under no obligation to\\n             generate the same identifiers each time a document is transformed or queried.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  This function returns a string that uniquely identifies a given node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"has-children\",qname:\"fn:has-children\",signature:\"() as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the supplied node has one or more child nodes (of any kind).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"has-children\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"has-children\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"node\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><phrase diff=\"add\" at=\"L\">Provided that the supplied argument <code>$node</code> matches the expected\\n          type <code>node()?</code>, </phrase>the result of the function call <code>fn:has-children($node)</code> is defined to be\\n             the same as the result of the expression\\n             <code>fn:exists($node/child::node())</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns true if the supplied node has one or more child nodes (of any kind).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"has-children\",qname:\"fn:has-children\",signature:\"($node as node()?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the supplied node has one or more child nodes (of any kind).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"has-children\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"has-children\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"node\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><phrase diff=\"add\" at=\"L\">Provided that the supplied argument <code>$node</code> matches the expected\\n          type <code>node()?</code>, </phrase>the result of the function call <code>fn:has-children($node)</code> is defined to be\\n             the same as the result of the expression\\n             <code>fn:exists($node/child::node())</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns true if the supplied node has one or more child nodes (of any kind).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"head\",qname:\"fn:head\",signature:\"($arg as item()*) as item()? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the first item in a sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"head\" return-type=\"item()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of the expression <code>$arg[1]</code></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the empty sequence is returned. Otherwise\\n             the first item in the sequence is returned.</p></div>\\n',summary:\"<p>  Returns the first item in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"hours-from-duration\",qname:\"fn:hours-from-duration\",signature:\"($arg as xs:duration?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of hours in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"hours-from-duration\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the hours\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:dayTimeDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the hours component as described in\\n                <specref ref=\"canonical-dayTimeDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-duration(xs:dayTimeDuration(\"P3DT10H\"))</code> returns <code>10</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-duration(xs:dayTimeDuration(\"P3DT12H32M12S\"))</code> returns <code>12</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-duration(xs:dayTimeDuration(\"PT123H\"))</code> returns <code>3</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-duration(xs:dayTimeDuration(\"-P3DT10H\"))</code> returns <code>-10</code>.</p></div>\\n',summary:\"<p>  Returns the number of hours in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"hours-from-time\",qname:\"fn:hours-from-time\",signature:\"($arg as xs:time?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the hours component of an <code>xs:time</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"hours-from-time\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> between 0 and 23, both\\n             inclusive, representing the value of the hours component in the local value of\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Assume that the dynamic context provides an implicit timezone value of\\n                   <code>-05:00</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-time(xs:time(\"11:23:00\"))</code> returns <code>11</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-time(xs:time(\"21:23:00\"))</code> returns <code>21</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-time(xs:time(\"01:23:00+05:00\"))</code> returns <code>1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-time(fn:adjust-time-to-timezone(xs:time(\"01:23:00+05:00\"),\\n                   xs:dayTimeDuration(\"PT0S\")))</code> returns <code>20</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:hours-from-time(xs:time(\"24:00:00\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the hours component of an  xs:time .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"id\",qname:\"fn:id\",signature:\"($arg as xs:string*) as element(*)* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of element nodes that have an <code>ID</code> value\\n             matching the value of one or more of the <code>IDREF</code> values supplied in\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence, in document order with duplicates eliminated,\\n             containing every element node <code>E</code> that satisfies all the following\\n             conditions:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>\\n                   <code>E</code> is in the target document. The target document is the document\\n                   containing <code>$node</code>, or the document containing the context item\\n                      (<code>.</code>) if the second argument is omitted. The behavior of the\\n                   function if <code>$node</code> is omitted is exactly the same as if the context\\n                   item had been passed as <code>$node</code>.</p></item><item><p><code>E</code> has an <code>ID</code> value equal to one of the candidate\\n                      <code>IDREF</code> values, where:</p><ulist><item><p> An element has an <code>ID</code> value equal to <code>V</code> if either\\n                         or both of the following conditions are true:</p><ulist><item><p>The <code>is-id</code> property (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) of the element node is true, and the typed value\\n                               of the element node is equal to <code>V</code> under the rules of the\\n                                  <code>eq</code> operator using the Unicode codepoint collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item><item><p>The element has an attribute node whose <code>is-id</code> property\\n                               (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and whose typed\\n                               value is equal to <code>V</code> under the rules of the\\n                                  <code>eq</code> operator using the Unicode code point collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p> Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were of\\n                         type <code>IDREFS</code>, that is, each <code>xs:string</code> in\\n                            <code>$arg</code> is treated as a whitespace-separated sequence of\\n                         tokens, each acting as an <code>IDREF</code>. These tokens are then included\\n                         in the list of candidate <code>IDREF</code>s. If any of the tokens is not a\\n                         lexically valid <code>IDREF</code> (that is, if it is not lexically an\\n                            <code>xs:NCName</code>), it is ignored. Formally, the candidate\\n                            <code>IDREF</code> values are the strings in the sequence given by the\\n                         expression:</p><eg xml:space=\"preserve\">for $s in $arg return\\n     fn:tokenize(fn:normalize-space($s), \\' \\')[. castable as xs:IDREF]</eg></item></ulist></item><item><p>If several elements have the same <code>ID</code> value, then <code>E</code> is\\n                   the one that is first in document order.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                <code>$node</code>, or the context item if the second argument is absent, is a node\\n                in a tree whose root is not a document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the sequence of element nodes that have an  ID  value\\n             matching the value of one or more of the  IDREF  values supplied in\\n                 $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"id\",qname:\"fn:id\",signature:\"($arg as xs:string*, $node as node()) as element(*)* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of element nodes that have an <code>ID</code> value\\n             matching the value of one or more of the <code>IDREF</code> values supplied in\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"id\" return-type=\"element()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence, in document order with duplicates eliminated,\\n             containing every element node <code>E</code> that satisfies all the following\\n             conditions:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>\\n                   <code>E</code> is in the target document. The target document is the document\\n                   containing <code>$node</code>, or the document containing the context item\\n                      (<code>.</code>) if the second argument is omitted. The behavior of the\\n                   function if <code>$node</code> is omitted is exactly the same as if the context\\n                   item had been passed as <code>$node</code>.</p></item><item><p><code>E</code> has an <code>ID</code> value equal to one of the candidate\\n                      <code>IDREF</code> values, where:</p><ulist><item><p> An element has an <code>ID</code> value equal to <code>V</code> if either\\n                         or both of the following conditions are true:</p><ulist><item><p>The <code>is-id</code> property (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) of the element node is true, and the typed value\\n                               of the element node is equal to <code>V</code> under the rules of the\\n                                  <code>eq</code> operator using the Unicode codepoint collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item><item><p>The element has an attribute node whose <code>is-id</code> property\\n                               (See <xspecref spec=\"DM30\" ref=\"dm-is-id\"/>.) is true and whose typed\\n                               value is equal to <code>V</code> under the rules of the\\n                                  <code>eq</code> operator using the Unicode code point collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p> Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were of\\n                         type <code>IDREFS</code>, that is, each <code>xs:string</code> in\\n                            <code>$arg</code> is treated as a whitespace-separated sequence of\\n                         tokens, each acting as an <code>IDREF</code>. These tokens are then included\\n                         in the list of candidate <code>IDREF</code>s. If any of the tokens is not a\\n                         lexically valid <code>IDREF</code> (that is, if it is not lexically an\\n                            <code>xs:NCName</code>), it is ignored. Formally, the candidate\\n                            <code>IDREF</code> values are the strings in the sequence given by the\\n                         expression:</p><eg xml:space=\"preserve\">for $s in $arg return\\n     fn:tokenize(fn:normalize-space($s), \\' \\')[. castable as xs:IDREF]</eg></item></ulist></item><item><p>If several elements have the same <code>ID</code> value, then <code>E</code> is\\n                   the one that is first in document order.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                <code>$node</code>, or the context item if the second argument is absent, is a node\\n                in a tree whose root is not a document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the sequence of element nodes that have an  ID  value\\n             matching the value of one or more of the  IDREF  values supplied in\\n                 $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"node\",type:\"node()\",occurrence:null,description:\"\"}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"idref\",qname:\"fn:idref\",signature:\"($arg as xs:string*) as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of element or attribute nodes with an <code>IDREF</code>\\n             value matching the value of one or more of the <code>ID</code> values supplied in\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"idref\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"idref\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The function returns a sequence, in document order with duplicates eliminated,\\n             containing every element or attribute node <code>$N</code> that satisfies all the\\n             following conditions:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p><code>$N</code> is in the target document. The target document is the document\\n                   containing <code>$node</code> or the document containing the context item\\n                      (<code>.</code>) if the second argument is omitted. The behavior of the\\n                   function if <code>$node</code> is omitted is exactly the same as if the context\\n                   item had been passed as <code>$node</code>.</p></item><item><p><code>$N</code> has an <code>IDREF</code> value equal to one of the candidate\\n                      <code>ID</code> values, where:</p><ulist><item><p>A node <code>$N</code> has an <code>IDREF</code> value equal to\\n                            <code>V</code> if both of the following conditions are true:</p><ulist><item><p>The <code>is-idrefs</code> property (see <xspecref spec=\"DM30\" ref=\"dm-is-idrefs\"/>) of <code>$N</code> is <code>true</code>.</p></item><item><p>The sequence <!--Text replaced by erratum E29 change 1\"--><eg diff=\"chg\" at=\"A-E29\" xml:space=\"preserve\">fn:tokenize(fn:normalize-space(fn:string($N)), \\' \\')</eg>\\n                               <!--End of text replaced by erratum E29--> contains a string that is\\n                               equal to <code>V</code> under the rules of the <code>eq</code>\\n                               operator using the Unicode code point collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were of\\n                         lexically of type <code>xs:ID</code>. These <code>xs:string</code>s are then\\n                         included in the list of candidate <code>xs:ID</code>s. If any of the strings\\n                         in <code>$arg</code> is not a lexically valid <code>xs:ID</code> (that is,\\n                         if it is not lexically an <code>xs:NCName</code>), it is ignored. More\\n                         formally, the candidate <code>ID</code> values are the strings in the\\n                         sequence:</p><eg xml:space=\"preserve\">$arg[. castable as xs:NCName]</eg></item></ulist></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                <code>$node</code>, or the context item if the second argument is omitted, is a node\\n                in a tree whose root is not a document node. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the sequence of element or attribute nodes with an  IDREF \\n             value matching the value of one or more of the  ID  values supplied in\\n                 $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"idref\",qname:\"fn:idref\",signature:\"($arg as xs:string*, $node as node()) as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of element or attribute nodes with an <code>IDREF</code>\\n             value matching the value of one or more of the <code>ID</code> values supplied in\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"idref\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"idref\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string*\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The function returns a sequence, in document order with duplicates eliminated,\\n             containing every element or attribute node <code>$N</code> that satisfies all the\\n             following conditions:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p><code>$N</code> is in the target document. The target document is the document\\n                   containing <code>$node</code> or the document containing the context item\\n                      (<code>.</code>) if the second argument is omitted. The behavior of the\\n                   function if <code>$node</code> is omitted is exactly the same as if the context\\n                   item had been passed as <code>$node</code>.</p></item><item><p><code>$N</code> has an <code>IDREF</code> value equal to one of the candidate\\n                      <code>ID</code> values, where:</p><ulist><item><p>A node <code>$N</code> has an <code>IDREF</code> value equal to\\n                            <code>V</code> if both of the following conditions are true:</p><ulist><item><p>The <code>is-idrefs</code> property (see <xspecref spec=\"DM30\" ref=\"dm-is-idrefs\"/>) of <code>$N</code> is <code>true</code>.</p></item><item><p>The sequence <!--Text replaced by erratum E29 change 1\"--><eg diff=\"chg\" at=\"A-E29\" xml:space=\"preserve\">fn:tokenize(fn:normalize-space(fn:string($N)), \\' \\')</eg>\\n                               <!--End of text replaced by erratum E29--> contains a string that is\\n                               equal to <code>V</code> under the rules of the <code>eq</code>\\n                               operator using the Unicode code point collation\\n                                  (<code>http://www.w3.org/2005/xpath-functions/collation/codepoint</code>).</p></item></ulist></item><item><p>Each <code>xs:string</code> in <code>$arg</code> is parsed as if it were of\\n                         lexically of type <code>xs:ID</code>. These <code>xs:string</code>s are then\\n                         included in the list of candidate <code>xs:ID</code>s. If any of the strings\\n                         in <code>$arg</code> is not a lexically valid <code>xs:ID</code> (that is,\\n                         if it is not lexically an <code>xs:NCName</code>), it is ignored. More\\n                         formally, the candidate <code>ID</code> values are the strings in the\\n                         sequence:</p><eg xml:space=\"preserve\">$arg[. castable as xs:NCName]</eg></item></ulist></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0001\" type=\"dynamic\"/> if\\n                <code>$node</code>, or the context item if the second argument is omitted, is a node\\n                in a tree whose root is not a document node. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$node</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the sequence of element or attribute nodes with an  IDREF \\n             value matching the value of one or more of the  ID  values supplied in\\n                 $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"node\",type:\"node()\",occurrence:null,description:\"\"}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"implicit-timezone\",qname:\"fn:implicit-timezone\",signature:\"() as xs:dayTimeDuration external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of the implicit timezone property from the dynamic context.\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"implicit-timezone\" return-type=\"xs:dayTimeDuration\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\timplicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of the implicit timezone property from the dynamic context. Components\\n             of the dynamic context are discussed in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p></div>\\n',summary:\"<p>  Returns the value of the implicit timezone property from the dynamic context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:dayTimeDuration\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"in-scope-prefixes\",qname:\"fn:in-scope-prefixes\",signature:\"($element as element(*)) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the prefixes of the in-scope namespaces for an element node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"in-scope-prefixes\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"element\" type=\"element()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of strings representing the prefixes of the in-scope\\n             namespaces for <code>$element</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For namespace bindings that have a prefix, the function returns the prefix as an\\n                <code>xs:NCName</code>. For the default namespace, which has no prefix, it returns\\n             the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result sequence contains no duplicates.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The ordering of the result sequence is <termref def=\"implementation-dependent\">implementation-dependent</termref>.</p></div>\\n',summary:\"<p>  Returns the prefixes of the in-scope namespaces for an element node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of\",qname:\"fn:index-of\",signature:\"($seq as xs:anyAtomicType*, $search as xs:anyAtomicType) as xs:integer* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of positive integers giving the positions within the\\n             sequence <code>$seq</code> of items that are equal to <code>$search</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"index-of\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"xs:anyAtomicType*\"/><arg name=\"search\" type=\"xs:anyAtomicType\"/></proto></example><example role=\"signature\"><proto name=\"index-of\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"xs:anyAtomicType*\"/><arg name=\"search\" type=\"xs:anyAtomicType\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of positive integers giving the positions within the\\n             sequence <code>$seq</code> of items that are equal to <code>$search</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. This collation is used when string comparison is\\n             required.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the sequence <code>$seq</code> are compared with <code>$search</code> under\\n             the rules for the <code>eq</code> operator. Values of type <code>xs:untypedAtomic</code>\\n             are compared as if they were of type <code>xs:string</code>. Values that cannot be\\n             compared, because the <code>eq</code> operator is not defined for their types, are\\n             considered to be distinct. If an item compares equal, then the position of that item in\\n             the sequence <code>$seq</code> is included in the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first item in a sequence is at position 1, not position 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result sequence is in ascending numeric order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$seq</code> is the empty sequence, or if no item in\\n                <code>$seq</code> matches <code>$search</code>, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">No error occurs if non-comparable values are encountered. So when\\n             comparing two atomic values, the effective boolean value of <code>fn:index-of($a,\\n                $b)</code> is true if <code>$a</code> and <code>$b</code> are equal, false if they\\n             are not equal or not comparable.</p></div>\\n',summary:\"<p>  Returns a sequence of positive integers giving the positions within the\\n             sequence  $seq  of items that are equal to  $search .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"search\",type:\"xs:anyAtomicType\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"index-of\",qname:\"fn:index-of\",signature:\"($seq as xs:anyAtomicType*, $search as xs:anyAtomicType, $collation as xs:string) as xs:integer* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of positive integers giving the positions within the\\n             sequence <code>$seq</code> of items that are equal to <code>$search</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"index-of\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"xs:anyAtomicType*\"/><arg name=\"search\" type=\"xs:anyAtomicType\"/></proto></example><example role=\"signature\"><proto name=\"index-of\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"seq\" type=\"xs:anyAtomicType*\"/><arg name=\"search\" type=\"xs:anyAtomicType\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of positive integers giving the positions within the\\n             sequence <code>$seq</code> of items that are equal to <code>$search</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>. This collation is used when string comparison is\\n             required.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the sequence <code>$seq</code> are compared with <code>$search</code> under\\n             the rules for the <code>eq</code> operator. Values of type <code>xs:untypedAtomic</code>\\n             are compared as if they were of type <code>xs:string</code>. Values that cannot be\\n             compared, because the <code>eq</code> operator is not defined for their types, are\\n             considered to be distinct. If an item compares equal, then the position of that item in\\n             the sequence <code>$seq</code> is included in the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first item in a sequence is at position 1, not position 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result sequence is in ascending numeric order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$seq</code> is the empty sequence, or if no item in\\n                <code>$seq</code> matches <code>$search</code>, then the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">No error occurs if non-comparable values are encountered. So when\\n             comparing two atomic values, the effective boolean value of <code>fn:index-of($a,\\n                $b)</code> is true if <code>$a</code> and <code>$b</code> are equal, false if they\\n             are not equal or not comparable.</p></div>\\n',summary:\"<p>  Returns a sequence of positive integers giving the positions within the\\n             sequence  $seq  of items that are equal to  $search .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"search\",type:\"xs:anyAtomicType\",occurrence:null,description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"innermost\",qname:\"fn:innermost\",signature:\"($nodes as node()*) as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns every node within the input sequence that is not an ancestor of another member\\n             of the input sequence; the nodes are returned in document order with duplicates\\n             eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"innermost\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"nodes\" type=\"node()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function call <code>fn:innermost($nodes)</code> is defined to be\\n             equivalent to the result of the expression <code>$nodes except\\n                $nodes/ancestor::node()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">That is, the function takes as input a sequence of nodes, and returns every node within\\n             the sequence that is not an ancestor of another node within the sequence; the nodes are\\n             returned in document order with duplicates eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the source document contains nested sections represented by <code>div</code>\\n                elements, the expression <code>innermost(//div)</code> returns those <code>div</code>\\n                elements that do not contain further <code>div</code> elements.</p></div>\\n',summary:\"<p>  Returns every node within the input sequence that is not an ancestor of another member\\n             of the input sequence; the nodes are returned in document order with duplicates\\n             eliminated.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:\"\"}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"insert-before\",qname:\"fn:insert-before\",signature:\"($target as item()*, $position as xs:integer, $inserts as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence constructed by inserting an item or a sequence of items at a\\n             given position within an existing sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"insert-before\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"target\" type=\"item()*\"/><arg name=\"position\" type=\"xs:integer\"/><arg name=\"inserts\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value returned by the function consists of all items of <code>$target</code> whose\\n             index is less than <code>$position</code>, followed by all items of\\n                <code>$inserts</code>, followed by the remaining elements of <code>$target</code>, in\\n             that order. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$target</code> is the empty sequence, <code>$inserts</code> is returned. If\\n                <code>$inserts</code> is the empty sequence, <code>$target</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$position</code> is less than one (1), the first position, the effective value\\n             of <code>$position</code> is one (1). If <code>$position</code> is greater than the\\n             number of items in <code>$target</code>, then the effective value of\\n                <code>$position</code> is equal to the number of items in <code>$target</code> plus\\n             1. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$target</code> is not affected by the sequence construction.</p></div>\\n',summary:\"<p>  Returns a sequence constructed by inserting an item or a sequence of items at a\\n             given position within an existing sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"target\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"position\",type:\"xs:integer\",occurrence:null,description:\"\"},{name:\"inserts\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"iri-to-uri\",qname:\"fn:iri-to-uri\",signature:\"($iri as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Converts a string containing an IRI into a URI according to the rules of\\n                <bibref ref=\"rfc3987\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"iri-to-uri\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"iri\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$iri</code> is the empty sequence, the function returns the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function converts the value of <code>$iri</code> into a URI according to\\n             the rules given in Section 3.1 of <bibref ref=\"rfc3987\"/> by percent-encoding characters\\n             that are allowed in an IRI but not in a URI. If <code>$iri</code> contains a character\\n             that is invalid in an IRI, such as the space character (see note below), the invalid\\n             character is replaced by its percent-encoded form as described in <bibref ref=\"rfc3986\"/> before the conversion is performed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Since <bibref ref=\"rfc3986\"/> recommends that, for consistency, URI producers and\\n             normalizers should use uppercase hexadecimal digits for all percent-encodings, this\\n             function must always generate hexadecimal values using the upper-case letters A-F.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is idempotent but not invertible. Both the inputs <code>My Documents</code>\\n             and <code>My%20Documents</code> will be converted to the output\\n                <code>My%20Documents</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function does not check whether <code>$iri</code> is a valid IRI. It treats it as\\n             an <termref def=\"string\">string</termref> and operates on the <termref def=\"character\">characters</termref> in the string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The following printable ASCII characters are invalid in an IRI: \"&lt;\", \"&gt;\", <quote>\\n                \" </quote> (double quote), space, \"{\", \"}\", \"|\", \"\\\\\", \"^\", and \"`\". Since these\\n             characters should not appear in an IRI, if they do appear in <code>$iri</code> they will\\n             be percent-encoded. In addition, characters outside the range x20-<phrase diff=\"chg\" at=\"A-E8\">x7E</phrase> will be percent-encoded because they are invalid in a URI. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> Since this function does not escape the PERCENT SIGN \"%\" and this character is not\\n             allowed in data within a URI, users wishing to convert character strings (such as file\\n             names) that include \"%\" to a URI should manually escape \"%\" by replacing it with \"%25\".\\n          </p></div>\\n',summary:\"<p>  Converts a string containing an IRI into a URI according to the rules of\\n                  .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"iri\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"lang\",qname:\"fn:lang\",signature:\"($testlang as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function tests whether the language of <code>$node</code>, or the context\\n             item if the second argument is omitted, as specified by <code>xml:lang</code> attributes\\n             is the same as, or is a sublanguage of, the language specified by\\n             <code>$testlang</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"lang\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"testlang\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"lang\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"testlang\" type=\"xs:string?\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The behavior of the function if the second argument is omitted is exactly the same as if\\n             the context item (<code>.</code>) had been passed as the second argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The language of the argument <code>$node</code>, or the context item if the second\\n             argument is omitted, is determined by the value of the <code>xml:lang</code> attribute\\n             on the node, or, if the node has no such attribute, by the value of the\\n                <code>xml:lang</code> attribute on the nearest ancestor of the node that has an\\n                <code>xml:lang</code> attribute. If there is no such ancestor, then the function\\n             returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$testlang</code> is the empty sequence it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The relevant <code>xml:lang</code> attribute is determined by the value of the XPath\\n             expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">(ancestor-or-self::*/@xml:lang)[last()]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If this expression returns an empty sequence, the function returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns <code>true</code> if and only if, based on a caseless\\n             default match as specified in section 3.13 of <bibref ref=\"Unicode\"/>, either:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p diff=\"chg\" at=\"A-E16\">\\n                   <code>$testlang</code> is equal to the string-value of the relevant\\n                      <code>xml:lang</code> attribute, or</p></item><item><p diff=\"chg\" at=\"A-E16\">\\n                   <code>$testlang</code> is equal to some substring of the string-value of the\\n                   relevant <code>xml:lang</code> attribute that starts at the start of the\\n                   string-value and ends immediately before a hyphen, \"-\" (the character \"-\" is\\n                   HYPHEN-MINUS, #x002D).</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  This function tests whether the language of  $node , or the context\\n             item if the second argument is omitted, as specified by  xml:lang  attributes\\n             is the same as, or is a sublanguage of, the language specified by\\n              $testlang .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"testlang\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"lang\",qname:\"fn:lang\",signature:\"($testlang as xs:string?, $node as node()) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function tests whether the language of <code>$node</code>, or the context\\n             item if the second argument is omitted, as specified by <code>xml:lang</code> attributes\\n             is the same as, or is a sublanguage of, the language specified by\\n             <code>$testlang</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"lang\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"testlang\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"lang\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"testlang\" type=\"xs:string?\"/><arg name=\"node\" type=\"node()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The behavior of the function if the second argument is omitted is exactly the same as if\\n             the context item (<code>.</code>) had been passed as the second argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The language of the argument <code>$node</code>, or the context item if the second\\n             argument is omitted, is determined by the value of the <code>xml:lang</code> attribute\\n             on the node, or, if the node has no such attribute, by the value of the\\n                <code>xml:lang</code> attribute on the nearest ancestor of the node that has an\\n                <code>xml:lang</code> attribute. If there is no such ancestor, then the function\\n             returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$testlang</code> is the empty sequence it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The relevant <code>xml:lang</code> attribute is determined by the value of the XPath\\n             expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">(ancestor-or-self::*/@xml:lang)[last()]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If this expression returns an empty sequence, the function returns <code>false</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns <code>true</code> if and only if, based on a caseless\\n             default match as specified in section 3.13 of <bibref ref=\"Unicode\"/>, either:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p diff=\"chg\" at=\"A-E16\">\\n                   <code>$testlang</code> is equal to the string-value of the relevant\\n                      <code>xml:lang</code> attribute, or</p></item><item><p diff=\"chg\" at=\"A-E16\">\\n                   <code>$testlang</code> is equal to some substring of the string-value of the\\n                   relevant <code>xml:lang</code> attribute that starts at the start of the\\n                   string-value and ends immediately before a hyphen, \"-\" (the character \"-\" is\\n                   HYPHEN-MINUS, #x002D).</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  This function tests whether the language of  $node , or the context\\n             item if the second argument is omitted, as specified by  xml:lang  attributes\\n             is the same as, or is a sublanguage of, the language specified by\\n              $testlang .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"testlang\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"node\",type:\"node()\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"last\",qname:\"fn:last\",signature:\"() as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the context size from the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"last\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the context size from the dynamic context. (See <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.)</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"type\"/> if the\\n             context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p></div>\\n',summary:\"<p>  Returns the context size from the dynamic context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"local-name-from-QName\",qname:\"fn:local-name-from-QName\",signature:\"($arg as xs:QName?) as xs:NCName? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the local part of the supplied QName.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"local-name-from-QName\" return-type=\"xs:NCName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:QName?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:NCName</code> representing the local part of\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:local-name-from-QName(fn:QName(\"http://www.example.com/example\",\\n                   \"person\"))</code> returns <code>\"person\"</code>.</p></div>\\n',summary:\"<p>  Returns the local part of the supplied QName.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:QName\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:NCName?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"local-name\",qname:\"fn:local-name\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the local part of the name of <code>$arg</code> as an\\n                <code>xs:string</code> that is either the zero-length string, or has the lexical form\\n             of an <code>xs:NCName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"local-name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"local-name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is supplied and is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> has no name (that is, if it is a document\\n             node, a comment, a text node, or a namespace node having no name), the function returns\\n             the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the local part of the expanded-QName of the node\\n             identified by <code>$arg</code>, as determined by the <code>dm:node-name</code> accessor\\n             defined in <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>). This will be an\\n                <code>xs:string</code> whose lexical form is an <code>xs:NCName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the local part of the name of  $arg  as an\\n                 xs:string  that is either the zero-length string, or has the lexical form\\n             of an  xs:NCName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"local-name\",qname:\"fn:local-name\",signature:\"($arg as node()?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the local part of the name of <code>$arg</code> as an\\n                <code>xs:string</code> that is either the zero-length string, or has the lexical form\\n             of an <code>xs:NCName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"local-name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"local-name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is supplied and is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> has no name (that is, if it is a document\\n             node, a comment, a text node, or a namespace node having no name), the function returns\\n             the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the local part of the expanded-QName of the node\\n             identified by <code>$arg</code>, as determined by the <code>dm:node-name</code> accessor\\n             defined in <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>). This will be an\\n                <code>xs:string</code> whose lexical form is an <code>xs:NCName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the local part of the name of  $arg  as an\\n                 xs:string  that is either the zero-length string, or has the lexical form\\n             of an  xs:NCName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"lower-case\",qname:\"fn:lower-case\",signature:\"($arg as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Converts a string to lower case.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"lower-case\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the zero-length string is\\n             returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of <code>$arg</code> after translating every\\n                <termref def=\"character\">character</termref> to its lower-case correspondent as\\n             defined in the appropriate case mappings section in the Unicode standard <bibref ref=\"Unicode\"/>. For versions of Unicode beginning with the 2.1.8 update, only\\n             locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and\\n             likely future versions) of Unicode, precise mappings are described in default case\\n             operations, which are full case mappings in the absence of tailoring for particular\\n             languages and environments. Every upper-case character that does not have a lower-case\\n             correspondent, as well as every lower-case character, is included in the returned value\\n             in its original form. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Case mappings may change the length of a string. In general, the\\n                <code>fn:upper-case</code> and <code>fn:lower-case</code> functions are not inverses\\n             of each other: <code>fn:lower-case(fn:upper-case($arg))</code> is not guaranteed to\\n             return <code>$arg</code>, nor is <code>fn:upper-case(fn:lower-case($arg))</code>. The\\n             Latin small letter dotless i (as used in Turkish) is perhaps the most prominent\\n             lower-case letter which will not round-trip. The Latin capital letter i with dot above\\n             is the most prominent upper-case letter which will not round trip; there are others,\\n             such as Latin capital letter Sharp S (#1E9E) which is introduced in Unicode 5.1.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> These functions may not always be linguistically appropriate (e.g. Turkish i without\\n             dot) or appropriate for the application (e.g. titlecase). In cases such as Turkish, a\\n             simple translation should be used first.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> Because the function is not sensitive to locale, results will not always match user\\n             expectations. In Quebec, for example, the standard uppercase equivalent of \"è\" is \"È\",\\n             while in metropolitan France it is more commonly \"E\"; only one of these is supported by\\n             the functions as defined.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> Many characters of class Ll lack uppercase equivalents in the Unicode case mapping\\n             tables; many characters of class Lu lack lowercase equivalents.</p></div>\\n',summary:\"<p>  Converts a string to lower case.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"matches\",qname:\"fn:matches\",signature:\"($input as xs:string?, $pattern as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the supplied string matches a given regular expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"matches\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"matches\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns <code>true</code> if <code>$input</code> or some substring of\\n                <code>$input</code> matches the regular expression supplied as <code>$pattern</code>.\\n             Otherwise, the function returns <code>false</code>. The matching rules are influenced by\\n             the value of <code>$flags</code> if present. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in <specref ref=\"flags\"/>. </p></div>\\n',summary:\"<p>  Returns true if the supplied string matches a given regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"matches\",qname:\"fn:matches\",signature:\"($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the supplied string matches a given regular expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"matches\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"matches\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns <code>true</code> if <code>$input</code> or some substring of\\n                <code>$input</code> matches the regular expression supplied as <code>$pattern</code>.\\n             Otherwise, the function returns <code>false</code>. The matching rules are influenced by\\n             the value of <code>$flags</code> if present. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in <specref ref=\"flags\"/>. </p></div>\\n',summary:\"<p>  Returns true if the supplied string matches a given regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"flags\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max\",qname:\"fn:max\",signature:\"($arg as xs:anyAtomicType*) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value that is equal to the highest value appearing in the input\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"max\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"max\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following rules are applied to the input sequence <code>$arg</code>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                      <code>xs:double</code>.</p></item><item><!--Text replaced by erratum E27 change 1\"--><p diff=\"chg\" at=\"A-E27\">Numeric and <code>xs:anyURI</code> values are converted to\\n                   the least common type reachable by a combination of type promotion and subtype\\n                   substitution. See <xspecref spec=\"XP30\" ref=\"promotion\"/> and <xspecref spec=\"XP30\" ref=\"mapping\"/>.</p><!--End of text replaced by erratum E27--></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the resulting sequence may be reordered in an arbitrary order. The\\n             resulting sequence is referred to below as the converted sequence. The function returns\\n             an item from the converted sequence rather than the input sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence must be\\n                derived</phrase> from a single base type for which the <code>le</code> operator is\\n             defined. In addition, the values in the sequence must have a total order. If date/time\\n             values do not have a timezone, they are considered to have the implicit timezone\\n             provided by the dynamic context for the purpose of comparison. Duration values must\\n             either all be <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, the value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> are of\\n             type <code>xs:string</code> or types derived by restriction from <code>xs:string</code>,\\n             then the determination of the item with the smallest value is made according to the\\n             collation that is used. If the type of the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> is not <code>xs:string</code> and\\n                <code>$collation</code> is specified, the collation is ignored.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the result of the expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n    if (every $v in $c satisfies $c[1] ge $v)\\n    then $c[1]\\n    else fn:max(fn:subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">evaluated with <code>$collation</code> as the default collation if specified, and with\\n                <code>$c</code> as the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value that is equal to the highest value appearing in the input\\n             sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"max\",qname:\"fn:max\",signature:\"($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value that is equal to the highest value appearing in the input\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"max\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"max\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following rules are applied to the input sequence <code>$arg</code>:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                      <code>xs:double</code>.</p></item><item><!--Text replaced by erratum E27 change 1\"--><p diff=\"chg\" at=\"A-E27\">Numeric and <code>xs:anyURI</code> values are converted to\\n                   the least common type reachable by a combination of type promotion and subtype\\n                   substitution. See <xspecref spec=\"XP30\" ref=\"promotion\"/> and <xspecref spec=\"XP30\" ref=\"mapping\"/>.</p><!--End of text replaced by erratum E27--></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the resulting sequence may be reordered in an arbitrary order. The\\n             resulting sequence is referred to below as the converted sequence. The function returns\\n             an item from the converted sequence rather than the input sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence must be\\n                derived</phrase> from a single base type for which the <code>le</code> operator is\\n             defined. In addition, the values in the sequence must have a total order. If date/time\\n             values do not have a timezone, they are considered to have the implicit timezone\\n             provided by the dynamic context for the purpose of comparison. Duration values must\\n             either all be <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, the value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> are of\\n             type <code>xs:string</code> or types derived by restriction from <code>xs:string</code>,\\n             then the determination of the item with the smallest value is made according to the\\n             collation that is used. If the type of the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> is not <code>xs:string</code> and\\n                <code>$collation</code> is specified, the collation is ignored.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the result of the expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n    if (every $v in $c satisfies $c[1] ge $v)\\n    then $c[1]\\n    else fn:max(fn:subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">evaluated with <code>$collation</code> as the default collation if specified, and with\\n                <code>$c</code> as the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value that is equal to the highest value appearing in the input\\n             sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"min\",qname:\"fn:min\",signature:\"($arg as xs:anyAtomicType*) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value that is equal to the lowest value appearing in the input\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"min\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"min\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following rules are applied to the input sequence:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                      <code>xs:double</code>.</p></item><item><!--Text replaced by erratum E27 change 2\"--><p diff=\"chg\" at=\"A-E27\">Numeric and <code>xs:anyURI</code> values are converted to\\n                   the least common type reachable by a combination of type promotion and subtype\\n                   substitution. See <xspecref spec=\"XP30\" ref=\"promotion\"/> and <xspecref spec=\"XP30\" ref=\"mapping\"/>.</p><!--End of text replaced by erratum E27--></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the resulting sequence may be reordered in an arbitrary order. The\\n             resulting sequence is referred to below as the converted sequence. The function returns\\n             an item from the converted sequence rather than the input sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence must be\\n                derived</phrase> from a single base type for which the <code>le</code> operator is\\n             defined. In addition, the values in the sequence must have a total order. If date/time\\n             values do not have a timezone, they are considered to have the implicit timezone\\n             provided by the dynamic context for the purpose of comparison. Duration values must\\n             either all be <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, the value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> are of\\n             type <code>xs:string</code> or types derived by restriction from <code>xs:string</code>,\\n             then the determination of the item with the smallest value is made according to the\\n             collation that is used. If the type of the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> is not <code>xs:string</code> and\\n                <code>$collation</code> is specified, the collation is ignored.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the result of the expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n    if (every $v in $c satisfies $c[1] le $v)\\n    then $c[1]\\n    else fn:min(fn:subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">evaluated with <code>$collation</code> as the default collation if specified, and with\\n                <code>$c</code> as the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value that is equal to the lowest value appearing in the input\\n             sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"min\",qname:\"fn:min\",signature:\"($arg as xs:anyAtomicType*, $collation as xs:string) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value that is equal to the lowest value appearing in the input\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"min\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"min\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri, and implicit timezone.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following rules are applied to the input sequence:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>Values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                      <code>xs:double</code>.</p></item><item><!--Text replaced by erratum E27 change 2\"--><p diff=\"chg\" at=\"A-E27\">Numeric and <code>xs:anyURI</code> values are converted to\\n                   the least common type reachable by a combination of type promotion and subtype\\n                   substitution. See <xspecref spec=\"XP30\" ref=\"promotion\"/> and <xspecref spec=\"XP30\" ref=\"mapping\"/>.</p><!--End of text replaced by erratum E27--></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The items in the resulting sequence may be reordered in an arbitrary order. The\\n             resulting sequence is referred to below as the converted sequence. The function returns\\n             an item from the converted sequence rather than the input sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence must be\\n                derived</phrase> from a single base type for which the <code>le</code> operator is\\n             defined. In addition, the values in the sequence must have a total order. If date/time\\n             values do not have a timezone, they are considered to have the implicit timezone\\n             provided by the dynamic context for the purpose of comparison. Duration values must\\n             either all be <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, the value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> are of\\n             type <code>xs:string</code> or types derived by restriction from <code>xs:string</code>,\\n             then the determination of the item with the smallest value is made according to the\\n             collation that is used. If the type of the items in the <phrase diff=\"chg\" at=\"A-E47\">converted sequence</phrase> is not <code>xs:string</code> and\\n                <code>$collation</code> is specified, the collation is ignored.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the result of the expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n    if (every $v in $c satisfies $c[1] le $v)\\n    then $c[1]\\n    else fn:min(fn:subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">evaluated with <code>$collation</code> as the default collation if specified, and with\\n                <code>$c</code> as the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value that is equal to the lowest value appearing in the input\\n             sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-dateTime\",qname:\"fn:minutes-from-dateTime\",signature:\"($arg as xs:dateTime?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the minute component of an <code>xs:dateTime</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"minutes-from-dateTime\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> value between 0 and 59, both\\n             inclusive, representing the minute component in the local value of\\n             <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>20</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:minutes-from-dateTime(xs:dateTime(\"1999-05-31T13:30:00+05:30\"))</code> returns <code>30</code>.</p></div>\\n',summary:\"<p>  Returns the minute component of an  xs:dateTime .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-duration\",qname:\"fn:minutes-from-duration\",signature:\"($arg as xs:duration?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of minutes in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"minutes-from-duration\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the minutes\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:dayTimeDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the minutes component as described\\n             in <specref ref=\"canonical-dayTimeDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:minutes-from-duration(xs:dayTimeDuration(\"P3DT10H\"))</code> returns <code>0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:minutes-from-duration(xs:dayTimeDuration(\"-P5DT12H30M\"))</code> returns <code>-30</code>.</p></div>\\n',summary:\"<p>  Returns the number of minutes in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-time\",qname:\"fn:minutes-from-time\",signature:\"($arg as xs:time?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the minutes component of an <code>xs:time</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"minutes-from-time\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> value between 0 and 59, both\\n             inclusive, representing the value of the minutes component in the local value of\\n                <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:minutes-from-time(xs:time(\"13:00:00Z\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the minutes component of an  xs:time .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"month-from-date\",qname:\"fn:month-from-date\",signature:\"($arg as xs:date?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the month component of an <code>xs:date</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"month-from-date\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> between 1 and 12, both\\n             inclusive, representing the month component in the local value of <code>$arg</code>.\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:month-from-date(xs:date(\"1999-05-31-05:00\"))</code> returns <code>5</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:month-from-date(xs:date(\"2000-01-01+05:00\"))</code> returns <code>1</code>.</p></div>\\n',summary:\"<p>  Returns the month component of an  xs:date .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"months-from-duration\",qname:\"fn:months-from-duration\",signature:\"($arg as xs:duration?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of months in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"months-from-duration\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the months\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:yearMonthDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the months component as described in\\n                <specref ref=\"canonical-yearMonthDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:dayTimeDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:months-from-duration(xs:yearMonthDuration(\"P20Y15M\"))</code> returns <code>3</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:months-from-duration(xs:yearMonthDuration(\"-P20Y18M\"))</code> returns <code>-6</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:months-from-duration(xs:dayTimeDuration(\"-P2DT15H0M0S\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the number of months in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"name\",qname:\"fn:name\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the name of a node, as an <code>xs:string</code> that is either the\\n             zero-length string, or has the lexical form of an <code>xs:QName</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is supplied and is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> has no name (that is, if it is a document\\n             node, a comment, a text node, or a namespace node having no name), the function returns\\n             the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of the expression\\n                <code>fn:string(fn:node-name($arg))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the name of a node, as an  xs:string  that is either the\\n             zero-length string, or has the lexical form of an  xs:QName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"name\",qname:\"fn:name\",signature:\"($arg as node()?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the name of a node, as an <code>xs:string</code> that is either the\\n             zero-length string, or has the lexical form of an <code>xs:QName</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"name\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is supplied and is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> has no name (that is, if it is a document\\n             node, a comment, a text node, or a namespace node having no name), the function returns\\n             the zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of the expression\\n                <code>fn:string(fn:node-name($arg))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the name of a node, as an  xs:string  that is either the\\n             zero-length string, or has the lexical form of an  xs:QName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"namespace-uri-for-prefix\",qname:\"fn:namespace-uri-for-prefix\",signature:\"($prefix as xs:string?, $element as element(*)) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the namespace URI of one of the in-scope namespaces for\\n                <code>$element</code>, identified by its namespace prefix.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"namespace-uri-for-prefix\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"prefix\" type=\"xs:string?\"/><arg name=\"element\" type=\"element()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$element</code> has an in-scope namespace whose namespace prefix is equal to\\n                <code>$prefix</code>, the function returns the namespace URI of that namespace.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$element</code> has no in-scope namespace whose namespace prefix is equal to\\n             <code>$prefix</code>, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"I\">If <code>$prefix</code> is the zero-length string or the empty\\n             sequence, then if <code>$element</code> has a default namespace (that is, a namespace\\n             node with no name), the function returns the namespace URI of the default namespace. If\\n                <code>$element</code> has no default namespace, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Prefixes are equal only if their Unicode codepoints match exactly.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">let <code>$e</code> := <eg xml:space=\"preserve\">\\n &lt;z:a xmlns=\"http://example.org/one\" xmlns:z=\"http://example.org/two\"&gt;\\n   &lt;b xmlns=\"\"/&gt;\\n &lt;/z:a&gt;</eg></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-for-prefix(\"z\", $e)</code> returns <code>\"http://example.org/two\"</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-for-prefix(\"\", $e)</code> returns <code>\"http://example.org/one\"</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-for-prefix((), $e)</code> returns <code>\"http://example.org/one\"</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-for-prefix(\"xml\", $e)</code> returns <code>\"http://www.w3.org/XML/1998/namespace\"</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-for-prefix(\"xml\", $e)</code> returns <code>\"http://www.w3.org/XML/1998/namespace\"</code>.</p></div>\\n',summary:\"<p>  Returns the namespace URI of one of the in-scope namespaces for\\n                 $element , identified by its namespace prefix.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prefix\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"element\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"namespace-uri-from-QName\",qname:\"fn:namespace-uri-from-QName\",signature:\"($arg as xs:QName?) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the namespace URI part of the supplied QName.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"namespace-uri-from-QName\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:QName?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:anyURI</code> representing the namespace URI\\n             part of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is in no namespace, the function returns the zero-length\\n                <code>xs:anyURI</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:namespace-uri-from-QName(fn:QName(\"http://www.example.com/example\",\\n                   \"person\"))</code> returns <code>xs:anyURI(\"http://www.example.com/example\")</code>.</p></div>\\n',summary:\"<p>  Returns the namespace URI part of the supplied QName.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:QName\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"namespace-uri\",qname:\"fn:namespace-uri\",signature:\"() as xs:anyURI external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E15\">Returns the namespace URI part of the name of\\n                <code>$arg</code>, as an <code>xs:anyURI</code> value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"namespace-uri\" return-type=\"xs:anyURI\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"namespace-uri\" return-type=\"xs:anyURI\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context node (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> is neither an element nor an attribute node,\\n             or if it is an element or attribute node whose expanded-QName (as determined by the\\n                <code>dm:node-name</code> accessor in the <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>)\\n             is in no namespace, then the function returns the zero-length <code>xs:anyURI</code>\\n             value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the result will be the namespace URI part of the expanded-QName of the node\\n             identified by <code>$arg</code>, as determined by the <code>dm:node-name</code> accessor\\n             defined in <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>), returned as an\\n                <code>xs:anyURI</code> value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the namespace URI part of the name of\\n                 $arg , as an  xs:anyURI  value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"namespace-uri\",qname:\"fn:namespace-uri\",signature:\"($arg as node()?) as xs:anyURI external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E15\">Returns the namespace URI part of the name of\\n                <code>$arg</code>, as an <code>xs:anyURI</code> value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"namespace-uri\" return-type=\"xs:anyURI\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"namespace-uri\" return-type=\"xs:anyURI\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context node (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the node identified by <code>$arg</code> is neither an element nor an attribute node,\\n             or if it is an element or attribute node whose expanded-QName (as determined by the\\n                <code>dm:node-name</code> accessor in the <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>)\\n             is in no namespace, then the function returns the zero-length <code>xs:anyURI</code>\\n             value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the result will be the namespace URI part of the expanded-QName of the node\\n             identified by <code>$arg</code>, as determined by the <code>dm:node-name</code> accessor\\n             defined in <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>), returned as an\\n                <code>xs:anyURI</code> value.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the namespace URI part of the name of\\n                 $arg , as an  xs:anyURI  value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"nilled\",qname:\"fn:nilled\",signature:\"() as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true for an element that is <term>nilled</term>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"nilled\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"nilled\" return-type=\"xs:boolean?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise the function returns the result of the <code>dm:nilled</code> accessor as\\n             defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-nilled\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns true for an element that is  nilled .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"nilled\",qname:\"fn:nilled\",signature:\"($arg as node()?) as xs:boolean? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true for an element that is <term>nilled</term>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"nilled\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"nilled\" return-type=\"xs:boolean?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the argument is omitted, it defaults to the context item (<code>.</code>). The\\n             behavior of the function if the argument is omitted is exactly the same as if the\\n             context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise the function returns the result of the <code>dm:nilled</code> accessor as\\n             defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-nilled\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns true for an element that is  nilled .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"node-name\",qname:\"fn:node-name\",signature:\"() as xs:QName? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the name of a node, as an <code>xs:QName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"node-name\" return-type=\"xs:QName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"node-name\" return-type=\"xs:QName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the result of the <code>dm:node-name</code> accessor as\\n             defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the name of a node, as an  xs:QName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"node-name\",qname:\"fn:node-name\",signature:\"($arg as node()?) as xs:QName? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the name of a node, as an <code>xs:QName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"node-name\" return-type=\"xs:QName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"node-name\" return-type=\"xs:QName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">If the argument is omitted, it defaults to the context item\\n                (<code>.</code>). The behavior of the function if the argument is omitted is exactly\\n             the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the result of the <code>dm:node-name</code> accessor as\\n             defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-node-name\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"I\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the name of a node, as an  xs:QName .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:QName?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"normalize-space\",qname:\"fn:normalize-space\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> with leading and trailing whitespace\\n             removed, and sequences of internal whitespace reduced to a single space character.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"normalize-space\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"normalize-space\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a string constructed by stripping leading and trailing whitespace\\n             from the value of <code>$arg</code>, and replacing sequences of one or more adjacent\\n             whitespace characters with a single space, <code>#x20</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The whitespace characters are defined in the metasymbol S (Production 3) of <bibref ref=\"REC-xml\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E14\">If no argument is supplied, then <code>$arg</code> defaults to the\\n             string value (calculated using <code>fn:string</code>) of the context item\\n                (<code>.</code>). </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If no argument is supplied and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref> then a <phrase diff=\"add\" at=\"dynamic\">dynamic</phrase> error is raised: <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/>.</p></div>\\n',summary:\"<p>  Returns the value of  $arg  with leading and trailing whitespace\\n             removed, and sequences of internal whitespace reduced to a single space character.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"normalize-space\",qname:\"fn:normalize-space\",signature:\"($arg as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> with leading and trailing whitespace\\n             removed, and sequences of internal whitespace reduced to a single space character.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"normalize-space\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"normalize-space\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a string constructed by stripping leading and trailing whitespace\\n             from the value of <code>$arg</code>, and replacing sequences of one or more adjacent\\n             whitespace characters with a single space, <code>#x20</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The whitespace characters are defined in the metasymbol S (Production 3) of <bibref ref=\"REC-xml\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E14\">If no argument is supplied, then <code>$arg</code> defaults to the\\n             string value (calculated using <code>fn:string</code>) of the context item\\n                (<code>.</code>). </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If no argument is supplied and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref> then a <phrase diff=\"add\" at=\"dynamic\">dynamic</phrase> error is raised: <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/>.</p></div>\\n',summary:\"<p>  Returns the value of  $arg  with leading and trailing whitespace\\n             removed, and sequences of internal whitespace reduced to a single space character.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"normalize-unicode\",qname:\"fn:normalize-unicode\",signature:\"($arg as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> after applying Unicode\\n             normalization.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"normalize-unicode\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"normalize-unicode\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/><arg name=\"normalizationForm\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the single-argument version of the function is used, the result is the same as\\n             calling the two-argument version with <code>$normalizationForm</code> set to the string\\n             \"NFC\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of <code>$arg</code> normalized according to\\n             the rules of the normalization form identified by the value of\\n                <code>$normalizationForm</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effective value of <code>$normalizationForm</code> is the value of the expression\\n                <code>fn:upper-case(fn:normalize-space($normalizationForm))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"D\">See <bibref ref=\"charmod-normalization\"/> for a description of the\\n             normalization forms.</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFC</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form C (NFC).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFD</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form D (NFD).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFKC</quote>,\\n                   then the function returns the value of <code>$arg</code> in Unicode Normalization\\n                   Form KC (NFKC).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFKD</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form KD (NFKD).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is\\n                      <quote>FULLY-NORMALIZED</quote>, then the function returns the value of\\n                      <code>$arg</code> converted to fully normalized form. </p></item><item><p>If the effective value of <code>$normalizationForm</code> is the zero-length\\n                   string, no normalization is performed and <code>$arg</code> is returned.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">Normalization forms NFC, NFD, NFKC, and NFKD, and the algorithms to be\\n             used for converting a string to each of these forms, are defined in <bibref ref=\"Unicode-Normalization\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">The motivation for normalization form FULLY-NORMALIZED is explained in\\n                <bibref ref=\"charmod-normalization\"/>. However, as that specification did not\\n             progress beyond working draft status, the normative specification is as follows:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\"><item><p>A string is <term>fully-normalized</term> if (a) it is in normalization form NFC\\n                   as defined in <bibref ref=\"Unicode-Normalization\"/>, and (b) it does not start\\n                   with a composing character.</p></item><item><p>A composing character is a character that is one or both of the following:</p><ulist><item><p>the second character in the canonical decomposition mapping of some\\n                         character that is not listed in the Composition Exclusion Table defined in\\n                            <bibref ref=\"Unicode-Normalization\"/>;</p></item><item><p>of non-zero canonical combining class (as defined in <bibref ref=\"Unicode\"/>).</p></item></ulist></item><item><p>A string is converted to FULLY-NORMALIZED form as follows:</p><ulist><item><p>if the first character in the string is a composing character, prepend a\\n                         single space (x20);</p></item><item><p>convert the resulting string to normalization form NFC.</p></item></ulist></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" At=\"L\">Conforming implementations <rfc2119>must</rfc2119> support normalization form \"NFC\" and\\n                <rfc2119>may</rfc2119> support normalization forms \"NFD\", \"NFKC\", \"NFKD\", and\\n             \"FULLY-NORMALIZED\". They <rfc2119>may</rfc2119> also support other normalization forms\\n             with <termref def=\"implementation-defined\">implementation-defined</termref> semantics. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">It is <termref def=\"dt-implementation-defined\">implementation-defined</termref> which version of\\n             Unicode (and therefore, of the normalization algorithms and their underlying\\n             data) is supported by the implementation. See <bibref ref=\"Unicode-Normalization\"/> for details of the\\n             stability policy regarding changes to the normalization rules in future\\n             versions of Unicode. If the input string contains codepoints that are\\n             unassigned in the relevant version of Unicode, or for which no normalization\\n             rules are defined, the <code>fn:normalize-unicode</code> function leaves such codepoints\\n             unchanged. If the implementation supports the requested normalization form then\\n             it <rfc2119>must</rfc2119> be able to handle every input string without raising an error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"CH\" code=\"0003\"/> if the effective value of the\\n                <code>$normalizationForm</code> argument is not one of the values supported by the\\n             implementation.</p></div>\\n',summary:\"<p>  Returns the value of  $arg  after applying Unicode\\n             normalization.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"normalize-unicode\",qname:\"fn:normalize-unicode\",signature:\"($arg as xs:string?, $normalizationForm as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> after applying Unicode\\n             normalization.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"normalize-unicode\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"normalize-unicode\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/><arg name=\"normalizationForm\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the single-argument version of the function is used, the result is the same as\\n             calling the two-argument version with <code>$normalizationForm</code> set to the string\\n             \"NFC\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of <code>$arg</code> normalized according to\\n             the rules of the normalization form identified by the value of\\n                <code>$normalizationForm</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effective value of <code>$normalizationForm</code> is the value of the expression\\n                <code>fn:upper-case(fn:normalize-space($normalizationForm))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"D\">See <bibref ref=\"charmod-normalization\"/> for a description of the\\n             normalization forms.</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFC</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form C (NFC).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFD</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form D (NFD).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFKC</quote>,\\n                   then the function returns the value of <code>$arg</code> in Unicode Normalization\\n                   Form KC (NFKC).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is <quote>NFKD</quote>,\\n                   then the function returns the value of <code>$arg</code> converted to Unicode\\n                   Normalization Form KD (NFKD).</p></item><item><p>If the effective value of <code>$normalizationForm</code> is\\n                      <quote>FULLY-NORMALIZED</quote>, then the function returns the value of\\n                      <code>$arg</code> converted to fully normalized form. </p></item><item><p>If the effective value of <code>$normalizationForm</code> is the zero-length\\n                   string, no normalization is performed and <code>$arg</code> is returned.</p></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">Normalization forms NFC, NFD, NFKC, and NFKD, and the algorithms to be\\n             used for converting a string to each of these forms, are defined in <bibref ref=\"Unicode-Normalization\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\">The motivation for normalization form FULLY-NORMALIZED is explained in\\n                <bibref ref=\"charmod-normalization\"/>. However, as that specification did not\\n             progress beyond working draft status, the normative specification is as follows:</p><ulist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"D\"><item><p>A string is <term>fully-normalized</term> if (a) it is in normalization form NFC\\n                   as defined in <bibref ref=\"Unicode-Normalization\"/>, and (b) it does not start\\n                   with a composing character.</p></item><item><p>A composing character is a character that is one or both of the following:</p><ulist><item><p>the second character in the canonical decomposition mapping of some\\n                         character that is not listed in the Composition Exclusion Table defined in\\n                            <bibref ref=\"Unicode-Normalization\"/>;</p></item><item><p>of non-zero canonical combining class (as defined in <bibref ref=\"Unicode\"/>).</p></item></ulist></item><item><p>A string is converted to FULLY-NORMALIZED form as follows:</p><ulist><item><p>if the first character in the string is a composing character, prepend a\\n                         single space (x20);</p></item><item><p>convert the resulting string to normalization form NFC.</p></item></ulist></item></ulist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" At=\"L\">Conforming implementations <rfc2119>must</rfc2119> support normalization form \"NFC\" and\\n                <rfc2119>may</rfc2119> support normalization forms \"NFD\", \"NFKC\", \"NFKD\", and\\n             \"FULLY-NORMALIZED\". They <rfc2119>may</rfc2119> also support other normalization forms\\n             with <termref def=\"implementation-defined\">implementation-defined</termref> semantics. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">It is <termref def=\"dt-implementation-defined\">implementation-defined</termref> which version of\\n             Unicode (and therefore, of the normalization algorithms and their underlying\\n             data) is supported by the implementation. See <bibref ref=\"Unicode-Normalization\"/> for details of the\\n             stability policy regarding changes to the normalization rules in future\\n             versions of Unicode. If the input string contains codepoints that are\\n             unassigned in the relevant version of Unicode, or for which no normalization\\n             rules are defined, the <code>fn:normalize-unicode</code> function leaves such codepoints\\n             unchanged. If the implementation supports the requested normalization form then\\n             it <rfc2119>must</rfc2119> be able to handle every input string without raising an error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"CH\" code=\"0003\"/> if the effective value of the\\n                <code>$normalizationForm</code> argument is not one of the values supported by the\\n             implementation.</p></div>\\n',summary:\"<p>  Returns the value of  $arg  after applying Unicode\\n             normalization.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"normalizationForm\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"not\",qname:\"fn:not\",signature:\"($arg as item()*) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>true</code> if the effective boolean value of <code>$arg</code>\\n             is <code>false</code>, or <code>false</code> if it is <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"not\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$arg</code> is first reduced to an effective boolean value by\\n             applying the <code>fn:boolean()</code> function. The function returns <code>true</code>\\n             if the effective boolean value is <code>false</code>, or <code>false</code> if the\\n             effective boolean value is <code>true</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:not(fn:true())</code> returns <code>false()</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:not(\"false\")</code> returns <code>false()</code>.</p></div>\\n',summary:\"<p>  Returns  true  if the effective boolean value of  $arg \\n             is  false , or  false  if it is  true .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"number\",qname:\"fn:number\",signature:\"() as xs:double external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value indicated by <code>$arg</code> or, if <code>$arg</code> is\\n             not specified, the context item after atomization, converted to an\\n                <code>xs:double</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"number\" return-type=\"xs:double\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"number\" return-type=\"xs:double\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the zero-argument version of the function is defined to give the same result as\\n             calling the single-argument version with the context item (<code>.</code>). That is,\\n                <code>fn:number()</code> is equivalent to <code>fn:number(.)</code>, as\\n          defined by the rules that follow.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence or if <code>$arg</code> <phrase diff=\"del\" at=\"L\">or the context item</phrase>\\n             cannot be converted to an <code>xs:double</code>, the <code>xs:double</code> value\\n                <code>NaN</code> is returned. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, <code>$arg</code> <phrase diff=\"del\" at=\"L\">, or the context item after atomization,</phrase> is converted to an\\n                <code>xs:double</code> following the rules of <specref ref=\"casting-to-double\"/>. If\\n             the conversion to <code>xs:double</code> fails, the <code>xs:double</code> value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/> if\\n                <code>$arg</code> is omitted and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">As a consequence of the rules given above, a type error occurs if the context\\n          item cannot be atomized, or if the result of atomizing the context item is a sequence containing\\n          more than one atomic value.</p></div>\\n',summary:\"<p>  Returns the value indicated by  $arg  or, if  $arg  is\\n             not specified, the context item after atomization, converted to an\\n                 xs:double .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:double\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"number\",qname:\"fn:number\",signature:\"($arg as xs:anyAtomicType?) as xs:double external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value indicated by <code>$arg</code> or, if <code>$arg</code> is\\n             not specified, the context item after atomization, converted to an\\n                <code>xs:double</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"number\" return-type=\"xs:double\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"number\" return-type=\"xs:double\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the zero-argument version of the function is defined to give the same result as\\n             calling the single-argument version with the context item (<code>.</code>). That is,\\n                <code>fn:number()</code> is equivalent to <code>fn:number(.)</code>, as\\n          defined by the rules that follow.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence or if <code>$arg</code> <phrase diff=\"del\" at=\"L\">or the context item</phrase>\\n             cannot be converted to an <code>xs:double</code>, the <code>xs:double</code> value\\n                <code>NaN</code> is returned. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, <code>$arg</code> <phrase diff=\"del\" at=\"L\">, or the context item after atomization,</phrase> is converted to an\\n                <code>xs:double</code> following the rules of <specref ref=\"casting-to-double\"/>. If\\n             the conversion to <code>xs:double</code> fails, the <code>xs:double</code> value\\n                <code>NaN</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/> if\\n                <code>$arg</code> is omitted and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">As a consequence of the rules given above, a type error occurs if the context\\n          item cannot be atomized, or if the result of atomizing the context item is a sequence containing\\n          more than one atomic value.</p></div>\\n',summary:\"<p>  Returns the value indicated by  $arg  or, if  $arg  is\\n             not specified, the context item after atomization, converted to an\\n                 xs:double .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"one-or-more\",qname:\"fn:one-or-more\",signature:\"($arg as item()*) as item()+ external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>$arg</code> if it contains one or more items. Otherwise, raises\\n             an error. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"one-or-more\" return-type=\"item()+\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Except in error cases, the function returns <code>$arg</code> unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0004\"/> if <code>$arg</code> is an empty\\n             sequence.</p></div>\\n',summary:\"<p>  Returns  $arg  if it contains one or more items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()+\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"outermost\",qname:\"fn:outermost\",signature:\"($nodes as node()*) as node()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns every node within the input sequence that has no ancestor that is itself a\\n             member of the input sequence; the nodes are returned in document order with duplicates\\n             eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"outermost\" return-type=\"node()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"nodes\" type=\"node()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of the function call <code>fn:outermost($nodes)</code> is defined to be\\n             equivalent to the result of the expression <code diff=\"chg\" at=\"L\">$nodes[not(ancestor::node() intersect\\n                $nodes)]/.</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">That is, the function takes as input a sequence of nodes, and returns every node within\\n             the sequence that <phrase diff=\"chg\" at=\"J\">does not have another node within the sequence as an ancestor</phrase>; the nodes are\\n             returned in document order with duplicates eliminated.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The formulation <code>$nodes except $nodes/descendant::node()</code> might appear to be\\n             simpler, but does not correctly account for attribute nodes, as these are not\\n             descendants of their parent element.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The motivation for the function was based on XSLT streaming use cases. There are cases\\n             where the <bibref ref=\"xslt-30\"/> streaming rules allow the construct\\n                <code>outermost(//section)</code> but do not allow <code>//section</code>; the\\n             function can therefore be useful in cases where it is known that sections will not be\\n             nested, as well as cases where the application actually wishes to process all sections\\n             except those that are nested within another.</p></div>\\n',summary:\"<p>  Returns every node within the input sequence that has no ancestor that is itself a\\n             member of the input sequence; the nodes are returned in document order with duplicates\\n             eliminated.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:\"\"}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"parse-xml-fragment\",qname:\"fn:parse-xml-fragment\",signature:\"($arg as xs:string?) as document(element(*,xs:untyped)) external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function takes as input an XML external entity represented as a string,\\n             and returns the document node at the root of an XDM tree representing the parsed\\n             document fragment.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"parse-xml-fragment\" return-type=\"document-node()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The input must be a namespace-well-formed external general parsed entity. More specifically,\\n             it must be a string conforming to the production rule <xnt xmlns:xlink=\"http://www.w3.org/1999/xlink\" spec=\"xml\" ref=\"NT-extParsedEnt\" xlink:type=\"simple\">extParsedEnt</xnt> in <bibref ref=\"REC-xml\"/>, it must contain no entity references other\\n             than references to predefined entities,\\n             and it must satisfy all the rules\\n             of <bibref ref=\"REC-xml-names\"/> for namespace-well-formed documents with the exception\\n             that the rule requiring it to be a well-formed document is replaced by the rule requiring\\n             it to be a well-formed external general parsed entity.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The string is parsed to form a sequence of nodes which\\n             become children of the new document node, in the same way as the content of any element\\n             is converted into a sequence of children for the resulting element node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Schema validation is <emph>not</emph> invoked, which means that the nodes in the\\n             returned document will all be untyped.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The precise process used to construct the XDM instance is <termref def=\"implementation-defined\"/>. In\\n             particular, it is implementation-defined whether an XML 1.0 or XML 1.1 parser is\\n             used.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"L\">The Static Base URI from the static context of the <code>fn:parse-xml-fragment</code> function call\\n             is used as the base URI of the document node\\n             that is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The document URI of the returned node is <termref def=\"absent\">absent</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is <emph>not</emph>\\n             <termref def=\"deterministic\">deterministic</termref>: that is, if the function is called\\n             twice with the same arguments, it is <termref def=\"implementation-dependent\">implementation-dependent</termref> whether the same node is returned on both\\n                occasions.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0006\"/> if the content of\\n                <code>$arg</code> is not a well-formed external general parsed entity,\\n             if it contains entity references other than references to predefined entities, or if a document that\\n             incorporates this well-formed parsed entity would not be namespace-well-formed.</p></div>\\n',summary:\"<p>  This function takes as input an XML external entity represented as a string,\\n             and returns the document node at the root of an XDM tree representing the parsed\\n             document fragment.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"document(element(*,xs:untyped))\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"parse-xml\",qname:\"fn:parse-xml\",signature:\"($arg as xs:string?) as document(element(*,xs:untyped)) external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function takes as input an XML document represented as a string, and\\n             returns the document node at the root of an XDM tree representing the parsed\\n             document.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"parse-xml\" return-type=\"document-node(element(*))?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">If <code>$arg</code> is the empty sequence, the function returns the\\n             empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The precise process used to construct the XDM instance is <termref def=\"implementation-defined\"/>. In\\n             particular, it is implementation-defined whether DTD and/or schema validation is invoked, and it is\\n             implementation-defined whether an XML 1.0 or XML 1.1 parser is used.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The Static Base URI property from the static context of the\\n             <code>fn:parse-xml</code> function call is used both as the base URI used by the XML parser to resolve\\n             relative entity references within the document, and as the base URI of the document node\\n             that is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The document URI of the returned node is <termref def=\"absent\">absent</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is <emph>not</emph>\\n             <termref def=\"deterministic\">deterministic</termref>: that is, if the function is called\\n             twice with the same arguments, it is <termref def=\"implementation-dependent\">implementation-dependent</termref> whether the same node is returned on both\\n             occasions.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0006\"/> if the content of\\n                <code>$arg</code> is not a well-formed and namespace-well-formed XML document.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0006\"/> if DTD-based\\n             validation is carried out and the content of <code>$arg</code> is not valid against its\\n             DTD.</p></div>\\n',summary:\"<p>  This function takes as input an XML document represented as a string, and\\n             returns the document node at the root of an XDM tree representing the parsed\\n             document.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"document(element(*,xs:untyped))\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"parse-xml\",qname:\"fn:parse-xml\",signature:\"($arg as xs:string?, $baseURI as xs:string) as document(element(*,xs:untyped)) external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function takes as input an XML document represented as a string, and\\n             returns the document node at the root of an XDM tree representing the parsed\\n             document.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"parse-xml\" return-type=\"document-node(element(*))?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-nondeterministic\">nondeterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">If <code>$arg</code> is the empty sequence, the function returns the\\n             empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The precise process used to construct the XDM instance is <termref def=\"implementation-defined\"/>. In\\n             particular, it is implementation-defined whether DTD and/or schema validation is invoked, and it is\\n             implementation-defined whether an XML 1.0 or XML 1.1 parser is used.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The Static Base URI property from the static context of the\\n             <code>fn:parse-xml</code> function call is used both as the base URI used by the XML parser to resolve\\n             relative entity references within the document, and as the base URI of the document node\\n             that is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The document URI of the returned node is <termref def=\"absent\">absent</termref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is <emph>not</emph>\\n             <termref def=\"deterministic\">deterministic</termref>: that is, if the function is called\\n             twice with the same arguments, it is <termref def=\"implementation-dependent\">implementation-dependent</termref> whether the same node is returned on both\\n             occasions.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0006\"/> if the content of\\n                <code>$arg</code> is not a well-formed and namespace-well-formed XML document.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"G\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0006\"/> if DTD-based\\n             validation is carried out and the content of <code>$arg</code> is not valid against its\\n             DTD.</p></div>\\n',summary:\"<p>  This function takes as input an XML document represented as a string, and\\n             returns the document node at the root of an XDM tree representing the parsed\\n             document.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"baseURI\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"document(element(*,xs:untyped))\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"position\",qname:\"fn:position\",signature:\"() as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the context position from the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"position\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the context position from the dynamic context. (See <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.)</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"type\"/> if the\\n             context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p></div>\\n',summary:\"<p>  Returns the context position from the dynamic context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"prefix-from-QName\",qname:\"fn:prefix-from-QName\",signature:\"($arg as xs:QName?) as xs:NCName? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the prefix component of the supplied QName.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"prefix-from-QName\" return-type=\"xs:NCName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:QName?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> has no prefix component the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:NCName</code> representing the prefix\\n             component of <code>$arg</code>.</p></div>\\n',summary:\"<p>  Returns the prefix component of the supplied QName.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:QName\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:NCName?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove\",qname:\"fn:remove\",signature:\"($target as item()*, $position as xs:integer) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a new sequence containing all the items of <code>$target</code> except\\n             the item at position <code>$position</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"remove\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"target\" type=\"item()*\"/><arg name=\"position\" type=\"xs:integer\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence consisting of all items of <code>$target</code> whose\\n             index is less than <code>$position</code>, followed by all items of <code>$target</code>\\n             whose index is greater than <code>$position</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$position</code> is less than 1 or greater than the number of items in\\n                <code>$target</code>, <code>$target</code> is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$target</code> is the empty sequence, the empty sequence is returned.</p></div>\\n',summary:\"<p>  Returns a new sequence containing all the items of  $target  except\\n             the item at position  $position .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"target\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"position\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"replace\",qname:\"fn:replace\",signature:\"($input as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string produced from the input string by replacing any substrings\\n             that match a given regular expression with a supplied replacement string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"replace\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"replacement\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"replace\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"replacement\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same manner as for the\\n                <code>fn:matches</code> function. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the <code>xs:string</code> that is obtained by replacing each\\n             non-overlapping substring of <code>$input</code> that matches the given\\n                <code>$pattern</code> with an occurrence of the <code>$replacement</code> string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If two overlapping substrings of <code>$input</code> both match the\\n                <code>$pattern</code>, then only the first one (that is, the one whose first <termref def=\"character\">character</termref> comes first in the <code>$input</code> string) is\\n             replaced.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">If the <code>q</code> flag is present, the replacement string is used\\n                <emph>as is</emph>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><phrase diff=\"add\" at=\"B\">Otherwise,</phrase> within the <code>$replacement</code>\\n             string, a variable <code>$N</code> may be used to refer to the substring captured by the\\n             Nth parenthesized sub-expression in the regular expression. For each match of the\\n             pattern, these variables are assigned the value of the content matched by the relevant\\n             sub-expression, and the modified replacement string is then substituted for the <termref def=\"character\">characters</termref> in <code>$input</code> that matched the pattern.\\n                <code>$0</code> refers to the substring captured by the regular expression as a\\n             whole.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the rules are as follows, where <code>S</code> is the number of\\n             parenthesized sub-expressions in the regular expression, and <code>N</code> is the\\n             decimal number formed by taking all the digits that consecutively follow the\\n                <code>$</code> character:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If <code>N</code>=<code>0</code>, then the variable is replaced by the substring\\n                   matched by the regular expression as a whole.</p></item><item><p>If <code>1</code>&lt;=<code>N</code>&lt;=<code>S</code>, then the variable is\\n                   replaced by the substring captured by the Nth parenthesized sub-expression. If the\\n                      <code>Nth</code> parenthesized sub-expression was not matched, then the\\n                   variable is replaced by the zero-length string.</p></item><item><p>If <code>S</code>&lt;<code>N</code>&lt;=<code>9</code>, then the variable is\\n                   replaced by the zero-length string.</p></item><item><p>Otherwise (if <code>N</code>&gt;<code>S</code> and\\n                      <code>N</code>&gt;<code>9</code>), the last digit of <code>N</code> is taken to\\n                   be a literal character to be included \"as is\" in the replacement string, and the\\n                   rules are reapplied using the number <code>N</code> formed by stripping off this\\n                   last digit.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For example, if the replacement string is <quote>\\n                <code>$23</code>\\n             </quote> and there are 5 substrings, the result contains the value of the substring that\\n             matches the second sub-expression, followed by the digit <quote>\\n                <code>3</code>\\n             </quote>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"B\">Unless the <code>q</code> flag is used, a literal <code>$</code>\\n             character within the replacement string must be written as <code>\\\\$</code>, and a\\n             literal <code>\\\\</code> character must be written as <code>\\\\\\\\</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If two alternatives within the pattern both match at the same position in the\\n                <code>$input</code>, then the match that is chosen is the one matched by the first\\n             alternative. For example:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:replace(\"abcd\", \"(ab)|(a)\", \"[1=$1][2=$2]\") returns \"[1=ab][2=]cd\"</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the pattern matches a\\n             zero-length string, that is, if the expression <code>fn:matches(\"\", $pattern,\\n                $flags)</code> returns <code>true</code>. It is not an error, however, if a captured\\n             substring is zero-length.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0004\"/> if the value of\\n                <code>$replacement</code> contains a \"<code>$</code>\" character that is not\\n             immediately followed by a digit <code>0-9</code> and not immediately preceded by a\\n             \"\\\\\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0004\"/> if the value of\\n                <code>$replacement</code> contains a \"<code>\\\\</code>\" character that is not part of a\\n                \"<code>\\\\\\\\</code>\" pair, unless it is immediately followed by a \"<code>$</code>\"\\n             character.</p></div>\\n',summary:\"<p>  Returns a string produced from the input string by replacing any substrings\\n             that match a given regular expression with a supplied replacement string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"replacement\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:4,name:\"replace\",qname:\"fn:replace\",signature:\"($input as xs:string?, $pattern as xs:string, $replacement as xs:string, $flags as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string produced from the input string by replacing any substrings\\n             that match a given regular expression with a supplied replacement string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"replace\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"replacement\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"replace\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"replacement\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same manner as for the\\n                <code>fn:matches</code> function. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the <code>xs:string</code> that is obtained by replacing each\\n             non-overlapping substring of <code>$input</code> that matches the given\\n                <code>$pattern</code> with an occurrence of the <code>$replacement</code> string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If two overlapping substrings of <code>$input</code> both match the\\n                <code>$pattern</code>, then only the first one (that is, the one whose first <termref def=\"character\">character</termref> comes first in the <code>$input</code> string) is\\n             replaced.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">If the <code>q</code> flag is present, the replacement string is used\\n                <emph>as is</emph>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><phrase diff=\"add\" at=\"B\">Otherwise,</phrase> within the <code>$replacement</code>\\n             string, a variable <code>$N</code> may be used to refer to the substring captured by the\\n             Nth parenthesized sub-expression in the regular expression. For each match of the\\n             pattern, these variables are assigned the value of the content matched by the relevant\\n             sub-expression, and the modified replacement string is then substituted for the <termref def=\"character\">characters</termref> in <code>$input</code> that matched the pattern.\\n                <code>$0</code> refers to the substring captured by the regular expression as a\\n             whole.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the rules are as follows, where <code>S</code> is the number of\\n             parenthesized sub-expressions in the regular expression, and <code>N</code> is the\\n             decimal number formed by taking all the digits that consecutively follow the\\n                <code>$</code> character:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If <code>N</code>=<code>0</code>, then the variable is replaced by the substring\\n                   matched by the regular expression as a whole.</p></item><item><p>If <code>1</code>&lt;=<code>N</code>&lt;=<code>S</code>, then the variable is\\n                   replaced by the substring captured by the Nth parenthesized sub-expression. If the\\n                      <code>Nth</code> parenthesized sub-expression was not matched, then the\\n                   variable is replaced by the zero-length string.</p></item><item><p>If <code>S</code>&lt;<code>N</code>&lt;=<code>9</code>, then the variable is\\n                   replaced by the zero-length string.</p></item><item><p>Otherwise (if <code>N</code>&gt;<code>S</code> and\\n                      <code>N</code>&gt;<code>9</code>), the last digit of <code>N</code> is taken to\\n                   be a literal character to be included \"as is\" in the replacement string, and the\\n                   rules are reapplied using the number <code>N</code> formed by stripping off this\\n                   last digit.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For example, if the replacement string is <quote>\\n                <code>$23</code>\\n             </quote> and there are 5 substrings, the result contains the value of the substring that\\n             matches the second sub-expression, followed by the digit <quote>\\n                <code>3</code>\\n             </quote>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"B\">Unless the <code>q</code> flag is used, a literal <code>$</code>\\n             character within the replacement string must be written as <code>\\\\$</code>, and a\\n             literal <code>\\\\</code> character must be written as <code>\\\\\\\\</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If two alternatives within the pattern both match at the same position in the\\n                <code>$input</code>, then the match that is chosen is the one matched by the first\\n             alternative. For example:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:replace(\"abcd\", \"(ab)|(a)\", \"[1=$1][2=$2]\") returns \"[1=ab][2=]cd\"</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the pattern matches a\\n             zero-length string, that is, if the expression <code>fn:matches(\"\", $pattern,\\n                $flags)</code> returns <code>true</code>. It is not an error, however, if a captured\\n             substring is zero-length.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0004\"/> if the value of\\n                <code>$replacement</code> contains a \"<code>$</code>\" character that is not\\n             immediately followed by a digit <code>0-9</code> and not immediately preceded by a\\n             \"\\\\\".</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0004\"/> if the value of\\n                <code>$replacement</code> contains a \"<code>\\\\</code>\" character that is not part of a\\n                \"<code>\\\\\\\\</code>\" pair, unless it is immediately followed by a \"<code>$</code>\"\\n             character.</p></div>\\n',summary:\"<p>  Returns a string produced from the input string by replacing any substrings\\n             that match a given regular expression with a supplied replacement string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"replacement\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"flags\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"resolve-QName\",qname:\"fn:resolve-QName\",signature:\"($qname as xs:string?, $element as element(*)) as xs:QName? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns an <code>xs:QName</code> value (that is, an expanded-QName) by taking\\n             an <code>xs:string</code> that has the lexical form of an <code>xs:QName</code> (a\\n             string in the form \"prefix:local-name\" or \"local-name\") and resolving it using the\\n             in-scope namespaces for a given element.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"resolve-QName\" return-type=\"xs:QName?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"qname\" type=\"xs:string?\"/><arg name=\"element\" type=\"element()\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$qname</code> is the empty sequence, returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the function searches the namespace bindings of <code>$element</code>\\n             for a binding whose name matches the prefix of <code>$qname</code>, or the zero-length\\n             string if it has no prefix, and constructs an expanded-QName whose local name is taken\\n             from the supplied <code>$qname</code>, and whose namespace URI is taken from the string\\n             value of the namespace binding.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the <code>$qname</code> has no prefix, and there is no namespace binding for\\n                <code>$element</code> corresponding to the default (unnamed) namespace, then the\\n             resulting expanded-QName has no namespace part.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The prefix (or absence of a prefix) in the supplied <code>$qname</code> argument is\\n             retained in the returned expanded-QName, as discussed in <xspecref spec=\"DM30\" ref=\"terminology\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"CA\" code=\"0002\"/> if <code>$qname</code> does not\\n             have the correct lexical form for an instance of <code>xs:QName</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"NS\" code=\"0004\"/> if <code>$qname</code> has a\\n             prefix and there is no namespace binding for <code>$element</code> that matches this\\n             prefix.</p></div>\\n',summary:'<p>  Returns an  xs:QName  value (that is, an expanded-QName) by taking\\n             an  xs:string  that has the lexical form of an  xs:QName  (a\\n             string in the form \"prefix:local-name\" or \"local-name\") and resolving it using the\\n             in-scope namespaces for a given element.</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"qname\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"element\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:QName?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"resolve-uri\",qname:\"fn:resolve-uri\",signature:\"($relative as xs:string?) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Resolves a relative IRI reference against an absolute IRI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"resolve-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"relative\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"resolve-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"relative\" type=\"xs:string?\"/><arg name=\"base\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the second argument is absent, the effect is the same as calling the two-argument\\n             function with the value of <code>fn:static-base-uri()</code> as the second argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is defined to operate on IRI references as defined in <bibref ref=\"rfc3987\"/>, and the implementation <rfc2119>must</rfc2119> permit all arguments that are valid\\n             according to that specification. In addition, the implementation <rfc2119>may</rfc2119>\\n             accept some or all strings that conform to the rules for (absolute or relative) Legacy\\n             Extended IRI references as defined in <bibref ref=\"LEIRI\"/>. For the purposes of this\\n             section, the terms IRI and IRI reference include these extensions, insofar as the\\n             implementation chooses to support them.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$relative</code> is the empty sequence, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$relative</code> is an absolute IRI (as defined above), then it is returned\\n             unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function resolves the relative IRI reference <code>$relative</code>\\n             against the base IRI <code>$base</code> using the algorithm defined in <bibref ref=\"rfc3986\"/>, adapted by treating any <termref def=\"character\">character</termref>\\n             that would not be valid in an RFC3986 URI or relative reference in the same way that\\n             RFC3986 treats unreserved characters. No percent-encoding takes place.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first form of this function resolves <code>$relative</code> against the value of the\\n             base-uri property from the static context. A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"NS\" code=\"0005\"/> if the base-uri property is not initialized in the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0002\"/> if <code>$relative</code> is not a\\n             valid IRI according to the rules of RFC3987, extended with an implementation-defined\\n             subset of the extensions permitted in LEIRI, or if it is not a suitable relative\\n             reference to use as input to the RFC3986 resolution algorithm extended to handle\\n             additional unreserved characters. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0002\"/> if <code>$base</code> is not a\\n             valid IRI according to the rules of RFC3987, extended with an implementation-defined\\n             subset of the extensions permitted in LEIRI, or if it is not a suitable IRI to use as\\n             input to the chosen resolution algorithm (for example, if it is a relative IRI\\n             reference, if it is a non-hierarchic URI, or if it contains a fragment identifier). </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0009\"/> if the chosen resolution algorithm\\n             fails for any other reason. </p></div>\\n',summary:\"<p>  Resolves a relative IRI reference against an absolute IRI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"relative\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"resolve-uri\",qname:\"fn:resolve-uri\",signature:\"($relative as xs:string?, $base as xs:string) as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Resolves a relative IRI reference against an absolute IRI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"resolve-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"relative\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"resolve-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"relative\" type=\"xs:string?\"/><arg name=\"base\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the second argument is absent, the effect is the same as calling the two-argument\\n             function with the value of <code>fn:static-base-uri()</code> as the second argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function is defined to operate on IRI references as defined in <bibref ref=\"rfc3987\"/>, and the implementation <rfc2119>must</rfc2119> permit all arguments that are valid\\n             according to that specification. In addition, the implementation <rfc2119>may</rfc2119>\\n             accept some or all strings that conform to the rules for (absolute or relative) Legacy\\n             Extended IRI references as defined in <bibref ref=\"LEIRI\"/>. For the purposes of this\\n             section, the terms IRI and IRI reference include these extensions, insofar as the\\n             implementation chooses to support them.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$relative</code> is the empty sequence, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$relative</code> is an absolute IRI (as defined above), then it is returned\\n             unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function resolves the relative IRI reference <code>$relative</code>\\n             against the base IRI <code>$base</code> using the algorithm defined in <bibref ref=\"rfc3986\"/>, adapted by treating any <termref def=\"character\">character</termref>\\n             that would not be valid in an RFC3986 URI or relative reference in the same way that\\n             RFC3986 treats unreserved characters. No percent-encoding takes place.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first form of this function resolves <code>$relative</code> against the value of the\\n             base-uri property from the static context. A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"NS\" code=\"0005\"/> if the base-uri property is not initialized in the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0002\"/> if <code>$relative</code> is not a\\n             valid IRI according to the rules of RFC3987, extended with an implementation-defined\\n             subset of the extensions permitted in LEIRI, or if it is not a suitable relative\\n             reference to use as input to the RFC3986 resolution algorithm extended to handle\\n             additional unreserved characters. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0002\"/> if <code>$base</code> is not a\\n             valid IRI according to the rules of RFC3987, extended with an implementation-defined\\n             subset of the extensions permitted in LEIRI, or if it is not a suitable IRI to use as\\n             input to the chosen resolution algorithm (for example, if it is a relative IRI\\n             reference, if it is a non-hierarchic URI, or if it contains a fragment identifier). </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0009\"/> if the chosen resolution algorithm\\n             fails for any other reason. </p></div>\\n',summary:\"<p>  Resolves a relative IRI reference against an absolute IRI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"relative\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"base\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"reverse\",qname:\"fn:reverse\",signature:\"($arg as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Reverses the order of items in a sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"reverse\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence containing the items in <code>$arg</code> in reverse\\n             order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the empty sequence is returned. </p></div>\\n',summary:\"<p>  Reverses the order of items in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"root\",qname:\"fn:root\",signature:\"() as node() external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the root of the tree to which <code>$arg</code> belongs. This will\\n             usually, but not necessarily, be a document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"root\" return-type=\"node()\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"root\" return-type=\"node()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the function is called without an argument, the context item (<code>.</code>) is used\\n             as the default argument. The behavior of the function if the argument is omitted is\\n             exactly the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of the expression\\n                <code>($arg/ancestor-or-self::node())[1]</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the root of the tree to which  $arg  belongs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"node()\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"root\",qname:\"fn:root\",signature:\"($arg as node()?) as node()? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the root of the tree to which <code>$arg</code> belongs. This will\\n             usually, but not necessarily, be a document node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"root\" return-type=\"node()\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"root\" return-type=\"node()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"node()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the function is called without an argument, the context item (<code>.</code>) is used\\n             as the default argument. The behavior of the function if the argument is omitted is\\n             exactly the same as if the context item had been passed as the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of the expression\\n                <code>($arg/ancestor-or-self::node())[1]</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The following errors may be raised when <code>$arg</code> is omitted:</p><ul xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><li><p>If the context\\n                item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, <phrase diff=\"add\" at=\"M\">dynamic error</phrase>\\n                <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/></p></li><li><p>If the context item is not a\\n                node, <phrase diff=\"add\" at=\"M\">type error</phrase> <xerrorref spec=\"XP\" class=\"TY\" code=\"0004\" type=\"type\"/>.</p></li></ul></div>\\n',summary:\"<p>  Returns the root of the tree to which  $arg  belongs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"node()\",occurrence:\"?\",description:\"\"}],returns:{type:\"node()?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"round-half-to-even\",qname:\"fn:round-half-to-even\",signature:\"($arg as numeric?) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds a value to a specified number of decimal places, rounding to make the\\n             last digit even if two such values are equally near.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"round-half-to-even\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example><example role=\"signature\"><proto name=\"round-half-to-even\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/><arg name=\"precision\" type=\"xs:integer\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the nearest (that is, numerically closest) value to\\n                <code>$arg</code> that is a multiple of ten to the power of minus\\n                <code>$precision</code>. If two such values are equally near (e.g. if the fractional\\n             part in <code>$arg</code> is exactly .500...), the function returns the one whose least\\n             significant digit is even.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The first signature of this function produces the same result as the second signature\\n             with <code>$precision=0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For arguments of type <code>xs:float</code> and <code>xs:double</code>:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the argument is <code>NaN</code>, positive or negative zero, or positive or\\n                   negative infinity, then the result is the same as the argument.</p></item><item><p>In all other cases, the argument is cast to <code>xs:decimal</code>\\n                   <phrase diff=\"add\" at=\"A\">using an implementation of xs:decimal that imposes no\\n                      limits on the number of digits that can be represented.</phrase> The function\\n                   is applied to this <code>xs:decimal</code> value, and the resulting\\n                      <code>xs:decimal</code> is cast back to <code>xs:float</code> or\\n                      <code>xs:double</code> as appropriate to form the function result. If the\\n                   resulting <code>xs:decimal</code> value is zero, then positive or negative zero is\\n                   returned according to the sign of the original argument.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A\">This function is typically used in financial applications where the\\n             argument is of type <code>xs:decimal</code>. For arguments of type <code>xs:float</code>\\n             and <code>xs:double</code> the results may be counter-intuitive. For example, consider\\n                <code>round-half-to-even(xs:float(150.015), 2)</code>. The result is not 150.02 as\\n             might be expected, but 150.01. This is because the conversion of the\\n                <code>xs:float</code> value represented by the literal 150.015 to an\\n                <code>xs:decimal</code> produces the <code>xs:decimal</code> value 150.014999389...,\\n             which is closer to 150.01 than to 150.02.</p></div>\\n',summary:\"<p>  Rounds a value to a specified number of decimal places, rounding to make the\\n             last digit even if two such values are equally near.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"round-half-to-even\",qname:\"fn:round-half-to-even\",signature:\"($arg as numeric?, $precision as xs:integer) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds a value to a specified number of decimal places, rounding to make the\\n             last digit even if two such values are equally near.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"round-half-to-even\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example><example role=\"signature\"><proto name=\"round-half-to-even\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/><arg name=\"precision\" type=\"xs:integer\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the nearest (that is, numerically closest) value to\\n                <code>$arg</code> that is a multiple of ten to the power of minus\\n                <code>$precision</code>. If two such values are equally near (e.g. if the fractional\\n             part in <code>$arg</code> is exactly .500...), the function returns the one whose least\\n             significant digit is even.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> The first signature of this function produces the same result as the second signature\\n             with <code>$precision=0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">For arguments of type <code>xs:float</code> and <code>xs:double</code>:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the argument is <code>NaN</code>, positive or negative zero, or positive or\\n                   negative infinity, then the result is the same as the argument.</p></item><item><p>In all other cases, the argument is cast to <code>xs:decimal</code>\\n                   <phrase diff=\"add\" at=\"A\">using an implementation of xs:decimal that imposes no\\n                      limits on the number of digits that can be represented.</phrase> The function\\n                   is applied to this <code>xs:decimal</code> value, and the resulting\\n                      <code>xs:decimal</code> is cast back to <code>xs:float</code> or\\n                      <code>xs:double</code> as appropriate to form the function result. If the\\n                   resulting <code>xs:decimal</code> value is zero, then positive or negative zero is\\n                   returned according to the sign of the original argument.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A\">This function is typically used in financial applications where the\\n             argument is of type <code>xs:decimal</code>. For arguments of type <code>xs:float</code>\\n             and <code>xs:double</code> the results may be counter-intuitive. For example, consider\\n                <code>round-half-to-even(xs:float(150.015), 2)</code>. The result is not 150.02 as\\n             might be expected, but 150.01. This is because the conversion of the\\n                <code>xs:float</code> value represented by the literal 150.015 to an\\n                <code>xs:decimal</code> produces the <code>xs:decimal</code> value 150.014999389...,\\n             which is closer to 150.01 than to 150.02.</p></div>\\n',summary:\"<p>  Rounds a value to a specified number of decimal places, rounding to make the\\n             last digit even if two such values are equally near.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"round\",qname:\"fn:round\",signature:\"($arg as numeric?) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds a value to a specified number of decimal places, rounding upwards if two\\n             such values are equally near.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"round\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example><example role=\"signature\"><proto name=\"round\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/><arg name=\"precision\" type=\"xs:integer\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the nearest (that is, numerically closest) value to\\n                <code>$arg</code> that is a multiple of ten to the power of minus\\n                <code>$precision</code>. If two such values are equally near (for example, if the\\n             fractional part in <code>$arg</code> is exactly .5), the function returns the one that\\n             is closest to positive infinity.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument version of this function produces the same result as the\\n             two-argument version with <code>$precision=0</code> (that is, it rounds to a whole\\n             number).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">When <code>$arg</code> is of type <code>xs:float</code> and <code>xs:double</code>:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If <code>$arg</code> is NaN, positive or negative zero, or positive or negative\\n                   infinity, then the result is the same as the argument.</p></item><item><p>For other values, the argument is cast to <code>xs:decimal</code> using an\\n                   implementation of <code>xs:decimal</code> that imposes no limits on the number of\\n                   digits that can be represented. The function is applied to this\\n                      <code>xs:decimal</code> value, and the resulting <code>xs:decimal</code> is\\n                   cast back to <code>xs:float</code> or <code>xs:double</code> as appropriate to\\n                   form the function result. If the resulting <code>xs:decimal</code> value is zero,\\n                   then positive or negative zero is returned according to the sign of\\n                      <code>$arg</code>.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is typically used with a non-zero <code>$precision</code> in financial\\n             applications where the argument is of type <code>xs:decimal</code>. For arguments of\\n             type <code>xs:float</code> and <code>xs:double</code> the results may be\\n             counter-intuitive. For example, consider <code>round(35.425e0, 2)</code>. The result is\\n             not 35.43, as might be expected, but 35.42. This is because the <code>xs:double</code> written as 35.425e0\\n             has an exact value equal to 35.42499999999..., which is closer\\n             to 35.42 than to 35.43.</p></div>\\n',summary:\"<p>  Rounds a value to a specified number of decimal places, rounding upwards if two\\n             such values are equally near.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"round\",qname:\"fn:round\",signature:\"($arg as numeric?, $precision as xs:integer) as numeric? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Rounds a value to a specified number of decimal places, rounding upwards if two\\n             such values are equally near.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"round\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/></proto></example><example role=\"signature\"><proto name=\"round\" return-type=\"numeric?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"numeric?\"/><arg name=\"precision\" type=\"xs:integer\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">General rules: see <specref ref=\"numeric-value-functions\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the nearest (that is, numerically closest) value to\\n                <code>$arg</code> that is a multiple of ten to the power of minus\\n                <code>$precision</code>. If two such values are equally near (for example, if the\\n             fractional part in <code>$arg</code> is exactly .5), the function returns the one that\\n             is closest to positive infinity.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the type of <code>$arg</code> is one of the four numeric types <code>xs:float</code>,\\n                <code>xs:double</code>, <code>xs:decimal</code> or <code>xs:integer</code> the type\\n             of the result is the same as the type of <code>$arg</code>. If the type of\\n                <code>$arg</code> is a type derived from one of the numeric types, the result is an\\n             instance of the base numeric type.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument version of this function produces the same result as the\\n             two-argument version with <code>$precision=0</code> (that is, it rounds to a whole\\n             number).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">When <code>$arg</code> is of type <code>xs:float</code> and <code>xs:double</code>:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If <code>$arg</code> is NaN, positive or negative zero, or positive or negative\\n                   infinity, then the result is the same as the argument.</p></item><item><p>For other values, the argument is cast to <code>xs:decimal</code> using an\\n                   implementation of <code>xs:decimal</code> that imposes no limits on the number of\\n                   digits that can be represented. The function is applied to this\\n                      <code>xs:decimal</code> value, and the resulting <code>xs:decimal</code> is\\n                   cast back to <code>xs:float</code> or <code>xs:double</code> as appropriate to\\n                   form the function result. If the resulting <code>xs:decimal</code> value is zero,\\n                   then positive or negative zero is returned according to the sign of\\n                      <code>$arg</code>.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is typically used with a non-zero <code>$precision</code> in financial\\n             applications where the argument is of type <code>xs:decimal</code>. For arguments of\\n             type <code>xs:float</code> and <code>xs:double</code> the results may be\\n             counter-intuitive. For example, consider <code>round(35.425e0, 2)</code>. The result is\\n             not 35.43, as might be expected, but 35.42. This is because the <code>xs:double</code> written as 35.425e0\\n             has an exact value equal to 35.42499999999..., which is closer\\n             to 35.42 than to 35.43.</p></div>\\n',summary:\"<p>  Rounds a value to a specified number of decimal places, rounding upwards if two\\n             such values are equally near.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"numeric\",occurrence:\"?\",description:\"\"},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:\"numeric?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-dateTime\",qname:\"fn:seconds-from-dateTime\",signature:\"($arg as xs:dateTime?) as xs:decimal? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the seconds component of an <code>xs:dateTime</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"seconds-from-dateTime\" return-type=\"xs:decimal?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:decimal</code> value greater than or equal\\n             to zero and less than 60, representing the seconds and fractional seconds in the local\\n             value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:seconds-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the seconds component of an  xs:dateTime .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-duration\",qname:\"fn:seconds-from-duration\",signature:\"($arg as xs:duration?) as xs:decimal? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of seconds in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"seconds-from-duration\" return-type=\"xs:decimal?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:decimal</code> representing the seconds\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:dayTimeDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the seconds component as described\\n             in <specref ref=\"canonical-dayTimeDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:yearMonthDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:seconds-from-duration(xs:dayTimeDuration(\"P3DT10H12.5S\"))</code> returns <code>12.5</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:seconds-from-duration(xs:dayTimeDuration(\"-PT256S\"))</code> returns <code>-16.0</code>.</p></div>\\n',summary:\"<p>  Returns the number of seconds in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-time\",qname:\"fn:seconds-from-time\",signature:\"($arg as xs:time?) as xs:decimal? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the seconds component of an <code>xs:time</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"seconds-from-time\" return-type=\"xs:decimal?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:decimal</code> value greater than or equal\\n             to zero and less than 60, representing the seconds and fractional seconds in the local\\n             value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:seconds-from-time(xs:time(\"13:20:10.5\"))</code> returns <code>10.5</code>.</p></div>\\n',summary:\"<p>  Returns the seconds component of an  xs:time .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"serialize\",qname:\"fn:serialize\",signature:\"($arg as item()*) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function serializes the supplied <phrase diff=\"chg\" at=\"G\">input\\n                sequence</phrase>\\n             <code>$arg</code> as described in <bibref ref=\"xslt-xquery-serialization-30\"/>,\\n             returning the serialized <phrase diff=\"chg\" at=\"G\">representation of the\\n                sequence</phrase> as a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"serialize\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example><example role=\"signature\"><proto name=\"serialize\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/><arg name=\"params\" type=\"element(output:serialization-parameters)?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$arg</code> acts as the input sequence to the serialization process,\\n             which starts with sequence normalization.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">The single-argument version of this function has the same effect as\\n             the two-argument version called with <code>$params</code> set to an empty sequence. This\\n             in turn is the same as the effect of passing an\\n                <code>output:serialization-parameters</code> element with no child elements.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">The <code>$params</code> argument is used to identify a set of\\n             serialization parameters. These are supplied in the form of an\\n                <code>output:serialization-parameters</code> element, having the format described in\\n                <xspecref spec=\"SER30\" ref=\"serparams-in-xdm-instance\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The final stage of serialization, that is, encoding, is skipped. If the serializer does\\n             not allow this phase to be skipped, then the sequence of octets returned by the\\n             serializer is decoded into a string by reversing the character encoding performed in the\\n             final stage.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">If the host language makes serialization an optional feature and\\n          the implementation does not support serialization, then a dynamic error\\n             <errorref class=\"DC\" code=\"0010\"/> is raised.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The serialization process will raise an error if <code>$arg</code> is an attribute or\\n             namespace node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If any serialization error occurs, including the detection of an invalid value for a\\n             serialization parameter, this results in the <code>fn:serialize</code> call failing with\\n             a dynamic error.</p></div>\\n',summary:\"<p>  This function serializes the supplied  input\\n                sequence \\n              $arg  as described in   ,\\n             returning the serialized  representation of the\\n                sequence  as a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"serialize\",qname:\"fn:serialize\",signature:\"($arg as item()*, $params as element(output:serialization-parameters)?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function serializes the supplied <phrase diff=\"chg\" at=\"G\">input\\n                sequence</phrase>\\n             <code>$arg</code> as described in <bibref ref=\"xslt-xquery-serialization-30\"/>,\\n             returning the serialized <phrase diff=\"chg\" at=\"G\">representation of the\\n                sequence</phrase> as a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"serialize\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example><example role=\"signature\"><proto name=\"serialize\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/><arg name=\"params\" type=\"element(output:serialization-parameters)?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The value of <code>$arg</code> acts as the input sequence to the serialization process,\\n             which starts with sequence normalization.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">The single-argument version of this function has the same effect as\\n             the two-argument version called with <code>$params</code> set to an empty sequence. This\\n             in turn is the same as the effect of passing an\\n                <code>output:serialization-parameters</code> element with no child elements.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">The <code>$params</code> argument is used to identify a set of\\n             serialization parameters. These are supplied in the form of an\\n                <code>output:serialization-parameters</code> element, having the format described in\\n                <xspecref spec=\"SER30\" ref=\"serparams-in-xdm-instance\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The final stage of serialization, that is, encoding, is skipped. If the serializer does\\n             not allow this phase to be skipped, then the sequence of octets returned by the\\n             serializer is decoded into a string by reversing the character encoding performed in the\\n             final stage.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">If the host language makes serialization an optional feature and\\n          the implementation does not support serialization, then a dynamic error\\n             <errorref class=\"DC\" code=\"0010\"/> is raised.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The serialization process will raise an error if <code>$arg</code> is an attribute or\\n             namespace node.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If any serialization error occurs, including the detection of an invalid value for a\\n             serialization parameter, this results in the <code>fn:serialize</code> call failing with\\n             a dynamic error.</p></div>\\n',summary:\"<p>  This function serializes the supplied  input\\n                sequence \\n              $arg  as described in   ,\\n             returning the serialized  representation of the\\n                sequence  as a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"params\",type:\"element(output:serialization-parameters)\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"starts-with\",qname:\"fn:starts-with\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             leading substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"starts-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"starts-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>. If the value of <code>$arg1</code> is the zero-length string and\\n             the value of <code>$arg2</code> is not the zero-length string, then the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> starts with a sequence of collation units that provides a\\n                <term>match</term> to the collation units of <code>$arg2</code> according to the\\n             collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Match</term> is defined in <bibref ref=\"Unicode-Collations\"/>.</p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             leading substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"starts-with\",qname:\"fn:starts-with\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns true if the string <code>$arg1</code> contains <code>$arg2</code> as a\\n             leading substring, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"starts-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"starts-with\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n                <code>true</code>. If the value of <code>$arg1</code> is the zero-length string and\\n             the value of <code>$arg2</code> is not the zero-length string, then the function returns\\n                <code>false</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:boolean</code> indicating whether or not the value of\\n                <code>$arg1</code> starts with a sequence of collation units that provides a\\n                <term>match</term> to the collation units of <code>$arg2</code> according to the\\n             collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Match</term> is defined in <bibref ref=\"Unicode-Collations\"/>.</p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns true if the string  $arg1  contains  $arg2  as a\\n             leading substring, taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"static-base-uri\",qname:\"fn:static-base-uri\",signature:\"() as xs:anyURI? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function returns the value of the Static Base URI property from the static context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"static-base-uri\" return-type=\"xs:anyURI?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of the Static Base URI property from the static context. If the\\n             property is absent, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Components of the static context are discussed in <xspecref spec=\"XP30\" ref=\"static_context\"/> .</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">XQuery 3.0 and XSLT 3.0 give an implementation freedom to use different base URIs during the\\n          static analysis phase and the dynamic evaluation phase, that is, for compile-time and run-time resources respectively.\\n          In this situation, the <code>fn:static-base-uri</code> function should return a URI suitable for locating resources needed\\n          during dynamic evaluation.</p></div>\\n',summary:\"<p>  This function returns the value of the Static Base URI property from the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"string-join\",qname:\"fn:string-join\",signature:\"($arg1 as xs:string*) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string created by concatenating the items in a sequence, with a\\n             defined separator between adjacent items.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-join\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"string-join\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string*\"/><arg name=\"arg2\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The effect of calling the single-argument version of this function is\\n             the same as calling the two-argument version with <code>$arg2</code> set to a\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:string</code> created by concatenating the items in the\\n             sequence <code>$arg1</code>, in order, using the value of <code>$arg2</code> as a\\n             separator between adjacent items. If the value of <code>$arg2</code> is the zero-length\\n             string, then the members of <code>$arg1</code> are concatenated without a separator.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> is the empty sequence, the function returns the\\n             zero-length string.</p></div>\\n',summary:\"<p>  Returns a string created by concatenating the items in a sequence, with a\\n             defined separator between adjacent items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"string-join\",qname:\"fn:string-join\",signature:\"($arg1 as xs:string*, $arg2 as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a string created by concatenating the items in a sequence, with a\\n             defined separator between adjacent items.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-join\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string*\"/></proto></example><example role=\"signature\"><proto name=\"string-join\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string*\"/><arg name=\"arg2\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"B\">The effect of calling the single-argument version of this function is\\n             the same as calling the two-argument version with <code>$arg2</code> set to a\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:string</code> created by concatenating the items in the\\n             sequence <code>$arg1</code>, in order, using the value of <code>$arg2</code> as a\\n             separator between adjacent items. If the value of <code>$arg2</code> is the zero-length\\n             string, then the members of <code>$arg1</code> are concatenated without a separator.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> is the empty sequence, the function returns the\\n             zero-length string.</p></div>\\n',summary:\"<p>  Returns a string created by concatenating the items in a sequence, with a\\n             defined separator between adjacent items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"string-length\",qname:\"fn:string-length\",signature:\"() as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of <termref def=\"character\">characters</termref> in a\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-length\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"string-length\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:integer</code> equal to the length in <termref def=\"character\">characters</termref> of the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the zero-argument version of the function is equivalent to calling\\n                <code>fn:string-length(fn:string(.))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n                <code>xs:integer</code> value zero (0).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not specified and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, a <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised: <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/>.</p></div>\\n',summary:\"<p>  Returns the number of  characters  in a\\n             string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"string-length\",qname:\"fn:string-length\",signature:\"($arg as xs:string?) as xs:integer external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of <termref def=\"character\">characters</termref> in a\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-length\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"string-length\" return-type=\"xs:integer\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns an <code>xs:integer</code> equal to the length in <termref def=\"character\">characters</termref> of the value of <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Calling the zero-argument version of the function is equivalent to calling\\n                <code>fn:string-length(fn:string(.))</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n                <code>xs:integer</code> value zero (0).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is not specified and the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>, a <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised: <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"dynamic\"/>.</p></div>\\n',summary:\"<p>  Returns the number of  characters  in a\\n             string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"string-to-codepoints\",qname:\"fn:string-to-codepoints\",signature:\"($arg as xs:string?) as xs:integer* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of <termref def=\"codepoint\">codepoints</termref> that\\n             constitute an <code>xs:string</code> value. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-to-codepoints\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of integers, each integer being the Unicode <termref def=\"codepoint\">codepoints</termref> of the corresponding <termref def=\"character\">character</termref> in <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a zero-length string or the empty sequence, the function returns\\n             the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:string-to-codepoints(\"Thérèse\")</code> returns <code>(84, 104, 233, 114, 232, 115, 101)</code>.</p></div>\\n',summary:\"<p>  Returns the sequence of  codepoints  that\\n             constitute an  xs:string  value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"string-to-codepoints\",qname:\"fn:string-to-codepoints\",signature:\"($arg as xs:string?) as xs:integer* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sequence of <termref def=\"codepoint\">codepoints</termref> that\\n             constitute an <code>xs:string</code> value. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string-to-codepoints\" return-type=\"xs:integer*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of integers, each integer being the Unicode <termref def=\"codepoint\">codepoints</termref> of the corresponding <termref def=\"character\">character</termref> in <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a zero-length string or the empty sequence, the function returns\\n             the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:string-to-codepoints(\"Thérèse\")</code> returns <code>(84, 104, 233, 114, 232, 115, 101)</code>.</p></div>\\n',summary:\"<p>  Returns the sequence of  codepoints  that\\n             constitute an  xs:string  value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"string\",qname:\"fn:string\",signature:\"() as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> represented as an\\n             <code>xs:string</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the zero-argument version of the function, <code>$arg</code> defaults to the context\\n             item. That is, calling <code>fn:string()</code> is equivalent to calling\\n                <code>fn:string(.)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a node, the function returns the string-value of the node, as\\n             obtained using the <code>dm:string-value</code> accessor defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-string-value\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an atomic value, the function returns the result of the\\n             expression <code>$arg cast as xs:string</code> (see <specref ref=\"casting\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"type\"/> by the\\n             zero-argument version of the function if the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0014\" type=\"type\"/> if\\n                <code>$arg</code> is a function item. </p></div>\\n',summary:\"<p>  Returns the value of  $arg  represented as an\\n              xs:string .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"string\",qname:\"fn:string\",signature:\"($arg as item()?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> represented as an\\n             <code>xs:string</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"string\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-dependent\">focus-dependent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The one-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the zero-argument version of the function, <code>$arg</code> defaults to the context\\n             item. That is, calling <code>fn:string()</code> is equivalent to calling\\n                <code>fn:string(.)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a node, the function returns the string-value of the node, as\\n             obtained using the <code>dm:string-value</code> accessor defined in <bibref ref=\"xpath-datamodel-30\"/> (see <xspecref spec=\"DM30\" ref=\"dm-string-value\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an atomic value, the function returns the result of the\\n             expression <code>$arg cast as xs:string</code> (see <specref ref=\"casting\"/>).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"M\">dynamic</phrase> error is raised <xerrorref spec=\"XP\" class=\"DY\" code=\"0002\" type=\"type\"/> by the\\n             zero-argument version of the function if the context item is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">type</phrase> error is raised <errorref class=\"TY\" code=\"0014\" type=\"type\"/> if\\n                <code>$arg</code> is a function item. </p></div>\\n',summary:\"<p>  Returns the value of  $arg  represented as an\\n              xs:string .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"subsequence\",qname:\"fn:subsequence\",signature:\"($sourceSeq as item()*, $startingLoc as xs:double) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the contiguous sequence of items in the value of\\n                <code>$sourceSeq</code> beginning at the position indicated by the value of\\n                <code>$startingLoc</code> and continuing for the number of items indicated by the\\n             value of <code>$length</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"subsequence\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceSeq\" type=\"item()*\"/><arg name=\"startingLoc\" type=\"xs:double\"/></proto></example><example role=\"signature\"><proto name=\"subsequence\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceSeq\" type=\"item()*\"/><arg name=\"startingLoc\" type=\"xs:double\"/><arg name=\"length\" type=\"xs:double\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the two-argument case, returns:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E2\" xml:space=\"preserve\">$sourceSeq[fn:round($startingLoc) le position()]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the three-argument case, returns:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E2\" xml:space=\"preserve\">$sourceSeq[fn:round($startingLoc) le position()\\n          and position() lt fn:round($startingLoc) + fn:round($length)]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first item of a sequence is located at position 1, not position 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$sourceSeq</code> is the empty sequence, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$startingLoc</code> is zero or negative, the subsequence includes items from\\n             the beginning of the <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$length</code> is not specified, the subsequence includes items to the end of\\n                <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$length</code> is greater than the number of items in the value of\\n                <code>$sourceSeq</code> following <code>$startingLoc</code>, the subsequence includes\\n             items to the end of <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">As an exception to the previous two notes, if\\n                <code>$startingLoc</code> is <code>-INF</code> and <code>$length</code> is\\n                <code>+INF</code>, then <code>fn:round($startingLoc) + fn:round($length)</code> is\\n                <code>NaN</code>; since <code>position() lt NaN</code> is always false, the result is\\n             an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The reason the function accepts arguments of type <code>xs:double</code> is that many\\n             computations on untyped data return an <code>xs:double</code> result; and the reason for\\n             the rounding rules is to compensate for any imprecision in these floating-point\\n             computations.</p></div>\\n',summary:\"<p>  Returns the contiguous sequence of items in the value of\\n                 $sourceSeq  beginning at the position indicated by the value of\\n                 $startingLoc  and continuing for the number of items indicated by the\\n             value of  $length .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sourceSeq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"startingLoc\",type:\"xs:double\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"subsequence\",qname:\"fn:subsequence\",signature:\"($sourceSeq as item()*, $startingLoc as xs:double, $length as xs:double) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the contiguous sequence of items in the value of\\n                <code>$sourceSeq</code> beginning at the position indicated by the value of\\n                <code>$startingLoc</code> and continuing for the number of items indicated by the\\n             value of <code>$length</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"subsequence\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceSeq\" type=\"item()*\"/><arg name=\"startingLoc\" type=\"xs:double\"/></proto></example><example role=\"signature\"><proto name=\"subsequence\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceSeq\" type=\"item()*\"/><arg name=\"startingLoc\" type=\"xs:double\"/><arg name=\"length\" type=\"xs:double\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the two-argument case, returns:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E2\" xml:space=\"preserve\">$sourceSeq[fn:round($startingLoc) le position()]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the three-argument case, returns:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"A-E2\" xml:space=\"preserve\">$sourceSeq[fn:round($startingLoc) le position()\\n          and position() lt fn:round($startingLoc) + fn:round($length)]</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first item of a sequence is located at position 1, not position 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$sourceSeq</code> is the empty sequence, the empty sequence is returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$startingLoc</code> is zero or negative, the subsequence includes items from\\n             the beginning of the <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$length</code> is not specified, the subsequence includes items to the end of\\n                <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If <code>$length</code> is greater than the number of items in the value of\\n                <code>$sourceSeq</code> following <code>$startingLoc</code>, the subsequence includes\\n             items to the end of <code>$sourceSeq</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"F\">As an exception to the previous two notes, if\\n                <code>$startingLoc</code> is <code>-INF</code> and <code>$length</code> is\\n                <code>+INF</code>, then <code>fn:round($startingLoc) + fn:round($length)</code> is\\n                <code>NaN</code>; since <code>position() lt NaN</code> is always false, the result is\\n             an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The reason the function accepts arguments of type <code>xs:double</code> is that many\\n             computations on untyped data return an <code>xs:double</code> result; and the reason for\\n             the rounding rules is to compensate for any imprecision in these floating-point\\n             computations.</p></div>\\n',summary:\"<p>  Returns the contiguous sequence of items in the value of\\n                 $sourceSeq  beginning at the position indicated by the value of\\n                 $startingLoc  and continuing for the number of items indicated by the\\n             value of  $length .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sourceSeq\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"startingLoc\",type:\"xs:double\",occurrence:null,description:\"\"},{name:\"length\",type:\"xs:double\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-after\",qname:\"fn:substring-after\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the part of <code>$arg1</code> that follows the first occurrence of\\n                <code>$arg2</code>, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring-after\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"substring-after\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n             the value of <code>$arg1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> does not contain a string that is equal to the value\\n             of <code>$arg2</code>, then the function returns the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the substring of the value of <code>$arg1</code> that follows in\\n             the value of <code>$arg1</code> the first occurrence of a sequence of collation units\\n             that provides a <term>minimal match</term> to the collation units of <code>$arg2</code>\\n             according to the collation that is used. </p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns the part of  $arg1  that follows the first occurrence of\\n                 $arg2 , taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"substring-after\",qname:\"fn:substring-after\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the part of <code>$arg1</code> that follows the first occurrence of\\n                <code>$arg2</code>, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring-after\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"substring-after\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n             the value of <code>$arg1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> does not contain a string that is equal to the value\\n             of <code>$arg2</code>, then the function returns the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the substring of the value of <code>$arg1</code> that follows in\\n             the value of <code>$arg1</code> the first occurrence of a sequence of collation units\\n             that provides a <term>minimal match</term> to the collation units of <code>$arg2</code>\\n             according to the collation that is used. </p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns the part of  $arg1  that follows the first occurrence of\\n                 $arg2 , taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-before\",qname:\"fn:substring-before\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the part of <code>$arg1</code> that precedes the first occurrence of\\n                <code>$arg2</code>, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring-before\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"substring-before\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n             the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> does not contain a string that is equal to the value\\n             of <code>$arg2</code>, then the function returns the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the substring of the value of <code>$arg1</code> that precedes in\\n             the value of <code>$arg1</code> the first occurrence of a sequence of collation units\\n             that provides a <term>minimal match</term> to the collation units of <code>$arg2</code>\\n             according to the collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns the part of  $arg1  that precedes the first occurrence of\\n                 $arg2 , taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"substring-before\",qname:\"fn:substring-before\",signature:\"($arg1 as xs:string?, $arg2 as xs:string?, $collation as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the part of <code>$arg1</code> that precedes the first occurrence of\\n                <code>$arg2</code>, taking collations into account.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring-before\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"substring-before\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg1\" type=\"xs:string?\"/><arg name=\"arg2\" type=\"xs:string?\"/><arg name=\"collation\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The three-argument form of this function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tcollations, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If the value of <code>$arg1</code> or <code>$arg2</code> is the empty sequence, or\\n             contains only ignorable collation units, it is interpreted as the zero-length\\n             string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg2</code> is the zero-length string, then the function returns\\n             the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg1</code> does not contain a string that is equal to the value\\n             of <code>$arg2</code>, then the function returns the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The collation used by this function is determined according to the rules in <specref ref=\"choosing-a-collation\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the substring of the value of <code>$arg1</code> that precedes in\\n             the value of <code>$arg1</code> the first occurrence of a sequence of collation units\\n             that provides a <term>minimal match</term> to the collation units of <code>$arg2</code>\\n             according to the collation that is used.</p><note xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><p><term>Minimal match</term> is defined in <bibref ref=\"Unicode-Collations\"/>. </p></note><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error <rfc2119>may</rfc2119> be raised <errorref class=\"CH\" code=\"0004\"/> if the\\n             specified collation does not support collation units.</p></div>\\n',summary:\"<p>  Returns the part of  $arg1  that precedes the first occurrence of\\n                 $arg2 , taking collations into account.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"collation\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring\",qname:\"fn:substring\",signature:\"($sourceString as xs:string?, $start as xs:double) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the portion of the value of <code>$sourceString</code> beginning at the\\n             position indicated by the value of <code>$start</code> and continuing for the number of\\n                <termref def=\"character\">characters</termref> indicated by the value of\\n                <code>$length</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceString\" type=\"xs:string?\"/><arg name=\"start\" type=\"xs:double\"/></proto></example><example role=\"signature\"><proto name=\"substring\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceString\" type=\"xs:string?\"/><arg name=\"start\" type=\"xs:double\"/><arg name=\"length\" type=\"xs:double\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$sourceString</code> is the empty sequence, the function returns\\n             the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns a string comprising those <termref def=\"character\">characters</termref> of <code>$sourceString</code> whose index position (counting\\n             from one) is greater than or equal to the value of <code>$start</code> (rounded to an\\n             integer), and (if <code>$length</code> is specified) less than the sum of\\n                <code>$start</code> and <code>$length</code> (both rounded to integers).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The characters returned do not extend beyond <code>$sourceString</code>. If\\n                <code>$start</code> is zero or negative, only those characters in positions greater\\n             than zero are returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the three argument version of the function returns the characters in\\n                <code>$sourceString</code> whose position <code>$p</code> satisfies:</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <code>fn:round($start) &lt;= $p &lt; fn:round($start) + fn:round($length)</code>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two argument version of the function assumes that <code>$length</code> is infinite\\n             and thus returns the <termref def=\"character\">characters</termref> in\\n                <code>$sourceString</code> whose position <code>$p</code> satisfies:</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <code>fn:round($start) &lt;= $p</code>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the above computations, the rules for <code>op:numeric-less-than</code> and\\n                <code>op:numeric-greater-than</code> apply.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first character of a string is located at position 1, not position 0.</p></div>\\n',summary:\"<p>  Returns the portion of the value of  $sourceString  beginning at the\\n             position indicated by the value of  $start  and continuing for the number of\\n                 characters  indicated by the value of\\n                 $length .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sourceString\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"start\",type:\"xs:double\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"substring\",qname:\"fn:substring\",signature:\"($sourceString as xs:string?, $start as xs:double, $length as xs:double) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the portion of the value of <code>$sourceString</code> beginning at the\\n             position indicated by the value of <code>$start</code> and continuing for the number of\\n                <termref def=\"character\">characters</termref> indicated by the value of\\n                <code>$length</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"substring\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceString\" type=\"xs:string?\"/><arg name=\"start\" type=\"xs:double\"/></proto></example><example role=\"signature\"><proto name=\"substring\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceString\" type=\"xs:string?\"/><arg name=\"start\" type=\"xs:double\"/><arg name=\"length\" type=\"xs:double\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$sourceString</code> is the empty sequence, the function returns\\n             the zero-length string. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns a string comprising those <termref def=\"character\">characters</termref> of <code>$sourceString</code> whose index position (counting\\n             from one) is greater than or equal to the value of <code>$start</code> (rounded to an\\n             integer), and (if <code>$length</code> is specified) less than the sum of\\n                <code>$start</code> and <code>$length</code> (both rounded to integers).</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The characters returned do not extend beyond <code>$sourceString</code>. If\\n                <code>$start</code> is zero or negative, only those characters in positions greater\\n             than zero are returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">More specifically, the three argument version of the function returns the characters in\\n                <code>$sourceString</code> whose position <code>$p</code> satisfies:</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <code>fn:round($start) &lt;= $p &lt; fn:round($start) + fn:round($length)</code>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The two argument version of the function assumes that <code>$length</code> is infinite\\n             and thus returns the <termref def=\"character\">characters</termref> in\\n                <code>$sourceString</code> whose position <code>$p</code> satisfies:</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">\\n             <code>fn:round($start) &lt;= $p</code>\\n          </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In the above computations, the rules for <code>op:numeric-less-than</code> and\\n                <code>op:numeric-greater-than</code> apply.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The first character of a string is located at position 1, not position 0.</p></div>\\n',summary:\"<p>  Returns the portion of the value of  $sourceString  beginning at the\\n             position indicated by the value of  $start  and continuing for the number of\\n                 characters  indicated by the value of\\n                 $length .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sourceString\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"start\",type:\"xs:double\",occurrence:null,description:\"\"},{name:\"length\",type:\"xs:double\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sum\",qname:\"fn:sum\",signature:\"($arg as xs:anyAtomicType*) as xs:anyAtomicType external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value obtained by adding together the values in\\n             <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"sum\" return-type=\"xs:anyAtomicType\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"sum\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"zero\" type=\"xs:anyAtomicType?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Any values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                <code>xs:double</code>. The items in the resulting sequence may be reordered in an\\n             arbitrary order. The resulting sequence is referred to below as the converted\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, then the single-argument form of the function\\n             returns the <code>xs:integer</code> value <code>0</code>; the two-argument form returns\\n             the value of the argument <code>$zero</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, <code>NaN</code> is\\n             returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in <code>$arg</code> must be numeric or derived from a single base type. In\\n             addition, the type must support addition. Duration values must either all be\\n                <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values. For numeric values, the numeric promotion\\n             rules defined in <specref ref=\"op.numeric\"/> are used to promote all values to a single\\n             common type. The sum of a sequence of integers will therefore be an integer, while the\\n             sum of a numeric sequence that includes at least one <code>xs:double</code> will be an\\n                <code>xs:double</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function, using the second signature, is the result of the\\n             expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n if (fn:count($c) eq 0) then\\n     $zero\\n else if (fn:count($c) eq 1) then\\n     $c[1]\\n else\\n     $c[1] + fn:sum(subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">where <code>$c</code> is the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function, using the first signature, is the result of the expression:\\n                <code>fn:sum($arg, 0)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value obtained by adding together the values in\\n              $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:anyAtomicType\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"sum\",qname:\"fn:sum\",signature:\"($arg as xs:anyAtomicType*, $zero as xs:anyAtomicType?) as xs:anyAtomicType? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a value obtained by adding together the values in\\n             <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"sum\" return-type=\"xs:anyAtomicType\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/></proto></example><example role=\"signature\"><proto name=\"sum\" return-type=\"xs:anyAtomicType?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:anyAtomicType*\"/><arg name=\"zero\" type=\"xs:anyAtomicType?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Any values of type <code>xs:untypedAtomic</code> in <code>$arg</code> are cast to\\n                <code>xs:double</code>. The items in the resulting sequence may be reordered in an\\n             arbitrary order. The resulting sequence is referred to below as the converted\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence is empty, then the single-argument form of the function\\n             returns the <code>xs:integer</code> value <code>0</code>; the two-argument form returns\\n             the value of the argument <code>$zero</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the converted sequence contains the value <code>NaN</code>, <code>NaN</code> is\\n             returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">All items in <code>$arg</code> must be numeric or derived from a single base type. In\\n             addition, the type must support addition. Duration values must either all be\\n                <code>xs:yearMonthDuration</code> values or must all be\\n                <code>xs:dayTimeDuration</code> values. For numeric values, the numeric promotion\\n             rules defined in <specref ref=\"op.numeric\"/> are used to promote all values to a single\\n             common type. The sum of a sequence of integers will therefore be an integer, while the\\n             sum of a numeric sequence that includes at least one <code>xs:double</code> will be an\\n                <code>xs:double</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function, using the second signature, is the result of the\\n             expression:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\">\\n if (fn:count($c) eq 0) then\\n     $zero\\n else if (fn:count($c) eq 1) then\\n     $c[1]\\n else\\n     $c[1] + fn:sum(subsequence($c, 2))</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">where <code>$c</code> is the converted sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function, using the first signature, is the result of the expression:\\n                <code>fn:sum($arg, 0)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A type error is raised <errorref class=\"RG\" code=\"0006\"/> if the input sequence contains\\n             items of incompatible types, as described above.</p></div>\\n',summary:\"<p>  Returns a value obtained by adding together the values in\\n              $arg .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:\"\"},{name:\"zero\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"tail\",qname:\"fn:tail\",signature:\"($arg as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns all but the first item in a sequence. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"tail\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of the expression <code>subsequence($arg, 2)</code></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, or a sequence containing a single item, then\\n             the empty sequence is returned. </p></div>\\n',summary:\"<p>  Returns all but the first item in a sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-date\",qname:\"fn:timezone-from-date\",signature:\"($arg as xs:date?) as xs:dayTimeDuration? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the timezone component of an <code>xs:date</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"timezone-from-date\" return-type=\"xs:dayTimeDuration?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the timezone component of <code>$arg</code>, if any. If\\n                <code>$arg</code> has a timezone component, then the result is an\\n                <code>xs:dayTimeDuration</code> that indicates deviation from UTC; its value may\\n             range from +14:00 to -14:00 hours, both inclusive. If <code>$arg</code> has no timezone\\n             component, the result is the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-date(xs:date(\"1999-05-31-05:00\"))</code> returns <code>xs:dayTimeDuration(\"-PT5H\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-date(xs:date(\"2000-06-12Z\"))</code> returns <code>xs:dayTimeDuration(\"PT0S\")</code>.</p></div>\\n',summary:\"<p>  Returns the timezone component of an  xs:date .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dayTimeDuration?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-dateTime\",qname:\"fn:timezone-from-dateTime\",signature:\"($arg as xs:dateTime?) as xs:dayTimeDuration? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the timezone component of an <code>xs:dateTime</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"timezone-from-dateTime\" return-type=\"xs:dayTimeDuration?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:dateTime?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the timezone component of <code>$arg</code>, if any. If\\n                <code>$arg</code> has a timezone component, then the result is an\\n                <code>xs:dayTimeDuration</code> that indicates deviation from UTC; its value may\\n             range from +14:00 to -14:00 hours, both inclusive. If <code>$arg</code> has no timezone\\n             component, the result is the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-dateTime(xs:dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>xs:dayTimeDuration(\"-PT5H\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-dateTime(xs:dateTime(\"2000-06-12T13:20:00Z\"))</code> returns <code>xs:dayTimeDuration(\"PT0S\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-dateTime(xs:dateTime(\"2004-08-27T00:00:00\"))</code> returns <code>()</code>.</p></div>\\n',summary:\"<p>  Returns the timezone component of an  xs:dateTime .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dayTimeDuration?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-time\",qname:\"fn:timezone-from-time\",signature:\"($arg as xs:time?) as xs:dayTimeDuration? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the timezone component of an <code>xs:time</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"timezone-from-time\" return-type=\"xs:dayTimeDuration?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:time?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the timezone component of <code>$arg</code>, if any. If\\n                <code>$arg</code> has a timezone component, then the result is an\\n                <code>xs:dayTimeDuration</code> that indicates deviation from UTC; its value may\\n             range from +14:00 to -14:00 hours, both inclusive. If <code>$arg</code> has no timezone\\n             component, the result is the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-time(xs:time(\"13:20:00-05:00\"))</code> returns <code>xs:dayTimeDuration(\"-PT5H\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:timezone-from-time(xs:time(\"13:20:00\"))</code> returns <code>()</code>.</p></div>\\n',summary:\"<p>  Returns the timezone component of an  xs:time .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:time\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:dayTimeDuration?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"tokenize\",qname:\"fn:tokenize\",signature:\"($input as xs:string?, $pattern as xs:string) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of strings constructed by splitting the input wherever a\\n             separator is found; the separator is any substring that matches a given regular\\n             expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"tokenize\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"tokenize\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same way as for the\\n                <code>fn:matches</code> function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, or if <code>$input</code> is the\\n             zero-length string, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of strings formed by breaking the <code>$input</code>\\n             string into a sequence of strings, treating any substring that matches\\n                <code>$pattern</code> as a separator. The separators themselves are not returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If a separator occurs at the start of the <code>$input</code> string, the result\\n             sequence will start with a zero-length string. Zero-length strings will also occur in\\n             the result sequence if a separator occurs at the end of the <code>$input</code> string,\\n             or if two adjacent substrings match the supplied <code>$pattern</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If two alternatives within the supplied <code>$pattern</code> both match at the same\\n             position in the <code>$input</code> string, then the match that is chosen is the first.\\n             For example:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:tokenize(\"abracadabra\", \"(ab)|(a)\") returns (\"\", \"r\", \"c\", \"d\", \"r\", \"\")</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the supplied\\n                <code>$pattern</code> matches a zero-length string, that is, if <code>fn:matches(\"\",\\n                $pattern, $flags)</code> returns <code>true</code>. </p></div>\\n',summary:\"<p>  Returns a sequence of strings constructed by splitting the input wherever a\\n             separator is found; the separator is any substring that matches a given regular\\n             expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"tokenize\",qname:\"fn:tokenize\",signature:\"($input as xs:string?, $pattern as xs:string, $flags as xs:string) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of strings constructed by splitting the input wherever a\\n             separator is found; the separator is any substring that matches a given regular\\n             expression.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"tokenize\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/></proto></example><example role=\"signature\"><proto name=\"tokenize\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"input\" type=\"xs:string?\"/><arg name=\"pattern\" type=\"xs:string\"/><arg name=\"flags\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The effect of calling the first version of this function (omitting the argument\\n                <code>$flags</code>) is the same as the effect of calling the second version with the\\n                <code>$flags</code> argument set to a zero-length string. Flags are defined in\\n                <specref ref=\"flags\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$flags</code> argument is interpreted in the same way as for the\\n                <code>fn:matches</code> function.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$input</code> is the empty sequence, or if <code>$input</code> is the\\n             zero-length string, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns a sequence of strings formed by breaking the <code>$input</code>\\n             string into a sequence of strings, treating any substring that matches\\n                <code>$pattern</code> as a separator. The separators themselves are not returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If a separator occurs at the start of the <code>$input</code> string, the result\\n             sequence will start with a zero-length string. Zero-length strings will also occur in\\n             the result sequence if a separator occurs at the end of the <code>$input</code> string,\\n             or if two adjacent substrings match the supplied <code>$pattern</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> If two alternatives within the supplied <code>$pattern</code> both match at the same\\n             position in the <code>$input</code> string, then the match that is chosen is the first.\\n             For example:</p><eg xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" xml:space=\"preserve\"> fn:tokenize(\"abracadabra\", \"(ab)|(a)\") returns (\"\", \"r\", \"c\", \"d\", \"r\", \"\")</eg><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0002\"/> if the value of\\n                <code>$pattern</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0001\"/> if the value of\\n                <code>$flags</code> is invalid according to the rules described in section <specref ref=\"regex-syntax\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RX\" code=\"0003\"/> if the supplied\\n                <code>$pattern</code> matches a zero-length string, that is, if <code>fn:matches(\"\",\\n                $pattern, $flags)</code> returns <code>true</code>. </p></div>\\n',summary:\"<p>  Returns a sequence of strings constructed by splitting the input wherever a\\n             separator is found; the separator is any substring that matches a given regular\\n             expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"flags\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"trace\",qname:\"fn:trace\",signature:\"($value as item()*, $label as xs:string) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Provides an execution trace intended to be used in debugging queries.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"trace\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"value\" type=\"item()*\"/><arg name=\"label\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the value of <code>$value</code>, unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In addition, the values of <code>$value</code>, converted to an <code>xs:string</code>,\\n             and <code>$label</code>\\n             <rfc2119>may</rfc2119> be directed to a trace data set. The destination of the trace\\n             output is <termref def=\"implementation-defined\"/>. The format of the trace output is\\n                <termref def=\"implementation-dependent\"/>. The ordering of output from calls of the\\n                <code>fn:trace</code> function is <termref def=\"implementation-dependent\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Consider a situation in which a user wants to investigate the actual value passed to\\n                a function. Assume that in a particular execution, <code>$v</code> is an\\n                   <code>xs:decimal</code> with value <code>124.84</code>. Writing <code>fn:trace($v,\\n                   \\'the value of $v is:\\')</code> will put the strings <code>\"124.84\"</code> and\\n                   <code>\"the value of $v is:\"</code> in the trace data set in implementation\\n                dependent order.</p></div>\\n',summary:\"<p>  Provides an execution trace intended to be used in debugging queries.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"label\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"translate\",qname:\"fn:translate\",signature:\"($arg as xs:string?, $mapString as xs:string, $transString as xs:string) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>$arg</code> modified by replacing or removing\\n             individual characters. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"translate\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/><arg name=\"mapString\" type=\"xs:string\"/><arg name=\"transString\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the function returns the\\n             zero-length string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns a result string constructed by processing each <termref def=\"character\">character</termref> in the value of <code>$arg</code>, in order,\\n             according to the following rules:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>If the character does not appear in the value of <code>$mapString</code> then it\\n                   is added to the result string unchanged.</p></item><item><p>If the character first appears in the value of <code>$mapString</code> at some\\n                   position <emph>M</emph>, where the value of <code>$transString</code> is\\n                      <emph>M</emph> or more characters in length, then the character at position\\n                      <emph>M</emph> in <code>$transString</code> is added to the result string.</p></item><item><p>If the character first appears in the value of <code>$mapString</code> at some\\n                   position <emph>M</emph>, where the value of <code>$transString</code> is less than\\n                      <emph>M</emph> characters in length, then the character is omitted from the\\n                   result string.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$mapString</code> is the zero-length string then the function returns\\n                <code>$arg</code> unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If a character occurs more than once in <code>$mapString</code>, then the first\\n             occurrence determines the action taken.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$transString</code> is longer than <code>$mapString</code>, the excess\\n             characters are ignored.</p></div>\\n',summary:\"<p>  Returns the value of  $arg  modified by replacing or removing\\n             individual characters.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"mapString\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"transString\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"true\",qname:\"fn:true\",signature:\"() as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the <code>xs:boolean</code> value <code>true</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"true\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result is equivalent to <code>xs:boolean(\"1\")</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:true()</code> returns <code>xs:boolean(1)</code>.</p></div>\\n',summary:\"<p>  Returns the  xs:boolean  value  true .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unordered\",qname:\"fn:unordered\",signature:\"($sourceSeq as item()*) as item()* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the items of <code>$sourceSeq</code> in an <termref def=\"implementation-dependent\"/> order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unordered\" return-type=\"item()*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"sourceSeq\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The function returns the items of <code>$sourceSeq</code> in an <termref def=\"implementation-dependent\"/> order.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Query optimizers may be able to do a better job if the order of the output sequence is\\n             not specified. For example, when retrieving prices from a purchase order, if an index\\n             exists on prices, it may be more efficient to return the prices in index order rather\\n             than in document order.</p></div>\\n',summary:\"<p>  Returns the items of  $sourceSeq  in an    order.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sourceSeq\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unparsed-text-available\",qname:\"fn:unparsed-text-available\",signature:\"($href as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Because errors in evaluating the <function>fn:unparsed-text</function> function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <function>fn:unparsed-text-available</function> function determines whether a call\\n             on the <function>fn:unparsed-text</function> function with identical arguments would\\n             return a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the first argument is an empty sequence, the function returns false. <phrase diff=\"del\" at=\"L\">If the second\\n             argument is an empty sequence, the function behaves as if the second argument were\\n             omitted.</phrase></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns true if a call on\\n                <function>fn:unparsed-text</function> with the same arguments would succeed, and\\n             false if a call on <function>fn:unparsed-text</function> with the same arguments would\\n             fail with a non-recoverable dynamic error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The functions <function>fn:unparsed-text</function> and\\n                <function>fn:unparsed-text-available</function> have the same requirement for\\n                <termref def=\"deterministic\">determinism</termref> as the functions\\n                <code>fn:doc</code> and <code>fn:doc-available</code>. This means that unless the\\n             user has explicitly stated a requirement for a reduced level of determinism, either of\\n             these functions if called twice with the same arguments during the course of a\\n             transformation <rfc2119>must</rfc2119> return the same results each time; moreover, the\\n             results of a call on <function>fn:unparsed-text-available</function>\\n             <rfc2119>must</rfc2119> be consistent with the results of a subsequent call on\\n                <function>unparsed-text</function> with the same arguments.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This requires that the <function>unparsed-text-available</function> function should\\n             actually attempt to read the resource identified by the URI, and check that it is\\n             correctly encoded and contains no characters that are invalid in XML. Implementations\\n             may avoid the cost of repeating these checks for example by caching the validated\\n             contents of the resource, to anticipate a subsequent call on the\\n                <function>unparsed-text</function>\\n             <phrase diff=\"add\" at=\"A\">or <function>unparsed-text-lines</function>\\n             </phrase> function. Alternatively, implementations may be able to rewrite an expression\\n             such as <code>if (unparsed-text-available(A)) then unparsed-text(A) else ...</code> to\\n             generate a single call internally.</p></div>\\n',summary:\"<p>  Because errors in evaluating the  fn:unparsed-text  function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unparsed-text-available\",qname:\"fn:unparsed-text-available\",signature:\"($href as xs:string?) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Because errors in evaluating the <function>fn:unparsed-text</function> function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <function>fn:unparsed-text-available</function> function determines whether a call\\n             on the <function>fn:unparsed-text</function> function with identical arguments would\\n             return a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the first argument is an empty sequence, the function returns false. <phrase diff=\"del\" at=\"L\">If the second\\n             argument is an empty sequence, the function behaves as if the second argument were\\n             omitted.</phrase></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns true if a call on\\n                <function>fn:unparsed-text</function> with the same arguments would succeed, and\\n             false if a call on <function>fn:unparsed-text</function> with the same arguments would\\n             fail with a non-recoverable dynamic error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The functions <function>fn:unparsed-text</function> and\\n                <function>fn:unparsed-text-available</function> have the same requirement for\\n                <termref def=\"deterministic\">determinism</termref> as the functions\\n                <code>fn:doc</code> and <code>fn:doc-available</code>. This means that unless the\\n             user has explicitly stated a requirement for a reduced level of determinism, either of\\n             these functions if called twice with the same arguments during the course of a\\n             transformation <rfc2119>must</rfc2119> return the same results each time; moreover, the\\n             results of a call on <function>fn:unparsed-text-available</function>\\n             <rfc2119>must</rfc2119> be consistent with the results of a subsequent call on\\n                <function>unparsed-text</function> with the same arguments.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This requires that the <function>unparsed-text-available</function> function should\\n             actually attempt to read the resource identified by the URI, and check that it is\\n             correctly encoded and contains no characters that are invalid in XML. Implementations\\n             may avoid the cost of repeating these checks for example by caching the validated\\n             contents of the resource, to anticipate a subsequent call on the\\n                <function>unparsed-text</function>\\n             <phrase diff=\"add\" at=\"A\">or <function>unparsed-text-lines</function>\\n             </phrase> function. Alternatively, implementations may be able to rewrite an expression\\n             such as <code>if (unparsed-text-available(A)) then unparsed-text(A) else ...</code> to\\n             generate a single call internally.</p></div>\\n',summary:\"<p>  Because errors in evaluating the  fn:unparsed-text  function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text-available\",qname:\"fn:unparsed-text-available\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Because errors in evaluating the <function>fn:unparsed-text</function> function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <function>fn:unparsed-text-available</function> function determines whether a call\\n             on the <function>fn:unparsed-text</function> function with identical arguments would\\n             return a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the first argument is an empty sequence, the function returns false. <phrase diff=\"del\" at=\"L\">If the second\\n             argument is an empty sequence, the function behaves as if the second argument were\\n             omitted.</phrase></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns true if a call on\\n                <function>fn:unparsed-text</function> with the same arguments would succeed, and\\n             false if a call on <function>fn:unparsed-text</function> with the same arguments would\\n             fail with a non-recoverable dynamic error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The functions <function>fn:unparsed-text</function> and\\n                <function>fn:unparsed-text-available</function> have the same requirement for\\n                <termref def=\"deterministic\">determinism</termref> as the functions\\n                <code>fn:doc</code> and <code>fn:doc-available</code>. This means that unless the\\n             user has explicitly stated a requirement for a reduced level of determinism, either of\\n             these functions if called twice with the same arguments during the course of a\\n             transformation <rfc2119>must</rfc2119> return the same results each time; moreover, the\\n             results of a call on <function>fn:unparsed-text-available</function>\\n             <rfc2119>must</rfc2119> be consistent with the results of a subsequent call on\\n                <function>unparsed-text</function> with the same arguments.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This requires that the <function>unparsed-text-available</function> function should\\n             actually attempt to read the resource identified by the URI, and check that it is\\n             correctly encoded and contains no characters that are invalid in XML. Implementations\\n             may avoid the cost of repeating these checks for example by caching the validated\\n             contents of the resource, to anticipate a subsequent call on the\\n                <function>unparsed-text</function>\\n             <phrase diff=\"add\" at=\"A\">or <function>unparsed-text-lines</function>\\n             </phrase> function. Alternatively, implementations may be able to rewrite an expression\\n             such as <code>if (unparsed-text-available(A)) then unparsed-text(A) else ...</code> to\\n             generate a single call internally.</p></div>\\n',summary:\"<p>  Because errors in evaluating the  fn:unparsed-text  function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text-available\",qname:\"fn:unparsed-text-available\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:boolean external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Because errors in evaluating the <function>fn:unparsed-text</function> function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-available\" return-type=\"xs:boolean\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <function>fn:unparsed-text-available</function> function determines whether a call\\n             on the <function>fn:unparsed-text</function> function with identical arguments would\\n             return a string.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the first argument is an empty sequence, the function returns false. <phrase diff=\"del\" at=\"L\">If the second\\n             argument is an empty sequence, the function behaves as if the second argument were\\n             omitted.</phrase></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases, the function returns true if a call on\\n                <function>fn:unparsed-text</function> with the same arguments would succeed, and\\n             false if a call on <function>fn:unparsed-text</function> with the same arguments would\\n             fail with a non-recoverable dynamic error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The functions <function>fn:unparsed-text</function> and\\n                <function>fn:unparsed-text-available</function> have the same requirement for\\n                <termref def=\"deterministic\">determinism</termref> as the functions\\n                <code>fn:doc</code> and <code>fn:doc-available</code>. This means that unless the\\n             user has explicitly stated a requirement for a reduced level of determinism, either of\\n             these functions if called twice with the same arguments during the course of a\\n             transformation <rfc2119>must</rfc2119> return the same results each time; moreover, the\\n             results of a call on <function>fn:unparsed-text-available</function>\\n             <rfc2119>must</rfc2119> be consistent with the results of a subsequent call on\\n                <function>unparsed-text</function> with the same arguments.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This requires that the <function>unparsed-text-available</function> function should\\n             actually attempt to read the resource identified by the URI, and check that it is\\n             correctly encoded and contains no characters that are invalid in XML. Implementations\\n             may avoid the cost of repeating these checks for example by caching the validated\\n             contents of the resource, to anticipate a subsequent call on the\\n                <function>unparsed-text</function>\\n             <phrase diff=\"add\" at=\"A\">or <function>unparsed-text-lines</function>\\n             </phrase> function. Alternatively, implementations may be able to rewrite an expression\\n             such as <code>if (unparsed-text-available(A)) then unparsed-text(A) else ...</code> to\\n             generate a single call internally.</p></div>\\n',summary:\"<p>  Because errors in evaluating the  fn:unparsed-text  function are\\n             non-recoverable, these two functions are provided to allow an application to determine\\n             whether a call with particular arguments would succeed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unparsed-text-lines\",qname:\"fn:unparsed-text-lines\",signature:\"($href as xs:string?) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text-lines</code> function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the  <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>unparsed-text-lines</code> function reads an external resource (for example, a\\n             file) and returns its <phrase diff=\"chg\" at=\"L\">string representation</phrase> as a sequence of strings, separated at newline\\n             boundaries. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the single-argument function is the same as the result of the expression\\n                <code>fn:tokenize(fn:unparsed-text($href), \\'\\\\r\\\\n|\\\\r|\\\\n\\')[not(position()=last() and\\n                .=\\'\\')]</code>. The result of the two-argument function is the same as the result of\\n             the expression <code>fn:tokenize(fn:unparsed-text($href, $encoding),\\n                \\'\\\\r\\\\n|\\\\r|\\\\n\\'))[not(position()=last() and .=\\'\\')]</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result is a thus a sequence of strings containing the text of the resource retrieved\\n             using the URI, each string representing one line of text. Lines are separated by one of\\n             the sequences x0A, x0D, or x0Dx0A. The characters representing the newline are not\\n             included in the returned strings. If there are two adjacent newline sequences, a\\n             zero-length string will be returned to represent the empty line; but if the external\\n             resource ends with a newline sequence, no zero-length string will be returned as the\\n             last item in the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Error conditions are the same as for the <code>fn:unparsed-text</code> function.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text-lines  function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the   string representation  of the resource.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text-lines\",qname:\"fn:unparsed-text-lines\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text-lines</code> function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the  <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>unparsed-text-lines</code> function reads an external resource (for example, a\\n             file) and returns its <phrase diff=\"chg\" at=\"L\">string representation</phrase> as a sequence of strings, separated at newline\\n             boundaries. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the single-argument function is the same as the result of the expression\\n                <code>fn:tokenize(fn:unparsed-text($href), \\'\\\\r\\\\n|\\\\r|\\\\n\\')[not(position()=last() and\\n                .=\\'\\')]</code>. The result of the two-argument function is the same as the result of\\n             the expression <code>fn:tokenize(fn:unparsed-text($href, $encoding),\\n                \\'\\\\r\\\\n|\\\\r|\\\\n\\'))[not(position()=last() and .=\\'\\')]</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result is a thus a sequence of strings containing the text of the resource retrieved\\n             using the URI, each string representing one line of text. Lines are separated by one of\\n             the sequences x0A, x0D, or x0Dx0A. The characters representing the newline are not\\n             included in the returned strings. If there are two adjacent newline sequences, a\\n             zero-length string will be returned to represent the empty line; but if the external\\n             resource ends with a newline sequence, no zero-length string will be returned as the\\n             last item in the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Error conditions are the same as for the <code>fn:unparsed-text</code> function.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text-lines  function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the   string representation  of the resource.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text-lines\",qname:\"fn:unparsed-text-lines\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:string* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text-lines</code> function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the  <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text-lines\" return-type=\"xs:string*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>unparsed-text-lines</code> function reads an external resource (for example, a\\n             file) and returns its <phrase diff=\"chg\" at=\"L\">string representation</phrase> as a sequence of strings, separated at newline\\n             boundaries. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the single-argument function is the same as the result of the expression\\n                <code>fn:tokenize(fn:unparsed-text($href), \\'\\\\r\\\\n|\\\\r|\\\\n\\')[not(position()=last() and\\n                .=\\'\\')]</code>. The result of the two-argument function is the same as the result of\\n             the expression <code>fn:tokenize(fn:unparsed-text($href, $encoding),\\n                \\'\\\\r\\\\n|\\\\r|\\\\n\\'))[not(position()=last() and .=\\'\\')]</code>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result is a thus a sequence of strings containing the text of the resource retrieved\\n             using the URI, each string representing one line of text. Lines are separated by one of\\n             the sequences x0A, x0D, or x0Dx0A. The characters representing the newline are not\\n             included in the returned strings. If there are two adjacent newline sequences, a\\n             zero-length string will be returned to represent the empty line; but if the external\\n             resource ends with a newline sequence, no zero-length string will be returned as the\\n             last item in the result.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Error conditions are the same as for the <code>fn:unparsed-text</code> function.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text-lines  function reads an external resource (for\\n             example, a file) and returns its contents as a sequence of strings, one for each line of\\n             text in the   string representation  of the resource.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unparsed-text\",qname:\"fn:unparsed-text\",signature:\"($href as xs:string?) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text</code> function reads an external resource (for example, a\\n             file) and returns <phrase diff=\"chg\" at=\"L\">a string representation of the resource</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$href</code> argument <rfc2119>must</rfc2119> be a string in the form of a URI\\n             reference, which <rfc2119>must</rfc2119> contain no fragment identifier, and\\n                <rfc2119>must</rfc2119> identify a resource\\n             <phrase diff=\"chg\" at=\"L\">for which a string representation is available</phrase>. If the URI is a\\n             relative URI reference, then it is resolved relative to the\\n             <phrase diff=\"chg\" at=\"L\">Static Base URI property from the static context</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The mapping of URIs to the string representation of a resource is the mapping defined\\n             in the <xtermref spec=\"XP30\" ref=\"dt-available-text-resources\">available text resources</xtermref>\\n          component of the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of the <code>$href</code> argument is an empty sequence, the function\\n             returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$encoding</code> argument, if present, is the name of an encoding. The values\\n             for this attribute follow the same rules as for the <code>encoding</code> attribute in\\n             an XML declaration. The only values which every <termref def=\"implementation\">implementation</termref> is <rfc2119>required</rfc2119> to recognize are\\n                <code>utf-8</code> and <code>utf-16</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The encoding of the external resource is determined as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>external encoding information is used if available, otherwise</p></item><item><p>if the media type of the resource is <code>text/xml</code> or\\n                      <code>application/xml</code> (see <bibref ref=\"rfc2376\"/>), or if it matches\\n                   the conventions <code>text/*+xml</code> or <code>application/*+xml</code> (see\\n                      <bibref ref=\"rfc3023\"/> and/or its successors), then the encoding is recognized\\n                   as specified in <bibref ref=\"REC-xml\"/>, otherwise</p></item><item><p>the value of the <code>$encoding</code> argument is used if present, otherwise</p></item><item><p>the processor <rfc2119>may</rfc2119> use <termref def=\"implementation-defined\">implementation-defined</termref> heuristics to determine the likely encoding,\\n                   otherwise</p></item><item><p>UTF-8 is assumed.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is a string containing the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource retrieved\\n             using the URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1170\"/> if <code>$href</code>\\n             contains a fragment identifier, or if it cannot be used to retrieve the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of a resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1190\"/> <phrase diff=\"add\" at=\"L\">if the value\\n             of the <code>$encoding</code> argument is not a valid encoding name, </phrase>if the <termref def=\"dt-processor\">processor</termref> does not support the specified encoding,\\n             if the <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the retrieved\\n             resource contains octets that cannot be decoded into Unicode <termref def=\"character\">characters</termref> using the specified encoding, or if the resulting characters\\n             are not permitted XML characters.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1200\"/> if\\n                <code>$encoding</code> is absent and the <termref def=\"dt-processor\">processor</termref> cannot infer the encoding using external information and the\\n             encoding is not UTF-8.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text  function reads an external resource (for example, a\\n             file) and returns  a string representation of the resource .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"unparsed-text\",qname:\"fn:unparsed-text\",signature:\"($href as xs:string?) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text</code> function reads an external resource (for example, a\\n             file) and returns <phrase diff=\"chg\" at=\"L\">a string representation of the resource</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$href</code> argument <rfc2119>must</rfc2119> be a string in the form of a URI\\n             reference, which <rfc2119>must</rfc2119> contain no fragment identifier, and\\n                <rfc2119>must</rfc2119> identify a resource\\n             <phrase diff=\"chg\" at=\"L\">for which a string representation is available</phrase>. If the URI is a\\n             relative URI reference, then it is resolved relative to the\\n             <phrase diff=\"chg\" at=\"L\">Static Base URI property from the static context</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The mapping of URIs to the string representation of a resource is the mapping defined\\n             in the <xtermref spec=\"XP30\" ref=\"dt-available-text-resources\">available text resources</xtermref>\\n          component of the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of the <code>$href</code> argument is an empty sequence, the function\\n             returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$encoding</code> argument, if present, is the name of an encoding. The values\\n             for this attribute follow the same rules as for the <code>encoding</code> attribute in\\n             an XML declaration. The only values which every <termref def=\"implementation\">implementation</termref> is <rfc2119>required</rfc2119> to recognize are\\n                <code>utf-8</code> and <code>utf-16</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The encoding of the external resource is determined as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>external encoding information is used if available, otherwise</p></item><item><p>if the media type of the resource is <code>text/xml</code> or\\n                      <code>application/xml</code> (see <bibref ref=\"rfc2376\"/>), or if it matches\\n                   the conventions <code>text/*+xml</code> or <code>application/*+xml</code> (see\\n                      <bibref ref=\"rfc3023\"/> and/or its successors), then the encoding is recognized\\n                   as specified in <bibref ref=\"REC-xml\"/>, otherwise</p></item><item><p>the value of the <code>$encoding</code> argument is used if present, otherwise</p></item><item><p>the processor <rfc2119>may</rfc2119> use <termref def=\"implementation-defined\">implementation-defined</termref> heuristics to determine the likely encoding,\\n                   otherwise</p></item><item><p>UTF-8 is assumed.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is a string containing the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource retrieved\\n             using the URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1170\"/> if <code>$href</code>\\n             contains a fragment identifier, or if it cannot be used to retrieve the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of a resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1190\"/> <phrase diff=\"add\" at=\"L\">if the value\\n             of the <code>$encoding</code> argument is not a valid encoding name, </phrase>if the <termref def=\"dt-processor\">processor</termref> does not support the specified encoding,\\n             if the <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the retrieved\\n             resource contains octets that cannot be decoded into Unicode <termref def=\"character\">characters</termref> using the specified encoding, or if the resulting characters\\n             are not permitted XML characters.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1200\"/> if\\n                <code>$encoding</code> is absent and the <termref def=\"dt-processor\">processor</termref> cannot infer the encoding using external information and the\\n             encoding is not UTF-8.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text  function reads an external resource (for example, a\\n             file) and returns  a string representation of the resource .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text\",qname:\"fn:unparsed-text\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text</code> function reads an external resource (for example, a\\n             file) and returns <phrase diff=\"chg\" at=\"L\">a string representation of the resource</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$href</code> argument <rfc2119>must</rfc2119> be a string in the form of a URI\\n             reference, which <rfc2119>must</rfc2119> contain no fragment identifier, and\\n                <rfc2119>must</rfc2119> identify a resource\\n             <phrase diff=\"chg\" at=\"L\">for which a string representation is available</phrase>. If the URI is a\\n             relative URI reference, then it is resolved relative to the\\n             <phrase diff=\"chg\" at=\"L\">Static Base URI property from the static context</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The mapping of URIs to the string representation of a resource is the mapping defined\\n             in the <xtermref spec=\"XP30\" ref=\"dt-available-text-resources\">available text resources</xtermref>\\n          component of the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of the <code>$href</code> argument is an empty sequence, the function\\n             returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$encoding</code> argument, if present, is the name of an encoding. The values\\n             for this attribute follow the same rules as for the <code>encoding</code> attribute in\\n             an XML declaration. The only values which every <termref def=\"implementation\">implementation</termref> is <rfc2119>required</rfc2119> to recognize are\\n                <code>utf-8</code> and <code>utf-16</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The encoding of the external resource is determined as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>external encoding information is used if available, otherwise</p></item><item><p>if the media type of the resource is <code>text/xml</code> or\\n                      <code>application/xml</code> (see <bibref ref=\"rfc2376\"/>), or if it matches\\n                   the conventions <code>text/*+xml</code> or <code>application/*+xml</code> (see\\n                      <bibref ref=\"rfc3023\"/> and/or its successors), then the encoding is recognized\\n                   as specified in <bibref ref=\"REC-xml\"/>, otherwise</p></item><item><p>the value of the <code>$encoding</code> argument is used if present, otherwise</p></item><item><p>the processor <rfc2119>may</rfc2119> use <termref def=\"implementation-defined\">implementation-defined</termref> heuristics to determine the likely encoding,\\n                   otherwise</p></item><item><p>UTF-8 is assumed.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is a string containing the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource retrieved\\n             using the URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1170\"/> if <code>$href</code>\\n             contains a fragment identifier, or if it cannot be used to retrieve the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of a resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1190\"/> <phrase diff=\"add\" at=\"L\">if the value\\n             of the <code>$encoding</code> argument is not a valid encoding name, </phrase>if the <termref def=\"dt-processor\">processor</termref> does not support the specified encoding,\\n             if the <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the retrieved\\n             resource contains octets that cannot be decoded into Unicode <termref def=\"character\">characters</termref> using the specified encoding, or if the resulting characters\\n             are not permitted XML characters.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1200\"/> if\\n                <code>$encoding</code> is absent and the <termref def=\"dt-processor\">processor</termref> cannot infer the encoding using external information and the\\n             encoding is not UTF-8.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text  function reads an external resource (for example, a\\n             file) and returns  a string representation of the resource .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"unparsed-text\",qname:\"fn:unparsed-text\",signature:\"($href as xs:string?, $encoding as xs:string) as xs:string? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>fn:unparsed-text</code> function reads an external resource (for example, a\\n             file) and returns <phrase diff=\"chg\" at=\"L\">a string representation of the resource</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/></proto></example><example role=\"signature\"><proto name=\"unparsed-text\" return-type=\"xs:string?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"href\" type=\"xs:string?\"/><arg name=\"encoding\" type=\"xs:string\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tstatic base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$href</code> argument <rfc2119>must</rfc2119> be a string in the form of a URI\\n             reference, which <rfc2119>must</rfc2119> contain no fragment identifier, and\\n                <rfc2119>must</rfc2119> identify a resource\\n             <phrase diff=\"chg\" at=\"L\">for which a string representation is available</phrase>. If the URI is a\\n             relative URI reference, then it is resolved relative to the\\n             <phrase diff=\"chg\" at=\"L\">Static Base URI property from the static context</phrase>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"add\" at=\"L\">The mapping of URIs to the string representation of a resource is the mapping defined\\n             in the <xtermref spec=\"XP30\" ref=\"dt-available-text-resources\">available text resources</xtermref>\\n          component of the dynamic context.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of the <code>$href</code> argument is an empty sequence, the function\\n             returns an empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The <code>$encoding</code> argument, if present, is the name of an encoding. The values\\n             for this attribute follow the same rules as for the <code>encoding</code> attribute in\\n             an XML declaration. The only values which every <termref def=\"implementation\">implementation</termref> is <rfc2119>required</rfc2119> to recognize are\\n                <code>utf-8</code> and <code>utf-16</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The encoding of the external resource is determined as follows:</p><olist xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><item><p>external encoding information is used if available, otherwise</p></item><item><p>if the media type of the resource is <code>text/xml</code> or\\n                      <code>application/xml</code> (see <bibref ref=\"rfc2376\"/>), or if it matches\\n                   the conventions <code>text/*+xml</code> or <code>application/*+xml</code> (see\\n                      <bibref ref=\"rfc3023\"/> and/or its successors), then the encoding is recognized\\n                   as specified in <bibref ref=\"REC-xml\"/>, otherwise</p></item><item><p>the value of the <code>$encoding</code> argument is used if present, otherwise</p></item><item><p>the processor <rfc2119>may</rfc2119> use <termref def=\"implementation-defined\">implementation-defined</termref> heuristics to determine the likely encoding,\\n                   otherwise</p></item><item><p>UTF-8 is assumed.</p></item></olist><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The result of the function is a string containing the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the resource retrieved\\n             using the URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1170\"/> if <code>$href</code>\\n             contains a fragment identifier, or if it cannot be used to retrieve the\\n             <phrase diff=\"chg\" at=\"L\">string representation</phrase> of a resource.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1190\"/> <phrase diff=\"add\" at=\"L\">if the value\\n             of the <code>$encoding</code> argument is not a valid encoding name, </phrase>if the <termref def=\"dt-processor\">processor</termref> does not support the specified encoding,\\n             if the <phrase diff=\"chg\" at=\"L\">string representation</phrase> of the retrieved\\n             resource contains octets that cannot be decoded into Unicode <termref def=\"character\">characters</termref> using the specified encoding, or if the resulting characters\\n             are not permitted XML characters.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"UT\" code=\"1200\"/> if\\n                <code>$encoding</code> is absent and the <termref def=\"dt-processor\">processor</termref> cannot infer the encoding using external information and the\\n             encoding is not UTF-8.</p></div>\\n',summary:\"<p>  The  fn:unparsed-text  function reads an external resource (for example, a\\n             file) and returns  a string representation of the resource .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"upper-case\",qname:\"fn:upper-case\",signature:\"($arg as xs:string?) as xs:string external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Converts a string to upper case.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"upper-case\" return-type=\"xs:string\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is the empty sequence, the zero-length string is\\n             returned.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns the value of <code>$arg</code> after translating every\\n                <termref def=\"character\">character</termref> to its upper-case correspondent as\\n             defined in the appropriate case mappings section in the Unicode standard <bibref ref=\"Unicode\"/>. For versions of Unicode beginning with the 2.1.8 update, only\\n             locale-insensitive case mappings should be applied. Beginning with version 3.2.0 (and\\n             likely future versions) of Unicode, precise mappings are described in default case\\n             operations, which are full case mappings in the absence of tailoring for particular\\n             languages and environments. Every lower-case character that does not have an upper-case\\n             correspondent, as well as every upper-case character, is included in the returned value\\n             in its original form. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Case mappings may change the length of a string. In general, the\\n                <code>fn:upper-case</code> and <code>fn:lower-case</code> functions are not inverses\\n             of each other: <code>fn:lower-case(fn:upper-case($arg))</code> is not guaranteed to\\n             return <code>$arg</code>, nor is <code>fn:upper-case(fn:lower-case($arg))</code>. The\\n             Latin small letter dotless i (as used in Turkish) is perhaps the most prominent\\n             lower-case letter which will not round-trip. The Latin capital letter i with dot above\\n             is the most prominent upper-case letter which will not round trip; there are others,\\n             such as Latin capital letter Sharp S (#1E9E) which is introduced in Unicode 5.1.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> These functions may not always be linguistically appropriate (e.g. Turkish i without\\n             dot) or appropriate for the application (e.g. titlecase). In cases such as Turkish, a\\n             simple translation should be used first.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> Because the function is not sensitive to locale, results will not always match user\\n             expectations. In Quebec, for example, the standard uppercase equivalent of \"è\" is \"È\",\\n             while in metropolitan France it is more commonly \"E\"; only one of these is supported by\\n             the functions as defined.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"> Many characters of class Ll lack uppercase equivalents in the Unicode case mapping\\n             tables; many characters of class Lu lack lowercase equivalents.</p></div>\\n',summary:\"<p>  Converts a string to upper case.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"uri-collection\",qname:\"fn:uri-collection\",signature:\"() as xs:anyURI* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of <code>xs:anyURI</code> values representing the URIs in a resource collection.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable resource collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of the function returns the URIs in the <term>Default resource collection</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument form of the function returns the sequence of URIs corresponding to the\\n             supplied URI in the <term>Available resource collections</term> described in\\n             <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied (that is, if the\\n             the function is called with no arguments, or with a single argument that evaluates to an empty sequence), and the\\n             value of the default resource collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/>\\n             if <term>available resource collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of  xs:anyURI  values representing the URIs in a resource collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI*\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"uri-collection\",qname:\"fn:uri-collection\",signature:\"() as xs:anyURI* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of <code>xs:anyURI</code> values representing the URIs in a resource collection.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable resource collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of the function returns the URIs in the <term>Default resource collection</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument form of the function returns the sequence of URIs corresponding to the\\n             supplied URI in the <term>Available resource collections</term> described in\\n             <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied (that is, if the\\n             the function is called with no arguments, or with a single argument that evaluates to an empty sequence), and the\\n             value of the default resource collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/>\\n             if <term>available resource collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of  xs:anyURI  values representing the URIs in a resource collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"uri-collection\",qname:\"fn:uri-collection\",signature:\"($arg as xs:string?) as xs:anyURI* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of <code>xs:anyURI</code> values representing the URIs in a resource collection.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable resource collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of the function returns the URIs in the <term>Default resource collection</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument form of the function returns the sequence of URIs corresponding to the\\n             supplied URI in the <term>Available resource collections</term> described in\\n             <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied (that is, if the\\n             the function is called with no arguments, or with a single argument that evaluates to an empty sequence), and the\\n             value of the default resource collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/>\\n             if <term>available resource collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of  xs:anyURI  values representing the URIs in a resource collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"uri-collection\",qname:\"fn:uri-collection\",signature:\"($arg as xs:string?) as xs:anyURI* external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns a sequence of <code>xs:anyURI</code> values representing the URIs in a resource collection.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example><example role=\"signature\"><proto name=\"uri-collection\" return-type=\"xs:anyURI*\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:string?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-dependent\">context-dependent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>.  It depends on\\n \t\tavailable resource collections, and static base uri.\\n \t</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The zero-argument form of the function returns the URIs in the <term>Default resource collection</term>\\n             described in <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If the value of <code>$arg</code> is a relative <code>xs:anyURI</code>, it is resolved\\n             against the value of the base-URI property from the static context. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function behaves as if it had been\\n             called without an argument. See above.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The single-argument form of the function returns the sequence of URIs corresponding to the\\n             supplied URI in the <term>Available resource collections</term> described in\\n             <xspecref spec=\"XP30\" ref=\"id-xp-evaluation-context-components\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/> if no URI is supplied (that is, if the\\n             the function is called with no arguments, or with a single argument that evaluates to an empty sequence), and the\\n             value of the default resource collection is <xtermref ref=\"dt-absent\" spec=\"DM30\">absent</xtermref>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"J\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0002\"/>\\n             if <term>available resource collections</term> provides no mapping for the absolutized URI.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"DC\" code=\"0004\"/> if <code>$arg</code> is not a\\n             valid <code>xs:anyURI</code>.</p></div>\\n',summary:\"<p>  Returns a sequence of  xs:anyURI  values representing the URIs in a resource collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:anyURI*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"year-from-date\",qname:\"fn:year-from-date\",signature:\"($arg as xs:date?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the year component of an <code>xs:date</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"year-from-date\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:date?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the year in the\\n             local value of <code>$arg</code>. The value may be negative. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:year-from-date(xs:date(\"1999-05-31\"))</code> returns <code>1999</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:year-from-date(xs:date(\"2000-01-01+05:00\"))</code> returns <code>2000</code>.</p></div>\\n',summary:\"<p>  Returns the year component of an  xs:date .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:date\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"years-from-duration\",qname:\"fn:years-from-duration\",signature:\"($arg as xs:duration?) as xs:integer? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the number of years in a duration.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"years-from-duration\" return-type=\"xs:integer?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:duration?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise, the function returns an <code>xs:integer</code> representing the years\\n             component in the value of <code>$arg</code>. The result is obtained by casting\\n                <code>$arg</code> to an <code>xs:yearMonthDuration</code> (see <specref ref=\"casting-to-durations\"/>) and then computing the years component as described in\\n                <specref ref=\"canonical-yearMonthDuration\"/>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is a negative duration then the result will be negative..</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is an <code>xs:dayTimeDuration</code> the function returns 0.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:years-from-duration(xs:yearMonthDuration(\"P20Y15M\"))</code> returns <code>21</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:years-from-duration(xs:yearMonthDuration(\"-P15M\"))</code> returns <code>-1</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>fn:years-from-duration(xs:dayTimeDuration(\"-P2DT15H\"))</code> returns <code>0</code>.</p></div>\\n',summary:\"<p>  Returns the number of years in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"zero-or-one\",qname:\"fn:zero-or-one\",signature:\"($arg as item()*) as item()? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns <code>$arg</code> if it contains zero or one items. Otherwise, raises\\n             an error.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"zero-or-one\" return-type=\"item()?\" isOp=\"no\" prefix=\"fn\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"item()*\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Except in error cases, the function returns <code>$arg</code> unchanged.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"del\" at=\"F\">For detailed type semantics, see [Formal Semantics].</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">A <phrase diff=\"add\" at=\"L\">dynamic</phrase> error is raised <errorref class=\"RG\" code=\"0003\"/> if <code>$arg</code> contains more\\n             than one item.</p></div>\\n',summary:\"<p>  Returns  $arg  if it contains zero or one items.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"item()?\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/csv\":{ns:\"http://zorba.io/modules/csv\",description:\" Function library providing converters from CSV/TXT to XML and back.\\n The functions are optimized to work with large amounts of data, in a streaming way.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/csv\",prefix:\"csv\"},{uri:\"http://zorba.io/modules/csv-options\",prefix:\"csv-options\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schemaOptions\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"parse\",qname:\"csv:parse\",signature:\"($csv as xs:string, $options as element(csv-options:options)?) as element(*)*\",description:' Parse a CSV or fixed size text and convert to XML.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n By default each line is converted to a &lt;row&gt; element, and each field to a &lt;column&gt; element inside &lt;row&gt;.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The format of the param $options is:<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n  <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    &lt;csv-options:options&gt;\\n        &lt;csv  [separator=\"default comma ,\"] ?\\n          [quote-char=\"default double quotes &amp;quote;\"]?\\n          [quote-escape=\"default double double quotes &amp;quote;&amp;quote;\"]? /&gt;\\n        or\\n        &lt;column-widths&gt;\\n          &lt;column-width&gt;<i>[column fixed width, unsigned int]</i>&lt;column-width&gt;*\\n        &lt;/column-widths&gt;\\n        or\\n        &lt;column-positions&gt;\\n          &lt;column-position&gt;<i>[column position on line, unsigned int]</i>&lt;column-position&gt;*\\n        &lt;/column-positions&gt;\\n        &lt;first-row-is-header [line=\"<i>first_line[-last_line]?</i>\"]?/&gt;?\\n        &lt;start-from-row line=\"<i>first_line[-last_line]?</i>\"/&gt;?\\n        &lt;add-last-void-columns/&gt;?\\n        &lt;xml-nodes&gt;\\n          [&lt;<i>row-name</i>&gt;\\n            [&lt;<i>column-name/</i>&gt;]?\\n          &lt;/<i>row-name</i>&gt;]?\\n        &lt;/xml-nodes&gt;?\\n    &lt;/csv-options:options&gt;\\n  </pre>\\n    All the parameters are optional and can appear in any order.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n    All the parameters are case sensitive. The namespace used is \"http://zorba.io/modules/csv-options\".<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n    All strings must have UTF-8 encoding.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n    Parameters csv, column-widths, column-positions are mutually exclusive. If none is specified,\\n    the input string is assumed to be csv.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n    Description of parameters:\\n    <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n     <dt><b>csv</b></dt>\\n     <dd> Specifies the parameters for parsing a csv string.<br/>\\n       <dl>\\n        <dt><b>separator</b></dt>\\n        <dd>The character or group of characters used to separating fields in a row.\\n            If it is not specified, it defaults to comma \\',\\'.\\n        </dd>\\n        <dt><b>quote-char</b></dt>\\n        <dd>The character or group of characters used for quoting the fields that may contain special characters,\\n             like separator, new line or this quote char. The default value is double quote \".<br/>\\n        </dd>\\n        <dt><b>quote-escape</b></dt>\\n        <dd>The group of characters used for escaping the quote char inside a field. The whole quote escape group\\n           is translated to a quote char during parsing. The default value is double double quotes \"\".<br/>\\n        </dd>\\n       </dl>\\n     </dd>\\n     <br/>\\n     <dt><b>column-widths</b></dt>\\n     <dd>Specifies the column widths for fixed size text. It contains multiple column-width child elements\\n        specifying the fixed width of each column, from left to right.<br/>\\n        If the line has more fields than specified, they are ignored.\\n     </dd>\\n     <dt><b>column-positions</b></dt>\\n     <dd>This is an alternative to column-widths, and specifies instead the starting position of each column.\\n        Column positions are 1 based, and are specified in order from left to right.\\n        The last column is read until end of line. The first column position can be greater than 1, if you want\\n        to parse only a part of the input text.\\n     </dd>\\n     <dt><b>first-row-is-header</b></dt>\\n     <dd>The presence of this element indicates that the first row is to be treated as the name of the columns.\\n        If it is not present, then each field is enclosed in a &lt;column&gt; element,\\n        or how it is specified in &lt;xml-nodes&gt; parameter.<br/>\\n        If the first row is the header, then each field is enclosed in an element with the corresponding name from the header.<br/>\\n        For example, the csv:\\n        <pre>\\n        <i>ID,Name,Occupation\\n        1,John,student</i>\\n        </pre>\\n        is parsed into:\\n        <pre>\\n        <i>&lt;row&gt;\\n        &lt;ID&gt;1&lt;/ID&gt;\\n        &lt;Name&gt;John&lt;/Name&gt;\\n        &lt;Occupation&gt;student&lt;/Occupation&gt;\\n        &lt;/row&gt;</i>\\n        </pre>\\n        If the header names contain characters that cannot be used in a QName, they are replaced with underscore \\'_\\'.<br/>\\n        The namespace for the header QNames is taken from the column name specified in xml-nodes parameter, or from\\n        the row name, or if that doesn\\'t exist either then empty namespace is used. <br/>\\n        If the header is not the first line in the input string, the starting line can be specified in the <b>line</b> attribute.<br/>\\n        If a column does not have a name, a new name is constructed in the form <i>columnN</i> where N is the position of the column,\\n        starting from 1.<br/>\\n        <b>Subheaders</b><br/>\\n        If the header consists of more than one line, this can be specified in the <b>line</b> attribute in the form\\n        \"<i>first_line - last_line</i>\". Having more lines as the header translates into a hierarchy of elements in the xml.<br/>\\n        For example, the csv:\\n        <pre>\\n        <i>ID,Name,,Occupation\\n        ,First Name,Last Name,\\n        1,John,Howard,student</i>\\n        </pre>\\n        is parsed into:\\n        <pre>\\n        <i>&lt;row&gt;\\n        &lt;ID&gt;1&lt;/ID&gt;\\n        &lt;Name&gt;\\n          &lt;First_Name&gt;John&lt;/First_Name&gt;\\n          &lt;Last_Name&gt;Howard&lt;/Last_Name&gt;\\n        &lt;/Name&gt;\\n        &lt;Occupation&gt;student&lt;/Occupation&gt;\\n        &lt;/row&gt;</i>\\n        </pre>\\n        This element can have an attribute \"accept-all-lines\" with values \"false\" or \"true\" (default \"false\").\\n        When set to true it tells the parser to not report lines that do not have the same number of items as\\n        the header. If set to false, the parser will raise a csv:WrongInput error for these lines.<br/>\\n     </dd>\\n     <dt><b>start-from-row</b></dt>\\n     <dd>If the data does not start from line 1 or immediately after the header,\\n        you can specify the starting line in the <b>line</b> attribute.<br/>\\n        Also you can use this attribute in the form \"<i>first_line - last_line</i>\" to specify also the last line\\n        if you don\\'t want the whole csv to be parsed.\\n     </dd>\\n     <dt><b>add-last-void-columns</b></dt>\\n     <dd>In the case when using headers and some data lines are shorter than the header, by default the excess columns are ignored\\n          for those lines. You can set the add-last-void-columns parameter to make all the columns appear in xml even if they are void.\\n     </dd>\\n     <dt><b>xml-nodes</b></dt>\\n     <dd>With this parameter you can specify the names for the row element and for the column element if there is no header.<br/>\\n        The first element child of this element specifies the desired QName of the row element in the output xml.\\n        The name of this element will be used as the name of the row element.<br/>\\n        The element child of this row element is the column element, and its name will be used as the name of the column elements\\n        that enclose the fields in the output xml if there is no header. <br/>\\n        If the csv has a header, only the namespace is used from the column element.<br/>\\n        For example, with parameter:\\n        <pre>\\n        <i>&lt;xml-nodes&gt;\\n        &lt;r&gt;\\n          &lt;c/&gt;\\n        &lt;/r&gt;\\n        &lt;/xml-nodes&gt;</i>\\n        </pre>\\n        the output for each line will look like:\\n        <pre>\\n        <i>&lt;r&gt;\\n          &lt;c&gt;field1&lt;/c&gt;\\n          &lt;c&gt;field2&lt;/c&gt;\\n          .......\\n        &lt;/r&gt;</i>\\n        </pre>\\n     </dd>\\n    </dl>\\n',summary:\"<p> Parse a CSV or fixed size text and convert to XML.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"csv\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string containing the csv or fixed size text.</div>'},{name:\"options\",type:\"element(csv-options:options)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> this parameter is validated against \"http://zorba.io/modules/csv-options\" schema. If this parameter is not specified, the row name is by default \"row\" and the column name is by default \"column\".</div>'}],returns:{type:\"element(*)*\",description:\"a sequence of row elements, one for each line in csv\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:CSV001 if the input string is streamable string and cannot be rewinded</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:WrongInput if the input string has lines with variable number of items, and the csv has headers and the options do not specify the ignore-foreign-input attribute</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 if $options can not be validated against the csv-options schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0084 if the options parameter doesn\\'t have the name \"csv-options:options\".</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"serialize\",qname:\"csv:serialize\",signature:\"($xml as element(*)*, $options as element(csv-options:options)?) as xs:string\",description:' Convert XML into CSV or fixed size text.\\n Note: if you want to serialize out the result, make sure that the serializer method is set to \"text\".\\n For example, in zorba command line, you have to set the param --serialize-text.\\n When using the <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">file:write(...)</pre> function, you have to set the\\n method serialization parameter to \"text\":\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n &lt;output:serialization-parameters&lt;\\n   &lt;output:method value=\"text\"/&lt;\\n &lt;/output:serialization-parameters&lt;\\n </pre>\\n The <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$options</pre> parameter must have the following format:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    &lt;csv-options:options&gt;<br/>\\n        &lt;csv  [separator=\"default comma ,\"] ? <br/>\\n          [quote-char=\"default double quotes &amp;quote;\"]? <br/>\\n          [quote-escape=\"default double double quotes &amp;quote;&amp;quote;\"]? /&gt; <br/>\\n        <br/>\\n        or<br/>\\n        &lt;column-widths [align=\"left|right\"]?&gt;<br/>\\n          &lt;column-width [align=\"left|right\"]?&gt;<i>[column fixed width, unsigned int]</i>&lt;column-width&gt;*<br/>\\n        &lt;/column-widths&gt;<br/>\\n        <br/>\\n        or<br/>\\n        &lt;column-positions [align=\"left|right\"]?&gt;<br/>\\n          &lt;column-position [align=\"left|right\"]?&gt;<i>[column position on line, unsigned int]</i>&lt;column-position&gt;*<br/>\\n        &lt;/column-positions&gt;<br/>\\n        <br/>\\n        &lt;first-row-is-header/&gt;?<br/>\\n    &lt;/csv-options:options&gt;\\n </pre>\\n All the parameters are optional and can appear in any order.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n All the parameters are case sensitive. The namespace used is \"http://zorba.io/modules/csv-options\".<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n All strings must have UTF-8 encoding.<br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Parameters csv, column-widths, column-positions are mutually exclusive.\\n If none is specified, the xml is converted to csv.\\n Description of parameters:\\n    <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n     <dt><b>csv</b></dt>\\n     <dd> Specifies the parameters for converting to csv.<br/>\\n       <dl>\\n        <dt><b>separator</b></dt>\\n        <dd>The character or group of characters used to separating fields in a row.\\n            If it is not specified, it defaults to comma \\',\\'.\\n        </dd>\\n        <dt><b>quote-char</b></dt>\\n        <dd>The character or group of characters used for quoting the fields that may contain special characters,\\n             like separator, new line or this quote char. The default value is double quote \".<br/>\\n        </dd>\\n        <dt><b>quote-escape</b></dt>\\n        <dd>The group of characters used for escaping the quote char inside a field. The whole quote escape group\\n           is translated to a quote char during parsing. The default value is double double quotes \"\".<br/>\\n        </dd>\\n       </dl>\\n     </dd>\\n     <br/>\\n     <dt><b>column-widths</b></dt>\\n     <dd>Specifies the column widths for fixed size text. It contains multiple column-width child elements\\n        specifying the fixed width of each column, from left to right.<br/>\\n        With the attribute <b>align</b> you can specify how to align fields that are smaller than the column width.\\n        The default alignment is left.<br/>\\n     </dd>\\n     <dt><b>column-positions</b></dt>\\n     <dd>This is an alternative to column-widths, and specifies instead the starting position of each column.\\n        Column positions are 1 based, and are specified in order from left to right.\\n        The last column has a variable length.<br/>\\n        With the attribute <b>align</b> you can specify how to align fields that are smaller than the column width.\\n        The default alignment is left. The last column does not need alignment.<br/>\\n     </dd>\\n     <dt><b>first-row-is-header</b></dt>\\n     <dd>The presence of this element indicates that the first row will contain the header, that is, the names of\\n        the column elements. Only the column names from the first row element are taken into account.<br/>\\n        For example, the row xml:<br/>\\n        <i>&lt;row&gt;<br/>\\n        &lt;ID&gt;1&lt;/ID&gt;<br/>\\n        &lt;Name&gt;John&lt;/Name&gt;<br/>\\n        &lt;Occupation&gt;student&lt;/Occupation&gt;<br/>\\n        &lt;/row&gt;</i><br/>\\n        <br/>\\n        is converted to<br/>\\n        <i>ID,Name,Occupation<br/>\\n        1,John,student</i><br/>\\n        <br/>\\n        The header names are the localnames of the column elements, and the namespace is ignored.<br/>\\n        <b>Subheaders</b><br/>\\n        If the row-column hierarchy is more complex, then subheaders are also generated on subsequent lines.\\n        The number of subheaders depends on the depth of the column hierarchy.<br/>\\n        When generating the subheaders, the non-whitespace text nodes are also taken into account,\\n        and a separate column is generated for them too.<br/>\\n        For example, the xml row element:<br/>\\n        <i>&lt;row&gt;<br/>\\n        &lt;ID&gt;1&lt;/ID&gt;<br/>\\n        &lt;Name&gt;<br/>\\n          Mr.<br/>\\n          &lt;First_Name&gt;John&lt;/First_Name&gt;<br/>\\n          &lt;Last_Name&gt;Howard&lt;/Last_Name&gt;<br/>\\n        &lt;/Name&gt;<br/>\\n        &lt;Occupation&gt;student&lt;/Occupation&gt;<br/>\\n        &lt;/row&gt;</i><br/>\\n        is converted to<br/>\\n        <i>ID,Name,,Occupation<br/>\\n        ,,First Name,Last Name,<br/>\\n        1,Mr.,John,Howard,student</i><br/>\\n        <br/>\\n        If first-row-is-header is not specified and the columns have a deeper hierarchy,\\n          only the first layer of columns is processed, and the fields are the string values of each column.<br/>\\n        This element can have an attribute \"ignore-foreign-input\" with values \"false\" or \"true\" (default \"false\").\\n        When set to true it tells the serializer to ignore elements that to not match the header names.\\n        If set to false, the serializer will raise a csv:ForeignInput error for these elements.<br/>\\n     </dd>\\n    </dl>\\n',summary:\"<p> Convert XML into CSV or fixed size text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of elements, each element representing a row. The name of each row element is ignored. The childs of each row are the column fields.</div>'},{name:\"options\",type:\"element(csv-options:options)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options parameter. See the function description for details. This parameter is validated against \"http://zorba.io/modules/csv-options\" schema.</div>'}],returns:{type:\"xs:string\",description:\"the csv or fixed size text as string containing all the lines\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:CSV003 if the serialize output is streamable string and cannot be reset</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:ForeignInput if there are input elements in subsequent rows that do not match the headers, and the options specify first-row-is-header and do not specify the ignore-foreign-input attribute</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 if $options can not be validated against csv-options schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0084 if the options parameter doesn\\'t have the name \"csv-options:options\".</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/reference\":{ns:\"http://zorba.io/modules/reference\",description:\" The module provides functions to compute an immutable and opaque reference\\n for nodes, objects, or arrays and to retrieve such items given their\\n identifier, respectively.\\n The identifiers are immutable, i.e. a identifier does not change\\n during the items lifetime and cannot be reused for another item after the\\n original item gets deleted.\\n Identifiers are unique, in that, two different items will never have the same\\n identifier. A item, at any time during its lifetime, can be retrieved by its\\n identifier.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"dereference\",qname:\"ref:dereference\",signature:\"($arg as xs:string) as item()? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the node, object, or array identified by the given reference.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the empty sequence if the item\\n that is referenced does not exist.</p>\\n',summary:\"<p>  Returns the node, object, or array identified by the given reference.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI of the item to retrieve.</div>'}],returns:{type:\"item()?\",description:\"the item identified by the URI passed as parameter or the empty-sequence if no item with that URI is found.\"},errors:[]},{isDocumented:!0,arity:1,name:\"reference\",qname:\"ref:reference\",signature:\"($arg as item()) as xs:string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an immutable and opaque reference (with type xs:anyURI) for\\n a given node, object, or array.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The generated identifier is immutable, i.e. a identifier does not\\n change during the item\\'s lifetime and cannot be reused for another node after\\n the original item gets deleted.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Identifiers are also unique, in that, two different items will never\\n have the same identifier.</p>\\n A item, at any time during its lifetime, can be retrieved by its\\n identifier, using the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ref:dereference</tt> function.\\n Please note that a reference can only be retrieved for a JSON object or JSON\\n array if the item is a member of a collection.\\n',summary:\"<p>  Returns an immutable and opaque reference (with type xs:anyURI) for\\n a given node, object, or array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node, object, or array for which the URI should be computed</div>'}],returns:{type:\"xs:string\",description:\"the opaque URI of the item.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr::ZAPI0080 is raised if the object or array passed as argument is not a member of a collection.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/dctx\":{ns:\"http://zorba.io/modules/dctx\",description:\" This module provides functions that gets components of the dynamic context.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/dctx\",prefix:\"dctx\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"snapshot-id\",qname:\"dctx:snapshot-id\",signature:\"() as xs:unsignedLong external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the current snapshot id.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned id is opaque and should not be used for reasoning about time.\\n The only guarantee is that the value returned by this function increases each\\n time a snapshot finishes.</p>\\n',summary:\"<p>  Retrieves the current snapshot id.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:unsignedLong\",description:\"the current snapshot id.\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/facts\":{ns:\"http://xbrl.io/modules/bizql/facts\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for retrieving facts.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Facts are the smallest reportable piece of information.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Facts have a certain number of characteristics: the archive in\\n which they were reported, a number of XBRL aspects (concept, entity, period,\\n unit, further XBRL dimensions), as well as profile-specific information.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve facts by picking the characteristics\\n you would like your results to have. You can retrieve a fact with its FID\\n (Fact ID). You can extract information about facts (period, entity, etc).\\n You can perform a full-text search on fact values, and obtain footnotes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If you are interested in the structures in which facts can be organized (such\\n as hypercubes), look at the components module.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Facts are stored in a MongoDB datasource called <b>xbrl</b>.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"standard_options\">Standard <code>$options</code> Parameter</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Most functions in the BizQL package allow an additional <code>$options</code>\\n    parameter. The options parameter is a JSON object allowing the following\\n    fields:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <li><b>Hypercube</b>: a hypercube object can be passed with the options to apply\\n     implicit filtering for it. Only facts belonging to this hypercube will be\\n     returned. Hypercube semantics (such as default dimension values) apply.\\n     By default, the dimensionless hypercube is used (no dimensions allowed, no filtering).\\n     You can override Hypercube with null to bypass hypercube semantics.</li>\\n <li><b>Filter</b>: an object specifying the fields to filter for. Filtering fields\\n     can be any field contained in facts, including profile specific fields, e.g.:\\n     <pre class=\"ace-static\" ace-mode=\"java\">\\n   {\\n     Filter:\\n       {\\n         Archive: \"0000034088-13-000011\",\\n         Aspects:\\n         {\\n           \"us-gaap:DefinedBenefitPlansDisclosuresDefinedBenefitPlansAxis\" :\\n             \"us-gaap:ForeignPensionPlansDefinedBenefitMember\"\\n         },\\n         Profiles: {\\n           SEC: {\\n             Fiscal: {\\n               Year: [2011, 2012]\\n             }\\n           }\\n         }\\n       }\\n   }\\n   </pre>\\n   A filter must contain at least on of the fields Archive, Aspects.xbrl:Concept,\\n   Aspects.xbrl:Period, or Aspects.xbrl:Entity.</li>\\n <li><b>concept-maps</b>:\\n   <ol><li>a string which is a name of a report schema that is stored in the\\n       reportschemas collection and from which to load a ConceptMap</li>\\n       <li>an object which is a ConceptMap network object</li>\\n       <li>an array of ConceptMap network objects (to learn more about concept-maps\\n       refer to the concept-maps module documentation)</li>\\n   </ol></li>\\n <li><b>Rules</b>:\\n   <ol><li>a string which is a name of a report schema that is stored in the\\n       reportschemas collection and from which to load Rules</li>\\n       <li>an object which is a Rule object</li>\\n       <li>an array of Rule objects</li>\\n   </ol></li>\\n <li><b>include-footnotes</b>: include XBRL Footnotes in each fact (true | false)</li>\\n <li><b>Lang</b>: language identifier according to http://www.ietf.org/rfc/rfc3066.txt,\\n     i.e. only return footnotes etc. for this specific language</li>\\n <li><b>audit-trail</b>: if set to \"debug\" the audit trails will be more verbose</li>\\n <li><b>facts-for-archives-and-concept</b>: to override how underlying facts are\\n     resolved, for example with finer-grained, profile-specific filtering (option value\\n     must be a function item). facts:facts-for-archives-and-concepts#3 is used by\\n     default, but it is possible to supply another function that, for examples, filters\\n     irrelevant facts out.</li>\\n </ul>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/concept-maps\",prefix:\"concept-maps\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/footnotes\",prefix:\"footnotes\"},{uri:\"http://xbrl.io/modules/bizql/hypercubes\",prefix:\"hypercubes\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"j\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/modules/reflection\",prefix:\"reflection\"},{uri:\"http://xbrl.io/modules/bizql/rules\",prefix:\"rules\"},{uri:\"http://zorba.io/modules/string\",prefix:\"string\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/modules/zorba-query\",prefix:\"zq\"}],functions:[{isDocumented:!0,arity:1,name:\"concept-for-fact\",qname:\"facts:concept-for-fact\",signature:\"($fact-or-id as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the concept against which a fact is reported.</p>\\n',summary:\"<p>  Retrieves the concept against which a fact is reported.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact or its FID.</div>'}],returns:{type:\"string\",description:\"the concept name.\"},errors:[]},{isDocumented:!0,arity:1,name:\"decimal-value\",qname:\"facts:decimal-value\",signature:\"($facts as object()*) as decimal\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of the given facts in case that it\\n    is castable to decimal. If no facts are given or a fact value\\n    is not castable to decimal 0 is returned instead.</p>\\n',summary:\"<p>  Returns the value of the given facts in case that it\\n    is castable to decimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"facts\",type:\"object()\",occurrence:\"*\",description:\"\"}],returns:{type:\"decimal\",description:\"the decimal value of the facts or 0.\"},errors:[]},{isDocumented:!0,arity:1,name:\"duration-for-fact\",qname:\"facts:duration-for-fact\",signature:\"($fact-or-id as item()) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the duration period for which a fact was reported.</p>\\n',summary:\"<p>  Retrieves the duration period for which a fact was reported.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact or its FID.</div>'}],returns:{type:\"object()?\",description:\"the duration period as an object with Start and End, or the empty sequence if it is not instant.\"},errors:[]},{isDocumented:!0,arity:1,name:\"entity-for-fact\",qname:\"facts:entity-for-fact\",signature:\"($fact-or-id as item()) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the eid of the entity who reported a fact.</p>\\n',summary:\"<p>  Retrieves the eid of the entity who reported a fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact or its FID.</div>'}],returns:{type:\"string\",description:\"the eid.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-archives-and-aspects\",qname:\"facts:facts-for-archives-and-aspects\",signature:\"($archives-or-ids as item()*, $aspects as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts reported in a given archive, and associated with a\\n given entity, concept, period and/or other aspects.</p>\\n',summary:\"<p>  Return all facts reported in a given archive, and associated with a\\n given entity, concept, period and/or other aspects.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive or archive IDs to filter (or $facts:ALL_OF_THEM to do not filter on archives).</div>'},{name:\"aspects\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (at least one of them is mandatory).</div>'}],returns:{type:\"object()*\",description:\"all facts satisfying all supplied conditions.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts-for-archives-and-aspects\",qname:\"facts:facts-for-archives-and-aspects\",signature:\"($archives-or-ids as item()*, $aspects as object(), $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts associated with a given entity, concept, period\\n and/or other aspects.</p>\\n',summary:\"<p>  Return all facts associated with a given entity, concept, period\\n and/or other aspects.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive or archive IDs to filter (or $facts:ALL_OF_THEM to do not filter on archives).</div>'},{name:\"aspects\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (all optional).</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"all facts satisfying all supplied conditions.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-archives-and-concepts\",qname:\"facts:facts-for-archives-and-concepts\",signature:\"($archives-or-ids as item()*, $concepts as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return facts associated with given concepts and archives.</p>\\n',summary:\"<p>  Return facts associated with given concepts and archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive or archive IDs to filter (or $facts:ALL_OF_THEM to do not filter on archives).</div>'},{name:\"concepts\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts (or $facts:ALL_OF_THEM to do no filter on concepts).</div>'}],returns:{type:\"object()*\",description:\"facts associated with these concepts and archives.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts-for-archives-and-concepts\",qname:\"facts:facts-for-archives-and-concepts\",signature:\"($archives-or-ids as item()*, $concepts as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return facts associated with given concepts and archives.</p>\\n',summary:\"<p>  Return facts associated with given concepts and archives.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"},{name:\"concepts\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts (or $facts:ALL_OF_THEM to do no filter on concepts).</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"facts associated with these concepts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts-for-archives\",qname:\"facts:facts-for-archives\",signature:\"($archives-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts reported within a given archive.</p>\\n',summary:\"<p>  Return all facts reported within a given archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archives-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or AIDs to filter.</div>'}],returns:{type:\"object()*\",description:\"all facts reported in these archives.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts-for-aspects\",qname:\"facts:facts-for-aspects\",signature:\"($aspects as object()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts associated with the given aspects.</p>\\n',summary:\"<p>  Return all facts associated with the given aspects.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"aspects\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (at least one of them is mandatory).</div>'}],returns:{type:\"object()*\",description:\"all facts associated with these aspects.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-aspects\",qname:\"facts:facts-for-aspects\",signature:\"($aspects as object(), $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts associated with the given aspects.</p>\\n',summary:\"<p>  Return all facts associated with the given aspects.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"aspects\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (at least one of them is mandatory).</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"all facts associated with these aspects.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts-for-concepts\",qname:\"facts:facts-for-concepts\",signature:\"($concepts as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return facts associated with given concepts.</p>\\n',summary:\"<p>  Return facts associated with given concepts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts.</div>'}],returns:{type:\"object()*\",description:\"facts associated with these concepts.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-concepts\",qname:\"facts:facts-for-concepts\",signature:\"($concepts as string*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return facts associated with given concepts.</p>\\n',summary:\"<p>  Return facts associated with given concepts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"facts associated with these concepts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts-for-entities\",qname:\"facts:facts-for-entities\",signature:\"($entities-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return facts reported by the given entities.</p>\\n',summary:\"<p>  Return facts reported by the given entities.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the entities or EIDs.</div>'}],returns:{type:\"object()*\",description:\"facts reported by the given entities.\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts-for\",qname:\"facts:facts-for\",signature:\"($options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts that match a given filter object optionally interpreted\\n    in the context of an optionally given hypercube.</p>\\n',summary:\"<p>  Return all facts that match a given filter object optionally interpreted\\n    in the context of an optionally given hypercube.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"all facts satisfying the filter and options.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">facts:FILTER-TOO-GENERIC The filter object must have at least one of the fields Archive, Aspects.xbrl:Concept, Aspects.xbrl:Period, or Aspects.xbrl:Entity.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"facts-search\",qname:\"facts:facts-search\",signature:\"($search as string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts that match the given search term.</p>\\n',summary:\"<p>  Return all facts that match the given search term.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"search\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the search query</div>'}],returns:{type:\"object()*\",description:\"all facts matching the given search query\"},errors:[]},{isDocumented:!0,arity:1,name:\"facts\",qname:\"facts:facts\",signature:\"($fact-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the fact with the given FIDs.</p>\\n',summary:\"<p>  Return the fact with the given FIDs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the FIDs or the facts themselves.</div>'}],returns:{type:\"object()*\",description:\"the facts with the given FIDs the empty sequence if no fact was found or if the input is an empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"fid\",qname:\"facts:fid\",signature:\"($facts-or-ids as item()*) as atomic*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized fact id (FID). The input\\n can be either an FID, or a fact object which contains an _id.</p>\\n',summary:\"<p>  Converts the input to a normalized fact id (FID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"facts-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of fact objects or FIDs.</div>'}],returns:{type:\"atomic*\",description:\"the normalized FIDs.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">facts:INVALID-PARAMETER if the FID or fact is not valid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"instant-for-fact\",qname:\"facts:instant-for-fact\",signature:\"($fact-or-id as item()) as atomic?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the instant period for which a fact was reported.</p>\\n',summary:\"<p>  Retrieves the instant period for which a fact was reported.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact or its FID.</div>'}],returns:{type:\"atomic?\",description:\"the instance period, or the empty sequence if it is not instant.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-fact-forever\",qname:\"facts:is-fact-forever\",signature:\"($fact-or-id as item()) as boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tests whether a fact is reported forever.</p>\\n',summary:\"<p>  Tests whether a fact is reported forever.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact or its FID.</div>'}],returns:{type:\"boolean\",description:\"true if its period is forever, false otherwise.\"},errors:[]},{isDocumented:!0,arity:3,name:\"merge-objects\",qname:\"facts:merge-objects\",signature:\"($o1 as object()?, $o2 as object()?, $prioritize-first-object as boolean) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Helper function to deep-merge two objects. If the two given objects have\\n    fields with the same name they are merged, which means:\\n      1. if the values of the fields are objects then these are merged\\n      2. in any other case the fields are accumulated into an array.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The third parameter can be used to priotitize the first object. If the first\\n    object is prioritized and both objects contain fields with the same name,\\n    the fields are either merged (in case of two object values) or the value of\\n    the first object is taken.</p>\\n',summary:\"<p>  Helper function to deep-merge two objects.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"o1\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> first object</div>'},{name:\"o2\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> second object</div>'},{name:\"prioritize-first-object\",type:\"boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> boolean flag to give the first object higher priority in the merge</div>'}],returns:{type:\"object()?\",description:\"one merge object or an empty-sequence (in case both input objects are empty).\"},errors:[]},{isDocumented:!0,arity:1,name:\"populate-with-footnotes\",qname:\"facts:populate-with-footnotes\",signature:\"($fact-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a sequence of facts with their associated footnotes.\\n More in detail, in each returned fact object an additional field\\n Footnotes is added which contains all connected footnotes in an\\n array.</p>\\n',summary:\"<p>  Populates a sequence of facts with their associated footnotes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the FIDs or the facts themselves.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated Footnotes field.\"},errors:[]},{isDocumented:!0,arity:2,name:\"populate-with-footnotes\",qname:\"facts:populate-with-footnotes\",signature:\"($fact-or-ids as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a sequence of facts with their associated footnotes.\\n More in detail, in each returned fact object an additional field\\n Footnotes is added which contains all connected footnotes in an\\n array.</p>\\n',summary:\"<p>  Populates a sequence of facts with their associated footnotes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the FIDs or the facts themselves.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated Footnotes field.\"},errors:[]},{isDocumented:!0,arity:1,name:\"prefix-from-fact-concept\",qname:\"facts:prefix-from-fact-concept\",signature:\"($fact as object()) as string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Helper function to get the prefix of a given fact`s xbrl:Concept aspect.</p>\\n',summary:\"<p>  Helper function to get the prefix of a given fact`s xbrl:Concept aspect.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact object.</div>'}],returns:{type:\"string?\",description:\"the prefix of the fact's xbrl:Concept aspect or empty sequence if the concept doesn't have a prefix.\"},errors:[]}],variables:[{name:\"facts:col\",type:\"string\",description:\" Name of the collection the facts are stored in.\\n\"},{name:\"facts:ID\",type:\"string\",description:\" Name of the field that points to the facts FID.\\n\"},{name:\"facts:ARCHIVE\",type:\"string\",description:\" Name of the field that points to the archive.\\n\"},{name:\"facts:ASPECTS\",type:\"string\",description:\" Name of the field that stores the aspects.\\n\"},{name:\"facts:CONCEPT\",type:\"string\",description:\" Name of the concept aspect.\\n\"},{name:\"facts:PERIOD\",type:\"string\",description:\" Name of the period aspect.\\n\"},{name:\"facts:ENTITY\",type:\"string\",description:\" Name of the entity aspect.\\n\"},{name:\"facts:UNIT\",type:\"string\",description:\" Name of the unit aspect.\\n\"},{name:\"facts:FOOTNOTES\",type:\"string\",description:\" Name of the field that stores the Footnotes (if populated).\\n\"},{name:\"facts:ALL_OF_THEM\",type:\"boolean\",description:\" Joker for all archives or all concepts.\\n\"}]},\"http://www.w3.org/2005/xqt-errors\":{ns:\"http://www.w3.org/2005/xqt-errors\",description:\" This module contains one variable declaration for each diagnostic of the\\n http://www.w3.org/2005/xqt-errors namespace.\\n The variables serves as documentation for the errors but can also\\n be used in the code. For example, one useful scenario is to compare\\n an error caught in the catch clause of a try-catch expression with one of\\n the variables.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Carlos Lopez</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"}],functions:[],variables:[{name:\"err:FORG0006\",type:\"xs:QName\",description:\" Invalid argument type.\\n\"},{name:\"err:FODF1280\",type:\"xs:QName\",description:\" Invalid decimal format name supplied to \\\\c fn:format-number().\\n\"},{name:\"err:FODF1310\",type:\"xs:QName\",description:\" Invalid decimal/integer format picture string.\\n\"},{name:\"err:FODT0001\",type:\"xs:QName\",description:\" Overflow/underflow in date/time operation.\\n\"},{name:\"err:FODT0002\",type:\"xs:QName\",description:\" Overflow/underflow in duration operation.\\n\"},{name:\"err:FODT0003\",type:\"xs:QName\",description:\" Invalid timezone value.\\n\"},{name:\"err:FONS0004\",type:\"xs:QName\",description:\" No namespace found for prefix.\\n\"},{name:\"err:FONS0005\",type:\"xs:QName\",description:\" Base-URI not defined in static context.\\n\"},{name:\"err:FORG0001\",type:\"xs:QName\",description:\" Invalid value for cast/constructor.\\n\"},{name:\"err:FORG0002\",type:\"xs:QName\",description:\" Invalid argument to \\\\c fn:resolve-uri().\\n\"},{name:\"err:FORG0003\",type:\"xs:QName\",description:\" \\\\c fn:zero-or-one() called with a sequence containing more than one\\n item.\\n\"},{name:\"err:FORG0004\",type:\"xs:QName\",description:\" \\\\c fn:one-or-more() called with a sequence containing no items.\\n\"},{name:\"err:FORG0005\",type:\"xs:QName\",description:\" \\\\c fn:exactly-one() called with a sequence containing zero or more\\n than one item.\\n\"},{name:\"err:FODC0007\",type:\"xs:QName\",description:\" Base URI passed to \\\\c fn:parse() is not a valid absolute URI.\\n\"},{name:\"err:FORG0008\",type:\"xs:QName\",description:\" The two arguments to fn:dateTime() have inconsistent timezones.\\n\"},{name:\"err:FORG0009\",type:\"xs:QName\",description:\" Error in resolving a relative URI against a base URI in\\n \\\\c fn:resolve-uri().\\n\"},{name:\"err:FORX0001\",type:\"xs:QName\",description:\" Invalid regular expression flags.\\n\"},{name:\"err:FORX0002\",type:\"xs:QName\",description:\" Invalid regular expression.\\n\"},{name:\"err:FORX0003\",type:\"xs:QName\",description:\" Regular expression matches zero-length string.\\n\"},{name:\"err:FORX0004\",type:\"xs:QName\",description:\" Invalid replacement string.\\n\"},{name:\"err:FOTY0012\",type:\"xs:QName\",description:\" Argument node does not have a typed value.\\n\"},{name:\"err:FOTY0013\",type:\"xs:QName\",description:\" An argument to \\\\c fn:data() contains a node that does not have a typed\\n value.\\n\"},{name:\"err:FOTY0014\",type:\"xs:QName\",description:\" The argument to \\\\c fn:string() is a function item.\\n\"},{name:\"err:FOTY0015\",type:\"xs:QName\",description:\" An argument to \\\\c fn:deep-equal() contains a function item.\\n\"},{name:\"err:FOUT1170\",type:\"xs:QName\",description:\" Identifier cannot be used to retrive a resource containing text\\n\"},{name:\"err:FOCA0005\",type:\"xs:QName\",description:\" NaN supplied as float/double value.\\n\"},{name:\"err:FTDY0016\",type:\"xs:QName\",description:\" It is a dynamic error if a weight value is not within the required range\\n of values; it is also a dynamic error if an implementation that does not\\n support negative weights encounters a negative weight value.\\n\"},{name:\"err:FTDY0017\",type:\"xs:QName\",description:\" It is a dynamic error if an implementation encounters a mild not\\n selection, one of whose operands evaluates to an AllMatches that\\n contains a StringExclude.\\n\"},{name:\"err:FTST0018\",type:\"xs:QName\",description:\" It is a static error if, during the static analysis phase, the query is\\n found to contain a thesaurus option that refers to a thesaurus that is\\n not found in the statically known thesauri.\\n\"},{name:\"err:FTST0019\",type:\"xs:QName\",description:\" It is a static error if, within a single FTMatchOptions, there is more\\n than one match option of any given match option group.\\n\"},{name:\"err:FTDY0020\",type:\"xs:QName\",description:' It is a dynamic error if, when \"wildcards\" is in effect, a query string\\n violates wildcard syntax.\\n'},{name:\"err:FOER0000\",type:\"xs:QName\",description:\" Unidentified error.\\n\"},{name:\"err:FOAR0001\",type:\"xs:QName\",description:\" Division by zero.\\n\"},{name:\"err:FOAR0002\",type:\"xs:QName\",description:\" Numeric operation overflow/underflow.\\n\"},{name:\"err:FOCA0001\",type:\"xs:QName\",description:\" Input value too large for decimal.\\n\"},{name:\"err:FOCA0002\",type:\"xs:QName\",description:\" Invalid lexical value.\\n\"},{name:\"err:FOCA0003\",type:\"xs:QName\",description:\" Input value too large for integer.\\n\"},{name:\"err:FOUT1190\",type:\"xs:QName\",description:\" Retrieved resource contains octets that cannot be decoded into Unicode\\n using the specified encoding, the resulting characters are not\\n permitted XML characters or requested encoding not supported\\n\"},{name:\"err:FOCA0006\",type:\"xs:QName\",description:\" Raised when casting a string to xs:decimal if the string has more\\n digits of precision than the implementation can represent (the\\n implementation also has the option of rounding).\\n\"},{name:\"err:FOCH0001\",type:\"xs:QName\",description:\" Code point not valid.\\n\"},{name:\"err:FOCH0002\",type:\"xs:QName\",description:\" Unsupported collation.\\n\"},{name:\"err:FOCH0003\",type:\"xs:QName\",description:\" Unsupported normalization form.\\n\"},{name:\"err:FOCH0004\",type:\"xs:QName\",description:\" Collation does not support collation units.\\n\"},{name:\"err:FODC0001\",type:\"xs:QName\",description:\" No context document.\\n\"},{name:\"err:FODC0002\",type:\"xs:QName\",description:\" Error retrieving resource.\\n\"},{name:\"err:FODC0003\",type:\"xs:QName\",description:\" Raised by fn:doc, fn:collection to indicate that it is not possible to\\n return a result that is guaranteed deterministic.\\n\"},{name:\"err:FODC0004\",type:\"xs:QName\",description:\" Invalid argument to \\\\c fn:collection().\\n\"},{name:\"err:FODC0005\",type:\"xs:QName\",description:\" Invalid argument to \\\\c fn:doc() or \\\\c fn:doc-available().\\n\"},{name:\"err:FODC0006\",type:\"xs:QName\",description:\" Invalid content passed to \\\\c fn:parse().\\n\"},{name:\"err:SERE0005\",type:\"xs:QName\",description:\" It is an error if the serialized result would contain an NCName Names\\n that contains a character that is not permitted by the version of\\n Namespaces in XML specified by the version parameter.\\n\"},{name:\"err:XUDY0024\",type:\"xs:QName\",description:\" It is a dynamic error if the effect of a set of updating expressions is\\n to introduce conflicting namespace bindings into an element node.\\n\"},{name:\"err:XUDY0027\",type:\"xs:QName\",description:\" It is a dynamic error if the target expression of an insert, replace, or\\n rename expression evaluates to an empty sequence.\\n\"},{name:\"err:XUST0028\",type:\"xs:QName\",description:\" It is a static error if a function declaration specifies both \\\\c updating\\n and a return type.\\n\"},{name:\"err:XUDY0029\",type:\"xs:QName\",description:\" In an insert expression where \\\\c before or \\\\c after is specified, it is\\n a dynamic error if the node returned by the target expression does not\\n have a parent.\\n\"},{name:\"err:XUDY0030\",type:\"xs:QName\",description:\" It is a dynamic error if an insert expression specifies the insertion of\\n an attribute node before or after a child of a document node.\\n\"},{name:\"err:XUDY0031\",type:\"xs:QName\",description:\" It is a dynamic error if multiple calls to \\\\c fn:put() in the same\\n snapshot specify the same URI (after resolution of relative URIs).\\n\"},{name:\"err:FOUP0001\",type:\"xs:QName\",description:\" It is a dynamic error if the first operand of \\\\c fn:put() is not a node\\n of a supported kind.\\n\"},{name:\"err:FOUP0002\",type:\"xs:QName\",description:\" It is a dynamic error if the second operand of \\\\c fn:put() is not a valid\\n lexical representation of the \\\\c xs:anyURI type.\\n\"},{name:\"err:SENR0001\",type:\"xs:QName\",description:\" It is an error if an item in S6 in sequence normalization is an attribute\\n node or a namespace node.\\n\"},{name:\"err:SERE0003\",type:\"xs:QName\",description:\" It is an error if the serializer is unable to satisfy the rules for\\n either a well-formed XML document entity or a well-formed XML external\\n general parsed entity, or both, except for content modified by the\\n character expansion phase of serialization.\\n\"},{name:\"err:SEPM0004\",type:\"xs:QName\",description:\" It is an error to specify the doctype-system parameter, or to specify\\n the standalone parameter with a value other than omit, if the instance\\n of the data model contains text nodes or multiple element nodes as\\n children of the root node.\\n\"},{name:\"err:XUDY0023\",type:\"xs:QName\",description:\" It is a dynamic error if an insert, replace, or rename expression\\n affects an element node by introducing a new namespace binding that\\n conflicts with one of its existing namespace bindings.\\n\"},{name:\"err:SERE0006\",type:\"xs:QName\",description:\" It is an error if the serialized result would contain a character that is\\n not permitted by the version of XML specified by the version parameter.\\n\"},{name:\"err:SESU0007\",type:\"xs:QName\",description:\" It is an error if an output encoding other than UTF-8 or UTF-16 is\\n requested and the serializer does not support that encoding.\\n\"},{name:\"err:SERE0008\",type:\"xs:QName\",description:\" It is an error if a character that cannot be represented in the encoding\\n that the serializer is using for output appears in a context where\\n character references are not allowed (for example if the character\\n occurs in the name of an element).\\n\"},{name:\"err:SEPM0009\",type:\"xs:QName\",description:\" It is an error if the omit-xml-declaration parameter has the value yes,\\n and the standalone attribute has a value other than omit; or the version\\n parameter has a value other than 1.0 and the doctype-system parameter is\\n specified.\\n\"},{name:\"err:SEPM0010\",type:\"xs:QName\",description:\" It is an error if the output method is xml, the value of the\\n undeclare-prefixes parameter is yes, and the value of the version\\n parameter is 1.0.\\n\"},{name:\"err:SESU0011\",type:\"xs:QName\",description:\" It is an error if the value of the normalization-form parameter\\n specifies a normalization form that is not supported by the serializer.\\n\"},{name:\"err:SERE0012\",type:\"xs:QName\",description:\" It is an error if the value of the normalization-form parameter is\\n fully-normalized and any relevant construct of the result begins with a\\n combining character.\\n\"},{name:\"err:SESU0013\",type:\"xs:QName\",description:\" It is an error if the serializer does not support the version of XML or\\n HTML specified by the version parameter.\\n\"},{name:\"err:SERE0014\",type:\"xs:QName\",description:\" It is an error to use the HTML output method when characters which are\\n legal in XML but not in HTML, specifically the control characters\\n #x7F-#x9F, appear in the instance of the data model.\\n\"},{name:\"err:SERE0015\",type:\"xs:QName\",description:\" It is an error to use the HTML output method when \\\\c &gt; appears within a\\n processing instruction in the data model instance being serialized.\\n\"},{name:\"err:SEPM0016\",type:\"xs:QName\",description:\" It is a an error if a parameter value is invalid for the defined domain.\\n\"},{name:\"err:XUTY0010\",type:\"xs:QName\",description:\" In a replace expression where value of is not specified and\\n the target is an element, text, comment, or processing instruction node,\\n it is a type error if the replacement sequence does not consist of zero\\n or more element, text, comment, or processing instruction nodes.\\n\"},{name:\"err:FOFL0001\",type:\"xs:QName\",description:\" This error is raised if the fn:function-lookup returns a context-dependent function and the context-dependent function is then called.\\n\"},{name:\"err:FOCZ0001\",type:\"xs:QName\",description:\" Invalid content passed to \\\\c x:canonicalize().\\n\"},{name:\"err:XUST0001\",type:\"xs:QName\",description:\" It is a static error if an updating expression is used in any position\\n other than one of the following:\\n - The topmost expression in the body of a query.\\n - The \\\\c modify clause of a transform expression.\\n - The \\\\c return clause of a FLWOR expression.\\n - The \\\\c return clauses of a typeswitch expression in which every \\\\c\\n return clause contains an updating expression or a vacuous expression.\\n - The \\\\c then and \\\\c else clauses of a conditional statement in which\\n both the \\\\c then and \\\\c else clauses contain either an updating\\n expression or a vacuous expression.\\n - An operand of a comma expression in which each operand is either an\\n updating expression or a vacuous expression.\\n - The content of a parenthesized expression.\\n - The body of a function declaration in which the keyword \\\\c updating is\\n specified.\\n\"},{name:\"err:XUST0002\",type:\"xs:QName\",description:\" It is a static error if a simple expression that is not a vacuous\\n expression is used in one of the following positions:\\n - The \\\\c modify clause of a transform expression.\\n - The top-level expression in the body of a function declaration in\\n which the keyword \\\\c updating is specified.\\n\"},{name:\"err:XUST0003\",type:\"xs:QName\",description:\" It is a static error if a Prolog contains more than one revalidation\\n declaration.\\n\"},{name:\"err:XUTY0004\",type:\"xs:QName\",description:\" It is a type error if the insertion sequence of an insert expression\\n contains an attribute node following a node that is not an attribute\\n node.\\n\"},{name:\"err:XUTY0005\",type:\"xs:QName\",description:\" In an insert expression where into, as first\\n into, or as last into is specified, it is a type\\n error if the target expression returns a non-empty result that does not\\n consist of a single element or document node.\\n\"},{name:\"err:XUTY0006\",type:\"xs:QName\",description:\" In an insert expression where \\\\c before or \\\\c after is specified, it is\\n a type error if the target expression returns a non-empty result that\\n does not consist of a single element, text, comment, or processing\\n instruction node.\\n\"},{name:\"err:XUTY0007\",type:\"xs:QName\",description:\" It is a type error if the target expression of a delete expression does\\n not return a sequence of zero or more nodes.\\n\"},{name:\"err:XUTY0008\",type:\"xs:QName\",description:\" In a replace expression, it is a type error if the target expression\\n returns a non-empty result that does not consist of a single element,\\n attribute, text, comment, or processing instruction node.\\n\"},{name:\"err:XUDY0009\",type:\"xs:QName\",description:\" In a replace expression where value of is not specified, it\\n is a dynamic error if the node returned by the target expression does\\n not have a parent.\\n\"},{name:\"err:FTST0009\",type:\"xs:QName\",description:\" It may be a static error if, during the static analysis phase, the query\\n is found to contain a language identifier in a language option that the\\n implementation does not support. The implementation may choose not to\\n raise this error and instead provide some other implementation-defined\\n behavior.\\n\"},{name:\"err:XUTY0011\",type:\"xs:QName\",description:\" In a replace expression where value of is not specified and\\n the target is an attribute node, it is a type error if the replacement\\n sequence does not consist of zero or more attribute nodes.\\n\"},{name:\"err:XUTY0012\",type:\"xs:QName\",description:\" In a rename expression, it is a type error if the target expression\\n returns a non-empty result that does not consist of a single element,\\n attribute, or processing instruction node.\\n\"},{name:\"err:XUTY0013\",type:\"xs:QName\",description:\" In a transform expression, it is a type error if a source expression in\\n the \\\\c copy clause does not return a single node.\\n\"},{name:\"err:XUDY0014\",type:\"xs:QName\",description:\" In a transform expression, it is a dynamic error if the \\\\c modify clause\\n modifies any node that was not created by the \\\\c copy clause.\\n\"},{name:\"err:XUDY0015\",type:\"xs:QName\",description:\" It is a dynamic error if any node is the target of more than one \\\\c\\n rename expression within the same query.\\n\"},{name:\"err:XUDY0016\",type:\"xs:QName\",description:\" It is a dynamic error if any node is the target of more than one \\\\c\\n replace expression (without value of being specified)\\n within the same query.\\n\"},{name:\"err:XUDY0017\",type:\"xs:QName\",description:\" It is a dynamic error if any node is the target of more than one\\n replace value of expression within the same query.\\n\"},{name:\"err:XUDY0018\",type:\"xs:QName\",description:\" It is a dynamic error if a function that was declared to be \\\\c external\\n but not \\\\c updating returns a non-empty pending update list.\\n\"},{name:\"err:XUDY0019\",type:\"xs:QName\",description:\" It is a dynamic error if a function that was declared to be both \\\\c\\n external and \\\\c updating returns a non-empty data model instance.\\n\"},{name:\"err:XUDY0021\",type:\"xs:QName\",description:\" It is a dynamic error if the XDM instance that would result from\\n applying all the updates in a query violates any constraint specified in\\n [XQuery 1.0 and XPath 2.0 Data Model]. In this case, none of the updates\\n in the query are made effective.\\n\"},{name:\"err:XUTY0022\",type:\"xs:QName\",description:\" It is a type error if an insert expression specifies the insertion of an\\n attribute node into a document node.\\n\"},{name:\"err:XQST0052\",type:\"xs:QName\",description:\" The type must be the name of a type defined in the in-scope schema types,\\n and the {variety} of the type must be simple.\\n\"},{name:\"err:XQST0033\",type:\"xs:QName\",description:\" It is a static error if a module contains multiple bindings for the same\\n namespace prefix.\\n\"},{name:\"err:XQST0034\",type:\"xs:QName\",description:\" It is a static error if multiple functions declared or imported by a\\n module have the same number of arguments and their expanded QNames are\\n equal (as defined by the eq operator).\\n\"},{name:\"err:XQST0035\",type:\"xs:QName\",description:\" It is a static error to import two schema components that both define the\\n same name in the same symbol space and in the same scope.\\n\"},{name:\"err:XQST0036\",type:\"xs:QName\",description:\" It is a static error to import a module if the in-scope schema\\n definitions of the importing module do not include all of the following:\\n -# An in-scope schema type for each type-name that appears:\\n - in the type of a variable that is declared in the imported module\\n and referenced in the importing module, OR\\n - in a parameter-type or result-type of a function that is declared in\\n the imported module and referenced in the importing module.\\n -# An in-scope element declaration for each element-name \\\\c EN such that:\\n - \\\\c schema-element(EN) appears in the declared type of a variable in\\n the imported module, and that variable is referenced in the\\n importing module, OR\\n - \\\\c schema-element(EN) appears in a parameter-type or result-type\\n of a function declared in the imported module, and that function is\\n referenced in the importing module.\\n -# An in-scope attribute declaration for each attribute-name \\\\c AN such\\n that:\\n - \\\\c schema-attribute(AN) appears in the declared type of a variable\\n in the imported module, and that variable is referenced in the\\n importing module, OR\\n - \\\\c schema-attribute(AN) appears in a parameter-type or result-type\\n of a function declared in the imported module, and that function is\\n referenced in the importing module.\\n\"},{name:\"err:XQST0038\",type:\"xs:QName\",description:\" It is a static error if a Prolog contains more than one default collation\\n declaration, or the value specified by a default collation declaration is\\n not present in statically known collations.\\n\"},{name:\"err:XQST0039\",type:\"xs:QName\",description:\" It is a static error for a function declaration to have more than one\\n parameter with the same name.\\n\"},{name:\"err:XQST0040\",type:\"xs:QName\",description:\" It is a static error if the attributes specified by a direct element\\n constructor do not have distinct expanded QNames.\\n\"},{name:\"err:XQST0045\",type:\"xs:QName\",description:\" It is a static error if the function name in a function declaration is in\\n one of the following namespaces:\\n http://www.w3.org/XML/1998/namespace,\\n http://www.w3.org/2001/XMLSchema,\\n http://www.w3.org/2001/XMLSchema-instance,\\n http://www.w3.org/2005/xpath-functions.\\n\"},{name:\"err:XQST0046\",type:\"xs:QName\",description:\" An implementation MAY raise a static error if the value of a URILiteral\\n is of nonzero length and is not in the lexical space of \\\\c xs:anyURI.\\n\"},{name:\"err:XQST0047\",type:\"xs:QName\",description:\" It is a static error if multiple module imports in the same Prolog\\n specify the same target namespace.\\n\"},{name:\"err:XQST0048\",type:\"xs:QName\",description:\" It is a static error if a function or variable declared in a library\\n module is not in the target namespace of the library module.\\n\"},{name:\"err:XQST0049\",type:\"xs:QName\",description:\" It is a static error if two or more variables declared or imported by a\\n module have equal expanded QNames (as defined by the eq operator.)\\n\"},{name:\"err:XQST0032\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one base URI\\n declaration.\\n\"},{name:\"err:XQST0054\",type:\"xs:QName\",description:\" It is a static error if a variable depends on itself.\\n\"},{name:\"err:XQST0055\",type:\"xs:QName\",description:\" It is a static error if a Prolog contains more than one copy-namespaces\\n declaration.\\n\"},{name:\"err:XQST0057\",type:\"xs:QName\",description:\" It is a static error if a schema import binds a namespace prefix but\\n does not specify a target namespace other than a zero-length string.\\n\"},{name:\"err:XQST0058\",type:\"xs:QName\",description:\" It is a static error if multiple schema imports specify the same target\\n namespace.\\n\"},{name:\"err:XQST0059\",type:\"xs:QName\",description:\" It is a static error if an implementation is unable to process a schema\\n or module import by finding a schema or module with the specified\\n target namespace.\\n\"},{name:\"err:XQST0060\",type:\"xs:QName\",description:\" It is a static error if the name of a function in a function declaration\\n is not in a namespace (expanded QName has a null namespace URI).\\n\"},{name:\"err:XQST0065\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one ordering mode\\n declaration.\\n\"},{name:\"err:XQST0066\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one default\\n element/type namespace declaration, or more than one default function\\n namespace declaration.\\n\"},{name:\"err:XQST0067\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one construction\\n declaration.\\n\"},{name:\"err:XQST0068\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one\\n boundary-space declaration.\\n\"},{name:\"err:XQST0069\",type:\"xs:QName\",description:\" A static error is raised if a Prolog contains more than one empty order\\n declaration.\\n\"},{name:\"err:XPTY0019\",type:\"xs:QName\",description:\" It is a type error if the result of a step (other than the last step) in a\\n path expression contains an atomic value.\\n\"},{name:\"err:XPST0001\",type:\"xs:QName\",description:\" It is a static error if analysis of an expression relies on some\\n component of the static context that has not been assigned a value.\\n\"},{name:\"err:XPST0003\",type:\"xs:QName\",description:\" It is a static error if an expression is not a valid instance of the\\n grammar.\\n\"},{name:\"err:XPST0005\",type:\"xs:QName\",description:\" During the analysis phase, it is a static error if the static type\\n assigned to an expression other than the expression \\\\c () or \\\\c data(())\\n is \\\\c empty-sequence().\\n\"},{name:\"err:XPST0008\",type:\"xs:QName\",description:\" It is a static error if an expression refers to an element name,\\n attribute name, schema type name, namespace prefix, or variable name\\n that is not defined in the static context, except for an ElementName in\\n an ElementTest or an AttributeName in an AttributeTest.\\n\"},{name:\"err:XPST0017\",type:\"xs:QName\",description:\" It is a static error if the expanded QName and number of arguments in a\\n function call do not match the name and arity of a function signature in\\n the static context.\\n\"},{name:\"err:XPST0051\",type:\"xs:QName\",description:\" It is a static error if a QName that is used as an AtomicType in a\\n SequenceType is not defined in the in-scope schema types as an atomic\\n type.\\n\"},{name:\"err:XPST0080\",type:\"xs:QName\",description:\" It is a static error if the target type of a \\\\c cast or \\\\c castable\\n expression is \\\\c xs:NOTATION or \\\\c xs:anyAtomicType.\\n\"},{name:\"err:XPST0081\",type:\"xs:QName\",description:\" It is a static error if a QName used in a query contains a namespace\\n prefix that cannot be expanded into a namespace URI by using the\\n statically known namespaces.\\n\"},{name:\"err:XPST0083\",type:\"xs:QName\",description:\" It is a static error if the target type of a \\\\c cast expression or\\n constructor function is \\\\c xs:QName or a type derived from \\\\c xs:QName\\n or \\\\c xs:NOTATION, and the argument of the cast expression or\\n constructor function is not a string literal.\\n\"},{name:\"err:XPTY0004\",type:\"xs:QName\",description:\" It is a type error if, during the static analysis phase, an expression\\n is found to have a static type that is not appropriate for the context\\n in which the expression occurs, or during the dynamic evaluation phase,\\n the dynamic type of a value does not match a required type as specified\\n by the matching rules in 2.5.4 SequenceType Matching.\\n\"},{name:\"err:XPTY0018\",type:\"xs:QName\",description:\" It is a type error if the result of the last step in a path expression\\n contains both nodes and non-nodes.\\n\"},{name:\"err:XQST0070\",type:\"xs:QName\",description:\" A static error is raised if one of the predefined prefixes \\\\c xml or \\\\c\\n xmlns appears in a namespace declaration, or if any of the following\\n conditions is statically detected in any expression or declaration:\\n - The prefix \\\\c xml is bound to some namespace URI other than\\n http://www.w3.org/XML/1998/namespace.\\n - A prefix other than \\\\c xml is bound to the namespace URI\\n http://www.w3.org/XML/1998/namespace.\\n - The prefix \\\\c xmlns is bound to any namespace URI.\\n - A prefix other than \\\\c xmlns is bound to the namespace URI\\n http://www.w3.org/2000/xmlns/.\\n\"},{name:\"err:XPTY0020\",type:\"xs:QName\",description:\" It is a type error if, in an axis step, the context item is not a node.\\n\"},{name:\"err:XPTY0117\",type:\"xs:QName\",description:\" Attempt to cast to a namespace-sensitive type failed because the namespace\\n bindings for the result can not be determined.\\n\"},{name:\"err:XQTY0024\",type:\"xs:QName\",description:\" It is a type error if the content sequence in an element constructor\\n contains an attribute node following a node that is not an attribute node.\\n\"},{name:\"err:XQTY0030\",type:\"xs:QName\",description:\" It is a type error if the argument of a validate expression does not\\n evaluate to exactly one document or element node.\\n\"},{name:\"err:XQTY0086\",type:\"xs:QName\",description:\" It is a type error if the typed value of a copied element or attribute\\n node is namespace-sensitive when construction mode is \\\\c preserve and\\n copy-namespaces mode is \\\\c no-preserve.\\n\"},{name:\"err:XQTY0105\",type:\"xs:QName\",description:\" It is a type error if the content sequence in an element constructor contains a function item.\\n\"},{name:\"err:XQST0009\",type:\"xs:QName\",description:\" An implementation that does not support the Schema Import Feature must\\n raise a static error if a Prolog contains a schema import.\\n\"},{name:\"err:XQST0012\",type:\"xs:QName\",description:\" It is a static error if the set of definitions contained in all schemas\\n imported by a Prolog do not satisfy the conditions for schema validity\\n specified in Sections 3 and 5 of [XML Schema] Part 1--i.e., each\\n definition must be valid, complete, and unique.\\n\"},{name:\"err:XQST0013\",type:\"xs:QName\",description:\" It is a static error if an implementation recognizes a pragma but\\n determines that its content is invalid.\\n\"},{name:\"err:XQST0022\",type:\"xs:QName\",description:\" It is a static error if the value of a namespace declaration attribute is\\n not a URILiteral.\\n\"},{name:\"err:XQST0031\",type:\"xs:QName\",description:\" It is a static error if the version number specified in a version\\n declaration is not supported by the implementation.\\n\"},{name:\"err:XQDY0072\",type:\"xs:QName\",description:\" It is a dynamic error if the result of the content expression of a\\n computed comment constructor contains two adjacent hyphens or ends with\\n a hyphen.\\n\"},{name:\"err:XQST0128\",type:\"xs:QName\",description:\" It is a static error if a feature name that an implementation supports appears\\n in a prohibit-feature option declaration, and the implementation is unable to\\n disable the feature.\\n\"},{name:\"err:XPDY0002\",type:\"xs:QName\",description:\" It is a dynamic error if evaluation of an expression relies on some part\\n of the dynamic context that has not been assigned a value.\\n\"},{name:\"err:XPDY0050\",type:\"xs:QName\",description:' It is a dynamic error if the dynamic type of the operand of a treat\\n expression does not match the sequence type specified by the treat\\n expression. This error might also be raised by a path expression\\n beginning with \"/\" or \"//\" if the context node\\n is not in a tree that is rooted at a document node. This is because a\\n leading \"/\" or \"//\" in a path expression is an\\n abbreviation for an initial step that includes the clause \\\\c treat as \\\\c\\n document-node().\\n'},{name:\"err:XQDY0025\",type:\"xs:QName\",description:\" It is a dynamic error if any attribute of a constructed element does not\\n have a name that is distinct from the names of all other attributes of\\n the constructed element.\\n\"},{name:\"err:XQDY0026\",type:\"xs:QName\",description:' It is a dynamic error if the result of the content expression of a\\n computed processing instruction constructor contains the string \"?&gt;\".\\n'},{name:\"err:XQDY0027\",type:\"xs:QName\",description:\" In a validate expression, it is a dynamic error if the root element\\n information item in the PSVI resulting from validation does not have the\\n expected validity property: \\\\c valid if validation mode is \\\\c strict, or\\n either \\\\c valid or \\\\c notKnown if validation mode is \\\\c lax.\\n\"},{name:\"err:XQDY0041\",type:\"xs:QName\",description:\" It is a dynamic error if the value of the name expression in a computed\\n processing instruction constructor cannot be cast to the type\\n \\\\c xs:NCName.\\n\"},{name:\"err:XQDY0044\",type:\"xs:QName\",description:\" It is a static error the node-name of a node constructed by a computed\\n attribute constructor has any of the following properties:\\n - Its namespace prefix is \\\\c xmlns.\\n - It has no namespace prefix and its local name is \\\\c xmlns.\\n - Its namespace URI is http://www.w3.org/2000/xmlns/.\\n - Its namespace prefix is \\\\c xml and its namespace URI is not\\n http://www.w3.org/XML/1998/namespace.\\n - Its namespace prefix is other than \\\\c xml and its namespace URI is\\n http://www.w3.org/XML/1998/namespace.\\n\"},{name:\"err:XQDY0054\",type:\"xs:QName\",description:\" It is a dynamic error if a cycle is encountered in the definition of a\\n module's dynamic context components, for example because of a cycle in\\n variable declarations.\\n\"},{name:\"err:XQDY0061\",type:\"xs:QName\",description:\" It is a dynamic error if the operand of a validate expression is a\\n document node whose children do not consist of exactly one element node\\n and zero or more comment and processing instruction nodes, in any order.\\n\"},{name:\"err:XQDY0064\",type:\"xs:QName\",description:' It is a dynamic error if the value of the name expression in a computed\\n processing instruction constructor is equal to \"XML\" (in any combination\\n of upper and lower case).\\n'},{name:\"err:XQST0127\",type:\"xs:QName\",description:\" It is a static error if a given feature is both required and prohibited, directly or indirectly, in a module.\\n\"},{name:\"err:XQDY0074\",type:\"xs:QName\",description:\" It is a dynamic error if the value of the name expression in a computed\\n element or attribute constructor cannot be converted to an expanded\\n QName (for example, because it contains a namespace prefix not found in\\n statically known namespaces).\\n\"},{name:\"err:XQDY0084\",type:\"xs:QName\",description:\" It is a dynamic error if the element validated by a \\\\c validate statement\\n does not have a top-level element declaration in the in-scope element\\n declarations, if validation mode is \\\\c strict.\\n\"},{name:\"err:XQDY0091\",type:\"xs:QName\",description:\" An implementation MAY raise a dynamic error if an \\\\c xml:id error, as\\n defined in [XML ID], is encountered during construction of an attribute\\n named \\\\c xml:id.\\n\"},{name:\"err:XQDY0092\",type:\"xs:QName\",description:\" An implementation MAY raise a dynamic error if a constructed attribute\\n named \\\\c xml:space has a value other than \\\\c preserve or \\\\c default.\\n\"},{name:\"err:XQDY0096\",type:\"xs:QName\",description:\" It is a dynamic error the node-name of a node constructed by a computed\\n element constructor has any of the following properties:\\n - Its namespace prefix is \\\\c xmlns.\\n - Its namespace URI is http://www.w3.org/2000/xmlns/.\\n - Its namespace prefix is \\\\c xml and its namespace URI is not\\n http://www.w3.org/XML/1998/namespace.\\n - Its namespace prefix is other than \\\\c xml and its namespace URI is\\n http://www.w3.org/XML/1998/namespace.\\n\"},{name:\"err:XQDY0101\",type:\"xs:QName\",description:\" Invalid prefix and/or uri in computed namespace constructor\\n\"},{name:\"err:XQDY0102\",type:\"xs:QName\",description:\" In an element constructor, if two or more namespace bindings in the in-scope bindings would have the same prefix, then an error is raised if they have different URIs; if they would have the same prefix and URI, duplicate bindings are ignored.\\n\"},{name:\"err:XTDE1310\",type:\"xs:QName\",description:\" It is a non-recoverable dynamic error if the picture string does not\\n satisfy the format-number function rules.\\n\"},{name:\"err:FOFD1340\",type:\"xs:QName\",description:\" It is a non-recoverable dynamic error if the $picture, $language,\\n $calendar, or $place argument for fn:format-date, fn:format-time, or\\n fn:format-dateTime is invalid.\\n\"},{name:\"err:FOFD1350\",type:\"xs:QName\",description:\" It is a non-recoverable dynamic error if a component specifier within\\n the picture refers to components that are not available in the given\\n type of $value.\\n\"},{name:\"err:FTST0008\",type:\"xs:QName\",description:\" It is a static error if, during the static analysis phase, the query is\\n found to contain a stop word option that refers to a stop word list that\\n is not found in the statically known stop word lists.\\n\"},{name:\"err:XQST0098\",type:\"xs:QName\",description:\" It is a static error if, for any named or unnamed decimal format, the\\n properties representing characters used in a picture string do not each\\n have distinct values. These properties are decimal-separator-sign,\\n grouping-separator, percent-sign, per-mille-sign, zero-digit,\\n digit-sign, and pattern-separator-sign.\\n\"},{name:\"err:XQST0071\",type:\"xs:QName\",description:\" A static error is raised if the namespace declaration attributes of a\\n direct element constructor do not have distinct names.\\n\"},{name:\"err:XQST0076\",type:\"xs:QName\",description:\" It is a static error if a \\\\c collation subclause in an order by clause\\n of a FLWOR expression does not identify a collation that is present in\\n statically known collations.\\n\"},{name:\"err:XQST0079\",type:\"xs:QName\",description:\" It is a static error if an extension expression contains neither a\\n pragma that is recognized by the implementation nor an expression\\n enclosed in curly braces.\\n\"},{name:\"err:XQST0085\",type:\"xs:QName\",description:\" It is a static error if the namespace URI in a namespace declaration\\n attribute is a zero-length string, and the implementation does not\\n support [XML Names 1.1].\\n\"},{name:\"err:XQST0087\",type:\"xs:QName\",description:\" It is a static error if the encoding specified in a Version Declaration\\n does not conform to the definition of \\\\c EncName specified in [XML 1.0]\\n\"},{name:\"err:XQST0088\",type:\"xs:QName\",description:\" It is a static error if the literal that specifies the target namespace\\n in a module import or a module declaration is of zero length.\\n\"},{name:\"err:XQST0089\",type:\"xs:QName\",description:\" It is a static error if a variable bound in a \\\\c for or \\\\c window clause\\n of a FLWOR expression, and its associated positional variable, do not\\n have distinct names (expanded QNames).\\n\"},{name:\"err:XQST0090\",type:\"xs:QName\",description:\" It is a static error if a character reference does not identify a valid\\n character in the version of XML that is in use.\\n\"},{name:\"err:XQST0093\",type:\"xs:QName\",description:\" It is a static error to import a module M1 if there exists a sequence of\\n modules M1 ... Mi ... M1 such that each module directly depends on the\\n next module in the sequence (informally, if M1 depends on itself through\\n some chain of module dependencies.)\\n\"},{name:\"err:XQST0094\",type:\"xs:QName\",description:\" In the group by clause of a FLWOR expression, it is a static error if the\\n name of a grouping variable is not equal (by the eq operator on expanded\\n QNames) to the name of a variable that is bound by a for or let clause\\n that precedes the group by clause.\\n\"},{name:\"err:XQST0097\",type:\"xs:QName\",description:\" It is a static error for a decimal-format to specify a value that is\\n not valid for a given property.\\n\"},{name:\"err:NS\",type:\"item()*\",description:\"\"},{name:\"err:XQST0099\",type:\"xs:QName\",description:\" If a module contains more than one context item declaration, a static error is raised [err:XQST0099].\\n\"},{name:\"err:XQST0103\",type:\"xs:QName\",description:\" All variables in a window clause must have distinct names.\\n\"},{name:\"err:XQST0106\",type:\"xs:QName\",description:\" It is a static error if a function's annotations contain more than one\\n annotation named \\\\c private or \\\\c public.  It is a static error if a\\n function's annotations contain more than one annotation named \\\\c\\n deterministic or \\\\c nondeterministic.\\n\"},{name:\"err:XQST0111\",type:\"xs:QName\",description:\" It is a static error for a query prolog to contain two decimal formats\\n with the same name, or to contain two default decimal formats.\\n\"},{name:\"err:XQST0113\",type:\"xs:QName\",description:\" Specifying a VarValue or VarDefaultValue for a context item declaration\\n in a library module is a static error.\\n\"},{name:\"err:XQST0114\",type:\"xs:QName\",description:\" It is a static error for a decimal format declaration to define the\\n same property more than once.\\n\"},{name:\"err:XQST0116\",type:\"xs:QName\",description:\" It is a static error if a variable declaration contains both a %private\\n and a %public annotation, more than one %private annotation, or more\\n than one %public annotation.\\n\"},{name:\"err:XQST0120\",type:\"xs:QName\",description:\" It is a static error if a feature required by require-feature is not\\n supported by the implementation.\\n\"},{name:\"err:XQST0122\",type:\"xs:QName\",description:\" It is a static error if the name of a feature in require-feature or\\n prohibit-feature is not in the lexical space of QName.\\n\"},{name:\"err:XQST0123\",type:\"xs:QName\",description:\" It is a static error if the name of a feature in require-feature is not\\n recognized by the implementation.\\n\"},{name:\"err:XQST0126\",type:\"xs:QName\",description:\" It is a static error if all-extensions appears in a require-feature option declaration.\\n\"}]},\"http://zorba.io/modules/excel/math\":{ns:\"http://zorba.io/modules/excel/math\",description:\" This is a library module offering a part of the set of functions\\n defined by Microsoft Excel 2003.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528291033.aspx\" target=\"_blank\">Excel 2003 Documentation: Math Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"abs\",qname:\"excel:abs\",signature:\"($arg as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Compute the abs of a numeric value.\\n The value can also be a string and it will be casted to the appropriate numeric first.\\n\",summary:\"<p> Compute the abs of a numeric value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The parameter can be a number, string, boolean value.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The abs value as a numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if arg cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"cast-as-numeric\",qname:\"excel:cast-as-numeric\",signature:\"($number as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Cast the xs:anyAtomicType to a numeric type.\\n If the value is already of a numeric type then nothing is changed.\\n Otherwise the value is casted to the numeric type that is most appropriate.\\n\",summary:\"<p> Cast the xs:anyAtomicType to a numeric type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The parameter can be a number, string, boolean value.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The casted value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the value cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"ceiling\",qname:\"excel:ceiling\",signature:\"($number as xs:anyAtomicType, $significance as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns number rounded up, away from zero, to the nearest multiple of significance.\\n Significance must have the same sign as number.\\n Number and significance must be of a numeric type or castable to numeric.\\n Significance must not be zero.\\n\",summary:\"<p> Returns number rounded up, away from zero, to the nearest multiple of significance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value you want to round.</div>'},{name:\"significance\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The rounded value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if significance is zero or it doesn\\'t have the same sign as number.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"degrees\",qname:\"excel:degrees\",signature:\"($radian as xs:double) as xs:integer\",description:\" Converts radians into degrees.\\n\",summary:\"<p> Converts radians into degrees.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"radian\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value in radians.</div>'}],returns:{type:\"xs:integer\",description:\"The value in degrees 0 .. 360 or 0 .. -360.\"},errors:[]},{isDocumented:!0,arity:1,name:\"even\",qname:\"excel:even\",signature:\"($number as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns number rounded up to the nearest even integer.\\n Regardless of the sign of number, a value is rounded up when adjusted away from zero.\\n\",summary:\"<p> Returns number rounded up to the nearest even integer.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The rounded value casted as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"fact\",qname:\"excel:fact\",signature:\"($number as xs:anyAtomicType) as xs:integer\",description:\" Returns the factorial of a number.\\n\",summary:\"<p> Returns the factorial of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The nonnegative number you want the factorial of. If number is not an integer, it is truncated.</div>'}],returns:{type:\"xs:integer\",description:\"Returns the factorial of a number. The factorial of a number is equal to 1*2*3*...* number.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the number is smaller than zero</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"factdouble\",qname:\"excel:factdouble\",signature:\"($number as xs:integer) as xs:integer\",description:\" Returns the double factorial of a number.\\n Computes the double factorial of n as n(n-2)(n-4)...\\n\",summary:\"<p> Returns the double factorial of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The positive integer value.</div>'}],returns:{type:\"xs:integer\",description:\"The result as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the number is negative.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"floor\",qname:\"excel:floor\",signature:\"($number as xs:anyAtomicType, $significance as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Rounds number down, toward zero, to the nearest multiple of significance.\\n Significance must have the same sign as number.\\n\",summary:\"<p> Rounds number down, toward zero, to the nearest multiple of significance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value you want to round. The value is casted to numeric.</div>'},{name:\"significance\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The rounded value as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if significance is zero or it doesn\\'t have the same sign as number.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"gcd\",qname:\"excel:gcd\",signature:\"($numbers as xs:integer+) as xs:integer\",description:\" Returns the greatest common divisor GCD of a sequence of integers.\\n The sequence can have one or more positive integers.\\n\",summary:\"<p> Returns the greatest common divisor GCD of a sequence of integers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:integer\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of positive integers.</div>'}],returns:{type:\"xs:integer\",description:\"The GCD as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if any number is smaller than zero.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"int\",qname:\"excel:int\",signature:\"($number as xs:anyAtomicType) as xs:integer\",description:\" Rounds a number down to the nearest integer.\\n Positive numbers are rounded toward zero, negative numbers are rounded away from zero.\\n\",summary:\"<p> Rounds a number down to the nearest integer.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be rounded.</div>'}],returns:{type:\"xs:integer\",description:\"The rounded integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameter cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-a-number\",qname:\"excel:is-a-number\",signature:\"($value as xs:anyAtomicType) as xs:boolean\",description:\" Checks if the xs:anyAtomicType argument is actually a numeric type\\n or can be converted to numeric.\\n\",summary:\"<p> Checks if the xs:anyAtomicType argument is actually a numeric type\\n or can be converted to numeric.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Parameter to be checked.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the value can be casted to numeric.\"},errors:[]},{isDocumented:!0,arity:1,name:\"lcm\",qname:\"excel:lcm\",signature:\"($numbers as xs:integer+) as xs:integer\",description:' Returns the least common multiple of integers.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n LCM for two numbers is computed by multiplying them and dividing with GCD. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The function is applied recursively replacing the first two numbers in the sequence with their LCM.\\n',summary:\"<p> Returns the least common multiple of integers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:integer\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of one or more positive integers.</div>'}],returns:{type:\"xs:integer\",description:\"The LCM as integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if any number is smaller than zero.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"mod\",qname:\"excel:mod\",signature:\"($number as xs:anyAtomicType, $divisor as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns the remainder after number is divided by divisor.\\n The result has the same sign as divisor.\\n\",summary:\"<p> Returns the remainder after number is divided by divisor.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number for which you want to find the remainder.</div>'},{name:\"divisor\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number by which you want to divide number. This cannot be zero.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The remainder from division as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Div0 if divisor is zero after casting to numeric.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"mround\",qname:\"excel:mround\",signature:\"($number as xs:anyAtomicType, $multiple as xs:anyAtomicType) as xs:anyAtomicType\",description:\" Returns a number rounded to the desired multiple.\\n MROUND rounds up, away from zero, if the remainder of dividing number by multiple\\n is greater than or equal to half the value of multiple.\\n MROUND is computed through floor function.\\n\",summary:\"<p> Returns a number rounded to the desired multiple.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round, castable to numeric type.</div>'},{name:\"multiple\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The multiple to which you want to round number.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The rounded number up to the desired multiple.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"odd\",qname:\"excel:odd\",signature:\"($number as xs:anyAtomicType) as xs:integer\",description:\" Returns number rounded up to the nearest odd integer, away from zero.\\n\",summary:\"<p> Returns number rounded up to the nearest odd integer, away from zero.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to round.</div>'}],returns:{type:\"xs:integer\",description:\"The odd integer.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameter cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"pi\",qname:\"excel:pi\",signature:\"() as xs:decimal\",description:\" Return the value of PI as decimal with 15 digits.\\n\",summary:\"<p> Return the value of PI as decimal with 15 digits.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:decimal\",description:\"The value of PI with 15 digits.\"},errors:[]},{isDocumented:!0,arity:2,name:\"power\",qname:\"excel:power\",signature:\"($number as xs:anyAtomicType, $power as xs:integer) as xs:anyAtomicType\",description:\" Returns the result of a number raised to a power.\\n The result is computed through successive multiplications.\\n\",summary:\"<p> Returns the result of a number raised to a power.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The base number.</div>'},{name:\"power\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The exponent as integer (cannot be floating point like in Excel).</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The result as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameter cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if power is smaller than zero.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"product\",qname:\"excel:product\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies all the numbers given as arguments and returns the product.\\n\",summary:\"<p> Multiplies all the numbers given as arguments and returns the product.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of arguments convertable to numeric types. The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The multiplication result as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"quotient\",qname:\"excel:quotient\",signature:\"($numerator as xs:anyAtomicType, $denominator as xs:anyAtomicType) as xs:integer\",description:\" Returns the integer portion of a division.\\n\",summary:\"<p> Returns the integer portion of a division.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numerator\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The divident.</div>'},{name:\"denominator\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The divisor. It cannot be zero.</div>'}],returns:{type:\"xs:integer\",description:\"The result value as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Div0 if denominator casted as numeric type has value zero.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"radians\",qname:\"excel:radians\",signature:\"($degree as xs:integer) as xs:decimal\",description:\" Converts degrees to radians.\\n\",summary:\"<p> Converts degrees to radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"degree\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An angle in degrees that you want to convert.</div>'}],returns:{type:\"xs:decimal\",description:\"The value in radians.\"},errors:[]},{isDocumented:!0,arity:1,name:\"roman\",qname:\"excel:roman\",signature:\"($number as xs:integer) as xs:string\",description:' Converts an arabic numeral to roman, as text.\\n Only the clasic format is supported (out of all formats Excel requires).<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n M is the largest digit, it represents 1000.\\n Numbers bigger than 2000 will be represented by a sequence of \"M\".<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n D = 500, C = 100, L = 50, X = 10, V = 5, I = 1.\\n',summary:\"<p> Converts an arabic numeral to roman, as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A positive integer.</div>'}],returns:{type:\"xs:string\",description:\"The roman string representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if the input integer is negative</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"round\",qname:\"excel:round\",signature:\"($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType\",description:\" Rounds a number to a specified number of digits.\\n If precision is greater than 0 (zero), then number is rounded\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded to the nearest integer.\\n If num_digits is less than 0, then number is rounded to the left of the decimal point.\\n The 0.5 is rounded away from zero.\\n\",summary:\"<p> Rounds a number to a specified number of digits.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round, castable to a numeric type.</div>'},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The rounded number as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"rounddown\",qname:\"excel:rounddown\",signature:\"($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType\",description:\" Rounds a number down, toward zero.\\n If num_digits is greater than 0 (zero), then number is rounded down\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded down to the nearest integer.\\n If num_digits is less than 0, then number is rounded down to the left of the decimal point.\\n\",summary:\"<p> Rounds a number down, toward zero.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round, castable to numeric type.</div>'},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the truncated number toward zero, as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"roundup\",qname:\"excel:roundup\",signature:\"($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType\",description:\" Rounds a number up, away from 0 (zero).\\n If num_digits is greater than 0 (zero), then number is rounded down\\n to the specified number of decimal places.\\n If num_digits is 0, then number is rounded down to the nearest integer.\\n If num_digits is less than 0, then number is rounded down to the left of the decimal point.\\n\",summary:\"<p> Rounds a number up, away from 0 (zero).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number to round, castable to numeric type.</div>'},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The truncated number away from zero, as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"sign\",qname:\"excel:sign\",signature:\"($number as xs:anyAtomicType) as xs:integer\",description:\" Determines the sign of a number.\\n Returns 1 if the number is positive, zero (0) if the number is 0,\\n and -1 if the number is negative.\\n\",summary:\"<p> Determines the sign of a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument castable to numeric type.</div>'}],returns:{type:\"xs:integer\",description:\"The sign as (-1, 0, 1).\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"sort-numbers\",qname:\"excel:sort-numbers\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType*\",description:' Helper function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Sorts a sequence of numbers or arguments castable to numeric.\\n It first casts all arguments to numeric and then sorts ascending.\\n',summary:\"<p> Helper function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of arguments castable to numeric.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"The sorted sequence as numeric types.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"sum\",qname:\"excel:sum\",signature:\"($numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Adds all the numbers in the sequence.\\n\",summary:\"<p> Adds all the numbers in the sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of arguments castable to numeric types. The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The sum as numeric type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameters cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"trunc\",qname:\"excel:trunc\",signature:\"($number as xs:anyAtomicType) as xs:integer\",description:\" Truncates a number to an integer by removing the fractional part of the number.\\n\",summary:\"<p> Truncates a number to an integer by removing the fractional part of the number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument castable to numeric type.</div>'}],returns:{type:\"xs:integer\",description:\"The integer value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameter cannot be casted to numeric type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"trunc\",qname:\"excel:trunc\",signature:\"($number as xs:anyAtomicType, $precision as xs:integer) as xs:anyAtomicType\",description:\" Truncates a number down to precision.\\n This behaves exactly like rounddown.\\n\",summary:\"<p> Truncates a number down to precision.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The argument castable to numeric type.</div>'},{name:\"precision\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of decimal places to keep .</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The integer value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if parameter cannot be casted to numeric type.</xqdoc:error>']}],variables:[]},\"http://api.28.io/browserview\":{ns:\"http://api.28.io/browserview\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/browserview\",prefix:\"browserview\"},{uri:\"http://api.28.io/model\",prefix:\"model\"},{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"}],functions:[{isDocumented:!1,arity:1,name:\"node-path\",qname:\"browserview:node-path\",signature:\"($node)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"node-reference\",qname:\"browserview:node-reference\",signature:\"($node, $short as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"},{name:\"short\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"serialize\",qname:\"browserview:serialize\",signature:\"($json)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"json\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"serializeMulti\",qname:\"browserview:serializeMulti\",signature:\"($json)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"json\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"show-namespaces\",qname:\"browserview:show-namespaces\",signature:\"($namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"show-node\",qname:\"browserview:show-node\",signature:\"($node, $namespaces, $short as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"},{name:\"short\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"show-nodes\",qname:\"browserview:show-nodes\",signature:\"($nodes)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/json-csv\":{ns:\"http://zorba.io/modules/json-csv\",description:' This module provides an API for parsing and serializing CSV (comma-separated\\n values) files.\\n See RFC 4180,\\n \"Common Format and MIME Type for Comma-Separated Values (CSV) Files.\"\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/json-csv\",prefix:\"csv\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"parse\",qname:\"csv:parse\",signature:\"($csv as string) as object()*\",description:' Parses a CSV (comma-separated values) string using the default options.\\n A newline (U+000A), optionally preceeded by a carriage-return (U+000D),\\n terminates lines, aka, \"records.\"\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Quoted values are always considered strings;\\n unquoted values are attempted to be cast to other types, e.g., integer\\n (unless the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cast-unquoted-values</code> option is <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">false</code>).\\n Casting is attempted in the following order:\\n integer, decimal, double, and boolean.\\n If casting fails, the value is considered a string.\\n Header field names are always considered strings even if unquoted.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n In addition to the \"normal\" values of\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">false</code> for boolean,\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">T</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Y</code> are also considered \"true\"\\n and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">F</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</code> are also considered \"false.\"\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The default options are:\\n  <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    <dt><code>cast-unquoted-values</code></dt>\\n      <dd>\\n        Whether to attempt to cast unquoted values to\\n        integer, decimal, double, or boolean;\\n        default: <code>true</code>.\\n      </dd>\\n    <dt><code>extra-name</code></dt>\\n      <dd>\\n        The field name for extra values, if any;\\n        default: none (error <code>csv:EXTRA_VALUE</code> is raised).\\n      </dd>\\n    <dt><code>field-names</code></dt>\\n      <dd>\\n        A JSON array of strings denoting field names;\\n        default: none.\\n        The first CSV line is assumed to be a header line\\n        and the field names are taken from this line.\\n      </dd>\\n    <dt><code>missing-value</code></dt>\\n      <dd>\\n        What should happen when a missing value is detected;\\n        default: <code>\"null\"</code>.\\n        A \"missing\" value is one of:\\n        <ul>\\n          <li>Two consecutive <code>quote-char</code> characters.</li>\\n          <li>A <code>quote-char</code> character as either the first\\n              or last character on a line.</li>\\n          <li>Fewer values than the number of field names.</li>\\n        </ul>\\n        When a missing value is detected,\\n        the value is set to <code>null</code>.\\n      </dd>\\n    <dt><code>quote-char</code></dt>\\n      <dd>\\n        The single ASCII character that may be used to quote values;\\n        default: <code>\"</code> (U+0022).\\n      </dd>\\n    <dt><code>quote-escape</code></dt>\\n      <dd>\\n        The single ASCII character used to escape <code>quote-char</code>;\\n        default: same as <code>quote-char</code>.\\n        This means that an escaped quote is doubled as <code>\"\"</code>.\\n      </dd>\\n    <dt><code>separator</code></dt>\\n      <dd>\\n        The single ASCII character used to separate values;\\n        default: <code>,</code> (U+002C).\\n      </dd>\\n  </dl>\\n',summary:\"<p> Parses a CSV (comma-separated values) string using the default options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"csv\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The CSV string to parse.</div>'}],returns:{type:\"object()*\",description:\"a sequence of zero or more JSON objects where each key is a field name and each value is a parsed value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:EXTRA_VALUE if an extra value is detected.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse\",qname:\"csv:parse\",signature:\"($csv as string, $options as object()) as object()* external\",description:' Parses a CSV (comma-separated values) string using the given options.\\n A newline (U+000A), optionally preceeded by a carriage-return (U+000D),\\n terminates lines, aka, \"records.\"\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Quoted values are always considered strings;\\n unquoted values are attempted to be cast to other types, e.g., integer\\n (unless the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cast-unquoted-values</code> option is <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">false</code>).\\n Casting is attempted in the following order:\\n integer, decimal, double, and boolean.\\n If casting fails, the value is considered a string.\\n Header field names are always considered strings even if unquoted.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n In addition to the \"normal\" values of\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">false</code> for boolean,\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">T</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Y</code> are also considered \"true\"\\n and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">F</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</code> are also considered \"false.\"\\n',summary:\"<p> Parses a CSV (comma-separated values) string using the given options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"csv\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The CSV string to parse.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options to use: <dl> <dt><code>cast-unquoted-values</code></dt> <dd> Whether to attempt to cast unquoted values to integer, decimal, double, or boolean; default: <code>true</code>. </dd> <dt><code>extra-name</code></dt> <dd> The field name for extra values, if any; default: none (error <code>csv:EXTRA_VALUE</code> is raised). If this option is given and a line contains one or more extra values (that is, values that have no corresponding field names), then the extra values are assigned as the values for fields having <code>extra-name</code> as their names. <p/> If <code>extra-name</code> contains a <code>#</code> (U+0023), then the <code>#</code> is substituted with the field number (where field numbers start at 1). If <code>extra-name</code> does not contains a <code>#</code>, then the field number is appended. </dd> <dt><code>field-names</code></dt> <dd> A JSON array of strings denoting field names; default: none. If this option is given, then the first CSV line is assumed not to be a header line; if omitted, then the first CSV line is assumed to be a header line and the field names are taken from this line. </dd> <dt><code>missing-value</code></dt> <dd> What should happen when a missing value is detected; default: <code>\"null\"</code>. A \"missing\" value is one of: <ul> <li>Two consecutive <code>separator</code> characters.</li> <li>A <code>separator</code> character as either the first or last character on a line.</li> <li>Fewer values than the number of field names.</li> </ul> When a missing value is detected, the value of this option determines what happens: <dl> <dt><code>\"error\"</code></dt> <dd>Error <code>csv:MISSING_VALUE</code> is raised.</dd> <dt><code>\"omit\"</code></dt> <dd>Both the value and its key are omitted from the result object.</dd> <dt><code>\"null\"</code></dt> <dd>The value is set to <code>null</code>.</dd> </dl> </dd> <dt><code>quote-char</code></dt> <dd> The single ASCII character that may be used to quote values; default: <code>\"</code> (U+0022). </dd> <dt><code>quote-escape</code></dt> <dd> The single ASCII character used to escape <code>quote-char</code>; default: same as <code>quote-char</code>. If <code>quote-escape</code> equals <code>quote-char</code>, it means that <code>quote-char</code> must be doubled to escape it. If <code>quote-escape</code> does not equal <code>quote-char</code>, it means that <code>quote-escape</code> is used to escape <code>quote-char</code>. For example, a <code>quote-char</code> of <code>\"</code> (U+0022) and a <code>quote-escape</code> of <code>\\\\</code> (U+005C) means that quotes will be escaped by <code>\\\\\"</code>. </dd> <dt><code>separator</code></dt> <dd> The single ASCII character used to separate values; default: <code>,</code> (U+002C). </dd> </dl></div>'}],returns:{type:\"object()*\",description:\"a sequence of zero or more JSON objects where each key is a field name and each value is a parsed value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:INVALID_OPTION if the <code>quote-char</code>, <code>quote-escape</code>, or <code>separator</code> option is given and it\\'s not a single ASCII character.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:MISSING_VALUE if a missing value is detected and the <code>missing-value</code> option is \"<code>error</code>\".</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">csv:EXTRA_VALUE if an extra value is detected and the <code>extra-name</code> option is not set.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"serialize\",qname:\"csv:serialize\",signature:\"($obj as object()*) as string*\",description:' Serializes a sequence of JSON objects as CSV (comma-separated values) using\\n the default options.\\n The default options are:\\n  <dl xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    <dt><code>field-names</code></dt>\\n      <dd>\\n        A JSON array of strings denoting field names;\\n        default: none.\\n        The field names are taken from the first JSON object\\n        and the order of the fields is implementation dependent.\\n      </dd>\\n    <dt><code>serialize-boolean-as</code></dt>\\n      <dd>\\n        What strings to serialize <code>true</code> and <code>false</code> as;\\n        default: <code>true</code> and <code>false</code>.\\n      </dd>\\n    <dt><code>serialize-header</code></dt>\\n      <dd>\\n        Whether a header line is included;\\n        default: <code>true</code>.\\n        The first string result is the header line\\n        comprised of all the objects\\' keys\\' names.\\n      </dd>\\n    <dt><code>serialize-null-as</code></dt>\\n      <dd>\\n        What string to serialize JSON <code>null</code> values as;\\n        default: <code>null</code>.\\n      </dd>\\n    <dt><code>quote-char</code></dt>\\n      <dd>\\n        The single ASCII character that may be used to quote values;\\n        default: <code>\"</code> (U+0022).\\n      </dd>\\n    <dt><code>quote-escape</code></dt>\\n      <dd>\\n        The single ASCII character used to escape <code>quote-char</code>;\\n        default: same as <code>quote-char</code>.\\n        This means that <code>quote-char</code> is doubled to escape it.\\n      </dd>\\n    <dt><code>separator</code></dt>\\n      <dd>\\n        The single ASCII character used to separate values;\\n        default: <code>,</code> (U+002C).\\n      </dd>\\n  </dl>\\n',summary:\"<p> Serializes a sequence of JSON objects as CSV (comma-separated values) using\\n the default options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of JSON objects to serialize.</div>'}],returns:{type:\"string*\",description:'a sequence of strings where each string corresponds to a JSON object, aka, \"record.\"'},errors:[]},{isDocumented:!0,arity:2,name:\"serialize\",qname:\"csv:serialize\",signature:\"($obj as object()*, $options as object()) as string* external\",description:\" Serializes a sequence of JSON objects as CSV (comma-separated values) using\\n the given options.\\n\",summary:\"<p> Serializes a sequence of JSON objects as CSV (comma-separated values) using\\n the given options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of JSON objects to serialize.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options to use: <dl> <dt><code>field-names</code></dt> <dd> A JSON array of strings denoting field names; default: none. If this option is not set, the field names are taken from the first JSON object and the order of the fields is implementation dependent. If this option is set, the fields are serielized in the order they are in the array. In either case, every JSON object must have the same keys as the first object. </dd> <dt><code>serialize-boolean-as</code></dt> <dd> What strings to serialize <code>true</code> and <code>false</code> as; default: <code>true</code> and <code>false</code>. This must be a sub-object with the two keys <code>\"true\"</code> and <code>\"false\"</code>, e.g.: <code>{ \"true\" : \"Y\", \"false\" : \"N\" }</code>. </dd> <dt><code>serialize-header</code></dt> <dd> Whether a header line is included; default: <code>true</code>. If <code>true</code>, the first string result is the header line comprised of all the objects\\' keys\\' names; if <code>false</code>, the heder line is not returned. </dd> <dt><code>serialize-null-as</code></dt> <dd> What string to serialize JSON <code>null</code> values as; default: <code>null</code>. </dd> <dt><code>quote-char</code></dt> <dd> The single ASCII character that may be used to quote values; default: <code>\"</code> (U+0022). </dd> <dt><code>quote-escape</code></dt> <dd> The single ASCII character used to escape <code>quote-char</code>; default: same as <code>quote-char</code>. If <code>quote-escape</code> equals <code>quote-char</code>, it means that <code>quote-char</code> must be doubled to escape it. If <code>quote-escape</code> does not equal <code>quote-char</code>, it means that <code>quote-escape</code> is used to escape <code>quote-char</code>. For example, a <code>quote-char</code> of <code>\"</code> (U+0022) and a <code>quote-escape</code> of <code>\\\\</code> (U+005C) means that quotes will be escaped by <code>\\\\\"</code>. </dd> <dt><code>separator</code></dt> <dd> The single ASCII character used to separate values; default: <code>,</code> (U+002C). </dd> </dl></div>'}],returns:{type:\"string*\",description:'a sequence of strings where each string corresponds to a JSON object, aka, \"record.\"'},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/email/imap\":{ns:\"http://www.zorba-xquery.com/modules/email/imap\",description:' This module provides functions for accessing and manipulating emails on mail\\n servers through the IMAP protocol.\\n All functions in this module receive as the first argument the IMAP host and user\\n information. This is an element with the type <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hostInfoType</code> as defined\\n in the email schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.\\n For example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n &lt;email:hostInfo&gt;\\n   &lt;email:hostName&gt;imap.example.com&lt;/email:hostName&gt;\\n   &lt;email:userName&gt;myuser&lt;/email:userName&gt;\\n   &lt;email:password&gt;mypassword&lt;/email:password&gt;\\n &lt;/email:hostInfo&gt;\\n </pre>\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hostInfoType</code> only needs to be in the email schema namespace\\n (<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>). It does not need\\n to be validated since it\\'s validated by the module.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.washington.edu/imap/\">c-client library part of UW IMAP toolkit</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Thomas, Gabriel Petrovay</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/email\",prefix:\"email\"},{uri:\"http://www.zorba-xquery.com/modules/email/imap\",prefix:\"imap\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:5,name:\"copy\",qname:\"imap:copy\",signature:\"($host-info as element(email:hostInfo), $mailbox-from as xs:string, $mailbox-to as xs:string, $messages as xs:long+, $uid as xs:boolean?) as empty-sequence()\",description:' Copies messages between mailboxes.\\n Depending on the value of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$uid</code>, the messages are either specified\\n through their sequence number or through their unique id. Both mailboxes must exist.\\n',summary:\"<p> Copies messages between mailboxes.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-from\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in which the messages reside.</div>'},{name:\"mailbox-to\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in to which the messages are copied.</div>'},{name:\"messages\",type:\"xs:long\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The messages to be copied, specified either by their sequence number or their unique id.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$messages</code> are treated as sequence numbers. Else as unique identifiers.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"create\",qname:\"imap:create\",signature:\"($host-info as element(email:hostInfo), $mailbox-name as xs:string) as empty-sequence()\",description:\" Creates a new mailbox for the given user.\\n\",summary:\"<p> Creates a new mailbox for the given user.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name for the new mailbox.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete\",qname:\"imap:delete\",signature:\"($host-info as element(email:hostInfo), $mailbox-name as xs:string) as empty-sequence()\",description:\" Deletes a mailbox for the given user.\\n\",summary:\"<p> Deletes a mailbox for the given user.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the mailbox to delete.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"expunge\",qname:\"imap:expunge\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string) as empty-sequence()\",description:' Permanently deletes all messages of the given mailbox that have the \"deleted\" flag set.\\n',summary:'<p> Permanently deletes all messages of the given mailbox that have the \"deleted\" flag set.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox for which all messages that have the \\\\Deleted flag set should be permanently deleted.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:4,name:\"fetch-envelope\",qname:\"imap:fetch-envelope\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long, $uid as xs:boolean?) as element(email:envelope)\",description:\" Fetches the envelope of a message.\\n\",summary:\"<p> Fetches the envelope of a message.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in which to search for the message.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The message for which to fetch the envelope (depending on <code>$uid</code> either as message sequence number or unique identifier).</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$message-number</code> is treated as sequence number. Else as unique identifier.</div>'}],returns:{type:\"element(email:envelope)\",description:'The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">envelope</code> of the requested message. The result is validated against the schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:4,name:\"fetch-flags\",qname:\"imap:fetch-flags\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long, $uid as xs:boolean?) as element(email:flags)\",description:\" Fetches the flags of a message.\\n\",summary:\"<p> Fetches the flags of a message.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox containing the specified message.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Either the message sequence number or the unique identifier of the message.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$message-number</code> is treated as sequence number. Else as unique identifier.</div>'}],returns:{type:\"element(email:flags)\",description:'The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">flags</code> of the specified message. The result is validated against the schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:3,name:\"fetch-from\",qname:\"imap:fetch-from\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long) as xs:string\",description:\" Fetches the 'from' string of a message.\\n Please note that this function only words with message sequence numbers,\\n not with unique identifiers. Only the first 255 characters of a 'from'\\n string are fetched.\\n\",summary:\"<p> Fetches the 'from' string of a message.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> The mailbox for which we want to get the 'from' string of a message.</div>\"},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> Denotes the message for which we want the 'from' string.</div>\"}],returns:{type:\"xs:string\",description:\"The 'from' string of the specified message.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:3,name:\"fetch-message-sequence-number\",qname:\"imap:fetch-message-sequence-number\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long) as xs:long\",description:\" Fetches the message sequence number for a given unique identifier.\\n\",summary:\"<p> Fetches the message sequence number for a given unique identifier.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox for which we want to get the message sequence number of an unique identifier.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The unique identifier for which we want the message sequence number.</div>'}],returns:{type:\"xs:long\",description:\"The message sequence number of the of the given unique identifier.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:4,name:\"fetch-message\",qname:\"imap:fetch-message\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long, $uid as xs:boolean) as element(email:message)\",description:\" Fetches a whole message.\\n\",summary:\"<p> Fetches a whole message.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in which to search for the message.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The message to fetch, denoted either by its sequence number or unique identifier.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$message-number</code> is treated as sequence number. Else as unique identifier.</div>'}],returns:{type:\"element(email:message)\",description:'the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">message</code> with the given <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$message-number</code>. The result is validated against the schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:3,name:\"fetch-subject\",qname:\"imap:fetch-subject\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long) as xs:string\",description:\" Fetches the subject for a message.\\n Please note that this function only works with message sequence numbers,\\n not with unique identifiers. Only the first 255 characters of a subject\\n are fetched.\\n\",summary:\"<p> Fetches the subject for a message.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox for which we want to get the subject of a message.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Denotes the message for which we want the subject.</div>'}],returns:{type:\"xs:string\",description:\"The subject of the specified message.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:3,name:\"fetch-uid\",qname:\"imap:fetch-uid\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long) as xs:long\",description:\" Fetches the unique identifier for a given message sequence number.\\n\",summary:\"<p> Fetches the unique identifier for a given message sequence number.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox for which we want to get the unique identifier of a message sequence number.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The message sequence number for which we want the unique identifier.</div>'}],returns:{type:\"xs:long\",description:\"The unique identifier of the given message sequence number.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:4,name:\"list\",qname:\"imap:list\",signature:\"($host-info as element(email:hostInfo), $mailbox-ref as xs:string, $pattern as xs:string, $only-subscribed as xs:boolean) as element(email:mailbox)*\",description:\" Lists IMAP folders for the specified user on the host that match the pattern.\\n\",summary:\"<p> Lists IMAP folders for the specified user on the host that match the pattern.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is applied to pattern in an implementation dependent fashion to search for matching mailbox names.</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> The pattern for mailboxes to look for (can include wildcards '*' and '%').</div>\"},{name:\"only-subscribed\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If set true, only mailboxes are listed to which the user is subscribed.</div>'}],returns:{type:\"element(email:mailbox)*\",description:'A sequence of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">mailbox</code> elements. The result elements are validated against the schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:5,name:\"move\",qname:\"imap:move\",signature:\"($host-info as element(email:hostInfo), $mailbox-from as xs:string, $mailbox-to as xs:string, $messages as xs:long+, $uid as xs:boolean?) as empty-sequence()\",description:' Moves messages between mailboxes.\\n Depending on the value of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$uid</code>, the messages are either specified through\\n their sequence number or through their unique id. Both mailboxes must exist.\\n',summary:\"<p> Moves messages between mailboxes.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-from\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in which the messages reside.</div>'},{name:\"mailbox-to\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox in to which the messages should be moved.</div>'},{name:\"messages\",type:\"xs:long\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The messages to be copied, specified either by their sequence number or their unique id.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$messages</code> are treated as sequence numbers. Else as unique identifiers.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:3,name:\"rename\",qname:\"imap:rename\",signature:\"($host-info as element(email:hostInfo), $mailbox-old as xs:string, $mailbox-new as xs:string) as empty-sequence()\",description:\" Renames a mailbox.\\n\",summary:\"<p> Renames a mailbox.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox-old\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the mailbox we want to rename.</div>'},{name:\"mailbox-new\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The new name for the mailbox.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:4,name:\"search\",qname:\"imap:search\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $criteria as xs:string, $uid as xs:boolean?) as xs:long*\",description:\" Searches a mailbox for messages that match the given criteria.\\n The criteria should be a string as defined in the RFC3501 (IMAP4rev1).\\n A valid example would be: 'FROM zorba@gmail.com OR NOT SUBJECT Bug'.\\n Depending on the value of <code xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">$uid</code>, the function will either\\n return matching sequence numbers or unique identifiers.\\n\",summary:\"<p> Searches a mailbox for messages that match the given criteria.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox to search.</div>'},{name:\"criteria\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The searching criteria.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, the function returns the sequence of unique identifiers corresponding to the matching mails, else the corresponding sequence numbers are returned.</div>'}],returns:{type:\"xs:long*\",description:\"Either the sequence of matching sequence numbers or the sequence of matching unique identifiers.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:5,name:\"set-flags\",qname:\"imap:set-flags\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string, $message-number as xs:long, $flags as element(email:flags), $uid as xs:boolean?) as empty-sequence()\",description:' Sets the flags for a given message.\\n The flags are set and unset according to the passed <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$flags</code>.\\n',summary:\"<p> Sets the flags for a given message.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox containing the specified message.</div>'},{name:\"message-number\",type:\"xs:long\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Either the message sequence number or the unique identifier of the message (depending on the value of <code>$uid</code>).</div>'},{name:\"flags\",type:\"element(email:flags)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Defines which flags should be set for this message. The possibilities are \"seen\", \"deleted\", \"flagged\", \"answered\", and \"draft\". Setting all flags at once is done by passing the element: <code> &lt;email:flags&gt; &lt;email:seen/&gt; &lt;email:deleted/&gt; &lt;email:flagged/&gt; &lt;email:answered/&gt; &lt;email:draft/&gt; &lt;/email:flags&gt; </code>. Setting \"flagged\" only and unsetting all other at once can be done by passing: <code> &lt;email:flags&gt; &lt;email:flagged/&gt; &lt;/email:flags&gt; </code>.</div>'},{name:\"uid\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If true, <code>$message-number</code> is treated as sequence number. Else as unique identifier.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0003 If no message is found with the provided sequence number/unique identifier.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"status\",qname:\"imap:status\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string) as element(email:status)\",description:' Returns the status of the given mailbox.\\n The status of a mailbox contains:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li><code>messages</code>: the number of messages in the mailbox</li>\\n  <li><code>recent</code>: the number of messages flagged as recent</li>\\n  <li><code>unseen</code>: the number of messages flagged as unseen</li>\\n  <li><code>uidnext</code>: the next unique identifier that will be assigned to a message</li>\\n  <li><code>uidvalidity</code>: a value that, together with the <code>uidnext</code> value\\n    forms a 64 bit number that must be unique for the server</li>\\n </ul>\\n',summary:\"<p> Returns the status of the given mailbox.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox for which we want to have the status.</div>'}],returns:{type:\"element(email:status)\",description:'The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">status</code> of the specified <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$mailbox</code>. The result is validated against the schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"subscribe\",qname:\"imap:subscribe\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string) as empty-sequence()\",description:\" Subscribes the user to the specified mailbox.\\n\",summary:\"<p> Subscribes the user to the specified mailbox.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox the user wants to subscribe to.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']},{isDocumented:!0,arity:2,name:\"unsubscribe\",qname:\"imap:unsubscribe\",signature:\"($host-info as element(email:hostInfo), $mailbox as xs:string) as empty-sequence()\",description:\" Unsubscribes the user from the specified mailbox.\\n\",summary:\"<p> Unsubscribes the user from the specified mailbox.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The IMAP host, user name, and password.</div>'},{name:\"mailbox\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mailbox the user wants to unsubscribe from.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0001 If the IMAP operation failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">imap:IMAP0002 If the connection to the IMAP server is refused.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the value of <code>$host-info</code> is not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']}],variables:[]},\"http://zorba.io/errors\":{ns:\"http://zorba.io/errors\",description:\" This module contains one variable declaration for each diagnostic of the\\n http://zorba.io/errors namespace.\\n The variables serves as documentation for the errors but can also\\n be used in the code. For example, one useful scenario is to compare\\n an error caught in the catch clause of a try-catch expression with one of\\n the variables.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Carlos Lopez</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[],variables:[{name:\"zerr:ZDST0032\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0021\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0022\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0023\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0024\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0025\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0026\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0027\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0028\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0029\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0030\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0031\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0033\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0034\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0035\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0036\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0041\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0044\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0048\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0060\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDTY0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDTY0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDTY0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDTY0012\",type:\"item()*\",description:\"\"},{name:\"zerr:ZGDB0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0038\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0024\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0025\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0026\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0027\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0028\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0029\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0030\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0031\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0032\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0033\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0034\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0035\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0036\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0037\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0039\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0040\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0041\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0042\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0043\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1000\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY1006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDST0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0005\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0001\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0002\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0003\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0004\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0005\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0006\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0007\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0008\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0009\",type:\"item()*\",description:\"\"},{name:\"zerr:XSST0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0066\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJPE0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJSE0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZJ2X0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0012\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZOSE0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0023\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0013\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0015\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0016\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0020\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0021\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0030\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0040\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0041\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0045\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0050\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0055\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0060\",type:\"item()*\",description:\"\"},{name:\"zerr:ZSTR0065\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQD0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0036\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0037\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0038\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0039\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0040\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0050\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0060\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0061\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP8401\",type:\"xs:QName\",description:\" The version of the thesaurus is not the expected version.\\n\"},{name:\"zerr:ZXQP8402\",type:\"xs:QName\",description:\" The thesaurus data file's endianness does not match that of the CPU.\\n\"},{name:\"zerr:ZXQP8403\",type:\"xs:QName\",description:\" The thesaurus data contains an unexpected value.\\n\"},{name:\"zerr:ZXQD0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQD0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQD0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0035\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQD0005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQD0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0014\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0015\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0019\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0014\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0000\",type:\"xs:QName\",description:' An \"error\" constant for \"no error.\"\\n'},{name:\"zerr:ZXQP0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0002\",type:\"xs:QName\",description:\" A Zorba programming assertion failed.  If this error occurs, it is a bug\\n and should be reported.\\n\"},{name:\"zerr:ZXQP0003\",type:\"xs:QName\",description:\" Something unexpected occurred in Zorba.  If this error occurs, it is a\\n bug and should be reported.\\n\"},{name:\"zerr:ZXQP0004\",type:\"xs:QName\",description:\" A particular XQuery feature has not been implemented by Zorba.\\n\"},{name:\"zerr:ZXQP0005\",type:\"xs:QName\",description:\" A particular XQuery feature has been implemented by Zorba, but the\\n feature has not been enabled in the current build.\\n\"},{name:\"zerr:ZXQP0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0012\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0013\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0020\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0016\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0017\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0020\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0021\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0024\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0025\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0026\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0028\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0029\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0030\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0031\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0032\",type:\"item()*\",description:\"\"},{name:\"zerr:ZXQP0033\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0012\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0013\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0014\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0015\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0016\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0017\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0010\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0011\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0012\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0013\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0014\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0015\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0016\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0017\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0018\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0020\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0019\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0021\",type:\"item()*\",description:\"\"},{name:\"zerr:ZDDY0022\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0045\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0021\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0023\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0024\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0025\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0026\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0027\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0028\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0029\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0030\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0039\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0040\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0041\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0042\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0043\",type:\"item()*\",description:\"\"},{name:\"zerr:NS\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0070\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0080\",type:\"item()*\",description:\"\"},{name:\"zerr:ZAPI0090\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0001\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0002\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0003\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0004\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0005\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0006\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0007\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0008\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0009\",type:\"item()*\",description:\"\"},{name:\"zerr:ZCSE0010\",type:\"item()*\",description:\"\"}]},\"http://zorba.io/modules/sequence\":{ns:\"http://zorba.io/modules/sequence\",description:\" This module provides an XQuery API to perform set operations on sequences.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/sequence\",prefix:\"seq\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"value-except\",qname:\"seq:value-except\",signature:\"($seq1 as xs:anyAtomicType*, $seq2 as xs:anyAtomicType*) as xs:anyAtomicType* external\",description:\" Filters the first sequence of atomic items such that they are not in the\\n second sequence based on their values.\\n\",summary:\"<p> Filters the first sequence of atomic items such that they are not in the\\n second sequence based on their values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first sequence.</div>'},{name:\"seq2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second sequence.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:'a sequence only containing items from <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$seq1</code> that are not in <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$seq2</code>.'},errors:[]},{isDocumented:!0,arity:2,name:\"value-intersect\",qname:\"seq:value-intersect\",signature:\"($seq1 as xs:anyAtomicType*, $seq2 as xs:anyAtomicType*) as xs:anyAtomicType* external\",description:\" Performs a set intersection of two sequences of atomic items based on their\\n values.\\n\",summary:\"<p> Performs a set intersection of two sequences of atomic items based on their\\n values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first sequence.</div>'},{name:\"seq2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second sequence.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:'a sequence containing only items from <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$seq1</code> that are also in <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$seq2</code>.'},errors:[]},{isDocumented:!0,arity:2,name:\"value-union\",qname:\"seq:value-union\",signature:\"($seq1 as xs:anyAtomicType*, $seq2 as xs:anyAtomicType*) as xs:anyAtomicType* external\",description:\" Performs a set union of two sequences of atomic items based on their values.\\n\",summary:\"<p> Performs a set union of two sequences of atomic items based on their values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first sequence.</div>'},{name:\"seq2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second sequence.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:'a sequence containing all items from <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$seq1</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">seq2$</code> but without duplicates.'},errors:[]}],variables:[]},\"http://api.28.io/functions\":{ns:\"http://api.28.io/functions\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/functions\",prefix:\"functions\"},{uri:\"http://api.28.io/model\",prefix:\"model\"},{uri:\"http://www.zorba-xquery.com/schemas/pul\",prefix:\"pul\"},{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"response\"},{uri:\"http://api.28.io/sandbox\",prefix:\"sandbox\"},{uri:\"http://www.zorba-xquery.com/schemas/xdm\",prefix:\"xdm\"}],functions:[{isDocumented:!1,arity:1,name:\"apply-pul\",qname:\"functions:apply-pul\",signature:\"($pul)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"pul\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"collections\",qname:\"functions:collections\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"decodeURI\",qname:\"functions:decodeURI\",signature:\"($str as xs:string) as xs:anyURI\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"str\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:anyURI\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"encode-for-js\",qname:\"functions:encode-for-js\",signature:\"($str as xs:string) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"str\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:5,name:\"entries\",qname:\"functions:entries\",signature:\"($collection as xs:string?, $node as xs:anyURI?, $index as xs:string?, $value as xs:string?, $format as xs:string)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"node\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"},{name:\"index\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"value\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"format\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"indexes\",qname:\"functions:indexes\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"key\",qname:\"functions:key\",signature:\"($collection as xs:string, $condition as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"condition\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"namesearch\",qname:\"functions:namesearch\",signature:\"($collection as xs:string, $path as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"node-to-js\",qname:\"functions:node-to-js\",signature:\"($node) as xs:string*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"parse-namespaces\",qname:\"functions:parse-namespaces\",signature:\"($namespaces as xs:string)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"namespaces\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"pksearch\",qname:\"functions:pksearch\",signature:\"($collection as xs:string)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"startpage\",qname:\"functions:startpage\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"strip-whitespaces\",qname:\"functions:strip-whitespaces\",signature:\"($xml)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"tuple\",qname:\"functions:tuple\",signature:\"($collection as xs:string, $condition as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"condition\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"valuesearch\",qname:\"functions:valuesearch\",signature:\"($collection as xs:string, $path as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"xmltojs\",qname:\"functions:xmltojs\",signature:\"($content)\",description:\" Internal function. Converts the XML contents of a POST BODY to JavaScript calls that rebuild the given XML for the collection browser frontend\\n\",summary:\"<p> Internal function.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"content\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"JavaScript calls for collection browser frontend\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/profiles/sec/companies\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/companies\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying companies (XBRL entities)\\n  submitting to the SEC.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Companies are nothing else than XBRL entities. For XBRL-generic requests on\\n entities, use the generic entities module.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve a company with its CIK (without converting\\n it to an EID). You can also retrieve companies by sector, by SIC code, by types,\\n by tags, by tickers.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/companies\",prefix:\"companies\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/core\",prefix:\"sec\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"companies-by-types\",qname:\"companies:companies-by-types\",signature:\"($company-types as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all companies whose company type matches the passed string(s).</p>\\n',summary:\"<p>  Retrieves all companies whose company type matches the passed string(s).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"company-types\",type:\"string\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"all companies with matching company type.\"},errors:[]},{isDocumented:!0,arity:1,name:\"companies-for-SIC\",qname:\"companies:companies-for-SIC\",signature:\"($sic-codes as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all companies whose type of business\\n matches the SIC (Standard Industrial Classification) code.</p>\\n',summary:\"<p>  Retrieves all companies whose type of business\\n matches the SIC (Standard Industrial Classification) code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sic-codes\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of SIC codes.</div>'}],returns:{type:\"object()*\",description:\"all companies with one of these SIC codes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"companies-for-sector\",qname:\"companies:companies-for-sector\",signature:\"($sectors as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all companies in the given sectors.</p>\\n',summary:\"<p>  Retrieves all companies in the given sectors.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sectors\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of sectors as strings.</div>'}],returns:{type:\"object()*\",description:\"all companies in these sectors.\"},errors:[]},{isDocumented:!0,arity:1,name:\"companies-for-tags\",qname:\"companies:companies-for-tags\",signature:\"($tags as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all companies with any of the given tags.</p>\\n',summary:\"<p>  Return all companies with any of the given tags.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"tags\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the tags to filter.</div>'}],returns:{type:\"object()*\",description:\"all companies with the given tags.\"},errors:[]},{isDocumented:!0,arity:1,name:\"companies-for-tickers\",qname:\"companies:companies-for-tickers\",signature:\"($tickers as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all companies with any of the given ticker symbols.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Tickers are case insensitive</p>\\n',summary:\"<p>  Return all companies with any of the given ticker symbols.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"tickers\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the tickers to filter.</div>'}],returns:{type:\"object()*\",description:\"all companies with the given tickers.\"},errors:[]},{isDocumented:!0,arity:0,name:\"companies\",qname:\"companies:companies\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all companies</p>\\n',summary:\"<p>  Return all companies \\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all companies.\"},errors:[]},{isDocumented:!0,arity:1,name:\"companies\",qname:\"companies:companies\",signature:\"($companies-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the companies with the given identifiers.</p>\\n',summary:\"<p>  Return the companies with the given identifiers.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"companies-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the ids of the companies or the companies themselves.</div>'}],returns:{type:\"object()*\",description:\"the companies with the given identifiers the empty sequence if no company was found or if the input is an empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"company-type\",qname:\"companies:company-type\",signature:\"($company-name as string) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return company type for a given company name. Company type can be one of:</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n     <li>Corporation</li>\\n     <li>Partnership</li>\\n     <li>unknown</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  Return company type for a given company name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"company-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of a company</div>'}],returns:{type:\"string\",description:'the company type string or \"unknown\" if the type can not be inferred'},errors:[]},{isDocumented:!0,arity:1,name:\"eid\",qname:\"companies:eid\",signature:\"($companies-or-eids-or-ciks as item()*) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized CIK. The input\\n can be either a pure CIK without scheme, or an already\\n normalized CIK, or an entity object which contains a CIK\\n in its id field.</p>\\n',summary:\"<p>  Converts the input to a normalized CIK.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"companies-or-eids-or-ciks\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"string*\",description:\"the normalized CIK.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sec:INVALID_PARAMETER if the CIK or entity is not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"types\",qname:\"companies:types\",signature:\"($companies-or-ciks as item()*) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the type of a company.</p>\\n',summary:\"<p>  Retrieves the type of a company.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"companies-or-ciks\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of companies or their identifiers (CIKs).</div>'}],returns:{type:\"string*\",description:\"all company types.\"},errors:[]}],variables:[]},\"http://api.28.io/collections\":{ns:\"http://api.28.io/collections\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/collections\",prefix:\"cm\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://api.28.io/util\",prefix:\"util\"},{uri:\"http://api.28.io/validation\",prefix:\"validate\"}],functions:[{isDocumented:!1,arity:1,name:\"definition-for-dynamic-collection\",qname:\"cm:definition-for-dynamic-collection\",signature:\"($name as xs:string) as object()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"delete-collection-property\",qname:\"cm:delete-collection-property\",signature:\"($name as xs:string, $property as xs:string) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"property\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"delete-collection\",qname:\"cm:delete-collection\",signature:\"($name) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:null,occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"dispatch\",qname:\"cm:dispatch\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"get-collection-property\",qname:\"cm:get-collection-property\",signature:\"($name as xs:string, $property as xs:string)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"property\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-collection\",qname:\"cm:get-collection\",signature:\"($name as xs:string) as object()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-or-create-collection-dynamic\",qname:\"cm:get-or-create-collection-dynamic\",signature:\"($name as xs:string) as object()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"list-collections\",qname:\"cm:list-collections\",signature:\"() as array()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"array()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"metadata\",qname:\"cm:metadata\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"put-collection-property\",qname:\"cm:put-collection-property\",signature:\"($name as xs:string, $property as xs:string, $value) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"property\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"value\",type:null,occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"put-collection\",qname:\"cm:put-collection\",signature:\"($name as xs:string, $collection as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"collection\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"validate-collection\",qname:\"cm:validate-collection\",signature:\"($collection as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/excel/math-sumproduct\":{ns:\"http://zorba.io/modules/excel/math-sumproduct\",description:\" Module implementing the sumproduct functions from Excel 2003 math library.\\n There are 30 functions defined, implementing the same function\\n but with 1 to 30 parameters.\\n Each parameter can be a sequence of infinite length.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/HP052092931033.aspx\" target=\"_blank\">Excel 2003 Documentation: Math-sumproduct Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/math-sumproduct\",prefix:\"excel\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Sums the values in the sequence.\\n The sequence can be of any length.\\n\",summary:\"<p> Sums the values in the sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:10,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:11,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:12,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:13,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:14,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:15,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:16,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:17,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:18,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:19,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:20,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:21,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:22,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:23,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:24,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:25,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:26,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*, $array26 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:27,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*, $array26 as xs:anyAtomicType*, $array27 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array27\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:28,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*, $array26 as xs:anyAtomicType*, $array27 as xs:anyAtomicType*, $array28 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array27\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array28\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:29,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*, $array26 as xs:anyAtomicType*, $array27 as xs:anyAtomicType*, $array28 as xs:anyAtomicType*, $array29 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array27\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array28\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array29\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:30,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*, $array10 as xs:anyAtomicType*, $array11 as xs:anyAtomicType*, $array12 as xs:anyAtomicType*, $array13 as xs:anyAtomicType*, $array14 as xs:anyAtomicType*, $array15 as xs:anyAtomicType*, $array16 as xs:anyAtomicType*, $array17 as xs:anyAtomicType*, $array18 as xs:anyAtomicType*, $array19 as xs:anyAtomicType*, $array20 as xs:anyAtomicType*, $array21 as xs:anyAtomicType*, $array22 as xs:anyAtomicType*, $array23 as xs:anyAtomicType*, $array24 as xs:anyAtomicType*, $array25 as xs:anyAtomicType*, $array26 as xs:anyAtomicType*, $array27 as xs:anyAtomicType*, $array28 as xs:anyAtomicType*, $array29 as xs:anyAtomicType*, $array30 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array10\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array11\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array12\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array13\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array14\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array15\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array16\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array17\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array18\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array19\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array20\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array21\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array22\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array23\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array24\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array25\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array26\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array27\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array28\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array29\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array30\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:7,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:8,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:9,name:\"sumproduct\",qname:\"excel:sumproduct\",signature:\"($array1 as xs:anyAtomicType*, $array2 as xs:anyAtomicType*, $array3 as xs:anyAtomicType*, $array4 as xs:anyAtomicType*, $array5 as xs:anyAtomicType*, $array6 as xs:anyAtomicType*, $array7 as xs:anyAtomicType*, $array8 as xs:anyAtomicType*, $array9 as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Multiplies the elements on the same position in each sequence\\n and sums up the results.\\n\",summary:\"<p> Multiplies the elements on the same position in each sequence\\n and sums up the results.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"array1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array3\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array4\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array5\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array6\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array7\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array8\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'},{name:\"array9\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequences of numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of products\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"sumsq\",qname:\"excel:sumsq\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Returns the sum of the squares of the arguments.\\n It used the sumproduct function.\\n\",summary:\"<p> Returns the sum of the squares of the arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of one or more numbers or arguments castable to numeric</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the sum of squared values, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/item\":{ns:\"http://zorba.io/modules/item\",description:\" This module provides utility functions on items. For example,\\n it provides a function that allows estimating the size in bytes\\n that a given item allocates in memory.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/item\",prefix:\"item\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"size\",qname:\"item:size\",signature:\"($item as item()) as xs:integer external\",description:' Computes the size in bytes of the given item in main memory.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Computes the size in bytes of the given item in main memory.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the item whose size to compute.</div>'}],returns:{type:\"xs:integer\",description:\"the size allocated by the item in bytes.\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/xqdoc/menu\":{ns:\"http://www.zorba-xquery.com/modules/xqdoc/menu\",description:\" Generate navigation for XQDoc batches.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/xqdoc/menu\",prefix:\"menu\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!1,arity:2,name:\"categories-as-js\",qname:\"menu:categories-as-js\",signature:\"($url-prefix as xs:string, $cats as element(*)) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"url-prefix\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cats\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"categories\",qname:\"menu:categories\",signature:\"($top as element(*)) as xs:string*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"top\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"closed-tabs\",qname:\"menu:closed-tabs\",signature:\"($item as element(section), $url-prefix as xs:string) as element(li)*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"element(section)\",occurrence:null,description:\"\"},{name:\"url-prefix\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"element(li)*\",description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"closed-tabs\",qname:\"menu:closed-tabs\",signature:\"($item as element(*)?, $result as element(*)*, $url-prefix as xs:string) as element(li)*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"element(*)\",occurrence:\"?\",description:\"\"},{name:\"result\",type:\"element(*)\",occurrence:\"*\",description:\"\"},{name:\"url-prefix\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"element(li)*\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"item-uri\",qname:\"menu:item-uri\",signature:\"($item as element(*)) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"item-uri\",qname:\"menu:item-uri\",signature:\"($item as element(*)?, $result as xs:string*) as xs:string+\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"element(*)\",occurrence:\"?\",description:\"\"},{name:\"result\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string+\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"item\",qname:\"menu:item\",signature:\"($ctx as element(*)?, $path as xs:string*) as element(*)?\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ctx\",type:\"element(*)\",occurrence:\"?\",description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"element(*)?\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"menu\",qname:\"menu:menu\",signature:\"($item as element(*), $url-prefix as xs:string)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"element(*)\",occurrence:null,description:\"\"},{name:\"url-prefix\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[{name:\"menu:not-found\",type:\"item()*\",description:\"\"}]},\"http://zorba.io/modules/dbgp-message-handler\":{ns:\"http://zorba.io/modules/dbgp-message-handler\",description:\" Zorba debugger module.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gabriel Petrovay</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/modules/dbgp-message-handler\",prefix:\"dmh\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"process\",qname:\"dmh:process\",signature:\"($message as element(*)) as xs:anyAtomicType*\",description:\" Process one message received from the Zorba debugger server.\\n\",summary:\"<p> Process one message received from the Zorba debugger server.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"().\"},errors:[]}],variables:[{name:\"dmh:debug\",type:\"xs:boolean\",description:\" Set this variale to true if you want to have mode debug information when\\n an error occurs.\\n\"}]},\"http://www.28msec.com/modules/ws/mailchimp\":{ns:\"http://www.28msec.com/modules/ws/mailchimp\",description:\" Mailchimp Client Module.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://apidocs.mailchimp.com\" target=\"_blank\">http://apidocs.mailchimp.com</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon {william.candillon@28msec.com}</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-client\"},{uri:\"http://www.28msec.com/modules/ws/mailchimp\",prefix:\"mailchimp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.28msec.com/modules/xmlrpc\",prefix:\"xmlrpc\"}],functions:[{isDocumented:!0,arity:3,name:\"apikey-add\",qname:\"mailchimp:apikey-add\",signature:\"($username as xs:string, $password as xs:string, $apikey as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#apikey-add-4\">apikey-add#4</a>.\\n',summary:\"<p> Convenience function for  apikey-add#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"username\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key</div>'}],returns:{type:\"item()*\",description:\"A new API Key that can be immediately used.\"},errors:[]},{isDocumented:!0,arity:4,name:\"apikey-add\",qname:\"mailchimp:apikey-add\",signature:\"($endpoint-url as xs:string, $username as xs:string, $password as xs:string, $apikey as xs:string) as item()*\",description:\" Add an API Key to your account. We will generate a new key for you and return it.\\n\",summary:\"<p> Add an API Key to your account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"username\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp user name</div>'},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key</div>'}],returns:{type:\"item()*\",description:\"A new API Key that can be immediately used.\"},errors:[]},{isDocumented:!0,arity:3,name:\"apikey-expire\",qname:\"mailchimp:apikey-expire\",signature:\"($username as xs:string, $password as xs:string, $apikey as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#apikey-expire-4\">apikey-expire#4</a>.\\n',summary:\"<p> Convenience function for  apikey-expire#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"username\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key that you wish to expire</div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"apikey-expire\",qname:\"mailchimp:apikey-expire\",signature:\"($endpoint-url as xs:string, $username as xs:string, $password as xs:string, $apikey as xs:string) as item()*\",description:' Expire a Specific API Key. Note that if you expire all of your keys, just visit <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a> to create a new one. If you are trying to shut off access to your account for an old developer, change your MailChimp password, then expire all of the keys they had access to. Note that this takes effect immediately, so make sure you replace the keys in any working application before expiring them! Consider yourself warned...\\n',summary:\"<p> Expire a Specific API Key.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"username\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp user name</div>'},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key that you wish to expire</div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"apikeys\",qname:\"mailchimp:apikeys\",signature:\"($username as xs:string, $password as xs:string, $apikey as xs:string, $expired as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#apikeys-5\">apikeys#5</a>.\\n',summary:\"<p> Convenience function for  apikeys#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"username\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key for your account</div>'},{name:\"expired\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - whether or not to include expired keys, defaults to false</div>'}],returns:{type:\"item()*\",description:\"An array of API keys.\"},errors:[]},{isDocumented:!0,arity:5,name:\"apikeys\",qname:\"mailchimp:apikeys\",signature:\"($endpoint-url as xs:string, $username as xs:string, $password as xs:string, $apikey as xs:string, $expired as xs:boolean) as item()*\",description:\" Retrieve a list of all MailChimp API Keys for this User.\\n\",summary:\"<p> Retrieve a list of all MailChimp API Keys for this User.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"username\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp user name</div>'},{name:\"password\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your MailChimp password</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Any valid API Key for your account</div>'},{name:\"expired\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - whether or not to include expired keys, defaults to false</div>'}],returns:{type:\"item()*\",description:\"An array of API keys.\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-abuse-reports\",qname:\"mailchimp:campaign-abuse-reports\",signature:\"($apikey as xs:string, $cid as xs:string, $since as xs:integer, $start as xs:integer, $limit as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-abuse-reports-6\">campaign-abuse-reports#6</a>.\\n',summary:\"<p> Convenience function for  campaign-abuse-reports#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull abuse reports for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"since\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000</div>'},{name:\"limit\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"Reports the abuse reports for this campaign\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-abuse-reports\",qname:\"mailchimp:campaign-abuse-reports\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $since as xs:integer, $start as xs:integer, $limit as xs:string) as item()*\",description:\" Get all email addresses that complained about a given campaign.\\n\",summary:\"<p> Get all email addresses that complained about a given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull abuse reports for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"since\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000</div>'},{name:\"limit\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"Reports the abuse reports for this campaign\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-advice\",qname:\"mailchimp:campaign-advice\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-advice-3\">campaign-advice#3</a>.\\n',summary:\"<p> Convenience function for  campaign-advice#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull advice text for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Advice on the campaign's performance\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-advice\",qname:\"mailchimp:campaign-advice\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best suited for display in customized reports pages.\\n Note: some messages will contain HTML - clean tags as necessary.\\n\",summary:\"<p> Retrieve the text presented in our app for how a campaign performed and any advice we may have for you - best suited for display in customized reports pages.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull advice text for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Advice on the campaign's performance\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-analytics\",qname:\"mailchimp:campaign-analytics\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-analytics-3\">campaign-analytics#3</a>.\\n',summary:\"<p> Convenience function for  campaign-analytics#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Analytics we've collected for the passed campaign.\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-analytics\",qname:\"mailchimp:campaign-analytics\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Retrieve the Google Analytics data we've collected for this campaign. Note, requires Google Analytics Add-on to be installed and configured.\\n\",summary:\"<p> Retrieve the Google Analytics data we've collected for this campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Analytics we've collected for the passed campaign.\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-bounce-message\",qname:\"mailchimp:campaign-bounce-message\",signature:\"($apikey as xs:string, $cid as xs:string, $email as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-bounce-message-4\">campaign-bounce-message#4</a>.\\n',summary:\"<p> Convenience function for  campaign-bounce-message#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"email\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address or unique id of the member to pull a bounce message for.</div>'}],returns:{type:\"item()*\",description:\"The full bounce message for this email+campaign along with some extra data.\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-bounce-message\",qname:\"mailchimp:campaign-bounce-message\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $email as xs:string) as item()*\",description:\" Retrieve the most recent full bounce message for a specific email address on the given campaign. Messages over 30 days old are subject to being removed.\\n\",summary:\"<p> Retrieve the most recent full bounce message for a specific email address on the given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"email\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address or unique id of the member to pull a bounce message for.</div>'}],returns:{type:\"item()*\",description:\"The full bounce message for this email+campaign along with some extra data.\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-bounce-messages\",qname:\"mailchimp:campaign-bounce-messages\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-bounce-messages-6\">campaign-bounce-messages#6</a>.\\n',summary:\"<p> Convenience function for  campaign-bounce-messages#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 25, upper limit set at 50</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD format in <strong>GMT</strong> (we only store the date, not the time)</div>'}],returns:{type:\"item()*\",description:\"Bounces the full bounce messages for this campaign\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-bounce-messages\",qname:\"mailchimp:campaign-bounce-messages\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:\" Retrieve the full bounce messages for the given campaign. Note that this can return very large amounts of data depending on how large the campaign was and how much cruft the bounce provider returned.\\n\",summary:\"<p> Retrieve the full bounce messages for the given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 25, upper limit set at 50</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD format in <strong>GMT</strong> (we only store the date, not the time)</div>'}],returns:{type:\"item()*\",description:\"Bounces the full bounce messages for this campaign\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-click-detail-AIM\",qname:\"mailchimp:campaign-click-detail-AIM\",signature:\"($apikey as xs:string, $cid as xs:string, $url as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-click-detail-AIM-6\">campaign-click-detail-AIM#6</a>.\\n',summary:\"<p> Convenience function for  campaign-click-detail-AIM#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get click stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL of the link that was clicked on</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-click-detail-AIM\",qname:\"mailchimp:campaign-click-detail-AIM\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $url as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Return the list of email addresses that clicked on a given url, and how many times they clicked.\\n\",summary:\"<p> Return the list of email addresses that clicked on a given url, and how many times they clicked.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get click stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL of the link that was clicked on</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-click-stats\",qname:\"mailchimp:campaign-click-stats\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-click-stats-3\">campaign-click-stats#3</a>.\\n',summary:\"<p> Convenience function for  campaign-click-stats#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"URLs will be keys and contain their associated statistics: clicks (number of times a specific link was clicked) and unique (number of unique people who clicked on the specific link).\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-click-stats\",qname:\"mailchimp:campaign-click-stats\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Get an array of the urls being tracked, and their click counts for a given campaign.\\n\",summary:\"<p> Get an array of the urls being tracked, and their click counts for a given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"URLs will be keys and contain their associated statistics: clicks (number of times a specific link was clicked) and unique (number of unique people who clicked on the specific link).\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-content\",qname:\"mailchimp:campaign-content\",signature:\"($apikey as xs:string, $cid as xs:string, $for_archive as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-content-4\">campaign-content#4</a>.\\n',summary:\"<p> Convenience function for  campaign-content#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get content for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"for_archive\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional controls whether we return the Archive version (true) or the Raw version (false), defaults to true</div>'}],returns:{type:\"item()*\",description:\"Struct containing all content for the campaign\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-content\",qname:\"mailchimp:campaign-content\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $for_archive as xs:boolean) as item()*\",description:\" Get the content (both html and text) for a campaign either as it would appear in the campaign archive or as the raw, original content.\\n\",summary:\"<p> Get the content (both html and text) for a campaign either as it would appear in the campaign archive or as the raw, original content.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get content for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"for_archive\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional controls whether we return the Archive version (true) or the Raw version (false), defaults to true</div>'}],returns:{type:\"item()*\",description:\"Struct containing all content for the campaign\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-create\",qname:\"mailchimp:campaign-create\",signature:\"($apikey as xs:string, $type as xs:string, $options as element(array), $content as element(array), $segment_opts as element(array), $type_opts as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-create-7\">campaign-create#7</a>.\\n',summary:\"<p> Convenience function for  campaign-create#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Type to create - one of \"regular\", \"plaintext\", \"absplit\", \"rss\", \"trans\", \"auto\"</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of the standard options for this campaign. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigncreate.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"content\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content for this campaign - use a struct with the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigncreate.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"segment_opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - if you wish to do Segmentation with this campaign this array should contain: see <a href=\"#campaign-segment-test-3\">campaign-segment-test()</a>. It\\'s suggested that you test your options against <a href=\"#campaign-segment-test-3\">campaign-segment-test()</a>. Also, \"trans\" campaigns <strong>do not</strong> support segmentation.</div>'},{name:\"type_opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional -</div>'}],returns:{type:\"item()*\",description:\"The ID for the created campaign\"},errors:[]},{isDocumented:!0,arity:7,name:\"campaign-create\",qname:\"mailchimp:campaign-create\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $type as xs:string, $options as element(array), $content as element(array), $segment_opts as element(array), $type_opts as element(array)) as item()*\",description:\" Create a new draft campaign to send. You can not have more than 32,000 campaigns in your account.\\n\",summary:\"<p> Create a new draft campaign to send.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Type to create - one of \"regular\", \"plaintext\", \"absplit\", \"rss\", \"trans\", \"auto\"</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of the standard options for this campaign. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigncreate.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"content\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content for this campaign - use a struct with the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigncreate.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"segment_opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - if you wish to do Segmentation with this campaign this array should contain: see <a href=\"#campaign-segment-test-3\"><a href=\"#campaign-segment-test-3\">campaign-segment-test()</a></a>. It\\'s suggested that you test your options against <a href=\"#campaign-segment-test-3\">campaign-segment-test()</a>. Also, \"trans\" campaigns <strong>do not</strong> support segmentation.</div>'},{name:\"type_opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional</div>'}],returns:{type:\"item()*\",description:\"The ID for the created campaign\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-delete\",qname:\"mailchimp:campaign-delete\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-delete-3\">campaign-delete#3</a>.\\n',summary:\"<p> Convenience function for  campaign-delete#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to delete</div>'}],returns:{type:\"item()*\",description:\"True if the delete succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-delete\",qname:\"mailchimp:campaign-delete\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:' Delete a campaign. Seriously, \"poof, gone!\" - be careful!.\\n',summary:\"<p> Delete a campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to delete</div>'}],returns:{type:\"item()*\",description:\"True if the delete succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-ecomm-order-add\",qname:\"mailchimp:campaign-ecomm-order-add\",signature:\"($apikey as xs:string, $order as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-ecomm-order-add-3\">campaign-ecomm-order-add#3</a>.\\n',summary:\"<p> Convenience function for  campaign-ecomm-order-add#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"order\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of information pertaining to the order that has completed. Use the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaignecommorderadd.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"True if the data is saved, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-ecomm-order-add\",qname:\"mailchimp:campaign-ecomm-order-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $order as element(array)) as item()*\",description:\" Attach Ecommerce Order Information to a Campaign.\\n\",summary:\"<p> Attach Ecommerce Order Information to a Campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"order\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of information pertaining to the order that has completed. Use the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaignecommorderadd.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"True if the data is saved, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-ecomm-orders\",qname:\"mailchimp:campaign-ecomm-orders\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-ecomm-orders-6\">campaign-ecomm-orders#6</a>.\\n',summary:\"<p> Convenience function for  campaign-ecomm-orders#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"The total matching orders and the specific orders for the requested page\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-ecomm-orders\",qname:\"mailchimp:campaign-ecomm-orders\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:' Retrieve the Ecommerce Orders tracked by <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-ecomm-order-add-2\">campaign-ecomm-order-add()</a>.\\n',summary:\"<p> Retrieve the Ecommerce Orders tracked by  campaign-ecomm-order-add() .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"The total matching orders and the specific orders for the requested page\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-eep-url-stats\",qname:\"mailchimp:campaign-eep-url-stats\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-eep-url-stats-3\">campaign-eep-url-stats#3</a>.\\n',summary:\"<p> Convenience function for  campaign-eep-url-stats#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-eep-url-stats\",qname:\"mailchimp:campaign-eep-url-stats\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Retrieve the tracked eepurl mentions on Twitter.\\n\",summary:\"<p> Retrieve the tracked eepurl mentions on Twitter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Stats an array containing tweets, retweets, clicks, and referrer related to using the campaign's eepurl\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-email-domain-performance\",qname:\"mailchimp:campaign-email-domain-performance\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-email-domain-performance-3\">campaign-email-domain-performance#3</a>.\\n',summary:\"<p> Convenience function for  campaign-email-domain-performance#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull email domain performance for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Domains email domains and their associated stats\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-email-domain-performance\",qname:\"mailchimp:campaign-email-domain-performance\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:' Get the top 5 performing email domains for this campaign. Users want more than 5 should use campaign <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-email-stats-AIM-3\">campaign-email-stats-AIM()</a> or <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-email-stats-AIM-all-4\">campaign-email-stats-AIM-all()</a> and generate any additional stats they require.\\n',summary:\"<p> Get the top 5 performing email domains for this campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull email domain performance for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Domains email domains and their associated stats\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-email-stats-AIM-all\",qname:\"mailchimp:campaign-email-stats-AIM-all\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-email-stats-AIM-all-5\">campaign-email-stats-AIM-all#5</a>.\\n',summary:\"<p> Convenience function for  campaign-email-stats-AIM-all#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 1000</div>'}],returns:{type:\"item()*\",description:\"Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-email-stats-AIM-all\",qname:\"mailchimp:campaign-email-stats-AIM-all\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time, for every user a campaign was delivered to.\\n\",summary:\"<p> Given a campaign and correct paging limits, return the entire click and open history with timestamps, ordered by time, for every user a campaign was delivered to.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 1000</div>'}],returns:{type:\"item()*\",description:\"Array containing a total record count and data including the actions (opens and clicks) for each email, with timestamps\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-email-stats-AIM\",qname:\"mailchimp:campaign-email-stats-AIM\",signature:\"($apikey as xs:string, $cid as xs:string, $email_address as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-email-stats-AIM-4\">campaign-email-stats-AIM#4</a>.\\n',summary:\"<p> Convenience function for  campaign-email-stats-AIM#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to check OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).</div>'}],returns:{type:\"item()*\",description:\"Array an array with the keys listed in Returned Fields below\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-email-stats-AIM\",qname:\"mailchimp:campaign-email-stats-AIM\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $email_address as element(array)) as item()*\",description:\" Given a campaign and email address, return the entire click and open history with timestamps, ordered by time.\\n\",summary:\"<p> Given a campaign and email address, return the entire click and open history with timestamps, ordered by time.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to check OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).</div>'}],returns:{type:\"item()*\",description:\"Array an array with the keys listed in Returned Fields below\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-geo-opens-for-country\",qname:\"mailchimp:campaign-geo-opens-for-country\",signature:\"($apikey as xs:string, $cid as xs:string, $code as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-geo-opens-for-country-4\">campaign-geo-opens-for-country#4</a>.\\n',summary:\"<p> Convenience function for  campaign-geo-opens-for-country#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"code\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An ISO3166 2 digit country code</div>'}],returns:{type:\"item()*\",description:\"Regions an array of regions within the provided country where opens occurred.\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-geo-opens-for-country\",qname:\"mailchimp:campaign-geo-opens-for-country\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $code as xs:string) as item()*\",description:\" Retrieve the regions and number of opens tracked for a certain country. Email address are not returned.\\n\",summary:\"<p> Retrieve the regions and number of opens tracked for a certain country.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"code\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An ISO3166 2 digit country code</div>'}],returns:{type:\"item()*\",description:\"Regions an array of regions within the provided country where opens occurred.\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-geo-opens\",qname:\"mailchimp:campaign-geo-opens\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-geo-opens-3\">campaign-geo-opens#3</a>.\\n',summary:\"<p> Convenience function for  campaign-geo-opens#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Countries an array of countries where opens occurred\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-geo-opens\",qname:\"mailchimp:campaign-geo-opens\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Retrieve the countries and number of opens tracked for each. Email address are not returned.\\n\",summary:\"<p> Retrieve the countries and number of opens tracked for each.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Countries an array of countries where opens occurred\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-hard-bounces\",qname:\"mailchimp:campaign-hard-bounces\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-hard-bounces-5\">campaign-hard-bounces#5</a>.\\n',summary:\"<p> Convenience function for  campaign-hard-bounces#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"array a total of all hard bounced emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-hard-bounces\",qname:\"mailchimp:campaign-hard-bounces\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">DEPRECATED</strong> Get all email addresses with Hard Bounces for a given campaign the email address that bounced.\\n',summary:\"<p>  DEPRECATED  Get all email addresses with Hard Bounces for a given campaign the email address that bounced.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"array a total of all hard bounced emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-members\",qname:\"mailchimp:campaign-members\",signature:\"($apikey as xs:string, $cid as xs:string, $status as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-members-6\">campaign-members#6</a>.\\n',summary:\"<p> Convenience function for  campaign-members#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull members for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"status\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned</div>\"},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"A total of all matching emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:6,name:\"campaign-members\",qname:\"mailchimp:campaign-members\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $status as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Get all email addresses the campaign was successfully sent to (ie, no bounces).\\n\",summary:\"<p> Get all email addresses the campaign was successfully sent to (ie, no bounces).</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull members for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"status\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> optional the status to pull - one of 'sent', 'hard' (bounce), or 'soft' (bounce). By default, all records are returned</div>\"},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"A total of all matching emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-not-opened-AIM\",qname:\"mailchimp:campaign-not-opened-AIM\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-not-opened-AIM-5\">campaign-not-opened-AIM#5</a>.\\n',summary:\"<p> Convenience function for  campaign-not-opened-AIM#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get no opens for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-not-opened-AIM\",qname:\"mailchimp:campaign-not-opened-AIM\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Retrieve the list of email addresses that did not open a given campaign string email Email address that opened the campaign.\\n\",summary:\"<p> Retrieve the list of email addresses that did not open a given campaign string email Email address that opened the campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get no opens for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"array array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-opened-AIM\",qname:\"mailchimp:campaign-opened-AIM\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-opened-AIM-5\">campaign-openedAIM#5</a>.\\n',summary:\"<p> Convenience function for  campaign-openedAIM#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get opens for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-opened-AIM\",qname:\"mailchimp:campaign-opened-AIM\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Retrieve the list of email addresses that opened a given campaign with how many times they opened.\\n\",summary:\"<p> Retrieve the list of email addresses that opened a given campaign with how many times they opened.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get opens for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array containing the total records matched and the specific records for this page\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-pause\",qname:\"mailchimp:campaign-pause\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-pause-3\">campaign-pause#3</a>.\\n',summary:\"<p> Convenience function for  campaign-pause#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to pause</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-pause\",qname:\"mailchimp:campaign-pause\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Pause an AutoResponder or RSS campaign from sending.\\n\",summary:\"<p> Pause an AutoResponder or RSS campaign from sending.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to pause</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-replicate\",qname:\"mailchimp:campaign-replicate\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-replicate-3\">campaign-replicate#3</a>.\\n',summary:\"<p> Convenience function for  campaign-replicate#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to replicate</div>'}],returns:{type:\"item()*\",description:\"The id of the replicated Campaign created, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-replicate\",qname:\"mailchimp:campaign-replicate\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Replicate a campaign.\\n\",summary:\"<p> Replicate a campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to replicate</div>'}],returns:{type:\"item()*\",description:\"The id of the replicated Campaign created, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-resume\",qname:\"mailchimp:campaign-resume\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-resume-3\">campaign-resume#3</a>.\\n',summary:\"<p> Convenience function for  campaign-resume#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to pause</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-resume\",qname:\"mailchimp:campaign-resume\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Resume sending an AutoResponder or RSS campaign.\\n\",summary:\"<p> Resume sending an AutoResponder or RSS campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to pause</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-schedule\",qname:\"mailchimp:campaign-schedule\",signature:\"($apikey as xs:string, $cid as xs:string, $schedule_time as xs:string, $schedule_time_b as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-schedule-5\">campaign-schedule#5</a>.\\n',summary:\"<p> Convenience function for  campaign-schedule#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to schedule</div>'},{name:\"schedule_time\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time to schedule the campaign. For A/B Split \"schedule\" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'},{name:\"schedule_time_b\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional -the time to schedule Group B of an A/B Split \"schedule\" campaign - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"boolean True on success\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-schedule\",qname:\"mailchimp:campaign-schedule\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $schedule_time as xs:string, $schedule_time_b as xs:string) as item()*\",description:\" Schedule a campaign to be sent in the future.\\n\",summary:\"<p> Schedule a campaign to be sent in the future.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to schedule</div>'},{name:\"schedule_time\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time to schedule the campaign. For A/B Split \"schedule\" campaigns, the time for Group A - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'},{name:\"schedule_time_b\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional -the time to schedule Group B of an A/B Split \"schedule\" campaign - in YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"boolean True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-segment-test\",qname:\"mailchimp:campaign-segment-test\",signature:\"($apikey as xs:string, $list_id as xs:string, $options as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-segment-test-4\">campaign-segment-test#4</a>.\\n',summary:\"<p> Convenience function for  campaign-segment-test#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"list_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list to test segmentation on - get lists using lists()</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> with 2 keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaignsegmenttest.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"The total number of subscribers matching your segmentation options\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-segment-test\",qname:\"mailchimp:campaign-segment-test\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $list_id as xs:string, $options as element(array)) as item()*\",description:\" Allows one to test their segmentation rules before creating a campaign using them.\\n\",summary:\"<p> Allows one to test their segmentation rules before creating a campaign using them.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"list_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list to test segmentation on - get lists using <a href=\"#lists-4\">lists()</a></div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> with 2 keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaignsegmenttest.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"The total number of subscribers matching your segmentation options\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-send-now\",qname:\"mailchimp:campaign-send-now\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-send-now-3\">campaign-send-now#3</a>.\\n',summary:\"<p> Convenience function for  campaign-send-now#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to send</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-send-now\",qname:\"mailchimp:campaign-send-now\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:' Send a given campaign immediately. For RSS campaigns, this will \"start\" them.\\n',summary:\"<p> Send a given campaign immediately.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to send</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-send-test\",qname:\"mailchimp:campaign-send-test\",signature:\"($apikey as xs:string, $cid as xs:string, $test_emails as element(array), $send_type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-send-test-5\">campaign-send-test#5</a>.\\n',summary:\"<p> Convenience function for  campaign-send-test#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to test</div>'},{name:\"test_emails\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email address to receive the test message</div>'},{name:\"send_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional by default (null) both formats are sent - \"html\" or \"text\" send just that format</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-send-test\",qname:\"mailchimp:campaign-send-test\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $test_emails as element(array), $send_type as xs:string) as item()*\",description:\" Send a test of this campaign to the provided email address.\\n\",summary:\"<p> Send a test of this campaign to the provided email address.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to test</div>'},{name:\"test_emails\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email address to receive the test message</div>'},{name:\"send_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional by default (null) both formats are sent - \"html\" or \"text\" send just that format</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-share-report\",qname:\"mailchimp:campaign-share-report\",signature:\"($apikey as xs:string, $cid as xs:string, $opts as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-share-report-4\">campaign-share-report#4</a>.\\n',summary:\"<p> Convenience function for  campaign-share-report#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to share a report for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> s optional various parameters which can be used to configure the shared report</div>'}],returns:{type:\"item()*\",description:\"Struct containing details for the shared report\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-share-report\",qname:\"mailchimp:campaign-share-report\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $opts as element(array)) as item()*\",description:' Get the URL to a customized <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://eepurl.com/gKmL\" target=\"_blank\">VIP Report</a> for the specified campaign and optionally send an email to someone with links to it. Note subsequent calls will overwrite anything already set for the same campign (eg, the password).\\n',summary:\"<p> Get the URL to a customized  VIP Report  for the specified campaign and optionally send an email to someone with links to it.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to share a report for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"opts\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> s optional various parameters which can be used to configure the shared report</div>'}],returns:{type:\"item()*\",description:\"Struct containing details for the shared report\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-soft-bounces\",qname:\"mailchimp:campaign-soft-bounces\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-soft-bounces-5\">campaign-soft-bounces#5</a>.\\n',summary:\"<p> Convenience function for  campaign-soft-bounces#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"A total of all soft bounced emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-soft-bounces\",qname:\"mailchimp:campaign-soft-bounces\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">DEPRECATED</strong> Get all email addresses with Soft Bounces for a given campaign the email address that bounced.\\n',summary:\"<p>  DEPRECATED  Get all email addresses with Soft Bounces for a given campaign the email address that bounced.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"A total of all soft bounced emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-stats\",qname:\"mailchimp:campaign-stats\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-stats-3\">campaign-stats#3</a>.\\n',summary:\"<p> Convenience function for  campaign-stats#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"array struct of the statistics for this campaign\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-stats\",qname:\"mailchimp:campaign-stats\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.)\\n\",summary:\"<p> Given a list and a campaign, get all the relevant campaign statistics (opens, bounces, clicks, etc.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull stats for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"array struct of the statistics for this campaign\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-template-content\",qname:\"mailchimp:campaign-template-content\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-template-content-3\">campaign-template-content#3</a>.\\n',summary:\"<p> Convenience function for  campaign-template-content#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get content for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Array containing all content section for the campaign -\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-template-content\",qname:\"mailchimp:campaign-template-content\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:' Get the HTML template content sections for a campaign. Note that this <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">will</strong> return very jagged, non-standard results based on the template a campaign is using. You only want to use this if you want to allow editing template sections in your applicaton.\\n',summary:\"<p> Get the HTML template content sections for a campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to get content for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'}],returns:{type:\"item()*\",description:\"Array containing all content section for the campaign -\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaign-unschedule\",qname:\"mailchimp:campaign-unschedule\",signature:\"($apikey as xs:string, $cid as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-unschedule-3\">campaign-unschedule#3</a>.\\n',summary:\"<p> Convenience function for  campaign-unschedule#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to unschedule</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaign-unschedule\",qname:\"mailchimp:campaign-unschedule\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string) as item()*\",description:\" Unschedule a campaign that is scheduled to be sent in the future.\\n\",summary:\"<p> Unschedule a campaign that is scheduled to be sent in the future.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the campaign to unschedule</div>'}],returns:{type:\"item()*\",description:\"True on success\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-unsubscribes\",qname:\"mailchimp:campaign-unsubscribes\",signature:\"($apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-unsubscribes-5\">campaign-unsubscribes#5</a>.\\n',summary:\"<p> Convenience function for  campaign-unsubscribes#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"array email addresses that unsubscribed from this campaign along with reasons, if given array a total of all unsubscribed emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-unsubscribes\",qname:\"mailchimp:campaign-unsubscribes\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Get all unsubscribed email addresses for a given campaign.\\n\",summary:\"<p> Get all unsubscribed email addresses for a given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the campaign id to pull bounces for (can be gathered using <a href=\"#campaigns-4\">campaigns()</a>)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> art optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> mit optional for large data sets, the number of results to return - defaults to 1000, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"array email addresses that unsubscribed from this campaign along with reasons, if given array a total of all unsubscribed emails and the specific emails for this page\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaign-update\",qname:\"mailchimp:campaign-update\",signature:\"($apikey as xs:string, $cid as xs:string, $name as xs:string, $value as item()) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-update-5\">campaign-update#5</a>.\\n',summary:\"<p> Convenience function for  campaign-update#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to update</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the parameter name (see <a href=\"#campaign-create-6\">campaigncreate()</a>). For items in the <strong>options</strong> array, this will be that parameter\\'s name (subject, from_email, etc.). Additional parameters will be that option name (content, segment_opts). \"type_opts\" will be the name of the type - rss, auto, trans, etc.</div>'},{name:\"value\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> e an appropriate value for the parameter ( see <a href=\"#campaign-create-6\">campaigncreate()</a>). For items in the <strong>options</strong> array, this will be that parameter\\'s value. For additional parameters, this is the same value passed to them.</div>'}],returns:{type:\"item()*\",description:\"boolean true if the update succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"campaign-update\",qname:\"mailchimp:campaign-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $cid as xs:string, $name as xs:string, $value as item()) as item()*\",description:' Update just about any setting for a campaign that has <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">not</em> been sent. See <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaign-create-6\">campaigncreate()</a> for details.\\n Caveats: <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n  <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    <li>If you set list_id, all segmentation options will be deleted and must be re-added.</li>\\n    <li>If you set template_id, you need to follow that up by setting it\\'s \\'content\\'</li>\\n    <li>If you set segment_opts, you should have tested your options against <a href=\"#campaign-segment-test-3\">campaign-segment-test()</a> as <a href=\"#campaign-update-4\">campaign-update()</a> will not allow you to set a segment that includes no members.</li>\\n  </ul>.\\n',summary:\"<p> Update just about any setting for a campaign that has  not  been sent.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"cid\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the Campaign Id to update</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the parameter name ( see <a href=\"#campaign-create-6\">campaigncreate()</a>). For items in the <strong>options</strong> array, this will be that parameter\\'s name (subject, from_email, etc.). Additional parameters will be that option name (content, segment_opts). \"type_opts\" will be the name of the type - rss, auto, trans, etc.</div>'},{name:\"value\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An appropriate value for the parameter ( see <a href=\"#campaign-create-6\">campaigncreate()</a>). For items in the <strong>options</strong> array, this will be that parameter\\'s value. For additional parameters, this is the same value passed to them.</div>'}],returns:{type:\"item()*\",description:\"True if the update succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"campaigns-for-email\",qname:\"mailchimp:campaigns-for-email\",signature:\"($apikey as xs:string, $email_address as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaigns-for-email-3\">campaigns-for-email#3</a>.\\n',summary:\"<p> Convenience function for  campaigns-for-email#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to unsubscribe OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'}],returns:{type:\"item()*\",description:\"An array of campaign_ids the member received\"},errors:[]},{isDocumented:!0,arity:3,name:\"campaigns-for-email\",qname:\"mailchimp:campaigns-for-email\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $email_address as xs:string) as item()*\",description:\" Retrieve all Campaigns Ids a member was sent.\\n\",summary:\"<p> Retrieve all Campaigns Ids a member was sent.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to unsubscribe OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'}],returns:{type:\"item()*\",description:\"An array of campaign_ids the member received\"},errors:[]},{isDocumented:!0,arity:4,name:\"campaigns\",qname:\"mailchimp:campaigns\",signature:\"($apikey as xs:string, $filters as element(array), $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#campaigns-5\">campaigns#5</a>.\\n',summary:\"<p> Convenience function for  campaigns#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"filters\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of filters to apply to this query - all are optional. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigns.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)</div>'}],returns:{type:\"item()*\",description:'An array containing a count of all matching campaigns and the specific ones for the current page (see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://apidocs.mailchimp.com/rtfm/campaigns.func.php\">Mailchimp API documentation</a> for more information about the return type)'},errors:[]},{isDocumented:!0,arity:5,name:\"campaigns\",qname:\"mailchimp:campaigns\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $filters as element(array), $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Get the list of campaigns and their details matching the specified filters.\\n\",summary:\"<p> Get the list of campaigns and their details matching the specified filters.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"filters\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of filters to apply to this query - all are optional. See <a href=\"http://apidocs.mailchimp.com/rtfm/campaigns.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of campaigns, start results at this campaign #, defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of campaigns, number of campaigns to return with each call, defaults to 25 (max=1000)</div>'}],returns:{type:\"item()*\",description:'An array containing a count of all matching campaigns and the specific ones for the current page (see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://apidocs.mailchimp.com/rtfm/campaigns.func.php\">Mailchimp API documentation</a> for more information about the return type)'},errors:[]},{isDocumented:!0,arity:1,name:\"chimp-chatter\",qname:\"mailchimp:chimp-chatter\",signature:\"($apikey as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#chimp-chatter-2\">chimp-chatter#2</a>.\\n',summary:\"<p> Convenience function for  chimp-chatter#2 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"An array of chatter messages and properties\"},errors:[]},{isDocumented:!0,arity:2,name:\"chimp-chatter\",qname:\"mailchimp:chimp-chatter\",signature:\"($endpoint-url as xs:string, $apikey as xs:string) as item()*\",description:\" Return the current Chimp Chatter messages for an account.\\n\",summary:\"<p> Return the current Chimp Chatter messages for an account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'}],returns:{type:\"item()*\",description:\"An array of chatter messages and properties\"},errors:[]},{isDocumented:!0,arity:2,name:\"ecomm-order-add\",qname:\"mailchimp:ecomm-order-add\",signature:\"($apikey as xs:string, $order as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#ecomm-order-add-3\">ecomm-order-add#3</a>.\\n',summary:\"<p> Convenience function for  ecomm-order-add#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"order\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of information pertaining to the order that has completed. Use the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/ecommorderadd.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"True if the data is saved, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:3,name:\"ecomm-order-add\",qname:\"mailchimp:ecomm-order-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $order as element(array)) as item()*\",description:\" Import Ecommerce Order Information to be used for Segmentation.\\n\",summary:\"<p> Import Ecommerce Order Information to be used for Segmentation.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"order\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of information pertaining to the order that has completed. Use the following keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/ecommorderadd.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'}],returns:{type:\"item()*\",description:\"True if the data is saved, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:3,name:\"ecomm-order-del\",qname:\"mailchimp:ecomm-order-del\",signature:\"($apikey as xs:string, $store_id as xs:string, $order_id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#ecomm-order-del-4\">ecomm-order-del#4</a>.\\n',summary:\"<p> Convenience function for  ecomm-order-del#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"store_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the store id the order belongs to</div>'},{name:\"order_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the order id (generated by the store) to delete</div>'}],returns:{type:\"item()*\",description:\"True if an order is deleted, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"ecomm-order-del\",qname:\"mailchimp:ecomm-order-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $store_id as xs:string, $order_id as xs:string) as item()*\",description:' Delete Ecommerce Order Information used for segmentation. This will generally be used by ecommerce package plugins <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"/plugins/ecomm360.phtml\">that we provide</a> or by 3rd part system developers.\\n',summary:\"<p> Delete Ecommerce Order Information used for segmentation.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"store_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the store id the order belongs to</div>'},{name:\"order_id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the order id (generated by the store) to delete</div>'}],returns:{type:\"item()*\",description:\"True if an order is deleted, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"ecomm-orders\",qname:\"mailchimp:ecomm-orders\",signature:\"($apikey as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#ecomm-orders-5\">ecomm-orders#5</a>.\\n',summary:\"<p> Convenience function for  ecomm-orders#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"Array the total matching orders and the specific orders for the requested page\"},errors:[]},{isDocumented:!0,arity:5,name:\"ecomm-orders\",qname:\"mailchimp:ecomm-orders\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:\" Retrieve the Ecommerce Orders for an account.\\n\",summary:\"<p> Retrieve the Ecommerce Orders for an account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 500</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"Array the total matching orders and the specific orders for the requested page\"},errors:[]},{isDocumented:!0,arity:3,name:\"folder-add\",qname:\"mailchimp:folder-add\",signature:\"($apikey as xs:string, $name as xs:string, $type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#folder-add-4\">folder-add#4</a>.\\n',summary:\"<p> Convenience function for  folder-add#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a unique name for a folder (max 100 bytes)</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"The folder_id of the newly created folder.\"},errors:[]},{isDocumented:!0,arity:4,name:\"folder-add\",qname:\"mailchimp:folder-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $name as xs:string, $type as xs:string) as item()*\",description:\" Add a new folder to file campaigns or autoresponders in.\\n\",summary:\"<p> Add a new folder to file campaigns or autoresponders in.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a unique name for a folder (max 100 bytes)</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"The folder_id of the newly created folder.\"},errors:[]},{isDocumented:!0,arity:3,name:\"folder-del\",qname:\"mailchimp:folder-del\",signature:\"($apikey as xs:string, $fid as xs:integer, $type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#folder-del-4\">folder-del#4</a>.\\n',summary:\"<p> Convenience function for  folder-del#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"fid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the folder id to update - retrieve from folders()</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"True if the delete worked, otherwise an exception is thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"folder-del\",qname:\"mailchimp:folder-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $fid as xs:integer, $type as xs:string) as item()*\",description:\" Delete a campaign or autoresponder folder. Note that this will simply make campaigns in the folder appear unfiled, they are not removed.\\n\",summary:\"<p> Delete a campaign or autoresponder folder.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"fid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the folder id to update - retrieve from folders()</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"True if the delete worked, otherwise an exception is thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"folder-update\",qname:\"mailchimp:folder-update\",signature:\"($apikey as xs:string, $fid as xs:integer, $name as xs:string, $type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#folder-update-5\">folder-update#5</a>.\\n',summary:\"<p> Convenience function for  folder-update#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"fid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the folder id to update - retrieve from folders()</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a new, unique name for the folder (max 100 bytes)</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"True if the update worked, otherwise an exception is thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"folder-update\",qname:\"mailchimp:folder-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $fid as xs:integer, $name as xs:string, $type as xs:string) as item()*\",description:\" Update the name of a folder for campaigns or autoresponders.\\n\",summary:\"<p> Update the name of a folder for campaigns or autoresponders.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"fid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the folder id to update - retrieve from folders()</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a new, unique name for the folder (max 100 bytes)</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folder to create - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"True if the update worked, otherwise an exception is thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"folders\",qname:\"mailchimp:folders\",signature:\"($apikey as xs:string, $type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#folders-3\">folders#3</a>.\\n',summary:\"<p> Convenience function for  folders#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folders to return - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"Array of folder structs (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:3,name:\"folders\",qname:\"mailchimp:folders\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $type as xs:string) as item()*\",description:\" List all the folders for a user account.\\n\",summary:\"<p> List all the folders for a user account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the type of folders to return - either \"campaign\" or \"autoresponder\". Defaults to \"campaign\"</div>'}],returns:{type:\"item()*\",description:\"Array of folder structs (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:3,name:\"generate-text\",qname:\"mailchimp:generate-text\",signature:\"($apikey as xs:string, $type as xs:string, $content as item()) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#generate-text-4\">generate-text#4</a>.\\n',summary:\"<p> Convenience function for  generate-text#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The type of content to parse. Must be one of: \"html\", \"template\", \"url\", \"cid\" (Campaign Id), or \"tid\" (Template Id)</div>'},{name:\"content\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content to use. For \"html\" expects a single string value, \"template\" expects an array like you send to campaignCreate, \"url\" expects a valid &amp; public URL to pull from, \"cid\" expects a valid Campaign Id, and \"tid\" expects a valid Template Id on your account.</div>'}],returns:{type:\"item()*\",description:\"The content pass in converted to text.\"},errors:[]},{isDocumented:!0,arity:4,name:\"generate-text\",qname:\"mailchimp:generate-text\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $type as xs:string, $content as item()) as item()*\",description:' Have HTML content auto-converted to a text-only format. You can send: plain HTML, an array of Template content, an existing Campaign Id, or an existing Template Id. Note that this will <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">not</b> save anything to or update any of your lists, campaigns, or templates.\\n',summary:\"<p> Have HTML content auto-converted to a text-only format.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The type of content to parse. Must be one of: \"html\", \"template\", \"url\", \"cid\" (Campaign Id), or \"tid\" (Template Id)</div>'},{name:\"content\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content to use. For \"html\" expects a single string value, \"template\" expects an array like you send to campaignCreate, \"url\" expects a valid &amp; public URL to pull from, \"cid\" expects a valid Campaign Id, and \"tid\" expects a valid Template Id on your account.</div>'}],returns:{type:\"item()*\",description:\"The content pass in converted to text.\"},errors:[]},{isDocumented:!0,arity:1,name:\"get-account-details\",qname:\"mailchimp:get-account-details\",signature:\"($apikey as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#get-account-details-2\">get-account-details#2</a>.\\n',summary:\"<p> Convenience function for  get-account-details#2 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"array containing the details for the account tied to this API Key\"},errors:[]},{isDocumented:!0,arity:2,name:\"get-account-details\",qname:\"mailchimp:get-account-details\",signature:\"($endpoint-url as xs:string, $apikey as xs:string) as item()*\",description:\" Retrieve lots of account information including payments made, plan info, some account stats, installed modules, contact info, and more.\\n\",summary:\"<p> Retrieve lots of account information including payments made, plan info, some account stats, installed modules, contact info, and more.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'}],returns:{type:\"item()*\",description:\"Array containing the details for the account tied to this API Key\"},errors:[]},{isDocumented:!0,arity:3,name:\"inline-css\",qname:\"mailchimp:inline-css\",signature:\"($apikey as xs:string, $html as xs:string, $strip_css as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#inline-css-4\">inline-css#4</a>.\\n',summary:\"<p> Convenience function for  inline-css#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your HTML content</div>'},{name:\"strip_css\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional Whether you want the CSS &amp;lt;style&amp;gt; tags stripped from the returned document. Defaults to false.</div>'}],returns:{type:\"item()*\",description:\"Your HTML content with all CSS inlined, just like if we sent it.\"},errors:[]},{isDocumented:!0,arity:4,name:\"inline-css\",qname:\"mailchimp:inline-css\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $html as xs:string, $strip_css as xs:boolean) as item()*\",description:\" Send your HTML content to have the CSS inlined and optionally remove the original styles.\\n\",summary:\"<p> Send your HTML content to have the CSS inlined and optionally remove the original styles.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Your HTML content</div>'},{name:\"strip_css\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional Whether you want the CSS &amp;lt;style&amp;gt; tags stripped from the returned document. Defaults to false.</div>'}],returns:{type:\"item()*\",description:\"Your HTML content with all CSS inlined, just like if we sent it.\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-abuse-reports\",qname:\"mailchimp:list-abuse-reports\",signature:\"($apikey as xs:string, $id as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-abuse-reports-6\">list-abuse-reports#6</a>.\\n',summary:\"<p> Convenience function for  list-abuse-reports#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to pull abuse reports for (can be gathered using lists())</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"The total of all reports and the specific reports reports this page\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-abuse-reports\",qname:\"mailchimp:list-abuse-reports\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $start as xs:integer, $limit as xs:integer, $since as xs:string) as item()*\",description:\" Get all email addresses that complained about a given campaign.\\n\",summary:\"<p> Get all email addresses that complained about a given campaign.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to pull abuse reports for (can be gathered using lists())</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 500, upper limit set at 1000</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull only messages since this time - use YYYY-MM-DD HH:II:SS format in <strong>GMT</strong></div>'}],returns:{type:\"item()*\",description:\"The total of all reports and the specific reports reports this page\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-activity\",qname:\"mailchimp:list-activity\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-activity-3\">list-activity#3</a>.\\n',summary:\"<p> Convenience function for  list-activity#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array of array of daily values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-activity\",qname:\"mailchimp:list-activity\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Access up to the previous 180 days of daily detailed aggregated activity stats for a given list.\\n\",summary:\"<p> Access up to the previous 180 days of daily detailed aggregated activity stats for a given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"array array of array of daily values.\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-batch-subscribe\",qname:\"mailchimp:list-batch-subscribe\",signature:\"($apikey as xs:string, $id as xs:string, $batch as element(array), $double_optin as xs:boolean, $update_existing as xs:boolean, $replace_interests as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-batch-subscribe-7\">list-batch-subscribe#7</a>.\\n',summary:\"<p> Convenience function for  list-batch-subscribe#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of structs for each address to import with two special keys: \"EMAIL\" for the email address, and \"EMAIL_TYPE\" for the email type option (html, text, or mobile)</div>'},{name:\"double_optin\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to control whether to send an opt-in confirmation email - defaults to true</div>'},{name:\"update_existing\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error)</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'}],returns:{type:\"item()*\",description:\"Array of result counts and any errors that occurred\"},errors:[]},{isDocumented:!0,arity:7,name:\"list-batch-subscribe\",qname:\"mailchimp:list-batch-subscribe\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $batch as element(array), $double_optin as xs:boolean, $update_existing as xs:boolean, $replace_interests as xs:boolean) as item()*\",description:' Subscribe a batch of email addresses to a list at once. If you are using a serialized version of the API, we strongly suggest that you only run this method as a POST request, and <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">not</em> a GET request. Maximum batch sizes vary based on the amount of data in each record, though you should cap them at 5k - 10k records, depending on your experience. These calls are also long, so be sure you increase your timeout values.\\n',summary:\"<p> Subscribe a batch of email addresses to a list at once.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of structs for each address to import with two special keys: \"EMAIL\" for the email address, and \"EMAIL_TYPE\" for the email type option (html, text, or mobile)</div>'},{name:\"double_optin\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to control whether to send an opt-in confirmation email - defaults to true</div>'},{name:\"update_existing\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error)</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'}],returns:{type:\"item()*\",description:\"Array of result counts and any errors that occurred\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-batch-unsubscribe\",qname:\"mailchimp:list-batch-unsubscribe\",signature:\"($apikey as xs:string, $id as xs:string, $emails as element(array), $delete_member as xs:boolean, $send_goodbye as xs:boolean, $send_notify as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-batch-unsubscribe-7\">list-batch-unsubscribe#7</a>.\\n',summary:\"<p> Convenience function for  list-batch-unsubscribe#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"emails\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> array of email addresses to unsubscribe</div>'},{name:\"delete_member\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to completely delete the member from your list instead of just unsubscribing, default to false</div>'},{name:\"send_goodbye\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the goodbye email to the email addresses, defaults to true</div>'},{name:\"send_notify\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to false</div>'}],returns:{type:\"item()*\",description:\"Array of result counts and any errors that occurred\"},errors:[]},{isDocumented:!0,arity:7,name:\"list-batch-unsubscribe\",qname:\"mailchimp:list-batch-unsubscribe\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $emails as element(array), $delete_member as xs:boolean, $send_goodbye as xs:boolean, $send_notify as xs:boolean) as item()*\",description:\" Unsubscribe a batch of email addresses to a list.\\n\",summary:\"<p> Unsubscribe a batch of email addresses to a list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"emails\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> array of email addresses to unsubscribe</div>'},{name:\"delete_member\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to completely delete the member from your list instead of just unsubscribing, default to false</div>'},{name:\"send_goodbye\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the goodbye email to the email addresses, defaults to true</div>'},{name:\"send_notify\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to false</div>'}],returns:{type:\"item()*\",description:\"Array of result counts and any errors that occurred\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-clients\",qname:\"mailchimp:list-clients\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-clients-3\">list-clients#3</a>.\\n',summary:\"<p> Convenience function for  list-clients#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"array the desktop and mobile user agents in use on the list\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-clients\",qname:\"mailchimp:list-clients\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Retrieve the clients that the list's subscribers have been tagged as being used based on user agents seen. Made possible by <a xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\" href=\\\"http://user-agent-string.info\\\" target=\\\"_blank\\\">user-agent-string.info</a> double penetration the percent of desktop clients in use array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented double penetration the percent of mobile clients in use array clients a record containing the 'client', an 'icon' image url, the 'percent' using the client, and the total 'members' represented.\\n\",summary:\"<p> Retrieve the clients that the list's subscribers have been tagged as being used based on user agents seen.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array the desktop and mobile user agents in use on the list\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-growth-history\",qname:\"mailchimp:list-growth-history\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-growth-history-3\">list-growth-history#3</a>.\\n',summary:\"<p> Convenience function for  list-growth-history#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array of months and growth\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-growth-history\",qname:\"mailchimp:list-growth-history\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Access the Growth History by Month for a given list.\\n\",summary:\"<p> Access the Growth History by Month for a given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array of months and growth\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-interest-group-add\",qname:\"mailchimp:list-interest-group-add\",signature:\"($apikey as xs:string, $id as xs:string, $group_name as xs:string, $grouping_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-group-add-5\">list-interest-group-add#5</a>.\\n',summary:\"<p> Convenience function for  list-interest-group-add#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"group_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group to add - group names must be unique within a grouping</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> ouping_id The grouping to add the new group to - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a>. If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-interest-group-add\",qname:\"mailchimp:list-interest-group-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $group_name as xs:string, $grouping_id as xs:integer) as item()*\",description:\" Add a single Interest Group - if interest groups for the List are not yet enabled, adding the first group will automatically turn them on.\\n\",summary:\"<p> Add a single Interest Group - if interest groups for the List are not yet enabled, adding the first group will automatically turn them on.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"group_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group to add - group names must be unique within a grouping</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> ouping_id The grouping to add the new group to - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a> . If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"bool true if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-interest-group-del\",qname:\"mailchimp:list-interest-group-del\",signature:\"($apikey as xs:string, $id as xs:string, $group_name as xs:string, $grouping_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-group-del-5\">list-interest-group-del#5</a>.\\n',summary:\"<p> Convenience function for  list-interest-group-del#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"group_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group to delete</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The grouping to delete the group from - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a> . If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-interest-group-del\",qname:\"mailchimp:list-interest-group-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $group_name as xs:string, $grouping_id as xs:integer) as item()*\",description:\" Delete a single Interest Group - if the last group for a list is deleted, this will also turn groups for the list off.\\n\",summary:\"<p> Delete a single Interest Group - if the last group for a list is deleted, this will also turn groups for the list off.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"group_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group to delete</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The grouping to delete the group from - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a> . If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-interest-group-update\",qname:\"mailchimp:list-interest-group-update\",signature:\"($apikey as xs:string, $id as xs:string, $old_name as xs:string, $new_name as xs:string, $grouping_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-group-update-6\">list-interest-group-update#6</a>.\\n',summary:\"<p> Convenience function for  list-interest-group-update#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"old_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group name to be changed</div>'},{name:\"new_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the new interest group name to be set</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> ouping_id The grouping to delete the group from - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a> . If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-interest-group-update\",qname:\"mailchimp:list-interest-group-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $old_name as xs:string, $new_name as xs:string, $grouping_id as xs:integer) as item()*\",description:\" Change the name of an Interest Group.\\n\",summary:\"<p> Change the name of an Interest Group.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"old_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest group name to be changed</div>'},{name:\"new_name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the new interest group name to be set</div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> ouping_id The grouping to delete the group from - get using <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a> . If not supplied, the first grouping on the list is used.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-interest-grouping-add\",qname:\"mailchimp:list-interest-grouping-add\",signature:\"($apikey as xs:string, $id as xs:string, $name as xs:string, $type as xs:string, $groups as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-grouping-add-6\">list-interest-grouping-add#6</a>.\\n',summary:\"<p> Convenience function for  list-interest-grouping-add#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping to add - grouping names must be unique</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The type of the grouping to add - one of \"checkboxes\", \"hidden\", \"dropdown\", \"radio\"</div>'},{name:\"groups\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The lists of initial group names to be added - at least 1 is required and the names must be unique within a grouping. If the number takes you over the 60 group limit, an error will be thrown.</div>'}],returns:{type:\"item()*\",description:\"The new grouping id if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-interest-grouping-add\",qname:\"mailchimp:list-interest-grouping-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $name as xs:string, $type as xs:string, $groups as element(array)) as item()*\",description:\" Add a new Interest Grouping - if interest groups for the List are not yet enabled, adding the first grouping will automatically turn them on.\\n\",summary:\"<p> Add a new Interest Grouping - if interest groups for the List are not yet enabled, adding the first grouping will automatically turn them on.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping to add - grouping names must be unique</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The type of the grouping to add - one of \"checkboxes\", \"hidden\", \"dropdown\", \"radio\"</div>'},{name:\"groups\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The lists of initial group names to be added - at least 1 is required and the names must be unique within a grouping. If the number takes you over the 60 group limit, an error will be thrown.</div>'}],returns:{type:\"item()*\",description:\"The new grouping id if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-interest-grouping-del\",qname:\"mailchimp:list-interest-grouping-del\",signature:\"($apikey as xs:string, $grouping_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-grouping-del-3\">list-interest-grouping-del#3</a>.\\n',summary:\"<p> Convenience function for  list-interest-grouping-del#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping id - get from <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a></div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-interest-grouping-del\",qname:\"mailchimp:list-interest-grouping-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $grouping_id as xs:integer) as item()*\",description:\" Delete an existing Interest Grouping - this will permanently delete all contained interest groups and will remove those selections from all list members.\\n\",summary:\"<p> Delete an existing Interest Grouping - this will permanently delete all contained interest groups and will remove those selections from all list members.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping id - get from <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a></div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-interest-grouping-update\",qname:\"mailchimp:list-interest-grouping-update\",signature:\"($apikey as xs:string, $grouping_id as xs:integer, $name as xs:string, $value as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-grouping-update-5\">list-interest-grouping-update#5</a>.\\n',summary:\"<p> Convenience function for  list-interest-grouping-update#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping id - get from <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the field to update - either \"name\" or \"type\". Groups with in the grouping should be manipulated using the standard listInterestGroup* methods</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The new value of the field. Grouping names must be unique - only \"hidden\" and \"checkboxes\" grouping types can be converted between each other.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-interest-grouping-update\",qname:\"mailchimp:list-interest-grouping-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $grouping_id as xs:integer, $name as xs:string, $value as xs:string) as item()*\",description:\" Update an existing Interest Grouping.\\n\",summary:\"<p> Update an existing Interest Grouping.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"grouping_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the interest grouping id - get from <a href=\"#list-interest-groupings-2\">list-interest-groupings()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the field to update - either \"name\" or \"type\". Groups with in the grouping should be manipulated using the standard listInterestGroup* methods</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The new value of the field. Grouping names must be unique - only \"hidden\" and \"checkboxes\" grouping types can be converted between each other.</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-interest-groupings\",qname:\"mailchimp:list-interest-groupings\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-interest-groupings-3\">list-interest-groupings#3</a>.\\n',summary:\"<p> Convenience function for  list-interest-groupings#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of interest groups for the list\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-interest-groupings\",qname:\"mailchimp:list-interest-groupings\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Get the list of interest groupings for a given list, including the label, form information, and included groups for each.\\n\",summary:\"<p> Get the list of interest groupings for a given list, including the label, form information, and included groups for each.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of interest groups for the list\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-locations\",qname:\"mailchimp:list-locations\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-locations-3\">list-locations#3</a>.\\n',summary:\"<p> Convenience function for  list-locations#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array of locations\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-locations\",qname:\"mailchimp:list-locations\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Retrieve the locations (countries) that the list's subscribers have been tagged to based on geocoding their IP address.\\n\",summary:\"<p> Retrieve the locations (countries) that the list's subscribers have been tagged to based on geocoding their IP address.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"Array of locations\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-member-activity\",qname:\"mailchimp:list-member-activity\",signature:\"($apikey as xs:string, $id as xs:string, $email_address as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-member-activity-4\">list-member-activity#4</a>.\\n',summary:\"<p> Convenience function for  list-member-activity#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to get information for OR the \"id\"(s) for the member returned from listMembers, Webhooks, and Campaigns.</div>'}],returns:{type:\"item()*\",description:\"Array of data and success/error counts\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-member-activity\",qname:\"mailchimp:list-member-activity\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $email_address as element(array)) as item()*\",description:\" Get the most recent 100 activities for particular list members (open, click, bounce, unsub, abuse, sent to).\\n\",summary:\"<p> Get the most recent 100 activities for particular list members (open, click, bounce, unsub, abuse, sent to).</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to get information for OR the \"id\"(s) for the member returned from listMembers, Webhooks, and Campaigns.</div>'}],returns:{type:\"item()*\",description:\"Array of data and success/error counts\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-member-info\",qname:\"mailchimp:list-member-info\",signature:\"($apikey as xs:string, $id as xs:string, $email_address as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-member-info-4\">list-member-info#4</a>.\\n',summary:\"<p> Convenience function for  list-member-info#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to get information for OR the \"id\"(s) for the member returned from listMembers, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).</div>'}],returns:{type:\"item()*\",description:\"Array of list members with their info in an array (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-member-info\",qname:\"mailchimp:list-member-info\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $email_address as element(array)) as item()*\",description:\" Get all the information for particular members of a list.\\n\",summary:\"<p> Get all the information for particular members of a list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of up to 50 email addresses to get information for OR the \"id\"(s) for the member returned from listMembers, Webhooks, and Campaigns. For backwards compatibility, if a string is passed, it will be treated as an array with a single element (will not work with XML-RPC).</div>'}],returns:{type:\"item()*\",description:\"Array of list members with their info in an array (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-members\",qname:\"mailchimp:list-members\",signature:\"($apikey as xs:string, $id as xs:string, $status as xs:string, $since as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-members-7\">list-members#7</a>.\\n',summary:\"<p> Convenience function for  list-members#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"status\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the status to get members for - one of(subscribed, unsubscribed, <a target=\"_blank\" href=\"http://eepurl.com/dwk1\">cleaned</a>, updated), defaults to subscribed</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull all members whose status (subscribed/unsubscribed/cleaned) has changed or whose profile (updated) has changed since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array of a the total records match and matching list member data for this page (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:7,name:\"list-members\",qname:\"mailchimp:list-members\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $status as xs:string, $since as xs:string, $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Get all of the list members for a list that are of a particular status.\\n\",summary:\"<p> Get all of the list members for a list that are of a particular status.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"status\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the status to get members for - one of(subscribed, unsubscribed, <a target=\"_blank\" href=\"http://eepurl.com/dwk1\">cleaned</a>, updated), defaults to subscribed</div>'},{name:\"since\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional pull all members whose status (subscribed/unsubscribed/cleaned) has changed or whose profile (updated) has changed since this date/time (in GMT) - format is YYYY-MM-DD HH:mm:ss (24hr)</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the page number to start at - defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for large data sets, the number of results to return - defaults to 100, upper limit set at 15000</div>'}],returns:{type:\"item()*\",description:\"Array of a the total records match and matching list member data for this page (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-merge-var-add\",qname:\"mailchimp:list-merge-var-add\",signature:\"($apikey as xs:string, $id as xs:string, $tag as xs:string, $name as xs:string, $options as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-merge-var-add-6\">list-merge-var-add#6</a>.\\n',summary:\"<p> Convenience function for  list-merge-var-add#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to add, e.g. FNAME</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The long description of the tag being added, used for user displays</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a \"boolean\"</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-merge-var-add\",qname:\"mailchimp:list-merge-var-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $tag as xs:string, $name as xs:string, $options as element(array)) as item()*\",description:\" Add a new merge tag to a given list.\\n\",summary:\"<p> Add a new merge tag to a given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to add, e.g. FNAME</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The long description of the tag being added, used for user displays</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional Various options for this merge var. <em>note:</em> for historical purposes this can also take a \"boolean\"</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-merge-var-del\",qname:\"mailchimp:list-merge-var-del\",signature:\"($apikey as xs:string, $id as xs:string, $tag as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-merge-var-del-4\">list-merge-var-del#4</a>.\\n',summary:\"<p> Convenience function for  list-merge-var-del#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to delete</div>'}],returns:{type:\"item()*\",description:\"bool true if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-merge-var-del\",qname:\"mailchimp:list-merge-var-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $tag as xs:string) as item()*\",description:\" Delete a merge tag from a given list and all its members. Seriously - the data is removed from all members as well! Note that on large lists this method may seem a bit slower than calls you typically make.\\n\",summary:\"<p> Delete a merge tag from a given list and all its members.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to delete</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-merge-var-update\",qname:\"mailchimp:list-merge-var-update\",signature:\"($apikey as xs:string, $id as xs:string, $tag as xs:string, $options as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-merge-var-update-5\">list-merge-var-update#5</a>.\\n',summary:\"<p> Convenience function for  list-merge-var-update#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to update</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options to change for a merge var. See <a href=\"#list-merge-var-add-5\">list-merge-var-add()</a> for valid options</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-merge-var-update\",qname:\"mailchimp:list-merge-var-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $tag as xs:string, $options as element(array)) as item()*\",description:\" Update most parameters for a merge tag on a given list. You cannot currently change the merge type.\\n\",summary:\"<p> Update most parameters for a merge tag on a given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"tag\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The merge tag to update</div>'},{name:\"options\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options to change for a merge var. See <a href=\"#list-merge-var-add-5\">list-merge-var-add()</a> for valid options</div>'}],returns:{type:\"item()*\",description:\"True if the request succeeds, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-merge-vars\",qname:\"mailchimp:list-merge-vars\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-merge-vars-3\">list-merge-vars#3</a>.\\n',summary:\"<p> Convenience function for  list-merge-vars#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of merge tags for the list\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-merge-vars\",qname:\"mailchimp:list-merge-vars\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Get the list of merge tags for a given list, including their name, tag, and required setting.\\n\",summary:\"<p> Get the list of merge tags for a given list, including their name, tag, and required setting.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of merge tags for the list\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-static-segment-add\",qname:\"mailchimp:list-static-segment-add\",signature:\"($apikey as xs:string, $id as xs:string, $name as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-static-segment-add-4\">list-static-segment-add#4</a>.\\n',summary:\"<p> Convenience function for  list-static-segment-add#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error</div>'}],returns:{type:\"item()*\",description:\"The id of the new segment, otherwise an error will be thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-static-segment-add\",qname:\"mailchimp:list-static-segment-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $name as xs:string) as item()*\",description:' Save a segment against a list for later use. There is no limit to the number of segments which can be saved. Static Segments <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">are not</strong> tied to any merge data, interest groups, etc. They essentially allow you to configure an unlimited number of custom segments which will have standard performance. When using proper segments, Static Segments are one of the available options for segmentation just as if you used a merge var (and they can be used with other segmentation options), though performance may degrade at that point.\\n',summary:\"<p> Save a segment against a list for later use.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a unique name per list for the segment - 50 byte maximum length, anything longer will throw an error</div>'}],returns:{type:\"item()*\",description:\"The id of the new segment, otherwise an error will be thrown.\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-static-segment-del\",qname:\"mailchimp:list-static-segment-del\",signature:\"($apikey as xs:string, $id as xs:string, $seg_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#listStaticSegmentDel-4\">list-static-segment-del#4</a>.\\n',summary:\"<p> Convenience function for  list-static-segment-del#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to delete - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-static-segment-del\",qname:\"mailchimp:list-static-segment-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $seg_id as xs:integer) as item()*\",description:\" Delete a static segment. Note that this will, of course, remove any member affiliations with the segment.\\n\",summary:\"<p> Delete a static segment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to delete - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-static-segment-members-add\",qname:\"mailchimp:list-static-segment-members-add\",signature:\"($apikey as xs:string, $id as xs:string, $seg_id as xs:integer, $batch as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-static-segment-members-add-5\">list-static-segment-members-add#5</a>.\\n',summary:\"<p> Convenience function for  list-static-segment-members-add#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to modify - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email addresses and/or unique_ids to add to the segment</div>'}],returns:{type:\"item()*\",description:\"An array with the results of the operation\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-static-segment-members-add\",qname:\"mailchimp:list-static-segment-members-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $seg_id as xs:integer, $batch as element(array)) as item()*\",description:' Add list members to a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list in order to be included - this <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">will not</strong> subscribe them to the list!.\\n',summary:\"<p> Add list members to a static segment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to modify - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email addresses and/or unique_ids to add to the segment</div>'}],returns:{type:\"item()*\",description:\"array an array with the results of the operation\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-static-segment-members-del\",qname:\"mailchimp:list-static-segment-members-del\",signature:\"($apikey as xs:string, $id as xs:string, $seg_id as xs:integer, $batch as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-static-segment-members-del-5\">list-static-segment-members-del#5</a>.\\n',summary:\"<p> Convenience function for  list-static-segment-members-del#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to delete - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email addresses and/or unique_ids to remove from the segment</div>'}],returns:{type:\"item()*\",description:\"An array with the results of the operation\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-static-segment-members-del\",qname:\"mailchimp:list-static-segment-members-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $seg_id as xs:integer, $batch as element(array)) as item()*\",description:' Remove list members from a static segment. It is suggested that you limit batch size to no more than 10,000 addresses per call. Email addresses must exist on the list in order to be removed - this <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">will not</strong> unsubscribe them from the list!.\\n',summary:\"<p> Remove list members from a static segment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to delete - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'},{name:\"batch\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an array of email addresses and/or unique_ids to remove from the segment</div>'}],returns:{type:\"item()*\",description:\"An array with the results of the operation\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-static-segment-reset\",qname:\"mailchimp:list-static-segment-reset\",signature:\"($apikey as xs:string, $id as xs:string, $seg_id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-static-segment-reset-4\">list-static-segment-reset#4</a>.\\n',summary:\"<p> Convenience function for  list-static-segment-reset#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to reset - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-static-segment-reset\",qname:\"mailchimp:list-static-segment-reset\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $seg_id as xs:integer) as item()*\",description:' Resets a static segment - removes <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">all</strong> members from the static segment. Note: does not actually affect list member data.\\n',summary:\"<p> Resets a static segment - removes  all  members from the static segment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"seg_id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the static segment to reset - get from <a href=\"#list-static-segments-2\">list-static-segments()</a></div>'}],returns:{type:\"item()*\",description:\"True if it worked, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-static-segments\",qname:\"mailchimp:list-static-segments\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-static-segments-3\">list-static-segments#3</a>.\\n',summary:\"<p> Convenience function for  list-static-segments#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"An array of parameters for each static segment\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-static-segments\",qname:\"mailchimp:list-static-segments\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Retrieve all of the Static Segments for a list.\\n\",summary:\"<p> Retrieve all of the Static Segments for a list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"An array of parameters for each static segment\"},errors:[]},{isDocumented:!0,arity:10,name:\"list-subscribe\",qname:\"mailchimp:list-subscribe\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $email_address as xs:string, $merge_vars as element(array), $email_type as xs:string, $double_optin as xs:boolean, $update_existing as xs:boolean, $replace_interests as xs:boolean, $send_welcome as xs:boolean) as item()*\",description:\" Subscribe the provided email to a list.\\n\",summary:\"<p> Subscribe the provided email to a list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to subscribe</div>'},{name:\"merge_vars\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional merges for the email (FNAME, LNAME, etc.) (see examples below for handling \"blank\" arrays). Note that a merge field can only hold up to 255 bytes. Also, there are a few \"special\" keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/listsubscribe.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"email_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional email type preference for the email (html, text, or mobile defaults to html)</div>'},{name:\"double_optin\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to control whether a double opt-in confirmation message is sent, defaults to true. <em>Abusing this may cause your account to be suspended.</em></div>'},{name:\"update_existing\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to control whether a existing subscribers should be updated instead of throwing and error, defaults to false</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to determine whether we replace the interest groups with the groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'},{name:\"send_welcome\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional if your double_optin is false and this is true, we will send your lists Welcome Email if this subscribe succeeds - this will *not* fire if we end up updating an existing subscriber. If double_optin is true, this has no effect. defaults to false.</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:9,name:\"list-subscribe\",qname:\"mailchimp:list-subscribe\",signature:\"($apikey as xs:string, $id as xs:string, $email_address as xs:string, $merge_vars as element(array), $email_type as xs:string, $double_optin as xs:boolean, $update_existing as xs:boolean, $replace_interests as xs:boolean, $send_welcome as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-subscribe-10\">list-subscribe#10</a>.\\n',summary:\"<p> Convenience function for  list-subscribe#10 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to subscribe</div>'},{name:\"merge_vars\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional merges for the email (FNAME, LNAME, etc.) (see examples below for handling \"blank\" arrays). Note that a merge field can only hold up to 255 bytes. Also, there are a few \"special\" keys. See <a href=\"http://apidocs.mailchimp.com/rtfm/listsubscribe.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"email_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional email type preference for the email (html, text, or mobile defaults to html)</div>'},{name:\"double_optin\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to control whether a double opt-in confirmation message is sent, defaults to true. <em>Abusing this may cause your account to be suspended.</em></div>'},{name:\"update_existing\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to control whether a existing subscribers should be updated instead of throwing and error, defaults to false</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional flag to determine whether we replace the interest groups with the groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'},{name:\"send_welcome\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional if your double_optin is false and this is true, we will send your lists Welcome Email if this subscribe succeeds - this will *not* fire if we end up updating an existing subscriber. If double_optin is true, this has no effect. defaults to false.</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-unsubscribe\",qname:\"mailchimp:list-unsubscribe\",signature:\"($apikey as xs:string, $id as xs:string, $email_address as xs:string, $delete_member as xs:boolean, $send_goodbye as xs:boolean, $send_notify as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-unsubscribe-7\">list-unsubscribe#7</a>.\\n',summary:\"<p> Convenience function for  list-unsubscribe#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to unsubscribe OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'},{name:\"delete_member\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to completely delete the member from your list instead of just unsubscribing, default to false</div>'},{name:\"send_goodbye\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the goodbye email to the email address, defaults to true</div>'},{name:\"send_notify\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:7,name:\"list-unsubscribe\",qname:\"mailchimp:list-unsubscribe\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $email_address as xs:string, $delete_member as xs:boolean, $send_goodbye as xs:boolean, $send_notify as xs:boolean) as item()*\",description:\" Unsubscribe the given email address from the list.\\n\",summary:\"<p> Unsubscribe the given email address from the list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to unsubscribe OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'},{name:\"delete_member\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to completely delete the member from your list instead of just unsubscribing, default to false</div>'},{name:\"send_goodbye\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the goodbye email to the email address, defaults to true</div>'},{name:\"send_notify\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-update-member\",qname:\"mailchimp:list-update-member\",signature:\"($apikey as xs:string, $id as xs:string, $email_address as xs:string, $merge_vars as element(array), $email_type as xs:string, $replace_interests as xs:boolean) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-update-member-7\">list-update-member#7</a>.\\n',summary:\"<p> Convenience function for  list-update-member#7 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the current email address of the member to update OR the \"id\" for the member returned from listMemberInfo, Webhooks, and Campaigns</div>'},{name:\"merge_vars\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> array of new field values to update the member with. See merge_vars in <a href=\"#list-subscribe-10\">list-subscribe()</a> for details.</div>'},{name:\"email_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> change the email type preference for the member (\"html\", \"text\", or \"mobile\"). Leave blank to keep the existing preference (optional)</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:7,name:\"list-update-member\",qname:\"mailchimp:list-update-member\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $email_address as xs:string, $merge_vars as element(array), $email_type as xs:string, $replace_interests as xs:boolean) as item()*\",description:' Edit the email address, merge fields, and interest groups for a list member. If you are doing a batch update on lots of users, consider using <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-batch-subscribe-6\">#list-batch-subscribe()</a> with the update_existing and possible replace_interests parameter.\\n',summary:\"<p> Edit the email address, merge fields, and interest groups for a list member.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the current email address of the member to update OR the \"id\" for the member returned from listMemberInfo, Webhooks, and Campaigns</div>'},{name:\"merge_vars\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> array of new field values to update the member with. See merge_vars in <a href=\"#list-subscribe-10\">list-subscribe()</a> for details.</div>'},{name:\"email_type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> change the email type preference for the member (\"html\", \"text\", or \"mobile\"). Leave blank to keep the existing preference (optional)</div>'},{name:\"replace_interests\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member\\'s interest groups (optional, defaults to true)</div>'}],returns:{type:\"item()*\",description:\"True on success, false on failure.\"},errors:[]},{isDocumented:!0,arity:5,name:\"list-webhook-add\",qname:\"mailchimp:list-webhook-add\",signature:\"($apikey as xs:string, $id as xs:string, $url as xs:string, $actions as element(array), $sources as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-webhook-add-6\">list-webhook-add#6</a>.\\n',summary:\"<p> Convenience function for  list-webhook-add#6 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.</div>'},{name:\"actions\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional a hash of actions to fire this Webhook for</div>'},{name:\"sources\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional a hash of sources to fire this Webhook for</div>'}],returns:{type:\"item()*\",description:\"True if the call succeeds, otherwise an exception will be thrown\"},errors:[]},{isDocumented:!0,arity:6,name:\"list-webhook-add\",qname:\"mailchimp:list-webhook-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $url as xs:string, $actions as element(array), $sources as element(array)) as item()*\",description:\" Add a new Webhook URL for the given list.\\n\",summary:\"<p> Add a new Webhook URL for the given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid URL for the Webhook - it will be validated. note that a url may only exist on a list once.</div>'},{name:\"actions\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional a hash of actions to fire this Webhook for</div>'},{name:\"sources\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional a hash of sources to fire this Webhook for</div>'}],returns:{type:\"item()*\",description:\"True if the call succeeds, otherwise an exception will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-webhook-del\",qname:\"mailchimp:list-webhook-del\",signature:\"($apikey as xs:string, $id as xs:string, $url as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-webhook-del-4\">list-webhook-del#4</a>.\\n',summary:\"<p> Convenience function for  list-webhook-del#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL of a Webhook on this list</div>'}],returns:{type:\"item()*\",description:\"True if the call succeeds, otherwise an exception will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"list-webhook-del\",qname:\"mailchimp:list-webhook-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string, $url as xs:string) as item()*\",description:\" Delete an existing Webhook URL from a given list.\\n\",summary:\"<p> Delete an existing Webhook URL from a given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'},{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL of a Webhook on this list</div>'}],returns:{type:\"item()*\",description:\"True if the call succeeds, otherwise an exception will be thrown\"},errors:[]},{isDocumented:!0,arity:2,name:\"list-webhooks\",qname:\"mailchimp:list-webhooks\",signature:\"($apikey as xs:string, $id as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#list-webhooks-3\">list-webhooks#3</a>.\\n',summary:\"<p> Convenience function for  list-webhooks#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of webhooks\"},errors:[]},{isDocumented:!0,arity:3,name:\"list-webhooks\",qname:\"mailchimp:list-webhooks\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:string) as item()*\",description:\" Return the Webhooks configured for the given list.\\n\",summary:\"<p> Return the Webhooks configured for the given list.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list id to connect to. Get by calling <a href=\"#lists-4\">lists()</a></div>'}],returns:{type:\"item()*\",description:\"List of webhooks\"},errors:[]},{isDocumented:!0,arity:2,name:\"lists-for-email\",qname:\"mailchimp:lists-for-email\",signature:\"($apikey as xs:string, $email_address as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#lists-for-email-3\">lists-for-email#3</a>.\\n',summary:\"<p> Convenience function for  lists-for-email#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to check OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'}],returns:{type:\"item()*\",description:\"An array of list_ids the member is subscribed to.\"},errors:[]},{isDocumented:!0,arity:3,name:\"lists-for-email\",qname:\"mailchimp:lists-for-email\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $email_address as xs:string) as item()*\",description:\" Retrieve all List Ids a member is subscribed to.\\n\",summary:\"<p> Retrieve all List Ids a member is subscribed to.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"email_address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the email address to check OR the email \"id\" returned from listMemberInfo, Webhooks, and Campaigns</div>'}],returns:{type:\"item()*\",description:\"An array of list_ids the member is subscribed to.\"},errors:[]},{isDocumented:!0,arity:4,name:\"lists\",qname:\"mailchimp:lists\",signature:\"($apikey as xs:string, $filters as element(array), $start as xs:integer, $limit as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#lists-5\">lists#5</a>.\\n',summary:\"<p> Convenience function for  lists#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"filters\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of filters to apply to this query - all are optional. See <a href=\"http://apidocs.mailchimp.com/rtfm/lists.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)</div>'}],returns:{type:\"item()*\",description:\"Array with keys listed in Returned Fields below\"},errors:[]},{isDocumented:!0,arity:5,name:\"lists\",qname:\"mailchimp:lists\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $filters as element(array), $start as xs:integer, $limit as xs:integer) as item()*\",description:\" Retrieve all of the lists defined for your user account.\\n\",summary:\"<p> Retrieve all of the lists defined for your user account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"filters\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hash of filters to apply to this query - all are optional. See <a href=\"http://apidocs.mailchimp.com/rtfm/lists.func.php\">Mailchimp API documentation</a> for more information about the parameter structure.</div>'},{name:\"start\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of lists, start results at this list #, defaults to 1st page of data (page 0)</div>'},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional - control paging of lists, number of lists to return with each call, defaults to 25 (max=100)</div>'}],returns:{type:\"item()*\",description:\"Array with keys listed in Returned Fields below\"},errors:[]},{isDocumented:!0,arity:1,name:\"ping\",qname:\"mailchimp:ping\",signature:\"($apikey as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#ping-2\">ping#2</a>.\\n',summary:\"<p> Convenience function for  ping#2 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:'Returns \"Everything\\'s Chimpy!\" if everything is chimpy, otherwise returns an error message'},errors:[]},{isDocumented:!0,arity:2,name:\"ping\",qname:\"mailchimp:ping\",signature:\"($endpoint-url as xs:string, $apikey as xs:string) as item()*\",description:' \"Ping\" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good. Note than unlike most all of our methods, we don\\'t throw an Exception if we are having issues. You will simply receive a different string back that will explain our view on what is going on.\\n',summary:'<p> \"Ping\" the MailChimp API - a simple method you can call that will return a constant value as long as everything is good.</p>',annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'}],returns:{type:\"item()*\",description:'Returns \"Everything\\'s Chimpy!\" if everything is chimpy, otherwise returns an error message'},errors:[]},{isDocumented:!0,arity:3,name:\"template-add\",qname:\"mailchimp:template-add\",signature:\"($apikey as xs:string, $name as xs:string, $html as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#template-add-4\">template-add#4</a>.\\n',summary:\"<p> Convenience function for  template-add#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name for the template - names must be unique and a max of 50 bytes</div>'},{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href=\"http://www.mailchimp.com/resources/email-template-language/\" target=\"_blank\">template language</a>.</div>'}],returns:{type:\"item()*\",description:\"The new template id, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:4,name:\"template-add\",qname:\"mailchimp:template-add\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $name as xs:string, $html as xs:string) as item()*\",description:' Create a new user template, <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT</strong> campaign content. These templates can then be applied while creating campaigns.\\n',summary:\"<p> Create a new user template,  NOT  campaign content.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name for the template - names must be unique and a max of 50 bytes</div>'},{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a string specifying the entire template to be created. This is <strong>NOT</strong> campaign content. They are intended to utilize our <a href=\"http://www.mailchimp.com/resources/email-template-language/\" target=\"_blank\">template language</a>.</div>'}],returns:{type:\"item()*\",description:\"The new template id, otherwise an error is thrown.\"},errors:[]},{isDocumented:!0,arity:2,name:\"template-del\",qname:\"mailchimp:template-del\",signature:\"($apikey as xs:string, $id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#template-del-3\">template-del#3</a>.\\n',summary:\"<p> Convenience function for  template-del#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to delete</div>'}],returns:{type:\"item()*\",description:\"True if the template was deleted, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"template-del\",qname:\"mailchimp:template-del\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:integer) as item()*\",description:\" Delete (deactivate) a user template.\\n\",summary:\"<p> Delete (deactivate) a user template.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to delete</div>'}],returns:{type:\"item()*\",description:\"True if the template was deleted, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"template-info\",qname:\"mailchimp:template-info\",signature:\"($apikey as xs:string, $tid as xs:integer, $type as xs:string) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#template-info-4\">template-info#4</a>.\\n',summary:\"<p> Convenience function for  template-info#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"tid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the template id - get from templates()</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> the template type to load - one of 'user', 'gallery', 'base'</div>\"}],returns:{type:\"item()*\",description:\"An array of info to be used when editing\"},errors:[]},{isDocumented:!0,arity:4,name:\"template-info\",qname:\"mailchimp:template-info\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $tid as xs:integer, $type as xs:string) as item()*\",description:\" Pull details for a specific template to help support editing.\\n\",summary:\"<p> Pull details for a specific template to help support editing.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"tid\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the template id - get from templates()</div>'},{name:\"type\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> the template type to load - one of 'user', 'gallery', 'base'</div>\"}],returns:{type:\"item()*\",description:\"An array of info to be used when editing\"},errors:[]},{isDocumented:!0,arity:2,name:\"template-undel\",qname:\"mailchimp:template-undel\",signature:\"($apikey as xs:string, $id as xs:integer) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#template-undel-3\">template-undel#3</a>.\\n',summary:\"<p> Convenience function for  template-undel#3 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to reactivate</div>'}],returns:{type:\"item()*\",description:\"boolean true if the template was deleted, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"template-undel\",qname:\"mailchimp:template-undel\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:integer) as item()*\",description:\" Undelete (reactivate) a user template.\\n\",summary:\"<p> Undelete (reactivate) a user template.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to reactivate</div>'}],returns:{type:\"item()*\",description:\"boolean true if the template was deleted, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:3,name:\"template-update\",qname:\"mailchimp:template-update\",signature:\"($apikey as xs:string, $id as xs:integer, $values as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#template-update-4\">template-update#4</a>.\\n',summary:\"<p> Convenience function for  template-update#4 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to update</div>'},{name:\"values\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> s the values to updates - while both are optional, at least one should be provided. Both can be updated at the same time.</div>'}],returns:{type:\"item()*\",description:\"True if the template was updated, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"template-update\",qname:\"mailchimp:template-update\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $id as xs:integer, $values as element(array)) as item()*\",description:' Replace the content of a user template, <strong xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT</strong> campaign content.\\n',summary:\"<p> Replace the content of a user template,  NOT  campaign content.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"id\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the user template to update</div>'},{name:\"values\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> s the values to updates - while both are optional, at least one should be provided. Both can be updated at the same time.</div>'}],returns:{type:\"item()*\",description:\"True if the template was updated, otherwise an error will be thrown\"},errors:[]},{isDocumented:!0,arity:4,name:\"templates\",qname:\"mailchimp:templates\",signature:\"($apikey as xs:string, $types as element(array), $category as xs:string, $inactives as element(array)) as item()*\",description:' Convenience function for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#templates-5\">templates#5</a>.\\n',summary:\"<p> Convenience function for  templates#5 .</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"apikey\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"types\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the types of templates to return</div>'},{name:\"category\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for Gallery templates only, limit to a specific template category</div>'},{name:\"inactives\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional options to control how inactive templates are returned, if at all</div>'}],returns:{type:\"item()*\",description:\"An array of structs, one for each template (see Returned Fields for details)\"},errors:[]},{isDocumented:!0,arity:5,name:\"templates\",qname:\"mailchimp:templates\",signature:\"($endpoint-url as xs:string, $apikey as xs:string, $types as element(array), $category as xs:string, $inactives as element(array)) as item()*\",description:' Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created. boolean user Customer template for this user account. Defaults to true. boolean gallery Templates from our Gallery. Note that some templates that require extra configuration are withheld. (eg, the Etsy template). Defaults to false. boolean base Our \"start from scratch\" extremely basic templates boolean include user templates are not deleted, only set inactive. defaults to false. boolean only only include inactive templates. defaults to false.\\n',summary:\"<p> Retrieve various templates available in the system, allowing some thing similar to our template gallery to be created.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Mailchimp endpoint URL, e.g. http://us1.api.mailchimp.com/1.3/</div>'},{name:\"apikey\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a valid API Key for your user account. Get by visiting <a href=\"http://admin.mailchimp.com/account/api\" target=\"_blank\">your API dashboard</a></div>'},{name:\"types\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional the types of templates to return</div>'},{name:\"category\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional for Gallery templates only, limit to a specific template category</div>'},{name:\"inactives\",type:\"element(array)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> optional options to control how inactive templates are returned, if at all</div>'}],returns:{type:\"item()*\",description:\"An array of structs, one for each template (see Returned Fields for details)\"},errors:[]}],variables:[{name:\"mailchimp:gateway\",type:\"item()*\",description:\" Mailchimp gateway where the client data is stored.\\n\"},{name:\"mailchimp:version\",type:\"item()*\",description:\" Mailchimp API version.\\n\"},{name:\"mailchimp:endpoint\",type:\"item()*\",description:\" Endpoint URL for the XML-RPC requests.\\n\"}]},\"http://www.zorba-xquery.com/modules/couchbase\":{ns:\"http://www.zorba-xquery.com/modules/couchbase\",description:\" This module provides minimal functionality to interact with the\\n Couchbase NoSQL database.\\n The module is built using the libcouchbase C client library and\\n exposes most of its functionality in XQuery with JSONiq extensions.\\n Beyond just allowing for basic key-value store operations (e.g.\\n put-/get-text or put-/get-binary, this module also allows to work\\n with Couchbase views in order to allow for complex JSON query\\n operations.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Juan Zacarias</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/couchbase\",prefix:\"cb\"},{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"connect\",qname:\"cb:connect\",signature:\"($options as object()) as xs:anyURI external\",description:\" Connect to the Couchbase server and return an opaque identifier\\n representing the established connection.\\n\",summary:\"<p> Connect to the Couchbase server and return an opaque identifier\\n representing the established connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a JSONiq object that contains the host, bucket, and user information.</div>'}],returns:{type:\"xs:anyURI\",description:'an identifier for the established connection. Example: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> { \"host\": \"localhost:8091\", \"username\" : null, \"password\" : null, \"bucket\" : \"default\" } </code>'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0001 if the connection to the given host/bucket could not be established.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0001 if mandatory connection information is missing.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if a given option is not supported.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"connect\",qname:\"cb:connect\",signature:\"($host as xs:string, $username as xs:string?, $password as xs:string?, $bucket as xs:string) as xs:anyURI\",description:\" Connect to the Couchbase server and return an opaque identifier\\n representing the established connection.\\n\",summary:\"<p> Connect to the Couchbase server and return an opaque identifier\\n representing the established connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> address of the couchbase server (e.g. \"localhost:8091\")</div>'},{name:\"username\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> username used for the connection</div>'},{name:\"password\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> password used for the connection</div>'},{name:\"bucket\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> name of the bucket to use (e.g. \"default\")</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for the established connection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0001 if the connection to the given host/bucket could not be established.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create-view\",qname:\"cb:create-view\",signature:\"($db as xs:anyURI, $doc-name as xs:string, $view-names as xs:string*) as xs:string* external\",description:\" Create a document/view.\\n If the document already exists, it is replaced. A document can hold several\\n views that must be specified in the same call of cb:create-view.\\n\",summary:\"<p> Create a document/view.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"doc-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> name of the document to create.</div>'},{name:\"view-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> names of the views to create in the document.</div>'}],returns:{type:\"xs:string*\",description:\"the names of the paths for the views that have been created.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"create-view\",qname:\"cb:create-view\",signature:\"($db as xs:anyURI, $doc-name as xs:string, $view-names as xs:string*, $options as object()*) as xs:string* external\",description:\" Create a document/view.\\n If the document already exists, it is replaced. A document can hold several\\n views that must be specified in the same call of cb:create-view.\\n\",summary:\"<p> Create a document/view.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"doc-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> name of the document to create.</div>'},{name:\"view-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> names of the views to create in the document.</div>'},{name:\"options\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> options describing how to create the view.</div>'}],returns:{type:\"xs:string*\",description:\"the names of the paths for the views that have been created.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0005 if the number of options doesn\\'t match the number of view-names.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0010 if any of the given options has an invalid type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-view\",qname:\"cb:delete-view\",signature:\"($db as xs:anyURI, $doc as xs:string*) as xs:string* external\",description:\" Delete a document/view.\\n If the document doesn't exists, function does nothing. All the views hold in the\\n Document are deleted, this function can't delete single views.\\n\",summary:\"<p> Delete a document/view.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"doc\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">-name name of the document to create.</div>'}],returns:{type:\"xs:string*\",description:\"empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"flush\",qname:\"cb:flush\",signature:\"($db as xs:anyURI) as empty-sequence() external\",description:\" Remove all key/value pairs from the cluster\\n\",summary:\"<p> Remove all key/value pairs from the cluster\\n</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get-binary\",qname:\"cb:get-binary\",signature:\"($db as xs:anyURI, $key as xs:string*) as xs:base64Binary* external\",description:\" Return the values of the given keys (type xs:string) as base64Binary.\\n\",summary:\"<p> Return the values of the given keys (type xs:string) as base64Binary.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the requested keys</div>'}],returns:{type:\"xs:base64Binary*\",description:\"a sequence of xs:base64Binary items for the given keys.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"get-binary\",qname:\"cb:get-binary\",signature:\"($db as xs:anyURI, $key as xs:string*, $options as object()) as xs:base64Binary* external\",description:\" Return the values of the given keys (type xs:string) as base64Binary.\\n\",summary:\"<p> Return the values of the given keys (type xs:string) as base64Binary.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the requested keys</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> JSONiq object with additional options</div>'}],returns:{type:\"xs:base64Binary*\",description:\"a sequence of xs:base64Binary items for the given keys.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0009 if the given expiration time is not an xs:integer.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get-text\",qname:\"cb:get-text\",signature:\"($db as xs:anyURI, $key as xs:string*) as xs:string* external\",description:\" Return the values of the given keys (type xs:string) as string.\\n\",summary:\"<p> Return the values of the given keys (type xs:string) as string.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the requested keys</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of string Items corresponding to the key\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"get-text\",qname:\"cb:get-text\",signature:\"($db as xs:anyURI, $key as xs:string*, $options as object()) as xs:string* external\",description:\" Return the values of the given keys (type xs:string) as string.\\n\",summary:\"<p> Return the values of the given keys (type xs:string) as string.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the requested keys</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> JSONiq object with additional options</div>'}],returns:{type:\"xs:string*\",description:\"a sequence of strings for the given keys.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0006 if the given encoding is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0009 if the given expiration time is not an xs:integer.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put-binary\",qname:\"cb:put-binary\",signature:\"($db as xs:anyURI, $key as xs:string*, $value as xs:base64Binary*) as empty-sequence()\",description:\" Store the given key-value bindings.\\n\",summary:\"<p> Store the given key-value bindings.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys to store</div>'},{name:\"value\",type:\"xs:base64Binary\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values (as xs:base64binary) to be stored.</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"put-binary\",qname:\"cb:put-binary\",signature:\"($db as xs:anyURI, $key as xs:string*, $value as xs:base64Binary*, $options as object()) as empty-sequence() external\",description:\" Store the given key-value bindings.\\n\",summary:\"<p> Store the given key-value bindings.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys to store</div>'},{name:\"value\",type:\"xs:base64Binary\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values (as xs:base64binary) to be stored.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> JSONiq object with additional options</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0009 if the given expiration time is not an xs:integer.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0011 if the stored Variable was not stored</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put-text\",qname:\"cb:put-text\",signature:\"($db as xs:anyURI, $key as xs:string*, $value as xs:string*) as empty-sequence()\",description:\" Store the given key-value bindings.\\n The values are stored with the UTF-8 encoding and a default\\n expiration time of 60 seconds.\\n\",summary:\"<p> Store the given key-value bindings.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys to store</div>'},{name:\"value\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values (as xs:string) to be stored.</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"put-text\",qname:\"cb:put-text\",signature:\"($db as xs:anyURI, $key as xs:string*, $value as xs:string*, $options as object()) as empty-sequence() external\",description:\" Store the given key-value bindings.\\n\",summary:\"<p> Store the given key-value bindings.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys to store</div>'},{name:\"value\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values (as xs:string) to be stored.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> JSONiq object with additional options</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0005 if the number of keys doesn\\'t match the number of values.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0006 if the given encoding is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0009 if the given expiration time is not an xs:integer.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0011 if the stored Variable was not stored</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"remove\",qname:\"cb:remove\",signature:\"($db as xs:anyURI, $key as xs:string*) as empty-sequence() external\",description:\" Remove the values matching the given keys (xs:string) from the server.\\n\",summary:\"<p> Remove the values matching the given keys (xs:string) from the server.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys of the values that should be removed.</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"touch\",qname:\"cb:touch\",signature:\"($db as xs:anyURI, $key as xs:string*, $exp-time as xs:integer) as empty-sequence() external\",description:\" Refresh the expiration time of the given keys.\\n\",summary:\"<p> Refresh the expiration time of the given keys.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"key\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the keys to touch</div>'},{name:\"exp-time\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> new expieration time in seconds</div>'}],returns:{type:\"empty-sequence()\",description:\"a empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"view\",qname:\"cb:view\",signature:\"($db as xs:anyURI, $path as xs:string*) as object()*\",description:\" Retrieve the content of existing views.\\n\",summary:\"<p> Retrieve the content of existing views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"path\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> contains the string of a view path (e.g. \"_design/test/_view/vies\").</div>'}],returns:{type:\"object()*\",description:\"a sequence of strings (as JSON) containing information of the views.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"view\",qname:\"cb:view\",signature:\"($db as xs:anyURI, $path as xs:string*, $options as object()) as object()*\",description:\" Retrieve the content of existing views.\\n\",summary:\"<p> Retrieve the content of existing views.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"db\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> connection reference</div>'},{name:\"path\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> contains the string of a view path (e.g. \"_design/test/_view/vies\").</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> JSONiq object with additional options</div>'}],returns:{type:\"object()*\",description:\"a sequence of strings (as JSON) containing information of the views.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:LCB0002 if any error occurs in the communication with the server.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cb:CB0007 if any of the options is not supported.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/excel/text\":{ns:\"http://zorba.io/modules/excel/text\",description:\" This is a library module offering the same set of functions\\n defined by Microsoft Excel, under Text and Data Functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528321033.aspx\" target=\"_blank\">Excel Documentation: Text Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/modules/excel/text\",prefix:\"excel-text\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"asc\",qname:\"excel-text:asc\",signature:\"($text as xs:string) as xs:string\",description:\" Returns the given $text unchanged.\\n\",summary:\"<p> Returns the given $text unchanged.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time</div>'}],returns:{type:\"xs:string\",description:\"The given $text unchanged.\"},errors:[]},{isDocumented:!0,arity:1,name:\"char\",qname:\"excel-text:char\",signature:\"($number as xs:integer) as xs:string\",description:\" Returns the character specified by a certain codepoint.\\n\",summary:\"<p> Returns the character specified by a certain codepoint.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the codepoint.</div>'}],returns:{type:\"xs:string\",description:\"the character specified by a certain codepoint.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value provided $number must be in range [1,255].</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"clean\",qname:\"excel-text:clean\",signature:\"($arg as xs:string?) as xs:string?\",description:\" Removes all nonprintable characters from text.\\n\",summary:\"<p> Removes all nonprintable characters from text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string.</div>'}],returns:{type:\"xs:string?\",description:'Removes all nonprintable characters from text. The CLEAN function was designed. to remove the first 32 nonprinting characters in the 7-bit ASCII code (values 0 through 31) from text. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> In the Unicode character set, there are additional nonprinting characters (values 127, 129, 141, 143, 144, and 157). <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> By itself, the CLEAN function does not remove these additional nonprinting characters.'},errors:[]},{isDocumented:!0,arity:1,name:\"code\",qname:\"excel-text:code\",signature:\"($arg as xs:string) as xs:integer\",description:\" Returns a codepoint for the first character in a text string.\\n\",summary:\"<p> Returns a codepoint for the first character in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string.</div>'}],returns:{type:\"xs:integer\",description:\"A codepoint for the first character in a text string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value Provided $arg was empty.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"concatenate\",qname:\"excel-text:concatenate\",signature:\"($args as xs:anyAtomicType*) as xs:string\",description:\" Joins several text strings into one text string.\\n\",summary:\"<p> Joins several text strings into one text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"args\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of strings.</div>'}],returns:{type:\"xs:string\",description:\"Joins several text strings into one text string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"concatenate\",qname:\"excel-text:concatenate\",signature:\"($arg1 as xs:anyAtomicType?, $arg2 as xs:anyAtomicType?) as xs:string\",description:\" Joins two text strings into one text string.\\n\",summary:\"<p> Joins two text strings into one text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first string.</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second string.</div>'}],returns:{type:\"xs:string\",description:\"Joins two text strings into one text string.\"},errors:[]},{isDocumented:!0,arity:1,name:\"dollar\",qname:\"excel-text:dollar\",signature:\"($number as xs:decimal) as xs:string\",description:\" Converts a number to text format and applies a currency symbol. The number of\\ndigits to the right of the decimal point is 2.\\n\",summary:\"<p> Converts a number to text format and applies a currency symbol.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number.</div>'}],returns:{type:\"xs:string\",description:\"Converts a number to text format and applies a currency symbol. The number of digits to the right of the decimal point is 2.\"},errors:[]},{isDocumented:!0,arity:2,name:\"dollar\",qname:\"excel-text:dollar\",signature:\"($number as xs:decimal, $decimals as xs:decimal) as xs:string\",description:\" Converts a number to text format and applies a currency symbol.\\n\",summary:\"<p> Converts a number to text format and applies a currency symbol.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number.</div>'},{name:\"decimals\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of digits to the right of the decimal point. <p/> If decimals is negative, number is rounded to the left of the decimal point.</div>'}],returns:{type:\"xs:string\",description:\"Converts a number to text format and applies a currency symbol.\"},errors:[]},{isDocumented:!0,arity:2,name:\"exact\",qname:\"excel-text:exact\",signature:\"($arg1 as xs:string, $arg2 as xs:string) as xs:boolean\",description:\" Compares two text strings and returns TRUE if they are exactly the same,\\nFALSE otherwise. EXACT is case-sensitive but ignores formatting differences.\\n\",summary:\"<p> Compares two text strings and returns TRUE if they are exactly the same,\\nFALSE otherwise.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first string.</div>'},{name:\"arg2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second string.</div>'}],returns:{type:\"xs:boolean\",description:\"Compares two text strings and returns TRUE if they are exactly the same, FALSE otherwise. EXACT is case-sensitive but ignores formatting differences.\"},errors:[]},{isDocumented:!0,arity:2,name:\"find\",qname:\"excel-text:find\",signature:\"($find_text as xs:string, $within_text as xs:string) as xs:integer?\",description:' Locate one text string within a second text string, and return the number of the\\n starting position of the first text string from the first character of the second text string. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The search is case sensitive.\\n',summary:\"<p> Locate one text string within a second text string, and return the number of the\\n starting position of the first text string from the first character of the second text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"find_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to find.</div>'},{name:\"within_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text in which you want to search for $find_text.</div>'}],returns:{type:\"xs:integer?\",description:'Locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search is case sensitive.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value the value is not greater than zero or is greater than the length of within_text.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value value was not found.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"find\",qname:\"excel-text:find\",signature:\"($find_text as xs:string, $within_text as xs:string, $start_num as xs:integer) as xs:integer?\",description:' Locate one text string within a second text string, and return the number of the\\n starting position of the first text string from the first character of the second text string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The search is case sensitive.\\n',summary:\"<p> Locate one text string within a second text string, and return the number of the\\n starting position of the first text string from the first character of the second text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"find_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to find.</div>'},{name:\"within_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text in which you want to search for $find_text.</div>'},{name:\"start_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> specifies the character at which to start the search.</div>'}],returns:{type:\"xs:integer?\",description:'Locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search is case sensitive.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value the value is not greater than zero or is greater than the length of within_text.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value value was not found.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"fixed\",qname:\"excel-text:fixed\",signature:\"($number as xs:decimal, $decimals as xs:decimal) as xs:string\",description:\" Rounds a number to the specified number of decimals, formats the number in\\n decimal format using a period and commas, and returns the result as text.\\n\",summary:\"<p> Rounds a number to the specified number of decimals, formats the number in\\n decimal format using a period and commas, and returns the result as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number you want to round and convert to text.</div>'},{name:\"decimals\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of digits to the right of the decimal point.</div>'}],returns:{type:\"xs:string\",description:\"Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.\"},errors:[]},{isDocumented:!0,arity:3,name:\"fixed\",qname:\"excel-text:fixed\",signature:\"($number as xs:decimal, $decimals as xs:decimal, $no_commas as xs:boolean) as xs:string\",description:\" Rounds a number to the specified number of decimals, formats the number in\\ndecimal format using a period and commas, and returns the result as text.\\n\",summary:\"<p> Rounds a number to the specified number of decimals, formats the number in\\ndecimal format using a period and commas, and returns the result as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"number\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number you want to round and convert to text.</div>'},{name:\"decimals\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of digits to the right of the decimal point.</div>'},{name:\"no_commas\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is a logical value that, if TRUE, prevents FIXED from including commas in the returned text.</div>'}],returns:{type:\"xs:string\",description:\"Rounds a number to the specified number of decimals, formats the number in decimal format using a period and commas, and returns the result as text.\"},errors:[]},{isDocumented:!0,arity:1,name:\"left\",qname:\"excel-text:left\",signature:\"($arg as xs:string) as xs:string\",description:\" Returns the first character in a text string.\\n\",summary:\"<p> Returns the first character in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the text string that contains the characters you want to extract.</div>'}],returns:{type:\"xs:string\",description:\"The first character in a text string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"left\",qname:\"excel-text:left\",signature:\"($text as xs:string, $num_chars as xs:integer) as xs:string\",description:\" Returns the first character or characters in $text, based on the number of $num_chars you specify.\\n\",summary:\"<p> Returns the first character or characters in $text, based on the number of $num_chars you specify.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the text string that contains the characters you want to extract.</div>'},{name:\"num_chars\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> specifies the number of characters you want to extract.</div>'}],returns:{type:\"xs:string\",description:\"The first character or characters in $text, based on the number of $num_chars you specify.\"},errors:[]},{isDocumented:!0,arity:1,name:\"len\",qname:\"excel-text:len\",signature:\"($arg as xs:string?) as xs:integer\",description:\" Returns the number of characters in a text string.\\n\",summary:\"<p> Returns the number of characters in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string.</div>'}],returns:{type:\"xs:integer\",description:\"The number of characters in a text string.\"},errors:[]},{isDocumented:!0,arity:1,name:\"lower\",qname:\"excel-text:lower\",signature:\"($arg as xs:string?) as xs:string?\",description:\" Converts all uppercase letters in a text string to lowercase.\\n\",summary:\"<p> Converts all uppercase letters in a text string to lowercase.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string.</div>'}],returns:{type:\"xs:string?\",description:\"Converts all uppercase letters in a text string to lowercase.\"},errors:[]},{isDocumented:!0,arity:3,name:\"mid\",qname:\"excel-text:mid\",signature:\"($text as xs:string?, $start_num as xs:integer, $num_chars as xs:integer) as xs:string?\",description:\" Returns a specific number of characters from a text string, starting at\\nthe position you specify, based on the number of characters you specify.\\n\",summary:\"<p> Returns a specific number of characters from a text string, starting at\\nthe position you specify, based on the number of characters you specify.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text string containing the characters you want to extract.</div>'},{name:\"start_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position of the first character you want to extract in text. The first character in text has start_num 1, and so on.</div>'},{name:\"num_chars\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of characters you want to return from text.</div>'}],returns:{type:\"xs:string?\",description:\"A specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.\"},errors:[]},{isDocumented:!0,arity:3,name:\"pad-integer-to-length\",qname:\"excel-text:pad-integer-to-length\",signature:\"($toPad as xs:anyAtomicType?, $padChar as xs:string, $length as xs:integer) as xs:string\",description:\" Returns $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string.\\n\",summary:\"<p> Returns $toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"toPad\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be padded.</div>'},{name:\"padChar\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the character used for padding.</div>'},{name:\"length\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired length.</div>'}],returns:{type:\"xs:string\",description:\"$toPad appended with enough repetitions of $padChar to make its length $length, the characters are added before the string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the length of the $toPad is greater than the desired length.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"replace\",qname:\"excel-text:replace\",signature:\"($old_text as xs:string?, $start_num as xs:integer, $num_chars as xs:integer, $new_text as xs:string) as xs:string\",description:\" Replaces part of a text string, based on the number of characters you specify, with a different text string.\\n\",summary:\"<p> Replaces part of a text string, based on the number of characters you specify, with a different text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"old_text\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is text in which you want to replace some characters.</div>'},{name:\"start_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position of the character in old_text that you want to replace with new_text.</div>'},{name:\"num_chars\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of characters in old_text that you want REPLACE to replace with new_text.</div>'},{name:\"new_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text that will replace characters in old_text.</div>'}],returns:{type:\"xs:string\",description:\"Replaces part of a text string, based on the number of characters you specify, with a different text string.\"},errors:[]},{isDocumented:!0,arity:1,name:\"right\",qname:\"excel-text:right\",signature:\"($arg as xs:string) as xs:string\",description:\" Returns the last character in a text string.\\n\",summary:\"<p> Returns the last character in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text string containing the characters you want to extract.</div>'}],returns:{type:\"xs:string\",description:\"The last character in a text string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"right\",qname:\"excel-text:right\",signature:\"($text as xs:string, $num_chars as xs:integer) as xs:string\",description:\" Returns the last character or characters in a text string, based on the number of characters you specify.\\n\",summary:\"<p> Returns the last character or characters in a text string, based on the number of characters you specify.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text string containing the characters you want to extract.</div>'},{name:\"num_chars\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> specifies the number of characters you want RIGHT to extract.</div>'}],returns:{type:\"xs:string\",description:\"The last character or characters in a text string, based on the number of characters you specify.\"},errors:[]},{isDocumented:!0,arity:2,name:\"search\",qname:\"excel-text:search\",signature:\"($find_text as xs:string, $within_text as xs:string) as xs:integer?\",description:' Locate one text string within a second text string, and return the number of\\n the starting position of the first text string from the first character of the\\n second text string. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search starts at position 1, and it is not case sensitive.\\n',summary:\"<p> Locate one text string within a second text string, and return the number of\\n the starting position of the first text string from the first character of the\\n second text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"find_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to find.</div>'},{name:\"within_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text in which you want to search for $find_text.</div>'}],returns:{type:\"xs:integer?\",description:'Locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search starts at position 1, and it is not case sensitive.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value the value is not greater than zero or is greater than the length of within_text.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value value was not found.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"search\",qname:\"excel-text:search\",signature:\"($find_text as xs:string, $within_text as xs:string, $start_num as xs:integer) as xs:integer?\",description:' Locate one text string within a second text string, and return the number of\\n the starting position of the first text string from the first character of the\\n second text string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search starts at $start_num, and it is not case sensitive.\\n',summary:\"<p> Locate one text string within a second text string, and return the number of\\n the starting position of the first text string from the first character of the\\n second text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"find_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to find.</div>'},{name:\"within_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text in which you want to search for $find_text.</div>'},{name:\"start_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the character number in within_text at which you want to start searching.</div>'}],returns:{type:\"xs:integer?\",description:'Locate one text string within a second text string, and return the number of the starting position of the first text string from the first character of the second text string.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The search starts at $start_num, and it is not case sensitive.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value the value is not greater than zero or is greater than the length of within_text.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value value was not found.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"substitute\",qname:\"excel-text:substitute\",signature:\"($text as xs:string, $old_text as xs:string, $new_text as xs:string) as xs:string?\",description:\" Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text.\\n\",summary:\"<p> Substitutes new_text for old_text in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text or the reference to a cell containing text for which you want to substitute characters.</div>'},{name:\"old_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to replace.</div>'},{name:\"new_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to replace old_text with.</div>'}],returns:{type:\"xs:string?\",description:\"Substitutes new_text for old_text in a text string. Every occurrence of old_text in text is changed to new_text.\"},errors:[]},{isDocumented:!0,arity:4,name:\"substitute\",qname:\"excel-text:substitute\",signature:\"($text as xs:string, $old_text as xs:string, $new_text as xs:string, $instance_num as xs:integer?) as xs:string\",description:\" Substitutes new_text for old_text in a text string.\\n\",summary:\"<p> Substitutes new_text for old_text in a text string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the text or the reference to a cell containing text for which you want to substitute characters.</div>'},{name:\"old_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to replace.</div>'},{name:\"new_text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want to replace old_text with.</div>'},{name:\"instance_num\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> specifies which occurrence of old_text you want to replace with new_text. <p/> Only that instance of old_text is replaced.</div>'}],returns:{type:\"xs:string\",description:'Substitutes new_text for old_text in a text string. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Use SUBSTITUTE when you want to replace specific text in a text string; use REPLACE when you want to replace any text that occurs in a specific location in a text string.'},errors:[]},{isDocumented:!0,arity:1,name:\"t\",qname:\"excel-text:t\",signature:\"($value as xs:anyAtomicType?) as xs:string\",description:\" Converts the $value to string.\\n\",summary:\"<p> Converts the $value to string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value</div>'}],returns:{type:\"xs:string\",description:\"Converts the $value to string.\"},errors:[]},{isDocumented:!0,arity:1,name:\"trim\",qname:\"excel-text:trim\",signature:\"($text as xs:string?) as xs:string?\",description:\" Removes all spaces from text except for single spaces between words.\\n\",summary:\"<p> Removes all spaces from text except for single spaces between words.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> from which you want spaces removed.</div>'}],returns:{type:\"xs:string?\",description:\"Removes all spaces from text except for single spaces between words.\"},errors:[]},{isDocumented:!0,arity:1,name:\"upper\",qname:\"excel-text:upper\",signature:\"($text as xs:string?) as xs:string?\",description:\" Converts text to uppercase.\\n\",summary:\"<p> Converts text to uppercase.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"text\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> text you want converted to uppercase.</div>'}],returns:{type:\"xs:string?\",description:\"Converts text to uppercase.\"},errors:[]},{isDocumented:!0,arity:2,name:\"value-except\",qname:\"excel-text:value-except\",signature:\"($arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" Returns the values in one sequence that do not appear in the second sequence in an implementation-defined order.\\n\",summary:\"<p> Returns the values in one sequence that do not appear in the second sequence in an implementation-defined order.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence.</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence.</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"The values in one sequence that do not appear in the second sequence in an implementation-defined order.\"},errors:[]},{isDocumented:!0,arity:1,name:\"value\",qname:\"excel-text:value\",signature:\"($arg as xs:anyAtomicType?) as xs:anyAtomicType?\",description:\" Converts a text string that represents a number to a number.\\n\",summary:\"<p> Converts a text string that represents a number to a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:anyAtomicType?\",description:\"Converts a text string that represents a number to a number.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value provided value is not a number.</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/http/response\":{ns:\"http://www.28msec.com/modules/http/response\",description:' The Sausalito response module can be used to modify the HTTP response\\n that will be send as a result of this request. For example, the\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">set-content-type</tt> function can be used to set the Content-Type\\n header and determine the encoding of data in the response.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"http\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"output\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"s\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"code-for-status\",qname:\"resp:code-for-status\",signature:\"($status as xs:QName) as xs:int\",description:\" Convert between the HTTP status code as QName and\\n the integer value of that status code.\\n\",summary:\"<p> Convert between the HTTP status code as QName and\\n the integer value of that status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:QName\",occurrence:null,description:\"\"}],returns:{type:\"xs:int\",description:\"the integer value of the given QName as xs:int\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given QName does not represent a valid http status code</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"content-type-binary\",qname:\"resp:content-type-binary\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a binary content-type. A\\n content-type is considered to be binary if it\\'s not a text\\n content-type.</p>\\n',summary:\"<p>  Test if a given content-type is a binary content-type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a binary content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-html\",qname:\"resp:content-type-html\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a HTML content-type, i.e.\\n the content-type is the string \"text/html\".</p>\\n',summary:\"<p>  Test if a given content-type is a HTML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the HTML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-json\",qname:\"resp:content-type-json\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a JSON content-type, i.e.\\n the content-type is the string \"application/json\".</p>\\n',summary:\"<p>  Test if a given content-type is a JSON content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the JSON content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-mixed-json-xml\",qname:\"resp:content-type-mixed-json-xml\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a mixed JSON-XML content-type, i.e.\\n the content-type is the string \"application/mixed-json-xml\".</p>\\n',summary:\"<p>  Test if a given content-type is a mixed JSON-XML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a mixed JSON-XML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-text\",qname:\"resp:content-type-text\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a text content-type.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A text content-type starts with \"text/\" or contains either of\\n the strings \"xml\" or \"json\".</p>\\n',summary:\"<p>  Test if a given content-type is a text content-type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a text content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-xhtml\",qname:\"resp:content-type-xhtml\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a XHTML content-type, i.e.\\n the content-type is the string \"application/xhtml+xml\".</p>\\n',summary:\"<p>  Test if a given content-type is a XHTML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the XHTML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-xml\",qname:\"resp:content-type-xml\",signature:\"($type as xs:string) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a XML content-type</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A XML content-type is a content-type that is \"application/xml\"\\n or ends : with the string \"+xml\".</p>\\n',summary:'<p>  Test if a given content-type is a XML content-type \\n  A XML content-type is a content-type that is \"application/xml\"\\n or ends : with the string \"+xml\".</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a XML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"decode-binary\",qname:\"resp:decode-binary\",signature:\"() as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the boolean indiciating whether base64Binaries returned by\\n this request will be decoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The default if not modified using resp:set-decode-binary is false.</p>\\n',summary:\"<p>  Returns the boolean indiciating whether base64Binaries returned by\\n this request will be decoded.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"the said boolean value\"},errors:[]},{isDocumented:!0,arity:1,name:\"message-for-status\",qname:\"resp:message-for-status\",signature:\"($status as xs:QName) as xs:string\",description:\" Convert between the HTTP status code as QName and\\n the name/message of that status code.\\n\",summary:\"<p> Convert between the HTTP status code as QName and\\n the name/message of that status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:QName\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"the message of the given QName as xs:string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given QName does not represent a valid http status code</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"serialization-parameters\",qname:\"resp:serialization-parameters\",signature:\"() as element(output:serialization-parameters)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the serialization parameters that are currently\\n active, i.e. the ones that will be used to serialize the result\\n of this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This will either be the default, the defaults set when\\n calling resp:set-content-type(), or the ones set by\\n resp:set-serialization-parameters().</p>\\n',summary:\"<p>  Returns the serialization parameters that are currently\\n active, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(output:serialization-parameters)\",description:\"the said serialization parameters\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-html\",qname:\"resp:serializer-defaults-html\",signature:\"() as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the HTML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <ul>\\n  <li>encoding: UTF-8</li>\\n  <li>indent: yes</li>\\n  <li>version: 4.01</li>\\n  <li>doctype-system: http://www.w3.org/TR/html4/loose.dtd</li>\\n  <li>doctype-public: -//W3C//DTD HTML 4.01 Transitional//EN</li>\\n  <li>include-content-type: yes</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some HTML content-type (i.e. text/html).</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the HTML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(*)*\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-json-xml-hybrid\",qname:\"resp:serializer-defaults-json-xml-hybrid\",signature:\"() as element(output:serialization-parameters)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the json-xml-hybrid\\n serialization method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <ul>\\n  <li>encoding: UTF-8</li>\\n  <li>indent: yes</li>\\n  <li>method: json-xml-hybrid</li>\\n  <li>omit-xml-declaration: yes</li>\\n  <li>version: 1.0</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to application/mixed-json-xml.</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the json-xml-hybrid\\n serialization method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(output:serialization-parameters)\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-json\",qname:\"resp:serializer-defaults-json\",signature:\"() as element(output:serialization-parameters)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the json\\n serialization method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <ul>\\n  <li>encoding: UTF-8</li>\\n  <li>indent: yes</li>\\n  <li>method: json</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some JSON content-type (e.g. application/json).</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the json\\n serialization method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(output:serialization-parameters)\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-text\",qname:\"resp:serializer-defaults-text\",signature:\"() as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the text serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The only default used is\\n <ul>\\n  <li>encoding: UTF-8</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, this default is used when setting\\n the content-type to some text content-type (e.g. text/plain).</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the text serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(*)*\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-xhtml\",qname:\"resp:serializer-defaults-xhtml\",signature:\"() as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the XHTML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <ul>\\n  <li>encoding: UTF-8</li>\\n  <li>indent: yes</li>\\n  <li>omit-xml-declaration: yes</li>\\n  <li>version: 1.0</li>\\n  <li>doctype-system: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</li>\\n  <li>doctype-public: -//W3C//DTD XHTML 1.0 Transitional//EN</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some XHTML content-type (i.e. application/xhtml+xml).</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the XHTML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(*)*\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-xml\",qname:\"resp:serializer-defaults-xml\",signature:\"() as element(output:serialization-parameters)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an element that can be used to specify the\\n settings of serialization parameters for the XML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <ul>\\n  <li>encoding: UTF-8</li>\\n  <li>indent: yes</li>\\n  <li>omit-xml-declaration: yes</li>\\n  <li>version: 1.0</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some XML content-type (e.g. application/atom+xml).</p>\\n',summary:\"<p>  Returns an element that can be used to specify the\\n settings of serialization parameters for the XML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"element(output:serialization-parameters)\",description:\"an element that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:1,name:\"set-content-type\",qname:\"resp:set-content-type\",signature:\"($type as xs:string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the Content-Type header for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n For example,\\n <tt>resp:set-content-type(\"text/plain\")</tt> will cause the\\n header\\n <tt>Content-Type: text/plain</tt> to be added for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addtion to setting the Content-Type header, the function also\\n sets the serialization parameters to the default values for serialization\\n method for the given content-type. For example, if the content-type is set to\\n text/plain, the default serialization parameters for the text\\n serialization method will be used. For application/atom+xml, the default\\n serialization parameters for the XML serialization method will be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The functions resp:content-type-text/xml/html/xhtml/binary may be used\\n to figure out which serialization method will be used for a specific\\n content-type.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the given content-type contains a charset declaration (e.g.\\n <tt>resp:set-content-type(\"text/plain;charset=ISO-8859-1\")</tt>), the\\n content of the response will be transcoded to the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The default serialization parameters set by this function can\\n be overwritten using the resp:set-serialization-parameters() function.</p>\\n',summary:\"<p>  Sets the Content-Type header for the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to be set</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set-content-type\",qname:\"resp:set-content-type\",signature:\"($type as xs:string, $params as element(output:serialization-parameters)) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the Content-Type header for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <tt>resp:set-content-type(\"text/plain\")</tt> will cause the\\n header\\n <tt>Content-Type: text/plain</tt> to be added for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition to the content-type, the function also allows to\\n specify the serialization method and parameters that will be used\\n for serializing the result. For details about this parameter, please\\n refer to resp:set-serialization-parameters().</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the given content-type contains a charset declaration (e.g.\\n <tt>resp:set-content-type(\"text/plain;charset=ISO-8859-1\")</tt>), the\\n content of the response will be transcoded to the given encoding.\\n If the serialization parameters also contain a charset declaration,\\n the charset contained in the content-type will be used. to transcode\\n the result.</p>\\n',summary:\"<p>  Sets the Content-Type header for the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to be set</div>'},{name:\"params\",type:\"element(output:serialization-parameters)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the serialization parameters that will be used for serialization the result.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-decode-binary\",qname:\"resp:set-decode-binary\",signature:\"($decode as xs:boolean) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If this function is invoked with true, the result of the request\\n will not be serialized. Instead, the result will be the binary values\\n of any item that is of type xs:base64Binary. The values of all other\\n items will not be part of the result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that all serialization parameters which have been set using\\n resp:set-serialization-parameters will be ignored. Also, the output encoding\\n is ignored for binaries.</p>\\n',summary:\"<p>  If this function is invoked with true, the result of the request\\n will not be serialized.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"decode\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> boolean value indicating whether base64Binaries should be decoded.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"set-encoding\",qname:\"resp:set-encoding\",signature:\"($encoding as xs:string) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function sets the output encoding that will be\\n used for the payload of the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <tt>resp:set-encoding(\"ISO-8859-1\")</tt> will cause the\\n content in the response to be encoded using ISO-8859-1.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that the encoding only applies to textual data.\\n It is not used if the function <tt>set-decode-binary()</tt>\\n was invoked passing true as parameter.</p>\\n',summary:\"<p>  The function sets the output encoding that will be\\n used for the payload of the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the encoding to be used for the payload of the response.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set-header-impl\",qname:\"resp:set-header-impl\",signature:\"($name as xs:string, $value as xs:string) as xs:string? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set an HTTP header in the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is only used for internal purposes and should\\n not be called by the user.</p>\\n',summary:\"<p>  Set an HTTP header in the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name for the header to set</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value for the header to set</div>'}],returns:{type:\"xs:string?\",description:\"the value of the header previously set or the empty sequence if no header has been set with the same name.\"},errors:[]},{isDocumented:!0,arity:2,name:\"set-header\",qname:\"resp:set-header\",signature:\"($name as xs:string, $value as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set a HTTP header in the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a header with the same name was already set, the\\n value is overwritten and the function returns the old value. As defined\\n in the HTTP specification, multiple headers with the same name\\n can be combined into one header whose value is a comma-separated\\n list of the values.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following headers must not be set using this function.\\n Instead, other functions of this module should be used in order\\n to implemented the required semantics:\\n <ul>\\n   <li>Status: use set-status() instead</li>\\n   <li>Content-Type: use set-content-type() instead</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Set a HTTP header in the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the header to set</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value of the header to set `</div>'}],returns:{type:\"xs:string?\",description:\"the value of the header previously set or the empty sequence if no header has been set with the same name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">resp:invalid-header-name if an invalid name is used for the header.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-redirect\",qname:\"resp:set-redirect\",signature:\"($url as xs:string) as empty-sequence()\",description:\" This function sets the HTTP 302 redirect status code in the response. As\\n a result, a redirect to the URL given as parameter will be made.\\n\",summary:\"<p> This function sets the HTTP 302 redirect status code in the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the redirect will be made.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:1,name:\"set-serialization-parameters\",qname:\"resp:set-serialization-parameters\",signature:\"($params as element(output:serialization-parameters)) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set the serialization parameters used for serializing the result\\n of the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following example shows how to set several options\\n for the HTML serialization method. Specifically, it sets the\\n HTML method to HTML 4.01, set the doctype-system and\\n doctype-public makes sure that the output is indented. In addition,\\n the output is UTF-8 encoded and\\n <pre>\\n &lt;output:serialization-parameters&gt;\\n   &lt;output:encoding value=\"UTF-8\"/&gt;\\n   &lt;output:doctype-system value=\"http://www.w3.org/TR/html4/loose.dtd\"/&gt;\\n   &lt;output:doctype-public value=\"-//W3C//DTD HTML 4.01 Transitional//EN\"/&gt;\\n &lt;/output:serialization-parameters&gt;\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The element passed as parameter need to be valid according\\n to the schema http://www.w3.org/2010/xslt-xquery-serialization. This\\n function validates its input (if it has not already been validated)\\n and may raise an error if the input is not valid.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that serialization options set by this function can\\n be overwritten by a subsequent call to resp:set-content-type. In this\\n case, the options will be reset to the default for the given\\n content-type. Also note, that the output encoding can be overwritten\\n by subsequently calling the resp:set-encoding function.</p>\\n',summary:\"<p>  Set the serialization parameters used for serializing the result\\n of the request.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"params\",type:\"element(output:serialization-parameters)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the serialization parameters that will be used to serialize the result of the request</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and, on success, returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 if the input is not valid according to the schema http://www.w3.org/2010/xslt-xquery-serialization.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the encoding specified in the serialization options is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-status-code\",qname:\"resp:set-status-code\",signature:\"($status as xs:integer) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the status code of the HTTP response to the integer given as\\n parameter.</p>\\n For example,\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">resp:set-status(204)</tt>\\n will result in \"HTTP/1.1 204 No Content\".\\n',summary:\"<p>  Sets the status code of the HTTP response to the integer given as\\n parameter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"status\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The status code of the HTTP response as integer.</div>'}],returns:{type:\"empty-sequence()\",description:\"On success, the empty-sequence is returned\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status-code if the given integer does not reflect a valid HTTP status code</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-status\",qname:\"resp:set-status\",signature:\"($status as xs:QName) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the status code of the HTTP response to the QName given as\\n parameter.</p>\\n For example,\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">resp:set-status($http:no-content)</tt>\\n will result in \"HTTP/1.1 204 No Content\".\\n',summary:\"<p>  Sets the status code of the HTTP response to the QName given as\\n parameter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"status\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The status code of the HTTP response as a QName (e.g. $http:no-content)</div>'}],returns:{type:\"empty-sequence()\",description:\"On success, the empty-sequence is returned\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given QName does not represent a valid HTTP status code;</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"valid-status\",qname:\"resp:valid-status\",signature:\"($status as xs:QName) as xs:boolean\",description:\" Test whether the given QName refers to a valid HTTP status code.\\n\",summary:\"<p> Test whether the given QName refers to a valid HTTP status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:QName\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the given QName refers to a valid HTTP status code, false otherwise.\"},errors:[]}],variables:[{name:\"http:precondition-required\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 428 Precondition Required (RFC 6585)\\n\"},{name:\"http:gone\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 410 GONE\\n\"},{name:\"http:length-required\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 411 Length Required\\n\"},{name:\"http:precondition-failed\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 412 Precondition Failed\\n\"},{name:\"http:request-entity-too-large\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 413 Request Entity Too Large\\n\"},{name:\"http:request-entity-too-long\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 414 Request Entity Too Long\\n\"},{name:\"http:unsupported-media-type\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 415 Unsupported Media Type\\n\"},{name:\"http:request-range-not-satisfiable\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 416 Request Range Not Satisfiable\\n\"},{name:\"http:expectation-failed\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 417 Expectation Failed\\n\"},{name:\"http:im-a-teapot\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 418 I'm a teapot (RFC 2324)\\n\"},{name:\"http:enhance-your-calm\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 420 Enhance Your Calm\\n\"},{name:\"http:unprocessable-entity\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 422 Unprocessable Entity (WebDAV; RFC 4918)\\n\"},{name:\"http:locked\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 423 Locked (WebDAV; RFC 4918)\\n\"},{name:\"http:failed-dependency\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 424 Failed Dependency (WebDAV; RFC 4918)\\n\"},{name:\"http:unordered-collection\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 425 Unordered Collection\\n\"},{name:\"http:upgrade-required\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 426 Upgrade Required\\n\"},{name:\"http:conflict\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 409 Conflict\\n\"},{name:\"http:too-many-requests\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 429 Too Many Requests (RFC 6585)\\n\"},{name:\"http:request-header-fields-too-large\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 431 Request Header Fields Too Large (RFC 6585)\\n\"},{name:\"http:internal-server-error\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 500 Internal Server Error\\n\"},{name:\"http:not-implemented\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 501 Not Implemented\\n\"},{name:\"http:bad-gateway\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 502 Bad Gateway\\n\"},{name:\"http:service-unavailable\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 503 Service Unavailable\\n\"},{name:\"http:gateway-timeout\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 504 Gateway Timeout\\n\"},{name:\"http:http-version-not-supported\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 505 HTTP Version Not Supported\\n\"},{name:\"http:variant-also-negotiates\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 506 Variant Also Negotiates (RFC 2295)\\n\"},{name:\"http:insufficient-storage\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 507 Insufficient Storage (WebDAV; RFC 4918)\\n\"},{name:\"http:loop-detected\",type:\"xs:QName\",description:\" QName representing the HTTP status code 508 Loop Detected (webdav; rfc 5842)\\n\"},{name:\"http:not-extended\",type:\"xs:QName\",description:\" QName representing the HTTP status code 510 Not Extended (RFC 2774)\\n\"},{name:\"http:network-authentication-required\",type:\"xs:QName\",description:\" QName representing the HTTP status code 511 Network Authentication Required (RFC 6585)\\n\"},{name:\"resp:status-info\",type:\"item()*\",description:\" Variable containing a description for all the HTTP Status Codes\\n\"},{name:\"http:see-other\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 303 See Other\\n\"},{name:\"http:switching-protocols\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 101 Switching Protocols\\n\"},{name:\"http:processing\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 102 Processing (Web; RFC 2518)\\n\"},{name:\"http:ok\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 200 OK\\n\"},{name:\"http:created\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 201 Created\\n\"},{name:\"http:accepted\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 202 Accepted\\n\"},{name:\"http:non-authoritative\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 203 Non-Authoritative\\n\"},{name:\"http:no-content\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 204 No Content\\n\"},{name:\"http:reset-content\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 205 Reset Content\\n\"},{name:\"http:partial-content\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 206 Partial Content\\n\"},{name:\"http:multi-status\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 207 Multi-Status (WebDAV; RFC 5842)\\n\"},{name:\"http:already-reported\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 208 Already Reported (WebDAV; RFC 5842)\\n\"},{name:\"http:im-used\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 226 IM Used (RFC 3229)\\n\"},{name:\"http:multiple-choices\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 300 Multiple Choices\\n\"},{name:\"http:moved-permanently\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 301 Moved Permantently\\n\"},{name:\"http:found\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 302 Found\\n\"},{name:\"http:continue\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 100 Continue\\n\"},{name:\"http:not-modified\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 304 Not Modified\\n\"},{name:\"http:use-proxy\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 305 Use Proxy\\n\"},{name:\"http:switch-proxy\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 306 Switch Proxy\\n\"},{name:\"http:temporary-redirect\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 307 Temporary Redirect\\n\"},{name:\"http:permanent-redirect\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 308 Permanent Redirect (http://tools.ietf.org/html/draft-reschke-http-status-308-07)\\n\"},{name:\"http:bad-request\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 400 Bad Request\\n\"},{name:\"http:unauthorized\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 401 Unauthorized\\n\"},{name:\"http:payment-required\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 402 Payment Required\\n\"},{name:\"http:forbidden\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 403 Forbidden\\n\"},{name:\"http:not-found\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 404 Not Found\\n\"},{name:\"http:not-allowed\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 405 Not Allowed\\n\"},{name:\"http:not-acceptable\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 406 Not Acceptable\\n\"},{name:\"http:proxy-authentication-required\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 407 Proxy Authentication Required\\n\"},{name:\"http:request-timeout\",type:\"xs:QName\",description:\" QName representing the HTTP Status Code 408 Request Timeout\\n\"}]},\"http://zorba.io/modules/uri\":{ns:\"http://zorba.io/modules/uri\",description:\" This module provides functions for processing URIs and URLs.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner, Luis Rodriguez Gonzalez</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/uri\",prefix:\"uri\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"decode\",qname:\"uri:decode\",signature:\"($u as xs:string) as xs:string\",description:\" Percent-decodes (aka URL decoding) the given string.\\n All percent encoded octets will be translated into their\\n decoded UTF-8 representation.\\n Please note that the percent encoding guarantees that a string\\n consists of ASCII characters only. Passing a string that contains\\n non-ASCII characters results in undefined behavior.\\n\",summary:\"<p> Percent-decodes (aka URL decoding) the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"u\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"the percent decoded string\"},errors:[]},{isDocumented:!0,arity:2,name:\"decode\",qname:\"uri:decode\",signature:\"($u as xs:string, $decode-plus as xs:boolean) as xs:string\",description:\" Percent-decodes (aka URL decoding) the given string.\\n All percent encoded octets will be translated into their\\n decoded UTF-8 representation.\\n If $decode-plus is specified all occurrences of the char '+'\\n will be replaced with a space ' ' before the percent decoding\\n happens.\\n Please note that the percent encoding guarantees that a string\\n consists of ASCII characters only. Passing a string that contains\\n non-ASCII characters results in undefined behavior.\\n\",summary:\"<p> Percent-decodes (aka URL decoding) the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"u\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"decode-plus\",type:\"xs:boolean\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> whether '+' chars will be replaced with spaces</div>\"}],returns:{type:\"xs:string\",description:\"the percent decoded string\"},errors:[]},{isDocumented:!0,arity:3,name:\"decode\",qname:\"uri:decode\",signature:\"($s as xs:string, $decode-plus as xs:boolean, $charset as xs:string) as xs:string external\",description:\" Percent-decodes (aka URL decoding) the given string.\\n All percent encoded octets will be translated into their\\n decoded UTF-8 representation.\\n If $decode-plus is specified all occurrences of the char '+'\\n will be replaced with a space ' ' before the percent decoding\\n happens.\\n The $charset parameter specifies the source charset after precent\\n decoding. It is used to convert the decoded string into UTF-8.\\n Please note that the percent encoding guarantees that a string\\n consists of ASCII characters only. Passing a string that contains\\n non-ASCII characters results in undefined behavior.\\n\",summary:\"<p> Percent-decodes (aka URL decoding) the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to decode</div>'},{name:\"decode-plus\",type:\"xs:boolean\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> whether '+' chars will be replaced with spaces</div>\"},{name:\"charset\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source charset of the string after percent decoding</div>'}],returns:{type:\"xs:string\",description:\"the percent decoded string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:CHARSET_UNKNOWN if the given charset is unknown or not supported</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0006 if there is an error transcoding the string</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"parse\",qname:\"uri:parse\",signature:\"($uri as xs:string) as object() external\",description:' Parses the URI passed as string. The returned object\\n contains only members with field names declared as constants in\\n this module.\\n For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n let my-uri := \"http://www.my.project.com/a/b/c?user=john;pass=1234#profile\"\\n return uri:parse(my-uri)\\n </pre>\\n returns\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n { \"squeme\" : \"http\", \"host\" : \"www.my.project.com\", \"path\" : \"/a/b/c\",\\n   \"query\" : \"user=john;pass=123\", \"fragment\" : \"profile\" }\\n </pre>\\n',summary:\"<p> Parses the URI passed as string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI to parse</div>'}],returns:{type:\"object()\",description:\"the JSON object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQST0046 if the URI is textually invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"serialize\",qname:\"uri:serialize\",signature:\"($uri as object()) as xs:string external\",description:\" Serialize the URI passed as object into a string.\\n\",summary:\"<p> Serialize the URI passed as object into a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the object representing the URI</div>'}],returns:{type:\"xs:string\",description:\"the URI as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:OPAQUE_COMB_NOT_VALID if opaque part is specified in conjunction with host/port/path/user-info/query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:OPAQUE_WITHOUT_SCHEME if opaque part is present but no scheme is present.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uri:INVALID_ABSOLUTE_PATH if a path component for an absolute URI doesn\\'t start with \"/\".</xqdoc:error>']}],variables:[{name:\"uri:SCHEME\",type:\"xs:string\",description:' Constant for the \"scheme\" part of a URI object.\\n'},{name:\"uri:AUTHORITY\",type:\"xs:string\",description:' Constant for the \"authority\" part of a URI object.\\n'},{name:\"uri:USER-INFO\",type:\"xs:string\",description:' Constant for the \"user-info\" part of a URI object.\\n'},{name:\"uri:HOST\",type:\"xs:string\",description:' Constant for the \"host\" part of a URI object.\\n'},{name:\"uri:PORT\",type:\"xs:string\",description:' Constant for the \"port\" part of a URI object.\\n'},{name:\"uri:PATH\",type:\"xs:string\",description:' Constant for the \"path\" part of a URI object.\\n'},{name:\"uri:QUERY\",type:\"xs:string\",description:' Constant for the \"query\" part of a URI object.\\n'},{name:\"uri:FRAGMENT\",type:\"xs:string\",description:' Constant for the \"fragment\" part of a URI object.\\n'},{name:\"uri:OPAQUE-PART\",type:\"xs:string\",description:' Constant for the \"opaque-part\" part of a URI object.\\n If this is set in a URI object, then none of $uri:PATH, $uri:HOST,\\n $uri:PORT, $uri:USER-INFO, or : $uri:QUERY may be specified.\\n If this is set in a URI object, $uri:SCHEME must also be specified\\n (ie, it must be an absolute URI).\\n'}]},\"http://xbrl.io/modules/bizql/profiles/sec/fiscal/core\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/fiscal/core\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying fiscal reports (10-K, 10-Q)\\n submitted to the SEC.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/companies\",prefix:\"companies\"},{uri:\"http://xbrl.io/modules/bizql/components\",prefix:\"components\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/filings\",prefix:\"filings\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/fiscal/core\",prefix:\"fiscal-core\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"j\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/core\",prefix:\"sec\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/networks\",prefix:\"sec-networks\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"balance-sheets-for-fiscal-periods-and-years\",qname:\"fiscal-core:balance-sheets-for-fiscal-periods-and-years\",signature:\"($entity-or-ids as item()*, $fiscal-period-focus as string*, $fiscal-year-focus as integer*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the balance sheet for the given entities and fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves the balance sheet for the given entities and fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entity-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of entities or their EIDs.</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the periods (YTD1, YTD2, YTD3, Q1, Q2, Q3 or FY) or $fiscal-core:ALL_FISCAL_PERIODS to accept all.</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the years (2012) or $fiscal-core:ALL_FISCAL_YEARS to accept all.</div>'}],returns:{type:\"object()*\",description:\"the balance sheet at that date and for that formType.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">entities:INVALID_PARAMETER if the CIK or entity is not valid.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"facts-for-aspects-and-fiscal-periods-and-years\",qname:\"fiscal-core:facts-for-aspects-and-fiscal-periods-and-years\",signature:\"($aspects as object()?, $fiscal-period-focus as string*, $fiscal-year-focus as integer*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves facts for the given aspects, fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves facts for the given aspects, fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"aspects\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (all optional).</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the periods (YTD1, YTD2, YTD3, Q1, Q2, Q3 or FY).</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the years (2012)</div>'}],returns:{type:\"object()*\",description:\"all facts matching the given aspects, fiscal period and year.\"},errors:[]},{isDocumented:!0,arity:4,name:\"facts-for-aspects-and-fiscal-periods-and-years\",qname:\"fiscal-core:facts-for-aspects-and-fiscal-periods-and-years\",signature:\"($aspects as object()?, $fiscal-period-focus as string*, $fiscal-year-focus as integer*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves facts for the given aspects, fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves facts for the given aspects, fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"aspects\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object containing aspects to filter, among which xbrl:Concept, xbrl:Entity and xbrl:Period (all optional).</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the periods (YTD1, YTD2, YTD3, Q1, Q2, Q3 or FY) or $fiscal-core:ALL_FISCAL_PERIODS to accept all.</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the years (2012) or $fiscal-core:ALL_FISCAL_YEARS to accept all.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"../core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"all facts matching the given aspects, fiscal period and year.\"},errors:[]},{isDocumented:!0,arity:4,name:\"facts-for-entities-and-concepts-and-fiscal-periods-and-years\",qname:\"fiscal-core:facts-for-entities-and-concepts-and-fiscal-periods-and-years\",signature:\"($entities-or-ids as item()*, $concepts as string*, $fiscal-period-focus as string*, $fiscal-year-focus as integer*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves facts for the given entities, concepts, fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves facts for the given entities, concepts, fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of entities or their EIDs.</div>'},{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of concept names (us-gaap:Assets)</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the periods (YTD1, YTD2, YTD3, Q1, Q2, Q3 or FY) or $fiscal-core:ALL_FISCAL_PERIODS to accept all.</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the years (2012) or $fiscal-core:ALL_FISCAL_YEARS to accept all.</div>'}],returns:{type:\"object()*\",description:\"all facts matching entities, concepts, fiscal periods and years\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">entities:INVALID_PARAMETER if the CIK or entity is not valid.</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"facts-for-entities-and-concepts-and-fiscal-periods-and-years\",qname:\"fiscal-core:facts-for-entities-and-concepts-and-fiscal-periods-and-years\",signature:\"($entities-or-ids as item()*, $concepts as string*, $fiscal-period-focus as string*, $fiscal-year-focus as integer*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves facts for the given entities, concepts, fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves facts for the given entities, concepts, fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of entities or their EIDs.</div>'},{name:\"concepts\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of concept names (us-gaap:Assets)</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the periods (YTD1, YTD2, YTD3, Q1, Q2, Q3 or FY) or $fiscal-core:ALL_FISCAL_PERIODS to accept all.</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the years (2012) or $fiscal-core:ALL_FISCAL_YEARS to accept all.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"../core#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"all facts matching entities, concepts, fiscal periods and years\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">entities:INVALID_PARAMETER if the CIK or entity is not valid.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"filings-for-entities-and-fiscal-periods-and-years\",qname:\"fiscal-core:filings-for-entities-and-fiscal-periods-and-years\",signature:\"($entities-or-ids as item()*, $fiscal-period-focus as string*, $fiscal-year-focus as integer*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all filings by entities and for given fiscal periods and years.</p>\\n',summary:\"<p>  Retrieves all filings by entities and for given fiscal periods and years.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> entities or their ids.</div>'},{name:\"fiscal-period-focus\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> fiscal periods (FY, YTD1, YTD2, YTD3, Q1, Q2, Q3, Q4) or $fiscal-core:ALL_FISCAL_PERIODS to accept all..</div>'},{name:\"fiscal-year-focus\",type:\"integer\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> fiscal years or $fiscal-core:ALL_FISCAL_YEARS to accept all..</div>'}],returns:{type:\"object()*\",description:\"all filings that match the criteria.\"},errors:[]},{isDocumented:!0,arity:1,name:\"fiscal-period\",qname:\"fiscal-core:fiscal-period\",signature:\"($filing-fact-or-id as item()?) as string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the fiscal period of a filing or a fact.</p>\\n',summary:\"<p>  Retrieves the fiscal period of a filing or a fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filing-fact-or-id\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a filing, a fact, or its id.</div>'}],returns:{type:\"string?\",description:\"the fiscal period (FY, YTD2, YTD3, Q1, Q2 or Q3).\"},errors:[]},{isDocumented:!0,arity:1,name:\"fiscal-year\",qname:\"fiscal-core:fiscal-year\",signature:\"($filing-fact-or-id as item()?) as integer?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the fiscal year of a filing or a fact.</p>\\n',summary:\"<p>  Retrieves the fiscal year of a filing or a fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filing-fact-or-id\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a filing, a fact, or its id.</div>'}],returns:{type:\"integer?\",description:\"the fiscal year (e.g., 2012).\"},errors:[]},{isDocumented:!0,arity:1,name:\"latest-reported-fiscal-period\",qname:\"fiscal-core:latest-reported-fiscal-period\",signature:\"($entity-or-id as item()) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the latest reported fiscal period and year for the\\n supplied entity.</p>\\n',summary:\"<p>  Retrieves the latest reported fiscal period and year for the\\n supplied entity.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entity-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an entity or its EID.</div>'}],returns:{type:\"object()*\",description:\"an object with two fields: period and year.\"},errors:[]},{isDocumented:!0,arity:2,name:\"latest-reported-fiscal-period\",qname:\"fiscal-core:latest-reported-fiscal-period\",signature:\"($entity-or-id as item(), $type as string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the latest fiscal period and year for the\\n supplied entity.</p>\\n',summary:\"<p>  Retrieves the latest fiscal period and year for the\\n supplied entity.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entity-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an entity or its EID.</div>'},{name:\"type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> 10-K or 10-Q or FY, YTD1, YTD2, YTD3, Q1, Q2, or Q3.</div>'}],returns:{type:\"object()*\",description:\"an object with two fields: period and year.\"},errors:[]}],variables:[{name:\"fiscal-core:ALL_FISCAL_PERIODS\",type:\"string\",description:\" Joker for all fiscal periods.\\n\"},{name:\"fiscal-core:ALL_FISCAL_YEARS\",type:\"integer\",description:\" Joker for all fiscal years.\\n\"}]},\"http://zorba.io/modules/base64\":{ns:\"http://zorba.io/modules/base64\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Base64 encoding and decoding.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"decode\",qname:\"base64:decode\",signature:\"($base64 as base64Binary) as string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Decode a base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function assumes that the content after decoding is valid\\n UTF-8.</p>\\n',summary:\"<p>  Decode a base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"base64\",type:\"base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The base64Binary item to decode</div>'}],returns:{type:\"string\",description:\"the base64-decoded value as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0006 if $base64 contains invalid base-64 data.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"decode\",qname:\"base64:decode\",signature:\"($base64 as base64Binary, $encoding as string) as string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Decode a base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function assumes that the content after decoding has\\n the given encoding.</p>\\n',summary:\"<p>  Decode a base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"base64\",type:\"base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The base64Binary item to decode</div>'},{name:\"encoding\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the string after base64-decoding it. The encoding parameter is case insensitive.</div>'}],returns:{type:\"string\",description:\"the base64-decoded value as a string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP0006 if the given encoding is invalid or not supported. \"ASCII\" and \"UTF-8\" are guaranteed to be supported; other encodings may be supported depending on the installation.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0006 if $base64 contains invalid base-64 data.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"encode\",qname:\"base64:encode\",signature:\"($string as string) as base64Binary external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Encode a string as base64Binary.</p>\\n',summary:\"<p>  Encode a string as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item whose string-value should be encoded</div>'}],returns:{type:\"base64Binary\",description:\"the base64-encoded string-value of the item parameter\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/networks\":{ns:\"http://xbrl.io/modules/bizql/networks\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for handling networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A network is a graph of concepts and resources, of which the edges\\n share the same semantics.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">There are several kinds of networks.\\n A network can be a tree or a DAG of concepts. It can be a bipartite\\n graph mapping concepts to resources.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">XBRL defines a number of standard networks: presentation, calculation,\\n definition (essence-alias, general-special, requires-element, similar-tuples, domain-member),\\n and label networks.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve the networks contained in a component, and you\\n can retrieve a standard XBRL network with the provided short names.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/components\",prefix:\"components\"},{uri:\"http://xbrl.io/modules/bizql/networks\",prefix:\"networks\"}],functions:[{isDocumented:!0,arity:2,name:\"networks-for-components-and-short-names\",qname:\"networks:networks-for-components-and-short-names\",signature:\"($components as item()*, $short-name as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the standardized networks in the supplied components with the given short names.</p>\\n',summary:\"<p>  Retrieves the standardized networks in the supplied components with the given short names.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of components.</div>'},{name:\"short-name\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the short names of the networks.</div>'}],returns:{type:\"object()*\",description:\"the standardized networks with these short names.\"},errors:[]},{isDocumented:!0,arity:1,name:\"networks-for-components\",qname:\"networks:networks-for-components\",signature:\"($components as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all networks in the supplied components.</p>\\n',summary:\"<p>  Retrieves all networks in the supplied components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of components.</div>'}],returns:{type:\"object()*\",description:\"all networks.\"},errors:[]}],variables:[{name:\"networks:PRESENTATION_NETWORK\",type:\"xs:string\",description:\" Short name of the presentation network.\\n\"},{name:\"networks:CALCULATION_NETWORK\",type:\"xs:string\",description:\" Short name of the calculation network.\\n\"},{name:\"networks:ESSENCE_ALIAS_NETWORK\",type:\"xs:string\",description:\" Short name of the essence-alias definition network.\\n\"},{name:\"networks:GENERAL_SPECIAL_NETWORK\",type:\"xs:string\",description:\" Short name of the general-special definition network.\\n\"},{name:\"networks:REQUIRES_ELEMENT_NETWORK\",type:\"xs:string\",description:\" Short name of the requires-element definition network.\\n\"},{name:\"networks:SIMILAR_TUPLES_NETWORK\",type:\"xs:string\",description:\" Short name of the similar-tuples definition network.\\n\"},{name:\"networks:DOMAIN_MEMBER_NETWORK\",type:\"xs:string\",description:\" Short name of the domain-member definition network.\\n\"}]},\"http://jsound.io/modules/validate/map\":{ns:\"http://jsound.io/modules/validate/map\",description:\" Map utility\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Chris Hillery, Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://jsound.io/modules/validate/map\",prefix:\"map\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"get\",qname:\"map:get\",signature:\"($map as object(), $key as string) as item()\",description:\" Returns the value under the key.\\n\",summary:\"<p> Returns the value under the key.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the map JSON object</div>'},{name:\"key\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the key</div>'}],returns:{type:\"item()\",description:\"the value under the $key, () if empty Example:\"},errors:[]},{isDocumented:!0,arity:2,name:\"has-key\",qname:\"map:has-key\",signature:\"($map as object(), $key as string) as boolean\",description:\" Returns true if $key exists in the map.\\n\",summary:\"<p> Returns true if $key exists in the map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the map JSON object</div>'},{name:\"key\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the key</div>'}],returns:{type:\"boolean\",description:\"true if $key exists, false otherwise Example:\"},errors:[]},{isDocumented:!0,arity:3,name:\"set-if-empty\",qname:\"map:set-if-empty\",signature:\"($map as object(), $key as xs:string, $value as item()) as boolean\",description:\" Only if key doesn't exist, inserts new key and value into the map and\\n returns true. Otherwise returns false.\\n\",summary:\"<p> Only if key doesn't exist, inserts new key and value into the map and\\n returns true.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the map JSON object</div>'},{name:\"key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the key</div>'},{name:\"value\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value</div>'}],returns:{type:\"boolean\",description:\"true if $key is empty, false otherwise Example:\"},errors:[]},{isDocumented:!0,arity:3,name:\"set\",qname:\"map:set\",signature:\"($map as object(), $key as xs:string, $value as item()) as boolean\",description:\" Inserts new key and value into the map or replaces value under the exiting key.\\n Returns true all the time.\\n\",summary:\"<p> Inserts new key and value into the map or replaces value under the exiting key.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the map JSON object</div>'},{name:\"key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the key</div>'},{name:\"value\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value</div>'}],returns:{type:\"boolean\",description:\"true Example:\"},errors:[]}],variables:[]},\"http://zorba.io/modules/xml\":{ns:\"http://zorba.io/modules/xml\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module provides functions for reading XML files from string inputs.\\n It allows reading of well-formed XML documents as well as well-formed\\n external parsed entities, described by\\n <a href=\"http://www.w3.org/TR/xml/#wf-entities\">XML 1.0 Well-Formed\\n Parsed Entities</a>. The functions can also perform Schema and DTD\\n validation of the input documents.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following example parses a sequence of XML elements and returns\\n them in a streaming fashion - each at a time:</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace x = \"http://zorba.io/modules/xml\";\\n import schema namespace opt = \"http://zorba.io/modules/xml-options\";\\n x:parse(\\n   \"&lt;from1&gt;Jani&lt;/from1&gt;&lt;from2&gt;Jani&lt;/from2&gt;&lt;from3&gt;Jani&lt;/from3&gt;\",\\n   &lt;opt:options&gt;\\n     &lt;opt:parse-external-parsed-entity/&gt;\\n   &lt;/opt:options&gt;\\n )\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Another useful option allows to skip an arbitrary number of levels\\n before returning a sequence of nodes as shown in the following example:</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace x = \"http://zorba.io/modules/xml\";\\n import schema namespace opt = \"http://zorba.io/modules/xml-options\";\\n x:parse(\\n   \"&lt;root&gt;\\n     &lt;from1&gt;Jani1&lt;/from1&gt;\\n     &lt;from2&gt;Jani2&lt;/from2&gt;\\n     &lt;from3&gt;Jani3&lt;/from3&gt;\\n   &lt;/root&gt;\",\\n   &lt;opt:options&gt;\\n     &lt;opt:parse-external-parsed-entity opt:skip-root-nodes=\"1\"/&gt;\\n   &lt;/opt:options&gt;\\n )\\n </pre>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xml/#wf-entities\">XML 1.0 Well-Formed Parsed Entities</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xpath-functions-30/#func-parse-xml\"> fn:parse-xml() function in XPath and XQuery Functions and Operators 3.0</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://xmlsoft.org/html/libxml-parser.html\">LibXml2 parser</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Juan Zacarias</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/xml-options\",prefix:\"opt\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/modules/xml\",prefix:\"x\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"canonicalize\",qname:\"x:canonicalize\",signature:\"($xml-string as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A function to canonicalize the given XML string, that is, transform\\n it into Canonical XML as defined by <a href=\"http://www.w3.org/TR/xml-c14n\">Canonical XML</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note: This function is not streamable. If a streamable string is used\\n as input for the function it will be materialized.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note: This function sets the\\n <a href=\"http://xmlsoft.org/html/libxml-parser.html#xmlParserOption\">XML_PARSE_NOERROR</a>\\n option when parsing the XML input.</p>\\n',summary:\"<p>  A function to canonicalize the given XML string, that is, transform\\n it into Canonical XML as defined by  Canonical XML .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml-string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a string representation of a well formed XML to canonicalize. XML fragments are not allowed.</div>'}],returns:{type:\"xs:string\",description:\"the canonicalized XML string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:CANO0001 invalid input.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"canonicalize\",qname:\"x:canonicalize\",signature:\"($xml-string as xs:string, $options as element(opt:options)) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A function to canonicalize the given XML string, that is, transform\\n it into Canonical XML as defined by <a href=\"http://www.w3.org/TR/xml-c14n\">Canonical XML</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This version of the function allows specifying certain options to be\\n used when initially parsing the XML string. These are of the same form\\n as the options to x:parse#2(), although the following options are\\n currently ignored for this function:\\n <ul>\\n <li>&lt;opt:no-error/&gt;</li>\\n <li>&lt;opt:base-uri/&gt;</li>\\n <li>&lt;opt:schema-validate/&gt;</li>\\n <li>&lt;opt:parse-external-parsed-entity/&gt;</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note: This function is not streamable, if a streamable string is used\\n as input for the function it will be materialized.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note: This function sets the\\n <a href=\"http://xmlsoft.org/html/libxml-parser.html#xmlParserOption\">XML_PARSE_NOERROR</a>\\n option when parsing the XML input.</p>\\n',summary:\"<p>  A function to canonicalize the given XML string, that is, transform\\n it into Canonical XML as defined by  Canonical XML .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml-string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a string representation of a well formed XML to canonicalize. XML fragments are not allowed.</div>'},{name:\"options\",type:\"element(opt:options)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an XML containg options for the canonicalize function.</div>'}],returns:{type:\"xs:string\",description:\"the canonicalized XML string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:CANO0001 invalid input.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse\",qname:\"x:parse\",signature:\"($xml-string as xs:string?, $options as element(opt:options)?) as node()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A function to parse XML files and fragments (i.e.\\n <a href=\"http://www.w3.org/TR/xml/#wf-entities\">external general parsed\\n entities</a>).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The functions takes two arguments: the first one is the\\n string to be parsed and the second argument is an &lt;options/&gt; element that\\n passes a list of options to the parsing function. They are described below.\\n The options element must conform to the xml-options:options element type\\n from the xml-options.xsd schema. Some of these\\n will be passed to the underlying library (LibXml2) and further documentation\\n for them can be found at <a href=\"http://xmlsoft.org/html/libxml-parser.html\">\\n LibXml2 parser</a>.</p>\\n The list of available options:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <li>\\n &lt;base-uri/&gt; - the element must have a \"value\" attribute, which will provide\\n the baseURI that will be used as the baseURI for every node returned by this\\n function.\\n </li>\\n <li>\\n &lt;no-error/&gt; - if present, the option will disable fatal error processing. Any\\n failure to parse or validate the input in the requested manner will result\\n in the function returning an empty sequence and no error will raised.\\n </li>\\n <li>\\n &lt;schema-validate/&gt; - if present, it will request that the input string be Schema\\n validated. The element accepts an attribute named \"mode\" which can have two\\n values: \"strict and \"lax\". Enabling the option will produce a result that is\\n equivalent to processing the input with the option disabled, and then copying\\n the result using the XQuery \"validate strict|lax\" expression. This option can not\\n be used together with either the &lt;DTD-validate/&gt; or the &lt;parse-external-parsed-entity/&gt;\\n option. Doing so will raise a zerr:ZXQD0003 error.\\n </li>\\n <li>\\n &lt;DTD-validate/&gt; - the option will enable the DTD-based validation. If this\\n option is enabled and the input references a DTD, then the input must be a\\n well-formed and DTD-valid XML document. The &lt;DTD-load/&gt; option must be used for\\n external DTD files to be loaded. If the option is enabled and the input does\\n not reference a DTD then the option is ignored. If the option is disabled, the\\n input is not required to reference a DTD and if it does reference a DTD then\\n the DTD is ignored for validation purposes. This option can not\\n be used together with either the &lt;schema-validate/&gt; or the &lt;parse-external-parsed-entity&gt;\\n option. Doing so will raise a zerr:ZXQD0003 error.\\n </li>\\n <li>\\n &lt;DTD-load/&gt; - if present, it will enable loading of external DTD files.\\n </li>\\n <li>\\n &lt;default-DTD-attributes/&gt; - if present, it will enable the default DTD attributes.\\n </li>\\n <li>\\n &lt;parse-external-parsed-entity/&gt; - if present, it will enable the processing of XML\\n external entities. If the option\\n is enabled, the input must conform to the syntax extParsedEnt (production\\n [78] in XML 1.0, see <a href=\"http://www.w3.org/TR/xml/#wf-entities\">\\n Well-Formed Parsed Entities</a>). In addition, by default a DOCTYPE declaration is allowed,\\n as described by the [28] doctypedecl production, see <a href=\"http://www.w3.org/TR/xml/#NT-doctypedecl\">\\n Document Type Definition</a>. A parameter is available to forbid the appearance of the DOCTYPE.\\n The result of the function call is a list\\n of nodes corresponding to the top-level components of the content of the\\n external entity: that is, elements, processing instructions, comments, and\\n text nodes. CDATA sections and character references are expanded, and\\n adjacent characters are merged so the result contains no adjacent text\\n nodes. If the option is disabled, the input must be a well-formed XML\\n document conforming to the Document production\\n (<a href=\"http://www.w3.org/TR/xml/#sec-well-formed\">production [1] in XML 1.0</a>).\\n This option can not be used together with either the &lt;schema-validate/&gt; or the &lt;DTD-validate/&gt;\\n option. Doing so will raise a zerr:ZXQD0003 error.\\n The &lt;parse-external-parsed-entity/&gt; option has three parameters, given by attributes. The first\\n attribute is \"skip-root-nodes\" and it can have a non-negative value. Specifying the paramter\\n tells the parser to skip the given number of root nodes and return only their children. E.g.\\n skip-root-nodes=\"1\" is equivalent to parse-xml($xml-string)/node()/node() . skip-root-nodes=\"2\" is equivalent\\n to parse-xml($xml-string)/node()/node()/node() , etc. The second attribute is \"skip-top-level-text-nodes\" with a\\n boolean value. Specifying \"true\" will tell the parser to skip top level text nodes, returning\\n only the top level elements, comments, PIs, etc. This parameter works in combination with\\n the \"skip-root-nodes\" paramter, thus top level text nodes are skipped after \"skip-root-nodes\" has\\n been applied. The third paramter is \"error-on-doctype\" and will generate an error if a DOCTYPE\\n declaration appears in the input, which by default is allowed.\\n </li>\\n <li>\\n &lt;substitute-entities/&gt; - if present, it will enable the XML entities substitutions.\\n </li>\\n <li>\\n &lt;remove-redundant-ns/&gt; - if present, the parser will remove redundant namespaces declarations.\\n </li>\\n <li>\\n &lt;no-CDATA/&gt; - if present, the parser will merge CDATA nodes as text nodes.\\n </li>\\n <li>\\n &lt;xinclude-substitutions/&gt; - if present, it will enable the XInclude substitutions.\\n </li>\\n <li>\\n &lt;no-xinclude-nodes/&gt; - if present, the parser will not generate XInclude START/END nodes.\\n </li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n An example that sets the base-uri of the parsed external entities:\\n </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n   import module namespace x = \"http://zorba.io/modules/xml\";\\n   import schema namespace opt = \"http://zorba.io/modules/xml-options\";\\n   x:parse(\"&lt;from1&gt;Jani&lt;/from1&gt;&lt;from2&gt;Jani&lt;/from2&gt;&lt;from3&gt;Jani&lt;/from3&gt;\",\\n     &lt;opt:options&gt;\\n       &lt;opt:base-uri opt:value=\"urn:test\"/&gt;\\n       &lt;opt:parse-external-parsed-entity/&gt;\\n     &lt;/opt:options&gt;\\n   )\\n </pre>\\n',summary:\"<p>  A function to parse XML files and fragments (i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml-string\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string that holds the XML to be parsed. If empty, the function will return an empty sequence</div>'},{name:\"options\",type:\"element(opt:options)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The options for the parsing</div>'}],returns:{type:\"node()*\",description:\"The parsed XML as a document node or a list of nodes, or an empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0003 The error will be raised if the options to the function are inconsistent.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FODC0006 The error will be raised if the input string is not a valid XML document or fragment (external general parsed entity) or if DTD validation was enabled and the document has not passed it.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 The error will be raised if schema validation was enabled and the input document has not passed it or if the parsing options are not conformant to the xml-options.xsd schema.</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/process\":{ns:\"http://www.zorba-xquery.com/modules/process\",description:' This module provides functions to create a native process and return the result\\n (i.e. exit code, result on standard out and error).\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Example:\\n<pre class=\"ace-static\" ace-mode=\"xquery\">\\n  import module namespace proc = \"http://www.zorba-xquery.com/modules/process\";\\n  proc:exec(\"ls\")\\n</pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Potential result:\\n <pre class=\"ace-static\" ace-mode=\"xquery\">\\n &lt;result xmlns=\"http://www.zorba-xquery.com/modules/process\"&gt;\\n   &lt;stdout&gt;myfile.txt&lt;/stout&gt;\\n   &lt;stderr/&gt;\\n   &lt;exit-code&gt;0&lt;/exit-code&gt;\\n &lt;/result&gt;\\n </pre>\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/process\",prefix:\"process\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"exec\",qname:\"process:exec\",signature:\"($cmd as xs:string) as element(process:result) external\",description:\" Executes the specified string command in a separate process.\\n This function does not allow arguments to be passed to\\n the command.\\n\",summary:\"<p> Executes the specified string command in a separate process.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cmd\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> command to be executed (without arguments)</div>'}],returns:{type:\"element(process:result)\",description:\"the result of the execution as an element as shown in the documentation of this module. The exit-code element returns the exit code of the child process. For POSIX compliant platforms: returns the process exit code. If process is terminated or stopped: 128 + termination signal code. For Windows platforms: returns the return value of the process or the exit or terminate process specified value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">process:PROC01 if an error occurred while communicating with the executed process.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"exec\",qname:\"process:exec\",signature:\"($cmd as xs:string, $args as xs:string*) as element(process:result) external\",description:\" Executes the specified string command in a separate process.\\n Each of the strings in the sequence passed in as the second\\n argument is passed as an argument to the executed command.\\n\",summary:\"<p> Executes the specified string command in a separate process.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cmd\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> command to be executed (without arguments)</div>'},{name:\"args\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the arguments passed to the executed command (e.g. \"-la\")</div>'}],returns:{type:\"element(process:result)\",description:\"the result of the execution as an element as shown in the documentation of this module. The exit-code element returns the exit code of the child process. For POSIX compliant platforms: returns the process exit code. If process is terminated or stopped: 128 + termination signal code. For Windows platforms: returns the return value of the process or the exit or terminate process specified value.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">process:PROC01 if an error occurred while communicating with the executed process.</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/maps\":{ns:\"http://www.28msec.com/modules/maps\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module defines a set of functions for working with maps. A map\\n is identified by a string and can be created using the map:create function\\n and dropped using the map:drop function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">It is possible to create persistent and transient maps. The lifetime of a\\n transient map is limited by the execution of the current query.\\n A persistent map lives until it is explicitly dropped.\\n Accordingly, it is also available to other requests.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre class=\"ace-static\" ace-mode=\"xquery\">map:create(\"my-map\", [\"string\", \"integer\"], { \"persistent\" : false })</pre>\\n will create a transient map named my-map having two keys.\\n The types of the keys are string and integer.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The key of a particular entry in the map can consist of a tuple of\\n atomic values (called key attributes). The actual type of each attribute\\n is determined when the map is created. The value of each entry is a\\n sequence of items. If an item in this sequence is a object or array,\\n this item needs to belong to a collection, otherwise, an error is raised.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For every persistent map, 28.io will create a new collection\\n in your MongoDB database. The collection will have the prefix <em>_28.map</em>.\\n For example, if your map is called foo, the according collection will\\n be named <em>_28.map.foo</em>.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/maps\",prefix:\"map\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:0,name:\"available-maps\",qname:\"map:available-maps\",signature:\"() as string* external\",description:\" The function returns a sequence of names of the maps that are\\n available (persistent and non-persistent). The sequence will be\\n empty if there are no maps.\\n\",summary:\"<p> The function returns a sequence of names of the maps that are\\n available (persistent and non-persistent).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"string*\",description:\"A sequence of string, one for each available map, or an emtpy sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"create\",qname:\"map:create\",signature:\"($name as string, $key-types as item()) as empty-sequence() external\",description:' Create a persistent map with a given name and type identifiers for the key\\n attributes.\\n If the map has only one key attribute, a single type identifier is given,\\n for more than one key attribute an array of type identifiers is given.\\n Calling this function is equivalent to calling create with the options\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">{ \"persistent\" : true }</pre>\\n Note that the function is sequential and immediately creates the map.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Each key-type should be specified as string (e.g. \"integer\",\\n \"string\", \"boolean\", \"double\", or \"datetime\").</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>map:create(\"my-map\", \"string\")</pre> or\\n <pre>map:create(\"my-map\", [\"string\", \"integer\"])</pre>.</p>\\n',summary:\"<p> Create a persistent map with a given name and type identifiers for the key\\n attributes.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map (the restrictons on collection names apply)</div>'},{name:\"key-types\",type:\"item()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately creates the corresponding map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if any of the key attribute types is not a subtype of anyAtomicType.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0001 if a map with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0043 if any of the given options has an invalid type</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create\",qname:\"map:create\",signature:\"($name as string, $key-types as item(), $options as object()) as empty-sequence() external\",description:' Create a map with a given name, type identifiers for the key attributes, and\\n options.\\n If the map has only one key attribute, a single type identifier is given,\\n for more than one key attribute an array of type identifiers is given.\\n Currently only one option is supported: To create a transient map the object\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">{ \"persistent\" : false }</code>\\n has to be passed to the $options parameter.\\n Note that the function is sequential and immediately creates the map in the\\n store.\\n',summary:\"<p> Create a map with a given name, type identifiers for the key attributes, and\\n options.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map (the restrictons on collection names apply)</div>'},{name:\"key-types\",type:\"item()\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an object describing options for the map</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately creates the corresponding map but returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if any of the attribute types is not a subtype of anyAtomicType.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0001 if a map with the given name already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1000 if the given name is not a legal collection name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0043 if any of the given options has an invalid type</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete\",qname:\"map:delete\",signature:\"($name as string, $key as item()) as empty-sequence() external\",description:' Removes an entry identified by the given key from the map.\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n Note that it is possible to insert entries with empty key attributes.\\n However as the removing the entries is based on the \"eq\" comparison and\\n as \"eq\" with an empty sequence always return false, it is not possible\\n to delete these entries.\\n',summary:\"<p> Removes an entry identified by the given key from the map.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately deletes the entry into the map but returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"drop\",qname:\"map:drop\",signature:\"($name as string) as empty-sequence() external\",description:\" Deletes the map with the given name.\\n\",summary:\"<p> Deletes the map with the given name.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map to drop</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately drops the map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"get\",qname:\"map:get\",signature:\"($name as string, $key as item()) as item()* external\",description:' Returns the value of the entry with the given key from the map.\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n Note that it is possible to insert entries with empty key attributes.\\n However as the getting the entries is based on the \"eq\" comparison and\\n as \"eq\" with an empty sequence always return false, it is not possible\\n to retrieve these entries.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>map:get(\"my-map\", \"key\")</pre> or\\n <pre>map:get(\"my-map\", [ \"key1\", \"key2\" ])</pre>.</p>\\n',summary:\"<p> Returns the value of the entry with the given key from the map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'}],returns:{type:\"item()*\",description:\"the value of the entry in the map identified by the given key. The empty-sequence will be returned if no entry with the given key is contained in the map.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"insert\",qname:\"map:insert\",signature:\"($name as string, $key as item(), $value as item()*) as empty-sequence() external\",description:' Inserts a new entry into the map with the given name.\\n If the map has only one key attribute, a single key value is given, for\\n more than one key attribute an array of key values is given.\\n If an entry with the given key already exists in the map, the value\\n sequences of the existing entry and the sequence passed using $value\\n argument are concatenated.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a map is persistent and if an item in the value sequence\\n is an object or array, this item needs to belong to a collection,\\n otherwise, an an error is raised.</p>\\n Note that it is possible to insert entries with empty key attributes\\n or key attributes having the value <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">null</code>. However, as\\n the comparison with an empty sequence or null always returns false,\\n it is not possible to retrieve these entries.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>map:insert(\"my-map\", \"key\", \"value\")</pre> or\\n <pre>map:insert(\"my-map\", [ \"key1\", \"key2\" ] , (42, \"value\"))</pre>.</p>\\n',summary:\"<p> Inserts a new entry into the map with the given name.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'},{name:\"key\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a single attribute key or an array of keys</div>'},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value of the entry to insert</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and immediately inserts the entry into the map. It returns the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the given number of key attributes does not match the number of key attributes specified when creating the map (see the map:create function).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQD0005 if any of the given key attributes can not be cast (or is not a subtype) of the corresponding key attribute specified when creating the map.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY1003 if the value to insert is an object or array it must belong to a collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"keys\",qname:\"map:keys\",signature:\"($name as string) as array()* external\",description:' Returns the keys of all entries of a map. The keys\\n are returned as sequence of arrays.\\n The following condition always holds:\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:size($name) eq count(map:keys($name))</tt>\\n',summary:\"<p> Returns the keys of all entries of a map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"array()*\",description:\"an sequence of arrays each array containing the values of all attributes of one key.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"options\",qname:\"map:options\",signature:\"($name as string) as object() external\",description:\" The function returns the options that were passed during creation or the\\n default options if no options were passed.\\n\",summary:\"<p> The function returns the options that were passed during creation or the\\n default options if no options were passed.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"object()\",description:\"an options object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"size\",qname:\"map:size\",signature:\"($name as string) as integer external\",description:' The number of entries in a map.\\n The following condition always holds:\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">map:size($name) eq count(map:keys($name))</tt>\\n',summary:\"<p> The number of entries in a map.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the map</div>'}],returns:{type:\"integer\",description:\"the number of entries in the map.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if a map with the given name does not exist.</xqdoc:error>']}],variables:[]},\"http://www.w3.org/2005/xpath-functions/math\":{ns:\"http://www.w3.org/2005/xpath-functions/math\",description:' This module contains all the functions part of the\\n W3C XPath and XQuery Functions and Operators 3.0\\n section \"4.7 Trigonometric and exponential functions\".\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.w3.org/TR/xpath-functions-30/#trigonometry</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">www.w3c.org</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"math\"}],functions:[{isDocumented:!0,arity:1,name:\"acos\",qname:\"math:acos\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the arc cosine of the argument, the result being in the range zero to\\n                +<var>π</var> radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"acos\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the arc cosine of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>acos</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> exception is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is <code>NaN</code>, or if its absolute value is greater than one,\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases the result is an <code>xs:double</code> value representing an angle\\n                <var>θ</var> in radians in the range <code>0 &lt;= $</code><var>θ</var><code> &lt;=\\n                +</code><var>π</var>. </p></div>\\n',summary:\"<p>  Returns the arc cosine of the argument, the result being in the range zero to\\n                + π  radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"asin\",qname:\"math:asin\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the arc sine of the argument, the result being in the range\\n                -<var>π</var>/2 to +<var>π</var>/2 radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"asin\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the arc sine of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>asin</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> and <code>underflow</code> exceptions\\n             is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is positive or negative zero, the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is <code>NaN</code>, or if its absolute value is greater than one,\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases the result is an <code>xs:double</code> value representing an angle\\n                <var>θ</var> in radians in the range -<var>π</var><code>/2 &lt;=\\n                $</code><var>θ</var><code> &lt;= +</code><var>π</var><code>/2</code>. </p></div>\\n',summary:\"<p>  Returns the arc sine of the argument, the result being in the range\\n                - π /2 to + π /2 radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"atan\",qname:\"math:atan\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the arc tangent of the argument, the result being in the range\\n                -<var>π</var>/2 to +<var>π</var>/2 radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"atan\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the arc tangent of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>atan</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>underflow</code> exception is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is positive or negative zero, the result is <code>$arg</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is <code>NaN</code> then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">In other cases the result is an <code>xs:double</code> value representing an angle\\n                <var>θ</var> in radians in the range -<var>π</var><code>/2 &lt;=\\n                $</code><var>θ</var><code> &lt;= +</code><var>π</var><code>/2</code>. </p></div>\\n',summary:\"<p>  Returns the arc tangent of the argument, the result being in the range\\n                - π /2 to + π /2 radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"atan2\",qname:\"math:atan2\",signature:\"($y as xs:double, $x as xs:double) as xs:double external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the angle in radians subtended at the origin by the point on a plane\\n             with coordinates (x, y) and the positive x-axis, the result being in the range\\n                -<var>π</var> to +<var>π</var>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"atan2\" return-type=\"xs:double\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"y\" type=\"xs:double\"/><arg name=\"x\" type=\"xs:double\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">The result is the value of <code>atan2(y, x)</code> as defined in the\\n                <bibref ref=\"ieee754-2008\"/> specification of the <code>atan2</code> function applied\\n             to 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>underflow</code> exception is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <phrase diff=\"chg\" at=\"L\">either argument</phrase> is <code>NaN</code>\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$y</code> is positive and <code>$x</code> is positive and finite, then\\n             (subject to rules for overflow, underflow and approximation)\\n          the value of <code>atan2($y, $x)</code> is <code>atan($y div $x)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$y</code> is positive and <code>$x</code> is negative and finite, then\\n             (subject to the same caveats)\\n             the value of <code>atan2($y, $x)</code> is <var>π</var> <code>- atan($y div $x)</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Some results for special values of the arguments are shown in the examples below.</p></div>\\n',summary:\"<p>  Returns the angle in radians subtended at the origin by the point on a plane\\n             with coordinates (x, y) and the positive x-axis, the result being in the range\\n                - π  to + π .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"y\",type:\"xs:double\",occurrence:null,description:\"\"},{name:\"x\",type:\"xs:double\",occurrence:null,description:\"\"}],returns:{type:\"xs:double\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"cos\",qname:\"math:cos\",signature:\"($theta as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the cosine of the argument, expressed in radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"cos\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"θ\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is the empty sequence, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative infinity, or <code>NaN</code>,\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the cosine of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>cos</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> exception is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative zero, the result is\\n                <code>$</code><var>θ</var>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative infinity, or <code>NaN</code>,\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise the result is always in the range -1.0e0 to +1.0e0</p></div>\\n',summary:\"<p>  Returns the cosine of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exp\",qname:\"math:exp\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <var>e</var><sup><var>x</var></sup>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"exp\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the mathematical constant <var>e</var>\\n             raised to the power of <code>$arg</code>, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>exp</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of overflow and underflow is defined in <specref ref=\"op.numeric\"/>.</p></div>\\n',summary:\"<p>  Returns the value of  e x .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exp10\",qname:\"math:exp10\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the value of <code>10</code><sup><var>x</var></sup>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"exp10\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is ten raised to the power of <code>$arg</code>,\\n             as defined in the <bibref ref=\"ieee754-2008\"/> specification of the <code>exp10</code>\\n             function applied to 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of overflow and underflow is defined in <specref ref=\"op.numeric\"/>.</p></div>\\n',summary:\"<p>  Returns the value of  10 x .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"log\",qname:\"math:log\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the natural logarithm of the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"log\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the natural logarithm of <code>$arg</code>, as\\n             defined in the <bibref ref=\"ieee754-2008\"/> specification of the <code>log</code>\\n             function applied to 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of <code>divideByZero</code> and <code>invalidOperation</code> exceptions\\n             is defined in <specref ref=\"op.numeric\"/>. The effect is that if the argument is less\\n             than or equal to zero, the result is <code>NaN</code>.</p></div>\\n',summary:\"<p>  Returns the natural logarithm of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"log10\",qname:\"math:log10\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the base-ten logarithm of the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"log10\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the base-10 logarithm of <code>$arg</code>, as\\n             defined in the <bibref ref=\"ieee754-2008\"/> specification of the <code>log10</code>\\n             function applied to 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of <code>divideByZero</code> and <code>invalidOperation</code> exceptions\\n             is defined in <specref ref=\"op.numeric\"/>. The effect is that if the argument is less\\n             than or equal to zero, the result is <code>NaN</code>.</p></div>\\n',summary:\"<p>  Returns the base-ten logarithm of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"pi\",qname:\"math:pi\",signature:\"() as xs:double external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns an approximation to the mathematical constant <var>π</var>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"pi\" return-type=\"xs:double\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"/></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function returns the <code>xs:double</code> value whose lexical representation is\\n             3.141592653589793e0</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>2*math:pi()</code> returns <code>6.283185307179586e0</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The expression <code>60 * (math:pi() div 180)</code> converts an angle of 60 degrees\\n                to radians. </p></div>\\n',summary:\"<p>  Returns an approximation to the mathematical constant  π .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:double\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"pow\",qname:\"math:pow\",signature:\"($x as xs:double?, $y as numeric) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the result of raising the first argument to the power of the\\n             second.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"pow\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"x\" type=\"xs:double?\"/><arg name=\"y\" type=\"numeric\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$x</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$y</code> is an instance of <code>xs:integer</code>, the result is\\n                <code>$x</code> raised to the power of <code>$y</code> as defined in the <bibref ref=\"ieee754-2008\"/> specification of the <code>pown</code> function applied to a\\n             64-bit binary floating point value and an integer.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise <code>$y</code> is converted to an <code>xs:double</code> by numeric\\n             promotion, and the result is the value of <code>$x</code> raised to the power of\\n                <code>$y</code> as defined in the <bibref ref=\"ieee754-2008\"/> specification of the\\n                <code>pow</code> function applied to two 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>divideByZero</code> and <code>invalidOperation</code>\\n             exceptions is defined in <specref ref=\"op.numeric\"/>. Some of the consequences are\\n             illustrated in the examples below.</p></div>\\n',summary:\"<p>  Returns the result of raising the first argument to the power of the\\n             second.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"xs:double\",occurrence:\"?\",description:\"\"},{name:\"y\",type:\"numeric\",occurrence:null,description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sin\",qname:\"math:sin\",signature:\"($theta as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the sine of the argument, expressed in radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"sin\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"θ\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is the empty sequence, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the sine of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>sin</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> and <code>underflow</code> exceptions\\n             is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative zero, the result is\\n                <code>$</code><var>θ</var>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative infinity, or <code>NaN</code>,\\n             then the result is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Otherwise the result is always in the range -1.0e0 to +1.0e0</p></div>\\n',summary:\"<p>  Returns the sine of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sqrt\",qname:\"math:sqrt\",signature:\"($arg as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the non-negative square root of the argument.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"sqrt\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"arg\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is the empty sequence, the function returns the empty sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the mathematical non-negative square root of\\n                <code>$arg</code> as defined in the <bibref ref=\"ieee754-2008\"/> specification of the\\n                <code>squareRoot</code> function applied to 64-bit binary floating point values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> exception is defined in <specref ref=\"op.numeric\"/>. The effect is that if the argument is less than zero, the result\\n             is <code>NaN</code>.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$arg</code> is positive or negative zero, positive infinity, or\\n                <code>NaN</code>, then the result is <code>$arg</code>. (Negative zero is the only\\n             case where the result can have negative sign)</p></div>\\n',summary:\"<p>  Returns the non-negative square root of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"tan\",qname:\"math:tan\",signature:\"($theta as xs:double?) as xs:double? external\",description:' <div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">Returns the tangent of the argument, expressed in radians.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\"><example role=\"signature\"><proto name=\"tan\" return-type=\"xs:double?\" isOp=\"no\" prefix=\"math\" returnEmptyOk=\"no\" returnSeq=\"no\" returnVaries=\"no\" isSchema=\"no\" isDatatype=\"no\" isSpecial=\"no\"><arg name=\"θ\" type=\"xs:double?\"/></proto></example></p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">This function is <termref def=\"dt-deterministic\">deterministic</termref>, <termref def=\"dt-context-independent\">context-independent</termref>,  and <termref def=\"dt-focus-independent\">focus-independent</termref>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is the empty sequence, the function returns the empty\\n             sequence.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\" diff=\"chg\" at=\"G\">Otherwise the result is the tangent of <code>$</code><var>θ</var>,\\n             treated as an angle in radians, as defined in the <bibref ref=\"ieee754-2008\"/>\\n             specification of the <code>tan</code> function applied to 64-bit binary floating point\\n             values.</p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">The treatment of the <code>invalidOperation</code> and <code>underflow</code> exceptions\\n             is defined in <specref ref=\"op.numeric\"/>. </p><p xmlns:e=\"http://www.w3.org/1999/XSL/Spec/ElementSyntax\">If <code>$</code><var>θ</var> is positive or negative infinity, or <code>NaN</code>,\\n             then the result is <code>NaN</code>.</p></div>\\n',summary:\"<p>  Returns the tangent of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"xs:double\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:double?\",description:\"\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/oauth/client\":{ns:\"http://www.zorba-xquery.com/modules/oauth/client\",description:' This module provides the functions necessary to acquire access to the personal\\n resources of a user through the open standard called\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://oauth.net/\" target=\"_blank\">OAuth</a>.\\n The application/mashup creator does not need to know the\\n specifics of <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://oauth.net/\" target=\"_blank\">OAuth</a> to use this module.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://oauth.net/\" target=\"_blank\">OAuth Website</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Stephanie Russell</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"mailto:william.candillon@28msec.com\">William Candillon</a></xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/features\",prefix:\"f\"},{uri:\"http://zorba.io/modules/hmac\",prefix:\"hmac\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-client\"},{uri:\"http://www.zorba-xquery.com/modules/oauth/client\",prefix:\"oauth\"},{uri:\"http://www.zorba-xquery.com/modules/oauth/error\",prefix:\"oerr\"},{uri:\"http://zorba.io/options/features\",prefix:\"op\"},{uri:\"http://www.zorba-xquery.com/schemas/oauth/parameters\",prefix:\"p\"},{uri:\"http://zorba.io/modules/random\",prefix:\"ra\"},{uri:\"http://www.zorba-xquery.com/schemas/oauth/service-provider\",prefix:\"sp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"access-token\",qname:\"oauth:access-token\",signature:\"($service-provider as schema-element(sp:service-provider), $parameters as schema-element(p:parameters)) as schema-element(p:parameters)\",description:\" This function allows the client to obtain a set of token credentials from the service provider by making an authenticated HTTP request to the Token Request endpoint.\\n This function is provided for convenience.\\n\",summary:\"<p> This function allows the client to obtain a set of token credentials from the service provider by making an authenticated HTTP request to the Token Request endpoint.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"service-provider\",type:\"schema-element(sp:service-provider)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Contains service provider information</div>'},{name:\"parameters\",type:\"schema-element(p:parameters)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameters</div>'}],returns:{type:\"schema-element(p:parameters)\",description:'token credentials correctly parsed as parameter elements, or an error if http response status is not 200 OK <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\"> let $service-provider := oauth:service-provider(...) let $parameters := oauth:parameters(\"oauth_token\", \"#\") let $parameters := oauth:add-parameter($parameters, \"oauth_token_secret\", \"#\") let $tokens := oauth:access-token($service-provider, $parameters) ... </pre>'},errors:[]},{isDocumented:!0,arity:3,name:\"add-parameter\",qname:\"oauth:add-parameter\",signature:\"($parameters as schema-element(p:parameters)?, $name as xs:string, $value as xs:string) as schema-element(p:parameters)\",description:' Adds an OAuth parameter to an OAuth Parameters instance.\\n Instances of OAuth parameters are used to\\n contain value/pair data such as <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">oauth_token</em>\\n and <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">oauth_token_secret</em>.\\n For instance the following code snippet:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n  let $params := oauth:parameters(\"oauth_token\", \"#\")\\n  let $params := oauth:add-parameter($params, \"oauth_token_secret\", \"#\")\\n  return $params\\n </pre>\\n Returns the following XML schema instance:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n <p:parameters xmlns:p=\"http://www.zorba-xquery.com/schemas/oauth/parameters\">\\n   <p:parameter name=\"oauth_token\" value=\"#\"/>\\n   <p:parameter name=\"oauth_token_secret\" value=\"#\"/>\\n </p:parameters>\\n </pre>\\n',summary:\"<p> Adds an OAuth parameter to an OAuth Parameters instance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"parameters\",type:\"schema-element(p:parameters)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameters</div>'},{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameter name</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameter value</div>'}],returns:{type:\"schema-element(p:parameters)\",description:\"instance of the OAuth parameters XML schema.\"},errors:[]},{isDocumented:!0,arity:2,name:\"parameter\",qname:\"oauth:parameter\",signature:\"($params as schema-element(p:parameters), $string as xs:string) as xs:string\",description:\" This function returns the string value of the parameters whose key matches a $string input.\\n\",summary:\"<p> This function returns the string value of the parameters whose key matches a $string input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"params\",type:\"schema-element(p:parameters)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> element parameters</div>'},{name:\"string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> string as the \"key\" name</div>'}],returns:{type:\"xs:string\",description:'string value of the parameter with key $string <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\"> let $params := oauth:parameters(\"oauth_token\", \"token\") let $params := oauth:add-parameter($params, \"oauth_token_secret\", \"secret\") let $token-secret := oauth:parameter($params, \"oauth_token_secret\") return $token-secret </pre>'},errors:[]},{isDocumented:!0,arity:2,name:\"parameters\",qname:\"oauth:parameters\",signature:\"($name as xs:string, $value as xs:string) as element(p:parameters)\",description:' Create an OAuth Parameters instance.\\n Instances of OAuth parameters are used to\\n contain value/pair data such as <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">oauth_token</em>\\n and <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">oauth_token_secret</em>.\\n For instance the following code snippet:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n  oauth:parameters(\"oauth_token\", \"#\")\\n </pre>\\n Returns the following XML schema instance:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xml\">\\n <p:parameters xmlns:p=\"http://www.zorba-xquery.com/schemas/oauth/parameters\">\\n   <p:parameter name=\"oauth_token\" value=\"#\"/>\\n </p:parameters>\\n </pre>\\n',summary:\"<p> Create an OAuth Parameters instance.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameter name</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameter value</div>'}],returns:{type:\"element(p:parameters)\",description:\"instance of the OAuth parameters XML schema.\"},errors:[]},{isDocumented:!0,arity:3,name:\"protected-resource\",qname:\"oauth:protected-resource\",signature:\"($protected-resource as schema-element(http:request), $service-provider as schema-element(sp:service-provider), $parameters as schema-element(p:parameters)) as item()*\",description:\" This function allows the client access to the protected resources of the user.\\n This function is provided for convenience.\\n\",summary:\"<p> This function allows the client access to the protected resources of the user.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"protected-resource\",type:\"schema-element(http:request)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> (Not schema-validated) http:request element with http method and href.</div>'},{name:\"service-provider\",type:\"schema-element(sp:service-provider)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Information about the service provider</div>'},{name:\"parameters\",type:\"schema-element(p:parameters)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> parameters</div>'}],returns:{type:\"item()*\",description:'protected resources parsed as parameter elements, or an error if http response status is not 200 OK <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\"> let $tokens := oauth:parameters(\"oauth_token\", \"#\") let $tokens := oauth:add-parameter($tokens, \"oauth_token_secret\", \"#\") let $service-provider := oauth:service-provider(...) let $request := validate { <request xmlns=\"http://expath.org/ns/http-client\" href=\"http://twitter.com/account/verify_credentials.xml\" method=\"GET\"/> } return oauth:protected-resource($request, $service-provider, $tokens) </pre>'},errors:[]},{isDocumented:!0,arity:1,name:\"request-token\",qname:\"oauth:request-token\",signature:\"($service-provider as schema-element(sp:service-provider)) as schema-element(p:parameters)\",description:' This function allows the client to obtain a set of temporary credentials from the service provider by making an authenticated HTTP request to the Temporary Credential Request endpoint.\\n This function is provided for convenience for <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#request-token-2\">request-token#2</a>.\\n Invoking this function is equivalent to:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n oauth:request-token($service-provider, ())\\n </pre>\\n',summary:\"<p> This function allows the client to obtain a set of temporary credentials from the service provider by making an authenticated HTTP request to the Temporary Credential Request endpoint.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"service-provider\",type:\"schema-element(sp:service-provider)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Information about the service provider</div>'}],returns:{type:\"schema-element(p:parameters)\",description:\"temporary credentials correctly parsed as parameter elements, or an error if http response status is not 200 OK\"},errors:[]},{isDocumented:!0,arity:2,name:\"request-token\",qname:\"oauth:request-token\",signature:\"($service-provider as schema-element(sp:service-provider), $parameters as schema-element(p:parameters)?) as schema-element(p:parameters)\",description:\" This function allows the client to obtain a set of temporary credentials from the service provider by making an authenticated HTTP request to the Temporary Credential Request endpoint.\\n This function is provided for convenience.\\n\",summary:\"<p> This function allows the client to obtain a set of temporary credentials from the service provider by making an authenticated HTTP request to the Temporary Credential Request endpoint.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"service-provider\",type:\"schema-element(sp:service-provider)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Information about the service provider</div>'},{name:\"parameters\",type:\"schema-element(p:parameters)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Additionnal parameters to the request</div>'}],returns:{type:\"schema-element(p:parameters)\",description:'temporary credentials correctly parsed as parameter elements, or an error if http response status is not 200 OK <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\"> let $twitter-config := oauth:service-provider(...) let $additional-parameter := oauth:parameters(\"foo\", \"bar\") let $tokens := oauth:request-token($twitter-config, $additional-parameter) let $token := oauth:parameter($tokens, \"oauth_token\") let $token-secret := oauth:parameter($tokens, \"oauth_token_secret\") ... </pre>'},errors:[]},{isDocumented:!0,arity:10,name:\"service-provider\",qname:\"oauth:service-provider\",signature:\"($consumer-key as xs:string, $consumer-secret as xs:string, $signature-method as xs:string, $realm as xs:string, $authorize-url as xs:string, $request-token-method as xs:string, $request-token-url as xs:string, $request-token-callback-url as xs:string, $access-token-method as xs:string, $access-token-url as xs:string) as schema-element(sp:service-provider)\",description:' Utility function to build a service provider object.\\n This object contains the information required by the\\n OAuth client to interact with an OAuth service provider.\\n For instance the following expression:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n let $consumer-key     := \"#\"\\n let $consumer-secret  := \"#\"\\n let $signature-method := \"HMAC-SHA1\"\\n let $realm            := \"twitter.com\"\\n let $authorize-url    := \"http://api.twitter.com/oauth/authorize\"\\n let $request-token-method := \"POST\"\\n let $request-token-url := \"https://twitter.com/oauth/request_token\"\\n let $request-token-callback-url := \"https://twitter.com/oauth/request_token\"\\n let $access-token-method := \"POST\"\\n let $access-token-url := \"https://api.twitter.com/oauth/access_token\"\\n return oauth:service-provider(\\n   $consumer-key, $consumer-secret, $signature-method,\\n   $realm, $authorize-url, $request-token-method,\\n   $request-token-url, $request-token-callback-url,\\n   $access-token-method, $access-token-url\\n )\\n </pre>\\n Will return the following XML schema instance:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xml\">\\n <sp:service-provider xmlns:sp=\"http://www.zorba-xquery.com/schemas/oauth/service-provider\" consumer-key=\"#\" consumer-secret=\"#\" signature-method=\"HMAC-SHA1\" realm=\"twitter.com\" authorize-url=\"http://api.twitter.com/oauth/authorize\">\\n   <sp:request-token method=\"POST\" href=\"https://twitter.com/oauth/request_token\" callback-url=\"https://twitter.com/oauth/request_token\"/>\\n   <sp:access-token method=\"POST\" href=\"https://api.twitter.com/oauth/access_token\"/>\\n </sp:service-provider>\\n </pre>\\n',summary:\"<p> Utility function to build a service provider object.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"consumer-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Client Identifier, also known as the consumer-key</div>'},{name:\"consumer-secret\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Client Shared-Secret, also known as the consumer-secret</div>'},{name:\"signature-method\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Method with which the signing key is signed (typically HMAC-SHA1)</div>'},{name:\"realm\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Realm that defines the protection space</div>'},{name:\"authorize-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> authorize-url</div>'},{name:\"request-token-method\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> request-token-method</div>'},{name:\"request-token-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> request-token-url</div>'},{name:\"request-token-callback-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> request-token-callback-url</div>'},{name:\"access-token-method\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> access-token-method</div>'},{name:\"access-token-url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> access-token-url</div>'}],returns:{type:\"schema-element(sp:service-provider)\",description:\"instance of the OAuth service provider XML schema.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/http/util/multipart\":{ns:\"http://www.28msec.com/modules/http/util/multipart\",description:\" This module provides utility functions to help dealing with the\\n content of multipart requests.\\n In their implementation, all the functions use the multipart\\n related functions of the request module (e.g. parts() or text-part()).\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.28msec.com/modules/http/util/multipart\",prefix:\"multipart\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"binary-content\",qname:\"multipart:binary-content\",signature:\"($name as xs:string) as xs:base64Binary*\",description:\" Returns the contents of the parts/files in the multipart requests with\\n the given part name as xs:base64Binary.\\n\",summary:\"<p> Returns the contents of the parts/files in the multipart requests with\\n the given part name as xs:base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"xs:base64Binary*\",description:\"the said content or the empty sequence if no part with the given name exists.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"binary-file\",qname:\"multipart:binary-file\",signature:\"($filename as xs:string) as xs:base64Binary*\",description:\" Returns the contents of the part/file in the multipart requests with\\n the given filename as xs:base64Binary.\\n Please note that the file is identified by the filename (and not the\\n name of the part) that is contained in the Content-Disposition header\\n of the part.\\n\",summary:\"<p> Returns the contents of the part/file in the multipart requests with\\n the given filename as xs:base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filename\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested file.</div>'}],returns:{type:\"xs:base64Binary*\",description:\"the said content or the empty sequence if no part with the given filename exists.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"content-length\",qname:\"multipart:content-length\",signature:\"($name as xs:string) as xs:integer*\",description:\" Returns the content length of the parts/files in the multipart requests with\\n the given part name as xs:integer.\\n\",summary:\"<p> Returns the content length of the parts/files in the multipart requests with\\n the given part name as xs:integer.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"xs:integer*\",description:\"The content-length in bytes of the parts/files or the empty sequence if the part does not exist\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"content-type\",qname:\"multipart:content-type\",signature:\"($name as xs:string) as xs:string*\",description:\" Returns the content type of the parts/files in the multipart requests with\\n the given part name as xs:string.\\n\",summary:\"<p> Returns the content type of the parts/files in the multipart requests with\\n the given part name as xs:string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"xs:string*\",description:\"The content-types of the parts/files or the empty sequence if the part does not exist\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"filename\",qname:\"multipart:filename\",signature:\"($name as xs:string) as xs:string*\",description:\" Returns the filenames of the parts/files in the multipart requests with\\n the given part name as xs:string.\\n\",summary:\"<p> Returns the filenames of the parts/files in the multipart requests with\\n the given part name as xs:string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"xs:string*\",description:\"The filename of the parts/files or the empty sequence if the part does not exist\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"filenames\",qname:\"multipart:filenames\",signature:\"() as xs:string*\",description:\" Returns the filenames of all the parts contained in the multipart\\n content of the given request.\\n\",summary:\"<p> Returns the filenames of all the parts contained in the multipart\\n content of the given request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"the said filenames\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"names\",qname:\"multipart:names\",signature:\"() as xs:string*\",description:\" Returns the names of all the parts contained in the multipart\\n content of the given request.\\n\",summary:\"<p> Returns the names of all the parts contained in the multipart\\n content of the given request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"the said names\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"part\",qname:\"multipart:part\",signature:\"($name as xs:string) as element(req:part)*\",description:' Returns the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">req:part</tt> element among all the parts contained\\n in the multipart requests with the given name.\\n',summary:\"<p> Returns the  req:part  element among all the parts contained\\n in the multipart requests with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"element(req:part)*\",description:\"the said part elements or the empty sequence if no part with the given name exists.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-content\",qname:\"multipart:text-content\",signature:\"($name as xs:string) as xs:string*\",description:\" Returns the contents of the parts/files in the multipart requests with\\n the given part name as a string.\\n It is assumed that the character set of the file is UTF-8.\\n\",summary:\"<p> Returns the contents of the parts/files in the multipart requests with\\n the given part name as a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested part.</div>'}],returns:{type:\"xs:string*\",description:\"the said content or the empty sequence if no part with the given filename exists.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-file\",qname:\"multipart:text-file\",signature:\"($filename as xs:string) as xs:string*\",description:\" Returns the contents of the part/file in the multipart requests with\\n the given filename as a string.\\n It is assumed that the character set of the file is UTF-8.\\n Please note that the file is identified by the filename (and not the\\n name of the part) that is contained in the Content-Disposition header\\n of the part.\\n\",summary:\"<p> Returns the contents of the part/file in the multipart requests with\\n the given filename as a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filename\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the requested file.</div>'}],returns:{type:\"xs:string*\",description:\"the said content or the empty sequence if no part with the given filename exists.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/excel/statistical-zorba\":{ns:\"http://zorba.io/modules/excel/statistical-zorba\",description:\" This module implements some Excel 2003 statistical functions\\n that cannot be implemented with standard XQuery functions.\\n It uses Zorba specific functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://office.microsoft.com/en-us/excel/CH062528311033.aspx</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Turcanu</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/statistical-zorba\",prefix:\"excel\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/modules/excel/statistical\",prefix:\"excel-statistical\"},{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"stdev\",qname:\"excel:stdev\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Estimates standard deviation based on a sample.\\n The standard deviation is a measure of how widely values are dispersed\\n   from the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / (n-1) )    = sqrt ( VAR(numbers) )\\n\",summary:\"<p> Estimates standard deviation based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the standard deviation, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"stdeva\",qname:\"excel:stdeva\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Estimates standard deviation based on a sample.\\n The standard deviation is a measure of how widely values are dispersed\\n   from the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / (n-1) )    = sqrt ( VARA(numbers) )\\n\",summary:\"<p> Estimates standard deviation based on a sample.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the standard deviation, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"stdevp\",qname:\"excel:stdevp\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Calculates standard deviation based on the entire population given as arguments.\\n The standard deviation is a measure of how widely values are dispersed from\\n   the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / n )    = sqrt ( VARP(numbers) )\\n\",summary:\"<p> Calculates standard deviation based on the entire population given as arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the standard deviation, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"stdevpa\",qname:\"excel:stdevpa\",signature:\"($numbers as xs:anyAtomicType+) as xs:anyAtomicType\",description:\" Calculates standard deviation based on the entire population given as arguments.\\n The standard deviation is a measure of how widely values are dispersed from\\n   the average value (the mean).\\n It is computed with formula:\\n sqrt( sum((x-average_x)^2) / n )    = sqrt ( VARPA(numbers) )\\n\",summary:\"<p> Calculates standard deviation based on the entire population given as arguments.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric The sequence can be of any length, from 1 up.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"the standard deviation, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if the parameters cannot be casted to numeric type</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"subtotal\",qname:\"excel:subtotal\",signature:\"($function_num as xs:integer, $numbers as xs:anyAtomicType*) as xs:anyAtomicType\",description:\" Moved from math module.\\n Returns a subtotal in a sequence of numbers.\\n The function applied is given by $function_num.\\n\",summary:\"<p> Moved from math module.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"function_num\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <dl>defines the function to be applied on sequence values. The possible values are: <dt>1 or 101</dt> <dd> AVERAGE</dd> <dt>2 or 102</dt> <dd> COUNT</dd> <dt>3 or 103</dt> <dd> COUNTA</dd> <dt>4 or 104</dt> <dd> MAX</dd> <dt>5 or 105</dt> <dd> MIN</dd> <dt>6 or 106</dt> <dd> PRODUCT</dd> <dt>7 or 107</dt> <dd> STDEV</dd> <dt>8 or 108</dt> <dd> STDEVP</dd> <dt>9 or 109</dt> <dd> SUM</dd> <dt>10 or 110</dt> <dd> VAR</dd> <dt>11 or 111</dt> <dd> VARP</dd></dl> In this implementation there is no difference between x and 10x.<p/></div>'},{name:\"numbers\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of numbers or values castable to numeric. The sequence can be of any length.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"The function result, as numeric type\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">depends on the function called</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if $function_num is not a value between 1 .. 11 or 101 .. 111</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/debug\":{ns:\"http://www.28msec.com/modules/debug\",description:\" This module contains internal debug functions.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/debug\",prefix:\"debug\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"non-seeakable-streamable-string\",qname:\"debug:non-seeakable-streamable-string\",signature:\"() as string external\",description:\" Returns a non seekable streamable string\\n\",summary:\"<p> Returns a non seekable streamable string\\n</p>\",annotation_str:\" %an:deterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"deterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"a non seekable streamable string\"},errors:[]},{isDocumented:!0,arity:1,name:\"test-01-cache\",qname:\"debug:test-01-cache\",signature:\"($arg as xs:integer) as item()* external\",description:' Equivalent to:\\n declare %an:cache function local:test-01-cache($x as xs:integer)\\n {\\n  if ($x &lt; 10)\\n  then $x * $x\\n  else if ($x &lt; 20)\\n  then ()\\n  else ($x, \" == \", $x * $x)\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:cache function local:test-01-cache($x as xs:integer)\\n {\\n  if ($x &lt; 10)\\n  then $x * $x\\n  else if ($x &lt; 20)\\n  then ()\\n  else ($x, \" == \", $x * $x)\\n };\\n</p>',annotation_str:\" %an:cache\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"cache\",value:\"\"}],updating:!1,parameters:[{name:\"arg\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:1,name:\"test-01-sd\",qname:\"debug:test-01-sd\",signature:\"($arg as xs:integer) as item()* external\",description:' Equivalent to:\\n declare %an:strictlydeterministic function local:test-01-sd($x as xs:integer)\\n {\\n  if ($x &lt; 10)\\n  then $x * $x\\n  else if ($x &lt; 20)\\n  then ()\\n  else ($x, \" == \", $x * $x)\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:strictlydeterministic function local:test-01-sd($x as xs:integer)\\n {\\n  if ($x &lt; 10)\\n  then $x * $x\\n  else if ($x &lt; 20)\\n  then ()\\n  else ($x, \" == \", $x * $x)\\n };\\n</p>',annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"arg\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:1,name:\"test-02-cache\",qname:\"debug:test-02-cache\",signature:\"($arg) as item()* external\",description:\" Equivalent to:\\n declare %an:cache function local:test-02-cache($arg)\\n {\\n   serialize($arg),\\n   uuid:uuid()\\n };\\n\",summary:\"<p> Equivalent to:\\n declare %an:cache function local:test-02-cache($arg)\\n {\\n   serialize($arg),\\n   uuid:uuid()\\n };\\n</p>\",annotation_str:\" %an:cache\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"cache\",value:\"\"}],updating:!1,parameters:[{name:\"arg\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:1,name:\"test-02-sd\",qname:\"debug:test-02-sd\",signature:\"($arg) as item()* external\",description:\" Equivalent to:\\n declare %an:strictlydeterministic function local:test-02-sd($arg)\\n {\\n   serialize($arg),\\n   uuid:uuid()\\n };\\n\",summary:\"<p> Equivalent to:\\n declare %an:strictlydeterministic function local:test-02-sd($arg)\\n {\\n   serialize($arg),\\n   uuid:uuid()\\n };\\n</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"arg\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:0,name:\"test-03-cache\",qname:\"debug:test-03-cache\",signature:\"() as item()* external\",description:' Equivalent to:\\n declare %an:cache function local:test-03-cache()\\n {\\n   { \"a\" : 1 },\\n   [1],\\n   &lt;a/&gt;,\\n   1\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:cache function local:test-03-cache()\\n {\\n   { \"a\" : 1 },\\n   [1],\\n   &lt;a/&gt;,\\n   1\\n };\\n</p>',annotation_str:\" %an:cache\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"cache\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:0,name:\"test-03-sd\",qname:\"debug:test-03-sd\",signature:\"() as item()* external\",description:' Equivalent to:\\n declare %an:strictlydeterministic function local:test-03-sd()\\n {\\n   { \"a\" : 1 },\\n   [1],\\n   &lt;a/&gt;,\\n   1\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:strictlydeterministic function local:test-03-sd()\\n {\\n   { \"a\" : 1 },\\n   [1],\\n   &lt;a/&gt;,\\n   1\\n };\\n</p>',annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:2,name:\"test-04-cache\",qname:\"debug:test-04-cache\",signature:\"($x, $y) as item()* external\",description:' Equivalent to:\\n declare %an:cache function local:test-04-cache($x, $y)\\n {\\n   debug:non-seeakable-streamable-string(),\\n   {\"key\" : debug:non-seeakable-streamable-string()},\\n   [debug:non-seeakable-streamable-string()],\\n   &lt;a&gt;{debug:non-seeakable-streamable-string()}&lt;/a&gt;\\n   serialize($x),\\n   serialize($y)\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:cache function local:test-04-cache($x, $y)\\n {\\n   debug:non-seeakable-streamable-string(),\\n   {\"key\" : debug:non-seeakable-streamable-string()},\\n   [debug:non-seeakable-streamable-string()],\\n   &lt;a&gt;{debug:non-seeakable-streamable-string()}&lt;/a&gt;\\n   serialize($x),\\n   serialize($y)\\n };\\n</p>',annotation_str:\" %an:cache\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"cache\",value:\"\"}],updating:!1,parameters:[{name:\"x\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'},{name:\"y\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:2,name:\"test-04-sd\",qname:\"debug:test-04-sd\",signature:\"($x, $y) as item()* external\",description:' Equivalent to:\\n declare %an:strictlydeterministic function local:test-04-sd($x, $y)\\n {\\n   debug:non-seeakable-streamable-string(),\\n   {\"key\" : debug:non-seeakable-streamable-string()},\\n   [debug:non-seeakable-streamable-string()],\\n   &lt;a&gt;{debug:non-seeakable-streamable-string()}&lt;/a&gt;\\n   serialize($x),\\n   serialize($y)\\n };\\n',summary:'<p> Equivalent to:\\n declare %an:strictlydeterministic function local:test-04-sd($x, $y)\\n {\\n   debug:non-seeakable-streamable-string(),\\n   {\"key\" : debug:non-seeakable-streamable-string()},\\n   [debug:non-seeakable-streamable-string()],\\n   &lt;a&gt;{debug:non-seeakable-streamable-string()}&lt;/a&gt;\\n   serialize($x),\\n   serialize($y)\\n };\\n</p>',annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"x\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'},{name:\"y\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:2,name:\"test-05-cache\",qname:\"debug:test-05-cache\",signature:\"($x as xs:boolean, $y) as item()* external\",description:\" Equivalent to:\\n declare %an:cache function local:test-05-cache($x as xs:boolean, $y)\\n {\\n   if ($x)\\n   then $y\\n   else $x\\n };\\n\",summary:\"<p> Equivalent to:\\n declare %an:cache function local:test-05-cache($x as xs:boolean, $y)\\n {\\n   if ($x)\\n   then $y\\n   else $x\\n };\\n</p>\",annotation_str:\" %an:cache\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"cache\",value:\"\"}],updating:!1,parameters:[{name:\"x\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'},{name:\"y\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:2,name:\"test-05-sd\",qname:\"debug:test-05-sd\",signature:\"($x as xs:boolean, $y) as item()* external\",description:\" Equivalent to:\\n declare %an:strictlydeterministic function local:test-05-sd($x as xs:boolean, $y)\\n {\\n   if ($x)\\n   then $y\\n   else $x\\n };\\n\",summary:\"<p> Equivalent to:\\n declare %an:strictlydeterministic function local:test-05-sd($x as xs:boolean, $y)\\n {\\n   if ($x)\\n   then $y\\n   else $x\\n };\\n</p>\",annotation_str:\" %an:strictlydeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"strictlydeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"x\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'},{name:\"y\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> as described above</div>'}],returns:{type:\"item()*\",description:\"as described above\"},errors:[]},{isDocumented:!0,arity:0,name:\"uuid\",qname:\"debug:uuid\",signature:\"() as string external\",description:\" This function is not deterministic despite the annotation\\n\",summary:\"<p> This function is not deterministic despite the annotation\\n</p>\",annotation_str:\" %an:deterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"deterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"a uuid\"},errors:[]}],variables:[]},\"http://zorba.io/modules/json-xml\":{ns:\"http://zorba.io/modules/json-xml\",description:' Using this module, you can parse JSON data into XML, manipulate it like any\\n other XML data using XQuery, and serialize the result back as JSON.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n There are many ways to represent JSON data in XML, some loss-less (\"round\\n tripable\") and some lossy (\"one way\").  Loss-less representations preserve\\n the JSON data types <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">boolean</i>, <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">number</i>, and <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">null</i>; lossy\\n representations convert all data to strings.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For a loss-less representation, this module implements that proposed by\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://john.snelson.org.uk/parsing-json-into-xquery\">John Snelson</a>.\\n For example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n   {\\n     \"firstName\" : \"John\",\\n     \"lastName\" : \"Smith\",\\n     \"address\" : {\\n       \"streetAddress\" : \"21 2nd Street\",\\n       \"city\" : \"New York\",\\n       \"state\" : \"NY\",\\n       \"postalCode\" : 10021\\n     },\\n     \"phoneNumbers\" : [ \"212 732-1234\", \"646 123-4567\" ]\\n   }\\n </pre>\\n would be represented as:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n   &lt;json type=\"object\"&gt;\\n     &lt;pair name=\"firstName\" type=\"string\"&gt;John&lt;/pair&gt;\\n     &lt;pair name=\"lastName\" type=\"string\"&gt;Smith&lt;/pair&gt;\\n     &lt;pair name=\"address\" type=\"object\"&gt;\\n       &lt;pair name=\"streetAddress\" type=\"string\"&gt;21 2nd Street&lt;/pair&gt;\\n       &lt;pair name=\"city\" type=\"string\"&gt;New York&lt;/pair&gt;\\n       &lt;pair name=\"state\" type=\"string\"&gt;NY&lt;/pair&gt;\\n       &lt;pair name=\"postalCode\" type=\"number\"&gt;10021&lt;/pair&gt;\\n     &lt;/pair&gt;\\n     &lt;pair name=\"phoneNumbers\" type=\"array\"&gt;\\n       &lt;item type=\"string\"&gt;212 732-1234&lt;/item&gt;\\n       &lt;item type=\"string\"&gt;646 123-4567&lt;/item&gt;\\n     &lt;/pair&gt;\\n   &lt;/json&gt;\\n </pre>\\n For a lossy representation, this module implements\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://jsonml.org/\">JsonML</a> (the array form).\\n For example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n   [ \"person\",\\n     { \"created\" : \"2006-11-11T19:23\",\\n       \"modified\" : \"2006-12-31T23:59\" },\\n     [ \"firstName\", \"Robert\" ],\\n     [ \"lastName\", \"Smith\" ],\\n     [ \"address\",\\n       { \"type\" : \"home\" },\\n       [ \"street\", \"12345 Sixth Ave\" ],\\n       [ \"city\", \"Anytown\" ],\\n       [ \"state\", \"CA\" ],\\n       [ \"postalCode\", \"98765-4321\" ]\\n     ]\\n   ]\\n </pre>\\n would be represented as:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n   &lt;person created=\"2006-11-11T19:23\" modified=\"2006-12-31T23:59\"&gt;\\n     &lt;firstName&gt;Robert&lt;/firstName&gt;\\n     &lt;lastName&gt;Smith&lt;/lastName&gt;\\n     &lt;address type=\"home\"&gt;\\n       &lt;street&gt;12345 Sixth Ave&lt;/street&gt;\\n       &lt;city&gt;Anytown&lt;/city&gt;\\n       &lt;state&gt;CA&lt;/state&gt;\\n       &lt;postalCode&gt;98765-4321&lt;/postalCode&gt;\\n     &lt;/address&gt;\\n   &lt;/person&gt;\\n </pre>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/json-xml\",prefix:\"jx\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"json-to-xml\",qname:\"jx:json-to-xml\",signature:\"($json as json-item()?) as element(*,xs:untyped)?\",description:' Converts JSON data into an XDM instance using the Snelson representation\\n described above.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Converts JSON data into an XDM instance using the Snelson representation\\n described above.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"json\",type:\"json-item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The JSON data.</div>'}],returns:{type:\"element(*,xs:untyped)?\",description:\"said XDM instance.\"},errors:[]},{isDocumented:!0,arity:2,name:\"json-to-xml\",qname:\"jx:json-to-xml\",signature:\"($json as json-item()?, $options as object()) as element(*,xs:untyped)?\",description:' Converts JSON data into an XDM instance using one of the representations\\n described above.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Converts JSON data into an XDM instance using one of the representations\\n described above.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"json\",type:\"json-item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The JSON data.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The JSON conversion options, for example: <pre> { \"json-format\" : \"JsonML-array\" } </pre></div>'}],returns:{type:\"element(*,xs:untyped)?\",description:\"said XDM instance.\"},errors:[]},{isDocumented:!0,arity:1,name:\"xml-to-json\",qname:\"jx:xml-to-json\",signature:\"($xml as item()*) as json-item()*\",description:' Converts XML data into a JSON item using the Snelson representation\\n described above.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Converts XML data into a JSON item using the Snelson representation\\n described above.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The XML data to convert.</div>'}],returns:{type:\"json-item()*\",description:\"said JSON items.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0001 if $xml is not a document or element node.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0002 if $xml contains an element that is missing a required attribute.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0003 if $xml contains an attribute having an illegal value.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0004 if $xml contains an illegal element. type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0007 if $xml contains an element that is missing a required value.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"xml-to-json\",qname:\"jx:xml-to-json\",signature:\"($xml as item()*, $options as object()) as json-item()*\",description:' Converts XML data into a JSON item using one of the respresentations\\n described above.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Converts XML data into a JSON item using one of the respresentations\\n described above.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xml\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The XML data to convert.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The conversion options, for example: <pre> { \"json-format\" : \"JsonML-array\" } </pre></div>'}],returns:{type:\"json-item()*\",description:\"said JSON items.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0001 if $xml is not a document or element node.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0002 if $xml contains an element that is missing a required attribute.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0003 if $xml contains an attribute having an illegal value.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0004 if $xml contains an illegal element. type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0007 if $xml contains an element that is missing a required value.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZJSE0008 if $xml contains an illegal value for a JSON type.</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/image/manipulation\":{ns:\"http://www.zorba-xquery.com/modules/image/manipulation\",description:' This module provides functions to handle image manipulations like resizing, zooming,\\n special effects etc.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The errors raised by functions of this module have the namespace\\n <tt>http://www.zorba-xquery.com/modules/image/error</tt> (associated with prefix ierr).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Thomas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/image/error\",prefix:\"ierr\"},{uri:\"http://www.zorba-xquery.com/modules/image/image\",prefix:\"image\"},{uri:\"http://www.zorba-xquery.com/modules/image/manipulation\",prefix:\"man\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"add-noise\",qname:\"man:add-noise\",signature:\"($image as xs:base64Binary, $noise-type as xs:string) as xs:base64Binary\",description:' Add noise to an image.\\n Allowed noise types are:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li>UniformNoise</li>\\n  <li>GaussianNoise</li>\\n  <li>MultiplicativeGaussianNoise</li>\\n  <li>ImpulseNoise</li>\\n  <li>LaplaceianNoise</li>\\n  <li>PoissonNoise</li>\\n </ul>\\n',summary:\"<p> Add noise to an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"noise-type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> specifies the type of noise to add</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with added noise\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 unsupported noise type</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"blur\",qname:\"man:blur\",signature:\"($image as xs:base64Binary, $radius as xs:int, $sigma as xs:int) as xs:base64Binary external\",description:\" Blur an image.\\n\",summary:\"<p> Blur an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"radius\",type:\"xs:int\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the radius of the Gaussian in pixels.</div>'},{name:\"sigma\",type:\"xs:int\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the standard deviation of the Laplacian in pixels.</div>'}],returns:{type:\"xs:base64Binary\",description:\"A blured copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"charcoal\",qname:\"man:charcoal\",signature:\"($image as xs:base64Binary, $radius as xs:double, $sigma as xs:double) as xs:base64Binary external\",description:\" Apply a charcoal effect to the image (looks like a charcoal sketch).\\n\",summary:\"<p> Apply a charcoal effect to the image (looks like a charcoal sketch).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"radius\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> radius of the Gaussian in pixels</div>'},{name:\"sigma\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> standard deviation of the Laplacian in pixels</div>'}],returns:{type:\"xs:base64Binary\",description:\"A charcoaled copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"chop\",qname:\"man:chop\",signature:\"($image as xs:base64Binary, $upper-left-x as xs:unsignedInt, $upper-left-y as xs:unsignedInt) as xs:base64Binary external\",description:\" Copy a part of a source image as new image.\\n The copied part is all right of $upper-left-x and below $upper-left-y.\\n\",summary:\"<p> Copy a part of a source image as new image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> source image</div>'},{name:\"upper-left-x\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> x position of the upper left corner of the part to copy</div>'},{name:\"upper-left-y\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> y position of the upper left corner of the part to copy</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image copied from a part of source image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"contrast\",qname:\"man:contrast\",signature:\"($image as xs:base64Binary, $sharpen as xs:double) as xs:base64Binary external\",description:\" Contrast an image (enhances image intensity differences) by a given value.\\n\",summary:\"<p> Contrast an image (enhances image intensity differences) by a given value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"sharpen\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> defines how much the image is contrasted.</div>'}],returns:{type:\"xs:base64Binary\",description:\"A contrasted copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"crop\",qname:\"man:crop\",signature:\"($image as xs:base64Binary, $lower-right-x as xs:unsignedInt, $lower-right-y as xs:unsignedInt) as xs:base64Binary external\",description:\" Copy a part of a source image as new image.\\n The copied part is all left of $lower-right-x and above $lower-right-y.\\n\",summary:\"<p> Copy a part of a source image as new image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> source image</div>'},{name:\"lower-right-x\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> x position of the lower right corner of the part to copy</div>'},{name:\"lower-right-y\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> y position of the lower right corner of the part to copy</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image copied from a part of source image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"despeckle\",qname:\"man:despeckle\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Despeckle an image.\\n\",summary:\"<p> Despeckle an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A despeckled copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"edge\",qname:\"man:edge\",signature:\"($image as xs:base64Binary, $radius as xs:unsignedInt) as xs:base64Binary external\",description:\" Highlight edges in an image.\\n\",summary:\"<p> Highlight edges in an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"radius\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> radius of the pixel neighborhood (0 for automatic selection)</div>'}],returns:{type:\"xs:base64Binary\",description:\"An edged copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"emboss\",qname:\"man:emboss\",signature:\"($image as xs:base64Binary, $radius as xs:double, $sigma as xs:double) as xs:base64Binary external\",description:\" Emboss an images (highlights edges with 3D effect).\\n\",summary:\"<p> Emboss an images (highlights edges with 3D effect).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"radius\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> radius of the Gaussian in pixels</div>'},{name:\"sigma\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> standard deviation of the Laplacian in pixels</div>'}],returns:{type:\"xs:base64Binary\",description:\"An embossed copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"enhance\",qname:\"man:enhance\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Enhance an images (minimizes noise).\\n\",summary:\"<p> Enhance an images (minimizes noise).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"An enhanced copy of $image.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"equalize\",qname:\"man:equalize\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Equalize an images (histogramm equalization).\\n\",summary:\"<p> Equalize an images (histogramm equalization).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"An equalized copy of $image.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"erase\",qname:\"man:erase\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Set all pixels of the image to the current backround color.\\n In most cases, this will result in all pixels to be set to white.\\n\",summary:\"<p> Set all pixels of the image to the current backround color.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to erase</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of image with all pixels set to the current background color\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"flip\",qname:\"man:flip\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Flip an image (vertical rotation).\\n\",summary:\"<p> Flip an image (vertical rotation).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A vertically rotated copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"flop\",qname:\"man:flop\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Flop an image (horizontal rotation).\\n\",summary:\"<p> Flop an image (horizontal rotation).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A horizontally rotated copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"gamma\",qname:\"man:gamma\",signature:\"($image as xs:base64Binary, $gamma-value as xs:double) as xs:base64Binary external\",description:\" Gamma correct an image.\\n Gamma values less than zero will erase the image.\\n\",summary:\"<p> Gamma correct an image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"gamma-value\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value for which to gamma correct the image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A gamma corrected copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"gamma\",qname:\"man:gamma\",signature:\"($image as xs:base64Binary, $gamma-red as xs:double, $gamma-green as xs:double, $gamma-blue as xs:double) as xs:base64Binary external\",description:\" Gamma correct an image for every color channel seperately.\\n Gamma values less than zero for any color will erase the corresponding color.\\n\",summary:\"<p> Gamma correct an image for every color channel seperately.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"gamma-red\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value to gamma correct the red channel of the image</div>'},{name:\"gamma-green\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value to gamma correct the green channel of the image</div>'},{name:\"gamma-blue\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> value to gamma correct the blue channel of the image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A gamma corrected copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"implode\",qname:\"man:implode\",signature:\"($image as xs:base64Binary, $factor as xs:double) as xs:base64Binary external\",description:\" Apply an implode effect to an image (a sort of special effect).\\n\",summary:\"<p> Apply an implode effect to an image (a sort of special effect).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"factor\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> factor to implode to</div>'}],returns:{type:\"xs:base64Binary\",description:\"An imploded copy of $image.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"oil-paint\",qname:\"man:oil-paint\",signature:\"($image as xs:base64Binary, $radius as xs:double) as xs:base64Binary external\",description:\" Apply an oil paint effect to an image (makes the image look as if it was\\n an oil paint).\\n\",summary:\"<p> Apply an oil paint effect to an image (makes the image look as if it was\\n an oil paint).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"radius\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> radius with which to oil paint</div>'}],returns:{type:\"xs:base64Binary\",description:\"A oil-painted copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"overlay\",qname:\"man:overlay\",signature:\"($image as xs:base64Binary, $overlay-image as xs:base64Binary, $overlay-upper-left-x as xs:unsignedInt, $overlay-upper-left-y as xs:unsignedInt, $operator as xs:string) as xs:base64Binary\",description:' Overlay $image with $overlay-image at the specfied position.\\n The $operator defines the details of the overlay and can have one of the\\n following values:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>OverCompositeOp: The result is the union of the two image shapes\\n       with the overlay image obscuring image in the region of overlap.</li>\\n   <li>InCompositeOp: The result is a simple overlay image cut by the shape\\n       of image. None of the image data of image is included in the result.</li>\\n   <li>OutCompositeOp: The resulting image is the overlay image with the shape\\n       of image cut out.</li>\\n   <li>AtopCompositeOp: The result is the same shape as image, with overlay\\n       image obscuring image there the image shapes overlap. Note that this\\n       differs from OverCompositeOp because the portion of composite image\\n       outside of image\\'s shape does not appear in the result.</li>\\n   <li>XorCompositeOp: The result is the image data from both overlay image\\n       and image that is outside the overlap region. The overlap region will\\n       be blank.</li>\\n   <li>PlusCompositeOp: The result is just the sum of the image data of both\\n       images. Output values are cropped to 255 (no overflow). This operation\\n       is independent of the matte channels.</li>\\n   <li>MinusCompositeOp: The result of overlay image - image, with overflow\\n       cropped to zero. The matte chanel is ignored (set to 255, full\\n       coverage).</li>\\n   <li>AddCompositeOp: The result of overlay image + image, with overflow\\n       wrapping around (mod 256).</li>\\n   <li>SubtractCompositeOp: The result of overlay image - image, with underflow\\n       wrapping around (mod 256). The add and subtract operators can be used to\\n       perform reverible transformations.</li>\\n   <li>DifferenceCompositeOp: The result of abs(overlay image - image). This is\\n       useful for comparing two very similar images.</li>\\n   <li>BumpmapCompositeOp: The result image shaded by overlay image.</li>\\n </ul>\\n',summary:\"<p> Overlay $image with $overlay-image at the specfied position.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> base image</div>'},{name:\"overlay-image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to overlay.</div>'},{name:\"overlay-upper-left-x\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> horizontal position within $image where the left upper edge of the $overlay-image is placed</div>'},{name:\"overlay-upper-left-y\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> vertical position within $image where the left upper edge of the $overlay-image is placed</div>'},{name:\"operator\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> defines how the overlay image should be overlayed (see details in operator listing above)</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image consisting of $image overlayed with $overlay-image.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 unsupported operator</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"reduce-noise\",qname:\"man:reduce-noise\",signature:\"($image as xs:base64Binary, $order as xs:double) as xs:base64Binary external\",description:\" Reduce noise of an image using a noise peak elemination filter.\\n\",summary:\"<p> Reduce noise of an image using a noise peak elemination filter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"order\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> defines how much the noise is reduced</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with reduced noise\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"resize\",qname:\"man:resize\",signature:\"($image as xs:base64Binary, $width as xs:unsignedInt, $height as xs:unsignedInt) as xs:base64Binary external\",description:\" Get a copy of the passed image with changed width and height (without\\n zooming the image's content).\\n To change the size of the actual contents of an image, use the zoom function.\\n More in detail: If the new dimensions are greater than the current dimensions\\n the new image will have the passed image in the upper left corner and the rest\\n will be filled with the current background color.\\n If the passed dimensions are less than the current dimensions, the new image\\n will contain the specified rectangle of the passed image beginning at the upper\\n left corner.\\n\",summary:\"<p> Get a copy of the passed image with changed width and height (without\\n zooming the image's content).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to resize</div>'},{name:\"width\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> new width</div>'},{name:\"height\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> new height</div>'}],returns:{type:\"xs:base64Binary\",description:\"resized copy of the source image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"rotate\",qname:\"man:rotate\",signature:\"($image as xs:base64Binary, $angle as xs:int) as xs:base64Binary external\",description:\" Get a new image as rotated copy of a passed source image (rotated by -360 to\\n 360 degrees).\\n The image is enlarged if this is required for containing the rotated image,\\n but never shrunk even if the rotation would make a smaller image possible.\\n\",summary:\"<p> Get a new image as rotated copy of a passed source image (rotated by -360 to\\n 360 degrees).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> source image.</div>'},{name:\"angle\",type:\"xs:int\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> between -360 to 360 degrees. Other values will be adjusted by modulo 360</div>'}],returns:{type:\"xs:base64Binary\",description:\"A rotated copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"solarize\",qname:\"man:solarize\",signature:\"($image as xs:base64Binary, $factor as xs:double) as xs:base64Binary external\",description:\" Apply a solarize effect to the image (similar to the effect seen when\\n exposing a photographic film to light during the development process).\\n\",summary:\"<p> Apply a solarize effect to the image (similar to the effect seen when\\n exposing a photographic film to light during the development process).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"factor\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> strength of the solarization (0 to 65535; 65535=100%)</div>'}],returns:{type:\"xs:base64Binary\",description:\"A solarized copy of $image.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"stereo\",qname:\"man:stereo\",signature:\"($left-image as xs:base64Binary, $right-image as xs:base64Binary) as xs:base64Binary external\",description:\" Make two passed images appear as stereo image when viewed with red-blue glasses.\\n Both images should be same but from a slightly different angle for this to work.\\n Both images should have the same size, if not, the size of the left image will\\n be taken.\\n\",summary:\"<p> Make two passed images appear as stereo image when viewed with red-blue glasses.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"left-image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> left image for the stereo image.</div>'},{name:\"right-image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> right image for the stereo image.</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image as combined stereo image of both source images\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 one of the passed images is invalid</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"sub-image\",qname:\"man:sub-image\",signature:\"($image as xs:base64Binary, $left-upper-x as xs:unsignedInt, $left-upper-y as xs:unsignedInt, $width as xs:unsignedInt, $height as xs:unsignedInt) as xs:base64Binary external\",description:\" Copy a part of the source image specified by a rectangle.\\n If the passed parameters for the sub-image specify a rectangle that isn't\\n entirely within the source image only the area that lies within the image\\n boundaries will be returned.\\n\",summary:\"<p> Copy a part of the source image specified by a rectangle.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image from which to extract a sub-image</div>'},{name:\"left-upper-x\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the x value of the upper left corner of the rectangle to cut out</div>'},{name:\"left-upper-y\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the y value of the upper left corner of the rectangle to cut out.</div>'},{name:\"width\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> width of the rectangle to cut out</div>'},{name:\"height\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> height of the rectangle to cut out</div>'}],returns:{type:\"xs:base64Binary\",description:\"A new image containing parts of the source image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"swirl\",qname:\"man:swirl\",signature:\"($image as xs:base64Binary, $degree as xs:double) as xs:base64Binary external\",description:\" Swirl an image (image pixels are rotated by degree).\\n\",summary:\"<p> Swirl an image (image pixels are rotated by degree).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"degree\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> degree to swirl image pixels</div>'}],returns:{type:\"xs:base64Binary\",description:\"A swirled copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"transparent\",qname:\"man:transparent\",signature:\"($image as xs:base64Binary, $color as xs:string) as xs:base64Binary\",description:\" Make all pixels of the specfied color transparent.\\n This works correctly only with image types supporting transparency\\n (e.g GIF or PNG).\\n\",summary:\"<p> Make all pixels of the specfied color transparent.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"color\",type:\"xs:string\",occurrence:null,description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> color to make transparent (e.g. '#FFFFFF')</div>\"}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with the specified color made transparent.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0001 unsupported color</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"trim\",qname:\"man:trim\",signature:\"($image as xs:base64Binary) as xs:base64Binary external\",description:\" Trim edges of the image's background color from the image.\\n\",summary:\"<p> Trim edges of the image's background color from the image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A trimmed copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"watermark\",qname:\"man:watermark\",signature:\"($image as xs:base64Binary, $watermark as xs:base64Binary) as xs:base64Binary external\",description:\" Add a $watermark image to $image.\\n\",summary:\"<p> Add a $watermark image to $image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the source image</div>'},{name:\"watermark\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the watermark image</div>'}],returns:{type:\"xs:base64Binary\",description:\"A watermarked copy of $image\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 one of the passed images is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"zoom-by-height\",qname:\"man:zoom-by-height\",signature:\"($image as xs:base64Binary, $height as xs:unsignedInt) as xs:base64Binary external\",description:\" Zoom the passed image to a given new height while keeping the ratio between\\n width and height.\\n So, the width is scaled accordingly.\\n Important note: this function does not change the size information stored\\n in the image (e.g. basic:width will not show a different value).\\n\",summary:\"<p> Zoom the passed image to a given new height while keeping the ratio between\\n width and height.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to resize</div>'},{name:\"height\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> new height for the image in pixels</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with given $height and width adjusted accordingly\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"zoom-by-width\",qname:\"man:zoom-by-width\",signature:\"($image as xs:base64Binary, $width as xs:unsignedInt) as xs:base64Binary external\",description:\" Zoom the passed image to a given new width while keeping the ratio between\\n width and height.\\n So, the height is scaled accordingly.\\n Important note: this function does not change the size information stored\\n in the image (e.g. basic:width will not show a different value).\\n\",summary:\"<p> Zoom the passed image to a given new width while keeping the ratio between\\n width and height.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to resize</div>'},{name:\"width\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> new width for the image in pixels</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with given $width and height changed accordingly\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"zoom\",qname:\"man:zoom\",signature:\"($image as xs:base64Binary, $ratio as xs:double) as xs:base64Binary external\",description:\" Zoom the passed image by the specified factor while keeping the ratio between\\n width and height.\\n A ratio of less than 1 will make the image smaller.\\n A ratio of less or equal than 0 will not effect the image.\\n Important note: this function does not change the size information stored in the\\n image (e.g. basic:width will not show a different value).\\n\",summary:\"<p> Zoom the passed image by the specified factor while keeping the ratio between\\n width and height.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"image\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> image to resize</div>'},{name:\"ratio\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> ratio to zoom width and height by</div>'}],returns:{type:\"xs:base64Binary\",description:\"A copy of $image with resized content\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 passed image is invalid</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/http-client-wrapper\":{ns:\"http://zorba.io/modules/http-client-wrapper\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides conversion functions between the\\n XML Expath http-client request and response formats and the\\n JSON http-client request and response formats used by the\\n <code>http://zorba.io/modules/http-client</code> module.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module is reserved for internal use by the\\n <code>http://www.zorba-xquery.com/modules/http-client</code> and the\\n <code>http://expath.org/ns/http-client</code> modules.\\n This module may be removed at any time. Method signature and\\n semantics may change.\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://expath.org/ns/error\",prefix:\"error\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http-schema\"},{uri:\"http://zorba.io/modules/http-client-wrapper\",prefix:\"http-wrapper\"},{uri:\"http://jsoniq.org/functions\",prefix:\"jn\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"json-http\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"libjn\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"ser\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"http-nondeterministic-request\",qname:\"http-wrapper:http-nondeterministic-request\",signature:\"($request as element(*)?, $href as xs:string?, $bodies as item()*) as item()+\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function sends an HTTP request and returns the corresponding response.\\n This function is declared non-deterministic and should only be used to issue\\n requests which do not change the state of the server.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Its inputs, outputs, and behavior are identical to the\\n <a href=\"http://expath.org/spec/http-client\">EXPath http-client</a>\\'s\\n send-request() function (except that HTML responses are not tidied\\n into XML - see <a href=\"#expath_relation\">the note above</a>). It\\n is provided here for use in Zorba installations that do not have\\n the EXPath module available. If you have the option of using the\\n EXPath module instead of this function, please do so, as it will\\n allow your application to be more interoperable between different\\n XQuery engines.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Full documentation of the $request parameter can be found in\\n <a href=\"http://expath.org/spec/http-client#d2e183\">the EXPath\\n specification</a>.</p>\\n',summary:\"<p>  This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Contains the various parameters of the request (see above).</div>'},{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above). If this parameter is specified, it will override the \"href\" attribute of $request.</div>'},{name:\"bodies\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the request body content, for HTTP methods that can contain a body in the request (i.e. POST and PUT). It is an error if this param is not the empty sequence for methods</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC003 With a multipart response, the override-media-type must be either a multipart media type or application/octet-stream.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC004 The src attribute on the body element is mutually exclusive with all other attribute (except the media-type).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC005 The input request element is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a POST, PUT, or DELETE request</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"http-sequential-request\",qname:\"http-wrapper:http-sequential-request\",signature:\"($request as element(*)?, $href as xs:string?, $bodies as item()*) as item()+\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function sends an HTTP request and returns the corresponding response.\\n This function is declared sequential and can be used to issue\\n requests which change the state of the server.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Its inputs, outputs, and behavior are identical to the\\n <a href=\"http://expath.org/spec/http-client\">EXPath http-client</a>\\'s\\n send-request() function (except that HTML responses are not tidied\\n into XML - see <a href=\"#expath_relation\">the note above</a>). It\\n is provided here for use in Zorba installations that do not have\\n the EXPath module available. If you have the option of using the\\n EXPath module instead of this function, please do so, as it will\\n allow your application to be more interoperable between different\\n XQuery engines.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Full documentation of the $request parameter can be found in\\n <a href=\"http://expath.org/spec/http-client#d2e183\">the EXPath\\n specification</a>.</p>\\n',summary:\"<p>  This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Contains the various parameters of the request (see above).</div>'},{name:\"href\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above). If this parameter is specified, it will override the \"href\" attribute of $request.</div>'},{name:\"bodies\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the request body content, for HTTP methods that can contain a body in the request (i.e. POST and PUT). It is an error if this param is not the empty sequence for methods</div>'}],returns:{type:\"item()+\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC001 An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC002 Error parsing the response content as XML.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC003 With a multipart response, the override-media-type must be either a multipart media type or application/octet-stream.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC004 The src attribute on the body element is mutually exclusive with all other attribute (except the media-type).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC005 The input request element is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HC006 A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">error:HCV02 Trying to follow a redirect of a POST, PUT, or DELETE request</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/cloudsearch\":{ns:\"http://www.28msec.com/modules/cloudsearch\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module offers functionality to search, add, update and remove documents in\\n an Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For each functionality two methods are provided\\n <ul>\\n  <li>one which accepts a single $options parameter. In this case the default\\n      credentials for the \"CloudSearch\" category will be used to determine the\\n      CloudSearch endpoint to use.</li>\\n  <li>one which accepts both an $endpoint and an $options parameter.\\n      In this case, if the $endpoint parameter is of type string, it will be\\n      interpreted as the name of a credentials in the \"CloudSearch\" category.\\n      Otherwise, if the $endpoint parameter is of type anyURI, it will be\\n      interpreted as the endpoint URI.</li>\\n </ul>\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The search functions (<a href=\"?anchor=search-1\">search#1</a> and\\n <a href=\"?anchor=search-2\">search#2</a>) are declared deterministic, which means that\\n their results could be cached when invoked multiple times with the same arguments\\n in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use two alternative search functions\\n (<a href=\"?anchor=search-nondeterministic-1\">search-nondeterministic#1</a> and\\n <a href=\"?anchor=search-nondeterministic-2\">search-nondeterministic#2</a>), which have\\n been declared as being non deterministic.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"search-options\">Search options</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The search settings are specified by means of an object whose form\\n is described in the following. The two most important fields are the\\n \"q\" and \"bq\" fields. At least one of them must be specified. If the \"bq\"\\n field is specified in conjunction with the \"q\" parameter, the values\\n are joined with a top-level AND.\\n <ul>\\n   <li>bq: one or more match expressions that define a Boolean search. Multiple\\n       expressions are joined with a top-level AND.\\n       <p>Type: string</p>\\n   </li>\\n   <li>q: the string to search for. You use the q parameter to perform simple text\\n       searches. This searches the default search field for the specified text.\\n       <p>Type: string</p>\\n   </li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Additional documentation on the format of the query and boolean query strings can\\n be found at:\\n <a href=\"http://docs.aws.amazon.com/cloudsearch/latest/developerguide/Search.Requests.html#Search.MatchSetExpression\">\\n Expression Syntax for Boolean Queries</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following additional optional parameters can be specified.\\n <ul>\\n   <li>facet: a comma-separated list of the fields for which you want to compute facets.\\n       The specified fields must be numeric fields or defined as facet enabled in the\\n       domain configuration.\\n       <p>Type: string</p>\\n   </li>\\n   <li>facet-<i>FIELD</i>-constraints: the field values (facet constraints) that\\n       you want to count for a particular field. FIELD is the name of the field.\\n       Constraints are specified as a comma-separated list of ranges or\\n       single-quoted strings. If you don\\'t specify facet constraints, counts\\n       are computed for all field values.\\n       <p>Type: string</p>\\n   </li>\\n   <li>facet-<i>FIELD</i>-sort: how you want to sort facet values for a\\n       particular field. FIELD is the name of the field. There are four sorting options:\\n       <ul>\\n         <li>alpha: Sort the facet values alphabetically (in ascending order).</li>\\n         <li>count: Sort the facet values by their counts (in descending order).</li>\\n         <li>max: Sort the facet values according to the maximum values in the specified\\n             field. This option is specified as <code>max(FIELD)</code>. By default, the\\n             facet values are sorted in ascending order. To sort in descending order,\\n             prefix the sort option with - (minus): <code>-max(FIELD)</code>.\\n         </li>\\n         <li>sum: Sort the facet values according to the sum of the values in the\\n             specified field (in ascending order). This option is specified as\\n             <code>sum(FIELD)</code>.\\n         </li>\\n       </ul>\\n   </li>\\n   <li>facet-<i>FIELD</i>-top-n: set the maximum number of facet constraints to\\n       be included for the specified field in the search results. By default,\\n       the results include counts for the top 40 constraints.\\n        <p>Type: integer</p>\\n   </li>\\n   <li>no-cache: if false, a cached result can be returned. If true, a revalidation of the\\n        results is forced. Default is false.\\n        <p>Type: boolean</p>\\n   </li>\\n   <li>rank: a comma-separated list of fields or rank expressions to use for ranking. A\\n        maximum of 10 fields and rank expressions can be specified. You can use any uint\\n        field to rank results numerically. Any result-enabled text or literal field can be\\n        used to rank results alphabetically. To rank results by relevance, you can specify\\n        the name of a custom rank expression or text_relevance. Hits are ordered according\\n        to the specified rank field(s). By default, hits are ranked in ascending order.\\n        <p>You can prefix a field name with a minus (-) to rank in descending order. If no\\n        rank parameter is specified, it defaults to <code>rank=-text_relevance</code>, which\\n        lists results according to their text_relevance scores with the highest-scoring\\n        documents first.</p>\\n       <p>Type: string</p>\\n   </li>\\n   <li>rank-<i>RANKNAME</i>: define a rank expression that can be used with the\\n       rank parameter. You can also specify the new rank expression as a return\\n       field and use it to set thresholds for the search results with the\\n       t-<i>FIELD</i> parameter. For more information about constructing\\n       rank expressions, see\\n       <a href=\"http://docs.aws.amazon.com/cloudsearch/latest/developerguide/tuneranking.html\">\\n       Customizing Result Ranking with Amazon CloudSearch</a>.\\n       <p>Type: string</p>\\n   </li>\\n   <li>return-fields: the document fields to include in the response. Up to 2 KB\\n       of data can be returned from a text field. If the field contents exceed\\n       2 KB, only the first 2 KB is included in the results. Specified as a\\n       comma-separated list of field names. If no return-fields are specified,\\n       only the document ids of the hits are returned.\\n       <p>Type: string</p>\\n   </li>\\n   <li>size: the maximum number of search hits to return. The default is 10.\\n       <p>Type: integer</p>\\n   </li>\\n   <li>start: the offset of the first search hit you want to return. The default is 0\\n       (the first hit).\\n       <p>Type: integer</p>\\n   </li>\\n   <li>t-<i>FIELD</i>: restrict the match set used in subsequent post-processing\\n       steps according to the specified rank expression. Only hits that have a\\n       score within the specified range are included. Ranges are specified as\\n       described in\\n       <a href=\"http://docs.aws.amazon.com/cloudsearch/latest/developerguide/Search.Requests.html#Search.MatchSetExpression\">\\n       Expression Syntax for Boolean Queries</a>.\\n       <p>Type: integer</p>\\n   </li>\\n </ul>\\n For additional details on the search parameters you can refer to the\\n <a href=\"http://docs.aws.amazon.com/cloudsearch/latest/developerguide/Search.Requests.html\">\\n Amazon CloudSearch search requests documentation</a>.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"search-results\">Search Results</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the returned object is the following:\\n <pre>\\n {\\n   \"rank\" : \"-text_relevance\",\\n   \"match-expr\" : \"(label \\'star wars\\')\",\\n   \"hits\" :\\n   {\\n     \"found\" : 2,\\n     \"start\" : 0,\\n     \"hit\" :\\n     [\\n       {\\n         \"id\" : \"tt1185834\",\\n         \"data\" :\\n         {\\n           \"actor\" : [\"Abercrombie, Ian\",\"Baker, Dee\",\"Burton, Corey\"],\\n           \"title\" : [\"Star Wars: The Clone Wars\"]\\n         }\\n       },\\n       {\\n         \"id\" :\"tt0121766\",\\n         \"data\" :\\n         {\\n           \"actor\" : [\"Bai, Ling\",\"Bryant, Gene\",\"Castle-Hughes, Keisha\"],\\n           \"title\" : [\"Star Wars: Episode III - Revenge of the Sith\"]\\n         }\\n       }\\n     ]\\n   },\\n   \"info\" :\\n   {\\n     \"rid\" : \"b7c167f6c2da6d93531b9a7b314ad030b3a74803b4b7797edb905ba5a6a08\",\\n     \"time-ms\" : 2,\\n     \"cpu-time-ms\" : 0\\n   }\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object fields have the following meaning:\\n <ul>\\n   <li>match-expr: Shows the match expression constructed from the search\\n       parameters.</li>\\n   <li>hits: Contains hit statistics (found, start) and a hit array that lists\\n       the document ids and data for each hit.</li>\\n   <li>found: The total number of hits that match the search request after\\n       Amazon CloudSearch finished processing the match set.</li>\\n   <li>start: The index of the first hit returned in this response.</li>\\n   <li>hit: An array that lists the document ids and data for each hit.</li>\\n   <li>id: The unique identifier for a document.</li>\\n   <li>data: A list of returned fields.</li>\\n   <li>facets: Contains facet information and facet counts.</li>\\n   <li><i>FacetFieldName</i>: A field for which facets were calculated.</li>\\n   <li>constraints: An array of the facet values and counts.</li>\\n   <li>value: The facet value being counted.</li>\\n   <li>count: The number of hits that contain the facet value in <i>FacetFieldName</i>.\\n       </li>\\n   <li>info: Contains information about the request processing.</li>\\n   <li>rank: Lists the fields that were used to rank the search hits.</li>\\n   <li>rid: The encrypted Resource ID.</li>\\n   <li>time-ms: How long it took to process the search request in milliseconds.\\n       </li>\\n   <li>cpu-time-ms: The CPU time required to process the search request in\\n       milliseconds.</li>\\n   <li>messages: Contains any error messages returned by the search service.\\n       The severity, code, and message properties are included for each item.</li>\\n   <li>severity: The severity of the message. It is always warning, which indicates\\n       a problem with the query string that did not prevent the request from being\\n       processed.</li>\\n   <li>code: The error code. The search service returns the following error codes:\\n     <ul>\\n       <li>CS-InvalidFieldOrRankAliasInRankParameter: the specified ranking field\\n           could not be found.</li>\\n       <li>CS-RankExpressionParseError: one of the specified rank expressions could\\n           not be parsed. No query-time rank expressions will be used. </li>\\n       <li>CS-RankExpressionValidationError: one of the specified rank expressions\\n           could not be validated. No query-time rank expressions will be used.</li>\\n       <li>CS-UndefinedField: an unknown field was specified in the match\\n           expression.</li>\\n       <li>CS-UnknownFieldInMatchExpression: a field specified in the bq parameter\\n           could not be found.</li>\\n       <li>CS-WildcardTermLimit: more than 2000 terms matched the wildcard in the\\n           search request. The number of terms matched was limited to 2000.</li>\\n     </ul>\\n   </li>\\n   <li>message: A description of the error that was returned by the search service.</li>\\n </ul>\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/cloudsearch\",prefix:\"cloudsearch\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"http\"}],functions:[{isDocumented:!0,arity:1,name:\"add-document\",qname:\"cloudsearch:add-document\",signature:\"($options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds or replaces a document in the default Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An add operation is applied only if a document with the same id is not\\n present or if the version number specified in the operation is greater than\\n the existing document\\'s version number.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The document to add or replace is specified through an object with\\n the following form:\\n <pre>\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request object have the following meaning:\\n <ul>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n   <li>lang: An ISO-639-1 two-letter language code.</li>\\n   <li>fields: An object containing one or more fields. Each field specifies\\n       a field within the document being added. Field names must begin with a\\n       lowercase letter and can contain the following characters: a-z, 0-9,\\n       and _. Field names must be at least 3 and no more than 64 characters.\\n       The names \"body\", \"docid\", and \"text_relevance\" are reserved names and\\n       cannot be used as field names. To specify multiple values for a field,\\n       you can specify an array of values instead of a single value.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object lists all warnings that were generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, always \"success\". In case an error occurred\\n       processing the request, an error is raised.</li>\\n   <li>warning: provides information about warnings generated during parsing\\n       or validation. The field is not present if no warning were generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, specifying endpoint URI:\\n <pre>\\n cloudsearch:add-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n });\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using stored credentials:\\n <pre>\\n cloudsearch:add-document(\"movies\",\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Adds or replaces a document in the default Amazon CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the default credentials endpoint is invalid or not present</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"add-document\",qname:\"cloudsearch:add-document\",signature:\"($endpoint as atomic, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds or replaces a document in the specified Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An add operation is applied only if a document with the same id is not\\n present or if the version number specified in the operation is greater than\\n the existing document\\'s version number.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The document to add or replace is specified through an object with\\n the following form:\\n <pre>\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request object have the following meaning:\\n <ul>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n   <li>lang: An ISO-639-1 two-letter language code.</li>\\n   <li>fields: An object containing one or more fields. Each field specifies\\n       a field within the document being added. Field names must begin with a\\n       lowercase letter and can contain the following characters: a-z, 0-9,\\n       and _. Field names must be at least 3 and no more than 64 characters.\\n       The names \"body\", \"docid\", and \"text_relevance\" are reserved names and\\n       cannot be used as field names. To specify multiple values for a field,\\n       you can specify an array of values instead of a single value.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object lists all warnings that were generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, always \"success\". In case an error occurred\\n       processing the request, an error is raised.</li>\\n   <li>warning: provides information about warnings generated during parsing\\n       or validation. The field is not present if no warning were generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, specifying endpoint URI:\\n <pre>\\n cloudsearch:add-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n });\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using stored credentials:\\n <pre>\\n cloudsearch:add-document(\"movies\",\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 1,\\n   \"lang\" : \"en\",\\n   \"fields\" :\\n   {\\n     \"title\" : \"The Seeker: The Dark Is Rising\",\\n     \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"]\\n   }\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Adds or replaces a document in the specified Amazon CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The endpoint URI or the name of a stored CloudSearch credentials</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the specified endpoint is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"batch-document\",qname:\"cloudsearch:batch-document\",signature:\"($options as array()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds, replaces or removes one or more documents from the default Amazon\\n CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An add or delete operation is only applied to an existing document if the\\n version number specified in the operation is greater than the existing document\\n version number.\\n If multiple add or delete operations for the same document are specified, the\\n operation with the highest version number is applied. If multiple operations in\\n a batch specify the same document and version number, the document service\\n arbitrarily picks which one to apply.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The documents to add, replace or delete can be specified through an array with\\n the following form:\\n <pre>\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request array have the following meaning:\\n <ul>\\n   <li>type: The operation type, \"add\" or \"delete\".</li>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n   <li>lang: An ISO-639-1 two-letter language code.</li>\\n   <li>fields: An object containing one or more fields. Each field specifies\\n       a field within the document being added. Field names must begin with a\\n       lowercase letter and can contain the following characters: a-z, 0-9,\\n       and _. Field names must be at least 3 and no more than 64 characters.\\n       The names \"body\", \"docid\", and \"text_relevance\" are reserved names and\\n       cannot be used as field names. To specify multiple values for a field,\\n       you can specify an array of values instead of a single value.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The response body lists any warning that was generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"adds\" : 1,\\n   \"deletes: 1,\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, which is either success or error.</li>\\n   <li>adds: the number of add document operations that were performed.</li>\\n   <li>deletes: the number of delete document operations that were performed.</li>\\n   <li>warning: provides information about a warning generated during parsing\\n       or validation. The field is not present if no warning was generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:batch-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]);\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:batch-document(\"movies\",\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]);\\n </pre>\\n </p>\\n',summary:\"<p>  Adds, replaces or removes one or more documents from the default Amazon\\n CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"array()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the default credentials endpoint is invalid or not present</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"batch-document\",qname:\"cloudsearch:batch-document\",signature:\"($endpoint as atomic, $options as array()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds, replaces or removes one or more documents from the specified Amazon\\n CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An add or delete operation is only applied to an existing document if the\\n version number specified in the operation is greater than the existing document\\n version number.\\n If multiple add or delete operations for the same document are specified, the\\n operation with the highest version number is applied. If multiple operations in\\n a batch specify the same document and version number, the document service\\n arbitrarily picks which one to apply.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The documents to add, replace or delete can be specified through an array with\\n the following form:\\n <pre>\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request array have the following meaning:\\n <ul>\\n   <li>type: The operation type, \"add\" or \"delete\".</li>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n   <li>lang: An ISO-639-1 two-letter language code.</li>\\n   <li>fields: An object containing one or more fields. Each field specifies\\n       a field within the document being added. Field names must begin with a\\n       lowercase letter and can contain the following characters: a-z, 0-9,\\n       and _. Field names must be at least 3 and no more than 64 characters.\\n       The names \"body\", \"docid\", and \"text_relevance\" are reserved names and\\n       cannot be used as field names. To specify multiple values for a field,\\n       you can specify an array of values instead of a single value.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The response body lists any warning that was generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"adds\" : 1,\\n   \"deletes: 1,\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, which is either success or error.</li>\\n   <li>adds: the number of add document operations that were performed.</li>\\n   <li>deletes: the number of delete document operations that were performed.</li>\\n   <li>warning: provides information about a warning generated during parsing\\n       or validation. The field is not present if no warning was generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:batch-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]);\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:batch-document(\"movies\",\\n [\\n   {\\n     \"type\" : \"add\",\\n     \"id\" :   \"tt0484562\",\\n     \"version\" : 1,\\n     \"lang\" : \"en\",\\n     \"fields\" :\\n     {\\n       \"title\" : \"The Seeker: The Dark Is Rising\",\\n       \"genre\" : [\"Adventure\",\"Drama\",\"Fantasy\",\"Thriller\"],\\n     }\\n   },\\n   {\\n     \"type\" : \"delete\",\\n     \"id\" :   \"tt0484575\",\\n     \"version\" : 2\\n   }\\n ]);\\n </pre>\\n </p>\\n',summary:\"<p>  Adds, replaces or removes one or more documents from the specified Amazon\\n CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The endpoint URI or the name of a stored CloudSearch credentials</div>'},{name:\"options\",type:\"array()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the specified endpoint is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-document\",qname:\"cloudsearch:delete-document\",signature:\"($options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a document from the default Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A delete operation is only applied to an existing document if the\\n version number specified in the operation is greater than the existing\\n document\\'s version number.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The document to remove is specified through an object with the\\n following form:\\n <pre>\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request object have the following meaning:\\n <ul>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The response body lists any warning that was generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, always \"success\". In case of errors an error is\\n       raised.</li>\\n   <li>warning: provides information about a warning generated during parsing or\\n       validation. The field is not present if no warning was generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:delete-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n });\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified stored endpoing:\\n <pre>\\n cloudsearch:delete-document(\"movies\",\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes a document from the default Amazon CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the default credentials endpoint is invalid or not present</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-document\",qname:\"cloudsearch:delete-document\",signature:\"($endpoint as atomic, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a document from the specified Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A delete operation is only applied to an existing document if the\\n version number specified in the operation is greater than the existing\\n document\\'s version number.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The document to remove is specified through an object with the\\n following form:\\n <pre>\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the request object have the following meaning:\\n <ul>\\n   <li>id: An alphanumeric string. Allowed characters are: a-z, 0-9, and _.\\n       Document IDs cannot begin with an underscore. The max length is 128\\n       characters.</li>\\n   <li>version: Any non-negative number less than 2^32.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The response body lists any warning that was generated.\\n <pre>\\n {\\n   \"status\" : \"success\",\\n   \"warning\" :\\n   [\\n     {\"message\" : \"Warning message.\"}\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Specifically, the fields in the response object have the following meaning:\\n <ul>\\n   <li>status: the result status, always \"success\". In case of errors an error is\\n       raised.</li>\\n   <li>warning: provides information about a warning generated during parsing or\\n       validation. The field is not present if no warning was generated.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:delete-document(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n });\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified stored endpoing:\\n <pre>\\n cloudsearch:delete-document(\"movies\",\\n {\\n   \"id\" : \"tt0484562\",\\n   \"version\" : 2\\n });\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes a document from the specified Amazon CloudSearch domain.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The endpoint URI or the name of a stored CloudSearch credentials</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying the request options</div>'}],returns:{type:\"object()\",description:\"The request response\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the specified endpoint is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESOURCES if the server storage or bandwidth resources are insufficient to execute the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"search-nondeterministic\",qname:\"cloudsearch:search-nondeterministic\",signature:\"($options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Searches the documents in the default Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#search-1\">search#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Searches the documents in the default Amazon CloudSearch domain.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"#search-options\">search options</a> object</div>'}],returns:{type:\"object()\",description:'The <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#search-results\">search results</a> object'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the default credentials endpoint is invalid or not present</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"search-nondeterministic\",qname:\"cloudsearch:search-nondeterministic\",signature:\"($endpoint as atomic, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Searches the documents in the specified Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#search-2\">search#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Searches the documents in the specified Amazon CloudSearch domain.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"endpoint\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The endpoint URI or the name of a stored CloudSearch credentials</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"search-options\">search options</a> object</div>'}],returns:{type:\"object()\",description:'The <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"search-results\">search results</a> object'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the specified endpoint is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"search\",qname:\"cloudsearch:search\",signature:\"($options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Searches the documents in the default Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the <a href=\"search-options\">search options</a> object and\\n of the <a href=\"search-results\">search results</a> object is documented in\\n the module introduction.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:\\n <pre>\\n cloudsearch:search({\"q\" : \"star+wars\", \"return-fields\" : \"title\"})\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example returned object:\\n <pre>\\n {\\n   \"rank\" : \"-text_relevance\",\\n   \"match-expr\" : \"(label \\'star wars\\')\",\\n   \"hits\" :\\n   {\\n     \"found\" : 2,\\n     \"start\" : 0,\\n     \"hit\" :\\n     [\\n       {\\n         \"id\" : \"tt1185834\",\\n         \"data\" :\\n         {\\n           \"actor\" : [\"Abercrombie, Ian\",\"Baker, Dee\",\"Burton, Corey\"],\\n           \"title\" : [\"Star Wars: The Clone Wars\"]\\n         }\\n       },\\n       {\\n         \"id\" :\"tt0121766\",\\n         \"data\" :\\n         {\\n           \"actor\" : [\"Bai, Ling\",\"Bryant, Gene\",\"Castle-Hughes, Keisha\"],\\n           \"title\" : [\"Star Wars: Episode III - Revenge of the Sith\"]\\n         }\\n       }\\n     ]\\n   },\\n   \"info\" :\\n   {\\n     \"rid\" : \"b7c167f6c2da6d93531b9a7b314ad030b3a74803b4b7797edb905ba5a6a08\",\\n     \"time-ms\" : 2,\\n     \"cpu-time-ms\" : 0\\n   }\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Searches the documents in the default Amazon CloudSearch domain.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"search-options\">search options</a> object</div>'}],returns:{type:\"object()\",description:'The <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"search-results\">search results</a> object'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the default credentials endpoint is invalid or not present</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"search\",qname:\"cloudsearch:search\",signature:\"($endpoint as atomic, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Searches the documents in the specified Amazon CloudSearch domain.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the <a href=\"search-options\">search options</a> object and\\n of the <a href=\"search-results\">search results</a> object is documented in\\n the module introduction.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following examples performs a simple text search for all documents\\n containing both the word \"star\" and \"trek\" and returns the matching document\\n title field.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using specified endpoint URI:\\n <pre>\\n cloudsearch:search(\\n anyURI(\"http://doc-movies-h2pc7ftfnsdlqh6pqqawbftrhu.us-east-1.cloudsearch.amazonaws.com\"),\\n {\"q\" : \"star+wars\", \"return-fields\" : \"title\"})\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example, using a stored endpoint:\\n <pre>\\n cloudsearch:search(\"movies\",\\n {\"q\" : \"star+wars\", \"return-fields\" : \"title\"})\\n </pre>\\n </p>\\n',summary:\"<p>  Searches the documents in the specified Amazon CloudSearch domain.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"endpoint\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The endpoint URI or the name of a stored CloudSearch credentials</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"search-options\">search options</a> object</div>'}],returns:{type:\"object()\",description:'The <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"search-results\">search results</a> object'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:ENDPOINT if the specified endpoint is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:AUTHORIZATION if the request was unauthorized</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:HTTP if an HTTP error has occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:REQUEST if the request is malformed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:INTERNAL if an internal server error occurred</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudsearch:RESPONSE if the CloudSearch response cannot be parsed</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/store/static/indexes/ddl\":{ns:\"http://zorba.io/modules/store/static/indexes/ddl\",description:' This modules defines a set of functions for managing indexes that are\\n declared in the prolog of a module.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data Definition Facility</a>.\\n All the indexes managed by this module have to be pre-declared in the prolog\\n of a module.\\n Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/store/static/indexes/ddl\",prefix:\"iddl\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:0,name:\"available-indexes\",qname:\"iddl:available-indexes\",signature:\"() as xs:QName* external\",description:\" Gets the available indexes.\\n\",summary:\"<p> Gets the available indexes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each available index, or an empty sequence if none are.\"},errors:[]},{isDocumented:!0,arity:1,name:\"create\",qname:\"iddl:create\",signature:\"($name as xs:QName) external\",description:\" Creates an index.\\n\",summary:\"<p> Creates an index.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to create.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, creates the index with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if <code>$name</code> is not equal to the name of any resource in the statically known indexes.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0022 if an index with <code>$name</code> already exists.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"declared-indexes\",qname:\"iddl:declared-indexes\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames representing the indexes that have been declared\\n in the prolog of the static context.\\n\",summary:\"<p> Gets a sequence of QNames representing the indexes that have been declared\\n in the prolog of the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each created collection, or an emtpy sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"delete\",qname:\"iddl:delete\",signature:\"($name as xs:QName) external\",description:\" Deletes an index.\\n\",summary:\"<p> Deletes an index.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the index with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0009 if the index does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-available-index\",qname:\"iddl:is-available-index\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gets whether an index exists.\\n\",summary:\"<p> Gets whether an index exists.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index that is being checked.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the index is available; false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-declared-index\",qname:\"iddl:is-declared-index\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gets whether an index has been declared in the prolog of the static context.\\n\",summary:\"<p> Gets whether an index has been declared in the prolog of the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index that is being checked.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the index was declared; false otherwise.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/excel/datetime\":{ns:\"http://zorba.io/modules/excel/datetime\",description:\" This is a library module offering the same set of functions\\n defined by Microsoft Excel.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528231033.aspx\" target=\"_blank\">Excel Documentation: Datetime Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/datetime\",prefix:\"excel-datetime\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/text\",prefix:\"excel-text\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"date\",qname:\"excel-datetime:date\",signature:\"($year as xs:integer, $month as xs:integer, $day as xs:integer) as xs:date?\",description:\" Constructs a date given the hours, months and days.\\n\",summary:\"<p> Constructs a date given the hours, months and days.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"year\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the year</div>'},{name:\"month\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the month</div>'},{name:\"day\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the day</div>'}],returns:{type:\"xs:date?\",description:\"A date given the hours, months and days\"},errors:[]},{isDocumented:!0,arity:1,name:\"day\",qname:\"excel-datetime:day\",signature:\"($date as xs:date) as xs:integer?\",description:\" Returns the day of a $date, represented by a serial number.\\n\",summary:\"<p> Returns the day of a $date, represented by a serial number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date.</div>'}],returns:{type:\"xs:integer?\",description:\"The day of a $date, represented by a serial number. The day is given as an integer ranging from 1 to 31.\"},errors:[]},{isDocumented:!0,arity:2,name:\"days360\",qname:\"excel-datetime:days360\",signature:\"($start_date as xs:date, $end_date as xs:date) as xs:integer\",description:\" Returns the number of days between two dates based on a 360-day year.\\n\",summary:\"<p> Returns the number of days between two dates based on a 360-day year.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"start_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the start date.</div>'},{name:\"end_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the end date.</div>'}],returns:{type:\"xs:integer\",description:'The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Use this function to help compute payments if your accounting system is based on twelve 30-day months.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The metod used is U.S. (NASD). If the starting date is the last day of a month, it becomes equal to the 30th of the same month. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> If the ending date is the last day of a month and the starting date is earlier than the 30th of a month, the ending date becomes equal to the 1st of the next month; otherwise the ending date becomes equal to the 30th of the same month.'},errors:[]},{isDocumented:!0,arity:3,name:\"days360\",qname:\"excel-datetime:days360\",signature:\"($start_date as xs:date, $end_date as xs:date, $method as xs:boolean) as xs:integer\",description:\" Returns the number of days between two dates based on a 360-day year.\\n\",summary:\"<p> Returns the number of days between two dates based on a 360-day year.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"start_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the start date.</div>'},{name:\"end_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the end date.</div>'},{name:\"method\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> if false then US/NASD Method is used, otherwise the European Method is used.</div>'}],returns:{type:\"xs:integer\",description:'The number of days between two dates based on a 360-day year (twelve 30-day months), which is used in some accounting calculations. Use this function to help compute payments if your accounting system is based on twelve 30-day months. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The European Method (30E/360)<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> - If either date A or B falls on the 31st of the month, that date will be changed to the 30th;<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> - Where date B falls on the last day of February, the actual date B will be used.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> The US/NASD Method (30US/360)<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> - If both date A and B fall on the last day of February, then date B will be changed to the 30th.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> - If date A falls on the 31st of a month or last day of February, then date A will be changed to the 30th.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> - If date A falls on the 30th of a month after applying (2) above and date B falls on the 31st of a month, then date B will be changed to the 30th.'},errors:[]},{isDocumented:!0,arity:1,name:\"hour\",qname:\"excel-datetime:hour\",signature:\"($time as xs:time) as xs:integer?\",description:\" Returns the hour of a time value.\\n\",summary:\"<p> Returns the hour of a time value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"time\",type:\"xs:time\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time.</div>'}],returns:{type:\"xs:integer?\",description:\"The hour of a time value. The hour is as an integer, ranging from 0 (12:00 A.M.) to 23 (11:00 P.M.).\"},errors:[]},{isDocumented:!0,arity:1,name:\"minute\",qname:\"excel-datetime:minute\",signature:\"($time as xs:time) as xs:integer?\",description:\" Returns the minutes of a time value.\\n\",summary:\"<p> Returns the minutes of a time value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"time\",type:\"xs:time\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time.</div>'}],returns:{type:\"xs:integer?\",description:\"The minutes of a time value. The minute is given as an integer, ranging from 0 to 59.\"},errors:[]},{isDocumented:!0,arity:1,name:\"month\",qname:\"excel-datetime:month\",signature:\"($date as xs:date) as xs:integer?\",description:\" Returns the month of a $date.\\n\",summary:\"<p> Returns the month of a $date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date.</div>'}],returns:{type:\"xs:integer?\",description:\"the month of a $date. The month is given as an integer, ranging from 1 (January) to 12 (December).\"},errors:[]},{isDocumented:!0,arity:2,name:\"networkdays\",qname:\"excel-datetime:networkdays\",signature:\"($start_date as xs:date, $end_date as xs:date) as xs:integer*\",description:\" Returns the number of whole working days between $start_date and $end_date.\\n\",summary:\"<p> Returns the number of whole working days between $start_date and $end_date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"start_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the start date.</div>'},{name:\"end_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the end date.</div>'}],returns:{type:\"xs:integer*\",description:'The number of whole working days between start_date and end_date.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Working days exclude weekends and any dates identified in holidays.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.'},errors:[]},{isDocumented:!0,arity:3,name:\"networkdays\",qname:\"excel-datetime:networkdays\",signature:\"($start_date as xs:date, $end_date as xs:date, $holidays as xs:date*) as xs:integer*\",description:\" Returns the number of whole working days between $start_date and $end_date.\\n\",summary:\"<p> Returns the number of whole working days between $start_date and $end_date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"start_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the start date.</div>'},{name:\"end_date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the end date.</div>'},{name:\"holidays\",type:\"xs:date\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> one or more dates to exclude from the working calendar, such as state and federal holidays and floating holidays.</div>'}],returns:{type:\"xs:integer*\",description:'The number of whole working days between start_date and end_date.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Working days exclude weekends and any dates identified in holidays.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.'},errors:[]},{isDocumented:!0,arity:0,name:\"now\",qname:\"excel-datetime:now\",signature:\"() as xs:dateTime?\",description:\" Returns the current date and time.\\n\",summary:\"<p> Returns the current date and time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:dateTime?\",description:\"The current date and time.\"},errors:[]},{isDocumented:!0,arity:1,name:\"second\",qname:\"excel-datetime:second\",signature:\"($time as xs:time) as xs:decimal?\",description:\" Returns the seconds of a $time value.\\n\",summary:\"<p> Returns the seconds of a $time value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"time\",type:\"xs:time\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time.</div>'}],returns:{type:\"xs:decimal?\",description:\"The seconds of a $time value. The second is given as an integer in the range 0 (zero) to 59.\"},errors:[]},{isDocumented:!0,arity:3,name:\"time\",qname:\"excel-datetime:time\",signature:\"($hour as xs:integer, $minute as xs:integer, $second as xs:integer) as xs:time?\",description:\" Constructs a time given the hours, minutes and seconds.\\n\",summary:\"<p> Constructs a time given the hours, minutes and seconds.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hour\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the hour.</div>'},{name:\"minute\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the minute.</div>'},{name:\"second\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second.</div>'}],returns:{type:\"xs:time?\",description:\"A time given the hours, minutes and seconds.\"},errors:[]},{isDocumented:!0,arity:0,name:\"today\",qname:\"excel-datetime:today\",signature:\"() as xs:date?\",description:\" Returns the current date.\\n\",summary:\"<p> Returns the current date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:date?\",description:\"The current date.\"},errors:[]},{isDocumented:!0,arity:1,name:\"weekday\",qname:\"excel-datetime:weekday\",signature:\"($date as xs:date) as xs:integer?\",description:\" Returns the day of the week corresponding to a $date.\\n\",summary:\"<p> Returns the day of the week corresponding to a $date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date.</div>'}],returns:{type:\"xs:integer?\",description:\"The day of the week corresponding to a $date. The day is given as an integer, ranging from 1 (Sunday) to 7 (Saturday).\"},errors:[]},{isDocumented:!0,arity:2,name:\"weekday\",qname:\"excel-datetime:weekday\",signature:\"($date as xs:date, $return_type as xs:integer) as xs:integer?\",description:\" Returns the day of the week corresponding to a $date depending on $return_type.\\n\",summary:\"<p> Returns the day of the week corresponding to a $date depending on $return_type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date.</div>'},{name:\"return_type\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> 1 for Numbers 1 (Sunday) through 7 (Saturday). 2 for Numbers 1 (Monday) through 7 (Sunday). 3 for Numbers 0 (Monday) through 6 (Sunday).</div>'}],returns:{type:\"xs:integer?\",description:\"The day of the week corresponding to a $date depending on $return_type.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if $return_type is outside the range [1,3].</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"year\",qname:\"excel-datetime:year\",signature:\"($date as xs:date) as xs:integer?\",description:\" Returns the year corresponding to a date.\\n\",summary:\"<p> Returns the year corresponding to a date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:date\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date.</div>'}],returns:{type:\"xs:integer?\",description:\"The year corresponding to a date.\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/profiles/sec/filings\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/filings\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying financial reports (filings)\\n submitted to the SEC.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SEC Filings are nothing else than XBRL archives. For XBRL-generic requests on archives,\\n use the generic archives module.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can access a number of properties of an SEC filing, such as\\n its document type. You can also retrieve an SEC filing given an SEC company (or its CIK).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can also access SEC filings statistics (the number of SEC Networks, of SEC Axes, etc).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/companies\",prefix:\"companies\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://zorba.io/modules/datetime\",prefix:\"datetime\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/filings\",prefix:\"filings\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/core\",prefix:\"sec\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"acceptance-dateTimes\",qname:\"filings:acceptance-dateTimes\",signature:\"($filings-or-ids as item()*) as dateTime*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the acceptance date of filings.</p>\\n',summary:\"<p>  Retrieves the acceptance date of filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of filings or their IDs.</div>'}],returns:{type:\"dateTime*\",description:\"the acceptance dateTimes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"document-types\",qname:\"filings:document-types\",signature:\"($filings-or-ids as item()*) as string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the document type of the filings.</p>\\n',summary:\"<p>  Retrieves the document type of the filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of filings or their ids.</div>'}],returns:{type:\"string?\",description:\"the document types (10-K, 10-Q).\"},errors:[]},{isDocumented:!0,arity:1,name:\"filing-dates\",qname:\"filings:filing-dates\",signature:\"($filings-or-ids as item()*) as date*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the submission date of filings.</p>\\n',summary:\"<p>  Retrieves the submission date of filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of filings or their IDs.</div>'}],returns:{type:\"date*\",description:\"the submission dates.\"},errors:[]},{isDocumented:!0,arity:1,name:\"filings-for-companies\",qname:\"filings:filings-for-companies\",signature:\"($companies-or-ciks as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all filings submitted by the supplied companies.</p>\\n',summary:\"<p>  Return all filings submitted by the supplied companies.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"companies-or-ciks\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> arbitrary number of company objects or CIKs.</div>'}],returns:{type:\"object()*\",description:\"all filings submitted by these companies.\"},errors:[]},{isDocumented:!0,arity:1,name:\"generators\",qname:\"filings:generators\",signature:\"($filings-or-ids as item()*) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the generators of filings.</p>\\n',summary:\"<p>  Retrieves the generators of filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of filings or their IDs.</div>'}],returns:{type:\"string*\",description:\"the generators used.\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-abstracts\",qname:\"filings:num-abstracts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) abstracts in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) abstracts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of abstracts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-axes\",qname:\"filings:num-axes\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) axes in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) axes in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of axes\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-concepts\",qname:\"filings:num-concepts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) concepts in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) concepts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of concepts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-extension-abstracts\",qname:\"filings:num-extension-abstracts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of extension abstracts in each of the given filings.\\n\",summary:\"<p> Return the number of extension abstracts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of abstracts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-extension-concepts\",qname:\"filings:num-extension-concepts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of extension concepts in each of the given filings.\\n\",summary:\"<p> Return the number of extension concepts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of concepts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-extension-facts\",qname:\"filings:num-extension-facts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of extension facts in each of the given filings.\\n\",summary:\"<p> Return the number of extension facts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of facts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-facts\",qname:\"filings:num-facts\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of facts in each of the given filings.\\n\",summary:\"<p> Return the number of facts in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of facts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-footnotes\",qname:\"filings:num-footnotes\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of footnotes in each of the given filings.\\n\",summary:\"<p> Return the number of footnotes in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of facts\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-line-items\",qname:\"filings:num-line-items\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) line items in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) line items in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of line items\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-members\",qname:\"filings:num-members\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) members in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) members in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of members\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-networks\",qname:\"filings:num-networks\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of networks in each of the given filings.\\n\",summary:\"<p> Return the number of networks in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of networks\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-report-elements\",qname:\"filings:num-report-elements\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of (distinct) report elements in each of the given filings.\\n\",summary:\"<p> Return the number of (distinct) report elements in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of report elements\"},errors:[]},{isDocumented:!0,arity:1,name:\"num-tables\",qname:\"filings:num-tables\",signature:\"($filings-or-ids) as integer*\",description:\" Return the number of tables in each of the given filings.\\n\",summary:\"<p> Return the number of tables in each of the given filings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filings-or-ids\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> list of filings or IDs</div>'}],returns:{type:\"integer*\",description:\"the said number of tables\"},errors:[]}],variables:[]},\"http://zorba.io/modules/string\":{ns:\"http://zorba.io/modules/string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides string related functions.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Mostly, the functions in this module provide primitives\\n to work with streamable strings. For example, it allows to\\n check whether a given string is streamable or seekable.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/string\",prefix:\"string\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"analyze-string\",qname:\"string:analyze-string\",signature:\"($input as xs:string?, $pattern as xs:string) as array()\",description:' Analyzes a string using a regular expression, returning sequence of JSON\\n objects that identify which parts of the input string matched or failed to\\n match the regular expression; and in the case of matched substrings, which\\n substrings matched each capturing group in the regular expression.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This function behaves like\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-analyze-string\"><code>fn:analyze-string</code></a>\\n but returns a JSON array rather than an XML element.\\n',summary:\"<p> Analyzes a string using a regular expression, returning sequence of JSON\\n objects that identify which parts of the input string matched or failed to\\n match the regular expression; and in the case of matched substrings, which\\n substrings matched each capturing group in the regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to analyze. If the empty sequence, the function behaves as if <code>$input</code> were a zero-length string.</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The regular expression.</div>'}],returns:{type:\"array()\",description:'a JSON array of objects where each object contains a single key/value pair. Each key is either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">match</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">non-match</code>. For <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">non-match</code>, the value is a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that did not match; for <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">match</code>, the value is either a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that matched (when <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$pattern</code> contains no capturing groups) or an array containing values for both capturing groups and other matches. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Capturing group matches are themselves arrays where the first element is the group number (1-based) and subsequent elements are either a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that matched or sub-arrays for nested capturing groups.'},errors:[]},{isDocumented:!0,arity:3,name:\"analyze-string\",qname:\"string:analyze-string\",signature:\"($input as xs:string?, $pattern as xs:string, $flags as xs:string) as array() external\",description:' Analyzes a string using a regular expression, returning sequence of JSON\\n objects that identify which parts of the input string matched or failed to\\n match the regular expression; and in the case of matched substrings, which\\n substrings matched each capturing group in the regular expression.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This function behaves like\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-analyze-string\"><code>fn:analyze-string</code></a>\\n but returns a JSON array rather than an XML element.\\n',summary:\"<p> Analyzes a string using a regular expression, returning sequence of JSON\\n objects that identify which parts of the input string matched or failed to\\n match the regular expression; and in the case of matched substrings, which\\n substrings matched each capturing group in the regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to analyze. If the empty sequence, the function behaves as if <code>$input</code> were a zero-length string.</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The regular expression.</div>'},{name:\"flags\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The  argument is interpreted in the same way as for the <a href=\"http://www.w3.org/TR/xpath-functions-30/#func-matches\"><code>fn:matches</code></a> function.</div>'}],returns:{type:\"array()\",description:'a JSON array of objects where each object contains a single key/value pair. Each key is either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">match</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">non-match</code>. For <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">non-match</code>, the value is a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that did not match; for <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">match</code>, the value is either a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that matched (when <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$pattern</code> contains no capturing groups) or an array containing values for both capturing groups and other matches. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> Capturing group matches are themselves arrays where the first element is the group number (1-based) and subsequent elements are either a string that is the part of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$input</code> that matched or sub-arrays for nested capturing groups.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-seekable\",qname:\"string:is-seekable\",signature:\"($s as string) as boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function checks whether a given string item is a\\n seekable stream string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, a seekable streamable string is returned by the\\n file module.</p>\\n',summary:\"<p>  This function checks whether a given string item is a\\n seekable stream string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to check</div>'}],returns:{type:\"boolean\",description:\"true if the given item is a seekable stream string or false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-streamable\",qname:\"string:is-streamable\",signature:\"($s as string) as boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function checks whether a given string item is implemented by a\\n streamable string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A streamable string is produced by some functions of a module.\\n It\\'s an optimized implementation of an string to handle arbitrary\\n sized data. The drawback is that its value can only be consumed once.\\n That is, only one function can access the value of a streamable string\\n item.</p>\\n',summary:\"<p>  This function checks whether a given string item is implemented by a\\n streamable string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to check</div>'}],returns:{type:\"boolean\",description:\"true if the given item is implemented using a streamable string or false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"materialize\",qname:\"string:materialize\",signature:\"($s as string) as string external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function materializes a streamable string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The drawback of a streamable (non-seekable) string is that\\n its value can only be consumed once. That is, only one function\\n can access the value of a streamable string item.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In order to remedy this situation, this function can be used to\\n convert a streamable string into its non-streamable counterpart. As a\\n result, the string returned by this function has the same value as its\\n input but is materialized and, hence, can be consumed multiple times.</p>\\n',summary:\"<p>  This function materializes a streamable string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the streamable string item to materialize</div>'}],returns:{type:\"string\",description:\"a materialized string of its input or the input if the input item was not a streamable string.\"},errors:[]},{isDocumented:!0,arity:2,name:\"split\",qname:\"string:split\",signature:\"($s as string, $separator as string) as string* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of strings constructed by splitting the input wherever\\n the given separator is found.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function is different from tokenize. It doesn\\'t allow\\n the separator to be a regular expression. This restriction allows for more\\n performant implementation. Specifically, the function processes\\n streamable strings as input in a streamable way which is particularly useful\\n to tokenize huge strings.</p>\\n',summary:\"<p>  Returns a sequence of strings constructed by splitting the input wherever\\n the given separator is found.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the input string to split</div>'},{name:\"separator\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the separator used for splitting the input string $s</div>'}],returns:{type:\"string*\",description:\"a sequence of strings constructed by splitting the input\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/store\":{ns:\"http://www.28msec.com/modules/store\",description:\" This module provides functions to perform MongoDB query operations\\n (i.e. find and aggregate) on the database associated with the\\n project.\\n <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">The module is always imported so you don't need to import it explicitly.\\n Also, you don't need to fully qualify the function if you want to invoke it.</p>\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/mongodb/types\",prefix:\"mongo\"},{uri:\"http://www.28msec.com/modules/store\",prefix:\"store\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"aggregate\",qname:\"store:aggregate\",signature:\"($collection as string, $pipeline as array()) as object() external\",description:' Performs a MongoDB aggregation framework job on the given collection.\\n The <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$pipeline</em> parameter needs to specify a valid aggregation\\n framework pipeline. For example,\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  [\\n    { $project : {\\n       author : 1,\\n       tags : 1,\\n    } },\\n    { $unwind : \"$tags\" },\\n    { $group : {\\n       _id : { tags : \"$tags\" },\\n       authors : { $addToSet : \"$author\" }\\n    } }\\n ]\\n </pre>\\n The function returns the result as one object. The object contains\\n the field named \"ok\" with value 0 if the execution failed or 1 if\\n it succeeded. If it succeeded, the result is contained as an array\\n in the result field. Otherwise, the errmsg field contains the description\\n of the error. For exampl,e\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n {\\n   \"result\" : [ ... ],\\n   \"ok\" : 1\\n }\\n </pre>\\n',summary:\"<p> Performs a MongoDB aggregation framework job on the given collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection to execute the job on</div>'},{name:\"pipeline\",type:\"array()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the specification of the pipeline to execute</div>'}],returns:{type:\"object()\",description:\"an object with the result or the error message.\"},errors:[]},{isDocumented:!1,arity:1,name:\"clear-if\",qname:\"store:clear-if\",signature:\"($cond as boolean) as integer\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cond\",type:\"boolean\",occurrence:null,description:\"\"}],returns:{type:\"integer\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"clear\",qname:\"store:clear\",signature:\"() as integer external\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"integer\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"collection-chunk-specs\",qname:\"store:collection-chunk-specs\",signature:\"($name as string) as object()*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:\"object()*\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"collection-chunk-specs\",qname:\"store:collection-chunk-specs\",signature:\"($name as string, $chunk-size as integer) as object()* external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:\"\"},{name:\"chunk-size\",type:\"integer\",occurrence:null,description:\"\"}],returns:{type:\"object()*\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"collection-chunk\",qname:\"store:collection-chunk\",signature:\"($name as string, $chunk as object()) as item()* external\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"string\",occurrence:null,description:\"\"},{name:\"chunk\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"find\",qname:\"store:find\",signature:\"($coll as string, $query as object()) as object()*\",description:\" Performs a MongoDB query operation on the given collection and\\n returns all matches.\\n\",summary:\"<p> Performs a MongoDB query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"coll\",type:\"string\",occurrence:null,description:\"\"},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0009 if the given collection does not exist</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"find\",qname:\"store:find\",signature:\"($coll as string, $query as object(), $options as object()) as object()* external\",description:' Performs a MongoDB query operation on the given collection and\\n returns all matches.\\n Available options:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>to-return: the maximum number of objects to return (0 = unlimited)</li>\\n   <li>to-skip: start with the n-th object</li>\\n   <li>batch-size: the number of objects to return in one batch</li>\\n   <li>slave-ok: allow this query to be run against a replica secondary</li>\\n   <li>await-data: the server will block for some extra time before returning,\\n   waiting for more data to return</li>\\n   <li>partial-results: return partial results if some shards are down instead\\n   of returning an error</li>\\n </ul>\\n',summary:\"<p> Performs a MongoDB query operation on the given collection and\\n returns all matches.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"coll\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection</div>'},{name:\"query\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query operation to perform</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options for this operation</div>'}],returns:{type:\"object()*\",description:\"all matches returned by the given query operation\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0009 if the given collection does not exist</xqdoc:error>']},{isDocumented:!1,arity:1,name:\"flush-if\",qname:\"store:flush-if\",signature:\"($cond as boolean) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"cond\",type:\"boolean\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"flush\",qname:\"store:flush\",signature:\"() as empty-sequence() external\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/hash\":{ns:\"http://zorba.io/modules/hash\",description:\" This module provides functions that perform different hash operations.\\n For example, they compute MD5 and various SHA functions on either\\n strings or binary. The result is the base64 encoded value of the hash.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Gabriel Petrovay, Markus Pilman, Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/hash\",prefix:\"hash\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"hash-binary\",qname:\"hash:hash-binary\",signature:\"($value as xs:base64Binary, $alg as xs:string) as xs:base64Binary external\",description:\" This function computes a hash value of the binary form of the given\\n base64Binary item, i.e. the item is base64-decoded before hashing.\\n\",summary:\"<p> This function computes a hash value of the binary form of the given\\n base64Binary item, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The binary item to be hashed.</div>'},{name:\"alg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The algorithm to use for this hashing operation. Supported algorithms are \"md5\", \"sha1\", and \"sha256\".</div>'}],returns:{type:\"xs:base64Binary\",description:\"The hash as xs:base64Binary of the provided binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hash:UNSUPPORTED-ALGORITHM if the given hash algorithm is not supported</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"hash\",qname:\"hash:hash\",signature:\"($value as xs:string, $alg as xs:string) as xs:base64Binary external\",description:\" This function computes a hash value of the string provided as parameter.\\n The function expects the hash algorithm to be used as parameter.\\n\",summary:\"<p> This function computes a hash value of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to be hashed.</div>'},{name:\"alg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The algorithm to use for this hashing operation. Supported algorithms are \"md5\", \"sha1\", and \"sha256\".</div>'}],returns:{type:\"xs:base64Binary\",description:\"The hash as xs:base64binary of the provided string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hash:UNSUPPORTED-ALGORITHM if the given hash algorithm is not supported</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"md5-binary\",qname:\"hash:md5-binary\",signature:\"($value as xs:base64Binary) as xs:base64Binary\",description:\" This function computes the MD5 hash value of the binary form of the given\\n base64Binary item, i.e. the item is base64-decoded before hashing.\\n\",summary:\"<p> This function computes the MD5 hash value of the binary form of the given\\n base64Binary item, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The binary item to hash.</div>'}],returns:{type:\"xs:base64Binary\",description:\"The MD5 hash of the provided binary.\"},errors:[]},{isDocumented:!0,arity:1,name:\"md5\",qname:\"hash:md5\",signature:\"($value as xs:string) as xs:base64Binary\",description:\" Computes the MD5 hash of the string provided as parameter.\\n\",summary:\"<p> Computes the MD5 hash of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to hash</div>'}],returns:{type:\"xs:base64Binary\",description:\"The MD5 hash as xs:base64Binary\"},errors:[]},{isDocumented:!0,arity:1,name:\"sha1-binary\",qname:\"hash:sha1-binary\",signature:\"($value as xs:base64Binary) as xs:base64Binary\",description:\" This function computes the SHA1 hash value of the binary form of the given\\n base64Binary item, i.e. the item is base64-decoded before hashing.\\n\",summary:\"<p> This function computes the SHA1 hash value of the binary form of the given\\n base64Binary item, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The binary item to hash.</div>'}],returns:{type:\"xs:base64Binary\",description:\"The base64 encoded SHA1 hash of the provided binary.\"},errors:[]},{isDocumented:!0,arity:1,name:\"sha1\",qname:\"hash:sha1\",signature:\"($value as xs:string) as xs:base64Binary\",description:\" Computes the SHA1 hash of the string provided as parameter.\\n\",summary:\"<p> Computes the SHA1 hash of the string provided as parameter.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to hash.</div>'}],returns:{type:\"xs:base64Binary\",description:\"The SHA1 hash as xs:base64Binary\"},errors:[]}],variables:[]},\"http://zorba.io/modules/xsl-fo\":{ns:\"http://zorba.io/modules/xsl-fo\",description:' This module converts <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3schools.com/xslfo/default.asp\">XSL-FO</a> documents\\n to various formats such as PDF, EPS, PCL, AFP, Text, PNG, Postscript, RTF, and TIFF.\\n For instance, the following example converts a simple XSL-FO document to PDF:\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">import module namespace fop = \"http://zorba.io/modules/xsl-fo\";\\n import module namespace file = \"http://expath.org/ns/file\";\\n declare namespace fo = \"http://www.w3.org/1999/XSL/Format\";\\n let $xsl-fo := &lt;fo:root xmlns:fo=\"http://www.w3.org/1999/XSL/Format\"&gt;\\n   &lt;fo:layout-master-set&gt;\\n     &lt;fo:simple-page-master master-name=\"my-page\"&gt;\\n       &lt;fo:region-body margin=\"1in\"/&gt;\\n     &lt;/fo:simple-page-master&gt;\\n   &lt;/fo:layout-master-set&gt;\\n   &lt;fo:page-sequence master-reference=\"my-page\"&gt;\\n     &lt;fo:flow flow-name=\"xsl-region-body\"&gt;\\n       &lt;fo:block&gt;Hello, world!&lt;/fo:block&gt;\\n     &lt;/fo:flow&gt;\\n   &lt;/fo:page-sequence&gt;\\n  &lt;/fo:root&gt;\\n let $pdf := fop:generator($fop:PDF, $xsl-fo)\\n return file:write-binary(\"simple.pdf\", $pdf)</pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module uses Apache-FOP to generate content from an XSL-FO document.\\n See <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlgraphics.apache.org/fop/\">the Apache FOP documentation</a> for further information.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note for Windows users</b>: On Windows, this module won\\'t work out of the box, since\\n this module uses Java. But the Java VM dll is not in the system path by default. To make\\n this module work, you need to add the directory where the jvm.dll is located to the\\n system path. This dll is located at JRE_DIR\\\\bin\\\\client. On a standard installation, this would\\n be something a path like \"C:\\\\Program Files\\\\Java\\\\jre6\\\\bin\\\\client\".\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://xmlgraphics.apache.org/fop/</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Markus Pilman</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/util-jvm\",prefix:\"util-jvm\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/modules/xsl-fo\",prefix:\"xsl-fo\"}],functions:[{isDocumented:!0,arity:2,name:\"generator\",qname:\"xsl-fo:generator\",signature:\"($output-format as xs:string, $xsl-fo-document as node()) as xs:base64Binary\",description:' The generator function takes an XSL-FO document as input and generates output\\n in the format given as input.\\n The output format can be given as a MIME type - for example \"application/pdf\"\\n - or one of the predefined variables can be used - like $xsl-fo:PDF. Please\\n refer to the Apache FOP documentation for\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlgraphics.apache.org/fop/0.95/output.html\">supported output formats</a>.\\n Apache FOP does not support 100% of the XSL-FO standard.\\n Please consult the <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlgraphics.apache.org/fop/\">official\\n documentation for further information</a>.\\n This function tries to find the needed Java libraries itself.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n On a Mac OS X computer, it should be sufficient to install Apache FOP via Mac\\n Ports.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n On Ubuntu it should be sufficient to install the fop packages via apt-get.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n On Windows, the classpath needs to be set manually using\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#generator#3\">generator#3</a>.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This function tries to find the jar files via environment variables. The user can set the\\n variable FOP_HOME to the root directory of an Apache FOP distribution. If you have all\\n JAR files in the same directory, you can set the environment variable FOP_LIB_DIR to this\\n directory.\\n',summary:\"<p> The generator function takes an XSL-FO document as input and generates output\\n in the format given as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"output-format\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The mime of the output format, to tell Apache FOP which kind of document it should create.</div>'},{name:\"xsl-fo-document\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The XSL-FO document from which the output should be generated.</div>'}],returns:{type:\"xs:base64Binary\",description:\"The generated output document.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xsl-fo:JVM-NOT-STARTED If zorba was unable to start the JVM.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xsl-fo:JAVA-EXCEPTION If Apache FOP throws an exception - i.e. if the input format is not correct/supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xsl-fo:JAR-NOT-FOUND If a needed Java library could not be found.</xqdoc:error>']}],variables:[{name:\"xsl-fo:AFP\",type:\"xs:string\",description:\" The mime type of IBMs AFP format (application/x-afp).\\n\"},{name:\"xsl-fo:EPS\",type:\"xs:string\",description:\" The mime type of the EPS format (application/postscript).\\n\"},{name:\"xsl-fo:PCL\",type:\"xs:string\",description:\" The mime type of the PCL format (application/x-pcl).\\n\"},{name:\"xsl-fo:PDF\",type:\"xs:string\",description:\" The mime type of the PDF format (application/pdf).\\n\"},{name:\"xsl-fo:PLAIN_TEXT\",type:\"xs:string\",description:\" The mime type for plain text files (text/plain).\\n\"},{name:\"xsl-fo:PNG\",type:\"xs:string\",description:\" The mime type of the PNG format (image/png).\\n\"},{name:\"xsl-fo:POSTSCRIPT\",type:\"xs:string\",description:\" The mime type of the postscript format (application/postscript).\\n\"},{name:\"xsl-fo:RTF\",type:\"xs:string\",description:\" The mime type of the RTF format (application/rtf).\\n\"},{name:\"xsl-fo:TIFF\",type:\"xs:string\",description:\" The mime type of TIFF format (application/tiff).\\n\"}]},\"http://zorba.io/warnings\":{ns:\"http://zorba.io/warnings\",description:\" This module contains one variable declaration for each diagnostic of the\\n http://zorba.io/warnings namespace.\\n The variables serves as documentation for the errors but can also\\n be used in the code. For example, one useful scenario is to compare\\n an error caught in the catch clause of a try-catch expression with one of\\n the variables.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Carlos Lopez</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/warnings\",prefix:\"zwarn\"}],functions:[],variables:[{name:\"zwarn:NS\",type:\"item()*\",description:\"\"},{name:\"zwarn:ZWST0002\",type:\"xs:QName\",description:\" This warning is reported if the declaration of a function, variable,\\n collection, or index contains an annotation that is not in the\\n http://zorba.io/annotations namespace and Zorba doesn't know how to\\n handle.\\n\"},{name:\"zwarn:ZWST0003\",type:\"item()*\",description:\"\"},{name:\"zwarn:ZWST0004\",type:\"item()*\",description:\"\"},{name:\"zwarn:ZWST0005\",type:\"xs:QName\",description:\" This warning is raised if the user explicitly enables caching\\n of function results (using the %an:cache or %an:strictlydeterministic\\n annotation) but the function cannot be cached.\\n For %an:cache this happens if the function is updating or variadic.\\n For %an:strictlydeterministic this happens if the function is updating,\\n variadic or sequential.\\n\"},{name:\"zwarn:ZWST0006\",type:\"xs:QName\",description:\" This warning is raised if the user explicitly enables caching\\n of function results (using the %an:cache annotation) and the function\\n is annotated as sequential or nondeterministic.\\n\"},{name:\"zwarn:ZWST0007\",type:\"item()*\",description:\"\"},{name:\"zwarn:ZWST0008\",type:\"item()*\",description:\"\"},{name:\"zwarn:ZWST0009\",type:\"xs:QName\",description:' This warning is enabled when the \"common-language\" option is employed. It will raise warnings\\n for language features that are not supported by both XQuery and JSONiq grammars.\\n'}]},\"http://www.28msec.com/modules/sparql\":{ns:\"http://www.28msec.com/modules/sparql\",description:' This module contains functions to interact with a SPARQL endpoint.\\n Requests to an endpoint are made using HTTP.\\n Specifically, this module allows SELECT, ASK, CONSTRUCT and DESCRIBE queries. Additionally, it also allows for UPDATE statements.\\n Various result formats are supported (e.g. XML, JSON, CSV)\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Configuration</h2>\\n For this module you may use a preconfigured default or named datasource of the SPARQL category.\\n You can also provide a configuration object directly.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">As config parameter you can either pass a string that will be interpreted as a SPARQL endpoint datasource name or\\n  an object with the following properties:\\n <ul>\\n  <li><tt>href</tt>: The URL of the SPARQL endpoint to use. Required.</li>\\n  <li><tt>auth_method</tt>: The HTTP authentication method to use.</li>\\n  <li><tt>username</tt>: The username to use for HTTP authentication.</li>\\n  <li><tt>password</tt>: The password to use for HTTP authentication.</li>\\n </ul>\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Options</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The options object that can be passed to plenty of the functions in this module. It may have the following properties:\\n <ul>\\n   <li><tt>default-graph-uri</tt>: A string or an array of strings with the graph URIs to be used by the query.</li>\\n   <li><tt>named-graph-uri</tt>: A string or an array of strings with the named graph URIs to be used by the query.</li>\\n   <li><tt>using-graph-uri</tt>: A string or an array of strings with the graph URIs to be used by an update statement.</li>\\n   <li><tt>using-named-graph-uri</tt>: A string or an array of strings with the named graph URIs to be used by an update statement.</li>\\n   <li><tt>method</tt>: The request method to be used. Available method values are $sparql:METHOD-GET, $sparql:METHOD-POST-URLENCODED or $sparql:METHOD-POST-SPARQL.</li>\\n   <li><tt>format</tt> : The result format to request. Possible format values are $sparql:FORMAT-XML, $sparql:FORMAT-JSON, $sparql:FORMAT-CSV, $sparql:FORMAT-TSV, $sparql:FORMAT-ANY. For CONSTRUCT or DESCRIBE queries $sparql:FORMAT-RDF is available.</li>\\n   <li><tt>parameters</tt>: Many SPARQL endpoints support additional parameters which are not part of the SPARQL endpoint specification. They can be provided here.</li>\\n   <li><tt>http-headers</tt>: object that will be used as the headers property for the requests made by the http-client.</li>\\n   <li><tt>http-options</tt>: object that will be used as the options property for the requests made by the http-client.</li>\\n  </ul>\\n <p>All those properties are optional.</p>\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Alexander.Kreutz@28msec.com</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"http-client\"},{uri:\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\",prefix:\"rdf\"},{uri:\"http://www.w3.org/2005/sparql-results#\",prefix:\"s\"},{uri:\"http://www.28msec.com/modules/sparql\",prefix:\"sparql\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"ask\",qname:\"sparql:ask\",signature:\"($query as string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.\\n The default datasource for SPARQL will be used.\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL ASK query as string.</div>'}],returns:{type:\"xs:boolean\",description:\"The boolean ASK query result.\"},errors:[]},{isDocumented:!0,arity:2,name:\"ask\",qname:\"sparql:ask\",signature:\"($query as string, $options as object()?) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. However this function will try to extract only the boolean answer from the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"xs:boolean\",description:\"The boolean ASK query result.\"},errors:[]},{isDocumented:!0,arity:3,name:\"ask\",qname:\"sparql:ask\",signature:\"($config as item()?, $query as string, $options as object()?) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. However this function will try to extract only the boolean answer from the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL ASK query to an endpoint and returns the result as boolean value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"xs:boolean\",description:\"The boolean ASK query result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-RESPONSE-TYPE if the response format cannot be handled by this function</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:ERROR if any http or endpoint error occurs</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"query-json\",qname:\"sparql:query-json\",signature:\"($query as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.\\n If the endpoint fails to deliver SPARQL JSON result format this function will try to convert the results to JSON if possible.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/sparql11-results-json\" target=\"_blank\">SPARQL 1.1 Query Results JSON Format</a></p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'}],returns:{type:\"object()\",description:\"The query result in SPARQL JSON format.\"},errors:[]},{isDocumented:!0,arity:2,name:\"query-json\",qname:\"sparql:query-json\",signature:\"($query as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.\\n If the endpoint fails to deliver SPARQL JSON result format this function will try to convert the results to JSON if possible.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/sparql11-results-json\" target=\"_blank\">SPARQL 1.1 Query Results JSON Format</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/sparql-results+json\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The query result in SPARQL JSON format.\"},errors:[]},{isDocumented:!0,arity:3,name:\"query-json\",qname:\"sparql:query-json\",signature:\"($config as item()?, $query as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.\\n If the endpoint fails to deliver SPARQL JSON result format this function will try to convert the results to JSON if possible.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/sparql11-results-json\" target=\"_blank\">SPARQL 1.1 Query Results JSON Format</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/sparql-results+json\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL JSON format object.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The query result in SPARQL JSON format.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-RESPONSE-TYPE if the response format cannot be handled by this function</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:ERROR if any http or endpoint error occurs</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"query-rdf\",qname:\"sparql:query-rdf\",signature:\"($query as string) as element(rdf:RDF)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-syntax-grammar\" target=\"_blank\">RDF/XML Syntax Specification</a></p>\\n',summary:\"<p>  \\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL CONSTRUCT or DESCRIBE query as string.</div>'}],returns:{type:\"element(rdf:RDF)\",description:\"The query result as RDF XML element.\"},errors:[]},{isDocumented:!0,arity:2,name:\"query-rdf\",qname:\"sparql:query-rdf\",signature:\"($query as string, $options as object()?) as element(rdf:RDF)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-syntax-grammar\" target=\"_blank\">RDF/XML Syntax Specification</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/rdf+xml\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL CONSTRUCT or DESCRIBE query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"element(rdf:RDF)\",description:\"The query result as RDF XML element.\"},errors:[]},{isDocumented:!0,arity:3,name:\"query-rdf\",qname:\"sparql:query-rdf\",signature:\"($config as item()?, $query as string, $options as object()?) as element(rdf:RDF)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-syntax-grammar\" target=\"_blank\">RDF/XML Syntax Specification</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/rdf+xml\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL CONSTRUCT or DESCRIBE query to an endpoint and returns the query response as RDF.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL CONSTRUCT or DESCRIBE query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"element(rdf:RDF)\",description:\"The query result as RDF XML element.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-RESPONSE-TYPE if the response format cannot be handled by this function</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:ERROR if any http or endpoint error occurs</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"query-xml\",qname:\"sparql:query-xml\",signature:\"($query as string) as element(s:sparql)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.\\n If the endpoint fails to deliver SPARQL XML result format this function will try to convert the results to XML if possible.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-sparql-XMLres/\" target=\"_blank\">SPARQL Query Results XML Format</a></p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'}],returns:{type:\"element(s:sparql)\",description:\"The query result in SPARQL XML format.\"},errors:[]},{isDocumented:!0,arity:2,name:\"query-xml\",qname:\"sparql:query-xml\",signature:\"($query as string, $options as object()?) as element(s:sparql)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.\\n If the endpoint fails to deliver SPARQL XML result format this function will try to convert the results to XML if possible.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-sparql-XMLres/\" target=\"_blank\">SPARQL Query Results XML Format</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/sparql-results+xml\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"element(s:sparql)\",description:\"The query result in SPARQL XML format.\"},errors:[]},{isDocumented:!0,arity:3,name:\"query-xml\",qname:\"sparql:query-xml\",signature:\"($config as item()?, $query as string, $options as object()?) as element(s:sparql)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.\\n If the endpoint fails to deliver SPARQL XML result format this function will try to convert the results to XML if possible.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Link to the specification of the result format at W3C: <a href=\"http://www.w3.org/TR/rdf-sparql-XMLres/\" target=\"_blank\">SPARQL Query Results XML Format</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object will be ignored. \"application/sparql-results+xml\" will be requested as result format. </li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL SELECT or ASK query to an endpoint and returns the query response as SPARQL XML format element.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL SELECT or ASK query as string.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"element(s:sparql)\",description:\"The query result in SPARQL XML format.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-RESPONSE-TYPE if the response format cannot be handled by this function</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:ERROR if any http or endpoint error occurs</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"query\",qname:\"sparql:query\",signature:\"($query as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.\\n The default datasource for SPARQL will be used.\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL query as string. May be any kind of query but not an update.</div>'}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:[]},{isDocumented:!0,arity:2,name:\"query\",qname:\"sparql:query\",signature:\"($query as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. XML will be used as default. However, note that this function does not interpret the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL query as string. May be any kind of query but not an update.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:[]},{isDocumented:!0,arity:3,name:\"query\",qname:\"sparql:query\",signature:\"($config as item()?, $query as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>default-graph-uri</tt> and <tt>named-graph-uri</tt> properties of the options object may be used to pass default graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. GET will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. XML will be used as default. However, note that this function does not interpret the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL query to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A SPARQL query as string. May be any kind of query but not an update.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"update\",qname:\"sparql:update\",signature:\"($update-statement as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.\\n The default datasource for SPARQL will be used.\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"update-statement\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:[]},{isDocumented:!0,arity:2,name:\"update\",qname:\"sparql:update\",signature:\"($update-statement as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.\\n The default datasource for SPARQL will be used.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>using-graph-uri</tt> and <tt>using-named-graph-uri</tt> properties of the options object may be used to pass graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. POST-URLENCODED will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. XML will be used as default. However, note that this function does not interpret the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"update-statement\",type:\"string\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:[]},{isDocumented:!0,arity:3,name:\"update\",qname:\"sparql:update\",signature:\"($config as item()?, $update-statement as string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <ul>\\n    <li>The <tt>using-graph-uri</tt> and <tt>using-named-graph-uri</tt> properties of the options object may be used to pass graph URIs or named graph URIs to the endpoint.</li>\\n    <li>The <tt>method</tt> property of the options object may be used to set the request method to be used. POST-URLENCODED will be used as default.</li>\\n    <li>The <tt>format</tt> property of the options object may be used to request a specific result format. XML will be used as default. However, note that this function does not interpret the result.</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  \\n This function sends a SPARQL update statement to an endpoint and directly returns the corresponding HTTP response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"config\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the credentials to use as string or a config object as described in the module description.</div>'},{name:\"update-statement\",type:\"string\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An optional options object as described in the module description.</div>'}],returns:{type:\"object()\",description:\"The endpoints response. This function returns the plain response object from the http-client.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:INVALID-PARAMETER invalid option specification</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-NOT-FOUND credential information not found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">sparql:CREDENTIALS-INVALID credential information not valid</xqdoc:error>']}],variables:[{name:\"sparql:CREDENTIALS-CATEGORY\",type:\"string\",description:\" This variable represents the category of the datasource.\\n\"},{name:\"sparql:METHOD-GET\",type:\"string\",description:' This variable represents the request method using HTTP GET requests. May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">method</tt> property of the options object.\\n'},{name:\"sparql:METHOD-POST-URLENCODED\",type:\"string\",description:' This variable represents the request method using HTTP POST with URL-encoded parameters. May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">method</tt> property of the options object.\\n'},{name:\"sparql:METHOD-POST-SPARQL\",type:\"string\",description:' This variable represents the request method using HTTP POST with the application/sparql-query content type. May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">method</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-XML\",type:\"string\",description:' This variable represents the SPARQL XML result format.May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-JSON\",type:\"string\",description:' This variable represents the SPARQL JSON result format.May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-RDF\",type:\"string\",description:' This variable represents the RDF+XML result format.May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-CSV\",type:\"string\",description:' This variable represents the CSV result format.May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-TSV\",type:\"string\",description:' This variable represents the TSV result format.May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object.\\n'},{name:\"sparql:FORMAT-ANY\",type:\"string\",description:' This variable represents any result format. May be used for the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">format</tt> property of the options object to not specify a requested format.\\n'}]},\"http://api.28.io/dispatcher\":{ns:\"http://api.28.io/dispatcher\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/browserview\",prefix:\"browserview\"},{uri:\"http://api.28.io/csvview\",prefix:\"csvview\"},{uri:\"http://api.28.io/dispatcher\",prefix:\"dispatcher\"},{uri:\"http://api.28.io/functions\",prefix:\"functions\"},{uri:\"http://api.28.io/model\",prefix:\"model\"},{uri:\"http://zorba.io/modules/xml\",prefix:\"parse-xml\"},{uri:\"http://www.zorba-xquery.com/schemas/pul\",prefix:\"pul\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"response\"},{uri:\"http://www.zorba-xquery.com/schemas/xdm\",prefix:\"xdm\"},{uri:\"http://api.28.io/xdmview\",prefix:\"xdmview\"}],functions:[{isDocumented:!0,arity:0,name:\"restapi\",qname:\"dispatcher:restapi\",signature:\"()\",description:\" Main function for the collection browser. May be called from a handler function.\\n Uses the call URL to determine which page needs to be returned.\\n The URL for the initial page needs to end with /index\\n\",summary:\"<p> Main function for the collection browser.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"the requested page of the collection browser\"},errors:[]}],variables:[]},\"http://zorba.io/modules/store/static/collections/ddl\":{ns:\"http://zorba.io/modules/store/static/collections/ddl\",description:' This modules defines a set of functions for managing collections that are\\n declared in the prolog of a module.\\n For example, it provides functions to create, delete, or introspect\\n collections.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data\\n Definition Facility</a>. All the collections managed by this module\\n have to be pre-declared in the prolog of a module. Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/store/static/collections/ddl\",prefix:\"cddl\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:0,name:\"available-collections\",qname:\"cddl:available-collections\",signature:\"() as xs:QName* external\",description:\" Gets the QNames of the collections that have been statically declared and\\n are available, if any.\\n\",summary:\"<p> Gets the QNames of the collections that have been statically declared and\\n are available, if any.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence comprising one QName for each statically declared and available collection or an emtpy sequence if no such collections are available.\"},errors:[]},{isDocumented:!0,arity:1,name:\"create\",qname:\"cddl:create\",signature:\"($name as xs:QName) external\",description:\" Creates a collection.\\n\",summary:\"<p> Creates a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The of the collection to create.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, creates a collection with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if <code>$name</code> is not equal to any of the declared collections in the static context.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0002 if a collection with <code>$name</code> already exists.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"create\",qname:\"cddl:create\",signature:\"($name as xs:QName, $content as item()*) external\",description:\" Creates a collection and adds the given sequence as content to the new\\n collection.\\n\",summary:\"<p> Creates a collection and adds the given sequence as content to the new\\n collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to create.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequences of items (nodes or JSON items) to be added to the new collection.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, creates a collection with the given name and inserts the given items into it.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if <code>$name</code> is not equal to any of the declared collections in the static context.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0002 if a collection with <code>$name</code> already exists.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type declared by the collection according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"declared-collections\",qname:\"cddl:declared-collections\",signature:\"() as xs:QName* external\",description:\" Gets the collections that have been declared in the prolog of the static\\n context.\\n\",summary:\"<p> Gets the collections that have been declared in the prolog of the static\\n context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each collection created in the static context, or an emtpy sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"delete\",qname:\"cddl:delete\",signature:\"($name as xs:QName) external\",description:\" Deletes a collection.\\n\",summary:\"<p> Deletes a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The collection to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the collection with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if <code>$name</code> is not equal to any of the declared collections in the static context.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection identified by <code>$name</code> is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0013 if the domain or key expression of any of the available indexes access the collection having <code>$name</code>.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0015 if any of the in-scope variables references an item that belongs to the collection having <code>$name</code></xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-available-collection\",qname:\"cddl:is-available-collection\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gets whether a collection is statically declared and available.\\n\",summary:\"<p> Gets whether a collection is statically declared and available.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to check.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the collection was statically declared and is available; false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-declared-collection\",qname:\"cddl:is-declared-collection\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gers whether a collection was declared in the prolog of the static context.\\n\",summary:\"<p> Gers whether a collection was declared in the prolog of the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to check.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the collection was declared; false otherwise.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/math\":{ns:\"http://www.28msec.com/modules/math\",description:' The functions in this module perform trigonometric and other mathematical\\n calculations on double values.\\n For a more detailed description of the semantics of each function, please\\n refer to <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#trigonometry\">\\n Trigonometric and exponential functions</a>.\\n',sees:[],authors:[],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"fnmath\"},{uri:\"http://www.28msec.com/modules/math\",prefix:\"math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"acos\",qname:\"math:acos\",signature:\"($arg as double?) as double?\",description:\" Returns the arc cosine of the argument, the result being in the range zero to +π radians.\\n\",summary:\"<p> Returns the arc cosine of the argument, the result being in the range zero to +π radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"asin\",qname:\"math:asin\",signature:\"($arg as double?) as double?\",description:\" Returns the arc sine of the argument, the result being in the range -π/2 to +π/2 radians.\\n\",summary:\"<p> Returns the arc sine of the argument, the result being in the range -π/2 to +π/2 radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"atan\",qname:\"math:atan\",signature:\"($arg as double?) as double?\",description:\" Returns the arc tangent of the argument, the result being in the range -π/2 to +π/2 radians.\\n\",summary:\"<p> Returns the arc tangent of the argument, the result being in the range -π/2 to +π/2 radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"atan2\",qname:\"math:atan2\",signature:\"($y as double, $x as double) as double\",description:\" Returns the angle in radians subtended at the origin by the point on a plane with\\n coordinates (x, y) and the positive x-axis, the result being in the range -π to +π.\\n\",summary:\"<p> Returns the angle in radians subtended at the origin by the point on a plane with\\n coordinates (x, y) and the positive x-axis, the result being in the range -π to +π.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"y\",type:\"double\",occurrence:null,description:\"\"},{name:\"x\",type:\"double\",occurrence:null,description:\"\"}],returns:{type:\"double\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"cos\",qname:\"math:cos\",signature:\"($theta as double?) as double?\",description:\" Returns the cosine of the argument, expressed in radians.\\n\",summary:\"<p> Returns the cosine of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exp\",qname:\"math:exp\",signature:\"($arg as double?) as double?\",description:\" Returns the value of ex.\\n\",summary:\"<p> Returns the value of ex.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"exp10\",qname:\"math:exp10\",signature:\"($arg as double?) as double?\",description:\" Returns the value of 10x.\\n\",summary:\"<p> Returns the value of 10x.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"log\",qname:\"math:log\",signature:\"($arg as double?) as double?\",description:\" Returns the natural logarithm of the argument.\\n\",summary:\"<p> Returns the natural logarithm of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"log10\",qname:\"math:log10\",signature:\"($arg as double?) as double?\",description:\" Returns the base-ten logarithm of the argument.\\n\",summary:\"<p> Returns the base-ten logarithm of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"pi\",qname:\"math:pi\",signature:\"() as double\",description:\" Returns an approximation to the mathematical constant π.\\n\",summary:\"<p> Returns an approximation to the mathematical constant π.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"double\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"pow\",qname:\"math:pow\",signature:\"($x as double?, $y) as double?\",description:\" Returns the result of raising the first argument to the power of the second.\\n\",summary:\"<p> Returns the result of raising the first argument to the power of the second.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"x\",type:\"double\",occurrence:\"?\",description:\"\"},{name:\"y\",type:null,occurrence:null,description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sin\",qname:\"math:sin\",signature:\"($theta as double?) as double?\",description:\" Returns the sine of the argument, expressed in radians.\\n\",summary:\"<p> Returns the sine of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sqrt\",qname:\"math:sqrt\",signature:\"($arg as double?) as double?\",description:\" Returns the non-negative square root of the argument.\\n\",summary:\"<p> Returns the non-negative square root of the argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"tan\",qname:\"math:tan\",signature:\"($theta as double?) as double?\",description:\" Returns the tangent of the argument, expressed in radians.\\n\",summary:\"<p> Returns the tangent of the argument, expressed in radians.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"theta\",type:\"double\",occurrence:\"?\",description:\"\"}],returns:{type:\"double?\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/data-cleaning/normalization\":{ns:\"http://zorba.io/modules/data-cleaning/normalization\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides data normalization functions for processing calendar dates,\\n temporal values, currency values, units of measurement, location names and postal addresses.\\n These functions are particularly useful for converting different data representations into cannonical formats.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins and Diogo Simões</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/http-client\",prefix:\"http\"},{uri:\"http://zorba.io/modules/data-cleaning/normalization\",prefix:\"normalization\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"normalize-address\",qname:\"normalization:normalize-address\",signature:\"($addr as xs:string*) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses an address normalization Web service to convert a postal address given as input into a\\n cannonical representation format.</p>\\n',summary:\"<p>  Uses an address normalization Web service to convert a postal address given as input into a\\n cannonical representation format.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"addr\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings encoding an address, where each string in the sequence corresponds to a different component (e.g., street, city, country, etc.) of the address.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings with the address encoded in a cannonical format, where each string in the sequence corresponds to a different component (e.g., street, city, country, etc.) of the address.\"},errors:[]},{isDocumented:!0,arity:1,name:\"normalize-phone\",qname:\"normalization:normalize-phone\",signature:\"($addr as xs:string*) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses an phone number normalization Web service to convert a phone number given as input into a\\n cannonical representation.</p>\\n',summary:\"<p>  Uses an phone number normalization Web service to convert a phone number given as input into a\\n cannonical representation.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"addr\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string*\",description:'A strings with the phone number encoded in a cannonical format. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/> <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b> Attention : This function is still not implemented. </b></p>'},errors:[]},{isDocumented:!0,arity:2,name:\"to-date\",qname:\"normalization:to-date\",signature:\"($sd as xs:string, $format as xs:string?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts a given string representation of a date value into a date representation valid according\\n to the corresponding XML Schema type.</p>\\n',summary:\"<p>  Converts a given string representation of a date value into a date representation valid according\\n to the corresponding XML Schema type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sd\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string representation for the date</div>'},{name:\"format\",type:\"xs:string\",occurrence:\"?\",description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> An optional parameter denoting the format used to represent the date in the string, according to a sequence of conversion specifications. In the format string, a conversion specification is introduced by '%', usually followed by a single letter or 'O' or 'E' and then a single letter. Any character in the format string that is not part of a conversion specification is interpreted literally, and the string '%%' gives '%'. The supported conversion specifications are as follows: <pre> '%b' Abbreviated month name in the current locale. '%B' Full month name in the current locale. '%d' Day of the month as decimal number (01-31). '%m' Month as decimal number (01-12). '%x' Date, locale-specific. '%y' Year without century (00-99). '%Y' Year with century. '%C' Century (00-99): the integer part of the year divided by 100. '%D' Locale-specific date format such as '%m/%d/%y'. '%e' Day of the month as decimal number (1-31), with a leading pace for a single-digit number. '%F' Equivalent to %Y-%m-%d (the ISO 8601 date format). '%h' Equivalent to '%b'. </pre></div>\"}],returns:{type:\"xs:string\",description:\"The date value resulting from the conversion.\"},errors:[]},{isDocumented:!0,arity:2,name:\"to-dateTime\",qname:\"normalization:to-dateTime\",signature:\"($sd as xs:string, $format as xs:string?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts a given string representation of a dateTime value into a dateTime representation\\n valid according to the corresponding XML Schema type.</p>\\n',summary:\"<p>  Converts a given string representation of a dateTime value into a dateTime representation\\n valid according to the corresponding XML Schema type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sd\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string representation for the dateTime.</div>'},{name:\"format\",type:\"xs:string\",occurrence:\"?\",description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> An optional parameter denoting the format used to represent the dateTime in the string, according to a sequence of conversion specifications. In the format string, a conversion specification is introduced by '%', usually followed by a single letter or 'O' or 'E' and then a single letter. Any character in the format string that is not part of a conversion specification is interpreted literally, and the string '%%' gives '%'. The supported conversion specifications are as follows: <p/> <pre class=\\\"ace-static\\\"> '%b' Abbreviated month name in the current locale. '%B' Full month name in the current locale. '%c' Date and time, locale-specific. '%C' Century (00-99): the integer part of the year divided by 100. '%d' Day of the month as decimal number (01-31). '%H' Hours as decimal number (00-23). '%I' Hours as decimal number (01-12). '%j' Day of year as decimal number (001-366). '%m' Month as decimal number (01-12). '%M' Minute as decimal number (00-59). '%p' AM/PM indicator in the locale. Used in conjunction with '%I' and *not* with '%H'. '%S' Second as decimal number (00-61), allowing for up to two leap-seconds. '%x' Date, locale-specific. '%X' Time, locale-specific. '%y' Year without century (00-99). '%Y' Year with century. '%z' Offset from Greenwich, so '-0900' is 9 hours west of Greenwich. '%Z' Time zone as a character string. '%D' Locale-specific date format such as '%m/%d/%y': ISO C99 says it should be that exact format. '%e' Day of the month as decimal number (1-31), with a leading pace for a single-digit number. '%F' Equivalent to %Y-%m-%d (the ISO 8601 date format). '%g' The last two digits of the week-based year (see '%V'). '%G' The week-based year (see '%V') as a decimal number. '%h' Equivalent to '%b'. '%k' The 24-hour clock time with single digits preceded by a blank. '%l' The 12-hour clock time with single digits preceded by a blank. '%r' The 12-hour clock time (using the locale's AM or PM). '%R' Equivalent to '%H:%M'. '%T' Equivalent to '%H:%M:%S'. </pre></div>\"}],returns:{type:\"xs:string\",description:\"The dateTime value resulting from the conversion.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">normalization:NOTSUPPORTED if the dateTime type is not known to the service.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"to-time\",qname:\"normalization:to-time\",signature:\"($sd as xs:string, $format as xs:string?) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts a given string representation of a time value into a time representation valid according to\\n the corresponding XML Schema type.</p>\\n',summary:\"<p>  Converts a given string representation of a time value into a time representation valid according to\\n the corresponding XML Schema type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sd\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string representation for the time.</div>'},{name:\"format\",type:\"xs:string\",occurrence:\"?\",description:\"<div xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> An optional parameter denoting the format used to represent the time in the string, according to a sequence of conversion specifications. In the format string, a conversion specification is introduced by '%', usually followed by a single letter or 'O' or 'E' and then a single letter. Any character in the format string that is not part of a conversion specification is interpreted literally, and the string '%%' gives '%'. The supported conversion specifications are as follows: <p/> <pre class=\\\"ace-static\\\"> '%H' Hours as decimal number (00-23). '%I' Hours as decimal number (01-12). '%M' Minute as decimal number (00-59). '%p' AM/PM indicator in the locale. Used in conjunction with '%I' and *not* with '%H'. '%S' Second as decimal number (00-61), allowing for up to two leap-seconds. '%X' Time, locale-specific. '%z' Offset from Greenwich, so '-0900' is 9 hours west of Greenwich. '%Z' Time zone as a character string. '%k' The 24-hour clock time with single digits preceded by a blank. '%l' The 12-hour clock time with single digits preceded by a blank. '%r' The 12-hour clock time (using the locale's AM or PM). '%R' Equivalent to '%H:%M'. '%T' Equivalent to '%H:%M:%S'. </pre></div>\"}],returns:{type:\"xs:string?\",description:\"The time value resulting from the conversion.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">normalization:NOTSUPPORTED if the date type is not known to the service.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/excel/engineering\":{ns:\"http://zorba.io/modules/excel/engineering\",description:\"  This is a library module offering the same set of functions\\n defined by Microsoft Excel, under Engineering Functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528241033.aspx\" target=\"_blank\">Excel Documentation: Engineering Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/engineering\",prefix:\"excel-engineering\"},{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/modules/excel/text\",prefix:\"excel-text\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"bin2dec\",qname:\"excel-engineering:bin2dec\",signature:\"($arg as xs:anyAtomicType) as xs:integer\",description:\" Converts a binary number to decimal.\\n\",summary:\"<p> Converts a binary number to decimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:integer\",description:\"A decimal representation of a number given it's binary representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a binary representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"bin2hex\",qname:\"excel-engineering:bin2hex\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a binary number to hexadecimal.\\n\",summary:\"<p> Converts a binary number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's binary representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a binary representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"bin2hex\",qname:\"excel-engineering:bin2hex\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a binary number to hexadecimal.\\n\",summary:\"<p> Converts a binary number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's binary representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a binary representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"bin2oct\",qname:\"excel-engineering:bin2oct\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a binary number to octal.\\n\",summary:\"<p> Converts a binary number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A octal representation of a number given it's binary representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a binary representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"bin2oct\",qname:\"excel-engineering:bin2oct\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a binary number to octal.\\n\",summary:\"<p> Converts a binary number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A octal representation of a number given it's binary representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a binary representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"dec2bin\",qname:\"excel-engineering:dec2bin\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to binary.\\n\",summary:\"<p> Converts a decimal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"dec2bin\",qname:\"excel-engineering:dec2bin\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to binary.\\n\",summary:\"<p> Converts a decimal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -512 or bigger than 511.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"dec2hex\",qname:\"excel-engineering:dec2hex\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to hexadecimal.\\n\",summary:\"<p> Converts a decimal number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"dec2hex\",qname:\"excel-engineering:dec2hex\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to hexadecimal.\\n\",summary:\"<p> Converts a decimal number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -549755813888 or bigger than 549755813887.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"dec2oct\",qname:\"excel-engineering:dec2oct\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to octal.\\n\",summary:\"<p> Converts a decimal number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"An octal representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"dec2oct\",qname:\"excel-engineering:dec2oct\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a decimal number to octal.\\n\",summary:\"<p> Converts a decimal number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"An octal representation of a number given it's decimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $arg is smaller than -536870912 or bigger than 536870911</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"hex2bin\",qname:\"excel-engineering:hex2bin\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a hexadecimal number to binary.\\n\",summary:\"<p> Converts a hexadecimal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's hexadecimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"hex2bin\",qname:\"excel-engineering:hex2bin\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a hexadecimal number to binary.\\n\",summary:\"<p> Converts a hexadecimal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's hexadecimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"hex2dec\",qname:\"excel-engineering:hex2dec\",signature:\"($arg as xs:string) as xs:integer\",description:\" Converts a hexadecimal number to decimal.\\n\",summary:\"<p> Converts a hexadecimal number to decimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:integer\",description:\"A decimal representation of a number given it's hexadecimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"hex2oct\",qname:\"excel-engineering:hex2oct\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts a hexadecimal number to octal.\\n\",summary:\"<p> Converts a hexadecimal number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A octal representation of a number given it's hexadecimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"hex2oct\",qname:\"excel-engineering:hex2oct\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts a hexadecimal number to octal.\\n\",summary:\"<p> Converts a hexadecimal number to octal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A octal representation of a number given it's hexadecimal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not a hexadecimal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"oct2bin\",qname:\"excel-engineering:oct2bin\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts an octal number to binary.\\n\",summary:\"<p> Converts an octal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's octal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not an octal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"oct2bin\",qname:\"excel-engineering:oct2bin\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts an octal number to binary.\\n\",summary:\"<p> Converts an octal number to binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A binary representation of a number given it's octal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not an octal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"oct2dec\",qname:\"excel-engineering:oct2dec\",signature:\"($arg as xs:anyAtomicType) as xs:integer\",description:\" Converts an octal number to decimal.\\n\",summary:\"<p> Converts an octal number to decimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:integer\",description:\"A decimal representation of a number given it's octal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not an octal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"oct2hex\",qname:\"excel-engineering:oct2hex\",signature:\"($arg as xs:anyAtomicType) as xs:string\",description:\" Converts an octal number to hexadecimal.\\n\",summary:\"<p> Converts an octal number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's octal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not an octal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"oct2hex\",qname:\"excel-engineering:oct2hex\",signature:\"($arg as xs:anyAtomicType, $places as xs:anyAtomicType) as xs:string\",description:\" Converts an octal number to hexadecimal.\\n\",summary:\"<p> Converts an octal number to hexadecimal.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number.</div>'},{name:\"places\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is the number of characters to use. Places is useful for padding the return value with leading 0s (zeros).</div>'}],returns:{type:\"xs:string\",description:\"A hexadecimal representation of a number given it's octal representation.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg is not an octal representation of a number.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $arg contains more than 10 characters.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value for $places is not numeric.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is zero or negative.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Num if provided value for $places is too small.</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/util-jvm\":{ns:\"http://www.zorba-xquery.com/modules/util-jvm\",description:' This module provides common functionality for modules that use java\\n implementations.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Modules using java implementations must import this module\\n to specify the dependency.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note:</b> Since this module has a Java library dependency a JVM is required\\n to be installed on the system. For Windows: jvm.dll is required on the system\\n path (usually located in \"C:\\\\Program Files\\\\Java\\\\jre\\\\bin\\\\client\").\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/util-jvm\",prefix:\"util-jvm\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[],variables:[]},\"http://www.28msec.com/modules/asynchronous-jobs\":{ns:\"http://www.28msec.com/modules/asynchronous-jobs\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for executing asynchronous jobs.\\n There are three kinds of jobs: (1) a job for executing a (public or private)\\n query of your project, (2) a job for mapping an input\\n collection into an output collection, and (3) a job for shuffling the items\\n of an input collection to several output collections.\\n Map and Shuffle jobs are mostly used within\\n the parallelism framework and are not meant to be created directly.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Jobs that have been scheduled for execution can be referred to by\\n an opaque identifier being returned by the corresponding scheduling\\n function (e.g. job:execute or job:map). Specifically,\\n the job\\'s identifier can be used to retrieve the status of a job\\n (e.g. job:status) or the names of its input and output collections.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Julien Ribon</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/modules/fetch\",prefix:\"fetch\"},{uri:\"http://www.zorba-xquery.com/modules/http-client\",prefix:\"http-client\"},{uri:\"http://www.28msec.com/modules/asynchronous-jobs\",prefix:\"job\"},{uri:\"http://www.28msec.com/modules/project\",prefix:\"project\"},{uri:\"http://zorba.io/modules/random\",prefix:\"rand\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"request\"},{uri:\"http://www.28msec.com/modules/store\",prefix:\"store\"}],functions:[{isDocumented:!0,arity:2,name:\"build-map-shuffle\",qname:\"job:build-map-shuffle\",signature:\"($input-collection as xs:string, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Builds an object describing an asynchronous job (map or shuffle).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This object can then be sent to the scheduler.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the shuffle job. Allowed options are:\\n <ul>\\n   <li><tt>kind</tt>: the kind of job (\"map\" or \"shuffle\").</li>\\n   <li><tt>map-function</tt> (map jobs only): a function with any signature\\n   (item()* to item()*),\\n   and that is used to map the input collection to the output collection.</li>\\n   <li><tt>shuffle-function</tt> (shuffle jobs only): a function taking an item\\n   and returning an integer.\\n   It is used to select the output collection to which each item is sent.</li>\\n   <li><tt>output-collection as string</tt> (map jobs only): the name of the collection in\\n     which the output of the executed query is stored. If not specified,\\n     the result of the query will be stored in a collection withing the\\n     MongoDB database associated with the project. The name of the\\n     collection is randomly generated and starts with <tt>_28.temporary</tt>\\n   </li>\\n   <li><tt>output-collections as array</tt> (shuffle jobs only): an array with the names of the collections in\\n     which the items of the input collections are shuffled. Compulsory.\\n   </li>\\n   <li><tt>chunk-info as object</tt>: an object containing the specification of a chunk\\n     of the input collection. The shuffling will only occur on this chunk.\\n     If not specified, the entire input collection will be mapped.\\n   </li>\\n   <li><tt>allow-streaming as boolean</tt> (map jobs only): a boolean indicating if calling the map function can\\n     be distributed over partitions of the input collection. If false, the map function will\\n     be called only once on the entire input collection. This might result\\n     in a cache overflow if the number of items is too big. If true,\\n     the input will be arbitrarily partitioned and the map function will be called for each\\n     partition. The size of a partition is chosen in order to be smaller than the cache size.\\n     The default is false.\\n   </li>\\n   <li><tt>dependencies as array</tt>: an array containing the ids of all asynchronous jobs that must\\n     be completed before this job starts. This job will be hold pending until all these dependencies\\n     are completed.\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Builds an object describing an asynchronous job (map or shuffle).</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input-collection\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection that the job processes.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the asynchronous job.</div>'}],returns:{type:\"object()\",description:\"the id of the scheduled job, which can be used to pull for the status and results.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0008 if the supplied input collection is not available.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"error\",qname:\"job:error\",signature:\"($id as xs:string) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the error object output by an asynchronous job, in case of a failed job.</p>\\n',summary:\"<p>  Returns the error object output by an asynchronous job, in case of a failed job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"object()?\",description:\"the error object output by the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:1,name:\"execute\",qname:\"job:execute\",signature:\"($query as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules an asynchronous job executing the given (public or private)\\n query from your project.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The result of the query will be stored in a collection withing the\\n MongoDB database associated with the project. The name of the collection\\n is randomly generated and starts with <tt>_28.temporary</tt>.</p>\\n',summary:\"<p>  Schedules an asynchronous job executing the given (public or private)\\n query from your project.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The path of the query to execute, which must begin with /public or /private. (examples: /public/query.xq, /private/query.jq).</div>'}],returns:{type:\"xs:string\",description:\"The id of the scheduled job.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0003 if the supplied query path does not begin with /public or /private.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0004 if the supplied query path cannot be resolved.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute\",qname:\"job:execute\",signature:\"($query as xs:string, $options as object()?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules an asynchronous job executing the given (public or private)\\n query from your project.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the asynchronously executed job. Allowed options are:\\n <ul>\\n   <li><tt>output-collection as string</tt>: the name of the collection in\\n     which the output of the executed query is stored. If not specified,\\n     the result of the query will be stored in a collection withing the\\n     MongoDB database associated with the project. The name of the\\n     collection is randomly generated and starts with <tt>_28.temporary</tt>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Schedules an asynchronous job executing the given (public or private)\\n query from your project.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The path of the query to execute, which must begin with /public or /private. (examples: /public/query.xq, /private/query.jq).</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the asynchronous job.</div>'}],returns:{type:\"xs:string\",description:\"The id of the scheduled job.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0003 if the supplied query path does not begin with /public or /private.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0004 if the supplied query path cannot be resolved.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"function\",qname:\"job:function\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the map or shuffle function used by an asynchronous job.</p>\\n',summary:\"<p>  Returns the name of the map or shuffle function used by an asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"xs:string?\",description:\"the name of the map or shuffle function of the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:1,name:\"get\",qname:\"job:get\",signature:\"($id as xs:string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the asynchronous job associated with the supplied asynchronous job id,\\n or the asynchronous jobs associated with the supplied parallel job id.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is internal and should only be used by the parallelism module.</p>\\n',summary:\"<p>  Returns the asynchronous job associated with the supplied asynchronous job id,\\n or the asynchronous jobs associated with the supplied parallel job id.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous or parallel job to query.</div>'}],returns:{type:\"object()*\",description:\"the objects describing the asynchronous jobs.\"},errors:[]},{isDocumented:!0,arity:1,name:\"input-collection\",qname:\"job:input-collection\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the input collection of a mapping asynchronous job.</p>\\n',summary:\"<p>  Returns the name of the input collection of a mapping asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"xs:string?\",description:\"the name of the input collection of the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:0,name:\"jobs\",qname:\"job:jobs\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the ids of all jobs created by this project.</p>\\n',summary:\"<p>  Returns the ids of all jobs created by this project.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"the sequence of the ids of all jobs created so far.\"},errors:[]},{isDocumented:!0,arity:1,name:\"kind\",qname:\"job:kind\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the kind of the asynchronous job.</p>\\n',summary:\"<p>  Returns the kind of the asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"xs:string?\",description:\"the kind of the asynchronous job.\"},errors:[]},{isDocumented:!0,arity:2,name:\"map\",qname:\"job:map\",signature:\"($input-collection as xs:string, $map-function as function (item()*) as item()*) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules an asynchronous job mapping the input collection\\n to an output collection with the specified function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The name of the output collection is randomly generated and\\n starts with <tt>_28.temporary</tt>.</p>\\n',summary:\"<p>  Schedules an asynchronous job mapping the input collection\\n to an output collection with the specified function.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input-collection\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection that the job processes.</div>'},{name:\"map-function\",type:\"function (item()*) as item()*\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The function which is run on the input collection\\'s contents.</div>'}],returns:{type:\"xs:string\",description:\"The id of the scheduled job, which can be used to pull for the status and results.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0008 if the supplied input collection does not exist.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"map\",qname:\"job:map\",signature:\"($input-collection as xs:string, $map-function as function (item()*) as item()*, $options as object()?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules an asynchronous job mapping the input collection\\n to an output collection with the specified function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the map job. Allowed options are:\\n <ul>\\n   <li><tt>output-collection as string</tt>: the name of the collection in\\n     which the output of the executed query is stored. If not specified,\\n     the result of the query will be stored in a collection withing the\\n     MongoDB database associated with the project. The name of the\\n     collection is randomly generated and starts with <tt>_28.temporary</tt>\\n   </li>\\n   <li><tt>chunk-info as object</tt>: an object containing the specification of a chunk\\n     of the input collection. The mapping will only occur on this chunk.\\n     If not specified, the entire input collection will be mapped.\\n   </li>\\n   <li><tt>allow-streaming as boolean</tt>: a boolean indicating if calling the map function can\\n     be distributed over partitions of the input collection. If false, the map function will\\n     be called only once on the entire input collection. This might result\\n     in a cache overflow if the number of items is too big. If true,\\n     the input will be arbitrarily partitioned and the map function will be called for each\\n     partition. The size of a partition is chosen in order to be smaller than the cache size.\\n     The default is false.\\n   </li>\\n   <li><tt>dependencies as array</tt>: an array containing the ids of all asynchronous jobs that must\\n     be completed before this job starts. This job will be hold pending until all these dependencies\\n     are completed.\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Schedules an asynchronous job mapping the input collection\\n to an output collection with the specified function.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input-collection\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection that the job processes.</div>'},{name:\"map-function\",type:\"function (item()*) as item()*\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The function which is run on the collection\\'s contents.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the asynchronous job.</div>'}],returns:{type:\"xs:string\",description:\"the id of the scheduled job, which can be used to pull for the status and results.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0008 if the supplied input collection does not exist.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"output-collection\",qname:\"job:output-collection\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the output collection of a mapping or executing asynchronous job.</p>\\n',summary:\"<p>  Returns the name of the output collection of a mapping or executing asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"xs:string?\",description:\"the name of the output collection of the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:1,name:\"output-collections\",qname:\"job:output-collections\",signature:\"($id as xs:string) as xs:string*\",description:\" Returns the name of the output collections of a shuffle asynchronous job.\\n\",summary:\"<p> Returns the name of the output collections of a shuffle asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"the name of the output collections of the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:1,name:\"properties\",qname:\"job:properties\",signature:\"($id as xs:string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the properties of an asynchronous job as an object with the following\\n fields:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  <li><tt>accessed</tt>: the time at which the job was last accessed.</li>\\n  <li><tt>completed</tt>: the time at which the job was completed.</li>\\n  <li><tt>created</tt>: the time at which the job was created.</li>\\n  <li><tt>lock-acquired</tt>: the time at which a processing lock was taken on the job.</li>\\n  <li><tt>status</tt>: the status of the job. One of <tt>pending</tt>, <tt>in progress</tt>,\\n  <tt>completed</tt>, <tt>failed</tt>, <tt>timed out</tt>.</li>\\n  <li><tt>error</tt>: An object containing error information in case of failure.</li>\\n </ul>\\n',summary:\"<p>  Returns the properties of an asynchronous job as an object with the following\\n fields: \\n  \\n   accessed : the time at which the job was last accessed.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"object()\",description:\"the time at which the corresponding asynchronous job was last accessed.\"},errors:[]},{isDocumented:!0,arity:1,name:\"query-name\",qname:\"job:query-name\",signature:\"($id as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the query executed by an executing asynchronous job.</p>\\n',summary:\"<p>  Returns the name of the query executed by an executing asynchronous job.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"id\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the id of the asynchronous job to query.</div>'}],returns:{type:\"xs:string?\",description:\"the name of the query executed by the corresponding asynchronous job.\"},errors:[]},{isDocumented:!0,arity:1,name:\"schedule\",qname:\"job:schedule\",signature:\"($jobs as object()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sends jobs to the job queue.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is internal and should only be used by this and the parallelism module.</p>\\n',summary:\"<p>  Sends jobs to the job queue.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"jobs\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The job to send, as generated by job:build-map-shuffle().</div>'}],returns:{type:\"object()*\",description:\"Objects containing the new ids.\"},errors:[]},{isDocumented:!0,arity:3,name:\"shuffle\",qname:\"job:shuffle\",signature:\"($input-collection as xs:string, $shuffle-function as function (item()) as xs:integer, $options as object()?) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Schedules an asynchronous job shuffling the items of the input collections to output collections\\n using the specified shuffle function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $options parameter allows for the specification of properties for\\n the shuffle job. Allowed options are:\\n <ul>\\n   <li><tt>output-collections as array</tt>: an array with the names of the collections in\\n     which the items of the input collections are shuffled. Compulsory.\\n   </li>\\n   <li><tt>chunk-info as object</tt>: an object containing the specification of a chunk\\n     of the input collection. The shuffling will only occur on this chunk.\\n     If not specified, the entire input collection will be mapped.\\n   </li>\\n   <li><tt>dependencies as array</tt>: an array containing the ids of all asynchronous jobs that must\\n     be completed before this job starts. This job will be hold pending until all these dependencies\\n     are completed.\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Schedules an asynchronous job shuffling the items of the input collections to output collections\\n using the specified shuffle function.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"input-collection\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection that the job processes.</div>'},{name:\"shuffle-function\",type:\"function (item()) as xs:integer\",occurrence:null,description:\"\"},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying above options for the asynchronous job.</div>'}],returns:{type:\"xs:string\",description:\"the id of the scheduled job, which can be used to pull for the status and results.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the type of a supplied option is incorrect.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0005 if the supplied function does not have a name.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0006 if the supplied function is in the local namespace.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">job:JBDY0008 if the supplied input collection does not exist.</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/datetime\":{ns:\"http://www.28msec.com/modules/datetime\",description:\" This modules contains function that operate on items of type date, time,\\n dateTime, and duration.\\n <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">The module is always imported so you don't need to import it explicitly.\\n Also, you don't need to fully qualify a function to invoke it.</p>\\n\",sees:[],authors:[],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.28msec.com/modules/datetime\",prefix:\"datetime\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"adjust-date-to-timezone\",qname:\"datetime:adjust-date-to-timezone\",signature:\"($arg as date?) as date?\",description:\" Adjusts a date value to the implicit timezone.\\n\",summary:\"<p> Adjusts a date value to the implicit timezone.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"}],returns:{type:\"date?\",description:'the date in the implicit timezone that contains the starting instant of the supplied date. For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone\">adjust-date-to-timezone</a>.'},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-date-to-timezone\",qname:\"datetime:adjust-date-to-timezone\",signature:\"($arg as date?, $timezone as dayTimeDuration?) as date?\",description:\" Adjusts a date value to a specific timezone, or to no timezone at all.\\n\",summary:\"<p> Adjusts a date value to a specific timezone, or to no timezone at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"date?\",description:'the date in the target timezone that contains the starting instant of the supplied date. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>adjust-date-to-timezone(date(\"2002-03-07\"), dayTimeDuration(\"-PT10H\"))</code> returns <code>date(\"2002-03-06-10:00\")</code>.</li> <li><code>adjust-date-to-timezone(date(\"2002-03-07-07:00\"), ())</code> returns <code>date(\"2002-03-07\")</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-date-to-timezone\">adjust-date-to-timezone</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"adjust-dateTime-to-timezone\",qname:\"datetime:adjust-dateTime-to-timezone\",signature:\"($arg as dateTime?) as dateTime\",description:\" Adjusts a dateTime value to the implicit timezone.\\n\",summary:\"<p> Adjusts a dateTime value to the implicit timezone.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"dateTime\",description:'the dateTime in the implicit timezone. For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone\">adjust-dateTime-to-timezone</a>'},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-dateTime-to-timezone\",qname:\"datetime:adjust-dateTime-to-timezone\",signature:\"($arg as dateTime?, $timezone as dayTimeDuration?) as dateTime\",description:\" Adjusts a dateTime value to the specified timezone, or to no timezone at all.\\n\",summary:\"<p> Adjusts a dateTime value to the specified timezone, or to no timezone at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"dateTime\",description:\"the dateTime in the specified timezone. <ul xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\"> <li><code>adjust-dateTime-to-timezone(dateTime('2002-03-07T10:00:00-07:00'), dayTimeDuration(\\\"-PT10H\\\"))</code> returns <code>dateTime('2002-03-07T07:00:00-10:00')</code>.</li> <li><code>adjust-dateTime-to-timezone(dateTime('2002-03-07T10:00:00'), ())</code> returns <code>dateTime('2002-03-07T10:00:00')</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\" href=\\\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-dateTime-to-timezone\\\">adjust-dateTime-to-timezone</a>\"},errors:[]},{isDocumented:!0,arity:1,name:\"adjust-time-to-timezone\",qname:\"datetime:adjust-time-to-timezone\",signature:\"($arg as time?) as time?\",description:\" Adjusts a time value to an implicit timezone.\\n\",summary:\"<p> Adjusts a time value to an implicit timezone.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"time?\",description:'the time in the implicit timezone. For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone\">adjust-time-to-timezone</a>'},errors:[]},{isDocumented:!0,arity:2,name:\"adjust-time-to-timezone\",qname:\"datetime:adjust-time-to-timezone\",signature:\"($arg as time?, $timezone as dayTimeDuration?) as time?\",description:\" Adjusts a time value to a specific timezone, or to no timezone at all.\\n\",summary:\"<p> Adjusts a time value to a specific timezone, or to no timezone at all.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"},{name:\"timezone\",type:\"dayTimeDuration\",occurrence:\"?\",description:\"\"}],returns:{type:\"time?\",description:'the time in the specified timezone. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>adjust-time-to-timezone(time(\"10:00:00\"), dayTimeDuration(\"-PT10H\"))</code> returns <code>time(\"07:00:00-10:00\")</code>.</li> <li><code>adjust-time-to-timezone(time(\"10:00:00-07:00\"), ())</code> returns <code>time(\"10:00:00\")</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-adjust-time-to-timezone\">adjust-time-to-timezone</a>'},errors:[]},{isDocumented:!0,arity:0,name:\"current-date\",qname:\"datetime:current-date\",signature:\"() as date external\",description:' Returns the current date.\\n For a detailed description of the semantics of this function, please see\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-current-date\">current-date</a>\\n',summary:\"<p> Returns the current date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"date\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-dateTime\",qname:\"datetime:current-dateTime\",signature:\"() as dateTimeStamp external\",description:' Returns the current dateTime.\\n For a detailed description of the semantics of this function, please see\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-current-dateTime\">current-dateTime</a>\\n',summary:\"<p> Returns the current dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"dateTimeStamp\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-time\",qname:\"datetime:current-time\",signature:\"() as time external\",description:' Returns the current time.\\n For a detailed description of the semantics of this function, please see\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-current-time\">current-time</a>\\n',summary:\"<p> Returns the current time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"time\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"dateTime\",qname:\"datetime:dateTime\",signature:\"($arg1 as date?, $arg2 as time?) as dateTime?\",description:\" Returns a dateTime value created by combining a date and a time.\\n\",summary:\"<p> Returns a dateTime value created by combining a date and a time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"date\",occurrence:\"?\",description:\"\"},{name:\"arg2\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"dateTime?\",description:'the dateTime value created by combinding the given date and time. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>dateTime(date(\"1999-12-31\"), time(\"12:00:00\"))</code> returns <code>dateTime(\"1999-12-31T12:00:00\")</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-dateTime\">dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"day-from-date\",qname:\"datetime:day-from-date\",signature:\"($arg as date?) as integer?\",description:\" Returns the day component of a date.\\n\",summary:\"<p> Returns the day component of a date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the day component of the given date. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>day-from-date(date(\"1999-05-31-05:00\"))</code> returns <code>31</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-day-from-date\">day-from-date</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"day-from-dateTime\",qname:\"datetime:day-from-dateTime\",signature:\"($arg as dateTime?) as integer?\",description:\" Returns the day component of a dateTime.\\n\",summary:\"<p> Returns the day component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the day component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>day-from-dateTime(dateTime(\"1999-12-31T20:00:00-05:00\"))</code> returns <code>31</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-day-from-dateTime\">day-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"days-from-duration\",qname:\"datetime:days-from-duration\",signature:\"($arg as duration?) as integer?\",description:\" Returns the number of days in a duration.\\n\",summary:\"<p> Returns the number of days in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the number of days in the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>days-from-duration(dayTimeDuration(\"P3DT55H\"))</code> returns <code>5</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-days-from-duration\">days-from-duration</a>'},errors:[]},{isDocumented:!0,arity:2,name:\"format-date\",qname:\"datetime:format-date\",signature:\"($value as date?, $picture as string) as string?\",description:\" Returns a string containing a date value formatted for display.\\n\",summary:\"<p> Returns a string containing a date value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"date\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:\"string?\",description:'the string formatted according to the given picture. The following examples assume <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">let $d := date(\"2002-12-31\")</code> and the Gregorian calendar as the default calendar. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>format-date($d, \"[Y0001]-[M01]-[D01]\")</code> returns <code>2002-12-31</code>.</li> <li><code>format-date($d, \"[D1] [MI] [Y]\")</code> returns <code>31 XII 2002</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-format-date\">format-date</a>'},errors:[]},{isDocumented:!0,arity:5,name:\"format-date\",qname:\"datetime:format-date\",signature:\"($value as date?, $picture as string, $language as string?, $calendar as string?, $place as string?) as string?\",description:\" Returns a string containing a date value formatted for display.\\n\",summary:\"<p> Returns a string containing a date value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"date\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"string\",occurrence:null,description:\"\"},{name:\"language\",type:\"string\",occurrence:\"?\",description:\"\"},{name:\"calendar\",type:\"string\",occurrence:\"?\",description:\"\"},{name:\"place\",type:\"string\",occurrence:\"?\",description:\"\"}],returns:{type:\"string?\",description:'the string formatted according to the given picture. The following examples assume <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">let $d := date(\"2002-12-31\")</code> and the Gregorian calendar as the default calendar. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>format-date($d, \"[YWw]\", \"en\", (), ())</code> returns <code>Two Thousand and Three</code>.</li> <li><code>format-date($d, \"[D] [MNn], [Y]\", \"de\", (), ())</code> returns <code>31 Dezember, 2002</code>.</li> <li><code>format-date($d, \"[D\\\\u0E51] [Mn] [Y\\\\u0E51]\", \"th\", \"BE\", ())</code> returns <code>๓๑ ธันวาคม ๒๐๐๒</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-format-date\">format-date</a>'},errors:[]},{isDocumented:!0,arity:2,name:\"format-dateTime\",qname:\"datetime:format-dateTime\",signature:\"($value as dateTime?, $picture as string) as string?\",description:\" Returns a string containing a dateTime value formatted for display.\\n\",summary:\"<p> Returns a string containing a dateTime value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"dateTime\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"string\",occurrence:null,description:\"\"}],returns:{type:\"string?\",description:'the string formatted according to the given picture. The following examples assume <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">let $dt := dateTime(\"2002-12-31T15:58:45\")</code> and the Gregorian calendar as the default calendar. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>format-dateTime($dt, \"[h].[m01][Pn] on [FNn], [D1o] [MNn]\")</code> returns <code>3.58pm on Tuesday, 31st December</code>.</li> <li><code>format-dateTime($dt, \"[M01]/[D01]/[Y0001] at [H01]:[m01]:[s01]\")</code> returns <code>12/31/2002 at 15:58:45</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime\">format-dateTime</a>'},errors:[]},{isDocumented:!0,arity:5,name:\"format-dateTime\",qname:\"datetime:format-dateTime\",signature:\"($value as dateTime?, $picture as string, $language as string?, $calendar as string?, $place as string?) as string?\",description:\" Returns a string containing a dateTime value formatted for display.\\n\",summary:\"<p> Returns a string containing a dateTime value formatted for display.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"dateTime\",occurrence:\"?\",description:\"\"},{name:\"picture\",type:\"string\",occurrence:null,description:\"\"},{name:\"language\",type:\"string\",occurrence:\"?\",description:\"\"},{name:\"calendar\",type:\"string\",occurrence:\"?\",description:\"\"},{name:\"place\",type:\"string\",occurrence:\"?\",description:\"\"}],returns:{type:\"string?\",description:'the string formatted according to the given picture. For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-format-dateTime\">format-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"hours-from-dateTime\",qname:\"datetime:hours-from-dateTime\",signature:\"($arg as dateTime?) as integer?\",description:\" Returns the hours component of a dateTime.\\n\",summary:\"<p> Returns the hours component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the hours component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>hours-from-dateTime(dateTime(\"1999-12-31T21:20:00-05:00\"))</code> returns <code>21</code>.</li> <li><code>hours-from-dateTime(adjust-dateTime-to-timezone(dateTime(\"1999-12-31T21:20:00-05:00\"), dayTimeDuration(\"PT0S\")))</code> returns <code>2</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-hours-from-time\">hours-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"hours-from-duration\",qname:\"datetime:hours-from-duration\",signature:\"($arg as duration?) as integer?\",description:\" Returns the number of hours in a duration.\\n\",summary:\"<p> Returns the number of hours in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the number of hours in the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>hours-from-duration(dayTimeDuration(\"P3DT10H\"))</code> returns <code>10</code>.</li> <li><code>hours-from-duration(dayTimeDuration(\"-P3DT10H\"))</code> returns <code>-10</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-hours-from-duration\">hours-from-duration</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"hours-from-time\",qname:\"datetime:hours-from-time\",signature:\"($arg as time?) as integer?\",description:\" Returns the hours component of a time.\\n\",summary:\"<p> Returns the hours component of a time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the hours component of the given time. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>hours-from-time(time(\"11:23:00\"))</code> returns <code>11</code>.</li> <li><code>hours-from-time(time(\"24:00:00\"))</code> returns <code>0</code>.</li> <li><code>hours-from-time(adjust-time-to-timezone(time(\"01:23:00+05:00\"), dayTimeDuration(\"PT0S\")))</code> returns <code>20</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-hours-from-time\">hours-from-time</a>'},errors:[]},{isDocumented:!0,arity:0,name:\"implicit-timezone\",qname:\"datetime:implicit-timezone\",signature:\"() as dayTimeDuration\",description:\" Returns the value of the implicit timezone property set in the platform.\\n\",summary:\"<p> Returns the value of the implicit timezone property set in the platform.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"dayTimeDuration\",description:'the implicit timezone property. For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-implicit-timezone\">implicit-timezone</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-dateTime\",qname:\"datetime:minutes-from-dateTime\",signature:\"($arg as dateTime?) as integer?\",description:\" Returns the minute component of a dateTime.\\n\",summary:\"<p> Returns the minute component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the minute component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>minutes-from-dateTime(dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>20</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-dateTime\">minutes-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-duration\",qname:\"datetime:minutes-from-duration\",signature:\"($arg as duration?) as integer?\",description:\" Returns the number of minutes in a duration.\\n\",summary:\"<p> Returns the number of minutes in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the number of minutes of the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>minutes-from-duration(dayTimeDuration(\"P3DT10H\"))</code> returns <code>0</code>.</li> <li><code>minutes-from-duration(dayTimeDuration(\"-P5DT12H30M\"))</code> returns <code>-30</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-duration\">minutes-from-duration</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"minutes-from-time\",qname:\"datetime:minutes-from-time\",signature:\"($arg as time?) as integer?\",description:\" Returns the minutes component of a time.\\n\",summary:\"<p> Returns the minutes component of a time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the minutes component of the given time. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>minutes-from-time(time(\"13:00:00Z\"))</code> returns <code>0</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-minutes-from-time\">minutes-from-time</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"month-from-date\",qname:\"datetime:month-from-date\",signature:\"($arg as date?) as integer?\",description:\" Returns the month component of a date.\\n\",summary:\"<p> Returns the month component of a date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the month component of the given date. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>month-from-date(date(\"1999-05-31-05:00\"))</code> returns <code>5</code>.</li> <li><code>month-from-date(date(\"2000-01-01+05:00\"))</code> returns <code>1</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-month-from-date\">month-from-date</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"month-from-dateTime\",qname:\"datetime:month-from-dateTime\",signature:\"($arg as dateTime?) as integer?\",description:\" Returns the month component of a dateTime.\\n\",summary:\"<p> Returns the month component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the month component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>month-from-dateTime(dateTime(\"1999-05-31T21:20:00-05:00\"))</code> returns <code>5</code>.</li> <li><code>month-from-dateTime(dateTime(\"2000-01-01T11:05:00+05:00\"))</code> returns <code>1</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-month-from-dateTime\">month-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"months-from-duration\",qname:\"datetime:months-from-duration\",signature:\"($arg as duration?) as integer?\",description:\" Returns the number of months in a duration.\\n\",summary:\"<p> Returns the number of months in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the number of months in the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>months-from-duration(yearMonthDuration(\"P20Y15M\"))</code> returns <code>3</code>.</li> <li><code>months-from-duration(yearMonthDuration(\"-P20Y18M\"))</code> returns <code>6</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-months-from-duration\">months-from-duration</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-dateTime\",qname:\"datetime:seconds-from-dateTime\",signature:\"($arg as dateTime?) as decimal?\",description:\" Returns the seconds component of a dateTime.\\n\",summary:\"<p> Returns the seconds component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"decimal?\",description:'the seconds component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>seconds-from-dateTime(dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>0</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-dateTime\">seconds-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-duration\",qname:\"datetime:seconds-from-duration\",signature:\"($arg as duration?) as decimal?\",description:\" Returns the number of seconds in a duration.\\n\",summary:\"<p> Returns the number of seconds in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"decimal?\",description:'the number of seconds in the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>seconds-from-duration(dayTimeDuration(\"P3DT10H12.5S\"))</code> returns <code>12.5</code>.</li> <li><code>seconds-from-duration(dayTimeDuration(\"-PT256S\"))</code> returns <code>-16.0</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-duration\">seconds-from-duration</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"seconds-from-time\",qname:\"datetime:seconds-from-time\",signature:\"($arg as time?) as decimal?\",description:\" Returns the seconds component of a time.\\n\",summary:\"<p> Returns the seconds component of a time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"decimal?\",description:'the seconds component of the given time. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>seconds-from-time(time(\"13:20:10.5\"))</code> returns <code>10.5</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-seconds-from-time\">seconds-from-time</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-date\",qname:\"datetime:timezone-from-date\",signature:\"($arg as date?) as dayTimeDuration?\",description:\" Returns the timezone component of a date.\\n\",summary:\"<p> Returns the timezone component of a date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"}],returns:{type:\"dayTimeDuration?\",description:'the timezone component of the given date. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>timezone-from-date(date(\"1999-05-31-05:00\"))</code> returns <code>dayTimeDuration(\"-PT5H\")</code>.</li> <li><code>timezone-from-date(date(\"2000-06-12Z\"))</code> returns <code>dayTimeDuration(\"PT0S\")</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-date\">timezone-from-date</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-dateTime\",qname:\"datetime:timezone-from-dateTime\",signature:\"($arg as dateTime?) as dayTimeDuration?\",description:\" Returns the timezone component of a dateTime.\\n\",summary:\"<p> Returns the timezone component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"dayTimeDuration?\",description:'the timezone component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>timezone-from-dateTime(dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>dayTimeDuration(\"-PT5H\")</code>.</li> <li><code>timezone-from-dateTime(dateTime(\"2000-06-12T13:20:00Z\"))</code> returns <code>dayTimeDuration(\"PT0S\")</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-dateTime\">timezone-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-time\",qname:\"datetime:timezone-from-time\",signature:\"($arg as time?) as dayTimeDuration?\",description:\" Returns the timezone component of a time.\\n\",summary:\"<p> Returns the timezone component of a time.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"time\",occurrence:\"?\",description:\"\"}],returns:{type:\"dayTimeDuration?\",description:'the timezone component of the given time. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>timezone-from-time(time(\"13:20:00-05:00\"))</code> returns <code>dayTimeDuration(\"-PT5H\")</code>.</li> <li><code>timezone-from-time(time(\"13:20:00\"))</code> returns <code>()</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-timezone-from-time\">timezone-from-time</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"year-from-date\",qname:\"datetime:year-from-date\",signature:\"($arg as date?) as integer?\",description:\" Returns the year component of a date.\\n\",summary:\"<p> Returns the year component of a date.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"date\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the year component of the given date. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>year-from-date(date(\"2000-01-01+05:00\"))</code> returns <code>2000</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-year-from-date\">year-from-date</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"year-from-dateTime\",qname:\"datetime:year-from-dateTime\",signature:\"($arg as dateTime?) as integer?\",description:\" Returns the year component of a dateTime.\\n\",summary:\"<p> Returns the year component of a dateTime.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"dateTime\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the year component of the given dateTime. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>year-from-dateTime(dateTime(\"1999-05-31T13:20:00-05:00\"))</code> returns <code>1999</code>.</li> <li><code>year-from-dateTime(dateTime(\"1999-12-31T24:00:00\"))</code> returns <code>2000</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-year-from-dateTime\">year-from-dateTime</a>'},errors:[]},{isDocumented:!0,arity:1,name:\"years-from-duration\",qname:\"datetime:years-from-duration\",signature:\"($arg as duration?) as integer?\",description:\" Returns the number of years in a duration.\\n\",summary:\"<p> Returns the number of years in a duration.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"duration\",occurrence:\"?\",description:\"\"}],returns:{type:\"integer?\",description:'the number of years in the given duration. <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <li><code>years-from-duration(yearMonthDuration(\"P20Y15M\"))</code> returns <code>21</code>.</li> <li><code>years-from-duration(yearMonthDuration(\"-P15M\"))</code> returns <code>-1</code>.</li> </ul> For a detailed description of the semantics of this function, please see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-functions-30/#func-years-from-duration\">years-from-duration</a>'},errors:[]}],variables:[]},\"http://api.28.io/jdbc\":{ns:\"http://api.28.io/jdbc\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/jdbc\",prefix:\"api\"},{uri:\"http://www.28msec.com/modules/jdbc\",prefix:\"jdbc\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"res\"},{uri:\"http://www.28msec.com/modules/store\",prefix:\"store\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!1,arity:0,name:\"dispatch\",qname:\"api:dispatch\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"import\",qname:\"api:import\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"tables\",qname:\"api:tables\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/excel/information\":{ns:\"http://zorba.io/modules/excel/information\",description:\" This is a library module offering the same set of functions\\n defined by Microsoft Excel, under Information Functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528261033.aspx\" target=\"_blank\">Excel Documentation: Information Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/information\",prefix:\"excel-information\"},{uri:\"http://zorba.io/modules/excel/math\",prefix:\"excel-math\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"is-blank\",qname:\"excel-information:is-blank\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Test if the passed argument is empty of not.\\n\",summary:\"<p> Test if the passed argument is empty of not.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"If the value of $arg is the empty sequence, the function returns true, otherwise the function returns false.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-even\",qname:\"excel-information:is-even\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Test is a number is even.\\n\",summary:\"<p> Test is a number is even.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if number is even, FALSE if number is odd.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value is not a number.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-odd\",qname:\"excel-information:is-odd\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Test is a number is odd.\\n\",summary:\"<p> Test is a number is odd.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if number is odd, FALSE if number is even.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value if provided value is not a number.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"islogical\",qname:\"excel-information:islogical\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Tests if the passed $value is a logical value.\\n\",summary:\"<p> Tests if the passed $value is a logical value.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if $value refers to a logical value.\"},errors:[]},{isDocumented:!0,arity:1,name:\"isnumber\",qname:\"excel-information:isnumber\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Tests if the passed $value is a number.\\n\",summary:\"<p> Tests if the passed $value is a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if $value refers to a number.\"},errors:[]},{isDocumented:!0,arity:1,name:\"istext\",qname:\"excel-information:istext\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Tests if the passed $value is a string.\\n\",summary:\"<p> Tests if the passed $value is a string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if $value refers to text.\"},errors:[]},{isDocumented:!0,arity:1,name:\"n\",qname:\"excel-information:n\",signature:\"($value as xs:anyAtomicType?) as xs:anyAtomicType\",description:\" Converts a $value to a number.\\n\",summary:\"<p> Converts a $value to a number.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value.</div>'}],returns:{type:\"xs:anyAtomicType\",description:\"A $value converted to a number.\"},errors:[]},{isDocumented:!0,arity:0,name:\"na\",qname:\"excel-information:na\",signature:\"() as xs:anyAtomicType\",description:\" Raises the error value #N/A.\\n\",summary:\"<p> Raises the error value #N/A.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyAtomicType\",description:'The error value #N/A. #N/A is the error value that means \"no value is available.\"'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:NA the purpose of this function is to raise this error</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/image/animation\":{ns:\"http://www.zorba-xquery.com/modules/image/animation\",description:\" This module provides functions to create animated GIF images.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Daniel Thomas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/image/animation\",prefix:\"anim\"},{uri:\"http://www.zorba-xquery.com/modules/image/error\",prefix:\"ierr\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"create-animated-gif\",qname:\"anim:create-animated-gif\",signature:\"($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt) as xs:base64Binary external\",description:\" Creates an animated GIF image.\\n The resulting animated GIF shows the passed images consecutively.\\n It has the same width and height as the first passed image.\\n\",summary:\"<p> Creates an animated GIF image.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"images\",type:\"xs:base64Binary\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image sequence</div>'},{name:\"delay\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the hundredths of seconds an image is shown</div>'},{name:\"iterations\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the amount of times all images are shown. 0 for infinite.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the animated GIF\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 one of the passed images is invalid.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"create-morphed-gif\",qname:\"anim:create-morphed-gif\",signature:\"($images as xs:base64Binary+, $delay as xs:unsignedInt, $iterations as xs:unsignedInt, $nr-of-morph-images as xs:unsignedInt) as xs:base64Binary external\",description:\" Creates an animated GIF image with morph effect.\\n The resulting animated GIF shows the passed images consecutively with morph effect between the changes.\\n It has the same width and height as the first passed image.\\n\",summary:\"<p> Creates an animated GIF image with morph effect.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"images\",type:\"xs:base64Binary\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the image sequence</div>'},{name:\"delay\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the hundredths of seconds an image is shown</div>'},{name:\"iterations\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the amount of times all images are shown. 0 for infinite.</div>'},{name:\"nr-of-morph-images\",type:\"xs:unsignedInt\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of additionally added images to create the morph effect between two passed images.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the animated GIF\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ierr:IM001 one of the passed images is invalid.</xqdoc:error>']}],variables:[]},\"http://28.io/modules/error\":{ns:\"http://28.io/modules/error\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Applications written with Sausalito use this default error module\\n if an error happens inside a Sausalito project.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An error can occur during the run time of a Sausalito project on one\\n of the following cases:</p>\\n <ol xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>If the XQuery code raises a dynamic error that is not caught in a\\n     try-catch block.</li>\\n   <li>If the given XQuery program is syntactically incorrect or contains\\n     other static errors.</li>\\n   <li>If an explicit call to fn:error() was made and the error is not\\n     caught in a try-catch block.</li>\\n   <li>If a request is made to a module or a function which does\\n     not exist.</li>\\n   <li>If any other unexpected error happens during the processing of\\n     the request.</li>\\n </ol>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://28.io/modules/error\",prefix:\"err\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"request\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:4,name:\"handle\",qname:\"err:handle\",signature:\"($code as xs:QName, $description as xs:string?, $value as item()*, $stack) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This is the default function that is called if an error happens.\\n The default can be overridden by adding an error.xq library module\\n into the Sausalito project. This module needs to declare a function\\n with the same signature as the err:handle function in this module.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value returned by this function is sent to the client. If the\\n default is overridden, the implementation is free to define all\\n parameters of the response (e.g. set the corresponding HTTP status\\n code or an arbitrary header).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the default is used, the status code is 500 if the $code QName\\n is not equal to one of the status code QNames declared in HTTP module.\\n Otherwise, the corresponding status code is set.</p>\\n',summary:\"<p>  This is the default function that is called if an error happens.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"code\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the error code that triggered the problem as a QName</div>'},{name:\"description\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a description of the error</div>'},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a potentially empty list of items that were involved in causing the error</div>'},{name:\"stack\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the stacktrace leading to the error as an element. For example, <tt> &lt;stack&gt; &lt;call ns=\"http://www.example.com/\" localName=\"my-function\" arity=\"3\"/&gt; &lt;/stack&gt; </tt></div>'}],returns:{type:\"item()*\",description:\"content of the response message\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/internal-debug\":{ns:\"http://www.zorba-xquery.com/modules/internal-debug\",description:\" This internal module provides functions for testing error handling and\\n internal function caching.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/internal-debug\",prefix:\"debug\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"cpp-error\",qname:\"debug:cpp-error\",signature:\"() as empty-sequence() external\",description:\" Raises a c++ exception.\\n\",summary:\"<p> Raises a c++ exception.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"empty sequence\"},errors:[]},{isDocumented:!0,arity:0,name:\"cpp-exit\",qname:\"debug:cpp-exit\",signature:\"() as empty-sequence() external\",description:\" C++ exit is invoked.\\n\",summary:\"<p> C++ exit is invoked.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"empty sequence\"},errors:[]},{isDocumented:!0,arity:0,name:\"user-error-no-location\",qname:\"debug:user-error-no-location\",signature:\"() as empty-sequence() external\",description:\" Raises a user error without query location.\\n\",summary:\"<p> Raises a user error without query location.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"empty sequence\"},errors:[]},{isDocumented:!0,arity:0,name:\"user-error\",qname:\"debug:user-error\",signature:\"() as empty-sequence() external\",description:\" Raises a user error.\\n\",summary:\"<p> Raises a user error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"empty sequence\"},errors:[]},{isDocumented:!0,arity:0,name:\"zorba-error\",qname:\"debug:zorba-error\",signature:\"() as empty-sequence() external\",description:\" Raises a zorba error.\\n\",summary:\"<p> Raises a zorba error.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"empty sequence\"},errors:[]}],variables:[]},\"http://zorba.io/modules/reflection\":{ns:\"http://zorba.io/modules/reflection\",description:\" This module provides functions to dynamically invoke functions or main modules,\\n respectively. Each of the functions (invoke or eval) come in four variants depending\\n whether the expression being invoked is simple, nondeterministic, updating,\\n or sequential.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/reflection\",prefix:\"reflection\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"eval-n\",qname:\"reflection:eval-n\",signature:\"($query as xs:string) as item()* external\",description:\" See documentation of reflection:eval() except the main module that is to\\n be executed may be nondeterministc.\\n\",summary:\"<p> See documentation of reflection:eval() except the main module that is to\\n be executed may be nondeterministc.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query string to be evaluated</div>'}],returns:{type:\"item()*\",description:\"the result of evaluating the query\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the evaluated XQuery may return</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQST0031 If the XQuery version of the inner program is greater than the version of the outer program.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"eval-s\",qname:\"reflection:eval-s\",signature:\"($query as xs:string) as item()* external\",description:\" See documentation of reflection:eval() except the main module that is to\\n be executed may be sequential, i.e. may have side-effects.\\n\",summary:\"<p> See documentation of reflection:eval() except the main module that is to\\n be executed may be sequential, i.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query string to be evaluated</div>'}],returns:{type:\"item()*\",description:\"the result of evaluating the query (the result is not supposed to contain any PUL).\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the evaluated XQuery may return</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQST0031 If the XQuery version of the inner program is greater than the version of the outer program.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"eval-u\",qname:\"reflection:eval-u\",signature:\"($query as xs:string) external\",description:\" See documentation of reflection:eval() except the main module that is to\\n be executed may be updating, i.e. return a pending update list.\\n\",summary:\"<p> See documentation of reflection:eval() except the main module that is to\\n be executed may be updating, i.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!0,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query string to be evaluated</div>'}],returns:{type:null,description:\"the PUL resulting from evaluating the query\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the evaluated XQuery may return</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQST0031 If the XQuery version of the inner program is greater than the version of the outer program.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"eval\",qname:\"reflection:eval\",signature:\"($query as xs:string) as item()* external\",description:' The purpose of this function is to (dynamically) execute an XQuery program\\n from inside another XQuery program.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The XQuery program that invokes the\\n eval function will be referred to as the \"outer\" program and the XQuery\\n program that is executed by the eval invocation will be referred to as\\n the \"inner\" program. The function is given as a string argument.\\n Typically, the outer program constructs this string dynamically,\\n e.g., based on data extracted from documents and/or the values of\\n external variables. The eval function treats this string as\\n an XQuery main module. That is, it parses the string, compiles the\\n resulting parse tree, executes the resulting execution plan, and finally\\n returns the result or error (if any) to the outer program.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The given XQuery program needs to be a valid according to XQuery\\'s\\n MainModule production (see <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xquery/#doc-xquery-MainModule\">\\n http://www.w3.org/TR/xquery/#doc-xquery-MainModule</a>. Please note\\n that the inner pogram must at least have the XQuery version of the\\n outer program [err:XQST0031].<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The inner program \"inherits\" the static and dynamic context of the outer\\n program. Specifically, evaluation of the inner program is done in static and\\n dynamic contextes that are initialized as copies of the static and dynamic\\n contextes of the outer program at the place where the eval invocation appears\\n at. This means that, for example, all variables that are in-scope at the place\\n where the eval function is invoked from, are also in-scope inside the inner\\n program and can be referenced there without having to be re-declared. On the other\\n hand, declarations that appear in the prolog of the inner main module or are\\n imported by the inner main module from library modules, hide their corresponding\\n inherited declarations. For example, if the inner main module declares\\n a variable or function with the same name as an inherited variable or function,\\n the inner variable/function hides the inherited one.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n If the inner program declares an external variable with the same name as an\\n inherited variable, the value of the inherited variable is used to initialize\\n the inner external variable. If, however, an inner external variable has no\\n default initializer and no corresponding inherited variable, it will remain\\n uninitialized, causing the inner program to raise an error when executed.\\n',summary:\"<p> The purpose of this function is to (dynamically) execute an XQuery program\\n from inside another XQuery program.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query string to be evaluated</div>'}],returns:{type:\"item()*\",description:\"the result of evaluating the query\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the evaluated XQuery may return.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQST0031 If the XQuery version of the inner program is greater than the version of the outer program.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"invoke-n\",qname:\"reflection:invoke-n\",signature:\"($name as xs:QName) as item()* external\",description:\" See documentation for reflection:invoke except the function that\\n is to be invoked may be nondeterministic.\\n\",summary:\"<p> See documentation for reflection:invoke except the function that\\n is to be invoked may be nondeterministic.</p>\",annotation_str:\" %an:nondeterministic %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"},{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the QName of the function that is to be invoked</div>'}],returns:{type:\"item()*\",description:\"the result that is returned by the invoked function\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the invoked function may return</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"invoke-s\",qname:\"reflection:invoke-s\",signature:\"($name as xs:QName) as item()* external\",description:\" See documentation for reflection:invoke except the function that\\n is to be invoked may be sequential, i.e. may have side-effects.\\n\",summary:\"<p> See documentation for reflection:invoke except the function that\\n is to be invoked may be sequential, i.</p>\",annotation_str:\" %an:variadic %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"},{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the QName of the function that is to be invoked</div>'}],returns:{type:\"item()*\",description:\"the result that is returned by the invoked function\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the invoked function may return</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"invoke-u\",qname:\"reflection:invoke-u\",signature:\"($name as xs:QName) external\",description:\" See documentation for reflection:invoke-n except the function that\\n is to be invoked may be updating, i.e. return a pending update list.\\n\",summary:\"<p> See documentation for reflection:invoke-n except the function that\\n is to be invoked may be updating, i.</p>\",annotation_str:\" %an:nondeterministic %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"},{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the QName of the function that is to be invoked</div>'}],returns:{type:null,description:\"the result that is returned by the invoked function\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the invoked function may return</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"invoke\",qname:\"reflection:invoke\",signature:\"($name as xs:QName) as item()* external\",description:' The invoke function allows to dynamically call a function given its QName\\n and parameters.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n It is possible to invoke a function whose name is not known\\n at compilation time -- it can be computed, passed through an external\\n variable, taken from a file, etc. The first parameter must always be a\\n QName identifying a known function.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The function is declared with the %an:variadic annotation. Hence, it allows\\n for an arbitrary number of parameters. All of these parameters (except the\\n first one) will be passed to the function that is called.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Example usage : <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> reflection:invoke ( xs:QName(\"fn:max\"), (1,2,3) ) </pre>\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Returns <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> 3 </pre>.\\n',summary:\"<p> The invoke function allows to dynamically call a function given its QName\\n and parameters.</p>\",annotation_str:\" %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the QName of the function that is to be invoked</div>'}],returns:{type:\"item()*\",description:\"the result that is returned by the invoked function\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">whatever error the invoked function may return</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/hmac\":{ns:\"http://zorba.io/modules/hmac\",description:\" This module provides functions that perform HMAC\\n (hash-based message authentication code) operations.\\n For example, they calculate message codes involving hash functions such\\n as MD5 and various SHA variants. The result is the base64 encoded value\\n of the hash. A hash may be used to verify the data integrity and\\n the authenticity of a message.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon, Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/hmac\",prefix:\"hmac\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:3,name:\"compute-binary\",qname:\"hmac:compute-binary\",signature:\"($message as xs:base64Binary, $secret-key as xs:string, $hash-algo as xs:string) as xs:base64Binary external\",description:\" Calculate the HMAC for the given message and secret-key involving\\n an custom hash function. Before calculating the code, the given\\n base64-encoded message is base64-decoded.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n an custom hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'},{name:\"hash-algo\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hash:UNSUPPORTED-ALGORITHM if the given hash algorithm is not supported</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"compute\",qname:\"hmac:compute\",signature:\"($message as xs:string, $secret-key as xs:string, $alg as xs:string) as xs:base64Binary external\",description:\" Calculate the HMAC for the given message and secret-key involving\\n an custom hash function.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n an custom hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'},{name:\"alg\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The algorithm to use for the hashing operation. Supported algorithms are \"md5\", \"sha1\", and \"sha256\".</div>'}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hash:UNSUPPORTED-ALGORITHM if the given hash algorithm is not supported</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"md5-binary\",qname:\"hmac:md5-binary\",signature:\"($message as xs:base64Binary, $secret-key as xs:string) as xs:base64Binary\",description:\" Calculate the HMAC for the given message and secret-key involving\\n the MD5 hash function. Before calculating the code, the given\\n base64-encoded message is base64-decoded.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n the MD5 hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:[]},{isDocumented:!0,arity:2,name:\"md5\",qname:\"hmac:md5\",signature:\"($message as xs:string, $secret-key as xs:string) as xs:base64Binary\",description:\" Calculate the HMAC for the given message and secret-key involving\\n the MD5 hash function.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n the MD5 hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:[]},{isDocumented:!0,arity:2,name:\"sha1-binary\",qname:\"hmac:sha1-binary\",signature:\"($message as xs:base64Binary, $secret-key as xs:string) as xs:base64Binary\",description:\" Calculate the HMAC for the given message and secret-key involving\\n the SHA1 hash function. Before calculating the code, the given\\n base64-encoded message is base64-decoded.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n the SHA1 hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:[]},{isDocumented:!0,arity:2,name:\"sha1\",qname:\"hmac:sha1\",signature:\"($message as xs:string, $secret-key as xs:string) as xs:base64Binary\",description:\" Calculate the HMAC for the given message and secret-key involving\\n the SHA1 hash function.\\n\",summary:\"<p> Calculate the HMAC for the given message and secret-key involving\\n the SHA1 hash function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'}],returns:{type:\"xs:base64Binary\",description:\"the base64 encoded message authentication code\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/sleep\":{ns:\"http://www.28msec.com/modules/sleep\",description:\" This module provides a function to put the currently executing request\\n to sleep.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/sleep\",prefix:\"sleep\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"millis\",qname:\"sleep:millis\",signature:\"($millis as xs:integer) as empty-sequence() external\",description:' Puts the currently executing request to sleep.\\n This function is mainly useful in development e.g. to simulate the\\n effects of long-running tasks wrt. the concurrent execution of\\n requests.\\n Here the function is used to simulate a request that runs for 1 second\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n declare $acquired := lock:try-acquire(\"my-lock\");\\n if ($acquired)\\n   sleep:millis(1000);\\n else\\n   fn:error(xs:QName(\"...\"), \"failed to acquire lock\");\\n </pre>\\n',summary:\"<p> Puts the currently executing request to sleep.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"millis\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of milliseconds to sleep</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/cloudant\":{ns:\"http://www.28msec.com/modules/cloudant\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for creating, reading, updating,\\n deleting and searching data in <a href=\"https://cloudant.com/\">Cloudant</a>\\n databases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Before issuing a request to Cloudant it is mandatory to create\\n a new connection through one of the <code>connect</code> functions.\\n These functions return a connection identifier which needs to be used\\n to access data in Cloudant through the other functions.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In these functions Cloudant databases will be identified through\\n their names. By default, the functions will assume that the database is owned by\\n the user for which the given connection has been created.\\n To specify a different database owner, most functions accept an\\n <code>$options</code> parameter that allows a <code>database-owner</code>\\n option to specify a different database owner for a single request.\\n Moreover, when connecting, it is possible to specify the default\\n database owner using the <code>connect#3</code> function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Additional information on the Cloudant APIs can be found\\n <a href=\"https://cloudant.com/for-developers/\">on the Cloudant website</a>.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The non side-effecting functions:\\n <ul>\\n   <li><a href=\"?anchor=list-databases-1\">list-databases#1</a></li>\\n   <li><a href=\"?anchor=list-databases-2\">list-databases#2</a></li>\\n   <li><a href=\"?anchor=database-info-2\">database-info#2</a></li>\\n   <li><a href=\"?anchor=database-info-3\">database-info#3</a></li>\\n   <li><a href=\"?anchor=all-documents-2\">all-documents#2</a></li>\\n   <li><a href=\"?anchor=all-documents-3\">all-documents#3</a></li>\\n   <li><a href=\"?anchor=multiple-documents-3\">multiple-documents#3</a></li>\\n   <li><a href=\"?anchor=multiple-documents-4\">multiple-documents#4</a></li>\\n   <li><a href=\"?anchor=document-3\">document#3</a></li>\\n   <li><a href=\"?anchor=document-4\">document#4</a></li>\\n   <li><a href=\"?anchor=document-info-3\">document-info#3</a></li>\\n   <li><a href=\"?anchor=document-info-4\">document-info#4</a></li>\\n   <li><a href=\"?anchor=attachment-4\">attachment#4</a></li>\\n   <li><a href=\"?anchor=attachment-5\">attachment#5</a></li>\\n   <li><a href=\"?anchor=all-view-documents-4\">all-view-documents#4</a></li>\\n   <li><a href=\"?anchor=all-view-documents-5\">all-view-documents#5</a></li>\\n   <li><a href=\"?anchor=multiple-view-documents-5\">multiple-view-documents#5</a></li>\\n   <li><a href=\"?anchor=multiple-view-documents-6\">multiple-view-documents#6</a></li>\\n   <li><a href=\"?anchor=lucene-query-5\">lucene-query#5</a></li>\\n   <li><a href=\"?anchor=lucene-query-6\">lucene-query#6</a></li>\\n </ul>\\n are declared deterministic, which means that their results could be cached\\n when invoked multiple times with the same arguments in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use the following alternative functions:\\n <ul>\\n   <li><a href=\"?anchor=list-databases-nondeterministic-1\">list-databases-nondeterministic#1</a></li>\\n   <li><a href=\"?anchor=list-databases-nondeterministic-2\">list-databases-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=database-info-nondeterministic-2\">database-info-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=database-info-nondeterministic-3\">database-info-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=all-documents-nondeterministic-2\">all-documents-nondeterministic#2</a></li>\\n   <li><a href=\"?anchor=all-documents-nondeterministic-3\">all-documents-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=multiple-documents-nondeterministic-3\">multiple-documents-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=multiple-documents-nondeterministic-4\">multiple-documents-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=document-nondeterministic-3\">document-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=document-nondeterministic-4\">document-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=document-info-nondeterministic-3\">document-info-nondeterministic#3</a></li>\\n   <li><a href=\"?anchor=document-info-nondeterministic-4\">document-info-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=attachment-nondeterministic-4\">attachment-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=attachment-nondeterministic-5\">attachment-nondeterministic#5</a></li>\\n   <li><a href=\"?anchor=all-view-documents-nondeterministic-4\">all-view-documents-nondeterministic#4</a></li>\\n   <li><a href=\"?anchor=all-view-documents-nondeterministic-5\">all-view-documents-nondeterministic#5</a></li>\\n   <li><a href=\"?anchor=multiple-view-documents-nondeterministic-5\">multiple-view-documents-nondeterministic#5</a></li>\\n   <li><a href=\"?anchor=multiple-view-documents-nondeterministic-6\">multiple-view-documents-nondeterministic#6</a></li>\\n   <li><a href=\"?anchor=lucene-query-nondeterministic-5\">lucene-query-nondeterministic#5</a></li>\\n   <li><a href=\"?anchor=lucene-query-nondeterministic-6\">lucene-query-nondeterministic#6</a></li>\\n </ul>\\n which have been declared as being non deterministic.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/cloudant\",prefix:\"cloudant\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"http\"},{uri:\"http://www.28msec.com/modules/maps\",prefix:\"map\"},{uri:\"http://zorba.io/modules/random\",prefix:\"random\"},{uri:\"http://www.zorba-xquery.com/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"all-documents-nondeterministic\",qname:\"cloudant:all-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#all-documents-2\">all-documents#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists all the documents in a given database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"object()\",description:\"An object listing the documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"all-documents-nondeterministic\",qname:\"cloudant:all-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#all-documents-3\">all-documents#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists all the documents in a given database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing the documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"all-documents\",qname:\"cloudant:all-documents\",signature:\"($connection as anyURI, $database as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:all-documents($connection, \"db\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\":3,\\n   \"offset\":0,\\n   \"rows\":[\\n   {\\n     \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"key\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n     }\\n   },\\n   {\\n     \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"key\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n      }\\n   },\\n   {\\n     \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"key\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n     }\\n   }]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all the documents in a given database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"object()\",description:\"An object listing the documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"all-documents\",qname:\"cloudant:all-documents\",signature:\"($connection as anyURI, $database as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists all the documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>descending: return the documents in descending by key order (boolean,\\n   default: false).</li>\\n   <li>endkey: stop returning records when the specified key is reached (string).</li>\\n   <li>endkey_docid: stop returning records when the specified document ID is\\n   reached (string).</li>\\n   <li>group: group the results using the reduce function to a group or single\\n   row (boolean, default: false).</li>\\n   <li>group_level: specify the group level to be used (numeric).</li>\\n   <li>include_docs: include the full content of the documents in the return\\n   (boolean, default: false).</li>\\n   <li>inclusive_end: specifies whether the specified end key should be included\\n   in the result (boolean, default: true).</li>\\n   <li>key: return only documents that match the specified key (string).</li>\\n   <li>limit: limit the number of the returned documents to the specified number\\n   (numeric).</li>\\n   <li>reduce: use the reduction function (boolean, default: true).</li>\\n   <li>skip: skip this number of records before starting to return the results\\n   (numeric, default: 0).</li>\\n   <li>stale: allow the results from a stale view to be used (string, allowed\\n   value: \"ok\").</li>\\n   <li>startkey: start returning records when the specified key is reached (string).</li>\\n   <li>startkey_docid: start returning records when the specified document ID\\n   is reached (string).</li>\\n   <li>database-owner: specifies the database owner (string, default: connection\\n   user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:all-documents($connection, \"db\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\":3,\\n   \"offset\":0,\\n   \"rows\":[\\n   {\\n     \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"key\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n     }\\n   },\\n   {\\n     \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"key\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n      }\\n   },\\n   {\\n     \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"key\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n     }\\n   }]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists all the documents in a given database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing the documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"all-view-documents-nondeterministic\",qname:\"cloudant:all-view-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a JSON object describing all the documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#all-view-documents-4\">all-view-documents#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns a JSON object describing all the documents in a given view.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'}],returns:{type:\"object()\",description:\"An object listing all documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"all-view-documents-nondeterministic\",qname:\"cloudant:all-view-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a JSON object describing all the documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#all-view-documents-5\">all-view-documents#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns a JSON object describing all the documents in a given view.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing all documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"all-view-documents\",qname:\"cloudant:all-view-documents\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a JSON object describing all the documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:all-view-documents($connection, \"db\", \"recipes\", \"by_title\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"offset\" : 0,\\n   \"rows\" :\\n   [\\n     {\\n       \"id\" : \"3-tiersalmonspinachandavocadoterrine\",\\n       \"key\" : \"3-tier salmon, spinach and avocado terrine\",\\n       \"value\" : [\"3-tier salmon, spinach and avocado terrine\"]\\n     },\\n     {\\n       \"id\" : \"Aberffrawcake\",\\n       \"key\" : \"Aberffraw cake\",\\n       \"value\" : [\"Aberffraw cake\"]\\n     },\\n     {\\n       \"id\" : \"Adukiandorangecasserole-microwave\",\\n       \"key\" : \"Aduki and orange casserole - microwave\",\\n       \"value\" : [\"Aduki and orange casserole - microwave\"]\\n     }\\n   ],\\n   \"total_rows\" : 3\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns a JSON object describing all the documents in a given view.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'}],returns:{type:\"object()\",description:\"An object listing all documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"all-view-documents\",qname:\"cloudant:all-view-documents\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a JSON object describing all the documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>descending: return the documents in descending by key order (boolean,\\n   default: false)</li>\\n   <li>endkey: stop returning records when the specified key is reached (string)</li>\\n   <li>endkey_docid: stop returning records when the specified document ID is\\n   reached (string)</li>\\n   <li>group: group the results using the reduce function to a group or single\\n   row (boolean, default: false)</li>\\n   <li>group_level: specify the group level to be used (numeric)</li>\\n   <li>include_docs: include the full content of the documents in the return\\n   (boolean, default: false)</li>\\n   <li>inclusive_end: specifies whether the specified end key should be included\\n   in the result (boolean, default: true)</li>\\n   <li>key: return only documents that match the specified key (string)</li>\\n   <li>limit: limit the number of the returned documents to the specified number\\n   (numeric)</li>\\n   <li>reduce: use the reduction function (boolean, default: true)</li>\\n   <li>skip: skip this number of records before starting to return the results\\n   (numeric, default: 0)</li>\\n   <li>stale: allow the results from a stale view to be used (string, allowed\\n   value: \"ok\")</li>\\n   <li>startkey: start returning records when the specified key is reached\\n   (string)</li>\\n   <li>startkey_docid: start returning records when the specified document ID\\n   is reached (string)</li>\\n   <li>database-owner: specifies the database owner (string, default:\\n   connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:all-view-documents($connection, \"db\", \"recipes\", \"by_title\",\\n   {\"database-owner\" : \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"offset\" : 0,\\n   \"rows\" :\\n   [\\n     {\\n       \"id\" : \"3-tiersalmonspinachandavocadoterrine\",\\n       \"key\" : \"3-tier salmon, spinach and avocado terrine\",\\n       \"value\" : [\"3-tier salmon, spinach and avocado terrine\"]\\n     },\\n     {\\n       \"id\" : \"Aberffrawcake\",\\n       \"key\" : \"Aberffraw cake\",\\n       \"value\" : [\"Aberffraw cake\"]\\n     },\\n     {\\n       \"id\" : \"Adukiandorangecasserole-microwave\",\\n       \"key\" : \"Aduki and orange casserole - microwave\",\\n       \"value\" : [\"Aduki and orange casserole - microwave\"]\\n     }\\n   ],\\n   \"total_rows\" : 3\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision\\n  number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns a JSON object describing all the documents in a given view.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing all documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"attachment-nondeterministic\",qname:\"cloudant:attachment-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string, $attachment-name as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the specified document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#attachment-4\">attachment#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the specified document attachment.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An attchment name</div>'}],returns:{type:\"object()\",description:\"The specified document attachment\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"attachment-nondeterministic\",qname:\"cloudant:attachment-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string, $attachment-name as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the specified document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#attachment-5\">attachment#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves the specified document attachment.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An attchment name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The specified document attachment\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-NOT-EXISTS Attachment does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"attachment\",qname:\"cloudant:attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $attachment-name as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the specified document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:attachment($connection, \"db\", \"DocID\", \"Attachment\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieving a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To retrieve a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:attachment($connection, \"db\", \"_design/DocID\", \"Attachment\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the media-type of the attachment as\\n it was specified when the attachment was submitted to the database and\\n its raw content.\\n The format of the returned object is the following:\\n <pre>\\n {\\n   \"media-type\": \"text/plain\",\\n   \"content\" : \"Hello World\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The type of the content field is determined by the media-type returned by the\\n server. If the media-type indicates that the body content is textual,\\n then the content has type string, base64Binary otherwise.\\n Specifically, the body content is considered textual only if the MIME-type specified in\\n the media-type is one of:\\n <ul>\\n   <li>\"application/json\"</li>\\n   <li>\"application/x-javascript\"</li>\\n   <li>\"application/xml\"</li>\\n   <li>\"application/xml-external-parsed-entity\"</li>\\n </ul>\\n or if the MIME-type starts with \"text/\" or ends with \"+xml\".</p>\\n',summary:\"<p>  Retrieves the specified document attachment.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An attchment name</div>'}],returns:{type:\"object()\",description:\"The specified document attachment\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"attachment\",qname:\"cloudant:attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $attachment-name as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the specified document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:attachment($connection, \"db\", \"DocID\", \"Attachment\",\\n   {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieving a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To retrieve a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:attachment($connection, \"db\", \"_design/DocID\", \"Attachment\",\\n   {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the media-type of the attachment as\\n it was specified when the attachment was submitted to the database and\\n its raw content.\\n The format of the returned object is the following:\\n <pre>\\n {\\n   \"media-type\": \"text/plain\",\\n   \"content\" : \"Hello World\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The type of the content field is determined by the media-type returned by the\\n server. If the media-type indicates that the body content is textual,\\n then the content has type string, base64Binary otherwise.\\n Specifically, the body content is considered textual only if the MIME-type specified in\\n the media-type is one of:\\n <ul>\\n   <li>\"application/json\"</li>\\n   <li>\"application/x-javascript\"</li>\\n   <li>\"application/xml\"</li>\\n   <li>\"application/xml-external-parsed-entity\"</li>\\n </ul>\\n or if the MIME-type starts with \"text/\" or ends with \"+xml\".</p>\\n',summary:\"<p>  Retrieves the specified document attachment.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An attchment name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The specified document attachment\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-NOT-EXISTS Attachment does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"bulk-crud\",qname:\"cloudant:bulk-crud\",signature:\"($connection as anyURI, $database as string, $documents as object()*) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates, updates or deletes multiple documents with a single request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When creating new documents the document ID is optional. For updating\\n existing documents, you must provide the document ID, revision information,\\n and new document values. To delete existing documents, you must provide the\\n document ID, revision information and add a field <code>_deleted</code> having\\n value <code>true</code>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:bulk-crud($connection, \"db\",\\n (\\n   {\\n     \"name\":\"Nicholas\",\\n     \"age\":45,\\n     \"gender\":\"male\",\\n   },\\n   {\\n     \"name\":\"Taylor\",\\n     \"age\":50,\\n     \"gender\":\"male\",\\n     \"_id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n   },\\n   {\\n     \"name\":\"Owen\",\\n     \"age\":51,\\n     \"gender\":\"male\",\\n     \"_id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"_rev\":\"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n   },\\n   {\\n     \"_id\":\"b675e932-9bb6-4fc9-b889-50238ac3512b\",\\n     \"_rev\":\"2-abd3942fdab3515bfed224abed2451feb\",\\n     \"_deleted\": true\\n   }\\n ))\\n </pre>\\n requires to insert the first document with a system-generated identifier, to\\n insert the second one with a user-specified identifier, to update the third\\n one and, finally,to delete the last one.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The JSON returned by the_bulk_docs operation consists of an array\\n of JSON structures, one for each submitted document.\\n The returned JSON structure should be examined to ensure that all of\\n the documents submitted in the original request were successfully added\\n to the database. When no errors are raised, the revision of the new\\n document is reported for all documents.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <pre>\\n [{\\n    \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n    \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n  },\\n  {\\n    \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n    \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n  },\\n  {\\n    \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n    \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n  },\\n  {\\n    \"id\": \"b675e932-9bb6-4fc9-b889-50238ac3512b\",\\n    \"rev\":\"2-12356bafb1232167befabb32127823943d\"\\n  }]\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cloudant will only guarantee that some of the documents will be\\n saved when you send the request. The response will contain the list of\\n documents successfully inserted or updated during the process.\\n In the event of a crash, some of the documents may have been successfully\\n saved, and some will have been lost.\\n The response structure will indicate whether the document was updated by\\n supplying the <code>rev</code> parameter indicating a new document revision\\n was created. If the update failed, then you will get an error of type\\n <code>conflict</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example:\\n <pre>\\n [\\n   {\\n     \"id\":\"FishStew\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   },\\n   {\\n     \"id\":\"LambStew\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   },\\n   {\\n     \"id\":\"7f7638c86173eb440b8890839ff35433\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   }\\n ]\\n </pre>\\n In this case no new revision has been created and you will need to submit\\n the document update with the correct revision tag, to update the document.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The exact structure of each document in the returned array is:\\n <ul>\\n   <li>id: the document ID</li>\\n   <li>rev: the new document revision, if a new revision was created</li>\\n   <li>error: the error type, if an error was raised</li>\\n   <li>reason: a description of the raised error, if an error was raised</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The error type can either be conflict or forbidden. The first type means that\\n the document as submitted is in conflict. The new revision has not been created\\n and you will need to re-submit the document to the database. Entries with forbidden\\n error type indicate that the validation routine applied to the document during submission\\n has returned an error.</p>\\n',summary:\"<p>  Creates, updates or deletes multiple documents with a single request.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"documents\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An sequence of documents</div>'}],returns:{type:\"array()\",description:\"An object describing the performed operations\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"bulk-crud\",qname:\"cloudant:bulk-crud\",signature:\"($connection as anyURI, $database as string, $documents as object()*, $options as object()) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates, updates or deletes multiple documents with a single request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When creating new documents the document ID is optional. For updating\\n existing documents, you must provide the document ID, revision information,\\n and new document values. To delete existing documents, you must provide the\\n document ID, revision information and add a field <code>_deleted</code> having\\n value <code>true</code>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>all_or_nothing: sets the database commit mode to use all-or-nothing\\n   semantics (boolean, default: false).</li>\\n   <li>database-owner: specifies the database owner (string, default: connection\\n   user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:bulk-crud($connection, \"db\",\\n (\\n   {\\n     \"name\":\"Nicholas\",\\n     \"age\":45,\\n     \"gender\":\"male\",\\n   },\\n   {\\n     \"name\":\"Taylor\",\\n     \"age\":50,\\n     \"gender\":\"male\",\\n     \"_id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n   },\\n   {\\n     \"name\":\"Owen\",\\n     \"age\":51,\\n     \"gender\":\"male\",\\n     \"_id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"_rev\":\"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n   },\\n   {\\n     \"_id\":\"b675e932-9bb6-4fc9-b889-50238ac3512b\",\\n     \"_rev\":\"2-abd3942fdab3515bfed224abed2451feb\",\\n     \"_deleted\": true\\n   }\\n ),{\"database-owner\": \"username\"})\\n </pre>\\n requires to insert the first document with a system-generated identifier, to\\n insert the second one with a user-specified identifier, to update the third\\n one and, finally, to delete the last one.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The JSON returned by the_bulk_docs operation consists of an array\\n of JSON structures, one for each document in the original submission.\\n The returned JSON structure should be examined to ensure that all of\\n the documents submitted in the original request were successfully added\\n to the database. When no errors are raised, the revision of the new\\n document is reported for all documents.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <pre>\\n [{\\n    \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n    \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n  },\\n  {\\n    \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n    \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n  },\\n  {\\n    \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n    \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n  },\\n  {\\n    \"id\": \"b675e932-9bb6-4fc9-b889-50238ac3512b\",\\n    \"rev\":\"2-12356bafb1232167befabb32127823943d\"\\n  }]\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cloudant will only guarantee that some of the documents will be\\n saved when you send the request. The response will contain the list of\\n documents successfully inserted or updated during the process.\\n In the event of a crash, some of the documents may have been successfully\\n saved, and some will have been lost.\\n The response structure will indicate whether the document was updated by\\n supplying the <code>rev</code> parameter indicating a new document revision\\n was created. If the update failed, then you will get an error of type\\n <code>conflict</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example:\\n <pre>\\n [\\n   {\\n     \"id\":\"FishStew\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   },\\n   {\\n     \"id\":\"LambStew\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   },\\n   {\\n     \"id\":\"7f7638c86173eb440b8890839ff35433\",\\n     \"error\":\"conflict\",\\n     \"reason\":\"Document update conflict.\"\\n   }\\n ]\\n </pre>\\n In this case no new revision has been created and you will need to submit\\n the document update with the correct revision tag, to update the document.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The exact structure of each document in the returned array is:\\n <ul>\\n   <li>id: the document ID</li>\\n   <li>rev: the new document revision, if a new revision was created</li>\\n   <li>error: the error type, if an error was raised</li>\\n   <li>reason: a description of the raised error, if an error was raised</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The error type can either be conflict or forbidden. The first type means that\\n the document as submitted is in conflict. The new revision has not been created\\n and you will need to re-submit the document to the database. Entries with forbidden\\n error type indicate that the validation routine applied to the document during submission\\n has returned an error.</p>\\n',summary:\"<p>  Creates, updates or deletes multiple documents with a single request.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"documents\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An sequence of documents</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"array()\",description:\"An object describing the performed operations\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"commit-changes\",qname:\"cloudant:commit-changes\",signature:\"($connection as anyURI, $database as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Commits any recent changes to the specified database to disk.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:commit-changes($connection, \"db\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"ok\" : true,\\n   \"instance_start_time\" : \"0\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Commits any recent changes to the specified database to disk.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"object()\",description:\"An object reporting the instance start time\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NOT-EXISTS The specified database does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"commit-changes\",qname:\"cloudant:commit-changes\",signature:\"($connection as anyURI, $database as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Commits any recent changes to the specified database to disk.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection\\n   user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:commit-changes($connection, \"db\", {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"ok\" : true,\\n   \"instance_start_time\" : \"0\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Commits any recent changes to the specified database to disk.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object reporting the instance start time\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NOT-EXISTS The specified database does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"connect\",qname:\"cloudant:connect\",signature:\"() as anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Opens a connection to Cloudant using the default credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that can represents the connection.\\n This URI has to be passed to other functions of this module that require\\n a <code>$connection</code> parameter as a first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function requires to specify an options object.\\n The following options are supported:\\n <ul>\\n   <li>username: the username used for connecting (string, mandatory).</li>\\n   <li>password: the password used for connecting (string, mandatory).</li>\\n   <li>default-database-owner: the default database owner which will be\\n       used when calling the other module functions (string).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:connect()</pre>.\\n </p>\\n',summary:\"<p>  Opens a connection to Cloudant using the default credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"anyURI\",description:\"An identifier that represents the connection to the server\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CREDENTIALS Missing or invalid credentials</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authentication error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect\",qname:\"cloudant:connect\",signature:\"($credentials as item()) as anyURI\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Opens a connection to Cloudant using the specified credentials.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that can represents the connection.\\n This URI has to be passed to other functions of this module that require\\n a <code>$connection</code> parameter as a first argument.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The $credentials parameter is used to specify the connection information.\\n If a string is used, then the function will interpret it as the name of\\n a credential in the Cloudant category.\\n If an object is used, then the function will open a connection using it.\\n The object structure is the following:\\n <ul>\\n   <li>username: the username used for connecting (string, mandatory).</li>\\n   <li>password: the password used for connecting (string, mandatory).</li>\\n   <li>default-database-owner: the default database owner which will be\\n       used when calling the other module functions (string, optional).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, using stored credential:\\n <pre>cloudant:connect(\"credentials-name\")</pre>\\n For example, specifying the connection information:\\n <pre>cloudant:connect(\\n   {\\n     \"username\": \"user\",\\n     \"password: \"pass\",\\n     \"owner\": \"another-user\"\\n   })</pre>.\\n </p>\\n',summary:\"<p>  Opens a connection to Cloudant using the specified credentials.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"credentials\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The connection specification</div>'}],returns:{type:\"anyURI\",description:\"An identifier that represents the connection to the server\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authentication error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CREDENTIALS Missing or malformed credentials</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"create-database\",qname:\"cloudant:create-database\",signature:\"($connection as anyURI, $database as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a new database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The database name must be composed of one or more of the following\\n characters:\\n <ul>\\n  <li>Lowercase characters (a-z).</li>\\n  <li>Digits (0-9).</li>\\n  <li>Any of the characters: _,$,(,),+,- and /.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-database($connection, \"db\")</pre>.\\n </p>\\n',summary:\"<p>  Creates a new database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"empty-sequence()\",description:\"Empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-EXISTS Database already exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create-document\",qname:\"cloudant:create-document\",signature:\"($connection as anyURI, $database as string, $document as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a new document in the specified database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a new document in the specified database,\\n using the supplied JSON document structure. If the JSON\\n structure includes the _id field, then the document will\\n be created with the specified document ID. If the _id\\n field is not specified, a new unique ID will be generated.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can include one or more attachments with a given document\\n by incorporating the attachment information within the JSON of\\n the document. This provides a simpler alternative to loading\\n documents with attachments than making a separate call.\\n To do so add you can add the <code>_attachments</code> object\\n field to the document. It can have one ore more fields, each\\n defining a different attachment.\\n The name of the field is the name of the attachment.\\n Its value is an object containing the following fields:\\n <ul>\\n  <li>content_type: MIME Content type string</li>\\n  <li>data: File attachment content, Base64 encoded</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-document($connection, \"db\",\\n   {\\n     \"_id\" : \"FishStew\",\\n     \"servings\" : 4,\\n     \"subtitle\" : \"Delicious with fresh bread\",\\n     \"title\" : \"Fish Stew\"\\n     \"_attachments\" : {\\n       \"styling.css\" : {\\n       \"content-type\" : \"text/css\",\\n       \"data\" : \"cCB7IGZvbnQtc2l6ZTogMTJwdDsgfQo=\"\\n       }\\n     }\\n   })\\n </pre>\\n creates a document with an attachment named <code>styling.css</code>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create a design document the <code>_id</code> field must be present and must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, the following expression creates a design document\\n <pre>cloudant:create-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   }, {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned JSON object will report the new document revision\\n and has the following form:\\n <pre>\\n {\\n   \"id\":\"64575eef70ab90a2b8d55fc09e00440d\",\\n   \"ok\":true,\\n   \"rev\":\"1-9c65296036141e575d32ba9c034dd3ee\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates a new document in the specified database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document</div>'}],returns:{type:\"object()\",description:\"An object which contains the document id and revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT Document creation conflict</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"create-document\",qname:\"cloudant:create-document\",signature:\"($connection as anyURI, $database as string, $document as object(), $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a new document in the specified database</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates a new document in the specified database,\\n using the supplied JSON document structure. If the JSON\\n structure includes the _id field, then the document will\\n be created with the specified document ID. If the _id\\n field is not specified, a new unique ID will be generated.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can include one or more attachments with a given document\\n by incorporating the attachment information within the JSON of\\n the document. This provides a simpler alternative to loading\\n documents with attachments than making a separate call.\\n To do so add you can add the <code>_attachments</code> object\\n field to the document. It can have one ore more fields, each\\n defining a different attachment.\\n The name of the field is the name of the attachment.\\n Its value is an object containing the following fields:\\n <ul>\\n  <li>content_type: MIME Content type string</li>\\n  <li>data: File attachment content, Base64 encoded</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-document($connection, \"db\",\\n   {\\n     \"_id\" : \"FishStew\",\\n     \"servings\" : 4,\\n     \"subtitle\" : \"Delicious with fresh bread\",\\n     \"title\" : \"Fish Stew\"\\n     \"_attachments\" : {\\n       \"styling.css\" : {\\n       \"content-type\" : \"text/css\",\\n       \"data\" : \"cCB7IGZvbnQtc2l6ZTogMTJwdDsgfQo=\"\\n       }\\n     }\\n   }, {\"database-owner\": \"username\"})\\n </pre>\\n creates a document with an attachment named <code>styling.css</code>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>batch: requires batch mode for insertions (string, allowed value: \"ok\")</li>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can write documents to the database at a higher rate\\n by using the batch option. This collects document writes\\n together in memory (on a user-by-user basis) before they are\\n committed to disk. This increases the risk of the documents\\n not being stored in the event of a failure, since the documents\\n are not written to disk immediately.</p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create a design document the <code>_id</code> field must be present and must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, the following expression creates a design document\\n <pre>cloudant:create-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   }, {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned JSON object will report the new document revision\\n and has the following form:\\n <pre>\\n {\\n   \"id\":\"64575eef70ab90a2b8d55fc09e00440d\",\\n   \"ok\":true,\\n   \"rev\":\"1-9c65296036141e575d32ba9c034dd3ee\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates a new document in the specified database \\n  Creates a new document in the specified database,\\n using the supplied JSON document structure.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object which contains the document id and revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT Document creation conflict</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:7,name:\"create-or-update-attachment\",qname:\"cloudant:create-or-update-attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string, $attachment-name as string, $media-type as string, $attachment as atomic) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates or updates a document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-attachment($connection, \"db\", \"FishStew\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\", \"text/plain\",\\n   \"AttachmentContent\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating or updating a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create or update a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-attachment($connection, \"db\", \"_design/DesDocId\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\", \"text/plain\",\\n   \"AttachmentContent\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its new\\n revision, as follows:\\n <pre>\\n {\\n   \"id\":\"FishStew\",\\n   \"ok\":true,\\n   \"rev\":\"9-247bb19a41bfd9bfdaf5ee6e2e05be74\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates or updates a document attachment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the attachment</div>'},{name:\"media-type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The media-type of the attachment</div>'},{name:\"attachment\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">-name The name of the attachment</div>'}],returns:{type:\"object()\",description:\"An object containing the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-TYPE Attachment type must be string, base64Binary or hexBinary</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:8,name:\"create-or-update-attachment\",qname:\"cloudant:create-or-update-attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string, $attachment-name as string, $media-type as string, $attachment as atomic, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates or updates a document attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-attachment($connection, \"db\", \"FishStew\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\", \"text/plain\",\\n   \"AttachmentContent\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating or updating a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create or update a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-attachment($connection, \"db\", \"_design/DesDocId\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\", \"text/plain\",\\n   \"AttachmentContent\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its new\\n revision, as follows:\\n <pre>\\n {\\n   \"id\":\"FishStew\",\\n   \"ok\":true,\\n   \"rev\":\"9-247bb19a41bfd9bfdaf5ee6e2e05be74\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates or updates a document attachment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the attachment</div>'},{name:\"media-type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The media-type of the attachment</div>'},{name:\"attachment\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">-name The name of the attachment</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object containing the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-TYPE Attachment type must be string, base64Binary or hexBinary</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create-or-update-document\",qname:\"cloudant:create-or-update-document\",signature:\"($connection as anyURI, $database as string, $document as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates or updates a document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When creating a new document, the <code>_id</code> field must\\n be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"name\":\"Hannah\",\\n     \"age\":120,\\n     \"gender\":\"female\",\\n     \"_id\":\"DocID\"\\n   })</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When updating a document, the <code>_id</code> and the\\n <code>_rev</code> field, which contains the last document revision,\\n must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"name\":\"Hannah\",\\n     \"age\":40,\\n     \"gender\":\"female\",\\n     \"_id\":\"DocID\",\\n     \"_rev\":\"1-764b9b11845fd0b73cfa0e61acc74ecf\"\\n   })</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating or updating a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create or update a design document the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, the following expression creates a design document\\n <pre>cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   })\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, the following expression updates a design document\\n <pre>cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"_rev\": \"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   })\\n </pre>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the design document is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>views: object defining the views. Each field defines a different view.\\n       The field name is the name of the view and has the following content:\\n     <ul>\\n       <li>map: view map function</li>\\n       <li>reduce: view reduce function (optional)</li>\\n     </ul>\\n   </li>\\n   <li>indexes: object defining the view indexes. Each field defines a different index.\\n       The field name is the name of the index and has the following content:\\n     <ul>\\n       <li>analyzer: Name of the analyzer to be used or an object with the\\n       following fields:\\n         <ul>\\n           <li>name: Name of the analyzer</li>\\n           <li>stopwords: An array of stop words. Stop words are words that\\n           should not be indexed.</li>\\n         </ul>\\n       </li>\\n       <li>index: Function that handles the indexing</li>\\n     </ul>\\n   </li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the returned object is the following and contains\\n the document id and revision.\\n <pre>\\n {\\n   \"ok\":true,\\n   \"id\":\"DocID\",\\n   \"rev\":\"1-764b9b11845fd0b73cfa0e61acc74ecf\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates or updates a document.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document</div>'}],returns:{type:\"object()\",description:\"An object which specifies the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT-MALFORMED Malformed document object</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"create-or-update-document\",qname:\"cloudant:create-or-update-document\",signature:\"($connection as anyURI, $database as string, $document as object(), $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creates or updates a document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When creating a new document, the <code>_id</code> field must\\n be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-document($connection, \"db\", \"DocID\",\\n   {\\n     \"name\":\"Hannah\",\\n     \"age\":120,\\n     \"gender\":\"female\",\\n     \"_id\":\"DocID\"\\n   }, {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">When updating a document, the <code>_id</code> and the\\n <code>_rev</code> field, which contains the last document revision,\\n must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:create-or-update-document($connection, \"db\", \"DocID\",\\n   {\\n     \"name\":\"Hannah\",\\n     \"age\":40,\\n     \"gender\":\"female\",\\n     \"_id\":\"DocID\",\\n     \"_rev\":\"1-764b9b11845fd0b73cfa0e61acc74ecf\"\\n   }, {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Creating or updating a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To create or update a design document the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, the following expression creates a design document\\n <pre>cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   }, {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:create-or-update-document($connection, \"db\",\\n   {\\n     \"_id\": \"_design/DesDocID\",\\n     \"_rev\": \"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n     \"views\": {\\n       \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n       }\\n     },\\n     \"indexes\": {\\n       \"mysearch\" : {\\n         \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n         \"index\": \"function(doc){ ... }\"\\n       },\\n     }\\n   }, {\"database-owner\": \"username\"})\\n </pre>.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the design document is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>views: object defining the views. Each field defines a different view.\\n       The field name is the name of the view and has the following content:\\n     <ul>\\n       <li>map: view map function</li>\\n       <li>reduce: view reduce function (optional)</li>\\n     </ul>\\n   </li>\\n   <li>indexes: object defining the view indexes. Each field defines a different index.\\n       The field name is the name of the index and has the following content:\\n     <ul>\\n       <li>analyzer: Name of the analyzer to be used or an object with the\\n       following fields:\\n         <ul>\\n           <li>name: Name of the analyzer</li>\\n           <li>stopwords: An array of stop words. Stop words are words that\\n           should not be indexed.</li>\\n         </ul>\\n       </li>\\n       <li>index: Function that handles the indexing</li>\\n     </ul>\\n   </li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the returned object is the following and contains\\n the document id and revision.\\n <pre>\\n {\\n   \"ok\":true,\\n   \"id\":\"DocID\",\\n   \"rev\":\"1-764b9b11845fd0b73cfa0e61acc74ecf\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Creates or updates a document.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object which specifies the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT-MALFORMED Malformed document object</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"database-info-nondeterministic\",qname:\"cloudant:database-info-nondeterministic\",signature:\"($connection as anyURI, $database as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns information about a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#database-info-2\">database-info#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns information about a database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"object()\",description:\"An object describing the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"database-info-nondeterministic\",qname:\"cloudant:database-info-nondeterministic\",signature:\"($connection as anyURI, $database as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns information about a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#database-info-3\">database-info#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns information about a database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object describing the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"database-info\",qname:\"cloudant:database-info\",signature:\"($connection as anyURI, $database as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns information about a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:database-info($connection, \"db\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"update_seq\": \"0-g1AAAADneJzLYWBg...\",\\n   \"db_name\": \"db\",\\n   \"purge_seq\": 0,\\n   \"other\": {\\n     \"data_size\": 0\\n   },\\n   \"doc_del_count\": 0,\\n   \"doc_count\": 0,\\n   \"disk_size\": 316,\\n   \"disk_format_version\": 5,\\n   \"compact_running\": false,\\n   \"instance_start_time\": \"0\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>compact_running: set to true if the database compaction routine is\\n  operating on this database.</li>\\n  <li>db_name: the name of the database.</li>\\n  <li>disk_format_version: the version of the physical format used for the data\\n  when it is stored on disk.</li>\\n  <li>disk_size: size in bytes of the data as stored on the disk. Views indexes\\n  are not included in the calculation.</li>\\n  <li>doc_count: a count of the documents in the specified database.</li>\\n  <li>doc_del_count: number of deleted documents.</li>\\n  <li>instance_start_time: always 0.</li>\\n  <li>purge_seq: the number of purge operations on the database.</li>\\n  <li>update_seq: the current number of updates to the database.</li>\\n  <li>other: JSON object containing a data_size field.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns information about a database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"object()\",description:\"An object describing the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"database-info\",qname:\"cloudant:database-info\",signature:\"($connection as anyURI, $database as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns information about a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:database-info($connection, \"db\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"update_seq\": \"0-g1AAAADneJzLYWBg...\",\\n   \"db_name\": \"db\",\\n   \"purge_seq\": 0,\\n   \"other\": {\\n     \"data_size\": 0\\n   },\\n   \"doc_del_count\": 0,\\n   \"doc_count\": 0,\\n   \"disk_size\": 316,\\n   \"disk_format_version\": 5,\\n   \"compact_running\": false,\\n   \"instance_start_time\": \"0\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>compact_running: set to true if the database compaction routine is\\n  operating on this database.</li>\\n  <li>db_name: the name of the database.</li>\\n  <li>disk_format_version: the version of the physical format used for the data\\n  when it is stored on disk.</li>\\n  <li>disk_size: size in bytes of the data as stored on the disk. Views indexes\\n  are not included in the calculation.</li>\\n  <li>doc_count: a count of the documents in the specified database.</li>\\n  <li>doc_del_count: number of deleted documents.</li>\\n  <li>instance_start_time: always 0.</li>\\n  <li>purge_seq: the number of purge operations on the database.</li>\\n  <li>update_seq: the current number of updates to the database.</li>\\n  <li>other: JSON object containing a data_size field.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns information about a database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a database name</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object describing the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"delete-attachment\",qname:\"cloudant:delete-attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string, $attachment-name as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes the specified attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:delete-attachment($connection, \"db\", \"FishStew\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deleting a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To delete a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:delete-attachment($connection, \"db\", \"_design/DesDocId\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\",\\n   \"AttachmentName\", \"text/plain\", \"AttachmentContent\")</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its new\\n revision, as follows:\\n <pre>\\n {\\n   \"id\":\"FishStew\",\\n   \"ok\":true,\\n   \"rev\":\"9-247bb19a41bfd9bfdaf5ee6e2e05be74\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes the specified attachment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the attachment</div>'}],returns:{type:\"object()\",description:\"An object containing the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-NOT-EXISTS Attachment does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-TYPE Attachment type must be string, base64Binary or hexBinary</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"delete-attachment\",qname:\"cloudant:delete-attachment\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string, $attachment-name as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes the specified attachment.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:delete-attachment($connection, \"db\", \"FishStew\",\\n \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\",\\n {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deleting a design document attachment.</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To delete a design document attachment the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:delete-attachment($connection, \"db\", \"_design/DesDocId\",\\n   \"8-7c4740b4dcf26683e941d6641c00c39d\", \"AttachmentName\", \"text/plain\",\\n   \"AttachmentContent\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its new\\n revision, as follows:\\n <pre>\\n {\\n   \"id\":\"FishStew\",\\n   \"ok\":true,\\n   \"rev\":\"9-247bb19a41bfd9bfdaf5ee6e2e05be74\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes the specified attachment.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'},{name:\"attachment-name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the attachment</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object containing the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-NOT-EXISTS Attachment does not exists</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:ATTACHMENT-TYPE Attachment type must be string, base64Binary or hexBinary</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-database\",qname:\"cloudant:delete-database\",signature:\"($connection as anyURI, $database as string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a database and all the documents and attachments contained in it.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The database name must be composed of one or more of the following characters:\\n <ul>\\n  <li>Lowercase characters (a-z).</li>\\n  <li>Digits (0-9).</li>\\n  <li>Any of the characters: _,$,(,),+,- and /.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:delete-database($connection, \"db\")</pre>.\\n </p>\\n',summary:\"<p>  Deletes a database and all the documents and attachments contained in it.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'}],returns:{type:\"empty-sequence()\",description:\"Empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NOT-EXISTS Database does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"delete-document\",qname:\"cloudant:delete-document\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes the specified document from a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:delete-document($connection, \"db\", \"DocID\", \"3-7c4740b4dcf26683e941d6641c00c39d\")\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deleting a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To delete a design document the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:delete-document($connection, \"db\", \"_design/DesDocID\", \"3-7c4740b4dcf26683e941d6641c00c39d\")\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its\\n new revision, as follows:\\n <pre>\\n {\\n   \"id\":\"DocID\",\\n   \"ok\":true,\\n   \"rev\":\"4-2719fd41187c60762ff584761b714cfb\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes the specified document from a database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'}],returns:{type:\"object()\",description:\"An object which specifies the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:REVISION Specified revision is missing, invalid or not the latest.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"delete-document\",qname:\"cloudant:delete-document\",signature:\"($connection as anyURI, $database as string, $document-id as string, $document-rev as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes the specified document from a database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest document revision must be specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:delete-document($connection, \"db\", \"DocID\", \"3-7c4740b4dcf26683e941d6641c00c39d\",\\n   {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deleting a design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To delete a design document the document id must\\n start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:delete-document($connection, \"db\", \"_design/DesDocID\", \"3-7c4740b4dcf26683e941d6641c00c39d\",\\n   {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return value</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned object reports the document id and its\\n new revision, as follows:\\n <pre>\\n {\\n   \"id\":\"DocID\",\\n   \"ok\":true,\\n   \"rev\":\"4-2719fd41187c60762ff584761b714cfb\"\\n }\\n </pre>\\n </p>\\n',summary:\"<p>  Deletes the specified document from a database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"document-rev\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document revision</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object which specifies the document id and its new revision\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:REVISION Specified revision is missing, invalid or not the latest.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"document-info-nondeterministic\",qname:\"cloudant:document-info-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the latest revision and size for a given document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#document-info-3\">document-info#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns the latest revision and size for a given document.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'}],returns:{type:\"object()\",description:\"An object specifying the document id, revision and size\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"document-info-nondeterministic\",qname:\"cloudant:document-info-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the latest revision and size for a given document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#document-info-4\">document-info#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns the latest revision and size for a given document.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object specifying the document id, revision and size\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"document-info\",qname:\"cloudant:document-info\",signature:\"($connection as anyURI, $database as string, $document-id as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the latest revision and size for a given document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document-info($connection, \"db\", \"DocID\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the returned object is the following and contains\\n the document id, latest revision and size.\\n <pre>\\n {\\n   \"ok\": true,\\n   \"id\": \"DocID\",\\n   \"rev\": \"1-764b9b11845fd0b73cfa0e61acc74ecf\",\\n   \"size\": 500\\n }\\n </pre>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returning the latest revision and size for a given design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To return the latest revision and size of a design document the document\\n id must start with\\n <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document-info($connection, \"db\", \"_design/DesDocID\")</pre>.\\n </p>\\n',summary:\"<p>  Returns the latest revision and size for a given document.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'}],returns:{type:\"object()\",description:\"An object specifying the document id, revision and size\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"document-info\",qname:\"cloudant:document-info\",signature:\"($connection as anyURI, $database as string, $document-id as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the latest revision and size for a given document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:document-info($connection, \"db\", \"DocID\", {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The format of the returned object is the following and contains\\n the document id, latest revision and size.\\n <pre>\\n {\\n   \"ok\": true,\\n   \"id\": \"DocID\",\\n   \"rev\": \"1-764b9b11845fd0b73cfa0e61acc74ecf\",\\n   \"size\": 500\\n }\\n </pre>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returning the latest revision and size for a given design document</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To return the latest revision and size of a design document the document\\n id must start with <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:document-info($connection, \"db\", \"_design/DesDocID\", {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n',summary:\"<p>  Returns the latest revision and size for a given document.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object specifying the document id, revision and size\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"document-nondeterministic\",qname:\"cloudant:document-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves a document from the specified database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#document-3\">document#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves a document from the specified database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'}],returns:{type:\"object()\",description:\"The specified document\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"document-nondeterministic\",qname:\"cloudant:document-nondeterministic\",signature:\"($connection as anyURI, $database as string, $document-id as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves a document from the specified database</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#document-4\">document#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Retrieves a document from the specified database \\n  This function has the same semantics as  document#4 ,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The specified document\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"document\",qname:\"cloudant:document\",signature:\"($connection as anyURI, $database as string, $document-id as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves a document from the specified database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The latest revision of the document will be returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the document includes attachments, then the\\n returned structure will contain a summary of the\\n attachments associated with the document, but not the\\n attachment data itself.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document($connection, \"db\", \"DocID\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned JSON object will contain the document\\n and has the following format:\\n <pre>\\n {\\n   \"_id\": \"DocID\",\\n   \"_rev\": \"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n   \"name\": \"Anna\",\\n   \"age\": 89,\\n   \"gender\": \"female\",\\n   \"_attachments\": {\\n     \"my attachment\": {\\n       \"content_type\": \"application/json; charset=UTF-8\",\\n       \"revpos\": 2,\\n       \"digest\": \"md5-37IZysiyWLRWx31J/1WQHw==\",\\n       \"length\": 12,\\n       \"stub\": true\\n       }\\n     }\\n   }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the returned object is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>attachments: document attachments (optional), each field denotes the name\\n       of a different attachment\\n     <ul>\\n       <li>content_type: attachment MIME Content type string</li>\\n       <li>length: attachment length in bytes</li>\\n       <li>revpos: revision where this attachment exists</li>\\n       <li>digest: MD5 checksum of the attachment</li>\\n       <li>stub: indicates whether the attachment is a stub</li>\\n    </ul>\\n  </li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieving a design document from the specified database</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To retrieve a design document the document id must start with\\n <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document($connection, \"db\", \"_design/DesDocID\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A JSON object with the following format is returned:\\n <pre>\\n {\\n  \"_id\": \"_design/DesDocID\",\\n   \"views\": {\\n     \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n     }\\n   },\\n   \"indexes\": {\\n     \"mysearch\" : {\\n       \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n       \"index\": \"function(doc){ ... }\"\\n     },\\n   }\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the returned object is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>views: object defining the views. Each field defines a different view.\\n       The field name is the name of the view and has the following content:\\n     <ul>\\n       <li>map: view map function</li>\\n       <li>reduce: view reduce function (optional)</li>\\n     </ul>\\n   </li>\\n   <li>indexes: object defining the view indexes. Each field defines a different index.\\n       The field name is the name of the index and has the following content:\\n     <ul>\\n       <li>analyzer: Name of the analyzer to be used or an object with the\\n       following fields:\\n         <ul>\\n           <li>name: Name of the analyzer</li>\\n           <li>stopwords: An array of stop words. Stop words are words that\\n           should not be indexed.</li>\\n         </ul>\\n       </li>\\n       <li>index: Function that handles the indexing</li>\\n     </ul>\\n   </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves a document from the specified database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'}],returns:{type:\"object()\",description:\"The specified document\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"document\",qname:\"cloudant:document\",signature:\"($connection as anyURI, $database as string, $document-id as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves a document from the specified database</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Unless you request a specific revision, the latest\\n revision of the document will always be returned.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>conflict: returns the conflict tree for the document (boolean)</li>\\n   <li>rev: specifies the revision to return (string)</li>\\n   <li>revs: return a list of the revisions for the document (boolean)</li>\\n   <li>revs_info: return a list of detailed revision information for the document\\n   (boolean, allowed value: true)</li>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the document includes attachments, then the\\n returned structure will contain a summary of the\\n attachments associated with the document, but not the\\n attachment data itself.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>\\n cloudant:document($connection, \"db\", \"DocID\", {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned JSON object will contain the document\\n and has the following format:\\n <pre>\\n {\\n   \"_id\": \"DocID\",\\n   \"_rev\": \"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n   \"name\": \"Anna\",\\n   \"age\": 89,\\n   \"gender\": \"female\",\\n   \"_attachments\": {\\n     \"my attachment\": {\\n       \"content_type\": \"application/json; charset=UTF-8\",\\n       \"revpos\": 2,\\n       \"digest\": \"md5-37IZysiyWLRWx31J/1WQHw==\",\\n       \"length\": 12,\\n       \"stub\": true\\n       }\\n     }\\n   }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the returned object is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>attachments: document attachments (optional), each field denotes the name\\n       of a different attachment:\\n   <ul>\\n     <li>content_type: attachment MIME Content type string</li>\\n     <li>length: attachment length in bytes</li>\\n     <li>revpos: revision where this attachment exists</li>\\n     <li>digest: MD5 checksum of the attachment</li>\\n     <li>stub: indicates whether the attachment is a stub</li>\\n  </ul>\\n  </li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieving a design document from the specified database</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To retrieve a design document the document id must start with\\n <code>_design/</code>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document($connection, \"db\", \"_design/DesDocID\", {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A JSON object with the following format is returned:\\n <pre>\\n {\\n  \"_id\": \"_design/DesDocID\",\\n  \"_rev\": \"2-f29c836d0bedc4b4b95cfaa6d99e95df\",\\n   \"views\": {\\n     \"view1\": {\\n       \"map\":\"function(doc){emit(doc.field, 1)}\",\\n       \"reduce\": \"function(key, value, rereduce){return sum(values)}\"\\n     }\\n   },\\n   \"indexes\": {\\n     \"mysearch\" : {\\n       \"analyzer\": {\"name\": \"portuguese\", \"stopwords\":[\"foo\", \"bar, \"baz\"]},\\n       \"index\": \"function(doc){ ... }\"\\n     },\\n   }\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The meaning of the fields in the returned object is the following:\\n <ul>\\n   <li>_id: document ID</li>\\n   <li>_rev: document revision</li>\\n   <li>views: object defining the views. Each field defines a different view.\\n       The field name is the name of the view and has the following content:\\n     <ul>\\n       <li>map: view map function</li>\\n       <li>reduce: view reduce function (optional)</li>\\n     </ul>\\n   </li>\\n   <li>indexes: object defining the view indexes. Each field defines a different index.\\n       The field name is the name of the index and has the following content:\\n     <ul>\\n       <li>analyzer: Name of the analyzer to be used or an object with the\\n       following fields:\\n         <ul>\\n           <li>name: Name of the analyzer</li>\\n           <li>stopwords: An array of stop words. Stop words are words that\\n           should not be indexed.</li>\\n         </ul>\\n       </li>\\n       <li>index: Function that handles the indexing</li>\\n     </ul>\\n   </li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Getting a List of Revisions</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can obtain a list of the revisions for a given document\\n by the revs option.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document($connection, \"db\", \"DocID\", {\"revs\": true})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned JSON object includes the original document and\\n a <code>_revisions</code> structure that includes the revision\\n information:\\n <pre>\\n {\\n   \"servings\":4,\\n   \"subtitle\":\"Delicious with a green salad\",\\n   \"_id\":\"FishStew\",\\n   \"title\":\"Irish Fish Stew\",\\n   \"_revisions\":\\n   {\\n     \"ids\": [\\n       \"a1a9b39ee3cc39181b796a69cb48521c\",\\n       \"7c4740b4dcf26683e941d6641c00c39d\",\\n       \"9c65296036141e575d32ba9c034dd3ee\"\\n      ],\\n     \"start\":3\\n  },\\n  \"_rev\":\"3-a1a9b39ee3cc39181b796a69cb48521c\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The meaning of the additional fields is the following:\\n <ul>\\n   <li>_revisions: document revisions</li>\\n   <li>_ids: array of valid revision IDs, in reverse order (latest first)</li>\\n   <li>start: prefix number for the latest revision</li>\\n </ul>\\n </p>\\n <h4 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Obtaining an Extended Revision History</h4>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">You can get additional information about the revisions for a given document\\n with the <code>revs_info</code> option.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:document($connection, \"db\", \"DocID\", {\"revs_info\": true})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This returns extended revision information, including the availability and status\\n of each revision:\\n <pre>\\n {\\n   \"servings\":4,\\n   \"subtitle\":\"Delicious with a green salad\",\\n   \"_id\":\"FishStew\",\\n   \"_revs_info\":[\\n     {\\n       \"status\":\"available\",\\n       \"rev\":\"3-a1a9b39ee3cc39181b796a69cb48521c\"\\n     },\\n     {\\n       \"status\":\"available\",\\n       \"rev\":\"2-7c4740b4dcf26683e941d6641c00c39d\"\\n     },\\n     {\\n       \"status\":\"available\",\\n       \"rev\":\"1-9c65296036141e575d32ba9c034dd3ee\"\\n     }\\n   ],\\n   \"title\":\"Irish Fish Stew\",\\n   \"_rev\":\"3-a1a9b39ee3cc39181b796a69cb48521c\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The meaning of the additional fields is the following:\\n <ul>\\n   <li>_revs_info: document extended revision info</li>\\n   <li>rev: revision ID</li>\\n   <li>status: revision status</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Retrieves a document from the specified database \\n  This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"document-id\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A document identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The specified document\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DATABASE-NAME Invalid database name</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:DOCUMENT The specified document or revision cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-databases-nondeterministic\",qname:\"cloudant:list-databases-nondeterministic\",signature:\"($connection as anyURI) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an array containing the names of all the user\\'s databases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-databases-1\">list-databases#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns an array containing the names of all the user's databases.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'}],returns:{type:\"array()\",description:\"An array of all the database names\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-databases-nondeterministic\",qname:\"cloudant:list-databases-nondeterministic\",signature:\"($connection as anyURI, $options as object()) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an array containing the names of all the user\\'s databases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#list-databases-2\">list-databases#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Returns an array containing the names of all the user's databases.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"array()\",description:\"An array of all the databases names\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"list-databases\",qname:\"cloudant:list-databases\",signature:\"($connection as anyURI) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an array containing the names of all the user\\'s databases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:list-databases($connection)</pre>.\\n </p>\\n',summary:\"<p>  Returns an array containing the names of all the user's databases.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'}],returns:{type:\"array()\",description:\"An array of all the database names\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"list-databases\",qname:\"cloudant:list-databases\",signature:\"($connection as anyURI, $options as object()) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an array containing the names of all the user\\'s databases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>database-owner: specifies the database owner (string, default: connection user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:list-databases($connection, {\"database-owner\" : \"username\"})</pre>.\\n </p>\\n',summary:\"<p>  Returns an array containing the names of all the user's databases.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"array()\",description:\"An array of all the databases names\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"lucene-query-nondeterministic\",qname:\"cloudant:lucene-query-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $index as string, $query as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a Lucene query against a view and returns the query result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#lucene-query-5\">lucene-query#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Executes a Lucene query against a view and returns the query result.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"index\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An index name</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A Lucene query</div>'}],returns:{type:\"object()\",description:\"The Lucene query results\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"lucene-query-nondeterministic\",qname:\"cloudant:lucene-query-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $index as string, $query as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a Lucene query against a view and returns the query result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#lucene-query-6\">lucene-query#6</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Executes a Lucene query against a view and returns the query result.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"index\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An index name</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A Lucene query</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The Lucene query results\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"lucene-query\",qname:\"cloudant:lucene-query\",signature:\"($connection as anyURI, $database as string, $design-document as string, $index as string, $query as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a Lucene query against a view and returns the query result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This method searches for documents whose index fields match the Lucene query.\\n Which fields of a document are indexed and how is determined by the index functions\\n in the design document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:lucene-query($connection, \"db\", \"designdoc\", \"view\", \"a*\")</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\": 3,\\n   \"bookmark\": \"g1AAAACWeJzLYWBgYMpgTmFQSElKzi9KdUhJMtbLTS3KLElMT9VLzskvTUnMK9HLSy3JAalMcgCSSfX____PAvPdQHwQSGTIIt6UPBaQlgNA6j_CJPsPcJOyANNEKzY\",\\n   \"rows\":\\n   [\\n     {\\n       \"id\": \"dd828eb4-c3f1-470f-aeff-c375ef70e4ad\",\\n       \"order\": [0.0, 1],\\n       \"fields\":\\n       {\\n         \"default\": \"aa\",\\n         \"foo\": 0.0\\n       }\\n     },\\n     {\\n       \"id\": \"ea522cf1-eb8e-4477-aa92-d1fa459bb216\",\\n       \"order\": [1.0, 0],\\n       \"fields\":\\n       {\\n         \"default\": \"ab\",\\n         \"foo\": 1.0\\n       }\\n     },\\n     {\\n       \"id\": \"c838baed-d573-43ea-9c34-621cf0f13301\",\\n       \"order\": [2.0, 0],\\n       \"fields\":\\n       {\\n         \"default\": \"ac\",\\n         \"foo\": 2.0\\n       }\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>total_rows: number of results returned.</li>\\n  <li>bookmark: string to be submitted in the next query to page through results.\\n      If this response contained no results, the bookmark will be the same as the\\n      one used to obtain this response.</li>\\n  <li>rows: array of document objects, each document contains the following fields:\\n    <ul>\\n      <li>order: specifies the order with regard to the indexed fields.</li>\\n      <li>fields: Object containing other search indexes.</li>\\n    </ul>\\n  </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Executes a Lucene query against a view and returns the query result.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"index\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An index name</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A Lucene query</div>'}],returns:{type:\"object()\",description:\"The Lucene query results\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"lucene-query\",qname:\"cloudant:lucene-query\",signature:\"($connection as anyURI, $database as string, $design-document as string, $index as string, $query as string, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Executes a Lucene query against a view and returns the query result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This method searches for documents whose index fields match the Lucene query.\\n Which fields of a document are indexed and how is determined by the index functions\\n in the design document.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>bookmark: A bookmark that was received from a previous search. This\\n   allows you to page through the results. If there are no more results after\\n   the bookmark, you will get a response with an empty rows array and the\\n   same bookmark. That way you can determine that you have reached the end\\n   of the result list (string).</li>\\n   <li>stale: allow the results from a stale view to be used (string, allowed\\n   value: \"ok\").</li>\\n   <li>limit: limit the number of the returned documents to the specified\\n   number (numeric).</li>\\n   <li>include_docs: include the full content of the documents in the return\\n   (boolean, default: false).</li>\\n   <li>sort: specifies the sort order of the results. A JSON string of the\\n   form <code>\"fieldname&lt;type&gt;\"</code> or <code>-fieldname&lt;type&gt;</code>\\n   for descending order, where fieldname is the name of a string or number field\\n   and type is either number or string. The type part is optional and defaults\\n   to number. Some examples are <code>\"foo\"</code>, <code>\"-foo\"</code>,\\n   <code>\"bar&lt;string&gt;\"</code>, <code>\"-foo&lt;number&gt;\"</code>. String\\n   fields used for sorting must not be analyzed fields. The field(s) used for\\n   sorting must be indexed by the same indexer used for the search query.\\n   Alternatively, a JSON array of such strings is allowed.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:lucene-query($connection, \"db\", \"designdoc\", \"view\", \"a*\",\\n {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\": 3,\\n   \"bookmark\": \"g1AAAACWeJzLYWBgYMpgTmFQSElKzi9KdUhJMtbLTS3KLElMT9VLzskvTUnMK9HLSy3JAalMcgCSSfX____PAvPdQHwQSGTIIt6UPBaQlgNA6j_CJPsPcJOyANNEKzY\",\\n   \"rows\":\\n   [\\n     {\\n       \"id\": \"dd828eb4-c3f1-470f-aeff-c375ef70e4ad\",\\n       \"order\": [0.0, 1],\\n       \"fields\":\\n       {\\n         \"default\": \"aa\",\\n         \"foo\": 0.0\\n       }\\n     },\\n     {\\n       \"id\": \"ea522cf1-eb8e-4477-aa92-d1fa459bb216\",\\n       \"order\": [1.0, 0],\\n       \"fields\":\\n       {\\n         \"default\": \"ab\",\\n         \"foo\": 1.0\\n       }\\n     },\\n     {\\n       \"id\": \"c838baed-d573-43ea-9c34-621cf0f13301\",\\n       \"order\": [2.0, 0],\\n       \"fields\":\\n       {\\n         \"default\": \"ac\",\\n         \"foo\": 2.0\\n       }\\n     }\\n   ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>total_rows: number of results returned.</li>\\n  <li>bookmark: string to be submitted in the next query to page through results.\\n      If this response contained no results, the bookmark will be the same as the\\n      one used to obtain this response.</li>\\n  <li>rows: array of document objects, each document contains the following fields:\\n    <ul>\\n      <li>order: specifies the order with regard to the indexed fields.</li>\\n      <li>fields: Object containing other search indexes.</li>\\n    </ul>\\n  </li>\\n </ul>\\n </p>\\n',summary:\"<p>  Executes a Lucene query against a view and returns the query result.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"index\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An index name</div>'},{name:\"query\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A Lucene query</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"The Lucene query results\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"multiple-documents-nondeterministic\",qname:\"cloudant:multiple-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $keys as string*) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">List the specified documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#multiple-documents-3\">multiple-documents#3</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  List the specified documents in a given database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'}],returns:{type:\"object()\",description:\"An object listing the specified documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"multiple-documents-nondeterministic\",qname:\"cloudant:multiple-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $keys as string*, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the specified documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#multiple-documents-4\">multiple-documents#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the specified documents in a given database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing the specified documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"multiple-documents\",qname:\"cloudant:multiple-documents\",signature:\"($connection as anyURI, $database as string, $keys as string*) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">List the specified documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:multiple-documents($connection, \"db\",\\n   (\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n    \"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n    \"96f898f0-f6ff-4a9b-aac4-503992f31b01\"))</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\":3,\\n   \"offset\":0,\\n   \"rows\":[\\n   {\\n     \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"key\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n     }\\n   },\\n   {\\n     \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"key\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n      }\\n   },\\n   {\\n     \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"key\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n     }\\n   }]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  List the specified documents in a given database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'}],returns:{type:\"object()\",description:\"An object listing the specified documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"multiple-documents\",qname:\"cloudant:multiple-documents\",signature:\"($connection as anyURI, $database as string, $keys as string*, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the specified documents in a given database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>descending: return the documents in descending by key order (boolean,\\n   default: false).</li>\\n   <li>endkey: stop returning records when the specified key is reached (string).</li>\\n   <li>endkey_docid: stop returning records when the specified document ID is\\n   reached (string).</li>\\n   <li>group: group the results using the reduce function to a group or single\\n   row (boolean, default: false).</li>\\n   <li>group_level: specify the group level to be used (numeric).</li>\\n   <li>include_docs: include the full content of the documents in the return\\n   (boolean, default: false).</li>\\n   <li>inclusive_end: specifies whether the specified end key should be included\\n   in the result (boolean, default: true).</li>\\n   <li>key: return only documents that match the specified key (string).</li>\\n   <li>limit: limit the number of the returned documents to the specified number\\n   (numeric).</li>\\n   <li>reduce: use the reduction function (boolean, default: true).</li>\\n   <li>skip: skip this number of records before starting to return the results\\n   (numeric, default: 0).</li>\\n   <li>stale: allow the results from a stale view to be used (string, allowed\\n   value: \"ok\").</li>\\n   <li>startkey: start returning records when the specified key is reached\\n   (string).</li>\\n   <li>startkey_docid: start returning records when the specified document ID\\n   is reached (string).</li>\\n   <li>database-owner: specifies the database owner (string, default: connection\\n   user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:multiple-documents($connection, \"db\",\\n   (\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n    \"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n    \"96f898f0-f6ff-4a9b-aac4-503992f31b01\"),\\n   {\"database-owner\": \"username\"})</pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\":3,\\n   \"offset\":0,\\n   \"rows\":[\\n   {\\n     \"id\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"key\":\"5a049246-179f-42ad-87ac-8f080426c17c\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-9d5401898196997853b5ac4163857a29\"\\n     }\\n   },\\n   {\\n     \"id\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"key\":\"96f898f0-f6ff-4a9b-aac4-503992f31b01\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-ff7b85665c4c297838963c80ecf481a3\"\\n      }\\n   },\\n   {\\n     \"id\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"key\":\"d1f61e66-7708-4da6-aa05-7cbc33b44b7e\",\\n     \"value\":\\n     {\\n       \"rev\":\"2-cbdef49ef3ddc127eff86350844a6108\"\\n     }\\n   }]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the specified documents in a given database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing the specified documents in the specified database\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"multiple-view-documents-nondeterministic\",qname:\"cloudant:multiple-view-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $keys as string*) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">List the specified documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#multiple-view-documents-5\">multiple-view-documents#5</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  List the specified documents in a given view.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'}],returns:{type:\"object()\",description:\"An object listing all the specified documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"multiple-view-documents-nondeterministic\",qname:\"cloudant:multiple-view-documents-nondeterministic\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $keys as string*, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the specified documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#multiple-view-documents-6\">multiple-view-documents#6</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p>  Lists the specified documents in a given view.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing all the specified documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']},{isDocumented:!0,arity:5,name:\"multiple-view-documents\",qname:\"cloudant:multiple-view-documents\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $keys as string*) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">List the specified documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:multiple-view-documents($connection, \"db\", \"recipes\", \"by_ingredient\",\\n (\"claret\", \"clear apple juice\"))\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\" : 26484,\\n   \"rows\" : [\\n     {\\n       \"value\" : [\"Scotch collops\"]],\\n       \"id\" : \"Scotchcollops\",\\n       \"key\" : \"claret\"\\n     },\\n     {\\n       \"value\" : [\"Stand pie\"],\\n       \"id\" : \"Standpie\",\\n       \"key\" : \"clear apple juice\"\\n     }\\n   ],\\n   \"offset\" : 6324\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision\\n  number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  List the specified documents in a given view.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'}],returns:{type:\"object()\",description:\"An object listing all the specified documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"multiple-view-documents\",qname:\"cloudant:multiple-view-documents\",signature:\"($connection as anyURI, $database as string, $design-document as string, $view as string, $keys as string*, $options as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Lists the specified documents in a given view.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The information is returned as a JSON structure containing meta information\\n about the return structure, and the list of documents each with its ID, revision\\n and key. The key is generated from the document ID.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function allows to specify an additional options object.\\n The following options are supported:\\n <ul>\\n   <li>descending: return the documents in descending by key order (boolean,\\n   default: false).</li>\\n   <li>endkey: stop returning records when the specified key is reached (string).</li>\\n   <li>endkey_docid: stop returning records when the specified document ID is\\n   reached (string).</li>\\n   <li>group: group the results using the reduce function to a group or single\\n   row (boolean, default: false).</li>\\n   <li>group_level: specify the group level to be used (numeric).</li>\\n   <li>include_docs: include the full content of the documents in the return\\n   (boolean, default: false).</li>\\n   <li>inclusive_end: specifies whether the specified end key should be included\\n   in the result (boolean, default: true).</li>\\n   <li>key: return only documents that match the specified key (string).</li>\\n   <li>limit: limit the number of the returned documents to the specified number\\n   (numeric).</li>\\n   <li>reduce: use the reduction function (boolean, default: true).</li>\\n   <li>skip: skip this number of records before starting to return the results\\n   (numeric, default: 0).</li>\\n   <li>stale: allow the results from a stale view to be used (string, allowed\\n   value: \"ok\").</li>\\n   <li>startkey: start returning records when the specified key is reached\\n   (string).</li>\\n   <li>startkey_docid: start returning records when the specified document ID\\n   is reached (string).</li>\\n   <li>database-owner: specifies the database owner (string, default: connection\\n   user).</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <pre>cloudant:multiple-view-documents($connection, \"db\", \"recipes\",\\n   \"by_ingredient\", (\"claret\", \"clear apple juice\"),\\n   {\"database-owner\": \"username\"})\\n </pre>.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">An object with the following format is returned:\\n <pre>\\n {\\n   \"total_rows\" : 26484,\\n   \"rows\" : [\\n     {\\n       \"value\" : [\"Scotch collops\"]],\\n       \"id\" : \"Scotchcollops\",\\n       \"key\" : \"claret\"\\n     },\\n     {\\n       \"value\" : [\"Stand pie\"],\\n       \"id\" : \"Standpie\",\\n       \"key\" : \"clear apple juice\"\\n     }\\n   ],\\n   \"offset\" : 6324\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The fields have the following meaning:\\n <ul>\\n  <li>offset: offset where the document list started.</li>\\n  <li>rows: array of document objects, each containing id, key and revision number.</li>\\n  <li>total_rows: number of documents in the database.</li>\\n  <li>update_seq: current update sequence database.</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Lists the specified documents in a given view.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A connection identifier</div>'},{name:\"database\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A database name</div>'},{name:\"design-document\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A design document name</div>'},{name:\"view\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A view name</div>'},{name:\"keys\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The keys of the documents which must be retrieved</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An object specifying additional request options</div>'}],returns:{type:\"object()\",description:\"An object listing all the specified documents in the specified view\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:AUTHORIZATION Authorization error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:HTTP An HTTP error occurred when issuing the request</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:RESPONSE An error occurred parsing the server response</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:CONNECTION The specified connection does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:INTERNAL Cloudant internal error</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">cloudant:OPTIONS Malformed options object</xqdoc:error>']}],variables:[]},\"http://api.28.io/exportimport\":{ns:\"http://api.28.io/exportimport\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/collections\",prefix:\"cm\"},{uri:\"http://api.28.io/exportimport\",prefix:\"exportimport\"},{uri:\"http://zorba.io/modules/fetch\",prefix:\"fetch\"},{uri:\"http://api.28.io/indices\",prefix:\"in\"},{uri:\"http://www.28msec.com/modules/maps\",prefix:\"map\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://www.28msec.com/modules/store\",prefix:\"store\"},{uri:\"http://api.28.io/validation\",prefix:\"validate\"}],functions:[{isDocumented:!1,arity:1,name:\"create-map\",qname:\"exportimport:create-map\",signature:\"($map as object())\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"export\",qname:\"exportimport:export\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"import\",qname:\"exportimport:import\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"import\",qname:\"exportimport:import\",signature:\"($import as object(), $overwrite as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"import\",type:\"object()\",occurrence:null,description:\"\"},{name:\"overwrite\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"is-system-collection\",qname:\"exportimport:is-system-collection\",signature:\"($name as xs:string) as xs:boolean\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"validate-map\",qname:\"exportimport:validate-map\",signature:\"($map as object()) as empty-sequence()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"map\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:\"empty-sequence()\",description:\"\"},errors:[]}],variables:[]},\"http://jsoniq.org/errors\":{ns:\"http://jsoniq.org/errors\",description:\" This module contains one variable declaration for each diagnostic of the\\n http://jsoniq.org/errors namespace.\\n The variables serves as documentation for the errors but can also\\n be used in the code. For example, one useful scenario is to compare\\n an error caught in the catch clause of a try-catch expression with one of\\n the variables.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Carlos Lopez</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://jsoniq.org/errors\",prefix:\"jerr\"}],functions:[],variables:[{name:\"jerr:JNSE0013\",type:\"xs:QName\",description:\"It is a dynamic error to serialize an atomic value not\\n supported by JSON or a node with the JSON output method and with\\n the jsoniq-serialization-extensions serialization parameter\\n set to false.\\n\"},{name:\"jerr:JNDY0021\",type:\"xs:QName\",description:\"parser error raised by jn:parse-json\\n\"},{name:\"jerr:JNTY0021\",type:\"xs:QName\",description:\"array or object selector on heterogeneous sequence\\n\"},{name:\"jerr:JNTY0020\",type:\"xs:QName\",description:\"parser error for invalid option type\\n\"},{name:\"jerr:JNTY0024\",type:\"xs:QName\",description:\"objects or arrays don't have a string value\\n\"},{name:\"jerr:JNTY0023\",type:\"xs:QName\",description:\"It is a type error if the prefix is not a string or if the\\n serialization parameters are not an element.\\n\"},{name:\"jerr:JNUP0019\",type:\"xs:QName\",description:\"It is a dynamic error if the content expression, in an object insert expression, does not evaluate to a sequence of objects.\\n\"},{name:\"jerr:JNTY0018\",type:\"xs:QName\",description:\"It is a dynamic error if there is not exactly one supplied parameter for an object or array selector.\\n\"},{name:\"jerr:JNUP0017\",type:\"xs:QName\",description:\" It is a dynamic error if the value in a replace expression is not exactly a single item.\\n\"},{name:\"jerr:JNUP0016\",type:\"xs:QName\",description:\"It is a dynamic error if it is attempted to create a replace, delete or rename update primitive with a selector that cannot be resolved against the target array or object.\\n\"},{name:\"jerr:JNSE0022\",type:\"xs:QName\",description:\"It is a dynamic error to serialize a sequence that does\\n not exist of exactly one document node with XML, HTML, XHTML, Text.\\n\"},{name:\"jerr:JNSE0014\",type:\"xs:QName\",description:\"It is a dynamic error to serialize a function or a node with the\\n JSON output method.\\n\"},{name:\"jerr:NS\",type:\"item()*\",description:\"\"},{name:\"jerr:JNSE0012\",type:\"xs:QName\",description:\"It is a dynamic error to serialize a sequence of less\\n or more than one item with the JSON output method if the\\n jsoniq-serialization-multiple-items is set to no.\\n\"},{name:\"jerr:JNTY0011\",type:\"xs:QName\",description:\"It is a type error if the content sequence in a node constructor or in an XQUF insert or replace update expression contains an object or an array.\\n\"},{name:\"jerr:JNUP0010\",type:\"xs:QName\",description:\"It is a dynamic error if a pending update list contains two renaming update primitives on the same object and with the same selector.\\n\"},{name:\"jerr:JNUP0009\",type:\"xs:QName\",description:\"It is a dynamic error if a pending update list contains two replacing update primitives on the same object or array, and with the same selector.\\n\"},{name:\"jerr:JNUP0008\",type:\"xs:QName\",description:\"It is a dynamic error if the target of a deleting or replacing expression is not an array or an object.\\n It is a dynamic error if the target of a renaming expression is not an object.\\n It is a dynamic error if the target of an appending expression is not an array.\\n It is a dynamic error if the target of a position-inserting expression is not an array.\\n It is a dynamic error if the target of a non-position-inserting expression is not an object.\\n\"},{name:\"jerr:JNUP0007\",type:\"xs:QName\",description:\"It is a type error if, in an updating expression, an array selector cannot be cast to xs:integer or if an object selector cannot be cast to xs:string.\\n\"},{name:\"jerr:JNUP0006\",type:\"xs:QName\",description:\"It is a dynamic error if upd:applyUpdates causes an object to contain two pairs with the same name.\\n\"},{name:\"jerr:JNUP0005\",type:\"xs:QName\",description:\"It is a dynamic error if a pending update list contains two inserting update primitives on the same object and pair name.\\n\"},{name:\"jerr:JNTY0004\",type:\"xs:QName\",description:\"It is a type error to call fn:data on a sequence containing an array or an object.\\n\"},{name:\"jerr:JNDY0003\",type:\"xs:QName\",description:\"It is a dynamic error if two pairs in an object constructor or in a simple object union have the same name.\\n\"},{name:\"jerr:JNTY0002\",type:\"xs:QName\",description:\"It is a type error if the right-hand-side expression of a pair constructor does not return exactly one item.\\n\"}]},\"http://zorba.io/modules/sctx\":{ns:\"http://zorba.io/modules/sctx\",description:\" This module provides functions that gets components of the static context.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.w3.org/TR/xquery/#id-xq-static-context-components</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/sctx\",prefix:\"sctx\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"base-uri\",qname:\"sctx:base-uri\",signature:\"() as xs:string? external\",description:\" Gets the base URI.\\n\",summary:\"<p> Gets the base URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string?\",description:\"The base URI.\"},errors:[]},{isDocumented:!0,arity:0,name:\"boundary-space-policy\",qname:\"sctx:boundary-space-policy\",signature:\"() as xs:string external\",description:\" Gets the boundary whitespace policy used by direct element constructors.\\n\",summary:\"<p> Gets the boundary whitespace policy used by direct element constructors.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:'Either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">preserve</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">strip</code>.'},errors:[]},{isDocumented:!0,arity:0,name:\"construction-mode\",qname:\"sctx:construction-mode\",signature:\"() as xs:string external\",description:\" Gets the static context construction mode of element and document nodes.\\n\",summary:\"<p> Gets the static context construction mode of element and document nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:'Either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">preserve</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">strip</code>.'},errors:[]},{isDocumented:!0,arity:0,name:\"copy-namespaces-mode\",qname:\"sctx:copy-namespaces-mode\",signature:\"() as xs:string+ external\",description:\" Gets the static context components that control the the namespace bindings\\n that are assigned when an existing element node is copied\\n by an element constructor.\\n\",summary:\"<p> Gets the static context components that control the the namespace bindings\\n that are assigned when an existing element node is copied\\n by an element constructor.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string+\",description:'A sequence of two strings: the first is either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">preserve</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">no-preserve</code> and the second is either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">inherit</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">no-inherit</code>.'},errors:[]},{isDocumented:!0,arity:0,name:\"default-collation\",qname:\"sctx:default-collation\",signature:\"() as xs:string external\",description:' Gets one of statically known collations used by functions and operators\\n for comparing and ordering values of type <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xs:string</code>\\n or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xs:anyURI</code> when no explicit collation is specified.\\n',summary:\"<p> Gets one of statically known collations used by functions and operators\\n for comparing and ordering values of type  xs:string \\n or  xs:anyURI  when no explicit collation is specified.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The collations that is used by default.\"},errors:[]},{isDocumented:!0,arity:0,name:\"default-collection-type\",qname:\"sctx:default-collection-type\",signature:\"() as xs:string external\",description:' Gets the statically known default collection type.\\n This is the type of the sequence of nodes that would result from calling the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">fn:collection</code> function with no arguments.\\n',summary:\"<p> Gets the statically known default collection type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The type of the default collection.\"},errors:[]},{isDocumented:!0,arity:0,name:\"default-function-namespace\",qname:\"sctx:default-function-namespace\",signature:\"() as xs:string external\",description:\" Gets the URI of the default function namespace.\\n\",summary:\"<p> Gets the URI of the default function namespace.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The URI of the of the default function namespace.\"},errors:[]},{isDocumented:!0,arity:0,name:\"default-order\",qname:\"sctx:default-order\",signature:\"() as xs:string external\",description:' Gets the component that controls the processing of empty sequences and NaN\\n values as ordering keys in an <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">order by</code> clause\\n in a FLWOR expression.\\n',summary:\"<p> Gets the component that controls the processing of empty sequences and NaN\\n values as ordering keys in an  order by  clause\\n in a FLWOR expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:'Either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">greatest</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">least</code>.'},errors:[]},{isDocumented:!0,arity:2,name:\"function-annotations\",qname:\"sctx:function-annotations\",signature:\"($name as xs:QName, $arity as xs:integer) as xs:QName* external\",description:\" Gets the list of annotations declared for the given function.\\n\",summary:\"<p> Gets the list of annotations declared for the given function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the function.</div>'},{name:\"arity\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of arguments the function takes.</div>'}],returns:{type:\"xs:QName*\",description:\"the list of annotations\"},errors:[]},{isDocumented:!0,arity:1,name:\"function-arguments-count\",qname:\"sctx:function-arguments-count\",signature:\"($function as xs:QName) as xs:int* external\",description:\" Gets the number of arguments the given XQuery function takes.\\n\",summary:\"<p> Gets the number of arguments the given XQuery function takes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"function\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A QName identifying a function.</div>'}],returns:{type:\"xs:int*\",description:\"Either a sequence of zero or more integers (one for each overloaded version of the given function) or an empty sequence if the function is not defined.\"},errors:[]},{isDocumented:!0,arity:0,name:\"function-names\",qname:\"sctx:function-names\",signature:\"() as xs:QName* external\",description:\" Gets a sequence containing the QNames of all defined functions\\n that are available to be called from within an expression.\\n\",summary:\"<p> Gets a sequence containing the QNames of all defined functions\\n that are available to be called from within an expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence for QNames identifying all functions.\"},errors:[]},{isDocumented:!0,arity:0,name:\"functions\",qname:\"sctx:functions\",signature:\"() as object()* external\",description:\" Gets a sequence of JSON objects containing the name, arity, and annotations\\n of all defined functions that are available to be called form within an\\n expression.\\n\",summary:\"<p> Gets a sequence of JSON objects containing the name, arity, and annotations\\n of all defined functions that are available to be called form within an\\n expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"A sequence of objects.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-attribute-declarations\",qname:\"sctx:in-scope-attribute-declarations\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying declared attributes\\n in the imported schemas.\\n\",summary:\"<p> Gets a sequence of QNames identifying declared attributes\\n in the imported schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each attribute.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-attribute-groups\",qname:\"sctx:in-scope-attribute-groups\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying declared in-scope\\n schema attribute groups.\\n\",summary:\"<p> Gets a sequence of QNames identifying declared in-scope\\n schema attribute groups.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each attribute group.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-element-declarations\",qname:\"sctx:in-scope-element-declarations\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying declared elements\\n in the imported schemas.\\n\",summary:\"<p> Gets a sequence of QNames identifying declared elements\\n in the imported schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each declared element.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-element-groups\",qname:\"sctx:in-scope-element-groups\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying declared in-scope\\n schema element groups.\\n\",summary:\"<p> Gets a sequence of QNames identifying declared in-scope\\n schema element groups.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each element group.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-schema-types\",qname:\"sctx:in-scope-schema-types\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying in-scope schema types\\n including all the predefined schema types and all definitions\\n found in imported schemas.\\n\",summary:\"<p> Gets a sequence of QNames identifying in-scope schema types\\n including all the predefined schema types and all definitions\\n found in imported schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each defined type.\"},errors:[]},{isDocumented:!0,arity:0,name:\"in-scope-variables\",qname:\"sctx:in-scope-variables\",signature:\"() as xs:QName* external\",description:\" Gets a sequence of QNames identifying declared variables\\n from the static context.\\n\",summary:\"<p> Gets a sequence of QNames identifying declared variables\\n from the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each variable.\"},errors:[]},{isDocumented:!0,arity:1,name:\"option\",qname:\"sctx:option\",signature:\"($name as xs:QName) as xs:string? external\",description:\" Gets the value of an option that is declared in the prolog of the module.\\n\",summary:\"<p> Gets the value of an option that is declared in the prolog of the module.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the option value to retrieve</div>'}],returns:{type:\"xs:string?\",description:\"the value of the option if contained in the static context or the empty sequence otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"ordering-mode\",qname:\"sctx:ordering-mode\",signature:\"() as xs:string external\",description:\" Gets the ordering mode that affects the ordering of the result sequences\\n returned by certain expressions.\\n\",summary:\"<p> Gets the ordering mode that affects the ordering of the result sequences\\n returned by certain expressions.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:'Either <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ordered</code> or <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">unordered</code>.'},errors:[]},{isDocumented:!0,arity:0,name:\"statically-known-collations\",qname:\"sctx:statically-known-collations\",signature:\"() as xs:anyURI* external\",description:\" Gets a sequence that contains the statically known collations.\\n\",summary:\"<p> Gets a sequence that contains the statically known collations.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI*\",description:\"The sequence of collations.\"},errors:[]},{isDocumented:!0,arity:1,name:\"statically-known-document-type\",qname:\"sctx:statically-known-document-type\",signature:\"($document as xs:string) as xs:QName external\",description:\" For the given document, returns the static type of its root node.\\n\",summary:\"<p> For the given document, returns the static type of its root node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"document\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A URI of a document.</div>'}],returns:{type:\"xs:QName\",description:\"The static type of the given document.\"},errors:[]},{isDocumented:!0,arity:0,name:\"statically-known-documents\",qname:\"sctx:statically-known-documents\",signature:\"() as xs:anyURI* external\",description:\" Gets a sequence that contains the URIs of all statically known documents.\\n\",summary:\"<p> Gets a sequence that contains the URIs of all statically known documents.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:anyURI*\",description:\"The sequence of document URIs.\"},errors:[]},{isDocumented:!0,arity:1,name:\"statically-known-namespace-binding\",qname:\"sctx:statically-known-namespace-binding\",signature:\"($prefix as xs:string) as xs:string? external\",description:\" Gets the bound URI for the given prefix.\\n\",summary:\"<p> Gets the bound URI for the given prefix.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prefix\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The prefix of the known namespace for which the bound URI is being requested.</div>'}],returns:{type:\"xs:string?\",description:\"The URI bound to the prefix is returned, or an empty sequence if the prefix is not known.\"},errors:[]},{isDocumented:!0,arity:0,name:\"statically-known-namespaces\",qname:\"sctx:statically-known-namespaces\",signature:\"() as xs:string* external\",description:\" Gets a list of known statically known namespaces as prefixes\\n (fn, xml, xs, xsi, etc).\\n\",summary:\"<p> Gets a list of known statically known namespaces as prefixes\\n (fn, xml, xs, xsi, etc).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"A sequence of xs:strings, one for each known namespace prefix.\"},errors:[]},{isDocumented:!0,arity:0,name:\"xpath10-compatibility-mode\",qname:\"sctx:xpath10-compatibility-mode\",signature:\"() as xs:boolean external\",description:\" Gets true or false depending on whether rules for compatibility\\n with XPath 1.0 are in effect.\\n XQuery set the value of this component to false.\\n\",summary:\"<p> Gets true or false depending on whether rules for compatibility\\n with XPath 1.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:'The function should return <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">false</code>.'},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/profiles/sec/import\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/import\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying XBRL Infosets of financial reports submitted to the SEC.\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/import\",prefix:\"imp\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"m\"},{uri:\"http://zorba.io/modules/string\",prefix:\"string\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"disclosure-for-network-label\",qname:\"imp:disclosure-for-network-label\",signature:\"($component as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n Compute the disclore for a component\\'s network label.\\n </p>\\n',summary:\"<p>  \\n Compute the disclore for a component's network label.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"component\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the component</div>'}],returns:{type:\"object()\",description:\"returns the given component ammended with the disclosure\"},errors:[]}],variables:[{name:\"imp:disclosure-matching\",type:\"object()\",description:\" Declarative description of the disclosure matching heuristics.\\n\"}]},\"http://xbrl.io/modules/bizql/profiles/sec/core\":{ns:\"http://xbrl.io/modules/bizql/profiles/sec/core\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for querying XBRL Models of financial reports submitted to the SEC.\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"standard_options\">Standard <code>$options</code> Parameter</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Most functions in the BizQL package allow an additional <code>$options</code>\\n    parameter. The options parameter is a JSON object which is defined in the documentation\\n    of the <a href=\"../../facts#standard_options\">facts module</a>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition to the option fields defined in the\\n    <a href=\"../../facts#standard_options\">facts module</a> the following\\n    fields can be used in the options of a function in the SEC profile:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n <li><b>HideAmendedFacts</b>: if set to true (default behavior) all facts that have been\\n     amended are not included in the result.</li>\\n <li><b>IncludeImpliedTable</b>: set to true in order to output the implied table if\\n     there is no Table (default is false).</li>\\n </ul>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/concept-maps\",prefix:\"concept-maps\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/hypercubes\",prefix:\"hypercubes\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"m\"},{uri:\"http://xbrl.io/modules/bizql/report-schemas\",prefix:\"report-schemas\"},{uri:\"http://xbrl.io/modules/bizql/profiles/sec/core\",prefix:\"sec\"},{uri:\"http://zorba.io/modules/string\",prefix:\"string\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"edgar-facts-for-archives\",qname:\"sec:edgar-facts-for-archives\",signature:\"($archive_or_ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts for concepts that are defined by one of the common\\n edgar taxonomies. In particular, this function returns facts for concepts\\n having one of the following prefixes:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>xbrli</li>\\n   <li>link</li>\\n   <li>xl</li>\\n   <li>xlink</li>\\n   <li>xbrldt</li>\\n   <li>xbrldi</li>\\n   <li>nonnum</li>\\n   <li>num</li>\\n   <li>ref</li>\\n   <li>us-gaap</li>\\n   <li>dei</li>\\n   <li>us-types</li>\\n   <li>invest</li>\\n   <li>country</li>\\n   <li>currency</li>\\n   <li>exch</li>\\n   <li>naics</li>\\n   <li>sic</li>\\n   <li>stpr</li>\\n   <li>rr</li>\\n   <li>rr-ent</li>\\n   <li>rr-cal</li>\\n   <li>rr-def</li>\\n   <li>rr-pre</li>\\n </ul>\\n',summary:\"<p>  Return all facts for concepts that are defined by one of the common\\n edgar taxonomies.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive_or_ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive or archive IDs to filter.</div>'}],returns:{type:\"object()*\",description:\"all facts having one of the above prefixes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"end-date\",qname:\"sec:end-date\",signature:\"($filing-fact-or-id as item()?) as xs:date?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the document end date of a filing or a fact.</p>\\n',summary:\"<p>  Retrieves the document end date of a filing or a fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"filing-fact-or-id\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a filing, a fact, or its id.</div>'}],returns:{type:\"xs:date?\",description:'the document end date (e.g., xs:date(\"2011-04-30\")).'},errors:[]},{isDocumented:!0,arity:1,name:\"extension-facts-for-archives\",qname:\"sec:extension-facts-for-archives\",signature:\"($archive_or_ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all facts for concepts that are NOT defined by one of the common\\n edgar taxonomies. In particular, this function returns facts for concepts\\n having none of the prefixes listed under function\\n sec:edgar-facts-for-archives.</p>\\n',summary:\"<p>  Return all facts for concepts that are NOT defined by one of the common\\n edgar taxonomies.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive_or_ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archive or archive IDs to filter.</div>'}],returns:{type:\"object()*\",description:\"all facts having none of the common edgar prefixes.\"},errors:[]},{isDocumented:!0,arity:2,name:\"fact-table-for-schema\",qname:\"sec:fact-table-for-schema\",signature:\"($schema as item(), $archives as item()*) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema or its RID.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $sec:ALL_OF_THEM for no filtering.</div>'}],returns:{type:\"array()\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-archives-and-concepts\",qname:\"sec:facts-for-archives-and-concepts\",signature:\"($archive_or_ids as item()*, $concepts as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the facts associated with the supplied concepts\\n from the supplied archive, that match the fiscal focus of the archive.</p>\\n',summary:\"<p>  Retrieves the facts associated with the supplied concepts\\n from the supplied archive, that match the fiscal focus of the archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive_or_ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their ids or $sec:ALL_OF_THEM for no filtering.</div>'},{name:\"concepts\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts or $sec:ALL_OF_THEM for no filtering.</div>'}],returns:{type:\"object()*\",description:\"the latest facts associated with the supplied concept.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts-for-archives-and-concepts\",qname:\"sec:facts-for-archives-and-concepts\",signature:\"($archive_or_ids as item()*, $concepts as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves the facts associated with the supplied concepts\\n from the supplied archive, that match the fiscal focus of the archive.</p>\\n',summary:\"<p>  Retrieves the facts associated with the supplied concepts\\n from the supplied archive, that match the fiscal focus of the archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive_or_ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their ids or $sec:ALL_OF_THEM for no filtering.</div>'},{name:\"concepts\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the concepts or $sec:ALL_OF_THEM for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"the latest facts associated with the supplied concept.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-schema\",qname:\"sec:facts-for-schema\",signature:\"($schema as item(), $archives as item()*) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema and to the fiscal focus, and populates\\n them with the default dimension values when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema and to the fiscal focus, and populates\\n them with the default dimension values when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a schema.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $sec:ALL_OF_THEM for no filtering.</div>'}],returns:{type:\"item()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:1,name:\"hide-amended-facts\",qname:\"sec:hide-amended-facts\",signature:\"($facts as object()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Filters a list of facts and returns only the latest amending facts.\\n    Accordingly, all amended facts are filtered out.</p>\\n',summary:\"<p>  Filters a list of facts and returns only the latest amending facts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"facts\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a list of facts.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts without amended facts.\"},errors:[]},{isDocumented:!0,arity:2,name:\"populate-schema-with-facts\",qname:\"sec:populate-schema-with-facts\",signature:\"($schema as item(), $archives as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema or its RID.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"populate-schema-with-facts\",qname:\"sec:populate-schema-with-facts\",signature:\"($schema as item(), $archives as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema or its RID.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $sec:ALL_OF_THEM for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"#standard_options\">standard SEC BizQL options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]}],variables:[{name:\"sec:CIK\",type:\"xs:string\",description:\" Scheme for the SEC entity identifiers (i.e. http://www.sec.gov/CIK)\\n\"},{name:\"sec:ALL_OF_THEM\",type:\"boolean\",description:\" Joker value for all archives or all concepts.\\n\"},{name:\"sec:EDGAR_PREFIXES\",type:\"item()*\",description:\" All prefixes pre-declared in SEC's EDGAR.\\n\"}]},\"http://zorba.io/modules/excel/logical\":{ns:\"http://zorba.io/modules/excel/logical\",description:\" This is a library module offering the same set of functions\\n defined by Microsoft Excel, under Logical Functions.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://office.microsoft.com/en-us/excel/CH062528271033.aspx\" target=\"_blank\">Excel Documentation: Logical Functions</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/excel/errors\",prefix:\"excel-err\"},{uri:\"http://zorba.io/modules/excel/logical\",prefix:\"excel-logical\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"and\",qname:\"excel-logical:and\",signature:\"($values as xs:anyAtomicType*) as xs:boolean\",description:\" Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.\\n\",summary:\"<p> Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of arguments.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value provided sequence is empty.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"and\",qname:\"excel-logical:and\",signature:\"($arg1 as xs:anyAtomicType, $arg2 as xs:anyAtomicType) as xs:boolean\",description:\" Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.\\n\",summary:\"<p> Returns TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first argument.</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second argument.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if all its arguments are TRUE; FALSE if one or more arguments are FALSE.\"},errors:[]},{isDocumented:!0,arity:3,name:\"if\",qname:\"excel-logical:if\",signature:\"($logical_test as xs:boolean, $value_if_true as item()*, $value_if_false as item()*) as item()*\",description:\" Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.\\n\",summary:\"<p> Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"logical_test\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> is any value or expression that can be evaluated to TRUE or FALSE.</div>'},{name:\"value_if_true\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value that is returned if logical_test is TRUE.</div>'},{name:\"value_if_false\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value that is returned if logical_test is FALSE.</div>'}],returns:{type:\"item()*\",description:\"One value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.\"},errors:[]},{isDocumented:!0,arity:1,name:\"or\",qname:\"excel-logical:or\",signature:\"($values as xs:anyAtomicType*) as xs:boolean\",description:\" Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE.\\n\",summary:\"<p> Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of arguments.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if any argument is TRUE; FALSE if all arguments are FALSE.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">excel-err:Value provided sequence is empty.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"or\",qname:\"excel-logical:or\",signature:\"($arg1 as xs:anyAtomicType, $arg2 as xs:anyAtomicType) as xs:boolean\",description:\" Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE.\\n\",summary:\"<p> Returns TRUE if any argument is TRUE; FALSE if all arguments are FALSE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first argument.</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second argument.</div>'}],returns:{type:\"xs:boolean\",description:\"TRUE if any argument is TRUE; FALSE if all arguments are FALSE.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/sequence\":{ns:\"http://www.28msec.com/modules/sequence\",description:\" The sequence module allows you to generate consecutive\\n application-unique xs:integer ids. This is required e.g. in accounting\\n applications as some legislations require consecutive invoice numbers.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/store/static/collections/dml\",prefix:\"cdml\"},{uri:\"http://zorba.io/modules/store/static/indexes/dml\",prefix:\"idml\"},{uri:\"http://www.28msec.com/modules/lock\",prefix:\"lock\"},{uri:\"http://www.28msec.com/modules/sequence\",prefix:\"seq\"},{uri:\"http://www.28msec.com/modules/sleep\",prefix:\"sleep\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"id\",qname:\"seq:id\",signature:\"($uri as xs:string) as xs:integer\",description:' Returns a unique (sequentially incremented) id for the\\n uri specified as parameter.\\n Here the function is used to create consecutive invoice numbers:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n if (order:fulfilled($order-id))\\n then\\n   {\\n     variable $invoice-id := seq:id(\"invoice\");\\n     invoice:create($invoice-id, $order-id);\\n   }\\n else\\n   ...\\n </pre>\\n',summary:\"<p> Returns a unique (sequentially incremented) id for the\\n uri specified as parameter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the sequence counter as uri.</div>'}],returns:{type:\"xs:integer\",description:\"A sequentially incremented id.\"},errors:[]},{isDocumented:!0,arity:1,name:\"reset\",qname:\"seq:reset\",signature:\"($uri as xs:string) as empty-sequence()\",description:\" Resets the unique (sequentially incremented) id generation\\n for the uri specified as parameter.\\n\",summary:\"<p> Resets the unique (sequentially incremented) id generation\\n for the uri specified as parameter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the sequence counter as uri.</div>'}],returns:{type:\"empty-sequence()\",description:\"empty-sequence()\"},errors:[]},{isDocumented:!0,arity:1,name:\"value\",qname:\"seq:value\",signature:\"($uri as xs:string) as xs:integer\",description:\" Returns the id for the uri specified as parameter without incrementing it.\\n\",summary:\"<p> Returns the id for the uri specified as parameter without incrementing it.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the sequence counter as uri.</div>'}],returns:{type:\"xs:integer\",description:\"The current value\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">seq:not-found if no counter with the given $uri was found</xqdoc:error>']}],variables:[{name:\"seq:counters\",type:\"item()*\",description:\" The QName for the counters collection.\\n\"},{name:\"seq:counters-by-uri\",type:\"item()*\",description:\" The QName for the counters-by-uri collection.\\n\"}]},\"http://api.28.io/databrowser\":{ns:\"http://api.28.io/databrowser\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/databrowser\",prefix:\"api\"},{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/modules/store/static/collections/dml\",prefix:\"dml\"},{uri:\"http://www.zorba-xquery.com/extensions\",prefix:\"ext\"},{uri:\"http://www.functx.com\",prefix:\"functx\"},{uri:\"http://expath.org/ns/http-client\",prefix:\"http\"},{uri:\"http://www.zorba-xquery.com/modules/http-client\",prefix:\"http-client\"},{uri:\"http://zorba.io/modules/xml-options\",prefix:\"opt\"},{uri:\"http://www.28msec.com/modules/project\",prefix:\"project\"},{uri:\"http://zorba.io/modules/reflection\",prefix:\"r\"},{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"res\"},{uri:\"http://zorba.io/modules/xml\",prefix:\"xmlmod\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!1,arity:1,name:\"collection\",qname:\"api:collection\",signature:\"($name as xs:string)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"delete\",qname:\"api:delete\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"dispatch\",qname:\"api:dispatch\",signature:\"()\",description:\" Data Browser API dispatched.\\n Handles API authorization to the portal and dispatching.\\n\",summary:\"<p> Data Browser API dispatched.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"edit\",qname:\"api:edit\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"options\",qname:\"api:options\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"run\",qname:\"api:run\",signature:\"($sequential as xs:boolean) as object()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"sequential\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"serialize\",qname:\"api:serialize\",signature:\"($items as item()*) as object()\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()\",description:\"\"},errors:[]},{isDocumented:!1,arity:0,name:\"upload\",qname:\"api:upload\",signature:\"()\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/footnotes\":{ns:\"http://xbrl.io/modules/bizql/footnotes\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for retrieving XBRL footnotes\\n (see section 4.11 Footnotes of the XBRL 2.1 specification).</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/footnotes\",prefix:\"footnotes\"},{uri:\"http://www.28msec.com/modules/mongodb/types\",prefix:\"m\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/modules/string\",prefix:\"string\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"fnid\",qname:\"footnotes:fnid\",signature:\"($footnote-or-id as item()) as atomic\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized footnote id (FNID). The input\\n can be either an FNID, or a footnote object which contains an _id.</p>\\n',summary:\"<p>  Converts the input to a normalized footnote id (FNID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"footnote-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an footnote object or FNID.</div>'}],returns:{type:\"atomic\",description:\"the normalized FNID.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">footnotes:INVALID-PARAMETER if the FNID or footnote is not valid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"footnotes-for-archives\",qname:\"footnotes:footnotes-for-archives\",signature:\"($archive-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all footnotes reported within a given archive.</p>\\n',summary:\"<p>  Return all footnotes reported within a given archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or AIDs to filter.</div>'}],returns:{type:\"object()*\",description:\"all footnotes reported in these archives.\"},errors:[]},{isDocumented:!0,arity:1,name:\"footnotes-for-facts\",qname:\"footnotes:footnotes-for-facts\",signature:\"($facts-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all footnotes associated with the given facts.</p>\\n',summary:\"<p>  Return all footnotes associated with the given facts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"facts-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of facts or fact IDs to filter</div>'}],returns:{type:\"object()*\",description:\"all footnotes associated with these facts.\"},errors:[]},{isDocumented:!0,arity:2,name:\"footnotes-for-facts\",qname:\"footnotes:footnotes-for-facts\",signature:\"($facts-or-ids as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all footnotes associated with the given facts.</p>\\n',summary:\"<p>  Return all footnotes associated with the given facts.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"facts-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of facts or fact IDs to filter</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"all footnotes associated with these facts.\"},errors:[]},{isDocumented:!0,arity:1,name:\"footnotes-search\",qname:\"footnotes:footnotes-search\",signature:\"($search as string) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all footnotes that match the given search term.</p>\\n',summary:\"<p>  Return all footnotes that match the given search term.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"search\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the search query</div>'}],returns:{type:\"object()*\",description:\"all footnotes matching the given search query\"},errors:[]},{isDocumented:!0,arity:0,name:\"footnotes\",qname:\"footnotes:footnotes\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all footnotes.</p>\\n',summary:\"<p>  Return all footnotes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all footnotes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"footnotes\",qname:\"footnotes:footnotes\",signature:\"($footnote-or-ids as item()*) as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the footnote with the given FNIDs.</p>\\n',summary:\"<p>  Return the footnote with the given FNIDs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"footnote-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the FNIDs or the footnotes themselves.</div>'}],returns:{type:\"object()?\",description:\"the footnotes with the given FNIDs the empty sequence if no footnote was found or if the input is an empty sequence.\"},errors:[]}],variables:[{name:\"footnotes:col\",type:\"string\",description:\" Name of the collection the footnotes are stored in.\\n\"},{name:\"footnotes:ARCHIVE\",type:\"string\",description:\" Name of the field that points to the archive.\\n\"},{name:\"footnotes:FACTS\",type:\"string\",description:\" Name of the field that points to the facts linked to this footnote.\\n\"},{name:\"footnotes:LANG\",type:\"string\",description:\" Name of the field that holds the language attribute of the footnote.\\n\"}]},\"http://zorba.io/modules/store/static/indexes/dml\":{ns:\"http://zorba.io/modules/store/static/indexes/dml\",description:' This module defines a set of functions to probe and refresh indexes which are\\n declared in the prolog of a module.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data Definition Facility</a>.\\n All the indexes managed by this module have to be pre-declared in the prolog\\n of a library module.\\n Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Zorba Team</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/store/static/indexes/dml\",prefix:\"idml\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"keys\",qname:\"idml:keys\",signature:\"($name as xs:QName) as node()* external\",description:' Gets a sequence of all keys contained in the index with the given name.\\n Each element has the following structure:\\n  <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"brush: xml;\">\\n   &lt;key xmlns=\"http://zorba.io/modules/store/static/indexes/dml\"&gt;\\n     &lt;attribute value=\"key1_value\"/&gt;\\n     &lt;attribute value=\"key2_value\"/&gt;\\n     &lt;attribute value=\"key3_value\"/&gt;\\n   &lt;/key&gt;\\n  </pre>\\n Note that the order of the attribute elements reflects the order of\\n the keys in the index specification. Also note that the values in\\n these attributes have the type that is declared in the corresponding\\n index specification.\\n',summary:\"<p> Gets a sequence of all keys contained in the index with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to get the keys for.</div>'}],returns:{type:\"node()*\",description:\"A sequence of elements comprising the keys in the index.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index was not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"probe-index-point-general\",qname:\"idml:probe-index-point-general\",signature:\"($name as xs:QName, $key as xs:anyAtomicType*) as node()* external\",description:' Gets from an index the domain nodes associated by general equality with a\\n given <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search sequence </em>.\\n The search sequence consists of an arbitrary number of <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search keys</em>\\n where each search key is an atomic item.\\n The function is supported by general indexes only.\\n',summary:\"<p> Gets from an index the domain nodes associated by general equality with a\\n given  search sequence  .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to probe.</div>'},{name:\"key\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The search sequence.</div>'}],returns:{type:\"node()*\",description:'The set of domain nodes for which the following XQuery expression returns true: <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> $keys = $node/keyExpr </pre> where keyExpr is the expression specified in the keyspec of the index (remember that for general indexes, there can be only one keyspec).'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if the search sequence contains a search key whose type does not match the sequence type specified in the keyspec of the index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index with name $name is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index with name $name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0029 if the index is not general.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"probe-index-point-value-skip\",qname:\"idml:probe-index-point-value-skip\",signature:\"($name as xs:QName, $skip as xs:integer, $key_i as xs:anyAtomicType?) as node()* external\",description:' This is an extension of the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">probe-index-point-value()</code> function\\n in that it allows index items to be skipped.\\n',summary:\"<p> This is an extension of the  probe-index-point-value()  function\\n in that it allows index items to be skipped.</p>\",annotation_str:\" %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to probe.</div>'},{name:\"skip\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of index items to skip.</div>'},{name:\"key_i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The search keys used to probe the index with. The i-th search key corresponds to the i-th key expression in the index declaration.</div>'}],returns:{type:\"node()*\",description:\"The set of domain nodes that satisfy the search condition.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the number of search keys passed as arguments is not the same as the number of keys declared for the index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if a non-empty seach key is given whose type does not match the sequence type specified in the corresponding keyspec.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"probe-index-point-value\",qname:\"idml:probe-index-point-value\",signature:\"($name as xs:QName, $key_i as xs:anyAtomicType?) as node()* external\",description:' Gets the domain nodes from an index associated by value equality with a\\n given <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search tuple</em>.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The search tuple consists of a number of <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search keys</em> where each\\n search key is either an atomic item or the empty sequence.  The number of\\n search keys given must be equal to the number of keys declared for the\\n index. Since the number of keys differs from one index to another, this\\n function is variadic.\\n',summary:\"<p> Gets the domain nodes from an index associated by value equality with a\\n given  search tuple .</p>\",annotation_str:\" %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The of the index to probe.</div>'},{name:\"key_i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A search key used to probe the index with. The i-th search key corresponds to the i-th key expression in the index declaration.</div>'}],returns:{type:\"node()*\",description:'The set of domain nodes for which the following XQuery expression returns true: <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> $key1 eq $node/keyExpr1 and ... and $keyM eq $node/keyExprM </pre> where <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">keyExpr<sub>i</sub></i> is the expression specified in the i-th keyspec of the index.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the number of search keys passed as arguments is not the same as the number of keys declared for the index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if a non-empty seach key is given whose type does not match the sequence type specified in the corresponding keyspec.</xqdoc:error>']},{isDocumented:!0,arity:7,name:\"probe-index-range-general\",qname:\"idml:probe-index-range-general\",signature:\"($name as xs:QName, $lowerBound as xs:anyAtomicType*, $upperBound as xs:anyAtomicType*, $haveLowerBound as xs:boolean, $haveUpperBound as xs:boolean, $lowerBoundIncluded as xs:boolean, $upperBoundIncluded as xs:boolean) as node()* external\",description:' Gets the domain nodes associated by general order-comparison (operators\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;=</code>, <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;</code>, <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&gt;=</code>,\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&gt;</code>) with one or two <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search sequences</em>.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Each search sequence consists of an arbitrary number of\\n <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search keys</em> where each search key is an atomic item.\\n This method is supported by general range indexes only.\\n Its result is either an error or the set of domain nodes for which the\\n following XQuery expression returns true:\\n  <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    if ( $haveLowerBound and $haveUpperBound ) then\\n      $lowerBoundKeys lop $node/keyExpr and $node/keyExpr uop $upperBoundKeys\\n    else if ( $haveLowerBound ) then\\n      $lowerBoundKeys lop $node/keyExpr\\n    else if ( $haveUpperBound ) then\\n      $node/keyExpr uop $upperBoundKeys\\n    else\\n      fn:true()\\n  </pre>\\n where <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">keyExpr</i> is the expression specified in the keyspec of the\\n index, <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">lop</i> is either the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;=</code> or the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;</code>\\n operator depending on whether <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lowerBoundsIncluded</code> is true or\\n false, and <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uop</i> is either the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;=</code> or the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">&lt;</code> operator depending on whether\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upperBoundsIncluded</code> is true or false.\\n',summary:\"<p> Gets the domain nodes associated by general order-comparison (operators\\n  &lt;= ,  &lt; ,  &gt;= ,\\n  &gt; ) with one or two  search sequences .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The of the index to probe.</div>'},{name:\"lowerBound\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The lower bound search sequence.</div>'},{name:\"upperBound\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The upper bound search sequence.</div>'},{name:\"haveLowerBound\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether a lower bound search sequence exists or not.</div>'},{name:\"haveUpperBound\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether an upper bound search sequence exists or not.</div>'},{name:\"lowerBoundIncluded\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether to use the <code>&lt;=</code> or the <code>&lt;</code> operator when comparing a search key from <code>$lowerBound</code> with an index key.</div>'},{name:\"upperBoundIncluded\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Whether to use the <code>&lt;=</code> or the <code>&lt;</code> operator when comparing an index key with a search key from <code>$upperBound</code>.</div>'}],returns:{type:\"node()*\",description:\"The set of domain nodes that satisfy the search condition.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index was not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0030 if the index is not a general range index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if <code>$haveLowerBound</code> is true and <code>$lowerBoundKeys</code> contains an atomic item whose type does not match the sequence type specified by the index keyspec, or <code>$haveUpperBound</code> is true and <code>$upperBoundKeys</code> contains an atomic item whose type does not match the sequence type specified by the index keyspec.</xqdoc:error>']},{isDocumented:!0,arity:8,name:\"probe-index-range-value-skip\",qname:\"idml:probe-index-range-value-skip\",signature:\"($name as xs:QName, $skip as xs:integer, $lowerBound-i as xs:anyAtomicType?, $upperBound-i as xs:anyAtomicType?, $haveLowerBound-i as xs:boolean, $haveUpperBound-i as xs:boolean, $lowerBoundIncluded-i as xs:boolean, $upperBoundIncluded-i as xs:boolean) as node()* external\",description:' This function is an extension of the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">probe-index-range-value()</code>\\n function that index items to be skipped.\\n',summary:\"<p> This function is an extension of the  probe-index-range-value() \\n function that index items to be skipped.</p>\",annotation_str:\" %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The QName of the index to probe</div>'},{name:\"skip\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of index items to skip.</div>'},{name:\"lowerBound-i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The lower bound in a range of key values.</div>'},{name:\"upperBound-i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The upper bound in a range of key values.</div>'},{name:\"haveLowerBound-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then there is no lower bound, or equivalently, the lower bound is -INFINITY. Otherwise, the lower bound is the one given by the <code>$lowerBound-i</code> value.</div>'},{name:\"haveUpperBound-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then there is no upper bound, or equivalently, the upper bound is +INFINITY. Otherwise, the upper bound is the one given by the <code>$upperBound-i</code> value.</div>'},{name:\"lowerBoundIncluded-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then the range is open from below, i.e., the lowerBound-i value is not considered part of the range. Otherwise, the range is closed from below, i.e., the <code>$lowerBound-i</code> value is part of the range.</div>'},{name:\"upperBoundIncluded-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then the range is open from above, i.e., the upperBound-i value is not considered part of the range. Otherwise, the range is closed from above, i.e., the <code>$upperBound-i</code> value is part of the range.</div>'}],returns:{type:\"node()*\",description:\"The set of domain nodes that satisfy the search condition.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index with name $name is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index with name $name does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the number of rangespecs passed as arguments is zero or greater than the number of keys declared for the index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0026 if the index is not a range index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if <code>$haveLowerBound-i</code> is true and <code>$lowerBound-i</code> is an atomic item whose type does not match the sequence type specified by the i<sup>th</sup> keyspec, or <code>$haveUpperBound-i</code> is true and <code>$upperBound-i</code> is an atomic item whose type does not match the sequence type specified by the i<sup>th</sup> keyspec.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0034 if (a) the index is general (in which case there is only one rangespac), (b) the index is untyped, (c) there is both a lower and an upper bound, and (d) if T1 and T2 are the types of the lower and upper bound, neither T1 is a subtype of T2 nor T2 is a subtype of T1.</xqdoc:error>']},{isDocumented:!0,arity:7,name:\"probe-index-range-value\",qname:\"idml:probe-index-range-value\",signature:\"($name as xs:QName, $lowerBound-i as xs:anyAtomicType?, $upperBound-i as xs:anyAtomicType?, $haveLowerBound-i as xs:boolean, $haveUpperBound-i as xs:boolean, $lowerBoundIncluded-i as xs:boolean, $upperBoundIncluded-i as xs:boolean) as node()* external\",description:' Gets the domain nodes associated by value order-comparison (operators\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">le</code>, <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">lt</code>, <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ge</code>, <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">gt</code>) with a\\n given <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">search box</em>.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The search box is specified as a number <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">M</i> of <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">rangespecs</em>\\n where each rangespec consists of six values.\\n The number <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">M</i> must be greater than 0 and less than or equal to the\\n number <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i> of keyspecs found in the index declaration.\\n If <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">M</i> &lt; <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i>, then the \"missing\" rangespecs are assumed to have\\n the following value: [(), (), false, false, false, false].\\n As a result, we can assume that <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">M</i> = <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i>.\\n Remember that for general indexes, there can be only one IndexKeySpec and,\\n as a result for general indexes, <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">M</i> = <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i> = 1.\\n Since the number of keys differs from one index to another,\\n this function is variadic.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The i<sup xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">th</sup> rangespec corresponds to the i<sup xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">th</sup> keyspec, and\\n specifies a search condition on the key values that are produced by\\n evaluating that keyspec for every domain node.\\n Specifically, we define the i<sup xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">th</sup> <em xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">rangespec result</em> as the\\n set of domain nodes for which the following XQuery expression returns\\n true:\\n  <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    if ( $haveLowerBound-i and $haveUpperBound-i ) then\\n      $lowerBound-i lop $node/keyExpr-i and $node/keyExpr-i uop $upperBound-i\\n    else if ( $haveLowerBound-i ) then\\n      $lowerBound-i lop $node/keyExpr-i\\n    else if ( $haveUpperBound-i ) then\\n      $node/keyExpr-i uop $upperBound-i\\n    else\\n      fn:true()\\n  </pre>\\n where <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">keyExpr-i</i> is the expression specified by the i<sup xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">th</sup>\\n keyspec of the index, <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">lop</i> is either the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">le</code> or the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">lt</code> operator depending on whether\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$lowerBoundsIncluded-i</code> is true or false, and <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">uop</i> is\\n either the <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">le</i> or the <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">lt</i> operator depending on whether\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$upperBoundsIncluded-i</code> is true or false.\\n',summary:\"<p> Gets the domain nodes associated by value order-comparison (operators\\n  le ,  lt ,  ge ,  gt ) with a\\n given  search box .</p>\",annotation_str:\" %an:variadic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"variadic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to probe.</div>'},{name:\"lowerBound-i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The lower bound in a range of key values.</div>'},{name:\"upperBound-i\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The upper bound in a range of key values.</div>'},{name:\"haveLowerBound-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then there is no lower bound, or equivalently, the lower bound is -INFINITY. Otherwise, the lower bound is the one given by the <code>$lowerBound-i</code> value.</div>'},{name:\"haveUpperBound-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then there is no upper bound, or equivalently, the upper bound is +INFINITY. Otherwise, the upper bound is the one given by the <code>$upperBound-i</code> value.</div>'},{name:\"lowerBoundIncluded-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then the range is open from below, i.e., the <code>$lowerBound-i</code> value is not considered part of the range. Otherwise, the range is closed from below, i.e., the <code>$lowerBound-i</code> value is part of the range.</div>'},{name:\"upperBoundIncluded-i\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> If false, then the range is open from above, i.e., the <code>$upperBound-i</code> value is not considered part of the range. Otherwise, the range is closed from above, i.e., the <code>$upperBound-i</code> value is part of the range.</div>'}],returns:{type:\"node()*\",description:\"The intersection of all the rangespec results.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0025 if the number of rangespecs passed as arguments is zero or greater than the number of keys declared for the index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0026 if the index is not a range index.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XPTY0004 if <code>$haveLowerBound-i</code> is true and <code>$lowerBound-i</code> is an atomic item whose type does not match the sequence type specified by the i<sup>th</sup> keyspec, or <code>$haveUpperBound-i</code> is true and <code>$upperBound-i</code> is an atomic item whose type does not match the sequence type specified by the i<sup>th</sup> keyspec.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0034 if (a) the index is general (in which case there is only one rangespac), (b) the index is untyped, (c) there is both a lower and an upper bound, and (d) if T1 and T2 are the types of the lower and upper bound, neither T1 is a subtype of T2 nor T2 is a subtype of T1.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"refresh-index\",qname:\"idml:refresh-index\",signature:\"($name as xs:QName) external\",description:\" Updates the index with the given name.  Note that if the maintenance\\n property of the index is automatic, this function does nothing.\\n\",summary:\"<p> Updates the index with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the index to refresh.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, when applied, refreshes the contents of the index.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0021 if the index is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0023 if the index does not exist.</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/full-text\":{ns:\"http://www.28msec.com/modules/full-text\",description:' This module provides an API to full-text functions such as tokenization,\\n stemming, or stop word detection. The default language is set to english\\n for all functions that don\\'t take an explicit language parameter.\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on stemming</h2>\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">stem()</code> functions return the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://en.wikipedia.org/wiki/Word_stem\">stem</a>\\n of a word.\\n On 28.io,\\n the stem of a word itself, however, is not guaranteed to be a word.\\n It is best to consider a stem as an opaque byte sequence.\\n All that is guaranteed about a stem is that,\\n for a given word,\\n the stem of that word will always be the same byte sequence.\\n Hence,\\n you sould never compare the result of one of the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">stem()</code>\\n functions against a non-stemmed string,\\n for example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\">\\n  if ( ft:stem( \"apples\" ) eq \"apple\" )             ** WRONG **\\n </pre>\\n Instead do:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\">\\n  if ( ft:stem( \"apples\" ) eq ft:stem( \"apple\" ) )  ** CORRECT **\\n </pre>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on the thesaurus</h2>\\n 28msec uses the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://wordnet.princeton.edu/\">WordNet lexical database</a> version 3.0,\\n In WordNet, the number of \"levels\" that two phrases are apart\\n are how many hierarchical meanings apart they are.\\n For example,\\n \"canary\" is 5 levels away from \"vertebrate\"\\n (carary &gt; finch &gt; oscine &gt; passerine &gt; bird &gt; vertebrate).\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n When using the WordNet implementation,\\n 28msec supports all of the relationships (and their abbreviations)\\n specified by\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=7776\">ISO 2788</a>\\n and\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a\">ANSI/NISO Z39.19-2005</a>\\n with the exceptions of \"HN\" (history note)\\n and \"X SN\" (see scope note for).\\n These relationships are:\\n  <table xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"table table-bordered\">\\n    <tr>\\n      <th>Rel.</th>\\n      <th>Meaning</th>\\n      <th>WordNet Rel.</th>\\n    </tr>\\n    <tr>\\n      <td>BT</td>\\n      <td>broader term</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTG</td>\\n      <td>broader term generic</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTI</td>\\n      <td>broader term instance</td>\\n      <td>instance hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTP</td>\\n      <td>broader term partitive</td>\\n      <td>part meronym</td>\\n    </tr>\\n    <tr>\\n      <td>NT</td>\\n      <td>narrower term</td>\\n      <td>hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTG</td>\\n      <td>narrower term generic</td>\\n      <td>hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTI</td>\\n      <td>narrower term instance</td>\\n      <td>instance hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTP</td>\\n      <td>narrower term partitive</td>\\n      <td>part holonym</td>\\n    </tr>\\n    <tr>\\n      <td>RT</td>\\n      <td>related term</td>\\n      <td>also see</td>\\n    </tr>\\n    <tr>\\n      <td>SN</td>\\n      <td>scope note</td>\\n      <td>n/a</td>\\n    </tr>\\n    <tr>\\n      <td>TT</td>\\n      <td>top term</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>UF</td>\\n      <td>non-preferred term</td>\\n      <td>n/a</td>\\n    </tr>\\n    <tr>\\n      <td>USE</td>\\n      <td>preferred term</td>\\n      <td>n/a</td>\\n    </tr>\\n  </table>\\n Note that you can specify relationships\\n either by their abbreviation\\n or their meaning.\\n Relationships are case-insensitive.\\n In addition to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=7776\">ISO 2788</a>\\n and\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a\">ANSI/NISO Z39.19-2005</a>\\n relationships,\\n 28msec also supports all of the relationships offered by WordNet.\\n These relationships are:\\n  <table xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ft_rels table table-bordered\">\\n    <tr>\\n      <th>Relationship</th>\\n      <th>Meaning</th>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">also see</td>\\n      <td>\\n        A word that is related to another,\\n        e.g., for \"varnished\" (furniture)\\n        one should <em>also see</em> \"finished.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>antonym</td>\\n      <td>\\n        A word opposite in meaning to another,\\n        e.g., \"light\" is an <em>antonym</em> for \"heavy.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>attribute</td>\\n      <td>\\n        A noun for which adjectives express values,\\n        e.g., \"weight\" is an <em>attribute</em>\\n        for which the adjectives \"light\" and \"heavy\"\\n        express values.\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>cause</td>\\n      <td>\\n        A verb that causes another,\\n        e.g., \"show\" is a <em>cause</em> of \"see.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">derivationally related form</td>\\n      <td>\\n        A word that is derived from a root word,\\n        e.g., \"metric\" is a <em>derivationally related form</em> of \"meter.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">derived from adjective</td>\\n      <td>\\n        An adverb that is derived from an adjective,\\n        e.g., \"correctly\" is <em>derived from the adjective</em> \"correct.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>entailment</td>\\n      <td>\\n        A verb that presupposes another,\\n        e.g., \"snoring\" <em>entails</em> \"sleeping.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>hypernym</td>\\n      <td>\\n        A word with a broad meaning that more specific words fall under,\\n        e.g., \"meal\" is a <em>hypernym</em> of \"breakfast.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>hyponym</td>\\n      <td>\\n        A word of more specific meaning than a general term applicable to it,\\n        e.g., \"breakfast\" is a <em>hyponym</em> of \"meal.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">instance hypernym</td>\\n      <td>\\n        A word that denotes a category of some specific instance,\\n        e.g., \"author\" is an <em>instance hypernym</em> of \"Asimov.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">instance hyponym</td>\\n      <td>\\n        A term that donotes a specific instance of some general category,\\n        e.g., \"Asimov\" is an <em>instance hyponym</em> of \"author.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">member holonym</td>\\n      <td>\\n        A word that denotes a collection of individuals,\\n        e.g., \"faculty\" is a <em>member holonym</em> of \"professor.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">member meronym</td>\\n      <td>\\n        A word that denotes a member of a larger group,\\n        e.g., a \"person\" is a <em>member meronym</em> of a \"crowd.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">part holonym</td>\\n      <td>\\n        A word that denotes a larger whole comprised of some part,\\n        e.g., \"car\" is a <em>part holonym</em> of \"engine.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">part meronym</td>\\n      <td>\\n        A word that denotes a part of a larger whole,\\n        e.g., an \"engine\" is <em>part meronym</em> of a \"car.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">participle of verb</td>\\n      <td>\\n        An adjective that is the participle of some verb,\\n        e.g., \"breaking\" is the <em>participle of the verb</em> \"break.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>pertainym</td>\\n      <td>\\n        An adjective that classifies its noun,\\n        e.g., \"musical\" is a <em>pertainym</em> in \"musical instrument.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">similar to</td>\\n      <td>\\n        Similar, though not necessarily interchangeable, adjectives.\\n        For example, \"shiny\" is <em>similar to</em> \"bright\",\\n        but they have subtle differences.\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">substance holonym</td>\\n      <td>\\n        A word that denotes a larger whole containing some constituent\\n        substance, e.g., \"bread\" is a <em>substance holonym</em> of \"flour.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">substance meronym</td>\\n      <td>\\n        A word that denotes a constituant substance of some larger whole,\\n        e.g., \"flour\" is a <em>substance meronym</em> of \"bread.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">verb group</td>\\n      <td>\\n        A verb that is a member of a group of similar verbs,\\n        e.g., \"live\" is in the <em>verb group</em>\\n        of \"dwell\", \"live\", \"inhabit\", etc.\\n      </td>\\n    </tr>\\n  </table>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.28msec.com/modules/full-text\",prefix:\"ft\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"},{uri:\"http://zorba.io/modules/full-text\",prefix:\"zft\"}],functions:[{isDocumented:!0,arity:1,name:\"is-stem-lang-supported\",qname:\"ft:is-stem-lang-supported\",signature:\"($lang as language) as boolean\",description:\" Checks whether the given language is supported for stemming.\\n\",summary:\"<p> Checks whether the given language is supported for stemming.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-stop-word-lang-supported\",qname:\"ft:is-stop-word-lang-supported\",signature:\"($lang as language) as boolean\",description:\" Checks whether the given language\\n is supported for stop words.\\n\",summary:\"<p> Checks whether the given language\\n is supported for stop words.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-stop-word\",qname:\"ft:is-stop-word\",signature:\"($word as string) as boolean\",description:\" Checks whether the given word is a stop-word.\\n\",summary:\"<p> Checks whether the given word is a stop-word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to check. The word\\'s language is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code> is a stop-word.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"is-stop-word\",qname:\"ft:is-stop-word\",signature:\"($word as string, $lang as language) as boolean\",description:\" Checks whether the given word is a stop-word.\\n\",summary:\"<p> Checks whether the given word is a stop-word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to check.</div>'},{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language of <code>$word</code>.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code> is a stop-word.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-thesaurus-lang-supported\",qname:\"ft:is-thesaurus-lang-supported\",signature:\"($lang as language) as boolean\",description:\" Checks whether the given language\\n is supported for look-up using the Wordnet thesaurus.\\n\",summary:\"<p> Checks whether the given language\\n is supported for look-up using the Wordnet thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-tokenizer-lang-supported\",qname:\"ft:is-tokenizer-lang-supported\",signature:\"($lang as language) as boolean\",description:\" Checks whether the given language\\n is supported for tokenization.\\n\",summary:\"<p> Checks whether the given language\\n is supported for tokenization.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"stem\",qname:\"ft:stem\",signature:\"($word as string) as string\",description:\" Stems the given word.\\n\",summary:\"<p> Stems the given word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to stem. The word\\'s language is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"string\",description:'the stem of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"stem\",qname:\"ft:stem\",signature:\"($word as string, $lang as language) as string\",description:\" Stems the given word.\\n\",summary:\"<p> Stems the given word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to stem.</div>'},{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language of <code>$word</code>.</div>'}],returns:{type:\"string\",description:'the stem of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"strip-diacritics\",qname:\"ft:strip-diacritics\",signature:\"($string as string) as string\",description:\" Strips all diacritical marks from all characters.\\n\",summary:\"<p> Strips all diacritical marks from all characters.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to strip diacritical marks from.</div>'}],returns:{type:\"string\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$string</code> with diacritical marks stripped.'},errors:[]},{isDocumented:!0,arity:1,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($phrase as string) as string*\",description:\" Looks-up the given phrase in the Wordnet thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in the Wordnet thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"phrase\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'}],returns:{type:\"string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of Zorba.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which Zorba is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($phrase as string, $relationship as string) as string*\",description:\" Looks-up the given phrase in a thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in a thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"phrase\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'},{name:\"relationship\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The relationship the results are to have to <code>$phrase</code>.</div>'}],returns:{type:\"string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of Zorba.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which Zorba is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($phrase as string, $relationship as string, $level-least as integer, $level-most as integer) as string*\",description:\" Looks-up the given phrase in a thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in a thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"phrase\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'},{name:\"relationship\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The relationship the results are to have to <code>$phrase</code>.</div>'},{name:\"level-least\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The minimum number of levels within the thesaurus to be traversed.</div>'},{name:\"level-most\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The maximum number of levels within the thesaurus to be traversed.</div>'}],returns:{type:\"string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCA0003 if either <code>$level-least</code> or <code>$level-most</code> is either negative or too large.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of Zorba.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which Zorba is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tokenize\",qname:\"ft:tokenize\",signature:\"($string as string) as string*\",description:\" Tokenizes the given string.\\n\",summary:\"<p> Tokenizes the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to tokenize. The string\\'s language is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"string*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"tokenize\",qname:\"ft:tokenize\",signature:\"($string as string, $lang as language) as string*\",description:\" Tokenizes the given string.\\n\",summary:\"<p> Tokenizes the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to tokenize.</div>'},{name:\"lang\",type:\"language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language of <code>$string</code>.</div>'}],returns:{type:\"string*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']}],variables:[{name:\"ft:lang-da\",type:\"language\",description:\" Predeclared constant for the Danish language.\\n\"},{name:\"ft:lang-de\",type:\"language\",description:\" Predeclared constant for the German language.\\n\"},{name:\"ft:lang-en\",type:\"language\",description:\" Predeclared constant for the English language.\\n\"},{name:\"ft:lang-es\",type:\"language\",description:\" Predeclared constant for the Spanish language.\\n\"},{name:\"ft:lang-fi\",type:\"language\",description:\" Predeclared constant for the Finnish language.\\n\"},{name:\"ft:lang-fr\",type:\"language\",description:\" Predeclared constant for the French language.\\n\"},{name:\"ft:lang-hu\",type:\"language\",description:\" Predeclared constant for the Hungarian language.\\n\"},{name:\"ft:lang-it\",type:\"language\",description:\" Predeclared constant for the Italian language.\\n\"},{name:\"ft:lang-nl\",type:\"language\",description:\" Predeclared constant for the Dutch language.\\n\"},{name:\"ft:lang-no\",type:\"language\",description:\" Predeclared constant for the Norwegian language.\\n\"},{name:\"ft:lang-pt\",type:\"language\",description:\" Predeclared constant for the Portuguese language.\\n\"},{name:\"ft:lang-ro\",type:\"language\",description:\" Predeclared constant for the Romanian language.\\n\"},{name:\"ft:lang-ru\",type:\"language\",description:\" Predeclared constant for the Russian language.\\n\"},{name:\"ft:lang-sv\",type:\"language\",description:\" Predeclared constant for the Swedish language.\\n\"},{name:\"ft:lang-tr\",type:\"language\",description:\" Predeclared constant for the Turkish language.\\n\"}]},\"http://xbrl.io/modules/bizql/report-schemas\":{ns:\"http://xbrl.io/modules/bizql/report-schemas\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for storing, retrieving, and modifying\\n report schemas. Report schemas can be used in BizQL queries. They can be\\n instantiated generating a business report.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Report schemas are nothing else than a user-defined component. However,\\n one of their hypercubes (the default hypercube), as well as two of their\\n networks (presentation, concept-map) are special. A report schema is identified\\n with an RID (Report schema ID).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve facts from an archive according to a report\\n schema. You can retrieve them as a (2D) fact table, or populate the presentation\\n network of the report schema with them. The concept map network will be used\\n by default to map the report schema concepts to reported concepts.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Report schemas are stored in the collection reportschemas in\\n the project\\'s MongoDB database.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A report schema needs to be a syntactically valid JSound document.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://xbrl.io/modules/bizql/hypercubes\",prefix:\"hypercubes\"},{uri:\"http://xbrl.io/modules/bizql/networks\",prefix:\"networks\"},{uri:\"http://xbrl.io/modules/bizql/report-schemas\",prefix:\"report-schemas\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"add\",qname:\"report-schemas:add\",signature:\"($report-schema as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Adds the given report schema to the database.</p>\\n',summary:\"<p>  Adds the given report schema to the database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"report-schema\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the report schema to add.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">report-schemas:INVALID-SCHEMA if the given report schema object does not contain a name field</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">report-schemas:EXISTS if a report schema with the given name already exists</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete\",qname:\"report-schemas:delete\",signature:\"($report-schema-or-id as item()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes a report schema from the database.</p>\\n',summary:\"<p>  Deletes a report schema from the database.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"report-schema-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the report schema to delete or its RID.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">report-schemas:DOES-NOT-EXIST if no report schema with the given RID exists.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"fact-table\",qname:\"report-schemas:fact-table\",signature:\"($schema as item(), $archives as item()*) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a schema or its RID,</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs.</div>'}],returns:{type:\"array()\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"fact-table\",qname:\"report-schemas:fact-table\",signature:\"($schema as item(), $archives as item()*, $options as object()?) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a schema or its RID,</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $report-schemas:ALL_ARCHIVES for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"array()\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts\",qname:\"report-schemas:facts\",signature:\"($schema as item(), $archives as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema or its RID,</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $report-schemas:ALL_ARCHIVES for no filtering.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts\",qname:\"report-schemas:facts\",signature:\"($schema as item(), $archives as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied schema, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema or its RID,</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $report-schemas:ALL_ARCHIVES for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:2,name:\"populate-with-facts\",qname:\"report-schemas:populate-with-facts\",signature:\"($schema as item(), $archives as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $report-schemas:ALL_ARCHIVES for no filtering.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"populate-with-facts\",qname:\"report-schemas:populate-with-facts\",signature:\"($schema as item(), $archives as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied schema.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schema\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $report-schemas:ALL_ARCHIVES for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:0,name:\"report-schemas\",qname:\"report-schemas:report-schemas\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all report schemas.</p>\\n',summary:\"<p>  Retrieves all report schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all report schemas.\"},errors:[]},{isDocumented:!0,arity:1,name:\"report-schemas\",qname:\"report-schemas:report-schemas\",signature:\"($report-schemas-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the report schemas with the given names (RIDs).</p>\\n',summary:\"<p>  Return the report schemas with the given names (RIDs).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"report-schemas-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the ids of the report schemas (RIDs) or the report schemas themselves.</div>'}],returns:{type:\"object()*\",description:\"the report schemas with the given RIDs or the empty sequence if no report schema was found or the input is an empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"rid\",qname:\"report-schemas:rid\",signature:\"($report-schema-or-id as item()) as atomic\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized report schema identifier (RID). The input\\n can be either a pure RID, or a report schema object which contains an RID.</p>\\n',summary:\"<p>  Converts the input to a normalized report schema identifier (RID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"report-schema-or-id\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a report schema identifier (RID)) or a report schema object.</div>'}],returns:{type:\"atomic\",description:\"the normalized RID.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">report-schemas:INVALID_PARAMETER if the RID or report schema is not valid</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"update\",qname:\"report-schemas:update\",signature:\"($report-schema as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Updates a report schema.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Replaces a report schema in the database with the given schema.\\n The schema to be replaced is identified by the value of the _id\\n field of the given schema (RID).</p>\\n',summary:\"<p>  Updates a report schema.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"report-schema\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the new report schema</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">report-schemas:DOES-NOT-EXIST if a report schema with the given name does not exist.</xqdoc:error>']}],variables:[{name:\"report-schemas:col\",type:\"string\",description:\" Name of the collection the report schemas are stored in.\\n\"},{name:\"report-schemas:ALL_ARCHIVES\",type:\"boolean\",description:\" Joker for all archives.\\n\"}]},\"http://zorba.io/modules/store/static/integrity-constraints/ddl\":{ns:\"http://zorba.io/modules/store/static/integrity-constraints/ddl\",description:' This module defines a set of functions to manage integrity constraints\\n that are declared in the prolog of a module.\\n For example, it provides functions to activate or deactivate integrity\\n constraints.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data Definition Facility</a>.\\n All the integrity constraints managed by this module have to be pre-declared\\n in the prolog of a module.\\n Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/store/static/integrity-constraints/ddl\",prefix:\"icddl\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:1,name:\"activate\",qname:\"icddl:activate\",signature:\"($name as xs:QName) external\",description:\" Activates an integrity constraint in the dynamic context.\\n\",summary:\"<p> Activates an integrity constraint in the dynamic context.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the integrity constraint to activate.</div>'}],returns:{type:null,description:'An empty XDM instance and a pending update list that consists of a <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">upd:activateIntegrityConstraint($name)</code> update primitive.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0031 if the integrity constraint does not exist in the static context.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"activated-integrity-constraints\",qname:\"icddl:activated-integrity-constraints\",signature:\"() as xs:QName* external\",description:\" Gets the integrity constraints that are activated, if any.\\n\",summary:\"<p> Gets the integrity constraints that are activated, if any.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each activated integrity constraint, or an empty sequence if none.\"},errors:[]},{isDocumented:!0,arity:1,name:\"deactivate\",qname:\"icddl:deactivate\",signature:\"($name as xs:QName) external\",description:\" Deactivates the integrity constraint.\\n\",summary:\"<p> Deactivates the integrity constraint.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the integrity constraint to deactivate.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deactivates the integrity constraint.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0032 if the integrity constraint was not declared in the the static context.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0032 if the integrity constraints is not activated.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"declared-integrity-constraints\",qname:\"icddl:declared-integrity-constraints\",signature:\"() as xs:QName* external\",description:\" Gets the sequence of QNames representing the integrity constraints that have\\n been declared in the prolog of the static context.\\n\",summary:\"<p> Gets the sequence of QNames representing the integrity constraints that have\\n been declared in the prolog of the static context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:QName*\",description:\"A sequence of QNames, one for each created integrity constraints, or an emtpy sequence if none.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-activated-integrity-constraint\",qname:\"icddl:is-activated-integrity-constraint\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gets whether an integrity constraints is activated.\\n\",summary:\"<p> Gets whether an integrity constraints is activated.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the constraint to check.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the integrity constraint is activated; false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-declared-integrity-constraint\",qname:\"icddl:is-declared-integrity-constraint\",signature:\"($name as xs:QName) as xs:boolean external\",description:\" Gets whether an integrity constraint is declared in the prolog of the static\\n context.\\n\",summary:\"<p> Gets whether an integrity constraint is declared in the prolog of the static\\n context.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the constraint to check.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the constraint is declared; false otherwise.\"},errors:[]}],variables:[]},\"http://www.functx.com\":{ns:\"http://www.functx.com\",description:\" --------------------------------\\n The FunctX XQuery Function Library\\n --------------------------------\\n Copyright (C) 2007 Datypic\\n This library is free software; you can redistribute it and/or\\n modify it under the terms of the GNU Lesser General Public\\n License as published by the Free Software Foundation; either\\n version 2.1 of the License.\\n This library is distributed in the hope that it will be useful,\\n but WITHOUT ANY WARRANTY; without even the implied warranty of\\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\\n Lesser General Public License for more details.\\n You should have received a copy of the GNU Lesser General Public\\n License along with this library; if not, write to the Free Software\\n Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA\\n For more information on the FunctX XQuery library, contact contrib@functx.com.\\n\",sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.xqueryfunctions.com</xqdoc:see>'],authors:[],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.functx.com\",prefix:\"functx\"}],functions:[{isDocumented:!0,arity:3,name:\"add-attributes\",qname:\"functx:add-attributes\",signature:\"($elements as element(*)*, $attrNames as xs:QName*, $attrValues as xs:anyAtomicType*) as element(*)?\",description:\" Adds attributes to XML elements\\n\",summary:\"<p> Adds attributes to XML elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) to which you wish to add the attribute</div>'},{name:\"attrNames\",type:\"xs:QName\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name(s) of the attribute(s) to add</div>'},{name:\"attrValues\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value(s) of the attribute(s) to add</div>'}],returns:{type:\"element(*)?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"add-months\",qname:\"functx:add-months\",signature:\"($date as xs:anyAtomicType?, $months as xs:integer) as xs:date?\",description:\" Adds months to a date\\n\",summary:\"<p> Adds months to a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'},{name:\"months\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of months to add</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"add-or-update-attributes\",qname:\"functx:add-or-update-attributes\",signature:\"($elements as element(*)*, $attrNames as xs:QName*, $attrValues as xs:anyAtomicType*) as element(*)?\",description:\" Adds attributes to XML elements\\n\",summary:\"<p> Adds attributes to XML elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) to which you wish to add the attribute</div>'},{name:\"attrNames\",type:\"xs:QName\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name(s) of the attribute(s) to add</div>'},{name:\"attrValues\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value(s) of the attribute(s) to add</div>'}],returns:{type:\"element(*)?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"all-whitespace\",qname:\"functx:all-whitespace\",signature:\"($arg as xs:string?) as xs:boolean\",description:\" Whether a value is all whitespace or a zero-length string\\n\",summary:\"<p> Whether a value is all whitespace or a zero-length string\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string (or node) to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"are-distinct-values\",qname:\"functx:are-distinct-values\",signature:\"($seq as xs:anyAtomicType*) as xs:boolean\",description:\" Whether all the values in a sequence are distinct\\n\",summary:\"<p> Whether all the values in a sequence are distinct\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"atomic-type\",qname:\"functx:atomic-type\",signature:\"($values as xs:anyAtomicType*) as xs:string*\",description:\" The built-in type of an atomic value\\n\",summary:\"<p> The built-in type of an atomic value\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value(s) whose type you want to determine</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"avg-empty-is-zero\",qname:\"functx:avg-empty-is-zero\",signature:\"($values as xs:anyAtomicType*, $allNodes as node()*) as xs:double\",description:' The average, counting \"empty\" values as zero\\n',summary:'<p> The average, counting \"empty\" values as zero\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values to be averaged</div>'},{name:\"allNodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of all nodes to find the average over</div>'}],returns:{type:\"xs:double\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"between-exclusive\",qname:\"functx:between-exclusive\",signature:\"($value as xs:anyAtomicType?, $minValue as xs:anyAtomicType, $maxValue as xs:anyAtomicType) as xs:boolean\",description:\" Whether a value is between two provided values\\n\",summary:\"<p> Whether a value is between two provided values\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be tested</div>'},{name:\"minValue\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the minimum value</div>'},{name:\"maxValue\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the maximum value</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"between-inclusive\",qname:\"functx:between-inclusive\",signature:\"($value as xs:anyAtomicType?, $minValue as xs:anyAtomicType, $maxValue as xs:anyAtomicType) as xs:boolean\",description:\" Whether a value is between two provided values, or equal to one of them\\n\",summary:\"<p> Whether a value is between two provided values, or equal to one of them\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to be tested</div>'},{name:\"minValue\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the minimum value</div>'},{name:\"maxValue\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the maximum value</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"camel-case-to-words\",qname:\"functx:camel-case-to-words\",signature:\"($arg as xs:string?, $delim as xs:string) as xs:string\",description:\" Turns a camelCase string into space-separated words\\n\",summary:\"<p> Turns a camelCase string into space-separated words\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to modify</div>'},{name:\"delim\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the delimiter for the words (e.g. a space)</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"capitalize-first\",qname:\"functx:capitalize-first\",signature:\"($arg as xs:string?) as xs:string?\",description:\" Capitalizes the first character of a string\\n\",summary:\"<p> Capitalizes the first character of a string\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the word or phrase to capitalize</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"change-element-names-deep\",qname:\"functx:change-element-names-deep\",signature:\"($nodes as node()*, $oldNames as xs:QName*, $newNames as xs:QName*) as node()*\",description:\" Changes the names of elements in an XML fragment\\n\",summary:\"<p> Changes the names of elements in an XML fragment\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) to change</div>'},{name:\"oldNames\",type:\"xs:QName\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of names to change from</div>'},{name:\"newNames\",type:\"xs:QName\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of names to change to</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"change-element-ns-deep\",qname:\"functx:change-element-ns-deep\",signature:\"($nodes as node()*, $newns as xs:string, $prefix as xs:string) as node()*\",description:\" Changes the namespace of XML elements and its descendants\\n\",summary:\"<p> Changes the namespace of XML elements and its descendants\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the nodes to change</div>'},{name:\"newns\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the new namespace</div>'},{name:\"prefix\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the prefix to use for the new namespace</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"change-element-ns\",qname:\"functx:change-element-ns\",signature:\"($elements as element(*)*, $newns as xs:string, $prefix as xs:string) as element(*)?\",description:\" Changes the namespace of XML elements\\n\",summary:\"<p> Changes the namespace of XML elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the elements to change</div>'},{name:\"newns\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the new namespace</div>'},{name:\"prefix\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the prefix to use for the new namespace</div>'}],returns:{type:\"element(*)?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"chars\",qname:\"functx:chars\",signature:\"($arg as xs:string?) as xs:string*\",description:\" Converts a string to a sequence of characters\\n\",summary:\"<p> Converts a string to a sequence of characters\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to split</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"contains-any-of\",qname:\"functx:contains-any-of\",signature:\"($arg as xs:string?, $searchStrings as xs:string*) as xs:boolean\",description:\" Whether a string contains any of a sequence of strings\\n\",summary:\"<p> Whether a string contains any of a sequence of strings\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to test</div>'},{name:\"searchStrings\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the strings to look for</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"contains-case-insensitive\",qname:\"functx:contains-case-insensitive\",signature:\"($arg as xs:string?, $substring as xs:string) as xs:boolean?\",description:\" Whether one string contains another, without regard to case\\n\",summary:\"<p> Whether one string contains another, without regard to case\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to search</div>'},{name:\"substring\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the substring to find</div>'}],returns:{type:\"xs:boolean?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"contains-word\",qname:\"functx:contains-word\",signature:\"($arg as xs:string?, $word as xs:string) as xs:boolean\",description:\" Whether one string contains another, as a separate word\\n\",summary:\"<p> Whether one string contains another, as a separate word\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to search</div>'},{name:\"word\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the word to find</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"copy-attributes\",qname:\"functx:copy-attributes\",signature:\"($copyTo as element(*), $copyFrom as element(*)) as element(*)\",description:\" Copies attributes from one element to another\\n\",summary:\"<p> Copies attributes from one element to another\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"copyTo\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element to copy attributes to</div>'},{name:\"copyFrom\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element to copy attributes from</div>'}],returns:{type:\"element(*)\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"date\",qname:\"functx:date\",signature:\"($year as xs:anyAtomicType, $month as xs:anyAtomicType, $day as xs:anyAtomicType) as xs:date\",description:\" Construct a date from a year, month and day\\n\",summary:\"<p> Construct a date from a year, month and day\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"year\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the year</div>'},{name:\"month\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the month</div>'},{name:\"day\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the day</div>'}],returns:{type:\"xs:date\",description:\"\"},errors:[]},{isDocumented:!0,arity:6,name:\"dateTime\",qname:\"functx:dateTime\",signature:\"($year as xs:anyAtomicType, $month as xs:anyAtomicType, $day as xs:anyAtomicType, $hour as xs:anyAtomicType, $minute as xs:anyAtomicType, $second as xs:anyAtomicType) as xs:dateTime\",description:\" Construct a date/time from individual components\\n\",summary:\"<p> Construct a date/time from individual components\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"year\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the year</div>'},{name:\"month\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the month</div>'},{name:\"day\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the day</div>'},{name:\"hour\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the hour</div>'},{name:\"minute\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the minute</div>'},{name:\"second\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second</div>'}],returns:{type:\"xs:dateTime\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"day-in-year\",qname:\"functx:day-in-year\",signature:\"($date as xs:anyAtomicType?) as xs:integer?\",description:\" The day of the year (a number between 1 and 366)\\n\",summary:\"<p> The day of the year (a number between 1 and 366)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"day-of-week-abbrev-en\",qname:\"functx:day-of-week-abbrev-en\",signature:\"($date as xs:anyAtomicType?) as xs:string?\",description:\" The abbreviated day of the week, from a date, in English\\n\",summary:\"<p> The abbreviated day of the week, from a date, in English\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"day-of-week-name-en\",qname:\"functx:day-of-week-name-en\",signature:\"($date as xs:anyAtomicType?) as xs:string?\",description:\" The name of the day of the week, from a date, in English\\n\",summary:\"<p> The name of the day of the week, from a date, in English\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"day-of-week\",qname:\"functx:day-of-week\",signature:\"($date as xs:anyAtomicType?) as xs:integer?\",description:\" The day of the week, from a date\\n\",summary:\"<p> The day of the week, from a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:4,name:\"dayTimeDuration\",qname:\"functx:dayTimeDuration\",signature:\"($days as xs:decimal?, $hours as xs:decimal?, $minutes as xs:decimal?, $seconds as xs:decimal?) as xs:dayTimeDuration\",description:\" Construct a dayTimeDuration from a number of days, hours, etc.\\n\",summary:\"<p> Construct a dayTimeDuration from a number of days, hours, etc.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"days\",type:\"xs:decimal\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of days</div>'},{name:\"hours\",type:\"xs:decimal\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of hours</div>'},{name:\"minutes\",type:\"xs:decimal\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of minutes</div>'},{name:\"seconds\",type:\"xs:decimal\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of seconds</div>'}],returns:{type:\"xs:dayTimeDuration\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"days-in-month\",qname:\"functx:days-in-month\",signature:\"($date as xs:anyAtomicType?) as xs:integer?\",description:\" Number of days in the month\\n\",summary:\"<p> Number of days in the month\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"depth-of-node\",qname:\"functx:depth-of-node\",signature:\"($node as node()?) as xs:integer\",description:\" The depth (level) of a node in an XML tree\\n\",summary:\"<p> The depth (level) of a node in an XML tree\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to check</div>'}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-attribute-names\",qname:\"functx:distinct-attribute-names\",signature:\"($nodes as node()*) as xs:string*\",description:\" The distinct names of all attributes in an XML fragment\\n\",summary:\"<p> The distinct names of all attributes in an XML fragment\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root to start from</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-deep\",qname:\"functx:distinct-deep\",signature:\"($nodes as node()*) as node()*\",description:\" The XML nodes with distinct values, taking into account attributes and descendants\\n\",summary:\"<p> The XML nodes with distinct values, taking into account attributes and descendants\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to test</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-element-names\",qname:\"functx:distinct-element-names\",signature:\"($nodes as node()*) as xs:string*\",description:\" The distinct names of all elements in an XML fragment\\n\",summary:\"<p> The distinct names of all elements in an XML fragment\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root(s) to start from</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-element-paths\",qname:\"functx:distinct-element-paths\",signature:\"($nodes as node()*) as xs:string*\",description:\" The distinct paths of all descendant elements in an XML fragment\\n\",summary:\"<p> The distinct paths of all descendant elements in an XML fragment\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root(s) to start from</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct-nodes\",qname:\"functx:distinct-nodes\",signature:\"($nodes as node()*) as node()*\",description:\" The distinct XML nodes in a sequence (by node identity)\\n\",summary:\"<p> The distinct XML nodes in a sequence (by node identity)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node sequence</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"duration-from-timezone\",qname:\"functx:duration-from-timezone\",signature:\"($timezone as xs:string) as xs:dayTimeDuration\",description:' Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration\\n',summary:'<p> Converts a timezone like \"-05:00\" or \"Z\" into xs:dayTimeDuration\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"timezone\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the time zone, in (+|-)HH:MM format</div>'}],returns:{type:\"xs:dayTimeDuration\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"dynamic-path\",qname:\"functx:dynamic-path\",signature:\"($parent as node(), $path as xs:string) as item()*\",description:\" Dynamically evaluates a simple XPath path\\n\",summary:\"<p> Dynamically evaluates a simple XPath path\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"parent\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root to start from</div>'},{name:\"path\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the path expression</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"escape-for-regex\",qname:\"functx:escape-for-regex\",signature:\"($arg as xs:string?) as xs:string\",description:\" Escapes regex special characters\\n\",summary:\"<p> Escapes regex special characters\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to escape</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"exclusive-or\",qname:\"functx:exclusive-or\",signature:\"($arg1 as xs:boolean?, $arg2 as xs:boolean?) as xs:boolean?\",description:\" Whether one (and only one) of two boolean values is true\\n\",summary:\"<p> Whether one (and only one) of two boolean values is true\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first boolean value</div>'},{name:\"arg2\",type:\"xs:boolean\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second boolean value</div>'}],returns:{type:\"xs:boolean?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"first-day-of-month\",qname:\"functx:first-day-of-month\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The first day of the month of a date\\n\",summary:\"<p> The first day of the month of a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"first-day-of-year\",qname:\"functx:first-day-of-year\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The first day of the year of a date\\n\",summary:\"<p> The first day of the year of a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"first-node\",qname:\"functx:first-node\",signature:\"($nodes as node()*) as node()?\",description:\" The XML node in a sequence that appears first in document order\\n\",summary:\"<p> The XML node in a sequence that appears first in document order\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes</div>'}],returns:{type:\"node()?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"follows-not-descendant\",qname:\"functx:follows-not-descendant\",signature:\"($a as node()?, $b as node()?) as xs:boolean\",description:\" Whether an XML node follows another without being its descendant\\n\",summary:\"<p> Whether an XML node follows another without being its descendant\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"a\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first node</div>'},{name:\"b\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second node</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"format-as-title-en\",qname:\"functx:format-as-title-en\",signature:\"($titles as xs:string*) as xs:string*\",description:' Moves title words like \"the\" and \"a\" to the end of strings\\n',summary:'<p> Moves title words like \"the\" and \"a\" to the end of strings\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"titles\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the titles to format</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"fragment-from-uri\",qname:\"functx:fragment-from-uri\",signature:\"($uri as xs:string?) as xs:string?\",description:\" Returns the fragment from a URI\\n\",summary:\"<p> Returns the fragment from a URI\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"get-matches-and-non-matches\",qname:\"functx:get-matches-and-non-matches\",signature:\"($string as xs:string?, $regex as xs:string) as element(*)*\",description:\" Splits a string into matching and non-matching regions\\n\",summary:\"<p> Splits a string into matching and non-matching regions\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to split</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the pattern</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"get-matches\",qname:\"functx:get-matches\",signature:\"($string as xs:string?, $regex as xs:string) as xs:string*\",description:\" Return the matching regions of a string\\n\",summary:\"<p> Return the matching regions of a string\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to split</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the pattern</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"has-element-only-content\",qname:\"functx:has-element-only-content\",signature:\"($element as element(*)) as xs:boolean\",description:\" Whether an element has element-only content\\n\",summary:\"<p> Whether an element has element-only content\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the XML element to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"has-empty-content\",qname:\"functx:has-empty-content\",signature:\"($element as element(*)) as xs:boolean\",description:\" Whether an element has empty content\\n\",summary:\"<p> Whether an element has empty content\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the XML element to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"has-mixed-content\",qname:\"functx:has-mixed-content\",signature:\"($element as element(*)) as xs:boolean\",description:\" Whether an element has mixed content\\n\",summary:\"<p> Whether an element has mixed content\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the XML element to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"has-simple-content\",qname:\"functx:has-simple-content\",signature:\"($element as element(*)) as xs:boolean\",description:\" Whether an element has simple content\\n\",summary:\"<p> Whether an element has simple content\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the XML element to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"id-from-element\",qname:\"functx:id-from-element\",signature:\"($element as element(*)?) as xs:string?\",description:\" Gets the ID of an XML element\\n\",summary:\"<p> Gets the ID of an XML element\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"id-untyped\",qname:\"functx:id-untyped\",signature:\"($node as node()*, $id as xs:anyAtomicType) as element(*)*\",description:\" Gets XML element(s) that have an attribute with a particular value\\n\",summary:\"<p> Gets XML element(s) that have an attribute with a particular value\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root node(s) to start from</div>'},{name:\"id\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the \"id\" to find</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"if-absent\",qname:\"functx:if-absent\",signature:\"($arg as item()*, $value as item()*) as item()*\",description:\" The first argument if it is not empty, otherwise the second argument\\n\",summary:\"<p> The first argument if it is not empty, otherwise the second argument\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the item(s) that may be absent</div>'},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the item(s) to use if the item is absent</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"if-empty\",qname:\"functx:if-empty\",signature:\"($arg as item()?, $value as item()*) as item()*\",description:\" The first argument if it is not blank, otherwise the second argument\\n\",summary:\"<p> The first argument if it is not blank, otherwise the second argument\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node that may be empty</div>'},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the item(s) to use if the node is empty</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-deep-equal-node\",qname:\"functx:index-of-deep-equal-node\",signature:\"($nodes as node()*, $nodeToFind as node()) as xs:integer*\",description:\" The position of a node in a sequence, based on contents and attributes\\n\",summary:\"<p> The position of a node in a sequence, based on contents and attributes\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node sequence</div>'},{name:\"nodeToFind\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to find in the sequence</div>'}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-match-first\",qname:\"functx:index-of-match-first\",signature:\"($arg as xs:string?, $pattern as xs:string) as xs:integer?\",description:\" The first position of a matching substring\\n\",summary:\"<p> The first position of a matching substring\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the pattern to match</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-node\",qname:\"functx:index-of-node\",signature:\"($nodes as node()*, $nodeToFind as node()) as xs:integer*\",description:\" The position of a node in a sequence, based on node identity\\n\",summary:\"<p> The position of a node in a sequence, based on node identity\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node sequence</div>'},{name:\"nodeToFind\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to find in the sequence</div>'}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-string-first\",qname:\"functx:index-of-string-first\",signature:\"($arg as xs:string?, $substring as xs:string) as xs:integer?\",description:\" The first position of a substring\\n\",summary:\"<p> The first position of a substring\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string</div>'},{name:\"substring\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the substring to find</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-string-last\",qname:\"functx:index-of-string-last\",signature:\"($arg as xs:string?, $substring as xs:string) as xs:integer?\",description:\" The last position of a substring\\n\",summary:\"<p> The last position of a substring\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string</div>'},{name:\"substring\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the substring to find</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"index-of-string\",qname:\"functx:index-of-string\",signature:\"($arg as xs:string?, $substring as xs:string) as xs:integer*\",description:\" The position(s) of a substring\\n\",summary:\"<p> The position(s) of a substring\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string</div>'},{name:\"substring\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the substring to find</div>'}],returns:{type:\"xs:integer*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"insert-string\",qname:\"functx:insert-string\",signature:\"($originalString as xs:string?, $stringToInsert as xs:string?, $pos as xs:integer) as xs:string\",description:\" Inserts a string at a specified position\\n\",summary:\"<p> Inserts a string at a specified position\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"originalString\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the original string to insert into</div>'},{name:\"stringToInsert\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to insert</div>'},{name:\"pos\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the position</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-a-number\",qname:\"functx:is-a-number\",signature:\"($value as xs:anyAtomicType?) as xs:boolean\",description:\" Whether a value is numeric\\n\",summary:\"<p> Whether a value is numeric\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-absolute-uri\",qname:\"functx:is-absolute-uri\",signature:\"($uri as xs:string?) as xs:boolean\",description:\" Whether a URI is absolute\\n\",summary:\"<p> Whether a URI is absolute\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI to test</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-ancestor\",qname:\"functx:is-ancestor\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean\",description:\" Whether an XML node is an ancestor of another node\\n\",summary:\"<p> Whether an XML node is an ancestor of another node\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first node</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second node</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-descendant\",qname:\"functx:is-descendant\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean\",description:\" Whether an XML node is a descendant of another node\\n\",summary:\"<p> Whether an XML node is a descendant of another node\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first node</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second node</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-leap-year\",qname:\"functx:is-leap-year\",signature:\"($date as xs:anyAtomicType?) as xs:boolean\",description:\" Whether a date falls in a leap year\\n\",summary:\"<p> Whether a date falls in a leap year\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date or year</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-node-among-descendants-deep-equal\",qname:\"functx:is-node-among-descendants-deep-equal\",signature:\"($node as node()?, $seq as node()*) as xs:boolean\",description:\" Whether an XML node is among the descendants of a sequence, based on contents and attributes\\n\",summary:\"<p> Whether an XML node is among the descendants of a sequence, based on contents and attributes\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to test</div>'},{name:\"seq\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to search</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-node-among-descendants\",qname:\"functx:is-node-among-descendants\",signature:\"($node as node()?, $seq as node()*) as xs:boolean\",description:\" Whether an XML node is among the descendants of a sequence, based on node identity\\n\",summary:\"<p> Whether an XML node is among the descendants of a sequence, based on node identity\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to test</div>'},{name:\"seq\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to search</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-node-in-sequence-deep-equal\",qname:\"functx:is-node-in-sequence-deep-equal\",signature:\"($node as node()?, $seq as node()*) as xs:boolean\",description:\" Whether an XML node is in a sequence, based on contents and attributes\\n\",summary:\"<p> Whether an XML node is in a sequence, based on contents and attributes\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to test</div>'},{name:\"seq\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to search</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-node-in-sequence\",qname:\"functx:is-node-in-sequence\",signature:\"($node as node()?, $seq as node()*) as xs:boolean\",description:\" Whether an XML node is in a sequence, based on node identity\\n\",summary:\"<p> Whether an XML node is in a sequence, based on node identity\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to test</div>'},{name:\"seq\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to search</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"is-value-in-sequence\",qname:\"functx:is-value-in-sequence\",signature:\"($value as xs:anyAtomicType?, $seq as xs:anyAtomicType*) as xs:boolean\",description:\" Whether an atomic value appears in a sequence\\n\",summary:\"<p> Whether an atomic value appears in a sequence\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"value\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the atomic value to test</div>'},{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values to search</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"last-day-of-month\",qname:\"functx:last-day-of-month\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The last day of the month of a date\\n\",summary:\"<p> The last day of the month of a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"last-day-of-year\",qname:\"functx:last-day-of-year\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The last day of the month of a date\\n\",summary:\"<p> The last day of the month of a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"last-node\",qname:\"functx:last-node\",signature:\"($nodes as node()*) as node()?\",description:\" The XML node in a sequence that is last in document order\\n\",summary:\"<p> The XML node in a sequence that is last in document order\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes</div>'}],returns:{type:\"node()?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"leaf-elements\",qname:\"functx:leaf-elements\",signature:\"($root as node()?) as element(*)*\",description:\" All XML elements that don't have any child elements\\n\",summary:\"<p> All XML elements that don't have any child elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"root\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"left-trim\",qname:\"functx:left-trim\",signature:\"($arg as xs:string?) as xs:string\",description:\" Trims leading whitespace\\n\",summary:\"<p> Trims leading whitespace\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to trim</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"line-count\",qname:\"functx:line-count\",signature:\"($arg as xs:string?) as xs:integer\",description:\" The number of lines\\n\",summary:\"<p> The number of lines\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to test</div>'}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"lines\",qname:\"functx:lines\",signature:\"($arg as xs:string?) as xs:string*\",description:\" Split a string into separate lines\\n\",summary:\"<p> Split a string into separate lines\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to split</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max-depth\",qname:\"functx:max-depth\",signature:\"($root as node()?) as xs:integer?\",description:\" The maximum depth of elements in an XML tree\\n\",summary:\"<p> The maximum depth of elements in an XML tree\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"root\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root to start from</div>'}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max-determine-type\",qname:\"functx:max-determine-type\",signature:\"($seq as xs:anyAtomicType*) as xs:anyAtomicType?\",description:\" The maximum value in a sequence, figuring out its type (numeric or string)\\n\",summary:\"<p> The maximum value in a sequence, figuring out its type (numeric or string)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values to test</div>'}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max-line-length\",qname:\"functx:max-line-length\",signature:\"($arg as xs:string?) as xs:integer\",description:\" The maximum line length\\n\",summary:\"<p> The maximum line length\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to test</div>'}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max-node\",qname:\"functx:max-node\",signature:\"($nodes as node()*) as node()*\",description:\" The XML node whose typed value is the maximum\\n\",summary:\"<p> The XML node whose typed value is the maximum\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to test</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"max-string\",qname:\"functx:max-string\",signature:\"($strings as xs:anyAtomicType*) as xs:string?\",description:\" The maximum of a sequence of values, treating them like strings\\n\",summary:\"<p> The maximum of a sequence of values, treating them like strings\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"strings\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"min-determine-type\",qname:\"functx:min-determine-type\",signature:\"($seq as xs:anyAtomicType*) as xs:anyAtomicType?\",description:\" The minimum value in a sequence, figuring out its type (numeric or string)\\n\",summary:\"<p> The minimum value in a sequence, figuring out its type (numeric or string)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values to test</div>'}],returns:{type:\"xs:anyAtomicType?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"min-node\",qname:\"functx:min-node\",signature:\"($nodes as node()*) as node()*\",description:\" The XML node whose typed value is the minimum\\n\",summary:\"<p> The XML node whose typed value is the minimum\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of nodes to test</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"min-non-empty-string\",qname:\"functx:min-non-empty-string\",signature:\"($strings as xs:string*) as xs:string?\",description:' The minimum of a sequence of strings, ignoring \"empty\" values\\n',summary:'<p> The minimum of a sequence of strings, ignoring \"empty\" values\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"strings\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of strings to search</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"min-string\",qname:\"functx:min-string\",signature:\"($strings as xs:anyAtomicType*) as xs:string?\",description:\" The minimum of a sequence of values, treating them like strings\\n\",summary:\"<p> The minimum of a sequence of values, treating them like strings\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"strings\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of strings</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"mmddyyyy-to-date\",qname:\"functx:mmddyyyy-to-date\",signature:\"($dateString as xs:string?) as xs:date?\",description:\" Converts a string with format MMDDYYYY (with any delimiters) to a date\\n\",summary:\"<p> Converts a string with format MMDDYYYY (with any delimiters) to a date\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dateString\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the MMDDYYYY string</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"month-abbrev-en\",qname:\"functx:month-abbrev-en\",signature:\"($date as xs:anyAtomicType?) as xs:string?\",description:\" The month of a date as an abbreviated word (Jan, Feb, etc.)\\n\",summary:\"<p> The month of a date as an abbreviated word (Jan, Feb, etc.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"month-name-en\",qname:\"functx:month-name-en\",signature:\"($date as xs:anyAtomicType?) as xs:string?\",description:\" The month of a date as a word (January, February, etc.)\\n\",summary:\"<p> The month of a date as a word (January, February, etc.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"name-test\",qname:\"functx:name-test\",signature:\"($testname as xs:string?, $names as xs:string*) as xs:boolean\",description:\" Whether a name matches a list of names or name wildcards\\n\",summary:\"<p> Whether a name matches a list of names or name wildcards\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"testname\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name to test</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the list of names or name wildcards</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"namespaces-in-use\",qname:\"functx:namespaces-in-use\",signature:\"($root as node()?) as xs:anyURI*\",description:\" A list of namespaces used in element/attribute names in an XML fragment\\n\",summary:\"<p> A list of namespaces used in element/attribute names in an XML fragment\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"root\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root node to start from</div>'}],returns:{type:\"xs:anyURI*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"next-day\",qname:\"functx:next-day\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The next day\\n\",summary:\"<p> The next day\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"node-kind\",qname:\"functx:node-kind\",signature:\"($nodes as node()*) as xs:string*\",description:\" The XML node kind (element, attribute, text, etc.)\\n\",summary:\"<p> The XML node kind (element, attribute, text, etc.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node(s) whose kind you want to determine</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"non-distinct-values\",qname:\"functx:non-distinct-values\",signature:\"($seq as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" Returns any values that appear more than once in a sequence\\n\",summary:\"<p> Returns any values that appear more than once in a sequence\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of values</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"number-of-matches\",qname:\"functx:number-of-matches\",signature:\"($arg as xs:string?, $pattern as xs:string) as xs:integer\",description:\" The number of regions that match a pattern\\n\",summary:\"<p> The number of regions that match a pattern\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to test</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the regular expression</div>'}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"ordinal-number-en\",qname:\"functx:ordinal-number-en\",signature:\"($num as xs:integer?) as xs:string\",description:\" Reformats a number as an ordinal number, e.g. 1st, 2nd, 3rd.\\n\",summary:\"<p> Reformats a number as an ordinal number, e.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"num\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"pad-integer-to-length\",qname:\"functx:pad-integer-to-length\",signature:\"($integerToPad as xs:anyAtomicType?, $length as xs:integer) as xs:string\",description:\" Pads an integer to a desired length by adding leading zeros\\n\",summary:\"<p> Pads an integer to a desired length by adding leading zeros\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"integerToPad\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the integer to pad</div>'},{name:\"length\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired length</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"pad-string-to-length\",qname:\"functx:pad-string-to-length\",signature:\"($stringToPad as xs:string?, $padChar as xs:string, $length as xs:integer) as xs:string\",description:\" Pads a string to a desired length\\n\",summary:\"<p> Pads a string to a desired length\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"stringToPad\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to pad</div>'},{name:\"padChar\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the character(s) to use as padding</div>'},{name:\"length\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired length</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"path-to-node-with-pos\",qname:\"functx:path-to-node-with-pos\",signature:\"($node as node()?) as xs:string\",description:\" A unique path to an XML node (or sequence of nodes)\\n\",summary:\"<p> A unique path to an XML node (or sequence of nodes)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node sequence</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"path-to-node\",qname:\"functx:path-to-node\",signature:\"($nodes as node()*) as xs:string*\",description:\" A path to an XML node (or sequence of nodes)\\n\",summary:\"<p> A path to an XML node (or sequence of nodes)\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node sequence</div>'}],returns:{type:\"xs:string*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"precedes-not-ancestor\",qname:\"functx:precedes-not-ancestor\",signature:\"($a as node()?, $b as node()?) as xs:boolean\",description:\" Whether an XML node precedes another without being its ancestor\\n\",summary:\"<p> Whether an XML node precedes another without being its ancestor\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"a\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first node</div>'},{name:\"b\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second node</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"previous-day\",qname:\"functx:previous-day\",signature:\"($date as xs:anyAtomicType?) as xs:date?\",description:\" The previous day\\n\",summary:\"<p> The previous day\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"date\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the date</div>'}],returns:{type:\"xs:date?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove-attributes-deep\",qname:\"functx:remove-attributes-deep\",signature:\"($nodes as node()*, $names as xs:string*) as node()*\",description:\" Removes attributes from an XML fragment, based on name\\n\",summary:\"<p> Removes attributes from an XML fragment, based on name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root(s) to start from</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the names of the attributes to remove, or * for all attributes</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove-attributes\",qname:\"functx:remove-attributes\",signature:\"($elements as element(*)*, $names as xs:string*) as element(*)\",description:\" Removes attributes from an XML element, based on name\\n\",summary:\"<p> Removes attributes from an XML element, based on name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) from which to remove the attributes</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the names of the attributes to remove, or * for all attributes</div>'}],returns:{type:\"element(*)\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove-elements-deep\",qname:\"functx:remove-elements-deep\",signature:\"($nodes as node()*, $names as xs:string*) as node()*\",description:\" Removes descendant elements from an XML node, based on name\\n\",summary:\"<p> Removes descendant elements from an XML node, based on name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> root(s) to start from</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the names of the elements to remove</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove-elements-not-contents\",qname:\"functx:remove-elements-not-contents\",signature:\"($nodes as node()*, $names as xs:string*) as node()*\",description:\" Removes descendant XML elements but keeps their content\\n\",summary:\"<p> Removes descendant XML elements but keeps their content\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the root(s) to start from</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the names of the elements to remove</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"remove-elements\",qname:\"functx:remove-elements\",signature:\"($elements as element(*)*, $names as xs:string*) as element(*)*\",description:\" Removes child elements from an XML node, based on name\\n\",summary:\"<p> Removes child elements from an XML node, based on name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) from which you wish to remove the children</div>'},{name:\"names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the names of the child elements to remove</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"repeat-string\",qname:\"functx:repeat-string\",signature:\"($stringToRepeat as xs:string?, $count as xs:integer) as xs:string\",description:\" Repeats a string a given number of times\\n\",summary:\"<p> Repeats a string a given number of times\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"stringToRepeat\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to repeat</div>'},{name:\"count\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the desired number of copies</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"replace-beginning\",qname:\"functx:replace-beginning\",signature:\"($arg as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string\",description:\" Replaces the beginning of a string, up to a matched pattern\\n\",summary:\"<p> Replaces the beginning of a string, up to a matched pattern\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the entire string to change</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the pattern of characters to replace up to</div>'},{name:\"replacement\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the replacement string</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"replace-element-values\",qname:\"functx:replace-element-values\",signature:\"($elements as element(*)*, $values as xs:anyAtomicType*) as element(*)*\",description:\" Updates the content of one or more elements\\n\",summary:\"<p> Updates the content of one or more elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the elements whose content you wish to replace</div>'},{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the replacement values</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"replace-first\",qname:\"functx:replace-first\",signature:\"($arg as xs:string?, $pattern as xs:string, $replacement as xs:string) as xs:string\",description:\" Replaces the first match of a pattern\\n\",summary:\"<p> Replaces the first match of a pattern\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the entire string to change</div>'},{name:\"pattern\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the pattern of characters to replace</div>'},{name:\"replacement\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the replacement string</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"replace-multi\",qname:\"functx:replace-multi\",signature:\"($arg as xs:string?, $changeFrom as xs:string*, $changeTo as xs:string*) as xs:string?\",description:\" Performs multiple replacements, using pairs of replace parameters\\n\",summary:\"<p> Performs multiple replacements, using pairs of replace parameters\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to manipulate</div>'},{name:\"changeFrom\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of strings or patterns to change from</div>'},{name:\"changeTo\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence of strings to change to</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"reverse-string\",qname:\"functx:reverse-string\",signature:\"($arg as xs:string?) as xs:string\",description:\" Reverses the order of characters\\n\",summary:\"<p> Reverses the order of characters\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to reverse</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"right-trim\",qname:\"functx:right-trim\",signature:\"($arg as xs:string?) as xs:string\",description:\" Trims trailing whitespace\\n\",summary:\"<p> Trims trailing whitespace\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to trim</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"scheme-from-uri\",qname:\"functx:scheme-from-uri\",signature:\"($uri as xs:string?) as xs:string?\",description:\" Returns the scheme from a URI\\n\",summary:\"<p> Returns the scheme from a URI\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"sequence-deep-equal\",qname:\"functx:sequence-deep-equal\",signature:\"($seq1 as item()*, $seq2 as item()*) as xs:boolean\",description:\" Whether two sequences have the same XML node content and/or values\\n\",summary:\"<p> Whether two sequences have the same XML node content and/or values\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence</div>'},{name:\"seq2\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"sequence-node-equal-any-order\",qname:\"functx:sequence-node-equal-any-order\",signature:\"($seq1 as node()*, $seq2 as node()*) as xs:boolean\",description:\" Whether two sequences contain the same XML nodes, regardless of order\\n\",summary:\"<p> Whether two sequences contain the same XML nodes, regardless of order\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence of nodes</div>'},{name:\"seq2\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence of nodes</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"sequence-node-equal\",qname:\"functx:sequence-node-equal\",signature:\"($seq1 as node()*, $seq2 as node()*) as xs:boolean\",description:\" Whether two sequences contain the same XML nodes, in the same order\\n\",summary:\"<p> Whether two sequences contain the same XML nodes, in the same order\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq1\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence of nodes</div>'},{name:\"seq2\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence of nodes</div>'}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sequence-type\",qname:\"functx:sequence-type\",signature:\"($items as item()*) as xs:string\",description:\" The sequence type that represents a sequence of nodes or values\\n\",summary:\"<p> The sequence type that represents a sequence of nodes or values\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the items whose sequence type you want to determine</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"siblings-same-name\",qname:\"functx:siblings-same-name\",signature:\"($element as element(*)?) as element(*)*\",description:\" The siblings of an XML element that have the same name\\n\",summary:\"<p> The siblings of an XML element that have the same name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"element\",type:\"element(*)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"siblings\",qname:\"functx:siblings\",signature:\"($node as node()?) as node()*\",description:\" The siblings of an XML node\\n\",summary:\"<p> The siblings of an XML node\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sort-as-numeric\",qname:\"functx:sort-as-numeric\",signature:\"($seq as item()*) as item()*\",description:\" Sorts a sequence of numeric values or nodes\\n\",summary:\"<p> Sorts a sequence of numeric values or nodes\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to sort</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sort-case-insensitive\",qname:\"functx:sort-case-insensitive\",signature:\"($seq as item()*) as item()*\",description:\" Sorts a sequence of values or nodes regardless of capitalization\\n\",summary:\"<p> Sorts a sequence of values or nodes regardless of capitalization\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to sort</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sort-document-order\",qname:\"functx:sort-document-order\",signature:\"($seq as node()*) as node()*\",description:\" Sorts a sequence of nodes in document order\\n\",summary:\"<p> Sorts a sequence of nodes in document order\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to sort</div>'}],returns:{type:\"node()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"sort\",qname:\"functx:sort\",signature:\"($seq as item()*) as item()*\",description:\" Sorts a sequence of values or nodes\\n\",summary:\"<p> Sorts a sequence of values or nodes\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"seq\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to sort</div>'}],returns:{type:\"item()*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-after-if-contains\",qname:\"functx:substring-after-if-contains\",signature:\"($arg as xs:string?, $delim as xs:string) as xs:string?\",description:\" Performs substring-after, returning the entire string if it does not contain the delimiter\\n\",summary:\"<p> Performs substring-after, returning the entire string if it does not contain the delimiter\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"delim\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the delimiter</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-after-last-match\",qname:\"functx:substring-after-last-match\",signature:\"($arg as xs:string?, $regex as xs:string) as xs:string\",description:\" The substring after the last text that matches a regex\\n\",summary:\"<p> The substring after the last text that matches a regex\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the regular expression</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-after-last\",qname:\"functx:substring-after-last\",signature:\"($arg as xs:string?, $delim as xs:string) as xs:string\",description:\" The substring after the last occurrence of a delimiter\\n\",summary:\"<p> The substring after the last occurrence of a delimiter\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"delim\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the delimiter</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-after-match\",qname:\"functx:substring-after-match\",signature:\"($arg as xs:string?, $regex as xs:string) as xs:string?\",description:\" The substring after the first text that matches a regex\\n\",summary:\"<p> The substring after the first text that matches a regex\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the regular expression</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-before-if-contains\",qname:\"functx:substring-before-if-contains\",signature:\"($arg as xs:string?, $delim as xs:string) as xs:string?\",description:\" Performs substring-before, returning the entire string if it does not contain the delimiter\\n\",summary:\"<p> Performs substring-before, returning the entire string if it does not contain the delimiter\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"delim\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the delimiter</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-before-last-match\",qname:\"functx:substring-before-last-match\",signature:\"($arg as xs:string?, $regex as xs:string) as xs:string?\",description:\" The substring after the first text that matches a regex\\n\",summary:\"<p> The substring after the first text that matches a regex\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the regular expression</div>'}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-before-last\",qname:\"functx:substring-before-last\",signature:\"($arg as xs:string?, $delim as xs:string) as xs:string\",description:\" The substring before the last occurrence of a delimiter\\n\",summary:\"<p> The substring before the last occurrence of a delimiter\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"delim\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the delimiter</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"substring-before-match\",qname:\"functx:substring-before-match\",signature:\"($arg as xs:string?, $regex as xs:string) as xs:string\",description:\" The substring before the last text that matches a regex\\n\",summary:\"<p> The substring before the last text that matches a regex\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to substring</div>'},{name:\"regex\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the regular expression</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"time\",qname:\"functx:time\",signature:\"($hour as xs:anyAtomicType, $minute as xs:anyAtomicType, $second as xs:anyAtomicType) as xs:time\",description:\" Construct a time from an hour, minute and second\\n\",summary:\"<p> Construct a time from an hour, minute and second\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hour\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the hour</div>'},{name:\"minute\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the minute</div>'},{name:\"second\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second</div>'}],returns:{type:\"xs:time\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"timezone-from-duration\",qname:\"functx:timezone-from-duration\",signature:\"($duration as xs:dayTimeDuration) as xs:string\",description:' Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\"\\n',summary:'<p> Converts an xs:dayTimeDuration into a timezone like \"-05:00\" or \"Z\"\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:dayTimeDuration\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-days-from-duration\",qname:\"functx:total-days-from-duration\",signature:\"($duration as xs:dayTimeDuration?) as xs:decimal?\",description:\" The total number of days in a dayTimeDuration\\n\",summary:\"<p> The total number of days in a dayTimeDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-hours-from-duration\",qname:\"functx:total-hours-from-duration\",signature:\"($duration as xs:dayTimeDuration?) as xs:decimal?\",description:\" The total number of hours in a dayTimeDuration\\n\",summary:\"<p> The total number of hours in a dayTimeDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-minutes-from-duration\",qname:\"functx:total-minutes-from-duration\",signature:\"($duration as xs:dayTimeDuration?) as xs:decimal?\",description:\" The total number of minutes in a dayTimeDuration\\n\",summary:\"<p> The total number of minutes in a dayTimeDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-months-from-duration\",qname:\"functx:total-months-from-duration\",signature:\"($duration as xs:yearMonthDuration?) as xs:decimal?\",description:\" The total number of months in a yearMonthDuration\\n\",summary:\"<p> The total number of months in a yearMonthDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:yearMonthDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-seconds-from-duration\",qname:\"functx:total-seconds-from-duration\",signature:\"($duration as xs:dayTimeDuration?) as xs:decimal?\",description:\" The total number of seconds in a dayTimeDuration\\n\",summary:\"<p> The total number of seconds in a dayTimeDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:dayTimeDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"total-years-from-duration\",qname:\"functx:total-years-from-duration\",signature:\"($duration as xs:yearMonthDuration?) as xs:decimal?\",description:\" The total number of years in a yearMonthDuration\\n\",summary:\"<p> The total number of years in a yearMonthDuration\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"duration\",type:\"xs:yearMonthDuration\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the duration</div>'}],returns:{type:\"xs:decimal?\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"trim\",qname:\"functx:trim\",signature:\"($arg as xs:string?) as xs:string\",description:\" Trims leading and trailing whitespace\\n\",summary:\"<p> Trims leading and trailing whitespace\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to trim</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:3,name:\"update-attributes\",qname:\"functx:update-attributes\",signature:\"($elements as element(*)*, $attrNames as xs:QName*, $attrValues as xs:anyAtomicType*) as element(*)?\",description:\" Updates the attribute value of an XML element\\n\",summary:\"<p> Updates the attribute value of an XML element\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"elements\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the element(s) for which you wish to update the attribute</div>'},{name:\"attrNames\",type:\"xs:QName\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name(s) of the attribute(s) to add</div>'},{name:\"attrValues\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value(s) of the attribute(s) to add</div>'}],returns:{type:\"element(*)?\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"value-except\",qname:\"functx:value-except\",signature:\"($arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" The values in one sequence that aren't in another sequence\\n\",summary:\"<p> The values in one sequence that aren't in another sequence\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"value-intersect\",qname:\"functx:value-intersect\",signature:\"($arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" The intersection of two sequences of values\\n\",summary:\"<p> The intersection of two sequences of values\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"value-union\",qname:\"functx:value-union\",signature:\"($arg1 as xs:anyAtomicType*, $arg2 as xs:anyAtomicType*) as xs:anyAtomicType*\",description:\" The union of two sequences of values\\n\",summary:\"<p> The union of two sequences of values\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg1\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first sequence</div>'},{name:\"arg2\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second sequence</div>'}],returns:{type:\"xs:anyAtomicType*\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"word-count\",qname:\"functx:word-count\",signature:\"($arg as xs:string?) as xs:integer\",description:\" The number of words\\n\",summary:\"<p> The number of words\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to measure</div>'}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"words-to-camel-case\",qname:\"functx:words-to-camel-case\",signature:\"($arg as xs:string?) as xs:string\",description:\" Turns a string of words into camelCase\\n\",summary:\"<p> Turns a string of words into camelCase\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the string to modify</div>'}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"wrap-values-in-elements\",qname:\"functx:wrap-values-in-elements\",signature:\"($values as xs:anyAtomicType*, $elementName as xs:QName) as element(*)*\",description:\" Wraps a sequence of atomic values in XML elements\\n\",summary:\"<p> Wraps a sequence of atomic values in XML elements\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"values\",type:\"xs:anyAtomicType\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the values to wrap in elements</div>'},{name:\"elementName\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the elements to construct</div>'}],returns:{type:\"element(*)*\",description:\"\"},errors:[]},{isDocumented:!0,arity:2,name:\"yearMonthDuration\",qname:\"functx:yearMonthDuration\",signature:\"($years as xs:decimal?, $months as xs:integer?) as xs:yearMonthDuration\",description:\" Construct a yearMonthDuration from a number of years and months\\n\",summary:\"<p> Construct a yearMonthDuration from a number of years and months\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"years\",type:\"xs:decimal\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of years</div>'},{name:\"months\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the number of months</div>'}],returns:{type:\"xs:yearMonthDuration\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/zorba-query\":{ns:\"http://zorba.io/modules/zorba-query\",description:\" This module contains functions to compile and evaluate queries\\n written in either JSONiq or XQuery. Also, it contains function that\\n allow to parameterize the static or dynamic evaluation phase.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Juan Zacarias</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/features\",prefix:\"f\"},{uri:\"http://zorba.io/options/features\",prefix:\"op\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/modules/zorba-query\",prefix:\"zq\"}],functions:[{isDocumented:!0,arity:2,name:\"bind-context-item\",qname:\"zq:bind-context-item\",signature:\"($query-key as xs:anyURI, $dot as item()) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function binds the context-item of the prepared query\\n identified by the given key to the $dot argument.</p>\\n',summary:\"<p>  This function binds the context-item of the prepared query\\n identified by the given key to the $dot argument.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'},{name:\"dot\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the context item to bind</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"bind-variable\",qname:\"zq:bind-variable\",signature:\"($query-key as xs:anyURI, $var as xs:QName, $value as item()*) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function binds the variable with name $name of\\n the prepared query identified by $query-key to the given sequence.</p>\\n',summary:\"<p>  This function binds the variable with name $name of\\n the prepared query identified by $query-key to the given sequence.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'},{name:\"var\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"value\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the sequence to which the external variable $name should be bound</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:UNDECLARED_VARIABLE if the given variable is not declared in the query.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-query\",qname:\"zq:delete-query\",signature:\"($query-key as xs:anyURI) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Deletes the prepared query associated with the given identifier.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">After the query is deleted, the corresponding identifier should\\n not be used as argument to any of the functions of this module.</p>\\n',summary:\"<p>  Deletes the prepared query associated with the given identifier.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"empty-sequence()\",description:\"the function has side effects and returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"evaluate-sequential\",qname:\"zq:evaluate-sequential\",signature:\"($query-key as xs:string) as item()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Evaluates the given prepared query and returns the result\\n of the evaluation. The query must be sequential.</p>\\n',summary:\"<p>  Evaluates the given prepared query and returns the result\\n of the evaluation.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"query-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"item()*\",description:\"the result of evaluating the query.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_NOT_SEQUENTIAL if the query is not sequential.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_IS_UPDATING if the query is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any dynamic error that is raised by evaluating the given query.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"evaluate-updating\",qname:\"zq:evaluate-updating\",signature:\"($query-key as xs:anyURI) external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Evaluates the given prepared query and applies the updates\\n computed by this query. The query must be an updating query.</p>\\n',summary:\"<p>  Evaluates the given prepared query and applies the updates\\n computed by this query.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:null,description:\"the function has side effects because it applies the updates of the query. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_NOT_UPDATING if the query is not an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_IS_SEQUENTIAL if the query is sequential.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any dynamic error that is raised by evaluating the given query or applying its updates.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"evaluate\",qname:\"zq:evaluate\",signature:\"($query-key as xs:anyURI) as item()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Evaluates the given prepared query and returns the result\\n of the evaluation. The query must not be sequential or\\n updating.</p>\\n',summary:\"<p>  Evaluates the given prepared query and returns the result\\n of the evaluation.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"item()*\",description:\"the result of evaluating the given query\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_IS_UPDATING if the query is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:QUERY_IS_SEQUENTIAL if the query is sequential.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any dynamic error that is raised by evaluating the given query.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"external-variables\",qname:\"zq:external-variables\",signature:\"($query-key as xs:anyURI) as xs:QName* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the names of the external variables that\\n are declared in the given query (either in the main module or\\n in any of the imported library modules).</p>\\n',summary:\"<p>  The function returns the names of the external variables that\\n are declared in the given query (either in the main module or\\n in any of the imported library modules).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"xs:QName*\",description:\"the sequence of names of the said external variables.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-bound-context-item\",qname:\"zq:is-bound-context-item\",signature:\"($query-key as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function tests if the context-item is bound for the\\n execution of the query referred to by the given query identifier.</p>\\n',summary:\"<p>  The function tests if the context-item is bound for the\\n execution of the query referred to by the given query identifier.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"xs:boolean\",description:\"true if the context-item is bound, false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"is-bound-variable\",qname:\"zq:is-bound-variable\",signature:\"($query-key as xs:anyURI, $var-name as xs:QName) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function tests if the given variable is bound for the\\n execution of the query referred to by the given query identifier.</p>\\n',summary:\"<p>  The function tests if the given variable is bound for the\\n execution of the query referred to by the given query identifier.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'},{name:\"var-name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the variable</div>'}],returns:{type:\"xs:boolean\",description:\"true if the variable is bound, false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:UNDECLARED_VARIABLE if the given variable is not declared in the query.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-sequential\",qname:\"zq:is-sequential\",signature:\"($query-key as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function tests if the query identified by the given key\\n is sequential query.</p>\\n',summary:\"<p>  The function tests if the query identified by the given key\\n is sequential query.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"xs:boolean\",description:\"true if the query is a sequential, false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-updating\",qname:\"zq:is-updating\",signature:\"($query-key as xs:anyURI) as xs:boolean external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function tests if the query identified by the given key\\n is an updating query.</p>\\n',summary:\"<p>  The function tests if the query identified by the given key\\n is an updating query.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier for a compiled query</div>'}],returns:{type:\"xs:boolean\",description:\"true if the query is an updating query, false otherwise.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"load-from-query-plan\",qname:\"zq:load-from-query-plan\",signature:\"($plan as xs:base64Binary) as xs:anyURI external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function loads a given query for execution from a\\n xs:base64Binary query plan, obtained through the zq:query-plan function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the query was successfully loaded, the function returns an\\n identifier as xs:anyURI. This URI can be passed to other functions\\n of this module (e.g. to actually evaluate the query). The URI\\n is opaque and its lifetime is bound by the lifetime of the query\\n that invoked this function. Further reference or uses\\n of the identifier lead to unexpected results.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Successfully prepared queries need to be deleted by passing the resulting\\n identifier to the zq:delete-query function of this module.</p>\\n',summary:\"<p>  The function loads a given query for execution from a\\n xs:base64Binary query plan, obtained through the zq:query-plan function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"plan\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the binary query plan.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for the compiled query that can be passed as arguments to other functions of this module.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any (static or type) error that may be raised during the compilation of the query. For example, err:XPST0003 if the given query could not be parsed.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"load-from-query-plan\",qname:\"zq:load-from-query-plan\",signature:\"($plan as xs:base64Binary, $resolver as item()?, $mapper as item()?) as xs:anyURI external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function loads a given query for execution from a\\n xs:base64Binary query plan, obtained through the zq:query-plan function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the query was successfully loaded, the function returns an\\n identifier as xs:anyURI. This URI can be passed to other functions\\n of this module (e.g. to actually evaluate the query). The URI\\n is opaque and its lilfetime is bound by the lifetime of the query\\n that invoked this function. Further reference or uses\\n of the identifier lead to unexpected results.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For important notes regarding the second and third parameters of the\\n function, review the comments in zq:prepare-main-module#3.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Successfully prepared queries need to be deleted by passing the resulting\\n identifier to the zq:delete-query function of this module.</p>\\n',summary:\"<p>  The function loads a given query for execution from a\\n xs:base64Binary query plan, obtained through the zq:query-plan function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"plan\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the binary query plan.</div>'},{name:\"resolver\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL resolver function.</div>'},{name:\"mapper\",type:\"item()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI mapper function.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for the compiled query that can be passed as arguments to other functions of this module.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any (static or type) error that may be raised during the compilation of the query. For example, err:XPST0003 if the given query could not be parsed.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"prepare-library-module\",qname:\"zq:prepare-library-module\",signature:\"($library-module-text as xs:string) as empty-sequence() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function compiles a given XQuery or JSONiq library module.\\n It can be used to compile-check a module.</p>\\n',summary:\"<p>  This function compiles a given XQuery or JSONiq library module.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"library-module-text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the library module that should be prepared.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty-sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any (static or type) error that may be raised during the compilation of the library module. For example, err:XPST0003 if the given library module could not be parsed.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"prepare-main-module\",qname:\"zq:prepare-main-module\",signature:\"($main-module-text as xs:string) as xs:anyURI external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function prepares a given a query for execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the query was successfully compiled, the function returns an\\n identifier as xs:anyURI. This URI can be passed to other functions\\n of this module (e.g. to actually evaluate the query). The URI\\n is opaque and its lifetime is bound by the lifetime of the query\\n that invoked this function. Further reference or uses\\n of the identifier lead to unexpected results.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Successfully prepared queries need to be deleted by passing the resulting\\n identifier to the zq:delete-query function of this module.</p>\\n',summary:\"<p>  The function prepares a given a query for execution.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"main-module-text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query that should be prepared. The query needs to be a XQuery or JSONiq main module.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for the compiled query that can be passed as arguments to other functions of this module.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any (static or type) error that may be raised during the compilation of the query. For example, err:XPST0003 if the given query could not be parsed.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"prepare-main-module\",qname:\"zq:prepare-main-module\",signature:\"($main-module-text as xs:string, $resolver as function (xs:string, xs:string) as item()??, $mapper as function (xs:string, xs:string) as xs:string*?) as xs:anyURI external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function prepares a given query for execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the query was successfully compiled, the function returns an\\n identifier as xs:anyURI. This URI can be passed to other functions\\n of this module (e.g. to actually evaluate the query). The URI\\n is opaque and its lifetime is bound by the lifetime of the query\\n that invoked this function. Further reference or uses\\n of the identifier lead to unexpected results.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Important notes regarding the second and third parameters of the function:</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">--------------------------------------------------------------------------</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">These parameters allow you to specify a URL resolver and a URI mapper\\n for Zorba to use when executing this query. See\\n <a href=\"http://www.zorba-xquery.com/html/documentation/2.7.0/zorba/uriresolvers\">here</a></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The second parameter is a function item for a URL\\n resolver. The URL resolver function must recive 2 parameters:\\n <li>A $namespace as xs:string that will contain the url to be resolved.</li>\\n <li>A $entity as xs:string that will contain the type of resolving needed.\\n   This can be one of two values: \"module\" or \"schema\".</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function must return the empty sequence when the specified $namespace\\n or $entity are not the ones to be resolved.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">declare function mymod:url-resolver($namespace as xs:string, $entity as xs:string) as item()?\\n {\\n  if($namespace = \\'http://test.xq\\')\\n  then \"module namespace test = \\'http://test\\'; declare function test:foo(){\\'foo\\'};\"\\n  else ()\\n };</pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The URL resolver function\\'s namespace, name, and parameter naming are\\n not restricted by ZQ.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The URL resolver function\\'s return type is not restricted, it could be a string, a sequence,\\n a node, etc. All the outputs types are to be serialized as a string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The third parameter is a function item for a URI mapper.</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The URI mapper function, just like the URL resolver, receives 2 parameters:\\n <li>A $namespace as xs:string that will contain the URI to be mapped.</li>\\n <li>A $entity as xs:string that will contain the type of resolving needed.\\n   This can be one of two values: \"module\" or \"schema\".</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The URI mapper must return an empty sequence when the specified $namesapce or $entity\\n are not to be mapped. Unlike the URL resolver this function must return a sequence of strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example:</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">declare function mymod:uri-mapper($namespace as xs:string, $entity as xs:string)\\n {\\n  if($namespace = \\'http://test\\')\\n  then (\"http://zorba.io/test\", \"http://foo.com/schema/test\")\\n  else ()\\n };</pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The URI mapper function\\'s namespace, name, and parameter naming are\\n not restricted by ZQ.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In order to pass the above URL resolver and URI mapper to this function,\\n use the following syntax:</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n   <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">variable $queryID := zq:prepare-main-module(\"..query text..\",\\n      mymod:url-resolver#2, mymod:uri-mapper#2);</pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">That is, the QName of the function followed by \"#2\". This is XQuery\\n \"higher-order function\" syntax, meaning the function with the specified\\n QName which takes two arguments. Since URL resolvers and URI mappers\\n must take two arguments, both will always be specified with \"#2\".</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Both the URL resolver and URI mapper functions are optional, meaning you\\n may pass the empty-sequence () for either.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Successfully prepared queries need to be deleted by passing the resulting\\n identifier to the zq:delete-query function of this module.</p>\\n',summary:\"<p>  The function prepares a given query for execution.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"main-module-text\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the query that should be prepared. The query needs to be a XQuery or JSONiq main module.</div>'},{name:\"resolver\",type:\"function (xs:string, xs:string) as item()?\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URL resolver function.</div>'},{name:\"mapper\",type:\"function (xs:string, xs:string) as xs:string*\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the URI mapper function.</div>'}],returns:{type:\"xs:anyURI\",description:\"an identifier for the compiled query that can be passed as arguments to other functions of this module.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">any (static or type) error that may be raised during the compilation of the query. For example, err:XPST0003 if the given query could not be parsed.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"query-plan\",qname:\"zq:query-plan\",signature:\"($query-key as xs:anyURI) as xs:base64Binary external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the compiled query identified by the given query-key\\n as binary data.</p>\\n',summary:\"<p>  Returns the compiled query identified by the given query-key\\n as binary data.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier of a compiled query.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the query as xs:base64Binary.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_PLAN if there is an error serializing the query.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"variable-value\",qname:\"zq:variable-value\",signature:\"($query-key as xs:anyURI, $var-name as xs:QName) as item()* external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns the value of a variable that is bound in the\\n given query.</p>\\n',summary:\"<p>  This function returns the value of a variable that is bound in the\\n given query.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"query-key\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier of a compiled query.</div>'},{name:\"var-name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the variable whose value should be returned.</div>'}],returns:{type:\"item()*\",description:\"the value bound to the given variable.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:NO_QUERY_MATCH if no query with the given identifier was prepared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:UNDECLARED_VARIABLE if the given variable is not declared in the query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zq:UNBOUND_VARIABLE if the given variable doesn\\'t have a value.</xqdoc:error>']}],variables:[]},\"http://xbrl.io/modules/bizql/hypercubes\":{ns:\"http://xbrl.io/modules/bizql/hypercubes\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functionality for manipulating hypercubes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A hypercube provides a multi-dimensional structure to organize facts.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The dimensions of a hypercube correspond to XBRL aspects (concepts, entities, periods,\\n units, further XBRL dimensions). An XBRL hypercube only is made of XBRL dimensions, however\\n including the other aspects as well is very useful in the context of NOLAP, so that xbrl.io\\n does so.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">xbrl.io introduces the notion of default hypercube. A default hypercube is implicitly added\\n to each component, and only contains the concept, entity, period and unit aspects.\\n In other words, the default hypercube\\n of a component contains all these facts that do not have any XBRL dimensions.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve all hypercubes contained in a component. You can\\n retrieve all facts contained in a hypercube (default dimension values are processed automatically),\\n either in raw form, or organized as a (2D) fact table. You can also populate a network (for example,\\n a presentation network) with the facts contained in a hypercube.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/concept-maps\",prefix:\"concept-maps\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/hypercubes\",prefix:\"hypercubes\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"dimensionless-hypercube\",qname:\"hypercubes:dimensionless-hypercube\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an instantiation of a dimensionless Hypercube containing only the basic\\n    characteristics (xbrl:Concept, xbrl:Period, xbrl:Entity, and xbrl:Unit).\\n    For each of those included aspects the value space is not limited.</p>\\n',summary:\"<p>  Returns an instantiation of a dimensionless Hypercube containing only the basic\\n    characteristics (xbrl:Concept, xbrl:Period, xbrl:Entity, and xbrl:Unit).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"dimensionless hypercube instantiation.\"},errors:[]},{isDocumented:!0,arity:1,name:\"dimensionless-hypercube\",qname:\"hypercubes:dimensionless-hypercube\",signature:\"($options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an instantiation of a dimensionless Hypercube containing only the basic\\n    characteristics (xbrl:Concept, xbrl:Period, xbrl:Entity, and xbrl:Unit).\\n    For each of those included aspects the value space is not limited.</p>\\n',summary:\"<p>  Returns an instantiation of a dimensionless Hypercube containing only the basic\\n    characteristics (xbrl:Concept, xbrl:Period, xbrl:Entity, and xbrl:Unit).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">: additional options among which: - Concepts: an array of concept names to include in the hypercube. - Periods: an array of periods to include in the hypercube. - Entities: an array of EIDs to include in the hypercube. - Units: an array of units to include in the hypercube.</div>'}],returns:{type:\"object()\",description:\"dimensionless hypercube instantiation.\"},errors:[]},{isDocumented:!0,arity:2,name:\"fact-table-for-hypercube\",qname:\"hypercubes:fact-table-for-hypercube\",signature:\"($hypercube as object(), $archives as item()*) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $hypercubes:ALL_ARCHIVES for no filtering.</div>'}],returns:{type:\"array()\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"fact-table-for-hypercube\",qname:\"hypercubes:fact-table-for-hypercube\",signature:\"($hypercube as object(), $archives as item()*, $options as object()?) as array()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"array()\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:2,name:\"facts-for-hypercube\",qname:\"hypercubes:facts-for-hypercube\",signature:\"($hypercube as object(), $archives as item()*) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $hypercubes:ALL_ARCHIVES for no filtering.</div>'}],returns:{type:\"item()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:3,name:\"facts-for-hypercube\",qname:\"hypercubes:facts-for-hypercube\",signature:\"($hypercube as object(), $archives as item()*, $options as object()?) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\\n',summary:\"<p>  Retrieves all facts from the supplied archives, that are relevant to the\\n supplied hypercube, and populates them with the default dimension values\\n when missing.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $hypercubes:ALL_ARCHIVES for no filtering.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"item()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:1,name:\"hypercubes-for-components\",qname:\"hypercubes:hypercubes-for-components\",signature:\"($components as object()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all hypercubes in the supplied components.</p>\\n',summary:\"<p>  Retrieves all hypercubes in the supplied components.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of components.</div>'}],returns:{type:\"object()*\",description:\"all hypercubes.\"},errors:[]},{isDocumented:!0,arity:2,name:\"hypercubes-for-components\",qname:\"hypercubes:hypercubes-for-components\",signature:\"($components as object()*, $names as string*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all hypercubes in the supplied components and\\n with the given names.</p>\\n',summary:\"<p>  Retrieves all hypercubes in the supplied components and\\n with the given names.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"components\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of components.</div>'},{name:\"names\",type:\"string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of names.</div>'}],returns:{type:\"object()*\",description:\"all hypercubes.\"},errors:[]},{isDocumented:!0,arity:3,name:\"populate-networks-with-facts\",qname:\"hypercubes:populate-networks-with-facts\",signature:\"($networks as object()*, $hypercube as object(), $archives as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied hypercube. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied hypercube.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> networks.</div>'},{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs or $hypercubes:ALL_ARCHIVES for no filtering.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]},{isDocumented:!0,arity:4,name:\"populate-networks-with-facts\",qname:\"hypercubes:populate-networks-with-facts\",signature:\"($networks as object()*, $hypercube as object(), $archives as item()*, $options as object()?) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied hypercube. Default dimension values are added to the facts\\n when missing.</p>\\n',summary:\"<p>  Populates a concept-tree network with all facts from the supplied archives,\\n that are relevant to the\\n supplied hypercube.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"networks\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> networks.</div>'},{name:\"hypercube\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a hypercube.</div>'},{name:\"archives\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of archives or their AIDs.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()*\",description:\"a sequence of facts with populated dimension values.\"},errors:[]}],variables:[{name:\"hypercubes:ALL_ARCHIVES\",type:\"boolean\",description:\" Joker for all archives.\\n\"}]},\"http://www.zorba-xquery.com/modules/xqdoc/batch\":{ns:\"http://www.zorba-xquery.com/modules/xqdoc/batch\",description:\" Process XQDoc batches.\\n This module generates XQDoc HTML documentation from multiple\\n XQuery modules.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon <a href=\"?anchor=\">wcandillon at gmail dot com</a></xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/xqdoc/batch\",prefix:\"batch\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://expath.org/ns/file\",prefix:\"file\"},{uri:\"http://www.functx.com\",prefix:\"functx\"},{uri:\"http://www.w3.org/1999/xhtml\",prefix:\"h\"},{uri:\"http://www.zorba-xquery.com/modules/xqdoc/html\",prefix:\"html\"},{uri:\"http://www.zorba-xquery.com/modules/xqdoc/menu\",prefix:\"menu\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"out\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.xqdoc.org/1.0\",prefix:\"xq\"},{uri:\"http://zorba.io/modules/xqdoc\",prefix:\"xqdoc\"}],functions:[{isDocumented:!1,arity:2,name:\"add-predeclared-namespaces\",qname:\"batch:add-predeclared-namespaces\",signature:\"($xqdoc as element(xq:xqdoc), $namespaces as element(namespace)*) as element(xq:xqdoc)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xqdoc\",type:\"element(xq:xqdoc)\",occurrence:null,description:\"\"},{name:\"namespaces\",type:\"element(namespace)\",occurrence:\"*\",description:\"\"}],returns:{type:\"element(xq:xqdoc)\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"add-trailing-slash\",qname:\"batch:add-trailing-slash\",signature:\"($path as xs:string) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!0,arity:4,name:\"build-xqdoc\",qname:\"batch:build-xqdoc\",signature:\"($output-folder as xs:string, $static-folders as xs:string*, $template as element(*), $modules as element(modules))\",description:\" Run an XQDoc batch.\\n\",summary:\"<p> Run an XQDoc batch.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"output-folder\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Where to write the generated files.</div>'},{name:\"static-folders\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Where to copy the static files from.</div>'},{name:\"template\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> HTML layout of the generated files. The layount can contains different variables. For instance: <pre class=\"ace-static\" ace-mode=\"xml\"><body><var name=\"page\"/></body></pre> is a valid example. Three variable names are available: <code>page</code>, <code>title</code>, and <code>menu</code>.</div>'},{name:\"modules\",type:\"element(modules)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Document describing the documentation project. For instance: <pre class=\"ace-static\" ace-mode=\"xml\"> <modules> <namespace prefix=\"ann\" uri=\"http://zorba.io/annotations\"/> <section id=\"modules\" label=\"My Modules\"> <!-- Location hints are optionnals --> <module ns=\"http://example.com/mymodule\" label=\"My Module\" id=\"module\" file=\"module.xq\"/> </section> </modules> </pre></div>'}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"copy-static-folders\",qname:\"batch:copy-static-folders\",signature:\"($output-folder as xs:string, $static-folders as xs:string*)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"output-folder\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"static-folders\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"create-page\",qname:\"batch:create-page\",signature:\"($output-folder as xs:string, $page-name as xs:string, $page as element(h:html))\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"output-folder\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"page-name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"page\",type:\"element(h:html)\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"create-xml-folder\",qname:\"batch:create-xml-folder\",signature:\"($folder as xs:string)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"folder\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"page\",qname:\"batch:page\",signature:\"($template as element(*), $menu as element(ul), $section as element(*)) as element(h:html)\",description:\"\",summary:\"\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"template\",type:\"element(*)\",occurrence:null,description:\"\"},{name:\"menu\",type:\"element(ul)\",occurrence:null,description:\"\"},{name:\"section\",type:\"element(*)\",occurrence:null,description:\"\"}],returns:{type:\"element(h:html)\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"save-xml\",qname:\"batch:save-xml\",signature:\"($output-file, $page)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"output-file\",type:null,occurrence:null,description:\"\"},{name:\"page\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"section\",qname:\"batch:section\",signature:\"($sections as element(section)+) as element(section)+\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sections\",type:\"element(section)\",occurrence:\"+\",description:\"\"}],returns:{type:\"element(section)+\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"section\",qname:\"batch:section\",signature:\"($sections as element(section)+, $level as xs:integer) as element(section)+\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"sections\",type:\"element(section)\",occurrence:\"+\",description:\"\"},{name:\"level\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:\"element(section)+\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"xqdoc\",qname:\"batch:xqdoc\",signature:\"($module as element(module)) as element(xq:xqdoc)\",description:\"\",summary:\"\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"module\",type:\"element(module)\",occurrence:null,description:\"\"}],returns:{type:\"element(xq:xqdoc)\",description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/data-cleaning/hybrid-string-similarity\":{ns:\"http://zorba.io/modules/data-cleaning/hybrid-string-similarity\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides hybrid string similarity functions, combining the properties of\\n character-based string similarity functions and token-based string similarity functions.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation,\\n although the module requires the trigonometic functions of XQuery 3.0 or a math extension\\n function such as sqrt($x as numeric) for computing the square root.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins and Diogo Simões</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xpath-functions/math\",prefix:\"math\"},{uri:\"http://zorba.io/modules/data-cleaning/set-similarity\",prefix:\"set\"},{uri:\"http://zorba.io/modules/data-cleaning/character-based-string-similarity\",prefix:\"simc\"},{uri:\"http://zorba.io/modules/data-cleaning/hybrid-string-similarity\",prefix:\"simh\"},{uri:\"http://zorba.io/modules/data-cleaning/phonetic-string-similarity\",prefix:\"simp\"},{uri:\"http://zorba.io/modules/data-cleaning/token-based-string-similarity\",prefix:\"simt\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:4,name:\"monge-elkan-jaro-winkler\",qname:\"simh:monge-elkan-jaro-winkler\",signature:\"($s1 as xs:string, $s2 as xs:string, $prefix as xs:integer, $fact as xs:double) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Monge-Elkan similarity coefficient between two strings, using the Jaro-Winkler</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">similarity function to discover token identity.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> monge-elkan-jaro-winkler(\"Comput. Sci. and Eng. Dept., University of California, San Diego\", \"Department of Computer Scinece, Univ. Calif., San Diego\", 4, 0.1) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.992 </pre></p>\\n',summary:\"<p>  Returns the Monge-Elkan similarity coefficient between two strings, using the Jaro-Winkler \\n  similarity function to discover token identity.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"prefix\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when testing for equal prefixes with the Jaro-Winkler metric.</div>'},{name:\"fact\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The weighting factor to consider when the input strings have equal prefixes with the Jaro-Winkler metric.</div>'}],returns:{type:\"xs:double\",description:\"The Monge-Elkan similarity coefficient between the two strings.\"},errors:[]},{isDocumented:!0,arity:4,name:\"soft-cosine-tokens-edit-distance\",qname:\"simh:soft-cosine-tokens-edit-distance\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string, $t as xs:integer) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Edit Distance similarity function is used to discover token identity, and tokens having an edit distance\\n bellow a given threshold are considered as matching tokens.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> soft-cosine-tokens-edit-distance(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\", 0 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.408248290463863 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'},{name:\"t\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A threshold for the similarity function used to discover token identity.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:6,name:\"soft-cosine-tokens-jaro-winkler\",qname:\"simh:soft-cosine-tokens-jaro-winkler\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string, $t as xs:double, $prefix as xs:integer?, $fact as xs:double?) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Jaro-Winkler similarity function is used to discover token identity, and tokens having a Jaro-Winkler\\n similarity above a given threshold are considered as matching tokens.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> soft-cosine-tokens-jaro-winkler(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\", 1, 4, 0.1 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.45 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'},{name:\"t\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A threshold for the similarity function used to discover token identity.</div>'},{name:\"prefix\",type:\"xs:integer\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of characters to consider when testing for equal prefixes with the Jaro-Winkler metric.</div>'},{name:\"fact\",type:\"xs:double\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The weighting factor to consider when the input strings have equal prefixes with the Jaro-Winkler metric.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:4,name:\"soft-cosine-tokens-jaro\",qname:\"simh:soft-cosine-tokens-jaro\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string, $t as xs:double) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Jaro similarity function is used to discover token identity, and tokens having a Jaro similarity above\\n a given threshold are considered as matching tokens.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> soft-cosine-tokens-jaro(\"The FLWOR Foundation\", \"FLWOR Found.\", \" +\", 1 ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.5 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'},{name:\"t\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A threshold for the similarity function used to discover token identity.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets tokens extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"soft-cosine-tokens-metaphone\",qname:\"simh:soft-cosine-tokens-metaphone\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Metaphone phonetic similarity function is used to discover token identity, which is equivalent to saying that\\n this function returns the cosine similarity coefficient between sets of Metaphone keys.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> soft-cosine-tokens-metaphone(\"ALEKSANDER SMITH\", \"ALEXANDER SMYTH\", \" +\" ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 1.0 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets Metaphone keys extracted from the two strings.\"},errors:[]},{isDocumented:!0,arity:3,name:\"soft-cosine-tokens-soundex\",qname:\"simh:soft-cosine-tokens-soundex\",signature:\"($s1 as xs:string, $s2 as xs:string, $r as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The tokens from each string are weighted according to their occurence frequency (i.e., weighted according to the\\n term-frequency heuristic from Information Retrieval).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Soundex phonetic similarity function is used to discover token identity, which is equivalent to saying that\\n this function returns the cosine similarity coefficient between sets of Soundex keys.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> soft-cosine-tokens-soundex(\"ALEKSANDER SMITH\", \"ALEXANDER SMYTH\", \" +\") </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 1.0 </pre></p>\\n',summary:\"<p>  Returns the cosine similarity coefficient between sets of tokens extracted from two strings.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first string.</div>'},{name:\"s2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second string.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:double\",description:\"The cosine similarity coefficient between the sets of Soundex keys extracted from the two strings.\"},errors:[]}],variables:[]},\"http://xbrl.io/modules/bizql/rules\":{ns:\"http://xbrl.io/modules/bizql/rules\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for storing, retrieving, and modifying\\n rules. Rules can be used in BizQL queries to:</p>\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>Impute Facts that were not reported within an instance, yet can be\\n       derived from reported facts.</li>\\n   <li>Compute arbitrary new Facts (Ratios, Calculated Facts, Facts from different\\n       Datasources/Instances, etc.).</li>\\n   <li>Run validation and/or verification rules</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A Rule is an object containing a BizQL fomula to execute if a condition is met.\\n For example if a user queries for a certain concept and a rule exists for this\\n concept then the rule is applied to get the fact.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve the rules associated with each report\\n schema. You can also query for facts by making implicitly use of the mapping.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://xbrl.io/modules/bizql/archives\",prefix:\"archives\"},{uri:\"http://xbrl.io/modules/bizql/facts\",prefix:\"facts\"},{uri:\"http://xbrl.io/modules/bizql/networks\",prefix:\"networks\"},{uri:\"http://xbrl.io/modules/bizql/report-schemas\",prefix:\"report-schemas\"},{uri:\"http://xbrl.io/modules/bizql/rules\",prefix:\"rules\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:7,name:\"create-computed-fact\",qname:\"rules:create-computed-fact\",signature:\"($template-fact as object(), $concept-name-or-aspects as item(), $value as item(), $rule as object(), $audit-trail-message as string, $source-facts as object()*, $options as object()?) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Helper function to create a new fact within a rule.</p>\\n',summary:\"<p>  Helper function to create a new fact within a rule.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"template-fact\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a fact object that will be used as a template for the newly created fact</div>'},{name:\"concept-name-or-aspects\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> either a name of the concept for the newly created fact or a complete aspects object to be used in the new fact.</div>'},{name:\"value\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a value for the newly created fact</div>'},{name:\"rule\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the rule in which this fact has been created</div>'},{name:\"audit-trail-message\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a verbose string message explaining how and why this fact has been created</div>'},{name:\"source-facts\",type:\"object()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> sequence of facts that have been used to compute the new fact (this will only be added to the AuditTrails if the audit-trail option is set to \"debug\")</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> <a href=\"facts#standard_options\">standard fact retrieving options</a>.</div>'}],returns:{type:\"object()\",description:\"the decimal value of the fact or 0.\"},errors:[]},{isDocumented:!0,arity:1,name:\"fact-trail\",qname:\"rules:fact-trail\",signature:\"($fact as object()?) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Serializes a fact to a simple string format that can be used in\\n    audit trail messages to trail the value of the fact.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned string follows the pattern: fact-concept-name[fact-value]</p>\\n',summary:\"<p>  Serializes a fact to a simple string format that can be used in\\n    audit trail messages to trail the value of the fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a single fact to serialize to a simple informative string</div>'}],returns:{type:\"string\",description:\"the string with key information about the fact.\"},errors:[]},{isDocumented:!0,arity:2,name:\"fact-trail\",qname:\"rules:fact-trail\",signature:\"($fact as object()?, $name as string) as string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Serializes a fact to a simple string format that can be used in\\n    audit trail messages to trail the value of the fact.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The returned string follows the pattern: fact-concept-name[fact-value]</p>\\n',summary:\"<p>  Serializes a fact to a simple string format that can be used in\\n    audit trail messages to trail the value of the fact.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"fact\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an empty-sequence or a single fact to serialize to a simple informative string</div>'},{name:\"name\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> an alternative name to use if the $fact is an empty-sequence otherwise the name will be taken from the fact</div>'}],returns:{type:\"string\",description:\"the string with key information about the fact.\"},errors:[]},{isDocumented:!0,arity:0,name:\"rules\",qname:\"rules:rules\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Retrieves all rules from all report schemas.</p>\\n',summary:\"<p>  Retrieves all rules from all report schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all rules.\"},errors:[]},{isDocumented:!0,arity:1,name:\"rules\",qname:\"rules:rules\",signature:\"($report-schemas-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the rules from the given report schemas.</p>\\n',summary:\"<p>  Return the rules from the given report schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"report-schemas-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"object()*\",description:\"the rules from the report schemas.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/lock\":{ns:\"http://www.28msec.com/modules/lock\",description:\" Sausalito provides a an application level locking mechanism that can be\\n used e.g. to ensure exclusive access to data.\\n As the store ensures atomicity of of single document updates, atomic\\n updates to multiple documents are implemented using this mechanism.\\n Locks can be acquired and re-acquired at any time during a request and\\n are released at the end of the request.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/lock\",prefix:\"lock\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"try-acquire\",qname:\"lock:try-acquire\",signature:\"($lock-name as xs:string) as xs:boolean external\",description:' Tries to acquire a lock.\\n This operation is non-blocking if the lock cannot be acquired immediately.\\n To check and modify the stock of a product wihtout interference from\\n concurrent requests a lock could be used like this:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n if (lock:try-acquire(\"stock-update\"))\\n then\\n   if (stock:check($product-id))\\n   then\\n     {\\n       order:finalize($order-id);\\n       stock:decrement($product-id);\\n     }\\n   else\\n     order:hold($order-id);\\n else\\n   ...\\n </pre>\\n',summary:\"<p> Tries to acquire a lock.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"lock-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the lock.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the lock could be acquired, false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"try-acquire\",qname:\"lock:try-acquire\",signature:\"($lock-name as xs:string, $reason as xs:string) as xs:boolean external\",description:\" tries to acquire a lock\\n\",summary:\"<p> tries to acquire a lock\\n</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"lock-name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the lock.</div>'},{name:\"reason\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a reason for the acquisition of the lock that can be used for</div>'}],returns:{type:\"xs:boolean\",description:\"true if the lock could be acquired, false otherwise.\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/xqdoc/html\":{ns:\"http://www.zorba-xquery.com/modules/xqdoc/html\",description:' Convert an XQDoc document into an HTML document.\\n This module contains a single <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">convert()</code> function\\n that transform an XQDoc document into an HTML document.\\n Usage:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n let $xqdoc := xqdoc:xqdoc(\"http://expath.org/ns/file\")\\n return html:convert($xqdoc)\\n </pre>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon <a href=\"?anchor=\">wcandillon at gmail dot com</a></xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/xqdoc/html\",prefix:\"html\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"o\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.xqdoc.org/1.0\",prefix:\"xq\"}],functions:[{isDocumented:!1,arity:1,name:\"convert\",qname:\"html:convert\",signature:\"($xqdoc as element(xq:xqdoc)) as element(div)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"xqdoc\",type:\"element(xq:xqdoc)\",occurrence:null,description:\"\"}],returns:{type:\"element(div)\",description:\"\"},errors:[]}],variables:[]},\"http://api.28.io/model\":{ns:\"http://api.28.io/model\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://zorba.io/modules/store/static/collections/ddl\",prefix:\"cddl\"},{uri:\"http://zorba.io/modules/store/static/collections/dml\",prefix:\"cdml\"},{uri:\"http://zorba.io/modules/store/static/indexes/ddl\",prefix:\"iddl\"},{uri:\"http://zorba.io/modules/store/static/indexes/dml\",prefix:\"idml\"},{uri:\"http://api.28.io/model\",prefix:\"model\"},{uri:\"http://www.zorba-xquery.com/schemas/pul\",prefix:\"pul\"},{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://www.zorba-xquery.com/schemas/xdm\",prefix:\"xdm\"}],functions:[{isDocumented:!1,arity:1,name:\"applyPUL\",qname:\"model:applyPUL\",signature:\"($pul as schema-element(pul:pending-update-list))\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"pul\",type:\"schema-element(pul:pending-update-list)\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"applyPULOp\",qname:\"model:applyPULOp\",signature:\"($pul)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"pul\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"build-nodes\",qname:\"model:build-nodes\",signature:\"($definition)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"definition\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"collection-qname\",qname:\"model:collection-qname\",signature:\"($name as xs:string) as xs:QName\",description:\" Returns the QName for a collection. Returns the empty sequence if no collection with the given name exists.\\n\",summary:\"<p> Returns the QName for a collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection as string</div>'}],returns:{type:\"xs:QName\",description:\"the QName for the collection or the empty sequence\"},errors:[]},{isDocumented:!1,arity:2,name:\"delete-node-collection\",qname:\"model:delete-node-collection\",signature:\"($collection as xs:QName, $noderef as xs:anyURI?)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"collection\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"noderef\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"delete-node\",qname:\"model:delete-node\",signature:\"($noderef as xs:anyURI)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"element-node\",qname:\"model:element-node\",signature:\"($definition as schema-element(xdm:element))\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"definition\",type:\"schema-element(xdm:element)\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"find-keys\",qname:\"model:find-keys\",signature:\"($collection)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"collection\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"get-collection-names\",qname:\"model:get-collection-names\",signature:\"() as xs:string*\",description:\" Returns all collection names\\n\",summary:\"<p> Returns all collection names\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"collection names as a sequence of strings\"},errors:[]},{isDocumented:!0,arity:1,name:\"get-collection-size\",qname:\"model:get-collection-size\",signature:\"($name as xs:string) as xs:integer\",description:\" Returns the size of a collection\\n\",summary:\"<p> Returns the size of a collection\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection as string</div>'}],returns:{type:\"xs:integer\",description:\"the size of the collection\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">if the collection chosen by $name does not exist</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-collection\",qname:\"model:get-collection\",signature:\"($name as xs:string) as node()*\",description:\" Returns the whole collection with a given name\\n\",summary:\"<p> Returns the whole collection with a given name\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> name of collection to return</div>'}],returns:{type:\"node()*\",description:\"sequence of nodes of the collection\"},errors:[]},{isDocumented:!0,arity:4,name:\"get-collection\",qname:\"model:get-collection\",signature:\"($name as xs:string, $first-noderef as xs:anyURI?, $offset as xs:integer?, $limit as xs:integer)\",description:' Returns \"a page\" of the collection (a part)\\n',summary:'<p> Returns \"a page\" of the collection (a part)\\n</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the collection as string</div>'},{name:\"first-noderef\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"},{name:\"offset\",type:\"xs:integer\",occurrence:\"?\",description:\"\"},{name:\"limit\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:null,description:\"a sequence of nodes from the collection\"},errors:[]},{isDocumented:!1,arity:4,name:\"get-column-id\",qname:\"model:get-column-id\",signature:\"($basepath as xs:string?, $name as xs:string, $isattribute as xs:boolean, $columns) as xs:integer\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"basepath\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"isattribute\",type:\"xs:boolean\",occurrence:null,description:\"\"},{name:\"columns\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:integer\",description:\"\"},errors:[]},{isDocumented:!0,arity:0,name:\"get-index-names\",qname:\"model:get-index-names\",signature:\"() as xs:string*\",description:\" Returns all index names\\n\",summary:\"<p> Returns all index names\\n</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"index names as a sequence of strings\"},errors:[]},{isDocumented:!1,arity:2,name:\"get-index-point\",qname:\"model:get-index-point\",signature:\"($index-name as xs:string, $index-key)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"index-name\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"index-key\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-node-group\",qname:\"model:get-node-group\",signature:\"($noderef as xs:anyURI)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-node-path\",qname:\"model:get-node-path\",signature:\"($node)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"get-node\",qname:\"model:get-node\",signature:\"($noderef as xs:anyURI)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!0,arity:1,name:\"index-qname\",qname:\"model:index-qname\",signature:\"($name as xs:string) as xs:QName\",description:\" Returns the QName for an index. Returns the empty sequence if no index with the given name exists.\\n\",summary:\"<p> Returns the QName for an index.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the index as string</div>'}],returns:{type:\"xs:QName\",description:\"the QName for the index or the empty sequence\"},errors:[]},{isDocumented:!1,arity:3,name:\"insert-attribute\",qname:\"model:insert-attribute\",signature:\"($noderef as xs:anyURI, $attribute as xs:string, $value)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"attribute\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"value\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:4,name:\"insert-node-collection-ordered\",qname:\"model:insert-node-collection-ordered\",signature:\"($collection as xs:QName, $noderef as xs:anyURI?, $position as xs:string, $nodes)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"collection\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"noderef\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"},{name:\"position\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"nodes\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:4,name:\"insert-node-collection\",qname:\"model:insert-node-collection\",signature:\"($collection as xs:QName, $noderef as xs:anyURI?, $position as xs:string, $nodes)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"collection\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"noderef\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"},{name:\"position\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"nodes\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:5,name:\"insert-node-collection\",qname:\"model:insert-node-collection\",signature:\"($collection as xs:QName, $noderef as xs:anyURI?, $position as xs:string, $nodes, $validate as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"collection\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"noderef\",type:\"xs:anyURI\",occurrence:\"?\",description:\"\"},{name:\"position\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"validate\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"insert-node\",qname:\"model:insert-node\",signature:\"($noderef as xs:anyURI, $position as xs:string, $newnodes)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"position\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"newnodes\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:4,name:\"make-table-row\",qname:\"model:make-table-row\",signature:\"($idx, $node, $columns, $namespaces)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"idx\",type:null,occurrence:null,description:\"\"},{name:\"node\",type:null,occurrence:null,description:\"\"},{name:\"columns\",type:null,occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:5,name:\"make-table-row\",qname:\"model:make-table-row\",signature:\"($node, $path as xs:string?, $row, $columns, $namespaces)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:\"?\",description:\"\"},{name:\"row\",type:null,occurrence:null,description:\"\"},{name:\"columns\",type:null,occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"make-table\",qname:\"model:make-table\",signature:\"($nodes, $namespaces)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"node-name\",qname:\"model:node-name\",signature:\"($node as element(*), $namespaces) as xs:string\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"node\",type:\"element(*)\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"node-path-index\",qname:\"model:node-path-index\",signature:\"($node as node(), $parent as node()) as xs:integer?\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:\"\"},{name:\"parent\",type:\"node()\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer?\",description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"node-prefix\",qname:\"model:node-prefix\",signature:\"($node as element(*), $namespaces) as xs:string?\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"node\",type:\"element(*)\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"node-reference\",qname:\"model:node-reference\",signature:\"($node) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"node\",qname:\"model:node\",signature:\"($definition)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"definition\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"rename-node\",qname:\"model:rename-node\",signature:\"($noderef as xs:anyURI, $name as xs:QName)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"name\",type:\"xs:QName\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"replace-node\",qname:\"model:replace-node\",signature:\"($noderef as xs:anyURI, $nodes)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"nodes\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"replace-value\",qname:\"model:replace-value\",signature:\"($noderef as xs:anyURI, $value)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"noderef\",type:\"xs:anyURI\",occurrence:null,description:\"\"},{name:\"value\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"resolve-qname\",qname:\"model:resolve-qname\",signature:\"($name as xs:QName, $namespaces) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"type-save\",qname:\"model:type-save\",signature:\"($val) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"val\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"type\",qname:\"model:type\",signature:\"($val as xs:anyAtomicType?) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"val\",type:\"xs:anyAtomicType\",occurrence:\"?\",description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"unused-prefix\",qname:\"model:unused-prefix\",signature:\"($namespaces) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]}],variables:[]},\"http://api.28.io/validation\":{ns:\"http://api.28.io/validation\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"http://zorba.io/modules/reflection\",prefix:\"reflection\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://api.28.io/validation\",prefix:\"validate\"}],functions:[{isDocumented:!1,arity:3,name:\"by-schema-array\",qname:\"validate:by-schema-array\",signature:\"($obj, $schema as array(), $path as xs:string)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:null,occurrence:null,description:\"\"},{name:\"schema\",type:\"array()\",occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"by-schema-obj\",qname:\"validate:by-schema-obj\",signature:\"($obj as object(), $schema as object(), $path as xs:string)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:\"object()\",occurrence:null,description:\"\"},{name:\"schema\",type:\"object()\",occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"by-schema-primitive\",qname:\"validate:by-schema-primitive\",signature:\"($obj, $schema-type as xs:string, $path)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:null,occurrence:null,description:\"\"},{name:\"schema-type\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"path\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"by-schema\",qname:\"validate:by-schema\",signature:\"($obj as object(), $schema as object())\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"obj\",type:\"object()\",occurrence:null,description:\"\"},{name:\"schema\",type:\"object()\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"expression\",qname:\"validate:expression\",signature:\"($expression as xs:string, $is-domain-expr as xs:boolean) as xs:boolean\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"expression\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"is-domain-expr\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"type\",qname:\"validate:type\",signature:\"($type as xs:string) as xs:boolean\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"\"},errors:[]}],variables:[]},\"http://api.28.io/sandbox\":{ns:\"http://api.28.io/sandbox\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"http://zorba.io/modules/reference\",prefix:\"ref\"},{uri:\"http://zorba.io/modules/reflection\",prefix:\"reflection\"},{uri:\"http://api.28.io/sandbox\",prefix:\"sandbox\"}],functions:[{isDocumented:!1,arity:3,name:\"filter\",qname:\"sandbox:filter\",signature:\"($nodes, $xpath as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"xpath\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"get-names\",qname:\"sandbox:get-names\",signature:\"($nodes, $path as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"get-values\",qname:\"sandbox:get-values\",signature:\"($nodes, $path as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"key-constraint\",qname:\"sandbox:key-constraint\",signature:\"($nodes, $condition as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"condition\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"ns-declarations\",qname:\"sandbox:ns-declarations\",signature:\"($namespaces) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:4,name:\"order\",qname:\"sandbox:order\",signature:\"($nodes, $path as xs:string, $descending as xs:boolean, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"path\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"descending\",type:\"xs:boolean\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:3,name:\"tuple-constraint\",qname:\"sandbox:tuple-constraint\",signature:\"($nodes, $condition as xs:string, $namespaces)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"condition\",type:\"xs:string\",occurrence:null,description:\"\"},{name:\"namespaces\",type:null,occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://zorba.io/modules/store/static/collections/dml\":{ns:\"http://zorba.io/modules/store/static/collections/dml\",description:' This modules provides a set of functions to modify a collection\\n and retrieve the items contained in a particular collection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n This module is part of\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/xqddf.html\">Zorba\\'s XQuery Data Definition Facility</a>.\\n All the collections managed by this module have to be pre-declared in the\\n prolog of a module.\\n Please refer to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/data_lifecycle.html\">general documentation</a>\\n for more information and examples.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../zorba/xqddf.html\">XQuery Data Definition Facility</a></xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/collections/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/indexes/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/ddl</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/modules/store/static/integrity-constraints/dml</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://zorba.io/errors</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Nicolae Brinza, Matthias Brantner, David Graf, Till Westmann, Markos Zaharioudakis</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/store/static/collections/dml\",prefix:\"cdml\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:3,name:\"apply-insert-after\",qname:\"cdml:apply-insert-after\",signature:\"($name as xs:QName, $pos as item(), $content as item()*) as item()* external\",description:' This function does the same thing as the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">insert-after()</code>\\n function except it immediately applies the resulting pending updates and\\n returns the items that have been inserted.\\n',summary:\"<p> This function does the same thing as the  insert-after() \\n function except it immediately applies the resulting pending updates and\\n returns the items that have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"pos\",type:\"item()\",occurrence:null,description:\"\"},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:\"item()*\",description:\"The sequence of items that have been inserted.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$target</code> is not in the collection.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"apply-insert-before\",qname:\"cdml:apply-insert-before\",signature:\"($name as xs:QName, $target as item(), $content as item()*) as item()* external\",description:' This function does the same thing as <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">insert-before()</code> except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.\\n',summary:\"<p> This function does the same thing as  insert-before()  except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item in the collection before which <code>$content</code> will be inserted.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:\"item()*\",description:\"The sequence of items that have been inserted.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection $name is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$target</code> is not an item that is contained in the collection.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"apply-insert-first\",qname:\"cdml:apply-insert-first\",signature:\"($name as xs:QName, $content as item()*) as item()* external\",description:' This function does the same thing as <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">insert-first()</code> except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.\\n',summary:\"<p> This function does the same thing as  insert-first()  except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:\"item()*\",description:\"The Sequence of items that have been inserted.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection $name is append-only, const, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"apply-insert-last\",qname:\"cdml:apply-insert-last\",signature:\"($name as xs:QName, $content as item()*) as item()* external\",description:' This function does the same thing as <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">insert-last()</code> except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.\\n',summary:\"<p> This function does the same thing as  insert-last()  except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:\"item()*\",description:\"The sequence of items that have been inserted.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"apply-insert\",qname:\"cdml:apply-insert\",signature:\"($name as xs:QName, $content as item()*) as item()* external\",description:' This function does the same thing as <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">insert()</code> except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.\\n',summary:\"<p> This function does the same thing as  insert()  except it\\n immediately applies the resulting pending updates and returns the items that\\n have been inserted.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:\"item()*\",description:\"The sequence of items that have been inserted.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is append-only, const, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"collection-name\",qname:\"cdml:collection-name\",signature:\"($item as item()) as xs:QName external\",description:\" Gets the name of the collection the given item (node or JSON item) belongs\\n to.\\n\",summary:\"<p> Gets the name of the collection the given item (node or JSON item) belongs\\n to.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item for which to get the name of its collection.</div>'}],returns:{type:\"xs:QName\",description:\"The name of the collection to which the given item belongs.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$item</code> does not belong to a collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"collection\",qname:\"cdml:collection\",signature:\"($name as xs:QName) as item()* external\",description:\" Gets the sequence of nodes or JSON items from a collection.\\n\",summary:\"<p> Gets the sequence of nodes or JSON items from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'}],returns:{type:\"item()*\",description:\"The seqnence of items from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"collection\",qname:\"cdml:collection\",signature:\"($name as xs:QName, $skip as xs:integer) as item()* external\",description:\" Gets the sequence of nodes or JSON items from a collection.\\n\",summary:\"<p> Gets the sequence of nodes or JSON items from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'},{name:\"skip\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The initial number of items to skip.</div>'}],returns:{type:\"item()*\",description:\"The (sub)sequence of items from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"collection\",qname:\"cdml:collection\",signature:\"($name as xs:QName, $start as xs:anyURI, $skip as xs:integer) as item()* external\",description:' Gets the sequence of items (nodes or JSON items) from a collection.\\n The parameters <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$start</code> and <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$skip</code> can be used to\\n skip over some items at the beginning of the collection.\\n If both are given, both are applied:\\n first <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$start</code> to skip to the referenced item\\n and then <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$skip</code> to skip that additional number of items.\\n',summary:\"<p> Gets the sequence of items (nodes or JSON items) from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection.</div>'},{name:\"start\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The reference to the first item to return.</div>'},{name:\"skip\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of additional items to skip.</div>'}],returns:{type:\"item()*\",description:\"The sub-sequence from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZAPI0028 If the given URI is not a valid node position computed by the <code>np:node-position</code> function.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZSTR0066 if <code>$start</code> does not reference a node from the collection.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-first\",qname:\"cdml:delete-first\",signature:\"($name as xs:QName) external\",description:\" Deletes the first item from a collection.\\n\",summary:\"<p> Deletes the first item from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to delete from.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the first item from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const or append-only.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if the collection is empty.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-first\",qname:\"cdml:delete-first\",signature:\"($name as xs:QName, $number as xs:integer) external\",description:' Deletes the first <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i> items from a collection.\\n',summary:\"<p> Deletes the first  N  items from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to delete from.</div>'},{name:\"number\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of items to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the items from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const or append-only.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if the collection contains less than <code>$number</code> items.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete-last\",qname:\"cdml:delete-last\",signature:\"($name as xs:QName) external\",description:\" Deletes the last item from a collection.\\n\",summary:\"<p> Deletes the last item from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to delete from.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the last item from the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if the collection is empty.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete-last\",qname:\"cdml:delete-last\",signature:\"($name as xs:QName, $number as xs:integer) external\",description:' Deletes the last <i xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">N</i> items from a collection.\\n',summary:\"<p> Deletes the last  N  items from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to delete from.</div>'},{name:\"number\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The number of items to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the items.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if the collection contains less than <code>$number</code> items.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"delete\",qname:\"cdml:delete\",signature:\"($items as item()*) external\",description:\" Deletes items (nodes or JSON items) from a collection.\\n\",summary:\"<p> Deletes items (nodes or JSON items) from a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"items\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The items in the collection to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the items from their collections.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if any item in <code>$items</code> is not a member of a collection or not all items belong to the same collection.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"edit\",qname:\"cdml:edit\",signature:\"($target as item(), $content as item()) external\",description:\" Edits the first supplied item so as to make it look exactly like a copy of\\n the second supplied item while retaining its original identity.\\n\",summary:\"<p> Edits the first supplied item so as to make it look exactly like a copy of\\n the second supplied item while retaining its original identity.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The target item to be edited.</div>'},{name:\"content\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item that serves as an edit goal.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, performs the edit.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection to which <code>$target</code> belongs is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection to which <code>$target</code> belongs is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection to which <code>$target</code> belongs is append-only, const, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0017 if <code>$target</code> is not a member of a collection.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0037 if the collection is append-only.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0038 if the collection is a queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0039 if <code>$target</code> is not a root.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0040 if <code>$target</code> cannot be updated to match the content (for example, because the target is a node and the content is an object).</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type (as specified in the collection declaration) according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"index-of\",qname:\"cdml:index-of\",signature:\"($item as item()) as xs:integer external\",description:\" Gets the position of the given item (node or JSON item) within its\\n collection.\\n\",summary:\"<p> Gets the position of the given item (node or JSON item) within its\\n collection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"item\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item to get the index of.</div>'}],returns:{type:\"xs:integer\",description:'The position of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$item</code> in its collection.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$item</code> does not belong to a collection.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"insert-after\",qname:\"cdml:insert-after\",signature:\"($name as xs:QName, $target as item(), $content as item()*) external\",description:\" The insert-after function is an updating function that inserts copies of the\\n given items (nodes or JSON items) into a collection at the position\\n directly following the given target item.\\n\",summary:\"<p> The insert-after function is an updating function that inserts copies of the\\n given items (nodes or JSON items) into a collection at the position\\n directly following the given target item.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item in the collection after which <code>$content</code> will be inserted.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$target</code> is not a node that is contained in the collection.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"insert-before\",qname:\"cdml:insert-before\",signature:\"($name as xs:QName, $target as item(), $content as item()*) external\",description:\" Inserts copies of the given items (nodes or JSON items) into a collection at\\n the position directly preceding the given target item.\\n\",summary:\"<p> Inserts copies of the given items (nodes or JSON items) into a collection at\\n the position directly preceding the given target item.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"target\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The item in the collection before which <code>$content</code> will be inserted.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const, append-only, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0011 if <code>$target</code> is not an item that is contained in the collection.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"insert-first\",qname:\"cdml:insert-first\",signature:\"($name as xs:QName, $content as item()*) external\",description:\" Inserts copies of the given items (nodes or JSON items) at the beginning of\\n a collection.\\n\",summary:\"<p> Inserts copies of the given items (nodes or JSON items) at the beginning of\\n a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is append-only, const, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"insert-last\",qname:\"cdml:insert-last\",signature:\"($name as xs:QName, $content as item()*) external\",description:\" Inserts copies of the given items (nodes or JSON items) at the end of a\\n collection.\\n\",summary:\"<p> Inserts copies of the given items (nodes or JSON items) at the end of a\\n collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of itemss whose copies to insert.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is const.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0012 if the collection is unordered.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"insert\",qname:\"cdml:insert\",signature:\"($name as xs:QName, $content as item()*) external\",description:\" Inserts copies of the given items (nodes or JSON items) into a collection.\\n Note that the insertion position of the items in the collection is not\\n defined.\\n\",summary:\"<p> Inserts copies of the given items (nodes or JSON items) into a collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection to insert into.</div>'},{name:\"content\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The sequence of items whose copies to insert.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, inserts the items into the collection.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0006 if the collection is append-only, const, or queue.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDTY0001 if <code>$content</code> does not match the expected type as specified in the collection declaration according to the rules for SequenceType Matching.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"truncate\",qname:\"cdml:truncate\",signature:\"($name as xs:QName) external\",description:\" Deletes the entire contents of collection.\\n Please note that applying this function can not be undone in case\\n an error happens during the application of the containing PUL.\\n\",summary:\"<p> Deletes the entire contents of collection.</p>\",annotation_str:\"\",annotations:[],updating:!0,parameters:[{name:\"name\",type:\"xs:QName\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the collection whose content to delete.</div>'}],returns:{type:null,description:\"An empty XDM instance and a pending update list that, once applied, deletes the nodes.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0001 if the collection is not declared.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZDDY0003 if the collection is not available.</xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/http-request\":{ns:\"http://www.28msec.com/modules/http-request\",description:' The request module provides functions for accessing\\n information contained in the HTTP request used to evaluate the current\\n query. For example, the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">param-names</tt> function can be used to\\n retrieve all the names of the parameters contained in a request.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.28msec.com/modules/http/request#2.0\",prefix:\"req\"},{uri:\"http://www.28msec.com/modules/http-request\",prefix:\"request\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"binary-content\",qname:\"request:binary-content\",signature:\"() as xs:base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as base64Binary.</p>\\n',summary:\"<p>  Returns the content of the request as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:base64Binary\",description:\"The content of the request as base64Binary.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-binary-content if the content contained in the body of the request cannot be treated as binary because it is a request with multipart or url-encoded content.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"binary-part\",qname:\"request:binary-part\",signature:\"($ref as xs:string) as xs:base64Binary\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as base64Binary.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> field returned by the <tt>request:parts</tt> function.</p>\\n',summary:\"<p>  Returns the value of a part as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'}],returns:{type:\"xs:base64Binary\",description:\"the value of the part as base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"content-length\",qname:\"request:content-length\",signature:\"() as xs:integer?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the length of the content in bytes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value returned corresponds to the value of the HTTP\\n content-length header. The function returns an empty sequence\\n if this header does not exist in the request or its value\\n could not be converted to item of type xs:integer</p>.\\n',summary:\"<p>  Returns the length of the content in bytes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:integer?\",description:\"The content-length in bytes of the content sent with this request or the empty sequence if the content-length header does not exist in the request.\"},errors:[]},{isDocumented:!0,arity:0,name:\"content-type\",qname:\"request:content-type\",signature:\"() as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content-type of the data sent with this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that the content-type is only set for PUT and POST requests.</p>\\n',summary:\"<p>  Returns the content-type of the data sent with this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string?\",description:\"The content-type of the request if it is a PUT or POST request. Otherwise, it returns the empty sequence.\"},errors:[]},{isDocumented:!0,arity:0,name:\"header-accept\",qname:\"request:header-accept\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the values of the HTTP ACCEPT header.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The data is returned as a sequence of objects\\n as shown in the following example.</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n {\\n   \"type\" : \"text\",\\n   \"subtype\" : \"html\",\\n   \"quality\" : 1\\n }\\n </pre>\\n',summary:\"<p>  Returns the values of the HTTP ACCEPT header.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"The header values of the header ACCEPT or the empty sequence if the header is not contained in the request. The order of the returned objects reflects the order of the components in the header.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-header if the accept header cannot be parsed</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"header-names\",qname:\"request:header-names\",signature:\"() as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of all the HTTP headers in this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Header fields are colon-separated name-value pairs, terminated\\n by a carriage return (CR) and line feed (LF) character sequence. The\\n names and values of each header are allowed to consist of US-ASCII\\n characters only.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The names of the headers are returned using upper-case letters.\\n If a header with the same name is contained multiple times in a request,\\n its name is only returned once. The order of the names in the resulting\\n sequence does not reflect the order of the headers in the request. If\\n a header does not have a value, it is as if the header does not exist\\n in the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note that the header names user-agent and content-type are not\\n returned by this function. They are returned by the corresponding\\n functions of this module module\\n (e.g. <a href=\"#user-agent-0\">user-agent</a>).</p>\\n',summary:\"<p>  Returns the names of all the HTTP headers in this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"The names of the headers of this request or the empty sequence if no headers are contained in the request.\"},errors:[]},{isDocumented:!0,arity:1,name:\"header-value\",qname:\"request:header-value\",signature:\"($name as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of the HTTP header with the given name.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Header fields are colon-separated name-value pairs, terminated\\n by a carriage return (CR) and line feed (LF) character sequence. The\\n names and values of each header are allowed to consist of US-ASCII\\n characters only.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that header names are considered case-insensitive.\\n Also note, that only one value is returned if multiple headers with the\\n same names exist in the request. This value is a comma-separated list\\n of the values of the headers in the order in which the headers appeared\\n in the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">All headers having a name that starts with SAUSALITO_ are reserved\\n and will not be returned by this function.</p>\\n',summary:\"<p>  Returns the value of the HTTP header with the given name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The header name for which the value should be returned.</div>'}],returns:{type:\"xs:string?\",description:'The header value of the header with the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$name</tt> argument or the empty sequence if no header with that name is contained in the request.'},errors:[]},{isDocumented:!0,arity:0,name:\"headers\",qname:\"request:headers\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object containing the request\\'s HTTP header names and\\n values.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Header fields are colon-separated name-value pairs, terminated\\n by a carriage return (CR) and line feed (LF) character sequence. The\\n names and values of each header are allowed to consist of US-ASCII\\n characters only.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The structure of the object is as shown in the following example:\\n <pre>\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">All headers having a name that starts with SAUSALITO_ are reserved\\n and will not be returned by this function.</p>\\n',summary:\"<p>  Returns an object containing the request's HTTP header names and\\n values.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:'The header value of the header with the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$name</tt> argument or the empty sequence if no header with that name is contained in the request.'},errors:[]},{isDocumented:!0,arity:0,name:\"method-delete\",qname:\"request:method-delete\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is DELETE.\\n\",summary:\"<p> Returns true if the HTTP method of this request is DELETE.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is DELETE, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-get\",qname:\"request:method-get\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is GET.\\n\",summary:\"<p> Returns true if the HTTP method of this request is GET.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is GET, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-head\",qname:\"request:method-head\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is HEAD.\\n\",summary:\"<p> Returns true if the HTTP method of this request is HEAD.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is HEAD, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-options\",qname:\"request:method-options\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is OPTION.\\n\",summary:\"<p> Returns true if the HTTP method of this request is OPTION.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is OPTION, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-post\",qname:\"request:method-post\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is POST.\\n\",summary:\"<p> Returns true if the HTTP method of this request is POST.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is POST, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method-put\",qname:\"request:method-put\",signature:\"() as xs:boolean\",description:\" Returns true if the HTTP method of this request is PUT.\\n\",summary:\"<p> Returns true if the HTTP method of this request is PUT.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"true if the HTTP method of this request is PUT, false otherwise.\"},errors:[]},{isDocumented:!0,arity:0,name:\"method\",qname:\"request:method\",signature:\"() as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the name of the HTTP method used to make this request.</p>\\n',summary:\"<p>  Returns the name of the HTTP method used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The request method used to make this request (i.e. GET, POST, PUT, DELETE or HEAD).\"},errors:[]},{isDocumented:!0,arity:0,name:\"param-names\",qname:\"request:param-names\",signature:\"() as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of the parameters contained in the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Also, the names of each parameter (after being precent-decoded) are\\n treated as UTF-8. Please see the <tt>http:param-names#1</tt> function\\n for retrieving parameter names submitted using a encoding other than UTF-8.\\n </p>\\n',summary:\"<p>  Returns the names of the parameters contained in the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string*\",description:\"The names of all parameters in this request. The empty sequence is returned if there are none.\"},errors:[]},{isDocumented:!0,arity:1,name:\"param-names\",qname:\"request:param-names\",signature:\"($encoding as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the names of the parameters contained in the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:param-names#0</tt> function.\\n However, the names are treated (after precent-decoding) using the\\n given encoding supplied as parameter. For example, parameters might\\n be encoded using the ISO-8859-1 encoding.</p>\\n',summary:\"<p>  Returns the names of the parameters contained in the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the parameters in the request (e.g. ISO-8859-1).</div>'}],returns:{type:\"xs:string*\",description:\"The names of all parameters in this request. The empty sequence is returned if there are none.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"param-values\",qname:\"request:param-values\",signature:\"($name as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Also, the names and the values of each parameter (after being precent-decoded)\\n are treated as UTF-8. Please see the <tt>http:param-values#3</tt> function\\n for retrieving parameters submitted using a encoding other than UTF-8.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns the empty-sequence if no parameter with the\\n given name exists in this request. If you want the function to return\\n a default value other than the empty sequence, use the\\n <tt>http:param-values#2</tt> function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A URL could contain the following query string:\\n <tt>name1=value1&amp;name2=value2;name1=value3&amp;name3</tt>.\\n <tt>name1=value1&amp;name2=value2&amp;name1=value3&amp;name3</tt>.\\n The name value pairs in this query string are\\n <ul>\\n   <li> name: <tt>name1</tt>; values: <tt>value1</tt> and <tt>value3</tt></li>\\n   <li> name: <tt>name2</tt>; value: <tt>value2</tt></li>\\n   <li> name: <tt>name3</tt>; value: <tt/></li>\\n </ul>\\n </p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The empty sequence is returned if no parameter exists with the given name.\"},errors:[]},{isDocumented:!0,arity:2,name:\"param-values\",qname:\"request:param-values\",signature:\"($name as xs:string, $default-values as xs:string*) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:param-values#1</tt> function.\\n However, instead of returning the empty-sequence as a default value it returns\\n the given default-values sequence if no parameter with the given name is found\\n in this request.</p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'},{name:\"default-values\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The sequence given as $default-values parameter is returned if no parameter exists with the given name.\"},errors:[]},{isDocumented:!0,arity:3,name:\"param-values\",qname:\"request:param-values\",signature:\"($name as xs:string, $default-values as xs:string*, $encoding as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is similar to the <tt>request:param-values#2</tt> function.\\n However, the names and values are treated (after precent-decoding) using the\\n given encoding supplied as third parameter. For example, parameters might\\n be encoded using the ISO-8859-1 encoding.</p>\\n',summary:\"<p>  Returns a sequence of parameter values for the given parameter name\\n which are contained in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of the parameter whose value(s) should be returned.</div>'},{name:\"default-values\",type:\"xs:string\",occurrence:\"*\",description:\"\"},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the parameters in the request (e.g. ISO-8859-1)</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of values for the parameter with the given name. The sequence given as $default-values parameter is returned if no parameter exists with the given name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"params\",qname:\"request:params\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object containg the parameter names and values contained\\n in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The structure of the object for the query string\\n \"param1=value1;param2&amp;param2=value2\"\\n <pre>\\n {\\n   \"param1\" : \"value1\",\\n   \"param2\" : [ \"\", \"value2\" ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Also, the names and the values of each parameter (after being precent-decoded)\\n are treated as UTF-8. Please see the <tt>http:params#1</tt> function\\n for retrieving parameters submitted using a encoding other than UTF-8.</p>\\n',summary:\"<p>  Returns an object containg the parameter names and values contained\\n in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"An object containing all the parameter names and values. An empty object is returned if the request doesn't contain any parameters.\"},errors:[]},{isDocumented:!0,arity:1,name:\"params\",qname:\"request:params\",signature:\"($encoding as xs:string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object containg the parameter names and values contained\\n in the URL\\'s query string or the body of a POST or PUT\\n request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The structure of the object for the query string\\n \"param1=value1;param2&amp;param2=value2\"\\n <pre>\\n {\\n   \"param1\" : \"value1\",\\n   \"param2\" : [ \"\", \"value2\" ]\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Parameters are name-value pairs contained in the query string of the URL\\n used to make this request. As defined in RFC 1738, the query string of a\\n URL starts with a \"?\" character and ends with the character (if any).\\n Additionally, such name-value pairs may be part of the request\\'s body if\\n it is a PUT or POST request and the content-type of the request is\\n \"application/x-www-form-urlencoded\". Name-value pairs are separated\\n using either the \"&amp;\" or the \";\" character.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In general, the names and the values  are precent-encoded. This function\\n does the decoding of the parameters, i.e. it returns the values being\\n not percent-encoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The name and value of each parameter (after being percent-decoded) are treated\\n in the encoding given by the <tt>$encoding</tt> paramter.</p>\\n',summary:\"<p>  Returns an object containg the parameter names and values contained\\n in the URL's query string or the body of a POST or PUT\\n request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The encoding of the parameters in the request (e.g. ISO-8859-1)</div>'}],returns:{type:\"object()\",description:\"An object containing all the parameter names and values. An empty object is returned if the request doesn't contain any parameters.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"parts\",qname:\"request:parts\",signature:\"() as object()?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the metadata of all parts contained in a multipart request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The metadata is returned as an object\\n as shown in the following example.</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n {\\n   \"media-type\" : \"multipart/form-data; boundary=----------------------------93298e7a66a4\",\\n   \"parts\" : [ {\\n     \"headers\" : {\\n       \"Content-Disposition\" : \"form-data; name=\\\\\"upload\\\\\"; filename=\\\\\"tmp.txt\\\\\"\",\\n       \"Content-Type\" : \"text/plain\"\\n     },\\n     \"filename\" : \"tmp.txt\",\\n     \"name\" : \"upload\",\\n     \"src\" : \"urn:uuid:09be48d1-da0e-42c1-a115-a697e1779c45\",\\n     \"size\" : \"153\"\\n   }, {\\n     \"headers\" : {\\n       \"Content-Disposition\" : \"form-data; name=\\\\\"press\\\\\"\"\\n     },\\n     \"name\" : \"press\",\\n     \"src\" : \"urn:uuid:c80e0609-b703-4d47-9171-441eb397a562\",\\n     \"size\" : \"2\"\\n   } ]\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The <tt>media-type</tt> field describes the content-type as given in the\\n request. Specifically, its value is equal to the value returned by\\n <tt>request:header-values(\"Content-Type\")</tt>).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Each of the array members of the <tt>parts</tt> field represents one\\n part of the multipart request. Each such part contains a header field\\n containing one field for each headers belonging to that part.\\n The value of the <tt>src</tt> field can be used to retrieve the actual value\\n of the part by passing it to the <tt>http:text-part</tt> or\\n <tt>http:binary-part</tt> functions. The remaining fields represent a\\n parameter of the Content-Disposition header as described in RFC 2183\\n (e.g. filename, name, creation-date).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that recursive multipart content is not supported.</p>\\n',summary:\"<p>  Returns the metadata of all parts contained in a multipart request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()?\",description:\"an object representing the metadata of the multipart content or an empty sequence if there is no content.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"path\",qname:\"request:path\",signature:\"() as xs:string\",description:\" Return the path component of the request URI. The path starts after the\\n host and ends before the query string starts.\\n\",summary:\"<p> Return the path component of the request URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The path component of the request URI\"},errors:[]},{isDocumented:!0,arity:0,name:\"query\",qname:\"request:query\",signature:\"() as xs:string\",description:\" <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">Returns the query string that was used to make this request.</p>\\n <p xmlns:xqdoc=\\\"http://www.xqdoc.org/1.0\\\">The query string contains the part of the request URL that\\n starts with the '?' character to the end or the starting of the\\n fragment (i.e. the '#' character).</p>\\n\",summary:\"<p>  Returns the query string that was used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The query string part of the request's URL\"},errors:[]},{isDocumented:!0,arity:0,name:\"remote-addr\",qname:\"request:remote-addr\",signature:\"() as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the IP address of the client to which this request\\n is connected.</p>\\n',summary:\"<p>  Returns the IP address of the client to which this request\\n is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The IP address on the client side to which this request is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"remote-port\",qname:\"request:remote-port\",signature:\"() as xs:int\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the port of the client to which this request is connected.</p>\\n',summary:\"<p>  Returns the port of the client to which this request is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:int\",description:\"The port on the client side to which this request is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"server-name\",qname:\"request:server-name\",signature:\"() as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the server name of the server running the application.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The web server\\'s hostname or IP address.</p>\\n',summary:\"<p>  Returns the server name of the server running the application.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The name of the server that runs the application accepting this request.\"},errors:[]},{isDocumented:!0,arity:0,name:\"server-port\",qname:\"request:server-port\",signature:\"() as xs:int\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the sever port to which the client making the current request\\n is connected.</p>\\n',summary:\"<p>  Returns the sever port to which the client making the current request\\n is connected.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:int\",description:\"The server port to which the client is connected.\"},errors:[]},{isDocumented:!0,arity:0,name:\"text-content\",qname:\"request:text-content\",signature:\"() as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the content of the request only\\n if the content-type refers to a type that can be treated\\n as text (e.g. text/* or application/xml). The function raises\\n an error if the content cannot be treated as text.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The text content is interpreted using the encoding/charset\\n that is specified in the Content-Type header of the request. If\\n no charset is specified, the default ISO-8859-1 is used. If a encoding\\n other than the specified or default one should be used, the\\n <tt>request:text-content#1</tt> function should be used.</p>\\n',summary:\"<p>  Returns the content of the request as string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The content of the request as a string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding specified in the Content-Type header is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the content contained in the body of the request cannot be treated as text.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-content\",qname:\"request:text-content\",signature:\"($overwrite-encoding as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the content of the request as string interpreting\\n it with the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the content of the request only\\n if the content-type refers to a type that can be treated\\n as text (e.g. text/* or application/xml). The function raises\\n an error if the content cannot be treated as text.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The text content is interpreted using the given encoding/charset.\\n That is, the charset specified in the Content-Type header of the request\\n is ignored. An error is raised if the given encoding is invalid\\n or not supported.</p>\\n',summary:\"<p>  Returns the content of the request as string interpreting\\n it with the given encoding.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"overwrite-encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"The content of the request as a string.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding specified in the Content-Type header or the $overwrite-encoding parameter is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the content contained in the body of the request cannot be treated as text.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"text-part\",qname:\"request:text-part\",signature:\"($ref as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as string</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> field returned by the <tt>request:parts</tt> function.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value of the text part is interpreted using the encoding/charset\\n given in the headers of the part. If no encoding is given, the default\\n US-ASCII is assumed.</p>\\n',summary:\"<p>  Returns the value of a part as string \\n  A part is identified by a reference that is the value of a\\n  src  field returned by the  request:parts  function.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'}],returns:{type:\"xs:string\",description:\"the value of the part as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding given in the headers of the part is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"text-part\",qname:\"request:text-part\",signature:\"($ref as xs:string, $overwrite-encoding as xs:string) as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the value of a part as string interpreting\\n it with the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A part is identified by a reference that is the value of a\\n <tt>src</tt> field returned by the <tt>request:parts</tt> function.</p>\\n',summary:\"<p>  Returns the value of a part as string interpreting\\n it with the given encoding.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"ref\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the part</div>'},{name:\"overwrite-encoding\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"the value of the part as string\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-encoding if the encoding given using the $overwrite-encoding parameter is invalid or not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:no-text-content if the value of the part cannot be treated as text</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-part if the part with the given name ($ref) does not exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:non-multipart if the current request does not contain multipart content</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">request:invalid-multipart if the multipart content is invalid (e.g. the boundary is missing)</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"uri\",qname:\"request:uri\",signature:\"() as xs:string\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the URI that was used to make this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The value returned contains the part of the URL starting\\n from the path to the end or the starting of the fragment (i.e.\\n the \\'#\\' character).</p>\\n',summary:\"<p>  Returns the URI that was used to make this request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string\",description:\"The path and query string part of the request's URL\"},errors:[]},{isDocumented:!0,arity:0,name:\"user-agent\",qname:\"request:user-agent\",signature:\"() as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the user agent that made to perform the current request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function returns the value of the User-Agent header\\n contained in the current request.</p>\\n',summary:\"<p>  Returns the user agent that made to perform the current request.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:string?\",description:\"The user agent used to perform this request of the empty sequence if there was no User-Agent header in the request.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/physical-reference\":{ns:\"http://www.28msec.com/modules/physical-reference\",description:' The module provides functions to compute an immutable and opaque reference\\n for nodes, objects, or arrays and to retrieve such items given their\\n identifier, respectively.\\n The identifiers are immutable, i.e. a identifier does not change\\n during the items lifetime and cannot be reused for another item after the\\n original item gets deleted.\\n Identifiers are unique, in that, two different items will never have the same\\n identifier. A item, at any time during its lifetime, can be retrieved by its\\n identifier. Identifiers can only be computed for items stored in a MongoDB\\n collection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please see the <a href=\"../../html/data_lifecycle.html\">data lifecycle\\n documentation</a> about details on storing items.</p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"../../html/data_lifecycle.html\">Data Lifecycle</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.28msec.com/modules/physical-reference\",prefix:\"ref\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"dereference\",qname:\"ref:dereference\",signature:\"($arg as object()) as item()? external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the node, object, or array identified by the given reference.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns the empty sequence if the item\\n that is referenced does not exist.</p>\\n',summary:\"<p>  Returns the node, object, or array identified by the given reference.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the identifier of the item to retrieve.</div>'}],returns:{type:\"item()?\",description:\"the item identified by the identifier passed as parameter or the empty-sequence if no item with that URI is found.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ref::REFERENCE is if the given identifier is invalid.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"reference\",qname:\"ref:reference\",signature:\"($arg as item()) as object() external\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an immutable and opaque reference (with type xs:anyURI) for\\n a given node, object, or array.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The generated identifier is immutable, i.e. a identifier does not\\n change during the item\\'s lifetime and cannot be reused for another node after\\n the original item gets deleted.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Identifiers are also unique, in that, two different items will never\\n have the same identifier.</p>\\n A item, at any time during its lifetime, can be retrieved by its\\n identifier, using the <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ref:dereference</tt> function.\\n Please note that a reference can only be retrieved for a JSON object or JSON\\n array if the item is a member of a collection.\\n',summary:\"<p>  Returns an immutable and opaque reference (with type xs:anyURI) for\\n a given node, object, or array.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"arg\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node, object, or array for which the URI should be computed</div>'}],returns:{type:\"object()\",description:\"the opaque URI of the item.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ref::COLLECTION is raised if the object or array passed as argument is not a member of a collection.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/data-cleaning/conversion\":{ns:\"http://zorba.io/modules/data-cleaning/conversion\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides data conversion functions for processing calendar dates,\\n temporal values, currency values, units of measurement, location names and postal addresses.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins and Diogo Simões</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/data-cleaning/conversion\",prefix:\"conversion\"},{uri:\"http://www.ecb.int/vocabulary/2002-08-01/eurofxref\",prefix:\"exref\"},{uri:\"http://www.zorba-xquery.com/modules/http-client\",prefix:\"http\"},{uri:\"http://zorba.io/modules/reflection\",prefix:\"reflection\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://api.whitepages.com/schema/\",prefix:\"wp\"}],functions:[{isDocumented:!0,arity:1,name:\"address-from-domain\",qname:\"conversion:address-from-domain\",signature:\"($domain as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the addresses associated to the name.</p>\\n',summary:\"<p>  Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the addresses associated to the name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"domain\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:'A sequence of strings for the addresses associated to the domain name. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b> Attention : This function is still not implemented. </b></p>'},errors:[]},{isDocumented:!0,arity:2,name:\"address-from-geocode\",qname:\"conversion:address-from-geocode\",signature:\"($lat as xs:double, $lon as xs:double) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Geospatial coordinates to placename converter, acting as a wrapper over the Yahoo! reverse geocoder service.</p>\\n',summary:\"<p>  Geospatial coordinates to placename converter, acting as a wrapper over the Yahoo! reverse geocoder service.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"lat\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Geospatial latitude.</div>'},{name:\"lon\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Geospatial longitude.</div>'}],returns:{type:\"xs:string*\",description:\"The sequence of strings corresponding to the different components (e.g., street, city, country, etc.) of the place name that corresponds to the input geospatial coordinates.\"},errors:[]},{isDocumented:!0,arity:1,name:\"address-from-phone\",qname:\"conversion:address-from-phone\",signature:\"($phone-number as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given phone number,\\n returning a string for the address associated to the phone number.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given phone number,\\n returning a string for the address associated to the phone number.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"phone-number\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string with 10 digits corresponding to the phone number.</div>'}],returns:{type:\"xs:string*\",description:\"A string for the addresses associated to the phone number.\"},errors:[]},{isDocumented:!0,arity:1,name:\"address-from-user\",qname:\"conversion:address-from-user\",signature:\"($name as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given name,\\n returning a sequence of strings for the addresses associated to the name.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given name,\\n returning a sequence of strings for the addresses associated to the name.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of person or organization.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings for the addresses associated to the name.\"},errors:[]},{isDocumented:!0,arity:4,name:\"currency-convert\",qname:\"conversion:currency-convert\",signature:\"($v as xs:double, $m1 as xs:string, $m2 as xs:string, $date as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Currency conversion function, acting as a wrapper over the WebService from the European Central Bank.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">WebService documentation at <a src=\"http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html\">http://www.ecb.int/stats/exchange/eurofxref/html/index.en.html</a></p>\\n',summary:\"<p>  Currency conversion function, acting as a wrapper over the WebService from the European Central Bank.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"v\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The amount we wish to convert.</div>'},{name:\"m1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The source currency (e.g., \"EUR\").</div>'},{name:\"m2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The target currency (e.g., \"USD\").</div>'},{name:\"date\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The reference date.</div>'}],returns:{type:\"xs:double\",description:\"The value resulting from the conversion.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">conversion:NOTSUPPORTED if the date, the source currency type or the target currency type are not known to the service.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"geocode-from-address\",qname:\"conversion:geocode-from-address\",signature:\"($q as xs:string*) as xs:double*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Placename to geospatial coordinates converter, acting as a wrapper over the Yahoo! geocoder service.</p>\\n',summary:\"<p>  Placename to geospatial coordinates converter, acting as a wrapper over the Yahoo! geocoder service.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"q\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings corresponding to the different components (e.g., street, city, country, etc.) of the place name.</div>'}],returns:{type:\"xs:double*\",description:\"The pair of latitude and longitude coordinates associated with the input address.\"},errors:[]},{isDocumented:!0,arity:1,name:\"name-from-domain\",qname:\"conversion:name-from-domain\",signature:\"($domain as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the person or organization names associated to the name.</p>\\n',summary:\"<p>  Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the person or organization names associated to the name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"domain\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:'A sequence of strings for the person or organization names associated to the domain name. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b> Attention : This function is still not implemented. </b></p>'},errors:[]},{isDocumented:!0,arity:1,name:\"phone-from-address\",qname:\"conversion:phone-from-address\",signature:\"($address as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given address,\\n returning a sequence of strings for the phone number associated to the address.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given address,\\n returning a sequence of strings for the phone number associated to the address.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string corresponding to the address (ex: 5655 E Gaskill Rd, Willcox, AZ, US).</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings for the phone number or organization's names associated to the address.\"},errors:[]},{isDocumented:!0,arity:1,name:\"phone-from-domain\",qname:\"conversion:phone-from-domain\",signature:\"($domain as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the phone numbers associated to the name.</p>\\n',summary:\"<p>  Uses a whois service to discover information about a given domain name, returning a sequence of strings\\n for the phone numbers associated to the name.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"domain\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:'A sequence of strings for the phone numbers associated to the domain name. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b> Attention : This function is still not implemented. </b></p>'},errors:[]},{isDocumented:!0,arity:1,name:\"phone-from-user\",qname:\"conversion:phone-from-user\",signature:\"($name as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given name,\\n returning a sequence of strings for the phone numbers associated to the name.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given name,\\n returning a sequence of strings for the phone numbers associated to the name.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The name of person or organization.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings for the phone numbers associated to the name.\"},errors:[]},{isDocumented:!0,arity:4,name:\"unit-convert\",qname:\"conversion:unit-convert\",signature:\"($v as xs:double, $t as xs:string, $m1 as xs:string, $m2 as xs:string) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Conversion function for units of measurement, acting as a wrapper over the CuppaIT WebService.</p>\\n',summary:\"<p>  Conversion function for units of measurement, acting as a wrapper over the CuppaIT WebService.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"v\",type:\"xs:double\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The amount we wish to convert.</div>'},{name:\"t\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The type of metric (e.g., \"Distance\")</div>'},{name:\"m1\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The source measurement unit metric (e.g., \"meter\")</div>'},{name:\"m2\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The target measurement unit metric (e.g., \"mile\")</div>'}],returns:{type:\"xs:double\",description:\"The value resulting from the conversion\"},errors:[]},{isDocumented:!0,arity:1,name:\"user-from-address\",qname:\"conversion:user-from-address\",signature:\"($address as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given address,\\n returning a sequence of strings for the names associated to the address.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given address,\\n returning a sequence of strings for the names associated to the address.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"address\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string corresponding to the address (ex: 5655 E Gaskill Rd, Willcox, AZ, US).</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings for the person or organization's names associated to the address.\"},errors:[]},{isDocumented:!0,arity:1,name:\"user-from-phone\",qname:\"conversion:user-from-phone\",signature:\"($phone-number as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Uses a White-pages Web service to discover information about a given phone number,\\n returning a sequence of strings for the name associated to the phone number.</p>\\n',summary:\"<p>  Uses a White-pages Web service to discover information about a given phone number,\\n returning a sequence of strings for the name associated to the phone number.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"phone-number\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A string with 10 digits corresponding to the phone number.</div>'}],returns:{type:\"xs:string*\",description:\"A sequence of strings for the person or organization's name associated to the phone number.\"},errors:[]}],variables:[{name:\"conversion:key\",type:\"item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The key to be used when accessing the White Pages Web service</p>\\n'}]},\"http://www.28msec.com/modules/jdbc\":{ns:\"http://www.28msec.com/modules/jdbc\",description:' This module allows connecting, querying, and updating JDBC datasources.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The results of a query are returned as a sequence of objects:\\n <code> { column: value } </code>.\\n The type of the value depends on the type of the column in the database:\\n <table class=\"table table-bordered\">\\n   <tr><th>JDBC Types</th><th>JSONiq Type</th></tr>\\n   <tr><td>integer, bigint, smallint, tinyint</td><td>integer</td></tr>\\n   <tr><td>decimal, double, float, numeric, real</td><td>double</td></tr>\\n   <tr><td>boolean, bit</td><td>boolean</td></tr>\\n   <tr><td>char, blob, longvarchar, longnvarchar, nchar, nclob, nvarchar,\\n  varchar, sqlxml, date, time, timestamp</td><td>string</td></tr>\\n   <tr><td>binary, blob, longvarbinary, varbinary, array, datalink,\\n  java_object, other, ref</td><td>base64Binary</td></tr>\\n </table>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n If the value of a column is null, it is mapped to the JSONiq null value.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Connecting to a JDBC source requires the following options:\\n <ul>\\n   <li><tt>url</tt>: the JDBC connection URI (mandatory)</li>\\n   <li><tt>user</tt>: the user used for connecting (optional)</li>\\n   <li><tt>password</tt>: the password used for connecting (optional)</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Examples:\\n <ul>\\n  <li><pre>\\n {\\n   \"url\" : \"jdbc:mysql://localhost/testdb\",\\n   \"user\" : \"root\",\\n   \"password\" : \"\"\\n }</pre></li>\\n  <li><pre>\\n {\\n   \"url\" : \"jdbc:sqlserver://192.168.1.1;databaseName=testdb\",\\n   \"user\" : \"sa\",\\n   \"password\" : \"\"\\n }</pre></li>\\n  <li><pre>\\n {\\n   \"url\" : \"jdbc:postgresql://localhost/testdb\",\\n   \"user\" : \"root\",\\n   \"password\" : \"\"\\n }</pre></li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Currently, the 28.io platform supports connections to\\n <ul>\\n   <li>MySQL using the mariadb-java-client.jar version 1.1.2,</li>\\n   <li>PostgreSQL using postgresql.jar version 9.2, and </li>\\n   <li>Microsoft SQL Server using sqljdbc4.jar version 4.0.</li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If you are interested in connecting to other JDBC datasources,\\n please contact us at support@28.io.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The non side-effecting functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-0\">connect#0</a></li>\\n   <li><a href=\"?anchor=connect-1\">connect#1</a></li>\\n   <li><a href=\"?anchor=connect-2\">connect#2</a></li>\\n   <li><a href=\"?anchor=execute-query-2\">execute-query#2</a></li>\\n   <li><a href=\"?anchor=execute-query-prepared-1\">execute-query-prepared#1</a></li>\\n   <li><a href=\"?anchor=tables-1\">tables#1</a></li>\\n   <li><a href=\"?anchor=tables-4\">tables#4</a></li>\\n </ul>\\n are declared deterministic, which means that their results could be cached\\n when invoked multiple times with the same arguments in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use the following alternative functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-notdeterministic-0\">connect-notdeterministic#0</a></li>\\n   <li><a href=\"?anchor=connect-notdeterministic-1\">connect-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=connect-notdeterministic-2\">connect-notdeterministic#2</a></li>\\n   <li><a href=\"?anchor=execute-query-notdeterministic-2\">execute-query-notdeterministic#2</a></li>\\n   <li><a href=\"?anchor=execute-query-prepared-notdeterministic-1\">execute-query-prepared-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=tables-notdeterministic-1\">tables-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=tables-notdeterministic-4\">tables-notdeterministic#4</a></li>\\n </ul>\\n which have been declared as being non deterministic.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cristi Dumitru</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://www.28msec.com/modules/jdbc\",prefix:\"jdbc\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://www.zorba-xquery.com/modules/jdbc\",prefix:\"zjdbc\"}],functions:[{isDocumented:!0,arity:1,name:\"affected-rows\",qname:\"jdbc:affected-rows\",signature:\"($dataset as anyURI) as integer\",description:\" Return the number of affected rows of an updating DataSet.\\n\",summary:\"<p> Return the number of affected rows of an updating DataSet.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the DataSet.</div>'}],returns:{type:\"integer\",description:\"the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"clear-params\",qname:\"jdbc:clear-params\",signature:\"($prepared-statement as anyURI) as empty-sequence()\",description:\" Clear all the parameters of the statement.\\n\",summary:\"<p> Clear all the parameters of the statement.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"commit\",qname:\"jdbc:commit\",signature:\"($conn as anyURI) as empty-sequence()\",description:\" Commit current transaction from an active connection.\\n\",summary:\"<p> Commit current transaction from an active connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the connection with a transaction to be commited.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"connect-nondeterministic\",qname:\"jdbc:connect-nondeterministic\",signature:\"() as anyURI\",description:' Open a connection to a database using the default credentials.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#connect-0\">connect#0</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Open a connection to a database using the default credentials.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The default credentials not found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect-nondeterministic\",qname:\"jdbc:connect-nondeterministic\",signature:\"($connection-config as item()) as anyURI\",description:' Open a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#connect-1\">connect#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Open a connection to a database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object containing the configuration information.</div>'}],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The specified credentials have not been found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-VALID Invalid connection information.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect-nondeterministic\",qname:\"jdbc:connect-nondeterministic\",signature:\"($connection-config as item(), $options as object()?) as anyURI\",description:' Open a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#connect-2\">connect#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Open a connection to a database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object containing the configuration information.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object to specify additional connection options.</div>'}],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The specified credentials have not been found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-VALID Invalid connection information.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"connect\",qname:\"jdbc:connect\",signature:\"() as anyURI\",description:' Open a connection to a database using the default credentials.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that can represents the connection.\\n This URI has to be passed to other functions of this module that require\\n the <tt>$conn</tt> parameter as a first argument.</p>\\n',summary:\"<p> Open a connection to a database using the default credentials.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The default credentials not found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect\",qname:\"jdbc:connect\",signature:\"($connection-config as item()) as anyURI\",description:' Open a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The input to the function contains the connection information.\\n If a string is used, then the function will interpret it as credential name\\n and will connect using the JDBC credentials with the specified name.\\n If an object is used, then the function will open a connection using it.\\n The object\\'s required structure is described in the module\\'s description.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that can represents the connection.\\n This URI has to be passed to other functions of this module that require\\n the <tt>$conn</tt> parameter as a first argument.</p>\\n',summary:\"<p> Open a connection to a database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object containing the configuration information.</div>'}],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The specified credentials have not been found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-VALID Invalid connection information.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect\",qname:\"jdbc:connect\",signature:\"($connection-config as item(), $options as object()?) as anyURI\",description:' Open a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The input to the function contains the connection information.\\n If a string is used, then the function will interpret it as credential name\\n and will connect using the JDBC credentials with the specified name.\\n If an object is used, then the function will open a connection using it.\\n The object\\'s required structure is described in the module\\'s description.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition to the connection configuration, the function allows to\\n specify several options:\\n <ul>\\n   <li><tt>autocommit</tt>: <tt>true/false</tt> turn on/off auto commit\\n (default: true)</li>\\n   <li><tt>readonly</tt>: <tt>true/false</tt> configure readonly/write on this\\n connection (default: false)</li>\\n   <li><tt>isolation-level</tt>: configure the isolation level for this connection\\n     <ul>\\n       <li><tt>READ-COMMITTED</tt>: set the isolation level read-committed</li>\\n       <li><tt>READ-UNCOMMITTED</tt>: set the isolation level read-uncommitted</li>\\n       <li><tt>READ-REPEATABLE</tt>: set the isolation level repeatable-read</li>\\n       <li><tt>SERIALIZABLE</tt>: set the isolation level serializable</li>\\n     </ul>\\n   If no isolation level is provided by the user the connection will be created\\n   with the default isolation level of the database.</li>\\n </ul></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function returns an opaque URI that represents the connection.\\n This URI has to be passed to other functions of this module that require\\n the <tt>$conn</tt> parameter as a first argument.</p>\\n',summary:\"<p> Open a connection to a database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-config\",type:\"item()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object containing the configuration information.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> object to specify additional connection options.</div>'}],returns:{type:\"anyURI\",description:\"an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-FOUND The specified credentials have not been found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NOT-VALID Invalid connection information.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connection-options\",qname:\"jdbc:connection-options\",signature:\"($conn as anyURI) as object()\",description:' Return a set with options for a specified connection.\\n The returned options are equal to the options specified in function jdbc:connect.\\n Consequently, the options are specified as follows:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li><tt>autocommit</tt>: <tt>true/false</tt> shows auto commit</li>\\n   <li><tt>readonly</tt>: <tt>true/false</tt> shows if the connection is readonly/write</li>\\n   <li><tt>isolation-level</tt>: shows the isolation level for this connection\\n     <ul>\\n       <li><tt>READ-COMMITTED</tt>: isolation level is read-committed</li>\\n       <li><tt>READ-UNCOMMITTED</tt>: isolation level is read-uncommitted</li>\\n       <li><tt>READ-REPEATABLE</tt>: isolation level is repeatable-read</li>\\n       <li><tt>SERIALIZABLE</tt>: isolation level is serializable</li>\\n     </ul></li>\\n </ul>\\n',summary:\"<p> Return a set with options for a specified connection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the connection.</div>'}],returns:{type:\"object()\",description:\"an object with the connection options.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-prepared\",qname:\"jdbc:execute-prepared\",signature:\"($prepared-statement as anyURI) as anyURI\",description:\" Execute SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly and returns an identifier to\\n a Dataset.\\n\",summary:\"<p> Execute SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly and returns an identifier to\\n a Dataset.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"anyURI\",description:\"the identifier of a DataSet.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-query-nondeterministic\",qname:\"jdbc:execute-query-nondeterministic\",signature:\"($conn as anyURI, $sql as string) as object()*\",description:' Execute non-updating SQL statements.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#execute-query-2\">execute-query#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Execute non-updating SQL statements.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection.</div>'},{name:\"sql\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"object()*\",description:\"an object with the result data rows from the query provided.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Updating type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-query-prepared-nondeterministic\",qname:\"jdbc:execute-query-prepared-nondeterministic\",signature:\"($prepared-statement as anyURI) as object()*\",description:' Execute non-updating SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#execute-query-prepared-1\">execute-query-prepared#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Execute non-updating SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"object()*\",description:\"an object with the result data rows from the query processed with the parameters provided.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The prepared statement is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-query-prepared\",qname:\"jdbc:execute-query-prepared\",signature:\"($prepared-statement as anyURI) as object()*\",description:' Execute non-updating SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Every row is represented by an object of column-value representation, as\\n in the module description.</p>\\n',summary:\"<p> Execute non-updating SQL statements prepared with jdbc:prepare-statement,\\n after setting the parameters values accordingly.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"object()*\",description:\"an object with the result data rows from the query processed with the parameters provided.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The prepared statement is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-query\",qname:\"jdbc:execute-query\",signature:\"($conn as anyURI, $sql as string) as object()*\",description:' Execute non-updating SQL statements.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Every row is represented by an object of column-value representation, as in\\n the module description.</p>\\n',summary:\"<p> Execute non-updating SQL statements.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection.</div>'},{name:\"sql\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"object()*\",description:\"an object with the result data rows from the query provided.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Updating type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-update-prepared\",qname:\"jdbc:execute-update-prepared\",signature:\"($prepared-statement as anyURI) as integer\",description:\" Execute updating SQL statements prepared with jdbc:prepare-statement.\\n\",summary:\"<p> Execute updating SQL statements prepared with jdbc:prepare-statement.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"integer\",description:\"the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL006 The prepared statement is a non-updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-update\",qname:\"jdbc:execute-update\",signature:\"($conn as anyURI, $sql as string) as integer\",description:\" Execute updating SQL statements.\\n\",summary:\"<p> Execute updating SQL statements.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection.</div>'},{name:\"sql\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"integer\",description:\"the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Read-only type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute\",qname:\"jdbc:execute\",signature:\"($conn as anyURI, $sql as string) as anyURI\",description:\" Execute any kind of SQL statement.\\n\",summary:\"<p> Execute any kind of SQL statement.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection.</div>'},{name:\"sql\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"anyURI\",description:\"an identifier of a DataSet.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-connected\",qname:\"jdbc:is-connected\",signature:\"($conn as anyURI) as boolean\",description:\" Verify if a connection is still active.\\n\",summary:\"<p> Verify if a connection is still active.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the connection to be verified.</div>'}],returns:{type:\"boolean\",description:\"true if connected, false otherwise\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"metadata\",qname:\"jdbc:metadata\",signature:\"($dataset as anyURI) as object()\",description:' Return the metadata of the result of a DataSet.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n More in detail, it returns information about column names, types, and whether\\n a column can contain a null value.\\n The metadata information can only be returned for DataSets that have been\\n executed explicitly using the jdbc:execute function.\\n The metadata node returned has the following structure:\\n <pre>{\\n   \"columns\": [ {\\n       \"name\": string,\\n       \"type\": string,\\n       \"autoincrement\"? = boolean,\\n       \"nillable\"? = boolean } * ]\\n }</pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n If the query is an updating query, then the result object will return the\\n number of affected rows like:\\n <pre>{ \"affectedrows\": integer }</pre>\\n </p>\\n',summary:\"<p> Return the metadata of the result of a DataSet.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the DataSet.</div>'}],returns:{type:\"object()\",description:\"the metadata associated with an executed DataSet.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"parameter-metadata\",qname:\"jdbc:parameter-metadata\",signature:\"($prepared-statement as anyURI) as object()\",description:' Retrieve the names and types of the prepared statement parameters.\\n The metadata returned has the following structure:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">  {\\n     columns: [{\\n       \"name\": string,\\n       \"type\": string\\n       }]\\n   } </pre>\\n',summary:\"<p> Retrieve the names and types of the prepared statement parameters.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'}],returns:{type:\"object()\",description:\"parameters metadata (name and type) associated with a prepared statement.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"prepare-statement\",qname:\"jdbc:prepare-statement\",signature:\"($conn as anyURI, $sql as string) as anyURI\",description:' Create a prepared statement for multiple executions with diferent parameters.\\n Example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n jdbc:prepare-statement($connection, \"SELECT * FROM users WHERE id=? AND age&gt;?\")\\n </pre>\\n',summary:\"<p> Create a prepared statement for multiple executions with diferent parameters.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the active connection.</div>'},{name:\"sql\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"anyURI\",description:\"the identifier of the prepared statement.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"result-set\",qname:\"jdbc:result-set\",signature:\"($dataset as anyURI) as object()*\",description:\" Extract the data rows from a non-updating DataSet.\\n Every row is represented by an object of column-value representation, as in\\n the module description.\\n\",summary:\"<p> Extract the data rows from a non-updating DataSet.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the DataSet.</div>'}],returns:{type:\"object()*\",description:\"an object with the result data rows from the DataSet provided.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"rollback\",qname:\"jdbc:rollback\",signature:\"($conn as anyURI) as empty-sequence()\",description:\" Rollback the current transaction of a connection.\\n\",summary:\"<p> Rollback the current transaction of a connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the connection with a transaction to be rollbacked.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-boolean\",qname:\"jdbc:set-boolean\",signature:\"($prepared-statement as anyURI, $parameter-index as integer, $value as boolean) as empty-sequence()\",description:' Set the value of the designated parameter with a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">boolean</tt> value.\\n',summary:\"<p> Set the value of the designated parameter with a  boolean  value.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'},{name:\"parameter-index\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set-null\",qname:\"jdbc:set-null\",signature:\"($prepared-statement as anyURI, $parameter-index as integer) as empty-sequence()\",description:' Set the value of the designated parameter with a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">NULL</tt> value.\\n',summary:\"<p> Set the value of the designated parameter with a  NULL  value.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'},{name:\"parameter-index\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-numeric\",qname:\"jdbc:set-numeric\",signature:\"($prepared-statement as anyURI, $parameter-index as decimal, $value as anyAtomicType) as empty-sequence()\",description:' Set the value of the designated parameter with a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">numeric</tt> value.\\n',summary:\"<p> Set the value of the designated parameter with a  numeric  value.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'},{name:\"parameter-index\",type:\"decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-string\",qname:\"jdbc:set-string\",signature:\"($prepared-statement as anyURI, $parameter-index as integer, $value as string) as empty-sequence()\",description:' Set the value of the designated parameter with a <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">string</tt> value.\\n',summary:\"<p> Set the value of the designated parameter with a  string  value.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'},{name:\"parameter-index\",type:\"integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-value\",qname:\"jdbc:set-value\",signature:\"($prepared-statement as anyURI, $parameter-index as decimal, $value as anyAtomicType) as empty-sequence()\",description:\" Set the value of the designated parameter with the given value.\\n The function will try to cast the value to the correct data type and assign\\n it to the parameter.\\n\",summary:\"<p> Set the value of the designated parameter with the given value.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier of the prepared statement.</div>'},{name:\"parameter-index\",type:\"decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tables-nondeterministic\",qname:\"jdbc:tables-nondeterministic\",signature:\"($conn as anyURI) as object()*\",description:' Return the list of tables from a connection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#tables-1\">tables#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Return the list of tables from a connection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"tables-nondeterministic\",qname:\"jdbc:tables-nondeterministic\",signature:\"($conn as anyURI, $catalog as string?, $schema as string?, $table as string?) as object()*\",description:' Return the list of tables from a connection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#tables-4\">tables#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Return the list of tables from a connection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'},{name:\"catalog\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the catalog name of the tables. Send empty-sequence for all tables.</div>'},{name:\"schema\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the schema name of the tables. Send empty-sequence for all tables.</div>'},{name:\"table\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the name of the tables. Send empty-sequence for all tables.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tables\",qname:\"jdbc:tables\",signature:\"($conn as anyURI) as object()*\",description:' Return the list of tables from a connection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Return the list of tables from a connection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"tables\",qname:\"jdbc:tables\",signature:\"($conn as anyURI, $catalog as string?, $schema as string?, $table as string?) as object()*\",description:' Return the list of tables from a connection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Return the list of tables from a connection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"conn\",type:\"anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'},{name:\"catalog\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the catalog name of the tables. Send empty-sequence for all tables.</div>'},{name:\"schema\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the schema name of the tables. Send empty-sequence for all tables.</div>'},{name:\"table\",type:\"string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the name of the tables. Send empty-sequence for all tables.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']}],variables:[{name:\"jdbc:READ-COMMITTED\",type:\"item()*\",description:\" This variable represents the READ-COMMITTED Isolation Level.\\n\"},{name:\"jdbc:READ-UNCOMMITTED\",type:\"item()*\",description:\" This variable represents the READ-UNCOMMITTED Isolation Level.\\n\"},{name:\"jdbc:REPEATABLE-READ\",type:\"item()*\",description:\" This variable represents the REPEATABLE-READ Isolation Levels.\\n\"},{name:\"jdbc:SERIALIZABLE\",type:\"item()*\",description:\" This variable represents the SERIALIZABLE Isolation Levels.\\n\"},{name:\"jdbc:CREDENTIALS-CATEGORY\",type:\"item()*\",description:\" This variable represents the category for the credentials used.\\n\"}]},\"http://zorba.io/modules/full-text\":{ns:\"http://zorba.io/modules/full-text\",description:' This module provides an XQuery API to full-text functions.\\n For general information about this implementation of the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xpath-full-text-10/\">XQuery and XPath Full Text 1.0 specification</a>\\n as well as instructions for building an installing a thesaurus,\\n see the <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/ft_thesaurus.html\">Full Text Thesaurus documentation</a>.\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on languages</h2>\\n To refer to particular human languages,\\n uses either the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://en.wikipedia.org/wiki/ISO_639-1\">ISO 639-1</a>\\n or\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://en.wikipedia.org/wiki/ISO_639-2\">ISO 639-2</a>\\n languages codes.\\n Note that only a subset of the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes\">complete list of language codes</a>\\n are supported and not every function supports the same subset.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Most functions in this module take a language as a parameter\\n using the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>\\n XML schema data type.\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on stemming</h2>\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">stem()</code> functions return the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://en.wikipedia.org/wiki/Word_stem\">stem</a>\\n of a word.\\n The stem of a word itself, however, is not guaranteed to be a word.\\n It is best to consider a stem as an opaque byte sequence.\\n All that is guaranteed about a stem is that,\\n for a given word,\\n the stem of that word will always be the same byte sequence.\\n Hence,\\n you should never compare the result of one of the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">stem()</code>\\n functions against a non-stemmed string,\\n for example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  if ( ft:stem( \"apples\" ) eq \"apple\" )             ** WRONG **\\n </pre>\\n Instead do:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n  if ( ft:stem( \"apples\" ) eq ft:stem( \"apple\" ) )  ** CORRECT **\\n </pre>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on the thesaurus</h2>\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">thesaurus-lookup()</code> functions have \"levels\"\\n and \"relationship\" parameters.\\n The values for these are implementation-defined.\\n The default implementation uses the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://wordnet.princeton.edu/\">WordNet lexical database</a>,\\n version 3.0.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n In WordNet,\\n the number of \"levels\" that two phrases are apart\\n are how many hierarchical meanings apart they are.\\n For example,\\n \"canary\" is 5 levels away from \"vertebrate\"\\n (carary &gt; finch &gt; oscine &gt; passerine &gt; bird &gt; vertebrate).\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n When using the WordNet implementation,\\n all of the relationships (and their abbreviations)\\n specified by\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=7776\">ISO 2788</a>\\n and\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a\">ANSI/NISO Z39.19-2005</a>\\n with the exceptions of \"HN\" (history note)\\n and \"X SN\" (see scope note for) are supported.\\n These relationships are:\\n  <table xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    <tr>\\n      <th>Rel.</th>\\n      <th>Meaning</th>\\n      <th>WordNet Rel.</th>\\n    </tr>\\n    <tr>\\n      <td>BT</td>\\n      <td>broader term</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTG</td>\\n      <td>broader term generic</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTI</td>\\n      <td>broader term instance</td>\\n      <td>instance hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>BTP</td>\\n      <td>broader term partitive</td>\\n      <td>part meronym</td>\\n    </tr>\\n    <tr>\\n      <td>NT</td>\\n      <td>narrower term</td>\\n      <td>hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTG</td>\\n      <td>narrower term generic</td>\\n      <td>hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTI</td>\\n      <td>narrower term instance</td>\\n      <td>instance hyponym</td>\\n    </tr>\\n    <tr>\\n      <td>NTP</td>\\n      <td>narrower term partitive</td>\\n      <td>part holonym</td>\\n    </tr>\\n    <tr>\\n      <td>RT</td>\\n      <td>related term</td>\\n      <td>also see</td>\\n    </tr>\\n    <tr>\\n      <td>SN</td>\\n      <td>scope note</td>\\n      <td>n/a</td>\\n    </tr>\\n    <tr>\\n      <td>TT</td>\\n      <td>top term</td>\\n      <td>hypernym</td>\\n    </tr>\\n    <tr>\\n      <td>UF</td>\\n      <td>non-preferred term</td>\\n      <td>n/a</td>\\n    </tr>\\n    <tr>\\n      <td>USE</td>\\n      <td>preferred term</td>\\n      <td>n/a</td>\\n    </tr>\\n  </table>\\n Note that you can specify relationships\\n either by their abbreviation\\n or their meaning.\\n Relationships are case-insensitive.\\n In addition to the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=7776\">ISO 2788</a>\\n and\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.niso.org/kst/reports/standards?step=2&amp;gid=&amp;project_key=7cc9b583cb5a62e8c15d3099e0bb46bbae9cf38a\">ANSI/NISO Z39.19-2005</a>\\n relationships,\\n All of the relationships offered by WordNet are also supported.\\n These relationships are:\\n  <table xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ft_rels\">\\n    <tr>\\n      <th>Relationship</th>\\n      <th>Meaning</th>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">also see</td>\\n      <td>\\n        A word that is related to another,\\n        e.g., for \"varnished\" (furniture)\\n        one should <em>also see</em> \"finished.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>antonym</td>\\n      <td>\\n        A word opposite in meaning to another,\\n        e.g., \"light\" is an <em>antonym</em> for \"heavy.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>attribute</td>\\n      <td>\\n        A noun for which adjectives express values,\\n        e.g., \"weight\" is an <em>attribute</em>\\n        for which the adjectives \"light\" and \"heavy\"\\n        express values.\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>cause</td>\\n      <td>\\n        A verb that causes another,\\n        e.g., \"show\" is a <em>cause</em> of \"see.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">derivationally related form</td>\\n      <td>\\n        A word that is derived from a root word,\\n        e.g., \"metric\" is a <em>derivationally related form</em> of \"meter.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">derived from adjective</td>\\n      <td>\\n        An adverb that is derived from an adjective,\\n        e.g., \"correctly\" is <em>derived from the adjective</em> \"correct.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>entailment</td>\\n      <td>\\n        A verb that presupposes another,\\n        e.g., \"snoring\" <em>entails</em> \"sleeping.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>hypernym</td>\\n      <td>\\n        A word with a broad meaning that more specific words fall under,\\n        e.g., \"meal\" is a <em>hypernym</em> of \"breakfast.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>hyponym</td>\\n      <td>\\n        A word of more specific meaning than a general term applicable to it,\\n        e.g., \"breakfast\" is a <em>hyponym</em> of \"meal.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">instance hypernym</td>\\n      <td>\\n        A word that denotes a category of some specific instance,\\n        e.g., \"author\" is an <em>instance hypernym</em> of \"Asimov.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">instance hyponym</td>\\n      <td>\\n        A term that donotes a specific instance of some general category,\\n        e.g., \"Asimov\" is an <em>instance hyponym</em> of \"author.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">member holonym</td>\\n      <td>\\n        A word that denotes a collection of individuals,\\n        e.g., \"faculty\" is a <em>member holonym</em> of \"professor.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">member meronym</td>\\n      <td>\\n        A word that denotes a member of a larger group,\\n        e.g., a \"person\" is a <em>member meronym</em> of a \"crowd.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">part holonym</td>\\n      <td>\\n        A word that denotes a larger whole comprised of some part,\\n        e.g., \"car\" is a <em>part holonym</em> of \"engine.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">part meronym</td>\\n      <td>\\n        A word that denotes a part of a larger whole,\\n        e.g., an \"engine\" is <em>part meronym</em> of a \"car.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">participle of verb</td>\\n      <td>\\n        An adjective that is the participle of some verb,\\n        e.g., \"breaking\" is the <em>participle of the verb</em> \"break.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td>pertainym</td>\\n      <td>\\n        An adjective that classifies its noun,\\n        e.g., \"musical\" is a <em>pertainym</em> in \"musical instrument.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">similar to</td>\\n      <td>\\n        Similar, though not necessarily interchangeable, adjectives.\\n        For example, \"shiny\" is <em>similar to</em> \"bright\",\\n        but they have subtle differences.\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">substance holonym</td>\\n      <td>\\n        A word that denotes a larger whole containing some constituent\\n        substance, e.g., \"bread\" is a <em>substance holonym</em> of \"flour.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">substance meronym</td>\\n      <td>\\n        A word that denotes a constituant substance of some larger whole,\\n        e.g., \"flour\" is a <em>substance meronym</em> of \"bread.\"\\n      </td>\\n    </tr>\\n    <tr>\\n      <td nowrap=\"nowrap\">verb group</td>\\n      <td>\\n        A verb that is a member of a group of similar verbs,\\n        e.g., \"live\" is in the <em>verb group</em>\\n        of \"dwell\", \"live\", \"inhabit\", etc.\\n      </td>\\n    </tr>\\n  </table>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Notes on tokenization</h2>\\n For general information about the implementation of tokenization,\\n including what constitutes a token,\\n see the <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"../zorba/ft_tokenizer.html\">Full Text Tokenizer</a> documentation.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Paul J. Lucas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/full-text\",prefix:\"ft\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"},{uri:\"http://zorba.io/errors\",prefix:\"zerr\"}],functions:[{isDocumented:!0,arity:0,name:\"current-compare-options\",qname:\"ft:current-compare-options\",signature:\"() as object() external\",description:\" Gets the current compare options.\\n\",summary:\"<p> Gets the current compare options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"said compare options.\"},errors:[]},{isDocumented:!0,arity:0,name:\"current-lang\",qname:\"ft:current-lang\",signature:\"() as xs:language external\",description:' Gets the current\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>:\\n either the language specified by the\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xpath-full-text-10/#doc-xquery10-FTOptionDecl\">declare ft-option using</a>\\n <a href=\"http://www.w3.org/TR/xpath-full-text-10/#ftlanguageoption\">language</a></code>\\n statement (if any)\\n or the one returned by <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ft:host-lang()</code> (if none).\\n',summary:\"<p> Gets the current\\n  language :\\n either the language specified by the\\n  declare ft-option using \\n  language \\n statement (if any)\\n or the one returned by  ft:host-lang()  (if none).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:language\",description:\"said language.\"},errors:[]},{isDocumented:!0,arity:0,name:\"host-lang\",qname:\"ft:host-lang\",signature:\"() as xs:language external\",description:' Gets the host\\'s current\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>.\\n The \"host\" is the computer on which the software is running.\\n The host\\'s current language is obtained as follows:\\n  <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n    <li>\\n      For *nix systems:\\n      <ol>\\n        <li>\\n          If <a ref=\"http://www.cplusplus.com/reference/clibrary/clocale/setlocale/\"><code>setlocale</code>(3)</a> returns non-null,\\n          the language corresponding to that locale is used.\\n        </li>\\n        <li>\\n          Else, if the <code>LANG</code> environment variable is set,\\n          that language is ued.\\n        </li>\\n        <li>\\n          Otherwise, there is no default language.\\n        </li>\\n      </ol>\\n    </li>\\n    <li>\\n      For Windows systems,\\n      the language corresponding to the locale returned by the\\n      <a href=\"http://msdn.microsoft.com/en-us/library/windows/desktop/dd318101(v=vs.85).aspx\"><code>GetLocaleInfo()</code></a>\\n      function is used.\\n    </li>\\n  </ul>\\n',summary:\"<p> Gets the host's current\\n  language .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"xs:language\",description:\"said language.\"},errors:[]},{isDocumented:!0,arity:1,name:\"is-stem-lang-supported\",qname:\"ft:is-stem-lang-supported\",signature:\"($lang as xs:language) as xs:boolean external\",description:' Checks whether the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n is supported for stemming.\\n',summary:\"<p> Checks whether the given\\n  language \\n is supported for stemming.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-stop-word-lang-supported\",qname:\"ft:is-stop-word-lang-supported\",signature:\"($lang as xs:language) as xs:boolean external\",description:' Checks whether the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n is supported for stop words.\\n',summary:\"<p> Checks whether the given\\n  language \\n is supported for stop words.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"is-stop-word\",qname:\"ft:is-stop-word\",signature:\"($word as xs:string) as xs:boolean external\",description:\" Checks whether the given word is a stop-word.\\n\",summary:\"<p> Checks whether the given word is a stop-word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to check. The word\\'s <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code> is a stop-word.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"is-stop-word\",qname:\"ft:is-stop-word\",signature:\"($word as xs:string, $lang as xs:language) as xs:boolean external\",description:\" Checks whether the given word is a stop-word.\\n\",summary:\"<p> Checks whether the given word is a stop-word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to check.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$word</code>.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code> is a stop-word.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-thesaurus-lang-supported\",qname:\"ft:is-thesaurus-lang-supported\",signature:\"($lang as xs:language) as xs:boolean external\",description:' Checks whether the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n is supported for look-up using the default thesaurus.\\n',summary:\"<p> Checks whether the given\\n  language \\n is supported for look-up using the default thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:2,name:\"is-thesaurus-lang-supported\",qname:\"ft:is-thesaurus-lang-supported\",signature:\"($uri as xs:string, $lang as xs:language) as xs:boolean external\",description:' Checks whether the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n is supported for look-up using the thesaurus specified by the given URI.\\n',summary:\"<p> Checks whether the given\\n  language \\n is supported for look-up using the thesaurus specified by the given URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URI specifying the thesaurus to use.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-tokenizer-lang-supported\",qname:\"ft:is-tokenizer-lang-supported\",signature:\"($lang as xs:language) as xs:boolean external\",description:' Checks whether the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n is supported for tokenization.\\n',summary:\"<p> Checks whether the given\\n  language \\n is supported for tokenization.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language to check.</div>'}],returns:{type:\"xs:boolean\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">true</code> only if the language is supported.'},errors:[]},{isDocumented:!0,arity:1,name:\"stem\",qname:\"ft:stem\",signature:\"($word as xs:string) as xs:string external\",description:\" Stems the given word.\\n\",summary:\"<p> Stems the given word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to stem. The word\\'s <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"xs:string\",description:'the stem of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"stem\",qname:\"ft:stem\",signature:\"($word as xs:string, $lang as xs:language) as xs:string external\",description:\" Stems the given word.\\n\",summary:\"<p> Stems the given word.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"word\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The word to stem.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$word</code>.</div>'}],returns:{type:\"xs:string\",description:'the stem of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$word</code>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"strip-diacritics\",qname:\"ft:strip-diacritics\",signature:\"($string as xs:string) as xs:string external\",description:\" Strips all diacritical marks from all characters.\\n\",summary:\"<p> Strips all diacritical marks from all characters.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to strip diacritical marks from.</div>'}],returns:{type:\"xs:string\",description:'<code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$string</code> with diacritical marks stripped.'},errors:[]},{isDocumented:!0,arity:1,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($phrase as xs:string) as xs:string* external\",description:\" Looks-up the given phrase in the default thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in the default thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"phrase\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up. The phrase\\'s <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"xs:string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of the software.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which the software is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($uri as xs:string, $phrase as xs:string) as xs:string* external\",description:\" Looks-up the given phrase in a thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in a thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URI specifying the thesaurus to use.</div>'},{name:\"phrase\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up. The phrase\\'s <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"xs:string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is unsupported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of the software.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which the software is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($uri as xs:string, $phrase as xs:string, $lang as xs:language) as xs:string* external\",description:\" Looks-up the given phrase in the thesaurus specified by the given URI.\\n\",summary:\"<p> Looks-up the given phrase in the thesaurus specified by the given URI.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URI specifying the thesaurus to use.</div>'},{name:\"phrase\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$phrase</code>.</div>'}],returns:{type:\"xs:string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of the software.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which the software is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($uri as xs:string, $phrase as xs:string, $lang as xs:language, $relationship as xs:string) as xs:string* external\",description:\" Looks-up the given phrase in a thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in a thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URI specifying the thesaurus to use.</div>'},{name:\"phrase\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$phrase</code>.</div>'},{name:\"relationship\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The relationship the results are to have to <code>$phrase</code>.</div>'}],returns:{type:\"xs:string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of the software.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which the software is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:6,name:\"thesaurus-lookup\",qname:\"ft:thesaurus-lookup\",signature:\"($uri as xs:string, $phrase as xs:string, $lang as xs:language, $relationship as xs:string, $level-least as xs:integer, $level-most as xs:integer) as xs:string* external\",description:\" Looks-up the given phrase in a thesaurus.\\n\",summary:\"<p> Looks-up the given phrase in a thesaurus.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"uri\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URI specifying the thesaurus to use.</div>'},{name:\"phrase\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The phrase to look up.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$phrase</code>.</div>'},{name:\"relationship\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The relationship the results are to have to <code>$phrase</code>.</div>'},{name:\"level-least\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The minimum number of levels within the thesaurus to be traversed.</div>'},{name:\"level-most\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The maximum number of levels within the thesaurus to be traversed.</div>'}],returns:{type:\"xs:string*\",description:'the related phrases if <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$phrase</code> is found in the thesaurus or the empty sequence if not.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCA0003 if either <code>$level-least</code> or <code>$level-most</code> is either negative or too large.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0018 if <code>$uri</code> refers to a thesaurus that is not found in the statically known thesauri.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0001 if the thesaurus data file could not be found.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZOSE0002 if the thesaurus data file is not a plain file.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8401 if the thesaurus data file\\'s version is not supported by the currently running version of the software.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8402 if the thesaurus data file\\'s endianness does not match that of the CPU on which the software is currently running.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">zerr:ZXQP8403 if there was an error reading the thesaurus data file.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tokenize-node\",qname:\"ft:tokenize-node\",signature:\"($node as node()) as object()* external\",description:\" Tokenizes the given node and all of its descendants.\\n\",summary:\"<p> Tokenizes the given node and all of its descendants.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The node to tokenize. The node\\'s default <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"object()*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"tokenize-node\",qname:\"ft:tokenize-node\",signature:\"($node as node(), $lang as xs:language) as object()* external\",description:\" Tokenizes the given node and all of its decendants.\\n\",summary:\"<p> Tokenizes the given node and all of its decendants.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The node to tokenize.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The default <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$node</code>.</div>'}],returns:{type:\"object()*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"tokenize-nodes\",qname:\"ft:tokenize-nodes\",signature:\"($includes as node()+, $excludes as node()*) as object()* external\",description:' Tokenizes the set of nodes comprising <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$includes</code> (and all of its\\n descendants) but excluding <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$excludes</code> (and all of its\\n descendants), if any.\\n',summary:\"<p> Tokenizes the set of nodes comprising  $includes  (and all of its\\n descendants) but excluding  $excludes  (and all of its\\n descendants), if any.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"includes\",type:\"node()\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The set of nodes (and its descendants) to include. The default <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'},{name:\"excludes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The set of nodes (and its descendants) to exclude.</div>'}],returns:{type:\"object()*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"tokenize-nodes\",qname:\"ft:tokenize-nodes\",signature:\"($includes as node()+, $excludes as node()*, $lang as xs:language) as object()* external\",description:' Tokenizes the set of nodes comprising <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$includes</code> (and all of its\\n descendants) but excluding <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$excludes</code> (and all of its\\n descendants), if any.\\n',summary:\"<p> Tokenizes the set of nodes comprising  $includes  (and all of its\\n descendants) but excluding  $excludes  (and all of its\\n descendants), if any.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"includes\",type:\"node()\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The set of nodes (and its descendants) to include.</div>'},{name:\"excludes\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The set of nodes (and its descendants) to exclude.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The default <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> for nodes.</div>'}],returns:{type:\"object()*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tokenize-string\",qname:\"ft:tokenize-string\",signature:\"($string as xs:string) as xs:string* external\",description:\" Tokenizes the given string.\\n\",summary:\"<p> Tokenizes the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to tokenize. The string\\'s <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> is assumed to be the one returned by <code>ft:current-lang()</code>.</div>'}],returns:{type:\"xs:string*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"tokenize-string\",qname:\"ft:tokenize-string\",signature:\"($string as xs:string, $lang as xs:language) as xs:string* external\",description:\" Tokenizes the given string.\\n\",summary:\"<p> Tokenizes the given string.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"string\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string to tokenize.</div>'},{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The <a href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a> of <code>$string</code>.</div>'}],returns:{type:\"xs:string*\",description:\"a (possibly empty) sequence of tokens.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"tokenizer-properties\",qname:\"ft:tokenizer-properties\",signature:\"() as object() external\",description:' Gets properties of the tokenizer for the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>\\n returned by <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">ft:current-lang()</code>.\\n',summary:\"<p> Gets properties of the tokenizer for the\\n  language \\n returned by  ft:current-lang() .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"said properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>ft:current-lang()</code> is not supported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tokenizer-properties\",qname:\"ft:tokenizer-properties\",signature:\"($lang as xs:language) as object() external\",description:' Gets properties of the tokenizer for the given\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\">language</a>.\\n',summary:\"<p> Gets properties of the tokenizer for the given\\n  language .</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"lang\",type:\"xs:language\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The language of the tokenizer to get the properties of.</div>'}],returns:{type:\"object()\",description:\"said properties.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FTST0009 if <code>$lang</code> is not supported. tokenization specifically.</xqdoc:error>']}],variables:[{name:\"ft:LANG-DA\",type:\"xs:language\",description:' Predeclared constant for the Danish\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-DE\",type:\"xs:language\",description:' Predeclared constant for the German\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-EN\",type:\"xs:language\",description:' Predeclared constant for the English\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-ES\",type:\"xs:language\",description:' Predeclared constant for the Spanish\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-FI\",type:\"xs:language\",description:' Predeclared constant for the Finnish\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-FR\",type:\"xs:language\",description:' Predeclared constant for the French\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-HU\",type:\"xs:language\",description:' Predeclared constant for the Hungarian\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-IT\",type:\"xs:language\",description:' Predeclared constant for the Italian\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-NL\",type:\"xs:language\",description:' Predeclared constant for the Dutch\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-NO\",type:\"xs:language\",description:' Predeclared constant for the Norwegian\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-PT\",type:\"xs:language\",description:' Predeclared constant for the Portuguese\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-RO\",type:\"xs:language\",description:' Predeclared constant for the Romanian\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-RU\",type:\"xs:language\",description:' Predeclared constant for the Russian\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-SV\",type:\"xs:language\",description:' Predeclared constant for the Swedish\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'},{name:\"ft:LANG-TR\",type:\"xs:language\",description:' Predeclared constant for the Turkish\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.w3.org/TR/xmlschema-2/#language\"><code>xs:language</code></a>.\\n'}]},\"http://www.zorba-xquery.com/modules/jdbc\":{ns:\"http://www.zorba-xquery.com/modules/jdbc\",description:' This module contains functions to connect to any JDBC datasource\\n using jvm-util module to handle Java interaction.\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"determinism\">Important Notice Regarding Function Determinism</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The non side-effecting functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-1\">connect#1</a></li>\\n   <li><a href=\"?anchor=connect-2\">connect#2</a></li>\\n   <li><a href=\"?anchor=execute-query-2\">execute-query#2</a></li>\\n   <li><a href=\"?anchor=execute-query-prepared-1\">execute-query-prepared#1</a></li>\\n   <li><a href=\"?anchor=tables-1\">tables#1</a></li>\\n   <li><a href=\"?anchor=tables-4\">tables#4</a></li>\\n </ul>\\n are declared deterministic, which means that their results could be cached\\n when invoked multiple times with the same arguments in the same query execution.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">To not use cached results you can use the following alternative functions:\\n <ul>\\n   <li><a href=\"?anchor=connect-notdeterministic-0\">connect-notdeterministic#0</a></li>\\n   <li><a href=\"?anchor=connect-notdeterministic-1\">connect-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=connect-notdeterministic-2\">connect-notdeterministic#2</a></li>\\n   <li><a href=\"?anchor=execute-query-notdeterministic-2\">execute-query-notdeterministic#2</a></li>\\n   <li><a href=\"?anchor=execute-query-prepared-notdeterministic-1\">execute-query-prepared-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=tables-notdeterministic-1\">tables-notdeterministic#1</a></li>\\n   <li><a href=\"?anchor=tables-notdeterministic-4\">tables-notdeterministic#4</a></li>\\n </ul>\\n which have been declared as being non deterministic.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Rodolfo Ochoa</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/jdbc\",prefix:\"jdbc\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"affected-rows\",qname:\"jdbc:affected-rows\",signature:\"($dataset-id as xs:anyURI) as xs:integer external\",description:\" Return the number of affected rows of a particular DataSet.\\n\",summary:\"<p> Return the number of affected rows of a particular DataSet.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a DataSet.</div>'}],returns:{type:\"xs:integer\",description:\"Returns an xs:integer with the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"clear-params\",qname:\"jdbc:clear-params\",signature:\"($prepared-statement as xs:anyURI) as empty-sequence() external\",description:\" Clears the current parameter values immediately.\\n\",summary:\"<p> Clears the current parameter values immediately.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"close-dataset\",qname:\"jdbc:close-dataset\",signature:\"($dataset-id as xs:anyURI) as empty-sequence() external\",description:\" Closes and free resources from a particular DataSet.\\n\",summary:\"<p> Closes and free resources from a particular DataSet.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"dataset-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a DataSet.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"close-prepared\",qname:\"jdbc:close-prepared\",signature:\"($prepared-statement as xs:anyURI) as empty-sequence() external\",description:\" Closes and frees from memory any prepared SQL statement created with jdbc:prepare-statement\\n\",summary:\"<p> Closes and frees from memory any prepared SQL statement created with jdbc:prepare-statement\\n</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"commit\",qname:\"jdbc:commit\",signature:\"($connection-id as xs:anyURI) as empty-sequence() external\",description:\" Commit current transaction from an active connection.\\n\",summary:\"<p> Commit current transaction from an active connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to the connection to be commited.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect-nondeterministic\",qname:\"jdbc:connect-nondeterministic\",signature:\"($connection-config as object()) as xs:anyURI external\",description:' Opens a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-1\">connect#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Opens a connection to a database.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that has the host and user informations.</div>'}],returns:{type:\"xs:anyURI\",description:\"Return an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect-nondeterministic\",qname:\"jdbc:connect-nondeterministic\",signature:\"($connection-config as object(), $options as object()?) as xs:anyURI external\",description:' Opens a connection to a database with specified options.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#connect-2\">connect#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Opens a connection to a database with specified options.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-config\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that has the host and user informations.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that specifies the connection options.</div>'}],returns:{type:\"xs:anyURI\",description:\"Return an identifier that represents the connection to the server.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connect\",qname:\"jdbc:connect\",signature:\"($connection-config as object()) as xs:anyURI external\",description:' Opens a connection to a database.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a URI identifying the connection that has been opened. The\\n implementing code determines from the $connection-config either explicitly\\n (interpreting the driver attribute) or implicitly (using the type attribute)\\n which driver it has to load.</p>\\n',summary:\"<p> Opens a connection to a database.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-config\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that has the host and user informations.</div>'}],returns:{type:\"xs:anyURI\",description:'Return an identifier that represents the connection to the server. Connection coonfiguration example: { \"url\" : \"jdbc:mysql://localhost/\", \"user\" : \"root\", \"password\" : \"\" }'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"connect\",qname:\"jdbc:connect\",signature:\"($connection-config as object(), $options as object()?) as xs:anyURI external\",description:' Opens a connection to a database with specified options.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns a URI identifying the connection that has been opened. The\\n implementing code determines from the $connection-config either explicitly\\n (interpreting the driver attribute) or implicitly (using the type attribute)\\n which driver it has to load.</p>\\n',summary:\"<p> Opens a connection to a database with specified options.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-config\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that has the host and user informations.</div>'},{name:\"options\",type:\"object()\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> json object that specifies the connection options.</div>'}],returns:{type:\"xs:anyURI\",description:'Return an identifier that represents the connection to the server. Connection options example: { \"autocommit\" : false, \"readonly\"? : true, \"isolation-level\"? : $jdbc:READ-COMMITTED }'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL28000 Authentication failed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08001 Connection error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL40003 Isolation level not supported.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"connection-options\",qname:\"jdbc:connection-options\",signature:\"($connection-id as xs:anyURI) as object() external\",description:\" Returns a set with options for a specified connection.\\n\",summary:\"<p> Returns a set with options for a specified connection.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to the connection to be verify.</div>'}],returns:{type:\"object()\",description:'Returns and object with the connection options. The returned options are equal to the options specified in function jdbc:connect. Consequently, the options are specified as follows: { \"autocommit\" : xs:boolean, \"readonly\" : xs:boolean, \"isolation-level\" : xs:string }'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-prepared\",qname:\"jdbc:execute-prepared\",signature:\"($prepared-statement as xs:anyURI) as xs:anyURI external\",description:\" Executes SQL statements prepared with 5.1 jsql:prepare-statement with values set\\n and returns an identifier to a Dataset.\\n\",summary:\"<p> Executes SQL statements prepared with 5.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"xs:anyURI\",description:\"Return an identifier that represents a DataSet.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-query-nondeterministic\",qname:\"jdbc:execute-query-nondeterministic\",signature:\"($connection-id as xs:anyURI, $sql as xs:string) as object()* external\",description:' Executes non-updating SQL statements.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#execute-query-2\">execute-query#2</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Executes non-updating SQL statements.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to an active connection.</div>'},{name:\"sql\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Updating type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-query-prepared-nondeterministic\",qname:\"jdbc:execute-query-prepared-nondeterministic\",signature:\"($prepared-statement as xs:anyURI) as object()* external\",description:' Executes a non-updating SQL statement prepared with 5.1 jsql:prepare-statement.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as\\n <a href=\"#execute-query-prepared-1\">execute-query-prepared#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Executes a non-updating SQL statement prepared with 5.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query processed with the parameter values provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The prepared statement is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-query-prepared\",qname:\"jdbc:execute-query-prepared\",signature:\"($prepared-statement as xs:anyURI) as object()* external\",description:' Executes a non-updating SQL statement prepared with 5.1 jsql:prepare-statement.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Executes a non-updating SQL statement prepared with 5.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query processed with the parameter values provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The prepared statement is an updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-query\",qname:\"jdbc:execute-query\",signature:\"($connection-id as xs:anyURI, $sql as xs:string) as object()* external\",description:' Executes non-updating SQL statements.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Executes non-updating SQL statements.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to an active connection.</div>'},{name:\"sql\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Updating type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"execute-update-prepared\",qname:\"jdbc:execute-update-prepared\",signature:\"($prepared-statement as xs:anyURI) as xs:integer external\",description:\" Executes an updating SQL statement prepared with 5.1 jsql:prepare-statement.\\n\",summary:\"<p> Executes an updating SQL statement prepared with 5.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"xs:integer\",description:\"Returns an xs:integer with the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL006 The prepared statement is a non-updating query.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute-update\",qname:\"jdbc:execute-update\",signature:\"($connection-id as xs:anyURI, $sql as xs:string) as xs:integer external\",description:\" Executes updating SQL statements.\\n\",summary:\"<p> Executes updating SQL statements.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to an active connection.</div>'},{name:\"sql\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"xs:integer\",description:\"Returns an xs:integer with the number of affected rows.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL005 The statement is Read-only type.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"execute\",qname:\"jdbc:execute\",signature:\"($connection-id as xs:anyURI, $sql as xs:string) as xs:anyURI external\",description:\" Executes any kind of SQL statement.\\n\",summary:\"<p> Executes any kind of SQL statement.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to an active connection.</div>'},{name:\"sql\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"xs:anyURI\",description:\"Return an identifier that represents a DataSet.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"is-connected\",qname:\"jdbc:is-connected\",signature:\"($connection-id as xs:anyURI) as xs:boolean external\",description:\" Verify if a connection is still active.\\n\",summary:\"<p> Verify if a connection is still active.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to the connection to be verify.</div>'}],returns:{type:\"xs:boolean\",description:\"Returns true if connected.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"metadata\",qname:\"jdbc:metadata\",signature:\"($dataset-id as xs:anyURI) as object() external\",description:\" Return the metadata of the result of a particular DataSet.\\n\",summary:\"<p> Return the metadata of the result of a particular DataSet.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a DataSet.</div>'}],returns:{type:\"object()\",description:'This function returns the metadata associated with an executed DataSet. More in detail, it returns information about column names, types, and whether a column can contain a null value. The metadata information can only be returned for DataSets that have been executed explicitly using the jsql:execute function. The metadata node returned by this function is defined as follows: { \"columns\": [ { \"name\": xs:string, \"type\": xs:string, \"autoincrement\"? = xs:boolean, \"nillable\"? = xs:boolean } * ] }'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"parameter-metadata\",qname:\"jdbc:parameter-metadata\",signature:\"($prepared-statement as xs:anyURI) as object() external\",description:\" Retrieves the number, types and properties of the prepared statement parameters.\\n\",summary:\"<p> Retrieves the number, types and properties of the prepared statement parameters.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'}],returns:{type:\"object()\",description:'This function returns the parameters metadata associated with a prepared statement. In other words, it returns information about the column name associated with the parameter, the type, etc. The metadata node returned by this function is defined as follows: { columns: [{ \"name\": xs:string, \"type\": xs:string }] }'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"prepare-statement\",qname:\"jdbc:prepare-statement\",signature:\"($connection-id as xs:anyURI, $sql as xs:string) as xs:anyURI external\",description:\"  Creates a prepared statement for multiple executions with diferent values.\\n\",summary:\"<p>  Creates a prepared statement for multiple executions with diferent values.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to an active connection.</div>'},{name:\"sql\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The query string to be executed.</div>'}],returns:{type:\"xs:anyURI\",description:'Return an identifier that represents the prepared statement. Example: jsql:prepare-statement($connection, \"SELECT * FROM users WHERE id=? AND age&gt;?\")'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"result-set\",qname:\"jdbc:result-set\",signature:\"($dataset-id as xs:anyURI) as object()* external\",description:\" This function returns a sequence of objects representing the rows of data from a non-updating query.\\n\",summary:\"<p> This function returns a sequence of objects representing the rows of data from a non-updating query.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"dataset-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a DataSet.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the DataSet provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL008 DataSet doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"rollback\",qname:\"jdbc:rollback\",signature:\"($connection-id as xs:anyURI) as empty-sequence() external\",description:\" Rollback the current transaction of a connection.\\n\",summary:\"<p> Rollback the current transaction of a connection.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to the connection to be rollbacked.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08003 Connection doesn\\'t exist</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-boolean\",qname:\"jdbc:set-boolean\",signature:\"($prepared-statement as xs:anyURI, $parameter-index as xs:integer, $value as xs:boolean) as empty-sequence() external\",description:\" Set the value of the designated parameter with the given value, this function will assign only boolean values.\\n\",summary:\"<p> Set the value of the designated parameter with the given value, this function will assign only boolean values.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'},{name:\"parameter-index\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"set-null\",qname:\"jdbc:set-null\",signature:\"($prepared-statement as xs:anyURI, $parameter-index as xs:integer) as empty-sequence() external\",description:\" Set the value of the designated parameter with the given value, this function\\n will assign only null values if possible.\\n\",summary:\"<p> Set the value of the designated parameter with the given value, this function\\n will assign only null values if possible.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'},{name:\"parameter-index\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-numeric\",qname:\"jdbc:set-numeric\",signature:\"($prepared-statement as xs:anyURI, $parameter-index as xs:decimal, $value as xs:anyAtomicType) as empty-sequence() external\",description:\" Set the value of the designated parameter with the given value, this function will assign only numeric values.\\n\",summary:\"<p> Set the value of the designated parameter with the given value, this function will assign only numeric values.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'},{name:\"parameter-index\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-string\",qname:\"jdbc:set-string\",signature:\"($prepared-statement as xs:anyURI, $parameter-index as xs:integer, $value as xs:string) as empty-sequence() external\",description:\" Set the value of the designated parameter with the given value, this function will assign only string values.\\n\",summary:\"<p> Set the value of the designated parameter with the given value, this function will assign only string values.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'},{name:\"parameter-index\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"set-value\",qname:\"jdbc:set-value\",signature:\"($prepared-statement as xs:anyURI, $parameter-index as xs:decimal, $value as xs:anyAtomicType) as empty-sequence() external\",description:\" Set the value of the designated parameter with the given value,\\n this function will assign any value you send\\n and it will try to cast to the correct type.\\n\",summary:\"<p> Set the value of the designated parameter with the given value,\\n this function will assign any value you send\\n and it will try to cast to the correct type.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"prepared-statement\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a prepared statement.</div>'},{name:\"parameter-index\",type:\"xs:decimal\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The index from the parameter to be set.</div>'},{name:\"value\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The value to be set.</div>'}],returns:{type:\"empty-sequence()\",description:\"This function returns an empty-sequence()\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL003 Prepared statement doesn\\'t exist.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL007 Parameter casting error.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tables-nondeterministic\",qname:\"jdbc:tables-nondeterministic\",signature:\"($connection-id as xs:anyURI) as object()*\",description:' Return the list of tables from a connection\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#tables-1\">tables#1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Return the list of tables from a connection\\n  This function has the same semantics as  tables#1 ,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"tables-nondeterministic\",qname:\"jdbc:tables-nondeterministic\",signature:\"($connection-id as xs:anyURI, $catalog as xs:string?, $schema as xs:string?, $table as xs:string?) as object()* external\",description:' Return the list of tables from a connection.\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function has the same semantics as <a href=\"#tables-4\">tables#4</a>,\\n but is declared as being non deterministic and thus should only be used when\\n result caching is not desired.</p>\\n',summary:\"<p> Return the list of tables from a connection.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'},{name:\"catalog\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the catalog name of the tables. Send empty-sequence for all tables.</div>'},{name:\"schema\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the schema name of the tables. Send empty-sequence for all tables.</div>'},{name:\"table\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the name of the tables. Send empty-sequence for all tables.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"tables\",qname:\"jdbc:tables\",signature:\"($connection-id as xs:anyURI) as object()*\",description:' Return the list of tables from a connection\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Return the list of tables from a connection\\n  This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']},{isDocumented:!0,arity:4,name:\"tables\",qname:\"jdbc:tables\",signature:\"($connection-id as xs:anyURI, $catalog as xs:string?, $schema as xs:string?, $table as xs:string?) as object()* external\",description:' Return the list of tables from a connection\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\\n',summary:\"<p> Return the list of tables from a connection\\n  This function is declared as deterministic and should be used whenever result\\n caching is acceptable.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"connection-id\",type:\"xs:anyURI\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The identifier to a connection.</div>'},{name:\"catalog\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the catalog name of the tables. Send empty-sequence for all tables.</div>'},{name:\"schema\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the schema name of the tables. Send empty-sequence for all tables.</div>'},{name:\"table\",type:\"xs:string\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A filter of the name of the tables. Send empty-sequence for all tables.</div>'}],returns:{type:\"object()*\",description:\"Return an object with the result data rows from the query provided, the data rows are defined as follows: { column:value* }* Every row is represented by an object of column-value representation of the returned SQL result.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL08000 Connection is closed.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">SQL001 Descriptive error, see error in attached message.</xqdoc:error>']}],variables:[{name:\"jdbc:NOT-SUPPORTED\",type:\"item()*\",description:\" This variable represents the NOT-SUPPORTED level for Isolation Levels in $options for 2.2 connect function.\\n\"},{name:\"jdbc:READ-COMMITTED\",type:\"item()*\",description:\" This variable represents the READ-COMMITTED level for Isolation Levels in $options for 2.2 connect function.\\n\"},{name:\"jdbc:READ-UNCOMMITTED\",type:\"item()*\",description:\" This variable represents the READ-UNCOMMITTED level for Isolation Levels in $options for 2.2 connect function.\\n\"},{name:\"jdbc:REPEATABLE-READ\",type:\"item()*\",description:\" This variable represents the REPEATABLE-READ level for Isolation Levels in $options for 2.2 connect function.\\n\"},{name:\"jdbc:SERIALIZABLE\",type:\"item()*\",description:\" This variable represents the SERIALIZABLE level for Isolation Levels in $options for 2.2 connect function.\\n\"}]},\"http://www.28msec.com/modules/http-response\":{ns:\"http://www.28msec.com/modules/http-response\",description:' The response module can be used to modify the HTTP response\\n that will be send as a result. For example, the\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">content-type</tt> function can be used to set the\\n Content-Type header and determine the encoding of data in the\\n response.\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/http-response\",prefix:\"http\"},{uri:\"http://www.w3.org/2010/xslt-xquery-serialization\",prefix:\"output\"},{uri:\"http://www.28msec.com/modules/http/response#2.0\",prefix:\"res\"},{uri:\"http://www.28msec.com/modules/http-response\",prefix:\"resp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"code-for-status\",qname:\"resp:code-for-status\",signature:\"($status as xs:string) as xs:integer\",description:\" Convert between the name of the HTTP status code and\\n the integer value of that status code.\\n\",summary:\"<p> Convert between the name of the HTTP status code and\\n the integer value of that status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:integer\",description:\"the integer value of the given status code.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given name does not represent a valid http status code</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"content-type-binary\",qname:\"resp:content-type-binary\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a binary content-type. A\\n content-type is considered to be binary if it\\'s not a text\\n content-type.</p>\\n',summary:\"<p>  Test if a given content-type is a binary content-type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a binary content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-html\",qname:\"resp:content-type-html\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a HTML content-type, i.e.\\n the content-type is the string \"text/html\".</p>\\n',summary:\"<p>  Test if a given content-type is a HTML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the HTML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-json\",qname:\"resp:content-type-json\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a JSON content-type, i.e.\\n the content-type is the string \"application/json\".</p>\\n',summary:\"<p>  Test if a given content-type is a JSON content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the JSON content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-mixed-json-xml\",qname:\"resp:content-type-mixed-json-xml\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a mixed JSON-XML content-type, i.e.\\n the content-type is the string \"application/mixed-json-xml\".</p>\\n',summary:\"<p>  Test if a given content-type is a mixed JSON-XML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a mixed JSON-XML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-text\",qname:\"resp:content-type-text\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a text content-type.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A text content-type starts with \"text/\" or contains either of\\n the strings \"xml\" or \"json\".</p>\\n',summary:\"<p>  Test if a given content-type is a text content-type.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a text content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-xhtml\",qname:\"resp:content-type-xhtml\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a XHTML content-type, i.e.\\n the content-type is the string \"application/xhtml+xml\".</p>\\n',summary:\"<p>  Test if a given content-type is a XHTML content-type, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is the XHTML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type-xml\",qname:\"resp:content-type-xml\",signature:\"($type as xs:string) as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Test if a given content-type is a XML content-type</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A XML content-type is a content-type that is \"application/xml\"\\n or ends : with the string \"+xml\".</p>\\n',summary:'<p>  Test if a given content-type is a XML content-type \\n  A XML content-type is a content-type that is \"application/xml\"\\n or ends : with the string \"+xml\".</p>',annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to test.</div>'}],returns:{type:\"xs:boolean\",description:\"true if the given content-type is a XML content-type, false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"content-type\",qname:\"resp:content-type\",signature:\"($type as xs:string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the Content-Type header for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n For example,\\n <tt>resp:content-type(\"text/plain\")</tt> will cause the\\n header\\n <tt>Content-Type: text/plain</tt> to be added for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addtion to setting the Content-Type header, the function also\\n sets the serialization parameters to the default values for serialization\\n method for the given content-type. For example, if the content-type is set to\\n text/plain, the default serialization parameters for the text\\n serialization method will be used.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The functions resp:content-type-text/xml/html/xhtml/binary may be used\\n to figure out which serialization method will be used for a specific\\n content-type.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the given content-type contains a charset declaration (e.g.\\n <tt>resp:content-type(\"text/plain;charset=ISO-8859-1\")</tt>), the\\n content of the response will be transcoded to the given encoding.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The default serialization parameters set by this function can\\n be overwritten using the resp:serialization-parameters() function.</p>\\n',summary:\"<p>  Sets the Content-Type header for the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to be set</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"content-type\",qname:\"resp:content-type\",signature:\"($type as xs:string, $params as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the Content-Type header for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <tt>resp:content-type(\"text/plain\")</tt> will cause the\\n header\\n <tt>Content-Type: text/plain</tt> to be added for the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">In addition to the content-type, the function also allows to\\n specify the serialization method and parameters that will be used\\n for serializing the result. For details about this parameter, please\\n refer to resp:serialization-parameters#1.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the content-type suggest using a binary serialization,\\n resp:decode-binary#1 will be called and set to true except if\\n the serialization method is specified at the same time. In this\\n case, the serialization method will be used as specified.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If the given content-type contains a charset declaration (e.g.\\n <tt>resp:content-type(\"text/plain;charset=ISO-8859-1\")</tt>), the\\n content of the response will be transcoded to the given encoding.\\n If the serialization parameters also contain a charset declaration,\\n the charset contained in the content-type will be used. to transcode\\n the result.</p>\\n',summary:\"<p>  Sets the Content-Type header for the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"type\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content-type to be set</div>'},{name:\"params\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the serialization parameters that will be used for serialization the result.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"decode-binary\",qname:\"resp:decode-binary\",signature:\"() as xs:boolean\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the boolean indiciating whether base64Binary returned by\\n this request will be decoded.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The default if not modified using resp:decode-binary is false.</p>\\n',summary:\"<p>  Returns the boolean indiciating whether base64Binary returned by\\n this request will be decoded.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:boolean\",description:\"the said boolean value\"},errors:[]},{isDocumented:!0,arity:1,name:\"decode-binary\",qname:\"resp:decode-binary\",signature:\"($decode as xs:boolean) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If this function is invoked with true, the result of the request\\n will not be serialized. Instead, the result will be the binary values\\n of any item that is of type base64Binary. The values of all other\\n items will not be part of the result.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that all serialization parameters which have been set using\\n resp:serialization-parameters will be ignored. Also, the output encoding\\n is ignored for binaries.</p>\\n',summary:\"<p>  If this function is invoked with true, the result of the request\\n will not be serialized.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"decode\",type:\"xs:boolean\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> boolean value indicating whether base64Binary should be decoded.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"encoding\",qname:\"resp:encoding\",signature:\"($encoding as xs:string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function sets the output encoding that will be\\n used for the payload of the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <tt>resp:encoding(\"ISO-8859-1\")</tt> will cause the\\n content in the response to be encoded using ISO-8859-1.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that the encoding only applies to textual data.\\n It is not used if the function <tt>decode-binary()</tt>\\n was invoked passing true as parameter.</p>\\n',summary:\"<p>  The function sets the output encoding that will be\\n used for the payload of the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the encoding to be used for the payload of the response.</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and returns the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the given encoding is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"header\",qname:\"resp:header\",signature:\"($name as xs:string, $value as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set a HTTP header in the response.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If a header with the same name was already set, the\\n value is overwritten and the function returns the old value. As defined\\n in the HTTP specification, multiple headers with the same name\\n can be combined into one header whose value is a comma-separated\\n list of the values.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following headers must not be set using this function.\\n Instead, other functions of this module should be used in order\\n to implemented the required semantics:\\n <ul>\\n   <li>Status: use status() instead</li>\\n   <li>Content-Type: use content-type() instead</li>\\n </ul>\\n </p>\\n',summary:\"<p>  Set a HTTP header in the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"name\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the name of the header to set</div>'},{name:\"value\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the value of the header to set `</div>'}],returns:{type:\"xs:string?\",description:\"the value of the header previously set or the empty sequence if no header has been set with the same name.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">resp:invalid-header-name if an invalid name is used for the header.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"message-for-status\",qname:\"resp:message-for-status\",signature:\"($status as xs:string) as xs:string\",description:\" Convert between the HTTP status code as string and\\n the name/message of that status code.\\n\",summary:\"<p> Convert between the HTTP status code as string and\\n the name/message of that status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"the message for the given name\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given name does not represent a valid http status code</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"redirect\",qname:\"resp:redirect\",signature:\"($url as xs:string) as empty-sequence()\",description:\" This function sets the HTTP 302 redirect status code in the response. As\\n a result, a redirect to the URL given as parameter will be made.\\n\",summary:\"<p> This function sets the HTTP 302 redirect status code in the response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"url\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the redirect will be made.</div>'}],returns:{type:\"empty-sequence()\",description:\"The empty-sequence is returned.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serialization-parameters\",qname:\"resp:serialization-parameters\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the serialization parameters that are currently\\n active, i.e. the ones that will be used to serialize the result\\n of this request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This will either be the default, the defaults set when\\n calling resp:content-type(), or the ones set by\\n resp:serialization-parameters().</p>\\n',summary:\"<p>  Returns the serialization parameters that are currently\\n active, i.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"the said serialization parameters\"},errors:[]},{isDocumented:!0,arity:1,name:\"serialization-parameters\",qname:\"resp:serialization-parameters\",signature:\"($params as object()) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Set the serialization parameters used for serializing the result\\n of the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The following example shows how to set several options\\n for the JSON serialization method.\\n <pre>\\n {\\n   \"method\" : \"json\",\\n   \"indent\" : false,\\n   \"encoding\" : \"UTF-16\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Please note that serialization options set by this function can\\n be overwritten by a subsequent call to resp:content-type. In this\\n case, the options will be reset to the default for the given\\n content-type. Also note, that the output encoding can be overwritten\\n by subsequently calling the resp:encoding function.</p>\\n',summary:\"<p>  Set the serialization parameters used for serializing the result\\n of the request.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"params\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the serialization parameters that will be used to serialize the result of the request</div>'}],returns:{type:\"empty-sequence()\",description:\"the function is sequential and, on success, returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 if the input is not valid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-encoding if the encoding specified in the serialization options is invalid or not supported.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"serializer-defaults-html\",qname:\"resp:serializer-defaults-html\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the HTML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <pre>\\n {\\n   \"encoding\" : \"UTF-8\",\\n   \"indent\" : true,\\n   \"method\" : \"html\",\\n   \"version\" : \"4.01\",\\n   \"doctype-system\" : \"http://www.w3.org/TR/html4/loose.dtd\",\\n   \"doctype-public\" : \"-//W3C//DTD HTML 4.01 Transitional//EN\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some HTML content-type (i.e. text/html).</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the HTML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-json-xml-hybrid\",qname:\"resp:serializer-defaults-json-xml-hybrid\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the json\\n serialization method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <pre>\\n {\\n   \"encoding\" : \"UTF-8\",\\n   \"indent\" : \"yes\",\\n   \"method\" : \"json\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some XML content-type (e.g. application/atom+xml).</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the json\\n serialization method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-json\",qname:\"resp:serializer-defaults-json\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the json-xml hybrid\\n serialization method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <pre>\\n {\\n   \"encoding\" : \"UTF-8\",\\n   \"indent\" : \"yes\",\\n   \"method\" : \"json\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to application/mixed-json-xml.</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the json-xml hybrid\\n serialization method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-text\",qname:\"resp:serializer-defaults-text\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the text serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The only default used is\\n <pre>\\n {\\n  \"method\" : \"text\",\\n  \"encoding\" : \"UTF-8\",\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, this default is used when setting\\n the content-type to some text content-type (e.g. text/plain).</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the text serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-xhtml\",qname:\"resp:serializer-defaults-xhtml\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the XHTML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <pre>\\n {\\n   \"encoding\" : \"UTF-8\",\\n   \"indent\" : true,\\n   \"method\" : \"xhtml\",\\n   \"omit-xml-declaration\" : true,\\n   \"version\" : \"1.0\",\\n   \"doctype-system\" : \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\",\\n   \"doctype-public\" : \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some XHTML content-type (i.e. application/xhtml+xml).</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the XHTML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:0,name:\"serializer-defaults-xml\",qname:\"resp:serializer-defaults-xml\",signature:\"() as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns an object that can be used to specify the\\n settings of serialization parameters for the XML serialization\\n method.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The defaults are\\n <pre>\\n {\\n  \"method\" : \"xml\",\\n  \"encoding\" : \"UTF-8\",\\n  \"indent\" : true,\\n  \"omit-xml-declaration\" : true,\\n  \"version\" : \"1.0\"\\n }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example, those defaults are used when setting\\n the content-type to some XML content-type (e.g. application/atom+xml).</p>\\n',summary:\"<p>  Returns an object that can be used to specify the\\n settings of serialization parameters for the XML serialization\\n method.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()\",description:\"an object that can be used to specify the above serialization parameters.\"},errors:[]},{isDocumented:!0,arity:1,name:\"status-code\",qname:\"resp:status-code\",signature:\"($status as xs:integer) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the status code of the HTTP response to the integer given as\\n parameter.</p>\\n For example,\\n <tt xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">resp:status(204)</tt>\\n will result in \"HTTP/1.1 204 No Content\".\\n',summary:\"<p>  Sets the status code of the HTTP response to the integer given as\\n parameter.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"status\",type:\"xs:integer\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The status code of the HTTP response as integer.</div>'}],returns:{type:\"empty-sequence()\",description:\"On success, the empty-sequence is returned\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status-code if the given integer does not reflect a valid HTTP status code</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"status\",qname:\"resp:status\",signature:\"($status as xs:string) as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sets the status code of the HTTP response to code associated\\n with the given string.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For example,\\n <tt>resp:status($http:no-content)</tt>\\n will result in \"HTTP/1.1 204 No Content\".</p>\\n',summary:\"<p>  Sets the status code of the HTTP response to code associated\\n with the given string.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"status\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The status code of the HTTP response as a string (e.g. $http:no-content)</div>'}],returns:{type:\"empty-sequence()\",description:\"On success, the empty-sequence is returned\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:invalid-status if the given string does not represent a valid HTTP status code;</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"valid-status\",qname:\"resp:valid-status\",signature:\"($status as xs:string) as xs:boolean\",description:\" Test whether the given name refers to a valid HTTP status code.\\n\",summary:\"<p> Test whether the given name refers to a valid HTTP status code.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"status\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:boolean\",description:\"true if the given name refers to a valid HTTP status code, false otherwise.\"},errors:[]}],variables:[{name:\"http:precondition-required\",type:\"item()*\",description:\" A string representing the HTTP Status Code 428 Precondition Required (RFC 6585)\\n\"},{name:\"http:gone\",type:\"item()*\",description:\" A string representing the HTTP Status Code 410 GONE\\n\"},{name:\"http:length-required\",type:\"item()*\",description:\" A string representing the HTTP Status Code 411 Length Required\\n\"},{name:\"http:precondition-failed\",type:\"item()*\",description:\" A string representing the HTTP Status Code 412 Precondition Failed\\n\"},{name:\"http:request-entity-too-large\",type:\"item()*\",description:\" A string representing the HTTP Status Code 413 Request Entity Too Large\\n\"},{name:\"http:request-entity-too-long\",type:\"item()*\",description:\" A string representing the HTTP Status Code 414 Request Entity Too Long\\n\"},{name:\"http:unsupported-media-type\",type:\"item()*\",description:\" A string representing the HTTP Status Code 415 Unsupported Media Type\\n\"},{name:\"http:request-range-not-satisfiable\",type:\"item()*\",description:\" A string representing the HTTP Status Code 416 Request Range Not Satisfiable\\n\"},{name:\"http:expectation-failed\",type:\"item()*\",description:\" A string representing the HTTP Status Code 417 Expectation Failed\\n\"},{name:\"http:im-a-teapot\",type:\"item()*\",description:\" A string representing the HTTP Status Code 418 I'm a teapot (RFC 2324)\\n\"},{name:\"http:enhance-your-calm\",type:\"item()*\",description:\" A string representing the HTTP Status Code 420 Enhance Your Calm\\n\"},{name:\"http:unprocessable-entity\",type:\"item()*\",description:\" A string representing the HTTP Status Code 422 Unprocessable Entity (WebDAV; RFC 4918)\\n\"},{name:\"http:locked\",type:\"item()*\",description:\" A string representing the HTTP Status Code 423 Locked (WebDAV; RFC 4918)\\n\"},{name:\"http:failed-dependency\",type:\"item()*\",description:\" A string representing the HTTP Status Code 424 Failed Dependency (WebDAV; RFC 4918)\\n\"},{name:\"http:unordered-collection\",type:\"item()*\",description:\" A string representing the HTTP Status Code 425 Unordered Collection\\n\"},{name:\"http:upgrade-required\",type:\"item()*\",description:\" A string representing the HTTP Status Code 426 Upgrade Required\\n\"},{name:\"http:conflict\",type:\"item()*\",description:\" A string representing the HTTP Status Code 409 Conflict\\n\"},{name:\"http:too-many-requests\",type:\"item()*\",description:\" A string representing the HTTP Status Code 429 Too Many Requests (RFC 6585)\\n\"},{name:\"http:request-header-fields-too-large\",type:\"item()*\",description:\" A string representing the HTTP Status Code 431 Request Header Fields Too Large (RFC 6585)\\n\"},{name:\"http:internal-server-error\",type:\"item()*\",description:\" A string representing the HTTP Status Code 500 Internal Server Error\\n\"},{name:\"http:not-implemented\",type:\"item()*\",description:\" A string representing the HTTP Status Code 501 Not Implemented\\n\"},{name:\"http:bad-gateway\",type:\"item()*\",description:\" A string representing the HTTP Status Code 502 Bad Gateway\\n\"},{name:\"http:service-unavailable\",type:\"item()*\",description:\" A string representing the HTTP Status Code 503 Service Unavailable\\n\"},{name:\"http:gateway-timeout\",type:\"item()*\",description:\" A string representing the HTTP Status Code 504 Gateway Timeout\\n\"},{name:\"http:http-version-not-supported\",type:\"item()*\",description:\" A string representing the HTTP Status Code 505 HTTP Version Not Supported\\n\"},{name:\"http:variant-also-negotiates\",type:\"item()*\",description:\" A string representing the HTTP Status Code 506 Variant Also Negotiates (RFC 2295)\\n\"},{name:\"http:insufficient-storage\",type:\"item()*\",description:\" A string representing the HTTP Status Code 507 Insufficient Storage (WebDAV; RFC 4918)\\n\"},{name:\"http:loop-detected\",type:\"item()*\",description:\" A string representing the HTTP status code 508 Loop Detected (webdav; rfc 5842)\\n\"},{name:\"http:not-extended\",type:\"item()*\",description:\" A string representing the HTTP status code 510 Not Extended (RFC 2774)\\n\"},{name:\"http:network-authentication-required\",type:\"item()*\",description:\" A string representing the HTTP status code 511 Network Authentication Required (RFC 6585)\\n\"},{name:\"resp:status-info\",type:\"object()\",description:\" Variable containing a description for all the HTTP Status Codes\\n\"},{name:\"http:see-other\",type:\"item()*\",description:\" A string representing the HTTP Status Code 303 See Other\\n\"},{name:\"http:switching-protocols\",type:\"item()*\",description:\" A string representing the HTTP Status Code 101 Switching Protocols\\n\"},{name:\"http:processing\",type:\"item()*\",description:\" A string representing the HTTP Status Code 102 Processing (Web; RFC 2518)\\n\"},{name:\"http:ok\",type:\"item()*\",description:\" A string representing the HTTP Status Code 200 OK\\n\"},{name:\"http:created\",type:\"item()*\",description:\" A string representing the HTTP Status Code 201 Created\\n\"},{name:\"http:accepted\",type:\"item()*\",description:\" A string representing the HTTP Status Code 202 Accepted\\n\"},{name:\"http:non-authoritative\",type:\"item()*\",description:\" A string representing the HTTP Status Code 203 Non-Authoritative\\n\"},{name:\"http:no-content\",type:\"item()*\",description:\" A string representing the HTTP Status Code 204 No Content\\n\"},{name:\"http:reset-content\",type:\"item()*\",description:\" A string representing the HTTP Status Code 205 Reset Content\\n\"},{name:\"http:partial-content\",type:\"item()*\",description:\" A string representing the HTTP Status Code 206 Partial Content\\n\"},{name:\"http:multi-status\",type:\"item()*\",description:\" A string representing the HTTP Status Code 207 Multi-Status (WebDAV; RFC 5842)\\n\"},{name:\"http:already-reported\",type:\"item()*\",description:\" A string representing the HTTP Status Code 208 Already Reported (WebDAV; RFC 5842)\\n\"},{name:\"http:im-used\",type:\"item()*\",description:\" A string representing the HTTP Status Code 226 IM Used (RFC 3229)\\n\"},{name:\"http:multiple-choices\",type:\"item()*\",description:\" A string representing the HTTP Status Code 300 Multiple Choices\\n\"},{name:\"http:moved-permanently\",type:\"item()*\",description:\" A string representing the HTTP Status Code 301 Moved Permantently\\n\"},{name:\"http:found\",type:\"item()*\",description:\" A string representing the HTTP Status Code 302 Found\\n\"},{name:\"http:continue\",type:\"item()*\",description:\" A string representing the HTTP Status Code 100 Continue\\n\"},{name:\"http:not-modified\",type:\"item()*\",description:\" A string representing the HTTP Status Code 304 Not Modified\\n\"},{name:\"http:use-proxy\",type:\"item()*\",description:\" A string representing the HTTP Status Code 305 Use Proxy\\n\"},{name:\"http:switch-proxy\",type:\"item()*\",description:\" A string representing the HTTP Status Code 306 Switch Proxy\\n\"},{name:\"http:temporary-redirect\",type:\"item()*\",description:\" A string representing the HTTP Status Code 307 Temporary Redirect\\n\"},{name:\"http:permanent-redirect\",type:\"item()*\",description:\" A string representing the HTTP Status Code 308 Permanent Redirect (http://tools.ietf.org/html/draft-reschke-http-status-308-07)\\n\"},{name:\"http:bad-request\",type:\"item()*\",description:\" A string representing the HTTP Status Code 400 Bad Request\\n\"},{name:\"http:unauthorized\",type:\"item()*\",description:\" A string representing the HTTP Status Code 401 Unauthorized\\n\"},{name:\"http:payment-required\",type:\"item()*\",description:\" A string representing the HTTP Status Code 402 Payment Required\\n\"},{name:\"http:forbidden\",type:\"item()*\",description:\" A string representing the HTTP Status Code 403 Forbidden\\n\"},{name:\"http:not-found\",type:\"item()*\",description:\" A string representing the HTTP Status Code 404 Not Found\\n\"},{name:\"http:not-allowed\",type:\"item()*\",description:\" A string representing the HTTP Status Code 405 Not Allowed\\n\"},{name:\"http:not-acceptable\",type:\"item()*\",description:\" A string representing the HTTP Status Code 406 Not Acceptable\\n\"},{name:\"http:proxy-authentication-required\",type:\"item()*\",description:\" A string representing the HTTP Status Code 407 Proxy Authentication Required\\n\"},{name:\"http:request-timeout\",type:\"item()*\",description:\" A string representing the HTTP Status Code 408 Request Timeout\\n\"}]},\"http://www.zorba-xquery.com/modules/email/smtp\":{ns:\"http://www.zorba-xquery.com/modules/email/smtp\",description:' This module can be used for sending emails.\\n The SMTP module contains only one public function that receives two parameters.\\n The SMTP server access information passed as an <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hostInfo</code> element\\n and the email message representation as a <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">message</code> element.\\n For a quick start see the examples associates with the <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">send(...)</code>\\n function. For a complete specification read, the description and the\\n documentation associated with this function.\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.washington.edu/imap/\">c-client Library part of UW IMAP toolkit</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi, Daniel Thomas</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.zorba-xquery.com/modules/email\",prefix:\"email\"},{uri:\"http://www.zorba-xquery.com/modules/email/smtp\",prefix:\"smtp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"send\",qname:\"smtp:send\",signature:\"($host-info as element(email:hostInfo), $message as element(email:message)) as empty-sequence()\",description:' This function sends an email message from the specified account.\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">hostName</code> child element of <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$host-info</code> must have the form:\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b>remote_system_name</b> [\":\" <b>port</b>] [<b>flags</b>]</code>. This syntax is part of the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://www.washington.edu/imap/documentation/naming.txt.html\" target=\"_blank\">Remote names</a>\\n syntax defined in the UW IMAP toolkit. The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b>remote_system_name</b></code> and\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><b>flags</b></code> fragments are explained in the section <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">III</code> of this document.\\n For example the hostName could look like:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li><code>&lt;hostName&gt;smtp.gmail.com:587/tls/novalidate-cert&lt;hostName&gt;</code></li>\\n   <li><code>&lt;hostName&gt;[209.85.129.111]:587/tls/novalidate-cert&lt;hostName&gt;</code></li>\\n </ul>\\n The <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">$host-info</code> parameter could then look like this:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n &lt;hostInfo&gt;\\n   &lt;hostName&gt;smtp.gmail.com:587/tls/novalidate-cert&lt;/hostName&gt;\\n   &lt;userName&gt;username&lt;/userName&gt;\\n   &lt;password&gt;password&lt;/password&gt;\\n &lt;/hostInfo&gt;\\n </pre>\\n For a complete of the structure of an email message, see the imported email\\n schema: <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>\\n All the data passed to this function does not need to be validated.\\n The only requirement is that they have a valid format and are in the\\n correct namespace according to the schema:\\n <code xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://www.zorba-xquery.com/modules/email</code>.\\n',summary:\"<p> This function sends an email message from the specified account.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"host-info\",type:\"element(email:hostInfo)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The SMTP host, user name, and password.</div>'},{name:\"message\",type:\"element(email:message)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The message to send as defined in the email XML schema.</div>'}],returns:{type:\"empty-sequence()\",description:\"The function is declared as sequential and has side-effects. It returns the empty sequence.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">smtp:SMTP0001 The message format is invalid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">smtp:SMTP0002 The message has no recipient.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">smtp:SMTP0003 The message could not be sent.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">smtp:SMTP9999 If any other error occurs.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 If the values of the arguments are not not valid according to the email schema: <code>http://www.zorba-xquery.com/modules/email</code></xqdoc:error>']}],variables:[]},\"http://www.28msec.com/modules/project\":{ns:\"http://www.28msec.com/modules/project\",description:\" This module contains functions to introspect a project.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://zorba.io/modules/base64\",prefix:\"base64\"},{uri:\"http://zorba.io/modules/hmac\",prefix:\"hmac\"},{uri:\"http://www.28msec.com/modules/project\",prefix:\"project\"},{uri:\"http://zorba.io/modules/random\",prefix:\"random\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"create-seed\",qname:\"project:create-seed\",signature:\"() as string\",description:\" Creates and return new random project seed.\\n\",summary:\"<p> Creates and return new random project seed.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"the project seed\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-EXISTS the project already has a seed file</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error writing the seed file</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED the specified seed is not at least 8 characters long</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"create-seed\",qname:\"project:create-seed\",signature:\"($seed as string) as empty-sequence()\",description:\" Creates a new project seed.\\n The specified seed must be at least 8 characters long.\\n\",summary:\"<p> Creates a new project seed.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"seed\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The new project seed.</div>'}],returns:{type:\"empty-sequence()\",description:\"the empty sequence\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-EXISTS the project already has a seed file</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error writing the seed file</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"has-seed\",qname:\"project:has-seed\",signature:\"() as boolean external\",description:\" Checks if the project has a seed file.\\n\",summary:\"<p> Checks if the project has a seed file.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"boolean\",description:\"whether the project has a seed file or not\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error accessing the seed file</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"name\",qname:\"project:name\",signature:\"() as string external\",description:\" Returns the name of the project.\\n\",summary:\"<p> Returns the name of the project.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"string\",description:\"the said name\"},errors:[]},{isDocumented:!0,arity:0,name:\"read-or-create-seed\",qname:\"project:read-or-create-seed\",signature:\"() as string\",description:\" Returns the project seed. If the project has no seed a new random one is created.\\n\",summary:\"<p> Returns the project seed.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"the project seed\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error reading or writing the seed file</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"scheduler-host\",qname:\"project:scheduler-host\",signature:\"() as string external\",description:\" Returns the host of the scheduler.\\n\",summary:\"<p> Returns the host of the scheduler.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"string\",description:\"the scheduler host.\"},errors:[]},{isDocumented:!0,arity:0,name:\"seed\",qname:\"project:seed\",signature:\"() as string external\",description:\" Returns the project seed.\\n\",summary:\"<p> Returns the project seed.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"the project seed\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:NO-SEED the project seed file cannot be found</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error reading the seed file</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"set-seed\",qname:\"project:set-seed\",signature:\"() as string\",description:\" Sets a new random project seed.\\n\",summary:\"<p> Sets a new random project seed.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"string\",description:\"the project seed\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error reading or writing the seed file</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"set-seed\",qname:\"project:set-seed\",signature:\"($seed as string) as empty-sequence()\",description:\" Sets the project seed.\\n The specified seed must be at least 8 characters long.\\n\",summary:\"<p> Sets the project seed.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"seed\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The new project seed.</div>'}],returns:{type:\"empty-sequence()\",description:\"the project seed\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED-FILE error reading or writing the seed file</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:SEED the specified seed is not at least 8 characters long</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"token\",qname:\"project:token\",signature:\"() as xs:base64Binary\",description:\" Creates a new project token, that expires after 12 hours.\\n\",summary:\"<p> Creates a new project token, that expires after 12 hours.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"xs:base64Binary\",description:\"the project token\"},errors:[]},{isDocumented:!0,arity:1,name:\"token\",qname:\"project:token\",signature:\"($expiration as xs:anyAtomicType) as xs:base64Binary\",description:\" Creates a new project token, that expires at the desired date.\\n The input to the function contains the expiration information.\\n If a duration is used, then the function will create a token expiring after the specified duration.\\n If a dateTime is used, then the function will create a token expiring that date.\\n If an integer is used, then the function will create a token expiring after the specified number of seconds.\\n\",summary:\"<p> Creates a new project token, that expires at the desired date.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"expiration\",type:\"xs:anyAtomicType\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> describes the expiration date of the token.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the new project token\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">project:INVALID-PARAMETER expiration information is invalid (not a duration, date or number of seconds)</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/http-client\":{ns:\"http://zorba.io/modules/http-client\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module provides functions for performing HTTP requests.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">A simple GET request using the get#1 convenience function</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n import module namespace http=\"http://zorba.io/modules/http-client\";\\n http:get(\"http://www.example.com\")\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This example makes a GET request to example.com and returns the server\\'s response\\n as a JSON object.\\n </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n {\\n   \"status\" : 200,\\n   \"message\" : \"OK\",\\n   \"headers\" : {\\n     \"Content-Length\" : \"1270\",\\n     \"Date\" : \"Tue, 11 Jun 2013 22:27:10 GMT\",\\n     ...\\n   },\\n   \"body\" : {\\n     \"media-type\" : \"text/html\",\\n     \"content\" : \"...\"\\n   }\\n }\\n </pre>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"standard_return\">Response format</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Most functions in this module (all except <a href=\"?anchor=options-1\">options#1</a>)\\n return a single JSON item, describing the server\\'s response, as in the previous\\n example.\\n The server status (integer) and message (string) fields are always present.\\n If the server replied sending one or more headers, they are reported\\n in an optional headers object. Each header is represented as a single (string)\\n field.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For non-multipart responses, as in the previous example, the response body,\\n if any, is reported as a body object. This object contains both the (string)\\n media-type returned by the server and its content.\\n The type of the content field is determined by the media-type returned by the\\n server. If the media-type indicates that the body content is textual,\\n then the content has type string, base64Binary otherwise.\\n Specifically, the body content is considered textual only if the MIME-type specified in\\n the media-type is one of:\\n <ul>\\n   <li>\"application/json\"</li>\\n   <li>\"application/x-javascript\"</li>\\n   <li>\"application/xml\"</li>\\n   <li>\"application/xml-external-parsed-entity\"</li>\\n </ul>\\n or if the MIME-type starts with \"text/\" or ends with \"+xml\".</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For multipart responses, multiple bodies are returned, as in the following example: </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n {\\n   \"status\" : 200,\\n   \"message\" : \"OK\",\\n   \"headers\" : {\\n     \"Date\" : \"Tue, 11 Jun 2013 22:34:13 GMT\",\\n     ...\\n   },\\n   \"multipart\" : {\\n     \"boundary\": \"--AaB03x\",\\n     \"parts\": [\\n       {\\n         \"headers\" : {\\n            \"Content Disposition: file\",\\n            ...\\n         },\\n         \"body\": {\\n           \"media-type\" : \"image/gif\",\\n           \"content\" : \"...\"\\n         }\\n       },\\n       {\\n         \"body\" : {\\n           \"media-type\" : \"text/html\",\\n           \"content\" : \"...\"\\n         }\\n       }\\n    ]\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The multipart field contains both the boundary used to separate parts\\n and an array containing all parts. Each part contains its specific headers,\\n if any, and the corresponding body.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"nondeterministic_warning\">Important Notice Regarding Nondeterministic Functions</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The following functions in this module -\\n <a href=\"?anchor=get-1\">get#1</a>,\\n <a href=\"?anchor=get-text-1\">get-text#1</a>,\\n <a href=\"?anchor=get-binary-1\">get-binary#1</a>,\\n <a href=\"?anchor=send-nondeterministic-request-1\">send-nondeterministic-request-1</a>,\\n <a href=\"?anchor=head-1\">head#1</a>, and\\n <a href=\"?anchor=options-1\">options#1</a>\\n are declared to be <i>nondeterministic</i>, which means that their results\\n will not be cached.\\n However, they are <b>not</b> declared to be\\n <i>sequential</i>, which means that they may be re-ordered during query optimization.\\n According to the HTTP RFC, GET, HEAD an OPTIONS requests should not have any side-effects.\\n However, in practice it is not uncommon, especially for GET requests, to have side-effects.\\n If your application depends on the ordering of side-effects from requests issued through\\n these functions, you should either use the <a href=\"?anchor=send-request-1\">send-request()</a>\\n function (which is declared <i>sequential</i>), or alternatively\\n wrap each call to get() in your own sequential function, to ensure\\n that the requests are not reordered.\\n Conversely, if you want their results to be cached you can use the\\n <a href=\"?anchor=send-deterministic-request-3\">send-deterministic-request()</a>\\n function (which is declared <i>deterministic</i>).\\n </p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"url_string\">$href Arguments to Functions</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Several functions in this module accept a URL argument named $href. In\\n all cases, the value passed to $href must be a valid anyURI.\\n However, all functions declare $href to be of type string. This\\n is for convenience, since you can pass a string literal value (that\\n is, a URL in double-quotes spelled out explicitly in your query)\\n to an string parameter.</p>\\n <h2 xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" id=\"expath_relation\">Relation to the EXPath http-client module</h2>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://expath.org/\">EXPath</a> defines its own http-client\\n module, which is available separately.\\n There are two primary differences between EXPath\\'s http-client and\\n this module:\\n <ol>\\n   <li>EXPath does not include the simpler get(), post(), put(), delete(),\\n head(), options() and patch() functions defined by this module.</li>\\n <li>EXPath uses XML to represent request for its send-request() function,\\n whereas this module uses JSON.</li>\\n <li>EXPath specifies that all XML content returned by an HTTP server\\n will be parsed and returned as an XML document, whereas all HTML content\\n will be <i>tidied up</i> into valid XML, and then parsed into an element.\\n This module returns any textual content as string and any binary content\\n as base6Binary.</li>\\n <li>EXPath accepts XML nodes as body in the send-request() function and\\n automatically serializes them into a string. The send-request() function\\n defined in this module only allows string, base64Binary, and hexBinary\\n as body types.\\n </li>\\n </ol>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n See <a href=\"http://www.expath.org/spec/http-client\">the full spec\\n of the EXPath http-client module</a> for more information.\\n </p>\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"><a href=\"http://www.w3.org/TR/xquery-11/#FunctionDeclns\">XQuery 1.1: Function Declaration</a></xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Federico Cavalieri</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/http-client\",prefix:\"http\"},{uri:\"http://jsoniq.org/function-library\",prefix:\"libjn\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"delete\",qname:\"http:delete\",signature:\"($href as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP DELETE request to a given URL.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP DELETE request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-binary\",qname:\"http:get-binary\",signature:\"($href as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes a GET request on a given URL. All returned bodies\\n are forced to be interpreted as binary data, and will be returned\\n as base64Binary items.\\n </p>\\n',summary:\"<p>  \\n This function makes a GET request on a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified href is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get-text\",qname:\"http:get-text\",signature:\"($href as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes a GET request to a given URL. All returned bodies\\n are forced to be interpreted as textual, with a UTF-8 charset and will\\n be returned as string items.\\n </p>\\n',summary:\"<p>  \\n This function makes a GET request to a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified href is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"get\",qname:\"http:get\",signature:\"($href as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes a GET request to a given URL.\\n </p>\\n',summary:\"<p>  \\n This function makes a GET request to a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified href is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"head\",qname:\"http:head\",signature:\"($href as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP HEAD request on a given URL.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP HEAD request on a given URL.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified href is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"options\",qname:\"http:options\",signature:\"($href as string) as string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP OPTIONS request, which asks the server\\n which operations it supports.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP OPTIONS request, which asks the server\\n which operations it supports.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'}],returns:{type:\"string*\",description:\"A sequence of string values of the allowed operations.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified href is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"patch\",qname:\"http:patch\",signature:\"($href as string, $body as atomic) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP PATCH request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary or\\n an hexBinary.\\n If it is a string, the Content-Type sent to the server will be \"text/plain\",\\n \"application/octet-stream\" otherwise.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP PATCH request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"patch\",qname:\"http:patch\",signature:\"($href as string, $body as atomic, $content-type as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP PATCH request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary, or\\n an hexBinary.\\n In any case, Content-Type of the request sent to the server will\\n be $content-type.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP PATCH request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'},{name:\"content-type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content type of $body to send to the server.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"post\",qname:\"http:post\",signature:\"($href as string, $body as atomic) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP POST request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary, or an\\n hexBinary.\\n If it is a string, the Content-Type sent to the server will be \"text/plain\",\\n \"application/octet-stream\" otherwise.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP POST request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"post\",qname:\"http:post\",signature:\"($href as string, $body as atomic, $content-type as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP POST request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary,\\n or an hexBinary.\\n In any case, Content-Type of the request sent to the server will\\n be $content-type.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP POST request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server</div>'},{name:\"content-type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content type of the body as described above.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"put\",qname:\"http:put\",signature:\"($href as string, $body as atomic) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP PUT request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary or\\n an hexBinary.\\n If it is a string, the Content-Type sent to the server will be \"text/plain\",\\n \"application/octet-stream\" otherwise.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP PUT request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"put\",qname:\"http:put\",signature:\"($href as string, $body as atomic, $content-type as string) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function makes an HTTP PUT request to a given URL.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The body passed to this function must be either a string, a base64Binary, or\\n an hexBinary.\\n In any case, Content-Type of the request sent to the server will\\n be $content-type.\\n </p>\\n',summary:\"<p>  \\n This function makes an HTTP PUT request to a given URL.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"href\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The URL to which the request will be made (see <a href=\"#url_string\">note</a> above).</div>'},{name:\"body\",type:\"atomic\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The body which will be sent to the server.</div>'},{name:\"content-type\",type:\"string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The content type of $body to send to the server.</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"send-deterministic-request\",qname:\"http:send-deterministic-request\",signature:\"($request as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends an HTTP request and returns the corresponding response.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function has the same semantics as <a href=\"#send-request-1\">send-request-1</a>,\\n but is declared as deterministic and thus should only be used when\\n the request has no side-effects and behaves deterministic as required by the\\n application.\\n </p>\\n',summary:\"<p>  \\n This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"request\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> see request parameter of <a href=\"#send-request-1\">send-request#1</a></div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:FOLLOW Cannot follow a redirect of a POST, PUT, or DELETE request.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"send-nondeterministic-request\",qname:\"http:send-nondeterministic-request\",signature:\"($request as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends an HTTP request and returns the corresponding response.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function has the same semantics as <a href=\"#send-request-1\">send-request-1</a>,\\n but is declared as being non deterministic and thus should only be used when\\n the request has no side-effects.\\n </p>\\n',summary:\"<p>  \\n This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:nondeterministic\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"nondeterministic\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> see request parameter of <a href=\"#send-request-1\">send-request#1</a></div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:FOLLOW Cannot follow a redirect of a POST, PUT, or DELETE request.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"send-request\",qname:\"http:send-request\",signature:\"($request as object()) as object()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function sends an HTTP request and returns the corresponding response.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This function is declared as sequential and should be used whenever the\\n request may have side-effects.\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The request parameters are specified in the $request JSON object, which\\n has the following minimal structure:\\n <pre class=\"ace-static\" ace-mode=\"java\">\\n   {\\n     \"href\": \"http://www.example.com\"\\n   }\\n </pre>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This object specifies a GET request of the URI \"http://www.example.com\"</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Additional optional parameters can be specified when issuing a request,\\n using the following structure:</p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n  {\\n    \"method\": \"POST\",\\n    \"href\": \"http://www.example.com\",\\n    \"authentication\":\\n    {\\n      \"username\" : \"user\",\\n      \"password\" : \"pass\",\\n      \"auth-method\" : \"Basic\"\\n    },\\n    \"options\":\\n    {\\n      \"status-only\": true,\\n      \"override-media-type\": \"text/plain\",\\n      \"follow-redirect\": false,\\n      \"timeout\": 30,\\n      \"user-agent\": \"Mozilla/5.0\",\\n      \"retry\":\\n      {\\n        \"delay\": [1000, 2000, 5000],\\n        \"on-connection-error\": false,\\n        \"on-statuses\": [500, 501]\\n      }\\n    },\\n    \"headers\":\\n    {\\n      \"name\": \"value\",\\n      ...\\n    },\\n    \"body\":\\n    {\\n      \"media-type\": \"text/plain\",\\n      \"content\": \"...\"\\n    }\\n  }\\n</pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n The method field (string) defines the HTTP verb to use in the HTTP request (i.e., GET, HEAD, OPTIONS,\\n POST, PUT, DELETE). If not specified GET will be used.\\n The authentication field can be used to specify the credentials and authentication method\\n used when issuing a request (e.g, Basic). If the authentication field is specified, all its (string)\\n subfields must be specified. If an authentication object is provided, it overrides any\\n Authorization header specified in the request.\\n Additionally, the following options can be specified:\\n <ul>\\n    <li>status-only. If true, the response body contents are omitted from the response object.</li>\\n    <li>override-media-type. Is a MIME type that will override the Content-Type header returned\\n        by the server. It affects the type of the result body content.</li>\\n    <li>follow-redirect. Control whether an http redirect is automatically followed or not. If\\n        it is false, the http redirect is returned as the response. If it is\\n        true (the default) the function tries to follow the redirect, by\\n        sending the same request to the new address (including body, headers,\\n         and authentication credentials.) Maximum one redirect is followed\\n        (there is no attempt to follow a redirect in response to following a\\n          first redirect).</li>\\n    <li>timeout. Is the maximum number of seconds to wait for the server to respond.\\n         If no response is received withing this time duration, an error is thrown.</li>\\n    <li>user-agent. The user agent sent to the server when issuing the request.\\n        If not specified libcurl-agent/1.0 is used.</li>\\n    <li>retry. The request will be automatically retried in case of connection error\\n        following mandatory suboptions:\\n        <ul>\\n            <li>delay: an array specifying the milliseconds of wait before each retry.</li>\\n            <li>on-connection-error: whether to retry the request if a connection to the\\n                server cannot be estabilished</li>\\n            <li>on-statuses: an array containing the statuses which will trigger a retry</li>\\n        </ul></li>\\n </ul>\\n </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">One or more headers can be sent to the server, specifying them in an optional headers object.\\n Each header is represented as a single (string) field. These headers are overridden if the corresponding\\n option/authentication has been specified in the request.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For non-multipart request a body object can be specified.\\n This object must contain both the desired (string) media-type and its content.\\n The type of the content field must be either string, base64Binary, or hexBinary. </p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">For multipart requests, multipart object can be specified in place of the body object.\\n The multipart object has the following structure: </p>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"java\">\\n  \"multipart\" : {\\n    \"boundary\": \"--AaB03x\",\\n    \"parts\": [\\n      {\\n        \"headers\" : {\\n           \"Content Disposition: file\",\\n           ...\\n        },\\n        \"body\": {\\n          \"media-type\" : \"image/gif\",\\n          \"content\" : \"...\"\\n        }\\n      },\\n      {\\n        \"body\" : {\\n          \"media-type\" : \"text/html\",\\n          \"content\" : \"...\"\\n        }\\n      }\\n   ]\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The multipart field contains an optional (string) field which specifies\\n the boundary used to separate each part and an array containing all parts.\\n Each part contains its specific headers, if any, and the corresponding body.\\n </p>\\n',summary:\"<p>  \\n This function sends an HTTP request and returns the corresponding response.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"request\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a JSON http-client request object</div>'}],returns:{type:\"object()\",description:'<a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"#standard_return\">standard http-client return type</a>.'},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:HTTP An HTTP error occurred.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:REQUEST The specified request is not valid.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:TIMEOUT A timeout occurred waiting for the response.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:FOLLOW Cannot follow a redirect of a POST, PUT, or DELETE request.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http:CHARSET The specified charset is unsupported.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/data-cleaning/consolidation\":{ns:\"http://zorba.io/modules/data-cleaning/consolidation\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides data consolidation functions that generally take as input a sequence of XML nodes\\n and apply some rule in order do decide which node is better suited to represent the entire sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation,\\n although the consolidation functions based on matching sequences against XPath expressions require\\n some form of dynamic evaluation for XPath expressions.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/data-cleaning/consolidation\",prefix:\"con\"},{uri:\"http://zorba.io/modules/data-cleaning/set-similarity\",prefix:\"set\"},{uri:\"http://zorba.io/modules/data-cleaning/character-based-string-similarity\",prefix:\"simc\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"all-xpaths\",qname:\"con:all-xpaths\",signature:\"($s as element(*)*, $paths as xs:string*) as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the elements from an input sequence of elements that, when matched to a given set of XPath expressions,\\n produce a non-empty set of nodes in all the cases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> all-xpaths( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;c&gt;&lt;d/&gt;&lt;/c&gt;, &lt;d/&gt;), (\".//b\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (&lt;a&gt;&lt;b/&gt;&lt;/a&gt;) </pre></p>\\n',summary:\"<p>  Returns the elements from an input sequence of elements that, when matched to a given set of XPath expressions,\\n produce a non-empty set of nodes in all the cases.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of elements.</div>'},{name:\"paths\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings denoting XPath expressions.</div>'}],returns:{type:\"element(*)*\",description:\"The elements that, when matched to the given set of XPath expressions, always return a non-empty set of nodes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-attributes\",qname:\"con:least-attributes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of descending attributes (attributes at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-attributes( ( &lt;a att1=\"a1\" att2=\"a2\"/&gt;, &lt;b att1=\"a1\" /&gt;, &lt;c/&gt; ) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;c/&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of descending attributes (attributes at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of descending attributes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-distinct-attributes\",qname:\"con:least-distinct-attributes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of distinct descending attributes (attributes at any\\n given depth) in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> least-distinct-attributes( ( &lt;a att1=\"a1\" att2=\"a2\"/&gt;, &lt;b att1=\"a1\" /&gt;, &lt;c/&gt; ) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (&lt;c/&gt;) </pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of distinct descending attributes (attributes at any\\n given depth) in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of distinct descending attributes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-distinct-elements\",qname:\"con:least-distinct-elements\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of distinct descending elements (sub-elements at any\\n given depth) in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> least-distinct-elements( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;b&gt;&lt;c/&gt;&lt;/b&gt;, &lt;d/&gt;) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (&lt;d/&gt;) </pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of distinct descending elements (sub-elements at any\\n given depth) in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of distinct descending elements in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-distinct-nodes\",qname:\"con:least-distinct-nodes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of distinct descending nodes (sub-nodes at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> least-distinct-nodes( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;b&gt;&lt;c/&gt;&lt;/b&gt;, &lt;d/&gt;) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (&lt;d/&gt;) </pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of distinct descending nodes (sub-nodes at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of distinct descending nodes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-elements\",qname:\"con:least-elements\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of descending elements (sub-elements at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-elements( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;b&gt;&lt;c/&gt;&lt;/b&gt;, &lt;d/&gt;) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;d/&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of descending elements (sub-elements at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of descending elements in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-frequent\",qname:\"con:least-frequent\",signature:\"($s) as item()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single less frequent node in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-frequent( ( \"a\", \"a\", \"b\") )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"b\")</pre></p>\\n',summary:\"<p>  Returns the single less frequent node in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"item()\",description:\"The least frequent node in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"least-nodes\",qname:\"con:least-nodes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the smallest number of descending nodes (sub-nodes at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-nodes( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;b&gt;&lt;c/&gt;&lt;/b&gt;, &lt;d/&gt;) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;d/&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the smallest number of descending nodes (sub-nodes at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the smallest number of descending nodes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"least-similar-edit-distance\",qname:\"con:least-similar-edit-distance\",signature:\"($s as xs:string*, $m as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single least similar string, in terms of the edit distance metric towards an input string,\\n in a sequence of strings provided as input. If more than one string has a minimum similarity (a maximum\\n value for the edit distance metric), return the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-similar-edit-distance( ( \"aaabbbccc\", \"aaabbb\", \"eeefff\" ), \"aaab\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">( \"eeefff\" )</pre></p>\\n',summary:\"<p>  Returns the single least similar string, in terms of the edit distance metric towards an input string,\\n in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'},{name:\"m\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string towards which we want to measure the edit distance.</div>'}],returns:{type:\"xs:string?\",description:\"The least similar string in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"least-tokens\",qname:\"con:least-tokens\",signature:\"($s as xs:string*, $r as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single shortest string, in terms of the number of tokens, in a sequence of strings provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">least-tokens( ( \"a b c\", \"a b\", \"a\"), \" +\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"a\")</pre></p>\\n',summary:\"<p>  Returns the single shortest string, in terms of the number of tokens, in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:string?\",description:\"The shortest string in the input sequence, in terms of the number of tokens.\"},errors:[]},{isDocumented:!0,arity:2,name:\"least-xpaths\",qname:\"con:least-xpaths\",signature:\"($s as element(*)*, $paths as xs:string*) as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single element from an input sequence of elements that matches the smallest number of\\n XPath expressions from a given set, producing a non-empty set of nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first element according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> least-xpaths( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;d&gt;&lt;c/&gt;&lt;b/&gt;&lt;/d&gt;, &lt;d/&gt;) , (\".//b\", \".//c\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> ( $lt;d/&gt; ) </pre></p>\\n',summary:\"<p>  Returns the single element from an input sequence of elements that matches the smallest number of\\n XPath expressions from a given set, producing a non-empty set of nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of elements.</div>'},{name:\"paths\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings denoting XPath expressions.</div>'}],returns:{type:\"element(*)*\",description:\"The element that matches the smallest number of XPath expressions producing a non-empty set of nodes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"longest\",qname:\"con:longest\",signature:\"($s as xs:string*) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single longest string, in terms of the number of characters, in a sequence of strings provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">con:longest( ( \"a\", \"aa\", \"aaa\") )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"aaa\")</pre></p>\\n',summary:\"<p>  Returns the single longest string, in terms of the number of characters, in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'}],returns:{type:\"xs:string?\",description:\"The longest string in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"matching\",qname:\"con:matching\",signature:\"($s as xs:string*, $r as xs:string) as xs:string*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the strings from an input sequence of strings that match a particular regular expression.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">matching( ( \"a A b\", \"c AAA d\", \"e BB f\"), \"A+\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">( \"a A b\", \"c AAA d\")</pre></p>\\n',summary:\"<p>  Returns the strings from an input sequence of strings that match a particular regular expression.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The regular expression to be used in the matching.</div>'}],returns:{type:\"xs:string*\",description:\"The strings in the input sequence that match the input regular expression.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-attributes\",qname:\"con:most-attributes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of descending attributes (attributes at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-attributes( ( &lt;a att1=\"a1\" att2=\"a2\"/&gt;, &lt;b att1=\"a1\" /&gt;, &lt;c/&gt; ) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a att1=\"a1\" att2=\"a2\"/&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of descending attributes (attributes at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of descending attributes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-distinct-attributes\",qname:\"con:most-distinct-attributes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of distinct descending attributes (attributes at any\\n given depth) in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-distinct-attributes( ( &lt;a att1=\"a1\" att2=\"a2\" att3=\"a3\"/&gt;, &lt;a att1=\"a1\" att2=\"a2\"&gt;&lt;b att2=\"a2\" /&gt;&lt;/a&gt;, &lt;c/&gt; ) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a att1=\"a1\" att2=\"a2\" att3=\"a3\"/&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of distinct descending attributes (attributes at any\\n given depth) in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of distinct descending attributes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-distinct-elements\",qname:\"con:most-distinct-elements\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of distinct descending elements (sub-elements at any\\n given depth) in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-distinct-elements( ( &lt;a&gt;&lt;b/&gt;&lt;c/&gt;&lt;d/&gt;&lt;/a&gt;, &lt;a&gt;&lt;b/&gt;&lt;b/&gt;&lt;c/&gt;&lt;/a&gt;, &lt;a/&gt; ) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a&gt;&lt;b/&gt;&lt;c/&gt;&lt;d/&gt;&lt;/a&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of distinct descending elements (sub-elements at any\\n given depth) in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of distinct descending elements in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-distinct-nodes\",qname:\"con:most-distinct-nodes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of distinct descending nodes (sub-nodes at any given depth) in\\n a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-distinct-nodes( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;a&gt;&lt;a/&gt;&lt;/a&gt;, &lt;b/&gt;) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a&gt;&lt;b/&gt;&lt;/a&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of distinct descending nodes (sub-nodes at any given depth) in\\n a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of distinct descending nodes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-elements\",qname:\"con:most-elements\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of descending elements (sub-elements at any given depth)\\n in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-elements( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;a/&gt;, &lt;b/&gt;) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a&gt;&lt;b/&gt;&lt;/a&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of descending elements (sub-elements at any given depth)\\n in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of descending elements in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-frequent\",qname:\"con:most-frequent\",signature:\"($s) as item()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single most frequent node in a sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, returns the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-frequent( ( \"a\", \"a\", \"b\") )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"a\")</pre></p>\\n',summary:\"<p>  Returns the single most frequent node in a sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"item()\",description:\"The most frequent node in the input sequence.\"},errors:[]},{isDocumented:!0,arity:1,name:\"most-nodes\",qname:\"con:most-nodes\",signature:\"($s) as element(*)\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single node having the largest number of descending nodes (sub-nodes at any given depth) in a\\n sequence of nodes provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first node according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-nodes( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;a/&gt;, &lt;b/&gt;) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(&lt;a&gt;&lt;b/&gt;&lt;/a&gt;)</pre></p>\\n',summary:\"<p>  Returns the single node having the largest number of descending nodes (sub-nodes at any given depth) in a\\n sequence of nodes provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of nodes.</div>'}],returns:{type:\"element(*)\",description:\"The node having the largest number of descending nodes in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"most-similar-edit-distance\",qname:\"con:most-similar-edit-distance\",signature:\"($s as xs:string*, $m as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single most similar string, in terms of the edit distance metric towards an input string,\\n in a sequence of strings provided as input. If more than one string has a maximum similarity (a minimum\\n value for the edit distance metric), the function return the first string according to the order of the\\n input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-similar-edit-distance( ( \"aaabbbccc\", \"aaabbb\", \"eeefff\" ), \"aaab\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">( \"aaabbb\" )</pre></p>\\n',summary:\"<p>  Returns the single most similar string, in terms of the edit distance metric towards an input string,\\n in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'},{name:\"m\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The string towards which we want to measure the edit distance.</div>'}],returns:{type:\"xs:string?\",description:\"The most similar string in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"most-tokens\",qname:\"con:most-tokens\",signature:\"($s as xs:string*, $r as xs:string) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single longest string, in terms of the number of tokens, in a sequence of strings provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">most-tokens( ( \"a b c\", \"a b\", \"a\"), \" +\" )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"a b c\")</pre></p>\\n',summary:\"<p>  Returns the single longest string, in terms of the number of tokens, in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'},{name:\"r\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A regular expression forming the delimiter character(s) which mark the boundaries between adjacent tokens.</div>'}],returns:{type:\"xs:string?\",description:\"The longest string in the input sequence, in terms of the number of tokens.\"},errors:[]},{isDocumented:!0,arity:2,name:\"most-xpaths\",qname:\"con:most-xpaths\",signature:\"($s as element(*)*, $paths as xs:string*) as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single element from an input sequence of elements that matches the largest number of\\n XPath expressions from a given set, producing a non-empty set of nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first element according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> most-xpaths( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;d&gt;&lt;c/&gt;&lt;b/&gt;&lt;/d&gt;, &lt;d/&gt;) , (\".//b\", \".//c\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> ( &lt;d&gt;&lt;c/&gt;&lt;b/&gt;&lt;/d&gt; ) </pre></p>\\n',summary:\"<p>  Returns the single element from an input sequence of elements that matches the largest number of\\n XPath expressions from a given set, producing a non-empty set of nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of elements.</div>'},{name:\"paths\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings denoting XPath expressions.</div>'}],returns:{type:\"element(*)*\",description:\"The element that matches the largest number of XPath expressions producing a non-empty set of nodes.\"},errors:[]},{isDocumented:!0,arity:1,name:\"shortest\",qname:\"con:shortest\",signature:\"($s as xs:string*) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single shortest string, in terms of the number of characters, in a sequence of strings provided as input.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, return the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">shortest( ( \"a\", \"aa\", \"aaa\") )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">(\"a\")</pre></p>\\n',summary:\"<p>  Returns the single shortest string, in terms of the number of characters, in a sequence of strings provided as input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'}],returns:{type:\"xs:string?\",description:\"The shortest string in the input sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"some-xpaths\",qname:\"con:some-xpaths\",signature:\"($s as element(*)*, $paths as xs:string*) as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the elements from a sequence of elements that, when matched to a given set of XPath expressions,\\n produce a non-empty set of nodes for some of the cases.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> some-xpaths( ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt;, &lt;d&gt;&lt;c/&gt;&lt;/d&gt;, &lt;d/&gt;), (\".//b\", \".//c\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> ( &lt;a&gt;&lt;b/&gt;&lt;/a&gt; , &lt;d&gt;&lt;c/&gt;&lt;/d&gt; ) </pre></p>\\n',summary:\"<p>  Returns the elements from a sequence of elements that, when matched to a given set of XPath expressions,\\n produce a non-empty set of nodes for some of the cases.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of elements.</div>'},{name:\"paths\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings denoting XPath expressions.</div>'}],returns:{type:\"element(*)*\",description:\"The elements that, when matched to the given set of XPath expressions, return a non-empty set of nodes for at least one of the cases.\"},errors:[]},{isDocumented:!0,arity:1,name:\"superstring\",qname:\"con:superstring\",signature:\"($s as xs:string*) as xs:string?\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the single string, from an input sequence of strings, that appears more frequently as part\\n of the other strings in the sequence. If no such string exists, the function returns an empty sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">If more then one answer is possible, the function returns the first string according to the order of the input sequence.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\">super-string( ( \"aaa bbb ccc\", \"aaa bbb\", \"aaa ddd\", \"eee fff\" ) )</pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\">( \"aaa bbb\" )</pre></p>\\n',summary:\"<p>  Returns the single string, from an input sequence of strings, that appears more frequently as part\\n of the other strings in the sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of strings.</div>'}],returns:{type:\"xs:string?\",description:\"The string that appears more frequently as part of the other strings in the sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"validating-schema\",qname:\"con:validating-schema\",signature:\"($s as element(*)*, $schema as element(*)) as element(*)*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the nodes from an input sequence of nodes that validate against a given XML Schema.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> validating-schema ( ( &lt;a/&gt; , &lt;b/&gt; ), &lt;xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"&gt;&lt;xs:element name=\"a\" /&gt;&lt;/xs:schema&gt; ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> ( &lt;a/&gt; ) </pre></p>\\n',summary:\"<p>  Returns the nodes from an input sequence of nodes that validate against a given XML Schema.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:\"element(*)\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A sequence of elements.</div>'},{name:\"schema\",type:\"element(*)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> An element encoding an XML Schema.</div>'}],returns:{type:\"element(*)*\",description:'The nodes that validate against the XML Schema. <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Attention : This function is still not implemented. </b>'},errors:[]}],variables:[]},\"http://zorba.io/modules/node\":{ns:\"http://zorba.io/modules/node\",description:\" This module defines a set of function which can be used\\n to determine (1) the relationship between two nodes (e.g. if one\\n is the ancestor if another) and (2) properties of given\\n nodes (e.g. their level in the tree).\\n The same functionality can be achieved with simple XPath expressions.\\n However, please note that using the functions in this modules instead\\n of path expressions guarantees better performance.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/node\",prefix:\"node\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"ancestor-of\",qname:\"node:ancestor-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is an\\n ancestor of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is an\\n ancestor of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential descendant</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential ancestor</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is an ancestor of $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"child-of\",qname:\"node:child-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is a\\n child of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is a\\n child of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential parent</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential child</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is a child of $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:1,name:\"copy\",qname:\"node:copy\",signature:\"($input as node()*) as node()* external\",description:' Return a deep copy of every given node according to the properties\\n specified in the static context of the invoking module.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Please note that a copy of a node is parentless.\\n',summary:\"<p> Return a deep copy of every given node according to the properties\\n specified in the static context of the invoking module.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"input\",type:\"node()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node to copy</div>'}],returns:{type:\"node()*\",description:\"a deep copy of every node in the input sequence or the empty sequence if $input is the empty sequence.\"},errors:[]},{isDocumented:!0,arity:2,name:\"descendant-of\",qname:\"node:descendant-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is a\\n descendant of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is a\\n descendant of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential ancestor</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential descendant</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is a descendant of $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"following-of\",qname:\"node:following-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is\\n following the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is\\n following the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is following the node $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"following-sibling-of\",qname:\"node:following-sibling-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is a\\n following-sibling of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is a\\n following-sibling of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding-sibling</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following-sibling</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is a following-sibling of $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"least-common-ancestor\",qname:\"node:least-common-ancestor\",signature:\"($node1 as node(), $node2 as node()) as node()? external\",description:\" Computes the least common ancestor of two given nodes in\\n the tree.\\n\",summary:\"<p> Computes the least common ancestor of two given nodes in\\n the tree.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the first node</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the second node</div>'}],returns:{type:\"node()?\",description:\"the least common ancestor of the two given nodes or the empty sequence if the two nodes are not part of the same tree.\"},errors:[]},{isDocumented:!0,arity:1,name:\"level\",qname:\"node:level\",signature:\"($node as node()) as xs:integer external\",description:\" Computes the level of a given node in the tree.\\n Note: The first level has the number one.\\n\",summary:\"<p> Computes the level of a given node in the tree.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the node for which the level should be computed</div>'}],returns:{type:\"xs:integer\",description:\"The level as xs:integer of the given node in the tree.\"},errors:[]},{isDocumented:!0,arity:2,name:\"parent-of\",qname:\"node:parent-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is a\\n parent of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is a\\n parent of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential child</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential parent</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is a parent of $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"preceding-of\",qname:\"node:preceding-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is\\n preceding the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is\\n preceding the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following node</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding node</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is preceding the node $node1; false otherwise.\"},errors:[]},{isDocumented:!0,arity:2,name:\"preceding-sibling-of\",qname:\"node:preceding-sibling-of\",signature:\"($node1 as node(), $node2 as node()) as xs:boolean external\",description:\" Determines whether the node given as second argument is a\\n preceding-sibling of the node given as first argument.\\n\",summary:\"<p> Determines whether the node given as second argument is a\\n preceding-sibling of the node given as first argument.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"node1\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential following-sibling</div>'},{name:\"node2\",type:\"node()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the potential preceding-sibling</div>'}],returns:{type:\"xs:boolean\",description:\"true if $node2 is a preceding-sibling of $node1; false otherwise.\"},errors:[]}],variables:[]},\"http://zorba.io/modules/archive\":{ns:\"http://zorba.io/modules/archive\",description:' This module provides functionality to work with (possibly compressed)\\n archives. For example, it provides functions to retrieve the names or\\n extract the values of several entries in a ZIP archive. Moreover,\\n there exist functions that allow to create or update archives.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The following archive formats and compression algorithms are supported:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li>ZIP (with compression DEFLATE or STORE)</li>\\n   <li>TAR (with compression GZIP)</li>\\n </ul>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Luis Rodgriguez, Juan Zacarias, and Matthias Brantner</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/archive\",prefix:\"a\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"create\",qname:\"a:create\",signature:\"($entries as item()*, $contents as item()*) as xs:base64Binary external\",description:' Creates a new ZIP archive out of the given entries and contents. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n All entries are compressed with the DEFLATE compression algorithm.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The parameters $entries and $contents have the same meaning as for\\n the function a:create with three arguments.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Entry entries can include a type element, this element can have one\\n of two possible values: \"regular\" or \"directory\". If \"regular\" is\\n specified then the entry will be created as a regular file; if \"directory\"\\n is specified then the entry will be created as a directory, no contents\\n will be read from $contents in this case. If no value is specified for type\\n then it will be set to \"regular\". <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Example:\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n $zip-file := a:create(\\n    ({ \"encoding\" : \"ISO-8859-1\", \"type\" : \"directory\", \"name\" : \"dir1\" }, \"dir1/file1\"),\\n    (\"file contents\"))\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Creates a new ZIP archive out of the given entries and contents.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entries\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the meta data for the entries in the archive. Each entry can be of type xs:string or a JSON oibject describing the entry.</div>'},{name:\"contents\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content for the archive. Each item in the sequence can be of type xs:string or xs:base64Binary.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the generated archive as xs:base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:ENTRY-COUNT-MISMATCH if the number of entries that don\\'t describe directories differs from the number of items in the $contents sequence: count($non-directory-entries) ne count($contents)</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENTRY-VALS if a values in an entry object are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENCODING if a given encoding is invalid or not supported</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0006 if an item in the contents sequence is not of type xs:string or xs:base64Binary</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"create\",qname:\"a:create\",signature:\"($entries as item()*, $contents as item()*, $options as object()) as xs:base64Binary external\",description:' Creates a new archive out of the given entries and contents. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The $entries arguments provides meta data for each entry in the archive.\\n For example, the name of the entry (mandatory) or the last-modified date\\n (optional). An entry can either be of type xs:string to describe the entry\\n name or of type xs:base64Binary to provide additional meta data.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The $contents sequence provides the data (xs:string or xs:base64Binary) for\\n the entries that should be included in the archive. Its length needs to\\n match the length of the entries in the $entries sequence that don\\'t describe\\n directory entries (a:ARCH0001). All items of type xs:base64Binary are decoded\\n before being added to the archive.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For each entry, the name, last-modified date and time, and compression\\n can be specified. In addition, an encoding can be specified which is used to\\n store entries of type xs:string. If no last-modified attribute is given, the\\n default is the current date and time. The compression is useful if various\\n entries in a ZIP archive are compressed using different compression\\n algorithms (i.e. store or deflate).<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n For example, the following sequence may be used to describe an archive\\n containing two elements: <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">{\\n   \"last-modified\" : \"{fn:current-dateTime()}\"\\n   \"name\" : \"myfile.txt\"\\n },\\n {\\n   \"encoding\" : \"ISO-8859-1\",\\n   \"compression\" : \"store\",\\n   \"name\" : \"dir/myfile.xml\"\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The $options argument may be used to describe general options for the\\n archive.  For example, the following options can be used to create a ZIP\\n archive in which all entries are compressed with the DEFLATE compression\\n algorithm: <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">{\\n   \"format\" : \"ZIP\",\\n   \"compression\" : \"DEFLATE\"\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The result of the function is the generated archive as a item of type\\n xs:base64Binary.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Creates a new archive out of the given entries and contents.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entries\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the meta data for the entries in the archive. Each entry can be of type xs:string or an JSON object describing the entry.</div>'},{name:\"contents\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content for the archive. Each item in the sequence can be of type xs:string or xs:base64Binary.</div>'},{name:\"options\",type:\"object()\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the options used to generate the archive.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the generated archive as xs:base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:ENTRY-COUNT-MISMATCH if the number of entries describing non-directories differs from the number of items in the $contents sequence: count($non-directoy-entries) ne count($contents)</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-OPTIONS if the options argument contains invalid values</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENTRY-VALS if any values in an entry are invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENCODING if a given encoding is invalid or not supported</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:DIFFERENT-COMPRESSIONS-NOT-SUPPORTED if different compression algorithms were selected but the actual version of libarchive doesn\\'t support it.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0006 if an item in the contents sequence is not of type xs:string or xs:base64Binary</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"delete\",qname:\"a:delete\",signature:\"($archive as xs:base64Binary, $entry-names as xs:string*) as xs:base64Binary external\",description:' Deletes entries from an archive. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Deletes entries from an archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'},{name:\"entry-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of names for entries which should be deleted</div>'}],returns:{type:\"xs:base64Binary\",description:\"the updated base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"entries\",qname:\"a:entries\",signature:\"($archive as xs:base64Binary) as object()* external\",description:' Returns the header information of all entries in the given archive as a JSON\\n objects sequence. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Such information includes the name of the entry, the uncompressed size,\\n as well as the last-modified timestamp. Note that not all values are\\n available in every archive.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Returns the header information of all entries in the given archive as a JSON\\n objects sequence.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to list the entries from as xs:base64Binary</div>'}],returns:{type:\"object()*\",description:\"a sequence of strings, one for each entry in the archive\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"extract-binary\",qname:\"a:extract-binary\",signature:\"($archive as xs:base64Binary) as xs:base64Binary* external\",description:' Returns the entries identified by the given paths from the archive\\n as base64Binary. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Returns the entries identified by the given paths from the archive\\n as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'}],returns:{type:\"xs:base64Binary*\",description:\"one xs:base64Binary item for the contents of each entry in the archive\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"extract-binary\",qname:\"a:extract-binary\",signature:\"($archive as xs:base64Binary, $entry-names as xs:string*) as xs:base64Binary* external\",description:' Returns the entries identified by the given paths from the archive\\n as base64Binary. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Returns the entries identified by the given paths from the archive\\n as base64Binary.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'},{name:\"entry-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of names for entries which should be extracted</div>'}],returns:{type:\"xs:base64Binary*\",description:\"a sequence of xs:base64Binary itmes for the given sequence of names or the empty sequence if no entries match the given names.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"extract-text\",qname:\"a:extract-text\",signature:\"($archive as xs:base64Binary) as xs:string* external\",description:' Extracts the contents of all entries in the given archive as text\\n using UTF-8 as default encoding. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Extracts the contents of all entries in the given archive as text\\n using UTF-8 as default encoding.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'}],returns:{type:\"xs:string*\",description:\"one string for the contents of each entry in the archive\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCH0001 if any of the entries contains invalid utf-8 characters</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"extract-text\",qname:\"a:extract-text\",signature:\"($archive as xs:base64Binary, $entry-names as xs:string*) as xs:string* external\",description:' Extracts the contets of the entries identified by a given sequence of\\n names as text.\\n The default encoding used to read the string is UTF-8. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Extracts the contets of the entries identified by a given sequence of\\n names as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'},{name:\"entry-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of names for entries which should be extracted</div>'}],returns:{type:\"xs:string*\",description:\"a sequence of strings for the given sequence of names or the empty sequence if no entries match the given names.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCH0001 if any of the entries requested contains invalid utf-8 characters</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"extract-text\",qname:\"a:extract-text\",signature:\"($archive as xs:base64Binary, $entry-names as xs:string*, $encoding as xs:string) as xs:string* external\",description:' Extracts the contets of the entries identified by a given sequence of\\n names as text. Each entry is treated with the given encoding. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Extracts the contets of the entries identified by a given sequence of\\n names as text.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to extract the entries from as xs:base64Binary</div>'},{name:\"entry-names\",type:\"xs:string\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a sequence of entry names that should be extracted</div>'},{name:\"encoding\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a encoding for transcoding each of the extracted entries</div>'}],returns:{type:\"xs:string*\",description:\"a sequence of strings for the given sequence of names or the empty sequence if no entries match the given names.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENCODING if the given $encoding is invalid or not supported</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FOCH0001 if a transcoding error happens</xqdoc:error>']},{isDocumented:!0,arity:1,name:\"options\",qname:\"a:options\",signature:\"($archive as xs:base64Binary) as object() external\",description:' Returns the algorithm and format options as a JSON object for a given archive.\\n For example, for a ZIP archive, the following options element\\n would be returned: <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">{\\n   \"format\" : \"ZIP\",\\n   \"compression\" : \"DEFLATE\"\\n }\\n </pre>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Returns the algorithm and format options as a JSON object for a given archive.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive as xs:base64Binary</div>'}],returns:{type:\"object()\",description:\"the algorithm and format options as a JSON object\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"update\",qname:\"a:update\",signature:\"($archive as xs:base64Binary, $entries as item()*, $contents as item()*) as xs:base64Binary external\",description:' Adds and replaces entries in an archive according to\\n the given spec. The contents can be string and base64Binary items. <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n The parameters $entries and $contents have the same meaning as for\\n the function a:create with three arguments.<p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> Adds and replaces entries in an archive according to\\n the given spec.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"archive\",type:\"xs:base64Binary\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the archive to add or replace content</div>'},{name:\"entries\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the meta data for the entries in the archive. Each entry can be of type xs:string or a JSON object. For mandatory fields in the JSON object see create function.</div>'},{name:\"contents\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the content for the archive. Each item in the sequence can be of type xs:string or xs:base64Binary.</div>'}],returns:{type:\"xs:base64Binary\",description:\"the updated xs:base64Binary\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:ENTRY-COUNT-MISMATCH if the number of entry elements differs from the number of items in the $contents sequence: count($non-directory-entries) ne count($contents)</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENTRY-VALS if a value for an entry element is invalid</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:INVALID-ENCODING if a given encoding is invalid or not supported</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:DIFFERENT-COMPRESSIONS-NOT-SUPPORTED if different compression algorithms were selected but the actual version of libarchive doesn\\'t support it.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:FORG0006 if an item in the contents sequence is not of type xs:string or xs:base64Binary</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">a:CORRUPTED-ARCHIVE if $archive is not an archive or corrupted</xqdoc:error>']}],variables:[]},\"http://www.zorba-xquery.com/modules/converters/html\":{ns:\"http://www.zorba-xquery.com/modules/converters/html\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n This module provides functions to <a href=\"http://www.w3.org/People/Raggett/tidy/\" target=\"_blank\">tidy</a> a HTML document. <br/>\\n The functions in this module take an HTML document (a string) as parameter,\\n tidy it in order to result in valid XHTML, and return this XHTML document as a document-node.\\n </p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Sorin Nasoi</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://ww.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://www.zorba-xquery.com/modules/converters/html\",prefix:\"html\"},{uri:\"http://www.zorba-xquery.com/modules/converters/html-options\",prefix:\"html-options\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"parse\",qname:\"html:parse\",signature:\"($html as xs:string) as document()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function tidies the given HTML string and returns\\n a valid XHTML document node.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This functions automatically sets the following tidying parameters:\\n   <ul>\\n    <li>output-xml=yes</li>\\n    <li>doctype=omit</li>\\n    <li>quote-nbsp=no</li>\\n    <li>char-encoding=utf8</li>\\n    <li>newline=LF</li>\\n    <li>tidy-mark=no</li>\\n   </ul>\\n </p>\\n',summary:\"<p>  This function tidies the given HTML string and returns\\n a valid XHTML document node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the HTML string to tidy</div>'}],returns:{type:\"document()\",description:\"the tidied XML document\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">html:InternalError if an internal error occurred while tidying the string.</xqdoc:error>']},{isDocumented:!0,arity:2,name:\"parse\",qname:\"html:parse\",signature:\"($html as xs:string, $options as element(html-options:options)) as document()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This function tidies the given HTML string and returns\\n a valid XHTML document node.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The second parameter allows to specify options that\\n configure the tidy process. This parameter is a sequence\\n of name=value pairs. Allowed parameter names and values\\n are documented at <a href=\"http://tidy.sourceforge.net/docs/quickref.html\">\\n http://tidy.sourceforge.net/docs/quickref.html</a>.</p>\\n',summary:\"<p>  This function tidies the given HTML string and returns\\n a valid XHTML document node.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"html\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the HTML string to tidy</div>'},{name:\"options\",type:\"element(html-options:options)\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> a set of name and value pairs that provide options to configure the tidy process that have to be validated against the \"http://www.zorba-xquery.com/modules/converters/html-options\" schema.</div>'}],returns:{type:\"document()\",description:\"the tidied XHTML document node\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">err:XQDY0027 if $options can not be validated against the html-options schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">html:TidyOption if there was an error with one of the options in the $options parameter that couldn\\'t have been caught by validating against the schema</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">html:InternalError if an internal error occurred while tidying the string.</xqdoc:error>']}],variables:[]},\"http://zorba.io/modules/data-cleaning/set-similarity\":{ns:\"http://zorba.io/modules/data-cleaning/set-similarity\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This library module provides similarity functions for comparing sets of XML\\n nodes (e.g., sets of XML elements, attributes or atomic values).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">These functions are particularly useful for matching near duplicate sets of XML nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The logic contained in this module is not specific to any particular XQuery implementation.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Bruno Martins</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/modules/data-cleaning/set-similarity\",prefix:\"set\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"deep-intersect\",qname:\"set:deep-intersect\",signature:\"($s1, $s2) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the intersection between two sets, using the deep-equal() function to compare the XML nodes from the sets.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> deep-intersect ( ( \"a\", \"b\", \"c\") , ( \"a\", \"a\", <d/> ) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (\"a\") </pre></p>\\n',summary:\"<p>  Returns the intersection between two sets, using the deep-equal() function to compare the XML nodes from the sets.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first set.</div>'},{name:\"s2\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second set.</div>'}],returns:{type:\"item()*\",description:\"The intersection of both sets.\"},errors:[]},{isDocumented:!0,arity:2,name:\"deep-union\",qname:\"set:deep-union\",signature:\"($s1, $s2) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the union between two sets, using the deep-equal() function to compare the XML nodes from the sets.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> deep-union ( ( \"a\", \"b\", \"c\") , ( \"a\", \"a\", <d/> ) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (\"a\", \"b\", \"c\", <d/> ) </pre></p>\\n',summary:\"<p>  Returns the union between two sets, using the deep-equal() function to compare the XML nodes from the sets.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first set.</div>'},{name:\"s2\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second set.</div>'}],returns:{type:\"item()*\",description:\"The union of both sets.\"},errors:[]},{isDocumented:!0,arity:2,name:\"dice\",qname:\"set:dice\",signature:\"($s1, $s2) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Dice similarity coefficient between two sets of XML nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Dice coefficient is defined as defined as twice the shared information between the input sets\\n (i.e., the size of the intersection) over the sum of the cardinalities for the input sets.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> dice ( ( \"a\", \"b\", <c/> ) , ( \"a\", \"a\", \"d\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.4 </pre></p>\\n',summary:\"<p>  Returns the Dice similarity coefficient between two sets of XML nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first set.</div>'},{name:\"s2\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second set.</div>'}],returns:{type:\"xs:double\",description:\"The Dice similarity coefficient between the two sets.\"},errors:[]},{isDocumented:!0,arity:1,name:\"distinct\",qname:\"set:distinct\",signature:\"($s) as item()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Removes exact duplicates from a set, using the deep-equal() function to compare the XML nodes from the sets.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> distinct ( ( \"a\", \"a\", <b/> ) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> (\"a\", <b/> ) </pre></p>\\n',summary:\"<p>  Removes exact duplicates from a set, using the deep-equal() function to compare the XML nodes from the sets.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> A set.</div>'}],returns:{type:\"item()*\",description:\"The set provided as input without the exact duplicates (i.e., returns the distinct nodes from the set provided as input).\"},errors:[]},{isDocumented:!0,arity:2,name:\"jaccard\",qname:\"set:jaccard\",signature:\"($s1, $s2) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the Jaccard similarity coefficient between two sets of XML nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The Jaccard coefficient is defined as the size of the intersection divided by the size of the\\n union of the input sets.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> jaccard ( ( \"a\", \"b\", <c/> ) , ( \"a\", \"a\", \"d\") ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 0.25 </pre></p>\\n',summary:\"<p>  Returns the Jaccard similarity coefficient between two sets of XML nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first set.</div>'},{name:\"s2\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second set.</div>'}],returns:{type:\"xs:double\",description:\"The Jaccard similarity coefficient between the two sets.\"},errors:[]},{isDocumented:!0,arity:2,name:\"overlap\",qname:\"set:overlap\",signature:\"($s1, $s2) as xs:double\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Returns the overlap coefficient between two sets of XML nodes.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The overlap coefficient is defined as the shared information between the input sets\\n (i.e., the size of the intersection) over the size of the smallest input set.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Example usage : <pre class=\"ace-static\" ace-mode=\"xquery\"> overlap ( ( \"a\", \"b\", <c/> ) , ( \"a\", \"a\", \"b\" ) ) </pre></p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">The function invocation in the example above returns : <pre class=\"ace-static\" ace-mode=\"xquery\"> 1.0 </pre></p>\\n',summary:\"<p>  Returns the overlap coefficient between two sets of XML nodes.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"s1\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The first set.</div>'},{name:\"s2\",type:null,occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The second set.</div>'}],returns:{type:\"xs:double\",description:\"The overlap coefficient between the two sets.\"},errors:[]}],variables:[]},\"http://www.28msec.com/modules/http/util/cache\":{ns:\"http://www.28msec.com/modules/http/util/cache\",description:\" This module contains a collection of convenience functions to help\\n developers work with HTTP caching options.\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">28msec</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://zorba.io/annotations\",prefix:\"an\"},{uri:\"http://www.28msec.com/modules/http/util/cache\",prefix:\"cache\"},{uri:\"http://www.28msec.com/modules/http/response\",prefix:\"resp\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:0,name:\"no-cache\",qname:\"cache:no-cache\",signature:\"() as empty-sequence()\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Forces a client not to cache the response by setting the appropriate\\n HTTP headers.</p>\\n In detail, the following HTTP headers will be set in the response:\\n <ul xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">\\n   <li><tt>Cache-Control: no-cache</tt></li>\\n   <li><tt>Pragma: no-cache</tt></li>\\n   <li><tt>Expires: 0</tt></li>\\n </ul>\\n',summary:\"<p>  Forces a client not to cache the response by setting the appropriate\\n HTTP headers.</p>\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"http://zorba.io/annotations\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[],returns:{type:\"empty-sequence()\",description:\"On success, the empty-sequence is returned\"},errors:[]}],variables:[]},\"http://www.zorba-xquery.com/modules/schema-tools\":{ns:\"http://www.zorba-xquery.com/modules/schema-tools\",description:' This module provides funtionality to get sample XMLSchema from XML instances\\n and sample XML instances from XMLSchema.\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlbeans.apache.org/\">Apache XMLBeans</a> library is used to implement\\n inst2xsd and xsd2inst functions.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n <b xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Note:</b> Since this module has a Java library dependency a JVM required\\n to be installed on the system. For Windows: jvm.dll is required on the system\\n path ( usually located in \"C:\\\\Program Files\\\\Java\\\\jre6\\\\bin\\\\client\".\\n',sees:['<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://xmlbeans.apache.org/</xqdoc:see>','<xqdoc:see xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">http://xmlbeans.apache.org</xqdoc:see>'],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Cezar Andrei</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.w3.org/2005/xqt-errors\",prefix:\"err\"},{uri:\"http://zorba.io/modules/schema\",prefix:\"schema-options\"},{uri:\"http://www.zorba-xquery.com/modules/schema-tools\",prefix:\"schema-tools\"},{uri:\"http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options\",prefix:\"st-options\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"inst2xsd\",qname:\"schema-tools:inst2xsd\",signature:\"($instances as element(*)+, $options as element(st-options:inst2xsd-options)?) as document()*\",description:' The inst2xsd function takes a set of sample XML instance elements as input and\\n generates a set of sample XMLSchema documents that define\\n the content of the given input.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Please consult the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlbeans.apache.org/\">official documentation for further\\n information</a>.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Example:<pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-mode=\"xquery\">\\n  import module namespace st = \"http://www.zorba-xquery.com/modules/schema-tools\";\\n  declare namespace sto =\\n      \"http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options\";\\n  let $instances := (&lt;a&gt;&lt;b/&gt;&lt;c/&gt;&lt;/a&gt;, &lt;b/&gt;, &lt;c&gt;ccc&lt;/c&gt;)\\n  let $options  :=\\n     &lt;sto:inst2xsd-options xmlns:sto=\\n       \"http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options\"&gt;\\n       &lt;sto:design&gt;vbd&lt;/sto:design&gt;\\n       &lt;sto:simple-content-types&gt;smart&lt;/sto:simple-content-types&gt;\\n       &lt;sto:use-enumeration&gt;10&lt;/sto:use-enumeration&gt;\\n     &lt;/sto:inst2xsd-options&gt;\\n  return\\n      st:inst2xsd($instances, $options)\\n </pre>\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> The inst2xsd function takes a set of sample XML instance elements as input and\\n generates a set of sample XMLSchema documents that define\\n the content of the given input.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"instances\",type:\"element(*)\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The input XML instance elements</div>'},{name:\"options\",type:\"element(st-options:inst2xsd-options)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Options:<br/> <ul> <li>design: Choose the generated schema design<br/> - rdd: Russian Doll Design - local elements and local types<br/> - ssd: Salami Slice Design - global elements and local types<br/> - vbd (default): Venetian Blind Design - local elements and global complex types</li> <li>simple-content-types: type of leaf nodes<br/> - smart (default): try to find the right simple XMLSchema type<br/> - always-string: use xsd:string for all simple types</li> <li>use-enumeration: - when there are multiple valid values in a list<br/> - 1: never use enumeration<br/> - 2 or more (default 10): use enumeration if less than this number of occurrences - number option</li> <li>verbose: - stdout verbose info<br/> - true: - output type holder information<br/> - false (default): no output</li></ul></div>'}],returns:{type:\"document()*\",description:\"The generated XMLSchema documents.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">schema-tools:VM001 If Zorba was unable to start the JVM.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">schema-tools:JAVA-EXCEPTION If Apache XMLBeans throws an exception.</xqdoc:error>']},{isDocumented:!0,arity:3,name:\"xsd2inst\",qname:\"schema-tools:xsd2inst\",signature:\"($schemas as element(*)+, $rootElementName as xs:string, $options as element(st-options:xsd2inst-options)?) as document()\",description:' The xsd2inst function takes a set of XML Schema elements as input and the\\n local name of the root element and\\n generates a document that represents one sample XML instance of the given\\n input schemas. The local name is searched in schema global element definitions\\n in the order of schemas parameter.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Please consult the\\n <a xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" href=\"http://xmlbeans.apache.org/\">official documentation for further\\n   information</a>.\\n <br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n Example: <pre xmlns:xqdoc=\"http://www.xqdoc.org/1.0\" class=\"ace-static\" ace-static=\"xquery\">\\n  import module namespace st = \"http://www.zorba-xquery.com/modules/schema-tools\";\\n  declare namespace sto =\\n      \"http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options\";\\n  let $xsds  :=\\n     ( &lt;xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\"\\n           attributeFormDefault=\"unqualified\"\\n           elementFormDefault=\"qualified\"&gt;\\n         &lt;xs:element name=\"a\" type=\"aType\"/&gt;\\n         &lt;xs:complexType name=\"aType\"&gt;\\n           &lt;xs:sequence&gt;\\n             &lt;xs:element type=\"xs:string\" name=\"b\"/&gt;\\n             &lt;xs:element type=\"xs:string\" name=\"c\"/&gt;\\n           &lt;/xs:sequence&gt;\\n         &lt;/xs:complexType&gt;\\n       &lt;/xs:schema&gt; )\\n  let $options :=\\n    &lt;sto:xsd2inst-options xmlns:sto=\\n      \"http://www.zorba-xquery.com/modules/schema-tools/schema-tools-options\"&gt;\\n      &lt;sto:network-downloads&gt;false&lt;/sto:network-downloads&gt;\\n      &lt;sto:no-pvr&gt;false&lt;/sto:no-pvr&gt;\\n      &lt;sto:no-upa&gt;false&lt;/sto:no-upa&gt;\\n    &lt;/sto:xsd2inst-options&gt;\\n  return\\n      st:xsd2inst($xsds, \"a\", $options)\\n </pre><br xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"/>\\n',summary:\"<p> The xsd2inst function takes a set of XML Schema elements as input and the\\n local name of the root element and\\n generates a document that represents one sample XML instance of the given\\n input schemas.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"schemas\",type:\"element(*)\",occurrence:\"+\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> elements representing XMLSchema definitions</div>'},{name:\"rootElementName\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> The local name of the instance root element. If multiple target namespaces are used, first one found - using the sequence order - will be used.</div>'},{name:\"options\",type:\"element(st-options:xsd2inst-options)\",occurrence:\"?\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> Options:<br/><ul> <li>network-downloads: boolean (default false)<br/> - true allows XMLBeans to use network when resolving schema imports and includes</li> <li>no-pvr: boolean (default false)<br/> - true to disable particle valid (restriction) rule, false otherwise</li> <li>no-upa: boolean (default false)<br/> - true to disable unique particle attribution rule, false otherwise</li></ul></div>'}],returns:{type:\"document()\",description:\"The generated output document, representing a sample XML instance.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">schema-tools:VM001 If Zorba was unable to start the JVM.</xqdoc:error>','<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">schema-tools:JAVA-EXCEPTION If Apache XMLBeans throws an exception.</xqdoc:error>']}],variables:[]},\"http://xbrl.io/modules/bizql/entities\":{ns:\"http://xbrl.io/modules/bizql/entities\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">This module provides functions for retrieving information about entities.\\n Entities submit archives (see archives module),\\n for example, to a reporting authority. Entities\\n are identified with an EID (Entity ID).</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">With this module, you can retrieve all entities, or a certain number of entities\\n with their EIDs, or obtain the EID of entities you already have.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Entities are stored in a MongoDB datasource called <b>xbrl</b>.</p>\\n <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Each entity can be associated with a set of tags that makes it easier\\n to manage them. The e:entities#1 function\\n allows to retrieve all entities with a given tag.</p>\\n',sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Charles Hoffman</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Matthias Brantner</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Dennis Knochenwefel</xqdoc:author>','<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Ghislain Fourny</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.28msec.com/modules/credentials\",prefix:\"credentials\"},{uri:\"http://xbrl.io/modules/bizql/entities\",prefix:\"entities\"},{uri:\"http://www.28msec.com/modules/mongodb\",prefix:\"mongo\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:1,name:\"eid\",qname:\"entities:eid\",signature:\"($entities-or-ids as item()*) as atomic*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Converts the input to a normalized entity identifier (EID). The input\\n can be either an EID, or an entity object which contains an _id.</p>\\n',summary:\"<p>  Converts the input to a normalized entity identifier (EID).</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:\"\"}],returns:{type:\"atomic*\",description:\"the normalized EIDs.\"},errors:['<xqdoc:error xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">entities:INVALID_PARAMETER if the EID or entity is not valid.</xqdoc:error>']},{isDocumented:!0,arity:0,name:\"entities\",qname:\"entities:entities\",signature:\"() as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return all entities.</p>\\n',summary:\"<p>  Return all entities.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[],returns:{type:\"object()*\",description:\"all entities.\"},errors:[]},{isDocumented:!0,arity:1,name:\"entities\",qname:\"entities:entities\",signature:\"($entities-or-ids as item()*) as object()*\",description:' <p xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">Return the entities with the given EIDs.</p>\\n',summary:\"<p>  Return the entities with the given EIDs.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entities-or-ids\",type:\"item()\",occurrence:\"*\",description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the ids of the entities (EIDs) or the entities themselves.</div>'}],returns:{type:\"object()*\",description:\"the entities with the given EIDs the empty sequence if no entity was found or if the input is an empty sequence.\"},errors:[]}],variables:[{name:\"entities:col\",type:\"string\",description:\" Name of the collection the entities are stored in.\\n\"}]},\"http://www.zorba-xquery.com/modules/cryptography/hmac\":{ns:\"http://www.zorba-xquery.com/modules/cryptography/hmac\",description:\" This module provides a function to generate hash-based\\n message authentication codes (HMAC) involving a cryptographic\\n hash function (e.g. SHA1).\\n\",sees:[],authors:['<xqdoc:author xmlns:xqdoc=\"http://www.xqdoc.org/1.0\">William Candillon</xqdoc:author>'],version:null,encoding:\"utf-8\",namespaces:[{uri:\"http://www.zorba-xquery.com/modules/cryptography/hmac\",prefix:\"hmac\"},{uri:\"http://zorba.io/options/versioning\",prefix:\"ver\"}],functions:[{isDocumented:!0,arity:2,name:\"sha1\",qname:\"hmac:sha1\",signature:\"($message as xs:string, $secret-key as xs:string) as xs:string external\",description:\" This function provides hash-based message authentication code using\\n the SHA1 algorithm.\\n\",summary:\"<p> This function provides hash-based message authentication code using\\n the SHA1 algorithm.</p>\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"message\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the message to be authenticated</div>'},{name:\"secret-key\",type:\"xs:string\",occurrence:null,description:'<div xmlns:xqdoc=\"http://www.xqdoc.org/1.0\"> the secret key used for calculating the authentication</div>'}],returns:{type:\"xs:string\",description:\"hash-based base64 encoded message authentication code\"},errors:[]}],variables:[]},\"http://api.28.io/csvview\":{ns:\"http://api.28.io/csvview\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"\",prefix:\"an\"},{uri:\"http://api.28.io/csvview\",prefix:\"csvview\"},{uri:\"http://api.28.io/model\",prefix:\"model\"}],functions:[{isDocumented:!1,arity:1,name:\"column\",qname:\"csvview:column\",signature:\"($data) as xs:string\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"data\",type:null,occurrence:null,description:\"\"}],returns:{type:\"xs:string\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"line\",qname:\"csvview:line\",signature:\"($entries as xs:string*)\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"entries\",type:\"xs:string\",occurrence:\"*\",description:\"\"}],returns:{type:null,description:\"\"},errors:[]},{isDocumented:!1,arity:2,name:\"show-nodes\",qname:\"csvview:show-nodes\",signature:\"($nodes, $show-headers as xs:boolean)\",description:\"\",summary:\"\",annotation_str:\" %an:sequential\",annotations:[{prefix:\"an\",ns:\"\",name:\"sequential\",value:\"\"}],updating:!1,parameters:[{name:\"nodes\",type:null,occurrence:null,description:\"\"},{name:\"show-headers\",type:\"xs:boolean\",occurrence:null,description:\"\"}],returns:{type:null,description:\"\"},errors:[]}],variables:[]},\"http://api.28.io/util\":{ns:\"http://api.28.io/util\",description:\"\",sees:[],authors:[],version:null,encoding:null,namespaces:[{uri:\"http://www.28msec.com/modules/http/request\",prefix:\"req\"},{uri:\"http://api.28.io/util\",prefix:\"util\"}],functions:[{isDocumented:!1,arity:1,name:\"param-or-body\",qname:\"util:param-or-body\",signature:\"($param-name as xs:string) as xs:string?\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"param-name\",type:\"xs:string\",occurrence:null,description:\"\"}],returns:{type:\"xs:string?\",description:\"\"},errors:[]},{isDocumented:!1,arity:1,name:\"path\",qname:\"util:path\",signature:\"($from as xs:integer) as xs:string*\",description:\"\",summary:\"\",annotation_str:\"\",annotations:[],updating:!1,parameters:[{name:\"from\",type:\"xs:integer\",occurrence:null,description:\"\"}],returns:{type:\"xs:string*\",description:\"\"},errors:[]}],variables:[{name:\"util:collection-namespace\",type:\"item()*\",description:\"\"}]}}}),define(\"ace/lib/event_emitter\",[\"require\",\"exports\",\"module\"],function(e,t,n){var r={},i=function(){this.propagationStopped=!0},s=function(){this.defaultPrevented=!0};r._emit=r._dispatchEvent=function(e,t){this._eventRegistry||(this._eventRegistry={}),this._defaultHandlers||(this._defaultHandlers={});var n=this._eventRegistry[e]||[],r=this._defaultHandlers[e];if(!n.length&&!r)return;if(typeof t!=\"object\"||!t)t={};t.type||(t.type=e),t.stopPropagation||(t.stopPropagation=i),t.preventDefault||(t.preventDefault=s),n=n.slice();for(var o=0;o<n.length;o++){n[o](t,this);if(t.propagationStopped)break}if(r&&!t.defaultPrevented)return r(t,this)},r._signal=function(e,t){var n=(this._eventRegistry||{})[e];if(!n)return;n=n.slice();for(var r=0;r<n.length;r++)n[r](t,this)},r.once=function(e,t){var n=this;t&&this.addEventListener(e,function r(){n.removeEventListener(e,r),t.apply(null,arguments)})},r.setDefaultHandler=function(e,t){var n=this._defaultHandlers;n||(n=this._defaultHandlers={_disabled_:{}});if(n[e]){var r=n[e],i=n._disabled_[e];i||(n._disabled_[e]=i=[]),i.push(r);var s=i.indexOf(t);s!=-1&&i.splice(s,1)}n[e]=t},r.removeDefaultHandler=function(e,t){var n=this._defaultHandlers;if(!n)return;var r=n._disabled_[e];if(n[e]==t){var i=n[e];r&&this.setDefaultHandler(e,r.pop())}else if(r){var s=r.indexOf(t);s!=-1&&r.splice(s,1)}},r.on=r.addEventListener=function(e,t,n){this._eventRegistry=this._eventRegistry||{};var r=this._eventRegistry[e];return r||(r=this._eventRegistry[e]=[]),r.indexOf(t)==-1&&r[n?\"unshift\":\"push\"](t),t},r.off=r.removeListener=r.removeEventListener=function(e,t){this._eventRegistry=this._eventRegistry||{};var n=this._eventRegistry[e];if(!n)return;var r=n.indexOf(t);r!==-1&&n.splice(r,1)},r.removeAllListeners=function(e){this._eventRegistry&&(this._eventRegistry[e]=[])},t.EventEmitter=r})"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-core-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Widgets Core Client</name>\n  <description>Uberfire Widgets Core Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <!-- CDI Integration Modules -->\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/CoreEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.ext.widgets.core.client.resources.TreeNavigatorResources;\nimport org.uberfire.ext.widgets.core.client.resources.WizardResources;\n\n/**\n * Bootstrap widgets-core\n */\n@EntryPoint\npublic class CoreEntryPoint {\n\n    @PostConstruct\n    public void startApp() {\n        //Ensure CSS has been loaded\n        WizardResources.INSTANCE.css().ensureInjected();\n        TreeNavigatorResources.INSTANCE.css().ensureInjected();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUpload.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.util.URIUtil;\n\npublic class DefaultEditorFileUpload\n        extends DefaultEditorFileUploadBase {\n\n    private static final String DEFAULT_EDITOR = \"defaulteditor/download?path=\";\n    private static final String PATH_PARAMETER = \"path\";\n    private static final String UPDATE_PARAMETER = \"update\";\n\n    private Path path;\n    private Boolean isUpdate = false;\n\n    @Override\n    protected Map<String, String> getParameters() {\n        HashMap<String, String> parameters = new HashMap<String, String>();\n\n        parameters.put(PATH_PARAMETER,\n                       URIUtil.encodeQueryString(URIUtil.decode(path.toURI())));\n        parameters.put(UPDATE_PARAMETER,\n                       isUpdate.toString());\n\n        return parameters;\n    }\n\n    public void setPath(Path path) {\n        this.path = path;\n    }\n    \n    public void setIsUpdate(boolean isUpdate) {\n        this.isUpdate = isUpdate;\n    }\n\n    public void download() {\n\n        Window.open(getFileDownloadURL(),\n                    CoreConstants.INSTANCE.Downloading(),\n                    \"resizable=no,scrollbars=yes,status=no\");\n    }\n\n    private String getFileDownloadURL() {\n        return GWT.getModuleBaseURL() + DEFAULT_EDITOR + URIUtil.encodeQueryString(URIUtil.decode(path.toURI()));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUploadBase.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FormPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.uberfire.ext.widgets.common.client.common.FileUpload;\nimport org.uberfire.ext.widgets.common.client.common.FileUploadFormEncoder;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.mvp.Command;\n\npublic abstract class DefaultEditorFileUploadBase\n        extends Composite {\n\n    private static DefaultEditorFileUploadBaseBinder uiBinder = GWT.create(DefaultEditorFileUploadBaseBinder.class);\n    @UiField\n    Form form;\n    @UiField(provided = true)\n    FileUpload fileUpload;\n    private Consumer<String> successCallback;\n    private Consumer<String> errorCallback;\n    private FileUploadFormEncoder formEncoder = new FileUploadFormEncoder();\n\n    public DefaultEditorFileUploadBase() {\n        this(true);\n    }\n\n    public DefaultEditorFileUploadBase(boolean showUpload) {\n        fileUpload = createFileUpload(showUpload);\n\n        initWidget(uiBinder.createAndBindUi(this));\n\n        initForm();\n    }\n\n    static boolean isUploadSuccessful(AbstractForm.SubmitCompleteEvent submitEvent) {\n        return \"OK\".equalsIgnoreCase(submitEvent.getResults());\n    }\n\n    void initForm() {\n        form.setEncoding(FormPanel.ENCODING_MULTIPART);\n        form.setMethod(FormPanel.METHOD_POST);\n\n        formEncoder.addUtf8Charset(form);\n\n        // Validation is not performed in a SubmitHandler as it fails to be invoked with GWT-Bootstrap3. See:-\n        // - https://issues.jboss.org/browse/GUVNOR-2302 and\n        // - the underlying cause https://github.com/gwtbootstrap3/gwtbootstrap3/issues/375\n        // Validation is now performed prior to the form being submitted.\n\n        form.addSubmitCompleteHandler(event -> {\n            if (isUploadSuccessful(event)) {\n                executeCallback(successCallback,\n                                event.getResults());\n            } else {\n                executeCallback(errorCallback,\n                                event.getResults());\n            }\n        });\n    }\n\n    private FileUpload createFileUpload(boolean showUpload) {\n        return new FileUpload(new Command() {\n            @Override\n            public void execute() {\n                form.setAction(GWT.getModuleBaseURL() + \"defaulteditor/upload\" + createParametersForURL());\n                if (isValid()) {\n                    form.submit();\n                }\n            }\n        },\n                              showUpload);\n    }\n\n    //Package protected to support overriding for tests\n    boolean isValid() {\n        String fileName = fileUpload.getFilename();\n        if (isNullOrEmpty(fileName)) {\n            Window.alert(CoreConstants.INSTANCE.SelectFileToUpload());\n            executeCallback(errorCallback,\n                            \"\");\n            return false;\n        }\n        return true;\n    }\n\n    private boolean isNullOrEmpty(String fileName) {\n        return fileName == null || \"\".equals(fileName);\n    }\n\n    private String createParametersForURL() {\n        String parameters = \"?\";\n        Map<String, String> map = getParameters();\n        Iterator<String> iterator = map.keySet().iterator();\n        while (iterator.hasNext()) {\n            String parameter = iterator.next();\n            parameters += parameter + \"=\" + map.get(parameter);\n            if (iterator.hasNext()) {\n                parameters += \"&\";\n            }\n        }\n        return parameters;\n    }\n\n    protected abstract Map<String, String> getParameters();\n\n    public void upload(final Consumer<String> successCallback,\n                       final Consumer<String> errorCallback) {\n        this.successCallback = successCallback;\n        this.errorCallback = errorCallback;\n        fileUpload.upload();\n    }\n\n    public String getFormFileName() {\n        return fileUpload.getFilename();\n    }\n\n    private void executeCallback(final Consumer<String> callback,\n                                 final String result) {\n        if (callback == null) {\n            return;\n        }\n        callback.accept(result);\n    }\n\n    interface DefaultEditorFileUploadBaseBinder\n            extends\n            UiBinder<Widget, DefaultEditorFileUploadBase> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUploadBase.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:common=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n\n    <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n\n    <b:Container fluid=\"true\">\n        <b:Row>\n            <b:Form ui:field=\"form\">\n                <b:FieldSet>\n                    <b:FormGroup>\n                        <b:FormLabel text=\"{i18n.SelectFileToUpload}\"/>\n                        <common:FileUpload ui:field=\"fileUpload\" name=\"fileUpload\"/>\n                    </b:FormGroup>\n                </b:FieldSet>\n            </b:Form>\n        </b:Row>\n    </b:Container>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorNewFileUpload.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic class DefaultEditorNewFileUpload\n        extends DefaultEditorFileUploadBase {\n\n    private Path path;\n    private String fileName;\n\n    public DefaultEditorNewFileUpload() {\n        super(false);\n    }\n\n    @Override\n    protected Map<String, String> getParameters() {\n        HashMap<String, String> parameters = new HashMap<String, String>();\n\n        parameters.put(\"folder\",\n                       path.toURI());\n        parameters.put(\"fileName\",\n                       fileName);\n\n        return parameters;\n    }\n\n    public void setFolderPath(Path path) {\n        this.path = path;\n    }\n\n    public void setFileName(String fileName) {\n        this.fileName = fileName;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultFileEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.type.AnyResourceType;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\n\n@Dependent\n@WorkbenchEditor(identifier = \"DefaultFileEditor\", supportedTypes = {AnyResourceType.class}, priority = Integer.MIN_VALUE)\npublic class DefaultFileEditorPresenter {\n\n    @Inject\n    public DefaultFileEditorView view;\n    @Inject\n    private Caller<VFSService> vfsServices;\n    private Path path;\n\n    @OnStartup\n    public void onStartup(final ObservablePath path) {\n        this.path = path;\n        view.setPath(path);\n        view.setIsUpdate(true);\n    }\n\n    @OnClose\n    public void onClose() {\n        this.path = null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CoreConstants.INSTANCE.DefaultEditor() + \" [\" + path.getFileName() + \"]\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    interface View {\n\n        void setPath(Path path);\n        \n        void setIsUpdate(boolean isUpdate);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultFileEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.uberfire.backend.vfs.Path;\n\npublic class DefaultFileEditorView\n        extends Composite\n        implements DefaultFileEditorPresenter.View {\n\n    private static DefaultFileEditorViewBinder uiBinder = GWT.create(DefaultFileEditorViewBinder.class);\n    @UiField\n    DefaultEditorFileUpload fileUpload;\n    @UiField\n    Button downloadButton;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setPath(Path path) {\n        fileUpload.setPath(path);\n    }\n    \n    @Override\n    public void setIsUpdate(boolean isUpdate) {\n        fileUpload.setIsUpdate(isUpdate);\n    }\n    \n    @UiHandler(\"downloadButton\")\n    public void handleClick(ClickEvent event) {\n        fileUpload.download();\n    }\n\n    interface DefaultFileEditorViewBinder\n            extends\n            UiBinder<Container, DefaultFileEditorView> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultFileEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:defaulteditor=\"urn:import:org.uberfire.ext.widgets.core.client.editors.defaulteditor\">\n\n    <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n\n    <ui:style>\n        .topMargin {\n            margin-top: 15px;\n        }\n\n        .editor {\n            padding-left: 0px;\n            padding-right: 0px;\n        }\n    </ui:style>\n\n    <b:Container fluid=\"true\" addStyleNames='{style.topMargin}'>\n        <b:Row>\n            <b:Column size=\"MD_12\">\n                <defaulteditor:DefaultEditorFileUpload ui:field=\"fileUpload\" addStyleNames=\"{style.editor}\"/>\n            </b:Column>\n        </b:Row>\n        <b:Row>\n            <b:Column size=\"MD_12\">\n                <b:Button ui:field=\"downloadButton\" text=\"{i18n.Download}\"/>\n            </b:Column>\n        </b:Row>\n    </b:Container>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/CoreCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface CoreCss\n        extends\n        CssResource {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/CoreImages.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface CoreImages\n        extends\n        ClientBundle {\n\n    CoreImages INSTANCE = GWT.create(CoreImages.class);\n\n    @Source(\"images/open_folder.gif\")\n    ImageResource openedFolder();\n\n    @Source(\"images/package.gif\")\n    ImageResource packageIcon();\n\n    @Source(\"images/file.gif\")\n    ImageResource file();\n\n    @Source(\"images/backup_large.png\")\n    ImageResource backupLarge();\n\n    //A warning triangle\n    @Source(\"images/warning-large.png\")\n    ImageResource warningLarge();\n\n    @Source(\"images/tick.png\")\n    ImageResource tick();\n\n    @Source(\"images/BPM_FileIcons_text.png\")\n    ImageResource typeTextFile();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/CoreResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface CoreResources\n        extends\n        ClientBundle {\n\n    CoreResources INSTANCE = GWT.create(CoreResources.class);\n\n    CoreImages images();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/TreeNavigatorResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.CssResource;\n\n/**\n * Wizard resources\n */\npublic interface TreeNavigatorResources\n        extends\n        ClientBundle {\n\n    public static final TreeNavigatorResources INSTANCE = GWT.create(TreeNavigatorResources.class);\n\n    @Source(\"css/TreeNavigator.css\")\n    NavigatorStyle css();\n\n    public interface NavigatorStyle extends CssResource {\n\n        @ClassName(\"tree\")\n        String tree();\n\n        @ClassName(\"tree-folder\")\n        String treeFolder();\n\n        @ClassName(\"tree-folder-header\")\n        String treeFolderHeader();\n\n        @ClassName(\"tree-folder-name\")\n        String treeFolderName();\n\n        @ClassName(\"tree-folder-content\")\n        String treeFolderContent();\n\n        @ClassName(\"tree-item\")\n        String treeItem();\n\n        @ClassName(\"tree-item-name\")\n        String treeItemName();\n\n        @ClassName(\"tree-selected\")\n        String treeSelected();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/WizardCellListResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.cellview.client.CellList;\n\n/**\n * Overriding the default styling for CellLists\n */\npublic interface WizardCellListResources\n        extends\n        CellList.Resources {\n\n    WizardCellListResources INSTANCE = GWT.create(WizardCellListResources.class);\n\n    @Source(\"css/WizardsCellList.css\")\n    WizardCellListStyle cellListStyle();\n\n    public interface WizardCellListStyle\n            extends\n            CellList.Style {\n\n        String cellListEvenItem();\n\n        String cellListKeyboardSelectedItem();\n\n        String cellListOddItem();\n\n        String cellListSelectedItem();\n\n        String cellListWidget();\n\n        String cellListEmptyItem();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/WizardResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.CssResource;\n\n/**\n * Wizard resources\n */\npublic interface WizardResources\n        extends\n        ClientBundle {\n\n    WizardResources INSTANCE = GWT.create(WizardResources.class);\n\n    @Source(\"css/Wizards.css\")\n    WizardStyle css();\n\n    public interface WizardStyle\n            extends\n            CssResource {\n\n        String wizardDTableList();\n\n        String wizardDTableHeader();\n\n        String wizardDTableButtons();\n\n        String wizardDTableFields();\n\n        String wizardDTableMessageContainer();\n\n        String wizardDTableMessage();\n\n        String wizardDTableValidationError();\n\n        String wizardButtonbar();\n\n        String wizardPageTitleContainer();\n\n        String wizardPageTitleImageContainer();\n\n        String wizardPageTitleLabelContainer();\n\n        String wizardDTableFieldContainerValid();\n\n        String wizardDTableFieldContainerInvalid();\n\n        String wizardDTableSummaryContainer();\n\n        String wizardDTableCaption();\n\n        String scrollPanel();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * Core Widgets I18N constants\n */\npublic interface CoreConstants\n        extends\n        Messages {\n\n    CoreConstants INSTANCE = GWT.create(CoreConstants.class);\n\n    String multipleMatchingActivitiesFound();\n\n    String activityNotFound();\n\n    String cancel();\n\n    String Previous();\n\n    String Next();\n\n    String Finish();\n\n    String Delete();\n\n    String RepositoryViewUriLabel();\n\n    String RepositoryViewRootLabel();\n\n    String Downloading();\n\n    String SelectFileToUpload();\n\n    String UploadSuccess();\n\n    String UploadFail();\n\n    String Uploading();\n\n    String DefaultEditor();\n\n    String Download();\n\n    String FileExplorer();\n\n    String Navigator();\n\n    String EmptyEntry();\n\n    String MetaFileEditor();\n\n    String CantLoadOrganizationalUnits();\n\n    String SelectEntry();\n\n    String URLMandatory();\n\n    String InvalidUrlFormat();\n\n    String OrganizationalUnitMandatory();\n\n    String RepositoryNaneMandatory();\n\n    String RepositoryNameInvalid();\n\n    String DoYouAgree();\n\n    String RepoCloneSuccess();\n\n    String RepoAlreadyExists();\n\n    String RepoCloneFail();\n\n    String Cloning();\n\n    String IndexClonedRepositoryWarning();\n\n    String RepoInformation();\n\n    String IsRequired();\n\n    String RepoName();\n\n    String RepoNameHolder();\n\n    String OrganizationalUnit();\n\n    String GitUrl();\n\n    String GitUrlHolder();\n\n    String UserName();\n\n    String UserNameHolder();\n\n    String Password();\n\n    String PasswordHolder();\n\n    String Cancel();\n\n    String Clone();\n\n    String RepoCreationSuccess();\n\n    String RepoCreationFail();\n\n    String Create();\n\n    String RepositoryEditor();\n\n    String AvailableProtocols();\n\n    String Reverting();\n\n    String GeneralInformation();\n\n    String CommitHistory();\n\n    String LoadMore();\n\n    String TextEditor();\n\n    String ConfirmStateRevert();\n\n    String ActivityNotFound();\n\n    String CloneRepository();\n\n    String CreateRepository();\n\n    String Empty();\n\n    String RevertToThis();\n\n    String textResourceTypeDescription();\n\n    String Branches();\n\n    String Update();\n\n    String GroupId();\n\n    String ArtifactId();\n\n    String Version();\n\n    String GroupIdHolder();\n\n    String ArtifactIdHolder();\n\n    String VersionHolder();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/screens/iframe/IFrameScreenPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.screens.iframe;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@WorkbenchScreen(identifier = \"IFrameScreen\")\npublic class IFrameScreenPresenter {\n\n    @Inject\n    public IFrameScreenPresenter.View view;\n    private String title;\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        this.view.setURL(placeRequest.getParameter(\"url\",\n                                                   \"none\"));\n        this.title = placeRequest.getParameter(\"title\",\n                                               \"iframe\");\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    public interface View extends IsWidget {\n\n        void setURL(final String url);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/screens/iframe/IFrameScreenView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.screens.iframe;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Frame;\nimport com.google.gwt.user.client.ui.RequiresResize;\n\npublic class IFrameScreenView\n        extends Composite\n        implements IFrameScreenPresenter.View,\n                   RequiresResize {\n\n    private final Frame frame = new Frame();\n\n    public IFrameScreenView() {\n        initWidget(frame);\n    }\n\n    @Override\n    public void setURL(final String url) {\n        frame.setUrl(url);\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        frame.setPixelSize(width,\n                           height);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport java.util.function.Supplier;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class FSTreeItem extends TreeItem<FSTreeItem> {\n\n    private final FSType fstype;\n\n    FSTreeItem(final FSType type,\n               final String value,\n               final Supplier<FlowPanel> contentProvider) {\n        super(createType(type),\n              value,\n              value,\n              createIcon(type),\n              contentProvider);\n        this.fstype = checkNotNull(\"type\",\n                                   type);\n    }\n\n    public FSTreeItem(final FSType type,\n                      final String value) {\n        super(createType(type),\n              value,\n              value,\n              createIcon(type));\n        this.fstype = checkNotNull(\"type\",\n                                   type);\n    }\n\n    private static final Type createType(final FSType type) {\n        switch (type) {\n            case ITEM:\n                return Type.ITEM;\n            case FOLDER:\n                return Type.CONTAINER;\n        }\n        return Type.ROOT;\n    }\n\n    private static final Icon createIcon(final FSType type) {\n        IconType iconType = IconType.FOLDER;\n        switch (type) {\n            case ITEM:\n                iconType = IconType.FILE_O;\n                break;\n            case FOLDER:\n                iconType = IconType.FOLDER;\n                break;\n            case ROOT:\n                iconType = IconType.FOLDER;\n                break;\n        }\n        return new Icon(iconType);\n    }\n\n    public FSTreeItem addItem(final FSType type,\n                              final String value) {\n        final FSTreeItem treeItem = new FSTreeItem(type,\n                                                   value);\n        super.addItem(treeItem);\n        return treeItem;\n    }\n\n    public FSType getFSType() {\n        return this.fstype;\n    }\n\n    @Override\n    protected void onOpenState() {\n        super.onOpenState();\n        getIcon().setType(IconType.FOLDER_OPEN);\n    }\n\n    @Override\n    protected void onCloseState() {\n        super.onCloseState();\n        getIcon().setType(IconType.FOLDER);\n    }\n\n    private Icon getIcon() {\n        return (Icon) getIconWidget();\n    }\n\n    public enum FSType {\n        ROOT,\n        FOLDER,\n        ITEM,\n        LOADING\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/Tree.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport java.util.Iterator;\nimport java.util.function.Supplier;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.event.logical.shared.HasOpenHandlers;\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.uberfire.ext.widgets.core.client.resources.TreeNavigatorResources;\n\npublic class Tree<T extends TreeItem> extends Composite implements HasSelectionHandlers<T>,\n                                                                   HasOpenHandlers<T>,\n                                                                   HasCloseHandlers<T> {\n\n    private FlowPanel container;\n    private T curSelection = null;\n\n    public Tree() {\n        this(FlowPanel::new);\n    }\n\n    Tree(final Supplier<FlowPanel> containerProvider) {\n        container = containerProvider.get();\n        initWidget(container);\n        container.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().tree());\n    }\n\n    @Override\n    public HandlerRegistration addOpenHandler(final OpenHandler<T> handler) {\n        return addHandler(handler,\n                          OpenEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addCloseHandler(final CloseHandler<T> handler) {\n        return addHandler(handler,\n                          CloseEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<T> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    public void clear() {\n        container.clear();\n    }\n\n    public void setSelectedItem(final T item,\n                                final boolean fireEvents) {\n        onSelection(item,\n                    fireEvents);\n    }\n\n    public T getSelectedItem() {\n        return curSelection;\n    }\n\n    public void setSelectedItem(final T item) {\n        onSelection(item,\n                    true);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T addItem(final T item) {\n        container.add(item);\n        item.setTree(this);\n        return item;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public T getItemByUuid(String uuid) {\n        final T item[] = (T[]) new TreeItem[1];\n        getItems().forEach(i -> {\n            if (item[0] == null) {\n                item[0] = (T) i.getItemByUuid(uuid);\n            }\n        });\n        return item[0];\n    }\n\n    public T getItem(int index) {\n        T item = null;\n        Iterator<T> itemIter = getItems().iterator();\n        int idx = 0;\n        while (itemIter.hasNext()) {\n            T treeItem = itemIter.next();\n            if (idx == index) {\n                item = treeItem;\n                break;\n            }\n            idx++;\n        }\n        return item;\n    }\n\n    public void removeItem(final T item) {\n        container.remove(item);\n    }\n\n    public Iterable<T> getItems() {\n        return () -> new T.TreeItemIterator<T>(container);\n    }\n\n    public boolean isEmpty() {\n        return container.getWidgetCount() == 0;\n    }\n\n    void onSelection(final T item,\n                     final boolean fireEvents) {\n        if (curSelection != null) {\n            curSelection.setSelected(false);\n        }\n        curSelection = item;\n        if (curSelection != null) {\n            // Select the item and fire the selection event.\n            curSelection.setSelected(true);\n            if (fireEvents) {\n                SelectionEvent.fire(this,\n                                    curSelection);\n            }\n        }\n    }\n\n    void fireStateChanged(final T item,\n                          final T.State state) {\n        if (state.equals(T.State.OPEN)) {\n            OpenEvent.fire(this,\n                           item);\n        } else {\n            CloseEvent.fire(this,\n                            item);\n        }\n        onSelection(item,\n                    true);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/tree/TreeItem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport java.util.Iterator;\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.Anchor;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\nimport org.uberfire.ext.widgets.core.client.resources.TreeNavigatorResources;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class TreeItem<I extends TreeItem> extends Composite implements OuiaComponent {\n\n    private static final String OUIA_COMPONENT_TYPE = \"tree-item\";\n\n    private final Type type;\n    protected FlowPanel content;\n    private Tree<I> tree;\n    private Object userObject;\n    private I parentItem;\n    private State state;\n    private String label;\n    private String uuid;\n    private boolean isSelected = false;\n    private FlowPanel header;\n    private IsWidget icon;\n    private FlowPanel item;\n\n    public TreeItem(final Type type,\n                    final String value,\n                    final String label,\n                    final IsWidget icon) {\n        this(type,\n             value,\n             label,\n             icon,\n             FlowPanel::new);\n    }\n\n    TreeItem(final Type type,\n             final String value,\n             final String label,\n             final IsWidget icon,\n             final Supplier<FlowPanel> contentProvider\n    ) {\n        this.label = label;\n        this.uuid = value;\n        this.type = checkNotNull(\"type\",\n                                 type);\n\n        if (type.equals(Type.CONTAINER) || type.equals(Type.ROOT)) {\n            final FlowPanel folder = contentProvider.get();\n            folder.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeFolder());\n            folder.getElement().getStyle().setDisplay(Style.Display.BLOCK);\n            {\n                this.state = State.CLOSE;\n                this.header = GWT.create(FlowPanel.class);\n                this.icon = icon;\n                this.content = contentProvider.get();\n                final Anchor name = new Anchor();\n                {\n                    header.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeFolderHeader());\n                    folder.add(header);\n                    {\n                        header.add(icon);\n                    }\n                    final FlowPanel folderName = new FlowPanel();\n                    {\n                        folderName.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeFolderName());\n                        header.add(folderName);\n                        {\n                            name.setText(label);\n                            name.setTitle(value);\n                            folderName.add(name);\n                        }\n                    }\n                    header.addDomHandler(new ClickHandler() {\n                                             @Override\n                                             public void onClick(ClickEvent event) {\n                                                 if (!isSelected) {\n                                                     updateSelected();\n                                                 }\n                                                 if (state.equals(State.CLOSE)) {\n                                                     setState(State.OPEN,\n                                                              true);\n                                                 } else {\n                                                     setState(State.CLOSE,\n                                                              true);\n                                                 }\n                                             }\n                                         },\n                                         ClickEvent.getType());\n                }\n                {\n                    content.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeFolderContent());\n                    content.getElement().getStyle().setDisplay(Style.Display.NONE);\n                    folder.add(content);\n                }\n                initWidget(folder);\n            }\n        } else if (type.equals(Type.ITEM)) {\n            this.state = State.NONE;\n            this.item = contentProvider.get();\n            item.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeItem());\n            {\n                this.icon = icon;\n                final FlowPanel itemName = new FlowPanel();\n                final Anchor name = new Anchor();\n                {\n                    item.add(icon);\n                }\n                {\n                    itemName.setStylePrimaryName(TreeNavigatorResources.INSTANCE.css().treeItemName());\n                    item.add(itemName);\n                    {\n                        name.setText(label);\n                        name.setTitle(value);\n\n                        itemName.add(name);\n                    }\n                }\n                item.addDomHandler(new ClickHandler() {\n                                       @Override\n                                       public void onClick(ClickEvent event) {\n                                           tree.onSelection((I) TreeItem.this,\n                                                            true);\n                                       }\n                                   },\n                                   ClickEvent.getType());\n            }\n            initWidget(item);\n        } else {\n            final FlowPanel loader = new FlowPanel();\n            {\n                final SimplePanel loading = new SimplePanel();\n                loading.getElement().setInnerText(value);\n                loader.add(loading);\n            }\n            initWidget(loader);\n        }\n        initOuiaComponentAttributes();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public I getItemByUuid(final String uuid) {\n        if (getUuid().equals(uuid)) {\n            return (I) this;\n        }\n        final I[] selectedItem = (I[]) new TreeItem[1];\n        getChildren().forEach(c -> {\n            if (selectedItem[0] == null) {\n                selectedItem[0] = (I) c.getItemByUuid(uuid);\n            }\n        });\n        return selectedItem[0];\n    }\n\n    private void updateSelected() {\n        tree.onSelection((I) this,\n                         true);\n    }\n\n    public State getState() {\n        return state;\n    }\n\n    public void setState(final State state) {\n        setState(state,\n                 false,\n                 true);\n    }\n\n    public void setState(final State state,\n                         boolean fireEvents) {\n        setState(state,\n                 false,\n                 fireEvents);\n    }\n\n    public void setState(final State state,\n                         boolean propagateParent,\n                         boolean fireEvents) {\n        if (notFolder()) {\n            return;\n        }\n        if (!this.state.equals(state)) {\n            this.state = state;\n            updateState(state);\n            if (fireEvents && tree != null) {\n                tree.fireStateChanged((I) this,\n                                      state);\n            }\n        }\n        if (propagateParent && parentItem != null) {\n            parentItem.setState(state,\n                                true,\n                                false);\n        }\n    }\n\n    private boolean notFolder() {\n        return !type.equals(Type.CONTAINER);\n    }\n\n    public Object getUserObject() {\n        return userObject;\n    }\n\n    public void setUserObject(final Object userObject) {\n        this.userObject = userObject;\n    }\n\n    public Type getType() {\n        return this.type;\n    }\n\n    public I addItem(final I item) {\n        return addChild(item, t -> content.add(t));\n    }\n\n    public I insertItem(final I item, final int index) {\n        return addChild(item, t -> content.insert(t, index));\n    }\n\n    public I addItem(final Type type,\n                     final String value,\n                     final String label,\n                     final IsWidget icon) {\n        return addChild(type,\n                        value,\n                        label,\n                        icon,\n                        this::addItem);\n    }\n\n    public I insertItem(final Type type,\n                        final String value,\n                        final String label,\n                        final IsWidget icon,\n                        final int index) {\n        return addChild(type,\n                        value,\n                        label,\n                        icon,\n                        t -> insertItem(t, index));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private I addChild(final I item,\n                       final Consumer<I> addItemFunction) {\n        checkContainerType();\n        addItemFunction.accept(item);\n        item.setTree(tree);\n        item.setParentItem(this);\n        return item;\n    }\n\n    private void checkContainerType() {\n        if (null == content) {\n            throw new IllegalStateException(\"This tree item instance is not a container.\");\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private I addChild(final Type type,\n                       final String value,\n                       final String label,\n                       final IsWidget icon,\n                       final Consumer<I> addItemFunction) {\n        final I child = makeChild(type,\n                                  value,\n                                  label,\n                                  icon);\n        addItemFunction.accept(child);\n        return child;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private I makeChild(final Type type,\n                        final String value,\n                        final String label,\n                        final IsWidget icon) {\n        return (I) new TreeItem(type,\n                                value,\n                                label,\n                                icon);\n    }\n\n    public void removeItems() {\n        checkContainerType();\n        content.clear();\n    }\n\n    public int getChildCount() {\n        return null != content ? content.getWidgetCount() : 0;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public I getChild(final int i) {\n        checkContainerType();\n        if (i + 1 > content.getWidgetCount()) {\n            return null;\n        }\n        return (I) content.getWidget(i);\n    }\n\n    public Iterable<I> getChildren() {\n        return () -> new TreeItemIterator<I>(content);\n    }\n\n    void setTree(final Tree<I> tree) {\n        this.tree = tree;\n    }\n\n    void updateState(final State state) {\n        // If the tree hasn't been set, there is no visual state to update.\n        // If the tree is not attached, then update will be called on attach.\n        if (tree == null) {\n            return;\n        }\n        switch (state) {\n            case OPEN:\n                onOpenState();\n                break;\n            case CLOSE:\n                onCloseState();\n        }\n    }\n\n    protected void onOpenState() {\n        content.getElement().getStyle().setDisplay(Style.Display.BLOCK);\n    }\n\n    protected void onCloseState() {\n        content.getElement().getStyle().setDisplay(Style.Display.NONE);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public void remove() {\n        if (parentItem != null) {\n            // If this item has a parent, remove self from it.\n            parentItem.removeItem(this);\n        } else if (tree != null) {\n            // If the item has no parent, but is in the Tree, it must be a top-level\n            // element.\n            tree.removeItem((I) this);\n        }\n    }\n\n    public void removeItem(final I treeItem) {\n        checkContainerType();\n        content.remove(treeItem);\n    }\n\n    public String getText() {\n        return getElement().getInnerText();\n    }\n\n    public String getUuid() {\n        return uuid;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public boolean isSelected() {\n        return isSelected;\n    }\n\n    void setSelected(boolean selected) {\n        isSelected = selected;\n        if (selected) {\n            if (header != null) {\n                header.addStyleName(TreeNavigatorResources.INSTANCE.css().treeSelected());\n            } else {\n                item.addStyleName(TreeNavigatorResources.INSTANCE.css().treeSelected());\n            }\n        } else {\n            if (header != null) {\n                header.removeStyleName(TreeNavigatorResources.INSTANCE.css().treeSelected());\n            } else {\n                item.removeStyleName(TreeNavigatorResources.INSTANCE.css().treeSelected());\n            }\n        }\n    }\n\n    public TreeItem getParentItem() {\n        return parentItem;\n    }\n\n    void setParentItem(final I parent) {\n        this.parentItem = parent;\n    }\n\n    public boolean isEmpty() {\n        return null == content || content.getWidgetCount() == 0;\n    }\n\n    IsWidget getIconWidget() {\n        return icon;\n    }\n\n    FlowPanel getContent() {\n        return content;\n    }\n\n    @Override\n    public OuiaComponentTypeAttribute ouiaComponentType() {\n        return new OuiaComponentTypeAttribute(OUIA_COMPONENT_TYPE);\n    }\n\n    @Override\n    public OuiaComponentIdAttribute ouiaComponentId() {\n        return new OuiaComponentIdAttribute(OUIA_COMPONENT_TYPE + \"-\" + label);\n    }\n\n    @Override\n    public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n        return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(), ouiaAttribute.getValue());\n    }\n\n    @Override\n    public boolean equals(final Object other) {\n        if (this == other) {\n            return true;\n        }\n        if (!(other instanceof TreeItem)) {\n            return false;\n        }\n        TreeItem that = (TreeItem) other;\n        return getUuid().equals(that.getUuid());\n    }\n\n    @Override\n    public int hashCode() {\n        return uuid.hashCode();\n    }\n\n    public enum Type {\n        ROOT,\n        CONTAINER,\n        ITEM,\n    }\n\n    public enum State {\n        NONE,\n        OPEN,\n        CLOSE\n    }\n\n    protected static class TreeItemIterator<T> implements Iterator<T> {\n\n        private final ComplexPanel container;\n        private int index = 0;\n\n        TreeItemIterator(ComplexPanel container) {\n            this.container = container;\n        }\n\n        @Override\n        public boolean hasNext() {\n            if (container == null) {\n                return false;\n            }\n            return index < container.getWidgetCount();\n        }\n\n        @Override\n        @SuppressWarnings(\"unchecked\")\n        public T next() {\n            return (T) container.getWidget(index++);\n        }\n\n        @Override\n        public void remove() {\n            throw new UnsupportedOperationException();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/AbstractWizard.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.callbacks.Callback;\n\n/**\n * The generic \"Wizard\" container, providing a left-hand side list of Page\n * titles, buttons to navigate the Wizard pages and a mechanism to display\n * different pages of the Wizard.\n */\npublic abstract class AbstractWizard implements\n                                     Wizard {\n\n    @Inject\n    //The generic view\n    protected WizardView view;\n    protected boolean isStarted = false;\n\n    @PostConstruct\n    public void setup() {\n        view.init(this);\n    }\n\n    //Update the status of each belonging to this Wizard\n    public void onStatusChange(final @Observes WizardPageStatusChangeEvent event) {\n        //Ignore events until the Wizard has been started\n        if (!isStarted) {\n            return;\n        }\n        //Ensure event belongs to this Wizard\n        final List<WizardPage> wps = getPages();\n        if (!wps.contains(event.getPage())) {\n            return;\n        }\n\n        checkPagesState();\n    }\n\n    protected void checkPagesState() {\n        final List<WizardPage> wps = getPages();\n        for (WizardPage wp : wps) {\n            final int index = wps.indexOf(wp);\n            wp.isComplete(new Callback<Boolean>() {\n                @Override\n                public void callback(final Boolean result) {\n                    view.setPageCompletionState(index,\n                                                Boolean.TRUE.equals(result));\n                }\n            });\n        }\n\n        //Update the status of this Wizard\n        isComplete(new Callback<Boolean>() {\n            @Override\n            public void callback(final Boolean result) {\n                view.setCompletionStatus(Boolean.TRUE.equals(result));\n            }\n        });\n    }\n\n    public void onPageSelected(final @Observes WizardPageSelectedEvent event) {\n        //Ignore events until the Wizard has been started\n        if (!isStarted) {\n            return;\n        }\n        final WizardPage page = event.getSelectedPage();\n        final int index = getPages().indexOf(page);\n        view.selectPage(index);\n    }\n\n    @Override\n    public void start() {\n        //Go, Go gadget Wizard!\n        isStarted = true;\n        view.setTitle(getTitle());\n        view.setPreferredHeight(getPreferredHeight());\n        view.setPreferredWidth(getPreferredWidth());\n        view.setPageTitles(getPages());\n\n        //Ensure Wizard's generic Cancel/Finish buttons are set correctly\n        checkPagesState();\n\n        view.selectPage(0);\n        view.show();\n    }\n\n    @Override\n    public void pageSelected(final int pageNumber) {\n        final Widget w = getPageWidget(pageNumber);\n        view.setBodyWidget(w);\n    }\n\n    @Override\n    public void close() {\n        view.hide();\n    }\n\n    @Override\n    public void complete() {\n        view.hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/Wizard.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.callbacks.Callback;\n\n/**\n * Things a Wizard needs to implement\n */\npublic interface Wizard {\n\n    /**\n     * Start the Wizard\n     */\n    void start();\n\n    /**\n     * Provide a list of pages\n     * @return\n     */\n    List<WizardPage> getPages();\n\n    /**\n     * Return the widget for a particular page\n     * @param pageNumber The index of of the page\n     * @return\n     */\n    Widget getPageWidget(int pageNumber);\n\n    /**\n     * A page has been selected from the UI\n     * @param pageNumber\n     */\n    void pageSelected(final int pageNumber);\n\n    /**\n     * Provide a title\n     * @return\n     */\n    String getTitle();\n\n    /**\n     * The preferred height of the page\n     * @return\n     */\n    int getPreferredHeight();\n\n    /**\n     * The preferred width of the page\n     * @return\n     */\n    int getPreferredWidth();\n\n    /**\n     * Is the Wizard complete; i.e. has all the necessary information for all\n     * pages in the Wizard been captured. What constitutes necessary data is up to\n     * the Wizard implementation, but a login page might consider the User ID and\n     * Password as necessary.\n     * @param callback True if the page is complete\n     */\n    void isComplete(Callback<Boolean> callback);\n\n    /**\n     * The Wizard has been completed\n     */\n    void complete();\n\n    /**\n     * The Wizard has been closed\n     */\n    void close();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPage.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.callbacks.Callback;\n\n/**\n * A page for a Wizard\n */\npublic interface WizardPage\n        extends\n        IsWidget {\n\n    /**\n     * Page title\n     * @return\n     */\n    String getTitle();\n\n    /**\n     * Is the page; i.e. has all the necessary information been captured. What\n     * constitutes necessary data is up to the Wizard implementation, but a login\n     * page might consider the User ID and Password as necessary.\n     * @param callback True if the page is complete\n     */\n    void isComplete(Callback<Boolean> callback);\n\n    /**\n     * Initialise the page with things that don't change between page visits\n     */\n    void initialise();\n\n    /**\n     * Prepare the page before it is displayed with things that can change\n     * between page visits\n     */\n    void prepareView();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPageSelectedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\n/**\n * An event representing the selection of a page within a Wizard\n */\npublic class WizardPageSelectedEvent {\n\n    private final WizardPage selectedPage;\n\n    public WizardPageSelectedEvent(final WizardPage selectedPage) {\n        this.selectedPage = selectedPage;\n    }\n\n    public WizardPage getSelectedPage() {\n        return selectedPage;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPageStatusChangeEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\n/**\n * An event representing the change in status (i.e. completed, not-completed) of a page within a Wizard.\n */\npublic class WizardPageStatusChangeEvent {\n\n    private final WizardPage page;\n\n    public WizardPageStatusChangeEvent(final WizardPage page) {\n        this.page = page;\n    }\n\n    public WizardPage getPage() {\n        return page;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPageTitle.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.mvp.Command;\n\n/**\n * A widget containing the page title of a Wizard page, along with an indicator\n * (a tick) that the page has been completed and whether it is the currently\n * displayed page (title is made bold).\n */\n@Dependent\npublic class WizardPageTitle extends Composite {\n\n    private static WizardPageTitleViewBinder uiBinder = GWT.create(WizardPageTitleViewBinder.class);\n    @UiField\n    protected AnchorListItem container;\n    private final Command isCompleteCommand = new Command() {\n        @Override\n        public void execute() {\n            setComplete(true);\n        }\n    };\n\n    private final Command isIncompleteCommand = new Command() {\n        @Override\n        public void execute() {\n            setComplete(false);\n        }\n    };\n    @Inject\n    private Event<WizardPageSelectedEvent> selectPageEvent;\n\n    public WizardPageTitle() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setContent(final WizardPage page) {\n        container.setText(page.getTitle());\n        page.isComplete(new Callback<Boolean>() {\n            @Override\n            public void callback(final Boolean result) {\n                setComplete(Boolean.TRUE.equals(result));\n            }\n        });\n\n        container.addDomHandler(new ClickHandler() {\n\n                                    public void onClick(final ClickEvent event) {\n                                        selectPageEvent.fire(new WizardPageSelectedEvent(page));\n                                    }\n                                },\n                                ClickEvent.getType());\n    }\n\n    /**\n     * Is the page complete\n     * @param isComplete\n     */\n    public void setComplete(final boolean isComplete) {\n        container.setIcon(isComplete ? IconType.CHECK_SQUARE_O : IconType.SQUARE_O);\n    }\n\n    /**\n     * Is the page the currently displayed page. Note WizardPageTitles are\n     * unaware of other WizardPageTitles and hence a mediator class needs to\n     * control the setting of the \"current page\" and de-selecting other previous\n     * \"current pages\".\n     * @param isSelected\n     */\n    public void setPageSelected(final boolean isSelected) {\n        container.setActive(isSelected);\n    }\n\n    interface WizardPageTitleViewBinder\n            extends\n            UiBinder<Widget, WizardPageTitle> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPageTitle.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field='images' type='org.uberfire.ext.widgets.core.client.resources.CoreImages'/>\n  <ui:with field=\"res\" type=\"org.uberfire.ext.widgets.core.client.resources.WizardResources\" />\n\n  <b:AnchorListItem ui:field=\"container\" iconFixedWidth=\"true\" icon=\"SQUARE_O\" />\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A Modal Footer used by the Wizard\n */\npublic class WizardPopupFooter extends ModalFooter {\n\n    private static WizardPopupFooterBinder uiBinder = GWT.create(WizardPopupFooterBinder.class);\n\n    private final Command cmdPreviousButton;\n    private final Command cmdNextButton;\n    private final Command cmdCancelButton;\n    private final Command cmdFinishButton;\n    @UiField\n    Button btnPrevious;\n    @UiField\n    Button btnNext;\n    @UiField\n    Button btnCancel;\n    @UiField\n    Button btnFinish;\n\n    public WizardPopupFooter(final Command cmdPreviousButton,\n                             final Command cmdNextButton,\n                             final Command cmdCancelButton,\n                             final Command cmdFinishButton) {\n        this.cmdPreviousButton = PortablePreconditions.checkNotNull(\"cmdPreviousButton\",\n                                                                    cmdPreviousButton);\n        this.cmdNextButton = PortablePreconditions.checkNotNull(\"cmdNextButton\",\n                                                                cmdNextButton);\n        this.cmdCancelButton = PortablePreconditions.checkNotNull(\"cmdCancelButton\",\n                                                                  cmdCancelButton);\n        this.cmdFinishButton = PortablePreconditions.checkNotNull(\"cmdFinishButton\",\n                                                                  cmdFinishButton);\n        add(uiBinder.createAndBindUi(this));\n    }\n\n    public void enablePreviousButton(final boolean enabled) {\n        btnPrevious.setEnabled(enabled);\n    }\n\n    public void enableNextButton(final boolean enabled) {\n        btnNext.setEnabled(enabled);\n    }\n\n    public void enableFinishButton(final boolean enabled) {\n        btnFinish.setEnabled(enabled);\n        if (enabled) {\n            btnFinish.setType(ButtonType.PRIMARY);\n        } else {\n            btnFinish.setType(ButtonType.DEFAULT);\n        }\n    }\n\n    public void setPreviousButtonFocus(final boolean focused) {\n        btnPrevious.setFocus(focused);\n    }\n\n    public void setNextButtonFocus(final boolean focused) {\n        btnNext.setFocus(focused);\n    }\n\n    @UiHandler(\"btnPrevious\")\n    public void onPreviousButtonClick(final ClickEvent e) {\n        cmdPreviousButton.execute();\n    }\n\n    @UiHandler(\"btnNext\")\n    public void onNextButtonClick(final ClickEvent e) {\n        cmdNextButton.execute();\n    }\n\n    @UiHandler(\"btnCancel\")\n    public void onCancelButtonClick(final ClickEvent e) {\n        cmdCancelButton.execute();\n    }\n\n    @UiHandler(\"btnFinish\")\n    public void onFinishButtonClick(final ClickEvent e) {\n        cmdFinishButton.execute();\n    }\n\n    interface WizardPopupFooterBinder\n            extends\n            UiBinder<Widget, WizardPopupFooter> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardPopupFooter.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'>\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n\n  <b:ModalFooter>\n    <b:Button ui:field=\"btnPrevious\" icon=\"ANGLE_LEFT\" iconPosition=\"LEFT\" text=\"{i18n.Previous}\" />\n    <b:Button ui:field=\"btnNext\" icon=\"ANGLE_RIGHT\" iconPosition=\"RIGHT\" text=\"{i18n.Next}\" />\n    <b:Button ui:field=\"btnCancel\" text=\"{i18n.cancel}\" />\n    <b:Button ui:field=\"btnFinish\" icon=\"CHECK\" type=\"PRIMARY\" text=\"{i18n.Finish}\" />\n  </b:ModalFooter>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\n\n/**\n * View and Presenter definitions for the generic Wizard\n */\npublic interface WizardView\n        extends\n        UberView<AbstractWizard> {\n\n    /**\n     * Show the Wizard\n     */\n    void show();\n\n    /**\n     * The title for the Wizard\n     * @param title\n     */\n    void setTitle(final String title);\n\n    /**\n     * The individual page titles\n     * @param pages\n     */\n    void setPageTitles(final List<WizardPage> pages);\n\n    /**\n     * Select a page\n     * @param page\n     */\n    void selectPage(final int page);\n\n    /**\n     * Set the Widget to display in the body panel of the generic Wizard\n     * @param w\n     */\n    void setBodyWidget(final Widget w);\n\n    /**\n     * Set the body panel preferred height\n     * @param height\n     */\n    void setPreferredHeight(final int height);\n\n    /**\n     * Set the body panel preferred width\n     * @param width\n     */\n    void setPreferredWidth(final int width);\n\n    /**\n     * The state (completed, not completed) of a page has changed.\n     * @param pageIndex\n     * @param isComplete\n     */\n    void setPageCompletionState(final int pageIndex,\n                                final boolean isComplete);\n\n    /**\n     * The state (completed, not completed) of the whole Wizard has changed\n     * @param isComplete\n     */\n    void setCompletionStatus(final boolean isComplete);\n\n    /**\n     * Hide the Wizard\n     */\n    void hide();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.NavPills;\nimport org.gwtbootstrap3.client.ui.base.modal.ModalDialog;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\n\n/**\n * The generic Wizard view implementation\n */\n@Dependent\npublic class WizardViewImpl extends BaseModal\n        implements\n        WizardView {\n\n    private static WizardActivityViewImplBinder uiBinder = GWT.create(WizardActivityViewImplBinder.class);\n    @UiField\n    protected NavPills sideBar;\n\n    @UiField\n    protected Column body;\n\n    protected WizardPopupFooter footer;\n    @Inject\n    protected SyncBeanManager iocBeanManager;\n    protected List<WizardPageTitle> pageTitleWidgets = new ArrayList<>();\n    private int pageNumber;\n    private int pageNumberTotal;\n    private AbstractWizard presenter;\n\n    public WizardViewImpl() {\n        footer = new WizardPopupFooter(\n                new Command() {\n                    @Override\n                    public void execute() {\n                        if (pageNumber == 0) {\n                            return;\n                        }\n                        selectPage(pageNumber - 1);\n                        footer.setPreviousButtonFocus(false);\n                    }\n                },\n                new Command() {\n                    @Override\n                    public void execute() {\n                        if (pageNumber == pageNumberTotal - 1) {\n                            return;\n                        }\n                        selectPage(pageNumber + 1);\n                        footer.setNextButtonFocus(false);\n                    }\n                },\n                new Command() {\n                    @Override\n                    public void execute() {\n                        presenter.close();\n                    }\n                },\n                new Command() {\n                    @Override\n                    public void execute() {\n                        presenter.complete();\n                    }\n                }\n        );\n\n        setBody(uiBinder.createAndBindUi(WizardViewImpl.this));\n\n        add(footer);\n    }\n\n    @Override\n    protected void onUnload() {\n        parentOnUnload();\n        getPresenter().close();\n    }\n\n    void parentOnUnload() {\n        super.onUnload();\n    }\n\n    AbstractWizard getPresenter() {\n        return presenter;\n    }\n\n    @Override\n    public void init(final AbstractWizard presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setPageTitles(final List<WizardPage> pages) {\n        //Clear existing titles\n        releaseWizardPageTitles();\n        sideBar.clear();\n\n        //Add new titles for pages\n        this.pageNumberTotal = pages.size();\n        for (WizardPage page : pages) {\n            final WizardPageTitle wpt = makeWizardPageTitle(page);\n            pageTitleWidgets.add(wpt);\n            sideBar.add(wpt);\n        }\n    }\n\n    private void releaseWizardPageTitles() {\n        for (WizardPageTitle wpt : pageTitleWidgets) {\n            iocBeanManager.destroyBean(wpt);\n        }\n        pageTitleWidgets.clear();\n    }\n\n    protected WizardPageTitle makeWizardPageTitle(final WizardPage page) {\n        final SyncBeanDef<WizardPageTitle> beanDefinition = iocBeanManager.lookupBean(WizardPageTitle.class);\n        final WizardPageTitle bean = beanDefinition.getInstance();\n        bean.setContent(page);\n        return bean;\n    }\n\n    @Override\n    public void selectPage(final int pageNumber) {\n        if (pageNumber < 0 || pageNumber > pageNumberTotal - 1) {\n            return;\n        }\n        this.pageNumber = pageNumber;\n        for (int i = 0; i < this.pageTitleWidgets.size(); i++) {\n            final WizardPageTitle wpt = this.pageTitleWidgets.get(i);\n            wpt.setPageSelected(i == pageNumber);\n        }\n        footer.enableNextButton(pageNumber < pageNumberTotal - 1);\n        footer.enablePreviousButton(pageNumber > 0);\n        presenter.pageSelected(pageNumber);\n    }\n\n    @Override\n    public void setBodyWidget(final Widget w) {\n        body.clear();\n        body.add(w);\n    }\n\n    @Override\n    public void setPreferredHeight(final int height) {\n        if (getWidgetCount() == 1 && getWidget(0) instanceof ModalDialog) {\n            this.getWidget(0).setHeight(height + \"px\");\n        }\n    }\n\n    @Override\n    public void setPreferredWidth(final int width) {\n        setWidth(width + \"px\");\n    }\n\n    @Override\n    public void setPageCompletionState(final int pageIndex,\n                                       final boolean isComplete) {\n        final WizardPageTitle wpt = this.pageTitleWidgets.get(pageIndex);\n        wpt.setComplete(isComplete);\n    }\n\n    @Override\n    public void setCompletionStatus(final boolean isComplete) {\n        footer.enableFinishButton(isComplete);\n    }\n\n    @Override\n    public void show() {\n        super.show();\n    }\n\n    @Override\n    public void hide() {\n        super.hide();\n        releaseWizardPageTitles();\n    }\n\n    interface WizardActivityViewImplBinder\n            extends\n            UiBinder<Widget, WizardViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/wizards/WizardViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n    <ui:with field=\"res\" type=\"org.uberfire.ext.widgets.core.client.resources.WizardResources\"/>\n\n    <b:Container fluid=\"true\">\n        <b:Row>\n            <b:Column size=\"MD_3\">\n                <b:NavPills ui:field=\"sideBar\" stacked=\"true\"/>\n            </b:Column>\n            <b:Column size=\"MD_9\" ui:field=\"body\" />\n        </b:Row>\n    </b:Container>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/workbench/widgets/popups/activities/notfound/ActivityNotFoundPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.workbench.widgets.popups.activities.notfound;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Popup presenter for when an Activity cannot be found\n */\n@ApplicationScoped\n@WorkbenchPopup(identifier = \"workbench.activity.notfound\")\npublic class ActivityNotFoundPresenter {\n\n    private ActivityNotFoundView view;\n\n    private PlaceManager placeManager;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CoreConstants.INSTANCE.ActivityNotFound();\n    }\n\n    @Inject\n    public ActivityNotFoundPresenter(final ActivityNotFoundView view, final PlaceManager placeManager) {\n        this.view = view;\n        this.placeManager = placeManager;\n    }\n\n    private PlaceRequest place;\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    @OnClose\n    public void onClose() {\n        final String identifier = place.getParameter(\"requestedPlaceIdentifier\",\n                                                     null);\n        if (identifier != null) {\n            placeManager.forceClosePlace(identifier);\n        }\n    }\n\n    @WorkbenchPartView\n    public UberView<ActivityNotFoundPresenter> getView() {\n        return view;\n    }\n\n    public interface View extends UberView<ActivityNotFoundPresenter> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/workbench/widgets/popups/activities/notfound/ActivityNotFoundView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.core.client.workbench.widgets.popups.activities.notfound;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * View for when an Activity cannot be found\n */\npublic class ActivityNotFoundView extends SimplePanel\n        implements\n        ActivityNotFoundPresenter.View {\n\n    private ActivityNotFoundPresenter presenter;\n\n    private static ActivityNotFoundViewBinder uiBinder = GWT.create(ActivityNotFoundViewBinder.class);\n\n    @PostConstruct\n    public void init() {\n        setWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final ActivityNotFoundPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    interface ActivityNotFoundViewBinder\n            extends\n            UiBinder<Widget, ActivityNotFoundView> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/java/org/uberfire/ext/widgets/core/client/workbench/widgets/popups/activities/notfound/ActivityNotFoundView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n             \n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\" />\n  <ui:with field=\"images\" type=\"org.uberfire.ext.widgets.core.client.resources.CoreImages\" />\n\n  <g:HorizontalPanel>\n    <g:Image resource=\"{images.warningLarge}\"/>\n    <g:Label text=\"{i18n.activityNotFound}\"/>\n  </g:HorizontalPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.widgets.core.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/UberfireWidgetsCore.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireAceEditor\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/css/TreeNavigator.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.tree {\n    color: #484848;\n}\n\n.tree a {\n    color: inherit;\n    text-decoration: none;\n}\n\n.tree .tree-folder {\n    width: 100%;\n    min-height: 20px;\n    margin-top: 1px;\n    cursor: pointer;\n}\n\n.tree .tree-folder .tree-folder-header {\n    position: relative;\n    display: inline-flex;\n    height: 20px;\n    width: inherit;\n    white-space: nowrap;\n    border-bottom: 1px solid transparent;\n    border-top: 1px solid transparent;\n}\n\n.tree .tree-folder .tree-folder-header i {\n    position: relative;\n    top: 5px;\n    left: 5px;\n    float: left;\n}\n\n.tree .tree-folder .tree-folder-header .tree-folder-name {\n    padding-left: 12px;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    white-space: nowrap;\n}\n\n.tree .tree-folder .tree-folder-content {\n    margin-left: 23px;\n}\n\n.tree .tree-item {\n    display: inline-flex;\n    position: relative;\n    width: 100%;\n    height: 20px;\n    margin: 1px;\n    cursor: pointer;\n    white-space: nowrap;\n    border-bottom: 1px solid transparent;\n    border-top: 1px solid transparent;\n}\n\n.tree .tree-item:hover,\n.tree .tree-folder-header:hover {\n    background-color: #d4edfa;\n    border-color: #b3d3e7;\n}\n\n.tree .tree-item .tree-item-name {\n    position: relative;\n    left: 10px;\n    z-index: 1 !important;\n    display: inline-flex;\n}\n\n.tree .tree-item i {\n    position: relative;\n    padding-top: 2px;\n    padding-left: 5px;\n}\n\n.tree .tree-selected,\n.tree .tree-selected:hover,\n.tree .tree-selected a {\n    background-color: #0099d3 !important;\n    border-color: #0076b7 !important;\n    color: #FFFFFF !important;\n}\n\n.tree .tree-item canvas {\n    margin-top: 2px;\n    margin-left: 2px;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/css/Wizards.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.wizardDTableList {\n    border-color: rgb(200, 200, 200);\n    border-top-style: solid;\n    border-left-style: solid;\n    border-right-style: solid;\n    border-bottom-style: solid;\n    border-width: 1px;\n    margin: 2px 10px 10px 10px;\n    padding: 5px;\n}\n\n.wizardDTableHeader {\n    font-weight: bold;\n    background-color: rgb(220, 220, 220);\n    border-color: rgb(200, 200, 200);\n    border-top-style: solid;\n    border-left-style: solid;\n    border-right-style: solid;\n    border-bottom-style: solid;\n    border-width: 1px;\n    margin: 10px 10px 0px 10px;\n    padding: 2px 5px 2px 5px;\n}\n\n.wizardDTableButtons {\n    margin-top: 100px;\n}\n\n.wizardDTableButtons td {\n    margin-bottom: 10px;\n    width: 48px;\n    height: 32px;\n    text-align: center;\n}\n\n.wizardDTableFields {\n    margin-left: 3px;\n    margin-right: 3px;\n}\n\n.wizardDTableMessageContainer {\n    background-color: red;\n    margin-top: 10px;\n    padding: 5px;\n    width: 100%;\n}\n\n.wizardDTableMessage {\n    margin-left: 10px;\n    margin-top: 6px;\n}\n\n.wizardDTableValidationError {\n    color:#b94a48;\n}\n\n.wizardButtonbar {\n    width: 100%;\n    background-color: rgb(220, 220, 220);\n    border-top: 1px solid rgb(200, 200, 200);\n    border-bottom: 1px solid rgb(200, 200, 200);\n    padding-top: 5px;\n    padding-bottom: 5px;\n}\n\n.wizardPageTitleContainer {\n    margin-top: 2px;\n    margin-bottom: 2px;\n    padding-top: 2px;\n    padding-bottom: 2px;\n    padding-left: 2px;\n}\n\n.wizardPageTitleContainer:HOVER {\n    background-color: #cdcdcd;\n    cursor: pointer;\n}\n\n.wizardPageTitleImageContainer {\n    width: 16px;\n    margin-right: 5px;\n}\n\n.wizardPageTitleLabelContainer {\n    width: 180px;\n}\n\n.wizardDTableFieldContainerValid {\n    padding: 2px;\n    margin-bottom: 3px;\n}\n\n.wizardDTableFieldContainerInvalid {\n    padding: 2px;\n    margin-bottom: 3px;\n    background-color: #990000;\n}\n\n.wizardDTableSummaryContainer {\n    margin: 10px;\n}\n\n.wizardDTableCaption {\n    margin-left: 10px;\n    margin-right: 10px;\n    margin-bottom: 10px;\n    margin-top: 10px;\n}\n\n.scrollPanel {\n\tpadding-top: 5px;\n\tpadding-bottom: 5px;\n\tmargin-bottom: 5px;\n\tborder-top-style: solid;\n\tborder-top-width: 1px;\n\tborder-top-color: #d0d0d0;\n\tborder-bottom-style: solid;\n\tborder-bottom-width: 1px;\n\tborder-bottom-color: #d0d0d0;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/css/WizardsCellList.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n \n.cellListWidget {\n    width: 250px;\n    overflow: hidden;\n    padding: 2px;\n}\n\n.cellListEvenItem {\n    padding: 1px;\n    margin-bottom: 1px;\n    cursor: pointer;\n    zoom: 1;\n}\n\n.cellListEmptyItem {\n    padding: 1px;\n    cursor: pointer;\n    color: rgb(150, 150, 150);\n    font-style: italic;\n    zoom: 1;\n}\n\n.cellListOddItem {\n    padding: 1px;\n    margin-bottom: 1px;\n    cursor: pointer;\n    zoom: 1;\n}\n\n.cellListKeyboardSelectedItem {\n    background: #ffc; \n}\n\n.cellListSelectedItem {\n    background-color: rgb(200,200,200);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nmultipleMatchingActivitiesFound=Multiple matching activities have been found.\nactivityNotFound=The location you try to open is inaccessible. Please double check it is an existing location and you have permissions to see it: Settings -> Roles -> Permissions.\ncancel=Cancel\nPrevious=Previous\nNext=Next\nFinish=Finish\nDelete=Delete\nRepositoryViewUriLabel=URI:\nRepositoryViewRootLabel=Root:\nDownloading=downloading\nSelectFileToUpload=Please select a file to upload\nUploadSuccess=Uploaded successfully\nUploadFail=Uploading failed\nUploading=Uploading\nDefaultEditor=Default Editor\nDownload=Download\nFileExplorer=File Explorer\nNavigator=Navigator\nEmptyEntry=-- empty --\nMetaFileEditor=Meta File Editor\nCantLoadOrganizationalUnits=Can''t load Organizational Units.\nSelectEntry=--- Select ---\nURLMandatory=URL is mandatory\nInvalidUrlFormat=Invalid URL format\nOrganizationalUnitMandatory=Organizational Unit is mandatory\nRepositoryNaneMandatory=Repository Name is mandatory\nRepositoryNameInvalid=Repository Name contained illegal characters and will be generated as\nDoYouAgree=Do you agree?\nRepoCloneSuccess=The repository is cloned successfully\nIndexClonedRepositoryWarning=The Repository will be indexed. Some workbench features may be unavailable until indexing has completed.\nRepoAlreadyExists=Repository already exists.\nRepoCloneFail=Can''t clone repository.\nCloning=Cloning repository...\nRepoInformation=Repository Information\nIsRequired=* is required\nRepoName=Repository Name\nRepoNameHolder=repository name...\nOrganizationalUnit=Organizational Unit\nGitUrl=Git URL\nGitUrlHolder=git url...\nUserName=User Name\nUserNameHolder=user name...\nPassword=Password\nPasswordHolder=password...\nCancel=Cancel\nClone=Clone\nRepoCreationSuccess=The repository is created successfully\nRepoCreationFail=Can''t create repository.\nCreate=Create\nRepositoryEditor=Repository Editor\nAvailableProtocols=Available protocol(s):\nReverting=Reverting...\nGeneralInformation=General Information\nCommitHistory=Commit History\nLoadMore=Load More...\nTextEditor=Text Editor\nConfirmStateRevert=Confirm state revert?\nActivityNotFound=Activity not found\nCloneRepository=Clone Repository\nCreateRepository=Create Repository\nEmpty=[empty]\nRevertToThis=Revert to this\ntextResourceTypeDescription=Text\nBranches=Branches\nUpdate=Update\nGroupId=Group Id\nArtifactId=Artifact Id\nVersion=Version\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Artifact Name\nVersionHolder=1.0.0\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_de.properties",
    "content": "multipleMatchingActivitiesFound=Mehrere übereinstimmende Aktivitäten gefunden.\ncancel=Abbrechen\nPrevious=Zurück\nNext=Weiter\nFinish=Beenden\nDelete=Löschen\nRepositoryViewUriLabel=URI\\:\nRepositoryViewRootLabel=Root\\:\nDownloading=Herunterladen\nSelectFileToUpload=Bitte eine Datei zum Hochladen auswählen\nUploadSuccess=Erfolgreich hochgeladen\nUploadFail=Hochladen fehlgeschlagen\nUploading=Hochladen\nDefaultEditor=Standard-Editor\nDownload=Herunterladen\nFileExplorer=Datei-Explorer\nNavigator=Navigator\nEmptyEntry=-- leer --\nMetaFileEditor=Meta Datei Editor\nCantLoadOrganizationalUnits=Kann Organisationseinheiten nicht laden.\nSelectEntry=--- Auswählen ---\nURLMandatory=URL ist obligatorisch\nInvalidUrlFormat=Ungültiges URL-Format\nOrganizationalUnitMandatory=Organisationseinheit ist obligatorisch\nRepositoryNaneMandatory=Repository-Name ist obligatorisch\nRepositoryNameInvalid=Repository-Name enthielt unzulässige Zeichen und wird generiert als\nDoYouAgree=Sind Sie einverstanden?\nRepoCloneSuccess=Das Repository wurde erfolgreich geklont\nIndexClonedRepositoryWarning=Das Repository wird indexiert. Einige Workbench-Features sind möglicherweise nicht verfügbar, bis die Indexierung abgeschlossen ist.\nRepoAlreadyExists=Repository bereits vorhanden.\nRepoCloneFail=Kann Repository nicht klonen\nCloning=Klone Repository...\nRepoInformation=Repository Information\nIsRequired=* ist erforderlich\nRepoName=Repository-Name\nRepoNameHolder=Repository-Name...\nOrganizationalUnit=Organisationseinheit\nGitUrl=Git URL\nGitUrlHolder=Git URL...\nUserName=Benutzername\nUserNameHolder=Benutzername...\nPassword=Passwort\nPasswordHolder=Passwort...\nCancel=Abbrechen\nClone=Klonen\nRepoCreationSuccess=Das Repository wurde erfolgreich erstellt\nRepoCreationFail=Kann Repository nicht erstellen\nCreate=Erstellen\nRepositoryEditor=Repository-Editor\nAvailableProtocols=Verfügbare Protokoll(e)\\:\nReverting=Rolle zurück...\nGeneralInformation=Allgemeine Informationen\nCommitHistory=Festschreibungsverlauf\nLoadMore=Mehr laden...\nTextEditor=Texteditor\nConfirmStateRevert=Zurückrollen von Status bestätigen?\nActivityNotFound=Aktivität nicht gefunden\nCloneRepository=Repository klonen\nCreateRepository=Repository erstellen\nEmpty=[leer]\nRevertToThis=Darauf zurückkehren\ntextResourceTypeDescription=Text\nBranches=Sprünge\nUpdate=Aktualisieren\nGroupId=Gruppen-ID\nArtifactId=Artifact-ID\nVersion=Version\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Artifact-Name\nVersionHolder=1.0.0\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nmultipleMatchingActivitiesFound=Se han encontrado múltiples actividades coincidentes.\nactivityNotFound=El lugar que intenta abrir es inaccesible. Compruebe que es una ubicación existente y que tiene permisos para verla:\ncancel=Cancelar\nPrevious=Anterior\nNext=Siguiente\nFinish=Finalizar\nDelete=Eliminar\nRepositoryViewUriLabel=URI:\nRepositoryViewRootLabel=Raíz:\nDownloading=descargando\nSelectFileToUpload=Seleccione un archivo para cargar\nUploadSuccess=La carga se completó correctamente\nUploadFail=Se produjo un error en la carga\nUploading=Cargando\nDefaultEditor=Editor predeterminado\nDownload=Descargar\nFileExplorer=Explorador de archivos\nNavigator=Navegador\nEmptyEntry=-- vacío --\nMetaFileEditor=Editor de metarchivos\nCantLoadOrganizationalUnits=No se pueden cargar las unidades de la organización.\nSelectEntry=--- Seleccionar ---\nURLMandatory=La URL es obligatoria\nInvalidUrlFormat=Formato de URL no válido\nOrganizationalUnitMandatory=La unidad organizativa es obligatoria\nRepositoryNaneMandatory=El nombre del repositorio es obligatorio\nRepositoryNameInvalid=El nombre del repositorio contenía caracteres no permitidos y se generará de la siguiente manera\nDoYouAgree=¿Está de acuerdo?\nRepoCloneSuccess=El repositorio se clonó correctamente\nIndexClonedRepositoryWarning=El repositorio se indexará. Algunas de las funcionalidades de la mesa de trabajo podrían no estar disponibles hasta que se haya completado la indexación.\nRepoAlreadyExists=El repositorio ya existe.\nRepoCloneFail=No se puede clonar el depósito.\nCloning=Clonando repositorio…\nRepoInformation=Información del repositorio\nIsRequired=* es obligatorio\nRepoName=Nombre del repositorio\nRepoNameHolder=nombre del depósito…\nOrganizationalUnit=Unidad organizativa\nGitUrl=URL Git\nGitUrlHolder=url git…\nUserName=Nombre de usuario\nUserNameHolder=nombre de usuario…\nPassword=Contraseña\nPasswordHolder=contraseña…\nCancel=Cancelar\nClone=Clonar\nRepoCreationSuccess=El repositorio se creó correctamente\nRepoCreationFail=No se puede crear un repositorio.\nCreate=Crear\nRepositoryEditor=Editor de repositorio\nAvailableProtocols=Protocolos disponibles:\nReverting=Revertiendo…\nGeneralInformation=Información general\nCommitHistory=Historial de confirmación\nLoadMore=Cargar más…\nTextEditor=Editor de texto\nConfirmStateRevert=¿Confirmar la reversión del estado?\nActivityNotFound=No se encuentra la actividad\nCloneRepository=Clonar repositorio\nCreateRepository=Crear repositorio\nEmpty=[vacío]\nRevertToThis=Revertir a esto\ntextResourceTypeDescription=Texto\nBranches=Ramas\nUpdate=Actualizar\nGroupId=ID de grupo\nArtifactId=ID de artefacto\nVersion=Versión\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Nombre de artefacto\nVersionHolder=1.0.0\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nmultipleMatchingActivitiesFound=Plusieurs activités correspondantes ont été trouvées.\nactivityNotFound=L''emplacement que vous essayez d''ouvrir est inaccessible. Vérifiez à nouveau qu''il s''agit d''un emplacement existant et que vous êtes autorisé à le visualiser : Settings -> Roles -> Permissions.\ncancel=Annuler\nPrevious=Précédent\nNext=Suivant\nFinish=Terminer\nDelete=Supprimer\nRepositoryViewUriLabel=URI :\nRepositoryViewRootLabel=Racine :\nDownloading=téléchargement\nSelectFileToUpload=Veuillez sélectionner un fichier à envoyer\nUploadSuccess=Envoyé avec succès\nUploadFail=L''envoi a échoué\nUploading=Envoi\nDefaultEditor=Éditeur par défaut\nDownload=Télécharger\nFileExplorer=Explorateur de fichiers\nNavigator=Navigateur\nEmptyEntry=-- vide --\nMetaFileEditor=Éditeur de métafichier\nCantLoadOrganizationalUnits=Impossible de charger les unités d''organisation.\nSelectEntry=--- Sélectionner ---\nURLMandatory=L''URL est obligatoire\nInvalidUrlFormat=Format d''URL non valide\nOrganizationalUnitMandatory=L''unité d''organisation est obligatoire\nRepositoryNaneMandatory=Le nom du référentiel est obligatoire\nRepositoryNameInvalid=Le nom du référentiel contient des caractères non autorisés et sera généré comme\nDoYouAgree=Êtes-vous d''accord ?\nRepoCloneSuccess=Le référentiel a été cloné\nIndexClonedRepositoryWarning=Le référentiel sera indexé. Il se peut que certaines fonctionnalités du tableau de référence soient indisponibles tant que l''indexation n''est pas terminée.\nRepoAlreadyExists=Le référentiel existe déjà.\nRepoCloneFail=Impossible de cloner le référentiel.\nCloning=Clonage du référentiel…\nRepoInformation=Informations sur le référentiel\nIsRequired=* est obligatoire\nRepoName=Nom du référentiel\nRepoNameHolder=nom du référentiel…\nOrganizationalUnit=Unité d''organisation\nGitUrl=URL GIT\nGitUrlHolder=url git…\nUserName=Nom d''utilisateur\nUserNameHolder=nom d''utilisateur…\nPassword=Mot de passe\nPasswordHolder=mot de passe…\nCancel=Annuler\nClone=Cloner\nRepoCreationSuccess=Le référentiel a été créé\nRepoCreationFail=Impossible de créer le référentiel.\nCreate=Créer\nRepositoryEditor=Éditeur de référentiel\nAvailableProtocols=Protocole(s) disponible(s) :\nReverting=Rétablissement…\nGeneralInformation=Informations générales\nCommitHistory=Historique de validation\nLoadMore=Charger plus…\nTextEditor=Éditeur de texte\nConfirmStateRevert=Confirmer le rétablissement de l''état initial ?\nActivityNotFound=Activité introuvable\nCloneRepository=Cloner le référentiel\nCreateRepository=Créer un référentiel\nEmpty=[vide]\nRevertToThis=Restaurer ceci\ntextResourceTypeDescription=Texte\nBranches=Branches\nUpdate=Mettre à jour\nGroupId=ID de groupe\nArtifactId=ID d''artefact\nVersion=Version\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Nom de l''artefact\nVersionHolder=1.0.0\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nmultipleMatchingActivitiesFound=Piu attività corrispondenti sono state trovate.\nactivityNotFound=La posizione che stai cercando di aprire non è accessibile. Per favore, verifica che sia una posizione esistente e che tu abbia i permessi per visualizzarla: Impostazioni -> Ruoli -> Permessi.\ncancel=Annulla\nPrevious=Precedente\nNext=Successivo\nFinish=Fine\nDelete=Elimina\nRepositoryViewUriLabel=URI:\nRepositoryViewRootLabel=Radice:\nDownloading=scaricamento\nSelectFileToUpload=Seleziona un file da caricare\nUploadSuccess=Caricamento completato con successo\nUploadFail=Caricamento fallito\nUploading=Caricamento in corso\nDefaultEditor=Editor predefinito\nDownload=Scarica\nFileExplorer=Esplora file\nNavigator=Navigatore\nEmptyEntry=-- vuoto --\nMetaFileEditor=Editor file meta\nCantLoadOrganizationalUnits=Impossibile caricare le unità organizzative.\nSelectEntry=--- Seleziona ---\nURLMandatory=L''URL è obbligatorio\nInvalidUrlFormat=Formato URL non valido\nOrganizationalUnitMandatory=L''unità organizzativa è obbligatoria\nRepositoryNaneMandatory=Il nome del repository è obbligatorio\nRepositoryNameInvalid=Il nome del repository contiene caratteri non validi e verrà generato come\nDoYouAgree=Sei d''accordo?\nRepoCloneSuccess=Il repository è stato clonato con successo\nIndexClonedRepositoryWarning=Il repository verrà indicizzato. Alcune funzionalità del workbench potrebbero non essere disponibili fino al completamento dell''indicizzazione.\nRepoAlreadyExists=Il repository esiste già.\nRepoCloneFail=Impossibile clonare il repository.\nCloning=Clonazione del repository in corso...\nRepoInformation=Informazioni sul repository\nIsRequired=* è obbligatorio\nRepoName=Nome del repository\nRepoNameHolder=nome del repository...\nOrganizationalUnit=Unità organizzativa\nGitUrl=URL Git\nGitUrlHolder=url git...\nUserName=Nome utente\nUserNameHolder=nome utente...\nPassword=Password\nPasswordHolder=password...\nCancel=Annulla\nClone=Clona\nRepoCreationSuccess=Il repository è stato creato con successo\nRepoCreationFail=Impossibile creare il repository.\nCreate=Crea\nRepositoryEditor=Editor del repository\nAvailableProtocols=Protocollo(i) disponibile(i):\nReverting=Annullamento in corso...\nGeneralInformation=Informazioni generali\nCommitHistory=Cronologia commit\nLoadMore=Carica altro...\nTextEditor=Editor di testo\nConfirmStateRevert=Conferma l''annullamento dello stato?\nActivityNotFound=Attività non trovata\nCloneRepository=Clona repository\nCreateRepository=Crea repository\nEmpty=[vuoto]\nRevertToThis=Torna a questo\ntextResourceTypeDescription=Testo\nBranches=Branch\nUpdate=Aggiorna\nGroupId=ID gruppo\nArtifactId=ID artefatto\nVersion=Versione\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Nome artefatto\nVersionHolder=1.0.0\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nmultipleMatchingActivitiesFound=一致するアクティビティーが複数見つかりました。\nactivityNotFound=表示しようとしている場所にアクセスできません。場所が存在することとパーミッションがあることを、設定 -> ロール -> パーミッション で確認してください。\ncancel=キャンセル\nPrevious=戻る\nNext=次へ\nFinish=完了\nDelete=削除\nRepositoryViewUriLabel=URI:\nRepositoryViewRootLabel=ルート:\nDownloading=ダウンロード中\nSelectFileToUpload=アップロードするファイルを選択してください\nUploadSuccess=正常にアップロードされました\nUploadFail=アップロードに失敗しました\nUploading=アップロード中\nDefaultEditor=デフォルトのエディター\nDownload=ダウンロード\nFileExplorer=ファイルエクスプローラー\nNavigator=ナビゲーター\nEmptyEntry=--  空 --\nMetaFileEditor=メタファイルエディター\nCantLoadOrganizationalUnits=組織単位をロードできません。\nSelectEntry=--- 選択してください---\nURLMandatory=URL は必須\nInvalidUrlFormat=無効な URL 形式\nOrganizationalUnitMandatory=組織単位は必須\nRepositoryNaneMandatory=リポジトリー名は必須\nRepositoryNameInvalid=リポジトリー名に不正な文字が含まれ、以下のように生成されます\nDoYouAgree=同意しますか?\nRepoCloneSuccess=リポジトリーが正常にクローンされました\nIndexClonedRepositoryWarning=リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。\nRepoAlreadyExists=リポジトリーがすでに存在します。\nRepoCloneFail=リポジトリをクローンできません。\nCloning=リポジトリーのクローン中 ...\nRepoInformation=リポジトリー情報\nIsRequired=* は必須\nRepoName=リポジトリー名\nRepoNameHolder=リポジトリー名 ...\nOrganizationalUnit=組織単位\nGitUrl=Git URL\nGitUrlHolder=git url...\nUserName=ユーザー名\nUserNameHolder=ユーザー名 ...\nPassword=パスワード\nPasswordHolder=パスワード...\nCancel=キャンセル\nClone=クローン\nRepoCreationSuccess=リポジトリーが正常に作成されました\nRepoCreationFail=リポジトリーを作成できません。\nCreate=作成\nRepositoryEditor=リポジトリーエディター\nAvailableProtocols=利用可能なプロトコル:\nReverting=取り消し中...\nGeneralInformation=一般情報\nCommitHistory=コミット履歴\nLoadMore=詳細のロード...\nTextEditor=テキストエディター\nConfirmStateRevert=取り消しの状態を確認しますか?\nActivityNotFound=アクティビティーが見つかりません\nCloneRepository=リポジトリーをクローン\nCreateRepository=リポジトリーを作成\nEmpty=[空]\nRevertToThis=これを取り消す\ntextResourceTypeDescription=テキスト\nBranches=ブランチ\nUpdate=更新\nGroupId=グループ ID\nArtifactId=アーティファクト ID\nVersion=バージョン\nGroupIdHolder=org.guvnor\nArtifactIdHolder=アーティファクト名\nVersionHolder=1.0.0\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_pt_BR.properties",
    "content": "multipleMatchingActivitiesFound=Nenhuma atividade de combinação múltipla foi encontrada.\ncancel=Cancelar\nPrevious=Anterior\nNext=Próximo\nFinish=Concluir\nDelete=Excluir\nRepositoryViewUriLabel=URI\\:\nRepositoryViewRootLabel=Root\\:\nDownloading=Executando o download\nSelectFileToUpload=Por favor selecione um arquivo para carregar\nUploadSuccess=Carregado com êxito\nUploadFail=Falha de carregamento\nUploading=Carregando\nDefaultEditor=Editor Default\nDownload=Download\nFileExplorer=Explorer do Arquivo\nNavigator=Navegador\nEmptyEntry=-- vazio --\nMetaFileEditor=Editor de Arquivo Meta\nCantLoadOrganizationalUnits=Não foi possível carregar Unidades Organizacionais.\nSelectEntry=--- Selecionar ---\nURLMandatory=O URL é mandatório\nInvalidUrlFormat=Formato de URL inválido\nOrganizationalUnitMandatory=A Unidade Organizacional é obrigatória\nRepositoryNaneMandatory=O Nome do Repositório é obrigatório\nRepositoryNameInvalid=O Nome do Repositório continha caracteres ilegais e será gerado como\nDoYouAgree=Você concorda?\nRepoCloneSuccess=O repositório foi clonado com êxito\nIndexClonedRepositoryWarning=O Repositório será indexado. Alguns recursos de bancada podem estar indisponíveis até que a indexação seja concluída.\nRepoAlreadyExists=O repositório já existe.\nRepoCloneFail=Não foi possível clonar o repositório.\nCloning=Clonando o repositório...\nRepoInformation=Informação do Repositório\nIsRequired=* é solicitado\nRepoName=Nome do Repositório\nRepoNameHolder=nome do repositório...\nOrganizationalUnit=Unidade Organizacional\nGitUrl=Git URL\nGitUrlHolder=git url...\nUserName=Nome do Usuário\nUserNameHolder=nome do usuário...\nPassword=Senha\nPasswordHolder=senha...\nCancel=Cancelar\nClone=Clonar\nRepoCreationSuccess=O repositório é criado com êxito\nRepoCreationFail=Não foi possível criar o repositório.\nCreate=Criar\nRepositoryEditor=Editor de repositório \nAvailableProtocols=Protocolo(s) disponível(is)\\:\nReverting=Revertendo...\nGeneralInformation=Informação Geral\nCommitHistory=Histórico de Confirmação\nLoadMore=Carregar Mais...\nTextEditor=Editor de Texto\nConfirmStateRevert=Confirmar o estado de reversão?\nActivityNotFound=Atividade não encontrada\nCloneRepository=Clonar Repositório\nCreateRepository=Criar Repositório\nEmpty=[vazio]\nRevertToThis=Reverter a isto\ntextResourceTypeDescription=Texto\nBranches=Ramificações\nUpdate=Atualizar\nGroupId=Id do Grupo\nArtifactId=ID do Artefato\nVersion=Versão\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Nome do Artefato\nVersionHolder=1.0.0\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/CoreConstants_zh_CN.properties",
    "content": "multipleMatchingActivitiesFound=未找到多个匹配的活动。\ncancel=取消\nPrevious=上一步\n# auto translated by TM merge from project: JON strings, version: jon33strings, DocId: Messages\nNext=下一步\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nFinish=完成\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nDelete=删除\n# auto translated by TM merge from project: KIE Workbench - Common, version: 6.2.0, DocId: org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants\nRepositoryViewUriLabel=URI\\:\nRepositoryViewRootLabel=Root\\:\nDownloading=正在下载\n# auto translated by TM merge from project: guvnor, version: 6.2.0, DocId: org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants\nSelectFileToUpload=请选择一个文件上传\n# auto translated by TM merge from project: KIE Workbench - Common, version: 6.2.0, DocId: org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants\nUploadSuccess=成功上传\nUploadFail=上传失败\nUploading=正在上传\nDefaultEditor=默认的编辑器\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-dtable-xls-editor-client/org/drools/workbench/screens/dtablexls/client/resources/i18n/DecisionTableXLSEditorConstants\nDownload=下载\nFileExplorer=文件浏览器\nNavigator=导航器\nEmptyEntry=-- empty --\nMetaFileEditor=元文件编辑器\nCantLoadOrganizationalUnits=无法加载组织单元。\nSelectEntry=--- Select ---\nURLMandatory=URL 是必需的\nInvalidUrlFormat=无效的 URL 格式\nOrganizationalUnitMandatory=组织单元是必需的\nRepositoryNaneMandatory=资料库名是必需的\nRepositoryNameInvalid=资料库名包含了无效的字符且将生成为\nDoYouAgree=您同意吗？\nRepoCloneSuccess=资料库被成功克隆\nIndexClonedRepositoryWarning=资料库将编制索引。在索引完成至前，某些工作区的功能可能不可用。\nRepoAlreadyExists=资料库 已经存在。\nRepoCloneFail=无法克隆资料库。\nCloning=正在克隆资料库...\nRepoInformation=资料库信息\nIsRequired=* 是必需的\nRepoName=资料库名称\nRepoNameHolder=repository name...\nOrganizationalUnit=组织单元\nGitUrl=Git URL\nGitUrlHolder=git url...\nUserName=用户名称\nUserNameHolder=user name...\nPassword=密码\nPasswordHolder=password...\nCancel=取消\nClone=克隆\nRepoCreationSuccess=资料库被成功创建\nRepoCreationFail=无法创建资料库。\nCreate=创建\nRepositoryEditor=存储库编辑器\nAvailableProtocols=可用的协议：\nReverting=正在还原...\nGeneralInformation=普通信息\nCommitHistory=提交历史\nLoadMore=加载更多内容...\nTextEditor=文本编辑器\nConfirmStateRevert=确认状态还原？\nActivityNotFound=未找到活动\nCloneRepository=克隆资料库\nCreateRepository=创建资料库\nEmpty=[empty]\nRevertToThis=还原至此\ntextResourceTypeDescription=文本\nBranches=分支\nUpdate=更新\nGroupId=Group Id\nArtifactId=Artifact Id\nVersion=版本\nGroupIdHolder=org.guvnor\nArtifactIdHolder=Artifact 名称\nVersionHolder=1.0.0\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUploadBaseTestWrapper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.Collections;\nimport java.util.Map;\n\npublic class DefaultEditorFileUploadBaseTestWrapper extends DefaultEditorFileUploadBase {\n\n    boolean initialized;\n    boolean isValid;\n\n    public DefaultEditorFileUploadBaseTestWrapper() {\n        super(false);\n    }\n\n    @Override\n    void initForm() {\n        if (initialized) {\n            super.initForm();\n        }\n    }\n\n    void forceInitForm() {\n        this.initialized = true;\n        initForm();\n    }\n\n    @Override\n    boolean isValid() {\n        return isValid;\n    }\n\n    void setValid(final boolean isValid) {\n        this.isValid = isValid;\n    }\n\n    @Override\n    protected Map<String, String> getParameters() {\n        return Collections.emptyMap();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUploadParametersTest.java",
    "content": "/*\n * Copyright 2019 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.Map;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.backend.vfs.PathFactory;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DefaultEditorFileUploadParametersTest {\n\n    private DefaultEditorFileUpload upload;\n\n    @Before\n    public void setUp() throws Exception {\n        upload = new DefaultEditorFileUpload() {\n            @Override\n            void initForm() {\n\n            }\n        };\n    }\n\n    @Test\n    public void testPathParameterIsEncoded() {\n        upload.setPath(new PathFactory.PathImpl(\"foo.txt\", \"default://foo & bar.txt\"));\n        upload.setIsUpdate(true);\n\n        final Map<String, String> parameters = upload.getParameters();\n\n        assertEquals(2, parameters.size());\n        assertEquals(\"default%3A%2F%2Ffoo+%26+bar.txt\", parameters.get(\"path\"));\n        assertEquals(\"true\", parameters.get(\"update\"));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/DefaultEditorFileUploadTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm.SubmitCompleteHandler;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm.SubmitHandler;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.common.FileUploadFormEncoder;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class DefaultEditorFileUploadTest {\n\n    @InjectMocks\n    private DefaultEditorFileUploadBaseTestWrapper editor;\n\n    @GwtMock\n    private Form form;\n\n    @Mock\n    private FileUploadFormEncoder formEncoder;\n\n    @Mock\n    private Consumer<String> successCallback;\n\n    @Mock\n    private Consumer<String> errorCallback;\n\n    @Before\n    public void setup() {\n        editor.forceInitForm();\n    }\n\n    @Test\n    public void formCharsetAdded() {\n        verify(formEncoder,\n               times(1)).addUtf8Charset(form);\n    }\n\n    @Test\n    public void formSubmitHandlersSet() {\n        verify(form,\n               never()).addSubmitHandler(any(SubmitHandler.class));\n        verify(form,\n               times(1)).addSubmitCompleteHandler(any(SubmitCompleteHandler.class));\n    }\n\n    @Test\n    public void formSubmitValidState() {\n        editor.setValid(true);\n        editor.upload(successCallback,\n                      errorCallback);\n        verify(form,\n               times(1)).submit();\n    }\n\n    @Test\n    public void formSubmitInvalidState() {\n        editor.setValid(false);\n        editor.upload(successCallback,\n                      errorCallback);\n        verify(form,\n               never()).submit();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/editors/defaulteditor/UploadEventTest.java",
    "content": "/*\n * Copyright 2017 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.defaulteditor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UploadEventTest {\n\n    @Mock\n    AbstractForm.SubmitCompleteEvent event;\n\n    @Test\n    public void testSuccessStatus() {\n        when(event.getResults()).thenReturn(\"OK\");\n\n        assertTrue(DefaultEditorFileUploadBase.isUploadSuccessful(event));\n    }\n\n    @Test\n    public void testFailedStatus() {\n        when(event.getResults()).thenReturn(\"FAIL\");\n\n        assertFalse(DefaultEditorFileUploadBase.isUploadSuccessful(event));\n    }\n\n    @Test\n    public void testUnknownStatus() {\n        when(event.getResults()).thenReturn(null);\n\n        assertFalse(DefaultEditorFileUploadBase.isUploadSuccessful(event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/tree/FSTreeItemTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.UIObject;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.ext.widgets.core.client.tree.FSTreeItem.FSType;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FSTreeItemTest {\n\n    public static final String ROOT_VALUE = \"root\";\n    public static final String ROOT_LABEL = \"root\";\n\n    public static final String FOLDER_VALUE = \"folder\";\n    public static final String FOLDER_LABEL = \"folder\";\n\n    public static final String ITEM_VALUE = \"item\";\n    public static final String ITEM_LABEL = \"item\";\n\n    @Mock\n    private UIObject uiObject;\n\n    @Mock\n    private IsWidget widget;\n\n    @Mock\n    private FlowPanel content;\n\n    @Mock\n    private FlowPanel item;\n\n    @Mock\n    private Tree<FSTreeItem> tree;\n\n    private FSTreeItem testedRoot;\n    private FSTreeItem testedContainer;\n    private FSTreeItem testedItem;\n\n    @Before\n    public void setup() {\n        final Element element = mock(Element.class);\n        when(content.getElement()).thenReturn(element);\n        when(element.getTitle()).thenReturn(\"title\");\n        final Style styleItem = mock(Style.class);\n        when(element.getStyle()).thenReturn(styleItem);\n\n        when(uiObject.getTitle()).thenReturn(\"TITLE\");\n\n        final Style style = mock(Style.class);\n        when(element.getStyle()).thenReturn(style);\n\n        testedRoot = new FSTreeItem(FSTreeItem.FSType.ROOT,\n                                    ROOT_VALUE,\n                                    () -> content);\n        testedRoot.setTree(tree);\n\n        testedContainer = new FSTreeItem(FSTreeItem.FSType.FOLDER,\n                                         FOLDER_VALUE,\n                                         () -> content);\n\n        testedItem = new FSTreeItem(FSTreeItem.FSType.ITEM,\n                                    ITEM_VALUE,\n                                    () -> content);\n    }\n\n    @Test\n    public void testGetters() {\n        assertEquals(TreeItem.State.CLOSE,\n                     testedRoot.getState());\n        assertEquals(FSTreeItem.FSType.ROOT,\n                     testedRoot.getFSType());\n        assertEquals(ROOT_LABEL,\n                     testedRoot.getLabel());\n        assertEquals(ROOT_VALUE,\n                     testedRoot.getUuid());\n\n        assertEquals(TreeItem.State.CLOSE,\n                     testedContainer.getState());\n        assertEquals(FSTreeItem.FSType.FOLDER,\n                     testedContainer.getFSType());\n        assertEquals(FOLDER_LABEL,\n                     testedContainer.getLabel());\n        assertEquals(FOLDER_VALUE,\n                     testedContainer.getUuid());\n\n        assertEquals(TreeItem.State.NONE,\n                     testedItem.getState());\n        assertEquals(FSTreeItem.FSType.ITEM,\n                     testedItem.getFSType());\n        assertEquals(ITEM_LABEL,\n                     testedItem.getLabel());\n        assertEquals(ITEM_VALUE,\n                     testedItem.getUuid());\n    }\n\n    @Test\n    public void testAddItem() {\n        final FSTreeItem childTreeItem = mock(FSTreeItem.class);\n        when(childTreeItem.getFSType()).thenReturn(FSType.ITEM);\n        final FSTreeItem treeItem1 = testedRoot.addItem(childTreeItem);\n        assertEquals(treeItem1,\n                     childTreeItem);\n        verify(childTreeItem,\n               times(1)).setTree(eq(tree));\n        verify(childTreeItem,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).add(eq(childTreeItem));\n    }\n\n    @Test\n    public void testAddContainer() {\n        final FSTreeItem childTreeContainer = mock(FSTreeItem.class);\n        when(childTreeContainer.getFSType()).thenReturn(FSTreeItem.FSType.FOLDER);\n        final FSTreeItem treeItem1 = testedRoot.addItem(childTreeContainer);\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).add(eq(childTreeContainer));\n    }\n\n    @Test\n    public void testAddItemToContainer() {\n        final FSTreeItem childTreeContainer = mock(FSTreeItem.class);\n        when(childTreeContainer.getFSType()).thenReturn(FSType.FOLDER);\n\n        final FSTreeItem childTreeItem = mock(FSTreeItem.class);\n        when(childTreeItem.getFSType()).thenReturn(FSType.ITEM);\n\n        final FSTreeItem treeItem1 = testedRoot.addItem(childTreeContainer);\n\n        final FSTreeItem treeItem2 = testedContainer.addItem(treeItem1);\n\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        assertEquals(treeItem2,\n                     treeItem1);\n\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(2)).add(treeItem2);\n        verify(treeItem1,\n               times(1)).setTree(eq(tree));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/tree/TreeItemTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class TreeItemTest {\n\n    public static final String ROOT_VALUE = \"rootValue\";\n    public static final String ROOT_LABEL = \"rootLabel\";\n    public static final String CONTAINER_VALUE = \"containerValue\";\n    public static final String CONTAINER_LABEL = \"containerLabel\";\n    public static final String ITEM_VALUE = \"itemValue\";\n    public static final String ITEM_LABEL = \"itemLabel\";\n\n    @Mock\n    private IsWidget widget;\n\n    @Mock\n    private FlowPanel content;\n\n    @Mock\n    private FlowPanel treeContainer;\n\n    @Mock\n    private Tree<TreeItem> tree;\n\n    private TreeItem testedRoot;\n    private TreeItem testedContainer;\n    private TreeItem testedItem;\n\n    @Before\n    public void setup() {\n        final Element element = mock(Element.class);\n        when(content.getElement()).thenReturn(element);\n        final Style style = mock(Style.class);\n        when(element.getStyle()).thenReturn(style);\n        testedRoot = new TreeItem(TreeItem.Type.ROOT,\n                                  ROOT_VALUE,\n                                  ROOT_LABEL,\n                                  widget,\n                                  () -> content);\n        testedRoot.setTree(tree);\n        testedContainer = new TreeItem(TreeItem.Type.CONTAINER,\n                                       CONTAINER_VALUE,\n                                       CONTAINER_LABEL,\n                                       widget,\n                                       () -> content);\n        testedItem = new TreeItem(TreeItem.Type.ITEM,\n                                  ITEM_VALUE,\n                                  ITEM_LABEL,\n                                  widget,\n                                  () -> content);\n    }\n\n    @Test\n    public void testGetters() {\n        assertEquals(TreeItem.State.CLOSE,\n                     testedRoot.getState());\n        assertEquals(TreeItem.Type.ROOT,\n                     testedRoot.getType());\n        assertEquals(ROOT_LABEL,\n                     testedRoot.getLabel());\n        assertEquals(ROOT_VALUE,\n                     testedRoot.getUuid());\n        assertEquals(TreeItem.State.CLOSE,\n                     testedContainer.getState());\n        assertEquals(TreeItem.Type.CONTAINER,\n                     testedContainer.getType());\n        assertEquals(CONTAINER_LABEL,\n                     testedContainer.getLabel());\n        assertEquals(CONTAINER_VALUE,\n                     testedContainer.getUuid());\n        assertEquals(TreeItem.State.NONE,\n                     testedItem.getState());\n        assertEquals(TreeItem.Type.ITEM,\n                     testedItem.getType());\n        assertEquals(ITEM_LABEL,\n                     testedItem.getLabel());\n        assertEquals(ITEM_VALUE,\n                     testedItem.getUuid());\n    }\n\n    @Test\n    public void testAddItem() {\n        final TreeItem childTreeItem = mock(TreeItem.class);\n        when(childTreeItem.getType()).thenReturn(TreeItem.Type.ITEM);\n        final TreeItem treeItem1 = testedRoot.addItem(childTreeItem);\n        assertEquals(treeItem1,\n                     childTreeItem);\n        verify(childTreeItem,\n               times(1)).setTree(eq(tree));\n        verify(childTreeItem,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).add(eq(childTreeItem));\n    }\n\n    @Test\n    public void testAddContainer() {\n        final TreeItem childTreeContainer = mock(TreeItem.class);\n        when(childTreeContainer.getType()).thenReturn(TreeItem.Type.CONTAINER);\n        final TreeItem treeItem1 = testedRoot.addItem(childTreeContainer);\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).add(eq(childTreeContainer));\n    }\n\n    @Test\n    public void testAddItemToContainer() {\n        final TreeItem childTreeContainer = mock(TreeItem.class);\n        when(childTreeContainer.getType()).thenReturn(TreeItem.Type.CONTAINER);\n        final TreeItem childTreeItem = mock(TreeItem.class);\n        when(childTreeItem.getType()).thenReturn(TreeItem.Type.ITEM);\n        final TreeItem treeItem1 = testedRoot.addItem(childTreeContainer);\n        final TreeItem treeItem2 = testedContainer.addItem(treeItem1);\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        assertEquals(treeItem2,\n                     treeItem1);\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(2)).add(eq(treeItem2));\n        verify(treeItem1,\n               times(1)).setTree(eq(tree));\n    }\n\n    @Test\n    public void testInsertItem() {\n        final TreeItem childTreeItem = mock(TreeItem.class);\n        when(childTreeItem.getType()).thenReturn(TreeItem.Type.ITEM);\n        final int index = 7;\n        final TreeItem treeItem1 = testedRoot.insertItem(childTreeItem, index);\n        assertEquals(treeItem1,\n                     childTreeItem);\n        verify(childTreeItem,\n               times(1)).setTree(eq(tree));\n        verify(childTreeItem,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).insert(eq(childTreeItem), eq(index));\n    }\n\n    @Test\n    public void testInsertContainer() {\n        final TreeItem childTreeContainer = mock(TreeItem.class);\n        when(childTreeContainer.getType()).thenReturn(TreeItem.Type.CONTAINER);\n        final int index = 10;\n        final TreeItem treeItem1 = testedRoot.insertItem(childTreeContainer, index);\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).insert(eq(childTreeContainer), eq(index));\n    }\n\n    @Test\n    public void testInsertItemToContainer() {\n        final TreeItem childTreeContainer = mock(TreeItem.class);\n        when(childTreeContainer.getType()).thenReturn(TreeItem.Type.CONTAINER);\n        final TreeItem childTreeItem = mock(TreeItem.class);\n        when(childTreeItem.getType()).thenReturn(TreeItem.Type.ITEM);\n        final int index1 = 17;\n        final int index2 = 25;\n        final TreeItem treeItem1 = testedRoot.insertItem(childTreeContainer, index1);\n        final TreeItem treeItem2 = testedContainer.insertItem(treeItem1, index2);\n        assertEquals(treeItem1,\n                     childTreeContainer);\n        assertEquals(treeItem2,\n                     treeItem1);\n        verify(childTreeContainer,\n               times(1)).setTree(eq(tree));\n        verify(childTreeContainer,\n               times(1)).setParentItem(eq(testedRoot));\n        verify(content,\n               times(1)).insert(eq(treeItem2), eq(index1));\n        verify(content,\n               times(1)).insert(eq(treeItem2), eq(index2));\n        verify(treeItem1,\n               times(1)).setTree(eq(tree));\n    }\n\n    @Test\n    public void testGetChildCount() {\n        testedRoot.getChildCount();\n        verify(content,\n               times(1)).getWidgetCount();\n    }\n\n    @Test\n    public void testRemoveItems() {\n        testedRoot.removeItems();\n        verify(content,\n               times(1)).clear();\n    }\n\n    @Test\n    public void testRemove() {\n        Tree<TreeItem> tree = new Tree<>(() -> treeContainer);\n        testedRoot.setTree(tree);\n        tree.addItem(testedRoot);\n        testedRoot.remove();\n        verify(treeContainer,\n               times(1)).remove(eq(testedRoot));\n    }\n\n    @Test\n    public void testRemoveItem() {\n        final TreeItem item = mock(TreeItem.class);\n        when(item.getType()).thenReturn(TreeItem.Type.ITEM);\n        testedRoot.addItem(item);\n        testedRoot.removeItem(item);\n        verify(content,\n               times(1)).remove(eq(item));\n    }\n\n    @Test\n    public void testRemoveItemFromParent() {\n        final TreeItem childTreeContainer = mock(TreeItem.class);\n        when(childTreeContainer.getType()).thenReturn(TreeItem.Type.CONTAINER);\n        final TreeItem childTreeItem = mock(TreeItem.class);\n        when(childTreeItem.getType()).thenReturn(TreeItem.Type.ITEM);\n        testedRoot.addItem(childTreeContainer);\n        testedRoot.removeItem(childTreeContainer);\n        verify(content,\n               times(1)).remove(eq(childTreeContainer));\n    }\n\n    @Test\n    public void testGetItemByUuid() {\n        final TreeItem treeItemTest = testedRoot.getItemByUuid(ROOT_VALUE);\n        assertEquals(treeItemTest,\n                     testedRoot);\n    }\n\n    @Test\n    public void testGetItemByUuidChildren() {\n        final TreeItem item = mock(TreeItem.class);\n        when(item.getItemByUuid(ITEM_VALUE)).thenReturn(item);\n        when(content.getWidgetCount()).thenReturn(1);\n        when(content.getWidget(eq(0))).thenReturn(item);\n        final TreeItem treeItemTest = testedRoot.getItemByUuid(ITEM_VALUE);\n        assertEquals(treeItemTest,\n                     item);\n    }\n\n    @Test\n    public void testOuiaComponentTypeAttribute() {\n        assertEquals(\"tree-item\", testedItem.ouiaComponentType().getValue());\n    }\n\n    @Test\n    public void testOuiaComponentIdAttribute() {\n        assertEquals(\"tree-item-\" + ITEM_LABEL, testedItem.ouiaComponentId().getValue());\n    }\n\n    @Test\n    public void testOuiaAttributeRenderer() {\n        testedItem = spy(testedItem);\n        final Element elementMock = mock(Element.class);\n        doReturn(elementMock).when(testedItem).getElement();\n\n        final OuiaComponentTypeAttribute componentTypeAttribute = testedItem.ouiaComponentType();\n        testedItem.ouiaAttributeRenderer().accept(componentTypeAttribute);\n        verify(elementMock).setAttribute(componentTypeAttribute.getName(), componentTypeAttribute.getValue());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/tree/TreeTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.tree;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class TreeTest {\n\n    @Mock\n    private IsWidget widget;\n\n    @Mock\n    private FlowPanel container;\n\n    @Mock\n    private FlowPanel content;\n\n    private Tree<TreeItem> testedTree;\n\n    @Before\n    public void setup() {\n        testedTree = new Tree<TreeItem>(() -> container);\n    }\n\n    @Test\n    public void testIsEmpty() {\n        assertEquals(testedTree.isEmpty(),\n                     true);\n    }\n\n    @Test\n    public void testAddItem() {\n        final TreeItem item = mock(TreeItem.class);\n        testedTree.addItem(item);\n        item.setTree(testedTree);\n        verify(container,\n               times(1)).add(eq(item));\n    }\n\n    @Test\n    public void testGetItem() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n        testedTree.addItem(item1);\n        verify(container,\n               times(1)).add(eq(item1));\n        assertEquals(testedTree.getItem(0),\n                     item1);\n    }\n\n    @Test\n    public void testGetItemByUuuid() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(item1.getUuid()).thenReturn(\"test\");\n        when(item1.getItemByUuid(\"test\")).thenReturn(item1);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n\n        testedTree.addItem(item1);\n        verify(container,\n               times(1)).add(eq(item1));\n        assertEquals(testedTree.getItem(0),\n                     item1);\n\n        TreeItem item = testedTree.getItemByUuid(\"test\");\n        assertEquals(item1,\n                     item);\n    }\n\n    @Test\n    public void testGetItemByUuuidWithParent() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(item1.getUuid()).thenReturn(\"test\");\n        when(item1.getItemByUuid(\"test\")).thenReturn(item1);\n        final TreeItem parent = mock(TreeItem.class);\n        when(parent.getUuid()).thenReturn(\"parent\");\n        when(parent.getChild(0)).thenReturn(item1);\n        when(parent.getChildCount()).thenReturn(1);\n        when(parent.getItemByUuid(\"parent\")).thenReturn(parent);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n\n        testedTree.addItem(parent);\n\n        verify(container,\n               times(1)).add(eq(parent));\n        assertEquals(testedTree.getItem(0),\n                     item1);\n\n        TreeItem item = testedTree.getItemByUuid(\"test\");\n        assertEquals(item1,\n                     item);\n    }\n\n    @Test\n    public void testRemoveItem() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n        testedTree.addItem(item1);\n        testedTree.removeItem(item1);\n        verify(container,\n               times(1)).remove(item1);\n    }\n\n    @Test\n    public void testGetItems() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n        testedTree.addItem(item1);\n        testedTree.getItems().iterator().hasNext();\n        verify(container,\n               times(1)).getWidgetCount();\n\n        final int[] idx = {0};\n        final TreeItem[] item = new TreeItem[1];\n        testedTree.getItems().forEach(i -> {\n                                          item[0] = i;\n                                          idx[0]++;\n                                      }\n        );\n        assertEquals(idx[0],\n                     1);\n        assertEquals(item[0],\n                     item1);\n    }\n\n    @Test\n    public void testGetSelectedItem() {\n        final TreeItem item1 = mock(TreeItem.class);\n        when(container.getWidgetCount()).thenReturn(1);\n        when(container.getWidget(eq(0))).thenReturn(item1);\n        testedTree.addItem(item1);\n        testedTree.setSelectedItem(item1);\n        TreeItem itemGet = testedTree.getSelectedItem();\n        assertEquals(itemGet,\n                     item1);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/wizards/WizardViewImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.wizards;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.NavPills;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.anyList;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WizardViewImplTest {\n\n    @Mock\n    NavPills sideBar;\n\n    @Mock\n    WizardPopupFooter footer;\n\n    @Mock\n    AbstractWizard presenter;\n\n    @Mock\n    SyncBeanManager iocBeanManager;\n\n    List<WizardPageTitle> pageTitleWidgets = new ArrayList<>();\n\n    @Mock\n    WizardViewImpl view;\n\n    @Before\n    public void init() {\n        view.sideBar = sideBar;\n        view.footer = footer;\n        view.iocBeanManager = iocBeanManager;\n        view.pageTitleWidgets = pageTitleWidgets;\n\n        doCallRealMethod().when(view).setCompletionStatus(anyBoolean());\n        doCallRealMethod().when(view).onUnload();\n        doCallRealMethod().when(view).setPageTitles(anyList());\n        doCallRealMethod().when(view).hide();\n    }\n\n    @Test\n    public void testSetCompletionStatusTrue() {\n        view.setCompletionStatus(true);\n\n        verify(view.footer,\n               times(1)).enableFinishButton(true);\n    }\n\n    @Test\n    public void testSetCompletionStatusFalse() {\n        view.setCompletionStatus(false);\n\n        verify(view.footer,\n               times(1)).enableFinishButton(false);\n    }\n\n    @Test\n    public void testOnUnload() {\n        doReturn(presenter).when(view).getPresenter();\n\n        view.onUnload();\n\n        verify(presenter).close();\n        verify(view).parentOnUnload();\n    }\n\n    @Test\n    public void testHide() {\n        final WizardPage firstWizardPageMock = mock(WizardPage.class);\n        final WizardPage secondWizardPageMock = mock(WizardPage.class);\n\n        final WizardPageTitle firstTitleMock = mock(WizardPageTitle.class);\n        final WizardPageTitle secondTitleMock = mock(WizardPageTitle.class);\n\n        doReturn(firstTitleMock).when(view).makeWizardPageTitle(firstWizardPageMock);\n        doReturn(secondTitleMock).when(view).makeWizardPageTitle(secondWizardPageMock);\n\n        view.setPageTitles(Arrays.asList(firstWizardPageMock, secondWizardPageMock));\n\n        assertEquals(2, pageTitleWidgets.size());\n\n        view.hide();\n\n        verify(iocBeanManager).destroyBean(firstTitleMock);\n        verify(iocBeanManager).destroyBean(secondTitleMock);\n        assertEquals(0, pageTitleWidgets.size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-client/src/test/java/org/uberfire/ext/widgets/core/client/workbench/widgets/popups/activities/notfound/ActivityNotFoundPresenterTest.java",
    "content": "/*\n * Copyright 2018 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.workbench.widgets.popups.activities.notfound;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.verifyZeroInteractions;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ActivityNotFoundPresenterTest {\n\n    @Mock\n    private ActivityNotFoundView view;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private PlaceRequest placeRequest;\n\n    private ActivityNotFoundPresenter presenter;\n\n    @Before\n    public void setUp() throws Exception {\n        presenter = new ActivityNotFoundPresenter(view, placeManager);\n        presenter.onStartup(placeRequest);\n    }\n\n    @Test\n    public void testOnCloseNullPlaceIdentifier() {\n        presenter.onClose();\n\n        verifyZeroInteractions(placeManager);\n    }\n\n    @Test\n    public void testOnCloseNonNullPlaceIdentifier() {\n        final String placeIdentifier = \"screen-id\";\n        when(placeRequest.getParameter(\"requestedPlaceIdentifier\", null)).thenReturn(placeIdentifier);\n        presenter.onClose();\n\n        verify(placeManager).forceClosePlace(placeIdentifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-core-editors</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Widgets Core Editors</name>\n  <description>Uberfire Widgets Core Editors</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-ace</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <!-- CDI Integration Modules -->\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/metafile/MetaFileEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.metafile;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.type.DotResourceType;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorMode;\nimport org.uberfire.ext.widgets.core.client.editors.texteditor.TextEditorPresenter;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.EditorsConstants;\nimport org.uberfire.lifecycle.IsDirty;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnSave;\nimport org.uberfire.lifecycle.OnStartup;\n\n@Dependent\n@WorkbenchEditor(identifier = \"MetaFileTextEditor\", supportedTypes = {DotResourceType.class}, priority = Integer.MAX_VALUE - 100)\npublic class MetaFileEditorPresenter {\n\n    @Inject\n    public TextEditorPresenter.View view;\n\n    @Inject\n    private Caller<VFSService> vfsServices;\n\n    private Path path;\n\n    @OnStartup\n    public void onStartup(final ObservablePath path) {\n        this.path = path;\n        vfsServices.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(String response) {\n                if (response == null) {\n                    view.setContent(EditorsConstants.INSTANCE.EmptyEntry(),\n                                    AceEditorMode.TEXT);\n                } else {\n                    view.setContent(response,\n                                    AceEditorMode.TEXT);\n                }\n            }\n        }).readAllString(path);\n    }\n\n    @OnSave\n    public void onSave() {\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(Path response) {\n                view.setDirty(false);\n            }\n        }).write(path,\n                 view.getContent());\n    }\n\n    @IsDirty\n    public boolean isDirty() {\n        return view.isDirty();\n    }\n\n    @OnClose\n    public void onClose() {\n        this.path = null;\n    }\n\n    @OnOpen\n    public void onOpen() {\n        view.setFocus();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return EditorsConstants.INSTANCE.MetaFileEditor() + \" [\" + path.getFileName() + \"]\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/texteditor/TextEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.texteditor;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorMode;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.EditorsConstants;\nimport org.uberfire.lifecycle.IsDirty;\nimport org.uberfire.lifecycle.OnStartup;\n\npublic abstract class TextEditorPresenter {\n\n    @Inject\n    public View view;\n    protected Path path;\n    @Inject\n    private Caller<VFSService> vfsServices;\n\n    @OnStartup\n    public void onStartup(final ObservablePath path) {\n        this.path = path;\n        vfsServices.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(String response) {\n                if (response == null) {\n                    view.setContent(EditorsConstants.INSTANCE.EmptyEntry(),\n                                    getAceEditorMode());\n                } else {\n                    view.setContent(response,\n                                    getAceEditorMode());\n                }\n                onAfterViewLoaded();\n            }\n        }).readAllString(path);\n    }\n\n    /**\n     * This is called after the view's content has been loaded. Sub-classes can override\n     * this method to perform applicable actions after the view's content has been set.\n     * The default implementation does nothing.\n     */\n    protected void onAfterViewLoaded() {\n    }\n\n    /**\n     * This allows sub-classes to determine the Mode of the AceEditor.\n     * By default the AceEditor assumes the AceEditorMode.TEXT.\n     * @return\n     */\n    public AceEditorMode getAceEditorMode() {\n        return AceEditorMode.TEXT;\n    }\n\n    @IsDirty\n    public boolean isDirty() {\n        return view.isDirty();\n    }\n\n    public void onOpen() {\n        view.setFocus();\n    }\n\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    public interface View\n            extends\n            IsWidget {\n\n        void setContent(final String content,\n                        final AceEditorMode mode);\n\n        String getContent();\n\n        void setFocus();\n\n        boolean isDirty();\n\n        void setDirty(final boolean dirty);\n\n        void setReadOnly(final boolean isReadOnly);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/texteditor/TextEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.texteditor;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeLayoutPanel;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditor;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorMode;\nimport org.uberfire.ext.widgets.common.client.ace.AceEditorTheme;\n\n/**\n * A Text editor\n */\npublic class TextEditorView extends Composite\n        implements\n        RequiresResize,\n        TextEditorPresenter.View {\n\n    private static TextEditorViewBinder uiBinder = GWT.create(TextEditorViewBinder.class);\n    @UiField\n    public AceEditor editor;\n    private boolean isDirty = false;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        editor.startEditor();\n        editor.setTheme(AceEditorTheme.CHROME);\n    }\n\n    @Override\n    public void setContent(final String content,\n                           final AceEditorMode mode) {\n        editor.setMode(mode);\n        editor.setText(content);\n        editor.redisplay();\n    }\n\n    @Override\n    public String getContent() {\n        return editor.getText();\n    }\n\n    @Override\n    public void setFocus() {\n        editor.setFocus();\n    }\n\n    @Override\n    public boolean isDirty() {\n        return isDirty;\n    }\n\n    @Override\n    public void setDirty(boolean dirty) {\n        isDirty = dirty;\n    }\n\n    @Override\n    public void setReadOnly(final boolean isReadOnly) {\n        editor.setReadOnly(isReadOnly);\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        setPixelSize(width,\n                     height);\n        editor.onResize();\n    }\n\n    interface TextEditorViewBinder\n            extends\n            UiBinder<ResizeLayoutPanel, TextEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/texteditor/TextEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:common=\"urn:import:org.uberfire.ext.widgets.common.client.ace\">\n\n  <ui:style>\n    .betterSetup {\n      margin: 10px 10px 10px 10px;\n      resize: none;\n    }\n  </ui:style>\n\n  <g:ResizeLayoutPanel>\n    <common:AceEditor ui:field=\"editor\" styleName=\"{style.betterSetup}\"/>\n  </g:ResizeLayoutPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/texteditor/TextEditorWorkbenchEditor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.texteditor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.type.DotResourceType;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.EditorsConstants;\nimport org.uberfire.lifecycle.IsDirty;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnSave;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@WorkbenchEditor(identifier = \"TextEditor\", supportedTypes = {TextResourceType.class, DotResourceType.class})\npublic class TextEditorWorkbenchEditor\n        extends TextEditorPresenter {\n\n    @Inject\n    private Caller<VFSService> vfsServices;\n\n    @Inject\n    private Event<ChangeTitleWidgetEvent> changeTitleWidgetEvent;\n\n    @OnStartup\n    public void onStartup(final Path path,\n                          final PlaceRequest placeRequest) {\n        vfsServices.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(String response) {\n                if (response == null) {\n                    view.setContent(EditorsConstants.INSTANCE.EmptyEntry(),\n                                    getAceEditorMode());\n                } else {\n                    view.setContent(response,\n                                    getAceEditorMode());\n                }\n                changeTitleWidgetEvent.fire(\n                        new ChangeTitleWidgetEvent(\n                                placeRequest,\n                                EditorsConstants.INSTANCE.TextEditor() + \" [\" + path.getFileName() + \"]\"));\n            }\n        }).readAllString(path);\n    }\n\n    @OnSave\n    public void onSave() {\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(Path response) {\n                view.setDirty(false);\n            }\n        }).write(path,\n                 view.getContent());\n    }\n\n    @IsDirty\n    public boolean isDirty() {\n        return super.isDirty();\n    }\n\n    @OnClose\n    public void onClose() {\n        this.path = null;\n    }\n\n    @OnOpen\n    public void onOpen() {\n        super.onOpen();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return EditorsConstants.INSTANCE.TextEditor();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return super.getWidget();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/editors/texteditor/TextResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.editors.texteditor;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.widgets.core.client.resources.CoreImages;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.EditorsConstants;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.TextResourceTypeDefinition;\n\n@ApplicationScoped\npublic class TextResourceType\n        extends TextResourceTypeDefinition\n        implements ClientResourceType {\n\n    private static final Image IMAGE = new Image(CoreImages.INSTANCE.typeTextFile());\n\n    public TextResourceType() {\n    }\n\n    @Inject\n    public TextResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return IMAGE;\n    }\n\n    @Override\n    public String getDescription() {\n        String desc = EditorsConstants.INSTANCE.textResourceTypeDescription();\n        if (desc == null || desc.isEmpty()) {\n            return super.getDescription();\n        }\n        return desc;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/java/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.core.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * Editors Widgets I18N constants\n */\npublic interface EditorsConstants\n        extends\n        Messages {\n\n    EditorsConstants INSTANCE = GWT.create(EditorsConstants.class);\n\n    String MetaFileEditor();\n\n    String EmptyEntry();\n\n    String textResourceTypeDescription();\n\n    String TextEditor();\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/UberfireWidgetsEditors.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.ext.widgets.core.UberfireWidgetsCore\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireAceEditor\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nMetaFileEditor=Meta File Editor\nEmptyEntry=-- empty --\ntextResourceTypeDescription=Text\nTextEditor=Text Editor"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_de.properties",
    "content": "MetaFileEditor=Meta Datei Editor\nEmptyEntry=-- leer --\ntextResourceTypeDescription=Text\nTextEditor=Texteditor"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nMetaFileEditor=Editor de metarchivos\nEmptyEntry=-- vacío --\ntextResourceTypeDescription=Texto\nTextEditor=Editor de texto"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nMetaFileEditor=Éditeur de métafichier\nEmptyEntry=-- vide --\ntextResourceTypeDescription=Texte\nTextEditor=Éditeur de texte"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nMetaFileEditor=Editor di file meta\nEmptyEntry=-- vuoto --\ntextResourceTypeDescription=Testo\nTextEditor=Editor di testo\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nMetaFileEditor=メタファイルエディター\nEmptyEntry=--  空 --\ntextResourceTypeDescription=テキスト\nTextEditor=テキストエディター"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_pt_BR.properties",
    "content": "MetaFileEditor=Editor de Arquivo Meta\nEmptyEntry=-- vazio --\ntextResourceTypeDescription=Texto\nTextEditor=Editor de Texto"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-core/uberfire-widgets-core-editors/src/main/resources/org/uberfire/ext/widgets/core/client/resources/i18n/EditorsConstants_zh_CN.properties",
    "content": "MetaFileEditor=元文件编辑器\nEmptyEntry=-- empty --\ntextResourceTypeDescription=文本\nTextEditor=文本编辑器"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-properties-editor</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Properties Editor Widget</name>\n\n  <modules>\n    <module>uberfire-widgets-properties-editor-api</module>\n    <module>uberfire-widgets-properties-editor-backend</module>\n    <module>uberfire-widgets-properties-editor-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-properties-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n\n  <name>Uberfire Properties Editor Widget API</name>\n  <description>Uberfire Properties Editor Widget API</description>\n\n  <dependencies>\n    <!-- Project Dependencies -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/CustomPropertyEditorFieldInfo.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\npublic class CustomPropertyEditorFieldInfo extends PropertyEditorFieldInfo {\n\n    private Class<?> customEditorClass;\n\n    public CustomPropertyEditorFieldInfo(String label,\n                                         String stringValue,\n                                         Class<?> customEditorClass) {\n        super(label,\n              stringValue,\n              PropertyEditorType.CUSTOM);\n        this.customEditorClass = customEditorClass;\n    }\n\n    public Class<?> getCustomEditorClass() {\n        return customEditorClass;\n    }\n\n    public void setCustomEditorClass(Class<?> customEditorClass) {\n        this.customEditorClass = customEditorClass;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\n/**\n * A grouping of PropertyEditorFieldInfo in a property editor.\n * The priority value is used to sort the categories. (lower values toward the beginning).\n */\npublic class PropertyEditorCategory {\n\n    private String name;\n    private int priority = Integer.MAX_VALUE;\n    private List<PropertyEditorFieldInfo> fields = new ArrayList<PropertyEditorFieldInfo>();\n    private String idEvent;\n\n    public PropertyEditorCategory() {\n\n    }\n\n    public PropertyEditorCategory(String name) {\n        this.name = checkNotNull(\"name\",\n                                 name);\n    }\n\n    public PropertyEditorCategory(String name,\n                                  int priority) {\n        this.name = checkNotNull(\"name\",\n                                 name);\n        this.priority = checkNotNull(\"name\",\n                                     priority);\n    }\n\n    /**\n     * Add a field to a PropertyEditorCategory\n     */\n    public PropertyEditorCategory withField(PropertyEditorFieldInfo field) {\n        checkNotNull(\"field\",\n                     field);\n        field.setPropertyEditorCategory(this);\n        fields.add(field);\n        return this;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public int getPriority() {\n        return priority;\n    }\n\n    public List<PropertyEditorFieldInfo> getFields() {\n        return fields;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? name.hashCode() : 0;\n        result = 31 * result + priority;\n        result = 31 * result + (fields != null ? fields.hashCode() : 0);\n        return result;\n    }\n\n    public String getIdEvent() {\n        return idEvent;\n    }\n\n    public void setIdEvent(String idEvent) {\n        this.idEvent = idEvent;\n    }\n\n    public void undo() {\n        fields.forEach(field -> field.undo());\n    }\n\n    @Override\n    public String toString() {\n        return \"PropertyEditorCategory{\" +\n                \"name=\" + name +\n                \", priority=\" + priority +\n                \", fields=\" + fields +\n                \", idEvent=\" + idEvent +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorChangeEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\n/**\n * A Property Editor CDI event.\n * Class that groups a PropertyEditorChangeEvent information.\n * This event is fired by property editor when a fields has its value changed.\n */\npublic class PropertyEditorChangeEvent {\n\n    private final PropertyEditorFieldInfo property;\n    private final String newValue;\n    private final String idEvent;\n\n    /**\n     * Creates a new PropertyEditorChangeEvent\n     * @param property the property changed\n     * @param newValue the new  value of the field\n     */\n    public PropertyEditorChangeEvent(PropertyEditorFieldInfo property,\n                                     String newValue) {\n        this.idEvent = property.getEventId();\n        this.property = property;\n        this.newValue = newValue;\n    }\n\n    public PropertyEditorFieldInfo getProperty() {\n        return property;\n    }\n\n    public String getNewValue() {\n        return newValue;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.List;\n\nimport static java.util.Collections.sort;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A Property Editor CDI Event handled by Property Editor.\n * Id event its a parameter to identify the originator of the event.\n * A Property Editor event contains one or multiples PropertyEditorCategory.\n */\npublic class PropertyEditorEvent {\n\n    private List<PropertyEditorCategory> properties = new ArrayList<PropertyEditorCategory>();\n\n    public PropertyEditorEvent(String idEvent,\n                               List<PropertyEditorCategory> properties) {\n        checkNotNull(\"idEvent\",\n                     idEvent);\n        checkNotNull(\"properties\",\n                     properties);\n        for (PropertyEditorCategory property : properties) {\n            property.setIdEvent(idEvent);\n        }\n        this.properties = properties;\n    }\n\n    public PropertyEditorEvent(String idEvent,\n                               PropertyEditorCategory property) {\n        checkNotNull(\"idEvent\",\n                     idEvent);\n        checkNotNull(\"property\",\n                     property);\n        property.setIdEvent(idEvent);\n        this.properties.add(property);\n    }\n\n    private static void sortCategoriesAndFieldsByPriority(List<PropertyEditorCategory> properties) {\n        sortCategoriesByPriority(properties);\n\n        sortEditorFieldInfoByPriority(properties);\n    }\n\n    private static void sortCategoriesByPriority(List<PropertyEditorCategory> properties) {\n        sort(properties,\n             new Comparator<PropertyEditorCategory>() {\n                 @Override\n                 public int compare(final PropertyEditorCategory o1,\n                                    final PropertyEditorCategory o2) {\n\n                     if (o1.getPriority() < o2.getPriority()) {\n                         return -1;\n                     } else if (o1.getPriority() > o2.getPriority()) {\n                         return 1;\n                     } else {\n                         return 0;\n                     }\n                 }\n             });\n    }\n\n    private static void sortEditorFieldInfoByPriority(List<PropertyEditorCategory> properties) {\n        for (PropertyEditorCategory category : properties) {\n            sort(category.getFields(),\n                 new Comparator<PropertyEditorFieldInfo>() {\n                     @Override\n                     public int compare(final PropertyEditorFieldInfo o1,\n                                        final PropertyEditorFieldInfo o2) {\n\n                         if (o1.getPriority() < o2.getPriority()) {\n                             return -1;\n                         } else if (o1.getPriority() > o2.getPriority()) {\n                             return 1;\n                         } else {\n                             return 0;\n                         }\n                     }\n                 });\n        }\n    }\n\n    /**\n     * Get Properties from a event ordered by priority.\n     *\n     * @return Categories and fields ordered by priority, lower values toward the beginning\n     */\n    public List<PropertyEditorCategory> getSortedProperties() {\n        sortCategoriesAndFieldsByPriority(properties);\n        return properties;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorFieldInfo.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\n/**\n * In Property Editor, PropertyEditorFieldInfo is a child of PropertyEditorCategory.\n * One PropertyEditorCategory contains multiple PropertyEditorFieldInfo.\n */\npublic class PropertyEditorFieldInfo {\n\n    private String label;\n    private String currentStringValue;\n    private String originalValue;\n    private PropertyEditorCategory category;\n    private PropertyEditorType type;\n    private List<String> comboValues;\n    private int priority = Integer.MAX_VALUE;\n    private List<PropertyFieldValidator> validators = new ArrayList<PropertyFieldValidator>();\n    private String key;\n    private boolean isRemovalSupported = false;\n    private String helpHeading;\n    private String helpText;\n    private List<PropertyEditorFieldOption> options = new ArrayList<>();\n\n    public PropertyEditorFieldInfo() {\n    }\n\n    /**\n     * Create a PropertyEditorFieldInfo\n     *\n     * @param label field descriptor\n     * @param type  Property Editor Type of this field\n     */\n    public PropertyEditorFieldInfo(String label,\n                                   PropertyEditorType type) {\n        this.label = checkNotNull(\"label\",\n                                  label);\n        this.originalValue = currentStringValue;\n        this.type = checkNotNull(\"type\",\n                                 type);\n        this.validators.addAll(type.getValidators());\n    }\n\n    /**\n     * Create a PropertyEditorFieldInfo\n     *\n     * @param label              field descriptor\n     * @param type               Property Editor Type of this field\n     * @param currentStringValue Current value of this field\n     */\n    public PropertyEditorFieldInfo(String label,\n                                   String currentStringValue,\n                                   PropertyEditorType type) {\n        this.label = checkNotNull(\"label\",\n                                  label);\n        this.currentStringValue = checkNotNull(\"currentStringValue\",\n                                               currentStringValue);\n        this.originalValue = currentStringValue;\n        this.type = checkNotNull(\"type\",\n                                 type);\n        this.validators.addAll(type.getValidators());\n    }\n\n    /**\n     * Key is a helper to identify a field. Sometimes labels can have complex descriptions.\n     * This key is a nice way to identify a property in a PropertyEditorChangeEvent.\n     *\n     * @param key\n     */\n    public PropertyEditorFieldInfo withKey(String key) {\n        this.key = checkNotNull(\"key\",\n                                key);\n        return this;\n    }\n\n    /**\n     * Combo values used in PropertyEditorType.COMBO fields.\n     *\n     * @param comboValues a list of combo values\n     */\n    public PropertyEditorFieldInfo withComboValues(List<String> comboValues) {\n        this.comboValues = checkNotNull(\"comboValues\",\n                                        comboValues);\n        return this;\n    }\n\n    /**\n     * The priority value is used to sort the categories (lower values toward the beginning).\n     *\n     * @param priority\n     * @return\n     */\n    public PropertyEditorFieldInfo withPriority(int priority) {\n        this.priority = checkNotNull(\"priority\",\n                                     priority);\n        return this;\n    }\n\n    public PropertyEditorFieldInfo withHelpInfo(String helpHeading,\n                                                String helpText) {\n        this.helpHeading = helpHeading;\n        this.helpText = helpText;\n        return this;\n    }\n\n    /**\n     * Add validators to a specific field. This validators are executed before the change event.\n     *\n     * @param validators\n     * @return\n     */\n    public PropertyEditorFieldInfo withValidators(PropertyFieldValidator... validators) {\n        checkNotNull(\"validators\",\n                     validators);\n        for (PropertyFieldValidator field : validators) {\n            this.validators.add(field);\n        }\n        return this;\n    }\n\n    public PropertyEditorFieldInfo withValidators(Collection<PropertyFieldValidator> validators) {\n        checkNotNull(\"validators\",\n                     validators);\n        for (PropertyFieldValidator field : validators) {\n            this.validators.add(field);\n        }\n        return this;\n    }\n\n    public PropertyEditorFieldInfo withRemovalSupported(boolean isRemovalSupported) {\n        this.isRemovalSupported = isRemovalSupported;\n        return this;\n    }\n\n    public PropertyEditorFieldInfo withOptions(PropertyEditorFieldOption... options) {\n        checkNotNull(\"options\",\n                     options);\n        for (PropertyEditorFieldOption option : options) {\n            this.options.add(option);\n        }\n        return this;\n    }\n\n    public void undo() {\n        currentStringValue = originalValue;\n    }\n\n    public List<String> getComboValues() {\n        return comboValues;\n    }\n\n    public PropertyEditorType getType() {\n        return type;\n    }\n\n    public String getOriginalValue() {\n        return originalValue;\n    }\n\n    public String getCurrentStringValue() {\n        return currentStringValue;\n    }\n\n    public void setCurrentStringValue(String currentStringValue) {\n        this.currentStringValue = currentStringValue;\n    }\n\n    public boolean isRemovalSupported() {\n        return isRemovalSupported;\n    }\n\n    public boolean hasHelpInfo() {\n        return helpHeading != null && helpText != null;\n    }\n\n    public void setPropertyEditorCategory(PropertyEditorCategory category) {\n        this.category = category;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public int getPriority() {\n        return priority;\n    }\n\n    public List<PropertyFieldValidator> getValidators() {\n        return validators;\n    }\n\n    public String getEventId() {\n        return category.getIdEvent();\n    }\n\n    public String getKey() {\n        return key;\n    }\n\n    public String getHelpHeading() {\n        return helpHeading;\n    }\n\n    public String getHelpText() {\n        return helpText;\n    }\n\n    public List<PropertyEditorFieldOption> getOptions() {\n        return options;\n    }\n\n    @Override\n    public String toString() {\n        return \"PropertyEditorFieldInfo{\" +\n                \"label=\" + label +\n                \", currentStringValue=\" + currentStringValue +\n                \", originalValue=\" + originalValue +\n                \", category=\" + category +\n                \", type=\" + type +\n                \", comboValues=\" + comboValues +\n                \", priority=\" + priority +\n                \", validators=\" + validators +\n                \", key=\" + key +\n                '}';\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorFieldOption.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\npublic enum PropertyEditorFieldOption {\n\n    DISABLED\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyEditorType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.properties.editor.model.validators.ColorValidator;\nimport org.uberfire.ext.properties.editor.model.validators.LongValidator;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\n/**\n * PropertyEditorType define the type of a PropertyEditorField\n */\npublic enum PropertyEditorType {\n\n    TEXT {\n        @Override\n        public boolean isType(Class<?> type) {\n            return isString(type) || isFloat(type) || isDouble(type);\n        }\n\n        private boolean isFloat(Class<?> type) {\n            return (type.equals(Float.class) || (type.toString().equalsIgnoreCase(\"float\")));\n        }\n\n        private boolean isDouble(Class<?> type) {\n            return (type.equals(Double.class) || (type.toString().equalsIgnoreCase(\"double\")));\n        }\n\n        private boolean isString(Class<?> type) {\n            return type.equals(String.class);\n        }\n    },\n    BOOLEAN {\n        @Override\n        public boolean isType(Class<?> type) {\n            return (type.equals(Boolean.class) || (type.toString().equalsIgnoreCase(\"boolean\")));\n        }\n    },\n    NATURAL_NUMBER {\n        @Override\n        public List<PropertyFieldValidator> getValidators() {\n            ArrayList validators = new ArrayList();\n            validators.add(new LongValidator());\n            return validators;\n        }\n\n        @Override\n        public boolean isType(Class<?> type) {\n            return isInteger(type) || isLong(type) || isShort(type);\n        }\n\n        private boolean isShort(Class<?> type) {\n            return (type.equals(Short.class) || (type.toString().equalsIgnoreCase(\"short\")));\n        }\n\n        private boolean isLong(Class<?> type) {\n            return (type.equals(Long.class) || (type.toString().equalsIgnoreCase(\"long\")));\n        }\n\n        private boolean isInteger(Class<?> type) {\n            return (type.equals(Integer.class) || (type.toString().equalsIgnoreCase(\"int\")));\n        }\n    },\n    COMBO {\n        @Override\n        public boolean isType(Class<?> type) {\n            return type.isEnum();\n        }\n    },\n    SECRET_TEXT {\n\n    },\n    COLOR {\n        public List<PropertyFieldValidator> getValidators() {\n            ArrayList validators = new ArrayList();\n            validators.add(new ColorValidator());\n            return validators;\n        }\n    },\n    CUSTOM {\n\n    };\n\n    public static PropertyEditorType getFromType(Class<?> type) {\n        for (PropertyEditorType candidate : PropertyEditorType.values()) {\n            if (candidate.isType(type)) {\n                return candidate;\n            }\n        }\n        return null;\n    }\n\n    public boolean isType(Class<?> type) {\n        return false;\n    }\n\n    public List<PropertyFieldValidator> getValidators() {\n        return new ArrayList();\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/PropertyUtils.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.List;\nimport java.util.Map;\n\npublic class PropertyUtils {\n\n    public static PropertyEditorCategory convertMapToCategory(Map<String, List<String>> map) {\n        if (map != null && !map.keySet().isEmpty()) {\n            String categoryName = map.keySet().iterator().next();\n            PropertyEditorCategory category = new PropertyEditorCategory(categoryName);\n            List<String> fields = map.get(categoryName);\n            for (String field : fields) {\n                category.withField(new PropertyEditorFieldInfo(field,\n                                                               PropertyEditorType.TEXT));\n            }\n\n            return category;\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/validators/ColorValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ColorValidator implements PropertyFieldValidator {\n\n    public static final List<Character> _hexLetters = Arrays.asList('a',\n                                                                    'b',\n                                                                    'c',\n                                                                    'd',\n                                                                    'e',\n                                                                    'f');\n\n    public static boolean isValid(String aColor) {\n        try {\n            String color = aColor.trim().toLowerCase();\n            if (color.length() != 6) {\n                return false;\n            }\n\n            for (int i = 0; i < color.length(); i++) {\n                char c = color.charAt(i);\n                if (!Character.isDigit(c) && !_hexLetters.contains(c)) {\n                    return false;\n                }\n            }\n            return true;\n        } catch (Exception e) {\n            return false;\n        }\n    }\n\n    @Override\n    public boolean validate(Object value) {\n        if (value == null) {\n            return false;\n        }\n        return isValid(value.toString());\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Value must be valid color. Example: 'FFFFFF'\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/validators/LongValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class LongValidator implements PropertyFieldValidator {\n\n    @Override\n    public boolean validate(Object value) {\n        try {\n            Long.parseLong(value.toString());\n            return true;\n        } catch (Exception e) {\n            return false;\n        }\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Value must be a number.\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/validators/MandatoryValidator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class MandatoryValidator implements PropertyFieldValidator {\n\n    @Override\n    public boolean validate(Object value) {\n        return value != null && !value.toString().trim().isEmpty();\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Field is mandatory.\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/validators/PropertyFieldValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\n/**\n * A validator of PropertyEditorFields. A field can contain multiples validators.\n */\npublic interface PropertyFieldValidator {\n\n    /**\n     * Validate a field new value\n     * @param value\n     * The value to be validated\n     * @return\n     * true if valid, false otherwise\n     */\n    public boolean validate(Object value);\n\n    /**\n     * Error message used in property editor.\n     * @return\n     */\n    public String getValidatorErrorMessage();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/model/validators/TextValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class TextValidator implements PropertyFieldValidator {\n\n    @Override\n    public boolean validate(Object value) {\n        if (value.toString().length() > 3) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Invalid Text data.\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/java/org/uberfire/ext/properties/editor/service/BeanPropertyEditorBuilderService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\n\n@Remote\npublic interface BeanPropertyEditorBuilderService {\n\n    PropertyEditorCategory extract(String fqcn);\n\n    PropertyEditorCategory extract(String fqcn,\n                                   Object instance);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/main/resources/org/uberfire/ext/properties/editor/PropertiesEditorAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n\n  <source path='model'/>\n  <source path='service'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/test/java/org/uberfire/ext/properties/editor/model/PropertyEditorEventTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class PropertyEditorEventTest {\n\n    @Test\n    public void sortCategoryByPriority() {\n        List<PropertyEditorCategory> categories = new ArrayList<PropertyEditorCategory>();\n        PropertyEditorCategory category1 = new PropertyEditorCategory(\"cat1\",\n                                                                      2);\n        categories.add(category1);\n        PropertyEditorCategory category2 = new PropertyEditorCategory(\"catHighPriority\",\n                                                                      1);\n        categories.add(category2);\n        PropertyEditorEvent event = new PropertyEditorEvent(\"event\",\n                                                            categories);\n        assertEquals(category2,\n                     event.getSortedProperties().get(0));\n        assertEquals(category1,\n                     event.getSortedProperties().get(1));\n    }\n\n    @Test\n    public void sortFieldsByPriority() {\n        PropertyEditorFieldInfo highPriority = new PropertyEditorFieldInfo(\"highPriority\",\n                                                                           PropertyEditorType.BOOLEAN).withPriority(1);\n        PropertyEditorFieldInfo lowPriority = new PropertyEditorFieldInfo(\"lowPriority\",\n                                                                          PropertyEditorType.BOOLEAN).withPriority(10);\n        PropertyEditorCategory category = new PropertyEditorCategory(\"cat1\",\n                                                                     2)\n                .withField(lowPriority)\n                .withField(highPriority);\n\n        PropertyEditorEvent event = new PropertyEditorEvent(\"event\",\n                                                            category);\n        assertEquals(highPriority,\n                     event.getSortedProperties().get(0).getFields().get(0));\n        assertEquals(lowPriority,\n                     event.getSortedProperties().get(0).getFields().get(1));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/test/java/org/uberfire/ext/properties/editor/model/PropertyUtilsTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class PropertyUtilsTest {\n\n    @Test\n    public void convertMapToCategoryNullCase() {\n        assertNull(PropertyUtils.convertMapToCategory(null));\n        assertNull(PropertyUtils.convertMapToCategory(new HashMap<String, List<String>>()));\n    }\n\n    @Test\n    public void convertMapToCategory() {\n\n        HashMap<String, List<String>> categoryMap = new HashMap<String, List<String>>();\n        List<String> categoryFields = new ArrayList<String>();\n        categoryFields.add(\"field1\");\n        categoryFields.add(\"field2\");\n        categoryMap.put(\"Category1\",\n                        categoryFields);\n\n        PropertyEditorCategory category = PropertyUtils.convertMapToCategory(categoryMap);\n        assertNotNull(category);\n        assertEquals(category.getFields().size(),\n                     2);\n        assertEquals(category.getFields().get(0).getLabel(),\n                     \"field1\");\n        assertEquals(category.getFields().get(1).getLabel(),\n                     \"field2\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-api/src/test/java/org/uberfire/ext/properties/editor/model/validators/MandatoryValidatorTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.model.validators;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class MandatoryValidatorTest {\n    \n    private MandatoryValidator validator;\n\n    @Before\n    public void setup() {\n        validator = new MandatoryValidator();\n    }\n    \n    @Test\n    public void testValid() {\n        assertTrue(validator.validate(\"valid\"));\n    }\n    \n    @Test\n    public void testNotValid() {\n        assertFalse(validator.validate(\"\"));\n        assertFalse(validator.validate(\"          \"));\n        assertFalse(validator.validate(null));\n    }\n\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-properties-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-properties-editor-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Properties Editor Widget Backend</name>\n  <description>Uberfire Properties Editor Widget Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/main/java/org/uberfire/ext/properties/editor/server/BeanPropertyEditorBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server;\n\nimport java.lang.reflect.Field;\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.properties.editor.service.BeanPropertyEditorBuilderService;\n\n@Service\n@Dependent\npublic class BeanPropertyEditorBuilder implements BeanPropertyEditorBuilderService {\n\n    @Override\n    public PropertyEditorCategory extract(String fqcn) {\n        return extractOnlyBeanInfo(fqcn);\n    }\n\n    @Override\n    public PropertyEditorCategory extract(String fqcn,\n                                          Object instance) {\n        return extractBeanInfoAndValues(fqcn,\n                                        instance);\n    }\n\n    private PropertyEditorCategory extractOnlyBeanInfo(String fqcn) {\n        return extractBeanInfoAndValues(fqcn,\n                                        null);\n    }\n\n    private PropertyEditorCategory extractBeanInfoAndValues(String fqcn,\n                                                            Object instance) {\n        Class targetClass;\n        try {\n            targetClass = Class.forName(fqcn);\n        } catch (Exception e) {\n            throw new NullBeanException(\"No bean found for FQCN: \" + fqcn);\n        }\n\n        PropertyEditorCategory beanCategory = new PropertyEditorCategory(targetClass.getSimpleName());\n        extractFieldInformationAndValues(targetClass,\n                                         beanCategory,\n                                         instance);\n        return beanCategory;\n    }\n\n    private void extractFieldInformationAndValues(Class targetClass,\n                                                  PropertyEditorCategory beanCategory,\n                                                  Object instance) throws ErrorReadingFieldInformationAndValues {\n        for (Field declaredField : targetClass.getDeclaredFields()) {\n            PropertyEditorType type = PropertyEditorType.getFromType(declaredField.getType());\n            if (isAHandledType(type)) {\n                PropertyEditorFieldInfo field = createPropertyEditorInfo(instance,\n                                                                         declaredField,\n                                                                         type);\n                if (isACombo(field)) {\n                    generateComboValues(declaredField,\n                                        field);\n                }\n                beanCategory.withField(field);\n            }\n        }\n    }\n\n    private PropertyEditorFieldInfo createPropertyEditorInfo(Object instance,\n                                                             Field declaredField,\n                                                             PropertyEditorType type) {\n        if (needToExtractValues(instance)) {\n            return new PropertyEditorFieldInfo(declaredField.getName(),\n                                               extractFieldValue(instance,\n                                                                 declaredField),\n                                               type);\n        } else {\n            return new PropertyEditorFieldInfo(declaredField.getName(),\n                                               type);\n        }\n    }\n\n    private boolean needToExtractValues(Object instance) {\n        return instance != null;\n    }\n\n    private boolean isACombo(PropertyEditorFieldInfo field) {\n        return field.getType().equals(PropertyEditorType.COMBO);\n    }\n\n    private String extractFieldValue(Object instance,\n                                     Field field) {\n        try {\n            return extractStringValue(instance,\n                                      field);\n        } catch (IllegalAccessException e) {\n            throw new ErrorReadingFieldInformationAndValues();\n        }\n    }\n\n    private String extractStringValue(Object instance,\n                                      Field field) throws IllegalAccessException {\n        field.setAccessible(true);\n        Object value = field.get(instance);\n        if (value != null) {\n            return value.toString();\n        } else {\n            return \"\";\n        }\n    }\n\n    private void generateComboValues(Field declaredField,\n                                     PropertyEditorFieldInfo field) {\n        List<String> values = new ArrayList<String>();\n        for (Object constant : declaredField.getType().getEnumConstants()) {\n            values.add(constant.toString());\n        }\n        field.withComboValues(values);\n    }\n\n    public boolean isAHandledType(PropertyEditorType type) {\n        return type != null;\n    }\n\n    public class NullBeanException extends RuntimeException {\n\n        public NullBeanException() {\n        }\n\n        public NullBeanException(String message) {\n            super(message);\n        }\n    }\n\n    private class ErrorReadingFieldInformationAndValues extends RuntimeException {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/test/java/org/uberfire/ext/properties/editor/server/BeanPropertyEditorBuilderTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.properties.editor.server.beans.ComplexPlanBean;\nimport org.uberfire.ext.properties.editor.server.beans.SampleEnum;\nimport org.uberfire.ext.properties.editor.server.beans.SamplePlanBean;\nimport org.uberfire.ext.properties.editor.server.beans.UnknownTypesBean;\n\nimport static org.junit.Assert.*;\n\npublic class BeanPropertyEditorBuilderTest {\n\n    @Test\n    public void samplePlanBean_shouldGenerateCategory() throws ClassNotFoundException {\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.SamplePlanBean\");\n        assertTrue(!category.getFields().isEmpty());\n        assertProperty(category.getFields().get(0),\n                       \"text1\",\n                       PropertyEditorType.TEXT);\n        assertProperty(category.getFields().get(1),\n                       \"text2\",\n                       PropertyEditorType.TEXT);\n    }\n\n    @Test(expected = BeanPropertyEditorBuilder.NullBeanException.class)\n    public void noBean_shouldGenerateException() {\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(null);\n    }\n\n    @Test\n    public void samplePlanBeanAndInstance_shouldGenerateCategoryAndValues() throws ClassNotFoundException {\n\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.SamplePlanBean\",\n                                                          new SamplePlanBean(\"value1\",\n                                                                             \"value2\"));\n        assertTrue(!category.getFields().isEmpty());\n\n        PropertyEditorFieldInfo field1 = category.getFields().get(0);\n        PropertyEditorFieldInfo fiedl2 = category.getFields().get(1);\n        assertProperty(field1,\n                       \"text1\",\n                       PropertyEditorType.TEXT,\n                       \"value1\");\n        assertProperty(fiedl2,\n                       \"text2\",\n                       PropertyEditorType.TEXT,\n                       \"value2\");\n    }\n\n    @Test\n    public void complexPlanBean_shouldGenerateCategory() throws ClassNotFoundException {\n\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.ComplexPlanBean\");\n        assertTrue(!category.getFields().isEmpty());\n\n        PropertyEditorFieldInfo text = category.getFields().get(0);\n        PropertyEditorFieldInfo bool = category.getFields().get(1);\n        PropertyEditorFieldInfo bool2 = category.getFields().get(2);\n        PropertyEditorFieldInfo integer = category.getFields().get(3);\n        PropertyEditorFieldInfo inti = category.getFields().get(4);\n        PropertyEditorFieldInfo lon = category.getFields().get(5);\n        PropertyEditorFieldInfo plong = category.getFields().get(6);\n        PropertyEditorFieldInfo enumSample = category.getFields().get(7);\n        List<String> enumValues = new ArrayList<String>();\n        enumValues.add(SampleEnum.VALUE1.toString());\n        enumValues.add(SampleEnum.VALUE2.toString());\n        enumValues.add(SampleEnum.VALUE3.toString());\n\n        assertProperty(text,\n                       \"text\",\n                       PropertyEditorType.TEXT);\n        assertProperty(bool,\n                       \"bool\",\n                       PropertyEditorType.BOOLEAN);\n        assertProperty(bool2,\n                       \"bool2\",\n                       PropertyEditorType.BOOLEAN);\n        assertProperty(integer,\n                       \"integ\",\n                       PropertyEditorType.NATURAL_NUMBER);\n        assertProperty(inti,\n                       \"inti\",\n                       PropertyEditorType.NATURAL_NUMBER);\n        assertProperty(lon,\n                       \"lon\",\n                       PropertyEditorType.NATURAL_NUMBER);\n        assertProperty(plong,\n                       \"plong\",\n                       PropertyEditorType.NATURAL_NUMBER);\n        assertProperty(enumSample,\n                       \"enumSample\",\n                       PropertyEditorType.COMBO);\n\n        assertEnumValues(enumSample,\n                         enumValues);\n    }\n\n    @Test\n    public void complexPlanBean_shouldGenerateCategoryAndValues() throws ClassNotFoundException {\n\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        ComplexPlanBean instance = new ComplexPlanBean(\"texto\",\n                                                       true,\n                                                       true,\n                                                       1,\n                                                       1,\n                                                       1l,\n                                                       1,\n                                                       SampleEnum.VALUE2);\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.ComplexPlanBean\",\n                                                          instance);\n        assertTrue(!category.getFields().isEmpty());\n\n        PropertyEditorFieldInfo text = category.getFields().get(0);\n        PropertyEditorFieldInfo bool = category.getFields().get(1);\n        PropertyEditorFieldInfo bool2 = category.getFields().get(2);\n        PropertyEditorFieldInfo integer = category.getFields().get(3);\n        PropertyEditorFieldInfo inti = category.getFields().get(4);\n        PropertyEditorFieldInfo lon = category.getFields().get(5);\n        PropertyEditorFieldInfo plong = category.getFields().get(6);\n        PropertyEditorFieldInfo enumSample = category.getFields().get(7);\n        List<String> enumValues = new ArrayList<String>();\n        enumValues.add(SampleEnum.VALUE1.toString());\n        enumValues.add(SampleEnum.VALUE2.toString());\n        enumValues.add(SampleEnum.VALUE3.toString());\n\n        assertProperty(text,\n                       \"text\",\n                       PropertyEditorType.TEXT,\n                       \"texto\");\n        assertProperty(bool,\n                       \"bool\",\n                       PropertyEditorType.BOOLEAN,\n                       \"true\");\n        assertProperty(bool2,\n                       \"bool2\",\n                       PropertyEditorType.BOOLEAN,\n                       \"true\");\n        assertProperty(integer,\n                       \"integ\",\n                       PropertyEditorType.NATURAL_NUMBER,\n                       \"1\");\n        assertProperty(inti,\n                       \"inti\",\n                       PropertyEditorType.NATURAL_NUMBER,\n                       \"1\");\n        assertProperty(lon,\n                       \"lon\",\n                       PropertyEditorType.NATURAL_NUMBER,\n                       \"1\");\n        assertProperty(plong,\n                       \"plong\",\n                       PropertyEditorType.NATURAL_NUMBER,\n                       \"1\");\n        assertProperty(enumSample,\n                       \"enumSample\",\n                       PropertyEditorType.COMBO,\n                       \"VALUE2\");\n\n        assertEnumValues(enumSample,\n                         enumValues);\n    }\n\n    @Test\n    public void shouldNotGenerateUnhandledTypes() throws ClassNotFoundException {\n\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.UnknownTypesBean\",\n                                                          new UnknownTypesBean());\n        assertTrue(category.getFields().isEmpty());\n\n        category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.UnknownTypesBean\");\n        assertTrue(category.getFields().isEmpty());\n    }\n\n    private void assertEnumValues(PropertyEditorFieldInfo enumSample,\n                                  List<String> enumValues) {\n        assertEquals(enumValues.size(),\n                     enumSample.getComboValues().size());\n        for (int i = 0; i < enumValues.size(); i++) {\n            assertEquals(enumSample.getComboValues().get(i),\n                         enumValues.get(i));\n        }\n    }\n\n    @Test\n    public void nullValuesOnInstanceShouldGenerateEmptyStrings() throws ClassNotFoundException {\n\n        BeanPropertyEditorBuilder builder = new BeanPropertyEditorBuilder();\n        PropertyEditorCategory category = builder.extract(\"org.uberfire.ext.properties.editor.server.beans.SamplePlanBean\",\n                                                          new SamplePlanBean(null,\n                                                                             null));\n        assertTrue(!category.getFields().isEmpty());\n\n        PropertyEditorFieldInfo field1 = category.getFields().get(0);\n        PropertyEditorFieldInfo fiedl2 = category.getFields().get(1);\n\n        assertProperty(field1,\n                       \"text1\",\n                       PropertyEditorType.TEXT,\n                       \"\");\n\n        assertProperty(fiedl2,\n                       \"text2\",\n                       PropertyEditorType.TEXT,\n                       \"\");\n    }\n\n    private void assertProperty(PropertyEditorFieldInfo fieldInfo,\n                                String label,\n                                PropertyEditorType type,\n                                String expectedValue) {\n        assertProperty(fieldInfo,\n                       label,\n                       type);\n        assertEquals(expectedValue,\n                     fieldInfo.getCurrentStringValue());\n    }\n\n    private void assertProperty(PropertyEditorFieldInfo fieldInfo,\n                                String label,\n                                PropertyEditorType type) {\n        assertEquals(label,\n                     fieldInfo.getLabel());\n        assertEquals(type,\n                     fieldInfo.getType());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/test/java/org/uberfire/ext/properties/editor/server/beans/ComplexPlanBean.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server.beans;\n\n\npublic class ComplexPlanBean {\n\n    private String text;\n    private boolean bool;\n    private Boolean bool2;\n    private Integer integ;\n    private int inti;\n    private Long lon;\n    private long plong;\n    private SampleEnum enumSample;\n\n\n\n    public ComplexPlanBean(){};\n\n    public ComplexPlanBean( String text,\n                            boolean bool,\n                            boolean bool2,\n                            Integer integ,\n                            int inti,\n                            long lon,\n                            long plong,\n                            SampleEnum enumSample ) {\n        this.text = text;\n        this.bool = bool;\n        this.bool2 = bool2;\n        this.integ = integ;\n        this.inti = inti;\n        this.lon = lon;\n        this.plong = plong;\n        this.enumSample = enumSample;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/test/java/org/uberfire/ext/properties/editor/server/beans/SampleEnum.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server.beans;\n\npublic enum SampleEnum {\n\n    VALUE1,VALUE2,VALUE3;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/test/java/org/uberfire/ext/properties/editor/server/beans/SamplePlanBean.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server.beans;\n\n\npublic class SamplePlanBean {\n\n    private String text1;\n    String text2;\n\n    public SamplePlanBean( String text1,\n                           String text2 ) {\n\n        this.text1 = text1;\n        this.text2 = text2;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-backend/src/test/java/org/uberfire/ext/properties/editor/server/beans/UnknownTypesBean.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.server.beans;\n\n\npublic class UnknownTypesBean {\n\n    private SamplePlanBean bean1;\n    private SamplePlanBean bean2;\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-properties-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n\n  <name>Uberfire Properties Editor Widget Client</name>\n  <description>Uberfire Properties Editor Widget Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <!-- dependencies added because of new illegal transitive dependency check -->\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <!-- Project Dependencies -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/PropertyEditorHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Column;\nimport org.gwtbootstrap3.client.ui.Container;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.InputGroup;\nimport org.gwtbootstrap3.client.ui.InputGroupButton;\nimport org.gwtbootstrap3.client.ui.Panel;\nimport org.gwtbootstrap3.client.ui.PanelBody;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.gwtbootstrap3.client.ui.Row;\nimport org.gwtbootstrap3.client.ui.constants.ColumnSize;\nimport org.gwtbootstrap3.client.ui.constants.FormType;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.properties.editor.client.fields.AbstractField;\nimport org.uberfire.ext.properties.editor.client.fields.PropertyEditorFieldType;\nimport org.uberfire.ext.properties.editor.client.options.PropertyEditorFieldOptionUtils;\nimport org.uberfire.ext.properties.editor.client.widgets.AbstractPropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorItemLabel;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorItemWidget;\nimport org.uberfire.ext.properties.editor.model.CustomPropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\npublic class PropertyEditorHelper {\n\n    public static void extractEditorFrom(final PropertyEditorWidget propertyEditorWidget,\n                                         final PanelGroup propertyMenu,\n                                         final PropertyEditorEvent event,\n                                         final String propertyNameFilter) {\n        propertyMenu.clear();\n        for (PropertyEditorCategory category : event.getSortedProperties()) {\n            createCategory(propertyEditorWidget,\n                           propertyMenu,\n                           category,\n                           propertyNameFilter);\n        }\n    }\n\n    static void createCategory(final PropertyEditorWidget propertyEditorWidget,\n                               final PanelGroup propertyMenu,\n                               final PropertyEditorCategory category,\n                               final String propertyNameFilter) {\n\n        Panel panel = GWT.create(Panel.class);\n        PanelCollapse panelCollapse = createPanelCollapse(propertyEditorWidget,\n                                                          category);\n        PanelHeader headerPanel = createPanelHeader(category,\n                                                    propertyMenu,\n                                                    panelCollapse);\n        PanelBody panelBody = createPanelBody();\n        Form form = createPanelContent(panelBody);\n\n        boolean categoryHasActiveChilds = false;\n        for (final PropertyEditorFieldInfo field : category.getFields()) {\n            if (isAMatchOfFilter(propertyNameFilter,\n                                 field)) {\n                categoryHasActiveChilds = true;\n                form.add(createItemsWidget(field,\n                                           category,\n                                           form));\n            }\n        }\n        if (categoryHasActiveChilds) {\n            panelCollapse.add(panelBody);\n            panel.add(headerPanel);\n            panel.add(panelCollapse);\n            propertyMenu.add(panel);\n        }\n    }\n\n    static PanelHeader createPanelHeader(final PropertyEditorCategory category,\n                                         final PanelGroup propertyMenu,\n                                         PanelCollapse panelCollapse) {\n\n        final Heading heading = new Heading(HeadingSize.H4);\n        final Anchor anchor = GWT.create(Anchor.class);\n        anchor.setText(category.getName());\n        anchor.setDataToggle(Toggle.COLLAPSE);\n        anchor.setDataParent(propertyMenu.getId());\n        anchor.setDataTargetWidget(panelCollapse);\n        anchor.addStyleName(\"collapsed\");\n        heading.add(anchor);\n\n        final PanelHeader header = GWT.create(PanelHeader.class);\n        header.add(heading);\n        return header;\n    }\n\n    static PanelCollapse createPanelCollapse(final PropertyEditorWidget propertyEditorWidget,\n                                             final PropertyEditorCategory category) {\n        final PanelCollapse collapse = GWT.create(PanelCollapse.class);\n        collapse.addShowHandler(showEvent -> propertyEditorWidget.addExpandedCategory(category.getName()));\n\n        collapse.addHiddenHandler(hiddenEvent -> {\n            hiddenEvent.stopPropagation();\n            propertyEditorWidget.collapseCategory(category.getName());\n        });\n\n        if (propertyEditorWidget.getExpandedCategories().contains(category.getName())) {\n            collapse.setIn(true);\n        }\n\n        return collapse;\n    }\n\n    private static Form createPanelContent(final PanelBody panelBody) {\n        final Container container = GWT.create(Container.class);\n        container.setFluid(true);\n        final Row row = GWT.create(Row.class);\n        final Column column = new Column(ColumnSize.MD_12);\n        final Form form = GWT.create(Form.class);\n        form.setType(FormType.HORIZONTAL);\n        container.add(row);\n        row.add(column);\n        column.add(form);\n        panelBody.add(container);\n        return form;\n    }\n\n    private static PanelBody createPanelBody() {\n        return GWT.create(PanelBody.class);\n    }\n\n    public static void extractEditorFrom(final PropertyEditorWidget propertyEditorWidget,\n                                         final PanelGroup propertyMenu,\n                                         final PropertyEditorEvent event) {\n        extractEditorFrom(propertyEditorWidget,\n                          propertyMenu,\n                          event,\n                          \"\");\n    }\n\n    static PropertyEditorItemsWidget createItemsWidget(final PropertyEditorFieldInfo field,\n                                                       final PropertyEditorCategory category,\n                                                       final Form panelBody) {\n        PropertyEditorItemsWidget items = GWT.create(PropertyEditorItemsWidget.class);\n\n        items.add(createLabel(field));\n        items.add(createField(field,\n                              items,\n                              category,\n                              panelBody));\n\n        return items;\n    }\n\n    static PropertyEditorItemLabel createLabel(final PropertyEditorFieldInfo field) {\n        PropertyEditorItemLabel item = GWT.create(PropertyEditorItemLabel.class);\n        item.setText(field.getLabel());\n        item.setFor(String.valueOf(field.hashCode()));\n        if (field.hasHelpInfo()) {\n            item.setHelpTitle(field.getHelpHeading());\n            item.setHelpContent(field.getHelpText());\n        }\n        return item;\n    }\n\n    static PropertyEditorItemWidget createField(final PropertyEditorFieldInfo field,\n                                                final PropertyEditorItemsWidget parent,\n                                                PropertyEditorCategory category,\n                                                Form panelBody) {\n        PropertyEditorItemWidget itemWidget = GWT.create(PropertyEditorItemWidget.class);\n        InputGroup content = GWT.create(InputGroup.class);\n        HelpBlock helpBlock = GWT.create(HelpBlock.class);\n\n        PropertyEditorFieldType editorFieldType = PropertyEditorFieldType.getFieldTypeFrom(field);\n\n        Widget fieldWidget;\n        if (editorFieldType == PropertyEditorFieldType.CUSTOM) {\n            Class<?> widgetClass = ((CustomPropertyEditorFieldInfo) field).getCustomEditorClass();\n            fieldWidget = getWidget(field,\n                                    widgetClass);\n        } else {\n            fieldWidget = editorFieldType.widget(field);\n        }\n        createErrorHandlingInfraStructure(parent,\n                                          fieldWidget);\n\n        content.add(fieldWidget);\n        content.add(helpBlock);\n        parent.setHelpInline(helpBlock);\n\n        field.getOptions().forEach(option -> PropertyEditorFieldOptionUtils.applyFieldOption(option,\n                                                                                             fieldWidget));\n\n        if (field.isRemovalSupported()) {\n            content.add(createRemoveAddOn(field,\n                                          category,\n                                          parent,\n                                          panelBody));\n        }\n\n        itemWidget.add(content);\n        return itemWidget;\n    }\n\n    private static InputGroupButton createRemoveAddOn(final PropertyEditorFieldInfo field,\n                                                      final PropertyEditorCategory category,\n                                                      final PropertyEditorItemsWidget parent,\n                                                      final Form categoryPanel) {\n        InputGroupButton groupButton = GWT.create(InputGroupButton.class);\n        Button button = GWT.create(Button.class);\n        button.setIcon(IconType.MINUS);\n        button.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                category.getFields().remove(field);\n                categoryPanel.remove(parent);\n            }\n        });\n        groupButton.add(button);\n        return groupButton;\n    }\n\n    private static Widget getWidget(final PropertyEditorFieldInfo property,\n                                    final Class fieldType) {\n        SyncBeanManager beanManager = IOC.getBeanManager();\n        SyncBeanDef<?> iocBeanDef = beanManager.lookupBean(fieldType);\n        AbstractField field = (AbstractField) iocBeanDef.getInstance();\n        return field.widget(property);\n    }\n\n    static void createErrorHandlingInfraStructure(final PropertyEditorItemsWidget parent,\n                                                  Widget widget) {\n        AbstractPropertyEditorWidget abstractPropertyEditorWidget = (AbstractPropertyEditorWidget) widget;\n        abstractPropertyEditorWidget.setParent(parent);\n    }\n\n    public static boolean validade(PropertyEditorEvent event) {\n        if (event == null) {\n            throw new NullEventException(\"Event should not be null,\");\n        }\n        if (event.getSortedProperties().isEmpty()) {\n            throw new NoPropertiesException(\"Event should not have empty properties.\");\n        }\n\n        return event != null && !event.getSortedProperties().isEmpty();\n    }\n\n    static boolean isAMatchOfFilter(String propertyNameFilter,\n                                    PropertyEditorFieldInfo field) {\n        if (propertyNameFilter.isEmpty()) {\n            return true;\n        }\n        return field.getLabel().toUpperCase().contains(propertyNameFilter.toUpperCase());\n    }\n\n    public static class NullEventException extends RuntimeException {\n\n        public NullEventException() {\n        }\n\n        public NullEventException(String message) {\n            super(message);\n        }\n    }\n\n    public static class NoPropertiesException extends RuntimeException {\n\n        public NoPropertiesException() {\n        }\n\n        public NoPropertiesException(String message) {\n            super(message);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/PropertyEditorItemsWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\npublic class PropertyEditorItemsWidget extends Composite {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n\n    @UiField\n    FormGroup items;\n\n    HelpBlock helpInline;\n\n    public PropertyEditorItemsWidget() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void add(Widget item) {\n        items.add(item);\n    }\n\n    public void setHelpInline(HelpBlock helpInline) {\n        this.helpInline = helpInline;\n    }\n\n    public void setError(String errorMessage) {\n        items.setValidationState(ValidationState.ERROR);\n        helpInline.setText(errorMessage);\n    }\n\n    public void clearError() {\n        helpInline.setText(\"\");\n        items.setValidationState(ValidationState.NONE);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorItemsWidget> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/PropertyEditorItemsWidget.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <b:FormGroup ui:field=\"items\">\n    </b:FormGroup>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/PropertyEditorWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.InputGroup;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\n\npublic class PropertyEditorWidget extends Composite {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    PanelGroup propertyMenu;\n    PropertyEditorEvent originalEvent;\n    @UiField\n    InputGroup filterGroup;\n    @UiField\n    TextBox filterBox;\n    @UiField\n    Button reload;\n    List<String> expandedCategories = new ArrayList<>();\n\n    public PropertyEditorWidget() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @PostConstruct\n    public void init() {\n        propertyMenu.setId(DOM.createUniqueId());\n    }\n\n    public void handle(PropertyEditorEvent event) {\n        if (PropertyEditorHelper.validade(event)) {\n            this.originalEvent = event;\n            this.filterBox.setText(\"\");\n            PropertyEditorHelper.extractEditorFrom(this,\n                                                   propertyMenu,\n                                                   event);\n        }\n    }\n\n    @UiHandler(\"reload\")\n    void onReload(ClickEvent e) {\n        this.filterBox.setText(\"\");\n        PropertyEditorHelper.extractEditorFrom(this,\n                                               propertyMenu,\n                                               originalEvent,\n                                               \"\");\n    }\n\n    @UiHandler(\"filterBox\")\n    public void onKeyUp(KeyUpEvent e) {\n        if (originalEvent != null) {\n            propertyMenu.clear();\n            PropertyEditorHelper.extractEditorFrom(this,\n                                                   propertyMenu,\n                                                   originalEvent,\n                                                   filterBox.getText());\n        }\n    }\n\n    public void setFilterGroupVisible(boolean visible) {\n        filterGroup.setVisible(visible);\n    }\n\n    public PanelGroup getPropertyMenu() {\n        return propertyMenu;\n    }\n\n    /**\n     * Bootstrap nows supports more than\n     * one panel expanded, so this method is\n     * @deprecated replaced by getExpandedCategories()\n     */\n    public String getLastOpenAccordionGroupTitle() {\n        if (expandedCategories.isEmpty()) {\n            return \"\";\n        }\n        return expandedCategories.get(expandedCategories.size() - 1);\n    }\n\n    /**\n     * Bootstrap nows supports more than\n     * one panel expanded, so this method is\n     * @deprecated replaced by addExpandedCategory( String categoriesToExpand)\n     */\n    @Deprecated\n    public void setLastOpenAccordionGroupTitle(String categoryToExpand) {\n        this.expandedCategories.add(categoryToExpand);\n    }\n\n    public void addExpandedCategory(String... categoriesToExpand) {\n        this.expandedCategories.addAll(Arrays.asList(categoriesToExpand));\n    }\n\n    public List<String> getExpandedCategories() {\n        return expandedCategories;\n    }\n\n    protected void collapseCategory(String categoryToCollapse) {\n        this.expandedCategories.remove(categoryToCollapse);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorWidget> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/PropertyEditorWidget.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n    <ui:with field=\"i18n\" type=\"org.uberfire.ext.properties.editor.client.resources.i18n.CommonConstants\"/>\n\n    <g:HTMLPanel>\n        <b:InputGroup ui:field=\"filterGroup\">\n            <b:TextBox ui:field=\"filterBox\" placeholder=\"{i18n.FilterProperties}\"/>\n            <b:InputGroupButton>\n                <b:Button icon=\"RETWEET\" ui:field=\"reload\"/>\n            </b:InputGroupButton>\n        </b:InputGroup>\n        <b:PanelGroup ui:field='propertyMenu'/>\n    </g:HTMLPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/AbstractField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\npublic abstract class AbstractField {\n\n    public abstract Widget widget(PropertyEditorFieldInfo property);\n\n    protected boolean validate(PropertyEditorFieldInfo property,\n                               String value) {\n        List<PropertyFieldValidator> validators = property.getValidators();\n\n        for (PropertyFieldValidator validator : validators) {\n            if (!validator.validate(value)) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    protected String getValidatorErrorMessage(PropertyEditorFieldInfo property,\n                                              String value) {\n        List<PropertyFieldValidator> validators = property.getValidators();\n\n        for (PropertyFieldValidator validator : validators) {\n            if (!validator.validate(value)) {\n                return validator.getValidatorErrorMessage();\n            }\n        }\n\n        return \"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/BooleanField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorCheckBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\npublic class BooleanField extends AbstractField {\n\n    @Inject\n    Event<PropertyEditorChangeEvent> propertyEditorChangeEventEvent;\n\n    @Override\n    public Widget widget(final PropertyEditorFieldInfo property) {\n        final PropertyEditorCheckBox checkBox = GWT.create(PropertyEditorCheckBox.class);\n        checkBox.setValue(Boolean.parseBoolean(property.getCurrentStringValue()));\n        checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {\n            @Override\n            public void onValueChange(ValueChangeEvent<Boolean> event) {\n\n                if (validate(property,\n                             checkBox.getValue().toString())) {\n                    checkBox.clearOldValidationErrors();\n                    property.setCurrentStringValue(checkBox.getValue().toString());\n                    propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                      checkBox.getValue().toString()));\n                } else {\n                    checkBox.setValidationError(getValidatorErrorMessage(property,\n                                                                         checkBox.getValue().toString()));\n                    checkBox.setValue(Boolean.valueOf(property.getCurrentStringValue()));\n                }\n            }\n        });\n\n        return checkBox;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/ColorField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorColorPicker;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\npublic class ColorField extends AbstractField {\n\n    @Inject\n    Event<PropertyEditorChangeEvent> propertyEditorChangeEvent;\n\n    @Override\n    public Widget widget(final PropertyEditorFieldInfo property) {\n        final PropertyEditorColorPicker colorPicker = GWT.create(PropertyEditorColorPicker.class);\n        String colorCode = property.getCurrentStringValue();\n        colorPicker.setValue(colorCode.startsWith(\"#\") ? colorCode.substring(1) : colorCode);\n        colorPicker.addChangeHandler(event -> {\n            String color = colorPicker.getValue();\n            if (color.isEmpty() || validate(property,\n                         color)) {\n                colorPicker.clearOldValidationErrors();\n                property.setCurrentStringValue(color);\n                propertyEditorChangeEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                             \"#\" + color));\n            } else {\n                colorPicker.setValidationError(getValidatorErrorMessage(property,\n                                                                        color));\n                colorPicker.setValue(property.getCurrentStringValue());\n            }\n        });\n        return colorPicker;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/ComboField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorComboBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\npublic class ComboField extends AbstractField {\n\n    @Inject\n    Event<PropertyEditorChangeEvent> propertyEditorChangeEventEvent;\n\n    @Override\n    public Widget widget(final PropertyEditorFieldInfo property) {\n        final PropertyEditorComboBox listBox = GWT.create(PropertyEditorComboBox.class);\n        int index = 0;\n        int selected = -1;\n        for (String value : property.getComboValues()) {\n            listBox.addItem(value);\n            selected = searchSelectItem(property,\n                                        index,\n                                        selected,\n                                        value);\n            index++;\n        }\n        ifSelectedSelectItem(listBox,\n                             index,\n                             selected);\n\n        addChangeHandler(property,\n                         listBox);\n\n        return listBox;\n    }\n\n    private void ifSelectedSelectItem(PropertyEditorComboBox listBox,\n                                      int index,\n                                      int selected) {\n        if (selectAnyItem(index)) {\n            listBox.setSelectedIndex(selected);\n        }\n    }\n\n    private void addChangeHandler(final PropertyEditorFieldInfo property,\n                                  final PropertyEditorComboBox listBox) {\n        listBox.addChangeHandler(new ChangeHandler() {\n                                     @Override\n                                     public void onChange(ChangeEvent event) {\n                                         int selectedIndex = listBox.getSelectedIndex();\n                                         if (validate(property,\n                                                      listBox.getItemText(selectedIndex))) {\n                                             listBox.clearOldValidationErrors();\n                                             property.setCurrentStringValue(listBox.getItemText(selectedIndex));\n                                             propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                                               listBox.getItemText(selectedIndex)));\n                                         } else {\n                                             listBox.setValidationError(getValidatorErrorMessage(property,\n                                                                                                 listBox.getItemText(selectedIndex)));\n                                             listBox.setSelectItemByText(property.getCurrentStringValue());\n                                         }\n                                     }\n                                 }\n\n        );\n    }\n\n    private int searchSelectItem(PropertyEditorFieldInfo property,\n                                 int index,\n                                 int selected,\n                                 String value) {\n        if (value.equalsIgnoreCase(property.getCurrentStringValue())) {\n            selected = index;\n        }\n        return selected;\n    }\n\n    private boolean selectAnyItem(int index) {\n        return index >= 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/PropertyEditorFieldType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\npublic enum PropertyEditorFieldType {\n\n    TEXT {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return getWidget(property,\n                             TextField.class);\n        }\n    },\n    BOOLEAN {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return getWidget(property,\n                             BooleanField.class);\n        }\n    },\n    NATURAL_NUMBER {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return TEXT.widget(property);\n        }\n    },\n    COMBO {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return getWidget(property,\n                             ComboField.class);\n        }\n    },\n    SECRET_TEXT {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return getWidget(property,\n                             SecretTextField.class);\n        }\n    },\n    COLOR {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return getWidget(property,\n                             ColorField.class);\n        }\n    },\n    CUSTOM {\n        @Override\n        public Widget widget(PropertyEditorFieldInfo property) {\n            return null;\n        }\n    };\n\n    private static Widget getWidget(PropertyEditorFieldInfo property,\n                                    Class fieldType) {\n        SyncBeanManager beanManager = IOC.getBeanManager();\n        SyncBeanDef<?> iocBeanDef = beanManager.lookupBean(fieldType);\n        AbstractField field = (AbstractField) iocBeanDef.getInstance();\n        return field.widget(property);\n    }\n\n    public static PropertyEditorFieldType getFieldTypeFrom(PropertyEditorFieldInfo fieldInfo) {\n        return PropertyEditorFieldType.valueOf(fieldInfo.getType().name());\n    }\n\n    public abstract Widget widget(PropertyEditorFieldInfo property);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/SecretTextField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorPasswordTextBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\npublic class SecretTextField extends AbstractField {\n\n    @Inject\n    Event<PropertyEditorChangeEvent> propertyEditorChangeEventEvent;\n\n    public SecretTextField() {\n    }\n\n    @Override\n    public Widget widget(final PropertyEditorFieldInfo property) {\n        final PropertyEditorPasswordTextBox passwordTextBox = GWT.create(PropertyEditorPasswordTextBox.class);\n        passwordTextBox.setText(property.getCurrentStringValue());\n        addLostFocusHandler(property,\n                            passwordTextBox);\n        addKeyDownHandler(property,\n                          passwordTextBox);\n        return passwordTextBox;\n    }\n\n    private void addLostFocusHandler(final PropertyEditorFieldInfo property,\n                                     final PropertyEditorPasswordTextBox passwordTextBox) {\n\n        passwordTextBox.addBlurHandler(new BlurHandler() {\n            @Override\n            public void onBlur(BlurEvent event) {\n                if (validate(property,\n                             passwordTextBox.getText())) {\n                    passwordTextBox.clearOldValidationErrors();\n                    property.setCurrentStringValue(passwordTextBox.getText());\n                    propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                      passwordTextBox.getText()));\n                } else {\n                    passwordTextBox.setValidationError(getValidatorErrorMessage(property,\n                                                                                passwordTextBox.getText()));\n                    passwordTextBox.setText(property.getCurrentStringValue());\n                }\n            }\n        });\n    }\n\n    private void addKeyDownHandler(final PropertyEditorFieldInfo property,\n                                   final PropertyEditorPasswordTextBox passwordTextBox) {\n        passwordTextBox.addKeyDownHandler(new KeyDownHandler() {\n            @Override\n            public void onKeyDown(KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    if (validate(property,\n                                 passwordTextBox.getText())) {\n                        passwordTextBox.clearOldValidationErrors();\n                        property.setCurrentStringValue(passwordTextBox.getText());\n                        propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                          passwordTextBox.getText()));\n                    } else {\n                        passwordTextBox.setValidationError(getValidatorErrorMessage(property,\n                                                                                    passwordTextBox.getText()));\n                        passwordTextBox.setText(property.getCurrentStringValue());\n                    }\n                }\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/fields/TextField.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.fields;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorTextBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorChangeEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\n\n@Dependent\npublic class TextField extends AbstractField {\n\n    @Inject\n    Event<PropertyEditorChangeEvent> propertyEditorChangeEventEvent;\n\n    @Override\n    public Widget widget(final PropertyEditorFieldInfo property) {\n        final PropertyEditorTextBox textBox = GWT.create(PropertyEditorTextBox.class);\n        textBox.setText(property.getCurrentStringValue());\n        textBox.setId(String.valueOf(property.hashCode()));\n        addEnterKeyHandler(property,\n                           textBox);\n        addLostFocusHandler(property,\n                            textBox);\n        return textBox;\n    }\n\n    private void addLostFocusHandler(final PropertyEditorFieldInfo property,\n                                     final PropertyEditorTextBox textBox) {\n\n        textBox.addBlurHandler(new BlurHandler() {\n            @Override\n            public void onBlur(BlurEvent event) {\n                if (validate(property,\n                             textBox.getText())) {\n                    textBox.clearOldValidationErrors();\n                    property.setCurrentStringValue(textBox.getText());\n                    propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                      textBox.getText()));\n                } else {\n                    textBox.setValidationError(getValidatorErrorMessage(property,\n                                                                        textBox.getText()));\n                    textBox.setText(property.getCurrentStringValue());\n                }\n            }\n        });\n    }\n\n    private void addEnterKeyHandler(final PropertyEditorFieldInfo property,\n                                    final PropertyEditorTextBox textBox) {\n        textBox.addKeyDownHandler(new KeyDownHandler() {\n            @Override\n            public void onKeyDown(KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    if (validate(property,\n                                 textBox.getText())) {\n                        textBox.clearOldValidationErrors();\n                        property.setCurrentStringValue(textBox.getText());\n                        propertyEditorChangeEventEvent.fire(new PropertyEditorChangeEvent(property,\n                                                                                          textBox.getText()));\n                    } else {\n                        textBox.setValidationError(getValidatorErrorMessage(property,\n                                                                            textBox.getText()));\n                        textBox.setText(property.getCurrentStringValue());\n                    }\n                }\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/options/PropertyEditorFieldOptionUtils.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.options;\n\nimport com.google.gwt.user.client.ui.HasEnabled;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldOption;\n\npublic class PropertyEditorFieldOptionUtils {\n\n    public static void applyFieldOption(final PropertyEditorFieldOption option,\n                                        final Widget fieldWidget) {\n        if (PropertyEditorFieldOption.DISABLED.equals(option)) {\n            disable(fieldWidget);\n        }\n    }\n\n    public static void disable(final Widget fieldWidget) {\n        if (fieldWidget instanceof HasEnabled) {\n            ((HasEnabled) fieldWidget).setEnabled(false);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.resources.i18n;\n\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    String FilterProperties();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/AbstractPropertyEditorWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HasEnabled;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorItemsWidget;\n\npublic abstract class AbstractPropertyEditorWidget extends Composite implements HasEnabled {\n\n    PropertyEditorItemsWidget parent;\n\n    public void setParent(PropertyEditorItemsWidget parent) {\n        this.parent = parent;\n    }\n\n    public void setValidationError(String errorMessage) {\n        parent.setError(errorMessage);\n    }\n\n    public void clearOldValidationErrors() {\n        parent.clearError();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorCheckBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.CheckBox;\n\npublic class PropertyEditorCheckBox extends AbstractPropertyEditorWidget {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    CheckBox checkBox;\n\n    public PropertyEditorCheckBox() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public Boolean getValue() {\n        return checkBox.getValue();\n    }\n\n    public void setValue(Boolean value) {\n        checkBox.setValue(value);\n    }\n\n    public void addValueChangeHandler(ValueChangeHandler<Boolean> valueChangeHandler) {\n        checkBox.addValueChangeHandler(valueChangeHandler);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return checkBox.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        checkBox.setEnabled(enabled);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorCheckBox> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorCheckBox.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <b:CheckBox ui:field=\"checkBox\" />\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorColorPicker.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.InputGroupAddon;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.properties.editor.model.validators.ColorValidator;\nimport org.uberfire.ext.widgets.common.client.colorpicker.ColorPickerDialog;\nimport org.uberfire.ext.widgets.common.client.colorpicker.dialog.DialogClosedEvent;\nimport org.uberfire.ext.widgets.common.client.colorpicker.dialog.DialogClosedHandler;\n\npublic class PropertyEditorColorPicker extends AbstractPropertyEditorWidget {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    InputGroupAddon icon;\n    @UiField\n    TextBox colorTextBox;\n\n    public PropertyEditorColorPicker() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        icon.addDomHandler(new ClickHandler() {\n                               public void onClick(ClickEvent event) {\n                                   openColorPickerDialog();\n                               }\n                           },\n                           ClickEvent.getType());\n    }\n\n    public String getValue() {\n        return colorTextBox.getValue();\n    }\n\n    public void setValue(String value) {\n        if (value.isEmpty() || ColorValidator.isValid(value)) {\n            colorTextBox.setValue(value);\n        }\n    }\n\n    public void addChangeHandler(ValueChangeHandler<String> changeHandler) {\n        colorTextBox.addValueChangeHandler(changeHandler);\n    }\n\n    protected void openColorPickerDialog() {\n        final ColorPickerDialog dlg = new ColorPickerDialog();\n        dlg.getElement().getStyle().setZIndex(9999);\n        String color = getValue();\n        if (ColorValidator.isValid(color)) {\n            dlg.setColor(color);\n        }\n        dlg.addDialogClosedHandler(new DialogClosedHandler() {\n            public void dialogClosed(DialogClosedEvent event) {\n                if (!event.isCanceled()) {\n                    colorTextBox.setValue(dlg.getColor().toUpperCase(),\n                                          true);\n                }\n            }\n        });\n        dlg.showRelativeTo(icon);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return colorTextBox.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        colorTextBox.setEnabled(enabled);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorColorPicker> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorColorPicker.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" >\n\n  <g:FlowPanel>\n    <b:InputGroup>\n      <b:InputGroupAddon ui:field=\"icon\" icon=\"EDIT\"/>\n      <b:TextBox ui:field=\"colorTextBox\"  />\n    </b:InputGroup>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorComboBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.commons.data.Pair;\n\npublic class PropertyEditorComboBox extends AbstractPropertyEditorWidget {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    ListBox listBox;\n\n    public PropertyEditorComboBox() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void addItem(final String value) {\n        listBox.addItem(value);\n    }\n\n    public void addItem(final Pair<String, String> pair) {\n        listBox.addItem(pair.getK1(),\n                        pair.getK2());\n    }\n\n    public Pair<String, String> getSelectedPair(final int selected) {\n        return Pair.newPair(listBox.getItemText(selected),\n                            listBox.getValue(selected));\n    }\n\n    public int getSelectedIndex() {\n        return listBox.getSelectedIndex();\n    }\n\n    public void setSelectedIndex(final int selected) {\n        listBox.setSelectedIndex(selected);\n    }\n\n    public void setSelectItemByText(final String text) {\n        for (int i = 0; i < listBox.getItemCount(); i++) {\n            String candidate = listBox.getItemText(i);\n            if (candidate.equalsIgnoreCase(text)) {\n                setSelectedIndex(i);\n            }\n        }\n    }\n\n    public void clear() {\n        listBox.clear();\n    }\n\n    public String getItemText(final int selectedIndex) {\n        return listBox.getItemText(selectedIndex);\n    }\n\n    public void addChangeHandler(final ChangeHandler changeHandler) {\n        listBox.addChangeHandler(changeHandler);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return listBox.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        listBox.setEnabled(enabled);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorComboBox> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorComboBox.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" >\n\n  <b:ListBox ui:field=\"listBox\"/>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemButtons.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.HasClickHandlers;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\n\npublic class PropertyEditorItemButtons extends Composite implements HasClickHandlers {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    Button removalButton;\n\n    public PropertyEditorItemButtons() {\n        initWidget(uiBinder.createAndBindUi(this));\n        removalButton.setType(ButtonType.DANGER);\n        removalButton.setSize(ButtonSize.EXTRA_SMALL);\n        removalButton.setIcon(IconType.MINUS);\n//        removalButton.addClickHandler( clickHandler );\n    }\n\n    public void addRemovalButton(ClickHandler clickHandler) {\n        removalButton.setVisible(true);\n        removalButton.setType(ButtonType.DANGER);\n        removalButton.setSize(ButtonSize.EXTRA_SMALL);\n        removalButton.setIcon(IconType.MINUS);\n        removalButton.addClickHandler(clickHandler);\n    }\n\n    @Override\n    public HandlerRegistration addClickHandler(ClickHandler handler) {\n        return removalButton.addClickHandler(handler);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorItemButtons> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemButtons.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Button ui:field='removalButton' size=\"SMALL\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemLabel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.views.pfly.widgets.FormLabelHelp;\n\npublic class PropertyEditorItemLabel extends Composite {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    FormLabelHelp label;\n\n    public PropertyEditorItemLabel() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setText(String text) {\n        label.setText(text);\n    }\n\n    public void setFor(String forValue) {\n        label.setFor(forValue);\n    }\n\n    public void setHelpTitle(final String title) {\n        label.setHelpTitle(title);\n    }\n\n    public void setHelpContent(final String content) {\n        label.setHelpContent(content);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorItemLabel> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemLabel.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:p=\"urn:import:org.uberfire.client.views.pfly.widgets\">\n\n\n    <p:FormLabelHelp ui:field='label' addStyleNames=\"col-md-4\"/>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemWidget.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Column;\n\npublic class PropertyEditorItemWidget extends Composite {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    Column item;\n\n    public PropertyEditorItemWidget() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void add(Widget widget) {\n        item.add(widget);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorItemWidget> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorItemWidget.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n        >\n\n    <b:Column size=\"MD_8\" ui:field='item' />\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorPasswordTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.FocusEvent;\nimport com.google.gwt.event.dom.client.FocusHandler;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Input;\n\npublic class PropertyEditorPasswordTextBox extends AbstractPropertyEditorWidget {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    Input passwordTextBox;\n\n    public PropertyEditorPasswordTextBox() {\n        initWidget(uiBinder.createAndBindUi(this));\n        passwordTextBox.addFocusHandler(new FocusHandler() {\n            @Override\n            public void onFocus(FocusEvent event) {\n                passwordTextBox.selectAll();\n            }\n        });\n    }\n\n    public String getText() {\n        return passwordTextBox.getText();\n    }\n\n    public void setText(String text) {\n        passwordTextBox.setText(text);\n    }\n\n    public void addKeyDownHandler(KeyDownHandler keyDownHandler) {\n        passwordTextBox.addKeyDownHandler(keyDownHandler);\n    }\n\n    public void addBlurHandler(BlurHandler blurHandler) {\n        passwordTextBox.addBlurHandler(blurHandler);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return passwordTextBox.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        passwordTextBox.setEnabled(enabled);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorPasswordTextBox> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorPasswordTextBox.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\" >\n\n  <b:Input ui:field=\"passwordTextBox\" type=\"PASSWORD\"/>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorTextBox.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.FocusEvent;\nimport com.google.gwt.event.dom.client.FocusHandler;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TextBox;\n\npublic class PropertyEditorTextBox extends AbstractPropertyEditorWidget {\n\n    private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);\n    @UiField\n    TextBox textBox;\n\n    public PropertyEditorTextBox() {\n        initWidget(uiBinder.createAndBindUi(this));\n        textBox.addFocusHandler(new FocusHandler() {\n            @Override\n            public void onFocus(FocusEvent event) {\n                textBox.selectAll();\n            }\n        });\n    }\n\n    public void setId(String id) {\n//        textBox.setId( id );\n    }\n\n    public String getText() {\n        return textBox.getText();\n    }\n\n    public void setText(String text) {\n        textBox.setText(text);\n    }\n\n    public void addKeyDownHandler(KeyDownHandler keyDownHandler) {\n        textBox.addKeyDownHandler(keyDownHandler);\n    }\n\n    public void addBlurHandler(BlurHandler blurHandler) {\n        textBox.addBlurHandler(blurHandler);\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return textBox.isEnabled();\n    }\n\n    @Override\n    public void setEnabled(boolean enabled) {\n        textBox.setEnabled(enabled);\n    }\n\n    interface MyUiBinder extends UiBinder<Widget, PropertyEditorTextBox> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/java/org/uberfire/ext/properties/editor/client/widgets/PropertyEditorTextBox.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n\n  <b:TextBox ui:field=\"textBox\" />\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.properties.editor.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/PropertiesEditorClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorAPI\"/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants.properties",
    "content": "FilterProperties=filter properties..."
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_de.properties",
    "content": "FilterProperties=Eigenschaften filtern …\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_es.properties",
    "content": "FilterProperties=filtrar propiedades…"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_fr.properties",
    "content": "FilterProperties=propriétés du filtre…"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_it.properties",
    "content": "FilterProperties=filtra le proprietà...\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_ja.properties",
    "content": "FilterProperties=フィルタープロパティー..."
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "FilterProperties=filtrar propriedades...\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/main/resources/org/uberfire/ext/properties/editor/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "FilterProperties=过滤器属性......\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/test/java/org/uberfire/ext/properties/editor/client/PropertyEditorHelperTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client;\n\nimport java.util.ArrayList;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorItemLabel;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(Heading.class)\npublic class PropertyEditorHelperTest {\n\n    @Test(expected = PropertyEditorHelper.NullEventException.class)\n    public void validateNullEventTest() {\n        PropertyEditorHelper.validade(null);\n    }\n\n    @Test(expected = PropertyEditorHelper.NoPropertiesException.class)\n    public void validateEventWithNoPropertiesTest() {\n        PropertyEditorEvent event = new PropertyEditorEvent(\"id\",\n                                                            new ArrayList<PropertyEditorCategory>());\n        PropertyEditorHelper.validade(event);\n    }\n\n    @Test\n    public void validateEventTest() {\n        ArrayList<PropertyEditorCategory> properties = new ArrayList<PropertyEditorCategory>();\n        properties.add(new PropertyEditorCategory(\"Category\"));\n        PropertyEditorEvent event = new PropertyEditorEvent(\"id\",\n                                                            properties);\n        assertTrue(PropertyEditorHelper.validade(event));\n    }\n\n    @Test\n    public void isAMatchOfEmptyFilterTest() {\n        PropertyEditorFieldInfo field = new PropertyEditorFieldInfo();\n        assertTrue(PropertyEditorHelper.isAMatchOfFilter(\"\",\n                                                         field));\n    }\n\n    @Test\n    public void isAMatchOfFilterTest() {\n        PropertyEditorFieldInfo field = new PropertyEditorFieldInfo(\"label\",\n                                                                    PropertyEditorType.TEXT);\n        assertTrue(PropertyEditorHelper.isAMatchOfFilter(\"l\",\n                                                         field));\n        assertTrue(PropertyEditorHelper.isAMatchOfFilter(\"label\",\n                                                         field));\n        assertTrue(PropertyEditorHelper.isAMatchOfFilter(\"LABEL\",\n                                                         field));\n        assertTrue(PropertyEditorHelper.isAMatchOfFilter(\"abel\",\n                                                         field));\n        assertFalse(PropertyEditorHelper.isAMatchOfFilter(\"LABELL\",\n                                                          field));\n        assertFalse(PropertyEditorHelper.isAMatchOfFilter(\"LASBELL\",\n                                                          field));\n        assertFalse(PropertyEditorHelper.isAMatchOfFilter(\"p\",\n                                                          field));\n    }\n\n    @Test\n    public void createLabelTest() {\n        PropertyEditorFieldInfo field = new PropertyEditorFieldInfo(\"label\",\n                                                                    PropertyEditorType.TEXT);\n        PropertyEditorItemLabel label = PropertyEditorHelper.createLabel(field);\n        verify(label).setText(\"label\");\n    }\n\n    @Test\n    public void createCategoryWithNoFields() {\n        PropertyEditorWidget propertyEditorWidget = GWT.create(PropertyEditorWidget.class);\n        PanelGroup propertyMenu = GWT.create(PanelGroup.class);\n\n        PropertyEditorCategory category = new PropertyEditorCategory(\"1\");\n        PropertyEditorHelper.createCategory(propertyEditorWidget,\n                                            propertyMenu,\n                                            category,\n                                            \"\");\n\n        verify(propertyMenu,\n               never()).add(any(Widget.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/test/java/org/uberfire/ext/properties/editor/client/PropertyEditorWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PropertyEditorWidgetTest {\n\n    PropertyEditorWidget propertyEditor;\n\n    @Before\n    public void setUp() throws Exception {\n        propertyEditor = new PropertyEditorWidget();\n    }\n\n    @Test\n    public void handleExpandedCategoriesTest() throws Exception {\n        assertTrue(propertyEditor.getExpandedCategories().isEmpty());\n\n        propertyEditor.addExpandedCategory(\"CAT1\",\n                                           \"CAT2\");\n\n        assertEquals(2,\n                     propertyEditor.getExpandedCategories().size());\n        assertEquals(\"CAT2\",\n                     propertyEditor.getLastOpenAccordionGroupTitle());\n\n        propertyEditor.collapseCategory(\"CAT2\");\n\n        assertEquals(1,\n                     propertyEditor.getExpandedCategories().size());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-properties-editor/uberfire-widgets-properties-editor-client/src/test/java/org/uberfire/ext/properties/editor/client/options/PropertyEditorFieldOptionUtilsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.properties.editor.client.options;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.properties.editor.client.widgets.PropertyEditorTextBox;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldOption;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PropertyEditorFieldOptionUtilsTest {\n\n    @Test\n    public void applyFieldOptionOnHasEnableWidgetTest() {\n        final PropertyEditorTextBox widget = mock(PropertyEditorTextBox.class);\n        PropertyEditorFieldOptionUtils.applyFieldOption(PropertyEditorFieldOption.DISABLED,\n                                                        widget);\n        verify(widget).setEnabled(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-sandbox</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Widgets Sandbox</name>\n\n  <modules>\n    <module>uberfire-widget-markdown</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-sandbox</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widget-markdown</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Markdown Widget</name>\n  <description>Uberfire Markdown Widget</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Errai Core -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/Markdown.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class Markdown extends Composite\n        implements\n        RequiresResize {\n\n    private static MarkdownBinder uiBinder = GWT.create(MarkdownBinder.class);\n    @UiField\n    HTMLPanel htmlContent;\n    HTML content;\n\n    public Markdown() {\n        initWidget(uiBinder.createAndBindUi(this));\n        content = new HTML();\n        htmlContent.add(content);\n    }\n\n    public void setContent(final String content) {\n        this.content.setHTML(toHTML(content));\n    }\n\n    @Override\n    public void onResize() {\n//        int height = getParent().getOffsetHeight();\n//        int width = getParent().getOffsetWidth();\n//        setPixelSize( width, height );\n    }\n\n    public native String toHTML(final String text) /*-{\n        var converter = new $wnd.Showdown.converter();\n        return converter.makeHtml(text);\n    }-*/;\n\n    interface MarkdownBinder\n            extends\n            UiBinder<Widget, Markdown> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/Markdown.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'>\n\n  <g:HTMLPanel ui:field=\"htmlContent\"/>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/MarkdownTextContent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class MarkdownTextContent {\n\n    private String content;\n\n    public MarkdownTextContent() {\n    }\n\n    public MarkdownTextContent(final String content) {\n        this.content = checkNotNull(\"content\",\n                                    content);\n    }\n\n    public String getContent() {\n        return content;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/MarkdownUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class MarkdownUtil {\n\n    public native String toHTML(final String text) /*-{\n        var converter = new $wnd.Showdown.converter();\n        return converter.makeHtml(text);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLiveEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.editorlive;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnStartup;\n\n@Dependent\n@WorkbenchScreen(identifier = \"MarkdownLiveEditor\")\npublic class MarkdownLiveEditorPresenter {\n\n    @Inject\n    public View view;\n\n    @OnStartup\n    public void onStartup() {\n        view.setContent(\"\");\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Markdown Live Editor\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    public interface View\n            extends\n            IsWidget {\n\n        void setContent(String content);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLiveEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.editorlive;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ChangeEvent;\nimport com.google.gwt.event.dom.client.ChangeHandler;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.event.dom.client.KeyUpHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeLayoutPanel;\nimport org.uberfire.ext.widgets.common.client.common.ResizableTextArea;\nimport org.uberfire.ext.widgets.sandbox.client.markdown.MarkdownTextContent;\n\n/**\n * A Text editor\n */\npublic class MarkdownLiveEditorView extends Composite\n        implements\n        RequiresResize,\n        MarkdownLiveEditorPresenter.View {\n\n    private static MarkdownLiveEditorViewBinder uiBinder = GWT.create(MarkdownLiveEditorViewBinder.class);\n    @UiField\n    protected ResizableTextArea fileContent;\n    @Inject\n    protected Event<MarkdownTextContent> event;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        fileContent.addKeyDownHandler(new KeyDownHandler() {\n            @Override\n            public void onKeyDown(final KeyDownEvent changeEvent) {\n                event.fire(new MarkdownTextContent(fileContent.getText()));\n            }\n        });\n\n        fileContent.addKeyUpHandler(new KeyUpHandler() {\n            @Override\n            public void onKeyUp(final KeyUpEvent changeEvent) {\n                event.fire(new MarkdownTextContent(fileContent.getText()));\n            }\n        });\n\n        fileContent.addChangeHandler(new ChangeHandler() {\n            public void onChange(ChangeEvent changeEvent) {\n                event.fire(new MarkdownTextContent(fileContent.getText()));\n            }\n        });\n    }\n\n    public void setContent(final String content) {\n        fileContent.setText(content);\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        setPixelSize(width,\n                     height);\n        fileContent.onResize();\n    }\n\n    interface MarkdownLiveEditorViewBinder\n            extends\n            UiBinder<ResizeLayoutPanel, MarkdownLiveEditorView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLiveEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\" \n             xmlns:common=\"urn:import:org.uberfire.ext.widgets.common.client.common\">\n\n  <ui:style>\n    .betterSetup {\n      margin: 10px 10px 10px 10px;\n      resize: none;\n    }\n  </ui:style>\n\n  <g:ResizeLayoutPanel>\n    <common:ResizableTextArea ui:field=\"fileContent\" styleName=\"{style.betterSetup}\"/>\n  </g:ResizeLayoutPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLivePresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.editorlive;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.widgets.sandbox.client.markdown.MarkdownTextContent;\n\n@Dependent\n@WorkbenchScreen(identifier = \"MarkdownLiveViewer\")\npublic class MarkdownLivePresenter {\n\n    @Inject\n    public View view;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Markdown Live Viewer\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    public void loadContent(@Observes MarkdownTextContent content) {\n        view.setContent(content.getContent());\n    }\n\n    public interface View\n            extends\n            IsWidget {\n\n        void setContent(final String htmlContent);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLiveView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.editorlive;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeLayoutPanel;\nimport org.uberfire.ext.widgets.sandbox.client.markdown.Markdown;\n\npublic class MarkdownLiveView extends Composite\n        implements\n        RequiresResize,\n        MarkdownLivePresenter.View {\n\n    private static MarkdownViewBinder uiBinder = GWT.create(MarkdownViewBinder.class);\n    @UiField\n    protected Markdown markdown;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setContent(final String content) {\n        markdown.setContent(content);\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        setPixelSize(width,\n                     height);\n    }\n\n    interface MarkdownViewBinder\n            extends\n            UiBinder<ResizeLayoutPanel, MarkdownLiveView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/editorlive/MarkdownLiveView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:md=\"urn:import:org.uberfire.ext.widgets.sandbox.client.markdown\">\n\n  <g:ResizeLayoutPanel>\n    <md:Markdown ui:field=\"markdown\"/>\n  </g:ResizeLayoutPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/viewer/MarkdownPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.viewer;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.lifecycle.OnStartup;\n\n@Dependent\n@WorkbenchEditor(identifier = \"MarkdownViewer\", supportedTypes = {MarkdownType.class})\npublic class MarkdownPresenter {\n\n    @Inject\n    public View view;\n    @Inject\n    private Caller<VFSService> vfsServices;\n    private String path;\n\n    @OnStartup\n    public void onStartup(final Path path) {\n        this.path = path.getFileName();\n        vfsServices.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(final String response) {\n                if (response == null) {\n                    view.setContent(\"<p>-- empty --</p>\");\n                } else {\n                    view.setContent(response);\n                }\n            }\n        }).readAllString(path);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Markdown Viewer [\" + path + \"]\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    public interface View\n            extends\n            IsWidget {\n\n        void setContent(final String htmlContent);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/viewer/MarkdownType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.viewer;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class MarkdownType implements ClientResourceType {\n\n    private Category category;\n\n    public MarkdownType() {\n    }\n\n    @Inject\n    public MarkdownType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"markdown\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Markdown file\";\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"md\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.md\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\"\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/viewer/MarkdownView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.sandbox.client.markdown.viewer;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeLayoutPanel;\nimport org.uberfire.ext.widgets.sandbox.client.markdown.Markdown;\n\npublic class MarkdownView extends Composite\n        implements\n        RequiresResize,\n        MarkdownPresenter.View {\n\n    private static MarkdownViewBinder uiBinder = GWT.create(MarkdownViewBinder.class);\n    @UiField\n    protected Markdown markdown;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    public void setContent(final String content) {\n        markdown.setContent(content);\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        setPixelSize(width,\n                     height);\n    }\n\n    interface MarkdownViewBinder\n            extends\n            UiBinder<ResizeLayoutPanel, MarkdownView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/java/org/uberfire/ext/widgets/sandbox/client/markdown/viewer/MarkdownView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:md=\"urn:import:org.uberfire.client.markdown\">\n\n  <g:ResizeLayoutPanel>\n    <md:Markdown ui:field=\"markdown\"/>\n  </g:ResizeLayoutPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.widgets.sandbox.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/resources/org/uberfire/ext/widgets/sandbox/UberfireMarkdownWidget.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <script src=\"js/showdown.js\"/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-sandbox/uberfire-widget-markdown/src/main/resources/org/uberfire/ext/widgets/sandbox/public/js/showdown.js",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n   A A L        Source code at:\n   T C A   <http://www.attacklab.net/>\n   T K B\n*/\n\nvar Showdown={};\nShowdown.converter=function(){\nvar _1;\nvar _2;\nvar _3;\nvar _4=0;\nthis.makeHtml=function(_5){\n_1=new Array();\n_2=new Array();\n_3=new Array();\n_5=_5.replace(/~/g,\"~T\");\n_5=_5.replace(/\\$/g,\"~D\");\n_5=_5.replace(/\\r\\n/g,\"\\n\");\n_5=_5.replace(/\\r/g,\"\\n\");\n_5=\"\\n\\n\"+_5+\"\\n\\n\";\n_5=_6(_5);\n_5=_5.replace(/^[ \\t]+$/mg,\"\");\n_5=_7(_5);\n_5=_8(_5);\n_5=_9(_5);\n_5=_a(_5);\n_5=_5.replace(/~D/g,\"$$\");\n_5=_5.replace(/~T/g,\"~\");\nreturn _5;\n};\nvar _8=function(_b){\nvar _b=_b.replace(/^[ ]{0,3}\\[(.+)\\]:[ \\t]*\\n?[ \\t]*<?(\\S+?)>?[ \\t]*\\n?[ \\t]*(?:(\\n*)[\"(](.+?)[\")][ \\t]*)?(?:\\n+|\\Z)/gm,function(_c,m1,m2,m3,m4){\nm1=m1.toLowerCase();\n_1[m1]=_11(m2);\nif(m3){\nreturn m3+m4;\n}else{\nif(m4){\n_2[m1]=m4.replace(/\"/g,\"&quot;\");\n}\n}\nreturn \"\";\n});\nreturn _b;\n};\nvar _7=function(_12){\n_12=_12.replace(/\\n/g,\"\\n\\n\");\nvar _13=\"p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del\";\nvar _14=\"p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math\";\n_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math|ins|del)\\b[^\\r]*?\\n<\\/\\2>[ \\t]*(?=\\n+))/gm,_15);\n_12=_12.replace(/^(<(p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|script|noscript|form|fieldset|iframe|math)\\b[^\\r]*?.*<\\/\\2>[ \\t]*(?=\\n+)\\n)/gm,_15);\n_12=_12.replace(/(\\n[ ]{0,3}(<(hr)\\b([^<>])*?\\/?>)[ \\t]*(?=\\n{2,}))/g,_15);\n_12=_12.replace(/(\\n\\n[ ]{0,3}<!(--[^\\r]*?--\\s*)+>[ \\t]*(?=\\n{2,}))/g,_15);\n_12=_12.replace(/(?:\\n\\n)([ ]{0,3}(?:<([?%])[^\\r]*?\\2>)[ \\t]*(?=\\n{2,}))/g,_15);\n_12=_12.replace(/\\n\\n/g,\"\\n\");\nreturn _12;\n};\nvar _15=function(_16,m1){\nvar _18=m1;\n_18=_18.replace(/\\n\\n/g,\"\\n\");\n_18=_18.replace(/^\\n/,\"\");\n_18=_18.replace(/\\n+$/g,\"\");\n_18=\"\\n\\n~K\"+(_3.push(_18)-1)+\"K\\n\\n\";\nreturn _18;\n};\nvar _9=function(_19){\n_19=_1a(_19);\nvar key=_1c(\"<hr />\");\n_19=_19.replace(/^[ ]{0,2}([ ]?\\*[ ]?){3,}[ \\t]*$/gm,key);\n_19=_19.replace(/^[ ]{0,2}([ ]?\\-[ ]?){3,}[ \\t]*$/gm,key);\n_19=_19.replace(/^[ ]{0,2}([ ]?\\_[ ]?){3,}[ \\t]*$/gm,key);\n_19=_1d(_19);\n_19=_1e(_19);\n_19=_1f(_19);\n_19=_7(_19);\n_19=_20(_19);\nreturn _19;\n};\nvar _21=function(_22){\n_22=_23(_22);\n_22=_24(_22);\n_22=_25(_22);\n_22=_26(_22);\n_22=_27(_22);\n_22=_28(_22);\n_22=_11(_22);\n_22=_29(_22);\n_22=_22.replace(/  +\\n/g,\" <br />\\n\");\nreturn _22;\n};\nvar _24=function(_2a){\nvar _2b=/(<[a-z\\/!$](\"[^\"]*\"|'[^']*'|[^'\">])*>|<!(--.*?--\\s*)+>)/gi;\n_2a=_2a.replace(_2b,function(_2c){\nvar tag=_2c.replace(/(.)<\\/?code>(?=.)/g,\"$1`\");\ntag=_2e(tag,\"\\\\`*_\");\nreturn tag;\n});\nreturn _2a;\n};\nvar _27=function(_2f){\n_2f=_2f.replace(/(\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\])()()()()/g,_30);\n_2f=_2f.replace(/(\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\]\\([ \\t]*()<?(.*?)>?[ \\t]*((['\"])(.*?)\\6[ \\t]*)?\\))/g,_30);\n_2f=_2f.replace(/(\\[([^\\[\\]]+)\\])()()()()()/g,_30);\nreturn _2f;\n};\nvar _30=function(_31,m1,m2,m3,m4,m5,m6,m7){\nif(m7==undefined){\nm7=\"\";\n}\nvar _39=m1;\nvar _3a=m2;\nvar _3b=m3.toLowerCase();\nvar url=m4;\nvar _3d=m7;\nif(url==\"\"){\nif(_3b==\"\"){\n_3b=_3a.toLowerCase().replace(/ ?\\n/g,\" \");\n}\nurl=\"#\"+_3b;\nif(_1[_3b]!=undefined){\nurl=_1[_3b];\nif(_2[_3b]!=undefined){\n_3d=_2[_3b];\n}\n}else{\nif(_39.search(/\\(\\s*\\)$/m)>-1){\nurl=\"\";\n}else{\nreturn _39;\n}\n}\n}\nurl=_2e(url,\"*_\");\nvar _3e=\"<a href=\\\"\"+url+\"\\\"\";\nif(_3d!=\"\"){\n_3d=_3d.replace(/\"/g,\"&quot;\");\n_3d=_2e(_3d,\"*_\");\n_3e+=\" title=\\\"\"+_3d+\"\\\"\";\n}\n_3e+=\">\"+_3a+\"</a>\";\nreturn _3e;\n};\nvar _26=function(_3f){\n_3f=_3f.replace(/(!\\[(.*?)\\][ ]?(?:\\n[ ]*)?\\[(.*?)\\])()()()()/g,_40);\n_3f=_3f.replace(/(!\\[(.*?)\\]\\s?\\([ \\t]*()<?(\\S+?)>?[ \\t]*((['\"])(.*?)\\6[ \\t]*)?\\))/g,_40);\nreturn _3f;\n};\nvar _40=function(_41,m1,m2,m3,m4,m5,m6,m7){\nvar _49=m1;\nvar _4a=m2;\nvar _4b=m3.toLowerCase();\nvar url=m4;\nvar _4d=m7;\nif(!_4d){\n_4d=\"\";\n}\nif(url==\"\"){\nif(_4b==\"\"){\n_4b=_4a.toLowerCase().replace(/ ?\\n/g,\" \");\n}\nurl=\"#\"+_4b;\nif(_1[_4b]!=undefined){\nurl=_1[_4b];\nif(_2[_4b]!=undefined){\n_4d=_2[_4b];\n}\n}else{\nreturn _49;\n}\n}\n_4a=_4a.replace(/\"/g,\"&quot;\");\nurl=_2e(url,\"*_\");\nvar _4e=\"<img src=\\\"\"+url+\"\\\" alt=\\\"\"+_4a+\"\\\"\";\n_4d=_4d.replace(/\"/g,\"&quot;\");\n_4d=_2e(_4d,\"*_\");\n_4e+=\" title=\\\"\"+_4d+\"\\\"\";\n_4e+=\" />\";\nreturn _4e;\n};\nvar _1a=function(_4f){\n_4f=_4f.replace(/^(.+)[ \\t]*\\n=+[ \\t]*\\n+/gm,function(_50,m1){\nreturn _1c(\"<h1>\"+_21(m1)+\"</h1>\");\n});\n_4f=_4f.replace(/^(.+)[ \\t]*\\n-+[ \\t]*\\n+/gm,function(_52,m1){\nreturn _1c(\"<h2>\"+_21(m1)+\"</h2>\");\n});\n_4f=_4f.replace(/^(\\#{1,6})[ \\t]*(.+?)[ \\t]*\\#*\\n+/gm,function(_54,m1,m2){\nvar _57=m1.length;\nreturn _1c(\"<h\"+_57+\">\"+_21(m2)+\"</h\"+_57+\">\");\n});\nreturn _4f;\n};\nvar _58;\nvar _1d=function(_59){\n_59+=\"~0\";\nvar _5a=/^(([ ]{0,3}([*+-]|\\d+[.])[ \\t]+)[^\\r]+?(~0|\\n{2,}(?=\\S)(?![ \\t]*(?:[*+-]|\\d+[.])[ \\t]+)))/gm;\nif(_4){\n_59=_59.replace(_5a,function(_5b,m1,m2){\nvar _5e=m1;\nvar _5f=(m2.search(/[*+-]/g)>-1)?\"ul\":\"ol\";\n_5e=_5e.replace(/\\n{2,}/g,\"\\n\\n\\n\");\nvar _60=_58(_5e);\n_60=_60.replace(/\\s+$/,\"\");\n_60=\"<\"+_5f+\">\"+_60+\"</\"+_5f+\">\\n\";\nreturn _60;\n});\n}else{\n_5a=/(\\n\\n|^\\n?)(([ ]{0,3}([*+-]|\\d+[.])[ \\t]+)[^\\r]+?(~0|\\n{2,}(?=\\S)(?![ \\t]*(?:[*+-]|\\d+[.])[ \\t]+)))/g;\n_59=_59.replace(_5a,function(_61,m1,m2,m3){\nvar _65=m1;\nvar _66=m2;\nvar _67=(m3.search(/[*+-]/g)>-1)?\"ul\":\"ol\";\nvar _66=_66.replace(/\\n{2,}/g,\"\\n\\n\\n\");\nvar _68=_58(_66);\n_68=_65+\"<\"+_67+\">\\n\"+_68+\"</\"+_67+\">\\n\";\nreturn _68;\n});\n}\n_59=_59.replace(/~0/,\"\");\nreturn _59;\n};\n_58=function(_69){\n_4++;\n_69=_69.replace(/\\n{2,}$/,\"\\n\");\n_69+=\"~0\";\n_69=_69.replace(/(\\n)?(^[ \\t]*)([*+-]|\\d+[.])[ \\t]+([^\\r]+?(\\n{1,2}))(?=\\n*(~0|\\2([*+-]|\\d+[.])[ \\t]+))/gm,function(_6a,m1,m2,m3,m4){\nvar _6f=m4;\nvar _70=m1;\nvar _71=m2;\nif(_70||(_6f.search(/\\n{2,}/)>-1)){\n_6f=_9(_72(_6f));\n}else{\n_6f=_1d(_72(_6f));\n_6f=_6f.replace(/\\n$/,\"\");\n_6f=_21(_6f);\n}\nreturn \"<li>\"+_6f+\"</li>\\n\";\n});\n_69=_69.replace(/~0/g,\"\");\n_4--;\nreturn _69;\n};\nvar _1e=function(_73){\n_73+=\"~0\";\n_73=_73.replace(/(?:\\n\\n|^)((?:(?:[ ]{4}|\\t).*\\n+)+)(\\n*[ ]{0,3}[^ \\t\\n]|(?=~0))/g,function(_74,m1,m2){\nvar _77=m1;\nvar _78=m2;\n_77=_79(_72(_77));\n_77=_6(_77);\n_77=_77.replace(/^\\n+/g,\"\");\n_77=_77.replace(/\\n+$/g,\"\");\n_77=\"<pre><code>\"+_77+\"\\n</code></pre>\";\nreturn _1c(_77)+_78;\n});\n_73=_73.replace(/~0/,\"\");\nreturn _73;\n};\nvar _1c=function(_7a){\n_7a=_7a.replace(/(^\\n+|\\n+$)/g,\"\");\nreturn \"\\n\\n~K\"+(_3.push(_7a)-1)+\"K\\n\\n\";\n};\nvar _23=function(_7b){\n_7b=_7b.replace(/(^|[^\\\\])(`+)([^\\r]*?[^`])\\2(?!`)/gm,function(_7c,m1,m2,m3,m4){\nvar c=m3;\nc=c.replace(/^([ \\t]*)/g,\"\");\nc=c.replace(/[ \\t]*$/g,\"\");\nc=_79(c);\nreturn m1+\"<code>\"+c+\"</code>\";\n});\nreturn _7b;\n};\nvar _79=function(_82){\n_82=_82.replace(/&/g,\"&amp;\");\n_82=_82.replace(/</g,\"&lt;\");\n_82=_82.replace(/>/g,\"&gt;\");\n_82=_2e(_82,\"*_{}[]\\\\\",false);\nreturn _82;\n};\nvar _29=function(_83){\n_83=_83.replace(/(\\*\\*|__)(?=\\S)([^\\r]*?\\S[*_]*)\\1/g,\"<strong>$2</strong>\");\n_83=_83.replace(/(\\*|_)(?=\\S)([^\\r]*?\\S)\\1/g,\"<em>$2</em>\");\nreturn _83;\n};\nvar _1f=function(_84){\n_84=_84.replace(/((^[ \\t]*>[ \\t]?.+\\n(.+\\n)*\\n*)+)/gm,function(_85,m1){\nvar bq=m1;\nbq=bq.replace(/^[ \\t]*>[ \\t]?/gm,\"~0\");\nbq=bq.replace(/~0/g,\"\");\nbq=bq.replace(/^[ \\t]+$/gm,\"\");\nbq=_9(bq);\nbq=bq.replace(/(^|\\n)/g,\"$1  \");\nbq=bq.replace(/(\\s*<pre>[^\\r]+?<\\/pre>)/gm,function(_88,m1){\nvar pre=m1;\npre=pre.replace(/^  /mg,\"~0\");\npre=pre.replace(/~0/g,\"\");\nreturn pre;\n});\nreturn _1c(\"<blockquote>\\n\"+bq+\"\\n</blockquote>\");\n});\nreturn _84;\n};\nvar _20=function(_8b){\n_8b=_8b.replace(/^\\n+/g,\"\");\n_8b=_8b.replace(/\\n+$/g,\"\");\nvar _8c=_8b.split(/\\n{2,}/g);\nvar _8d=new Array();\nvar end=_8c.length;\nfor(var i=0;i<end;i++){\nvar str=_8c[i];\nif(str.search(/~K(\\d+)K/g)>=0){\n_8d.push(str);\n}else{\nif(str.search(/\\S/)>=0){\nstr=_21(str);\nstr=str.replace(/^([ \\t]*)/g,\"<p>\");\nstr+=\"</p>\";\n_8d.push(str);\n}\n}\n}\nend=_8d.length;\nfor(var i=0;i<end;i++){\nwhile(_8d[i].search(/~K(\\d+)K/)>=0){\nvar _91=_3[RegExp.$1];\n_91=_91.replace(/\\$/g,\"$$$$\");\n_8d[i]=_8d[i].replace(/~K\\d+K/,_91);\n}\n}\nreturn _8d.join(\"\\n\\n\");\n};\nvar _11=function(_92){\n_92=_92.replace(/&(?!#?[xX]?(?:[0-9a-fA-F]+|\\w+);)/g,\"&amp;\");\n_92=_92.replace(/<(?![a-z\\/?\\$!])/gi,\"&lt;\");\nreturn _92;\n};\nvar _25=function(_93){\n_93=_93.replace(/\\\\(\\\\)/g,_94);\n_93=_93.replace(/\\\\([`*_{}\\[\\]()>#+-.!])/g,_94);\nreturn _93;\n};\nvar _28=function(_95){\n_95=_95.replace(/<((https?|ftp|dict):[^'\">\\s]+)>/gi,\"<a href=\\\"$1\\\">$1</a>\");\n_95=_95.replace(/<(?:mailto:)?([-.\\w]+\\@[-a-z0-9]+(\\.[-a-z0-9]+)*\\.[a-z]+)>/gi,function(_96,m1){\nreturn _98(_a(m1));\n});\nreturn _95;\n};\nvar _98=function(_99){\nfunction char2hex(ch){\nvar _9b=\"0123456789ABCDEF\";\nvar dec=ch.charCodeAt(0);\nreturn (_9b.charAt(dec>>4)+_9b.charAt(dec&15));\n}\nvar _9d=[function(ch){\nreturn \"&#\"+ch.charCodeAt(0)+\";\";\n},function(ch){\nreturn \"&#x\"+char2hex(ch)+\";\";\n},function(ch){\nreturn ch;\n}];\n_99=\"mailto:\"+_99;\n_99=_99.replace(/./g,function(ch){\nif(ch==\"@\"){\nch=_9d[Math.floor(Math.random()*2)](ch);\n}else{\nif(ch!=\":\"){\nvar r=Math.random();\nch=(r>0.9?_9d[2](ch):r>0.45?_9d[1](ch):_9d[0](ch));\n}\n}\nreturn ch;\n});\n_99=\"<a href=\\\"\"+_99+\"\\\">\"+_99+\"</a>\";\n_99=_99.replace(/\">.+:/g,\"\\\">\");\nreturn _99;\n};\nvar _a=function(_a3){\n_a3=_a3.replace(/~E(\\d+)E/g,function(_a4,m1){\nvar _a6=parseInt(m1);\nreturn String.fromCharCode(_a6);\n});\nreturn _a3;\n};\nvar _72=function(_a7){\n_a7=_a7.replace(/^(\\t|[ ]{1,4})/gm,\"~0\");\n_a7=_a7.replace(/~0/g,\"\");\nreturn _a7;\n};\nvar _6=function(_a8){\n_a8=_a8.replace(/\\t(?=\\t)/g,\"    \");\n_a8=_a8.replace(/\\t/g,\"~A~B\");\n_a8=_a8.replace(/~B(.+?)~A/g,function(_a9,m1,m2){\nvar _ac=m1;\nvar _ad=4-_ac.length%4;\nfor(var i=0;i<_ad;i++){\n_ac+=\" \";\n}\nreturn _ac;\n});\n_a8=_a8.replace(/~A/g,\"    \");\n_a8=_a8.replace(/~B/g,\"\");\nreturn _a8;\n};\nvar _2e=function(_af,_b0,_b1){\nvar _b2=\"([\"+_b0.replace(/([\\[\\]\\\\])/g,\"\\\\$1\")+\"])\";\nif(_b1){\n_b2=\"\\\\\\\\\"+_b2;\n}\nvar _b3=new RegExp(_b2,\"g\");\n_af=_af.replace(_b3,_94);\nreturn _af;\n};\nvar _94=function(_b4,m1){\nvar _b6=m1.charCodeAt(0);\nreturn \"~E\"+_b6+\"E\";\n};\n};\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.uberfire</groupId>\n        <artifactId>uberfire-widgets</artifactId>\n        <version>7.75.0-SNAPSHOT</version>\n    </parent>\n    <artifactId>uberfire-widgets-service</artifactId>\n    <packaging>pom</packaging>\n    <name>Uberfire Widgets Commons Services</name>\n    <description>Uberfire Widgets Commons Services</description>\n    <modules>\n        <module>uberfire-widgets-service-api</module>\n        <module>uberfire-widgets-service-backend</module>\n    </modules>\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-service</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <artifactId>uberfire-widgets-service-api</artifactId>\n  <packaging>jar</packaging>\n  <name>Uberfire Widgets Commons Services API</name>\n  <description>Uberfire Widgets Commons Services API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/GridColumnPreference.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class GridColumnPreference implements Comparable {\n\n    private String name;\n    private Integer position;\n    private String width;\n\n    public GridColumnPreference(@MapsTo(\"name\") String name,\n                                @MapsTo(\"position\") Integer position,\n                                @MapsTo(\"width\") String width) {\n        this.name = name;\n        this.position = position;\n        this.width = width;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public Integer getPosition() {\n        return position;\n    }\n\n    public void setPosition(Integer position) {\n        this.position = position;\n    }\n\n    public String getWidth() {\n        return width;\n    }\n\n    public void setWidth(String width) {\n        this.width = width;\n    }\n\n    @Override\n    public int compareTo(Object o) {\n        if (!(o instanceof GridColumnPreference)) {\n            return 0;\n        }\n        if (position < ((GridColumnPreference) o).getPosition()) {\n            return -1;\n        } else if (position > ((GridColumnPreference) o).getPosition()) {\n            return 1;\n        } else {\n            return 0;\n        }\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 5;\n        hash = 79 * hash + (this.name != null ? this.name.hashCode() : 0);\n        hash = 79 * hash + (this.position != null ? this.position.hashCode() : 0);\n        hash = 79 * hash + (this.width != null ? this.width.hashCode() : 0);\n        return hash;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        final GridColumnPreference other = (GridColumnPreference) obj;\n        if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {\n            return false;\n        }\n        if (this.position != other.position && (this.position == null || !this.position.equals(other.position))) {\n            return false;\n        }\n        if ((this.width == null) ? (other.width != null) : !this.width.equals(other.width)) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return \"GridColumnPreference{\" + \"name=\" + name + \", position=\" + position + \", width=\" + width + '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/GridGlobalPreferences.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class GridGlobalPreferences {\n\n    private static int DEFAULT_PAGE_SIZE = 10;\n\n    private String key;\n    private List<String> initialColumns = new ArrayList<String>();\n    private List<String> bannedColumns = new ArrayList<String>();\n    private int pageSize = DEFAULT_PAGE_SIZE;\n\n    public GridGlobalPreferences() {\n    }\n\n    public GridGlobalPreferences(String key,\n                                 List<String> initialColumns,\n                                 List<String> bannedColumns) {\n        this.key = key;\n        this.initialColumns = initialColumns;\n        this.bannedColumns = bannedColumns;\n    }\n\n    public String getKey() {\n        return key;\n    }\n\n    public List<String> getInitialColumns() {\n        return initialColumns;\n    }\n\n    public List<String> getBannedColumns() {\n        return bannedColumns;\n    }\n\n    public int getPageSize() {\n        return this.pageSize;\n    }\n\n    public void setPageSize(int pageSize) {\n        this.pageSize = pageSize;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/GridPreferencesStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class GridPreferencesStore extends UserPreference {\n\n    private GridGlobalPreferences globalPreferences;\n    private List<GridColumnPreference> columnPreferences = new ArrayList<GridColumnPreference>();\n    private int pageSizePreferences;\n    private String selectedFilterKey;\n    private HashMap<String, HashMap> customFilters = new HashMap<String, HashMap>();\n    private GridSortedColumnPreference gridSortedColumnPreference;\n\n    public GridPreferencesStore() {\n    }\n\n    public GridPreferencesStore(GridGlobalPreferences globalPreferences) {\n        this.globalPreferences = globalPreferences;\n        if (globalPreferences != null) {\n            this.pageSizePreferences = globalPreferences.getPageSize();\n        }\n        super.type = UserPreferencesType.GRIDPREFERENCES;\n        super.preferenceKey = globalPreferences.getKey();\n    }\n\n    public GridGlobalPreferences getGlobalPreferences() {\n        return globalPreferences;\n    }\n\n    public List<GridColumnPreference> getColumnPreferences() {\n        return columnPreferences;\n    }\n\n    public void addGridColumnPreference(GridColumnPreference preference) {\n        columnPreferences.add(preference);\n    }\n\n    public GridSortedColumnPreference getGridSortedColumnPreference() {\n        return gridSortedColumnPreference;\n    }\n\n    public void setGridSortedColumnPreference(GridSortedColumnPreference gridSortedColumnPreference) {\n        this.gridSortedColumnPreference = gridSortedColumnPreference;\n    }\n\n    public void resetGridColumnPreferences() {\n        columnPreferences.clear();\n    }\n\n    public void resetPageSizePreferences() {\n        if (globalPreferences != null) {\n            this.pageSizePreferences = globalPreferences.getPageSize();\n        }\n    }\n\n    public int getPageSizePreferences() {\n        return pageSizePreferences;\n    }\n\n    public void setPageSizePreferences(int pageSizePreferences) {\n        this.pageSizePreferences = pageSizePreferences;\n    }\n\n    public String getSelectedFilterKey() {\n        return selectedFilterKey;\n    }\n\n    public void setSelectedFilterKey(String selectedFilterKey) {\n        if (!\"addFilter\".equals(selectedFilterKey)) {\n            this.selectedFilterKey = selectedFilterKey;\n        }\n    }\n\n    public void addCustomFilter(String filterName,\n                                HashMap filterParams) {\n        customFilters.put(filterName,\n                          filterParams);\n    }\n\n    public HashMap getCustomFilters() {\n        return customFilters;\n    }\n\n    public void removeCustomFilter(String filterName) {\n        customFilters.remove(filterName);\n    }\n\n    public void resetGridPreferences() {\n        resetPageSizePreferences();\n        resetGridColumnPreferences();\n        selectedFilterKey = \"\";\n        customFilters.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/GridSortedColumnPreference.java",
    "content": "/*\n * Copyright 2019 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class GridSortedColumnPreference implements Comparable {\n\n    private String dataStoreName;\n    private boolean ascending;\n\n    public GridSortedColumnPreference(@MapsTo(\"dataStoreName\") String dataStoreName,\n                                      @MapsTo(\"ascending\") boolean ascending) {\n        this.dataStoreName = dataStoreName;\n        this.ascending = ascending;\n    }\n\n    public String getDataStoreName() {\n        return dataStoreName;\n    }\n\n    public void setDataStoreName(String dataStoreName) {\n        this.dataStoreName = dataStoreName;\n    }\n\n    public boolean isAscending() {\n        return ascending;\n    }\n\n    public void setAscending(boolean ascending) {\n        this.ascending = ascending;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        GridSortedColumnPreference that = (GridSortedColumnPreference) o;\n\n        if (ascending != that.ascending) {\n            return false;\n        }\n        return dataStoreName != null ? dataStoreName.equals(that.dataStoreName) : that.dataStoreName == null;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = dataStoreName != null ? dataStoreName.hashCode() : 0;\n        result = 31 * result + (ascending ? 1 : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public int compareTo(Object o) {\n        if (!(o instanceof GridSortedColumnPreference)) {\n            return 0;\n        }\n        String name = ((GridSortedColumnPreference) o).getDataStoreName();\n        boolean order = ((GridSortedColumnPreference) o).isAscending();\n\n        if (!dataStoreName.equals(name)) {\n            return 0;\n        }\n\n        if (order != ascending) {\n            return 0;\n        }\n\n        return 1;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/MultiGridPreferencesStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class MultiGridPreferencesStore extends UserPreference {\n\n    private String multiGridId;\n    private HashMap<String, HashMap> gridsSettings = new HashMap<String, HashMap>();\n    private ArrayList<String> gridsIds = new ArrayList<String>();\n    private String selectedGrid = \"NONE\";\n    private int refreshInterval = 10;\n    private String defaultGridId = \"\";\n\n    public MultiGridPreferencesStore() {\n    }\n\n    public MultiGridPreferencesStore(String multiGridId) {\n        this.multiGridId = multiGridId;\n        super.type = UserPreferencesType.MULTIGRIDPREFERENCES;\n        super.preferenceKey = multiGridId;\n    }\n\n    public String getMultiGridId() {\n        return multiGridId;\n    }\n\n    public void setMultiGridId(String multiGridId) {\n        this.multiGridId = multiGridId;\n    }\n\n    public HashMap getGridSettings(String key) {\n        if (gridsSettings != null) {\n            return gridsSettings.get(key);\n        }\n        return null;\n    }\n\n    public String getGridSettingParam(String key,\n                                      String paramId) {\n        HashMap<String, String> params = getGridSettings(key);\n        if (params != null) {\n            return params.get(paramId);\n        }\n        return null;\n    }\n\n    public void setGridSettings(String key,\n                                HashMap params) {\n        gridsSettings.put(key,\n                          params);\n    }\n\n    public ArrayList<String> getGridsId() {\n        return gridsIds;\n    }\n\n    public void addGridId(String gridKey) {\n        getGridsId().add(gridKey);\n    }\n\n    public void addNewTab(String gridKey,\n                          HashMap gridsSettings) {\n        addGridId(gridKey);\n        setGridSettings(gridKey,\n                        gridsSettings);\n    }\n\n    public void removeTab(String gridKey) {\n        gridsSettings.remove(gridKey);\n\n        for (int i = 0; i < getGridsId().size(); i++) {\n            if (gridsIds.get(i).equals(gridKey)) {\n                gridsIds.remove(i);\n            }\n        }\n        if (isSelectedGrid(gridKey)) {\n            selectedGrid = \"\";\n        }\n    }\n\n    public boolean isSelectedGrid(String gridKey) {\n        if (selectedGrid != null) {\n            return selectedGrid.equals(gridKey);\n        }\n        return false;\n    }\n\n    public String getSelectedGrid() {\n        return selectedGrid;\n    }\n\n    public void setSelectedGrid(String gridKey) {\n        selectedGrid = gridKey;\n    }\n\n    public int getRefreshInterval() {\n        return refreshInterval;\n    }\n\n    public void setRefreshInterval(int refreshInterval) {\n        this.refreshInterval = refreshInterval;\n    }\n\n    public String getDefaultGridId() {\n        return defaultGridId;\n    }\n\n    public void setDefaultGridId(String defaultGridId) {\n        this.defaultGridId = defaultGridId;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/UserPreference.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UserPreference {\n\n    protected UserPreferencesType type;\n\n    protected String preferenceKey;\n\n    public UserPreferencesType getType() {\n        return type;\n    }\n\n    public void setType(final UserPreferencesType type) {\n        this.type = type;\n    }\n\n    public String getPreferenceKey() {\n        return this.preferenceKey;\n    }\n\n    public void setPreferenceKey(final String preferenceKey) {\n        this.preferenceKey = preferenceKey;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/UserPreferencesService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface UserPreferencesService {\n\n    void saveUserPreferences(final UserPreference preferences);\n\n    UserPreference loadUserPreferences(final String key,\n                                       final UserPreferencesType type);\n\n    UserPreference loadUserPreferences(final UserPreference preferences);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/UserPreferencesType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\npublic enum UserPreferencesType {\n\n    GRIDPREFERENCES(\"datagrid-preferences\"),\n    MULTIGRIDPREFERENCES(\"multigrid-preferences\"),\n    WORKBENCHSETTINGS(\"workbench-settings\");\n\n    private String ext;\n\n    private UserPreferencesType(final String ext) {\n        this.ext = ext;\n    }\n\n    public String getExt() {\n        return this.ext;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/java/org/uberfire/ext/services/shared/preferences/UserWorkbenchPreferences.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.shared.preferences;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UserWorkbenchPreferences extends UserPreference {\n\n    private String language;\n    private boolean useWorkbenchInCompactMode;\n\n    public UserWorkbenchPreferences() {\n    }\n\n    public UserWorkbenchPreferences(final String language) {\n        super();\n        super.type = UserPreferencesType.WORKBENCHSETTINGS;\n        super.preferenceKey = \"settings\";\n        this.language = language;\n    }\n\n    public String getLanguage() {\n        return language;\n    }\n\n    public void setLanguage(final String language) {\n        this.language = language;\n    }\n\n    public boolean isUseWorkbenchInCompactMode() {\n        return useWorkbenchInCompactMode;\n    }\n\n    public void setUseWorkbenchInCompactMode(boolean useWorkbenchInCompactMode) {\n        this.useWorkbenchInCompactMode = useWorkbenchInCompactMode;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-api/src/main/resources/org/uberfire/ext/services/UberfireWidgetsServicesAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.uberfire.UberfireBackend'/>\n  <source path='shared'/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets-service</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <name>Uberfire Widgets Commons Services Backend</name>\n  <description>Uberfire Widgets Commons Services Backend</description>\n  <artifactId>uberfire-widgets-service-backend</artifactId>\n  <packaging>jar</packaging>\n  <dependencies>\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-backend/src/main/java/org/uberfire/ext/services/backend/preferences/UserPreferencesServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.services.backend.preferences;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.kie.soup.xstream.XStreamUtils;\nimport org.uberfire.backend.server.UserServicesBackendImpl;\nimport org.uberfire.ext.services.shared.preferences.UserPreference;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesService;\nimport org.uberfire.ext.services.shared.preferences.UserPreferencesType;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\n@Service\npublic class UserPreferencesServiceImpl implements UserPreferencesService {\n\n    @Inject\n    private UserServicesBackendImpl userServicesBackend;\n\n    @Inject\n    private User identity;\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioServiceConfig;\n\n    private XStream xs = XStreamUtils.createTrustingXStream();\n\n    @Override\n    public void saveUserPreferences(final UserPreference preferences) {\n        final Path preferencesPath = userServicesBackend.buildPath(identity.getIdentifier(),\n                                                                   preferences.getType().getExt(),\n                                                                   preferences.getPreferenceKey());\n        saveUserPreferences(preferences,\n                            preferencesPath);\n    }\n\n    @Override\n    public UserPreference loadUserPreferences(final String key,\n                                              final UserPreferencesType type) {\n        final Path preferencesPath = userServicesBackend.buildPath(identity.getIdentifier(),\n                                                                   type.getExt(),\n                                                                   key);\n        return loadUserPreferences(preferencesPath);\n    }\n\n    private void saveUserPreferences(final UserPreference preferences,\n                                     final Path path) {\n        try {\n            ioServiceConfig.startBatch(path.getFileSystem());\n            ioServiceConfig.write(path,\n                                  xs.toXML(preferences));\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            ioServiceConfig.endBatch();\n        }\n    }\n\n    private UserPreference loadUserPreferences(final Path path) {\n        try {\n            if (ioServiceConfig.exists(path)) {\n                final String xml = ioServiceConfig.readAllString(path);\n                return (UserPreference) xs.fromXML(xml);\n            }\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n        return null;\n    }\n\n    @Override\n    public UserPreference loadUserPreferences(final UserPreference preferences) {\n        final Path preferencesPath = userServicesBackend.buildPath(identity.getIdentifier(),\n                                                                   preferences.getType().getExt(),\n                                                                   preferences.getPreferenceKey());\n        return loadUserPreferences(preferencesPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-service/uberfire-widgets-service-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.uberfire\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-widgets</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-widgets-table</artifactId>\n\n  <name>Uberfire Table Widget</name>\n  <description>Uberfire Table Widget</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n\n    <!-- Test -->\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/CheckboxCellImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.cell.client.AbstractEditableCell;\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.InputElement;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\n\n/**\n * A {@link Cell} used to render a checkbox. The value of the checkbox may be\n * toggled using the ENTER key as well as via mouse click.\n */\npublic class CheckboxCellImpl extends AbstractEditableCell<Boolean, Boolean> {\n\n    /**\n     * An html string representation of a checked input box.\n     */\n    private static final SafeHtml INPUT_CHECKED = SafeHtmlUtils.fromSafeConstant(\"<input type=\\\"checkbox\\\" tabindex=\\\"-1\\\" checked/>\");\n\n    /**\n     * An html string representation of an unchecked input box.\n     */\n    private static final SafeHtml INPUT_UNCHECKED = SafeHtmlUtils.fromSafeConstant(\"<input type=\\\"checkbox\\\" tabindex=\\\"-1\\\"/>\");\n\n    /**\n     * An html string representation of a read-only checked input box.\n     */\n    private static final SafeHtml READ_ONLY_INPUT_CHECKED = SafeHtmlUtils.fromSafeConstant(\"<input type=\\\"checkbox\\\" tabindex=\\\"-1\\\" checked disabled=\\\"disabled\\\"/>\");\n\n    /**\n     * An html string representation of a read-only unchecked input box.\n     */\n    private static final SafeHtml READ_ONLY_INPUT_UNCHECKED = SafeHtmlUtils.fromSafeConstant(\"<input type=\\\"checkbox\\\" tabindex=\\\"-1\\\" disabled=\\\"disabled\\\"/>\");\n\n    protected boolean isReadOnly;\n\n    /**\n     * Construct a new {@link CheckboxCellImpl}\n     */\n    public CheckboxCellImpl(boolean isReadOnly) {\n        super(\"click\",\n              \"keydown\");\n        this.isReadOnly = isReadOnly;\n    }\n\n    CheckboxCellImpl(String... consumedEvents) {\n        super(consumedEvents);\n    }\n\n    @Override\n    public boolean isEditing(Context context,\n                             Element parent,\n                             Boolean value) {\n        // A checkbox is never in \"edit mode\". There is no intermediate state\n        // between checked and unchecked.\n        return false;\n    }\n\n    @Override\n    public void onBrowserEvent(Context context,\n                               Element parent,\n                               Boolean value,\n                               NativeEvent event,\n                               ValueUpdater<Boolean> valueUpdater) {\n\n        //If read-only ignore editing events\n        if (isReadOnly) {\n            return;\n        }\n\n        String type = event.getType();\n\n        boolean enterPressed = \"keydown\".equals(type) && event.getKeyCode() == KeyCodes.KEY_ENTER;\n        if (\"click\".equals(type) || enterPressed) {\n            InputElement input = parent.getFirstChild().cast();\n            Boolean isChecked = input.isChecked();\n\n            /*\n             * Toggle the value if the enter key was pressed and the cell\n             * handles selection or doesn't depend on selection. If the cell\n             * depends on selection but doesn't handle selection, then ignore\n             * the enter key and let the SelectionEventManager determine which\n             * keys will trigger a change.\n             */\n            if (enterPressed) {\n                isChecked = !isChecked;\n                input.setChecked(isChecked);\n            }\n\n            /*\n             * Save the new value. However, if the cell depends on the\n             * selection, then do not save the value because we can get into an\n             * inconsistent state.\n             */\n            if (value != isChecked) {\n                setViewData(context.getKey(),\n                            isChecked);\n            }\n\n            if (valueUpdater != null) {\n                valueUpdater.update(isChecked);\n            }\n        }\n    }\n\n    @Override\n    public void render(Context context,\n                       Boolean value,\n                       SafeHtmlBuilder sb) {\n        // Get the view data.\n        Object key = context.getKey();\n        Boolean viewData = getViewData(key);\n        if (viewData != null && viewData.equals(value)) {\n            clearViewData(key);\n            viewData = null;\n        }\n\n        if (value != null && ((viewData != null) ? viewData : value)) {\n            if (isReadOnly) {\n                sb.append(READ_ONLY_INPUT_CHECKED);\n            } else {\n                sb.append(INPUT_CHECKED);\n            }\n        } else {\n            if (isReadOnly) {\n                sb.append(READ_ONLY_INPUT_UNCHECKED);\n            } else {\n                sb.append(INPUT_UNCHECKED);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ColumnChangedHandler.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\npublic interface ColumnChangedHandler {\n\n    void beforeColumnChanged();\n\n    void afterColumnChanged();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ColumnMeta.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\n\npublic class ColumnMeta<T> implements Comparable {\n\n    private Column<T, ?> column;\n    private String caption;\n    private Header header;\n    private boolean visible = true;\n    private int position = -1;\n    private boolean extraColumn;\n    private boolean isVisibleIndex = true;\n\n    public ColumnMeta(Column<T, ?> column,\n                      String caption) {\n        this.column = column;\n        this.caption = caption;\n    }\n\n    public ColumnMeta(Column<T, ?> column,\n                      String caption,\n                      boolean visible) {\n        this.column = column;\n        this.caption = caption;\n        this.visible = visible;\n    }\n\n    public ColumnMeta(Column<T, ?> column,\n                      String caption,\n                      boolean visible,\n                      int position) {\n        this.column = column;\n        this.caption = caption;\n        this.visible = visible;\n        this.position = position;\n    }\n\n    public ColumnMeta(Column<T, ?> column,\n                      String caption,\n                      boolean visible,\n                      boolean extraColumn) {\n        this(column,\n             caption,\n             visible);\n        this.extraColumn = extraColumn;\n    }\n\n    public boolean isExtraColumn() {\n        return extraColumn;\n    }\n\n    public String getCaption() {\n        return caption;\n    }\n\n    public void setCaption(String caption) {\n        this.caption = caption;\n    }\n\n    public Header getHeader() {\n        return header;\n    }\n\n    public void setHeader(Header header) {\n        this.header = header;\n    }\n\n    public Column<T, ?> getColumn() {\n        return column;\n    }\n\n    public boolean isVisible() {\n        return visible;\n    }\n\n    public void setVisible(boolean visible) {\n        this.visible = visible;\n    }\n\n    public int getPosition() {\n        return position;\n    }\n\n    public void setPosition(int position) {\n        this.position = position;\n    }\n\n    public boolean isVisibleIndex() {\n        return isVisibleIndex;\n    }\n\n    public void setVisibleIndex(boolean visibleIndex) {\n        isVisibleIndex = visibleIndex;\n    }\n\n    @Override\n    public int compareTo(Object o) {\n        if (!(o instanceof ColumnMeta)) {\n            return 0;\n        }\n        ColumnMeta otherMeta = (ColumnMeta) o;\n        if (position == -1 && otherMeta.getPosition() == -1) {\n            return 0;\n        }\n        if (position == -1) {\n            return 1;\n        }\n        if (otherMeta.getPosition() == -1) {\n            return -1;\n        }\n        if (position < otherMeta.getPosition()) {\n            return -1;\n        } else if (position > otherMeta.getPosition()) {\n            return 1;\n        } else {\n            return 0;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/DataGrid.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.view.client.ProvidesKey;\n\npublic class DataGrid<T> extends org.gwtbootstrap3.client.ui.gwt.DataGrid<T> {\n\n    public DataGrid() {\n        super();\n        setupDefaults();\n    }\n\n    public DataGrid(final ProvidesKey<T> keyProvider) {\n        super(keyProvider);\n        setupDefaults();\n    }\n\n    protected void setupDefaults() {\n        setHover(true);\n        setStriped(true);\n        setBordered(true);\n        addRedrawHandler(() -> fixTableStyle(this.getElement()));\n    }\n\n    public native void fixTableStyle(final Element e) /*-{\n        var table = $wnd.jQuery(e).find(\"table\").first();\n        table.addClass(\"table\");\n        table.css(\"margin-bottom\", \"0px\");\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/PagedTableHelper.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.uberfire.ext.widgets.table.client.resources.i18n.CommonConstants;\n\npublic class PagedTableHelper {\n\n    public static void setSelectedValue(final ListBox listbox,\n                                        final String value) {\n\n        for (int i = 0; i < listbox.getItemCount(); i++) {\n            if (listbox.getValue(i).equals(value)) {\n                listbox.setSelectedIndex(i);\n                return;\n            }\n        }\n    }\n\n    public static void setSelectIndexOnPageSizesSelector(int minPageSize,\n                                                         int maxPageSize,\n                                                         int incPageSize,\n                                                         ListBox pageSizesSelector,\n                                                         int pageSize) {\n        for (int i = minPageSize; i <= maxPageSize; i = i + incPageSize) {\n            pageSizesSelector\n                    .addItem(String.valueOf(i) + \" \" + CommonConstants.INSTANCE.Items(),\n                             String.valueOf(i));\n            if (i == pageSize) {\n                for (int z = 0; z < pageSizesSelector.getItemCount(); z++) {\n                    if (pageSizesSelector.getValue(z).equals(String.valueOf(i))) {\n                        pageSizesSelector.setSelectedIndex(z);\n                        break;\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/ResizableMovableHeader.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.cell.client.AbstractCell;\nimport com.google.gwt.cell.client.Cell.Context;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Cursor;\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.Event.NativePreviewEvent;\nimport com.google.gwt.user.client.Event.NativePreviewHandler;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\nimport static com.google.gwt.dom.client.Style.Unit.PX;\n\n/**\n * A column header that supports resizing and moving\n * See https://github.com/gchatelet/GwtResizableDraggableColumns/blob/master/src/fr/mikrosimage/gwt/client/ResizableHeader.java\n *\n * @param <T>\n */\npublic abstract class ResizableMovableHeader<T> extends Header<String> {\n\n    private static final Cursor MOVE_CURSOR = Cursor.MOVE;\n    private static final String MOVE_COLOR = \"gray\";\n    private static final int MOVE_HANDLE_WIDTH = 32;\n\n    private static final Cursor RESIZE_CURSOR = Cursor.COL_RESIZE;\n    private static final String RESIZE_COLOR = \"gray\";\n    private static final int RESIZE_HANDLE_WIDTH = 8;\n\n    private static final double GHOST_OPACITY = .3;\n\n    private static final int MINIMUM_COLUMN_WIDTH = 30;\n\n    private final Document document = Document.get();\n\n    private final String title;\n    private final DataGrid<T> table;\n    private final UberfireColumnPicker columnPicker;\n    private final Column<T, ?> column;\n\n    private final Element tableElement;\n    private HeaderHelper current;\n    private List<ColumnChangedHandler> columnChangedHandlers = new ArrayList<ColumnChangedHandler>();\n\n    public ResizableMovableHeader(final String title,\n                                  final DataGrid<T> table,\n                                  final UberfireColumnPicker columnPicker,\n                                  final Column<T, ?> column) {\n        super(new HeaderCell());\n        this.title = PortablePreconditions.checkNotNull(\"title\",\n                                                        title);\n        this.table = PortablePreconditions.checkNotNull(\"table\",\n                                                        table);\n        this.columnPicker = PortablePreconditions.checkNotNull(\"columnPicker\",\n                                                               columnPicker);\n        this.column = PortablePreconditions.checkNotNull(\"column\",\n                                                         column);\n        this.tableElement = table.getElement();\n    }\n\n    private static NativeEvent getEventAndPreventPropagation(final NativePreviewEvent event) {\n        final NativeEvent nativeEvent = event.getNativeEvent();\n        nativeEvent.preventDefault();\n        nativeEvent.stopPropagation();\n        return nativeEvent;\n    }\n\n    private static void setLine(final Style style,\n                                final int width,\n                                final int top,\n                                final int height,\n                                final String color) {\n        style.setPosition(Position.ABSOLUTE);\n        style.setTop(top,\n                     PX);\n        style.setHeight(height,\n                        PX);\n        style.setWidth(width,\n                       PX);\n        style.setBackgroundColor(color);\n        style.setZIndex(Integer.MAX_VALUE);\n    }\n\n    @Override\n    public String getValue() {\n        return title;\n    }\n\n    @Override\n    public void onBrowserEvent(final Context context,\n                               final Element target,\n                               final NativeEvent event) {\n        if (current == null) {\n            current = new HeaderHelper(target,\n                                       event);\n        }\n    }\n\n    protected void columnResized(final int newWidth) {\n        table.setColumnWidth(column,\n                             newWidth + \"px\");\n        columnPicker.adjustColumnWidths();\n        for (ColumnChangedHandler handler : columnChangedHandlers) {\n            handler.afterColumnChanged();\n        }\n    }\n\n    protected void columnMoved(final int fromIndex,\n                               final int beforeIndex) {\n        columnPicker.columnMoved(fromIndex,\n                                 beforeIndex);\n        table.removeColumn(fromIndex);\n        table.insertColumn(beforeIndex,\n                           column,\n                           this);\n        for (ColumnChangedHandler handler : columnChangedHandlers) {\n            handler.afterColumnChanged();\n        }\n    }\n\n    protected abstract int getTableBodyHeight();\n\n    public void addColumnChangedHandler(ColumnChangedHandler handler) {\n        if (handler != null) {\n            columnChangedHandlers.add(handler);\n        }\n    }\n\n    interface IDragCallback {\n\n        void dragFinished();\n    }\n\n    private static class HeaderCell extends AbstractCell<String> {\n\n        public HeaderCell() {\n            super(\"mousemove\");\n        }\n\n        @Override\n        public void render(final Context context,\n                           final String value,\n                           final SafeHtmlBuilder sb) {\n            sb.append(SafeHtmlUtils.fromString(value));\n        }\n    }\n\n    private class HeaderHelper implements NativePreviewHandler,\n                                          IDragCallback {\n\n        private final HandlerRegistration handler = Event.addNativePreviewHandler(this);\n        private final Element source;\n        private final Element handles;\n        private final Element moveHandle;\n        private final Element resizeHandle;\n        private boolean dragging;\n\n        public HeaderHelper(final Element target,\n                            final NativeEvent event) {\n            event.preventDefault();\n            event.stopPropagation();\n            this.source = target;\n            this.handles = document.createDivElement();\n\n            final int leftBound = target.getOffsetLeft() + target.getOffsetWidth();\n            this.moveHandle = createSpanElement(MOVE_CURSOR,\n                                                leftBound - RESIZE_HANDLE_WIDTH - MOVE_HANDLE_WIDTH,\n                                                MOVE_HANDLE_WIDTH);\n            this.resizeHandle = createSpanElement(RESIZE_CURSOR,\n                                                  leftBound - RESIZE_HANDLE_WIDTH,\n                                                  RESIZE_HANDLE_WIDTH);\n            handles.appendChild(moveHandle);\n            handles.appendChild(resizeHandle);\n            source.appendChild(handles);\n        }\n\n        private SpanElement createSpanElement(final Cursor cursor,\n                                              final double left,\n                                              final double width) {\n            final SpanElement span = document.createSpanElement();\n            span.setAttribute(\"title\",\n                              title);\n            final Style style = span.getStyle();\n            style.setCursor(cursor);\n            style.setPosition(Position.ABSOLUTE);\n            style.setBottom(0,\n                            PX);\n            style.setHeight(source.getOffsetHeight(),\n                            PX);\n            style.setTop(source.getOffsetTop(),\n                         PX);\n            style.setWidth(width,\n                           PX);\n            style.setLeft(left,\n                          PX);\n            return span;\n        }\n\n        @Override\n        public void onPreviewNativeEvent(final NativePreviewEvent event) {\n            final NativeEvent natEvent = event.getNativeEvent();\n            final Element element = natEvent.getEventTarget().cast();\n            final String eventType = natEvent.getType();\n            if (!(element == moveHandle || element == resizeHandle)) {\n                if (\"mousedown\".equals(eventType)) {\n                    //No need to do anything, the event will be passed on to the column sort handler\n                } else if (!dragging && \"mouseover\".equals(eventType)) {\n                    cleanUp();\n                }\n                return;\n            }\n            final NativeEvent nativeEvent = getEventAndPreventPropagation(event);\n            if (\"mousedown\".equals(eventType)) {\n                if (element == resizeHandle) {\n                    moveHandle.removeFromParent();\n                    new ColumnResizeHelper(this,\n                                           source,\n                                           nativeEvent);\n                } else {\n                    new ColumnMoverHelper(this,\n                                          source,\n                                          nativeEvent);\n                }\n                dragging = true;\n            }\n        }\n\n        private void cleanUp() {\n            handler.removeHandler();\n            handles.removeFromParent();\n            current = null;\n        }\n\n        public void dragFinished() {\n            dragging = false;\n            cleanUp();\n        }\n    }\n\n    private class ColumnResizeHelper implements NativePreviewHandler {\n\n        private final HandlerRegistration handler = Event.addNativePreviewHandler(this);\n        private final DivElement resizeLine = document.createDivElement();\n        private final Style resizeLineStyle = resizeLine.getStyle();\n        private final Element header;\n        private final IDragCallback dragCallback;\n\n        private ColumnResizeHelper(final IDragCallback dragCallback,\n                                   final Element header,\n                                   final NativeEvent event) {\n            this.dragCallback = dragCallback;\n            this.header = header;\n            setLine(resizeLineStyle,\n                    2,\n                    0,\n                    getTableBodyHeight(),\n                    RESIZE_COLOR);\n            moveLine(event.getClientX());\n            tableElement.appendChild(resizeLine);\n        }\n\n        @Override\n        public void onPreviewNativeEvent(final NativePreviewEvent event) {\n            final NativeEvent nativeEvent = getEventAndPreventPropagation(event);\n            final int clientX = nativeEvent.getClientX();\n            final String eventType = nativeEvent.getType();\n            if (\"mousemove\".equals(eventType)) {\n                moveLine(clientX);\n            } else if (\"mouseup\".equals(eventType)) {\n                handler.removeHandler();\n                resizeLine.removeFromParent();\n                dragCallback.dragFinished();\n                columnResized(Math.max(clientX - header.getAbsoluteLeft(),\n                                       MINIMUM_COLUMN_WIDTH));\n            }\n        }\n\n        private void moveLine(final int clientX) {\n            final int xPos = clientX - table.getAbsoluteLeft();\n            resizeLineStyle.setLeft(xPos,\n                                    PX);\n        }\n    }\n\n    private class ColumnMoverHelper implements NativePreviewHandler {\n\n        private static final int ghostLineWidth = 4;\n        private final HandlerRegistration handler = Event.addNativePreviewHandler(this);\n        private final DivElement ghostLine = document.createDivElement();\n        private final Style ghostLineStyle = ghostLine.getStyle();\n        private final DivElement ghostColumn = document.createDivElement();\n        private final Style ghostColumnStyle = ghostColumn.getStyle();\n        private final int columnWidth;\n        private final int[] columnXPositions;\n        private final IDragCallback dragCallback;\n        private int fromIndex = -1;\n        private int toIndex;\n\n        private ColumnMoverHelper(final IDragCallback dragCallback,\n                                  final Element target,\n                                  final NativeEvent event) {\n            final int clientX = event.getClientX();\n            final Element tr = getRowElement(target);\n            final int columns = tr.getChildCount();\n\n            this.dragCallback = dragCallback;\n            this.columnWidth = target.getOffsetWidth();\n            this.columnXPositions = new int[columns + 1];\n            this.columnXPositions[0] = tr.getAbsoluteLeft();\n            for (int i = 0; i < columns; ++i) {\n                final int xPos = columnXPositions[i] + ((Element) tr.getChild(i)).getOffsetWidth();\n                if (xPos > clientX && fromIndex == -1) {\n                    fromIndex = i;\n                }\n                columnXPositions[i + 1] = xPos;\n            }\n            toIndex = fromIndex;\n            final int bodyHeight = getTableBodyHeight();\n            setLine(ghostColumnStyle,\n                    columnWidth,\n                    0,\n                    bodyHeight,\n                    MOVE_COLOR);\n            setLine(ghostLineStyle,\n                    ghostLineWidth,\n                    0,\n                    bodyHeight,\n                    RESIZE_COLOR);\n            ghostColumnStyle.setOpacity(GHOST_OPACITY);\n            moveColumn(clientX);\n            tableElement.appendChild(ghostColumn);\n            tableElement.appendChild(ghostLine);\n        }\n\n        protected Element getRowElement(Element target) {\n            Element parent = target.getParentElement();\n            while (parent != null) {\n                if (parent.getTagName().equalsIgnoreCase(\"tr\")) {\n                    return parent;\n                }\n                parent = parent.getParentElement();\n            }\n            return target.getParentElement();\n        }\n\n        @Override\n        public void onPreviewNativeEvent(final NativePreviewEvent event) {\n            final NativeEvent nativeEvent = getEventAndPreventPropagation(event);\n            final String eventType = nativeEvent.getType();\n            if (\"mousemove\".equals(eventType)) {\n                moveColumn(nativeEvent.getClientX());\n            } else if (\"mouseup\".equals(eventType)) {\n                handler.removeHandler();\n                ghostColumn.removeFromParent();\n                ghostLine.removeFromParent();\n                if (fromIndex != toIndex) {\n                    columnMoved(fromIndex,\n                                toIndex);\n                }\n                dragCallback.dragFinished();\n            }\n        }\n\n        private void moveColumn(final int clientX) {\n            final int pointer = clientX - columnWidth / 2;\n            ghostColumnStyle.setLeft(pointer - table.getAbsoluteLeft(),\n                                     PX);\n            for (int i = 0; i < columnXPositions.length - 1; ++i) {\n                if (clientX < columnXPositions[i + 1]) {\n                    final int adjustedIndex = i > fromIndex ? i + 1 : i;\n                    int lineXPos = columnXPositions[adjustedIndex] - table.getAbsoluteLeft();\n                    if (adjustedIndex == columnXPositions.length - 1) {\n                        lineXPos -= ghostLineWidth;\n                    } else if (adjustedIndex > 0) {\n                        lineXPos -= ghostLineWidth / 2;\n                    }\n                    ghostLineStyle.setLeft(lineXPos,\n                                           PX);\n                    toIndex = i;\n                    break;\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/TableEntryPoint.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.ext.widgets.table.client.resources.UFTableResources;\n\n@EntryPoint\npublic class TableEntryPoint {\n\n    @PostConstruct\n    public void startApp() {\n        UFTableResources.INSTANCE.CSS().ensureInjected();\n        PatternFlyBootstrapper.ensurejQueryIsAvailable();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfireColumnPicker.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\nimport org.uberfire.ext.widgets.table.client.resources.UFTableResources;\nimport org.uberfire.ext.widgets.table.client.resources.i18n.CommonConstants;\n\npublic class UberfireColumnPicker<T> {\n\n    protected final DataGrid<T> dataGrid;\n    protected final List<ColumnMeta<T>> columnMetaList = new ArrayList<>();\n    protected final PopupPanel popup = GWT.create(PopupPanel.class);\n    protected List<ColumnChangedHandler> columnChangedHandler = new ArrayList<>();\n\n    protected DataGrid<T> getDataGrid() {\n        return dataGrid;\n    }\n\n    public UberfireColumnPicker(DataGrid<T> dataGrid) {\n        this.dataGrid = dataGrid;\n        setupPopup();\n    }\n\n    private void setupPopup() {\n        popup.setAutoHideEnabled(true);\n        popup.setAutoHideOnHistoryEventsEnabled(true);\n    }\n\n    public void addColumnChangedHandler(ColumnChangedHandler handler) {\n        columnChangedHandler.add(handler);\n    }\n\n    public Collection<ColumnMeta<T>> getColumnMetaList() {\n        return columnMetaList;\n    }\n\n    protected String getColumnStoreName(ColumnMeta columnMeta) {\n        if (columnMeta != null) {\n            if (columnMeta.getColumn() != null) {\n                String colStoreName = columnMeta.getColumn().getDataStoreName();\n                if (colStoreName != null && !colStoreName.isEmpty()) {\n                    return colStoreName;\n                }\n            }\n            return columnMeta.getCaption();\n        }\n        return \"\";\n    }\n\n    public void columnMoved(final int visibleFromIndex,\n                            final int visibleBeforeIndex) {\n        int visibleColumnFromIndex = 0;\n        ColumnMeta<T> columnMetaToMove = null;\n        for (int i = 0; i < columnMetaList.size(); i++) {\n            final ColumnMeta<T> columnMeta = columnMetaList.get(i);\n            if (columnMeta.isVisible()) {\n                if (visibleFromIndex == visibleColumnFromIndex) {\n                    columnMetaToMove = columnMeta;\n                    break;\n                }\n                visibleColumnFromIndex++;\n            }\n        }\n        if (columnMetaToMove == null) {\n            return;\n        }\n\n        columnMetaList.remove(columnMetaToMove);\n\n        boolean columnInserted = false;\n        int visibleColumnBeforeIndex = 0;\n        for (int i = 0; i < columnMetaList.size(); i++) {\n            final ColumnMeta<T> columnMeta = columnMetaList.get(i);\n            if (columnMeta.isVisible()) {\n                if (visibleBeforeIndex == visibleColumnBeforeIndex) {\n                    columnMetaList.add(i,\n                                       columnMetaToMove);\n                    columnInserted = true;\n                    break;\n                }\n                visibleColumnBeforeIndex++;\n            }\n        }\n        if (!columnInserted) {\n            columnMetaList.add(columnMetaToMove);\n        }\n    }\n\n    protected int getVisibleColumnIndex(final ColumnMeta<T> columnMeta) {\n        int index = 0;\n        for (final ColumnMeta<T> cm : columnMetaList) {\n            if (cm.equals(columnMeta)) {\n                return index;\n            }\n            if (cm.isVisible() && cm.isVisibleIndex()) {\n                index++;\n            }\n        }\n        return index;\n    }\n\n    public void addColumn(ColumnMeta<T> columnMeta) {\n        if (columnMeta == null) {\n            return;\n        }\n        if (!columnMetaList.contains(columnMeta)) {\n            columnMetaList.add(columnMeta);\n        }\n        Collections.sort(columnMetaList);\n        if (columnMeta.isVisible()) {\n            dataGrid.insertColumn(getVisibleColumnIndex(columnMeta),\n                                  columnMeta.getColumn(),\n                                  columnMeta.getHeader());\n        }\n    }\n\n    protected void sortAndAddColumns(List<ColumnMeta<T>> columnMetas) {\n        columnMetas.stream().sorted().forEach(meta -> addColumn(meta));\n    }\n\n    public void adjustColumnWidths() {\n        for (ColumnChangedHandler handler : columnChangedHandler) {\n            handler.afterColumnChanged();\n        }\n    }\n\n    public void addColumns(List<ColumnMeta<T>> columnMetas) {\n        columnMetaList.addAll(columnMetas);\n        sortAndAddColumns(columnMetas);\n        adjustColumnWidths();\n    }\n\n    public void removeColumn(ColumnMeta<T> columnMeta) {\n        columnMetaList.remove(columnMeta);\n        int count = dataGrid.getColumnCount();\n        for (int i = 0; i < count; i++) {\n            dataGrid.removeColumn(0);\n        }\n\n        sortAndAddColumns(columnMetaList);\n        adjustColumnWidths();\n    }\n\n    protected void configureColorPickerPopup(int left,\n                                             int top,\n                                             VerticalPanel popupContent) {\n        popup.setWidget(popupContent);\n        popup.show();\n        int finalLeft = left - popup.getOffsetWidth();\n        popup.setPopupPosition(finalLeft,\n                               top);\n    }\n\n    protected boolean addThisColumnToPopup(ColumnMeta<T> columnMeta) {\n        return (columnMeta.getHeader().getValue() instanceof String);\n    }\n\n    protected void addResetButtom(final int left,\n                                  final int top,\n                                  VerticalPanel popupContent) {\n        //there is no reset buttom\n    }\n\n    protected void showColumnPickerPopup(final int left,\n                                         final int top) {\n        VerticalPanel popupContent = GWT.create(VerticalPanel.class);\n\n        initCheckBoxs(popupContent);\n\n        addResetButtom(left,\n                       top,\n                       popupContent);\n        configureColorPickerPopup(left,\n                                  top,\n                                  popupContent);\n    }\n\n    protected void initCheckBoxs(VerticalPanel popupContent) {\n        for (final ColumnMeta<T> columnMeta : columnMetaList) {\n            if (addThisColumnToPopup(columnMeta)) {\n                final CheckBox checkBox = GWT.create(CheckBox.class);\n                checkBox.setText((String) columnMeta.getHeader().getValue());\n                checkBox.setName((String) columnMeta.getHeader().getValue());\n                checkBox.setValue(columnMeta.isVisible());\n                checkBox.addValueChangeHandler(handler -> addColumnOnDataGrid(handler.getValue(), columnMeta));\n\n                popupContent.add(checkBox);\n            }\n        }\n    }\n\n    protected void addColumnOnDataGrid(boolean visible, ColumnMeta<T> columnMeta) {\n        if (visible) {\n            dataGrid.insertColumn(getVisibleColumnIndex(columnMeta),\n                                  columnMeta.getColumn(),\n                                  columnMeta.getHeader());\n        } else {\n            dataGrid.removeColumn(columnMeta.getColumn());\n        }\n        columnMeta.setVisible(visible);\n        adjustColumnWidths();\n    }\n\n    public Button createToggleButton() {\n        final Button button = GWT.create(Button.class);\n        button.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerButton());\n        button.setDataToggle(Toggle.BUTTON);\n        button.setIcon(IconType.LIST_UL);\n        button.setTitle(CommonConstants.INSTANCE.ColumnPickerButtonTooltip());\n\n        popup.addStyleName(UFTableResources.INSTANCE.CSS().columnPickerPopup());\n        popup.addAutoHidePartner(button.getElement());\n        popup.addCloseHandler(new CloseHandler<PopupPanel>() {\n            public void onClose(CloseEvent<PopupPanel> popupPanelCloseEvent) {\n                if (popupPanelCloseEvent.isAutoClosed()) {\n                    button.setActive(false);\n                }\n            }\n        });\n\n        button.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                if (!button.isActive()) {\n                    showColumnPickerPopup(button.getAbsoluteLeft() + button.getOffsetWidth(),\n                                          button.getAbsoluteTop() + button.getOffsetHeight());\n                } else {\n                    popup.hide(false);\n                }\n            }\n        });\n        return button;\n    }\n\n    protected void resetTableColumns(int left,\n                                     int top) {\n        int count = dataGrid.getColumnCount();\n        for (int i = 0; i < count; i++) {\n            dataGrid.removeColumn(0);\n        }\n\n        loadGlobalGridPreferences();\n\n        sortAndAddColumns(new ArrayList<ColumnMeta<T>>(columnMetaList));\n\n        adjustColumnWidths();\n\n        showColumnPickerPopup(left,\n                              top);\n    }\n\n    protected void loadGlobalGridPreferences() {\n    }\n\n    public int getDataGridMinWidth() {\n        return -1;\n    }\n\n    public void setDefaultColumnWidthSize(int defaultColumSize) {\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfirePagedTable.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.AbstractDataProvider;\nimport com.google.gwt.view.client.ProvidesKey;\nimport org.gwtbootstrap3.client.ui.ListBox;\n\npublic class UberfirePagedTable<T>\n        extends UberfireSimpleTable<T> {\n\n    public static final int DEFAULT_PAGE_SIZE = 10;\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField\n    public UberfireSimplePager pager;\n    @UiField\n    public ListBox pageSizesSelector;\n    protected boolean showPageSizesSelector = false;\n    private int pageSize = 0;\n    private AbstractDataProvider<T> dataProvider;\n\n    public UberfirePagedTable() {\n        this(DEFAULT_PAGE_SIZE);\n    }\n\n    public UberfirePagedTable(final int pageSize) {\n        this(pageSize,\n             null);\n    }\n\n    public UberfirePagedTable(final int pageSize,\n                              final ProvidesKey<T> providesKey) {\n        this(pageSize,\n             providesKey,\n             false);\n    }\n\n    public UberfirePagedTable(final int pageSize,\n                              final ProvidesKey<T> providesKey,\n                              final boolean showPageSizesSelector) {\n\n        this(pageSize,\n             providesKey,\n             showPageSizesSelector,\n             false,\n             false);\n    }\n\n    public UberfirePagedTable(final int pageSize,\n                              final ProvidesKey<T> providesKey,\n                              final boolean showPageSizesSelector,\n                              final boolean showFFButton,\n                              final boolean showLButton) {\n        super(providesKey);\n        this.showPageSizesSelector = showPageSizesSelector;\n        this.pageSize = pageSize;\n        this.dataGrid.setPageSize(pageSize);\n        PagedTableHelper.setSelectedValue(pageSizesSelector,\n                                          String.valueOf(pageSize));\n        this.pager.setDisplay(dataGrid);\n        this.pageSizesSelector.setVisible(this.showPageSizesSelector);\n        setShowFastFordwardPagerButton(showFFButton);\n        setShowLastPagerButton(showLButton);\n        createPageSizesListBox(5,\n                               20,\n                               5);\n    }\n\n    @Override\n    protected Widget makeWidget() {\n        return uiBinder.createAndBindUi(this);\n    }\n\n    public AbstractDataProvider<T> getDataProvider() {\n        return dataProvider;\n    }\n\n    public void setDataProvider(final AbstractDataProvider<T> dataProvider) {\n        this.dataProvider = dataProvider;\n        this.dataProvider.addDataDisplay(this);\n    }\n\n    public int getPageSize() {\n        return this.pageSize;\n    }\n\n    public int getPageStart() {\n        return this.pager.getPageStart();\n    }\n\n    public void createPageSizesListBox(int minPageSize,\n                                       int maxPageSize,\n                                       int incPageSize) {\n        pageSizesSelector.clear();\n        PagedTableHelper.setSelectIndexOnPageSizesSelector(minPageSize,\n                                                           maxPageSize,\n                                                           incPageSize,\n                                                           pageSizesSelector,\n                                                           pageSize);\n        pageSizesSelector.addChangeHandler(event -> loadPageSizePreferences());\n\n        loadPageSizePreferences();\n    }\n\n    public final void loadPageSizePreferences() {\n        this.dataGrid.setPageSize(pageSize);\n        this.pager.setPageSize(pageSize);\n        this.dataGrid.setHeight(((pageSize == 0 ? 1 : pageSize) * 30 + 10) + \"px\");\n    }\n\n    public void setShowLastPagerButton(boolean showLastPagerButton) {\n        this.pager.setShowLastPageButton(showLastPagerButton);\n    }\n\n    public void setShowFastFordwardPagerButton(boolean showFastFordwardPagerButton) {\n        this.pager.setShowFastFordwardPageButton(showFastFordwardPagerButton);\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, UberfirePagedTable> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfirePagedTable.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\"\n             xmlns:uf=\"urn:import:org.uberfire.ext.widgets.table.client\">\n\n  <ui:style>\n    .dataGridContainer {\n      padding-top: 10px;\n      padding-bottom: 10px;\n    }\n\n    .leftToolBar {\n      float: left;\n      text-align: left\n    }\n\n    .rightToolBar {\n      float: right;\n      text-align: right;\n    }\n\n    .centerToolBar {\n      text-align: center\n    }\n\n    .pager {\n      margin: 0px;\n    }\n  </ui:style>\n\n  <g:FlowPanel addStyleNames=\"{style.dataGridContainer}\">\n    <g:HorizontalPanel ui:field=\"toolbarContainer\" width=\"100%\">\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"leftToolbar\" addStyleNames=\"{style.leftToolBar}\"></g:FlowPanel>\n      </g:cell>\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"centerToolbar\" addStyleNames=\"{style.centerToolBar}\"></g:FlowPanel>\n      </g:cell>\n      <g:cell width=\"33%\" horizontalAlignment=\"right\">\n        <g:HorizontalPanel ui:field=\"rightToolbar\">\n          <g:FlowPanel width=\"100%\" ui:field=\"rightActionsToolbar\" addStyleNames=\"{style.rightToolBar}\"/>\n          <b:Button ui:field=\"columnPickerButton\" dataToggle=\"BUTTON\" icon=\"LIST_UL\"/>\n        </g:HorizontalPanel>\n      </g:cell>\n    </g:HorizontalPanel>\n    <g:SimplePanel>\n      <bg:DataGrid ui:field=\"dataGrid\" />\n    </g:SimplePanel>\n    <g:HorizontalPanel width=\"100%\">\n      <g:cell width=\"50%\" horizontalAlignment=\"left\" verticalAlignment=\"middle\">\n        <b:ListBox ui:field=\"pageSizesSelector\" width=\"100px\"/>\n      </g:cell>\n      <g:cell width=\"50%\" horizontalAlignment=\"right\" verticalAlignment=\"top\">\n        <uf:UberfireSimplePager ui:field=\"pager\" addStyleNames=\"pagination pagination-right pull-right {style.pager}\"/>\n      </g:cell>\n    </g:HorizontalPanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfireSimplePager.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.i18n.client.NumberFormat;\nimport com.google.gwt.resources.client.CssResource;\nimport com.google.gwt.user.cellview.client.AbstractPager;\nimport com.google.gwt.user.cellview.client.SimplePager;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasVerticalAlignment;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.view.client.HasRows;\nimport com.google.gwt.view.client.Range;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.widgets.table.client.resources.UberfireSimplePagerResources;\nimport org.uberfire.ext.widgets.table.client.resources.i18n.CommonConstants;\n\n/**\n * Essentially a fork of GWT's SimplePager that maintains a set page size and\n * displays page numbers and total pages more elegantly. SimplePager will ensure\n * <code>pageSize</code> rows are always rendered even if the \"last\" page has\n * less than <code>pageSize</code> rows remain. Forked not sub-classed as\n * GWTs code is largely private and not open to extension :(\n */\npublic class UberfireSimplePager extends AbstractPager {\n\n    private static int DEFAULT_FAST_FORWARD_ROWS = 100;\n    private static UberfireSimplePagerResources DEFAULT_RESOURCES;\n    private final Button fastForward;\n    private final int fastForwardRows;\n    private final Button firstPage;\n    /**\n     * We use an {@link HTML} so we can embed the loading image.\n     */\n    private final HTML label = new HTML();\n    private final Button lastPage;\n    private final Button nextPage;\n    private final Button prevPage;\n    /**\n     * The {@link UberfireSimplePagerResources} used by this widget.\n     */\n    private final UberfireSimplePagerResources resources;\n    /**\n     * The {@link Style} used by this widget.\n     */\n    private final Style style;\n    //Page size is normally derieved from the visibleRange\n    private int pageSize = 10;\n\n    /**\n     * Construct a {@link SimplePager} with the default text location.\n     */\n    public UberfireSimplePager() {\n        this(TextLocation.CENTER);\n    }\n\n    /**\n     * Construct a {@link SimplePager} with the specified text location.\n     * @param location the location of the text relative to the buttons\n     */\n    public UberfireSimplePager(TextLocation location) {\n        this(location,\n             getDefaultResources(),\n             true,\n             DEFAULT_FAST_FORWARD_ROWS,\n             true);\n    }\n\n    public UberfireSimplePager(boolean showFastForwardButton,\n                               boolean showLastPageButton) {\n        this(TextLocation.CENTER,\n             getDefaultResources(),\n             showFastForwardButton,\n             DEFAULT_FAST_FORWARD_ROWS,\n             showLastPageButton);\n    }\n\n    /**\n     * Construct a {@link SimplePager} with the specified resources.\n     * @param location the location of the text relative to the buttons\n     * @param resources the {@link UberfireSimplePagerResources} to use\n     * @param showFastForwardButton if true, show a fast-forward button that advances by a larger\n     * increment than a single page\n     * @param fastForwardRows the number of rows to jump when fast forwarding\n     * @param showLastPageButton if true, show a button to go the the last page\n     */\n    public UberfireSimplePager(TextLocation location,\n                               UberfireSimplePagerResources resources,\n                               boolean showFastForwardButton,\n                               final int fastForwardRows,\n                               boolean showLastPageButton) {\n        this.resources = resources;\n        this.fastForwardRows = fastForwardRows;\n        this.style = resources.simplePagerStyle();\n        this.style.ensureInjected();\n\n        // Create the buttons.\n        firstPage = new Button();\n        firstPage.setIcon(IconType.ANGLE_DOUBLE_LEFT);\n        firstPage.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                firstPage();\n            }\n        });\n        nextPage = new Button();\n        nextPage.setIcon(IconType.ANGLE_RIGHT);\n        nextPage.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                nextPage();\n            }\n        });\n        prevPage = new Button();\n        prevPage.setIcon(IconType.ANGLE_LEFT);\n        prevPage.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                previousPage();\n            }\n        });\n\n        lastPage = new Button();\n        lastPage.setIcon(IconType.ANGLE_DOUBLE_RIGHT);\n        lastPage.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                lastPage();\n            }\n        });\n\n        fastForward = new Button();\n        fastForward.setIcon(IconType.FAST_FORWARD);\n        fastForward.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                setPage(getPage() + getFastForwardPages());\n            }\n        });\n\n        // Construct the widget.\n        HorizontalPanel layout = new HorizontalPanel();\n        layout.setVerticalAlignment(HasVerticalAlignment.ALIGN_MIDDLE);\n        initWidget(layout);\n        if (location == TextLocation.RIGHT) {\n            layout.add(label);\n        }\n        layout.add(firstPage);\n        layout.add(prevPage);\n        if (location == TextLocation.CENTER) {\n            layout.add(label);\n        }\n        layout.add(nextPage);\n        layout.add(fastForward);\n        layout.add(lastPage);\n\n        if (location == TextLocation.LEFT) {\n            layout.add(label);\n        }\n\n        // Add style names to the cells.\n        firstPage.getElement().getParentElement().addClassName(style.button());\n        prevPage.getElement().getParentElement().addClassName(style.button());\n        label.getElement().getParentElement().addClassName(style.pageDetails());\n        nextPage.getElement().getParentElement().addClassName(style.button());\n        fastForward.getElement().getParentElement().addClassName(style.button());\n        lastPage.getElement().getParentElement().addClassName(style.button());\n\n        setShowLastPageButton(showLastPageButton);\n        setShowFastFordwardPageButton(showFastForwardButton);\n\n        // Disable the buttons by default.\n        setDisplay(null);\n    }\n\n    private static UberfireSimplePagerResources getDefaultResources() {\n        if (DEFAULT_RESOURCES == null) {\n            DEFAULT_RESOURCES = UberfireSimplePagerResources.INSTANCE;\n        }\n        return DEFAULT_RESOURCES;\n    }\n\n    public void setShowLastPageButton(boolean showLastPageButton) {\n        this.lastPage.setVisible(showLastPageButton);\n    }\n\n    public void setShowFastFordwardPageButton(boolean showFastFordwardPageButton) {\n        this.fastForward.setVisible(showFastFordwardPageButton);\n    }\n\n    // We want pageSize to remain constant\n    @Override\n    public int getPageSize() {\n        return pageSize;\n    }\n\n    @Override\n    public void setPageSize(int pageSize) {\n        this.pageSize = pageSize;\n        super.setPageSize(pageSize);\n    }\n\n    // Page forward by an exact size rather than the number of visible\n    // rows as is in the norm in the underlying implementation\n    @Override\n    public void nextPage() {\n        if (getDisplay() != null) {\n            Range range = getDisplay().getVisibleRange();\n            setPageStart(range.getStart()\n                                 + getPageSize());\n        }\n    }\n\n    // Page back by an exact size rather than the number of visible rows\n    // as is in the norm in the underlying implementation\n    @Override\n    public void previousPage() {\n        if (getDisplay() != null) {\n            Range range = getDisplay().getVisibleRange();\n            setPageStart(range.getStart()\n                                 - getPageSize());\n        }\n    }\n\n    @Override\n    public void setDisplay(HasRows display) {\n        // Enable or disable all buttons.\n        boolean disableButtons = (display == null);\n        setFastForwardDisabled(disableButtons);\n        setNextPageButtonsDisabled(disableButtons);\n        setPrevPageButtonsDisabled(disableButtons);\n        super.setDisplay(display);\n    }\n\n    @Override\n    public void setPage(int index) {\n        super.setPage(index);\n    }\n\n    // Override so the last page is shown with a number of rows less\n    // than the pageSize rather than always showing the pageSize number\n    // of rows and possibly repeating rows on the last and penultimate\n    // page\n    @Override\n    public void setPageStart(int index) {\n        if (getDisplay() != null) {\n            Range range = getDisplay().getVisibleRange();\n            int displayPageSize = range.getLength();\n            if (!isRangeLimited() && getDisplay().isRowCountExact()) {\n                index = Math.min(index,\n                                 getDisplay().getRowCount() - displayPageSize);\n            }\n            index = Math.max(0,\n                             index);\n            if (index != range.getStart()) {\n                getDisplay().setVisibleRange(index,\n                                             displayPageSize);\n            }\n        }\n    }\n\n    /**\n     * Let the page know that the table is loading. Call this method to clear\n     * all data from the table and hide the current range when new data is being\n     * loaded into the table.\n     */\n    public void startLoading() {\n        getDisplay().setRowCount(0,\n                                 true);\n        label.setHTML(\"\");\n    }\n\n    /**\n     * Get the number of pages to fast forward based on the current page size.\n     * @return the number of pages to fast forward\n     */\n    private int getFastForwardPages() {\n        int pageSize = getPageSize();\n        return pageSize > 0 ? fastForwardRows / pageSize : 0;\n    }\n\n    /**\n     * Enable or disable the fast forward button.\n     * @param disabled true to disable, false to enable\n     */\n    private void setFastForwardDisabled(boolean disabled) {\n        if (fastForward == null) {\n            return;\n        }\n\n        //The one line change to GWT's SimplePager code!\n        fastForward.setEnabled(!disabled);\n    }\n\n    /**\n     * Enable or disable the next page buttons.\n     * @param disabled true to disable, false to enable\n     */\n    private void setNextPageButtonsDisabled(boolean disabled) {\n        nextPage.setEnabled(!disabled);\n        if (lastPage != null) {\n            lastPage.setEnabled(!disabled);\n        }\n    }\n\n    /**\n     * Enable or disable the previous page buttons.\n     * @param disabled true to disable, false to enable\n     */\n    private void setPrevPageButtonsDisabled(boolean disabled) {\n        firstPage.setEnabled(!disabled);\n        prevPage.setEnabled(!disabled);\n    }\n\n    // Override to display \"0 of 0\" when there are no records (otherwise\n    // you get \"1-1 of 0\") and \"1 of 1\" when there is only one record\n    // (otherwise you get \"1-1 of 1\"). Not internationalised (but\n    // neither is SimplePager)\n    protected String createText() {\n        NumberFormat formatter = NumberFormat.getFormat(\"#,###\");\n        HasRows display = getDisplay();\n        Range range = display.getVisibleRange();\n        int pageStart = range.getStart() + 1;\n        int pageSize = range.getLength();\n        int dataSize = display.getRowCount();\n        int endIndex = Math.min(dataSize,\n                                pageStart\n                                        + pageSize\n                                        - 1);\n        endIndex = Math.max(pageStart,\n                            endIndex);\n        boolean exact = display.isRowCountExact();\n        if (dataSize == 0) {\n            return \"0 \" + of() + \" 0\";\n        } else if (pageStart == endIndex) {\n            return formatter.format(pageStart)\n                    + \" \" + of() + \" \"\n                    + formatter.format(dataSize);\n        }\n        return formatter.format(pageStart)\n                + \"-\"\n                + formatter.format(endIndex)\n                + (exact ? \" \" + of() + \" \" : \" \" + of() + \" \" + over() + \" \")\n                + formatter.format(dataSize);\n    }\n\n    @Override\n    protected void onRangeOrRowCountChanged() {\n        HasRows display = getDisplay();\n        label.setText(createText());\n\n        // Update the prev and first buttons.\n        setPrevPageButtonsDisabled(!hasPreviousPage());\n\n        // Update the next and last buttons.\n        if (isRangeLimited() || !display.isRowCountExact()) {\n            setNextPageButtonsDisabled(!hasNextPage());\n            setFastForwardDisabled(!hasNextPages(getFastForwardPages()));\n        }\n    }\n\n    /**\n     * Check if the next button is disabled. Visible for testing.\n     */\n    boolean isNextButtonDisabled() {\n        return nextPage.isEnabled() == false;\n    }\n\n    /**\n     * Check if the previous button is disabled. Visible for testing.\n     */\n    boolean isPreviousButtonDisabled() {\n        return prevPage.isEnabled() == false;\n    }\n\n    private String of() {\n        return CommonConstants.INSTANCE.Of();\n    }\n\n    private String over() {\n        return CommonConstants.INSTANCE.Over();\n    }\n\n    /**\n     * The location of the text relative to the paging buttons.\n     */\n    public enum TextLocation {\n        CENTER,\n        LEFT,\n        RIGHT\n    }\n\n    /**\n     * Styles used by this widget.\n     */\n    public interface Style\n            extends\n            CssResource {\n\n        /**\n         * Applied to buttons.\n         */\n        String button();\n\n        /**\n         * Applied to the details text.\n         */\n        String pageDetails();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfireSimpleTable.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client;\n\nimport java.util.List;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.user.cellview.client.RowStyles;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.*;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.uberfire.ext.widgets.table.client.resources.UFTableResources;\n\n/**\n * A composite Widget that shows rows of data (not-paged) and a \"column picker\"\n * to allow columns to be hidden from view. Columns can also be sorted.\n */\npublic class UberfireSimpleTable<T>\n        extends Composite\n        implements HasData<T> {\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n    @UiField(provided = true)\n    public Button columnPickerButton;\n    @UiField(provided = true)\n    public DataGrid<T> dataGrid;\n    @UiField\n    public ComplexPanel toolbarContainer;\n    @UiField\n    public ComplexPanel rightToolbar;\n    @UiField\n    public FlowPanel rightActionsToolbar;\n    @UiField\n    public FlowPanel leftToolbar;\n    @UiField\n    public FlowPanel centerToolbar;\n    protected UberfireColumnPicker<T> columnPicker;\n    private String emptyTableCaption;\n\n    public UberfireSimpleTable() {\n        setupDataGrid(null);\n        setupGridTable();\n    }\n\n    public UberfireSimpleTable(final ProvidesKey<T> providesKey) {\n        setupDataGrid(providesKey);\n        setupGridTable();\n    }\n\n    protected static native void addDataGridStyles(final JavaScriptObject grid,\n                                                   final String header,\n                                                   final String content)/*-{\n        $wnd.jQuery(grid).find('table:first').addClass(header);\n        $wnd.jQuery(grid).find('table:last').addClass(content);\n    }-*/;\n\n    public void addDataGridStyles(final String header,\n                                  final String content) {\n        addDataGridStyles(dataGrid.getElement(),\n                          header,\n                          content);\n    }\n\n    protected void setupGridTable() {\n        setupDataGrid();\n        setEmptyTableWidget();\n\n        setupColumnPicker();\n\n        columnPickerButton = getColumnPicker().createToggleButton();\n\n        initWidget(makeWidget());\n    }\n\n    protected void setupColumnPicker() {\n        setColumnPicker(new UberfireColumnPicker<>(dataGrid));\n    }\n\n    protected UberfireColumnPicker<T> getColumnPicker() {\n        return columnPicker;\n    }\n\n    protected void setColumnPicker(UberfireColumnPicker<T> columnPicker) {\n        this.columnPicker = columnPicker;\n    }\n\n    protected void setupDataGrid(ProvidesKey<T> providesKey) {\n        if (providesKey != null) {\n            dataGrid = new DataGrid<T>(providesKey);\n        } else {\n            dataGrid = new DataGrid<T>();\n        }\n    }\n\n    public void setEmptyTableCaption(final String emptyTableCaption) {\n        this.emptyTableCaption = emptyTableCaption;\n        setEmptyTableWidget();\n    }\n\n    protected void setupDataGrid() {\n        dataGrid.setSkipRowHoverCheck(false);\n        dataGrid.setSkipRowHoverStyleUpdate(false);\n        dataGrid.addStyleName(UFTableResources.INSTANCE.CSS().dataGridMain());\n        dataGrid.addStyleName(UFTableResources.INSTANCE.CSS().dataGrid());\n        dataGrid.setRowStyles((row, rowIndex) -> UFTableResources.INSTANCE.CSS().dataGridRow());\n        addDataGridStyles(UFTableResources.INSTANCE.CSS().dataGridHeader(),\n                          UFTableResources.INSTANCE.CSS().dataGridContent());\n    }\n\n    protected void setEmptyTableWidget() {\n        String caption = \"-----\";\n        if (!emptyCaptionIsDefined()) {\n            caption = emptyTableCaption;\n        }\n        dataGrid.setEmptyTableWidget(new Label(caption));\n    }\n\n    private boolean emptyCaptionIsDefined() {\n        return emptyTableCaption == null || emptyTableCaption.trim().isEmpty();\n    }\n\n    protected Widget makeWidget() {\n        return uiBinder.createAndBindUi(this);\n    }\n\n    public void redraw() {\n        dataGrid.redraw();\n        dataGrid.flush();\n    }\n\n    public void refresh() {\n        dataGrid.setVisibleRangeAndClearData(dataGrid.getVisibleRange(),\n                                             true);\n    }\n\n    @Override\n    public HandlerRegistration addCellPreviewHandler(final CellPreviewEvent.Handler<T> handler) {\n        return dataGrid.addCellPreviewHandler(handler);\n    }\n\n    @Override\n    public HandlerRegistration addRangeChangeHandler(final RangeChangeEvent.Handler handler) {\n        return dataGrid.addRangeChangeHandler(handler);\n    }\n\n    @Override\n    public HandlerRegistration addRowCountChangeHandler(final RowCountChangeEvent.Handler handler) {\n        return dataGrid.addRowCountChangeHandler(handler);\n    }\n\n    public int getColumnIndex(final Column<T, ?> column) {\n        return dataGrid.getColumnIndex(column);\n    }\n\n    public HandlerRegistration addColumnSortHandler(final ColumnSortEvent.Handler handler) {\n        return this.dataGrid.addColumnSortHandler(handler);\n    }\n\n    @Override\n    public int getRowCount() {\n        return dataGrid.getRowCount();\n    }\n\n    @Override\n    public void setRowCount(final int count) {\n        dataGrid.setRowCount(count);\n    }\n\n    @Override\n    public Range getVisibleRange() {\n        return dataGrid.getVisibleRange();\n    }\n\n    @Override\n    public void setVisibleRange(final Range range) {\n        dataGrid.setVisibleRange(range);\n    }\n\n    @Override\n    public boolean isRowCountExact() {\n        return dataGrid.isRowCountExact();\n    }\n\n    @Override\n    public void setRowCount(final int count,\n                            final boolean isExact) {\n        dataGrid.setRowCount(count,\n                             isExact);\n    }\n\n    @Override\n    public void setVisibleRange(final int start,\n                                final int length) {\n        dataGrid.setVisibleRange(start,\n                                 length);\n    }\n\n    @Override\n    public SelectionModel<? super T> getSelectionModel() {\n        return dataGrid.getSelectionModel();\n    }\n\n    @Override\n    public void setSelectionModel(final SelectionModel<? super T> selectionModel) {\n        dataGrid.setSelectionModel(selectionModel);\n    }\n\n    @Override\n    public T getVisibleItem(final int indexOnPage) {\n        return dataGrid.getVisibleItem(indexOnPage);\n    }\n\n    @Override\n    public int getVisibleItemCount() {\n        return dataGrid.getVisibleItemCount();\n    }\n\n    @Override\n    public Iterable<T> getVisibleItems() {\n        return dataGrid.getVisibleItems();\n    }\n\n    @Override\n    public void setRowData(final int start,\n                           final List<? extends T> values) {\n        dataGrid.setRowData(start,\n                            values);\n        redraw();\n    }\n\n    public void setRowData(final List<? extends T> values) {\n        dataGrid.setRowData(values);\n        redraw();\n    }\n\n    public void setSelectionModel(final SelectionModel<? super T> selectionModel,\n                                  final CellPreviewEvent.Handler<T> selectionEventManager) {\n        dataGrid.setSelectionModel(selectionModel,\n                                   selectionEventManager);\n    }\n\n    @Override\n    public void setVisibleRangeAndClearData(final Range range,\n                                            final boolean forceRangeChangeEvent) {\n        dataGrid.setVisibleRangeAndClearData(range,\n                                             forceRangeChangeEvent);\n    }\n\n    @Override\n    public void setHeight(final String height) {\n        dataGrid.setHeight(height);\n    }\n\n    @Override\n    public void setPixelSize(final int width,\n                             final int height) {\n        dataGrid.setPixelSize(width,\n                              height);\n    }\n\n    @Override\n    public void setSize(final String width,\n                        final String height) {\n        dataGrid.setSize(width,\n                         height);\n    }\n\n    @Override\n    public void setWidth(final String width) {\n        dataGrid.setWidth(width);\n    }\n\n    public void setColumnWidth(final Column<T, ?> column,\n                               final double width,\n                               final Style.Unit unit) {\n        dataGrid.setColumnWidth(column,\n                                width,\n                                unit);\n        getColumnPicker().adjustColumnWidths();\n    }\n\n    public void setToolBarVisible(final boolean visible) {\n        toolbarContainer.setVisible(visible);\n    }\n\n    public ColumnSortList getColumnSortList() {\n        return dataGrid.getColumnSortList();\n    }\n\n    public HasWidgets getToolbar() {\n        return toolbarContainer;\n    }\n\n    public HasWidgets getRightToolbar() {\n        return rightToolbar;\n    }\n\n    public HasWidgets getRightActionsToolbar() {\n        return rightActionsToolbar;\n    }\n\n    public HasWidgets getLeftToolbar() {\n        return leftToolbar;\n    }\n\n    public HasWidgets getCenterToolbar() {\n        return centerToolbar;\n    }\n\n    public void setRowStyles(final RowStyles<T> styles) {\n        dataGrid.setRowStyles(styles);\n    }\n\n    public void addTableTitle(String tableTitle) {\n        getLeftToolbar().add(new HTML(\"<h4>\" + tableTitle + \"</h4>\"));\n    }\n\n    public void setAlwaysShowScrollBars(boolean alwaysShowScrollBars) {\n        dataGrid.setAlwaysShowScrollBars(alwaysShowScrollBars);\n    }\n\n    public void addColumn(final Column<T, ?> column,\n                          final String caption) {\n        addColumn(column,\n                  caption,\n                  true);\n    }\n\n    public void addColumn(final Column<T, ?> column,\n                          final String caption,\n                          final boolean visible) {\n        ColumnMeta<T> columnMeta = new ColumnMeta<T>(column,\n                                                     caption,\n                                                     visible);\n        addColumn(columnMeta);\n    }\n\n    public void addColumns(final List<ColumnMeta<T>> columnMetas) {\n        for (ColumnMeta columnMeta : columnMetas) {\n            if (columnMeta.getHeader() == null) {\n                columnMeta.setHeader(getColumnHeader(columnMeta.getCaption(),\n                                                     columnMeta.getColumn()));\n            }\n        }\n        getColumnPicker().addColumns(columnMetas);\n    }\n\n    protected void addColumn(final ColumnMeta<T> columnMeta) {\n        if (columnMeta.getHeader() == null) {\n            columnMeta.setHeader(getColumnHeader(columnMeta.getCaption(),\n                                                 columnMeta.getColumn()));\n        }\n        getColumnPicker().addColumn(columnMeta);\n    }\n\n    protected ResizableMovableHeader<T> getColumnHeader(final String caption,\n                                                        final Column column) {\n        final ResizableMovableHeader header = new ResizableMovableHeader<T>(caption,\n                                                                            dataGrid,\n                                                                            columnPicker,\n                                                                            column) {\n            @Override\n            protected int getTableBodyHeight() {\n                return dataGrid.getOffsetHeight();\n            }\n        };\n        header.addColumnChangedHandler(new ColumnChangedHandler() {\n            @Override\n            public void afterColumnChanged() {\n                afterColumnChangedHandler();\n            }\n\n            @Override\n            public void beforeColumnChanged() {\n\n            }\n        });\n        return header;\n    }\n\n    public void setColumnPickerButtonVisible(final boolean show) {\n        columnPickerButton.setVisible(show);\n    }\n\n    protected void afterColumnChangedHandler() {\n\n    }\n\n    interface Binder\n            extends\n            UiBinder<Widget, UberfireSimpleTable> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/UberfireSimpleTable.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bg=\"urn:import:org.gwtbootstrap3.client.ui.gwt\">\n\n  <ui:style>\n    .dataGridContainer {\n      padding-top: 10px;\n      padding-bottom: 10px;\n    }\n\n    .horizontalContainer {\n      height: 32px;\n    }\n\n    .rightToolBar {\n      float: right;\n      text-align: right;\n    }\n\n    .centerToolBar {\n      text-align: center\n    }\n  </ui:style>\n\n  <g:FlowPanel addStyleNames=\"{style.dataGridContainer}\">\n    <g:HorizontalPanel ui:field=\"toolbarContainer\" width=\"100%\" addStyleNames=\"{style.horizontalContainer}\">\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"leftToolbar\"/>\n      </g:cell>\n      <g:cell width=\"33%\">\n        <g:FlowPanel width=\"100%\" ui:field=\"centerToolbar\" addStyleNames=\"{style.centerToolBar}\"></g:FlowPanel>\n      </g:cell>\n      <g:cell width=\"33%\" horizontalAlignment=\"right\">\n        <g:HorizontalPanel ui:field=\"rightToolbar\">\n          <g:FlowPanel width=\"100%\" ui:field=\"rightActionsToolbar\" addStyleNames=\"{style.rightToolBar}\"/>\n          <b:Button ui:field=\"columnPickerButton\" />\n        </g:HorizontalPanel>\n      </g:cell>\n    </g:HorizontalPanel>\n    <g:SimplePanel>\n      <bg:DataGrid ui:field=\"dataGrid\"/>\n    </g:SimplePanel>\n  </g:FlowPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/resources/UFTableCss.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface UFTableCss\n        extends\n        CssResource {\n\n    @ClassName(\"dataGrid\")\n    String dataGrid();\n\n    @ClassName(\"dataGridRow\")\n    String dataGridRow();\n\n    @ClassName(\"dataGridHeader\")\n    String dataGridHeader();\n\n    @ClassName(\"dataGridContent\")\n    String dataGridContent();\n\n    @ClassName(\"dataGridMain\")\n    String dataGridMain();\n\n    @ClassName(\"columnPickerButton\")\n    String columnPickerButton();\n\n    @ClassName(\"columnPickerPopup\")\n    String columnPickerPopup();\n\n    ;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/resources/UFTableResources.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.widgets.table.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface UFTableResources\n        extends\n        ClientBundle {\n\n    UFTableResources INSTANCE = GWT.create(UFTableResources.class);\n\n    @Source(\"css/uftable.css\")\n    UFTableCss CSS();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/resources/UberfireSimplePagerResources.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\nimport org.uberfire.ext.widgets.table.client.UberfireSimplePager;\n\n/**\n * A ClientBundle that provides images for this widget.\n */\npublic interface UberfireSimplePagerResources\n        extends\n        ClientBundle {\n\n    UberfireSimplePagerResources INSTANCE = GWT.create(UberfireSimplePagerResources.class);\n\n    /**\n     * The image used to skip ahead multiple pages.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerFastForward.png\")\n    ImageResource simplePagerFastForward();\n\n    /**\n     * The disabled \"fast forward\" image.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerFastForwardDisabled.png\")\n    ImageResource simplePagerFastForwardDisabled();\n\n    /**\n     * The image used to go to the first page.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerFirstPage.png\")\n    ImageResource simplePagerFirstPage();\n\n    /**\n     * The disabled first page image.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerFirstPageDisabled.png\")\n    ImageResource simplePagerFirstPageDisabled();\n\n    /**\n     * The image used to go to the last page.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerLastPage.png\")\n    ImageResource simplePagerLastPage();\n\n    /**\n     * The disabled last page image.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerLastPageDisabled.png\")\n    ImageResource simplePagerLastPageDisabled();\n\n    /**\n     * The image used to go to the next page.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerNextPage.png\")\n    ImageResource simplePagerNextPage();\n\n    /**\n     * The disabled next page image.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerNextPageDisabled.png\")\n    ImageResource simplePagerNextPageDisabled();\n\n    /**\n     * The image used to go to the previous page.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerPreviousPage.png\")\n    ImageResource simplePagerPreviousPage();\n\n    /**\n     * The disabled previous page image.\n     */\n    @ImageResource.ImageOptions(flipRtl = true)\n    @Source(\"images/simplepager/simplePagerPreviousPageDisabled.png\")\n    ImageResource simplePagerPreviousPageDisabled();\n\n    /**\n     * The styles used in this widget.\n     */\n    @Source(\"css/UberfireSimplePager.css\")\n    UberfireSimplePager.Style simplePagerStyle();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/java/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n *\n */\npublic interface CommonConstants\n        extends Messages {\n\n    public static final CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String ColumnPickerButtonTooltip();\n\n    String Items();\n\n    String Of();\n\n    String Over();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.widgets.table.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/UberfireTableWidget.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n</module>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/css/UberfireSimplePager.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.pageDetails {\n    padding: 4px 8px;\n    text-align: center;\n}\n\n.button {\n    padding: 4px;\n    cursor: pointer;\n    cursor: hand;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/css/uftable.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.dataGrid td div {\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.dataGridRow:first-child td {\n    border-top: none;\n}\n.dataGridHeader {\n\n}\n\n.dataGridHeader thead th {\n    overflow: hidden;\n    text-overflow: ellipsis;\n}\n\n.dataGridContent {\n    border-top: none;\n    margin-bottom: 0px;\n}\n\n.dataGridMain {\n    width: 100%;\n    height: 300px;\n}\n\n.columnPickerButton {\n\n}\n\n.columnPickerPopup {\n    background-color: #FFFFFF;\n    padding: 5px;\n    border: 1px solid #d1d1d1;\n    z-index: 2000;\n}\n\n@external .checkbox;\n\n.columnPickerPopup .checkbox {\n    margin-top: 2px;\n    margin-bottom: 2px;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nColumnPickerButtonTooltip=Show/hide columns\nItems=Items\nOf=of\nOver=over"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_de.properties",
    "content": "ColumnPickerButtonTooltip=Spalten einblenden/ausblenden\nItems=Posten\nOf=von\nOver=über\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nColumnPickerButtonTooltip=Mostrar/ocultar columnas\nItems=Ítems\nOf=de\nOver=sobre"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nColumnPickerButtonTooltip=Afficher/masquer les colonnes\nItems=Éléments\nOf=de\nOver=sur"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nColumnPickerButtonTooltip=Mostra/nascondi colonne\nItems=Elementi\nOf=di\nOver=sopra\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nColumnPickerButtonTooltip=カラムの表示/非表示\nItems=アイテム\nOf=/\nOver=オーバー"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "ColumnPickerButtonTooltip=Mostrar/ esconder colunas\nItems=Itens\nOf=de\nOver=sobre\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/main/resources/org/uberfire/ext/widgets/table/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "ColumnPickerButtonTooltip=显示/隐藏列\nItems=条目\nOf=之\nOver=超出\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/test/java/org/uberfire/ext/widgets/table/client/UberfireColumnPickerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\nimport java.util.Arrays;\n\nimport com.google.gwt.cell.client.CheckboxCell;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.Header;\nimport com.google.gwt.user.cellview.client.TextHeader;\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.gwt.DataGrid;\nimport org.gwtbootstrap3.client.ui.gwt.Widget;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberfireColumnPickerTest {\n\n    @Mock\n    protected org.gwtbootstrap3.client.ui.gwt.DataGrid dataGrid;\n    @GwtMock\n    VerticalPanel popupContent;\n    @InjectMocks\n    private UberfireColumnPicker<String> uberfireColumnPicker;\n    private ColumnMeta columnMetaTextCell1;\n    private ColumnMeta columnMetaTextCell2;\n    private ColumnMeta columnMetaCheckBoxCell;\n\n    @Before\n    public void setup() {\n        columnMetaTextCell1 = createColumnTextCell(\"val1\", \"col1\");\n        columnMetaTextCell2 = createColumnTextCell(\"val2\", \"col2\");\n        columnMetaCheckBoxCell = createColumnCheckboxCell(\"columnMetaCheckBoxCell\");\n        uberfireColumnPicker.addColumn(columnMetaCheckBoxCell);\n        uberfireColumnPicker.addColumn(columnMetaTextCell1);\n        uberfireColumnPicker.addColumn(columnMetaTextCell2);\n    }\n\n    @Test\n    public void testAddThisColumnToPopup() {\n        assertTrue(uberfireColumnPicker.addThisColumnToPopup(columnMetaTextCell1));\n        assertFalse(uberfireColumnPicker.addThisColumnToPopup(columnMetaCheckBoxCell));\n    }\n\n    @Test\n    public void testOnlyAddHeaderStringColumnPickerPopup() {\n        uberfireColumnPicker.showColumnPickerPopup(0, 0);\n        verify(popupContent, times(2)).add(any());\n    }\n\n    private ColumnMeta createColumnMeta(final String value,\n                                        final String dataStoreName,\n                                        boolean isVisible,\n                                        boolean isVisibleIndex,\n                                        int position) {\n\n        final Header<String> header = new TextHeader(value);\n        ColumnMeta<String> columnMeta = new ColumnMeta(createColumn(value, dataStoreName), dataStoreName);\n        columnMeta.setHeader(header);\n        columnMeta.setVisible(isVisible);\n        columnMeta.setVisibleIndex(isVisibleIndex);\n        columnMeta.setPosition(position);\n        return columnMeta;\n    }\n\n    private Column createColumn(final String value, final String dataStoreName) {\n        Column<String, String> testColumn = new Column<String, String>(new TextCell()) {\n            @Override\n            public String getValue(String object) {\n                return value;\n            }\n        };\n        testColumn.setSortable(true);\n        testColumn.setDataStoreName(dataStoreName);\n\n        return testColumn;\n    }\n\n    private ColumnMeta createColumnTextCell(final String value, String dataStoreName) {\n\n        return createColumnMeta(value, dataStoreName, true, true, -1);\n    }\n\n    private ColumnMeta createColumnCheckboxCell(String dataStoreName) {\n        CheckboxCell checkboxCell = new CheckboxCell(true, false);\n        Column<String, Boolean> checkColumn = new Column<String, Boolean>(checkboxCell) {\n            @Override\n            public Boolean getValue(String object) {\n                return true;\n            }\n        };\n\n        Header<Boolean> selectPageHeader = new Header<Boolean>(checkboxCell) {\n            @Override\n            public Boolean getValue() {\n                return true;\n            }\n        };\n\n        checkColumn.setSortable(false);\n        checkColumn.setDataStoreName(dataStoreName);\n        ColumnMeta<String> checkColMeta = new ColumnMeta<String>(checkColumn, \"\");\n        checkColMeta.setHeader(selectPageHeader);\n        return checkColMeta;\n    }\n\n    @Test\n    public void testAddColumnBeforeActionsOnAddColumnOnDataGrid() {\n        UberfireColumnPicker<String> columnPicker = new UberfireColumnPicker<>(new DataGrid<>());\n        ColumnMeta<String> name = createColumnMeta(\"Name\", \"name\", true, true, -1);\n        ColumnMeta<String> age = createColumnMeta(\"Age\", \"age\", true, true, -1);\n        ColumnMeta<String> description = createColumnMeta(\"Description\", \"description\", false, true, -1);\n        ColumnMeta<String> actions = createColumnMeta(\"Actions\", \"actions\", true, false, -1);\n        ColumnMeta<String> etc = createColumnMeta(\"Etc\", \"etc\", false, true, -1);\n\n        columnPicker.addColumn(name);\n        columnPicker.addColumn(age);\n        columnPicker.addColumn(description);\n        columnPicker.addColumn(actions);\n        columnPicker.addColumn(etc);\n\n        assertEquals(3, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"name\", columnPicker.getDataGrid().getColumn(0).getDataStoreName());\n        assertEquals(\"age\", columnPicker.getDataGrid().getColumn(1).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n\n        columnPicker.addColumnOnDataGrid(true, etc);\n\n        assertEquals(4, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(3).getDataStoreName());\n\n        columnPicker.addColumnOnDataGrid(true, description);\n\n        assertEquals(5, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"description\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(3).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(4).getDataStoreName());\n    }\n\n    @Test\n    public void testAddColumnBeforeActionsOnAddColumn() {\n        UberfireColumnPicker<String> columnPicker = new UberfireColumnPicker<>(new DataGrid<>());\n        ColumnMeta<String> name = createColumnMeta(\"Name\", \"name\", true, true, -1);\n        ColumnMeta<String> age = createColumnMeta(\"Age\", \"age\", true, true, -1);\n        ColumnMeta<String> description = createColumnMeta(\"Description\", \"description\", false, true, -1);\n        ColumnMeta<String> actions = createColumnMeta(\"Actions\", \"actions\", true, false, -1);\n        ColumnMeta<String> etc = createColumnMeta(\"Etc\", \"etc\", true, true, -1);\n\n        columnPicker.addColumn(name);\n        columnPicker.addColumn(age);\n        columnPicker.addColumn(description);\n        columnPicker.addColumn(actions);\n        columnPicker.addColumn(etc);\n\n        assertEquals(4, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"name\", columnPicker.getDataGrid().getColumn(0).getDataStoreName());\n        assertEquals(\"age\", columnPicker.getDataGrid().getColumn(1).getDataStoreName());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(3).getDataStoreName());\n\n        ColumnMeta<String> comment = createColumnMeta(\"comment\", \"comment\", true, true, -1);\n        columnPicker.addColumn(comment);\n        assertEquals(5, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"name\", columnPicker.getDataGrid().getColumn(0).getDataStoreName());\n        assertEquals(\"age\", columnPicker.getDataGrid().getColumn(1).getDataStoreName());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n        assertEquals(\"comment\", columnPicker.getDataGrid().getColumn(3).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(4).getDataStoreName());\n    }\n\n    @Test\n    public void testAddColumns() {\n        UberfireColumnPicker<String> columnPicker = new UberfireColumnPicker<>(new DataGrid<>());\n        ColumnMeta<String> name = createColumnMeta(\"Name\", \"name\", true, true, 0);\n        ColumnMeta<String> age = createColumnMeta(\"Age\", \"age\", true, true, 3);\n        ColumnMeta<String> description = createColumnMeta(\"Description\", \"description\", false, true, 1);\n        ColumnMeta<String> actions = createColumnMeta(\"Actions\", \"actions\", true, false, 2);\n        ColumnMeta<String> etc = createColumnMeta(\"Etc\", \"etc\", true, true, 4);\n\n        columnPicker.addColumns(Arrays.asList(name, age, description, actions, etc));\n\n        assertEquals(4, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"name\", columnPicker.getDataGrid().getColumn(0).getDataStoreName());\n        assertEquals(\"age\", columnPicker.getDataGrid().getColumn(1).getDataStoreName());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(3).getDataStoreName());\n    }\n\n    @Test\n    public void testRemoveColumns() {\n        UberfireColumnPicker<String> columnPicker = new UberfireColumnPicker<>(new DataGrid<>());\n        ColumnMeta<String> name = createColumnMeta(\"Name\", \"name\", true, true, 0);\n        ColumnMeta<String> age = createColumnMeta(\"Age\", \"age\", true, true, 3);\n        ColumnMeta<String> description = createColumnMeta(\"Description\", \"description\", false, true, 1);\n        ColumnMeta<String> actions = createColumnMeta(\"Actions\", \"actions\", true, false, 2);\n        ColumnMeta<String> etc = createColumnMeta(\"Etc\", \"etc\", true, true, 4);\n\n        columnPicker.addColumns(Arrays.asList(name, age, description, actions, etc));\n\n        columnPicker.removeColumn(name);\n        columnPicker.removeColumn(description);\n\n        assertEquals(3, columnPicker.getDataGrid().getColumnCount());\n        assertEquals(\"age\", columnPicker.getDataGrid().getColumn(0).getDataStoreName());\n        assertEquals(\"etc\", columnPicker.getDataGrid().getColumn(1).getDataStoreName());\n        assertEquals(\"actions\", columnPicker.getDataGrid().getColumn(2).getDataStoreName());\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-widgets/uberfire-widgets-table/src/test/java/org/uberfire/ext/widgets/table/client/UberfireSimpleTableTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.widgets.table.client;\n\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberfireSimpleTableTest {\n\n    @Mock\n    protected UberfireColumnPicker columnPickerMock;\n\n    @InjectMocks\n    private UberfireSimpleTable<String> uberfireSimpleTable;\n\n    @Before\n    public void setup() {\n\n    }\n\n    @Test\n    public void testSetColumnWidth() {\n        Column<String, String> testColumn = new Column<String, String>(new TextCell()) {\n            @Override\n            public String getValue(String object) {\n                return \"col1\";\n            }\n        };\n        uberfireSimpleTable.setColumnPicker(columnPickerMock);\n        uberfireSimpleTable.setColumnWidth(testColumn,\n                                           35,\n                                           Style.Unit.PX);\n        verify(columnPickerMock).adjustColumnWidths();\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/README.md",
    "content": "wires\n=====\n\nwires canvas\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-extensions</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-wires</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Wires</name>\n\n  <modules>\n    <module>uberfire-wires-core</module>\n    <module>uberfire-wires-bayesian-parser</module>\n    <module>uberfire-wires-bayesian-network</module>\n    <module>uberfire-wires-bpmn</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-bayesian-network</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Wires :: Bayesian Network</name>\n\n  <modules>\n    <module>uberfire-wires-bayesian-network-client</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-bayesian-network</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-bayesian-network-client</artifactId>\n\n  <name>Uberfire Wires :: Bayesian Network Client</name>\n  <description>Wires Bayesian Network Client</description>\n\n  <dependencies>\n    <!-- dependencies added because of new illegal transitive dependency check -->\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-bayesian-parser-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n\n    <!-- Wires -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-scratchpad</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-bayesian-parser-backend</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/events/BayesianTemplateSelectedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.events;\n\npublic class BayesianTemplateSelectedEvent {\n\n    private String template;\n\n    public BayesianTemplateSelectedEvent(final String template) {\n        this.template = template;\n    }\n\n    public String getTemplate() {\n        return template;\n    }\n\n    public void setTemplate(final String template) {\n        this.template = template;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/events/RenderBayesianNetworkEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.events;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianNode;\n\npublic class RenderBayesianNetworkEvent {\n\n    private List<EditableBayesianNode> bayesianNodes;\n\n    public RenderBayesianNetworkEvent(final List<EditableBayesianNode> bayesianNodes) {\n        this.bayesianNodes = bayesianNodes;\n    }\n\n    public List<EditableBayesianNode> getBayesianNodes() {\n        return bayesianNodes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/factory/BaseFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.client.factory;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Shape;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.Color;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class BaseFactory {\n\n    private static final String defaultFillColor = ShapesUtils.RGB_FILL_SHAPE;\n    private static final String defaultBorderColor = ShapesUtils.RGB_STROKE_SHAPE;\n\n    protected void setAttributes(final Shape<?> shape,\n                                 final String fillColor,\n                                 final double x,\n                                 final double y,\n                                 final String borderColor) {\n        String fill = (fillColor == null) ? defaultFillColor : fillColor;\n        String border = (borderColor == null) ? defaultBorderColor : borderColor;\n\n        shape.setX(x).setY(y).setStrokeColor(border).setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE).setFillColor(fill).setDraggable(false);\n    }\n\n    protected Rectangle drawComponent(final String color,\n                                      final int positionX,\n                                      final int positionY,\n                                      final int width,\n                                      final int height,\n                                      String borderColor,\n                                      double radius) {\n        if (borderColor == null) {\n            borderColor = Color.rgbToBrowserHexColor(0,\n                                                     0,\n                                                     0);\n        }\n        Rectangle component = new Rectangle(width,\n                                            height);\n        setAttributes(component,\n                      color,\n                      positionX,\n                      positionY,\n                      borderColor);\n        component.setCornerRadius(radius);\n        return component;\n    }\n\n    protected Text drawText(final String description,\n                            final int fontSize,\n                            final int positionX,\n                            final int positionY) {\n        return new Text(description,\n                        \"Times\",\n                        fontSize).setX(positionX).setY(positionY);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/factory/BayesianFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.factory;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.Color;\nimport com.google.common.collect.Lists;\nimport com.google.common.collect.Maps;\nimport com.google.gwt.user.client.Window;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.ext.wires.bayesian.network.client.events.RenderBayesianNetworkEvent;\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianNode;\nimport org.uberfire.ext.wires.bayesian.network.client.utils.BayesianUtils;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesNetwork;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesVariable;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.service.BayesianService;\nimport org.uberfire.ext.wires.core.client.progressbar.ProgressBar;\n\n@ApplicationScoped\npublic class BayesianFactory extends BaseFactory {\n\n    @Inject\n    private Caller<BayesianService> bayesianService;\n\n    @Inject\n    private Event<RenderBayesianNetworkEvent> readyEvent;\n\n    private String[][] colors;\n    private List<EditableBayesianNode> bayesianNodes = new ArrayList<EditableBayesianNode>();\n\n    public void init(final String xml03File) {\n        bayesianService.call(new RemoteCallback<BayesNetwork>() {\n                                 @Override\n                                 public void callback(final BayesNetwork response) {\n                                     bayesianNodes.clear();\n                                     for (BayesVariable bay : response.getNodos()) {\n                                         drawBayesianNode(bay);\n                                     }\n                                     readyEvent.fire(new RenderBayesianNetworkEvent(bayesianNodes));\n                                 }\n                             },\n                             new ErrorCallback<Object>() {\n\n                                 @Override\n                                 public boolean error(Object message,\n                                                      Throwable throwable) {\n                                     Window.alert(\"Sorry.. the \" + xml03File + \" could not be read..\");\n                                     ProgressBar.setInfinite(false);\n                                     return false;\n                                 }\n                             }\n        ).buildXml03(BayesianUtils.XML3_RESOURCE_PATH + xml03File);\n    }\n\n    private void drawBayesianNode(BayesVariable node) {\n        colors = BayesianUtils.getNodeColors();\n        double position[][] = node.getPosition();\n        int positionX = (int) (BayesianUtils.POSITION_X_BASE + Math.round(position[0][0]));\n        int positionY = (int) (BayesianUtils.POSITION_Y_BASE + Math.round(position[0][1]));\n        String fillNodeColor = colors[0][0];\n\n        EditableBayesianNode bayesianNode = new EditableBayesianNode(BayesianUtils.WIDTH_NODE,\n                                                                     BayesianUtils.HEIGHT_NODE,\n                                                                     positionX,\n                                                                     positionY,\n                                                                     fillNodeColor,\n                                                                     node);\n\n        this.setHeader(node,\n                       bayesianNode);\n        this.setPorcentualBar(node,\n                              bayesianNode);\n\n        bayesianNode.buildNode();\n\n        bayesianNodes.add(bayesianNode);\n    }\n\n    private void setHeader(BayesVariable node,\n                           EditableBayesianNode bayesianNode) {\n        bayesianNode.setHeader(new Rectangle(bayesianNode.getWidth(),\n                                             BayesianUtils.HEIGHT_HEADER));\n        bayesianNode.getHeader().setFillColor(colors[0][1]);\n        bayesianNode.getHeader().setX(bayesianNode.getHeader().getX());\n        bayesianNode.setTextHeader(drawText(node.getName(),\n                                            BayesianUtils.FONT_SIZE_HEADER_NODE,\n                                            BayesianUtils.LABEL_POSITION_X_DEFAULT,\n                                            BayesianUtils.LABEL_POSITION_Y_DEFAULT));\n    }\n\n    private void setPorcentualBar(BayesVariable node,\n                                  EditableBayesianNode bayesianNode) {\n        String fillColor = colors[0][1];\n        int widthFill;\n        int positionY = 18;\n        positionY = (node.getOutcomes().size() > 3) ? positionY - 10 : positionY;\n        String borderColor = fillColor;\n\n        List<Rectangle> componentsProgressBar = Lists.newArrayList();\n        Text labelPorcentual;\n        Map<Text, List<Rectangle>> porcentualsBar = Maps.newHashMap();\n        for (int i = 0; i < node.getOutcomes().size(); i++) {\n            // Porcentual bar\n            positionY += 14;\n            labelPorcentual = this.drawText(node.getOutcomes().get(i),\n                                            BayesianUtils.FONT_SIZE_PORCENTUAL_BAR,\n                                            BayesianUtils.LABEL_POSITION_X_DEFAULT,\n                                            positionY + 7);\n            componentsProgressBar.add(this.drawComponent(Color.rgbToBrowserHexColor(255,\n                                                                                    255,\n                                                                                    255),\n                                                         BayesianUtils.POSITION_X_PORCENTUAL_BAR,\n                                                         positionY,\n                                                         BayesianUtils.WIDTH_PORCENTUAL_BAR,\n                                                         BayesianUtils.HEIGHT_PORCENTUAL_BAR,\n                                                         borderColor,\n                                                         3));\n            // fill bar\n            widthFill = calculatePorcentage(node.getProbabilities(),\n                                            BayesianUtils.WIDTH_PORCENTUAL_BAR,\n                                            i);\n            componentsProgressBar.add(drawComponent(fillColor,\n                                                    BayesianUtils.POSITION_X_PORCENTUAL_BAR,\n                                                    positionY,\n                                                    widthFill,\n                                                    BayesianUtils.HEIGHT_PORCENTUAL_BAR,\n                                                    borderColor,\n                                                    0));\n            bayesianNode.getPorcentualsBar().put(labelPorcentual,\n                                                 componentsProgressBar);\n\n            porcentualsBar.put(labelPorcentual,\n                               componentsProgressBar);\n        }\n        bayesianNode.setPorcentualBars(porcentualsBar);\n    }\n\n    private int calculatePorcentage(double probabilities[][],\n                                    int maxWidthFill,\n                                    int position) {\n        double porcentual = 0;\n        if (position == 0) {\n            porcentual = probabilities[0][0];\n        } else if (position == 1) {\n            porcentual = probabilities[0][1];\n        }\n        porcentual *= 100;\n        return (int) ((porcentual * maxWidthFill) / 100);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/factory/BayesianNodeCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.factory;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class BayesianNodeCategory extends Category {\n\n    public static final BayesianNodeCategory CATEGORY = new BayesianNodeCategory();\n\n    private BayesianNodeCategory() {\n        super(\"Bayesian Node\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/factory/BayesianNodePaletteFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.factory;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianNode;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\n@ApplicationScoped\npublic class BayesianNodePaletteFactory extends AbstractBaseFactory<Rectangle> {\n\n    private static final String DESCRIPTION = \"Bayesian Node\";\n\n    private static final int SHAPE_SIZE_X = 40;\n    private static final int SHAPE_SIZE_Y = 40;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return BayesianNodeCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new EditableBayesianNode(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof EditableBayesianNode;\n    }\n\n    @Override\n    protected Rectangle makeShape() {\n        final Rectangle rectangle = new Rectangle(SHAPE_SIZE_X,\n                                                  SHAPE_SIZE_Y,\n                                                  5);\n        rectangle.setX(0 - (SHAPE_SIZE_X / 2))\n                .setY(0 - (SHAPE_SIZE_Y / 2))\n                .setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(ShapesUtils.RGB_FILL_SHAPE)\n                .setDraggable(false);\n        return rectangle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return SHAPE_SIZE_X;\n    }\n\n    @Override\n    protected double getHeight() {\n        return SHAPE_SIZE_Y;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/factory/ProbabilityFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.factory;\n\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.Color;\nimport com.google.common.collect.Maps;\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianProbability;\nimport org.uberfire.ext.wires.bayesian.network.client.utils.BayesianUtils;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesVariable;\n\npublic class ProbabilityFactory extends BaseFactory {\n\n    private int positionXPorc;\n\n    public EditableBayesianProbability init(final BayesVariable node) {\n        int positionX = 350;\n        int positionY = 80;\n        int width = 65;\n        int height = 100;\n\n        EditableBayesianProbability bayesianProbabilityGrid = new EditableBayesianProbability(1200,\n                                                                                              300,\n                                                                                              0,\n                                                                                              0);\n\n        // draw parent node\n        drawNodeSelected(node,\n                         positionX,\n                         positionY,\n                         width,\n                         height,\n                         bayesianProbabilityGrid);\n\n        // draw porcentual options\n        int positionXOptions = positionX + width;\n        int heightOptions = height / node.getOutcomes().size();\n        int widthOptions = width - 10;\n        drawPorcentualOptions(node,\n                              positionXOptions,\n                              positionY,\n                              widthOptions,\n                              heightOptions,\n                              bayesianProbabilityGrid);\n\n        // draw porcentual values\n        int positionXValues = positionXOptions + widthOptions;\n        int positionYValues = positionY;\n        int heightPorcentualValue = height / node.getOutcomes().size();\n        int widthPorcentualValue = widthOptions - 5;\n        drawPorcentualValues(node,\n                             positionXValues,\n                             positionYValues,\n                             widthPorcentualValue,\n                             heightPorcentualValue,\n                             positionYValues,\n                             bayesianProbabilityGrid);\n\n        // draw incoming nodes\n        int widthIncoming = width + widthOptions;\n        int heightIncoming = 25;\n        int positionYIncoming = positionY - heightIncoming;\n        drawIncomingNodes(node,\n                          positionX,\n                          positionYIncoming,\n                          widthIncoming,\n                          heightIncoming,\n                          widthPorcentualValue,\n                          widthOptions,\n                          heightOptions,\n                          bayesianProbabilityGrid);\n\n        bayesianProbabilityGrid.buildGrid();\n\n        return bayesianProbabilityGrid;\n    }\n\n    private void drawNodeSelected(final BayesVariable node,\n                                  final int positionX,\n                                  final int positionY,\n                                  final int width,\n                                  final int height,\n                                  final EditableBayesianProbability bayesianProbabilityGrid) {\n        Map<Text, Rectangle> parentNode = Maps.newHashMap();\n        Rectangle nodeSelected = super.drawComponent(Color.rgbToBrowserHexColor(183,\n                                                                                198,\n                                                                                201),\n                                                     positionX,\n                                                     positionY,\n                                                     width,\n                                                     height,\n                                                     Color.rgbToBrowserHexColor(183,\n                                                                                198,\n                                                                                201),\n                                                     2);\n\n        Text label = super.drawText(node.getName(),\n                                    BayesianUtils.FONT_SIZE_TEXT_LABEL,\n                                    positionX + 7,\n                                    positionY + 54);\n        parentNode.put(label,\n                       nodeSelected);\n        bayesianProbabilityGrid.setParentNode(parentNode);\n    }\n\n    private void drawPorcentualOptions(final BayesVariable node,\n                                       final int positionXOptions,\n                                       final int positionYOptions,\n                                       final int widthOptions,\n                                       final int heightOptions,\n                                       final EditableBayesianProbability bayesianProbabilityGrid) {\n        int _positionYOptions = positionYOptions;\n        Map<Text, Rectangle> porcentualOptions = Maps.newHashMap();\n        for (String outcome : node.getOutcomes()) {\n            Rectangle porcentualOption = super.drawComponent(Color.rgbToBrowserHexColor(200,\n                                                                                        216,\n                                                                                        203),\n                                                             positionXOptions,\n                                                             _positionYOptions,\n                                                             widthOptions,\n                                                             heightOptions,\n                                                             Color.rgbToBrowserHexColor(200,\n                                                                                        216,\n                                                                                        203),\n                                                             0);\n\n            Text porcentualLabel = super.drawText(outcome,\n                                                  BayesianUtils.FONT_SIZE_TEXT_LABEL,\n                                                  positionXOptions + 7,\n                                                  _positionYOptions + (20 / node.getOutcomes().size()) + 19);\n\n            _positionYOptions += heightOptions;\n            porcentualOptions.put(porcentualLabel,\n                                  porcentualOption);\n        }\n        bayesianProbabilityGrid.setPorcentualOptions(porcentualOptions);\n    }\n\n    private void drawPorcentualValues(final BayesVariable node,\n                                      final int positionXValues,\n                                      final int positionYValues,\n                                      final int widthPorcentualValue,\n                                      final int heightPorcentualValue,\n                                      final int positionY,\n                                      final EditableBayesianProbability bayesianProbabilityGrid) {\n        int _positionXValues = positionXValues;\n        int _positionYValues = positionYValues;\n        double probabilities[][] = (node.getGiven() != null && node.getGiven().size() > 1) ? BayesianUtils.orderListValues(node,\n                                                                                                                           node.getOutcomes().size()) : node.getProbabilities();\n        Map<Text, Rectangle> porcentualValues = Maps.newHashMap();\n        for (int i = 0; i < probabilities.length / node.getOutcomes().size(); i++) {\n            for (int j = 0; j < node.getOutcomes().size(); j++) {\n                Rectangle porcentual = super.drawComponent(Color.rgbToBrowserHexColor(255,\n                                                                                      255,\n                                                                                      255),\n                                                           _positionXValues,\n                                                           _positionYValues,\n                                                           widthPorcentualValue,\n                                                           heightPorcentualValue,\n                                                           Color.rgbToBrowserHexColor(183,\n                                                                                      198,\n                                                                                      201),\n                                                           0);\n\n                Text porcentualLabel = super.drawText(String.valueOf(probabilities[i][j]),\n                                                      BayesianUtils.FONT_SIZE_TEXT_LABEL,\n                                                      _positionXValues + 7,\n                                                      _positionYValues + (20 / node.getOutcomes().size()) + 19);\n\n                _positionYValues += heightPorcentualValue;\n                porcentualValues.put(porcentualLabel,\n                                     porcentual);\n            }\n            _positionYValues = positionY;\n            _positionXValues += widthPorcentualValue;\n        }\n        bayesianProbabilityGrid.setPorcentualValues(porcentualValues);\n    }\n\n    private void drawIncomingNodes(final BayesVariable node,\n                                   final int positionXIncoming,\n                                   final int positionYIncoming,\n                                   final int widthIncoming,\n                                   final int heightIncoming,\n                                   final int widthPorcentualValue,\n                                   final int widthOptions,\n                                   final int heightOptions,\n                                   final EditableBayesianProbability bayesianProbabilityGrid) {\n        int _positionYIncoming = positionYIncoming;\n        String color = Color.rgbToBrowserHexColor(182,\n                                                  199,\n                                                  191);\n        int incomingPosition = 0;\n        Map<Map<Text, Rectangle>, Map<Text, Rectangle>> porcentualIncoming = Maps.newHashMap();\n        int acountIterations = 0;\n        int widthNode = 0;\n        if (node.getIncomingNodes() != null && !node.getIncomingNodes().isEmpty()) {\n            for (BayesVariable nod : node.getIncomingNodes()) {\n                Map<Text, Rectangle> incomingNodes = Maps.newHashMap();\n                Map<Text, Rectangle> porcentualValues = Maps.newHashMap();\n\n                // draw label\n                Rectangle incomingNode = super.drawComponent(color,\n                                                             positionXIncoming,\n                                                             _positionYIncoming,\n                                                             widthIncoming,\n                                                             heightIncoming,\n                                                             color,\n                                                             0);\n                Text incomingLabel = super.drawText(nod.getName(),\n                                                    BayesianUtils.FONT_SIZE_TEXT_LABEL,\n                                                    positionXIncoming + 10,\n                                                    _positionYIncoming + 19);\n\n                incomingNodes.put(incomingLabel,\n                                  incomingNode);\n\n                // draw porcentual options\n                positionXPorc = positionXIncoming + widthIncoming;\n\n                if (incomingPosition == 0) {\n                    for (int i = 0; i < (node.getProbabilities().length / node.getOutcomes().size()) / nod.getOutcomes().size(); i++) {\n                        drawPorcentualIncoming(nod,\n                                               _positionYIncoming,\n                                               heightIncoming,\n                                               widthPorcentualValue,\n                                               heightOptions,\n                                               bayesianProbabilityGrid,\n                                               porcentualValues);\n                        acountIterations += 1;\n                    }\n                } else {\n                    int sizeOutcomesPrevIncomingNode = node.getIncomingNodes().get(incomingPosition - 1).getOutcomes().size();\n                    int iter = acountIterations / nod.getOutcomes().size();\n                    acountIterations = 0;\n\n                    widthNode = (widthNode == 0) ? widthPorcentualValue * sizeOutcomesPrevIncomingNode : widthNode * sizeOutcomesPrevIncomingNode;\n\n                    for (int i = 0; i < iter; i++) {\n                        drawPorcentualIncoming(nod,\n                                               _positionYIncoming,\n                                               heightIncoming,\n                                               widthNode,\n                                               heightOptions,\n                                               bayesianProbabilityGrid,\n                                               porcentualValues);\n                        acountIterations += 1;\n                    }\n                }\n                incomingPosition += 1;\n\n                _positionYIncoming -= heightIncoming;\n                color = Color.rgbToBrowserHexColor(210,\n                                                   204,\n                                                   229);\n                porcentualIncoming.put(incomingNodes,\n                                       porcentualValues);\n            }\n            bayesianProbabilityGrid.setIncomingNodes(porcentualIncoming);\n        }\n    }\n\n    private void drawPorcentualIncoming(final BayesVariable nod,\n                                        final int positionYIncoming,\n                                        final int heightIncoming,\n                                        final int widthPorcentualValue,\n                                        final int heightOptions,\n                                        final EditableBayesianProbability bayesianProbabilityGrid,\n                                        final Map<Text, Rectangle> porcentualValues) {\n        for (String out : nod.getOutcomes()) {\n            Rectangle porcentual = super.drawComponent(Color.rgbToBrowserHexColor(200,\n                                                                                  216,\n                                                                                  203),\n                                                       positionXPorc,\n                                                       positionYIncoming,\n                                                       widthPorcentualValue,\n                                                       heightIncoming,\n                                                       Color.rgbToBrowserHexColor(200,\n                                                                                  216,\n                                                                                  203),\n                                                       0);\n\n            Text porcentualLabel = super.drawText(out,\n                                                  BayesianUtils.FONT_SIZE_TEXT_LABEL,\n                                                  positionXPorc + 7,\n                                                  positionYIncoming + 19);\n\n            positionXPorc += widthPorcentualValue;\n            porcentualValues.put(porcentualLabel,\n                                 porcentual);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/perspectives/WiresBayesianPerspective.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n/**\n * A Perspective to show Bayesian related panels\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"WiresBayesianPerspective\")\npublic class WiresBayesianPerspective {\n\n    private static final String WIRES = \"Bayesian Networks\";\n\n    private static final String BAYESIAN_SCREEN = \"BayesianScreen\";\n    private static final String WIRES_LAYERS_SCREEN = \"WiresLayersScreen\";\n    private static final String WIRES_TEMPLATE_SCREEN = \"BayesianTemplatesScreen\";\n    private static final String BAYESIAN_VARIABLES_SCREEN = \"BayesianVariablesScreen\";\n\n    private static final int MIN_WIDTH_PANEL = 200;\n    private static final int WIDTH_PANEL = 300;\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        perspective.setName(WIRES);\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(BAYESIAN_SCREEN)));\n\n        final PanelDefinition layersPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        layersPanel.setMinWidth(MIN_WIDTH_PANEL);\n        layersPanel.setWidth(WIDTH_PANEL);\n        layersPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_LAYERS_SCREEN)));\n\n        final PanelDefinition templatesPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        templatesPanel.setMinWidth(MIN_WIDTH_PANEL);\n        templatesPanel.setWidth(WIDTH_PANEL);\n        templatesPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_TEMPLATE_SCREEN)));\n\n        layersPanel.appendChild(CompassPosition.SOUTH,\n                                templatesPanel);\n\n        perspective.getRoot().insertChild(CompassPosition.EAST,\n                                          layersPanel);\n\n        final PanelDefinition variablesPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        variablesPanel.setMinWidth(MIN_WIDTH_PANEL);\n        variablesPanel.setWidth(WIDTH_PANEL);\n        variablesPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(BAYESIAN_VARIABLES_SCREEN)));\n\n        perspective.getRoot().insertChild(CompassPosition.SOUTH,\n                                          variablesPanel);\n\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/screen/BayesianScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.screen;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.wires.bayesian.network.client.events.BayesianTemplateSelectedEvent;\nimport org.uberfire.ext.wires.bayesian.network.client.events.RenderBayesianNetworkEvent;\nimport org.uberfire.ext.wires.bayesian.network.client.factory.BayesianFactory;\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianNode;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeAddedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.canvas.WiresCanvas;\n\n/**\n * A custom WiresCanvas implementation to handle Bayesian Networks\n */\n@Dependent\n@WorkbenchScreen(identifier = \"BayesianScreen\")\npublic class BayesianScreen extends WiresCanvas {\n\n    @Inject\n    private BayesianFactory factory;\n\n    @Inject\n    private Event<ClearEvent> clearEvent;\n\n    @Inject\n    private Event<ShapeSelectedEvent> shapeSelectedEvent;\n\n    @Inject\n    private Event<ShapeAddedEvent> shapeAddedEvent;\n\n    public void onBayesianEvent(@Observes BayesianTemplateSelectedEvent event) {\n        factory.init(event.getTemplate());\n    }\n\n    public void onReadyEvent(@Observes RenderBayesianNetworkEvent event) {\n        //ClearEvent clears Variables Panel and this Canvas\n        clearEvent.fire(new ClearEvent());\n        for (EditableBayesianNode node : event.getBayesianNodes()) {\n            addShape(node);\n        }\n    }\n\n    public void onClearEvent(@Observes ClearEvent clearEvent) {\n        clear();\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Bayesian Network\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    @Override\n    public void addShape(final WiresBaseShape shape) {\n        //ShapeAddedEvent integrates with Layers Panel\n        super.addShape(shape);\n        shapeAddedEvent.fire(new ShapeAddedEvent(shape));\n    }\n\n    @Override\n    public void selectShape(final WiresBaseShape shape) {\n        shapeSelectedEvent.fire(new ShapeSelectedEvent(shape));\n    }\n\n    public void onShapeSelected(@Observes ShapeSelectedEvent event) {\n        //ShapeSelectedEvent integrates with Layers Panel and this Canvas\n        super.selectShape(event.getShape());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/shapes/EditableBayesianNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.shapes;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.google.common.collect.Maps;\nimport org.uberfire.ext.wires.bayesian.network.client.utils.BayesianUtils;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesVariable;\nimport org.uberfire.ext.wires.core.api.shapes.OverridesFactoryDescription;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class EditableBayesianNode extends WiresBaseShape implements OverridesFactoryDescription {\n\n    private static final int BOUNDARY_SIZE = 10;\n    private final Rectangle rectangle;\n    private final Rectangle bounding;\n    private final BayesVariable variable;\n    private Rectangle header;\n    private Text textHeader;\n    private Map<Text, List<Rectangle>> porcentualBars;\n\n    public EditableBayesianNode() {\n        this(0,\n             0,\n             0,\n             0,\n             \"\");\n    }\n\n    public EditableBayesianNode(final Rectangle shape) {\n        this(shape.getWidth(),\n             shape.getHeight(),\n             shape.getX(),\n             shape.getY(),\n             BayesianUtils.getNodeColors()[0][0]);\n    }\n\n    public EditableBayesianNode(final double width,\n                                final double height,\n                                final double positionXNode,\n                                final double positionYNode,\n                                final String fillColor) {\n        this(width,\n             height,\n             positionXNode,\n             positionYNode,\n             fillColor,\n             new BayesVariable());\n    }\n\n    public EditableBayesianNode(final double width,\n                                final double height,\n                                final double positionXNode,\n                                final double positionYNode,\n                                final String fillColor,\n                                final BayesVariable variable) {\n        this.variable = variable;\n\n        rectangle = new Rectangle(width,\n                                  height);\n        rectangle.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE);\n        rectangle.setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE);\n        rectangle.setFillColor(fillColor);\n\n        bounding = new Rectangle(width + BOUNDARY_SIZE,\n                                 height + BOUNDARY_SIZE,\n                                 rectangle.getCornerRadius());\n        bounding.setX(getX() - (BOUNDARY_SIZE / 2));\n        bounding.setY(getY() - (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(rectangle);\n\n        setX(positionXNode);\n        setY(positionYNode);\n\n        this.porcentualBars = Maps.newHashMap();\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(double cx,\n                            double cy) {\n        //We don't have any ControlPoints so no need to worry about whether we contain a given point\n        return false;\n    }\n\n    public void buildNode() {\n        add(this.header);\n        add(this.textHeader);\n        for (Map.Entry<Text, List<Rectangle>> porcenualBar : this.porcentualBars.entrySet()) {\n            for (Rectangle rec : porcenualBar.getValue()) {\n                add(rec);\n            }\n            add(porcenualBar.getKey());\n        }\n    }\n\n    public Rectangle getParentNode() {\n        return rectangle;\n    }\n\n    public Rectangle getHeader() {\n        return header;\n    }\n\n    public void setHeader(final Rectangle header) {\n        this.header = header;\n    }\n\n    public Text getTextHeader() {\n        return textHeader;\n    }\n\n    public void setTextHeader(final Text textHeader) {\n        this.textHeader = textHeader;\n    }\n\n    public Map<Text, List<Rectangle>> getPorcentualsBar() {\n        return porcentualBars;\n    }\n\n    public void setPorcentualBars(final Map<Text, List<Rectangle>> porcentualBars) {\n        this.porcentualBars = porcentualBars;\n    }\n\n    public double getWidth() {\n        return rectangle.getWidth();\n    }\n\n    public BayesVariable getVariable() {\n        return variable;\n    }\n\n    @Override\n    public String getDescription() {\n        return variable.getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/shapes/EditableBayesianProbability.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.shapes;\n\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.google.common.collect.Maps;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class EditableBayesianProbability extends WiresBaseShape {\n\n    private final Rectangle rectangle;\n    private Map<Text, Rectangle> parentNode;\n    private Map<Text, Rectangle> porcentualOptions;\n    private Map<Text, Rectangle> porcentualValues;\n    private Map<Map<Text, Rectangle>, Map<Text, Rectangle>> incomingNodes;\n\n    public EditableBayesianProbability() {\n        this(0,\n             0,\n             0,\n             0);\n    }\n\n    public EditableBayesianProbability(final double width,\n                                       final double height,\n                                       final double positionXNode,\n                                       final double positionYNode) {\n        rectangle = new Rectangle(width,\n                                  height);\n        rectangle.setStrokeColor(ColorName.WHITE.getValue());\n\n        add(rectangle);\n\n        setX(positionXNode);\n        setY(positionYNode);\n        setDraggable(false);\n\n        this.parentNode = Maps.newHashMap();\n        this.porcentualOptions = Maps.newHashMap();\n        this.porcentualValues = Maps.newHashMap();\n        this.incomingNodes = Maps.newHashMap();\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        //It's not possible to select these Shapes\n    }\n\n    @Override\n    public boolean contains(double cx,\n                            double cy) {\n        //We don't have any ControlPoints so no need to worry about whether we contain a given point\n        return false;\n    }\n\n    public void buildGrid() {\n        drawComponents(this.parentNode);\n        drawComponents(this.porcentualOptions);\n        drawComponents(this.porcentualValues);\n        if (this.incomingNodes != null && !this.incomingNodes.isEmpty()) {\n            for (Map.Entry<Map<Text, Rectangle>, Map<Text, Rectangle>> porc : incomingNodes.entrySet()) {\n                drawComponents(porc.getValue());\n                drawComponents(porc.getKey());\n            }\n        }\n    }\n\n    private void drawComponents(final Map<Text, Rectangle> hash) {\n        for (Map.Entry<Text, Rectangle> parent : hash.entrySet()) {\n            add(parent.getValue());\n            add(parent.getKey());\n        }\n    }\n\n    public Map<Text, Rectangle> getParentNode() {\n        return parentNode;\n    }\n\n    public void setParentNode(final Map<Text, Rectangle> parentNode) {\n        this.parentNode = parentNode;\n    }\n\n    public Map<Text, Rectangle> getPorcentualOptions() {\n        return porcentualOptions;\n    }\n\n    public void setPorcentualOptions(final Map<Text, Rectangle> porcentualOptions) {\n        this.porcentualOptions = porcentualOptions;\n    }\n\n    public Map<Text, Rectangle> getPorcentualValues() {\n        return porcentualValues;\n    }\n\n    public void setPorcentualValues(final Map<Text, Rectangle> porcentualValues) {\n        this.porcentualValues = porcentualValues;\n    }\n\n    public Map<Map<Text, Rectangle>, Map<Text, Rectangle>> getIncomingNodes() {\n        return incomingNodes;\n    }\n\n    public void setIncomingNodes(final Map<Map<Text, Rectangle>, Map<Text, Rectangle>> incomingNodes) {\n        this.incomingNodes = incomingNodes;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/templates/StencilTemplateBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.templates;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Shape;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\n/**\n *\n */\npublic class StencilTemplateBuilder {\n\n    public TemplateShape build(final String templateName,\n                               final NodeMouseClickHandler clickHandler) {\n\n        final TemplateShape templateShape = new TemplateShape();\n        final Shape shape = drawShape();\n        final Rectangle bounding = drawBoundingBox();\n        final Text description = drawDescription(templateName);\n\n        //Attach handles for drag operation\n        shape.addNodeMouseClickHandler(clickHandler);\n        bounding.addNodeMouseClickHandler(clickHandler);\n        description.addNodeMouseClickHandler(clickHandler);\n\n        //Build Template Shape\n        templateShape.setBounding(bounding);\n        templateShape.setShape(shape);\n        templateShape.setDescription(description);\n\n        return templateShape;\n    }\n\n    private Shape drawShape() {\n        final Rectangle rectangle = new Rectangle(20,\n                                                  20);\n\n        rectangle.setX(5).setY(5)\n                .setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(ShapesUtils.RGB_FILL_SHAPE)\n                .setDraggable(false);\n\n        return rectangle;\n    }\n\n    private Rectangle drawBoundingBox() {\n        final Rectangle boundingBox = new Rectangle(ShapeFactoryUtil.WIDTH_BOUNDING_LAYER,\n                                                    ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER);\n        boundingBox.setStrokeColor(ShapeFactoryUtil.RGB_STROKE_BOUNDING)\n                .setStrokeWidth(1)\n                .setFillColor(ShapeFactoryUtil.RGB_FILL_BOUNDING)\n                .setDraggable(false);\n        return boundingBox;\n    }\n\n    private Text drawDescription(final String templateName) {\n        Text text = new Text(templateName,\n                             ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION,\n                             ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);\n        text.setFillColor(ShapeFactoryUtil.RGB_TEXT_DESCRIPTION);\n        text.setTextBaseLine(TextBaseLine.MIDDLE);\n        text.setX(30);\n        text.setY(10);\n        return text;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/templates/TemplateScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.client.templates;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"BayesianTemplatesScreen\")\npublic class TemplateScreen extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    PanelGroup accordion;\n    @UiField\n    PanelHeader headerTemplates;\n    @UiField\n    PanelCollapse collapseTemplates;\n    @UiField\n    SimplePanel templates;\n    @Inject\n    private SyncBeanManager iocManager;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        accordion.setId(DOM.createUniqueId());\n        headerTemplates.setDataParent(accordion.getId());\n        headerTemplates.setDataTargetWidget(collapseTemplates);\n\n        templates.add(iocManager.lookupBean(TemplatesGroup.class).getInstance());\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Templates\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    interface ViewBinder extends UiBinder<Widget, TemplateScreen> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/templates/TemplateScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <g:SimplePanel>\n    <b:PanelGroup ui:field=\"accordion\">\n      <b:Panel>\n        <b:PanelHeader dataToggle=\"COLLAPSE\" text=\"Bayesian examples\" ui:field=\"headerTemplates\"/>\n        <b:PanelCollapse ui:field=\"collapseTemplates\" in=\"true\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"templates\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n  </g:SimplePanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/templates/TemplateShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.templates;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Shape;\nimport com.ait.lienzo.client.core.shape.Text;\n\npublic class TemplateShape extends Group {\n\n    public void setBounding(Rectangle bounding) {\n        add(bounding);\n    }\n\n    public void setShape(Shape<?> shape) {\n        add(shape);\n    }\n\n    public void setDescription(Text description) {\n        add(description);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/templates/TemplatesGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.templates;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.common.collect.ImmutableSet;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.bayesian.network.client.events.BayesianTemplateSelectedEvent;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\n\n@Dependent\npublic class TemplatesGroup extends Composite {\n\n    private final ImmutableSet<String> templateNames = ImmutableSet.of(\"dog-problem.xml03\",\n                                                                       \"cancer.xml03\",\n                                                                       \"asia.xml03\",\n                                                                       \"car-starts.xml03\",\n                                                                       \"elimbel2.xml03\",\n                                                                       \"john-mary-call.xml03\");\n    private Layer layer;\n    private LienzoPanel panel;\n    @Inject\n    private Event<BayesianTemplateSelectedEvent> bayesianEvent;\n\n    @Inject\n    private StencilTemplateBuilder stencilBuilder;\n\n    @PostConstruct\n    public void init() {\n        panel = new LienzoPanel(ShapeFactoryUtil.WIDTH_PANEL,\n                                ShapeFactoryUtil.HEIGHT_PANEL);\n        layer = new Layer();\n        panel.getScene().add(layer);\n        initWidget(panel);\n\n        drawTemplates();\n    }\n\n    private void drawTemplates() {\n        //Add Template files to panel\n        final List<TemplateShape> shapes = new ArrayList<TemplateShape>();\n        for (String templateName : templateNames) {\n            shapes.add(stencilBuilder.build(templateName,\n                                            getTemplateClickHandler(templateName)));\n        }\n\n        //Add TemplateShapes to the UI\n        int shapeCount = 0;\n        for (TemplateShape shape : shapes) {\n            shape.setX(0);\n            shape.setY(shapeCount * (ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING));\n            layer.add(shape);\n            shapeCount++;\n        }\n\n        layer.batch();\n    }\n\n    private NodeMouseClickHandler getTemplateClickHandler(final String templateName) {\n        return new NodeMouseClickHandler() {\n            @Override\n            public void onNodeMouseClick(final NodeMouseClickEvent event) {\n                bayesianEvent.fire(new BayesianTemplateSelectedEvent(templateName));\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/utils/BayesianUtils.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.client.utils;\n\nimport java.util.Map;\n\nimport com.ait.lienzo.shared.core.types.Color;\nimport com.google.common.collect.ImmutableMap;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesVariable;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class BayesianUtils {\n\n    // porcentual bar\n    public static final String DEFAULT_PORCENTUAL_FILL_COLOR = ShapesUtils.RGB_FILL_SHAPE;\n    public static final String DEFAULT_PORCENTUAL_BORDER_COLOR = ShapesUtils.RGB_STROKE_SHAPE;\n    public static final int HEIGHT_PORCENTUAL_BAR = 8;\n    public static final int FONT_SIZE_PORCENTUAL_BAR = 9;\n    public static final int POSITION_X_PORCENTUAL_BAR = 64;\n    // node\n    public static int WIDTH_NODE = 135;\n    public static final int WIDTH_PORCENTUAL_BAR = BayesianUtils.WIDTH_NODE - 75;\n    public static int HEIGHT_NODE = 83;\n    public static int HEIGHT_HEADER = 25;\n    // header node\n    public static int FONT_SIZE_HEADER_NODE = 10;\n    public static int LABEL_POSITION_X_DEFAULT = 8;\n    public static int LABEL_POSITION_Y_DEFAULT = 15;\n    public static int POSITION_X_BASE = 0;\n    public static int POSITION_Y_BASE = 25;\n\n    public static int SUBSTRATE_HEIGHT = 34;\n\n    public static String SUBSTRATE_COLOR = \"#666\";\n\n    public static String FONT_FAMILY_PROGRESS_BAR = \"Lucida Console\";\n    public static int FONT_SIZE_PROGRESS_BAR = 12;\n\n    public static String XML3_RESOURCE_PATH = \"xml03/\";\n\n    // label\n    public static String BG_COLOR_CONTAINER = Color.rgbToBrowserHexColor(236,\n                                                                         236,\n                                                                         236);\n    public static String BORDER_CONTAINER = Color.rgbToBrowserHexColor(236,\n                                                                       236,\n                                                                       236);\n    public static int POSITION_X_CONTAINER = 0;\n    public static int POSITION_Y_CONTAINER = -4;\n    public static int WIDTH_CONTAINER = 250;\n    public static int HEIGHT_CONTAINER = 23;\n    public static int FONT_SIZE_TEXT_LABEL = 9;\n    public static String COLOR_TEXT_LABEL = Color.rgbToBrowserHexColor(141,\n                                                                       147,\n                                                                       144);\n    public static int POSITION_X_TEXT_LABEL = 40;\n    public static int POSITION_Y_TEXT_LABEL = 0;\n    public static int WIDTH_TEXT_LABEL = 150;\n    public static int HEIGHT_TEXT_LABEL = 18;\n\n    private static ImmutableMap<Double, String[][]> nodeColors = ImmutableMap\n            .<Double, String[][]>builder()\n            .put(0.1,\n                 new String[][]{{Color.rgbToBrowserHexColor(102,\n                                                            183,\n                                                            176), Color.rgbToBrowserHexColor(197,\n                                                                                             216,\n                                                                                             214)}})\n            .put(0.2,\n                 new String[][]{{Color.rgbToBrowserHexColor(179,\n                                                            99,\n                                                            150), Color.rgbToBrowserHexColor(213,\n                                                                                             186,\n                                                                                             216)}})\n            .put(0.3,\n                 new String[][]{{Color.rgbToBrowserHexColor(120,\n                                                            101,\n                                                            186), Color.rgbToBrowserHexColor(210,\n                                                                                             204,\n                                                                                             229)}})\n            .put(0.4,\n                 new String[][]{{Color.rgbToBrowserHexColor(169,\n                                                            181,\n                                                            99), Color.rgbToBrowserHexColor(221,\n                                                                                            224,\n                                                                                            205)}})\n            .put(0.5,\n                 new String[][]{{Color.rgbToBrowserHexColor(89,\n                                                            177,\n                                                            140), Color.rgbToBrowserHexColor(182,\n                                                                                             199,\n                                                                                             191)}})\n            .put(0.6,\n                 new String[][]{{Color.rgbToBrowserHexColor(186,\n                                                            183,\n                                                            102), Color.rgbToBrowserHexColor(222,\n                                                                                             219,\n                                                                                             202)}})\n            .put(0.7,\n                 new String[][]{{Color.rgbToBrowserHexColor(191,\n                                                            102,\n                                                            104), Color.rgbToBrowserHexColor(230,\n                                                                                             210,\n                                                                                             211)}})\n            .put(0.8,\n                 new String[][]{{Color.rgbToBrowserHexColor(108,\n                                                            156,\n                                                            218), Color.rgbToBrowserHexColor(187,\n                                                                                             194,\n                                                                                             204)}})\n            .put(0.9,\n                 new String[][]{{Color.rgbToBrowserHexColor(108,\n                                                            156,\n                                                            218), Color.rgbToBrowserHexColor(187,\n                                                                                             194,\n                                                                                             204)}})\n            .put(1.0,\n                 new String[][]{{Color.rgbToBrowserHexColor(108,\n                                                            156,\n                                                            218), Color.rgbToBrowserHexColor(187,\n                                                                                             194,\n                                                                                             204)}})\n            .build();\n\n    public static String[][] getNodeColors() {\n        double rand = Math.random();\n        String colors[][] = new String[2][2];\n        for (Map.Entry<Double, String[][]> entry : nodeColors.entrySet()) {\n            if (rand < entry.getKey() && rand > (entry.getKey() - 0.1)) {\n                colors[0][0] = entry.getValue()[0][1];\n                colors[0][1] = entry.getValue()[0][0];\n            }\n        }\n        return colors;\n    }\n\n    public static double[][] orderListValues(BayesVariable node,\n                                             int outcomesSize) {\n        double[][] probabilities = node.getProbabilities();\n        double[][] valuesSorted = new double[probabilities.length][probabilities.length];\n        int middle = probabilities.length / outcomesSize;\n        int sizeFirstIncoming = node.getIncomingNodes().get(0).getOutcomes().size();\n        int secondPart = middle / sizeFirstIncoming;\n        int k = 0;\n        for (int i = 0; i < middle / 2; i++) {\n            for (int j = 0; j < outcomesSize; j++) {\n                orderValues(valuesSorted,\n                            secondPart,\n                            k,\n                            j,\n                            sizeFirstIncoming,\n                            probabilities);\n            }\n            k += sizeFirstIncoming;\n        }\n        return valuesSorted;\n    }\n\n    private static void orderValues(double[][] valuesSorted,\n                                    int secondPart,\n                                    int k,\n                                    int j,\n                                    int sizeFirstIncoming,\n                                    double[][] probabilities) {\n        for (int i = 0; i < sizeFirstIncoming; i++) {\n            valuesSorted[k + i][j] = probabilities[secondPart * i + i][j];\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/variables/BayesianVariablesScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.variables;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"BayesianVariablesScreen\")\npublic class BayesianVariablesScreen extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    public SimplePanel variables;\n    @UiField\n    PanelGroup accordion;\n\n    @UiField\n    PanelHeader headerVariables;\n\n    @UiField\n    PanelCollapse collapseVariables;\n    @Inject\n    private SyncBeanManager iocManager;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        accordion.setId(DOM.createUniqueId());\n        headerVariables.setDataParent(accordion.getId());\n        headerVariables.setDataTargetWidget(collapseVariables);\n\n        variables.add(iocManager.lookupBean(PorcentualsGroup.class).getInstance());\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Template variables\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    interface ViewBinder extends UiBinder<Widget, BayesianVariablesScreen> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/variables/BayesianVariablesScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <g:SimplePanel>\n    <b:PanelGroup ui:field=\"accordion\">\n      <b:Panel>\n        <b:PanelHeader dataToggle=\"COLLAPSE\" text=\"Variables\" ui:field=\"headerVariables\"/>\n        <b:PanelCollapse ui:field=\"collapseVariables\" in=\"true\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"variables\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n  </g:SimplePanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/java/org/uberfire/ext/wires/bayesian/network/client/variables/PorcentualsGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bayesian.network.client.variables;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.bayesian.network.client.factory.ProbabilityFactory;\nimport org.uberfire.ext.wires.bayesian.network.client.shapes.EditableBayesianNode;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\n\n@Dependent\npublic class PorcentualsGroup extends Composite {\n\n    private Layer layer;\n    private LienzoPanel panel;\n\n    @Inject\n    private ProbabilityFactory factory;\n\n    @PostConstruct\n    public void init() {\n        panel = new LienzoPanel(1200,\n                                600);\n        layer = new Layer();\n        panel.getScene().add(layer);\n        initWidget(panel);\n    }\n\n    public void onShapeSelectedEvent(@Observes ShapeSelectedEvent event) {\n        layer.removeAll();\n        if (event.getShape() instanceof EditableBayesianNode) {\n            final EditableBayesianNode node = (EditableBayesianNode) event.getShape();\n            layer.add(factory.init(node.getVariable()));\n        }\n        layer.batch();\n    }\n\n    public void clearPanel(@Observes ClearEvent event) {\n        layer.removeAll();\n        layer.batch();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.bayesian.network.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-network/uberfire-wires-bayesian-network-client/src/main/resources/org/uberfire/ext/wires/bayesian/network/BayesianNetworkClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreClient\"/>\n  <inherits name=\"org.uberfire.ext.wires.core.scratchpad.WiresCoreScratchPad\"/>\n\n  <source path=\"client\"></source>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-bayesian-parser</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Wires :: Bayesian Parser</name>\n\n  <modules>\n    <module>uberfire-wires-bayesian-parser-api</module>\n    <module>uberfire-wires-bayesian-parser-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-bayesian-parser</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-bayesian-parser-api</artifactId>\n\n  <name>Uberfire Wires :: Bayesian Parser API</name>\n  <description>Wires Bayesian Parser API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/builder/BayesianBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.builder;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesNetwork;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesVariable;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Bif;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Definition;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Network;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Variable;\n\npublic class BayesianBuilder {\n\n    public BayesNetwork build(Bif bif) {\n        BayesNetwork bayesNetwork = new BayesNetwork(bif.getNetwork().getName());\n        int id = 1;\n        for (Definition def : bif.getNetwork().getDefinitions()) {\n            BayesVariable nodo = buildVariable(def,\n                                               bif.getNetwork(),\n                                               id);\n            bayesNetwork.getNodos().add(nodo);\n            id += 1;\n        }\n        this.setIncomingNodes(bayesNetwork);\n\n        return bayesNetwork;\n    }\n\n    private BayesVariable buildVariable(Definition def,\n                                        Network network,\n                                        int id) {\n        List<String> outcomes = new ArrayList<String>();\n        double[][] position = new double[2][2];\n        this.getOutcomesByVariable(network,\n                                   def.getName(),\n                                   outcomes,\n                                   position);\n        return new BayesVariable(def.getName(),\n                                 id,\n                                 outcomes,\n                                 this.getProbabilities(def.getProbabilities(),\n                                                       outcomes),\n                                 def.getGiven(),\n                                 position);\n    }\n\n    private void getOutcomesByVariable(Network network,\n                                       String nameDefinition,\n                                       List<String> outcomes,\n                                       double[][] position) {\n        for (Variable var : network.getVariables()) {\n            if (var.getName().equals(nameDefinition)) {\n                for (String outcome : var.getOutComes()) {\n                    outcomes.add(outcome);\n                }\n                // get position\n                position = getPosition(var.getPosition(),\n                                       position);\n            }\n        }\n    }\n\n    private double[][] getProbabilities(String table,\n                                        List<String> outcomes) {\n        double probabilities[][] = new double[table.split(\" \").length][table.split(\" \").length];\n        String[] values = table.split(\" \");\n        int k = 0;\n        for (int i = 0; i < values.length / outcomes.size(); i++) {\n            for (int j = 0; j < outcomes.size(); j++) {\n                probabilities[i][j] = Double.valueOf(values[k]);\n                k += 1;\n            }\n        }\n        return probabilities;\n    }\n\n    private double[][] getPosition(String stringPosition,\n                                   double[][] position) {\n        if (stringPosition != null) {\n            stringPosition = this.clearStringPosticion(stringPosition);\n            int i = 0;\n            int j = 0;\n            for (String pos : stringPosition.split(\",\")) {\n                position[i][j] = Double.parseDouble(pos);\n                if (i < j) {\n                    i += 1;\n                }\n                j += 1;\n            }\n        }\n        return null;\n    }\n\n    private String clearStringPosticion(String stringPosition) {\n        stringPosition = stringPosition.replace(\"position\",\n                                                \"\");\n        stringPosition = stringPosition.replace(\"=\",\n                                                \"\");\n        stringPosition = stringPosition.replace(\"(\",\n                                                \"\");\n        stringPosition = stringPosition.replace(\")\",\n                                                \"\");\n        stringPosition = stringPosition.trim();\n        return stringPosition;\n    }\n\n    private void setIncomingNodes(BayesNetwork bayesNetwork) {\n        for (BayesVariable node : bayesNetwork.getNodos()) {\n            if (node.getGiven() != null && !node.getGiven().isEmpty()) {\n                node.setIncomingNodes(this.getNodesByGiven(node.getGiven(),\n                                                           bayesNetwork.getNodos()));\n            }\n        }\n    }\n\n    private List<BayesVariable> getNodesByGiven(List<String> given,\n                                                List<BayesVariable> nodes) {\n        List<BayesVariable> listIncoming = new ArrayList<BayesVariable>();\n        for (String giv : given) {\n            for (BayesVariable node : nodes) {\n                if (node.getName().equals(giv)) {\n                    listIncoming.add(node);\n                    break;\n                }\n            }\n        }\n        return listIncoming;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/model/BayesNetwork.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.model;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.google.common.collect.Lists;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class BayesNetwork implements Serializable {\n\n    private static final long serialVersionUID = 6231201134802600033L;\n\n    private String name;\n    private List<BayesVariable> nodos;\n\n    public BayesNetwork(@MapsTo(\"name\") String name) {\n        this.nodos = Lists.newArrayList();\n        this.name = name;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<BayesVariable> getNodos() {\n        return nodos;\n    }\n\n    public void setNodos(List<BayesVariable> nodos) {\n        this.nodos = nodos;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/model/BayesVariable.java",
    "content": "/*\r\n * Copyright 2015 JBoss, by Red Hat, Inc\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *       http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\npackage org.uberfire.ext.wires.bayesian.network.parser.client.model;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.List;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class BayesVariable implements Serializable {\r\n\r\n    private static final long serialVersionUID = -6018017577352463589L;\r\n    double[][] probabilities;\r\n    double[][] position;\r\n    private String name;\r\n    private int id;\r\n    private List<String> outcomes;\r\n    private String type;\r\n    private List<String> given;\r\n    private List<BayesVariable> incomingNodes;\r\n\r\n    public BayesVariable() {\r\n\r\n    }\r\n\r\n    public BayesVariable(String name,\r\n                         int id,\r\n                         List<String> outcomes,\r\n                         double[][] probabilities) {\r\n        this.name = name;\r\n        this.id = id;\r\n        this.probabilities = probabilities;\r\n        this.outcomes = outcomes;\r\n    }\r\n\r\n    public BayesVariable(String name,\r\n                         int id,\r\n                         List<String> outcomes,\r\n                         double[][] probabilities,\r\n                         List<String> given,\r\n                         double[][] position) {\r\n        this.name = name;\r\n        this.id = id;\r\n        this.probabilities = probabilities;\r\n        this.outcomes = outcomes;\r\n        this.given = given;\r\n        this.position = position;\r\n    }\r\n\r\n    public String getName() {\r\n        return name;\r\n    }\r\n\r\n    public void setName(String name) {\r\n        this.name = name;\r\n    }\r\n\r\n    public int getId() {\r\n        return id;\r\n    }\r\n\r\n    public void setId(int id) {\r\n        this.id = id;\r\n    }\r\n\r\n    public double[][] getProbabilities() {\r\n        return probabilities;\r\n    }\r\n\r\n    public void setProbabilities(double[][] probabilities) {\r\n        this.probabilities = probabilities;\r\n    }\r\n\r\n    public String getType() {\r\n        return type;\r\n    }\r\n\r\n    public void setType(String type) {\r\n        this.type = type;\r\n    }\r\n\r\n    public double[][] getPosition() {\r\n        return position;\r\n    }\r\n\r\n    public void setPosition(double[][] position) {\r\n        this.position = position;\r\n    }\r\n\r\n    public List<String> getOutcomes() {\r\n        return outcomes;\r\n    }\r\n\r\n    public void setOutcomes(List<String> outcomes) {\r\n        this.outcomes = outcomes;\r\n    }\r\n\r\n    public List<String> getGiven() {\r\n        return given;\r\n    }\r\n\r\n    public void setGiven(List<String> given) {\r\n        this.given = given;\r\n    }\r\n\r\n    public List<BayesVariable> getIncomingNodes() {\r\n        return incomingNodes;\r\n    }\r\n\r\n    public void setIncomingNodes(List<BayesVariable> incomingNodes) {\r\n        this.incomingNodes = incomingNodes;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/Bif.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@XStreamAlias(\"BIF\")\n@Portable\npublic class Bif implements Serializable {\n\n    private static final long serialVersionUID = -4817544750207015779L;\n\n    @XStreamAlias(\"NETWORK\")\n    private Network network;\n\n    public Network getNetwork() {\n        return network;\n    }\n\n    public void setNetwork(Network network) {\n        this.network = network;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/Definition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@XStreamAlias(\"DEFINITION\")\n@Portable\npublic class Definition implements Serializable {\n\n    private static final long serialVersionUID = -4549156706417732124L;\n\n    @XStreamAlias(\"FOR\")\n    private String name;\n\n    @XStreamImplicit(itemFieldName = \"GIVEN\")\n    private List<String> given;\n\n    @XStreamAlias(\"TABLE\")\n    private String probabilities;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<String> getGiven() {\n        return given;\n    }\n\n    public void setGiven(List<String> given) {\n        this.given = given;\n    }\n\n    public String getProbabilities() {\n        return probabilities;\n    }\n\n    public void setProbabilities(String probabilities) {\n        this.probabilities = probabilities;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/Network.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@XStreamAlias(\"NETWORK\")\n@Portable\npublic class Network extends NetworkXml implements Serializable {\n\n    private static final long serialVersionUID = 8613096385540596843L;\n\n    @XStreamAlias(\"NAME\")\n    private String name;\n\n    @XStreamImplicit(itemFieldName = \"VARIABLE\")\n    private List<Variable> variables;\n\n    @XStreamImplicit(itemFieldName = \"DEFINITION\")\n    private List<Definition> definitions;\n\n    public List<Variable> getVariables() {\n        return variables;\n    }\n\n    public void setVariables(List<Variable> variables) {\n        this.variables = variables;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<Definition> getDefinitions() {\n        return definitions;\n    }\n\n    public void setDefinitions(List<Definition> definitions) {\n        this.definitions = definitions;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/NetworkXml.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NetworkXml implements Serializable {\n\n    private static final long serialVersionUID = -3348355473054506395L;\n\n    @XStreamImplicit(itemFieldName = \"PROBABILITY\")\n    private List<Probability> probabilities;\n\n    public List<Probability> getProbabilities() {\n        return probabilities;\n    }\n\n    public void setProbabilities(List<Probability> probabilities) {\n        this.probabilities = probabilities;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/Probability.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@XStreamAlias(\"PROBABILITY\")\n@Portable\npublic class Probability implements Serializable {\n\n    private static final long serialVersionUID = 329348179543890266L;\n\n    @XStreamAlias(\"FOR\")\n    private String for_;\n\n    @XStreamImplicit(itemFieldName = \"GIVEN\")\n    private List<String> given;\n\n    @XStreamAlias(\"TABLE\")\n    private String table;\n\n    public String getFor_() {\n        return for_;\n    }\n\n    public void setFor_(String for_) {\n        this.for_ = for_;\n    }\n\n    public List<String> getGiven() {\n        return given;\n    }\n\n    public void setGiven(List<String> given) {\n        this.given = given;\n    }\n\n    public String getTable() {\n        return table;\n    }\n\n    public void setTable(String table) {\n        this.table = table;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/Variable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@XStreamAlias(\"VARIABLE\")\n@Portable\npublic class Variable extends VariableXml implements Serializable {\n\n    private static final long serialVersionUID = -4272919361549757485L;\n\n    @XStreamAlias(\"NAME\")\n    private String name;\n\n    @XStreamImplicit(itemFieldName = \"OUTCOME\")\n    private List<String> outComes;\n\n    @XStreamAlias(\"PROPERTY\")\n    private String position;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<String> getOutComes() {\n        return outComes;\n    }\n\n    public void setOutComes(List<String> outComes) {\n        this.outComes = outComes;\n    }\n\n    public String getPosition() {\n        return position;\n    }\n\n    public void setPosition(String position) {\n        this.position = position;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/parser/VariableXml.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.parser;\n\nimport java.io.Serializable;\nimport java.util.List;\n\nimport com.thoughtworks.xstream.annotations.XStreamAlias;\nimport com.thoughtworks.xstream.annotations.XStreamImplicit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class VariableXml implements Serializable {\n\n    private static final long serialVersionUID = 6209765372130565034L;\n\n    @XStreamImplicit(itemFieldName = \"VALUE\")\n    private List<String> value;\n\n    @XStreamAlias(\"TYPE\")\n    private String type;\n\n    public List<String> getValue() {\n        return value;\n    }\n\n    public void setValue(List<String> value) {\n        this.value = value;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/client/service/BayesianService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.client.service;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesNetwork;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Bif;\n\n@Remote\npublic interface BayesianService {\n\n    BayesNetwork buildXml03(String relativePathtoXmlResource);\n\n    Bif xmlToObject(String relativePathtoXmlResource);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-api/src/main/resources/org/uberfire/ext/wires/bayesian/network/parser/BayesianNetworkAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n\n  <source path=\"client\"/>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-backend/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-bayesian-parser</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-bayesian-parser-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Wires :: Bayesian Parser Backend</name>\n  <description>Wires Bayesian Parser Backend</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-bayesian-parser-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-backend/src/main/java/org/uberfire/ext/wires/bayesian/network/parser/backend/BayesianServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bayesian.network.parser.backend;\n\nimport java.io.InputStream;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.kie.soup.xstream.XStreamUtils;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.builder.BayesianBuilder;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.model.BayesNetwork;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Bif;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Definition;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Network;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.parser.Probability;\nimport org.uberfire.ext.wires.bayesian.network.parser.client.service.BayesianService;\n\n@Service\n@ApplicationScoped\npublic class BayesianServiceImpl implements BayesianService {\n\n    @Override\n    public BayesNetwork buildXml03(String relativePathtoXmlResource) {\n        return new BayesianBuilder().build(xmlToObject(relativePathtoXmlResource));\n    }\n\n    @Override\n    public Bif xmlToObject(String relativePathtoXmlResource) {\n        InputStream resourceAsStream = loadResource(relativePathtoXmlResource);\n        return processXML(resourceAsStream);\n    }\n\n    private Bif processXML(InputStream resourceAsStream) {\n        XStream xstream = XStreamUtils.createTrustingXStream();\n        xstream.processAnnotations(Bif.class);\n        xstream.processAnnotations(Network.class);\n        xstream.processAnnotations(Probability.class);\n        xstream.processAnnotations(Definition.class);\n        return (Bif) xstream.fromXML(resourceAsStream);\n    }\n\n    private InputStream loadResource(String xmlFileName) {\n        ClassLoader loader = Thread.currentThread().getContextClassLoader();\n        return loader.getResourceAsStream(xmlFileName);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bayesian-parser/uberfire-wires-bayesian-parser-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-wires</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-bpmn</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Wires :: BPMN</name>\n\n  <modules>\n    <module>uberfire-wires-bpmn-api</module>\n    <module>uberfire-wires-bpmn-backend</module>\n    <module>uberfire-wires-bpmn-client</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-wires-bpmn</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-bpmn-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Wires :: BPMN API</name>\n  <description>Wires BPMN API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/category/Process.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.ext.wires.bpmn.api.category;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Process extends Category {\n\n    private static final String CATEGORY_NAME = \"PROCESS\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/BpmnEdge.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Edge;\n\n/**\n * An Edge in a BPMN diagram\n */\npublic interface BpmnEdge extends Copyable<BpmnEdge>,\n                                  Edge<BpmnGraphNode> {\n\n    /**\n     * The Role for the Edge.\n     * @return\n     */\n    Role getRole();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/BpmnGraph.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Graph;\n\n/**\n * A Graph in a BPMN diagram\n */\npublic interface BpmnGraph extends Graph<Content, BpmnGraphNode> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/BpmnGraphNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\n/**\n * A GraphNode in a BPMN diagram\n */\npublic interface BpmnGraphNode extends Copyable<BpmnGraphNode>,\n                                       GraphNode<Content, BpmnEdge> {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/Content.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\nimport java.util.Set;\n\n/**\n * Base content for all Nodes in the graph.\n */\npublic interface Content extends Copyable<Content> {\n\n    String getId();\n\n    String getTitle();\n\n    String getDescription();\n\n    Set<Role> getRoles();\n\n    Set<Property> getProperties();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/Copyable.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\n/**\n * Implementations can provide a copy of themselves.\n */\npublic interface Copyable<T> {\n\n    T copy();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/Property.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\n/**\n * A Property of an Element\n */\npublic interface Property extends Copyable<Property> {\n\n    String getId();\n\n    Type getType();\n\n    String getCaption();\n\n    String getDescription();\n\n    boolean isReadOnly();\n\n    boolean isOptional();\n\n    /**\n     * Type of Property\n     */\n    public static interface Type {\n\n        String getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/Role.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model;\n\n/**\n * The Role of an Element. Roles are used to associate behaviour to Elements in a diagram.\n */\npublic interface Role extends Copyable<Role> {\n\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/BpmnEditorContent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\n\n@Portable\npublic class BpmnEditorContent {\n\n    private ProcessNode process;\n\n    public BpmnEditorContent(@MapsTo(\"process\") final ProcessNode process) {\n        this.process = PortablePreconditions.checkNotNull(\"process\",\n                                                          process);\n    }\n\n    public ProcessNode getProcess() {\n        return this.process;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/content/DefaultContentImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.content;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\n/**\n * Content of a Bpmn GraphNode\n */\n@Portable\npublic class DefaultContentImpl implements Content {\n\n    private String id;\n    private String title;\n    private String description;\n    private Set<Role> roles;\n    private Set<Property> properties;\n\n    public DefaultContentImpl(@MapsTo(\"id\") final String id,\n                              @MapsTo(\"title\") final String title,\n                              @MapsTo(\"description\") final String description,\n                              @MapsTo(\"roles\") final Set<Role> roles,\n                              @MapsTo(\"properties\") final Set<Property> properties) {\n        this.id = PortablePreconditions.checkNotNull(\"id\",\n                                                     id);\n        this.title = PortablePreconditions.checkNotNull(\"title\",\n                                                        title);\n        this.description = PortablePreconditions.checkNotNull(\"description\",\n                                                              description);\n        this.roles = PortablePreconditions.checkNotNull(\"roles\",\n                                                        roles);\n        this.properties = PortablePreconditions.checkNotNull(\"properties\",\n                                                             properties);\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public String getTitle() {\n        return title;\n    }\n\n    @Override\n    public String getDescription() {\n        return description;\n    }\n\n    @Override\n    public Set<Role> getRoles() {\n        return roles;\n    }\n\n    @Override\n    public Set<Property> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public Content copy() {\n        final Content copy = new DefaultContentImpl(this.id,\n                                                    this.title,\n                                                    this.description,\n                                                    copyRoles(this.roles),\n                                                    copyProperties(this.properties));\n        return copy;\n    }\n\n    private Set<Role> copyRoles(final Set<Role> roles) {\n        final Set<Role> copy = new HashSet<Role>();\n        for (Role role : roles) {\n            copy.add(role.copy());\n        }\n        return copy;\n    }\n\n    private Set<Property> copyProperties(final Set<Property> properties) {\n        final Set<Property> copy = new HashSet<Property>();\n        for (Property property : properties) {\n            copy.add(property.copy());\n        }\n        return copy;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultContentImpl)) {\n            return false;\n        }\n\n        DefaultContentImpl that = (DefaultContentImpl) o;\n\n        if (!description.equals(that.description)) {\n            return false;\n        }\n        if (!id.equals(that.id)) {\n            return false;\n        }\n        if (!properties.equals(that.properties)) {\n            return false;\n        }\n        if (!roles.equals(that.roles)) {\n            return false;\n        }\n        if (!title.equals(that.title)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id.hashCode();\n        result = ~~result;\n        result = 31 * result + title.hashCode();\n        result = ~~result;\n        result = 31 * result + description.hashCode();\n        result = ~~result;\n        result = 31 * result + roles.hashCode();\n        result = ~~result;\n        result = 31 * result + properties.hashCode();\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultContentImpl{\" +\n                \"id='\" + id + '\\'' +\n                \", title='\" + title + '\\'' +\n                \", description='\" + description + '\\'' +\n                \", roles=\" + roles +\n                \", properties=\" + properties +\n                '}';\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/edges/BpmnEdgeImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.edges;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.EdgeImpl;\n\n/**\n * A BPMN Edge\n */\n@Portable\npublic class BpmnEdgeImpl extends EdgeImpl<BpmnGraphNode> implements BpmnEdge {\n\n    private Role role;\n\n    public BpmnEdgeImpl(@MapsTo(\"role\") final Role role) {\n        this.role = PortablePreconditions.checkNotNull(\"role\",\n                                                       role);\n    }\n\n    @Override\n    public Role getRole() {\n        return role;\n    }\n\n    @Override\n    public BpmnEdge copy() {\n        return new BpmnEdgeImpl(this.getRole());\n    }\n\n    @Override\n    public String toString() {\n        return \"BpmnEdgeImpl{\" +\n                \"role=\" + role +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/nodes/EndProcessNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.nodes;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.content.DefaultContentImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.GraphNodeImpl;\n\n/**\n * A BPMN \"End Node\"\n */\n@Portable\npublic class EndProcessNode extends GraphNodeImpl<Content, BpmnEdge> implements BpmnGraphNode {\n\n    private Set<Role> roles = new HashSet<Role>() {{\n        add(new DefaultRoleImpl(\"all\"));\n        add(new DefaultRoleImpl(\"Endevents_all\"));\n        add(new DefaultRoleImpl(\"sequence_end\"));\n        add(new DefaultRoleImpl(\"to_task_event\"));\n        add(new DefaultRoleImpl(\"from_task_event\"));\n        add(new DefaultRoleImpl(\"fromtoall\"));\n        add(new DefaultRoleImpl(\"EndEventsMorph\"));\n    }};\n\n    private Set<Property> properties = new HashSet<Property>();\n\n    public EndProcessNode() {\n        setContent(new DefaultContentImpl(\"EndNoneEvent\",\n                                          \"EndNoneEvent\",\n                                          \"The untyped end event typically marks the standard end of a process.\",\n                                          roles,\n                                          properties));\n    }\n\n    @Override\n    public EndProcessNode copy() {\n        final EndProcessNode copy = new EndProcessNode();\n        copy.setContent(this.getContent().copy());\n        return copy;\n    }\n\n    @Override\n    public String toString() {\n        return \"EndProcessNode{\" +\n                \"roles=\" + roles +\n                \", properties=\" + properties +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/nodes/ProcessNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.nodes;\n\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.content.DefaultContentImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.properties.DefaultPropertyImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.types.StringType;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Graph;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.GraphImpl;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.GraphNodeImpl;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.MapGraphStore;\n\n/**\n * A BPMN \"Process\"\n */\n@Portable\npublic class ProcessNode extends GraphNodeImpl<Content, BpmnEdge> implements\n                                                                  BpmnGraph,\n                                                                  BpmnGraphNode {\n\n    private Graph<Content, BpmnGraphNode> graph = new GraphImpl<Content, BpmnGraphNode>(new MapGraphStore<BpmnGraphNode>());\n\n    private Set<Role> roles = new HashSet<Role>() {{\n        add(new DefaultRoleImpl(\"canContainArtifacts\"));\n    }};\n\n    private Set<Property> properties = new HashSet<Property>() {{\n        add(new DefaultPropertyImpl(\"processn\",\n                                    new StringType(),\n                                    \"Process Name\",\n                                    \"Process Name\",\n                                    false,\n                                    false));\n        add(new DefaultPropertyImpl(\"documentation\",\n                                    new StringType(),\n                                    \"Documentation\",\n                                    \"This attribute is used to annotate the BPMN element, such as descriptions and other documentation.\",\n                                    false,\n                                    true));\n    }};\n\n    public ProcessNode() {\n        setContent(new DefaultContentImpl(\"BPMNProcess\",\n                                          \"BPMN-Process\",\n                                          \"A BPMN 2.0 Process.\",\n                                          roles,\n                                          properties));\n    }\n\n    @Override\n    public BpmnGraphNode addNode(final BpmnGraphNode node) {\n        return graph.addNode(node);\n    }\n\n    @Override\n    public BpmnGraphNode removeNode(final int id) {\n        return graph.removeNode(id);\n    }\n\n    @Override\n    public BpmnGraphNode getNode(final int id) {\n        return graph.getNode(id);\n    }\n\n    @Override\n    public int size() {\n        return graph.size();\n    }\n\n    @Override\n    public Iterator<BpmnGraphNode> iterator() {\n        return graph.iterator();\n    }\n\n    @Override\n    public ProcessNode copy() {\n        final ProcessNode copy = new ProcessNode();\n        copy.setContent(this.getContent().copy());\n        for (BpmnGraphNode node : graph) {\n            copy.addNode(node.copy());\n        }\n        return copy;\n    }\n\n    @Override\n    public String toString() {\n        return \"ProcessNode{\" +\n                \"graph=\" + graph +\n                \", roles=\" + roles +\n                \", properties=\" + properties +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/nodes/StartProcessNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.nodes;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.content.DefaultContentImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.GraphNodeImpl;\n\n/**\n * A BPMN \"Start Node\"\n */\n@Portable\npublic class StartProcessNode extends GraphNodeImpl<Content, BpmnEdge> implements BpmnGraphNode {\n\n    private Set<Role> roles = new HashSet<Role>() {{\n        add(new DefaultRoleImpl(\"all\"));\n        add(new DefaultRoleImpl(\"Startevents_all\"));\n        add(new DefaultRoleImpl(\"sequence_start\"));\n        add(new DefaultRoleImpl(\"to_task_event\"));\n        add(new DefaultRoleImpl(\"from_task_event\"));\n        add(new DefaultRoleImpl(\"fromtoall\"));\n        add(new DefaultRoleImpl(\"StartEventsMorph\"));\n    }};\n\n    private Set<Property> properties = new HashSet<Property>();\n\n    public StartProcessNode() {\n        setContent(new DefaultContentImpl(\"StartNoneEvent\",\n                                          \"StartNoneEvent\",\n                                          \"Untyped start event.\",\n                                          roles,\n                                          properties));\n    }\n\n    @Override\n    public StartProcessNode copy() {\n        final StartProcessNode copy = new StartProcessNode();\n        copy.setContent(this.getContent().copy());\n        return copy;\n    }\n\n    @Override\n    public String toString() {\n        return \"StartProcessNode{\" +\n                \"roles=\" + roles +\n                \", properties=\" + properties +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/properties/DefaultPropertyImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.properties;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\n\n@Portable\npublic class DefaultPropertyImpl implements Property {\n\n    private String id;\n    private Type type;\n    private String caption;\n    private String description;\n    private boolean isReadOnly;\n    private boolean isOptional;\n\n    public DefaultPropertyImpl(@MapsTo(\"id\") final String id,\n                               @MapsTo(\"type\") final Type type,\n                               @MapsTo(\"caption\") final String caption,\n                               @MapsTo(\"description\") final String description,\n                               @MapsTo(\"isReadOnly\") final boolean isReadOnly,\n                               @MapsTo(\"isOptional\") final boolean isOptional) {\n        this.id = PortablePreconditions.checkNotNull(\"id\",\n                                                     id);\n        this.type = PortablePreconditions.checkNotNull(\"type\",\n                                                       type);\n        this.caption = PortablePreconditions.checkNotNull(\"caption\",\n                                                          caption);\n        this.description = PortablePreconditions.checkNotNull(\"description\",\n                                                              description);\n        this.isReadOnly = isReadOnly;\n        this.isOptional = isOptional;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public Type getType() {\n        return type;\n    }\n\n    @Override\n    public String getCaption() {\n        return caption;\n    }\n\n    @Override\n    public String getDescription() {\n        return description;\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return isReadOnly;\n    }\n\n    @Override\n    public boolean isOptional() {\n        return isOptional;\n    }\n\n    @Override\n    public Property copy() {\n        return new DefaultPropertyImpl(this.id,\n                                       this.type,\n                                       this.caption,\n                                       this.description,\n                                       this.isReadOnly,\n                                       this.isOptional);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultPropertyImpl)) {\n            return false;\n        }\n\n        DefaultPropertyImpl that = (DefaultPropertyImpl) o;\n\n        if (isOptional != that.isOptional) {\n            return false;\n        }\n        if (isReadOnly != that.isReadOnly) {\n            return false;\n        }\n        if (!caption.equals(that.caption)) {\n            return false;\n        }\n        if (!description.equals(that.description)) {\n            return false;\n        }\n        if (!id.equals(that.id)) {\n            return false;\n        }\n        if (!type.equals(that.type)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id.hashCode();\n        result = ~~result;\n        result = 31 * result + type.hashCode();\n        result = ~~result;\n        result = 31 * result + caption.hashCode();\n        result = ~~result;\n        result = 31 * result + description.hashCode();\n        result = ~~result;\n        result = 31 * result + (isReadOnly ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (isOptional ? 1 : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultPropertyImpl{\" +\n                \"id='\" + id + '\\'' +\n                \", type=\" + type +\n                \", caption='\" + caption + '\\'' +\n                \", description='\" + description + '\\'' +\n                \", isReadOnly=\" + isReadOnly +\n                \", isOptional=\" + isOptional +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/roles/DefaultRoleImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.roles;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\n@Portable\npublic class DefaultRoleImpl implements Role {\n\n    private String name;\n\n    public DefaultRoleImpl(@MapsTo(\"name\") final String name) {\n        this.name = PortablePreconditions.checkNotNull(\"name\",\n                                                       name);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public Role copy() {\n        return new DefaultRoleImpl(this.name);\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultRoleImpl)) {\n            return false;\n        }\n\n        DefaultRoleImpl that = (DefaultRoleImpl) o;\n\n        if (!name.equals(that.name)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return name.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultRoleImpl{\" +\n                \"name='\" + name + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/rules/CardinalityRuleImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.rules;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.CardinalityRule;\n\n@Portable\npublic class CardinalityRuleImpl implements CardinalityRule {\n\n    private String name;\n    private Role role;\n    private long minOccurrences = 0;\n    private long maxOccurrences = 0;\n    private Set<ConnectorRule> incomingConnectionRules = new HashSet<ConnectorRule>();\n    private Set<ConnectorRule> outgoingConnectionRules = new HashSet<ConnectorRule>();\n\n    public CardinalityRuleImpl(@MapsTo(\"name\") final String name,\n                               @MapsTo(\"role\") Role role,\n                               @MapsTo(\"minOccurrences\") long minOccurrences,\n                               @MapsTo(\"maxOccurrences\") long maxOccurrences,\n                               @MapsTo(\"incomingConnectionRules\") Set<ConnectorRule> incomingConnectionRules,\n                               @MapsTo(\"outgoingConnectionRules\") Set<ConnectorRule> outgoingConnectionRules) {\n        this.name = PortablePreconditions.checkNotNull(\"name\",\n                                                       name);\n        this.role = PortablePreconditions.checkNotNull(\"role\",\n                                                       role);\n        if (minOccurrences < 0) {\n            throw new IllegalArgumentException(\"minOccurrences cannot be less than 0.\");\n        }\n        this.minOccurrences = minOccurrences;\n        if (maxOccurrences < minOccurrences) {\n            throw new IllegalArgumentException(\"maxOccurrences cannot be less than minOccurrences.\");\n        }\n        this.maxOccurrences = maxOccurrences;\n        for (ConnectorRule cr : incomingConnectionRules) {\n            final long crMinOccurrences = cr.getMinOccurrences();\n            final long crMaxOccurrences = cr.getMaxOccurrences();\n            if (crMinOccurrences < 0) {\n                throw new IllegalArgumentException(\"Incoming ConnectorRule minOccurrences cannot be less than 0.\");\n            }\n            if (crMaxOccurrences < crMinOccurrences) {\n                throw new IllegalArgumentException(\"Incoming ConnectorRule maxOccurrences cannot be less than minOccurrences.\");\n            }\n        }\n        this.incomingConnectionRules = PortablePreconditions.checkNotNull(\"incomingConnectionRules\",\n                                                                          incomingConnectionRules);\n        for (ConnectorRule cr : outgoingConnectionRules) {\n            final long crMinOccurrences = cr.getMinOccurrences();\n            final long crMaxOccurrences = cr.getMaxOccurrences();\n            if (crMinOccurrences < 0) {\n                throw new IllegalArgumentException(\"Outgoing ConnectorRule minOccurrences cannot be less than 0.\");\n            }\n            if (crMaxOccurrences < crMinOccurrences) {\n                throw new IllegalArgumentException(\"Outgoing ConnectorRule maxOccurrences cannot be less than minOccurrences.\");\n            }\n        }\n        this.outgoingConnectionRules = PortablePreconditions.checkNotNull(\"outgoingConnectionRules\",\n                                                                          outgoingConnectionRules);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public Role getRole() {\n        return role;\n    }\n\n    @Override\n    public long getMinOccurrences() {\n        return minOccurrences;\n    }\n\n    @Override\n    public long getMaxOccurrences() {\n        return maxOccurrences;\n    }\n\n    @Override\n    public Set<ConnectorRule> getIncomingConnectionRules() {\n        return incomingConnectionRules;\n    }\n\n    @Override\n    public Set<ConnectorRule> getOutgoingConnectionRules() {\n        return outgoingConnectionRules;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/rules/ConnectionRuleImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.rules;\n\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.ConnectionRule;\n\n@Portable\npublic class ConnectionRuleImpl implements ConnectionRule {\n\n    private String name;\n    private Role role;\n    private Set<PermittedConnection> permittedRoles;\n\n    public ConnectionRuleImpl(@MapsTo(\"name\") final String name,\n                              @MapsTo(\"role\") final Role role,\n                              @MapsTo(\"permittedRoles\") final Set<PermittedConnection> permittedRoles) {\n        this.name = PortablePreconditions.checkNotNull(\"name\",\n                                                       name);\n        this.role = PortablePreconditions.checkNotNull(\"role\",\n                                                       role);\n        this.permittedRoles = PortablePreconditions.checkNotNull(\"permittedRoles\",\n                                                                 permittedRoles);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public Role getRole() {\n        return role;\n    }\n\n    @Override\n    public Set<PermittedConnection> getPermittedConnections() {\n        return permittedRoles;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/rules/ContainmentRuleImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.rules;\n\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.ContainmentRule;\n\n@Portable\npublic class ContainmentRuleImpl implements ContainmentRule {\n\n    private String name;\n    private String id;\n    private Set<Role> permittedRoles;\n\n    public ContainmentRuleImpl(@MapsTo(\"name\") final String name,\n                               @MapsTo(\"id\") final String id,\n                               @MapsTo(\"permittedRoles\") final Set<Role> permittedRoles) {\n        this.name = PortablePreconditions.checkNotNull(\"name\",\n                                                       name);\n        this.id = PortablePreconditions.checkNotNull(\"id\",\n                                                     id);\n        this.permittedRoles = PortablePreconditions.checkNotNull(\"permittedRoles\",\n                                                                 permittedRoles);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public Set<Role> getPermittedRoles() {\n        return permittedRoles;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/impl/types/StringType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.types;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\n\n@Portable\npublic class StringType implements Property.Type {\n\n    private static final String name = \"java.lang.String\";\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof StringType)) {\n            return false;\n        }\n\n        StringType that = (StringType) o;\n\n        if (!name.equals(that.name)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return name.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return \"StringType{\" +\n                \"name='\" + name + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/CardinalityRule.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\nimport java.util.Set;\n\n/**\n * Rule to restrict the cardinality of Elements in a diagram.\n */\npublic interface CardinalityRule extends RuleByRole {\n\n    /**\n     * The minimum number of occurrences that an Element can have in a diagram.\n     * @return\n     */\n    long getMinOccurrences();\n\n    /**\n     * The maximum number of occurrences that an Element can have in a diagram.\n     * @return\n     */\n    long getMaxOccurrences();\n\n    /**\n     * Restrictions on the incoming connections to an Element\n     * @return\n     */\n    Set<ConnectorRule> getIncomingConnectionRules();\n\n    /**\n     * Restrictions on the outgoing connections from an Element\n     * @return\n     */\n    Set<ConnectorRule> getOutgoingConnectionRules();\n\n    /**\n     * Rule to restrict the cardinality of Connections. The direction of the Connection is defined in CardinalityRule.\n     */\n    public static interface ConnectorRule extends RuleByRole {\n\n        /**\n         * The minimum number of connections an Element can have.\n         * @return\n         */\n        long getMinOccurrences();\n\n        /**\n         * The maximum number of connections an Element can have.\n         * @return\n         */\n        long getMaxOccurrences();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/ConnectionRule.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\nimport java.util.Set;\n\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\n/**\n * Rule to restrict how Elements can be connected. Connections can be restricted to Elements with certain Roles.\n */\npublic interface ConnectionRule extends RuleByRole {\n\n    /**\n     * The Connections that are permitted by the Rule. The source and target of the connection must have the Role defined in the PermittedConnection\n     * @return\n     */\n    Set<PermittedConnection> getPermittedConnections();\n\n    /**\n     * Permitted connections\n     */\n    public static interface PermittedConnection {\n\n        /**\n         * Role of the start Element that can accept this Connection\n         * @return\n         */\n        Role getStartRole();\n\n        /**\n         * Role of then end Element that can accept this Connection\n         * @return\n         */\n        Role getEndRole();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/ContainmentRule.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\nimport java.util.Set;\n\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\n/**\n * Rule restricting the Elements that can be contained within another Element.\n */\npublic interface ContainmentRule extends RuleById {\n\n    /**\n     * The Roles of Elements permitted to be held within another Element.\n     * @return\n     */\n    Set<Role> getPermittedRoles();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/Rule.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\n/**\n * Rules define restrictions on behaviour of Elements in a diagram\n */\npublic interface Rule {\n\n    /**\n     * A name for the rule.\n     * @return\n     *//**/\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/RuleById.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\n/**\n * Rules define restrictions on behaviour of Elements in a diagram\n */\npublic interface RuleById extends Rule {\n\n    /**\n     * The identifier for which the Rule applies. All Elements with this Id will be affected by the Rule.\n     * @return\n     */\n    String getId();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/model/rules/RuleByRole.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.rules;\n\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\n/**\n * Rules define restrictions on behaviour of Elements in a diagram\n */\npublic interface RuleByRole extends Rule {\n\n    /**\n     * The Role for which the Rule applies. All Elements with this Role will be affected by the Rule.\n     * @return\n     */\n    Role getRole();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/service/BpmnService.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.service;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCopy;\nimport org.uberfire.ext.editor.commons.service.support.SupportsCreate;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRead;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRename;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.editor.commons.service.support.SupportsUpdate;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.BpmnEditorContent;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.service.todo.Metadata;\n\n@Remote\npublic interface BpmnService extends SupportsCreate<ProcessNode>,\n                                     SupportsRead<ProcessNode>,\n                                     SupportsUpdate<ProcessNode, Metadata>,\n                                     SupportsSaveAndRename<ProcessNode, Metadata>,\n                                     SupportsDelete,\n                                     SupportsCopy,\n                                     SupportsRename {\n\n    List<Path> listFiles();\n\n    BpmnEditorContent loadContent(final Path path);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/service/todo/Metadata.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.service.todo;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * When Bpmn moves to KIE-WB this class can be removed and we can use Guvnor's Metadata class.\n */\n@Portable\npublic class Metadata {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/api/type/BpmnResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.type;\n\nimport javax.enterprise.inject.Default;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.wires.bpmn.api.category.Process;\nimport org.uberfire.workbench.annotations.VisibleAsset;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n@Default\n@VisibleAsset\npublic class BpmnResourceTypeDefinition implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public BpmnResourceTypeDefinition() {\n\n    }\n\n    public BpmnResourceTypeDefinition(final Process category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"bpmn\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"BPMN definition\";\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"bpmn\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 101;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.\" + getSuffix();\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\".\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/Edge.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph;\n\npublic interface Edge<T extends GraphNode> {\n\n    public T getOutGraphNode();\n\n    public T getInGraphNode();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/Graph.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph;\n\npublic interface Graph<C, T extends GraphNode> extends Iterable<T> {\n\n    public T addNode(T node);\n\n    public T removeNode(int id);\n\n    public T getNode(int id);\n\n    public C getContent();\n\n    public void setContent(C content);\n\n    public int size();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/GraphNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph;\n\nimport java.util.List;\n\npublic interface GraphNode<C, T extends Edge> {\n\n    public int getId();\n\n    public void setId(int id);\n\n    public List<T> getInEdges();\n\n    public List<T> getOutEdges();\n\n    public C getContent();\n\n    public void setContent(C content);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/EdgeImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Edge;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\npublic class EdgeImpl<T extends GraphNode> implements Edge<T> {\n\n    private T inGraphNode;\n\n    private T outGraphNode;\n\n    @Override\n    public T getInGraphNode() {\n        return inGraphNode;\n    }\n\n    @Override\n    public T getOutGraphNode() {\n        return outGraphNode;\n    }\n\n    @Override\n    public String toString() {\n        return \"EdgeImpl{\" +\n                \"inGraphNode=\" + inGraphNode +\n                \", outGraphNode=\" + outGraphNode +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/GraphImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport java.util.Iterator;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Graph;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\n@Portable\npublic class GraphImpl<C, T extends GraphNode> implements Graph<C, T>,\n                                                          Iterable<T> {\n\n    private GraphStore<T> graphStore;\n    private C content;\n\n    public GraphImpl(@MapsTo(\"graphStore\") GraphStore<T> graphStore) {\n        this.graphStore = graphStore;\n    }\n\n    @Override\n    public T addNode(T node) {\n        return graphStore.addNode(node);\n    }\n\n    public T removeNode(int id) {\n        return graphStore.removeNode(id);\n    }\n\n    @Override\n    public T getNode(int id) {\n        return graphStore.getNode(id);\n    }\n\n    @Override\n    public C getContent() {\n        return content;\n    }\n\n    @Override\n    public void setContent(C content) {\n        this.content = content;\n    }\n\n    @Override\n    public int size() {\n        return graphStore.size();\n    }\n\n    @Override\n    public Iterator<T> iterator() {\n        return graphStore.iterator();\n    }\n\n    @Override\n    public String toString() {\n        return \"GraphImpl{\" +\n                \"graphStore=\" + graphStore +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/GraphNodeImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.Edge;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\n@Portable\npublic class GraphNodeImpl<C, T extends Edge> implements GraphNode<C, T> {\n\n    private int id;\n    private C content;\n\n    private List<T> inEdges = new ArrayList<T>();\n    private List<T> outEdges = new ArrayList<T>();\n\n    @Override\n    public C getContent() {\n        return content;\n    }\n\n    @Override\n    public void setContent(C content) {\n        this.content = content;\n    }\n\n    @Override\n    public int getId() {\n        return this.id;\n    }\n\n    @Override\n    public void setId(int id) {\n        this.id = id;\n    }\n\n    @Override\n    public List<T> getInEdges() {\n        return inEdges;\n    }\n\n    @Override\n    public List<T> getOutEdges() {\n        return outEdges;\n    }\n\n    @Override\n    public String toString() {\n        return \"GraphNodeImpl{\" +\n                \"id=\" + id +\n                \", content=\" + content +\n                \", inEdges=\" + inEdges +\n                \", outEdges=\" + outEdges +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/GraphStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\npublic interface GraphStore<T extends GraphNode> extends Iterable<T> {\n\n    public T addNode(T node);\n\n    public T removeNode(int id);\n\n    public T getNode(int id);\n\n    public int size();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/ListGraphStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\n@Portable\npublic class ListGraphStore<T extends GraphNode> implements GraphStore<T> {\n\n    private List<T> nodes = new ArrayList<T>();\n\n    @Override\n    public T addNode(T node) {\n        nodes.add(node);\n        node.setId(nodes.size());\n        return node;\n    }\n\n    @Override\n    public T removeNode(int id) {\n        throw new UnsupportedOperationException(\"ListGraphStore is additive only.\");\n    }\n\n    @Override\n    public T getNode(int id) {\n        return nodes.get(id);\n    }\n\n    @Override\n    public int size() {\n        return nodes.size();\n    }\n\n    @Override\n    public Iterator<T> iterator() {\n        return nodes.iterator();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/java/org/uberfire/ext/wires/bpmn/beliefs/graph/impl/MapGraphStore.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.beliefs.graph.impl;\n\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.GraphNode;\n\n@Portable\npublic class MapGraphStore<T extends GraphNode> implements GraphStore<T> {\n\n    protected int idCounter;\n\n    protected Map<Integer, T> nodes = new HashMap();\n\n    public Map<Integer, T> getNodes() {\n        return nodes;\n    }\n\n    @Override\n    public T addNode(T node) {\n        node.setId(idCounter++);\n        nodes.put(node.getId(),\n                  node);\n        return node;\n    }\n\n    public T removeNode(int id) {\n        return nodes.remove(id);\n    }\n\n    @Override\n    public T getNode(int id) {\n        return nodes.get(id);\n    }\n\n    @Override\n    public int size() {\n        return nodes.size();\n    }\n\n    @Override\n    public Iterator<T> iterator() {\n        return nodes.values().iterator();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/main/resources/org/uberfire/ext/wires/bpmn/WiresBpmnApi.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n\t<inherits name=\"com.google.gwt.user.User\"/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n\n\t<source path=\"api\"></source>\n  <source path=\"beliefs\"></source>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/test/java/org/uberfire/ext/wires/bpmn/api/model/impl/content/CopyContentTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.content;\n\nimport java.util.HashSet;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.properties.DefaultPropertyImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.types.StringType;\n\nimport static junit.framework.Assert.assertNotNull;\nimport static org.junit.Assert.*;\n\npublic class CopyContentTest {\n\n    @Test\n    public void testCopyContent() {\n        final Content content = new DefaultContentImpl(\"id\",\n                                                       \"title\",\n                                                       \"description\",\n                                                       new HashSet<Role>() {{\n                                                           add(new DefaultRoleImpl(\"a-role\"));\n                                                       }},\n                                                       new HashSet<Property>() {{\n                                                           add(new DefaultPropertyImpl(\"id\",\n                                                                                       new StringType(),\n                                                                                       \"caption\",\n                                                                                       \"description\",\n                                                                                       true,\n                                                                                       true));\n                                                       }}\n        );\n        final Content copy = content.copy();\n\n        assertNotNull(copy);\n        assertFalse(content == copy);\n        assertEquals(content.getId(),\n                     copy.getId());\n        assertEquals(content.getTitle(),\n                     copy.getTitle());\n        assertEquals(content.getDescription(),\n                     copy.getDescription());\n        assertEquals(content.getRoles(),\n                     copy.getRoles());\n        assertEquals(content.getProperties(),\n                     copy.getProperties());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/test/java/org/uberfire/ext/wires/bpmn/api/model/impl/edges/CopyEdgesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.edges;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\n\nimport static junit.framework.Assert.assertNotNull;\nimport static org.junit.Assert.*;\n\npublic class CopyEdgesTest {\n\n    @Test\n    public void testCopyEdge() {\n        final BpmnEdge edge = new BpmnEdgeImpl(new DefaultRoleImpl(\"a-role\"));\n        final BpmnEdge copy = edge.copy();\n\n        assertNotNull(copy);\n        assertFalse(edge == copy);\n        assertEquals(edge.getRole(),\n                     copy.getRole());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/test/java/org/uberfire/ext/wires/bpmn/api/model/impl/nodes/CopyNodesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.nodes;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\n\nimport static junit.framework.Assert.assertNotNull;\nimport static org.jgroups.util.Util.assertTrue;\nimport static org.junit.Assert.*;\n\npublic class CopyNodesTest {\n\n    @Test\n    public void testCopyStartProcessNode() {\n        final StartProcessNode node = new StartProcessNode();\n        final StartProcessNode copy = node.copy();\n\n        assertNotNull(copy);\n        assertFalse(node == copy);\n        assertEquals(node.getContent().getId(),\n                     copy.getContent().getId());\n        assertEquals(node.getContent().getTitle(),\n                     copy.getContent().getTitle());\n        assertEquals(node.getContent().getDescription(),\n                     copy.getContent().getDescription());\n        assertEquals(node.getContent().getRoles(),\n                     copy.getContent().getRoles());\n        assertEquals(node.getContent().getProperties(),\n                     copy.getContent().getProperties());\n    }\n\n    @Test\n    public void testCopyEndProcessNode() {\n        final EndProcessNode node = new EndProcessNode();\n        final EndProcessNode copy = node.copy();\n\n        assertNotNull(copy);\n        assertFalse(node == copy);\n        assertEquals(node.getContent().getId(),\n                     copy.getContent().getId());\n        assertEquals(node.getContent().getTitle(),\n                     copy.getContent().getTitle());\n        assertEquals(node.getContent().getDescription(),\n                     copy.getContent().getDescription());\n        assertEquals(node.getContent().getRoles(),\n                     copy.getContent().getRoles());\n        assertEquals(node.getContent().getProperties(),\n                     copy.getContent().getProperties());\n    }\n\n    @Test\n    public void testCopyProcessNode1() {\n        final ProcessNode node = new ProcessNode();\n        final ProcessNode copy = node.copy();\n\n        assertNotNull(copy);\n        assertFalse(node == copy);\n        assertEquals(node.getContent().getId(),\n                     copy.getContent().getId());\n        assertEquals(node.getContent().getTitle(),\n                     copy.getContent().getTitle());\n        assertEquals(node.getContent().getDescription(),\n                     copy.getContent().getDescription());\n        assertEquals(node.getContent().getRoles(),\n                     copy.getContent().getRoles());\n        assertEquals(node.getContent().getProperties(),\n                     copy.getContent().getProperties());\n    }\n\n    @Test\n    public void testCopyProcessNode2() {\n        final ProcessNode process = new ProcessNode();\n        final StartProcessNode startProcessNode = new StartProcessNode();\n        final EndProcessNode endProcessNode = new EndProcessNode();\n        process.addNode(startProcessNode);\n        process.addNode(endProcessNode);\n\n        final ProcessNode copyProcess = process.copy();\n\n        assertNotNull(copyProcess);\n        assertFalse(process == copyProcess);\n        assertEquals(process.getContent().getId(),\n                     copyProcess.getContent().getId());\n        assertEquals(process.getContent().getTitle(),\n                     copyProcess.getContent().getTitle());\n        assertEquals(process.getContent().getDescription(),\n                     copyProcess.getContent().getDescription());\n        assertEquals(process.getContent().getRoles(),\n                     copyProcess.getContent().getRoles());\n        assertEquals(process.getContent().getProperties(),\n                     copyProcess.getContent().getProperties());\n\n        assertEquals(process.size(),\n                     copyProcess.size());\n\n        final BpmnGraphNode copyStartProcessNode = getNode(copyProcess,\n                                                           StartProcessNode.class);\n        assertNotNull(copyStartProcessNode);\n        assertTrue(copyStartProcessNode instanceof StartProcessNode);\n        assertFalse(startProcessNode == copyStartProcessNode);\n\n        final BpmnGraphNode copyEndProcessNode = getNode(copyProcess,\n                                                         EndProcessNode.class);\n        assertNotNull(copyEndProcessNode);\n        assertTrue(copyEndProcessNode instanceof EndProcessNode);\n        assertFalse(endProcessNode == copyEndProcessNode);\n    }\n\n    private BpmnGraphNode getNode(final BpmnGraph process,\n                                  final Class clazz) {\n        for (BpmnGraphNode node : process) {\n            if (node.getClass().equals(clazz)) {\n                return node;\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/test/java/org/uberfire/ext/wires/bpmn/api/model/impl/properties/CopyPropertiesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.properties;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.Property;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.types.StringType;\n\nimport static junit.framework.Assert.assertNotNull;\nimport static org.junit.Assert.*;\n\npublic class CopyPropertiesTest {\n\n    @Test\n    public void testCopyProperties() {\n        final Property property = new DefaultPropertyImpl(\"id\",\n                                                          new StringType(),\n                                                          \"caption\",\n                                                          \"description\",\n                                                          true,\n                                                          true);\n        final Property copy = property.copy();\n\n        assertNotNull(copy);\n        assertFalse(property == copy);\n        assertEquals(property.getId(),\n                     copy.getId());\n        assertEquals(property.getType(),\n                     copy.getType());\n        assertEquals(property.getCaption(),\n                     copy.getCaption());\n        assertEquals(property.getDescription(),\n                     copy.getDescription());\n        assertEquals(property.isReadOnly(),\n                     copy.isReadOnly());\n        assertEquals(property.isOptional(),\n                     copy.isOptional());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-api/src/test/java/org/uberfire/ext/wires/bpmn/api/model/impl/roles/CopyRolesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.api.model.impl.roles;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\n\nimport static junit.framework.Assert.assertNotNull;\nimport static org.junit.Assert.*;\n\npublic class CopyRolesTest {\n\n    @Test\n    public void testCopyRole() {\n        final Role role = new DefaultRoleImpl(\"a-role\");\n        final Role copy = role.copy();\n\n        assertNotNull(copy);\n        assertFalse(role == copy);\n        assertEquals(role.getName(),\n                     copy.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-wires-bpmn</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-bpmn-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Wires :: BPMN Backend</name>\n  <description>Wires BPMN Backend</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <!-- as javax.inject is excluded in parent pom's errai-bus dep. It had to be declared here -->\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-bpmn-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/BpmnPersistence.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.kie.soup.xstream.XStreamUtils;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\n\npublic class BpmnPersistence {\n\n    private static final BpmnPersistence INSTANCE = new BpmnPersistence();\n\n    private XStream xs = XStreamUtils.createTrustingXStream();\n\n    protected BpmnPersistence() {\n    }\n\n    public static BpmnPersistence getInstance() {\n        return INSTANCE;\n    }\n\n    public String marshal(final ProcessNode process) {\n        return xs.toXML(process);\n    }\n\n    public ProcessNode unmarshal(final String content) {\n        final ProcessNode process = (ProcessNode) xs.fromXML(content);\n        return process;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/BpmnServiceImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.editor.commons.service.CopyService;\nimport org.uberfire.ext.editor.commons.service.DeleteService;\nimport org.uberfire.ext.editor.commons.service.RenameService;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.BpmnEditorContent;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.service.BpmnService;\nimport org.uberfire.ext.wires.bpmn.api.service.todo.Metadata;\nimport org.uberfire.ext.wires.bpmn.api.type.BpmnResourceTypeDefinition;\nimport org.uberfire.ext.wires.bpmn.backend.todo.CommentedOptionFactory;\nimport org.uberfire.ext.wires.bpmn.backend.todo.ExceptionUtilities;\nimport org.uberfire.ext.wires.bpmn.backend.todo.MetadataFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.rpc.SessionInfo;\n\n@Service\n@ApplicationScoped\npublic class BpmnServiceImpl implements BpmnService {\n\n    @Inject\n    protected User identity;\n    @Inject\n    protected SessionInfo sessionInfo;\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n    @Inject\n    private CopyService copyService;\n\n    @Inject\n    private DeleteService deleteService;\n\n    @Inject\n    private RenameService renameService;\n\n    @Inject\n    private BpmnResourceTypeDefinition typeDefinition;\n\n    @Inject\n    private SaveAndRenameServiceImpl<ProcessNode, Metadata> saveAndRenameService;\n    /**\n     * TEMPORARY METHODS UNTIL INTEGRATED INTO KIE-WB\n     */\n    private FileSystem fileSystem;\n    private org.uberfire.java.nio.file.Path root;\n\n    @Override\n    public Path create(final Path context,\n                       final String fileName,\n                       final ProcessNode content,\n                       final String comment) {\n        try {\n            final org.uberfire.java.nio.file.Path nioPath = Paths.convert(context).resolve(fileName);\n            final Path newPath = Paths.convert(nioPath);\n\n            if (ioService.exists(nioPath)) {\n                throw new FileAlreadyExistsException(nioPath.toString());\n            }\n\n            ioService.write(nioPath,\n                            BpmnPersistence.getInstance().marshal(content),\n                            CommentedOptionFactory.makeCommentedOption(identity,\n                                                                       sessionInfo,\n                                                                       comment));\n\n            return newPath;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public BpmnEditorContent loadContent(final Path path) {\n        try {\n            final ProcessNode graph = load(path);\n            final BpmnEditorContent content = new BpmnEditorContent(graph);\n\n            return content;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public ProcessNode load(final Path path) {\n        try {\n            final String content = ioService.readAllString(Paths.convert(path));\n\n            return BpmnPersistence.getInstance().unmarshal(content);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Path save(final Path path,\n                     final ProcessNode content,\n                     final Metadata metadata,\n                     final String comment) {\n        try {\n            ioService.write(Paths.convert(path),\n                            BpmnPersistence.getInstance().marshal(content),\n                            MetadataFactory.makeMetadata(metadata),\n                            CommentedOptionFactory.makeCommentedOption(identity,\n                                                                       sessionInfo,\n                                                                       comment));\n\n            return path;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final String comment) {\n        try {\n            deleteService.delete(path,\n                                 comment);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Path rename(final Path path,\n                       final String newName,\n                       final String comment) {\n        try {\n            return renameService.rename(path,\n                                        newName,\n                                        comment);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final String comment) {\n        try {\n            return copyService.copy(path,\n                                    newName,\n                                    comment);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Path copy(final Path path,\n                     final String newName,\n                     final Path targetDirectory,\n                     final String comment) {\n        throw new UnsupportedOperationException(\"A bpmn resource cannot be copied to another directory.\");\n    }\n\n    @PostConstruct\n    public void setup() {\n        try {\n            fileSystem = ioService.newFileSystem(URI.create(\"default://bpmn\"),\n                                                 new HashMap<String, Object>() {{\n                                                     put(\"init\",\n                                                         Boolean.TRUE);\n                                                     put(\"internal\",\n                                                         Boolean.TRUE);\n                                                 }});\n        } catch (final FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(URI.create(\"default://bpmn\"));\n        }\n        this.root = fileSystem.getRootDirectories().iterator().next();\n\n        ioService.write(root.resolve(\"file1.bpmn\"),\n                        BpmnPersistence.getInstance().marshal(new ProcessNode()));\n\n        saveAndRenameService.init(this);\n    }\n\n    @Override\n    public List<Path> listFiles() {\n        final DirectoryStream<org.uberfire.java.nio.file.Path> stream = ioService.newDirectoryStream(root,\n                                                                                                     new DirectoryStream.Filter<org.uberfire.java.nio.file.Path>() {\n                                                                                                         @Override\n                                                                                                         public boolean accept(org.uberfire.java.nio.file.Path entry) throws IOException {\n                                                                                                             return typeDefinition.accept(Paths.convert(entry));\n                                                                                                         }\n                                                                                                     });\n        final List<Path> files = new ArrayList<Path>();\n        final Iterator<org.uberfire.java.nio.file.Path> itr = stream.iterator();\n        while (itr.hasNext()) {\n            files.add(Paths.convert(itr.next()));\n        }\n        return files;\n    }\n\n    @Override\n    public Path saveAndRename(final Path path,\n                              final String newFileName,\n                              final Metadata metadata,\n                              final ProcessNode content,\n                              final String comment) {\n        return saveAndRenameService.saveAndRename(path, newFileName, metadata, content, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/todo/CommentedOptionFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend.todo;\n\nimport java.util.Date;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.rpc.SessionInfo;\n\n/**\n * When Bpmn moves to KIE-WB this class can be removed.\n */\npublic class CommentedOptionFactory {\n\n    public static CommentedOption makeCommentedOption(final User identity,\n                                                      final SessionInfo sessionInfo,\n                                                      final String commitMessage) {\n        final String name = identity.getIdentifier();\n        final Date when = new Date();\n        final CommentedOption co = new CommentedOption(sessionInfo.getId(),\n                                                       name,\n                                                       null,\n                                                       commitMessage,\n                                                       when);\n        return co;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/todo/ExceptionUtilities.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend.todo;\n\nimport org.jboss.errai.config.rebind.EnvUtil;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * When Bpmn moves to KIE-WB this class can be removed.\n */\npublic class ExceptionUtilities {\n\n    private static final Logger logger = LoggerFactory.getLogger(ExceptionUtilities.class);\n\n    /**\n     * Helper to return a @Portable RuntimeException.\n     * @param e\n     * @return\n     */\n    public static RuntimeException handleException(final Exception e) {\n        logger.debug(\"Exception thrown: \" + e.getMessage(),\n                     e);\n        if (EnvUtil.isPortableType(e.getClass())) {\n            if (e instanceof RuntimeException) {\n                return (RuntimeException) e;\n            } else {\n                return new GenericPortableException(e.getMessage(),\n                                                    e);\n            }\n        }\n        return new GenericPortableException(e.getMessage(),\n                                            e);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/todo/GenericPortableException.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend.todo;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * When Bpmn moves to KIE-WB this class can be removed.\n */\n@Portable\npublic class GenericPortableException extends RuntimeException {\n\n    public GenericPortableException(final String message) {\n        super(message);\n    }\n\n    public GenericPortableException(@MapsTo(\"message\") final String message,\n                                    @MapsTo(\"e\") Exception e) {\n        super(message,\n              e);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/java/org/uberfire/ext/wires/bpmn/backend/todo/MetadataFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.backend.todo;\n\nimport java.util.Collections;\nimport java.util.Map;\n\nimport org.uberfire.ext.wires.bpmn.api.service.todo.Metadata;\n\n/**\n * When Bpmn moves to KIE-WB this class can be removed.\n */\npublic class MetadataFactory {\n\n    public static Map<String, Object> makeMetadata(final Metadata metadata) {\n        return Collections.EMPTY_MAP;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-backend/src/test/java/org/uberfire/ext/wires/bpmn/backend/BpmnServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bpmn.backend;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.backend.service.SaveAndRenameServiceImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.service.todo.Metadata;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class BpmnServiceImplTest {\n\n    @Mock\n    private SaveAndRenameServiceImpl<ProcessNode, Metadata> saveAndRenameService;\n\n    @Spy\n    @InjectMocks\n    private BpmnServiceImpl bpmnService = new BpmnServiceImpl();\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void bpmnResourceCopyTest() {\n        Path path = mock(Path.class);\n        String newName = \"newName\";\n        Path targetDirectory = mock(Path.class);\n        String comment = \"comment\";\n\n        bpmnService.copy(path,\n                         newName,\n                         targetDirectory,\n                         comment);\n    }\n\n    @Test\n    public void testSaveAndRename() {\n\n        final String newFileName = \"newFileName\";\n        final String comment = \"comment\";\n        final Path path = mock(Path.class);\n        final Metadata metadata = mock(Metadata.class);\n        final ProcessNode content = mock(ProcessNode.class);\n\n        bpmnService.saveAndRename(path, newFileName, metadata, content, comment);\n\n        verify(saveAndRenameService).saveAndRename(path, newFileName, metadata, content, comment);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-wires-bpmn</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-bpmn-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Wires :: BPMN Client</name>\n  <description>Wires BPMN Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-bpmn-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/BpmnEntryPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.ext.wires.bpmn.client.resources.BpmnEditorResources;\n\n@EntryPoint\npublic class BpmnEntryPoint {\n\n    @PostConstruct\n    public void init() {\n        BpmnEditorResources.INSTANCE.css().ensureInjected();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/Command.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands;\n\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * Command to mutate Elements\n */\npublic interface Command {\n\n    /**\n     * Apply the command\n     * @param ruleManager\n     * @return\n     */\n    Results apply(final RuleManager ruleManager);\n\n    /**\n     * Undo the changes the command made to the model\n     * @param ruleManager\n     * @return\n     */\n    Results undo(final RuleManager ruleManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/CommandManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands;\n\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * Command Manager to handle execution of commands to mutate Elements\n */\npublic interface CommandManager {\n\n    /**\n     * Execute a Command and return results\n     * @param ruleManager\n     * @param command\n     * @return\n     */\n    Results execute(final RuleManager ruleManager,\n                    final Command command);\n\n    /**\n     * Undo the most recent command\n     * @param ruleManager\n     * @return\n     */\n    Results undo(final RuleManager ruleManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/Result.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands;\n\n/**\n * Result from the execution of a command\n */\npublic interface Result {\n\n    /**\n     * Type of Result\n     * @return\n     */\n    ResultType getType();\n\n    /**\n     * Detailed message for the Result\n     * @return\n     */\n    String getMessage();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/ResultType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands;\n\n/**\n * Type of Result\n */\npublic enum ResultType {\n\n    WARNING,\n    ERROR\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/Results.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands;\n\nimport java.util.List;\n\n/**\n * Result from the execution of a command\n */\npublic interface Results {\n\n    void addMessage(final Result result);\n\n    List<Result> getMessages();\n\n    List<Result> getMessages(final ResultType type);\n\n    boolean contains(final ResultType type);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/AddEdgeCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * A Command to add an Edge between two GraphNodes\n */\npublic class AddEdgeCommand implements Command {\n\n    private BpmnGraphNode outgoingNode;\n    private BpmnGraphNode incomingNode;\n    private BpmnEdge edge;\n\n    public AddEdgeCommand(final BpmnGraphNode outgoingNode,\n                          final BpmnGraphNode incomingNode,\n                          final BpmnEdge edge) {\n        this.outgoingNode = PortablePreconditions.checkNotNull(\"outgoingNode\",\n                                                               outgoingNode);\n        this.incomingNode = PortablePreconditions.checkNotNull(\"incomingNode\",\n                                                               incomingNode);\n        this.edge = PortablePreconditions.checkNotNull(\"edge\",\n                                                       edge);\n    }\n\n    @Override\n    public Results apply(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        results.getMessages().addAll(ruleManager.checkConnectionRules(outgoingNode,\n                                                                      incomingNode,\n                                                                      edge).getMessages());\n        results.getMessages().addAll(ruleManager.checkCardinality(outgoingNode,\n                                                                  incomingNode,\n                                                                  edge,\n                                                                  RuleManager.Operation.ADD).getMessages());\n        if (!results.contains(ResultType.ERROR)) {\n            outgoingNode.getOutEdges().add(edge);\n            incomingNode.getInEdges().add(edge);\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        final Command undoCommand = new DeleteEdgeCommand(outgoingNode,\n                                                          incomingNode,\n                                                          edge);\n        return undoCommand.apply(ruleManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/AddGraphNodeCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * A Command to add a GraphNode to a Graph\n */\npublic class AddGraphNodeCommand implements Command {\n\n    private BpmnGraph target;\n    private BpmnGraphNode candidate;\n\n    public AddGraphNodeCommand(final BpmnGraph target,\n                               final BpmnGraphNode candidate) {\n        this.target = PortablePreconditions.checkNotNull(\"target\",\n                                                         target);\n        this.candidate = PortablePreconditions.checkNotNull(\"candidate\",\n                                                            candidate);\n    }\n\n    @Override\n    public Results apply(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        results.getMessages().addAll(ruleManager.checkContainment(target,\n                                                                  candidate).getMessages());\n        results.getMessages().addAll(ruleManager.checkCardinality(target,\n                                                                  candidate,\n                                                                  RuleManager.Operation.ADD).getMessages());\n        if (!results.contains(ResultType.ERROR)) {\n            target.addNode(candidate);\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        final Command undoCommand = new DeleteGraphNodeCommand(target,\n                                                               candidate);\n        return undoCommand.apply(ruleManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/BatchCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Stack;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * A batch of Commands to be executed as an atomic unit\n */\npublic class BatchCommand implements Command {\n\n    private List<Command> commands;\n\n    public BatchCommand(final List<Command> commands) {\n        this.commands = PortablePreconditions.checkNotNull(\"commands\",\n                                                           commands);\n    }\n\n    public BatchCommand(final Command... commands) {\n        this.commands = Arrays.asList(PortablePreconditions.checkNotNull(\"commands\",\n                                                                         commands));\n    }\n\n    @Override\n    public Results apply(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        final Stack<Command> appliedCommands = new Stack<Command>();\n        for (Command command : commands) {\n            results.getMessages().addAll(command.apply(ruleManager).getMessages());\n            if (results.contains(ResultType.ERROR)) {\n                for (Command undo : appliedCommands) {\n                    undo.undo(ruleManager);\n                }\n                return results;\n            } else {\n                appliedCommands.add(command);\n            }\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        final Stack<Command> appliedCommands = new Stack<Command>();\n        for (Command command : commands) {\n            results.getMessages().addAll(command.undo(ruleManager).getMessages());\n            if (results.contains(ResultType.ERROR)) {\n                for (Command cmd : appliedCommands) {\n                    cmd.apply(ruleManager);\n                }\n                return results;\n            } else {\n                appliedCommands.add(command);\n            }\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DefaultCommandManagerImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.Stack;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * Default implementation of CommandManager\n */\n@ApplicationScoped\npublic class DefaultCommandManagerImpl implements CommandManager {\n\n    private Stack<Command> commands = new Stack<Command>();\n\n    @Override\n    public Results execute(final RuleManager ruleManager,\n                           final Command command) {\n        PortablePreconditions.checkNotNull(\"command\",\n                                           command);\n        final Results results = command.apply(ruleManager);\n        if (!results.contains(ResultType.ERROR)) {\n            commands.push(command);\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        if (commands.isEmpty()) {\n            throw new IllegalStateException(\"No commands to undo\");\n        }\n        return commands.pop().undo(ruleManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DefaultResultImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.client.commands.Result;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\n\n/**\n * Result from the execution of a command\n */\npublic class DefaultResultImpl implements Result {\n\n    private ResultType type;\n    private String message;\n\n    public DefaultResultImpl(final ResultType type,\n                             final String message) {\n        this.type = PortablePreconditions.checkNotNull(\"type\",\n                                                       type);\n        this.message = PortablePreconditions.checkNotNull(\"message\",\n                                                          message);\n    }\n\n    @Override\n    public ResultType getType() {\n        return type;\n    }\n\n    @Override\n    public String getMessage() {\n        return message;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultResultImpl)) {\n            return false;\n        }\n\n        DefaultResultImpl that = (DefaultResultImpl) o;\n\n        if (!message.equals(that.message)) {\n            return false;\n        }\n        if (type != that.type) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = type.hashCode();\n        result = 31 * result + message.hashCode();\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultResultImpl{\" +\n                \"type=\" + type +\n                \", message='\" + message + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DefaultResultsImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.bpmn.client.commands.Result;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\n\n/**\n * Results from the execution of a command\n */\npublic class DefaultResultsImpl implements Results {\n\n    private List<Result> results = new ArrayList<Result>();\n\n    @Override\n    public void addMessage(final Result result) {\n        results.add(result);\n    }\n\n    @Override\n    public List<Result> getMessages() {\n        return results;\n    }\n\n    @Override\n    public List<Result> getMessages(final ResultType type) {\n        final List<Result> filteredResults = new ArrayList<Result>();\n        for (Result result : results) {\n            if (result.getType().equals(type)) {\n                filteredResults.add(result);\n            }\n        }\n        return Collections.unmodifiableList(filteredResults);\n    }\n\n    @Override\n    public boolean contains(final ResultType type) {\n        for (Result result : results) {\n            if (result.getType().equals(type)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultResultsImpl)) {\n            return false;\n        }\n\n        DefaultResultsImpl that = (DefaultResultsImpl) o;\n\n        if (!results.equals(that.results)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return results.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultResultsImpl{\" +\n                \"results=\" + results +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DeleteEdgeCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * A Command to delete an Edge between two GraphNodes\n */\npublic class DeleteEdgeCommand implements Command {\n\n    private BpmnGraphNode outgoingNode;\n    private BpmnGraphNode incomingNode;\n    private BpmnEdge edge;\n\n    public DeleteEdgeCommand(final BpmnGraphNode outgoingNode,\n                             final BpmnGraphNode incomingNode,\n                             final BpmnEdge edge) {\n        this.outgoingNode = PortablePreconditions.checkNotNull(\"outgoingNode\",\n                                                               outgoingNode);\n        this.incomingNode = PortablePreconditions.checkNotNull(\"incomingNode\",\n                                                               incomingNode);\n        this.edge = PortablePreconditions.checkNotNull(\"edge\",\n                                                       edge);\n    }\n\n    @Override\n    public Results apply(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        boolean isEdgeOutgoing = false;\n        boolean isEdgeIncoming = false;\n        for (BpmnEdge e : outgoingNode.getOutEdges()) {\n            if (e.equals(edge)) {\n                isEdgeOutgoing = true;\n                break;\n            }\n        }\n        for (BpmnEdge e : incomingNode.getInEdges()) {\n            if (e.equals(edge)) {\n                isEdgeIncoming = true;\n                break;\n            }\n        }\n        if (isEdgeOutgoing && isEdgeIncoming) {\n            results.getMessages().addAll(ruleManager.checkCardinality(outgoingNode,\n                                                                      incomingNode,\n                                                                      edge,\n                                                                      RuleManager.Operation.DELETE).getMessages());\n            if (!results.contains(ResultType.ERROR)) {\n                outgoingNode.getOutEdges().remove(edge);\n                incomingNode.getInEdges().remove(edge);\n            }\n        } else {\n            results.addMessage(new DefaultResultImpl(ResultType.WARNING,\n                                                     \"The Edge does not connect the given GraphNodes and hence was not deleted.\"));\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        final Command undoCommand = new AddEdgeCommand(outgoingNode,\n                                                       incomingNode,\n                                                       edge);\n        return undoCommand.apply(ruleManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DeleteGraphNodeCommand.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.Command;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * A Command to delete a GraphNode from a Graph\n */\npublic class DeleteGraphNodeCommand implements Command {\n\n    private BpmnGraph target;\n    private BpmnGraphNode candidate;\n\n    public DeleteGraphNodeCommand(final BpmnGraph target,\n                                  final BpmnGraphNode candidate) {\n        this.target = PortablePreconditions.checkNotNull(\"target\",\n                                                         target);\n        this.candidate = PortablePreconditions.checkNotNull(\"candidate\",\n                                                            candidate);\n    }\n\n    @Override\n    public Results apply(final RuleManager ruleManager) {\n        final Results results = new DefaultResultsImpl();\n        boolean isNodeInGraph = false;\n        for (BpmnGraphNode node : target) {\n            if (node.equals(candidate)) {\n                isNodeInGraph = true;\n                break;\n            }\n        }\n        if (isNodeInGraph) {\n            results.getMessages().addAll(ruleManager.checkCardinality(target,\n                                                                      candidate,\n                                                                      RuleManager.Operation.DELETE).getMessages());\n            if (!results.contains(ResultType.ERROR)) {\n                target.removeNode(candidate.getId());\n            }\n        } else {\n            results.addMessage(new DefaultResultImpl(ResultType.WARNING,\n                                                     \"GraphNode was not present in Graph and hence was not deleted.\"));\n        }\n        return results;\n    }\n\n    @Override\n    public Results undo(final RuleManager ruleManager) {\n        final Command undoCommand = new AddGraphNodeCommand(target,\n                                                            candidate);\n        return undoCommand.apply(ruleManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/editor/BpmnEditorPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.editor;\n\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.service.support.SupportsSaveAndRename;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.BpmnEditorContent;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.service.BpmnService;\nimport org.uberfire.ext.wires.bpmn.api.service.todo.Metadata;\nimport org.uberfire.ext.wires.bpmn.client.resources.i18n.BpmnEditorConstants;\nimport org.uberfire.ext.wires.bpmn.client.type.BpmnResourceType;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.COPY;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.RENAME;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\n@Dependent\n@WorkbenchEditor(identifier = \"BPMN Editor\", supportedTypes = {BpmnResourceType.class}, priority = Integer.MAX_VALUE)\npublic class BpmnEditorPresenter extends BaseEditor<ProcessNode, Metadata> {\n\n    @Inject\n    private BpmnResourceType resourceType;\n\n    @Inject\n    private Caller<BpmnService> service;\n\n    private BpmnEditorView view;\n\n    private ProcessNode process;\n\n    @Inject\n    public BpmnEditorPresenter(final BpmnEditorView baseView) {\n        super(baseView);\n        this.view = baseView;\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        init(path,\n             place,\n             resourceType,\n             true,\n             false,\n             SAVE,\n             COPY,\n             RENAME,\n             DELETE);\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return BpmnEditorConstants.INSTANCE.bpmnEditorTitle();\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public UberView<BpmnEditorPresenter> getWidget() {\n        return (UberView<BpmnEditorPresenter>) super.baseView;\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return super.mayClose(process.hashCode());\n    }\n\n    @Override\n    protected void loadContent() {\n        //TODO {manstis} When we move to KIE-WB this class can extend KieBaseEditor and be refactored\n        service.call(getModelSuccessCallback()).loadContent(versionRecordManager.getCurrentPath());\n    }\n\n    @Override\n    protected Supplier<ProcessNode> getContentSupplier() {\n        return this::getContent;\n    }\n\n    ProcessNode getContent() {\n        return process;\n    }\n\n    @Override\n    protected Caller<? extends SupportsSaveAndRename<ProcessNode, Metadata>> getSaveAndRenameServiceCaller() {\n        return service;\n    }\n\n    private RemoteCallback<BpmnEditorContent> getModelSuccessCallback() {\n        //TODO {manstis} When we move to KIE-WB this class can extend KieBaseEditor and be refactored\n        return new RemoteCallback<BpmnEditorContent>() {\n\n            @Override\n            public void callback(final BpmnEditorContent content) {\n                //Path is set to null when the Editor is closed (which can happen before async calls complete).\n                if (versionRecordManager.getCurrentPath() == null) {\n                    return;\n                }\n\n                process = content.getProcess();\n\n                view.setContent(content,\n                                isReadOnly);\n                view.hideBusyIndicator();\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/editor/BpmnEditorView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.editor;\n\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.BpmnEditorContent;\n\npublic interface BpmnEditorView extends BaseEditorView,\n                                        UberView<BpmnEditorPresenter> {\n\n    void setContent(final BpmnEditorContent content,\n                    final boolean isReadOnly);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/editor/BpmnEditorViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.uberfire.ext.editor.commons.client.BaseEditorViewImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.BpmnEditorContent;\n\n@Dependent\npublic class BpmnEditorViewImpl extends BaseEditorViewImpl\n        implements BpmnEditorView {\n\n    final private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    Label label;\n    private BpmnEditorPresenter presenter;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final BpmnEditorPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setContent(final BpmnEditorContent content,\n                           final boolean isReadOnly) {\n        label.setText(content.getProcess().toString());\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, BpmnEditorViewImpl> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/editor/BpmnEditorViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <b:Label ui:field=\"label\"/>\n\n</ui:UiBinder>\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/explorer/BpmnExplorerPresenter.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.explorer;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.ext.wires.bpmn.api.service.BpmnService;\nimport org.uberfire.ext.wires.bpmn.client.resources.i18n.BpmnEditorConstants;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@Dependent\n@WorkbenchScreen(identifier = \"BPMN Explorer\")\npublic class BpmnExplorerPresenter {\n\n    @Inject\n    private Caller<BpmnService> service;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private BpmnExplorerView view;\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n        service.call(new RemoteCallback<List<Path>>() {\n            @Override\n            public void callback(final List<Path> files) {\n                view.setContent(files);\n            }\n        }).listFiles();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return BpmnEditorConstants.INSTANCE.bpmnExplorerTitle();\n    }\n\n    @WorkbenchPartView\n    public UberView<BpmnExplorerPresenter> getWidget() {\n        return view;\n    }\n\n    public void openFile(final Path file) {\n        placeManager.goTo(new PathPlaceRequest(file));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/explorer/BpmnExplorerView.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.explorer;\n\nimport java.util.List;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.UberView;\n\npublic interface BpmnExplorerView extends UberView<BpmnExplorerPresenter> {\n\n    void setContent(final List<Path> files);\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/explorer/BpmnExplorerViewImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.explorer;\n\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.TextColumn;\nimport com.google.gwt.user.cellview.client.TextHeader;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.ListDataProvider;\nimport org.gwtbootstrap3.client.ui.Label;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.gwtbootstrap3.client.ui.gwt.CellTable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.wires.bpmn.client.resources.i18n.BpmnEditorConstants;\n\n@Dependent\npublic class BpmnExplorerViewImpl extends Composite implements BpmnExplorerView {\n\n    final private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField(provided = true)\n    CellTable<Path> table = new CellTable<Path>();\n    private ListDataProvider<Path> dataProvider = new ListDataProvider<Path>();\n    private BpmnExplorerPresenter presenter;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void init(final BpmnExplorerPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setContent(final List<Path> files) {\n        table.setStriped(true);\n        table.setCondensed(true);\n        table.setBordered(true);\n        table.setEmptyTableWidget(new Label(BpmnEditorConstants.INSTANCE.bpmnExplorerNoFilesFound()));\n\n        //Columns\n        final TextColumn<Path> urlColumn = new TextColumn<Path>() {\n\n            @Override\n            public String getValue(final Path file) {\n                return file.toURI();\n            }\n        };\n\n        final ButtonCell openButton = new ButtonCell(IconType.EDIT,\n                                                     ButtonType.PRIMARY,\n                                                     ButtonSize.SMALL);\n        final Column<Path, String> openColumn = new Column<Path, String>(openButton) {\n            @Override\n            public String getValue(final Path global) {\n                return BpmnEditorConstants.INSTANCE.bpmnExplorerNoFilesOpen();\n            }\n        };\n        openColumn.setFieldUpdater(new FieldUpdater<Path, String>() {\n            public void update(final int index,\n                               final Path file,\n                               final String value) {\n                presenter.openFile(file);\n            }\n        });\n\n        table.addColumn(urlColumn,\n                        new TextHeader(BpmnEditorConstants.INSTANCE.bpmnExplorerFileUrl()));\n        table.addColumn(openColumn);\n\n        //Link data\n        dataProvider.addDataDisplay(table);\n        dataProvider.setList(files);\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, BpmnExplorerViewImpl> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/explorer/BpmnExplorerViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui.gwt\">\n\n  <b:CellTable ui:field=\"table\" bordered=\"true\" striped=\"true\"/>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/perspectives/BpmnPerspective.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.ext.wires.bpmn.client.resources.i18n.BpmnEditorConstants;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"BpmnPerspective\")\npublic class BpmnPerspective {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return buildPerspective();\n    }\n\n    private PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinitionImpl perspective = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        perspective.setName(BpmnEditorConstants.INSTANCE.bpmnPerspectiveTitle());\n\n        final PanelDefinition west = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        west.setWidth(300);\n        west.setMinWidth(200);\n        west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(\"BPMN Explorer\")));\n\n        perspective.getRoot().insertChild(CompassPosition.WEST,\n                                          west);\n\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/resources/BpmnEditorResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport org.uberfire.ext.wires.bpmn.client.resources.css.BpmnEditorCss;\nimport org.uberfire.ext.wires.bpmn.client.resources.images.BpmnEditorImageResources;\n\npublic interface BpmnEditorResources\n        extends\n        ClientBundle {\n\n    BpmnEditorResources INSTANCE = GWT.create(BpmnEditorResources.class);\n\n    @Source(\"css/bpmn.css\")\n    BpmnEditorCss css();\n\n    BpmnEditorImageResources images();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/resources/css/BpmnEditorCss.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.resources.css;\n\nimport com.google.gwt.resources.client.CssResource;\n\npublic interface BpmnEditorCss extends CssResource {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface BpmnEditorConstants\n        extends\n        Messages {\n\n    public static final BpmnEditorConstants INSTANCE = GWT.create(BpmnEditorConstants.class);\n\n    String bpmnResourceTypeDescription();\n\n    String bpmnPerspectiveTitle();\n\n    String bpmnExplorerTitle();\n\n    String bpmnExplorerNoFilesFound();\n\n    String bpmnExplorerNoFilesOpen();\n\n    String bpmnExplorerFileUrl();\n\n    String bpmnEditorTitle();\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/resources/images/BpmnEditorImageResources.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.resources.images;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface BpmnEditorImageResources\n        extends\n        ClientBundle {\n\n    @Source(\"BPM_FileIcons_bpmn.png\")\n    ImageResource typeBpmn();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/rules/RuleManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.rules;\n\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\n\n/**\n * Rule Manager to report validation issues when attempting to mutate Elements\n */\npublic interface RuleManager {\n\n    /**\n     * Add a rule to the Rule Manager\n     * @param rule\n     */\n    void addRule(final Rule rule);\n\n    /**\n     * Check whether adding the proposed Node to the target Process breaks any containment Rules\n     * @param target Target process\n     * @param candidate Candidate node\n     * @return\n     */\n    Results checkContainment(final BpmnGraph target,\n                             final BpmnGraphNode candidate);\n\n    /**\n     * Check whether adding the proposed Node to the target Process breaks any cardinality Rules\n     * @param target Target process\n     * @param candidate Candidate node\n     * @param operation Is the candidate Node being added or removed\n     * @return\n     */\n    Results checkCardinality(final BpmnGraph target,\n                             final BpmnGraphNode candidate,\n                             final Operation operation);\n\n    /**\n     * Check whether adding the proposed Edge to the target Process breaks any connection Rules\n     * @param outgoingNode Node from which the Edge will emanate\n     * @param incomingNode Node to which the Edge will terminate\n     * @param edge Candidate edge\n     * @return Is the Edge being added or removed\n     */\n    Results checkConnectionRules(final BpmnGraphNode outgoingNode,\n                                 final BpmnGraphNode incomingNode,\n                                 final BpmnEdge edge);\n\n    /**\n     * Check whether adding the proposed Edge to the target Process breaks any cardinality Rules\n     * @param outgoingNode Node from which the Edge will emanate\n     * @param incomingNode Node to which the Edge will terminate\n     * @param edge Candidate edge\n     * @param operation\n     * @return Is the Edge being added or removed\n     */\n    Results checkCardinality(final BpmnGraphNode outgoingNode,\n                             final BpmnGraphNode incomingNode,\n                             final BpmnEdge edge,\n                             final Operation operation);\n\n    /**\n     * Rules are applied against an unmodified Graph to check whether the proposed mutated state is valid.\n     * This is deliberate to avoid, for example, costly \"undo\" operations if we were to mutate the state\n     * first and then validate. An invalidate state would need to be reverted. If we decided to change\n     * this we'd need to mutate the graph state first and then validate the whole graph.\n     */\n    public enum Operation {\n        ADD,\n        DELETE\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/rules/impl/DefaultRuleManagerImpl.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.rules.impl;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.CardinalityRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.ConnectionRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.ContainmentRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.commands.impl.DefaultResultImpl;\nimport org.uberfire.ext.wires.bpmn.client.commands.impl.DefaultResultsImpl;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\n/**\n * Default implementation of Rule Manager\n */\n@ApplicationScoped\npublic class DefaultRuleManagerImpl implements RuleManager {\n\n    private final Set<ContainmentRule> containmentRules = new HashSet<ContainmentRule>();\n    private final Set<CardinalityRule> cardinalityRules = new HashSet<CardinalityRule>();\n    private final Set<ConnectionRule> connectionRules = new HashSet<ConnectionRule>();\n\n    @Override\n    public void addRule(final Rule rule) {\n        PortablePreconditions.checkNotNull(\"rule\",\n                                           rule);\n        // Filter Rules upon insertion as different types of validation use different rules\n        // It's quicker to filter once here than every time the Rules are needed.\n        if (rule instanceof ContainmentRule) {\n            containmentRules.add((ContainmentRule) rule);\n        } else if (rule instanceof CardinalityRule) {\n            cardinalityRules.add((CardinalityRule) rule);\n        } else if (rule instanceof ConnectionRule) {\n            connectionRules.add((ConnectionRule) rule);\n        }\n    }\n\n    @Override\n    public Results checkContainment(final BpmnGraph target,\n                                    final BpmnGraphNode candidate) {\n        final Results results = new DefaultResultsImpl();\n        if (containmentRules.isEmpty()) {\n            return results;\n        }\n\n        for (ContainmentRule rule : containmentRules) {\n            if (rule.getId().equals(target.getContent().getId())) {\n                final Set<Role> permittedRoles = new HashSet(rule.getPermittedRoles());\n                permittedRoles.retainAll(candidate.getContent().getRoles());\n                if (permittedRoles.size() > 0) {\n                    return results;\n                }\n            }\n        }\n        results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                 \"'\" + target.getContent().getId() + \"' cannot contain '\" + candidate.getContent().getId() + \"'.\"));\n        return results;\n    }\n\n    @Override\n    public Results checkCardinality(final BpmnGraph target,\n                                    final BpmnGraphNode candidate,\n                                    final Operation operation) {\n        final Results results = new DefaultResultsImpl();\n        if (cardinalityRules.isEmpty()) {\n            return results;\n        }\n\n        for (CardinalityRule rule : cardinalityRules) {\n            if (candidate.getContent().getRoles().contains(rule.getRole())) {\n                final long minOccurrences = rule.getMinOccurrences();\n                final long maxOccurrences = rule.getMaxOccurrences();\n                long count = (operation == Operation.ADD ? 1 : -1);\n                for (BpmnGraphNode node : target) {\n                    if (node.getContent().getId().equals(candidate.getContent().getId())) {\n                        count++;\n                    }\n                }\n                if (count < minOccurrences) {\n                    results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                             \"'\" + target.getContent().getId() + \"' needs a minimum '\" + minOccurrences + \"' of '\" + candidate.getContent().getId() + \"' nodes. Found '\" + count + \"'.\"));\n                } else if (count > maxOccurrences) {\n                    results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                             \"'\" + target.getContent().getId() + \"' can have a maximum  '\" + maxOccurrences + \"' of '\" + candidate.getContent().getId() + \"' nodes. Found '\" + count + \"'.\"));\n                }\n            }\n        }\n        return results;\n    }\n\n    @Override\n    public Results checkConnectionRules(final BpmnGraphNode outgoingNode,\n                                        final BpmnGraphNode incomingNode,\n                                        final BpmnEdge edge) {\n        final Results results = new DefaultResultsImpl();\n        if (connectionRules.isEmpty()) {\n            return results;\n        }\n\n        final Set<Pair<String, String>> couples = new HashSet<Pair<String, String>>();\n        for (ConnectionRule rule : connectionRules) {\n            if (edge.getRole().equals(rule.getRole())) {\n                for (ConnectionRule.PermittedConnection pc : rule.getPermittedConnections()) {\n                    couples.add(new Pair(pc.getStartRole().getName(),\n                                         pc.getEndRole().getName()));\n                    if (outgoingNode.getContent().getRoles().contains(pc.getStartRole())) {\n                        if (incomingNode.getContent().getRoles().contains(pc.getEndRole())) {\n                            return results;\n                        }\n                    }\n                }\n            }\n        }\n\n        results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                 \"Edge does not emanate from a GraphNode with a permitted Role nor terminate at GraphNode with a permitted Role. Permitted Connections are: \" + couples.toString()));\n        return results;\n    }\n\n    @Override\n    public Results checkCardinality(final BpmnGraphNode outgoingNode,\n                                    final BpmnGraphNode incomingNode,\n                                    final BpmnEdge edge,\n                                    final Operation operation) {\n        final Results results = new DefaultResultsImpl();\n        if (cardinalityRules.isEmpty()) {\n            return results;\n        }\n\n        for (CardinalityRule rule : cardinalityRules) {\n            //Check outgoing connections\n            if (outgoingNode.getContent().getRoles().contains(rule.getRole())) {\n                for (CardinalityRule.ConnectorRule cr : rule.getOutgoingConnectionRules()) {\n                    if (cr.getRole().equals(edge.getRole())) {\n                        final long minOccurrences = cr.getMinOccurrences();\n                        final long maxOccurrences = cr.getMaxOccurrences();\n                        long count = (operation == Operation.ADD ? 1 : -1);\n                        for (BpmnEdge e : outgoingNode.getOutEdges()) {\n                            if (e instanceof BpmnEdge) {\n                                final BpmnEdge be = (BpmnEdge) e;\n                                if (be.getRole().equals(edge.getRole())) {\n                                    count++;\n                                }\n                            }\n                        }\n\n                        if (count < minOccurrences) {\n                            results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                                     \"'\" + outgoingNode.getContent().getId() + \"' needs a minimum '\" + minOccurrences + \"' of '\" + cr.getRole() + \"' edges. Found '\" + count + \"'.\"));\n                        } else if (count > maxOccurrences) {\n                            results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                                     \"'\" + outgoingNode.getContent().getId() + \"' can have a maximum  '\" + maxOccurrences + \"' of '\" + cr.getRole() + \"' edges. Found '\" + count + \"'.\"));\n                        }\n                    }\n                }\n            }\n\n            //Check incoming connections\n            if (incomingNode.getContent().getRoles().contains(rule.getRole())) {\n                for (CardinalityRule.ConnectorRule cr : rule.getIncomingConnectionRules()) {\n                    if (cr.getRole().equals(edge.getRole())) {\n                        final long minOccurrences = cr.getMinOccurrences();\n                        final long maxOccurrences = cr.getMaxOccurrences();\n                        long count = (operation == Operation.ADD ? 1 : -1);\n                        for (BpmnEdge e : incomingNode.getInEdges()) {\n                            if (e instanceof BpmnEdge) {\n                                final BpmnEdge be = (BpmnEdge) e;\n                                if (be.getRole().equals(edge.getRole())) {\n                                    count++;\n                                }\n                            }\n                        }\n\n                        if (count < minOccurrences) {\n                            results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                                     \"'\" + incomingNode.getContent().getId() + \"' needs a minimum '\" + minOccurrences + \"' of '\" + cr.getRole() + \"' edges. Found '\" + count + \"'.\"));\n                        } else if (count > maxOccurrences) {\n                            results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                                     \"'\" + incomingNode.getContent().getId() + \"' can have a maximum  '\" + maxOccurrences + \"' of '\" + cr.getRole() + \"' edges. Found '\" + count + \"'.\"));\n                        }\n                    }\n                }\n            }\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/java/org/uberfire/ext/wires/bpmn/client/type/BpmnResourceType.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.ext.wires.bpmn.api.category.Process;\nimport org.uberfire.ext.wires.bpmn.api.type.BpmnResourceTypeDefinition;\nimport org.uberfire.ext.wires.bpmn.client.resources.BpmnEditorResources;\nimport org.uberfire.ext.wires.bpmn.client.resources.i18n.BpmnEditorConstants;\n\n@ApplicationScoped\npublic class BpmnResourceType\n        extends BpmnResourceTypeDefinition\n        implements ClientResourceType {\n\n    private static final Image IMAGE = new Image(BpmnEditorResources.INSTANCE.images().typeBpmn());\n\n    public BpmnResourceType() {\n    }\n\n    @Inject\n    public BpmnResourceType(final Process category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return IMAGE;\n    }\n\n    @Override\n    public String getDescription() {\n        String desc = BpmnEditorConstants.INSTANCE.bpmnResourceTypeDescription();\n        if (desc == null || desc.isEmpty()) {\n            return super.getDescription();\n        }\n        return desc;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.bpmn.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/WiresBpmnClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n  <inherits name=\"org.uberfire.ext.editor.commons.UberfireCommonsEditorClient\"/>\n\n  <source path=\"client\"></source>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/css/bpmn.css",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nbpmnResourceTypeDescription=BPMN Definitions\nbpmnPerspectiveTitle=BPMN Authoring\nbpmnExplorerTitle=BPMN Explorer\nbpmnExplorerNoFilesFound=--- No files found ---\nbpmnExplorerNoFilesOpen=Open\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=BPMN Editor"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_de.properties",
    "content": "bpmnResourceTypeDescription=BPMN Definitionen\nbpmnPerspectiveTitle=BPMN Authoring\nbpmnExplorerTitle=BPMN Explorer\nbpmnExplorerNoFilesFound=--- Keine Dateien gefunden ---\nbpmnExplorerNoFilesOpen=Öffnen\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=BPMN Editor\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_es.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nbpmnResourceTypeDescription=Definiciones de BPMN\nbpmnPerspectiveTitle=Autoría de BPMN\nbpmnExplorerTitle=Explorador de BPMN\nbpmnExplorerNoFilesFound=--- No se encontraron archivos ---\nbpmnExplorerNoFilesOpen=Abrir\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=Editor de BPMN"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_fr.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nbpmnResourceTypeDescription=Définitions BPMN\nbpmnPerspectiveTitle=Création BPMN\nbpmnExplorerTitle=Explorateur BPMN\nbpmnExplorerNoFilesFound=--- Aucun fichier trouvé ---\nbpmnExplorerNoFilesOpen=Ouvrir\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=Éditeur BPMN"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_it.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nbpmnResourceTypeDescription=Definizioni BPMN\nbpmnPerspectiveTitle=Creazione BPMN\nbpmnExplorerTitle=Esploratore BPMN\nbpmnExplorerNoFilesFound=--- Nessun file trovato ---\nbpmnExplorerNoFilesOpen=Apri\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=Editor BPMN\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_ja.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nbpmnResourceTypeDescription=BPMN 定義\nbpmnPerspectiveTitle=BPMN オーサリング\nbpmnExplorerTitle=BPMN エクスプローラー\nbpmnExplorerNoFilesFound=--- ファイルは見つかりませんでした ---\nbpmnExplorerNoFilesOpen=開く\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=BPMN エディター"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_pt_BR.properties",
    "content": "bpmnResourceTypeDescription=Definições BPMN\nbpmnPerspectiveTitle=Criação BPMN\nbpmnExplorerTitle=Explorador BPMN\nbpmnExplorerNoFilesFound=--- Nenhum arquivo encontrado ---\nbpmnExplorerNoFilesOpen=Abrir\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=Editor BPMN\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/main/resources/org/uberfire/ext/wires/bpmn/client/resources/i18n/BpmnEditorConstants_zh_CN.properties",
    "content": "bpmnResourceTypeDescription=BPMN 定义\nbpmnPerspectiveTitle=BPMN 编写\nbpmnExplorerTitle=BPMN 浏览器\nbpmnExplorerNoFilesFound=--- 未找到文件 ---\nbpmnExplorerNoFilesOpen=打开\nbpmnExplorerFileUrl=URL\nbpmnEditorTitle=BPMN 编辑器\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/AbstractBaseRuleTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraph;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.CardinalityRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.ConnectionRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.ContainmentRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.CardinalityRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.ConnectionRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\n\nimport static org.junit.Assert.*;\n\n/**\n * Base for Rule related tests\n */\npublic abstract class AbstractBaseRuleTest {\n\n    protected Set<Rule> getContainmentRules() {\n        final Set<Rule> rules = new HashSet<Rule>();\n        rules.add(new ContainmentRuleImpl(\"Process Node Containment Rule\",\n                                          new ProcessNode().getContent().getId(),\n                                          new HashSet<Role>() {{\n                                              add(new DefaultRoleImpl(\"all\"));\n                                          }}));\n        return rules;\n    }\n\n    protected Set<Rule> getCardinalityRules() {\n        final Set<Rule> rules = new HashSet<Rule>();\n        rules.add(new CardinalityRuleImpl(\"Start Node Cardinality Rule\",\n                                          new DefaultRoleImpl(\"sequence_start\"),\n                                          0,\n                                          1,\n                                          Collections.EMPTY_SET,\n                                          new HashSet<CardinalityRule.ConnectorRule>() {{\n                                              add(new CardinalityRule.ConnectorRule() {\n                                                  @Override\n                                                  public long getMinOccurrences() {\n                                                      return 0;\n                                                  }\n\n                                                  @Override\n                                                  public long getMaxOccurrences() {\n                                                      return 1;\n                                                  }\n\n                                                  @Override\n                                                  public Role getRole() {\n                                                      return new DefaultRoleImpl(\"general_edge\");\n                                                  }\n\n                                                  @Override\n                                                  public String getName() {\n                                                      return \"Start Node Outgoing Connector Rule 1\";\n                                                  }\n                                              });\n                                          }}));\n        rules.add(new CardinalityRuleImpl(\"End Node Cardinality Rule\",\n                                          new DefaultRoleImpl(\"sequence_end\"),\n                                          0,\n                                          1,\n                                          new HashSet<CardinalityRule.ConnectorRule>() {{\n                                              add(new CardinalityRule.ConnectorRule() {\n                                                  @Override\n                                                  public long getMinOccurrences() {\n                                                      return 0;\n                                                  }\n\n                                                  @Override\n                                                  public long getMaxOccurrences() {\n                                                      return 1;\n                                                  }\n\n                                                  @Override\n                                                  public Role getRole() {\n                                                      return new DefaultRoleImpl(\"general_edge\");\n                                                  }\n\n                                                  @Override\n                                                  public String getName() {\n                                                      return \"End Node Incoming Connector Rule 1\";\n                                                  }\n                                              });\n                                          }},\n                                          Collections.EMPTY_SET));\n        return rules;\n    }\n\n    protected Set<Rule> getConnectionRules() {\n        final Set<Rule> rules = new HashSet<Rule>();\n        rules.add(new ConnectionRuleImpl(\"StartNode to TestDummyNode Connector Rule\",\n                                         new DefaultRoleImpl(\"general_edge\"),\n                                         new HashSet<ConnectionRule.PermittedConnection>() {{\n                                             add(new ConnectionRule.PermittedConnection() {\n                                                 @Override\n                                                 public Role getStartRole() {\n                                                     return new DefaultRoleImpl(\"sequence_start\");\n                                                 }\n\n                                                 @Override\n                                                 public Role getEndRole() {\n                                                     return new DefaultRoleImpl(\"dummy\");\n                                                 }\n                                             });\n                                             add(new ConnectionRule.PermittedConnection() {\n                                                 @Override\n                                                 public Role getStartRole() {\n                                                     return new DefaultRoleImpl(\"dummy\");\n                                                 }\n\n                                                 @Override\n                                                 public Role getEndRole() {\n                                                     return new DefaultRoleImpl(\"sequence_end\");\n                                                 }\n                                             });\n                                             add(new ConnectionRule.PermittedConnection() {\n                                                 @Override\n                                                 public Role getStartRole() {\n                                                     return new DefaultRoleImpl(\"dummy\");\n                                                 }\n\n                                                 @Override\n                                                 public Role getEndRole() {\n                                                     return new DefaultRoleImpl(\"dummy\");\n                                                 }\n                                             });\n                                         }}));\n        return rules;\n    }\n\n    protected void assertProcessContainsNodes(final BpmnGraph graph,\n                                              final BpmnGraphNode... nodes) {\n        final Set<BpmnGraphNode> nodesToExist = new HashSet<BpmnGraphNode>();\n        for (BpmnGraphNode node : nodes) {\n            nodesToExist.add(node);\n        }\n        for (BpmnGraphNode gn : graph) {\n            for (BpmnGraphNode node : nodes) {\n                if (gn.equals(node)) {\n                    nodesToExist.remove(node);\n                }\n            }\n        }\n        if (!nodesToExist.isEmpty()) {\n            final StringBuffer sb = new StringBuffer(\"Not all GraphNodes were present in Graph.\\n\");\n            for (BpmnGraphNode node : nodesToExist) {\n                sb.append(\"--> Not present: GraphNode [\" + node.toString() + \"].\\n\");\n            }\n            fail(sb.toString());\n        }\n    }\n\n    protected void assertProcessNotContainsNodes(final BpmnGraph graph,\n                                                 final BpmnGraphNode... nodes) {\n        final Set<BpmnGraphNode> nodesToNotExist = new HashSet<BpmnGraphNode>();\n        for (BpmnGraphNode gn : graph) {\n            for (BpmnGraphNode node : nodes) {\n                if (gn.equals(node)) {\n                    nodesToNotExist.add(node);\n                }\n            }\n        }\n        if (!nodesToNotExist.isEmpty()) {\n            final StringBuffer sb = new StringBuffer(\"One or more GraphNodes were present in Graph.\\n\");\n            for (BpmnGraphNode node : nodesToNotExist) {\n                sb.append(\"--> Present: GraphNode [\" + node.toString() + \"].\\n\");\n            }\n            fail(sb.toString());\n        }\n    }\n\n    protected void assertNodeContainsOutgoingEdges(final BpmnGraphNode node,\n                                                   final BpmnEdge... edges) {\n        final Set<BpmnEdge> edgesToExist = new HashSet<BpmnEdge>();\n        for (BpmnEdge edge : edges) {\n            edgesToExist.add(edge);\n        }\n        for (BpmnEdge edge : node.getOutEdges()) {\n            for (BpmnEdge be : edges) {\n                if (be.equals(edge)) {\n                    edgesToExist.remove(edge);\n                }\n            }\n        }\n        if (!edgesToExist.isEmpty()) {\n            final StringBuffer sb = new StringBuffer(\"Not all Edges were present in GraphNode Outgoing connections.\\n\");\n            for (BpmnEdge edge : edgesToExist) {\n                sb.append(\"--> Not present: Edge [\" + edge.toString() + \"].\\n\");\n            }\n            fail(sb.toString());\n        }\n    }\n\n    protected void assertNodeContainsIncomingEdges(final BpmnGraphNode node,\n                                                   final BpmnEdge... edges) {\n        final Set<BpmnEdge> edgesToExist = new HashSet<BpmnEdge>();\n        for (BpmnEdge edge : edges) {\n            edgesToExist.add(edge);\n        }\n        for (BpmnEdge edge : node.getInEdges()) {\n            for (BpmnEdge be : edges) {\n                if (be.equals(edge)) {\n                    edgesToExist.remove(edge);\n                }\n            }\n        }\n        if (!edgesToExist.isEmpty()) {\n            final StringBuffer sb = new StringBuffer(\"Not all Edges were present in GraphNode Incoming connections.\\n\");\n            for (BpmnEdge edge : edgesToExist) {\n                sb.append(\"--> Not present: Edge [\" + edge.toString() + \"].\\n\");\n            }\n            fail(sb.toString());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/TestDummyNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client;\n\nimport java.util.Collections;\nimport java.util.HashSet;\n\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.Content;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.content.DefaultContentImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.beliefs.graph.impl.GraphNodeImpl;\n\n/**\n * A TestDummyNode that cannot be added to a Process\n */\npublic class TestDummyNode extends GraphNodeImpl<Content, BpmnEdge> implements BpmnGraphNode {\n\n    public TestDummyNode() {\n        setContent(new DefaultContentImpl(\"dummy\",\n                                          \"dummy\",\n                                          \"dummy\",\n                                          new HashSet<Role>() {{\n                                              add(new DefaultRoleImpl(\"dummy\"));\n                                          }},\n                                          Collections.EMPTY_SET));\n    }\n\n    @Override\n    public TestDummyNode copy() {\n        final TestDummyNode copy = new TestDummyNode();\n        copy.setContent(this.getContent().copy());\n        return copy;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/AddEdgeCommandTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.edges.BpmnEdgeImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class AddEdgeCommandTest extends AbstractBaseRuleTest {\n\n    private ProcessNode process;\n    private RuleManager ruleManager;\n    private StartProcessNode node1;\n    private TestDummyNode node2;\n    private EndProcessNode node3;\n    private CommandManager commandManager;\n\n    @Before\n    public void setupNodes() {\n        //Dummy process for each test consists of 3 unconnected nodes\n        //-----------------------------------------------------------\n        //\n        // [StartNode]       [DummyNode]       [EndNode]\n        //\n        process = new ProcessNode();\n        ruleManager = new DefaultRuleManagerImpl();\n        node1 = new StartProcessNode();\n        node2 = new TestDummyNode();\n        node3 = new EndProcessNode();\n        commandManager = new DefaultCommandManagerImpl();\n\n        for (Rule rule : getConnectionRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Add StartProcessNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        //Add TestDummyNode\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n\n        assertNotNull(results2);\n        assertEquals(0,\n                     results2.getMessages().size());\n\n        //Add EndProcessNode\n        final Results results3 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node3));\n\n        assertNotNull(results3);\n        assertEquals(0,\n                     results3.getMessages().size());\n    }\n\n    @Test\n    public void testAddEdgeBetweenStartNodeAndDummyNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        //An Edge with role \"general_edge\" is permitted between StartNode and DummyNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node2,\n                                                                           e1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(1,\n                     node1.getOutEdges().size());\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(0,\n                     node2.getOutEdges().size());\n\n        assertEquals(e1,\n                     node1.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node2.getInEdges().toArray()[0]);\n    }\n\n    @Test\n    public void testAddEdgeBetweenDummyNodeAndEndNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        //An Edge with role \"general_edge\" is permitted between DummyNode and EndNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(0,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n\n        assertEquals(e1,\n                     node2.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node3.getInEdges().toArray()[0]);\n    }\n\n    @Test\n    public void testAddEdgeBetweenStartNodeAndEndNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        //An Edge with role \"general_edge\" is NOT permitted between StartNode and EndNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node3,\n                                                                           e1));\n\n        assertNotNull(results1);\n        assertEquals(1,\n                     results1.getMessages().size());\n        assertEquals(1,\n                     results1.getMessages(ResultType.ERROR).size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(0,\n                     node1.getOutEdges().size());\n        assertEquals(0,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n    }\n\n    @Test\n    public void testStartNodeOutgoingCardinalityAndDummyNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        //An Edge with role \"general_edge\" is permitted between StartNode and DummyNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node2,\n                                                                           e1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(1,\n                     node1.getOutEdges().size());\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(0,\n                     node2.getOutEdges().size());\n\n        assertEquals(e1,\n                     node1.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node2.getInEdges().toArray()[0]);\n\n        //Try to add another Edge with role \"general_edge\" between StartNode and DummyNode. This should not be allowed.\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node2,\n                                                                           e1));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(1,\n                     node1.getOutEdges().size());\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(0,\n                     node2.getOutEdges().size());\n\n        assertEquals(e1,\n                     node1.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node2.getInEdges().toArray()[0]);\n    }\n\n    @Test\n    public void testDummyNodeAndEndNodeIncomingCardinality() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        //An Edge with role \"general_edge\" is permitted between DummyNode and EndNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(0,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n\n        assertEquals(e1,\n                     node2.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node3.getInEdges().toArray()[0]);\n\n        //Try to add another Edge with role \"general_edge\" between DummyNode and EndNode. This should not be allowed.\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e1));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(0,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n\n        assertEquals(e1,\n                     node2.getOutEdges().toArray()[0]);\n        assertEquals(e1,\n                     node3.getInEdges().toArray()[0]);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/AddGraphNodeCommandTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class AddGraphNodeCommandTest extends AbstractBaseRuleTest {\n\n    @Test\n    public void testAddStartProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final StartProcessNode node1 = new StartProcessNode();\n        final StartProcessNode node2 = new StartProcessNode();\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        //Add one Node\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n\n        //Try to add another Node (rules specify maximum as one)\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n        assertProcessNotContainsNodes(process,\n                                      node2);\n    }\n\n    @Test\n    public void testAddEndProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final EndProcessNode node1 = new EndProcessNode();\n        final EndProcessNode node2 = new EndProcessNode();\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        //Add one Node\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n\n        //Try to add another Node (rules specify maximum as one)\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n        assertProcessNotContainsNodes(process,\n                                      node2);\n    }\n\n    @Test\n    public void testAddDummyNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final BpmnGraphNode node = new TestDummyNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n        final Results results = commandManager.execute(ruleManager,\n                                                       new AddGraphNodeCommand(process,\n                                                                               node));\n\n        assertNotNull(results);\n        assertEquals(1,\n                     results.getMessages().size());\n        assertEquals(1,\n                     results.getMessages(ResultType.ERROR).size());\n\n        assertEquals(0,\n                     process.size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/BatchCommandTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.edges.BpmnEdgeImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class BatchCommandTest extends AbstractBaseRuleTest {\n\n    private ProcessNode process;\n    private RuleManager ruleManager;\n    private StartProcessNode node1;\n    private TestDummyNode node2;\n    private EndProcessNode node3;\n    private BpmnEdge e1;\n    private BpmnEdge e2;\n    private CommandManager commandManager;\n\n    @Before\n    public void setupNodes() {\n        //Dummy process for each test consists of 3 connected nodes\n        //---------------------------------------------------------\n        //\n        // [StartNode]--e1-->[DummyNode]--e2-->[EndNode]\n        //\n        process = new ProcessNode();\n        ruleManager = new DefaultRuleManagerImpl();\n        node1 = new StartProcessNode();\n        node2 = new TestDummyNode();\n        node3 = new EndProcessNode();\n        commandManager = new DefaultCommandManagerImpl();\n\n        for (Rule rule : getConnectionRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Add StartProcessNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        //Add TestDummyNode\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n\n        assertNotNull(results2);\n        assertEquals(0,\n                     results2.getMessages().size());\n\n        //Add EndProcessNode\n        final Results results3 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node3));\n\n        assertNotNull(results3);\n        assertEquals(0,\n                     results3.getMessages().size());\n\n        //Add Edge between StartNode and DummyNode1\n        e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results4 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node2,\n                                                                           e1));\n\n        assertNotNull(results4);\n        assertEquals(0,\n                     results4.getMessages().size());\n\n        //Add Edge between DummyNode2 and EndNode\n        e2 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results5 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e2));\n\n        assertNotNull(results5);\n        assertEquals(0,\n                     results5.getMessages().size());\n    }\n\n    @Test\n    public void testBatchAddValidState() {\n        // Add two more TestDummyNodes and related Edges to the existing graph. This is valid.\n        final TestDummyNode testNode1 = new TestDummyNode();\n        final TestDummyNode testNode2 = new TestDummyNode();\n        final BpmnEdge testEdge1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final BpmnEdge testEdge2 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final AddGraphNodeCommand testCmd1 = new AddGraphNodeCommand(process,\n                                                                     testNode1);\n        final AddGraphNodeCommand testCmd2 = new AddGraphNodeCommand(process,\n                                                                     testNode2);\n        final AddEdgeCommand testCmd3 = new AddEdgeCommand(node2,\n                                                           testNode1,\n                                                           testEdge1);\n        final AddEdgeCommand testCmd4 = new AddEdgeCommand(testNode1,\n                                                           testNode2,\n                                                           testEdge2);\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new BatchCommand(testCmd1,\n                                                                         testCmd2,\n                                                                         testCmd3,\n                                                                         testCmd4));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(5,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   testNode1,\n                                   testNode2);\n        assertEquals(2,\n                     node2.getOutEdges().size());\n        assertNodeContainsOutgoingEdges(node2,\n                                        e2,\n                                        testEdge1);\n\n        assertEquals(1,\n                     testNode1.getInEdges().size());\n        assertNodeContainsIncomingEdges(testNode1,\n                                        testEdge1);\n        assertEquals(1,\n                     testNode1.getOutEdges().size());\n        assertNodeContainsOutgoingEdges(testNode1,\n                                        testEdge2);\n\n        assertEquals(1,\n                     testNode2.getInEdges().size());\n        assertNodeContainsIncomingEdges(testNode2,\n                                        testEdge2);\n    }\n\n    @Test\n    public void testBatchAddInvalidState1() {\n        // Add one more TestDummyNode and another EndProcessNode plus related Edges to the existing graph.\n        // This is invalid as a Process can only contain one EndProcessNode and hence the batch should fail.\n        final TestDummyNode testNode1 = new TestDummyNode();\n        final EndProcessNode testNode2 = new EndProcessNode();\n        final BpmnEdge testEdge1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final BpmnEdge testEdge2 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final AddGraphNodeCommand testCmd1 = new AddGraphNodeCommand(process,\n                                                                     testNode1);\n        final AddGraphNodeCommand testCmd2 = new AddGraphNodeCommand(process,\n                                                                     testNode2);\n        final AddEdgeCommand testCmd3 = new AddEdgeCommand(node2,\n                                                           testNode1,\n                                                           testEdge1);\n        final AddEdgeCommand testCmd4 = new AddEdgeCommand(testNode1,\n                                                           testNode2,\n                                                           testEdge2);\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new BatchCommand(testCmd1,\n                                                                         testCmd2,\n                                                                         testCmd3,\n                                                                         testCmd4));\n\n        assertNotNull(results1);\n        assertEquals(1,\n                     results1.getMessages().size());\n        assertEquals(1,\n                     results1.getMessages(ResultType.ERROR).size());\n\n        assertEquals(3,\n                     process.size());\n        assertProcessNotContainsNodes(process,\n                                      testNode1,\n                                      testNode2);\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertNodeContainsOutgoingEdges(node2,\n                                        e2);\n\n        assertEquals(0,\n                     testNode1.getInEdges().size());\n        assertEquals(0,\n                     testNode1.getOutEdges().size());\n        assertEquals(0,\n                     testNode2.getInEdges().size());\n    }\n\n    @Test\n    public void testBatchAddInvalidState2() {\n        // Add one more TestDummyNode and related Edges to the existing graph. However we attach the TestDummyNode\n        // to the existing StartProcessNode. This is invalid as a StartProcessNode can only contain one outgoing Edge\n        // and hence the batch should fail.\n        final TestDummyNode testNode1 = new TestDummyNode();\n        final BpmnEdge testEdge1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final AddGraphNodeCommand testCmd1 = new AddGraphNodeCommand(process,\n                                                                     testNode1);\n        final AddEdgeCommand testCmd2 = new AddEdgeCommand(node1,\n                                                           testNode1,\n                                                           testEdge1);\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new BatchCommand(testCmd1,\n                                                                         testCmd2));\n\n        assertNotNull(results1);\n        assertEquals(1,\n                     results1.getMessages().size());\n        assertEquals(1,\n                     results1.getMessages(ResultType.ERROR).size());\n\n        assertEquals(3,\n                     process.size());\n        assertProcessNotContainsNodes(process,\n                                      testNode1);\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertNodeContainsOutgoingEdges(node2,\n                                        e2);\n\n        assertEquals(0,\n                     testNode1.getInEdges().size());\n        assertEquals(0,\n                     testNode1.getOutEdges().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/CommandManagerTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.Collections;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.CardinalityRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class CommandManagerTest extends AbstractBaseRuleTest {\n\n    @Test\n    public void testAddOneNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        final StartProcessNode node1 = new StartProcessNode();\n\n        //Add StartProcessNode to Graph\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n        assertEquals(node1,\n                     process.getNode(node1.getId()));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n    }\n\n    @Test\n    public void testAddTwoNodesToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        final StartProcessNode node1 = new StartProcessNode();\n        final EndProcessNode node2 = new EndProcessNode();\n\n        //Add StartProcessNode to Graph\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n        assertEquals(node1,\n                     process.getNode(node1.getId()));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        //Add EndProcessNode to Graph\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n        assertEquals(node2,\n                     process.getNode(node2.getId()));\n\n        assertNotNull(results2);\n        assertEquals(0,\n                     results2.getMessages().size());\n\n        assertEquals(2,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1,\n                                   node2);\n    }\n\n    @Test\n    public void testAddTwoNodesToProcessThenUndo() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        final StartProcessNode node1 = new StartProcessNode();\n        final EndProcessNode node2 = new EndProcessNode();\n\n        //Add StartProcessNode to Graph\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n\n        //Add EndProcessNode to Graph\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n        assertNotNull(results2);\n        assertEquals(0,\n                     results2.getMessages().size());\n        assertEquals(2,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1,\n                                   node2);\n\n        //Undo last Command\n        commandManager.undo(ruleManager);\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n        assertProcessNotContainsNodes(process,\n                                      node2);\n\n        //Undo last Command\n        commandManager.undo(ruleManager);\n        assertEquals(0,\n                     process.size());\n        assertProcessNotContainsNodes(process,\n                                      node1,\n                                      node2);\n    }\n\n    @Test\n    public void testAddNotPermittedNodesToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        //Set a minimum of 0 and a maximum of 1 node\n        ruleManager.addRule(new CardinalityRuleImpl(\"TestDummyNode Cardinality Rule\",\n                                                    new DefaultRoleImpl(\"dummy\"),\n                                                    0,\n                                                    1,\n                                                    Collections.EMPTY_SET,\n                                                    Collections.EMPTY_SET));\n\n        final TestDummyNode node1 = new TestDummyNode();\n        final TestDummyNode node2 = new TestDummyNode();\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n\n        //Add StartProcessNode to Graph\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n\n        //Add EndProcessNode to Graph\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertProcessContainsNodes(process,\n                                   node1);\n        assertProcessNotContainsNodes(process,\n                                      node2);\n\n        //Undo last Command\n        commandManager.undo(ruleManager);\n        assertEquals(0,\n                     process.size());\n        assertProcessNotContainsNodes(process,\n                                      node1,\n                                      node2);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DeleteEdgeCommandTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.Collections;\nimport java.util.HashSet;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.Role;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.edges.BpmnEdgeImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.CardinalityRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.CardinalityRule;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class DeleteEdgeCommandTest extends AbstractBaseRuleTest {\n\n    private ProcessNode process;\n    private RuleManager ruleManager;\n    private StartProcessNode node1;\n    private TestDummyNode node2;\n    private TestDummyNode node3;\n    private EndProcessNode node4;\n    private BpmnEdge e1;\n    private BpmnEdge e2;\n    private BpmnEdge e3;\n    private BpmnEdge e4;\n    private CommandManager commandManager;\n\n    @Before\n    public void setupNodes() {\n        //Dummy process for each test consists of 3 connected nodes\n        //---------------------------------------------------------\n        //\n        // [StartNode]--e1-->[DummyNode]--e2-->[DummyNode]--e3-->[EndNode]\n        //                   [         ]--e4-->[         ]\n        //\n        process = new ProcessNode();\n        ruleManager = new DefaultRuleManagerImpl();\n        node1 = new StartProcessNode();\n        node2 = new TestDummyNode();\n        node3 = new TestDummyNode();\n        node4 = new EndProcessNode();\n        commandManager = new DefaultCommandManagerImpl();\n\n        for (Rule rule : getConnectionRules()) {\n            ruleManager.addRule(rule);\n        }\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Add StartProcessNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        //Add TestDummyNode\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node2));\n\n        assertNotNull(results2);\n        assertEquals(0,\n                     results2.getMessages().size());\n\n        final Results results3 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node3));\n\n        assertNotNull(results3);\n        assertEquals(0,\n                     results3.getMessages().size());\n\n        //Add EndProcessNode\n        final Results results4 = commandManager.execute(ruleManager,\n                                                        new AddGraphNodeCommand(process,\n                                                                                node4));\n\n        assertNotNull(results4);\n        assertEquals(0,\n                     results4.getMessages().size());\n\n        //Add Edge between StartNode and DummyNode1\n        e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results5 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node1,\n                                                                           node2,\n                                                                           e1));\n\n        assertNotNull(results5);\n        assertEquals(0,\n                     results5.getMessages().size());\n\n        //Add Edge between DummyNode1 and DummyNode2\n        e2 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results6 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e2));\n\n        assertNotNull(results6);\n        assertEquals(0,\n                     results6.getMessages().size());\n\n        //Add Edge between DummyNode2 and EndNode\n        e3 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results7 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node3,\n                                                                           node4,\n                                                                           e3));\n\n        assertNotNull(results7);\n        assertEquals(0,\n                     results7.getMessages().size());\n\n        //Add another Edge between DummyNode1 and DummyNode2\n        e4 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n        final Results results8 = commandManager.execute(ruleManager,\n                                                        new AddEdgeCommand(node2,\n                                                                           node3,\n                                                                           e4));\n\n        assertNotNull(results8);\n        assertEquals(0,\n                     results8.getMessages().size());\n    }\n\n    @Test\n    public void testDeleteEdgeBetweenStartNodeAndDummyNode() {\n        //Delete edge between StartNode and DummyNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node1,\n                                                                              node2,\n                                                                              e1));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(0,\n                     node1.getOutEdges().size());\n        assertEquals(0,\n                     node2.getInEdges().size());\n        assertEquals(2,\n                     node2.getOutEdges().size());\n\n        //Try to delete the same edge between StartNode and DummyNode again\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node1,\n                                                                              node2,\n                                                                              e1));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.WARNING).size());\n\n        assertEquals(0,\n                     node1.getInEdges().size());\n        assertEquals(0,\n                     node1.getOutEdges().size());\n        assertEquals(0,\n                     node2.getInEdges().size());\n        assertEquals(2,\n                     node2.getOutEdges().size());\n    }\n\n    @Test\n    public void testDeleteEdgeBetweenDummyNodeAndEndNode() {\n        //Delete edge between DummyNode and EndNode\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node3,\n                                                                              node4,\n                                                                              e3));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(2,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n        assertEquals(0,\n                     node4.getInEdges().size());\n        assertEquals(0,\n                     node4.getOutEdges().size());\n\n        //Try to delete the same edge between DummyNode and EndNode again\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node3,\n                                                                              node4,\n                                                                              e3));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.WARNING).size());\n\n        assertEquals(2,\n                     node3.getInEdges().size());\n        assertEquals(0,\n                     node3.getOutEdges().size());\n        assertEquals(0,\n                     node4.getInEdges().size());\n        assertEquals(0,\n                     node4.getOutEdges().size());\n    }\n\n    @Test\n    public void testDeleteOutgoingCardinalityOutgoingMinimum() {\n        ruleManager.addRule(new CardinalityRuleImpl(\"DummyNode Outgoing Cardinality Rule\",\n                                                    new DefaultRoleImpl(\"dummy\"),\n                                                    0,\n                                                    2,\n                                                    new HashSet<CardinalityRule.ConnectorRule>() {{\n                                                        add(new CardinalityRule.ConnectorRule() {\n                                                            @Override\n                                                            public long getMinOccurrences() {\n                                                                return 1;\n                                                            }\n\n                                                            @Override\n                                                            public long getMaxOccurrences() {\n                                                                return 2;\n                                                            }\n\n                                                            @Override\n                                                            public Role getRole() {\n                                                                return new DefaultRoleImpl(\"general_edge\");\n                                                            }\n\n                                                            @Override\n                                                            public String getName() {\n                                                                return \"End Node DummyNode Connector Rule 1\";\n                                                            }\n                                                        });\n                                                    }},\n                                                    Collections.EMPTY_SET));\n\n        //Delete edge between DummyNode1 and DummyNode2\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node2,\n                                                                              node3,\n                                                                              e2));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(1,\n                     node3.getOutEdges().size());\n\n        //Try to delete the other edge between DummyNode1 and DummyNode2 again. This should fail validation.\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node2,\n                                                                              node3,\n                                                                              e4));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(1,\n                     node3.getOutEdges().size());\n    }\n\n    @Test\n    public void testDeleteOutgoingCardinalityIncomingMinimum() {\n        ruleManager.addRule(new CardinalityRuleImpl(\"DummyNode Incoming Cardinality Rule\",\n                                                    new DefaultRoleImpl(\"dummy\"),\n                                                    0,\n                                                    2,\n                                                    Collections.EMPTY_SET,\n                                                    new HashSet<CardinalityRule.ConnectorRule>() {{\n                                                        add(new CardinalityRule.ConnectorRule() {\n                                                            @Override\n                                                            public long getMinOccurrences() {\n                                                                return 1;\n                                                            }\n\n                                                            @Override\n                                                            public long getMaxOccurrences() {\n                                                                return 2;\n                                                            }\n\n                                                            @Override\n                                                            public Role getRole() {\n                                                                return new DefaultRoleImpl(\"general_edge\");\n                                                            }\n\n                                                            @Override\n                                                            public String getName() {\n                                                                return \"End Node DummyNode Connector Rule 1\";\n                                                            }\n                                                        });\n                                                    }}));\n\n        //Delete edge between DummyNode1 and DummyNode2\n        final Results results1 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node2,\n                                                                              node3,\n                                                                              e2));\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(1,\n                     node3.getOutEdges().size());\n\n        //Try to delete the other edge between DummyNode1 and DummyNode2 again. This should fail validation.\n        final Results results2 = commandManager.execute(ruleManager,\n                                                        new DeleteEdgeCommand(node2,\n                                                                              node3,\n                                                                              e4));\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n\n        assertEquals(1,\n                     node2.getInEdges().size());\n        assertEquals(1,\n                     node2.getOutEdges().size());\n        assertEquals(1,\n                     node3.getInEdges().size());\n        assertEquals(1,\n                     node3.getOutEdges().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/DeleteGraphNodeCommandTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport java.util.Collections;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.rules.CardinalityRuleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.CommandManager;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\nimport org.uberfire.ext.wires.bpmn.client.rules.impl.DefaultRuleManagerImpl;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class DeleteGraphNodeCommandTest extends AbstractBaseRuleTest {\n\n    @Test\n    public void testDeleteStartProcessNodeFromProcess() {\n        final ProcessNode process = new ProcessNode();\n        final StartProcessNode node = new StartProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        //Set a minimum of 1 node\n        ruleManager.addRule(new CardinalityRuleImpl(\"Start Node Cardinality Rule\",\n                                                    new DefaultRoleImpl(\"sequence_start\"),\n                                                    1,\n                                                    1,\n                                                    Collections.EMPTY_SET,\n                                                    Collections.EMPTY_SET));\n\n        process.addNode(node);\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n        final Results results = commandManager.execute(ruleManager,\n                                                       new DeleteGraphNodeCommand(process,\n                                                                                  node));\n\n        assertNotNull(results);\n        assertEquals(1,\n                     results.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertEquals(node,\n                     process.getNode(node.getId()));\n    }\n\n    @Test\n    public void testDeleteEndProcessNodeFromProcess() {\n        final ProcessNode process = new ProcessNode();\n        final EndProcessNode node = new EndProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        //Set a minimum of 1 node\n        ruleManager.addRule(new CardinalityRuleImpl(\"End Node Cardinality Rule\",\n                                                    new DefaultRoleImpl(\"sequence_end\"),\n                                                    1,\n                                                    1,\n                                                    Collections.EMPTY_SET,\n                                                    Collections.EMPTY_SET));\n\n        process.addNode(node);\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n        final Results results = commandManager.execute(ruleManager,\n                                                       new DeleteGraphNodeCommand(process,\n                                                                                  node));\n\n        assertNotNull(results);\n        assertEquals(1,\n                     results.getMessages().size());\n\n        assertEquals(1,\n                     process.size());\n        assertEquals(node,\n                     process.getNode(node.getId()));\n    }\n\n    @Test\n    public void testDeleteDummyNodeFromProcess() {\n        final ProcessNode process = new ProcessNode();\n        final BpmnGraphNode node = new TestDummyNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        process.addNode(node);\n\n        final CommandManager commandManager = new DefaultCommandManagerImpl();\n        final Results results = commandManager.execute(ruleManager,\n                                                       new DeleteGraphNodeCommand(process,\n                                                                                  node));\n\n        assertNotNull(results);\n        assertEquals(0,\n                     results.getMessages().size());\n\n        assertEquals(0,\n                     process.size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/commands/impl/ResultsTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.commands.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\n\nimport static org.jgroups.util.Util.assertFalse;\nimport static org.jgroups.util.Util.assertTrue;\nimport static org.junit.Assert.*;\n\npublic class ResultsTest {\n\n    @Test\n    public void testNewInstance() {\n        final Results results = new DefaultResultsImpl();\n        assertTrue(results.getMessages().isEmpty());\n        assertTrue(results.getMessages(ResultType.ERROR).isEmpty());\n        assertTrue(results.getMessages(ResultType.WARNING).isEmpty());\n    }\n\n    @Test\n    public void testAdd() {\n        final Results results = new DefaultResultsImpl();\n        results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                 \"An error\"));\n        results.addMessage(new DefaultResultImpl(ResultType.WARNING,\n                                                 \"A warning\"));\n        assertEquals(2,\n                     results.getMessages().size());\n        assertEquals(1,\n                     results.getMessages(ResultType.ERROR).size());\n        assertEquals(1,\n                     results.getMessages(ResultType.WARNING).size());\n    }\n\n    @Test\n    public void testContains() {\n        final Results results = new DefaultResultsImpl();\n        results.addMessage(new DefaultResultImpl(ResultType.ERROR,\n                                                 \"An error\"));\n        assertTrue(results.contains(ResultType.ERROR));\n        assertFalse(results.contains(ResultType.WARNING));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/editor/BpmnEditorPresenterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.bpmn.client.editor;\n\nimport java.util.function.Supplier;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.service.BpmnService;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class BpmnEditorPresenterTest {\n\n    @Mock\n    private BpmnEditorView view;\n\n    @Mock\n    private ProcessNode processNode;\n\n    @Mock\n    private Caller<BpmnService> service;\n\n    @InjectMocks\n    private BpmnEditorPresenter presenter = spy(new BpmnEditorPresenter(view));\n\n    @Test\n    public void testGetContentSupplier() {\n\n        doReturn(processNode).when(presenter).getContent();\n\n        final Supplier<ProcessNode> contentSupplier = presenter.getContentSupplier();\n\n        assertEquals(processNode, contentSupplier.get());\n    }\n\n    @Test\n    public void testGetSaveAndRenameServiceCaller() {\n        assertEquals(service, presenter.getSaveAndRenameServiceCaller());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/rules/impl/CardinalityRulesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.rules.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class CardinalityRulesTest extends AbstractBaseRuleTest {\n\n    @Test\n    public void testAddStartProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final StartProcessNode candidate = new StartProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Try to add a single StartProcessNode\n        final Results results1 = ruleManager.checkCardinality(process,\n                                                              candidate,\n                                                              RuleManager.Operation.ADD);\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n        process.addNode(candidate);\n\n        //Try to add a second StartProcessNode\n        final Results results2 = ruleManager.checkCardinality(process,\n                                                              candidate,\n                                                              RuleManager.Operation.ADD);\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n    }\n\n    @Test\n    public void testAddEndProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final EndProcessNode candidate = new EndProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Try to add a single EndProcessNode.\n        final Results results1 = ruleManager.checkCardinality(process,\n                                                              candidate,\n                                                              RuleManager.Operation.ADD);\n\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n        process.addNode(candidate);\n\n        //Try to add a second EndProcessNode\n        final Results results2 = ruleManager.checkCardinality(process,\n                                                              candidate,\n                                                              RuleManager.Operation.ADD);\n\n        assertNotNull(results2);\n        assertEquals(1,\n                     results2.getMessages().size());\n        assertEquals(1,\n                     results2.getMessages(ResultType.ERROR).size());\n    }\n\n    @Test\n    public void testAddDummyNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final BpmnGraphNode candidate = new TestDummyNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getCardinalityRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Try to add a single TestDummyNode. There are no rules restricting the cardinality of TestDummyNode.\n        final Results results = ruleManager.checkCardinality(process,\n                                                             candidate,\n                                                             RuleManager.Operation.ADD);\n\n        assertNotNull(results);\n        assertEquals(0,\n                     results.getMessages().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/rules/impl/ConnectionRulesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.rules.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnEdge;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.edges.BpmnEdgeImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.roles.DefaultRoleImpl;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class ConnectionRulesTest extends AbstractBaseRuleTest {\n\n    private ProcessNode process;\n    private RuleManager ruleManager;\n    private StartProcessNode node1;\n    private TestDummyNode node2;\n    private EndProcessNode node3;\n\n    @Before\n    public void setupNodes() {\n        process = new ProcessNode();\n        ruleManager = new DefaultRuleManagerImpl();\n        node1 = new StartProcessNode();\n        node2 = new TestDummyNode();\n        node3 = new EndProcessNode();\n\n        for (Rule rule : getConnectionRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        //Add StartProcessNode\n        process.addNode(node1);\n        process.addNode(node2);\n        process.addNode(node3);\n    }\n\n    @Test\n    public void testAddEdgeBetweenStartNodeAndDummyNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        final Results results1 = ruleManager.checkConnectionRules(node1,\n                                                                  node2,\n                                                                  e1);\n\n        //An Edge with role \"general_edge\" is permitted between StartNode and DummyNode\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n    }\n\n    @Test\n    public void testAddEdgeBetweenDummyNodeAndEndNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        final Results results1 = ruleManager.checkConnectionRules(node2,\n                                                                  node3,\n                                                                  e1);\n\n        //An Edge with role \"general_edge\" is permitted between DummyNode and EndNode\n        assertNotNull(results1);\n        assertEquals(0,\n                     results1.getMessages().size());\n    }\n\n    @Test\n    public void testAddEdgeBetweenStartNodeAndEndNode() {\n        final BpmnEdge e1 = new BpmnEdgeImpl(new DefaultRoleImpl(\"general_edge\"));\n\n        final Results results1 = ruleManager.checkConnectionRules(node1,\n                                                                  node3,\n                                                                  e1);\n\n        //An Edge with role \"general_edge\" is NOT permitted between StartNode and EndNode\n        assertNotNull(results1);\n        assertEquals(1,\n                     results1.getMessages().size());\n        assertEquals(1,\n                     results1.getMessages(ResultType.ERROR).size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-bpmn/uberfire-wires-bpmn-client/src/test/java/org/uberfire/ext/wires/bpmn/client/rules/impl/ContainmentRulesTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.bpmn.client.rules.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.bpmn.api.model.BpmnGraphNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.EndProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.ProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.impl.nodes.StartProcessNode;\nimport org.uberfire.ext.wires.bpmn.api.model.rules.Rule;\nimport org.uberfire.ext.wires.bpmn.client.AbstractBaseRuleTest;\nimport org.uberfire.ext.wires.bpmn.client.TestDummyNode;\nimport org.uberfire.ext.wires.bpmn.client.commands.ResultType;\nimport org.uberfire.ext.wires.bpmn.client.commands.Results;\nimport org.uberfire.ext.wires.bpmn.client.rules.RuleManager;\n\nimport static junit.framework.Assert.assertEquals;\nimport static junit.framework.Assert.assertNotNull;\n\npublic class ContainmentRulesTest extends AbstractBaseRuleTest {\n\n    @Test\n    public void testAddStartProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final StartProcessNode candidate = new StartProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final Results results = ruleManager.checkContainment(process,\n                                                             candidate);\n\n        assertNotNull(results);\n        assertEquals(0,\n                     results.getMessages().size());\n    }\n\n    @Test\n    public void testAddEndProcessNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final EndProcessNode candidate = new EndProcessNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final Results results = ruleManager.checkContainment(process,\n                                                             candidate);\n\n        assertNotNull(results);\n        assertEquals(0,\n                     results.getMessages().size());\n    }\n\n    @Test\n    public void testAddDummyNodeToProcess() {\n        final ProcessNode process = new ProcessNode();\n        final BpmnGraphNode candidate = new TestDummyNode();\n        final RuleManager ruleManager = new DefaultRuleManagerImpl();\n\n        for (Rule rule : getContainmentRules()) {\n            ruleManager.addRule(rule);\n        }\n\n        final Results results = ruleManager.checkContainment(process,\n                                                             candidate);\n\n        assertNotNull(results);\n        assertEquals(1,\n                     results.getMessages().size());\n        assertEquals(1,\n                     results.getMessages(ResultType.ERROR).size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# GwtTest\ngwt-unitCache\nwww-test\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-core</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire Wires :: Core</name>\n\n  <modules>\n    <module>uberfire-wires-core-api</module>\n    <module>uberfire-wires-core-client</module>\n    <module>uberfire-wires-core-scratchpad</module>\n    <module>uberfire-wires-core-trees</module>\n    <module>uberfire-wires-core-grids</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-core-api</artifactId>\n\n  <name>Uberfire Wires :: Core API</name>\n  <description>Wires Core Api</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/containers/ContainerManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.containers;\n\n/**\n * Manager for Containers and related operations\n */\npublic interface ContainerManager {\n\n    /**\n     * Get the Container that contains the given Canvas co-ordinate\n     * @param cx Canvas X co-ordinate\n     * @param cy Canvas Y co-ordinate\n     * @return A Container or null if the point was not within a Container\n     */\n    WiresContainer getContainer(final double cx,\n                                final double cy);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/containers/RequiresContainerManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.containers;\n\n/**\n * Marker interface indicating an element needs a ContainerManager\n */\npublic interface RequiresContainerManager {\n\n    void setContainerManager(final ContainerManager containerManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/containers/WiresContainer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.containers;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\n\npublic interface WiresContainer extends WiresShape {\n\n    /**\n     * Attach a Shape to the Container\n     * @param shape\n     */\n    void attachShape(final WiresBaseShape shape);\n\n    /**\n     * Detach a Shape from the Container\n     * @param shape\n     */\n    void detachShape(final WiresBaseShape shape);\n\n    /**\n     * Get a list of WiresBaseShape contained within the Container\n     * @return\n     */\n    List<WiresBaseShape> getContainedShapes();\n\n    /**\n     * Signal the Container is being hovered over\n     */\n    void setHover(final boolean isHover);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/controlpoints/ControlPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.controlpoints;\n\nimport com.ait.lienzo.client.core.shape.IPrimitive;\n\npublic interface ControlPoint<T extends IPrimitive<T>> extends IPrimitive<T> {\n\n    String getId();\n\n    ControlPointMoveHandler getHandler();\n\n    void move(final double dx,\n              final double dy);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/controlpoints/ControlPointMoveHandler.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.controlpoints;\n\n/**\n * Handler for when a ControlPoint is moved\n */\npublic interface ControlPointMoveHandler {\n\n    /**\n     * ControlPoint has been moved to (x, y)\n     * @param x\n     * @param y\n     */\n    void onMove(final double x,\n                final double y);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/controlpoints/HasControlPoints.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.controlpoints;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\n\npublic interface HasControlPoints extends WiresShape {\n\n    void addControlPoint(final ControlPoint cp);\n\n    void showControlPoints();\n\n    void hideControlPoints();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ClearEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\npublic class ClearEvent {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ProgressEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\npublic class ProgressEvent {\n\n    private boolean clearProgressBar;\n\n    public ProgressEvent() {\n        clearProgressBar = false;\n    }\n\n    public ProgressEvent(final boolean clearProgressBar) {\n        this.clearProgressBar = clearProgressBar;\n    }\n\n    public boolean isClearProgressBar() {\n        return clearProgressBar;\n    }\n\n    public void setClearProgressBar(final boolean clearProgressBar) {\n        this.clearProgressBar = clearProgressBar;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ShapeAddedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class ShapeAddedEvent {\n\n    private WiresBaseShape shape;\n\n    public ShapeAddedEvent(final WiresBaseShape shape) {\n        this.shape = shape;\n    }\n\n    public WiresBaseShape getShape() {\n        return shape;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ShapeDeletedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class ShapeDeletedEvent {\n\n    private WiresBaseShape shape;\n\n    public ShapeDeletedEvent(final WiresBaseShape shape) {\n        this.shape = shape;\n    }\n\n    public WiresBaseShape getShape() {\n        return shape;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ShapeDragCompleteEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class ShapeDragCompleteEvent {\n\n    private WiresBaseShape shape;\n    private double x;\n    private double y;\n\n    public ShapeDragCompleteEvent(final WiresBaseShape shape,\n                                  final double x,\n                                  final double y) {\n        this.shape = shape;\n        this.x = x;\n        this.y = y;\n    }\n\n    public WiresBaseShape getShape() {\n        return shape;\n    }\n\n    public double getX() {\n        return x;\n    }\n\n    public double getY() {\n        return y;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ShapeDragPreviewEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class ShapeDragPreviewEvent {\n\n    private WiresBaseShape shape;\n    private double x;\n    private double y;\n\n    public ShapeDragPreviewEvent(final WiresBaseShape shape,\n                                 final double x,\n                                 final double y) {\n        this.shape = shape;\n        this.x = x;\n        this.y = y;\n    }\n\n    public WiresBaseShape getShape() {\n        return shape;\n    }\n\n    public double getX() {\n        return x;\n    }\n\n    public double getY() {\n        return y;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/events/ShapeSelectedEvent.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.events;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class ShapeSelectedEvent {\n\n    private WiresBaseShape shape;\n\n    public ShapeSelectedEvent(final WiresBaseShape shape) {\n        this.shape = shape;\n    }\n\n    public WiresBaseShape getShape() {\n        return shape;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/FactoryHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\n/**\n * Helper to identify the exact nature of a Shape being dragged from the Palette into a Canvas. The purpose of this is to\n * allow a single ShapeFactory to create multiple (but similar) different Shapes. For example you might have a ShapeFactory\n * that creates \"Letters of the Alphabet\". It is a single factory and it's \"Shape\" is a single letter. You could add multiple\n * PaletteShapes to the Palette, one for each letter of the alphabet, and use FactoryHelper to specify which letter has been selected.\n */\npublic interface FactoryHelper<T> {\n\n    T getContext();\n\n    void setContext(final T context);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeDragProxy.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\nimport com.ait.lienzo.client.core.shape.Group;\n\n/**\n * Proxy for Shapes being dragged from the Palette\n */\npublic interface ShapeDragProxy {\n\n    /**\n     * Get a Group that is used as the drag proxy\n     * @return\n     */\n    Group getDragGroup();\n\n    /**\n     * Called during the drag operation\n     * @param x\n     * @param y\n     */\n    void onDragPreview(final double x,\n                       final double y);\n\n    /**\n     * Called when the drag operation completes\n     * @param x\n     * @param y\n     */\n    void onDragComplete(final double x,\n                        final double y);\n\n    /**\n     * Height of proxy used to ensure proxy is centered around mouse pointer position\n     * @return\n     */\n    double getHeight();\n\n    /**\n     * Width of proxy used to ensure proxy is centered around mouse pointer position\n     * @return\n     */\n    double getWidth();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeDragProxyCompleteCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\n/**\n * Callback for when a drag event completes\n */\npublic interface ShapeDragProxyCompleteCallback {\n\n    /**\n     * Callback invoked when the drag operation ends\n     * @param x\n     * @param y\n     */\n    void callback(final double x,\n                  final double y);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeDragProxyPreviewCallback.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\n/**\n * Callback for when a drag event completes\n */\npublic interface ShapeDragProxyPreviewCallback {\n\n    /**\n     * Callback invoked when the drag operation ends\n     * @param x\n     * @param y\n     */\n    void callback(final double x,\n                  final double y);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeDropContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\n/**\n * Drop Context for Shapes being dragged from the Palette into a Canvas\n */\npublic interface ShapeDropContext<T> {\n\n    T getContext();\n\n    void setContext(final T context);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\nimport com.ait.lienzo.client.core.shape.Shape;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\n/**\n * Factory for building shapes available for authoring.\n */\npublic interface ShapeFactory<T extends Shape<T>> {\n\n    /**\n     * Get a glyph to represent the Shape. Used by the Palette Screen and Layers Screen\n     * @return\n     */\n    ShapeGlyph getGlyph();\n\n    /**\n     * Get a proxy used during and at the end of a drag operation\n     * @param helper\n     * @param dragPreviewCallback\n     * @param dragEndCallBack\n     * @return\n     */\n    ShapeDragProxy getDragProxy(final FactoryHelper helper,\n                                final ShapeDragProxyPreviewCallback dragPreviewCallback,\n                                final ShapeDragProxyCompleteCallback dragEndCallBack);\n\n    /**\n     * Get a Shape to be created on the Canvas (usually at the end of a drag operation)\n     * @return\n     */\n    WiresBaseShape getShape(final FactoryHelper helper);\n\n    /**\n     * Does the Factory build the given shape type\n     * @param shapeType\n     * @return true is the Factor builds the given type\n     */\n    boolean builds(final WiresBaseShape shapeType);\n\n    /**\n     * Get description of Shape\n     * @return\n     */\n    String getShapeDescription();\n\n    /**\n     * Get category to which Shape belongs\n     * @return\n     */\n    Category getCategory();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/ShapeGlyph.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories;\n\nimport com.ait.lienzo.client.core.shape.Group;\n\n/**\n * A Shape Glyph.\n */\npublic interface ShapeGlyph {\n\n    /**\n     * Get the glyph's Group\n     * @return\n     */\n    Group getGroup();\n\n    /**\n     * Get the glyph's width\n     * @return\n     */\n    double getWidth();\n\n    /**\n     * Get the glyph's height\n     * @return\n     */\n    double getHeight();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/factories/categories/Category.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.factories.categories;\n\npublic class Category {\n\n    private String category;\n\n    public Category(final String category) {\n        this.category = category;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Category)) {\n            return false;\n        }\n\n        Category that = (Category) o;\n\n        if (!category.equals(that.category)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return category.hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return \"Category{\" +\n                \"category='\" + category + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/layout/LayoutManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.layout;\n\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\n/**\n * Manager for Layout related operations\n */\npublic interface LayoutManager {\n\n    /**\n     * Get the layout information for the shapes\n     * @param root Root element of the shapes to layout\n     * @return Map of Shape-to-Location information\n     */\n    Map<WiresBaseShape, Point2D> getLayoutInformation(final WiresBaseShape root);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/layout/RequiresLayoutManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.layout;\n\n/**\n * Marker interface indicating an element needs a LayoutManager\n */\npublic interface RequiresLayoutManager {\n\n    void setLayoutManager(final LayoutManager layoutManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/magnets/HasMagnets.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.magnets;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\n\npublic interface HasMagnets extends WiresShape {\n\n    /**\n     * Get a list of Magnets associated with the Shape\n     * @return\n     */\n    List<Magnet> getMagnets();\n\n    /**\n     * Add a Magnet to the Shape\n     * @param m\n     */\n    void addMagnet(final Magnet m);\n\n    /**\n     * Show Magnets\n     */\n    void showMagnetsPoints();\n\n    /**\n     * Hide Magnets\n     */\n    void hideMagnetPoints();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/magnets/Magnet.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.magnets;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\n\npublic interface Magnet<T extends IPrimitive<T>> extends IPrimitive<T> {\n\n    /**\n     * Get UUID for Magnet\n     * @return\n     */\n    String getId();\n\n    /**\n     * Attach a ControlPoint to the Magnet\n     * @param controlPoint\n     */\n    void attachControlPoint(final ControlPoint controlPoint);\n\n    /**\n     * Detach a ControlPoint from the Magnet\n     * @param controlPoint\n     */\n    void detachControlPoint(final ControlPoint controlPoint);\n\n    /**\n     * Get a list of ControlPoints attached to the Magnet\n     * @return\n     */\n    List<ControlPoint> getAttachedControlPoints();\n\n    /**\n     * Activate the Magnet\n     * @param isActive\n     */\n    void setActive(final boolean isActive);\n\n    void move(final double dx,\n              final double dy);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/magnets/MagnetManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.magnets;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\n\n/**\n * Manager for Magnets and related operations\n */\npublic interface MagnetManager {\n\n    void hideAllMagnets();\n\n    Magnet getMagnet(final WiresShape shapeActive,\n                     final double cx,\n                     final double cy);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/magnets/RequiresMagnetManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.magnets;\n\n/**\n * Marker interface indicating an element needs a MagnetManager\n */\npublic interface RequiresMagnetManager {\n\n    void setMagnetManager(final MagnetManager magnetManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/properties/PropertyEditorAdaptor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.properties;\n\nimport java.util.List;\n\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\n/**\n * Adaptor to convert to and from a Shapes attributes and the PropertyEditor's model.\n */\npublic interface PropertyEditorAdaptor {\n\n    boolean supports(final WiresBaseShape shape);\n\n    List<PropertyEditorCategory> getProperties(final WiresBaseShape shape);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/selection/RequiresSelectionManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.selection;\n\n/**\n * Marker interface indicating an element needs a SelectionManager\n */\npublic interface RequiresSelectionManager {\n\n    public void setSelectionManager(final SelectionManager manager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/selection/SelectionManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.selection;\n\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\n/**\n * Mediator for Shape related operations\n */\npublic interface SelectionManager {\n\n    public void clearSelection();\n\n    public void selectShape(final WiresBaseShape shape);\n\n    public void deselectShape(final WiresBaseShape shape);\n\n    boolean isShapeSelected();\n\n    WiresBaseShape getSelectedShape();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/OverridesFactoryDescription.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\n/**\n * ShapeFactory provides the means for Shapes to define a generic description (e.g. Circle, Rectangle). This interface\n * allows for a Shape to declare it provides it's own naming implementation; supporting different instances of\n * a Shape to have different descriptions.\n */\npublic interface OverridesFactoryDescription {\n\n    /**\n     * Get Description of specific Shape instance; overriding the generic description provides by Factories\n     * @return\n     */\n    String getDescription();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/RequiresShapesManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\n/**\n * Marker interface indicating an element needs a ShapesManager\n */\npublic interface RequiresShapesManager {\n\n    void setShapesManager(final ShapesManager shapesManager);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/ShapesManager.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\nimport java.util.List;\n\npublic interface ShapesManager {\n\n    /**\n     * Get a list of all Shapes on the Canvas\n     * @return\n     */\n    List<WiresBaseShape> getShapesInCanvas();\n\n    /**\n     * Add a Shape to the Canvas\n     * @param shape\n     */\n    void addShape(final WiresBaseShape shape);\n\n    /**\n     * Delete a Shape from the Canvas. Implementations may prompt the User for confirmation.\n     * @param shape\n     */\n    void deleteShape(final WiresBaseShape shape);\n\n    /**\n     * Forcefully delete a Shape from the Canvas. This allows deletion of Shapes without prompting the User for confirmation.\n     * @param shape\n     */\n    void forceDeleteShape(final WiresBaseShape shape);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/WiresBaseDynamicContainer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.event.NodeDragStartEvent;\nimport com.ait.lienzo.client.core.event.NodeDragStartHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\n\n/**\n * A Container that can be re-sized and have connectors attached.\n */\npublic abstract class WiresBaseDynamicContainer extends WiresBaseDynamicShape implements WiresContainer,\n                                                                                         RequiresShapesManager {\n\n    protected ShapesManager shapesManager;\n    private List<WiresBaseShape> children = new ArrayList<WiresBaseShape>();\n    private List<Pair<WiresBaseShape, Point2D>> dragStartLocations = new ArrayList<Pair<WiresBaseShape, Point2D>>();\n\n    public WiresBaseDynamicContainer() {\n        //Record the start location of Children when the Container is dragged. These are\n        //used to calculate the new positions of Children as the Container is dragged\n        addNodeDragStartHandler(new NodeDragStartHandler() {\n            @Override\n            public void onNodeDragStart(final NodeDragStartEvent nodeDragStartEvent) {\n                dragStartLocations.clear();\n                for (WiresBaseShape shape : children) {\n                    dragStartLocations.add(new Pair<WiresBaseShape, Point2D>(shape,\n                                                                             new Point2D(shape.getLocation().getX(),\n                                                                                         shape.getLocation().getY())));\n                }\n            }\n        });\n\n        //As the Container is dragged update the location of the Children,\n        //using their start location and the DragContext DX, DY\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                final double deltaX = nodeDragMoveEvent.getDragContext().getDx();\n                final double deltaY = nodeDragMoveEvent.getDragContext().getDy();\n                final Point2D delta = new Point2D(deltaX,\n                                                  deltaY);\n                for (Pair<WiresBaseShape, Point2D> dragStartLocation : dragStartLocations) {\n                    dragStartLocation.getK1().setLocation(dragStartLocation.getK2().add(delta));\n                }\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setShapesManager(final ShapesManager shapesManager) {\n        this.shapesManager = shapesManager;\n    }\n\n    @Override\n    public void attachShape(final WiresBaseShape shape) {\n        children.add(shape);\n    }\n\n    @Override\n    public void detachShape(final WiresBaseShape shape) {\n        children.remove(shape);\n    }\n\n    @Override\n    public List<WiresBaseShape> getContainedShapes() {\n        return Collections.unmodifiableList(children);\n    }\n\n    @Override\n    public Group setX(final double x) {\n        updateChildrenLocations(x - getX(),\n                                0);\n        return super.setX(x);\n    }\n\n    @Override\n    public Group setY(final double y) {\n        updateChildrenLocations(0,\n                                y - getY());\n        return super.setY(y);\n    }\n\n    protected void updateChildrenLocations(final double deltaX,\n                                           final double deltaY) {\n        if (children == null) {\n            return;\n        }\n        final Point2D delta = new Point2D(deltaX,\n                                          deltaY);\n        for (WiresBaseShape shape : children) {\n            shape.setLocation(shape.getLocation().add(delta));\n        }\n    }\n\n    @Override\n    public void destroy() {\n        super.destroy();\n        for (WiresBaseShape shape : children) {\n            shapesManager.forceDeleteShape(shape);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/WiresBaseDynamicShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.HasControlPoints;\nimport org.uberfire.ext.wires.core.api.magnets.HasMagnets;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\n\n/**\n * A Shape that can be re-sized and have connectors attached. It CANNOT be added to Containers.\n */\npublic abstract class WiresBaseDynamicShape extends WiresBaseShape implements HasMagnets,\n                                                                              HasControlPoints {\n\n    protected List<Magnet> magnets = new ArrayList<Magnet>();\n    protected List<ControlPoint> controlPoints = new ArrayList<ControlPoint>();\n\n    private boolean showingMagnets = false;\n    private boolean showingControlPoints = false;\n\n    public WiresBaseDynamicShape() {\n        //Update Magnets and ControlPoints when the Shape is dragged\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                updateMagnetLocations(0,\n                                      0);\n                updateControlPointLocations(0,\n                                            0);\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void addControlPoint(final ControlPoint cp) {\n        controlPoints.add(cp);\n    }\n\n    @Override\n    public void showControlPoints() {\n        final Layer layer = getLayer();\n        if (!controlPoints.isEmpty() && !showingControlPoints) {\n            for (ControlPoint cp : controlPoints) {\n                layer.add(cp);\n            }\n            showingControlPoints = true;\n            getLayer().batch();\n        }\n    }\n\n    @Override\n    public void hideControlPoints() {\n        final Layer layer = getLayer();\n        if (!controlPoints.isEmpty() && showingControlPoints) {\n            for (ControlPoint cp : controlPoints) {\n                layer.remove(cp);\n            }\n            showingControlPoints = false;\n            getLayer().batch();\n        }\n    }\n\n    @Override\n    public void addMagnet(final Magnet m) {\n        magnets.add(m);\n    }\n\n    @Override\n    public List<Magnet> getMagnets() {\n        return magnets;\n    }\n\n    @Override\n    public void showMagnetsPoints() {\n        final Layer layer = getLayer();\n        if (!magnets.isEmpty() && !showingMagnets) {\n            for (Magnet m : magnets) {\n                layer.add(m);\n            }\n            showingMagnets = true;\n            getLayer().batch();\n        }\n    }\n\n    @Override\n    public void hideMagnetPoints() {\n        final Layer layer = getLayer();\n        if (!magnets.isEmpty() && showingMagnets) {\n            for (Magnet m : magnets) {\n                layer.remove(m);\n            }\n            showingMagnets = false;\n            getLayer().batch();\n        }\n    }\n\n    @Override\n    public void destroy() {\n        hideControlPoints();\n        hideMagnetPoints();\n        super.destroy();\n    }\n\n    @Override\n    public Group setX(final double x) {\n        final double dx = x - getX();\n        final double dy = 0;\n        updateMagnetLocations(dx,\n                              dy);\n        updateControlPointLocations(dx,\n                                    dy);\n        final Group g = super.setX(x);\n        return g;\n    }\n\n    @Override\n    public Group setY(final double y) {\n        final double dx = 0;\n        final double dy = y - getY();\n        updateMagnetLocations(dx,\n                              dy);\n        updateControlPointLocations(dx,\n                                    dy);\n        final Group g = super.setY(y);\n        return g;\n    }\n\n    protected void updateMagnetLocations(final double dx,\n                                         final double dy) {\n        if (magnets == null) {\n            return;\n        }\n        for (Magnet m : magnets) {\n            m.move(dx,\n                   dy);\n        }\n    }\n\n    protected void updateControlPointLocations(final double dx,\n                                               final double dy) {\n        if (controlPoints == null) {\n            return;\n        }\n        for (ControlPoint cp : controlPoints) {\n            cp.move(dx,\n                    dy);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/WiresBaseShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.animation.AnimationProperties;\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.commons.uuid.UUID;\nimport org.uberfire.ext.wires.core.api.selection.RequiresSelectionManager;\nimport org.uberfire.ext.wires.core.api.selection.SelectionManager;\n\n/**\n * A Fixed Shape that cannot be re-sized or have connectors attached\n */\npublic abstract class WiresBaseShape extends Group implements WiresShape,\n                                                              RequiresSelectionManager {\n\n    private static final int ANIMATION_DURATION = 250;\n    private static final int DEFAULT_CONTROL_SPACING = 30;\n    private static final int DEFAULT_CONTROL_POSITION_X_OFFSET = 100;\n    private static final int DEFAULT_CONTROL_POSITION_Y_OFFSET = 0;\n    protected String id;\n    protected SelectionManager selectionManager;\n    protected List<Group> controls = new ArrayList<Group>();\n    protected boolean isControlsVisible = false;\n    private IAnimationHandle animationHandle;\n\n    public WiresBaseShape() {\n        id = UUID.uuid();\n        setDraggable(true);\n\n        //Clicking the Group selects the Shape\n        addNodeMouseClickHandler(new NodeMouseClickHandler() {\n            @Override\n            public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) {\n                selectionManager.selectShape(WiresBaseShape.this);\n            }\n        });\n\n        //Update Control positions when Shape is dragged\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                updateControlLocations();\n            }\n        });\n    }\n\n    @Override\n    public String getId() {\n        return this.id;\n    }\n\n    @Override\n    public void setSelectionManager(final SelectionManager manager) {\n        this.selectionManager = manager;\n    }\n\n    @Override\n    public void showControls() {\n        if (controls == null || controls.isEmpty()) {\n            return;\n        }\n        if (isControlsVisible) {\n            return;\n        }\n        if (animationHandle != null) {\n            animationHandle.stop();\n        }\n        isControlsVisible = true;\n        animationHandle = animate(AnimationTweener.EASE_OUT,\n                                  new AnimationProperties(),\n                                  ANIMATION_DURATION,\n                                  new IAnimationCallback() {\n\n                                      private final AnimationTweener tweener = AnimationTweener.TweenerBuilder.MAKE_ELASTIC(1);\n                                      private final Map<Group, Pair<Point2D, Point2D>> transformations = new HashMap<Group, Pair<Point2D, Point2D>>();\n\n                                      @Override\n                                      public void onStart(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Store required transformations: Control, Current location, Target location\n                                          transformations.clear();\n                                          for (int index = 0; index < controls.size(); index++) {\n                                              final Group ctrl = controls.get(index);\n                                              final Point2D origin = new Point2D(0,\n                                                                                 0);\n                                              final Point2D target = getControlTarget(ctrl);\n                                              transformations.put(ctrl,\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             target));\n                                              WiresBaseShape.this.getLayer().add(ctrl);\n                                              ctrl.setLocation(origin);\n                                              ctrl.setAlpha(0.0);\n                                          }\n                                      }\n\n                                      @Override\n                                      public void onFrame(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          final double pct = tweener.apply(iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent());\n\n                                          //Move each Control along the line between its origin and the target destination\n                                          for (Map.Entry<Group, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                              final Point2D origin = e.getValue().getK1();\n                                              final Point2D target = e.getValue().getK2();\n                                              final double dx = (target.getX() - origin.getX()) * pct;\n                                              final double dy = (target.getY() - origin.getY()) * pct;\n                                              e.getKey().setLocation(new Point2D(origin.getX() + dx,\n                                                                                 origin.getY() + dy).add(WiresBaseShape.this.getLocation()));\n                                          }\n\n                                          for (Group ctrl : controls) {\n                                              ctrl.setAlpha(iAnimation.getPercent());\n                                          }\n\n                                          //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                                          WiresBaseShape.this.getLayer().batch();\n                                      }\n\n                                      @Override\n                                      public void onClose(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Do nothing\n                                      }\n                                  });\n    }\n\n    @Override\n    public void hideControls() {\n        if (controls == null || controls.isEmpty()) {\n            return;\n        }\n        if (!isControlsVisible) {\n            return;\n        }\n        if (animationHandle != null) {\n            animationHandle.stop();\n        }\n        isControlsVisible = false;\n        animationHandle = animate(AnimationTweener.EASE_OUT,\n                                  new AnimationProperties(),\n                                  ANIMATION_DURATION,\n                                  new IAnimationCallback() {\n\n                                      private final AnimationTweener tweener = AnimationTweener.TweenerBuilder.MAKE_EASE_IN(3.0);\n                                      private final Map<Group, Pair<Point2D, Point2D>> transformations = new HashMap<Group, Pair<Point2D, Point2D>>();\n\n                                      @Override\n                                      public void onStart(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Store required transformations: Control, Current location, Target location\n                                          transformations.clear();\n                                          for (int index = 0; index < controls.size(); index++) {\n                                              final Group ctrl = controls.get(index);\n                                              final Point2D origin = ctrl.getLocation();\n                                              origin.minus(WiresBaseShape.this.getLocation());\n                                              final Point2D target = new Point2D(0,\n                                                                                 0);\n                                              transformations.put(ctrl,\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             target));\n                                          }\n                                      }\n\n                                      @Override\n                                      public void onFrame(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          final double pct = tweener.apply(iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent());\n\n                                          //Move each Control along the line between its origin and the target destination\n                                          for (Map.Entry<Group, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                              final Point2D origin = e.getValue().getK1();\n                                              final Point2D target = e.getValue().getK2();\n                                              final double dx = (target.getX() - origin.getX()) * pct;\n                                              final double dy = (target.getY() - origin.getY()) * pct;\n                                              e.getKey().setLocation(new Point2D(origin.getX() + dx,\n                                                                                 origin.getY() + dy).add(WiresBaseShape.this.getLocation()));\n                                          }\n\n                                          for (Group ctrl : controls) {\n                                              ctrl.setAlpha(1.0 - iAnimation.getPercent());\n                                          }\n\n                                          //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                                          WiresBaseShape.this.getLayer().batch();\n                                      }\n\n                                      @Override\n                                      public void onClose(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          for (Group ctrl : controls) {\n                                              WiresBaseShape.this.getLayer().remove(ctrl);\n                                          }\n                                      }\n                                  });\n    }\n\n    @Override\n    public void addControl(final Group ctrlToAdd) {\n        if (!isControlsVisible) {\n            controls.add(ctrlToAdd);\n            return;\n        }\n        final List<Group> newControls = new ArrayList<Group>(controls);\n        newControls.add(ctrlToAdd);\n        setControls(newControls);\n    }\n\n    @Override\n    public void removeControl(final Group ctrlToRemove) {\n        if (!isControlsVisible) {\n            controls.remove(ctrlToRemove);\n            return;\n        }\n        final List<Group> newControls = new ArrayList<Group>(controls);\n        newControls.remove(ctrlToRemove);\n        setControls(newControls);\n    }\n\n    @Override\n    public void setControls(final List<Group> newControls) {\n        if (!isControlsVisible) {\n            controls.clear();\n            controls.addAll(newControls);\n            return;\n        }\n        if (animationHandle != null) {\n            animationHandle.stop();\n        }\n        animationHandle = animate(AnimationTweener.EASE_OUT,\n                                  new AnimationProperties(),\n                                  ANIMATION_DURATION,\n                                  new IAnimationCallback() {\n\n                                      private final List<Group> controlsToAdd = new ArrayList<Group>();\n                                      private final List<Group> controlsToRemove = new ArrayList<Group>();\n                                      private final List<Group> controlsToRemain = new ArrayList<Group>();\n                                      private final AnimationTweener tweener = AnimationTweener.TweenerBuilder.MAKE_ELASTIC(1);\n                                      private final Map<Group, Pair<Point2D, Point2D>> transformations = new HashMap<Group, Pair<Point2D, Point2D>>();\n\n                                      @Override\n                                      public void onStart(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Initialise new Controls being added\n                                          controlsToAdd.clear();\n                                          controlsToAdd.addAll(newControls);\n                                          controlsToAdd.removeAll(controls);\n                                          for (Group ctrl : controlsToAdd) {\n                                              ctrl.setLocation(new Point2D(0,\n                                                                           0));\n                                              ctrl.setAlpha(0.0);\n                                              WiresBaseShape.this.getLayer().add(ctrl);\n                                          }\n\n                                          //Initialise new Controls being removed\n                                          controlsToRemove.clear();\n                                          controlsToRemove.addAll(controls);\n                                          controlsToRemove.removeAll(newControls);\n\n                                          //Initialise remaining Controls\n                                          controlsToRemain.clear();\n                                          controlsToRemain.addAll(controls);\n                                          controlsToRemain.removeAll(controlsToAdd);\n                                          controlsToRemain.removeAll(controlsToRemove);\n\n                                          //Store required transformations: Control, Current location, Target location\n                                          controls.clear();\n                                          controls.addAll(newControls);\n                                          transformations.clear();\n                                          for (Group ctrl : controlsToAdd) {\n                                              final Point2D origin = new Point2D(0,\n                                                                                 0);\n                                              final Point2D target = getControlTarget(ctrl);\n                                              transformations.put(ctrl,\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             target));\n                                          }\n                                          for (Group ctrl : controlsToRemove) {\n                                              final Point2D origin = ctrl.getLocation();\n                                              origin.minus(WiresBaseShape.this.getLocation());\n                                              final Point2D target = new Point2D(0,\n                                                                                 0);\n                                              transformations.put(ctrl,\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             target));\n                                          }\n                                          for (Group ctrl : controlsToRemain) {\n                                              final Point2D origin = ctrl.getLocation();\n                                              origin.minus(WiresBaseShape.this.getLocation());\n                                              final Point2D target = getControlTarget(ctrl);\n                                              transformations.put(ctrl,\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             target));\n                                          }\n                                      }\n\n                                      @Override\n                                      public void onFrame(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          final double pct = tweener.apply(iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent());\n\n                                          //Move each Control along the line between its origin and the target destination\n                                          for (Map.Entry<Group, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                              final Point2D origin = e.getValue().getK1();\n                                              final Point2D target = e.getValue().getK2();\n                                              final double dx = (target.getX() - origin.getX()) * pct;\n                                              final double dy = (target.getY() - origin.getY()) * pct;\n                                              e.getKey().setLocation(new Point2D(origin.getX() + dx,\n                                                                                 origin.getY() + dy).add(WiresBaseShape.this.getLocation()));\n                                          }\n\n                                          for (Group ctrl : controlsToAdd) {\n                                              ctrl.setAlpha(pct);\n                                          }\n                                          for (Group ctrl : controlsToRemove) {\n                                              ctrl.setAlpha(1.0 - pct);\n                                          }\n\n                                          //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                                          WiresBaseShape.this.getLayer().batch();\n                                      }\n\n                                      @Override\n                                      public void onClose(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          isControlsVisible = !controls.isEmpty();\n                                          for (Group ctrl : controlsToRemove) {\n                                              WiresBaseShape.this.getLayer().remove(ctrl);\n                                          }\n                                      }\n                                  });\n    }\n\n    @Override\n    public boolean isControlsVisible() {\n        return this.isControlsVisible;\n    }\n\n    /**\n     * Returns a Point (relative to the WiresShape) where a Control should be placed when Controls\n     * are shown. This default implementation places all Controls at WiresShape.getX()+100 and evenly\n     * spaces the Controls vertically with centres spaced 30px\n     * @param ctrl The Control to position\n     * @return The position of the Control\n     */\n    protected Point2D getControlTarget(final Group ctrl) {\n        final int offsetY = -((controls.size() - 1) * DEFAULT_CONTROL_SPACING) / 2;\n        final Point2D target = new Point2D(DEFAULT_CONTROL_POSITION_X_OFFSET,\n                                           DEFAULT_CONTROL_POSITION_Y_OFFSET + offsetY + (controls.indexOf(ctrl) * DEFAULT_CONTROL_SPACING));\n        return target;\n    }\n\n    @Override\n    public void destroy() {\n        if (isControlsVisible) {\n            for (Group ctrl : controls) {\n                getLayer().remove(ctrl);\n            }\n            isControlsVisible = false;\n        }\n        Layer layer = getLayer();\n        layer.remove(this);\n        layer.batch();\n    }\n\n    //Move the Controls to match where the descendant has been moved\n    private void updateControlLocations() {\n        if (controls == null) {\n            return;\n        }\n        if (!isControlsVisible) {\n            return;\n        }\n        for (Group ctrl : controls) {\n            final Point2D target = getControlTarget(ctrl).add(WiresBaseShape.this.getLocation());\n            ctrl.setLocation(target);\n        }\n    }\n\n    //Move the Controls to match where the descendant has been moved\n    private void updateControlLocations(final double dx,\n                                        final double dy) {\n        if (controls == null) {\n            return;\n        }\n        if (!isControlsVisible) {\n            return;\n        }\n        for (Group ctrl : controls) {\n            ctrl.setLocation(ctrl.getLocation().add(new Point2D(dx,\n                                                                dy)));\n        }\n    }\n\n    @Override\n    public Group setX(final double x) {\n        final double dx = x - super.getX();\n        final Group g = super.setX(x);\n        updateControlLocations(dx,\n                               0);\n        return g;\n    }\n\n    @Override\n    public Group setY(final double y) {\n        final double dy = y - super.getY();\n        final Group g = super.setY(y);\n        updateControlLocations(0,\n                               dy);\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/java/org/uberfire/ext/wires/core/api/shapes/WiresShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.api.shapes;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.Group;\n\npublic interface WiresShape {\n\n    /**\n     * Get UUID for Shape\n     * @return\n     */\n    String getId();\n\n    /**\n     * Select the shape. Implementations may choose to change their appearance\n     */\n    void setSelected(final boolean isSelected);\n\n    /**\n     * Destroy the shape and any related components\n     */\n    void destroy();\n\n    /**\n     * Check whether the Shape contains a point\n     * @param cx Canvas X coordinate\n     * @param cy Canvas Y coordinate\n     * @return\n     */\n    boolean contains(final double cx,\n                     final double cy);\n\n    /**\n     * Add a Control to the WiresShape\n     * @param ctrl\n     */\n    void addControl(final Group ctrl);\n\n    /**\n     * Remove a Control from the WiresShape\n     * @param ctrl\n     */\n    void removeControl(final Group ctrl);\n\n    /**\n     * Set the Controls for the WiresShape\n     * @param controls\n     */\n    void setControls(final List<Group> controls);\n\n    /**\n     * Show Controls related to this WiresShape\n     */\n    void showControls();\n\n    /**\n     * Hide Controls related to this WiresShape\n     */\n    void hideControls();\n\n    /**\n     * Are the Controls associated with this WireShape visible\n     * @return true is the Controls are visible\n     */\n    boolean isControlsVisible();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.core.api.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-api/src/main/resources/org/uberfire/ext/wires/core/WiresCoreApi.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n\t<inherits name='com.google.gwt.user.User' />\n\n  <inherits name=\"com.ait.lienzo.Lienzo\"/>\n\n\t<source path=\"api\"/>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-core-client</artifactId>\n\n  <name>Uberfire Wires :: Core Client</name>\n  <description>Wires Core Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <!-- Property Editor - Uberfire Extensions -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-backend</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/actions/ActionShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.actions;\n\nimport java.io.Serializable;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Picture;\nimport com.ait.lienzo.client.core.shape.Rectangle;\n\npublic class ActionShape extends Group implements Serializable {\n\n    private static final long serialVersionUID = -6555009991474610157L;\n\n    public void setBounding(final Rectangle bounding) {\n        add(bounding);\n    }\n\n    public void setPicture(final Picture picture) {\n        add(picture);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/actions/ActionsGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.actions;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel;\nimport org.uberfire.ext.wires.core.client.palette.PaletteLayoutUtilities;\nimport org.uberfire.ext.wires.core.client.resources.AppResource;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\n@Dependent\npublic class ActionsGroup extends Composite {\n\n    private Layer layer;\n    private LienzoPanel panel;\n\n    @Inject\n    private Event<ClearEvent> clearEvent;\n\n    @Inject\n    private StencilActionBuilder stencilBuilder;\n\n    @PostConstruct\n    public void init() {\n        panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL,\n                                         ShapesUtils.calculateHeight(1));\n        layer = new Layer();\n        panel.getScene().add(layer);\n        initWidget(panel);\n\n        drawActions();\n    }\n\n    private void drawActions() {\n        //Hard-coded list of ActionShapes\n        final List<ActionShape> shapes = new ArrayList<ActionShape>();\n        shapes.add(stencilBuilder.build(getClearCanvasClickHandler(),\n                                        AppResource.INSTANCE.images().clear()));\n        layer.batch();\n\n        //Add ActionShapes to the UI\n        int shapeCount = 1;\n        for (ActionShape shape : shapes) {\n            shape.setX(0);\n            shape.setY(PaletteLayoutUtilities.getY(shapeCount));\n            layer.add(shape);\n            shapeCount++;\n        }\n    }\n\n    private NodeMouseClickHandler getClearCanvasClickHandler() {\n        return new NodeMouseClickHandler() {\n            @Override\n            public void onNodeMouseClick(final NodeMouseClickEvent event) {\n                if (Window.confirm(\"Are you sure to clean the canvas?\")) {\n                    clearEvent.fire(new ClearEvent());\n                }\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/actions/ActionsScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.actions;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WiresActionsScreen\")\npublic class ActionsScreen extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    public SimplePanel actions;\n    @UiField\n    PanelGroup accordion;\n\n    @UiField\n    PanelHeader headerActions;\n\n    @UiField\n    PanelCollapse collapseActions;\n    @Inject\n    private SyncBeanManager iocManager;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        accordion.setId(DOM.createUniqueId());\n        headerActions.setDataParent(accordion.getId());\n        headerActions.setDataTargetWidget(collapseActions);\n\n        actions.add(iocManager.lookupBean(ActionsGroup.class).getInstance());\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Actions\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    interface ViewBinder extends UiBinder<Widget, ActionsScreen> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/actions/ActionsScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <g:SimplePanel>\n    <b:PanelGroup ui:field=\"accordion\">\n      <b:Panel>\n        <b:PanelHeader dataToggle=\"COLLAPSE\" text=\"Canvas Actions\" ui:field=\"headerActions\"/>\n        <b:PanelCollapse ui:field=\"collapseActions\" in=\"true\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"actions\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n  </g:SimplePanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/actions/StencilActionBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.actions;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Picture;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic class StencilActionBuilder {\n\n    private static final int HEIGHT_BOUNDING = 20;\n    private static final int WIDTH_BOUNDING = 20;\n    private static final int HEIGHT_PICTURE = 16;\n    private static final int WIDTH_PICTURE = 16;\n\n    public ActionShape build(final NodeMouseClickHandler clickHandler,\n                             final ImageResource img) {\n        final Rectangle bounding = getBoundingImage(clickHandler);\n        final ActionShape shape = new ActionShape();\n        shape.setBounding(bounding);\n        new Picture(img,\n                    shape::setPicture,\n                    WIDTH_PICTURE,\n                    HEIGHT_PICTURE,\n                    false);\n        return shape;\n    }\n\n    private Rectangle getBoundingImage(final NodeMouseClickHandler clickHandler) {\n        final Rectangle bounding = new Rectangle(WIDTH_BOUNDING,\n                                                 HEIGHT_BOUNDING).setX(0).setY(0).setStrokeColor(ColorName.WHITE.getValue());\n        bounding.addNodeMouseClickHandler(clickHandler);\n        return bounding;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/canvas/FocusableLienzoPanel.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.canvas;\n\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.event.dom.client.DomEvent;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.dom.client.MouseWheelEvent;\nimport com.google.gwt.event.dom.client.MouseWheelHandler;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * LienzoPanel that can take the Focus (and more importantly cause other Widgets to loose the Focus)\n */\npublic class FocusableLienzoPanel extends LienzoPanel {\n\n    public FocusableLienzoPanel(final int width,\n                                final int height) {\n        super(width,\n              height);\n\n        //Basic support to loose focus on other Widgets when a WiresCanvas is clicked\n        addMouseDownHandler(new MouseDownHandler() {\n            @Override\n            public void onMouseDown(final MouseDownEvent event) {\n                broadcastBlurEvent();\n            }\n        });\n        addMouseWheelHandler(new MouseWheelHandler() {\n            @Override\n            public void onMouseWheel(final MouseWheelEvent event) {\n                broadcastBlurEvent();\n            }\n        });\n    }\n\n    protected void broadcastBlurEvent() {\n        final NativeEvent blur = Document.get().createBlurEvent();\n        for (int i = 0; i < RootPanel.get().getWidgetCount(); i++) {\n            final Widget w = RootPanel.get().getWidget(i);\n            DomEvent.fireNativeEvent(blur,\n                                     w);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/canvas/WiresCanvas.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.canvas;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\n\nimport com.ait.lienzo.client.core.shape.GridLayer;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.controlpoints.HasControlPoints;\nimport org.uberfire.ext.wires.core.api.magnets.HasMagnets;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.magnets.MagnetManager;\nimport org.uberfire.ext.wires.core.api.magnets.RequiresMagnetManager;\nimport org.uberfire.ext.wires.core.api.selection.SelectionManager;\nimport org.uberfire.ext.wires.core.api.shapes.RequiresShapesManager;\nimport org.uberfire.ext.wires.core.api.shapes.ShapesManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\nimport org.uberfire.ext.wires.core.client.progressbar.ProgressBar;\n\n/**\n * This is the root Canvas provided by Wires\n */\npublic class WiresCanvas extends Composite implements ShapesManager,\n                                                      SelectionManager,\n                                                      MagnetManager {\n\n    public static final int DEFAULT_SIZE_WIDTH = 1000;\n    public static final int DEFAULT_SIZE_HEIGHT = 1000;\n    protected Layer canvasLayer = new Layer();\n    protected List<WiresBaseShape> shapesInCanvas = new ArrayList<WiresBaseShape>();\n    private FocusableLienzoPanel panel;\n    private WiresBaseShape selectedShape;\n    private ProgressBar progressBar;\n\n    @PostConstruct\n    public void init() {\n        panel = new FocusableLienzoPanel(DEFAULT_SIZE_WIDTH,\n                                         DEFAULT_SIZE_HEIGHT);\n\n        initWidget(panel);\n\n        //Grid...\n        Line line1 = new Line(0,\n                              0,\n                              0,\n                              0).setStrokeColor(ColorName.BLUE).setAlpha(0.5); // primary lines\n        Line line2 = new Line(0,\n                              0,\n                              0,\n                              0).setStrokeColor(ColorName.GREEN).setAlpha(0.5); // secondary dashed-lines\n        line2.setDashArray(2,\n                           2);\n\n        GridLayer gridLayer = new GridLayer(100,\n                                            line1,\n                                            25,\n                                            line2);\n        panel.setBackgroundLayer(gridLayer);\n\n        panel.getScene().add(canvasLayer);\n    }\n\n    public boolean hasProgressBar() {\n        return this.progressBar != null;\n    }\n\n    public ProgressBar getProgressBar() {\n        return this.progressBar;\n    }\n\n    public void setProgressBar(final ProgressBar progressBar) {\n        this.progressBar = progressBar;\n        canvasLayer.add(progressBar);\n        canvasLayer.batch();\n    }\n\n    @Override\n    public List<WiresBaseShape> getShapesInCanvas() {\n        return Collections.unmodifiableList(this.shapesInCanvas);\n    }\n\n    @Override\n    public void addShape(final WiresBaseShape shape) {\n        //Attach relevant handlers\n        shape.setSelectionManager(this);\n        if (shape instanceof RequiresShapesManager) {\n            ((RequiresShapesManager) shape).setShapesManager(this);\n        }\n        if (shape instanceof RequiresMagnetManager) {\n            ((RequiresMagnetManager) shape).setMagnetManager(this);\n        }\n\n        canvasLayer.add(shape);\n        shapesInCanvas.add(shape);\n\n        //Containers are always at the bottom of the render stack\n        if (shape instanceof WiresContainer) {\n            shape.moveToBottom();\n        }\n\n        canvasLayer.batch();\n    }\n\n    @Override\n    public void deleteShape(final WiresBaseShape shape) {\n        shape.destroy();\n        deselectShape(shape);\n        canvasLayer.remove(shape);\n        shapesInCanvas.remove(shape);\n        canvasLayer.batch();\n    }\n\n    @Override\n    public void forceDeleteShape(final WiresBaseShape shape) {\n        deleteShape(shape);\n    }\n\n    public void clear() {\n        //Detach Shapes in Containers; as destroying a Container automatically destroys it's contained Shapes\n        //This sounds as though we need not worry about those, however \"shapesInCanvas\" this means we cannot\n        //simply iterate over \"shapesInCanvas\" as it's content changes as Shapes are destroyed.\n        for (WiresShape shape : shapesInCanvas) {\n            if (shape instanceof WiresContainer) {\n                final WiresContainer wc = (WiresContainer) shape;\n                for (WiresBaseShape bc : wc.getContainedShapes()) {\n                    wc.detachShape(bc);\n                }\n            }\n        }\n\n        //Now it's safe to destroy all Shapes\n        for (WiresShape shape : shapesInCanvas) {\n            shape.destroy();\n            canvasLayer.remove((IPrimitive<?>) shape);\n        }\n        clearSelection();\n        shapesInCanvas.clear();\n        panel.getViewport().setPixelSize(DEFAULT_SIZE_WIDTH,\n                                         DEFAULT_SIZE_HEIGHT);\n        panel.getViewport().draw();\n    }\n\n    @Override\n    public void clearSelection() {\n        selectedShape = null;\n        for (WiresShape shape : getShapesInCanvas()) {\n            shape.setSelected(false);\n            if (shape instanceof HasControlPoints) {\n                ((HasControlPoints) shape).hideControlPoints();\n            }\n            if (shape instanceof HasMagnets) {\n                ((HasMagnets) shape).hideMagnetPoints();\n            }\n        }\n        canvasLayer.batch();\n    }\n\n    @Override\n    public void selectShape(final WiresBaseShape shape) {\n        if (shape == null) {\n            return;\n        }\n        if (shape.equals(selectedShape)) {\n            return;\n        }\n        clearSelection();\n        selectedShape = shape;\n        selectedShape.setSelected(true);\n        if (shape instanceof HasControlPoints) {\n            ((HasControlPoints) selectedShape).showControlPoints();\n        }\n        canvasLayer.batch();\n    }\n\n    @Override\n    public void deselectShape(final WiresBaseShape shape) {\n        if (shape == null) {\n            return;\n        }\n        selectedShape = null;\n        if (shape instanceof HasControlPoints) {\n            ((HasControlPoints) shape).hideControlPoints();\n        }\n        if (shape instanceof HasMagnets) {\n            ((HasMagnets) shape).hideMagnetPoints();\n        }\n        canvasLayer.batch();\n    }\n\n    @Override\n    public boolean isShapeSelected() {\n        return selectedShape != null;\n    }\n\n    @Override\n    public WiresBaseShape getSelectedShape() {\n        return selectedShape;\n    }\n\n    @Override\n    public void hideAllMagnets() {\n        for (WiresShape shape : getShapesInCanvas()) {\n            if (shape instanceof HasMagnets) {\n                final HasMagnets mShape = (HasMagnets) shape;\n                mShape.hideMagnetPoints();\n            }\n        }\n    }\n\n    @Override\n    public Magnet getMagnet(final WiresShape activeShape,\n                            final double cx,\n                            final double cy) {\n        if (activeShape == null) {\n            return null;\n        }\n\n        Magnet selectedMagnet = null;\n        double finalDistance = Double.MAX_VALUE;\n        for (WiresShape shape : getShapesInCanvas()) {\n            if (!shape.getId().equals(activeShape.getId())) {\n                if (shape instanceof HasMagnets) {\n                    final HasMagnets mShape = (HasMagnets) shape;\n                    if (shape.contains(cx,\n                                       cy)) {\n                        mShape.showMagnetsPoints();\n                        final List<Magnet> magnets = mShape.getMagnets();\n                        for (Magnet magnet : magnets) {\n                            magnet.setActive(false);\n\n                            double deltaX = cx - magnet.getX();\n                            double deltaY = cy - magnet.getY();\n                            double distance = Math.sqrt(Math.pow(deltaX,\n                                                                 2) + Math.pow(deltaY,\n                                                                               2));\n\n                            if (finalDistance > distance) {\n                                finalDistance = distance;\n                                if (selectedMagnet != null) {\n                                    selectedMagnet.setActive(false);\n                                }\n                                selectedMagnet = magnet;\n                            }\n                        }\n                        if (selectedMagnet != null) {\n                            selectedMagnet.setActive(true);\n                        }\n                    } else {\n                        mShape.hideMagnetPoints();\n                    }\n                }\n            }\n        }\n\n        return selectedMagnet;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/controlpoints/ConnectibleControlPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.controlpoints;\n\nimport com.ait.lienzo.client.core.event.NodeDragEndEvent;\nimport com.ait.lienzo.client.core.event.NodeDragEndHandler;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.controlpoints.HasControlPoints;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.magnets.MagnetManager;\n\n/**\n * A Control Point that can be connected to Magnets\n */\npublic class ConnectibleControlPoint extends DefaultControlPoint {\n\n    private static final int MAGNET_ATTRACTION = 30;\n    private final HasControlPoints shape;\n    private final MagnetManager magnetManager;\n    private Magnet boundMagnet;\n\n    public ConnectibleControlPoint(final double x,\n                                   final double y,\n                                   final HasControlPoints shape,\n                                   final MagnetManager magnetManager,\n                                   final ControlPointMoveHandler cpMoveHandler) {\n        super(x,\n              y,\n              cpMoveHandler);\n        this.shape = shape;\n        this.magnetManager = magnetManager;\n    }\n\n    @Override\n    protected void setupHandlers(final ControlPointMoveHandler handler) {\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                handler.onMove(ConnectibleControlPoint.this.getX(),\n                               ConnectibleControlPoint.this.getY());\n\n                if (boundMagnet != null) {\n                    boundMagnet.detachControlPoint(ConnectibleControlPoint.this);\n                }\n\n                boundMagnet = magnetManager.getMagnet(shape,\n                                                      ConnectibleControlPoint.this.getX(),\n                                                      ConnectibleControlPoint.this.getY());\n\n                getLayer().batch();\n            }\n        });\n\n        addNodeDragEndHandler(new NodeDragEndHandler() {\n\n            @Override\n            public void onNodeDragEnd(final NodeDragEndEvent nodeDragEndEvent) {\n                if (boundMagnet != null) {\n                    double deltaX = getX() - boundMagnet.getX();\n                    double deltaY = getY() - boundMagnet.getY();\n                    double distance = Math.sqrt(Math.pow(deltaX,\n                                                         2) + Math.pow(deltaY,\n                                                                       2));\n                    if (distance < MAGNET_ATTRACTION) {\n                        boundMagnet.attachControlPoint(ConnectibleControlPoint.this);\n                        final double x = boundMagnet.getX();\n                        final double y = boundMagnet.getY();\n                        setX(x);\n                        setY(y);\n                        handler.onMove(x,\n                                       y);\n                    }\n                }\n                magnetManager.hideAllMagnets();\n\n                getLayer().batch();\n            }\n        });\n    }\n\n    public Magnet getBoundMagnet() {\n        return boundMagnet;\n    }\n\n    @Override\n    public String toString() {\n        return \"ConnectibleControlPoint{\" + \"id=\" + getId() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/controlpoints/DefaultControlPoint.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.controlpoints;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Circle;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.commons.uuid.UUID;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\n/**\n * Default ControlPoint that informs the registered handler of changes to state\n */\npublic class DefaultControlPoint extends Circle implements ControlPoint<Circle> {\n\n    private static final int RADIUS = 8;\n\n    private final String id;\n    private final ControlPointMoveHandler cpMoveHandler;\n\n    public DefaultControlPoint(final double x,\n                               final double y,\n                               final ControlPointMoveHandler cpMoveHandler) {\n        super(RADIUS);\n        this.id = UUID.uuid();\n        this.cpMoveHandler = cpMoveHandler;\n\n        setFillColor(ShapesUtils.CP_RGB_FILL_COLOR);\n        setStrokeWidth(ShapesUtils.CP_RGB_STROKE_WIDTH_SHAPE);\n        setX(x);\n        setY(y);\n        setDraggable(true);\n\n        setupHandlers(cpMoveHandler);\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public ControlPointMoveHandler getHandler() {\n        return cpMoveHandler;\n    }\n\n    @Override\n    public void move(final double dx,\n                     final double dy) {\n        setLocation(getLocation().add(new Point2D(dx,\n                                                  dy)));\n    }\n\n    protected void setupHandlers(final ControlPointMoveHandler moveHandler) {\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                moveHandler.onMove(DefaultControlPoint.this.getX(),\n                                   DefaultControlPoint.this.getY());\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultControlPoint{\" + \"id=\" + id + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/AbstractBaseFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Shape;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxy;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxyCompleteCallback;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxyPreviewCallback;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.factories.ShapeGlyph;\n\n/**\n * Base implementation of a ShapeFactory to avoid unnecessary boiler-plate code\n */\npublic abstract class AbstractBaseFactory<T extends Shape<T>> implements ShapeFactory<T> {\n\n    @Override\n    public ShapeGlyph getGlyph() {\n        final T shape = makeShape();\n        final Group group = new Group();\n        group.add(shape);\n\n        return new ShapeGlyph() {\n            @Override\n            public Group getGroup() {\n                return group;\n            }\n\n            @Override\n            public double getWidth() {\n                return AbstractBaseFactory.this.getWidth();\n            }\n\n            @Override\n            public double getHeight() {\n                return AbstractBaseFactory.this.getHeight();\n            }\n        };\n    }\n\n    @Override\n    public ShapeDragProxy getDragProxy(final @SuppressWarnings(\"unused\") FactoryHelper helper,\n                                       final ShapeDragProxyPreviewCallback dragPreviewCallback,\n                                       final ShapeDragProxyCompleteCallback dragEndCallBack) {\n        final T shape = makeShape();\n        final Group group = new Group();\n        group.add(shape);\n\n        return new ShapeDragProxy() {\n            @Override\n            public Group getDragGroup() {\n                return group;\n            }\n\n            @Override\n            public void onDragPreview(final double x,\n                                      final double y) {\n                dragPreviewCallback.callback(x,\n                                             y);\n            }\n\n            @Override\n            public void onDragComplete(final double x,\n                                       final double y) {\n                dragEndCallBack.callback(x,\n                                         y);\n            }\n\n            @Override\n            public double getWidth() {\n                return AbstractBaseFactory.this.getWidth();\n            }\n\n            @Override\n            public double getHeight() {\n                return AbstractBaseFactory.this.getHeight();\n            }\n        };\n    }\n\n    protected abstract T makeShape();\n\n    protected abstract double getWidth();\n\n    protected abstract double getHeight();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/ShapeFactoryCache.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\n\n/**\n * A cache of Factories\n */\n@ApplicationScoped\npublic class ShapeFactoryCache {\n\n    @Inject\n    private SyncBeanManager iocManager;\n\n    private Set<ShapeFactory> factories = new HashSet<ShapeFactory>();\n\n    @PostConstruct\n    private void setup() {\n        this.factories = getAvailableFactories();\n    }\n\n    public Set<ShapeFactory> getShapeFactories() {\n        return Collections.unmodifiableSet(factories);\n    }\n\n    public void addShapeFactory(final ShapeFactory factory) {\n        factories.add(PortablePreconditions.checkNotNull(\"factory\",\n                                                         factory));\n    }\n\n    private Set<ShapeFactory> getAvailableFactories() {\n        final Set<ShapeFactory> factories = new HashSet<ShapeFactory>();\n        final Collection<SyncBeanDef<ShapeFactory>> factoryBeans = iocManager.lookupBeans(ShapeFactory.class);\n        for (SyncBeanDef<ShapeFactory> factoryBean : factoryBeans) {\n            factories.add(factoryBean.getInstance());\n        }\n        return factories;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/StringFactoryHelper.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories;\n\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\n\n/**\n * Implementation of a FactoryHelper that has a String context\n */\npublic class StringFactoryHelper implements FactoryHelper<String> {\n\n    private String context;\n\n    public StringFactoryHelper(final String context) {\n        this.context = context;\n    }\n\n    @Override\n    public String getContext() {\n        return this.context;\n    }\n\n    @Override\n    public void setContext(final String context) {\n        this.context = context;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/categories/ConnectorCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories.categories;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class ConnectorCategory extends Category {\n\n    public static final ConnectorCategory CATEGORY = new ConnectorCategory();\n\n    private ConnectorCategory() {\n        super(\"Connectors\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/categories/ContainerCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories.categories;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class ContainerCategory extends Category {\n\n    public static final ContainerCategory CATEGORY = new ContainerCategory();\n\n    private ContainerCategory() {\n        super(\"Containers\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/categories/FixedShapeCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories.categories;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class FixedShapeCategory extends Category {\n\n    public static final FixedShapeCategory CATEGORY = new FixedShapeCategory();\n\n    private FixedShapeCategory() {\n        super(\"Fixed Shapes\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/factories/categories/ShapeCategory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.factories.categories;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class ShapeCategory extends Category {\n\n    public static final ShapeCategory CATEGORY = new ShapeCategory();\n\n    private ShapeCategory() {\n        super(\"Shapes\");\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/layers/LayerShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.layers;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\n\npublic class LayerShape extends Group {\n\n    /**\n     * Add a bounding Rectangle to the LayerShape.\n     * @param bounding If null this parameter is ignored\n     */\n    public void setBounding(final Rectangle bounding) {\n        if (bounding != null) {\n            add(bounding);\n        }\n    }\n\n    /**\n     * Add a Group to the LayerShape.\n     * @param group If null this parameter is ignored\n     */\n    public void setGroup(final Group group) {\n        if (group != null) {\n            add(group);\n        }\n    }\n\n    /**\n     * Add Text to the LayerShape.\n     * @param description If null this parameter is ignored\n     */\n    public void setDescription(final Text description) {\n        if (description != null) {\n            add(description);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/layers/LayersGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.layers;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\n\n@Dependent\npublic class LayersGroup extends Composite {\n\n    private Layer layer;\n    private LienzoPanel panel;\n    private List<LayerShape> stencils = new ArrayList<LayerShape>();\n    private List<WiresBaseShape> shapes = new ArrayList<WiresBaseShape>();\n\n    @Inject\n    private StencilLayerBuilder stencilBuilder;\n\n    @PostConstruct\n    public void init() {\n        panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL,\n                                         ShapeFactoryUtil.HEIGHT_PANEL);\n        super.initWidget(panel);\n        layer = new Layer();\n        panel.getScene().add(layer);\n    }\n\n    public void addShape(final WiresBaseShape shape,\n                         final ShapeFactory factory) {\n        final LayerShape stencil = stencilBuilder.build(shape,\n                                                        factory);\n        shapes.add(shape);\n        stencils.add(stencil);\n\n        //Add LayerShape to the UI\n        stencil.setX(0);\n        stencil.setY((ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER + 5) * (shapes.size() - 1));\n        layer.add(stencil);\n        layer.batch();\n    }\n\n    public void deleteShape(final WiresBaseShape shape) {\n        //Remove from UI\n        final int index = shapes.indexOf(shape);\n        layer.remove(stencils.get(index));\n        shapes.remove(index);\n        stencils.remove(index);\n\n        int shapeCount = 0;\n        for (LayerShape stencil : stencils) {\n            stencil.setY((ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER + 5) * shapeCount);\n            shapeCount++;\n        }\n        layer.batch();\n    }\n\n    public void clearPanel() {\n        shapes.clear();\n        stencils.clear();\n        layer.removeAll();\n        layer.batch();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/layers/LayersScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.layers;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeAddedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDeletedEvent;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.ShapeFactoryCache;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WiresLayersScreen\")\npublic class LayersScreen extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    public SimplePanel layers;\n    @UiField\n    PanelGroup accordion;\n\n    @UiField\n    PanelHeader headerLayers;\n\n    @UiField\n    PanelCollapse collapseLayers;\n    @Inject\n    private LayersGroup layersGroup;\n    @Inject\n    private ShapeFactoryCache factoriesCache;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        accordion.setId(DOM.createUniqueId());\n        headerLayers.setDataParent(accordion.getId());\n        headerLayers.setDataTargetWidget(collapseLayers);\n\n        layers.add(layersGroup);\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Layers\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    public void onShapeAdded(@Observes ShapeAddedEvent shapeAddedEvent) {\n        final WiresBaseShape shape = shapeAddedEvent.getShape();\n        for (ShapeFactory factory : factoriesCache.getShapeFactories()) {\n            if (factory.builds(shape)) {\n                layersGroup.addShape(shape,\n                                     factory);\n            }\n        }\n    }\n\n    public void onShapeDeleted(@Observes ShapeDeletedEvent shapeDeletedEvent) {\n        final WiresBaseShape shape = shapeDeletedEvent.getShape();\n        layersGroup.deleteShape(shape);\n    }\n\n    public void onClear(@Observes ClearEvent event) {\n        layersGroup.clearPanel();\n    }\n\n    interface ViewBinder extends UiBinder<Widget, LayersScreen> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/layers/LayersScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:style>\n    .layers {\n      padding: 5px;\n    }\n  </ui:style>\n\n  <g:SimplePanel styleName=\"{style.layers}\">\n    <b:PanelGroup ui:field=\"accordion\">\n      <b:Panel>\n        <b:PanelHeader dataToggle=\"COLLAPSE\" text=\"Layers\" ui:field=\"headerLayers\"/>\n        <b:PanelCollapse ui:field=\"collapseLayers\" in=\"true\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"layers\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n  </g:SimplePanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/layers/StencilLayerBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.layers;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.factories.ShapeGlyph;\nimport org.uberfire.ext.wires.core.api.shapes.OverridesFactoryDescription;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\n\n@ApplicationScoped\npublic class StencilLayerBuilder extends Composite {\n\n    private static final int GLYPH_WIDTH = 25;\n    private static final int GLYPH_HEIGHT = 25;\n\n    @Inject\n    private Event<ShapeSelectedEvent> shapeSelectedEvent;\n\n    public LayerShape build(final WiresBaseShape shape,\n                            final ShapeFactory factory) {\n        final LayerShape layerShape = new LayerShape();\n        final Rectangle bounding = drawBoundingBox();\n        final ShapeGlyph glyph = factory.getGlyph();\n\n        //Get display name to show in Panel\n        final String name = (shape instanceof OverridesFactoryDescription) ? ((OverridesFactoryDescription) shape).getDescription() : factory.getShapeDescription();\n        final Text description = drawDescription(name);\n\n        //Clicking on the Shape selects it - Lienzo doesn't support bubbling click events down through\n        //overlapping items as it uses a bitmap SelectionLayer to detect mouse-clicks. Therefore we need\n        //to attach the handler to all elements\n        final NodeMouseClickHandler handler = new NodeMouseClickHandler() {\n            @Override\n            public void onNodeMouseClick(final NodeMouseClickEvent nodeMouseClickEvent) {\n                shapeSelectedEvent.fire(new ShapeSelectedEvent(shape));\n            }\n        };\n        layerShape.addNodeMouseClickHandler(handler);\n\n        //Build Layer Shape\n        layerShape.setBounding(bounding);\n        layerShape.setDescription(description);\n        layerShape.setGroup(scaleGlyph(glyph));\n\n        return layerShape;\n    }\n\n    private Group scaleGlyph(final ShapeGlyph glyph) {\n        final double sx = GLYPH_WIDTH / glyph.getWidth();\n        final double sy = GLYPH_HEIGHT / glyph.getHeight();\n        final Group group = glyph.getGroup();\n        return group.setX(ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER / 2).setY(ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER / 2).setScale(sx,\n                                                                                                                                sy);\n    }\n\n    private Rectangle drawBoundingBox() {\n        final Rectangle boundingBox = new Rectangle(ShapeFactoryUtil.WIDTH_BOUNDING_LAYER,\n                                                    ShapeFactoryUtil.HEIGHT_BOUNDING_LAYER);\n        boundingBox.setStrokeColor(ShapeFactoryUtil.RGB_STROKE_BOUNDING)\n                .setStrokeWidth(1)\n                .setFillColor(ShapeFactoryUtil.RGB_FILL_BOUNDING)\n                .setDraggable(false);\n        return boundingBox;\n    }\n\n    private Text drawDescription(final String description) {\n        Text text = new Text(description,\n                             ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION,\n                             ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);\n        text.setFillColor(ShapeFactoryUtil.RGB_TEXT_DESCRIPTION);\n        text.setTextBaseLine(TextBaseLine.MIDDLE);\n        text.setX(40);\n        text.setY(15);\n        return text;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/magnets/DefaultMagnet.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage org.uberfire.ext.wires.core.client.magnets;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.commons.uuid.UUID;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class DefaultMagnet extends Circle implements Magnet<Circle> {\n\n    private static final int RADIUS = 8;\n\n    private final String id;\n    private final List<ControlPoint> attachedControlPoints = new ArrayList<ControlPoint>();\n\n    public DefaultMagnet(final double x,\n                         final double y) {\n        super(RADIUS);\n        this.id = UUID.uuid();\n\n        setFillColor(ShapesUtils.MAGNET_RGB_FILL_SHAPE);\n        setStrokeWidth(ShapesUtils.CP_RGB_STROKE_WIDTH_SHAPE);\n        setX(x);\n        setY(y);\n        setDraggable(false);\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n\n    @Override\n    public void attachControlPoint(final ControlPoint controlPoint) {\n        attachedControlPoints.add(controlPoint);\n    }\n\n    @Override\n    public void detachControlPoint(final ControlPoint controlPoint) {\n        attachedControlPoints.remove(controlPoint);\n    }\n\n    @Override\n    public List<ControlPoint> getAttachedControlPoints() {\n        return attachedControlPoints;\n    }\n\n    @Override\n    public void setActive(final boolean isActive) {\n        if (isActive) {\n            setFillColor(ShapesUtils.MAGNET_ACTIVE_RGB_FILL_SHAPE);\n        } else {\n            setFillColor(ShapesUtils.MAGNET_RGB_FILL_SHAPE);\n        }\n    }\n\n    @Override\n    public Circle setX(final double x) {\n        final Circle c = super.setX(x);\n        moveAttachedControlPoints();\n        return c;\n    }\n\n    @Override\n    public Circle setY(final double y) {\n        final Circle c = super.setY(y);\n        moveAttachedControlPoints();\n        return c;\n    }\n\n    @Override\n    public Circle setLocation(final Point2D p) {\n        final Circle c = super.setLocation(p);\n        moveAttachedControlPoints();\n        return c;\n    }\n\n    @Override\n    public void move(final double dx,\n                     final double dy) {\n        setLocation(getLocation().add(new Point2D(dx,\n                                                  dy)));\n    }\n\n    protected void moveAttachedControlPoints() {\n        final List<ControlPoint> controlPoints = getAttachedControlPoints();\n        if (controlPoints == null || controlPoints.isEmpty()) {\n            return;\n        }\n        for (ControlPoint cp : controlPoints) {\n            final double dx = getX();\n            final double dy = getY();\n            cp.setX(dx);\n            cp.setY(dy);\n            cp.getHandler().onMove(dx,\n                                   dy);\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultMagnet{\" + \"id=\" + id + '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/BaseGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.client.canvas.FocusableLienzoPanel;\nimport org.uberfire.ext.wires.core.client.factories.ShapeFactoryCache;\nimport org.uberfire.ext.wires.core.client.factories.StringFactoryHelper;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic abstract class BaseGroup extends Composite {\n\n    private Layer layer;\n    private LienzoPanel panel;\n\n    @Inject\n    private ShapeFactoryCache factoriesCache;\n\n    @Inject\n    private StencilPaletteBuilder stencilBuilder;\n\n    @PostConstruct\n    public void init() {\n        panel = new FocusableLienzoPanel(ShapeFactoryUtil.WIDTH_PANEL,\n                                         ShapesUtils.calculateHeight(ShapesUtils.getNumberOfShapesInCategory(getCategory(),\n                                                                                                             factoriesCache.getShapeFactories())));\n        layer = new Layer();\n        panel.getScene().add(layer);\n        initWidget(panel);\n\n        drawStencils();\n    }\n\n    public abstract Category getCategory();\n\n    protected void drawStencils() {\n        //Get PaletteShape for each Factory\n        final Category category = getCategory();\n        final List<PaletteShape> shapes = new ArrayList<PaletteShape>();\n        for (ShapeFactory factory : factoriesCache.getShapeFactories()) {\n            if (factory.getCategory().equals(category)) {\n                shapes.add(stencilBuilder.build(panel,\n                                                new StringFactoryHelper(factory.getShapeDescription()),\n                                                factory));\n            }\n        }\n\n        //Add PaletteShapes to the UI\n        int shapeCount = 1;\n        for (PaletteShape shape : shapes) {\n            shape.setX(PaletteLayoutUtilities.getX(shapeCount));\n            shape.setY(PaletteLayoutUtilities.getY(shapeCount));\n            layer.add(shape);\n            shapeCount++;\n        }\n\n        layer.batch();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/ConnectorsGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.client.factories.categories.ConnectorCategory;\n\n@Dependent\npublic class ConnectorsGroup extends BaseGroup {\n\n    @Override\n    public Category getCategory() {\n        return ConnectorCategory.CATEGORY;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/ContainersGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.client.factories.categories.ContainerCategory;\n\n@Dependent\npublic class ContainersGroup extends BaseGroup {\n\n    @Override\n    public Category getCategory() {\n        return ContainerCategory.CATEGORY;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/FixedShapesGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.client.factories.categories.FixedShapeCategory;\n\n@Dependent\npublic class FixedShapesGroup extends BaseGroup {\n\n    @Override\n    public Category getCategory() {\n        return FixedShapeCategory.CATEGORY;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/PaletteLayoutUtilities.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\n\n/**\n * Helper to calculate the (x, y) of a PaletteShape to be added to a Panel\n */\npublic class PaletteLayoutUtilities {\n\n    public static double getX(final int shapeNumber) {\n        return calculateX(shapeNumber);\n    }\n\n    public static double getY(final int shapeNumber) {\n        return calculateY(shapeNumber);\n    }\n\n    private static int calculateX(final int shapeNumber) {\n        int x = shapeNumber > 1 ? (getPositionInRow(shapeNumber) - 1) : 0;\n        return x > 0 ? (ShapeFactoryUtil.WIDTH_BOUNDING * x) + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING * x : ShapeFactoryUtil.WIDTH_BOUNDING * x;\n    }\n\n    private static int calculateY(final int shapeNumber) {\n        int y = shapeNumber > 1 ? getRow(shapeNumber) : 0;\n        return y > 0 ? (y * ShapeFactoryUtil.HEIGHT_BOUNDING) + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING * y : y * ShapeFactoryUtil.HEIGHT_BOUNDING;\n    }\n\n    private static int getRow(final int shapeNumber) {\n        return Math.round((shapeNumber * ShapeFactoryUtil.WIDTH_BOUNDING) / ShapeFactoryUtil.WIDTH_STENCIL);\n    }\n\n    private static int shapesByRow() {\n        return Math.round(ShapeFactoryUtil.WIDTH_STENCIL / ShapeFactoryUtil.WIDTH_BOUNDING);\n    }\n\n    private static int getPositionInRow(final int shapeNumber) {\n        return (shapeNumber - shapesByRow()) >= 1 ? (shapeNumber - (shapesByRow() * getRow(shapeNumber))) : shapeNumber;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/PaletteScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.PanelCollapse;\nimport org.gwtbootstrap3.client.ui.PanelGroup;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WiresPaletteScreen\")\npublic class PaletteScreen extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    public SimplePanel categoryShapes;\n    @UiField\n    public SimplePanel categoryFixedShapes;\n    @UiField\n    public SimplePanel categoryConnectors;\n    @UiField\n    public SimplePanel categoryContainers;\n    @UiField\n    public PanelGroup accordion;\n    @UiField\n    public PanelHeader headerCategoryShapes;\n    @UiField\n    public PanelCollapse collapseCategoryShapes;\n    @UiField\n    public PanelHeader headerCategoryFixedShapes;\n    @UiField\n    public PanelCollapse collapseCategoryFixedShapes;\n    @UiField\n    public PanelHeader headerCategoryConnectors;\n    @UiField\n    public PanelCollapse collapseCategoryConnectors;\n    @UiField\n    public PanelHeader headerCategoryContainers;\n    @UiField\n    public PanelCollapse collapseCategoryContainers;\n    @Inject\n    private ShapesGroup shapesGroup;\n    @Inject\n    private FixedShapesGroup fixedShapesGroup;\n    @Inject\n    private ConnectorsGroup connectorsGroup;\n    @Inject\n    private ContainersGroup containersGroup;\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        accordion.setId(DOM.createUniqueId());\n        headerCategoryShapes.setDataParent(accordion.getId());\n        headerCategoryShapes.setDataTargetWidget(collapseCategoryShapes);\n        headerCategoryFixedShapes.setDataParent(accordion.getId());\n        headerCategoryFixedShapes.setDataTargetWidget(collapseCategoryFixedShapes);\n        headerCategoryConnectors.setDataParent(accordion.getId());\n        headerCategoryConnectors.setDataTargetWidget(collapseCategoryConnectors);\n        headerCategoryContainers.setDataParent(accordion.getId());\n        headerCategoryContainers.setDataTargetWidget(collapseCategoryContainers);\n\n        categoryShapes.setWidget(shapesGroup);\n        categoryFixedShapes.setWidget(fixedShapesGroup);\n        categoryConnectors.setWidget(connectorsGroup);\n        categoryContainers.setWidget(containersGroup);\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Palette\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    interface ViewBinder extends UiBinder<Widget, PaletteScreen> {\n\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/PaletteScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:style>\n    .palette {\n      padding: 5px;\n    }\n  </ui:style>\n\n  <g:SimplePanel styleName=\"{style.palette}\">\n    <b:PanelGroup ui:field=\"accordion\">\n      <b:Panel>\n        <b:PanelHeader ui:field=\"headerCategoryShapes\" dataToggle=\"COLLAPSE\" text=\"Shapes\"/>\n        <b:PanelCollapse ui:field=\"collapseCategoryShapes\" in=\"true\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"categoryShapes\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n\n      <b:Panel>\n        <b:PanelHeader ui:field=\"headerCategoryFixedShapes\" dataToggle=\"COLLAPSE\" text=\"Fixed shapes\"/>\n        <b:PanelCollapse ui:field=\"collapseCategoryFixedShapes\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"categoryFixedShapes\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n\n      <b:Panel>\n        <b:PanelHeader ui:field=\"headerCategoryConnectors\" dataToggle=\"COLLAPSE\" text=\"Connectors\"/>\n        <b:PanelCollapse ui:field=\"collapseCategoryConnectors\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"categoryConnectors\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n\n      <b:Panel>\n        <b:PanelHeader ui:field=\"headerCategoryContainers\" dataToggle=\"COLLAPSE\" text=\"Containers\"/>\n        <b:PanelCollapse ui:field=\"collapseCategoryContainers\">\n          <b:PanelBody>\n            <g:SimplePanel ui:field=\"categoryContainers\"/>\n          </b:PanelBody>\n        </b:PanelCollapse>\n      </b:Panel>\n    </b:PanelGroup>\n  </g:SimplePanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/PaletteShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport java.io.Serializable;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\n\n/**\n * A PaletteShape is an icon and text, bound by a rectangle, used in the Palette.\n */\npublic class PaletteShape extends Group implements Serializable {\n\n    private static final long serialVersionUID = -6555009991474610157L;\n\n    /**\n     * Add a bounding Rectangle to the PaletteShape.\n     * @param bounding If null this parameter is ignored\n     */\n    public void setBounding(final Rectangle bounding) {\n        if (bounding != null) {\n            add(bounding);\n        }\n    }\n\n    /**\n     * Add a Group to the PaletteShape.\n     * @param group If null this parameter is ignored\n     */\n    public void setGroup(final Group group) {\n        if (group != null) {\n            add(group);\n        }\n    }\n\n    /**\n     * Add Text to the PaletteShape.\n     * @param description If null this parameter is ignored\n     */\n    public void setDescription(final Text description) {\n        if (description != null) {\n            add(description);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/ShapesGroup.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.client.factories.categories.ShapeCategory;\n\n@Dependent\npublic class ShapesGroup extends BaseGroup {\n\n    @Override\n    public Category getCategory() {\n        return ShapeCategory.CATEGORY;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/palette/StencilPaletteBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.palette;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDownHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragCompleteEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragPreviewEvent;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxy;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxyCompleteCallback;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDragProxyPreviewCallback;\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.factories.ShapeGlyph;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.util.ShapeFactoryUtil;\n\n@ApplicationScoped\npublic class StencilPaletteBuilder {\n\n    private static final int ZINDEX = Integer.MAX_VALUE;\n    private static final double GLYPH_WIDTH = 65;\n    private static final double GLYPH_HEIGHT = 65;\n\n    @Inject\n    private Event<ShapeDragCompleteEvent> shapeDragCompleteEvent;\n\n    @Inject\n    private Event<ShapeDragPreviewEvent> shapeDragPreviewEvent;\n\n    public PaletteShape build(final LienzoPanel dragProxyParentPanel,\n                              final FactoryHelper helper,\n                              final ShapeFactory factory) {\n        final PaletteShape paletteShape = new PaletteShape();\n        final ShapeGlyph glyph = drawGlyph(factory,\n                                           helper);\n        final Text description = drawDescription(factory,\n                                                 helper);\n        final Rectangle bounding = drawBoundingBox(factory,\n                                                   helper);\n\n        //Callback is invoked when the drag operation ends\n        final ShapeDragProxyCompleteCallback dragCompleteCallback = new ShapeDragProxyCompleteCallback() {\n            @Override\n            public void callback(final double x,\n                                 final double y) {\n                shapeDragCompleteEvent.fire(new ShapeDragCompleteEvent(factory.getShape(helper),\n                                                                       x,\n                                                                       y));\n            }\n        };\n\n        //Callback is invoked during the drag operation\n        final WiresBaseShape shape = factory.getShape(helper);\n        final ShapeDragProxyPreviewCallback dragPreviewCallback = new ShapeDragProxyPreviewCallback() {\n            @Override\n            public void callback(final double x,\n                                 final double y) {\n                shapeDragPreviewEvent.fire(new ShapeDragPreviewEvent(shape,\n                                                                     x,\n                                                                     y));\n            }\n        };\n\n        //Attach handles for drag operation\n        final ShapeDragProxy dragProxy = factory.getDragProxy(helper,\n                                                              dragPreviewCallback,\n                                                              dragCompleteCallback);\n        addDragHandlers(dragProxyParentPanel,\n                        dragProxy,\n                        paletteShape);\n\n        //Build Palette Shape\n        paletteShape.setBounding(bounding);\n        paletteShape.setGroup(scaleGlyph(glyph));\n        paletteShape.setDescription(description);\n\n        return paletteShape;\n    }\n\n    /**\n     * Return a ShapeGlyph that represents the Factory in the Palette.\n     * This implementation delegates this to the ShapeFactory.\n     * @param factory ShapeFactory that is capable of providing a default ShapeGlyph\n     * @param helper FactoryHelper that might provide additional information to build a Glyph. Unused by this implementation.\n     * @return A ShapeGlyph object or null if one is not required.\n     */\n    protected ShapeGlyph drawGlyph(final ShapeFactory factory,\n                                   final @SuppressWarnings(\"unused\") FactoryHelper helper) {\n        return factory.getGlyph();\n    }\n\n    /**\n     * Scale the Shape provided by the ShapeFactory as the glyph to fit the PaletteShape.\n     * @param glyph\n     * @return\n     */\n    protected Group scaleGlyph(final ShapeGlyph glyph) {\n        final double sx = GLYPH_WIDTH / glyph.getWidth();\n        final double sy = GLYPH_HEIGHT / glyph.getHeight();\n        final Group group = glyph.getGroup();\n        return group.setX(ShapeFactoryUtil.WIDTH_BOUNDING / 2).setY(ShapeFactoryUtil.WIDTH_BOUNDING / 2).setScale(sx,\n                                                                                                                  sy);\n    }\n\n    /**\n     * Return Text that represents the Factory in the Palette.\n     * This implementation delegates this to the ShapeFactory.\n     * @param factory ShapeFactory that is capable of providing a default description\n     * @param helper FactoryHelper that might provide additional information to build a Glyph. Unused by this implementation.\n     * @return A Text object or null if one is not required.\n     */\n    protected Text drawDescription(final ShapeFactory factory,\n                                   final @SuppressWarnings(\"unused\") FactoryHelper helper) {\n        Text text = new Text(factory.getShapeDescription(),\n                             ShapeFactoryUtil.FONT_FAMILY_DESCRIPTION,\n                             ShapeFactoryUtil.FONT_SIZE_DESCRIPTION);\n        text.setFillColor(ShapeFactoryUtil.RGB_TEXT_DESCRIPTION);\n        text.setTextBaseLine(TextBaseLine.MIDDLE);\n        text.setX(5);\n        text.setY(85);\n        return text;\n    }\n\n    /**\n     * Return a Rectangle that is the bounding box for the PaletteShape.\n     * This implementation does not use the ShapeFactory but sub-classes could.\n     * @param factory ShapeFactory that might be useful for sub-classes to build a bounding Rectangle\n     * @param helper FactoryHelper that might provide additional information to build a Glyph. Unused by this implementation.\n     * @return A Rectangle object or null if one is not required.\n     */\n    protected Rectangle drawBoundingBox(final @SuppressWarnings(\"unused\") ShapeFactory factory,\n                                        final @SuppressWarnings(\"unused\") FactoryHelper helper) {\n        final Rectangle boundingBox = new Rectangle(ShapeFactoryUtil.WIDTH_BOUNDING,\n                                                    ShapeFactoryUtil.HEIGHT_BOUNDING);\n        boundingBox.setStrokeColor(ShapeFactoryUtil.RGB_STROKE_BOUNDING)\n                .setStrokeWidth(1)\n                .setFillColor(ShapeFactoryUtil.RGB_FILL_BOUNDING)\n                .setDraggable(false);\n        return boundingBox;\n    }\n\n    private void addDragHandlers(final LienzoPanel dragProxyParentPanel,\n                                 final ShapeDragProxy proxy,\n                                 final Group shape) {\n        shape.addNodeMouseDownHandler(getShapeDragStartHandler(dragProxyParentPanel,\n                                                               proxy));\n    }\n\n    private NodeMouseDownHandler getShapeDragStartHandler(final LienzoPanel dragProxyParentPanel,\n                                                          final ShapeDragProxy proxy) {\n        return new NodeMouseDownHandler() {\n\n            @Override\n            public void onNodeMouseDown(final NodeMouseDownEvent event) {\n                final double proxyWidth = proxy.getWidth();\n                final double proxyHeight = proxy.getHeight();\n                final Group dragShape = proxy.getDragGroup();\n                dragShape.setX(proxyWidth / 2);\n                dragShape.setY(proxyHeight / 2);\n\n                final LienzoPanel dragProxyPanel = new LienzoPanel((int) proxyWidth,\n                                                                   (int) proxyHeight);\n                final Layer dragProxyLayer = new Layer();\n                dragProxyLayer.add(dragShape);\n                dragProxyPanel.add(dragProxyLayer);\n                dragProxyLayer.batch();\n\n                setDragProxyPosition(dragProxyParentPanel,\n                                     dragProxyPanel,\n                                     proxyWidth,\n                                     proxyHeight,\n                                     event);\n                attachDragProxyHandlers(dragProxyPanel,\n                                        proxy);\n\n                RootPanel.get().add(dragProxyPanel);\n            }\n        };\n    }\n\n    private void setDragProxyPosition(final LienzoPanel dragProxyParentPanel,\n                                      final LienzoPanel dragProxyPanel,\n                                      final double proxyWidth,\n                                      final double proxyHeight,\n                                      final NodeMouseDownEvent event) {\n        Style style = dragProxyPanel.getElement().getStyle();\n        style.setPosition(Style.Position.ABSOLUTE);\n        style.setLeft(dragProxyParentPanel.getAbsoluteLeft() + event.getX() - (proxyWidth / 2),\n                      Style.Unit.PX);\n        style.setTop(dragProxyParentPanel.getAbsoluteTop() + event.getY() - (proxyHeight / 2),\n                     Style.Unit.PX);\n        style.setZIndex(ZINDEX);\n    }\n\n    private void attachDragProxyHandlers(final LienzoPanel floatingPanel,\n                                         final ShapeDragProxy proxy) {\n        final Style style = floatingPanel.getElement().getStyle();\n        final HandlerRegistration[] handlerRegs = new HandlerRegistration[2];\n\n        //MouseMoveEvents\n        handlerRegs[0] = RootPanel.get().addDomHandler(new MouseMoveHandler() {\n\n                                                           @Override\n                                                           public void onMouseMove(final MouseMoveEvent mouseMoveEvent) {\n                                                               style.setLeft(mouseMoveEvent.getX() - (floatingPanel.getWidth() / 2),\n                                                                             Style.Unit.PX);\n                                                               style.setTop(mouseMoveEvent.getY() - (floatingPanel.getHeight() / 2),\n                                                                            Style.Unit.PX);\n                                                               proxy.onDragPreview(mouseMoveEvent.getX(),\n                                                                                   mouseMoveEvent.getY());\n                                                           }\n                                                       },\n                                                       MouseMoveEvent.getType());\n\n        //MouseUpEvent\n        handlerRegs[1] = RootPanel.get().addDomHandler(new MouseUpHandler() {\n\n                                                           @Override\n                                                           public void onMouseUp(final MouseUpEvent mouseUpEvent) {\n                                                               handlerRegs[0].removeHandler();\n                                                               handlerRegs[1].removeHandler();\n                                                               RootPanel.get().remove(floatingPanel);\n                                                               proxy.onDragComplete(mouseUpEvent.getX(),\n                                                                                    mouseUpEvent.getY());\n                                                           }\n                                                       },\n                                                       MouseUpEvent.getType());\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/progressbar/ProgressBar.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.progressbar;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.LinearGradient;\nimport com.ait.lienzo.client.core.types.Shadow;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport com.google.gwt.user.client.Timer;\n\npublic class ProgressBar extends Group {\n\n    private static boolean infinite = true;\n    private static int substrateWidth = 300;\n    private static int substrateHeight = 34;\n    private final int PROGRESS_MARGIN = 4;\n    private Timer timer;\n    private Rectangle substrate;\n    private String substrateColor = \"#666\";\n    private LinearGradient substrateGradient;\n    private Rectangle progress;\n    private int progressWidth = 0;\n    private int progressHeight = 0;\n    private int width = 0;\n    private int height = 0;\n    private LinearGradient progressGradient;\n    private Text progressPercentage;\n    private Layer layer;\n\n    public ProgressBar(int width,\n                       int height,\n                       Layer layer) {\n        setInfinite(true);\n        this.layer = layer;\n\n        this.width = width;\n        this.height = height;\n\n        progressHeight = substrateHeight - PROGRESS_MARGIN;\n\n        init();\n\n        add(substrate);\n        add(progress);\n        add(progressPercentage);\n    }\n\n    public static int getSubstrateWidth() {\n        return substrateWidth;\n    }\n\n    public static boolean isInfinite() {\n        return infinite;\n    }\n\n    public static void setInfinite(boolean infinite) {\n        ProgressBar.infinite = infinite;\n    }\n\n    public void show() {\n        infinite = true;\n        setVisible(true);\n        progressWidth = 0;\n        timer.scheduleRepeating(1);\n    }\n\n    public void hide() {\n        setVisible(false);\n        timer.cancel();\n    }\n\n    public void center() {\n\n        int x = (int) (width / 2 - substrate.getWidth() / 2);\n        int y = (int) (height / 2 - substrate.getHeight() / 2);\n\n        substrate.setX(x).setY(y);\n        progress.setX(x + 2).setY(y + 2);\n        progressPercentage.setX(x + substrate.getWidth() / 2).setY(y + 2 + progress.getHeight() / 2);\n\n        layer.batch();\n    }\n\n    public int getProgressWidth() {\n        return progressWidth;\n    }\n\n    public void setProgressWidth(int progressWidth) {\n        this.progressWidth = progressWidth;\n        progress.setWidth(progressWidth);\n    }\n\n    public Text getProgressPercentage() {\n        return progressPercentage;\n    }\n\n    public Timer getTimer() {\n        return timer;\n    }\n\n    private void init() {\n\n        substrate = new Rectangle(substrateWidth,\n                                  substrateHeight);\n        progress = new Rectangle(progressWidth,\n                                 progressHeight);\n\n        progressPercentage = new Text(\"0 %\",\n                                      \"Lucida Console\",\n                                      12).setFillColor(ColorName.WHITE.getValue())\n                .setStrokeColor(substrateColor).setTextBaseLine(TextBaseLine.MIDDLE).setTextAlign(TextAlign.CENTER);\n\n        substrateGradient = new LinearGradient(0,\n                                               substrateHeight,\n                                               0,\n                                               0);\n        substrateGradient.addColorStop(0.4,\n                                       \"rgba(255,255,255, 0.1)\");\n        substrateGradient.addColorStop(0.6,\n                                       \"rgba(255,255,255, 0.7)\");\n        substrateGradient.addColorStop(0.9,\n                                       \"rgba(255,255,255,0.4)\");\n        substrateGradient.addColorStop(1,\n                                       \"rgba(189,189,189,1)\");\n\n        substrate.setFillGradient(substrateGradient).setShadow(new Shadow(substrateColor,\n                                                                          5,\n                                                                          3,\n                                                                          3))\n                .setStrokeColor(substrateColor).setStrokeWidth(1);\n\n        progressGradient = new LinearGradient(0,\n                                              -50,\n                                              0,\n                                              50);\n        progressGradient.addColorStop(0.5,\n                                      \"#4DA4F3\");\n        progressGradient.addColorStop(0.8,\n                                      \"#ADD9FF\");\n        progressGradient.addColorStop(1,\n                                      \"#9ED1FF\");\n\n        progress.setFillGradient(progressGradient);\n\n        center();\n        progress();\n    }\n\n    private void progress() {\n        timer = new Timer() {\n            @Override\n            public void run() {\n                if (!isInfinite()) {\n                    hide();\n                }\n                progressWidth++;\n                if (progressWidth > substrateWidth - 4) {\n                    this.cancel();\n                }\n                progressPercentage.setText((int) progressWidth / 3 + \" %\");\n                setProgressWidth(progressWidth);\n                layer.batch();\n            }\n        };\n        timer.scheduleRepeating(1);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/properties/DoubleValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.properties;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\n/**\n * Validator for doubles\n */\n@ApplicationScoped\npublic class DoubleValidator implements PropertyFieldValidator {\n\n    @Override\n    public boolean validate(Object value) {\n        try {\n            Double.parseDouble(value.toString());\n            return true;\n        } catch (Exception e) {\n            return false;\n        }\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Value must be a double.\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/properties/PropertiesScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.properties;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.properties.editor.client.PropertyEditorWidget;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WiresPropertiesScreen\")\npublic class PropertiesScreen extends Composite {\n\n    private static final String MY_ID = \"WiresPropertiesScreen\";\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    FlowPanel panel;\n    @UiField\n    PropertyEditorWidget propertyEditorWidget;\n    @Inject\n    PropertyEditorAdaptorsCache adaptors;\n    private WiresBaseShape selectedShape;\n\n    @PostConstruct\n    public void init() {\n        super.initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Properties Editor\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    public void onShapeSelectedEvent(@Observes ShapeSelectedEvent event) {\n        selectedShape = event.getShape();\n        propertyEditorWidget.handle(new PropertyEditorEvent(MY_ID,\n                                                            getProperties(selectedShape)));\n    }\n\n    protected List<PropertyEditorCategory> getProperties(final WiresBaseShape shape) {\n        final List<PropertyEditorCategory> properties = new ArrayList<PropertyEditorCategory>();\n        for (PropertyEditorAdaptor adaptor : adaptors.getAdaptors()) {\n            if (adaptor.supports(shape)) {\n                properties.addAll(adaptor.getProperties(shape));\n            }\n        }\n        return properties;\n    }\n\n    interface ViewBinder extends UiBinder<Widget, PropertiesScreen> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/properties/PropertiesScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'\n             xmlns:uf='urn:import:org.uberfire.ext.properties.editor.client'>\n\n  <g:FlowPanel ui:field='panel'>\n    <uf:PropertyEditorWidget ui:field='propertyEditorWidget'/>\n  </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/properties/PropertyEditorAdaptorsCache.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.properties;\n\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\n\n/**\n * A cache of PropertyEditorAdaptors\n */\n@ApplicationScoped\npublic class PropertyEditorAdaptorsCache {\n\n    @Inject\n    private SyncBeanManager iocManager;\n\n    private Set<PropertyEditorAdaptor> adaptors = new HashSet<PropertyEditorAdaptor>();\n\n    @PostConstruct\n    private void setup() {\n        this.adaptors = getAvailableAdaptors();\n    }\n\n    public Set<PropertyEditorAdaptor> getAdaptors() {\n        return adaptors;\n    }\n\n    private Set<PropertyEditorAdaptor> getAvailableAdaptors() {\n        final Set<PropertyEditorAdaptor> factories = new HashSet<PropertyEditorAdaptor>();\n        final Collection<SyncBeanDef<PropertyEditorAdaptor>> factoryBeans = iocManager.lookupBeans(PropertyEditorAdaptor.class);\n        for (SyncBeanDef<PropertyEditorAdaptor> factoryBean : factoryBeans) {\n            factories.add(factoryBean.getInstance());\n        }\n        return factories;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/properties/WiresComboPropertyEditorFieldInfo.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.properties;\n\nimport java.util.List;\n\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\n\n/**\n * This is a work-around for being able to set the ComboValues and override a method on PropertyEditorFieldInfo\n * Class PropertyEditorFieldInfo initialized ComboValues to null so we can't override a method with an anonymous\n * sub-class and then call getComboValues().addAll(...)\n */\npublic class WiresComboPropertyEditorFieldInfo extends PropertyEditorFieldInfo {\n\n    public WiresComboPropertyEditorFieldInfo(final String label,\n                                             final String currentStringValue,\n                                             final List<String> comboValues) {\n        super(label,\n              currentStringValue,\n              PropertyEditorType.COMBO);\n        withComboValues(comboValues);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/resources/AppImages.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.resources;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for Workbench\n */\npublic interface AppImages extends ClientBundle {\n\n    @Source(\"wires-user-logo.png\")\n    ImageResource wiresUserLogo();\n\n    @Source(\"layerPanel/delete.png\")\n    ImageResource delete();\n\n    @Source(\"layerPanel/view.png\")\n    ImageResource view();\n\n    @Source(\"layerPanel/clear.png\")\n    ImageResource clear();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/resources/AppResource.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface AppResource\n        extends\n        ClientBundle {\n\n    AppResource INSTANCE = GWT.create(AppResource.class);\n\n    AppImages images();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/util/GeometryUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.client.util;\n\n/**\n * Useful geometry functions taken from Java's Line2D class\n */\npublic class GeometryUtil {\n\n    /**\n     * Returns the square of the distance from a point to a line segment.\n     * The distance measured is the distance between the specified\n     * point and the closest point between the specified end points.\n     * If the specified point intersects the line segment in between the\n     * end points, this method returns 0.0.\n     * <p>\n     * See http://docs.oracle.com/javase/6/docs/api/java/awt/geom/Line2D.html#ptSegDist%28double,%20double,%20double,%20double,%20double,%20double%29\n     * @param x1 the X coordinate of the start point of the\n     * specified line segment\n     * @param y1 the Y coordinate of the start point of the\n     * specified line segment\n     * @param x2 the X coordinate of the end point of the\n     * specified line segment\n     * @param y2 the Y coordinate of the end point of the\n     * specified line segment\n     * @param px the X coordinate of the specified point being\n     * measured against the specified line segment\n     * @param py the Y coordinate of the specified point being\n     * measured against the specified line segment\n     * @return a double value that is the square of the distance from the\n     * specified point to the specified line segment.\n     */\n    public static double ptSegDistSq(double x1,\n                                     double y1,\n                                     double x2,\n                                     double y2,\n                                     double px,\n                                     double py) {\n        // Adjust vectors relative to x1,y1\n        // x2,y2 becomes relative vector from x1,y1 to end of segment\n        x2 -= x1;\n        y2 -= y1;\n        // px,py becomes relative vector from x1,y1 to test point\n        px -= x1;\n        py -= y1;\n        double dotprod = px * x2 + py * y2;\n        double projlenSq;\n        if (dotprod <= 0.0) {\n            // px,py is on the side of x1,y1 away from x2,y2\n            // distance to segment is length of px,py vector\n            // \"length of its (clipped) projection\" is now 0.0\n            projlenSq = 0.0;\n        } else {\n            // switch to backwards vectors relative to x2,y2\n            // x2,y2 are already the negative of x1,y1=>x2,y2\n            // to get px,py to be the negative of px,py=>x2,y2\n            // the dot product of two negated vectors is the same\n            // as the dot product of the two normal vectors\n            px = x2 - px;\n            py = y2 - py;\n            dotprod = px * x2 + py * y2;\n            if (dotprod <= 0.0) {\n                // px,py is on the side of x2,y2 away from x1,y1\n                // distance to segment is length of (backwards) px,py vector\n                // \"length of its (clipped) projection\" is now 0.0\n                projlenSq = 0.0;\n            } else {\n                // px,py is between x1,y1 and x2,y2\n                // dotprod is the length of the px,py vector\n                // projected on the x2,y2=>x1,y1 vector times the\n                // length of the x2,y2=>x1,y1 vector\n                projlenSq = dotprod * dotprod / (x2 * x2 + y2 * y2);\n            }\n        }\n        // Distance to line is now the length of the relative point\n        // vector minus the length of its projection onto the line\n        // (which is zero if the projection falls outside the range\n        //  of the line segment).\n        double lenSq = px * px + py * py - projlenSq;\n        if (lenSq < 0) {\n            lenSq = 0;\n        }\n        return lenSq;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/util/ShapeFactoryUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.util;\n\nimport com.ait.lienzo.shared.core.types.Color;\n\npublic class ShapeFactoryUtil {\n\n    // stencil\n    public static final int BOUNDINGS_BY_STENCIL = 5;\n    // panel\n    public static final int WIDTH_PANEL = ShapeFactoryUtil.WIDTH_STENCIL + 5;\n    public static final int HEIGHT_PANEL = 300;\n    // bounding Shape\n    public static final int WIDTH_BOUNDING = 75;\n    public static final int HEIGHT_BOUNDING = 100;\n    public static final String RGB_FILL_BOUNDING = Color.rgbToBrowserHexColor(255,\n                                                                              255,\n                                                                              255);\n    public static final String RGB_STROKE_BOUNDING = Color.rgbToBrowserHexColor(219,\n                                                                                217,\n                                                                                217);\n    public static final int SPACE_BETWEEN_BOUNDING = 5;\n    public static final int WIDTH_STENCIL = (ShapeFactoryUtil.BOUNDINGS_BY_STENCIL * ShapeFactoryUtil.WIDTH_BOUNDING)\n            + (ShapeFactoryUtil.BOUNDINGS_BY_STENCIL * ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING);\n    // bounding Layer\n    public static final int WIDTH_BOUNDING_LAYER = 250;\n    public static final int HEIGHT_BOUNDING_LAYER = 30;\n\n    // text\n    public static final String RGB_TEXT_DESCRIPTION = Color.rgbToBrowserHexColor(188,\n                                                                                 187,\n                                                                                 189);\n    public static final String FONT_FAMILY_DESCRIPTION = \"oblique normal\";\n    public static final double FONT_SIZE_DESCRIPTION = 10;\n    public static final double FONT_SIZE_WIDTH = 6;\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/java/org/uberfire/ext/wires/core/client/util/ShapesUtils.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.client.util;\n\nimport java.util.Set;\n\nimport org.uberfire.ext.wires.core.api.factories.ShapeFactory;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\n\npublic class ShapesUtils {\n\n    // Control Points\n    public static final String CP_RGB_FILL_COLOR = \"#0000FF\";\n    public static final int CP_RGB_STROKE_WIDTH_SHAPE = 1;\n\n    // Magnets\n    public static final String MAGNET_RGB_FILL_SHAPE = \"#F2F2F2\";\n    public static final String MAGNET_ACTIVE_RGB_FILL_SHAPE = \"#00FF00\";\n\n    // shapes\n    public static final String RGB_STROKE_SHAPE = \"#999999\";\n    public static final String RGB_FILL_SHAPE = \"#F2F2F2\";\n    public static final int RGB_STROKE_WIDTH_SHAPE = 2;\n\n    //Containers\n    public static final String RGB_STROKE_CONTAINER = \"#FF9900\";\n    public static final String RGB_FILL_CONTAINER = \"#FFFF66\";\n    public static final String RGB_STROKE_HOVER_CONTAINER = \"#33CC33\";\n    public static final String RGB_FILL_HOVER_CONTAINER = \"#33FF33\";\n    public static final int RGB_STROKE_WIDTH_CONTAINER = 4;\n    public static final double RGB_ALPHA_CONTAINER = 0.75;\n\n    //Text\n    public static final String RGB_STROKE_TEXT = \"#181818\";\n    public static final String RGB_FILL_TEXT = \"#181818\";\n\n    public static int getNumberOfShapesInCategory(final Category shapeCategory,\n                                                  final Set<ShapeFactory> factories) {\n        int account = 0;\n        for (ShapeFactory factory : factories) {\n            if (factory.getCategory().equals(shapeCategory)) {\n                account++;\n            }\n        }\n        return account;\n    }\n\n    public static int calculateHeight(int shapes) {\n        int y = shapes > 1 ? getRow(shapes) : 0;\n        y = y > 0 ? (y * ShapeFactoryUtil.HEIGHT_BOUNDING) + ShapeFactoryUtil.SPACE_BETWEEN_BOUNDING * y : y\n                * ShapeFactoryUtil.HEIGHT_BOUNDING;\n        return y + ShapeFactoryUtil.HEIGHT_BOUNDING + 15;\n    }\n\n    public static int getRow(int shapes) {\n        return Math.round((shapes * ShapeFactoryUtil.WIDTH_BOUNDING) / ShapeFactoryUtil.WIDTH_STENCIL);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.core.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-client/src/main/resources/org/uberfire/ext/wires/core/WiresCoreClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreApi\"/>\n  <inherits name=\"org.uberfire.ext.properties.editor.PropertiesEditorClient\"/>\n\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-wires-core-grids</artifactId>\n\n  <name>Uberfire Wires :: Core Grids</name>\n  <description>Wires Grids support</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-tests</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.mortbay.jasper</groupId>\n          <artifactId>apache-el</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/Bounds.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model;\n\n/**\n * Defines a rectangular boundary.\n */\npublic interface Bounds {\n\n    /**\n     * Returns the Canvas (untransformed) x-coordinate of the bounds.\n     * @return\n     */\n    double getX();\n\n    /**\n     * Sets the Canvas (untransformed) x-coordinate of the bounds.\n     * @param x\n     */\n    void setX(final double x);\n\n    /**\n     * Returns the Canvas (untransformed) y-coordinate of the bounds.\n     * @return\n     */\n    double getY();\n\n    /**\n     * Sets the Canvas (untransformed) y-coordinate of the bounds.\n     * @param y\n     */\n    void setY(final double y);\n\n    /**\n     * Returns the Canvas (untransformed) width of the bounds.\n     * @return\n     */\n    double getWidth();\n\n    /**\n     * Sets the Canvas (untransformed) width of the bounds.\n     * @param width Must be positive.\n     */\n    void setWidth(final double width);\n\n    /**\n     * Returns the Canvas (untransformed) height of the bounds.\n     * @return\n     */\n    double getHeight();\n\n    /**\n     * Sets the Canvas (untransformed) height of the bounds.\n     * @param height Must be positive.\n     */\n    void setHeight(final double height);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridCell.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\n/**\n * Defines a cell's value holder within a grid.\n * @param <T> The Type of value\n */\npublic interface GridCell<T> {\n\n    /**\n     * The default {@link GridCellEditAction} when otherwise undefined.\n     */\n    GridCellEditAction DEFAULT_EDIT_ACTION = GridCellEditAction.DOUBLE_CLICK;\n\n    /**\n     * Returns the value holder for the cell. It should be noted there is intentionally no \"setter\" as\n     * mutation of the value may require further mutation to other data within the grid. Therefore mutation\n     * of cell values is via the GridData interface to ensure the integrity of all data within the grid.\n     * @return\n     */\n    GridCellValue<T> getValue();\n\n    /**\n     * Returns whether the cell is in a merged state\n     * @return true if merged\n     */\n    boolean isMerged();\n\n    /**\n     * Returns the number of cells merged into this cell. For cells that are at the top of a merged block\n     * this should be the number of merged cells, including this cell. For cells that are not the top of a\n     * merged block but are contained in a merged block this should return zero. For non-merged cells this\n     * should return one.\n     * @return The number of cells merged into this cell, or zero if part of a merged block or one if not merged.\n     */\n    int getMergedCellCount();\n\n    /**\n     * Returns whether the cell is collapsed. For cells that are at the top of a collapsed\n     * block this should return false. For cells that are not the top of a collapsed block\n     * but are contained in a collapsed block this should return false.\n     * @return true is collapsed.\n     */\n    boolean isCollapsed();\n\n    /**\n     * Collapse the cell.\n     */\n    void collapse();\n\n    /**\n     * Expand the cell.\n     */\n    void expand();\n\n    /**\n     * Reset the cell to a non-merged, non-collapsed state.\n     */\n    void reset();\n\n    /**\n     * Returns the CellSelectionStrategy to handle selections of the cell.\n     * @return\n     */\n    CellSelectionStrategy getSelectionStrategy();\n\n    /**\n     * Sets the CellSelectionStrategy to handle selections of the cell.\n     * @return\n     */\n    void setSelectionStrategy(final CellSelectionStrategy selectionStrategy);\n\n    /**\n     * Returns the default action that will trigger editing of the cells value.\n     * @return\n     */\n    default GridCellEditAction getSupportedEditAction() {\n        return DEFAULT_EDIT_ACTION;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridCellEditAction.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport java.util.Arrays;\nimport java.util.Objects;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent;\n\n/**\n * Defines the action that triggers an Edit operation on a cell.\n */\npublic enum GridCellEditAction {\n\n    NONE(AbstractNodeMouseEvent.class),\n    SINGLE_CLICK(NodeMouseClickEvent.class),\n    DOUBLE_CLICK(NodeMouseDoubleClickEvent.class);\n\n    private Class<? extends AbstractNodeMouseEvent> eventClass;\n\n    GridCellEditAction(final Class<? extends AbstractNodeMouseEvent> eventClass) {\n        this.eventClass = eventClass;\n    }\n\n    public static GridCellEditAction getSupportedEditAction(final AbstractNodeMouseEvent event) {\n        return Arrays.stream(values())\n                .filter(action -> Objects.equals(action.eventClass, event.getClass()))\n                .findFirst()\n                .orElse(NONE);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridCellValue.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\n/**\n * Holds the value of a cell.\n * @param <T> The Type of the value\n */\npublic interface GridCellValue<T> {\n\n    /**\n     * Returns the value of the cell. It should be noted there is intentionally no \"setter\" as\n     * mutation of the value may require further mutation to other data within the grid. Therefore mutation\n     * of cell values is via the GridData interface to ensure the integrity of all data within the grid.\n     * @return\n     */\n    T getValue();\n\n    /**\n     * Returns the (optional) <b>placeholder</b> to use when no actual value has been set\n     * @return\n     */\n    String getPlaceHolder();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.HeaderSingleCellSelectionStrategy;\n\n/**\n * Defines a Column within a grid.\n */\npublic interface GridColumn<T> {\n\n    /**\n     * Returns the MetaData for the Header. Each entry represents a row in the header.\n     * Index 0 represents the first (top-down) row, Index 1 represents the second row etc.\n     * @return\n     */\n    List<HeaderMetaData> getHeaderMetaData();\n\n    /**\n     * Returns the Render for the column\n     * @return\n     */\n    GridColumnRenderer<T> getColumnRenderer();\n\n    /**\n     * Edit the cell (normally in response to a mouse double-click event)\n     * @param cell\n     * @param context\n     * @param callback\n     */\n    default void edit(final GridCell<T> cell,\n                      final GridBodyCellRenderContext context,\n                      final Consumer<GridCellValue<T>> callback) {\n    }\n\n    /**\n     * Edit the cell (normally in response to a mouse double-click event)\n     * @param cell\n     * @param context\n     * @param callback\n     */\n    default void edit(final GridCell<T> cell,\n                      final GridBodyCellEditContext context,\n                      final Consumer<GridCellValue<T>> callback) {\n        edit(cell,\n             (GridBodyCellRenderContext) context,\n             callback);\n    }\n\n    /**\n     * Returns the column's width\n     * @return\n     */\n    double getWidth();\n\n    /**\n     * Sets the columns width\n     * @param width\n     */\n    void setWidth(final double width);\n\n    /**\n     * Returns a flag indicating this column is linked to another\n     * @return\n     */\n    boolean isLinked();\n\n    /**\n     * Returns the column to which this column is linked\n     * @return\n     */\n    GridColumn<?> getLink();\n\n    /**\n     * Sets the column to which this column is linked\n     * @param link\n     */\n    void setLink(final GridColumn<?> link);\n\n    /**\n     * Returns the logical index to which this column relates. Columns may be re-ordered and therefore, to\n     * avoid manipulating the underlying row data, the logical index of the column may be different to their\n     * physical index (i.e. the order in which they were added to the grid).\n     * @return\n     */\n    int getIndex();\n\n    /**\n     * Sets the logical index of the column, to support indirection of columns' access to row data.\n     * @param index\n     */\n    void setIndex(final int index);\n\n    /**\n     * Returns a flag indicating whether a column can be re-sized.\n     * @return true if the column can be re-sized.\n     */\n    boolean isResizable();\n\n    /**\n     * Sets whether the column can be re-sized.\n     * @param isResizable true if the column can be re-sized.\n     */\n    void setResizable(final boolean isResizable);\n\n    /**\n     * Returns a flag indicating whether a column can be moved.\n     * @return true if the column can be moved.\n     */\n    boolean isMovable();\n\n    /**\n     * Sets whether the column can be moved.\n     * @param isMovable true if the column can be moved.\n     */\n    void setMovable(final boolean isMovable);\n\n    /**\n     * Returns a flag indicating whether a column is capable of floating on the left-hand side of the table when clipped horizontally.\n     * @return true if the column is capable of floating.\n     */\n    boolean isFloatable();\n\n    /**\n     * Sets whether the column is capable of floating on the left-hand side of the table when clipped horizontally.\n     * @param isFloatable true if the column can be floated.\n     */\n    void setFloatable(final boolean isFloatable);\n\n    /**\n     * Returns a flag indicating whether a column is visible.\n     * @return true if the column is visible.\n     */\n    boolean isVisible();\n\n    /**\n     * Sets whether the column is visible.\n     * @param isVisible true if the column is visible.\n     */\n    void setVisible(final boolean isVisible);\n\n    /**\n     * Returns the minimum width to which the column can be re-sized\n     * @return null if no minimum\n     */\n    Double getMinimumWidth();\n\n    /**\n     * Sets the minimum width to which the column can be re-sized\n     * @param minimumWidth Minimum width, or null if no minimum width\n     */\n    void setMinimumWidth(final Double minimumWidth);\n\n    /**\n     * Returns the maximum width to which the column can be re-sized\n     * @return null if no maximum\n     */\n    Double getMaximumWidth();\n\n    /**\n     * Sets the maximum width to which the column can be re-sized\n     * @param maximumWidth Maximum width, or null if no minimum width\n     */\n    void setMaximumWidth(final Double maximumWidth);\n\n    /**\n     * MetaData for the column's header\n     */\n    interface HeaderMetaData {\n\n        /**\n         * Returns an identifier for a group of Columns. Columns in one group cannot be moved to another group.\n         * @return The group identifier. It should not be null.\n         */\n        String getColumnGroup();\n\n        /**\n         * Sets the identifier for a group of Columns. Columns in one group cannot be moved to another group.\n         * @The group identifier. It should not be null.\n         */\n        void setColumnGroup(final String columnGroup);\n\n        /**\n         * Returns the column's title\n         * @return\n         */\n        String getTitle();\n\n        /**\n         * Sets the column's title\n         * @param title\n         */\n        void setTitle(final String title);\n\n        /**\n         * Returns the CellSelectionStrategy to handle selections of the header cell.\n         * @return\n         */\n        default CellSelectionStrategy getSelectionStrategy() {\n            return HeaderSingleCellSelectionStrategy.INSTANCE;\n        }\n\n        /**\n         * Puts the {@link HeaderMetaData} into 'edit' mode.\n         * @param context The context of a Grid's cell header during the rendering phase.\n         */\n        default void edit(final GridBodyCellEditContext context) {\n          // do nothing by default\n        }\n    }\n\n    /**\n     * Get column width mode\n     * @return\n     */\n    ColumnWidthMode getColumnWidthMode();\n\n    /**\n     * Set column width mode\n     * @return\n     */\n    void setColumnWidthMode(ColumnWidthMode columnWidthMode);\n\n    /**\n     * Enum that identify the width mode of a column\n     */\n    enum ColumnWidthMode {\n        // FIXED means that no automatic resize will be done, only the user can manually resize it\n        FIXED,\n        // AUTO means that its width will be calculate to fit all the available space\n        AUTO;\n\n        static public boolean isAuto(GridColumn<?> column) {\n            return column != null && AUTO.equals(column.getColumnWidthMode());\n        }\n\n        static public boolean isFixed(GridColumn<?> column) {\n            return column != null && FIXED.equals(column.getColumnWidthMode());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridData.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport java.util.List;\nimport java.util.function.Supplier;\n\n/**\n * An interface defining a generic grid of data.\n */\npublic interface GridData {\n\n    /**\n     * Returns the columns associated with the grid.\n     * @return\n     */\n    List<GridColumn<?>> getColumns();\n\n    /**\n     * Returns the total number of columns in the grid, including hidden columns.\n     * @return\n     */\n    int getColumnCount();\n\n    /**\n     * Appends a column to the end of the grid. End being considered the far most right.\n     * @param column\n     */\n    void appendColumn(final GridColumn<?> column);\n\n    /**\n     * Inserts a column to the grid at the specified index.\n     * @param index\n     * @param column\n     */\n    void insertColumn(final int index,\n                      final GridColumn<?> column);\n\n    /**\n     * Updates a column in the grid at the specified index. All existing row data will be cleared.\n     * @param index\n     * @param column\n     */\n    void updateColumn(final int index,\n                      final GridColumn<?> column);\n\n    /**\n     * Deletes a column from the grid.\n     * @param column\n     */\n    void deleteColumn(final GridColumn<?> column);\n\n    /**\n     * Moves a column to a new index within the grid\n     * @param index\n     * @param column\n     */\n    void moveColumnTo(final int index,\n                      final GridColumn<?> column);\n\n    /**\n     * Moves columns to a new index within the grid\n     * @param index\n     * @param columns\n     */\n    void moveColumnsTo(final int index,\n                       final List<GridColumn<?>> columns);\n\n    /**\n     * Returns the rows associated with the grid.\n     * @return\n     */\n    List<GridRow> getRows();\n\n    /**\n     * Returns the row at the specified index.\n     * @param rowIndex\n     * @return\n     */\n    GridRow getRow(final int rowIndex);\n\n    /**\n     * Appends a row to the end of the grid.\n     * @param row\n     */\n    void appendRow(final GridRow row);\n\n    /**\n     * Inserts a row to the grid at the specified index.\n     * @param rowIndex\n     * @param row\n     */\n    void insertRow(final int rowIndex,\n                   final GridRow row);\n\n    /**\n     * Deletes a row from the grid at the specified index.\n     * @param rowIndex\n     * @return The Range of rows affected by the operation.\n     */\n    Range deleteRow(final int rowIndex);\n\n    /**\n     * Moves a row to a new index within the grid\n     * @param index\n     * @param row\n     */\n    void moveRowTo(final int index,\n                   final GridRow row);\n\n    /**\n     * Moves rowss to a new index within the grid\n     * @param index\n     * @param rows\n     */\n    void moveRowsTo(final int index,\n                    final List<GridRow> rows);\n\n    /**\n     * Returns the total number of rows in the grid, including collapsed rows.\n     * @return\n     */\n    int getRowCount();\n\n    /**\n     * Returns the number of rows in the grid's header.\n     * @return The number of rows in the header; greater than zero.\n     */\n    int getHeaderRowCount();\n\n    /**\n     * Sets the number of rows in the grid's header.\n     * @param headerRowCount Cannot be less than 1.\n     */\n    void setHeaderRowCount(final int headerRowCount);\n\n    /**\n     * Returns a cell at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @return\n     */\n    GridCell<?> getCell(final int rowIndex,\n                        final int columnIndex);\n\n    /**\n     * Sets a cell at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @param cellSupplier A supplier of new cell instances\n     * @return The Range of rows affected by the operation.\n     */\n    Range setCell(final int rowIndex,\n                  final int columnIndex,\n                  final Supplier<GridCell<?>> cellSupplier);\n\n    /**\n     * Sets a cell value at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @param value\n     * @return The Range of rows affected by the operation.\n     */\n    Range setCellValue(final int rowIndex,\n                       final int columnIndex,\n                       final GridCellValue<?> value);\n\n    /**\n     * Deletes a cell at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @return The Range of rows affected by the operation.\n     */\n    Range deleteCell(final int rowIndex,\n                     final int columnIndex);\n\n    /**\n     * Selects a cell at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @return The Range of rows affected by the operation.\n     */\n    Range selectCell(final int rowIndex,\n                     final int columnIndex);\n\n    /**\n     * Selects a cell at the specified physical coordinate.\n     * @param rowIndex\n     * @param columnIndex\n     * @param width\n     * @param height\n     * @return The Range of rows affected by the operation.\n     */\n    Range selectCells(final int rowIndex,\n                      final int columnIndex,\n                      final int width,\n                      final int height);\n\n    /**\n     * Returns the origin of a selected range.\n     * @return null if no origin has been defined.\n     */\n    SelectedCell getSelectedCellsOrigin();\n\n    /**\n     * Returns all selected cells.\n     * @return\n     */\n    List<SelectedCell> getSelectedCells();\n\n    /**\n     * Selects a header cell at the specified physical coordinate.\n     * @param headerRowIndex\n     * @param headerColumnIndex\n     * @return The Range of rows affected by the operation.\n     */\n    Range selectHeaderCell(final int headerRowIndex,\n                           final int headerColumnIndex);\n\n    /**\n     * Returns all selected header cells.\n     * @return\n     */\n    List<SelectedCell> getSelectedHeaderCells();\n\n    /**\n     * Clears all cell selections.\n     */\n    void clearSelections();\n\n    /**\n     * Returns whether the data in a merged state.\n     * @return true if merged.\n     */\n    boolean isMerged();\n\n    /**\n     * Sets whether the data is in merged state.\n     * @param isMerged\n     */\n    void setMerged(final boolean isMerged);\n\n    /**\n     * Returns whether rows can be repositioned by dragging and dropping.\n     * @return true if drag and drop is enabled.\n     */\n    boolean isRowDraggingEnabled();\n\n    /**\n     * Set whether rows can be repositioned by dragging and dropping.\n     * @param enabled true if drag and drop is enabled.\n     */\n    void setRowDraggingEnabled(final boolean enabled);\n\n    /**\n     * Returns whether columns can be repositioned by dragging and dropping.\n     * @return true if drag and drop is enabled.\n     */\n    boolean isColumnDraggingEnabled();\n\n    /**\n     * Sets whether columns can be repositioned by dragging and dropping.\n     * @param enabled true if drag and drop is enabled.\n     */\n    void setColumnDraggingEnabled(final boolean enabled);\n\n    /**\n     * Collapses a cell and corresponding rows. The cell being collapsed has all other merged\n     * cells below it collapsed into the single cell. The cell itself remains not collapsed.\n     * @param rowIndex\n     * @param columnIndex\n     */\n    void collapseCell(final int rowIndex,\n                      final int columnIndex);\n\n    /**\n     * Expands a cell and corresponding rows. The cell being collapsed has all other merged cells\n     * below it expanded. Expanding collapsed cells should not expand nested collapsed cells.\n     * @param rowIndex\n     * @param columnIndex\n     */\n    void expandCell(final int rowIndex,\n                    final int columnIndex);\n\n    /**\n     * Updates the width of columns with {@link GridColumn.ColumnWidthMode#AUTO}\n     * @return a boolean that indicates if grid need to be redraw or not\n     */\n    boolean refreshWidth();\n\n    /**\n     * Updates the width of columns with {@link GridColumn.ColumnWidthMode#AUTO}\n     * @param currentWidth is the grid width before this resize iteration\n     * @return a boolean that indicates if grid need to be redraw or not\n     */\n    boolean refreshWidth(double currentWidth);\n\n    /**\n     * Update visible size information and refresh columns width. See {@link GridData#refreshWidth()}\n     * @param width\n     * @param height\n     * @return a boolean that indicates if grid need to be redraw or not\n     */\n    boolean setVisibleSizeAndRefresh(int width, int height);\n\n    /**\n     * Get visible width\n     * @return\n     */\n    int getVisibleWidth();\n\n    /**\n     * Get visible height\n     * @return\n     */\n    int getVisibleHeight();\n\n    /**\n     * A range of rows.\n     */\n    class Range {\n\n        private int minRowIndex;\n        private int maxRowIndex;\n\n        public Range(final int rowIndex) {\n            this(rowIndex,\n                 rowIndex);\n        }\n\n        public Range(final int minRowIndex,\n                     final int maxRowIndex) {\n            this.minRowIndex = minRowIndex;\n            this.maxRowIndex = maxRowIndex;\n        }\n\n        public int getMinRowIndex() {\n            return minRowIndex;\n        }\n\n        public int getMaxRowIndex() {\n            return maxRowIndex;\n        }\n    }\n\n    /**\n     * A selected cell within the data. Selected state is not stored in the GridCell implementation\n     * as we'd need to scan the whole grid to retrieve selected cells. The assumption is that the number\n     * of selected cells is invariably far, far fewer than the total number of cells in the grid.\n     */\n    class SelectedCell {\n\n        private final int rowIndex;\n        private final int columnIndex;\n\n        public SelectedCell(final int rowIndex,\n                            final int columnIndex) {\n            this.rowIndex = rowIndex;\n            this.columnIndex = columnIndex;\n        }\n\n        public int getRowIndex() {\n            return rowIndex;\n        }\n\n        public int getColumnIndex() {\n            return columnIndex;\n        }\n\n        @Override\n        public boolean equals(final Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (!(o instanceof SelectedCell)) {\n                return false;\n            }\n\n            SelectedCell that = (SelectedCell) o;\n\n            if (rowIndex != that.rowIndex) {\n                return false;\n            }\n            if (columnIndex != that.columnIndex) {\n                return false;\n            }\n            return true;\n        }\n\n        @Override\n        public int hashCode() {\n            int result = rowIndex;\n            result = ~~result;\n            result = 31 * result + columnIndex;\n            result = ~~result;\n            return result;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/GridRow.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport java.util.Map;\n\n/**\n * Defines a row within the grid\n */\npublic interface GridRow {\n\n    /**\n     * Returns the height of the row\n     * @return\n     */\n    double getHeight();\n\n    /**\n     * Sets the height of the row\n     * @param height\n     */\n    void setHeight(final double height);\n\n    /**\n     * Collapsed rows have zero height. This returns the height of the row before it was collapsed.\n     * This is currently used primarily during the \"expand/collapse row(s)\" animations.\n     * @return The height of the row before it was collapsed.\n     */\n    double peekHeight();\n\n    /**\n     * Returns the cells within the row. This is an sparse map of column index to value.\n     * Empty cells do not have an entry within the map. Empty cells should be considered\n     * as \"null\" values; rather than empty Strings however the strict interpretation is up\n     * to the implementations.\n     * @return\n     */\n    Map<Integer, GridCell<?>> getCells();\n\n    /**\n     * Returns whether the row contains merged cells\n     * @return true if merged\n     */\n    boolean isMerged();\n\n    /**\n     * Returns whether the row contains collapsed cells\n     * @return true if collapsed\n     */\n    boolean isCollapsed();\n\n    /**\n     * Collapses all cells on the row.\n     */\n    void collapse();\n\n    /**\n     * Expands all cells on the row.\n     */\n    void expand();\n\n    /**\n     * Resets all cells on the row to a non-merged, non-collapsed state.\n     */\n    void reset();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseBounds.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\n\n/**\n * Base implementation of {@link Bounds}\n */\npublic class BaseBounds implements Bounds {\n\n    private double x;\n    private double y;\n    private double width;\n    private double height;\n\n    public BaseBounds(final double x,\n                      final double y,\n                      final double width,\n                      final double height) {\n        setX(x);\n        setY(y);\n        setWidth(width);\n        setHeight(height);\n    }\n\n    @Override\n    public double getX() {\n        return x;\n    }\n\n    @Override\n    public void setX(double x) {\n        this.x = x;\n    }\n\n    @Override\n    public double getY() {\n        return y;\n    }\n\n    @Override\n    public void setY(double y) {\n        this.y = y;\n    }\n\n    @Override\n    public double getWidth() {\n        return width;\n    }\n\n    @Override\n    public void setWidth(double width) {\n        if (!(width >= 0)) {\n            throw new IllegalStateException(\"Width must be positive\");\n        }\n        this.width = width;\n    }\n\n    @Override\n    public double getHeight() {\n        return height;\n    }\n\n    @Override\n    public void setHeight(double height) {\n        if (!(height >= 0)) {\n            throw new IllegalStateException(\"Height must be positive\");\n        }\n        this.height = height;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridCell.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RangeSelectionStrategy;\n\n/**\n * Base implementation of a grid cell to avoid boiler-plate for more specific implementations.\n * @param <T> The Type of value\n */\npublic class BaseGridCell<T> implements GridCell<T> {\n\n    protected GridCellValue<T> value;\n    private int collapseLevel = 0;\n    private int mergedCellCount = 1;\n    private CellSelectionStrategy selectionStrategy = RangeSelectionStrategy.INSTANCE;\n\n    public BaseGridCell(final GridCellValue<T> value) {\n        this.value = value;\n    }\n\n    @Override\n    public GridCellValue<T> getValue() {\n        return value;\n    }\n\n    //This is not part of the GridCell interface as we don't want to expose this for general use\n    protected void setValue(final GridCellValue<T> value) {\n        this.value = value;\n    }\n\n    @Override\n    public boolean isMerged() {\n        return getMergedCellCount() != 1;\n    }\n\n    @Override\n    public int getMergedCellCount() {\n        return mergedCellCount;\n    }\n\n    //This is not part of the GridCell interface as we don't want to expose this for general use\n    void setMergedCellCount(final int mergedCellCount) {\n        this.mergedCellCount = mergedCellCount;\n    }\n\n    @Override\n    public boolean isCollapsed() {\n        return collapseLevel > 0;\n    }\n\n    @Override\n    public void collapse() {\n        collapseLevel++;\n    }\n\n    @Override\n    public void expand() {\n        collapseLevel--;\n    }\n\n    @Override\n    public void reset() {\n        mergedCellCount = 1;\n        collapseLevel = 0;\n    }\n\n    @Override\n    public CellSelectionStrategy getSelectionStrategy() {\n        return selectionStrategy;\n    }\n\n    @Override\n    public void setSelectionStrategy(final CellSelectionStrategy selectionStrategy) {\n        this.selectionStrategy = selectionStrategy;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof BaseGridCell)) {\n            return false;\n        }\n\n        BaseGridCell<?> that = (BaseGridCell<?>) o;\n\n        return !(value != null ? !value.equals(that.value) : that.value != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = value != null ? value.hashCode() : 0;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridCellValue.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\n\n/**\n * Base implementation of a grid cell value holder to avoid boiler-plate for more specific implementations.\n * @param <T> The Type of the value\n */\npublic class BaseGridCellValue<T> implements GridCellValue<T> {\n\n    protected T value;\n    private String placeHolder = null;\n\n    public BaseGridCellValue(final T value) {\n        this.value = value;\n    }\n\n    public BaseGridCellValue(T value, String placeHolder) {\n        this(value);\n        this.placeHolder = placeHolder;\n    }\n\n    @Override\n    public T getValue() {\n        return value;\n    }\n\n    @Override\n    public String getPlaceHolder() {\n        return placeHolder;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        BaseGridCellValue that = (BaseGridCellValue) o;\n\n        if (value != null ? !value.equals(that.value) : that.value != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return value != null ? value.hashCode() : 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\n\n/**\n * Base implementation of a grid column to avoid boiler-plate for more specific implementations.\n */\npublic class BaseGridColumn<T> implements GridColumn<T> {\n\n    //Default minimum width of a column.\n    private static final double COLUMN_MIN_WIDTH = 100;\n\n    private double width;\n    private boolean isResizable = true;\n    private boolean isMovable = true;\n    private boolean isFloatable = false;\n    private boolean isVisible = true;\n    private Double minimumWidth = COLUMN_MIN_WIDTH;\n    private Double maximumWidth = null;\n    private GridColumn<?> link;\n    private int index = -1;\n    private List<HeaderMetaData> headerMetaData = new ArrayList<HeaderMetaData>();\n    private GridColumnRenderer<T> columnRenderer;\n    private ColumnWidthMode columnWidthMode = ColumnWidthMode.FIXED;\n\n    protected String placeHolder = null;\n\n    public BaseGridColumn(final HeaderMetaData headerMetaData,\n                          final GridColumnRenderer<T> columnRenderer,\n                          final double width) {\n        Objects.requireNonNull(headerMetaData, \"headerMetaData\");\n        Objects.requireNonNull(columnRenderer, \"columnRenderer\");\n        this.headerMetaData.add(headerMetaData);\n        this.columnRenderer = columnRenderer;\n        this.width = width;\n    }\n\n    public BaseGridColumn(final List<HeaderMetaData> headerMetaData,\n                          final GridColumnRenderer<T> columnRenderer,\n                          final double width) {\n        Objects.requireNonNull(headerMetaData, \"headerMetaData\");\n        Objects.requireNonNull(columnRenderer, \"columnRenderer\");\n        this.headerMetaData.addAll(headerMetaData);\n        this.columnRenderer = columnRenderer;\n        this.width = width;\n    }\n\n    public BaseGridColumn(final HeaderMetaData headerMetaData,\n                          final GridColumnRenderer<T> columnRenderer,\n                          final double width, final String placeHolder) {\n        this(headerMetaData, columnRenderer, width);\n        this.placeHolder = placeHolder;\n    }\n\n    public BaseGridColumn(final List<HeaderMetaData> headerMetaData,\n                          final GridColumnRenderer<T> columnRenderer,\n                          final double width, final String placeHolder) {\n        this(headerMetaData, columnRenderer, width);\n        this.placeHolder = placeHolder;\n    }\n\n    @Override\n    public List<HeaderMetaData> getHeaderMetaData() {\n        return headerMetaData;\n    }\n\n    @Override\n    public GridColumnRenderer<T> getColumnRenderer() {\n        return columnRenderer;\n    }\n\n    @Override\n    public double getWidth() {\n        return width;\n    }\n\n    @Override\n    public void setWidth(final double width) {\n        this.width = width;\n    }\n\n    @Override\n    public boolean isLinked() {\n        return link != null;\n    }\n\n    @Override\n    public GridColumn<?> getLink() {\n        return link;\n    }\n\n    @Override\n    public void setLink(final GridColumn<?> link) {\n        this.link = link;\n    }\n\n    @Override\n    public int getIndex() {\n        if (index == -1) {\n            throw new IllegalStateException(\"Column has not been added to a Grid and hence has no index.\");\n        }\n        return index;\n    }\n\n    @Override\n    public void setIndex(final int index) {\n        this.index = index;\n    }\n\n    @Override\n    public boolean isResizable() {\n        return isResizable;\n    }\n\n    @Override\n    public void setResizable(final boolean isResizable) {\n        this.isResizable = isResizable;\n    }\n\n    @Override\n    public boolean isMovable() {\n        return this.isMovable;\n    }\n\n    @Override\n    public void setMovable(final boolean isMovable) {\n        this.isMovable = isMovable;\n    }\n\n    @Override\n    public boolean isFloatable() {\n        return isFloatable;\n    }\n\n    @Override\n    public void setFloatable(final boolean isFloatable) {\n        this.isFloatable = isFloatable;\n    }\n\n    @Override\n    public boolean isVisible() {\n        return isVisible;\n    }\n\n    @Override\n    public void setVisible(final boolean isVisible) {\n        this.isVisible = isVisible;\n    }\n\n    @Override\n    public Double getMinimumWidth() {\n        return minimumWidth;\n    }\n\n    @Override\n    public void setMinimumWidth(final Double minimumWidth) {\n        this.minimumWidth = minimumWidth;\n    }\n\n    @Override\n    public Double getMaximumWidth() {\n        return maximumWidth;\n    }\n\n    @Override\n    public void setMaximumWidth(final Double maximumWidth) {\n        this.maximumWidth = maximumWidth;\n    }\n\n    public String getPlaceHolder() {\n        return placeHolder;\n    }\n\n    public void setPlaceHolder(String placeHolder) {\n        this.placeHolder = placeHolder;\n    }\n\n    @Override\n    public ColumnWidthMode getColumnWidthMode() {\n        return columnWidthMode;\n    }\n\n    @Override\n    public void setColumnWidthMode(ColumnWidthMode columnWidthMode) {\n        this.columnWidthMode = columnWidthMode;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof BaseGridColumn)) {\n            return false;\n        }\n\n        BaseGridColumn that = (BaseGridColumn) o;\n\n        if (Double.compare(that.width,\n                           width) != 0) {\n            return false;\n        }\n        if (isResizable != that.isResizable) {\n            return false;\n        }\n        if (isMovable != that.isMovable) {\n            return false;\n        }\n        if (isVisible != that.isVisible) {\n            return false;\n        }\n        if (index != that.index) {\n            return false;\n        }\n        if (minimumWidth != null ? !minimumWidth.equals(that.minimumWidth) : that.minimumWidth != null) {\n            return false;\n        }\n        if (maximumWidth != null ? !maximumWidth.equals(that.maximumWidth) : that.maximumWidth != null) {\n            return false;\n        }\n        if (link != null ? !link.equals(that.link) : that.link != null) {\n            return false;\n        }\n        return getHeaderMetaData().equals(that.getHeaderMetaData());\n    }\n\n    @Override\n    public int hashCode() {\n        int result;\n        long temp;\n        temp = Double.doubleToLongBits(width);\n        result = (int) (temp ^ (temp >>> 32));\n        result = ~~result;\n        result = 31 * result + (isResizable ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (isMovable ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (isVisible ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (minimumWidth != null ? minimumWidth.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (maximumWidth != null ? maximumWidth.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (link != null ? link.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + index;\n        result = ~~result;\n        result = 31 * result + getHeaderMetaData().hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridData.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.AbstractMap;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.OptionalDouble;\nimport java.util.OptionalInt;\nimport java.util.TreeMap;\nimport java.util.function.Function;\nimport java.util.function.Supplier;\nimport java.util.stream.IntStream;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\n\n/**\n * Base implementation of a grid to avoid boiler-plate for more specific implementations.\n */\npublic class BaseGridData implements GridData {\n\n    protected boolean isMerged = true;\n    protected boolean isRowDraggingEnabled = true;\n    protected boolean isColumnDraggingEnabled = true;\n    protected List<GridRow> rows = new ArrayList<>();\n    protected List<GridColumn<?>> columns = new ArrayList<>();\n    protected List<SelectedCell> selectedCells = new ArrayList<>();\n    protected List<SelectedCell> selectedHeaderCells = new ArrayList<>();\n    protected int headerRowCount = 0;\n\n    protected BaseGridDataIndexManager indexManager = new BaseGridDataIndexManager(this);\n    protected BaseGridDataSelectionsManager selectionsManager = new BaseGridDataSelectionsManager(this);\n    private int visibleWidth;\n    private int visibleHeight;\n    private int previousVisibleWidth;\n\n    public BaseGridData() {\n        this(true);\n    }\n\n    public BaseGridData(final boolean isMerged) {\n        this.isMerged = isMerged;\n    }\n\n    @Override\n    public List<GridColumn<?>> getColumns() {\n        return Collections.unmodifiableList(columns);\n    }\n\n    @Override\n    public int getColumnCount() {\n        return columns.size();\n    }\n\n    @Override\n    public void appendColumn(final GridColumn<?> column) {\n        double originalWidth = getWidth();\n        column.setIndex(columns.size());\n        columns.add(column);\n\n        OptionalDouble optionalOriginalWidth = OptionalDouble.of(originalWidth);\n\n        if (GridColumn.ColumnWidthMode.isAuto(column)) {\n            column.setWidth(calculateInitWidth(column, optionalOriginalWidth));\n            internalRefreshWidth(true, optionalOriginalWidth);\n        }\n        selectionsManager.onInsertColumn(columns.size() - 1);\n    }\n\n    @Override\n    public void insertColumn(final int index,\n                             final GridColumn<?> column) {\n        double originalWidth = getWidth();\n        column.setIndex(columns.size());\n        columns.add(index,\n                    column);\n\n        OptionalDouble optionalOriginalWidth = OptionalDouble.of(originalWidth);\n\n        if (GridColumn.ColumnWidthMode.isAuto(column)) {\n            column.setWidth(calculateInitWidth(column, optionalOriginalWidth));\n            internalRefreshWidth(true, optionalOriginalWidth);\n        }\n        selectionsManager.onInsertColumn(index);\n    }\n\n    @Override\n    public void deleteColumn(final GridColumn<?> column) {\n        final int index = column.getIndex();\n        for (GridColumn<?> c : columns) {\n            if (c.getIndex() > index) {\n                c.setIndex(c.getIndex() - 1);\n            }\n        }\n\n        //Destroy column\n        if (column.getColumnRenderer() instanceof HasDOMElementResources) {\n            ((HasDOMElementResources) column.getColumnRenderer()).destroyResources();\n        }\n\n        removeColumn(column);\n\n        //Destroy column related cell\n        for (GridRow row : rows) {\n            ((BaseGridRow) row).deleteCell(index);\n            //Shift all cells according to the removed one\n            final Map<Integer, GridCell<?>> clone = new TreeMap<>(row.getCells());\n            for (Map.Entry<Integer, GridCell<?>> e : clone.entrySet()) {\n                if (e.getKey() > index) {\n                    ((BaseGridRow) row).deleteCell(e.getKey());\n                    ((BaseGridRow) row).setCell(e.getKey() - 1,\n                                                e.getValue());\n                }\n            }\n        }\n\n        internalRefreshWidth(true, OptionalDouble.empty());\n\n        selectionsManager.onDeleteColumn(index);\n    }\n\n    void removeColumn(final GridColumn<?> column) {\n        final IntStream indexes = IntStream.range(0, columns.size());\n        final OptionalInt columnIndex = indexes.filter(i -> column == columns.get(i)).findFirst();\n\n        if (columnIndex.isPresent()) {\n            columns.remove(columnIndex.getAsInt());\n        } else {\n            columns.remove(column);\n        }\n\n        internalRefreshWidth(true, OptionalDouble.empty());\n    }\n\n    @Override\n    public void moveColumnTo(final int index,\n                             final GridColumn<?> column) {\n        moveColumnsTo(index,\n                      new ArrayList<GridColumn<?>>() {{\n                          add(column);\n                      }});\n    }\n\n    @Override\n    public void moveColumnsTo(final int index,\n                              final List<GridColumn<?>> columns) {\n        if (columns == null || columns.isEmpty()) {\n            return;\n        }\n        final int currentIndex = this.columns.indexOf(columns.get(0));\n\n        //Moving left\n        if (index < currentIndex) {\n            this.columns.removeAll(columns);\n            this.columns.addAll(index,\n                                columns);\n        }\n\n        //Moving right\n        if (index > currentIndex) {\n            this.columns.removeAll(columns);\n            this.columns.addAll(index - columns.size() + 1,\n                                columns);\n        }\n    }\n\n    @Override\n    public List<GridRow> getRows() {\n        return Collections.unmodifiableList(rows);\n    }\n\n    @Override\n    public GridRow getRow(final int rowIndex) {\n        return rows.get(rowIndex);\n    }\n\n    @Override\n    public void appendRow(final GridRow row) {\n        this.rows.add(row);\n    }\n\n    @Override\n    public void insertRow(final int rowIndex,\n                          final GridRow row) {\n        this.rows.add(rowIndex,\n                      row);\n\n        indexManager.onInsertRow(rowIndex);\n        selectionsManager.onInsertRow(rowIndex);\n    }\n\n    @Override\n    public Range deleteRow(final int rowIndex) {\n        //Find row that is the \"lead\" in a merged collapsed block\n        GridRow row;\n        int minRowIndex = rowIndex;\n        int maxRowIndex = rowIndex;\n        while ((row = rows.get(minRowIndex)).isMerged() && row.isCollapsed() && minRowIndex > 0) {\n            minRowIndex--;\n        }\n\n        //Find last row in a merged collapsed block\n        do {\n            maxRowIndex++;\n        }\n        while (maxRowIndex < rows.size() && rows.get(maxRowIndex).isCollapsed());\n        maxRowIndex--;\n\n        final Range range = new Range(minRowIndex,\n                                      maxRowIndex);\n\n        for (int _rowIndex = minRowIndex; _rowIndex <= maxRowIndex; _rowIndex++) {\n            rows.remove(minRowIndex);\n        }\n\n        indexManager.onDeleteRow(range);\n        selectionsManager.onDeleteRow(range);\n\n        return range;\n    }\n\n    @Override\n    public void moveRowTo(final int index,\n                          final GridRow row) {\n        moveRowsTo(index,\n                   new ArrayList<GridRow>() {{\n                       add(row);\n                   }});\n    }\n\n    @Override\n    public void moveRowsTo(final int index,\n                           final List<GridRow> rows) {\n        if (rows == null || rows.isEmpty()) {\n            return;\n        }\n\n        //Get extent of block being moved\n        final int oldBlockStart = this.rows.indexOf(rows.get(0));\n        final int oldBlockEnd = this.rows.indexOf(rows.get(rows.size() - 1));\n\n        //If we're attempting to move it to its current index just exit\n        if (index == oldBlockStart) {\n            return;\n        }\n\n        this.rows.removeAll(rows);\n\n        if (index < oldBlockStart) {\n            this.rows.addAll(index,\n                             rows);\n        } else if (index > oldBlockStart) {\n            this.rows.addAll(index - rows.size() + 1,\n                             rows);\n        }\n\n        final Range oldBlockExtent = new Range(oldBlockStart,\n                                               oldBlockEnd);\n        indexManager.onMoveRows(rows,\n                                oldBlockExtent);\n        selectionsManager.onMoveRows(rows,\n                                     oldBlockExtent);\n    }\n\n    @Override\n    public int getRowCount() {\n        return rows.size();\n    }\n\n    @Override\n    public int getHeaderRowCount() {\n        int headerRowCount = this.headerRowCount;\n        for (GridColumn<?> column : columns) {\n            headerRowCount = Math.max(headerRowCount, column.getHeaderMetaData().size());\n        }\n        return headerRowCount;\n    }\n\n    @Override\n    public void setHeaderRowCount(final int headerRowCount) {\n        if (!(headerRowCount >= 0)) {\n            throw new IllegalStateException(\"headerRowCount\");\n        }\n        this.headerRowCount = headerRowCount;\n    }\n\n    @Override\n    public GridCell<?> getCell(final int rowIndex,\n                               final int columnIndex) {\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return null;\n        }\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n        return rows.get(rowIndex).getCells().get(_columnIndex);\n    }\n\n    @Override\n    public SelectedCell getSelectedCellsOrigin() {\n        return selectedCells.isEmpty() ? null : selectedCells.get(0);\n    }\n\n    @Override\n    public List<SelectedCell> getSelectedCells() {\n        return selectedCells;\n    }\n\n    @Override\n    public List<SelectedCell> getSelectedHeaderCells() {\n        return selectedHeaderCells;\n    }\n\n    @Override\n    public void clearSelections() {\n        selectedCells.clear();\n        selectedHeaderCells.clear();\n    }\n\n    @Override\n    public void updateColumn(final int index,\n                             final GridColumn<?> column) {\n        //Destroy existing column\n        final GridColumn<?> existing = columns.get(index);\n        if (existing.getColumnRenderer() instanceof HasDOMElementResources) {\n            ((HasDOMElementResources) existing.getColumnRenderer()).destroyResources();\n        }\n\n        //Replace existing with new column\n        column.setIndex(columns.get(index).getIndex());\n        columns.set(index,\n                    column);\n\n        //Clear column data\n        for (GridRow row : rows) {\n            ((BaseGridRow) row).deleteCell(column.getIndex());\n        }\n    }\n\n    @Override\n    public boolean isMerged() {\n        return this.isMerged;\n    }\n\n    @Override\n    public void setMerged(final boolean isMerged) {\n        if (this.isMerged == isMerged) {\n            return;\n        }\n        this.isMerged = isMerged;\n        indexManager.onMerge(isMerged);\n        selectionsManager.onMerge(isMerged);\n    }\n\n    @Override\n    public boolean isRowDraggingEnabled() {\n        return this.isRowDraggingEnabled;\n    }\n\n    @Override\n    public void setRowDraggingEnabled(final boolean enabled) {\n        this.isRowDraggingEnabled = enabled;\n    }\n\n    @Override\n    public boolean isColumnDraggingEnabled() {\n        return this.isColumnDraggingEnabled;\n    }\n\n    @Override\n    public void setColumnDraggingEnabled(final boolean enabled) {\n        this.isColumnDraggingEnabled = enabled;\n    }\n\n    @Override\n    public Range setCell(final int rowIndex,\n                         final int columnIndex,\n                         final Supplier<GridCell<?>> cellSupplier) {\n        return doSetCell(rowIndex,\n                         columnIndex,\n                         (pair) -> cellSupplier.get());\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public Range setCellValue(final int rowIndex,\n                              final int columnIndex,\n                              final GridCellValue<?> value) {\n        return doSetCell(rowIndex,\n                         columnIndex,\n                         (pair) -> {\n                             final Optional<BaseGridCell> cell = Optional.ofNullable((BaseGridCell) getCell(pair.getKey(), pair.getValue()));\n                             final BaseGridCell c = cell.orElse(new BaseGridCell<>(value));\n                             c.setValue(value);\n                             return c;\n                         });\n    }\n\n    protected Range doSetCell(final int rowIndex,\n                              final int columnIndex,\n                              final Function<Map.Entry<Integer, Integer>, GridCell<?>> cellSupplier) {\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return new Range(rowIndex);\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return new Range(rowIndex);\n        }\n\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n\n        //If we're not merged just set the value of a single cell\n        if (!isMerged) {\n            ((BaseGridRow) rows.get(rowIndex)).setCell(_columnIndex,\n                                                       cellSupplier.apply(new AbstractMap.SimpleEntry<>(rowIndex, columnIndex)));\n            return new Range(rowIndex);\n        }\n\n        //Find affected rows for merged data\n        final int minRowIndex = findMinRowIndexForCellUpdate(rowIndex,\n                                                             _columnIndex);\n        final int maxRowIndex = findMaxRowIndexForCellUpdate(rowIndex,\n                                                             _columnIndex);\n\n        //Update all rows' value\n        final Range range = new Range(minRowIndex,\n                                      maxRowIndex);\n        for (int i = minRowIndex; i <= maxRowIndex; i++) {\n            final GridRow row = rows.get(i);\n            ((BaseGridRow) row).setCell(_columnIndex,\n                                        cellSupplier.apply(new AbstractMap.SimpleEntry<>(i, columnIndex)));\n        }\n\n        indexManager.onSetCell(range,\n                               _columnIndex);\n\n        return range;\n    }\n\n    @Override\n    public Range deleteCell(final int rowIndex,\n                            final int columnIndex) {\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return new Range(rowIndex);\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return new Range(rowIndex);\n        }\n\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n\n        //If we're not merged just set the value of a single cell\n        if (!isMerged) {\n            ((BaseGridRow) rows.get(rowIndex)).deleteCell(_columnIndex);\n            return new Range(rowIndex);\n        }\n\n        //Find affected rows for merged data\n        final int minRowIndex = findMinRowIndexForCellUpdate(rowIndex,\n                                                             _columnIndex);\n        final int maxRowIndex = findMaxRowIndexForCellUpdate(rowIndex,\n                                                             _columnIndex);\n\n        //Update all rows' value\n        final Range range = new Range(minRowIndex,\n                                      maxRowIndex);\n        for (int i = minRowIndex; i <= maxRowIndex; i++) {\n            final GridRow row = rows.get(i);\n            ((BaseGridRow) row).deleteCell(_columnIndex);\n            row.expand();\n        }\n\n        indexManager.onDeleteCell(range,\n                                  _columnIndex);\n\n        return range;\n    }\n\n    @Override\n    public Range selectCell(final int rowIndex,\n                            final int columnIndex) {\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return new Range(rowIndex);\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return new Range(rowIndex);\n        }\n\n        return selectionsManager.onSelectCell(rowIndex,\n                                              columnIndex);\n    }\n\n    @Override\n    public Range selectCells(final int rowIndex,\n                             final int columnIndex,\n                             final int width,\n                             final int height) {\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return new Range(rowIndex);\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return new Range(rowIndex);\n        }\n\n        return selectionsManager.onSelectCells(rowIndex,\n                                               columnIndex,\n                                               width,\n                                               height);\n    }\n\n    @Override\n    public Range selectHeaderCell(final int headerRowIndex,\n                                  final int headerColumnIndex) {\n        if (headerColumnIndex < 0 || headerColumnIndex > columns.size() - 1) {\n            return new Range(headerRowIndex);\n        }\n        final GridColumn<?> gridColumn = getColumns().get(headerColumnIndex);\n        final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData();\n        if (headerRowIndex < 0 || headerRowIndex > gridColumnHeaderMetaData.size() - 1) {\n            return new Range(headerRowIndex);\n        }\n\n        return selectionsManager.onSelectHeaderCell(headerRowIndex,\n                                                    headerColumnIndex);\n    }\n\n    @Override\n    public void collapseCell(final int rowIndex,\n                             final int columnIndex) {\n        //Data needs to be merged to collapse cells\n        if (!isMerged) {\n            return;\n        }\n\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n        final GridRow row = rows.get(rowIndex);\n        final GridCell<?> cell = row.getCells().get(_columnIndex);\n        if (cell == null) {\n            return;\n        }\n        if (!cell.isMerged()) {\n            return;\n        }\n        indexManager.onCollapseCell(rowIndex,\n                                    _columnIndex);\n    }\n\n    @Override\n    public void expandCell(final int rowIndex,\n                           final int columnIndex) {\n        //Data needs to be merged to expand cells\n        if (!isMerged) {\n            return;\n        }\n\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n        final GridRow row = rows.get(rowIndex);\n        final GridCell<?> cell = row.getCells().get(_columnIndex);\n        if (cell == null) {\n            return;\n        }\n        indexManager.onExpandCell(rowIndex,\n                                  _columnIndex);\n    }\n\n    private int findMinRowIndexForCellUpdate(final int rowIndex,\n                                             final int columnIndex) {\n        int minRowIndex = rowIndex;\n        final GridRow currentRow = getRow(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find minimum row with a cell containing the same value as that being updated\n        boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0;\n        while (minRowIndex > 0) {\n            final GridRow previousRow = rows.get(minRowIndex - 1);\n            final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n            if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) {\n                if (previousRowCell == null) {\n                    break;\n                }\n                if (previousRowCell.isCollapsed() && foundTopSplitMarker) {\n                    break;\n                }\n                if (!previousRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                if (previousRowCell.getMergedCellCount() > 0) {\n                    foundTopSplitMarker = true;\n                }\n            }\n            minRowIndex--;\n        }\n        return minRowIndex;\n    }\n\n    private int findMaxRowIndexForCellUpdate(final int rowIndex,\n                                             final int columnIndex) {\n        int maxRowIndex = rowIndex + 1;\n        final GridRow currentRow = getRow(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find maximum row with a cell containing the same value as that being updated\n        boolean foundBottomSplitMarker = false;\n        while (maxRowIndex < rows.size()) {\n            final GridRow nextRow = rows.get(maxRowIndex);\n            final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n            if (!nextRow.isCollapsed()) {\n                if (nextRowCell == null) {\n                    break;\n                }\n                if (nextRowCell.isCollapsed() && foundBottomSplitMarker) {\n                    maxRowIndex--;\n                    break;\n                }\n                if (!nextRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                if (nextRowCell.getMergedCellCount() > 0) {\n                    foundBottomSplitMarker = true;\n                }\n            }\n            maxRowIndex++;\n        }\n        return maxRowIndex - 1;\n    }\n\n    @Override\n    public boolean refreshWidth() {\n        return internalRefreshWidth(false, OptionalDouble.empty());\n    }\n\n    @Override\n    public boolean refreshWidth(double currentWidth) {\n        return internalRefreshWidth(false, OptionalDouble.of(currentWidth));\n    }\n\n    protected boolean internalRefreshWidth(boolean changedNumberOfColumn, OptionalDouble optionalCurrentWidth) {\n\n        double visibleWidth = getVisibleWidth();\n        // this happens during initialization\n        if (visibleWidth == 0) {\n            return false;\n        }\n        // refresh is not needed if it has not been added a column and visibleWidth doesn't change (except if\n        // previousVisibleWidth is 0 so it is the first refresh)\n        if (!changedNumberOfColumn && previousVisibleWidth != 0 && visibleWidth == previousVisibleWidth) {\n            return false;\n        }\n\n        GridWidthMetadata gridWidthMetadata = new GridWidthMetadata(optionalCurrentWidth);\n\n        // if there are no columns with AUTO width no need to continue\n        if (gridWidthMetadata.numberOfAutoColumn == 0) {\n            return false;\n        }\n\n        // verify if grid was 100% width with a delta\n        boolean wasFullWidth = Math.abs(gridWidthMetadata.currentGrossWidth - previousVisibleWidth) < 0.1;\n\n        // keep 100% width or max between visible area and grid width\n        double targetGrossWidth = wasFullWidth ? visibleWidth : Math.max(visibleWidth, gridWidthMetadata.currentGrossWidth);\n\n        double currentWidth = getWidth() - gridWidthMetadata.fixedWidth;\n        double targetWidth = targetGrossWidth - gridWidthMetadata.fixedWidth;\n\n        // if grid is greater than visible panel and it wasn't at full width no refresh is needed\n        if (visibleWidth < gridWidthMetadata.currentGrossWidth && !wasFullWidth) {\n            return false;\n        }\n\n        boolean toRedraw = false;\n        for (GridColumn<?> column : getColumns()) {\n            if (!column.isVisible() || !GridColumn.ColumnWidthMode.isAuto(column)) {\n                continue;\n            }\n            double oldWidth = column.getWidth();\n            double ratio = oldWidth / currentWidth;\n            double newWidth = ratio * targetWidth;\n            // this could happen during initialization when columns can be added before the first call to setVisibleSizeAndRefresh\n            if (oldWidth == 0) {\n                newWidth = calculateInitWidth(column, OptionalDouble.empty());\n            }\n            if (newWidth < column.getMinimumWidth()) {\n                newWidth = column.getMinimumWidth();\n            }\n            // if nothing changed no need to update nor refresh\n            if (newWidth != oldWidth) {\n                column.setWidth(newWidth);\n                toRedraw = true;\n            }\n        }\n        return toRedraw;\n    }\n\n    protected double getWidth() {\n        return getColumns().stream().filter(GridColumn::isVisible).mapToDouble(GridColumn::getWidth).sum();\n    }\n\n    @Override\n    public boolean setVisibleSizeAndRefresh(int width, int height) {\n        this.previousVisibleWidth = this.visibleWidth;\n        this.visibleWidth = width;\n        this.visibleHeight = height;\n        return refreshWidth();\n    }\n\n    @Override\n    public int getVisibleWidth() {\n        return this.visibleWidth;\n    }\n\n    @Override\n    public int getVisibleHeight() {\n        return this.visibleHeight;\n    }\n\n    double calculateInitWidth(GridColumn<?> column, OptionalDouble optionalCurrentWidth) {\n        if (!GridColumn.ColumnWidthMode.isAuto(column)) {\n            return column.getWidth();\n        }\n        GridWidthMetadata gridWidthMetadata = new GridWidthMetadata(optionalCurrentWidth);\n        int visibleWidth = getVisibleWidth();\n\n        double calculatedWidth;\n        if (gridWidthMetadata.numberOfAutoColumn < 2) {\n            calculatedWidth = visibleWidth - gridWidthMetadata.fixedWidth;\n        } else {\n            calculatedWidth = (visibleWidth - gridWidthMetadata.fixedWidth) / (gridWidthMetadata.numberOfAutoColumn - 1);\n        }\n        return Math.max(calculatedWidth, column.getMinimumWidth());\n    }\n\n    private class GridWidthMetadata {\n\n        // total size of the grid\n        private double currentGrossWidth = 0;\n        private double previousWidth = 0;\n        private long numberOfAutoColumn = 0;\n        // total size of FIXED column\n        private double fixedWidth = 0;\n\n        private GridWidthMetadata(OptionalDouble optionalCurrentWidth) {\n            for (GridColumn<?> column : getColumns()) {\n                if (!column.isVisible()) {\n                    continue;\n                }\n                double columnWidth = column.getWidth();\n\n                currentGrossWidth += columnWidth;\n                numberOfAutoColumn = GridColumn.ColumnWidthMode.isAuto(column) ? numberOfAutoColumn + 1 : numberOfAutoColumn;\n                fixedWidth = GridColumn.ColumnWidthMode.isFixed(column) ? fixedWidth + columnWidth : fixedWidth;\n            }\n            previousWidth = optionalCurrentWidth.orElse(currentGrossWidth);\n            if (optionalCurrentWidth.isPresent()) {\n                currentGrossWidth = optionalCurrentWidth.getAsDouble();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridDataIndexManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\n\n/**\n * Helper class that manages \"merge\" and \"group\" meta-data following different mutations to {@link GridData}\n */\npublic class BaseGridDataIndexManager {\n\n    private final GridData gridData;\n\n    public BaseGridDataIndexManager(final GridData gridData) {\n        this.gridData = gridData;\n    }\n\n    public void onMerge(final boolean isMerged) {\n        if (isMerged) {\n            fullIndex();\n        } else {\n            reset();\n        }\n    }\n\n    //Update all merge meta-data\n    private void fullIndex() {\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {\n            indexColumn(columnIndex);\n        }\n    }\n\n    //Update merge meta-data for a single column\n    public void indexColumn(final int columnIndex) {\n        final List<GridRow> rows = gridData.getRows();\n        for (int rowIndex = 0; rowIndex < rows.size(); rowIndex++) {\n            final GridCell<?> currentRowCell = gridData.getCell(rowIndex,\n                                                                columnIndex);\n            if (currentRowCell == null) {\n                continue;\n            }\n\n            currentRowCell.reset();\n\n            int maxRowIndex = rowIndex + 1;\n            while (maxRowIndex < rows.size()) {\n                final GridCell<?> nextRowCell = gridData.getCell(maxRowIndex,\n                                                                 columnIndex);\n                if (nextRowCell == null) {\n                    break;\n                }\n                if (!nextRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                maxRowIndex++;\n            }\n\n            //Update merge meta-data\n            if (maxRowIndex - rowIndex > 1) {\n                for (int i = rowIndex; i < maxRowIndex; i++) {\n                    final GridRow row = rows.get(i);\n                    final GridCell<?> cell = gridData.getCell(i,\n                                                              columnIndex);\n                    ((BaseGridCell) cell).setMergedCellCount(0);\n                    updateRowMergedCells(row);\n                }\n\n                final GridRow row = rows.get(rowIndex);\n                final GridCell<?> cell = gridData.getCell(rowIndex,\n                                                          columnIndex);\n                ((BaseGridCell) cell).setMergedCellCount(maxRowIndex - rowIndex);\n                updateRowMergedCells(row);\n\n                rowIndex = maxRowIndex - 1;\n            }\n        }\n    }\n\n    //Clear all merge meta-data\n    private void reset() {\n        final List<GridRow> rows = gridData.getRows();\n        for (GridRow row : rows) {\n            row.reset();\n        }\n    }\n\n    public void onInsertRow(final int rowIndex) {\n        if (!gridData.isMerged()) {\n            return;\n        }\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {\n            final GridColumn<?> column = columns.get(columnIndex);\n            final int _columnIndex = column.getIndex();\n            if (rowIndex > 0) {\n                updateMergeMetaData(rowIndex - 1,\n                                    _columnIndex);\n            }\n            if (rowIndex < gridData.getRowCount() - 1) {\n                updateMergeMetaData(rowIndex + 1,\n                                    _columnIndex);\n            }\n        }\n    }\n\n    public void onDeleteRow(final GridData.Range range) {\n        if (!gridData.isMerged()) {\n            return;\n        }\n        final int minRowIndex = range.getMinRowIndex();\n        final int maxRowIndex = range.getMaxRowIndex();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        for (int _rowIndex = minRowIndex; _rowIndex <= maxRowIndex; _rowIndex++) {\n            for (int columnIndex = 0; columnIndex < columns.size(); columnIndex++) {\n                final GridColumn<?> column = columns.get(columnIndex);\n                final int _columnIndex = column.getIndex();\n                if (minRowIndex < gridData.getRowCount()) {\n                    updateMergeMetaData(minRowIndex,\n                                        _columnIndex);\n                } else if (minRowIndex > 0) {\n                    updateMergeMetaData(minRowIndex - 1,\n                                        _columnIndex);\n                }\n            }\n        }\n    }\n\n    private void updateMergeMetaData(final int rowIndex,\n                                     final int columnIndex) {\n        updateMergeMetaData(rowIndex,\n                            columnIndex,\n                            0,\n                            gridData.getRowCount());\n    }\n\n    private void updateMergeMetaData(final int rowIndex,\n                                     final int columnIndex,\n                                     final int minRowIndex,\n                                     final int maxRowIndex) {\n        //Find the cell's current value\n        final GridRow currentRow = gridData.getRow(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find minimum row with a cell containing the same value as that being updated\n        final int minBlockRowIndex = findMinRowIndex(rowIndex,\n                                                     columnIndex,\n                                                     minRowIndex,\n                                                     currentRowCell);\n        //Find maximum row with a cell containing the same value as that being updated\n        final int maxBlockRowIndex = findMaxRowIndex(rowIndex,\n                                                     columnIndex,\n                                                     maxRowIndex,\n                                                     currentRowCell);\n\n        //Update merge meta-data\n        updateMergeMetaData(minBlockRowIndex,\n                            maxBlockRowIndex,\n                            columnIndex);\n    }\n\n    public void onSetCell(final GridData.Range range,\n                          final int columnIndex) {\n        final int minRowIndex = range.getMinRowIndex();\n        updateMergeMetaData(minRowIndex,\n                            columnIndex);\n    }\n\n    public void onDeleteCell(final GridData.Range range,\n                             final int columnIndex) {\n        final int minRowIndex = range.getMinRowIndex();\n        final int maxRowIndex = range.getMaxRowIndex();\n        for (int i = minRowIndex; i <= maxRowIndex; i++) {\n            final GridRow row = gridData.getRow(i);\n            updateRowMergedCells(row);\n        }\n\n        updateMergeMetaData(minRowIndex,\n                            columnIndex);\n    }\n\n    public void onCollapseCell(final int rowIndex,\n                               final int columnIndex) {\n        int minRowIndex = rowIndex;\n        int maxRowIndex = rowIndex + 1;\n        final List<GridRow> rows = gridData.getRows();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final GridRow currentRow = rows.get(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        if (currentRowCell == null) {\n            return;\n        }\n\n        if (currentRowCell.getMergedCellCount() == 0) {\n            do {\n                minRowIndex--;\n                final GridRow previousRow = rows.get(minRowIndex);\n                final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n                if (previousRowCell.getMergedCellCount() > 0) {\n                    break;\n                }\n            }\n            while (minRowIndex > 0);\n        }\n\n        while (maxRowIndex < rows.size()) {\n            final GridRow nextRow = rows.get(maxRowIndex);\n            final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n            if (nextRowCell == null) {\n                break;\n            }\n            if (nextRowCell.getMergedCellCount() > 0) {\n                break;\n            }\n            maxRowIndex++;\n        }\n\n        for (int i = minRowIndex + 1; i < maxRowIndex; i++) {\n            rows.get(i).collapse();\n        }\n\n        for (int i = 0; i < columns.size(); i++) {\n            final int _columnIndex = columns.get(i).getIndex();\n            if (_columnIndex == columnIndex) {\n                continue;\n            }\n            updateMergeMetaDataOnCollapseTopSplitRows(minRowIndex,\n                                                      maxRowIndex,\n                                                      _columnIndex);\n            updateMergeMetaDataOnCollapseBottomSplitRows(minRowIndex,\n                                                         maxRowIndex,\n                                                         _columnIndex);\n        }\n    }\n\n    private void updateMergeMetaDataOnCollapseTopSplitRows(final int minRowIndex,\n                                                           final int maxRowIndex,\n                                                           final int columnIndex) {\n        if (minRowIndex < 1) {\n            return;\n        }\n\n        final List<GridRow> rows = gridData.getRows();\n        final GridRow checkTopRow = gridData.getRow(minRowIndex - 1);\n        final GridCell<?> checkTopCell = checkTopRow.getCells().get(columnIndex);\n\n        if (checkTopCell == null) {\n            return;\n        }\n\n        if (checkTopCell.getMergedCellCount() == 1) {\n            return;\n        }\n\n        // Scan from the first row before the start of collapsed block downwards to the end of the\n        // collapsed block. If any cell is not identical to first then we need to split the cell.\n        boolean splitTopSection = false;\n        for (int collapsedRowIndex = minRowIndex; collapsedRowIndex < maxRowIndex; collapsedRowIndex++) {\n            final GridRow collapsedRow = gridData.getRow(collapsedRowIndex);\n            final GridCell<?> collapsedCell = collapsedRow.getCells().get(columnIndex);\n            if (collapsedCell == null) {\n                break;\n            }\n            if (!collapsedCell.equals(checkTopCell)) {\n                break;\n            }\n            splitTopSection = collapsedRowIndex < maxRowIndex - 1;\n        }\n\n        if (splitTopSection) {\n\n            //Find minimum row with a cell containing the same value as the split-point\n            int checkMinRowIndex = minRowIndex - 1;\n            if (checkTopCell.getMergedCellCount() == 0) {\n                while (checkMinRowIndex > 0) {\n                    final GridRow previousRow = rows.get(checkMinRowIndex);\n                    final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n                    if (previousRowCell == null) {\n                        break;\n                    }\n                    if (previousRowCell.getMergedCellCount() > 0) {\n                        break;\n                    }\n                    checkMinRowIndex--;\n                }\n            }\n\n            //Update merge meta-data for top part of split cell\n            if (minRowIndex > checkMinRowIndex) {\n                for (int i = checkMinRowIndex; i < minRowIndex; i++) {\n                    final GridRow row = rows.get(i);\n                    final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n                    if (cell != null) {\n                        cell.setMergedCellCount(0);\n                    }\n                    updateRowMergedCells(row);\n                }\n\n                final GridRow topSplitRow = rows.get(checkMinRowIndex);\n                final BaseGridCell topSplitRowCell = ((BaseGridCell) topSplitRow.getCells().get(columnIndex));\n                if (topSplitRowCell != null) {\n                    topSplitRowCell.setMergedCellCount(minRowIndex - checkMinRowIndex);\n                }\n                updateRowMergedCells(topSplitRow);\n            }\n\n            //Find maximum row with a cell containing the same value as the split-point\n            int checkMaxRowIndex = minRowIndex;\n            boolean foundBottomSplitMarker = false;\n            while (checkMaxRowIndex < rows.size()) {\n                final GridRow nextRow = rows.get(checkMaxRowIndex);\n                final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n                if (nextRowCell == null) {\n                    break;\n                }\n                if (nextRowCell.isCollapsed() && foundBottomSplitMarker) {\n                    checkMaxRowIndex--;\n                    break;\n                }\n                if (!nextRowCell.equals(checkTopCell)) {\n                    break;\n                }\n                if (nextRowCell.getMergedCellCount() > 0) {\n                    foundBottomSplitMarker = true;\n                }\n                checkMaxRowIndex++;\n            }\n\n            //Update merge meta-data for bottom part of split cell\n            if (checkMaxRowIndex > minRowIndex) {\n                for (int i = minRowIndex; i < checkMaxRowIndex; i++) {\n                    final GridRow row = rows.get(i);\n                    final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n                    if (cell != null) {\n                        cell.setMergedCellCount(0);\n                    }\n                    updateRowMergedCells(row);\n                }\n\n                final GridRow bottomSplitRow = rows.get(minRowIndex);\n                final BaseGridCell bottomSplitRowCell = ((BaseGridCell) bottomSplitRow.getCells().get(columnIndex));\n                if (bottomSplitRowCell != null) {\n                    bottomSplitRowCell.setMergedCellCount(checkMaxRowIndex - minRowIndex);\n                }\n                updateRowMergedCells(bottomSplitRow);\n            }\n        }\n    }\n\n    private void updateMergeMetaDataOnCollapseBottomSplitRows(final int minRowIndex,\n                                                              final int maxRowIndex,\n                                                              final int columnIndex) {\n        final List<GridRow> rows = gridData.getRows();\n        if (maxRowIndex == rows.size()) {\n            return;\n        }\n\n        final GridRow checkBottomRow = gridData.getRow(maxRowIndex);\n        final GridCell<?> checkBottomCell = checkBottomRow.getCells().get(columnIndex);\n\n        if (checkBottomCell == null) {\n            return;\n        }\n\n        if (checkBottomCell.getMergedCellCount() == 1) {\n            return;\n        }\n\n        // Scan from the first row after the end of collapsed block upwards to the beginning of the\n        // collapsed block. If any cell is not identical to first then we need to split the cell.\n        boolean splitBottomSection = false;\n        for (int collapsedRowIndex = maxRowIndex - 1; collapsedRowIndex >= minRowIndex; collapsedRowIndex--) {\n            final GridRow collapsedRow = gridData.getRow(collapsedRowIndex);\n            final GridCell<?> collapsedCell = collapsedRow.getCells().get(columnIndex);\n            if (collapsedCell == null) {\n                break;\n            }\n            if (!collapsedCell.equals(checkBottomCell)) {\n                break;\n            }\n            splitBottomSection = collapsedRowIndex > minRowIndex;\n        }\n\n        if (splitBottomSection) {\n\n            //Find minimum row with a cell containing the same value as the split-point\n            int checkMinRowIndex = maxRowIndex - 1;\n            if (checkBottomCell.getMergedCellCount() == 0) {\n                while (checkMinRowIndex > 0) {\n                    final GridRow previousRow = rows.get(checkMinRowIndex);\n                    final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n                    if (previousRowCell == null) {\n                        break;\n                    }\n                    if (previousRowCell.getMergedCellCount() > 0) {\n                        break;\n                    }\n                    checkMinRowIndex--;\n                }\n            }\n\n            //Update merge meta-data for top part of split cell\n            if (maxRowIndex > checkMinRowIndex) {\n                for (int i = checkMinRowIndex; i < maxRowIndex; i++) {\n                    final GridRow row = rows.get(i);\n                    final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n                    if (cell != null) {\n                        cell.setMergedCellCount(0);\n                    }\n                    updateRowMergedCells(row);\n                }\n\n                final GridRow topSplitRow = rows.get(checkMinRowIndex);\n                final BaseGridCell topSplitRowCell = ((BaseGridCell) topSplitRow.getCells().get(columnIndex));\n                if (topSplitRowCell != null) {\n                    topSplitRowCell.setMergedCellCount(maxRowIndex - checkMinRowIndex);\n                }\n                updateRowMergedCells(topSplitRow);\n            }\n\n            //Find maximum row with a cell containing the same value as the split-point\n            int checkMaxRowIndex = maxRowIndex;\n            boolean foundBottomSplitMarker = false;\n            while (checkMaxRowIndex < rows.size()) {\n                final GridRow nextRow = rows.get(checkMaxRowIndex);\n                final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n                if (nextRowCell == null) {\n                    break;\n                }\n                if (nextRowCell.isCollapsed() && foundBottomSplitMarker) {\n                    checkMaxRowIndex--;\n                    break;\n                }\n                if (!nextRowCell.equals(checkBottomCell)) {\n                    break;\n                }\n                if (nextRowCell.getMergedCellCount() > 0) {\n                    foundBottomSplitMarker = true;\n                }\n                checkMaxRowIndex++;\n            }\n\n            //Update merge meta-data for bottom part of split cell\n            if (checkMaxRowIndex > maxRowIndex) {\n                for (int i = maxRowIndex; i < checkMaxRowIndex; i++) {\n                    final GridRow row = rows.get(i);\n                    final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n                    if (cell != null) {\n                        cell.setMergedCellCount(0);\n                    }\n                    updateRowMergedCells(row);\n                }\n\n                //Only split bottom if it isn't already split\n                final GridRow bottomSplitRow = rows.get(maxRowIndex);\n                if (bottomSplitRow.getCells().get(columnIndex).getMergedCellCount() == 0) {\n                    final BaseGridCell bottomSplitRowCell = ((BaseGridCell) bottomSplitRow.getCells().get(columnIndex));\n                    if (bottomSplitRowCell != null) {\n                        bottomSplitRowCell.setMergedCellCount(checkMaxRowIndex - maxRowIndex);\n                    }\n                    updateRowMergedCells(bottomSplitRow);\n                }\n            }\n        }\n    }\n\n    public void onExpandCell(final int rowIndex,\n                             final int columnIndex) {\n        int minRowIndex = rowIndex;\n        int maxRowIndex = rowIndex + 1;\n        final List<GridRow> rows = gridData.getRows();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final GridRow currentRow = rows.get(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        if (currentRowCell == null) {\n            return;\n        }\n\n        if (currentRowCell.getMergedCellCount() == 0) {\n            do {\n                minRowIndex--;\n                final GridRow previousRow = rows.get(minRowIndex);\n                final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n                if (previousRowCell == null) {\n                    break;\n                }\n                if (previousRowCell.getMergedCellCount() > 0) {\n                    break;\n                }\n            }\n            while (minRowIndex > 0);\n        }\n\n        while (maxRowIndex < rows.size()) {\n            final GridRow nextRow = rows.get(maxRowIndex);\n            final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n            if (nextRowCell == null) {\n                break;\n            }\n            if (nextRowCell.getMergedCellCount() > 0) {\n                break;\n            }\n            maxRowIndex++;\n        }\n\n        for (int i = minRowIndex + 1; i < maxRowIndex; i++) {\n            rows.get(i).expand();\n        }\n\n        for (int i = 0; i < columns.size(); i++) {\n            final int _columnIndex = columns.get(i).getIndex();\n            updateMergeMetaDataOnExpand(minRowIndex,\n                                        maxRowIndex,\n                                        _columnIndex);\n            updateMergeMetaDataOnExpand(maxRowIndex - 1,\n                                        maxRowIndex,\n                                        _columnIndex);\n        }\n    }\n\n    private void updateMergeMetaDataOnExpand(final int expandMinRowIndex,\n                                             final int expandMaxRowIndex,\n                                             final int columnIndex) {\n        //Find the cell's current value\n        final List<GridRow> rows = gridData.getRows();\n        final GridRow currentRow = gridData.getRow(expandMinRowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find minimum row with a cell containing the same value as that being updated\n        final int minRowIndex = findMinRowIndex(expandMinRowIndex,\n                                                columnIndex,\n                                                0,\n                                                currentRowCell);\n        //Find maximum row with a cell containing the same value as that being updated\n        final int maxRowIndex = findMaxRowIndex(expandMinRowIndex,\n                                                columnIndex,\n                                                rows.size(),\n                                                currentRowCell);\n\n        //Update merge meta-data\n        updateMergeMetaData(minRowIndex,\n                            maxRowIndex,\n                            columnIndex);\n\n        //If merged block is partially collapsed split it\n        final GridRow row = rows.get(minRowIndex);\n        final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n        if (maxRowIndex > expandMaxRowIndex) {\n            final GridRow bottomSplitRow = rows.get(expandMaxRowIndex);\n            if (bottomSplitRow.isCollapsed()) {\n                final BaseGridCell bottomSplitRowCell = ((BaseGridCell) bottomSplitRow.getCells().get(columnIndex));\n                if (bottomSplitRowCell != null) {\n                    bottomSplitRowCell.setMergedCellCount(maxRowIndex - expandMaxRowIndex);\n                }\n                updateRowMergedCells(bottomSplitRow);\n                bottomSplitRow.expand();\n                if (cell != null) {\n                    cell.setMergedCellCount(expandMaxRowIndex - minRowIndex);\n                }\n                updateRowMergedCells(row);\n            }\n        }\n    }\n\n    public void onMoveRows(final List<GridRow> rowsMoved,\n                           final GridData.Range oldBlockExtent) {\n        if (!gridData.isMerged()) {\n            return;\n        }\n\n        final List<GridRow> rows = gridData.getRows();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final int oldBlockEnd = oldBlockExtent.getMaxRowIndex();\n        final int newBlockStart = rows.indexOf(rowsMoved.get(0));\n        final int newBlockEnd = rows.indexOf(rowsMoved.get(rowsMoved.size() - 1));\n\n        boolean isCollapsedBlock = false;\n        for (GridRow rowMoved : rowsMoved) {\n            if (rowMoved.isCollapsed()) {\n                isCollapsedBlock = true;\n                break;\n            }\n        }\n\n        //Update indexes for where rows were removed\n        for (GridColumn<?> column : columns) {\n            final int _columnIndex = column.getIndex();\n            if (oldBlockEnd > 0) {\n                updateMergeMetaData(oldBlockEnd - 1,\n                                    _columnIndex);\n            }\n            if (oldBlockEnd < rows.size() - 1) {\n                updateMergeMetaData(oldBlockEnd + 1,\n                                    _columnIndex);\n            }\n            if (oldBlockEnd == rows.size() - 1) {\n                updateMergeMetaData(oldBlockEnd, _columnIndex);\n            }\n        }\n\n        //Update indexes for where rows were inserted\n        for (GridColumn<?> column : columns) {\n            final int _columnIndex = column.getIndex();\n            if (isCollapsedBlock) {\n                updateMergedMetaDataRowMove(newBlockStart,\n                                            newBlockEnd,\n                                            _columnIndex);\n            } else {\n\n                if (newBlockStart > 0) {\n                    updateMergeMetaData(newBlockStart - 1,\n                                        _columnIndex);\n                }\n                if (newBlockStart < rows.size() - 1) {\n                    updateMergeMetaData(newBlockStart + 1,\n                                        _columnIndex);\n                }\n                if (newBlockEnd > 0) {\n                    updateMergeMetaData(newBlockEnd - 1,\n                                        _columnIndex);\n                }\n                if (newBlockEnd < rows.size() - 1) {\n                    updateMergeMetaData(newBlockEnd + 1,\n                                        _columnIndex);\n                }\n            }\n        }\n    }\n\n    private void updateMergedMetaDataRowMove(final int blockStart,\n                                             final int blockEnd,\n                                             final int columnIndex) {\n        //Back track from the row prior to the BlockStart, correcting MetaData\n        if (blockStart > 0) {\n            final GridRow currentRow = gridData.getRow(blockStart - 1);\n            final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n            int minBlockRowIndex = findMinRowIndex(blockStart - 1,\n                                                   columnIndex,\n                                                   0,\n                                                   currentRowCell);\n            final int maxBlockRowIndex = blockStart;\n\n            //Update merge meta-data\n            updateMergeMetaData(minBlockRowIndex,\n                                maxBlockRowIndex,\n                                columnIndex);\n        }\n\n        //Forward track form the row after the BlockEnd, correcting MetaData\n        if (blockEnd < gridData.getRowCount() - 1) {\n            final GridRow currentRow = gridData.getRow(blockEnd + 1);\n            final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n            final int minBlockRowIndex = blockEnd + 1;\n            final int maxBlockRowIndex = findMaxRowIndex(blockEnd,\n                                                         columnIndex,\n                                                         gridData.getRowCount(),\n                                                         currentRowCell);\n\n            //Update merge meta-data\n            updateMergeMetaData(minBlockRowIndex,\n                                maxBlockRowIndex,\n                                columnIndex);\n        }\n\n        //Update the moved block\n        updateMergeMetaData(blockStart,\n                            columnIndex,\n                            blockStart,\n                            blockEnd + 1);\n    }\n\n    private int findMinRowIndex(final int rowIndex,\n                                final int columnIndex,\n                                final int minRowIndex,\n                                final GridCell<?> currentRowCell) {\n        int minBlockRowIndex = rowIndex;\n\n        if (currentRowCell != null) {\n\n            boolean foundTopSplitMarker = currentRowCell.getMergedCellCount() > 0;\n\n            while (minBlockRowIndex > minRowIndex) {\n                final GridRow previousRow = gridData.getRow(minBlockRowIndex - 1);\n                final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n                if (previousRowCell == null) {\n                    break;\n                }\n                if (previousRowCell.isCollapsed() && foundTopSplitMarker) {\n                    break;\n                }\n                if (!previousRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                if (previousRowCell.getMergedCellCount() > 0) {\n                    foundTopSplitMarker = true;\n                }\n                minBlockRowIndex--;\n            }\n        }\n\n        return minBlockRowIndex;\n    }\n\n    private int findMaxRowIndex(final int rowIndex,\n                                final int columnIndex,\n                                final int maxRowIndex,\n                                final GridCell<?> currentRowCell) {\n\n        int maxBlockRowIndex = rowIndex + 1;\n\n        boolean foundBottomSplitMarker = false;\n        while (maxBlockRowIndex < maxRowIndex) {\n            final GridRow nextRow = gridData.getRow(maxBlockRowIndex);\n            final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n            if (nextRowCell == null) {\n                break;\n            }\n            if (nextRowCell.isCollapsed() && foundBottomSplitMarker) {\n                maxBlockRowIndex--;\n                break;\n            }\n            if (!nextRowCell.equals(currentRowCell)) {\n                break;\n            }\n            if (nextRowCell.getMergedCellCount() > 0) {\n                foundBottomSplitMarker = true;\n            }\n            maxBlockRowIndex++;\n        }\n\n        return maxBlockRowIndex;\n    }\n\n    private void updateMergeMetaData(final int minBlockRowIndex,\n                                     final int maxBlockRowIndex,\n                                     final int columnIndex) {\n        for (int i = minBlockRowIndex; i < maxBlockRowIndex; i++) {\n            final GridRow row = gridData.getRow(i);\n            final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n            if (cell != null) {\n                cell.setMergedCellCount(0);\n            }\n            updateRowMergedCells(row);\n        }\n\n        final GridRow row = gridData.getRow(minBlockRowIndex);\n        final BaseGridCell cell = ((BaseGridCell) row.getCells().get(columnIndex));\n        if (cell != null) {\n            cell.setMergedCellCount(maxBlockRowIndex - minBlockRowIndex);\n        }\n        updateRowMergedCells(row);\n    }\n\n    private void updateRowMergedCells(final GridRow row) {\n        for (GridCell<?> cell : row.getCells().values()) {\n            if (cell.isMerged()) {\n                ((BaseGridRow) row).setHasMergedCells(true);\n                return;\n            }\n        }\n        ((BaseGridRow) row).setHasMergedCells(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridDataSelectionsManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy;\n\n/**\n * Helper class that manages \"selected cell\" meta-data following different mutations to {@link GridData}\n */\npublic class BaseGridDataSelectionsManager {\n\n    private final GridData gridData;\n\n    public BaseGridDataSelectionsManager(final GridData gridData) {\n        this.gridData = gridData;\n    }\n\n    public void onMerge(final boolean isMerged) {\n        if (isMerged) {\n            final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n            final List<GridData.SelectedCell> cloneSelectedCells = new ArrayList<GridData.SelectedCell>(selectedCells);\n            gridData.clearSelections();\n            for (GridData.SelectedCell cell : cloneSelectedCells) {\n                gridData.selectCells(cell.getRowIndex(),\n                                     ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(),\n                                                                            cell.getColumnIndex()),\n                                     1,\n                                     1);\n            }\n        }\n    }\n\n    public void onInsertColumn(final int index) {\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final List<Integer> rowsWithASelection = selectedCells.stream()\n                .filter(sc -> {\n                    final int ri = sc.getRowIndex();\n                    final int ci = sc.getColumnIndex();\n                    final int _ci = ColumnIndexUtilities.findUiColumnIndex(gridData.getColumns(), ci);\n                    final GridCell<?> cell = gridData.getCell(ri, _ci);\n                    return cell != null && cell.getSelectionStrategy() instanceof RowSelectionStrategy;\n                })\n                .map(GridData.SelectedCell::getRowIndex)\n                .collect(Collectors.toList());\n\n        rowsWithASelection.forEach(rowIndex -> onSelectCell(rowIndex, index));\n    }\n\n    public void onDeleteColumn(final int index) {\n        onDeleteColumn(index, gridData.getSelectedCells());\n        onDeleteColumn(index, gridData.getSelectedHeaderCells());\n    }\n\n    private void onDeleteColumn(final int index,\n                                final List<GridData.SelectedCell> selectedCells) {\n        final List<GridData.SelectedCell> selectedCellsToRemove = new ArrayList<GridData.SelectedCell>();\n        final List<GridData.SelectedCell> selectedCellsToUpdate = new ArrayList<GridData.SelectedCell>();\n        for (GridData.SelectedCell sc : selectedCells) {\n            if (sc.getColumnIndex() == index) {\n                selectedCellsToRemove.add(sc);\n            } else if (sc.getColumnIndex() > index) {\n                selectedCellsToUpdate.add(sc);\n            }\n        }\n        selectedCells.removeAll(selectedCellsToRemove);\n        selectedCells.removeAll(selectedCellsToUpdate);\n        for (GridData.SelectedCell sc : selectedCellsToUpdate) {\n            selectedCells.add(new GridData.SelectedCell(sc.getRowIndex(),\n                                                        sc.getColumnIndex() - 1));\n        }\n    }\n\n    public void onInsertRow(final int rowIndex) {\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final List<GridData.SelectedCell> selectedCellsToUpdate = new ArrayList<GridData.SelectedCell>();\n        for (GridData.SelectedCell sc : selectedCells) {\n            if (sc.getRowIndex() >= rowIndex) {\n                selectedCellsToUpdate.add(sc);\n            }\n        }\n        selectedCells.removeAll(selectedCellsToUpdate);\n        for (GridData.SelectedCell sc : selectedCellsToUpdate) {\n            selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() + 1,\n                                                        sc.getColumnIndex()));\n        }\n    }\n\n    public void onDeleteRow(final GridData.Range range) {\n        final int minRowIndex = range.getMinRowIndex();\n        final int maxRowIndex = range.getMaxRowIndex();\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final List<GridData.SelectedCell> selectedCellsToRemove = new ArrayList<GridData.SelectedCell>();\n        final List<GridData.SelectedCell> selectedCellsToUpdate = new ArrayList<GridData.SelectedCell>();\n        for (GridData.SelectedCell sc : selectedCells) {\n            if (sc.getRowIndex() >= minRowIndex && sc.getRowIndex() <= maxRowIndex) {\n                selectedCellsToRemove.add(sc);\n            } else if (sc.getRowIndex() > maxRowIndex) {\n                selectedCellsToUpdate.add(sc);\n            }\n        }\n        selectedCells.removeAll(selectedCellsToRemove);\n        selectedCells.removeAll(selectedCellsToUpdate);\n        for (GridData.SelectedCell sc : selectedCellsToUpdate) {\n            selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() - 1,\n                                                        sc.getColumnIndex()));\n        }\n    }\n\n    public GridData.Range onSelectCell(final int rowIndex,\n                                       final int columnIndex) {\n        if (gridData.isMerged()) {\n            return selectCellMerged(rowIndex,\n                                    columnIndex);\n        } else {\n            selectCellNotMerged(rowIndex,\n                                columnIndex);\n            return new GridData.Range(rowIndex);\n        }\n    }\n\n    public GridData.Range onSelectCells(final int rowIndex,\n                                        final int columnIndex,\n                                        final int width,\n                                        final int height) {\n        //If we're not merged just set the value of a single cell\n        if (!gridData.isMerged()) {\n            selectCellsNotMerged(rowIndex,\n                                 columnIndex,\n                                 width,\n                                 height);\n            return new GridData.Range(rowIndex);\n        }\n\n        //Find affected rows for merged data\n        int _columnIndex;\n        int minRowIndex = rowIndex;\n        int maxRowIndex = rowIndex + height - 1;\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        for (int ci = columnIndex; ci < columnIndex + width; ci++) {\n            _columnIndex = columns.get(ci).getIndex();\n            minRowIndex = Math.min(minRowIndex,\n                                   findMinRowIndex(minRowIndex,\n                                                   _columnIndex));\n            maxRowIndex = Math.max(maxRowIndex,\n                                   findMaxRowIndex(maxRowIndex,\n                                                   _columnIndex));\n        }\n\n        //Select all applicable rows' cells\n        selectCellsNotMerged(minRowIndex,\n                             columnIndex,\n                             width,\n                             maxRowIndex - minRowIndex + 1);\n\n        return new GridData.Range(minRowIndex,\n                                  maxRowIndex);\n    }\n\n    public GridData.Range onSelectHeaderCell(final int headerRowIndex,\n                                             final int headerColumnIndex) {\n        return selectHeaderCell(headerRowIndex,\n                                headerColumnIndex);\n    }\n\n    private GridData.Range selectCellMerged(final int rowIndex,\n                                            final int columnIndex) {\n        //Find affected rows for merged data\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n        final int minRowIndex = findMinRowIndex(rowIndex,\n                                                _columnIndex);\n        final int maxRowIndex = findMaxRowIndex(rowIndex,\n                                                _columnIndex);\n\n        //Select all applicable rows' cells\n        selectCellsNotMerged(minRowIndex,\n                             columnIndex,\n                             1,\n                             maxRowIndex - minRowIndex + 1);\n\n        return new GridData.Range(minRowIndex,\n                                  maxRowIndex);\n    }\n\n    private GridData.Range selectCellNotMerged(final int rowIndex,\n                                               final int columnIndex) {\n        final List<GridRow> rows = gridData.getRows();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final GridData.Range range = new GridData.Range(rowIndex);\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return range;\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return range;\n        }\n        final int _columnIndex = columns.get(columnIndex).getIndex();\n        final GridData.SelectedCell selectedCell = new GridData.SelectedCell(rowIndex,\n                                                                             _columnIndex);\n\n        if (!selectedCells.contains(selectedCell)) {\n            selectedCells.add(selectedCell);\n        }\n\n        return range;\n    }\n\n    private GridData.Range selectCellsNotMerged(final int rowIndex,\n                                                final int columnIndex,\n                                                final int width,\n                                                final int height) {\n        final List<GridRow> rows = gridData.getRows();\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final GridData.Range range = new GridData.Range(rowIndex);\n        if (rowIndex < 0 || rowIndex > rows.size() - 1) {\n            return range;\n        }\n        if (columnIndex < 0 || columnIndex > columns.size() - 1) {\n            return range;\n        }\n        if (width < 1) {\n            return range;\n        }\n        if (height < 1) {\n            return range;\n        }\n        for (int ri = rowIndex; ri < rowIndex + height; ri++) {\n            for (int ci = columnIndex; ci < columnIndex + width; ci++) {\n                final int _columnIndex = columns.get(ci).getIndex();\n                final GridData.SelectedCell selectedCell = new GridData.SelectedCell(ri,\n                                                                                     _columnIndex);\n                if (!selectedCells.contains(selectedCell)) {\n                    selectedCells.add(selectedCell);\n                }\n            }\n        }\n\n        return new GridData.Range(rowIndex,\n                                  rowIndex + height - 1);\n    }\n\n    private GridData.Range selectHeaderCell(final int headerRowIndex,\n                                            final int headerColumnIndex) {\n        final List<GridColumn<?>> columns = gridData.getColumns();\n        final List<GridData.SelectedCell> selectedHeaderCells = gridData.getSelectedHeaderCells();\n        final GridData.Range range = new GridData.Range(headerRowIndex);\n        if (headerColumnIndex < 0 || headerColumnIndex > columns.size() - 1) {\n            return range;\n        }\n        final GridColumn<?> gridColumn = columns.get(headerColumnIndex);\n        final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData();\n        if (headerRowIndex < 0 || headerRowIndex > gridColumnHeaderMetaData.size() - 1) {\n            return range;\n        }\n\n        final int _headerColumnIndex = columns.get(headerColumnIndex).getIndex();\n        final GridData.SelectedCell selectedCell = new GridData.SelectedCell(headerRowIndex,\n                                                                             _headerColumnIndex);\n\n        if (!selectedHeaderCells.contains(selectedCell)) {\n            selectedHeaderCells.add(selectedCell);\n        }\n\n        return range;\n    }\n\n    private int findMinRowIndex(final int rowIndex,\n                                final int columnIndex) {\n        int minRowIndex = rowIndex;\n        final GridRow currentRow = gridData.getRow(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find minimum row with a cell containing the same value as that being updated\n        boolean foundTopSplitMarker = currentRowCell != null && currentRowCell.getMergedCellCount() > 0;\n        while (minRowIndex > 0) {\n            final GridRow previousRow = gridData.getRow(minRowIndex - 1);\n            final GridCell<?> previousRowCell = previousRow.getCells().get(columnIndex);\n            if (!(previousRow.isCollapsed() && currentRow.isCollapsed())) {\n                if (previousRowCell == null) {\n                    break;\n                }\n                if (previousRowCell.isCollapsed() && foundTopSplitMarker) {\n                    break;\n                }\n                if (!previousRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                if (previousRowCell.getMergedCellCount() > 0) {\n                    foundTopSplitMarker = true;\n                }\n            }\n            minRowIndex--;\n        }\n        return minRowIndex;\n    }\n\n    private int findMaxRowIndex(final int rowIndex,\n                                final int columnIndex) {\n        int maxRowIndex = rowIndex + 1;\n        final GridRow currentRow = gridData.getRow(rowIndex);\n        final GridCell<?> currentRowCell = currentRow.getCells().get(columnIndex);\n\n        //Find maximum row with a cell containing the same value as that being updated\n        boolean foundBottomSplitMarker = false;\n        while (maxRowIndex < gridData.getRowCount()) {\n            final GridRow nextRow = gridData.getRow(maxRowIndex);\n            final GridCell<?> nextRowCell = nextRow.getCells().get(columnIndex);\n            if (!nextRow.isCollapsed()) {\n                if (nextRowCell == null) {\n                    break;\n                }\n                if (nextRowCell.isCollapsed() && foundBottomSplitMarker) {\n                    maxRowIndex--;\n                    break;\n                }\n                if (!nextRowCell.equals(currentRowCell)) {\n                    break;\n                }\n                if (nextRowCell.getMergedCellCount() > 0) {\n                    foundBottomSplitMarker = true;\n                }\n            }\n            maxRowIndex++;\n        }\n        return maxRowIndex - 1;\n    }\n\n    public void onMoveRows(final List<GridRow> rowsMoved,\n                           final GridData.Range oldBlockExtent) {\n        final List<GridRow> rows = gridData.getRows();\n        final int oldBlockStart = oldBlockExtent.getMinRowIndex();\n        final int oldBlockEnd = oldBlockExtent.getMaxRowIndex();\n        final int newBlockStart = rows.indexOf(rowsMoved.get(0));\n        final int newBlockEnd = rows.indexOf(rowsMoved.get(rowsMoved.size() - 1));\n        final List<GridData.SelectedCell> selectedCells = gridData.getSelectedCells();\n        final List<GridData.SelectedCell> selectedCellsToMoveUp = new ArrayList<GridData.SelectedCell>();\n        final List<GridData.SelectedCell> selectedCellsToMoveDown = new ArrayList<GridData.SelectedCell>();\n        final List<GridData.SelectedCell> selectedCellsToUpdate = new ArrayList<GridData.SelectedCell>();\n\n        if (newBlockStart < oldBlockStart) {\n            //Moving row(s) up\n            for (GridData.SelectedCell sc : selectedCells) {\n                if (sc.getRowIndex() >= oldBlockStart && sc.getRowIndex() <= oldBlockEnd) {\n                    selectedCellsToMoveUp.add(sc);\n                } else if (sc.getRowIndex() >= newBlockStart && sc.getRowIndex() <= newBlockEnd) {\n                    selectedCellsToMoveDown.add(sc);\n                } else if (sc.getRowIndex() > newBlockEnd && sc.getRowIndex() < oldBlockStart) {\n                    selectedCellsToUpdate.add(sc);\n                }\n            }\n            selectedCells.removeAll(selectedCellsToMoveUp);\n            selectedCells.removeAll(selectedCellsToMoveDown);\n            selectedCells.removeAll(selectedCellsToUpdate);\n            for (GridData.SelectedCell sc : selectedCellsToMoveUp) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() - (oldBlockStart - newBlockStart),\n                                                            sc.getColumnIndex()));\n            }\n            for (GridData.SelectedCell sc : selectedCellsToMoveDown) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() + (oldBlockEnd - oldBlockStart) + 1,\n                                                            sc.getColumnIndex()));\n            }\n            for (GridData.SelectedCell sc : selectedCellsToUpdate) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() + (oldBlockEnd - oldBlockStart) + 1,\n                                                            sc.getColumnIndex()));\n            }\n        } else if (newBlockStart > oldBlockStart) {\n            //Moving row(s) down\n            for (GridData.SelectedCell sc : selectedCells) {\n                if (sc.getRowIndex() >= oldBlockStart && sc.getRowIndex() <= oldBlockEnd) {\n                    selectedCellsToMoveDown.add(sc);\n                } else if (sc.getRowIndex() >= newBlockStart && sc.getRowIndex() <= newBlockEnd) {\n                    selectedCellsToMoveUp.add(sc);\n                } else if (sc.getRowIndex() > oldBlockEnd && sc.getRowIndex() < newBlockStart) {\n                    selectedCellsToUpdate.add(sc);\n                }\n            }\n            selectedCells.removeAll(selectedCellsToMoveUp);\n            selectedCells.removeAll(selectedCellsToMoveDown);\n            selectedCells.removeAll(selectedCellsToUpdate);\n            for (GridData.SelectedCell sc : selectedCellsToMoveUp) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() - (oldBlockEnd - oldBlockStart) - 1,\n                                                            sc.getColumnIndex()));\n            }\n            for (GridData.SelectedCell sc : selectedCellsToMoveDown) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() + (newBlockStart - oldBlockStart),\n                                                            sc.getColumnIndex()));\n            }\n            for (GridData.SelectedCell sc : selectedCellsToUpdate) {\n                selectedCells.add(new GridData.SelectedCell(sc.getRowIndex() - (newBlockEnd - newBlockStart) - 1,\n                                                            sc.getColumnIndex()));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridRow.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Stack;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\n\n/**\n * Base implementation of a grid row to avoid boiler-plate for more specific implementations.\n */\npublic class BaseGridRow implements GridRow {\n\n    protected double height = 20.0;\n    protected Map<Integer, GridCell<?>> cells = new HashMap<Integer, GridCell<?>>();\n\n    private boolean hasMergedCells = false;\n    private Stack<Double> heights = new Stack<Double>();\n    private int collapseLevel = 0;\n\n    public BaseGridRow() {\n        this(20);\n    }\n\n    public BaseGridRow(final double height) {\n        this.height = height;\n        this.heights.push(height);\n    }\n\n    @Override\n    public Map<Integer, GridCell<?>> getCells() {\n        return Collections.unmodifiableMap(cells);\n    }\n\n    @Override\n    public double getHeight() {\n        return this.height;\n    }\n\n    @Override\n    public void setHeight(final double height) {\n        this.height = height;\n    }\n\n    @Override\n    public double peekHeight() {\n        return heights.peek();\n    }\n\n    @Override\n    public boolean isMerged() {\n        return hasMergedCells;\n    }\n\n    @Override\n    public boolean isCollapsed() {\n        return collapseLevel > 0;\n    }\n\n    @Override\n    public void collapse() {\n        collapseLevel++;\n        heights.push(height);\n        for (GridCell<?> cell : cells.values()) {\n            cell.collapse();\n        }\n    }\n\n    @Override\n    public void expand() {\n        if (collapseLevel == 0) {\n            return;\n        }\n        collapseLevel--;\n        height = heights.pop();\n        for (GridCell<?> cell : cells.values()) {\n            cell.expand();\n        }\n    }\n\n    @Override\n    public void reset() {\n        collapseLevel = 0;\n        hasMergedCells = false;\n        height = heights.firstElement();\n        heights.clear();\n        heights.push(height);\n        for (GridCell<?> cell : cells.values()) {\n            cell.reset();\n        }\n    }\n\n    //This is not part of the GridCell interface as we don't want to expose this for general use\n    @SuppressWarnings(\"unchecked\")\n    void setCell(final int columnIndex,\n                 final GridCell cell) {\n        cells.put(columnIndex,\n                  cell);\n    }\n\n    //This is not part of the GridCell interface as we don't want to expose this for general use\n    void deleteCell(final int columnIndex) {\n        cells.remove(columnIndex);\n    }\n\n    //This is not part of the GridCell interface as we don't want to expose this for general use\n    void setHasMergedCells(final boolean hasMergedCells) {\n        this.hasMergedCells = hasMergedCells;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseHeaderMetaData.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.Objects;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\n\npublic class BaseHeaderMetaData implements GridColumn.HeaderMetaData {\n\n    private static final String DEFAULT_COLUMN_GROUP = \"\";\n\n    private String columnTitle;\n    private String columnGroup;\n\n    public BaseHeaderMetaData(final String columnTitle) {\n        this(columnTitle,\n             DEFAULT_COLUMN_GROUP);\n    }\n\n    public BaseHeaderMetaData(final String columnTitle,\n                              final String columnGroup) {\n        this.columnTitle = Objects.requireNonNull(columnTitle, \"columnTitle\");\n        this.columnGroup = Objects.requireNonNull(columnGroup, \"columnGroup\");\n    }\n\n    @Override\n    public String getTitle() {\n        return this.columnTitle;\n    }\n\n    @Override\n    public void setTitle(final String columnTitle) {\n        this.columnTitle = columnTitle;\n    }\n\n    @Override\n    public String getColumnGroup() {\n        return this.columnGroup;\n    }\n\n    @Override\n    public void setColumnGroup(final String columnGroup) {\n        this.columnGroup = columnGroup;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof BaseHeaderMetaData)) {\n            return false;\n        }\n\n        BaseHeaderMetaData that = (BaseHeaderMetaData) o;\n\n        if (!columnTitle.equals(that.columnTitle)) {\n            return false;\n        }\n        return columnGroup.equals(that.columnGroup);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = columnTitle.hashCode();\n        result = ~~result;\n        result = 31 * result + columnGroup.hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/CellContextUtilities.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.IntStream;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\npublic class CellContextUtilities {\n\n    public static GridBodyCellEditContext makeCellRenderContext(final GridWidget gridWidget,\n                                                                final BaseGridRendererHelper.RenderingInformation ri,\n                                                                final BaseGridRendererHelper.ColumnInformation ci,\n                                                                final int uiRowIndex) {\n        final GridColumn<?> column = ci.getColumn();\n        final GridRenderer renderer = gridWidget.getRenderer();\n\n        final double cellX = getCellX(gridWidget, ci);\n        final double cellY = getCellY(gridWidget, uiRowIndex);\n\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation();\n        final double clipMinX = getClipMinX(gridWidget, floatingBlockInformation);\n        final double clipMinY = getClipMinY(gridWidget);\n\n        final double blockCellWidth = column.getWidth();\n        final double blockCellHeight = ri.getAllRowHeights().get(uiRowIndex);\n\n        return new GridBodyCellEditContext(cellX,\n                                           cellY,\n                                           blockCellWidth,\n                                           blockCellHeight,\n                                           clipMinY,\n                                           clipMinX,\n                                           uiRowIndex,\n                                           ci.getUiColumnIndex(),\n                                           floatingBlockInformation.getColumns().contains(column),\n                                           gridWidget.getViewport().getTransform(),\n                                           renderer,\n                                           Optional.empty());\n    }\n\n    public static GridBodyCellEditContext makeHeaderCellRenderContext(final GridWidget gridWidget,\n                                                                      final BaseGridRendererHelper.RenderingInformation ri,\n                                                                      final BaseGridRendererHelper.ColumnInformation ci,\n                                                                      final int uiHeaderRowIndex) {\n        return makeHeaderCellRenderContext(gridWidget,\n                                           ri,\n                                           ci,\n                                           null,\n                                           uiHeaderRowIndex);\n    }\n\n    public static GridBodyCellEditContext makeHeaderCellRenderContext(final GridWidget gridWidget,\n                                                                      final BaseGridRendererHelper.RenderingInformation ri,\n                                                                      final BaseGridRendererHelper.ColumnInformation ci,\n                                                                      final Point2D rp,\n                                                                      final int uiHeaderRowIndex) {\n        final GridColumn<?> column = ci.getColumn();\n        final GridRenderer renderer = gridWidget.getRenderer();\n        final double headerRowHeight = getHeaderRowHeight(ri, column);\n\n        final double cellX = getCellX(gridWidget, ci);\n        final double cellY = getHeaderY(gridWidget, ri) + (headerRowHeight * uiHeaderRowIndex);\n\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = ri.getFloatingBlockInformation();\n        final double clipMinX = getClipMinX(gridWidget, floatingBlockInformation);\n        final double clipMinY = getClipMinY(gridWidget);\n\n        final List<GridColumn<?>> gridColumns = ri.getAllColumns();\n        final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex);\n        final int blockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(gridColumns,\n                                                                                              headerMetaData,\n                                                                                              uiHeaderRowIndex,\n                                                                                              ci.getUiColumnIndex());\n        final int blockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(gridColumns,\n                                                                                          headerMetaData,\n                                                                                          uiHeaderRowIndex,\n                                                                                          ci.getUiColumnIndex());\n\n        final double blockCellWidth = IntStream.rangeClosed(blockStartColumnIndex,\n                                                            blockEndColumnIndex)\n                .mapToDouble(uiHeaderColumnIndex -> gridColumns.get(uiHeaderColumnIndex).getWidth())\n                .sum();\n\n        return new GridBodyCellEditContext(cellX,\n                                           cellY,\n                                           blockCellWidth,\n                                           headerRowHeight,\n                                           clipMinY,\n                                           clipMinX,\n                                           uiHeaderRowIndex,\n                                           ci.getUiColumnIndex(),\n                                           floatingBlockInformation.getColumns().contains(column),\n                                           gridWidget.getViewport().getTransform(),\n                                           renderer,\n                                           Optional.ofNullable(rp));\n    }\n\n    public static void editSelectedCell(final GridWidget gridWidget) {\n        editSelectedCell(gridWidget, null);\n    }\n\n    public static void editSelectedCell(final GridWidget gridWidget,\n                                        final Point2D relativeLocation) {\n        final GridData gridModel = gridWidget.getModel();\n\n        if (gridModel.getSelectedHeaderCells().size() > 0) {\n            final GridData.SelectedCell selectedCell = gridModel.getSelectedHeaderCells().get(0);\n            final int uiHeaderRowIndex = selectedCell.getRowIndex();\n            final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                             selectedCell.getColumnIndex());\n\n            final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);\n            final GridColumn.HeaderMetaData headerMetaData = column.getHeaderMetaData().get(uiHeaderRowIndex);\n\n            final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n            final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();\n            final double columnXCoordinate = rendererHelper.getColumnOffset(column) + column.getWidth() / 2;\n            final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(columnXCoordinate);\n\n            final GridBodyCellEditContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                     ri,\n                                                                                                     ci,\n                                                                                                     relativeLocation,\n                                                                                                     uiHeaderRowIndex);\n\n            headerMetaData.edit(context);\n        } else if (gridModel.getSelectedCells().size() > 0) {\n            final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();\n            if (origin == null) {\n                return;\n            }\n            gridWidget.startEditingCell(origin.getRowIndex(),\n                                        ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                               origin.getColumnIndex()));\n        }\n    }\n\n    private static double getCellX(final GridWidget gridWidget,\n                                   final BaseGridRendererHelper.ColumnInformation ci) {\n        return gridWidget.getComputedLocation().getX() + ci.getOffsetX();\n    }\n\n    private static double getCellY(final GridWidget gridWidget,\n                                   final int uiRowIndex) {\n        final GridRenderer renderer = gridWidget.getRenderer();\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        return gridWidget.getComputedLocation().getY() + renderer.getHeaderHeight() + rendererHelper.getRowOffset(uiRowIndex);\n    }\n\n    private static double getHeaderY(final GridWidget gridWidget,\n                                     final BaseGridRendererHelper.RenderingInformation ri) {\n        final Group header = gridWidget.getHeader();\n        final double headerRowsYOffset = ri.getHeaderRowsYOffset();\n        final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);\n        return gridWidget.getComputedLocation().getY() + headerMinY;\n    }\n\n    private static double getHeaderRowHeight(final BaseGridRendererHelper.RenderingInformation ri,\n                                             final GridColumn<?> column) {\n        if (column.getHeaderMetaData() == null || column.getHeaderMetaData().size() == 0) {\n            return 0.0;\n        }\n        return ri.getHeaderRowsHeight() / column.getHeaderMetaData().size();\n    }\n\n    private static double getClipMinX(final GridWidget gridWidget,\n                                      final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation) {\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n        return gridWidget.getComputedLocation().getX() + floatingX + floatingWidth;\n    }\n\n    private static double getClipMinY(final GridWidget gridWidget) {\n        return gridWidget.getComputedLocation().getY();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/ColumnIndexUtilities.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.List;\nimport java.util.Objects;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\n/**\n * Utilities class\n */\npublic class ColumnIndexUtilities {\n\n    /**\n     * Finds the UI Column index corresponding to a Model Column index from the provided range of columns.\n     * A \"UI Column\" is a Canvas element as rendered from left-to-right representing a Grid. Index 0 would\n     * be the left most column, index N would be the right most column. A \"Model Column index\" is the index\n     * a column relates to in the Row's data. Row data is not reordered when columns are reordered.\n     * @param columns The range of columns to check. Cannot be null.\n     * @param modelColumnIndex The index a model column represents in a row of data.\n     * @return The UI Column index corresponding to model column index.\n     */\n    public static int findUiColumnIndex(final List<GridColumn<?>> columns,\n                                        final int modelColumnIndex) {\n        for (int uiColumnIndex = 0; uiColumnIndex < columns.size(); uiColumnIndex++) {\n            final GridColumn<?> c = columns.get(uiColumnIndex);\n            if (c.getIndex() == modelColumnIndex) {\n                return uiColumnIndex;\n            }\n        }\n        throw new IllegalStateException(\"Column was not found!\");\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static int getHeaderBlockStartColumnIndex(final List<GridColumn<?>> allColumns,\n                                                     final GridColumn.HeaderMetaData headerMetaData,\n                                                     final int headerRowIndex,\n                                                     final int headerColumnIndex) {\n        //Back-track adding width of proceeding columns sharing header MetaData\n        int candidateHeaderColumnIndex = headerColumnIndex;\n        if (candidateHeaderColumnIndex == 0) {\n            return candidateHeaderColumnIndex;\n        }\n        while (candidateHeaderColumnIndex > 0) {\n            final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex - 1);\n            final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData();\n            if (candidateHeaderMetaData.size() - 1 < headerRowIndex) {\n                break;\n            }\n            if (!Objects.equals(candidateHeaderMetaData.get(headerRowIndex), headerMetaData)) {\n                break;\n            }\n            candidateHeaderColumnIndex--;\n        }\n\n        return candidateHeaderColumnIndex;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static int getHeaderBlockEndColumnIndex(final List<GridColumn<?>> allColumns,\n                                                   final GridColumn.HeaderMetaData headerMetaData,\n                                                   final int headerRowIndex,\n                                                   final int headerColumnIndex) {\n        //Forward-track adding width of following columns sharing header MetaData\n        int candidateHeaderColumnIndex = headerColumnIndex;\n        if (candidateHeaderColumnIndex >= allColumns.size() - 1) {\n            return allColumns.size() - 1;\n        }\n        while (candidateHeaderColumnIndex < allColumns.size() - 1) {\n            final GridColumn candidateColumn = allColumns.get(candidateHeaderColumnIndex + 1);\n            final List<GridColumn.HeaderMetaData> candidateHeaderMetaData = candidateColumn.getHeaderMetaData();\n            if (candidateHeaderMetaData.size() - 1 < headerRowIndex) {\n                break;\n            }\n            if (!Objects.equals(candidateHeaderMetaData.get(headerRowIndex), headerMetaData)) {\n                break;\n            }\n            candidateHeaderColumnIndex++;\n        }\n\n        return candidateHeaderColumnIndex;\n    }\n\n    public static int getMaxUiHeaderRowIndexOfColumn(final GridData model, final int uiColumnIndex) {\n        return model.getColumns().get(uiColumnIndex).getHeaderMetaData().size() - 1;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/CoordinateUtilities.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport com.ait.lienzo.client.core.event.INodeXYEvent;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.event.dom.client.DomEvent;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\n/**\n * Utilities class\n */\npublic class CoordinateUtilities {\n\n    /**\n     * Convert a DOM-relative coordinate to one within a GridWidget, taking\n     * the current transformation (translation and scale) into consideration.\n     * @param view The GridWidget to which we need to find the relative coordinate.\n     * @param point The Canvas/DOM MouseEvent coordinate.\n     * @return A coordinate relative to the GridWidget (in un-transformed coordinate space).\n     */\n    public static Point2D convertDOMToGridCoordinate(final GridWidget view,\n                                                     final Point2D point) {\n        Viewport viewport = view.getViewport();\n        Transform transform = viewport != null ? viewport.getTransform() : null;\n        if (transform == null) {\n            transform = new Transform();\n        }\n        if (viewport != null) {\n            view.getViewport().setTransform(transform);\n        }\n\n        transform = transform.copy().getInverse();\n        final Point2D p = new Point2D(point.getX(),\n                                      point.getY());\n        transform.transform(p,\n                            p);\n        return p.add(new Point2D(view.getComputedLocation().getX(),\n                                 view.getComputedLocation().getY()).mul(-1.0));\n    }\n\n    /**\n     * Gets the row index corresponding to the provided Canvas y-coordinate relative to the grid. Grid-relative coordinates can be\n     * obtained from {@link INodeXYEvent} using {@link CoordinateUtilities#convertDOMToGridCoordinate(GridWidget, Point2D)}\n     * @param gridWidget GridWidget to check.\n     * @param relativeY y-coordinate relative to the GridWidget.\n     * @return The row index or null if the coordinate did not map to a cell.\n     */\n    public static Integer getUiRowIndex(final GridWidget gridWidget,\n                                        final double relativeY) {\n        final Group header = gridWidget.getHeader();\n        final GridData gridModel = gridWidget.getModel();\n        final GridRenderer renderer = gridWidget.getRenderer();\n        final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());\n\n        if (relativeY < headerMaxY || relativeY > gridWidget.getHeight()) {\n            return null;\n        }\n        if (gridModel.getRowCount() == 0) {\n            return null;\n        }\n\n        //Get row index\n        GridRow row;\n        int uiRowIndex = 0;\n        double offsetY = relativeY - renderer.getHeaderHeight();\n        while ((row = gridModel.getRow(uiRowIndex)).getHeight() < offsetY) {\n            offsetY = offsetY - row.getHeight();\n            uiRowIndex++;\n        }\n        if (uiRowIndex > gridModel.getRowCount() - 1) {\n            return null;\n        }\n\n        return uiRowIndex;\n    }\n\n    /**\n     * Gets the column index corresponding to the provided Canvas x-coordinate relative to the grid. Grid-relative coordinates can be\n     * obtained from {@link INodeXYEvent} using {@link CoordinateUtilities#convertDOMToGridCoordinate(GridWidget, Point2D)}\n     * @param gridWidget GridWidget to check.\n     * @param relativeX x-coordinate relative to the GridWidget.\n     * @return The column index or null if the coordinate did not map to a cell.\n     */\n    public static Integer getUiColumnIndex(final GridWidget gridWidget,\n                                           final double relativeX) {\n        final GridData gridModel = gridWidget.getModel();\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n\n        if (relativeX < 0 || relativeX > gridWidget.getWidth()) {\n            return null;\n        }\n\n        //Get column index\n        final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(relativeX);\n        final GridColumn<?> uiColumn = ci.getColumn();\n        final int uiColumnIndex = ci.getUiColumnIndex();\n\n        if (uiColumn == null) {\n            return null;\n        }\n        if (uiColumnIndex < 0 || uiColumnIndex > gridModel.getColumnCount() - 1) {\n            return null;\n        }\n\n        return uiColumnIndex;\n    }\n\n    /**\n     * Gets the header row index corresponding to the provided Canvas y-coordinate relative to\n     * the grid. Grid-relative coordinates can be obtained from {@link INodeXYEvent} using\n     * {@link CoordinateUtilities#convertDOMToGridCoordinate(GridWidget, Point2D)}\n     * @param gridWidget GridWidget to check.\n     * @param rp Canvas coordinate relative to the GridWidget.\n     * @return The header row index or null if the coordinate did not map to a header row.\n     */\n    public static Integer getUiHeaderRowIndex(final GridWidget gridWidget,\n                                              final Point2D rp) {\n        final double relativeX = rp.getX();\n        final double relativeY = rp.getY();\n\n        final Group header = gridWidget.getHeader();\n        final GridRenderer renderer = gridWidget.getRenderer();\n        final BaseGridRendererHelper.RenderingInformation ri = gridWidget.getRendererHelper().getRenderingInformation();\n        final double headerRowsYOffset = ri.getHeaderRowsYOffset();\n        final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);\n        final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());\n\n        if (relativeX < 0 || relativeX > gridWidget.getWidth()) {\n            return null;\n        }\n        if (relativeY < headerMinY || relativeY > headerMaxY) {\n            return null;\n        }\n        final int headerRowCount = gridWidget.getModel().getHeaderRowCount();\n        if (headerRowCount < 1) {\n            return null;\n        }\n\n        //Get header column index\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(relativeX);\n        final GridColumn<?> uiColumn = ci.getColumn();\n        if (uiColumn == null) {\n            return null;\n        }\n\n        //Get header row index\n        int uiHeaderRowIndex = 0;\n        double offsetY = relativeY - headerMinY;\n        final double headerRowHeight = renderer.getHeaderRowHeight();\n        final double headerRowsHeight = headerRowHeight * headerRowCount;\n        final double columnHeaderRowHeight = headerRowsHeight / uiColumn.getHeaderMetaData().size();\n        while (columnHeaderRowHeight < offsetY) {\n            offsetY = offsetY - columnHeaderRowHeight;\n            uiHeaderRowIndex++;\n        }\n        if (uiHeaderRowIndex < 0 || uiHeaderRowIndex > uiColumn.getHeaderMetaData().size() - 1) {\n            return null;\n        }\n\n        return uiHeaderRowIndex;\n    }\n\n    public static int getRelativeXOfEvent(final DomEvent event) {\n        final NativeEvent e = event.getNativeEvent();\n        final Element target = event.getRelativeElement();\n        return e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() + target.getOwnerDocument().getScrollLeft();\n    }\n\n    public static int getRelativeYOfEvent(final DomEvent event) {\n        final NativeEvent e = event.getNativeEvent();\n        final Element target = event.getRelativeElement();\n        return e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() + target.getOwnerDocument().getScrollTop();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/GridHighlightHelper.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\npublic class GridHighlightHelper {\n\n    private double paddingX = 0d;\n\n    private double paddingY = 0d;\n\n    private boolean isPinnedGrid = false;\n\n    private final GridLienzoPanel gridPanel;\n\n    private final GridWidget gridWidget;\n\n    public GridHighlightHelper(final GridLienzoPanel gridPanel,\n                               final GridWidget gridWidget) {\n        this.gridPanel = gridPanel;\n        this.gridWidget = gridWidget;\n    }\n\n    public void highlight(final int row,\n                          final int column) {\n\n        final double rowOffset = calculateRowOffset(row);\n        final double columnOffset = calculateColumnOffset(column);\n        final double y = applyPinnedGridConstraints(rowOffset);\n        final double x = applyPinnedGridConstraints(columnOffset);\n        highlightCell(row, column);\n        select(row, column);\n        moveCanvasTo(x, y);\n    }\n\n    public void clearSelections() {\n\n        final GridWidget gridWidget = getGridWidget();\n        gridWidget.getModel().clearSelections();\n        gridWidget.draw();\n    }\n\n    public void clearHighlight() {\n\n        final GridWidget gridWidget = getGridWidget();\n        final GridRenderer renderer = gridWidget.getRenderer();\n        if (renderer instanceof BaseGridRenderer) {\n            final BaseGridRenderer bgr = (BaseGridRenderer) renderer;\n            bgr.clearCellHighlight();\n            gridWidget.draw();\n        }\n    }\n\n    public GridHighlightHelper withPaddingX(final double paddingX) {\n        this.paddingX = paddingX;\n        return this;\n    }\n\n    public GridHighlightHelper withPaddingY(final double paddingY) {\n        this.paddingY = paddingY;\n        return this;\n    }\n\n    public GridHighlightHelper withPinnedGrid() {\n        this.isPinnedGrid = true;\n        return this;\n    }\n\n    private void select(final int row,\n                        final int column) {\n        gridWidget.selectCell(row, column, false, false);\n        gridWidget.draw();\n    }\n\n    void highlightCell(final int row,\n                       final int column) {\n        final GridRenderer renderer = gridWidget.getRenderer();\n        if (renderer instanceof BaseGridRenderer) {\n            ((BaseGridRenderer) renderer).highlightCell(column, row);\n        }\n    }\n\n    void moveCanvasTo(final double x,\n                      final double y) {\n\n        final double deltaY = calculateDeltaY(y);\n        final double deltaX = calculateDeltaX(x);\n        final Transform newTransform = getTransform().copy().translate(deltaX, deltaY);\n\n        getViewport().setTransform(newTransform);\n        getDefaultGridLayer().batch();\n        getGridPanel().refreshScrollPosition();\n    }\n\n    private double calculateDeltaY(final double y) {\n\n        final double rawY = -(y - getPaddingY());\n        final Range yRange = new Range(getVisibleBounds().getY() + getPaddingY(),\n                                       getVisibleBounds().getY() + getVisibleBounds().getHeight() - getPaddingY());\n\n        if (yRange.contains(rawY)) {\n            return 0d;\n        }\n\n        return y - (getTransform().getTranslateY() / getTransform().getScaleY());\n    }\n\n    private double calculateDeltaX(final double x) {\n\n        final double rawX = -(x - getPaddingX());\n        final Range xRange = new Range(getVisibleBounds().getX() + getPaddingX(),\n                                       getVisibleBounds().getX() + getVisibleBounds().getWidth() - getPaddingX());\n\n        if (xRange.contains(rawX)) {\n            return 0d;\n        }\n\n        return x - (getTransform().getTranslateX() / getTransform().getScaleX());\n    }\n\n    double calculateColumnOffset(final int column) {\n        final double offset = getRendererHelper().getColumnOffset(column);\n        final double x = getGridWidget().getX() + offset;\n        return -(x - getPaddingX());\n    }\n\n    double calculateRowOffset(final int row) {\n        final double offset = getRendererHelper().getRowOffset(row);\n        final double y = getGridWidget().getY() + offset;\n        return -(y - getPaddingY());\n    }\n\n    private BaseGridRendererHelper getRendererHelper() {\n        return getGridWidget().getRendererHelper();\n    }\n\n    private double applyPinnedGridConstraints(final double value) {\n        if (isPinnedGrid && value > 0) {\n            return 0;\n        } else {\n            return value;\n        }\n    }\n\n    private Bounds getVisibleBounds() {\n        return getDefaultGridLayer().getVisibleBounds();\n    }\n\n    private Transform getTransform() {\n        return getViewport().getTransform();\n    }\n\n    private Viewport getViewport() {\n        return getDefaultGridLayer().getViewport();\n    }\n\n    private GridLienzoPanel getGridPanel() {\n        return gridPanel;\n    }\n\n    private GridWidget getGridWidget() {\n        return gridWidget;\n    }\n\n    double getPaddingX() {\n        return paddingX;\n    }\n\n    double getPaddingY() {\n        return paddingY;\n    }\n\n    private DefaultGridLayer getDefaultGridLayer() {\n        return getGridPanel().getDefaultGridLayer();\n    }\n\n    class Range {\n\n        final double min;\n        final double max;\n\n        Range(final double min,\n              final double max) {\n            this.min = min;\n            this.max = max;\n        }\n\n        boolean contains(final double value) {\n            return value > min && value < max;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/Logging.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic class Logging {\n\n    private Logging() {\n        //Sonar rule: Utility classes should not have public constructors\n    }\n\n    /**\n     * Logs a message at {@see Level.FINEST}\n     * @param logger Logger to record the entry.\n     * @param message Message to log.\n     * @return Returns the current (system) time in milliseconds.\n     */\n    public static long log(final Logger logger,\n                           final String message) {\n        if (logger.isLoggable(Level.FINEST)) {\n            logger.log(Level.FINEST, message);\n        }\n        return System.currentTimeMillis();\n    }\n\n    /**\n     * Logs a message at {@see Level.FINEST} including the elapsed time between the\n     * previousTimeMillis and the current (system) time in milliseconds.\n     * @param logger Logger to record the entry.\n     * @param message Message to log.\n     * @param previousTimeMillis Previous time in milliseconds.\n     * @return Returns the current (system) time in milliseconds.\n     */\n    public static long log(final Logger logger,\n                           final String message,\n                           final long previousTimeMillis) {\n        final long currentTimeMillis = System.currentTimeMillis();\n        if (logger.isLoggable(Level.FINEST)) {\n            logger.log(Level.FINEST, message + \" - \" + (currentTimeMillis - previousTimeMillis) + \"ms\");\n        }\n        return currentTimeMillis;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/util/MathUtilities.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.util;\n\n/**\n * Utilities class\n */\npublic class MathUtilities {\n\n    private static final double EPSILON = 0.0000001;\n\n    /**\n     * Convenience method to check if a double is \"almost\" one.\n     * @param value A value to be checked.\n     * @return true if the value is \"almost\" one.\n     */\n    public static boolean isOne(final double value) {\n        return value >= 1.0 - EPSILON && value <= 1.0 + EPSILON;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridBodyCellEditContext.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.shape.wires.handlers.MouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\n\n/**\n * The context of a Grid's cell being edited.\n */\npublic class GridBodyCellEditContext extends GridBodyCellRenderContext {\n\n    private final Optional<Point2D> relativeLocation;\n\n    public GridBodyCellEditContext(final double absoluteCellX,\n                                   final double absoluteCellY,\n                                   final double cellWidth,\n                                   final double cellHeight,\n                                   final double clipMinY,\n                                   final double clipMinX,\n                                   final int rowIndex,\n                                   final int columnIndex,\n                                   final boolean isFloating,\n                                   final Transform transform,\n                                   final GridRenderer renderer,\n                                   final Optional<Point2D> relativeLocation) {\n        super(absoluteCellX,\n              absoluteCellY,\n              cellWidth,\n              cellHeight,\n              clipMinY,\n              clipMinX,\n              rowIndex,\n              columnIndex,\n              isFloating,\n              transform,\n              renderer);\n        this.relativeLocation = relativeLocation;\n    }\n\n    /**\n     * Returns the Canvas coordinate relative to the GridWidget containing the cell being edited in response to a {@link MouseEvent}.\n     * @return {@link Optional#empty()} if the edit operation did not result from a {@link MouseEvent}\n     */\n    public Optional<Point2D> getRelativeLocation() {\n        return relativeLocation;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridBodyCellRenderContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\n\n/**\n * The context of a Grid's cell during the rendering phase.\n */\npublic class GridBodyCellRenderContext {\n\n    private final double absoluteCellX;\n    private final double absoluteCellY;\n    private final double cellWidth;\n    private final double cellHeight;\n    private final double clipMinY;\n    private final double clipMinX;\n    private final int rowIndex;\n    private final int columnIndex;\n    private final boolean isFloating;\n    private final Transform transform;\n    private final GridRenderer renderer;\n\n    public GridBodyCellRenderContext(final double absoluteCellX,\n                                     final double absoluteCellY,\n                                     final double cellWidth,\n                                     final double cellHeight,\n                                     final double clipMinY,\n                                     final double clipMinX,\n                                     final int rowIndex,\n                                     final int columnIndex,\n                                     final boolean isFloating,\n                                     final Transform transform,\n                                     final GridRenderer renderer) {\n        this.absoluteCellX = absoluteCellX;\n        this.absoluteCellY = absoluteCellY;\n        this.cellWidth = cellWidth;\n        this.cellHeight = cellHeight;\n        this.clipMinY = clipMinY;\n        this.clipMinX = clipMinX;\n        this.rowIndex = rowIndex;\n        this.columnIndex = columnIndex;\n        this.isFloating = isFloating;\n        this.transform = transform;\n        this.renderer = renderer;\n    }\n\n    /**\n     * Returns the cell's canvas x-coordinate; not transformed.\n     * @return\n     */\n    public double getAbsoluteCellX() {\n        return absoluteCellX;\n    }\n\n    /**\n     * Returns the cell's canvas y-coordinate; not transformed.\n     * @return\n     */\n    public double getAbsoluteCellY() {\n        return absoluteCellY;\n    }\n\n    /**\n     * Returns the width of the cell.\n     * @return\n     */\n    public double getCellWidth() {\n        return cellWidth;\n    }\n\n    /**\n     * Returns the height of the cell.\n     * @return\n     */\n    public double getCellHeight() {\n        return cellHeight;\n    }\n\n    /**\n     * Returns the minimum Y coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinY() {\n        return clipMinY;\n    }\n\n    /**\n     * Returns the minimum X coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinX() {\n        return clipMinX;\n    }\n\n    /**\n     * Returns the index of the row this cell represents.\n     * @return\n     */\n    public int getRowIndex() {\n        return rowIndex;\n    }\n\n    /**\n     * Returns the index of the column this cell represents.\n     * @return\n     */\n    public int getColumnIndex() {\n        return columnIndex;\n    }\n\n    /**\n     * Returns a flag indicating whether the Cell is contained within a floating column.\n     * @return\n     */\n    public boolean isFloating() {\n        return isFloating;\n    }\n\n    /**\n     * Returns the transformation of the Grid Widget.\n     * @return\n     */\n    public Transform getTransform() {\n        return transform;\n    }\n\n    /**\n     * Returns the Renderer for the Grid Widget.\n     * @return\n     */\n    public GridRenderer getRenderer() {\n        return renderer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridBodyColumnRenderContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\n\n/**\n * The context of a Grid's column during the rendering phase.\n */\npublic class GridBodyColumnRenderContext {\n\n    private final double x;\n    private final double absoluteGridX;\n    private final double absoluteGridY;\n    private final double absoluteColumnX;\n    private final double clipMinY;\n    private final double clipMinX;\n    private final int minVisibleRowIndex;\n    private final int maxVisibleRowIndex;\n    private final boolean isFloating;\n    private final GridData model;\n    private final Transform transform;\n    private final GridRenderer renderer;\n\n    public GridBodyColumnRenderContext(final double x,\n                                       final double absoluteGridX,\n                                       final double absoluteGridY,\n                                       final double absoluteColumnX,\n                                       final double clipMinY,\n                                       final double clipMinX,\n                                       final int minVisibleRowIndex,\n                                       final int maxVisibleRowIndex,\n                                       final boolean isFloating,\n                                       final GridData model,\n                                       final Transform transform,\n                                       final GridRenderer renderer) {\n        this.x = x;\n        this.absoluteGridX = absoluteGridX;\n        this.absoluteGridY = absoluteGridY;\n        this.absoluteColumnX = absoluteColumnX;\n        this.clipMinY = clipMinY;\n        this.clipMinX = clipMinX;\n        this.minVisibleRowIndex = minVisibleRowIndex;\n        this.maxVisibleRowIndex = maxVisibleRowIndex;\n        this.isFloating = isFloating;\n        this.model = model;\n        this.transform = transform;\n        this.renderer = renderer;\n    }\n\n    /**\n     * Returns the columns x-coordinate relative to the grids origin.\n     * @return\n     */\n    public double getX() {\n        return this.x;\n    }\n\n    /**\n     * Returns the canvas x-coordinate of the Grid; not transformed.\n     * @return\n     */\n    public double getAbsoluteGridX() {\n        return absoluteGridX;\n    }\n\n    /**\n     * Returns the canvas y-coordinate of the Grid; not transformed.\n     * @return\n     */\n    public double getAbsoluteGridY() {\n        return absoluteGridY;\n    }\n\n    /**\n     * Returns the canvas x-coordinate of the Column; not transformed.\n     * @return\n     */\n    public double getAbsoluteColumnX() {\n        return absoluteColumnX;\n    }\n\n    /**\n     * Returns the minimum Y coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinY() {\n        return clipMinY;\n    }\n\n    /**\n     * Returns the minimum X coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinX() {\n        return clipMinX;\n    }\n\n    /**\n     * Returns the index of the first row being rendered.\n     * @return\n     */\n    public int getMinVisibleRowIndex() {\n        return minVisibleRowIndex;\n    }\n\n    /**\n     * Returns the index of the last row being rendered.\n     * @return\n     */\n    public int getMaxVisibleRowIndex() {\n        return maxVisibleRowIndex;\n    }\n\n    /**\n     * Returns whether the column is floating.\n     * @return true if the column is floating.\n     */\n    public boolean isFloating() {\n        return isFloating;\n    }\n\n    /**\n     * Returns the data model for the Grid Widget to which the Column relates.\n     * @return\n     */\n    public GridData getModel() {\n        return model;\n    }\n\n    /**\n     * Returns the transformation of the Grid Widget.\n     * @return\n     */\n    public Transform getTransform() {\n        return transform;\n    }\n\n    /**\n     * Returns the Renderer for the Grid Widget.\n     * @return\n     */\n    public GridRenderer getRenderer() {\n        return renderer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridBodyRenderContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\n\n/**\n * The context of a Grid's body during the rendering phase.\n */\npublic class GridBodyRenderContext {\n\n    private final double absoluteGridX;\n    private final double absoluteGridY;\n    private final double clipMinY;\n    private final double clipMinX;\n    private final List<GridColumn<?>> blockColumns;\n    private final double absoluteColumnOffsetX;\n    private final int minVisibleRowIndex;\n    private final int maxVisibleRowIndex;\n    private final Transform transform;\n    private final GridRenderer renderer;\n    private final SelectionsTransformer transformer;\n\n    public GridBodyRenderContext(final double absoluteGridX,\n                                 final double absoluteGridY,\n                                 final double absoluteColumnOffsetX,\n                                 final double clipMinY,\n                                 final double clipMinX,\n                                 final int minVisibleRowIndex,\n                                 final int maxVisibleRowIndex,\n                                 final List<GridColumn<?>> blockColumns,\n                                 final Transform transform,\n                                 final GridRenderer renderer,\n                                 final SelectionsTransformer transformer) {\n        this.absoluteGridX = absoluteGridX;\n        this.absoluteGridY = absoluteGridY;\n        this.absoluteColumnOffsetX = absoluteColumnOffsetX;\n        this.clipMinY = clipMinY;\n        this.clipMinX = clipMinX;\n        this.minVisibleRowIndex = minVisibleRowIndex;\n        this.maxVisibleRowIndex = maxVisibleRowIndex;\n        this.blockColumns = blockColumns;\n        this.transform = transform;\n        this.renderer = renderer;\n        this.transformer = transformer;\n    }\n\n    /**\n     * Returns the canvas x-coordinate of the Grid; not transformed.\n     * @return\n     */\n    public double getAbsoluteGridX() {\n        return absoluteGridX;\n    }\n\n    /**\n     * Returns the canvas y-coordinate of the Grid; not transformed\n     * @return\n     */\n    public double getAbsoluteGridY() {\n        return absoluteGridY;\n    }\n\n    /**\n     * Returns the absolute offset from absoluteGridX that the first column needs to be rendered.\n     * Only visible columns are rendered; and so the first column to be rendered needs to\n     * be offset from the Grid's absolute X co-ordinate.\n     * @return\n     */\n    public double getAbsoluteColumnOffsetX() {\n        return absoluteColumnOffsetX;\n    }\n\n    /**\n     * Returns the minimum Y coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinY() {\n        return clipMinY;\n    }\n\n    /**\n     * Returns the minimum X coordinate for visible content. Content outside the region should be clipped.\n     * @return\n     */\n    public double getClipMinX() {\n        return clipMinX;\n    }\n\n    /**\n     * Returns the index of the first row being rendered.\n     * @return\n     */\n    public int getMinVisibleRowIndex() {\n        return minVisibleRowIndex;\n    }\n\n    /**\n     * Returns the index of the last row being rendered.\n     * @return\n     */\n    public int getMaxVisibleRowIndex() {\n        return maxVisibleRowIndex;\n    }\n\n    /**\n     * Returns the columns to render for the block.\n     * @return\n     */\n    public List<GridColumn<?>> getBlockColumns() {\n        return blockColumns;\n    }\n\n    /**\n     * TReturns the transformation of the Grid Widget.\n     * @return\n     */\n    public Transform getTransform() {\n        return transform;\n    }\n\n    /**\n     * Returns the Renderer for the Grid Widget.\n     * @return\n     */\n    public GridRenderer getRenderer() {\n        return renderer;\n    }\n\n    /**\n     * Returns the Column Index transformer supporting Floating Columns.\n     * @return\n     */\n    public SelectionsTransformer getTransformer() {\n        return transformer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridBoundaryRenderContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\n/**\n * The context of a Grid's boundary during the rendering phase.\n */\npublic class GridBoundaryRenderContext {\n\n    private final double x;\n    private final double y;\n    private final double width;\n    private final double height;\n\n    public GridBoundaryRenderContext(final double x,\n                                     final double y,\n                                     final double width,\n                                     final double height) {\n        this.x = x;\n        this.y = y;\n        this.width = width;\n        this.height = height;\n    }\n\n    /**\n     * Returns the X co-ordinate relative to the grid of the boundary.\n     * @return\n     */\n    public double getX() {\n        return x;\n    }\n\n    /**\n     * Returns the Y co-ordinate relative to the grid of the boundary.\n     * @return\n     */\n    public double getY() {\n        return y;\n    }\n\n    /**\n     * Returns the width of the Grid boundary.\n     * @return\n     */\n    public double getWidth() {\n        return width;\n    }\n\n    /**\n     * Returns the height of the Grid boundary.\n     * @return\n     */\n    public double getHeight() {\n        return height;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridHeaderColumnRenderContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\n\n/**\n * The context of a Grid's cell header during the rendering phase.\n */\npublic class GridHeaderColumnRenderContext {\n\n    private final double x;\n    private final List<GridColumn<?>> allColumns;\n    private final List<GridColumn<?>> blockColumns;\n    private final int columnIndex;\n    private final GridData model;\n    private final GridRenderer renderer;\n\n    public GridHeaderColumnRenderContext(final double x,\n                                         final List<GridColumn<?>> allColumns,\n                                         final List<GridColumn<?>> blockColumns,\n                                         final int columnIndex,\n                                         final GridData model,\n                                         final GridRenderer renderer) {\n        this.x = x;\n        this.allColumns = allColumns;\n        this.blockColumns = blockColumns;\n        this.columnIndex = columnIndex;\n        this.model = model;\n        this.renderer = renderer;\n    }\n\n    /**\n     * Returns the columns x-coordinate relative to the grids origin.\n     * @return\n     */\n    public double getX() {\n        return this.x;\n    }\n\n    /**\n     * Returns all columns in the block, some of which may not be visible or rendered within the Viewport.\n     * @return\n     */\n    public List<GridColumn<?>> getAllColumns() {\n        return allColumns;\n    }\n\n    /**\n     * Returns the columns to render for the block.\n     * @return\n     */\n    public List<GridColumn<?>> getBlockColumns() {\n        return blockColumns;\n    }\n\n    /**\n     * Returns the index of the column, in BlockColumns, being rendered.\n     * @return\n     */\n    public int getColumnIndex() {\n        return columnIndex;\n    }\n\n    /**\n     * Returns the data model for the Grid Widget to which the Column relates.\n     * @return\n     */\n    public GridData getModel() {\n        return model;\n    }\n\n    /**\n     * Returns the Renderer for the Grid Widget.\n     * @return\n     */\n    public GridRenderer getRenderer() {\n        return renderer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/context/GridHeaderRenderContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.context;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\n\n/**\n * The context of a Grid's header during the rendering phase.\n */\npublic class GridHeaderRenderContext {\n\n    private final List<GridColumn<?>> allColumns;\n    private final List<GridColumn<?>> blockColumns;\n\n    public GridHeaderRenderContext(final List<GridColumn<?>> allColumns,\n                                   final List<GridColumn<?>> blockColumns) {\n        this.allColumns = allColumns;\n        this.blockColumns = blockColumns;\n    }\n\n    /**\n     * Returns all columns in the block, some of which may not be visible or rendered within the Viewport.\n     * @return\n     */\n    public List<GridColumn<?>> getAllColumns() {\n        return allColumns;\n    }\n\n    /**\n     * Returns the columns to render for the block.\n     * @return\n     */\n    public List<GridColumn<?>> getBlockColumns() {\n        return blockColumns;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDHandlersState.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.google.gwt.dom.client.Style;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * A container for the state of the MouseDown, MouseMove and MouseUp handlers during a drag operation.\n */\npublic class GridWidgetDnDHandlersState {\n\n    private GridWidget activeGridWidget = null;\n    private GridColumn.HeaderMetaData activeHeaderMetaData = null;\n    private List<GridColumn<?>> activeGridColumns = new ArrayList<GridColumn<?>>();\n    private List<GridRow> activeGridRows = new ArrayList<GridRow>();\n\n    private GridWidgetHandlersOperation operation = GridWidgetHandlersOperation.NONE;\n    private Style.Cursor cursor = Style.Cursor.DEFAULT;\n\n    private double eventInitialX = 0;\n    private double eventInitialColumnWidth = 0;\n    private GridWidgetDnDProxy eventColumnHighlight = new GridWidgetDnDProxy();\n\n    /**\n     * Resets the state to no operation with no active columns or rows.\n     */\n    public void reset() {\n        if (activeGridWidget != null) {\n            activeGridWidget.setDraggable(false);\n        }\n        this.activeGridWidget = null;\n        this.activeHeaderMetaData = null;\n        this.activeGridRows.clear();\n        setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.NONE);\n        setCursor(Style.Cursor.DEFAULT);\n    }\n\n    /**\n     * Returns the active GridWidget. Can be null if no DnD operation has been registered over a GridWidget.\n     * @return The active GridWidget or null.\n     */\n    public GridWidget getActiveGridWidget() {\n        return activeGridWidget;\n    }\n\n    /**\n     * Sets the active GridWidget. Can be null.\n     * @param activeGridWidget\n     */\n    public void setActiveGridWidget(final GridWidget activeGridWidget) {\n        this.activeGridWidget = activeGridWidget;\n    }\n\n    /**\n     * Returns the active HeaderMetaData.\n     * @return\n     */\n    public GridColumn.HeaderMetaData getActiveHeaderMetaData() {\n        return activeHeaderMetaData;\n    }\n\n    /**\n     * Sets the active HeaderMetaData.\n     * @param activeHeaderMetaData\n     */\n    public void setActiveHeaderMetaData(final GridColumn.HeaderMetaData activeHeaderMetaData) {\n        this.activeHeaderMetaData = activeHeaderMetaData;\n    }\n\n    /**\n     * Returns the active columns being affected by the current the operation.\n     * @return\n     */\n    public List<GridColumn<?>> getActiveGridColumns() {\n        return Collections.unmodifiableList(activeGridColumns);\n    }\n\n    /**\n     * Sets the active columns to be affected by the current the operation.\n     */\n    public void setActiveGridColumns(final List<GridColumn<?>> activeGridColumns) {\n        this.activeGridColumns.clear();\n        this.activeGridColumns.addAll(activeGridColumns);\n    }\n\n    /**\n     * Returns the active rows being affected by the current the operation.\n     * @return\n     */\n    public List<GridRow> getActiveGridRows() {\n        return Collections.unmodifiableList(activeGridRows);\n    }\n\n    /**\n     * Sets the active rows to be affected by the current the operation.\n     */\n    public void setActiveGridRows(final List<GridRow> activeGridRows) {\n        this.activeGridRows.clear();\n        this.activeGridRows.addAll(activeGridRows);\n    }\n\n    /**\n     * The current drag operation in progress.\n     * @return\n     */\n    public GridWidgetHandlersOperation getOperation() {\n        return operation;\n    }\n\n    /**\n     * Sets the current drag operation in progress.\n     * @param operation\n     */\n    public void setOperation(final GridWidgetHandlersOperation operation) {\n        this.operation = operation;\n    }\n\n    /**\n     * Returns the Cursor type to be shown for the current operation. This primarily used in conjunction with DOMElement based cells.\n     * When the pointer moves over a DOM element the browser determines the Cursor to show based on the DOM element's CSS. This\n     * however can be different to the pointer required during, for example, a column resize operation. In such cases the\n     * browser changes the pointer to that defined by CSS replacing that set by the MouseMove handler.\n     * @return\n     */\n    public Style.Cursor getCursor() {\n        return cursor;\n    }\n\n    /**\n     * Sets the Cursor type to be shown for the current operation.\n     * @param cursor\n     */\n    public void setCursor(Style.Cursor cursor) {\n        this.cursor = cursor;\n    }\n\n    /**\n     * Returns the grid-relative x-coordinate of the Mouse Event.\n     * @return\n     */\n    public double getEventInitialX() {\n        return eventInitialX;\n    }\n\n    /**\n     * Sets the grid-relative x-coordinate of the Mouse Event.\n     * @param eventInitialX\n     */\n    public void setEventInitialX(final double eventInitialX) {\n        this.eventInitialX = eventInitialX;\n    }\n\n    /**\n     * Returns the width of a column being re-sized at the commencement of the resize operation.\n     * During a re-size operation the new width is determined by calculating the delta of\n     * the MouseMoveEvent coordinates. The initial width is therefore required to apply\n     * the same delta.\n     * @return\n     */\n    public double getEventInitialColumnWidth() {\n        return eventInitialColumnWidth;\n    }\n\n    /**\n     * Sets the initial width of a column to be resized.\n     * @param eventInitialColumnWidth\n     */\n    public void setEventInitialColumnWidth(final double eventInitialColumnWidth) {\n        this.eventInitialColumnWidth = eventInitialColumnWidth;\n    }\n\n    /**\n     * Returns  the Group representing the column during a drag operation of the column being moved\n     * @return\n     */\n    public GridWidgetDnDProxy getEventColumnHighlight() {\n        return eventColumnHighlight;\n    }\n\n    /**\n     * The different states of the drag operation.\n     */\n    public enum GridWidgetHandlersOperation {\n        NONE,                   // Nothing happening!\n        COLUMN_RESIZE_PENDING,  // The ability to resize a column has been detected.\n        COLUMN_RESIZE,          // A column is being resized\n        COLUMN_MOVE_PENDING,    // The ability to move a column has been detected.\n        COLUMN_MOVE_INITIATED,  // A column is able to move but has not _been_ moved to a new position.\n        COLUMN_MOVE,            // A column is able to move and had been moved to a new position.\n        ROW_MOVE_PENDING,       // The ability to move a row has been detected.\n        ROW_MOVE_INITIATED,     // A row is able to move but has not _been_ moved to a new position.\n        ROW_MOVE,               // A row is able to move and has been moved to a new position.\n        GRID_MOVE_PENDING,      // The ability to move a grid has been detected.\n        GRID_MOVE               // A grid has been moved.\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseDownHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDownHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.shared.core.types.DragMode;\nimport com.google.gwt.dom.client.Style;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.util.CoordinateUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * MouseDownHandler to handle the commencement of drag operations.\n */\npublic class GridWidgetDnDMouseDownHandler implements NodeMouseDownHandler {\n\n    protected final GridLayer layer;\n    protected final GridWidgetDnDHandlersState state;\n\n    public GridWidgetDnDMouseDownHandler(final GridLayer layer,\n                                         final GridWidgetDnDHandlersState state) {\n        this.layer = layer;\n        this.state = state;\n    }\n\n    @Override\n    public void onNodeMouseDown(final NodeMouseDownEvent event) {\n        //The Grid that the pointer is currently over is set by the MouseMoveHandler\n        if (state.getActiveGridWidget() == null) {\n            return;\n        }\n\n        //Get the GridWidget for the grid.\n        final GridWidget activeGridWidget = state.getActiveGridWidget();\n        final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(activeGridWidget,\n                                                                          new Point2D(event.getX(),\n                                                                                      event.getY()));\n\n        //Move from one of the pending operations to the actual operation, as appropriate.\n        switch (state.getOperation()) {\n            case COLUMN_RESIZE_PENDING:\n                if (state.getActiveGridColumns().isEmpty()) {\n                    return;\n                }\n                state.setEventInitialX(ap.getX());\n                state.setEventInitialColumnWidth(state.getActiveGridColumns().get(0).getWidth());\n                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_RESIZE);\n                break;\n\n            case COLUMN_MOVE_PENDING:\n                if (state.getActiveGridColumns().isEmpty()) {\n                    return;\n                }\n\n                state.setEventInitialX(ap.getX());\n                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_MOVE_INITIATED);\n                showColumnHighlight(state.getActiveGridWidget(), state.getActiveGridColumns());\n                break;\n\n            case ROW_MOVE_PENDING:\n                if (state.getActiveGridRows().isEmpty()) {\n                    return;\n                }\n\n                state.setEventInitialX(ap.getX());\n                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.ROW_MOVE_INITIATED);\n                showRowHighlight(state.getActiveGridWidget(), state.getActiveGridRows());\n                break;\n\n            case GRID_MOVE_PENDING:\n                state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.GRID_MOVE);\n                activeGridWidget.setDragMode(DragMode.SAME_LAYER);\n                activeGridWidget.setDraggable(true);\n                setCursor(Style.Cursor.MOVE);\n        }\n    }\n\n    private void setCursor(final Style.Cursor cursor) {\n        layer.getViewport().getElement().getStyle().setCursor(cursor);\n        state.setCursor(cursor);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected void showColumnHighlight(final GridWidget view,\n                                       final List<GridColumn<?>> activeGridColumns) {\n        final BaseGridRendererHelper rendererHelper = view.getRendererHelper();\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n        if (renderingInformation == null) {\n            return;\n        }\n\n        final Group header = view.getHeader();\n        final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n        final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);\n\n        final Bounds bounds = renderingInformation.getBounds();\n        final double activeColumnX = rendererHelper.getColumnOffset(activeGridColumns.get(0));\n        final double highlightWidth = getHighlightWidth(activeGridColumns);\n        final double highlightHeight = getHighlightHeight(bounds,\n                                                          view,\n                                                          headerMinY);\n\n        final GridWidgetDnDProxy highlight = state.getEventColumnHighlight();\n        highlight.setWidth(highlightWidth);\n        highlight.setHeight(highlightHeight);\n        highlight.setX(view.getComputedLocation().getX() + activeColumnX);\n        highlight.setY(view.getComputedLocation().getY() + headerMinY);\n        layer.add(state.getEventColumnHighlight());\n        layer.getLayer().batch();\n    }\n\n    private double getHighlightWidth(final List<GridColumn<?>> activeGridColumns) {\n        double highlightWidth = 0;\n        for (GridColumn<?> activeGridColumn : activeGridColumns) {\n            highlightWidth = highlightWidth + activeGridColumn.getWidth();\n        }\n        return highlightWidth;\n    }\n\n    private double getHighlightHeight(final Bounds bounds,\n                                      final GridWidget view,\n                                      final double headerMinY) {\n        final double highlightHeight = Math.min(bounds.getY() + bounds.getHeight() - view.getComputedLocation().getY(),\n                                                view.getHeight()) - headerMinY;\n        return highlightHeight;\n    }\n\n    protected void showRowHighlight(final GridWidget view,\n                                    final List<GridRow> activeGridRows) {\n        final BaseGridRendererHelper rendererHelper = view.getRendererHelper();\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n        if (renderingInformation == null) {\n            return;\n        }\n\n        final Bounds bounds = renderingInformation.getBounds();\n        final GridRow row = activeGridRows.get(0);\n        final int rowIndex = view.getModel().getRows().indexOf(row);\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final double rowOffsetY = rendererHelper.getRowOffset(rowIndex, allRowHeights) + view.getRenderer().getHeaderHeight();\n\n        final double highlightWidth = Math.min(bounds.getX() + bounds.getWidth() - view.getComputedLocation().getX(),\n                                               view.getWidth());\n        final double highlightHeight = allRowHeights.get(rowIndex);\n\n        final GridWidgetDnDProxy highlight = state.getEventColumnHighlight();\n        highlight.setWidth(highlightWidth);\n        highlight.setHeight(highlightHeight);\n        highlight.setX(view.getComputedLocation().getX());\n        highlight.setY(view.getComputedLocation().getY() + rowOffsetY);\n        layer.add(state.getEventColumnHighlight());\n        layer.getLayer().batch();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseMoveHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveHandler;\nimport com.ait.lienzo.client.core.mediator.IMediator;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.google.gwt.dom.client.Style;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.util.CoordinateUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.RestrictedMousePanMediator;\n\n/**\n * MouseMoveHandler to handle potential drag operations and handle the drag itself; if required.\n */\npublic class GridWidgetDnDMouseMoveHandler implements NodeMouseMoveHandler {\n\n    // How close the mouse pointer needs to be to the column separator to initiate a resize operation.\n    private static final int COLUMN_RESIZE_HANDLE_SENSITIVITY = 5;\n\n    protected final GridLayer layer;\n    protected final GridWidgetDnDHandlersState state;\n\n    public GridWidgetDnDMouseMoveHandler(final GridLayer layer,\n                                         final GridWidgetDnDHandlersState state) {\n        this.layer = layer;\n        this.state = state;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public void onNodeMouseMove(final NodeMouseMoveEvent event) {\n        switch (state.getOperation()) {\n            case GRID_MOVE:\n                //The grid is draggable. This is handled by Lienzo.\n                break;\n\n            case COLUMN_RESIZE:\n                //If we're currently resizing a column we don't need to find a column\n                handleColumnResize(event);\n                break;\n\n            case COLUMN_MOVE:\n            case COLUMN_MOVE_INITIATED:\n                //If we're currently moving a column we don't need to find a column\n                handleColumnMove(event);\n                break;\n\n            case ROW_MOVE:\n            case ROW_MOVE_INITIATED:\n                //If we're currently moving a row we don't need to find a row\n                handleRowMove(event);\n                break;\n\n            default:\n                //Otherwise try to find a Grid and GridColumn(s)\n                findGridColumn(event);\n        }\n    }\n\n    protected void findGridColumn(final NodeMouseMoveEvent event) {\n        state.reset();\n        setCursor(state.getCursor());\n\n        for (GridWidget gridWidget : layer.getGridWidgets()) {\n\n            gridWidget.setDraggable(false);\n\n            if (!gridWidget.isVisible()) {\n                continue;\n            }\n            if (!gridWidget.getModel().isColumnDraggingEnabled()) {\n                continue;\n            }\n\n            final Group header = gridWidget.getHeader();\n            final GridRenderer renderer = gridWidget.getRenderer();\n            final double headerHeight = renderer.getHeaderHeight();\n\n            final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n            final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n            if (renderingInformation == null) {\n                continue;\n            }\n\n            final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n            final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);\n            final double headerMaxY = (header == null ? headerHeight : headerHeight + header.getY());\n\n            final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget,\n                                                                              new Point2D(event.getX(),\n                                                                                          event.getY()));\n\n            final double cx = ap.getX();\n            final double cy = ap.getY();\n\n            //If over Grid's drag handle prime for dragging\n            if (!layer.isGridPinned()) {\n                if (gridWidget.onDragHandle(event)) {\n                    state.setActiveGridWidget(gridWidget);\n                    state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.GRID_MOVE_PENDING);\n                    continue;\n                }\n            }\n\n            //Check bounds\n            if (cx < 0 || cx > gridWidget.getWidth()) {\n                continue;\n            }\n            if (cy < headerMinY || cy > gridWidget.getHeight()) {\n                continue;\n            }\n\n            if (cy < headerMaxY) {\n                //Check for column moving\n                findMovableColumns(gridWidget,\n                                   renderingInformation,\n                                   headerHeight - headerRowsYOffset,\n                                   headerMinY,\n                                   cx,\n                                   cy);\n            } else {\n                //Check for movable rows\n                findMovableRows(gridWidget,\n                                renderingInformation,\n                                cx,\n                                cy);\n            }\n\n            //Check for column resizing\n            findResizableColumn(gridWidget,\n                                renderingInformation,\n                                cx);\n\n            //If over Grid but no operation has been identified default to Grid dragging; when unpinned\n            if (!layer.isGridPinned()) {\n                if (state.getActiveGridWidget() == null) {\n                    state.setActiveGridWidget(gridWidget);\n                    state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.GRID_MOVE_PENDING);\n                }\n            }\n        }\n\n        for (IMediator mediator : layer.getViewport().getMediators()) {\n            mediator.setEnabled(state.getActiveGridWidget() == null);\n        }\n    }\n\n    protected void setCursor(final Style.Cursor cursor) {\n        for (IMediator mediator : layer.getViewport().getMediators()) {\n            if (mediator instanceof RestrictedMousePanMediator) {\n                if (((RestrictedMousePanMediator) mediator).isDragging()) {\n                    return;\n                }\n            }\n        }\n        layer.getViewport().getElement().getStyle().setCursor(cursor);\n        state.setCursor(cursor);\n    }\n\n    protected void findResizableColumn(final GridWidget view,\n                                       final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                       final double cx) {\n        //Gather information on columns\n        if (renderingInformation == null) {\n            return;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n        final double bodyX = bodyBlockInformation.getX();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        //Check floating columns\n        double offsetX = floatingX;\n        GridColumn<?> column = null;\n        for (GridColumn<?> gridColumn : floatingColumns) {\n            if (gridColumn.isVisible()) {\n                if (gridColumn.isResizable()) {\n                    final double columnWidth = gridColumn.getWidth();\n                    if (cx > columnWidth + offsetX - COLUMN_RESIZE_HANDLE_SENSITIVITY && cx < columnWidth + offsetX + COLUMN_RESIZE_HANDLE_SENSITIVITY) {\n                        column = gridColumn;\n                        break;\n                    }\n                }\n                offsetX = offsetX + gridColumn.getWidth();\n            }\n        }\n\n        //Check all other columns\n        if (column == null) {\n            offsetX = bodyX;\n            for (GridColumn<?> gridColumn : bodyColumns) {\n                if (gridColumn.isVisible()) {\n                    if (gridColumn.isResizable()) {\n                        final double columnWidth = gridColumn.getWidth();\n                        if (offsetX + gridColumn.getWidth() > floatingX + floatingWidth) {\n                            if (cx > columnWidth + offsetX - COLUMN_RESIZE_HANDLE_SENSITIVITY && cx < columnWidth + offsetX + COLUMN_RESIZE_HANDLE_SENSITIVITY) {\n                                column = gridColumn;\n                                break;\n                            }\n                        }\n                    }\n                    offsetX = offsetX + gridColumn.getWidth();\n                }\n            }\n        }\n\n        if (column != null) {\n            final List<GridColumn<?>> activeColumns = new ArrayList<>();\n            activeColumns.add(column);\n            state.setActiveGridWidget(view);\n            state.setActiveGridColumns(activeColumns);\n            state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING);\n            setCursor(Style.Cursor.COL_RESIZE);\n        }\n    }\n\n    protected void findMovableColumns(final GridWidget view,\n                                      final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                      final double headerRowsHeight,\n                                      final double headerMinY,\n                                      final double cx,\n                                      final double cy) {\n        //Gather information on columns\n        if (renderingInformation == null) {\n            return;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> allColumns = view.getModel().getColumns();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n        final double bodyX = bodyBlockInformation.getX();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        //Check all other columns. Floating columns cannot be moved.\n        double offsetX = bodyX;\n        for (int headerColumnIndex = 0; headerColumnIndex < bodyColumns.size(); headerColumnIndex++) {\n            final GridColumn<?> gridColumn = bodyColumns.get(headerColumnIndex);\n            final double columnWidth = gridColumn.getWidth();\n\n            if (gridColumn.isVisible()) {\n                final List<GridColumn.HeaderMetaData> headerMetaData = gridColumn.getHeaderMetaData();\n                final double headerRowHeight = headerRowsHeight / headerMetaData.size();\n\n                for (int headerRowIndex = 0; headerRowIndex < headerMetaData.size(); headerRowIndex++) {\n                    final GridColumn.HeaderMetaData md = headerMetaData.get(headerRowIndex);\n                    if (gridColumn.isMovable()) {\n                        if (cy < (headerRowIndex + 1) * headerRowHeight + headerMinY) {\n                            if (cx > floatingX + floatingWidth) {\n                                if (cx > offsetX && cx < offsetX + columnWidth) {\n                                    //Get the block of columns to be moved.\n                                    final List<GridColumn<?>> blockColumns = getBlockColumns(allColumns,\n                                                                                             headerMetaData,\n                                                                                             headerRowIndex,\n                                                                                             allColumns.indexOf(gridColumn));\n                                    //If the columns to move are split between body and floating we cannot move them.\n                                    for (GridColumn<?> blockColumn : blockColumns) {\n                                        if (floatingColumns.contains(blockColumn)) {\n                                            return;\n                                        }\n                                    }\n\n                                    state.setActiveGridWidget(view);\n                                    state.setActiveGridColumns(blockColumns);\n                                    state.setActiveHeaderMetaData(md);\n                                    state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n                                    setCursor(Style.Cursor.MOVE);\n                                    return;\n                                }\n                            }\n                        }\n                    }\n                }\n                offsetX = offsetX + columnWidth;\n            }\n        }\n    }\n\n    private List<GridColumn<?>> getBlockColumns(final List<GridColumn<?>> allColumns,\n                                                final List<GridColumn.HeaderMetaData> headerMetaData,\n                                                final int headerRowIndex,\n                                                final int headerColumnIndex) {\n        final int blockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(allColumns,\n                                                                                              headerMetaData.get(headerRowIndex),\n                                                                                              headerRowIndex,\n                                                                                              headerColumnIndex);\n        final int blockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(allColumns,\n                                                                                          headerMetaData.get(headerRowIndex),\n                                                                                          headerRowIndex,\n                                                                                          headerColumnIndex);\n\n        final List<GridColumn<?>> columns = new ArrayList<GridColumn<?>>();\n        columns.addAll(allColumns.subList(blockStartColumnIndex,\n                                          blockEndColumnIndex + 1));\n        return columns;\n    }\n\n    protected void findMovableRows(final GridWidget view,\n                                   final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                   final double cx,\n                                   final double cy) {\n        if (!isOverRowDragHandleColumn(renderingInformation,\n                                       cx)) {\n            return;\n        }\n\n        final GridData gridModel = view.getModel();\n        final GridRenderer renderer = view.getRenderer();\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n\n        //Get row index\n        if (gridModel.getRowCount() == 0) {\n            return;\n        }\n        double rowHeight;\n        int uiRowIndex = 0;\n        double offsetY = cy - renderer.getHeaderHeight();\n        while ((rowHeight = allRowHeights.get(uiRowIndex)) < offsetY) {\n            offsetY = offsetY - rowHeight;\n            uiRowIndex++;\n        }\n        if (uiRowIndex < 0 || uiRowIndex > gridModel.getRowCount() - 1) {\n            return;\n        }\n\n        //Add row over which MouseEvent occurred\n        final List<GridRow> rows = new ArrayList<>();\n        rows.add(gridModel.getRow(uiRowIndex));\n\n        //Add any other collapsed rows\n        GridRow collapsedRow;\n        while (uiRowIndex + 1 < gridModel.getRowCount() && (collapsedRow = gridModel.getRow(uiRowIndex + 1)).isCollapsed()) {\n            rows.add(collapsedRow);\n            uiRowIndex++;\n        }\n\n        state.setActiveGridWidget(view);\n        state.setActiveGridRows(rows);\n        state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.ROW_MOVE_PENDING);\n        setCursor(Style.Cursor.MOVE);\n    }\n\n    private boolean isOverRowDragHandleColumn(final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                              final double cx) {\n        //Gather information on columns\n        if (renderingInformation == null) {\n            return false;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n        final double bodyX = bodyBlockInformation.getX();\n        final double floatingX = floatingBlockInformation.getX();\n\n        //Check floating columns\n        if (findRowDragHandleColumn(floatingColumns,\n                                    floatingX,\n                                    cx) != null) {\n            return true;\n        }\n\n        //Check all other columns\n        return findRowDragHandleColumn(bodyColumns,\n                                       bodyX,\n                                       cx) != null;\n    }\n\n    private GridColumn<?> findRowDragHandleColumn(final List<GridColumn<?>> columns,\n                                                  final double offsetX,\n                                                  final double cx) {\n        double _offsetX = offsetX;\n        for (GridColumn<?> gridColumn : columns) {\n            if (gridColumn.isVisible()) {\n                if (gridColumn instanceof IsRowDragHandle) {\n                    final double columnWidth = gridColumn.getWidth();\n                    if (cx > _offsetX && cx < _offsetX + columnWidth) {\n                        return gridColumn;\n                    }\n                }\n                _offsetX = _offsetX + gridColumn.getWidth();\n            }\n        }\n        return null;\n    }\n\n    protected void handleColumnResize(final NodeMouseMoveEvent event) {\n        final GridWidget activeGridWidget = state.getActiveGridWidget();\n        final List<GridColumn<?>> activeGridColumns = state.getActiveGridColumns();\n        if (activeGridColumns.size() > 1) {\n            return;\n        }\n        final GridColumn<?> activeGridColumn = activeGridColumns.get(0);\n        final GridData activeGridModel = activeGridWidget.getModel();\n        final List<GridColumn<?>> allGridColumns = activeGridModel.getColumns();\n\n        final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(activeGridWidget,\n                                                                          new Point2D(event.getX(),\n                                                                                      event.getY()));\n        final double deltaX = ap.getX() - state.getEventInitialX();\n        final Double columnMinimumWidth = activeGridColumn.getMinimumWidth();\n        final Double columnMaximumWidth = activeGridColumn.getMaximumWidth();\n        double columnNewWidth = state.getEventInitialColumnWidth() + deltaX;\n        if (columnMinimumWidth != null) {\n            if (columnNewWidth < columnMinimumWidth) {\n                columnNewWidth = columnMinimumWidth;\n            }\n        }\n        if (columnMaximumWidth != null) {\n            if (columnNewWidth > columnMaximumWidth) {\n                columnNewWidth = columnMaximumWidth;\n            }\n        }\n\n        destroyColumns(allGridColumns);\n\n        activeGridColumn.setWidth(adjustColumnWidth(columnNewWidth, activeGridColumn, activeGridWidget));\n        layer.batch();\n    }\n\n    protected double adjustColumnWidth(double columnNewWidth, GridColumn<?> activeGridColumn, GridWidget activeGridWidget) {\n        final GridData activeGridModel = activeGridWidget.getModel();\n\n        double originalLeftColumnWidth = activeGridColumn.getWidth();\n        double delta = originalLeftColumnWidth - columnNewWidth;\n\n        int visibleWidth = activeGridModel.getVisibleWidth();\n        double gridWidgetWidth = activeGridWidget.getWidth();\n        double newGridWidth = gridWidgetWidth - delta;\n\n        // if the grid is becoming less than 100% width\n        if (newGridWidth < visibleWidth && delta > 0) {\n\n            // look for a column with AUTO width on the right\n            Optional<GridColumn<?>> rightGridColumn = getFirstRightAutoColumn(activeGridColumn, activeGridModel);\n            if (rightGridColumn.isPresent()) {\n                GridColumn<?> rightColumn = rightGridColumn.get();\n                double originalRightColumnWidth = rightColumn.getWidth();\n                double widthWithoutColumn = gridWidgetWidth - originalRightColumnWidth;\n\n                double newWidth = visibleWidth - widthWithoutColumn + delta;\n\n                rightColumn.setWidth(newWidth);\n            }\n            // or revert column resizing if the column itself has AUTO width\n            else if (GridColumn.ColumnWidthMode.isAuto(activeGridColumn)) {\n                double widthWithoutColumn = gridWidgetWidth - originalLeftColumnWidth;\n                columnNewWidth = visibleWidth - widthWithoutColumn;\n            }\n        }\n        return columnNewWidth;\n    }\n\n    Optional<GridColumn<?>> getFirstRightAutoColumn(GridColumn<?> target, GridData model) {\n        List<GridColumn<?>> columns = model.getColumns();\n        int targetIndex = columns.indexOf(target);\n\n        for (int i = targetIndex + 1; i < columns.size(); i += 1) {\n            GridColumn<?> gridColumn = columns.get(i);\n            if (GridColumn.ColumnWidthMode.isAuto(gridColumn)) {\n                return Optional.of(gridColumn);\n            }\n        }\n        return Optional.empty();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected void handleColumnMove(final NodeMouseMoveEvent event) {\n        final GridWidget activeGridWidget = state.getActiveGridWidget();\n        final List<GridColumn<?>> activeGridColumns = state.getActiveGridColumns();\n        final GridColumn.HeaderMetaData activeHeaderMetaData = state.getActiveHeaderMetaData();\n\n        final GridData activeGridModel = activeGridWidget.getModel();\n        final List<GridColumn<?>> allGridColumns = activeGridModel.getColumns();\n        final BaseGridRendererHelper rendererHelper = activeGridWidget.getRendererHelper();\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n        if (renderingInformation == null) {\n            return;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(activeGridWidget,\n                                                                          new Point2D(event.getX(),\n                                                                                      event.getY()));\n        final double cx = ap.getX();\n        if (cx < floatingX + floatingWidth) {\n            return;\n        }\n\n        final double activeBlockWidth = getBlockWidth(allGridColumns,\n                                                      allGridColumns.indexOf(activeGridColumns.get(0)),\n                                                      allGridColumns.indexOf(activeGridColumns.get(activeGridColumns.size() - 1)));\n\n        for (int headerColumnIndex = 0; headerColumnIndex < allGridColumns.size(); headerColumnIndex++) {\n            final GridColumn<?> candidateGridColumn = allGridColumns.get(headerColumnIndex);\n            if (candidateGridColumn.isVisible()) {\n                if (!activeGridColumns.contains(candidateGridColumn)) {\n                    for (int headerRowIndex = 0; headerRowIndex < candidateGridColumn.getHeaderMetaData().size(); headerRowIndex++) {\n                        final GridColumn.HeaderMetaData candidateHeaderMetaData = candidateGridColumn.getHeaderMetaData().get(headerRowIndex);\n                        if (candidateHeaderMetaData.getColumnGroup().equals(activeHeaderMetaData.getColumnGroup())) {\n                            final int candidateBlockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(allGridColumns,\n                                                                                                                           candidateHeaderMetaData,\n                                                                                                                           headerRowIndex,\n                                                                                                                           headerColumnIndex);\n                            final int candidateBlockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(allGridColumns,\n                                                                                                                       candidateHeaderMetaData,\n                                                                                                                       headerRowIndex,\n                                                                                                                       headerColumnIndex);\n                            final double candidateBlockOffset = rendererHelper.getColumnOffset(candidateBlockStartColumnIndex);\n                            final double candidateBlockWidth = getBlockWidth(allGridColumns,\n                                                                             candidateBlockStartColumnIndex,\n                                                                             candidateBlockEndColumnIndex);\n\n                            final double minColX = Math.max(candidateBlockOffset,\n                                                            candidateBlockOffset + (candidateBlockWidth - activeBlockWidth) / 2);\n                            final double maxColX = Math.min(candidateBlockOffset + candidateBlockWidth,\n                                                            candidateBlockOffset + (candidateBlockWidth + activeBlockWidth) / 2);\n                            final double midColX = candidateBlockOffset + candidateBlockWidth / 2;\n                            if (cx > minColX && cx < maxColX) {\n                                if (cx < midColX) {\n                                    destroyColumns(allGridColumns);\n                                    activeGridModel.moveColumnsTo(candidateBlockEndColumnIndex,\n                                                                  activeGridColumns);\n                                    state.getEventColumnHighlight().setX(activeGridWidget.getComputedLocation().getX() + rendererHelper.getColumnOffset(activeGridColumns.get(0)));\n                                    state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_MOVE);\n                                    layer.batch();\n                                    return;\n                                } else {\n                                    destroyColumns(allGridColumns);\n                                    activeGridModel.moveColumnsTo(candidateBlockStartColumnIndex,\n                                                                  activeGridColumns);\n                                    state.getEventColumnHighlight().setX(activeGridWidget.getComputedLocation().getX() + rendererHelper.getColumnOffset(activeGridColumns.get(0)));\n                                    state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.COLUMN_MOVE);\n                                    layer.batch();\n                                    return;\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private double getBlockWidth(final List<? extends GridColumn> columns,\n                                 final int blockStartColumnIndex,\n                                 final int blockEndColumnIndex) {\n        double blockWidth = 0;\n        for (int blockColumnIndex = blockStartColumnIndex; blockColumnIndex <= blockEndColumnIndex; blockColumnIndex++) {\n            final GridColumn column = columns.get(blockColumnIndex);\n            if (column.isVisible()) {\n                blockWidth = blockWidth + column.getWidth();\n            }\n        }\n        return blockWidth;\n    }\n\n    protected void handleRowMove(final NodeMouseMoveEvent event) {\n        final GridWidget activeGridWidget = state.getActiveGridWidget();\n        final List<GridRow> activeGridRows = state.getActiveGridRows();\n\n        final GridData activeGridModel = activeGridWidget.getModel();\n        final List<GridColumn<?>> allGridColumns = activeGridModel.getColumns();\n\n        final BaseGridRendererHelper rendererHelper = activeGridWidget.getRendererHelper();\n        final GridRenderer renderer = activeGridWidget.getRenderer();\n        final double headerHeight = renderer.getHeaderHeight();\n\n        final GridRow leadRow = activeGridRows.get(0);\n        final int leadRowIndex = activeGridModel.getRows().indexOf(leadRow);\n\n        final Point2D ap = CoordinateUtilities.convertDOMToGridCoordinate(activeGridWidget,\n                                                                          new Point2D(event.getX(),\n                                                                                      event.getY()));\n        final double cy = ap.getY();\n        if (cy < headerHeight || cy > activeGridWidget.getHeight()) {\n            return;\n        }\n\n        //Find new row index\n        GridRow row;\n        int uiRowIndex = 0;\n        double offsetY = cy - headerHeight;\n        while ((row = activeGridModel.getRow(uiRowIndex)).getHeight() < offsetY) {\n            offsetY = offsetY - row.getHeight();\n            uiRowIndex++;\n        }\n        if (uiRowIndex < 0 || uiRowIndex > activeGridModel.getRowCount() - 1) {\n            return;\n        }\n\n        if (uiRowIndex == leadRowIndex) {\n            //Don't move if the new rowIndex equals the index of the row(s) being moved\n            return;\n        } else if (uiRowIndex < activeGridModel.getRows().indexOf(leadRow)) {\n            //Don't move up if the pointer is in the bottom half of the target row.\n            if (offsetY > activeGridModel.getRow(uiRowIndex).getHeight() / 2) {\n                return;\n            }\n        } else if (uiRowIndex > activeGridModel.getRows().indexOf(leadRow)) {\n            //Don't move down if the pointer is in the top half of the target row.\n            if (offsetY < activeGridModel.getRow(uiRowIndex).getHeight() / 2) {\n                return;\n            }\n        }\n\n        //Move row(s) and update highlight\n        destroyColumns(allGridColumns);\n        activeGridModel.moveRowsTo(uiRowIndex, activeGridRows);\n\n        final double rowOffsetY = rendererHelper.getRowOffset(leadRow) + headerHeight;\n        state.getEventColumnHighlight().setY(activeGridWidget.getComputedLocation().getY() + rowOffsetY);\n        state.setOperation(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.ROW_MOVE);\n        layer.batch();\n    }\n\n    //Destroy all DOMElement based columns as their creation stores the GridBodyCellRenderContext\n    //which is used to write updated GridCellValue(s) to the underlying GridData at the coordinate\n    //at which the DOMElement was created. Moving Rows and Columns changes these coordinates and\n    //hence the reference held in the DOMElement becomes out of date.\n    private void destroyColumns(final List<GridColumn<?>> columns) {\n        for (GridColumn<?> column : columns) {\n            if (column instanceof HasDOMElementResources) {\n                ((HasDOMElementResources) column).destroyResources();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseUpHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpHandler;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * MouseUpHandler to handle completion of drag operations and release resources.\n */\npublic class GridWidgetDnDMouseUpHandler implements NodeMouseUpHandler {\n\n    protected final GridLayer layer;\n    protected final GridWidgetDnDHandlersState state;\n\n    public GridWidgetDnDMouseUpHandler(final GridLayer layer,\n                                       final GridWidgetDnDHandlersState state) {\n        this.layer = layer;\n        this.state = state;\n    }\n\n    @Override\n    public void onNodeMouseUp(final NodeMouseUpEvent event) {\n        switch (state.getOperation()) {\n            case NONE:\n            case COLUMN_MOVE_PENDING:\n            case COLUMN_RESIZE_PENDING:\n            case ROW_MOVE_PENDING:\n            case COLUMN_RESIZE:\n                break;\n            case COLUMN_MOVE:\n            case COLUMN_MOVE_INITIATED:\n            case ROW_MOVE:\n            case ROW_MOVE_INITIATED:\n                //Clean-up the GridWidgetDnDProxy\n                layer.remove(state.getEventColumnHighlight());\n                layer.batch();\n                break;\n        }\n\n        //Reset state. Defer until the next browser event loop iteration to enable ClickEvents to be processed.\n        scheduleDeferred(() -> {\n            state.reset();\n            layer.getViewport().getElement().getStyle().setCursor(state.getCursor());\n        });\n    }\n\n    void scheduleDeferred(final Command command) {\n        Scheduler.get().scheduleDeferred(command::execute);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.shared.core.types.ColorName;\n\n/**\n * The Group representing a column or row during the drag operation of the column or row being moved.\n */\npublic class GridWidgetDnDProxy extends Group {\n\n    private Rectangle r = new Rectangle(0,\n                                        0)\n            .setFillColor(ColorName.DARKGRAY)\n            .setListening(false)\n            .setAlpha(0.5);\n\n    public GridWidgetDnDProxy() {\n        add(r);\n    }\n\n    public GridWidgetDnDProxy setWidth(final double width) {\n        r.setWidth(width);\n        return this;\n    }\n\n    public GridWidgetDnDProxy setHeight(final double height) {\n        r.setHeight(height);\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/IsRowDragHandle.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\n/**\n * Marker interface for columns that can initiate Row drag and drop operations.\n */\npublic interface IsRowDragHandle {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/DOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom;\n\nimport java.util.function.Consumer;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * Definition of a Factor that can create DOMElements for GWT Widget based cell content.\n * DOMElements are transient in nature and only exist when required, such as when a column\n * and row is visible or when a cell is being edited.\n * @param <W> The Widget to be wrapped by the DOMElement.\n * @param <E> The DOMElement type that this Factory generates.\n */\npublic interface DOMElementFactory<W, E> extends HasDOMElementResources {\n\n    /**\n     * Creates a Widget to be wrapped by the DOMElement\n     * @return\n     */\n    W createWidget();\n\n    /**\n     * Creates a DOMElement.\n     * @param gridLayer The Lienzo layer on which the Grid Widget is attached. DOMElements may need to redraw the Layer when their state changes.\n     * @param gridWidget The GridWidget to which this DOMElement is to be associated.\n     * @return\n     */\n    E createDomElement(final GridLayer gridLayer,\n                       final GridWidget gridWidget);\n\n    /**\n     * Register handlers for the widget. The set of handlers may differ per each Factory. Common handlers\n     * registered in this method are KeyDownHandler, BlurHandler, ... .\n     * @param widget\n     * @param widgetDomElement\n     */\n    void registerHandlers(final W widget, final E widgetDomElement);\n\n    /**\n     * Initialises a DOMElement for a cell and attach it to the GWT container.\n     * @param context The render context of the cell.\n     * @param onCreation A callback that is invoked after the cell has been initialised, allowing content etc to be pre-set\n     * @param onDisplay A callback that is invoked after the cell has been attached to the DOM and displayed.\n     */\n    void attachDomElement(final GridBodyCellRenderContext context,\n                          final Consumer<E> onCreation,\n                          final Consumer<E> onDisplay);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/HasDOMElementResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom;\n\n/**\n * Interface declaring the need for additional resources. This interface is used during the grid rendering phase.\n * Columns may need additional resources to render their content. For example the DOM element overlays need to\n * initialise a DOM element and be able to release these when the column is no longer rendered.\n */\npublic interface HasDOMElementResources {\n\n    /**\n     * Destroys all additional resources created during initialisation. This is\n     * invoked at the end of the render phase if the column is not visible.\n     */\n    void destroyResources();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/impl/BaseDOMElement.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.impl;\n\nimport java.util.Iterator;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.i18n.client.NumberFormat;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.wires.core.grids.client.util.MathUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * The base of all DOMElements, providing common services such as Browser event propagation. MouseEvents do not bubble\n * from an absolutely positioned DIV to other DOM elements; such as the Canvas. This class therefore emulates event\n * propagation by passing MouseEvents to canvas Layer and Grid Widget.\n * @param <T> The data-type represented by the DOMElement.\n * @param <W> The Widget to be wrapped by the DOMElement.\n */\npublic abstract class BaseDOMElement<T, W extends Widget> {\n\n    private static final NumberFormat FORMAT = NumberFormat.getFormat(\"0.0\");\n\n    protected final W widget;\n    protected final SimplePanel widgetContainer = GWT.create(SimplePanel.class);\n\n    protected final GridLayer gridLayer;\n    protected final GridWidget gridWidget;\n    protected final AbsolutePanel domElementContainer;\n\n    protected GridBodyCellRenderContext context;\n\n    public BaseDOMElement(final W widget,\n                          final GridLayer gridLayer,\n                          final GridWidget gridWidget) {\n        this.widget = widget;\n        this.gridLayer = gridLayer;\n        this.gridWidget = gridWidget;\n        this.domElementContainer = gridLayer.getDomElementContainer();\n\n        final Style style = widgetContainer.getElement().getStyle();\n        style.setPosition(Style.Position.ABSOLUTE);\n\n        //MouseEvents over absolutely positioned elements do not bubble through the DOM.\n        //Consequentially Event Handlers on GridLayer do not receive notification of MouseMove\n        //Events used during column resizing. Therefore we manually bubble events to GridLayer.\n        setupDelegatingMouseDownHandler();\n        setupDelegatingMouseMoveHandler();\n        setupDelegatingMouseUpHandler();\n        setupDelegatingClickHandler();\n    }\n\n    protected void setupDelegatingMouseDownHandler() {\n        widgetContainer.addDomHandler(new MouseDownHandler() {\n                                          @Override\n                                          public void onMouseDown(final MouseDownEvent event) {\n                                              gridLayer.onNodeMouseDown(new NodeMouseDownEvent(event) {\n\n                                                  @Override\n                                                  public int getX() {\n                                                      //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getX() + widgetContainer.getElement().getOffsetLeft();\n                                                  }\n\n                                                  @Override\n                                                  public int getY() {\n                                                      //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getY() + widgetContainer.getElement().getOffsetTop();\n                                                  }\n                                              });\n                                          }\n                                      },\n                                      MouseDownEvent.getType());\n    }\n\n    protected void setupDelegatingMouseMoveHandler() {\n        final Style style = widgetContainer.getElement().getStyle();\n        widgetContainer.addDomHandler(new MouseMoveHandler() {\n                                          @Override\n                                          public void onMouseMove(final MouseMoveEvent event) {\n                                              //The DOM Element changes the Cursor, so set to the state determined by the MouseEvent Handlers on GridLayer\n                                              style.setCursor(gridLayer.getGridWidgetHandlersState().getCursor());\n\n                                              gridLayer.onNodeMouseMove(new NodeMouseMoveEvent(event) {\n\n                                                  @Override\n                                                  public int getX() {\n                                                      //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getX() + widgetContainer.getElement().getOffsetLeft();\n                                                  }\n\n                                                  @Override\n                                                  public int getY() {\n                                                      //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getY() + widgetContainer.getElement().getOffsetTop();\n                                                  }\n                                              });\n                                          }\n                                      },\n                                      MouseMoveEvent.getType());\n    }\n\n    protected void setupDelegatingMouseUpHandler() {\n        widgetContainer.addDomHandler(new MouseUpHandler() {\n                                          @Override\n                                          public void onMouseUp(final MouseUpEvent event) {\n                                              gridLayer.onNodeMouseUp(new NodeMouseUpEvent(event) {\n\n                                                  @Override\n                                                  public int getX() {\n                                                      //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getX() + widgetContainer.getElement().getOffsetLeft();\n                                                  }\n\n                                                  @Override\n                                                  public int getY() {\n                                                      //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getY() + widgetContainer.getElement().getOffsetTop();\n                                                  }\n                                              });\n                                          }\n                                      },\n                                      MouseUpEvent.getType());\n    }\n\n    protected void setupDelegatingClickHandler() {\n        widgetContainer.addDomHandler(new ClickHandler() {\n                                          @Override\n                                          public void onClick(final ClickEvent event) {\n                                              gridWidget.onNodeMouseClick(new NodeMouseClickEvent(event) {\n\n                                                  @Override\n                                                  public int getX() {\n                                                      //Adjust the x-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getX() + widgetContainer.getElement().getOffsetLeft();\n                                                  }\n\n                                                  @Override\n                                                  public int getY() {\n                                                      //Adjust the y-coordinate (relative to the DOM Element) to be relative to the GridCanvas.\n                                                      return super.getY() + widgetContainer.getElement().getOffsetTop();\n                                                  }\n                                              });\n                                          }\n                                      },\n                                      ClickEvent.getType());\n    }\n\n    /**\n     * Set the Cell context this DOMElement is representing.\n     * @param context\n     */\n    public void setContext(final GridBodyCellRenderContext context) {\n        this.context = context;\n    }\n\n    /**\n     * Initialise the DOMElement for the given cell and render context.\n     * @param context The render context for the cell.\n     */\n    public abstract void initialise(final GridBodyCellRenderContext context);\n\n    /**\n     * Flush the state of the GWT Widget to the underlying GridWidget.\n     * @param value The cell value requiring a DOMElement.\n     */\n    public abstract void flush(final T value);\n\n    /**\n     * Get a GWT Widget for the DOMElement.\n     * @return\n     */\n    public W getWidget() {\n        return widget;\n    }\n\n    /**\n     * Get the container for the GWT Widget.\n     * @return\n     */\n    protected SimplePanel getContainer() {\n        return widgetContainer;\n    }\n\n    /**\n     * Transform the DOMElement based on the render context, such as scale and position.\n     * @param context\n     */\n    protected void transform(final GridBodyCellRenderContext context) {\n        final Transform transform = context.getTransform();\n        final double width = context.getCellWidth();\n        final double height = context.getCellHeight();\n\n        final Style style = widgetContainer.getElement().getStyle();\n\n        //Copy across GridWidget's opacity to DOMElements\n        style.setOpacity(gridWidget.getAlpha());\n\n        //Reposition and transform the DOM Element\n        style.setLeft((context.getAbsoluteCellX() * transform.getScaleX()) + transform.getTranslateX(),\n                      Style.Unit.PX);\n        style.setTop((context.getAbsoluteCellY() * transform.getScaleY()) + transform.getTranslateY(),\n                     Style.Unit.PX);\n        style.setWidth(width,\n                       Style.Unit.PX);\n        style.setHeight(height,\n                        Style.Unit.PX);\n\n        //If the DOMElement overlaps a fixed header clip content\n        style.clearProperty(\"clip\");\n        final double top = context.getAbsoluteCellY() + transform.getTranslateY();\n        final double left = context.getAbsoluteCellX() + transform.getTranslateX();\n        final boolean isFloating = context.isFloating();\n        boolean clip = false;\n        double ct = 0.0;\n        double cr = width;\n        double cb = height;\n        double cl = 0.0;\n\n        final Group header = gridWidget.getHeader();\n        final double clipMinY = context.getClipMinY() + transform.getTranslateY();\n        final double clipMinX = context.getClipMinX() + transform.getTranslateX();\n        if (header != null) {\n            if (top < clipMinY) {\n                ct = clipMinY - top;\n                clip = true;\n            }\n        }\n        if (!isFloating && left < clipMinX) {\n            cl = clipMinX - left;\n            clip = true;\n        }\n        if (clip) {\n            style.setProperty(\"clip\",\n                              \"rect(\" + (int) ct + \"px,\" + (int) cr + \"px,\" + (int) cb + \"px,\" + (int) cl + \"px)\");\n        }\n\n        // --- Workaround for BS2 ---\n        style.setProperty(\"WebkitBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"MozBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"boxSizing\",\n                          \"border-box\");\n        style.setProperty(\"lineHeight\",\n                          \"normal\");\n        // --- End workaround ---\n\n        if (MathUtilities.isOne(transform.getScaleX()) && MathUtilities.isOne(transform.getScaleY())) {\n            style.clearProperty(\"WebkitTransform\");\n            style.clearProperty(\"MozTransform\");\n            style.clearProperty(\"Transform\");\n            style.clearProperty(\"MsTransform\");\n            return;\n        }\n\n        final String scale = \"scale(\" + FORMAT.format(transform.getScaleX()) + \", \" + FORMAT.format(transform.getScaleY()) + \")\";\n        final String translate = \"translate(\" + FORMAT.format(((width - width * transform.getScaleX()) / -2.0)) + \"px, \" + FORMAT.format(((height - height * transform.getScaleY()) / -2.0)) + \"px)\";\n        style.setProperty(\"WebkitTransform\",\n                          translate + \" \" + scale);\n        style.setProperty(\"MozTransform\",\n                          translate + \" \" + scale);\n        style.setProperty(\"Transform\",\n                          translate + \" \" + scale);\n        style.setProperty(\"MsTransform\",\n                          translate + \" \" + scale);\n    }\n\n    /**\n     * Attach the DOMElement to the GWT container, if not already attached.\n     */\n    public void attach() {\n        final Iterator<Widget> itr = domElementContainer.iterator();\n        while (itr.hasNext()) {\n            if (itr.next().equals(widgetContainer)) {\n                return;\n            }\n        }\n        //When an Element is detached it's Position configuration is cleared, so reset it\n        final Style style = widgetContainer.getElement().getStyle();\n        style.setPosition(Style.Position.ABSOLUTE);\n        style.setProperty(\"WebkitUserSelect\",\n                          \"none\");\n        style.setProperty(\"MozUserSelect\",\n                          \"none\");\n        style.setProperty(\"MsUserSelect\",\n                          \"none\");\n\n        domElementContainer.add(widgetContainer);\n    }\n\n    /**\n     * Detach the DOMElement from the GWT container, if already attached.\n     */\n    public void detach() {\n        final Iterator<Widget> itr = domElementContainer.iterator();\n        while (itr.hasNext()) {\n            if (itr.next().equals(widgetContainer)) {\n                itr.remove();\n                return;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/impl/CheckBoxDOMElement.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.impl;\n\nimport com.google.gwt.dom.client.Style;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * A DOMElement for CheckBoxes.\n */\npublic class CheckBoxDOMElement extends BaseDOMElement<Boolean, CheckBox> {\n\n    //Hack to centre CheckBox\n    private static final int SIZE = 20;\n\n    public CheckBoxDOMElement(final CheckBox widget,\n                              final GridLayer gridLayer,\n                              final GridWidget gridWidget) {\n        super(widget,\n              gridLayer,\n              gridWidget);\n        final Style style = widget.getElement().getStyle();\n        style.setMarginTop(0,\n                           Style.Unit.PX);\n        style.setMarginLeft(2,\n                            Style.Unit.PX);\n        style.setWidth(SIZE,\n                       Style.Unit.PX);\n        style.setHeight(SIZE,\n                        Style.Unit.PX);\n\n        // --- Workaround for BS2 ---\n        style.setPosition(Style.Position.RELATIVE);\n        style.setPaddingTop(0,\n                            Style.Unit.PX);\n        style.setPaddingBottom(0,\n                               Style.Unit.PX);\n        style.setProperty(\"WebkitBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"MozBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"boxSizing\",\n                          \"border-box\");\n        style.setProperty(\"lineHeight\",\n                          \"normal\");\n        // --- End workaround ---\n\n        getContainer().setWidget(widget);\n    }\n\n    @Override\n    public void initialise(final GridBodyCellRenderContext context) {\n        final Style style = widget.getElement().getStyle();\n        style.setLeft((context.getCellWidth() - SIZE) / 2,\n                      Style.Unit.PX);\n        style.setTop((context.getCellHeight() - SIZE) / 2,\n                     Style.Unit.PX);\n        transform(context);\n    }\n\n    @Override\n    public void flush(final Boolean value) {\n        final int rowIndex = context.getRowIndex();\n        final int columnIndex = context.getColumnIndex();\n        gridWidget.getModel().setCellValue(rowIndex,\n                                           columnIndex,\n                                           new BaseGridCellValue<Boolean>(value));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/impl/ListBoxDOMElement.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.impl;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.ListBox;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * A DOMElement for TextBoxes.\n */\npublic class ListBoxDOMElement extends BaseDOMElement<String, ListBox> {\n\n    private static final int HEIGHT = 16;\n\n    public ListBoxDOMElement(final ListBox widget,\n                             final GridLayer gridLayer,\n                             final GridWidget gridWidget) {\n        super(widget,\n              gridLayer,\n              gridWidget);\n        final Style style = widget.getElement().getStyle();\n        style.setWidth(100,\n                       Style.Unit.PCT);\n        style.setHeight(HEIGHT,\n                        Style.Unit.PX);\n        style.setPaddingLeft(2,\n                             Style.Unit.PX);\n        style.setPaddingRight(2,\n                              Style.Unit.PX);\n        style.setFontSize(10,\n                          Style.Unit.PX);\n\n        // --- Workaround for BS2 ---\n        style.setPosition(Style.Position.RELATIVE);\n        style.setPaddingTop(0,\n                            Style.Unit.PX);\n        style.setPaddingBottom(0,\n                               Style.Unit.PX);\n        style.setProperty(\"WebkitBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"MozBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"boxSizing\",\n                          \"border-box\");\n        style.setProperty(\"lineHeight\",\n                          \"normal\");\n        // --- End workaround ---\n\n        getContainer().getElement().getStyle().setPaddingLeft(5,\n                                                              Style.Unit.PX);\n        getContainer().getElement().getStyle().setPaddingRight(5,\n                                                               Style.Unit.PX);\n        getContainer().setWidget(widget);\n    }\n\n    @Override\n    public void initialise(final GridBodyCellRenderContext context) {\n        final Style style = widget.getElement().getStyle();\n        style.setMarginTop((context.getCellHeight() - HEIGHT) / 2,\n                           Style.Unit.PX);\n        transform(context);\n    }\n\n    @Override\n    public void flush(final String value) {\n        final int rowIndex = context.getRowIndex();\n        final int columnIndex = context.getColumnIndex();\n        if (value == null || value.trim().isEmpty()) {\n            gridWidget.getModel().deleteCell(rowIndex,\n                                             columnIndex);\n        } else {\n            gridWidget.getModel().setCellValue(rowIndex,\n                                               columnIndex,\n                                               new BaseGridCellValue<String>(value));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/impl/TextBoxDOMElement.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.impl;\n\nimport com.google.gwt.dom.client.Style;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * A DOMElement for TextBoxes.\n */\npublic class TextBoxDOMElement extends BaseDOMElement<String, TextBox> {\n\n    private static final int HEIGHT = 16;\n\n    public TextBoxDOMElement(final TextBox widget,\n                             final GridLayer gridLayer,\n                             final GridWidget gridWidget) {\n        super(widget,\n              gridLayer,\n              gridWidget);\n        final Style style = widget.getElement().getStyle();\n        style.setWidth(100,\n                       Style.Unit.PCT);\n        style.setHeight(HEIGHT,\n                        Style.Unit.PX);\n        style.setPaddingLeft(2,\n                             Style.Unit.PX);\n        style.setPaddingRight(2,\n                              Style.Unit.PX);\n        style.setFontSize(10,\n                          Style.Unit.PX);\n\n        // --- Workaround for BS2 ---\n        style.setPosition(Style.Position.RELATIVE);\n        style.setPaddingTop(0,\n                            Style.Unit.PX);\n        style.setPaddingBottom(0,\n                               Style.Unit.PX);\n        style.setProperty(\"WebkitBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"MozBoxSizing\",\n                          \"border-box\");\n        style.setProperty(\"boxSizing\",\n                          \"border-box\");\n        style.setProperty(\"lineHeight\",\n                          \"normal\");\n        // --- End workaround ---\n\n        getContainer().getElement().getStyle().setPaddingLeft(5,\n                                                              Style.Unit.PX);\n        getContainer().getElement().getStyle().setPaddingRight(5,\n                                                               Style.Unit.PX);\n        getContainer().setWidget(widget);\n    }\n\n    @Override\n    public void initialise(final GridBodyCellRenderContext context) {\n        final Style style = widget.getElement().getStyle();\n        style.setMarginTop((context.getCellHeight() - HEIGHT) / 2,\n                           Style.Unit.PX);\n        transform(context);\n    }\n\n    @Override\n    public void flush(final String value) {\n        final int rowIndex = context.getRowIndex();\n        final int columnIndex = context.getColumnIndex();\n        if (value == null || value.trim().isEmpty()) {\n            gridWidget.getModel().deleteCell(rowIndex,\n                                             columnIndex);\n        } else {\n            gridWidget.getModel().setCellValue(rowIndex,\n                                               columnIndex,\n                                               new BaseGridCellValue<String>(value));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/multiple/HasMultipleDOMElementResources.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.multiple;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\n\n/**\n * Extension for Factories and Columns that display multiple DOMElements to edit the content of cells.\n */\npublic interface HasMultipleDOMElementResources extends HasDOMElementResources {\n\n    /**\n     * Initialises additional resources. This is invoked at the\n     * start of the render phase if a column is visible.\n     */\n    void initialiseResources();\n\n    /**\n     * Destroys additional resources that are not required. This is invoked at the\n     * end of the render phase on columns that are partially visible. Some of the\n     * resources acquired in initialisation may not have been used for rendering\n     * and can be released.\n     */\n    void freeUnusedResources();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/multiple/MultipleDOMElementFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.multiple;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.DOMElementFactory;\n\n/**\n * Definition of a Factory that can create DOMElements for GWT Widget based cell content.\n * DOMElements are transient in nature and only exist when required, such as when a column\n * and row is visible or when a cell is being edited.\n * @param <W> The Widget to be wrapped by the DOMElement.\n * @param <E> The DOMElement type that this Factory generates.\n */\npublic interface MultipleDOMElementFactory<W, E> extends DOMElementFactory<W, E>,\n                                                         HasMultipleDOMElementResources {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/multiple/impl/BaseDOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.MultipleDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * Base Factory for multi-instance DOMElements, i.e. there can be more than one \"on screen\" at any given time.\n * This implementation keeps track of a List of DOMElements used during a render phase. DOMElements are re-used\n * for subsequent render phases, freeing unused DOMElements at the end of the render phase. When a column\n * is not rendered all DOMElements are destroyed.\n * @param <T> The data-type of the cell\n * @param <W> The Widget to be wrapped by the DOMElement.\n * @param <E> The DOMElement type that this Factory generates.\n */\npublic abstract class BaseDOMElementFactory<T, W extends Widget, E extends BaseDOMElement<T, W>> implements MultipleDOMElementFactory<W, E> {\n\n    protected final GridLayer gridLayer;\n    protected final GridWidget gridWidget;\n\n    protected final List<E> domElements = new ArrayList<E>();\n\n    private int consumed = 0;\n\n    public BaseDOMElementFactory(final GridLayer gridLayer,\n                                 final GridWidget gridWidget) {\n        this.gridLayer = gridLayer;\n        this.gridWidget = gridWidget;\n    }\n\n    @Override\n    public void attachDomElement(final GridBodyCellRenderContext context,\n                                 final Consumer<E> onCreation,\n                                 final Consumer<E> onDisplay) {\n        E domElement;\n        if (consumed + 1 > domElements.size()) {\n            domElement = createDomElement(gridLayer,\n                                          gridWidget);\n            domElements.add(domElement);\n        } else {\n            domElement = domElements.get(consumed);\n        }\n        consumed++;\n\n        domElement.setContext(context);\n        domElement.initialise(context);\n        onCreation.accept(domElement);\n\n        domElement.attach();\n        onDisplay.accept(domElement);\n    }\n\n    @Override\n    public void initialiseResources() {\n        consumed = 0;\n    }\n\n    @Override\n    public void destroyResources() {\n        for (E domElement : domElements) {\n            domElement.detach();\n        }\n        domElements.clear();\n        consumed = 0;\n    }\n\n    @Override\n    public void freeUnusedResources() {\n        final List<E> freedDomElements = new ArrayList<E>();\n        for (int i = consumed; i < domElements.size(); i++) {\n            final E domElement = domElements.get(i);\n            domElement.detach();\n            freedDomElements.add(domElement);\n        }\n        for (E domElement : freedDomElements) {\n            domElements.remove(domElement);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/multiple/impl/CheckBoxDOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.CheckBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * A DOMElement Factory for multi-instance CheckBoxes.\n */\npublic class CheckBoxDOMElementFactory extends BaseDOMElementFactory<Boolean, CheckBox, CheckBoxDOMElement> {\n\n    public CheckBoxDOMElementFactory(final GridLayer gridLayer,\n                                     final GridWidget gridWidget) {\n        super(gridLayer,\n              gridWidget);\n    }\n\n    @Override\n    public CheckBox createWidget() {\n        return new CheckBox();\n    }\n\n    @Override\n    public CheckBoxDOMElement createDomElement(final GridLayer gridLayer,\n                                               final GridWidget gridWidget) {\n        final CheckBox widget = createWidget();\n        final CheckBoxDOMElement e = new CheckBoxDOMElement(widget,\n                                                            gridLayer,\n                                                            gridWidget);\n        registerHandlers(widget, e);\n        return e;\n    }\n\n    @Override\n    public void registerHandlers(final CheckBox widget, final CheckBoxDOMElement widgetDomElement) {\n        widget.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                widgetDomElement.flush(widget.getValue());\n                gridLayer.batch();\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/multiple/impl/TextBoxDOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl;\n\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.TextBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * A DOMElement Factory for multi-instance TextBoxes.\n */\npublic class TextBoxDOMElementFactory extends BaseDOMElementFactory<String, TextBox, TextBoxDOMElement> {\n\n    public TextBoxDOMElementFactory(final GridLayer gridLayer,\n                                    final GridWidget gridWidget) {\n        super(gridLayer,\n              gridWidget);\n    }\n\n    @Override\n    public TextBox createWidget() {\n        return new TextBox();\n    }\n\n    @Override\n    public TextBoxDOMElement createDomElement(final GridLayer gridLayer,\n                                              final GridWidget gridWidget) {\n        final TextBox widget = createWidget();\n        final TextBoxDOMElement e = new TextBoxDOMElement(widget,\n                                                          gridLayer,\n                                                          gridWidget);\n        registerHandlers(widget, e);\n        return e;\n    }\n\n    @Override\n    public void registerHandlers(final TextBox widget, final TextBoxDOMElement widgetDomElement) {\n        widget.addBlurHandler(new BlurHandler() {\n            @Override\n            public void onBlur(final BlurEvent event) {\n                widgetDomElement.flush(widget.getValue());\n                gridLayer.batch();\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/HasSingletonDOMElementResource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\n\n/**\n * Extension for Factories and Columns that display a single DOMElement to edit the content of a cell.\n */\npublic interface HasSingletonDOMElementResource extends HasDOMElementResources {\n\n    /**\n     * Flushes the content of a DOMElement to the underlying model. Releasing and removing the DOMElement.\n     */\n    void flush();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/SingletonDOMElementFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.DOMElementFactory;\n\n/**\n * Definition of a Factory that can create DOMElements for GWT Widget based cell content.\n * DOMElements are transient in nature and only exist when required, such as when a column\n * and row is visible or when a cell is being edited.\n * @param <W> The Widget to be wrapped by the DOMElement.\n * @param <E> The DOMElement type that this Factory generates.\n */\npublic interface SingletonDOMElementFactory<W, E> extends DOMElementFactory<W, E>,\n                                                          HasSingletonDOMElementResource {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/BaseSingletonDOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.user.client.ui.Focusable;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.SingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard.KeyDownHandlerCommon;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLayerRedrawManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\n/**\n * Base Factory for single-instance DOMElements, i.e. there can only be one instance \"on screen\" at any given time,\n * for example to handle \"in cell\" editing; when a DOMElement is required to \"edit\" the cell but not when the cell\n * is rendered ordinarily. This implementation keeps a single DOMElement that is detached from the GWT container\n * when not needed.\n * @param <T> The data-type of the cell\n * @param <W> The Widget to be wrapped by the DOMElement.\n * @param <E> The DOMElement type that this Factory generates.\n */\npublic abstract class BaseSingletonDOMElementFactory<T, W extends Widget, E extends BaseDOMElement<T, W>> implements SingletonDOMElementFactory<W, E> {\n\n    protected final GridLienzoPanel gridPanel;\n    protected final GridLayer gridLayer;\n    protected final GridWidget gridWidget;\n\n    protected W widget;\n    protected E e;\n\n    public BaseSingletonDOMElementFactory(final GridLienzoPanel gridPanel,\n                                          final GridLayer gridLayer,\n                                          final GridWidget gridWidget) {\n        this.gridPanel = gridPanel;\n        this.gridLayer = gridLayer;\n        this.gridWidget = gridWidget;\n    }\n\n    @Override\n    public void attachDomElement(final GridBodyCellRenderContext context,\n                                 final Consumer<E> onCreation,\n                                 final Consumer<E> onDisplay) {\n        gridLayer.batch(new GridLayerRedrawManager.PrioritizedCommand(Integer.MAX_VALUE) {\n            @Override\n            public void execute() {\n                final E domElement = createDomElement(gridLayer,\n                                                      gridWidget);\n                registerHandlers(widget, domElement);\n\n                domElement.setContext(context);\n                domElement.initialise(context);\n                onCreation.accept(domElement);\n\n                domElement.attach();\n                onDisplay.accept(domElement);\n            }\n        });\n    }\n\n    @Override\n    public E createDomElement(final GridLayer gridLayer,\n                              final GridWidget gridWidget) {\n        widget = createWidget();\n        e = createDomElementInternal(widget, gridLayer, gridWidget);\n\n        return e;\n    }\n\n    @Override\n    public void registerHandlers(final W widget, final E widgetDomElement) {\n        widget.addDomHandler(destroyOrFlushKeyDownHandler(),\n                             KeyDownEvent.getType());\n        widget.addDomHandler((e) -> e.stopPropagation(),\n                             KeyDownEvent.getType());\n        widget.addDomHandler((e) -> e.stopPropagation(),\n                             MouseDownEvent.getType());\n\n        if (widget instanceof Focusable) {\n            widget.addDomHandler((e) ->\n                                 {\n                                     flush();\n                                     gridLayer.batch();\n                                     gridPanel.setFocus(true);\n                                 }, BlurEvent.getType());\n        }\n    }\n\n    @Override\n    public void destroyResources() {\n        if (e != null) {\n            e.detach();\n            widget = null;\n            e = null;\n        }\n    }\n\n    @Override\n    public void flush() {\n        if (e != null) {\n            if (widget != null) {\n                e.flush(getValue());\n            }\n            e.detach();\n            widget = null;\n            e = null;\n        }\n    }\n\n    protected KeyDownHandlerCommon destroyOrFlushKeyDownHandler() {\n        return new KeyDownHandlerCommon(gridPanel, gridLayer, gridWidget, this);\n    }\n\n    protected abstract T getValue();\n\n    protected abstract E createDomElementInternal(final W widget,\n                                                  final GridLayer gridLayer,\n                                                  final GridWidget gridWidget);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/ListBoxSingletonDOMElementFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport com.google.gwt.user.client.ui.ListBox;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.ListBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\n/**\n * A DOMElement Factory for single-instance ListBoxes.\n */\npublic class ListBoxSingletonDOMElementFactory extends BaseSingletonDOMElementFactory<String, ListBox, ListBoxDOMElement> {\n\n    public ListBoxSingletonDOMElementFactory(final GridLienzoPanel gridPanel,\n                                             final GridLayer gridLayer,\n                                             final GridWidget gridWidget) {\n        super(gridPanel,\n              gridLayer,\n              gridWidget);\n    }\n\n    @Override\n    public ListBox createWidget() {\n        return new ListBox();\n    }\n\n    @Override\n    protected String getValue() {\n        if (widget != null) {\n            return widget.getValue(widget.getSelectedIndex());\n        }\n        return null;\n    }\n\n    @Override\n    protected ListBoxDOMElement createDomElementInternal(final ListBox widget,\n                                                         final GridLayer gridLayer,\n                                                         final GridWidget gridWidget) {\n        return new ListBoxDOMElement(widget,\n                                     gridLayer,\n                                     gridWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/TextBoxSingletonDOMElementFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.TextBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\n/**\n * A DOMElement Factory for single-instance TextBoxes.\n */\npublic class TextBoxSingletonDOMElementFactory extends BaseSingletonDOMElementFactory<String, TextBox, TextBoxDOMElement> {\n\n    public TextBoxSingletonDOMElementFactory(final GridLienzoPanel gridPanel,\n                                             final GridLayer gridLayer,\n                                             final GridWidget gridWidget) {\n        super(gridPanel,\n              gridLayer,\n              gridWidget);\n    }\n\n    @Override\n    public TextBox createWidget() {\n        return new TextBox();\n    }\n\n    @Override\n    protected String getValue() {\n        if (widget != null) {\n            return widget.getValue();\n        }\n        return null;\n    }\n\n    @Override\n    protected TextBoxDOMElement createDomElementInternal(final TextBox widget,\n                                                         final GridLayer gridLayer,\n                                                         final GridWidget gridWidget) {\n        return new TextBoxDOMElement(widget,\n                                     gridLayer,\n                                     gridWidget);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/edit/EditorPopup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.edit;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\n\n/**\n * A simple popup to demonstrate \"out of cell\" editing for Strings.\n */\npublic class EditorPopup extends Modal {\n\n    private final TextBox textBox = new TextBox();\n    private final ModalBody modalBody = new ModalBody();\n\n    private GridCellValue<String> value;\n    private Consumer<GridCellValue<String>> callback = null;\n\n    public EditorPopup() {\n        setTitle(\"Edit\");\n\n        textBox.addKeyDownHandler(new KeyDownHandler() {\n            @Override\n            public void onKeyDown(final KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    commit();\n                }\n            }\n        });\n\n        modalBody.add(textBox);\n        add(modalBody);\n\n        final ModalFooter footer = new ModalFooter();\n        final Button okButton = new Button(\"OK\");\n        okButton.setIcon(IconType.EDIT);\n        okButton.setType(ButtonType.PRIMARY);\n        okButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                commit();\n            }\n        });\n\n        final Button cancelButton = new Button(\"Cancel\");\n        cancelButton.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                cancel();\n            }\n        });\n\n        footer.add(okButton);\n        footer.add(cancelButton);\n        add(footer);\n\n        addShownHandler((e) -> textBox.setFocus(true));\n    }\n\n    /**\n     * Show the popup\n     * @param value The value to show in the editor.\n     * @param callback Callback to invoke when the popup is \"OK'ed\".\n     */\n    public void edit(final GridCellValue<String> value,\n                     final Consumer<GridCellValue<String>> callback) {\n        this.value = value;\n        this.callback = callback;\n        textBox.setText(value == null ? \"\" : value.getValue());\n        show();\n    }\n\n    private void cancel() {\n        hide();\n    }\n\n    private void commit() {\n        if (callback != null) {\n            callback.accept(new BaseGridCellValue<String>(textBox.getText()));\n        }\n        hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/GridWidget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid;\n\nimport com.ait.lienzo.client.core.event.INodeXYEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.CoordinateUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\n\n/**\n * The base of all GridWidgets.\n */\npublic interface GridWidget extends IPrimitive<Group>,\n                                    NodeMouseClickHandler,\n                                    CellSelectionManager {\n\n    /**\n     * Returns the Model backing the Widget.\n     * @return\n     */\n    GridData getModel();\n\n    /**\n     * Returns the Renderer used to render the Widget.\n     * @return\n     */\n    GridRenderer getRenderer();\n\n    /**\n     * Returns the Rendered used to render the Widget.\n     * @param renderer\n     */\n    void setRenderer(final GridRenderer renderer);\n\n    /**\n     * Returns helper for rendering the Widget.\n     * @return\n     */\n    BaseGridRendererHelper getRendererHelper();\n\n    /**\n     * Returns the Group representing the GridWidget's Body\n     * @return\n     */\n    Group getBody();\n\n    /**\n     * Returns the Group representing the GridWidget's Header\n     * @return\n     */\n    Group getHeader();\n\n    /**\n     * Returns the width of the whole Widget.\n     * @return\n     */\n    double getWidth();\n\n    /**\n     * Returns the height of the whole Widget, including Header and Body.\n     * @return\n     */\n    double getHeight();\n\n    /**\n     * Selects the Widget; i.e. it has been clicked on, so show some visual indicator that it has been selected.\n     */\n    void select();\n\n    /**\n     * Deselects the Widget; i.e. another GridWidget has been clicked on, so hide\n     * any visual indicator that this Widget was selected.\n     */\n    void deselect();\n\n    /**\n     * Returns the selected state of the Widget.\n     * @return true if the Widget is selected.\n     */\n    boolean isSelected();\n\n    /**\n     * Show context menu of a header cell at coordinates 'uiHeaderRowIndex' and 'uiHeaderColumnIndex'.\n     * If the provided coordinate does not resolve to a header cell in the Grid no operation is performed.\n     * @param uiHeaderRowIndex Header row index of cell to invoke context menu\n     * @param uiHeaderColumnIndex Header column index of cell to invoke context menu\n     * @return true if menu was shown.\n     */\n    boolean showContextMenuForHeader(final int uiHeaderRowIndex,\n                                     final int uiHeaderColumnIndex);\n\n    /**\n     * Show context menu of a cell at coordinates 'uiRowIndex' and 'uiColumnIndex'.\n     * If the provided coordinate does not resolve to a cell in the Grid no operation is performed.\n     * @param uiRowIndex Row index of cell to invoke context menu\n     * @param uiColumnIndex Column index of cell to invoke context menu\n     * @return true if menu was shown.\n     */\n    boolean showContextMenuForCell(final int uiRowIndex,\n                                   final int uiColumnIndex);\n\n    /**\n     * Returns the {@link CellSelectionManager} associated with the {@link GridWidget}\n     * @return\n     */\n    CellSelectionManager getCellSelectionManager();\n\n    /**\n     * Checks whether a cell-relative coordinate is \"on\" the hot-spot to toggle the collapsed/expanded state.\n     * @param cellX The MouseEvent relative to the cell's x-coordinate.\n     * @param cellY The MouseEvent relative to the cell's y-coordinate.\n     * @param cellWidth Width of the containing cell.\n     * @param cellHeight Height of the containing cell.\n     * @return true if the cell coordinate is on the hot-spot.\n     */\n    boolean onGroupingToggle(final double cellX,\n                             final double cellY,\n                             final double cellWidth,\n                             final double cellHeight);\n\n    /**\n     * Checks whether a canvas coordinate is within the \"drag handle\" for the GridWidget.\n     * Canvas coordinates can be mapped to coordinates relative to the GridWidget with\n     * {@link CoordinateUtilities#convertDOMToGridCoordinate(GridWidget, Point2D)}\n     * @param event The INodeXYEvent relative to the canvas coordinate system.\n     * @return true if the event is within the drag handle.\n     */\n    @SuppressWarnings(\"unused\")\n    default boolean onDragHandle(final INodeXYEvent event) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/NodeMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * Defines a generic handler for any type of {@link AbstractNodeMouseEvent}.\n */\npublic interface NodeMouseEventHandler {\n\n    /**\n     * Executes when a {@link NodeMouseEventHandler} reacts to the {@link AbstractNodeMouseEvent}\n     * to which the {@link NodeMouseEventHandler} has been registered. Note {@code uiHeaderRowIndex},\n     * {@code uiHeaderColumnIndex}, {@code uiRowIndex} and {@code uiColumnIndex} may be {@link Optional#empty()} if\n     * the event did not occur over the applicable element within the {@link GridWidget}.\n     * @param gridWidget The {@link GridWidget} on which the event occurred.\n     * @param relativeLocation {@link Point2D} relative to the top-left of the {@link GridWidget}\n     * @param uiHeaderRowIndex Index of the Header row as seen in the UI. 0-based index. Top row is 0.\n     * @param uiHeaderColumnIndex Index of the Header column as seen in the UI. 0-based index. Leftmost column is 0.\n     * @param uiRowIndex Index of the Body row as seen in the UI\n     * @param uiColumnIndex Index of the Body column as seen in the UI\n     * @param event The original event.\n     * @return true if the event was handled.\n     */\n    boolean onNodeMouseEvent(final GridWidget gridWidget,\n                             final Point2D relativeLocation,\n                             final Optional<Integer> uiHeaderRowIndex,\n                             final Optional<Integer> uiHeaderColumnIndex,\n                             final Optional<Integer> uiRowIndex,\n                             final Optional<Integer> uiColumnIndex,\n                             final AbstractNodeMouseEvent event);\n\n    /**\n     * Handles the event for a Header element.\n     * @param gridWidget The {@link GridWidget} on which the event occurred.\n     * @param relativeLocation {@link Point2D} relative to the top-left of the {@link GridWidget}\n     * @param uiHeaderRowIndex Index of the Header row as seen in the UI. 0-based index. Top row is 0.\n     * @param uiHeaderColumnIndex Index of the Header column as seen in the UI. 0-based index. Leftmost column is 0.\n     * @param event The original event.\n     * @return true if the event was handled.\n     */\n    default boolean handleHeaderCell(final GridWidget gridWidget,\n                                     final Point2D relativeLocation,\n                                     final int uiHeaderRowIndex,\n                                     final int uiHeaderColumnIndex,\n                                     final AbstractNodeMouseEvent event) {\n        return false;\n    }\n\n    /**\n     * Handles the event for a Body element.\n     * @param gridWidget The {@link GridWidget} on which the event occurred.\n     * @param relativeLocation {@link Point2D} relative to the top-left of the {@link GridWidget}\n     * @param uiRowIndex Index of the Body row as seen in the UI\n     * @param uiColumnIndex Index of the Body column as seen in the UI\n     * @param event The original event.\n     * @return true if the event was handled.\n     */\n    default boolean handleBodyCell(final GridWidget gridWidget,\n                                   final Point2D relativeLocation,\n                                   final int uiRowIndex,\n                                   final int uiColumnIndex,\n                                   final AbstractNodeMouseEvent event) {\n        return false;\n    }\n\n    /**\n     * Returns whether the {@link AbstractNodeMouseEvent} occurred during a Drag and Drop operation.\n     * @param gridWidget The {@link GridWidget} on which the event occurred.\n     * @return true if the event occurred during a Drag and Drop operation.\n     */\n    default boolean isDNDOperationInProgress(final GridWidget gridWidget) {\n        if (!(gridWidget.getLayer() instanceof GridLayer)) {\n            return false;\n        }\n        final GridLayer gridLayer = (GridLayer) gridWidget.getLayer();\n        final GridWidgetDnDHandlersState.GridWidgetHandlersOperation operation = gridLayer.getGridWidgetHandlersState().getOperation();\n        switch (operation) {\n            case NONE:\n            case COLUMN_RESIZE_PENDING:\n            case COLUMN_MOVE_PENDING:\n            case COLUMN_MOVE_INITIATED:\n            case ROW_MOVE_PENDING:\n            case ROW_MOVE_INITIATED:\n            case GRID_MOVE_PENDING:\n                return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/GridWidgetEnterPinnedModeAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.animation.TimedAnimation;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * An animation to reposition the ViewPort so the given GridWidget is centred\n * horizontally and GridWidget header aligned with the top of the ViewPort.\n */\npublic class GridWidgetEnterPinnedModeAnimation extends TimedAnimation {\n\n    public GridWidgetEnterPinnedModeAnimation(final GridWidget gridWidget,\n                                              final Set<GridWidget> gridWidgets,\n                                              final Set<IPrimitive<?>> gridWidgetConnectors,\n                                              final Command onStartCommand,\n                                              final List<Command> onEnterPinnedModeCommands) {\n        super(500,\n              new IAnimationCallback() {\n\n                  private final double endScaleX = 1.0;\n                  private final double endScaleY = 1.0;\n                  private Point2D delta;\n                  private Point2D startTranslation;\n                  private double startScaleX;\n                  private double startScaleY;\n                  private AnimationTweener tweener = AnimationTweener.EASE_OUT;\n\n                  @Override\n                  public void onStart(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      final Viewport vp = gridWidget.getViewport();\n                      if (vp.getTransform() == null) {\n                          vp.setTransform(new Transform());\n                      }\n                      startScaleX = vp.getTransform().getScaleX();\n                      startScaleY = vp.getTransform().getScaleY();\n                      startTranslation = getViewportTranslation().mul(-1.0);\n\n                      final Point2D endTranslation = new Point2D(gridWidget.getX(),\n                                                                 gridWidget.getY()).mul(-1.0);\n\n                      delta = new Point2D(endTranslation.getX() - startTranslation.getX(),\n                                          endTranslation.getY() - startTranslation.getY());\n\n                      onStartCommand.execute();\n\n                      gridWidget.getLayer().setListening(false);\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onFrame(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      final double pct = assertPct(animation.getPercent());\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      transform.reset();\n\n                      final Point2D frameLocation = startTranslation.add(delta.mul(pct));\n                      final double frameScaleX = startScaleX + (endScaleX - startScaleX) * pct;\n                      final double frameScaleY = startScaleY + (endScaleY - startScaleY) * pct;\n                      transform.scale(frameScaleX,\n                                      frameScaleY).translate(frameLocation.getX(),\n                                                             frameLocation.getY());\n\n                      hideGridWidgets(pct);\n                      hideGridWidgetConnectors(pct);\n\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onClose(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      for (GridWidget gw : gridWidgets) {\n                          gw.setVisible(false);\n                      }\n                      for (IPrimitive<?> p : gridWidgetConnectors) {\n                          p.setVisible(false);\n                      }\n                      gridWidget.getLayer().setListening(true);\n                      gridWidget.getLayer().batch();\n\n                      onEnterPinnedModeCommands.forEach(Command::execute);\n                  }\n\n                  private Point2D getViewportTranslation() {\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      final Transform t = transform.copy().getInverse();\n                      final Point2D p = new Point2D(t.getTranslateX(),\n                                                    t.getTranslateY());\n                      return p;\n                  }\n\n                  private double assertPct(final double pct) {\n                      if (pct < 0) {\n                          return 0;\n                      }\n                      if (pct > 1.0) {\n                          return 1.0;\n                      }\n                      return tweener.apply(pct);\n                  }\n\n                  private void hideGridWidgets(final double pct) {\n                      for (GridWidget gw : gridWidgets) {\n                          gw.setAlpha(1.0 - pct);\n                      }\n                  }\n\n                  private void hideGridWidgetConnectors(final double pct) {\n                      for (IPrimitive<?> p : gridWidgetConnectors) {\n                          p.setAlpha(1.0 - pct);\n                      }\n                  }\n              });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/GridWidgetExitPinnedModeAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport java.util.List;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.animation.TimedAnimation;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\n/**\n * An animation to reposition the ViewPort so the given GridWidget is centred\n * horizontally and GridWidget header aligned with the top of the ViewPort.\n */\npublic class GridWidgetExitPinnedModeAnimation extends TimedAnimation {\n\n    public GridWidgetExitPinnedModeAnimation(final GridPinnedModeManager.PinnedContext state,\n                                             final Set<GridWidget> gridWidgets,\n                                             final Set<IPrimitive<?>> gridWidgetConnectors,\n                                             final Command onCompleteCommand,\n                                             final List<Command> onExitPinnedModeCommands) {\n        super(500,\n              new IAnimationCallback() {\n\n                  private final double startScaleX = 1.0;\n                  private final double startScaleY = 1.0;\n                  private Point2D delta;\n                  private Point2D startTranslation;\n                  private GridWidget gridWidget;\n                  private double endScaleX;\n                  private double endScaleY;\n\n                  private AnimationTweener tweener = AnimationTweener.EASE_OUT;\n\n                  @Override\n                  public void onStart(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      gridWidget = state.getGridWidget();\n                      final Viewport vp = gridWidget.getViewport();\n                      if (vp.getTransform() == null) {\n                          vp.setTransform(new Transform());\n                      }\n                      endScaleX = state.getScaleX();\n                      endScaleY = state.getScaleY();\n                      startTranslation = getViewportTranslation().mul(-1.0);\n\n                      final Point2D endTranslation = new Point2D(state.getTranslateX(),\n                                                                 state.getTranslateY());\n\n                      delta = new Point2D(endTranslation.getX() - startTranslation.getX(),\n                                          endTranslation.getY() - startTranslation.getY());\n\n                      for (GridWidget gw : gridWidgets) {\n                          gw.setVisible(true);\n                      }\n                      for (IPrimitive<?> p : gridWidgetConnectors) {\n                          p.setVisible(true);\n                      }\n\n                      gridWidget.getLayer().setListening(false);\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onFrame(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      final double pct = assertPct(animation.getPercent());\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      transform.reset();\n\n                      final Point2D frameLocation = startTranslation.add(delta.mul(pct));\n                      final double frameScaleX = startScaleX + (endScaleX - startScaleX) * pct;\n                      final double frameScaleY = startScaleY + (endScaleY - startScaleY) * pct;\n                      transform.translate(frameLocation.getX(),\n                                          frameLocation.getY()).scale(frameScaleX,\n                                                                      frameScaleY);\n\n                      showGridWidgets(pct);\n                      showGridWidgetConnectors(pct);\n\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onClose(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      state.getGridWidget().getLayer().setListening(true);\n                      state.getGridWidget().getLayer().batch();\n\n                      onCompleteCommand.execute();\n\n                      onExitPinnedModeCommands.forEach(Command::execute);\n                  }\n\n                  private Point2D getViewportTranslation() {\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      final Transform t = transform.copy().getInverse();\n                      final Point2D p = new Point2D(t.getTranslateX(),\n                                                    t.getTranslateY());\n                      return p;\n                  }\n\n                  private double assertPct(final double pct) {\n                      if (pct < 0) {\n                          return 0;\n                      }\n                      if (pct > 1.0) {\n                          return 1.0;\n                      }\n                      return tweener.apply(pct);\n                  }\n\n                  private void showGridWidgets(final double pct) {\n                      for (GridWidget gw : gridWidgets) {\n                          gw.setAlpha(pct);\n                      }\n                  }\n\n                  private void showGridWidgetConnectors(final double pct) {\n                      for (IPrimitive<?> p : gridWidgetConnectors) {\n                          p.setAlpha(pct);\n                      }\n                  }\n              });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/GridWidgetScrollIntoViewAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.animation.TimedAnimation;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * An animation to reposition the ViewPort so the given GridWidget is positioned in the top-left of the visible bounds.\n */\npublic class GridWidgetScrollIntoViewAnimation extends TimedAnimation {\n\n    public GridWidgetScrollIntoViewAnimation(final GridWidget gridWidget,\n                                             final Command onStartCommand) {\n        super(500,\n              new IAnimationCallback() {\n\n                  private Point2D delta;\n                  private Point2D startTranslation;\n                  private AnimationTweener tweener = AnimationTweener.EASE_OUT;\n\n                  @Override\n                  public void onStart(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      final Viewport vp = gridWidget.getViewport();\n                      if (vp.getTransform() == null) {\n                          vp.setTransform(new Transform());\n                      }\n                      startTranslation = getViewportTranslation().mul(-1.0);\n\n                      final Point2D endTranslation = new Point2D(gridWidget.getX(),\n                                                                 gridWidget.getY()).mul(-1.0);\n\n                      delta = new Point2D(endTranslation.getX() - startTranslation.getX(),\n                                          endTranslation.getY() - startTranslation.getY());\n\n                      onStartCommand.execute();\n\n                      gridWidget.getLayer().setListening(false);\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onFrame(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      final double pct = assertPct(animation.getPercent());\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      final double scaleX = transform.getScaleX();\n                      final double scaleY = transform.getScaleY();\n                      transform.reset();\n\n                      final Point2D frameLocation = startTranslation.add(delta.mul(pct));\n                      transform.scale(scaleX,\n                                      scaleY).translate(frameLocation.getX(),\n                                                        frameLocation.getY());\n\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onClose(final IAnimation animation,\n                                      final IAnimationHandle handle) {\n                      gridWidget.getLayer().setListening(true);\n                      gridWidget.getLayer().batch();\n                  }\n\n                  private Point2D getViewportTranslation() {\n                      final Viewport vp = gridWidget.getViewport();\n                      final Transform transform = vp.getTransform();\n                      final Transform t = transform.copy().getInverse();\n                      final Point2D p = new Point2D(t.getTranslateX(),\n                                                    t.getTranslateY());\n                      return p;\n                  }\n\n                  private double assertPct(final double pct) {\n                      if (pct < 0) {\n                          return 0;\n                      }\n                      if (pct > 1.0) {\n                          return 1.0;\n                      }\n                      return tweener.apply(pct);\n                  }\n              });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/MergableGridWidgetCollapseRowsAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.animation.TimedAnimation;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * An animation to collapse rows in a merged block. The cells in\n * the merged block are set to collapsed when the animation starts.\n */\npublic class MergableGridWidgetCollapseRowsAnimation extends TimedAnimation {\n\n    public MergableGridWidgetCollapseRowsAnimation(final GridWidget gridWidget,\n                                                   final int uiRowIndex,\n                                                   final int uiColumnIndex,\n                                                   final int rowCount) {\n        super(500,\n              new IAnimationCallback() {\n\n                  private AnimationTweener tweener = AnimationTweener.EASE_OUT;\n\n                  @Override\n                  public void onStart(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Mark cells as collapsed\n                      gridWidget.getModel().collapseCell(uiRowIndex,\n                                                         uiColumnIndex);\n                  }\n\n                  @Override\n                  public void onFrame(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Set the rows' height to their starting height down to zero\n                      final double pct = assertPct(iAnimation.getPercent());\n                      for (int i = 1; i < rowCount; i++) {\n                          final GridRow row = gridWidget.getModel().getRow(uiRowIndex + i);\n                          row.setHeight((1.0 - pct) * row.peekHeight());\n                      }\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onClose(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Do nothing\n                  }\n\n                  private double assertPct(final double pct) {\n                      if (pct < 0) {\n                          return 0;\n                      }\n                      if (pct > 1.0) {\n                          return 1.0;\n                      }\n                      return tweener.apply(pct);\n                  }\n              });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/MergableGridWidgetExpandRowsAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.animation.TimedAnimation;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * An animation to expand collapsed rows in a merged block. The cells in\n * the merged block are set to expanded when the animation starts.\n */\npublic class MergableGridWidgetExpandRowsAnimation extends TimedAnimation {\n\n    public MergableGridWidgetExpandRowsAnimation(final GridWidget gridWidget,\n                                                 final int uiRowIndex,\n                                                 final int uiColumnIndex,\n                                                 final int rowCount) {\n        super(500,\n              new IAnimationCallback() {\n\n                  private AnimationTweener tweener = AnimationTweener.EASE_OUT;\n                  private List<Double> heights = new ArrayList<Double>();\n\n                  @Override\n                  public void onStart(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Store the rows' target heights\n                      for (int i = 0; i < rowCount; i++) {\n                          final GridRow row = gridWidget.getModel().getRow(uiRowIndex + i);\n                          heights.add(row.peekHeight());\n                      }\n\n                      //Mark cells as expanded\n                      gridWidget.getModel().expandCell(uiRowIndex,\n                                                       uiColumnIndex);\n                  }\n\n                  @Override\n                  public void onFrame(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Set the rows' height from zero to their starting height\n                      final double pct = assertPct(iAnimation.getPercent());\n                      for (int i = 1; i < rowCount; i++) {\n                          final GridRow row = gridWidget.getModel().getRow(uiRowIndex + i);\n                          row.setHeight(pct * heights.get(i));\n                      }\n                      gridWidget.getLayer().batch();\n                  }\n\n                  @Override\n                  public void onClose(final IAnimation iAnimation,\n                                      final IAnimationHandle iAnimationHandle) {\n                      //Do nothing\n                  }\n\n                  private double assertPct(final double pct) {\n                      if (pct < 0) {\n                          return 0;\n                      }\n                      if (pct > 1.0) {\n                          return 1.0;\n                      }\n                      return tweener.apply(pct);\n                  }\n              });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/BooleanDOMElementColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.HasMultipleDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.CheckBoxDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.impl.BooleanColumnDOMElementRenderer;\n\npublic class BooleanDOMElementColumn extends BaseGridColumn<Boolean> implements HasMultipleDOMElementResources {\n\n    private CheckBoxDOMElementFactory factory;\n\n    public BooleanDOMElementColumn(final GridColumn.HeaderMetaData headerMetaData,\n                                   final CheckBoxDOMElementFactory factory,\n                                   final double width) {\n        this(new ArrayList<HeaderMetaData>() {{\n                 add(headerMetaData);\n             }},\n             factory,\n             width);\n    }\n\n    public BooleanDOMElementColumn(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                   final CheckBoxDOMElementFactory factory,\n                                   final double width) {\n        super(headerMetaData,\n              new BooleanColumnDOMElementRenderer(factory),\n              width);\n        this.factory = factory;\n    }\n\n    @Override\n    public void initialiseResources() {\n        factory.initialiseResources();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n\n    @Override\n    public void freeUnusedResources() {\n        factory.freeUnusedResources();\n    }\n\n    @Override\n    public void edit(final GridCell<Boolean> cell,\n                     final GridBodyCellRenderContext context,\n                     final Consumer<GridCellValue<Boolean>> callback) {\n        callback.accept(new BaseGridCellValue<>(!cell.getValue().getValue()));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/ListBoxDOMElementSingletonColumn.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.ListBox;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.ListBoxSingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.impl.ListBoxColumnDOMElementSingletonRenderer;\n\npublic class ListBoxDOMElementSingletonColumn extends BaseGridColumn<String> implements HasSingletonDOMElementResource {\n\n    private final ListBoxSingletonDOMElementFactory factory;\n\n    public ListBoxDOMElementSingletonColumn(final HeaderMetaData headerMetaData,\n                                            final ListBoxSingletonDOMElementFactory factory,\n                                            final double width) {\n        this(new ArrayList<HeaderMetaData>() {{\n                 add(headerMetaData);\n             }},\n             factory,\n             width);\n    }\n\n    public ListBoxDOMElementSingletonColumn(final List<HeaderMetaData> headerMetaData,\n                                            final ListBoxSingletonDOMElementFactory factory,\n                                            final double width) {\n        super(headerMetaData,\n              new ListBoxColumnDOMElementSingletonRenderer(factory),\n              width);\n        this.factory = Objects.requireNonNull(factory, \"factory\");\n    }\n\n    @Override\n    public void edit(final GridCell<String> cell,\n                     final GridBodyCellRenderContext context,\n                     final Consumer<GridCellValue<String>> callback) {\n        factory.attachDomElement(context,\n                                 e -> {\n                                     final ListBox widget = e.getWidget();\n                                     widget.addItem(\"one\");\n                                     widget.addItem(\"two\");\n                                     if (cell != null && cell.getValue() != null) {\n                                         for (int i = 0; i < widget.getItemCount(); i++) {\n                                             if (widget.getItemText(i).equals(cell.getValue().getValue())) {\n                                                 widget.setSelectedIndex(i);\n                                                 break;\n                                             }\n                                         }\n                                     }\n                                 },\n                                 e -> e.getWidget().setFocus(true));\n    }\n\n    @Override\n    public void flush() {\n        factory.flush();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/RowNumberColumn.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.IsRowDragHandle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl.IntegerColumnRenderer;\n\npublic class RowNumberColumn extends BaseGridColumn<Integer> implements IsRowDragHandle {\n\n    public RowNumberColumn() {\n        this(new ArrayList<HeaderMetaData>() {{\n                 add(new BaseHeaderMetaData(\"#\"));\n             }},\n             new IntegerColumnRenderer());\n    }\n\n    public RowNumberColumn(final List<HeaderMetaData> headerMetaData) {\n        this(headerMetaData,\n             new IntegerColumnRenderer());\n    }\n\n    public RowNumberColumn(final List<HeaderMetaData> headerMetaData,\n                           final GridColumnRenderer<Integer> columnRenderer) {\n        super(headerMetaData,\n              columnRenderer,\n              50.0);\n        setMovable(false);\n        setResizable(false);\n        setFloatable(true);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/StringDOMElementColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.HasMultipleDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.TextBoxDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.impl.StringColumnDOMElementRenderer;\n\npublic class StringDOMElementColumn extends BaseGridColumn<String> implements HasMultipleDOMElementResources {\n\n    private TextBoxDOMElementFactory factory;\n\n    public StringDOMElementColumn(final GridColumn.HeaderMetaData headerMetaData,\n                                  final TextBoxDOMElementFactory factory,\n                                  final double width) {\n        this(new ArrayList<HeaderMetaData>() {{\n                 add(headerMetaData);\n             }},\n             factory,\n             width);\n    }\n\n    public StringDOMElementColumn(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                  final TextBoxDOMElementFactory factory,\n                                  final double width) {\n        super(headerMetaData,\n              new StringColumnDOMElementRenderer(factory),\n              width);\n        this.factory = factory;\n    }\n\n    @Override\n    public void initialiseResources() {\n        factory.initialiseResources();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n\n    @Override\n    public void freeUnusedResources() {\n        factory.freeUnusedResources();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/StringDOMElementSingletonColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.Consumer;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.TextBoxSingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.impl.StringColumnDOMElementSingletonRenderer;\n\npublic class StringDOMElementSingletonColumn extends BaseGridColumn<String> implements HasSingletonDOMElementResource {\n\n    private final TextBoxSingletonDOMElementFactory factory;\n\n    public StringDOMElementSingletonColumn(final GridColumn.HeaderMetaData headerMetaData,\n                                           final TextBoxSingletonDOMElementFactory factory,\n                                           final double width) {\n        this(new ArrayList<HeaderMetaData>() {{\n                 add(headerMetaData);\n             }},\n             factory,\n             width);\n    }\n\n    public StringDOMElementSingletonColumn(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                           final TextBoxSingletonDOMElementFactory factory,\n                                           final double width) {\n        super(headerMetaData,\n              new StringColumnDOMElementSingletonRenderer(factory),\n              width);\n        this.factory = Objects.requireNonNull(factory, \"factory\");\n    }\n\n    @Override\n    public void edit(final GridCell<String> cell,\n                     final GridBodyCellRenderContext context,\n                     final Consumer<GridCellValue<String>> callback) {\n        factory.attachDomElement(context,\n                                 e -> e.getWidget().setValue(assertCell(cell).getValue().getValue()),\n                                 e -> e.getWidget().setFocus(true));\n    }\n\n    private GridCell<String> assertCell(final GridCell<String> cell) {\n        if (cell != null) {\n            return cell;\n        }\n        return new BaseGridCell<String>(new BaseGridCellValue<String>(\"\"));\n    }\n\n    @Override\n    public void flush() {\n        factory.flush();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/StringPopupColumn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.edit.EditorPopup;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\n\npublic class StringPopupColumn extends BaseGridColumn<String> {\n\n    private final EditorPopup editor = new EditorPopup();\n\n    public StringPopupColumn(final List<GridColumn.HeaderMetaData> headerMetaData,\n                             final GridColumnRenderer<String> columnRenderer,\n                             final double width) {\n        super(headerMetaData,\n              columnRenderer,\n              width);\n    }\n\n    public StringPopupColumn(final GridColumn.HeaderMetaData headerMetaData,\n                             final GridColumnRenderer<String> columnRenderer,\n                             final double width) {\n        super(headerMetaData,\n              columnRenderer,\n              width);\n    }\n\n    @Override\n    public void edit(final GridCell<String> cell,\n                     final GridBodyCellRenderContext context,\n                     final Consumer<GridCellValue<String>> callback) {\n        editor.edit(assertCell(cell).getValue(),\n                    callback);\n    }\n\n    private GridCell<String> assertCell(final GridCell<String> cell) {\n        if (cell != null) {\n            return cell;\n        }\n        return new BaseGridCell<String>(new BaseGridCellValue<String>(\"\"));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.AbstractMap;\nimport java.util.ArrayDeque;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\nimport java.util.logging.Logger;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\nimport com.ait.lienzo.client.core.Context2D;\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.BoundingBox;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.HasMultipleDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.DefaultSelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.FloatingSelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.SelectedRange;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.BaseCellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\nimport static org.uberfire.ext.wires.core.grids.client.util.Logging.log;\n\n/**\n * The base of all GridWidgets.\n */\npublic class BaseGridWidget extends Group implements GridWidget {\n\n    private static final Logger LOGGER = Logger.getLogger(BaseGridWidget.class.getName());\n\n    protected final SelectionsTransformer bodyTransformer;\n    protected final SelectionsTransformer floatingColumnsTransformer;\n    protected final BaseGridRendererHelper rendererHelper;\n    protected final Queue<Map.Entry<Group, List<GridRenderer.RendererCommand>>> renderQueue = new ArrayDeque<>();\n\n    //These are final as a reference is held by the ISelectionsTransformers\n    protected final List<GridColumn<?>> allColumns = new ArrayList<>();\n    protected final List<GridColumn<?>> bodyColumns = new ArrayList<>();\n    protected final List<GridColumn<?>> floatingColumns = new ArrayList<>();\n\n    protected GridData model;\n    protected GridRenderer renderer;\n    protected Group header = null;\n    protected Group headerSelections = null;\n    protected Group floatingHeader = null;\n    protected Group floatingHeaderSelections = null;\n\n    protected Group body = null;\n    protected Group bodySelections = null;\n    protected Group floatingBody = null;\n    protected Group floatingBodySelections = null;\n\n    protected Group boundary = null;\n    protected BaseGridRendererHelper.RenderingInformation renderingInformation;\n\n    private Group selection = null;\n    private boolean isSelected = false;\n    private CellSelectionManager cellSelectionManager;\n\n    private final BiFunction<SelectedRange, Integer, Double> headerSelectionYOffsetStrategy;\n    private final Function<SelectedRange, Double> headerSelectionHeightStrategy;\n    private final BiFunction<SelectedRange, Integer, Double> bodySelectionYOffsetStrategy;\n    private final Function<SelectedRange, Double> bodySelectionHeightStrategy;\n\n    public BaseGridWidget(final GridData model,\n                          final GridSelectionManager selectionManager,\n                          final GridPinnedModeManager pinnedModeManager,\n                          final GridRenderer renderer) {\n        this.model = model;\n        this.renderer = renderer;\n        this.bodyTransformer = new DefaultSelectionsTransformer(model,\n                                                                bodyColumns);\n        this.floatingColumnsTransformer = new FloatingSelectionsTransformer(model,\n                                                                            floatingColumns);\n        this.rendererHelper = getBaseGridRendererHelper();\n        this.cellSelectionManager = getCellSelectionManager();\n\n        //Click handlers\n        addNodeMouseClickHandler(getGridMouseClickHandler(selectionManager));\n        addNodeMouseDoubleClickHandler(getGridMouseDoubleClickHandler(selectionManager,\n                                                                      pinnedModeManager));\n\n        //NodeMouseUpEvent on GridLayer is not fired at a drag-end, so clear the state here.\n        addNodeDragEndHandler((event) -> {\n            final GridWidgetDnDHandlersState state = ((DefaultGridLayer) getLayer()).getGridWidgetHandlersState();\n            state.reset();\n            getViewport().getElement().getStyle().setCursor(state.getCursor());\n        });\n\n        headerSelectionYOffsetStrategy = getHeaderSelectionYOffsetStrategy();\n        headerSelectionHeightStrategy = getHeaderSelectionHeightStrategy();\n        bodySelectionYOffsetStrategy = getBodySelectionYOffsetStrategy();\n        bodySelectionHeightStrategy = getBodySelectionHeightStrategy();\n    }\n\n    BiFunction<SelectedRange, Integer, Double> getHeaderSelectionYOffsetStrategy() {\n        return (selectedRange, minVisibleUiRowIndex) -> {\n            final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n            final double uiRowOffset = renderer.getHeaderRowHeight() * selectedRange.getUiRowIndex();\n            return headerRowsYOffset + uiRowOffset;\n        };\n    }\n\n    Function<SelectedRange, Double> getHeaderSelectionHeightStrategy() {\n        return selectedRange -> {\n            final double headerHeight = getRenderer().getHeaderHeight();\n            final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n            final GridColumn<?> uiColumn = model.getColumns().get(selectedRange.getUiColumnIndex());\n            final List<GridColumn.HeaderMetaData> headerMetaData = uiColumn.getHeaderMetaData();\n            final double headerRowHeight = (headerHeight - headerRowsYOffset) / headerMetaData.size();\n            return selectedRange.getHeight() * headerRowHeight;\n        };\n    }\n\n    BiFunction<SelectedRange, Integer, Double> getBodySelectionYOffsetStrategy() {\n        return (selectedRange, minVisibleUiRowIndex) -> {\n            final double uiRowOffset = rendererHelper.getRowOffset(selectedRange.getUiRowIndex());\n            final double uiMinVisibleRowOffset = rendererHelper.getRowOffset(minVisibleUiRowIndex);\n            return uiRowOffset - uiMinVisibleRowOffset;\n        };\n    }\n\n    Function<SelectedRange, Double> getBodySelectionHeightStrategy() {\n        return selectedRange ->\n                IntStream.range(0, selectedRange.getHeight())\n                        .mapToObj(rowIndex -> model.getRow(selectedRange.getUiRowIndex() + rowIndex))\n                        .mapToDouble(GridRow::getHeight)\n                        .sum();\n    }\n\n    protected BaseGridRendererHelper getBaseGridRendererHelper() {\n        return new BaseGridRendererHelper(this);\n    }\n\n    @Override\n    public CellSelectionManager getCellSelectionManager() {\n        if (cellSelectionManager == null) {\n            cellSelectionManager = new BaseCellSelectionManager(this);\n        }\n        return cellSelectionManager;\n    }\n\n    protected NodeMouseClickHandler getGridMouseClickHandler(final GridSelectionManager selectionManager) {\n        return new BaseGridWidgetMouseClickHandler(this, getNodeMouseClickEventHandlers(selectionManager));\n    }\n\n    protected List<NodeMouseEventHandler> getNodeMouseClickEventHandlers(final GridSelectionManager selectionManager) {\n        final List<NodeMouseEventHandler> handlers = new ArrayList<>();\n        handlers.add(new DefaultGridWidgetCellSelectorMouseEventHandler(selectionManager));\n        handlers.add(new DefaultGridWidgetCollapsedCellMouseEventHandler(renderer));\n        handlers.add(new DefaultGridWidgetLinkedColumnMouseEventHandler(selectionManager,\n                                                                        renderer));\n        return handlers;\n    }\n\n    protected NodeMouseDoubleClickHandler getGridMouseDoubleClickHandler(final GridSelectionManager selectionManager,\n                                                                         final GridPinnedModeManager pinnedModeManager) {\n        return new BaseGridWidgetMouseDoubleClickHandler(this, getNodeMouseDoubleClickEventHandlers(selectionManager, pinnedModeManager));\n    }\n\n    protected List<NodeMouseEventHandler> getNodeMouseDoubleClickEventHandlers(final GridSelectionManager selectionManager,\n                                                                               final GridPinnedModeManager pinnedModeManager) {\n        final List<NodeMouseEventHandler> handlers = new ArrayList<>();\n        handlers.add(new DefaultGridWidgetEditCellMouseEventHandler());\n        handlers.add(new DefaultGridWidgetPinnedModeMouseEventHandler(pinnedModeManager,\n                                                                      renderer));\n        return handlers;\n    }\n\n    @Override\n    public GridData getModel() {\n        return model;\n    }\n\n    @Override\n    public GridRenderer getRenderer() {\n        return this.renderer;\n    }\n\n    @Override\n    public void setRenderer(final GridRenderer renderer) {\n        this.renderer = renderer;\n    }\n\n    @Override\n    public BaseGridRendererHelper getRendererHelper() {\n        return rendererHelper;\n    }\n\n    @Override\n    public Group getBody() {\n        return body;\n    }\n\n    @Override\n    public Group getHeader() {\n        return header;\n    }\n\n    @Override\n    public double getWidth() {\n        return rendererHelper.getWidth(model.getColumns());\n    }\n\n    @Override\n    public double getHeight() {\n        double height = renderer.getHeaderHeight();\n        height = height + rendererHelper.getRowOffset(model.getRowCount());\n        return height;\n    }\n\n    private double getHeight(final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        double height = renderer.getHeaderHeight();\n        for (double h : renderingInformation.getAllRowHeights()) {\n            height = height + h;\n        }\n        return height;\n    }\n\n    @Override\n    public void select() {\n        isSelected = true;\n    }\n\n    @Override\n    public void deselect() {\n        isSelected = false;\n    }\n\n    @Override\n    public boolean isSelected() {\n        return isSelected;\n    }\n\n    /**\n     * Intercept the normal Lienzo draw mechanism to calculate and hence draw only the visible\n     * columns and rows for the Grid; being those within the bounds of the GridLayer. At the\n     * start of this draw method all visible columns are given an opportunity to initialise\n     * any resources they require (e.g. DOMElements). At the end of this method all visible\n     * columns are given an opportunity to release any unused resources (e.g. DOMElements).\n     * If a column is not visible it is given an opportunity to destroy all resources.\n     * @param context\n     * @param alpha\n     */\n    @Override\n    protected void drawWithoutTransforms(Context2D context,\n                                         double alpha,\n                                         BoundingBox bb) {\n        final boolean isSelectionLayer = context.isSelection();\n        if (isSelectionLayer && (false == isListening())) {\n            return;\n        }\n        alpha = alpha * getAttributes().getAlpha();\n\n        if (alpha <= 0) {\n            return;\n        }\n        if (model.getColumns().isEmpty()) {\n            return;\n        }\n\n        //Clear existing content\n        this.removeAll();\n\n        long currentTimeMillis;\n        if (!isSelectionLayer) {\n            //If there's no RenderingInformation the GridWidget is not visible\n            currentTimeMillis = log(LOGGER, \" - Pre- prepare()\");\n            this.renderingInformation = prepare();\n            log(LOGGER, \" - Post- prepare()\", currentTimeMillis);\n            if (renderingInformation == null) {\n                destroyDOMElementResources();\n                return;\n            }\n            currentTimeMillis = log(LOGGER, \" - Pre- makeRenderingCommands()\");\n            makeRenderingCommands();\n            log(LOGGER, \" - Post- makeRenderingCommands()\", currentTimeMillis);\n        }\n\n        currentTimeMillis = log(LOGGER, \" - Pre- layerRenderGroups()\");\n        layerRenderGroups();\n        log(LOGGER, \" - Post- layerRenderGroups()\", currentTimeMillis);\n\n        currentTimeMillis = log(LOGGER, \" - Pre- executeRenderQueueCommands()\");\n        executeRenderQueueCommands(isSelectionLayer);\n        log(LOGGER, \" - Post- executeRenderQueueCommands()\", currentTimeMillis);\n\n        //Signal columns to free any unused resources\n        if (!isSelectionLayer) {\n            Stream.concat(bodyColumns.stream(),\n                          floatingColumns.stream())\n                    .filter(column -> column instanceof HasMultipleDOMElementResources)\n                    .map(column -> (HasMultipleDOMElementResources) column)\n                    .forEach(HasMultipleDOMElementResources::freeUnusedResources);\n        }\n\n        //Then render to the canvas\n        currentTimeMillis = log(LOGGER, \" - Pre- super.drawWithoutTransforms()\");\n        super.drawWithoutTransforms(context,\n                                    alpha,\n                                    bb);\n        log(LOGGER, \" - Post- super.drawWithoutTransforms()\", currentTimeMillis);\n    }\n\n    private BaseGridRendererHelper.RenderingInformation prepare() {\n        this.body = null;\n        this.header = null;\n        this.floatingBody = null;\n        this.floatingHeader = null;\n        this.bodySelections = null;\n        this.headerSelections = null;\n        this.floatingBodySelections = null;\n        this.floatingHeaderSelections = null;\n        this.boundary = null;\n        this.selection = null;\n        this.allColumns.clear();\n        this.bodyColumns.clear();\n        this.floatingColumns.clear();\n        this.renderQueue.clear();\n\n        //If there's no RenderingInformation the GridWidget is not visible\n        long currentTimeMillis = log(LOGGER, \" - Pre- getRenderingInformation()\");\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n        log(LOGGER, \" - Post- getRenderingInformation()\", currentTimeMillis);\n        if (renderingInformation == null) {\n            return null;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> allColumns = renderingInformation.getAllColumns();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n\n        this.allColumns.addAll(allColumns);\n        this.bodyColumns.addAll(bodyColumns);\n        this.floatingColumns.addAll(floatingColumns);\n\n        return renderingInformation;\n    }\n\n    private void destroyDOMElementResources() {\n        for (GridColumn<?> column : model.getColumns()) {\n            if (column.getColumnRenderer() instanceof HasDOMElementResources) {\n                ((HasDOMElementResources) column.getColumnRenderer()).destroyResources();\n            }\n        }\n    }\n\n    private void makeRenderingCommands() {\n        //Signal columns to attach or detach rendering support\n        for (GridColumn<?> column : model.getColumns()) {\n            if (bodyColumns.contains(column) || floatingColumns.contains(column)) {\n                if (column instanceof HasMultipleDOMElementResources) {\n                    ((HasMultipleDOMElementResources) column).initialiseResources();\n                }\n            } else if (column instanceof HasDOMElementResources) {\n                ((HasDOMElementResources) column).destroyResources();\n            }\n        }\n\n        //Draw if required\n        if (bodyColumns.size() > 0) {\n\n            boundary = new Group();\n\n            drawHeader(renderingInformation);\n\n            if (model.getRowCount() > 0) {\n                drawBody(renderingInformation);\n            }\n        }\n\n        final int minVisibleRowIndex = renderingInformation.getMinVisibleRowIndex();\n        final int maxVisibleRowIndex = renderingInformation.getMaxVisibleRowIndex();\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n\n        if (headerSelections != null) {\n            addCommandToRenderQueue(headerSelections,\n                                    renderSelectedRanges(bodyColumns,\n                                                         bodyBlockInformation.getX(),\n                                                         0,\n                                                         model.getHeaderRowCount(),\n                                                         bodyTransformer,\n                                                         renderingInformation,\n                                                         model.getSelectedHeaderCells(),\n                                                         headerSelectionYOffsetStrategy,\n                                                         headerSelectionHeightStrategy));\n        }\n        if (floatingHeaderSelections != null) {\n            addCommandToRenderQueue(floatingHeaderSelections,\n                                    renderSelectedRanges(floatingColumns,\n                                                         floatingBlockInformation.getX(),\n                                                         0,\n                                                         model.getHeaderRowCount(),\n                                                         floatingColumnsTransformer,\n                                                         renderingInformation,\n                                                         model.getSelectedHeaderCells(),\n                                                         headerSelectionYOffsetStrategy,\n                                                         headerSelectionHeightStrategy));\n        }\n\n        if (bodySelections != null) {\n            addCommandToRenderQueue(bodySelections,\n                                    renderSelectedRanges(bodyColumns,\n                                                         bodyBlockInformation.getX(),\n                                                         minVisibleRowIndex,\n                                                         maxVisibleRowIndex,\n                                                         bodyTransformer,\n                                                         renderingInformation,\n                                                         model.getSelectedCells(),\n                                                         bodySelectionYOffsetStrategy,\n                                                         bodySelectionHeightStrategy));\n        }\n        if (floatingBodySelections != null) {\n            addCommandToRenderQueue(floatingBodySelections,\n                                    renderSelectedRanges(floatingColumns,\n                                                         floatingBlockInformation.getX(),\n                                                         minVisibleRowIndex,\n                                                         maxVisibleRowIndex,\n                                                         floatingColumnsTransformer,\n                                                         renderingInformation,\n                                                         model.getSelectedCells(),\n                                                         bodySelectionYOffsetStrategy,\n                                                         bodySelectionHeightStrategy));\n        }\n        if (boundary != null) {\n            addCommandToRenderQueue(boundary,\n                                    renderGridBoundary(renderingInformation));\n        }\n        if (isSelected) {\n            this.selection = new Group();\n            addCommandToRenderQueue(selection,\n                                    renderer.renderSelector(getWidth(),\n                                                            getHeight(),\n                                                            renderingInformation));\n        }\n    }\n\n    private void layerRenderGroups() {\n        //The order these are added ensures the parts overlap correctly\n        if (body != null) {\n            add(body);\n        }\n        if (bodySelections != null) {\n            add(bodySelections);\n        }\n        if (header != null) {\n            add(header);\n        }\n        if (headerSelections != null) {\n            add(headerSelections);\n        }\n\n        if (floatingBody != null) {\n            add(floatingBody);\n        }\n        if (floatingBodySelections != null) {\n            add(floatingBodySelections);\n        }\n        if (floatingHeader != null) {\n            add(floatingHeader);\n        }\n        if (floatingHeaderSelections != null) {\n            add(floatingHeaderSelections);\n        }\n\n        if (boundary != null) {\n            add(boundary);\n        }\n\n        //Include selection indicator if required\n        if (selection != null) {\n            add(selection);\n        }\n    }\n\n    @Override\n    public Group setVisible(final boolean visible) {\n        if (!visible) {\n            for (GridColumn<?> gc : getModel().getColumns()) {\n                if (gc instanceof HasMultipleDOMElementResources) {\n                    ((HasMultipleDOMElementResources) gc).destroyResources();\n                }\n            }\n        }\n        return super.setVisible(visible);\n    }\n\n    protected void drawHeader(final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final List<GridColumn<?>> allColumns = renderingInformation.getAllColumns();\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n\n        final double headerX = bodyBlockInformation.getX();\n        final double headerY = bodyBlockInformation.getHeaderY();\n        final double floatingHeaderX = floatingBlockInformation.getX();\n        final double floatingHeaderY = floatingBlockInformation.getHeaderY();\n\n        //Add Header, if applicable\n        final boolean addFixedHeader = renderingInformation.isFixedHeader();\n        final boolean addFloatingHeader = renderingInformation.isFloatingHeader();\n\n        if (addFixedHeader || addFloatingHeader) {\n            //Render header for body columns, if required\n            if (bodyColumns.size() > 0) {\n                header = new Group();\n                header.setX(headerX);\n                headerSelections = new Group();\n                headerSelections.setX(headerX).setY(headerY);\n                addCommandsToRenderQueue(header,\n                                         renderGridHeaderWidget(allColumns,\n                                                                bodyColumns,\n                                                                renderingInformation));\n\n                if (addFloatingHeader) {\n                    header.setY(headerY);\n                }\n            }\n\n            //Render header for floating columns, if required\n            if (floatingColumns.size() > 0) {\n                floatingHeader = new Group();\n                floatingHeader.setX(floatingHeaderX).setY(floatingHeaderY);\n                floatingHeaderSelections = new Group();\n                floatingHeaderSelections.setX(floatingHeaderX).setY(floatingHeaderY);\n                addCommandsToRenderQueue(floatingHeader,\n                                         renderGridHeaderWidget(floatingColumns,\n                                                                floatingColumns,\n                                                                renderingInformation));\n            }\n        }\n    }\n\n    protected void drawBody(final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n\n        final double bodyX = bodyBlockInformation.getX();\n        final double bodyY = bodyBlockInformation.getBodyY();\n        final double floatingBodyX = floatingBlockInformation.getX();\n        final double floatingBodyY = floatingBlockInformation.getBodyY();\n\n        final int minVisibleRowIndex = renderingInformation.getMinVisibleRowIndex();\n        final int maxVisibleRowIndex = renderingInformation.getMaxVisibleRowIndex();\n\n        //Render body columns, if required\n        if (bodyColumns.size() > 0) {\n            body = new Group();\n            body.setX(bodyX).setY(bodyY);\n            bodySelections = new Group();\n            bodySelections.setX(bodyX).setY(bodyY);\n\n            addCommandsToRenderQueue(body,\n                                     renderGridBodyWidget(bodyColumns,\n                                                          bodyBlockInformation.getX(),\n                                                          minVisibleRowIndex,\n                                                          maxVisibleRowIndex,\n                                                          bodyTransformer,\n                                                          renderingInformation));\n        }\n\n        //Render floating columns, if required\n        if (floatingColumns.size() > 0) {\n            floatingBody = new Group();\n            floatingBody.setX(floatingBodyX).setY(floatingBodyY);\n            floatingBodySelections = new Group();\n            floatingBodySelections.setX(floatingBodyX).setY(floatingBodyY);\n\n            addCommandsToRenderQueue(floatingBody,\n                                     renderGridBodyWidget(floatingColumns,\n                                                          floatingBlockInformation.getX(),\n                                                          minVisibleRowIndex,\n                                                          maxVisibleRowIndex,\n                                                          floatingColumnsTransformer,\n                                                          renderingInformation));\n        }\n    }\n\n    protected void addCommandToRenderQueue(final Group parent,\n                                           final GridRenderer.RendererCommand command) {\n        addCommandsToRenderQueue(parent, Collections.singletonList(command));\n    }\n\n    protected void addCommandsToRenderQueue(final Group parent,\n                                            final List<GridRenderer.RendererCommand> commands) {\n        renderQueue.add(new AbstractMap.SimpleEntry<>(parent, commands));\n    }\n\n    protected void executeRenderQueueCommands(final boolean isSelectionLayer) {\n        renderQueue.stream()\n                .forEach(p -> p.getValue()\n                        .forEach(c -> c.execute(new GridRenderer.GridRendererContext() {\n                            @Override\n                            public Group getGroup() {\n                                return p.getKey();\n                            }\n\n                            @Override\n                            public boolean isSelectionLayer() {\n                                return isSelectionLayer;\n                            }\n                        })));\n    }\n\n    /**\n     * Render the Widget's Header and append to this Group.\n     * @param allColumns All columns in the model.\n     * @param blockColumns The columns to render for a block.\n     */\n    protected List<GridRenderer.RendererCommand> renderGridHeaderWidget(final List<GridColumn<?>> allColumns,\n                                                                        final List<GridColumn<?>> blockColumns,\n                                                                        final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final GridHeaderRenderContext context = new GridHeaderRenderContext(allColumns,\n                                                                            blockColumns);\n        return renderer.renderHeader(model,\n                                     context,\n                                     rendererHelper,\n                                     renderingInformation);\n    }\n\n    /**\n     * Render the Widget's Body and append to this Group.\n     * @param blockColumns The columns to render.\n     * @param absoluteColumnOffsetX Absolute offset from Grid's X co-ordinate to render first column in block.\n     * @param minVisibleRowIndex The index of the first visible row.\n     * @param maxVisibleRowIndex The index of the last visible row.\n     * @param transformer SelectionTransformer in operation.\n     */\n    protected List<GridRenderer.RendererCommand> renderGridBodyWidget(final List<GridColumn<?>> blockColumns,\n                                                                      final double absoluteColumnOffsetX,\n                                                                      final int minVisibleRowIndex,\n                                                                      final int maxVisibleRowIndex,\n                                                                      final SelectionsTransformer transformer,\n                                                                      final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        final double clipMinY = getComputedLocation().getY() + (header == null ? 0.0 : header.getY() + getRenderer().getHeaderHeight());\n        final double clipMinX = getComputedLocation().getX() + floatingX + floatingWidth;\n        final GridBodyRenderContext context = new GridBodyRenderContext(getComputedLocation().getX(),\n                                                                        getComputedLocation().getY(),\n                                                                        absoluteColumnOffsetX,\n                                                                        clipMinY,\n                                                                        clipMinX,\n                                                                        minVisibleRowIndex,\n                                                                        maxVisibleRowIndex,\n                                                                        blockColumns,\n                                                                        getViewport().getTransform(),\n                                                                        renderer,\n                                                                        transformer);\n        return renderer.renderBody(model,\n                                   context,\n                                   rendererHelper,\n                                   renderingInformation);\n    }\n\n    /**\n     * Render the selected ranges and append to the Body Group.\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @return A Group containing the boundary.\n     */\n    protected GridRenderer.RendererCommand renderGridBoundary(final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        double x = 0;\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n\n        if (body != null || header != null) {\n            allColumns.addAll(bodyColumns);\n            x = bodyBlockInformation.getX();\n        }\n        if (floatingBody != null || floatingHeader != null) {\n            allColumns.addAll(floatingColumns);\n            x = floatingBlockInformation.getX();\n        }\n        final double headerYOffset = (header == null ? 0.0 : header.getY());\n        final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n        final double y = headerRowsYOffset + headerYOffset;\n\n        final double height = getHeight(renderingInformation) - headerRowsYOffset - headerYOffset;\n        double width = rendererHelper.getWidth(allColumns);\n        if (!floatingColumns.isEmpty()) {\n            width = width - (floatingBlockInformation.getX() + rendererHelper.getWidth(floatingColumns) - bodyBlockInformation.getX());\n        }\n\n        final GridBoundaryRenderContext context = new GridBoundaryRenderContext(x,\n                                                                                y,\n                                                                                width,\n                                                                                height);\n\n        return renderer.renderGridBoundary(context);\n    }\n\n    /**\n     * Render the selected ranges and append to the Body Group.\n     * @param blockColumns The columns to render.\n     * @param absoluteColumnOffsetX Absolute offset from Grid's X co-ordinate to render first column in block.\n     * @param minVisibleRowIndex The index of the first visible row.\n     * @param maxVisibleRowIndex The index of the last visible row.\n     * @param transformer SelectionTransformer in operation.\n     * @return\n     */\n    protected GridRenderer.RendererCommand renderSelectedRanges(final List<GridColumn<?>> blockColumns,\n                                                                final double absoluteColumnOffsetX,\n                                                                final int minVisibleRowIndex,\n                                                                final int maxVisibleRowIndex,\n                                                                final SelectionsTransformer transformer,\n                                                                final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                                final List<GridData.SelectedCell> selectedCells,\n                                                                final BiFunction<SelectedRange, Integer, Double> selectedCellsYOffsetStrategy,\n                                                                final Function<SelectedRange, Double> selectedCellsHeightStrategy) {\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        final double clipMinY = getComputedLocation().getY() + (header == null ? 0.0 : header.getY() + getRenderer().getHeaderHeight());\n        final double clipMinX = getComputedLocation().getX() + floatingX + floatingWidth;\n        final GridBodyRenderContext context = new GridBodyRenderContext(getComputedLocation().getX(),\n                                                                        getComputedLocation().getY(),\n                                                                        absoluteColumnOffsetX,\n                                                                        clipMinY,\n                                                                        clipMinX,\n                                                                        minVisibleRowIndex,\n                                                                        maxVisibleRowIndex,\n                                                                        blockColumns,\n                                                                        getViewport().getTransform(),\n                                                                        renderer,\n                                                                        transformer);\n        return renderer.renderSelectedCells(model,\n                                            context,\n                                            rendererHelper,\n                                            selectedCells,\n                                            selectedCellsYOffsetStrategy,\n                                            selectedCellsHeightStrategy);\n    }\n\n    @Override\n    public void onNodeMouseClick(final NodeMouseClickEvent event) {\n        fireEvent(event);\n    }\n\n    @Override\n    public boolean onGroupingToggle(final double cellX,\n                                    final double cellY,\n                                    final double cellWidth,\n                                    final double cellHeight) {\n        return renderer.onGroupingToggle(cellX,\n                                         cellY,\n                                         cellWidth,\n                                         cellHeight);\n    }\n\n    @Override\n    public boolean selectCell(final Point2D rp,\n                              final boolean isShiftKeyDown,\n                              final boolean isControlKeyDown) {\n        return cellSelectionManager.selectCell(rp,\n                                               isShiftKeyDown,\n                                               isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectCell(final int uiRowIndex,\n                              final int uiColumnIndex,\n                              final boolean isShiftKeyDown,\n                              final boolean isControlKeyDown) {\n        return cellSelectionManager.selectCell(uiRowIndex,\n                                               uiColumnIndex,\n                                               isShiftKeyDown,\n                                               isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectHeaderCell(final Point2D rp,\n                                    final boolean isShiftKeyDown,\n                                    final boolean isControlKeyDown) {\n        return cellSelectionManager.selectHeaderCell(rp,\n                                                     isShiftKeyDown,\n                                                     isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectHeaderCell(final int uiHeaderRowIndex,\n                                    final int uiHeaderColumnIndex,\n                                    final boolean isShiftKeyDown,\n                                    final boolean isControlKeyDown) {\n        return cellSelectionManager.selectHeaderCell(uiHeaderRowIndex,\n                                                     uiHeaderColumnIndex,\n                                                     isShiftKeyDown,\n                                                     isControlKeyDown);\n    }\n\n    @Override\n    public boolean adjustSelection(final SelectionExtension direction,\n                                   final boolean isShiftKeyDown) {\n        return cellSelectionManager.adjustSelection(direction,\n                                                    isShiftKeyDown);\n    }\n\n    @Override\n    public boolean startEditingCell(final int uiRowIndex,\n                                    final int uiColumnIndex) {\n        return cellSelectionManager.startEditingCell(uiRowIndex,\n                                                     uiColumnIndex);\n    }\n\n    @Override\n    public boolean startEditingCell(final Point2D rp) {\n        return cellSelectionManager.startEditingCell(rp);\n    }\n\n    @Override\n    public boolean showContextMenuForHeader(final int uiHeaderRowIndex,\n                                            final int uiHeaderColumnIndex) {\n        // no operation by default\n        return false;\n    }\n\n    @Override\n    public boolean showContextMenuForCell(final int uiRowIndex,\n                                          final int uiColumnIndex) {\n        // no operation by default\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetKeyboardHandler.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.HashSet;\nimport java.util.Objects;\nimport java.util.Set;\n\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.HasDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.KeyboardOperation.TriStateBoolean;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\n/**\n * KeyDownHandler for keyboard operations. Keyboard operations supported:\n * <ul>\n * <li>Clearing cell content with the DELETE key</li>\n * <li>Edit a cell content with the ENTER key</li>\n * <li>Keyboard navigation with the CURSOR keys</li>\n * <li>Move to top-left cell with HOME key</li>\n * <li>Move to bottom-right cell with END key</li>\n * </ul>\n * All operations keep the selection origin in view, i.e. the @{link Viewport} is\n * translated to keep the cell in view if necessary.\n */\npublic class BaseGridWidgetKeyboardHandler implements KeyDownHandler {\n\n    protected GridLayer gridLayer;\n\n    private Set<KeyboardOperation> operations = new HashSet<>();\n\n    public BaseGridWidgetKeyboardHandler(final GridLayer gridLayer) {\n        this.gridLayer = Objects.requireNonNull(gridLayer, \"gridLayer\");\n    }\n\n    public void addOperation(final KeyboardOperation... operations) {\n        for (KeyboardOperation operation : operations) {\n            this.operations.add(Objects.requireNonNull(operation, \"operation\"));\n        }\n    }\n\n    @Override\n    public void onKeyDown(final KeyDownEvent event) {\n        final GridWidget selectedGridWidget = getSelectedGridWidget();\n        if (selectedGridWidget == null) {\n            return;\n        }\n\n        final KeyboardOperation operation = getOperation(event);\n        if (operation == null) {\n            return;\n        }\n\n        if (!operation.isExecutable(selectedGridWidget)) {\n            return;\n        }\n\n        flushDOMElements(selectedGridWidget);\n\n        final boolean redraw = operation.perform(selectedGridWidget,\n                                                 event.isShiftKeyDown(),\n                                                 event.isControlKeyDown());\n\n        event.preventDefault();\n        event.stopPropagation();\n\n        if (redraw) {\n            gridLayer.draw();\n        }\n    }\n\n    private KeyboardOperation getOperation(final KeyDownEvent event) {\n        final int keyCode = event.getNativeKeyCode();\n        final boolean isShiftKeyDown = event.isShiftKeyDown();\n        final boolean isControlKeyDown = event.isControlKeyDown();\n        for (KeyboardOperation operation : operations) {\n            if (operation.getKeyCode() == keyCode) {\n                if (keyDownStateMatches(isShiftKeyDown,\n                                        operation.isShiftKeyDown()) && keyDownStateMatches(isControlKeyDown,\n                                                                                           operation.isControlKeyDown())) {\n                    return operation;\n                }\n            }\n        }\n        return null;\n    }\n\n    private boolean keyDownStateMatches(final boolean actualKeyDownState,\n                                        final TriStateBoolean requiredKeyDownState) {\n        if (actualKeyDownState && (requiredKeyDownState == TriStateBoolean.TRUE || requiredKeyDownState == TriStateBoolean.DONT_CARE)) {\n            return true;\n        }\n        if (!actualKeyDownState && (requiredKeyDownState == TriStateBoolean.FALSE || requiredKeyDownState == TriStateBoolean.DONT_CARE)) {\n            return true;\n        }\n        return false;\n    }\n\n    private void flushDOMElements(final GridWidget selectedGridWidget) {\n        final GridData gridModel = selectedGridWidget.getModel();\n        for (GridColumn<?> column : gridModel.getColumns()) {\n            if (column instanceof HasSingletonDOMElementResource) {\n                ((HasSingletonDOMElementResource) column).flush();\n            }\n            if (column instanceof HasDOMElementResources) {\n                ((HasDOMElementResources) column).destroyResources();\n            }\n        }\n    }\n\n    private GridWidget getSelectedGridWidget() {\n        for (GridWidget gridWidget : gridLayer.getGridWidgets()) {\n            if (gridWidget.isSelected()) {\n                return gridWidget;\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetMouseClickHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\n\n/**\n * Base {@link NodeMouseClickHandler} to handle clicks to either the GridWidgets Header or Body.\n * This delegates event handling to the {@link NodeMouseEventHandler} provided in the {@link List}\n * parameter of the constructor. Delegation follows the order of {@link NodeMouseEventHandler} in the {@link List}.\n */\npublic class BaseGridWidgetMouseClickHandler extends BaseGridWidgetMouseEventHandler implements NodeMouseClickHandler {\n\n    public BaseGridWidgetMouseClickHandler(final GridWidget gridWidget,\n                                           final List<NodeMouseEventHandler> handlers) {\n        super(gridWidget,\n              handlers);\n    }\n\n    @Override\n    public void onNodeMouseClick(final NodeMouseClickEvent event) {\n        doEventDispatch(event);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetMouseDoubleClickHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\n\n/**\n * Base {@link NodeMouseDoubleClickHandler} to handle double-clicks to either the GridWidgets Header\n * or Body. This delegates event handling to the {@link NodeMouseEventHandler} provided in the {@link List}\n * parameter of the constructor. Delegation follows the order of {@link NodeMouseEventHandler} in the {@link List}.\n */\npublic class BaseGridWidgetMouseDoubleClickHandler extends BaseGridWidgetMouseEventHandler implements NodeMouseDoubleClickHandler {\n\n    public BaseGridWidgetMouseDoubleClickHandler(final GridWidget gridWidget,\n                                                 final List<NodeMouseEventHandler> handlers) {\n        super(gridWidget,\n              handlers);\n    }\n\n    @Override\n    public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent event) {\n        doEventDispatch(event);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.util.CoordinateUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\n\n/**\n * Base {@link AbstractNodeMouseEvent} handler that delegates handling of events to registered delegates.\n */\npublic abstract class BaseGridWidgetMouseEventHandler {\n\n    protected GridWidget gridWidget;\n    protected List<NodeMouseEventHandler> handlers;\n\n    public BaseGridWidgetMouseEventHandler(final GridWidget gridWidget,\n                                           final List<NodeMouseEventHandler> handlers) {\n        this.gridWidget = gridWidget;\n        this.handlers = handlers;\n    }\n\n    public void doEventDispatch(final AbstractNodeMouseEvent event) {\n        if (!gridWidget.isVisible()) {\n            return;\n        }\n        //Convert Canvas co-ordinate to Grid co-ordinate\n        final Point2D relativeLocation = CoordinateUtilities.convertDOMToGridCoordinate(gridWidget,\n                                                                                        new Point2D(event.getX(),\n                                                                                                    event.getY()));\n\n        //Extract Header row and column indexes\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(gridWidget,\n                                                                                 relativeLocation);\n        final Integer uiHeaderColumnIndex = CoordinateUtilities.getUiColumnIndex(gridWidget,\n                                                                                 relativeLocation.getX());\n\n        //Extract Body row and column indexes\n        final Integer uiRowIndex = CoordinateUtilities.getUiRowIndex(gridWidget,\n                                                                     relativeLocation.getY());\n        final Integer uiColumnIndex = CoordinateUtilities.getUiColumnIndex(gridWidget,\n                                                                           relativeLocation.getX());\n\n        handlers.stream().forEach(handler -> handler.onNodeMouseEvent(gridWidget,\n                                                                      relativeLocation,\n                                                                      Optional.ofNullable(uiHeaderRowIndex),\n                                                                      Optional.ofNullable(uiHeaderColumnIndex),\n                                                                      Optional.ofNullable(uiRowIndex),\n                                                                      Optional.ofNullable(uiColumnIndex),\n                                                                      event));\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseKeyboardOperation.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\nimport java.util.Objects;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingBlockInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static com.google.gwt.event.dom.client.KeyCodes.KEY_RIGHT;\n\npublic abstract class BaseKeyboardOperation implements KeyboardOperation {\n\n    protected GridLayer gridLayer;\n\n    public BaseKeyboardOperation(final GridLayer gridLayer) {\n        this.gridLayer = Objects.requireNonNull(gridLayer, \"gridLayer\");\n    }\n\n    @Override\n    public TriStateBoolean isShiftKeyDown() {\n        return TriStateBoolean.DONT_CARE;\n    }\n\n    @Override\n    public TriStateBoolean isControlKeyDown() {\n        return TriStateBoolean.DONT_CARE;\n    }\n\n    @Override\n    public boolean isExecutable(final GridWidget gridWidget) {\n        final GridData gridModel = gridWidget.getModel();\n        final int rowCount = gridModel.getRowCount();\n        final int columnCount = gridModel.getColumnCount();\n        if (rowCount == 0 || columnCount == 0) {\n            return false;\n        } else {\n            return true;\n        }\n    }\n\n    protected boolean scrollSelectedCellIntoView(final GridWidget gridWidget) {\n        if (!isSelectionOriginSet(gridWidget) && !isHeaderSelectionOriginSet(gridWidget)) {\n            return false;\n        }\n\n        boolean isHeaderCellSelected = false;\n        if (!isSelectionOriginSet(gridWidget) && isHeaderSelectionOriginSet(gridWidget)) {\n            isHeaderCellSelected = true;\n        }\n\n        if (!isGridColumnCandidateForScroll(gridWidget,\n                                            isHeaderCellSelected)) {\n            return false;\n        }\n\n        final double dx = getCellScrollDeltaX(gridWidget, isHeaderCellSelected);\n        final double dy = getCellScrollDeltaY(gridWidget, isHeaderCellSelected);\n\n        if (dx != 0 || dy != 0) {\n            adjustViewportTransform(gridLayer.getViewport(),\n                                    new Point2D(dx,\n                                                dy));\n        }\n        return true;\n    }\n\n    private boolean isSelectionOriginSet(final GridWidget selectedGridWidget) {\n        final GridData gridModel = selectedGridWidget.getModel();\n        final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();\n        return origin != null;\n    }\n\n    private boolean isHeaderSelectionOriginSet(final GridWidget selectedGridWidget) {\n        final GridData gridModel = selectedGridWidget.getModel();\n        return !gridModel.getSelectedHeaderCells().isEmpty();\n    }\n\n    private boolean isGridColumnCandidateForScroll(final GridWidget gridWidget,\n                                                   final boolean isHeaderCellSelected) {\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        final RenderingInformation renderingInformation = rendererHelper.getRenderingInformation();\n\n        if (Objects.isNull(renderingInformation)) {\n            return false;\n        }\n\n        final GridData gridModel = gridWidget.getModel();\n\n        final List<GridColumn<?>> columns = gridModel.getColumns();\n        final GridData.SelectedCell origin = getSelectedCellOrigin(gridModel, isHeaderCellSelected);\n        final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                                         origin.getColumnIndex());\n\n        final RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n        final GridColumn<?> column = columns.get(uiColumnIndex);\n\n        return !floatingColumns.contains(column);\n    }\n\n    private double getCellScrollDeltaX(final GridWidget gridWidget, final boolean isHeaderCellSelected) {\n        final GridData gridModel = gridWidget.getModel();\n        final List<GridColumn<?>> columns = gridModel.getColumns();\n        final GridData.SelectedCell origin = getSelectedCellOrigin(gridModel, isHeaderCellSelected);\n        final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                                         origin.getColumnIndex());\n\n        double dx = 0;\n        final Bounds bounds = gridLayer.getVisibleBounds();\n        final double columnWidth = columns.get(uiColumnIndex).getWidth();\n        final double gridCellX = gridWidget.getX() + gridWidget.getRendererHelper().getColumnOffset(uiColumnIndex);\n\n        if (gridCellX + columnWidth >= bounds.getX() + bounds.getWidth()) {\n            dx = bounds.getX() + bounds.getWidth() - gridCellX - columnWidth;\n        } else if (gridCellX <= bounds.getX()) {\n            dx = bounds.getX() - gridCellX;\n        }\n\n        return dx;\n    }\n\n    private double getCellScrollDeltaY(final GridWidget gridWidget, final boolean isHeaderCellSelected) {\n        final GridData gridModel = gridWidget.getModel();\n        final GridData.SelectedCell origin = getSelectedCellOrigin(gridModel, isHeaderCellSelected);\n        final int uiRowIndex = origin.getRowIndex();\n\n        double dy = 0;\n        final Bounds bounds = gridLayer.getVisibleBounds();\n        final int headerRowCount = gridModel.getHeaderRowCount();\n        final double headerHeight = gridWidget.getRenderer().getHeaderHeight();\n        final double rowHeight = isHeaderCellSelected ? gridWidget.getRenderer().getHeaderRowHeight() : gridModel.getRow(uiRowIndex).getHeight();\n        final double headerYOffset = isHeaderCellSelected ? headerHeight - headerRowCount * rowHeight : headerHeight;\n        final double rowOffset = isHeaderCellSelected ? rowHeight * uiRowIndex : gridWidget.getRendererHelper().getRowOffset(uiRowIndex);\n        final double gridCellY = gridWidget.getY() + headerYOffset + rowOffset;\n\n        if (gridCellY + rowHeight >= bounds.getY() + bounds.getHeight()) {\n            dy = bounds.getY() + bounds.getHeight() - gridCellY - rowHeight;\n        } else if (gridCellY <= bounds.getY() + headerYOffset) {\n            dy = bounds.getY() + headerYOffset - gridCellY;\n        }\n\n        return dy;\n    }\n\n    /**\n     * It retrieves the selected cell in <code>GridData</code> model, which could be an <b>header</b> cell or a\n     * simple one. In case of an <b>header</b> cell, it manages a possible case where a cell is spanned over multiple\n     * columns: when pressing <code>KEY_RIGHT</code>, it selected the last cell of the selected header cells group in\n     * order to show all the spanned cell. The otherwise in all other cases\n     * @param gridModel\n     * @param isHeaderCellSelected\n     * @return\n     */\n    protected GridData.SelectedCell getSelectedCellOrigin(final GridData gridModel, final boolean isHeaderCellSelected) {\n        if (isHeaderCellSelected) {\n            List<GridData.SelectedCell> selectedHeaderCells = gridModel.getSelectedHeaderCells();\n            if (KEY_RIGHT == getKeyCode()) {\n                return selectedHeaderCells.get(selectedHeaderCells.size() - 1);\n            } else {\n                return selectedHeaderCells.get(0);\n            }\n        } else {\n            return gridModel.getSelectedCellsOrigin();\n        }\n    }\n\n    private void adjustViewportTransform(final Viewport vp,\n                                         final Point2D delta) {\n        final Transform transform = vp.getTransform();\n        final Transform t = transform.copy().getInverse();\n        final Point2D translation = new Point2D(t.getTranslateX(),\n                                                t.getTranslateY()).mul(-1.0);\n\n        final double scaleX = transform.getScaleX();\n        final double scaleY = transform.getScaleY();\n        transform.reset();\n\n        final Point2D frameLocation = translation.add(delta);\n        transform.scale(scaleX,\n                        scaleY).translate(frameLocation.getX(),\n                                          frameLocation.getY());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetCellSelectorMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\n\n/**\n * A {@link NodeMouseEventHandler} to handle selection of cells.\n */\npublic class DefaultGridWidgetCellSelectorMouseEventHandler implements NodeMouseEventHandler {\n\n    protected GridSelectionManager selectionManager;\n\n    public DefaultGridWidgetCellSelectorMouseEventHandler(final GridSelectionManager selectionManager) {\n        this.selectionManager = selectionManager;\n    }\n\n    @Override\n    public boolean onNodeMouseEvent(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final Optional<Integer> uiHeaderRowIndex,\n                                    final Optional<Integer> uiHeaderColumnIndex,\n                                    final Optional<Integer> uiRowIndex,\n                                    final Optional<Integer> uiColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        if (isDNDOperationInProgress(gridWidget)) {\n            return false;\n        }\n\n        boolean isHandled = false;\n        if (uiHeaderRowIndex.isPresent() && uiHeaderColumnIndex.isPresent()) {\n            isHandled = handleHeaderCell(gridWidget,\n                                         relativeLocation,\n                                         uiHeaderRowIndex.get(),\n                                         uiHeaderColumnIndex.get(),\n                                         event);\n        }\n        if (!isHandled && uiRowIndex.isPresent() && uiColumnIndex.isPresent()) {\n            isHandled = handleBodyCell(gridWidget,\n                                       relativeLocation,\n                                       uiRowIndex.get(),\n                                       uiColumnIndex.get(),\n                                       event);\n        }\n        if (isHandled) {\n            if (!gridWidget.isSelected()) {\n                selectionManager.select(gridWidget);\n            }\n        }\n\n        return isHandled;\n    }\n\n    /**\n     * Select header cells.\n     */\n    @Override\n    public boolean handleHeaderCell(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final int uiHeaderRowIndex,\n                                    final int uiHeaderColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        final boolean isHandled = gridWidget.selectHeaderCell(relativeLocation,\n                                                              event.isShiftKeyDown(),\n                                                              event.isControlKeyDown());\n        if (isHandled) {\n            gridWidget.getLayer().batch();\n        }\n        return isHandled;\n    }\n\n    /**\n     * Select body cells.\n     */\n    @Override\n    public boolean handleBodyCell(final GridWidget gridWidget,\n                                  final Point2D relativeLocation,\n                                  final int uiRowIndex,\n                                  final int uiColumnIndex,\n                                  final AbstractNodeMouseEvent event) {\n        final boolean isHandled = gridWidget.selectCell(relativeLocation,\n                                                        event.isShiftKeyDown(),\n                                                        event.isControlKeyDown());\n\n        if (isHandled) {\n            gridWidget.getLayer().batch();\n        }\n        return isHandled;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetCollapsedCellMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.animation.MergableGridWidgetCollapseRowsAnimation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.animation.MergableGridWidgetExpandRowsAnimation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\n/**\n * A {@link NodeMouseEventHandler} to handle interaction with a \"merged\" {@link GridCell} \"hot spot\". The\n * {@link AbstractNodeMouseEvent} is checked to have happened over the {@link GridWidget#onGroupingToggle(double, double, double, double)}\n * in which case the applicable {@link GridRow}(s) are either collapsed or expanded; depending on their state.\n */\npublic class DefaultGridWidgetCollapsedCellMouseEventHandler implements NodeMouseEventHandler {\n\n    protected GridRenderer renderer;\n\n    public DefaultGridWidgetCollapsedCellMouseEventHandler(final GridRenderer renderer) {\n        this.renderer = renderer;\n    }\n\n    @Override\n    public boolean onNodeMouseEvent(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final Optional<Integer> uiHeaderRowIndex,\n                                    final Optional<Integer> uiHeaderColumnIndex,\n                                    final Optional<Integer> uiRowIndex,\n                                    final Optional<Integer> uiColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        if (isDNDOperationInProgress(gridWidget)) {\n            return false;\n        }\n\n        boolean isHandled = false;\n        if (uiRowIndex.isPresent() && uiColumnIndex.isPresent()) {\n            isHandled = handleBodyCell(gridWidget,\n                                       relativeLocation,\n                                       uiRowIndex.get(),\n                                       uiColumnIndex.get(),\n                                       event);\n        }\n\n        return isHandled;\n    }\n\n    @Override\n    public boolean handleBodyCell(final GridWidget gridWidget,\n                                  final Point2D relativeLocation,\n                                  final int uiRowIndex,\n                                  final int uiColumnIndex,\n                                  final AbstractNodeMouseEvent event) {\n        final GridData gridData = gridWidget.getModel();\n        final List<GridColumn<?>> gridColumns = gridData.getColumns();\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n\n        //Check if the cell can be Grouped\n        final GridCell<?> cell = gridData.getCell(uiRowIndex,\n                                                  uiColumnIndex);\n        if (cell == null) {\n            return false;\n        }\n        if (cell.getMergedCellCount() < 2) {\n            return false;\n        }\n\n        //Check if the Grouping control has been clicked\n        final double cy = relativeLocation.getY();\n        final double cx = relativeLocation.getX();\n        final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);\n        final double offsetX = ci.getOffsetX();\n\n        final GridRow gridRow = gridData.getRow(uiRowIndex);\n        final GridColumn<?> gridColumn = gridColumns.get(uiColumnIndex);\n        final GridCell<?> nextRowCell = gridData.getCell(uiRowIndex + 1,\n                                                         uiColumnIndex);\n        final double cellX = cx - offsetX;\n        final double cellY = cy - rendererHelper.getRowOffset(uiRowIndex) - renderer.getHeaderHeight();\n        if (!gridWidget.onGroupingToggle(cellX,\n                                         cellY,\n                                         gridColumn.getWidth(),\n                                         gridRow.getHeight())) {\n            return false;\n        }\n\n        //Collapse or expand rows as needed\n        if (!nextRowCell.isCollapsed()) {\n            collapseRows(gridWidget,\n                         uiRowIndex,\n                         uiColumnIndex,\n                         cell.getMergedCellCount());\n        } else {\n            expandRows(gridWidget,\n                       uiRowIndex,\n                       uiColumnIndex,\n                       cell.getMergedCellCount());\n        }\n\n        return true;\n    }\n\n    void collapseRows(final GridWidget gridWidget,\n                      final int uiRowIndex,\n                      final int uiColumnIndex,\n                      final int rowCount) {\n        final MergableGridWidgetCollapseRowsAnimation a = new MergableGridWidgetCollapseRowsAnimation(gridWidget,\n                                                                                                      uiRowIndex,\n                                                                                                      uiColumnIndex,\n                                                                                                      rowCount);\n        a.run();\n    }\n\n    void expandRows(final GridWidget gridWidget,\n                    final int uiRowIndex,\n                    final int uiColumnIndex,\n                    final int rowCount) {\n        final MergableGridWidgetExpandRowsAnimation a = new MergableGridWidgetExpandRowsAnimation(gridWidget,\n                                                                                                  uiRowIndex,\n                                                                                                  uiColumnIndex,\n                                                                                                  rowCount);\n        a.run();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetEditCellMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Objects;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\n\n/**\n * A {@link NodeMouseEventHandler} to handle editing of cells.\n */\npublic class DefaultGridWidgetEditCellMouseEventHandler implements NodeMouseEventHandler {\n\n    @Override\n    public boolean onNodeMouseEvent(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final Optional<Integer> uiHeaderRowIndex,\n                                    final Optional<Integer> uiHeaderColumnIndex,\n                                    final Optional<Integer> uiRowIndex,\n                                    final Optional<Integer> uiColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        if (isDNDOperationInProgress(gridWidget)) {\n            return false;\n        }\n\n        boolean isHandled = false;\n        if (uiHeaderRowIndex.isPresent() && uiHeaderColumnIndex.isPresent()) {\n            isHandled = handleHeaderCell(gridWidget,\n                                         relativeLocation,\n                                         uiHeaderRowIndex.get(),\n                                         uiHeaderColumnIndex.get(),\n                                         event);\n        }\n        if (!isHandled && uiRowIndex.isPresent() && uiColumnIndex.isPresent()) {\n            isHandled = handleBodyCell(gridWidget,\n                                       relativeLocation,\n                                       uiRowIndex.get(),\n                                       uiColumnIndex.get(),\n                                       event);\n        }\n\n        return isHandled;\n    }\n\n    /**\n     * Checks if a {@link AbstractNodeMouseEvent} happened within a {@link GridCell}. If the\n     * {@link AbstractNodeMouseEvent} is found to have happened within a cell, the {@link GridCell#getSupportedEditAction()}\n     * is checked to {@link Object#equals(Object)} that for the {@link AbstractNodeMouseEvent}. If they equal then the\n     * {@link GridCell} is put into \"edit\" mode via {@link GridWidget#startEditingCell(Point2D)}.\n     */\n    @Override\n    public boolean handleBodyCell(final GridWidget gridWidget,\n                                  final Point2D relativeLocation,\n                                  final int uiRowIndex,\n                                  final int uiColumnIndex,\n                                  final AbstractNodeMouseEvent event) {\n        final GridData gridData = gridWidget.getModel();\n        if (gridData.getSelectedCells().size() == 1) {\n            final GridCell<?> cell = gridData.getCell(uiRowIndex, uiColumnIndex);\n            final GridCellEditAction cellEditAction = cell == null ? GridCell.DEFAULT_EDIT_ACTION : cell.getSupportedEditAction();\n            if (Objects.equals(cellEditAction, GridCellEditAction.getSupportedEditAction(event))) {\n                return gridWidget.startEditingCell(relativeLocation);\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetLinkedColumnMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\n\n/**\n * A {@link NodeMouseEventHandler} to handle interaction with a \"linked\"\n * {@link GridColumn} in the Header and delegating a response to the {@link GridSelectionManager}.\n */\npublic class DefaultGridWidgetLinkedColumnMouseEventHandler implements NodeMouseEventHandler {\n\n    protected GridSelectionManager selectionManager;\n    protected GridRenderer renderer;\n\n    public DefaultGridWidgetLinkedColumnMouseEventHandler(final GridSelectionManager selectionManager,\n                                                          final GridRenderer renderer) {\n        this.selectionManager = selectionManager;\n        this.renderer = renderer;\n    }\n\n    @Override\n    public boolean onNodeMouseEvent(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final Optional<Integer> uiHeaderRowIndex,\n                                    final Optional<Integer> uiHeaderColumnIndex,\n                                    final Optional<Integer> uiRowIndex,\n                                    final Optional<Integer> uiColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        if (isDNDOperationInProgress(gridWidget)) {\n            return false;\n        }\n\n        boolean isHandled = false;\n        if (uiHeaderRowIndex.isPresent() && uiHeaderColumnIndex.isPresent()) {\n            isHandled = handleHeaderCell(gridWidget,\n                                         relativeLocation,\n                                         uiHeaderRowIndex.get(),\n                                         uiHeaderColumnIndex.get(),\n                                         event);\n        }\n\n        return isHandled;\n    }\n\n    /**\n     * Checks if the {@link AbstractNodeMouseEvent} happened on a \"linked\" {@link GridColumn}. If\n     * the {@link AbstractNodeMouseEvent} was found to have happened on a {@link GridWidget} \"linked\" column then\n     * selection of the \"linked\" {@link GridColumn} is delegated to {@link GridSelectionManager#selectLinkedColumn(GridColumn)}.\n     */\n    @Override\n    public boolean handleHeaderCell(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final int uiHeaderRowIndex,\n                                    final int uiHeaderColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n\n        final double cx = relativeLocation.getX();\n        final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(cx);\n        final GridColumn<?> column = ci.getColumn();\n        if (column == null) {\n            return false;\n        }\n\n        //If linked scroll it into view\n        if (column.isLinked()) {\n            final GridColumn<?> link = column.getLink();\n            selectionManager.selectLinkedColumn(link);\n            return true;\n        }\n\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetPinnedModeMouseEventHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\n/**\n * A {@link NodeMouseEventHandler} to handle entering or exiting of a {@link GridWidget}\n * \"pinned\" state. If a {@link AbstractNodeMouseEvent} is found to have happened within the {@link GridWidget}\n * Header the \"pinned\" mode is toggled. See {@link GridPinnedModeManager} for more information.\n */\npublic class DefaultGridWidgetPinnedModeMouseEventHandler implements NodeMouseEventHandler {\n\n    protected GridPinnedModeManager pinnedModeManager;\n    protected GridRenderer renderer;\n\n    public DefaultGridWidgetPinnedModeMouseEventHandler(final GridPinnedModeManager pinnedModeManager,\n                                                        final GridRenderer renderer) {\n        this.pinnedModeManager = pinnedModeManager;\n        this.renderer = renderer;\n    }\n\n    @Override\n    public boolean onNodeMouseEvent(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final Optional<Integer> uiHeaderRowIndex,\n                                    final Optional<Integer> uiHeaderColumnIndex,\n                                    final Optional<Integer> uiRowIndex,\n                                    final Optional<Integer> uiColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        if (isDNDOperationInProgress(gridWidget)) {\n            return false;\n        }\n\n        boolean isHandled = false;\n        if (uiHeaderRowIndex.isPresent() && uiHeaderColumnIndex.isPresent()) {\n            isHandled = handleHeaderCell(gridWidget,\n                                         relativeLocation,\n                                         uiHeaderRowIndex.get(),\n                                         uiHeaderColumnIndex.get(),\n                                         event);\n        }\n\n        return isHandled;\n    }\n\n    /**\n     * Checks if a {@link AbstractNodeMouseEvent} is found to have happened within the {@link GridWidget}\n     * Header. If the {@link AbstractNodeMouseEvent} was found to have happened in the {@link GridWidget} Header\n     * the \"pinned\" mode is toggled. See {@link GridPinnedModeManager} for more information.\n     */\n    @Override\n    public boolean handleHeaderCell(final GridWidget gridWidget,\n                                    final Point2D relativeLocation,\n                                    final int uiHeaderRowIndex,\n                                    final int uiHeaderColumnIndex,\n                                    final AbstractNodeMouseEvent event) {\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n\n        final double cx = relativeLocation.getX();\n        final double cy = relativeLocation.getY();\n\n        final Group header = gridWidget.getHeader();\n        final BaseGridRendererHelper.RenderingInformation ri = rendererHelper.getRenderingInformation();\n        final double headerRowsYOffset = ri.getHeaderRowsYOffset();\n        final double headerMinY = (header == null ? headerRowsYOffset : header.getY() + headerRowsYOffset);\n        final double headerMaxY = (header == null ? renderer.getHeaderHeight() : renderer.getHeaderHeight() + header.getY());\n\n        if (cx < 0 || cx > gridWidget.getWidth()) {\n            return false;\n        }\n        if (cy < headerMinY || cy > headerMaxY) {\n            return false;\n        }\n\n        if (!pinnedModeManager.isGridPinned()) {\n            pinnedModeManager.enterPinnedMode(gridWidget,\n                                              () -> {/*Nothing*/});\n        } else {\n            pinnedModeManager.exitPinnedMode(() -> {/*Nothing*/});\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/GridWidgetConnector.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\n\n/**\n * Meta-data for a Connector between two \"linked\" GridWidgets.\n */\npublic class GridWidgetConnector {\n\n    private GridColumn<?> sourceColumn;\n    private GridColumn<?> targetColumn;\n\n    public GridWidgetConnector(final GridColumn<?> sourceColumn,\n                               final GridColumn<?> targetColumn) {\n        this.sourceColumn = sourceColumn;\n        this.targetColumn = targetColumn;\n    }\n\n    /**\n     * Get the source Column from which the Connector originates.\n     * @return\n     */\n    public GridColumn<?> getSourceColumn() {\n        return sourceColumn;\n    }\n\n    /**\n     * Get the target Column to which the Connector terminates.\n     * @return\n     */\n    public GridColumn<?> getTargetColumn() {\n        return targetColumn;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        GridWidgetConnector connector = (GridWidgetConnector) o;\n\n        if (!sourceColumn.equals(connector.sourceColumn)) {\n            return false;\n        }\n        if (!targetColumn.equals(connector.targetColumn)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = sourceColumn.hashCode();\n        result = ~~result;\n        result = 31 * result + targetColumn.hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperation.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * Defines a keyboard based operation.\n */\npublic interface KeyboardOperation {\n\n    /**\n     * Gets the @{link com.google.gwt.event.dom.client.KeyCodes} that this operation matches.\n     * @return A key code.\n     */\n    int getKeyCode();\n\n    /**\n     * Gets the shift-key state that this operation matches.\n     * @return true if the shift-key is down.\n     */\n    TriStateBoolean isShiftKeyDown();\n\n    /**\n     * Gets the control-key state that this operation matches.\n     * @return true if the control-key is down.\n     */\n    TriStateBoolean isControlKeyDown();\n\n    /**\n     * Decides about @link{GridWidget} state for execution of the operation.\n     * By implementing this @link(BaseGridWidgetKeyboardHandler}\n     * will know which registered operations can be executed.\n     * @param gridWidget The GridWidget on which to perform the operation.\n     * @return true if the gridWidget is in an appropriate state, false otherwise\n     */\n    boolean isExecutable(final GridWidget gridWidget);\n\n    /**\n     * Performs the operation on the given @{link GridWidget}\n     * @param gridWidget The GridWidget on which to perform the operation.\n     * @param isShiftKeyDown True if the shift-key is down.\n     * @param isControlKeyDown True if the control-key is down.\n     * @return true if the view needs to be rendered.\n     */\n    boolean perform(final GridWidget gridWidget,\n                    final boolean isShiftKeyDown,\n                    final boolean isControlKeyDown);\n\n    enum TriStateBoolean {\n        TRUE,\n        FALSE,\n        DONT_CARE\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationClearCell.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\npublic class KeyboardOperationClearCell extends BaseKeyboardOperation {\n\n    public KeyboardOperationClearCell(final GridLayer gridLayer) {\n        super(gridLayer);\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_DELETE;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        clearCells(gridWidget);\n        return true;\n    }\n\n    protected void clearCells(final GridWidget gridWidget) {\n        final GridData gridModel = gridWidget.getModel();\n        final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();\n        for (GridData.SelectedCell cell : selectedCells) {\n            gridModel.deleteCell(cell.getRowIndex(),\n                                 cell.getColumnIndex());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationEditCell.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.CellContextUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\npublic class KeyboardOperationEditCell extends BaseKeyboardOperation {\n\n    public KeyboardOperationEditCell(final GridLayer gridLayer) {\n        super(gridLayer);\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_ENTER;\n    }\n\n    @Override\n    public boolean isExecutable(final GridWidget gridWidget) {\n        final GridData model = gridWidget.getModel();\n        return model.getSelectedHeaderCells().size() > 0 || model.getSelectedCells().size() > 0;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        CellContextUtilities.editSelectedCell(gridWidget);\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationInvokeContextMenuForSelectedCell.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\npublic class KeyboardOperationInvokeContextMenuForSelectedCell extends BaseKeyboardOperation {\n\n    public KeyboardOperationInvokeContextMenuForSelectedCell(final GridLayer gridLayer) {\n        super(gridLayer);\n    }\n\n    @Override\n    public TriStateBoolean isControlKeyDown() {\n        return TriStateBoolean.TRUE;\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_SPACE;\n    }\n\n    @Override\n    public boolean isExecutable(final GridWidget gridWidget) {\n        final GridData model = gridWidget.getModel();\n        return model.getSelectedHeaderCells().size() > 0 || model.getSelectedCells().size() > 0;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        final GridData model = gridWidget.getModel();\n        if (model.getSelectedHeaderCells().size() > 0) {\n            return performHeaderOperation(gridWidget);\n        } else if (model.getSelectedCells().size() > 0) {\n            return performBodyOperation(gridWidget);\n        }\n        return false;\n    }\n\n    protected boolean performHeaderOperation(final GridWidget gridWidget) {\n        final GridData model = gridWidget.getModel();\n        final List<GridData.SelectedCell> selectedHeaderCells = model.getSelectedHeaderCells();\n        if (selectedHeaderCells.isEmpty()) {\n            return false;\n        }\n        final GridData.SelectedCell firstSelectedHeaderCell = selectedHeaderCells.get(0);\n        final int headerRowIndex = firstSelectedHeaderCell.getRowIndex();\n        final int headerColumnIndex = ColumnIndexUtilities.findUiColumnIndex(model.getColumns(),\n                                                                             firstSelectedHeaderCell.getColumnIndex());\n        return gridWidget.showContextMenuForHeader(headerRowIndex, headerColumnIndex);\n    }\n\n    protected boolean performBodyOperation(final GridWidget gridWidget) {\n        final GridData model = gridWidget.getModel();\n        final GridData.SelectedCell origin = model.getSelectedCellsOrigin();\n        if (origin == null) {\n            return false;\n        }\n        final int rowIndex = origin.getRowIndex();\n        final int columnIndex = ColumnIndexUtilities.findUiColumnIndex(model.getColumns(),\n                                                                       origin.getColumnIndex());\n        return gridWidget.showContextMenuForCell(rowIndex, columnIndex);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMove.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\npublic abstract class KeyboardOperationMove extends BaseKeyboardOperation {\n\n    private final Optional<GridLienzoScrollable> panel;\n\n    KeyboardOperationMove(final GridLayer gridLayer,\n                          final GridLienzoScrollable panel) {\n        super(gridLayer);\n        this.panel = Optional.ofNullable(panel);\n    }\n\n    @Override\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        final boolean redraw = gridWidget.adjustSelection(getSelectionExtension(),\n                                                          isShiftKeyDown);\n        baseScrollSelectedCellIntoView(gridWidget);\n        panel.ifPresent(GridLienzoScrollable::refreshScrollPosition);\n        return redraw;\n    }\n\n    void baseScrollSelectedCellIntoView(final GridWidget gridWidget) {\n        scrollSelectedCellIntoView(gridWidget);\n    }\n\n    abstract SelectionExtension getSelectionExtension();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveDown.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\npublic class KeyboardOperationMoveDown extends KeyboardOperationMove {\n\n    public KeyboardOperationMoveDown(final GridLayer gridLayer) {\n        this(gridLayer, null);\n    }\n\n    public KeyboardOperationMoveDown(final GridLayer gridLayer,\n                                     final GridLienzoScrollable panel) {\n        super(gridLayer, panel);\n    }\n\n    @Override\n    SelectionExtension getSelectionExtension() {\n        return SelectionExtension.DOWN;\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_DOWN;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveLeft.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\npublic class KeyboardOperationMoveLeft extends KeyboardOperationMove {\n\n    public KeyboardOperationMoveLeft(final GridLayer gridLayer) {\n        this(gridLayer, null);\n    }\n\n    public KeyboardOperationMoveLeft(final GridLayer gridLayer,\n                                     final GridLienzoScrollable panel) {\n        super(gridLayer, panel);\n    }\n\n    @Override\n    SelectionExtension getSelectionExtension() {\n        return SelectionExtension.LEFT;\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_LEFT;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveRight.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\npublic class KeyboardOperationMoveRight extends KeyboardOperationMove {\n\n    public KeyboardOperationMoveRight(final GridLayer gridLayer) {\n        this(gridLayer, null);\n    }\n\n    public KeyboardOperationMoveRight(final GridLayer gridLayer,\n                                      final GridLienzoScrollable panel) {\n        super(gridLayer, panel);\n    }\n\n    @Override\n    SelectionExtension getSelectionExtension() {\n        return SelectionExtension.RIGHT;\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_RIGHT;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveUp.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\npublic class KeyboardOperationMoveUp extends KeyboardOperationMove {\n\n    public KeyboardOperationMoveUp(final GridLayer gridLayer) {\n        this(gridLayer, null);\n    }\n\n    public KeyboardOperationMoveUp(final GridLayer gridLayer,\n                                   final GridLienzoScrollable panel) {\n        super(gridLayer, panel);\n    }\n\n    @Override\n    SelectionExtension getSelectionExtension() {\n        return SelectionExtension.UP;\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_UP;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationSelectBottomRightCell.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\npublic class KeyboardOperationSelectBottomRightCell extends BaseKeyboardOperation {\n\n    public KeyboardOperationSelectBottomRightCell(final GridLayer gridLayer) {\n        super(gridLayer);\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_END;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        final boolean redraw = selectBottomRightCell(gridWidget);\n        scrollSelectedCellIntoView(gridWidget);\n        return redraw;\n    }\n\n    protected boolean selectBottomRightCell(final GridWidget gridWidget) {\n        final GridData gridModel = gridWidget.getModel();\n        final int rowCount = gridModel.getRowCount();\n        final int columnCount = gridModel.getColumnCount();\n        return gridWidget.selectCell(rowCount - 1,\n                                     columnCount - 1,\n                                     false,\n                                     false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationSelectTopLeftCell.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\npublic class KeyboardOperationSelectTopLeftCell extends BaseKeyboardOperation {\n\n    public KeyboardOperationSelectTopLeftCell(final GridLayer gridLayer) {\n        super(gridLayer);\n    }\n\n    @Override\n    public int getKeyCode() {\n        return KeyCodes.KEY_HOME;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public boolean perform(final GridWidget gridWidget,\n                           final boolean isShiftKeyDown,\n                           final boolean isControlKeyDown) {\n        final boolean redraw = selectTopLeftCell(gridWidget);\n        scrollSelectedCellIntoView(gridWidget);\n        return redraw;\n    }\n\n    protected boolean selectTopLeftCell(final GridWidget gridWidget) {\n        return gridWidget.selectCell(0,\n                                     0,\n                                     false,\n                                     false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/KeyDownHandlerCommon.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport java.util.Optional;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\npublic class KeyDownHandlerCommon implements KeyDownHandler {\n\n    protected final GridLienzoPanel gridPanel;\n    protected final GridLayer gridLayer;\n    protected final GridWidget gridWidget;\n    protected final HasSingletonDOMElementResource gridCell;\n\n    private final boolean isTabKeyHandled;\n    private final boolean isEnterKeyHandled;\n    private final boolean isEscapeKeyHandled;\n\n    public KeyDownHandlerCommon(final GridLienzoPanel gridPanel,\n                                final GridLayer gridLayer,\n                                final GridWidget gridWidget,\n                                final HasSingletonDOMElementResource gridCell) {\n        this(gridPanel,\n             gridLayer,\n             gridWidget,\n             gridCell,\n             true,\n             true,\n             true);\n    }\n\n    public KeyDownHandlerCommon(final GridLienzoPanel gridPanel,\n                                final GridLayer gridLayer,\n                                final GridWidget gridWidget,\n                                final HasSingletonDOMElementResource gridCell,\n                                final boolean isTabKeyHandled,\n                                final boolean isEnterKeyHandled,\n                                final boolean isEscapeKeyHandled) {\n        this.gridPanel = gridPanel;\n        this.gridLayer = gridLayer;\n        this.gridWidget = gridWidget;\n        this.gridCell = gridCell;\n\n        this.isTabKeyHandled = isTabKeyHandled;\n        this.isEnterKeyHandled = isEnterKeyHandled;\n        this.isEscapeKeyHandled = isEscapeKeyHandled;\n    }\n\n    @Override\n    public void onKeyDown(final KeyDownEvent e) {\n        final int keyCode = e.getNativeKeyCode();\n\n        switch (keyCode) {\n            case KeyCodes.KEY_TAB:\n                if (isTabKeyHandled) {\n                    flush(e);\n                }\n                break;\n\n            case KeyCodes.KEY_ENTER:\n                if (isEnterKeyHandled) {\n                    flush(e);\n                }\n                break;\n\n            case KeyCodes.KEY_ESCAPE:\n                if (isEscapeKeyHandled) {\n                    reset();\n                }\n        }\n\n        e.stopPropagation();\n    }\n\n    private void flush(final KeyDownEvent e) {\n        final int keyCode = e.getNativeKeyCode();\n        final boolean isShiftKeyDown = e.isShiftKeyDown();\n\n        gridCell.flush();\n        moveSelection(keyCode, isShiftKeyDown);\n        e.preventDefault();\n\n        reset();\n    }\n\n    private void reset() {\n        gridCell.destroyResources();\n        gridPanel.setFocus(true);\n        gridLayer.batch();\n    }\n\n    protected void moveSelection(final int keyCode,\n                                 final boolean isShiftKeyDown) {\n        final Optional<Integer> dx = getDelta(keyCode,\n                                              KeyCodes.KEY_TAB,\n                                              isShiftKeyDown);\n        final Optional<Integer> dy = getDelta(keyCode,\n                                              KeyCodes.KEY_ENTER,\n                                              isShiftKeyDown);\n\n        if (dx.isPresent()) {\n            gridWidget.adjustSelection(dx.get() > 0 ? SelectionExtension.RIGHT : SelectionExtension.LEFT,\n                                       false);\n        }\n\n        if (dy.isPresent()) {\n            gridWidget.adjustSelection(dy.get() > 0 ? SelectionExtension.DOWN : SelectionExtension.UP,\n                                       false);\n        }\n    }\n\n    private Optional<Integer> getDelta(final int keyCode,\n                                       final int requiredKeyCode,\n                                       final boolean isShiftKeyDown) {\n        if (keyCode == requiredKeyCode) {\n            return Optional.of(isShiftKeyDown ? -1 : 1);\n        }\n        return Optional.empty();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/GridColumnRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns;\n\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\npublic interface GridColumnRenderer<T> {\n\n    /**\n     * Renders the column's Header..\n     * @param headerMetaData MetaData for the header\n     * @param context Contextual information to support rendering\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @param columnRenderingConstraint Function to determine whether column should be rendered to the SelectionLayer\n     * @return\n     */\n    List<GridRenderer.RendererCommand> renderHeader(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                                    final GridHeaderColumnRenderContext context,\n                                                    final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                    final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint);\n\n    /**\n     * Renders the column's Header content.\n     * @param headerMetaData MetaData for the header\n     * @param context Contextual information to support rendering\n     * @param headerRowIndex Index of the header row being rendered. Zero based.\n     * @param blockWidth Width of the block of 'equal' header meta data objects.\n     * @param rowHeight Height of the header row.\n     * @return\n     */\n    Group renderHeaderContent(final List<GridColumn.HeaderMetaData> headerMetaData,\n                              final GridHeaderColumnRenderContext context,\n                              final int headerRowIndex,\n                              final double blockWidth,\n                              final double rowHeight);\n\n    /**\n     * Renders the column.textual information to support rendering\n     * @param column The column to render\n     * @param context Contextual information to support rendering\n     * @param rendererHelper Helper for rendering.\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @param columnRenderingConstraint Function to determine whether column should be rendered to the SelectionLayer\n     * @return\n     */\n    List<GridRenderer.RendererCommand> renderColumn(final GridColumn<?> column,\n                                                    final GridBodyColumnRenderContext context,\n                                                    final BaseGridRendererHelper rendererHelper,\n                                                    final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                    final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint);\n\n    /**\n     * Renders a cell for the column for a row. Normally a column would use its logical index\n     * to retrieve the corresponding element from the row to be rendered.\n     * @param cell The cell to render\n     * @param context Contextual information to support rendering\n     * @return\n     */\n    Group renderCell(final GridCell<T> cell,\n                     final GridBodyCellRenderContext context);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/BaseGridColumnRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.BoundingBoxPathClipper;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.BoundingBox;\nimport com.google.gwt.core.client.GWT;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic abstract class BaseGridColumnRenderer<T> implements GridColumnRenderer<T> {\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    public List<GridRenderer.RendererCommand> renderHeader(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                                           final GridHeaderColumnRenderContext context,\n                                                           final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                           final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) {\n        final GridData model = context.getModel();\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n\n        final double x = context.getX();\n        final double headerRowsHeight = renderingInformation.getHeaderRowsHeight();\n        final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n        final double rowHeight = headerRowsHeight / headerMetaData.size();\n\n        final List<GridColumn<?>> allBlockColumns = context.getAllColumns();\n        final List<GridColumn<?>> visibleBlockColumns = context.getBlockColumns();\n\n        final int headerStartColumnIndex = allBlockColumns.indexOf(visibleBlockColumns.get(0));\n        final int headerColumnIndex = allBlockColumns.indexOf(visibleBlockColumns.get(context.getColumnIndex()));\n        final GridColumn<?> column = visibleBlockColumns.get(context.getColumnIndex());\n\n        final List<GridRenderer.RendererCommand> commands = new ArrayList<>();\n\n        //Grid lines\n        commands.add((GridRenderer.RenderHeaderGridLinesCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                final Group g = new Group().setX(x);\n                final MultiPath headerGrid = theme.getHeaderGridLine().setY(headerRowsYOffset);\n\n                for (int headerRowIndex = 0; headerRowIndex < headerMetaData.size(); headerRowIndex++) {\n                    //Get extents of block for Header cell\n                    final int blockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(allBlockColumns,\n                                                                                                          headerMetaData.get(headerRowIndex),\n                                                                                                          headerRowIndex,\n                                                                                                          headerColumnIndex);\n                    final int blockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(allBlockColumns,\n                                                                                                      headerMetaData.get(headerRowIndex),\n                                                                                                      headerRowIndex,\n                                                                                                      headerColumnIndex);\n\n                    //Vertical grid lines\n                    if (headerColumnIndex < model.getColumnCount() - 1) {\n                        if (blockEndColumnIndex == headerColumnIndex) {\n                            final double hx = column.getWidth();\n                            headerGrid.M(hx + 0.5,\n                                         headerRowIndex * rowHeight).L(hx + 0.5,\n                                                                       (headerRowIndex + 1) * rowHeight);\n                        }\n                    }\n\n                    //Check whether we need to render clipped cell (we only render once for blocks spanning multiple columns)\n                    boolean skip;\n                    if (blockStartColumnIndex >= headerStartColumnIndex) {\n                        skip = headerColumnIndex > blockStartColumnIndex;\n                    } else {\n                        skip = headerColumnIndex > headerStartColumnIndex;\n                    }\n                    if (skip) {\n                        continue;\n                    }\n\n                    //Get adjustments for the blocked Header cell\n                    final double offsetX = getBlockOffset(allBlockColumns,\n                                                          blockStartColumnIndex,\n                                                          headerColumnIndex);\n                    final double blockWidth = getBlockWidth(allBlockColumns,\n                                                            blockStartColumnIndex,\n                                                            blockEndColumnIndex);\n\n                    //Horizontal grid lines\n                    if (headerRowIndex > 0) {\n                        headerGrid.M(offsetX,\n                                     (headerRowIndex * rowHeight) + 0.5).L(offsetX + blockWidth,\n                                                                           (headerRowIndex * rowHeight) + 0.5);\n                    }\n                }\n                g.add(headerGrid);\n                rc.getGroup().add(g);\n            }\n        });\n\n        //Grid content\n        commands.add((GridRenderer.RenderHeaderContentCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                final Group g = new Group().setX(x);\n                for (int headerRowIndex = 0; headerRowIndex < headerMetaData.size(); headerRowIndex++) {\n                    //Get extents of block for Header cell\n                    final int blockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(allBlockColumns,\n                                                                                                          headerMetaData.get(headerRowIndex),\n                                                                                                          headerRowIndex,\n                                                                                                          headerColumnIndex);\n                    final int blockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(allBlockColumns,\n                                                                                                      headerMetaData.get(headerRowIndex),\n                                                                                                      headerRowIndex,\n                                                                                                      headerColumnIndex);\n\n                    //Check whether we need to render clipped cell (we only render once for blocks spanning multiple columns)\n                    boolean skip;\n                    if (blockStartColumnIndex >= headerStartColumnIndex) {\n                        skip = headerColumnIndex > blockStartColumnIndex;\n                    } else {\n                        skip = headerColumnIndex > headerStartColumnIndex;\n                    }\n                    if (skip) {\n                        continue;\n                    }\n\n                    //Get adjustments for the blocked Header cell\n                    final double offsetX = getBlockOffset(allBlockColumns,\n                                                          blockStartColumnIndex,\n                                                          headerColumnIndex);\n                    final double blockWidth = getBlockWidth(allBlockColumns,\n                                                            blockStartColumnIndex,\n                                                            blockEndColumnIndex);\n\n                    final Group headerGroup = renderHeaderContent(headerMetaData,\n                                                                  context,\n                                                                  headerRowIndex,\n                                                                  blockWidth,\n                                                                  rowHeight);\n\n                    //Clip Header Group\n                    final BoundingBox bb = new BoundingBox(0,\n                                                           0,\n                                                           blockWidth,\n                                                           rowHeight);\n                    final IPathClipper clipper = getBoundingBoxPathClipper(bb);\n                    headerGroup.setX(offsetX);\n                    headerGroup.setY(headerRowsYOffset + headerRowIndex * rowHeight);\n                    headerGroup.setPathClipper(clipper);\n                    clipper.setActive(true);\n\n                    g.add(headerGroup);\n                }\n                rc.getGroup().add(g);\n            }\n        });\n\n        return commands;\n    }\n\n    protected IPathClipper getBoundingBoxPathClipper(final BoundingBox bb) {\n        return new BoundingBoxPathClipper(bb);\n    }\n\n    @Override\n    public Group renderHeaderContent(final List<GridColumn.HeaderMetaData> headerMetaData,\n                                     final GridHeaderColumnRenderContext context,\n                                     final int headerRowIndex,\n                                     final double blockWidth,\n                                     final double rowHeight) {\n        final Group headerGroup = GWT.create(Group.class);\n        final String title = headerMetaData.get(headerRowIndex).getTitle();\n        final Text t = context.getRenderer().getTheme().getHeaderText();\n        t.setText(title);\n        t.setListening(false);\n        t.setX(blockWidth / 2);\n        t.setY(rowHeight / 2);\n        headerGroup.add(t);\n        return headerGroup;\n    }\n\n    private double getBlockOffset(final List<GridColumn<?>> allColumns,\n                                  final int blockStartColumnIndex,\n                                  final int headerColumnIndex) {\n        double blockOffset = 0;\n        for (int blockColumnIndex = blockStartColumnIndex; blockColumnIndex < headerColumnIndex; blockColumnIndex++) {\n            final GridColumn column = allColumns.get(blockColumnIndex);\n            if (column.isVisible()) {\n                blockOffset = blockOffset - column.getWidth();\n            }\n        }\n        return blockOffset;\n    }\n\n    private double getBlockWidth(final List<GridColumn<?>> allColumns,\n                                 final int blockStartColumnIndex,\n                                 final int blockEndColumnIndex) {\n        double blockWidth = 0;\n        for (int blockColumnIndex = blockStartColumnIndex; blockColumnIndex <= blockEndColumnIndex; blockColumnIndex++) {\n            final GridColumn column = allColumns.get(blockColumnIndex);\n            if (column.isVisible()) {\n                blockWidth = blockWidth + column.getWidth();\n            }\n        }\n        return blockWidth;\n    }\n\n    @Override\n    public List<GridRenderer.RendererCommand> renderColumn(final GridColumn<?> column,\n                                                           final GridBodyColumnRenderContext context,\n                                                           final BaseGridRendererHelper rendererHelper,\n                                                           final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                           final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) {\n        if (context.getModel().isMerged()) {\n            return ColumnRenderingStrategyMerged.render(column,\n                                                        context,\n                                                        rendererHelper,\n                                                        renderingInformation,\n                                                        columnRenderingConstraint);\n        } else {\n            return ColumnRenderingStrategyFlattened.render(column,\n                                                           context,\n                                                           rendererHelper,\n                                                           renderingInformation,\n                                                           columnRenderingConstraint);\n        }\n    }\n\n    /**\n     * Return the <code>Group</code> holding the <b>cell</b> data\n     * @param cell\n     * @param context\n     * @param text code the <code>Text</code> that will contain the data to show\n     * @param value the String to show\n     * @return\n     */\n    protected Group internalRenderCell(final GridCell<T> cell,\n                                       final GridBodyCellRenderContext context,\n                                       final Text text,\n                                       final String value) {\n        if (value == null) {\n            return null;\n        }\n\n        final Group g = new Group();\n\n        text.setText(value);\n        text.setListening(false);\n        text.setX(context.getCellWidth() / 2);\n        text.setY(context.getCellHeight() / 2);\n\n        g.add(text);\n        return g;\n    }\n\n    protected boolean isToReturnNull(final GridCell<T> cell) {\n        return cell == null || cell.getValue() == null || (cell.getValue().getValue() == null && cell.getValue().getPlaceHolder() == null);\n    }\n\n    protected boolean isPlaceHolderToBeShown(final GridCell<T> cell) {\n        return cell.getValue() != null && cell.getValue().getValue() == null && cell.getValue().getPlaceHolder() != null;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/BoundingBoxPathClipperFactory.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport com.ait.lienzo.client.core.shape.BoundingBoxPathClipper;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.types.BoundingBox;\n\npublic class BoundingBoxPathClipperFactory {\n\n    public IPathClipper newClipper(final double minX,\n                                   final double minY,\n                                   final double maxX,\n                                   final double maxY) {\n        final BoundingBox boundingBox = new BoundingBox(minX, minY, maxX, maxY);\n        return new BoundingBoxPathClipper(boundingBox);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/ColumnRenderingStrategyFlattened.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.core.client.GWT;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class ColumnRenderingStrategyFlattened {\n\n    @SuppressWarnings({\"unused\", \"unchecked\"})\n    public static List<GridRenderer.RendererCommand> render(final GridColumn<?> column,\n                                                            final GridBodyColumnRenderContext context,\n                                                            final BaseGridRendererHelper rendererHelper,\n                                                            final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                            final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) {\n        final double x = context.getX();\n        final double absoluteGridY = context.getAbsoluteGridY();\n        final double absoluteColumnX = context.getAbsoluteColumnX();\n        final double clipMinY = context.getClipMinY();\n        final double clipMinX = context.getClipMinX();\n        final int minVisibleRowIndex = context.getMinVisibleRowIndex();\n        final int maxVisibleRowIndex = context.getMaxVisibleRowIndex();\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final List<Double> visibleRowOffsets = renderingInformation.getVisibleRowOffsets();\n        final boolean isFloating = context.isFloating();\n        final GridData model = context.getModel();\n        final Transform transform = context.getTransform();\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n        final double columnWidth = column.getWidth();\n        final double columnHeight = visibleRowOffsets.get(maxVisibleRowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0) + allRowHeights.get(maxVisibleRowIndex);\n\n        final List<GridRenderer.RendererCommand> commands = new ArrayList<>();\n\n        //Grid lines\n        commands.add((GridRenderer.RenderBodyGridLinesCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                //- horizontal\n                final MultiPath bodyGrid = theme.getBodyGridLine();\n                for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) {\n                    if (rowIndex == 0) {\n                        continue;\n                    }\n                    final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0);\n                    bodyGrid.M(x, y + 0.5)\n                            .L(x + columnWidth, y + 0.5);\n                }\n\n                //- vertical\n                final int columnIndex = model.getColumns().indexOf(column);\n                if (columnIndex < model.getColumnCount() - 1) {\n                    bodyGrid.M(x + columnWidth + 0.5, 0)\n                            .L(x + columnWidth + 0.5, columnHeight);\n                }\n\n                rc.getGroup().add(bodyGrid);\n            }\n        });\n\n        //Column content\n        commands.add((GridRenderer.RenderBodyGridContentCommand) (rc) -> {\n            if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) {\n                final Group columnGroup = GWT.create(Group.class);\n                columnGroup.setX(x);\n                final int columnIndex = model.getColumns().indexOf(column);\n                for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) {\n                    final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0);\n                    final double rowHeight = allRowHeights.get(rowIndex);\n                    final GridBodyCellRenderContext cellContext = new GridBodyCellRenderContext(absoluteColumnX,\n                                                                                                absoluteGridY + renderer.getHeaderHeight() + visibleRowOffsets.get(rowIndex - minVisibleRowIndex),\n                                                                                                columnWidth,\n                                                                                                rowHeight,\n                                                                                                clipMinY,\n                                                                                                clipMinX,\n                                                                                                rowIndex,\n                                                                                                columnIndex,\n                                                                                                isFloating,\n                                                                                                transform,\n                                                                                                renderer);\n\n                    //Cell's content\n                    final GridCell<?> cell = model.getCell(rowIndex,\n                                                           columnIndex);\n                    final Group cc = column.getColumnRenderer().renderCell((GridCell) cell,\n                                                                           cellContext);\n                    if (cc != null) {\n                        cc.setX(0).setY(y).setListening(true);\n                        columnGroup.add(cc);\n                    }\n                }\n\n                //Clip Column Group\n                final BoundingBoxPathClipperFactory boundingBoxPathClipperFactory = GWT.create(BoundingBoxPathClipperFactory.class);\n                final IPathClipper clipper = boundingBoxPathClipperFactory.newClipper(0,\n                                                                                      0,\n                                                                                      columnWidth,\n                                                                                      columnHeight);\n                columnGroup.setPathClipper(clipper);\n                clipper.setActive(true);\n\n                rc.getGroup().add(columnGroup);\n            }\n        });\n\n        return commands;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/ColumnRenderingStrategyMerged.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.google.gwt.core.client.GWT;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.GroupingToggle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class ColumnRenderingStrategyMerged {\n\n    private static final int LOOP_THRESHOLD = 1000;\n\n    public static List<GridRenderer.RendererCommand> render(final GridColumn<?> column,\n                                                            final GridBodyColumnRenderContext context,\n                                                            final BaseGridRendererHelper rendererHelper,\n                                                            final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                                            final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) {\n        final double x = context.getX();\n        final double absoluteGridY = context.getAbsoluteGridY();\n        final double absoluteColumnX = context.getAbsoluteColumnX();\n        final double clipMinY = context.getClipMinY();\n        final double clipMinX = context.getClipMinX();\n        final int minVisibleRowIndex = context.getMinVisibleRowIndex();\n        final int maxVisibleRowIndex = context.getMaxVisibleRowIndex();\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final List<Double> visibleRowOffsets = renderingInformation.getVisibleRowOffsets();\n        final boolean isFloating = context.isFloating();\n        final GridData model = context.getModel();\n        final Transform transform = context.getTransform();\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n        final double columnWidth = column.getWidth();\n        final double columnHeight = visibleRowOffsets.get(maxVisibleRowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0) + allRowHeights.get(maxVisibleRowIndex);\n        final int columnIndex = model.getColumns().indexOf(column);\n\n        final List<GridRenderer.RendererCommand> commands = new ArrayList<>();\n\n        //Grid lines\n        commands.add((GridRenderer.RenderBodyGridLinesCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                //- horizontal\n                final MultiPath bodyGrid = theme.getBodyGridLine();\n                for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) {\n                    final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0);\n                    final GridRow row = model.getRow(rowIndex);\n\n                    if (!row.isMerged()) {\n                        //If row doesn't contain merged cells just draw a line across the visible body\n                        bodyGrid.M(x, y + 0.5)\n                                .L(x + columnWidth, y + 0.5);\n                    } else if (!row.isCollapsed()) {\n                        //If row isn't collapsed just draw a line across the visible body at the top of the merged block\n                        final GridCell<?> cell = model.getCell(rowIndex,\n                                                               columnIndex);\n\n                        if (cell == null || cell.getMergedCellCount() > 0) {\n                            //Draw a line-segment for empty cells and cells that are to have content rendered\n                            bodyGrid.M(x, y + 0.5)\n                                    .L(x + columnWidth, y + 0.5);\n                        } else if (isCollapsedRowMultiValue(model,\n                                                            column,\n                                                            cell,\n                                                            rowIndex)) {\n                            //Special case for when a cell follows collapsed row(s) with multiple values\n                            bodyGrid.M(x, y + 0.5)\n                                    .L(x + columnWidth, y + 0.5);\n                        }\n                    }\n                }\n\n                //- vertical\n                if (columnIndex < model.getColumnCount() - 1) {\n                    bodyGrid.M(x + columnWidth + 0.5, 0)\n                            .L(x + columnWidth + 0.5, columnHeight);\n                }\n\n                rc.getGroup().add(bodyGrid);\n            }\n        });\n\n        //Column content\n        commands.add((GridRenderer.RenderBodyGridContentCommand) (rc) -> {\n            if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) {\n                final Group columnGroup = GWT.create(Group.class);\n                columnGroup.setX(x);\n                int iterations = 0;\n                for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) {\n\n                    // This is a defensive programming to prevent this loop from never ending.\n                    // The check should never be satisfied however, especially in early development, this loop sometimes became\n                    // infinite. All known issue are resolved however the check remains as a safety precaution. Without the check\n                    // the Workbench could appear to \"lock up\" - if the infinite loop scenario reoccurred. With the check,\n                    // at worst, the grid will be incorrectly rendered.\n                    iterations++;\n                    if (iterations > LOOP_THRESHOLD) {\n                        break;\n                    }\n\n                    final double y = visibleRowOffsets.get(rowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0);\n                    final GridRow row = model.getRow(rowIndex);\n                    final GridCell<?> cell = model.getCell(rowIndex,\n                                                           columnIndex);\n\n                    //Only show content for rows that are not collapsed\n                    if (row.isCollapsed()) {\n                        continue;\n                    }\n\n                    //Add highlight for merged cells with different values\n                    final boolean isCollapsedCellMixedValue = isCollapsedCellMixedValue(model,\n                                                                                        rowIndex,\n                                                                                        columnIndex);\n\n                    if (isCollapsedCellMixedValue) {\n                        final Group mixedValueGroup = renderMergedCellMixedValueHighlight(columnWidth,\n                                                                                          allRowHeights.get(rowIndex));\n                        mixedValueGroup.setX(0).setY(y).setListening(true);\n                        columnGroup.add(mixedValueGroup);\n                    }\n\n                    //Only show content if there's a Cell behind it!\n                    if (cell == null) {\n                        continue;\n                    }\n\n                    //Add Group Toggle for first row in a Merged block\n                    if (cell.getMergedCellCount() > 1) {\n                        final GridCell<?> nextRowCell = model.getCell(rowIndex + 1,\n                                                                      columnIndex);\n                        if (nextRowCell != null) {\n                            final Group gt = renderGroupedCellToggle(columnWidth,\n                                                                     allRowHeights.get(rowIndex),\n                                                                     nextRowCell.isCollapsed());\n                            gt.setX(0).setY(y);\n                            columnGroup.add(gt);\n                        }\n                    }\n\n                    if (cell.getMergedCellCount() > 0) {\n                        //If cell is \"lead\" i.e. top of a merged block centralize content in cell\n                        final double cellHeight = getCellHeight(rowIndex,\n                                                                allRowHeights,\n                                                                cell);\n                        final GridBodyCellRenderContext cellContext = new GridBodyCellRenderContext(absoluteColumnX,\n                                                                                                    absoluteGridY + renderer.getHeaderHeight() + visibleRowOffsets.get(rowIndex - minVisibleRowIndex),\n                                                                                                    columnWidth,\n                                                                                                    cellHeight,\n                                                                                                    clipMinY,\n                                                                                                    clipMinX,\n                                                                                                    rowIndex,\n                                                                                                    columnIndex,\n                                                                                                    isFloating,\n                                                                                                    transform,\n                                                                                                    renderer);\n\n                        //Render cell's content\n                        final Group cc = column.getColumnRenderer().renderCell((GridCell) cell,\n                                                                               cellContext);\n                        cc.setX(0).setY(y).setListening(true);\n                        columnGroup.add(cc);\n\n                        //Skip remainder of merged block\n                        rowIndex = rowIndex + cell.getMergedCellCount() - 1;\n                    } else {\n                        //Otherwise the cell has been clipped and we need to back-track to the \"lead\" cell to centralize content\n                        double _y = y;\n                        int _rowIndex = rowIndex;\n                        GridCell<?> _cell = cell;\n                        while (_cell.getMergedCellCount() == 0) {\n                            _rowIndex--;\n                            _y = _y - allRowHeights.get(_rowIndex);\n                            _cell = model.getCell(_rowIndex,\n                                                  columnIndex);\n                        }\n\n                        final double cellHeight = getCellHeight(_rowIndex,\n                                                                allRowHeights,\n                                                                cell);\n                        final GridBodyCellRenderContext cellContext = new GridBodyCellRenderContext(absoluteColumnX,\n                                                                                                    absoluteGridY + renderer.getHeaderHeight() + rendererHelper.getRowOffset(_rowIndex),\n                                                                                                    columnWidth,\n                                                                                                    cellHeight,\n                                                                                                    clipMinY,\n                                                                                                    clipMinX,\n                                                                                                    rowIndex,\n                                                                                                    columnIndex,\n                                                                                                    isFloating,\n                                                                                                    transform,\n                                                                                                    renderer);\n\n                        //Render cell's content\n                        final Group cc = column.getColumnRenderer().renderCell((GridCell) _cell,\n                                                                               cellContext);\n                        cc.setX(0).setY(_y).setListening(true);\n                        columnGroup.add(cc);\n\n                        //Skip remainder of merged block\n                        rowIndex = _rowIndex + _cell.getMergedCellCount() - 1;\n                    }\n                }\n\n                //Clip Column Group\n                final double gridLinesStrokeWidth = theme.getBodyGridLine().getStrokeWidth();\n                final BoundingBoxPathClipperFactory boundingBoxPathClipperFactory = GWT.create(BoundingBoxPathClipperFactory.class);\n                final IPathClipper clipper = boundingBoxPathClipperFactory.newClipper(gridLinesStrokeWidth,\n                                                                                      0,\n                                                                                      columnWidth - gridLinesStrokeWidth,\n                                                                                      columnHeight);\n                columnGroup.setPathClipper(clipper);\n                clipper.setActive(true);\n\n                rc.getGroup().add(columnGroup);\n            }\n        });\n\n        return commands;\n    }\n\n    protected static boolean isCollapsedRowMultiValue(final GridData model,\n                                                      final GridColumn<?> column,\n                                                      final GridCell<?> cell,\n                                                      final int rowIndex) {\n        GridRow row;\n        int rowOffset = 1;\n        final int columnIndex = column.getIndex();\n\n        //Iterate collapsed rows checking if the values differ\n        while ((row = model.getRow(rowIndex - rowOffset)).isCollapsed()) {\n            final GridCell<?> nc = row.getCells().get(columnIndex);\n            if (!Objects.equals(nc, cell)) {\n                return true;\n            }\n            rowOffset++;\n        }\n\n        //Check \"lead\" row as well - since this is not marked as collapsed\n        final GridCell<?> nc = row.getCells().get(columnIndex);\n        if (!Objects.equals(nc, cell)) {\n            return true;\n        }\n        return false;\n    }\n\n    protected static boolean isCollapsedCellMixedValue(final GridData model,\n                                                       final int rowIndex,\n                                                       final int columnIndex) {\n        int _rowIndex = rowIndex;\n        GridCell<?> currentCell = model.getCell(_rowIndex,\n                                                columnIndex);\n        if (currentCell != null) {\n            while (_rowIndex > 0 && currentCell.getMergedCellCount() == 0) {\n                _rowIndex--;\n                currentCell = model.getCell(_rowIndex,\n                                            columnIndex);\n            }\n        }\n\n        _rowIndex++;\n        if (_rowIndex > model.getRowCount() - 1) {\n            return false;\n        }\n        while (_rowIndex < model.getRowCount() && model.getRow(_rowIndex).isCollapsed()) {\n            final GridCell<?> nextCell = model.getCell(_rowIndex,\n                                                       columnIndex);\n            if (!Objects.equals(currentCell, nextCell)) {\n                return true;\n            }\n            _rowIndex++;\n        }\n\n        return false;\n    }\n\n    protected static double getCellHeight(final int rowIndex,\n                                          final List<Double> allRowHeights,\n                                          final GridCell<?> cell) {\n        double height = 0.0;\n        for (int iRowIndex = rowIndex; iRowIndex < rowIndex + cell.getMergedCellCount(); iRowIndex++) {\n            height = height + allRowHeights.get(iRowIndex);\n        }\n        return height;\n    }\n\n    private static Group renderGroupedCellToggle(final double cellWidth,\n                                                 final double cellHeight,\n                                                 final boolean isCollapsed) {\n        return new GroupingToggle(cellWidth,\n                                  cellHeight,\n                                  isCollapsed);\n    }\n\n    private static Group renderMergedCellMixedValueHighlight(final double cellWidth,\n                                                             final double cellHeight) {\n        final Group g = new Group();\n        final Rectangle multiValueHighlight = new Rectangle(cellWidth,\n                                                            cellHeight);\n        multiValueHighlight.setFillColor(ColorName.GOLDENROD);\n        g.add(multiValueHighlight);\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/IntegerColumnRenderer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Text;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class IntegerColumnRenderer extends BaseGridColumnRenderer<Integer> {\n\n    @Override\n    public Group renderCell(final GridCell<Integer> cell,\n                            final GridBodyCellRenderContext context) {\n        if (isToReturnNull(cell)) {\n            return null;\n        }\n\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n\n        Text text;\n        String value;\n\n        if (isPlaceHolderToBeShown(cell)) {\n            text = theme.getPlaceholderText();\n            value = cell.getValue().getPlaceHolder();\n        } else {\n            text = theme.getBodyText();\n            value = cell.getValue() != null ? Integer.toString(cell.getValue().getValue()) : null;\n        }\n\n        return internalRenderCell(cell,\n                                  context,\n                                  text,\n                                  value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/StringColumnRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Text;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class StringColumnRenderer extends BaseGridColumnRenderer<String> {\n\n    @Override\n    public Group renderCell(final GridCell<String> cell,\n                            final GridBodyCellRenderContext context) {\n        if (isToReturnNull(cell)) {\n            return null;\n        }\n\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n\n        Text text;\n        String value;\n\n        if (isPlaceHolderToBeShown(cell)) {\n            text = theme.getPlaceholderText();\n            value = cell.getValue().getPlaceHolder();\n        } else {\n            text = theme.getBodyText();\n            value = cell.getValue() != null ? cell.getValue().getValue() : null;\n        }\n\n        return internalRenderCell(cell,\n                                  context,\n                                  text,\n                                  value);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/multiple/GridColumnMultipleDOMElementRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.HasMultipleDOMElementResources;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\n\npublic interface GridColumnMultipleDOMElementRenderer<T> extends GridColumnRenderer<T>,\n                                                                 HasMultipleDOMElementResources {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/multiple/impl/BaseGridColumnMultipleDOMElementRenderer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.impl;\n\nimport java.util.Objects;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.MultipleDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl.BaseGridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.GridColumnMultipleDOMElementRenderer;\n\npublic abstract class BaseGridColumnMultipleDOMElementRenderer<T, W extends Widget, E extends BaseDOMElement> extends BaseGridColumnRenderer<T> implements GridColumnMultipleDOMElementRenderer<T> {\n\n    protected final MultipleDOMElementFactory<W, E> factory;\n\n    public BaseGridColumnMultipleDOMElementRenderer(final MultipleDOMElementFactory<W, E> factory) {\n        this.factory = Objects.requireNonNull(factory, \"factory\");\n    }\n\n    @Override\n    public void initialiseResources() {\n        factory.initialiseResources();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n\n    @Override\n    public void freeUnusedResources() {\n        factory.freeUnusedResources();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/multiple/impl/BooleanColumnDOMElementRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.CheckBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.CheckBoxDOMElementFactory;\n\npublic class BooleanColumnDOMElementRenderer extends BaseGridColumnMultipleDOMElementRenderer<Boolean, CheckBox, CheckBoxDOMElement> {\n\n    public BooleanColumnDOMElementRenderer(final CheckBoxDOMElementFactory factory) {\n        super(factory);\n    }\n\n    @Override\n    public Group renderCell(final GridCell<Boolean> cell,\n                            final GridBodyCellRenderContext context) {\n        if (cell == null || cell.getValue() == null) {\n            return null;\n        }\n        final Group g = new Group();\n        factory.attachDomElement(context,\n                                 e -> e.getWidget().setValue(cell.getValue().getValue()),\n                                 result -> {/*Nothing*/});\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/multiple/impl/StringColumnDOMElementRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.multiple.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.TextBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.TextBoxDOMElementFactory;\n\npublic class StringColumnDOMElementRenderer extends BaseGridColumnMultipleDOMElementRenderer<String, TextBox, TextBoxDOMElement> {\n\n    public StringColumnDOMElementRenderer(final TextBoxDOMElementFactory factory) {\n        super(factory);\n    }\n\n    @Override\n    public Group renderCell(final GridCell<String> cell,\n                            final GridBodyCellRenderContext context) {\n        if (cell == null || cell.getValue() == null) {\n            return null;\n        }\n        final Group g = new Group();\n        factory.attachDomElement(context,\n                                 e -> e.getWidget().setValue(cell.getValue().getValue()),\n                                 result -> {/*Nothing*/});\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/single/GridColumnSingletonDOMElementRenderer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\n\npublic interface GridColumnSingletonDOMElementRenderer<T> extends GridColumnRenderer<T>,\n                                                                  HasSingletonDOMElementResource {\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/single/impl/BaseGridColumnSingletonDOMElementRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.impl;\n\nimport java.util.Objects;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.SingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl.BaseGridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.GridColumnSingletonDOMElementRenderer;\n\npublic abstract class BaseGridColumnSingletonDOMElementRenderer<T, W extends Widget, E extends BaseDOMElement> extends BaseGridColumnRenderer<T> implements GridColumnSingletonDOMElementRenderer<T> {\n\n    protected final SingletonDOMElementFactory<W, E> factory;\n\n    public BaseGridColumnSingletonDOMElementRenderer(final SingletonDOMElementFactory<W, E> factory) {\n        this.factory = Objects.requireNonNull(factory, \"factory\");\n    }\n\n    @Override\n    public void flush() {\n        factory.flush();\n    }\n\n    @Override\n    public void destroyResources() {\n        factory.destroyResources();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/single/impl/ListBoxColumnDOMElementSingletonRenderer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.google.gwt.user.client.ui.ListBox;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.ListBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.ListBoxSingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class ListBoxColumnDOMElementSingletonRenderer extends BaseGridColumnSingletonDOMElementRenderer<String, ListBox, ListBoxDOMElement> {\n\n    public ListBoxColumnDOMElementSingletonRenderer(final ListBoxSingletonDOMElementFactory factory) {\n        super(factory);\n    }\n\n    @Override\n    public Group renderCell(final GridCell<String> cell,\n                            final GridBodyCellRenderContext context) {\n        if (cell == null || cell.getValue() == null) {\n            return null;\n        }\n\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n\n        final Group g = new Group();\n        final Text t = theme.getBodyText()\n                .setText(cell.getValue().getValue())\n                .setListening(false)\n                .setX(context.getCellWidth() / 2)\n                .setY(context.getCellHeight() / 2);\n        g.add(t);\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/single/impl/StringColumnDOMElementSingletonRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.single.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Text;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.TextBoxDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl.TextBoxSingletonDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\npublic class StringColumnDOMElementSingletonRenderer extends BaseGridColumnSingletonDOMElementRenderer<String, TextBox, TextBoxDOMElement> {\n\n    public StringColumnDOMElementSingletonRenderer(final TextBoxSingletonDOMElementFactory factory) {\n        super(factory);\n    }\n\n    @Override\n    public Group renderCell(final GridCell<String> cell,\n                            final GridBodyCellRenderContext context) {\n        if (cell == null || cell.getValue() == null) {\n            return null;\n        }\n\n        final GridRenderer renderer = context.getRenderer();\n        final GridRendererTheme theme = renderer.getTheme();\n\n        final Group g = new Group();\n        final Text t = theme.getBodyText()\n                .setText(cell.getValue().getValue())\n                .setListening(false)\n                .setX(context.getCellWidth() / 2)\n                .setY(context.getCellHeight() / 2);\n        g.add(t);\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/GridRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids;\n\nimport java.util.List;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.SelectedRange;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * Definition of a render for the pluggable rendering mechanism.\n */\npublic interface GridRenderer {\n\n    interface GridRendererContext {\n\n        Group getGroup();\n\n        boolean isSelectionLayer();\n    }\n\n    /**\n     * Generic command to render a component of the grid\n     */\n    interface RendererCommand {\n\n        void execute(GridRendererContext parameter);\n    }\n\n    /**\n     * Command to render the \"Selector\" component of the grid\n     */\n    interface RenderSelectorCommand extends RendererCommand {\n\n    }\n\n    /**\n     * Command to render the \"Selected cells\" component of the grid\n     */\n    interface RenderSelectedCellsCommand extends RendererCommand {\n\n    }\n\n    /**\n     * Command to render the \"Grid boundary\" components of the grid\n     */\n    interface RenderGridBoundaryCommand extends RendererCommand {\n\n    }\n\n    /**\n     * Generic command for all header related rendering.\n     */\n    interface RendererHeaderCommand extends RendererCommand {\n\n    }\n\n    /**\n     * Command to render the \"Grid lines\" components of the grid header\n     */\n    interface RenderHeaderGridLinesCommand extends RendererHeaderCommand {\n\n    }\n\n    /**\n     * Command to render the \"background\" components of the grid header\n     */\n    interface RenderHeaderBackgroundCommand extends RendererHeaderCommand {\n\n    }\n\n    /**\n     * Command to render the \"content\" components of the grid header\n     */\n    interface RenderHeaderContentCommand extends RendererHeaderCommand {\n\n    }\n\n    /**\n     * Generic command for all body related rendering.\n     */\n    interface RendererBodyCommand extends RendererCommand {\n\n    }\n\n    /**\n     * Command to render the \"Grid lines\" components of the grid body\n     */\n    interface RenderBodyGridLinesCommand extends RendererBodyCommand {\n\n    }\n\n    /**\n     * Command to render the \"background\" components of the grid\n     */\n    interface RenderBodyGridBackgroundCommand extends RendererBodyCommand {\n\n    }\n\n    /**\n     * Command to render the \"content\" components of the grid\n     */\n    interface RenderBodyGridContentCommand extends RendererBodyCommand {\n\n    }\n\n    /**\n     * Returns the height of the header built by this renderer. The header's height may be greater than the product\n     * of the maximum number of header rows (see {@link GridColumn.HeaderMetaData}) and {@link #getHeaderRowHeight()}.\n     * Header rows are always positioned adjacent to the Body.\n     * @return The height of the header.\n     */\n    double getHeaderHeight();\n\n    /**\n     * Returns the height of a single row in the header.\n     * @return The height of a row.\n     */\n    double getHeaderRowHeight();\n\n    /**\n     * Returns the theme.\n     */\n    GridRendererTheme getTheme();\n\n    /**\n     * Sets the theme.\n     * @param theme\n     */\n    void setTheme(final GridRendererTheme theme);\n\n    /**\n     * Renders a \"selector\" when a grid has been selected, i.e. clicked.\n     * @param width The width of the GridWidget.\n     * @param height The height of the GridWidget including header and body.\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @return A command that adds the \"selector\".\n     */\n    RendererCommand renderSelector(final double width,\n                                   final double height,\n                                   final BaseGridRendererHelper.RenderingInformation renderingInformation);\n\n    /**\n     * Renders the selected ranges and append to the Body Group.\n     * @param model The data model for the GridWidget.\n     * @param context The context of the render phase.\n     * @param rendererHelper Helper for rendering.\n     * @param selectedCells The cells that are selected.\n     * @param selectedCellsYOffsetStrategy A function that returns the YOffset of a selection.\n     * @param selectedCellsHeightStrategy A function that returns the height of a selection.\n     * @return A command that adds the \"selected cells\".\n     */\n    RendererCommand renderSelectedCells(final GridData model,\n                                        final GridBodyRenderContext context,\n                                        final BaseGridRendererHelper rendererHelper,\n                                        final List<GridData.SelectedCell> selectedCells,\n                                        final BiFunction<SelectedRange, Integer, Double> selectedCellsYOffsetStrategy,\n                                        final Function<SelectedRange, Double> selectedCellsHeightStrategy);\n\n    /**\n     * Renders the header for the Grid.\n     * @param model The data model for the GridWidget.\n     * @param context The context of the render phase.\n     * @param rendererHelper Helper for rendering.\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @return Commands that add the \"header\".\n     */\n    List<RendererCommand> renderHeader(final GridData model,\n                                       final GridHeaderRenderContext context,\n                                       final BaseGridRendererHelper rendererHelper,\n                                       final BaseGridRendererHelper.RenderingInformation renderingInformation);\n\n    /**\n     * Renders the body for the Grid.\n     * @param model The data model for the GridWidget.\n     * @param context The context of the render phase.\n     * @param rendererHelper Helper for rendering.\n     * @param renderingInformation Calculated rendering information supporting rendering.\n     * @return Commands that add the \"body\".\n     */\n    List<RendererCommand> renderBody(final GridData model,\n                                     final GridBodyRenderContext context,\n                                     final BaseGridRendererHelper rendererHelper,\n                                     final BaseGridRendererHelper.RenderingInformation renderingInformation);\n\n    /**\n     * Renders a divider between Grid header and body. The divider must be positioned in the Group relative to the\n     * top-left of the Grid itself; i.e. horizontal lines will need have y-coordinate {@link GridRenderer#getHeaderHeight()}.\n     * The returned Group itself is not positioned when added to the Grid. This is to support different types of divider\n     * that may need to be positioned at a y-coordinate different to {@link GridRenderer#getHeaderHeight()}.\n     * @param width The width of the divider. May not be the width of the whole grid if there are floating columns.\n     * @return A Group containing the divider positioned relative to the top-left of the Grid.\n     */\n    RendererCommand renderHeaderBodyDivider(final double width);\n\n    /**\n     * Renders a boundary around the grid.\n     * @param context The context of the render phase.\n     * @return A command that adds the grids \"boundary\".\n     */\n    RendererCommand renderGridBoundary(final GridBoundaryRenderContext context);\n\n    /**\n     * Checks whether a cell-relative coordinate is \"on\" the hot-spot to toggle the collapsed/expanded state.\n     * @param cellX The MouseEvent relative to the cell's x-coordinate.\n     * @param cellY The MouseEvent relative to the cell's y-coordinate.\n     * @param cellWidth Width of the containing cell.\n     * @param cellHeight Height of the containing cell.\n     * @return true if the cell coordinate is on the hot-spot.\n     */\n    boolean onGroupingToggle(final double cellX,\n                             final double cellY,\n                             final double cellWidth,\n                             final double cellHeight);\n\n    /**\n     * Sets the constraint to control rendering of columns. The default implementation does not render to\n     * the SelectionLayer as a performance optimisation and only their basic definition, e.g. size, background\n     * colour, grid is rendered to support selection. Nested tables need to be rendered to the SelectionLayer\n     * to support their selection and other User interactions.\n     * @param columnRenderingConstraint\n     */\n    void setColumnRenderConstraint(final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/SelectionsTransformer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.SelectedRange;\n\n/**\n * Helper functions to convert SelectedCells into SelectedRanges.\n */\npublic interface SelectionsTransformer {\n\n    List<SelectedRange> transformToSelectedRanges(final List<GridData.SelectedCell> selectedCells);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRenderer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Point2DArray;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * A renderer that only renders the visible columns and rows of merged data. This implementation\n * can render the data either in a merged state or non-merged state.\n */\npublic class BaseGridRenderer implements GridRenderer {\n\n    private static final int HEADER_HEIGHT = 64;\n\n    private static final int HEADER_ROW_HEIGHT = 32;\n\n    private static final String LINK_FONT_FAMILY = \"Glyphicons Halflings\";\n\n    private static final double LINK_FONT_SIZE = 10.0;\n\n    private static final String LINK_ICON = \"\\ue144\";\n\n    private Integer highlightCellColumnIndex;\n\n    private Integer highlightCellRowIndex;\n\n    protected GridRendererTheme theme;\n\n    protected BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint = (isSelectionLayer, gridColumn) -> !isSelectionLayer;\n\n    public BaseGridRenderer(final GridRendererTheme theme) {\n        setTheme(theme);\n    }\n\n    @Override\n    public double getHeaderHeight() {\n        return HEADER_HEIGHT;\n    }\n\n    @Override\n    public double getHeaderRowHeight() {\n        return HEADER_ROW_HEIGHT;\n    }\n\n    @Override\n    public GridRendererTheme getTheme() {\n        return theme;\n    }\n\n    @Override\n    public void setTheme(final GridRendererTheme theme) {\n        this.theme = Objects.requireNonNull(theme, \"theme\");\n    }\n\n    @Override\n    public RendererCommand renderSelector(final double width,\n                                          final double height,\n                                          final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        return (RenderSelectorCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                final MultiPath selector = theme.getSelector()\n                        .M(0.5, 0.5)\n                        .L(0.5, height)\n                        .L(width, height)\n                        .L(width, 0.5)\n                        .L(0.5, 0.5)\n                        .setListening(false);\n                rc.getGroup().add(selector);\n            }\n        };\n    }\n\n    @Override\n    public RendererCommand renderSelectedCells(final GridData model,\n                                               final GridBodyRenderContext context,\n                                               final BaseGridRendererHelper rendererHelper,\n                                               final List<GridData.SelectedCell> selectedCells,\n                                               final BiFunction<SelectedRange, Integer, Double> selectedCellsYOffsetStrategy,\n                                               final Function<SelectedRange, Double> selectedCellsHeightStrategy) {\n        return (RenderSelectedCellsCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n\n                final List<GridColumn<?>> blockColumns = context.getBlockColumns();\n                final SelectionsTransformer transformer = context.getTransformer();\n                final double gridLineStrokeWidth = theme.getBodyGridLine().getStrokeWidth();\n                final double selectorStrokeWidth = theme.getCellSelectorBorder().getStrokeWidth();\n                final int minVisibleUiColumnIndex = model.getColumns().indexOf(blockColumns.get(0));\n                final int maxVisibleUiColumnIndex = model.getColumns().indexOf(blockColumns.get(blockColumns.size() - 1));\n                final int minVisibleUiRowIndex = context.getMinVisibleRowIndex();\n                final int maxVisibleUiRowIndex = context.getMaxVisibleRowIndex();\n\n                //Convert SelectedCells into SelectedRanges, i.e. group them into rectangular ranges\n                final List<SelectedRange> selectedRanges = transformer.transformToSelectedRanges(selectedCells);\n\n                final Group g = new Group();\n                for (SelectedRange selectedRange : selectedRanges) {\n                    final int rangeOriginUiColumnIndex = selectedRange.getUiColumnIndex();\n                    final int rangeOriginUiRowIndex = selectedRange.getUiRowIndex();\n                    final int rangeUiWidth = selectedRange.getWidth();\n                    final int rangeUiHeight = selectedRange.getHeight();\n\n                    //Only render range highlights if they're at least partially visible\n                    if (rangeOriginUiColumnIndex + rangeUiWidth - 1 < minVisibleUiColumnIndex) {\n                        continue;\n                    }\n                    if (rangeOriginUiColumnIndex > maxVisibleUiColumnIndex) {\n                        continue;\n                    }\n                    if (rangeOriginUiRowIndex + rangeUiHeight - 1 < minVisibleUiRowIndex) {\n                        continue;\n                    }\n                    if (rangeOriginUiRowIndex > maxVisibleUiRowIndex) {\n                        continue;\n                    }\n\n                    //Clip range to visible bounds\n                    SelectedRange _selectedRange = selectedRange;\n                    if (rangeOriginUiRowIndex < minVisibleUiRowIndex) {\n                        final int dy = minVisibleUiRowIndex - rangeOriginUiRowIndex;\n                        _selectedRange = new SelectedRange(selectedRange.getUiRowIndex() + dy,\n                                                           selectedRange.getUiColumnIndex(),\n                                                           selectedRange.getWidth(),\n                                                           selectedRange.getHeight() - dy);\n                    }\n\n                    final Group cs = renderSelectedRange(blockColumns,\n                                                         minVisibleUiColumnIndex,\n                                                         _selectedRange,\n                                                         selectedCellsHeightStrategy);\n                    if (cs != null) {\n                        final double csx = rendererHelper.getColumnOffset(blockColumns,\n                                                                          _selectedRange.getUiColumnIndex() - minVisibleUiColumnIndex);\n                        final double csy = selectedCellsYOffsetStrategy.apply(_selectedRange, minVisibleUiRowIndex);\n                        cs.setX(csx + gridLineStrokeWidth + (selectorStrokeWidth / 2))\n                                .setY(csy + gridLineStrokeWidth + (selectorStrokeWidth / 2))\n                                .setListening(false);\n                        g.add(cs);\n                    }\n                }\n                rc.getGroup().add(g);\n            }\n        };\n    }\n\n    protected Group renderSelectedRange(final List<GridColumn<?>> blockColumns,\n                                        final int minVisibleUiColumnIndex,\n                                        final SelectedRange selectedRange,\n                                        final Function<SelectedRange, Double> selectedCellsHeightStrategy) {\n        final Group cellSelector = new Group();\n        final double gridLineStrokeWidth = theme.getBodyGridLine().getStrokeWidth();\n        final double selectorStrokeWidth = theme.getCellSelectorBorder().getStrokeWidth();\n        final double width = getSelectedRangeWidth(blockColumns,\n                                                   minVisibleUiColumnIndex,\n                                                   selectedRange) - (gridLineStrokeWidth + selectorStrokeWidth);\n        final double height = selectedCellsHeightStrategy.apply(selectedRange) - (gridLineStrokeWidth + selectorStrokeWidth);\n        final Rectangle selector = theme.getCellSelectorBorder()\n                .setWidth(width)\n                .setHeight(height)\n                .setListening(false);\n\n        final Rectangle highlight = theme.getCellSelectorBackground()\n                .setWidth(width)\n                .setHeight(height)\n                .setListening(false);\n\n        cellSelector.add(highlight);\n        cellSelector.add(selector);\n\n        return cellSelector;\n    }\n\n    double getSelectedRangeWidth(final List<GridColumn<?>> blockColumns,\n                                 final int minVisibleUiColumnIndex,\n                                 final SelectedRange selectedRange) {\n        double width = 0;\n        for (int columnIndex = 0; columnIndex < selectedRange.getWidth(); columnIndex++) {\n            final int relativeColumnIndex = columnIndex + selectedRange.getUiColumnIndex() - minVisibleUiColumnIndex;\n            final GridColumn<?> uiColumn = blockColumns.get(relativeColumnIndex);\n            if (uiColumn.isVisible()) {\n                width = width + uiColumn.getWidth();\n            }\n        }\n        return width;\n    }\n\n    @Override\n    public List<RendererCommand> renderHeader(final GridData model,\n                                              final GridHeaderRenderContext context,\n                                              final BaseGridRendererHelper rendererHelper,\n                                              final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final List<RendererCommand> commands = new ArrayList<>();\n        final int headerRowCount = renderingInformation.getHeaderRowCount();\n        if (headerRowCount == 0) {\n            return commands;\n        }\n\n        final List<GridColumn<?>> allBlockColumns = context.getAllColumns();\n        final List<GridColumn<?>> visibleBlockColumns = context.getBlockColumns();\n        final double headerRowsHeight = renderingInformation.getHeaderRowsHeight();\n        final double headerRowsYOffset = renderingInformation.getHeaderRowsYOffset();\n\n        //Column backgrounds\n        double cx = 0;\n        for (final GridColumn<?> column : visibleBlockColumns) {\n            if (column.isVisible()) {\n                final double x = cx;\n                final double w = column.getWidth();\n                Rectangle header;\n                if (column.isLinked()) {\n                    header = theme.getHeaderLinkBackground(column);\n                } else {\n                    header = theme.getHeaderBackground(column);\n                }\n                if (header != null) {\n                    commands.add((RenderHeaderBackgroundCommand) (rc) -> {\n                        if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) {\n                            header.setWidth(w)\n                                    .setListening(true)\n                                    .setHeight(headerRowsHeight)\n                                    .setY(headerRowsYOffset)\n                                    .setX(x);\n                            rc.getGroup().add(header);\n                        }\n                    });\n                }\n                cx = cx + w;\n            }\n        }\n\n        //Column title and grid lines\n        cx = 0;\n        for (final GridColumn<?> column : visibleBlockColumns) {\n            if (column.isVisible()) {\n                final double columnWidth = column.getWidth();\n\n                final int columnIndex = visibleBlockColumns.indexOf(column);\n                final GridHeaderColumnRenderContext headerCellRenderContext = new GridHeaderColumnRenderContext(cx,\n                                                                                                                allBlockColumns,\n                                                                                                                visibleBlockColumns,\n                                                                                                                columnIndex,\n                                                                                                                model,\n                                                                                                                this);\n\n                commands.addAll(column.getColumnRenderer().renderHeader(column.getHeaderMetaData(),\n                                                                        headerCellRenderContext,\n                                                                        renderingInformation,\n                                                                        columnRenderingConstraint));\n                cx = cx + columnWidth;\n            }\n        }\n\n        //Linked column icons\n        cx = 0;\n        for (final GridColumn<?> column : visibleBlockColumns) {\n            if (column.isVisible()) {\n                final double x = cx;\n                final double w = column.getWidth();\n\n                if (column.isLinked()) {\n                    commands.add((RenderHeaderContentCommand) (rc) -> {\n                        if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) {\n                            final Text t = theme.getBodyText()\n                                    .setFontFamily(LINK_FONT_FAMILY)\n                                    .setFontSize(LINK_FONT_SIZE)\n                                    .setText(LINK_ICON)\n                                    .setY(headerRowsYOffset + LINK_FONT_SIZE)\n                                    .setX(x + w - LINK_FONT_SIZE);\n                            rc.getGroup().add(t);\n                        }\n                    });\n                }\n                cx = cx + w;\n            }\n        }\n\n        //Divider between header and body\n        commands.add(renderHeaderBodyDivider(rendererHelper.getWidth(visibleBlockColumns)));\n\n        return commands;\n    }\n\n    @Override\n    public RendererCommand renderHeaderBodyDivider(final double width) {\n        return (RenderHeaderGridLinesCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                final Line divider = theme.getGridHeaderBodyDivider();\n                divider.setPoints(new Point2DArray(new Point2D(0,\n                                                               getHeaderHeight() + 0.5),\n                                                   new Point2D(width,\n                                                               getHeaderHeight() + 0.5)));\n                rc.getGroup().add(divider);\n            }\n        };\n    }\n\n    @Override\n    public List<RendererCommand> renderBody(final GridData model,\n                                            final GridBodyRenderContext context,\n                                            final BaseGridRendererHelper rendererHelper,\n                                            final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n        final List<RendererCommand> commands = new ArrayList<>();\n\n        final double absoluteGridX = context.getAbsoluteGridX();\n        final double absoluteGridY = context.getAbsoluteGridY();\n        final double absoluteColumnOffsetX = context.getAbsoluteColumnOffsetX();\n        final double clipMinY = context.getClipMinY();\n        final double clipMinX = context.getClipMinX();\n        final int minVisibleRowIndex = context.getMinVisibleRowIndex();\n        final int maxVisibleRowIndex = context.getMaxVisibleRowIndex();\n        final List<GridColumn<?>> blockColumns = context.getBlockColumns();\n        final Transform transform = context.getTransform();\n        final GridRenderer renderer = context.getRenderer();\n\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final List<Double> visibleRowOffsets = renderingInformation.getVisibleRowOffsets();\n\n        final double columnHeight = visibleRowOffsets.get(maxVisibleRowIndex - minVisibleRowIndex) - visibleRowOffsets.get(0) + allRowHeights.get(maxVisibleRowIndex);\n\n        //Column backgrounds\n        double cx = 0;\n        for (final GridColumn<?> column : blockColumns) {\n            if (column.isVisible()) {\n                final double x = cx;\n                final double columnWidth = column.getWidth();\n\n                commands.add((RenderBodyGridBackgroundCommand) (rc) -> {\n                    if (columnRenderingConstraint.apply(rc.isSelectionLayer(), column)) {\n                        final Rectangle body = theme.getBodyBackground(column)\n                                .setWidth(columnWidth)\n                                .setListening(true)\n                                .setHeight(columnHeight)\n                                .setX(x);\n                        rc.getGroup().add(body);\n                    }\n                });\n                cx = cx + columnWidth;\n            }\n        }\n\n        //Column content and grid lines\n        cx = 0;\n        for (GridColumn<?> column : blockColumns) {\n            if (column.isVisible()) {\n                final double columnWidth = column.getWidth();\n\n                final double columnRelativeX = rendererHelper.getColumnOffset(blockColumns,\n                                                                              blockColumns.indexOf(column)) + absoluteColumnOffsetX;\n                final boolean isFloating = floatingBlockInformation.getColumns().contains(column);\n                final GridBodyColumnRenderContext columnContext = new GridBodyColumnRenderContext(cx,\n                                                                                                  absoluteGridX,\n                                                                                                  absoluteGridY,\n                                                                                                  absoluteGridX + columnRelativeX,\n                                                                                                  clipMinY,\n                                                                                                  clipMinX,\n                                                                                                  minVisibleRowIndex,\n                                                                                                  maxVisibleRowIndex,\n                                                                                                  isFloating,\n                                                                                                  model,\n                                                                                                  transform,\n                                                                                                  renderer);\n\n                commands.addAll(column.getColumnRenderer().renderColumn(column,\n                                                                        columnContext,\n                                                                        rendererHelper,\n                                                                        renderingInformation,\n                                                                        columnRenderingConstraint));\n                cx = cx + columnWidth;\n            }\n        }\n\n        addRenderHighlightedCellsCommand(model, context, rendererHelper, renderingInformation, commands);\n\n        return commands;\n    }\n\n    void addRenderHighlightedCellsCommand(final GridData model,\n                                          final GridBodyRenderContext context,\n                                          final BaseGridRendererHelper rendererHelper,\n                                          final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                          final List<RendererCommand> commands) {\n        if (!Objects.isNull(getHighlightCellColumnIndex()) && !Objects.isNull(getHighlightCellRowIndex())) {\n            commands.add(renderHighlightedCells(model,\n                                                context,\n                                                rendererHelper,\n                                                renderingInformation));\n        }\n    }\n\n    @Override\n    public RendererCommand renderGridBoundary(final GridBoundaryRenderContext context) {\n        return (RenderGridBoundaryCommand) (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                final double x = context.getX();\n                final double y = context.getY();\n                final double width = context.getWidth();\n                final double height = context.getHeight();\n\n                final Rectangle boundary = theme.getGridBoundary()\n                        .setWidth(width)\n                        .setHeight(height)\n                        .setListening(false)\n                        .setX(x + 0.5)\n                        .setY(y + 0.5);\n\n                rc.getGroup().add(boundary);\n            }\n        };\n    }\n\n    @Override\n    public boolean onGroupingToggle(double cellX,\n                                    double cellY,\n                                    double cellWidth,\n                                    double cellHeight) {\n        return GroupingToggle.onHotSpot(cellX,\n                                        cellY,\n                                        cellWidth,\n                                        cellHeight);\n    }\n\n    @Override\n    public void setColumnRenderConstraint(final BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint) {\n        this.columnRenderingConstraint = columnRenderingConstraint;\n    }\n\n    public void clearCellHighlight() {\n        highlightCellColumnIndex = null;\n        highlightCellRowIndex = null;\n    }\n\n    public void highlightCell(final int column, final int row) {\n        highlightCellColumnIndex = column;\n        highlightCellRowIndex = row;\n    }\n\n    public Integer getHighlightCellColumnIndex() {\n        return highlightCellColumnIndex;\n    }\n\n    public Integer getHighlightCellRowIndex() {\n        return highlightCellRowIndex;\n    }\n\n    RendererCommand renderHighlightedCells(final GridData model,\n                                           final GridBodyRenderContext context,\n                                           final BaseGridRendererHelper rendererHelper,\n                                           final BaseGridRendererHelper.RenderingInformation renderingInformation) {\n\n        final GridColumn<?> column = model.getColumns().get(getHighlightCellColumnIndex());\n\n        final int visibleRowIndex = getHighlightCellRowIndex() - renderingInformation.getMinVisibleRowIndex();\n\n        return getRendererCommand(model,\n                                  context,\n                                  rendererHelper,\n                                  renderingInformation,\n                                  column,\n                                  visibleRowIndex);\n    }\n\n    RendererCommand getRendererCommand(final GridData model,\n                                       final GridBodyRenderContext context,\n                                       final BaseGridRendererHelper rendererHelper,\n                                       final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                       final GridColumn<?> column,\n                                       final int visibleRowIndex) {\n        return (rc) -> {\n            if (!rc.isSelectionLayer()) {\n                if (model.getColumns().size() >= 1) {\n\n                    rc.getGroup().add(makeCellHighlight(getHighlightCellRowIndex(),\n                                                        visibleRowIndex,\n                                                        model,\n                                                        rendererHelper,\n                                                        renderingInformation,\n                                                        column,\n                                                        context));\n                }\n            }\n        };\n    }\n\n    Rectangle makeCellHighlight(final int rowIndex,\n                                final int visibleRowIndex,\n                                final GridData model,\n                                final BaseGridRendererHelper rendererHelper,\n                                final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                final GridColumn<?> column,\n                                final GridBodyRenderContext context) {\n\n        final Rectangle r = getTheme().getHighlightedCellBackground().setListening(false);\n        setCellHighlightX(r, context, rendererHelper);\n        setCellHighlightY(r, rendererHelper, visibleRowIndex, model);\n        setCellHighlightSize(r, model, column, renderingInformation.getAllRowHeights(), rowIndex);\n        return r;\n    }\n\n    void setCellHighlightY(final Rectangle r,\n                           final BaseGridRendererHelper rendererHelper,\n                           final int visibleRowIndex,\n                           final GridData model) {\n\n        final GridCell<?> cell = model.getCell(getHighlightCellRowIndex(), getHighlightCellColumnIndex());\n\n        if (!cell.isMerged()) {\n            r.setY(rendererHelper.getRowOffset(visibleRowIndex));\n        } else {\n            int firstRowOfMergedBlock = getFirstRowIndexOfMergedBlock(model, visibleRowIndex);\n            r.setY(rendererHelper.getRowOffset(firstRowOfMergedBlock));\n        }\n    }\n\n    int getFirstRowIndexOfMergedBlock(final GridData model, final int rowIndex) {\n\n        int currentIndex = rowIndex;\n        GridCell<?> cell = model.getCell(rowIndex, getHighlightCellColumnIndex());\n        while (cell.getMergedCellCount() == 0 && currentIndex >= 0) {\n            currentIndex--;\n            cell = model.getCell(currentIndex, getHighlightCellColumnIndex());\n        }\n\n        return currentIndex;\n    }\n\n    void setCellHighlightX(final Rectangle r,\n                           final GridBodyRenderContext context,\n                           final BaseGridRendererHelper rendererHelper) {\n\n        double columnOffsetX = context.getAbsoluteColumnOffsetX();\n        double x = rendererHelper.getColumnOffset(getHighlightCellColumnIndex()) - columnOffsetX;\n        r.setX(x);\n    }\n\n    void setCellHighlightSize(final Rectangle rectangle,\n                              final GridData model,\n                              final GridColumn<?> column,\n                              final List<Double> allRowHeights,\n                              final int rowIndex) {\n\n        final double width = column.getWidth();\n        rectangle.setWidth(width);\n\n        final int mergedCellsCount = getMergedCellsCount(model, rowIndex);\n        rectangle.setHeight(allRowHeights.get(rowIndex) * mergedCellsCount);\n    }\n\n    int getMergedCellsCount(final GridData model,\n                            final int rowIndex) {\n\n        int currentIndex = rowIndex;\n        GridCell<?> cell = model.getCell(rowIndex, getHighlightCellColumnIndex());\n        while (cell.getMergedCellCount() == 0 && currentIndex >= 0) {\n            currentIndex--;\n            cell = model.getCell(currentIndex, getHighlightCellColumnIndex());\n        }\n\n        return cell.getMergedCellCount();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.logging.Logger;\n\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.uberfire.ext.wires.core.grids.client.util.Logging.log;\n\n/**\n * Helper for rendering a grid.\n */\npublic class BaseGridRendererHelper {\n\n    private static final Logger LOGGER = Logger.getLogger(BaseGridRendererHelper.class.getName());\n\n    private final GridWidget view;\n\n    public BaseGridRendererHelper(final GridWidget view) {\n        this.view = Objects.requireNonNull(view, \"view\");\n    }\n\n    /**\n     * Get the x-offset for a given Column in the model relative to zero.\n     * @param column The GridColumn.\n     * @return\n     */\n    public double getColumnOffset(final GridColumn<?> column) {\n        final GridData model = view.getModel();\n        final int columnIndex = model.getColumns().indexOf(column);\n        if (columnIndex == -1) {\n            return 0;\n        }\n        return getColumnOffset(columnIndex);\n    }\n\n    /**\n     * Get the x-offset for a given Column index in the model relative to zero.\n     * @param columnIndex The index of the GridColumn.\n     * @return\n     */\n    public double getColumnOffset(final int columnIndex) {\n        double columnOffset = 0;\n        final GridData model = view.getModel();\n        final List<GridColumn<?>> columns = model.getColumns();\n        for (int i = 0; i < columnIndex; i++) {\n            final GridColumn column = columns.get(i);\n            if (column.isVisible()) {\n                columnOffset = columnOffset + column.getWidth();\n            }\n        }\n        return columnOffset;\n    }\n\n    /**\n     * Get the x-offset for a given Column index in a list of Columns relative to zero.\n     * @param columns\n     * @param columnIndex\n     * @return\n     */\n    public double getColumnOffset(final List<GridColumn<?>> columns,\n                                  final int columnIndex) {\n        double columnOffset = 0;\n        for (int idx = 0; idx < columnIndex; idx++) {\n            final GridColumn<?> column = columns.get(idx);\n            if (column.isVisible()) {\n                columnOffset = columnOffset + column.getWidth();\n            }\n        }\n        return columnOffset;\n    }\n\n    /**\n     * Get the y-offset for a given Row.\n     * @param row The GridRow.\n     * @return\n     */\n    public double getRowOffset(final GridRow row) {\n        final GridData model = view.getModel();\n        final int rowIndex = model.getRows().indexOf(row);\n        return getRowOffset(rowIndex);\n    }\n\n    /**\n     * Get the y-offset for a given Row index.\n     * @param rowIndex The index of the GridRow.\n     * @return\n     */\n    public double getRowOffset(final int rowIndex) {\n        double rowOffset = 0;\n        final GridData model = view.getModel();\n        for (int i = 0; i < rowIndex; i++) {\n            final GridRow row = model.getRow(i);\n            rowOffset = rowOffset + row.getHeight();\n        }\n        return rowOffset;\n    }\n\n    public double getRowOffset(final GridRow row,\n                               final List<Double> rowHeights) {\n        final GridData model = view.getModel();\n        final int rowIndex = model.getRows().indexOf(row);\n        return getRowOffset(rowIndex, rowHeights);\n    }\n\n    public double getRowOffset(final int rowIndex,\n                               final List<Double> rowHeights) {\n        double rowOffset = 0;\n        for (int i = 0; i < rowIndex; i++) {\n            rowOffset = rowOffset + rowHeights.get(i);\n        }\n        return rowOffset;\n    }\n\n    /**\n     * Get the width of a set of columns, ignoring hidden columns.\n     * @param columns The columns.\n     * @return\n     */\n    public double getWidth(final List<GridColumn<?>> columns) {\n        double width = 0;\n        for (GridColumn<?> column : columns) {\n            if (column.isVisible()) {\n                width = width + column.getWidth();\n            }\n        }\n        return width;\n    }\n\n    /**\n     * Get rendering information about which columns are floating, which are visible. This method never returns null.\n     * It returns a RenderingInformation object representing the columns that are visible and/or floating.\n     * @return A RenderingInformation object or null if the GridWidget is not even partially visible.\n     */\n    public RenderingInformation getRenderingInformation() {\n        final GridData model = view.getModel();\n        final Bounds bounds = getVisibleBounds();\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final List<GridColumn<?>> bodyColumns = new ArrayList<>();\n        final List<GridColumn<?>> floatingColumns = new ArrayList<>();\n\n        double viewHeight = 0;\n        final int rowCount = model.getRowCount();\n        final List<Double> rowHeights = new ArrayList<>();\n        for (GridRow row : model.getRows()) {\n            final double rowHeight = row.getHeight();\n            viewHeight = viewHeight + rowHeight;\n            rowHeights.add(rowHeight);\n        }\n\n        final double vpX = bounds.getX();\n        final double vpY = bounds.getY();\n        final double vpWidth = bounds.getWidth();\n        final double vpHeight = bounds.getHeight();\n        final double headerOffsetY = getHeaderOffsetY();\n        final GridRenderer renderer = view.getRenderer();\n\n        //Simple bounds check\n        if (view.getComputedLocation().getX() > vpX + vpWidth) {\n            return null;\n        } else if (view.getComputedLocation().getX() + view.getWidth() < vpX) {\n            return null;\n        } else if (view.getComputedLocation().getY() > vpY + vpHeight) {\n            return null;\n        } else if (view.getComputedLocation().getY() + viewHeight < vpY) {\n            return null;\n        }\n\n        //Identify type of header\n        boolean isFixedHeader = false;\n        boolean isFloatingHeader = false;\n        if (view.isSelected()) {\n            if (view.getComputedLocation().getY() < vpY) {\n                //GridWidget is selected and clipped at the top\n                if (view.getComputedLocation().getY() + viewHeight > vpY + renderer.getHeaderHeight()) {\n                    //GridWidget is taller than the Header; add floating header\n                    isFloatingHeader = true;\n                } else {\n                    //GridWidget is shorter than the Header; add fixed header\n                    isFixedHeader = true;\n                }\n            } else if (view.getComputedLocation().getY() <= vpY + vpHeight) {\n                //GridWidget is selected and not clipped at the top; add fixed header\n                isFixedHeader = true;\n            }\n        } else if (view.getComputedLocation().getY() + renderer.getHeaderHeight() > vpY && view.getComputedLocation().getY() < vpY + vpHeight) {\n            //GridWidget is not selected; add fixed header\n            isFixedHeader = true;\n        }\n\n        //Identify rows to render\n        long currentTimeMillis = log(LOGGER, \" - Pre- identify rows to render\");\n\n        int minVisibleRowIndex = 0;\n        if (model.getRowCount() > 0) {\n            double clipTop = vpY - view.getComputedLocation().getY() - (isFloatingHeader ? 0.0 : renderer.getHeaderHeight());\n            while (rowHeights.get(minVisibleRowIndex) < clipTop && minVisibleRowIndex < rowCount - 1) {\n                clipTop = clipTop - rowHeights.get(minVisibleRowIndex);\n                minVisibleRowIndex++;\n            }\n        }\n\n        int maxVisibleRowIndex = minVisibleRowIndex;\n        if (model.getRowCount() > 0) {\n            double clipBottom = vpY - view.getComputedLocation().getY() - renderer.getHeaderHeight() + vpHeight - getRowOffset(minVisibleRowIndex, rowHeights);\n            while (rowHeights.get(maxVisibleRowIndex) < clipBottom && maxVisibleRowIndex < rowCount - 1) {\n                clipBottom = clipBottom - rowHeights.get(maxVisibleRowIndex);\n                maxVisibleRowIndex++;\n            }\n        }\n        log(LOGGER, \" - Post- identify rows to render\", currentTimeMillis);\n\n        //Identify columns to render\n        currentTimeMillis = log(LOGGER, \" - Pre- identify columns to render\");\n\n        double x = 0;\n        for (GridColumn<?> column : model.getColumns()) {\n            allColumns.add(column);\n            final double floatingColumnsWidth = getWidth(floatingColumns);\n            if (view.getComputedLocation().getX() + x + column.getWidth() >= vpX + floatingColumnsWidth) {\n                if (view.getComputedLocation().getX() + x < vpX + vpWidth) {\n                    bodyColumns.add(column);\n                }\n            }\n            if (view.isSelected()) {\n                if (column.isFloatable()) {\n                    if (view.getComputedLocation().getX() + x < vpX + floatingColumnsWidth) {\n                        allColumns.remove(column);\n                        bodyColumns.remove(column);\n                        floatingColumns.add(column);\n                    }\n                }\n            }\n            if (column.isVisible()) {\n                x = x + column.getWidth();\n            }\n        }\n\n        //If the floating columns obscure the body columns remove the float and just show the body columns\n        if (view.getComputedLocation().getX() + x - vpX < getWidth(floatingColumns)) {\n            allColumns.clear();\n            bodyColumns.clear();\n            floatingColumns.clear();\n            allColumns.addAll(model.getColumns());\n\n            x = 0;\n            for (GridColumn<?> column : model.getColumns()) {\n                if (view.getComputedLocation().getX() + x + column.getWidth() >= vpX) {\n                    if (view.getComputedLocation().getX() + x < vpX + vpWidth) {\n                        bodyColumns.add(column);\n                    }\n                }\n                if (column.isVisible()) {\n                    x = x + column.getWidth();\n                }\n            }\n        }\n        log(LOGGER, \" - Post- identify columns to render\", currentTimeMillis);\n\n        //Construct details of Floating and Body blocks\n        double visibleRowOffset = getRowOffset(minVisibleRowIndex, rowHeights);\n        final double bodyOffsetY = visibleRowOffset + renderer.getHeaderHeight();\n        final double offsetX = (bodyColumns.size() > 0 ? getColumnOffset(bodyColumns.get(0)) : 0);\n        final double floatingOffsetX = getFloatingColumnOffset();\n\n        final RenderingBlockInformation bodyBlockInformation = new RenderingBlockInformation(bodyColumns,\n                                                                                             offsetX,\n                                                                                             headerOffsetY,\n                                                                                             bodyOffsetY,\n                                                                                             getWidth(bodyColumns));\n        final RenderingBlockInformation floatingBlockInformation = new RenderingBlockInformation(floatingColumns,\n                                                                                                 floatingOffsetX,\n                                                                                                 headerOffsetY,\n                                                                                                 bodyOffsetY,\n                                                                                                 getWidth(floatingColumns));\n\n        // Construct \"row offsets\". The row offsets are based from zero; for each row to be rendered.\n        // The minVisibleRowIndex corresponds to index zero and maxVisibleRowIndex corresponds to visibleRowOffsets.size() - 1.\n        // This is useful to calculate the Y co-ordinate of each Row's top. It is calculated once and passed to\n        // each column as an optimisation to prevent each column from recalculating the same values.\n        currentTimeMillis = log(LOGGER, \" - Pre- calculate row offsets\");\n\n        final List<Double> visibleRowOffsets = new ArrayList<>();\n        if (model.getRowCount() > 0) {\n            for (int rowIndex = minVisibleRowIndex; rowIndex <= maxVisibleRowIndex; rowIndex++) {\n                visibleRowOffsets.add(visibleRowOffset);\n                visibleRowOffset = visibleRowOffset + rowHeights.get(rowIndex);\n            }\n        }\n        log(LOGGER, \" - Post- calculate row offsets\", currentTimeMillis);\n\n        final int headerRowCount = model.getHeaderRowCount();\n        final double headerHeight = renderer.getHeaderHeight();\n        final double headerRowHeight = renderer.getHeaderRowHeight();\n        final double headerRowsHeight = headerRowHeight * headerRowCount;\n        final double headerRowsYOffset = headerHeight - headerRowsHeight;\n\n        //Finally return all rendering information\n        return new RenderingInformation(bounds,\n                                        allColumns,\n                                        bodyBlockInformation,\n                                        floatingBlockInformation,\n                                        minVisibleRowIndex,\n                                        maxVisibleRowIndex,\n                                        rowHeights,\n                                        visibleRowOffsets,\n                                        isFixedHeader,\n                                        isFloatingHeader,\n                                        headerRowCount,\n                                        headerRowHeight,\n                                        headerRowsHeight,\n                                        headerRowsYOffset);\n    }\n\n    /**\n     * Get information about a column corresponding to a grid-relative x-coordinate. This method never returns null.\n     * It returns a ColumnInformation object representing the column corresponding to the grid-relative x-coordinate;\n     * or an empty ColumnInformation object if no corresponding column was found.\n     * @param cx An x-coordinate relative to the GridWidget.\n     * @return A non-null ColumnInformation object.\n     */\n    public ColumnInformation getColumnInformation(final double cx) {\n        //Gather information on columns\n        final RenderingInformation renderingInformation = getRenderingInformation();\n        if (renderingInformation == null) {\n            return new ColumnInformation();\n        }\n\n        final GridData model = view.getModel();\n        final List<GridColumn<?>> columns = model.getColumns();\n        final RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        //Check floating columns\n        double offsetX = floatingX;\n        GridColumn<?> column = null;\n        for (GridColumn<?> gridColumn : floatingColumns) {\n            if (gridColumn.isVisible()) {\n                final double columnWidth = gridColumn.getWidth();\n                if (cx > offsetX && cx < offsetX + columnWidth) {\n                    column = gridColumn;\n                    break;\n                }\n                offsetX = offsetX + columnWidth;\n            }\n        }\n        if (column != null) {\n            return new ColumnInformation(column,\n                                         columns.indexOf(column),\n                                         offsetX);\n        }\n\n        //Check all other columns\n        offsetX = bodyBlockInformation.getX();\n        for (GridColumn<?> gridColumn : bodyColumns) {\n            if (gridColumn.isVisible()) {\n                final double columnWidth = gridColumn.getWidth();\n                if (offsetX + columnWidth > floatingX + floatingWidth) {\n                    if (cx > offsetX && cx < offsetX + columnWidth) {\n                        column = gridColumn;\n                        break;\n                    }\n                }\n                offsetX = offsetX + columnWidth;\n            }\n        }\n        if (column == null) {\n            return new ColumnInformation();\n        }\n        return new ColumnInformation(column,\n                                     columns.indexOf(column),\n                                     offsetX);\n    }\n\n    /**\n     * Get the visible bounds (canvas coordinate system) of the given GridWidget.\n     * @return\n     */\n    private Bounds getVisibleBounds() {\n        final GridLayer gridLayer = ((GridLayer) view.getLayer());\n        final Bounds bounds = gridLayer.getVisibleBounds();\n        return bounds;\n    }\n\n    /**\n     * Find the x-offset relative to the GridWidget origin where Floating columns are positioned.\n     * @return\n     */\n    private double getFloatingColumnOffset() {\n        final Bounds bounds = getVisibleBounds();\n        return bounds.getX() - view.getComputedLocation().getX();\n    }\n\n    /**\n     * Find the y-offset relative to the GridWidget origin where Floating Header is positioned.\n     * @return\n     */\n    private double getHeaderOffsetY() {\n        final double vpY = getVisibleBounds().getY();\n        if (view.isSelected()) {\n            if (view.getComputedLocation().getY() < vpY && view.getComputedLocation().getY() + view.getHeight() > vpY + view.getRenderer().getHeaderHeight()) {\n                return vpY - view.getComputedLocation().getY();\n            }\n        }\n        return 0.0;\n    }\n\n    /**\n     * A container for Column Information.\n     */\n    public static class ColumnInformation {\n\n        private GridColumn<?> column;\n        private int uiColumnIndex = -1;\n        private double offsetX = -1;\n\n        ColumnInformation() {\n\n        }\n\n        public ColumnInformation(final GridColumn<?> column,\n                                 final int uiColumnIndex,\n                                 final double offsetX) {\n            this.column = column;\n            this.uiColumnIndex = uiColumnIndex;\n            this.offsetX = offsetX;\n        }\n\n        /**\n         * The GridWidget's column corresponding to the grid-relative x-coordinate, or null if none was found.\n         * @return\n         */\n        public GridColumn<?> getColumn() {\n            return column;\n        }\n\n        /**\n         * The index of the GridWidget's column. This is equivalent to columns.indexOf(column).\n         * @return\n         */\n        public int getUiColumnIndex() {\n            return uiColumnIndex;\n        }\n\n        /**\n         * The x-offset of the Column's left-hand edge relative to the GridWidget. i.e. column 0 has an x-offset of 0.\n         * Floating columns canvas position is set dynamically depending on the GridWidget's position and the canvas's\n         * Viewport. Therefore the x-offset of the first floating column is not zero but subject to the Viewport.\n         * @return\n         */\n        public double getOffsetX() {\n            return offsetX;\n        }\n    }\n\n    /**\n     * A container for Rendering Information.\n     */\n    public static class RenderingInformation {\n\n        private final Bounds bounds;\n        private final List<GridColumn<?>> allColumns;\n        private final RenderingBlockInformation bodyBlockInformation;\n        private final RenderingBlockInformation floatingBlockInformation;\n        private final int minVisibleRowIndex;\n        private final int maxVisibleRowIndex;\n        private final List<Double> allRowHeights;\n        private final List<Double> visibleRowOffsets;\n        private final boolean isFixedHeader;\n        private final boolean isFloatingHeader;\n        private final int headerRowCount;\n        private final double headerRowHeight;\n        private final double headerRowsHeight;\n        private final double headerRowsYOffset;\n\n        public RenderingInformation(final Bounds bounds,\n                                    final List<GridColumn<?>> allColumns,\n                                    final RenderingBlockInformation bodyBlockInformation,\n                                    final RenderingBlockInformation floatingBlockInformation,\n                                    final int minVisibleRowIndex,\n                                    final int maxVisibleRowIndex,\n                                    final List<Double> allRowHeights,\n                                    final List<Double> visibleRowOffsets,\n                                    final boolean isFixedHeader,\n                                    final boolean isFloatingHeader,\n                                    final int headerRowCount,\n                                    final double headerRowHeight,\n                                    final double headerRowsHeight,\n                                    final double headerRowsYOffset) {\n            this.bounds = bounds;\n            this.allColumns = allColumns;\n            this.bodyBlockInformation = bodyBlockInformation;\n            this.floatingBlockInformation = floatingBlockInformation;\n            this.minVisibleRowIndex = minVisibleRowIndex;\n            this.maxVisibleRowIndex = maxVisibleRowIndex;\n            this.allRowHeights = allRowHeights;\n            this.visibleRowOffsets = visibleRowOffsets;\n            this.isFixedHeader = isFixedHeader;\n            this.isFloatingHeader = isFloatingHeader;\n            this.headerRowCount = headerRowCount;\n            this.headerRowHeight = headerRowHeight;\n            this.headerRowsHeight = headerRowsHeight;\n            this.headerRowsYOffset = headerRowsYOffset;\n        }\n\n        public Bounds getBounds() {\n            return bounds;\n        }\n\n        public List<GridColumn<?>> getAllColumns() {\n            return allColumns;\n        }\n\n        public RenderingBlockInformation getBodyBlockInformation() {\n            return bodyBlockInformation;\n        }\n\n        public RenderingBlockInformation getFloatingBlockInformation() {\n            return floatingBlockInformation;\n        }\n\n        public int getMinVisibleRowIndex() {\n            return minVisibleRowIndex;\n        }\n\n        public int getMaxVisibleRowIndex() {\n            return maxVisibleRowIndex;\n        }\n\n        public List<Double> getAllRowHeights() {\n            return Collections.unmodifiableList(allRowHeights);\n        }\n\n        public List<Double> getVisibleRowOffsets() {\n            return Collections.unmodifiableList(visibleRowOffsets);\n        }\n\n        public boolean isFixedHeader() {\n            return isFixedHeader;\n        }\n\n        public boolean isFloatingHeader() {\n            return isFloatingHeader;\n        }\n\n        public int getHeaderRowCount() {\n            return headerRowCount;\n        }\n\n        public double getHeaderRowHeight() {\n            return headerRowHeight;\n        }\n\n        public double getHeaderRowsHeight() {\n            return headerRowsHeight;\n        }\n\n        public double getHeaderRowsYOffset() {\n            return headerRowsYOffset;\n        }\n    }\n\n    /**\n     * A container for Rendering Block Information.\n     */\n    public static class RenderingBlockInformation {\n\n        private final List<GridColumn<?>> columns;\n        private final double x;\n        private final double headerY;\n        private final double bodyY;\n        private final double width;\n\n        public RenderingBlockInformation(final List<GridColumn<?>> columns,\n                                         final double x,\n                                         final double headerY,\n                                         final double bodyY,\n                                         final double width) {\n            this.columns = columns;\n            this.x = x;\n            this.headerY = headerY;\n            this.bodyY = bodyY;\n            this.width = width;\n        }\n\n        public List<GridColumn<?>> getColumns() {\n            return Collections.unmodifiableList(columns);\n        }\n\n        public double getX() {\n            return x;\n        }\n\n        public double getHeaderY() {\n            return headerY;\n        }\n\n        public double getBodyY() {\n            return bodyY;\n        }\n\n        public double getWidth() {\n            return width;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/DefaultSelectionsTransformer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.TreeMap;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\n\n/**\n * Helper functions to convert SelectedCells into SelectedRanges.\n */\npublic class DefaultSelectionsTransformer implements SelectionsTransformer {\n\n    protected final GridData model;\n    protected final List<GridColumn<?>> columns;\n\n    public DefaultSelectionsTransformer(final GridData model,\n                                        final List<GridColumn<?>> columns) {\n        this.model = Objects.requireNonNull(model, \"model\");\n        this.columns = Objects.requireNonNull(columns, \"columns\");\n    }\n\n    @Override\n    public List<SelectedRange> transformToSelectedRanges(final List<GridData.SelectedCell> selectedCells) {\n        //Group into vertical ranges translating modelColumnIndexes to uiColumnIndexes\n        int currentUiColumnIndex = -1;\n        SelectedRange currentRange = null;\n        final List<GridData.SelectedCell> orderedSelectedCells = sortSelectedCells(selectedCells);\n        final Map<Integer, List<SelectedRange>> orderedSelectedRanges = new TreeMap<Integer, List<SelectedRange>>();\n\n        for (GridData.SelectedCell selectedCell : orderedSelectedCells) {\n            final int scRowIndex = selectedCell.getRowIndex();\n            final int scColumnIndex = selectedCell.getColumnIndex();\n            final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(getApplicableColumns(),\n                                                                             scColumnIndex);\n            if (uiColumnIndex != currentUiColumnIndex) {\n                storeSelectedRange(orderedSelectedRanges,\n                                   currentRange,\n                                   currentUiColumnIndex);\n                currentUiColumnIndex = uiColumnIndex;\n                currentRange = new SelectedRange(scRowIndex,\n                                                 uiColumnIndex,\n                                                 1,\n                                                 1);\n            } else if (scRowIndex == currentRange.getUiRowIndex() + currentRange.getHeight()) {\n                currentRange.setHeight(currentRange.getHeight() + 1);\n            } else {\n                storeSelectedRange(orderedSelectedRanges,\n                                   currentRange,\n                                   uiColumnIndex);\n                currentRange = new SelectedRange(scRowIndex,\n                                                 uiColumnIndex,\n                                                 1,\n                                                 1);\n            }\n        }\n        storeSelectedRange(orderedSelectedRanges,\n                           currentRange,\n                           currentUiColumnIndex);\n\n        //Group vertical ranges horizontally\n        final int maxColumnIndex = getMaximumColumnIndex(orderedSelectedRanges);\n        for (Map.Entry<Integer, List<SelectedRange>> e : orderedSelectedRanges.entrySet()) {\n            for (SelectedRange selectedRange : e.getValue()) {\n                for (int mergeColumnIndex = e.getKey() + 1; mergeColumnIndex <= maxColumnIndex; mergeColumnIndex++) {\n                    final List<SelectedRange> mergeRanges = orderedSelectedRanges.get(mergeColumnIndex);\n                    if (mergeRanges == null) {\n                        break;\n                    }\n                    final Iterator<SelectedRange> srIterator = mergeRanges.iterator();\n                    while (srIterator.hasNext()) {\n                        final SelectedRange mergeRange = srIterator.next();\n                        if (selectedRange.getUiRowIndex() == mergeRange.getUiRowIndex()) {\n                            if (selectedRange.getUiColumnIndex() + selectedRange.getWidth() == mergeRange.getUiColumnIndex()) {\n                                if (selectedRange.getHeight() == mergeRange.getHeight()) {\n                                    selectedRange.setWidth(selectedRange.getWidth() + 1);\n                                    srIterator.remove();\n                                }\n                            }\n                        }\n                    }\n                }\n            }\n        }\n\n        //Dump into a single list\n        final List<SelectedRange> selectedRanges = new ArrayList<SelectedRange>();\n        for (List<SelectedRange> ranges : orderedSelectedRanges.values()) {\n            selectedRanges.addAll(ranges);\n        }\n\n        return selectedRanges;\n    }\n\n    private int getMaximumColumnIndex(final Map<Integer, List<SelectedRange>> selectedRanges) {\n        int maxColumnIndex = 0;\n        for (Integer idx : selectedRanges.keySet()) {\n            maxColumnIndex = Math.max(maxColumnIndex,\n                                      idx);\n        }\n        return maxColumnIndex;\n    }\n\n    private void storeSelectedRange(final Map<Integer, List<SelectedRange>> orderedSelectedRanges,\n                                    final SelectedRange currentRange,\n                                    final int uiColumnIndex) {\n        if (currentRange != null) {\n            List<SelectedRange> selectedRanges = orderedSelectedRanges.get(uiColumnIndex);\n            if (selectedRanges == null) {\n                selectedRanges = new ArrayList<SelectedRange>();\n                orderedSelectedRanges.put(uiColumnIndex,\n                                          selectedRanges);\n            }\n            selectedRanges.add(currentRange);\n        }\n    }\n\n    protected List<GridColumn<?>> getApplicableColumns() {\n        return model.getColumns();\n    }\n\n    //Sort arbitrary selections by column->row to simplify grouping\n    private List<GridData.SelectedCell> sortSelectedCells(final List<GridData.SelectedCell> selectedCells) {\n        final List<GridData.SelectedCell> _selectedCells = new ArrayList<GridData.SelectedCell>();\n        for (GridData.SelectedCell sc : selectedCells) {\n            if (isSelectionInColumns(sc)) {\n                _selectedCells.add(sc);\n            }\n        }\n        final int rowCount = model.getRowCount();\n        Collections.sort(_selectedCells,\n                         new Comparator<GridData.SelectedCell>() {\n\n                             @Override\n                             public int compare(final GridData.SelectedCell o1,\n                                                final GridData.SelectedCell o2) {\n                                 //(0,0)->0, (1,0)->3, (2,0)->6\n                                 //(0,1)->1, (1,1)->4, (2,1)->7\n                                 //(0,2)->2, (1,2)->5, (2,2)->8\n                                 final int o1Index = o1.getRowIndex() + o1.getColumnIndex() * rowCount;\n                                 final int o2Index = o2.getRowIndex() + o2.getColumnIndex() * rowCount;\n                                 return o1Index - o2Index;\n                             }\n                         });\n        return _selectedCells;\n    }\n\n    private boolean isSelectionInColumns(final GridData.SelectedCell sc) {\n        final int scColumnIndex = sc.getColumnIndex();\n        for (GridColumn<?> column : columns) {\n            final int columnIndex = column.getIndex();\n            if (scColumnIndex == columnIndex) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/FloatingSelectionsTransformer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\n/**\n * Helper functions to convert SelectedCells into SelectedRanges.\n */\npublic class FloatingSelectionsTransformer extends DefaultSelectionsTransformer {\n\n    public FloatingSelectionsTransformer(final GridData model,\n                                         final List<GridColumn<?>> columns) {\n        super(model,\n              columns);\n    }\n\n    @Override\n    protected List<GridColumn<?>> getApplicableColumns() {\n        return columns;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/GroupingToggle.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.ColorName;\n\n/**\n * A in-cell widget representing the state of merged cells; i.e. collapsed or expanded.\n */\npublic class GroupingToggle extends Group {\n\n    private static final String TOGGLE_FONT_FAMILY = \"Glyphicons Halflings\";\n\n    private static final double TOGGLE_FONT_SIZE = 12.0;\n\n    private static final String TOGGLE_ICON_EXPAND = \"\\ue252\";\n\n    private static final String TOGGLE_ICON_COLLAPSE = \"\\ue253\";\n\n    private static final double PADDING = 8;\n\n    private final Text toggle = new Text(\"\",\n                                         TOGGLE_FONT_FAMILY,\n                                         TOGGLE_FONT_SIZE) {{\n        setFillColor(ColorName.GRAY);\n    }};\n\n    /**\n     * Constructor for the widget.\n     * @param cellWidth Width of the containing cell.\n     * @param cellHeight Height of the containing cell.\n     * @param isGrouped true is the cell is collapsed.\n     */\n    @SuppressWarnings(\"unused\")\n    public GroupingToggle(final double cellWidth,\n                          final double cellHeight,\n                          final boolean isGrouped) {\n        toggle.setText(isGrouped ? TOGGLE_ICON_EXPAND : TOGGLE_ICON_COLLAPSE);\n        toggle.setX(cellWidth - TOGGLE_FONT_SIZE - PADDING);\n        toggle.setY(TOGGLE_FONT_SIZE + PADDING);\n        add(toggle);\n    }\n\n    /**\n     * Check whether a cell-relative coordinate is \"on\" the hot-spot to toggle the collapsed/expanded state.\n     * @param cellX The MouseEvent relative to the cell's x-coordinate.\n     * @param cellY The MouseEvent relative to the cell's y-coordinate.\n     * @param cellWidth Width of the containing cell.\n     * @param cellHeight Height of the containing cell.\n     * @return true if the cell coordinate is on the hot-spot.\n     */\n    @SuppressWarnings(\"unused\")\n    public static boolean onHotSpot(final double cellX,\n                                    final double cellY,\n                                    final double cellWidth,\n                                    final double cellHeight) {\n        final double offsetX = cellWidth - TOGGLE_FONT_SIZE - PADDING;\n        if (cellX - offsetX > 0 && cellX - offsetX < TOGGLE_FONT_SIZE) {\n            if (cellY > PADDING && cellY < PADDING + TOGGLE_FONT_SIZE) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/SelectedRange.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\n/**\n * A selected range within the data\n */\npublic class SelectedRange {\n\n    private final int uiRowIndex;\n    private final int uiColumnIndex;\n    private int width;\n    private int height;\n\n    public SelectedRange(final int uiRowIndex,\n                         final int uiColumnIndex) {\n        this(uiRowIndex,\n             uiColumnIndex,\n             1,\n             1);\n    }\n\n    public SelectedRange(final int uiRowIndex,\n                         final int uiColumnIndex,\n                         final int width,\n                         final int height) {\n        this.uiRowIndex = uiRowIndex;\n        this.uiColumnIndex = uiColumnIndex;\n        this.width = width;\n        this.height = height;\n    }\n\n    public int getUiRowIndex() {\n        return uiRowIndex;\n    }\n\n    public int getUiColumnIndex() {\n        return uiColumnIndex;\n    }\n\n    public int getWidth() {\n        return width;\n    }\n\n    public void setWidth(final int width) {\n        this.width = width;\n    }\n\n    public int getHeight() {\n        return height;\n    }\n\n    public void setHeight(final int height) {\n        this.height = height;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof SelectedRange)) {\n            return false;\n        }\n\n        SelectedRange that = (SelectedRange) o;\n\n        if (uiRowIndex != that.uiRowIndex) {\n            return false;\n        }\n        if (uiColumnIndex != that.uiColumnIndex) {\n            return false;\n        }\n        if (width != that.width) {\n            return false;\n        }\n        return height == that.height;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = uiRowIndex;\n        result = ~~result;\n        result = 31 * result + uiColumnIndex;\n        result = ~~result;\n        result = 31 * result + width;\n        result = ~~result;\n        result = 31 * result + height;\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/GridRendererTheme.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport com.ait.lienzo.shared.core.types.TextUnit;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.KIEColours;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.KIEStyles;\n\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.KIEColours.HIGHLIGHTED_CELL_BACKGROUND;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.KIEColours.HIGHLIGHTED_CELL_STROKE;\n\n/**\n * Definition of themes used by a render for the pluggable rendering mechanism.\n */\npublic interface GridRendererTheme {\n\n    /**\n     * Returns a display name for the theme.\n     * @return A name for the theme\n     */\n    String getName();\n\n    /**\n     * Delegates construction of the \"selector\" to sub-classes. All implementations\n     * are to provide a MultiPath to draw around the GridWidget.\n     * @return A {@link MultiPath} for the \"selector\"\n     */\n    MultiPath getSelector();\n\n    /**\n     * Delegates construction of the cell \"selector\" border to sub-classes.\n     * @return A {@link Rectangle} for the cell \"selector\"\n     */\n    Rectangle getCellSelectorBorder();\n\n    /**\n     * Delegates construction of the cell \"selector\" background to sub-classes.\n     * @return A {@link Rectangle} for the cell \"selector\"\n     */\n    Rectangle getCellSelectorBackground();\n\n    /**\n     * Delegates the Header's background Rectangle to sub-classes.\n     * @param column The column being rendered.\n     * @return A {@link Rectangle} for the header's background.\n     */\n    Rectangle getHeaderBackground(final GridColumn<?> column);\n\n    /**\n     * Delegates the Header's background Rectangle, used for \"linked\" columns to sub-classes.\n     * @param column The column being rendered.\n     * @return A {@link Rectangle} for a header's background for a \"linked\" column.\n     */\n    Rectangle getHeaderLinkBackground(final GridColumn<?> column);\n\n    /**\n     * Delegates the Header's grid lines to sub-classes.\n     * @return A {@link MultiPath} to be used to render the header's grid lines.\n     */\n    MultiPath getHeaderGridLine();\n\n    /**\n     * Delegates the Header's Text to sub-classes.\n     * @return A {@link Text} used to render all text in the header.\n     */\n    Text getHeaderText();\n\n    /**\n     * Delegates the Body's background Rectangle to sub-classes.\n     * @param column The column being rendered.\n     * @return A {@link Rectangle} for the body's background.\n     */\n    Rectangle getBodyBackground(final GridColumn<?> column);\n\n    /**\n     * Delegates the Body's grid lines to sub-classes.\n     * @return A {@link MultiPath} to be used to render the body's grid lines.\n     */\n    MultiPath getBodyGridLine();\n\n    /**\n     * Delegates the Body's Text to sub-classes.\n     * @return A {@link Text} used to render all text in the body.\n     */\n    Text getBodyText();\n\n    /**\n     * Delegates construction of the Grids boundary to sub-classes. All implementations\n     * are to provide a Rectangle surrounding the whole GridWidget.\n     * @return A {@link Rectangle} for the Grid's boundary.\n     */\n    Rectangle getGridBoundary();\n\n    /**\n     * Delegates construction of a divider between the Grids header and body to sub-classes.\n     * @return A {@link Line} for the divider.\n     */\n    Line getGridHeaderBodyDivider();\n\n    /**\n     * Delegates the Body's Text to sub-classes.\n     * @return A {@link Text} used to render the placeholder in the body.\n     */\n    default Text getPlaceholderText() {\n        return new Text(\"\")\n                .setFillColor(KIEColours.PLACEHOLDER_COLOR)\n                .setFontSize(KIEStyles.FONT_SIZE)\n                .setFontFamily(KIEStyles.FONT_FAMILY_LABEL)\n                .setFontStyle(KIEStyles.FONT_STYLE_ITALIC)\n                .setTextUnit(TextUnit.PT)\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n    }\n\n    /**\n     * Delegates the highlighted cell background Rectangle to sub-classes.\n     * @return A {@link Rectangle} for the cell's highlight background.\n     */\n    default Rectangle getHighlightedCellBackground() {\n        final Rectangle r = new Rectangle(0, 0);\n        r.setFillColor(HIGHLIGHTED_CELL_BACKGROUND);\n        r.setStrokeWidth(1.0);\n        // We need some alpha because the highlight is draw over the cell content.\n        r.setAlpha(0.3);\n        r.setStrokeColor(HIGHLIGHTED_CELL_STROKE);\n        return r;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/BlueTheme.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.Shadow;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.IsRowDragHandle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * A renderer that draws a predominantly blue GridWidget.\n */\npublic class BlueTheme implements GridRendererTheme {\n\n    @Override\n    public String getName() {\n        return \"Blue\";\n    }\n\n    @Override\n    public MultiPath getSelector() {\n        final MultiPath selector = new MultiPath()\n                .setStrokeWidth(2.0)\n                .setStrokeColor(ColorName.BLUE)\n                .setShadow(new Shadow(ColorName.DARKBLUE,\n                                      4,\n                                      0.0,\n                                      0.0));\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBorder() {\n        final Rectangle selector = new Rectangle(0, 0)\n                .setStrokeColor(ColorName.BLUE)\n                .setStrokeWidth(1.0);\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBackground() {\n        final Rectangle background = new Rectangle(0, 0)\n                .setFillColor(ColorName.BLUE)\n                .setAlpha(0.25);\n        return background;\n    }\n\n    @Override\n    public Rectangle getHeaderBackground(final GridColumn<?> column) {\n        final Rectangle header = new Rectangle(0,\n                                               0)\n                .setFillColor(ColorName.CYAN);\n        return header;\n    }\n\n    @Override\n    public Rectangle getHeaderLinkBackground(final GridColumn<?> column) {\n        final Rectangle link = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.BROWN);\n        return link;\n    }\n\n    @Override\n    public MultiPath getHeaderGridLine() {\n        final MultiPath headerGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return headerGrid;\n    }\n\n    @Override\n    public Text getHeaderText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.DARKBLUE)\n                .setFontSize(12)\n                .setFontStyle(\"bold\")\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getBodyBackground(final GridColumn<?> column) {\n        if (column instanceof IsRowDragHandle) {\n            return getHeaderBackground(column);\n        }\n        final Rectangle body = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.LIGHTCYAN);\n        return body;\n    }\n\n    @Override\n    public MultiPath getBodyGridLine() {\n        final MultiPath bodyGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return bodyGrid;\n    }\n\n    @Override\n    public Text getBodyText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.BLUE)\n                .setFontSize(12)\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getGridBoundary() {\n        final Rectangle boundary = new Rectangle(0,\n                                                 0)\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return boundary;\n    }\n\n    @Override\n    public Line getGridHeaderBodyDivider() {\n        final Line divider = new Line()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return divider;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/GreenTheme.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.Shadow;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.IsRowDragHandle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * A renderer that draws a predominantly green GridWidget.\n */\npublic class GreenTheme implements GridRendererTheme {\n\n    @Override\n    public String getName() {\n        return \"Green\";\n    }\n\n    @Override\n    public MultiPath getSelector() {\n        final MultiPath selector = new MultiPath()\n                .setStrokeWidth(2.0)\n                .setStrokeColor(ColorName.GREEN)\n                .setShadow(new Shadow(ColorName.DARKGREEN,\n                                      4,\n                                      0.0,\n                                      0.0));\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBorder() {\n        final Rectangle selector = new Rectangle(0, 0)\n                .setStrokeColor(ColorName.GREEN)\n                .setStrokeWidth(1.0);\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBackground() {\n        final Rectangle background = new Rectangle(0, 0)\n                .setFillColor(ColorName.GREEN)\n                .setAlpha(0.25);\n        return background;\n    }\n\n    @Override\n    public Rectangle getHeaderBackground(final GridColumn<?> column) {\n        final Rectangle header = new Rectangle(0,\n                                               0)\n                .setFillColor(ColorName.LAWNGREEN);\n        return header;\n    }\n\n    @Override\n    public Rectangle getHeaderLinkBackground(final GridColumn<?> column) {\n        final Rectangle link = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.BROWN);\n        return link;\n    }\n\n    @Override\n    public MultiPath getHeaderGridLine() {\n        final MultiPath headerGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return headerGrid;\n    }\n\n    @Override\n    public Text getHeaderText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.DARKGREEN)\n                .setFontSize(12)\n                .setFontStyle(\"bold\")\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getBodyBackground(final GridColumn<?> column) {\n        if (column instanceof IsRowDragHandle) {\n            return getHeaderBackground(column);\n        }\n        final Rectangle body = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.LIGHTGREEN);\n        return body;\n    }\n\n    @Override\n    public MultiPath getBodyGridLine() {\n        final MultiPath bodyGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return bodyGrid;\n    }\n\n    @Override\n    public Text getBodyText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.GREEN)\n                .setFontSize(12)\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getGridBoundary() {\n        final Rectangle boundary = new Rectangle(0,\n                                                 0)\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return boundary;\n    }\n\n    @Override\n    public Line getGridHeaderBodyDivider() {\n        final Line divider = new Line()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return divider;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/KIEColours.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\n/**\n * Shared colours for KIE grids. See https://issues.jboss.org/browse/DROOLS-3151\n */\npublic class KIEColours {\n\n    public static final String HEADER_BACKGROUND_WHITE = \"#FFFFFF\";\n\n    public static final String HEADER_BACKGROUND_LIGHT_GREY = \"#EDEDED\";\n\n    public static final String HEADER_BACKGROUND_LIGHT_BLUE = \"#DEF3FF\";\n\n    public static final String HEADER_BACKGROUND_DARK_BLUE = \"#BEE1F4\";\n\n    public static final String TABLE_GRID = \"#BBBBBB\";\n\n    public static final String TABLE_TEXT = \"#030303\";\n\n    public static final String CELL_CONTENT = \"#FFFFFF\";\n\n    public static final String CELL_FOCUS = \"#0088CE\";\n\n    public static final String CELL_ERROR_FOCUS = \"#8B0000\";\n\n    public static final String CELL_ERROR_BACKGROUND = \"#FFE6E6\";\n\n    public static final String PLACEHOLDER_COLOR = \"#757575\";\n\n    public static final String HIGHLIGHTED_CELL_BACKGROUND = \"#F9D67A\";\n\n    public static final String HIGHLIGHTED_CELL_STROKE = \"#F5C12E\";\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/KIEStyles.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\npublic class KIEStyles {\n\n    public static final String FONT_FAMILY_LABEL = \"Open Sans, Helvetica, Arial, sans-serif\";\n    public static final String FONT_STYLE_ITALIC = \"italic\";\n    public static final int FONT_SIZE = 10;\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/MultiColouredTheme.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.Shadow;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.IsRowDragHandle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * A renderer that draws a predominantly red GridWidget.\n */\npublic class MultiColouredTheme implements GridRendererTheme {\n\n    @Override\n    public String getName() {\n        return \"Multi-coloured\";\n    }\n\n    @Override\n    public MultiPath getSelector() {\n        final MultiPath selector = new MultiPath()\n                .setStrokeWidth(2.0)\n                .setStrokeColor(ColorName.GREEN)\n                .setShadow(new Shadow(ColorName.DARKGREEN,\n                                      4,\n                                      0.0,\n                                      0.0));\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBorder() {\n        final Rectangle selector = new Rectangle(0, 0)\n                .setStrokeColor(ColorName.PURPLE)\n                .setStrokeWidth(10.0);\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBackground() {\n        final Rectangle background = new Rectangle(0, 0)\n                .setFillColor(ColorName.PURPLE)\n                .setAlpha(0.25);\n        return background;\n    }\n\n    @Override\n    public Rectangle getHeaderBackground(final GridColumn<?> column) {\n        final Rectangle header = new Rectangle(0,\n                                               0)\n                .setFillColor(ColorName.BISQUE);\n        return header;\n    }\n\n    @Override\n    public Rectangle getHeaderLinkBackground(final GridColumn<?> column) {\n        final Rectangle link = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.BROWN);\n        return link;\n    }\n\n    @Override\n    public MultiPath getHeaderGridLine() {\n        final MultiPath headerGrid = new MultiPath()\n                .setStrokeColor(ColorName.GREY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return headerGrid;\n    }\n\n    @Override\n    public Text getHeaderText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.DARKGOLDENROD)\n                .setFontSize(12)\n                .setFontStyle(\"bold\")\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getBodyBackground(final GridColumn<?> column) {\n        if (column instanceof IsRowDragHandle) {\n            return getHeaderBackground(column);\n        }\n        final Rectangle body = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.LIGHTYELLOW);\n        return body;\n    }\n\n    @Override\n    public MultiPath getBodyGridLine() {\n        final MultiPath bodyGrid = new MultiPath()\n                .setStrokeColor(ColorName.GREY)\n                .setStrokeWidth(1)\n                .setListening(false);\n        return bodyGrid;\n    }\n\n    @Override\n    public Text getBodyText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.GREY)\n                .setFontSize(12)\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getGridBoundary() {\n        final Rectangle boundary = new Rectangle(0,\n                                                 0)\n                .setStrokeColor(ColorName.GREY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return boundary;\n    }\n\n    @Override\n    public Line getGridHeaderBodyDivider() {\n        final Line divider = new Line()\n                .setStrokeColor(ColorName.GREY)\n                .setStrokeWidth(0.5);\n        return divider;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/themes/impl/RedTheme.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.Shadow;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.IsRowDragHandle;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\n/**\n * A renderer that draws a predominantly red GridWidget.\n */\npublic class RedTheme implements GridRendererTheme {\n\n    @Override\n    public String getName() {\n        return \"Red\";\n    }\n\n    @Override\n    public MultiPath getSelector() {\n        final MultiPath selector = new MultiPath()\n                .setStrokeWidth(2.0)\n                .setStrokeColor(ColorName.RED)\n                .setShadow(new Shadow(ColorName.DARKRED,\n                                      4,\n                                      0.0,\n                                      0.0));\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBorder() {\n        final Rectangle selector = new Rectangle(0, 0)\n                .setStrokeColor(ColorName.RED)\n                .setStrokeWidth(1.0);\n        return selector;\n    }\n\n    @Override\n    public Rectangle getCellSelectorBackground() {\n        final Rectangle background = new Rectangle(0, 0)\n                .setFillColor(ColorName.RED)\n                .setAlpha(0.25);\n        return background;\n    }\n\n    @Override\n    public Rectangle getHeaderBackground(final GridColumn<?> column) {\n        final Rectangle header = new Rectangle(0,\n                                               0)\n                .setFillColor(ColorName.PALEVIOLETRED);\n        return header;\n    }\n\n    @Override\n    public Rectangle getHeaderLinkBackground(final GridColumn<?> column) {\n        final Rectangle link = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.BROWN);\n        return link;\n    }\n\n    @Override\n    public MultiPath getHeaderGridLine() {\n        final MultiPath headerGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return headerGrid;\n    }\n\n    @Override\n    public Text getHeaderText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.DARKRED)\n                .setFontSize(12)\n                .setFontStyle(\"bold\")\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    @SuppressWarnings(\"unused\")\n    public Rectangle getBodyBackground(final GridColumn<?> column) {\n        if (column instanceof IsRowDragHandle) {\n            return getHeaderBackground(column);\n        }\n        final Rectangle body = new Rectangle(0,\n                                             0)\n                .setFillColor(ColorName.PINK);\n        return body;\n    }\n\n    @Override\n    public MultiPath getBodyGridLine() {\n        final MultiPath bodyGrid = new MultiPath()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return bodyGrid;\n    }\n\n    @Override\n    public Text getBodyText() {\n        final Text t = new Text(\"\")\n                .setFillColor(ColorName.RED)\n                .setFontSize(12)\n                .setFontFamily(\"serif\")\n                .setListening(false)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER);\n        return t;\n    }\n\n    @Override\n    public Rectangle getGridBoundary() {\n        final Rectangle boundary = new Rectangle(0,\n                                                 0)\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5)\n                .setListening(false);\n        return boundary;\n    }\n\n    @Override\n    public Line getGridHeaderBodyDivider() {\n        final Line divider = new Line()\n                .setStrokeColor(ColorName.SLATEGRAY)\n                .setStrokeWidth(0.5);\n        return divider;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/CellSelectionManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections;\n\nimport com.ait.lienzo.client.core.types.Point2D;\n\n/**\n * Manager for Cell selection operations.\n */\npublic interface CellSelectionManager {\n\n    /**\n     * Handles selection of a cell by delegating selection to a @{link CellSelectionStrategy} associated\n     * with the cell being selected. Different strategies may select an entire row, a range depending\n     * upon shift/control key states etc.\n     * @param rp Canvas coordinate relative to the GridWidget.\n     * @param isShiftKeyDown True if the shift key is pressed.\n     * @param isControlKeyDown True if the control key is pressed.\n     * @return true if the selections have changed.\n     */\n    boolean selectCell(final Point2D rp,\n                       final boolean isShiftKeyDown,\n                       final boolean isControlKeyDown);\n\n    /**\n     * Handles selection of a cell by delegating selection to a @{link CellSelectionStrategy} associated\n     * with the cell being selected. Different strategies may select an entire row, a range depending\n     * upon shift/control key states etc.\n     * @param uiRowIndex Index of row as seen in the UI\n     * @param uiColumnIndex Index of the column as seen in the UI\n     * @param isShiftKeyDown True if the shift key is pressed.\n     * @param isControlKeyDown True if the control key is pressed.\n     * @return true if the selections have changed.\n     */\n    boolean selectCell(final int uiRowIndex,\n                       final int uiColumnIndex,\n                       final boolean isShiftKeyDown,\n                       final boolean isControlKeyDown);\n\n    /**\n     * Handles selection of a cell in the Header by delegating selection to a @{link HeaderCellSelectionStrategy}\n     * associated with the header cell being selected. Different strategies may select an entire column, or a range\n     * depending upon shift/control key states etc.\n     * @param rp Canvas coordinate relative to the GridWidget.\n     * @param isShiftKeyDown True if the shift key is pressed.\n     * @param isControlKeyDown True if the control key is pressed.\n     * @return true if the selections have changed.\n     */\n    boolean selectHeaderCell(final Point2D rp,\n                             final boolean isShiftKeyDown,\n                             final boolean isControlKeyDown);\n\n    /**\n     * Handles selection of a cell in the Header by delegating selection to a @{link HeaderCellSelectionStrategy}\n     * associated with the header cell being selected. Different strategies may select an entire column, or a range\n     * depending upon shift/control key states etc.\n     * @param uiHeaderRowIndex Index of row as seen in the UI. 0-based index. Top row is 0.\n     * @param uiHeaderColumnIndex Index of the column as seen in the UI. 0-based index. Leftmost column is 0.\n     * @param isShiftKeyDown True if the shift key is pressed.\n     * @param isControlKeyDown True if the control key is pressed.\n     * @return true if the selections have changed.\n     */\n    boolean selectHeaderCell(final int uiHeaderRowIndex,\n                             final int uiHeaderColumnIndex,\n                             final boolean isShiftKeyDown,\n                             final boolean isControlKeyDown);\n\n    /**\n     * Adjusts an existing selection, based on the selection origin, depending on the\n     * provided parameters. If the shift key is down the current selected range is extended\n     * in the required direction; otherwise the current origin is moved in the required direction.\n     * @param direction The proposed direction in which to extend the selection.\n     * @param isShiftKeyDown true if the shift key is pressed.\n     * @return true if the selection changed, otherwise false.\n     */\n    boolean adjustSelection(final SelectionExtension direction,\n                            final boolean isShiftKeyDown);\n\n    /**\n     * Handles initiation of editing a cell. If the provided Canvas coordinate\n     * does not resolve to a cell in the Grid no operation if performed.\n     * @param rp Canvas coordinate relative to the GridWidget.\n     * @return true if an edit operation was successfully initiated.\n     */\n    boolean startEditingCell(final Point2D rp);\n\n    /**\n     * Handles initiation of editing a cell. If the provided Canvas coordinate\n     * does not resolve to a cell in the Grid no operation if performed.\n     * @param uiRowIndex Row index of cell being edited.\n     * @param uiColumnIndex Column index of cell being edited.\n     * @return true if an edit operation was successfully initiated.\n     */\n    boolean startEditingCell(final int uiRowIndex,\n                             final int uiColumnIndex);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/CellSelectionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\n/**\n * Strategy for selection of cells.\n */\npublic interface CellSelectionStrategy {\n\n    /**\n     * Handle a single cell selection.\n     * @param model Underlying GridData model.\n     * @param uiRowIndex Index of row as seen in the UI\n     * @param uiColumnIndex Index of the column as seen in the UI\n     * @param isShiftKeyDown True if the shift key is pressed.\n     * @param isControlKeyDown True if the control key is pressed.\n     * @return true if the selections have changed.\n     */\n    boolean handleSelection(final GridData model,\n                            final int uiRowIndex,\n                            final int uiColumnIndex,\n                            final boolean isShiftKeyDown,\n                            final boolean isControlKeyDown);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/SelectionExtension.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections;\n\nimport java.io.Serializable;\n\n/**\n * Possible directions in which a Selection can be extended.\n */\npublic enum SelectionExtension {\n\n    LEFT(\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max - 1;\n                } else {\n                    return min - 1;\n                }\n            },\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max;\n                } else {\n                    return min;\n                }\n            },\n            -1,\n            0),\n    RIGHT(\n            (int min, int max, int origin) -> {\n                if (min < origin) {\n                    return min + 1;\n                } else {\n                    return max + 1;\n                }\n            },\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max;\n                } else {\n                    return min;\n                }\n            },\n            1,\n            0),\n    UP(\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max;\n                } else {\n                    return min;\n                }\n            },\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max - 1;\n                } else {\n                    return min - 1;\n                }\n            },\n            0,\n            -1),\n    DOWN(\n            (int min, int max, int origin) -> {\n                if (max > origin) {\n                    return max;\n                } else {\n                    return min;\n                }\n            },\n            (int min, int max, int origin) -> {\n                if (min < origin) {\n                    return min + 1;\n                } else {\n                    return max + 1;\n                }\n            },\n            0,\n            1);\n\n    private NextIndexCalculator nextXCalculator;\n    private NextIndexCalculator nextYCalculator;\n    private int deltaX;\n    private int deltaY;\n\n    SelectionExtension(final NextIndexCalculator nextXCalculator,\n                       final NextIndexCalculator nextYCalculator,\n                       final int deltaX,\n                       final int deltaY) {\n        this.nextXCalculator = nextXCalculator;\n        this.nextYCalculator = nextYCalculator;\n        this.deltaX = deltaX;\n        this.deltaY = deltaY;\n    }\n\n    public int getNextX(final int minIndex,\n                        final int maxIndex,\n                        final int originIndex) {\n        return nextXCalculator.getNext(minIndex,\n                                       maxIndex,\n                                       originIndex);\n    }\n\n    public int getNextY(final int minIndex,\n                        final int maxIndex,\n                        final int originIndex) {\n        return nextYCalculator.getNext(minIndex,\n                                       maxIndex,\n                                       originIndex);\n    }\n\n    public int getDeltaX() {\n        return this.deltaX;\n    }\n\n    public int getDeltaY() {\n        return this.deltaY;\n    }\n\n    private interface NextIndexCalculator extends Serializable {\n\n        int getNext(final int minIndex,\n                    final int maxIndex,\n                    final int originIndex);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/BaseCellSelectionManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.function.IntPredicate;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.util.CoordinateUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\n\n/**\n * Manager for Cell selection operations.\n */\npublic class BaseCellSelectionManager implements CellSelectionManager {\n\n    private final GridWidget gridWidget;\n    private final GridData gridModel;\n\n    public BaseCellSelectionManager(final GridWidget gridWidget) {\n        this.gridWidget = Objects.requireNonNull(gridWidget, \"gridWidget\");\n        this.gridModel = Objects.requireNonNull(gridWidget.getModel(), \"gridModel\");\n    }\n\n    @Override\n    public boolean selectCell(final Point2D rp,\n                              final boolean isShiftKeyDown,\n                              final boolean isControlKeyDown) {\n        final Integer uiRowIndex = CoordinateUtilities.getUiRowIndex(gridWidget,\n                                                                     rp.getY());\n        final Integer uiColumnIndex = CoordinateUtilities.getUiColumnIndex(gridWidget,\n                                                                           rp.getX());\n        if (uiRowIndex == null || uiColumnIndex == null) {\n            return false;\n        }\n\n        return selectCell(uiRowIndex,\n                          uiColumnIndex,\n                          isShiftKeyDown,\n                          isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectCell(final int uiRowIndex,\n                              final int uiColumnIndex,\n                              final boolean isShiftKeyDown,\n                              final boolean isControlKeyDown) {\n        if (uiRowIndex < 0 || uiRowIndex > gridModel.getRowCount() - 1) {\n            return false;\n        }\n        if (uiColumnIndex < 0 || uiColumnIndex > gridModel.getColumnCount() - 1) {\n            return false;\n        }\n\n        CellSelectionStrategy strategy;\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex,\n                                                   uiColumnIndex);\n        if (cell == null) {\n            strategy = RangeSelectionStrategy.INSTANCE;\n        } else {\n            strategy = cell.getSelectionStrategy();\n        }\n        if (strategy == null) {\n            return false;\n        }\n\n        //Handle selection\n        return strategy.handleSelection(gridModel,\n                                        uiRowIndex,\n                                        uiColumnIndex,\n                                        isShiftKeyDown,\n                                        isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectHeaderCell(final Point2D rp,\n                                    final boolean isShiftKeyDown,\n                                    final boolean isControlKeyDown) {\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(gridWidget,\n                                                                                 rp);\n        final Integer uiHeaderColumnIndex = CoordinateUtilities.getUiColumnIndex(gridWidget,\n                                                                                 rp.getX());\n        if (uiHeaderRowIndex == null || uiHeaderColumnIndex == null) {\n            return false;\n        }\n\n        return selectHeaderCell(uiHeaderRowIndex,\n                                uiHeaderColumnIndex,\n                                isShiftKeyDown,\n                                isControlKeyDown);\n    }\n\n    @Override\n    public boolean selectHeaderCell(final int uiHeaderRowIndex,\n                                    final int uiHeaderColumnIndex,\n                                    final boolean isShiftKeyDown,\n                                    final boolean isControlKeyDown) {\n        if (uiHeaderColumnIndex < 0 || uiHeaderColumnIndex > gridModel.getColumnCount() - 1) {\n            return false;\n        }\n\n        final GridColumn<?> gridColumn = gridModel.getColumns().get(uiHeaderColumnIndex);\n        final List<GridColumn.HeaderMetaData> gridColumnHeaderMetaData = gridColumn.getHeaderMetaData();\n        if (uiHeaderRowIndex < 0 || uiHeaderRowIndex > gridColumnHeaderMetaData.size() - 1) {\n            return false;\n        }\n        final GridColumn.HeaderMetaData headerMetaData = gridColumnHeaderMetaData.get(uiHeaderRowIndex);\n        final CellSelectionStrategy strategy = headerMetaData.getSelectionStrategy();\n\n        return strategy.handleSelection(gridModel,\n                                        uiHeaderRowIndex,\n                                        uiHeaderColumnIndex,\n                                        isShiftKeyDown,\n                                        isControlKeyDown);\n    }\n\n    @Override\n    public boolean adjustSelection(final SelectionExtension direction,\n                                   final boolean isShiftKeyDown) {\n        final GridData.SelectedCell origin = gridModel.getSelectedCellsOrigin();\n        if (origin == null) {\n            if (gridModel.getSelectedHeaderCells().size() > 0) {\n                final GridData.SelectedCell selectedHeaderCell = gridModel.getSelectedHeaderCells().get(0);\n                if (movingHorizontally(direction)) {\n                    return moveInHeaderHorizontally(direction, selectedHeaderCell);\n                }\n                if (movingVertically(direction)) {\n                    return moveInHeaderVerticallyOrMoveToData(direction, selectedHeaderCell);\n                }\n            }\n            return false;\n        }\n\n        if (isShiftKeyDown) {\n            return extendSelection(origin,\n                                   direction);\n        } else {\n            return moveSelection(origin,\n                                 direction);\n        }\n    }\n\n    private static boolean movingHorizontally(final SelectionExtension direction) {\n        return direction == SelectionExtension.LEFT || direction == SelectionExtension.RIGHT;\n    }\n\n    private static boolean movingVertically(final SelectionExtension direction) {\n        return direction == SelectionExtension.UP || direction == SelectionExtension.DOWN;\n    }\n\n    private boolean moveInHeaderHorizontally(final SelectionExtension direction,\n                                             final GridData.SelectedCell selectedHeaderCell) {\n        final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                         selectedHeaderCell.getColumnIndex());\n\n        final GridColumn.HeaderMetaData columnHeaderMetaData = gridModel.getColumns().get(uiColumnIndex)\n                .getHeaderMetaData().get(selectedHeaderCell.getRowIndex());\n\n        final int headerBlockStartIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(gridModel.getColumns(),\n                                                                                              columnHeaderMetaData,\n                                                                                              selectedHeaderCell.getRowIndex(),\n                                                                                              uiColumnIndex);\n        final int headerBlockEndIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(gridModel.getColumns(),\n                                                                                          columnHeaderMetaData,\n                                                                                          selectedHeaderCell.getRowIndex(),\n                                                                                          uiColumnIndex);\n        int proposedUiColumnIndex = uiColumnIndex + direction.getDeltaX();\n        final int hiddenColumnXCompensation = computeHiddenColumnsCompensation(proposedUiColumnIndex, direction);\n        proposedUiColumnIndex = proposedUiColumnIndex + hiddenColumnXCompensation;\n\n        if (direction == SelectionExtension.LEFT) {\n            proposedUiColumnIndex = Math.min(headerBlockStartIndex - 1,\n                                             proposedUiColumnIndex);\n        }\n\n        if (direction == SelectionExtension.RIGHT) {\n            proposedUiColumnIndex = Math.max(headerBlockEndIndex + 1,\n                                             proposedUiColumnIndex);\n        }\n\n        if (proposedUiColumnIndex < 0 || proposedUiColumnIndex > gridModel.getColumnCount() - 1) {\n            return false;\n        }\n\n        final int proposedUiRowIndex = // either keep the same or pick the closest one\n                Math.min(selectedHeaderCell.getRowIndex(),\n                         ColumnIndexUtilities.getMaxUiHeaderRowIndexOfColumn(gridModel, proposedUiColumnIndex));\n\n        return selectHeaderCell(proposedUiRowIndex,\n                                proposedUiColumnIndex,\n                                false,\n                                false);\n    }\n\n    private boolean moveInHeaderVerticallyOrMoveToData(final SelectionExtension direction,\n                                                       final GridData.SelectedCell selectedHeaderCell) {\n        final int uiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                         selectedHeaderCell.getColumnIndex());\n\n        final boolean selectionChanged = selectHeaderCell(selectedHeaderCell.getRowIndex() + direction.getDeltaY(),\n                                                          uiColumnIndex,\n                                                          false,\n                                                          false);\n        if (!selectionChanged && direction == SelectionExtension.DOWN) {\n            return selectCell(0,\n                              uiColumnIndex,\n                              false,\n                              false);\n        } else {\n            return selectionChanged;\n        }\n    }\n\n    private boolean extendSelection(final GridData.SelectedCell origin,\n                                    final SelectionExtension direction) {\n        if (gridModel.getSelectedCells().isEmpty()) {\n            return false;\n        }\n        final int originUiRowIndex = origin.getRowIndex();\n        final int originUiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                               origin.getColumnIndex());\n        final int minUiRowIndex = findMinUiRowIndex(origin);\n        final int maxUiRowIndex = findMaxUiRowIndex(origin);\n        final int minUiColumnIndex = findMinUiColumnIndex(origin);\n        final int maxUiColumnIndex = findMaxUiColumnIndex(origin);\n\n        final int proposedUiColumnIndex = direction.getNextX(minUiColumnIndex,\n                                                             maxUiColumnIndex,\n                                                             originUiColumnIndex);\n        final int proposedUiRowIndex = direction.getNextY(minUiRowIndex,\n                                                          maxUiRowIndex,\n                                                          originUiRowIndex);\n\n        if (!isCoordinateWithinExtents(proposedUiRowIndex,\n                                       proposedUiColumnIndex)) {\n            return false;\n        }\n\n        return selectCell(proposedUiRowIndex,\n                          proposedUiColumnIndex,\n                          true,\n                          false);\n    }\n\n    private int findMinUiRowIndex(final GridData.SelectedCell origin) {\n        int minUiRowIndex = origin.getRowIndex();\n        final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();\n        for (GridData.SelectedCell selectedCell : selectedCells) {\n            minUiRowIndex = Math.min(selectedCell.getRowIndex(),\n                                     minUiRowIndex);\n        }\n        return minUiRowIndex;\n    }\n\n    private int findMaxUiRowIndex(final GridData.SelectedCell origin) {\n        int maxUiRowIndex = origin.getRowIndex();\n        final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();\n        for (GridData.SelectedCell selectedCell : selectedCells) {\n            maxUiRowIndex = Math.max(selectedCell.getRowIndex(),\n                                     maxUiRowIndex);\n        }\n        return maxUiRowIndex;\n    }\n\n    private int findMinUiColumnIndex(final GridData.SelectedCell origin) {\n        int minUiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                      origin.getColumnIndex());\n        final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();\n        for (GridData.SelectedCell selectedCell : selectedCells) {\n            minUiColumnIndex = Math.min(ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                               selectedCell.getColumnIndex()),\n                                        minUiColumnIndex);\n        }\n        return minUiColumnIndex;\n    }\n\n    private int findMaxUiColumnIndex(final GridData.SelectedCell origin) {\n        int maxUiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                      origin.getColumnIndex());\n        final List<GridData.SelectedCell> selectedCells = gridModel.getSelectedCells();\n        for (GridData.SelectedCell selectedCell : selectedCells) {\n            maxUiColumnIndex = Math.max(ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                               selectedCell.getColumnIndex()),\n                                        maxUiColumnIndex);\n        }\n        return maxUiColumnIndex;\n    }\n\n    /**\n     * @return count of hidden columns that are as one hidden section starting on given index\n     */\n    private int computeHiddenColumnsCompensation(final int startingIndex,\n                                                 final SelectionExtension direction) {\n        int index = startingIndex;\n        int hiddenColumnsCount = 0;\n        IntPredicate outOfBound = columnIndex -> columnIndex < 0 || columnIndex >= gridModel.getColumnCount();\n        if (gridModel.getColumnCount() > 0) {\n            while (!outOfBound.test(index) && !gridModel.getColumns().get(index).isVisible()) {\n                hiddenColumnsCount++;\n                index += direction.getDeltaX();\n            }\n        }\n        return hiddenColumnsCount * direction.getDeltaX();\n    }\n\n    private boolean moveSelection(final GridData.SelectedCell origin,\n                                  final SelectionExtension direction) {\n        final int dx = direction.getDeltaX();\n        final int dy = direction.getDeltaY();\n        final int currentUiRowIndex = origin.getRowIndex();\n        final int currentUiColumnIndex = ColumnIndexUtilities.findUiColumnIndex(gridModel.getColumns(),\n                                                                                origin.getColumnIndex());\n        final int proposedUiRowIndex = currentUiRowIndex + dy;\n        int proposedUiColumnIndex = currentUiColumnIndex + dx;\n        final int hiddenColumnXCompensation = computeHiddenColumnsCompensation(proposedUiColumnIndex, direction);\n        proposedUiColumnIndex = proposedUiColumnIndex + hiddenColumnXCompensation;\n\n        if (canMoveFromDataToHeader(direction, proposedUiRowIndex)) {\n            return moveFromDataToHeader(proposedUiColumnIndex);\n        }\n\n        if (!isCoordinateWithinExtents(proposedUiRowIndex,\n                                       proposedUiColumnIndex)) {\n            return false;\n        }\n\n        return selectCell(proposedUiRowIndex,\n                          proposedUiColumnIndex,\n                          false,\n                          false);\n    }\n\n    private boolean canMoveFromDataToHeader(final SelectionExtension direction,\n                                            final int proposedUiRowIndex) {\n        return direction == SelectionExtension.UP && proposedUiRowIndex < 0 && gridModel.getHeaderRowCount() > 0;\n    }\n\n    private boolean moveFromDataToHeader(final int uiColumnIndex) {\n        final int uiHeaderRowIndex = ColumnIndexUtilities.getMaxUiHeaderRowIndexOfColumn(gridModel, uiColumnIndex);\n        return selectHeaderCell(uiHeaderRowIndex,\n                                uiColumnIndex,\n                                false,\n                                false);\n    }\n\n    private boolean isCoordinateWithinExtents(final int proposedUiRowIndex,\n                                              final int proposedUiColumnIndex) {\n        if (proposedUiRowIndex < 0 || proposedUiRowIndex > gridModel.getRowCount() - 1) {\n            return false;\n        }\n        if (proposedUiColumnIndex < 0 || proposedUiColumnIndex > gridModel.getColumnCount() - 1) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public boolean startEditingCell(final Point2D rp) {\n        //Get row information\n        final Integer uiRowIndex = CoordinateUtilities.getUiRowIndex(gridWidget,\n                                                                     rp.getY());\n        if (uiRowIndex == null) {\n            return false;\n        }\n\n        //Get column information\n        final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation();\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        final BaseGridRendererHelper.ColumnInformation ci = rendererHelper.getColumnInformation(rp.getX());\n        final GridColumn<?> column = ci.getColumn();\n        if (column == null) {\n            return false;\n        }\n\n        return edit(uiRowIndex,\n                    ci,\n                    rendererHelper.getRenderingInformation(),\n                    Optional.of(rp.add(gridWidgetComputedLocation)));\n    }\n\n    @Override\n    public boolean startEditingCell(final int uiRowIndex,\n                                    final int uiColumnIndex) {\n        if (!isCoordinateWithinExtents(uiRowIndex,\n                                       uiColumnIndex)) {\n            return false;\n        }\n\n        final RenderingInformation renderingInformation = computeRenderingInformation();\n\n        BaseGridRendererHelper.ColumnInformation ci = getFloatingColumnInformation(uiColumnIndex, renderingInformation);\n        if (ci == null) {\n            ci = getBodyColumnInformation(uiColumnIndex, renderingInformation);\n        }\n        if (ci == null) {\n            return false;\n        }\n\n        return edit(uiRowIndex,\n                    ci,\n                    renderingInformation,\n                    Optional.empty());\n    }\n\n    private BaseGridRendererHelper.ColumnInformation getFloatingColumnInformation(final int uiColumnIndex,\n                                                                                  final RenderingInformation renderingInformation) {\n        final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final List<GridColumn<?>> floatingColumns = floatingBlockInformation.getColumns();\n\n        if (!floatingColumns.contains(column)) {\n            return null;\n        }\n\n        return new BaseGridRendererHelper.ColumnInformation(column,\n                                                            uiColumnIndex,\n                                                            floatingBlockInformation.getX() + rendererHelper.getColumnOffset(floatingColumns,\n                                                                                                                             floatingColumns.indexOf(column)));\n    }\n\n    private BaseGridRendererHelper.ColumnInformation getBodyColumnInformation(final int uiColumnIndex,\n                                                                              final RenderingInformation renderingInformation) {\n        final GridColumn<?> column = gridModel.getColumns().get(uiColumnIndex);\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        final BaseGridRendererHelper.RenderingBlockInformation bodyBlockInformation = renderingInformation.getBodyBlockInformation();\n        final List<GridColumn<?>> bodyColumns = bodyBlockInformation.getColumns();\n\n        if (!bodyColumns.contains(column)) {\n            return null;\n        }\n\n        return new BaseGridRendererHelper.ColumnInformation(column,\n                                                            uiColumnIndex,\n                                                            bodyBlockInformation.getX() + rendererHelper.getColumnOffset(bodyColumns,\n                                                                                                                         bodyColumns.indexOf(column)));\n    }\n\n    private boolean edit(final int uiRowIndex,\n                         final BaseGridRendererHelper.ColumnInformation ci,\n                         final RenderingInformation renderingInformation,\n                         final Optional<Point2D> rp) {\n        final GridColumn<?> column = ci.getColumn();\n        final int uiColumnIndex = ci.getUiColumnIndex();\n        final double offsetX = ci.getOffsetX();\n\n        //Get rendering information\n        final GridRenderer renderer = gridWidget.getRenderer();\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        if (renderingInformation == null) {\n            return false;\n        }\n\n        final BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation = renderingInformation.getFloatingBlockInformation();\n        final double floatingX = floatingBlockInformation.getX();\n        final double floatingWidth = floatingBlockInformation.getWidth();\n\n        //Construct context of MouseEvent\n        final Point2D gridWidgetComputedLocation = gridWidget.getComputedLocation();\n        final double cellX = gridWidgetComputedLocation.getX() + offsetX;\n        final double cellY = gridWidgetComputedLocation.getY() + renderer.getHeaderHeight() + getRowOffset(uiRowIndex,\n                                                                                                           uiColumnIndex,\n                                                                                                           rendererHelper);\n        final double cellHeight = getCellHeight(uiRowIndex,\n                                                uiColumnIndex,\n                                                renderingInformation);\n\n        final Group header = gridWidget.getHeader();\n        final double clipMinX = gridWidgetComputedLocation.getX() + floatingX + floatingWidth;\n        final double clipMinY = gridWidgetComputedLocation.getY() + (header == null ? 0.0 : header.getY()) + renderer.getHeaderHeight();\n\n        final GridBodyCellEditContext context = new GridBodyCellEditContext(cellX,\n                                                                            cellY,\n                                                                            column.getWidth(),\n                                                                            cellHeight,\n                                                                            clipMinY,\n                                                                            clipMinX,\n                                                                            uiRowIndex,\n                                                                            uiColumnIndex,\n                                                                            floatingBlockInformation.getColumns().contains(column),\n                                                                            gridWidget.getViewport().getTransform(),\n                                                                            renderer,\n                                                                            rp);\n\n        doEdit(context);\n\n        return true;\n    }\n\n    private double getRowOffset(final int uiRowIndex,\n                                final int uiColumnIndex,\n                                final BaseGridRendererHelper rendererHelper) {\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex,\n                                                   uiColumnIndex);\n        if (cell == null) {\n            return rendererHelper.getRowOffset(uiRowIndex);\n        }\n        if (cell.getMergedCellCount() == 1) {\n            return rendererHelper.getRowOffset(uiRowIndex);\n        } else if (cell.getMergedCellCount() > 1) {\n            return rendererHelper.getRowOffset(uiRowIndex);\n        } else {\n            int _uiRowIndex = uiRowIndex;\n            GridCell<?> _cell = cell;\n            while (_cell.getMergedCellCount() == 0) {\n                _uiRowIndex--;\n                _cell = gridModel.getCell(_uiRowIndex,\n                                          uiColumnIndex);\n            }\n            return rendererHelper.getRowOffset(_uiRowIndex);\n        }\n    }\n\n    private double getCellHeight(final int uiRowIndex,\n                                 final int uiColumnIndex,\n                                 final RenderingInformation renderingInformation) {\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex, uiColumnIndex);\n        if (cell == null) {\n            return allRowHeights.get(uiRowIndex);\n        }\n        if (cell.getMergedCellCount() == 1) {\n            return allRowHeights.get(uiRowIndex);\n        } else if (cell.getMergedCellCount() > 1) {\n            return getMergedCellHeight(uiRowIndex,\n                                       uiColumnIndex,\n                                       renderingInformation);\n        } else {\n            return getClippedMergedCellHeight(uiRowIndex,\n                                              uiColumnIndex,\n                                              renderingInformation);\n        }\n    }\n\n    private double getMergedCellHeight(final int uiRowIndex,\n                                       final int uiColumnIndex,\n                                       final RenderingInformation renderingInformation) {\n        double height = 0;\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex, uiColumnIndex);\n        for (int i = uiRowIndex; i < uiRowIndex + cell.getMergedCellCount(); i++) {\n            height = height + allRowHeights.get(i);\n        }\n        return height;\n    }\n\n    private double getClippedMergedCellHeight(final int uiRowIndex,\n                                              final int uiColumnIndex,\n                                              final RenderingInformation renderingInformation) {\n        final List<Double> allRowHeights = renderingInformation.getAllRowHeights();\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex, uiColumnIndex);\n        GridCell<?> _cell = cell;\n        int _uiRowIndex = uiRowIndex;\n        while (_cell.getMergedCellCount() == 0) {\n            _uiRowIndex--;\n            _cell = gridModel.getCell(_uiRowIndex,\n                                      uiColumnIndex);\n        }\n        double height = 0;\n        for (int i = _uiRowIndex; i < _uiRowIndex + _cell.getMergedCellCount(); i++) {\n            height = height + allRowHeights.get(i);\n        }\n        return height;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    protected void doEdit(final GridBodyCellEditContext context) {\n        final int uiRowIndex = context.getRowIndex();\n        final int uiColumnIndex = context.getColumnIndex();\n\n        final GridData gridModel = gridWidget.getModel();\n        final GridColumn column = gridModel.getColumns().get(uiColumnIndex);\n        final GridCell<?> cell = gridModel.getCell(uiRowIndex,\n                                                   uiColumnIndex);\n\n        column.edit(cell,\n                    context,\n                    value -> {\n                        gridModel.setCellValue(uiRowIndex,\n                                               uiColumnIndex,\n                                               (GridCellValue<?>) value);\n                        gridWidget.getLayer().batch();\n                    });\n    }\n\n    /**\n     * Computing of RenderingInformation is quite complex operation\n     * It is preferable to compute it just once and reuse\n     * See https://issues.redhat.com/browse/DROOLS-4793\n     */\n    private RenderingInformation computeRenderingInformation() {\n        final BaseGridRendererHelper rendererHelper = gridWidget.getRendererHelper();\n        return rendererHelper.getRenderingInformation();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/BaseCellSelectionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\npublic abstract class BaseCellSelectionStrategy implements CellSelectionStrategy {\n\n    protected boolean hasSelectionChanged(final List<GridData.SelectedCell> currentSelections,\n                                          final List<GridData.SelectedCell> originalSelections) {\n        final List<GridData.SelectedCell> cloneCurrentSelections = new ArrayList<GridData.SelectedCell>(currentSelections);\n        final List<GridData.SelectedCell> cloneOriginalSelections = new ArrayList<GridData.SelectedCell>(originalSelections);\n        cloneCurrentSelections.removeAll(originalSelections);\n        cloneOriginalSelections.removeAll(currentSelections);\n        return cloneCurrentSelections.size() > 0 || cloneOriginalSelections.size() > 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/HeaderSingleCellSelectionStrategy.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.IntStream;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\npublic class HeaderSingleCellSelectionStrategy extends BaseCellSelectionStrategy {\n\n    public static CellSelectionStrategy INSTANCE = new HeaderSingleCellSelectionStrategy();\n\n    @Override\n    public boolean handleSelection(final GridData model,\n                                   final int uiHeaderRowIndex,\n                                   final int uiHeaderColumnIndex,\n                                   final boolean isShiftKeyDown,\n                                   final boolean isControlKeyDown) {\n        final List<GridData.SelectedCell> originalSelections = new ArrayList<>(model.getSelectedHeaderCells());\n\n        //Get extents of block for Header cell\n        final List<GridColumn<?>> gridColumns = model.getColumns();\n        final List<GridColumn.HeaderMetaData> headerMetaData = gridColumns.get(uiHeaderColumnIndex).getHeaderMetaData();\n        final int blockStartColumnIndex = ColumnIndexUtilities.getHeaderBlockStartColumnIndex(gridColumns,\n                                                                                              headerMetaData.get(uiHeaderRowIndex),\n                                                                                              uiHeaderRowIndex,\n                                                                                              uiHeaderColumnIndex);\n        final int blockEndColumnIndex = ColumnIndexUtilities.getHeaderBlockEndColumnIndex(gridColumns,\n                                                                                          headerMetaData.get(uiHeaderRowIndex),\n                                                                                          uiHeaderRowIndex,\n                                                                                          uiHeaderColumnIndex);\n\n        model.clearSelections();\n        IntStream.range(blockStartColumnIndex, blockEndColumnIndex + 1)\n                .forEach(blockColumnIndex -> model.selectHeaderCell(uiHeaderRowIndex,\n                                                                    blockColumnIndex));\n\n        return hasSelectionChanged(model.getSelectedHeaderCells(),\n                                   originalSelections);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RangeSelectionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.util.ColumnIndexUtilities;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\npublic class RangeSelectionStrategy extends BaseCellSelectionStrategy {\n\n    public static CellSelectionStrategy INSTANCE = new RangeSelectionStrategy();\n\n    @Override\n    public boolean handleSelection(final GridData model,\n                                   final int uiRowIndex,\n                                   final int uiColumnIndex,\n                                   final boolean isShiftKeyDown,\n                                   final boolean isControlKeyDown) {\n        //Remember origin which is required if we're selecting a range with the shift-key pressed\n        final GridData.SelectedCell selectedCellsOrigin = model.getSelectedCellsOrigin();\n        final List<GridData.SelectedCell> originalSelections = new ArrayList<GridData.SelectedCell>(model.getSelectedCells());\n\n        //If the Control Key is pressed add additional cells to the selection\n        if (!isControlKeyDown) {\n            model.clearSelections();\n        } else {\n            model.getSelectedHeaderCells().clear();\n        }\n\n        if (isShiftKeyDown) {\n            if (selectedCellsOrigin == null) {\n                model.selectCell(uiRowIndex,\n                                 uiColumnIndex);\n            } else {\n                final int uiOriginRowIndex = selectedCellsOrigin.getRowIndex();\n                final int uiOriginColumnIndex = ColumnIndexUtilities.findUiColumnIndex(model.getColumns(),\n                                                                                       selectedCellsOrigin.getColumnIndex());\n                model.selectCell(uiOriginRowIndex,\n                                 uiOriginColumnIndex);\n                model.selectCells((uiRowIndex > uiOriginRowIndex ? uiOriginRowIndex : uiRowIndex),\n                                  (uiColumnIndex > uiOriginColumnIndex ? uiOriginColumnIndex : uiColumnIndex),\n                                  Math.abs(uiColumnIndex - uiOriginColumnIndex) + 1,\n                                  Math.abs(uiRowIndex - uiOriginRowIndex) + 1);\n            }\n        } else {\n            model.selectCell(uiRowIndex,\n                             uiColumnIndex);\n        }\n\n        return hasSelectionChanged(model.getSelectedCells(),\n                                   originalSelections);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RowSelectionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\npublic class RowSelectionStrategy extends BaseCellSelectionStrategy {\n\n    public static CellSelectionStrategy INSTANCE = new RowSelectionStrategy();\n\n    @Override\n    public boolean handleSelection(final GridData model,\n                                   final int uiRowIndex,\n                                   final int uiColumnIndex,\n                                   final boolean isShiftKeyDown,\n                                   final boolean isControlKeyDown) {\n        //Remember origin which is required if we're selecting a range with the shift-key pressed\n        final GridData.SelectedCell selectedCellsOrigin = model.getSelectedCellsOrigin();\n        final List<GridData.SelectedCell> originalSelections = new ArrayList<GridData.SelectedCell>(model.getSelectedCells());\n\n        //If the Control Key is pressed add additional cells to the selection\n        if (!isControlKeyDown) {\n            model.clearSelections();\n        } else {\n            model.getSelectedHeaderCells().clear();\n        }\n\n        if (isShiftKeyDown) {\n            if (selectedCellsOrigin == null) {\n                selectRow(model,\n                          uiRowIndex);\n            } else {\n                model.selectCell(selectedCellsOrigin.getRowIndex(),\n                                 selectedCellsOrigin.getColumnIndex());\n                final int uiOriginRowIndex = selectedCellsOrigin.getRowIndex();\n                selectRows(model,\n                           (uiRowIndex > uiOriginRowIndex ? uiOriginRowIndex : uiRowIndex),\n                           Math.abs(uiRowIndex - uiOriginRowIndex) + 1);\n            }\n        } else {\n            selectRow(model,\n                      uiRowIndex);\n        }\n\n        return hasSelectionChanged(model.getSelectedCells(),\n                                   originalSelections);\n    }\n\n    private void selectRow(final GridData model,\n                           final int uiRowIndex) {\n        model.selectCells(uiRowIndex,\n                          0,\n                          model.getColumnCount(),\n                          1);\n    }\n\n    private void selectRows(final GridData model,\n                            final int uiRowIndex,\n                            final int height) {\n        model.selectCells(uiRowIndex,\n                          0,\n                          model.getColumnCount(),\n                          height);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/GridLayer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer;\n\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownHandler;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveHandler;\nimport com.ait.lienzo.client.core.event.NodeMouseUpHandler;\nimport com.ait.lienzo.client.core.shape.IContainer;\nimport com.ait.lienzo.client.core.shape.IDrawable;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLayerRedrawManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\n/**\n * A specialised Layer that supports pass-through of MouseEvents from DOMElements to GridWidgets.\n * This implementation handles  drawing connectors between \"linked\" grids and acts as a GridSelectionManager.\n */\npublic interface GridLayer extends GridSelectionManager,\n                                   GridPinnedModeManager,\n                                   IContainer<Layer, IPrimitive<?>>,\n                                   IDrawable<Layer>,\n                                   NodeMouseDownHandler,\n                                   NodeMouseMoveHandler,\n                                   NodeMouseUpHandler {\n\n    /**\n     * Get the visible bounds of the Layer in the Viewport\n     * @return\n     */\n    Bounds getVisibleBounds();\n\n    /**\n     * Get the state of any Handlers registered to the Grid\n     * @return\n     */\n    GridWidgetDnDHandlersState getGridWidgetHandlersState();\n\n    /**\n     * Get the overlay panel.\n     * @return\n     */\n    AbsolutePanel getDomElementContainer();\n\n    /**\n     * Set a reference to an AbsolutePanel that overlays the Canvas.\n     * This can be used to overlay DOM elements on top of the Canvas.\n     * @param getDomElementContainer The overlay panel\n     */\n    void setDomElementContainer(final AbsolutePanel getDomElementContainer);\n\n    /**\n     * Redraw the Grid. All updates are batched into a single draw on the next animation\n     * frame. Execute the provided command after the batch redraw has been scheduled.\n     * @param command The command to execute\n     * @return\n     */\n    Layer batch(final GridLayerRedrawManager.PrioritizedCommand command);\n\n    /**\n     * Gets a collection of all connectors used to connect all {@link GridWidget} together.\n     * @return A {@link Set} of connectors.\n     */\n    Set<IPrimitive<?>> getGridWidgetConnectors();\n\n    /**\n     * Refreshes all connectors used to connect all {@link GridWidget} together.\n     */\n    void refreshGridWidgetConnectors();\n\n    /**\n     * Moves the specified GridWidget into view without scrolling the Canvas.\n     * If the GridLayer is not in \"pinned mode\" this method has no operation.\n     * @param gridWidget The GridWidget to move into view.\n     */\n    void flipToGridWidget(final GridWidget gridWidget);\n\n    /**\n     * Scrolls the specified GridWidget into view.\n     * If the GridLayer is in \"pinned mode\" this method has no operation.\n     * @param gridWidget The GridWidget to scroll into view.\n     */\n    void scrollToGridWidget(final GridWidget gridWidget);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/GridSelectionManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer;\n\nimport java.util.Set;\n\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\npublic interface GridSelectionManager {\n\n    void select(final GridWidget selectedGridWidget);\n\n    void selectLinkedColumn(final GridColumn<?> selectedGridColumn);\n\n    Set<GridWidget> getGridWidgets();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/GridWidgetRegistry.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer;\n\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\npublic interface GridWidgetRegistry {\n\n    /**\n     * Registers a {@link GridWidget}\n     * @param gridWidget The {@link GridWidget} to register\n     */\n    void register(final GridWidget gridWidget);\n\n    /**\n     * Deregisters a {@link GridWidget}\n     * @param gridWidget The {@link GridWidget} to deregister\n     */\n    void deregister(final GridWidget gridWidget);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/DefaultGridLayer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedHashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Point2DArray;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.shared.core.types.ColorName;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDMouseDownHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDMouseMoveHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDMouseUpHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.animation.GridWidgetScrollIntoViewAnimation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.GridWidgetConnector;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridWidgetRegistry;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.BoundaryTransformMediator;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.DefaultPinnedModeManager;\n\n/**\n * Default implementation of GridLayer\n */\npublic class DefaultGridLayer extends Layer implements GridLayer,\n                                                       GridWidgetRegistry {\n\n    //This is helpful when debugging rendering issues to set the bounds smaller than the Viewport\n    private static final int PADDING = 0;\n    private final GridWidgetDnDMouseDownHandler mouseDownHandler;\n    private final GridWidgetDnDMouseMoveHandler mouseMoveHandler;\n    private final GridWidgetDnDMouseUpHandler mouseUpHandler;\n    private final GridWidgetDnDHandlersState state = new GridWidgetDnDHandlersState();\n    private final TransformMediator defaultTransformMediator = new BoundaryTransformMediator();\n    private final DefaultPinnedModeManager pinnedModeManager = new DefaultPinnedModeManager(this);\n    private Set<GridWidget> explicitGridWidgets = new LinkedHashSet<>();\n    private Set<GridWidget> registeredGridWidgets = new LinkedHashSet<>();\n    private Map<GridWidgetConnector, Line> gridWidgetConnectors = new HashMap<>();\n    private final GridLayerRedrawManager.PrioritizedCommand REDRAW = new GridLayerRedrawManager.PrioritizedCommand(Integer.MIN_VALUE) {\n        @Override\n        public void execute() {\n            DefaultGridLayer.this.draw();\n        }\n    };\n    private AbsolutePanel domElementContainer;\n    private Bounds bounds;\n\n    public DefaultGridLayer() {\n        this.bounds = new BaseBounds(0,\n                                     0,\n                                     0,\n                                     0);\n\n        //Column DnD handlers\n        this.mouseDownHandler = getGridWidgetDnDMouseDownHandler();\n        this.mouseMoveHandler = getGridWidgetDnDMouseMoveHandler();\n        this.mouseUpHandler = getGridWidgetDnDMouseUpHandler();\n        addNodeMouseDownHandler(mouseDownHandler);\n        addNodeMouseMoveHandler(mouseMoveHandler);\n        addNodeMouseUpHandler(mouseUpHandler);\n\n        //Destroy SingletonDOMElements on MouseDownEvents to ensure they're hidden:-\n        // 1) When moving columns\n        // 2) When resizing columns\n        // 3) When the User clicks outside of a GridWidget\n        // We do this rather than setFocus on GridPanel as the FocusImplSafari implementation of\n        // FocusPanel sets focus at unpredictable times which can lead to SingletonDOMElements\n        // loosing focus after they've been attached to the DOM and hence disappearing.\n        addNodeMouseDownHandler((event) -> {\n            for (GridWidget gridWidget : getGridWidgets()) {\n                for (GridColumn<?> gridColumn : gridWidget.getModel().getColumns()) {\n                    if (gridColumn instanceof HasSingletonDOMElementResource) {\n                        ((HasSingletonDOMElementResource) gridColumn).flush();\n                        ((HasSingletonDOMElementResource) gridColumn).destroyResources();\n                        batch();\n                    }\n                }\n            }\n        });\n    }\n\n    protected GridWidgetDnDMouseDownHandler getGridWidgetDnDMouseDownHandler() {\n        return new GridWidgetDnDMouseDownHandler(this,\n                                                 state);\n    }\n\n    protected GridWidgetDnDMouseMoveHandler getGridWidgetDnDMouseMoveHandler() {\n        return new GridWidgetDnDMouseMoveHandler(this,\n                                                 state);\n    }\n\n    protected GridWidgetDnDMouseUpHandler getGridWidgetDnDMouseUpHandler() {\n        return new GridWidgetDnDMouseUpHandler(this,\n                                               state);\n    }\n\n    @Override\n    public void onNodeMouseDown(final NodeMouseDownEvent event) {\n        mouseDownHandler.onNodeMouseDown(event);\n    }\n\n    @Override\n    public void onNodeMouseMove(final NodeMouseMoveEvent event) {\n        mouseMoveHandler.onNodeMouseMove(event);\n    }\n\n    @Override\n    public void onNodeMouseUp(final NodeMouseUpEvent event) {\n        mouseUpHandler.onNodeMouseUp(event);\n    }\n\n    @Override\n    public Layer draw() {\n        //Clear all transient registrations added as the Layer is rendered\n        registeredGridWidgets.clear();\n        registeredGridWidgets.addAll(explicitGridWidgets);\n\n        //We use Layer.batch() to ensure rendering is tied to the browser's requestAnimationFrame()\n        //however this calls back into Layer.draw() so update dependent Shapes here.\n        updateGridWidgetConnectors();\n        return super.draw();\n    }\n\n    @Override\n    public Layer batch() {\n        return batch(REDRAW);\n    }\n\n    @Override\n    public Layer batch(final GridLayerRedrawManager.PrioritizedCommand command) {\n        GridLayerRedrawManager.get().schedule(command);\n        return this;\n    }\n\n    @Override\n    public Set<IPrimitive<?>> getGridWidgetConnectors() {\n        return Collections.unmodifiableSet(new HashSet<>(gridWidgetConnectors.values()));\n    }\n\n    private void updateGridWidgetConnectors() {\n        for (Map.Entry<GridWidgetConnector, Line> e : gridWidgetConnectors.entrySet()) {\n            final GridWidgetConnector connector = e.getKey();\n            final Line line = e.getValue();\n            final GridColumn<?> sourceGridColumn = connector.getSourceColumn();\n            final GridColumn<?> targetGridColumn = connector.getTargetColumn();\n            final GridWidget sourceGridWidget = getLinkedGridWidget(sourceGridColumn);\n            final GridWidget targetGridWidget = getLinkedGridWidget(targetGridColumn);\n\n            final Point2D sp = new Point2D(sourceGridWidget.getX() + sourceGridWidget.getWidth() / 2,\n                                           sourceGridWidget.getY() + sourceGridWidget.getHeight() / 2);\n            final Point2D ep = new Point2D(targetGridWidget.getX() + targetGridWidget.getWidth() / 2,\n                                           targetGridWidget.getY() + targetGridWidget.getHeight() / 2);\n\n            line.setPoints(new Point2DArray(sp,\n                                            ep));\n        }\n    }\n\n    /**\n     * Add a child to this Layer. If the child is a GridWidget then also add\n     * a Connector between the Grid Widget and any \"linked\" GridWidgets.\n     * @param child Primitive to add to the Layer\n     * @return The Layer\n     */\n    @Override\n    public Layer add(final IPrimitive<?> child) {\n        addGridWidget(child);\n        return super.add(child);\n    }\n\n    private void addGridWidget(final IPrimitive<?> child,\n                               final IPrimitive<?>... children) {\n        final List<IPrimitive<?>> all = new ArrayList<IPrimitive<?>>();\n        all.add(child);\n        all.addAll(Arrays.asList(children));\n        for (IPrimitive<?> c : all) {\n            if (c instanceof GridWidget) {\n                final GridWidget gridWidget = (GridWidget) c;\n                register(gridWidget);\n                explicitGridWidgets.add(gridWidget);\n                addGridWidgetConnectors();\n            }\n        }\n    }\n\n    @Override\n    public void register(final GridWidget gridWidget) {\n        registeredGridWidgets.add(gridWidget);\n    }\n\n    @Override\n    public void refreshGridWidgetConnectors() {\n        for (Line line : gridWidgetConnectors.values()) {\n            remove(line);\n        }\n        gridWidgetConnectors.clear();\n        addGridWidgetConnectors();\n    }\n\n    private void addGridWidgetConnectors() {\n        for (GridWidget gridWidget : explicitGridWidgets) {\n            final GridData gridModel = gridWidget.getModel();\n            for (GridColumn<?> gridColumn : gridModel.getColumns()) {\n                if (gridColumn.isVisible()) {\n                    if (gridColumn.isLinked()) {\n                        final GridWidget linkedGridWidget = getLinkedGridWidget(gridColumn.getLink());\n                        if (linkedGridWidget != null) {\n                            final Point2D sp = new Point2D(gridWidget.getX() + gridWidget.getWidth() / 2,\n                                                           gridWidget.getY() + gridWidget.getHeight() / 2);\n                            final Point2D ep = new Point2D(linkedGridWidget.getX() + linkedGridWidget.getWidth() / 2,\n                                                           linkedGridWidget.getY() + linkedGridWidget.getHeight() / 2);\n\n                            final GridWidgetConnector connector = new GridWidgetConnector(gridColumn,\n                                                                                          gridColumn.getLink());\n\n                            if (!gridWidgetConnectors.containsKey(connector)) {\n                                final Line line = new Line(sp,\n                                                           ep)\n                                        .setVisible(!isGridPinned())\n                                        .setStrokeColor(ColorName.DARKGRAY)\n                                        .setFillColor(ColorName.TAN)\n                                        .setStrokeWidth(2.0);\n                                gridWidgetConnectors.put(connector,\n                                                         line);\n                                super.add(line);\n                                line.moveToBottom();\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private GridWidget getLinkedGridWidget(final GridColumn<?> linkedGridColumn) {\n        GridWidget linkedGridWidget = null;\n        for (GridWidget gridWidget : explicitGridWidgets) {\n            final GridData gridModel = gridWidget.getModel();\n            if (gridModel.getColumns().contains(linkedGridColumn)) {\n                linkedGridWidget = gridWidget;\n                break;\n            }\n        }\n        return linkedGridWidget;\n    }\n\n    /**\n     * Add a child and other children to this Layer. If the child or any children is a GridWidget\n     * then also add a Connector between the Grid Widget and any \"linked\" GridWidgets.\n     * @param child Primitive to add to the Layer\n     * @param children Additional primitive(s) to add to the Layer\n     * @return The Layer\n     */\n    @Override\n    public Layer add(final IPrimitive<?> child,\n                     final IPrimitive<?>... children) {\n        addGridWidget(child,\n                      children);\n        return super.add(child,\n                         children);\n    }\n\n    /**\n     * Remove a child from this Layer. if the child is a GridWidget also remove\n     * any Connectors that have been added between the GridWidget being removed\n     * and any of GridWidgets.\n     * @param child Primitive to remove from the Layer\n     * @return The Layer\n     */\n    @Override\n    public Layer remove(final IPrimitive<?> child) {\n        removeGridWidget(child);\n        return super.remove(child);\n    }\n\n    private void removeGridWidget(final IPrimitive<?> child,\n                                  final IPrimitive<?>... children) {\n        final List<IPrimitive<?>> all = new ArrayList<IPrimitive<?>>();\n        all.add(child);\n        all.addAll(Arrays.asList(children));\n        for (IPrimitive<?> c : all) {\n            if (c instanceof GridWidget) {\n                final GridWidget gridWidget = (GridWidget) c;\n                deregister(gridWidget);\n                explicitGridWidgets.remove(gridWidget);\n                removeGridWidgetConnectors(gridWidget);\n            }\n        }\n    }\n\n    @Override\n    public void deregister(final GridWidget gridWidget) {\n        registeredGridWidgets.remove(gridWidget);\n    }\n\n    private void removeGridWidgetConnectors(final GridWidget gridWidget) {\n        final GridData gridModel = gridWidget.getModel();\n        final List<GridWidgetConnector> removedConnectors = new ArrayList<GridWidgetConnector>();\n        for (Map.Entry<GridWidgetConnector, Line> e : gridWidgetConnectors.entrySet()) {\n            if (gridModel.getColumns().contains(e.getKey().getSourceColumn()) || gridModel.getColumns().contains(e.getKey().getTargetColumn())) {\n                remove(e.getValue());\n                removedConnectors.add(e.getKey());\n            }\n        }\n        //Remove Connectors from HashMap after iteration of EntrySet to avoid ConcurrentModificationException\n        for (GridWidgetConnector c : removedConnectors) {\n            gridWidgetConnectors.remove(c);\n        }\n    }\n\n    @Override\n    public Layer removeAll() {\n        explicitGridWidgets.clear();\n        gridWidgetConnectors.clear();\n        registeredGridWidgets.clear();\n        return super.removeAll();\n    }\n\n    @Override\n    public void select(final GridWidget selectedGridWidget) {\n        boolean selectionChanged = false;\n        for (GridWidget gridWidget : getGridWidgets()) {\n            if (gridWidget.isSelected()) {\n                if (!gridWidget.equals(selectedGridWidget)) {\n                    selectionChanged = true;\n                    gridWidget.deselect();\n                }\n            } else if (gridWidget.equals(selectedGridWidget)) {\n                selectionChanged = true;\n                gridWidget.select();\n            }\n        }\n        if (selectionChanged) {\n            batch();\n        }\n    }\n\n    @Override\n    public void selectLinkedColumn(final GridColumn<?> selectedGridColumn) {\n        final GridWidget gridWidget = getLinkedGridWidget(selectedGridColumn);\n        if (gridWidget == null) {\n            return;\n        }\n\n        if (isGridPinned()) {\n            flipToGridWidget(gridWidget);\n        } else {\n            scrollToGridWidget(gridWidget);\n        }\n    }\n\n    @Override\n    public void flipToGridWidget(final GridWidget gridWidget) {\n        if (!isGridPinned()) {\n            return;\n        }\n        for (GridWidget gw : explicitGridWidgets) {\n            gw.setAlpha(gw.equals(gridWidget) ? 1.0 : 0.0);\n            gw.setVisible(gw.equals(gridWidget));\n        }\n\n        final Point2D translation = new Point2D(gridWidget.getX(),\n                                                gridWidget.getY()).mul(-1.0);\n        final Viewport vp = gridWidget.getViewport();\n        final Transform transform = vp.getTransform();\n        transform.reset();\n        transform.translate(translation.getX(),\n                            translation.getY());\n\n        updatePinnedContext(gridWidget);\n\n        batch(new GridLayerRedrawManager.PrioritizedCommand(0) {\n            @Override\n            public void execute() {\n                select(gridWidget);\n            }\n        });\n    }\n\n    @Override\n    public void scrollToGridWidget(final GridWidget gridWidget) {\n        if (isGridPinned()) {\n            return;\n        }\n        final GridWidgetScrollIntoViewAnimation a = new GridWidgetScrollIntoViewAnimation(gridWidget,\n                                                                                          new Command() {\n                                                                                              @Override\n                                                                                              public void execute() {\n                                                                                                  select(gridWidget);\n                                                                                              }\n                                                                                          });\n        a.run();\n    }\n\n    @Override\n    public Set<GridWidget> getGridWidgets() {\n        return Collections.unmodifiableSet(registeredGridWidgets);\n    }\n\n    @Override\n    public void enterPinnedMode(final GridWidget gridWidget,\n                                final Command onStartCommand) {\n        pinnedModeManager.enterPinnedMode(gridWidget,\n                                          onStartCommand);\n    }\n\n    @Override\n    public void exitPinnedMode(final Command onCompleteCommand) {\n        pinnedModeManager.exitPinnedMode(onCompleteCommand);\n    }\n\n    @Override\n    public void updatePinnedContext(final GridWidget gridWidget) throws IllegalStateException {\n        pinnedModeManager.updatePinnedContext(gridWidget);\n    }\n\n    @Override\n    public PinnedContext getPinnedContext() {\n        return pinnedModeManager.getPinnedContext();\n    }\n\n    @Override\n    public boolean isGridPinned() {\n        return pinnedModeManager.isGridPinned();\n    }\n\n    @Override\n    public TransformMediator getDefaultTransformMediator() {\n        return defaultTransformMediator;\n    }\n\n    @Override\n    public void addOnEnterPinnedModeCommand(final Command command) {\n        getPinnedModeManager().addOnEnterPinnedModeCommand(command);\n    }\n\n    @Override\n    public void addOnExitPinnedModeCommand(final Command command) {\n        getPinnedModeManager().addOnExitPinnedModeCommand(command);\n    }\n\n    DefaultPinnedModeManager getPinnedModeManager() {\n        return pinnedModeManager;\n    }\n\n    @Override\n    public Bounds getVisibleBounds() {\n        updateVisibleBounds();\n        return bounds;\n    }\n\n    private void updateVisibleBounds() {\n        final Viewport viewport = getViewport();\n        Transform transform = viewport.getTransform();\n        if (transform == null) {\n            viewport.setTransform(transform = new Transform());\n        }\n        final double x = (PADDING - transform.getTranslateX()) / transform.getScaleX();\n        final double y = (PADDING - transform.getTranslateY()) / transform.getScaleY();\n        bounds.setX(x);\n        bounds.setY(y);\n        bounds.setHeight(Math.max(0,\n                                  (viewport.getHeight() - PADDING * 2) / transform.getScaleX()));\n        bounds.setWidth(Math.max(0,\n                                 (viewport.getWidth() - PADDING * 2) / transform.getScaleY()));\n    }\n\n    @Override\n    public GridWidgetDnDHandlersState getGridWidgetHandlersState() {\n        return state;\n    }\n\n    @Override\n    public AbsolutePanel getDomElementContainer() {\n        return domElementContainer;\n    }\n\n    @Override\n    public void setDomElementContainer(final AbsolutePanel domElementContainer) {\n        this.domElementContainer = domElementContainer;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/GridLayerRedrawManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport java.util.Comparator;\nimport java.util.Iterator;\nimport java.util.Objects;\nimport java.util.SortedSet;\nimport java.util.TreeSet;\n\nimport com.google.gwt.animation.client.AnimationScheduler;\nimport com.google.gwt.user.client.Command;\n\npublic class GridLayerRedrawManager {\n\n    private static final GridLayerRedrawManager instance = new GridLayerRedrawManager();\n\n    private final Comparator<PrioritizedCommand> COMPARATOR = new Comparator<PrioritizedCommand>() {\n        @Override\n        public int compare(final PrioritizedCommand o1,\n                           final PrioritizedCommand o2) {\n            return o1.getPriority() - o2.getPriority();\n        }\n    };\n\n    SortedSet<PrioritizedCommand> commands = new TreeSet<PrioritizedCommand>(COMPARATOR);\n\n    private AnimationScheduler.AnimationCallback callback;\n\n    private GridLayerRedrawManager() {\n        callback = new AnimationScheduler.AnimationCallback() {\n\n            @Override\n            public void execute(double time) {\n                final SortedSet<PrioritizedCommand> clone = commands;\n                commands = new TreeSet<PrioritizedCommand>(COMPARATOR);\n\n                if (!clone.isEmpty()) {\n                    final Iterator<PrioritizedCommand> itr = clone.iterator();\n                    while (itr.hasNext()) {\n                        final PrioritizedCommand command = itr.next();\n                        command.execute();\n                    }\n                }\n            }\n        };\n    }\n\n    public static final GridLayerRedrawManager get() {\n        return instance;\n    }\n\n    public void schedule(final PrioritizedCommand command) {\n        Objects.requireNonNull(command, \"command\");\n        if (!commands.contains(command)) {\n            commands.add(command);\n            kick();\n        }\n    }\n\n    private void kick() {\n        if (commands.size() > 0) {\n            AnimationScheduler.get().requestAnimationFrame(callback);\n        }\n    }\n\n    public static abstract class PrioritizedCommand implements Command {\n\n        private int priority = 0;\n\n        public PrioritizedCommand(final int priority) {\n            this.priority = priority;\n        }\n\n        public int getPriority() {\n            return priority;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/GridLienzoPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ScrollEvent;\nimport com.google.gwt.event.dom.client.ScrollHandler;\nimport com.google.gwt.event.logical.shared.AttachEvent;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\n/**\n * Specialised LienzoPanel that is overlaid with an AbsolutePanel\n * to support overlaying DOM elements on top of the Canvas element.\n */\npublic class GridLienzoPanel extends FocusPanel implements RequiresResize,\n                                                           ProvidesResize,\n                                                           GridLienzoScrollable {\n\n    protected final LienzoPanel lienzoPanel;\n\n    protected final AbsolutePanel domElementContainer = new AbsolutePanel();\n\n    private final AbsolutePanel internalScrollPanel = new AbsolutePanel();\n\n    private final AbsolutePanel scrollPanel = new AbsolutePanel();\n\n    private final AbsolutePanel rootPanel = new AbsolutePanel();\n\n    private final GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    private DefaultGridLayer defaultGridLayer;\n\n    public GridLienzoPanel() {\n        this(new LienzoPanel() {\n            @Override\n            public void onResize() {\n                // Do nothing. Resize is handled by AttachHandler. LienzoPanel calls onResize() in\n                // it's onAttach() method which causes the Canvas to be redrawn. However when LienzoPanel\n                // is adopted by another Widget LienzoPanel's onAttach() is called before its children\n                // have been attached. Should redraw require children to be attached errors arise.\n            }\n        });\n    }\n\n    public GridLienzoPanel(final int width,\n                           final int height) {\n        this(new LienzoPanel(width,\n                             height) {\n            @Override\n            public void onResize() {\n                // Do nothing. Resize is handled by AttachHandler. LienzoPanel calls onResize() in\n                // it's onAttach() method which causes the Canvas to be redrawn. However when LienzoPanel\n                // is adopted by another Widget LienzoPanel's onAttach() is called before its children\n                // have been attached. Should redraw require children to be attached errors arise.\n            }\n        });\n\n        updatePanelSize(width,\n                        height);\n    }\n\n    public GridLienzoPanel(final DefaultGridLayer defaultGridLayer) {\n        this(new LienzoPanel() {\n                 @Override\n                 public void onResize() {\n                     // Do nothing. Resize is handled by AttachHandler. LienzoPanel calls onResize() in\n                     // it's onAttach() method which causes the Canvas to be redrawn. However when LienzoPanel\n                     // is adopted by another Widget LienzoPanel's onAttach() is called before its children\n                     // have been attached. Should redraw require children to be attached errors arise.\n                 }\n             },\n             defaultGridLayer);\n    }\n\n    public GridLienzoPanel(final int width,\n                           final int height,\n                           final DefaultGridLayer defaultGridLayer) {\n        this(new LienzoPanel(width,\n                             height) {\n                 @Override\n                 public void onResize() {\n                     // Do nothing. Resize is handled by AttachHandler. LienzoPanel calls onResize() in\n                     // it's onAttach() method which causes the Canvas to be redrawn. However when LienzoPanel\n                     // is adopted by another Widget LienzoPanel's onAttach() is called before its children\n                     // have been attached. Should redraw require children to be attached errors arise.\n                 }\n             },\n             defaultGridLayer);\n\n        updatePanelSize(width,\n                        height);\n    }\n\n    protected GridLienzoPanel(final LienzoPanel lienzoPanel) {\n        this.lienzoPanel = lienzoPanel;\n        this.gridLienzoScrollHandler = new GridLienzoScrollHandler(this);\n\n        setupPanels();\n        setupScrollHandlers();\n        setupDefaultHandlers();\n    }\n\n    protected GridLienzoPanel(final LienzoPanel lienzoPanel,\n                              final DefaultGridLayer defaultGridLayer) {\n        this.lienzoPanel = lienzoPanel;\n        this.gridLienzoScrollHandler = new GridLienzoScrollHandler(this);\n\n        add(defaultGridLayer);\n\n        setupPanels();\n        setupScrollHandlers();\n        setupDefaultHandlers();\n    }\n\n    protected void setupPanels() {\n        setupScrollPanel();\n        setupDomElementContainer();\n        setupRootPanel();\n\n        add(getRootPanel());\n        getElement().getStyle().setOutlineStyle(Style.OutlineStyle.NONE);\n    }\n\n    protected void setupScrollPanel() {\n        getScrollPanel().add(getInternalScrollPanel());\n    }\n\n    protected void setupDomElementContainer() {\n        getDomElementContainer().add(getLienzoPanel());\n    }\n\n    protected void setupRootPanel() {\n        getRootPanel().add(getDomElementContainer());\n        getRootPanel().add(getScrollPanel());\n    }\n\n    protected void setupScrollHandlers() {\n        getGridLienzoScrollHandler().init();\n        addMouseUpHandler();\n    }\n\n    protected void addMouseUpHandler() {\n        addMouseUpHandler((e) -> refreshScrollPosition());\n    }\n\n    protected void setupDefaultHandlers() {\n        //Prevent DOMElements scrolling into view when they receive the focus\n        domElementContainer.addDomHandler(new ScrollHandler() {\n\n                                              @Override\n                                              public void onScroll(final ScrollEvent scrollEvent) {\n                                                  domElementContainer.getElement().setScrollTop(0);\n                                                  domElementContainer.getElement().setScrollLeft(0);\n                                              }\n                                          },\n                                          ScrollEvent.getType());\n        addAttachHandler(new AttachEvent.Handler() {\n            @Override\n            public void onAttachOrDetach(final AttachEvent event) {\n                if (event.isAttached()) {\n                    onResize();\n                }\n            }\n        });\n    }\n\n    @Override\n    public void onResize() {\n        scheduleDeferred(() -> {\n            updatePanelSize();\n            refreshScrollPosition();\n        });\n    }\n\n    protected void scheduleDeferred(final Scheduler.ScheduledCommand scheduledCommand) {\n        Scheduler.get().scheduleDeferred(scheduledCommand);\n    }\n\n    @Override\n    public void updatePanelSize() {\n        final Element parentElement = getElement().getParentElement();\n        final Integer width = parentElement.getOffsetWidth();\n        final Integer height = parentElement.getOffsetHeight();\n\n        if (width > 0 && height > 0) {\n            updatePanelSize(width,\n                            height);\n        }\n    }\n\n    @Override\n    public void updatePanelSize(final Integer width,\n                                final Integer height) {\n        updateScrollPanelSize(width,\n                              height);\n        updateInternalPanelsSizes(width,\n                                  height);\n    }\n\n    protected void updateInternalPanelsSizes(final int width,\n                                             final int height) {\n        final Integer scrollbarWidth = getGridLienzoScrollHandler().scrollbarWidth();\n        final Integer scrollbarHeight = getGridLienzoScrollHandler().scrollbarHeight();\n\n        final int visibleWidth = width - scrollbarWidth;\n        final int visibleHeight = height - scrollbarHeight;\n\n        getDomElementContainer().setPixelSize(visibleWidth,\n                                              visibleHeight);\n        getLienzoPanel().setPixelSize(visibleWidth,\n                                      visibleHeight);\n\n        propagateNewPanelSize(visibleWidth, visibleHeight);\n    }\n\n    protected void updateScrollPanelSize(final int width,\n                                         final int height) {\n        getScrollPanel().setPixelSize(width,\n                                      height);\n    }\n\n    protected void propagateNewPanelSize(int visibleWidth, int visibleHeight) {\n        if (getDefaultGridLayer() == null) {\n            return;\n        }\n        // propagate to all widgets the new visible width and refresh the layer if needed\n        boolean toRefresh = false;\n        for (GridWidget gridWidget : getDefaultGridLayer().getGridWidgets()) {\n            toRefresh = toRefresh || gridWidget.getModel().setVisibleSizeAndRefresh(visibleWidth, visibleHeight);\n        }\n        if (toRefresh) {\n            this.getDefaultGridLayer().batch();\n        }\n    }\n\n    @Override\n    public void refreshScrollPosition() {\n        getGridLienzoScrollHandler().refreshScrollPosition();\n    }\n\n    @Override\n    public void setBounds(final Bounds bounds) {\n        getGridLienzoScrollHandler().setBounds(bounds);\n    }\n\n    public LienzoPanel add(final DefaultGridLayer layer) {\n        defaultGridLayer = setupDefaultGridLayer(layer);\n\n        layer.setDomElementContainer(domElementContainer);\n\n        lienzoPanel.add(defaultGridLayer);\n\n        return lienzoPanel;\n    }\n\n    protected DefaultGridLayer setupDefaultGridLayer(final DefaultGridLayer layer) {\n        layer.addOnEnterPinnedModeCommand(this::refreshScrollPosition);\n        layer.addOnExitPinnedModeCommand(this::refreshScrollPosition);\n\n        return layer;\n    }\n\n    public final Viewport getViewport() {\n        return lienzoPanel.getViewport();\n    }\n\n    public LienzoPanel getLienzoPanel() {\n        return lienzoPanel;\n    }\n\n    public AbsolutePanel getScrollPanel() {\n        return scrollPanel;\n    }\n\n    public AbsolutePanel getDomElementContainer() {\n        return domElementContainer;\n    }\n\n    public AbsolutePanel getInternalScrollPanel() {\n        return internalScrollPanel;\n    }\n\n    public DefaultGridLayer getDefaultGridLayer() {\n        return defaultGridLayer;\n    }\n\n    protected AbsolutePanel getRootPanel() {\n        return rootPanel;\n    }\n\n    protected GridLienzoScrollHandler getGridLienzoScrollHandler() {\n        return gridLienzoScrollHandler;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/GridPinnedModeManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning;\n\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\n/**\n * Interface defining operations of a Manager to handle \"pinning\" GridWidgets. A \"pinned\" GridWidget\n * is scaled to 100% and positioned in the top left of the visible range.\n */\npublic interface GridPinnedModeManager extends IsPinnedModeAware {\n\n    /**\n     * Enters \"pinned\" mode. This has no effect if another GridWidget is already \"pinned\".\n     * @param gridWidget GridWidget to \"pin\"\n     * @param onStartCommand Command to execute on start of entry to \"pinned\" mode\n     */\n    void enterPinnedMode(final GridWidget gridWidget,\n                         final Command onStartCommand);\n\n    /**\n     * Exits \"pinned\" mode. This has no effect if a GridWidget is not already pinned.\n     * @param onCompleteCommand Command to execute on completion of exiting \"pinned\" mode\n     */\n    void exitPinnedMode(final Command onCompleteCommand);\n\n    /**\n     * Updates the context to a different GridWidget and related translation.\n     * @param gridWidget GridWidget to \"pin\"\n     * @throws IllegalStateException If \"pinned\" mode has not been entered.\n     */\n    void updatePinnedContext(final GridWidget gridWidget) throws IllegalStateException;\n\n    /**\n     * Returns the pinned Context, or null if no GridWidget is pinned.\n     * @return\n     */\n    PinnedContext getPinnedContext();\n\n    /**\n     * Returns the default restriction when in \"unpinned\" mode.\n     * @return\n     */\n    TransformMediator getDefaultTransformMediator();\n\n    void addOnEnterPinnedModeCommand(final Command command);\n\n    void addOnExitPinnedModeCommand(final Command command);\n\n    /**\n     * Container for the previous Viewport state; to support \"unpinning\" to revert to the previous Viewport transformation.\n     */\n    class PinnedContext {\n\n        private GridWidget gridWidget;\n        private double translateX;\n        private double translateY;\n        private double scaleX;\n        private double scaleY;\n\n        public PinnedContext(final GridWidget gridWidget,\n                             final double translateX,\n                             final double translateY,\n                             final double scaleX,\n                             final double scaleY) {\n            this.gridWidget = gridWidget;\n            this.translateX = translateX;\n            this.translateY = translateY;\n            this.scaleX = scaleX;\n            this.scaleY = scaleY;\n        }\n\n        public GridWidget getGridWidget() {\n            return gridWidget;\n        }\n\n        public double getTranslateX() {\n            return translateX;\n        }\n\n        public double getTranslateY() {\n            return translateY;\n        }\n\n        public double getScaleX() {\n            return scaleX;\n        }\n\n        public double getScaleY() {\n            return scaleY;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/IsPinnedModeAware.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning;\n\n/**\n * Interface for classes needing to be aware of the \"pinned\" state.\n */\npublic interface IsPinnedModeAware {\n\n    /**\n     * Returns the current state of the View; whether a GridWidget is already \"pinned\".\n     * @return\n     */\n    boolean isGridPinned();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/TransformMediator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\n\n/**\n * Defines a mediator that can mediate {@link Transform} applied to a {@link Viewport}.\n */\npublic interface TransformMediator {\n\n    /**\n     * Adjusts a {@link Transform} to mediate transformations.\n     * @param transform The proposed Transform to be applied to the Viewport.\n     * @param visibleBounds {@link Bounds} of the visible portion of the Viewport.\n     * @return A new Transform.\n     */\n    Transform adjust(final Transform transform,\n                     final Bounds visibleBounds);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/BoundaryTransformMediator.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\n\n/**\n * A {@link TransformMediator} that prevents transformations from being applied such that the \"visible bounds\" (i.e.\n * the visible portion of the Viewport) would extend beyond the boundary of a notional rectangular region.\n */\npublic class BoundaryTransformMediator implements TransformMediator {\n\n    private double minX;\n    private double minY;\n    private double maxX;\n    private double maxY;\n\n    public BoundaryTransformMediator() {\n        this.minX = Double.NEGATIVE_INFINITY;\n        this.minY = Double.NEGATIVE_INFINITY;\n        this.maxX = Double.POSITIVE_INFINITY;\n        this.maxY = Double.POSITIVE_INFINITY;\n    }\n\n    public BoundaryTransformMediator(final Bounds bounds) {\n        setBounds(bounds);\n    }\n\n    public void setBounds(final Bounds bounds) {\n        this.minX = bounds.getX();\n        this.minY = bounds.getY();\n        this.maxX = minX + bounds.getWidth();\n        this.maxY = minY + bounds.getHeight();\n    }\n\n    @Override\n    public Transform adjust(final Transform transform,\n                            final Bounds visibleBounds) {\n        Transform newTransform = transform.copy();\n\n        final double scaleX = transform.getScaleX();\n        final double scaleY = transform.getScaleY();\n        final double translateX = newTransform.getTranslateX();\n        final double translateY = newTransform.getTranslateY();\n        final double scaledTranslateX = translateX / scaleX;\n        final double scaledTranslateY = translateY / scaleY;\n        final double visibleBoundsWidth = visibleBounds.getWidth();\n        final double visibleBoundsHeight = visibleBounds.getHeight();\n\n        if (-scaledTranslateX < minX) {\n            newTransform = newTransform.translate(-scaledTranslateX - minX,\n                                                  0);\n        }\n        if (-scaledTranslateY < minY) {\n            newTransform = newTransform.translate(0,\n                                                  -scaledTranslateY - minY);\n        }\n        if (-scaledTranslateX + visibleBoundsWidth > maxX) {\n            newTransform = newTransform.translate(-scaledTranslateX + visibleBoundsWidth - maxX,\n                                                  0);\n        }\n        if (-scaledTranslateY + visibleBoundsHeight > maxY) {\n            newTransform = newTransform.translate(0,\n                                                  -scaledTranslateY + visibleBoundsHeight - maxY);\n        }\n\n        return newTransform;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/DefaultPinnedModeManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.mediator.IMediator;\nimport com.ait.lienzo.client.core.mediator.Mediators;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.user.client.Command;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.animation.GridWidgetEnterPinnedModeAnimation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.animation.GridWidgetExitPinnedModeAnimation;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\n\n/**\n * Default implementation of {@link GridPinnedModeManager} that uses animations to enter and/exit \"pinned\" mode.\n */\npublic class DefaultPinnedModeManager implements GridPinnedModeManager {\n\n    private final GridLayer gridLayer;\n\n    private final List<Command> onEnterPinnedModeCommands;\n\n    private final List<Command> onExitPinnedModeCommands;\n\n    private PinnedContext context = null;\n\n    public DefaultPinnedModeManager(final GridLayer gridLayer) {\n        this.onEnterPinnedModeCommands = new ArrayList<>();\n        this.onExitPinnedModeCommands = new ArrayList<>();\n        this.gridLayer = Objects.requireNonNull(gridLayer, \"gridLayer\");\n    }\n\n    @Override\n    public void enterPinnedMode(final GridWidget gridWidget,\n                                final Command onStartCommand) {\n        if (context != null) {\n            return;\n        }\n        final Transform transform = gridWidget.getViewport().getTransform();\n        final double translateX = transform.getTranslateX();\n        final double translateY = transform.getTranslateY();\n        final double scaleX = transform.getScaleX();\n        final double scaleY = transform.getScaleY();\n        final PinnedContext newState = new PinnedContext(gridWidget,\n                                                         translateX,\n                                                         translateY,\n                                                         scaleX,\n                                                         scaleY);\n\n        final Set<GridWidget> gridWidgetsToFadeFromView = new HashSet<>(gridLayer.getGridWidgets());\n        gridWidgetsToFadeFromView.remove(gridWidget);\n        final Set<IPrimitive<?>> gridWidgetConnectorsToFadeFromView = gridLayer.getGridWidgetConnectors();\n\n        doEnterPinnedMode(() -> {\n                              context = newState;\n                              onStartCommand.execute();\n                              enableGridTransformMediator(gridWidget);\n                          },\n                          gridWidget,\n                          gridWidgetsToFadeFromView,\n                          gridWidgetConnectorsToFadeFromView);\n    }\n\n    protected void doEnterPinnedMode(final Command onStartCommand,\n                                     final GridWidget gridWidget,\n                                     final Set<GridWidget> gridWidgetsToFadeFromView,\n                                     final Set<IPrimitive<?>> gridWidgetConnectorsToFadeFromView) {\n        final GridWidgetEnterPinnedModeAnimation enterAnimation = new GridWidgetEnterPinnedModeAnimation(gridWidget,\n                                                                                                         gridWidgetsToFadeFromView,\n                                                                                                         gridWidgetConnectorsToFadeFromView,\n                                                                                                         onStartCommand,\n                                                                                                         onEnterPinnedModeCommands);\n        enterAnimation.run();\n    }\n\n    @Override\n    public void exitPinnedMode(final Command onCompleteCommand) {\n        if (context == null) {\n            return;\n        }\n\n        final Set<GridWidget> gridWidgetsToFadeIntoView = new HashSet<>(gridLayer.getGridWidgets());\n        gridWidgetsToFadeIntoView.remove(context.getGridWidget());\n        final Set<IPrimitive<?>> gridWidgetConnectorsToFadeIntoView = gridLayer.getGridWidgetConnectors();\n\n        doExitPinnedMode(() -> {\n                             context = null;\n                             onCompleteCommand.execute();\n                             enableDefaultTransformMediator();\n                         },\n                         gridWidgetsToFadeIntoView,\n                         gridWidgetConnectorsToFadeIntoView);\n    }\n\n    protected void doExitPinnedMode(final Command onCompleteCommand,\n                                    final Set<GridWidget> gridWidgetsToFadeIntoView,\n                                    final Set<IPrimitive<?>> gridWidgetConnectorsToFadeIntoView) {\n        final GridWidgetExitPinnedModeAnimation exitAnimation = new GridWidgetExitPinnedModeAnimation(context,\n                                                                                                      gridWidgetsToFadeIntoView,\n                                                                                                      gridWidgetConnectorsToFadeIntoView,\n                                                                                                      onCompleteCommand,\n                                                                                                      onExitPinnedModeCommands);\n        exitAnimation.run();\n    }\n\n    private void enableGridTransformMediator(final GridWidget gridWidget) {\n        for (IMediator mediator : getMediators()) {\n            if (mediator instanceof RestrictedMousePanMediator) {\n                ((RestrictedMousePanMediator) mediator).setTransformMediator(new GridTransformMediator(gridWidget));\n            }\n        }\n    }\n\n    private void enableDefaultTransformMediator() {\n        for (IMediator mediator : getMediators()) {\n            if (mediator instanceof RestrictedMousePanMediator) {\n                ((RestrictedMousePanMediator) mediator).setTransformMediator(getDefaultTransformMediator());\n            }\n        }\n    }\n\n    private Mediators getMediators() {\n        final Viewport viewport = gridLayer.getViewport();\n        final Mediators mediators = viewport.getMediators();\n        return mediators;\n    }\n\n    @Override\n    public void updatePinnedContext(final GridWidget gridWidget) throws IllegalStateException {\n        if (context == null) {\n            throw new IllegalStateException(\"'pinned' mode has not been entered.\");\n        }\n\n        for (IMediator mediator : gridLayer.getViewport().getMediators()) {\n            if (mediator instanceof RestrictedMousePanMediator) {\n                ((RestrictedMousePanMediator) mediator).setTransformMediator(new GridTransformMediator(gridWidget));\n            }\n        }\n\n        final Transform transform = gridWidget.getViewport().getTransform();\n        final double scaleX = context.getScaleX();\n        final double scaleY = context.getScaleY();\n        final double translateX = transform.getTranslateX() * scaleX;\n        final double translateY = transform.getTranslateY() * scaleY;\n        context = new PinnedContext(gridWidget,\n                                    translateX,\n                                    translateY,\n                                    context.getScaleX(),\n                                    context.getScaleY());\n    }\n\n    @Override\n    public PinnedContext getPinnedContext() {\n        return context;\n    }\n\n    @Override\n    public boolean isGridPinned() {\n        return context != null;\n    }\n\n    @Override\n    public TransformMediator getDefaultTransformMediator() {\n        return gridLayer.getDefaultTransformMediator();\n    }\n\n    @Override\n    public void addOnEnterPinnedModeCommand(final Command command) {\n        onEnterPinnedModeCommands.add(command);\n    }\n\n    @Override\n    public void addOnExitPinnedModeCommand(final Command command) {\n        onExitPinnedModeCommands.add(command);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/GridTransformMediator.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\n\n/**\n * A @{link TransformMediator} that prevents transformations from being applied that would cause a {@link GridWidget}\n * to move beyond the \"edges\" of the \"visible bounds\" effectively \"sticking\" the {@link GridWidget} to the edges.\n */\npublic class GridTransformMediator implements TransformMediator {\n\n    private final GridWidget gridWidget;\n\n    public GridTransformMediator(final GridWidget gridWidget) {\n        this.gridWidget = gridWidget;\n    }\n\n    @Override\n    public Transform adjust(final Transform transform,\n                            final Bounds visibleBounds) {\n        Transform newTransform = transform.copy();\n\n        final double minX = gridWidget.getX();\n        final double minY = gridWidget.getY();\n        final double gridWidth = gridWidget.getWidth();\n        final double gridHeight = gridWidget.getHeight();\n        final double maxX = gridWidget.getX() + gridWidth;\n        final double maxY = gridWidget.getY() + gridHeight;\n\n        final double scaleX = transform.getScaleX();\n        final double scaleY = transform.getScaleY();\n        final double translateX = newTransform.getTranslateX();\n        final double translateY = newTransform.getTranslateY();\n        final double scaledTranslateX = translateX / scaleX;\n        final double scaledTranslateY = translateY / scaleY;\n        final double visibleBoundsWidth = visibleBounds.getWidth();\n        final double visibleBoundsHeight = visibleBounds.getHeight();\n\n        if (gridWidth <= visibleBoundsWidth) {\n            newTransform = newTransform.translate(-scaledTranslateX - minX,\n                                                  0);\n        } else {\n            if (-scaledTranslateX < minX) {\n                newTransform = newTransform.translate(-scaledTranslateX - minX,\n                                                      0);\n            }\n            if (-scaledTranslateX + visibleBoundsWidth > maxX) {\n                newTransform = newTransform.translate(-scaledTranslateX + visibleBoundsWidth - maxX,\n                                                      0);\n            }\n        }\n        if (gridHeight <= visibleBoundsHeight) {\n            newTransform = newTransform.translate(0,\n                                                  -scaledTranslateY - minY);\n        } else {\n            if (-scaledTranslateY < minY) {\n                newTransform = newTransform.translate(0,\n                                                      -scaledTranslateY - minY);\n            }\n            if (-scaledTranslateY + visibleBoundsHeight > maxY) {\n                newTransform = newTransform.translate(0,\n                                                      -scaledTranslateY + visibleBoundsHeight - maxY);\n            }\n        }\n\n        return newTransform;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/RestrictedMousePanMediator.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseOutEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.mediator.AbstractMediator;\nimport com.ait.lienzo.client.core.mediator.IEventFilter;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.shared.GwtEvent;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\n\n/**\n * This a fork of {@link com.ait.lienzo.client.core.mediator.MousePanMediator} however this implementation does not\n * stop the propagation of NodeMouseEvents to other listeners. Lienzo's implementation causes other NodeMouseMoveHandler,\n * NodeMouseDownHandler and NodeMouseUpHandler to miss receipt of Events. This implementation also restricts\n * transformations according to a {@link TransformMediator}.\n */\npublic class RestrictedMousePanMediator extends AbstractMediator {\n\n    private GridLayer gridLayer;\n\n    private TransformMediator transformMediator;\n\n    private Point2D m_last = new Point2D();\n\n    private boolean m_dragging = false;\n\n    private Transform m_inverseTransform = null;\n\n    public RestrictedMousePanMediator(final GridLayer gridLayer) {\n        this.gridLayer = gridLayer;\n    }\n\n    protected RestrictedMousePanMediator() {\n    }\n\n    public boolean isDragging() {\n        return m_dragging;\n    }\n\n    public TransformMediator getTransformMediator() {\n        return this.transformMediator;\n    }\n\n    public void setTransformMediator(final TransformMediator transformMediator) {\n        this.transformMediator = transformMediator;\n    }\n\n    @Override\n    public void cancel() {\n        m_dragging = false;\n        setCursor(Style.Cursor.DEFAULT);\n    }\n\n    protected void setCursor(final Style.Cursor cursor) {\n        getLayerViewport().getElement().getStyle().setCursor(cursor);\n    }\n\n    protected Viewport getLayerViewport() {\n        return getGridLayer().getViewport();\n    }\n\n    GridLayer getGridLayer() {\n        return gridLayer;\n    }\n\n    @Override\n    public boolean handleEvent(final GwtEvent<?> event) {\n        if (event.getAssociatedType() == NodeMouseMoveEvent.getType()) {\n            if (isDragging()) {\n                onMouseMove((NodeMouseMoveEvent) event);\n            }\n        } else if (event.getAssociatedType() == NodeMouseDownEvent.getType()) {\n            final IEventFilter filter = getEventFilter();\n\n            if ((null == filter) || (false == filter.isEnabled()) || (filter.test(event))) {\n                onMouseDown((NodeMouseDownEvent) event);\n            }\n        } else if (event.getAssociatedType() == NodeMouseUpEvent.getType()) {\n            if (isDragging()) {\n                onMouseUp((NodeMouseUpEvent) event);\n            }\n        } else if (event.getAssociatedType() == NodeMouseOutEvent.getType()) {\n            cancel();\n        }\n\n        return false;\n    }\n\n    protected void onMouseDown(final NodeMouseDownEvent event) {\n        m_last = new Point2D(event.getX(),\n                             event.getY());\n\n        m_dragging = true;\n\n        Transform transform = getTransform();\n\n        if (transform == null) {\n            setTransform(transform = new Transform());\n        }\n        m_inverseTransform = transform.getInverse();\n\n        m_inverseTransform.transform(m_last,\n                                     m_last);\n\n        setCursor(Style.Cursor.MOVE);\n    }\n\n    protected void onMouseMove(final NodeMouseMoveEvent event) {\n        final Point2D curr = new Point2D(event.getX(),\n                                         event.getY());\n\n        inverseTransform().transform(curr,\n                                     curr);\n\n        double deltaX = curr.getX() - m_last.getX();\n        double deltaY = curr.getY() - m_last.getY();\n\n        Transform newTransform = getTransform().copy().translate(deltaX,\n                                                                 deltaY);\n        if (transformMediator != null) {\n            newTransform = transformMediator.adjust(newTransform,\n                                                    gridLayer.getVisibleBounds());\n        }\n\n        setTransform(newTransform);\n\n        m_last = curr;\n\n        if (isBatchDraw()) {\n            getViewport().getScene().batch();\n        } else {\n            getViewport().getScene().draw();\n        }\n    }\n\n    protected void onMouseUp(final NodeMouseUpEvent event) {\n        cancel();\n    }\n\n    protected Transform inverseTransform() {\n        return m_inverseTransform;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollBars.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.google.gwt.user.client.ui.Panel;\n\n/*\n * Represents browser scrollbars in the Grid Lienzo context,\n * providing an API to get/set their position.\n */\n\nclass GridLienzoScrollBars {\n\n    private final GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    GridLienzoScrollBars(final GridLienzoScrollHandler gridLienzoScrollHandler) {\n        this.gridLienzoScrollHandler = gridLienzoScrollHandler;\n    }\n\n    Double getHorizontalScrollPosition() {\n\n        final Integer scrollLeft = scrollPanel().getElement().getScrollLeft();\n        final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();\n        final Integer clientWidth = scrollPanel().getElement().getClientWidth();\n        final Integer level = scrollWidth - clientWidth;\n\n        return level == 0 ? 0d : 100d * scrollLeft / level;\n    }\n\n    void setHorizontalScrollPosition(final Double percentage) {\n\n        final Integer scrollWidth = scrollPanel().getElement().getScrollWidth();\n        final Integer clientWidth = scrollPanel().getElement().getClientWidth();\n        final Integer max = scrollWidth - clientWidth;\n\n        setScrollLeft((int) ((max * percentage) / 100));\n    }\n\n    Double getVerticalScrollPosition() {\n\n        final Integer scrollTop = scrollPanel().getElement().getScrollTop();\n        final Integer scrollHeight = scrollPanel().getElement().getScrollHeight();\n        final Integer clientHeight = scrollPanel().getElement().getClientHeight();\n        final Integer level = scrollHeight - clientHeight;\n\n        return level == 0 ? 0d : 100d * scrollTop / level;\n    }\n\n    void setVerticalScrollPosition(final Double percentage) {\n\n        final Integer scrollHeight = scrollPanel().getElement().getScrollHeight();\n        final Integer clientHeight = scrollPanel().getElement().getClientHeight();\n        final Integer max = scrollHeight - clientHeight;\n\n        setScrollTop((int) ((max * percentage) / 100));\n    }\n\n    void setScrollTop(final Integer scrollTop) {\n        scrollPanel().getElement().setScrollTop(scrollTop);\n    }\n\n    void setScrollLeft(final Integer scrollLeft) {\n        scrollPanel().getElement().setScrollLeft(scrollLeft);\n    }\n\n    Panel scrollPanel() {\n        return gridLienzoScrollHandler.getScrollPanel();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollBounds.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport com.ait.lienzo.client.core.shape.IDrawable;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\n/*\n * Represents the Grid Lienzo bounds in the scrollbars context.\n */\n\nclass GridLienzoScrollBounds {\n\n    private static final Double DEFAULT_VALUE = 0D;\n\n    private final GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    private Bounds defaultBounds;\n\n    GridLienzoScrollBounds(final GridLienzoScrollHandler GridLienzoScrollHandler) {\n        this.gridLienzoScrollHandler = GridLienzoScrollHandler;\n    }\n\n    Double maxBoundX() {\n\n        final List<Double> boundsValues =\n                getVisibleGridWidgets()\n                        .map(gridWidget -> gridWidget.getX() + gridWidget.getWidth())\n                        .collect(Collectors.toList());\n\n        addExtraBounds(boundsValues,\n                       bounds -> bounds.getX() + bounds.getWidth());\n\n        return maxValue(boundsValues);\n    }\n\n    Double maxBoundY() {\n\n        final List<Double> boundsValues =\n                getVisibleGridWidgets()\n                        .map(gridWidget -> gridWidget.getY() + gridWidget.getHeight())\n                        .collect(Collectors.toList());\n\n        addExtraBounds(boundsValues,\n                       bounds -> bounds.getY() + bounds.getHeight());\n\n        return maxValue(boundsValues);\n    }\n\n    Double minBoundX() {\n\n        final List<Double> boundsValues =\n                getVisibleGridWidgets()\n                        .map(IPrimitive::getX)\n                        .collect(Collectors.toList());\n\n        addExtraBounds(boundsValues,\n                       Bounds::getX);\n\n        return minValue(boundsValues);\n    }\n\n    Double minBoundY() {\n\n        final List<Double> boundsValues =\n                getVisibleGridWidgets()\n                        .map(IPrimitive::getY)\n                        .collect(Collectors.toList());\n\n        addExtraBounds(boundsValues,\n                       Bounds::getY);\n\n        return minValue(boundsValues);\n    }\n\n    Stream<GridWidget> getVisibleGridWidgets() {\n        return getGridWidgets()\n                .stream()\n                .filter(IDrawable::isVisible);\n    }\n\n    private double maxValue(final List<Double> boundsValues) {\n        return boundsValues.stream().reduce(Double::max).orElse(DEFAULT_VALUE);\n    }\n\n    private double minValue(final List<Double> boundsValues) {\n        return boundsValues.stream().reduce(Double::min).orElse(DEFAULT_VALUE);\n    }\n\n    private void addExtraBounds(final List<Double> bounds,\n                                final Function<Bounds, Double> function) {\n        if (hasVisibleBounds()) {\n            bounds.add(function.apply(getVisibleBounds()));\n        }\n\n        if (hasDefaultBounds() && !isGridPinned()) {\n            bounds.add(function.apply(getDefaultBounds()));\n        }\n    }\n\n    Bounds getVisibleBounds() {\n        return getDefaultGridLayer().getVisibleBounds();\n    }\n\n    Boolean hasDefaultBounds() {\n        return Optional.ofNullable(getDefaultBounds()).isPresent();\n    }\n\n    Boolean hasVisibleBounds() {\n        final Viewport viewport = getDefaultGridLayer().getViewport();\n\n        return Optional.ofNullable(viewport).isPresent();\n    }\n\n    Bounds getDefaultBounds() {\n        return defaultBounds;\n    }\n\n    void setDefaultBounds(final Bounds defaultBounds) {\n        this.defaultBounds = defaultBounds;\n    }\n\n    DefaultGridLayer getDefaultGridLayer() {\n        return gridLienzoScrollHandler.getDefaultGridLayer();\n    }\n\n    Set<GridWidget> getGridWidgets() {\n        return getDefaultGridLayer().getGridWidgets();\n    }\n\n    private boolean isGridPinned() {\n        return getDefaultGridLayer().isGridPinned();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollHandler.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport java.util.Objects;\n\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseWheelEvent;\nimport com.google.gwt.event.dom.client.MouseWheelHandler;\nimport com.google.gwt.event.dom.client.ScrollEvent;\nimport com.google.gwt.event.dom.client.ScrollHandler;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.RestrictedMousePanMediator;\n\n/*\n * Responsible for the setup and control of every scroll related event.\n */\n\npublic class GridLienzoScrollHandler {\n\n    static final int DEFAULT_INTERNAL_SCROLL_HEIGHT = 1;\n\n    static final int DEFAULT_INTERNAL_SCROLL_WIDTH = 1;\n\n    private final GridLienzoScrollBars scrollBars = new GridLienzoScrollBars(this);\n\n    private final GridLienzoScrollPosition scrollPosition = new GridLienzoScrollPosition(this);\n\n    private final GridLienzoScrollBounds scrollBounds = new GridLienzoScrollBounds(this);\n\n    private final GridLienzoPanel panel;\n\n    private DefaultGridLayer emptyLayer;\n\n    private RestrictedMousePanMediator mousePanMediator;\n\n    public GridLienzoScrollHandler(final GridLienzoPanel panel) {\n        this.panel = panel;\n    }\n\n    public void init() {\n        setupGridLienzoScrollStyle();\n        setupScrollBarSynchronization();\n        setupMouseDragSynchronization();\n        setupContextSwitcher();\n    }\n\n    void setupContextSwitcher() {\n        getDomElementContainer().addDomHandler(disablePointerEvents(), MouseWheelEvent.getType());\n        getPanel().addMouseMoveHandler(enablePointerEvents());\n    }\n\n    MouseWheelHandler disablePointerEvents() {\n        return event -> gridLienzoScrollUI().disablePointerEvents(getDomElementContainer());\n    }\n\n    MouseMoveHandler enablePointerEvents() {\n        return event -> gridLienzoScrollUI().enablePointerEvents(getDomElementContainer());\n    }\n\n    public Integer scrollbarWidth() {\n        return getScrollPanel().getElement().getOffsetWidth() - getScrollPanel().getElement().getClientWidth();\n    }\n\n    public Integer scrollbarHeight() {\n        return getScrollPanel().getElement().getOffsetHeight() - getScrollPanel().getElement().getClientHeight();\n    }\n\n    void setupGridLienzoScrollStyle() {\n        gridLienzoScrollUI().setup();\n    }\n\n    GridLienzoScrollUI gridLienzoScrollUI() {\n        return new GridLienzoScrollUI(this);\n    }\n\n    void setupScrollBarSynchronization() {\n        getScrollPanel().addDomHandler(onScroll(),\n                                       ScrollEvent.getType());\n        synchronizeScrollSize();\n    }\n\n    void setupMouseDragSynchronization() {\n\n        mousePanMediator = makeRestrictedMousePanMediator();\n\n        getLienzoPanel().getViewport().getMediators().push(mousePanMediator);\n    }\n\n    RestrictedMousePanMediator makeRestrictedMousePanMediator() {\n        return new RestrictedMousePanMediator() {\n            @Override\n            protected void onMouseMove(final NodeMouseMoveEvent event) {\n                refreshScrollPosition();\n            }\n\n            @Override\n            protected Viewport getLayerViewport() {\n                return getViewport();\n            }\n        };\n    }\n\n    ScrollHandler onScroll() {\n        return (ScrollEvent event) -> {\n            final Boolean mouseIsNotDragging = !getMousePanMediator().isDragging();\n\n            if (mouseIsNotDragging) {\n                updateGridLienzoPosition();\n            }\n        };\n    }\n\n    public void refreshScrollPosition() {\n\n        synchronizeScrollSize();\n\n        setScrollBarsPosition(scrollPosition().currentRelativeX(),\n                              scrollPosition().currentRelativeY());\n    }\n\n    void updateGridLienzoPosition() {\n\n        final Double percentageX = scrollBars().getHorizontalScrollPosition();\n        final Double percentageY = scrollBars().getVerticalScrollPosition();\n\n        final Double currentXPosition = scrollPosition().currentPositionX(percentageX);\n        final Double currentYPosition = scrollPosition().currentPositionY(percentageY);\n\n        updateGridLienzoTransform(currentXPosition,\n                                  currentYPosition);\n    }\n\n    void updateGridLienzoTransform(final Double currentXPosition,\n                                   final Double currentYPosition) {\n\n        final Transform oldTransform = getViewport().getTransform();\n        final Double dx = currentXPosition - (oldTransform.getTranslateX() / oldTransform.getScaleX());\n        final Double dy = currentYPosition - (oldTransform.getTranslateY() / oldTransform.getScaleY());\n\n        final Transform newTransform = oldTransform.copy().translate(dx,\n                                                                     dy);\n\n        getViewport().setTransform(newTransform);\n        getDefaultGridLayer().batch();\n    }\n\n    void synchronizeScrollSize() {\n        getInternalScrollPanel().setPixelSize(calculateInternalScrollPanelWidth(),\n                                              calculateInternalScrollPanelHeight());\n    }\n\n    Integer calculateInternalScrollPanelWidth() {\n        final Double absWidth = scrollBounds().maxBoundX() - scrollBounds().minBoundX();\n\n        if (getViewport() != null && scrollPosition().deltaX() != 0) {\n            final Double scaleX = getViewport().getTransform().getScaleX();\n            final Double width = absWidth * scaleX;\n\n            return width.intValue();\n        }\n\n        return DEFAULT_INTERNAL_SCROLL_WIDTH;\n    }\n\n    Integer calculateInternalScrollPanelHeight() {\n        final Double absHeight = scrollBounds().maxBoundY() - scrollBounds().minBoundY();\n\n        if (getViewport() != null && scrollPosition().deltaY() != 0) {\n            final Double scaleY = getViewport().getTransform().getScaleY();\n            final Double height = absHeight * scaleY;\n\n            return height.intValue();\n        }\n\n        return DEFAULT_INTERNAL_SCROLL_HEIGHT;\n    }\n\n    void setScrollBarsPosition(final Double xPercentage,\n                               final Double yPercentage) {\n\n        scrollBars().setHorizontalScrollPosition(xPercentage);\n        scrollBars().setVerticalScrollPosition(yPercentage);\n    }\n\n    RestrictedMousePanMediator getMousePanMediator() {\n        return mousePanMediator;\n    }\n\n    AbsolutePanel getScrollPanel() {\n        return getPanel().getScrollPanel();\n    }\n\n    AbsolutePanel getInternalScrollPanel() {\n        return getPanel().getInternalScrollPanel();\n    }\n\n    AbsolutePanel getDomElementContainer() {\n        return getPanel().getDomElementContainer();\n    }\n\n    LienzoPanel getLienzoPanel() {\n        return getPanel().getLienzoPanel();\n    }\n\n    GridLienzoPanel getPanel() {\n        return panel;\n    }\n\n    DefaultGridLayer getDefaultGridLayer() {\n        //Do not use Optional.ofNullable(..).orElse(..) as the _else_ expression is *always* invoked\n        final DefaultGridLayer defaultGridLayer = panel.getDefaultGridLayer();\n        return Objects.nonNull(defaultGridLayer) ? defaultGridLayer : emptyLayer();\n    }\n\n    Viewport getViewport() {\n        return getDefaultGridLayer().getViewport();\n    }\n\n    DefaultGridLayer emptyLayer() {\n        if (Objects.isNull(emptyLayer)) {\n            emptyLayer = new DefaultGridLayer();\n        }\n        return emptyLayer;\n    }\n\n    GridLienzoScrollBars scrollBars() {\n        return scrollBars;\n    }\n\n    GridLienzoScrollPosition scrollPosition() {\n        return scrollPosition;\n    }\n\n    GridLienzoScrollBounds scrollBounds() {\n        return scrollBounds;\n    }\n\n    public void setBounds(final Bounds bounds) {\n        scrollBounds().setDefaultBounds(bounds);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollPosition.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\n/*\n * Converts the viewport coordinates to a proportional unit, in the Grid Lienzo scrollbars context.\n */\n\nclass GridLienzoScrollPosition {\n\n    private final GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    GridLienzoScrollPosition(final GridLienzoScrollHandler gridLienzoScrollHandler) {\n        this.gridLienzoScrollHandler = gridLienzoScrollHandler;\n    }\n\n    Double currentRelativeX() {\n\n        final Double delta = deltaX();\n\n        return delta == 0d ? 0d : 100 * currentX() / delta;\n    }\n\n    Double currentRelativeY() {\n\n        final Double delta = deltaY();\n\n        return delta == 0d ? 0d : 100 * currentY() / delta;\n    }\n\n    Double currentPositionX(final Double level) {\n\n        final Double position = deltaX() * level / 100;\n\n        return -(bounds().minBoundX() + position);\n    }\n\n    Double currentPositionY(final Double level) {\n\n        final Double position = deltaY() * level / 100;\n\n        return -(bounds().minBoundY() + position);\n    }\n\n    Double deltaX() {\n        return bounds().maxBoundX() - bounds().minBoundX() - getVisibleBounds().getWidth();\n    }\n\n    Double deltaY() {\n        return bounds().maxBoundY() - bounds().minBoundY() - getVisibleBounds().getHeight();\n    }\n\n    private Double currentX() {\n        return -(getTransform().getTranslateX() / getTransform().getScaleX() + bounds().minBoundX());\n    }\n\n    private Double currentY() {\n        return -(getTransform().getTranslateY() / getTransform().getScaleY() + bounds().minBoundY());\n    }\n\n    Transform getTransform() {\n        final Viewport viewport = getDefaultGridLayer().getViewport();\n\n        return viewport.getTransform();\n    }\n\n    Bounds getVisibleBounds() {\n        return getDefaultGridLayer().getVisibleBounds();\n    }\n\n    GridLienzoScrollBounds bounds() {\n        return gridLienzoScrollHandler.scrollBounds();\n    }\n\n    private DefaultGridLayer getDefaultGridLayer() {\n        return gridLienzoScrollHandler.getDefaultGridLayer();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollUI.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.Widget;\n\n/*\n * Applies the scrollbar style in the Grid Lienzo panels.\n */\n\nclass GridLienzoScrollUI {\n\n    private final GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    GridLienzoScrollUI(final GridLienzoScrollHandler gridLienzoScrollHandler) {\n        this.gridLienzoScrollHandler = gridLienzoScrollHandler;\n    }\n\n    void setup() {\n        applyScrollPanelStyle();\n        applyInternalScrollPanelStyle();\n        applyDomElementContainerStyle();\n    }\n\n    void applyScrollPanelStyle() {\n        style(getScrollPanel()).setPosition(Style.Position.RELATIVE);\n        style(getScrollPanel()).setOverflow(Style.Overflow.SCROLL);\n    }\n\n    void applyInternalScrollPanelStyle() {\n        style(getInternalScrollPanel()).setPosition(Style.Position.ABSOLUTE);\n    }\n\n    void applyDomElementContainerStyle() {\n        style(getDomElementContainer()).setPosition(Style.Position.ABSOLUTE);\n        style(getDomElementContainer()).setZIndex(1);\n    }\n\n    private AbsolutePanel getScrollPanel() {\n        return gridLienzoScrollHandler.getScrollPanel();\n    }\n\n    private AbsolutePanel getInternalScrollPanel() {\n        return gridLienzoScrollHandler.getInternalScrollPanel();\n    }\n\n    private AbsolutePanel getDomElementContainer() {\n        return gridLienzoScrollHandler.getDomElementContainer();\n    }\n\n    void enablePointerEvents(final Widget widget) {\n        setPointerEvents(widget, \"initial\");\n    }\n\n    void disablePointerEvents(final Widget widget) {\n        setPointerEvents(widget, \"none\");\n    }\n\n    void setPointerEvents(final Widget widget,\n                          final String value) {\n        style(widget).setProperty(\"pointerEvents\", value);\n    }\n\n    Style style(final Widget widget) {\n        return widget.getElement().getStyle();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollable.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\n\npublic interface GridLienzoScrollable {\n\n    void updatePanelSize();\n\n    void updatePanelSize(final Integer width,\n                         final Integer height);\n\n    void refreshScrollPosition();\n\n    void setBounds(final Bounds bounds);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.core.grids.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/main/resources/org/uberfire/ext/wires/core/grids/WiresCoreGrids.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name='com.ait.lienzo.Lienzo'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n\n  <source path=\"client\"></source>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/GridCellEditActionTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model;\n\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseWheelEvent;\nimport com.google.gwt.event.dom.client.DoubleClickEvent;\nimport com.google.gwt.event.dom.client.MouseEvent;\nimport com.google.gwt.event.dom.client.MouseWheelEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GridCellEditActionTest {\n\n    @Mock\n    private MouseEvent clickEvent;\n\n    @Mock\n    private DoubleClickEvent doubleClickEvent;\n\n    @Mock\n    private MouseWheelEvent mouseWheelEvent;\n\n    private NodeMouseClickEvent nodeMouseClickEvent;\n\n    private NodeMouseDoubleClickEvent nodeMouseDoubleClickEvent;\n\n    private NodeMouseWheelEvent nodeMouseWheelEvent;\n\n    @Before\n    public void setup() {\n        this.nodeMouseClickEvent = new NodeMouseClickEvent(clickEvent);\n        this.nodeMouseDoubleClickEvent = new NodeMouseDoubleClickEvent(doubleClickEvent);\n        this.nodeMouseWheelEvent = new NodeMouseWheelEvent(mouseWheelEvent);\n    }\n\n    @Test\n    public void assertEnumeratedValues() {\n        assertThat(GridCellEditAction.getSupportedEditAction(nodeMouseClickEvent)).isEqualTo(GridCellEditAction.SINGLE_CLICK);\n        assertThat(GridCellEditAction.getSupportedEditAction(nodeMouseDoubleClickEvent)).isEqualTo(GridCellEditAction.DOUBLE_CLICK);\n        assertThat(GridCellEditAction.getSupportedEditAction(nodeMouseWheelEvent)).isEqualTo(GridCellEditAction.NONE);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseBoundsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class BaseBoundsTest {\n\n    @Test\n    public void validConstructorParameters() {\n        final BaseBounds b = new BaseBounds(10.0,\n                                            20.0,\n                                            30.0,\n                                            40.0);\n        assertEquals(10.0,\n                     b.getX(),\n                     0.0);\n        assertEquals(20.0,\n                     b.getY(),\n                     0.0);\n        assertEquals(30.0,\n                     b.getWidth(),\n                     0.0);\n        assertEquals(40.0,\n                     b.getHeight(),\n                     0.0);\n    }\n\n    @SuppressWarnings(\"unused\")\n    @Test(expected = IllegalStateException.class)\n    public void invalidConstructorWidthParameter() {\n        final BaseBounds b = new BaseBounds(10.0,\n                                            20.0,\n                                            -30.0,\n                                            40.0);\n    }\n\n    @SuppressWarnings(\"unused\")\n    @Test(expected = IllegalStateException.class)\n    public void invalidConstructorHeightParameter() {\n        final BaseBounds b = new BaseBounds(10.0,\n                                            20.0,\n                                            30.0,\n                                            -40.0);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void invalidSetterWidthParameter() {\n        final BaseBounds b = new BaseBounds(10.0,\n                                            20.0,\n                                            30.0,\n                                            40.0);\n        b.setWidth(-30.0);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void invalidSetterHeightParameter() {\n        final BaseBounds b = new BaseBounds(10.0,\n                                            20.0,\n                                            30.0,\n                                            40.0);\n        b.setHeight(-40.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridDataTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.OptionalDouble;\nimport java.util.stream.IntStream;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\n\nimport static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertSame;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridDataTest {\n\n    @Mock\n    private GridColumnRenderer<String> columnRenderer;\n\n    @Mock\n    private BaseHeaderMetaData header;\n\n    @Captor\n    private ArgumentCaptor<Boolean> booleanArgumentCaptor;\n\n    @Captor\n    private ArgumentCaptor<OptionalDouble> optionalDoubleArgumentCaptor;\n\n    private BaseGridData baseGridData;\n\n    @Before\n    public void setUp() {\n        baseGridData = new BaseGridData();\n    }\n\n    @Test\n    public void testDefaultHeaderRowCount() {\n        assertEquals(0, baseGridData.getHeaderRowCount());\n    }\n\n    @Test\n    public void testGetHeaderRowCountWithColumnWithHeaderMetaData() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n\n        baseGridData.appendColumn(column);\n\n        assertEquals(1, baseGridData.getHeaderRowCount());\n    }\n\n    @Test\n    public void testGetHeaderRowCountWithColumnsWithHeaderMetaData() {\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(Collections.emptyList(), columnRenderer, 100.0);\n\n        baseGridData.appendColumn(column1);\n        baseGridData.appendColumn(column2);\n\n        assertEquals(1, baseGridData.getHeaderRowCount());\n    }\n\n    @Test\n    public void testGetHeaderRowCountWithColumnWithoutHeaderMetaData() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(Collections.emptyList(), columnRenderer, 100.0);\n\n        baseGridData.appendColumn(column);\n\n        assertEquals(0, baseGridData.getHeaderRowCount());\n    }\n\n    @Test\n    public void testDeleteColumn() {\n\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n\n        baseGridData.insertColumn(0, column1);\n        baseGridData.insertColumn(0, column2);\n\n        baseGridData.deleteColumn(column1);\n\n        final List<GridColumn<?>> columns = baseGridData.getColumns();\n\n        assertSame(column2, columns.get(0));\n        assertEquals(1, columns.size());\n    }\n\n    @Test\n    public void testRemoveColumnWhenThereIsTheSameColumn() {\n\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 25.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 50.0);\n\n        baseGridData.insertColumn(0, column1);\n        baseGridData.insertColumn(0, column2);\n\n        baseGridData.removeColumn(column2);\n\n        final List<GridColumn<?>> columns = baseGridData.getColumns();\n\n        assertSame(column1, columns.get(0));\n        assertEquals(1, columns.size());\n    }\n\n    @Test\n    public void testRemoveColumnWhenThereIsNotTheSameColumnButThereIsAnEqualColumn() {\n\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 25.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 50.0);\n\n        baseGridData.insertColumn(0, column1);\n        baseGridData.insertColumn(1, column2);\n\n        baseGridData.removeColumn(new BaseGridColumn<String>(header, columnRenderer, 50.0) {{\n            setIndex(1);\n        }});\n\n        final List<GridColumn<?>> columns = baseGridData.getColumns();\n\n        assertSame(column1, columns.get(0));\n        assertEquals(1, columns.size());\n    }\n\n    @Test\n    public void testRemoveColumnWhenThereIsNoEqualColumn() {\n\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 25.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 50.0);\n\n        baseGridData.insertColumn(0, column1);\n        baseGridData.insertColumn(1, column2);\n\n        baseGridData.removeColumn(new BaseGridColumn<String>(header, columnRenderer, 75.0));\n\n        final List<GridColumn<?>> columns = baseGridData.getColumns();\n\n        assertEquals(2, columns.size());\n    }\n\n    @Test\n    public void testSetCellValueWhenNoExistingGridCell() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0);\n\n        baseGridData.insertColumn(0, column);\n        baseGridData.appendRow(new BaseGridRow());\n\n        baseGridData.setCellValue(0, 0, new BaseGridCellValue<>(\"hello\"));\n\n        assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo(\"hello\");\n        assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class);\n    }\n\n    @Test\n    public void testSetCellValueWhenExistingBaseGridCell() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0);\n\n        baseGridData.insertColumn(0, column);\n        baseGridData.appendRow(new BaseGridRow());\n\n        baseGridData.setCell(0, 0, () -> new BaseGridCell<>(new BaseGridCellValue<>(\"\")));\n        baseGridData.setCellValue(0, 0, new BaseGridCellValue<>(\"hello\"));\n\n        assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo(\"hello\");\n        assertThat(baseGridData.getCell(0, 0)).isInstanceOf(BaseGridCell.class);\n    }\n\n    @Test\n    public void testSetCellValueWhenExistingCustomGridCell() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 25.0);\n\n        baseGridData.insertColumn(0, column);\n        baseGridData.appendRow(new BaseGridRow());\n\n        baseGridData.setCell(0, 0, () -> new CustomGridCell<>(new BaseGridCellValue<>(\"hello\")));\n        baseGridData.setCellValue(0, 0, new BaseGridCellValue<>(\"hello\"));\n\n        assertThat(baseGridData.getCell(0, 0).getValue().getValue()).isEqualTo(\"hello\");\n        assertThat(baseGridData.getCell(0, 0)).isInstanceOf(CustomGridCell.class);\n    }\n\n    @Test\n    public void testSelectHeaderCell() {\n        final BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n\n        baseGridData.appendColumn(column1);\n        baseGridData.appendColumn(column2);\n\n        assertThat(baseGridData.selectHeaderCell(0, 1).getMaxRowIndex()).isEqualTo(0);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = baseGridData.getSelectedHeaderCells();\n        assertThat(selectedHeaderCells).isNotEmpty();\n        assertThat(selectedHeaderCells.size()).isEqualTo(1);\n        assertThat(selectedHeaderCells).contains(new GridData.SelectedCell(0, 1));\n    }\n\n    @Test\n    public void testSelectHeaderCellOutOfHeaderRowRange() {\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n\n        baseGridData.appendColumn(column);\n\n        assertThat(baseGridData.selectHeaderCell(1, 0).getMaxRowIndex()).isEqualTo(1);\n\n        assertThat(baseGridData.getSelectedHeaderCells()).isEmpty();\n    }\n\n    @Test\n    public void testSelectHeaderCellOutOfHeaderColumnRange() {\n        assertThat(baseGridData.selectHeaderCell(0, 0).getMaxRowIndex()).isEqualTo(0);\n\n        assertThat(baseGridData.getSelectedHeaderCells()).isEmpty();\n    }\n\n    @Test\n    public void appendColumn() {\n        BaseGridData data = spy(baseGridData);\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        column.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n\n        double originalWidth = data.getWidth();\n        data.appendColumn(column);\n\n        verify(data, times(1))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertTrue(booleanArgumentCaptor.getValue());\n        assertTrue(optionalDoubleArgumentCaptor.getValue().isPresent());\n        assertEquals(originalWidth, optionalDoubleArgumentCaptor.getValue().getAsDouble(), 0.1);\n\n        reset(data);\n        final BaseGridColumn<String> columnFixed = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.appendColumn(columnFixed);\n\n        verify(data, never()).internalRefreshWidth(anyBoolean(), any());\n    }\n\n    @Test\n    public void insertColumn() {\n        BaseGridData data = spy(baseGridData);\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        column.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n\n        double originalWidth = data.getWidth();\n        data.insertColumn(0, column);\n\n        verify(data, times(1))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertTrue(booleanArgumentCaptor.getValue());\n        assertTrue(optionalDoubleArgumentCaptor.getValue().isPresent());\n        assertEquals(originalWidth, optionalDoubleArgumentCaptor.getValue().getAsDouble(), 0.1);\n\n        reset(data);\n        final BaseGridColumn<String> columnFixed = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.insertColumn(0, columnFixed);\n\n        verify(data, never()).internalRefreshWidth(anyBoolean(), any());\n    }\n\n    @Test\n    public void deleteColumn() {\n        BaseGridData data = spy(baseGridData);\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.appendColumn(column);\n        reset(data);\n        data.deleteColumn(column);\n\n        verify(data, times(2))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertTrue(booleanArgumentCaptor.getAllValues().stream().allMatch(elem -> elem));\n        assertFalse(optionalDoubleArgumentCaptor.getAllValues().stream().allMatch(OptionalDouble::isPresent));\n    }\n\n    @Test\n    public void deleteColumn_checkColumnsAndCellsShifting() {\n        BaseGridData data = spy(baseGridData);\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column3 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        final BaseGridColumn<String> column4 = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.appendColumn(column);\n        data.appendColumn(column2);\n        data.appendColumn(column3);\n        data.appendColumn(column4);\n        final BaseGridRow row = new BaseGridRow();\n        data.appendRow(row);\n        BaseGridCell cell = new BaseGridCell(new BaseGridCellValue(\"\"));\n        BaseGridCell cell2 = new BaseGridCell(new BaseGridCellValue(\"\"));\n        BaseGridCell cell3 = new BaseGridCell(new BaseGridCellValue(\"\"));\n        BaseGridCell cell4 = new BaseGridCell(new BaseGridCellValue(\"\"));\n        data.setCell(0,0, () -> cell);\n        data.setCell(0,1, () -> cell2);\n        data.setCell(0,2, () -> cell3);\n        data.setCell(0,3, () -> cell4);\n\n        assertTrue(data.getColumnCount() == 4);\n        assertSame(data.getColumns().get(0), column);\n        assertSame(data.getColumns().get(1), column2);\n        assertSame(data.getColumns().get(2), column3);\n        assertSame(data.getColumns().get(3), column4);\n        assertTrue(data.getRow(0).getCells().size() == 4);\n        assertSame(data.getRow(0).getCells().get(0), cell);\n        assertSame(data.getRow(0).getCells().get(1), cell2);\n        assertSame(data.getRow(0).getCells().get(2), cell3);\n        assertSame(data.getRow(0).getCells().get(3), cell4);\n\n        data.deleteColumn(column2);\n\n        assertTrue(data.getColumnCount() == 3);\n        assertSame(data.getColumns().get(0), column);\n        assertSame(data.getColumns().get(1), column3);\n        assertSame(data.getColumns().get(2), column4);\n        assertTrue(data.getRow(0).getCells().size() == 3);\n        assertSame(data.getRow(0).getCells().get(0), cell);\n        assertSame(data.getRow(0).getCells().get(1), cell3);\n        assertSame(data.getRow(0).getCells().get(2), cell4);\n        verify(data, times(2))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertTrue(booleanArgumentCaptor.getAllValues().stream().allMatch(elem -> elem));\n        assertFalse(optionalDoubleArgumentCaptor.getAllValues().stream().allMatch(OptionalDouble::isPresent));\n    }\n\n    @Test\n    public void removeColumn() {\n        BaseGridData data = spy(baseGridData);\n        final BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.appendColumn(column);\n        reset(data);\n        data.removeColumn(column);\n\n        verify(data, times(1))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertTrue(booleanArgumentCaptor.getValue());\n        assertFalse(optionalDoubleArgumentCaptor.getValue().isPresent());\n    }\n\n    @Test\n    public void refreshWidth() {\n        BaseGridData data = spy(baseGridData);\n\n        data.refreshWidth();\n\n        verify(data, times(1))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertFalse(booleanArgumentCaptor.getValue());\n        assertFalse(optionalDoubleArgumentCaptor.getValue().isPresent());\n    }\n\n    @Test\n    public void refreshWidthWithValue() {\n        BaseGridData data = spy(baseGridData);\n\n        double width = 100;\n        data.refreshWidth(width);\n\n        verify(data, times(1))\n                .internalRefreshWidth(booleanArgumentCaptor.capture(), optionalDoubleArgumentCaptor.capture());\n        assertFalse(booleanArgumentCaptor.getValue());\n        assertEquals(width, optionalDoubleArgumentCaptor.getValue().getAsDouble(), 0.1);\n    }\n\n    @Test\n    public void internalRefreshWidth() {\n        int visibleWidth = 0;\n        double minimumWidth = 600;\n        BaseGridData data = spy(baseGridData);\n\n        data.setVisibleSizeAndRefresh(visibleWidth, 0);\n        assertFalse(data.internalRefreshWidth(true, OptionalDouble.empty()));\n\n        visibleWidth = 1000;\n        data.setVisibleSizeAndRefresh(visibleWidth, 0);\n        assertFalse(data.internalRefreshWidth(false, OptionalDouble.empty()));\n        data.setVisibleSizeAndRefresh(visibleWidth, 0);\n        assertFalse(data.internalRefreshWidth(true, OptionalDouble.empty()));\n\n        visibleWidth = 500;\n        data.setVisibleSizeAndRefresh(visibleWidth, 0);\n        assertFalse(data.internalRefreshWidth(true, OptionalDouble.empty()));\n\n        BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        data.appendColumn(column);\n        column.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n\n        column.setWidth(0);\n        assertTrue(data.internalRefreshWidth(true, OptionalDouble.empty()));\n        assertEquals(visibleWidth, column.getWidth(), 0.1);\n\n        column.setWidth(0);\n        column.setMinimumWidth(minimumWidth);\n        assertTrue(data.internalRefreshWidth(true, OptionalDouble.empty()));\n        assertEquals(minimumWidth, column.getWidth(), 0.1);\n\n        BaseGridColumn<String> fixedColumn = new BaseGridColumn<>(header, columnRenderer, 100);\n        data.appendColumn(fixedColumn);\n        column.setWidth(100.0);\n        column.setMinimumWidth(100.0);\n        assertTrue(data.internalRefreshWidth(false, OptionalDouble.empty()));\n        assertEquals(visibleWidth - fixedColumn.getWidth(), column.getWidth(), 0.1);\n        // if already refreshed nothing should change\n        assertFalse(data.internalRefreshWidth(false, OptionalDouble.empty()));\n        assertEquals(visibleWidth - fixedColumn.getWidth(), column.getWidth(), 0.1);\n    }\n\n    @Test\n    public void getWidth() {\n        BaseGridData data = spy(baseGridData);\n        double previous = data.getWidth();\n        BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, 100.0);\n        column.setVisible(false);\n        data.appendColumn(column);\n        double updated = data.getWidth();\n\n        assertEquals(previous, updated, 0.1);\n    }\n\n    @Test\n    public void calculateInitWidth() {\n        BaseGridData data = spy(baseGridData);\n        double originalWidth = 100;\n        BaseGridColumn<String> column = new BaseGridColumn<>(header, columnRenderer, originalWidth);\n        column.setColumnWidthMode(GridColumn.ColumnWidthMode.FIXED);\n        data.appendColumn(column);\n        assertEquals(originalWidth, data.calculateInitWidth(column, OptionalDouble.empty()), 0.1);\n\n        data.setVisibleSizeAndRefresh(500, 0);\n\n        BaseGridColumn<String> column1 = new BaseGridColumn<>(header, columnRenderer, originalWidth);\n        column1.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        data.appendColumn(column1);\n\n        assertEquals(data.getVisibleWidth() - originalWidth, data.calculateInitWidth(column1, OptionalDouble.empty()), 0.1);\n\n        BaseGridColumn<String> column2 = new BaseGridColumn<>(header, columnRenderer, originalWidth);\n        column2.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        data.appendColumn(column2);\n\n        BaseGridColumn<String> column3 = new BaseGridColumn<>(header, columnRenderer, originalWidth);\n        column3.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        data.appendColumn(column3);\n\n        assertEquals(((data.getVisibleWidth() - originalWidth) / 2), data.calculateInitWidth(column2, OptionalDouble.empty()), 0.1);\n\n        BaseGridColumn<String> column4 = new BaseGridColumn<>(header, columnRenderer, originalWidth);\n        column4.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        double minWidth = originalWidth * 10;\n        column4.setMinimumWidth(minWidth);\n        data.appendColumn(column4);\n\n        assertEquals(minWidth, column4.getWidth(), 0.1);\n    }\n\n    static class CustomGridCell<T> extends BaseGridCell<T> {\n\n        public CustomGridCell(final GridCellValue<T> value) {\n            super(value);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/BaseGridTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.function.Consumer;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl.BaseGridColumnRenderer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.fail;\n\npublic abstract class BaseGridTest {\n\n    protected GridData gridData;\n\n    protected GridRow[] gridRows;\n\n    protected GridColumn<String>[] gridColumns;\n\n    // true by default\n    private boolean isMerged = true;\n\n    protected void constructGridData(final boolean isMerged, final int columnCount, final int rowCount) {\n        this.isMerged = isMerged;\n        constructGridData(columnCount, rowCount);\n    }\n\n    protected void constructGridData(final int columnCount, final int rowCount) {\n        gridData = new BaseGridData(isMerged);\n\n        gridColumns = new GridColumn[columnCount];\n        for (int i = 0; i < columnCount; i++) {\n            gridColumns[i] = new MockMergableGridColumn<>(\"col\" + i, 100);\n            gridData.appendColumn(gridColumns[i]);\n        }\n\n        gridRows = new GridRow[rowCount];\n        for (int i = 0; i < rowCount; i++) {\n            gridRows[i] = new BaseGridRow();\n            gridData.appendRow(gridRows[i]);\n        }\n    }\n\n    public void assertGridIndexes(final GridData data,\n                                  final boolean[] expectedRowMergeStates,\n                                  final boolean[] expectedRowCollapseStates,\n                                  final Expected[][] expectedCellStates) {\n        if (data.getRowCount() != expectedRowMergeStates.length) {\n            fail(\"Size of parameter 'expectedRowMergeStates' differs to expected row count.\");\n        }\n        if (data.getRowCount() != expectedRowCollapseStates.length) {\n            fail(\"Size of parameter 'expectedRowCollapseStates' differs to expected row count.\");\n        }\n        if (data.getRowCount() != expectedCellStates.length) {\n            fail(\"Size of parameter 'expectedCellStates' differs to expected row count.\");\n        }\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            final GridRow row = data.getRow(rowIndex);\n            assertEquals(\"Row[\" + rowIndex + \"] actual isMerged() differs to expected.\",\n                         expectedRowMergeStates[rowIndex],\n                         row.isMerged());\n            assertEquals(\"Row[\" + rowIndex + \"] actual isCollapsed() differs to expected.\",\n                         expectedRowCollapseStates[rowIndex],\n                         row.isCollapsed());\n\n            if (data.getColumnCount() != expectedCellStates[rowIndex].length) {\n                fail(\"Size of parameter 'expectedCellStates[\" + rowIndex + \"]' differs to expected column count.\");\n            }\n\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final GridCell cell = data.getCell(rowIndex,\n                                                   columnIndex);\n                if (cell == null) {\n                    assertNull(\"Cell[\" + columnIndex + \", \" + rowIndex + \"] was expected to be null.\",\n                               expectedCellStates[rowIndex][columnIndex].value);\n                } else {\n                    assertEquals(\"Cell[\" + columnIndex + \", \" + rowIndex + \"] actual isMerged() differs to expected.\",\n                                 expectedCellStates[rowIndex][columnIndex].isMerged,\n                                 cell.isMerged());\n                    assertEquals(\"Cell[\" + columnIndex + \", \" + rowIndex + \"] actual getMergedCellCount() differs to expected.\",\n                                 expectedCellStates[rowIndex][columnIndex].mergedCellCount,\n                                 cell.getMergedCellCount());\n                    assertEquals(\"Cell[\" + columnIndex + \", \" + rowIndex + \"] actual getValue() differs to expected.\",\n                                 expectedCellStates[rowIndex][columnIndex].value,\n                                 cell.getValue().getValue());\n                }\n            }\n        }\n    }\n\n    public static class Expected {\n\n        private boolean isMerged;\n        private int mergedCellCount;\n        private Object value;\n\n        private Expected(final boolean isMerged,\n                         final int mergedCellCount,\n                         final Object value) {\n            this.isMerged = isMerged;\n            this.mergedCellCount = mergedCellCount;\n            this.value = value;\n        }\n\n        private Expected(final Object value) {\n            this.value = value;\n        }\n\n        public static Expected build(final Object value) {\n            return new Expected(value);\n        }\n\n        public static Expected build(final boolean isMerged,\n                                     final int mergedCellCount,\n                                     final Object value) {\n            return new Expected(isMerged,\n                                mergedCellCount,\n                                value);\n        }\n    }\n\n    public static class MockMergableGridColumn<T> extends BaseGridColumn<T> {\n\n        public MockMergableGridColumn(final String title,\n                                      final double width) {\n            super(new BaseHeaderMetaData(title),\n                  new MockMergableGridColumnRenderer<T>(),\n                  width);\n        }\n\n        @Override\n        public void edit(final GridCell<T> cell,\n                         final GridBodyCellRenderContext context,\n                         final Consumer<GridCellValue<T>> callback) {\n            //Do nothing\n        }\n    }\n\n    public static class MockMergableGridColumnRenderer<T> extends BaseGridColumnRenderer<T> {\n\n        @Override\n        public Group renderCell(final GridCell<T> cell,\n                                final GridBodyCellRenderContext context) {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridCellSelectionsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.function.Consumer;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.RowSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest.Expected.build;\n\npublic class GridCellSelectionsTest extends BaseGridTest {\n\n    @Test\n    public void testSelectCell() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMergedData() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellGroupedDataSelectGroupedCell() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellGroupedDataSelectMergedCell() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        gridData.selectCell(0,\n                            1);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMultipleTimes() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        //Select once\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        //Select again\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testClearSelections() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        gridData.clearSelections();\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                   1)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMoveColumn() {\n        constructGridData(2, 2);\n        final GridColumn<String> gc1 = gridColumns[0];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")}\n                          });\n\n        //Select cell\n        gridData.selectCell(0,\n                            0);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n\n        //Move column\n        gridData.moveColumnTo(1,\n                              gc1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n    }\n\n    @Test\n    public void testMoveColumnSelectCell() {\n        constructGridData(2, 2);\n        final GridColumn<String> gc1 = gridColumns[0];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")}\n                          });\n\n        //Move column\n        gridData.moveColumnTo(1,\n                              gc1);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n\n        //Select cell\n        gridData.selectCell(0,\n                            0);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n    }\n\n    @Test\n    public void testSelectCellsMoveColumn() {\n        constructGridData(3, 2);\n        final GridColumn<String> gc3 = gridColumns[2];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        //Select cell\n        gridData.selectCells(0,\n                             0,\n                             2,\n                             1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   2)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   2)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(2, 0)\",\n                     gridData.getCell(0,\n                                      2).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n        assertEquals(\"(2, 1)\",\n                     gridData.getCell(1,\n                                      2).getValue().getValue());\n\n        //Move column\n        gridData.moveColumnTo(1,\n                              gc3);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   2)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   2)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      2).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      2).getValue().getValue());\n    }\n\n    @Test\n    public void testMoveColumnSelectCells() {\n        constructGridData(3, 2);\n        final GridColumn<String> gc3 = gridColumns[2];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        //Move column\n        gridData.moveColumnTo(1,\n                              gc3);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   2)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   2)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      2).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      2).getValue().getValue());\n\n        //Select cell\n        gridData.selectCells(0,\n                             0,\n                             2,\n                             1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  2)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   2)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        assertEquals(\"(0, 0)\",\n                     gridData.getCell(0,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 0)\",\n                     gridData.getCell(0,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 0)\",\n                     gridData.getCell(0,\n                                      2).getValue().getValue());\n        assertEquals(\"(0, 1)\",\n                     gridData.getCell(1,\n                                      0).getValue().getValue());\n        assertEquals(\"(2, 1)\",\n                     gridData.getCell(1,\n                                      1).getValue().getValue());\n        assertEquals(\"(1, 1)\",\n                     gridData.getCell(1,\n                                      2).getValue().getValue());\n    }\n\n    @Test\n    public void testSelectCellMergedDataInsertRow() {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.insertRow(1,\n                           new BaseGridRow());\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellUnmergedDataInsertRow() {\n        constructGridData(false, 1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(1,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.insertRow(1,\n                           new BaseGridRow());\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMergedDataDeleteRow() {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteRow(1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMergedDataDeleteRowWithAdditionalSelections() {\n        constructGridData(1, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(rowIndex < 2 ? \"a\" : \"b\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"a\")},\n                                  {build(true,\n                                         0,\n                                         \"a\")},\n                                  {build(false,\n                                         1,\n                                         \"b\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(2,\n                            0);\n        assertEquals(3,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteRow(1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellGroupedDataDeleteRow() {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.collapseCell(0,\n                              0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteRow(0);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellGroupedDataDeleteRowWithAdditionalSelections() {\n        constructGridData(1, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(rowIndex < 2 ? \"a\" : \"b\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"a\")},\n                                  {build(true,\n                                         0,\n                                         \"a\")},\n                                  {build(false,\n                                         1,\n                                         \"b\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(2,\n                            0);\n        gridData.collapseCell(0,\n                              0);\n        assertEquals(3,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteRow(0);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellUnmergedDataDeleteRow() {\n        constructGridData(false, 1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(1,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteRow(1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellThenAppendColumn() {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.appendColumn(new MockMergableGridColumn<String>(\"col1\",\n                                                                 100));\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellInsertColumn() {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"(0, 0)\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.insertColumn(0,\n                              new MockMergableGridColumn<String>(\"col1\",\n                                                                 100));\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellAppendColumnWithRowSelected() {\n        doTestSelectCellWithRowSelected((data) -> data.appendColumn(new MockMergableGridColumn<String>(\"col1\",\n                                                                                                       100)));\n    }\n\n    @Test\n    public void testSelectCellInsertColumnWithRowSelected() {\n        doTestSelectCellWithRowSelected((data) -> data.insertColumn(0,\n                                                                    new MockMergableGridColumn<String>(\"col1\",\n                                                                                                       100)));\n    }\n\n    private void doTestSelectCellWithRowSelected(final Consumer<GridData> mutation) {\n        constructGridData(1, 2);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<>(rowIndex));\n            gridData.getCell(rowIndex,\n                             0).setSelectionStrategy(RowSelectionStrategy.INSTANCE);\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         0)},\n                                  {build(false,\n                                         1,\n                                         1)}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        mutation.accept(gridData);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                   1)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellDeleteColumn() {\n        constructGridData(2, 1);\n        final GridColumn<String> gc1 = gridColumns[0];\n\n        for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n            gridData.setCellValue(0,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(0, \" + columnIndex + \")\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false},\n                          new boolean[]{false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(0, 1)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteColumn(gc1);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectHeaderCellDeleteColumn() {\n        constructGridData(2, 0);\n        final GridColumn<String> gc0 = gridColumns[0];\n        final GridColumn<String> gc1 = gridColumns[1];\n\n        gc0.getHeaderMetaData().add(new BaseHeaderMetaData(\"col0\"));\n        gc1.getHeaderMetaData().add(new BaseHeaderMetaData(\"col1\"));\n\n        gridData.selectHeaderCell(0, 0);\n        gridData.selectHeaderCell(0, 1);\n        assertEquals(2,\n                     gridData.getSelectedHeaderCells().size());\n\n        gridData.deleteColumn(gc0);\n\n        assertTrue(gridData.getSelectedHeaderCells().contains(new GridData.SelectedCell(0,\n                                                                                        0)));\n        assertFalse(gridData.getSelectedHeaderCells().contains(new GridData.SelectedCell(0,\n                                                                                         1)));\n        assertEquals(1,\n                     gridData.getSelectedHeaderCells().size());\n    }\n\n    @Test\n    public void testSelectCellDeleteColumnWithAdditionalSelections() {\n        constructGridData(2, 1);\n        final GridColumn<String> gc1 = gridColumns[0];\n\n        for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n            gridData.setCellValue(0,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(0, \" + columnIndex + \")\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false},\n                          new boolean[]{false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(0, 1)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(0,\n                            1);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n\n        gridData.deleteColumn(gc1);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMoveColumnDeleteColumn() {\n        constructGridData(2, 1);\n        final GridColumn<String> gc1 = gridColumns[0];\n\n        for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n            gridData.setCellValue(0,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(0, \" + columnIndex + \")\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false},\n                          new boolean[]{false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(0, 1)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n        gridData.moveColumnTo(1,\n                              gc1);\n\n        gridData.deleteColumn(gc1);\n\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   0)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   1)));\n        assertEquals(0,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testSelectCellMoveColumnToSplitSelectionsDeleteColumn() {\n        constructGridData(4, 1);\n        final GridColumn<String> gc2 = gridColumns[1];\n        final GridColumn<String> gc4 = gridColumns[3];\n\n        for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n            gridData.setCellValue(0,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(0, \" + columnIndex + \")\"));\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false},\n                          new boolean[]{false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(0, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(0, 2)\"), build(false,\n                                                                                            1,\n                                                                                            \"(0, 3)\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(0,\n                            1);\n        gridData.selectCell(0,\n                            2);\n        assertEquals(3,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  2)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   3)));\n\n        gridData.moveColumnTo(1,\n                              gc4);\n\n        gridData.deleteColumn(gc2);\n\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertFalse(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                   2)));\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n    }\n\n    @Test\n    public void testUnmergedMoveRowUpWithSelections() {\n        constructGridData(false, 2, 3);\n        final GridRow row1 = gridRows[1];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[ ], 0[ ]\n        // row1 = b[X], 1[X]\n        // row2 = a[ ], 2[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n\n        gridData.selectCell(1,\n                            0);\n        gridData.selectCell(1,\n                            1);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n\n        //Move row\n        gridData.moveRowTo(0,\n                           row1);\n\n        // row0 = b[X], 1[X]\n        // row1 = a[ ], 0[ ]\n        // row2 = a[ ], 2[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testUnmergedMoveRowDownWithSelections() {\n        constructGridData(false, 2, 3);\n        final GridRow row0 = gridRows[0];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 0 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b[X], 0[X]\n        // row1 = a[ ], 1[ ]\n        // row2 = a[ ], 2[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(0,\n                            1);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n\n        //Move row\n        gridData.moveRowTo(1,\n                           row0);\n\n        // row0 = a[ ], 1[ ]\n        // row1 = b[X], 0[X]\n        // row2 = a[ ], 2[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testMergedMoveRowUpWithSelections1() {\n        constructGridData(2, 5);\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[ ], 0[X]\n        // row1 = a[ ], 1[ ]\n        // row2 = a[ ], 2[ ]\n        // row3 = a[ ], 3[ ]\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            1);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(3,\n                           row4);\n\n        // row0 = a[ ], 0[X]\n        // row1 = a[ ], 1[ ]\n        // row2 = a[ ], 2[ ]\n        // row3 = b[X], 4[ ]\n        // row4 = a[ ], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowUpWithSelections2() {\n        constructGridData(2, 5);\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(3,\n                           row4);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = b[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowUpWithSelections3() {\n        constructGridData(2, 5);\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? \"a\" : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = a[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(3,\n                           row4);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowUpWithSelections4() {\n        constructGridData(2, 5);\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? \"a\" : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = a[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(2,\n                           row3);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowDownWithSelections1() {\n        constructGridData(2, 5);\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[ ], 0[X]\n        // row1 = a[ ], 1[ ]\n        // row2 = a[ ], 2[ ]\n        // row3 = a[ ], 3[ ]\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            1);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(4,\n                           row3);\n\n        // row0 = a[ ], 0[X]\n        // row1 = a[ ], 1[ ]\n        // row2 = a[ ], 2[ ]\n        // row3 = b[X], 4[ ]\n        // row4 = a[ ], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(2,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowDownWithSelections2() {\n        constructGridData(2, 5);\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(4,\n                           row3);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = b[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowDownWithSelections3() {\n        constructGridData(2, 5);\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? \"a\" : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = a[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(4,\n                           row3);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testMergedMoveRowDownWithSelections4() {\n        constructGridData(2, 5);\n        final GridRow row0 = gridRows[0];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? \"a\" : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 3[ ]\n        // row4 = a[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowTo(1,\n                           row0);\n\n        // row0 = a[X], 0[ ]\n        // row1 = a[X], 1[ ]\n        // row2 = a[X], 2[ ]\n        // row3 = a[X], 4[ ]\n        // row4 = a[X], 3[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  5,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testGroupedMoveRowUpWithSelections1() {\n        constructGridData(2, 5);\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[ ], 0[X] } Collapse (Lead)\n        // row1 = a[ ], 1[X] } Collapse (Child)\n        // row2 = a[ ], 2[X] } Collapse (Child)\n        // row3 = a[ ], 3[X] } Collapse (Child)\n        // row4 = b[X], 4[ ]\n\n        //Collapse cell\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        gridData.selectCell(0,\n                            1);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(row4);\n                            }});\n\n        // row0 = b[X], 4[ ]\n        // row1 = a[ ], 0[X] } Collapse (Lead)\n        // row2 = a[ ], 1[X] } Collapse (Child)\n        // row3 = a[ ], 2[X] } Collapse (Child)\n        // row4 = a[ ], 3[X] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, true, true},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testGroupedMoveRowUpWithSelections2() {\n        constructGridData(2, 5);\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ] } Collapse (Lead)\n        // row1 = a[X], 1[ ] } Collapse (Child)\n        // row2 = a[X], 2[ ] } Collapse (Child)\n        // row3 = a[X], 3[ ] } Collapse (Child)\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(0,\n                              0);\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(row4);\n                            }});\n\n        // row0 = b[X], 4[ ]\n        // row1 = a[X], 0[ ] } Collapse (Lead)\n        // row2 = a[X], 1[ ] } Collapse (Child)\n        // row3 = a[X], 2[ ] } Collapse (Child)\n        // row4 = a[X], 3[ ] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, true, true},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testGroupedMoveRowUpWithSelections3() {\n        constructGridData(2, 5);\n        final GridRow row1 = gridRows[1];\n        final GridRow row2 = gridRows[2];\n        final GridRow row3 = gridRows[3];\n        final GridRow row4 = gridRows[4];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 0 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b[X], 0[ ]\n        // row1 = a[X], 1[ ] } Collapse (Lead)\n        // row2 = a[X], 2[ ] } Collapse (Child)\n        // row3 = a[X], 3[ ] } Collapse (Child)\n        // row4 = a[X], 4[ ] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(1,\n                              0);\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(1,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(row1);\n                                add(row2);\n                                add(row3);\n                                add(row4);\n                            }});\n\n        // row0 = a[X], 1[ ] } Collapse (Lead)\n        // row1 = a[X], 2[ ] } Collapse (Child)\n        // row2 = a[X], 3[ ] } Collapse (Child)\n        // row3 = a[X], 4[ ] } Collapse (Child)\n        // row4 = b[X], 0[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testGroupedMoveRowDownWithSelections1() {\n        constructGridData(2, 5);\n        final GridRow row0 = gridRows[0];\n        final GridRow row1 = gridRows[1];\n        final GridRow row2 = gridRows[2];\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[ ], 0[X] } Collapse (Lead)\n        // row1 = a[ ], 1[X] } Collapse (Child)\n        // row2 = a[ ], 2[X] } Collapse (Child)\n        // row3 = a[ ], 3[X] } Collapse (Child)\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(0,\n                              0);\n\n        gridData.selectCell(0,\n                            1);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move rows\n        gridData.moveRowsTo(4,\n                            new ArrayList<GridRow>() {{\n                                add(row0);\n                                add(row1);\n                                add(row2);\n                                add(row3);\n                            }});\n\n        // row0 = b[X], 4[ ]\n        // row1 = a[ ], 0[X] } Collapse (Lead)\n        // row2 = a[ ], 1[X] } Collapse (Child)\n        // row3 = a[ ], 2[X] } Collapse (Child)\n        // row4 = a[ ], 3[X] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, true, true},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testGroupedMoveRowDownWithSelections2() {\n        constructGridData(2, 5);\n        final GridRow row0 = gridRows[0];\n        final GridRow row1 = gridRows[1];\n        final GridRow row2 = gridRows[2];\n        final GridRow row3 = gridRows[3];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a[X], 0[ ] } Collapse (Lead)\n        // row1 = a[X], 1[ ] } Collapse (Child)\n        // row2 = a[X], 2[ ] } Collapse (Child)\n        // row3 = a[X], 3[ ] } Collapse (Child)\n        // row4 = b[X], 4[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(0,\n                              0);\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(4,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move rows\n        gridData.moveRowsTo(4,\n                            new ArrayList<GridRow>() {{\n                                add(row0);\n                                add(row1);\n                                add(row2);\n                                add(row3);\n                            }});\n\n        // row0 = b[X], 4[ ]\n        // row1 = a[X], 0[ ] } Collapse (Lead)\n        // row2 = a[X], 1[ ] } Collapse (Child)\n        // row3 = a[X], 2[ ] } Collapse (Child)\n        // row4 = a[X], 3[ ] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, true, true},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testGroupedMoveRowDownWithSelections3() {\n        constructGridData(2, 5);\n        final GridRow row0 = gridRows[0];\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 0 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b[X], 0[ ]\n        // row1 = a[X], 1[ ] } Collapse (Lead)\n        // row2 = a[X], 2[ ] } Collapse (Child)\n        // row3 = a[X], 3[ ] } Collapse (Child)\n        // row4 = a[X], 4[ ] } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(1,\n                              0);\n\n        gridData.selectCell(0,\n                            0);\n        gridData.selectCell(1,\n                            0);\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n\n        //Move rows\n        gridData.moveRowsTo(4,\n                            new ArrayList<GridRow>() {{\n                                add(row0);\n                            }});\n\n        // row0 = a[X], 1[ ] } Collapse (Lead)\n        // row1 = a[X], 2[ ] } Collapse (Child)\n        // row2 = a[X], 3[ ] } Collapse (Child)\n        // row3 = a[X], 4[ ] } Collapse (Child)\n        // row4 = b[X], 0[ ]\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")}\n                          });\n\n        assertEquals(5,\n                     gridData.getSelectedCells().size());\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(3,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(4,\n                                                                                  0)));\n    }\n\n    @Test\n    public void testSelectCellSelectedRangeChangeTopLeft() {\n        constructGridData(3, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 2)\")}\n                          });\n\n        gridData.selectCell(1,\n                            1);\n\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n\n        gridData.selectCells(0,\n                             0,\n                             2,\n                             2);\n\n        assertEquals(4,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testSelectCellSelectedRangeChangeTopRight() {\n        constructGridData(3, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 2)\")}\n                          });\n\n        gridData.selectCell(1,\n                            1);\n\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n\n        gridData.selectCells(0,\n                             1,\n                             2,\n                             2);\n\n        assertEquals(4,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                                  2)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  2)));\n    }\n\n    @Test\n    public void testSelectCellSelectedRangeChangeBottomLeft() {\n        constructGridData(3, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 2)\")}\n                          });\n\n        gridData.selectCell(1,\n                            1);\n\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n\n        gridData.selectCells(1,\n                             0,\n                             2,\n                             2);\n\n        assertEquals(4,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  0)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n    }\n\n    @Test\n    public void testSelectCellSelectedRangeChangeBottomRight() {\n        constructGridData(3, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 2)\")}\n                          });\n\n        gridData.selectCell(1,\n                            1);\n\n        assertEquals(1,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n\n        gridData.selectCells(1,\n                             1,\n                             2,\n                             2);\n\n        assertEquals(4,\n                     gridData.getSelectedCells().size());\n        assertEquals(gridData.getSelectedCellsOrigin(),\n                     new GridData.SelectedCell(1,\n                                               1));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                                  2)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  1)));\n        assertTrue(gridData.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                                  2)));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridCellSelectionsTransformationTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.DefaultSelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.FloatingSelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.SelectedRange;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class GridCellSelectionsTransformationTest extends BaseGridTest {\n\n    @Test\n    public void testTransformationVerticalRightExtent() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer = new DefaultSelectionsTransformer(data,\n                                                                                   data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // - - x\n        // x x x\n        // - - x\n        data.selectCell(1,\n                        0);\n        data.selectCell(1,\n                        1);\n        data.selectCell(1,\n                        2);\n        data.selectCell(0,\n                        2);\n        data.selectCell(2,\n                        2);\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<SelectedRange> selectedRanges2 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(2,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationPlusSign() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer = new DefaultSelectionsTransformer(data,\n                                                                                   data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // - x -\n        // x x x\n        // - x -\n        data.selectCell(1,\n                        0);\n        data.selectCell(1,\n                        1);\n        data.selectCell(1,\n                        2);\n        data.selectCell(0,\n                        1);\n        data.selectCell(2,\n                        1);\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<SelectedRange> selectedRanges2 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(3,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationColumnSubsetVerticalRightExtent() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer1 = new DefaultSelectionsTransformer(data,\n                                                                                    data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer1.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // - - x\n        // x x x\n        // - - x\n        data.selectCell(1,\n                        0);\n        data.selectCell(1,\n                        1);\n        data.selectCell(1,\n                        2);\n        data.selectCell(0,\n                        2);\n        data.selectCell(2,\n                        2);\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<GridColumn<?>> columns = new ArrayList<GridColumn<?>>() {{\n            add(gc1);\n            add(gc2);\n        }};\n        final SelectionsTransformer transformer2 = new FloatingSelectionsTransformer(data,\n                                                                                     columns);\n        final List<SelectedRange> selectedRanges2 = transformer2.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(1,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationColumnSubsetPlusSign() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer1 = new DefaultSelectionsTransformer(data,\n                                                                                    data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer1.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // - x -\n        // x x x\n        // - x -\n        data.selectCell(1,\n                        0);\n        data.selectCell(1,\n                        1);\n        data.selectCell(1,\n                        2);\n        data.selectCell(0,\n                        1);\n        data.selectCell(2,\n                        1);\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<GridColumn<?>> columns = new ArrayList<GridColumn<?>>() {{\n            add(gc1);\n            add(gc3);\n        }};\n        final SelectionsTransformer transformer2 = new FloatingSelectionsTransformer(data,\n                                                                                     columns);\n        final List<SelectedRange> selectedRanges2 = transformer2.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(1,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationSplitRows() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer = new DefaultSelectionsTransformer(data,\n                                                                                   data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // x x x\n        // - - -\n        // x x x\n        data.selectCell(0,\n                        0);\n        data.selectCell(0,\n                        1);\n        data.selectCell(0,\n                        2);\n        data.selectCell(2,\n                        0);\n        data.selectCell(2,\n                        1);\n        data.selectCell(2,\n                        2);\n\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              2)));\n        assertEquals(6,\n                     data.getSelectedCells().size());\n\n        final List<SelectedRange> selectedRanges2 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(2,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationNeighbours() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer = new DefaultSelectionsTransformer(data,\n                                                                                   data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // x - x\n        // x - x\n        // - x -\n        data.selectCell(0,\n                        0);\n        data.selectCell(0,\n                        2);\n        data.selectCell(1,\n                        0);\n        data.selectCell(1,\n                        2);\n        data.selectCell(2,\n                        1);\n\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<SelectedRange> selectedRanges2 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(3,\n                     selectedRanges2.size());\n    }\n\n    @Test\n    public void testTransformationDiagonalCross() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               2)));\n        assertEquals(0,\n                     data.getSelectedCells().size());\n\n        final SelectionsTransformer transformer = new DefaultSelectionsTransformer(data,\n                                                                                   data.getColumns());\n        final List<SelectedRange> selectedRanges1 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(0,\n                     selectedRanges1.size());\n\n        // x - x\n        // - x -\n        // x - x\n        data.selectCell(0,\n                        0);\n        data.selectCell(0,\n                        2);\n        data.selectCell(1,\n                        1);\n        data.selectCell(2,\n                        0);\n        data.selectCell(2,\n                        2);\n\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(0,\n                                                                              2)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               0)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                              1)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(1,\n                                                                               2)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              0)));\n        assertFalse(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                               1)));\n        assertTrue(data.getSelectedCells().contains(new GridData.SelectedCell(2,\n                                                                              2)));\n        assertEquals(5,\n                     data.getSelectedCells().size());\n\n        final List<SelectedRange> selectedRanges2 = transformer.transformToSelectedRanges(data.getSelectedCells());\n        assertEquals(5,\n                     selectedRanges2.size());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridColumnIndexingTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class GridColumnIndexingTest extends BaseGridTest {\n\n    @Test\n    public void testAddInitialColumns() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(2,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(columns.get(0),\n                     gc1);\n        assertEquals(columns.get(1),\n                     gc2);\n    }\n\n    @Test\n    public void testAddColumn() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.insertColumn(1,\n                          gc3);\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(3,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(columns.get(0),\n                     gc1);\n        assertEquals(columns.get(1),\n                     gc3);\n        assertEquals(columns.get(2),\n                     gc2);\n    }\n\n    @Test\n    public void testRemoveColumn() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n\n        grid.deleteColumn(gc2);\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(2,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc3.getIndex());\n        assertEquals(columns.get(0),\n                     gc1);\n        assertEquals(columns.get(1),\n                     gc3);\n    }\n\n    @Test\n    public void testMoveColumnToLeft() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnTo(1,\n                          gc4);\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc1);\n        assertEquals(columns.get(1),\n                     gc4);\n        assertEquals(columns.get(2),\n                     gc2);\n        assertEquals(columns.get(3),\n                     gc3);\n    }\n\n    @Test\n    public void testMoveColumnsToLeft_RightMostTwoColumns() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnsTo(1,\n                           new ArrayList<GridColumn<?>>() {{\n                               add(gc3);\n                               add(gc4);\n                           }});\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc1);\n        assertEquals(columns.get(1),\n                     gc3);\n        assertEquals(columns.get(2),\n                     gc4);\n        assertEquals(columns.get(3),\n                     gc2);\n    }\n\n    @Test\n    public void testMoveColumnsToLeft_MiddleTwoColumns() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnsTo(0,\n                           new ArrayList<GridColumn<?>>() {{\n                               add(gc2);\n                               add(gc3);\n                           }});\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc2);\n        assertEquals(columns.get(1),\n                     gc3);\n        assertEquals(columns.get(2),\n                     gc1);\n        assertEquals(columns.get(3),\n                     gc4);\n    }\n\n    @Test\n    public void testMoveColumnToRight_LeftMostColumn() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnTo(3,\n                          gc1);\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc2);\n        assertEquals(columns.get(1),\n                     gc3);\n        assertEquals(columns.get(2),\n                     gc4);\n        assertEquals(columns.get(3),\n                     gc1);\n    }\n\n    @Test\n    public void testMoveColumnsToRight_LeftMostTwoColumns() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnsTo(2,\n                           new ArrayList<GridColumn<?>>() {{\n                               add(gc1);\n                               add(gc2);\n                           }});\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc3);\n        assertEquals(columns.get(1),\n                     gc1);\n        assertEquals(columns.get(2),\n                     gc2);\n        assertEquals(columns.get(3),\n                     gc4);\n    }\n\n    @Test\n    public void testMoveColumnsToRight_LeftMostTwoColumns_ToRightExtent() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n\n        grid.moveColumnsTo(3,\n                           new ArrayList<GridColumn<?>>() {{\n                               add(gc1);\n                               add(gc2);\n                           }});\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(4,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(columns.get(0),\n                     gc3);\n        assertEquals(columns.get(1),\n                     gc4);\n        assertEquals(columns.get(2),\n                     gc1);\n        assertEquals(columns.get(3),\n                     gc2);\n    }\n\n    @Test\n    public void testMoveColumnsToRight_LeftMostTwoColumns_MidBlock() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        final GridColumn<String> gc5 = new MockMergableGridColumn<String>(\"col5\",\n                                                                          100);\n        final GridColumn<String> gc6 = new MockMergableGridColumn<String>(\"col6\",\n                                                                          100);\n        final GridColumn<String> gc7 = new MockMergableGridColumn<String>(\"col7\",\n                                                                          100);\n        final GridColumn<String> gc8 = new MockMergableGridColumn<String>(\"col8\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n        grid.appendColumn(gc4);\n        grid.appendColumn(gc5);\n        grid.appendColumn(gc6);\n        grid.appendColumn(gc7);\n        grid.appendColumn(gc8);\n\n        grid.moveColumnsTo(5,\n                           new ArrayList<GridColumn<?>>() {{\n                               add(gc1);\n                               add(gc2);\n                           }});\n\n        final List<GridColumn<?>> columns = grid.getColumns();\n\n        assertEquals(8,\n                     columns.size());\n        assertEquals(0,\n                     gc1.getIndex());\n        assertEquals(1,\n                     gc2.getIndex());\n        assertEquals(2,\n                     gc3.getIndex());\n        assertEquals(3,\n                     gc4.getIndex());\n        assertEquals(4,\n                     gc5.getIndex());\n        assertEquals(5,\n                     gc6.getIndex());\n        assertEquals(6,\n                     gc7.getIndex());\n        assertEquals(7,\n                     gc8.getIndex());\n        assertEquals(columns.get(0),\n                     gc3);\n        assertEquals(columns.get(1),\n                     gc4);\n        assertEquals(columns.get(2),\n                     gc5);\n        assertEquals(columns.get(3),\n                     gc6);\n        assertEquals(columns.get(4),\n                     gc1);\n        assertEquals(columns.get(5),\n                     gc2);\n        assertEquals(columns.get(6),\n                     gc7);\n        assertEquals(columns.get(7),\n                     gc8);\n    }\n\n    @Test\n    public void testRemoveRow() {\n        final GridData grid = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        grid.appendColumn(gc1);\n        grid.appendColumn(gc2);\n        grid.appendColumn(gc3);\n\n        final GridRow gr1 = new BaseGridRow();\n        final GridRow gr2 = new BaseGridRow();\n        final GridRow gr3 = new BaseGridRow();\n\n        grid.appendRow(gr1);\n        grid.appendRow(gr2);\n        grid.appendRow(gr3);\n\n        grid.deleteRow(1);\n\n        assertEquals(2,\n                     grid.getRowCount());\n        assertEquals(gr1,\n                     grid.getRow(0));\n        assertEquals(gr3,\n                     grid.getRow(1));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridColumnsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest.Expected.build;\n\npublic class GridColumnsTest extends BaseGridTest {\n\n    @Test\n    public void testAppendColumn() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")}\n                          });\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc3);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           null)},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           null)}\n                          });\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n    }\n\n    @Test\n    public void testInsertColumn() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")}\n                          });\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.insertColumn(1,\n                          gc3);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 1)\")}\n                          });\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n    }\n\n    @Test\n    public void testDeleteColumn() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        data.deleteColumn(gc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(2, 1)\")}\n                          });\n\n        assertEquals(2,\n                     data.getRow(0).getCells().size());\n        assertEquals(2,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n    }\n\n    @Test\n    public void testDeleteColumnThenInsertColumn() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        data.deleteColumn(gc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(2, 1)\")}\n                          });\n\n        assertEquals(2,\n                     data.getRow(0).getCells().size());\n        assertEquals(2,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n\n        final GridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                          100);\n        data.insertColumn(1,\n                          gc4);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(2, 1)\")}\n                          });\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n    }\n\n    @Test\n    public void testInsertx2ColumnThenDeletex2Column() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        //Validate initial setup\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        //Insert column#1 and validate\n        final GridColumn<String> tgc1 = new MockMergableGridColumn<String>(\"col4\",\n                                                                           100);\n        data.insertColumn(1,\n                          tgc1);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 0)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 1)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(3).getIndex());\n\n        //Insert column#2 and check validate\n        final GridColumn<String> tgc2 = new MockMergableGridColumn<String>(\"col5\",\n                                                                           100);\n        data.insertColumn(1,\n                          tgc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       null), build(false,\n                                                                                    1,\n                                                                                    \"(1, 0)\"), build(false,\n                                                                                                     1,\n                                                                                                     \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       null), build(false,\n                                                                                    1,\n                                                                                    \"(1, 1)\"), build(false,\n                                                                                                     1,\n                                                                                                     \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(4,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(3).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(4).getIndex());\n\n        //Delete column#1 and validate\n        data.deleteColumn(tgc1);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 0)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 1)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(3).getIndex());\n\n        //Delete column#2 and validate\n        data.deleteColumn(tgc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n    }\n\n    @Test\n    public void testInsertx2ColumnThenDeletex2ColumnReverseOrder() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        //Validate initial setup\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        //Insert column#1 and validate\n        final GridColumn<String> tgc1 = new MockMergableGridColumn<String>(\"col4\",\n                                                                           100);\n        data.insertColumn(1,\n                          tgc1);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 0)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 1)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(3).getIndex());\n\n        //Insert column#2 and check validate\n        final GridColumn<String> tgc2 = new MockMergableGridColumn<String>(\"col5\",\n                                                                           100);\n        data.insertColumn(1,\n                          tgc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       null), build(false,\n                                                                                    1,\n                                                                                    \"(1, 0)\"), build(false,\n                                                                                                     1,\n                                                                                                     \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       null), build(false,\n                                                                                    1,\n                                                                                    \"(1, 1)\"), build(false,\n                                                                                                     1,\n                                                                                                     \"(2, 1)\")}\n                          });\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(4,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(3).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(4).getIndex());\n\n        //Delete column#2 and validate\n        data.deleteColumn(tgc2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 0)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(1, 1)\"), build(false,\n                                                                                        1,\n                                                                                        \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(3,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(3).getIndex());\n\n        //Delete column#1 and validate\n        data.deleteColumn(tgc1);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n    }\n\n    @Test\n    public void testMoveColumnThenDelete() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        //Validate initial setup\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        //Move column and validate\n        data.moveColumnTo(0,\n                          gc3);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(2, 0)\"), build(false,\n                                                          1,\n                                                          \"(0, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(2, 1)\"), build(false,\n                                                          1,\n                                                          \"(0, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(1, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(2,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(0,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(2).getIndex());\n\n        //Delete column and validate\n        data.deleteColumn(gc1);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(2, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(2, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")}\n                          });\n\n        assertEquals(2,\n                     data.getRow(0).getCells().size());\n        assertEquals(2,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(1,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(0,\n                     data.getColumns().get(1).getIndex());\n    }\n\n    @Test\n    public void testUpdateColumn() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        final GridColumn<String> gc3 = new MockMergableGridColumn<String>(\"col3\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n        data.appendColumn(gc3);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 1)\")}\n                          });\n\n        assertEquals(3,\n                     data.getRow(0).getCells().size());\n        assertEquals(3,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        final MockMergableGridColumn<String> gc4 = new MockMergableGridColumn<String>(\"col4\",\n                                                                                      100);\n        data.updateColumn(1,\n                          gc4);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(2, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          null), build(false,\n                                                                       1,\n                                                                       \"(2, 1)\")}\n                          });\n\n        assertEquals(2,\n                     data.getRow(0).getCells().size());\n        assertEquals(2,\n                     data.getRow(1).getCells().size());\n\n        assertEquals(0,\n                     data.getColumns().get(0).getIndex());\n        assertEquals(1,\n                     data.getColumns().get(1).getIndex());\n        assertEquals(2,\n                     data.getColumns().get(2).getIndex());\n\n        assertEquals(gc1,\n                     data.getColumns().get(0));\n        assertEquals(gc4,\n                     data.getColumns().get(1));\n        assertEquals(gc3,\n                     data.getColumns().get(2));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridGroupingTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.ArrayList;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest.Expected.build;\n\npublic class GridGroupingTest extends BaseGridTest {\n\n    @Test\n    public void testInitialSetup() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            final GridRow row = gridData.getRow(rowIndex);\n            assertFalse(row.isMerged());\n            assertFalse(row.isCollapsed());\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final GridCell<?> cell = gridData.getCell(rowIndex,\n                                                          columnIndex);\n                assertFalse(cell.isMerged());\n            }\n        }\n\n        assertEquals(3,\n                     gridData.getRowCount());\n    }\n\n    @Test\n    public void testGroup() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Group cells\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        //Ungroup cells\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupNotCombineWhenCellsValuesUpdatedAbove() {\n        //Tests that cells with the same value do not combine into existing collapsed blocks\n        //Test #1 - Update cells above the existing collapsed block\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0) (1,0) ]\n        // [ (0,1) (1,1) ]\n        // [ (0,2) (1,2) ]\n        // [ (0,2) (1,3) ]\n        // [ (0,4) (1,4) ]\n\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        //Group cells\n        gridData.collapseCell(2,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, false},\n                          new boolean[]{false, false, false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Set cell above existing block (should not affect existing block)\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, false},\n                          new boolean[]{false, false, false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Set cell above existing block (should create a new block)\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Ungroup cell (should result in a single block spanning 4 rows)\n        gridData.expandCell(2,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         4,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupNotCombineWhenCellsValuesUpdatedBelow() {\n        //Tests that cells with the same value do not combine into existing collapsed blocks\n        //Test #2 - Update cells below the existing collapsed block\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0) (1,0) ]\n        // [ (0,1) (1,1) ]\n        // [ (0,1) (1,2) ]\n        // [ (0,3) (1,3) ]\n        // [ (0,4) (1,4) ]\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        //Group cells\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, false, false},\n                          new boolean[]{false, false, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Set cell below existing block (should not affect existing block)\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, false, false},\n                          new boolean[]{false, false, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Set cell below existing block (should create a new block)\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         2,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Ungroup cell (should result in a single block spanning 4 rows)\n        gridData.expandCell(1,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         4,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseBlockWithinParent() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1  (1,0) ]\n        // [   g1    g2  ]      [   g1  (1,0) ]\n        // [   g1    g2  ] ---> [   g1    g2  ] ---> [   g1  (1,0) ]\n        // [   g1    g2  ]      [   g1  (1,4) ]\n        // [   g1  (1,4) ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g2\n        gridData.collapseCell(1,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, true, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         5,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Group g1\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         5,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, true, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         5,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseRightColumn_SingleCellOverlap_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0)   g2  ]\n        // [ (0,1)   g2  ]      [ (0,0)   g2  ]      [ (0,0)   g2  ]      [ (0,0)   g2  ]\n        // [   g1    g2  ] ---> [   g1  (1,3) ] ---> [   g1  (1,3) ] ---> [   g1  (1,3) ]\n        // [   g1  (1,3) ]      [   g1  (1,4) ]                           [   g1  (1,4) ]\n        // [   g1  (1,4) ]\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g2 - should split g1\n        gridData.collapseCell(0,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          3,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Group g1\n        gridData.collapseCell(3,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          3,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(3,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          3,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_SingleCellOverlap_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1  (1,0) ]\n        // [   g1  (1,1) ]      [   g1  (1,0) ]                           [   g1  (1,0) ]\n        // [   g1    g2  ] ---> [ (0,3)   g2  ] ---> [ (0,3)   g2  ] ---> [ (0,3)   g2  ]\n        // [ (0,3)   g2  ]      [ (0,4)   g2  ]                           [ (0,4)   g2  ]\n        // [ (0,4)   g2  ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - should split g2\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Group g2\n        gridData.collapseCell(3,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g2\n        gridData.expandCell(3,\n                            1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_ChildBlockCoversTableExtents() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [  g1    g2 ]\n        // [  g1    g2 ]\n        // [ (0,2)  g2 ]\n        // [ (0,3)  g2 ]\n        // [ (0,4)  g2 ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_SingleCellOverlapMidTable_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0)  (1,0) ]\n        // [  g1    (1,1) ]\n        // [  g1      g2  ]\n        // [ (0,3)    g2  ]\n        // [ (0,4)    g2  ]\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - should split g2\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(1,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_SubExtentOverlap_NoSplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0)  (1,0) ]\n        // [  g1      g2  ]\n        // [  g1      g2  ]\n        // [ (0,3)    g2  ]\n        // [ (0,4)    g2  ]\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - doesn't need to split g2 since it spans all of g1\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(true,\n                                                      4,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(1,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(true,\n                                                      4,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_MultipleCellOverlap_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1   (1,0) ]\n        // [   g1     g2  ]      [   g1  (1,0) ]\n        // [   g1     g2  ] ---> [ (0,3)   g2  ]\n        // [ (0,3)    g2  ]      [ (0,4)   g2  ]\n        // [ (0,4)    g2  ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - should split g2\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      2,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      4,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseWholeTable() {\n        constructGridData(2, 5);\n\n        // [   g1    g2  ]\n        // [   g1    g2  ]\n        // [   g1    g2  ] ---> [   g1    g2  ]\n        // [   g1    g2  ]\n        // [   g1    g2  ]\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"g1\"));\n            gridData.setCellValue(rowIndex,\n                                  1,\n                                  new BaseGridCellValue<String>(\"g2\"));\n        }\n\n        //Group g1\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         5,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         5,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseWholeTableExceptLastRow() {\n        constructGridData(2, 5);\n\n        // [   g1    g2  ]\n        // [   g1    g2  ]\n        // [   g1    g2  ] ---> [   g1    g2  ]\n        // [   g1    g2  ]      [ (0,4) (1,4) ]\n        // [ (0,4) (1,4) ]\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount() - 1; rowIndex++) {\n            gridData.setCellValue(rowIndex,\n                                  0,\n                                  new BaseGridCellValue<String>(\"g1\"));\n            gridData.setCellValue(rowIndex,\n                                  1,\n                                  new BaseGridCellValue<String>(\"g2\"));\n        }\n\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 4)\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"(1, 4)\"));\n\n        //Group g1\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, true, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         4,\n                                         \"g1\"), build(true,\n                                                      4,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n\n        //Ungroup g1\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         4,\n                                         \"g1\"), build(true,\n                                                      4,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_SingleCellOverlapBottom_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1  (1,0) ]\n        // [   g1  (1,1) ]      [   g1  (1,0) ]      [   g1  (1,0) ]      [   g1  (1,0) ]      [   g1  (1,0) ]\n        // [   g1    g2  ] ---> [ (0,3)   g2  ] ---> [ (0,3)   g2  ] ---> [   g1  (1,1) ] ---> [ (0,3)   g2  ]\n        // [ (0,3)   g2  ]      [ (0,4)   g2  ]                           [   g1    g2  ]\n        // [ (0,4)   g2  ]                                                [ (0,3)   g2  ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - should split g2\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Group g2\n        gridData.collapseCell(3,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1 - should not recombine g2 as it has been split and collapsed\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Group g1 - check re-applying collapse preserves indexing\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1 - check re-applying collapse preserves indexing\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 1)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseRightColumn_ChildSubExtent() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1    g2  ]                           [   g1    g2  ]\n        // [   g1    g2  ]                           [   g1    g2  ]\n        // [   g1    g2  ] ---> [   g1    g2  ] ---> [   g1    g2  ]\n        // [ (0,3)   g2  ]                           [ (0,3)   g2  ]\n        // [ (0,4)   g2  ]                           [ (0,4)   g2  ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g2\n        gridData.collapseCell(0,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g1 - should result in g2 being split and collapsed\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g2 - should restore to original configuration\n        gridData.expandCell(3,\n                            1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_MultipleCellOverlapTableExtent_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [   g1    g2  ]                           [   g1    g2  ]\n        // [   g1    g2  ]      [   g1    g2  ]      [   g1    g2  ]\n        // [   g1    g2  ] ---> [ (0,3)   g2  ] ---> [   g1    g2  ]\n        // [ (0,3)   g2  ]      [ (0,4)   g2  ]      [ (0,3)   g2  ]\n        // [ (0,4)   g2  ]                           [ (0,4)   g2  ]\n\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Ungroup g2\n        gridData.expandCell(0,\n                            1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n\n        //Group g2\n        gridData.collapseCell(0,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      5,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_SingleCellOverlapTop_SplitBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0)   g2  ]\n        // [ (0,1)   g2  ]      [ (0,0)   g2  ]\n        // [   g1    g2  ] ---> [ (0,1)   g2  ] ---> [ (0,0)   g2  ]\n        // [   g1  (1,3) ]      [   g1    g2  ]      [   g1    g2  ]\n        // [   g1  (1,4) ]\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        //Group g1 - should split g2\n        gridData.collapseCell(2,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Group g2\n        gridData.collapseCell(0,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, false, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Ungroup g1 - g2 should remain split\n        gridData.expandCell(2,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n\n        //Ungroup g2 - g2 should not be split\n        gridData.expandCell(0,\n                            1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          3,\n                                                          \"g2\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(true,\n                                                          0,\n                                                          \"g2\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseRightColumn_SingleCellOverlapBottom_NestedSplitBlocks() {\n        constructGridData(3, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0) (1,0)   g3  ]\n        // [ (0,1) (1,1)   g3  ]      [ (0,0) (1,0)   g3  ]\n        // [   g1    g2    g3  ] ---> [   g1    g2  (2,3) ] ---> [ (0,0) (1,0)   g3  ]\n        // [   g1    g2  (2,3) ]      [ (0,4)   g2  (2,4) ]      [   g1    g2  (2,3) ]\n        // [ (0,4)   g2  (2,4) ]\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        gridData.setCellValue(0,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(1,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(2,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n\n        //Check initial setup\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           3,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(true,\n                                                      3,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 4)\")}\n                          });\n\n        //Group g3 - should split g1 and g2\n        gridData.collapseCell(0,\n                              2);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           3,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      2,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 4)\")}\n                          });\n\n        //Group g2\n        gridData.collapseCell(3,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           3,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      2,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_StaggeredSingleCellOverlapTop_NestedSplitBlocks() {\n        constructGridData(3, 7);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0) (1,0)   g3  ]\n        // [ (0,1) (1,1)   g3  ]      [ (0,0) (1,0)   g3  ]      [ (0,0) (1,0)   g3  ]\n        // [ (0,2)   g2    g3) ]      [ (0,1) (1,1)   g3  ]      [ (0,1) (1,1)   g3  ]      [ (0,0) (1,0)   g3  ]\n        // [ (0,3)   g2  (2,3) ] ---> [ (0,2)   g2    g3  ] ---> [ (0,2)   g2    g3  ] ---> [   g1    g2  (2,4) ]\n        // [   g1    g2  (2,4) ]      [ (0,3)   g2  (2,3) ]      [   g1    g2  (2,4) ]\n        // [   g1  (1,5) (2,5) ]      [   g1    g2  (2,4) ]\n        // [   g1  (1,6) (2,6) ]\n\n        gridData.setCellValue(4,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(5,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(6,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(2,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(3,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(4,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        gridData.setCellValue(0,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(1,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(2,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n\n        //Check initial setup\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           3,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          3,\n                                                          \"g2\"), build(true,\n                                                                       0,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 4)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 5)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 5)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 6)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 6)\")}\n                          });\n\n        //Group g1 - should split g2\n        gridData.collapseCell(4,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           3,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       0,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 4)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 5)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 5)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 6)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 6)\")}\n                          });\n\n        //Group g2 - should split g1\n        gridData.collapseCell(2,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true, true},\n                          new boolean[]{false, false, false, true, false, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           2,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 4)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 5)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 5)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 6)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 6)\")}\n                          });\n\n        //Group g3\n        gridData.collapseCell(0,\n                              2);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true, true},\n                          new boolean[]{false, true, false, true, false, true, true},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\"), build(true,\n                                                                           2,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 1)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\"), build(true,\n                                                                           0,\n                                                                           \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 3)\"), build(true,\n                                                          0,\n                                                          \"g2\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"g2\"), build(false,\n                                                                   1,\n                                                                   \"(2, 4)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 5)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 5)\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 6)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 6)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupOverlap_CollapseLeftColumn_MultipleCellOverlap_NestedSplitBlocks() {\n        constructGridData(3, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        // [ (0,0)   g2    g3  ]\n        // [   g1    g2    g3  ]      [ (0,0)   g2    g3  ]      [ (0,0)   g2    g3  ]\n        // [   g1  (1,2)   g3  ] ---> [   g1  (1,2)   g3  ] ---> [   g1  (1,3) (2,3) ]\n        // [   g1  (1,3) (2,3) ]      [   g1  (1,3) (2,3) ]      [ (0,4) (1,4) (2,4) ]\n        // [ (0,4) (1,4) (2,4) ]      [ (0,4) (1,4) (2,4) ]\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"g1\"));\n\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n        gridData.setCellValue(1,\n                              1,\n                              new BaseGridCellValue<String>(\"g2\"));\n\n        gridData.setCellValue(0,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(1,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n        gridData.setCellValue(2,\n                              2,\n                              new BaseGridCellValue<String>(\"g3\"));\n\n        //Check initial setup\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       3,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         3,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 2)\"), build(true,\n                                                                       0,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 4)\")}\n                          });\n\n        //Group g2 - should split g1 but not g3\n        gridData.collapseCell(0,\n                              1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       3,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 2)\"), build(true,\n                                                                       0,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 4)\")}\n                          });\n\n        //Group g1 - should split g3\n        gridData.collapseCell(2,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       2,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 2)\"), build(false,\n                                                                       1,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 4)\")}\n                          });\n\n        //Ungroup g1 - g3 should remain split as we don't merge into collapsed cells\n        gridData.expandCell(2,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       2,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 2)\"), build(false,\n                                                                       1,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 4)\")}\n                          });\n\n        //Group g1 (again) - there should be no change in state, other than an additional collapsed row\n        gridData.collapseCell(2,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, true, false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(0, 0)\"), build(true,\n                                                          2,\n                                                          \"g2\"), build(true,\n                                                                       2,\n                                                                       \"g3\")},\n                                  {build(false,\n                                         1,\n                                         \"g1\"), build(true,\n                                                      0,\n                                                      \"g2\"), build(true,\n                                                                   0,\n                                                                   \"g3\")},\n                                  {build(true,\n                                         2,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 2)\"), build(false,\n                                                                       1,\n                                                                       \"g3\")},\n                                  {build(true,\n                                         0,\n                                         \"g1\"), build(false,\n                                                      1,\n                                                      \"(1, 3)\"), build(false,\n                                                                       1,\n                                                                       \"(2, 3)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 4)\"), build(false,\n                                                          1,\n                                                          \"(1, 4)\"), build(false,\n                                                                           1,\n                                                                           \"(2, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupUpdateCellValue() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Group cells\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        //Update cell value\n        gridData.setCellValue(0,\n                              0,\n                              new BaseGridCellValue<String>(\"<changed>\"));\n\n        //Ungroup cells\n        gridData.expandCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"<changed>\"), build(false,\n                                                             1,\n                                                             \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"<changed>\"), build(false,\n                                                             1,\n                                                             \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n    }\n\n    @Test\n    public void testGroupMovedColumnUpdateCellValue() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Group cells\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(true,\n                                         2,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 0)\")},\n                                  {build(true,\n                                         0,\n                                         \"(0, 0)\"), build(false,\n                                                          1,\n                                                          \"(1, 1)\")},\n                                  {build(false,\n                                         1,\n                                         \"(0, 2)\"), build(false,\n                                                          1,\n                                                          \"(1, 2)\")}\n                          });\n\n        //Move column\n        gridData.moveColumnTo(1,\n                              gridColumns[0]);\n\n        //Update cell value\n        gridData.setCellValue(0,\n                              1,\n                              new BaseGridCellValue<String>(\"<changed>\"));\n\n        //Ungroup cells\n        gridData.expandCell(0,\n                            1);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new BaseGridTest.Expected[][]{\n                                  {build(false,\n                                         1,\n                                         \"(1, 0)\"), build(true,\n                                                          2,\n                                                          \"<changed>\")},\n                                  {build(false,\n                                         1,\n                                         \"(1, 1)\"), build(true,\n                                                          0,\n                                                          \"<changed>\")},\n                                  {build(false,\n                                         1,\n                                         \"(1, 2)\"), build(false,\n                                                          1,\n                                                          \"(0, 2)\")}\n                          });\n    }\n\n    @Test\n    public void testMergedDeleteCellValue() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Group cells\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, true, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Update cell value\n        gridData.deleteCell(0,\n                            0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(null), Expected.build(false,\n                                                                        1,\n                                                                        \"(1, 0)\")},\n                                  {Expected.build(null), Expected.build(false,\n                                                                        1,\n                                                                        \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testRemoveRowIndex0FromGroupedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(0);\n        assertEquals(0,\n                     rows.getMinRowIndex());\n        assertEquals(0,\n                     rows.getMaxRowIndex());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false},\n                          new boolean[]{false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testRemoveRowIndex1FromGroupedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(1);\n        assertEquals(1,\n                     rows.getMinRowIndex());\n        assertEquals(3,\n                     rows.getMaxRowIndex());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testRemoveRowIndex2FromGroupedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(2);\n        assertEquals(1,\n                     rows.getMinRowIndex());\n        assertEquals(3,\n                     rows.getMaxRowIndex());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testRemoveRowIndex3FromGroupedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(3);\n        assertEquals(1,\n                     rows.getMinRowIndex());\n        assertEquals(3,\n                     rows.getMaxRowIndex());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false},\n                          new boolean[]{false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testRemoveRowIndex4FromGroupedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n        gridData.setCellValue(3,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        // (0, 0), (1, 0)\n        // (0, 1), (1, 1)\n        // (0, 1), (1, 2)\n        // (0, 1), (1, 3)\n        // (0, 4), (1, 4)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        gridData.collapseCell(1,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, true, true, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(4);\n        assertEquals(4,\n                     rows.getMinRowIndex());\n        assertEquals(4,\n                     rows.getMaxRowIndex());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true},\n                          new boolean[]{false, false, true, true},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")}\n                          });\n    }\n\n    @Test\n    public void testRemoveOnlyRow() {\n        constructGridData(2, 1);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false},\n                          new boolean[]{false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(0);\n        assertEquals(0,\n                     rows.getMinRowIndex());\n        assertEquals(0,\n                     rows.getMaxRowIndex());\n\n        assertEquals(0,\n                     gridData.getRowCount());\n    }\n\n    @Test\n    public void testRemoveAllRows() {\n        constructGridData(2, 3);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        gridData.setCellValue(1,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n        gridData.setCellValue(2,\n                              0,\n                              new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")}\n                          });\n\n        gridData.collapseCell(0,\n                              0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, true, true},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")}\n                          });\n\n        final GridData.Range rows = gridData.deleteRow(1);\n        assertEquals(0,\n                     rows.getMinRowIndex());\n        assertEquals(2,\n                     rows.getMaxRowIndex());\n\n        assertEquals(0,\n                     gridData.getRowCount());\n    }\n\n    @Test\n    public void testGrouped_MoveUp_Rowsx3ToIndex0_Blockx3Rows() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 0 || rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, 0\n        // row1 = a, 1 } Collapse (Lead)\n        // row2 = a, 2 } Collapse (Child)\n        // row3 = a, 3 } Collapse (Child)\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(1,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[1]);\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = a, 1 } Collapse (Lead)\n        // row1 = a, 2 } Collapse (Child)\n        // row2 = a, 3 } Collapse (Child)\n        // row3 = b, 0\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, true, true, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveUp_Rowsx2ToIndex1_Blockx2Rows() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 || rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2 } Collapse (Lead)\n        // row3 = a, 3 } Collapse (Child)\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(2,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(1,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = a, 0 } Should remain unchanged\n        // row1 = a, 2 } Collapse (Lead)\n        // row2 = a, 3 } Collapse (Child)\n        // row3 = b, 1\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, true, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveUp_Rowsx2ToIndex0_Blockx2Rows() {\n        constructGridData(2, 6);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 || rowIndex == 4 ? \"a\" : \"b\") : \"c\";\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, c\n        // row1 = a, c\n        // row2 = b, c } Collapse (Lead)\n        // row3 = b, c } Collapse (Child)\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       6,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(2,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = b, c } Collapse (Lead)\n        // row1 = b, c } Collapse (Child)\n        // row2 = b, c } Should remain unchanged\n        // row3 = a, c\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true, true},\n                          new boolean[]{false, true, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(true,\n                                                                       2,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       4,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveUp_Rowsx2ToIndex0_Blockx2Rows_MakeNewSplitBlock() {\n        constructGridData(2, 6);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 || rowIndex == 4 ? \"a\" : \"b\") : (rowIndex == 0 ? \"d\" : \"c\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, d\n        // row1 = a, c\n        // row2 = b, c } Collapse (Lead)\n        // row3 = b, c } Collapse (Child)\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       5,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(2,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = b, c } Collapse (Lead)\n        // row1 = b, c } Collapse (Child)\n        // row2 = b, d } Should remain unchanged\n        // row3 = a, c\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true, true},\n                          new boolean[]{false, true, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(true,\n                                                                       2,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveUp_Rowsx2ToIndex0_Blockx2Rows_MakeNewMergedBlock() {\n        constructGridData(2, 6);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 || rowIndex == 4 ? \"a\" : \"b\") : (rowIndex == 0 || rowIndex == 3 ? \"d\" : \"c\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, d\n        // row1 = a, c\n        // row2 = b, c } Collapse (Lead)\n        // row3 = b, d } Collapse (Child)\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(2,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = b, c } Collapse (Lead)\n        // row1 = b, d } Collapse (Child)\n        // row2 = b, d } Should remain unchanged\n        // row3 = a, c\n        // row4 = a, c\n        // row5 = b, c\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true, true},\n                          new boolean[]{false, true, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"d\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"c\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"c\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveDown_Rowsx3ToIndex4_Blockx3Rows_NewMergedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 0 || rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, 0\n        // row1 = a, 1 } Collapse (Lead)\n        // row2 = a, 2 } Collapse (Child)\n        // row3 = a, 3 } Collapse (Child)\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(1,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(4,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[1]);\n                                add(gridRows[2]);\n                                add(gridRows[3]);\n                            }});\n\n        // row0 = b, 0\n        // row1 = b, 4\n        // row2 = a, 1 } Collapse (Lead)\n        // row3 = a, 2 } Collapse (Child)\n        // row4 = a, 3 } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, true, true},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n    }\n\n    @Test\n    public void testGrouped_MoveDown_Rowsx2ToIndex4_Blockx2Rows_NewMergedGroup() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 || rowIndex == 2 || rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1 } Collapse (Lead)\n        // row2 = b, 2 } Collapse (Child)\n        // row3 = a, 3\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Collapse cell\n        gridData.collapseCell(1,\n                              0);\n\n        //Move row\n        gridData.moveRowsTo(4,\n                            new ArrayList<GridRow>() {{\n                                add(gridRows[1]);\n                                add(gridRows[2]);\n                            }});\n\n        // row0 = a, 0\n        // row1 = a, 3\n        // row2 = b, 4 } Should remain unchanged\n        // row3 = b, 1 } Collapse (Lead)\n        // row4 = b, 2 } Collapse (Child)\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, true},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridMergingTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\n\npublic class GridMergingTest extends BaseGridTest {\n\n    @Test\n    public void testInitialSetup_NoMerging() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            assertFalse(data.getRow(rowIndex).isMerged());\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final GridCell<?> cell = data.getCell(rowIndex,\n                                                      columnIndex);\n                assertFalse(cell.isMerged());\n                assertEquals(1,\n                             cell.getMergedCellCount());\n            }\n        }\n    }\n\n    @Test\n    public void testInitialSetup_Column1Merged() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + (columnIndex == 0 ? \"X\" : rowIndex) + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, X)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, X)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, X)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeDownwards_SplitBlock_Rowsx2Rowx1() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeDownwards_SplitBlock_Rowsx1Rowx2() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(2,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeDownwards_TableExtents() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n        data.setCellValue(2,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeUpwards_SplitBlock_Rowsx2Rowsx1() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(0,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 1)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeUpwards_SplitBlock_Rowsx1Rowsx2() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeUpwards_TableExtents() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        data.setCellValue(0,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergeNonSequential() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(0,\n                          0,\n                          new BaseGridCellValue<String>(\"(a, b)\"));\n\n        data.setCellValue(2,\n                          0,\n                          new BaseGridCellValue<String>(\"(a, b)\"));\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(a, b)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(a, b)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(a, b)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(a, b)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMergedUpdateCellValue() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Update cell value\n        data.setCellValue(0,\n                          0,\n                          new BaseGridCellValue<String>(\"<changed>\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"<changed>\"), Expected.build(false,\n                                                                               1,\n                                                                               \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"<changed>\"), Expected.build(false,\n                                                                               1,\n                                                                               \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMerged_MovedColumnRight_UpdateCellInMergedCell() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Move column\n        data.moveColumnTo(1,\n                          gc1);\n\n        //Update cell value\n        data.setCellValue(0,\n                          1,\n                          new BaseGridCellValue<String>(\"<changed>\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 0)\"), Expected.build(true,\n                                                                            2,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 1)\"), Expected.build(true,\n                                                                            0,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(0, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMerged_MovedColumnRight_UpdateCellInMergedCell_CheckMergeToggle() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Move column\n        data.moveColumnTo(1,\n                          gc1);\n\n        //Update cell value\n        data.setCellValue(0,\n                          1,\n                          new BaseGridCellValue<String>(\"<changed>\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 0)\"), Expected.build(true,\n                                                                            2,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 1)\"), Expected.build(true,\n                                                                            0,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(0, 2)\")},\n                          });\n\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(0, 2)\")},\n                          });\n\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 0)\"), Expected.build(true,\n                                                                            2,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 1)\"), Expected.build(true,\n                                                                            0,\n                                                                            \"<changed>\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(1, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(0, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testFullIndexing_TableExtents() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n        data.setCellValue(2,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Check initial indexing\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Clear merging\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Set merging\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testFullIndexing_TableTopExtent() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n        data.setCellValue(2,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        //Check initial indexing\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 3)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        //Clear merging\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 3)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        //Set merging\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 3)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 4)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testFullIndexing_TableBottomExtent() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(3,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 2)\"));\n        data.setCellValue(4,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 2)\"));\n\n        //Check initial indexing\n        assertGridIndexes(data,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        //Clear merging\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n\n        //Set merging\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 3)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 4)\")}\n                          });\n    }\n\n    @Test\n    public void testMergeString_TableExtents() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"a\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testMergeString_SplitBlockx2() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(rowIndex == 0 ? \"b\" : \"a\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testMergeString_SplitBlockx3() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex == 0 || rowIndex == 3 || rowIndex == 4 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testMergeBoolean_TableExtents() {\n        final GridData data = new BaseGridData();\n        final GridColumn<Boolean> gc1 = new MockMergableGridColumn<Boolean>(\"col1\",\n                                                                            100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<Boolean>(false));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)}\n                          });\n    }\n\n    @Test\n    public void testMergeBoolean_SplitBlockx2() {\n        final GridData data = new BaseGridData();\n        final GridColumn<Boolean> gc1 = new MockMergableGridColumn<Boolean>(\"col1\",\n                                                                            100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<Boolean>(rowIndex == 0));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)},\n                                  {Expected.build(true,\n                                                  3,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)}\n                          });\n    }\n\n    @Test\n    public void testMergeBoolean_SplitBlockx3() {\n        final GridData data = new BaseGridData();\n        final GridColumn<Boolean> gc1 = new MockMergableGridColumn<Boolean>(\"col1\",\n                                                                            100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final boolean value = rowIndex == 0 || rowIndex == 3 || rowIndex == 4;\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<Boolean>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  true)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  true)}\n                          });\n\n        data.setMerged(false);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  false)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  false)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)}\n                          });\n\n        data.setMerged(true);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  true)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  false)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  true)},\n                                  {Expected.build(true,\n                                                  0,\n                                                  true)}\n                          });\n    }\n\n    @Test\n    public void testMerged_DeleteCell_MergedCell() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        data.setCellValue(1,\n                          0,\n                          new BaseGridCellValue<String>(\"(0, 0)\"));\n\n        assertGridIndexes(data,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Update cell value\n        data.deleteCell(0,\n                        0);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(null), Expected.build(false,\n                                                                        1,\n                                                                        \"(1, 0)\")},\n                                  {Expected.build(null), Expected.build(false,\n                                                                        1,\n                                                                        \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n\n    @Test\n    public void testMerged_DeleteCell_UnmergedCell() {\n        final GridData data = new BaseGridData();\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        final GridColumn<String> gc2 = new MockMergableGridColumn<String>(\"col2\",\n                                                                          100);\n        data.appendColumn(gc1);\n        data.appendColumn(gc2);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"(\" + columnIndex + \", \" + rowIndex + \")\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 0)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n\n        //Update cell value\n        data.deleteCell(0,\n                        0);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(null), Expected.build(false,\n                                                                        1,\n                                                                        \"(1, 0)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 1)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 1)\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"(0, 2)\"), Expected.build(false,\n                                                                            1,\n                                                                            \"(1, 2)\")},\n                          });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridRowsMergedTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport java.util.Arrays;\n\nimport org.junit.Test;\n\npublic class GridRowsMergedTest extends BaseGridTest {\n\n    @Test\n    public void testRemoveRow() {\n        constructGridData(1, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex > 0 && rowIndex < 4 ? \"b\" : \"a\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n\n        gridData.deleteRow(2);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testAppendRow() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n\n        gridData.appendRow(new BaseGridRow());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtZeroIndex() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n\n        gridData.insertRow(0,\n                           new BaseGridRow());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtStartEndBlock() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n\n        gridData.insertRow(2,\n                           new BaseGridRow());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtMidBlock() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"a\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n\n        gridData.insertRow(2,\n                           new BaseGridRow());\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtZeroIndex() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n\n        gridData.deleteRow(0);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtStartEndBlock() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\")}\n                          });\n\n        gridData.deleteRow(2);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtMidBlock() {\n        constructGridData(1, 4);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(\"a\"));\n            }\n        }\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n\n        gridData.deleteRow(2);\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index4to3() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(3,\n                           gridRows[4]);\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 2\n        // row3 = b, 4\n        // row4 = a, 3\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index3to2() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 3 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 2\n        // row3 = b, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(2,\n                           gridRows[3]);\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = b, 3\n        // row3 = a, 2\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index2to1() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 2 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = b, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(1,\n                           gridRows[2]);\n\n        // row0 = a, 0\n        // row1 = b, 2\n        // row2 = a, 1\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index1to0() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(0,\n                           gridRows[1]);\n\n        // row0 = b, 1\n        // row1 = a, 0\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index2to1_NewMergedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, a\n        // row1 = b, a\n        // row2 = a, b\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(1,\n                           gridRows[2]);\n\n        // row0 = a, a\n        // row1 = a, b\n        // row2 = b, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowUp_Index3to2_NewMergedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(2,\n                           gridRows[3]);\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, b\n        // row3 = a, a\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index0to1() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 4 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(1,\n                           gridRows[0]);\n\n        // row0 = a, 1\n        // row1 = a, 0\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = b, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index1to2() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 3 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 2\n        // row3 = b, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(2,\n                           gridRows[1]);\n\n        // row0 = a, 0\n        // row1 = a, 2\n        // row2 = a, 1\n        // row3 = b, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index2to3() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 2 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = b, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(3,\n                           gridRows[2]);\n\n        // row0 = a, 0\n        // row1 = a, 1\n        // row2 = a, 3\n        // row3 = b, 2\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index3to4() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(4,\n                           gridRows[3]);\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2\n        // row3 = a, 4\n        // row4 = a, 3\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index1to2_NewMergedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex < 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, a\n        // row1 = b, a\n        // row2 = a, b\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(2,\n                           gridRows[1]);\n\n        // row0 = a, a\n        // row1 = a, b\n        // row2 = b, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, false, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowDown_Index2to3_NewMergedBlock() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowTo(3,\n                           gridRows[2]);\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, b\n        // row3 = a, a\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsDown_Indexes2and3to4() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(4,\n                            Arrays.asList(gridRows[2], gridRows[3]));\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, b\n        // row3 = a, a\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsDown_Indexes0and1and2to3() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(3,\n                            Arrays.asList(gridRows[0], gridRows[1], gridRows[2]));\n\n        // row0 = a, b\n        // row1 = a, b\n        // row2 = b, b\n        // row3 = a, a\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsDown_Indexes0and1to4() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(4,\n                            Arrays.asList(gridRows[0], gridRows[1]));\n\n        // row0 = a, a\n        // row1 = a, b\n        // row2 = a, b\n        // row3 = a, b\n        // row4 = b, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       4,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsUp_Indexes3and4to1() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(1,\n                            Arrays.asList(gridRows[3], gridRows[4]));\n\n        // row0 = a, b\n        // row1 = a, b\n        // row2 = a, b\n        // row3 = b, b\n        // row4 = a, a\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(true,\n                                                                       4,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsUp_Indexes2and3and4to1() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(1,\n                            Arrays.asList(gridRows[2], gridRows[3], gridRows[4]));\n\n        // row0 = a, b\n        // row1 = a, a\n        // row2 = a, b\n        // row3 = a, b\n        // row4 = b, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  4,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       3,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsUp_Indexes2and3to0() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex == 1 ? \"b\" : \"a\") : (rowIndex == 2 ? \"a\" : \"b\");\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, b\n        // row1 = b, b\n        // row2 = a, a\n        // row3 = a, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       2,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            Arrays.asList(gridRows[2], gridRows[3]));\n\n        // row0 = a, a\n        // row1 = a, b\n        // row2 = a, b\n        // row3 = b, b\n        // row4 = a, b\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"a\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       4,\n                                                                       \"b\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(true,\n                                                                       0,\n                                                                       \"b\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsUp_notAllRowsMergedAfterMoving() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex < 3 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, 0\n        // row1 = b, 1\n        // row2 = b, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(0,\n                            Arrays.asList(gridRows[2], gridRows[3]));\n\n        // row0 = b, 2\n        // row1 = a, 3\n        // row2 = b, 0\n        // row3 = b, 1\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsUp_notAllRowsMergedBeforeMoving() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex % 2 == 1 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2\n        // row3 = b, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(2,\n                            Arrays.asList(gridRows[3], gridRows[4]));\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = b, 3\n        // row3 = a, 4\n        // row4 = a, 2\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsDown_notAllRowsMergedAfterMoving() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex < 3 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = b, 0\n        // row1 = b, 1\n        // row2 = b, 2\n        // row3 = a, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{true, true, true, true, true},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(true,\n                                                  3,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(3,\n                            Arrays.asList(gridRows[0], gridRows[1]));\n\n        // row0 = b, 2\n        // row1 = a, 3\n        // row2 = b, 0\n        // row3 = b, 1\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, true, true, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n    }\n\n    @Test\n    public void testMergedBlock_MoveRowsDown_notAllRowsMergedBeforeMoving() {\n        constructGridData(2, 5);\n\n        for (int rowIndex = 0; rowIndex < gridData.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < gridData.getColumnCount(); columnIndex++) {\n                final String value = columnIndex == 0 ? (rowIndex % 2 == 1 ? \"b\" : \"a\") : Integer.toString(rowIndex);\n                gridData.setCellValue(rowIndex,\n                                      columnIndex,\n                                      new BaseGridCellValue<String>(value));\n            }\n        }\n\n        // row0 = a, 0\n        // row1 = b, 1\n        // row2 = a, 2\n        // row3 = b, 3\n        // row4 = a, 4\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")}\n                          });\n\n        //Move row\n        gridData.moveRowsTo(4,\n                            Arrays.asList(gridRows[0], gridRows[1], gridRows[2]));\n\n        // row0 = b, 3\n        // row1 = a, 4\n        // row2 = a, 0\n        // row3 = b, 1\n        // row4 = a, 2\n\n        assertGridIndexes(gridData,\n                          new boolean[]{false, true, true, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"3\")},\n                                  {Expected.build(true,\n                                                  2,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"4\")},\n                                  {Expected.build(true,\n                                                  0,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"0\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\"), Expected.build(false,\n                                                                       1,\n                                                                       \"1\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\"), Expected.build(false,\n                                                                       1,\n                                                                       \"2\")}\n                          });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/model/impl/GridRowsUnmergedTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.model.impl;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\npublic class GridRowsUnmergedTest extends BaseGridTest {\n\n    @Test\n    public void testRemoveRow() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex > 0 && rowIndex < 4 ? \"b\" : \"a\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n\n        data.deleteRow(2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testAppendRow() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n\n        data.appendRow(new BaseGridRow());\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtZeroIndex() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n\n        data.insertRow(0,\n                       new BaseGridRow());\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtStartEndBlock() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n\n        data.insertRow(2,\n                       new BaseGridRow());\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testInsertRowAtMidBlock() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"a\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n\n        data.insertRow(2,\n                       new BaseGridRow());\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false, false},\n                          new boolean[]{false, false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  null)},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtZeroIndex() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n\n        data.deleteRow(0);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtStartEndBlock() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\");\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(value));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n\n        data.deleteRow(2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"b\")}\n                          });\n    }\n\n    @Test\n    public void testDeleteRowAtMidBlock() {\n        final GridData data = new BaseGridData(false);\n        final GridColumn<String> gc1 = new MockMergableGridColumn<String>(\"col1\",\n                                                                          100);\n        data.appendColumn(gc1);\n\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n        data.appendRow(new BaseGridRow());\n\n        for (int rowIndex = 0; rowIndex < data.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < data.getColumnCount(); columnIndex++) {\n                data.setCellValue(rowIndex,\n                                  columnIndex,\n                                  new BaseGridCellValue<String>(\"a\"));\n            }\n        }\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false, false},\n                          new boolean[]{false, false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n\n        data.deleteRow(2);\n\n        assertGridIndexes(data,\n                          new boolean[]{false, false, false},\n                          new boolean[]{false, false, false},\n                          new Expected[][]{\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")},\n                                  {Expected.build(false,\n                                                  1,\n                                                  \"a\")}\n                          });\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/util/CellContextUtilitiesTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class CellContextUtilitiesTest {\n\n    private static final double HEADER_HEIGHT = 50.0;\n    private static final double HEADER_ROW_HEIGHT = HEADER_HEIGHT / 2;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation ri;\n\n    @Mock\n    private BaseGridRendererHelper.ColumnInformation ci;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingBlockInformation floatingBlockInformation;\n\n    @Mock\n    private GridColumn.HeaderMetaData headerMetaDataC1;\n\n    @Mock\n    private GridColumn.HeaderMetaData headerMetaDataC2;\n\n    @Captor\n    private ArgumentCaptor<GridBodyCellEditContext> gridBodyCellEditContextCaptor;\n\n    private Point2D rp = new Point2D(0, 0);\n    private Point2D computedLocation = new Point2D(0, 0);\n    private BaseGridRendererHelper gridRendererHelper;\n    private BaseGridRow row1;\n    private BaseGridRow row2;\n    private BaseGridRow row3;\n\n    @Before\n    public void setup() {\n        row1 = new BaseGridRow();\n        row2 = new BaseGridRow();\n        row3 = new BaseGridRow();\n\n        gridRendererHelper = spy(new BaseGridRendererHelper(gridWidget));\n\n        doReturn(computedLocation).when(gridWidget).getComputedLocation();\n        doReturn(gridRenderer).when(gridWidget).getRenderer();\n        doReturn(gridRendererHelper).when(gridWidget).getRendererHelper();\n        doReturn(ri).when(gridRendererHelper).getRenderingInformation();\n        doReturn(HEADER_HEIGHT).when(gridRenderer).getHeaderHeight();\n        doReturn(HEADER_ROW_HEIGHT).when(gridRenderer).getHeaderRowHeight();\n        doReturn(HEADER_HEIGHT).when(ri).getHeaderRowsHeight();\n        doReturn(HEADER_ROW_HEIGHT).when(ri).getHeaderRowHeight();\n\n        doReturn(floatingBlockInformation).when(ri).getFloatingBlockInformation();\n        doReturn(0.0).when(floatingBlockInformation).getX();\n        doReturn(0.0).when(floatingBlockInformation).getWidth();\n\n        doReturn(mock(Viewport.class)).when(gridWidget).getViewport();\n\n        doReturn(new BaseGridData()).when(gridWidget).getModel();\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextNoBlockMultipleColumns() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0);\n        final GridColumn<?> uiColumn3 = mockGridColumn(100.0);\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n        allColumns.add(uiColumn3);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn2).when(ci).getColumn();\n        doReturn(25.0).when(ci).getOffsetX();\n        doReturn(1).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(25.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(50.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeCellRenderContextOneRow() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final List<Double> allRowHeights = Collections.singletonList(row1.getHeight());\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(60.0);\n        final GridColumn<?> uiColumn3 = mockGridColumn(100.0);\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n        allColumns.add(uiColumn3);\n        gridWidget.getModel().appendRow(row1);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(allRowHeights).when(ri).getAllRowHeights();\n        doReturn(uiColumn2).when(ci).getColumn();\n        doReturn(25.0).when(ci).getOffsetX();\n        doReturn(1).when(ci).getUiColumnIndex();\n\n        final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget,\n                                                                                           ri,\n                                                                                           ci,\n                                                                                           0);\n\n        assertNotNull(context);\n        assertThat(context.getAbsoluteCellX())\n                .as(\"Should be column offset\")\n                .isEqualTo(25.0);\n\n        assertThat(context.getAbsoluteCellY())\n                .as(\"Should be headers height\")\n                .isEqualTo(HEADER_HEIGHT);\n    }\n\n    @Test\n    public void testMakeCellRenderContextThreeRows() {\n        setupThreeRowGrid();\n\n        final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget,\n                                                                                           ri,\n                                                                                           ci,\n                                                                                           2);\n\n        assertNotNull(context);\n        assertThat(context.getAbsoluteCellX())\n                .as(\"Should be column offset\")\n                .isEqualTo(25.0);\n\n        assertThat(context.getAbsoluteCellY())\n                .as(\"Should be sum of header height plus preceding row heights\")\n                .isEqualTo(HEADER_HEIGHT + row1.getHeight() + row2.getHeight());\n    }\n\n    @Test\n    public void testMakeCellRenderContextThreeRowsWhenScrolled() {\n        setupThreeRowGrid();\n\n        final Point2D gridComputedLocation = new Point2D(0, -row1.getHeight());\n\n        doReturn(gridComputedLocation).when(gridWidget).getComputedLocation();\n\n        final GridBodyCellEditContext context = CellContextUtilities.makeCellRenderContext(gridWidget,\n                                                                                           ri,\n                                                                                           ci,\n                                                                                           2);\n\n        assertNotNull(context);\n        assertThat(context.getAbsoluteCellX())\n                .as(\"Should be column offset\")\n                .isEqualTo(25.0);\n\n        assertThat(context.getAbsoluteCellY())\n                .as(\"Should be sum of header height plus preceding visible row heights\")\n                .isEqualTo(HEADER_HEIGHT + row2.getHeight());\n    }\n\n    private void setupThreeRowGrid() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final List<Double> allRowHeights = Collections.nCopies(3, row1.getHeight());\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(60.0);\n        final GridColumn<?> uiColumn3 = mockGridColumn(100.0);\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n        allColumns.add(uiColumn3);\n\n        gridWidget.getModel().appendRow(row1);\n        gridWidget.getModel().appendRow(row2);\n        gridWidget.getModel().appendRow(row3);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(allRowHeights).when(ri).getAllRowHeights();\n        doReturn(uiColumn3).when(ci).getColumn();\n        doReturn(25.0).when(ci).getOffsetX();\n        doReturn(3).when(ci).getUiColumnIndex();\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextLeadBlock() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0,\n                                                       uiColumn1.getHeaderMetaData());\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn2).when(ci).getColumn();\n        doReturn(25.0).when(ci).getOffsetX();\n        doReturn(1).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(25.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(75.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextDifferentColumnHeaderMetaDataRows_Column0_Row0() {\n        final List<GridColumn<?>> allColumns = setupHeadersWithDifferentColumnHeaderMetaDataRows();\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(allColumns.get(0)).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(0.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(0.0,\n                     context.getAbsoluteCellY(),\n                     0.0);\n        assertEquals(50.0,\n                     context.getCellWidth(),\n                     0.0);\n        assertEquals(HEADER_ROW_HEIGHT,\n                     context.getCellHeight(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextDifferentColumnHeaderMetaDataRows_Column0_Row1() {\n        final List<GridColumn<?>> allColumns = setupHeadersWithDifferentColumnHeaderMetaDataRows();\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(allColumns.get(0)).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   1);\n\n        assertNotNull(context);\n        assertEquals(0.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(25.0,\n                     context.getAbsoluteCellY(),\n                     0.0);\n        assertEquals(50.0,\n                     context.getCellWidth(),\n                     0.0);\n        assertEquals(HEADER_ROW_HEIGHT,\n                     context.getCellHeight(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextDifferentColumnHeaderMetaDataRows_Column1_Row0() {\n        final List<GridColumn<?>> allColumns = setupHeadersWithDifferentColumnHeaderMetaDataRows();\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(allColumns.get(1)).when(ci).getColumn();\n        doReturn(50.0).when(ci).getOffsetX();\n        doReturn(1).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(50.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(0.0,\n                     context.getAbsoluteCellY(),\n                     0.0);\n        assertEquals(50.0,\n                     context.getCellWidth(),\n                     0.0);\n        assertEquals(HEADER_HEIGHT,\n                     context.getCellHeight(),\n                     0.0);\n    }\n\n    private List<GridColumn<?>> setupHeadersWithDifferentColumnHeaderMetaDataRows() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        //Two Header rows\n        final GridColumn<?> uiColumn1 = mockGridColumn(50.0);\n        //Single Header row\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0,\n                                                       Collections.singletonList(mock(GridColumn.HeaderMetaData.class)));\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n\n        return allColumns;\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextLeadBlockWithExtraLeadNonBlockColumn() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0);\n        final GridColumn<?> uiColumn3 = mockGridColumn(75.0,\n                                                       uiColumn2.getHeaderMetaData());\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n        allColumns.add(uiColumn3);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn3).when(ci).getColumn();\n        doReturn(75.0).when(ci).getOffsetX();\n        doReturn(2).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(75.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(125.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextTailBlock() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0,\n                                                       uiColumn1.getHeaderMetaData());\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn1).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(0.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(75.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextTailBlockWithExtraTailNonBlockColumn() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn1 = mockGridColumn(25.0);\n        final GridColumn<?> uiColumn2 = mockGridColumn(50.0,\n                                                       uiColumn1.getHeaderMetaData());\n        final GridColumn<?> uiColumn3 = mockGridColumn(100.0);\n        allColumns.add(uiColumn1);\n        allColumns.add(uiColumn2);\n        allColumns.add(uiColumn3);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn1).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(0.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(75.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testMakeHeaderRenderContextNoBlock() {\n        final List<GridColumn<?>> allColumns = new ArrayList<>();\n        final GridColumn<?> uiColumn = mockGridColumn(100.0);\n        allColumns.add(uiColumn);\n\n        doReturn(allColumns).when(ri).getAllColumns();\n        doReturn(uiColumn).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n\n        final GridBodyCellRenderContext context = CellContextUtilities.makeHeaderCellRenderContext(gridWidget,\n                                                                                                   ri,\n                                                                                                   ci,\n                                                                                                   rp,\n                                                                                                   0);\n\n        assertNotNull(context);\n        assertEquals(0.0,\n                     context.getAbsoluteCellX(),\n                     0.0);\n        assertEquals(100.0,\n                     context.getCellWidth(),\n                     0.0);\n    }\n\n    @Test\n    public void testEditWhenNoCellSelected() {\n        final GridColumn.HeaderMetaData headerMetaData = mock(GridColumn.HeaderMetaData.class);\n        final GridColumn<?> gridColumn = mockGridColumn(100.0, Arrays.asList(headerMetaData));\n        gridWidget.getModel().appendColumn(gridColumn);\n\n        CellContextUtilities.editSelectedCell(gridWidget);\n\n        verify(headerMetaData, never()).edit(any(GridBodyCellEditContext.class));\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget, never()).startEditingCell(any(Point2D.class));\n    }\n\n    @Test\n    public void testEditWhenHeaderCellSelected() {\n        setupHeaderMetadata();\n\n        CellContextUtilities.editSelectedCell(gridWidget);\n\n        verify(headerMetaDataC1, never()).edit(any(GridBodyCellEditContext.class));\n        verify(headerMetaDataC2).edit(gridBodyCellEditContextCaptor.capture());\n        final GridBodyCellEditContext gridBodyCellEditContext = gridBodyCellEditContextCaptor.getValue();\n        assertThat(gridBodyCellEditContext)\n                .hasFieldOrPropertyWithValue(\"columnIndex\", 1)\n                .hasFieldOrPropertyWithValue(\"rowIndex\", 0);\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget, never()).startEditingCell(any(Point2D.class));\n    }\n\n    @Test\n    public void testEditWhenHeaderCellSelectedWithRelativeLocation() {\n        setupHeaderMetadata();\n\n        final Point2D relativeLocation = new Point2D(25.0, 35.0);\n\n        CellContextUtilities.editSelectedCell(gridWidget, relativeLocation);\n\n        verify(headerMetaDataC1, never()).edit(any(GridBodyCellEditContext.class));\n        verify(headerMetaDataC2).edit(gridBodyCellEditContextCaptor.capture());\n        final GridBodyCellEditContext gridBodyCellEditContext = gridBodyCellEditContextCaptor.getValue();\n        assertThat(gridBodyCellEditContext)\n                .hasFieldOrPropertyWithValue(\"columnIndex\", 1)\n                .hasFieldOrPropertyWithValue(\"rowIndex\", 0)\n                .hasFieldOrPropertyWithValue(\"relativeLocation\", Optional.of(relativeLocation));\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget, never()).startEditingCell(any(Point2D.class));\n    }\n\n    private void setupHeaderMetadata() {\n        final GridColumn<?> gridColumnOne = mockGridColumn(100.0, Arrays.asList(headerMetaDataC1));\n        final GridColumn<?> gridColumnTwo = mockGridColumn(100.0, Arrays.asList(headerMetaDataC2));\n\n        doReturn(0).when(gridColumnOne).getIndex();\n        doReturn(1).when(gridColumnTwo).getIndex();\n\n        final double secondColumnXCoordinate = gridColumnOne.getWidth() + gridColumnTwo.getWidth() / 2;\n\n        doReturn(ci).when(gridRendererHelper).getColumnInformation(secondColumnXCoordinate);\n        doReturn(gridColumnOne.getWidth()).when(gridRendererHelper).getColumnOffset(gridColumnTwo);\n        doReturn(gridColumnTwo).when(ci).getColumn();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(1).when(ci).getUiColumnIndex();\n\n        doReturn(Arrays.asList(gridColumnOne, gridColumnTwo)).when(ri).getAllColumns();\n\n        gridWidget.getModel().appendColumn(gridColumnOne);\n        gridWidget.getModel().appendColumn(gridColumnTwo);\n        gridWidget.getModel().selectHeaderCell(0, 1);\n    }\n\n    @Test\n    public void testEditWhenDataCellSelectedSecondRow() {\n        final GridColumn.HeaderMetaData headerMetaData = mock(GridColumn.HeaderMetaData.class);\n        final GridColumn<?> gridColumn = mockGridColumn(100.0, Arrays.asList(headerMetaData));\n\n        doReturn(0).when(gridColumn).getIndex();\n\n        gridWidget.getModel().appendColumn(gridColumn);\n        gridWidget.getModel().appendRow(row1);\n        gridWidget.getModel().appendRow(row2);\n        gridWidget.getModel().selectCell(1, 0);\n\n        CellContextUtilities.editSelectedCell(gridWidget);\n\n        verify(headerMetaData, never()).edit(any(GridBodyCellEditContext.class));\n        verify(gridWidget).startEditingCell(1, 0);\n    }\n\n    @Test\n    public void testEditWhenDataCellSelectedSecondColumn() {\n        final GridColumn.HeaderMetaData headerMetaDataC1 = mock(GridColumn.HeaderMetaData.class);\n        final GridColumn.HeaderMetaData headerMetaDataC2 = mock(GridColumn.HeaderMetaData.class);\n        final GridColumn<?> gridColumnOne = mockGridColumn(100.0, Arrays.asList(headerMetaDataC1));\n        final GridColumn<?> gridColumnTwo = mockGridColumn(100.0, Arrays.asList(headerMetaDataC2));\n\n        doReturn(0).when(gridColumnOne).getIndex();\n        doReturn(1).when(gridColumnTwo).getIndex();\n\n        gridWidget.getModel().appendColumn(gridColumnOne);\n        gridWidget.getModel().appendColumn(gridColumnTwo);\n        gridWidget.getModel().appendRow(row1);\n        gridWidget.getModel().selectCell(0, 1);\n\n        CellContextUtilities.editSelectedCell(gridWidget);\n\n        verify(headerMetaDataC1, never()).edit(any(GridBodyCellEditContext.class));\n        verify(headerMetaDataC2, never()).edit(any(GridBodyCellEditContext.class));\n        verify(gridWidget).startEditingCell(0, 1);\n    }\n\n    private GridColumn<?> mockGridColumn(final double width) {\n        final List<GridColumn.HeaderMetaData> headerMetaData = new ArrayList<>();\n        headerMetaData.add(mock(GridColumn.HeaderMetaData.class));\n        headerMetaData.add(mock(GridColumn.HeaderMetaData.class));\n\n        return mockGridColumn(width,\n                              headerMetaData);\n    }\n\n    private GridColumn<?> mockGridColumn(final double width,\n                                         final List<GridColumn.HeaderMetaData> headerMetaData) {\n        final GridColumn<?> uiColumn = mock(GridColumn.class);\n\n        doReturn(headerMetaData).when(uiColumn).getHeaderMetaData();\n        doReturn(width).when(uiColumn).getWidth();\n\n        return uiColumn;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/util/ColumnIndexUtilitiesTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class ColumnIndexUtilitiesTest {\n\n    private static final int COLUMN_COUNT = 4;\n\n    private List<GridColumn<?>> columns;\n\n    @Before\n    public void setup() {\n        this.columns = new ArrayList<>();\n        for (int index = 0; index < COLUMN_COUNT; index++) {\n            final GridColumn<String> column = new BaseGridTest.MockMergableGridColumn<>(\"col1\",\n                                                                                        100);\n            column.setIndex(COLUMN_COUNT - index - 1);\n            columns.add(column);\n        }\n    }\n\n    @Test\n    public void testFindUiColumnIndex() {\n        assertEquals(3,\n                     ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                            0));\n        assertEquals(2,\n                     ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                            1));\n        assertEquals(1,\n                     ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                            2));\n        assertEquals(0,\n                     ColumnIndexUtilities.findUiColumnIndex(columns,\n                                                            3));\n    }\n\n    @Test\n    public void testGetHeaderBlockStartColumnIndex() {\n        //MetaDataGroups: [\"\"][\"\"][\"\"][\"\"]\n        assertEquals(0,\n                     ColumnIndexUtilities.getHeaderBlockStartColumnIndex(columns,\n                                                                         columns.get(3).getHeaderMetaData().get(0),\n                                                                         0,\n                                                                         3));\n    }\n\n    @Test\n    public void testGetHeaderBlockStartColumnIndexWithSplitBlock() {\n        //MetaDataGroups: [\"\"][\"new-group\"][\"\"][\"\"]\n        columns.get(1).getHeaderMetaData().get(0).setColumnGroup(\"new-group\");\n        assertEquals(2,\n                     ColumnIndexUtilities.getHeaderBlockStartColumnIndex(columns,\n                                                                         columns.get(3).getHeaderMetaData().get(0),\n                                                                         0,\n                                                                         3));\n    }\n\n    @Test\n    public void testGetHeaderBlockEndColumnIndex() {\n        //MetaDataGroups: [\"\"][\"\"][\"\"][\"\"]\n        assertEquals(3,\n                     ColumnIndexUtilities.getHeaderBlockEndColumnIndex(columns,\n                                                                       columns.get(0).getHeaderMetaData().get(0),\n                                                                       0,\n                                                                       0));\n    }\n\n    @Test\n    public void testGetHeaderBlockEndColumnIndexWithSplitBlock() {\n        //MetaDataGroups: [\"\"][\"\"][\"new-group\"][\"\"]\n        columns.get(2).getHeaderMetaData().get(0).setColumnGroup(\"new-group\");\n        assertEquals(1,\n                     ColumnIndexUtilities.getHeaderBlockEndColumnIndex(columns,\n                                                                       columns.get(0).getHeaderMetaData().get(0),\n                                                                       0,\n                                                                       0));\n    }\n\n    @Test\n    public void testGetHeaderBlockEndColumnIndexWithIndexOutOfBounds() {\n        //MetaDataGroups: [\"\"][\"\"][\"\"][\"\"]\n        assertEquals(3,\n                     ColumnIndexUtilities.getHeaderBlockEndColumnIndex(columns,\n                                                                       columns.get(0).getHeaderMetaData().get(0),\n                                                                       0,\n                                                                       4));\n    }\n\n    @Test\n    public void testGetHeaderBlockEndColumnIndexWithIndexOutOfBounds2() {\n        //MetaDataGroups: [\"\"][\"\"][\"\"][\"\"]\n        assertEquals(3,\n                     ColumnIndexUtilities.getHeaderBlockEndColumnIndex(columns,\n                                                                       columns.get(0).getHeaderMetaData().get(0),\n                                                                       0,\n                                                                       100));\n    }\n\n    @Test\n    public void testGetUiHeaderRowIndex() {\n        final BaseGridData model = new BaseGridData();\n        columns.forEach(col -> model.appendColumn(col));\n\n        assertEquals(0, ColumnIndexUtilities.getMaxUiHeaderRowIndexOfColumn(model, 0));\n\n        columns.get(1).getHeaderMetaData().add(new BaseHeaderMetaData(\"col1\", \"second-row\"));\n\n        assertEquals(1, ColumnIndexUtilities.getMaxUiHeaderRowIndexOfColumn(model, 1));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/util/CoordinateUtilitiesTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.event.dom.client.ContextMenuEvent;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.GreenTheme;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.DefaultPinnedModeManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class CoordinateUtilitiesTest {\n\n    private static final double DEFAULT_ROW_HEIGHT = 20D;\n    private static final double COLUMN_WIDTH = 50D;\n\n    protected final int NATIVE_EVENT_CLIENT_X = 100;\n    protected final int NATIVE_EVENT_CLIENT_Y = 100;\n    protected final int TARGET_ABSOLUTE_LEFT = 50;\n    protected final int TARGET_SCROLL_LEFT = 20;\n    protected final int TARGET_ABSOLUTE_TOP = 50;\n    protected final int TARGET_SCROLL_TOP = 20;\n    protected final int DOCUMENT_SCROLL_LEFT = 10;\n    protected final int DOCUMENT_SCROLL_TOP = 10;\n\n    private final int EXPECTED_RELATIVE_X = NATIVE_EVENT_CLIENT_X - TARGET_ABSOLUTE_LEFT + TARGET_SCROLL_LEFT + DOCUMENT_SCROLL_LEFT;\n    private final int EXPECTED_RELATIVE_Y = NATIVE_EVENT_CLIENT_Y - TARGET_ABSOLUTE_TOP + TARGET_SCROLL_TOP + DOCUMENT_SCROLL_TOP;\n\n    @Mock\n    private BaseGridRendererHelper gridRendererHelper;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation ri;\n\n    @Mock\n    private BaseGridRendererHelper.ColumnInformation ci;\n\n    @Mock\n    private Element targetMock;\n\n    @Mock\n    private NativeEvent nativeEventMock;\n\n    @Mock\n    private ContextMenuEvent contextMenuEventMock;\n\n    @Mock\n    private Document documentMock;\n\n    private GridData gridData;\n\n    private GridSelectionManager gridSelectionManager;\n\n    private GridPinnedModeManager gridPinnedModeManager;\n\n    private GridRenderer gridRenderer;\n\n    private GridColumnRenderer gridColumnRenderer;\n\n    private Point2D point;\n\n    private Point2D convertedPoint;\n\n    private GridWidget view;\n\n    @Before\n    public void setUp() throws Exception {\n        gridData = new BaseGridData();\n        gridSelectionManager = new DefaultGridLayer();\n        gridPinnedModeManager = new DefaultPinnedModeManager((DefaultGridLayer) gridSelectionManager);\n        gridRenderer = new BaseGridRenderer(new GreenTheme());\n        gridColumnRenderer = mock(GridColumnRenderer.class);\n\n        when(nativeEventMock.getClientX()).thenReturn(NATIVE_EVENT_CLIENT_X);\n        when(nativeEventMock.getClientY()).thenReturn(NATIVE_EVENT_CLIENT_Y);\n\n        when(targetMock.getOwnerDocument()).thenReturn(documentMock);\n        when(targetMock.getAbsoluteLeft()).thenReturn(TARGET_ABSOLUTE_LEFT);\n        when(targetMock.getScrollLeft()).thenReturn(TARGET_SCROLL_LEFT);\n        when(targetMock.getAbsoluteTop()).thenReturn(TARGET_ABSOLUTE_TOP);\n        when(targetMock.getScrollTop()).thenReturn(TARGET_SCROLL_TOP);\n\n        when(documentMock.getScrollLeft()).thenReturn(DOCUMENT_SCROLL_LEFT);\n        when(documentMock.getScrollTop()).thenReturn(DOCUMENT_SCROLL_TOP);\n\n        when(contextMenuEventMock.getNativeEvent()).thenReturn(nativeEventMock);\n        when(contextMenuEventMock.getRelativeElement()).thenReturn(targetMock);\n    }\n\n    @Test\n    public void testConvertDOMToGridCoordinateNoParent() throws Exception {\n        point = new Point2D(15D, 20D);\n        setupGridWidget();\n        convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);\n        Assertions.assertThat(convertedPoint).isNotNull();\n        Assertions.assertThat(convertedPoint.getX()).isEqualTo(15D);\n        Assertions.assertThat(convertedPoint.getY()).isEqualTo(20D);\n    }\n\n    @Test\n    public void testConvertDOMToGridCoordinateWithParentWithoutTransform() throws Exception {\n        point = new Point2D(15D, 20D);\n        setupGridWidget();\n        when(view.getViewport()).thenReturn(mock(Viewport.class));\n        convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);\n        Assertions.assertThat(convertedPoint).isNotNull();\n        Assertions.assertThat(convertedPoint.getX()).isEqualTo(15D);\n        Assertions.assertThat(convertedPoint.getY()).isEqualTo(20D);\n    }\n\n    @Test\n    public void testConvertDOMToGridCoordinateWithParentWithTransformMove() throws Exception {\n        final Viewport viewport = mock(Viewport.class);\n        final Transform transform = new Transform();\n        transform.translate(10D, 10D);\n        point = new Point2D(15D, 20D);\n        setupGridWidget();\n        when(view.getViewport()).thenReturn(viewport);\n        when(viewport.getTransform()).thenReturn(transform);\n        convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);\n        Assertions.assertThat(convertedPoint).isNotNull();\n        Assertions.assertThat(convertedPoint.getX()).isEqualTo(5D);\n        Assertions.assertThat(convertedPoint.getY()).isEqualTo(10D);\n    }\n\n    @Test\n    public void testConvertDOMToGridCoordinateWithParentWithTransformMoveAndRotate() throws Exception {\n        final Viewport viewport = mock(Viewport.class);\n        final Transform transform = new Transform();\n        transform.translate(10D, 10D);\n        transform.rotate(Math.PI);\n        point = new Point2D(15D, 20D);\n        setupGridWidget();\n        when(view.getViewport()).thenReturn(viewport);\n        when(viewport.getTransform()).thenReturn(transform);\n        convertedPoint = CoordinateUtilities.convertDOMToGridCoordinate(view, point);\n        Assertions.assertThat(convertedPoint).isNotNull();\n        Assertions.assertThat(Double.valueOf(convertedPoint.getX()).intValue()).isEqualTo(-5);\n        Assertions.assertThat(Double.valueOf(convertedPoint.getY()).intValue()).isEqualTo(-10);\n    }\n\n    @Test\n    public void testGetUiRowIndexOverHeader() throws Exception {\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, -1);\n        Assertions.assertThat(rowIndex).isNull();\n    }\n\n    @Test\n    public void testGetUiRowIndexInHeader() throws Exception {\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, gridRenderer.getHeaderHeight() - 1);\n        Assertions.assertThat(rowIndex).isNull();\n    }\n\n    @Test\n    public void testGetUiRowIndexInHeaderInFirstRow() throws Exception {\n        // one row has height 20\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, gridRenderer.getHeaderHeight() + 1);\n        Assertions.assertThat(rowIndex).isEqualTo(0);\n    }\n\n    @Test\n    public void testGetUiRowIndexInHeaderInSecondRow() throws Exception {\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, gridRenderer.getHeaderHeight() + DEFAULT_ROW_HEIGHT + 1);\n        Assertions.assertThat(rowIndex).isEqualTo(1);\n    }\n\n    @Test\n    public void testGetUiRowIndexInHeaderInThirdRow() throws Exception {\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, gridRenderer.getHeaderHeight() + (DEFAULT_ROW_HEIGHT * 2) + 1);\n        Assertions.assertThat(rowIndex).isEqualTo(2);\n    }\n\n    @Test\n    public void testGetUiRowIndexInHeaderBelowLastRow() throws Exception {\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        gridData.appendRow(new BaseGridRow());\n        setupGridWidget();\n        final Integer rowIndex = CoordinateUtilities.getUiRowIndex(view, gridRenderer.getHeaderHeight() + (DEFAULT_ROW_HEIGHT * 3) + 1);\n        Assertions.assertThat(rowIndex).isNull();\n    }\n\n    @Test\n    public void testGetUiColumnIndexBeforeWidget() throws Exception {\n        setupGridWidget();\n        final Integer columnIndex = CoordinateUtilities.getUiColumnIndex(view, -1);\n        Assertions.assertThat(columnIndex).isNull();\n    }\n\n    @Test\n    public void testGetUiColumnIndexAfterWidgetHeader() throws Exception {\n        setupGridWidget();\n        final Integer columnIndex = CoordinateUtilities.getUiColumnIndex(view, view.getWidth() + 1);\n        Assertions.assertThat(columnIndex).isNull();\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGetUiColumnIndexInHeaderAfterLastColumn() throws Exception {\n        gridData.appendColumn(new BaseGridColumn<>(new BaseHeaderMetaData(\"first\"), gridColumnRenderer, COLUMN_WIDTH));\n        gridData.appendColumn(new BaseGridColumn<>(new BaseHeaderMetaData(\"second\"), gridColumnRenderer, COLUMN_WIDTH));\n        gridData.appendColumn(new BaseGridColumn<>(new BaseHeaderMetaData(\"third\"), gridColumnRenderer, COLUMN_WIDTH));\n        setupGridWidget();\n        doReturn(gridSelectionManager).when(view).getLayer();\n        final Integer columnIndex = CoordinateUtilities.getUiColumnIndex(view, (COLUMN_WIDTH * 3) + 1);\n        Assertions.assertThat(columnIndex).isNull();\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGetUiHeaderRowIndexHeaderMinY() {\n        point = new Point2D(COLUMN_WIDTH / 2, -5.0);\n        setupGridWidget();\n\n        final GridColumn uiColumn = new BaseGridColumn<>(new BaseHeaderMetaData(\"first\"), gridColumnRenderer, COLUMN_WIDTH);\n        gridData.appendColumn(uiColumn);\n        doReturn(uiColumn).when(ci).getColumn();\n\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(view,\n                                                                                 point);\n        assertNull(uiHeaderRowIndex);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGetUiHeaderRowIndexHeaderMaxY() {\n        point = new Point2D(COLUMN_WIDTH / 2, gridRenderer.getHeaderHeight() + 5.0);\n        setupGridWidget();\n\n        final GridColumn uiColumn = new BaseGridColumn<>(new BaseHeaderMetaData(\"first\"), gridColumnRenderer, COLUMN_WIDTH);\n        gridData.appendColumn(uiColumn);\n        doReturn(uiColumn).when(ci).getColumn();\n\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(view,\n                                                                                 point);\n        assertNull(uiHeaderRowIndex);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGetUiHeaderRowIndexRow0() {\n        point = new Point2D(COLUMN_WIDTH / 2, gridRenderer.getHeaderRowHeight() - 5.0);\n        setupGridWidget();\n\n        final GridColumn uiColumn = new BaseGridColumn<>(new BaseHeaderMetaData(\"first\"), gridColumnRenderer, COLUMN_WIDTH);\n        gridData.appendColumn(uiColumn);\n        doReturn(uiColumn).when(ci).getColumn();\n\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(view,\n                                                                                 point);\n        assertNotNull(uiHeaderRowIndex);\n        assertEquals(0,\n                     (int) uiHeaderRowIndex);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGetUiHeaderRowIndexRow1() {\n        point = new Point2D(COLUMN_WIDTH / 2, gridRenderer.getHeaderRowHeight() + 5.0);\n        setupGridWidget();\n\n        final List<GridColumn.HeaderMetaData> headerMetaData = new ArrayList<>();\n        headerMetaData.add(new BaseHeaderMetaData(\"first\"));\n        headerMetaData.add(new BaseHeaderMetaData(\"second\"));\n        final GridColumn uiColumn = new BaseGridColumn<>(headerMetaData,\n                                                         gridColumnRenderer,\n                                                         COLUMN_WIDTH);\n        gridData.appendColumn(uiColumn);\n        doReturn(uiColumn).when(ci).getColumn();\n\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(view,\n                                                                                 point);\n        assertNotNull(uiHeaderRowIndex);\n        assertEquals(1,\n                     (int) uiHeaderRowIndex);\n    }\n\n    @Test\n    public void testGetRelativeXOfEvent() {\n        int retrieved = CoordinateUtilities.getRelativeXOfEvent(contextMenuEventMock);\n        assertEquals(EXPECTED_RELATIVE_X, retrieved);\n    }\n\n    @Test\n    public void testGetRelativeYOfEvent() {\n        int retrieved = CoordinateUtilities.getRelativeYOfEvent(contextMenuEventMock);\n        assertEquals(EXPECTED_RELATIVE_Y, retrieved);\n    }\n\n    @Test\n    public void testGetUiHeaderRowIndexOnNoRowsHeader() {\n        point = new Point2D(COLUMN_WIDTH / 2, gridRenderer.getHeaderRowHeight() - 5.0);\n        setupGridWidget();\n\n        gridData.setHeaderRowCount(0);\n        final Integer uiHeaderRowIndex = CoordinateUtilities.getUiHeaderRowIndex(view,\n                                                                                 point);\n        assertNull(uiHeaderRowIndex);\n    }\n\n    private void setupGridWidget() {\n        view = spy(new BaseGridWidget(gridData, gridSelectionManager, gridPinnedModeManager, gridRenderer));\n        doReturn(gridRenderer).when(view).getRenderer();\n        doReturn(gridRendererHelper).when(view).getRendererHelper();\n        doReturn(ri).when(gridRendererHelper).getRenderingInformation();\n        doReturn(ci).when(gridRendererHelper).getColumnInformation(anyDouble());\n        doReturn(mock(Viewport.class)).when(view).getViewport();\n        doReturn(0.0).when(ci).getOffsetX();\n        doReturn(0).when(ci).getUiColumnIndex();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/util/GridHighlightHelperTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridHighlightHelperTest {\n\n    @Mock\n    private GridLienzoPanel gridPanel;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    private DefaultGridLayer defaultGridLayer;\n\n    @Mock\n    private Bounds visibleBounds;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Transform transform;\n\n    private int column = 2;\n\n    private int row = 4;\n\n    private int x = 64;\n\n    private int y = 128;\n\n    private double columnOffset = 64;\n\n    private double rowOffset = 128;\n\n    private double defaultPaddingX = 1;\n\n    private double defaultPaddingY = 2;\n\n    private double defaultScale = 1;\n\n    private double defaultTranslate = 1;\n\n    private double visibleBoundsX = -800;\n\n    private double visibleBoundsY = -600;\n\n    private double visibleBoundsWidth = 810;\n\n    private double visibleBoundsHeight = 620;\n\n    private GridHighlightHelper highlightHelper;\n\n    @Before\n    public void init() {\n\n        highlightHelper = spy(new GridHighlightHelper(gridPanel, gridWidget));\n        highlightHelper.withPaddingX(defaultPaddingX);\n        highlightHelper.withPaddingY(defaultPaddingY);\n\n        when(gridPanel.getDefaultGridLayer()).thenReturn(defaultGridLayer);\n        when(gridWidget.getRendererHelper()).thenReturn(rendererHelper);\n\n        // BaseGridRendererHelper\n        when(rendererHelper.getColumnOffset(column)).thenReturn(columnOffset);\n        when(rendererHelper.getRowOffset(row)).thenReturn(rowOffset);\n\n        // DefaultGridLayer\n        when(defaultGridLayer.getVisibleBounds()).thenReturn(visibleBounds);\n        when(defaultGridLayer.getViewport()).thenReturn(viewport);\n\n        // VisibleBounds\n        when(visibleBounds.getX()).thenReturn(visibleBoundsX);\n        when(visibleBounds.getY()).thenReturn(visibleBoundsY);\n        when(visibleBounds.getWidth()).thenReturn(visibleBoundsWidth);\n        when(visibleBounds.getHeight()).thenReturn(visibleBoundsHeight);\n\n        // Viewport\n        when(viewport.getTransform()).thenReturn(transform);\n        when(transform.getScaleY()).thenReturn(defaultScale);\n        when(transform.getScaleX()).thenReturn(defaultScale);\n        when(transform.getTranslateY()).thenReturn(defaultTranslate);\n        when(transform.getTranslateX()).thenReturn(defaultTranslate);\n    }\n\n    @Test\n    public void testHighlight() {\n\n        doNothing().when(highlightHelper).moveCanvasTo(anyDouble(), anyDouble());\n        doNothing().when(highlightHelper).highlightCell(row, column);\n\n        highlightHelper.highlight(row, column);\n\n        verify(gridWidget).selectCell(row, column, false, false);\n        verify(gridWidget).draw();\n        verify(highlightHelper).moveCanvasTo(-63, -126);\n    }\n\n    @Test\n    public void testHighlightWithPinnedGrid() {\n\n        doNothing().when(highlightHelper).moveCanvasTo(anyDouble(), anyDouble());\n\n        highlightHelper.withPinnedGrid().highlight(row, column);\n\n        verify(gridWidget).selectCell(row, column, false, false);\n        verify(gridWidget).draw();\n        verify(highlightHelper).moveCanvasTo(-63, -126);\n    }\n\n    @Test\n    public void testHighlightWithPadding() {\n\n        doNothing().when(highlightHelper).moveCanvasTo(anyDouble(), anyDouble());\n\n        highlightHelper\n                .withPaddingX(128)\n                .withPaddingY(64)\n                .highlight(row, column);\n\n        verify(gridWidget).selectCell(row, column, false, false);\n        verify(gridWidget).draw();\n        verify(highlightHelper).moveCanvasTo(64, -64);\n    }\n\n    @Test\n    public void testMoveCanvasToWhenTheElementIsVisible() {\n\n        final int expectedDeltaX = 0;\n        final int expectedDeltaY = 0;\n        final Transform copy = mock(Transform.class);\n        final Transform newTransform = mock(Transform.class);\n\n        when(transform.copy()).thenReturn(copy);\n        when(copy.translate(anyDouble(), anyDouble())).thenReturn(newTransform);\n\n        highlightHelper.moveCanvasTo(x, y);\n\n        verify(copy).translate(expectedDeltaX, expectedDeltaY);\n        verify(viewport).setTransform(newTransform);\n        verify(defaultGridLayer).batch();\n        verify(gridPanel).refreshScrollPosition();\n    }\n\n    @Test\n    public void testMoveCanvasToWhenElementIsNotHorizontallyVisible() {\n\n        final int expectedDeltaX = -747;\n        final int expectedDeltaY = 0;\n        final Transform copy = mock(Transform.class);\n        final Transform newTransform = mock(Transform.class);\n\n        when(transform.copy()).thenReturn(copy);\n        when(copy.translate(anyDouble(), anyDouble())).thenReturn(newTransform);\n\n        highlightHelper.moveCanvasTo(x - visibleBoundsWidth, y);\n\n        verify(copy).translate(expectedDeltaX, expectedDeltaY);\n        verify(viewport).setTransform(newTransform);\n        verify(defaultGridLayer).batch();\n        verify(gridPanel).refreshScrollPosition();\n    }\n\n    @Test\n    public void testMoveCanvasToWhenElementIsNotVerticallyVisible() {\n\n        final int expectedDeltaX = 0;\n        final int expectedDeltaY = -493;\n        final Transform copy = mock(Transform.class);\n        final Transform newTransform = mock(Transform.class);\n\n        when(transform.copy()).thenReturn(copy);\n        when(copy.translate(anyDouble(), anyDouble())).thenReturn(newTransform);\n\n        highlightHelper.moveCanvasTo(x, y - visibleBoundsHeight);\n\n        verify(copy).translate(expectedDeltaX, expectedDeltaY);\n        verify(viewport).setTransform(newTransform);\n        verify(defaultGridLayer).batch();\n        verify(gridPanel).refreshScrollPosition();\n    }\n\n    @Test\n    public void testClearSelections() {\n\n        final GridData model = mock(GridData.class);\n\n        when(gridWidget.getModel()).thenReturn(model);\n\n        highlightHelper.clearSelections();\n\n        verify(model).clearSelections();\n        verify(gridWidget).draw();\n    }\n\n    @Test\n    public void testCalculateRowOffset() {\n\n        final double widgetY = -32;\n        final double paddingY = 20;\n        final double expected = -(widgetY + rowOffset - paddingY);\n\n        when(highlightHelper.getPaddingY()).thenReturn(paddingY);\n        when(gridWidget.getY()).thenReturn(widgetY);\n\n        final double actual = highlightHelper.calculateRowOffset(row);\n\n        assertEquals(expected, actual, 0.01d);\n    }\n\n    @Test\n    public void testCalculateColumnOffset() {\n\n        final double widgetX = -67;\n        final double paddingX = 12;\n        final double expected = -(widgetX + columnOffset - paddingX);\n\n        when(highlightHelper.getPaddingX()).thenReturn(paddingX);\n        when(gridWidget.getX()).thenReturn(widgetX);\n\n        final double actual = highlightHelper.calculateColumnOffset(column);\n\n        assertEquals(expected, actual, 0.01d);\n    }\n\n    @Test\n    public void testClearHighlight() {\n\n        final BaseGridRenderer renderer = mock(BaseGridRenderer.class);\n        when(gridWidget.getRenderer()).thenReturn(renderer);\n\n        highlightHelper.clearHighlight();\n\n        verify(renderer).clearCellHighlight();\n        verify(gridWidget).draw();\n    }\n\n    @Test\n    public void testHighlightCell() {\n\n        final BaseGridRenderer renderer = mock(BaseGridRenderer.class);\n        when(gridWidget.getRenderer()).thenReturn(renderer);\n\n        highlightHelper.highlightCell(row, column);\n\n        verify(renderer).highlightCell(column, row);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/util/LoggingTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.util;\n\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.contains;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LoggingTest {\n\n    private static final String MESSAGE = \"message\";\n\n    private static final long PREVIOUS_TIME_MILLIS = 100;\n\n    @Mock\n    private Logger logger;\n\n    @Test\n    public void testLogEnabled() {\n        when(logger.isLoggable(Level.FINEST)).thenReturn(true);\n\n        assertThat(Logging.log(logger, MESSAGE)).isGreaterThan(0);\n\n        verify(logger).log(eq(Level.FINEST), eq(MESSAGE));\n    }\n\n    @Test\n    public void testLogWithPreviousTimeTimeMillisEnabled() {\n        when(logger.isLoggable(Level.FINEST)).thenReturn(true);\n\n        // There's no guarantee that the method takes >0 ms to complete\n        // so compare the result is at least the same as the previous time\n        assertThat(Logging.log(logger, MESSAGE, PREVIOUS_TIME_MILLIS)).isGreaterThanOrEqualTo(PREVIOUS_TIME_MILLIS);\n\n        verify(logger).log(eq(Level.FINEST), contains(MESSAGE));\n    }\n\n    @Test\n    public void testLogDisabled() {\n        when(logger.isLoggable(Level.FINEST)).thenReturn(false);\n\n        assertThat(Logging.log(logger, MESSAGE)).isGreaterThan(0);\n\n        verify(logger, never()).log(any(Level.class), anyString());\n    }\n\n    @Test\n    public void testLogWithPreviousTimeTimeMillisDisabled() {\n        when(logger.isLoggable(Level.FINEST)).thenReturn(false);\n\n        // There's no guarantee that the method takes >0 ms to complete\n        // so compare the result is at least the same as the previous time\n        assertThat(Logging.log(logger, MESSAGE, PREVIOUS_TIME_MILLIS)).isGreaterThanOrEqualTo(PREVIOUS_TIME_MILLIS);\n\n        verify(logger, never()).log(any(Level.class), anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseDownHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState.GridWidgetHandlersOperation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridWidgetDnDMouseDownHandlerTest {\n\n    private static final double GRID_X = 10.0;\n\n    private static final double GRID_Y = 20.0;\n\n    private static final double GRID_WIDTH = 100.0;\n\n    private static final double GRID_HEIGHT = 200.0;\n\n    private static final double COLUMN_WIDTH = 25.0;\n\n    private static final double HEADER_HEIGHT = 25.0;\n\n    private static final double ROW_HEIGHT = 32.0;\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private Layer layer;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private DivElement element;\n\n    @Mock\n    private Style style;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private Group gridWidgetHeader;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation renderingInformation;\n\n    @Mock\n    private GridColumn<String> uiColumn;\n\n    @Mock\n    private GridRow uiRow;\n\n    @Mock\n    private NodeMouseDownEvent event;\n\n    @Captor\n    private ArgumentCaptor<List<GridColumn<?>>> uiColumnsArgumentCaptor;\n\n    @Captor\n    private ArgumentCaptor<List<GridRow>> uiRowsArgumentCaptor;\n\n    private GridWidgetDnDHandlersState state;\n\n    private GridWidgetDnDMouseDownHandler handler;\n\n    @Before\n    public void setup() {\n        when(gridLayer.getLayer()).thenReturn(layer);\n        when(gridLayer.getViewport()).thenReturn(viewport);\n        when(viewport.getElement()).thenReturn(element);\n        when(element.getStyle()).thenReturn(style);\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getRenderer()).thenReturn(gridRenderer);\n        when(gridWidget.getRendererHelper()).thenReturn(rendererHelper);\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(GRID_X, GRID_Y));\n        when(gridRenderer.getHeaderHeight()).thenReturn(HEADER_HEIGHT);\n\n        final GridWidgetDnDHandlersState wrappedState = new GridWidgetDnDHandlersState();\n        this.state = spy(wrappedState);\n\n        final GridWidgetDnDMouseDownHandler wrapped = new GridWidgetDnDMouseDownHandler(gridLayer,\n                                                                                        state);\n        this.handler = spy(wrapped);\n    }\n\n    @Test\n    public void skipNonActiveGrid() {\n        when(state.getActiveGridWidget()).thenReturn(null);\n\n        handler.onNodeMouseDown(event);\n\n        // This is the only reasonable check that \"nothing\" happened; as the implementation calls\n        // these directly after the check for an \"active grid widget\" has succeeded.\n        verify(event,\n               never()).getX();\n        verify(event,\n               never()).getY();\n    }\n\n    @Test\n    public void stateColumnResizePendingMovesToColumnResize() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING);\n        when(state.getActiveGridColumns()).thenReturn(new ArrayList<GridColumn<?>>() {{\n            add(uiColumn);\n        }});\n\n        handler.onNodeMouseDown(event);\n\n        verify(state,\n               times(1)).setOperation(GridWidgetHandlersOperation.COLUMN_RESIZE);\n    }\n\n    @Test\n    public void stateColumnResizePendingWithNoActiveColumn() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING);\n        when(state.getActiveGridColumns()).thenReturn(Collections.emptyList());\n\n        handler.onNodeMouseDown(event);\n\n        verify(state, never()).setOperation(any(GridWidgetHandlersOperation.class));\n    }\n\n    @Test\n    public void stateColumnMovePendingMovesToColumnMove() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n        when(state.getActiveGridColumns()).thenReturn(new ArrayList<GridColumn<?>>() {{\n            add(uiColumn);\n        }});\n\n        handler.onNodeMouseDown(event);\n\n        verify(handler,\n               times(1)).showColumnHighlight(eq(gridWidget),\n                                             uiColumnsArgumentCaptor.capture());\n        verify(state,\n               times(1)).setOperation(GridWidgetHandlersOperation.COLUMN_MOVE_INITIATED);\n\n        final List<GridColumn<?>> uiColumns = uiColumnsArgumentCaptor.getValue();\n        assertNotNull(uiColumns);\n        assertEquals(1,\n                     uiColumns.size());\n        assertTrue(uiColumns.contains(uiColumn));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void stateColumnMovePendingWithNoActiveColumns() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n        when(state.getActiveGridColumns()).thenReturn(Collections.emptyList());\n\n        handler.onNodeMouseDown(event);\n\n        verify(handler, never()).showColumnHighlight(any(GridWidget.class),\n                                                     any(List.class));\n    }\n\n    @Test\n    public void stateRowMovePendingMovesToRowMove() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING);\n        when(state.getActiveGridRows()).thenReturn(new ArrayList<GridRow>() {{\n            add(uiRow);\n        }});\n\n        handler.onNodeMouseDown(event);\n\n        verify(handler,\n               times(1)).showRowHighlight(eq(gridWidget),\n                                          uiRowsArgumentCaptor.capture());\n        verify(state,\n               times(1)).setOperation(GridWidgetHandlersOperation.ROW_MOVE_INITIATED);\n\n        final List<GridRow> uiRows = uiRowsArgumentCaptor.getValue();\n        assertNotNull(uiRows);\n        assertEquals(1,\n                     uiRows.size());\n        assertTrue(uiRows.contains(uiRow));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void stateRowMovePendingWithNoActiveRows() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING);\n        when(state.getActiveGridRows()).thenReturn(Collections.emptyList());\n\n        handler.onNodeMouseDown(event);\n\n        verify(handler, never()).showRowHighlight(any(GridWidget.class),\n                                                  any(List.class));\n    }\n\n    @Test\n    public void stateGridMovePendingMovesToGridMove() {\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.GRID_MOVE_PENDING);\n\n        handler.onNodeMouseDown(event);\n\n        verify(state,\n               times(1)).setOperation(GridWidgetHandlersOperation.GRID_MOVE);\n        verify(gridWidget,\n               times(1)).setDraggable(eq(true));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testColumnHighlight() {\n        final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class);\n        final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT);\n\n        when(state.getEventColumnHighlight()).thenReturn(highlight);\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n        when(state.getActiveGridColumns()).thenReturn(Collections.singletonList(uiColumn));\n\n        when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation);\n        when(rendererHelper.getRowOffset(anyInt(), any(List.class))).thenCallRealMethod();\n        when(renderingInformation.getBounds()).thenReturn(bounds);\n        when(gridWidget.getHeader()).thenReturn(gridWidgetHeader);\n        when(gridWidget.getHeight()).thenReturn(GRID_HEIGHT);\n        when(uiColumn.getWidth()).thenReturn(COLUMN_WIDTH);\n\n        handler.onNodeMouseDown(event);\n\n        verify(highlight).setWidth(COLUMN_WIDTH);\n        verify(highlight).setHeight(GRID_HEIGHT);\n        verify(highlight).setX(GRID_X);\n        verify(highlight).setY(GRID_Y);\n        verify(layer).batch();\n    }\n\n    @Test\n    public void testRowHighlight() {\n        final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class);\n        final Bounds bounds = new BaseBounds(GRID_X, GRID_Y, GRID_WIDTH, GRID_HEIGHT);\n        final GridData gridData = new BaseGridData();\n        gridData.appendRow(uiRow);\n\n        when(state.getEventColumnHighlight()).thenReturn(highlight);\n        when(state.getActiveGridWidget()).thenReturn(gridWidget);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING);\n        when(state.getActiveGridRows()).thenReturn(Collections.singletonList(uiRow));\n\n        when(rendererHelper.getRenderingInformation()).thenReturn(renderingInformation);\n        when(renderingInformation.getBounds()).thenReturn(bounds);\n        when(renderingInformation.getAllRowHeights()).thenReturn(Collections.singletonList(ROW_HEIGHT));\n        when(gridWidget.getModel()).thenReturn(gridData);\n        when(gridWidget.getHeader()).thenReturn(gridWidgetHeader);\n        when(gridWidget.getWidth()).thenReturn(GRID_WIDTH);\n        when(uiRow.getHeight()).thenReturn(ROW_HEIGHT);\n\n        handler.onNodeMouseDown(event);\n\n        verify(highlight).setWidth(GRID_WIDTH);\n        verify(highlight).setHeight(ROW_HEIGHT);\n        verify(highlight).setX(GRID_X);\n        verify(highlight).setY(GRID_Y + HEADER_HEIGHT);\n        verify(layer).batch();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseMoveHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.event.INodeXYEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.mediator.Mediators;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState.GridWidgetHandlersOperation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridWidgetDnDMouseMoveHandlerTest {\n\n    @Mock\n    private GridLayer layer;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private DivElement element;\n\n    @Mock\n    private Style style;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private GridRenderer renderer;\n\n    @Mock\n    private GridColumnRenderer<String> columnRenderer;\n\n    @Mock\n    private BaseGridRendererHelper helper;\n\n    @Mock\n    private NodeMouseMoveEvent event;\n\n    @Mock\n    private BaseHeaderMetaData header;\n\n    @Captor\n    private ArgumentCaptor<List<GridColumn<?>>> uiColumnsArgumentCaptor;\n\n    @Captor\n    private ArgumentCaptor<List<GridRow>> uiRowsArgumentCaptor;\n\n    private BaseGridData uiModel;\n\n    private BaseGridColumn uiColumn1;\n    private BaseGridColumn<String> uiColumn2;\n\n    private GridWidgetDnDHandlersState state;\n\n    private Mediators mediators;\n\n    private GridWidgetDnDMouseMoveHandler handler;\n\n    private double originalColumnWidth = 200;\n    private double originalRightColumnWidth = 300;\n    private BaseGridColumn<String> column;\n    private BaseGridColumn<String> rightColumn;\n\n    @Before\n    public void setup() {\n        this.uiColumn1 = new RowNumberColumn();\n        this.uiColumn2 = new BaseGridColumn<>(Arrays.asList(new BaseHeaderMetaData(\"title1\"), new BaseHeaderMetaData(\"title2\")),\n                                              columnRenderer,\n                                              100.0);\n        this.uiModel = new BaseGridData();\n        uiModel.appendColumn(uiColumn1);\n        uiModel.appendColumn(uiColumn2);\n        uiModel.appendRow(new BaseGridRow());\n        uiModel.appendRow(new BaseGridRow());\n        uiModel.appendRow(new BaseGridRow());\n\n        this.mediators = new Mediators(viewport);\n\n        when(renderer.getHeaderHeight()).thenReturn(64.0);\n        when(renderer.getHeaderRowHeight()).thenReturn(32.0);\n\n        when(layer.getViewport()).thenReturn(viewport);\n        when(viewport.getElement()).thenReturn(element);\n        when(viewport.getMediators()).thenReturn(mediators);\n        when(element.getStyle()).thenReturn(style);\n        when(gridWidget.getModel()).thenReturn(uiModel);\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getRenderer()).thenReturn(renderer);\n        when(gridWidget.getRendererHelper()).thenReturn(helper);\n        when(gridWidget.getWidth()).thenReturn(150.0);\n        when(gridWidget.getHeight()).thenReturn(124.0);\n\n        final Point2D computedLocation = new Point2D(100.0, 100.0);\n        when(gridWidget.getComputedLocation()).thenReturn(computedLocation);\n\n        final BaseGridRendererHelper.RenderingInformation ri = new BaseGridRendererHelper.RenderingInformation(mock(Bounds.class),\n                                                                                                               uiModel.getColumns(),\n                                                                                                               new BaseGridRendererHelper.RenderingBlockInformation(uiModel.getColumns(),\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    100),\n                                                                                                               new BaseGridRendererHelper.RenderingBlockInformation(Collections.emptyList(),\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    0.0,\n                                                                                                                                                                    0.0),\n                                                                                                               0,\n                                                                                                               2,\n                                                                                                               new ArrayList<Double>() {{\n                                                                                                                   add(20.0);\n                                                                                                                   add(20.0);\n                                                                                                                   add(20.0);\n                                                                                                               }},\n                                                                                                               new ArrayList<Double>() {{\n                                                                                                                   add(20.0);\n                                                                                                                   add(40.0);\n                                                                                                                   add(60.0);\n                                                                                                               }},\n                                                                                                               false,\n                                                                                                               false,\n                                                                                                               2,\n                                                                                                               0,\n                                                                                                               0,\n                                                                                                               0);\n        when(helper.getRenderingInformation()).thenReturn(ri);\n\n        final GridWidgetDnDHandlersState wrappedState = new GridWidgetDnDHandlersState();\n        this.state = spy(wrappedState);\n\n        final GridWidgetDnDMouseMoveHandler wrapped = new GridWidgetDnDMouseMoveHandler(layer,\n                                                                                        state);\n        this.handler = spy(wrapped);\n\n        column = new BaseGridColumn<>(header, columnRenderer, originalColumnWidth);\n        rightColumn = new BaseGridColumn<>(header, columnRenderer, originalRightColumnWidth);\n    }\n\n    @Test\n    public void findGridColumnWithEmptyLayer() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               never()).findMovableColumns(any(GridWidget.class),\n                                           any(BaseGridRendererHelper.RenderingInformation.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class));\n        verify(handler,\n               never()).findMovableRows(any(GridWidget.class),\n                                        any(BaseGridRendererHelper.RenderingInformation.class),\n                                        any(Double.class),\n                                        any(Double.class));\n        verify(handler,\n               never()).findResizableColumn(any(GridWidget.class),\n                                            any(BaseGridRendererHelper.RenderingInformation.class),\n                                            any(Double.class));\n    }\n\n    @Test\n    public void findGridColumnWithInvisibleGridWidgets() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(false);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               never()).findMovableColumns(any(GridWidget.class),\n                                           any(BaseGridRendererHelper.RenderingInformation.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class));\n        verify(handler,\n               never()).findMovableRows(any(GridWidget.class),\n                                        any(BaseGridRendererHelper.RenderingInformation.class),\n                                        any(Double.class),\n                                        any(Double.class));\n        verify(handler,\n               never()).findResizableColumn(any(GridWidget.class),\n                                            any(BaseGridRendererHelper.RenderingInformation.class),\n                                            any(Double.class));\n    }\n\n    @Test\n    public void findMovableGridWhenNoColumnOrRowOperationIsDetected() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is top-left of the GridWidget; not within a column move/resize or row move hot-spot\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(100);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               times(1)).findMovableColumns(any(GridWidget.class),\n                                            any(BaseGridRendererHelper.RenderingInformation.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class));\n        verify(handler,\n               never()).findMovableRows(any(GridWidget.class),\n                                        any(BaseGridRendererHelper.RenderingInformation.class),\n                                        any(Double.class),\n                                        any(Double.class));\n        verify(handler,\n               times(1)).findResizableColumn(any(GridWidget.class),\n                                             any(BaseGridRendererHelper.RenderingInformation.class),\n                                             any(Double.class));\n\n        verify(state,\n               times(1)).setActiveGridWidget(eq(gridWidget));\n        verify(state,\n               times(1)).setOperation(eq(GridWidgetHandlersOperation.GRID_MOVE_PENDING));\n    }\n\n    @Test\n    public void findMovableGridWhenNoColumnOrRowOperationIsDetectedAndGridIsPinned() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n        when(layer.isGridPinned()).thenReturn(true);\n\n        //This location is top-left of the GridWidget; not within a column move/resize or row move hot-spot\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(100);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(state,\n               never()).setActiveGridWidget(any(GridWidget.class));\n        verify(state,\n               times(1)).setOperation(eq(GridWidgetHandlersOperation.NONE));\n    }\n\n    @Test\n    public void findMovableGridWhenOverDragHandleWhenIsPinned() {\n        doFindMovableGridWhenOverDragHandle(true,\n                                            () -> {\n                                                verify(state,\n                                                       never()).setActiveGridWidget(any(GridWidget.class));\n                                                verify(state,\n                                                       never()).setOperation(eq(GridWidgetHandlersOperation.GRID_MOVE_PENDING));\n                                                assertNull(state.getActiveGridWidget());\n                                                assertEquals(GridWidgetHandlersOperation.NONE,\n                                                             state.getOperation());\n                                            });\n    }\n\n    @Test\n    public void findMovableGridWhenOverDragHandleWhenNotPinned() {\n        doFindMovableGridWhenOverDragHandle(false,\n                                            () -> {\n                                                verify(state).setActiveGridWidget(eq(gridWidget));\n                                                verify(state).setOperation(eq(GridWidgetHandlersOperation.GRID_MOVE_PENDING));\n                                                assertEquals(gridWidget,\n                                                             state.getActiveGridWidget());\n                                                assertEquals(GridWidgetHandlersOperation.GRID_MOVE_PENDING,\n                                                             state.getOperation());\n                                            });\n    }\n\n    private void doFindMovableGridWhenOverDragHandle(final boolean isPinned,\n                                                     final Runnable assertion) {\n        state.setOperation(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(gridWidget.onDragHandle(any(INodeXYEvent.class))).thenReturn(true);\n        when(layer.isGridPinned()).thenReturn(isPinned);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is top-left of the GridWidget; not within a column move/resize or row move hot-spot\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(100);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        assertion.run();\n    }\n\n    @Test\n    public void findMovableColumns() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is in the GridWidget's header; within a column move hot-spot, but not within a column resize or row move hot-spot\n        when(event.getX()).thenReturn(160);\n        when(event.getY()).thenReturn(100);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               times(1)).findMovableColumns(any(GridWidget.class),\n                                            any(BaseGridRendererHelper.RenderingInformation.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class));\n        verify(handler,\n               never()).findMovableRows(any(GridWidget.class),\n                                        any(BaseGridRendererHelper.RenderingInformation.class),\n                                        any(Double.class),\n                                        any(Double.class));\n        verify(handler,\n               times(1)).findResizableColumn(any(GridWidget.class),\n                                             any(BaseGridRendererHelper.RenderingInformation.class),\n                                             any(Double.class));\n\n        verify(state,\n               times(1)).setActiveGridWidget(eq(gridWidget));\n        verify(state,\n               times(1)).setOperation(eq(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING));\n        verify(state,\n               times(1)).setActiveGridColumns(uiColumnsArgumentCaptor.capture());\n\n        final List<GridColumn<?>> uiColumns = uiColumnsArgumentCaptor.getValue();\n        assertNotNull(uiColumns);\n        assertEquals(1,\n                     uiColumns.size());\n        assertTrue(uiColumns.contains(uiColumn2));\n    }\n\n    @Test\n    public void findResizableColumnsInHeader() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is in the GridWidget's header; within a column resize hot-spot, but not within a column move.\n        when(event.getX()).thenReturn(246);\n        when(event.getY()).thenReturn(132);\n\n        //Both COLUMN_MOVE_PENDING and COLUMN_RESIZE_PENDING are detected; however COLUMN_RESIZE_PENGING takes precedence.\n        final InOrder inOrder = Mockito.inOrder(state);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               times(1)).findMovableColumns(any(GridWidget.class),\n                                            any(BaseGridRendererHelper.RenderingInformation.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class),\n                                            any(Double.class));\n        inOrder.verify(state,\n                       times(1)).setActiveGridWidget(eq(gridWidget));\n        inOrder.verify(state,\n                       times(1)).setActiveGridColumns(uiColumnsArgumentCaptor.capture());\n        inOrder.verify(state,\n                       times(1)).setOperation(eq(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING));\n\n        verify(handler,\n               never()).findMovableRows(any(GridWidget.class),\n                                        any(BaseGridRendererHelper.RenderingInformation.class),\n                                        any(Double.class),\n                                        any(Double.class));\n\n        verify(handler,\n               times(1)).findResizableColumn(any(GridWidget.class),\n                                             any(BaseGridRendererHelper.RenderingInformation.class),\n                                             any(Double.class));\n        inOrder.verify(state,\n                       times(1)).setActiveGridWidget(eq(gridWidget));\n        inOrder.verify(state,\n                       times(1)).setActiveGridColumns(uiColumnsArgumentCaptor.capture());\n        inOrder.verify(state,\n                       times(1)).setOperation(eq(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING));\n\n        final List<GridColumn<?>> uiColumns = uiColumnsArgumentCaptor.getValue();\n        assertNotNull(uiColumns);\n        assertEquals(1,\n                     uiColumns.size());\n        assertTrue(uiColumns.contains(uiColumn2));\n    }\n\n    @Test\n    public void findResizableColumnsInBody() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is in the GridWidget's body; within a column resize hot-spot, but not within a column move or row move hot-spot\n        when(event.getX()).thenReturn(246);\n        when(event.getY()).thenReturn(180);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               never()).findMovableColumns(any(GridWidget.class),\n                                           any(BaseGridRendererHelper.RenderingInformation.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class));\n        verify(handler,\n               times(1)).findMovableRows(any(GridWidget.class),\n                                         any(BaseGridRendererHelper.RenderingInformation.class),\n                                         any(Double.class),\n                                         any(Double.class));\n        verify(handler,\n               times(1)).findResizableColumn(any(GridWidget.class),\n                                             any(BaseGridRendererHelper.RenderingInformation.class),\n                                             any(Double.class));\n\n        verify(state,\n               times(1)).setActiveGridWidget(eq(gridWidget));\n        verify(state,\n               times(1)).setActiveGridColumns(uiColumnsArgumentCaptor.capture());\n        verify(state,\n               times(1)).setOperation(eq(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING));\n\n        final List<GridColumn<?>> uiColumns = uiColumnsArgumentCaptor.getValue();\n        assertNotNull(uiColumns);\n        assertEquals(1,\n                     uiColumns.size());\n        assertTrue(uiColumns.contains(uiColumn2));\n    }\n\n    @Test\n    public void findMovableRows() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is in the GridWidget's body; within row 1's move hot-spot, but not within a column move or resize hot-spot\n        final int eventX = (int) (gridWidget.getComputedLocation().getX() + uiColumn1.getWidth() / 2);\n        final int eventY = (int) (gridWidget.getComputedLocation().getY() + renderer.getHeaderHeight() + uiModel.getRow(0).getHeight() + uiModel.getRow(1).getHeight() / 2);\n        when(event.getX()).thenReturn(eventX);\n        when(event.getY()).thenReturn(eventY);\n\n        handler.onNodeMouseMove(event);\n\n        verify(handler,\n               times(1)).findGridColumn(eq(event));\n\n        verify(handler,\n               never()).findMovableColumns(any(GridWidget.class),\n                                           any(BaseGridRendererHelper.RenderingInformation.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class),\n                                           any(Double.class));\n        verify(handler,\n               times(1)).findMovableRows(any(GridWidget.class),\n                                         any(BaseGridRendererHelper.RenderingInformation.class),\n                                         any(Double.class),\n                                         any(Double.class));\n        verify(handler,\n               times(1)).findResizableColumn(any(GridWidget.class),\n                                             any(BaseGridRendererHelper.RenderingInformation.class),\n                                             any(Double.class));\n\n        verify(state,\n               times(1)).setActiveGridWidget(eq(gridWidget));\n        verify(state,\n               times(1)).setOperation(eq(GridWidgetHandlersOperation.ROW_MOVE_PENDING));\n        verify(state,\n               times(1)).setActiveGridRows(uiRowsArgumentCaptor.capture());\n\n        final List<GridRow> uiRows = uiRowsArgumentCaptor.getValue();\n        assertNotNull(uiRows);\n        assertEquals(1,\n                     uiRows.size());\n        assertTrue(uiRows.contains(uiModel.getRow(1)));\n    }\n\n    @Test\n    public void handleRowMove() {\n        final List<GridRow> existingRowOrder = new ArrayList<>(uiModel.getRows());\n        final GridWidgetDnDProxy highlight = mock(GridWidgetDnDProxy.class);\n        when(state.getEventColumnHighlight()).thenReturn(highlight);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(layer.getGridWidgets()).thenReturn(Collections.singleton(gridWidget));\n\n        //This location is in the GridWidget's body; within row 0's move hot-spot, but not within a column move or resize hot-spot\n        final int eventX = (int) (gridWidget.getComputedLocation().getX() + uiColumn1.getWidth() / 2);\n        final int eventY = (int) (gridWidget.getComputedLocation().getY() + renderer.getHeaderHeight() + uiModel.getRow(0).getHeight() / 2);\n        when(event.getX()).thenReturn(eventX);\n        when(event.getY()).thenReturn(eventY);\n\n        //Mouse is moved over row and viable rows recorded\n        handler.onNodeMouseMove(event);\n\n        //Emulate row drag starting on a MouseDownEvent (see GridWidgetDnDMouseDownHandler)\n        //This location is in the GridWidget's body; within row 1's move hot-spot\n        final int eventNewY = (int) (gridWidget.getComputedLocation().getY() + renderer.getHeaderHeight() + uiModel.getRow(0).getHeight() + uiModel.getRow(1).getHeight() / 2);\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE);\n        when(event.getY()).thenReturn(eventNewY);\n\n        handler.onNodeMouseMove(event);\n\n        verify(highlight).setY(gridWidget.getComputedLocation().getY() + renderer.getHeaderHeight());\n        verify(layer).batch();\n\n        assertEquals(existingRowOrder.get(0), uiModel.getRow(1));\n        assertEquals(existingRowOrder.get(1), uiModel.getRow(0));\n        assertEquals(existingRowOrder.get(2), uiModel.getRow(2));\n    }\n\n    @Test\n    public void adjustColumnWidth() {\n        double proposedNewWidth = 100;\n        uiModel.setVisibleSizeAndRefresh(10, 0);\n        assertEquals(proposedNewWidth, handler.adjustColumnWidth(proposedNewWidth, column, gridWidget), 0.1);\n\n        uiModel.setVisibleSizeAndRefresh(1000, 0);\n        proposedNewWidth = 300;\n        assertEquals(proposedNewWidth, handler.adjustColumnWidth(proposedNewWidth, column, gridWidget), 0.1);\n\n        proposedNewWidth = 50;\n        uiColumn2.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        int visibleWidth = gridWidget.getModel().getVisibleWidth();\n        double adjustedWidth = handler.adjustColumnWidth(proposedNewWidth, uiColumn2, gridWidget);\n\n        double widthWithoutColumn = gridWidget.getModel()\n                .getColumns().stream()\n                .filter(col -> !col.equals(uiColumn2))\n                .mapToDouble(GridColumn::getWidth)\n                .sum();\n\n        assertEquals(visibleWidth - widthWithoutColumn, adjustedWidth, 0.1);\n\n        column.setColumnWidthMode(GridColumn.ColumnWidthMode.FIXED);\n        uiModel.appendColumn(column);\n        uiModel.appendColumn(rightColumn);\n        rightColumn.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        assertEquals(proposedNewWidth, handler.adjustColumnWidth(proposedNewWidth, column, gridWidget), 0.1);\n        double columnDelta = column.getWidth() - proposedNewWidth;\n        double widthWithoutRightColumn = gridWidget.getWidth() - originalRightColumnWidth;\n        double newRightColumnWidth = visibleWidth - widthWithoutRightColumn + columnDelta;\n        assertEquals(newRightColumnWidth, rightColumn.getWidth(), 0.1);\n    }\n\n    @Test\n    public void getFirstRightAutoColumn() {\n        assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent());\n\n        uiModel.appendColumn(column);\n        assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent());\n\n        uiModel.appendColumn(rightColumn);\n        assertFalse(handler.getFirstRightAutoColumn(column, uiModel).isPresent());\n\n        rightColumn.setColumnWidthMode(GridColumn.ColumnWidthMode.AUTO);\n        assertEquals(rightColumn, handler.getFirstRightAutoColumn(column, uiModel).get());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dnd/GridWidgetDnDMouseUpHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.dnd;\n\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState.GridWidgetHandlersOperation;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridWidgetDnDMouseUpHandlerTest {\n\n    @Mock\n    private GridLayer layer;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private DivElement element;\n\n    @Mock\n    private Style style;\n\n    @Mock\n    private NodeMouseUpEvent event;\n\n    private GridWidgetDnDHandlersState state;\n\n    private GridWidgetDnDMouseUpHandler handler;\n\n    @Before\n    public void setup() {\n        when(layer.getViewport()).thenReturn(viewport);\n        when(viewport.getElement()).thenReturn(element);\n        when(element.getStyle()).thenReturn(style);\n\n        final GridWidgetDnDHandlersState wrappedState = new GridWidgetDnDHandlersState();\n        this.state = spy(wrappedState);\n\n        final GridWidgetDnDMouseUpHandler wrapped = new GridWidgetDnDMouseUpHandler(layer,\n                                                                                    state);\n        this.handler = spy(wrapped);\n\n        doAnswer(i -> {\n            ((Command) i.getArguments()[0]).execute();\n            return null;\n        }).when(handler).scheduleDeferred(any(Command.class));\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsNone() {\n        state.setOperation(GridWidgetHandlersOperation.NONE);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsColumnMovePending() {\n        state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsColumnResizePending() {\n        state.setOperation(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsColumnResize() {\n        state.setOperation(GridWidgetHandlersOperation.COLUMN_RESIZE);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsColumnMove() {\n        state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n        verify(layer,\n               times(1)).remove(any(IPrimitive.class));\n        verify(layer,\n               times(1)).batch();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsRowMove() {\n        state.setOperation(GridWidgetHandlersOperation.ROW_MOVE);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n        verify(layer,\n               times(1)).remove(any(IPrimitive.class));\n        verify(layer,\n               times(1)).batch();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsColumnMoveInitiated() {\n        state.setOperation(GridWidgetHandlersOperation.COLUMN_MOVE_INITIATED);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n        verify(layer,\n               times(1)).remove(any(IPrimitive.class));\n        verify(layer,\n               times(1)).batch();\n    }\n\n    @Test\n    public void stateIsResetOnMouseUpWhenStateIsRowMoveInitiated() {\n        state.setOperation(GridWidgetHandlersOperation.ROW_MOVE_INITIATED);\n\n        handler.onNodeMouseUp(event);\n\n        verify(state,\n               times(1)).reset();\n        verify(layer,\n               times(1)).remove(any(IPrimitive.class));\n        verify(layer,\n               times(1)).batch();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/BaseSingletonDOMElementFactoryTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.DomEvent;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.shared.EventHandler;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.BaseDOMElement;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard.KeyDownHandlerCommon;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\npublic abstract class BaseSingletonDOMElementFactoryTest {\n\n    @Mock\n    protected GridLienzoPanel gridLienzoPanelMock;\n\n    @Mock\n    protected GridLayer gridLayerMock;\n\n    @Mock\n    protected GridWidget gridWidgetMock;\n\n    private BaseSingletonDOMElementFactory testedFactory;\n\n    @Captor\n    private ArgumentCaptor<EventHandler> handlerCaptor;\n\n    public abstract BaseSingletonDOMElementFactory getTestedFactory();\n\n    @Before\n    public void setUp() throws Exception {\n        testedFactory = getTestedFactory();\n    }\n\n    @Test\n    public void testRegisterHandlers() {\n        testedFactory.createDomElement(gridLayerMock, gridWidgetMock);\n        testedFactory.registerHandlers(testedFactory.widget, testedFactory.e);\n\n        verify(testedFactory.widget, times(4)).addDomHandler(handlerCaptor.capture(), any(DomEvent.Type.class));\n\n        // KeyDownHandlerCommon\n        Assertions.assertThat(handlerCaptor.getAllValues().get(0)).isInstanceOf(KeyDownHandlerCommon.class);\n\n        // KeyDownHandler - stopPropagation\n        final KeyDownEvent keyDownEventMock = mock(KeyDownEvent.class);\n        Assertions.assertThat(handlerCaptor.getAllValues().get(1)).isInstanceOf(KeyDownHandler.class);\n        ((KeyDownHandler) handlerCaptor.getAllValues().get(1)).onKeyDown(keyDownEventMock);\n        verify(keyDownEventMock).stopPropagation();\n\n        // MouseDownHandler - stopPropagation\n        final MouseDownEvent mouseDownEventMock = mock(MouseDownEvent.class);\n        Assertions.assertThat(handlerCaptor.getAllValues().get(2)).isInstanceOf(MouseDownHandler.class);\n        ((MouseDownHandler) handlerCaptor.getAllValues().get(2)).onMouseDown(mouseDownEventMock);\n        verify(mouseDownEventMock).stopPropagation();\n\n        // BlurHandler\n        final BaseDOMElement domElement = testedFactory.e;\n        final BlurEvent blurEventMock = mock(BlurEvent.class);\n        Assertions.assertThat(handlerCaptor.getAllValues().get(3)).isInstanceOf(BlurHandler.class);\n        ((BlurHandler) handlerCaptor.getAllValues().get(3)).onBlur(blurEventMock);\n        Assertions.assertThat(testedFactory.widget).isNull();\n        Assertions.assertThat(testedFactory.e).isNull();\n        verify(domElement).detach();\n        verify(gridLayerMock).batch();\n        verify(gridLienzoPanelMock).setFocus(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/ListBoxSingletonDOMElementFactoryTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.ListBox;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.ListBoxDOMElement;\n\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(ListBoxDOMElement.class)\npublic class ListBoxSingletonDOMElementFactoryTest extends BaseSingletonDOMElementFactoryTest {\n\n    public static final String VALUE = \"val\";\n\n    @Mock\n    private ListBoxDOMElement domElementMock;\n\n    @Mock\n    private ListBox listBoxMock;\n\n    @Override\n    public BaseSingletonDOMElementFactory getTestedFactory() {\n        final ListBoxSingletonDOMElementFactory factory = spy(new ListBoxSingletonDOMElementFactory(gridLienzoPanelMock,\n                                                                                                    gridLayerMock,\n                                                                                                    gridWidgetMock));\n\n        when(listBoxMock.getValue(anyInt())).thenReturn(VALUE);\n\n        doReturn(listBoxMock).when(factory).createWidget();\n        doReturn(domElementMock).when(factory).createDomElementInternal(listBoxMock, gridLayerMock, gridWidgetMock);\n\n        return factory;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/dom/single/impl/TextBoxSingletonDOMElementFactoryTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.dom.single.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.impl.TextBoxDOMElement;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(TextBoxDOMElement.class)\npublic class TextBoxSingletonDOMElementFactoryTest extends BaseSingletonDOMElementFactoryTest {\n\n    public static final String VALUE = \"val\";\n\n    @Mock\n    private TextBoxDOMElement domElementMock;\n\n    @Mock\n    private TextBox textBoxMock;\n\n    @Override\n    public BaseSingletonDOMElementFactory getTestedFactory() {\n        final TextBoxSingletonDOMElementFactory factory = spy(new TextBoxSingletonDOMElementFactory(gridLienzoPanelMock,\n                                                                                                    gridLayerMock,\n                                                                                                    gridWidgetMock));\n        when(textBoxMock.getValue()).thenReturn(VALUE);\n\n        doReturn(textBoxMock).when(factory).createWidget();\n        doReturn(domElementMock).when(factory).createDomElementInternal(textBoxMock, gridLayerMock, gridWidgetMock);\n\n        return factory;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/NodeMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState.GridWidgetHandlersOperation;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class NodeMouseEventHandlerTest {\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private DefaultGridLayer gridLayer;\n\n    @Mock\n    private GridWidgetDnDHandlersState state;\n\n    @Mock\n    private Point2D relativeLocation;\n\n    @Mock\n    private AbstractNodeMouseEvent event;\n\n    private NodeMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        this.handler = (final GridWidget gridWidget,\n                        final Point2D relativeLocation,\n                        final Optional<Integer> uiHeaderRowIndex,\n                        final Optional<Integer> uiHeaderColumnIndex,\n                        final Optional<Integer> uiRowIndex,\n                        final Optional<Integer> uiColumnIndex,\n                        final AbstractNodeMouseEvent event) -> false;\n        when(gridWidget.getLayer()).thenReturn(gridLayer);\n        when(gridLayer.getGridWidgetHandlersState()).thenReturn(state);\n    }\n\n    @Test\n    public void testHandleHeaderCell() {\n        assertFalse(handler.handleHeaderCell(gridWidget, relativeLocation, 0, 0, event));\n    }\n\n    @Test\n    public void testHandleBodyCell() {\n        assertFalse(handler.handleBodyCell(gridWidget, relativeLocation, 0, 0, event));\n    }\n\n    @Test\n    public void testIsDNDOperationInProgress() {\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.NONE);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_RESIZE_PENDING);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_RESIZE);\n        assertTrue(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_PENDING);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE_INITIATED);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.COLUMN_MOVE);\n        assertTrue(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_PENDING);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE_INITIATED);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.ROW_MOVE);\n        assertTrue(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.GRID_MOVE_PENDING);\n        assertFalse(handler.isDNDOperationInProgress(gridWidget));\n\n        when(state.getOperation()).thenReturn(GridWidgetHandlersOperation.GRID_MOVE);\n        assertTrue(handler.isDNDOperationInProgress(gridWidget));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/GridWidgetEnterPinnedModeAnimationTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GridWidgetEnterPinnedModeAnimationTest {\n\n    @Mock\n    private Layer layer;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private Command onStartCommand;\n\n    @Mock\n    private GridWidget widget;\n\n    @Mock\n    private IPrimitive<?> primitive;\n\n    @Mock\n    private Command command;\n\n    @Test\n    public void testOnClose() {\n\n        doReturn(layer).when(gridWidget).getLayer();\n\n        final Set<GridWidget> gridWidgets = new HashSet<GridWidget>() {{\n            add(widget);\n        }};\n        final Set<IPrimitive<?>> gridWidgetConnectors = new HashSet<IPrimitive<?>>() {{\n            add(primitive);\n        }};\n        final List<Command> onEnterPinnedModeCommands = new ArrayList<Command>() {{\n            add(command);\n        }};\n        final GridWidgetEnterPinnedModeAnimation animation = new GridWidgetEnterPinnedModeAnimation(gridWidget,\n                                                                                                    gridWidgets,\n                                                                                                    gridWidgetConnectors,\n                                                                                                    onStartCommand,\n                                                                                                    onEnterPinnedModeCommands);\n\n        animation.doClose();\n\n        verify(widget).setVisible(false);\n        verify(primitive).setVisible(false);\n        verify(layer).setListening(true);\n        verify(layer).batch();\n        verify(command).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/animation/GridWidgetExitPinnedModeAnimationTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.animation;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GridWidgetExitPinnedModeAnimationTest {\n\n    @Mock\n    private Layer layer;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private GridPinnedModeManager.PinnedContext state;\n\n    @Mock\n    private Command onCompleteCommand;\n\n    @Mock\n    private Command command;\n\n    @Test\n    public void testOnClose() {\n\n        doReturn(layer).when(gridWidget).getLayer();\n        doReturn(gridWidget).when(state).getGridWidget();\n\n        final Set<GridWidget> gridWidgets = new HashSet<>();\n        final Set<IPrimitive<?>> gridWidgetConnectors = new HashSet<>();\n        final List<Command> onExitPinnedModeCommands = new ArrayList<Command>() {{\n            add(command);\n        }};\n        final GridWidgetExitPinnedModeAnimation animation = new GridWidgetExitPinnedModeAnimation(state,\n                                                                                                  gridWidgets,\n                                                                                                  gridWidgetConnectors,\n                                                                                                  onCompleteCommand,\n                                                                                                  onExitPinnedModeCommands);\n\n        animation.doClose();\n\n        verify(layer).setListening(true);\n        verify(layer).batch();\n        verify(onCompleteCommand).execute();\n        verify(command).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/columns/BooleanDOMElementColumnTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.columns;\n\nimport java.util.function.Consumer;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.CheckBoxDOMElementFactory;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BooleanDOMElementColumnTest {\n\n    @Mock\n    private GridColumn.HeaderMetaData headerMetaData;\n\n    @Mock\n    private CheckBoxDOMElementFactory factory;\n\n    @Mock\n    private GridBodyCellRenderContext context;\n\n    @Mock\n    private Consumer<GridCellValue<Boolean>> callback;\n\n    @Captor\n    private ArgumentCaptor<BaseGridCellValue<Boolean>> callbackArgumentCaptor;\n\n    private BooleanDOMElementColumn column;\n\n    @Before\n    public void setup() {\n        this.column = new BooleanDOMElementColumn(headerMetaData,\n                                                  factory,\n                                                  100);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void editTrueToFalse() {\n        final GridCell<Boolean> cell = new BaseGridCell<>(new BaseGridCellValue<>(true));\n        column.edit(cell,\n                    context,\n                    callback);\n\n        verify(callback,\n               times(1)).accept(callbackArgumentCaptor.capture());\n\n        final BaseGridCellValue<Boolean> callbackArgument = callbackArgumentCaptor.getValue();\n        assertFalse(callbackArgument.getValue());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void editFalseToTrue() {\n        final GridCell<Boolean> cell = new BaseGridCell<>(new BaseGridCellValue<>(false));\n        column.edit(cell,\n                    context,\n                    callback);\n\n        verify(callback,\n               times(1)).accept(callbackArgumentCaptor.capture());\n\n        final BaseGridCellValue<Boolean> callbackArgument = callbackArgumentCaptor.getValue();\n        assertTrue(callbackArgument.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetKeyboardHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.StringDOMElementColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.StringDOMElementSingletonColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl.BaseCellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridWidgetKeyboardHandlerTest {\n\n    @Mock\n    private DefaultGridLayer layer;\n\n    @Mock\n    private KeyDownEvent event;\n\n    @Mock\n    private GridWidget gridWidget1;\n\n    @Mock\n    private GridWidget gridWidget2;\n\n    @Mock\n    private GridRenderer gridWidget1Renderer;\n\n    @Mock\n    private BaseGridRendererHelper gridWidget1RendererHelper;\n\n    @Mock\n    private GridLienzoPanel gridPanel;\n\n    private GridData gridWidget1Data;\n\n    private Bounds visibleBounds = new BaseBounds(-1000,\n                                                  -1000,\n                                                  2000,\n                                                  2000);\n\n    private Set<GridWidget> gridWidgets = new HashSet<>();\n\n    private BaseCellSelectionManager cellSelectionManager;\n\n    private KeyboardOperation keyboardOperationClearCell;\n    private KeyboardOperation keyboardOperationEditCell;\n    private KeyboardOperation keyboardOperationMoveLeft;\n    private KeyboardOperation keyboardOperationMoveRight;\n    private KeyboardOperation keyboardOperationMoveUp;\n    private KeyboardOperation keyboardOperationMoveDown;\n    private KeyboardOperation keyboardOperationSelectTopLeftCell;\n    private KeyboardOperation keyboardOperationSelectBottomRightCell;\n\n    private BaseGridWidgetKeyboardHandler handler;\n\n    @Before\n    public void setup() {\n        gridWidgets.add(gridWidget1);\n        gridWidgets.add(gridWidget2);\n\n        gridWidget1Data = new BaseGridData();\n        gridWidget1Data.appendRow(new BaseGridRow());\n        gridWidget1Data.appendRow(new BaseGridRow());\n        gridWidget1Data.appendColumn(new BaseGridTest.MockMergableGridColumn<>(\"col1\",\n                                                                               100));\n        gridWidget1Data.appendColumn(new BaseGridTest.MockMergableGridColumn<>(\"col2\",\n                                                                               100));\n\n        when(gridWidget1.getModel()).thenReturn(gridWidget1Data);\n        when(gridWidget1.getRenderer()).thenReturn(gridWidget1Renderer);\n        when(gridWidget1.getRendererHelper()).thenReturn(gridWidget1RendererHelper);\n        when(gridWidget1.adjustSelection(any(SelectionExtension.class),\n                                         any(Boolean.class))).thenAnswer((InvocationOnMock invocation) -> {\n            final SelectionExtension direction = (SelectionExtension) invocation.getArguments()[0];\n            final boolean isShiftKeyDown = (Boolean) invocation.getArguments()[1];\n            return cellSelectionManager.adjustSelection(direction,\n                                                        isShiftKeyDown);\n        });\n        when(gridWidget1Renderer.getHeaderHeight()).thenReturn(32.0);\n        when(layer.getVisibleBounds()).thenReturn(visibleBounds);\n        when(event.isLeftArrow()).thenCallRealMethod();\n        when(event.isRightArrow()).thenCallRealMethod();\n        when(event.isUpArrow()).thenCallRealMethod();\n        when(event.isDownArrow()).thenCallRealMethod();\n\n        cellSelectionManager = new BaseCellSelectionManager(gridWidget1);\n\n        final BaseGridWidgetKeyboardHandler wrapped = new BaseGridWidgetKeyboardHandler(layer);\n        handler = spy(wrapped);\n        setupKeyboardOperations();\n    }\n\n    @Test\n    public void testDestroyResourcesOnKeyDown() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT);\n\n        final StringDOMElementColumn columnWithAdditionalDomElements = mock(StringDOMElementColumn.class);\n        gridWidget1Data.appendColumn(columnWithAdditionalDomElements);\n\n        handler.onKeyDown(event);\n\n        verify(columnWithAdditionalDomElements).destroyResources();\n    }\n\n    @Test\n    public void testDestroyResourcesAndFlushOnKeyDown() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT);\n\n        final StringDOMElementSingletonColumn columnWithAdditionalDomElements = mock(StringDOMElementSingletonColumn.class);\n        gridWidget1Data.appendColumn(columnWithAdditionalDomElements);\n\n        handler.onKeyDown(event);\n\n        verify(columnWithAdditionalDomElements).flush();\n        verify(columnWithAdditionalDomElements).destroyResources();\n    }\n\n    @Test\n    public void noSelectedDecisionTable() {\n        handler.onKeyDown(event);\n\n        verifyNoOperationsInvoked();\n    }\n\n    @Test\n    public void unhandledKeysInvokeNoAction() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_A);\n\n        handler.onKeyDown(event);\n\n        verifyNoOperationsInvoked();\n    }\n\n    private void verifyNoOperationsInvoked() {\n        verify(keyboardOperationClearCell,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationEditCell,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationMoveLeft,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationMoveRight,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationMoveUp,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationMoveDown,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationSelectTopLeftCell,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n        verify(keyboardOperationSelectBottomRightCell,\n               never()).perform(any(GridWidget.class),\n                                any(Boolean.class),\n                                any(Boolean.class));\n    }\n\n    @Test\n    public void deleteKeyClearsCells() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_DELETE);\n\n        gridWidget1Data.setCellValue(0,\n                                     0,\n                                     new BaseGridCellValue<>(\"hello\"));\n        assertEquals(\"hello\",\n                     gridWidget1Data.getCell(0,\n                                             0).getValue().getValue());\n\n        gridWidget1Data.selectCell(0,\n                                   0);\n\n        handler.onKeyDown(event);\n\n        verify(keyboardOperationClearCell,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n        assertNull(gridWidget1Data.getCell(0,\n                                           0));\n        verify(layer,\n               times(1)).draw();\n    }\n\n    @Test\n    public void enterKeyEditsCells() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_ENTER);\n\n        gridWidget1Data.selectCell(0,\n                                   0);\n\n        handler.onKeyDown(event);\n\n        verify(gridWidget1,\n               times(1)).startEditingCell(eq(0),\n                                          eq(0));\n        verify(layer,\n               never()).draw();\n        verify(keyboardOperationEditCell,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n    }\n\n    @Test\n    public void homeKeyMovesToTopLeft() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_HOME);\n\n        handler.onKeyDown(event);\n\n        verify(gridWidget1,\n               times(1)).selectCell(eq(0),\n                                    eq(0),\n                                    eq(false),\n                                    eq(false));\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationSelectTopLeftCell,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n    }\n\n    @Test\n    public void endKeyMovesToBottomRight() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(1),\n                                    eq(1),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_END);\n\n        handler.onKeyDown(event);\n\n        verify(gridWidget1,\n               times(1)).selectCell(eq(1),\n                                    eq(1),\n                                    eq(false),\n                                    eq(false));\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationSelectBottomRightCell,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n    }\n\n    @Test\n    public void leftCursorWithoutShiftKeyMovesLeftOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_LEFT);\n\n        gridWidget1.getModel().selectCell(0,\n                                          1);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveLeft,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n    }\n\n    @Test\n    public void leftCursorWithShiftKeyExtendsRangeLeftOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_LEFT);\n        when(event.isShiftKeyDown()).thenReturn(true);\n\n        gridWidget1.getModel().selectCell(0,\n                                          1);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveLeft,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(true),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(1,\n                     selectedCells.get(0).getColumnIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getColumnIndex());\n    }\n\n    @Test\n    public void rightCursorWithoutShiftKeyMovesRightOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(1),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT);\n\n        gridWidget1.getModel().selectCell(0,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveRight,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(1,\n                     selectedCells.get(0).getColumnIndex());\n    }\n\n    @Test\n    public void rightCursorWithShiftKeyExtendsRangeRightOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(1),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_RIGHT);\n        when(event.isShiftKeyDown()).thenReturn(true);\n\n        gridWidget1.getModel().selectCell(0,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveRight,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(true),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getRowIndex());\n        assertEquals(1,\n                     selectedCells.get(1).getColumnIndex());\n    }\n\n    @Test\n    public void upCursorWithoutShiftKeyMovesUpOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_UP);\n\n        gridWidget1.getModel().selectCell(1,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveUp,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n    }\n\n    @Test\n    public void upCursorWithShiftKeyExtendsRangeUpOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(0),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_UP);\n        when(event.isShiftKeyDown()).thenReturn(true);\n\n        gridWidget1.getModel().selectCell(1,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveUp,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(true),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertEquals(1,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getColumnIndex());\n    }\n\n    @Test\n    public void downCursorWithoutShiftKeyMovesDownOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(1),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_DOWN);\n\n        gridWidget1.getModel().selectCell(0,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveDown,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(false),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(1,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n    }\n\n    @Test\n    public void downCursorWithShiftKeyExtendsRangeDownOneCell() {\n        when(layer.getGridWidgets()).thenReturn(gridWidgets);\n        when(gridWidget1.isSelected()).thenReturn(true);\n        when(gridWidget1.selectCell(eq(1),\n                                    eq(0),\n                                    any(Boolean.class),\n                                    any(Boolean.class))).thenReturn(true);\n        when(event.getNativeKeyCode()).thenReturn(KeyCodes.KEY_DOWN);\n        when(event.isShiftKeyDown()).thenReturn(true);\n\n        gridWidget1.getModel().selectCell(0,\n                                          0);\n\n        handler.onKeyDown(event);\n\n        verify(layer,\n               times(1)).draw();\n        verify(keyboardOperationMoveDown,\n               times(1)).perform(eq(gridWidget1),\n                                 eq(true),\n                                 eq(false));\n        final List<GridData.SelectedCell> selectedCells = gridWidget1Data.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n        assertEquals(1,\n                     selectedCells.get(1).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(1).getColumnIndex());\n    }\n\n    private void setupKeyboardOperations() {\n        this.keyboardOperationClearCell = spy(new KeyboardOperationClearCell(layer));\n        this.keyboardOperationEditCell = spy(new KeyboardOperationEditCell(layer));\n        this.keyboardOperationMoveLeft = spy(new KeyboardOperationMoveLeft(layer, gridPanel));\n        this.keyboardOperationMoveRight = spy(new KeyboardOperationMoveRight(layer, gridPanel));\n        this.keyboardOperationMoveUp = spy(new KeyboardOperationMoveUp(layer, gridPanel));\n        this.keyboardOperationMoveDown = spy(new KeyboardOperationMoveDown(layer, gridPanel));\n        this.keyboardOperationSelectTopLeftCell = spy(new KeyboardOperationSelectTopLeftCell(layer));\n        this.keyboardOperationSelectBottomRightCell = spy(new KeyboardOperationSelectBottomRightCell(layer));\n\n        handler.addOperation(keyboardOperationClearCell,\n                             keyboardOperationEditCell,\n                             keyboardOperationMoveLeft,\n                             keyboardOperationMoveRight,\n                             keyboardOperationMoveUp,\n                             keyboardOperationMoveDown,\n                             keyboardOperationSelectTopLeftCell,\n                             keyboardOperationSelectBottomRightCell);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetMouseClickHandlerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseClickEvent;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic abstract class BaseGridWidgetMouseClickHandlerTest {\n\n    @Mock\n    protected Viewport viewport;\n\n    @Mock\n    protected DefaultGridLayer layer;\n\n    @Mock\n    protected GridSelectionManager selectionManager;\n\n    @Mock\n    protected GridData uiModel;\n\n    @Mock\n    protected GridWidget gridWidget;\n\n    @Mock\n    protected GridRenderer renderer;\n\n    @Mock\n    protected NodeMouseClickEvent event;\n\n    @Mock\n    protected BaseGridRendererHelper helper;\n\n    @Mock\n    protected GridColumn<String> uiColumn;\n\n    @Mock\n    protected GridColumn<String> uiLinkedColumn;\n\n    @Mock\n    protected Point2D relativeLocation;\n\n    @Mock\n    private NodeMouseEventHandler eventHandler;\n\n    @Mock\n    private GridWidgetDnDHandlersState state;\n\n    private BaseGridWidgetMouseClickHandler mouseClickHandler;\n\n    @Before\n    public void setup() {\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getModel()).thenReturn(uiModel);\n        when(gridWidget.getRendererHelper()).thenReturn(helper);\n        when(gridWidget.getLayer()).thenReturn(layer);\n        when(gridWidget.getRenderer()).thenReturn(renderer);\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0.0, 0.0));\n        when(renderer.getHeaderHeight()).thenReturn(64.0);\n        when(renderer.getHeaderRowHeight()).thenReturn(32.0);\n        when(uiModel.getHeaderRowCount()).thenReturn(2);\n\n        when(state.getOperation()).thenReturn(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.NONE);\n        when(layer.getGridWidgetHandlersState()).thenReturn(state);\n\n        final BaseGridRendererHelper.RenderingInformation ri = BaseGridWidgetRenderingTestUtils.makeRenderingInformation(uiModel, Collections.emptyList());\n        when(helper.getRenderingInformation()).thenReturn(ri);\n\n        final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn, 0, 0);\n        when(helper.getColumnInformation(anyDouble())).thenReturn(ci);\n\n        this.mouseClickHandler = new BaseGridWidgetMouseClickHandler(gridWidget, Collections.singletonList(eventHandler));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void visibleGrid() {\n        when(gridWidget.isVisible()).thenReturn(true);\n\n        mouseClickHandler.onNodeMouseClick(event);\n\n        verify(eventHandler).onNodeMouseEvent(eq(gridWidget),\n                                              any(Point2D.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              eq(event));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void skipInvisibleGrid() {\n        when(gridWidget.isVisible()).thenReturn(false);\n\n        mouseClickHandler.onNodeMouseClick(event);\n\n        verify(eventHandler,\n               never()).onNodeMouseEvent(any(GridWidget.class),\n                                         any(Point2D.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(AbstractNodeMouseEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetMouseDoubleClickHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.event.AbstractNodeMouseEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.event.dom.client.DoubleClickEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.dnd.GridWidgetDnDHandlersState;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic abstract class BaseGridWidgetMouseDoubleClickHandlerTest {\n\n    @Mock\n    protected Group header;\n\n    @Mock\n    protected Viewport viewport;\n\n    @Mock\n    protected DefaultGridLayer layer;\n\n    @Mock\n    protected GridData uiModel;\n\n    @Mock\n    protected GridWidget gridWidget;\n\n    @Mock\n    protected GridRenderer renderer;\n\n    @Mock\n    protected DoubleClickEvent doubleClickEvent;\n\n    @Mock\n    protected BaseGridRendererHelper helper;\n\n    @Mock\n    protected GridColumn<String> uiColumn;\n\n    @Mock\n    protected Point2D relativeLocation;\n\n    @Mock\n    private NodeMouseEventHandler eventHandler;\n\n    @Mock\n    private GridWidgetDnDHandlersState state;\n\n    protected NodeMouseDoubleClickEvent event;\n\n    private BaseGridWidgetMouseDoubleClickHandler mouseDoubleClickHandler;\n\n    @Before\n    public void setup() {\n        this.event = new NodeMouseDoubleClickEvent(doubleClickEvent);\n\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getModel()).thenReturn(uiModel);\n        when(gridWidget.getRenderer()).thenReturn(renderer);\n        when(gridWidget.getRendererHelper()).thenReturn(helper);\n        when(gridWidget.getLayer()).thenReturn(layer);\n        when(gridWidget.getHeader()).thenReturn(header);\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0.0, 0.0));\n        when(renderer.getHeaderHeight()).thenReturn(64.0);\n        when(renderer.getHeaderRowHeight()).thenReturn(32.0);\n        when(uiModel.getHeaderRowCount()).thenReturn(2);\n        when(uiModel.getColumnCount()).thenReturn(1);\n        when(uiModel.getColumns()).thenReturn(new ArrayList<GridColumn<?>>() {{\n            add(uiColumn);\n        }});\n\n        when(state.getOperation()).thenReturn(GridWidgetDnDHandlersState.GridWidgetHandlersOperation.NONE);\n        when(layer.getGridWidgetHandlersState()).thenReturn(state);\n\n        final BaseGridRendererHelper.RenderingInformation ri = BaseGridWidgetRenderingTestUtils.makeRenderingInformation(uiModel, Collections.emptyList());\n        when(helper.getRenderingInformation()).thenReturn(ri);\n\n        final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn, 0, 0);\n        when(helper.getColumnInformation(anyDouble())).thenReturn(ci);\n\n        this.mouseDoubleClickHandler = new BaseGridWidgetMouseDoubleClickHandler(gridWidget, Collections.singletonList(eventHandler));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void visibleGrid() {\n        when(gridWidget.isVisible()).thenReturn(true);\n\n        mouseDoubleClickHandler.onNodeMouseDoubleClick(event);\n\n        verify(eventHandler).onNodeMouseEvent(eq(gridWidget),\n                                              any(Point2D.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              any(Optional.class),\n                                              eq(event));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void skipInvisibleGrid() {\n        when(gridWidget.isVisible()).thenReturn(false);\n\n        mouseDoubleClickHandler.onNodeMouseDoubleClick(event);\n\n        verify(eventHandler,\n               never()).onNodeMouseEvent(any(GridWidget.class),\n                                         any(Point2D.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(Optional.class),\n                                         any(AbstractNodeMouseEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetRenderingTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport com.ait.lienzo.client.core.Context2D;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Node;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.BoundingBox;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.multiple.impl.CheckBoxDOMElementFactory;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.BooleanDOMElementColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.SelectedRange;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.makeRenderingInformation;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridWidgetRenderingTest {\n\n    private static final double HEADER_Y_OFFSET = 32.0;\n\n    private static final double ROW_HEIGHT = 20.0;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Transform transform;\n\n    @Mock\n    private DefaultGridLayer gridLayer;\n\n    @Mock\n    private GridSelectionManager selectionManager;\n\n    @Mock\n    private CellSelectionManager cellSelectionManager;\n\n    @Mock\n    private GridPinnedModeManager pinnedModeManager;\n\n    @Mock\n    private GridRenderer renderer;\n\n    @Mock\n    private BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    private Group header;\n\n    @Mock\n    private Group body;\n\n    @Mock\n    private Group selections;\n\n    @Mock\n    private Group selector;\n\n    @Mock\n    private Group boundary;\n\n    private BaseGridWidget gridWidget;\n\n    private GridData model;\n\n    @Before\n    public void setup() {\n        this.model = new BaseGridData();\n        final BaseGridWidget wrapped = new BaseGridWidget(model,\n                                                          selectionManager,\n                                                          pinnedModeManager,\n                                                          renderer) {\n            @Override\n            public CellSelectionManager getCellSelectionManager() {\n                return BaseGridWidgetRenderingTest.this.cellSelectionManager;\n            }\n\n            @Override\n            protected BaseGridRendererHelper getBaseGridRendererHelper() {\n                return BaseGridWidgetRenderingTest.this.rendererHelper;\n            }\n        };\n        gridWidget = spy(wrapped);\n\n        mockCanvas();\n        mockHeader();\n        mockBody();\n        mockSelections();\n        mockSelector();\n        mockBoundary();\n    }\n\n    private void mockCanvas() {\n        when(gridWidget.getLayer()).thenReturn(gridLayer);\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(viewport.getTransform()).thenReturn(transform);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockHeader() {\n        when(header.asNode()).thenReturn(mock(Node.class));\n        when(renderer.renderHeader(any(GridData.class),\n                                   any(GridHeaderRenderContext.class),\n                                   eq(rendererHelper),\n                                   any(BaseGridRendererHelper.RenderingInformation.class))).thenReturn(Collections.singletonList((rc) -> rc.getGroup().add(header)));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockBody() {\n        when(body.asNode()).thenReturn(mock(Node.class));\n        when(renderer.renderBody(any(GridData.class),\n                                 any(GridBodyRenderContext.class),\n                                 eq(rendererHelper),\n                                 any(BaseGridRendererHelper.RenderingInformation.class))).thenReturn(Collections.singletonList((rc) -> rc.getGroup().add(body)));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockSelections() {\n        when(selections.asNode()).thenReturn(mock(Node.class));\n        when(renderer.renderSelectedCells(any(GridData.class),\n                                          any(GridBodyRenderContext.class),\n                                          eq(rendererHelper),\n                                          any(List.class),\n                                          any(BiFunction.class),\n                                          any(Function.class))).thenReturn((rc) -> rc.getGroup().add(selections));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockSelector() {\n        when(selector.asNode()).thenReturn(mock(Node.class));\n        when(renderer.renderSelector(anyDouble(),\n                                     anyDouble(),\n                                     any(BaseGridRendererHelper.RenderingInformation.class))).thenReturn((rc) -> rc.getGroup().add(selector));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockBoundary() {\n        when(boundary.asNode()).thenReturn(mock(Node.class));\n        when(renderer.renderGridBoundary(any(GridBoundaryRenderContext.class))).thenReturn((rc) -> rc.getGroup().add(boundary));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void mockGridRendering(final double expectedHeaderYOffset,\n                                   final double headerHeight,\n                                   final int numberOfRows) {\n        final List<Double> rowOffsets = new ArrayList<>();\n        for (int i = 0; i < numberOfRows; i++) {\n            rowOffsets.add(i * ROW_HEIGHT);\n            model.appendRow(new BaseGridRow(ROW_HEIGHT));\n            when(rendererHelper.getRowOffset(i)).thenReturn(rowOffsets.get(i));\n        }\n\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        rowOffsets,\n                                                                                        BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT + expectedHeaderYOffset);\n        when(rendererHelper.getRenderingInformation()).thenReturn(ri);\n        when(renderer.getHeaderHeight()).thenReturn(headerHeight);\n\n        final GridColumn<String> column = new BaseGridColumn<>(Arrays.asList(new BaseHeaderMetaData(\"row1\"), new BaseHeaderMetaData(\"row2\")),\n                                                               mock(GridColumnRenderer.class),\n                                                               100.0);\n        model.appendColumn(column);\n\n        final Context2D context2D = mock(Context2D.class);\n        final BoundingBox boundingBox = mock(BoundingBox.class);\n\n        gridWidget.drawWithTransforms(context2D,\n                                      1.0,\n                                      boundingBox);\n    }\n\n    @Test\n    public void renderingWithDOMElementColumnsAndRows() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Collections.singletonList(0d));\n        when(rendererHelper.getRenderingInformation()).thenReturn(ri);\n\n        final BooleanDOMElementColumn column = spy(new BooleanDOMElementColumn(new BaseHeaderMetaData(\"col1\"),\n                                                                               new CheckBoxDOMElementFactory(gridLayer,\n                                                                                                             gridWidget),\n                                                                               100.0));\n\n        model.appendColumn(column);\n        model.appendRow(new BaseGridRow(HEADER_ROW_HEIGHT));\n\n        final Context2D context2D = mock(Context2D.class);\n        final BoundingBox boundingBox = mock(BoundingBox.class);\n\n        gridWidget.drawWithTransforms(context2D,\n                                      1.0,\n                                      boundingBox);\n\n        verify(column,\n               times(1)).initialiseResources();\n        verify(column,\n               times(1)).freeUnusedResources();\n        verify(gridWidget,\n               times(1)).drawHeader(eq(ri));\n        verify(gridWidget,\n               times(1)).drawBody(eq(ri));\n    }\n\n    @Test\n    public void renderingWithDOMElementColumnsAndWithoutRows() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Collections.emptyList());\n        when(rendererHelper.getRenderingInformation()).thenReturn(ri);\n\n        final BooleanDOMElementColumn column = spy(new BooleanDOMElementColumn(new BaseHeaderMetaData(\"col1\"),\n                                                                               new CheckBoxDOMElementFactory(gridLayer,\n                                                                                                             gridWidget),\n                                                                               100.0));\n\n        model.appendColumn(column);\n\n        final Context2D context2D = mock(Context2D.class);\n        final BoundingBox boundingBox = mock(BoundingBox.class);\n\n        gridWidget.drawWithTransforms(context2D,\n                                      1.0,\n                                      boundingBox);\n\n        verify(column,\n               times(1)).initialiseResources();\n        verify(column,\n               times(1)).freeUnusedResources();\n        verify(gridWidget,\n               times(1)).drawHeader(eq(ri));\n        verify(gridWidget,\n               never()).drawBody(any(BaseGridRendererHelper.RenderingInformation.class));\n    }\n\n    @Test\n    public void testHeaderSelectionYOffsetStrategyWhenHeaderHeightIsEqualToRowsHeight() {\n        assertHeaderSelectionYOffsetStrategy(0.0);\n    }\n\n    @Test\n    public void testHeaderSelectionYOffsetStrategyWhenHeaderHeightIsGreaterThanRowsHeight() {\n        assertHeaderSelectionYOffsetStrategy(HEADER_Y_OFFSET);\n    }\n\n    @Test\n    public void testHeaderSelectionHeightStrategySingleSelectionNoYOffset() {\n        mockGridRendering(0.0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getHeaderSelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0);\n\n        assertEquals(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testHeaderSelectionHeightStrategyMultipleSelectionsNoYOffset() {\n        mockGridRendering(0.0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getHeaderSelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0, 1, 2);\n\n        assertEquals(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT * 2,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testHeaderSelectionHeightStrategySingleSelectionWithYOffset() {\n        mockGridRendering(HEADER_Y_OFFSET, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getHeaderSelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0);\n\n        assertEquals(((BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT * 2) - HEADER_Y_OFFSET) / BaseGridWidgetRenderingTestUtils.HEADER_ROW_COUNT,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testHeaderSelectionHeightStrategyMultipleSelectionsWithYOffset() {\n        mockGridRendering(HEADER_Y_OFFSET, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getHeaderSelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0, 1, 2);\n\n        assertEquals((BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT * 2) - HEADER_Y_OFFSET,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testBodySelectionYOffsetStrategyRow0() {\n        assertBodySelectionYOffsetStrategy(new SelectedRange(0, 0), 0);\n    }\n\n    @Test\n    public void testBodySelectionYOffsetStrategyRow1() {\n        assertBodySelectionYOffsetStrategy(new SelectedRange(1, 0), ROW_HEIGHT);\n    }\n\n    @Test\n    public void testBodySelectionHeightStrategySingleSelection() {\n        mockGridRendering(0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 2);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getBodySelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0);\n\n        assertEquals(ROW_HEIGHT,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testBodySelectionHeightStrategyMultipleSelections() {\n        mockGridRendering(0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 2);\n\n        final Function<SelectedRange, Double> strategy = gridWidget.getBodySelectionHeightStrategy();\n        final SelectedRange selectedRange = new SelectedRange(0, 0, 1, 2);\n\n        assertEquals(ROW_HEIGHT * 2,\n                     strategy.apply(selectedRange),\n                     0.0);\n    }\n\n    @Test\n    public void testSelection() {\n        gridWidget.select();\n\n        assertTrue(gridWidget.isSelected());\n\n        verify(gridWidget, never()).add(any(IPrimitive.class));\n\n        mockGridRendering(0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        verify(renderer).renderSelector(anyDouble(),\n                                        anyDouble(),\n                                        any(BaseGridRendererHelper.RenderingInformation.class));\n    }\n\n    @Test\n    public void testDeselection() {\n        gridWidget.deselect();\n\n        assertFalse(gridWidget.isSelected());\n\n        verify(gridWidget, never()).remove(any(IPrimitive.class));\n\n        mockGridRendering(0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        verify(renderer, never()).renderSelector(anyDouble(),\n                                                 anyDouble(),\n                                                 any(BaseGridRendererHelper.RenderingInformation.class));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void assertHeaderSelectionYOffsetStrategy(final double expectedHeaderYOffset) {\n        mockGridRendering(expectedHeaderYOffset, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 0);\n\n        final BiFunction<SelectedRange, Integer, Double> strategy = gridWidget.getHeaderSelectionYOffsetStrategy();\n        final SelectedRange selectedRange = new SelectedRange(1, 0);\n\n        assertEquals(expectedHeaderYOffset,\n                     strategy.apply(selectedRange, 1),\n                     0.0);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void assertBodySelectionYOffsetStrategy(final SelectedRange selectedRange,\n                                                    final double expectedRowYOffset) {\n        mockGridRendering(0, BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT, 2);\n\n        final BiFunction<SelectedRange, Integer, Double> strategy = gridWidget.getBodySelectionYOffsetStrategy();\n\n        assertEquals(expectedRowYOffset,\n                     strategy.apply(selectedRange, 0),\n                     0.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetRenderingTestUtils.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation;\n\nimport static org.mockito.Mockito.mock;\n\npublic class BaseGridWidgetRenderingTestUtils {\n\n    public static final int HEADER_ROW_COUNT = 2;\n\n    public static final double HEADER_ROW_HEIGHT = 20.0;\n\n    public static final double HEADER_HEIGHT = HEADER_ROW_HEIGHT * HEADER_ROW_COUNT;\n\n    public static RenderingInformation makeRenderingInformation(final GridData model) {\n        return makeRenderingInformation(model,\n                                        Collections.emptyList(),\n                                        0,\n                                        0.0,\n                                        0.0);\n    }\n\n    public static RenderingInformation makeRenderingInformation(final GridData model,\n                                                                final List<Double> rowOffsets) {\n        return makeRenderingInformation(model,\n                                        rowOffsets,\n                                        HEADER_HEIGHT);\n    }\n\n    public static RenderingInformation makeRenderingInformation(final GridData model,\n                                                                final List<Double> rowOffsets,\n                                                                final double headerHeight) {\n        return makeRenderingInformation(model,\n                                        rowOffsets,\n                                        HEADER_ROW_COUNT,\n                                        HEADER_ROW_HEIGHT,\n                                        headerHeight);\n    }\n\n    public static RenderingInformation makeRenderingInformation(final GridData model,\n                                                                final List<Double> rowOffsets,\n                                                                final int headerRowCount,\n                                                                final double headerRowHeight,\n                                                                final double headerRowsHeight) {\n        final List<Double> rowHeights = new ArrayList<>();\n        for (int rowIndex = 0; rowIndex < rowOffsets.size(); rowIndex++) {\n            rowHeights.add(20.0);\n        }\n        return new RenderingInformation(mock(Bounds.class),\n                                        model.getColumns(),\n                                        new BaseGridRendererHelper.RenderingBlockInformation(model.getColumns(),\n                                                                                             0.0,\n                                                                                             0.0,\n                                                                                             0.0,\n                                                                                             100),\n                                        new BaseGridRendererHelper.RenderingBlockInformation(Collections.emptyList(),\n                                                                                             0.0,\n                                                                                             0.0,\n                                                                                             0.0,\n                                                                                             0.0),\n                                        0,\n                                        rowOffsets.size() - 1,\n                                        rowHeights,\n                                        rowOffsets,\n                                        false,\n                                        false,\n                                        headerRowCount,\n                                        headerRowHeight,\n                                        headerRowsHeight,\n                                        headerRowsHeight - (headerRowCount * headerRowHeight));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseGridWidgetTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.NodeMouseEventHandler;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridWidgetTest {\n\n    private BaseGridWidget gridWidget;\n\n    private GridData model;\n\n    @Mock\n    private GridSelectionManager selectionManager;\n\n    @Mock\n    private CellSelectionManager cellSelectionManager;\n\n    @Mock\n    private GridPinnedModeManager pinnedModeManager;\n\n    @Mock\n    private GridRenderer renderer;\n\n    @Before\n    public void setup() {\n        this.model = new BaseGridData();\n        final BaseGridWidget wrapped = new BaseGridWidget(model,\n                                                          selectionManager,\n                                                          pinnedModeManager,\n                                                          renderer) {\n            @Override\n            public CellSelectionManager getCellSelectionManager() {\n                return cellSelectionManager;\n            }\n        };\n        gridWidget = spy(wrapped);\n    }\n\n    @Test\n    public void selectCellMouseClick() {\n        final Point2D cp = new Point2D(10,\n                                       20);\n        gridWidget.selectCell(cp,\n                              true,\n                              false);\n\n        final ArgumentCaptor<Point2D> pointArgumentCaptor = ArgumentCaptor.forClass(Point2D.class);\n\n        verify(cellSelectionManager,\n               times(1)).selectCell(pointArgumentCaptor.capture(),\n                                    eq(true),\n                                    eq(false));\n        final Point2D point = pointArgumentCaptor.getValue();\n        assertEquals(cp,\n                     point);\n    }\n\n    @Test\n    public void selectCellKeyboardNavigation() {\n        gridWidget.selectCell(0,\n                              1,\n                              true,\n                              false);\n        verify(cellSelectionManager,\n               times(1)).selectCell(eq(0),\n                                    eq(1),\n                                    eq(true),\n                                    eq(false));\n    }\n\n    @Test\n    public void adjustSelection() {\n        gridWidget.adjustSelection(SelectionExtension.LEFT,\n                                   false);\n\n        verify(cellSelectionManager,\n               times(1)).adjustSelection(eq(SelectionExtension.LEFT),\n                                         eq(false));\n    }\n\n    @Test\n    public void startEditingCellMouseClick() {\n        final Point2D rp = new Point2D(10,\n                                       20);\n\n        gridWidget.startEditingCell(rp);\n\n        final ArgumentCaptor<Point2D> pointArgumentCaptor = ArgumentCaptor.forClass(Point2D.class);\n\n        verify(cellSelectionManager,\n               times(1)).startEditingCell(pointArgumentCaptor.capture());\n        final Point2D point = pointArgumentCaptor.getValue();\n        assertEquals(rp,\n                     point);\n    }\n\n    @Test\n    public void startEditingCellKeyboardNavigation() {\n        gridWidget.startEditingCell(0,\n                                    1);\n\n        verify(cellSelectionManager,\n               times(1)).startEditingCell(eq(0),\n                                          eq(1));\n    }\n\n    @Test\n    public void testDefaultNodeMouseClickHandlers() {\n        final List<NodeMouseEventHandler> handlers = gridWidget.getNodeMouseClickEventHandlers(selectionManager);\n\n        assertThat(handlers).hasSize(3);\n        assertThat(handlers.get(0)).isInstanceOf(DefaultGridWidgetCellSelectorMouseEventHandler.class);\n        assertThat(handlers.get(1)).isInstanceOf(DefaultGridWidgetCollapsedCellMouseEventHandler.class);\n        assertThat(handlers.get(2)).isInstanceOf(DefaultGridWidgetLinkedColumnMouseEventHandler.class);\n    }\n\n    @Test\n    public void testDefaultNodeMouseDoubleClickHandlers() {\n        final List<NodeMouseEventHandler> handlers = gridWidget.getNodeMouseDoubleClickEventHandlers(selectionManager,\n                                                                                                     pinnedModeManager);\n\n        assertThat(handlers).hasSize(2);\n        assertThat(handlers.get(0)).isInstanceOf(DefaultGridWidgetEditCellMouseEventHandler.class);\n        assertThat(handlers.get(1)).isInstanceOf(DefaultGridWidgetPinnedModeMouseEventHandler.class);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/BaseKeyboardOperationTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingBlockInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static com.google.gwt.event.dom.client.KeyCodes.KEY_LEFT;\nimport static com.google.gwt.event.dom.client.KeyCodes.KEY_RIGHT;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseKeyboardOperationTest {\n\n    private static final double BOUNDS_WIDTH = 1000.0;\n    private static final double BOUNDS_HEIGHT = 1000.0;\n\n    @Mock\n    private DefaultGridLayer layer;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private GridData gridData;\n\n    @Mock\n    private GridColumn gridColumn;\n\n    @Mock\n    private GridRow gridRow;\n\n    @Mock\n    private BaseGridRendererHelper baseGridRendererHelperMock;\n\n    @Mock\n    private RenderingInformation baseGridRendererInformationMock;\n\n    @Mock\n    private RenderingBlockInformation baseGridRendererBlockInformationMock;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private Viewport viewport;\n\n    private Transform transform;\n\n    private BaseKeyboardOperation baseKeyboardOperationSpy;\n    private int currentKeyCode = 0;\n\n    @Before\n    public void setup() {\n        when(gridWidget.getModel()).thenReturn(gridData);\n        when(gridWidget.getRendererHelper()).thenReturn(baseGridRendererHelperMock);\n        when(baseGridRendererHelperMock.getRenderingInformation()).thenReturn(baseGridRendererInformationMock);\n        when(baseGridRendererInformationMock.getFloatingBlockInformation()).thenReturn(baseGridRendererBlockInformationMock);\n        when(baseGridRendererBlockInformationMock.getColumns()).thenReturn(Collections.emptyList());\n        when(gridData.getColumns()).thenReturn(Collections.singletonList(gridColumn));\n        when(gridColumn.getIndex()).thenReturn(0);\n        when(gridWidget.getRenderer()).thenReturn(gridRenderer);\n        when(layer.getViewport()).thenReturn(viewport);\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        transform = spy(new Transform());\n        when(viewport.getTransform()).thenReturn(transform);\n\n        baseKeyboardOperationSpy = spy(new BaseKeyboardOperation(layer) {\n            @Override\n            public int getKeyCode() {\n                return currentKeyCode;\n            }\n\n            @Override\n            public boolean perform(GridWidget gridWidget, boolean isShiftKeyDown, boolean isControlKeyDown) {\n                return false;\n            }\n        });\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_NoSelection() {\n        assertFalse(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_NoRenderedInformation() {\n        List<GridData.SelectedCell> selectedCells = Arrays.asList(new GridData.SelectedCell(0, 0));\n        when(gridData.getSelectedHeaderCells()).thenReturn(selectedCells);\n        when(baseGridRendererHelperMock.getRenderingInformation()).thenReturn(null);\n        assertFalse(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_HeaderSelected() {\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 0)));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, never()).getViewport();\n        verify(viewport, never()).getTransform();\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_CellSelected() {\n        when(gridData.getSelectedCellsOrigin()).thenReturn(new GridData.SelectedCell(0, 0));\n        when(gridData.getRow(0)).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(30d);\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, never()).getViewport();\n        verify(viewport, never()).getTransform();\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_HeaderSelected_WithDeltaXScroll() {\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 0)));\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(600, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(600, 0);\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_CellSelected_WithDeltaXScroll() {\n        when(gridData.getSelectedCellsOrigin()).thenReturn(new GridData.SelectedCell(0, 0));\n        when(gridData.getRow(0)).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(30d);\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(500, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(500d, 0);\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_HeaderSelected_WithDeltaYScroll() {\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 0)));\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(0, 250, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(0, 250);\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_CellSelected_WithDeltaYScroll() {\n        when(gridData.getSelectedCellsOrigin()).thenReturn(new GridData.SelectedCell(0, 0));\n        when(gridData.getRow(0)).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(30d);\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(0, 400, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(0, 400);\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_HeaderSelected_WithDeltaXYScroll() {\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 0)));\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(50, 75, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(50, 75);\n    }\n\n    @Test\n    public void scrollSelectedCellIntoView_CellSelected_WithDeltaXYScroll() {\n        when(gridData.getSelectedCellsOrigin()).thenReturn(new GridData.SelectedCell(0, 0));\n        when(gridData.getRow(0)).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(30d);\n        when(layer.getVisibleBounds()).thenReturn(new BaseBounds(75, 100, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        assertTrue(baseKeyboardOperationSpy.scrollSelectedCellIntoView(gridWidget));\n        verify(layer, times(1)).getViewport();\n        verify(viewport, times(1)).getTransform();\n        verify(transform, times(1)).scale(1, 1);\n        verify(transform, times(1)).translate(75, 100);\n    }\n\n    @Test\n    public void getSelectedCellOrigin_NotHeaderCell() {\n        when(gridData.getSelectedCellsOrigin()).thenReturn(new GridData.SelectedCell(0, 0));\n        baseKeyboardOperationSpy.getSelectedCellOrigin(gridData, false);\n        verify(gridData, times(1)).getSelectedCellsOrigin();\n        verify(gridData, never()).getSelectedHeaderCells();\n    }\n\n    @Test\n    public void getSelectedCellOrigin_SingleHeaderCell_KeyRight() {\n        currentKeyCode = KEY_RIGHT;\n        GridData.SelectedCell headerCell = new GridData.SelectedCell(0, 0);\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(headerCell));\n        assertEquals(headerCell, baseKeyboardOperationSpy.getSelectedCellOrigin(gridData, true));\n        verify(gridData, times(1)).getSelectedHeaderCells();\n        verify(gridData, never()).getSelectedCellsOrigin();\n    }\n\n    @Test\n    public void getSelectedCellOrigin_SingleHeaderCell_KeyLeft() {\n        currentKeyCode = KEY_LEFT;\n        GridData.SelectedCell headerCell = new GridData.SelectedCell(0, 0);\n        when(gridData.getSelectedHeaderCells()).thenReturn(Collections.singletonList(headerCell));\n        assertEquals(headerCell, baseKeyboardOperationSpy.getSelectedCellOrigin(gridData, true));\n        verify(gridData, times(1)).getSelectedHeaderCells();\n        verify(gridData, never()).getSelectedCellsOrigin();\n    }\n\n    @Test\n    public void getSelectedCellOrigin_MultipleHeaderCell_KeyRight() {\n        currentKeyCode = KEY_RIGHT;\n        GridData.SelectedCell headerCell = new GridData.SelectedCell(0, 0);\n        GridData.SelectedCell headerCell2 = new GridData.SelectedCell(0, 1);\n        when(gridData.getSelectedHeaderCells()).thenReturn(Arrays.asList(headerCell, headerCell2));\n        assertEquals(headerCell2, baseKeyboardOperationSpy.getSelectedCellOrigin(gridData, true));\n        verify(gridData, times(1)).getSelectedHeaderCells();\n        verify(gridData, never()).getSelectedCellsOrigin();\n    }\n\n    @Test\n    public void getSelectedCellOrigin_MultipleHeaderCell_KeyLeft() {\n        currentKeyCode = KEY_LEFT;\n        GridData.SelectedCell headerCell = new GridData.SelectedCell(0, 0);\n        GridData.SelectedCell headerCell2 = new GridData.SelectedCell(0, 1);\n        when(gridData.getSelectedHeaderCells()).thenReturn(Arrays.asList(headerCell, headerCell2));\n        assertEquals(headerCell, baseKeyboardOperationSpy.getSelectedCellOrigin(gridData, true));\n        verify(gridData, times(1)).getSelectedHeaderCells();\n        verify(gridData, never()).getSelectedCellsOrigin();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetCellSelectorMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridWidgetCellSelectorMouseEventHandlerTest extends BaseGridWidgetMouseClickHandlerTest {\n\n    private DefaultGridWidgetCellSelectorMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        final DefaultGridWidgetCellSelectorMouseEventHandler wrapped = new DefaultGridWidgetCellSelectorMouseEventHandler(selectionManager);\n        handler = spy(wrapped);\n    }\n\n    @Test\n    public void checkHeaderSelectionDelegation() {\n        when(gridWidget.selectHeaderCell(eq(relativeLocation), anyBoolean(), anyBoolean())).thenReturn(true);\n        when(gridWidget.isSelected()).thenReturn(false);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(200);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.of(0),\n                                 Optional.of(1),\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 event);\n\n        verify(handler,\n               times(1)).handleHeaderCell(eq(gridWidget),\n                                          eq(relativeLocation),\n                                          eq(0),\n                                          eq(1),\n                                          eq(event));\n        verify(gridWidget,\n               times(1)).selectHeaderCell(eq(relativeLocation),\n                                          eq(false),\n                                          eq(false));\n        verify(layer).batch();\n        verify(selectionManager).select(eq(gridWidget));\n    }\n\n    @Test\n    public void checkBodySelectionDelegation() {\n        when(gridWidget.selectCell(eq(relativeLocation), anyBoolean(), anyBoolean())).thenReturn(true);\n        when(gridWidget.isSelected()).thenReturn(false);\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(200);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 Optional.of(0),\n                                 Optional.of(1),\n                                 event);\n\n        verify(handler,\n               times(1)).handleBodyCell(eq(gridWidget),\n                                        eq(relativeLocation),\n                                        eq(0),\n                                        eq(1),\n                                        eq(event));\n        verify(gridWidget,\n               times(1)).selectCell(eq(relativeLocation),\n                                    eq(false),\n                                    eq(false));\n        verify(layer).batch();\n        verify(selectionManager).select(eq(gridWidget));\n    }\n\n    @Test\n    public void checkOnNodeMouseEventDuringDragOperation() {\n        doReturn(true).when(handler).isDNDOperationInProgress(eq(gridWidget));\n\n        assertFalse(handler.onNodeMouseEvent(gridWidget,\n                                             relativeLocation,\n                                             Optional.empty(),\n                                             Optional.empty(),\n                                             Optional.of(0),\n                                             Optional.of(1),\n                                             event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetCollapsedCellMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridWidgetCollapsedCellMouseEventHandlerTest extends BaseGridWidgetMouseClickHandlerTest {\n\n    @Mock\n    private GridCell gridCell;\n\n    @Mock\n    private GridCell nextGridCell;\n\n    @Mock\n    private GridRow gridRow;\n\n    @Mock\n    private GridColumn gridColumn;\n\n    private DefaultGridWidgetCollapsedCellMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        final DefaultGridWidgetCollapsedCellMouseEventHandler wrapped = new DefaultGridWidgetCollapsedCellMouseEventHandler(renderer);\n        handler = spy(wrapped);\n\n        doNothing().when(handler).collapseRows(any(GridWidget.class),\n                                               anyInt(),\n                                               anyInt(),\n                                               anyInt());\n        doNothing().when(handler).expandRows(any(GridWidget.class),\n                                             anyInt(),\n                                             anyInt(),\n                                             anyInt());\n    }\n\n    @Test\n    public void testNullCell() {\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(0),\n                                            event)).isFalse();\n\n        verify(handler, never()).collapseRows(any(GridWidget.class),\n                                              anyInt(),\n                                              anyInt(),\n                                              anyInt());\n        verify(handler, never()).expandRows(any(GridWidget.class),\n                                            anyInt(),\n                                            anyInt(),\n                                            anyInt());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testNonMergedCell() {\n        when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell);\n        when(gridCell.getMergedCellCount()).thenReturn(1);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(0),\n                                            event)).isFalse();\n\n        verify(handler, never()).collapseRows(any(GridWidget.class),\n                                              anyInt(),\n                                              anyInt(),\n                                              anyInt());\n        verify(handler, never()).expandRows(any(GridWidget.class),\n                                            anyInt(),\n                                            anyInt(),\n                                            anyInt());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMergedCellNotOnHotSpot() {\n        when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell);\n        when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell);\n        when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn));\n        when(uiModel.getRow(eq(0))).thenReturn(gridRow);\n        when(gridCell.getMergedCellCount()).thenReturn(2);\n        when(nextGridCell.isCollapsed()).thenReturn(false);\n        when(gridWidget.onGroupingToggle(anyDouble(),\n                                         anyDouble(),\n                                         anyDouble(),\n                                         anyDouble())).thenReturn(false);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(0),\n                                            event)).isFalse();\n\n        verify(handler, never()).collapseRows(any(GridWidget.class),\n                                              anyInt(),\n                                              anyInt(),\n                                              anyInt());\n        verify(handler, never()).expandRows(any(GridWidget.class),\n                                            anyInt(),\n                                            anyInt(),\n                                            anyInt());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMergedCellCollapseOnHotSpot() {\n        when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell);\n        when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell);\n        when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn));\n        when(uiModel.getRow(eq(0))).thenReturn(gridRow);\n        when(gridCell.getMergedCellCount()).thenReturn(2);\n        when(nextGridCell.isCollapsed()).thenReturn(false);\n        when(gridWidget.onGroupingToggle(anyDouble(),\n                                         anyDouble(),\n                                         anyDouble(),\n                                         anyDouble())).thenReturn(true);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(0),\n                                            event)).isTrue();\n\n        verify(handler).collapseRows(eq(gridWidget),\n                                     eq(0),\n                                     eq(0),\n                                     eq(2));\n        verify(handler, never()).expandRows(any(GridWidget.class),\n                                            anyInt(),\n                                            anyInt(),\n                                            anyInt());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMergedCellExpandOnHotSpot() {\n        when(uiModel.getCell(eq(0), eq(0))).thenReturn(gridCell);\n        when(uiModel.getCell(eq(1), eq(0))).thenReturn(nextGridCell);\n        when(uiModel.getColumns()).thenReturn(Collections.singletonList(gridColumn));\n        when(uiModel.getRow(eq(0))).thenReturn(gridRow);\n        when(gridCell.getMergedCellCount()).thenReturn(2);\n        when(nextGridCell.isCollapsed()).thenReturn(true);\n        when(gridWidget.onGroupingToggle(anyDouble(),\n                                         anyDouble(),\n                                         anyDouble(),\n                                         anyDouble())).thenReturn(true);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(0),\n                                            event)).isTrue();\n\n        verify(handler, never()).collapseRows(any(GridWidget.class),\n                                              anyInt(),\n                                              anyInt(),\n                                              anyInt());\n        verify(handler).expandRows(eq(gridWidget),\n                                   eq(0),\n                                   eq(0),\n                                   eq(2));\n    }\n\n    @Test\n    public void checkOnNodeMouseEventDuringDragOperation() {\n        doReturn(true).when(handler).isDNDOperationInProgress(eq(gridWidget));\n\n        assertFalse(handler.onNodeMouseEvent(gridWidget,\n                                             relativeLocation,\n                                             Optional.empty(),\n                                             Optional.empty(),\n                                             Optional.of(0),\n                                             Optional.of(1),\n                                             event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetEditCellMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellEditAction;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridWidgetEditCellMouseEventHandlerTest extends BaseGridWidgetMouseDoubleClickHandlerTest {\n\n    @Mock\n    private GridCell gridCell;\n\n    private DefaultGridWidgetEditCellMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        final DefaultGridWidgetEditCellMouseEventHandler wrapped = new DefaultGridWidgetEditCellMouseEventHandler();\n        handler = spy(wrapped);\n    }\n\n    @Test\n    public void testEditHeaderCell() {\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.of(0),\n                                            Optional.of(1),\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            event)).isFalse();\n\n        verify(uiModel, never()).selectHeaderCell(anyInt(), anyInt());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testEditBodyCellWithASelectedCell() {\n        when(uiModel.getSelectedCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 1)));\n        when(uiModel.getCell(eq(0), eq(1))).thenReturn(gridCell);\n        when(gridCell.getSupportedEditAction()).thenReturn(GridCellEditAction.DOUBLE_CLICK);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(1),\n                                            event)).isFalse();\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget).startEditingCell(eq(relativeLocation));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testEditBodyCellWithANullSelectedCell() {\n        when(uiModel.getSelectedCells()).thenReturn(Collections.singletonList(new GridData.SelectedCell(0, 1)));\n        when(uiModel.getCell(eq(0), eq(1))).thenReturn(null);\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(1),\n                                            event)).isFalse();\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget).startEditingCell(eq(relativeLocation));\n    }\n\n    @Test\n    public void testEditBodyCellWithMultipleSelectedCells() {\n        when(uiModel.getSelectedCells()).thenReturn(Arrays.asList(new GridData.SelectedCell(0, 0),\n                                                                  new GridData.SelectedCell(0, 1)));\n\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(1),\n                                            event)).isFalse();\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget, never()).startEditingCell(any(Point2D.class));\n    }\n\n    @Test\n    public void testEditBodyCellWithoutASelectedCell() {\n        assertThat(handler.onNodeMouseEvent(gridWidget,\n                                            relativeLocation,\n                                            Optional.empty(),\n                                            Optional.empty(),\n                                            Optional.of(0),\n                                            Optional.of(1),\n                                            event)).isFalse();\n\n        verify(gridWidget, never()).startEditingCell(anyInt(), anyInt());\n        verify(gridWidget, never()).startEditingCell(any(Point2D.class));\n    }\n\n    @Test\n    public void checkOnNodeMouseEventDuringDragOperation() {\n        doReturn(true).when(handler).isDNDOperationInProgress(eq(gridWidget));\n\n        assertFalse(handler.onNodeMouseEvent(gridWidget,\n                                             relativeLocation,\n                                             Optional.empty(),\n                                             Optional.empty(),\n                                             Optional.of(0),\n                                             Optional.of(1),\n                                             event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetLinkedColumnMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridWidgetLinkedColumnMouseEventHandlerTest extends BaseGridWidgetMouseClickHandlerTest {\n\n    private DefaultGridWidgetLinkedColumnMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        final DefaultGridWidgetLinkedColumnMouseEventHandler wrapped = new DefaultGridWidgetLinkedColumnMouseEventHandler(selectionManager, renderer);\n        handler = spy(wrapped);\n    }\n\n    @Test\n    public void selectVisibleGridHeaderNonLinkedColumn() {\n        when(gridWidget.isVisible()).thenReturn(true);\n\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(100);\n\n        when(gridWidget.getLocation()).thenReturn(new Point2D(100,\n                                                              100));\n        when(uiColumn.isLinked()).thenReturn(false);\n\n        final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,\n                                                                                                         0,\n                                                                                                         0);\n        when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.of(0),\n                                 Optional.of(0),\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 event);\n\n        verify(handler,\n               times(1)).handleHeaderCell(eq(gridWidget),\n                                          eq(relativeLocation),\n                                          eq(0),\n                                          eq(0),\n                                          eq(event));\n        verify(selectionManager,\n               never()).select(any(GridWidget.class));\n        verify(selectionManager,\n               never()).selectLinkedColumn(eq(uiColumn));\n    }\n\n    @Test\n    public void selectVisibleGridHeaderLinkedColumn() {\n        when(gridWidget.isVisible()).thenReturn(true);\n\n        when(event.getX()).thenReturn(100);\n        when(event.getY()).thenReturn(100);\n\n        final Point2D computedLocation = new Point2D(100.0, 100.0);\n        when(gridWidget.getComputedLocation()).thenReturn(computedLocation);\n        when(uiColumn.isLinked()).thenReturn(true);\n        when(uiColumn.getLink()).thenAnswer(invocation -> uiLinkedColumn);\n\n        final BaseGridRendererHelper.ColumnInformation ci = new BaseGridRendererHelper.ColumnInformation(uiColumn,\n                                                                                                         0,\n                                                                                                         0);\n        when(helper.getColumnInformation(any(Double.class))).thenReturn(ci);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.of(0),\n                                 Optional.of(0),\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 event);\n\n        verify(handler,\n               times(1)).handleHeaderCell(eq(gridWidget),\n                                          eq(relativeLocation),\n                                          eq(0),\n                                          eq(0),\n                                          eq(event));\n        verify(selectionManager,\n               never()).select(any(GridWidget.class));\n        verify(selectionManager,\n               times(1)).selectLinkedColumn(eq(uiLinkedColumn));\n    }\n\n    @Test\n    public void checkOnNodeMouseEventDuringDragOperation() {\n        doReturn(true).when(handler).isDNDOperationInProgress(eq(gridWidget));\n\n        assertFalse(handler.onNodeMouseEvent(gridWidget,\n                                             relativeLocation,\n                                             Optional.empty(),\n                                             Optional.empty(),\n                                             Optional.of(0),\n                                             Optional.of(1),\n                                             event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/DefaultGridWidgetPinnedModeMouseEventHandlerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridWidgetPinnedModeMouseEventHandlerTest extends BaseGridWidgetMouseDoubleClickHandlerTest {\n\n    @Mock\n    private GridPinnedModeManager pinnedModeManager;\n\n    private DefaultGridWidgetPinnedModeMouseEventHandler handler;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        final DefaultGridWidgetPinnedModeMouseEventHandler wrapped = new DefaultGridWidgetPinnedModeMouseEventHandler(pinnedModeManager,\n                                                                                                                      renderer);\n        handler = spy(wrapped);\n    }\n\n    @Test\n    public void enterPinnedMode() {\n        when(gridWidget.isVisible()).thenReturn(true);\n\n        when(doubleClickEvent.getX()).thenReturn(100);\n        when(doubleClickEvent.getY()).thenReturn(100);\n\n        final Point2D computedLocation = new Point2D(100.0, 100.0);\n        when(gridWidget.getComputedLocation()).thenReturn(computedLocation);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.of(0),\n                                 Optional.of(0),\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 event);\n\n        verify(handler,\n               times(1)).handleHeaderCell(eq(gridWidget),\n                                          eq(relativeLocation),\n                                          eq(0),\n                                          eq(0),\n                                          eq(event));\n        verify(pinnedModeManager,\n               times(1)).enterPinnedMode(eq(gridWidget),\n                                         any(Command.class));\n        verify(pinnedModeManager,\n               never()).exitPinnedMode(any(Command.class));\n    }\n\n    @Test\n    public void exitPinnedMode() {\n        when(gridWidget.isVisible()).thenReturn(true);\n        when(pinnedModeManager.isGridPinned()).thenReturn(true);\n\n        when(doubleClickEvent.getX()).thenReturn(100);\n        when(doubleClickEvent.getY()).thenReturn(100);\n\n        final Point2D computedLocation = new Point2D(100.0, 100.0);\n        when(gridWidget.getComputedLocation()).thenReturn(computedLocation);\n\n        handler.onNodeMouseEvent(gridWidget,\n                                 relativeLocation,\n                                 Optional.of(0),\n                                 Optional.of(0),\n                                 Optional.empty(),\n                                 Optional.empty(),\n                                 event);\n\n        verify(handler,\n               times(1)).handleHeaderCell(eq(gridWidget),\n                                          eq(relativeLocation),\n                                          eq(0),\n                                          eq(0),\n                                          eq(event));\n        verify(pinnedModeManager,\n               never()).enterPinnedMode(any(GridWidget.class),\n                                        any(Command.class));\n        verify(pinnedModeManager,\n               times(1)).exitPinnedMode(any(Command.class));\n    }\n\n    @Test\n    public void checkOnNodeMouseEventDuringDragOperation() {\n        doReturn(true).when(handler).isDNDOperationInProgress(eq(gridWidget));\n\n        assertFalse(handler.onNodeMouseEvent(gridWidget,\n                                             relativeLocation,\n                                             Optional.empty(),\n                                             Optional.empty(),\n                                             Optional.of(0),\n                                             Optional.of(1),\n                                             event));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationInvokeContextMenuForSelectedCellTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport java.util.Collections;\n\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class KeyboardOperationInvokeContextMenuForSelectedCellTest {\n\n    @Mock\n    private GridLayer gridLayerMock;\n\n    @Mock\n    private GridWidget gridWidgetMock;\n\n    @Mock\n    private GridData gridDataMock;\n\n    private KeyboardOperationInvokeContextMenuForSelectedCell testedOperation;\n\n    @Before\n    public void setUp() {\n        testedOperation = new KeyboardOperationInvokeContextMenuForSelectedCell(gridLayerMock);\n\n        doReturn(gridDataMock).when(gridWidgetMock).getModel();\n    }\n\n    @Test\n    public void testKeysThatFireOperation() {\n        assertThat(testedOperation.isControlKeyDown()).isEqualTo(KeyboardOperation.TriStateBoolean.TRUE);\n        assertThat(testedOperation.isShiftKeyDown()).isEqualTo(KeyboardOperation.TriStateBoolean.DONT_CARE);\n        assertThat(testedOperation.getKeyCode()).isEqualTo(KeyCodes.KEY_SPACE);\n    }\n\n    @Test\n    public void testIsExecutableNoSelectedCells() {\n        doReturn(Collections.emptyList()).when(gridDataMock).getSelectedCells();\n\n        assertThat(testedOperation.isExecutable(gridWidgetMock)).isFalse();\n    }\n\n    @Test\n    public void testIsExecutableSelectedHeader() {\n        doReturn(Collections.singletonList(mock(GridData.SelectedCell.class))).when(gridDataMock).getSelectedHeaderCells();\n\n        assertThat(testedOperation.isExecutable(gridWidgetMock)).isTrue();\n    }\n\n    @Test\n    public void testIsExecutableSelectedCells() {\n        doReturn(Collections.singletonList(mock(GridData.SelectedCell.class))).when(gridDataMock).getSelectedCells();\n\n        assertThat(testedOperation.isExecutable(gridWidgetMock)).isTrue();\n    }\n\n    @Test\n    public void testPerformWithSelectedHeader() {\n        // non null indexes to verify the coordinates translation\n        final int headerRowIndex = 1;\n        final int headerColumnIndex = 2;\n        // translated column index as just one column used in test\n        final int uiColumnIndex = 0;\n\n        final GridData.SelectedCell selectedCellMock = mock(GridData.SelectedCell.class);\n        doReturn(Collections.singletonList(selectedCellMock)).when(gridDataMock).getSelectedHeaderCells();\n        doReturn(headerRowIndex).when(selectedCellMock).getRowIndex();\n        doReturn(headerColumnIndex).when(selectedCellMock).getColumnIndex();\n\n        final GridColumn columnMock = mock(GridColumn.class);\n        doReturn(headerColumnIndex).when(columnMock).getIndex();\n\n        doReturn(Collections.singletonList(columnMock)).when(gridDataMock).getColumns();\n\n        doReturn(true).when(gridWidgetMock).showContextMenuForHeader(headerRowIndex, uiColumnIndex);\n\n        assertThat(testedOperation.perform(gridWidgetMock, false, true))\n                .as(\"Menu should be shown successfully\")\n                .isTrue();\n        verify(gridWidgetMock).showContextMenuForHeader(headerRowIndex, uiColumnIndex);\n    }\n\n    @Test\n    public void testPerformWithSelectedCell() {\n        // non null indexes to verify the coordinates translation\n        final int rowIndex = 1;\n        final int columnIndex = 2;\n        // translated column index as just one column used in test\n        final int uiColumnIndex = 0;\n\n        final GridData.SelectedCell selectedCellMock = mock(GridData.SelectedCell.class);\n        doReturn(Collections.singletonList(selectedCellMock)).when(gridDataMock).getSelectedCells();\n        doReturn(rowIndex).when(selectedCellMock).getRowIndex();\n        doReturn(columnIndex).when(selectedCellMock).getColumnIndex();\n\n        final GridColumn columnMock = mock(GridColumn.class);\n        doReturn(columnIndex).when(columnMock).getIndex();\n\n        doReturn(Collections.singletonList(columnMock)).when(gridDataMock).getColumns();\n\n        doReturn(selectedCellMock).when(gridDataMock).getSelectedCellsOrigin();\n        doReturn(true).when(gridWidgetMock).showContextMenuForCell(rowIndex, uiColumnIndex);\n\n        assertThat(testedOperation.perform(gridWidgetMock, false, true))\n                .as(\"Menu should be shown successfully\")\n                .isTrue();\n        verify(gridWidgetMock).showContextMenuForCell(rowIndex, uiColumnIndex);\n    }\n\n    @Test\n    public void testPerformNothingSelected() {\n        // non null indexes to verify the coordinates translation\n        final int rowIndex = 1;\n        final int columnIndex = 2;\n        // translated column index as just one column used in test\n        final int uiColumnIndex = 0;\n\n        final GridData.SelectedCell selectedCellMock = mock(GridData.SelectedCell.class);\n        doReturn(rowIndex).when(selectedCellMock).getRowIndex();\n        doReturn(columnIndex).when(selectedCellMock).getColumnIndex();\n\n        final GridColumn columnMock = mock(GridColumn.class);\n        doReturn(columnIndex).when(columnMock).getIndex();\n\n        doReturn(Collections.singletonList(columnMock)).when(gridDataMock).getColumns();\n\n        doReturn(null).when(gridDataMock).getSelectedCellsOrigin();\n        doReturn(true).when(gridWidgetMock).showContextMenuForCell(rowIndex, uiColumnIndex);\n\n        assertThat(testedOperation.perform(gridWidgetMock, false, true))\n                .as(\"Menu should not be shown successfully\")\n                .isFalse();\n        verify(gridWidgetMock, never()).showContextMenuForCell(anyInt(), anyInt());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveDownTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyboardOperationMoveDownTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private GridLienzoPanel panel;\n\n    private KeyboardOperationMoveDown keyboardOperation;\n\n    @Before\n    public void setup() {\n        keyboardOperation = new KeyboardOperationMoveDown(gridLayer, panel);\n    }\n\n    @Test\n    public void testGetSelectionExtension() {\n\n        final SelectionExtension actual = keyboardOperation.getSelectionExtension();\n        assertEquals(SelectionExtension.DOWN, actual);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveLeftTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyboardOperationMoveLeftTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private GridLienzoPanel panel;\n\n    private KeyboardOperationMoveLeft keyboardOperation;\n\n    @Before\n    public void setup() {\n        keyboardOperation = new KeyboardOperationMoveLeft(gridLayer, panel);\n    }\n\n    @Test\n    public void testGetSelectionExtension() {\n\n        final SelectionExtension actual = keyboardOperation.getSelectionExtension();\n        assertEquals(SelectionExtension.LEFT, actual);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveRightTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyboardOperationMoveRightTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private GridLienzoPanel panel;\n\n    private KeyboardOperationMoveRight keyboardOperation;\n\n    @Before\n    public void setup() {\n        keyboardOperation = new KeyboardOperationMoveRight(gridLayer, panel);\n    }\n\n    @Test\n    public void testGetSelectionExtension() {\n\n        final SelectionExtension actual = keyboardOperation.getSelectionExtension();\n        assertEquals(SelectionExtension.RIGHT, actual);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollable;\n\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyboardOperationMoveTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private GridLienzoScrollable gridLienzoPanel;\n\n    @Mock\n    private SelectionExtension extension;\n\n    private KeyboardOperationMove keyboardOperationMove;\n\n    @Before\n    public void setup() {\n\n        keyboardOperationMove = spy(new KeyboardOperationMove(gridLayer,\n                                                              gridLienzoPanel) {\n            @Override\n            public int getKeyCode() {\n                return 0;\n            }\n\n            @Override\n            SelectionExtension getSelectionExtension() {\n                return extension;\n            }\n        });\n    }\n\n    @Test\n    public void testPerform() {\n\n        final GridWidget gridWidget = mock(GridWidget.class);\n        doNothing().when(keyboardOperationMove).baseScrollSelectedCellIntoView(gridWidget);\n\n        keyboardOperationMove.perform(gridWidget, true, true);\n\n        verify(gridWidget).adjustSelection(extension, true);\n        verify(keyboardOperationMove).baseScrollSelectedCellIntoView(gridWidget);\n        verify(gridLienzoPanel).refreshScrollPosition();\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/impl/KeyboardOperationMoveUpTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyboardOperationMoveUpTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private GridLienzoPanel panel;\n\n    private KeyboardOperationMoveUp keyboardOperation;\n\n    @Before\n    public void setup() {\n        keyboardOperation = new KeyboardOperationMoveUp(gridLayer, panel);\n    }\n\n    @Test\n    public void testGetSelectionExtension() {\n\n        final SelectionExtension actual = keyboardOperation.getSelectionExtension();\n        assertEquals(SelectionExtension.UP, actual);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/BaseKeyDownHandlerCommonTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport java.util.Optional;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.dom.single.HasSingletonDOMElementResource;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.verifyNoMoreInteractions;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\nabstract class BaseKeyDownHandlerCommonTest {\n\n    @Mock\n    protected GridLayer gridLayer;\n\n    @Mock\n    protected GridLienzoPanel gridPanel;\n\n    @Mock\n    protected GridWidget gridWidget;\n\n    @Mock\n    protected HasSingletonDOMElementResource gridCell;\n\n    @Mock\n    protected GridColumn.HeaderMetaData headerMetaData;\n\n    @Mock\n    protected GridColumnRenderer<?> columnRenderer;\n\n    protected GridData uiModel;\n\n    private KeyDownHandlerCommon handler;\n\n    @Before\n    public void setUpHandler() {\n        uiModel = new BaseGridData();\n        handler = new KeyDownHandlerCommon(gridPanel,\n                                           gridLayer,\n                                           gridWidget,\n                                           gridCell,\n                                           isTabKeyHandled(),\n                                           isEnterKeyHandled(),\n                                           isEscapeKeyHandled());\n\n        for (int size = 0; size < 3; size++) {\n            uiModel.appendRow(new BaseGridRow());\n            uiModel.appendColumn(new BaseGridColumn<>(headerMetaData,\n                                                      columnRenderer,\n                                                      100.0));\n        }\n\n        when(gridWidget.getModel()).thenReturn(uiModel);\n    }\n\n    protected abstract boolean isTabKeyHandled();\n\n    protected abstract boolean isEnterKeyHandled();\n\n    protected abstract boolean isEscapeKeyHandled();\n\n    @Test\n    public void tabKeyCanvasActions() {\n        final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_TAB),\n                                                Optional.of(false),\n                                                Optional.of(false));\n\n        handler.onKeyDown(e);\n\n        if (isTabKeyHandled()) {\n            verify(gridCell).flush();\n            verify(e).preventDefault();\n            verifyCommonActions();\n        } else {\n            verifyNoMoreInteractions(gridCell);\n        }\n    }\n\n    @Test\n    public void enterKeyCanvasActions() {\n        final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ENTER),\n                                                Optional.of(false),\n                                                Optional.of(false));\n\n        handler.onKeyDown(e);\n\n        if (isEnterKeyHandled()) {\n            verify(gridCell).flush();\n            verify(e).preventDefault();\n            verifyCommonActions();\n        } else {\n            verifyNoMoreInteractions(gridCell);\n        }\n    }\n\n    @Test\n    public void escapeKeyCanvasActions() {\n        final KeyDownEvent e = mockKeyDownEvent(Optional.of(KeyCodes.KEY_ESCAPE),\n                                                Optional.of(false),\n                                                Optional.of(false));\n\n        handler.onKeyDown(e);\n\n        if (isEscapeKeyHandled()) {\n            verify(gridCell, never()).flush();\n            verifyCommonActions();\n        }\n    }\n\n    private void verifyCommonActions() {\n        verify(gridCell).destroyResources();\n        verify(gridPanel).setFocus(eq(true));\n        verify(gridLayer).batch();\n    }\n\n    private KeyDownEvent mockKeyDownEvent(final Optional<Integer> keyCode,\n                                          final Optional<Boolean> isShiftKeyDown,\n                                          final Optional<Boolean> isControlKeyDown) {\n        final KeyDownEvent e = mock(KeyDownEvent.class);\n        keyCode.ifPresent((c) -> when(e.getNativeKeyCode()).thenReturn(c));\n        isShiftKeyDown.ifPresent((c) -> when(e.isShiftKeyDown()).thenReturn(c));\n        isControlKeyDown.ifPresent((c) -> when(e.isControlKeyDown()).thenReturn(c));\n        return e;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/KeyDownHandlerCommonEnterKeyTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.runner.RunWith;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyDownHandlerCommonEnterKeyTest extends BaseKeyDownHandlerCommonTest {\n\n    @Override\n    protected boolean isTabKeyHandled() {\n        return false;\n    }\n\n    @Override\n    protected boolean isEnterKeyHandled() {\n        return true;\n    }\n\n    @Override\n    protected boolean isEscapeKeyHandled() {\n        return false;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/KeyDownHandlerCommonEscapeKeyTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.runner.RunWith;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyDownHandlerCommonEscapeKeyTest extends BaseKeyDownHandlerCommonTest {\n\n    @Override\n    protected boolean isTabKeyHandled() {\n        return false;\n    }\n\n    @Override\n    protected boolean isEnterKeyHandled() {\n        return false;\n    }\n\n    @Override\n    protected boolean isEscapeKeyHandled() {\n        return true;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/KeyDownHandlerCommonTabKeyTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.runner.RunWith;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyDownHandlerCommonTabKeyTest extends BaseKeyDownHandlerCommonTest {\n\n    @Override\n    protected boolean isTabKeyHandled() {\n        return true;\n    }\n\n    @Override\n    protected boolean isEnterKeyHandled() {\n        return false;\n    }\n\n    @Override\n    protected boolean isEscapeKeyHandled() {\n        return false;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/keyboard/KeyDownHandlerCommonTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.keyboard;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.runner.RunWith;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class KeyDownHandlerCommonTest extends BaseKeyDownHandlerCommonTest {\n\n    @Override\n    protected boolean isTabKeyHandled() {\n        return true;\n    }\n\n    @Override\n    protected boolean isEnterKeyHandled() {\n        return true;\n    }\n\n    @Override\n    protected boolean isEscapeKeyHandled() {\n        return true;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/BaseColumnRendererTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.Node;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwtmockito.GwtMock;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic abstract class BaseColumnRendererTest<T, R extends GridColumnRenderer<T>> {\n\n    private static final String TITLE = \"title\";\n\n    @Mock\n    private GridCell<T> cell;\n\n    @Mock\n    private GridCellValue<T> cellValue;\n\n    @Mock\n    private GridColumn gridColumn;\n\n    @Mock\n    private GridBodyCellRenderContext context;\n\n    @Mock\n    private GridHeaderColumnRenderContext headerContext;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation renderingInformation;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private GridRendererTheme theme;\n\n    @Mock\n    private GridRenderer.GridRendererContext renderContext;\n\n    @Mock\n    private Text text;\n\n    @Mock\n    private Node textNode;\n\n    @Mock\n    private Text placeHolderText;\n\n    @Mock\n    private Node placeHolderTextNode;\n\n    @GwtMock\n    @SuppressWarnings(\"unused\")\n    private Group headerGroup;\n\n    @Mock\n    private Node headerGroupNode;\n\n    @Mock\n    private Group parentGroup;\n\n    @Mock\n    private Node parentGroupNode;\n\n    @Mock\n    protected GridColumn.HeaderMetaData headerMetaData;\n\n    @Mock\n    protected IPathClipper boundingBoxPathClipper;\n\n    protected R renderer;\n\n    protected String PLACEHOLDER = \"PLACEHOLDER\";\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n        this.renderer = getRenderer();\n        this.gridColumn = getGridColumn();\n\n        final GridData uiModel = new BaseGridData();\n        uiModel.appendColumn(gridColumn);\n\n        when(context.getRenderer()).thenReturn(gridRenderer);\n        when(headerContext.getRenderer()).thenReturn(gridRenderer);\n        when(headerContext.getAllColumns()).thenReturn(uiModel.getColumns());\n        when(headerContext.getBlockColumns()).thenReturn(uiModel.getColumns());\n        when(gridRenderer.getTheme()).thenReturn(theme);\n        when(theme.getBodyText()).thenReturn(text);\n        when(theme.getHeaderText()).thenReturn(text);\n        when(theme.getPlaceholderText()).thenReturn(placeHolderText);\n        when(text.asNode()).thenReturn(textNode);\n        when(placeHolderText.asNode()).thenReturn(placeHolderTextNode);\n        when(headerGroup.asNode()).thenReturn(headerGroupNode);\n        when(parentGroup.asNode()).thenReturn(parentGroupNode);\n        when(renderContext.getGroup()).thenReturn(parentGroup);\n        when(headerMetaData.getTitle()).thenReturn(TITLE);\n    }\n\n    protected abstract R getRenderer();\n\n    protected abstract T getValueToRender();\n\n    protected abstract GridColumn getGridColumn();\n\n    @Test\n    public void testNullCell() {\n        assertNull(renderer.renderCell(null, context));\n    }\n\n    @Test\n    public void testNullCellValue() {\n        doReturn(null).when(cell).getValue();\n\n        assertNull(renderer.renderCell(cell, context));\n    }\n\n    @Test\n    public void testNullCellValueValue() {\n        doReturn(cellValue).when(cell).getValue();\n        doReturn(null).when(cellValue).getValue();\n\n        assertNull(renderer.renderCell(cell, context));\n    }\n\n    @Test\n    public void testRendering() {\n        doReturn(cellValue).when(cell).getValue();\n        doReturn(getValueToRender()).when(cellValue).getValue();\n\n        final Group g = renderer.renderCell(cell, context);\n        assertNotNull(g);\n\n        assertEquals(1,\n                     g.getChildNodes().size());\n        assertEquals(text,\n                     g.getChildNodes().get(0));\n    }\n\n    @Test\n    public void testRenderingPlaceHolder() {\n        doReturn(cellValue).when(cell).getValue();\n        doReturn(null).when(cellValue).getValue();\n        doReturn(PLACEHOLDER).when(cellValue).getPlaceHolder();\n\n        final Group g = renderer.renderCell(cell, context);\n        assertNotNull(g);\n\n        assertEquals(1,\n                     g.getChildNodes().size());\n        assertEquals(placeHolderText,\n                     g.getChildNodes().get(0));\n        verify(placeHolderText, times(1)).setText(eq(PLACEHOLDER));\n    }\n\n    @Test\n    public void testRenderHeader() {\n        final List<GridRenderer.RendererCommand> commands = renderer.renderHeader(Collections.singletonList(headerMetaData),\n                                                                                  headerContext,\n                                                                                  renderingInformation,\n                                                                                  (isSelectionLayer, gridColumn) -> true);\n\n        assertRenderingCommands(commands,\n                                GridRenderer.RenderHeaderGridLinesCommand.class, GridRenderer.RenderHeaderContentCommand.class);\n\n        commands.stream()\n                .filter(command -> command instanceof GridRenderer.RenderHeaderContentCommand)\n                .findFirst()\n                .ifPresent(command -> command.execute(renderContext));\n\n        verify(text).setText(eq(TITLE));\n        verify(text).setX(gridColumn.getWidth() / 2);\n        verify(text).setY(0.0);\n\n        verify(headerGroup).add(text);\n    }\n\n    @SafeVarargs\n    private final void assertRenderingCommands(final List<GridRenderer.RendererCommand> actualCommands,\n                                               final Class<? extends GridRenderer.RendererCommand>... expectedTypes) {\n        assertThat(actualCommands).asList().hasOnlyElementsOfTypes(expectedTypes);\n        Arrays.asList(expectedTypes).forEach(type -> assertThat(actualCommands).asList().filteredOn(type::isInstance).hasSize(1));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/ColumnRenderingStrategyFlattenedTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.BoundingBoxPathClipper;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\n\n@WithClassesToStub(BoundingBoxPathClipper.class)\n@RunWith(LienzoMockitoTestRunner.class)\npublic class ColumnRenderingStrategyFlattenedTest {\n\n    private static final double ROW_HEIGHT = 50;\n    private static final double CONTEXT_X_POSITION = 0;\n    private static final double COLUMN_WIDTH = 220;\n    private static final int MIN_VISIBLE_ROW_INDEX = 0;\n    private static final int MAX_VISIBLE_ROW_INDEX = 2;\n\n    @Mock\n    private GridColumn<?> column;\n\n    @Mock\n    private GridBodyColumnRenderContext context;\n\n    @Mock\n    private GridData gridData;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private GridRendererTheme gridRendererTheme;\n\n    @Mock\n    private GridColumnRenderer gridColumnRenderer;\n\n    @Mock\n    private GridRow rowOne;\n\n    @Mock\n    private GridRow rowTwo;\n\n    @Mock\n    private GridRow rowThree;\n\n    /*\n     *   [cellOne,   mock]\n     *   [cellTwo,   mock]\n     *   [cellThree, mock]\n     */\n\n    @Mock\n    private GridCell cellOne;\n\n    @Mock\n    private GridCell cellTwo;\n\n    @Mock\n    private GridCell cellThree;\n\n    @Spy\n    private MultiPath multiPath = new MultiPath();\n\n    @Mock\n    private BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation renderingInformation;\n\n    @Mock\n    private BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint;\n\n    @Mock\n    private BoundingBoxPathClipperFactory boundingBoxPathClipperFactory;\n\n    @Mock\n    private IPathClipper pathClipper;\n\n    @Mock\n    private Group columnGroup;\n\n    @Before\n    public void setUp() {\n        GwtMockito.useProviderForType(BoundingBoxPathClipperFactory.class, aClass -> boundingBoxPathClipperFactory);\n        GwtMockito.useProviderForType(Group.class, aClass -> columnGroup);\n\n        doReturn(CONTEXT_X_POSITION).when(context).getX();\n        doReturn(MIN_VISIBLE_ROW_INDEX).when(context).getMinVisibleRowIndex();\n        doReturn(MAX_VISIBLE_ROW_INDEX).when(context).getMaxVisibleRowIndex();\n        doReturn(gridData).when(context).getModel();\n        doReturn(gridRenderer).when(context).getRenderer();\n\n        doReturn(gridRendererTheme).when(gridRenderer).getTheme();\n\n        doReturn(multiPath).when(gridRendererTheme).getBodyGridLine();\n\n        doReturn(Arrays.asList(0d,\n                               ROW_HEIGHT,\n                               ROW_HEIGHT * 2d)).when(renderingInformation).getVisibleRowOffsets();\n\n        doReturn(COLUMN_WIDTH).when(column).getWidth();\n        doReturn(gridColumnRenderer).when(column).getColumnRenderer();\n\n        //Grid-lines are only rendered for all but the last column so ensure we have at least 2 columns\n        doReturn(2).when(gridData).getColumnCount();\n        doReturn(Arrays.asList(column, mock(GridColumn.class))).when(gridData).getColumns();\n        doReturn(rowOne).when(gridData).getRow(0);\n        doReturn(rowTwo).when(gridData).getRow(1);\n        doReturn(rowThree).when(gridData).getRow(2);\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n\n        doReturn(ROW_HEIGHT).when(rowOne).getHeight();\n        doReturn(ROW_HEIGHT).when(rowTwo).getHeight();\n        doReturn(ROW_HEIGHT).when(rowThree).getHeight();\n\n        doReturn(true).when(columnRenderingConstraint).apply(false, column);\n\n        doReturn(pathClipper).when(boundingBoxPathClipperFactory).newClipper(0,\n                                                                             0,\n                                                                             COLUMN_WIDTH,\n                                                                             ROW_HEIGHT * 3);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRenderNotSelectionLayer() {\n        final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(3, ROW_HEIGHT));\n        final GridRenderer.GridRendererContext rendererContext = mock(GridRenderer.GridRendererContext.class);\n        final Group group = mock(Group.class);\n        doReturn(false).when(rendererContext).isSelectionLayer();\n        doReturn(group).when(rendererContext).getGroup();\n        doReturn(allRowHeights).when(renderingInformation).getAllRowHeights();\n\n        final List<GridRenderer.RendererCommand> commands = ColumnRenderingStrategyFlattened.render(column,\n                                                                                                    context,\n                                                                                                    rendererHelper,\n                                                                                                    renderingInformation,\n                                                                                                    columnRenderingConstraint);\n\n        // Grid lines and column content\n        assertThat(commands).hasSize(2);\n\n        // -- Grid lines --\n        commands.get(0).execute(rendererContext);\n\n        verify(group).add(multiPath);\n        // Verify horizontal lines\n        // First row ignored\n        verify(multiPath, never()).M(CONTEXT_X_POSITION, 0 + 0.5);\n        verify(multiPath, never()).L(CONTEXT_X_POSITION + COLUMN_WIDTH, 0 + 0.5);\n\n        // Second row\n        verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT + 0.5);\n\n        // Third row\n        verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT * 2 + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT * 2 + 0.5);\n\n        // Vertical\n        verify(multiPath).M(COLUMN_WIDTH + 0.5, 0);\n        verify(multiPath).L(COLUMN_WIDTH + 0.5, ROW_HEIGHT * 3);\n\n        reset(group);\n\n        // -- Column content --\n        commands.get(1).execute(rendererContext);\n\n        verify(gridColumnRenderer).renderCell(eq(cellOne),\n                                              any(GridBodyCellRenderContext.class));\n        verify(gridColumnRenderer).renderCell(eq(cellTwo),\n                                              any(GridBodyCellRenderContext.class));\n        verify(gridColumnRenderer).renderCell(eq(cellThree),\n                                              any(GridBodyCellRenderContext.class));\n\n        verify(boundingBoxPathClipperFactory).newClipper(0,\n                                                         0,\n                                                         COLUMN_WIDTH,\n                                                         ROW_HEIGHT * 3);\n        verify(pathClipper).setActive(true);\n\n        verify(columnGroup).setX(CONTEXT_X_POSITION);\n\n        verify(group).add(columnGroup);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/ColumnRenderingStrategyMergedTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.function.BiFunction;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwtmockito.GwtMockito;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyDouble;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class ColumnRenderingStrategyMergedTest {\n\n    private static final double ROW_HEIGHT = 50;\n\n    private static final double COLUMN_WIDTH = 100;\n\n    private static final double CONTEXT_X_POSITION = 0;\n\n    private static final int CONTEXT_MIN_VISIBLE_ROW_INDEX = 0;\n\n    private static final int CONTEXT_MAX_VISIBLE_ROW_INDEX = 2;\n\n    @Spy\n    private MultiPath multiPath = new MultiPath();\n\n    @Mock\n    private BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    private BaseGridRendererHelper.RenderingInformation renderingInformation;\n\n    @Mock\n    private BiFunction<Boolean, GridColumn<?>, Boolean> columnRenderingConstraint;\n\n    @Mock\n    private BoundingBoxPathClipperFactory boundingBoxPathClipperFactory;\n\n    @Mock\n    private IPathClipper pathClipper;\n\n    @Mock\n    private Group columnGroup;\n\n    @Mock\n    private Group cellGroup;\n\n    @Mock\n    private GridColumn<?> gridColumn;\n\n    @Mock\n    private GridBodyColumnRenderContext context;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private GridRendererTheme gridRendererTheme;\n\n    @Mock\n    private GridColumnRenderer gridColumnRenderer;\n\n    @Mock\n    private GridData gridData;\n\n    @Mock\n    private GridCell<String> gridCell;\n\n    @Mock\n    private GridRow gridRow;\n\n    @Captor\n    private ArgumentCaptor<GridBodyCellRenderContext> gridBodyCellRenderContextArgumentCaptor;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setUp() {\n        GwtMockito.useProviderForType(BoundingBoxPathClipperFactory.class, aClass -> boundingBoxPathClipperFactory);\n        GwtMockito.useProviderForType(Group.class, aClass -> columnGroup);\n\n        when(context.getX()).thenReturn(CONTEXT_X_POSITION);\n        when(context.getMinVisibleRowIndex()).thenReturn(CONTEXT_MIN_VISIBLE_ROW_INDEX);\n        when(context.getMaxVisibleRowIndex()).thenReturn(CONTEXT_MAX_VISIBLE_ROW_INDEX);\n        when(context.getModel()).thenReturn(gridData);\n        when(context.getRenderer()).thenReturn(gridRenderer);\n\n        when(gridRenderer.getTheme()).thenReturn(gridRendererTheme);\n        when(gridRendererTheme.getBodyGridLine()).thenReturn(multiPath);\n        when(columnRenderingConstraint.apply(false, gridColumn)).thenReturn(true);\n        when(renderingInformation.getVisibleRowOffsets()).thenReturn(Arrays.asList(0d, ROW_HEIGHT, ROW_HEIGHT * 2d));\n        when(boundingBoxPathClipperFactory.newClipper(anyDouble(), anyDouble(), anyDouble(), anyDouble())).thenReturn(pathClipper);\n\n        when(gridColumn.getWidth()).thenReturn(COLUMN_WIDTH);\n        when(gridColumn.getColumnRenderer()).thenReturn(gridColumnRenderer);\n        //Grid-lines are only rendered for all but the last column so ensure we have at least 2 columns\n        when(gridData.getColumnCount()).thenReturn(2);\n        when(gridData.getColumns()).thenReturn(Arrays.asList(gridColumn, mock(GridColumn.class)));\n    }\n\n    @Test\n    public void testGetCellHeightCells3() {\n        doReturn(3).when(gridCell).getMergedCellCount();\n        final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(3, BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT));\n        assertThat(ColumnRenderingStrategyMerged.getCellHeight(0, allRowHeights, gridCell)).isEqualTo(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT * 3);\n    }\n\n    @Test\n    public void testGetCellHeightCells4() {\n        doReturn(4).when(gridCell).getMergedCellCount();\n        final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(4, BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT));\n        assertThat(ColumnRenderingStrategyMerged.getCellHeight(0, allRowHeights, gridCell)).isEqualTo(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT * 4);\n    }\n\n    @Test\n    public void testIsCollapsedCellMixedValueThreeDifferentValues() {\n        when(gridData.getRow(anyInt())).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT);\n\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"three\", 0);\n        doReturn(3).when(gridData).getRowCount();\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n        doReturn(true).when(gridRow).isCollapsed();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedCellMixedValue(gridData, 2, 0)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedCellMixedValueOneDifferentValue_1() {\n        when(gridData.getRow(anyInt())).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT);\n\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        doReturn(3).when(gridData).getRowCount();\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n        doReturn(true).when(gridRow).isCollapsed();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedCellMixedValue(gridData, 2, 0)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedCellMixedValueOneDifferentValue_2() {\n        when(gridData.getRow(anyInt())).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT);\n\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"two\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        doReturn(3).when(gridData).getRowCount();\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n        doReturn(true).when(gridRow).isCollapsed();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedCellMixedValue(gridData, 2, 0)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedCellMixedValueOneDifferentValue_3() {\n        when(gridData.getRow(anyInt())).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT);\n\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"two\", 0);\n        doReturn(3).when(gridData).getRowCount();\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n        doReturn(true).when(gridRow).isCollapsed();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedCellMixedValue(gridData, 2, 0)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedCellMixedValue() {\n        when(gridData.getRow(anyInt())).thenReturn(gridRow);\n        when(gridRow.getHeight()).thenReturn(BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT);\n\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        doReturn(3).when(gridData).getRowCount();\n        doReturn(cellOne).when(gridData).getCell(0, 0);\n        doReturn(cellTwo).when(gridData).getCell(1, 0);\n        doReturn(cellThree).when(gridData).getCell(2, 0);\n        doReturn(true).when(gridRow).isCollapsed();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedCellMixedValue(gridData, 2, 0)).isFalse();\n    }\n\n    @Test\n    public void testIsCollapsedRowMixedValueThreeDifferentValues() {\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"three\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        doReturn(gridRowOne).when(gridData).getRow(0);\n        doReturn(gridRowTwo).when(gridData).getRow(1);\n        doReturn(gridRowThree).when(gridData).getRow(2);\n        doReturn(false).when(gridRowOne).isCollapsed();\n        doReturn(true).when(gridRowTwo).isCollapsed();\n        doReturn(true).when(gridRowThree).isCollapsed();\n        doReturn(Collections.singletonMap(0, cellOne)).when(gridRowOne).getCells();\n        doReturn(Collections.singletonMap(0, cellTwo)).when(gridRowTwo).getCells();\n        doReturn(Collections.singletonMap(0, cellThree)).when(gridRowThree).getCells();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedRowMultiValue(gridData, gridColumn, cellThree, 2)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedRowMixedValueOneDifferentValue_1() {\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        doReturn(gridRowOne).when(gridData).getRow(0);\n        doReturn(gridRowTwo).when(gridData).getRow(1);\n        doReturn(gridRowThree).when(gridData).getRow(2);\n        doReturn(false).when(gridRowOne).isCollapsed();\n        doReturn(true).when(gridRowTwo).isCollapsed();\n        doReturn(true).when(gridRowThree).isCollapsed();\n        doReturn(Collections.singletonMap(0, cellOne)).when(gridRowOne).getCells();\n        doReturn(Collections.singletonMap(0, cellTwo)).when(gridRowTwo).getCells();\n        doReturn(Collections.singletonMap(0, cellThree)).when(gridRowThree).getCells();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedRowMultiValue(gridData, gridColumn, cellThree, 2)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedRowMixedValueOneDifferentValue_2() {\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        doReturn(gridRowOne).when(gridData).getRow(0);\n        doReturn(gridRowTwo).when(gridData).getRow(1);\n        doReturn(gridRowThree).when(gridData).getRow(2);\n        doReturn(false).when(gridRowOne).isCollapsed();\n        doReturn(true).when(gridRowTwo).isCollapsed();\n        doReturn(true).when(gridRowThree).isCollapsed();\n        doReturn(Collections.singletonMap(0, cellOne)).when(gridRowOne).getCells();\n        doReturn(Collections.singletonMap(0, cellTwo)).when(gridRowTwo).getCells();\n        doReturn(Collections.singletonMap(0, cellThree)).when(gridRowThree).getCells();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedRowMultiValue(gridData, gridColumn, cellThree, 2)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedRowMixedValueOneDifferentValue_3() {\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"two\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        doReturn(gridRowOne).when(gridData).getRow(0);\n        doReturn(gridRowTwo).when(gridData).getRow(1);\n        doReturn(gridRowThree).when(gridData).getRow(2);\n        doReturn(false).when(gridRowOne).isCollapsed();\n        doReturn(true).when(gridRowTwo).isCollapsed();\n        doReturn(true).when(gridRowThree).isCollapsed();\n        doReturn(Collections.singletonMap(0, cellOne)).when(gridRowOne).getCells();\n        doReturn(Collections.singletonMap(0, cellTwo)).when(gridRowTwo).getCells();\n        doReturn(Collections.singletonMap(0, cellThree)).when(gridRowThree).getCells();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedRowMultiValue(gridData, gridColumn, cellThree, 2)).isTrue();\n    }\n\n    @Test\n    public void testIsCollapsedRowMixedValue() {\n        final GridCell<String> cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell<String> cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell<String> cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        doReturn(gridRowOne).when(gridData).getRow(0);\n        doReturn(gridRowTwo).when(gridData).getRow(1);\n        doReturn(gridRowThree).when(gridData).getRow(2);\n        doReturn(false).when(gridRowOne).isCollapsed();\n        doReturn(true).when(gridRowTwo).isCollapsed();\n        doReturn(true).when(gridRowThree).isCollapsed();\n        doReturn(Collections.singletonMap(0, cellOne)).when(gridRowOne).getCells();\n        doReturn(Collections.singletonMap(0, cellTwo)).when(gridRowTwo).getCells();\n        doReturn(Collections.singletonMap(0, cellThree)).when(gridRowThree).getCells();\n\n        assertThat(ColumnRenderingStrategyMerged.isCollapsedRowMultiValue(gridData, gridColumn, cellThree, 2)).isFalse();\n    }\n\n    private GridCell<String> gridCellWithMockedMergedCellCount(final String value,\n                                                               final int mergedCellCount) {\n        return new BaseGridCell<String>(new BaseGridCellValue<>(value)) {\n            @Override\n            public int getMergedCellCount() {\n                return mergedCellCount;\n            }\n        };\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRenderNotSelectionLayer_Unmerged() {\n        final GridCell cellOne = gridCellWithMockedMergedCellCount(\"one\", 1);\n        final GridCell cellTwo = gridCellWithMockedMergedCellCount(\"two\", 1);\n        final GridCell cellThree = gridCellWithMockedMergedCellCount(\"three\", 1);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        when(gridData.getRow(0)).thenReturn(gridRowOne);\n        when(gridData.getRow(1)).thenReturn(gridRowTwo);\n        when(gridData.getRow(2)).thenReturn(gridRowThree);\n        when(gridRowOne.isCollapsed()).thenReturn(false);\n        when(gridRowTwo.isCollapsed()).thenReturn(false);\n        when(gridRowThree.isCollapsed()).thenReturn(false);\n        when(gridRowOne.getCells()).thenReturn(Collections.singletonMap(0, cellOne));\n        when(gridRowTwo.getCells()).thenReturn(Collections.singletonMap(0, cellTwo));\n        when(gridRowThree.getCells()).thenReturn(Collections.singletonMap(0, cellThree));\n        when(gridData.getCell(0, 0)).thenReturn(cellOne);\n        when(gridData.getCell(1, 0)).thenReturn(cellTwo);\n        when(gridData.getCell(2, 0)).thenReturn(cellThree);\n        when(gridColumnRenderer.renderCell(any(GridCell.class), any(GridBodyCellRenderContext.class))).thenReturn(cellGroup);\n        when(cellGroup.setX(anyDouble())).thenReturn(cellGroup);\n        when(cellGroup.setY(anyDouble())).thenReturn(cellGroup);\n\n        final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(3, ROW_HEIGHT));\n        final GridRenderer.GridRendererContext rendererContext = mock(GridRenderer.GridRendererContext.class);\n        final Group group = mock(Group.class);\n        doReturn(false).when(rendererContext).isSelectionLayer();\n        doReturn(group).when(rendererContext).getGroup();\n        doReturn(allRowHeights).when(renderingInformation).getAllRowHeights();\n\n        final List<GridRenderer.RendererCommand> commands = ColumnRenderingStrategyMerged.render(gridColumn,\n                                                                                                 context,\n                                                                                                 rendererHelper,\n                                                                                                 renderingInformation,\n                                                                                                 columnRenderingConstraint);\n\n        // Grid lines and column content\n        assertThat(commands).hasSize(2);\n\n        // -- Grid lines --\n        commands.get(0).execute(rendererContext);\n\n        verify(group).add(multiPath);\n        // Verify horizontal lines\n        // First row\n        verify(multiPath).M(CONTEXT_X_POSITION, 0 + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, 0 + 0.5);\n\n        // Second row\n        verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT + 0.5);\n\n        // Third row\n        verify(multiPath).M(CONTEXT_X_POSITION, ROW_HEIGHT * 2 + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, ROW_HEIGHT * 2 + 0.5);\n\n        // Vertical\n        verify(multiPath).M(COLUMN_WIDTH + 0.5, 0);\n        verify(multiPath).L(COLUMN_WIDTH + 0.5, ROW_HEIGHT * 3);\n\n        reset(group);\n\n        // -- Column content --\n        commands.get(1).execute(rendererContext);\n\n        verify(gridColumnRenderer).renderCell(eq(cellOne),\n                                              gridBodyCellRenderContextArgumentCaptor.capture());\n        assertGridBodyCellRenderContext(gridBodyCellRenderContextArgumentCaptor.getAllValues().get(0),\n                                        0.0,\n                                        0.0,\n                                        gridColumn.getWidth(),\n                                        ROW_HEIGHT,\n                                        0,\n                                        0);\n\n        verify(gridColumnRenderer).renderCell(eq(cellTwo),\n                                              gridBodyCellRenderContextArgumentCaptor.capture());\n        assertGridBodyCellRenderContext(gridBodyCellRenderContextArgumentCaptor.getAllValues().get(1),\n                                        0.0,\n                                        50.0,\n                                        gridColumn.getWidth(),\n                                        ROW_HEIGHT,\n                                        1,\n                                        0);\n\n        verify(gridColumnRenderer).renderCell(eq(cellThree),\n                                              gridBodyCellRenderContextArgumentCaptor.capture());\n        assertGridBodyCellRenderContext(gridBodyCellRenderContextArgumentCaptor.getAllValues().get(2),\n                                        0.0,\n                                        100.0,\n                                        gridColumn.getWidth(),\n                                        ROW_HEIGHT,\n                                        2,\n                                        0);\n\n        verify(boundingBoxPathClipperFactory).newClipper(0,\n                                                         0,\n                                                         COLUMN_WIDTH,\n                                                         ROW_HEIGHT * 3);\n        verify(pathClipper).setActive(true);\n\n        verify(columnGroup).setX(CONTEXT_X_POSITION);\n\n        verify(group).add(columnGroup);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRenderNotSelectionLayer_Merged() {\n        final GridCell cellOne = gridCellWithMockedMergedCellCount(\"one\", 3);\n        final GridCell cellTwo = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridCell cellThree = gridCellWithMockedMergedCellCount(\"one\", 0);\n        final GridRow gridRowOne = mock(GridRow.class);\n        final GridRow gridRowTwo = mock(GridRow.class);\n        final GridRow gridRowThree = mock(GridRow.class);\n        when(gridData.getRow(0)).thenReturn(gridRowOne);\n        when(gridData.getRow(1)).thenReturn(gridRowTwo);\n        when(gridData.getRow(2)).thenReturn(gridRowThree);\n        when(gridRowOne.isMerged()).thenReturn(true);\n        when(gridRowTwo.isMerged()).thenReturn(true);\n        when(gridRowThree.isMerged()).thenReturn(true);\n        when(gridRowOne.isCollapsed()).thenReturn(false);\n        when(gridRowTwo.isCollapsed()).thenReturn(false);\n        when(gridRowThree.isCollapsed()).thenReturn(false);\n        when(gridRowOne.getCells()).thenReturn(Collections.singletonMap(0, cellOne));\n        when(gridRowTwo.getCells()).thenReturn(Collections.singletonMap(0, cellTwo));\n        when(gridRowThree.getCells()).thenReturn(Collections.singletonMap(0, cellThree));\n        when(gridData.getCell(0, 0)).thenReturn(cellOne);\n        when(gridData.getCell(1, 0)).thenReturn(cellTwo);\n        when(gridData.getCell(2, 0)).thenReturn(cellThree);\n        when(gridColumnRenderer.renderCell(any(GridCell.class), any(GridBodyCellRenderContext.class))).thenReturn(cellGroup);\n        when(cellGroup.setX(anyDouble())).thenReturn(cellGroup);\n        when(cellGroup.setY(anyDouble())).thenReturn(cellGroup);\n\n        final List<Double> allRowHeights = new ArrayList<>(Collections.nCopies(3, ROW_HEIGHT));\n        final GridRenderer.GridRendererContext rendererContext = mock(GridRenderer.GridRendererContext.class);\n        final Group group = mock(Group.class);\n        doReturn(false).when(rendererContext).isSelectionLayer();\n        doReturn(group).when(rendererContext).getGroup();\n        doReturn(allRowHeights).when(renderingInformation).getAllRowHeights();\n\n        final List<GridRenderer.RendererCommand> commands = ColumnRenderingStrategyMerged.render(gridColumn,\n                                                                                                 context,\n                                                                                                 rendererHelper,\n                                                                                                 renderingInformation,\n                                                                                                 columnRenderingConstraint);\n\n        // Grid lines and column content\n        assertThat(commands).hasSize(2);\n\n        // -- Grid lines --\n        commands.get(0).execute(rendererContext);\n\n        verify(group).add(multiPath);\n        // Verify horizontal lines\n        // First (merged) row\n        verify(multiPath).M(CONTEXT_X_POSITION, 0 + 0.5);\n        verify(multiPath).L(CONTEXT_X_POSITION + COLUMN_WIDTH, 0 + 0.5);\n\n        // Vertical\n        verify(multiPath).M(COLUMN_WIDTH + 0.5, 0);\n        verify(multiPath).L(COLUMN_WIDTH + 0.5, ROW_HEIGHT * 3);\n\n        reset(group);\n\n        // -- Column content --\n        commands.get(1).execute(rendererContext);\n\n        verify(gridColumnRenderer).renderCell(eq(cellOne),\n                                              gridBodyCellRenderContextArgumentCaptor.capture());\n        final GridBodyCellRenderContext context = gridBodyCellRenderContextArgumentCaptor.getValue();\n        assertGridBodyCellRenderContext(context,\n                                        0.0,\n                                        0.0,\n                                        gridColumn.getWidth(),\n                                        ROW_HEIGHT * 3,\n                                        0,\n                                        0);\n\n        verify(boundingBoxPathClipperFactory).newClipper(0,\n                                                         0,\n                                                         COLUMN_WIDTH,\n                                                         ROW_HEIGHT * 3);\n        verify(pathClipper).setActive(true);\n\n        verify(columnGroup).setX(CONTEXT_X_POSITION);\n\n        verify(group).add(columnGroup);\n    }\n\n    private void assertGridBodyCellRenderContext(final GridBodyCellRenderContext context,\n                                                 final double expectedAbsoluteCellX,\n                                                 final double expectedAbsoluteCellY,\n                                                 final double expectedCellWidth,\n                                                 final double expectedCellHeight,\n                                                 final int expectedRowIndex,\n                                                 final int expectedColumnIndex) {\n        assertThat(context).isNotNull();\n        assertThat(context.getAbsoluteCellX()).isEqualTo(expectedAbsoluteCellX);\n        assertThat(context.getAbsoluteCellY()).isEqualTo(expectedAbsoluteCellY);\n        assertThat(context.getCellWidth()).isEqualTo(expectedCellWidth);\n        assertThat(context.getCellHeight()).isEqualTo(expectedCellHeight);\n        assertThat(context.getRowIndex()).isEqualTo(expectedRowIndex);\n        assertThat(context.getColumnIndex()).isEqualTo(expectedColumnIndex);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/IntegerColumnRendererTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.Collections;\n\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.types.BoundingBox;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn;\n\n@WithClassesToStub({Text.class})\npublic class IntegerColumnRendererTest extends BaseColumnRendererTest<Integer, IntegerColumnRenderer> {\n\n    @Override\n    public IntegerColumnRenderer getRenderer() {\n        return new IntegerColumnRenderer() {\n            @Override\n            @SuppressWarnings(\"unused\")\n            protected IPathClipper getBoundingBoxPathClipper(final BoundingBox bb) {\n                return boundingBoxPathClipper;\n            }\n        };\n    }\n\n    @Override\n    protected Integer getValueToRender() {\n        return 1;\n    }\n\n    @Override\n    protected GridColumn getGridColumn() {\n        return new RowNumberColumn(Collections.singletonList(headerMetaData),\n                                   renderer);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/columns/impl/StringColumnRendererTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.impl;\n\nimport java.util.Collections;\n\nimport com.ait.lienzo.client.core.shape.IPathClipper;\nimport com.ait.lienzo.client.core.types.BoundingBox;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.StringPopupColumn;\n\n@WithClassesToStub({Text.class})\npublic class StringColumnRendererTest extends BaseColumnRendererTest<String, StringColumnRenderer> {\n\n    @Override\n    public StringColumnRenderer getRenderer() {\n        return new StringColumnRenderer() {\n            @Override\n            @SuppressWarnings(\"unused\")\n            protected IPathClipper getBoundingBoxPathClipper(final BoundingBox bb) {\n                return boundingBoxPathClipper;\n            }\n        };\n    }\n\n    @Override\n    protected String getValueToRender() {\n        return \"cheese\";\n    }\n\n    @Override\n    protected GridColumn getGridColumn() {\n        return new StringPopupColumn(Collections.singletonList(headerMetaData),\n                                     renderer,\n                                     100.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererHelperTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.RowNumberColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridRendererHelperTest {\n\n    private static final double HEADER_HEIGHT = 32.0;\n\n    private static final double HEADER_ROW_HEIGHT = 10.0;\n\n    private static final double BOUNDS_WIDTH = 1000.0;\n\n    private static final double BOUNDS_HEIGHT = 1000.0;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private DefaultGridLayer gridLayer;\n\n    @Mock\n    private GridRenderer gridRenderer;\n\n    @Mock\n    private GridColumnRenderer<String> columnRenderer;\n\n    private GridColumn<Integer> uiColumn1;\n    private GridColumn<String> uiColumn2;\n    private GridRow uiRow1;\n    private GridRow uiRow2;\n    private GridRow uiRow3;\n\n    private GridData uiModel;\n\n    private BaseGridRendererHelper helper;\n\n    @Before\n    public void setup() {\n        this.uiColumn1 = new RowNumberColumn();\n        this.uiColumn2 = new BaseGridColumn<>(Arrays.asList(new BaseHeaderMetaData(\"title1\"), new BaseHeaderMetaData(\"title2\")),\n                                              columnRenderer,\n                                              100.0);\n        this.uiRow1 = new BaseGridRow();\n        this.uiRow2 = new BaseGridRow();\n        this.uiRow3 = new BaseGridRow();\n        this.uiModel = new BaseGridData();\n        this.uiModel.appendColumn(uiColumn1);\n        this.uiModel.appendColumn(uiColumn2);\n        this.uiModel.appendRow(uiRow1);\n        this.uiModel.appendRow(uiRow2);\n        this.uiModel.appendRow(uiRow3);\n        this.helper = new BaseGridRendererHelper(gridWidget);\n\n        when(gridWidget.getModel()).thenReturn(uiModel);\n        when(gridWidget.getLayer()).thenReturn(gridLayer);\n        when(gridWidget.getRenderer()).thenReturn(gridRenderer);\n        when(gridRenderer.getHeaderHeight()).thenReturn(HEADER_HEIGHT);\n        when(gridRenderer.getHeaderRowHeight()).thenReturn(HEADER_ROW_HEIGHT);\n        when(gridWidget.getWidth()).thenReturn(uiColumn1.getWidth() + uiColumn2.getWidth());\n        when(gridWidget.getHeight()).thenReturn(HEADER_HEIGHT + uiRow1.getHeight() + uiRow2.getHeight() + uiRow3.getHeight());\n    }\n\n    @Test\n    public void testGetColumnOffsetByObject() {\n        assertThat(helper.getColumnOffset(uiColumn1)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(uiColumn2)).isEqualTo(uiColumn1.getWidth());\n    }\n\n    @Test\n    public void testGetColumnOffsetByObjectWithHiddenColumn() {\n        uiColumn1.setVisible(false);\n\n        assertThat(helper.getColumnOffset(uiColumn1)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(uiColumn2)).isEqualTo(0.0);\n    }\n\n    @Test\n    public void testGetColumnOffsetByIndex() {\n        assertThat(helper.getColumnOffset(0)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(1)).isEqualTo(uiColumn1.getWidth());\n    }\n\n    @Test\n    public void testGetColumnOffsetByIndexWithHiddenColumn() {\n        uiColumn1.setVisible(false);\n\n        assertThat(helper.getColumnOffset(0)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(1)).isEqualTo(0.0);\n    }\n\n    @Test\n    public void testGetColumnOffsetByIndexAndSubList() {\n        assertThat(helper.getColumnOffset(uiModel.getColumns(), 0)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(uiModel.getColumns(), 1)).isEqualTo(uiColumn1.getWidth());\n    }\n\n    @Test\n    public void testGetColumnOffsetByIndexAndSubListWithHiddenColumn() {\n        uiColumn1.setVisible(false);\n\n        assertThat(helper.getColumnOffset(uiModel.getColumns(), 0)).isEqualTo(0.0);\n        assertThat(helper.getColumnOffset(uiModel.getColumns(), 1)).isEqualTo(0.0);\n    }\n\n    @Test\n    public void testGetRowOffsetWithObject() {\n        assertThat(helper.getRowOffset(uiRow1)).isEqualTo(0.0);\n        assertThat(helper.getRowOffset(uiRow2)).isEqualTo(uiRow1.getHeight());\n        assertThat(helper.getRowOffset(uiRow3)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight());\n    }\n\n    @Test\n    public void testGetRowOffsetWithIndex() {\n        assertThat(helper.getRowOffset(0)).isEqualTo(0.0);\n        assertThat(helper.getRowOffset(1)).isEqualTo(uiRow1.getHeight());\n        assertThat(helper.getRowOffset(2)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight());\n    }\n\n    @Test\n    public void testGetRowOffsetWithObjectAndExplicitRowHeights() {\n        final List<Double> allRowHeights = new ArrayList<>(Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()));\n        assertThat(helper.getRowOffset(uiRow1, allRowHeights)).isEqualTo(0.0);\n        assertThat(helper.getRowOffset(uiRow2, allRowHeights)).isEqualTo(uiRow1.getHeight());\n        assertThat(helper.getRowOffset(uiRow3, allRowHeights)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight());\n    }\n\n    @Test\n    public void testGetRowOffsetWithIndexAndExplicitRowHeights() {\n        final List<Double> allRowHeights = new ArrayList<>(Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()));\n        assertThat(helper.getRowOffset(0, allRowHeights)).isEqualTo(0.0);\n        assertThat(helper.getRowOffset(1, allRowHeights)).isEqualTo(uiRow1.getHeight());\n        assertThat(helper.getRowOffset(2, allRowHeights)).isEqualTo(uiRow1.getHeight() + uiRow2.getHeight());\n    }\n\n    @Test\n    public void testGetWidth() {\n        assertThat(helper.getWidth(uiModel.getColumns())).isEqualTo(uiColumn1.getWidth() + uiColumn2.getWidth());\n    }\n\n    @Test\n    public void testGetWidthWithHiddenColumn() {\n        uiColumn1.setVisible(false);\n\n        assertThat(helper.getWidth(uiModel.getColumns())).isEqualTo(uiColumn2.getWidth());\n    }\n\n    @Test\n    public void testGetRenderingInformation_BoundsLeft() {\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(-(uiColumn1.getWidth() + uiColumn2.getWidth()) - 1, 0));\n\n        assertThat(helper.getRenderingInformation()).isNull();\n    }\n\n    @Test\n    public void testGetRenderingInformation_BoundsRight() {\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(BOUNDS_WIDTH + 1, 0));\n\n        assertThat(helper.getRenderingInformation()).isNull();\n    }\n\n    @Test\n    public void testGetRenderingInformation_BoundsTop() {\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, -(HEADER_HEIGHT + uiRow1.getHeight() + uiRow2.getHeight() + uiRow3.getHeight()) - 1));\n\n        assertThat(helper.getRenderingInformation()).isNull();\n    }\n\n    @Test\n    public void testGetRenderingInformation_BoundsBottom() {\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, BOUNDS_HEIGHT + 1));\n\n        assertThat(helper.getRenderingInformation()).isNull();\n    }\n\n    @Test\n    public void testGetRenderingInformation_FixedHeaderSelected_NoFloatingColumns() {\n        when(gridWidget.isSelected()).thenReturn(true);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, 0));\n\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = helper.getRenderingInformation();\n        assertRenderingInformation(renderingInformation,\n                                   true,\n                                   false,\n                                   uiModel.getColumns(),\n                                   0,\n                                   uiModel.getRowCount() - 1,\n                                   Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()),\n                                   Arrays.asList(0.0, uiRow1.getHeight(), uiRow1.getHeight() + uiRow2.getHeight()),\n                                   uiModel.getHeaderRowCount(),\n                                   HEADER_ROW_HEIGHT,\n                                   HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount(),\n                                   HEADER_HEIGHT - HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount());\n\n        assertBlockInformation(renderingInformation.getBodyBlockInformation(),\n                               uiModel.getColumns(),\n                               0.0,\n                               0.0,\n                               HEADER_HEIGHT,\n                               uiColumn1.getWidth() + uiColumn2.getWidth());\n        assertBlockInformation(renderingInformation.getFloatingBlockInformation(),\n                               Collections.emptyList(),\n                               0.0,\n                               0.0,\n                               HEADER_HEIGHT,\n                               0.0);\n    }\n\n    @Test\n    public void testGetRenderingInformation_FixedHeaderNotSelected_NoFloatingColumns() {\n        when(gridWidget.isSelected()).thenReturn(false);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, 0));\n\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = helper.getRenderingInformation();\n        assertRenderingInformation(renderingInformation,\n                                   true,\n                                   false,\n                                   uiModel.getColumns(),\n                                   0,\n                                   uiModel.getRowCount() - 1,\n                                   Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()),\n                                   Arrays.asList(0.0, uiRow1.getHeight(), uiRow1.getHeight() + uiRow2.getHeight()),\n                                   uiModel.getHeaderRowCount(),\n                                   HEADER_ROW_HEIGHT,\n                                   HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount(),\n                                   HEADER_HEIGHT - HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount());\n\n        assertBlockInformation(renderingInformation.getBodyBlockInformation(),\n                               uiModel.getColumns(),\n                               0.0,\n                               0.0,\n                               HEADER_HEIGHT,\n                               uiColumn1.getWidth() + uiColumn2.getWidth());\n        assertBlockInformation(renderingInformation.getFloatingBlockInformation(),\n                               Collections.emptyList(),\n                               0.0,\n                               0.0,\n                               HEADER_HEIGHT,\n                               0.0);\n    }\n\n    @Test\n    public void testGetRenderingInformation_FloatingHeaderSelected_NoFloatingColumns() {\n        final double gridWidgetLocationY = -uiRow1.getHeight() - 5;\n        when(gridWidget.isSelected()).thenReturn(true);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, gridWidgetLocationY));\n\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = helper.getRenderingInformation();\n        assertRenderingInformation(renderingInformation,\n                                   false,\n                                   true,\n                                   uiModel.getColumns(),\n                                   1,\n                                   uiModel.getRowCount() - 1,\n                                   Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()),\n                                   Arrays.asList(uiRow1.getHeight(), uiRow1.getHeight() + uiRow2.getHeight()),\n                                   uiModel.getHeaderRowCount(),\n                                   HEADER_ROW_HEIGHT,\n                                   HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount(),\n                                   HEADER_HEIGHT - HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount());\n\n        assertBlockInformation(renderingInformation.getBodyBlockInformation(),\n                               uiModel.getColumns(),\n                               0.0,\n                               -gridWidgetLocationY,\n                               HEADER_HEIGHT + uiRow1.getHeight(),\n                               uiColumn1.getWidth() + uiColumn2.getWidth());\n        assertBlockInformation(renderingInformation.getFloatingBlockInformation(),\n                               Collections.emptyList(),\n                               0.0,\n                               -gridWidgetLocationY,\n                               HEADER_HEIGHT + uiRow1.getHeight(),\n                               0.0);\n    }\n\n    @Test\n    public void testGetRenderingInformation_FloatingHeaderSelected_FloatingColumns() {\n        final double gridWidgetLocationY = -uiRow1.getHeight() - 5;\n        final double gridWidgetLocationX = -uiColumn1.getWidth() - 5;\n        when(gridWidget.isSelected()).thenReturn(true);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(gridWidgetLocationX, gridWidgetLocationY));\n\n        final BaseGridRendererHelper.RenderingInformation renderingInformation = helper.getRenderingInformation();\n        assertRenderingInformation(renderingInformation,\n                                   false,\n                                   true,\n                                   Collections.singletonList(uiColumn2),\n                                   1,\n                                   uiModel.getRowCount() - 1,\n                                   Arrays.asList(uiRow1.getHeight(), uiRow2.getHeight(), uiRow3.getHeight()),\n                                   Arrays.asList(uiRow1.getHeight(), uiRow1.getHeight() + uiRow2.getHeight()),\n                                   uiModel.getHeaderRowCount(),\n                                   HEADER_ROW_HEIGHT,\n                                   HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount(),\n                                   HEADER_HEIGHT - HEADER_ROW_HEIGHT * uiModel.getHeaderRowCount());\n\n        assertBlockInformation(renderingInformation.getBodyBlockInformation(),\n                               Collections.singletonList(uiColumn2),\n                               uiColumn1.getWidth(),\n                               -gridWidgetLocationY,\n                               HEADER_HEIGHT + uiRow1.getHeight(),\n                               uiColumn2.getWidth());\n        assertBlockInformation(renderingInformation.getFloatingBlockInformation(),\n                               Collections.singletonList(uiColumn1),\n                               -gridWidgetLocationX,\n                               -gridWidgetLocationY,\n                               HEADER_HEIGHT + uiRow1.getHeight(),\n                               uiColumn1.getWidth());\n    }\n\n    @Test\n    public void testGetColumnInformation_FixedHeaderSelected_NoFloatingColumns() {\n        when(gridWidget.isSelected()).thenReturn(true);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(0, 0));\n\n        final BaseGridRendererHelper.ColumnInformation columnInformation = helper.getColumnInformation(uiColumn1.getWidth() / 2);\n        assertColumnInformation(columnInformation,\n                                uiColumn1,\n                                0,\n                                0.0);\n    }\n\n    @Test\n    public void testGetColumnInformation_FixedHeaderSelected_FloatingColumns() {\n        final double gridWidgetLocationX = -5;\n        when(gridWidget.isSelected()).thenReturn(true);\n        when(gridLayer.getVisibleBounds()).thenReturn(new BaseBounds(0, 0, BOUNDS_WIDTH, BOUNDS_HEIGHT));\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(gridWidgetLocationX, 0));\n\n        final BaseGridRendererHelper.ColumnInformation columnInformation = helper.getColumnInformation(uiColumn1.getWidth() / 2);\n        assertColumnInformation(columnInformation,\n                                uiColumn1,\n                                0,\n                                -gridWidgetLocationX);\n    }\n\n    private void assertRenderingInformation(final BaseGridRendererHelper.RenderingInformation renderingInformation,\n                                            final boolean expectedIsFixedHeader,\n                                            final boolean expectedIsFloatingHeader,\n                                            final List<GridColumn<?>> expectedAllColumns,\n                                            final int expectedMinVisibleRowIndex,\n                                            final int expectedMaxVisibleRowIndex,\n                                            final List<Double> expectedAllRowHeights,\n                                            final List<Double> expectedVisibleRowOffsets,\n                                            final int expectedHeaderRowCount,\n                                            final double expectedHeaderRowHeight,\n                                            final double expectedHeaderRowsHeight,\n                                            final double expectedHeaderRowsYOffset) {\n        assertThat(renderingInformation).isNotNull();\n        assertThat(renderingInformation.isFixedHeader()).isEqualTo(expectedIsFixedHeader);\n        assertThat(renderingInformation.isFloatingHeader()).isEqualTo(expectedIsFloatingHeader);\n        assertThat(renderingInformation.getAllColumns()).containsSequence(expectedAllColumns);\n        assertThat(renderingInformation.getMinVisibleRowIndex()).isEqualTo(expectedMinVisibleRowIndex);\n        assertThat(renderingInformation.getMaxVisibleRowIndex()).isEqualTo(expectedMaxVisibleRowIndex);\n        assertThat(renderingInformation.getAllRowHeights()).containsSequence(expectedAllRowHeights);\n        assertThat(renderingInformation.getVisibleRowOffsets()).containsSequence(expectedVisibleRowOffsets);\n        assertThat(renderingInformation.getHeaderRowCount()).isEqualTo(expectedHeaderRowCount);\n        assertThat(renderingInformation.getHeaderRowHeight()).isEqualTo(expectedHeaderRowHeight);\n        assertThat(renderingInformation.getHeaderRowsHeight()).isEqualTo(expectedHeaderRowsHeight);\n        assertThat(renderingInformation.getHeaderRowsYOffset()).isEqualTo(expectedHeaderRowsYOffset);\n    }\n\n    private void assertBlockInformation(final BaseGridRendererHelper.RenderingBlockInformation blockInformation,\n                                        final List<GridColumn<?>> expectedBlockColumns,\n                                        final double expectedBlockOffsetX,\n                                        final double expectedBlockHeaderYOffset,\n                                        final double expectedBlockBodyYOffset,\n                                        final double expectedBlockWidth) {\n        assertThat(blockInformation).isNotNull();\n        assertThat(blockInformation.getColumns()).containsSequence(expectedBlockColumns);\n        assertThat(blockInformation.getX()).isEqualTo(expectedBlockOffsetX);\n        assertThat(blockInformation.getHeaderY()).isEqualTo(expectedBlockHeaderYOffset);\n        assertThat(blockInformation.getBodyY()).isEqualTo(expectedBlockBodyYOffset);\n        assertThat(blockInformation.getWidth()).isEqualTo(expectedBlockWidth);\n    }\n\n    private void assertColumnInformation(final BaseGridRendererHelper.ColumnInformation columnInformation,\n                                         final GridColumn<?> expectedColumn,\n                                         final int expectedUiColumnIndex,\n                                         final double expectedOffsetX) {\n        assertThat(columnInformation).isNotNull();\n        assertThat(columnInformation.getColumn()).isEqualTo(expectedColumn);\n        assertThat(columnInformation.getUiColumnIndex()).isEqualTo(expectedUiColumnIndex);\n        assertThat(columnInformation.getOffsetX()).isEqualTo(expectedOffsetX);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererNonSelectionLayerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.client.core.shape.MultiPath;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderBodyGridBackgroundCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderGridBoundaryCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderHeaderBackgroundCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderHeaderGridLinesCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderSelectorCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RendererCommand;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyList;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.makeRenderingInformation;\n\n@WithClassesToStub({Text.class})\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridRendererNonSelectionLayerTest extends BaseGridRendererTest {\n\n    @Override\n    protected boolean isSelectionLayer() {\n        return false;\n    }\n\n    @Test\n    public void checkRenderSelector() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n\n        final RendererCommand command = renderer.renderSelector(WIDTH,\n                                                                HEIGHT,\n                                                                ri);\n\n        assertNotNull(command);\n        assertRenderingCommands(Collections.singletonList(command),\n                                RenderSelectorCommand.class);\n\n        command.execute(rc);\n\n        final ArgumentCaptor<MultiPath> selectorCaptor = ArgumentCaptor.forClass(MultiPath.class);\n        verify(parent).add(selectorCaptor.capture());\n\n        final MultiPath selector = selectorCaptor.getValue();\n        assertEquals(WIDTH,\n                     selector.getBoundingBox().getWidth(),\n                     0.5);\n        assertEquals(HEIGHT,\n                     selector.getBoundingBox().getHeight(),\n                     0.5);\n    }\n\n    @Test\n    public void checkSelectedCellsClippedByHeader() {\n        checkRenderedSelectedCells(0,\n                                   0,\n                                   1,\n                                   3,\n                                   1,\n                                   2,\n                                   column.getWidth());\n    }\n\n    @Test\n    public void checkSelectedCellsNotClippedByHeader() {\n        checkRenderedSelectedCells(0,\n                                   0,\n                                   1,\n                                   3,\n                                   0,\n                                   2,\n                                   column.getWidth());\n    }\n\n    @Test\n    public void checkSelectedCellsWithHiddenColumnSingleColumn() {\n        column.setVisible(false);\n        checkRenderedSelectedCells(0,\n                                   0,\n                                   1,\n                                   3,\n                                   0,\n                                   2,\n                                   0.0);\n    }\n\n    @Test\n    public void checkSelectedCellsWithHiddenColumnMultipleColumns() {\n        final GridColumn<String> column2 = makeGridColumn(200.0);\n        this.model.appendColumn(column2);\n        setupSelectionContext();\n\n        checkRenderedSelectedCells(0,\n                                   0,\n                                   2,\n                                   1,\n                                   0,\n                                   0,\n                                   column.getWidth() + column2.getWidth());\n    }\n\n    @Test\n    public void checkSelectedCellsWithHiddenColumnMultipleColumnsFirstHidden() {\n        final GridColumn<String> column2 = makeGridColumn(200.0);\n        this.model.appendColumn(column2);\n        this.column.setVisible(false);\n        setupSelectionContext();\n\n        checkRenderedSelectedCells(0,\n                                   0,\n                                   2,\n                                   1,\n                                   0,\n                                   0,\n                                   column2.getWidth());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void checkRenderHeader() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n        final GridHeaderRenderContext context = mock(GridHeaderRenderContext.class);\n        doReturn(model.getColumns()).when(context).getAllColumns();\n        doReturn(model.getColumns()).when(context).getBlockColumns();\n\n        final List<RendererCommand> commands = renderer.renderHeader(model,\n                                                                     context,\n                                                                     rendererHelper,\n                                                                     ri);\n        assertThat(commands).isNotNull();\n        assertThat(commands).asList().hasSize(2);\n        assertRenderingCommands(commands,\n                                RenderHeaderBackgroundCommand.class, RenderHeaderGridLinesCommand.class);\n\n        //Check the ColumnRenderer was asked to contribute towards the rendering\n        //It is mocked in this test and hence we cannot verify it actually did anything.\n        verify(columnRenderer).renderHeader(anyList(),\n                                            any(GridHeaderColumnRenderContext.class),\n                                            eq(ri),\n                                            any(BiFunction.class));\n\n        //Notional check for background rendering\n        final ArgumentCaptor<Rectangle> rectangleCaptor = ArgumentCaptor.forClass(Rectangle.class);\n\n        commands.stream().filter(c -> c instanceof RenderHeaderBackgroundCommand).findFirst().ifPresent(c -> c.execute(rc));\n\n        verify(parent).add(rectangleCaptor.capture());\n\n        assertRenderedRectangle(rectangleCaptor.getValue(),\n                                column.getWidth(),\n                                BaseGridWidgetRenderingTestUtils.HEADER_HEIGHT);\n\n        //Notional check for header/body divider\n        reset(parent);\n        final ArgumentCaptor<Line> lineCaptor = ArgumentCaptor.forClass(Line.class);\n\n        commands.stream().filter(c -> c instanceof RenderHeaderGridLinesCommand).findFirst().ifPresent(c -> c.execute(rc));\n\n        verify(parent).add(lineCaptor.capture());\n\n        final Line line = lineCaptor.getValue();\n        assertEquals(column.getWidth(),\n                     line.getBoundingBox().getWidth(),\n                     0.5);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void checkRenderBody() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n        final GridBodyRenderContext context = mock(GridBodyRenderContext.class);\n        doReturn(0).when(context).getMinVisibleRowIndex();\n        doReturn(model.getRowCount() - 1).when(context).getMaxVisibleRowIndex();\n        doReturn(model.getColumns()).when(context).getBlockColumns();\n\n        final List<RendererCommand> commands = renderer.renderBody(model,\n                                                                   context,\n                                                                   rendererHelper,\n                                                                   ri);\n        assertThat(commands).isNotNull();\n        assertThat(commands).asList().hasSize(1);\n        assertThat(commands).asList().hasOnlyOneElementSatisfying(o -> assertTrue(o instanceof RenderBodyGridBackgroundCommand));\n\n        //Check the ColumnRenderer was asked to contribute towards the rendering\n        //It is mocked in this test and hence we cannot verify it actually did anything.\n        verify(columnRenderer).renderColumn(eq(column),\n                                            any(GridBodyColumnRenderContext.class),\n                                            eq(rendererHelper),\n                                            eq(ri),\n                                            any(BiFunction.class));\n\n        //Notional check for background rendering\n        final ArgumentCaptor<Rectangle> rectangleCaptor = ArgumentCaptor.forClass(Rectangle.class);\n\n        commands.get(0).execute(rc);\n\n        verify(parent).add(rectangleCaptor.capture());\n\n        assertRenderedRectangle(rectangleCaptor.getValue(),\n                                column.getWidth(),\n                                ri.getVisibleRowOffsets().get(2) + HEADER_ROW_HEIGHT);\n    }\n\n    @Test\n    public void checkRenderBoundary() {\n        final double WIDTH = 100.0;\n        final double HEIGHT = 200.0;\n        final GridBoundaryRenderContext context = new GridBoundaryRenderContext(0, 0, WIDTH, HEIGHT);\n\n        final RendererCommand command = renderer.renderGridBoundary(context);\n\n        assertNotNull(command);\n        assertRenderingCommands(Collections.singletonList(command),\n                                RenderGridBoundaryCommand.class);\n\n        command.execute(rc);\n\n        final ArgumentCaptor<Rectangle> boundaryCaptor = ArgumentCaptor.forClass(Rectangle.class);\n        verify(parent).add(boundaryCaptor.capture());\n\n        assertRenderedRectangle(boundaryCaptor.getValue(),\n                                WIDTH,\n                                HEIGHT);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void checkRenderedSelectedCells(final int selectionRowIndex,\n                                            final int selectionColumnIndex,\n                                            final int selectionColumnCount,\n                                            final int selectionRowCount,\n                                            final int minVisibleRowIndex,\n                                            final int maxVisibleRowIndex,\n                                            final double expectedSelectionWidth) {\n        this.model.selectCells(selectionRowIndex,\n                               selectionColumnIndex,\n                               selectionColumnCount,\n                               selectionRowCount);\n        when(context.getMinVisibleRowIndex()).thenReturn(minVisibleRowIndex);\n        when(context.getMaxVisibleRowIndex()).thenReturn(maxVisibleRowIndex);\n\n        final double[] actualSelectionWidth = new double[]{0.0};\n        doAnswer((i) -> {\n            actualSelectionWidth[0] = (double) i.callRealMethod();\n            return actualSelectionWidth[0];\n        }).when(renderer).getSelectedRangeWidth(anyList(), anyInt(), any(SelectedRange.class));\n\n        renderer.renderSelectedCells(model,\n                                     context,\n                                     rendererHelper,\n                                     model.getSelectedCells(),\n                                     (uiRowIndex, minVisibleUiRowIndex) -> 0.0,\n                                     selectedRange -> 0.0).execute(rc);\n\n        verify(renderer,\n               times(1)).renderSelectedRange(columnsCaptor.capture(),\n                                             eq(selectionColumnIndex),\n                                             selectedRangeCaptor.capture(),\n                                             any(Function.class));\n\n        final List<GridColumn<?>> columns = columnsCaptor.getValue();\n        assertNotNull(columns);\n        assertEquals(selectionColumnCount,\n                     columns.size());\n        assertEquals(column,\n                     columns.get(0));\n\n        final SelectedRange selectedRange = selectedRangeCaptor.getValue();\n        assertNotNull(selectedRange);\n        assertEquals(selectionColumnIndex,\n                     selectedRange.getUiColumnIndex());\n        assertEquals(minVisibleRowIndex,\n                     selectedRange.getUiRowIndex());\n        assertEquals(selectionColumnCount,\n                     selectedRange.getWidth());\n        assertEquals(maxVisibleRowIndex - minVisibleRowIndex + 1,\n                     selectedRange.getHeight());\n\n        assertEquals(expectedSelectionWidth,\n                     actualSelectionWidth[0],\n                     0.0);\n    }\n\n    @SafeVarargs\n    private final void assertRenderingCommands(final List<RendererCommand> actualCommands,\n                                               final Class<? extends RendererCommand>... expectedTypes) {\n        assertThat(actualCommands).asList().hasOnlyElementsOfTypes(expectedTypes);\n        Arrays.asList(expectedTypes).forEach(type -> assertThat(actualCommands).asList().filteredOn(type::isInstance).hasSize(1));\n    }\n\n    private void assertRenderedRectangle(final Rectangle rectangle,\n                                         final double expectedWidth,\n                                         final double expectedHeight) {\n        assertEquals(expectedWidth,\n                     rectangle.getWidth(),\n                     0.5);\n        assertEquals(expectedHeight,\n                     rectangle.getHeight(),\n                     0.5);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererSelectionLayerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBoundaryRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderColumnRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderBodyGridBackgroundCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderGridBoundaryCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderHeaderBackgroundCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderHeaderGridLinesCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RenderSelectorCommand;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.RendererCommand;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.ArgumentMatchers.anyList;\nimport static org.mockito.ArgumentMatchers.anyObject;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.HEADER_ROW_HEIGHT;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.makeRenderingInformation;\n\n@WithClassesToStub({Text.class})\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseGridRendererSelectionLayerTest extends BaseGridRendererTest {\n\n    @Override\n    protected boolean isSelectionLayer() {\n        return true;\n    }\n\n    @Test\n    public void checkRenderSelector() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n\n        final RendererCommand command = renderer.renderSelector(WIDTH,\n                                                                HEIGHT,\n                                                                ri);\n\n        assertNotNull(command);\n        assertRenderingCommands(Collections.singletonList(command),\n                                RenderSelectorCommand.class);\n\n        command.execute(rc);\n\n        verify(parent, never()).add(anyObject());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void checkSelectedCells() {\n        this.model.selectCells(0, 0, 1, 1);\n        when(context.getMinVisibleRowIndex()).thenReturn(0);\n        when(context.getMaxVisibleRowIndex()).thenReturn(1);\n\n        renderer.renderSelectedCells(model,\n                                     context,\n                                     rendererHelper,\n                                     model.getSelectedCells(),\n                                     (uiRowIndex, minVisibleUiRowIndex) -> 0.0,\n                                     selectedRange -> 0.0).execute(rc);\n\n        verify(renderer, never()).renderSelectedRange(anyList(),\n                                                      anyInt(),\n                                                      any(SelectedRange.class),\n                                                      any(Function.class));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void checkRenderHeader() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n        final GridHeaderRenderContext context = mock(GridHeaderRenderContext.class);\n        doReturn(model.getColumns()).when(context).getAllColumns();\n        doReturn(model.getColumns()).when(context).getBlockColumns();\n\n        final List<RendererCommand> commands = renderer.renderHeader(model,\n                                                                     context,\n                                                                     rendererHelper,\n                                                                     ri);\n        assertThat(commands).isNotNull();\n        assertThat(commands).asList().hasSize(2);\n        assertRenderingCommands(commands,\n                                RenderHeaderBackgroundCommand.class, RenderHeaderGridLinesCommand.class);\n\n        //Check the ColumnRenderer was asked to contribute towards the rendering\n        //It is mocked in this test and hence we cannot verify it actually did anything.\n        verify(columnRenderer).renderHeader(anyList(),\n                                            any(GridHeaderColumnRenderContext.class),\n                                            eq(ri),\n                                            any(BiFunction.class));\n\n        //Notional check for background rendering\n        commands.stream().filter(c -> c instanceof RenderHeaderBackgroundCommand).findFirst().ifPresent(c -> c.execute(rc));\n        verify(parent, never()).add(anyObject());\n\n        //Notional check for header/body divider\n        reset(parent);\n        commands.stream().filter(c -> c instanceof RenderHeaderGridLinesCommand).findFirst().ifPresent(c -> c.execute(rc));\n        verify(parent, never()).add(anyObject());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void checkRenderBody() {\n        final BaseGridRendererHelper.RenderingInformation ri = makeRenderingInformation(model,\n                                                                                        Arrays.asList(0d, HEADER_ROW_HEIGHT, HEADER_ROW_HEIGHT * 2));\n        final GridBodyRenderContext context = mock(GridBodyRenderContext.class);\n        doReturn(0).when(context).getMinVisibleRowIndex();\n        doReturn(model.getRowCount() - 1).when(context).getMaxVisibleRowIndex();\n        doReturn(model.getColumns()).when(context).getBlockColumns();\n\n        final List<RendererCommand> commands = renderer.renderBody(model,\n                                                                   context,\n                                                                   rendererHelper,\n                                                                   ri);\n        assertThat(commands).isNotNull();\n        assertThat(commands).asList().hasSize(1);\n        assertThat(commands).asList().hasOnlyOneElementSatisfying(o -> assertTrue(o instanceof RenderBodyGridBackgroundCommand));\n\n        //Check the ColumnRenderer was asked to contribute towards the rendering\n        //It is mocked in this test and hence we cannot verify it actually did anything.\n        verify(columnRenderer).renderColumn(eq(column),\n                                            any(GridBodyColumnRenderContext.class),\n                                            eq(rendererHelper),\n                                            eq(ri),\n                                            any(BiFunction.class));\n\n        commands.get(0).execute(rc);\n\n        verify(parent, never()).add(anyObject());\n    }\n\n    @Test\n    public void checkRenderBoundary() {\n        final double WIDTH = 100.0;\n        final double HEIGHT = 200.0;\n        final GridBoundaryRenderContext context = new GridBoundaryRenderContext(0, 0, WIDTH, HEIGHT);\n\n        final RendererCommand command = renderer.renderGridBoundary(context);\n\n        assertNotNull(command);\n        assertRenderingCommands(Collections.singletonList(command),\n                                RenderGridBoundaryCommand.class);\n\n        command.execute(rc);\n\n        verify(parent, never()).add(anyObject());\n    }\n\n    @SafeVarargs\n    private final void assertRenderingCommands(final List<RendererCommand> actualCommands,\n                                               final Class<? extends RendererCommand>... expectedTypes) {\n        assertThat(actualCommands).asList().hasOnlyElementsOfTypes(expectedTypes);\n        Arrays.asList(expectedTypes).forEach(type -> assertThat(actualCommands).asList().filteredOn(type::isInstance).hasSize(1));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/renderers/grids/impl/BaseGridRendererTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Objects;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.GridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridHeaderRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.columns.StringPopupColumn;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.columns.GridColumnRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer.GridRendererContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.SelectionsTransformer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingBlockInformation;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.GridRendererTheme;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.themes.impl.BlueTheme;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.anyList;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidgetRenderingTestUtils.makeRenderingInformation;\nimport static org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper.RenderingInformation;\n\npublic abstract class BaseGridRendererTest {\n\n    protected static final double WIDTH = 100.0;\n\n    protected static final double HEIGHT = 200.0;\n\n    @Mock\n    protected GridColumnRenderer<String> columnRenderer;\n\n    @Mock\n    protected GridBodyRenderContext context;\n\n    @Mock\n    protected BaseGridRendererHelper rendererHelper;\n\n    @Mock\n    protected RenderingInformation renderingInformation;\n\n    @Mock\n    protected Group parent;\n\n    @Mock\n    protected GridRendererContext rc;\n\n    @Captor\n    protected ArgumentCaptor<List<GridColumn<?>>> columnsCaptor;\n\n    @Captor\n    protected ArgumentCaptor<SelectedRange> selectedRangeCaptor;\n\n    protected GridData model;\n\n    protected GridColumn<String> column;\n\n    protected GridRendererTheme theme = new BlueTheme();\n\n    protected BaseGridRenderer renderer;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n        final BaseGridRenderer wrapped = new BaseGridRenderer(theme);\n        this.renderer = spy(wrapped);\n\n        this.column = makeGridColumn(100.0);\n\n        this.model = new BaseGridData();\n        this.model.appendColumn(column);\n        this.model.appendRow(new BaseGridRow());\n        this.model.appendRow(new BaseGridRow());\n        this.model.appendRow(new BaseGridRow());\n\n        setupSelectionContext();\n\n        doCallRealMethod().when(rendererHelper).getWidth(anyList());\n\n        when(rc.getGroup()).thenReturn(parent);\n        when(rc.isSelectionLayer()).thenReturn(isSelectionLayer());\n    }\n\n    @Test\n    public void checkRenderHeaderWhenColumnsHaveNoMetaData() {\n        column.getHeaderMetaData().clear();\n\n        final RenderingInformation ri = makeRenderingInformation(model);\n        final GridHeaderRenderContext context = mock(GridHeaderRenderContext.class);\n\n        final List<GridRenderer.RendererCommand> commands = renderer.renderHeader(model,\n                                                                                  context,\n                                                                                  rendererHelper,\n                                                                                  ri);\n        assertThat(commands).isNotNull();\n        assertThat(commands).asList().hasSize(0);\n    }\n\n    protected GridColumn<String> makeGridColumn(final double width) {\n        return new StringPopupColumn(new BaseHeaderMetaData(\"title\"),\n                                     columnRenderer,\n                                     width);\n    }\n\n    protected void setupSelectionContext() {\n        final SelectionsTransformer selectionsTransformer = new DefaultSelectionsTransformer(model,\n                                                                                             model.getColumns());\n\n        when(context.getBlockColumns()).thenReturn(model.getColumns());\n        when(context.getTransformer()).thenReturn(selectionsTransformer);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testMakeCellHighlight() {\n        final int rowIndex = 1;\n        final int visibleRowIndex = 2;\n        final List<Double> allRowHeights = new ArrayList<>();\n        final GridData model = mock(GridData.class);\n        final GridRendererTheme theme = mock(GridRendererTheme.class);\n        final Rectangle rectangle = mock(Rectangle.class);\n        when(theme.getHighlightedCellBackground()).thenReturn(rectangle);\n        when(rectangle.setListening(false)).thenReturn(rectangle);\n        renderer.setTheme(theme);\n\n        doNothing().when(renderer).setCellHighlightX(rectangle, context, rendererHelper);\n        doNothing().when(renderer).setCellHighlightY(rectangle, rendererHelper, visibleRowIndex, model);\n        doNothing().when(renderer).setCellHighlightSize(rectangle, model, column, allRowHeights, rowIndex);\n\n        final Rectangle current = renderer.makeCellHighlight(rowIndex,\n                                                             visibleRowIndex,\n                                                             model,\n                                                             rendererHelper,\n                                                             renderingInformation,\n                                                             column,\n                                                             context);\n\n        assertEquals(rectangle, current);\n    }\n\n    @Test\n    public void testSetCellHighlightY() {\n        final int visibleRowIndex = 2;\n        final Rectangle rectangle = mock(Rectangle.class);\n        final double y = 190;\n        final GridCell cell = mock(GridCell.class);\n        final int rowIndex = 5;\n        final int columnIndex = 1;\n\n        when(rendererHelper.getRowOffset(visibleRowIndex)).thenReturn(y);\n        doReturn(rowIndex).when(renderer).getHighlightCellRowIndex();\n        doReturn(columnIndex).when(renderer).getHighlightCellColumnIndex();\n        final GridData dataModel = mock(GridData.class);\n\n        when(dataModel.getCell(rowIndex, columnIndex)).thenReturn(cell);\n        when(cell.isMerged()).thenReturn(false);\n\n        renderer.setCellHighlightY(rectangle, rendererHelper, visibleRowIndex, dataModel);\n\n        verify(rectangle).setY(y);\n    }\n\n    @Test\n    public void testSetCellHighlightYWithMergedCell() {\n        final int visibleRowIndex = 2;\n        final Rectangle rectangle = mock(Rectangle.class);\n        final double y = 190;\n        final GridCell cell = mock(GridCell.class);\n        final int rowIndex = 5;\n        final int columnIndex = 1;\n        final int firstMergedCellIndex = 3;\n        when(rendererHelper.getRowOffset(firstMergedCellIndex)).thenReturn(y);\n        doReturn(rowIndex).when(renderer).getHighlightCellRowIndex();\n        doReturn(columnIndex).when(renderer).getHighlightCellColumnIndex();\n        final GridData dataModel = mock(GridData.class);\n\n        when(dataModel.getCell(rowIndex, columnIndex)).thenReturn(cell);\n        when(cell.isMerged()).thenReturn(true);\n        doReturn(firstMergedCellIndex).when(renderer).getFirstRowIndexOfMergedBlock(dataModel, visibleRowIndex);\n\n        renderer.setCellHighlightY(rectangle, rendererHelper, visibleRowIndex, dataModel);\n\n        verify(rectangle).setY(y);\n    }\n\n    @Test\n    public void setCellHighlightX() {\n        final RenderingInformation renderingInformation = mock(RenderingInformation.class);\n        final RenderingBlockInformation floatingBlockInformation = mock(RenderingBlockInformation.class);\n        final List<GridColumn<?>> fakeList = mock(List.class);\n        when(floatingBlockInformation.getColumns()).thenReturn(fakeList);\n        when(fakeList.size()).thenReturn(1);\n        final Rectangle rectangle = mock(Rectangle.class);\n        final double columnOffsetX = 77;\n        final int columnIndex = 3;\n        final double xOffset = 128;\n        final double expectedOffset = xOffset - columnOffsetX;\n\n        when(renderingInformation.getFloatingBlockInformation()).thenReturn(floatingBlockInformation);\n        when(context.getAbsoluteColumnOffsetX()).thenReturn(columnOffsetX);\n        final GridColumn<?> column = mock(GridColumn.class);\n        when(column.getIndex()).thenReturn(columnIndex);\n\n        when(rendererHelper.getColumnOffset(columnIndex)).thenReturn(xOffset);\n\n        renderer.highlightCell(columnIndex, 0);\n        renderer.setCellHighlightX(rectangle, context, rendererHelper);\n\n        verify(rectangle).setX(expectedOffset);\n    }\n\n    @Test\n    public void testSetCellHighlightSize() {\n        final Rectangle rectangle = mock(Rectangle.class);\n        final GridData model = mock(GridData.class);\n        final GridColumn<?> column = mock(GridColumn.class);\n        final double width = 100;\n        final int rowIndex = 4;\n        final GridRow row = mock(GridRow.class);\n        final double height = 20;\n        when(column.getWidth()).thenReturn(width);\n        when(model.getRow(rowIndex)).thenReturn(row);\n        doReturn(1).when(renderer).getMergedCellsCount(model, rowIndex);\n\n        renderer.setCellHighlightSize(rectangle, model, column, Collections.nCopies(5, height), rowIndex);\n\n        verify(rectangle).setWidth(width);\n        verify(rectangle).setHeight(height);\n    }\n\n    @Test\n    public void testGetMergedCellsCount() {\n        final GridData model = mock(GridData.class);\n        final GridCell cell = mock(GridCell.class);\n        final int rowIndex = 0;\n        final int columnIndex = 1;\n        final int mergedCellsCount = 1;\n\n        when(renderer.getHighlightCellColumnIndex()).thenReturn(columnIndex);\n        when(model.getCell(rowIndex, columnIndex)).thenReturn(cell);\n        when(cell.getMergedCellCount()).thenReturn(mergedCellsCount);\n\n        final int actual = renderer.getMergedCellsCount(model, rowIndex);\n\n        assertEquals(mergedCellsCount, actual);\n    }\n\n    @Test\n    public void testRenderHighlightedCells() {\n\n        final RenderingInformation renderingInformation = mock(RenderingInformation.class);\n        final List<GridColumn<?>> columnsList = new ArrayList<>();\n        columnsList.add(column);\n        final GridData dataModel = mock(GridData.class);\n\n        doReturn(1).when(renderer).getHighlightCellRowIndex();\n        doReturn(0).when(renderer).getHighlightCellColumnIndex();\n        when(renderingInformation.getMinVisibleRowIndex()).thenReturn(1);\n        when(dataModel.getColumns()).thenReturn(columnsList);\n\n        final GridRenderer.RendererCommand result = renderer.renderHighlightedCells(dataModel, context, rendererHelper, renderingInformation);\n\n        assertNotNull(result);\n    }\n\n    @Test\n    public void testGetRendererCommand() {\n\n        final int highlightCellRowIndex = 0;\n        final GridData dataModel = mock(GridData.class);\n        final int visibleRowIndex = 0;\n        final List<GridColumn<?>> columnsList = new ArrayList<>();\n        columnsList.add(column);\n        final GridRendererContext rc = mock(GridRendererContext.class);\n        final Group group = mock(Group.class);\n        final Rectangle rectangle = mock(Rectangle.class);\n\n        doReturn(highlightCellRowIndex).when(renderer).getHighlightCellRowIndex();\n        when(dataModel.getColumns()).thenReturn(columnsList);\n        when(rc.getGroup()).thenReturn(group);\n        when(rc.isSelectionLayer()).thenReturn(false);\n\n        doReturn(rectangle).when(renderer).makeCellHighlight(highlightCellRowIndex,\n                                                             visibleRowIndex,\n                                                             dataModel,\n                                                             rendererHelper,\n                                                             renderingInformation,\n                                                             column,\n                                                             context);\n\n        final GridRenderer.RendererCommand cmd = renderer.getRendererCommand(dataModel,\n                                                                             context,\n                                                                             rendererHelper,\n                                                                             renderingInformation,\n                                                                             column,\n                                                                             visibleRowIndex);\n\n        cmd.execute(rc);\n\n        verify(group).add(rectangle);\n    }\n\n    @Test\n    public void testAddRenderHighlightedCellsCommand() {\n\n        final GridData dataModel = mock(GridData.class);\n        final RenderingInformation renderingInformation = mock(RenderingInformation.class);\n        final List<GridRenderer.RendererCommand> commands = mock(List.class);\n        final int columnIndex = 1;\n        final int rowIndex = 1;\n        final GridRenderer.RendererCommand cmd = mock(GridRenderer.RendererCommand.class);\n\n        doReturn(columnIndex).when(renderer).getHighlightCellColumnIndex();\n        doReturn(rowIndex).when(renderer).getHighlightCellRowIndex();\n        doReturn(cmd).when(renderer).renderHighlightedCells(dataModel,\n                                                            context,\n                                                            rendererHelper,\n                                                            renderingInformation);\n\n        renderer.addRenderHighlightedCellsCommand(dataModel,\n                                                  context,\n                                                  rendererHelper,\n                                                  renderingInformation,\n                                                  commands);\n\n        verify(commands).add(cmd);\n    }\n\n    @Test\n    public void testClearCellHighlight() {\n\n        renderer.highlightCell(0, 0);\n        renderer.clearCellHighlight();\n\n        final Integer rowIndex = renderer.getHighlightCellRowIndex();\n        final Integer columnIndex = renderer.getHighlightCellColumnIndex();\n\n        assertTrue(Objects.isNull(rowIndex));\n        assertTrue(Objects.isNull(columnIndex));\n    }\n\n    @Test\n    public void testGetFirstRowIndexOfMergedBlock() {\n\n        final GridData dataModel = mock(GridData.class);\n        final int rowIndex = 2;\n\n        final GridCell cell2 = mock(GridCell.class);\n        when(cell2.getMergedCellCount()).thenReturn(0);\n        when(dataModel.getCell(2, 0)).thenReturn(cell2);\n\n        final GridCell cell1 = mock(GridCell.class);\n        when(cell1.getMergedCellCount()).thenReturn(1);\n        when(dataModel.getCell(1, 0)).thenReturn(cell1);\n\n        renderer.highlightCell(0, 0);\n        final int actual = renderer.getFirstRowIndexOfMergedBlock(dataModel, rowIndex);\n\n        assertEquals(1, actual);\n    }\n\n    protected abstract boolean isSelectionLayer();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/SelectionExtensionTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(Parameterized.class)\npublic class SelectionExtensionTest {\n\n    @Parameterized.Parameter(0)\n    public SelectionExtension extension;\n    @Parameterized.Parameter(1)\n    public int deltaX;\n    @Parameterized.Parameter(2)\n    public int deltaY;\n    @Parameterized.Parameter(3)\n    public int expectedX1;\n    @Parameterized.Parameter(4)\n    public int expectedX2;\n    @Parameterized.Parameter(5)\n    public int expectedY1;\n    @Parameterized.Parameter(6)\n    public int expectedY2;\n\n    @Parameterized.Parameters\n    public static Object[][] data() {\n        return new Object[][]{\n                {SelectionExtension.LEFT, -1, 0, 9, 4, 10, 5},\n                {SelectionExtension.RIGHT, 1, 0, 11, 6, 10, 5},\n                {SelectionExtension.UP, 0, -1, 10, 5, 9, 4},\n                {SelectionExtension.DOWN, 0, 1, 10, 5, 11, 6}\n        };\n    }\n\n    @Test\n    public void check() {\n        assertEquals(deltaX,\n                     extension.getDeltaX());\n        assertEquals(deltaY,\n                     extension.getDeltaY());\n        assertEquals(expectedX1,\n                     extension.getNextX(5,\n                                        10,\n                                        5));\n        assertEquals(expectedX2,\n                     extension.getNextX(5,\n                                        10,\n                                        10));\n        assertEquals(expectedY1,\n                     extension.getNextY(5,\n                                        10,\n                                        5));\n        assertEquals(expectedY2,\n                     extension.getNextY(5,\n                                        10,\n                                        10));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/BaseCellSelectionManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.GridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCell;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseHeaderMetaData;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellEditContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.context.GridBodyCellRenderContext;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.impl.BaseGridRendererHelper;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.SelectionExtension;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BaseCellSelectionManagerTest {\n\n    private static final double HEADER_HEIGHT = 32.0;\n\n    private static final double ROW_HEIGHT = 20.0;\n\n    private static final double GRID_ABSOLUTE_X = 15.0;\n\n    private static final double GRID_ABSOLUTE_Y = 30.0;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private DefaultGridLayer gridLayer;\n\n    @Mock\n    private GridRenderer gridWidgetRenderer;\n\n    @Mock\n    private Group gridWidgetHeader;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Transform transform;\n\n    @Captor\n    private ArgumentCaptor<GridBodyCellRenderContext> contextArgumentCaptor;\n\n    @Captor\n    private ArgumentCaptor<GridBodyCellEditContext> editContextArgumentCaptor;\n\n    private GridData gridWidgetData;\n\n    private GridColumn<String> col1 = spy(new BaseGridTest.MockMergableGridColumn<>(\"col1\",\n                                                                                    100));\n    private GridColumn<String> col2 = spy(new BaseGridTest.MockMergableGridColumn<>(\"col2\",\n                                                                                    100));\n    private GridColumn<String> col3 = spy(new BaseGridTest.MockMergableGridColumn<>(\"col3\",\n                                                                                    100));\n\n    private Bounds visibleBounds = new BaseBounds(-1000,\n                                                  -1000,\n                                                  2000,\n                                                  2000);\n\n    private CellSelectionManager cellSelectionManager;\n\n    @Before\n    public void setup() {\n        gridWidgetData = new BaseGridData();\n        gridWidgetData.appendRow(new BaseGridRow(ROW_HEIGHT));\n        gridWidgetData.appendRow(new BaseGridRow(ROW_HEIGHT));\n        gridWidgetData.appendColumn(col1);\n        gridWidgetData.appendColumn(col2);\n        gridWidgetData.appendColumn(col3);\n\n        when(gridWidget.getModel()).thenReturn(gridWidgetData);\n\n        cellSelectionManager = new BaseCellSelectionManager(gridWidget);\n        final BaseGridRendererHelper gridWidgetRendererHelper = new BaseGridRendererHelper(gridWidget);\n\n        when(gridWidget.getRenderer()).thenReturn(gridWidgetRenderer);\n        when(gridWidget.getRendererHelper()).thenReturn(gridWidgetRendererHelper);\n        when(gridWidget.getLayer()).thenReturn(gridLayer);\n        when(gridWidget.getWidth()).thenReturn(300.0);\n        when(gridWidget.getHeader()).thenReturn(gridWidgetHeader);\n        when(gridWidget.getHeight()).thenReturn(HEADER_HEIGHT + (ROW_HEIGHT * 2));\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getX()).thenReturn(0.0);\n        when(gridWidget.getY()).thenReturn(0.0);\n        when(gridWidget.getComputedLocation()).thenReturn(new Point2D(GRID_ABSOLUTE_X, GRID_ABSOLUTE_Y));\n        when(gridLayer.getVisibleBounds()).thenReturn(visibleBounds);\n        when(gridWidgetRenderer.getHeaderHeight()).thenReturn(HEADER_HEIGHT);\n        when(gridWidgetRenderer.getHeaderRowHeight()).thenReturn(HEADER_HEIGHT);\n        when(viewport.getTransform()).thenReturn(transform);\n    }\n\n    @Test\n    public void selectCellPointCoordinateOutsideGridBounds() {\n        cellSelectionManager.selectCell(new Point2D(-10,\n                                                    -10),\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertTrue(selectedCells.isEmpty());\n    }\n\n    @Test\n    public void selectCellPointCoordinateWithinGridBounds() {\n        cellSelectionManager.selectCell(new Point2D(50,\n                                                    42),\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n    }\n\n    @Test\n    public void selectCellPointCoordinateWithinGridBoundsWithShiftKey() {\n        cellSelectionManager.selectCell(new Point2D(50,\n                                                    42),\n                                        false,\n                                        false);\n        cellSelectionManager.selectCell(new Point2D(150,\n                                                    62),\n                                        true,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void selectCellPointCoordinateWithinGridBoundsWithControlKey() {\n        cellSelectionManager.selectCell(new Point2D(50,\n                                                    42),\n                                        false,\n                                        false);\n        cellSelectionManager.selectCell(new Point2D(150,\n                                                    62),\n                                        false,\n                                        true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void selectCellRowCoordinateLessThanZero() {\n        cellSelectionManager.selectCell(-1,\n                                        0,\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertTrue(selectedCells.isEmpty());\n    }\n\n    @Test\n    public void selectCellRowCoordinateGreaterThanRowCount() {\n        cellSelectionManager.selectCell(2,\n                                        0,\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertTrue(selectedCells.isEmpty());\n    }\n\n    @Test\n    public void selectCellColumnCoordinateLessThanZero() {\n        cellSelectionManager.selectCell(0,\n                                        -1,\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertTrue(selectedCells.isEmpty());\n    }\n\n    @Test\n    public void selectCellColumnCoordinateGreaterThanColumnCount() {\n        cellSelectionManager.selectCell(0,\n                                        3,\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertTrue(selectedCells.isEmpty());\n    }\n\n    @Test\n    public void selectCellWithoutShiftKeyWithoutControlKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertEquals(0,\n                     selectedCells.get(0).getRowIndex());\n        assertEquals(0,\n                     selectedCells.get(0).getColumnIndex());\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void selectCellWithShiftKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.selectCell(1,\n                                        1,\n                                        true,\n                                        false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void selectCellWithControlKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.selectCell(1,\n                                        1,\n                                        false,\n                                        true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    1)));\n    }\n\n    @Test\n    public void selectHeaderCellWithPoint() {\n        cellSelectionManager.selectHeaderCell(new Point2D(col1.getWidth() + col2.getWidth() / 2,\n                                                          HEADER_HEIGHT / 2),\n                                              false,\n                                              false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertEquals(0,\n                     selectedHeaderCells.get(0).getRowIndex());\n        assertEquals(1,\n                     selectedHeaderCells.get(0).getColumnIndex());\n        assertNull(gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void selectHeaderCellWithCoordinate() {\n        cellSelectionManager.selectHeaderCell(0,\n                                              1,\n                                              false,\n                                              false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertEquals(0,\n                     selectedHeaderCells.get(0).getRowIndex());\n        assertEquals(1,\n                     selectedHeaderCells.get(0).getColumnIndex());\n        assertNull(gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionLeft() {\n        cellSelectionManager.selectCell(0,\n                                        1,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.LEFT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionLeftAndFindVisible() {\n        // DROOLS-5442\n        when(col2.isVisible()).thenReturn(false);\n\n        cellSelectionManager.selectCell(0,\n                                        2,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.LEFT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionLeftOutOfBound() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.LEFT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionLeftWithShiftKey() {\n        cellSelectionManager.selectCell(0,\n                                        1,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.LEFT,\n                                             true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               1),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionRight() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               1),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionRightAndFindVisible() {\n        // DROOLS-5442\n        when(col2.isVisible()).thenReturn(false);\n\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    2)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               2),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionRightOutOfBound() {\n        cellSelectionManager.selectCell(0,\n                                        2,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    2)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               2),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionRightWithShiftKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT,\n                                             true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionUp() {\n        cellSelectionManager.selectCell(1,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.UP,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionUpWithShiftKey() {\n        cellSelectionManager.selectCell(1,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.UP,\n                                             true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(1,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionDown() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.DOWN,\n                                             false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(1,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionDownWithShiftKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.DOWN,\n                                             true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    0)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void adjustSelectionRightDownWithShiftKey() {\n        cellSelectionManager.selectCell(0,\n                                        0,\n                                        false,\n                                        false);\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT,\n                                             true);\n        cellSelectionManager.adjustSelection(SelectionExtension.DOWN,\n                                             true);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(0,\n                                                                    1)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    0)));\n        assertTrue(selectedCells.contains(new GridData.SelectedCell(1,\n                                                                    1)));\n        assertEquals(new GridData.SelectedCell(0,\n                                               0),\n                     gridWidgetData.getSelectedCellsOrigin());\n    }\n\n    @Test\n    public void testAdjustSelectionUpFromDataToHeader() {\n        cellSelectionManager.selectCell(0,\n                                        1,\n                                        false,\n                                        false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.UP, false);\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        Assertions.assertThat(selectedCells).isEmpty();\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).hasSize(1);\n\n        final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);\n        Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);\n        Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);\n    }\n\n    @Test\n    public void testAdjustSelectionDownFromHeaderToData() {\n        cellSelectionManager.selectHeaderCell(0,\n                                              1,\n                                              false,\n                                              false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).isEmpty();\n\n        final List<GridData.SelectedCell> selectedCells = gridWidgetData.getSelectedCells();\n        Assertions.assertThat(selectedCells).hasSize(1);\n\n        final GridData.SelectedCell selectedCell = selectedCells.get(0);\n        Assertions.assertThat(selectedCell.getColumnIndex()).isEqualTo(1);\n        Assertions.assertThat(selectedCell.getRowIndex()).isEqualTo(0);\n    }\n\n    @Test\n    public void testAdjustSelectionUpInHeader() {\n        col2.getHeaderMetaData().add(new BaseHeaderMetaData(\"col1\", \"second-row\"));\n\n        cellSelectionManager.selectHeaderCell(1,\n                                              1,\n                                              false,\n                                              false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.UP, false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).hasSize(1);\n\n        final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);\n        Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);\n        Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);\n    }\n\n    @Test\n    public void testAdjustSelectionDownInHeader() {\n        col2.getHeaderMetaData().add(new BaseHeaderMetaData(\"col1\", \"second-row\"));\n\n        cellSelectionManager.selectHeaderCell(0,\n                                              1,\n                                              false,\n                                              false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.DOWN, false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).hasSize(1);\n\n        final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);\n        Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);\n        Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(1);\n    }\n\n    @Test\n    public void testAdjustSelectionRightInHeader() {\n        cellSelectionManager.selectHeaderCell(0,\n                                              0,\n                                              false,\n                                              false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.RIGHT, false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).hasSize(1);\n\n        final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);\n        Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(1);\n        Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);\n    }\n\n    @Test\n    public void testAdjustSelectionLeftInHeader() {\n        cellSelectionManager.selectHeaderCell(0,\n                                              1,\n                                              false,\n                                              false);\n\n        cellSelectionManager.adjustSelection(SelectionExtension.LEFT, false);\n\n        final List<GridData.SelectedCell> selectedHeaderCells = gridWidgetData.getSelectedHeaderCells();\n        Assertions.assertThat(selectedHeaderCells).hasSize(1);\n\n        final GridData.SelectedCell selectedHeaderCell = selectedHeaderCells.get(0);\n        Assertions.assertThat(selectedHeaderCell.getColumnIndex()).isEqualTo(0);\n        Assertions.assertThat(selectedHeaderCell.getRowIndex()).isEqualTo(0);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void startEditingCellPointCoordinateOutsideGridBounds() {\n        cellSelectionManager.startEditingCell(new Point2D(-10,\n                                                          -10));\n        verify(col1,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellRenderContext.class),\n                             any(Consumer.class));\n        verify(col2,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellRenderContext.class),\n                             any(Consumer.class));\n\n        verify(col1,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellEditContext.class),\n                             any(Consumer.class));\n        verify(col2,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellEditContext.class),\n                             any(Consumer.class));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void startEditingCellPointCoordinateWithinGridBounds() {\n        final Point2D editedAtPoint = new Point2D(col1.getWidth() + col2.getWidth() / 2,\n                                                  HEADER_HEIGHT + ROW_HEIGHT / 2);\n\n        cellSelectionManager.startEditingCell(editedAtPoint);\n\n        verify(col2,\n               times(1)).edit(any(),\n                              contextArgumentCaptor.capture(),\n                              any(Consumer.class));\n        verify(col2,\n               times(1)).edit(any(),\n                              editContextArgumentCaptor.capture(),\n                              any(Consumer.class));\n\n        final GridBodyCellRenderContext context = contextArgumentCaptor.getValue();\n        assertEquals(0,\n                     context.getRowIndex());\n        assertEquals(1,\n                     context.getColumnIndex());\n\n        final GridBodyCellEditContext editContext = editContextArgumentCaptor.getValue();\n        assertTrue(editContext.getRelativeLocation().isPresent());\n        assertEquals(editedAtPoint.add(gridWidget.getComputedLocation()),\n                     editContext.getRelativeLocation().get());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void startEditingCellCoordinateOutsideGridBounds() {\n        cellSelectionManager.startEditingCell(-1,\n                                              -1);\n        verify(col1,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellRenderContext.class),\n                             any(Consumer.class));\n        verify(col2,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellRenderContext.class),\n                             any(Consumer.class));\n\n        verify(col1,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellEditContext.class),\n                             any(Consumer.class));\n        verify(col2,\n               never()).edit(any(GridCell.class),\n                             any(GridBodyCellEditContext.class),\n                             any(Consumer.class));\n    }\n\n    @Test\n    public void startEditingCoordinateWithinGridBoundsWithHeader() {\n        assertStartEditingCoordinateWithinGridBounds(gridWidgetHeader);\n    }\n\n    @Test\n    public void startEditingCoordinateWithinGridBoundsWithNullHeader() {\n        assertStartEditingCoordinateWithinGridBounds(null);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private void assertStartEditingCoordinateWithinGridBounds(final Group header) {\n        when(gridWidget.getHeader()).thenReturn(header);\n\n        cellSelectionManager.startEditingCell(0,\n                                              1);\n\n        verify(col2,\n               times(1)).edit(any(),\n                              contextArgumentCaptor.capture(),\n                              any(Consumer.class));\n        verify(col2,\n               times(1)).edit(any(),\n                              editContextArgumentCaptor.capture(),\n                              any(Consumer.class));\n\n        final GridBodyCellRenderContext context = contextArgumentCaptor.getValue();\n        assertEquals(0,\n                     context.getRowIndex());\n        assertEquals(1,\n                     context.getColumnIndex());\n\n        final GridBodyCellEditContext editContext = editContextArgumentCaptor.getValue();\n        assertFalse(editContext.getRelativeLocation().isPresent());\n\n        cellSelectionManager.startEditingCell(new Point2D(10, HEADER_HEIGHT + 1));\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGridBodyCellEditContextConstruction() {\n        final GridCell<String> cell = new BaseGridCell<>(new BaseGridCellValue<>(\"value\"));\n\n        gridWidgetData.setCell(0, 1, () -> cell);\n\n        cellSelectionManager.startEditingCell(0, 1);\n\n        verify(col2).edit(eq(cell),\n                          editContextArgumentCaptor.capture(),\n                          any(Consumer.class));\n\n        assertGridBodyCellEditContext(editContextArgumentCaptor.getValue(),\n                                      0,\n                                      1,\n                                      ROW_HEIGHT,\n                                      col2.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      GRID_ABSOLUTE_X + col1.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      visibleBounds.getX());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGridBodyCellEditContextConstructionWithMergedCells() {\n        final GridCell<String> cell1 = new BaseGridCell<>(new BaseGridCellValue<>(\"value\"));\n        final GridCell<String> cell2 = new BaseGridCell<>(new BaseGridCellValue<>(\"value\"));\n\n        gridWidgetData.setMerged(true);\n        gridWidgetData.setCell(0, 1, () -> cell1);\n        gridWidgetData.setCell(1, 1, () -> cell2);\n\n        cellSelectionManager.startEditingCell(0, 1);\n\n        verify(col2).edit(eq(cell1),\n                          editContextArgumentCaptor.capture(),\n                          any(Consumer.class));\n\n        assertGridBodyCellEditContext(editContextArgumentCaptor.getValue(),\n                                      0,\n                                      1,\n                                      ROW_HEIGHT * 2,\n                                      col2.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      GRID_ABSOLUTE_X + col1.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      visibleBounds.getX());\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testGridBodyCellEditContextConstructionWithMergedCellsProgrammaticEditingCollapsedCell() {\n        final GridCell<String> cell1 = new BaseGridCell<>(new BaseGridCellValue<>(\"value\"));\n        final GridCell<String> cell2 = new BaseGridCell<>(new BaseGridCellValue<>(\"value\"));\n\n        gridWidgetData.setMerged(true);\n        gridWidgetData.setCell(0, 1, () -> cell1);\n        gridWidgetData.setCell(1, 1, () -> cell2);\n\n        cellSelectionManager.startEditingCell(1, 1);\n\n        verify(col2).edit(eq(cell2),\n                          editContextArgumentCaptor.capture(),\n                          any(Consumer.class));\n\n        assertGridBodyCellEditContext(editContextArgumentCaptor.getValue(),\n                                      1,\n                                      1,\n                                      ROW_HEIGHT * 2,\n                                      col2.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      GRID_ABSOLUTE_X + col1.getWidth(),\n                                      GRID_ABSOLUTE_Y + HEADER_HEIGHT,\n                                      visibleBounds.getX());\n    }\n\n    private void assertGridBodyCellEditContext(final GridBodyCellEditContext context,\n                                               final int expectedUiRowIndex,\n                                               final int expectedUiColumnIndex,\n                                               final double expectedCellHeight,\n                                               final double expectedCellWidth,\n                                               final double expectedAbsoluteCellY,\n                                               final double expectedAbsoluteCellX,\n                                               final double expectedClipMinY,\n                                               final double expectedClipMinX) {\n        assertEquals(expectedUiRowIndex, context.getRowIndex());\n        assertEquals(expectedUiColumnIndex, context.getColumnIndex());\n        assertEquals(expectedCellHeight, context.getCellHeight(), 0.0);\n        assertEquals(expectedCellWidth, context.getCellWidth(), 0.0);\n        assertEquals(expectedAbsoluteCellY, context.getAbsoluteCellY(), 0.0);\n        assertEquals(expectedAbsoluteCellX, context.getAbsoluteCellX(), 0.0);\n        assertEquals(expectedClipMinY, context.getClipMinY(), 0.0);\n        assertEquals(expectedClipMinX, context.getClipMinX(), 0.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/BaseCellSelectionStrategyTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport org.junit.Before;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridCellValue;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridRow;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\npublic abstract class BaseCellSelectionStrategyTest {\n\n    protected CellSelectionStrategy strategy;\n\n    protected GridData uiModel;\n\n    protected GridColumn<String> gc1;\n    protected GridColumn<String> gc2;\n\n    @Before\n    public void setup() {\n        this.strategy = getStrategy();\n        this.uiModel = new BaseGridData();\n\n        gc1 = new BaseGridTest.MockMergableGridColumn<>(\"col1\",\n                                                        100);\n        gc2 = new BaseGridTest.MockMergableGridColumn<>(\"col2\",\n                                                        100);\n        uiModel.appendColumn(gc1);\n        uiModel.appendColumn(gc2);\n\n        uiModel.appendRow(new BaseGridRow());\n        uiModel.appendRow(new BaseGridRow());\n        uiModel.appendRow(new BaseGridRow());\n        uiModel.appendRow(new BaseGridRow());\n\n        // [0,0 : a0] [0,1 : a1]\n        // [1,0 : a0] [1,1 : a1]\n        // [2,0 : b0] [2,1 : b1]\n        // [3,0 : b0] [3,1 : b1]\n\n        for (int rowIndex = 0; rowIndex < uiModel.getRowCount(); rowIndex++) {\n            for (int columnIndex = 0; columnIndex < uiModel.getColumnCount(); columnIndex++) {\n                final String value = (rowIndex < 2 ? \"a\" : \"b\") + columnIndex;\n                uiModel.setCellValue(rowIndex,\n                                     columnIndex,\n                                     new BaseGridCellValue<>(value));\n            }\n        }\n    }\n\n    protected abstract CellSelectionStrategy getStrategy();\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/HeaderSingleCellSelectionStrategyTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridTest;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class HeaderSingleCellSelectionStrategyTest extends BaseCellSelectionStrategyTest {\n\n    @Override\n    protected CellSelectionStrategy getStrategy() {\n        return new HeaderSingleCellSelectionStrategy();\n    }\n\n    @Test\n    public void testSingleHeaderCell() {\n        //MetaDataGroups: [headerInstance1][headerInstance2]\n        assertTrue(strategy.handleSelection(uiModel,\n                                            0,\n                                            0,\n                                            false,\n                                            false));\n\n        assertCellSelections(0, 0, 1);\n\n        assertTrue(strategy.handleSelection(uiModel,\n                                            0,\n                                            1,\n                                            false,\n                                            false));\n\n        assertCellSelections(0, 1, 1);\n    }\n\n    @Test\n    public void testBlockHeaderCell() {\n        //MetaDataGroups: [headerInstance1][headerInstance1][headerInstance2][headerInstance2]\n        final GridColumn<?> gc3 = new BaseGridTest.MockMergableGridColumn<>(\"col3\", 100);\n        final GridColumn<?> gc4 = new BaseGridTest.MockMergableGridColumn<>(\"col4\", 100);\n        uiModel.appendColumn(gc3);\n        uiModel.appendColumn(gc4);\n\n        gc1.getHeaderMetaData().set(0, gc2.getHeaderMetaData().get(0));\n        gc3.getHeaderMetaData().set(0, gc4.getHeaderMetaData().get(0));\n\n        assertTrue(strategy.handleSelection(uiModel,\n                                            0,\n                                            0,\n                                            false,\n                                            false));\n\n        assertCellSelections(0, 0, 2);\n\n        assertTrue(strategy.handleSelection(uiModel,\n                                            0,\n                                            2,\n                                            false,\n                                            false));\n\n        assertCellSelections(0, 2, 2);\n    }\n\n    private void assertCellSelections(final int headerRowIndex,\n                                      final int headerColumnIndex,\n                                      final int selectedCellCount) {\n        final List<GridData.SelectedCell> selectedCells = uiModel.getSelectedCells();\n        final List<GridData.SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();\n        assertEquals(0,\n                     selectedCells.size());\n        assertEquals(selectedCellCount,\n                     selectedHeaderCells.size());\n        assertTrue(selectedHeaderCells.contains(new GridData.SelectedCell(headerRowIndex,\n                                                                          headerColumnIndex)));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RangeSelectionStrategyMergedDataTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData.SelectedCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class RangeSelectionStrategyMergedDataTest extends BaseCellSelectionStrategyTest {\n\n    @Override\n    protected CellSelectionStrategy getStrategy() {\n        return new RangeSelectionStrategy();\n    }\n\n    @Test\n    public void singleCellSelection() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n    }\n\n    @Test\n    public void extendSelectionWithShiftKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(8,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithControlKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithColumnMovedWithShiftKey() {\n        uiModel.moveColumnTo(0,\n                             gc2);\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(8,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RangeSelectionStrategyUnmergedDataTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData.SelectedCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class RangeSelectionStrategyUnmergedDataTest extends BaseCellSelectionStrategyTest {\n\n    @Before\n    @Override\n    public void setup() {\n        super.setup();\n        uiModel.setMerged(false);\n    }\n\n    @Override\n    protected CellSelectionStrategy getStrategy() {\n        return new RangeSelectionStrategy();\n    }\n\n    @Test\n    public void singleCellSelection() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n    }\n\n    @Test\n    public void extendSelectionWithShiftKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(6,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithControlKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithColumnMovedWithShiftKey() {\n        uiModel.moveColumnTo(0,\n                             gc2);\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(6,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void selectCellWithShiftKeyWithHeaderSelected() {\n        uiModel.selectHeaderCell(0, 0);\n\n        final List<SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertTrue(selectedHeaderCells.contains(new SelectedCell(0,\n                                                                 0)));\n\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(uiModel.getSelectedHeaderCells().isEmpty());\n    }\n\n    @Test\n    public void selectCellWithControlKeyWithHeaderSelected() {\n        uiModel.selectHeaderCell(0, 0);\n\n        final List<SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertTrue(selectedHeaderCells.contains(new SelectedCell(0,\n                                                                 0)));\n\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(1,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(uiModel.getSelectedHeaderCells().isEmpty());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RowSelectionStrategyMergedDataTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\n\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData.SelectedCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class RowSelectionStrategyMergedDataTest extends BaseCellSelectionStrategyTest {\n\n    @Override\n    protected CellSelectionStrategy getStrategy() {\n        return new RowSelectionStrategy();\n    }\n\n    @Test\n    public void singleCellSelection() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithShiftKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(8,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithControlKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(8,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithColumnMovedWithShiftKey() {\n        uiModel.moveColumnTo(0,\n                             gc2);\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(8,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(3,\n                                                           1)));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/grid/selections/impl/RowSelectionStrategyUnmergedDataTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.grid.selections.impl;\n\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData.SelectedCell;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.selections.CellSelectionStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\n\npublic class RowSelectionStrategyUnmergedDataTest extends BaseCellSelectionStrategyTest {\n\n    @Before\n    @Override\n    public void setup() {\n        super.setup();\n        uiModel.setMerged(false);\n    }\n\n    @Override\n    protected CellSelectionStrategy getStrategy() {\n        return new RowSelectionStrategy();\n    }\n\n    @Test\n    public void singleCellSelection() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithShiftKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(6,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithControlKey() {\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(4,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void extendSelectionWithColumnMovedWithShiftKey() {\n        uiModel.moveColumnTo(0,\n                             gc2);\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 false);\n        strategy.handleSelection(uiModel,\n                                 2,\n                                 1,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(6,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(1,\n                                                           1)));\n        assertTrue(selectedCells.contains(new SelectedCell(2,\n                                                           1)));\n    }\n\n    @Test\n    public void selectCellWithShiftKeyWithHeaderSelected() {\n        uiModel.selectHeaderCell(0, 0);\n\n        final List<SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertTrue(selectedHeaderCells.contains(new SelectedCell(0,\n                                                                 0)));\n\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 true,\n                                 false);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(uiModel.getSelectedHeaderCells().isEmpty());\n    }\n\n    @Test\n    public void selectCellWithControlKeyWithHeaderSelected() {\n        uiModel.selectHeaderCell(0, 0);\n\n        final List<SelectedCell> selectedHeaderCells = uiModel.getSelectedHeaderCells();\n        assertEquals(1,\n                     selectedHeaderCells.size());\n        assertTrue(selectedHeaderCells.contains(new SelectedCell(0,\n                                                                 0)));\n\n        strategy.handleSelection(uiModel,\n                                 0,\n                                 0,\n                                 false,\n                                 true);\n\n        final List<SelectedCell> selectedCells = uiModel.getSelectedCells();\n        assertEquals(2,\n                     selectedCells.size());\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           0)));\n        assertTrue(selectedCells.contains(new SelectedCell(0,\n                                                           1)));\n        assertTrue(uiModel.getSelectedHeaderCells().isEmpty());\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/DefaultGridLayerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.mediator.Mediators;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Node;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridColumn;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseGridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.impl.BaseGridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.renderers.grids.GridRenderer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.DefaultPinnedModeManager;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultGridLayerTest {\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private GridRenderer renderer;\n\n    @Mock\n    private Mediators mediators;\n\n    private DefaultGridLayer gridLayer;\n\n    private Transform transform;\n\n    @Before\n    public void setup() {\n        this.transform = new Transform();\n\n        final LienzoPanel panel = new LienzoPanel(500,\n                                                  500);\n        final DefaultGridLayer wrapped = new DefaultGridLayer() {\n\n            @Override\n            public Layer batch() {\n                //Don't render Layer for tests\n                return this;\n            }\n\n            @Override\n            public Layer batch(final GridLayerRedrawManager.PrioritizedCommand command) {\n                //Don't render Layer for tests\n                return this;\n            }\n        };\n        panel.add(wrapped);\n        this.gridLayer = spy(wrapped);\n\n        when(gridLayer.getViewport()).thenReturn(viewport);\n        when(viewport.getTransform()).thenReturn(transform);\n        when(viewport.getMediators()).thenReturn(mediators);\n    }\n\n    private GridWidget makeGridWidget() {\n        final GridData uiModel = new BaseGridData();\n        return new BaseGridWidget(uiModel,\n                                  gridLayer,\n                                  gridLayer,\n                                  renderer) {\n            @Override\n            public void select() {\n                //Don't render Selector for tests\n            }\n        };\n    }\n\n    @Test\n    public void checkFlipToGridWidgetWhenPinned() {\n        final GridWidget gridWidget = makeGridWidget();\n        this.gridLayer.add(gridWidget);\n\n        gridLayer.enterPinnedMode(gridWidget,\n                                  new GridLayerRedrawManager.PrioritizedCommand(0) {\n                                      @Override\n                                      public void execute() {\n\n                                      }\n                                  });\n\n        gridLayer.flipToGridWidget(gridWidget);\n\n        verify(gridLayer,\n               times(1)).updatePinnedContext(eq(gridWidget));\n        verify(gridLayer,\n               times(1)).batch(any(GridLayerRedrawManager.PrioritizedCommand.class));\n    }\n\n    @Test\n    public void checkFlipToGridWidgetWhenNotPinned() {\n        final GridWidget gridWidget = makeGridWidget();\n        this.gridLayer.add(gridWidget);\n\n        gridLayer.flipToGridWidget(gridWidget);\n\n        verify(gridLayer,\n               never()).updatePinnedContext(eq(gridWidget));\n        verify(gridLayer,\n               never()).batch(any(GridLayerRedrawManager.PrioritizedCommand.class));\n    }\n\n    @Test\n    public void checkScrollToGridWidgetWhenPinned() {\n        final GridWidget gridWidget = makeGridWidget();\n        this.gridLayer.add(gridWidget);\n\n        gridLayer.enterPinnedMode(gridWidget,\n                                  new GridLayerRedrawManager.PrioritizedCommand(0) {\n                                      @Override\n                                      public void execute() {\n                                          //Do nothing\n                                      }\n                                  });\n\n        gridLayer.scrollToGridWidget(gridWidget);\n\n        verify(gridLayer,\n               never()).select(eq(gridWidget));\n    }\n\n    @Test\n    public void checkScrollToGridWidgetWhenNotPinned() {\n        final GridWidget gridWidget = makeGridWidget();\n        this.gridLayer.add(gridWidget);\n\n        gridLayer.scrollToGridWidget(gridWidget);\n\n        verify(gridLayer,\n               times(1)).select(eq(gridWidget));\n    }\n\n    @Test\n    public void checkRemoveAllClearsCachedReferences() {\n        final GridWidget gridWidget1 = makeGridWidget();\n        final GridColumn column1 = mock(GridColumn.class);\n        when(column1.isVisible()).thenReturn(true);\n        gridWidget1.getModel().appendColumn(column1);\n\n        final GridWidget gridWidget2 = makeGridWidget();\n        final GridColumn column2 = mock(GridColumn.class);\n        when(column2.isVisible()).thenReturn(true);\n        when(column2.isLinked()).thenReturn(true);\n        when(column2.getLink()).thenReturn(column1);\n        gridWidget2.getModel().appendColumn(column2);\n\n        this.gridLayer.add(gridWidget1);\n        this.gridLayer.add(gridWidget2);\n\n        assertEquals(2,\n                     gridLayer.getGridWidgets().size());\n        assertEquals(1,\n                     gridLayer.getGridWidgetConnectors().size());\n\n        gridLayer.removeAll();\n\n        assertEquals(0,\n                     gridLayer.getGridWidgets().size());\n        assertEquals(0,\n                     gridLayer.getGridWidgetConnectors().size());\n    }\n\n    @Test\n    public void checkConnectorsVisibilityFollowPinnedModeStatus() {\n        final GridWidget gridWidget1 = makeGridWidget();\n        final GridColumn column1 = mock(GridColumn.class);\n        when(column1.isVisible()).thenReturn(true);\n        gridWidget1.getModel().appendColumn(column1);\n\n        final GridWidget gridWidget2 = makeGridWidget();\n        final GridColumn column2 = mock(GridColumn.class);\n        when(column2.isVisible()).thenReturn(true);\n        when(column2.isLinked()).thenReturn(true);\n        when(column2.getLink()).thenReturn(column1);\n        gridWidget2.getModel().appendColumn(column2);\n\n        this.gridLayer.add(gridWidget1);\n        this.gridLayer.add(gridWidget2);\n\n        gridLayer.refreshGridWidgetConnectors();\n\n        checkConnectorsVisibility(true);\n\n        gridLayer.enterPinnedMode(gridWidget1,\n                                  new GridLayerRedrawManager.PrioritizedCommand(0) {\n                                      @Override\n                                      public void execute() {\n                                          //Do nothing\n                                      }\n                                  });\n\n        gridLayer.refreshGridWidgetConnectors();\n\n        checkConnectorsVisibility(false);\n    }\n\n    @Test\n    public void testAddOnEnterPinnedModeCommand() {\n\n        final DefaultGridLayer defaultGridLayer = spy(new DefaultGridLayer());\n        final DefaultPinnedModeManager defaultPinnedModeManager = mock(DefaultPinnedModeManager.class);\n        final Command command = mock(Command.class);\n\n        doReturn(defaultPinnedModeManager).when(defaultGridLayer).getPinnedModeManager();\n\n        defaultGridLayer.addOnEnterPinnedModeCommand(command);\n\n        verify(defaultPinnedModeManager).addOnEnterPinnedModeCommand(command);\n    }\n\n    @Test\n    public void testAddOnExitPinnedModeCommand() {\n\n        final DefaultGridLayer defaultGridLayer = spy(new DefaultGridLayer());\n        final DefaultPinnedModeManager defaultPinnedModeManager = mock(DefaultPinnedModeManager.class);\n        final Command command = mock(Command.class);\n\n        doReturn(defaultPinnedModeManager).when(defaultGridLayer).getPinnedModeManager();\n\n        defaultGridLayer.addOnExitPinnedModeCommand(command);\n\n        verify(defaultPinnedModeManager).addOnExitPinnedModeCommand(command);\n    }\n\n    private void checkConnectorsVisibility(final boolean isVisible) {\n        final Set<IPrimitive<?>> connectors = gridLayer.getGridWidgetConnectors();\n        assertEquals(1,\n                     connectors.size());\n        assertEquals(isVisible,\n                     connectors.iterator().next().isVisible());\n    }\n\n    @Test\n    public void testRegister() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n\n        gridLayer.register(gridWidget1);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(1);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1);\n\n        gridLayer.register(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(2);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1, gridWidget2);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRegisterAndAddAsPrimitive() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        when(gridWidget1.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget1.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.add(gridWidget1);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(1);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1);\n\n        gridLayer.register(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(2);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1, gridWidget2);\n    }\n\n    @Test\n    public void testRegisterOrdering() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n\n        gridLayer.register(gridWidget1);\n        gridLayer.register(gridWidget2);\n\n        final Set<GridWidget> gridWidgets = gridLayer.getGridWidgets();\n        assertThat(gridWidgets.size()).isEqualTo(2);\n        assertThat(gridWidgets).containsExactly(gridWidget1, gridWidget2);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRegisterAndAddAsPrimitiveOrdering() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        final GridWidget gridWidget3 = mock(GridWidget.class);\n        final GridWidget gridWidget4 = mock(GridWidget.class);\n        when(gridWidget1.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget1.getModel()).thenReturn(new BaseGridData());\n        when(gridWidget3.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget3.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.add(gridWidget1);\n        gridLayer.register(gridWidget2);\n        gridLayer.add(gridWidget3);\n        gridLayer.register(gridWidget4);\n\n        final Set<GridWidget> gridWidgets = gridLayer.getGridWidgets();\n        assertThat(gridWidgets.size()).isEqualTo(4);\n        assertThat(gridWidgets).containsExactly(gridWidget1, gridWidget2, gridWidget3, gridWidget4);\n    }\n\n    @Test\n    public void testRegisteringSameInstanceMultipleTimes() {\n        final GridWidget gridWidget = mock(GridWidget.class);\n\n        gridLayer.register(gridWidget);\n        gridLayer.register(gridWidget);\n\n        final Set<GridWidget> gridWidgets = gridLayer.getGridWidgets();\n        assertThat(gridWidgets.size()).isEqualTo(1);\n        assertThat(gridWidgets).containsExactly(gridWidget);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRegisterAndAddAsPrimitiveSameInstanceMultipleTimes() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        when(gridWidget1.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget1.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.add(gridWidget1);\n        gridLayer.add(gridWidget1);\n        gridLayer.register(gridWidget2);\n        gridLayer.register(gridWidget2);\n\n        final Set<GridWidget> gridWidgets = gridLayer.getGridWidgets();\n        assertThat(gridWidgets.size()).isEqualTo(2);\n        assertThat(gridWidgets).containsExactly(gridWidget1, gridWidget2);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testRegisterAndAddAsPrimitiveSameInstanceMultipleTimesTwo() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        when(gridWidget1.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget1.getModel()).thenReturn(new BaseGridData());\n        when(gridWidget2.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget2.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.add(gridWidget1);\n        gridLayer.add(gridWidget2);\n        gridLayer.register(gridWidget1);\n        gridLayer.register(gridWidget2);\n\n        final Set<GridWidget> gridWidgets = gridLayer.getGridWidgets();\n        assertThat(gridWidgets.size()).isEqualTo(2);\n        assertThat(gridWidgets).containsExactly(gridWidget1, gridWidget2);\n    }\n\n    @Test\n    public void testDeregister() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n\n        gridLayer.register(gridWidget1);\n        gridLayer.register(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(2);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1, gridWidget2);\n\n        gridLayer.deregister(gridWidget1);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(1);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget2);\n\n        gridLayer.deregister(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets()).isEmpty();\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testDeregisterAsPrimitive() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        when(gridWidget2.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget2.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.register(gridWidget1);\n        gridLayer.register(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(2);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget1, gridWidget2);\n\n        gridLayer.deregister(gridWidget1);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(1);\n        assertThat(gridLayer.getGridWidgets()).contains(gridWidget2);\n\n        gridLayer.remove(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets()).isEmpty();\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testDrawPreservesExplicitGridWidgets() {\n        final GridWidget gridWidget1 = mock(GridWidget.class);\n        final GridWidget gridWidget2 = mock(GridWidget.class);\n        when(gridWidget1.asNode()).thenReturn(mock(Node.class));\n        when(gridWidget1.getModel()).thenReturn(new BaseGridData());\n\n        gridLayer.add(gridWidget1);\n        gridLayer.register(gridWidget2);\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(2);\n        assertThat(gridLayer.getGridWidgets()).containsOnly(gridWidget1, gridWidget2);\n\n        gridLayer.draw();\n\n        assertThat(gridLayer.getGridWidgets().size()).isEqualTo(1);\n        assertThat(gridLayer.getGridWidgets()).containsOnly(gridWidget1);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/GridLayerRedrawManagerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLayerRedrawManager.PrioritizedCommand;\n\nimport static org.junit.Assert.assertSame;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridLayerRedrawManagerTest {\n\n    @Test\n    public void comparatorUsedInsteadOfNaturalOrdering() {\n        final TestPrioritizedCommand c1 = new TestPrioritizedCommand(1);\n        final TestPrioritizedCommand c2 = new TestPrioritizedCommand(2);\n\n        final GridLayerRedrawManager gridLayerRedrawManager = GridLayerRedrawManager.get();\n        gridLayerRedrawManager.schedule(c1);\n        gridLayerRedrawManager.schedule(c2);\n\n        assertSame(c1,\n                   gridLayerRedrawManager.commands.first());\n    }\n\n    private static class TestPrioritizedCommand extends GridLayerRedrawManager.PrioritizedCommand implements Comparable<GridLayerRedrawManager.PrioritizedCommand> {\n\n        public TestPrioritizedCommand(int priority) {\n            super(priority);\n        }\n\n        @Override\n        public void execute() {\n        }\n\n        @Override\n        public int compareTo(PrioritizedCommand o) {\n            throw new RuntimeException(\"Should not be used as comparator is provided by GridLayerRedrawManager\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/impl/GridLienzoPanelTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.impl;\n\nimport com.ait.lienzo.client.core.Context2D;\nimport com.ait.lienzo.client.core.INativeContext2D;\nimport com.ait.lienzo.client.core.shape.Node;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.CanvasElement;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport com.google.gwt.event.dom.client.MouseUpHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InOrder;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.GridData;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollHandler;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.inOrder;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridLienzoPanelTest {\n\n    private static final int WIDTH = 100;\n\n    private static final int HEIGHT = 200;\n\n    @Mock\n    private AbsolutePanel rootPanel;\n\n    @Mock\n    private AbsolutePanel scrollPanel;\n\n    @Mock\n    private AbsolutePanel internalScrollPanel;\n\n    @Mock\n    private AbsolutePanel domElementContainer;\n\n    @Mock\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    @Mock\n    private LienzoPanel lienzoPanel;\n\n    @Mock\n    private DefaultGridLayer gridLayer;\n\n    @Mock\n    private DivElement gridLayerDivElement;\n\n    @Mock\n    private Style gridLayerDivElementStyle;\n\n    @Mock\n    private CanvasElement gridLayerCanvasElement;\n\n    @Mock\n    private Node gridLayerNode;\n\n    @Mock\n    private Context2D context2D;\n\n    @Mock\n    private INativeContext2D nativeContext2D;\n\n    private GridLienzoPanel gridLienzoPanel;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setUp() {\n\n        gridLienzoPanel = spy(new GridLienzoPanel());\n\n        when(gridLienzoPanel.getRootPanel()).thenReturn(rootPanel);\n        when(gridLienzoPanel.getScrollPanel()).thenReturn(scrollPanel);\n        when(gridLienzoPanel.getInternalScrollPanel()).thenReturn(internalScrollPanel);\n        when(gridLienzoPanel.getDomElementContainer()).thenReturn(domElementContainer);\n        when(gridLienzoPanel.getLienzoPanel()).thenReturn(lienzoPanel);\n        when(gridLienzoPanel.getGridLienzoScrollHandler()).thenReturn(gridLienzoScrollHandler);\n\n        when(gridLayer.getElement()).thenReturn(gridLayerDivElement);\n        when(gridLayerDivElement.getStyle()).thenReturn(gridLayerDivElementStyle);\n        when(gridLayer.getCanvasElement()).thenReturn(gridLayerCanvasElement);\n        when(gridLayer.getContext()).thenReturn(context2D);\n        when(gridLayer.asNode()).thenReturn(gridLayerNode);\n        when(context2D.getNativeContext()).thenReturn(nativeContext2D);\n    }\n\n    @Test\n    public void testSetupPanels() {\n\n        doNothing().when(gridLienzoPanel).setupScrollPanel();\n        doNothing().when(gridLienzoPanel).setupDomElementContainer();\n        doNothing().when(gridLienzoPanel).setupRootPanel();\n\n        gridLienzoPanel.setupPanels();\n\n        final InOrder inOrder = inOrder(gridLienzoPanel);\n\n        inOrder.verify(gridLienzoPanel).setupScrollPanel();\n        inOrder.verify(gridLienzoPanel).setupDomElementContainer();\n        inOrder.verify(gridLienzoPanel).setupRootPanel();\n        inOrder.verify(gridLienzoPanel).add(rootPanel);\n    }\n\n    @Test\n    public void testSetupScrollPanel() {\n\n        gridLienzoPanel.setupScrollPanel();\n\n        verify(scrollPanel).add(internalScrollPanel);\n    }\n\n    @Test\n    public void testSetupDomElementContainer() {\n\n        gridLienzoPanel.setupDomElementContainer();\n\n        verify(domElementContainer).add(lienzoPanel);\n    }\n\n    @Test\n    public void testSetupRootPanel() {\n\n        gridLienzoPanel.setupRootPanel();\n\n        verify(rootPanel).add(domElementContainer);\n        verify(rootPanel).add(scrollPanel);\n    }\n\n    @Test\n    public void testSetupScrollHandlers() {\n\n        final GridLienzoScrollHandler lienzoScrollHandler = mock(GridLienzoScrollHandler.class);\n\n        doReturn(lienzoScrollHandler).when(gridLienzoPanel).getGridLienzoScrollHandler();\n\n        gridLienzoPanel.setupScrollHandlers();\n\n        verify(lienzoScrollHandler).init();\n        verify(gridLienzoPanel).addMouseUpHandler();\n    }\n\n    @Test\n    public void testAddMouseUpHandler() {\n\n        final ArgumentCaptor<MouseUpHandler> handler = ArgumentCaptor.forClass(MouseUpHandler.class);\n        final MouseUpEvent mouseUpEvent = mock(MouseUpEvent.class);\n        final HandlerRegistration registration = mock(HandlerRegistration.class);\n\n        doReturn(registration).when(gridLienzoPanel).addMouseUpHandler(handler.capture());\n        doNothing().when(gridLienzoPanel).refreshScrollPosition();\n\n        gridLienzoPanel.addMouseUpHandler();\n\n        handler.getValue().onMouseUp(mouseUpEvent);\n\n        verify(gridLienzoPanel).refreshScrollPosition();\n    }\n\n    @Test\n    public void testOnResize() {\n\n        final ArgumentCaptor<Scheduler.ScheduledCommand> scheduledCommand = ArgumentCaptor.forClass(Scheduler.ScheduledCommand.class);\n\n        doNothing().when(gridLienzoPanel).updatePanelSize();\n        doNothing().when(gridLienzoPanel).refreshScrollPosition();\n        doNothing().when(gridLienzoPanel).scheduleDeferred(scheduledCommand.capture());\n\n        gridLienzoPanel.onResize();\n\n        scheduledCommand.getValue().execute();\n\n        verify(gridLienzoPanel).updatePanelSize();\n        verify(gridLienzoPanel).refreshScrollPosition();\n    }\n\n    @Test\n    public void testUpdatePanelSizeWhenWidthAndHeightAreGreaterThanZero() {\n\n        final Element element = mock(Element.class);\n        final Element parentElement = mock(Element.class);\n        final Integer scrollWidth = 14;\n        final Integer scrollHeight = 14;\n        final Integer width = 800;\n        final Integer height = 600;\n\n        doReturn(element).when(gridLienzoPanel).getElement();\n        doReturn(parentElement).when(element).getParentElement();\n        doReturn(width).when(parentElement).getOffsetWidth();\n        doReturn(height).when(parentElement).getOffsetHeight();\n        doReturn(scrollWidth).when(gridLienzoScrollHandler).scrollbarWidth();\n        doReturn(scrollHeight).when(gridLienzoScrollHandler).scrollbarHeight();\n\n        gridLienzoPanel.updatePanelSize();\n\n        verify(domElementContainer).setPixelSize(width - scrollWidth,\n                                                 height - scrollHeight);\n        verify(lienzoPanel).setPixelSize(width - scrollWidth,\n                                         height - scrollHeight);\n        verify(scrollPanel).setPixelSize(width,\n                                         height);\n    }\n\n    @Test\n    public void testUpdatePanelSizeWhenWidthAndHeightAreNotGreaterThanZero() {\n\n        final Element element = mock(Element.class);\n        final Element parentElement = mock(Element.class);\n        final Integer width = 0;\n        final Integer height = 0;\n\n        doReturn(element).when(gridLienzoPanel).getElement();\n        doReturn(parentElement).when(element).getParentElement();\n        doReturn(width).when(parentElement).getOffsetWidth();\n        doReturn(height).when(parentElement).getOffsetHeight();\n\n        gridLienzoPanel.updatePanelSize();\n\n        verify(domElementContainer,\n               never()).setPixelSize(anyInt(),\n                                     anyInt());\n        verify(lienzoPanel,\n               never()).setPixelSize(anyInt(),\n                                     anyInt());\n        verify(scrollPanel,\n               never()).setPixelSize(anyInt(),\n                                     anyInt());\n    }\n\n    @Test\n    public void testRefreshScrollPosition() {\n\n        final GridLienzoScrollHandler lienzoScrollHandler = mock(GridLienzoScrollHandler.class);\n\n        doReturn(lienzoScrollHandler).when(gridLienzoPanel).getGridLienzoScrollHandler();\n\n        gridLienzoPanel.refreshScrollPosition();\n\n        verify(lienzoScrollHandler).refreshScrollPosition();\n    }\n\n    @Test\n    public void propagateNewPanelSize() {\n        int visibleWidth = 100;\n        int visibleHeight = 100;\n        GridData gridData = mock(GridData.class);\n        GridWidget gridWidget = mock(GridWidget.class);\n        DefaultGridLayer defaultGridLayer = new DefaultGridLayer();\n        defaultGridLayer.register(gridWidget);\n        when(gridWidget.getModel()).thenReturn(gridData);\n        gridLienzoPanel.propagateNewPanelSize(visibleWidth, visibleHeight);\n        verify(gridData, never()).setVisibleSizeAndRefresh(anyInt(), anyInt());\n\n        gridLienzoPanel.add(defaultGridLayer);\n        gridLienzoPanel.propagateNewPanelSize(visibleWidth, visibleHeight);\n\n        verify(gridData, times(1)).setVisibleSizeAndRefresh(visibleWidth, visibleHeight);\n    }\n\n    @Test\n    public void testConstructorWithSizeAndDefaultGridLayer() {\n        final GridLienzoPanel gridPanel = new GridLienzoPanel(WIDTH, HEIGHT, gridLayer);\n\n        assertThat(gridPanel.getDefaultGridLayer()).isEqualTo(gridLayer);\n    }\n\n    @Test\n    public void testConstructor() {\n        final GridLienzoPanel gridPanel = new GridLienzoPanel(gridLayer);\n\n        assertThat(gridPanel.getDefaultGridLayer()).isEqualTo(gridLayer);\n    }\n\n    @Test\n    public void testMouseDownHandlerDoesNotSetFocus() {\n        gridLienzoPanel.setupDefaultHandlers();\n\n        verify(gridLienzoPanel, never()).addMouseDownHandler(any(MouseDownHandler.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/BoundaryMousePanMediatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.shape.Attributes;\nimport com.ait.lienzo.client.core.shape.Scene;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseUpEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BoundaryMousePanMediatorTest {\n\n    private final Bounds bounds = new BaseBounds(-1000,\n                                                 -1000,\n                                                 2000,\n                                                 2000);\n    private final Bounds visibleBounds = new BaseBounds(-500,\n                                                        -500,\n                                                        1000,\n                                                        1000);\n    private RestrictedMousePanMediator mediator;\n    @Mock\n    private GridLayer viewLayer;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Scene scene;\n\n    @Mock\n    private Attributes attributes;\n\n    @Mock\n    private DivElement vpElement;\n\n    @Mock\n    private Style vpStyle;\n\n    private Transform transform;\n\n    @Before\n    public void setup() {\n        this.transform = new Transform();\n\n        when(viewLayer.getVisibleBounds()).thenReturn(visibleBounds);\n        when(viewLayer.getViewport()).thenReturn(viewport);\n        when(viewport.getElement()).thenReturn(vpElement);\n        when(vpElement.getStyle()).thenReturn(vpStyle);\n        when(viewport.getTransform()).thenReturn(transform);\n        when(viewport.getAttributes()).thenReturn(attributes);\n        when(viewport.getScene()).thenReturn(scene);\n\n        this.mediator = new RestrictedMousePanMediator(viewLayer);\n        this.mediator.setTransformMediator(new BoundaryTransformMediator(bounds));\n        this.mediator.setViewport(viewport);\n    }\n\n    @Test\n    public void testMouseDownEvent() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        mediator.handleEvent(nmd0);\n\n        verify(vpStyle,\n               times(1)).setCursor(eq(Style.Cursor.MOVE));\n    }\n\n    @Test\n    public void testMouseUpEvent() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseUpEvent mu0 = mock(MouseUpEvent.class);\n        final NodeMouseUpEvent nmu0 = new NodeMouseUpEvent(mu0);\n\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmu0);\n\n        verify(vpStyle,\n               times(1)).setCursor(eq(Style.Cursor.MOVE));\n        verify(vpStyle,\n               times(1)).setCursor(eq(Style.Cursor.DEFAULT));\n    }\n\n    @Test\n    public void testMouseMoveEvent_LeftEdge() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(1200);\n        when(mm1.getRelativeY(any())).thenReturn(0);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(1000.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_RightEdge() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(-200);\n        when(mm1.getRelativeY(any())).thenReturn(0);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_TopEdge() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(0);\n        when(mm1.getRelativeY(any())).thenReturn(1200);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(1000.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_BottomEdge() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(0);\n        when(mm1.getRelativeY(any())).thenReturn(-200);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_LeftEdge_Scaled50pct() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(1200);\n        when(mm1.getRelativeY(any())).thenReturn(0);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        transform.scale(0.5,\n                        0.5);\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(500.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_RightEdge_Scaled50pct() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(-200);\n        when(mm1.getRelativeY(any())).thenReturn(0);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        transform.scale(0.5,\n                        0.5);\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_TopEdge_Scaled50pct() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(0);\n        when(mm1.getRelativeY(any())).thenReturn(1200);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        transform.scale(0.5,\n                        0.5);\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(500.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testMouseMoveEvent_BottomEdge_Scaled50pct() {\n        final MouseDownEvent md0 = mock(MouseDownEvent.class);\n        when(md0.getRelativeX(any())).thenReturn(0);\n        when(md0.getRelativeY(any())).thenReturn(0);\n        final NodeMouseDownEvent nmd0 = new NodeMouseDownEvent(md0);\n\n        final MouseMoveEvent mm1 = mock(MouseMoveEvent.class);\n        when(mm1.getRelativeX(any())).thenReturn(0);\n        when(mm1.getRelativeY(any())).thenReturn(-200);\n        final NodeMouseMoveEvent nmm1 = new NodeMouseMoveEvent(mm1);\n\n        final ArgumentCaptor<Transform> transformArgumentCaptor = ArgumentCaptor.forClass(Transform.class);\n\n        transform.scale(0.5,\n                        0.5);\n        mediator.handleEvent(nmd0);\n        mediator.handleEvent(nmm1);\n\n        verify(viewport,\n               times(1)).setTransform(transformArgumentCaptor.capture());\n        final Transform result = transformArgumentCaptor.getValue();\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/BoundaryTransformMediatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class BoundaryTransformMediatorTest {\n\n    private final Bounds bounds = new BaseBounds(-1000,\n                                                 -1000,\n                                                 2000,\n                                                 2000);\n    private BoundaryTransformMediator restriction;\n\n    @Before\n    public void setup() {\n        this.restriction = new BoundaryTransformMediator(bounds);\n    }\n\n    @Test\n    public void testLeftEdge() {\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(1200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(1000.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testRightEdge() {\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(-200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testTopEdge() {\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(0.0,\n                                                         1200.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(1000.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testBottomEdge() {\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(0.0,\n                                                         -200.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/DefaultPinnedModeManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport java.util.Set;\n\nimport com.ait.lienzo.client.core.mediator.IMediator;\nimport com.ait.lienzo.client.core.mediator.Mediators;\nimport com.ait.lienzo.client.core.shape.IPrimitive;\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.user.client.Command;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.GridPinnedModeManager;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.TransformMediator;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class DefaultPinnedModeManagerTest {\n\n    @Mock\n    private GridLayer gridLayer;\n\n    @Mock\n    private Layer layer;\n\n    @Mock\n    private TransformMediator defaultMediator;\n\n    @Mock\n    private GridWidget gridWidget;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Transform transform;\n\n    @Mock\n    private Command enterPinnedModeCommand;\n\n    @Mock\n    private Command exitPinnedModeCommand;\n\n    private Mediators mediators;\n\n    private GridPinnedModeManager manager;\n\n    @Before\n    public void setup() {\n        this.manager = new DefaultPinnedModeManager(gridLayer) {\n            @Override\n            protected void doEnterPinnedMode(final Command onStartCommand,\n                                             final GridWidget gridWidget,\n                                             final Set<GridWidget> gridWidgetsToFadeFromView,\n                                             final Set<IPrimitive<?>> gridWidgetConnectorsToFadeFromView) {\n                assertEquals(DefaultPinnedModeManagerTest.this.gridWidget,\n                             gridWidget);\n                assertTrue(gridWidgetsToFadeFromView.isEmpty());\n                assertTrue(gridWidgetConnectorsToFadeFromView.isEmpty());\n                onStartCommand.execute();\n            }\n\n            @Override\n            protected void doExitPinnedMode(final Command onCompleteCommand,\n                                            final Set<GridWidget> gridWidgetsToFadeIntoView,\n                                            final Set<IPrimitive<?>> gridWidgetConnectorsToFadeIntoView) {\n                assertTrue(gridWidgetsToFadeIntoView.isEmpty());\n                assertTrue(gridWidgetConnectorsToFadeIntoView.isEmpty());\n                onCompleteCommand.execute();\n            }\n        };\n        this.mediators = new Mediators(viewport);\n        this.mediators.push(new RestrictedMousePanMediator(gridLayer));\n\n        when(gridLayer.getViewport()).thenReturn(viewport);\n        when(gridLayer.getDefaultTransformMediator()).thenReturn(defaultMediator);\n        when(gridWidget.getViewport()).thenReturn(viewport);\n        when(gridWidget.getLayer()).thenReturn(layer);\n        when(viewport.getMediators()).thenReturn(mediators);\n        when(viewport.getTransform()).thenReturn(transform);\n        when(transform.copy()).thenReturn(transform);\n        when(transform.getInverse()).thenReturn(transform);\n    }\n\n    @Test\n    public void enteringPinnedModeSetsMediatorToGridTransformMediator() {\n        manager.enterPinnedMode(gridWidget,\n                                enterPinnedModeCommand);\n\n        verify(enterPinnedModeCommand,\n               times(1)).execute();\n\n        assertNotNull(manager.getPinnedContext());\n\n        final IMediator mediator = mediators.pop();\n        assertTrue(mediator instanceof RestrictedMousePanMediator);\n\n        final RestrictedMousePanMediator rmpm = (RestrictedMousePanMediator) mediator;\n        final TransformMediator tm = rmpm.getTransformMediator();\n\n        assertTrue(tm instanceof GridTransformMediator);\n    }\n\n    @Test\n    public void exitingPinnedModeSetsMediatorToDefaultTransformMediator() {\n        manager.enterPinnedMode(gridWidget,\n                                enterPinnedModeCommand);\n\n        manager.exitPinnedMode(exitPinnedModeCommand);\n\n        verify(exitPinnedModeCommand,\n               times(1)).execute();\n\n        assertNull(manager.getPinnedContext());\n\n        final IMediator mediator = mediators.pop();\n        assertTrue(mediator instanceof RestrictedMousePanMediator);\n\n        final RestrictedMousePanMediator rmpm = (RestrictedMousePanMediator) mediator;\n        final TransformMediator tm = rmpm.getTransformMediator();\n\n        assertEquals(defaultMediator,\n                     tm);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/GridTransformMediatorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridTransformMediatorTest {\n\n    private GridTransformMediator restriction;\n\n    @Mock\n    private GridWidget grid;\n\n    @Before\n    public void setup() {\n        this.restriction = new GridTransformMediator(grid);\n    }\n\n    @Test\n    public void testGridNarrowerThanVisibleBounds() {\n        when(grid.getX()).thenReturn(10.0);\n        when(grid.getY()).thenReturn(0.0);\n        when(grid.getWidth()).thenReturn(100.0);\n        when(grid.getHeight()).thenReturn(100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(1200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(-10.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testGridShorterThanVisibleBounds() {\n        when(grid.getX()).thenReturn(0.0);\n        when(grid.getY()).thenReturn(10.0);\n        when(grid.getWidth()).thenReturn(100.0);\n        when(grid.getHeight()).thenReturn(100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(1200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(-10.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testGridWiderThanVisibleBoundsLeftEdge() {\n        when(grid.getX()).thenReturn(10.0);\n        when(grid.getY()).thenReturn(0.0);\n        when(grid.getWidth()).thenReturn(1100.0);\n        when(grid.getHeight()).thenReturn(100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(1200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(-10.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testGridWiderThanVisibleBoundsRightEdge() {\n        when(grid.getX()).thenReturn(10.0);\n        when(grid.getY()).thenReturn(0.0);\n        when(grid.getWidth()).thenReturn(1100.0);\n        when(grid.getHeight()).thenReturn(100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(-200.0,\n                                                         0.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(-110.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(0.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testGridTallerThanVisibleBoundsTopEdge() {\n        when(grid.getX()).thenReturn(0.0);\n        when(grid.getY()).thenReturn(10.0);\n        when(grid.getWidth()).thenReturn(100.0);\n        when(grid.getHeight()).thenReturn(1100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(0.0,\n                                                         1200.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(-10.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n\n    @Test\n    public void testGridTallerThanVisibleBoundsBottomEdge() {\n        when(grid.getX()).thenReturn(0.0);\n        when(grid.getY()).thenReturn(10.0);\n        when(grid.getWidth()).thenReturn(100.0);\n        when(grid.getHeight()).thenReturn(1100.0);\n\n        final Bounds visibleBounds = new BaseBounds(-500,\n                                                    -500,\n                                                    1000,\n                                                    1000);\n        final Transform test = new Transform().translate(0.0,\n                                                         -200.0);\n        final Transform result = restriction.adjust(test,\n                                                    visibleBounds);\n\n        assertNotNull(result);\n        assertEquals(0.0,\n                     result.getTranslateX(),\n                     0.0);\n        assertEquals(-110.0,\n                     result.getTranslateY(),\n                     0.0);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/layer/pinning/impl/RestrictedMousePanMediatorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseUpEvent;\nimport com.ait.lienzo.client.core.mediator.IEventFilter;\nimport com.ait.lienzo.client.core.shape.Scene;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.GridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyDouble;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class RestrictedMousePanMediatorTest {\n\n    private RestrictedMousePanMediator mediator;\n\n    @Before\n    public void setUp() {\n        mediator = spy(new RestrictedMousePanMediator());\n    }\n\n    @Test\n    public void testGetLayerViewport() {\n\n        final GridLayer layer = mock(GridLayer.class);\n        final Viewport expectedViewport = mock(Viewport.class);\n\n        doReturn(expectedViewport).when(layer).getViewport();\n        doReturn(layer).when(mediator).getGridLayer();\n\n        final Viewport actualViewport = mediator.getLayerViewport();\n\n        assertEquals(expectedViewport,\n                     actualViewport);\n    }\n\n    @Test\n    public void testSetCursor() {\n\n        final Viewport viewport = mock(Viewport.class);\n        final DivElement divElement = mock(DivElement.class);\n        final Style.Cursor cursor = mock(Style.Cursor.class);\n        final Style style = mock(Style.class);\n\n        doReturn(style).when(divElement).getStyle();\n        doReturn(divElement).when(viewport).getElement();\n        doReturn(viewport).when(mediator).getLayerViewport();\n\n        mediator.setCursor(cursor);\n\n        verify(style).setCursor(cursor);\n    }\n\n    @Test\n    public void testCancel() throws Exception {\n        final Viewport viewport = mock(Viewport.class);\n        final DivElement divElement = mock(DivElement.class);\n        final Style style = mock(Style.class);\n\n        doReturn(style).when(divElement).getStyle();\n        doReturn(divElement).when(viewport).getElement();\n        doReturn(viewport).when(mediator).getLayerViewport();\n\n        mediator.cancel();\n\n        verify(style).setCursor(Style.Cursor.DEFAULT);\n    }\n\n    @Test\n    public void testHandleEventMouseMoveDragging() throws Exception {\n        final NodeMouseMoveEvent moveEvent = mock(NodeMouseMoveEvent.class);\n        final Viewport viewport = mock(Viewport.class);\n        final Transform transform = mock(Transform.class);\n        final Transform inverseTransform = mock(Transform.class);\n        final Scene scene = mock(Scene.class);\n\n        doReturn(transform).when(transform).copy();\n\n        doReturn(NodeMouseMoveEvent.getType()).when(moveEvent).getAssociatedType();\n\n        doReturn(transform).when(viewport).getTransform();\n        doReturn(scene).when(viewport).getScene();\n\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(true).when(mediator).isDragging();\n        doReturn(inverseTransform).when(mediator).inverseTransform();\n\n        mediator.handleEvent(moveEvent);\n\n        verify(mediator).onMouseMove(eq(moveEvent));\n    }\n\n    @Test\n    public void testHandleEventMouseMoveNotDragging() throws Exception {\n        final NodeMouseMoveEvent moveEvent = mock(NodeMouseMoveEvent.class);\n\n        doReturn(NodeMouseMoveEvent.getType()).when(moveEvent).getAssociatedType();\n\n        doReturn(false).when(mediator).isDragging();\n\n        mediator.handleEvent(moveEvent);\n\n        verify(mediator,\n               never()).onMouseMove(any(NodeMouseMoveEvent.class));\n    }\n\n    @Test\n    public void testHandleEventMouseDownNoFilter() throws Exception {\n        final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final Viewport viewport = mock(Viewport.class);\n\n        doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(viewport).when(mediator).getLayerViewport();\n        doReturn(viewport).when(mediator).getViewport();\n\n        mediator.handleEvent(downEvent);\n\n        verify(mediator).onMouseDown(eq(downEvent));\n    }\n\n    @Test\n    public void testHandleEventMouseDownDisabledFilter() throws Exception {\n        final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final Viewport viewport = mock(Viewport.class);\n        final IEventFilter iEventFilter = mock(IEventFilter.class);\n\n        doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(false).when(iEventFilter).isEnabled();\n\n        doReturn(viewport).when(mediator).getLayerViewport();\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(iEventFilter).when(mediator).getEventFilter();\n\n        mediator.handleEvent(downEvent);\n\n        verify(mediator).onMouseDown(eq(downEvent));\n    }\n\n    @Test\n    public void testHandleEventMouseDownEnabledFilterTestPassed() throws Exception {\n        final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final Viewport viewport = mock(Viewport.class);\n        final IEventFilter iEventFilter = mock(IEventFilter.class);\n\n        doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(true).when(iEventFilter).isEnabled();\n        doReturn(true).when(iEventFilter).test(any());\n\n        doReturn(viewport).when(mediator).getLayerViewport();\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(iEventFilter).when(mediator).getEventFilter();\n\n        mediator.handleEvent(downEvent);\n\n        verify(mediator).onMouseDown(eq(downEvent));\n    }\n\n    @Test\n    public void testHandleEventMouseDownEnabledFilterTestNotPassed() throws Exception {\n        final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final Viewport viewport = mock(Viewport.class);\n        final IEventFilter iEventFilter = mock(IEventFilter.class);\n\n        doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(true).when(iEventFilter).isEnabled();\n        doReturn(false).when(iEventFilter).test(any());\n\n        doReturn(viewport).when(mediator).getLayerViewport();\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(iEventFilter).when(mediator).getEventFilter();\n\n        mediator.handleEvent(downEvent);\n\n        verify(mediator,\n               never()).onMouseDown(any(NodeMouseDownEvent.class));\n    }\n\n    @Test\n    public void testHandleEventMouseUpNotDragging() throws Exception {\n        final NodeMouseUpEvent upEvent = mock(NodeMouseUpEvent.class);\n\n        doReturn(NodeMouseUpEvent.getType()).when(upEvent).getAssociatedType();\n\n        doReturn(false).when(mediator).isDragging();\n\n        mediator.handleEvent(upEvent);\n\n        verify(mediator,\n               never()).onMouseUp(any(NodeMouseUpEvent.class));\n        verify(mediator,\n               never()).cancel();\n    }\n\n    @Test\n    public void testHandleEventMouseUpDragging() throws Exception {\n        final NodeMouseUpEvent upEvent = mock(NodeMouseUpEvent.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final Viewport viewport = mock(Viewport.class);\n\n        doReturn(NodeMouseUpEvent.getType()).when(upEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(viewport).when(mediator).getLayerViewport();\n        doReturn(true).when(mediator).isDragging();\n\n        mediator.handleEvent(upEvent);\n\n        verify(mediator).onMouseUp(eq(upEvent));\n        verify(mediator).cancel();\n    }\n\n    @Test\n    public void testOnMouseDown() throws Exception {\n        final NodeMouseDownEvent downEvent = mock(NodeMouseDownEvent.class);\n        final Transform transform = mock(Transform.class);\n        final Viewport viewport = mock(Viewport.class);\n        final DivElement element = mock(DivElement.class);\n        final Style style = mock(Style.class);\n        final ArgumentCaptor<Point2D> point = ArgumentCaptor.forClass(Point2D.class);\n\n        doReturn(123).when(downEvent).getX();\n        doReturn(987).when(downEvent).getY();\n        doReturn(NodeMouseDownEvent.getType()).when(downEvent).getAssociatedType();\n\n        doReturn(style).when(element).getStyle();\n\n        doReturn(transform).when(transform).getInverse();\n\n        doReturn(transform).when(viewport).getTransform();\n        doReturn(element).when(viewport).getElement();\n\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(viewport).when(mediator).getLayerViewport();\n\n        mediator.onMouseDown(downEvent);\n\n        verify(transform).transform(point.capture(),\n                                    point.capture());\n\n        assertEquals(\"Expected X coordinate of the event\",\n                     123.0,\n                     point.getAllValues().get(0).getX(),\n                     0.0);\n        assertEquals(\"Expected Y coordinate of the event\",\n                     987.0,\n                     point.getAllValues().get(0).getY(),\n                     0.0);\n\n        assertEquals(\"Expected the same point to be transformed\",\n                     point.getAllValues().get(0),\n                     point.getAllValues().get(1));\n\n        verify(mediator).setCursor(Style.Cursor.MOVE);\n    }\n\n    @Test\n    public void testOnMouseMoveBatch() throws Exception {\n        testOnMouseMove(true);\n    }\n\n    @Test\n    public void testOnMouseMoveDraw() throws Exception {\n        testOnMouseMove(false);\n    }\n\n    private void testOnMouseMove(boolean batchDrawing) {\n        final int xCoordinate = 123;\n        final int yCoordinate = 987;\n        final NodeMouseMoveEvent moveEvent = mock(NodeMouseMoveEvent.class);\n        final Transform transform = mock(Transform.class);\n        final Transform translated = mock(Transform.class);\n        final Viewport viewport = mock(Viewport.class);\n        final Scene scene = mock(Scene.class);\n\n        doReturn(xCoordinate).when(moveEvent).getX();\n        doReturn(yCoordinate).when(moveEvent).getY();\n        doReturn(NodeMouseMoveEvent.getType()).when(moveEvent).getAssociatedType();\n\n        doReturn(translated).when(transform).translate(anyDouble(),\n                                                       anyDouble());\n        doReturn(transform).when(transform).copy();\n\n        doReturn(scene).when(viewport).getScene();\n        doReturn(transform).when(viewport).getTransform();\n\n        doReturn(viewport).when(mediator).getViewport();\n        doReturn(transform).when(mediator).inverseTransform();\n        doReturn(batchDrawing).when(mediator).isBatchDraw();\n\n        mediator.onMouseMove(moveEvent);\n\n        verify(transform).translate(xCoordinate,\n                                    yCoordinate);\n\n        verify(viewport).setTransform(translated);\n\n        if (batchDrawing) {\n            verify(scene).batch();\n        } else {\n            verify(scene).draw();\n        }\n\n        final int xMovement = 10;\n        final int yMovement = 20;\n        final NodeMouseMoveEvent secondMoveEvent = mock(NodeMouseMoveEvent.class);\n\n        doReturn(xCoordinate + xMovement).when(secondMoveEvent).getX();\n        doReturn(yCoordinate + yMovement).when(secondMoveEvent).getY();\n\n        mediator.onMouseMove(secondMoveEvent);\n\n        verify(transform).translate(xMovement,\n                                    yMovement);\n\n        verify(viewport, times(2)).setTransform(translated);\n\n        if (batchDrawing) {\n            verify(scene, times(2)).batch();\n        } else {\n            verify(scene, times(2)).draw();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollBarsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GridLienzoScrollBarsTest {\n\n    private static final Integer SCROLL_LEFT = 500;\n\n    private static final Integer SCROLL_TOP = 1500;\n\n    private static final Integer SCROLL_WIDTH = 4000;\n\n    private static final Integer SCROLL_HEIGHT = 4000;\n\n    private static final Integer CLIENT_WIDTH = 2500;\n\n    private static final Integer CLIENT_HEIGHT = 500;\n\n    @Mock\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    private GridLienzoScrollBars gridLienzoScrollBars;\n\n    @Before\n    public void setUp() {\n        gridLienzoScrollBars = spy(new GridLienzoScrollBars(gridLienzoScrollHandler));\n    }\n\n    @Test\n    public void testGetHorizontalScrollPosition() {\n\n        doReturn(scrollPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double position = gridLienzoScrollBars.getHorizontalScrollPosition();\n\n        assertEquals(100d * SCROLL_LEFT / (SCROLL_WIDTH - CLIENT_WIDTH),\n                     position,\n                     0);\n    }\n\n    @Test\n    public void testGetHorizontalScrollPositionWhenScrollbarIsDisabled() {\n\n        doReturn(emptyPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double position = gridLienzoScrollBars.getHorizontalScrollPosition();\n\n        assertEquals(0,\n                     position,\n                     0);\n    }\n\n    @Test\n    public void testGetVerticalScrollPosition() {\n\n        doReturn(scrollPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double position = gridLienzoScrollBars.getVerticalScrollPosition();\n\n        assertEquals(100d * SCROLL_TOP / (SCROLL_HEIGHT - CLIENT_HEIGHT),\n                     position,\n                     0);\n    }\n\n    @Test\n    public void testGetVerticalScrollPositionWhenScrollbarIsDisabled() {\n\n        doReturn(emptyPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double position = gridLienzoScrollBars.getVerticalScrollPosition();\n\n        assertEquals(0,\n                     position,\n                     0);\n    }\n\n    @Test\n    public void testSetHorizontalScrollPosition() {\n\n        doReturn(scrollPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double percentage = 100d * SCROLL_LEFT / (SCROLL_WIDTH - CLIENT_WIDTH);\n\n        gridLienzoScrollBars.setHorizontalScrollPosition(percentage);\n\n        verify(gridLienzoScrollBars).setScrollLeft(eq(SCROLL_LEFT));\n    }\n\n    @Test\n    public void testSetVerticalScrollPosition() {\n\n        doReturn(scrollPanel()).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Double percentage = 100d * SCROLL_TOP / (SCROLL_HEIGHT - CLIENT_HEIGHT);\n\n        gridLienzoScrollBars.setVerticalScrollPosition(percentage);\n\n        verify(gridLienzoScrollBars).setScrollTop(eq(SCROLL_TOP));\n    }\n\n    @Test\n    public void testPanel() {\n\n        final Panel expectedPanel = mock(AbsolutePanel.class);\n\n        doReturn(expectedPanel).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Panel actualPanel = gridLienzoScrollBars.scrollPanel();\n\n        assertEquals(expectedPanel,\n                     actualPanel);\n    }\n\n    private Panel scrollPanel() {\n\n        final Panel panel = mock(AbsolutePanel.class);\n        final Element element = mock(Element.class);\n\n        doReturn(SCROLL_LEFT).when(element).getScrollLeft();\n        doReturn(SCROLL_TOP).when(element).getScrollTop();\n        doReturn(SCROLL_WIDTH).when(element).getScrollWidth();\n        doReturn(SCROLL_HEIGHT).when(element).getScrollHeight();\n        doReturn(CLIENT_WIDTH).when(element).getClientWidth();\n        doReturn(CLIENT_HEIGHT).when(element).getClientHeight();\n\n        doReturn(element).when(panel).getElement();\n\n        return panel;\n    }\n\n    private Panel emptyPanel() {\n\n        final Panel panel = mock(AbsolutePanel.class);\n        final Element element = mock(Element.class);\n\n        doReturn(0).when(element).getScrollLeft();\n        doReturn(0).when(element).getScrollTop();\n        doReturn(0).when(element).getScrollWidth();\n        doReturn(0).when(element).getScrollHeight();\n        doReturn(0).when(element).getClientWidth();\n        doReturn(0).when(element).getClientHeight();\n\n        doReturn(element).when(panel).getElement();\n\n        return panel;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollBoundsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.stream.Stream;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.model.impl.BaseBounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.grid.GridWidget;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridLienzoScrollBoundsTest {\n\n    @Mock\n    private DefaultGridLayer defaultGridLayer;\n\n    @Mock\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    private GridLienzoScrollBounds gridLienzoScrollBounds;\n\n    @Before\n    public void setUp() {\n        gridLienzoScrollBounds = spy(new GridLienzoScrollBounds(gridLienzoScrollHandler));\n\n        doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();\n    }\n\n    @Test\n    public void testMaxBoundXWhenAWidgetHasTheMaximumValue() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        assertEquals(biggestWidget().getX() + biggestWidget().getWidth(),\n                     gridLienzoScrollBounds.maxBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMaxBoundXWhenVisibleBoundsHasTheMaximumValue() {\n\n        final BaseBounds visibleBounds = makeMaxBounds();\n\n        doReturn(true).when(gridLienzoScrollBounds).hasVisibleBounds();\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(visibleBounds).when(defaultGridLayer).getVisibleBounds();\n\n        assertEquals(visibleBounds.getWidth(),\n                     gridLienzoScrollBounds.maxBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMaxBoundXWhenDefaultBoundsHasTheMaximumValue() {\n\n        final BaseBounds defaultBounds = makeMaxBounds();\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(defaultBounds).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertEquals(defaultBounds.getWidth(),\n                     gridLienzoScrollBounds.maxBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMaxBoundYWhenAWidgetHasTheMaximumValue() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        assertEquals(biggestWidget().getY() + biggestWidget().getHeight(),\n                     gridLienzoScrollBounds.maxBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testMaxBoundYWhenVisibleBoundsHasTheMaximumValue() {\n\n        final BaseBounds visibleBounds = makeMaxBounds();\n\n        doReturn(true).when(gridLienzoScrollBounds).hasVisibleBounds();\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(visibleBounds).when(defaultGridLayer).getVisibleBounds();\n\n        assertEquals(visibleBounds.getHeight(),\n                     gridLienzoScrollBounds.maxBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testMaxBoundYWhenDefaultBoundsHasTheMaximumValue() {\n\n        final BaseBounds defaultBounds = makeMaxBounds();\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(defaultBounds).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertEquals(defaultBounds.getHeight(),\n                     gridLienzoScrollBounds.maxBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundXWhenAWidgetHasTheMinimumValue() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        assertEquals(biggestWidget().getX(),\n                     gridLienzoScrollBounds.minBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundXWhenVisibleBoundsHasTheMinimumValue() {\n\n        final BaseBounds visibleBounds = makeMinBounds();\n\n        doReturn(true).when(gridLienzoScrollBounds).hasVisibleBounds();\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(visibleBounds).when(defaultGridLayer).getVisibleBounds();\n\n        assertEquals(visibleBounds.getX(),\n                     gridLienzoScrollBounds.minBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundXWhenDefaultBoundsHasTheMinimumValue() {\n\n        final BaseBounds defaultBounds = makeMinBounds();\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(defaultBounds).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertEquals(defaultBounds.getX(),\n                     gridLienzoScrollBounds.minBoundX(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundYWhenAWidgetHasTheMinimumValue() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        assertEquals(biggestWidget().getY(),\n                     gridLienzoScrollBounds.minBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundYWhenVisibleBoundsHasTheMinimumValue() {\n\n        final BaseBounds visibleBounds = makeMinBounds();\n\n        doReturn(true).when(gridLienzoScrollBounds).hasVisibleBounds();\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(visibleBounds).when(defaultGridLayer).getVisibleBounds();\n\n        assertEquals(visibleBounds.getY(),\n                     gridLienzoScrollBounds.minBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testMinBoundYWhenDefaultBoundsHasTheMinimumValue() {\n\n        final BaseBounds defaultBounds = makeMinBounds();\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n        doReturn(defaultBounds).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertEquals(defaultBounds.getY(),\n                     gridLienzoScrollBounds.minBoundY(),\n                     0);\n    }\n\n    @Test\n    public void testSetDefaultBounds() {\n\n        final Bounds bounds = mock(Bounds.class);\n\n        gridLienzoScrollBounds.setDefaultBounds(bounds);\n\n        assertEquals(bounds,\n                     gridLienzoScrollBounds.getDefaultBounds());\n    }\n\n    @Test\n    public void testGetVisibleBounds() {\n\n        final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class);\n        final Bounds expectedBounds = mock(Bounds.class);\n\n        doReturn(expectedBounds).when(defaultGridLayer).getVisibleBounds();\n        doReturn(defaultGridLayer).when(gridLienzoScrollBounds).getDefaultGridLayer();\n\n        final Bounds actualBounds = gridLienzoScrollBounds.getVisibleBounds();\n\n        assertEquals(expectedBounds,\n                     actualBounds);\n    }\n\n    @Test\n    public void testGetGridWidgets() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        final Set<GridWidget> gridWidgets = gridLienzoScrollBounds.getGridWidgets();\n\n        assertEquals(4,\n                     gridWidgets.size());\n    }\n\n    @Test\n    public void testGetVisibleGridWidgets() {\n\n        doReturn(getGridWidgets()).when(defaultGridLayer).getGridWidgets();\n\n        final Stream<GridWidget> gridWidgets = gridLienzoScrollBounds.getVisibleGridWidgets();\n\n        assertEquals(3,\n                     gridWidgets.count());\n    }\n\n    @Test\n    public void testHasDefaultBoundsWhenDefaultBoundsIsNull() {\n\n        doReturn(null).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertFalse(gridLienzoScrollBounds.hasDefaultBounds());\n    }\n\n    @Test\n    public void testHasDefaultBoundsWhenDefaultBoundsIsNotNull() {\n\n        doReturn(mock(Bounds.class)).when(gridLienzoScrollBounds).getDefaultBounds();\n\n        assertTrue(gridLienzoScrollBounds.hasDefaultBounds());\n    }\n\n    @Test\n    public void testHasVisibleBoundsWhenViewportIsNull() {\n\n        doReturn(null).when(gridLienzoScrollHandler).getViewport();\n\n        assertFalse(gridLienzoScrollBounds.hasVisibleBounds());\n    }\n\n    @Test\n    public void testHasVisibleBoundsWhenViewportIsNotNull() {\n\n        doReturn(mock(Viewport.class)).when(defaultGridLayer).getViewport();\n        doReturn(defaultGridLayer).when(gridLienzoScrollBounds).getDefaultGridLayer();\n\n        assertTrue(gridLienzoScrollBounds.hasVisibleBounds());\n    }\n\n    private GridWidget makeGridWidget(final Double x,\n                                      final Double y,\n                                      final Double width,\n                                      final Double height,\n                                      final boolean visible) {\n\n        final GridWidget mock = mock(GridWidget.class);\n\n        when(mock.getX()).thenReturn(x);\n        when(mock.getY()).thenReturn(y);\n        when(mock.getWidth()).thenReturn(width);\n        when(mock.getHeight()).thenReturn(height);\n        when(mock.isVisible()).thenReturn(visible);\n\n        return mock;\n    }\n\n    private HashSet<GridWidget> getGridWidgets() {\n        return new HashSet<GridWidget>() {{\n            add(smallestWidget());\n            add(mediumWidget());\n            add(biggestWidget());\n            add(hiddenWidget());\n        }};\n    }\n\n    private BaseBounds makeMaxBounds() {\n        return new BaseBounds(0,\n                              0,\n                              8000d,\n                              6000d);\n    }\n\n    private BaseBounds makeMinBounds() {\n        return new BaseBounds(-8000d,\n                              -6000d,\n                              1d,\n                              1d);\n    }\n\n    private GridWidget biggestWidget() {\n        return makeGridWidget(-3840d,\n                              -2160d,\n                              3840d * 2,\n                              2160d * 2,\n                              true);\n    }\n\n    private GridWidget mediumWidget() {\n        return makeGridWidget(-2560d,\n                              -1440d,\n                              2560d * 2,\n                              1440d * 2,\n                              true);\n    }\n\n    private GridWidget smallestWidget() {\n        return makeGridWidget(-1920d,\n                              -1080d,\n                              1920d * 2,\n                              1080d * 2,\n                              true);\n    }\n\n    private GridWidget hiddenWidget() {\n        return makeGridWidget(-3840d,\n                              -2160d,\n                              3840d * 2,\n                              2160d * 2,\n                              false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollHandlerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.ait.lienzo.client.core.event.NodeMouseDownEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseMoveEvent;\nimport com.ait.lienzo.client.core.mediator.Mediators;\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.ait.lienzo.test.LienzoMockitoTestRunner;\nimport com.google.gwt.dom.client.DivElement;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.MouseMoveEvent;\nimport com.google.gwt.event.dom.client.MouseMoveHandler;\nimport com.google.gwt.event.dom.client.MouseWheelEvent;\nimport com.google.gwt.event.dom.client.MouseWheelHandler;\nimport com.google.gwt.event.dom.client.ScrollEvent;\nimport com.google.gwt.event.dom.client.ScrollHandler;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.GridLienzoPanel;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.pinning.impl.RestrictedMousePanMediator;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyDouble;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollHandler.DEFAULT_INTERNAL_SCROLL_HEIGHT;\nimport static org.uberfire.ext.wires.core.grids.client.widget.scrollbars.GridLienzoScrollHandler.DEFAULT_INTERNAL_SCROLL_WIDTH;\n\n@RunWith(LienzoMockitoTestRunner.class)\npublic class GridLienzoScrollHandlerTest {\n\n    @Mock\n    private GridLienzoPanel gridLienzoPanel;\n\n    @Mock\n    private GridLienzoScrollPosition scrollPosition;\n\n    @Mock\n    private GridLienzoScrollBounds scrollBounds;\n\n    @Mock\n    private DefaultGridLayer defaultGridLayer;\n\n    @Mock\n    private Viewport viewport;\n\n    @Mock\n    private Transform transform;\n\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    @Before\n    public void setUp() {\n\n        this.gridLienzoScrollHandler = spy(new GridLienzoScrollHandler(gridLienzoPanel));\n\n        doReturn(transform).when(viewport).getTransform();\n        doReturn(viewport).when(defaultGridLayer).getViewport();\n        doReturn(scrollBounds).when(gridLienzoScrollHandler).scrollBounds();\n        doReturn(scrollPosition).when(gridLienzoScrollHandler).scrollPosition();\n        doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();\n    }\n\n    @Test\n    public void testInit() {\n\n        doNothing().when(gridLienzoScrollHandler).setupGridLienzoScrollStyle();\n        doNothing().when(gridLienzoScrollHandler).setupScrollBarSynchronization();\n        doNothing().when(gridLienzoScrollHandler).setupMouseDragSynchronization();\n        doNothing().when(gridLienzoScrollHandler).setupContextSwitcher();\n\n        gridLienzoScrollHandler.init();\n\n        verify(gridLienzoScrollHandler).setupGridLienzoScrollStyle();\n        verify(gridLienzoScrollHandler).setupScrollBarSynchronization();\n        verify(gridLienzoScrollHandler).setupMouseDragSynchronization();\n        verify(gridLienzoScrollHandler).setupContextSwitcher();\n    }\n\n    @Test\n    public void testSetupGridLienzoScrollStyle() {\n\n        final GridLienzoScrollUI scrollUI = mock(GridLienzoScrollUI.class);\n\n        doReturn(scrollUI).when(gridLienzoScrollHandler).gridLienzoScrollUI();\n\n        gridLienzoScrollHandler.setupGridLienzoScrollStyle();\n\n        verify(scrollUI).setup();\n    }\n\n    @Test\n    public void testGridLienzoScrollUI() {\n        final GridLienzoScrollUI scrollUI = gridLienzoScrollHandler.gridLienzoScrollUI();\n\n        assertTrue(scrollUI != null);\n    }\n\n    @Test\n    public void testSetupScrollBarSynchronization() {\n\n        final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);\n        final ScrollHandler scrollHandler = mock(ScrollHandler.class);\n\n        doReturn(scrollHandler).when(gridLienzoScrollHandler).onScroll();\n        doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();\n        doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();\n\n        gridLienzoScrollHandler.setupScrollBarSynchronization();\n\n        verify(gridLienzoScrollHandler).synchronizeScrollSize();\n        verify(scrollPanel).addDomHandler(scrollHandler,\n                                          ScrollEvent.getType());\n    }\n\n    @Test\n    public void testSynchronizeScrollSize() {\n\n        final AbsolutePanel panel = mock(AbsolutePanel.class);\n        final Integer internalScrollPanelWidth = 42;\n        final Integer internalScrollPanelHeight = 58;\n\n        doReturn(internalScrollPanelWidth).when(gridLienzoScrollHandler).calculateInternalScrollPanelWidth();\n        doReturn(internalScrollPanelHeight).when(gridLienzoScrollHandler).calculateInternalScrollPanelHeight();\n        doReturn(panel).when(gridLienzoScrollHandler).getInternalScrollPanel();\n\n        gridLienzoScrollHandler.synchronizeScrollSize();\n\n        verify(panel).setPixelSize(eq(internalScrollPanelWidth),\n                                   eq(internalScrollPanelHeight));\n    }\n\n    @Test\n    public void testCalculateInternalScrollPanelWidthWhenScrollbarXIsEnabled() {\n\n        final Double maximumBoundX = +20d;\n        final Double minimumBoundX = -20d;\n        final Double zoomLevel = 0.75d;\n        final Double currentScrollPosition = 10d;\n\n        doReturn(maximumBoundX).when(scrollBounds).maxBoundX();\n        doReturn(minimumBoundX).when(scrollBounds).minBoundX();\n        doReturn(zoomLevel).when(transform).getScaleX();\n        doReturn(currentScrollPosition).when(scrollPosition).deltaX();\n\n        final Integer panelWidth = gridLienzoScrollHandler.calculateInternalScrollPanelWidth();\n        final Integer scaledWidth = (int) ((maximumBoundX - minimumBoundX) * zoomLevel);\n\n        assertEquals(scaledWidth,\n                     panelWidth,\n                     0);\n    }\n\n    @Test\n    public void testCalculateInternalScrollPanelWidthWhenScrollbarXIsDisabled() {\n\n        final Double maximumBoundX = +20d;\n        final Double minimumBoundX = -20d;\n        final Double zoomLevel = 0.75d;\n        final Double currentScrollPosition = 0d;\n\n        doReturn(maximumBoundX).when(scrollBounds).maxBoundX();\n        doReturn(minimumBoundX).when(scrollBounds).minBoundX();\n        doReturn(zoomLevel).when(transform).getScaleX();\n        doReturn(currentScrollPosition).when(scrollPosition).deltaX();\n\n        final Integer panelWidth = gridLienzoScrollHandler.calculateInternalScrollPanelWidth();\n\n        assertEquals(DEFAULT_INTERNAL_SCROLL_WIDTH,\n                     panelWidth,\n                     0);\n    }\n\n    @Test\n    public void testCalculateInternalScrollPanelHeightWhenScrollbarYIsEnabled() {\n\n        final Double maximumBoundY = +20d;\n        final Double minimumBoundY = -20d;\n        final Double zoomLevel = 0.75d;\n        final Double currentScrollPosition = 10d;\n\n        doReturn(maximumBoundY).when(scrollBounds).maxBoundY();\n        doReturn(minimumBoundY).when(scrollBounds).minBoundY();\n        doReturn(zoomLevel).when(transform).getScaleY();\n        doReturn(currentScrollPosition).when(scrollPosition).deltaY();\n\n        final Integer panelHeight = gridLienzoScrollHandler.calculateInternalScrollPanelHeight();\n        final Integer scaledHeight = (int) ((maximumBoundY - minimumBoundY) * zoomLevel);\n\n        assertEquals(scaledHeight,\n                     panelHeight,\n                     0);\n    }\n\n    @Test\n    public void testCalculateInternalScrollPanelHeightWhenScrollbarYIsDisabled() {\n\n        final Double maximumBoundY = +20d;\n        final Double minimumBoundY = -20d;\n        final Double zoomLevel = 0.75d;\n        final Double currentScrollPosition = 0d;\n\n        doReturn(maximumBoundY).when(scrollBounds).maxBoundY();\n        doReturn(minimumBoundY).when(scrollBounds).minBoundY();\n        doReturn(zoomLevel).when(transform).getScaleY();\n        doReturn(currentScrollPosition).when(scrollPosition).deltaY();\n\n        final Integer panelHeight = gridLienzoScrollHandler.calculateInternalScrollPanelHeight();\n\n        assertEquals(DEFAULT_INTERNAL_SCROLL_HEIGHT,\n                     panelHeight,\n                     0);\n    }\n\n    @Test\n    public void testSetupMouseDragSynchronization() {\n\n        final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);\n        final LienzoPanel lienzoPanel = mock(LienzoPanel.class);\n        final Viewport viewport = mock(Viewport.class);\n        final Mediators mediators = mock(Mediators.class);\n\n        doReturn(mediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();\n        doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();\n        doReturn(viewport).when(lienzoPanel).getViewport();\n        doReturn(mediators).when(viewport).getMediators();\n\n        gridLienzoScrollHandler.setupMouseDragSynchronization();\n\n        verify(mediators).push(mediator);\n    }\n\n    @Test\n    public void testOnScrollWhenMouseIsNotDragging() {\n\n        final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);\n        final ScrollEvent scrollEvent = mock(ScrollEvent.class);\n\n        doReturn(false).when(mediator).isDragging();\n        doReturn(mediator).when(gridLienzoScrollHandler).getMousePanMediator();\n        doNothing().when(gridLienzoScrollHandler).updateGridLienzoPosition();\n\n        final ScrollHandler scrollHandler = gridLienzoScrollHandler.onScroll();\n        scrollHandler.onScroll(scrollEvent);\n\n        verify(gridLienzoScrollHandler).updateGridLienzoPosition();\n    }\n\n    @Test\n    public void testOnScrollWhenMouseIsDragging() {\n\n        final RestrictedMousePanMediator mediator = mock(RestrictedMousePanMediator.class);\n        final ScrollEvent scrollEvent = mock(ScrollEvent.class);\n\n        doReturn(true).when(mediator).isDragging();\n        doReturn(mediator).when(gridLienzoScrollHandler).getMousePanMediator();\n\n        final ScrollHandler scrollHandler = gridLienzoScrollHandler.onScroll();\n        scrollHandler.onScroll(scrollEvent);\n\n        verify(gridLienzoScrollHandler,\n               never()).updateGridLienzoPosition();\n    }\n\n    @Test\n    public void testRefreshScrollPosition() {\n\n        final GridLienzoScrollPosition scrollPosition = mock(GridLienzoScrollPosition.class);\n        final Double internalScrollPanelWidth = 42d;\n        final Double internalScrollPanelHeight = 58d;\n\n        doReturn(internalScrollPanelWidth).when(scrollPosition).currentRelativeX();\n        doReturn(internalScrollPanelHeight).when(scrollPosition).currentRelativeY();\n        doReturn(scrollPosition).when(gridLienzoScrollHandler).scrollPosition();\n        doNothing().when(gridLienzoScrollHandler).synchronizeScrollSize();\n        doNothing().when(gridLienzoScrollHandler).setScrollBarsPosition(anyDouble(),\n                                                                        anyDouble());\n\n        gridLienzoScrollHandler.refreshScrollPosition();\n\n        verify(gridLienzoScrollHandler).synchronizeScrollSize();\n        verify(gridLienzoScrollHandler).setScrollBarsPosition(internalScrollPanelWidth,\n                                                              internalScrollPanelHeight);\n    }\n\n    @Test\n    public void testUpdateGridLienzoPosition() {\n\n        final GridLienzoScrollBars scrollBars = mock(GridLienzoScrollBars.class);\n        final GridLienzoScrollPosition scrollPosition = mock(GridLienzoScrollPosition.class);\n        final Double percentageX = 40d;\n        final Double percentageY = 60d;\n        final Double currentXPosition = 400d;\n        final Double currentYPosition = 600d;\n\n        doReturn(scrollBars).when(gridLienzoScrollHandler).scrollBars();\n        doReturn(scrollPosition).when(gridLienzoScrollHandler).scrollPosition();\n        doReturn(percentageX).when(scrollBars).getHorizontalScrollPosition();\n        doReturn(percentageY).when(scrollBars).getVerticalScrollPosition();\n        doReturn(currentXPosition).when(scrollPosition).currentPositionX(percentageX);\n        doReturn(currentYPosition).when(scrollPosition).currentPositionY(percentageY);\n        doNothing().when(gridLienzoScrollHandler).updateGridLienzoTransform(anyDouble(),\n                                                                            anyDouble());\n\n        gridLienzoScrollHandler.updateGridLienzoPosition();\n\n        verify(gridLienzoScrollHandler).updateGridLienzoTransform(currentXPosition,\n                                                                  currentYPosition);\n    }\n\n    @Test\n    public void testUpdateGridLienzoPositionWithPositions() {\n\n        final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class);\n        final Viewport viewport = mock(Viewport.class);\n        final Transform transform = mock(Transform.class);\n        final Transform copy = mock(Transform.class);\n        final Transform translate = mock(Transform.class);\n        final Double oldTranslateX = 200d;\n        final Double oldTranslateY = 200d;\n        final Double scaleX = 2d;\n        final Double scaleY = 2d;\n        final Double currentXPosition = 500d;\n        final Double currentYPosition = 500d;\n\n        doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();\n        doReturn(viewport).when(defaultGridLayer).getViewport();\n        doReturn(transform).when(viewport).getTransform();\n        doReturn(oldTranslateX).when(transform).getTranslateX();\n        doReturn(oldTranslateY).when(transform).getTranslateY();\n        doReturn(scaleX).when(transform).getScaleX();\n        doReturn(scaleY).when(transform).getScaleY();\n        doReturn(copy).when(transform).copy();\n        doReturn(translate).when(copy).translate(anyDouble(),\n                                                 anyDouble());\n\n        gridLienzoScrollHandler.updateGridLienzoTransform(currentXPosition,\n                                                          currentYPosition);\n\n        final Double deltaX = currentXPosition - (oldTranslateX / scaleX);\n        final Double deltaY = currentYPosition - (oldTranslateY / scaleY);\n\n        verify(defaultGridLayer).batch();\n        verify(viewport).setTransform(translate);\n        verify(copy).translate(deltaX,\n                               deltaY);\n    }\n\n    @Test\n    public void testSetScrollBarsPosition() {\n\n        final GridLienzoScrollBars scrollBars = mock(GridLienzoScrollBars.class);\n        final Double xPercentage = 42d;\n        final Double yPercentage = 58d;\n\n        doReturn(scrollBars).when(gridLienzoScrollHandler).scrollBars();\n\n        gridLienzoScrollHandler.setScrollBarsPosition(xPercentage,\n                                                      yPercentage);\n\n        verify(scrollBars).setHorizontalScrollPosition(xPercentage);\n        verify(scrollBars).setVerticalScrollPosition(yPercentage);\n    }\n\n    @Test\n    public void testMakeRestrictedMousePanMediator() {\n\n        final Viewport viewport = viewportMock();\n        final DefaultGridLayer defaultGridLayer = mock(DefaultGridLayer.class);\n        final RestrictedMousePanMediator restrictedMousePanMediator = spy(gridLienzoScrollHandler.makeRestrictedMousePanMediator());\n\n        doNothing().when(gridLienzoScrollHandler).refreshScrollPosition();\n        doReturn(viewport).when(restrictedMousePanMediator).getViewport();\n        doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();\n        doReturn(viewport).when(defaultGridLayer).getViewport();\n\n        restrictedMousePanMediator.handleEvent(mouseDownEventMock());\n        restrictedMousePanMediator.handleEvent(mouseMoveEventMock());\n\n        verify(gridLienzoScrollHandler).refreshScrollPosition();\n    }\n\n    @Test\n    public void testGetMousePanMediator() {\n\n        final RestrictedMousePanMediator expectedMediator = mock(RestrictedMousePanMediator.class);\n        final LienzoPanel lienzoPanel = mock(LienzoPanel.class);\n        final Viewport viewport = mock(Viewport.class);\n        final Mediators mediators = mock(Mediators.class);\n\n        doReturn(lienzoPanel).when(gridLienzoScrollHandler).getLienzoPanel();\n        doReturn(viewport).when(lienzoPanel).getViewport();\n        doReturn(mediators).when(viewport).getMediators();\n        doReturn(expectedMediator).when(gridLienzoScrollHandler).makeRestrictedMousePanMediator();\n\n        gridLienzoScrollHandler.setupMouseDragSynchronization();\n\n        final RestrictedMousePanMediator actualMediator = gridLienzoScrollHandler.getMousePanMediator();\n\n        assertEquals(expectedMediator,\n                     actualMediator);\n    }\n\n    @Test\n    public void testGetScrollPanel() {\n\n        final AbsolutePanel expectedPanel = mock(AbsolutePanel.class);\n\n        doReturn(expectedPanel).when(gridLienzoPanel).getScrollPanel();\n\n        final AbsolutePanel actualPanel = gridLienzoScrollHandler.getScrollPanel();\n\n        assertEquals(expectedPanel,\n                     actualPanel);\n    }\n\n    @Test\n    public void testGetInternalScrollPanel() {\n\n        final AbsolutePanel expectedPanel = mock(AbsolutePanel.class);\n\n        doReturn(expectedPanel).when(gridLienzoPanel).getInternalScrollPanel();\n\n        final AbsolutePanel actualPanel = gridLienzoScrollHandler.getInternalScrollPanel();\n\n        assertEquals(expectedPanel,\n                     actualPanel);\n    }\n\n    @Test\n    public void testGetDomElementContainer() {\n\n        final AbsolutePanel expectedPanel = mock(AbsolutePanel.class);\n\n        doReturn(expectedPanel).when(gridLienzoPanel).getDomElementContainer();\n\n        final AbsolutePanel actualPanel = gridLienzoScrollHandler.getDomElementContainer();\n\n        assertEquals(expectedPanel,\n                     actualPanel);\n    }\n\n    @Test\n    public void testGetLienzoPanel() {\n\n        final LienzoPanel expectedPanel = mock(LienzoPanel.class);\n\n        doReturn(expectedPanel).when(gridLienzoPanel).getLienzoPanel();\n\n        final LienzoPanel actualPanel = gridLienzoScrollHandler.getLienzoPanel();\n\n        assertEquals(expectedPanel,\n                     actualPanel);\n    }\n\n    @Test\n    public void testEmptyLayerReuse() {\n        Assertions.assertThat(gridLienzoScrollHandler.emptyLayer()).isEqualTo(gridLienzoScrollHandler.emptyLayer());\n    }\n\n    @Test\n    public void testScrollBarsReuse() {\n        Assertions.assertThat(gridLienzoScrollHandler.scrollBars()).isEqualTo(gridLienzoScrollHandler.scrollBars());\n    }\n\n    @Test\n    public void testScrollPositionReuse() {\n        Assertions.assertThat(gridLienzoScrollHandler.scrollPosition()).isEqualTo(gridLienzoScrollHandler.scrollPosition());\n    }\n\n    @Test\n    public void testScrollBoundsReuse() {\n        Assertions.assertThat(gridLienzoScrollHandler.scrollBounds()).isEqualTo(gridLienzoScrollHandler.scrollBounds());\n    }\n\n    @Test\n    public void testGetDefaultGridLayerWhenLienzoGridLayerIsNotNull() {\n        final DefaultGridLayer actualLayer = gridLienzoScrollHandler.getDefaultGridLayer();\n\n        verify(gridLienzoScrollHandler, never()).emptyLayer();\n\n        assertEquals(defaultGridLayer,\n                     actualLayer);\n    }\n\n    @Test\n    public void testGetDefaultGridLayerWhenLienzoGridLayerIsNull() {\n\n        final DefaultGridLayer expectedLayer = mock(DefaultGridLayer.class);\n\n        doReturn(null).when(gridLienzoPanel).getDefaultGridLayer();\n        doReturn(expectedLayer).when(gridLienzoScrollHandler).emptyLayer();\n        doCallRealMethod().when(gridLienzoScrollHandler).getDefaultGridLayer();\n\n        final DefaultGridLayer actualLayer = gridLienzoScrollHandler.getDefaultGridLayer();\n\n        assertEquals(expectedLayer,\n                     actualLayer);\n    }\n\n    @Test\n    public void testEmptyLayer() {\n        assertTrue(gridLienzoScrollHandler.emptyLayer() != null);\n    }\n\n    @Test\n    public void testScrollBars() {\n        assertTrue(gridLienzoScrollHandler.scrollBars() != null);\n    }\n\n    @Test\n    public void testScrollPosition() {\n        assertTrue(gridLienzoScrollHandler.scrollPosition() != null);\n    }\n\n    @Test\n    public void testScrollBounds() {\n        assertTrue(gridLienzoScrollHandler.scrollBounds() != null);\n    }\n\n    @Test\n    public void testScrollbarWidth() {\n\n        final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);\n        final Element element = mock(Element.class);\n        final Integer offsetWidth = 1014;\n        final Integer clientWidth = 1000;\n\n        doReturn(offsetWidth).when(element).getOffsetWidth();\n        doReturn(clientWidth).when(element).getClientWidth();\n        doReturn(element).when(scrollPanel).getElement();\n        doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Integer expectedScrollbarWidth = offsetWidth - clientWidth;\n        final Integer actualScrollbarWidth = gridLienzoScrollHandler.scrollbarWidth();\n\n        assertEquals(expectedScrollbarWidth,\n                     actualScrollbarWidth);\n    }\n\n    @Test\n    public void testScrollbarHeight() {\n\n        final AbsolutePanel scrollPanel = mock(AbsolutePanel.class);\n        final Element element = mock(Element.class);\n        final Integer offsetHeight = 1014;\n        final Integer clientHeight = 1000;\n\n        doReturn(offsetHeight).when(element).getOffsetHeight();\n        doReturn(clientHeight).when(element).getClientHeight();\n        doReturn(element).when(scrollPanel).getElement();\n        doReturn(scrollPanel).when(gridLienzoScrollHandler).getScrollPanel();\n\n        final Integer expectedScrollbarHeight = offsetHeight - clientHeight;\n        final Integer actualScrollbarHeight = gridLienzoScrollHandler.scrollbarHeight();\n\n        assertEquals(expectedScrollbarHeight,\n                     actualScrollbarHeight);\n    }\n\n    @Test\n    public void testSetupContextSwitcher() {\n\n        final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);\n        final LienzoPanel lienzoPanel = mock(LienzoPanel.class);\n        final MouseWheelHandler wheelHandler = mock(MouseWheelHandler.class);\n        final MouseMoveHandler moveHandler = mock(MouseMoveHandler.class);\n\n        doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();\n        doReturn(wheelHandler).when(gridLienzoScrollHandler).disablePointerEvents();\n        doReturn(moveHandler).when(gridLienzoScrollHandler).enablePointerEvents();\n\n        gridLienzoScrollHandler.setupContextSwitcher();\n\n        verify(domElementContainer).addDomHandler(wheelHandler, MouseWheelEvent.getType());\n        verify(gridLienzoPanel).addMouseMoveHandler(moveHandler);\n    }\n\n    @Test\n    public void testEnablePointerEvents() {\n\n        final MouseMoveEvent mouseMoveEvent = mock(MouseMoveEvent.class);\n        final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);\n        final GridLienzoScrollUI scrollUI = mock(GridLienzoScrollUI.class);\n\n        doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();\n        doReturn(scrollUI).when(gridLienzoScrollHandler).gridLienzoScrollUI();\n        doNothing().when(scrollUI).disablePointerEvents(any());\n\n        gridLienzoScrollHandler.enablePointerEvents().onMouseMove(mouseMoveEvent);\n\n        verify(scrollUI).enablePointerEvents(domElementContainer);\n    }\n\n    @Test\n    public void testDisablePointerEvents() {\n\n        final MouseWheelEvent mouseWheelEvent = mock(MouseWheelEvent.class);\n        final AbsolutePanel domElementContainer = mock(AbsolutePanel.class);\n        final GridLienzoScrollUI scrollUI = mock(GridLienzoScrollUI.class);\n\n        doReturn(domElementContainer).when(gridLienzoPanel).getDomElementContainer();\n        doReturn(scrollUI).when(gridLienzoScrollHandler).gridLienzoScrollUI();\n        doNothing().when(scrollUI).disablePointerEvents(any());\n\n        gridLienzoScrollHandler.disablePointerEvents().onMouseWheel(mouseWheelEvent);\n\n        verify(scrollUI).disablePointerEvents(domElementContainer);\n    }\n\n    private Viewport viewportMock() {\n\n        final Viewport viewport = mock(Viewport.class);\n        final DivElement divElement = mock(DivElement.class);\n        final Style style = mock(Style.class);\n\n        doReturn(style).when(divElement).getStyle();\n        doReturn(divElement).when(viewport).getElement();\n        doReturn(transformMock()).when(viewport).getTransform();\n\n        return viewport;\n    }\n\n    public Transform transformMock() {\n\n        final Transform transform = mock(Transform.class);\n\n        doReturn(transform).when(transform).getInverse();\n\n        return transform;\n    }\n\n    private NodeMouseDownEvent mouseDownEventMock() {\n\n        final NodeMouseDownEvent mouseDownEvent = mock(NodeMouseDownEvent.class);\n\n        doReturn(NodeMouseDownEvent.getType()).when(mouseDownEvent).getAssociatedType();\n\n        return mouseDownEvent;\n    }\n\n    private NodeMouseMoveEvent mouseMoveEventMock() {\n\n        final NodeMouseMoveEvent mouseMoveEvent = mock(NodeMouseMoveEvent.class);\n\n        doReturn(NodeMouseMoveEvent.getType()).when(mouseMoveEvent).getAssociatedType();\n\n        return mouseMoveEvent;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollPositionTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Transform;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.wires.core.grids.client.model.Bounds;\nimport org.uberfire.ext.wires.core.grids.client.widget.layer.impl.DefaultGridLayer;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GridLienzoScrollPositionTest {\n\n    private static final Double MAX_BOUND_X = 2000d;\n\n    private static final Double MAX_BOUND_Y = 2000d;\n\n    private static final Double MIN_BOUND_X = -2000d;\n\n    private static final Double MIN_BOUND_Y = -2000d;\n\n    private static final Double VISIBLE_BOUND_WIDTH = 2500d;\n\n    private static final Double VISIBLE_BOUND_HEIGHT = 500d;\n\n    private static final Double TRANSLATE_X = 1300d;\n\n    private static final Double TRANSLATE_Y = 700d;\n\n    private static final Double SCALE_X = 1d;\n\n    private static final Double SCALE_Y = 1d;\n\n    private static final Double CURRENT_Y = -(TRANSLATE_Y / SCALE_Y + MIN_BOUND_Y);\n\n    private static final Double CURRENT_X = -(TRANSLATE_X / SCALE_X + MIN_BOUND_X);\n\n    private static final Double DELTA_Y = MAX_BOUND_Y - MIN_BOUND_Y - VISIBLE_BOUND_HEIGHT;\n\n    private static final Double DELTA_X = MAX_BOUND_X - MIN_BOUND_X - VISIBLE_BOUND_WIDTH;\n\n    @Mock\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    @Mock\n    private DefaultGridLayer defaultGridLayer;\n\n    @Mock\n    private GridLienzoScrollBounds scrollBounds;\n\n    private GridLienzoScrollPosition gridLienzoScrollPosition;\n\n    @Before\n    public void setUp() {\n\n        gridLienzoScrollPosition = spy(new GridLienzoScrollPosition(gridLienzoScrollHandler));\n\n        doReturn(makeTransform()).when(gridLienzoScrollPosition).getTransform();\n        doReturn(makeVisibleBounds()).when(gridLienzoScrollPosition).getVisibleBounds();\n        doReturn(makeScrollBoundsHelper()).when(gridLienzoScrollPosition).bounds();\n        doReturn(defaultGridLayer).when(gridLienzoScrollHandler).getDefaultGridLayer();\n        doReturn(scrollBounds).when(gridLienzoScrollHandler).scrollBounds();\n    }\n\n    @Test\n    public void testGetCurrentXLevel() {\n\n        final Double actualLevel = gridLienzoScrollPosition.currentRelativeX();\n        final Double expectedLevel = 100 * CURRENT_X / DELTA_X;\n\n        assertEquals(expectedLevel,\n                     actualLevel,\n                     0);\n    }\n\n    @Test\n    public void testGetCurrentXLevelWhenDeltaXIsZero() {\n\n        doReturn(0d).when(gridLienzoScrollPosition).deltaX();\n\n        final Double actualLevel = gridLienzoScrollPosition.currentRelativeX();\n        final Double expectedLevel = 0d;\n\n        assertEquals(expectedLevel,\n                     actualLevel,\n                     0);\n    }\n\n    @Test\n    public void testGetCurrentYLevel() {\n\n        final Double actualLevel = gridLienzoScrollPosition.currentRelativeY();\n        final Double expectedLevel = 100 * CURRENT_Y / DELTA_Y;\n\n        assertEquals(actualLevel,\n                     expectedLevel,\n                     0);\n    }\n\n    @Test\n    public void testGetCurrentYLevelWhenDeltaYIsZero() {\n\n        doReturn(0d).when(gridLienzoScrollPosition).deltaY();\n\n        final Double actualLevel = gridLienzoScrollPosition.currentRelativeY();\n        final Double expectedLevel = 0d;\n\n        assertEquals(expectedLevel,\n                     actualLevel,\n                     0);\n    }\n\n    @Test\n    public void testCurrentXPosition() {\n\n        final Double level = 46.66d;\n        final Double expectedPosition = -(MIN_BOUND_X + (DELTA_X * level / 100));\n        final Double actualPosition = gridLienzoScrollPosition.currentPositionX(level);\n\n        assertEquals(expectedPosition,\n                     actualPosition,\n                     0);\n    }\n\n    @Test\n    public void testCurrentYPosition() {\n\n        final Double level = 37.14d;\n        final Double expectedPosition = -(MIN_BOUND_Y + (DELTA_Y * level / 100));\n        final Double actualPosition = gridLienzoScrollPosition.currentPositionY(level);\n\n        assertEquals(expectedPosition,\n                     actualPosition,\n                     0);\n    }\n\n    @Test\n    public void testGetVisibleBounds() {\n\n        final Bounds expectedBounds = mock(Bounds.class);\n\n        doReturn(expectedBounds).when(defaultGridLayer).getVisibleBounds();\n        doCallRealMethod().when(gridLienzoScrollPosition).getVisibleBounds();\n\n        final Bounds actualBounds = gridLienzoScrollPosition.getVisibleBounds();\n\n        assertEquals(expectedBounds,\n                     actualBounds);\n    }\n\n    @Test\n    public void testGetTransform() {\n\n        final Viewport viewport = mock(Viewport.class);\n        final Transform expectedTransform = mock(Transform.class);\n\n        doReturn(viewport).when(defaultGridLayer).getViewport();\n        doReturn(expectedTransform).when(viewport).getTransform();\n        doCallRealMethod().when(gridLienzoScrollPosition).getTransform();\n\n        final Transform actualTransform = gridLienzoScrollPosition.getTransform();\n\n        assertEquals(expectedTransform,\n                     actualTransform);\n    }\n\n    @Test\n    public void testBounds() {\n\n        doCallRealMethod().when(gridLienzoScrollPosition).bounds();\n\n        assertTrue(gridLienzoScrollPosition.bounds() != null);\n    }\n\n    private GridLienzoScrollBounds makeScrollBoundsHelper() {\n\n        final GridLienzoScrollBounds gridLienzoScrollBounds = mock(GridLienzoScrollBounds.class);\n\n        doReturn(MAX_BOUND_X).when(gridLienzoScrollBounds).maxBoundX();\n        doReturn(MAX_BOUND_Y).when(gridLienzoScrollBounds).maxBoundY();\n        doReturn(MIN_BOUND_X).when(gridLienzoScrollBounds).minBoundX();\n        doReturn(MIN_BOUND_Y).when(gridLienzoScrollBounds).minBoundY();\n\n        return gridLienzoScrollBounds;\n    }\n\n    private Bounds makeVisibleBounds() {\n\n        final Bounds bounds = mock(Bounds.class);\n\n        doReturn(VISIBLE_BOUND_WIDTH).when(bounds).getWidth();\n        doReturn(VISIBLE_BOUND_HEIGHT).when(bounds).getHeight();\n\n        return bounds;\n    }\n\n    private Transform makeTransform() {\n\n        final Transform transform = mock(Transform.class);\n\n        doReturn(TRANSLATE_X).when(transform).getTranslateX();\n        doReturn(TRANSLATE_Y).when(transform).getTranslateY();\n        doReturn(SCALE_X).when(transform).getScaleX();\n        doReturn(SCALE_Y).when(transform).getScaleY();\n\n        return transform;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-grids/src/test/java/org/uberfire/ext/wires/core/grids/client/widget/scrollbars/GridLienzoScrollUITest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.grids.client.widget.scrollbars;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GridLienzoScrollUITest {\n\n    @Mock\n    private AbsolutePanel panel;\n\n    @Mock\n    private Style style;\n\n    @Mock\n    private GridLienzoScrollHandler gridLienzoScrollHandler;\n\n    private GridLienzoScrollUI gridLienzoScrollUI;\n\n    @Before\n    public void setUp() {\n        this.gridLienzoScrollUI = spy(new GridLienzoScrollUI(gridLienzoScrollHandler));\n\n        doReturn(style).when(gridLienzoScrollUI).style(any());\n    }\n\n    @Test\n    public void testSetup() {\n\n        gridLienzoScrollUI.setup();\n\n        verify(gridLienzoScrollUI).applyScrollPanelStyle();\n        verify(gridLienzoScrollUI).applyInternalScrollPanelStyle();\n        verify(gridLienzoScrollUI).applyDomElementContainerStyle();\n    }\n\n    @Test\n    public void testApplyScrollPanelStyle() {\n\n        gridLienzoScrollUI.applyScrollPanelStyle();\n\n        verify(style).setPosition(Style.Position.RELATIVE);\n        verify(style).setOverflow(Style.Overflow.SCROLL);\n    }\n\n    @Test\n    public void testApplyInternalScrollPanelStyle() {\n\n        gridLienzoScrollUI.applyInternalScrollPanelStyle();\n\n        verify(style).setPosition(Style.Position.ABSOLUTE);\n    }\n\n    @Test\n    public void testApplyDomElementContainerStyle() {\n\n        doReturn(style).when(gridLienzoScrollUI).style(any());\n\n        gridLienzoScrollUI.applyDomElementContainerStyle();\n\n        verify(style).setPosition(Style.Position.ABSOLUTE);\n        verify(style).setZIndex(1);\n    }\n\n    @Test\n    public void testEnablePointerEvents() {\n\n        final Widget widget = mock(Widget.class);\n\n        gridLienzoScrollUI.enablePointerEvents(widget);\n\n        verify(gridLienzoScrollUI).setPointerEvents(widget, \"initial\");\n    }\n\n    @Test\n    public void testDisablePointerEvents() {\n\n        final Widget widget = mock(Widget.class);\n\n        gridLienzoScrollUI.disablePointerEvents(widget);\n\n        verify(gridLienzoScrollUI).setPointerEvents(widget, \"none\");\n    }\n\n    @Test\n    public void testSetPointerEvents() {\n\n        final Widget widget = mock(Widget.class);\n\n        gridLienzoScrollUI.setPointerEvents(widget, \"none\");\n\n        verify(style).setProperty(eq(\"pointerEvents\"), eq(\"none\"));\n    }\n\n    @Test\n    public void testStyle() {\n\n        final Widget widget = mock(Widget.class);\n        final Element element = mock(Element.class);\n        final Style expectedStyle = mock(Style.class);\n\n        doReturn(expectedStyle).when(element).getStyle();\n        doReturn(element).when(widget).getElement();\n        doCallRealMethod().when(gridLienzoScrollUI).style(any());\n\n        final Style actualStyle = gridLienzoScrollUI.style(widget);\n\n        assertEquals(expectedStyle,\n                     actualStyle);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-core-scratchpad</artifactId>\n\n  <name>Uberfire Wires :: Core Scratch Pad</name>\n  <description>Wires Core Scratch Pad</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/canvas/WiresScratchPadDropContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.canvas;\n\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.factories.ShapeDropContext;\n\npublic class WiresScratchPadDropContext implements ShapeDropContext<WiresContainer> {\n\n    private WiresContainer context;\n\n    @Override\n    public WiresContainer getContext() {\n        return context;\n    }\n\n    @Override\n    public void setContext(final WiresContainer context) {\n        this.context = context;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/canvas/WiresScratchPadScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.canvas;\n\nimport java.util.function.Consumer;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.wires.core.api.containers.ContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.RequiresContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeAddedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDeletedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragCompleteEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragPreviewEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\nimport org.uberfire.ext.wires.core.client.canvas.WiresCanvas;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@SuppressWarnings(\"unused\")\n@Dependent\n@WorkbenchScreen(identifier = \"WiresScratchPadScreen\")\npublic class WiresScratchPadScreen extends WiresCanvas implements ContainerManager {\n\n    @Inject\n    private Event<ClearEvent> clearEvent;\n\n    @Inject\n    private Event<ShapeSelectedEvent> shapeSelectedEvent;\n\n    @Inject\n    private Event<ShapeAddedEvent> shapeAddedEvent;\n\n    @Inject\n    private Event<ShapeDeletedEvent> shapeDeletedEvent;\n\n    private Menus menus;\n\n    private WiresScratchPadDropContext dropContext = new WiresScratchPadDropContext();\n\n    @PostConstruct\n    public void setup() {\n        this.menus = MenuFactory\n                .newTopLevelMenu(\"Clear grid\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        clear();\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Delete selected\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        if (isShapeSelected()) {\n                            deleteShape(getSelectedShape());\n                        }\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Clear selection\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        if (isShapeSelected()) {\n                            clearSelection();\n                            menus.getItems().get(1).setEnabled(false);\n                            menus.getItems().get(2).setEnabled(false);\n                        }\n                    }\n                })\n                .endMenu()\n                .build();\n        menus.getItems().get(0).setEnabled(false);\n        menus.getItems().get(1).setEnabled(false);\n        menus.getItems().get(2).setEnabled(false);\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Canvas\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menus);\n    }\n\n    @Override\n    public void selectShape(final WiresBaseShape shape) {\n        shapeSelectedEvent.fire(new ShapeSelectedEvent(shape));\n    }\n\n    public void onShapeSelected(@Observes ShapeSelectedEvent event) {\n        super.selectShape(event.getShape());\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n    }\n\n    @Override\n    public void deselectShape(final WiresBaseShape shape) {\n        super.deselectShape(shape);\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n    }\n\n    public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) {\n        //Only Shapes that require a ContainerManager can be dropped into Containers\n        if (!(shapeDragPreviewEvent.getShape() instanceof RequiresContainerManager)) {\n            dropContext.setContext(null);\n            return;\n        }\n\n        //Find a Container to drop the Shape into\n        final double cx = getX(shapeDragPreviewEvent.getX());\n        final double cy = getY(shapeDragPreviewEvent.getY());\n        final WiresContainer container = getContainer(cx,\n                                                      cy);\n        dropContext.setContext(container);\n        canvasLayer.batch();\n    }\n\n    public void onDragCompleteHandler(@Observes ShapeDragCompleteEvent shapeDragCompleteEvent) {\n        final WiresBaseShape wiresShape = shapeDragCompleteEvent.getShape();\n\n        //If there's no Shape to add then exit\n        if (wiresShape == null) {\n            return;\n        }\n\n        //Get Shape's co-ordinates relative to the Canvas\n        final double cx = getX(shapeDragCompleteEvent.getX());\n        final double cy = getY(shapeDragCompleteEvent.getY());\n\n        //If the Shape was dropped outside the bounds of the Canvas then exit\n        if (cx < 0 || cy < 0) {\n            return;\n        }\n        if (cx > getOffsetWidth() || cy > getOffsetHeight()) {\n            return;\n        }\n\n        //Add Shape to Canvas\n        wiresShape.setX(cx);\n        wiresShape.setY(cy);\n\n        //If we're adding the Shape to a Container notify the Container of a new child. We cannot add Shape\n        //to the Container's underlying (impl) Group (which would be ideal) as we can no longer select the\n        //child separately from the Group. We therefore just keep a reference to children in the Container\n        //and move them when we move the Container\n        final WiresContainer container = dropContext.getContext();\n        if (container != null) {\n            container.attachShape(wiresShape);\n            container.setHover(false);\n        }\n\n        addShape(wiresShape);\n\n        //Enable clearing of Canvas now a Shape has been added\n        menus.getItems().get(0).setEnabled(true);\n\n        //Notify other Panels of a Shape being added\n        shapeAddedEvent.fire(new ShapeAddedEvent(wiresShape));\n    }\n\n    private double getX(double xShapeEvent) {\n        return xShapeEvent - getAbsoluteLeft();\n    }\n\n    private double getY(double yShapeEvent) {\n        return yShapeEvent - getAbsoluteTop();\n    }\n\n    @Override\n    public void clear() {\n        if (Window.confirm(\"Are you sure to clean the canvas?\")) {\n            clearEvent.fire(new ClearEvent());\n        }\n    }\n\n    public void onClear(@Observes ClearEvent event) {\n        super.clear();\n        menus.getItems().get(0).setEnabled(false);\n        menus.getItems().get(1).setEnabled(false);\n        menus.getItems().get(2).setEnabled(false);\n    }\n\n    @Override\n    public void deleteShape(final WiresBaseShape shape) {\n        if (Window.confirm(\"Are you sure to remove the selected shape?\")) {\n            shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));\n        }\n    }\n\n    @Override\n    public void forceDeleteShape(final WiresBaseShape shape) {\n        shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));\n    }\n\n    public void onShapeDeleted(@Observes ShapeDeletedEvent event) {\n        super.deleteShape(event.getShape());\n        menus.getItems().get(0).setEnabled(getShapesInCanvas().size() > 0);\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n    }\n\n    @Override\n    public void addShape(final WiresBaseShape shape) {\n        super.addShape(shape);\n\n        //Attach relevant handlers\n        if (shape instanceof RequiresContainerManager) {\n            ((RequiresContainerManager) shape).setContainerManager(this);\n        }\n    }\n\n    @Override\n    public WiresContainer getContainer(final double cx,\n                                       final double cy) {\n        WiresContainer container = null;\n        for (WiresShape ws : getShapesInCanvas()) {\n            if (ws instanceof WiresContainer) {\n                final WiresContainer wc = (WiresContainer) ws;\n                wc.setHover(false);\n                if (wc.contains(cx,\n                                cy)) {\n                    wc.setHover(true);\n                    container = wc;\n                }\n            }\n        }\n        return container;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/connectors/ArrowFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.connectors;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Arrow;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.shared.core.types.ArrowType;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ConnectorCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors.WiresArrow;\n\n@ApplicationScoped\npublic class ArrowFactory extends AbstractBaseFactory<Arrow> {\n\n    private static final String DESCRIPTION = \"Arrow\";\n\n    private static final int BASE_WIDTH = 10;\n    private static final int HEAD_WIDTH = 20;\n    private static final int ARROW_ANGLE = 45;\n    private static final int BASE_ANGLE = 30;\n\n    private static final int SHAPE_SIZE_X = 50;\n    private static final int SHAPE_SIZE_Y = 50;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ConnectorCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresArrow(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresArrow;\n    }\n\n    @Override\n    protected Arrow makeShape() {\n        final Arrow arrow = new Arrow(new Point2D(0 - (SHAPE_SIZE_X / 2),\n                                                  0 - (SHAPE_SIZE_Y / 2)),\n                                      new Point2D(SHAPE_SIZE_X / 2,\n                                                  SHAPE_SIZE_Y / 2),\n                                      BASE_WIDTH,\n                                      HEAD_WIDTH,\n                                      ARROW_ANGLE,\n                                      BASE_ANGLE,\n                                      ArrowType.AT_END);\n        arrow.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(1)\n                .setFillColor(\"#ffff00\")\n                .setDraggable(false);\n        return arrow;\n    }\n\n    @Override\n    protected double getWidth() {\n        return SHAPE_SIZE_X + 10;\n    }\n\n    @Override\n    protected double getHeight() {\n        return SHAPE_SIZE_Y + 10;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/connectors/BezierCurveFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.connectors;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.BezierCurve;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ConnectorCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors.WiresBezierCurve;\n\n@ApplicationScoped\npublic class BezierCurveFactory extends AbstractBaseFactory<BezierCurve> {\n\n    private static final String DESCRIPTION = \"Curve\";\n\n    private static final int SHAPE_SIZE_X = 50;\n    private static final int SHAPE_SIZE_Y = 50;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ConnectorCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresBezierCurve(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresBezierCurve;\n    }\n\n    @Override\n    protected BezierCurve makeShape() {\n        final BezierCurve curve = new BezierCurve(0 - SHAPE_SIZE_X,\n                                                  0 - SHAPE_SIZE_Y,\n                                                  0 - SHAPE_SIZE_X,\n                                                  SHAPE_SIZE_Y,\n                                                  SHAPE_SIZE_X,\n                                                  0 - SHAPE_SIZE_Y,\n                                                  SHAPE_SIZE_X,\n                                                  SHAPE_SIZE_Y);\n        curve.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setDraggable(false);\n        return curve;\n    }\n\n    @Override\n    protected double getWidth() {\n        return (SHAPE_SIZE_X + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n\n    @Override\n    protected double getHeight() {\n        return (SHAPE_SIZE_Y + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/connectors/LineFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.connectors;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.shared.core.types.LineCap;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ConnectorCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors.WiresLine;\n\n@ApplicationScoped\npublic class LineFactory extends AbstractBaseFactory<Line> {\n\n    private static final String DESCRIPTION = \"Line\";\n\n    private static final int SHAPE_SIZE_X = 40;\n    private static final int SHAPE_SIZE_Y = 40;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ConnectorCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresLine(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresLine;\n    }\n\n    @Override\n    protected Line makeShape() {\n        final Line line = new Line(0 - (SHAPE_SIZE_X / 2),\n                                   0 - (SHAPE_SIZE_Y / 2),\n                                   SHAPE_SIZE_X / 2,\n                                   SHAPE_SIZE_Y / 2);\n        line.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(ShapesUtils.RGB_FILL_SHAPE)\n                .setLineCap(LineCap.ROUND)\n                .setStrokeWidth(3)\n                .setDraggable(false);\n        return line;\n    }\n\n    @Override\n    protected double getWidth() {\n        return SHAPE_SIZE_X + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n\n    @Override\n    protected double getHeight() {\n        return SHAPE_SIZE_Y + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/containers/CircularContainerFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.containers;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ContainerCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.containers.WiresCircularContainer;\n\n@ApplicationScoped\npublic class CircularContainerFactory extends AbstractBaseFactory<Circle> {\n\n    private static final String DESCRIPTION = \"Container\";\n\n    private static final int SHAPE_RADIUS = 100;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ContainerCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresCircularContainer(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresCircularContainer;\n    }\n\n    @Override\n    protected Circle makeShape() {\n        final Circle circle = new Circle(SHAPE_RADIUS);\n        circle.setStrokeColor(ShapesUtils.RGB_STROKE_CONTAINER)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_CONTAINER)\n                .setFillColor(ShapesUtils.RGB_FILL_CONTAINER)\n                .setAlpha(ShapesUtils.RGB_ALPHA_CONTAINER)\n                .setDraggable(false);\n        return circle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n\n    @Override\n    protected double getHeight() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/containers/RectangularContainerFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.containers;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ContainerCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.containers.WiresRectangularContainer;\n\n@ApplicationScoped\npublic class RectangularContainerFactory extends AbstractBaseFactory<Rectangle> {\n\n    private static final String DESCRIPTION = \"Container\";\n\n    private static final int SHAPE_SIZE_X = 200;\n    private static final int SHAPE_SIZE_Y = 200;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ContainerCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresRectangularContainer(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresRectangularContainer;\n    }\n\n    @Override\n    protected Rectangle makeShape() {\n        final Rectangle rectangle = new Rectangle(SHAPE_SIZE_X,\n                                                  SHAPE_SIZE_Y,\n                                                  10);\n        rectangle.setX(0 - (SHAPE_SIZE_X / 2))\n                .setY(0 - (SHAPE_SIZE_Y / 2))\n                .setStrokeColor(ShapesUtils.RGB_STROKE_CONTAINER)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_CONTAINER)\n                .setFillColor(ShapesUtils.RGB_FILL_CONTAINER)\n                .setAlpha(ShapesUtils.RGB_ALPHA_CONTAINER)\n                .setDraggable(false);\n        return rectangle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return SHAPE_SIZE_X + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n\n    @Override\n    protected double getHeight() {\n        return SHAPE_SIZE_Y + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/dynamic/CircleFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.dynamic;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ShapeCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic.WiresCircle;\n\n@ApplicationScoped\npublic class CircleFactory extends AbstractBaseFactory<Circle> {\n\n    private static final String DESCRIPTION = \"Circle\";\n\n    private static final int SHAPE_RADIUS = 25;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ShapeCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresCircle(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresCircle;\n    }\n\n    @Override\n    protected Circle makeShape() {\n        final Circle circle = new Circle(SHAPE_RADIUS);\n        circle.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(\"#00ff00\")\n                .setDraggable(false);\n        return circle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n\n    @Override\n    protected double getHeight() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/dynamic/RectangleFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.dynamic;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.ShapeCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic.WiresRectangle;\n\n@ApplicationScoped\npublic class RectangleFactory extends AbstractBaseFactory<Rectangle> {\n\n    private static final String DESCRIPTION = \"Box\";\n\n    private static final int SHAPE_SIZE_X = 70;\n    private static final int SHAPE_SIZE_Y = 40;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return ShapeCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresRectangle(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresRectangle;\n    }\n\n    @Override\n    protected Rectangle makeShape() {\n        final Rectangle rectangle = new Rectangle(SHAPE_SIZE_X,\n                                                  SHAPE_SIZE_Y,\n                                                  5);\n        rectangle.setX(0 - (SHAPE_SIZE_X / 2))\n                .setY(0 - (SHAPE_SIZE_Y / 2))\n                .setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(ShapesUtils.RGB_FILL_SHAPE)\n                .setDraggable(false);\n        return rectangle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return SHAPE_SIZE_X + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n\n    @Override\n    protected double getHeight() {\n        return SHAPE_SIZE_Y + (ShapesUtils.RGB_STROKE_WIDTH_SHAPE * 2);\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/fixed/FixedCircleFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.fixed;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.FixedShapeCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.fixed.WiresFixedCircle;\n\n@ApplicationScoped\npublic class FixedCircleFactory extends AbstractBaseFactory<Circle> {\n\n    private static final String DESCRIPTION = \"Circle\";\n\n    private static final int SHAPE_RADIUS = 25;\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return FixedShapeCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresFixedCircle(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresFixedCircle;\n    }\n\n    @Override\n    protected Circle makeShape() {\n        final Circle circle = new Circle(SHAPE_RADIUS);\n        circle.setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(\"#ff0000\")\n                .setAlpha(0.75)\n                .setDraggable(false);\n        return circle;\n    }\n\n    @Override\n    protected double getWidth() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n\n    @Override\n    protected double getHeight() {\n        return (SHAPE_RADIUS + ShapesUtils.RGB_STROKE_WIDTH_SHAPE) * 2;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/factories/fixed/FixedTextFactory.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.factories.fixed;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.client.core.shape.Layer;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.client.core.types.TextMetrics;\nimport com.ait.lienzo.client.widget.LienzoPanel;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.ait.lienzo.shared.core.types.TextBaseLine;\nimport org.uberfire.ext.wires.core.api.factories.FactoryHelper;\nimport org.uberfire.ext.wires.core.api.factories.categories.Category;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.factories.AbstractBaseFactory;\nimport org.uberfire.ext.wires.core.client.factories.categories.FixedShapeCategory;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.fixed.WiresFixedText;\n\n@ApplicationScoped\npublic class FixedTextFactory extends AbstractBaseFactory<Text> {\n\n    private static final String DESCRIPTION = \"Text\";\n\n    private static final int FONT_POINT = 30;\n\n    private final double TEXT_WIDTH;\n    private final double TEXT_HEIGHT;\n\n    public FixedTextFactory() {\n        final Text text = makeShape();\n        final LienzoPanel panel = new LienzoPanel(100,\n                                                  100);\n        final Layer layer = new Layer();\n        panel.add(layer);\n        final TextMetrics tm = text.measure(layer.getContext());\n        TEXT_WIDTH = tm.getWidth();\n        TEXT_HEIGHT = tm.getHeight();\n    }\n\n    @Override\n    public String getShapeDescription() {\n        return DESCRIPTION;\n    }\n\n    @Override\n    public Category getCategory() {\n        return FixedShapeCategory.CATEGORY;\n    }\n\n    @Override\n    public WiresBaseShape getShape(final FactoryHelper helper) {\n        return new WiresFixedText(makeShape());\n    }\n\n    @Override\n    public boolean builds(final WiresBaseShape shapeType) {\n        return shapeType instanceof WiresFixedText;\n    }\n\n    @Override\n    protected Text makeShape() {\n        final Text text = new Text(\"T\",\n                                   \"normal\",\n                                   FONT_POINT);\n        text.setStrokeColor(ShapesUtils.RGB_STROKE_TEXT)\n                .setFillColor(ShapesUtils.RGB_FILL_TEXT)\n                .setTextBaseLine(TextBaseLine.MIDDLE)\n                .setTextAlign(TextAlign.CENTER)\n                .setDraggable(false);\n        return text;\n    }\n\n    @Override\n    protected double getWidth() {\n        return Math.round(TEXT_WIDTH);\n    }\n\n    @Override\n    protected double getHeight() {\n        return Math.round(TEXT_HEIGHT);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/perspectives/WiresScratchPadPerspective.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.wires.core.scratchpad.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n/**\n * A Perspective for Wires Scratch Pad\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = \"WiresScratchPadPerspective\", isDefault = true)\npublic class WiresScratchPadPerspective {\n\n    private static final String WIRES = \"Wires\";\n\n    private static final String WIRES_LAYERS_SCREEN = \"WiresLayersScreen\";\n    private static final String WIRES_PALETTE_SCREEN = \"WiresPaletteScreen\";\n    private static final String WIRES_CANVAS_SCREEN = \"WiresScratchPadScreen\";\n    private static final String WIRES_ACTIONS_SCREEN = \"WiresActionsScreen\";\n    private static final String WIRES_PROPERTIES_SCREEN = \"WiresPropertiesScreen\";\n\n    private static final int MIN_WIDTH_PANEL = 200;\n    private static final int WIDTH_PANEL = 300;\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        perspective.setName(WIRES);\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_CANVAS_SCREEN)));\n\n        final PanelDefinition layersPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        layersPanel.setMinWidth(MIN_WIDTH_PANEL);\n        layersPanel.setWidth(WIDTH_PANEL);\n        layersPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_LAYERS_SCREEN)));\n\n        final PanelDefinition actionsPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        actionsPanel.setMinWidth(MIN_WIDTH_PANEL);\n        actionsPanel.setWidth(WIDTH_PANEL);\n        actionsPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_ACTIONS_SCREEN)));\n\n        layersPanel.appendChild(CompassPosition.SOUTH,\n                                actionsPanel);\n\n        perspective.getRoot().insertChild(CompassPosition.EAST,\n                                          layersPanel);\n\n        final PanelDefinition palettePanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        palettePanel.setMinWidth(MIN_WIDTH_PANEL);\n        palettePanel.setWidth(WIDTH_PANEL);\n        palettePanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_PALETTE_SCREEN)));\n\n        final PanelDefinition propertiesPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        propertiesPanel.setMinWidth(MIN_WIDTH_PANEL);\n        propertiesPanel.setWidth(WIDTH_PANEL);\n        propertiesPanel.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(WIRES_PROPERTIES_SCREEN)));\n\n        palettePanel.appendChild(CompassPosition.SOUTH,\n                                 propertiesPanel);\n\n        perspective.getRoot().insertChild(CompassPosition.WEST,\n                                          palettePanel);\n\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/properties/CssHexColourValidator.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.properties;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.ext.properties.editor.model.validators.PropertyFieldValidator;\n\n/**\n * Validator for CSS colours\n */\n@ApplicationScoped\npublic class CssHexColourValidator implements PropertyFieldValidator {\n\n    private static final List<Character> HEX_DIGITS = Arrays.asList(new Character[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'});\n\n    @Override\n    public boolean validate(Object value) {\n        String hex = value.toString().toLowerCase();\n        if (hex.length() != 7) {\n            return false;\n        }\n        if (!hex.startsWith(\"#\")) {\n            return false;\n        }\n        for (Character c : hex.substring(1).toCharArray()) {\n            if (!HEX_DIGITS.contains(c)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    @Override\n    public String getValidatorErrorMessage() {\n        return \"Value must be a CSS colour #rrggbb.\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/properties/DefaultPropertyEditorAdaptor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.properties;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.common.collect.Lists;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.properties.DoubleValidator;\n\n/**\n * Default PropertyEditorAdaptor to extract X and Y\n */\n@ApplicationScoped\npublic class DefaultPropertyEditorAdaptor implements PropertyEditorAdaptor {\n\n    private static final String POSITION_NODE = \"Position Node\";\n\n    @Override\n    public boolean supports(final WiresBaseShape shape) {\n        return true;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getProperties(final WiresBaseShape shape) {\n        final PropertyEditorFieldInfo fieldInfo1 = new PropertyEditorFieldInfo(\"X\",\n                                                                               String.valueOf(shape.getX()),\n                                                                               PropertyEditorType.NATURAL_NUMBER) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double x = Double.parseDouble(currentStringValue);\n                    shape.setX(x);\n                    shape.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n        final PropertyEditorFieldInfo fieldInfo2 = new PropertyEditorFieldInfo(\"Y\",\n                                                                               String.valueOf(shape.getY()),\n                                                                               PropertyEditorType.NATURAL_NUMBER) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double y = Double.parseDouble(currentStringValue);\n                    shape.setY(y);\n                    shape.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n\n        //Setup Validators\n        fieldInfo1.getValidators().clear();\n        fieldInfo2.getValidators().clear();\n        fieldInfo1.getValidators().add(new DoubleValidator());\n        fieldInfo2.getValidators().add(new DoubleValidator());\n\n        final PropertyEditorCategory position = new PropertyEditorCategory(POSITION_NODE).withField(fieldInfo1).withField(fieldInfo2);\n\n        return Lists.newArrayList(position);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/properties/WiresCirclePropertyEditorAdaptor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.properties;\n\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.common.collect.Lists;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.properties.DoubleValidator;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic.WiresCircle;\n\n/**\n * PropertyEditorAdaptor for WiresCircle to extract radius\n */\n@ApplicationScoped\npublic class WiresCirclePropertyEditorAdaptor implements PropertyEditorAdaptor {\n\n    private static final String ATTRIBUTES = \"Attributes\";\n\n    @Override\n    public boolean supports(final WiresBaseShape shape) {\n        return shape instanceof WiresCircle;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getProperties(final WiresBaseShape shape) {\n        if (!supports(shape)) {\n            return Collections.emptyList();\n        }\n        final WiresCircle w = (WiresCircle) shape;\n        final PropertyEditorFieldInfo fieldInfo1 = new PropertyEditorFieldInfo(\"Radius\",\n                                                                               String.valueOf(w.getRadius()),\n                                                                               PropertyEditorType.NATURAL_NUMBER) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double r = Double.parseDouble(currentStringValue);\n                    w.setRadius(r);\n                    w.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n\n        //Setup Validators\n        fieldInfo1.getValidators().clear();\n        fieldInfo1.getValidators().add(new DoubleValidator());\n\n        final PropertyEditorCategory attributes = new PropertyEditorCategory(ATTRIBUTES).withField(fieldInfo1);\n\n        return Lists.newArrayList(attributes);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/properties/WiresFixedTextPropertyEditorAdaptor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.properties;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.google.common.collect.Lists;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.properties.WiresComboPropertyEditorFieldInfo;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.fixed.WiresFixedText;\n\n/**\n * PropertyEditorAdaptor for WiresFixedText to extract text\n */\n@ApplicationScoped\npublic class WiresFixedTextPropertyEditorAdaptor implements PropertyEditorAdaptor {\n\n    private static final String ATTRIBUTES = \"Attributes\";\n\n    @Override\n    public boolean supports(final WiresBaseShape shape) {\n        return shape instanceof WiresFixedText;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getProperties(final WiresBaseShape shape) {\n        if (!supports(shape)) {\n            return Collections.emptyList();\n        }\n        final WiresFixedText w = (WiresFixedText) shape;\n        final PropertyEditorFieldInfo fieldInfo1 = new PropertyEditorFieldInfo(\"Text\",\n                                                                               String.valueOf(w.getText()),\n                                                                               PropertyEditorType.TEXT) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                w.setText(currentStringValue);\n                w.getLayer().batch();\n            }\n        };\n\n        final PropertyEditorFieldInfo fieldInfo2 = new WiresComboPropertyEditorFieldInfo(\"Text Align\",\n                                                                                         w.getTextAlign().getValue(),\n                                                                                         getTextAlignValues()) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                w.setTextAlign(TextAlign.lookup(currentStringValue));\n                w.getLayer().batch();\n            }\n        };\n\n        final PropertyEditorFieldInfo fieldInfo3 = new PropertyEditorFieldInfo(\"Stroke colour\",\n                                                                               String.valueOf(w.getStrokeColour()),\n                                                                               PropertyEditorType.TEXT) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                w.setStrokeColour(currentStringValue);\n                w.getLayer().batch();\n            }\n        };\n\n        final PropertyEditorFieldInfo fieldInfo4 = new PropertyEditorFieldInfo(\"Fill colour\",\n                                                                               String.valueOf(w.getFillColour()),\n                                                                               PropertyEditorType.TEXT) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                w.setFillColour(currentStringValue);\n                w.getLayer().batch();\n            }\n        };\n\n        final PropertyEditorFieldInfo fieldInfo5 = new WiresComboPropertyEditorFieldInfo(\"Font size\",\n                                                                                         String.valueOf(w.getFontSize()),\n                                                                                         getFontSizeValues()) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double fontSize = Double.parseDouble(currentStringValue);\n                    w.setFontSize(fontSize);\n                    w.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n\n        //We're issued with a default TextValidator that demands values are longer than 8 characters; so get rid of it\n        fieldInfo1.getValidators().clear();\n        fieldInfo2.getValidators().clear();\n        fieldInfo3.getValidators().clear();\n        fieldInfo4.getValidators().clear();\n        fieldInfo5.getValidators().clear();\n\n        fieldInfo3.getValidators().add(new CssHexColourValidator());\n        fieldInfo4.getValidators().add(new CssHexColourValidator());\n\n        final PropertyEditorCategory attributes = new PropertyEditorCategory(ATTRIBUTES)\n                .withField(fieldInfo1)\n                .withField(fieldInfo2)\n                .withField(fieldInfo3)\n                .withField(fieldInfo4)\n                .withField(fieldInfo5);\n\n        return Lists.newArrayList(attributes);\n    }\n\n    private List<String> getTextAlignValues() {\n        final List<String> values = new ArrayList<String>();\n        for (TextAlign ta : TextAlign.values()) {\n            values.add(ta.getValue());\n        }\n        return values;\n    }\n\n    private List<String> getFontSizeValues() {\n        return Arrays.asList(new String[]{\"15\", \"20\", \"25\", \"30\", \"35\", \"40\", \"45\", \"50\"});\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/properties/WiresRectanglePropertyEditorAdaptor.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.properties;\n\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.common.collect.Lists;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorCategory;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorFieldInfo;\nimport org.uberfire.ext.properties.editor.model.PropertyEditorType;\nimport org.uberfire.ext.wires.core.api.properties.PropertyEditorAdaptor;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.properties.DoubleValidator;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic.WiresRectangle;\n\n/**\n * PropertyEditorAdaptor for WiresRectangle to extract width and height\n */\n@ApplicationScoped\npublic class WiresRectanglePropertyEditorAdaptor implements PropertyEditorAdaptor {\n\n    private static final String ATTRIBUTES = \"Attributes\";\n\n    @Override\n    public boolean supports(final WiresBaseShape shape) {\n        return shape instanceof WiresRectangle;\n    }\n\n    @Override\n    public List<PropertyEditorCategory> getProperties(final WiresBaseShape shape) {\n        if (!supports(shape)) {\n            return Collections.emptyList();\n        }\n        final WiresRectangle w = (WiresRectangle) shape;\n        final PropertyEditorFieldInfo fieldInfo1 = new PropertyEditorFieldInfo(\"Width\",\n                                                                               String.valueOf(w.getWidth()),\n                                                                               PropertyEditorType.NATURAL_NUMBER) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double width = Double.parseDouble(currentStringValue);\n                    w.setWidth(width);\n                    w.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n        final PropertyEditorFieldInfo fieldInfo2 = new PropertyEditorFieldInfo(\"Height\",\n                                                                               String.valueOf(w.getHeight()),\n                                                                               PropertyEditorType.NATURAL_NUMBER) {\n            @Override\n            public void setCurrentStringValue(final String currentStringValue) {\n                super.setCurrentStringValue(currentStringValue);\n                try {\n                    final double height = Double.parseDouble(currentStringValue);\n                    w.setHeight(height);\n                    w.getLayer().batch();\n                } catch (NumberFormatException e) {\n                    //Swallow\n                }\n            }\n        };\n\n        //Setup Validators\n        fieldInfo1.getValidators().clear();\n        fieldInfo2.getValidators().clear();\n        fieldInfo1.getValidators().add(new DoubleValidator());\n        fieldInfo2.getValidators().add(new DoubleValidator());\n\n        PropertyEditorCategory attributes = new PropertyEditorCategory(ATTRIBUTES).withField(fieldInfo1).withField(fieldInfo2);\n\n        return Lists.newArrayList(attributes);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/WiresScratchPadDefaultShape.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * To change this license header, choose License Headers in Project Properties.\n * To change this template file, choose Tools | Templates\n * and open the template in the editor.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes;\n\nimport com.ait.lienzo.client.core.event.NodeDragEndEvent;\nimport com.ait.lienzo.client.core.event.NodeDragEndHandler;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport org.uberfire.ext.wires.core.api.containers.ContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.RequiresContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicShape;\n\n/**\n * A Shape that can be re-sized and have connectors attached. It CAN be added to Containers.\n */\npublic abstract class WiresScratchPadDefaultShape extends WiresBaseDynamicShape implements RequiresContainerManager {\n\n    protected ContainerManager containerManager;\n\n    private WiresContainer boundContainer;\n\n    public WiresScratchPadDefaultShape() {\n        //Check for the Shape being added to a Container as it is dragged around\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                boundContainer = containerManager.getContainer(WiresScratchPadDefaultShape.this.getX(),\n                                                               WiresScratchPadDefaultShape.this.getY());\n                if (boundContainer != null) {\n                    boundContainer.detachShape(WiresScratchPadDefaultShape.this);\n                }\n\n                getLayer().batch();\n            }\n        });\n\n        //When the drag ends; if it was within a Container add this Shape to the Container\n        addNodeDragEndHandler(new NodeDragEndHandler() {\n\n            @Override\n            public void onNodeDragEnd(final NodeDragEndEvent nodeDragEndEvent) {\n                if (boundContainer != null) {\n                    boundContainer.attachShape(WiresScratchPadDefaultShape.this);\n                    boundContainer.setHover(false);\n                }\n\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setContainerManager(final ContainerManager containerManager) {\n        this.containerManager = containerManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/connectors/WiresArrow.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Arrow;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.ait.lienzo.shared.core.types.ArrowType;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.magnets.MagnetManager;\nimport org.uberfire.ext.wires.core.api.magnets.RequiresMagnetManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\nimport org.uberfire.ext.wires.core.client.controlpoints.ConnectibleControlPoint;\nimport org.uberfire.ext.wires.core.client.util.GeometryUtil;\n\npublic class WiresArrow extends WiresBaseDynamicShape implements MagnetManager,\n                                                                 RequiresMagnetManager {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    private static final int BASE_WIDTH = 10;\n    private static final int HEAD_WIDTH = 20;\n    private static final int ARROW_ANGLE = 45;\n    private static final int BASE_ANGLE = 30;\n\n    private final Arrow arrow;\n    private final Arrow bounding;\n\n    private final ConnectibleControlPoint controlPoint1;\n    private final ConnectibleControlPoint controlPoint2;\n\n    private MagnetManager magnetManager;\n\n    public WiresArrow(final Arrow shape) {\n        final double x1 = shape.getStart().getX();\n        final double y1 = shape.getStart().getY();\n        final double x2 = shape.getEnd().getX();\n        final double y2 = shape.getEnd().getY();\n\n        arrow = shape;\n        bounding = new Arrow(new Point2D(x1,\n                                         y1),\n                             new Point2D(x2,\n                                         y2),\n                             BASE_WIDTH,\n                             HEAD_WIDTH,\n                             ARROW_ANGLE,\n                             BASE_ANGLE,\n                             ArrowType.AT_END);\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(arrow);\n\n        magnets.clear();\n\n        controlPoints.clear();\n        controlPoint1 = new ConnectibleControlPoint(x1,\n                                                    y1,\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            arrow.setStart(new Point2D(x - getX(),\n                                                                                       y - getY()));\n                                                            bounding.setStart(new Point2D(x - getX(),\n                                                                                          y - getY()));\n                                                        }\n                                                    }\n        );\n\n        controlPoint2 = new ConnectibleControlPoint(x2,\n                                                    y2,\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            arrow.setEnd(new Point2D(x - getX(),\n                                                                                     y - getY()));\n                                                            bounding.setEnd(new Point2D(x - getX(),\n                                                                                        y - getY()));\n                                                        }\n                                                    }\n        );\n        addControlPoint(controlPoint1);\n        addControlPoint(controlPoint2);\n\n        //If Connector is dragged as a whole (i.e. not a ControlPoint) detach it from Magnets\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                final Magnet boundMagnet1 = controlPoint1.getBoundMagnet();\n                final Magnet boundMagnet2 = controlPoint2.getBoundMagnet();\n                if (boundMagnet1 != null) {\n                    boundMagnet1.detachControlPoint(controlPoint1);\n                }\n                if (boundMagnet2 != null) {\n                    boundMagnet2.detachControlPoint(controlPoint2);\n                }\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setMagnetManager(final MagnetManager magnetManager) {\n        this.magnetManager = magnetManager;\n    }\n\n    @Override\n    public void hideAllMagnets() {\n        if (magnetManager != null) {\n            magnetManager.hideAllMagnets();\n        }\n    }\n\n    @Override\n    public Magnet getMagnet(final WiresShape shapeActive,\n                            final double cx,\n                            final double cy) {\n        if (this.magnetManager != null) {\n            return magnetManager.getMagnet(shapeActive,\n                                           cx,\n                                           cy);\n        }\n        return null;\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        return Math.sqrt(GeometryUtil.ptSegDistSq(arrow.getPoints().get(0).getX(),\n                                                  arrow.getPoints().get(0).getY(),\n                                                  arrow.getPoints().get(1).getX(),\n                                                  arrow.getPoints().get(1).getY(),\n                                                  _x,\n                                                  _y)) < BOUNDARY_SIZE;\n    }\n\n    @Override\n    public String toString() {\n        return \"WiresArrow{\" + \"id=\" + getId() + \",x = \" + getX() + \", y = \" + getY() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/connectors/WiresBezierCurve.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.BezierCurve;\nimport com.ait.lienzo.client.core.shape.Line;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.magnets.MagnetManager;\nimport org.uberfire.ext.wires.core.api.magnets.RequiresMagnetManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\nimport org.uberfire.ext.wires.core.client.controlpoints.ConnectibleControlPoint;\nimport org.uberfire.ext.wires.core.client.controlpoints.DefaultControlPoint;\n\npublic class WiresBezierCurve extends WiresBaseDynamicShape implements MagnetManager,\n                                                                       RequiresMagnetManager {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    //We do not hide the boundary item for Lines as it makes selecting them very difficult\n    private static final double ALPHA_DESELECTED = 0.01;\n    private static final double ALPHA_SELECTED = 0.1;\n\n    private final BezierCurve curve;\n    private final BezierCurve bounding;\n    private final Line controlLine1;\n    private final Line controlLine2;\n\n    private final ConnectibleControlPoint controlPoint1;\n    private final ControlPoint controlPoint2;\n    private final ControlPoint controlPoint3;\n    private final ConnectibleControlPoint controlPoint4;\n\n    private MagnetManager magnetManager;\n\n    public WiresBezierCurve(final BezierCurve shape) {\n        final double x = shape.getControlPoints().get(0).getX();\n        final double y = shape.getControlPoints().get(0).getY();\n        final double controlX1 = shape.getControlPoints().get(1).getX();\n        final double controlY1 = shape.getControlPoints().get(1).getY();\n        final double controlX2 = shape.getControlPoints().get(2).getX();\n        final double controlY2 = shape.getControlPoints().get(2).getY();\n        final double endX = shape.getControlPoints().get(3).getX();\n        final double endY = shape.getControlPoints().get(3).getY();\n\n        curve = shape;\n        bounding = new BezierCurve(x,\n                                   y,\n                                   controlX1,\n                                   controlY1,\n                                   controlX2,\n                                   controlY2,\n                                   endX,\n                                   endY);\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(ALPHA_DESELECTED);\n\n        controlLine1 = new Line(x,\n                                y,\n                                controlX1,\n                                controlY1);\n        controlLine1.setAlpha(0.5);\n        controlLine1.setStrokeColor(\"#0000ff\");\n        controlLine1.setDashArray(2,\n                                  2);\n        controlLine2 = new Line(controlX2,\n                                controlY2,\n                                endX,\n                                endY);\n        controlLine2.setAlpha(0.5);\n        controlLine2.setStrokeColor(\"#0000ff\");\n        controlLine2.setDashArray(2,\n                                  2);\n\n        add(curve);\n        add(bounding);\n\n        magnets.clear();\n\n        controlPoints.clear();\n        controlPoint1 = new ConnectibleControlPoint(curve.getControlPoints().get(0).getX(),\n                                                    curve.getControlPoints().get(0).getY(),\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            curve.getControlPoints().get(0).setX(x - getX());\n                                                            curve.getControlPoints().get(0).setY(y - getY());\n                                                            bounding.getControlPoints().get(0).setX(x - getX());\n                                                            bounding.getControlPoints().get(0).setY(y - getY());\n                                                            controlLine1.getPoints().get(0).setX(x - getX());\n                                                            controlLine1.getPoints().get(0).setY(y - getY());\n                                                        }\n                                                    }\n        );\n\n        controlPoint2 = new DefaultControlPoint(curve.getControlPoints().get(1).getX(),\n                                                curve.getControlPoints().get(1).getY(),\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        curve.getControlPoints().get(1).setX(x - getX());\n                                                        curve.getControlPoints().get(1).setY(y - getY());\n                                                        bounding.getControlPoints().get(1).setX(x - getX());\n                                                        bounding.getControlPoints().get(1).setY(y - getY());\n                                                        controlLine1.getPoints().get(1).setX(x - getX());\n                                                        controlLine1.getPoints().get(1).setY(y - getY());\n                                                    }\n                                                }\n        );\n\n        controlPoint3 = new DefaultControlPoint(curve.getControlPoints().get(2).getX(),\n                                                curve.getControlPoints().get(2).getY(),\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        curve.getControlPoints().get(2).setX(x - getX());\n                                                        curve.getControlPoints().get(2).setY(y - getY());\n                                                        bounding.getControlPoints().get(2).setX(x - getX());\n                                                        bounding.getControlPoints().get(2).setY(y - getY());\n                                                        controlLine2.getPoints().get(0).setX(x - getX());\n                                                        controlLine2.getPoints().get(0).setY(y - getY());\n                                                    }\n                                                }\n        );\n\n        controlPoint4 = new ConnectibleControlPoint(curve.getControlPoints().get(3).getX(),\n                                                    curve.getControlPoints().get(3).getY(),\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            curve.getControlPoints().get(3).setX(x - getX());\n                                                            curve.getControlPoints().get(3).setY(y - getY());\n                                                            bounding.getControlPoints().get(3).setX(x - getX());\n                                                            bounding.getControlPoints().get(3).setY(y - getY());\n                                                            controlLine2.getPoints().get(1).setX(x - getX());\n                                                            controlLine2.getPoints().get(1).setY(y - getY());\n                                                        }\n                                                    }\n        );\n\n        addControlPoint(controlPoint1);\n        addControlPoint(controlPoint2);\n        addControlPoint(controlPoint3);\n        addControlPoint(controlPoint4);\n\n        //If Connector is dragged as a whole (i.e. not a ControlPoint) detach it from Magnets\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                final Magnet boundMagnet1 = controlPoint1.getBoundMagnet();\n                final Magnet boundMagnet4 = controlPoint4.getBoundMagnet();\n                if (boundMagnet1 != null) {\n                    boundMagnet1.detachControlPoint(controlPoint1);\n                }\n                if (boundMagnet4 != null) {\n                    boundMagnet4.detachControlPoint(controlPoint4);\n                }\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setMagnetManager(final MagnetManager magnetManager) {\n        this.magnetManager = magnetManager;\n    }\n\n    @Override\n    public void hideAllMagnets() {\n        if (magnetManager != null) {\n            magnetManager.hideAllMagnets();\n        }\n    }\n\n    @Override\n    public Magnet getMagnet(final WiresShape shapeActive,\n                            final double cx,\n                            final double cy) {\n        if (this.magnetManager != null) {\n            return magnetManager.getMagnet(shapeActive,\n                                           cx,\n                                           cy);\n        }\n        return null;\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(controlLine1);\n            add(controlLine2);\n            bounding.setAlpha(ALPHA_SELECTED);\n        } else {\n            remove(controlLine1);\n            remove(controlLine2);\n            bounding.setAlpha(ALPHA_DESELECTED);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/connectors/WiresLine.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.connectors;\n\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Line;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.magnets.MagnetManager;\nimport org.uberfire.ext.wires.core.api.magnets.RequiresMagnetManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicShape;\nimport org.uberfire.ext.wires.core.api.shapes.WiresShape;\nimport org.uberfire.ext.wires.core.client.controlpoints.ConnectibleControlPoint;\nimport org.uberfire.ext.wires.core.client.util.GeometryUtil;\n\npublic class WiresLine extends WiresBaseDynamicShape implements MagnetManager,\n                                                                RequiresMagnetManager {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    //We do not hide the boundary item for Lines as it makes selecting them very difficult\n    private static final double ALPHA_DESELECTED = 0.01;\n    private static final double ALPHA_SELECTED = 0.1;\n\n    private final Line line;\n    private final Line bounding;\n\n    private final ConnectibleControlPoint controlPoint1;\n    private final ConnectibleControlPoint controlPoint2;\n\n    private MagnetManager magnetManager;\n\n    public WiresLine(final Line shape) {\n        final double x1 = shape.getPoints().get(0).getX();\n        final double y1 = shape.getPoints().get(0).getY();\n        final double x2 = shape.getPoints().get(1).getX();\n        final double y2 = shape.getPoints().get(1).getY();\n\n        line = shape;\n        bounding = new Line(x1,\n                            y1,\n                            x2,\n                            y2);\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(ALPHA_DESELECTED);\n\n        add(line);\n        add(bounding);\n\n        magnets.clear();\n\n        controlPoints.clear();\n        controlPoint1 = new ConnectibleControlPoint(x1,\n                                                    y1,\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            line.getPoints().get(0).setX(x - getX());\n                                                            line.getPoints().get(0).setY(y - getY());\n                                                            bounding.getPoints().get(0).setX(x - getX());\n                                                            bounding.getPoints().get(0).setY(y - getY());\n                                                        }\n                                                    });\n\n        controlPoint2 = new ConnectibleControlPoint(x2,\n                                                    y2,\n                                                    this,\n                                                    this,\n                                                    new ControlPointMoveHandler() {\n                                                        @Override\n                                                        public void onMove(final double x,\n                                                                           final double y) {\n                                                            line.getPoints().get(1).setX(x - getX());\n                                                            line.getPoints().get(1).setY(y - getY());\n                                                            bounding.getPoints().get(1).setX(x - getX());\n                                                            bounding.getPoints().get(1).setY(y - getY());\n                                                        }\n                                                    });\n        addControlPoint(controlPoint1);\n        addControlPoint(controlPoint2);\n\n        //If Connector is dragged as a whole (i.e. not a ControlPoint) detach it from Magnets\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                final Magnet boundMagnet1 = controlPoint1.getBoundMagnet();\n                final Magnet boundMagnet2 = controlPoint2.getBoundMagnet();\n                if (boundMagnet1 != null) {\n                    boundMagnet1.detachControlPoint(controlPoint1);\n                }\n                if (boundMagnet2 != null) {\n                    boundMagnet2.detachControlPoint(controlPoint2);\n                }\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setMagnetManager(final MagnetManager magnetManager) {\n        this.magnetManager = magnetManager;\n    }\n\n    @Override\n    public void hideAllMagnets() {\n        if (magnetManager != null) {\n            magnetManager.hideAllMagnets();\n        }\n    }\n\n    @Override\n    public Magnet getMagnet(final WiresShape shapeActive,\n                            final double cx,\n                            final double cy) {\n        if (this.magnetManager != null) {\n            return magnetManager.getMagnet(shapeActive,\n                                           cx,\n                                           cy);\n        }\n        return null;\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            bounding.setAlpha(ALPHA_SELECTED);\n        } else {\n            bounding.setAlpha(ALPHA_DESELECTED);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        return Math.sqrt(GeometryUtil.ptSegDistSq(line.getPoints().get(0).getX(),\n                                                  line.getPoints().get(0).getY(),\n                                                  line.getPoints().get(1).getX(),\n                                                  line.getPoints().get(1).getY(),\n                                                  _x,\n                                                  _y)) < BOUNDARY_SIZE;\n    }\n\n    @Override\n    public String toString() {\n        return \"WiresLine{\" + \"id=\" + getId() + \",x = \" + getX() + \", y = \" + getY() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/containers/WiresCircularContainer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.containers;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicContainer;\nimport org.uberfire.ext.wires.core.client.controlpoints.DefaultControlPoint;\nimport org.uberfire.ext.wires.core.client.magnets.DefaultMagnet;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class WiresCircularContainer extends WiresBaseDynamicContainer {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    private final Circle circle;\n    private final Circle bounding;\n    private final String circleStrokeColour;\n    private final String circleFillColour;\n\n    private final Magnet magnet1;\n    private final Magnet magnet2;\n    private final Magnet magnet3;\n    private final Magnet magnet4;\n\n    private final ControlPoint controlPoint1;\n\n    public WiresCircularContainer(final Circle shape) {\n        circle = shape;\n        circleFillColour = shape.getFillColor();\n        circleStrokeColour = shape.getStrokeColor();\n\n        final double radius = circle.getRadius();\n        bounding = new Circle(radius + (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(circle);\n\n        magnets.clear();\n        magnet1 = new DefaultMagnet(getX() - radius,\n                                    getY());\n        magnet2 = new DefaultMagnet(getX() + radius,\n                                    getY());\n        magnet3 = new DefaultMagnet(getX(),\n                                    getY() - radius);\n        magnet4 = new DefaultMagnet(getX(),\n                                    getY() + radius);\n        addMagnet(magnet1);\n        addMagnet(magnet2);\n        addMagnet(magnet3);\n        addMagnet(magnet4);\n\n        controlPoints.clear();\n        controlPoint1 = new DefaultControlPoint(getX() + radius,\n                                                getY(),\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        final double dx = getX() - x;\n                                                        final double dy = getY() - y;\n                                                        final double r = Math.sqrt(Math.pow(dx,\n                                                                                            2) + Math.pow(dy,\n                                                                                                          2));\n                                                        magnet1.setX(getX() - r);\n                                                        magnet2.setX(getX() + r);\n                                                        magnet3.setY(getY() - r);\n                                                        magnet4.setY(getY() + r);\n                                                        circle.setRadius(r);\n                                                        bounding.setRadius(r + (BOUNDARY_SIZE / 2));\n                                                    }\n                                                }\n        );\n        addControlPoint(controlPoint1);\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        return Math.sqrt(Math.pow(_x,\n                                  2) + Math.pow(_y,\n                                                2)) < circle.getRadius() + BOUNDARY_SIZE;\n    }\n\n    @Override\n    public void setHover(final boolean isHover) {\n        if (isHover) {\n            circle.setFillColor(ShapesUtils.RGB_FILL_HOVER_CONTAINER);\n            circle.setStrokeColor(ShapesUtils.RGB_STROKE_HOVER_CONTAINER);\n        } else {\n            circle.setFillColor(circleFillColour);\n            circle.setStrokeColor(circleStrokeColour);\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"WiresCircularContainer{\" + \"id=\" + getId() + \",x = \" + getX() + \", y = \" + getY() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/containers/WiresRectangularContainer.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.containers;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseDynamicContainer;\nimport org.uberfire.ext.wires.core.client.controlpoints.DefaultControlPoint;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\npublic class WiresRectangularContainer extends WiresBaseDynamicContainer {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    private final Rectangle rectangle;\n    private final Rectangle bounding;\n    private final String rectangleFillColour;\n    private final String rectangleStokeColour;\n\n    private final ControlPoint controlPoint1;\n    private final ControlPoint controlPoint2;\n    private final ControlPoint controlPoint3;\n    private final ControlPoint controlPoint4;\n\n    public WiresRectangularContainer(final Rectangle shape) {\n        final double x1 = shape.getX();\n        final double y1 = shape.getY();\n        final double x2 = shape.getX() + shape.getWidth();\n        final double y2 = shape.getY() + shape.getHeight();\n        final double width = Math.abs(x2 - x1);\n        final double height = Math.abs(y2 - y1);\n\n        rectangle = shape;\n        rectangleFillColour = shape.getFillColor();\n        rectangleStokeColour = shape.getStrokeColor();\n\n        bounding = new Rectangle(width + BOUNDARY_SIZE,\n                                 height + BOUNDARY_SIZE,\n                                 rectangle.getCornerRadius());\n        bounding.setX(x1 - (BOUNDARY_SIZE / 2));\n        bounding.setY(y1 - (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(rectangle);\n\n        magnets.clear();\n        controlPoints.clear();\n\n        final double px1 = rectangle.getX();\n        final double py1 = rectangle.getY();\n        controlPoint1 = new DefaultControlPoint(px1,\n                                                py1,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        controlPoint2.setY(controlPoint1.getY());\n                                                        controlPoint3.setX(controlPoint1.getX());\n                                                        rectangle.setX(x - getX());\n                                                        rectangle.setY(y - getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setX(rectangle.getX() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setY(rectangle.getY() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                    }\n                                                }\n        );\n\n        final double px2 = rectangle.getX() + rectangle.getWidth();\n        final double py2 = rectangle.getY();\n        controlPoint2 = new DefaultControlPoint(px2,\n                                                py2,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint1.setY(controlPoint2.getY());\n                                                        controlPoint4.setX(controlPoint2.getX());\n                                                        rectangle.setY(y - getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setY(rectangle.getY() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                    }\n                                                }\n        );\n\n        final double px3 = rectangle.getX();\n        final double py3 = rectangle.getY() + rectangle.getHeight();\n        controlPoint3 = new DefaultControlPoint(px3,\n                                                py3,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint1.setX(controlPoint3.getX());\n                                                        controlPoint4.setY(controlPoint3.getY());\n                                                        rectangle.setX(x - getX());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setX(rectangle.getX() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                    }\n                                                }\n        );\n\n        final double px4 = rectangle.getX() + rectangle.getWidth();\n        final double py4 = rectangle.getY() + rectangle.getHeight();\n        controlPoint4 = new DefaultControlPoint(px4,\n                                                py4,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint2.setX(controlPoint4.getX());\n                                                        controlPoint3.setY(controlPoint4.getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                    }\n                                                }\n        );\n        addControlPoint(controlPoint1);\n        addControlPoint(controlPoint2);\n        addControlPoint(controlPoint3);\n        addControlPoint(controlPoint4);\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        if (_x < rectangle.getX()) {\n            return false;\n        } else if (_x > rectangle.getX() + rectangle.getWidth()) {\n            return false;\n        } else if (_y < rectangle.getY()) {\n            return false;\n        } else if (_y > rectangle.getY() + rectangle.getHeight()) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public void setHover(final boolean isHover) {\n        if (isHover) {\n            rectangle.setFillColor(ShapesUtils.RGB_FILL_HOVER_CONTAINER);\n            rectangle.setStrokeColor(ShapesUtils.RGB_STROKE_HOVER_CONTAINER);\n        } else {\n            rectangle.setFillColor(rectangleFillColour);\n            rectangle.setStrokeColor(rectangleStokeColour);\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"WiresRectangularContainer{\" + \"id=\" + getId() + \",x = \" + getX() + \", y = \" + getY() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/dynamic/WiresCircle.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic;\n\nimport com.ait.lienzo.client.core.shape.Circle;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.client.controlpoints.DefaultControlPoint;\nimport org.uberfire.ext.wires.core.client.magnets.DefaultMagnet;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.WiresScratchPadDefaultShape;\n\npublic class WiresCircle extends WiresScratchPadDefaultShape {\n\n    private static final int BOUNDARY_SIZE = 10;\n    private final Magnet magnet1;\n    private final Magnet magnet2;\n    private final Magnet magnet3;\n    private final Magnet magnet4;\n    private final ControlPoint controlPoint1;\n    private Circle circle;\n    private Circle bounding;\n\n    public WiresCircle(final Circle shape) {\n        final double radius = shape.getRadius();\n\n        circle = shape;\n        bounding = new Circle(radius + (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(circle);\n\n        magnets.clear();\n        magnet1 = new DefaultMagnet(getX() - radius,\n                                    getY());\n        magnet2 = new DefaultMagnet(getX() + radius,\n                                    getY());\n        magnet3 = new DefaultMagnet(getX(),\n                                    getY() - radius);\n        magnet4 = new DefaultMagnet(getX(),\n                                    getY() + radius);\n        addMagnet(magnet1);\n        addMagnet(magnet2);\n        addMagnet(magnet3);\n        addMagnet(magnet4);\n\n        controlPoints.clear();\n        controlPoint1 = new DefaultControlPoint(getX() + radius,\n                                                getY(),\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        final double dx = getX() - x;\n                                                        final double dy = getY() - y;\n                                                        final double r = Math.sqrt(Math.pow(dx,\n                                                                                            2) + Math.pow(dy,\n                                                                                                          2));\n                                                        magnet1.setX(getX() - r);\n                                                        magnet2.setX(getX() + r);\n                                                        magnet3.setY(getY() - r);\n                                                        magnet4.setY(getY() + r);\n                                                        circle.setRadius(r);\n                                                        bounding.setRadius(r + (BOUNDARY_SIZE / 2));\n                                                    }\n                                                }\n        );\n        addControlPoint(controlPoint1);\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        return Math.sqrt(Math.pow(_x,\n                                  2) + Math.pow(_y,\n                                                2)) < circle.getRadius() + BOUNDARY_SIZE;\n    }\n\n    public double getRadius() {\n        return circle.getRadius();\n    }\n\n    public void setRadius(final double radius) {\n        circle.setRadius(radius);\n        bounding.setRadius(radius + (BOUNDARY_SIZE / 2));\n        final double theta = Math.atan(controlPoint1.getY() / controlPoint1.getX());\n        controlPoint1.setLocation(new Point2D(getX() + (radius * Math.cos(theta)),\n                                              getY() + (radius * Math.sin(theta))));\n        magnet1.setLocation(new Point2D(getX() - radius,\n                                        getY()));\n        magnet2.setLocation(new Point2D(getX() + radius,\n                                        getY()));\n        magnet3.setLocation(new Point2D(getX(),\n                                        getY() - radius));\n        magnet4.setLocation(new Point2D(getX(),\n                                        getY() + radius));\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/dynamic/WiresRectangle.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.dynamic;\n\nimport com.ait.lienzo.client.core.shape.Rectangle;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPoint;\nimport org.uberfire.ext.wires.core.api.controlpoints.ControlPointMoveHandler;\nimport org.uberfire.ext.wires.core.api.magnets.Magnet;\nimport org.uberfire.ext.wires.core.client.controlpoints.DefaultControlPoint;\nimport org.uberfire.ext.wires.core.client.magnets.DefaultMagnet;\nimport org.uberfire.ext.wires.core.scratchpad.client.shapes.WiresScratchPadDefaultShape;\n\npublic class WiresRectangle extends WiresScratchPadDefaultShape {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    private final Rectangle rectangle;\n    private final Rectangle bounding;\n\n    private final Magnet magnet1;\n    private final Magnet magnet2;\n    private final Magnet magnet3;\n    private final Magnet magnet4;\n\n    private final ControlPoint controlPoint1;\n    private final ControlPoint controlPoint2;\n    private final ControlPoint controlPoint3;\n    private final ControlPoint controlPoint4;\n\n    public WiresRectangle(final Rectangle shape) {\n        final double x1 = shape.getX();\n        final double y1 = shape.getY();\n        final double x2 = shape.getX() + shape.getWidth();\n        final double y2 = shape.getY() + shape.getHeight();\n        final double width = Math.abs(x2 - x1);\n        final double height = Math.abs(y2 - y1);\n\n        rectangle = shape;\n\n        bounding = new Rectangle(width + BOUNDARY_SIZE,\n                                 height + BOUNDARY_SIZE,\n                                 rectangle.getCornerRadius());\n        bounding.setX(x1 - (BOUNDARY_SIZE / 2));\n        bounding.setY(y1 - (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(rectangle);\n\n        magnets.clear();\n        magnet1 = new DefaultMagnet(x1,\n                                    y1 + (height / 2));\n        magnet2 = new DefaultMagnet(x2,\n                                    y1 + (height / 2));\n        magnet3 = new DefaultMagnet(x1 + (width / 2),\n                                    y1);\n        magnet4 = new DefaultMagnet(x1 + (width / 2),\n                                    y2);\n        addMagnet(magnet1);\n        addMagnet(magnet2);\n        addMagnet(magnet3);\n        addMagnet(magnet4);\n\n        controlPoints.clear();\n        final double px1 = rectangle.getX();\n        final double py1 = rectangle.getY();\n        controlPoint1 = new DefaultControlPoint(px1,\n                                                py1,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(final double x,\n                                                                       final double y) {\n                                                        controlPoint2.setY(controlPoint1.getY());\n                                                        controlPoint3.setX(controlPoint1.getX());\n                                                        rectangle.setX(x - getX());\n                                                        rectangle.setY(y - getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setX(x - getX() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setY(y - getY() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                        magnet1.setX(x);\n                                                        magnet1.setY(y + (rectangle.getHeight() / 2));\n                                                        magnet2.setY(y + (rectangle.getHeight() / 2));\n                                                        magnet3.setX(x + (rectangle.getWidth() / 2));\n                                                        magnet3.setY(y);\n                                                        magnet4.setX(x + (rectangle.getWidth() / 2));\n                                                    }\n                                                }\n        );\n\n        final double px2 = rectangle.getX() + rectangle.getWidth();\n        final double py2 = rectangle.getY();\n        controlPoint2 = new DefaultControlPoint(px2,\n                                                py2,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint1.setY(controlPoint2.getY());\n                                                        controlPoint4.setX(controlPoint2.getX());\n                                                        rectangle.setY(y - getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setY(y - getY() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                        magnet1.setY(y + (rectangle.getHeight() / 2));\n                                                        magnet2.setX(x);\n                                                        magnet2.setY(y + (rectangle.getHeight() / 2));\n                                                        magnet3.setX(x - (rectangle.getWidth() / 2));\n                                                        magnet3.setY(y);\n                                                        magnet4.setX(x - (rectangle.getWidth() / 2));\n                                                    }\n                                                }\n        );\n\n        final double px3 = rectangle.getX();\n        final double py3 = rectangle.getY() + rectangle.getHeight();\n        controlPoint3 = new DefaultControlPoint(px3,\n                                                py3,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint1.setX(controlPoint3.getX());\n                                                        controlPoint4.setY(controlPoint3.getY());\n                                                        rectangle.setX(x - getX());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setX(x - getX() - (BOUNDARY_SIZE / 2));\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                        magnet1.setX(x);\n                                                        magnet1.setY(y - (rectangle.getHeight() / 2));\n                                                        magnet2.setY(y - (rectangle.getHeight() / 2));\n                                                        magnet3.setX(x + (rectangle.getWidth() / 2));\n                                                        magnet4.setX(x + (rectangle.getWidth() / 2));\n                                                        magnet4.setY(y);\n                                                    }\n                                                }\n        );\n\n        final double px4 = rectangle.getX() + rectangle.getWidth();\n        final double py4 = rectangle.getY() + rectangle.getHeight();\n        controlPoint4 = new DefaultControlPoint(px4,\n                                                py4,\n                                                new ControlPointMoveHandler() {\n                                                    @Override\n                                                    public void onMove(double x,\n                                                                       double y) {\n                                                        controlPoint2.setX(controlPoint4.getX());\n                                                        controlPoint3.setY(controlPoint4.getY());\n                                                        rectangle.setWidth(controlPoint2.getX() - controlPoint1.getX());\n                                                        rectangle.setHeight(controlPoint3.getY() - controlPoint1.getY());\n                                                        bounding.setWidth(rectangle.getWidth() + BOUNDARY_SIZE);\n                                                        bounding.setHeight(rectangle.getHeight() + BOUNDARY_SIZE);\n                                                        magnet1.setY(y - (rectangle.getHeight() / 2));\n                                                        magnet2.setX(x);\n                                                        magnet2.setY(y - (rectangle.getHeight() / 2));\n                                                        magnet3.setX(x - (rectangle.getWidth() / 2));\n                                                        magnet4.setX(x - (rectangle.getWidth() / 2));\n                                                        magnet4.setY(y);\n                                                    }\n                                                }\n        );\n        addControlPoint(controlPoint1);\n        addControlPoint(controlPoint2);\n        addControlPoint(controlPoint3);\n        addControlPoint(controlPoint4);\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        final double _x = cx - getX();\n        final double _y = cy - getY();\n        if (_x < rectangle.getX()) {\n            return false;\n        } else if (_x > rectangle.getX() + rectangle.getWidth()) {\n            return false;\n        } else if (_y < rectangle.getY()) {\n            return false;\n        } else if (_y > rectangle.getY() + rectangle.getHeight()) {\n            return false;\n        }\n        return true;\n    }\n\n    public double getWidth() {\n        return rectangle.getWidth();\n    }\n\n    public void setWidth(final double width) {\n        rectangle.setWidth(width);\n        bounding.setWidth(width + BOUNDARY_SIZE);\n        controlPoint2.setX(getX() + rectangle.getX() + width);\n        controlPoint4.setX(getX() + rectangle.getX() + width);\n        magnet2.setX(getX() + rectangle.getX() + width);\n        magnet3.setX(getX() + rectangle.getX() + width / 2);\n        magnet4.setX(getX() + rectangle.getX() + width / 2);\n    }\n\n    public double getHeight() {\n        return rectangle.getHeight();\n    }\n\n    public void setHeight(final double height) {\n        rectangle.setHeight(height);\n        bounding.setHeight(height + BOUNDARY_SIZE);\n        controlPoint3.setY(getY() + rectangle.getY() + height);\n        controlPoint4.setY(getY() + rectangle.getY() + height);\n        magnet1.setY(getY() + rectangle.getY() + height / 2);\n        magnet2.setY(getY() + rectangle.getY() + height / 2);\n        magnet4.setY(getY() + rectangle.getY() + height);\n    }\n\n    @Override\n    public String toString() {\n        return \"WiresRectangle{\" + \"id=\" + getId() + \",x = \" + getX() + \", y = \" + getY() + \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/fixed/WiresFixedCircle.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.fixed;\n\nimport com.ait.lienzo.client.core.event.NodeDragEndEvent;\nimport com.ait.lienzo.client.core.event.NodeDragEndHandler;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Circle;\nimport org.uberfire.ext.wires.core.api.containers.ContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.RequiresContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class WiresFixedCircle extends WiresBaseShape implements RequiresContainerManager {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    private final Circle circle;\n    private final Circle bounding;\n    protected ContainerManager containerManager;\n    private WiresContainer boundContainer;\n\n    public WiresFixedCircle(final Circle shape) {\n        circle = shape;\n\n        bounding = new Circle(circle.getRadius() + (BOUNDARY_SIZE / 2));\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(0.1);\n\n        add(circle);\n\n        //This class doesn't extend a super-class that handles Containers, so we add it manually\n        //Check for the Shape being added to a Container as it is dragged around\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                boundContainer = containerManager.getContainer(WiresFixedCircle.this.getX(),\n                                                               WiresFixedCircle.this.getY());\n                if (boundContainer != null) {\n                    boundContainer.detachShape(WiresFixedCircle.this);\n                }\n\n                getLayer().batch();\n            }\n        });\n\n        //When the drag ends; if it was within a Container add this Shape to the Container\n        addNodeDragEndHandler(new NodeDragEndHandler() {\n\n            @Override\n            public void onNodeDragEnd(final NodeDragEndEvent nodeDragEndEvent) {\n                if (boundContainer != null) {\n                    boundContainer.attachShape(WiresFixedCircle.this);\n                    boundContainer.setHover(false);\n                }\n\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setContainerManager(final ContainerManager containerManager) {\n        this.containerManager = containerManager;\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            add(bounding);\n        } else {\n            remove(bounding);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/java/org/uberfire/ext/wires/core/scratchpad/client/shapes/fixed/WiresFixedText.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.scratchpad.client.shapes.fixed;\n\nimport com.ait.lienzo.client.core.event.NodeDragEndEvent;\nimport com.ait.lienzo.client.core.event.NodeDragEndHandler;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickEvent;\nimport com.ait.lienzo.client.core.event.NodeMouseDoubleClickHandler;\nimport com.ait.lienzo.client.core.shape.Text;\nimport com.ait.lienzo.shared.core.types.TextAlign;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.BlurEvent;\nimport com.google.gwt.event.dom.client.BlurHandler;\nimport com.google.gwt.event.dom.client.KeyCodes;\nimport com.google.gwt.event.dom.client.KeyDownEvent;\nimport com.google.gwt.event.dom.client.KeyDownHandler;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.wires.core.api.containers.ContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.RequiresContainerManager;\nimport org.uberfire.ext.wires.core.api.containers.WiresContainer;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\n\npublic class WiresFixedText extends WiresBaseShape implements RequiresContainerManager {\n\n    private static final int BOUNDARY_SIZE = 10;\n\n    //We do not hide the boundary item for Lines as it makes selecting them very difficult\n    private static final double ALPHA_DESELECTED = 0.01;\n    private static final double ALPHA_SELECTED = 0.1;\n\n    private final Text text;\n    private final Text bounding;\n    private final TextBox editTextBox = new TextBox();\n    protected ContainerManager containerManager;\n    private WiresContainer boundContainer;\n\n    public WiresFixedText(final Text shape) {\n        text = shape;\n        text.setText(\"Text\");\n\n        bounding = new Text(text.getText(),\n                            text.getFontFamily(),\n                            text.getFontSize());\n        bounding.setTextBaseLine(text.getTextBaseLine());\n        bounding.setTextAlign(text.getTextAlign());\n        bounding.setStrokeWidth(BOUNDARY_SIZE);\n        bounding.setAlpha(ALPHA_DESELECTED);\n\n        add(text);\n        add(bounding);\n\n        //This class doesn't extend a super-class that handles Containers, so we add it manually\n        //Check for the Shape being added to a Container as it is dragged around\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                boundContainer = containerManager.getContainer(WiresFixedText.this.getX(),\n                                                               WiresFixedText.this.getY());\n                if (boundContainer != null) {\n                    boundContainer.detachShape(WiresFixedText.this);\n                }\n\n                getLayer().batch();\n            }\n        });\n\n        //When the drag ends; if it was within a Container add this Shape to the Container\n        addNodeDragEndHandler(new NodeDragEndHandler() {\n\n            @Override\n            public void onNodeDragEnd(final NodeDragEndEvent nodeDragEndEvent) {\n                if (boundContainer != null) {\n                    boundContainer.attachShape(WiresFixedText.this);\n                    boundContainer.setHover(false);\n                }\n\n                getLayer().batch();\n            }\n        });\n\n        //Add support for \"in place\" editing of text\n        editTextBox.addBlurHandler(new BlurHandler() {\n            @Override\n            public void onBlur(final BlurEvent event) {\n                text.setText(editTextBox.getText());\n                bounding.setText(editTextBox.getText());\n                text.getLayer().batch();\n                RootPanel.get().remove(editTextBox);\n            }\n        });\n        editTextBox.addKeyDownHandler(new KeyDownHandler() {\n            @Override\n            public void onKeyDown(final KeyDownEvent event) {\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {\n                    text.setText(editTextBox.getText());\n                    bounding.setText(editTextBox.getText());\n                    text.getLayer().batch();\n                    RootPanel.get().remove(editTextBox);\n                }\n                if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {\n                    RootPanel.get().remove(editTextBox);\n                }\n            }\n        });\n        addNodeMouseDoubleClickHandler(new NodeMouseDoubleClickHandler() {\n            @Override\n            public void onNodeMouseDoubleClick(final NodeMouseDoubleClickEvent nodeMouseDoubleClickEvent) {\n                editTextBox.setText(text.getText());\n                editTextBox.getElement().getStyle().setPosition(Style.Position.FIXED);\n                editTextBox.getElement().getStyle().setLeft(getX() + getLayer().getCanvasElement().getAbsoluteLeft(),\n                                                            Style.Unit.PX);\n                editTextBox.getElement().getStyle().setTop(getY() + getLayer().getCanvasElement().getAbsoluteTop(),\n                                                           Style.Unit.PX);\n                RootPanel.get().add(editTextBox);\n                editTextBox.setFocus(true);\n            }\n        });\n    }\n\n    @Override\n    public void setContainerManager(final ContainerManager containerManager) {\n        this.containerManager = containerManager;\n    }\n\n    @Override\n    public void setSelected(final boolean isSelected) {\n        if (isSelected) {\n            bounding.setAlpha(ALPHA_SELECTED);\n        } else {\n            bounding.setAlpha(ALPHA_DESELECTED);\n        }\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        return false;\n    }\n\n    public String getText() {\n        return text.getText();\n    }\n\n    public void setText(final String text) {\n        this.text.setText(text);\n        this.bounding.setText(text);\n    }\n\n    public TextAlign getTextAlign() {\n        return text.getTextAlign();\n    }\n\n    public void setTextAlign(final TextAlign align) {\n        text.setTextAlign(align);\n        bounding.setTextAlign(align);\n    }\n\n    public String getStrokeColour() {\n        return text.getStrokeColor();\n    }\n\n    public void setStrokeColour(final String strokeColour) {\n        text.setStrokeColor(strokeColour);\n    }\n\n    public String getFillColour() {\n        return text.getFillColor();\n    }\n\n    public void setFillColour(final String fillColour) {\n        text.setFillColor(fillColour);\n    }\n\n    public double getFontSize() {\n        return text.getFontSize();\n    }\n\n    public void setFontSize(final double fontSize) {\n        text.setFontSize(fontSize);\n        bounding.setFontSize(fontSize);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.core.scratchpad.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-scratchpad/src/main/resources/org/uberfire/ext/wires/core/scratchpad/WiresCoreScratchPad.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreApi\"/>\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreClient\"/>\n\n  <source path=\"client\"></source>\n</module>"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-wires-core</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-wires-core-trees</artifactId>\n\n  <name>Uberfire Wires :: Trees</name>\n  <description>Wires Trees support</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-wires-core-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie</groupId>\n      <artifactId>lienzo-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/canvas/WiresTreeNodeConnector.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.canvas;\n\nimport com.ait.lienzo.client.core.shape.Line;\nimport com.ait.lienzo.shared.core.types.LineCap;\nimport org.uberfire.ext.wires.core.client.util.ShapesUtils;\n\n/**\n * A connector between Tree Nodes\n */\npublic class WiresTreeNodeConnector extends Line {\n\n    public WiresTreeNodeConnector() {\n        setStrokeColor(ShapesUtils.RGB_STROKE_SHAPE)\n                .setStrokeWidth(ShapesUtils.RGB_STROKE_WIDTH_SHAPE)\n                .setFillColor(ShapesUtils.RGB_FILL_SHAPE)\n                .setLineCap(LineCap.ROUND)\n                .setStrokeWidth(3)\n                .setDraggable(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/canvas/WiresTreeNodeDropContext.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.canvas;\n\nimport org.uberfire.ext.wires.core.api.factories.ShapeDropContext;\nimport org.uberfire.ext.wires.core.trees.client.shapes.WiresBaseTreeNode;\n\npublic class WiresTreeNodeDropContext implements ShapeDropContext<WiresBaseTreeNode> {\n\n    private WiresBaseTreeNode context;\n\n    @Override\n    public WiresBaseTreeNode getContext() {\n        return context;\n    }\n\n    @Override\n    public void setContext(final WiresBaseTreeNode context) {\n        this.context = context;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/canvas/WiresTreesScreen.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.canvas;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.function.Consumer;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.ait.lienzo.client.core.animation.AnimationProperties;\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.wires.core.api.events.ClearEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeAddedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDeletedEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragCompleteEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeDragPreviewEvent;\nimport org.uberfire.ext.wires.core.api.events.ShapeSelectedEvent;\nimport org.uberfire.ext.wires.core.api.layout.LayoutManager;\nimport org.uberfire.ext.wires.core.api.layout.RequiresLayoutManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.canvas.WiresCanvas;\nimport org.uberfire.ext.wires.core.trees.client.layout.WiresLayoutUtilities;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.Rectangle2D;\nimport org.uberfire.ext.wires.core.trees.client.shapes.WiresBaseTreeNode;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WiresTreesScreen\")\npublic class WiresTreesScreen extends WiresCanvas {\n\n    private static final int MAX_PROXIMITY = 200;\n\n    private static final int ANIMATION_DURATION = 250;\n\n    @Inject\n    private Event<ClearEvent> clearEvent;\n\n    @Inject\n    private Event<ShapeSelectedEvent> shapeSelectedEvent;\n\n    @Inject\n    private Event<ShapeAddedEvent> shapeAddedEvent;\n\n    @Inject\n    private Event<ShapeDeletedEvent> shapeDeletedEvent;\n\n    @Inject\n    private LayoutManager layoutManager;\n\n    private Menus menus;\n\n    private WiresTreeNodeDropContext dropContext = new WiresTreeNodeDropContext();\n\n    private WiresTreeNodeConnector connector = null;\n\n    private WiresBaseTreeNode root;\n\n    @PostConstruct\n    public void setup() {\n        this.menus = MenuFactory\n                .newTopLevelMenu(\"Clear grid\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        clear();\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Delete selected\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        if (isShapeSelected()) {\n                            deleteShape(getSelectedShape());\n                        }\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Clear selection\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        if (isShapeSelected()) {\n                            clearSelection();\n                            menus.getItems().get(1).setEnabled(false);\n                            menus.getItems().get(2).setEnabled(false);\n                            menus.getItems().get(3).setEnabled(false);\n                            menus.getItems().get(4).setEnabled(false);\n                        }\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Collapse node\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        collapseNode();\n                    }\n                })\n                .endMenu()\n                .newTopLevelMenu(\"Expand node\")\n                .respondsWith(new Command() {\n                    @Override\n                    public void execute() {\n                        expandNode();\n                    }\n                })\n                .endMenu()\n                .build();\n        menus.getItems().get(0).setEnabled(false);\n        menus.getItems().get(1).setEnabled(false);\n        menus.getItems().get(2).setEnabled(false);\n        menus.getItems().get(3).setEnabled(false);\n        menus.getItems().get(4).setEnabled(false);\n    }\n\n    @WorkbenchPartTitle\n    @Override\n    public String getTitle() {\n        return \"Canvas\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menus);\n    }\n\n    @Override\n    public void selectShape(final WiresBaseShape shape) {\n        shapeSelectedEvent.fire(new ShapeSelectedEvent(shape));\n    }\n\n    public void onShapeSelected(@Observes ShapeSelectedEvent event) {\n        final WiresBaseShape shape = event.getShape();\n        super.selectShape(shape);\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n        menus.getItems().get(3).setEnabled(nodeHasChildren(shape) && !nodeHasCollapsedChildren(shape));\n        menus.getItems().get(4).setEnabled(nodeHasCollapsedChildren(shape));\n    }\n\n    @Override\n    public void deselectShape(final WiresBaseShape shape) {\n        super.deselectShape(shape);\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n        menus.getItems().get(3).setEnabled(isShapeSelected());\n        menus.getItems().get(4).setEnabled(isShapeSelected());\n    }\n\n    public void onDragPreviewHandler(@Observes ShapeDragPreviewEvent shapeDragPreviewEvent) {\n        //We can only connect WiresTreeNodes to each other\n        if (!(shapeDragPreviewEvent.getShape() instanceof WiresBaseTreeNode)) {\n            dropContext.setContext(null);\n            return;\n        }\n\n        //Find a Parent Node to attach the Shape to\n        final double cx = getX(shapeDragPreviewEvent.getX());\n        final double cy = getY(shapeDragPreviewEvent.getY());\n        final WiresBaseTreeNode child = (WiresBaseTreeNode) shapeDragPreviewEvent.getShape();\n        final WiresBaseTreeNode prospectiveParent = getParentNode(child,\n                                                                  cx,\n                                                                  cy);\n\n        //If there is a prospective parent show the line between child and parent\n        if (prospectiveParent != null) {\n            if (connector == null) {\n                connector = new WiresTreeNodeConnector();\n                canvasLayer.add(connector);\n                connector.moveToBottom();\n            }\n            connector.getPoints().get(0).set(prospectiveParent.getLocation());\n            connector.getPoints().get(1).set(new Point2D(cx,\n                                                         cy));\n        } else if (connector != null) {\n            canvasLayer.remove(connector);\n            connector = null;\n        }\n\n        dropContext.setContext(prospectiveParent);\n        canvasLayer.batch();\n    }\n\n    public void onDragCompleteHandler(@Observes ShapeDragCompleteEvent shapeDragCompleteEvent) {\n        final WiresBaseShape wiresShape = shapeDragCompleteEvent.getShape();\n\n        //Hide the temporary connector\n        if (connector != null) {\n            canvasLayer.remove(connector);\n            canvasLayer.batch();\n            connector = null;\n        }\n\n        //If there's no Shape to add then exit\n        if (wiresShape == null) {\n            dropContext.setContext(null);\n            return;\n        }\n\n        //Get Shape's co-ordinates relative to the Canvas\n        final double cx = getX(shapeDragCompleteEvent.getX());\n        final double cy = getY(shapeDragCompleteEvent.getY());\n\n        //If the Shape was dropped outside the bounds of the Canvas then exit\n        if (cx < 0 || cy < 0) {\n            dropContext.setContext(null);\n            return;\n        }\n\n        final int scrollWidth = getElement().getScrollWidth();\n        final int scrollHeight = getElement().getScrollHeight();\n        if (cx > scrollWidth || cy > scrollHeight) {\n            dropContext.setContext(null);\n            return;\n        }\n\n        //Add the new Node to it's parent (unless this is the first node)\n        final WiresBaseTreeNode parent = dropContext.getContext();\n        boolean addShape = getShapesInCanvas().size() == 0 || getShapesInCanvas().size() > 0 && parent != null;\n        boolean addChildToParent = parent != null;\n\n        if (addShape) {\n            wiresShape.setX(cx);\n            wiresShape.setY(cy);\n\n            if (addChildToParent) {\n                parent.addChildNode((WiresBaseTreeNode) wiresShape);\n            } else if (wiresShape instanceof WiresBaseTreeNode) {\n                root = (WiresBaseTreeNode) wiresShape;\n            }\n\n            addShape(wiresShape);\n            layout();\n\n            //Enable clearing of Canvas now a Shape has been added\n            menus.getItems().get(0).setEnabled(true);\n\n            //Notify other Panels of a Shape being added\n            shapeAddedEvent.fire(new ShapeAddedEvent(wiresShape));\n        }\n    }\n\n    private double getX(double xShapeEvent) {\n        return xShapeEvent - getAbsoluteLeft();\n    }\n\n    private double getY(double yShapeEvent) {\n        return yShapeEvent - getAbsoluteTop();\n    }\n\n    @Override\n    public void clear() {\n        if (Window.confirm(\"Are you sure to clean the canvas?\")) {\n            super.clear();\n            clearEvent.fire(new ClearEvent());\n            root = null;\n        }\n    }\n\n    @Override\n    public void deleteShape(final WiresBaseShape shape) {\n        if (Window.confirm(\"Are you sure to remove the selected shape?\")) {\n            shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));\n            layout();\n        }\n    }\n\n    @Override\n    public void forceDeleteShape(final WiresBaseShape shape) {\n        shapeDeletedEvent.fire(new ShapeDeletedEvent(shape));\n    }\n\n    public void onShapeDeleted(@Observes ShapeDeletedEvent event) {\n        if (root != null && root.equals(event.getShape())) {\n            root = null;\n        }\n        super.deleteShape(event.getShape());\n        menus.getItems().get(0).setEnabled(getShapesInCanvas().size() > 0);\n        menus.getItems().get(1).setEnabled(isShapeSelected());\n        menus.getItems().get(2).setEnabled(isShapeSelected());\n        menus.getItems().get(3).setEnabled(isShapeSelected());\n        menus.getItems().get(4).setEnabled(isShapeSelected());\n    }\n\n    @Override\n    public void addShape(final WiresBaseShape shape) {\n        super.addShape(shape);\n\n        //Attach relevant handlers\n        if (shape instanceof RequiresLayoutManager) {\n            ((RequiresLayoutManager) shape).setLayoutManager(layoutManager);\n        }\n    }\n\n    protected WiresBaseTreeNode getParentNode(final WiresBaseTreeNode dragShape,\n                                              final double cx,\n                                              final double cy) {\n        WiresBaseTreeNode prospectiveParent = null;\n        double finalDistance = Double.MAX_VALUE;\n        for (WiresBaseShape ws : getShapesInCanvas()) {\n            if (ws.isVisible()) {\n                if (ws instanceof WiresBaseTreeNode) {\n                    final WiresBaseTreeNode node = (WiresBaseTreeNode) ws;\n                    if (node.acceptChildNode(dragShape) && !node.hasCollapsedChildren()) {\n                        double deltaX = cx - node.getX();\n                        double deltaY = cy - node.getY();\n                        double distance = Math.sqrt(Math.pow(deltaX,\n                                                             2) + Math.pow(deltaY,\n                                                                           2));\n\n                        if (finalDistance > distance) {\n                            finalDistance = distance;\n                            prospectiveParent = node;\n                        }\n                    }\n                }\n            }\n        }\n\n        //If we're too far away from a parent we might as well not have a parent\n        if (finalDistance > MAX_PROXIMITY) {\n            prospectiveParent = null;\n        }\n        return prospectiveParent;\n    }\n\n    private void collapseNode() {\n        if (!isShapeSelected()) {\n            return;\n        }\n        final WiresBaseShape shape = getSelectedShape();\n        if (!(shape instanceof WiresBaseTreeNode)) {\n            return;\n        }\n        final WiresBaseTreeNode node = (WiresBaseTreeNode) shape;\n        node.collapse(new Command() {\n            @Override\n            public void execute() {\n                menus.getItems().get(3).setEnabled(false);\n                menus.getItems().get(4).setEnabled(true);\n            }\n        });\n    }\n\n    private void expandNode() {\n        if (!isShapeSelected()) {\n            return;\n        }\n        final WiresBaseShape shape = getSelectedShape();\n        if (!(shape instanceof WiresBaseTreeNode)) {\n            return;\n        }\n        final WiresBaseTreeNode node = (WiresBaseTreeNode) shape;\n        node.expand(new Command() {\n            @Override\n            public void execute() {\n                menus.getItems().get(3).setEnabled(true);\n                menus.getItems().get(4).setEnabled(false);\n            }\n        });\n    }\n\n    private boolean nodeHasChildren(final WiresBaseShape shape) {\n        if (!(shape instanceof WiresBaseTreeNode)) {\n            return false;\n        }\n        final WiresBaseTreeNode node = (WiresBaseTreeNode) shape;\n        return node.hasChildren();\n    }\n\n    private boolean nodeHasCollapsedChildren(final WiresBaseShape shape) {\n        if (!(shape instanceof WiresBaseTreeNode)) {\n            return false;\n        }\n        final WiresBaseTreeNode node = (WiresBaseTreeNode) shape;\n        return node.hasCollapsedChildren();\n    }\n\n    private void layout() {\n        //Get layout information\n        final Map<WiresBaseShape, Point2D> layout = layoutManager.getLayoutInformation(root);\n        final Rectangle2D canvasBounds = WiresLayoutUtilities.alignLayoutInCanvas(layout);\n\n        //Run an animation to move WiresBaseTreeNodes from their current position to the target position\n        root.animate(AnimationTweener.EASE_OUT,\n                     new AnimationProperties(),\n                     ANIMATION_DURATION,\n                     new IAnimationCallback() {\n\n                         private final Map<WiresBaseShape, Pair<Point2D, Point2D>> transformations = new HashMap<WiresBaseShape, Pair<Point2D, Point2D>>();\n\n                         @Override\n                         public void onStart(final IAnimation iAnimation,\n                                             final IAnimationHandle iAnimationHandle) {\n                             //Reposition nodes. First we store the WiresBaseTreeNode together with its current position and target position\n                             transformations.clear();\n                             for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {\n                                 final Point2D origin = e.getKey().getLocation();\n                                 final Point2D destination = e.getValue();\n                                 transformations.put(e.getKey(),\n                                                     new Pair<Point2D, Point2D>(origin,\n                                                                                destination));\n                             }\n                             WiresLayoutUtilities.resizeViewPort(canvasBounds,\n                                                                 canvasLayer.getViewport());\n                         }\n\n                         @Override\n                         public void onFrame(final IAnimation iAnimation,\n                                             final IAnimationHandle iAnimationHandle) {\n                             //Lienzo's IAnimation.getPercent() passes values > 1.0\n                             final double pct = iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent();\n\n                             //Move each descendant along the line between its origin and the target destination\n                             for (Map.Entry<WiresBaseShape, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                 final Point2D descendantOrigin = e.getValue().getK1();\n                                 final Point2D descendantTarget = e.getValue().getK2();\n                                 final double dx = (descendantTarget.getX() - descendantOrigin.getX()) * pct;\n                                 final double dy = (descendantTarget.getY() - descendantOrigin.getY()) * pct;\n                                 e.getKey().setX(descendantOrigin.getX() + dx);\n                                 e.getKey().setY(descendantOrigin.getY() + dy);\n                             }\n\n                             //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                             root.getLayer().batch();\n                         }\n\n                         @Override\n                         public void onClose(final IAnimation iAnimation,\n                                             final IAnimationHandle iAnimationHandle) {\n                             //Nothing to do\n                         }\n                     });\n\n        canvasLayer.batch();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/WiresLayoutUtilities.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout;\n\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.shape.Viewport;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.client.canvas.WiresCanvas;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.Rectangle2D;\n\n/**\n * Layout utilities\n */\npublic class WiresLayoutUtilities {\n\n    public static final double PADDING = 100;\n\n    /**\n     * Get the bounds of the layout information\n     * @param layout Layout information\n     * @return The bounds of the layout\n     */\n    public static Rectangle2D getLayoutBounds(final Map<WiresBaseShape, Point2D> layout) {\n        double minX = 0;\n        double maxX = 0;\n        double minY = 0;\n        double maxY = 0;\n        for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {\n            final double ax = e.getValue().getX();\n            final double ay = e.getValue().getY();\n            if (ax < minX) {\n                minX = ax;\n            }\n            if (ax > maxX) {\n                maxX = ax;\n            }\n            if (ay < minY) {\n                minY = ay;\n            }\n            if (ay > maxY) {\n                maxY = ay;\n            }\n        }\n        final double width = maxX - minX;\n        final double height = maxY - minY;\n        final Rectangle2D bounds = new Rectangle2D(minX,\n                                                   minY,\n                                                   width,\n                                                   height);\n        return bounds;\n    }\n\n    /**\n     * Get the bounds of the Canvas to hold the provided Layout bounds. This notionally adds padding to the Layout bounds, however\n     * if the Canvas bounds are less than a minimum defined as WiresCanvas.DEFAULT_SIZE_WIDTH and WiresCanvas.DEFAULT_SIZE_HEIGHT\n     * then the minimum dimensions are used.\n     * @param layoutBounds The bounds of the Layout\n     * @return The bounds of the Canvas including padding to contain the Layout.\n     */\n    public static Rectangle2D getCanvasBounds(final Rectangle2D layoutBounds) {\n        double canvasWidth = layoutBounds.getWidth() + PADDING * 2;\n        double canvasHeight = layoutBounds.getHeight() + PADDING * 2;\n        if (canvasWidth < WiresCanvas.DEFAULT_SIZE_WIDTH) {\n            canvasWidth = WiresCanvas.DEFAULT_SIZE_WIDTH;\n        }\n        if (canvasHeight < WiresCanvas.DEFAULT_SIZE_HEIGHT) {\n            canvasHeight = WiresCanvas.DEFAULT_SIZE_HEIGHT;\n        }\n\n        return new Rectangle2D(0,\n                               0,\n                               canvasWidth,\n                               canvasHeight);\n    }\n\n    /**\n     * Align the Layout within a Canvas\n     * @param layout Layout information\n     * @return Canvas bounds\n     */\n    public static Rectangle2D alignLayoutInCanvas(final Map<WiresBaseShape, Point2D> layout) {\n        final Rectangle2D layoutBounds = getLayoutBounds(layout);\n        final Rectangle2D canvasBounds = getCanvasBounds(layoutBounds);\n        for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {\n            double ax = e.getValue().getX();\n            double ay = e.getValue().getY();\n\n            ax = ax + ((canvasBounds.getWidth() - layoutBounds.getWidth()) / 2);\n            ay = ay + PADDING;\n            e.setValue(new Point2D(ax,\n                                   ay));\n        }\n        return canvasBounds;\n    }\n\n    /**\n     * Resize the canvas based on the layout information\n     * @param canvasBounds Bounds of the Canvas\n     * @param viewport Viewport to be re-sized\n     */\n    public static void resizeViewPort(final Rectangle2D canvasBounds,\n                                      final Viewport viewport) {\n        viewport.setPixelSize((int) canvasBounds.getWidth(),\n                              (int) canvasBounds.getHeight());\n        viewport.draw();\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/WiresTreesDefaultLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.ext.wires.core.api.layout.LayoutManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.AbstractTreeForTreeLayout;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.Configuration;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.DefaultConfiguration;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.NodeExtentProvider;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.Rectangle2D;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.TreeLayout;\nimport org.uberfire.ext.wires.core.trees.client.shapes.WiresBaseTreeNode;\n\n/**\n * Default Tree layout using an adaptation of https://code.google.com/p/treelayout/ for use with GWT\n */\npublic class WiresTreesDefaultLayout implements LayoutManager {\n\n    @Override\n    public Map<WiresBaseShape, Point2D> getLayoutInformation(final WiresBaseShape root) {\n        if (root == null) {\n            return Collections.emptyMap();\n        }\n        if (!(root instanceof WiresBaseTreeNode)) {\n            return Collections.emptyMap();\n        }\n\n        //Layout tree\n        final WiresBaseTreeNode treeRootNode = (WiresBaseTreeNode) root;\n        final WiresTreeForTreeLayout treeNodesProvider = new WiresTreeForTreeLayout(treeRootNode);\n        final WiresTreeNodeExtentProvider treeNodesExtentProvider = new WiresTreeNodeExtentProvider();\n        final Configuration<WiresBaseTreeNode> treeNodesLayoutConfiguration = new DefaultConfiguration<WiresBaseTreeNode>(50,\n                                                                                                                          50);\n        final TreeLayout<WiresBaseTreeNode> layout = new TreeLayout<WiresBaseTreeNode>(treeNodesProvider,\n                                                                                       treeNodesExtentProvider,\n                                                                                       treeNodesLayoutConfiguration);\n\n        //Set absolute positions\n        final Map<WiresBaseShape, Point2D> locations = new HashMap<WiresBaseShape, Point2D>();\n        for (Map.Entry<WiresBaseTreeNode, Rectangle2D> e : layout.getNodeBounds().entrySet()) {\n            locations.put(e.getKey(),\n                          new Point2D(e.getValue().getX(),\n                                      e.getValue().getY()));\n        }\n\n        //Collapse children into parent if required. By setting the location of \"collapsed\" nodes to that\n        //of their parent we can animate the layout changes required to collapse a node and repositioning\n        //of the remaining nodes with a single animation.\n        collapseChildren(treeRootNode,\n                         locations);\n\n        return locations;\n    }\n\n    private void collapseChildren(final WiresBaseTreeNode node,\n                                  final Map<WiresBaseShape, Point2D> locations) {\n        if (node.hasCollapsedChildren()) {\n            final Point2D destination = locations.get(node);\n            for (WiresBaseTreeNode child : node.getChildren()) {\n                collapseChildren(child,\n                                 destination,\n                                 locations);\n            }\n        } else {\n            for (WiresBaseTreeNode child : node.getChildren()) {\n                collapseChildren(child,\n                                 locations);\n            }\n        }\n    }\n\n    private void collapseChildren(final WiresBaseTreeNode node,\n                                  final Point2D destination,\n                                  final Map<WiresBaseShape, Point2D> locations) {\n        locations.put(node,\n                      destination);\n        for (WiresBaseTreeNode child : node.getChildren()) {\n            collapseChildren(child,\n                             destination,\n                             locations);\n        }\n    }\n\n    /**\n     * Implementation of AbstractTreeForTreeLayout for Wires that handles collapsed nodes\n     */\n    private static class WiresTreeForTreeLayout extends AbstractTreeForTreeLayout<WiresBaseTreeNode> {\n\n        public WiresTreeForTreeLayout(final WiresBaseTreeNode root) {\n            super(root);\n        }\n\n        @Override\n        public WiresBaseTreeNode getParent(final WiresBaseTreeNode node) {\n            return node.getParentNode();\n        }\n\n        @Override\n        public List<WiresBaseTreeNode> getChildrenList(final WiresBaseTreeNode node) {\n            //If node has collapsed children don't return them so it appears we have a single node\n            if (node.hasCollapsedChildren()) {\n                return Collections.emptyList();\n            }\n            return node.getChildren();\n        }\n    }\n\n    /**\n     * Implementation of NodeExtentProvider for Wires\n     */\n    private static class WiresTreeNodeExtentProvider implements\n                                                     NodeExtentProvider<WiresBaseTreeNode> {\n\n        @Override\n        public double getWidth(final WiresBaseTreeNode node) {\n            return node.getWidth();\n        }\n\n        @Override\n        public double getHeight(final WiresBaseTreeNode node) {\n            return node.getHeight();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/AbstractTreeForTreeLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\nimport java.util.List;\n\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.util.IterableUtil;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.util.ListUtil;\n\n/**\n * Provides an easy way to implement the {@link TreeForTreeLayout} interface by\n * defining just two simple methods and a constructor.\n * <p>\n * To use this class the underlying tree must provide the children as a list\n * (see {@link #getChildrenList(Object)} and give direct access to the parent of\n * a node (see {@link #getParent(Object)}).\n * <p>\n * @param <TreeNode> <p/>\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic abstract class AbstractTreeForTreeLayout<TreeNode> implements\n                                                          TreeForTreeLayout<TreeNode> {\n\n    private final TreeNode root;\n\n    public AbstractTreeForTreeLayout(TreeNode root) {\n        this.root = root;\n    }\n\n    /**\n     * Returns the parent of a node, if it has one.\n     * <p>\n     * Time Complexity: O(1)\n     * @param node\n     * @return [nullable] the parent of the node, or null when the node is a\n     * root.\n     */\n    abstract public TreeNode getParent(TreeNode node);\n\n    /**\n     * Return the children of a node as a {@link List}.\n     * <p>\n     * Time Complexity: O(1)\n     * <p>\n     * Also the access to an item of the list must have time complexity O(1).\n     * <p>\n     * A client must not modify the returned list.\n     * @param node\n     * @return the children of the given node. When node is a leaf the list is\n     * empty.\n     */\n    abstract public List<TreeNode> getChildrenList(TreeNode node);\n\n    @Override\n    public TreeNode getRoot() {\n        return root;\n    }\n\n    @Override\n    public boolean isLeaf(TreeNode node) {\n        return getChildrenList(node).isEmpty();\n    }\n\n    @Override\n    public boolean isChildOfParent(TreeNode node,\n                                   TreeNode parentNode) {\n        return getParent(node) == parentNode;\n    }\n\n    @Override\n    public Iterable<TreeNode> getChildren(TreeNode node) {\n        return getChildrenList(node);\n    }\n\n    @Override\n    public Iterable<TreeNode> getChildrenReverse(TreeNode node) {\n        return IterableUtil.createReverseIterable(getChildrenList(node));\n    }\n\n    @Override\n    public TreeNode getFirstChild(TreeNode parentNode) {\n        return getChildrenList(parentNode).get(0);\n    }\n\n    @Override\n    public TreeNode getLastChild(TreeNode parentNode) {\n        return ListUtil.getLast(getChildrenList(parentNode));\n    }\n}\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/Configuration.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\n/**\n * Used to configure the tree layout algorithm.\n * <p>\n * Also see <a href=\"package-summary.html\">this overview</a>.\n * @param <TreeNode> <p/>\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic interface Configuration<TreeNode> {\n\n    // ------------------------------------------------------------------------\n    // rootLocation\n\n    /**\n     * Returns the position of the root node in the diagram.\n     * <p>\n     * By default the root of the tree is located at the top of the diagram.\n     * However one may also put it at the left, right or bottom of the diagram.\n     * <p>\n     * <table border=\"1\">\n     * <tr>\n     * <th>Top (Default)</th>\n     * <th>Left</th>\n     * <th>Right</th>\n     * <th>Bottom</th>\n     * </tr>\n     * <tr>\n     * <td style=\"padding:10px;\"><img src=\"doc-files/TreeGraphView-Top.png\"></td>\n     * <td style=\"padding:10px;\"><img src=\"doc-files/TreeGraphView-Left.png\"></td>\n     * <td style=\"padding:10px;\"><img src=\"doc-files/TreeGraphView-Right.png\"></td>\n     * <td style=\"padding:10px;\"><img src=\"doc-files/TreeGraphView-Bottom.png\"></td>\n     * </tr>\n     * </table>\n     * @return the position of the root node in the diagram\n     */\n    Location getRootLocation();\n\n    // ------------------------------------------------------------------------\n    // alignmentInLevel\n\n    /**\n     * Returns the alignment of \"smaller\" nodes within a level.\n     * <p>\n     * By default all nodes of one level are centered in the level. However one\n     * may also align them \"towards the root\" or \"away from the root\". When the\n     * root is located at the top this means the nodes are aligned \"to the top\n     * of the level\" or \"to the bottom of the level\".\n     * <p>\n     * <table border=\"1\">\n     * <tr>\n     * <th>Center (Default)</th>\n     * <th>TowardsRoot (\"top of level\")</th>\n     * <th>AwayFromRoot (\"bottom of level\")</th>\n     * </tr>\n     * <tr>\n     * <td style=\"padding:10px;\"><img src=\"doc-files/TreeGraphView-Center.png\"></td>\n     * <td style=\"padding:10px;\"><img\n     * src=\"doc-files/TreeGraphView-TowardsRoot.png\"></td>\n     * <td style=\"padding:10px;\"><img\n     * src=\"doc-files/TreeGraphView-AwayFromRoot.png\"></td>\n     * </tr>\n     * </table>\n     * <p>\n     * Alignment in level when root is at the left:\n     * </p>\n     * <table border=\"1\">\n     * <tr>\n     * <th>Center (Default)</th>\n     * <th>TowardsRoot (\"left of level\")</th>\n     * <th>AwayFromRoot<br>\n     * (\"right of level\")</th>\n     * </tr>\n     * <tr>\n     * <td style=\"padding:10px;\"><img\n     * src=\"doc-files/TreeGraphView-Center-RootLeft.png\"></td>\n     * <td style=\"padding:10px;\"><img\n     * src=\"doc-files/TreeGraphView-TowardsRoot-RootLeft.png\"></td>\n     * <td style=\"padding:10px;\"><img\n     * src=\"doc-files/TreeGraphView-AwayFromRoot-RootLeft.png\"></td>\n     * </tr>\n     * </table>\n     * <p/>\n     * <p>\n     * Of cause the alignment also works when the root is at the bottom or at\n     * the right side.\n     * </p>\n     * @return the alignment of \"smaller\" nodes within a level\n     */\n    AlignmentInLevel getAlignmentInLevel();\n\n    /**\n     * Returns the size of the gap between subsequent levels.\n     * <p>\n     * <img src=\"doc-files/gapBetweenLevels.png\">\n     * @param nextLevel [nextLevel > 0]\n     * @return the size of the gap between level (nextLevel-1) and nextLevel\n     * [result >= 0]\n     */\n    double getGapBetweenLevels(int nextLevel);\n\n    /**\n     * Returns the size of the minimal gap of nodes within a level.\n     * <p>\n     * In the layout there will be a gap of at least the returned size between\n     * both given nodes.\n     * <p>\n     * <img src=\"doc-files/gapBetweenNodes.png\">\n     * <p>\n     * node1 and node2 are at the same level and are placed next to each other.\n     * @param node1\n     * @param node2\n     * @return the minimal size of the gap between node1 and node2 [result >= 0]\n     */\n    double getGapBetweenNodes(TreeNode node1,\n                              TreeNode node2);\n\n    // ------------------------------------------------------------------------\n    // gapBetweenLevels/Nodes\n\n    /**\n     * Identifies the sides of a rectangle (top, left, ...)\n     */\n    public enum Location {\n        Top,\n        Left,\n        Bottom,\n        Right\n    }\n\n    /**\n     * Possible alignments of a node within a level (centered, towards or away\n     * from root)\n     */\n    public enum AlignmentInLevel {\n        Center,\n        TowardsRoot,\n        AwayFromRoot\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/DefaultConfiguration.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * Specify a {@link Configuration} through configurable parameters, or falling\n * back to some frequently used defaults.\n *\n * @param <TreeNode> <p/>\n *                   <p>\n *                   Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n *                   <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic class DefaultConfiguration<TreeNode> implements\n                                            Configuration<TreeNode> {\n\n    private final double gapBetweenLevels;\n    private final double gapBetweenNodes;\n    private final Location location;\n\n    // -----------------------------------------------------------------------\n    // gapBetweenLevels\n    private AlignmentInLevel alignmentInLevel;\n\n    /**\n     * Specifies the constants to be used for this Configuration.\n     *\n     * @param gapBetweenLevels\n     * @param gapBetweenNodes\n     * @param location         [default: {@link Configuration.Location#Top Top}]\n     * @param alignmentInLevel [default: {@link Configuration.AlignmentInLevel#Center Center}]\n     */\n    public DefaultConfiguration(double gapBetweenLevels,\n                                double gapBetweenNodes,\n                                Location location,\n                                AlignmentInLevel alignmentInLevel) {\n        PortablePreconditions.checkCondition(\"gapBetweenLevels must be >= 0\",\n                                             gapBetweenLevels >= 0);\n        PortablePreconditions.checkCondition(\"gapBetweenNodes must be >= 0\",\n                                             gapBetweenNodes >= 0);\n\n        this.gapBetweenLevels = gapBetweenLevels;\n        this.gapBetweenNodes = gapBetweenNodes;\n        this.location = location;\n        this.alignmentInLevel = alignmentInLevel;\n    }\n\n    // -----------------------------------------------------------------------\n    // gapBetweenNodes\n\n    /**\n     * Convenience constructor, using a default for the alignmentInLevel.\n     * <p>\n     * see\n     * {@link #DefaultConfiguration(double, double, Configuration.Location, Configuration.AlignmentInLevel)}\n     */\n    public DefaultConfiguration(double gapBetweenLevels,\n                                double gapBetweenNodes,\n                                Location location) {\n        this(gapBetweenLevels,\n             gapBetweenNodes,\n             location,\n             AlignmentInLevel.Center);\n    }\n\n    /**\n     * Convenience constructor, using a default for the rootLocation and the\n     * alignmentInLevel.\n     * <p>\n     * see\n     * {@link #DefaultConfiguration(double, double, Configuration.Location, Configuration.AlignmentInLevel)}\n     */\n    public DefaultConfiguration(double gapBetweenLevels,\n                                double gapBetweenNodes) {\n        this(gapBetweenLevels,\n             gapBetweenNodes,\n             Location.Top,\n             AlignmentInLevel.Center);\n    }\n\n    // -----------------------------------------------------------------------\n    // location\n\n    @Override\n    public double getGapBetweenLevels(int nextLevel) {\n        return gapBetweenLevels;\n    }\n\n    @Override\n    public double getGapBetweenNodes(TreeNode node1,\n                                     TreeNode node2) {\n        return gapBetweenNodes;\n    }\n\n    // -----------------------------------------------------------------------\n    // alignmentInLevel\n\n    @Override\n    public Location getRootLocation() {\n        return location;\n    }\n\n    @Override\n    public AlignmentInLevel getAlignmentInLevel() {\n        return alignmentInLevel;\n    }\n}"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/NodeExtentProvider.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\n/**\n * Provides the extent (width and height) of a tree node.\n * <p>\n * Also see <a href=\"package-summary.html\">this overview</a>.\n * @param <TreeNode> <p/>\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic interface NodeExtentProvider<TreeNode> {\n\n    /**\n     * Returns the width of the given treeNode.\n     * @param treeNode\n     * @return [result >= 0]\n     */\n    double getWidth(TreeNode treeNode);\n\n    /**\n     * Returns the height of the given treeNode.\n     * @param treeNode\n     * @return [result >= 0]\n     */\n    double getHeight(TreeNode treeNode);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/Point2D.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\n/**\n * The original implementation used java.awt.geom.Point2D that is not available for use in GWT.\n * We further could not use Lienzo's Point2D as it is marked as \"final\" and hence cannot be extended\n * as required by TreeLayout.\n */\npublic class Point2D {\n\n    private double x;\n    private double y;\n\n    protected Point2D() {\n    }\n\n    public void setLocation(final double x,\n                            final double y) {\n        this.x = x;\n        this.y = y;\n    }\n\n    public double getX() {\n        return x;\n    }\n\n    public double getY() {\n        return y;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/Rectangle2D.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\n/**\n * The original implementation used java.awt.geom.Rectangle2D that is not available for use in GWT.\n */\npublic class Rectangle2D {\n\n    private double x;\n    private double y;\n    private double width;\n    private double height;\n\n    public Rectangle2D(final double x,\n                       final double y,\n                       final double w,\n                       final double h) {\n        this.x = x;\n        this.y = y;\n        this.width = w;\n        this.height = h;\n    }\n\n    public double getX() {\n        return x;\n    }\n\n    public double getY() {\n        return y;\n    }\n\n    public double getWidth() {\n        return width;\n    }\n\n    public double getHeight() {\n        return height;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/TreeForTreeLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\n/**\n * Represents a tree to be used by the {@link TreeLayout}.\n * <p>\n * The TreeForTreeLayout interface is designed to best match the implemented\n * layout algorithm and to ensure the algorithm's time complexity promises in\n * all possible cases. However in most situation a client must not deal with all\n * details of this interface and can directly use the\n * {@link AbstractTreeForTreeLayout} to implement this\n * interface.\n * <p>\n * Also see <a href=\"package-summary.html\">this overview</a>.\n * @param <TreeNode> <p/>\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic interface TreeForTreeLayout<TreeNode> {\n\n    /**\n     * Returns the the root of the tree.\n     * <p>\n     * Time Complexity: O(1)\n     * @return the root of the tree\n     */\n    TreeNode getRoot();\n\n    /**\n     * Tells if a node is a leaf in the tree.\n     * <p>\n     * Time Complexity: O(1)\n     * @param node\n     * @return true iff node is a leaf in the tree, i.e. has no children.\n     */\n    boolean isLeaf(TreeNode node);\n\n    /**\n     * Tells if a node is a child of a given parentNode.\n     * <p>\n     * Time Complexity: O(1)\n     * @param node\n     * @param parentNode\n     * @return true iff the node is a child of the given parentNode\n     */\n    boolean isChildOfParent(TreeNode node,\n                            TreeNode parentNode);\n\n    /**\n     * Returns the children of a parent node.\n     * <p>\n     * Time Complexity: O(1)\n     * @param parentNode [!isLeaf(parentNode)]\n     * @return the children of the given parentNode, from first to last\n     */\n    Iterable<TreeNode> getChildren(TreeNode parentNode);\n\n    /**\n     * Returns the children of a parent node, in reverse order.\n     * <p>\n     * Time Complexity: O(1)\n     * @param parentNode [!isLeaf(parentNode)]\n     * @return the children of given parentNode, from last to first\n     */\n    Iterable<TreeNode> getChildrenReverse(TreeNode parentNode);\n\n    /**\n     * Returns the first child of a parent node.\n     * <p>\n     * Time Complexity: O(1)\n     * @param parentNode [!isLeaf(parentNode)]\n     * @return the first child of the parentNode\n     */\n    TreeNode getFirstChild(TreeNode parentNode);\n\n    /**\n     * Returns the last child of a parent node.\n     * <p>\n     * <p>\n     * Time Complexity: O(1)\n     * @param parentNode [!isLeaf(parentNode)]\n     * @return the last child of the parentNode\n     */\n    TreeNode getLastChild(TreeNode parentNode);\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/TreeLayout.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.IdentityHashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * Implements the actual tree layout algorithm.\n * <p>\n * The nodes with their final layout can be retrieved through\n * {@link #getNodeBounds()}.\n * <p>\n *\n * @param <TreeNode> <p/>\n *                   <p>\n *                   Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n *                   <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic class TreeLayout<TreeNode> {\n    /*\n     * Differences between this implementation and original algorithm\n\t * --------------------------------------------------------------\n\t *\n\t * For easier reference the same names (or at least similar names) as in the\n\t * paper of Buchheim, J&uuml;nger, and Leipert are used in this\n\t * implementation. However in the external interface \"first\" and \"last\" are\n\t * used instead of \"left most\" and \"right most\". The implementation also\n\t * supports tree layouts with the root at the left (or right) side. In that\n\t * case using \"left most\" would refer to the \"top\" child, i.e. using \"first\"\n\t * is less confusing.\n\t *\n\t * Also the y coordinate is not the level but directly refers the y\n\t * coordinate of a level, taking node's height and gapBetweenLevels into\n\t * account. When the root is at the left or right side the y coordinate\n\t * actually becomes an x coordinate.\n\t *\n\t * Instead of just using a constant \"distance\" to calculate the position to\n\t * the next node we refer to the \"size\" (width or height) of the node and a\n\t * \"gapBetweenNodes\".\n\t */\n\n    // ------------------------------------------------------------------------\n    // tree\n\n    private final TreeForTreeLayout<TreeNode> tree;\n    private final NodeExtentProvider<TreeNode> nodeExtentProvider;\n\n    // ------------------------------------------------------------------------\n    // nodeExtentProvider\n    private final Configuration<TreeNode> configuration;\n    private final List<Double> sizeOfLevel = new ArrayList<Double>();\n    private final boolean useIdentity;\n    private final Map<TreeNode, Double> mod;\n    private final Map<TreeNode, TreeNode> thread;\n    private final Map<TreeNode, Double> prelim;\n    private final Map<TreeNode, Double> change;\n\n    // ------------------------------------------------------------------------\n    // configuration\n    private final Map<TreeNode, Double> shift;\n    private final Map<TreeNode, TreeNode> ancestor;\n    private final Map<TreeNode, Integer> number;\n    private final Map<TreeNode, Point2D> positions;\n\n    // ------------------------------------------------------------------------\n    // bounds\n    private double boundsLeft = Double.MAX_VALUE;\n    private double boundsRight = Double.MIN_VALUE;\n    private double boundsTop = Double.MAX_VALUE;\n    private double boundsBottom = Double.MIN_VALUE;\n    private Map<TreeNode, Rectangle2D> nodeBounds;\n\n    /**\n     * Creates a TreeLayout for a given tree.\n     * <p>\n     * In addition to the tree the {@link NodeExtentProvider} and the\n     * {@link Configuration} must be given.\n     *\n     * @param useIdentity [default: false] when true, identity (\"==\") is used instead of\n     *                    equality (\"equals(...)\") when checking nodes. Within a tree\n     *                    each node must only be once (using this check).\n     */\n    public TreeLayout(TreeForTreeLayout<TreeNode> tree,\n                      NodeExtentProvider<TreeNode> nodeExtentProvider,\n                      Configuration<TreeNode> configuration,\n                      boolean useIdentity) {\n        this.tree = tree;\n        this.nodeExtentProvider = nodeExtentProvider;\n        this.configuration = configuration;\n        this.useIdentity = useIdentity;\n\n        if (this.useIdentity) {\n            this.mod = new IdentityHashMap<TreeNode, Double>();\n            this.thread = new IdentityHashMap<TreeNode, TreeNode>();\n            this.prelim = new IdentityHashMap<TreeNode, Double>();\n            this.change = new IdentityHashMap<TreeNode, Double>();\n            this.shift = new IdentityHashMap<TreeNode, Double>();\n            this.ancestor = new IdentityHashMap<TreeNode, TreeNode>();\n            this.number = new IdentityHashMap<TreeNode, Integer>();\n            this.positions = new IdentityHashMap<TreeNode, Point2D>();\n        } else {\n            this.mod = new HashMap<TreeNode, Double>();\n            this.thread = new HashMap<TreeNode, TreeNode>();\n            this.prelim = new HashMap<TreeNode, Double>();\n            this.change = new HashMap<TreeNode, Double>();\n            this.shift = new HashMap<TreeNode, Double>();\n            this.ancestor = new HashMap<TreeNode, TreeNode>();\n            this.number = new HashMap<TreeNode, Integer>();\n            this.positions = new HashMap<TreeNode, Point2D>();\n        }\n\n        // No need to explicitly set mod, thread and ancestor as their getters\n        // are taking care of the initial values. This avoids a full tree walk\n        // through and saves some memory as no entries are added for\n        // \"initial values\".\n\n        TreeNode r = tree.getRoot();\n        firstWalk(r,\n                  null);\n        calcSizeOfLevels(r,\n                         0);\n        secondWalk(r,\n                   -getPrelim(r),\n                   0,\n                   0);\n    }\n\n    // ------------------------------------------------------------------------\n    // size of level\n\n    public TreeLayout(TreeForTreeLayout<TreeNode> tree,\n                      NodeExtentProvider<TreeNode> nodeExtentProvider,\n                      Configuration<TreeNode> configuration) {\n        this(tree,\n             nodeExtentProvider,\n             configuration,\n             false);\n    }\n\n    /**\n     * Returns the Tree the layout is created for.\n     */\n    public TreeForTreeLayout<TreeNode> getTree() {\n        return tree;\n    }\n\n    /**\n     * Returns the {@link NodeExtentProvider} used by this {@link TreeLayout}.\n     */\n    public NodeExtentProvider<TreeNode> getNodeExtentProvider() {\n        return nodeExtentProvider;\n    }\n\n    private double getNodeHeight(TreeNode node) {\n        return nodeExtentProvider.getHeight(node);\n    }\n\n    // ------------------------------------------------------------------------\n    // NormalizedPosition\n\n    private double getNodeWidth(TreeNode node) {\n        return nodeExtentProvider.getWidth(node);\n    }\n\n    // ------------------------------------------------------------------------\n    // The Algorithm\n\n    private double getWidthOrHeightOfNode(TreeNode treeNode,\n                                          boolean returnWidth) {\n        return returnWidth ? getNodeWidth(treeNode) : getNodeHeight(treeNode);\n    }\n\n    /**\n     * When the level changes in Y-axis (i.e. root location Top or Bottom) the\n     * height of a node is its thickness, otherwise the node's width is its\n     * thickness.\n     * <p>\n     * The thickness of a node is used when calculating the locations of the\n     * levels.\n     *\n     * @param treeNode\n     * @return\n     */\n    private double getNodeThickness(TreeNode treeNode) {\n        return getWidthOrHeightOfNode(treeNode,\n                                      !isLevelChangeInYAxis());\n    }\n\n    /**\n     * When the level changes in Y-axis (i.e. root location Top or Bottom) the\n     * width of a node is its size, otherwise the node's height is its size.\n     * <p>\n     * The size of a node is used when calculating the distance between two\n     * nodes.\n     *\n     * @param treeNode\n     * @return\n     */\n    private double getNodeSize(TreeNode treeNode) {\n        return getWidthOrHeightOfNode(treeNode,\n                                      isLevelChangeInYAxis());\n    }\n\n    /**\n     * Returns the Configuration used by this {@link TreeLayout}.\n     */\n    public Configuration<TreeNode> getConfiguration() {\n        return configuration;\n    }\n\n    private boolean isLevelChangeInYAxis() {\n        Configuration.Location rootLocation = configuration.getRootLocation();\n        return rootLocation == Configuration.Location.Top || rootLocation == Configuration.Location.Bottom;\n    }\n\n    private int getLevelChangeSign() {\n        Configuration.Location rootLocation = configuration.getRootLocation();\n        return rootLocation == Configuration.Location.Bottom\n                || rootLocation == Configuration.Location.Right ? -1 : 1;\n    }\n\n    private void updateBounds(TreeNode node,\n                              double centerX,\n                              double centerY) {\n        double width = getNodeWidth(node);\n        double height = getNodeHeight(node);\n        double left = centerX - width / 2;\n        double right = centerX + width / 2;\n        double top = centerY - height / 2;\n        double bottom = centerY + height / 2;\n        if (boundsLeft > left) {\n            boundsLeft = left;\n        }\n        if (boundsRight < right) {\n            boundsRight = right;\n        }\n        if (boundsTop > top) {\n            boundsTop = top;\n        }\n        if (boundsBottom < bottom) {\n            boundsBottom = bottom;\n        }\n    }\n\n    /**\n     * Returns the bounds of the tree layout.\n     * <p>\n     * The bounds of a TreeLayout is the smallest rectangle containing the\n     * bounds of all nodes in the layout. It always starts at (0,0).\n     *\n     * @return the bounds of the tree layout\n     */\n    public Rectangle2D getBounds() {\n        return new Rectangle2D(0,\n                               0,\n                               boundsRight - boundsLeft,\n                               boundsBottom - boundsTop);\n    }\n\n    private void calcSizeOfLevels(TreeNode node,\n                                  int level) {\n        double oldSize;\n        if (sizeOfLevel.size() <= level) {\n            sizeOfLevel.add(Double.valueOf(0));\n            oldSize = 0;\n        } else {\n            oldSize = sizeOfLevel.get(level);\n        }\n\n        double size = getNodeThickness(node);\n        // size = nodeExtentProvider.getHeight(node);\n        if (oldSize < size) {\n            sizeOfLevel.set(level,\n                            size);\n        }\n\n        if (!tree.isLeaf(node)) {\n            for (TreeNode child : tree.getChildren(node)) {\n                calcSizeOfLevels(child,\n                                 level + 1);\n            }\n        }\n    }\n\n    /**\n     * Returns the number of levels of the tree.\n     *\n     * @return [level > 0]\n     */\n    public int getLevelCount() {\n        return sizeOfLevel.size();\n    }\n\n    /**\n     * Returns the size of a level.\n     * <p>\n     * When the root is located at the top or bottom the size of a level is the\n     * maximal height of the nodes of that level. When the root is located at\n     * the left or right the size of a level is the maximal width of the nodes\n     * of that level.\n     *\n     * @param level\n     * @return the size of the level [level >= 0 && level < levelCount]\n     */\n    public double getSizeOfLevel(int level) {\n        PortablePreconditions.checkCondition(\"level must be >= 0\",\n                                             level >= 0);\n        PortablePreconditions.checkCondition(\"level must be < levelCount\",\n                                             level < getLevelCount());\n\n        return sizeOfLevel.get(level);\n    }\n\n    private double getMod(TreeNode node) {\n        Double d = mod.get(node);\n        return d != null ? d.doubleValue() : 0;\n    }\n\n    private void setMod(TreeNode node,\n                        double d) {\n        mod.put(node,\n                d);\n    }\n\n    private TreeNode getThread(TreeNode node) {\n        TreeNode n = thread.get(node);\n        return n != null ? n : null;\n    }\n\n    private void setThread(TreeNode node,\n                           TreeNode thread) {\n        this.thread.put(node,\n                        thread);\n    }\n\n    private TreeNode getAncestor(TreeNode node) {\n        TreeNode n = ancestor.get(node);\n        return n != null ? n : node;\n    }\n\n    private void setAncestor(TreeNode node,\n                             TreeNode ancestor) {\n        this.ancestor.put(node,\n                          ancestor);\n    }\n\n    private double getPrelim(TreeNode node) {\n        Double d = prelim.get(node);\n        return d != null ? d.doubleValue() : 0;\n    }\n\n    private void setPrelim(TreeNode node,\n                           double d) {\n        prelim.put(node,\n                   d);\n    }\n\n    private double getChange(TreeNode node) {\n        Double d = change.get(node);\n        return d != null ? d.doubleValue() : 0;\n    }\n\n    private void setChange(TreeNode node,\n                           double d) {\n        change.put(node,\n                   d);\n    }\n\n    private double getShift(TreeNode node) {\n        Double d = shift.get(node);\n        return d != null ? d.doubleValue() : 0;\n    }\n\n    private void setShift(TreeNode node,\n                          double d) {\n        shift.put(node,\n                  d);\n    }\n\n    /**\n     * The distance of two nodes is the distance of the centers of both noded.\n     * <p>\n     * I.e. the distance includes the gap between the nodes and half of the\n     * sizes of the nodes.\n     *\n     * @param v\n     * @param w\n     * @return the distance between node v and w\n     */\n    private double getDistance(TreeNode v,\n                               TreeNode w) {\n        double sizeOfNodes = getNodeSize(v) + getNodeSize(w);\n\n        double distance = sizeOfNodes / 2 + configuration.getGapBetweenNodes(v,\n                                                                             w);\n        return distance;\n    }\n\n    private TreeNode nextLeft(TreeNode v) {\n        return tree.isLeaf(v) ? getThread(v) : tree.getFirstChild(v);\n    }\n\n    private TreeNode nextRight(TreeNode v) {\n        return tree.isLeaf(v) ? getThread(v) : tree.getLastChild(v);\n    }\n\n    /**\n     * @param node       [tree.isChildOfParent(node, parentNode)]\n     * @param parentNode parent of node\n     * @return\n     */\n    private int getNumber(TreeNode node,\n                          TreeNode parentNode) {\n        Integer n = number.get(node);\n        if (n == null) {\n            int i = 1;\n            for (TreeNode child : tree.getChildren(parentNode)) {\n                number.put(child,\n                           i++);\n            }\n            n = number.get(node);\n        }\n\n        return n.intValue();\n    }\n\n    /**\n     * @param vIMinus\n     * @param v\n     * @param parentOfV\n     * @param defaultAncestor\n     * @return the greatest distinct ancestor of vIMinus and its right neighbor\n     * v\n     */\n    private TreeNode ancestor(TreeNode vIMinus,\n                              TreeNode v,\n                              TreeNode parentOfV,\n                              TreeNode defaultAncestor) {\n        TreeNode ancestor = getAncestor(vIMinus);\n\n        // when the ancestor of vIMinus is a sibling of v (i.e. has the same\n        // parent as v) it is also the greatest distinct ancestor vIMinus and\n        // v. Otherwise it is the defaultAncestor\n\n        return tree.isChildOfParent(ancestor,\n                                    parentOfV) ? ancestor : defaultAncestor;\n    }\n\n    private void moveSubtree(TreeNode wMinus,\n                             TreeNode wPlus,\n                             TreeNode parent,\n                             double shift) {\n\n        int subtrees = getNumber(wPlus,\n                                 parent) - getNumber(wMinus,\n                                                     parent);\n        setChange(wPlus,\n                  getChange(wPlus) - shift / subtrees);\n        setShift(wPlus,\n                 getShift(wPlus) + shift);\n        setChange(wMinus,\n                  getChange(wMinus) + shift / subtrees);\n        setPrelim(wPlus,\n                  getPrelim(wPlus) + shift);\n        setMod(wPlus,\n               getMod(wPlus) + shift);\n    }\n\n    /**\n     * In difference to the original algorithm we also pass in the leftSibling\n     * and the parent of v.\n     * <p>\n     * <b>Why adding the parameter 'parent of v' (parentOfV) ?</b>\n     * <p>\n     * In this method we need access to the parent of v. Not every tree\n     * implementation may support efficient (i.e. constant time) access to it.\n     * On the other hand the (only) caller of this method can provide this\n     * information with only constant extra time.\n     * <p>\n     * Also we need access to the \"left most sibling\" of v. Not every tree\n     * implementation may support efficient (i.e. constant time) access to it.\n     * On the other hand the \"left most sibling\" of v is also the \"first child\"\n     * of the parent of v. The first child of a parent node we can get in\n     * constant time. As we got the parent of v we can so also get the\n     * \"left most sibling\" of v in constant time.\n     * <p>\n     * <b>Why adding the parameter 'leftSibling' ?</b>\n     * <p>\n     * In this method we need access to the \"left sibling\" of v. Not every tree\n     * implementation may support efficient (i.e. constant time) access to it.\n     * However it is easy for the caller of this method to provide this\n     * information with only constant extra time.\n     * <p>\n     * <p>\n     * <p>\n     * In addition these extra parameters avoid the need for\n     * {@link TreeForTreeLayout} to include extra methods \"getParent\",\n     * \"getLeftSibling\", or \"getLeftMostSibling\". This keeps the interface\n     * {@link TreeForTreeLayout} small and avoids redundant implementations.\n     *\n     * @param v\n     * @param defaultAncestor\n     * @param leftSibling     [nullable] the left sibling v, if there is any\n     * @param parentOfV       the parent of v\n     * @return the (possibly changes) defaultAncestor\n     */\n    private TreeNode apportion(TreeNode v,\n                               TreeNode defaultAncestor,\n                               TreeNode leftSibling,\n                               TreeNode parentOfV) {\n        TreeNode w = leftSibling;\n        if (w == null) {\n            // v has no left sibling\n            return defaultAncestor;\n        }\n        // v has left sibling w\n\n        // The following variables \"v...\" are used to traverse the contours to\n        // the subtrees. \"Minus\" refers to the left, \"Plus\" to the right\n        // subtree. \"I\" refers to the \"inside\" and \"O\" to the outside contour.\n        TreeNode vOPlus = v;\n        TreeNode vIPlus = v;\n        TreeNode vIMinus = w;\n        // get leftmost sibling of vIPlus, i.e. get the leftmost sibling of\n        // v, i.e. the leftmost child of the parent of v (which is passed\n        // in)\n        TreeNode vOMinus = tree.getFirstChild(parentOfV);\n\n        Double sIPlus = getMod(vIPlus);\n        Double sOPlus = getMod(vOPlus);\n        Double sIMinus = getMod(vIMinus);\n        Double sOMinus = getMod(vOMinus);\n\n        TreeNode nextRightVIMinus = nextRight(vIMinus);\n        TreeNode nextLeftVIPlus = nextLeft(vIPlus);\n\n        while (nextRightVIMinus != null && nextLeftVIPlus != null) {\n            vIMinus = nextRightVIMinus;\n            vIPlus = nextLeftVIPlus;\n            vOMinus = nextLeft(vOMinus);\n            vOPlus = nextRight(vOPlus);\n            setAncestor(vOPlus,\n                        v);\n            double shift = (getPrelim(vIMinus) + sIMinus)\n                    - (getPrelim(vIPlus) + sIPlus)\n                    + getDistance(vIMinus,\n                                  vIPlus);\n\n            if (shift > 0) {\n                moveSubtree(ancestor(vIMinus,\n                                     v,\n                                     parentOfV,\n                                     defaultAncestor),\n                            v,\n                            parentOfV,\n                            shift);\n                sIPlus = sIPlus + shift;\n                sOPlus = sOPlus + shift;\n            }\n            sIMinus = sIMinus + getMod(vIMinus);\n            sIPlus = sIPlus + getMod(vIPlus);\n            sOMinus = sOMinus + getMod(vOMinus);\n            sOPlus = sOPlus + getMod(vOPlus);\n\n            nextRightVIMinus = nextRight(vIMinus);\n            nextLeftVIPlus = nextLeft(vIPlus);\n        }\n\n        if (nextRightVIMinus != null && nextRight(vOPlus) == null) {\n            setThread(vOPlus,\n                      nextRightVIMinus);\n            setMod(vOPlus,\n                   getMod(vOPlus) + sIMinus - sOPlus);\n        }\n\n        if (nextLeftVIPlus != null && nextLeft(vOMinus) == null) {\n            setThread(vOMinus,\n                      nextLeftVIPlus);\n            setMod(vOMinus,\n                   getMod(vOMinus) + sIPlus - sOMinus);\n            defaultAncestor = v;\n        }\n        return defaultAncestor;\n    }\n\n    /**\n     * @param v [!tree.isLeaf(v)]\n     */\n    private void executeShifts(TreeNode v) {\n        double shift = 0;\n        double change = 0;\n        for (TreeNode w : tree.getChildrenReverse(v)) {\n            change = change + getChange(w);\n            setPrelim(w,\n                      getPrelim(w) + shift);\n            setMod(w,\n                   getMod(w) + shift);\n            shift = shift + getShift(w) + change;\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // nodeBounds\n\n    /**\n     * In difference to the original algorithm we also pass in the leftSibling\n     * (see {@link #apportion(Object, Object, Object, Object)} for a\n     * motivation).\n     *\n     * @param v\n     * @param leftSibling [nullable] the left sibling v, if there is any\n     */\n    private void firstWalk(TreeNode v,\n                           TreeNode leftSibling) {\n        if (tree.isLeaf(v)) {\n            // No need to set prelim(v) to 0 as the getter takes care of this.\n\n            TreeNode w = leftSibling;\n            if (w != null) {\n                // v has left sibling\n\n                setPrelim(v,\n                          getPrelim(w) + getDistance(v,\n                                                     w));\n            }\n        } else {\n            // v is not a leaf\n\n            TreeNode defaultAncestor = tree.getFirstChild(v);\n            TreeNode previousChild = null;\n            for (TreeNode w : tree.getChildren(v)) {\n                firstWalk(w,\n                          previousChild);\n                defaultAncestor = apportion(w,\n                                            defaultAncestor,\n                                            previousChild,\n                                            v);\n                previousChild = w;\n            }\n            executeShifts(v);\n            double midpoint = (getPrelim(tree.getFirstChild(v)) + getPrelim(tree.getLastChild(v))) / 2.0;\n            TreeNode w = leftSibling;\n            if (w != null) {\n                // v has left sibling\n\n                setPrelim(v,\n                          getPrelim(w) + getDistance(v,\n                                                     w));\n                setMod(v,\n                       getPrelim(v) - midpoint);\n            } else {\n                // v has no left sibling\n\n                setPrelim(v,\n                          midpoint);\n            }\n        }\n    }\n\n    /**\n     * In difference to the original algorithm we also pass in extra level\n     * information.\n     *\n     * @param v\n     * @param m\n     * @param level\n     * @param levelStart\n     */\n    private void secondWalk(TreeNode v,\n                            double m,\n                            int level,\n                            double levelStart) {\n        // construct the position from the prelim and the level information\n\n        // The rootLocation affects the way how x and y are changed and in what\n        // direction.\n        double levelChangeSign = getLevelChangeSign();\n        boolean levelChangeOnYAxis = isLevelChangeInYAxis();\n        double levelSize = getSizeOfLevel(level);\n\n        double x = getPrelim(v) + m;\n\n        double y;\n        Configuration.AlignmentInLevel alignment = configuration.getAlignmentInLevel();\n        if (alignment == Configuration.AlignmentInLevel.Center) {\n            y = levelStart + levelChangeSign * (levelSize / 2);\n        } else if (alignment == Configuration.AlignmentInLevel.TowardsRoot) {\n            y = levelStart + levelChangeSign * (getNodeThickness(v) / 2);\n        } else {\n            y = levelStart + levelSize - levelChangeSign * (getNodeThickness(v) / 2);\n        }\n\n        if (!levelChangeOnYAxis) {\n            double t = x;\n            x = y;\n            y = t;\n        }\n\n        positions.put(v,\n                      new NormalizedPosition(x,\n                                             y));\n\n        // update the bounds\n        updateBounds(v,\n                     x,\n                     y);\n\n        // recurse\n        if (!tree.isLeaf(v)) {\n            double nextLevelStart = levelStart\n                    + (levelSize + configuration.getGapBetweenLevels(level + 1))\n                    * levelChangeSign;\n            for (TreeNode w : tree.getChildren(v)) {\n                secondWalk(w,\n                           m + getMod(v),\n                           level + 1,\n                           nextLevelStart);\n            }\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // constructor\n\n    /**\n     * Returns the layout of the tree nodes by mapping each node of the tree to\n     * its bounds (position and size).\n     * <p>\n     * For each rectangle x and y will be >= 0. At least one rectangle will have\n     * an x == 0 and at least one rectangle will have an y == 0.\n     *\n     * @return maps each node of the tree to its bounds (position and size).\n     */\n    public Map<TreeNode, Rectangle2D> getNodeBounds() {\n        if (nodeBounds == null) {\n            nodeBounds = this.useIdentity ? new IdentityHashMap<TreeNode, Rectangle2D>()\n                    : new HashMap<TreeNode, Rectangle2D>();\n            for (Map.Entry<TreeNode, Point2D> entry : positions.entrySet()) {\n                TreeNode node = entry.getKey();\n                Point2D pos = entry.getValue();\n                double w = getNodeWidth(node);\n                double h = getNodeHeight(node);\n                double x = pos.getX() - w / 2;\n                double y = pos.getY() - h / 2;\n                nodeBounds.put(node,\n                               new Rectangle2D(x,\n                                               y,\n                                               w,\n                                               h));\n            }\n        }\n        return nodeBounds;\n    }\n\n    private void addUniqueNodes(Map<TreeNode, TreeNode> nodes,\n                                TreeNode newNode) {\n        if (nodes.put(newNode,\n                      newNode) != null) {\n            throw new RuntimeException(\"Node used more than once in tree: \" + newNode);\n        }\n        for (TreeNode n : tree.getChildren(newNode)) {\n            addUniqueNodes(nodes,\n                           n);\n        }\n    }\n\n    // ------------------------------------------------------------------------\n    // checkTree\n\n    /**\n     * Check if the tree is a \"valid\" tree.\n     * <p>\n     * Typically you will use this method during development when you get an\n     * unexpected layout from your trees.\n     * <p>\n     * The following checks are performed:\n     * <ul>\n     * <li>Each node must only occur once in the tree.</li>\n     * </ul>\n     */\n    public void checkTree() {\n        Map<TreeNode, TreeNode> nodes = this.useIdentity ? new IdentityHashMap<TreeNode, TreeNode>()\n                : new HashMap<TreeNode, TreeNode>();\n\n        // Traverse the tree and check if each node is only used once.\n        addUniqueNodes(nodes,\n                       tree.getRoot());\n    }\n\n    /**\n     * The algorithm calculates the position starting with the root at 0. I.e.\n     * the left children will get negative positions. However we want the result\n     * to be normalized to (0,0).\n     * <p>\n     * {@link NormalizedPosition} will normalize the position (given relative to\n     * the root position), taking the current bounds into account. This way the\n     * left most node bounds will start at x = 0, the top most node bounds at y\n     * = 0.\n     */\n    private class NormalizedPosition extends Point2D {\n\n        private double x_relativeToRoot;\n        private double y_relativeToRoot;\n\n        public NormalizedPosition(double x_relativeToRoot,\n                                  double y_relativeToRoot) {\n            setLocation(x_relativeToRoot,\n                        y_relativeToRoot);\n        }\n\n        @Override\n        public double getX() {\n            return x_relativeToRoot - boundsLeft;\n        }\n\n        @Override\n        public double getY() {\n            return y_relativeToRoot - boundsTop;\n        }\n\n        @Override\n        // never called from outside\n        public void setLocation(double x_relativeToRoot,\n                                double y_relativeToRoot) {\n            this.x_relativeToRoot = x_relativeToRoot;\n            this.y_relativeToRoot = y_relativeToRoot;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/util/IterableUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout.util;\n\nimport java.util.Iterator;\nimport java.util.List;\n\n/**\n * Util (general purpose) methods dealing with {@link Iterable}.\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic class IterableUtil {\n\n    /**\n     * Returns an {@link Iterable} with an iterator iterating the given list\n     * from the end to the start.\n     * <p>\n     * I.e. the iterator does the reverse of the {@link List#iterator()}.\n     * @param <T>\n     * @param list\n     * @return a reverse {@link Iterable} of the list\n     */\n    public static <T> Iterable<T> createReverseIterable(List<T> list) {\n        // When the list is empty we can use the \"forward\" iterable (i.e. the\n        // list itself) also as the reverseIterable as it will do nothing.\n        if (list.size() == 0) {\n            return list;\n        }\n\n        return new ReverseIterable<T>(list);\n    }\n\n    ;\n\n    private static class ReverseIterable<T> implements Iterable<T> {\n\n        private List<T> list;\n\n        public ReverseIterable(List<T> list) {\n            this.list = list;\n        }\n\n        @Override\n        public Iterator<T> iterator() {\n            return IteratorUtil.createReverseIterator(list);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/util/IteratorUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout.util;\n\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.ListIterator;\n\n/**\n * Util (general purpose) methods dealing with {@link Iterator}.\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic class IteratorUtil {\n\n    /**\n     * Returns an {@link Iterator} iterating the given list from the end to the\n     * start.\n     * <p>\n     * I.e. the iterator does the reverse of the {@link List#iterator()}.\n     * @param <T>\n     * @param list\n     * @return a reverse {@link Iterator} of the list\n     */\n    public static <T> Iterator<T> createReverseIterator(List<T> list) {\n        return new ReverseIterator<T>(list);\n    }\n\n    private static class ReverseIterator<T> implements Iterator<T> {\n\n        private ListIterator<T> listIterator;\n\n        public ReverseIterator(List<T> list) {\n            this.listIterator = list.listIterator(list.size());\n        }\n\n        @Override\n        public boolean hasNext() {\n            return listIterator.hasPrevious();\n        }\n\n        @Override\n        public T next() {\n            return listIterator.previous();\n        }\n\n        @Override\n        public void remove() {\n            listIterator.remove();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/layout/treelayout/util/ListUtil.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.layout.treelayout.util;\n\nimport java.util.List;\n\n/**\n * Util (general purpose) methods dealing with {@link List}.\n * <p>\n * Adapted from https://code.google.com/p/treelayout/ to be available to GWT clients\n * <p>\n * @author Udo Borkowski (ub@abego.org)\n */\npublic class ListUtil {\n\n    /**\n     * @param <T>\n     * @param list [!list.isEmpty()]\n     * @return the last element of the list\n     */\n    public static <T> T getLast(List<T> list) {\n        return list.get(list.size() - 1);\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/java/org/uberfire/ext/wires/core/trees/client/shapes/WiresBaseTreeNode.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.ext.wires.core.trees.client.shapes;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.ait.lienzo.client.core.animation.AnimationProperties;\nimport com.ait.lienzo.client.core.animation.AnimationTweener;\nimport com.ait.lienzo.client.core.animation.IAnimation;\nimport com.ait.lienzo.client.core.animation.IAnimationCallback;\nimport com.ait.lienzo.client.core.animation.IAnimationHandle;\nimport com.ait.lienzo.client.core.event.NodeDragMoveEvent;\nimport com.ait.lienzo.client.core.event.NodeDragMoveHandler;\nimport com.ait.lienzo.client.core.shape.Group;\nimport com.ait.lienzo.client.core.types.Point2D;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.ext.wires.core.api.layout.LayoutManager;\nimport org.uberfire.ext.wires.core.api.layout.RequiresLayoutManager;\nimport org.uberfire.ext.wires.core.api.shapes.RequiresShapesManager;\nimport org.uberfire.ext.wires.core.api.shapes.ShapesManager;\nimport org.uberfire.ext.wires.core.api.shapes.WiresBaseShape;\nimport org.uberfire.ext.wires.core.trees.client.canvas.WiresTreeNodeConnector;\nimport org.uberfire.ext.wires.core.trees.client.layout.WiresLayoutUtilities;\nimport org.uberfire.ext.wires.core.trees.client.layout.treelayout.Rectangle2D;\nimport org.uberfire.mvp.Command;\n\npublic abstract class WiresBaseTreeNode extends WiresBaseShape implements RequiresShapesManager,\n                                                                          RequiresLayoutManager {\n\n    private static final int ANIMATION_DURATION = 250;\n    protected ShapesManager shapesManager;\n    protected LayoutManager layoutManager;\n    private WiresBaseTreeNode parent;\n    private List<WiresBaseTreeNode> children = new ArrayList<WiresBaseTreeNode>();\n    private List<WiresTreeNodeConnector> connectors = new ArrayList<WiresTreeNodeConnector>();\n    private IAnimationHandle animationHandle;\n    private int collapsed = 0;\n\n    public WiresBaseTreeNode() {\n        //Update connectors when this Node moves\n        addNodeDragMoveHandler(new NodeDragMoveHandler() {\n\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                for (WiresTreeNodeConnector connector : connectors) {\n                    connector.getPoints().get(0).set(getLocation());\n                }\n                getLayer().batch();\n            }\n        });\n    }\n\n    @Override\n    public void setShapesManager(final ShapesManager shapesManager) {\n        this.shapesManager = shapesManager;\n    }\n\n    @Override\n    public void setLayoutManager(final LayoutManager layoutManager) {\n        this.layoutManager = layoutManager;\n    }\n\n    @Override\n    public boolean contains(final double cx,\n                            final double cy) {\n        return false;\n    }\n\n    @Override\n    public void destroy() {\n        //Remove children\n        final List<WiresBaseTreeNode> cloneChildren = new ArrayList<WiresBaseTreeNode>(children);\n        for (WiresBaseTreeNode child : cloneChildren) {\n            shapesManager.forceDeleteShape(child);\n        }\n        children.clear();\n\n        //Remove connectors to children\n        final List<WiresTreeNodeConnector> cloneConnectors = new ArrayList<WiresTreeNodeConnector>(connectors);\n        for (WiresTreeNodeConnector connector : cloneConnectors) {\n            getLayer().remove(connector);\n        }\n        connectors.clear();\n\n        //Remove from its parent\n        if (parent != null) {\n            parent.removeChildNode(this);\n        }\n        super.destroy();\n    }\n\n    public WiresBaseTreeNode getParentNode() {\n        return this.parent;\n    }\n\n    public void setParentNode(final WiresBaseTreeNode parent) {\n        this.parent = parent;\n    }\n\n    /**\n     * TreeNodes can decide to accept child TreeNodes when being dragged from the Palette to a prospective parent\n     * @param child TreeNode that will be added to this TreeNode as a child\n     * @return true if the child can be added to this TreeNode\n     */\n    public boolean acceptChildNode(final WiresBaseTreeNode child) {\n        //Accept all types of WiresBaseTreeNode by default\n        return true;\n    }\n\n    /**\n     * Add a TreeNode as a child to this TreeNode. A connector is automatically created and maintained for the child.\n     * Connectors are \"outgoing\" from the parent to a child.\n     * @param child\n     */\n    public void addChildNode(final WiresBaseTreeNode child) {\n        final WiresTreeNodeConnector connector = new WiresTreeNodeConnector();\n        connector.getPoints().get(0).set(getLocation());\n        connector.getPoints().get(1).set(child.getLocation());\n        getLayer().add(connector);\n        connector.moveToBottom();\n\n        final int index = getChildIndex(connector);\n        children.add(index,\n                     child);\n        connectors.add(index,\n                       connector);\n        child.setParentNode(this);\n\n        //Update connectors when child Node moves\n        child.addNodeDragMoveHandler(new NodeDragMoveHandler() {\n            @Override\n            public void onNodeDragMove(final NodeDragMoveEvent nodeDragMoveEvent) {\n                connector.getPoints().get(1).set(child.getLocation());\n            }\n        });\n    }\n\n    //Get the index of the new child connector by determining the angle of existing connectors it lays in between\n    private int getChildIndex(final WiresTreeNodeConnector newConnector) {\n        final double newConnectorTheta = getConnectorAngle(newConnector);\n        for (int index = 0; index < connectors.size(); index++) {\n            final WiresTreeNodeConnector existingConnector = connectors.get(index);\n            final double existingConnectorTheta = getConnectorAngle(existingConnector);\n            if (newConnectorTheta > existingConnectorTheta) {\n                return index;\n            }\n        }\n        return connectors.size();\n    }\n\n    private double getConnectorAngle(final WiresTreeNodeConnector connector) {\n        final double cdx = connector.getPoints().get(1).getX() - connector.getPoints().get(0).getX();\n        final double cdy = connector.getPoints().get(1).getY() - connector.getPoints().get(0).getY();\n        final double theta = Math.atan2(cdy,\n                                        cdx) + Math.PI / 2;\n        return (theta < 0 ? theta + (2 * Math.PI) : theta);\n    }\n\n    /**\n     * Remove a child TreeNode from this TreeNode. Connectors are automatically cleared up.\n     * @param child\n     */\n    public void removeChildNode(final WiresBaseTreeNode child) {\n        child.setParentNode(null);\n        final int index = children.indexOf(child);\n        final WiresTreeNodeConnector connector = connectors.get(index);\n        children.remove(child);\n        connectors.remove(connector);\n        getLayer().remove(connector);\n    }\n\n    public List<WiresBaseTreeNode> getChildren() {\n        return this.children;\n    }\n\n    public abstract double getWidth();\n\n    public abstract double getHeight();\n\n    private void childMoved(final WiresBaseTreeNode child,\n                            final double nx,\n                            final double ny) {\n        final int index = children.indexOf(child);\n        final WiresTreeNodeConnector connector = connectors.get(index);\n        connector.getPoints().get(1).setX(nx);\n        connector.getPoints().get(1).setY(ny);\n    }\n\n    /**\n     * Collapse this TreeNode and all descendants.\n     * @param callback The callback is invoked when the animation completes.\n     */\n    public void collapse(final Command callback) {\n        //This TreeNode is already collapsed\n        if (!hasChildren() || hasCollapsedChildren()) {\n            return;\n        }\n        if (animationHandle != null) {\n            animationHandle.stop();\n        }\n        animationHandle = animate(AnimationTweener.EASE_OUT,\n                                  new AnimationProperties(),\n                                  ANIMATION_DURATION,\n                                  new IAnimationCallback() {\n\n                                      private List<WiresBaseTreeNode> descendants;\n                                      private Map<WiresBaseShape, Pair<Point2D, Point2D>> transformations = new HashMap<WiresBaseShape, Pair<Point2D, Point2D>>();\n\n                                      private Map<WiresBaseShape, Point2D> layout;\n                                      private Rectangle2D canvasBounds;\n\n                                      @Override\n                                      public void onStart(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Mark all descendants as collapsed, which affects the layout information\n                                          descendants = getDescendants(WiresBaseTreeNode.this);\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              descendant.collapsed++;\n                                          }\n\n                                          //Get new layout information\n                                          layout = layoutManager.getLayoutInformation(getTreeRoot());\n                                          canvasBounds = WiresLayoutUtilities.alignLayoutInCanvas(layout);\n\n                                          //Store required transformations: Shape, Current location, Target location\n                                          transformations.clear();\n                                          for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {\n                                              final Point2D origin = e.getKey().getLocation();\n                                              final Point2D destination = e.getValue();\n                                              transformations.put(e.getKey(),\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             destination));\n                                          }\n\n                                          //Allow subclasses to change their appearance\n                                          onCollapseStart();\n                                      }\n\n                                      @Override\n                                      public void onFrame(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Lienzo's IAnimation.getPercent() passes values > 1.0\n                                          final double pct = iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent();\n\n                                          //Move each descendant along the line between its origin and the target destination\n                                          for (Map.Entry<WiresBaseShape, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                              final Point2D descendantOrigin = e.getValue().getK1();\n                                              final Point2D descendantTarget = e.getValue().getK2();\n                                              final double dx = (descendantTarget.getX() - descendantOrigin.getX()) * pct;\n                                              final double dy = (descendantTarget.getY() - descendantOrigin.getY()) * pct;\n                                              e.getKey().setX(descendantOrigin.getX() + dx);\n                                              e.getKey().setY(descendantOrigin.getY() + dy);\n                                          }\n\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              descendant.setAlpha(1.0 - pct);\n                                          }\n\n                                          //Allow subclasses to change their appearance\n                                          onCollapseProgress(pct);\n\n                                          //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                                          WiresBaseTreeNode.this.getLayer().batch();\n                                      }\n\n                                      @Override\n                                      public void onClose(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Hide connectors, descendants and descendants' connectors when complete\n                                          for (WiresTreeNodeConnector connector : connectors) {\n                                              connector.setVisible(false);\n                                          }\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              descendant.setVisible(false);\n                                              for (WiresTreeNodeConnector connector : descendant.connectors) {\n                                                  connector.setVisible(false);\n                                              }\n                                          }\n\n                                          //Allow subclasses to change their appearance\n                                          onCollapseEnd();\n\n                                          //Invoke callback if one was provided\n                                          if (callback != null) {\n                                              callback.execute();\n                                          }\n\n                                          WiresLayoutUtilities.resizeViewPort(canvasBounds,\n                                                                              WiresBaseTreeNode.this.getViewport());\n                                      }\n                                  });\n\n        getLayer().batch();\n    }\n\n    /**\n     * Called when the TreeNode is about to be collapsed. Default implementation does nothing.\n     */\n    public void onCollapseStart() {\n        //Do nothing by default\n    }\n\n    /**\n     * Called while the TreeNode is being collapsed. Default implementation does nothing.\n     * @param pct 0.0 to 1.0 where 1.0 is collapsed\n     */\n    public void onCollapseProgress(final double pct) {\n        //Do nothing by default\n    }\n\n    /**\n     * Called when the TreeNode has been collapsed. Default implementation does nothing.\n     */\n    public void onCollapseEnd() {\n        //Do nothing by default\n    }\n\n    /**\n     * Expand this TreeNode and all descendants. Nested collapsed TreeNodes are not expanded.\n     * @param callback The callback is invoked when the animation completes.\n     */\n    public void expand(final Command callback) {\n        //This TreeNode is already expanded\n        if (!hasCollapsedChildren()) {\n            return;\n        }\n        if (animationHandle != null) {\n            animationHandle.stop();\n        }\n        animationHandle = animate(AnimationTweener.EASE_OUT,\n                                  new AnimationProperties(),\n                                  ANIMATION_DURATION,\n                                  new IAnimationCallback() {\n\n                                      private List<WiresBaseTreeNode> descendants;\n                                      private Map<WiresBaseShape, Pair<Point2D, Point2D>> transformations = new HashMap<WiresBaseShape, Pair<Point2D, Point2D>>();\n\n                                      @Override\n                                      public void onStart(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Show connectors to this node's immediate children\n                                          for (WiresTreeNodeConnector connector : connectors) {\n                                              connector.setVisible(true);\n                                          }\n\n                                          //Show child nodes and connectors if they are not still collapsed\n                                          descendants = getDescendants(WiresBaseTreeNode.this);\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              descendant.collapsed--;\n                                              if (descendant.collapsed == 0) {\n                                                  descendant.setVisible(true);\n                                              }\n                                          }\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              for (WiresTreeNodeConnector connector : descendant.connectors) {\n                                                  connector.setVisible(!descendant.hasCollapsedChildren());\n                                              }\n                                          }\n\n                                          //Get new layout information\n                                          final Map<WiresBaseShape, Point2D> layout = layoutManager.getLayoutInformation(getTreeRoot());\n                                          final Rectangle2D canvasBounds = WiresLayoutUtilities.alignLayoutInCanvas(layout);\n\n                                          //Store required transformations: Shape, Current location, Target location\n                                          transformations.clear();\n                                          for (Map.Entry<WiresBaseShape, Point2D> e : layout.entrySet()) {\n                                              final Point2D origin = e.getKey().getLocation();\n                                              final Point2D destination = e.getValue();\n                                              transformations.put(e.getKey(),\n                                                                  new Pair<Point2D, Point2D>(origin,\n                                                                                             destination));\n                                          }\n\n                                          //Allow subclasses to change their appearance\n                                          onExpandStart();\n\n                                          WiresLayoutUtilities.resizeViewPort(canvasBounds,\n                                                                              WiresBaseTreeNode.this.getViewport());\n                                      }\n\n                                      @Override\n                                      public void onFrame(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Lienzo's IAnimation.getPercent() passes values > 1.0\n                                          final double pct = iAnimation.getPercent() > 1.0 ? 1.0 : iAnimation.getPercent();\n\n                                          //Move each descendant along the line between its origin and the target destination\n                                          for (Map.Entry<WiresBaseShape, Pair<Point2D, Point2D>> e : transformations.entrySet()) {\n                                              final Point2D descendantOrigin = e.getValue().getK1();\n                                              final Point2D descendantTarget = e.getValue().getK2();\n                                              final double dx = (descendantTarget.getX() - descendantOrigin.getX()) * pct;\n                                              final double dy = (descendantTarget.getY() - descendantOrigin.getY()) * pct;\n                                              e.getKey().setX(descendantOrigin.getX() + dx);\n                                              e.getKey().setY(descendantOrigin.getY() + dy);\n                                          }\n\n                                          for (WiresBaseTreeNode descendant : descendants) {\n                                              descendant.setAlpha(pct);\n                                          }\n\n                                          //Allow subclasses to change their appearance\n                                          onExpandProgress(pct);\n\n                                          //Without this call Lienzo doesn't update the Canvas for sub-classes of WiresBaseTreeNode\n                                          WiresBaseTreeNode.this.getLayer().batch();\n                                      }\n\n                                      @Override\n                                      public void onClose(final IAnimation iAnimation,\n                                                          final IAnimationHandle iAnimationHandle) {\n                                          //Allow subclasses to change their appearance\n                                          onExpandEnd();\n\n                                          //Invoke callback if one was provided\n                                          if (callback != null) {\n                                              callback.execute();\n                                          }\n                                      }\n                                  });\n\n        getLayer().batch();\n    }\n\n    /**\n     * Get the root node for the tree in which this node exists\n     * @return The root\n     */\n    private WiresBaseTreeNode getTreeRoot() {\n        WiresBaseTreeNode root = this;\n        while (root.parent != null) {\n            root = root.parent;\n        }\n        return root;\n    }\n\n    /**\n     * Called when the TreeNode is about to be expanded. Default implementation does nothing.\n     */\n    public void onExpandStart() {\n        //Do nothing by default\n    }\n\n    /**\n     * Called while the TreeNode is being expanded. Default implementation does nothing.\n     * @param pct 0.0 to 1.0 where 1.0 is expanded\n     */\n    public void onExpandProgress(final double pct) {\n        //Do nothing by default\n    }\n\n    /**\n     * Called when the TreeNode has been expanded. Default implementation does nothing.\n     */\n    public void onExpandEnd() {\n        //Do nothing by default\n    }\n\n    protected List<WiresBaseTreeNode> getDescendants(final WiresBaseTreeNode node) {\n        final List<WiresBaseTreeNode> descendants = new ArrayList<WiresBaseTreeNode>();\n        descendants.addAll(node.children);\n        for (WiresBaseTreeNode child : node.children) {\n            descendants.addAll(getDescendants(child));\n        }\n        return descendants;\n    }\n\n    public boolean hasChildren() {\n        return children.size() > 0;\n    }\n\n    public boolean hasCollapsedChildren() {\n        for (WiresBaseTreeNode child : children) {\n            if (child.collapsed > 0) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    //Move the Connector end-points to match where the descendant has been moved\n    private void updateConnectorsEndPoints() {\n        if (connectors == null) {\n            return;\n        }\n        for (WiresTreeNodeConnector connector : connectors) {\n            connector.getPoints().get(0).setX(getX());\n            connector.getPoints().get(0).setY(getY());\n        }\n        if (parent != null) {\n            parent.childMoved(this,\n                              getX(),\n                              getY());\n        }\n    }\n\n    @Override\n    public Group setX(final double x) {\n        final Group g = super.setX(x);\n        updateConnectorsEndPoints();\n        return g;\n    }\n\n    @Override\n    public Group setY(final double y) {\n        final Group g = super.setY(y);\n        updateConnectorsEndPoints();\n        return g;\n    }\n}\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 JBoss, by Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.ext.wires.core.trees.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-extensions/uberfire-wires/uberfire-wires-core/uberfire-wires-core-trees/src/main/resources/org/uberfire/ext/wires/core/trees/WiresCoreTrees.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 JBoss, by Red Hat, Inc\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.5.1//EN\" \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.1/distro-source/core/src/gwt-module.dtd\">\n\n<module>\n  <inherits name='com.google.gwt.user.User'/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ioc.Container\"/>\n\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreApi\"/>\n  <inherits name=\"org.uberfire.ext.wires.core.WiresCoreClient\"/>\n\n  <source path=\"client\"></source>\n</module>"
  },
  {
    "path": "uberfire-io/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-io/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-io</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire I/O</name>\n  <description>\n    Set of utilities/facades for NIO.2\n  </description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>log4j-over-slf4j</artifactId>\n      <scope>runtime</scope>\n    </dependency>\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/IOService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.commons.lifecycle.PriorityDisposable;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\n/**\n *\n */\npublic interface IOService extends PriorityDisposable {\n\n    public static Set<OpenOption> EMPTY_OPTIONS = new HashSet<OpenOption>();\n\n    void startBatch(final FileSystem fs);\n\n    void startBatch(final FileSystem fs,\n                    final Option... options);\n\n    void endBatch();\n\n    FileAttribute<?>[] convert(final Map<String, ?> attrs);\n\n    Path get(final String first,\n             final String... more)\n            throws IllegalArgumentException;\n\n    Path get(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException;\n\n    Iterable<FileSystemMetadata> getFileSystemMetadata();\n\n    FileSystem getFileSystem(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException,\n            ProviderNotFoundException, SecurityException;\n\n    FileSystem newFileSystem(final URI uri,\n                             final Map<String, ?> env)\n            throws IllegalArgumentException, FileSystemAlreadyExistsException,\n            ProviderNotFoundException, IOException, SecurityException;\n\n    void onNewFileSystem(final NewFileSystemListener listener);\n\n    InputStream newInputStream(final Path path,\n                               final OpenOption... options)\n            throws IllegalArgumentException, NoSuchFileException,\n            UnsupportedOperationException, IOException, SecurityException;\n\n    OutputStream newOutputStream(final Path path,\n                                 final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException;\n\n    SeekableByteChannel newByteChannel(final Path path,\n                                       final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException;\n\n    SeekableByteChannel newByteChannel(final Path path,\n                                       final Set<? extends OpenOption> options,\n                                       final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException;\n\n    DirectoryStream<Path> newDirectoryStream(final Path dir)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException;\n\n    DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                             final DirectoryStream.Filter<Path> filter)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException;\n\n    Path createFile(final Path path,\n                    final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException;\n\n    Path createDirectory(final Path dir,\n                         final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException;\n\n    Path createDirectories(final Path dir,\n                           final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException;\n\n    Path createDirectory(final Path dir,\n                         final Map<String, ?> attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException;\n\n    Path createDirectories(final Path dir,\n                           final Map<String, ?> attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException;\n\n    void delete(final Path path,\n                final DeleteOption... options)\n            throws IllegalArgumentException, NoSuchFileException,\n            DirectoryNotEmptyException, IOException, SecurityException;\n\n    boolean deleteIfExists(final Path path,\n                           final DeleteOption... options)\n            throws IllegalArgumentException, DirectoryNotEmptyException,\n            IOException, SecurityException;\n\n    Path createTempFile(final String prefix,\n                        final String suffix,\n                        final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException;\n\n    Path createTempFile(final Path dir,\n                        final String prefix,\n                        final String suffix,\n                        final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException;\n\n    Path createTempDirectory(final String prefix,\n                             final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException;\n\n    Path createTempDirectory(final Path dir,\n                             final String prefix,\n                             final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException;\n\n    Path copy(final Path source,\n              final Path target,\n              final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, IOException, SecurityException;\n\n    Path move(final Path source,\n              final Path target,\n              final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, AtomicMoveNotSupportedException,\n            IOException, SecurityException;\n\n    <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                         final Class<V> type)\n            throws IllegalArgumentException;\n\n    Map<String, Object> readAttributes(final Path path)\n            throws UnsupportedOperationException, NoSuchFileException,\n            IllegalArgumentException, IOException, SecurityException;\n\n    Map<String, Object> readAttributes(final Path path,\n                                       final String attributes)\n            throws UnsupportedOperationException, NoSuchFileException,\n            IllegalArgumentException, IOException, SecurityException;\n\n    Path setAttributes(final Path path,\n                       final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClassCastException, IOException, SecurityException;\n\n    Path setAttributes(final Path path,\n                       final Map<String, Object> attrs)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClassCastException, IOException, SecurityException;\n\n    Path setAttribute(final Path path,\n                      final String attribute,\n                      final Object value)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClassCastException, IOException, SecurityException;\n\n    Object getAttribute(final Path path,\n                        final String attribute)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            IOException, SecurityException;\n\n    FileTime getLastModifiedTime(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException;\n\n    long size(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException;\n\n    boolean exists(final Path path)\n            throws IllegalArgumentException, SecurityException;\n\n    boolean notExists(final Path path)\n            throws IllegalArgumentException, SecurityException;\n\n    boolean isSameFile(final Path path,\n                       final Path path2)\n            throws IllegalArgumentException, IOException, SecurityException;\n\n    BufferedReader newBufferedReader(final Path path,\n                                     final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException;\n\n    BufferedWriter newBufferedWriter(final Path path,\n                                     final Charset cs,\n                                     final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException;\n\n    long copy(final InputStream in,\n              final Path target,\n              final CopyOption... options)\n            throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException,\n            UnsupportedOperationException, SecurityException;\n\n    long copy(final Path source,\n              final OutputStream out)\n            throws IOException, SecurityException;\n\n    byte[] readAllBytes(final Path path)\n            throws IOException, OutOfMemoryError, SecurityException;\n\n    List<String> readAllLines(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException;\n\n    List<String> readAllLines(final Path path,\n                              final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException;\n\n    String readAllString(final Path path,\n                         final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException;\n\n    String readAllString(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, IOException;\n\n    Path write(final Path path,\n               final byte[] bytes,\n               final OpenOption... options)\n            throws IOException, UnsupportedOperationException, SecurityException;\n\n    Path write(final Path path,\n               final byte[] bytes,\n               final Map<String, ?> attrs,\n               final OpenOption... options)\n            throws IOException, UnsupportedOperationException, SecurityException;\n\n    Path write(final Path path,\n               final byte[] bytes,\n               final Set<? extends OpenOption> options,\n               final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final Iterable<? extends CharSequence> lines,\n               final Charset cs,\n               final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException;\n\n    Path write(final Path path,\n               final String content,\n               final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Charset cs,\n               final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Set<? extends OpenOption> options,\n               final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Charset cs,\n               final Set<? extends OpenOption> options,\n               final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Map<String, ?> attrs,\n               final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    Path write(final Path path,\n               final String content,\n               final Charset cs,\n               final Map<String, ?> attrs,\n               final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException;\n\n    public abstract static class NewFileSystemListener {\n\n        public abstract void execute(final FileSystem newFileSystem,\n                                     final String scheme,\n                                     final String name,\n                                     final Map<String, ?> env);\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/IOWatchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.WatchService;\n\npublic interface IOWatchService {\n\n    boolean hasWatchService(final FileSystem fs);\n\n    void addWatchService(final FileSystem fs,\n                         final WatchService watchService);\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/attribute/DublinCoreAttributes.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.attribute;\n\nimport java.util.List;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n *\n */\npublic interface DublinCoreAttributes extends BasicFileAttributes {\n\n    List<String> titles();\n\n    List<String> creators();\n\n    List<String> subjects();\n\n    List<String> descriptions();\n\n    List<String> publishers();\n\n    List<String> contributors();\n\n    List<String> types();\n\n    List<String> formats();\n\n    List<String> identifiers();\n\n    List<String> sources();\n\n    List<String> languages();\n\n    List<String> relations();\n\n    List<String> coverages();\n\n    List<String> rights();\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/attribute/DublinCoreAttributesUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.uberfire.io.attribute.DublinCoreView.CONTRIBUTOR;\nimport static org.uberfire.io.attribute.DublinCoreView.COVERAGE;\nimport static org.uberfire.io.attribute.DublinCoreView.CREATION_TIME;\nimport static org.uberfire.io.attribute.DublinCoreView.CREATOR;\nimport static org.uberfire.io.attribute.DublinCoreView.DESCRIPTION;\nimport static org.uberfire.io.attribute.DublinCoreView.FORMAT;\nimport static org.uberfire.io.attribute.DublinCoreView.IDENTIFIER;\nimport static org.uberfire.io.attribute.DublinCoreView.LANGUAGE;\nimport static org.uberfire.io.attribute.DublinCoreView.LAST_ACCESS_TIME;\nimport static org.uberfire.io.attribute.DublinCoreView.LAST_MODIFIED_TIME;\nimport static org.uberfire.io.attribute.DublinCoreView.PUBLISHER;\nimport static org.uberfire.io.attribute.DublinCoreView.RELATION;\nimport static org.uberfire.io.attribute.DublinCoreView.RIGHTS;\nimport static org.uberfire.io.attribute.DublinCoreView.SOURCE;\nimport static org.uberfire.io.attribute.DublinCoreView.SUBJECT;\nimport static org.uberfire.io.attribute.DublinCoreView.TITLE;\nimport static org.uberfire.io.attribute.DublinCoreView.TYPE;\n\n/**\n *\n */\npublic final class DublinCoreAttributesUtil {\n\n    private DublinCoreAttributesUtil() {\n\n    }\n\n    public static Map<String, Object> cleanup(final Map<String, Object> _attrs) {\n        final Map<String, Object> attrs = new HashMap<String, Object>(_attrs);\n\n        for (final String key : _attrs.keySet()) {\n            if (key.startsWith(TITLE) || key.startsWith(CREATOR) ||\n                    key.startsWith(SUBJECT) || key.startsWith(DESCRIPTION) ||\n                    key.startsWith(PUBLISHER) || key.startsWith(CONTRIBUTOR) ||\n                    key.startsWith(TYPE) || key.startsWith(FORMAT) ||\n                    key.startsWith(IDENTIFIER) || key.startsWith(SOURCE) ||\n                    key.startsWith(LANGUAGE) || key.startsWith(RELATION) ||\n                    key.startsWith(COVERAGE) || key.startsWith(RIGHTS)) {\n                attrs.put(key,\n                          null);\n            }\n        }\n\n        return attrs;\n    }\n\n    public static Map<String, Object> toMap(final DublinCoreAttributes attrs,\n                                            final String... attributes) {\n\n        return new HashMap<String, Object>() {{\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n\n                if (attribute.equals(\"*\") || attribute.equals(TITLE)) {\n                    for (int i = 0; i < attrs.titles().size(); i++) {\n                        final String content = attrs.titles().get(i);\n                        put(buildAttrName(TITLE,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(CREATOR)) {\n                    for (int i = 0; i < attrs.creators().size(); i++) {\n                        final String content = attrs.creators().get(i);\n                        put(buildAttrName(CREATOR,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(SUBJECT)) {\n                    for (int i = 0; i < attrs.subjects().size(); i++) {\n                        final String content = attrs.subjects().get(i);\n                        put(buildAttrName(SUBJECT,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(DESCRIPTION)) {\n                    for (int i = 0; i < attrs.descriptions().size(); i++) {\n                        final String content = attrs.descriptions().get(i);\n                        put(buildAttrName(DESCRIPTION,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(PUBLISHER)) {\n                    for (int i = 0; i < attrs.publishers().size(); i++) {\n                        final String content = attrs.publishers().get(i);\n                        put(buildAttrName(PUBLISHER,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(CONTRIBUTOR)) {\n                    for (int i = 0; i < attrs.contributors().size(); i++) {\n                        final String content = attrs.contributors().get(i);\n                        put(buildAttrName(CONTRIBUTOR,\n                                          i),\n                            content);\n                    }\n                }\n\n                if (attribute.equals(\"*\") || attribute.equals(LAST_MODIFIED_TIME)) {\n                    put(LAST_MODIFIED_TIME,\n                        null);\n                }\n                if (attribute.equals(\"*\") || attribute.equals(LAST_ACCESS_TIME)) {\n                    put(LAST_ACCESS_TIME,\n                        null);\n                }\n                if (attribute.equals(\"*\") || attribute.equals(CREATION_TIME)) {\n                    put(CREATION_TIME,\n                        null);\n                }\n\n                if (attribute.equals(\"*\") || attribute.equals(TYPE)) {\n                    for (int i = 0; i < attrs.types().size(); i++) {\n                        final String content = attrs.types().get(i);\n                        put(buildAttrName(TYPE,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(FORMAT)) {\n                    for (int i = 0; i < attrs.formats().size(); i++) {\n                        final String content = attrs.formats().get(i);\n                        put(buildAttrName(FORMAT,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(IDENTIFIER)) {\n                    for (int i = 0; i < attrs.identifiers().size(); i++) {\n                        final String content = attrs.identifiers().get(i);\n                        put(buildAttrName(IDENTIFIER,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(SOURCE)) {\n                    for (int i = 0; i < attrs.sources().size(); i++) {\n                        final String content = attrs.sources().get(i);\n                        put(buildAttrName(SOURCE,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(LANGUAGE)) {\n                    for (int i = 0; i < attrs.languages().size(); i++) {\n                        final String content = attrs.languages().get(i);\n                        put(buildAttrName(LANGUAGE,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(RELATION)) {\n                    for (int i = 0; i < attrs.relations().size(); i++) {\n                        final String content = attrs.relations().get(i);\n                        put(buildAttrName(RELATION,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(COVERAGE)) {\n                    for (int i = 0; i < attrs.coverages().size(); i++) {\n                        final String content = attrs.coverages().get(i);\n                        put(buildAttrName(COVERAGE,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\") || attribute.equals(RIGHTS)) {\n                    for (int i = 0; i < attrs.rights().size(); i++) {\n                        final String content = attrs.rights().get(i);\n                        put(buildAttrName(RIGHTS,\n                                          i),\n                            content);\n                    }\n                }\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n\n    private static String buildAttrName(final String title,\n                                        final int i) {\n        return title + \"[\" + i + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/attribute/DublinCoreView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.attribute;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.commons.data.Pair.newPair;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.uberfire.io.attribute.DublinCoreAttributesUtil.toMap;\n\n/**\n *\n */\npublic class DublinCoreView\n        extends AbstractBasicFileAttributeView<AbstractPath>\n        implements NeedsPreloadedAttrs {\n\n    static final String TITLE = \"dcore.title\";\n    static final String CREATOR = \"dcore.creator\";\n    static final String SUBJECT = \"dcore.subject\";\n    static final String DESCRIPTION = \"dcore.description\";\n    static final String PUBLISHER = \"dcore.publisher\";\n    static final String CONTRIBUTOR = \"dcore.contributor\";\n    static final String TYPE = \"dcore.type\";\n    static final String FORMAT = \"dcore.format\";\n    static final String IDENTIFIER = \"dcore.identifier\";\n    static final String SOURCE = \"dcore.source\";\n    static final String LANGUAGE = \"dcore.language\";\n    static final String RELATION = \"dcore.relation\";\n    static final String COVERAGE = \"dcore.coverage\";\n    static final String RIGHTS = \"dcore.rights\";\n    static final String LAST_MODIFIED_TIME = \"lastModifiedTime\";\n    static final String LAST_ACCESS_TIME = \"lastAccessTime\";\n    static final String CREATION_TIME = \"creationTime\";\n\n    private static final Set<String> PROPERTIES = new HashSet<String>() {{\n        add(TITLE);\n        add(CREATOR);\n        add(SUBJECT);\n        add(DESCRIPTION);\n        add(PUBLISHER);\n        add(CONTRIBUTOR);\n        add(TYPE);\n        add(FORMAT);\n        add(IDENTIFIER);\n        add(SOURCE);\n        add(LANGUAGE);\n        add(RELATION);\n        add(COVERAGE);\n        add(RIGHTS);\n    }};\n\n    private final DublinCoreAttributes attrs;\n\n    public DublinCoreView(final AbstractPath path) {\n        super(path);\n        final Map<String, Object> content = path.getAttrStorage().getContent();\n\n        final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path,\n                                                                                                   BasicFileAttributeView.class).readAttributes();\n\n        final Map<String, List<String>> dcore = new HashMap<String, List<String>>() {{\n            for (final String property : PROPERTIES) {\n                put(property,\n                    new ArrayList<String>());\n            }\n        }};\n\n        for (final Map.Entry<String, Object> entry : content.entrySet()) {\n            if (entry.getKey().startsWith(TITLE)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(TITLE).add(result.getK1(),\n                                     result.getK2());\n            } else if (entry.getKey().startsWith(CREATOR)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(CREATOR).add(result.getK1(),\n                                       result.getK2());\n            } else if (entry.getKey().startsWith(SUBJECT)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(SUBJECT).add(result.getK1(),\n                                       result.getK2());\n            } else if (entry.getKey().startsWith(DESCRIPTION)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(DESCRIPTION).add(result.getK1(),\n                                           result.getK2());\n            } else if (entry.getKey().startsWith(PUBLISHER)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(PUBLISHER).add(result.getK1(),\n                                         result.getK2());\n            } else if (entry.getKey().startsWith(CONTRIBUTOR)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(CONTRIBUTOR).add(result.getK1(),\n                                           result.getK2());\n            } else if (entry.getKey().startsWith(TYPE)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(TYPE).add(result.getK1(),\n                                    result.getK2());\n            } else if (entry.getKey().startsWith(FORMAT)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(FORMAT).add(result.getK1(),\n                                      result.getK2());\n            } else if (entry.getKey().startsWith(IDENTIFIER)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(IDENTIFIER).add(result.getK1(),\n                                          result.getK2());\n            } else if (entry.getKey().startsWith(SOURCE)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(SOURCE).add(result.getK1(),\n                                      result.getK2());\n            } else if (entry.getKey().startsWith(LANGUAGE)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(LANGUAGE).add(result.getK1(),\n                                        result.getK2());\n            } else if (entry.getKey().startsWith(RELATION)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(RELATION).add(result.getK1(),\n                                        result.getK2());\n            } else if (entry.getKey().startsWith(COVERAGE)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(COVERAGE).add(result.getK1(),\n                                        result.getK2());\n            } else if (entry.getKey().startsWith(RIGHTS)) {\n                final Pair<Integer, String> result = extractValue(entry);\n                dcore.get(RIGHTS).add(result.getK1(),\n                                      result.getK2());\n            }\n        }\n\n        this.attrs = new DublinCoreAttributes() {\n            @Override\n            public List<String> titles() {\n                return dcore.get(TITLE);\n            }\n\n            @Override\n            public List<String> creators() {\n                return dcore.get(CREATOR);\n            }\n\n            @Override\n            public List<String> subjects() {\n                return dcore.get(SUBJECT);\n            }\n\n            @Override\n            public List<String> descriptions() {\n                return dcore.get(DESCRIPTION);\n            }\n\n            @Override\n            public List<String> publishers() {\n                return dcore.get(PUBLISHER);\n            }\n\n            @Override\n            public List<String> contributors() {\n                return dcore.get(CONTRIBUTOR);\n            }\n\n            @Override\n            public List<String> types() {\n                return dcore.get(TYPE);\n            }\n\n            @Override\n            public List<String> formats() {\n                return dcore.get(FORMAT);\n            }\n\n            @Override\n            public List<String> identifiers() {\n                return dcore.get(IDENTIFIER);\n            }\n\n            @Override\n            public List<String> sources() {\n                return dcore.get(SOURCE);\n            }\n\n            @Override\n            public List<String> languages() {\n                return dcore.get(LANGUAGE);\n            }\n\n            @Override\n            public List<String> relations() {\n                return dcore.get(RELATION);\n            }\n\n            @Override\n            public List<String> coverages() {\n                return dcore.get(COVERAGE);\n            }\n\n            @Override\n            public List<String> rights() {\n                return dcore.get(RIGHTS);\n            }\n\n            @Override\n            public FileTime lastModifiedTime() {\n                return fileAttrs.lastModifiedTime();\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return fileAttrs.lastAccessTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                return fileAttrs.creationTime();\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return fileAttrs.isRegularFile();\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return fileAttrs.isDirectory();\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return fileAttrs.isSymbolicLink();\n            }\n\n            @Override\n            public boolean isOther() {\n                return fileAttrs.isOther();\n            }\n\n            @Override\n            public long size() {\n                return fileAttrs.size();\n            }\n\n            @Override\n            public Object fileKey() {\n                return fileAttrs.fileKey();\n            }\n        };\n    }\n\n    private Pair<Integer, String> extractValue(final Map.Entry<String, Object> entry) {\n        int start = entry.getKey().indexOf('[');\n        if (start < 0) {\n            return newPair(0,\n                           entry.getValue().toString());\n        }\n        int end = entry.getKey().indexOf(']');\n\n        return newPair(Integer.valueOf(entry.getKey().substring(start + 1,\n                                                                end)),\n                       entry.getValue().toString());\n    }\n\n    @Override\n    public String name() {\n        return \"dcore\";\n    }\n\n    @Override\n    public DublinCoreAttributes readAttributes() throws IOException {\n        return attrs;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        return toMap(readAttributes(),\n                     attributes);\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{DublinCoreView.class};\n    }\n\n    @Override\n    public void setAttribute(final String attribute,\n                             final Object value) throws IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n        checkCondition(\"invalid attribute\",\n                       PROPERTIES.contains(attribute));\n\n        throw new NotImplementedException();\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/impl/AbstractIOService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.ByteBuffer;\nimport java.nio.charset.Charset;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.EnumSet;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.IOWatchService;\nimport org.uberfire.io.lock.BatchLockControl;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.FileSystems;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.StandardOpenOption;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.StandardOpenOption.CREATE_NEW;\nimport static org.uberfire.java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;\nimport static org.uberfire.java.nio.file.StandardOpenOption.WRITE;\n\npublic abstract class AbstractIOService implements IOServiceIdentifiable,\n                                                   IOServiceLockable {\n\n    protected static final String DEFAULT_SERVICE_NAME = \"default\";\n    protected static final Charset UTF_8 = Charset.forName(\"UTF-8\");\n    private static final Logger logger = LoggerFactory.getLogger(AbstractIOService.class);\n    private static final Set<StandardOpenOption> CREATE_NEW_FILE_OPTIONS = EnumSet.of(CREATE_NEW,\n                                                                                      WRITE);\n    private static final Pattern pattern = Pattern.compile(\"/[\\u202a\\u202b\\u202c\\u202d\\u202e\\u2066\\u2067\\u2068\\u2069]/ug\");\n    protected final IOWatchService ioWatchService;\n\n    protected final Set<FileSystemMetadata> fileSystems = Collections.newSetFromMap(new ConcurrentHashMap<>());\n    private final BatchLockControl batchLockControl = new BatchLockControl();\n    protected NewFileSystemListener newFileSystemListener = null;\n    protected boolean isDisposed = false;\n    private String id;\n\n    public AbstractIOService() {\n        this.id = DEFAULT_SERVICE_NAME;\n        ioWatchService = null;\n        PriorityDisposableRegistry.register(this);\n    }\n\n    public AbstractIOService(final String id) {\n        this.id = id;\n        ioWatchService = null;\n        PriorityDisposableRegistry.register(this);\n    }\n\n    public AbstractIOService(final IOWatchService watchService) {\n        this.id = DEFAULT_SERVICE_NAME;\n        ioWatchService = watchService;\n        PriorityDisposableRegistry.register(this);\n    }\n\n    public AbstractIOService(final String id,\n                             final IOWatchService watchService) {\n        this.id = id;\n        ioWatchService = watchService;\n        PriorityDisposableRegistry.register(this);\n    }\n\n    @Override\n    public void startBatch(FileSystem fs) {\n        batchProcess(fs);\n    }\n\n    @Override\n    public void startBatch(FileSystem fs,\n                           final Option... options) {\n        batchProcess(fs,\n                     options);\n    }\n\n    private void batchProcess(final FileSystem fs,\n                              final Option... options) {\n        startBatchProcess(fs);\n        setOptionsOnFileSystem(fs,\n                               options);\n    }\n\n    private void startBatchProcess(final FileSystem fileSystem) {\n        batchLockControl.lock(fileSystem);\n        setBatchModeOn(fileSystem);\n    }\n\n    private void setOptionsOnFileSystem(FileSystem fs,\n                                        Option[] options) {\n        if (options != null && options.length == 1) {\n            setAttribute(getFirstRootDirectory(fs),\n                         FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                         options[0]);\n        }\n    }\n\n    @Override\n    public void endBatch() {\n        if (!batchLockControl.isLocked()) {\n            throw new RuntimeException(\"There is no batch process.\");\n        }\n\n        if (batchLockControl.getHoldCount() > 1) {\n            batchLockControl.unlock();\n            return;\n        }\n\n        try {\n            FileSystem fsOnBatch = batchLockControl.getFileSystemOnBatch();\n            cleanUpAndUnsetBatchModeOnFileSystems(fsOnBatch);\n        } catch (Exception e) {\n            throw new RuntimeException(\"Exception cleaning and unsetting batch mode on FS.\",\n                                       e);\n        } finally {\n            batchLockControl.unlock();\n        }\n    }\n\n    private void cleanUpAndUnsetBatchModeOnFileSystems(FileSystem fileSystemOnBatch) {\n        unsetBatchModeOn(fileSystemOnBatch);\n    }\n\n    @Override\n    public BatchLockControl getLockControl() {\n        return batchLockControl;\n    }\n\n    private void setBatchModeOn(FileSystem fs) {\n        Files.setAttribute(getFirstRootDirectory(fs),\n                           FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                           FileSystemState.BATCH);\n    }\n\n    private Path getFirstRootDirectory(FileSystem fs) {\n        checkNotNull(\"fs\",\n                     fs);\n        Iterable<Path> rootDirectories = checkNotNull(\"fs.getRootDirectories()\",\n                                                      fs.getRootDirectories());\n        Iterator<Path> iterator = checkNotNull(\"fs.getRootDirectories().iterator()\",\n                                               rootDirectories.iterator());\n        return iterator.next();\n    }\n\n    void unsetBatchModeOn(FileSystem fs) {\n        Files.setAttribute(getFirstRootDirectory(fs),\n                           FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                           FileSystemState.NORMAL);\n    }\n\n    @Override\n    public Path get(final String first,\n                    final String... more) throws IllegalArgumentException {\n        return Paths.get(first,\n                         more);\n    }\n\n    @Override\n    public Path get(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return Paths.get(uri);\n    }\n\n    @Override\n    public Iterable<FileSystemMetadata> getFileSystemMetadata() {\n        return fileSystems;\n    }\n\n    @Override\n    public FileSystem getFileSystem(final URI uri) {\n        try {\n            return registerFS(FileSystems.getFileSystem(uri));\n        } catch (final Exception ex) {\n            logger.error(\"Failed to register filesystem \" + uri + \" with DEFAULT_FS_TYPE. Returning null.\",\n                         ex);\n            return null;\n        }\n    }\n\n    @Override\n    public FileSystem newFileSystem(final URI uri,\n                                    final Map<String, ?> env) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {\n        try {\n            final FileSystem fs = FileSystems.newFileSystem(uri,\n                                                            env);\n            return registerFS(fs);\n        } catch (final FileSystemAlreadyExistsException ex) {\n            registerFS(FileSystems.getFileSystem(uri));\n            throw ex;\n        }\n    }\n\n    @Override\n    public void onNewFileSystem(final NewFileSystemListener listener) {\n        this.newFileSystemListener = listener;\n    }\n\n    private FileSystem registerFS(final FileSystem fs) {\n        if (fs == null) {\n            return fs;\n        }\n\n        if (ioWatchService != null && !ioWatchService.hasWatchService(fs)) {\n            ioWatchService.addWatchService(fs,\n                                           fs.newWatchService());\n        }\n\n        fileSystems.add(new FileSystemMetadata(fs));\n\n        return fs;\n    }\n\n    @Override\n    public InputStream newInputStream(final Path path,\n                                      final OpenOption... options)\n            throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException,\n            IOException, SecurityException {\n        return Files.newInputStream(path,\n                                    options);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path dir)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return Files.newDirectoryStream(dir);\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                                    final DirectoryStream.Filter<Path> filter)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return Files.newDirectoryStream(dir,\n                                        filter);\n    }\n\n    @Override\n    public OutputStream newOutputStream(final Path path,\n                                        final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            IOException, SecurityException {\n        return Files.newOutputStream(path,\n                                     options);\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        return Files.newByteChannel(path,\n                                    options);\n    }\n\n    @Override\n    public Path createDirectory(final Path dir,\n                                final Map<String, ?> attrs) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return createDirectory(dir,\n                               convert(attrs));\n    }\n\n    @Override\n    public Path createDirectories(final Path dir,\n                                  final Map<String, ?> attrs) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return createDirectories(dir,\n                                 convert(attrs));\n    }\n\n    @Override\n    public Path createTempFile(final String prefix,\n                               final String suffix,\n                               final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return Files.createTempFile(prefix,\n                                    suffix,\n                                    attrs);\n    }\n\n    @Override\n    public Path createTempFile(final Path dir,\n                               final String prefix,\n                               final String suffix,\n                               final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return Files.createTempFile(dir,\n                                    prefix,\n                                    suffix,\n                                    attrs);\n    }\n\n    @Override\n    public Path createTempDirectory(final String prefix,\n                                    final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return Files.createTempDirectory(prefix,\n                                         attrs);\n    }\n\n    @Override\n    public Path createTempDirectory(final Path dir,\n                                    final String prefix,\n                                    final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return Files.createTempDirectory(dir,\n                                         prefix,\n                                         attrs);\n    }\n\n    @Override\n    public FileTime getLastModifiedTime(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        return Files.getLastModifiedTime(path);\n    }\n\n    @Override\n    public Path setAttribute(final Path path,\n                             final String attribute,\n                             final Object value)\n            throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        Files.setAttribute(path,\n                           attribute,\n                           value);\n        return path;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path)\n            throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException,\n            IOException, SecurityException {\n        return readAttributes(path,\n                              \"*\");\n    }\n\n    @Override\n    public Path setAttributes(final Path path,\n                              final Map<String, Object> attrs)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClassCastException, IOException, SecurityException {\n        return setAttributes(path,\n                             convert(attrs));\n    }\n\n    @Override\n    public long size(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        return Files.size(path);\n    }\n\n    @Override\n    public boolean exists(final Path path)\n            throws IllegalArgumentException, SecurityException {\n        return Files.exists(path);\n    }\n\n    @Override\n    public boolean notExists(final Path path)\n            throws IllegalArgumentException, SecurityException {\n        return Files.notExists(path);\n    }\n\n    @Override\n    public boolean isSameFile(final Path path,\n                              final Path path2)\n            throws IllegalArgumentException, IOException, SecurityException {\n        return Files.isSameFile(path,\n                                path2);\n    }\n\n    @Override\n    public Path createFile(final Path path,\n                           final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        try {\n            newByteChannel(path,\n                           CREATE_NEW_FILE_OPTIONS,\n                           attrs).close();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n\n        return path;\n    }\n\n    @Override\n    public BufferedReader newBufferedReader(final Path path,\n                                            final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return Files.newBufferedReader(path,\n                                       cs);\n    }\n\n    @Override\n    public long copy(final Path source,\n                     final OutputStream out)\n            throws IOException, SecurityException {\n        return Files.copy(source,\n                          out);\n    }\n\n    @Override\n    public byte[] readAllBytes(final Path path)\n            throws IOException, OutOfMemoryError, SecurityException {\n        return Files.readAllBytes(path);\n    }\n\n    @Override\n    public List<String> readAllLines(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return readAllLines(path,\n                            UTF_8);\n    }\n\n    @Override\n    public List<String> readAllLines(final Path path,\n                                     final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return Files.readAllLines(path,\n                                  cs);\n    }\n\n    @Override\n    public String readAllString(final Path path,\n                                final Charset cs) throws IllegalArgumentException, NoSuchFileException, IOException {\n        final byte[] result = Files.readAllBytes(path);\n        if (result == null || result.length == 0) {\n            return \"\";\n        }\n        return sanitizeContent(new String(result, cs));\n    }\n\n    @Override\n    public String readAllString(final Path path)\n            throws IllegalArgumentException, NoSuchFileException, IOException {\n        return readAllString(path,\n                             UTF_8);\n    }\n\n    @Override\n    public BufferedWriter newBufferedWriter(final Path path,\n                                            final Charset cs,\n                                            final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return Files.newBufferedWriter(path,\n                                       cs,\n                                       options);\n    }\n\n    @Override\n    public long copy(final InputStream in,\n                     final Path target,\n                     final CopyOption... options)\n            throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {\n        return Files.copy(in,\n                          target,\n                          options);\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final byte[] bytes,\n                      final OpenOption... options)\n            throws IOException, UnsupportedOperationException, SecurityException {\n        return write(path,\n                     bytes,\n                     new HashSet<OpenOption>(Arrays.asList(options)));\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final Iterable<? extends CharSequence> lines,\n                      final Charset cs,\n                      final OpenOption... options) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return write(path,\n                     toByteArray(lines,\n                                 cs),\n                     new HashSet<OpenOption>(Arrays.asList(options)));\n    }\n\n    private byte[] toByteArray(final Iterable<? extends CharSequence> lines,\n                               final Charset cs) {\n        final StringBuilder sb = new StringBuilder();\n        for (final CharSequence line : lines) {\n            sb.append(line.toString());\n        }\n        return sb.toString().getBytes();\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Charset cs,\n                      final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return write(path,\n                     sanitizeContent(content).getBytes(cs),\n                     new HashSet<OpenOption>(Arrays.asList(options)));\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return write(path,\n                     content,\n                     UTF_8,\n                     options);\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Map<String, ?> attrs,\n                      final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return write(path,\n                     content,\n                     UTF_8,\n                     attrs,\n                     options);\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Charset cs,\n                      final Map<String, ?> attrs,\n                      final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return write(path,\n                     content,\n                     cs,\n                     new HashSet<OpenOption>(Arrays.asList(options)),\n                     convert(attrs));\n    }\n\n    @Override\n    public void dispose() {\n        isDisposed = true;\n        for (final FileSystemMetadata fileSystem : getFileSystemMetadata()) {\n            try {\n                fileSystem.closeFS();\n            } catch (final Exception ignored) {\n            }\n        }\n    }\n\n    @Override\n    public FileAttribute<?>[] convert(final Map<String, ?> attrs) {\n\n        if (attrs == null || attrs.size() == 0) {\n            return new FileAttribute<?>[0];\n        }\n\n        final FileAttribute<?>[] attrsArray = new FileAttribute<?>[attrs.size()];\n\n        int i = 0;\n        for (final Map.Entry<String, ?> attr : attrs.entrySet()) {\n            attrsArray[i++] = new FileAttribute<Object>() {\n                @Override\n                public String name() {\n                    return attr.getKey();\n                }\n\n                @Override\n                public Object value() {\n                    return attr.getValue();\n                }\n            };\n        }\n\n        return attrsArray;\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final byte[] bytes,\n                      final Map<String, ?> attrs,\n                      final OpenOption... options) throws IOException, UnsupportedOperationException, SecurityException {\n        return write(path,\n                     bytes,\n                     new HashSet<OpenOption>(Arrays.asList(options)),\n                     convert(attrs));\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Set<? extends OpenOption> options,\n                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return write(path,\n                     content,\n                     UTF_8,\n                     options,\n                     attrs);\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final String content,\n                      final Charset cs,\n                      final Set<? extends OpenOption> options,\n                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException {\n\n        return write(path,\n                     sanitizeContent(content).getBytes(cs),\n                     options,\n                     attrs);\n    }\n\n    @Override\n    public Path write(final Path path,\n                      final byte[] bytes,\n                      final Set<? extends OpenOption> options,\n                      final FileAttribute<?>... attrs) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        SeekableByteChannel byteChannel;\n        try {\n            byteChannel = newByteChannel(path,\n                                         buildOptions(options),\n                                         attrs);\n        } catch (final FileAlreadyExistsException ex) {\n            ((AbstractPath) path).clearCache();\n            byteChannel = newByteChannel(path,\n                                         buildOptions(options,\n                                                      TRUNCATE_EXISTING),\n                                         attrs);\n        }\n\n        try {\n            byteChannel.write(ByteBuffer.wrap(bytes));\n            byteChannel.close();\n        } catch (final java.io.IOException e) {\n            throw new IOException(e);\n        }\n\n        return path;\n    }\n\n    protected abstract Set<? extends OpenOption> buildOptions(final Set<? extends OpenOption> options,\n                                                              final OpenOption... other);\n\n    private String sanitizeContent(final String content) {\n        Matcher m = pattern.matcher(content);\n        if (m.matches()) {\n            return m.replaceAll(\"\");\n        }\n        return content;\n    }\n\n    @Override\n    public String getId() {\n        return id;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/impl/IOServiceDotFileImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport java.lang.reflect.Constructor;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.IOWatchService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AttrHolder;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.base.Properties;\nimport org.uberfire.java.nio.base.dotfiles.DotFileOption;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.buildDotFile;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.consolidate;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.dot;\nimport static org.uberfire.java.nio.file.StandardCopyOption.REPLACE_EXISTING;\n\npublic class IOServiceDotFileImpl\n        extends AbstractIOService\n        implements IOService {\n\n    public IOServiceDotFileImpl() {\n        super();\n    }\n\n    public IOServiceDotFileImpl(final String serviceId) {\n        super(serviceId);\n    }\n\n    public IOServiceDotFileImpl(final IOWatchService watchService) {\n        super(watchService);\n    }\n\n    public IOServiceDotFileImpl(final String serviceId,\n                                final IOWatchService watchService) {\n        super(serviceId,\n              watchService);\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options)\n            throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException,\n            IOException, SecurityException {\n        Files.delete(path,\n                     options);\n        try {\n            Files.deleteIfExists(dot(path),\n                                 options);\n        } catch (Exception ex) {\n        }\n        if (path instanceof AttrHolder) {\n            ((AttrHolder) path).getAttrStorage().clear();\n        }\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path,\n                                  final DeleteOption... options)\n            throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        final boolean result = Files.deleteIfExists(path,\n                                                    options);\n        try {\n            Files.deleteIfExists(dot(path),\n                                 options);\n        } catch (Exception ex) {\n        }\n        if (path instanceof AttrHolder) {\n            ((AttrHolder) path).getAttrStorage().clear();\n        }\n        return result;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final Set<? extends OpenOption> options,\n                                              final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        final Properties properties = new Properties();\n        if (exists(dot(path))) {\n            properties.load(newInputStream(dot(path)));\n        }\n        final FileAttribute<?>[] allAttrs = consolidate(properties,\n                                                        attrs);\n\n        final SeekableByteChannel result = Files.newByteChannel(path,\n                                                                buildOptions(options),\n                                                                allAttrs);\n\n        if (isFileScheme(path)) {\n            buildDotFile(path,\n                         newOutputStream(dot(path)),\n                         allAttrs);\n        }\n\n        return result;\n    }\n\n    @Override\n    public Path createDirectory(final Path dir,\n                                final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        return internalCreateDirectory(dir,\n                                       false,\n                                       attrs);\n    }\n\n    @Override\n    public Path createDirectories(final Path dir,\n                                  final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        final Path result = Files.createDirectories(dir,\n                                                    attrs);\n\n        buildDotFile(dir,\n                     newOutputStream(dot(dir)),\n                     attrs);\n\n        return result;\n    }\n\n    @Override\n    public Path copy(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, IOException, SecurityException {\n        if (Files.exists(dot(source))) {\n            Files.copy(dot(source),\n                       dot(target),\n                       forceBuildOptions(options));\n        } else if (Files.exists(dot(target))) {\n            Files.delete(dot(target));\n        }\n\n        final Path result = Files.copy(source,\n                                       target,\n                                       options);\n\n        return result;\n    }\n\n    @Override\n    public Path move(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        if (Files.exists(dot(source))) {\n            Files.move(dot(source),\n                       dot(target),\n                       forceBuildOptions(options));\n        } else if (Files.exists(dot(target))) {\n            Files.delete(dot(target));\n        }\n\n        final Path result = Files.move(source,\n                                       target,\n                                       options);\n\n        return result;\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                                final Class<V> type)\n            throws IllegalArgumentException {\n\n        final V value = Files.getFileAttributeView(path,\n                                                   type);\n\n        if (value == null && path instanceof AttrHolder) {\n            final AttrHolder holder = ((AttrHolder) path);\n            final V holderView = holder.getAttrView(type);\n            if (holderView == null && AbstractBasicFileAttributeView.class.isAssignableFrom(type)) {\n                return (V) newView(holder,\n                                   (Class<? extends AbstractBasicFileAttributeView>) type);\n            }\n            return holderView;\n        }\n\n        return value;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path,\n                                              final String attributes)\n            throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException,\n            IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attributes);\n\n        final Properties original = new Properties(Files.readAttributes(path,\n                                                                        attributes));\n        if (attributes.equals(\"*\") && exists(dot(path))) {\n            boolean isAttrHolder = path instanceof AttrHolder;\n            if (isAttrHolder && ((AttrHolder) path).getAttrStorage().getContent().size() > 0) {\n                return ((AttrHolder) path).getAttrStorage().getAllContent();\n            }\n            final Properties content = new Properties();\n            content.load(newInputStream(dot(path)));\n            content.putAll(original);\n\n            if (isAttrHolder) {\n                ((AttrHolder) path).getAttrStorage().loadContent(content);\n            }\n            return content;\n        }\n\n        return original;\n    }\n\n    @Override\n    public Path setAttributes(final Path path,\n                              final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        if (Files.isDirectory(path)) {\n            return internalCreateDirectory(path,\n                                           true,\n                                           attrs);\n        }\n        return write(path,\n                     readAllBytes(path),\n                     Collections.<OpenOption>emptySet(),\n                     attrs);\n    }\n\n    @Override\n    public Object getAttribute(final Path path,\n                               final String attribute)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        Object value;\n        try {\n            value = Files.getAttribute(path,\n                                       attribute);\n        } catch (UnsupportedOperationException ex) {\n            value = null;\n        }\n\n        if (value == null && path instanceof AttrHolder) {\n            final AttrHolder holder = ((AttrHolder) path);\n            final String[] attr = split(attribute);\n            if (holder.getAttrStorage().getContent().isEmpty()) {\n                loadDotFile(path);\n            }\n            return holder.getAttrStorage().getAllContent().get(attr[1]);\n        }\n\n        return value;\n    }\n\n    @Override\n    protected Set<? extends OpenOption> buildOptions(final Set<? extends OpenOption> options,\n                                                     final OpenOption... others) {\n        return new HashSet<OpenOption>(options) {{\n            add(new DotFileOption());\n            if (others != null) {\n                for (final OpenOption other : others) {\n                    add(other);\n                }\n            }\n        }};\n    }\n\n    protected CopyOption[] buildOptions(final CopyOption... options) {\n        final CopyOption[] result = new CopyOption[options.length + 1];\n        System.arraycopy(options,\n                         0,\n                         result,\n                         0,\n                         options.length);\n        result[result.length - 1] = new DotFileOption();\n        return result;\n    }\n\n    protected CopyOption[] forceBuildOptions(final CopyOption[] options) {\n        final CopyOption[] result = new CopyOption[options.length + 1];\n        System.arraycopy(options,\n                         0,\n                         result,\n                         0,\n                         options.length);\n        result[result.length - 1] = REPLACE_EXISTING;\n        return result;\n    }\n\n    protected boolean isFileScheme(final Path path) {\n        if (path == null || path.getFileSystem() == null || path.getFileSystem().provider() == null) {\n            return false;\n        }\n\n        return path.getFileSystem().provider().getScheme().equals(\"file\");\n    }\n\n    protected void loadDotFile(final Path path) {\n        final Properties content = new Properties();\n        content.load(newInputStream(dot(path)));\n\n        if (path instanceof AttrHolder) {\n            ((AttrHolder) path).getAttrStorage().loadContent(content);\n        }\n    }\n\n    protected <V extends AbstractBasicFileAttributeView> V newView(final AttrHolder holder,\n                                                                   final Class<V> type) {\n        if (NeedsPreloadedAttrs.class.isAssignableFrom(type) && holder.getAttrStorage().getContent().size() == 0) {\n            readAttributes((Path) holder);\n        }\n\n        try {\n            final Constructor<V> constructor = (Constructor<V>) type.getConstructors()[0];\n            final V view = constructor.newInstance(holder);\n            holder.addAttrView(view);\n            return view;\n        } catch (final Exception e) {\n        }\n        return null;\n    }\n\n    protected Path internalCreateDirectory(final Path dir,\n                                           final boolean skipAlreadyExistsException,\n                                           final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n        FileAttribute<?>[] allAttrs = attrs;\n        try {\n            Files.createDirectory(dir,\n                                  attrs);\n        } catch (final FileAlreadyExistsException ex) {\n            final Properties properties = new Properties();\n            if (exists(dot(dir))) {\n                properties.load(newInputStream(dot(dir)));\n            }\n            allAttrs = consolidate(properties,\n                                   attrs);\n            if (!skipAlreadyExistsException) {\n                throw ex;\n            }\n        }\n\n        buildDotFile(dir,\n                     newOutputStream(dot(dir)),\n                     allAttrs);\n\n        return dir;\n    }\n\n    protected String[] split(final String attribute) {\n        final String[] s = new String[2];\n        final int pos = attribute.indexOf(':');\n        if (pos == -1) {\n            s[0] = \"basic\";\n            s[1] = attribute;\n        } else {\n            s[0] = attribute.substring(0,\n                                       pos);\n            s[1] = (pos == attribute.length()) ? \"\" : attribute.substring(pos + 1);\n        }\n        return s;\n    }\n\n    @Override\n    public int priority() {\n        return 10;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/impl/IOServiceIdentifiable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport org.uberfire.io.IOService;\n\npublic interface IOServiceIdentifiable extends IOService {\n\n    String getId();\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/impl/IOServiceLockable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport org.uberfire.io.lock.BatchLockControl;\n\npublic interface IOServiceLockable extends IOServiceIdentifiable {\n\n    BatchLockControl getLockControl();\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/impl/IOServiceNio2WrapperImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.IOWatchService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\npublic class IOServiceNio2WrapperImpl\n        extends AbstractIOService\n        implements IOService {\n\n    public IOServiceNio2WrapperImpl() {\n        super();\n    }\n\n    public IOServiceNio2WrapperImpl(final String id) {\n        super(id);\n    }\n\n    public IOServiceNio2WrapperImpl(final IOWatchService watchService) {\n        super(watchService);\n    }\n\n    public IOServiceNio2WrapperImpl(final String id,\n                                    final IOWatchService watchService) {\n        super(id,\n              watchService);\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options)\n            throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException,\n            IOException, SecurityException {\n        Files.delete(path,\n                     options);\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path,\n                                  final DeleteOption... options)\n            throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        return Files.deleteIfExists(path,\n                                    options);\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final Set<? extends OpenOption> options,\n                                              final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return Files.newByteChannel(path,\n                                    options,\n                                    attrs);\n    }\n\n    @Override\n    public Path createDirectory(final Path dir,\n                                final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        return Files.createDirectory(dir,\n                                     attrs);\n    }\n\n    @Override\n    public Path createDirectories(final Path dir,\n                                  final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        return Files.createDirectories(dir,\n                                       attrs);\n    }\n\n    @Override\n    public Path copy(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, IOException, SecurityException {\n        return Files.copy(source,\n                          target,\n                          options);\n    }\n\n    @Override\n    public Path move(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        return Files.move(source,\n                          target,\n                          options);\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                                final Class<V> type)\n            throws IllegalArgumentException {\n        return Files.getFileAttributeView(path,\n                                          type);\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path,\n                                              final String attributes)\n            throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException,\n            IOException, SecurityException {\n        return Files.readAttributes(path,\n                                    attributes);\n    }\n\n    @Override\n    public Path setAttributes(final Path path,\n                              final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, IllegalArgumentException, ClassCastException,\n            IOException, SecurityException {\n        Path out = null;\n        for (final FileAttribute<?> attr : attrs) {\n            out = Files.setAttribute(path,\n                                     attr.name(),\n                                     attr.value());\n        }\n        return out;\n    }\n\n    @Override\n    public Object getAttribute(final Path path,\n                               final String attribute)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        return Files.getAttribute(path,\n                                  attribute);\n    }\n\n    @Override\n    protected Set<? extends OpenOption> buildOptions(final Set<? extends OpenOption> options,\n                                                     final OpenOption... others) {\n        return new HashSet<OpenOption>(options) {{\n            if (others != null) {\n                for (final OpenOption other : others) {\n                    add(other);\n                }\n            }\n        }};\n    }\n\n    @Override\n    public int priority() {\n        return 10;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/lock/BatchLockControl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.lock;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\nimport java.util.concurrent.locks.ReentrantLock;\n\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.LockableFileSystem;\n\npublic class BatchLockControl {\n\n    private ReentrantLock lock = new ReentrantLock(true);\n    private FileSystem fileSystemOnBatch;\n\n    public void lock(final FileSystem fs) {\n        checkNotNull(\"fs\", fs);\n        lock.lock();\n        try{\n            makeSureThatIsOnlyOneFSOnCurrentBatch(fs);\n\n            if (!isAlreadyOnBatch(fs)) {\n                if (isLockable(fs)) {\n                    fileSystemOnBatch = fs;\n                    ((LockableFileSystem) fs).lock();\n                } else {\n                    throw new BatchRuntimeException(\"Not a LockableFileSystem : \"\n                            + fs.toString());\n                }\n            }\n        }\n        catch (BatchRuntimeException e){\n            lock.unlock();\n            throw e;\n        }\n    }\n\n    private void makeSureThatIsOnlyOneFSOnCurrentBatch(FileSystem fs) {\n        if (fileSystemOnBatch != null && !fileSystemOnBatch.equals(fs)) {\n            throw new BatchRuntimeException(\"We already have a batch process running on another FS : \"\n                                                    + fileSystemOnBatch.toString());\n        }\n    }\n\n    private boolean isAlreadyOnBatch(FileSystem fileSystem) {\n        return fileSystemOnBatch != null && fileSystemOnBatch.equals(fileSystem);\n    }\n\n    public void unlock() {\n        if (lock.isLocked()) {\n            if (shouldUnlockLockedFileSystems()) {\n                ((LockableFileSystem) fileSystemOnBatch).unlock();\n                fileSystemOnBatch = null;\n            }\n            lock.unlock();\n        }\n    }\n\n    private boolean shouldUnlockLockedFileSystems() {\n        return lock.getHoldCount() == 1 && fileSystemOnBatch != null && isLockable(fileSystemOnBatch);\n    }\n\n    private boolean isLockable(FileSystem fileSystem) {\n        return fileSystem instanceof LockableFileSystem;\n    }\n\n    public boolean isLocked() {\n        return lock.isLocked();\n    }\n\n    public int getHoldCount() {\n        return lock.getHoldCount();\n    }\n\n    public FileSystem getFileSystemOnBatch() {\n        return fileSystemOnBatch;\n    }\n\n    public class BatchRuntimeException extends RuntimeException {\n\n        public BatchRuntimeException(String message) {\n            super(message);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/java/org/uberfire/io/regex/AntPathMatcher.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.regex;\n\nimport java.net.URI;\nimport java.util.Collection;\n\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic final class AntPathMatcher {\n\n    private static final String PATTERNS = \"patterns\";\n    private static org.uberfire.commons.regex.util.AntPathMatcher matcher = new org.uberfire.commons.regex.util.AntPathMatcher();\n\n    public static boolean filter(final Collection<String> includes,\n                                 final Collection<String> excludes,\n                                 final Path path) {\n        checkNotNull(\"includes\",\n                     includes);\n        checkNotNull(\"excludes\",\n                     excludes);\n        checkNotNull(\"path\",\n                     path);\n        if (includes.isEmpty() && excludes.isEmpty()) {\n            return true;\n        } else if (includes.isEmpty()) {\n            return !(excludes(excludes,\n                              path));\n        } else if (excludes.isEmpty()) {\n            return includes(includes,\n                            path);\n        }\n        return includes(includes,\n                        path) && !(excludes(excludes,\n                                            path));\n    }\n\n    public static boolean filter(final Collection<String> includes,\n                                 final Collection<String> excludes,\n                                 final URI uri) {\n        checkNotNull(\"includes\",\n                     includes);\n        checkNotNull(\"excludes\",\n                     excludes);\n        checkNotNull(\"uri\",\n                     uri);\n        if (includes.isEmpty() && excludes.isEmpty()) {\n            return true;\n        } else if (includes.isEmpty()) {\n            return !(excludes(excludes,\n                              uri));\n        } else if (excludes.isEmpty()) {\n            return includes(includes,\n                            uri);\n        }\n        return includes(includes,\n                        uri) && !(excludes(excludes,\n                                           uri));\n    }\n\n    public static boolean includes(final Collection<String> patterns,\n                                   final Path path) {\n        checkNotNull(PATTERNS,\n                     patterns);\n        checkNotNull(\"path\",\n                     path);\n        return matches(patterns,\n                       path);\n    }\n\n    public static boolean includes(final Collection<String> patterns,\n                                   final URI uri) {\n        checkNotNull(PATTERNS,\n                     patterns);\n        checkNotNull(\"uri\",\n                     uri);\n        return matches(patterns,\n                       uri);\n    }\n\n    public static boolean excludes(final Collection<String> patterns,\n                                   final URI uri) {\n        checkNotNull(PATTERNS,\n                     patterns);\n        checkNotNull(\"uri\",\n                     uri);\n        return matches(patterns,\n                       uri);\n    }\n\n    public static boolean excludes(final Collection<String> patterns,\n                                   final Path path) {\n        checkNotNull(PATTERNS,\n                     patterns);\n        checkNotNull(\"path\",\n                     path);\n        return matches(patterns,\n                       path);\n    }\n\n    private static boolean matches(final Collection<String> patterns,\n                                   final Path path) {\n        return matches(patterns,\n                       path.toUri());\n    }\n\n    private static boolean matches(final Collection<String> patterns,\n                                   final URI uri) {\n        for (final String pattern : patterns) {\n            if (matcher.match(pattern,\n                              uri.toString())) {\n                return true;\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/main/resources/org/uberfire/io/UberfireIO.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <source path='FileSystemType.java'/>\n\n</module>"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/CommonIOExceptionsServiceDotFileTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n *\n */\npublic abstract class CommonIOExceptionsServiceDotFileTest extends CommonIOServiceDotFileTest {\n\n    @Test(expected = NoSuchFileException.class)\n    public void deleteNoSuchFileException() {\n        final Path path = getFilePath();\n        ioService().deleteIfExists(path);\n\n        ioService().delete(path);\n    }\n\n    @Test(expected = DirectoryNotEmptyException.class)\n    public void deleteDirectoryNotEmptyException() {\n        final Path path = getDirectoryPath().resolveSibling(\"dirToBug\");\n\n        ioService().createDirectories(path);\n\n        ioService().write(path.resolve(\"myFile.txt\"),\n                          \"ooooo!\");\n\n        ioService().delete(path);\n    }\n\n    @Test(expected = DirectoryNotEmptyException.class)\n    public void deleteIfExistsDirectoryNotEmptyException() {\n        final Path path = getDirectoryPath().resolveSibling(\"dirToBugIfExists\");\n\n        ioService().createDirectories(path);\n\n        ioService().write(path.resolve(\"myFile.txt\"),\n                          \"ooooo!\");\n\n        ioService().deleteIfExists(path);\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void newByteChannelFileAlreadyExistsException() {\n        final Path path = getFilePath().resolveSibling(\"alreadyExists.txt\");\n\n        ioService().deleteIfExists(path);\n\n        ioService().write(path,\n                          \"ooooo!\");\n\n        ioService().newByteChannel(path);\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void createDirectoryFileAlreadyExistsException() {\n        final Path path = getDirectoryPath().resolveSibling(\"otherDir\");\n\n        ioService().deleteIfExists(path);\n\n        ioService().createDirectory(path);\n\n        ioService().createDirectory(path);\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void createDirectoriesFileAlreadyExistsException() {\n        final Path path = getDirectoryPath().resolveSibling(\"otherDir\").resolve(\"innerDir\");\n\n        ioService().deleteIfExists(path);\n\n        ioService().createDirectories(path);\n\n        ioService().createDirectories(path);\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void copyFileAlreadyExistsException() {\n        final Path path = getDirectoryPath().resolveSibling(\"alreadyExistsTest\");\n\n        ioService().deleteIfExists(path);\n        ioService().createDirectories(path);\n\n        ioService().write(path.resolve(\"myFile.txt\"),\n                          \"ooooo!\");\n        ioService().write(path.resolve(\"mytarget\"),\n                          \"xooooo!\");\n\n        ioService().copy(path.resolve(\"myFile.txt\"),\n                         path.resolve(\"mytarget\"));\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void readAttributesNoSuchFileException() {\n        final Path path = getDirectoryPath().resolveSibling(\"somethingXXX\");\n\n        ioService().deleteIfExists(path);\n\n        ioService().readAttributes(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/CommonIOServiceDotFileTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.ByteBuffer;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.AttrHolder;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardOpenOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.dot;\n\n/**\n *\n */\npublic abstract class CommonIOServiceDotFileTest {\n\n    protected static final List<File> tempFiles = new ArrayList<File>();\n    protected static IOService ioService = null;\n    protected final Date dateValue = new Date();\n\n    public static File createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        tempFiles.add(temp);\n\n        return temp;\n    }\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n\n    @Test\n    public void testFile() throws IOException {\n        final Path path = getFilePath();\n        ioService().write(path,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          },\n                          new FileAttribute<String>() {\n                              @Override\n                              public String name() {\n                                  return \"int.hello\";\n                              }\n\n                              @Override\n                              public String value() {\n                                  return \"world\";\n                              }\n                          },\n                          new FileAttribute<Integer>() {\n                              @Override\n                              public String name() {\n                                  return \"int\";\n                              }\n\n                              @Override\n                              public Integer value() {\n                                  return 10;\n                              }\n                          }\n        );\n\n        Map<String, Object> attrs = ioService().readAttributes(path);\n\n        assertEquals(testFileAttrSize1(),\n                     attrs.size());\n        assertTrue(attrs.containsKey(\"int.hello\"));\n        assertTrue(attrs.containsKey(\"custom\"));\n        assertTrue(attrs.containsKey(\"int\"));\n\n        assertEquals(10,\n                     attrs.get(\"int\"));\n        assertEquals(dateValue,\n                     attrs.get(\"custom\"));\n        assertEquals(\"world\",\n                     attrs.get(\"int.hello\"));\n\n        if (path instanceof AttrHolder) {\n            ((AttrHolder) path).getAttrStorage().clear();\n        }\n\n        attrs = ioService().readAttributes(path);\n\n        assertEquals(10,\n                     attrs.get(\"int\"));\n        assertEquals(dateValue,\n                     attrs.get(\"custom\"));\n        assertEquals(\"world\",\n                     attrs.get(\"int.hello\"));\n\n        final Map<String, Object> attrsValue = ioService().readAttributes(path);\n\n        assertEquals(testFileAttrSize2(),\n                     attrsValue.size());\n\n        ioService().setAttributes(path,\n                                  new FileAttribute<Object>() {\n                                      @Override\n                                      public String name() {\n                                          return \"my_new_key\";\n                                      }\n\n                                      @Override\n                                      public Object value() {\n                                          return null;\n                                      }\n                                  });\n\n        final Map<String, Object> attrsValue2 = ioService().readAttributes(path);\n\n        assertEquals(testFileAttrSize3(),\n                     attrsValue2.size());\n        assertFalse(attrsValue2.containsKey(\"my_new_key\"));\n\n        ioService().delete(path);\n\n        ioService().write(path,\n                          \"ooooo!\");\n\n        final Map<String, Object> attrsClean = ioService().readAttributes(path);\n\n        assertEquals(testFileAttrSize4(),\n                     attrsClean.size());\n    }\n\n    protected abstract int testFileAttrSize4();\n\n    protected abstract int testFileAttrSize3();\n\n    protected abstract int testFileAttrSize2();\n\n    protected abstract int testFileAttrSize1();\n\n    @Test\n    public void testDirectory() throws IOException {\n        final Path path = getDirectoryPath();\n        ioService().createDirectory(path,\n                                    new FileAttribute<Object>() {\n                                        @Override\n                                        public String name() {\n                                            return \"custom\";\n                                        }\n\n                                        @Override\n                                        public Object value() {\n                                            return dateValue;\n                                        }\n                                    },\n                                    new FileAttribute<String>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int.hello\";\n                                        }\n\n                                        @Override\n                                        public String value() {\n                                            return \"world\";\n                                        }\n                                    },\n                                    new FileAttribute<Integer>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int\";\n                                        }\n\n                                        @Override\n                                        public Integer value() {\n                                            return 10;\n                                        }\n                                    }\n        );\n\n        Map<String, Object> attrs = ioService().readAttributes(path);\n\n        assertEquals(testDirectoryAttrSize1(),\n                     attrs.size());\n        assertTrue(attrs.containsKey(\"int.hello\"));\n        assertTrue(attrs.containsKey(\"custom\"));\n        assertTrue(attrs.containsKey(\"int\"));\n\n        assertEquals(10,\n                     attrs.get(\"int\"));\n        assertEquals(dateValue,\n                     attrs.get(\"custom\"));\n        assertEquals(\"world\",\n                     attrs.get(\"int.hello\"));\n\n        if (path instanceof AttrHolder) {\n            ((AttrHolder) path).getAttrStorage().clear();\n        }\n\n        attrs = ioService().readAttributes(path);\n\n        assertEquals(10,\n                     attrs.get(\"int\"));\n        assertEquals(dateValue,\n                     attrs.get(\"custom\"));\n        assertEquals(\"world\",\n                     attrs.get(\"int.hello\"));\n\n        ioService().delete(path);\n\n        ioService().createDirectory(path);\n\n        final Map<String, Object> attrsClean = ioService().readAttributes(path);\n\n        assertEquals(testDirectoryAttrSize4(),\n                     attrsClean.size());\n    }\n\n    protected abstract int testDirectoryAttrSize4();\n\n    protected abstract int testDirectoryAttrSize3();\n\n    protected abstract int testDirectoryAttrSize2();\n\n    protected abstract int testDirectoryAttrSize1();\n\n    @Test\n    public void testDelete() throws IOException {\n        final Path dir = getDirectoryPath();\n\n        ioService().createDirectory(dir,\n                                    new FileAttribute<Object>() {\n                                        @Override\n                                        public String name() {\n                                            return \"custom\";\n                                        }\n\n                                        @Override\n                                        public Object value() {\n                                            return dateValue;\n                                        }\n                                    },\n                                    new FileAttribute<String>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int.hello\";\n                                        }\n\n                                        @Override\n                                        public String value() {\n                                            return \"world\";\n                                        }\n                                    },\n                                    new FileAttribute<Integer>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int\";\n                                        }\n\n                                        @Override\n                                        public Integer value() {\n                                            return 10;\n                                        }\n                                    }\n        );\n        assertTrue(ioService().exists(dir));\n        assertTrue(ioService().exists(dot(dir)));\n\n        ioService().delete(dir);\n\n        assertFalse(ioService().exists(dir));\n        assertFalse(ioService().exists(dot(dir)));\n\n        final Path file = getFilePath();\n\n        ioService().write(file,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          });\n\n        assertTrue(ioService().exists(file));\n        assertTrue(ioService().exists(dot(file)));\n\n        assertFalse(((AttrHolder) file).getAttrStorage().getContent().isEmpty());\n\n        ioService().delete(file);\n\n        assertTrue(((AttrHolder) file).getAttrStorage().getContent().isEmpty());\n\n        assertFalse(ioService().exists(file));\n        assertFalse(ioService().exists(dot(file)));\n    }\n\n    @Test\n    public void testCopyFile() {\n        final Path sfile = getFilePath();\n        final Path tfile = getTargetPath();\n\n        ioService().deleteIfExists(sfile);\n        ioService().deleteIfExists(tfile);\n\n        ioService().write(sfile,\n                          \"wow\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          });\n\n        assertTrue(ioService().exists(sfile));\n        assertTrue(ioService().exists(dot(sfile)));\n        assertFalse(ioService().exists(tfile));\n        assertFalse(ioService().exists(dot(tfile)));\n\n        ioService().copy(sfile,\n                         tfile);\n\n        assertTrue(ioService().exists(sfile));\n        assertTrue(ioService().exists(dot(sfile)));\n        assertTrue(ioService().exists(tfile));\n        assertTrue(ioService().exists(dot(tfile)));\n    }\n\n    @Test\n    public void createDirectories() {\n        final Path dir = getComposedDirectoryPath();\n\n        assertFalse(ioService().exists(dir));\n\n        ioService().createDirectories(dir,\n                                      new FileAttribute<Object>() {\n                                          @Override\n                                          public String name() {\n                                              return \"custom\";\n                                          }\n\n                                          @Override\n                                          public Object value() {\n                                              return dateValue;\n                                          }\n                                      });\n\n        assertTrue(ioService().exists(dir));\n\n        assertTrue(ioService().exists(dir.getParent()));\n        assertNotNull(ioService().exists(dir.getParent().getFileName()));\n\n        Map<String, Object> attrs = ioService().readAttributes(dir);\n\n        assertEquals(createDirectoriesAttrSize(),\n                     attrs.size());\n\n        ioService().delete(dir);\n\n        ioService().exists(dir.getParent());\n    }\n\n    protected abstract int createDirectoriesAttrSize();\n\n    @Test\n    public void testDeleteIfExistis() throws IOException {\n        final Path dir = getDirectoryPath();\n\n        ioService().deleteIfExists(dir);\n\n        ioService().createDirectory(dir,\n                                    new FileAttribute<Object>() {\n                                        @Override\n                                        public String name() {\n                                            return \"custom\";\n                                        }\n\n                                        @Override\n                                        public Object value() {\n                                            return dateValue;\n                                        }\n                                    },\n                                    new FileAttribute<String>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int.hello\";\n                                        }\n\n                                        @Override\n                                        public String value() {\n                                            return \"world\";\n                                        }\n                                    },\n                                    new FileAttribute<Integer>() {\n                                        @Override\n                                        public String name() {\n                                            return \"int\";\n                                        }\n\n                                        @Override\n                                        public Integer value() {\n                                            return 10;\n                                        }\n                                    }\n        );\n\n        assertTrue(ioService().deleteIfExists(dir));\n        assertFalse(ioService().deleteIfExists(dir));\n\n        final Path file = getFilePath();\n\n        ioService().deleteIfExists(file);\n\n        ioService().write(file,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"custom\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return dateValue;\n                              }\n                          });\n\n        assertFalse(((AttrHolder) file).getAttrStorage().getContent().isEmpty());\n\n        assertTrue(ioService().deleteIfExists(file));\n\n        assertTrue(((AttrHolder) file).getAttrStorage().getContent().isEmpty());\n\n        assertFalse(ioService().deleteIfExists(file));\n    }\n\n    @Test\n    public void testReadNewByteChannel() throws IOException {\n        final Path file = getFilePath();\n        ioService().deleteIfExists(file);\n        assertFalse(ioService().exists(file));\n        String content = \"sample content\";\n        ioService.write(file,\n                        content);\n        assertTrue(ioService().exists(file));\n\n        final SeekableByteChannel sbc = ioService().newByteChannel(file,\n                                                                   StandardOpenOption.READ);\n        String readContent = readSbc(sbc);\n        sbc.close();\n\n        assertEquals(content,\n                     readContent);\n\n        ioService().delete(file);\n    }\n\n    @Test\n    public void testNewByteChannel() throws IOException {\n        final Path file = getFilePath();\n\n        ioService().deleteIfExists(file);\n\n        assertFalse(ioService().exists(file));\n\n        final SeekableByteChannel sbc = ioService().newByteChannel(file,\n                                                                   Collections.<OpenOption>emptySet(),\n                                                                   new FileAttribute<Object>() {\n                                                                       @Override\n                                                                       public String name() {\n                                                                           return \"custom\";\n                                                                       }\n\n                                                                       @Override\n                                                                       public Object value() {\n                                                                           return dateValue;\n                                                                       }\n                                                                   });\n\n        sbc.write(ByteBuffer.wrap(\"helloWorld!\".getBytes()));\n        sbc.close();\n\n        assertTrue(ioService().exists(file));\n\n        Map<String, Object> attrs = ioService().readAttributes(file);\n\n        assertEquals(testNewByteChannelAttrSize(),\n                     attrs.size());\n\n        try {\n            ioService().newByteChannel(file,\n                                       Collections.<OpenOption>emptySet());\n            fail(\"FileAlreadyExistsException expected\");\n        } catch (FileAlreadyExistsException ex) {\n        }\n\n        ioService().delete(file);\n\n        ioService().newByteChannel(file,\n                                   Collections.<OpenOption>emptySet()).close();\n\n        assertTrue(ioService().deleteIfExists(file));\n    }\n\n    protected abstract int testNewByteChannelAttrSize();\n\n    @Test\n    public void testGetAttribute() {\n        final Path file = getFilePath();\n\n        ioService().deleteIfExists(file);\n\n        ioService().write(file,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.author\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"AuthorName\";\n                              }\n                          });\n\n        assertNotNull(ioService().getAttribute(file,\n                                               \"dcore:dcore.author\"));\n        assertNull(ioService().getAttribute(file,\n                                            \"dcore:dcore.not_here\"));\n        assertNotNull(ioService().getAttribute(file,\n                                               \"dcore.author\"));\n        assertNull(ioService().getAttribute(file,\n                                            \"something\"));\n\n        ((AttrHolder) file).getAttrStorage().clear();\n\n        assertNotNull(ioService().getAttribute(file,\n                                               \"dcore:dcore.author\"));\n        assertNull(ioService().getAttribute(file,\n                                            \"dcore:dcore.not_here\"));\n        assertNotNull(ioService().getAttribute(file,\n                                               \"dcore.author\"));\n        assertNull(ioService().getAttribute(file,\n                                            \"something\"));\n    }\n\n    @Test\n    public void testGetAttributeView() {\n        final Path file = getFilePath();\n\n        ioService().deleteIfExists(file);\n\n        ioService().write(file,\n                          \"ooooo!\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.author\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"AuthorName\";\n                              }\n                          });\n\n        assertNotNull(ioService().getFileAttributeView(file,\n                                                       BasicFileAttributeView.class));\n        assertNull(ioService().getFileAttributeView(file,\n                                                    MyAttrsView.class));\n        assertNotNull(ioService().getFileAttributeView(file,\n                                                       XDublinCoreView.class));\n\n        final DublinCoreAttributes attr = ioService().getFileAttributeView(file,\n                                                                           XDublinCoreView.class).readAttributes();\n        assertEquals(\"AuthorName\",\n                     attr.getAuthor());\n\n        ((AttrHolder) file).getAttrStorage().clear();\n\n        assertNotNull(ioService().getFileAttributeView(file,\n                                                       BasicFileAttributeView.class));\n        assertNull(ioService().getFileAttributeView(file,\n                                                    MyAttrsView.class));\n        assertNotNull(ioService().getFileAttributeView(file,\n                                                       XDublinCoreView.class));\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void testReadAllStringFromUnexistentFile() {\n        String content = ioService().readAllString(getFilePath());\n    }\n\n    @Test\n    public void testReadAllStringFromEmptyFile() {\n        final Path filePath = getFilePath();\n        ioService().createFile(filePath);\n\n        String content = ioService().readAllString(filePath);\n\n        assertEquals(\"\",\n                     content);\n    }\n\n    @Test\n    public void testReadAllStringFromExistentFile() {\n        final Path filePath = getFilePath();\n        ioService().createFile(filePath);\n        ioService().write(filePath,\n                          \"text\");\n\n        String content = ioService().readAllString(filePath);\n\n        assertEquals(\"text\",\n                     content);\n    }\n\n    public abstract Path getFilePath();\n\n    public abstract Path getTargetPath();\n\n    public abstract Path getDirectoryPath();\n\n    public abstract Path getComposedDirectoryPath();\n\n    private String readSbc(SeekableByteChannel sbc) {\n        ByteBuffer byteBuffer = ByteBuffer.allocate(100);\n        StringBuilder content = new StringBuilder();\n        byteBuffer.clear();\n        try {\n            while ((sbc.read(byteBuffer)) > 0) {\n                byteBuffer.flip();\n                content.append(new String(byteBuffer.array(),\n                                          0,\n                                          byteBuffer.remaining()));\n                byteBuffer.compact();\n            }\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n        return content.toString();\n    }\n\n    public IOService ioService() {\n        if (ioService == null) {\n            ioService = new IOServiceDotFileImpl();\n            assertTrue(PriorityDisposableRegistry.getDisposables().contains(ioService));\n        }\n        return ioService;\n    }\n\n    private static interface MyAttrsView extends BasicFileAttributeView {\n\n    }\n\n    public static class XDublinCoreView extends AbstractBasicFileAttributeView<AbstractPath>\n            implements NeedsPreloadedAttrs {\n\n        private BasicFileAttributes attrs = null;\n\n        public XDublinCoreView(final AbstractPath path) {\n            super(path);\n        }\n\n        @Override\n        public <T extends BasicFileAttributes> T readAttributes() throws org.uberfire.java.nio.IOException {\n            if (attrs == null) {\n                final BasicFileAttributes basicAtts = ((BasicFileAttributeView) path.getAttrView(BasicFileAttributeView.class)).readAttributes();\n                attrs = new DublinCoreAttributes(basicAtts,\n                                                 (String) path.getAttrStorage().getContent().get(\"dcore.author\"));\n            }\n            return (T) attrs;\n        }\n\n        @Override\n        public Class<? extends BasicFileAttributeView>[] viewTypes() {\n            return new Class[]{XDublinCoreView.class};\n        }\n    }\n\n    public static class DublinCoreAttributes implements BasicFileAttributes {\n\n        private final BasicFileAttributes attributes;\n        private final String author;\n\n        private DublinCoreAttributes(final BasicFileAttributes attributes,\n                                     final String author) {\n            this.attributes = attributes;\n            this.author = author;\n        }\n\n        public String getAuthor() {\n            return author;\n        }\n\n        @Override\n        public FileTime lastModifiedTime() {\n            return attributes.lastModifiedTime();\n        }\n\n        @Override\n        public FileTime lastAccessTime() {\n            return attributes.lastAccessTime();\n        }\n\n        @Override\n        public FileTime creationTime() {\n            return attributes.creationTime();\n        }\n\n        @Override\n        public boolean isRegularFile() {\n            return attributes.isRegularFile();\n        }\n\n        @Override\n        public boolean isDirectory() {\n            return attributes.isDirectory();\n        }\n\n        @Override\n        public boolean isSymbolicLink() {\n            return attributes.isSymbolicLink();\n        }\n\n        @Override\n        public boolean isOther() {\n            return attributes.isOther();\n        }\n\n        @Override\n        public long size() {\n            return attributes.size();\n        }\n\n        @Override\n        public Object fileKey() {\n            return attributes.fileKey();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/GitIOServiceDotFileTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Random;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class GitIOServiceDotFileTest extends CommonIOExceptionsServiceDotFileTest {\n\n    private static boolean created = false;\n\n    @Override\n    protected int testFileAttrSize4() {\n        return 9;\n    }\n\n    @Override\n    protected int testFileAttrSize3() {\n        return 12;\n    }\n\n    @Override\n    protected int testFileAttrSize2() {\n        return 12;\n    }\n\n    @Override\n    protected int testFileAttrSize1() {\n        return 12;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize4() {\n        return 9;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize3() {\n        return 12;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize2() {\n        return 13;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize1() {\n        return 12;\n    }\n\n    @Override\n    protected int createDirectoriesAttrSize() {\n        return 10;\n    }\n\n    @Override\n    protected int testNewByteChannelAttrSize() {\n        return 10;\n    }\n\n    @Test\n    public void testGetFileSystems() {\n\n        final URI newRepo = URI.create(\"git://\" + new Date().getTime() + \"-repo-test\");\n        ioService().newFileSystem(newRepo,\n                                  new HashMap<>());\n\n        final URI newRepo2 = URI.create(\"git://\" + new Date().getTime() + \"-repo2-test\");\n        ioService().newFileSystem(newRepo2,\n                                  new HashMap<>());\n\n        final URI newRepo3 = URI.create(\"git://\" + new Date().getTime() + \"-repo3-test\");\n        ioService().newFileSystem(newRepo3,\n                                  new HashMap<>());\n\n        final Iterator<FileSystemMetadata> iterator = ioService.getFileSystemMetadata().iterator();\n\n        assertNotNull(iterator);\n\n        assertTrue(iterator.hasNext());\n        assertNotNull(iterator.next());\n\n        assertTrue(iterator.hasNext());\n        assertNotNull(iterator.next());\n\n        assertTrue(iterator.hasNext());\n        assertNotNull(iterator.next());\n\n        assertTrue(iterator.hasNext());\n        assertNotNull(iterator.next());\n\n        assertFalse(iterator.hasNext());\n    }\n\n    @Test\n    public void testGetFileSystemInvalidURI() {\n        URI uri = URI.create(\"git://\" + new Date().getTime() + \"-repo-test\");\n        FileSystem fs = ioService().getFileSystem(uri);\n\n        assertNull(fs);\n    }\n\n    @Test(expected = FileSystemAlreadyExistsException.class)\n    public void testCreateFileSystemTwice() {\n        URI uri = URI.create(\"git://\" + new Date().getTime() + \"-repo-test\");\n        ioService().newFileSystem(uri, new HashMap<>());\n        ioService().newFileSystem(uri, new HashMap<>());\n    }\n\n    @Test\n    public void testRoot() throws IOException {\n        final Path path = getRootPath();\n\n        ioService().setAttributes(path,\n                                  new FileAttribute<Object>() {\n                                      @Override\n                                      public String name() {\n                                          return \"my_new_key\";\n                                      }\n\n                                      @Override\n                                      public Object value() {\n                                          return \"value\";\n                                      }\n                                  });\n\n        final Map<String, Object> attrsValue = ioService().readAttributes(path);\n\n        assertEquals(9,\n                     attrsValue.size());\n        assertTrue(attrsValue.containsKey(\"my_new_key\"));\n\n        ioService().setAttributes(path,\n                                  new FileAttribute<Object>() {\n                                      @Override\n                                      public String name() {\n                                          return \"my_new_key\";\n                                      }\n\n                                      @Override\n                                      public Object value() {\n                                          return null;\n                                      }\n                                  });\n\n        final Map<String, Object> attrsValue2 = ioService().readAttributes(path);\n\n        assertEquals(8,\n                     attrsValue2.size());\n        assertFalse(attrsValue2.containsKey(\"my_new_key\"));\n    }\n\n    @Override\n    public Path getFilePath() {\n\n        final Path file = ioService().get(URI.create(\"git://repo-test/myfile\" + new Random(10L).nextInt() + \".txt\"));\n        ioService().deleteIfExists(file);\n\n        return file;\n    }\n\n    @Override\n    public Path getTargetPath() {\n        final Path file = ioService().get(URI.create(\"git://repo-test/myTargetFile\" + new Random(10L).nextInt() + \".txt\"));\n        ioService().deleteIfExists(file);\n\n        return file;\n    }\n\n    @Override\n    public Path getDirectoryPath() {\n        final Path dir = ioService().get(URI.create(\"git://repo-test/someDir\" + new Random(10L).nextInt()));\n        ioService().deleteIfExists(dir);\n\n        return dir;\n    }\n\n    @Override\n    public Path getComposedDirectoryPath() {\n        return ioService().get(URI.create(\"git://repo-test/path/to/someNewRandom\" + new Random(10L).nextInt()));\n    }\n\n    private Path getRootPath() {\n        return ioService().get(URI.create(\"git://repo-test/\"));\n    }\n\n    @Before\n    public void setup() throws IOException {\n        if (!created) {\n            final String path = createTempDirectory().getAbsolutePath();\n            System.setProperty(\"org.uberfire.nio.git.dir\",\n                               path);\n            System.out.println(\".niogit: \" + path);\n\n            final URI newRepo = URI.create(\"git://repo-test\");\n\n            try {\n                ioService().newFileSystem(newRepo,\n                                          new HashMap<>());\n            } catch (final Exception ex) {\n            } finally {\n                created = true;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/OpenCloseTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashMap;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\npublic class OpenCloseTest {\n\n    private static File path = null;\n    final IOService ioService = new IOServiceDotFileImpl();\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        if (path != null) {\n            FileUtils.deleteQuietly(path);\n        }\n    }\n\n    @Before\n    public void setup() throws IOException {\n        assertTrue(PriorityDisposableRegistry.getDisposables().contains(ioService));\n        path = CommonIOServiceDotFileTest.createTempDirectory();\n        System.setProperty(\"org.uberfire.nio.git.dir\",\n                           path.getAbsolutePath());\n        System.out.println(\".niogit: \" + path.getAbsolutePath());\n\n        final URI newRepo = URI.create(\"git://open-close-repo-test\");\n\n        ioService.newFileSystem(newRepo,\n                                new HashMap<String, Object>());\n    }\n\n    @Test\n    public void testOpenCloseFS() throws IOException, InterruptedException {\n        Path init = ioService.get(URI.create(\"git://open-close-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.delete(init.getFileSystem().getPath(null));\n\n        final URI repo = URI.create(\"git://open-close-repo-test\");\n        try {\n            ioService.newFileSystem(repo,\n                                    new HashMap<String, Object>());\n        } catch (FileSystemAlreadyExistsException ex) {\n            fail(\"FS doesn't exists!\");\n        }\n\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n        assertEquals(\"init!\",\n                     ioService.readAllString(init));\n\n        init = ioService.get(URI.create(\"git://open-close-repo-test/readme.txt\"));\n        ioService.delete(init.getFileSystem().getPath(null));\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/SimpleFSIOServiceDotFileTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.Collections;\nimport java.util.Map;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic class SimpleFSIOServiceDotFileTest extends CommonIOExceptionsServiceDotFileTest {\n\n    protected static final Map<String, Object> EMPTY_ENV = Collections.emptyMap();\n\n    @Override\n    protected int testFileAttrSize4() {\n        return 7;\n    }\n\n    @Override\n    protected int testFileAttrSize3() {\n        return 10;\n    }\n\n    @Override\n    protected int testFileAttrSize2() {\n        return 10;\n    }\n\n    @Override\n    protected int testFileAttrSize1() {\n        return 10;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize4() {\n        return 7;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize3() {\n        return 10;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize2() {\n        return 11;\n    }\n\n    @Override\n    protected int testDirectoryAttrSize1() {\n        return 10;\n    }\n\n    @Override\n    protected int createDirectoriesAttrSize() {\n        return 8;\n    }\n\n    @Override\n    protected int testNewByteChannelAttrSize() {\n        return 8;\n    }\n\n    @Override\n    public Path getFilePath() {\n        try {\n            final File dir = createTempDirectory();\n            return ioService().get(dir.toURI()).resolve(\"myTempFile.txt\");\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Path getTargetPath() {\n        try {\n            final File dir = createTempDirectory();\n            return ioService().get(dir.toURI()).resolve(\"myTargetFile.txt\");\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Path getDirectoryPath() {\n        try {\n            final File dir = createTempDirectory();\n            return ioService().get(dir.toURI()).resolve(\"myDir\");\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Path getComposedDirectoryPath() {\n        try {\n            final File dir = createTempDirectory();\n            return ioService().get(dir.toURI()).resolve(\"path/to/myDir\");\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public File tempFile(final String content) throws IOException {\n        final File file = File.createTempFile(\"bar\",\n                                              \"foo\");\n        tempFiles.add(file);\n        final OutputStream out = new FileOutputStream(file);\n\n        if (content != null && !content.isEmpty()) {\n            out.write(content.getBytes());\n            out.flush();\n        }\n\n        out.close();\n\n        return file;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/attribute/DotFileAttrViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.attribute;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class DotFileAttrViewTest {\n\n    protected static final List<File> tempFiles = new ArrayList<>();\n    protected static IOService ioService = null;\n    private static boolean created = false;\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n\n    public static File createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        tempFiles.add(temp);\n\n        return temp;\n    }\n\n    @Test\n    public void testDotFileAttrAccess() throws IOException {\n        final URI newRepo = URI.create(\"git://\" + new Date().getTime() + \"-repo-test-3\");\n        ioService().newFileSystem(newRepo,\n                                  new HashMap<>());\n\n        final Path dir = ioService().get(newRepo);\n        final Path file = dir.resolve(\"myFile.txt\");\n\n        ioService().write(file,\n                          \"mycontent\",\n                          Collections.<OpenOption>emptySet());\n\n        {\n            final DublinCoreView view = ioService().getFileAttributeView(file,\n                                                                         DublinCoreView.class);\n\n            assertNotNull(view);\n\n            assertNotNull(view.readAttributes());\n\n            assertNotNull(view.readAttributes().languages());\n\n            assertEquals(0,\n                         view.readAttributes().languages().size());\n        }\n\n        ioService().write(file,\n                          \"mycontent\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.creator\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"some user name here\";\n                              }\n                          },\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.language[0]\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"en\";\n                              }\n                          },\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.language[1]\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"pt-BR\";\n                              }\n                          }\n        );\n\n        {\n            final DublinCoreView view = ioService().getFileAttributeView(file,\n                                                                         DublinCoreView.class);\n\n            assertNotNull(view);\n\n            assertNotNull(view.readAttributes());\n\n            assertNotNull(view.readAttributes().languages());\n\n            assertEquals(2,\n                         view.readAttributes().languages().size());\n\n            assertTrue(view.readAttributes().languages().contains(\"pt-BR\"));\n\n            assertTrue(view.readAttributes().languages().contains(\"en\"));\n\n            assertEquals(1,\n                         view.readAttributes().creators().size());\n\n            assertTrue(view.readAttributes().creators().contains(\"some user name here\"));\n        }\n\n        final Path dotFile = file.getParent().resolve(\".myFile.txt\");\n        assertTrue(Files.exists(dotFile));\n\n        final VersionAttributeView attrs = Files.getFileAttributeView(dotFile,\n                                                                      VersionAttributeView.class);\n        assertEquals(1,\n                     attrs.readAttributes().history().records().size());\n\n        final Map<String, Object> result = Files.readAttributes(dotFile,\n                                                                \"*\");\n        assertNotNull(result);\n    }\n\n    public IOService ioService() {\n        if (ioService == null) {\n            ioService = new IOServiceDotFileImpl();\n            assertTrue(PriorityDisposableRegistry.getDisposables().contains(ioService));\n        }\n        return ioService;\n    }\n\n    @Before\n    public void setup() throws IOException {\n        if (!created) {\n            final String path = createTempDirectory().getAbsolutePath();\n            System.setProperty(\"org.uberfire.nio.git.dir\",\n                               path);\n            System.out.println(\".niogit: \" + path);\n\n            final URI newRepo = URI.create(\"git://repo-test-3\");\n\n            try {\n                ioService().newFileSystem(newRepo,\n                                          new HashMap<String, Object>());\n            } catch (final Exception ex) {\n            } finally {\n                created = true;\n            }\n        }\n    }\n\n    @After\n    public void tearDown() {\n        // dispose the IOService or it will badly influence the tests executed after\n        ioService.dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/attribute/DublinCoreTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.attribute;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.Test;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class DublinCoreTest {\n\n    protected static final List<File> tempFiles = new ArrayList<File>();\n    protected static IOService ioService = null;\n\n    @AfterClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n\n    public static File createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        tempFiles.add(temp);\n\n        return temp;\n    }\n\n    @Test\n    public void testDCore() throws IOException {\n        final Path dir = ioService().get(createTempDirectory().toURI());\n        final Path file = dir.resolve(\"myFile.txt\");\n\n        ioService().write(file,\n                          \"mycontent\",\n                          Collections.<OpenOption>emptySet());\n\n        {\n            final DublinCoreView view = ioService().getFileAttributeView(file,\n                                                                         DublinCoreView.class);\n\n            assertNotNull(view);\n\n            assertNotNull(view.readAttributes());\n\n            assertNotNull(view.readAttributes().languages());\n\n            assertEquals(0,\n                         view.readAttributes().languages().size());\n        }\n\n        ioService().write(file,\n                          \"mycontent\",\n                          Collections.<OpenOption>emptySet(),\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.creator\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"some user name here\";\n                              }\n                          },\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.language[0]\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"en\";\n                              }\n                          },\n                          new FileAttribute<Object>() {\n                              @Override\n                              public String name() {\n                                  return \"dcore.language[1]\";\n                              }\n\n                              @Override\n                              public Object value() {\n                                  return \"pt-BR\";\n                              }\n                          }\n        );\n\n        {\n            final DublinCoreView view = ioService().getFileAttributeView(file,\n                                                                         DublinCoreView.class);\n\n            assertNotNull(view);\n\n            assertNotNull(view.readAttributes());\n\n            assertNotNull(view.readAttributes().languages());\n\n            assertEquals(2,\n                         view.readAttributes().languages().size());\n\n            assertTrue(view.readAttributes().languages().contains(\"pt-BR\"));\n\n            assertTrue(view.readAttributes().languages().contains(\"en\"));\n\n            assertEquals(1,\n                         view.readAttributes().creators().size());\n\n            assertTrue(view.readAttributes().creators().contains(\"some user name here\"));\n        }\n\n        ioService().setAttributes(file,\n                                  new FileAttribute<Object>() {\n                                      @Override\n                                      public String name() {\n                                          return \"dcore.identifier\";\n                                      }\n\n                                      @Override\n                                      public Object value() {\n                                          return file.toUri().toString();\n                                      }\n                                  });\n\n        {\n            final DublinCoreView view = ioService().getFileAttributeView(file,\n                                                                         DublinCoreView.class);\n\n            assertNotNull(view);\n\n            assertNotNull(view.readAttributes());\n\n            assertNotNull(view.readAttributes().languages());\n\n            assertEquals(2,\n                         view.readAttributes().languages().size());\n\n            assertTrue(view.readAttributes().languages().contains(\"pt-BR\"));\n\n            assertTrue(view.readAttributes().languages().contains(\"en\"));\n\n            assertEquals(1,\n                         view.readAttributes().creators().size());\n\n            assertTrue(view.readAttributes().creators().contains(\"some user name here\"));\n\n            assertEquals(1,\n                         view.readAttributes().identifiers().size());\n\n            assertTrue(view.readAttributes().identifiers().contains(file.toUri().toString()));\n        }\n    }\n\n    public IOService ioService() {\n        if (ioService == null) {\n            ioService = new IOServiceDotFileImpl();\n        }\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/impl/BatchTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.impl;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.UnsupportedEncodingException;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Random;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport org.apache.commons.io.FileUtils;\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.hooks.PostCommitHook;\nimport org.eclipse.jgit.hooks.PreCommitHook;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.util.FS_POSIX;\nimport org.eclipse.jgit.util.ProcessResult;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.mockito.Mockito;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.CommonIOServiceDotFileTest;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.lock.BatchLockControl;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProxy;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitWatchEvent;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class BatchTest {\n\n    final static IOService ioService = new IOServiceDotFileImpl();\n    static FileSystem fs1;\n    static JGitFileSystemImpl fs1Batch;\n    static FileSystem fs2;\n    static JGitFileSystemImpl fs2Batch;\n    static FileSystem fs3;\n    static JGitFileSystemImpl fs3Batch;\n    private static File path = null;\n\n    @BeforeClass\n    public static void setup() throws IOException {\n        assertTrue(PriorityDisposableRegistry.getDisposables().contains(ioService));\n        path = CommonIOServiceDotFileTest.createTempDirectory();\n\n        // XXX this is shaky at best: FileSystemProviders bootstraps the JGit FS in a static initializer.\n        //     if anything has referenced it before now, setting this system property will have no effect.\n        System.setProperty(\"org.uberfire.nio.git.dir\",\n                           path.getAbsolutePath());\n        System.out.println(\".niogit: \" + path.getAbsolutePath());\n\n        final URI newRepo = URI.create(\"git://amend-repo-test\");\n\n        fs1 = ioService.newFileSystem(newRepo,\n                                      new HashMap<>());\n        fs1Batch = (JGitFileSystemImpl) ((JGitFileSystemProxy) fs1).getRealJGitFileSystem();\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/init.file\"));\n        ioService.write(init,\n                        \"setupFS!\");\n\n        final URI newRepo2 = URI.create(\"git://check-amend-repo-test\");\n\n        fs2 = ioService.newFileSystem(newRepo2,\n                                      new HashMap<String, Object>() {{\n                                          put(\"init\",\n                                              \"true\");\n                                      }});\n        fs2Batch = (JGitFileSystemImpl) ((JGitFileSystemProxy) fs2).getRealJGitFileSystem();\n        init = ioService.get(URI.create(\"git://check-amend-repo-test/init.file\"));\n        ioService.write(init,\n                        \"setupFS!\");\n\n        final URI newRepo3 = URI.create(\"git://check-amend-repo-test-2\");\n        fs3 = ioService.newFileSystem(newRepo3,\n                                      new HashMap<String, Object>() {{\n                                          put(\"init\",\n                                              \"true\");\n                                      }});\n        fs3Batch = (JGitFileSystemImpl) ((JGitFileSystemProxy) fs3).getRealJGitFileSystem();\n        init = ioService.get(URI.create(\"git://check-amend-repo-test-2/init.file\"));\n        ioService.write(init,\n                        \"setupFS!\");\n    }\n\n    @AfterClass\n    public static void cleanup() {\n        FileUtils.deleteQuietly(path);\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.shutdown();\n        FileUtils.deleteQuietly(gitFsProvider.getGitRepoContainerDir());\n    }\n\n    @Test\n    public void deleteOnBatchEventShouldKeepUserInfo() {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/file.txt\"));\n\n        final WatchService ws = init.getFileSystem().newWatchService();\n        String user = \"dora\";\n        String message = \"message\";\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(user,\n                                            message));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n        }\n\n        ioService.startBatch(init.getFileSystem());\n        ioService.delete(init, new CommentedOption(user, message));\n        ioService.endBatch();\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            JGitWatchEvent event = (JGitWatchEvent) events.get(0);\n            WatchContext context = (WatchContext) event.context();\n            assertEquals(user, context.getUser());\n        }\n    }\n\n    @Test\n    public void testMoveAndAddOnBatchShouldTriggerRenameAndModifyEvent() {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/file.txt\"));\n        final Path initMoved = ioService.get(URI.create(\"git://amend-repo-test/fileMoved.txt\"));\n\n        final WatchService ws = init.getFileSystem().newWatchService();\n\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size());\n            assertEquals(StandardWatchEventKind.ENTRY_CREATE, ((JGitWatchEvent) events.get(0)).kind());\n        }\n\n        ioService.move(init, initMoved, new CommentedOption(\"moved\"));\n\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size());\n            assertEquals(StandardWatchEventKind.ENTRY_RENAME, ((JGitWatchEvent) events.get(0)).kind());\n        }\n\n        final Path aNewFile = ioService.get(URI.create(\"git://amend-repo-test/aNewFile.txt\"));\n        final Path aNewFileMoved = ioService.get(URI.create(\"git://amend-repo-test/aNewFileMoved.txt\"));\n\n        ioService.write(aNewFile,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size());\n            assertEquals(StandardWatchEventKind.ENTRY_CREATE, ((JGitWatchEvent) events.get(0)).kind());\n        }\n\n        ioService.startBatch(aNewFile.getFileSystem());\n        ioService.move(aNewFile, aNewFileMoved, new CommentedOption(\"moved\"));\n\n        ioService.write(aNewFileMoved,\n                        \"aNewFileMoved!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.endBatch();\n\n        assertEquals(\"aNewFileMoved!\", ioService.readAllString(aNewFileMoved));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n\n            assertEquals(2,\n                         events.size());\n            assertEquals(StandardWatchEventKind.ENTRY_RENAME, ((JGitWatchEvent) events.get(0)).kind());\n            assertEquals(StandardWatchEventKind.ENTRY_MODIFY, ((JGitWatchEvent) events.get(1)).kind());\n        }\n    }\n\n    @Test\n    public void testBatch() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        final WatchService ws = init.getFileSystem().newWatchService();\n\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n        ioService.write(init,\n                        \"init 2!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message2\"));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size());//modify readme\n        }\n\n        final Path init2 = ioService.get(URI.create(\"git://amend-repo-test/readme2.txt\"));\n        ioService.write(init2,\n                        \"init 3!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message3\"));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size()); // add file\n        }\n        ioService.write(init2,\n                        \"init 4!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message4\"));\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(1,\n                         events.size());// modify file\n        }\n\n        final VersionAttributeView vinit = ioService.getFileAttributeView(init,\n                                                                          VersionAttributeView.class);\n        final VersionAttributeView vinit2 = ioService.getFileAttributeView(init,\n                                                                           VersionAttributeView.class);\n\n        assertEquals(\"init 2!\",\n                     ioService.readAllString(init));\n\n        assertNotNull(vinit);\n        assertEquals(2,\n                     vinit.readAttributes().history().records().size());\n        assertNotNull(vinit2);\n        assertEquals(2,\n                     vinit2.readAttributes().history().records().size());\n\n        ioService.startBatch(init.getFileSystem());\n        final Path path = ioService.get(URI.create(\"git://amend-repo-test/mybatch\" + new Random(10L).nextInt() + \".txt\"));\n        final Path path2 = ioService.get(URI.create(\"git://amend-repo-test/mybatch2\" + new Random(10L).nextInt() + \".txt\"));\n        ioService.write(path,\n                        \"ooooo!\");\n        //init.file event\n        assertNotNull(ws.poll());\n        ioService.write(path,\n                        \"ooooo wdfs fg sdf!\");\n        assertNull(ws.poll());\n        ioService.write(path2,\n                        \"ooooo222!\");\n        assertNull(ws.poll());\n        ioService.write(path2,\n                        \" sdfsdg sdg ooooo222!\");\n        assertNull(ws.poll());\n        ioService.endBatch();\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(4,\n                         events.size()); //adds files\n        }\n\n        final VersionAttributeView v = ioService.getFileAttributeView(path,\n                                                                      VersionAttributeView.class);\n        final VersionAttributeView v2 = ioService.getFileAttributeView(path2,\n                                                                       VersionAttributeView.class);\n\n        assertNotNull(v);\n        assertNotNull(v2);\n        assertEquals(1,\n                     v.readAttributes().history().records().size());\n        assertEquals(1,\n                     v2.readAttributes().history().records().size());\n\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testBatch2() throws IOException, InterruptedException {\n        final Path f1 = ioService.get(URI.create(\"git://check-amend-repo-test/f1.txt\"));\n        final Path f2 = ioService.get(URI.create(\"git://check-amend-repo-test/f2.txt\"));\n        final Path f3 = ioService.get(URI.create(\"git://check-amend-repo-test/f3.txt\"));\n        // XXX: Workaround for UF-70: amend-test-repo has to contain something so it can receive the BATCH\n        ioService.write(f1,\n                        \"init f1!\");\n        ioService.write(f2,\n                        \"init f2!\");\n        // END workaround\n\n        final WatchService ws = f1.getFileSystem().newWatchService();\n\n        ioService.startBatch(f1.getFileSystem());\n        ioService.write(f1,\n                        \"f1-u1!\");\n        assertNull(ws.poll());\n        ioService.write(f2,\n                        \"f2-u1!\");\n        assertNull(ws.poll());\n        ioService.write(f3,\n                        \"f3-u1!\");\n        assertNull(ws.poll());\n        ioService.endBatch();\n\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(3,\n                         events.size()); //adds files\n\n            final VersionAttributeView v = ioService.getFileAttributeView(f1,\n                                                                          VersionAttributeView.class);\n            assertNotNull(v);\n            assertEquals(2,\n                         v.readAttributes().history().records().size());\n\n            final VersionAttributeView v2 = ioService.getFileAttributeView(f2,\n                                                                           VersionAttributeView.class);\n            assertNotNull(v2);\n            assertEquals(2,\n                         v2.readAttributes().history().records().size());\n\n            final VersionAttributeView v3 = ioService.getFileAttributeView(f3,\n                                                                           VersionAttributeView.class);\n            assertNotNull(v3);\n            assertEquals(1,\n                         v3.readAttributes().history().records().size());\n        }\n\n        ioService.startBatch(f1.getFileSystem());\n        ioService.write(f1,\n                        \"f1-u1!\");\n        assertNull(ws.poll());\n        ioService.write(f2,\n                        \"f2-u2!\");\n        assertNull(ws.poll());\n        ioService.write(f3,\n                        \"f3-u2!\");\n        assertNull(ws.poll());\n        ioService.endBatch();\n\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            assertEquals(2,\n                         events.size()); //adds files\n\n            final VersionAttributeView v = ioService.getFileAttributeView(f1,\n                                                                          VersionAttributeView.class);\n            assertNotNull(v);\n            assertEquals(2,\n                         v.readAttributes().history().records().size());\n\n            final VersionAttributeView v2 = ioService.getFileAttributeView(f2,\n                                                                           VersionAttributeView.class);\n            assertNotNull(v2);\n            assertEquals(3,\n                         v2.readAttributes().history().records().size());\n\n            final VersionAttributeView v3 = ioService.getFileAttributeView(f3,\n                                                                           VersionAttributeView.class);\n            assertNotNull(v3);\n            assertEquals(2,\n                         v3.readAttributes().history().records().size());\n        }\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void batchTest() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.endBatch();\n        assertFalse(fs1Batch.isOnBatch());\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void justOneFSOnBatchTest() throws IOException, InterruptedException {\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        init = ioService.get(URI.create(\"git://check-amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        assertFalse(fs2Batch.isOnBatch());\n        ioService.endBatch();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testInnerBatch() throws IOException, InterruptedException {\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        init = ioService.get(URI.create(\"git://check-amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.endBatch();\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.endBatch();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void innerBatchShouldOnlyBeCalledOnTheSameFS() throws IOException, InterruptedException {\n        Path repo1 = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(repo1,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        Path repo2 = ioService.get(URI.create(\"git://check-amend-repo-test/readme.txt\"));\n        ioService.write(repo2,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        try {\n            ioService.startBatch(fs2);\n            fail();\n        } catch (BatchLockControl.BatchRuntimeException e) {\n            //We already have a batch process running on another FS : git://amend-repo-test\n        }\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.endBatch();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void assertNumberOfCommitsOnInnerBatch() throws IOException, InterruptedException {\n        final Path f11 = ioService.get(URI.create(\"git://check-amend-repo-test/f11.txt\"));\n        // XXX: Workaround for UF-70: amend-test-repo has to contain something so it can receive the BATCH\n        ioService.write(f11,\n                        \"init f1!\");\n        // END workaround\n\n        ioService.startBatch(f11.getFileSystem());\n        ioService.write(f11,\n                        \"f1-u1!\");\n        ioService.endBatch();\n\n        VersionAttributeView v = ioService.getFileAttributeView(f11,\n                                                                VersionAttributeView.class);\n        assertNotNull(v);\n        assertEquals(2,\n                     v.readAttributes().history().records().size());\n\n        ioService.startBatch(f11.getFileSystem());\n\n        ioService.write(f11,\n                        \"f2-u2!\");\n\n        //inner batch (samme commit)\n        ioService.startBatch(f11.getFileSystem());\n        ioService.write(f11,\n                        \"f2-u2 - inner batch!\");\n        ioService.write(f11,\n                        \"f2-u2 - inner 2 batch!\");\n        ioService.endBatch();\n        ioService.write(f11,\n                        \"f2-u2 - inner batch! last\");\n\n        ioService.endBatch();\n\n        assertEquals(\"f2-u2 - inner batch! last\",\n                     ioService.readAllString(f11));\n\n        v = ioService.getFileAttributeView(f11,\n                                           VersionAttributeView.class);\n        assertNotNull(v);\n        assertEquals(4,\n                     v.readAttributes().history().records().size());\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testTwoStartedFsOnBatchByTheSameThread() throws IOException, InterruptedException {\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        init = ioService.get(URI.create(\"git://check-amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        try {\n            ioService.startBatch(fs1);\n        } catch (final Exception e) {\n            fail();\n        }\n\n        ioService.endBatch();\n        ioService.endBatch();\n\n        try {\n            ioService.endBatch();\n            fail();\n        } catch (final Exception e) {\n        }\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testTwoFsOnBatchByTheSameThread() throws IOException, InterruptedException {\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        init = ioService.get(URI.create(\"git://check-amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\",\n                        new CommentedOption(\"User Tester\",\n                                            \"message1\"));\n\n        ioService.startBatch(fs1);\n        assertTrue(fs1Batch.isOnBatch());\n        ioService.endBatch();\n        ioService.startBatch(fs2);\n        assertTrue(fs2Batch.isOnBatch());\n        ioService.endBatch();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testDifferentThreads() throws IOException, InterruptedException {\n\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\");\n\n        ioService.startBatch(fs1);\n        System.out.println(\"After start batch\");\n        Thread thread = new Thread(\"second\") {\n            @Override\n            public void run() {\n                try {\n                    System.out.println(\"Inner starting\");\n                    ioService.startBatch(fs1);\n                    System.out.println(\"Inner after batch\");\n                    final OutputStream innerOut = ioService.newOutputStream(init);\n                    for (int i = 0; i < 100; i++) {\n                        innerOut.write((\"sss\" + i).getBytes());\n                    }\n                    System.out.println(\"Inner after write\");\n                    innerOut.close();\n                    System.out.println(\"Inner after close\");\n                    ioService.endBatch();\n                    System.out.println(\"Inner after end batch\");\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                }\n            }\n        };\n        thread.start();\n        System.out.println(\"After start 2nd Thread\");\n        for (int i = 0; i < 100; i++) {\n            if (i % 20 == 0) {\n                Thread.sleep(10);\n            }\n            ioService.write(init,\n                            (\"sss\" + i).getBytes());\n        }\n        System.out.println(\"After writes\");\n        ioService.endBatch();\n        System.out.println(\"After end batch\");\n        thread.join();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testDifferentThreadsWithoutBatch() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\");\n\n        Thread thread = new Thread(\"second\") {\n            @Override\n            public void run() {\n                try {\n                    System.out.println(\"Inner starting\");\n                    final OutputStream innerOut = ioService.newOutputStream(init);\n                    for (int i = 0; i < 100; i++) {\n                        innerOut.write((\"sss\" + i).getBytes());\n                    }\n                    System.out.println(\"Inner after write\");\n                    innerOut.close();\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                }\n            }\n        };\n        thread.start();\n        System.out.println(\"After start 2nd Thread\");\n        for (int i = 0; i < 100; i++) {\n            if (i % 20 == 0) {\n                Thread.sleep(10);\n            }\n            ioService.write(init,\n                            (\"sss\" + i).getBytes());\n        }\n        System.out.println(\"After writes\");\n        thread.join();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testDifferentThreads3() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\");\n\n        ioService.startBatch(fs1);\n        System.out.println(\"After start batch\");\n\n        final Runnable runnable = new Runnable() {\n\n            @Override\n            public void run() {\n                try {\n                    System.out.println(\"Inner starting\");\n                    ioService.startBatch(fs1);\n                    System.out.println(\"Inner after batch\");\n                    final OutputStream innerOut = ioService.newOutputStream(init);\n                    for (int i = 0; i < 100; i++) {\n                        innerOut.write((\"sss\" + i).getBytes());\n                    }\n                    System.out.println(\"Inner after write\");\n                    innerOut.close();\n                    System.out.println(\"Inner after close\");\n                    ioService.endBatch();\n                    System.out.println(\"Inner after end batch\");\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                }\n            }\n        };\n\n        final Thread thread = new Thread(runnable,\n                                         \"second\");\n        final Thread thread2 = new Thread(runnable,\n                                          \"third\");\n        thread.start();\n        Thread.sleep(100);\n        thread2.start();\n        Thread.sleep(100);\n\n        System.out.println(\"After start 2nd Thread\");\n        for (int i = 0; i < 100; i++) {\n            if (i % 20 == 0) {\n                Thread.sleep(10);\n            }\n            ioService.write(init,\n                            (\"sss\" + i).getBytes());\n        }\n        System.out.println(\"After writes\");\n        ioService.endBatch();\n        System.out.println(\"After end batch\");\n        thread.join();\n        thread2.join();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testDifferentThreadsNotBatchInners() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\");\n\n        ioService.startBatch(fs1);\n        System.out.println(\"After start batch\");\n\n        final Runnable runnable = new Runnable() {\n\n            @Override\n            public void run() {\n                try {\n                    System.out.println(\"Inner starting\");\n                    final OutputStream innerOut = ioService.newOutputStream(init);\n                    for (int i = 0; i < 100; i++) {\n                        innerOut.write((\"sss\" + i).getBytes());\n                    }\n                    System.out.println(\"Inner after write\");\n                    innerOut.close();\n                    System.out.println(\"Inner after end batch\");\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                }\n            }\n        };\n\n        final Thread thread = new Thread(runnable,\n                                         \"second\");\n        final Thread thread2 = new Thread(runnable,\n                                          \"third\");\n        thread.start();\n        Thread.sleep(100);\n        thread2.start();\n        Thread.sleep(100);\n\n        System.out.println(\"After start 2nd Thread\");\n        for (int i = 0; i < 100; i++) {\n            if (i % 20 == 0) {\n                Thread.sleep(10);\n            }\n            ioService.write(init,\n                            (\"sss\" + i).getBytes());\n        }\n        System.out.println(\"After writes\");\n        ioService.endBatch();\n        System.out.println(\"After end batch\");\n        thread.join();\n        thread2.join();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void testDifferentThreadsNotBatchOuter() throws IOException, InterruptedException {\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioService.write(init,\n                        \"init!\");\n\n        final Runnable runnable = new Runnable() {\n            @Override\n            public void run() {\n                try {\n                    System.out.println(\"Inner starting\");\n                    ioService.startBatch(fs1);\n                    System.out.println(\"Inner after batch\");\n                    final OutputStream innerOut = ioService.newOutputStream(init);\n                    for (int i = 0; i < 100; i++) {\n                        ioService.write(init,\n                                        (\"sss\" + i).getBytes());\n                    }\n                    System.out.println(\"Inner after write\");\n                    innerOut.close();\n                    System.out.println(\"Inner after close\");\n                    ioService.endBatch();\n                    System.out.println(\"Inner after end batch\");\n                } catch (Exception ex) {\n                    ex.printStackTrace();\n                }\n            }\n        };\n\n        final Thread thread = new Thread(runnable,\n                                         \"second\");\n        final Thread thread2 = new Thread(runnable,\n                                          \"third\");\n        thread.start();\n        Thread.sleep(100);\n        thread2.start();\n        Thread.sleep(100);\n\n        System.out.println(\"After start 2nd Thread\");\n        for (int i = 0; i < 100; i++) {\n            if (i % 20 == 0) {\n                Thread.sleep(10);\n            }\n            ioService.write(init,\n                            (\"sss\" + i).getBytes());\n        }\n        System.out.println(\"After writes\");\n        thread.join();\n        thread2.join();\n        assertProperBatchCleanup();\n    }\n\n    @Test\n    public void exceptionOnCleanUpAndUnsetBatchModeOnFileSystemsShouldReleaseLock() throws IOException, InterruptedException {\n        IOServiceDotFileImpl ioServiceSpy = spy((IOServiceDotFileImpl) ioService);\n\n        Mockito.doThrow(new RuntimeException()).when(ioServiceSpy).unsetBatchModeOn(fs1Batch);\n\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/readme.txt\"));\n        ioServiceSpy.write(init,\n                           \"init!\",\n                           new CommentedOption(\"User Tester\",\n                                               \"message1\"));\n\n        ioServiceSpy.startBatch(fs1);\n        assertTrue(ioServiceSpy.getLockControl().isLocked());\n        try {\n            ioServiceSpy.endBatch();\n        } catch (Exception e) {\n\n        }\n        assertFalse(ioServiceSpy.getLockControl().isLocked());\n    }\n\n    @Test\n    public void hooksShouldBeCalledOnBatch() throws IOException {\n\n        final File hooksDir = CommonIOServiceDotFileTest.createTempDirectory();\n        System.setProperty(\"org.uberfire.nio.git.hooks\",\n                           hooksDir.getAbsolutePath());\n\n        writeMockHook(hooksDir,\n                      \"post-commit\");\n\n        JGitFileSystemProvider provider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://hook-fs/\"));\n\n        final AtomicInteger postCommitHookCalled = new AtomicInteger();\n\n        provider.setDetectedFS(new FS_POSIX() {\n            @Override\n            public ProcessResult runHookIfPresent(Repository repox,\n                                                  String hookName,\n                                                  String[] args) throws JGitInternalException {\n                if (hookName.equals(PostCommitHook.NAME)) {\n                    postCommitHookCalled.incrementAndGet();\n                    return new ProcessResult(1, ProcessResult.Status.OK);\n                }\n                return new ProcessResult(ProcessResult.Status.NOT_PRESENT);\n            }\n        });\n\n        ioService.newFileSystem(URI.create(\"git://hook-fs/\"),\n                                new HashMap<>());\n\n        Path init = ioService.get(URI.create(\"git://hook-fs/init.file\"));\n\n        ioService.write(init,\n                        \"setupFS!\");\n\n        ioService.startBatch(init.getFileSystem());\n\n        ioService.write(init,\n                        \"onBatch!\");\n\n        ioService.endBatch();\n\n        assertEquals(2, postCommitHookCalled.get());\n    }\n\n    static void writeMockHook(final File hooksDirectory,\n                              final String hookName)\n            throws FileNotFoundException, UnsupportedEncodingException {\n        final PrintWriter writer = new PrintWriter(new File(hooksDirectory,\n                                                            hookName),\n                                                   \"UTF-8\");\n        writer.println(\"# hook data\");\n        writer.close();\n    }\n\n    private void assertProperBatchCleanup() {\n        assertFalse(fs1Batch.isOnBatch());\n        assertFalse(fs2Batch.isOnBatch());\n        assertFalse(fs3Batch.isOnBatch());\n    }\n}"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/impl/WatcherTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.io.impl;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.commons.lifecycle.PriorityDisposableRegistry;\nimport org.uberfire.io.CommonIOServiceDotFileTest;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProxy;\n\nimport static org.junit.Assert.*;\n\npublic class WatcherTest {\n\n    final static IOService ioService = new IOServiceDotFileImpl();\n\n    private static File path = null;\n    static FileSystem fs1;\n    static JGitFileSystemImpl jgitFs1;\n\n    @BeforeClass\n    public static void setup() throws IOException {\n        assertTrue(PriorityDisposableRegistry.getDisposables().contains(ioService));\n        path = CommonIOServiceDotFileTest.createTempDirectory();\n\n        System.setProperty(\"org.uberfire.nio.git.dir\",\n                           path.getAbsolutePath());\n\n        final URI newRepo = URI.create(\"git://amend-repo-test\");\n\n        fs1 = ioService.newFileSystem(newRepo,\n                                      new HashMap<>());\n        jgitFs1 = (JGitFileSystemImpl) ((JGitFileSystemProxy) fs1).getRealJGitFileSystem();\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/init.file\"));\n        ioService.write(init,\n                        \"setupFS!\");\n    }\n\n    @AfterClass\n    public static void cleanup() {\n        FileUtils.deleteQuietly(path);\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.shutdown();\n        FileUtils.deleteQuietly(gitFsProvider.getGitRepoContainerDir());\n        System.clearProperty(\"org.uberfire.nio.git.dir\");\n    }\n\n    @Test\n    public void simpleWatcherTest() {\n\n        final Path init = ioService.get(URI.create(\"git://amend-repo-test/dora1.txt\"));\n        final WatchService ws = init.getFileSystem().newWatchService();\n\n        ioService.write(init,\n                        \"init!\");\n\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            WatchEvent.Kind<?> kind = events.get(0).kind();\n            assertEquals(kind.name(),\n                         StandardWatchEventKind.ENTRY_CREATE.name());\n            assertEquals(1,\n                         events.size());\n        }\n        ioService.write(init,\n                        \"init 2!\");\n        {\n            List<WatchEvent<?>> events = ws.poll().pollEvents();\n            WatchEvent.Kind<?> kind = events.get(0).kind();\n            assertEquals(kind.name(),\n                         StandardWatchEventKind.ENTRY_MODIFY.name());\n            assertEquals(1,\n                         events.size());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/java/org/uberfire/io/regex/AntPathMatcherTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.io.regex;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.io.CommonIOServiceDotFileTest;\nimport org.uberfire.java.nio.file.FileSystems;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\n\nimport static org.uberfire.io.regex.AntPathMatcher.excludes;\nimport static org.uberfire.io.regex.AntPathMatcher.filter;\nimport static org.uberfire.io.regex.AntPathMatcher.includes;\n\npublic class AntPathMatcherTest {\n\n    private static File path;\n\n    @BeforeClass\n    public static void setup() throws IOException {\n        path = CommonIOServiceDotFileTest.createTempDirectory();\n\n        // XXX this is shaky at best: FileSystemProviders bootstraps the JGit FS in a static initializer.\n        //     if anything has referenced it before now, setting this system property will have no effect.\n        System.setProperty(\"org.uberfire.nio.git.dir\",\n                           path.getAbsolutePath());\n        System.out.println(\".niogit: \" + path.getAbsolutePath());\n\n        final URI newRepo = URI.create(\"git://antpathmatcher\");\n\n        FileSystems.newFileSystem(newRepo,\n                                  new HashMap<String, Object>());\n    }\n\n    @AfterClass\n    public static void cleanup() {\n        FileUtils.deleteQuietly(path);\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.shutdown();\n        FileUtils.deleteQuietly(gitFsProvider.getGitRepoContainerDir());\n    }\n\n    @Test\n    public void testIncludes() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"git://**\");\n            add(\"**/repo/**\");\n        }};\n\n        {\n            final Path path = Paths.get(URI.create(\"file:///Users/home\"));\n            Assert.assertFalse(includes(patterns,\n                                        path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://antpathmatcher\"));\n            Assert.assertTrue(includes(patterns,\n                                       path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://main@antpathmatcher\"));\n            Assert.assertTrue(includes(patterns,\n                                       path));\n        }\n    }\n\n    @Test\n    public void testIncludesMid() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"default://**\");\n            add(\"**/repo/**\");\n        }};\n\n        {\n            final Path path = Paths.get(URI.create(\"file:///Users/home\"));\n            Assert.assertTrue(includes(patterns,\n                                       path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://antpathmatcher\"));\n            Assert.assertFalse(includes(patterns,\n                                        path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://main@antpathmatcher/repo/sss\"));\n            Assert.assertTrue(includes(patterns,\n                                       path));\n        }\n    }\n\n    @Test\n    public void testExcludes() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"git://**\");\n            add(\"**/repo/**\");\n        }};\n\n        {\n            final Path path = Paths.get(URI.create(\"file:///Users/home\"));\n            Assert.assertFalse(excludes(patterns,\n                                        path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://antpathmatcher\"));\n            Assert.assertTrue(excludes(patterns,\n                                       path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://main@antpathmatcher\"));\n            Assert.assertTrue(excludes(patterns,\n                                       path));\n        }\n    }\n\n    @Test\n    public void testExcludesMid() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"default://**\");\n            add(\"**/repo/**\");\n        }};\n\n        {\n            final Path path = Paths.get(URI.create(\"file:///Users/home\"));\n            Assert.assertTrue(excludes(patterns,\n                                       path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://antpathmatcher\"));\n            Assert.assertFalse(excludes(patterns,\n                                        path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://main@antpathmatcher/repo/sss\"));\n            Assert.assertTrue(excludes(patterns,\n                                       path));\n        }\n    }\n\n    @Test\n    public void testFilter() {\n        final Collection<String> includes = new ArrayList<String>() {{\n            add(\"git://**\");\n        }};\n        final Collection<String> excludes = new ArrayList<String>() {{\n            add(\"default://**\");\n        }};\n\n        {\n            final Path path = Paths.get(URI.create(\"file:///Users/home\"));\n            Assert.assertFalse(filter(includes,\n                                      excludes,\n                                      path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://antpathmatcher\"));\n            Assert.assertTrue(filter(includes,\n                                     excludes,\n                                     path));\n        }\n\n        {\n            final Path path = Paths.get(URI.create(\"git://main@antpathmatcher/repo/sss\"));\n            Assert.assertTrue(filter(includes,\n                                     excludes,\n                                     path));\n        }\n\n        Assert.assertTrue(filter(Collections.<String>emptyList(),\n                                 Collections.<String>emptyList(),\n                                 Paths.get(URI.create(\"git://main@antpathmatcher/repo/sss\"))));\n        Assert.assertTrue(filter(Collections.<String>emptyList(),\n                                 Collections.<String>emptyList(),\n                                 Paths.get(URI.create(\"git://antpathmatcher\"))));\n    }\n\n    @Test\n    public void testIncludesUri() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"git://**\");\n            add(\"**/repo/**\");\n        }};\n\n        Assert.assertFalse(includes(patterns,\n                                    URI.create(\"file:///Users/home\")));\n\n        Assert.assertTrue(includes(patterns,\n                                   URI.create(\"git://antpathmatcher\")));\n\n        Assert.assertTrue(includes(patterns,\n                                   URI.create(\"git://main@antpathmatcher\")));\n    }\n\n    @Test\n    public void testIncludesMidUri() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"file://**\");\n            add(\"**/repo/**\");\n        }};\n\n        Assert.assertTrue(includes(patterns,\n                                   URI.create(\"file:///Users/home\")));\n\n        Assert.assertFalse(includes(patterns,\n                                    URI.create(\"git://antpathmatcher\")));\n\n        Assert.assertTrue(includes(patterns,\n                                   URI.create(\"git://main@antpathmatcher/repo/sss\")));\n    }\n\n    @Test\n    public void testExcludesUri() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"git://**\");\n            add(\"**/repo/**\");\n        }};\n\n        Assert.assertFalse(excludes(patterns,\n                                    URI.create(\"file:///Users/home\")));\n\n        Assert.assertTrue(excludes(patterns,\n                                   URI.create(\"git://antpathmatcher\")));\n\n        Assert.assertTrue(excludes(patterns,\n                                   URI.create(\"git://main@antpathmatcher\")));\n    }\n\n    @Test\n    public void testExcludesMidUri() {\n        final Collection<String> patterns = new ArrayList<String>() {{\n            add(\"file://**\");\n            add(\"**/repo/**\");\n        }};\n\n        Assert.assertTrue(excludes(patterns,\n                                   URI.create(\"file:///Users/home\")));\n\n        Assert.assertFalse(excludes(patterns,\n                                    URI.create(\"git://antpathmatcher\")));\n\n        Assert.assertTrue(excludes(patterns,\n                                   URI.create(\"git://main@antpathmatcher/repo/sss\")));\n    }\n\n    @Test\n    public void testFilterUri() {\n        final Collection<String> includes = new ArrayList<String>() {{\n            add(\"git://**\");\n        }};\n        final Collection<String> excludes = new ArrayList<String>() {{\n            add(\"file://**\");\n        }};\n\n        Assert.assertFalse(filter(includes,\n                                  excludes,\n                                  URI.create(\"file:///Users/home\")));\n\n        Assert.assertTrue(filter(includes,\n                                 excludes,\n                                 URI.create(\"git://antpathmatcher\")));\n\n        Assert.assertTrue(filter(includes,\n                                 excludes,\n                                 URI.create(\"git://main@antpathmatcher/repo/sss\")));\n\n        Assert.assertTrue(filter(Collections.<String>emptyList(),\n                                 Collections.<String>emptyList(),\n                                 URI.create(\"file:///Users/home\")));\n\n        Assert.assertTrue(filter(Collections.<String>emptyList(),\n                                 Collections.<String>emptyList(),\n                                 URI.create(\"git://main@antpathmatcher/repo/sss\")));\n    }\n}\n"
  },
  {
    "path": "uberfire-io/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-io/src/test/resources/simplelogger.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# logging configuration for slf4j-simple\n\norg.slf4j.simpleLogger.logFile=System.out\n\norg.slf4j.simpleLogger.defaultLogLevel=info\n\n# Some logging categories that may be of interest when troubleshooting:\n#org.slf4j.simpleLogger.log.org.uberfire.io=debug\n#org.slf4j.simpleLogger.log.org.uberfire.java.nio.fs.jgit=debug\n"
  },
  {
    "path": "uberfire-js/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-js/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-js</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire JS</name>\n  <description>UberFire JS</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-bridge</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/JSEntryPoint.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport static com.google.gwt.core.client.ScriptInjector.TOP_WINDOW;\n\nimport java.util.Collection;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.plugin.RuntimePluginsServiceProxy;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport com.google.gwt.core.client.ScriptInjector;\n\n@EntryPoint\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class JSEntryPoint {\n\n    @Inject\n    private Workbench workbench;\n\n    @Inject\n    private RuntimePluginsServiceProxy runtimePluginsService;\n\n    @PostConstruct\n    public void init() {\n        workbench.addStartupBlocker(JSEntryPoint.class);\n        runtimePluginsService.listFrameworksContent(new ParameterizedCommand<Collection<String>>() {\n            @Override\n            public void execute(final Collection<String> response) {\n                for (final String s : response) {\n                    ScriptInjector.fromString(s).setWindow(TOP_WINDOW).inject();\n                }\n                runtimePluginsService.listPluginsContent(new ParameterizedCommand<Collection<String>>() {\n                    @Override\n                    public void execute(final Collection<String> response) {\n                        try {\n                            for (final String s : response) {\n                                ScriptInjector.fromString(s).setWindow(TOP_WINDOW).inject();\n                            }\n                        } finally {\n                            workbench.removeStartupBlocker(JSEntryPoint.class);\n                        }\n                    }\n                });\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/editor/JSEditorActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.editor;\n\nimport javax.enterprise.inject.Alternative;\n\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\n\n@Alternative\npublic class JSEditorActivity extends AbstractWorkbenchEditorActivity {\n\n    private JSNativeEditor nativeEditor;\n\n    public JSEditorActivity(final JSNativeEditor nativeEditor,\n                            final PlaceManager placeManager) {\n        super(placeManager);\n        this.nativeEditor = nativeEditor;\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        super.onStartup(path,\n                        place);\n        setupObservablePathCallBacks();\n        nativeEditor.onStartup(path.toURI());\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        nativeEditor.onOpen(path.toURI());\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        nativeEditor.onClose();\n    }\n\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        nativeEditor.onShutdown();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return nativeEditor.getId();\n    }\n\n    private void setupObservablePathCallBacks() {\n        path.onConcurrentUpdate(new ParameterizedCommand<ObservablePath.OnConcurrentUpdateEvent>() {\n            @Override\n            public void execute(ObservablePath.OnConcurrentUpdateEvent parameter) {\n                nativeEditor.onConcurrentUpdate();\n            }\n        });\n        path.onConcurrentDelete(new ParameterizedCommand<ObservablePath.OnConcurrentDelete>() {\n            @Override\n            public void execute(ObservablePath.OnConcurrentDelete parameter) {\n                nativeEditor.onConcurrentDelete();\n            }\n        });\n        path.onConcurrentRename(new ParameterizedCommand<ObservablePath.OnConcurrentRenameEvent>() {\n            @Override\n            public void execute(ObservablePath.OnConcurrentRenameEvent parameter) {\n                nativeEditor.onConcurrentRename();\n            }\n        });\n        path.onConcurrentCopy(new ParameterizedCommand<ObservablePath.OnConcurrentCopyEvent>() {\n            @Override\n            public void execute(ObservablePath.OnConcurrentCopyEvent parameter) {\n                nativeEditor.onConcurrentCopy();\n            }\n        });\n        path.onRename(new Command() {\n            @Override\n            public void execute() {\n                nativeEditor.onRename();\n            }\n        });\n        path.onDelete(new Command() {\n            @Override\n            public void execute() {\n                nativeEditor.onDelete();\n            }\n        });\n        path.onUpdate(new Command() {\n            @Override\n            public void execute() {\n                nativeEditor.onUpdate();\n            }\n        });\n        path.onCopy(new Command() {\n            @Override\n            public void execute() {\n                nativeEditor.onCopy();\n            }\n        });\n    }\n\n    @Override\n    public String getTitle() {\n        return nativeEditor.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return new HTML(nativeEditor.getElement().getInnerHTML());\n    }\n\n    public JSNativeEditor getNativeEditor() {\n        return nativeEditor;\n    }\n\n    public void setNativeEditor(JSNativeEditor nativeEditor) {\n        this.nativeEditor = nativeEditor;\n    }\n\n    @Override\n    protected WorkbenchEditor.LockingStrategy getLockingStrategy() {\n        return WorkbenchEditor.LockingStrategy.EDITOR_PROVIDED;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/editor/JSNativeEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.editor;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.client.plugin.JSNativePlugin;\n\n@Dependent\npublic class JSNativeEditor extends JSNativePlugin {\n\n    private String resourceType;\n\n    private static native String getResourceType(final JavaScriptObject o) /*-{\n        return o.resourceType;\n    }-*/;\n\n    private static native void executeOnConcurrentUpdate(final JavaScriptObject o) /*-{\n        o.on_concurrent_update();\n    }-*/;\n\n    private static native void executeOnConcurrentDelete(final JavaScriptObject o) /*-{\n        o.on_concurrent_delete();\n    }-*/;\n\n    private static native void executeOnConcurrentRename(final JavaScriptObject o) /*-{\n        o.on_concurrent_rename();\n    }-*/;\n\n    private static native void executeOnConcurrentCopy(final JavaScriptObject o) /*-{\n        o.on_concurrent_copy();\n    }-*/;\n\n    private static native void executeOnRename(final JavaScriptObject o) /*-{\n        o.on_copy();\n    }-*/;\n\n    private static native void executeOnDelete(final JavaScriptObject o) /*-{\n        o.on_copy();\n    }-*/;\n\n    private static native void executeOnCopy(final JavaScriptObject o) /*-{\n        o.on_copy();\n    }-*/;\n\n    private static native void executeOnUpdate(final JavaScriptObject o) /*-{\n        o.on_update();\n    }-*/;\n\n    public void build(final JavaScriptObject obj) {\n        super.build(obj);\n        if (hasStringProperty(obj,\n                              \"resourceType\")) {\n            resourceType = getResourceType(obj);\n        }\n    }\n\n    public void onConcurrentUpdate() {\n        if (hasMethod(obj,\n                      \"on_concurrent_update\")) {\n            executeOnConcurrentUpdate(obj);\n        }\n    }\n\n    public void onConcurrentDelete() {\n        if (hasMethod(obj,\n                      \"on_concurrent_delete\")) {\n            executeOnConcurrentDelete(obj);\n        }\n    }\n\n    public void onConcurrentRename() {\n        if (hasMethod(obj,\n                      \"on_concurrent_rename\")) {\n            executeOnConcurrentRename(obj);\n        }\n    }\n\n    public void onConcurrentCopy() {\n        if (hasMethod(obj,\n                      \"on_concurrent_copy\")) {\n            executeOnConcurrentCopy(obj);\n        }\n    }\n\n    public void onRename() {\n        if (hasMethod(obj,\n                      \"on_rename\")) {\n            executeOnRename(obj);\n        }\n    }\n\n    public void onDelete() {\n        if (hasMethod(obj,\n                      \"on_delete\")) {\n            executeOnDelete(obj);\n        }\n    }\n\n    public void onCopy() {\n        if (hasMethod(obj,\n                      \"on_copy\")) {\n            executeOnCopy(obj);\n        }\n    }\n\n    public void onUpdate() {\n        if (hasMethod(obj,\n                      \"on_update\")) {\n            executeOnUpdate(obj);\n        }\n    }\n\n    public String getResourceType() {\n        return resourceType;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/editor/type/JSClientResourceType.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.editor.type;\n\nimport javax.enterprise.inject.Alternative;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\n\n@Alternative\npublic class JSClientResourceType implements ClientResourceType {\n\n    private JSNativeClientResourceType jsNativeClientResourceType;\n    private Category category;\n\n    public JSClientResourceType() {\n\n    }\n\n    public JSClientResourceType(JSNativeClientResourceType jsNativeClientResourceType,\n                                Category category) {\n        this.jsNativeClientResourceType = jsNativeClientResourceType;\n        this.category = category;\n    }\n\n    @Override\n    public String getShortName() {\n        return jsNativeClientResourceType.getShortName();\n    }\n\n    @Override\n    public String getDescription() {\n        return jsNativeClientResourceType.getDescription();\n    }\n\n    @Override\n    public String getPrefix() {\n        return jsNativeClientResourceType.getPrefix();\n    }\n\n    @Override\n    public String getSuffix() {\n        return jsNativeClientResourceType.getSuffix();\n    }\n\n    @Override\n    public int getPriority() {\n        return Integer.valueOf(jsNativeClientResourceType.getPriority());\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return jsNativeClientResourceType.getSimpleWildcardPattern();\n    }\n\n    @Override\n    public boolean accept(Path path) {\n        return jsNativeClientResourceType.acceptFileName(path.getFileName());\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    public String getId() {\n        return jsNativeClientResourceType.getId();\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/editor/type/JSNativeClientResourceType.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.editor.type;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\n@Dependent\npublic class JSNativeClientResourceType {\n\n    private JavaScriptObject obj;\n\n    public void build(final JavaScriptObject obj) {\n        if (this.obj != null) {\n            throw new RuntimeException(\"Can't build more than once.\");\n        }\n        this.obj = obj;\n    }\n\n    public native boolean acceptFileName(String filename) /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.accept(filename);\n    }-*/;\n\n    public native String getSimpleWildcardPattern()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.simple_wildcard_pattern;\n    }-*/;\n\n    public native String getPriority()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.priority;\n    }-*/;\n\n    public native String getSuffix()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.suffix;\n    }-*/;\n\n    public native String getPrefix()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.prefix;\n    }-*/;\n\n    public native String getDescription()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.description;\n    }-*/;\n\n    public native String getShortName()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.short_name;\n    }-*/;\n\n    public native String getId()  /*-{\n        return this.@org.uberfire.client.editor.type.JSNativeClientResourceType::obj.id;\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/EditorJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.editor.JSEditorActivity;\nimport org.uberfire.client.editor.JSNativeEditor;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class EditorJSExporter implements UberfireJSExporter {\n\n    public static void registerEditor(final Object _obj) {\n        final JavaScriptObject obj = (JavaScriptObject) _obj;\n        if (JSNativeEditor.hasStringProperty(obj,\n                                             \"id\")) {\n            final SyncBeanManager beanManager = IOC.getBeanManager();\n            final ActivityBeansCache activityBeansCache = beanManager.lookupBean(ActivityBeansCache.class).getInstance();\n\n            final JSNativeEditor newNativeEditor = beanManager.lookupBean(JSNativeEditor.class).getInstance();\n            newNativeEditor.build(obj);\n\n            PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n\n            JSEditorActivity activity = JSExporterUtils.findActivityIfExists(beanManager,\n                                                                             newNativeEditor.getId(),\n                                                                             JSEditorActivity.class);\n\n            if (activity == null) {\n                registerNewActivity(beanManager,\n                                    activityBeansCache,\n                                    newNativeEditor,\n                                    placeManager);\n            } else {\n                updateExistentActivity(newNativeEditor,\n                                       activity);\n            }\n        }\n    }\n\n    private static void updateExistentActivity(final JSNativeEditor newNativeEditor,\n                                               final JSEditorActivity activity) {\n        activity.setNativeEditor(newNativeEditor);\n    }\n\n    private static void registerNewActivity(final SyncBeanManager beanManager,\n                                            final ActivityBeansCache activityBeansCache,\n                                            final JSNativeEditor newNativeEditor,\n                                            final PlaceManager placeManager) {\n        final JSEditorActivity activity;\n        activity = new JSEditorActivity(newNativeEditor,\n                                        placeManager);\n\n        final Set<Annotation> qualifiers = new HashSet<Annotation>(Arrays.asList(DEFAULT_QUALIFIERS));\n        final SingletonBeanDefinition<JSEditorActivity, JSEditorActivity> beanDef = new SingletonBeanDefinition<>(\n                activity,\n                JSEditorActivity.class,\n                qualifiers,\n                newNativeEditor.getId(),\n                true,\n                WorkbenchEditorActivity.class,\n                Activity.class);\n\n        beanManager.registerBean(beanDef);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          WorkbenchEditorActivity.class);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          Activity.class);\n\n        activityBeansCache.addNewEditorActivity(beanManager.lookupBeans(newNativeEditor.getId()).iterator().next(),\n                                                newNativeEditor.getPriority(),\n                                                newNativeEditor.getResourceType());\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$registerEditor = @org.uberfire.client.exporter.EditorJSExporter::registerEditor(Ljava/lang/Object;);\n    }-*/;\n\n    public static class EditorResourceTypeNotFound extends RuntimeException {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/JSExporterUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.util.Iterator;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.Activity;\n\npublic class JSExporterUtils {\n\n    public static <T extends Activity> T findActivityIfExists(final SyncBeanManager beanManager,\n                                                              String id,\n                                                              Class<T> activityType) {\n        Iterator<SyncBeanDef> existentActivities = beanManager.lookupBeans(id).iterator();\n        while (existentActivities.hasNext()) {\n            Object existentActivity = existentActivities.next().getInstance();\n            if (activityType.equals(existentActivity.getClass())) {\n                return (T) existentActivity;\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/PerspectiveJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.perspective.JSNativePerspective;\nimport org.uberfire.client.perspective.JSWorkbenchPerspectiveActivity;\nimport org.uberfire.client.plugin.JSNativePlugin;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class PerspectiveJSExporter implements UberfireJSExporter {\n\n    public static void registerPerspective(final Object _obj) {\n        final JavaScriptObject obj = (JavaScriptObject) _obj;\n\n        if (JSNativePlugin.hasStringProperty(obj,\n                                             \"id\")) {\n            final SyncBeanManager beanManager = IOC.getBeanManager();\n            final ActivityBeansCache activityBeansCache = beanManager.lookupBean(ActivityBeansCache.class).getInstance();\n\n            final JSNativePerspective newNativePerspective = beanManager.lookupBean(JSNativePerspective.class).getInstance();\n            newNativePerspective.build(obj);\n\n            final JSWorkbenchPerspectiveActivity activity = new JSWorkbenchPerspectiveActivity(newNativePerspective);\n\n            beanManager.registerBean(new SingletonBeanDefinition<PerspectiveActivity, JSWorkbenchPerspectiveActivity>(activity,\n                                                                   PerspectiveActivity.class,\n                                                                   new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                                                                   newNativePerspective.getId(),\n                                                                   true,\n                                                                   JSWorkbenchPerspectiveActivity.class));\n\n            activityBeansCache.addNewPerspectiveActivity(beanManager.lookupBeans(newNativePerspective.getId()).iterator().next());\n        }\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$registerPerspective = @org.uberfire.client.exporter.PerspectiveJSExporter::registerPerspective(Ljava/lang/Object;);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/PlaceManagerJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n@ApplicationScoped\npublic class PlaceManagerJSExporter implements UberfireJSExporter {\n\n    public static void goTo(final String place) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n        placeManager.goTo(new DefaultPlaceRequest(place));\n    }\n\n    public static void goTo(final String place,\n                            final HTMLElement element) {\n        final SyncBeanManager beanManager = IOC.getBeanManager();\n        final PlaceManager placeManager = beanManager.lookupBean(PlaceManager.class).getInstance();\n        placeManager.goTo(place, element);\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$goToPlace = @org.uberfire.client.exporter.PlaceManagerJSExporter::goTo(Ljava/lang/String;);\n        $wnd.$goToScreen = @org.uberfire.client.exporter.PlaceManagerJSExporter::goTo(Ljava/lang/String;Lorg/jboss/errai/common/client/dom/HTMLElement;);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/PluginJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.client.plugin.JSNativePlugin;\nimport org.uberfire.client.screen.JSNativeScreen;\nimport org.uberfire.client.screen.JSWorkbenchScreenActivity;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class PluginJSExporter implements UberfireJSExporter {\n\n    public static void registerPlugin(final Object _obj) {\n        final JavaScriptObject obj = (JavaScriptObject) _obj;\n\n        if (JSNativePlugin.hasStringProperty(obj,\n                                             \"id\") && JSNativePlugin.hasTemplate(obj)) {\n            final SyncBeanManager beanManager = IOC.getBeanManager();\n            final ActivityBeansCache activityBeansCache = beanManager.lookupBean(ActivityBeansCache.class).getInstance();\n\n            final JSNativeScreen newNativePlugin = beanManager.lookupBean(JSNativeScreen.class).getInstance();\n            newNativePlugin.build(obj);\n\n            JSWorkbenchScreenActivity activity = JSExporterUtils.findActivityIfExists(beanManager,\n                                                                                      newNativePlugin.getId(),\n                                                                                      JSWorkbenchScreenActivity.class);\n\n            if (activity == null) {\n                registerNewActivity(beanManager,\n                                    activityBeansCache,\n                                    newNativePlugin);\n            } else {\n                updateExistentActivity(newNativePlugin,\n                                       activity);\n            }\n        }\n    }\n\n    private static void updateExistentActivity(final JSNativeScreen newNativePlugin,\n                                               final JSWorkbenchScreenActivity activity) {\n        activity.setNativePlugin(newNativePlugin);\n    }\n\n    private static void registerNewActivity(final SyncBeanManager beanManager,\n                                            final ActivityBeansCache activityBeansCache,\n                                            final JSNativeScreen newNativePlugin) {\n        final JSWorkbenchScreenActivity activity;\n        activity = new JSWorkbenchScreenActivity(newNativePlugin,\n                                                 beanManager.lookupBean(PlaceManager.class).getInstance());\n\n        final Set<Annotation> qualifiers = new HashSet<Annotation>(Arrays.asList(DEFAULT_QUALIFIERS));\n        final SingletonBeanDefinition<JSWorkbenchScreenActivity, JSWorkbenchScreenActivity> beanDef =\n                new SingletonBeanDefinition<>(activity,\n                                              JSWorkbenchScreenActivity.class,\n                                              qualifiers,\n                                              newNativePlugin.getId(),\n                                              true,\n                                              WorkbenchScreenActivity.class,\n                                              Activity.class);\n        beanManager.registerBean(beanDef);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          WorkbenchScreenActivity.class);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          Activity.class);\n\n        activityBeansCache.addNewScreenActivity(beanManager.lookupBeans(newNativePlugin.getId()).iterator().next());\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$registerPlugin = @org.uberfire.client.exporter.PluginJSExporter::registerPlugin(Ljava/lang/Object;);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/ResourceTypeDefinitionJSExporter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.editor.type.JSClientResourceType;\nimport org.uberfire.client.editor.type.JSNativeClientResourceType;\nimport org.uberfire.client.plugin.JSNativePlugin;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class ResourceTypeDefinitionJSExporter implements UberfireJSExporter {\n\n    public static void registerResourceTypeDefinition(final Object _obj) {\n        final JavaScriptObject obj = (JavaScriptObject) _obj;\n\n        if (JSNativePlugin.hasStringProperty(obj,\n                                             \"id\")) {\n            final SyncBeanManager beanManager = IOC.getBeanManager();\n            final JSNativeClientResourceType newNativeClientResourceType = beanManager.lookupBean(JSNativeClientResourceType.class).getInstance();\n            final Category category = beanManager.lookupBean(Others.class).getInstance();\n            newNativeClientResourceType.build(obj);\n            JSClientResourceType jsClientResourceType = new JSClientResourceType(newNativeClientResourceType,\n                                                                                 category);\n            beanManager.registerBean(new SingletonBeanDefinition<ClientResourceType, JSClientResourceType>(jsClientResourceType,\n                                                                   ClientResourceType.class,\n                                                                   new HashSet<>(Arrays.asList(DEFAULT_QUALIFIERS)),\n                                                                   jsClientResourceType.getId(),\n                                                                   true,\n                                                                   JSClientResourceType.class));\n        }\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$registerResourceType = @org.uberfire.client.exporter.ResourceTypeDefinitionJSExporter::registerResourceTypeDefinition(Ljava/lang/Object;);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/SplashScreenJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.splash.JSNativeSplashScreen;\nimport org.uberfire.client.splash.JSSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport org.uberfire.jsbridge.client.cdi.SingletonBeanDefinition;\n\nimport static org.jboss.errai.ioc.client.QualifierUtil.DEFAULT_QUALIFIERS;\n\n@ApplicationScoped\npublic class SplashScreenJSExporter implements UberfireJSExporter {\n\n    public static void registerSplashScreen(final Object _obj) {\n        final JavaScriptObject obj = (JavaScriptObject) _obj;\n\n        if (JSNativeSplashScreen.hasStringProperty(obj,\n                                                   \"id\") && JSNativeSplashScreen.hasTemplate(obj)) {\n            final SyncBeanManager beanManager = IOC.getBeanManager();\n            final ActivityBeansCache activityBeansCache = beanManager.lookupBean(ActivityBeansCache.class).getInstance();\n\n            final JSNativeSplashScreen newNativePlugin = beanManager.lookupBean(JSNativeSplashScreen.class).getInstance();\n            newNativePlugin.build(obj);\n\n            final SplashView splashView = beanManager.lookupBean(SplashView.class).getInstance();\n\n            JSSplashScreenActivity activity = JSExporterUtils.findActivityIfExists(beanManager,\n                                                                                   newNativePlugin.getId(),\n                                                                                   JSSplashScreenActivity.class);\n\n            if (activity == null) {\n                registerNewActivity(beanManager,\n                                    activityBeansCache,\n                                    newNativePlugin,\n                                    splashView);\n            } else {\n                updateExistentActivity(newNativePlugin,\n                                       activity);\n            }\n        }\n    }\n\n    private static void updateExistentActivity(final JSNativeSplashScreen newNativePlugin,\n                                               final JSSplashScreenActivity activity) {\n        activity.setNativeSplashScreen(newNativePlugin);\n    }\n\n    private static void registerNewActivity(final SyncBeanManager beanManager,\n                                            final ActivityBeansCache activityBeansCache,\n                                            final JSNativeSplashScreen newNativePlugin,\n                                            final SplashView splashView) {\n        final JSSplashScreenActivity activity;\n        activity = new JSSplashScreenActivity(newNativePlugin,\n                                              splashView);\n        final Set<Annotation> qualifiers = new HashSet<Annotation>(Arrays.asList(DEFAULT_QUALIFIERS));\n        final SingletonBeanDefinition<JSSplashScreenActivity, JSSplashScreenActivity> beanDef =\n                new SingletonBeanDefinition<>(activity,\n                                              JSSplashScreenActivity.class,\n                                              qualifiers,\n                                              newNativePlugin.getId(),\n                                              true,\n                                              SplashScreenActivity.class,\n                                              Activity.class);\n        beanManager.registerBean(beanDef);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          SplashScreenActivity.class);\n        beanManager.registerBeanTypeAlias(beanDef,\n                                          Activity.class);\n\n        activityBeansCache.addNewSplashScreenActivity(beanManager.lookupBeans(newNativePlugin.getId()).iterator().next());\n    }\n\n    @Override\n    public void export() {\n        publish();\n    }\n\n    private native void publish() /*-{\n        $wnd.$registerSplashScreen = @org.uberfire.client.exporter.SplashScreenJSExporter::registerSplashScreen(Ljava/lang/Object;);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/UberfireJSAPIExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.util.Collection;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.workbench.events.UberfireJSAPIReadyEvent;\n\n@EntryPoint\npublic class UberfireJSAPIExporter {\n\n    @Inject\n    Event<UberfireJSAPIReadyEvent> jsapiReadyEvent;\n\n    @PostConstruct\n    public void export() {\n        Collection<SyncBeanDef<UberfireJSExporter>> jsAPIs = IOC.getBeanManager().lookupBeans(UberfireJSExporter.class);\n        for (SyncBeanDef<UberfireJSExporter> bean : jsAPIs) {\n            UberfireJSExporter jsAPI = bean.getInstance();\n            jsAPI.export();\n        }\n        if (!jsAPIs.isEmpty()) {\n            jsapiReadyEvent.fire(new UberfireJSAPIReadyEvent());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/UberfireJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\npublic interface UberfireJSExporter {\n\n    public void export();\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/exporter/VFSJSExporter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\n\n@ApplicationScoped\npublic class VFSJSExporter implements UberfireJSExporter {\n\n    @Inject\n    Caller<VFSService> vfsServices;\n\n    @Override\n    public void export() {\n        publish(this);\n    }\n\n    private native void publish(VFSJSExporter js)/*-{\n        $wnd.$vfs_write = function (uri, content, callback) {\n            js.@org.uberfire.client.exporter.VFSJSExporter::write(Ljava/lang/String;Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)(uri, content, callback)\n        }\n        $wnd.$vfs_readAllString = function (uri, callback) {\n            js.@org.uberfire.client.exporter.VFSJSExporter::readAllString(Ljava/lang/String;Lcom/google/gwt/core/client/JavaScriptObject;)(uri, callback)\n        }\n    }-*/;\n\n    public void write(final String uri,\n                      final String content,\n                      final JavaScriptObject callback) {\n\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path path) {\n                vfsServices.call(new RemoteCallback<Path>() {\n                    @Override\n                    public void callback(final Path response) {\n                        executeNativeCallback(callback,\n                                              true);\n                    }\n                }).write(path,\n                         content);\n            }\n        }).get(uri);\n    }\n\n    public void readAllString(final String uri,\n                              final JavaScriptObject callback) {\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path o) {\n                vfsServices.call(new RemoteCallback<String>() {\n                    @Override\n                    public void callback(final String response) {\n                        executeNativeCallback(callback,\n                                              response);\n                    }\n                }).readAllString(o);\n            }\n        }).get(uri);\n    }\n\n    private native void executeNativeCallback(JavaScriptObject callback,\n                                              Object param) /*-{\n        callback(param);\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/perspective/JSNativePerspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.perspective;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\nimport com.google.gwt.json.client.JSONObject;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.plugin.JSNativePlugin;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.jsbridge.client.JsPlaceRequest;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.ContextDisplayMode;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@Dependent\npublic class JSNativePerspective {\n\n    @Inject\n    private PanelManager panelManager;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private ActivityManager activityManager;\n\n    @Inject\n    private WorkbenchServicesProxy wbServices;\n\n    private JavaScriptObject obj;\n\n    private static native JSPanelDefinition getView(final JavaScriptObject o) /*-{\n        return o.view;\n    }-*/;\n\n    private static native void executeOnStartup(final JavaScriptObject o,\n                                                JsPlaceRequest place) /*-{\n        o.on_open(place);\n    }-*/;\n\n    private static native void executeOnOpen(final JavaScriptObject o) /*-{\n        o.on_open();\n    }-*/;\n\n    private static native void executeOnClose(final JavaScriptObject o) /*-{\n        o.on_close();\n    }-*/;\n\n    private static native void executeOnShutdown(final JavaScriptObject o) /*-{\n        o.on_shutdown();\n    }-*/;\n\n    public void build(final JavaScriptObject obj) {\n        if (this.obj != null) {\n            throw new RuntimeException(\"Can't build more than once.\");\n        }\n        this.obj = obj;\n    }\n\n    public native String getId()  /*-{\n        return this.@org.uberfire.client.perspective.JSNativePerspective::obj.id;\n    }-*/;\n\n    public native boolean isDefault()  /*-{\n        if ((typeof this.@org.uberfire.client.perspective.JSNativePerspective::obj.is_default === \"boolean\")) {\n            return this.@org.uberfire.client.perspective.JSNativePerspective::obj.is_default;\n        }\n        return false;\n    }-*/;\n\n    public native boolean isTransient()  /*-{\n        var jso = this.@org.uberfire.client.perspective.JSNativePerspective::obj;\n        if ((typeof jso.is_transient === \"boolean\")) {\n            return jso.is_transient;\n        }\n        return true;\n    }-*/;\n\n    private native String getPanelTypeAsString()  /*-{\n        return this.@org.uberfire.client.perspective.JSNativePerspective::obj.panel_type;\n    }-*/;\n\n    private native String getContextDisplayModeAsString()  /*-{\n        return this.@org.uberfire.client.perspective.JSNativePerspective::obj.context_display_mode;\n    }-*/;\n\n    private native String getContextId()  /*-{\n        return this.@org.uberfire.client.perspective.JSNativePerspective::obj.context_id;\n    }-*/;\n\n    public void onStartup(final PlaceRequest place) {\n        if (JSNativePlugin.hasMethod(obj,\n                                     \"on_startup\")) {\n\n            executeOnStartup(obj,\n                             JsPlaceRequest.fromPlaceRequest(place));\n        }\n    }\n\n    public void onOpen() {\n        if (JSNativePlugin.hasMethod(obj,\n                                     \"on_open\")) {\n            executeOnOpen(obj);\n        }\n    }\n\n    public void onClose() {\n        if (JSNativePlugin.hasMethod(obj,\n                                     \"on_close\")) {\n            executeOnClose(obj);\n        }\n    }\n\n    public void onShutdown() {\n        if (JSNativePlugin.hasMethod(obj,\n                                     \"on_shutdown\")) {\n            executeOnShutdown(obj);\n        }\n    }\n\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition perspectiveDefinition = new PerspectiveDefinitionImpl(getDefaultPanelType());\n        perspectiveDefinition.setName(getId());\n        final String contextId = getContextId();\n        if (contextId != null) {\n            perspectiveDefinition.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(contextId)));\n        }\n        perspectiveDefinition.setContextDisplayMode(getContextDisplayMode());\n\n        final JSPanelDefinition view = getView(obj);\n\n        final JsArray<JSPartDefinition> parts = view.getParts();\n        final JsArray<JSPanelDefinition> panels = view.getChildren();\n\n        final PanelDefinition root = perspectiveDefinition.getRoot();\n\n        buildParts(root,\n                   parts);\n        buildPanels(root,\n                    panels);\n\n        return perspectiveDefinition;\n    }\n\n    private String getDefaultPanelType() {\n        return getPanelType(getPanelTypeAsString(),\n                            MultiTabWorkbenchPanelPresenter.class.getName());\n    }\n\n    private ContextDisplayMode getContextDisplayMode() {\n        return getContextDisplayMode(getContextDisplayModeAsString(),\n                                     ContextDisplayMode.SHOW);\n    }\n\n    private ContextDisplayMode getContextDisplayMode(final String contextDisplayMode,\n                                                     final ContextDisplayMode defaultType) {\n        if (contextDisplayMode == null) {\n            return defaultType;\n        }\n\n        try {\n            return ContextDisplayMode.valueOf(contextDisplayMode.toUpperCase());\n        } catch (Exception ex) {\n            return defaultType;\n        }\n    }\n\n    private String getPanelType(final String panelType,\n                                final String defaultType) {\n        if (panelType == null) {\n            return defaultType;\n        }\n        return panelType;\n    }\n\n    private void buildParts(final PanelDefinition panel,\n                            final JsArray<JSPartDefinition> parts) {\n        if (parts != null) {\n            for (int i = 0; i < parts.length(); i++) {\n                final JSPartDefinition part = parts.get(i);\n                final PlaceRequest placeRequest = new DefaultPlaceRequest(part.getPlaceName());\n\n                if (part.getParameters() != null) {\n                    final JSONObject json = new JSONObject(part.getParameters());\n                    for (final String key : json.keySet()) {\n                        placeRequest.addParameter(key,\n                                                  json.get(key).isString().stringValue());\n                    }\n                }\n\n                final PartDefinition partDefinition = new PartDefinitionImpl(placeRequest);\n                partDefinition.setContextDisplayMode(JSNativePerspective.this.getContextDisplayMode(part.getContextDisplayModeAsString(),\n                                                                                                    ContextDisplayMode.SHOW));\n                if (part.getContextId() != null) {\n                    partDefinition.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(part.getContextId())));\n                }\n\n                panel.addPart(partDefinition);\n            }\n        }\n    }\n\n    private void buildPanels(final PanelDefinition panel,\n                             final JsArray<JSPanelDefinition> panels) {\n        if (panels != null) {\n            for (int i = 0; i < panels.length(); i++) {\n                final JSPanelDefinition activePanelDef = panels.get(i);\n\n                final PanelDefinition newPanel = new PanelDefinitionImpl(getPanelType(activePanelDef.getPanelTypeAsString(),\n                                                                                      MultiTabWorkbenchPanelPresenter.class.getName()));\n\n                newPanel.setContextDisplayMode(JSNativePerspective.this.getContextDisplayMode(activePanelDef.getContextDisplayModeAsString(),\n                                                                                              ContextDisplayMode.SHOW));\n                if (activePanelDef.getContextId() != null) {\n                    newPanel.setContextDefinition(new ContextDefinitionImpl(new DefaultPlaceRequest(activePanelDef.getContextId())));\n                }\n\n                if (activePanelDef.getWidth() > 0) {\n                    newPanel.setWidth(activePanelDef.getWidth());\n                }\n\n                if (activePanelDef.getMinWidth() > 0) {\n                    newPanel.setMinWidth(activePanelDef.getMinWidth());\n                }\n\n                if (activePanelDef.getHeight() > 0) {\n                    newPanel.setHeight(activePanelDef.getHeight());\n                }\n\n                if (activePanelDef.getMinHeight() > 0) {\n                    newPanel.setHeight(activePanelDef.getMinHeight());\n                }\n\n                buildParts(newPanel,\n                           activePanelDef.getParts());\n\n                buildPanels(newPanel,\n                            activePanelDef.getChildren());\n\n                panel.insertChild(CompassPosition.valueOf(activePanelDef.getPosition().toUpperCase()),\n                                  newPanel);\n            }\n        }\n    }\n\n    public PanelManager getPanelManager() {\n        return panelManager;\n    }\n\n    public PlaceManager getPlaceManager() {\n        return placeManager;\n    }\n\n    public ActivityManager getActivityManager() {\n        return activityManager;\n    }\n\n    public WorkbenchServicesProxy getWbServices() {\n        return wbServices;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/perspective/JSPanelDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.perspective;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArray;\n\npublic class JSPanelDefinition extends JavaScriptObject {\n\n    protected JSPanelDefinition() {\n    }\n\n    public final native int getWidth() /*-{\n        if ((typeof this[\"width\"]) === \"number\") {\n            return this.width;\n        }\n        return -1;\n    }-*/;\n\n    public final native int getMinWidth() /*-{\n        if ((typeof this[\"min_width\"]) === \"number\") {\n            return this.min_width;\n        }\n        return -1;\n    }-*/;\n\n    public final native int getHeight() /*-{\n        if ((typeof this[\"height\"]) === \"number\") {\n            return this.height;\n        }\n        return -1;\n    }-*/;\n\n    public final native int getMinHeight() /*-{\n        if ((typeof this[\"min_height\"]) === \"number\") {\n            return this.min_height;\n        }\n        return -1;\n    }-*/;\n\n    public final native String getPosition() /*-{\n        return this.position;\n    }-*/;\n\n    public final native String getPanelTypeAsString() /*-{\n        return this.panel_type;\n    }-*/;\n\n    public final native JsArray<JSPartDefinition> getParts() /*-{\n        return this.parts;\n    }-*/;\n\n    public final native JsArray<JSPanelDefinition> getChildren() /*-{\n        return this.panels;\n    }-*/;\n\n    public final native String getContextId()  /*-{\n        return this.context_id;\n    }-*/;\n\n    public final native String getContextDisplayModeAsString()  /*-{\n        return this.context_display_mode;\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/perspective/JSPartDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.perspective;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic class JSPartDefinition extends JavaScriptObject {\n\n    protected JSPartDefinition() {\n    }\n\n    public final native String getPlaceName() /*-{\n        return this.place;\n    }-*/;\n\n    public final native JavaScriptObject getParameters() /*-{\n        return this.parameters;\n    }-*/;\n\n    public final native String getContextId()  /*-{\n        return this.context_id;\n    }-*/;\n\n    public final native String getContextDisplayModeAsString()  /*-{\n        return this.context_display_mode;\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/perspective/JSWorkbenchPerspectiveActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.perspective;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.inject.Alternative;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@Alternative\npublic class JSWorkbenchPerspectiveActivity implements PerspectiveActivity {\n\n    private final JSNativePerspective nativePerspective;\n    private PlaceRequest place;\n\n    public JSWorkbenchPerspectiveActivity(final JSNativePerspective nativePerspective) {\n        this.nativePerspective = nativePerspective;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n        nativePerspective.onStartup(place);\n    }\n\n    @Override\n    public void onOpen() {\n        nativePerspective.onOpen();\n    }\n\n    @Override\n    public void onClose() {\n        nativePerspective.onClose();\n    }\n\n    @Override\n    public void onShutdown() {\n        nativePerspective.onShutdown();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return nativePerspective.buildPerspective();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return nativePerspective.getId();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return nativePerspective.isDefault();\n    }\n\n    @Override\n    public boolean isTransient() {\n        return nativePerspective.isTransient();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/plugin/JSNativePlugin.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.plugin;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.jsbridge.client.JsPlaceRequest;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\n\npublic abstract class JSNativePlugin {\n\n    @Inject\n    protected RuntimePluginsServiceProxy runtimePluginsService;\n\n    protected JavaScriptObject obj;\n    protected Element element = null;\n\n    public static boolean hasTemplate(final JavaScriptObject obj) {\n        if (hasMethod(obj,\n                      \"template\") || hasMethod(obj,\n                                               \"templateUrl\")) {\n            return true;\n        }\n\n        return hasStringProperty(obj,\n                                 \"template\") || hasStringProperty(obj,\n                                                                  \"templateUrl\");\n    }\n\n    public static native boolean hasMethod(final JavaScriptObject obj,\n                                           final String methodName)  /*-{\n        return ((typeof obj[methodName]) === \"function\");\n    }-*/;\n\n    public static native boolean hasStringProperty(final JavaScriptObject obj,\n                                                   final String propertyName)  /*-{\n        return ((typeof obj[propertyName]) === \"string\");\n    }-*/;\n\n    public static native boolean hasIntProperty(final JavaScriptObject obj,\n                                                final String propertyName)  /*-{\n        return (obj[propertyName] === parseInt(obj[propertyName]));\n    }-*/;\n\n    public static native boolean hasBooleanProperty(final JavaScriptObject obj,\n                                                    final String propertyName)  /*-{\n        return ((typeof obj[propertyName]) === \"boolean\");\n    }-*/;\n\n    public static native boolean hasArrayProperty(final JavaScriptObject obj,\n                                                  final String propertyName)  /*-{\n        return ((obj.propertyName) instanceof Array);\n    }-*/;\n\n    private static native String getTemplateUrlFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.templateUrl();\n        if (typeof result === \"string\") {\n            return result;\n        }\n        return null;\n    }-*/;\n\n    private static native String getTemplateFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.template();\n        if (typeof result === \"string\") {\n            return result;\n        }\n        return null;\n    }-*/;\n\n    private static native String getContextIdFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.context_Id();\n        if (typeof result === \"string\") {\n            return result;\n        }\n        return null;\n    }-*/;\n\n    private static native String getTypeFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.type();\n        if (typeof result === \"string\") {\n            return result;\n        }\n        return null;\n    }-*/;\n\n    private static native String getTitleFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.title();\n        if (typeof result === \"string\") {\n            return result;\n        }\n        return null;\n    }-*/;\n\n    private static native void executeOnOpen(final JavaScriptObject o,\n                                             String URI) /*-{\n        o.on_open(URI);\n    }-*/;\n\n    private static native void executeOnOpen(final JavaScriptObject o) /*-{\n        o.on_open();\n    }-*/;\n\n    private static native void executeOnClose(final JavaScriptObject o) /*-{\n        o.on_close();\n    }-*/;\n\n    private static native void executeOnShutdown(final JavaScriptObject o) /*-{\n        o.on_shutdown();\n    }-*/;\n\n    private static native void executeOnStartup(final JavaScriptObject o,\n                                                String URI) /*-{\n        o.on_startup(URI);\n    }-*/;\n\n    private static native void executeOnStartup(final JavaScriptObject o,\n                                                final JsPlaceRequest place) /*-{\n        o.on_startup(place);\n    }-*/;\n\n    private static native void executeOnFocus(final JavaScriptObject o) /*-{\n        o.on_focus();\n    }-*/;\n\n    private static native void executeOnLostFocus(final JavaScriptObject o) /*-{\n        o.on_lost_focus();\n    }-*/;\n\n    private static native boolean executeOnMayClose(final JavaScriptObject o) /*-{\n        var result = o.type();\n        if (typeof result === \"boolean\") {\n            return result;\n        }\n        return true;\n    }-*/;\n\n    private static native String getType(final JavaScriptObject o) /*-{\n        return o.type;\n    }-*/;\n\n    private static native String getTitle(final JavaScriptObject o) /*-{\n        return o.title;\n    }-*/;\n\n    private static native String getContextId(final JavaScriptObject o) /*-{\n        return o.context_id;\n    }-*/;\n\n    private static native String getTemplate(final JavaScriptObject o) /*-{\n        return o.template;\n    }-*/;\n\n    private static native String getTemplateUrl(final JavaScriptObject o) /*-{\n        return o.templateUrl;\n    }-*/;\n\n    public void build(final JavaScriptObject obj) {\n        if (this.obj != null) {\n            throw new RuntimeException(\"Can't build more than once.\");\n        }\n        this.obj = obj;\n        buildElement();\n    }\n\n    public native String getId()  /*-{\n        return this.@org.uberfire.client.plugin.JSNativePlugin::obj.id;\n    }-*/;\n\n    public native String getPriority()  /*-{\n        return this.@org.uberfire.client.plugin.JSNativePlugin::obj.priority;\n    }-*/;\n\n    public Element getElement() {\n        return element;\n    }\n\n    public String getContextId() {\n        String contextId = null;\n\n        if (hasMethod(obj,\n                      \"context_id\")) {\n            contextId = getContextIdFunctionResult(obj);\n        } else if (hasStringProperty(obj,\n                                     \"context_id\")) {\n            contextId = getContextId(obj);\n        }\n\n        return contextId;\n    }\n\n    public String getTitle() {\n        String title = null;\n\n        if (hasMethod(obj,\n                      \"title\")) {\n            title = getTitleFunctionResult(obj);\n        } else if (hasStringProperty(obj,\n                                     \"title\")) {\n            title = getTitle(obj);\n        }\n\n        if (title == null) {\n            title = getId();\n        }\n\n        return title;\n    }\n\n    public String getType() {\n        String type = null;\n\n        if (hasMethod(obj,\n                      \"type\")) {\n            type = getTypeFunctionResult(obj);\n        } else if (hasStringProperty(obj,\n                                     \"type\")) {\n            type = getType(obj);\n        }\n\n        if (type == null) {\n            type = \"\";\n        }\n\n        return type;\n    }\n\n    public void onOpen() {\n        if (hasMethod(obj,\n                      \"on_open\")) {\n            executeOnOpen(obj);\n        }\n    }\n\n    public void onOpen(String URI) {\n        if (hasMethod(obj,\n                      \"on_open\")) {\n            executeOnOpen(obj,\n                          URI);\n        }\n    }\n\n    public void onClose() {\n        if (hasMethod(obj,\n                      \"on_close\")) {\n            executeOnClose(obj);\n        }\n    }\n\n    public void onFocus() {\n        if (hasMethod(obj,\n                      \"on_focus\")) {\n            executeOnFocus(obj);\n        }\n    }\n\n    public void onLostFocus() {\n        if (hasMethod(obj,\n                      \"on_lost_focus\")) {\n            executeOnLostFocus(obj);\n        }\n    }\n\n    public boolean onMayClose() {\n        if (hasMethod(obj,\n                      \"on_may_close\")) {\n            return executeOnMayClose(obj);\n        }\n        return true;\n    }\n\n    protected void buildElement() {\n        final String content;\n        final String contentUrl;\n        if (hasMethod(obj,\n                      \"templateUrl\")) {\n            contentUrl = getTemplateUrlFunctionResult(obj);\n            content = null;\n        } else if (hasMethod(obj,\n                             \"template\")) {\n            content = getTemplateFunctionResult(obj);\n            contentUrl = null;\n        } else if (hasStringProperty(obj,\n                                     \"templateUrl\")) {\n            contentUrl = getTemplateUrl(obj);\n            content = null;\n        } else if (hasStringProperty(obj,\n                                     \"template\")) {\n            content = getTemplate(obj);\n            contentUrl = null;\n        } else {\n            content = null;\n            contentUrl = null;\n        }\n\n        element = new SimplePanel(new Label(\"Loading\")).getElement();\n        if (content != null) {\n            element = new HTML(new SafeHtmlBuilder().appendHtmlConstant(content).toSafeHtml()).getElement();\n        } else if (contentUrl != null) {\n            runtimePluginsService.getTemplateContent(contentUrl,\n                                                     new ParameterizedCommand<String>() {\n                                                         @Override\n                                                         public void execute(String parameter) {\n                                                             element = new HTML(new SafeHtmlBuilder().appendHtmlConstant(parameter).toSafeHtml()).getElement();\n                                                         }\n                                                     });\n        } else {\n            element = null;\n        }\n    }\n\n    public void onStartup(String URI) {\n        if (hasMethod(obj,\n                      \"on_startup\")) {\n            executeOnStartup(obj,\n                             URI);\n        }\n    }\n\n    public void onStartup(PlaceRequest place) {\n        if (hasMethod(obj,\n                      \"on_startup\")) {\n            executeOnStartup(obj,\n                             JsPlaceRequest.fromPlaceRequest(place));\n        }\n    }\n\n    public void onShutdown() {\n        if (hasMethod(obj,\n                      \"on_shutdown\")) {\n            executeOnShutdown(obj);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/plugin/RuntimePluginsServiceProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.plugin;\n\nimport java.util.Collection;\n\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface RuntimePluginsServiceProxy {\n\n    void getTemplateContent(final String contentUrl,\n                            final ParameterizedCommand<String> command);\n\n    void listFrameworksContent(final ParameterizedCommand<Collection<String>> command);\n\n    void listPluginsContent(final ParameterizedCommand<Collection<String>> command);\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/plugin/RuntimePluginsServiceProxyClientImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.plugin;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.AnchorElement;\nimport com.google.gwt.dom.client.NodeList;\nimport com.google.gwt.http.client.Request;\nimport com.google.gwt.http.client.RequestBuilder;\nimport com.google.gwt.http.client.RequestCallback;\nimport com.google.gwt.http.client.RequestException;\nimport com.google.gwt.http.client.Response;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.Element;\nimport org.slf4j.Logger;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * Searches for runtime plugins and frameworks by parsing the directory listing at <tt>${appBase}/plugins/</tt> or\n * <tt>${appBase}/plugins/</tt> respectively. Any {@code <a>} tag with an href whose URI ends in <tt>.js</tt> will\n * qualify as a runtime plugin or framework, and its contents will be fetched with a separate request. Normally, this\n * will be compatible with any web server's built-in directory listing feature. If it isn't, just manually add an\n * <tt>index.html</tt> file that has links to the .js files you care about.\n */\n@Dependent\n@Alternative\npublic class RuntimePluginsServiceProxyClientImpl implements RuntimePluginsServiceProxy {\n\n    @Inject\n    private Logger logger;\n\n    @Override\n    public void getTemplateContent(final String contentUrl,\n                                   final ParameterizedCommand<String> command) {\n        RequestBuilder contentRb = new RequestBuilder(RequestBuilder.GET,\n                                                      \"plugins/\" + contentUrl);\n        try {\n            contentRb.sendRequest(null,\n                                  new RequestCallback() {\n\n                                      @Override\n                                      public void onResponseReceived(Request request,\n                                                                     Response response) {\n                                          command.execute(response.getText());\n                                      }\n\n                                      @Override\n                                      public void onError(Request request,\n                                                          Throwable ex) {\n                                          logger.warn(\"Error in template content request for \" + contentUrl,\n                                                      ex);\n                                          command.execute(null);\n                                      }\n                                  });\n        } catch (RequestException ex) {\n            logger.warn(\"Couldn't load template content at \" + contentUrl,\n                        ex);\n            command.execute(null);\n        }\n    }\n\n    @Override\n    public void listFrameworksContent(ParameterizedCommand<Collection<String>> command) {\n        findAndFetchContent(\"frameworks/\",\n                            \".js\",\n                            \"framework\",\n                            command);\n    }\n\n    @Override\n    public void listPluginsContent(final ParameterizedCommand<Collection<String>> command) {\n        findAndFetchContent(\"plugins/\",\n                            \".js\",\n                            \"plugin\",\n                            command);\n    }\n\n    private void findAndFetchContent(final String relativeUri,\n                                     final String filenameExtension,\n                                     final String fileType,\n                                     final ParameterizedCommand<Collection<String>> doWhenFinished) {\n        RequestBuilder rb = new RequestBuilder(RequestBuilder.GET,\n                                               relativeUri);\n        try {\n            rb.sendRequest(null,\n                           new RequestCallback() {\n\n                               @Override\n                               public void onResponseReceived(Request request,\n                                                              Response response) {\n                                   final List<String> pluginUrls = new ArrayList<String>();\n                                   final List<String> pluginContents = new ArrayList<String>();\n                                   final int[] contentErrors = new int[1];\n\n                                   Element detachedDiv = DOM.createDiv();\n                                   detachedDiv.setInnerHTML(response.getText());\n                                   NodeList<com.google.gwt.dom.client.Element> links = detachedDiv.getElementsByTagName(\"a\");\n                                   for (int i = 0; i < links.getLength(); i++) {\n                                       AnchorElement aElem = (AnchorElement) links.getItem(i);\n\n                                       // DOM spec says these are already absolutized for us. Nice!\n                                       String href = aElem.getHref();\n\n                                       if (href.endsWith(filenameExtension)) {\n                                           pluginUrls.add(href);\n                                       }\n                                   }\n\n                                   if (pluginUrls.size() == 0) {\n                                       doWhenFinished.execute(Collections.<String>emptyList());\n                                       return;\n                                   }\n\n                                   for (final String href : pluginUrls) {\n                                       RequestBuilder contentRb = new RequestBuilder(RequestBuilder.GET,\n                                                                                     href);\n                                       try {\n                                           contentRb.sendRequest(null,\n                                                                 new RequestCallback() {\n\n                                                                     @Override\n                                                                     public void onResponseReceived(Request request,\n                                                                                                    Response response) {\n                                                                         if (response.getStatusCode() == 200) {\n                                                                             pluginContents.add(response.getText());\n                                                                         } else {\n                                                                             contentErrors[0]++;\n                                                                         }\n                                                                         if (pluginContents.size() >= pluginUrls.size() + contentErrors[0]) {\n                                                                             doWhenFinished.execute(pluginContents);\n                                                                         }\n                                                                     }\n\n                                                                     @Override\n                                                                     public void onError(Request request,\n                                                                                         Throwable exception) {\n                                                                         logger.warn(\"Error in \" + fileType + \" content request for \" + href);\n                                                                         contentErrors[0]++;\n                                                                         if (pluginContents.size() >= pluginUrls.size() + contentErrors[0]) {\n                                                                             doWhenFinished.execute(pluginContents);\n                                                                         }\n                                                                     }\n                                                                 });\n                                       } catch (RequestException ex) {\n                                           logger.warn(\"Failed to send request for \" + fileType + \" \" + href,\n                                                       ex);\n                                           contentErrors[0]++;\n                                           if (pluginContents.size() >= pluginUrls.size() + contentErrors[0]) {\n                                               doWhenFinished.execute(pluginContents);\n                                           }\n                                       }\n                                   }\n                               }\n\n                               @Override\n                               public void onError(Request request,\n                                                   Throwable ex) {\n                                   logger.warn(\"Error in \" + fileType + \" list request. Not loading JS \" + fileType + \"s.\",\n                                               ex);\n                                   doWhenFinished.execute(Collections.<String>emptyList());\n                               }\n                           });\n        } catch (RequestException ex) {\n            logger.warn(\"Couldn't load JS \" + fileType + \". Continuing without runtime \" + fileType + \"s.\",\n                        ex);\n            doWhenFinished.execute(Collections.<String>emptyList());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/screen/JSNativeScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screen;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.client.plugin.JSNativePlugin;\n\n@Dependent\npublic class JSNativeScreen extends JSNativePlugin {\n\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/screen/JSWorkbenchScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screen;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.inject.Alternative;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@Alternative\npublic class JSWorkbenchScreenActivity implements WorkbenchScreenActivity {\n\n    private final PlaceManager placeManager;\n\n    private PlaceRequest place;\n\n    private JSNativeScreen nativePlugin;\n\n    public JSWorkbenchScreenActivity(final JSNativeScreen nativePlugin,\n                                     final PlaceManager placeManager) {\n        this.nativePlugin = nativePlugin;\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    public void onStartup(PlaceRequest place) {\n        this.place = place;\n        nativePlugin.onStartup(place);\n    }\n\n    public void setNativePlugin(JSNativeScreen nativePlugin) {\n        this.nativePlugin = nativePlugin;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return nativePlugin.getId();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.SCREEN;\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return nativePlugin.onMayClose();\n    }\n\n    @Override\n    public void onClose() {\n        nativePlugin.onClose();\n        placeManager.executeOnCloseCallbacks(place);\n    }\n\n    @Override\n    public void onShutdown() {\n        nativePlugin.onShutdown();\n    }\n\n    @Override\n    public Position getDefaultPosition() {\n        return CompassPosition.ROOT;\n    }\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return null;\n    }\n\n    @Override\n    public void onFocus() {\n        nativePlugin.onFocus();\n    }\n\n    @Override\n    public void onLostFocus() {\n        nativePlugin.onLostFocus();\n    }\n\n    @Override\n    public String getTitle() {\n        return nativePlugin.getTitle();\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return new HTML(nativePlugin.getElement().getInnerHTML());\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    @Override\n    public void onOpen() {\n        Scheduler.get().scheduleDeferred(() -> {\n            if (nativePlugin.getType() != null && nativePlugin.getType().equalsIgnoreCase(\"angularjs\")) {\n                bind();\n            }\n\n            nativePlugin.onOpen();\n            placeManager.executeOnOpenCallbacks(place);\n        });\n    }\n\n    // Alias registerPlugin with a global JS function.\n    private native String bind() /*-{\n        var apps = $wnd.document.querySelectorAll('[ng-app]'), i;\n\n        for (i = 0; i < apps.length; ++i) {\n            var element = $wnd.angular.element(apps[i]);\n            if (!element.injector()) {\n                var value = apps[i].attributes[\"ng-app\"].value;\n                if (value) {\n                    $wnd.angular.bootstrap(element, [value]);\n                } else {\n                    $wnd.angular.bootstrap(element, []);\n                }\n            }\n        }\n    }-*/;\n\n    @Override\n    public String contextId() {\n        return nativePlugin.getContextId();\n    }\n\n    @Override\n    public int preferredHeight() {\n        return -1;\n    }\n\n    @Override\n    public int preferredWidth() {\n        return -1;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/splash/JSNativeSplashScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.splash;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.core.client.JsArrayString;\nimport org.uberfire.client.plugin.JSNativePlugin;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.workbench.model.impl.SplashScreenFilterImpl;\n\nimport static java.util.Collections.emptyList;\n\n@Dependent\npublic class JSNativeSplashScreen extends JSNativePlugin {\n\n    private Integer bodyHeight = null;\n\n    @Inject\n    private WorkbenchServicesProxy wbServices;\n\n    private static native boolean getDisplayNextTimeFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.display_next_time();\n        if (typeof result === \"boolean\") {\n            return result;\n        }\n        return false;\n    }-*/;\n\n    private static native boolean getDisplayNextTime(final JavaScriptObject o) /*-{\n        return o.display_next_time;\n    }-*/;\n\n    private static native JsArrayString getInterceptionPointsFunctionResult(final JavaScriptObject o) /*-{\n        var result = o.interception_points();\n        if (result instanceof Array) {\n            return result;\n        }\n        return [];\n    }-*/;\n\n    private static native JsArrayString getInterceptionPoints(final JavaScriptObject o) /*-{\n        return o.interception_points;\n    }-*/;\n\n    private static native int getBodyHeight(final JavaScriptObject o) /*-{\n        return o.body_height;\n    }-*/;\n\n    private static native boolean getIsEnabled(final JavaScriptObject o) /*-{\n        return o.enabled;\n    }-*/;\n\n    public WorkbenchServicesProxy getWbServices() {\n        return wbServices;\n    }\n\n    protected void buildElement() {\n        super.buildElement();\n\n        if (hasIntProperty(obj,\n                           \"body_height\")) {\n            bodyHeight = getBodyHeight(obj);\n        } else {\n            bodyHeight = null;\n        }\n    }\n\n    public Integer getBodyHeight() {\n        return bodyHeight;\n    }\n\n    public SplashScreenFilter buildFilter() {\n        boolean displayNextTime = true;\n        JsArrayString interceptionPoints = null;\n\n        if (hasMethod(obj,\n                      \"display_next_time\")) {\n            displayNextTime = getDisplayNextTimeFunctionResult(obj);\n        } else if (hasBooleanProperty(obj,\n                                      \"display_next_time\")) {\n            displayNextTime = getDisplayNextTime(obj);\n        }\n\n        if (hasMethod(obj,\n                      \"interception_points\")) {\n            interceptionPoints = getInterceptionPointsFunctionResult(obj);\n        } else {\n            interceptionPoints = getInterceptionPoints(obj);\n        }\n\n        return new SplashScreenFilterImpl(getId(),\n                                          displayNextTime,\n                                          toCollection(interceptionPoints));\n    }\n\n    public boolean isEnabled() {\n        if (hasBooleanProperty(obj,\n                               \"enabled\")) {\n            return getIsEnabled(obj);\n        }\n        return true;\n    }\n\n    private Collection<String> toCollection(final JsArrayString interceptionPoints) {\n        if (interceptionPoints == null || interceptionPoints.length() == 0) {\n            return emptyList();\n        }\n\n        final Collection<String> result = new ArrayList<String>();\n        for (int i = 0; i < interceptionPoints.length(); i++) {\n            result.add(interceptionPoints.get(i));\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/java/org/uberfire/client/splash/JSSplashScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.splash;\n\nimport javax.enterprise.inject.Alternative;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n@Alternative\npublic class JSSplashScreenActivity implements SplashScreenActivity {\n\n    private final SplashView splash;\n    private Boolean showAgain = Boolean.TRUE;\n    private Boolean isEnabled = Boolean.TRUE;\n    private SplashScreenFilter splashFilter;\n    private JSNativeSplashScreen nativeSplashScreen;\n    private PlaceRequest place;\n\n    public JSSplashScreenActivity(final JSNativeSplashScreen nativeSplashScreen,\n                                  final SplashView splashView) {\n        this.nativeSplashScreen = nativeSplashScreen;\n        this.splash = splashView;\n        this.isEnabled = nativeSplashScreen.isEnabled();\n        this.splashFilter = nativeSplashScreen.buildFilter();\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n\n        nativeSplashScreen.getWbServices().loadSplashScreenFilter(getFilter().getName(),\n                                                                  new ParameterizedCommand<SplashScreenFilter>() {\n                                                                      @Override\n                                                                      public void execute(final SplashScreenFilter response) {\n                                                                          if (response != null) {\n                                                                              splashFilter = response;\n                                                                          }\n                                                                          init();\n                                                                      }\n                                                                  });\n\n        nativeSplashScreen.onStartup(place);\n    }\n\n    public void setNativeSplashScreen(JSNativeSplashScreen nativeSplashScreen) {\n        this.nativeSplashScreen = nativeSplashScreen;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return nativeSplashScreen.getId();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.SPLASH;\n    }\n\n    public void init() {\n        if (!splashFilter.displayNextTime()) {\n            return;\n        }\n        forceShow();\n    }\n\n    @Override\n    public String getTitle() {\n        return nativeSplashScreen.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return new HTML(nativeSplashScreen.getElement().getInnerHTML());\n    }\n\n    @Override\n    public Integer getBodyHeight() {\n        return nativeSplashScreen.getBodyHeight();\n    }\n\n    @Override\n    public SplashScreenFilter getFilter() {\n        return splashFilter;\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public void onOpen() {\n        nativeSplashScreen.onOpen();\n    }\n\n    @Override\n    public void closeIfOpen() {\n        if (splash.isAttached()) {\n            splash.hide();\n            onClose();\n        }\n    }\n\n    @Override\n    public void forceShow() {\n        final IsWidget widget = getWidget();\n\n        splash.setContent(widget,\n                          getBodyHeight());\n        splash.setTitle(getTitle());\n        splash.show();\n        splash.addCloseHandler(new CloseHandler<SplashView>() {\n            @Override\n            public void onClose(final CloseEvent<SplashView> event) {\n                JSSplashScreenActivity.this.onClose();\n            }\n        });\n    }\n\n    @Override\n    public void onClose() {\n        nativeSplashScreen.onClose();\n        saveState();\n    }\n\n    @Override\n    public void onShutdown() {\n        nativeSplashScreen.onShutdown();\n    }\n\n    @Override\n    public Boolean intercept(final PlaceRequest intercepted) {\n        if (splashFilter == null) {\n            return false;\n        }\n        for (final String interceptPoint : splashFilter.getInterceptionPoints()) {\n            if (intercepted.getIdentifier().equals(interceptPoint)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return isEnabled;\n    }\n\n    private void saveState() {\n        showAgain = splash.showAgain();\n        if (showAgain != null) {\n            splashFilter.setDisplayNextTime(showAgain);\n            nativeSplashScreen.getWbServices().save(splashFilter);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-js/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-js/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-js/src/main/resources/org/uberfire/UberfireJS.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.UberfireClientAPI\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.UberfireBackend\"/>\n  <inherits name=\"org.uberfire.jsbridge.AppFormerJsBridge\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-js/src/test/java/org/uberfire/client/exporter/JSExporterUtilsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.exporter;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.screen.JSNativeScreen;\nimport org.uberfire.client.screen.JSWorkbenchScreenActivity;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class JSExporterUtilsTest {\n\n    private SyncBeanManager beanManager;\n\n    private JSWorkbenchScreenActivity screenActivity;\n\n    private JSNativeScreen screen;\n\n    @Before\n    public void setup() {\n        beanManager = mock(SyncBeanManager.class);\n        screen = mock(JSNativeScreen.class);\n        screenActivity = new JSWorkbenchScreenActivity(screen,\n                                                       mock(PlaceManager.class));\n        when(screen.getId()).thenReturn(\"id\");\n    }\n\n    @Test\n    public void testUpdateExistentActivity() {\n        List<SyncBeanDef> activities = new ArrayList<SyncBeanDef>();\n        activities.add(createActivityBeanDef(screenActivity));\n        when(beanManager.lookupBeans(any(String.class))).thenReturn(activities);\n\n        JSWorkbenchScreenActivity activity = JSExporterUtils.findActivityIfExists(beanManager,\n                                                                                  screen.getId(),\n                                                                                  JSWorkbenchScreenActivity.class);\n\n        assertNotNull(activity);\n    }\n\n    @Test\n    public void testTryUpdatingUnexistentActivity() {\n        List<SyncBeanDef> activities = new ArrayList<SyncBeanDef>();\n        when(beanManager.lookupBeans(any(String.class))).thenReturn(activities);\n\n        JSWorkbenchScreenActivity activity = JSExporterUtils.findActivityIfExists(beanManager,\n                                                                                  screen.getId(),\n                                                                                  JSWorkbenchScreenActivity.class);\n\n        assertNull(activity);\n    }\n\n    private SyncBeanDef createActivityBeanDef(Activity activity) {\n        return new SyncBeanDef() {\n            @Override\n            public Object getInstance() {\n                return activity;\n            }\n\n            @Override\n            public Object newInstance() {\n                return null;\n            }\n\n            @Override\n            public boolean isAssignableTo(final Class aClass) {\n                return false;\n            }\n\n            @Override\n            public Class getType() {\n                return null;\n            }\n\n            @Override\n            public Class<?> getBeanClass() {\n                return null;\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return null;\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n                return null;\n            }\n\n            @Override\n            public boolean matches(final Set set) {\n                return false;\n            }\n\n            @Override\n            public String getName() {\n                return null;\n            }\n\n            @Override\n            public boolean isActivated() {\n                return false;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-m2repo-editor/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <!-- UberFire M2_REPO editor-->\n  <artifactId>uberfire-m2repo-editor</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - M2_REPO</name>\n\n  <modules>\n    <module>uberfire-m2repo-editor-api</module>\n    <module>uberfire-m2repo-editor-client</module>\n    <module>uberfire-m2repo-editor-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-m2repo-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-m2repo-editor-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - M2_REPO API</name>\n  <description>UberFire - M2_REPO API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-workingset-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-services-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-structure-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/exception/InvalidValueException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.m2repo.exception;\n\npublic class InvalidValueException\n        extends Exception {\n\n    public InvalidValueException(String details) {\n        super(details);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/model/HTMLFileManagerFields.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.model;\n\n/**\n * This is a central location for all form fields use in HTML forms for submission to the file servlet.\n * The all must be unique, of course.\n */\npublic class HTMLFileManagerFields {\n\n    //Name for Upload Form control\n    public static final String UPLOAD_FIELD_NAME_ATTACH = \"fileUploadElement\";\n\n    //Upload field for GroupID\n    public static final String GROUP_ID = \"groupId\";\n\n    //Upload field for ArtifactID\n    public static final String ARTIFACT_ID = \"artifactId\";\n\n    //Upload field for Version\n    public static final String VERSION_ID = \"version\";\n\n    //Indicator for uploaded JAR contains no pom.xml or pom.properties\n    public static final String UPLOAD_MISSING_POM = \"MISSING_POM\";\n\n    //Indicator for uploaded pom.xml file could not be parsed\n    public static final String UPLOAD_UNABLE_TO_PARSE_POM = \"UNABLE_TO_PARSE_POM\";\n\n    //Indicator for upload being successful\n    public static final String UPLOAD_OK = \"OK\";\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/model/JarListPageRequest.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\npackage org.guvnor.m2repo.model;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.paging.PageRequest;\n\n/**\n * A request for GuvnorM2Repository content\n */\n@Portable\npublic class JarListPageRequest extends PageRequest {\n\n    public static final String COLUMN_NAME = \"org.guvnor.m2repo.model.name\";\n\n    public static final String COLUMN_PATH = \"org.guvnor.m2repo.model.path\";\n\n    public static final String COLUMN_GAV = \"org.guvnor.m2repo.model.gav\";\n\n    public static final String COLUMN_LAST_MODIFIED = \"org.guvnor.m2repo.model.last.modified\";\n\n    private String filters;\n    private List<String> fileFormats;\n    private String dataSourceName;\n    private boolean isAscending;\n\n    public JarListPageRequest(@MapsTo(\"startRowIndex\") final int startRowIndex,\n                              @MapsTo(\"pageSize\") final Integer pageSize,\n                              @MapsTo(\"filters\") final String filters,\n                              @MapsTo(\"fileFormats\") final List<String> fileFormats,\n                              @MapsTo(\"dataSourceName\") final String dataSourceName,\n                              @MapsTo(\"isAscending\") final boolean isAscending) {\n        super(startRowIndex,\n              pageSize);\n        this.filters = filters;\n        this.fileFormats = fileFormats;\n        this.dataSourceName = dataSourceName;\n        this.isAscending = isAscending;\n    }\n\n    public String getFilters() {\n        return filters;\n    }\n\n    public List<String> getFileFormats() {\n        return fileFormats;\n    }\n\n    public String getDataSourceName() {\n        return dataSourceName;\n    }\n\n    public boolean isAscending() {\n        return isAscending;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/model/JarListPageRow.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\npackage org.guvnor.m2repo.model;\n\nimport java.util.Date;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.paging.AbstractPageRow;\n\n/**\n * A single row of a paged data\n */\n@Portable\npublic class JarListPageRow extends AbstractPageRow {\n\n    private String name;\n    private String path;\n    private GAV gav;\n    private Date lastModified;\n    private String repository;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getPath() {\n        return path;\n    }\n\n    public void setPath(String path) {\n        this.path = path;\n    }\n\n    public GAV getGav() {\n        return gav;\n    }\n\n    public void setGav(GAV gav) {\n        this.gav = gav;\n    }\n\n    public Date getLastModified() {\n        return lastModified;\n    }\n\n    public void setLastModified(Date lastModified) {\n        this.lastModified = lastModified;\n    }\n\n    public String getRepositoryName() {\n        return repository;\n    }\n\n    public void setRepositoryName(final String repository) {\n        this.repository = repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/preferences/ArtifactRepositoryPreference.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.preferences;\n\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.impl.validation.NotEmptyValidator;\n\n@WorkbenchPreference(identifier = \"ArtifactRepositoryPreference\", bundleKey = \"ArtifactRepositoryPreference.Label\")\npublic class ArtifactRepositoryPreference implements BasePreference<ArtifactRepositoryPreference> {\n\n    @Property(bundleKey = \"ArtifactRepositoryPreference.GlobalM2RepoDir\",\n            validators = NotEmptyValidator.class)\n    private String globalM2RepoDir;\n\n    @Property(bundleKey = \"ArtifactRepositoryPreference.GlobalM2RepoDirEnabled\", formType = PropertyFormType.BOOLEAN)\n    private boolean globalM2RepoDirEnabled;\n\n    @Property(bundleKey = \"ArtifactRepositoryPreference.WorkspaceM2RepoDir\",\n            validators = NotEmptyValidator.class)\n    private String workspaceM2RepoDir;\n\n    @Property(bundleKey = \"ArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled\", formType = PropertyFormType.BOOLEAN)\n    private boolean workspaceM2RepoDirEnabled;\n\n    @Property(bundleKey = \"ArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled\", formType = PropertyFormType.BOOLEAN)\n    private boolean distributionManagementM2RepoDirEnabled;\n\n    public static String getGlobalM2RepoDirWithFallback() {\n        ArtifactRepositoryPreference artifactRepositoryPreference = new ArtifactRepositoryPreference();\n        artifactRepositoryPreference = artifactRepositoryPreference.defaultValue(artifactRepositoryPreference);\n        String global = artifactRepositoryPreference.getGlobalM2RepoDir();\n        if (global == null) {\n            global = \"repositories/kie/global\";\n        }\n        return global;\n    }\n\n    @Override\n    public ArtifactRepositoryPreference defaultValue(final ArtifactRepositoryPreference defaultValue) {\n        defaultValue.globalM2RepoDir = \"repositories/kie/global\";\n        defaultValue.workspaceM2RepoDir = \"repositories/kie/workspaces\";\n        defaultValue.globalM2RepoDirEnabled = true;\n        defaultValue.workspaceM2RepoDirEnabled = false;\n        defaultValue.distributionManagementM2RepoDirEnabled = true;\n        return defaultValue;\n    }\n\n    public String getGlobalM2RepoDir() {\n        return globalM2RepoDir;\n    }\n\n    public void setGlobalM2RepoDir(final String globalM2RepoDir) {\n        this.globalM2RepoDir = globalM2RepoDir.trim();\n    }\n\n    public String getWorkspaceM2RepoDir() {\n        return workspaceM2RepoDir;\n    }\n\n    public void setWorkspaceM2RepoDir(String workspaceM2RepoDir) {\n        this.workspaceM2RepoDir = workspaceM2RepoDir;\n    }\n\n    public boolean isGlobalM2RepoDirEnabled() {\n        return globalM2RepoDirEnabled;\n    }\n\n    public void setGlobalM2RepoDirEnabled(boolean globalM2RepoDirEnabled) {\n        this.globalM2RepoDirEnabled = globalM2RepoDirEnabled;\n    }\n\n    public boolean isWorkspaceM2RepoDirEnabled() {\n        return workspaceM2RepoDirEnabled;\n    }\n\n    public void setWorkspaceM2RepoDirEnabled(boolean workspaceM2RepoDirEnabled) {\n        this.workspaceM2RepoDirEnabled = workspaceM2RepoDirEnabled;\n    }\n\n    public boolean isDistributionManagementM2RepoDirEnabled() {\n        return distributionManagementM2RepoDirEnabled;\n    }\n\n    public void setDistributionManagementM2RepoDirEnabled(boolean distributionManagementM2RepoDirEnabled) {\n        this.distributionManagementM2RepoDirEnabled = distributionManagementM2RepoDirEnabled;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/security/MavenRepositoryPagedJarTableFeatures.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.security;\n\npublic interface MavenRepositoryPagedJarTableFeatures {\n\n    String JAR_DOWNLOAD = \"jar.download\";\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/service/M2RepoService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.service;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.paging.PageResponse;\n\n@Remote\npublic interface M2RepoService {\n\n    /**\n     * Retrieve the pom.xml from the given Path. The path may represent either a JAR, KJAR or pom.xml file\n     * @param path The path to the file\n     * @return The pom.xml text\n     */\n    String getPomText(String path);\n\n    /**\n     * Retrieve the GAV details from a JAR or KJAR\n     * @param path The path to the artifact\n     * @return The GAV within the artifact\n     */\n    GAV loadGAVFromJar(String path);\n\n    /**\n     * Query the repository for a list of artifacts\n     * @param pageRequest Request for required artifacts\n     * @return Response containing artifacts\n     */\n    PageResponse<JarListPageRow> listArtifacts(JarListPageRequest pageRequest);\n\n    /**\n     * Get the repository's URL\n     * @return A String representing the repository's URL relative to the container's root\n     */\n    String getRepositoryURL();\n\n    /**\n     * Retrieve the kmodule.xml from the given Path.\n     * @param path The path to the file\n     * @return The kmodule.xml text\n     */\n    String getKModuleText(String path);\n\n    /**\n     * Retrieve the kie-deployment-descriptor.xml from the given Path.\n     * @param path The path to the file\n     * @return The kie-deployment-descriptor.xml text\n     */\n    String getKieDeploymentDescriptorText(String path);\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/java/org/guvnor/m2repo/utils/FileNameUtilities.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.utils;\n\n/**\n * Utilities to validate file being uploaded to Guvnor's M2 Repository\n */\npublic class FileNameUtilities {\n\n    private FileNameUtilities() {\n    }\n\n    /**\n     * Is the file valid; i.e. either a JAR, KJAR or pom.xml file.\n     * @param fileName\n     * @return true if the file is either a JAR, KJAR or pom.xml file.\n     */\n    public static boolean isValid(final String fileName) {\n        return isJar(fileName) || isKJar(fileName) || isPom(fileName);\n    }\n\n    /**\n     * Is the file a JAR file. File names ending with \".jar\" are considered valid JAR files.\n     * @param fileName\n     * @return true if the file is a JAR file\n     */\n    public static boolean isJar(final String fileName) {\n        return endsWith(fileName,\n                        \".jar\");\n    }\n\n    /**\n     * Is the file a KJAR file. File names ending with \".kjar\" are considered valid KJAR files.\n     * It should be noted KJAR is not a recognised file extension; however it appears some Users\n     * are confusing talk of KJARS in Drools' documentation with a file extension and therefore,\n     * in the absence of any clarification from the Drools Core developers, we include such suffix.\n     * See https://bugzilla.redhat.com/show_bug.cgi?id=1201154 for examples.\n     * @param fileName\n     * @return true if the file is a KJAR file\n     */\n    public static boolean isKJar(final String fileName) {\n        return endsWith(fileName,\n                        \".kjar\");\n    }\n\n    /**\n     * Is the file a pom.xml file\n     * @param fileName\n     * @return true if the file is a pom.xml file\n     */\n    public static boolean isPom(final String fileName) {\n        return endsWith(fileName,\n                        \"pom.xml\");\n    }\n\n    /**\n     * Returns whether or not the provided path points to a .pom file.\n     * @param path path to the file\n     * @return true if the path points to a .pom file, otherwise false.\n     */\n    public static boolean isDeployedPom(final String path) {\n        return endsWith(path,\n                        \".pom\");\n    }\n\n    /**\n     * Returns whether or not the provided path ends in the provided suffix.\n     * @param path path to the file\n     * @param suffix the suffix to check\n     * @return true if the path ends in the provided suffix, otherwise false.\n     */\n    private static boolean endsWith(final String path,\n                                    final String suffix) {\n\n        return path != null && !path.trim().isEmpty() && path.toLowerCase().endsWith(suffix);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-api/src/main/resources/org/guvnor/m2repo/GuvnorM2RepoEditorAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.guvnor.common.services.project.GuvnorProjectAPI'/>\n  <inherits name=\"org.uberfire.java.nio.UberfireNIO2Model\"/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n\n  <source path=\"model\"/>\n  <source path=\"preferences\"/>\n  <source path=\"service\"/>\n  <source path=\"security\"/>\n  <source path=\"utils\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/.gitignore",
    "content": "/target\n/local\n/repositories\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-m2repo-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-m2repo-editor-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - M2_REPO Backend</name>\n  <description>UberFire - M2_REPO Backend</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-core</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.interceptor</groupId>\n          <artifactId>javax.interceptor-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-settings</artifactId>\n    </dependency>\n    <!-- Needed to make Guice (used by Maven) work in servlet and Java EE containers -->\n    <dependency>\n      <groupId>com.google.inject.extensions</groupId>\n      <artifactId>guice-servlet</artifactId>\n      <scope>runtime</scope>\n      <exclusions>\n        <exclusion>\n          <!-- Let's use the guice no_aop coming from kie-ci/maven-core -->\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.codehaus.plexus</groupId>\n      <artifactId>plexus-utils</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.eclipse.aether</groupId>\n      <artifactId>aether-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.eclipse.aether</groupId>\n      <artifactId>aether-util</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-m2repo-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-maven-integration</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-maven-support</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <!-- The version of commons-io in droolsjbpm-build-bootstrap pom is way too old-->\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-fileupload</groupId>\n      <artifactId>commons-fileupload</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.ant</groupId>\n      <artifactId>ant</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-module-junit4</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-api-mockito2</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/ArtifactImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.util.Map;\n\nimport org.eclipse.aether.artifact.Artifact;\n\npublic class ArtifactImpl implements Artifact {\n\n    private String groupId;\n    private String artifactId;\n    private String version;\n    private String baseVersion;\n    private boolean snapshot;\n    private String classifier;\n    private String extension;\n    private File file;\n    private Map<String, String> properties;\n\n    public ArtifactImpl(final File file) {\n        this.setFile(file);\n    }\n\n    @Override\n    public String getGroupId() {\n        return this.groupId;\n    }\n\n    @Override\n    public String getArtifactId() {\n        return this.artifactId;\n    }\n\n    @Override\n    public String getVersion() {\n        return this.version;\n    }\n\n    @Override\n    public Artifact setVersion(final String version) {\n        this.version = version;\n        return this;\n    }\n\n    @Override\n    public String getBaseVersion() {\n        return this.baseVersion;\n    }\n\n    @Override\n    public boolean isSnapshot() {\n        return this.snapshot;\n    }\n\n    @Override\n    public String getClassifier() {\n        return this.classifier;\n    }\n\n    @Override\n    public String getExtension() {\n        return this.extension;\n    }\n\n    @Override\n    public File getFile() {\n        return this.file;\n    }\n\n    @Override\n    public Artifact setFile(final File file) {\n        this.file = file;\n        return this;\n    }\n\n    @Override\n    public String getProperty(final String s,\n                              final String s1) {\n        return this.properties.getOrDefault(s,\n                                            s1);\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return this.properties;\n    }\n\n    @Override\n    public Artifact setProperties(final Map<String, String> map) {\n        this.properties = map;\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/ExtendedM2RepoService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.InputStream;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.service.M2RepoService;\n\npublic interface ExtendedM2RepoService extends M2RepoService {\n\n    /**\n     * Deploy JAR to all repositories (this includes Guvnor's internal Maven Repository,\n     * external Repositories configured by Distribution Management in the JAR's pom.xml\n     * and external Repositories configured by active Profiles in settings.xml).\n     * @param is InputStream holding JAR\n     * @param gav GAV representing the JAR\n     */\n    void deployJar(InputStream is,\n                   GAV gav);\n\n    /**\n     * Convenience method for unit tests - to avoid deploying to additional (possibly external) repositories\n     * @param is InputStream holding JAR\n     * @param gav GAV representing the JAR\n     */\n    void deployJarInternal(InputStream is,\n                           GAV gav);\n\n    /**\n     * Deploy POM to local Maven Repository and Workbench's remote Maven Repository.\n     * @param is InputStream holding POM\n     * @param gav GAV representing the POM\n     */\n    void deployPom(InputStream is,\n                   GAV gav);\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/FixNotMavenizedArtifactInfo.java",
    "content": "package org.guvnor.m2repo.backend.server;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Comparator;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.TreeMap;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static java.util.Comparator.naturalOrder;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.ARTIFACT_ID;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.GROUP_ID;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.VERSION;\n\n/**\n * This class aim to provide maven meta information for artifacts (.jar) that don't\n * have maven metadata built-in.\n * <p>\n * Maven auto-generate a `pom.properties` to store GAV information, and it also\n * embeds the original pom file into the produced artifacts. However, this meta information\n * is not always available if the artifact was created using a different system like ant.\n * Even if the artifact doesn't have the necessary embedded information, those artifacts can\n * be available in maven repositories, but the metadata are provided differently.\n * <p>\n * To build the GAV information out of a .jar file, this class uses as input a\n * `not-mavenized-artifacts.properties` from classpath that provides the feedback needed\n * to produce the required metadata. In case of an artifact is not listed in the input file,\n * this class won't be able to provide the GAV.\n */\npublic class FixNotMavenizedArtifactInfo {\n\n    private static final Logger logger = LoggerFactory.getLogger(FixNotMavenizedArtifactInfo.class);\n\n    //sort artifact names from longer to shorter, to prevent false-positive matches with artifactIds which are\n    // prefixes of other artifactIds (e.g. ant vs. ant-launcher)\n    private static final Comparator<String> LONG_BEFORE_SHORT_COMPARATOR = Comparator.comparing(String::length).reversed().thenComparing(naturalOrder());\n\n    private final TreeMap<String, String[]> notMavenizedArtifacts = new TreeMap<>(LONG_BEFORE_SHORT_COMPARATOR);\n\n    private static final String POM_TEMPLATE = \"<project xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n            \"         xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n\" +\n            \"         xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\">\\n\" +\n            \"\\n\" +\n            \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n            \"  <groupId>{groupId}</groupId>\\n\" +\n            \"  <artifactId>{artifactId}</artifactId>\\n\" +\n            \"  <version>{version}</version>\\n\" +\n            \"  <packaging>jar</packaging>\\n\" +\n            \"</project>\";\n\n    public FixNotMavenizedArtifactInfo() {\n        final Properties notMavenizedArtifactsProps = new Properties();\n        try {\n            final InputStream isNotMavenizedArtifacts = M2ServletContextListener.class.getResourceAsStream(\"/not-mavenized-artifacts.properties\");\n            if (isNotMavenizedArtifacts != null) {\n                notMavenizedArtifactsProps.load(isNotMavenizedArtifacts);\n            }\n            for (Map.Entry<Object, Object> entry : notMavenizedArtifactsProps.entrySet()) {\n                notMavenizedArtifacts.put(entry.getKey().toString() + \"-\", entry.getValue().toString().split(\":\"));\n            }\n        } catch (IOException e) {\n            logger.error(e.getMessage(), e);\n        }\n    }\n\n    public Properties getProperties(final String filePath) {\n        final Properties result = new Properties();\n        final String fullFileName = filePath.substring(filePath.lastIndexOf('/') + 1);\n\n        for (Map.Entry<String, String[]> entry : notMavenizedArtifacts.entrySet()) {\n            if (fullFileName.startsWith(entry.getKey())) {\n                final String fileVersion = fullFileName.substring(entry.getKey().length()).replace(\".jar\", \"\");\n\n                result.put(GROUP_ID, entry.getValue()[0]);\n                result.put(ARTIFACT_ID, entry.getValue()[1]);\n                result.put(VERSION, fileVersion);\n                break;\n            }\n        }\n        return result;\n    }\n\n    public String buildPom(GAV gav) {\n        return POM_TEMPLATE.replace(\"{groupId}\", gav.getGroupId())\n                .replace(\"{artifactId}\", gav.getArtifactId())\n                .replace(\"{version}\", gav.getVersion());\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/GuvnorM2Repository.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.StringReader;\nimport java.io.StringWriter;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Enumeration;\nimport java.util.List;\nimport java.util.Properties;\nimport java.util.function.Predicate;\nimport java.util.regex.Matcher;\nimport java.util.stream.Collectors;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipException;\nimport java.util.zip.ZipFile;\nimport java.util.zip.ZipInputStream;\nimport java.util.zip.ZipOutputStream;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.apache.commons.io.IOUtils;\nimport org.apache.commons.io.input.ReaderInputStream;\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Writer;\nimport org.codehaus.plexus.util.IOUtil;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.util.artifact.SubArtifact;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepository;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isDeployedPom;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isJar;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isKJar;\n\n@ApplicationScoped\npublic class GuvnorM2Repository {\n\n    private static final Logger log = LoggerFactory.getLogger(GuvnorM2Repository.class);\n\n    private static final int BUFFER_SIZE = 1024;\n    protected static final String META_INF = \"META-INF\";\n    private static final String MAVEN = \"maven\";\n    private static final String META_INF_MAVEN = META_INF + \"/\" + MAVEN;\n    private static final String POM = \"pom\";\n    private static final String POM_XML = POM + \".xml\";\n    private static final String POM_PROPERTIES = POM + \".properties\";\n\n    private static final String GROUP_ID_NAME = \"groupId\";\n    private static final String ARTIFACT_ID_NAME = \"artifactId\";\n    private static final String VERSION_NAME = \"version\";\n    protected static final String KMODULE_XML = \"kmodule.xml\";\n    protected static final String KIE_DEPLOYMENT_DESCRIPTOR_XML = \"kie-deployment-descriptor.xml\";\n\n    private final List<ArtifactRepository> repositories = new ArrayList<>();\n    private final List<ArtifactRepository> pomRepositories = new ArrayList<>();\n    private ArtifactRepositoryService artifactRepositoryFactory;\n\n    public GuvnorM2Repository() {\n    }\n\n    @Inject\n    public GuvnorM2Repository(ArtifactRepositoryService factory) {\n        this.artifactRepositoryFactory = factory;\n    }\n\n    @PostConstruct\n    public void init() {\n        setM2Repos();\n    }\n\n    private void setM2Repos() {\n\n        this.repositories.addAll(this.artifactRepositoryFactory.getRepositories());\n        this.pomRepositories.addAll(this.artifactRepositoryFactory.getPomRepositories());\n    }\n\n    public String getM2RepositoryDir(String repositoryName) {\n        return this.getM2RepositoryRootDir(repositoryName).replaceAll(Matcher.quoteReplacement(File.separator)+\"$\",\n                                                                      \"\");\n    }\n\n    public String getM2RepositoryRootDir(String repositoryName) {\n\n        String defaultName = ArtifactRepositoryService.GLOBAL_M2_REPO_NAME;\n        if (repositoryName != null && !repositoryName.isEmpty()) {\n            defaultName = repositoryName;\n        }\n\n        final String name = defaultName;\n\n        ArtifactRepository repository = getArtifactRepository(name);\n\n        String rootDir = repository.getRootDir();\n        if (!repository.getRootDir().endsWith(File.separator)) {\n            return rootDir + File.separator;\n        } else {\n            return rootDir;\n        }\n    }\n\n    private ArtifactRepository getArtifactRepository(String name) {\n        return this.repositories\n                .stream()\n                .filter(artifactRepository -> artifactRepository.getName().equals(name))\n                .findFirst().orElseThrow(() -> new RuntimeException(String.format(\"Repository %s not found\",\n                                                                                  name)));\n    }\n\n    public String getRepositoryURL(String repositoryName) {\n        File file = new File(getM2RepositoryRootDir(repositoryName));\n        return \"file://\" + file.getAbsolutePath();\n    }\n    \n    public void deployArtifact(final InputStream jarStream,\n                               final GAV gav,\n                               final boolean includeAdditionalRepositories) {\n        deployArtifact(jarStream, gav, includeAdditionalRepositories, (repo) -> true);\n    }\n\n    public void deployArtifact(final InputStream jarStream,\n                               final GAV gav,\n                               final boolean includeAdditionalRepositories,\n                               final Predicate<ArtifactRepository> filter) {\n        //Write JAR to temporary file for deployment\n        File jarFile = new File(System.getProperty(\"java.io.tmpdir\"),\n                                toFileName(gav,\n                                           \"jar\"));\n\n        try {\n\n            inputStreamToFile(jarStream,\n                              jarFile);\n\n            //Write pom.xml to JAR if it doesn't already exist\n            String pomXML = loadPomFromJar(new File(jarFile.getPath()));\n            if (pomXML == null) {\n                pomXML = generatePOM(gav);\n                jarFile = appendFileToJar(pomXML,\n                                          getPomXmlPath(gav),\n                                          jarFile.getPath());\n            }\n\n            //Write pom.properties to JAR if it doesn't already exist\n            String pomProperties = loadGAVFromJarInternal(new File(jarFile.getPath()));\n            if (pomProperties == null) {\n                pomProperties = generatePomProperties(gav);\n                jarFile = appendFileToJar(pomProperties,\n                                          getPomPropertiesPath(gav),\n                                          jarFile.getPath());\n            }\n\n            deployArtifact(gav,\n                           pomXML,\n                           jarFile,\n                           includeAdditionalRepositories,\n                           filter);\n        } finally {\n            try {\n                jarFile.delete();\n            } catch (Exception e) {\n                log.warn(\"Unable to remove temporary file '\" + jarFile.getAbsolutePath() + \"'\");\n            }\n        }\n    }\n\n    public void deployPom(final InputStream pomStream,\n                          final GAV gav) {\n        //Write POM to temporary file for deployment\n        File pomFile = new File(System.getProperty(\"java.io.tmpdir\"), toFileName(gav, POM));\n\n        try {\n\n            inputStreamToFile(pomStream,\n                              pomFile);\n\n            deployPom(gav,\n                      pomFile);\n        } finally {\n            try {\n                pomFile.delete();\n            } catch (Exception e) {\n                log.warn(\"Unable to remove temporary file '\" + pomFile.getAbsolutePath() + \"'\");\n            }\n        }\n    }\n\n    private void inputStreamToFile(final InputStream inputStream,\n                                   final File file) {\n\n        FileOutputStream fos = null;\n        try {\n            if (!file.exists()) {\n                file.getParentFile().mkdirs();\n                file.createNewFile();\n            }\n            fos = new FileOutputStream(file);\n\n            final byte[] buf = new byte[BUFFER_SIZE];\n            int byteRead = 0;\n            while ((byteRead = inputStream.read(buf)) != -1) {\n                fos.write(buf,\n                          0,\n                          byteRead);\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        } finally {\n            if (fos != null) {\n                try {\n                    fos.flush();\n                    fos.close();\n                } catch (IOException e) {\n                    log.error(\"Error occurred when trying to close stream\",\n                              e);\n                }\n            }\n        }\n    }\n\n    public void deployParentPom(final GAV gav) {\n        //Write pom.xml to temporary file for deployment\n        final File pomXMLFile = new File(System.getProperty(\"java.io.tmpdir\"),\n                                         toFileName(gav,\n                                                    POM_XML));\n\n        try {\n\n            String pomXML = generateParentPOM(gav);\n            writeStringIntoFile(pomXML,\n                                pomXMLFile);\n            //pom.xml Artifact\n            Artifact pomXMLArtifact = new DefaultArtifact(gav.getGroupId(),\n                                                          gav.getArtifactId(),\n                                                          POM,\n                                                          gav.getVersion());\n            pomXMLArtifact = pomXMLArtifact.setFile(pomXMLFile);\n\n            final Artifact finalPomXMLArtifact = pomXMLArtifact;\n            this.pomRepositories.forEach(artifactRepository -> {\n                artifactRepository.deploy(pomXML,\n                                          finalPomXMLArtifact);\n            });\n        } finally {\n            try {\n                pomXMLFile.delete();\n            } catch (Exception e) {\n                log.warn(\"Unable to remove temporary file '\" + pomXMLFile.getAbsolutePath() + \"'\");\n            }\n        }\n    }\n\n    private void deployArtifact(final GAV gav,\n                                final String pomXML,\n                                final File jarFile,\n                                final boolean includeAdditionalRepositories,\n                                final Predicate<ArtifactRepository> filter) {\n        //Write pom.xml to temporary file for deployment\n        final File pomXMLFile = new File(System.getProperty(\"java.io.tmpdir\"), toFileName(gav, POM_XML));\n\n        try {\n\n            writeStringIntoFile(pomXML,\n                                pomXMLFile);\n\n            //JAR Artifact\n            Artifact jarArtifact = new DefaultArtifact(gav.getGroupId(),\n                                                       gav.getArtifactId(),\n                                                       \"jar\",\n                                                       gav.getVersion());\n            jarArtifact = jarArtifact.setFile(jarFile);\n\n            //pom.xml Artifact\n            Artifact pomXMLArtifact = new SubArtifact(jarArtifact, \"\", POM);\n            pomXMLArtifact = pomXMLArtifact.setFile(pomXMLFile);\n\n            final Artifact finalJarArtifact = jarArtifact;\n            final Artifact finalPomXMLArtifact = pomXMLArtifact;\n            this.repositories.stream().filter(filter).forEach((repository) -> repository.deploy(pomXML,\n                                                                        finalJarArtifact,\n                                                                        finalPomXMLArtifact));\n\n            //Only deploy to additional repositories if required. This flag is principally for Unit Tests\n            if (!includeAdditionalRepositories) {\n                return;\n            }\n        } finally {\n            try {\n                pomXMLFile.delete();\n            } catch (Exception e) {\n                log.warn(\"Unable to remove temporary file '\" + pomXMLFile.getAbsolutePath() + \"'\");\n            }\n        }\n    }\n\n    private void writeStringIntoFile(final String string,\n                                     final File file) {\n        FileOutputStream fos = null;\n        try {\n            if (!file.exists()) {\n                file.getParentFile().mkdirs();\n                file.createNewFile();\n            }\n\n            fos = new FileOutputStream(file);\n            IOUtils.write(string,\n                          fos);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        } finally {\n            if (fos != null) {\n                try {\n                    fos.flush();\n                    fos.close();\n                } catch (IOException e) {\n                    log.error(\"Error occurred trying to close a stream\",\n                              e);\n                }\n            }\n        }\n    }\n\n    private void deployPom(final GAV gav,\n                           final File pomFile) {\n        //POM Artifact\n        Artifact pomArtifact = new DefaultArtifact(gav.getGroupId(),\n                                                   gav.getArtifactId(),\n                                                   POM,\n                                                   gav.getVersion());\n        pomArtifact = pomArtifact.setFile(pomFile);\n\n        final Artifact finalPomArtifact = pomArtifact;\n        this.pomRepositories.forEach(artifactRepository -> {\n            artifactRepository.deploy(null,\n                                      finalPomArtifact);\n        });\n    }\n\n    /**\n     * Finds files within the repository.\n     * @return an collection of java.io.File with the matching files\n     */\n    public Collection<File> listFiles() {\n        return listFiles(null);\n    }\n\n    /**\n     * Finds files within the repository with the given filters.\n     * @param filters filter to apply when finding files. The filter is used to create a wildcard matcher, ie., \"*filter*.*\", in which \"*\" is\n     * to represent a multiple wildcard characters.\n     * @return an collection of java.io.File with the matching files\n     */\n    public List<File> listFiles(final String filters) {\n        return listFiles(filters,\n                         null);\n    }\n\n    /**\n     * Finds files within the repository with the given filters and formats.\n     * @param filters filter to apply when finding files. The filter is used to create a wildcard matcher, ie., \"*filter*.*\", in which \"*\" is\n     * to represent a multiple wildcard characters.\n     * @param fileFormats file formats to apply when finding files, ie., [ \"jar\", \"kjar\" ].\n     * @return an collection of java.io.File with the matching files\n     */\n    public List<File> listFiles(final String filters,\n                                List<String> fileFormats) {\n        final List<String> wildcards = new ArrayList<String>();\n        String wildcardPrefix = \"\";\n\n        if (filters != null) {\n            wildcardPrefix = \"*\" + filters;\n        }\n\n        if (fileFormats == null) {\n            fileFormats = new ArrayList<String>();\n            fileFormats.add(\"jar\");\n            fileFormats.add(\"kjar\");\n            fileFormats.add(POM);\n        }\n\n        for (String fileFormat : fileFormats) {\n            wildcards.add(wildcardPrefix + \"*.\" + fileFormat);\n        }\n\n        final List<File> files = new ArrayList<File>(getFiles(wildcards));\n\n        return files;\n    }\n\n    public List<Artifact> listArtifacts(final String filters,\n                                        List<String> fileFormats) {\n        final List<String> wildcards = new ArrayList<String>();\n        String wildcardPrefix = \"\";\n\n        if (filters != null) {\n            wildcardPrefix = \"*\" + filters;\n        }\n\n        if (fileFormats == null) {\n            fileFormats = new ArrayList<String>();\n            fileFormats.add(\"jar\");\n            fileFormats.add(\"kjar\");\n            fileFormats.add(POM);\n        }\n\n        for (String fileFormat : fileFormats) {\n            wildcards.add(wildcardPrefix + \"*.\" + fileFormat);\n        }\n\n        final List<Artifact> files = new ArrayList<>(getArtifacts(wildcards));\n\n        return files;\n    }\n\n    protected Collection<File> getFiles(final List<String> wildcards) {\n        return this.repositories.stream()\n                .flatMap(artifactRepository -> artifactRepository.listFiles(wildcards).stream())\n                .collect(Collectors.toList());\n    }\n\n    protected Collection<Artifact> getArtifacts(final List<String> wildcards) {\n        return this.repositories.stream()\n                .flatMap(artifactRepository -> artifactRepository.listArtifacts(wildcards).stream())\n                .collect(Collectors.toList());\n    }\n\n    public String getPomText(final String path) {\n        ArtifactRepository repository = this.getArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n        final File file = new File(repository.getRootDir(),\n                                   path);\n\n        final String normalizedPath = file.toPath().normalize().toString();\n        if (isJar(normalizedPath) || isKJar(normalizedPath)) {\n            return loadPomFromJar(file);\n        } else if (isDeployedPom(normalizedPath)) {\n            return loadPom(file);\n        } else {\n            throw new RuntimeException(\"Not a valid jar, kjar or pom file: \" + path);\n        }\n    }\n\n    public String getKModuleText(final String path) {\n        return loadKieTextFromJar(path, META_INF, KMODULE_XML);\n    }\n\n    public String getKieDeploymentDescriptorText(final String path) {\n        return loadKieTextFromJar(path, META_INF, KIE_DEPLOYMENT_DESCRIPTOR_XML);\n    }\n\n    protected String loadKieTextFromJar(final String jarFilePath, final String subPath, final String fileName) {\n        ArtifactRepository repository = this.getArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n        final File file = new File(repository.getRootDir(),\n                                   jarFilePath);\n\n\n        final String normalizedPath = file.toPath().normalize().toString();\n        if (isJar(normalizedPath) || isKJar(normalizedPath)) {\n            return loadFileTextFromJar(file, subPath, fileName);\n        }\n        return null;\n    }\n\n    private static String loadPomFromJar(final File file) {\n        return loadFileTextFromJar(file, META_INF_MAVEN, POM_XML);\n    }\n\n    protected static String loadFileTextFromJar(final File jarFile, String path, String fileName) {\n        if (jarFile != null && fileName != null && !fileName.isEmpty()) {\n            try (ZipFile zip = new ZipFile(jarFile)) {\n                for (Enumeration e = zip.entries(); e.hasMoreElements(); ) {\n                    ZipEntry entry = (ZipEntry) e.nextElement();\n                    if (entry.getName().startsWith(path) && entry.getName().endsWith(fileName)) {\n                        return zipEntryToString(zip,\n                                                entry);\n                    }\n                }\n            } catch (ZipException e) {\n                log.error(e.getMessage());\n            } catch (IOException e) {\n                log.error(e.getMessage());\n            }\n        }\n        return null;\n    }\n\n    private static String loadPom(final File file) {\n        try (InputStream is = new FileInputStream(file);\n             InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8)) {\n            StringBuilder sb = new StringBuilder();\n            for (int c = isr.read(); c != -1; c = isr.read()) {\n                sb.append((char) c);\n            }\n            return sb.toString();\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return null;\n    }\n\n    public GAV loadGAVFromJar(final String jarPath) {\n        ArtifactRepository repository = this.getArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n        File zip = new File(repository.getRootDir(),\n                            jarPath);\n\n        try {\n            final String pomProperties = loadGAVFromJarInternal(zip);\n\n            final Properties props = new Properties();\n            props.load(new StringReader(pomProperties));\n\n            final String groupId = props.getProperty(GROUP_ID_NAME);\n            final String artifactId = props.getProperty(ARTIFACT_ID_NAME);\n            final String version = props.getProperty(VERSION_NAME);\n\n            return new GAV(groupId,\n                           artifactId,\n                           version);\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return null;\n    }\n\n    private String loadGAVFromJarInternal(final File file) {\n        try {\n            ZipFile zip = new ZipFile(file);\n\n            for (Enumeration e = zip.entries(); e.hasMoreElements(); ) {\n                ZipEntry entry = (ZipEntry) e.nextElement();\n\n                if (entry.getName().startsWith(META_INF_MAVEN) && entry.getName().endsWith(POM_PROPERTIES)) {\n                    return zipEntryToString(zip,\n                                            entry);\n                }\n            }\n        } catch (ZipException e) {\n            log.error(e.getMessage());\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return null;\n    }\n\n    public static String loadPomFromJar(final InputStream jarInputStream) {\n        try {\n\n            InputStream is = getInputStreamFromJar(jarInputStream, META_INF_MAVEN, POM_XML);\n            StringBuilder sb = new StringBuilder();\n            for (int c = is.read(); c != -1; c = is.read()) {\n                sb.append((char) c);\n            }\n            return sb.toString();\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return null;\n    }\n\n    public static String loadPomPropertiesFromJar(final InputStream jarInputStream) {\n        try {\n\n            InputStream is = getInputStreamFromJar(jarInputStream, META_INF_MAVEN, POM_PROPERTIES);\n            StringBuilder sb = new StringBuilder();\n            for (int c = is.read(); c != -1; c = is.read()) {\n                sb.append((char) c);\n            }\n            return sb.toString();\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return null;\n    }\n\n    private static InputStream getInputStreamFromJar(final InputStream jarInputStream,\n                                                     final String prefix,\n                                                     final String suffix) throws IOException {\n        ZipInputStream zis = new ZipInputStream(jarInputStream);\n        ZipEntry entry;\n\n        while ((entry = zis.getNextEntry()) != null) {\n            final String entryName = entry.getName();\n            if (entryName.startsWith(prefix) && entryName.endsWith(suffix)) {\n                return new ReaderInputStream(new InputStreamReader(zis, StandardCharsets.UTF_8), StandardCharsets.UTF_8);\n            }\n        }\n\n        throw new FileNotFoundException(\"Could not find '\" + prefix + \"/*/\" + suffix + \"' in the jar.\");\n    }\n\n    private File appendFileToJar(final String content,\n                                 final String contentPath,\n                                 final String jarPath) {\n        File originalJarFile = new File(jarPath);\n        File appendedJarFile = new File(jarPath + \".tmp\");\n\n        try (ZipFile war = new ZipFile(originalJarFile);\n             ZipOutputStream append = new ZipOutputStream(new FileOutputStream(appendedJarFile))) {\n\n            // first, copy contents from existing war\n            copyEntriesFromExistingWar(war,\n                                       append);\n\n            // append pom.xml\n            ZipEntry e = new ZipEntry(contentPath);\n            append.putNextEntry(e);\n            append.write(content.getBytes());\n            append.closeEntry();\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return appendedJarFile;\n    }\n\n    private void copyEntriesFromExistingWar(final ZipFile war,\n                                            final ZipOutputStream append) throws IOException {\n        Enumeration<? extends ZipEntry> entries = war.entries();\n        while (entries.hasMoreElements()) {\n            ZipEntry e = entries.nextElement();\n            append.putNextEntry(e);\n            if (!e.isDirectory()) {\n                IOUtil.copy(war.getInputStream(e),\n                            append);\n            }\n            append.closeEntry();\n        }\n    }\n\n    protected String toFileName(final GAV gav,\n                                final String fileName) {\n        return gav.getGroupId() + \"-\" + gav.getArtifactId() + \"-\" + gav.getVersion() + \"-\" + Math.random() + \".\" + fileName;\n    }\n\n    public String generatePOM(final GAV gav) {\n        Model model = new Model();\n        model.setGroupId(gav.getGroupId());\n        model.setArtifactId(gav.getArtifactId());\n        model.setVersion(gav.getVersion());\n        model.setModelVersion(\"4.0.0\");\n\n        StringWriter stringWriter = new StringWriter();\n        try {\n            new MavenXpp3Writer().write(stringWriter,\n                                        model);\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return stringWriter.toString();\n    }\n\n    public static String generatePomProperties(final GAV gav) {\n        StringBuilder sBuilder = new StringBuilder();\n        sBuilder.append(GROUP_ID_NAME + \"=\");\n        sBuilder.append(gav.getGroupId());\n        sBuilder.append(\"\\n\");\n\n        sBuilder.append(ARTIFACT_ID_NAME + \"=\");\n        sBuilder.append(gav.getArtifactId());\n        sBuilder.append(\"\\n\");\n\n        sBuilder.append(VERSION_NAME + \"=\");\n        sBuilder.append(gav.getVersion());\n        sBuilder.append(\"\\n\");\n\n        return sBuilder.toString();\n    }\n\n    public String getPomXmlPath(final GAV gav) {\n        return META_INF_MAVEN + \"/\" + gav.getGroupId() + \"/\" + gav.getArtifactId() + \"/\" + POM_XML;\n    }\n\n    public String getPomPropertiesPath(final GAV gav) {\n        return META_INF_MAVEN + \"/\" + gav.getGroupId() + \"/\" + gav.getArtifactId() + \"/\" + POM_PROPERTIES;\n    }\n\n    public String generateParentPOM(final GAV gav) {\n        Model model = new Model();\n        model.setGroupId(gav.getGroupId());\n        model.setArtifactId(gav.getArtifactId());\n        model.setVersion(gav.getVersion());\n        model.setPackaging(POM);\n        model.setModelVersion(\"4.0.0\");\n\n        StringWriter stringWriter = new StringWriter();\n        try {\n            new MavenXpp3Writer().write(stringWriter,\n                                        model);\n        } catch (IOException e) {\n            log.error(e.getMessage());\n        }\n\n        return stringWriter.toString();\n    }\n\n    public boolean containsArtifact(final GAV gav) {\n        return containsArtifact(gav, (repo) -> true);\n    }\n    \n    public boolean containsArtifact(final GAV gav,\n                                    final Predicate<ArtifactRepository> filter) {\n        return this.repositories.stream()\n                .filter(filter)\n                .anyMatch(artifactRepository -> artifactRepository.containsArtifact(gav));\n    }\n\n    public File getArtifactFileFromRepository(final GAV gav) {\n        final List<File> artifacts = this.repositories\n                .stream()\n                .map(artifactRepository -> artifactRepository.getArtifactFileFromRepository(gav))\n                .filter(artifact -> artifact != null)\n                .collect(Collectors.toList());\n        return artifacts.get(0);\n    }\n\n    protected static String zipEntryToString(ZipFile zip,\n                                             ZipEntry entry) throws IOException {\n        final InputStream is = zip.getInputStream(entry);\n        final InputStreamReader isr = new InputStreamReader(is, StandardCharsets.UTF_8);\n        StringBuilder sb = new StringBuilder();\n        for (int c = isr.read(); c != -1; c = isr.read()) {\n            sb.append((char) c);\n        }\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/M2RepoServiceImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Date;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.appformer.maven.support.MinimalPomParser;\nimport org.appformer.maven.support.PomModel;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.paging.PageResponse;\n\n@Service\n@ApplicationScoped\n// Implementation needs to implement both interfaces even though one extends the other\n// otherwise the implementation discovery mechanism for the @Service annotation fails.\npublic class M2RepoServiceImpl implements M2RepoService,\n                                          ExtendedM2RepoService {\n\n    private Logger logger;\n\n    private GuvnorM2Repository repository;\n\n    public M2RepoServiceImpl() {}\n\n    @Inject\n    public M2RepoServiceImpl(GuvnorM2Repository repository) {\n        this(LoggerFactory.getLogger(M2RepoServiceImpl.class), repository);\n    }\n\n    public M2RepoServiceImpl(final Logger logger,\n                             GuvnorM2Repository repository) {\n        this.logger = logger;\n        this.repository = repository;\n\n        if (!isURLValid()) {\n            logger.error(String.format(\"The property %s is not correctly set. The workbench will use a direct file path to the m2 repository and this should only be used when test the workbench.\", ArtifactRepositoryService.GLOBAL_M2_REPO_URL));\n        }\n    }\n\n    @Override\n    public void deployJar(final InputStream is,\n                          final GAV gav) {\n        repository.deployArtifact(is,\n                                  gav,\n                                  true);\n    }\n\n    @Override\n    public void deployJarInternal(final InputStream is,\n                                  final GAV gav) {\n        repository.deployArtifact(is,\n                                  gav,\n                                  false);\n    }\n\n    @Override\n    public void deployPom(final InputStream is,\n                          final GAV gav) {\n        repository.deployPom(is,\n                             gav);\n    }\n\n    @Override\n    public String getPomText(final String path) {\n        checkPathTraversal(path);\n\n        return repository.getPomText(path);\n    }\n\n    @Override\n    public GAV loadGAVFromJar(final String path) {\n        checkPathTraversal(path);\n\n        final GAV gav = repository.loadGAVFromJar(path);\n        return gav;\n    }\n\n    @Override\n    public PageResponse<JarListPageRow> listArtifacts(final JarListPageRequest pageRequest) {\n        //Get unsorted files matching filter\n        final String filters = pageRequest.getFilters();\n        final List<String> fileFormats = pageRequest.getFileFormats();\n        final String dataSourceName = pageRequest.getDataSourceName();\n        final boolean isAscending = pageRequest.isAscending();\n        final Collection<Artifact> files = repository.listArtifacts(filters,\n                                                                    fileFormats);\n\n        //Convert files to JarListPageRow\n        final List<JarListPageRow> jarPageRowList = new ArrayList<JarListPageRow>();\n        for (Artifact artifact : files) {\n            final File file = artifact.getFile();\n            JarListPageRow jarListPageRow = new JarListPageRow();\n            jarListPageRow.setName(file.getName());\n            jarListPageRow.setPath(getJarPath(file.getPath(),\n                                              File.separator));\n            jarListPageRow.setGav(getGAV(jarListPageRow.getPath()));\n            jarListPageRow.setLastModified(new Date(file.lastModified()));\n            jarListPageRow.setRepositoryName(artifact.getProperty(\"repository\",\n                                                                  \"undefined\"));\n            jarPageRowList.add(jarListPageRow);\n        }\n\n        //Sort JarListPageRow entries, if required\n        if (dataSourceName != null) {\n            final int order = (isAscending ? 1 : -1);\n            if (dataSourceName.equals(JarListPageRequest.COLUMN_NAME)) {\n                Collections.sort(jarPageRowList,\n                                 new Comparator<JarListPageRow>() {\n                                     @Override\n                                     public int compare(final JarListPageRow o1,\n                                                        final JarListPageRow o2) {\n                                         return o1.getName().compareTo(o2.getName()) * order;\n                                     }\n                                 });\n            } else if (dataSourceName.equals(JarListPageRequest.COLUMN_PATH)) {\n                Collections.sort(jarPageRowList,\n                                 new Comparator<JarListPageRow>() {\n                                     @Override\n                                     public int compare(final JarListPageRow o1,\n                                                        final JarListPageRow o2) {\n                                         return o1.getPath().compareTo(o2.getPath()) * order;\n                                     }\n                                 });\n            } else if (dataSourceName.equals(JarListPageRequest.COLUMN_GAV)) {\n                Collections.sort(jarPageRowList,\n                                 new Comparator<JarListPageRow>() {\n                                     @Override\n                                     public int compare(final JarListPageRow o1,\n                                                        final JarListPageRow o2) {\n                                         final GAV gav1 = o1.getGav();\n                                         final GAV gav2 = o2.getGav();\n                                         return gav1.toString().compareToIgnoreCase(gav2.toString()) * order;\n                                     }\n                                 });\n            } else if (dataSourceName.equals(JarListPageRequest.COLUMN_LAST_MODIFIED)) {\n                Collections.sort(jarPageRowList,\n                                 new Comparator<JarListPageRow>() {\n                                     @Override\n                                     public int compare(final JarListPageRow o1,\n                                                        final JarListPageRow o2) {\n                                         final Long ft1 = o1.getLastModified().getTime();\n                                         final Long ft2 = o2.getLastModified().getTime();\n                                         return ft1.compareTo(ft2) * order;\n                                     }\n                                 });\n            }\n        }\n\n        //Copy request \"page\" of entries to response\n        final Integer pageSize = pageRequest.getPageSize();\n        final int startRowIndex = pageRequest.getStartRowIndex();\n        final int endRowIndex = Math.min(jarPageRowList.size(),\n                                         (pageSize == null ? jarPageRowList.size() : startRowIndex + pageSize));\n        final List<JarListPageRow> responsePageRowList = new ArrayList<JarListPageRow>();\n        if (startRowIndex < jarPageRowList.size()) {\n            int i = startRowIndex;\n            while (i < endRowIndex && i < jarPageRowList.size()) {\n                responsePageRowList.add(jarPageRowList.get(i));\n                i++;\n            }\n        }\n\n        final PageResponse<JarListPageRow> response = new PageResponse<JarListPageRow>();\n        response.setPageRowList(responsePageRowList);\n        response.setStartRowIndex(pageRequest.getStartRowIndex());\n        response.setTotalRowSize(files.size());\n        response.setTotalRowSizeExact(true);\n\n        return response;\n    }\n\n    // The file separator is provided as a parameter so that we can test for correct JAR path creation on both\n    // Windows and Linux based Operating Systems in Unit tests running on either platform. See JarPathTest.\n    String getJarPath(final String path,\n                      final String separator) {\n        //Strip \"Repository\" prefix\n        String pathToDir = repository.getM2RepositoryDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n        String jarPath = path.substring(pathToDir.length() + 1);\n        //Replace OS-dependent file separators with HTTP path separators\n        jarPath = jarPath.replaceAll(\"\\\\\" + separator,\n                                     \"/\");\n        return jarPath;\n    }\n\n    GAV getGAV(final String path) {\n        GAV gav = null;\n        InputStream is = null;\n        try {\n            final String pom = getPomText(path);\n            is = new ByteArrayInputStream(pom.getBytes(Charset.forName(\"UTF-8\")));\n            final PomModel model = MinimalPomParser.parse(path,\n                                                          is);\n            gav = new GAV(model.getReleaseId().getGroupId(),\n                          model.getReleaseId().getArtifactId(),\n                          model.getReleaseId().getVersion());\n        } catch (RuntimeException rte) {\n            //RuntimeException is thrown by MinimalPomParser for any Exception..\n            gav = new GAV(\"<undetermined>\",\n                          \"<undetermined>\",\n                          \"<undetermined>\");\n        } finally {\n            if (is != null) {\n                try {\n                    is.close();\n                } catch (IOException ioe) {\n                    //Swallow\n                }\n            }\n        }\n        return gav;\n    }\n\n    /**\n     * URL point to local file system if URL property is not available.\n     * @return String\n     */\n    @Override\n    public String getRepositoryURL() {\n        if (isURLValid()) {\n            return System.getProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL);\n        } else {\n            return repository.getRepositoryURL(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n        }\n    }\n\n    @Override\n    public String getKModuleText(String path) {\n        checkPathTraversal(path);\n        return repository.getKModuleText(path);\n    }\n\n    @Override\n    public String getKieDeploymentDescriptorText(String path) {\n        checkPathTraversal(path);\n        return repository.getKieDeploymentDescriptorText(path);\n    }\n\n    private boolean isURLValid() {\n        final String urlProperty = System.getProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL);\n        try {\n            new URL(urlProperty);\n        } catch (MalformedURLException e) {\n            logger.warn(String.format(\"The url %s is not valid. Using the default.\", urlProperty));\n            return false;\n        }\n        return true;\n    }\n\n    /**\n     * Asserts that the path does not cause traversal.\n     * @param path the path to check, must not be null.\n     */\n    private void checkPathTraversal(String path) {\n        // There's no more decoding / unescaping happening on the String beyond \n        // this point so we don't have to check for %u002e, %252e, etc., as these \n        // paths would result in a FileNotFoundException anyway.\n        if (path.contains(\"..\")) {\n            throw new RuntimeException(\"Invalid path provided!\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/M2Servlet.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.IOException;\nimport javax.inject.Inject;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.guvnor.m2repo.backend.server.helpers.HttpGetHelper;\nimport org.guvnor.m2repo.backend.server.helpers.HttpPostHelper;\nimport org.guvnor.m2repo.backend.server.helpers.HttpPutHelper;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class M2Servlet extends HttpServlet {\n\n    private static final Logger log = LoggerFactory.getLogger(M2Servlet.class);\n\n    @Inject\n    private HttpPostHelper httpPostHelper;\n\n    @Inject\n    private HttpPutHelper httpPutHelper;\n\n    @Inject\n    private HttpGetHelper httpGetHelper;\n\n    @Override\n    protected void doGet(final HttpServletRequest request,\n                         final HttpServletResponse response) throws ServletException, IOException {\n        log.info(\"GET request received for \" + request.getPathInfo());\n        httpGetHelper.handle(request,\n                             response,\n                             getServletContext());\n    }\n\n    @Override\n    protected void doPost(final HttpServletRequest request,\n                          final HttpServletResponse response) throws ServletException, IOException {\n        log.info(\"POST request received.\");\n        httpPostHelper.handle(request,\n                              response);\n    }\n\n    @Override\n    protected void doPut(final HttpServletRequest request,\n                         final HttpServletResponse response) throws ServletException, IOException {\n        log.info(\"PUT request received for \" + request.getPathInfo());\n        httpPutHelper.handle(request,\n                             response);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/M2ServletContextListener.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.BufferedInputStream;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.DirectoryStream;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\nimport java.util.Enumeration;\nimport java.util.Properties;\nimport java.util.concurrent.TimeUnit;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipFile;\n\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\nimport javax.servlet.annotation.WebListener;\n\nimport org.appformer.maven.integration.Aether;\nimport org.appformer.maven.integration.MavenRepository;\nimport org.appformer.maven.support.AFReleaseIdImpl;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.installation.InstallRequest;\nimport org.eclipse.aether.installation.InstallationException;\nimport org.eclipse.aether.util.artifact.SubArtifact;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * It reads all the jars present in the WEB-INF/lib\n * to create a Map with entries of GAV and path of the dependency\n */\n@WebListener\npublic class M2ServletContextListener implements ServletContextListener {\n\n    private static final Logger logger = LoggerFactory.getLogger(M2ServletContextListener.class);\n\n    private static final String FORCE_OFFLINE = \"kie.maven.offline.force\";\n\n    static final String GROUP_ID = \"groupId\";\n    static final String ARTIFACT_ID = \"artifactId\";\n    static final String VERSION = \"version\";\n    private static final String JAR_EXT = \".jar\";\n    private static final String WEB_INF_FOLDER = \"WEB-INF\";\n    private static final String LIB_FOLDER = \"lib\";\n    private static final String JAR_ARTIFACT = \"jar\";\n    private static final String JARS_FOLDER = File.separator + WEB_INF_FOLDER + File.separator + LIB_FOLDER + File.separator;\n    private static final String MAVEN_META_INF = \"META-INF/maven\";\n    private final Path tempDir;\n    private final FixNotMavenizedArtifactInfo fixNotMavenizedArtifact = new FixNotMavenizedArtifactInfo();\n\n    public M2ServletContextListener() {\n        Path tempDir = null;\n        try {\n            tempDir = Files.createTempDirectory(\"pom-extract\");\n        } catch (IOException e) {\n            logger.error(e.getMessage(),\n                         e);\n        }\n        this.tempDir = tempDir;\n    }\n\n    @Override\n    public void contextInitialized(ServletContextEvent servletContextEvent) {\n        if (Boolean.valueOf(System.getProperty(FORCE_OFFLINE, \"false\"))) {\n            logger.info(\"M2ServletContextListener contextInitialized started\");\n            final ServletContext ctx = servletContextEvent.getServletContext();\n            final String jarsPath = ctx.getRealPath(JARS_FOLDER);\n            final long startTime = System.nanoTime();\n            final int jarsDeployed = deployJarsFromWar(jarsPath);\n            final long endTime = System.nanoTime();\n            final long totalTime = TimeUnit.NANOSECONDS.toSeconds(endTime - startTime);\n            logger.info(\"M2ServletContextListener contextInitialized deployed {} jars in {} sec \",\n                        jarsDeployed,\n                        totalTime);\n        } else {\n            logger.debug(\"M2ServletContextListener not executed, offline `{}` options set to false.\", FORCE_OFFLINE);\n        }\n    }\n\n    @Override\n    public void contextDestroyed(ServletContextEvent servletContextEvent) {\n    }\n\n    int deployJarsFromWar(final String path) {\n        int i = 0;\n        try (DirectoryStream<Path> ds = Files.newDirectoryStream(Paths.get(path))) {\n            for (Path p : ds) {\n                if (p.toString().endsWith(JAR_EXT)) {\n                    deployJar(p.toAbsolutePath().toString());\n                    i++;\n                }\n            }\n        } catch (Exception e) {\n            logger.error(e.getMessage(), e);\n        }\n        return i;\n    }\n\n    GAV deployJar(final String file) {\n        GAV gav = new GAV();\n        Properties props = readZipFile(file);\n        if (!props.isEmpty()) {\n            gav = new GAV(props.getProperty(GROUP_ID),\n                          props.getProperty(ARTIFACT_ID),\n                          props.getProperty(VERSION));\n            deploy(gav, file);\n        }\n        return gav;\n    }\n\n    private Properties readZipFile(String zipFilePath) {\n        try {\n            final ZipFile zipFile = new ZipFile(zipFilePath);\n            final Enumeration<? extends ZipEntry> e = zipFile.entries();\n            while (e.hasMoreElements()) {\n                ZipEntry entry = e.nextElement();\n                if (!entry.isDirectory()\n                        && entry.getName().startsWith(MAVEN_META_INF)\n                        && entry.getName().endsWith(\"pom.properties\")) {\n                    try (BufferedInputStream bis = new BufferedInputStream(zipFile.getInputStream(entry))) {\n                        Properties props = new Properties();\n                        props.load(bis);\n                        return props;\n                    }\n                }\n            }\n        } catch (IOException e) {\n            logger.error(\"IOError :{}\", e.getMessage(), e);\n        }\n\n        return fixNotMavenizedArtifact.getProperties(zipFilePath);\n    }\n\n    public void deploy(final GAV gav,\n                       final String jarPath) {\n\n        final Artifact artifact = MavenRepository.getMavenRepository().resolveArtifact(new AFReleaseIdImpl(gav.getGroupId(), gav.getArtifactId(), gav.getVersion()));\n\n        if (artifact != null) {\n            logger.info(\"Maven Artifact {} already exists in local Maven repository.\", gav.toString());\n            return;\n        }\n\n        logger.warn(\"Maven Artifact {} deployed from WEB-INF.\", gav.toString());\n\n        Artifact jarArtifact = new DefaultArtifact(gav.getGroupId(),\n                                                   gav.getArtifactId(),\n                                                   JAR_ARTIFACT,\n                                                   gav.getVersion());\n        final File jarFile = new File(jarPath);\n        jarArtifact = jarArtifact.setFile(jarFile);\n\n        Artifact pom = null;\n        try {\n            final ZipFile jarZipFile = new ZipFile(jarArtifact.getFile());\n            boolean foundPom = false;\n            Path target = null;\n            final Enumeration<? extends ZipEntry> entries = jarZipFile.entries();\n            while (entries.hasMoreElements()) {\n                ZipEntry entry = entries.nextElement();\n                if (entry.getName().endsWith(\"pom.xml\")) {\n                    foundPom = true;\n                    final String jarFileName = jarArtifact.getFile().toPath().getFileName().toString();\n                    Path pomDir = Files.createDirectory(tempDir.resolve(jarFileName));\n                    target = Files.createFile(pomDir.resolve(jarFileName.substring(0,\n                                                                                   jarFileName.length() - 4) + \".pom\"));\n                    InputStream stream = jarZipFile.getInputStream(entry);\n                    java.nio.file.Files.copy(stream,\n                                             target,\n                                             StandardCopyOption.REPLACE_EXISTING);\n                    break;\n                }\n            }\n            if (!foundPom) {\n                final String pomFileName = jarFile.toPath().getFileName().toString().replace(\".jar\", \".pom\");\n                final String result = fixNotMavenizedArtifact.buildPom(gav);\n                target = Files.createFile(tempDir.resolve(pomFileName));\n                java.nio.file.Files.write(target, result.getBytes());\n            }\n            pom = new SubArtifact(jarArtifact, null, \"pom\").setFile(target.toFile());\n        } catch (final Exception ex) {\n            pom = null;\n            logger.error(ex.getMessage(), ex);\n        }\n\n        try {\n            final InstallRequest installRequest = new InstallRequest();\n            installRequest.addArtifact(jarArtifact);\n            if (pom != null) {\n                installRequest.addArtifact(pom);\n            }\n\n            Aether.getAether().getSystem().install(Aether.getAether().getSession(), installRequest);\n        } catch (InstallationException e) {\n            logger.error(e.getMessage(), e);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/helpers/FormData.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.guvnor.common.services.project.model.GAV;\n\npublic class FormData {\n\n    private FileItem file;\n    private GAV gav;\n\n    public FileItem getFile() {\n        return file;\n    }\n\n    public void setFile(FileItem file) {\n        this.file = file;\n    }\n\n    public void closeFile() {\n    }\n\n    public GAV getGav() {\n        return gav;\n    }\n\n    public void setGav(GAV gav) {\n        this.gav = gav;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/helpers/HttpGetHelper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.io.RandomAccessFile;\nimport java.net.URLDecoder;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.zip.GZIPOutputStream;\nimport javax.inject.Inject;\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.guvnor.m2repo.backend.server.GuvnorM2Repository;\nimport org.guvnor.m2repo.service.M2RepoService;\n\npublic class HttpGetHelper {\n\n    private static final int DEFAULT_BUFFER_SIZE = 10240;\n    private static final long DEFAULT_EXPIRE_TIME = 604800000L; //1 week.\n    private static final String MULTIPART_BOUNDARY = \"MULTIPART_BYTERANGES\";\n\n    @Inject\n    private M2RepoService m2RepoService;\n\n    @Inject\n    private GuvnorM2Repository repository;\n\n    public void handle(final HttpServletRequest request,\n                       final HttpServletResponse response,\n                       final ServletContext context) throws IOException {\n        String requestedFile = request.getPathInfo();\n\n        if (requestedFile == null) {\n            response.sendError(HttpServletResponse.SC_NOT_FOUND);\n            return;\n        }\n\n        requestedFile = URLDecoder.decode(requestedFile,\n                                          \"UTF-8\");\n\n        String repositoryName = request.getParameter(\"repository\");\n\n        //File traversal check:\n        final File mavenRootDir = new File(repository.getM2RepositoryRootDir(repositoryName));\n        final String canonicalDirPath = mavenRootDir.getCanonicalPath() + File.separator;\n        final String canonicalEntryPath = new File(mavenRootDir,\n                                                   requestedFile).getCanonicalPath();\n        if (!canonicalEntryPath.startsWith(canonicalDirPath)) {\n            response.sendError(HttpServletResponse.SC_NOT_FOUND);\n            return;\n        }\n\n        requestedFile = canonicalEntryPath.substring(canonicalDirPath.length());\n        final File file = new File(mavenRootDir,\n                                   requestedFile);\n\n        if (file == null) {\n            response.sendError(HttpServletResponse.SC_NOT_FOUND);\n            return;\n        }\n\n        if (!file.exists()) {\n            response.sendError(HttpServletResponse.SC_NOT_FOUND);\n            return;\n        }\n\n        // Process the ETag\n        String fileName = file.getName();\n        long length = file.length();\n        long lastModified = file.lastModified();\n        String eTag = fileName + \"_\" + length + \"_\" + lastModified;\n\n        String ifNoneMatch = request.getHeader(\"If-None-Match\");\n        if (ifNoneMatch != null && matches(ifNoneMatch,\n                                           eTag)) {\n            response.setHeader(\"ETag\",\n                               eTag); // Required in 304.\n            response.sendError(HttpServletResponse.SC_NOT_MODIFIED);\n            return;\n        }\n\n        long ifModifiedSince = request.getDateHeader(\"If-Modified-Since\");\n        if (ifNoneMatch == null && ifModifiedSince != -1 && ifModifiedSince + 1000 > lastModified) {\n            response.setHeader(\"ETag\",\n                               eTag); // Required in 304.\n            response.sendError(HttpServletResponse.SC_NOT_MODIFIED);\n            return;\n        }\n\n        String ifMatch = request.getHeader(\"If-Match\");\n        if (ifMatch != null && !matches(ifMatch,\n                                        eTag)) {\n            response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);\n            return;\n        }\n\n        long ifUnmodifiedSince = request.getDateHeader(\"If-Unmodified-Since\");\n        if (ifUnmodifiedSince != -1 && ifUnmodifiedSince + 1000 <= lastModified) {\n            response.sendError(HttpServletResponse.SC_PRECONDITION_FAILED);\n            return;\n        }\n\n        Range full = new Range(0,\n                               length - 1,\n                               length);\n        List<Range> ranges = new ArrayList<Range>();\n\n        String contentType = context.getMimeType(fileName);\n        boolean acceptsGzip = false;\n        String disposition = \"inline\";\n\n        if (contentType == null) {\n            contentType = \"application/octet-stream\";\n        }\n\n        if (contentType.startsWith(\"text\")) {\n            String acceptEncoding = request.getHeader(\"Accept-Encoding\");\n            acceptsGzip = acceptEncoding != null\n                    && accepts(acceptEncoding,\n                               \"gzip\");\n            contentType += \";charset=UTF-8\";\n        } else if (!contentType.startsWith(\"image\")) {\n            String accept = request.getHeader(\"Accept\");\n            disposition = accept != null && accepts(accept,\n                                                    contentType) ? \"inline\" : \"attachment\";\n        }\n\n        //Response.\n        response.reset();\n        response.setBufferSize(DEFAULT_BUFFER_SIZE);\n        response.setHeader(\"Content-Disposition\",\n                           disposition +\n                                   \";filename=\\\"\" +\n                                   fileName +\n                                   \"\\\"\");\n        response.setHeader(\"Accept-Ranges\",\n                           \"bytes\");\n        response.setHeader(\"ETag\",\n                           eTag);\n        response.setDateHeader(\"Last-Modified\",\n                               lastModified);\n        response.setDateHeader(\"Expires\",\n                               System.currentTimeMillis() + DEFAULT_EXPIRE_TIME);\n\n        RandomAccessFile input = null;\n        OutputStream output = null;\n\n        try {\n            input = new RandomAccessFile(file,\n                                         \"r\");\n            output = response.getOutputStream();\n\n            if (ranges.isEmpty() || ranges.get(0) == full) {\n                Range r = full;\n                response.setContentType(contentType);\n                response.setHeader(\"Content-Range\",\n                                   \"bytes \" + r.start + \"-\" + r.end + \"/\" + r.total);\n\n                if (acceptsGzip) {\n                    response.setHeader(\"Content-Encoding\",\n                                       \"gzip\");\n                    output = new GZIPOutputStream(output,\n                                                  DEFAULT_BUFFER_SIZE);\n                } else {\n                    response.setHeader(\"Content-Length\",\n                                       String.valueOf(r.length));\n                }\n\n                copyRange(input,\n                          output,\n                          r.start,\n                          r.length);\n            } else if (ranges.size() == 1) {\n                Range r = ranges.get(0);\n                response.setContentType(contentType);\n                response.setHeader(\"Content-Range\",\n                                   \"bytes \" + r.start + \"-\" + r.end + \"/\" + r.total);\n                response.setHeader(\"Content-Length\",\n                                   String.valueOf(r.length));\n                response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); // 206.\n\n                copyRange(input,\n                          output,\n                          r.start,\n                          r.length);\n            } else {\n                response.setContentType(\"multipart/byteranges; boundary=\" + MULTIPART_BOUNDARY);\n                response.setStatus(HttpServletResponse.SC_PARTIAL_CONTENT); // 206.\n\n                ServletOutputStream sos = (ServletOutputStream) output;\n                for (Range r : ranges) {\n                    sos.println();\n                    sos.println(\"--\" + MULTIPART_BOUNDARY);\n                    sos.println(\"Content-Type: \" + contentType);\n                    sos.println(\"Content-Range: bytes \" + r.start + \"-\" + r.end + \"/\" + r.total);\n\n                    copyRange(input,\n                              output,\n                              r.start,\n                              r.length);\n                }\n\n                sos.println();\n                sos.println(\"--\" + MULTIPART_BOUNDARY + \"--\");\n            }\n        } finally {\n            if (output != null) {\n                output.close();\n            }\n            if (input != null) {\n                input.close();\n            }\n        }\n    }\n\n    private static boolean accepts(final String acceptHeader,\n                                   final String toAccept) {\n        String[] acceptValues = acceptHeader.split(\"\\\\s*(,|;)\\\\s*\");\n        Arrays.sort(acceptValues);\n        return Arrays.binarySearch(acceptValues,\n                                   toAccept) > -1\n                || Arrays.binarySearch(acceptValues,\n                                       toAccept.replaceAll(\"/.*$\",\n                                                           \"/*\")) > -1\n                || Arrays.binarySearch(acceptValues,\n                                       \"*/*\") > -1;\n    }\n\n    private static boolean matches(final String matchHeader,\n                                   final String toMatch) {\n        String[] matchValues = matchHeader.split(\"\\\\s*,\\\\s*\");\n        Arrays.sort(matchValues);\n        return Arrays.binarySearch(matchValues,\n                                   toMatch) > -1\n                || Arrays.binarySearch(matchValues,\n                                       \"*\") > -1;\n    }\n\n    private static void copyRange(final RandomAccessFile input,\n                                  final OutputStream output,\n                                  final long start,\n                                  final long length) throws IOException {\n        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];\n        int read;\n\n        if (input.length() == length) {\n            // Write full range.\n            while ((read = input.read(buffer)) > 0) {\n                output.write(buffer,\n                             0,\n                             read);\n            }\n        } else {\n            // Write partial range.\n            input.seek(start);\n            long toRead = length;\n\n            while ((read = input.read(buffer)) > 0) {\n                if ((toRead -= read) > 0) {\n                    output.write(buffer,\n                                 0,\n                                 read);\n                } else {\n                    output.write(buffer,\n                                 0,\n                                 (int) toRead + read);\n                    break;\n                }\n            }\n        }\n    }\n\n    protected class Range {\n\n        long start;\n        long end;\n        long length;\n        long total;\n\n        public Range(long start,\n                     long end,\n                     long total) {\n            this.start = start;\n            this.end = end;\n            this.length = end - start + 1;\n            this.total = total;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/helpers/HttpPostHelper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport java.io.BufferedInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.Iterator;\nimport java.util.List;\nimport javax.inject.Inject;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileItemFactory;\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.apache.commons.fileupload.disk.DiskFileItemFactory;\nimport org.apache.commons.fileupload.servlet.ServletFileUpload;\nimport org.appformer.maven.support.PomModel;\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.ExtendedM2RepoService;\nimport org.guvnor.m2repo.model.HTMLFileManagerFields;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_MISSING_POM;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_OK;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_UNABLE_TO_PARSE_POM;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isJar;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isKJar;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isPom;\n\npublic class HttpPostHelper {\n\n    private static final Logger log = LoggerFactory.getLogger(HttpPostHelper.class);\n\n    @Inject\n    protected ExtendedM2RepoService m2RepoService;\n\n    /**\n     * Posting accepts content of various types -\n     * may be an attachment for an asset, or perhaps a repository import to process.\n     */\n    public void handle(final HttpServletRequest request,\n                       final HttpServletResponse response) throws ServletException, IOException {\n        response.setContentType(\"text/html\");\n        final FormData formData = extractFormData(request);\n        final String result = upload(formData);\n        response.getWriter().write(result);\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    protected FormData extractFormData(final HttpServletRequest request) throws IOException {\n        FileItemFactory factory = new DiskFileItemFactory();\n        ServletFileUpload upload = new ServletFileUpload(factory);\n        upload.setHeaderEncoding(\"UTF-8\");\n\n        FormData data = new FormData();\n        GAV emptyGAV = new GAV();\n        try {\n            List items = upload.parseRequest(request);\n            Iterator it = items.iterator();\n            while (it.hasNext()) {\n                FileItem item = (FileItem) it.next();\n                if (!item.isFormField()) {\n                    data.setFile(item);\n                }\n\n                if (item.isFormField() && item.getFieldName().equals(HTMLFileManagerFields.GROUP_ID)) {\n                    emptyGAV.setGroupId(item.getString());\n                } else if (item.isFormField() && item.getFieldName().equals(HTMLFileManagerFields.ARTIFACT_ID)) {\n                    emptyGAV.setArtifactId(item.getString());\n                } else if (item.isFormField() && item.getFieldName().equals(HTMLFileManagerFields.VERSION_ID)) {\n                    emptyGAV.setVersion(item.getString());\n                }\n            }\n\n            if (isNullOrEmpty(emptyGAV.getGroupId())\n                    || isNullOrEmpty(emptyGAV.getArtifactId())\n                    || isNullOrEmpty(emptyGAV.getVersion())) {\n                data.setGav(null);\n            } else {\n                data.setGav(emptyGAV);\n            }\n\n            return data;\n        } catch (FileUploadException e) {\n            log.error(e.getMessage(),\n                      e);\n        }\n\n        return null;\n    }\n\n    protected String upload(final FormData formData) throws IOException {\n        //Validate upload\n        final FileItem fileItem = formData.getFile();\n        if (fileItem == null) {\n            throw new IOException(\"No file selected.\");\n        }\n        final String fileName = fileItem.getName();\n        if (isNullOrEmpty(fileName)) {\n            throw new IOException(\"No file selected.\");\n        }\n\n        if (isJar(fileName) || isKJar(fileName)) {\n            return uploadJar(formData);\n        } else if (isPom(fileName)) {\n            return uploadPom(formData);\n        } else {\n            throw new IOException(\"Unsupported file type selected.\");\n        }\n    }\n\n    protected String uploadJar(final FormData formData) throws IOException {\n        GAV gav = formData.getGav();\n        InputStream jarStream = null;\n\n        try {\n            jarStream = formData.getFile().getInputStream();\n            if (gav == null) {\n                if (!jarStream.markSupported()) {\n                    jarStream = new BufferedInputStream(jarStream);\n                }\n\n                // is available() safe?\n                jarStream.mark(jarStream.available());\n\n                PomModel pomModel = PomModelResolver.resolveFromJar(jarStream);\n\n                //If we were able to get a POM model we can get the GAV\n                if (pomModel != null) {\n                    String groupId = pomModel.getReleaseId().getGroupId();\n                    String artifactId = pomModel.getReleaseId().getArtifactId();\n                    String version = pomModel.getReleaseId().getVersion();\n\n                    if (isNullOrEmpty(groupId) || isNullOrEmpty(artifactId) || isNullOrEmpty(version)) {\n                        return UPLOAD_MISSING_POM;\n                    } else {\n                        gav = new GAV(groupId,\n                                      artifactId,\n                                      version);\n                    }\n                } else {\n                    return UPLOAD_MISSING_POM;\n                }\n                jarStream.reset();\n                \n                formData.setGav(gav);\n            }\n            deploy(gav, jarStream);\n\n            return UPLOAD_OK;\n        } catch (IOException ioe) {\n            log.error(ioe.getMessage(),\n                      ioe);\n            throw ExceptionUtilities.handleException(ioe);\n        } finally {\n            if (jarStream != null) {\n                jarStream.close();\n            }\n        }\n    }\n    \n    protected void deploy(GAV gav, InputStream jarStream) {\n\n        m2RepoService.deployJar(jarStream,\n                                gav);\n    }\n\n    protected String uploadPom(final FormData formData) throws IOException {\n        ReusableInputStream pomStream = null;\n\n        try {\n            GAV gav;\n            pomStream = new ReusableInputStream(formData.getFile().getInputStream());\n\n            // is available() safe?\n            pomStream.mark(pomStream.available());\n\n            try {\n                final PomModel pomModel = PomModelResolver.resolveFromPom(pomStream);\n                final String groupId = pomModel.getReleaseId().getGroupId();\n                final String artifactId = pomModel.getReleaseId().getArtifactId();\n                final String version = pomModel.getReleaseId().getVersion();\n\n                if (isNullOrEmpty(groupId) || isNullOrEmpty(artifactId) || isNullOrEmpty(version)) {\n                    return UPLOAD_UNABLE_TO_PARSE_POM;\n                } else {\n                    gav = new GAV(groupId,\n                                  artifactId,\n                                  version);\n                }\n            } catch (Exception e) {\n                log.error(\"Could not parse the uploaded POM.XML file.\",\n                          e);\n                return UPLOAD_UNABLE_TO_PARSE_POM;\n            }\n            pomStream.reset();\n\n            m2RepoService.deployPom(pomStream,\n                                    gav);\n\n            return UPLOAD_OK;\n        } catch (IOException ioe) {\n            log.error(ioe.getMessage(),\n                      ioe);\n            throw ExceptionUtilities.handleException(ioe);\n        } finally {\n            if (pomStream != null) {\n                pomStream.doClose();\n            }\n        }\n    }\n\n    private boolean isNullOrEmpty(String value) {\n        return value == null || value.isEmpty();\n    }\n\n    /**\n     * PomModelResolver uses org.kie.scanner.embedder.MavenEmbedder which closes the underlying\n     * InputStream once the PomModel has been resolved. We however need to keep the InputStream\n     * open to be able to write the file to GuvnorM2Repository. Therefore this sub-class\n     * overrides close to prevent the InputStream from being closed prematurely.\n     */\n    private static class ReusableInputStream extends BufferedInputStream {\n\n        public ReusableInputStream(InputStream in) {\n            super(in);\n        }\n\n        @Override\n        public void close() throws IOException {\n            //Do nothing.\n        }\n\n        void doClose() throws IOException {\n            //Do the closure\n            super.close();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/helpers/HttpPutHelper.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport java.io.BufferedOutputStream;\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URLDecoder;\nimport javax.inject.Inject;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.codehaus.plexus.util.IOUtil;\nimport org.guvnor.m2repo.backend.server.GuvnorM2Repository;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class HttpPutHelper {\n\n    private static final Logger log = LoggerFactory.getLogger(HttpPutHelper.class);\n\n    @Inject\n    private GuvnorM2Repository m2RepoService;\n\n    public void handle(final HttpServletRequest request,\n                       final HttpServletResponse response) throws ServletException, IOException {\n\n        final InputStream inputStream = request.getInputStream();\n        OutputStream outputStream = null;\n        int status = HttpServletResponse.SC_OK;\n\n        try {\n\n            //Get destination path\n            String pathInfo = request.getPathInfo();\n\n            if (pathInfo == null) {\n                response.sendError(HttpServletResponse.SC_NOT_FOUND);\n                return;\n            }\n\n            pathInfo = URLDecoder.decode(pathInfo,\n                                         \"UTF-8\");\n\n            String repositoryName = request.getParameter(\"repository\");\n\n            //File traversal check:\n            final File mavenRootDir = new File(m2RepoService.getM2RepositoryRootDir(repositoryName));\n            final String canonicalDirPath = mavenRootDir.getCanonicalPath() + File.separator;\n            final String canonicalEntryPath = new File(mavenRootDir,\n                                                       pathInfo).getCanonicalPath();\n            if (!canonicalEntryPath.startsWith(canonicalDirPath)) {\n                response.sendError(HttpServletResponse.SC_NOT_FOUND);\n                return;\n            }\n\n            pathInfo = canonicalEntryPath.substring(canonicalDirPath.length());\n            final File file = new File(mavenRootDir,\n                                       pathInfo);\n\n            //Create new file if it does not already exist and set status code to 201\n            //See http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html Section 9.6 PUT\n            if (!file.exists()) {\n                file.getParentFile().mkdirs();\n                file.createNewFile();\n                status = HttpServletResponse.SC_CREATED;\n            }\n\n            outputStream = new BufferedOutputStream(new FileOutputStream(file));\n\n            //Copy input\n            IOUtil.copy(inputStream,\n                        outputStream);\n\n            response.setStatus(status);\n        } catch (FileNotFoundException e) {\n            log.error(e.toString(),\n                      e);\n        } catch (IOException e) {\n            log.error(e.toString(),\n                      e);\n        } finally {\n            if (outputStream != null) {\n                try {\n                    outputStream.flush();\n                    outputStream.close();\n                } catch (IOException e) {\n                    //Swallow\n                }\n            }\n            if (inputStream != null) {\n                try {\n                    inputStream.close();\n                } catch (IOException e) {\n                    //Swallow\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/helpers/PomModelResolver.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\n\nimport org.apache.maven.project.ProjectBuildingException;\nimport org.appformer.maven.integration.embedder.MavenEmbedderException;\nimport org.appformer.maven.support.PomModel;\nimport org.appformer.maven.support.AFReleaseId;\nimport org.appformer.maven.support.AFReleaseIdImpl;\nimport org.guvnor.m2repo.backend.server.GuvnorM2Repository;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class PomModelResolver {\n\n    private static final Logger log = LoggerFactory.getLogger(PomModelResolver.class);\n\n    /**\n     * Construct a PomModel from a JAR by parsing first the pom.xml file within the JAR\n     * and if not present a pom.properties file in the JAR.\n     * @param jarStream InputStream to the JAR\n     * @return a populated PomModel or null if neither pom.xml or pom.properties existed in the JAR\n     */\n    public static PomModel resolveFromJar(InputStream jarStream) {\n        //Attempt to load JAR's POM information from it's pom.xml file\n        PomModel pomModel = null;\n        try {\n            String pomXML = GuvnorM2Repository.loadPomFromJar(jarStream);\n            if (pomXML != null) {\n                pomModel = PomModel.Parser.parse(\"pom.xml\",\n                                                 new ByteArrayInputStream(pomXML.getBytes()));\n            }\n        } catch (Exception e) {\n            log.info(\"Failed to parse pom.xml for GAV information. Falling back to pom.properties.\",\n                     e);\n        }\n\n        //Attempt to load JAR's POM information from it's pom.properties file\n        if (pomModel == null) {\n            try {\n                jarStream.reset();\n                String pomProperties = GuvnorM2Repository.loadPomPropertiesFromJar(jarStream);\n                if (pomProperties != null) {\n                    final AFReleaseId releaseId = AFReleaseIdImpl.fromPropertiesString(pomProperties);\n                    pomModel = new PomModel.InternalModel();\n                    ((PomModel.InternalModel) pomModel).setReleaseId(releaseId);\n                }\n            } catch (Exception e) {\n                log.info(\"Failed to parse pom.properties for GAV information.\");\n            }\n        }\n        return pomModel;\n    }\n\n    /**\n     * Construct a PomModel from a pom.xml file\n     * @param pomStream InputStream to the pom.xml file\n     * @return a populated PomModel or throws exception if the file could not be parsed or deployed\n     */\n    public static PomModel resolveFromPom(InputStream pomStream) throws Exception {\n\n        try {\n            return PomModel.Parser.parse(\"pom.xml\",\n                                         pomStream);\n        } catch (final Exception e) {\n            if (e.getCause() != null) {\n                if (e.getCause() instanceof ProjectBuildingException) {\n                    throw (ProjectBuildingException) e.getCause();\n                }\n                if (e.getCause() instanceof MavenEmbedderException) {\n                    throw (MavenEmbedderException) e.getCause();\n                }\n            }\n\n            log.info(\"Failed to process pom.xml for GAV information.\",\n                     e);\n            throw e;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/ArtifactRepository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.eclipse.aether.artifact.Artifact;\nimport org.guvnor.common.services.project.model.GAV;\n\n/**\n * Represents an artifact repository. Every repository should implement this interface.\n */\npublic interface ArtifactRepository {\n\n    /**\n     * Returns the name of the repository, an identifier\n     * @return the name\n     */\n    String getName();\n\n    /**\n     * Return the root dir of a repository, if it doesn't have one, return null\n     * @return the root dir of a repository.\n     */\n    String getRootDir();\n\n    /**\n     * List repository files filtered by wildcards\n     * @param wildcards the filtering wildcards\n     * @return the files\n     */\n    Collection<File> listFiles(final List<String> wildcards);\n\n    /**\n     * List repository artifacts filtered by wildcards\n     * @param wildcards the filtering wildcards\n     * @return the artifacts\n     */\n    Collection<Artifact> listArtifacts(final List<String> wildcards);\n\n    /**\n     * Deploy a list of artifact into a repository\n     * @param pom the artifact pom\n     * @param artifacts the list of artifacts\n     */\n    void deploy(String pom,\n                Artifact... artifacts);\n\n    /**\n     * Delete an artifact from the repository\n     * @param gav the GAV identifier of the artifact to be deleted\n     */\n    void delete(final GAV gav);\n\n    /**\n     * Checks whether this Maven repository contains the specified artifact (GAV).\n     * <p>\n     * As opposed to ${code {@link #getArtifactFileFromRepository(GAV)}}, this method will not log any WARNings in case\n     * the artifact is not present (the Aether exception is only logged as TRACE message).\n     * @param gav artifact GAV, never null\n     * @return true if the this Maven repo contains the specified artifact, otherwise false\n     */\n    boolean containsArtifact(final GAV gav);\n\n    /**\n     * Return an artifact from the repository\n     * @param gav the GAV identifier\n     * @return the artifact found\n     */\n    File getArtifactFileFromRepository(final GAV gav);\n\n    /**\n     * Identifies if is a repository that admit artifacts\n     * @return\n     */\n    boolean isRepository();\n\n    /**\n     * Identifies if is a repository that admit pom artifacts\n     * @return\n     */\n    boolean isPomRepository();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/ArtifactRepositoryProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.guvnor.m2repo.preferences.ArtifactRepositoryPreference;\nimport org.uberfire.apache.commons.io.FilenameUtils;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceNameResolver;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceScoped;\n\n@ApplicationScoped\npublic class ArtifactRepositoryProducer {\n\n    private ArtifactRepositoryPreference preferences;\n    private WorkspaceNameResolver workspaceNameResolver;\n\n    public ArtifactRepositoryProducer() {\n    }\n\n    @Inject\n    public ArtifactRepositoryProducer(ArtifactRepositoryPreference preferences,\n                                      WorkspaceNameResolver resolver) {\n        this.preferences = preferences;\n        this.workspaceNameResolver = resolver;\n    }\n\n    @PostConstruct\n    public void initialize() {\n        this.preferences.load();\n    }\n\n    @Produces\n    @Repository\n    @ApplicationScoped\n    public ArtifactRepository produceLocalRepository() {\n        return new LocalArtifactRepository(ArtifactRepositoryService.LOCAL_M2_REPO_NAME);\n    }\n\n    @Produces\n    @Repository\n    @ApplicationScoped\n    public ArtifactRepository produceGlobalRepository() {\n        if (!this.preferences.isGlobalM2RepoDirEnabled()) {\n            return new NullArtifactRepository();\n        }\n        return new FileSystemArtifactRepository(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME,\n                                                this.getGlobalM2RepoDir());\n    }\n\n    @Produces\n    @Repository\n    @WorkspaceScoped\n    public ArtifactRepository produceWorkspaceRepository() {\n        if (!this.preferences.isWorkspaceM2RepoDirEnabled()) {\n            return new NullArtifactRepository();\n        }\n        String repoDir = getWorkspaceRepoDir();\n        return new FileSystemArtifactRepository(ArtifactRepositoryService.WORKSPACE_M2_REPO_NAME,\n                                                repoDir);\n    }\n\n    @Produces\n    @Repository\n    @ApplicationScoped\n    public ArtifactRepository produceDistributionManagementRepository() {\n        if (!this.preferences.isDistributionManagementM2RepoDirEnabled()) {\n            return new NullArtifactRepository();\n        }\n        return new DistributionManagementArtifactRepository(ArtifactRepositoryService.DISTRIBUTION_MANAGEMENT_REPO_NAME);\n    }\n\n    private String getGlobalM2RepoDir() {\n        final String repoRoot = FilenameUtils.separatorsToSystem(preferences.getGlobalM2RepoDir());\n\n        final String meReposDir = System.getProperty(ArtifactRepositoryService.ORG_GUVNOR_M2REPO_DIR_PROPERTY);\n\n        String repoDir;\n        if (meReposDir == null || meReposDir.trim().isEmpty()) {\n            repoDir = repoRoot;\n        } else {\n            repoDir = meReposDir.trim();\n        }\n        return repoDir;\n    }\n\n    private String getWorkspaceRepoDir() {\n        String workspace = this.getWorkspaceName();\n        final String repoRoot = FilenameUtils.separatorsToSystem(preferences.getWorkspaceM2RepoDir());\n        String repoDir;\n        if (repoRoot == null || repoRoot.trim().isEmpty()) {\n            repoDir = this.getGlobalM2RepoDir() + File.separator + \"workspaces\";\n        } else {\n            repoDir = repoRoot;\n        }\n        return repoDir + File.separator + workspace;\n    }\n\n    private String getWorkspaceName() {\n        return workspaceNameResolver.getWorkspaceName();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/ArtifactRepositoryService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\n@ApplicationScoped\npublic class ArtifactRepositoryService {\n\n    public static final String LOCAL_M2_REPO_NAME = \"local-m2-repo\";\n    public static final String GLOBAL_M2_REPO_NAME = \"global-m2-repo\";\n    public static final String WORKSPACE_M2_REPO_NAME = \"workspace-m2-repo\";\n    public static final String DISTRIBUTION_MANAGEMENT_REPO_NAME = \"distribution-management-repo\";\n    public static final String ORG_GUVNOR_M2REPO_DIR_PROPERTY = \"org.guvnor.m2repo.dir\";\n    public static final String GLOBAL_M2_REPO_URL = \"org.appformer.m2repo.url\";\n\n    private List<ArtifactRepository> repositories;\n\n    public ArtifactRepositoryService() {\n    }\n\n    @Inject\n    public ArtifactRepositoryService(@Repository @Any Instance<ArtifactRepository> artifactRepositoryInstances) {\n        this.repositories = new ArrayList<>();\n        for (ArtifactRepository artifactRepository : artifactRepositoryInstances) {\n            this.repositories.add(artifactRepository);\n        }\n    }\n\n    public List<? extends ArtifactRepository> getRepositories() {\n        return this.repositories.stream().filter(ArtifactRepository::isRepository).collect(Collectors.toList());\n    }\n\n    public List<? extends ArtifactRepository> getPomRepositories() {\n        return this.repositories.stream().filter(ArtifactRepository::isPomRepository).collect(Collectors.toList());\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/DistributionManagementArtifactRepository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.nio.charset.Charset;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.regex.Pattern;\n\nimport org.apache.maven.model.DeploymentRepository;\nimport org.apache.maven.model.DistributionManagement;\nimport org.apache.maven.project.MavenProject;\nimport org.apache.maven.project.ProjectBuildingException;\nimport org.apache.maven.settings.Proxy;\nimport org.apache.maven.settings.Server;\nimport org.apache.maven.settings.Settings;\nimport org.appformer.maven.integration.Aether;\nimport org.appformer.maven.integration.embedder.MavenEmbedder;\nimport org.appformer.maven.integration.embedder.MavenEmbedderException;\nimport org.appformer.maven.integration.embedder.MavenProjectLoader;\nimport org.appformer.maven.integration.embedder.MavenSettings;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.deployment.DeployRequest;\nimport org.eclipse.aether.deployment.DeploymentException;\nimport org.eclipse.aether.repository.Authentication;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.eclipse.aether.repository.RepositoryPolicy;\nimport org.eclipse.aether.util.repository.AuthenticationBuilder;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class DistributionManagementArtifactRepository implements ArtifactRepository {\n\n    private String name;\n    private Logger logger = LoggerFactory.getLogger(DistributionManagementArtifactRepository.class);\n\n    public DistributionManagementArtifactRepository() {\n    }\n\n    public DistributionManagementArtifactRepository(final String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String getRootDir() {\n        return null;\n    }\n\n    @Override\n    public Collection<File> listFiles(final List<String> wildcards) {\n        return Collections.EMPTY_LIST;\n    }\n\n    @Override\n    public Collection<Artifact> listArtifacts(final List<String> wildcards) {\n        return Collections.EMPTY_LIST;\n    }\n\n    @Override\n    public boolean containsArtifact(final GAV gav) {\n        return false;\n    }\n\n    @Override\n    public File getArtifactFileFromRepository(final GAV gav) {\n        return null;\n    }\n\n    @Override\n    public boolean isRepository() {\n        return true;\n    }\n\n    @Override\n    public boolean isPomRepository() {\n        return false;\n    }\n\n    @Override\n    public void deploy(final String pom,\n                       final Artifact... artifacts) {\n        try {\n\n            MavenEmbedder embedder = MavenProjectLoader.newMavenEmbedder(false);\n            DistributionManagement distributionManagement = getDistributionManagement(pom,\n                                                                                      embedder);\n\n            if (distributionManagement != null) {\n\n                final boolean isSnapshot = Arrays.stream(artifacts).anyMatch(artifact -> artifact.isSnapshot());\n                DeploymentRepository remoteRepository = null;\n                if (isSnapshot) {\n                    remoteRepository = distributionManagement.getSnapshotRepository();\n\n                    //Maven documentation states use of the regular repository if the SNAPSHOT repository is undefined\n                    //See https://maven.apache.org/pom.html#Repository and https://bugzilla.redhat.com/show_bug.cgi?id=1129573\n                    if (remoteRepository == null) {\n                        remoteRepository = distributionManagement.getRepository();\n                    }\n                } else {\n                    remoteRepository = distributionManagement.getRepository();\n                }\n\n                //If the user has configured a distribution management module in the pom then we will attempt to deploy there.\n                //If credentials are required those credentials must be provisioned in the user's settings.xml file\n                if (remoteRepository != null) {\n                    DeployRequest remoteRequest = new DeployRequest();\n\n                    for (Artifact artifact : artifacts) {\n                        remoteRequest.addArtifact(artifact);\n                    }\n\n                    remoteRequest.setRepository(getRemoteRepoFromDeployment(remoteRepository,\n                                                                            embedder));\n\n                    Aether.getAether().getSystem().deploy(Aether.getAether().getSession(),\n                                                          remoteRequest);\n                }\n            }\n        } catch (DeploymentException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private DistributionManagement getDistributionManagement(final String pomXML,\n                                                             final MavenEmbedder embedder) {\n        final InputStream is = new ByteArrayInputStream(pomXML.getBytes(Charset.forName(\"UTF-8\")));\n        MavenProject project = null;\n        try {\n            project = embedder.readProject(is);\n        } catch (ProjectBuildingException e) {\n            logger.error(\"Unable to build Maven project from POM\",\n                         e);\n            throw new RuntimeException(e);\n        } catch (MavenEmbedderException e) {\n            logger.error(\"Unable to build Maven project from POM\",\n                         e);\n            throw new RuntimeException(e);\n        } finally {\n            try {\n                is.close();\n            } catch (IOException ioe) {\n                //Swallow\n            }\n        }\n        return project.getDistributionManagement();\n    }\n\n    private RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository repo,\n                                                         final MavenEmbedder embedder) {\n        RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(repo.getId(), repo.getLayout(), repo.getUrl())\n                .setSnapshotPolicy(new RepositoryPolicy(true,\n                                                        RepositoryPolicy.UPDATE_POLICY_DAILY,\n                                                        RepositoryPolicy.CHECKSUM_POLICY_WARN))\n                .setReleasePolicy(new RepositoryPolicy(true,\n                                                       RepositoryPolicy.UPDATE_POLICY_ALWAYS,\n                                                       RepositoryPolicy.CHECKSUM_POLICY_WARN));\n\n        Settings settings = MavenSettings.getSettings();\n        Server server = settings.getServer(repo.getId());\n\n        Proxy activeProxy = settings.getActiveProxy();\n\n        if (activeProxy != null) {\n            if (activeProxy.getNonProxyHosts() == null || !repositoryUrlMatchNonProxyHosts(settings.getActiveProxy().getNonProxyHosts(), remoteRepoBuilder.build().getUrl())) {\n                remoteRepoBuilder.setProxy(getActiveAetherProxyFromSettings(settings));\n            }\n        }\n        if (server != null) {\n            Authentication authentication = embedder.getMavenSession().getRepositorySession()\n                    .getAuthenticationSelector()\n                    .getAuthentication(remoteRepoBuilder.build());\n            remoteRepoBuilder.setAuthentication(authentication);\n        }\n\n        return remoteRepoBuilder.build();\n    }\n\n    private boolean repositoryUrlMatchNonProxyHosts(String nonProxyHosts, String artifactURL) {\n        String nonProxyHostsRegexp = nonProxyHosts.replace(\"*\", \".*\");\n        try {\n            Pattern p = Pattern.compile(nonProxyHostsRegexp);\n            URL url = new URL(artifactURL);\n            return p.matcher(url.getHost()).find();\n        } catch (MalformedURLException e) {\n            logger.warn(\"Failed to parse URL proxy {}, cause {}\", artifactURL, e.getMessage());\n            return false;\n        }\n    }\n\n    private org.eclipse.aether.repository.Proxy getActiveAetherProxyFromSettings(final Settings settings) {\n        return new org.eclipse.aether.repository.Proxy(settings.getActiveProxy().getProtocol(),\n                                                       settings.getActiveProxy().getHost(),\n                                                       settings.getActiveProxy().getPort(),\n                                                       new AuthenticationBuilder()\n                                                               .addUsername(settings.getActiveProxy().getUsername())\n                                                               .addPassword(settings.getActiveProxy().getPassword())\n                                                               .build());\n    }\n\n    @Override\n    public void delete(final GAV gav) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/FileSystemArtifactRepository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\nimport java.net.MalformedURLException;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.io.IOCase;\nimport org.apache.commons.io.filefilter.DirectoryFileFilter;\nimport org.apache.commons.io.filefilter.WildcardFileFilter;\nimport org.appformer.maven.integration.Aether;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.deployment.DeployRequest;\nimport org.eclipse.aether.deployment.DeploymentException;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.eclipse.aether.repository.RepositoryPolicy;\nimport org.eclipse.aether.resolution.ArtifactRequest;\nimport org.eclipse.aether.resolution.ArtifactResolutionException;\nimport org.eclipse.aether.resolution.ArtifactResult;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.ArtifactImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.apache.commons.io.FilenameUtils;\n\npublic class FileSystemArtifactRepository implements ArtifactRepository {\n\n    private String name;\n    private Logger logger = LoggerFactory.getLogger(FileSystemArtifactRepository.class);\n\n    private RemoteRepository repository;\n    private String repositoryDirectory;\n\n    public FileSystemArtifactRepository() {\n    }\n\n    public FileSystemArtifactRepository(final String name,\n                                        final String dir) {\n        this.name = name;\n        final String m2RepoDir = FilenameUtils.normalize(dir.trim() + File.separatorChar);\n        logger.info(\"Maven Repository root set to: \" + m2RepoDir);\n\n        //Ensure repository root has been created\n        final File root = new File(m2RepoDir);\n        if (!root.exists()) {\n            logger.info(\"Creating Maven Repository root: \" + m2RepoDir);\n            root.mkdirs();\n        }\n        this.repositoryDirectory = dir;\n        this.repository = this.createRepository(dir);\n        Aether.getAether().getRepositories().add(this.getRepository());\n    }\n\n    @Override\n    public String getName() {\n        return this.name;\n    }\n\n    @Override\n    public String getRootDir() {\n        return this.getRepositoryDirectory();\n    }\n\n    @Override\n    public Collection<File> listFiles(final List<String> wildcards) {\n        return FileUtils.listFiles(new File(this.getRepositoryDirectory()),\n                                   new WildcardFileFilter(wildcards,\n                                                          IOCase.INSENSITIVE),\n                                   DirectoryFileFilter.DIRECTORY);\n    }\n\n    @Override\n    public Collection<Artifact> listArtifacts(final List<String> wildcards) {\n        final Collection<File> files = this.listFiles(wildcards);\n\n        return files.stream().map(file -> {\n            final HashMap<String, String> map = new HashMap<String, String>();\n            map.put(\"repository\",\n                    this.getName());\n            final ArtifactImpl artifact = new ArtifactImpl(file);\n            artifact.setProperties(map);\n            return artifact;\n        }).collect(Collectors.toList());\n    }\n\n    @Override\n    public boolean containsArtifact(final GAV gav) {\n        ArtifactRequest request = createArtifactRequest(gav);\n        try {\n            Aether aether = Aether.getAether();\n            aether.getSystem().resolveArtifact(aether.getSession(),\n                                               request);\n        } catch (ArtifactResolutionException e) {\n            logger.trace(\"Artifact {} not found.\",\n                         gav,\n                         e);\n            return false;\n        }\n        logger.trace(\"Artifact {} found.\",\n                     gav);\n        return true;\n    }\n\n    @Override\n    public File getArtifactFileFromRepository(final GAV gav) {\n        ArtifactRequest request = createArtifactRequest(gav);\n        ArtifactResult result = null;\n        try {\n            result = Aether.getAether().getSystem().resolveArtifact(\n                    Aether.getAether().getSession(),\n                    request);\n        } catch (ArtifactResolutionException e) {\n            logger.warn(e.getMessage(),\n                        e);\n        }\n\n        if (result == null) {\n            return null;\n        }\n\n        File artifactFile = null;\n        if (result.isResolved() && !result.isMissing()) {\n            artifactFile = result.getArtifact().getFile();\n        }\n\n        return artifactFile;\n    }\n\n    @Override\n    public boolean isRepository() {\n        return true;\n    }\n\n    @Override\n    public boolean isPomRepository() {\n        return true;\n    }\n\n    @Override\n    public void deploy(final String pom,\n                       final Artifact... artifacts) {\n        try {\n            final DeployRequest deployRequest = new DeployRequest();\n\n            for (Artifact artifact : artifacts) {\n                deployRequest.addArtifact(artifact);\n            }\n\n            deployRequest.setRepository(getRepository());\n\n            Aether.getAether().getSystem().deploy(Aether.getAether().getSession(),\n                                                  deployRequest);\n        } catch (DeploymentException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void delete(final GAV gav) {\n\n    }\n\n    private ArtifactRequest createArtifactRequest(final GAV gav) {\n        ArtifactRequest request = new ArtifactRequest();\n        request.addRepository(this.getRepository());\n        DefaultArtifact artifact = new DefaultArtifact(gav.getGroupId(),\n                                                       gav.getArtifactId(),\n                                                       \"jar\",\n                                                       gav.getVersion());\n        request.setArtifact(artifact);\n        return request;\n    }\n\n    protected RemoteRepository getRepository() {\n        return this.repository;\n    }\n\n    private RemoteRepository createRepository(final String dir) {\n        File m2RepoDir = new File(dir);\n        if (!m2RepoDir.exists()) {\n            logger.error(\"Repository root does not exist: \" + dir);\n            throw new IllegalArgumentException(\"Repository root does not exist: \" + dir);\n        }\n\n        try {\n            String localRepositoryUrl = m2RepoDir.toURI().toURL().toExternalForm();\n            return new RemoteRepository.Builder(this.getName(),\n                                                \"default\",\n                                                localRepositoryUrl)\n                    .setSnapshotPolicy(new RepositoryPolicy(true,\n                                                            RepositoryPolicy.UPDATE_POLICY_DAILY,\n                                                            RepositoryPolicy.CHECKSUM_POLICY_WARN))\n                    .setReleasePolicy(new RepositoryPolicy(true,\n                                                           RepositoryPolicy.UPDATE_POLICY_ALWAYS,\n                                                           RepositoryPolicy.CHECKSUM_POLICY_WARN))\n                    .build();\n        } catch (MalformedURLException e) {\n            logger.error(e.getMessage(),\n                         e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    private String getRepositoryDirectory() {\n        return repositoryDirectory;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/LocalArtifactRepository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.appformer.maven.integration.Aether;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.installation.InstallRequest;\nimport org.eclipse.aether.installation.InstallationException;\nimport org.guvnor.common.services.project.model.GAV;\n\npublic class LocalArtifactRepository implements ArtifactRepository {\n\n    private String name;\n\n    public LocalArtifactRepository() {\n    }\n\n    public LocalArtifactRepository(final String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String getRootDir() {\n        return Aether.getAether()\n                .getLocalRepository()\n                .getUrl()\n                .replaceAll(\"^file:\",\n                            \"\")\n                .replaceAll(File.separatorChar + \"$\",\n                            \"\");\n    }\n\n    @Override\n    public Collection<File> listFiles(final List<String> wildcards) {\n        return Collections.EMPTY_LIST;\n    }\n\n    @Override\n    public Collection<Artifact> listArtifacts(final List<String> wildcards) {\n        return Collections.EMPTY_LIST;\n    }\n\n    @Override\n    public boolean containsArtifact(final GAV gav) {\n        return false;\n    }\n\n    @Override\n    public File getArtifactFileFromRepository(final GAV gav) {\n        return null;\n    }\n\n    @Override\n    public boolean isRepository() {\n        return true;\n    }\n\n    @Override\n    public boolean isPomRepository() {\n        return true;\n    }\n\n    @Override\n    public void deploy(final String pom,\n                       Artifact... artifacts) {\n\n        try {\n            final InstallRequest installRequest = new InstallRequest();\n            for (Artifact artifact : artifacts) {\n                installRequest\n                        .addArtifact(artifact);\n            }\n            Aether.getAether().getSystem().install(Aether.getAether().getSession(),\n                                                   installRequest);\n        } catch (InstallationException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void delete(final GAV gav) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/NullArtifactRepository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.eclipse.aether.artifact.Artifact;\nimport org.guvnor.common.services.project.model.GAV;\n\npublic class NullArtifactRepository implements ArtifactRepository {\n\n    private static final String NULL_ARTIFACT_REPOSITORY_NAME = \"null-m2-repo\";\n\n    @Override\n    public String getName() {\n        return NULL_ARTIFACT_REPOSITORY_NAME;\n    }\n\n    @Override\n    public String getRootDir() {\n        return null;\n    }\n\n    @Override\n    public Collection<File> listFiles(List<String> wildcards) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public Collection<Artifact> listArtifacts(List<String> wildcards) {\n        return Collections.emptyList();\n    }\n\n    @Override\n    public void deploy(String pom,\n                       Artifact... artifacts) {\n\n    }\n\n    @Override\n    public void delete(GAV gav) {\n\n    }\n\n    @Override\n    public boolean containsArtifact(GAV gav) {\n        return false;\n    }\n\n    @Override\n    public File getArtifactFileFromRepository(GAV gav) {\n        return null;\n    }\n\n    @Override\n    public boolean isRepository() {\n        return false;\n    }\n\n    @Override\n    public boolean isPomRepository() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/java/org/guvnor/m2repo/backend/server/repositories/Repository.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\n@Target({TYPE, METHOD, PARAMETER})\npublic @interface Repository {\n\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/FixNotMavenizedArtifactInfoTest.java",
    "content": "package org.guvnor.m2repo.backend.server;\n\nimport java.util.Properties;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.junit.Test;\n\nimport static junit.framework.TestCase.assertFalse;\nimport static junit.framework.TestCase.assertTrue;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.ARTIFACT_ID;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.GROUP_ID;\nimport static org.guvnor.m2repo.backend.server.M2ServletContextListener.VERSION;\n\npublic class FixNotMavenizedArtifactInfoTest {\n\n    @Test\n    public void testProperties() {\n        final FixNotMavenizedArtifactInfo fixNotMavenizedArtifactInfo = new FixNotMavenizedArtifactInfo();\n        {\n            final Properties result = fixNotMavenizedArtifactInfo.getProperties(\"/opt/wildfly/standalone/tmp/vfs/temp/temp9c869d5d938ad120/content-b548cc99838ba656/WEB-INF/lib/junit-4.12.jar\");\n\n            assertFalse(result.isEmpty());\n            assertThat(result.getProperty(GROUP_ID)).isEqualTo(\"junit\");\n            assertThat(result.getProperty(ARTIFACT_ID)).isEqualTo(\"junit\");\n            assertThat(result.getProperty(VERSION)).isEqualTo(\"4.12\");\n        }\n\n        {\n            final Properties result = fixNotMavenizedArtifactInfo.getProperties(\"/opt/wildfly/standalone/tmp/vfs/temp/temp9c869d5d938ad120/content-b548cc99838ba656/WEB-INF/lib/ant-launcher-X.12-SNAPSHOT.jar\");\n\n            assertFalse(result.isEmpty());\n            assertThat(result.getProperty(GROUP_ID)).isEqualTo(\"org.apache.ant\");\n            assertThat(result.getProperty(ARTIFACT_ID)).isEqualTo(\"ant-launcher\");\n            assertThat(result.getProperty(VERSION)).isEqualTo(\"X.12-SNAPSHOT\");\n        }\n\n        {\n            final Properties result = fixNotMavenizedArtifactInfo.getProperties(\"/opt/wildfly/standalone/tmp/vfs/temp/temp9c869d5d938ad120/content-b548cc99838ba656/WEB-INF/lib/ant-X.12-SNAPSHOT.jar\");\n\n            assertFalse(result.isEmpty());\n            assertThat(result.getProperty(GROUP_ID)).isEqualTo(\"org.apache.ant\");\n            assertThat(result.getProperty(ARTIFACT_ID)).isEqualTo(\"ant\");\n            assertThat(result.getProperty(VERSION)).isEqualTo(\"X.12-SNAPSHOT\");\n        }\n    }\n\n    @Test\n    public void testEmptyProperties() {\n        final FixNotMavenizedArtifactInfo fixNotMavenizedArtifactInfo = new FixNotMavenizedArtifactInfo();\n        final Properties result = fixNotMavenizedArtifactInfo.getProperties(\"/opt/wildfly/standalone/tmp/vfs/temp/temp9c869d5d938ad120/content-b548cc99838ba656/WEB-INF/lib/xxjunit-4.12.jar\");\n        assertTrue(result.isEmpty());\n    }\n\n    @Test\n    public void testBuildPOM() {\n        final FixNotMavenizedArtifactInfo fixNotMavenizedArtifactInfo = new FixNotMavenizedArtifactInfo();\n\n        final GAV gav = new GAV(\"junit\", \"junit\", \"4.12\");\n\n        final String pomResult = fixNotMavenizedArtifactInfo.buildPom(gav);\n        assertThat(pomResult).isEqualTo(\"<project xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                                                \"         xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\"\\n\" +\n                                                \"         xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\">\\n\" +\n                                                \"\\n\" +\n                                                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                                                \"  <groupId>junit</groupId>\\n\" +\n                                                \"  <artifactId>junit</artifactId>\\n\" +\n                                                \"  <version>4.12</version>\\n\" +\n                                                \"  <packaging>jar</packaging>\\n\" +\n                                                \"</project>\");\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/GAVResolverFromParentPomTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.io.InputStream;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.appformer.maven.support.PomModel;\nimport org.guvnor.m2repo.backend.server.helpers.FormData;\nimport org.guvnor.m2repo.backend.server.helpers.HttpPostHelper;\nimport org.guvnor.m2repo.backend.server.helpers.PomModelResolver;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static junit.framework.TestCase.assertEquals;\nimport static org.guvnor.m2repo.backend.server.M2RepoServiceCreator.deleteDir;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_OK;\n\npublic class GAVResolverFromParentPomTest {\n\n    private static final Logger log = LoggerFactory.getLogger(GAVResolverFromParentPomTest.class);\n\n    private static final String PARENT_POM = \"parent-gav-pom.xml\";\n\n    @AfterClass\n    public static void tearDown() {\n        log.info(\"Deleting all Repository instances..\");\n\n        File dir = new File(\"repositories\");\n        log.info(\"DELETING test repo: \" + dir.getAbsolutePath());\n        deleteDir(dir);\n        log.info(\"TEST repo was deleted.\");\n    }\n\n    @Before\n    public void setup() throws Exception {\n        M2RepoServiceCreator m2RepoServiceCreator = new M2RepoServiceCreator();\n        HttpPostHelper helper = m2RepoServiceCreator.getHelper();\n        java.lang.reflect.Method helperMethod = m2RepoServiceCreator.getHelperMethod();\n\n        FormData uploadItem = new FormData();\n        FileItem file = new MockFileItem(\"pom.xml\",\n                                         this.getClass().getResourceAsStream(PARENT_POM));\n        uploadItem.setFile(file);\n\n        assertEquals(\"Error occurred when uploading pom\", UPLOAD_OK, helperMethod.invoke(helper,\n                                                                                         uploadItem));\n    }\n\n    @Test\n    public void testResolveGavFromParentPomOnlyGroupID() throws Exception {\n        String pathToPomWithoutVersion = \"org/guvnor/m2repo/backend/server/helpers/gav-pom-without-version.xml\";\n\n        final PomModel pomModel = resolvePom(pathToPomWithoutVersion);\n        assertEquals(\"The groupID does not match to child pom\", \"org.guvnor.m2repo.backend.server.helpers\", pomModel.getReleaseId().getGroupId());\n        assertEquals(\"The version does not match to parent pom\", \"1.0\", pomModel.getReleaseId().getVersion());\n    }\n\n    @Test\n    public void testResolveGavFromParentPomOnlyVersion() throws Exception {\n        String pathToPomWithoutGroup = \"org/guvnor/m2repo/backend/server/helpers/gav-pom-without-group.xml\";\n\n        final PomModel pomModel = resolvePom(pathToPomWithoutGroup);\n        assertEquals(\"The groupID does not match to parent pom\", \"org.guvnor.test\", pomModel.getReleaseId().getGroupId());\n        assertEquals(\"The version does not match to child pom\", \"1.1.1\", pomModel.getReleaseId().getVersion());\n    }\n\n    private PomModel resolvePom(String path) throws Exception {\n        InputStream pomInputStream = this.getClass().getClassLoader().getResourceAsStream(path);\n        return PomModelResolver.resolveFromPom(pomInputStream);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/GuvnorM2RepositoryTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.lang.reflect.Field;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.inject.Instance;\n\nimport org.appformer.maven.integration.Aether;\nimport org.eclipse.aether.RepositorySystem;\nimport org.eclipse.aether.RepositorySystemSession;\nimport org.eclipse.aether.deployment.DeployRequest;\nimport org.eclipse.aether.installation.InstallRequest;\nimport org.eclipse.aether.installation.InstallResult;\nimport org.eclipse.aether.installation.InstallationException;\nimport org.eclipse.aether.repository.Authentication;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepository;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryProducer;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.guvnor.m2repo.preferences.ArtifactRepositoryPreference;\nimport org.hamcrest.BaseMatcher;\nimport org.hamcrest.Description;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.rules.ExpectedException;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentMatcher;\nimport org.mockito.ArgumentMatchers;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.powermock.core.classloader.annotations.PowerMockIgnore;\nimport org.powermock.core.classloader.annotations.PrepareForTest;\nimport org.powermock.modules.junit4.PowerMockRunner;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceNameResolver;\nimport org.uberfire.mocks.MockInstanceImpl;\n\nimport static org.junit.Assert.*;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.argThat;\nimport static org.mockito.Mockito.*;\nimport static org.powermock.api.mockito.PowerMockito.mockStatic;\n\n@RunWith(PowerMockRunner.class)\n@PrepareForTest(Aether.class)\n@PowerMockIgnore({\"javax.crypto.*\", \"javax.net.ssl.*\", \"javax.net.*\", \"javax.security.auth.x500.X500Principal\"})\npublic class GuvnorM2RepositoryTest {\n\n    public static final String KIE_SETTINGS_CUSTOM_KEY = \"kie.maven.settings.custom\";\n    public static final String SETTINGS_SECURITY_KEY = \"settings.security\";\n\n    private static final Logger log = LoggerFactory.getLogger(GuvnorM2RepositoryTest.class);\n    private static String settingsSecurityOriginalValue;\n    private static String kieSettingsCustomOriginalValue;\n\n    private GuvnorM2Repository repo;\n    private RepositorySystem repositorySystem = mock(RepositorySystem.class);\n    private RepositorySystemSession repositorySystemSession = mock(RepositorySystemSession.class);\n\n    @Rule\n    public final ExpectedException exception = ExpectedException.none();\n\n    @BeforeClass\n    public static void setupClass() throws IOException, URISyntaxException {\n        settingsSecurityOriginalValue = System.getProperty(SETTINGS_SECURITY_KEY);\n        System.setProperty(SETTINGS_SECURITY_KEY,\n                           resolveFilePath(\"settings-security.xml\"));\n        kieSettingsCustomOriginalValue = System.getProperty(KIE_SETTINGS_CUSTOM_KEY);\n        System.setProperty(KIE_SETTINGS_CUSTOM_KEY,\n                           resolveFilePath(\"settings.xml\"));\n    }\n\n    private static String resolveFilePath(String value) throws URISyntaxException {\n        final URL url = GuvnorM2RepositoryTest.class.getResource(value);\n        final URI uri = url.toURI();\n        final File f = new File(uri);\n        return f.getAbsolutePath();\n    }\n\n    @AfterClass\n    public static void tearDownClass() throws Exception {\n        nullSafeSetProperty(SETTINGS_SECURITY_KEY,\n                            settingsSecurityOriginalValue);\n        nullSafeSetProperty(KIE_SETTINGS_CUSTOM_KEY,\n                            kieSettingsCustomOriginalValue);\n    }\n\n    private static void nullSafeSetProperty(final String propertyKey,\n                                            final String propertyValue) {\n        System.setProperty(propertyKey,\n                           propertyValue == null ? \"\" : propertyValue);\n    }\n\n    @Before\n    public void setup() throws Exception {\n        log.info(\"Deleting existing Repositories instance..\");\n        ArtifactRepositoryPreference pref = mock(ArtifactRepositoryPreference.class);\n        when(pref.getGlobalM2RepoDir()).thenReturn(\"repositories/kie\");\n        when(pref.isGlobalM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isDistributionManagementM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isWorkspaceM2RepoDirEnabled()).thenReturn(false);\n        WorkspaceNameResolver resolver = mock(WorkspaceNameResolver.class);\n        when(resolver.getWorkspaceName()).thenReturn(\"global\");\n        ArtifactRepositoryProducer producer = new ArtifactRepositoryProducer(pref,\n                                                                             resolver);\n        producer.initialize();\n        Instance<ArtifactRepository> repositories = new MockInstanceImpl<>(producer.produceLocalRepository(),\n                                                                           producer.produceGlobalRepository(),\n                                                                           producer.produceDistributionManagementRepository());\n        ArtifactRepositoryService factory = new ArtifactRepositoryService(repositories);\n\n        repo = new GuvnorM2Repository(factory);\n        repo.init();\n\n        Aether aether = mock(Aether.class);\n        when(aether.getSession()).thenReturn(repositorySystemSession);\n        when(aether.getSystem()).thenReturn(repositorySystem);\n\n        mockStatic(Aether.class);\n        when(Aether.getAether()).thenReturn(aether);\n\n        try {\n            when(repositorySystem.install(any(RepositorySystemSession.class),\n                                          any(InstallRequest.class)))\n                    .thenAnswer(new Answer<InstallResult>() {\n                        @Override\n                        public InstallResult answer(InvocationOnMock invocation) throws Throwable {\n                            return new InstallResult((InstallRequest) invocation.getArguments()[1]);\n                        }\n                    });\n        } catch (InstallationException e) {\n            e.printStackTrace();\n        }\n    }\n\n    @Test\n    public void testDeployArtifactWithDeployArtifactDistributionManagement() throws Exception {\n        final GAV gav = new GAV(\"org.kie.guvnor\",\n                                \"guvnor-m2repo-editor-backend\",\n                                \"0.0.1-SNAPSHOT\");\n\n        final InputStream is = this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-with-distribution-management.jar\");\n        repo.deployArtifact(is,\n                            gav,\n                            true);\n\n        verify(repositorySystem,\n               times(1)).deploy(any(RepositorySystemSession.class),\n                                argThat(request -> \"global-m2-repo\".equals(request.getRepository().getId())));\n        verify(repositorySystem,\n               times(1)).deploy(any(RepositorySystemSession.class),\n                                argThat(request -> {\n                                    String string = \"example.project.http\";\n                                    RemoteRepository repo = request.getRepository();\n                                    boolean equals = string.equals(repo.getId());\n                                    if (!equals) {\n                                        return false;\n                                    }\n                                    Authentication auth = repo.getAuthentication();\n                                    Class<? extends Authentication> class1 = auth.getClass();\n                                    try {\n                                        Field declaredField = class1.getDeclaredField(\"authentications\");\n                                        declaredField.setAccessible(true);\n                                        Authentication[] object = (Authentication[]) declaredField.get(auth);\n                                        Authentication authentication = object[1];\n                                        Class<? extends Authentication> class2 = authentication.getClass();\n                                        boolean equals3 = \"SecretAuthentication\".equals(class2.getSimpleName());\n                                        if (equals3) {\n                                            Field valueField = class2.getDeclaredField(\"value\");\n                                            valueField.setAccessible(true);\n                                            // length of plaintext password, obviously not\n                                            // length of encrypted password\n                                            assertEquals(\"Plaintext pw (repopw) length expected.\",\n                                                         6,\n                                                         ((char[]) valueField.get(authentication)).length);\n                                        }\n                                        return \"StringAuthentication\".equals(object[0].getClass().getSimpleName()) && equals3;\n                                    } catch (Exception e) {\n                                        e.printStackTrace();\n                                        throw new RuntimeException(e);\n                                    }\n                                }));\n    }\n    \n    @Test\n    public void testDeployArtifactFilteredOutAllRepositories() throws Exception {\n        final GAV gav = new GAV(\"org.kie.guvnor\",\n                                \"guvnor-m2repo-editor-backend\",\n                                \"0.0.1-SNAPSHOT\");\n\n        final InputStream is = this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-with-distribution-management.jar\");\n        repo.deployArtifact(is,\n                            gav,\n                            true,\n                            (repo) -> false);\n\n        verify(repositorySystem,\n               never()).deploy(any(RepositorySystemSession.class),\n                                any());\n    }\n    \n    @Test\n    public void testContainArtifact() throws Exception {\n        final GAV gav = new GAV(\"org.kie.guvnor\",\n                                \"guvnor-m2repo-editor-backend\",\n                                \"0.0.1-SNAPSHOT\");\n\n        \n        repo.containsArtifact(gav);\n\n        verify(repositorySystem,\n               times(1)).resolveArtifact(any(),\n                                        any());\n    }\n    \n    @Test\n    public void testContainArtifactFilteredOutAllRepositories() throws Exception {\n        final GAV gav = new GAV(\"org.kie.guvnor\",\n                                \"guvnor-m2repo-editor-backend\",\n                                \"0.0.1-SNAPSHOT\");\n\n        \n        repo.containsArtifact(gav,\n                              (repo) -> false);\n\n        verify(repositorySystem,\n               never()).resolveArtifact(any(),\n                                        any());\n    }\n\n    @Test\n    public void testListFilesWithoutParameters() {\n        List<String> wildcards = new ArrayList<String>();\n        wildcards.add(\"*.jar\");\n        wildcards.add(\"*.kjar\");\n        wildcards.add(\"*.pom\");\n\n        GuvnorM2Repository spiedRepo = spy(repo);\n\n        doReturn(new ArrayList<String>()).when(spiedRepo).getFiles(ArgumentMatchers.<List<String>>any());\n\n        spiedRepo.listFiles();\n        verify(spiedRepo).getFiles(wildcards);\n    }\n\n    @Test\n    public void testListFilesWithFilter() {\n        final String filter = \"filter\";\n\n        List<String> wildcards = new ArrayList<String>();\n        wildcards.add(\"*\" + filter + \"*.jar\");\n        wildcards.add(\"*\" + filter + \"*.kjar\");\n        wildcards.add(\"*\" + filter + \"*.pom\");\n\n        GuvnorM2Repository spiedRepo = spy(repo);\n\n        doReturn(new ArrayList<String>()).when(spiedRepo).getFiles(ArgumentMatchers.<List<String>>any());\n\n        spiedRepo.listFiles(filter);\n        verify(spiedRepo).getFiles(wildcards);\n    }\n\n    @Test\n    public void testListFilesWithFilterAndFileFormats() {\n        final String filter = \"filter\";\n\n        List<String> fileFormats = new ArrayList<String>();\n        fileFormats.add(\"xml\");\n        fileFormats.add(\"war\");\n\n        List<String> wildcards = new ArrayList<String>();\n        wildcards.add(\"*\" + filter + \"*.xml\");\n        wildcards.add(\"*\" + filter + \"*.war\");\n\n        GuvnorM2Repository spiedRepo = spy(repo);\n\n        doReturn(new ArrayList<String>()).when(spiedRepo).getFiles(ArgumentMatchers.<List<String>>any());\n\n        spiedRepo.listFiles(filter,\n                            fileFormats);\n        verify(spiedRepo).getFiles(wildcards);\n    }\n\n    @Test\n    public void testGetPomTextVerifiesPath() {\n        repo.getPomText(\"dir/name.pom\");\n        repo.getPomText(\"dir/name.kjar\");\n        repo.getPomText(\"dir/name.jar\");\n\n        exception.expect(RuntimeException.class);\n        repo.getPomText(\"dir/name.foo\");\n    }\n\n    @Test\n    public void testLoadFileTextFromJar() {\n        File jarFile = new File(\"src/test/resources/org/guvnor/m2repo/backend/server/evaluation-12.1.1.jar\");\n        assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, GuvnorM2Repository.KIE_DEPLOYMENT_DESCRIPTOR_XML));\n        assertNotNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, GuvnorM2Repository.KMODULE_XML));\n\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, \"kie-descriptor.xml\"));\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, \"modu.xml\"));\n\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, \"\"));\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, \"\"));\n\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, null));\n        assertNull(GuvnorM2Repository.loadFileTextFromJar(jarFile, GuvnorM2Repository.META_INF, null));\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/JarPathTest.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepository;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryProducer;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.guvnor.m2repo.preferences.ArtifactRepositoryPreference;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceNameResolver;\nimport org.uberfire.mocks.MockInstanceImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class JarPathTest {\n\n    private GuvnorM2Repository repository;\n\n    @Before\n    public void setupGuvnorM2Repository() {\n        ArtifactRepositoryPreference pref = mock(ArtifactRepositoryPreference.class);\n        when(pref.getGlobalM2RepoDir()).thenReturn(\"repositories/kie\");\n        when(pref.isGlobalM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isDistributionManagementM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isWorkspaceM2RepoDirEnabled()).thenReturn(false);\n        WorkspaceNameResolver resolver = mock(WorkspaceNameResolver.class);\n        when(resolver.getWorkspaceName()).thenReturn(\"global\");\n        ArtifactRepositoryProducer producer = new ArtifactRepositoryProducer(pref,\n                                                                             resolver);\n        producer.initialize();\n        Instance<ArtifactRepository> repositories = new MockInstanceImpl<>(producer.produceLocalRepository(),\n                                                                           producer.produceGlobalRepository(),\n                                                                           producer.produceDistributionManagementRepository());\n        ArtifactRepositoryService factory = new ArtifactRepositoryService(repositories);\n        repository = new GuvnorM2Repository(factory);\n        repository.init();\n    }\n\n    @Test\n    public void testLinuxPathSeparators() {\n        final M2RepoServiceImpl service = new M2RepoServiceImpl(mock(Logger.class),\n                                                                this.repository);\n        final String jarPath = service.getJarPath(repository.getM2RepositoryDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME) + \"/a/b/c\",\n                                                  \"/\");\n        assertEquals(\"a/b/c\",\n                     jarPath);\n    }\n\n    @Test\n    public void testWindowsPathSeparators() {\n        final M2RepoServiceImpl service = new M2RepoServiceImpl(mock(Logger.class),\n                                                                this.repository);\n        final String jarPath = service.getJarPath(repository.getM2RepositoryDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME) + \"\\\\a\\\\b\\\\c\",\n                                                  \"\\\\\");\n        assertEquals(\"a/b/c\",\n                     jarPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/M2MavenRepositoryServiceImplTest.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Enumeration;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.jar.JarEntry;\nimport java.util.jar.JarFile;\nimport java.util.stream.Collectors;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.m2repo.backend.server.helpers.FormData;\nimport org.guvnor.m2repo.backend.server.helpers.HttpPostHelper;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.rules.ExpectedException;\nimport org.mockito.ArgumentMatchers;\nimport org.mockito.Mockito;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.paging.PageResponse;\n\nimport static java.util.Collections.singletonList;\nimport static org.guvnor.m2repo.backend.server.M2RepoServiceCreator.deleteDir;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_OK;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class M2MavenRepositoryServiceImplTest {\n\n    private static final Logger log = LoggerFactory.getLogger(M2MavenRepositoryServiceImplTest.class);\n    private static GAV gavBackend;\n    private static GAV gavBackend1;\n    private static GAV gavBackend2;\n    private static GAV gavArquillian;\n    @Rule\n    public final ExpectedException exception = ExpectedException.none();\n    private GuvnorM2Repository repo;\n    private M2RepoServiceImpl service;\n    private HttpPostHelper helper;\n    private java.lang.reflect.Method helperMethod;\n\n    @BeforeClass\n    public static void setupClass() {\n        gavBackend = new GAV(\"org.kie.guvnor\",\n                             \"guvnor-m2repo-editor-backend\",\n                             \"0.0.1-SNAPSHOT\");\n\n        gavBackend1 = new GAV(\"org.kie.guvnor\",\n                              \"guvnor-m2repo-editor-backend1\",\n                              \"0.0.1-SNAPSHOT\");\n\n        gavBackend2 = new GAV(\"org.kie.guvnor\",\n                              \"guvnor-m2repo-editor-backend2\",\n                              \"0.0.1-SNAPSHOT\");\n\n        gavArquillian = new GAV(\"org.jboss.arquillian.core\",\n                                \"arquillian-core-api\",\n                                \"1.0.2.Final\");\n    }\n\n    @AfterClass\n    public static void tearDown() throws Exception {\n        log.info(\"Deleting all Repository instances..\");\n\n        File dir = new File(\"repositories\");\n        log.info(\"DELETING test repo: \" + dir.getAbsolutePath());\n        deleteDir(dir);\n        log.info(\"TEST repo was deleted.\");\n    }\n\n    @Before\n    public void setup() throws Exception {\n        M2RepoServiceCreator m2RepoServiceCreator = new M2RepoServiceCreator();\n        this.repo = m2RepoServiceCreator.getRepo();\n        this.service = m2RepoServiceCreator.getService();\n        this.helper = m2RepoServiceCreator.getHelper();\n        this.helperMethod = m2RepoServiceCreator.getHelperMethod();\n    }\n\n    @Test\n    public void testDeployArtifact() throws Exception {\n        deployArtifact(gavBackend);\n\n        Collection<File> files = repo.listFiles();\n\n        boolean found = false;\n        for (File file : files) {\n            String fileName = file.getName();\n            if (fileName.startsWith(\"guvnor-m2repo-editor-backend-0.0.1\") && fileName.endsWith(\".jar\")) {\n                found = true;\n                String path = file.getPath();\n                String jarPath = path.substring(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME).length());\n                String pom = repo.getPomText(jarPath);\n                assertNotNull(pom);\n                break;\n            }\n        }\n\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found);\n\n        // Test get artifact file\n        File file = repo.getArtifactFileFromRepository(gavBackend);\n        assertNotNull(\"Empty file for artifact\",\n                      file);\n        JarFile jarFile = new JarFile(file);\n        int count = 0;\n\n        String lastEntryName = null;\n        for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements(); ) {\n            ++count;\n            JarEntry entry = entries.nextElement();\n            assertNotEquals(\"Endless loop.\",\n                            lastEntryName,\n                            entry.getName());\n        }\n        assertTrue(\"Empty jar file!\",\n                   count > 0);\n    }\n\n    @Test\n    public void testDeployPom() throws Exception {\n        InputStream is = this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-pom.xml\");\n        repo.deployPom(is,\n                       gavBackend);\n\n        Collection<File> files = repo.listFiles();\n\n        boolean found = false;\n        for (File file : files) {\n            String fileName = file.getName();\n            if (fileName.startsWith(\"guvnor-m2repo-editor-backend-0.0.1\") && fileName.endsWith(\".pom\")) {\n                found = true;\n                String path = file.getPath();\n                String jarPath = path.substring(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME).length());\n                String pom = repo.getPomText(jarPath);\n                assertNotNull(pom);\n                break;\n            }\n        }\n\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found);\n    }\n\n    @Test\n    public void testListFiles() throws Exception {\n        deployArtifact(gavBackend);\n        deployArtifact(gavArquillian);\n\n        Collection<File> files = repo.listFiles();\n\n        boolean found1 = false;\n        boolean found2 = false;\n        for (File file : files) {\n            String fileName = file.getName();\n            if (fileName.startsWith(\"guvnor-m2repo-editor-backend-0.0.1\") && fileName.endsWith(\".jar\")) {\n                found1 = true;\n            }\n            if (fileName.startsWith(\"arquillian-core-api-1.0.2.Final\") && fileName.endsWith(\".jar\")) {\n                found2 = true;\n            }\n        }\n\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found1);\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found2);\n    }\n\n    @Test\n    public void testListFilesWithFilter() throws Exception {\n        deployArtifact(gavBackend);\n        deployArtifact(gavArquillian);\n\n        //filter with version number\n        boolean found1 = false;\n        Collection<File> files = repo.listFiles(\"1.0.2\");\n        final String VERSION_NUMBER_SEARCH_FILTER = \"arquillian-core-api-1.0.2\";\n        for (File file : files) {\n            String fileName = file.getName();\n            if (fileName.startsWith(VERSION_NUMBER_SEARCH_FILTER) && fileName.endsWith(\".jar\")) {\n                found1 = true;\n            }\n        }\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found1);\n\n        for (File file : files) {\n            String fileName = file.getName();\n            if (!fileName.contains(VERSION_NUMBER_SEARCH_FILTER)) {\n                Assert.fail(fileName + \" doesn't match the filter \" + VERSION_NUMBER_SEARCH_FILTER);\n            }\n        }\n\n        //filter with artifact id\n        found1 = false;\n        files = repo.listFiles(\"arquillian-core-api\");\n        final String ARTIFACT_SEARCH_FILTER = \"arquillian-core-api\";\n        for (File file : files) {\n            String fileName = file.getName();\n            if (fileName.startsWith(ARTIFACT_SEARCH_FILTER) && fileName.endsWith(\".jar\")) {\n                found1 = true;\n            }\n        }\n        assertTrue(\"Did not find expected file after calling M2Repository.addFile()\",\n                   found1);\n\n        for (File file : files) {\n            String fileName = file.getName();\n            if (!fileName.contains(ARTIFACT_SEARCH_FILTER)) {\n                Assert.fail(fileName + \" doesn't match the filter \" + ARTIFACT_SEARCH_FILTER);\n            }\n        }\n    }\n\n    @Test\n    public void testUploadJARWithPOM() throws Exception {\n        FormData uploadItem = new FormData();\n        FileItem file = new MockFileItem(\"guvnor-m2repo-editor-backend-test-with-pom.jar\",\n                                         this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-with-pom.jar\"));\n        uploadItem.setFile(file);\n\n        assert (helperMethod.invoke(helper,\n                                    uploadItem).equals(UPLOAD_OK));\n    }\n\n    @Test\n    public void testUploadKJARWithPOM() throws Exception {\n        FormData uploadItem = new FormData();\n        FileItem file = new MockFileItem(\"guvnor-m2repo-editor-backend-test-with-pom.kjar\",\n                                         this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-with-pom.jar\"));\n        uploadItem.setFile(file);\n\n        assert (helperMethod.invoke(helper,\n                                    uploadItem).equals(UPLOAD_OK));\n    }\n\n    @Test\n    public void testUploadJARWithManualGAV() throws Exception {\n        FormData uploadItem = new FormData();\n        uploadItem.setGav(gavBackend);\n        FileItem file = new MockFileItem(\"guvnor-m2repo-editor-backend-test-without-pom.jar\",\n                                         this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-without-pom.jar\"));\n        uploadItem.setFile(file);\n\n        assert (helperMethod.invoke(helper,\n                                    uploadItem).equals(UPLOAD_OK));\n    }\n\n    @Test\n    public void testUploadKJARWithManualGAV() throws Exception {\n        FormData uploadItem = new FormData();\n        uploadItem.setGav(gavBackend);\n        FileItem file = new MockFileItem(\"guvnor-m2repo-editor-backend-test.kjar\",\n                                         this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-without-pom.jar\"));\n        uploadItem.setFile(file);\n\n        assert (helperMethod.invoke(helper,\n                                    uploadItem).equals(UPLOAD_OK));\n    }\n\n    /**\n     * Verify that\n     * {@link M2RepoServiceImpl#listArtifacts(org.guvnor.m2repo.model.JarListPageRequest) M2RepoServiceImpl.listFiles()}\n     * returns correct PageResponse.\n     * @throws java.lang.Exception\n     */\n    @Test\n    public void testListArtifacts() throws Exception {\n        List<Artifact> artifacts = new ArrayList<Artifact>();\n        final int TOTAL = 5;\n        final int PAGE_START = 1;\n        final int PAGE_SIZE = 2;\n        for (int i = 0; i < TOTAL; i++) {\n            final ArtifactImpl artifact = new ArtifactImpl(new File(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME),\n                                                                    \"path/x\" + i));\n            final HashMap<String, String> map = new HashMap<String, String>();\n            map.put(\"repository\",\n                    \"guvnor-m2-repo\");\n            artifact.setProperties(map);\n            artifacts.add(artifact);\n        }\n        // Create a mock repository to make the test independent on any project deployment\n        GuvnorM2Repository mockRepo = mock(GuvnorM2Repository.class);\n        Mockito.when(mockRepo.listArtifacts(Mockito.any(),\n                                            Mockito.any()))\n                .thenReturn(artifacts);\n        when(mockRepo.getM2RepositoryDir(any())).thenReturn(repo.getM2RepositoryDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME));\n\n        // Create a shell M2RepoService with injected mock M2Repository\n        M2RepoServiceImpl m2service = new M2RepoServiceImpl(mock(Logger.class),\n                                                            mockRepo);\n\n        // Verify PageResponse\n        JarListPageRequest request = new JarListPageRequest(PAGE_START,\n                                                            PAGE_SIZE,\n                                                            null,\n                                                            null,\n                                                            null,\n                                                            false);\n        PageResponse<JarListPageRow> response = m2service.listArtifacts(request);\n        assertEquals(PAGE_SIZE,\n                     response.getPageRowList().size());\n        assertEquals(TOTAL,\n                     response.getTotalRowSize());\n        int i = PAGE_START;\n        for (JarListPageRow row : response.getPageRowList()) {\n            assertEquals(\"x\" + i,\n                         row.getName());\n            assertEquals(\"path/x\" + i,\n                         row.getPath());\n            i += 1;\n        }\n    }\n\n    @Test\n    public void testUploadPOM() throws Exception {\n        FormData uploadItem = new FormData();\n        FileItem file = new MockFileItem(\"pom.xml\",\n                                         this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-pom.xml\"));\n        uploadItem.setFile(file);\n\n        assert (helperMethod.invoke(helper,\n                                    uploadItem).equals(UPLOAD_OK));\n\n        assertFilesCount(null,\n                         null,\n                         null,\n                         false,\n                         1);\n    }\n\n    @Test\n    public void testListFilesWithSortOnNameAscending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by Name ascending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_NAME,\n                                                                       true,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final String fileName0 = files.get(0).getName();\n        final String fileName2 = files.get(2).getName();\n        assertTrue(fileName0.startsWith(\"guvnor-m2repo-editor-backend1\"));\n        assertTrue(fileName2.startsWith(\"guvnor-m2repo-editor-backend2\"));\n    }\n\n    @Test\n    public void testListFilesWithSortOnNameDescending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by Name descending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_NAME,\n                                                                       false,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final String fileName0 = files.get(0).getName();\n        final String fileName2 = files.get(2).getName();\n        assertTrue(fileName0.startsWith(\"guvnor-m2repo-editor-backend2\"));\n        assertTrue(fileName2.startsWith(\"guvnor-m2repo-editor-backend1\"));\n    }\n\n    @Test\n    public void testListFilesWithSortOnPathAscending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by Path ascending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_PATH,\n                                                                       true,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final String filePath0 = files.get(0).getPath();\n        final String filePath2 = files.get(2).getPath();\n        assertTrue(filePath0.contains(\"guvnor-m2repo-editor-backend1\"));\n        assertTrue(filePath2.contains(\"guvnor-m2repo-editor-backend2\"));\n    }\n\n    @Test\n    public void testListFilesWithSortOnPathDescending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by Path descending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_PATH,\n                                                                       false,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final String filePath0 = files.get(0).getPath();\n        final String filePath2 = files.get(2).getPath();\n        assertTrue(filePath0.contains(\"guvnor-m2repo-editor-backend2\"));\n        assertTrue(filePath2.contains(\"guvnor-m2repo-editor-backend1\"));\n    }\n\n    @Test\n    public void testListFilesWithSortOnGavAscending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by GAV ascending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_GAV,\n                                                                       true,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final GAV gav0 = files.get(0).getGav();\n        final GAV gav2 = files.get(2).getGav();\n        assertEquals(\"guvnor-m2repo-editor-backend1\",\n                     gav0.getArtifactId());\n        assertEquals(\"guvnor-m2repo-editor-backend2\",\n                     gav2.getArtifactId());\n    }\n\n    @Test\n    public void testListFilesWithSortOnGavDescending() throws Exception {\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        //Sort by GAV descending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_GAV,\n                                                                       false,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final GAV gav0 = files.get(0).getGav();\n        final GAV gav2 = files.get(2).getGav();\n        assertEquals(\"guvnor-m2repo-editor-backend2\",\n                     gav0.getArtifactId());\n        assertEquals(\"guvnor-m2repo-editor-backend1\",\n                     gav2.getArtifactId());\n    }\n\n    @Test\n    public void testListFilesWithSortOnLastModifiedAscending() throws Exception {\n        deployArtifact(gavBackend1);\n\n        //Wait a bit before deploying other file (to ensure different Last Modified times)\n        Thread.sleep(2000);\n\n        //This installs a JAR and a POM\n        deployArtifact(gavBackend2);\n\n        //Sort by Last Modified ascending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_LAST_MODIFIED,\n                                                                       true,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final Long fileTime0 = files.get(0).getLastModified().getTime();\n        final Long fileTime2 = files.get(2).getLastModified().getTime();\n        assertTrue(fileTime0.compareTo(fileTime2) < 0);\n    }\n\n    @Test\n    public void testListFilesWithSortOnLastModifiedDescending() throws Exception {\n        deployArtifact(gavBackend1);\n\n        //Wait a bit before deploying other file (to ensure different Last Modified times)\n        Thread.sleep(2000);\n\n        deployArtifact(gavBackend2);\n\n        //Sort by Last Modified descending\n        final PageResponse<JarListPageRow> response = assertFilesCount(null,\n                                                                       null,\n                                                                       JarListPageRequest.COLUMN_LAST_MODIFIED,\n                                                                       false,\n                                                                       4);\n        final List<JarListPageRow> files = response.getPageRowList();\n        final Long fileTime0 = files.get(0).getLastModified().getTime();\n        final Long fileTime2 = files.get(2).getLastModified().getTime();\n        assertTrue(fileTime0.compareTo(fileTime2) > 0);\n    }\n\n    @Test\n    public void testListFilesIncludingPom() throws Exception {\n        deployArtifact(gavBackend);\n\n        //This installs a POM\n        GAV gavBackendParent = new GAV(\"org.kie.guvnor\",\n                                       \"guvnor-m2repo-editor-backend-parent\",\n                                       \"0.0.1-SNAPSHOT\");\n        InputStream is = this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-pom.xml\");\n        repo.deployPom(is,\n                       gavBackendParent);\n\n        assertFilesCount(null,\n                         null,\n                         null,\n                         false,\n                         3);\n    }\n\n    @Test\n    public void testListFilesWhenNoneExist() throws Exception {\n        assertFilesCount(null,\n                         null,\n                         JarListPageRequest.COLUMN_GAV,\n                         false,\n                         0);\n    }\n\n    @Test\n    public void testListFilesWithPageSize() throws Exception {\n        //Deploy 2 files (equating to 4 files)\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        final JarListPageRequest request = new JarListPageRequest(0,\n                                                                  10,\n                                                                  null,\n                                                                  null,\n                                                                  null,\n                                                                  true);\n        final PageResponse<JarListPageRow> response = service.listArtifacts(request);\n        assertEquals(4,\n                     response.getPageRowList().size());\n    }\n\n    @Test\n    public void testListFilesWithStartBeyondMaximum() throws Exception {\n        //Deploy 2 files (equating to 4 files)\n        deployArtifact(gavBackend1);\n        deployArtifact(gavBackend2);\n\n        final JarListPageRequest request = new JarListPageRequest(10,\n                                                                  10,\n                                                                  null,\n                                                                  null,\n                                                                  null,\n                                                                  true);\n        final PageResponse<JarListPageRow> response = service.listArtifacts(request);\n        assertEquals(0,\n                     response.getPageRowList().size());\n    }\n\n    @Test\n    public void testCheckArtifactExistsReturnsTrueForExistingArtifact() {\n        deployArtifact(gavBackend);\n        assertTrue(repo.containsArtifact(gavBackend));\n    }\n\n    @Test\n    public void testCheckArtifactExistsReturnsFalseForNonExistingArtifact() {\n        assertFalse(repo.containsArtifact(new GAV(\"org.guvnor:non-existing-jar:1.0.Final\")));\n    }\n\n    @Test\n    public void testGetPomTextRejectsTraversingPaths() {\n        service.getPomText(\"dir/name.jar\");\n        service.getPomText(\"dir/name.kjar\");\n        service.getPomText(\"dir/name.pom\");\n\n        exception.expect(RuntimeException.class);\n        service.getPomText(\"path/../file.pom\");\n    }\n\n    @Test\n    public void testLoadGAVFromJarRejectsTraversingPaths() {\n        exception.expect(RuntimeException.class);\n        service.loadGAVFromJar(\"path/../file.jar\");\n    }\n\n    private PageResponse<JarListPageRow> assertFilesCount(final String filters,\n                                                          final List<String> fileFormats,\n                                                          final String dataSourceName,\n                                                          final boolean isAscending,\n                                                          final int filesCount) {\n        final JarListPageRequest request = new JarListPageRequest(0,\n                                                                  null,\n                                                                  filters,\n                                                                  fileFormats,\n                                                                  dataSourceName,\n                                                                  isAscending);\n        final PageResponse<JarListPageRow> response = service.listArtifacts(request);\n        assertEquals(filesCount,\n                     response.getPageRowList().size());\n        return response;\n    }\n\n    private void deployArtifact(GAV gav) {\n        //This installs a JAR and a POM\n        InputStream is = this.getClass().getResourceAsStream(\"guvnor-m2repo-editor-backend-test-without-pom.jar\");\n        repo.deployArtifact(is,\n                            gav,\n                            false);\n    }\n\n    @Test\n    public void testGetKieText() {\n        GAV gavEvaluation = new GAV(\"evaluation\", \"evaluation\", \"12.1.1-SNAPSHOT\");\n        InputStream is = this.getClass().getResourceAsStream(\"evaluation-12.1.1.jar\");\n\n        repo.deployArtifact(is, gavEvaluation, false);\n\n        Optional<File> file = repo.listFiles(\"evaluation-12.1.1\", singletonList(\"jar\")).stream().findFirst();\n        assertTrue(file.isPresent());\n\n        String path = file.get().getPath();\n        String jarPath = path.substring(repo.getM2RepositoryRootDir(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME).length());\n\n        String kieDeploymentDescriptorText = repo.getKieDeploymentDescriptorText(jarPath);\n        assertNotNull(kieDeploymentDescriptorText);\n        String kModuleText = repo.getKModuleText(jarPath);\n        assertNotNull(kModuleText);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/M2RepoServiceCreator.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.lang.reflect.Method;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.apache.commons.io.FileUtils;\nimport org.guvnor.m2repo.backend.server.helpers.FormData;\nimport org.guvnor.m2repo.backend.server.helpers.HttpPostHelper;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepository;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryProducer;\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.guvnor.m2repo.preferences.ArtifactRepositoryPreference;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceNameResolver;\nimport org.uberfire.mocks.MockInstanceImpl;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\nclass M2RepoServiceCreator {\n\n    private static final Logger log = LoggerFactory.getLogger(M2RepoServiceCreator.class);\n\n    private GuvnorM2Repository repo;\n    private M2RepoServiceImpl service;\n    private HttpPostHelper helper;\n    private java.lang.reflect.Method helperMethod;\n\n    public GuvnorM2Repository getRepo() {\n        return repo;\n    }\n\n    public M2RepoServiceImpl getService() {\n        return service;\n    }\n\n    public HttpPostHelper getHelper() {\n        return helper;\n    }\n\n    public Method getHelperMethod() {\n        return helperMethod;\n    }\n\n    M2RepoServiceCreator() throws Exception {\n        log.info(\"Deleting existing Repositories instance..\");\n\n        File dir = new File(\"repositories\");\n        log.info(\"DELETING test repo: \" + dir.getAbsolutePath());\n        deleteDir(dir);\n        log.info(\"TEST repo was deleted.\");\n\n        ArtifactRepositoryPreference pref = mock(ArtifactRepositoryPreference.class);\n        when(pref.getGlobalM2RepoDir()).thenReturn(\"repositories/kie\");\n        when(pref.isGlobalM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isDistributionManagementM2RepoDirEnabled()).thenReturn(true);\n        when(pref.isWorkspaceM2RepoDirEnabled()).thenReturn(false);\n        WorkspaceNameResolver resolver = mock(WorkspaceNameResolver.class);\n        when(resolver.getWorkspaceName()).thenReturn(\"global\");\n        ArtifactRepositoryProducer producer = new ArtifactRepositoryProducer(pref,\n                                                                             resolver);\n        producer.initialize();\n        Instance<ArtifactRepository> repositories = new MockInstanceImpl<>(producer.produceLocalRepository(),\n                                                                           producer.produceGlobalRepository(),\n                                                                           producer.produceDistributionManagementRepository());\n        ArtifactRepositoryService factory = new ArtifactRepositoryService(repositories);\n        repo = new GuvnorM2Repository(factory);\n        repo.init();\n\n        //Create a shell M2RepoService and set the M2Repository\n        service = new M2RepoServiceImpl(mock(Logger.class),\n                                        repo);\n        java.lang.reflect.Field repositoryField = M2RepoServiceImpl.class.getDeclaredField(\"repository\");\n        repositoryField.setAccessible(true);\n        repositoryField.set(service,\n                            repo);\n\n        //Make private method accessible for testing\n        helper = new HttpPostHelper();\n        helperMethod = HttpPostHelper.class.getDeclaredMethod(\"upload\",\n                                                              FormData.class);\n        helperMethod.setAccessible(true);\n\n        //Set the repository service created above in the HttpPostHelper\n        java.lang.reflect.Field m2RepoServiceField = HttpPostHelper.class.getDeclaredField(\"m2RepoService\");\n        m2RepoServiceField.setAccessible(true);\n        m2RepoServiceField.set(helper,\n                               service);\n    }\n\n    static boolean deleteDir(File dir) {\n        try {\n            FileUtils.deleteDirectory(dir);\n        } catch (Exception e) {\n            log.error(\"Couldn't delete file {}\",\n                      dir);\n            log.error(e.getMessage(),\n                      e);\n        }\n\n        // The directory is now empty so delete it\n        return dir.delete();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/M2RepoServiceImplM2RepoURLTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\n\nimport org.guvnor.m2repo.backend.server.repositories.ArtifactRepositoryService;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.slf4j.Logger;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class M2RepoServiceImplM2RepoURLTest {\n\n    @Mock\n    private GuvnorM2Repository repository;\n    @Mock\n    private Logger logger;\n\n    private M2RepoServiceImpl m2RepoService;\n\n    @Before\n    public void setUp() throws Exception {\n        m2RepoService = new M2RepoServiceImpl(logger,\n                                              repository);\n        doReturn(\"file://path-to-m2\").when(repository).getRepositoryURL(ArtifactRepositoryService.GLOBAL_M2_REPO_NAME);\n    }\n\n    @After\n    public void tearDown() throws Exception {\n        System.clearProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL);\n    }\n\n    @Test\n    public void errorDisplayedWhenPropertyIsNotSet() throws Exception {\n        verify(logger).error(anyString());\n    }\n\n    @Test\n    public void localRepoURL() throws Exception {\n        assertEquals(\"file://path-to-m2\", m2RepoService.getRepositoryURL());\n    }\n\n    @Test\n    public void repoURLFromSystemProperty() throws Exception {\n\n        System.setProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL, \"http://my-url\");\n\n        assertEquals(\"http://my-url\", m2RepoService.getRepositoryURL());\n    }\n\n    @Test\n    public void repoURLFromSystemPropertyEmptyValue() throws Exception {\n        reset(logger);\n\n        System.setProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL, \"\");\n\n        assertEquals(\"file://path-to-m2\", m2RepoService.getRepositoryURL());\n        verify(logger).warn(anyString());\n    }\n\n    @Test\n    public void repoURLFromSystemPropertyInvalidURL() throws Exception {\n        reset(logger);\n\n        System.setProperty(ArtifactRepositoryService.GLOBAL_M2_REPO_URL, \"12345\");\n\n        assertEquals(\"file://path-to-m2\", m2RepoService.getRepositoryURL());\n        verify(logger).warn(anyString());\n    }\n\n    @Test\n    public void testGetKModuleAndKieDeploymentDescriptorText() throws Exception {\n        File jarFile = new File(\"src/test/resources/org/guvnor/m2repo/backend/server/evaluation-12.1.1.jar\");\n\n        when(repository.getKieDeploymentDescriptorText(\"evaluation-12.1.1.jar\"))\n                .thenReturn(GuvnorM2Repository.loadFileTextFromJar(jarFile, \"META-INF\", \"kie-deployment-descriptor.xml\"));\n        when(repository.getKModuleText(\"evaluation-12.1.1.jar\"))\n                .thenReturn(GuvnorM2Repository.loadFileTextFromJar(jarFile, \"META-INF\", \"kmodule.xml\"));\n\n        assertNotNull(m2RepoService.getKModuleText(\"evaluation-12.1.1.jar\"));\n        assertNotNull(m2RepoService.getKieDeploymentDescriptorText(\"evaluation-12.1.1.jar\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/M2ServletContextListenerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\n\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\n\nimport org.appformer.maven.integration.Aether;\nimport org.eclipse.aether.RepositorySystemSession;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.resolution.ArtifactRequest;\nimport org.eclipse.aether.resolution.ArtifactResolutionException;\nimport org.eclipse.aether.resolution.ArtifactResult;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.junit.After;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class M2ServletContextListenerTest {\n\n    @After\n    public void tearDown() throws Exception {\n        deleteArtifactIFPresent();\n        System.clearProperty(\"kie.maven.offline.force\");\n    }\n\n    private void deleteArtifactIFPresent() throws ArtifactResolutionException {\n        ArtifactRequest artifactRequest = new ArtifactRequest();\n        artifactRequest.setArtifact(getArtifact());\n        try {\n            ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(Aether.getAether().getSession(),\n                                                                                   artifactRequest);\n            File artifactFile = result.getArtifact().getFile();\n            assertThat(artifactFile.delete()).isTrue();\n        } catch (ArtifactResolutionException ex) {\n        }\n    }\n\n    private Artifact getArtifact() {\n        Artifact jarArtifact = new DefaultArtifact(\"org.uberfire\",\n                                                   \"uberfire-m2repo-editor-backend\",\n                                                   \"jar\",\n                                                   \"100-SNAPSHOT\");\n        return jarArtifact;\n    }\n\n    @Test\n    public void deployJarsFrowWar() throws Exception {\n        RepositorySystemSession session = Aether.getAether().getSession();\n        assertThat(checksIfArtifactIsPresent(session)).isFalse();\n\n        File file = new File(\"target/test-classes/org/guvnor/m2repo/backend/server/uberfire-m2repo-editor-backend-100-SNAPSHOT.jar\");\n        assertThat(file).exists();\n\n        M2ServletContextListener listener = new M2ServletContextListener();\n        GAV deployed = listener.deployJar(file.getAbsolutePath());\n        assertThat(deployed.getGroupId()).isEqualTo(\"org.uberfire\");\n        assertThat(deployed.getArtifactId()).isEqualTo(\"uberfire-m2repo-editor-backend\");\n        assertThat(deployed.getVersion()).isEqualTo(\"100-SNAPSHOT\");\n\n        ArtifactRequest artifactRequest = new ArtifactRequest();\n        artifactRequest.setArtifact(getArtifact());\n        ArtifactResult result = Aether.getAether().getSystem().resolveArtifact(session,\n                                                                               artifactRequest);\n        assertThat(result.isMissing()).isFalse();\n        assertThat(result.isResolved()).isTrue();\n        String absolutePath = result.getArtifact().getFile().toString();\n        String folder = absolutePath.substring(0,\n                                               absolutePath.lastIndexOf(File.separator));\n        File remoteRepos = new File(folder + File.separator + \"_remote.repositories\");\n        assertThat(remoteRepos.exists()).isTrue();\n        File metadata = new File(folder + File.separator + \"maven-metadata-local.xml\");\n        assertThat(metadata.exists()).isTrue();\n        File pom = new File(folder + File.separator + \"uberfire-m2repo-editor-backend-100-SNAPSHOT.pom\");\n        assertThat(pom.exists()).isTrue();\n    }\n\n    @Test\n    public void checkRegularExecution() {\n        System.setProperty(\"kie.maven.offline.force\", \"false\");\n        final M2ServletContextListener listener = spy(new M2ServletContextListener());\n        final ServletContextEvent contextEvent = mock(ServletContextEvent.class);\n        final ServletContext servletContext = mock(ServletContext.class);\n        when(servletContext.getRealPath(any())).thenReturn(\".\");\n        when(contextEvent.getServletContext()).thenReturn(servletContext);\n        listener.contextInitialized(contextEvent);\n        verify(listener, times(0)).deployJarsFromWar(any());\n    }\n\n    @Test\n    public void checkOfflineExecution() {\n        System.setProperty(\"kie.maven.offline.force\", \"true\");\n        final M2ServletContextListener listener = spy(new M2ServletContextListener());\n        final ServletContextEvent contextEvent = mock(ServletContextEvent.class);\n        final ServletContext servletContext = mock(ServletContext.class);\n        when(servletContext.getRealPath(any())).thenReturn(\".\");\n        when(contextEvent.getServletContext()).thenReturn(servletContext);\n        listener.contextInitialized(contextEvent);\n        verify(listener, times(1)).deployJarsFromWar(any());\n    }\n\n    private boolean checksIfArtifactIsPresent(RepositorySystemSession session) {\n        try {\n            ArtifactRequest artifactRequest = new ArtifactRequest();\n            artifactRequest.setArtifact(getArtifact());\n            Aether.getAether().getSystem().resolveArtifact(session,\n                                                           artifactRequest);\n            return true;\n        } catch (ArtifactResolutionException e) {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/MockFileItem.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.UnsupportedEncodingException;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileItemHeaders;\n\n@SuppressWarnings(\"serial\")\nclass MockFileItem implements FileItem {\n\n    private final String fileName;\n    private final InputStream fileStream;\n\n    MockFileItem(final String fileName,\n                 final InputStream fileStream) {\n        this.fileName = fileName;\n        this.fileStream = fileStream;\n    }\n\n    @Override\n    public InputStream getInputStream() throws IOException {\n        return fileStream;\n    }\n\n    @Override\n    public String getContentType() {\n        return null;\n    }\n\n    @Override\n    public String getName() {\n        return fileName;\n    }\n\n    @Override\n    public boolean isInMemory() {\n        return false;\n    }\n\n    @Override\n    public long getSize() {\n        return 0;\n    }\n\n    @Override\n    public byte[] get() {\n        return null;\n    }\n\n    @Override\n    public String getString(String encoding) throws UnsupportedEncodingException {\n        return null;\n    }\n\n    @Override\n    public String getString() {\n        return null;\n    }\n\n    @Override\n    public void write(File file) throws Exception {\n    }\n\n    @Override\n    public void delete() {\n    }\n\n    @Override\n    public String getFieldName() {\n        return null;\n    }\n\n    @Override\n    public void setFieldName(String name) {\n    }\n\n    @Override\n    public boolean isFormField() {\n        return false;\n    }\n\n    @Override\n    public void setFormField(boolean state) {\n    }\n\n    @Override\n    public OutputStream getOutputStream() throws IOException {\n        return null;\n    }\n\n    @Override\n    public FileItemHeaders getHeaders() {\n        return null;\n    }\n\n    @Override\n    public void setHeaders(FileItemHeaders fileItemHeaders) {\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/helpers/UploadInvalidPomTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.backend.server.helpers;\n\nimport java.io.InputStream;\n\nimport org.apache.maven.project.ProjectBuildingException;\nimport org.junit.Test;\n\npublic class UploadInvalidPomTest {\n\n    @Test(expected = ProjectBuildingException.class)\n    public void testBrokenPom() throws Exception {\n        resolvePom(\"org/guvnor/m2repo/backend/server/helpers/broken-pom.xml\");\n    }\n\n    @Test(expected = ProjectBuildingException.class)\n    public void testNonExistingParentGavInPom() throws Exception {\n        resolvePom(\"org/guvnor/m2repo/backend/server/helpers/non-existing-parent-gav-pom.xml\");\n    }\n\n    private void resolvePom(String path) throws Exception {\n        try (InputStream pomInputStream = this.getClass().getClassLoader().getResourceAsStream(path)) {\n            PomModelResolver.resolveFromPom(pomInputStream);\n        } catch (Exception e) {\n            throw e;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/repositories/ArtifactRepositoryServiceTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.MockInstanceImpl;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ArtifactRepositoryServiceTest {\n\n    private ArtifactRepositoryService artifactRepositoryService;\n    private ArtifactRepository artifactRepository1;\n    private ArtifactRepository artifactRepository2;\n    private ArtifactRepository artifactRepository3;\n    private ArtifactRepository artifactRepository4;\n    private ArtifactRepository artifactRepository5;\n\n    @Before\n    public void setUp() {\n\n        artifactRepository1 = mock(ArtifactRepository.class);\n        artifactRepository2 = mock(ArtifactRepository.class);\n        artifactRepository3 = mock(ArtifactRepository.class);\n        artifactRepository4 = mock(ArtifactRepository.class);\n        artifactRepository5 = mock(ArtifactRepository.class);\n\n        when(artifactRepository1.isRepository()).thenReturn(true);\n        when(artifactRepository2.isRepository()).thenReturn(true);\n        when(artifactRepository3.isRepository()).thenReturn(true);\n        when(artifactRepository4.isRepository()).thenReturn(true);\n        when(artifactRepository5.isRepository()).thenReturn(false);\n\n        when(artifactRepository1.isPomRepository()).thenReturn(true);\n        when(artifactRepository2.isPomRepository()).thenReturn(true);\n        when(artifactRepository3.isPomRepository()).thenReturn(false);\n        when(artifactRepository4.isPomRepository()).thenReturn(false);\n        when(artifactRepository5.isPomRepository()).thenReturn(false);\n\n        MockInstanceImpl<ArtifactRepository> instance = new MockInstanceImpl<>(artifactRepository1,\n                                                                               artifactRepository2,\n                                                                               artifactRepository3,\n                                                                               artifactRepository4,\n                                                                               artifactRepository5);\n\n        this.artifactRepositoryService = new ArtifactRepositoryService(instance);\n    }\n\n    @Test\n    public void testDeploymentRepositories() {\n        List<? extends ArtifactRepository> repositories = this.artifactRepositoryService.getRepositories();\n        assertEquals(4,\n                     repositories.size());\n        assertTrue(Arrays.asList(this.artifactRepository1,\n                                 this.artifactRepository2,\n                                 this.artifactRepository3,\n                                 this.artifactRepository4).containsAll(repositories));\n        assertFalse(repositories.contains(this.artifactRepository5));\n    }\n\n    @Test\n    public void testPomRepositories() {\n        List<? extends ArtifactRepository> repositories = this.artifactRepositoryService.getPomRepositories();\n        assertEquals(2,\n                     repositories.size());\n        assertTrue(Arrays.asList(this.artifactRepository1,\n                                 this.artifactRepository2).containsAll(repositories));\n        assertFalse(repositories.contains(this.artifactRepository3));\n        assertFalse(repositories.contains(this.artifactRepository4));\n        assertFalse(repositories.contains(this.artifactRepository5));\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/java/org/guvnor/m2repo/backend/server/repositories/LocalArtifactRepositoryTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.backend.server.repositories;\n\nimport java.io.File;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class LocalArtifactRepositoryTest {\n\n    @Test\n    public void testGetRootDir() throws Exception {\n        LocalArtifactRepository repository = new LocalArtifactRepository(\"test\");\n        String rootDir = repository.getRootDir();\n        assertNotNull(rootDir);\n        File rootDirFile = new File(rootDir);\n        assertTrue(rootDirFile.isDirectory());\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/not-mavenized-artifacts.properties",
    "content": "activation=javax.activation:activation\nant=org.apache.ant:ant\nana=org.apache.ant:ana\nanz=org.apache.ant:anz\nant-launcher=org.apache.ant:ant-launcher\naopalliance=aopalliance:aopalliance\nbase=com.google.jsinterop:base\njunit=junit:junit\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/guvnor-m2repo-editor-backend-test-pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.guvnor.test</groupId>\n  <artifactId>guvnor-m2repo-editor-test</artifactId>\n  <version>0.0.1-SNAPSHOT</version>\n\n  <packaging>jar</packaging>\n\n  <name>Guvnor - M2_REPO Backend - Test</name>\n  <description>Guvnor - M2_REPO Backend - Test</description>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/helpers/broken-pom.xml",
    "content": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0\n                             http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.guvnor.m2repo.backend.server.helpers</groupId>\n  <artifactId>testBrokenPom</artifactId>\n  <packaging>jar</packaging>\n  <vrsion>1.0</vrsion>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/helpers/gav-pom-without-group.xml",
    "content": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0\n                             http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <artifactId>parent-gav-pom</artifactId>\n    <groupId>org.guvnor.test</groupId>\n    <version>1.0</version>\n  </parent>\n\n  <artifactId>testExistingParentGavInPom</artifactId>\n  <version>1.1.1</version>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/helpers/gav-pom-without-version.xml",
    "content": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0\n                             http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <artifactId>parent-gav-pom</artifactId>\n    <groupId>org.guvnor.test</groupId>\n    <version>1.0</version>\n  </parent>\n\n  <groupId>org.guvnor.m2repo.backend.server.helpers</groupId>\n  <artifactId>testExistingParentGavInPom</artifactId>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/helpers/non-existing-parent-gav-pom.xml",
    "content": "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0\n                             http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n\n  <parent>\n    <groupId>nonexisting</groupId>\n    <artifactId>nonexisting</artifactId>\n    <version>123</version>\n  </parent>\n\n  <groupId>org.guvnor.m2repo.backend.server.helpers</groupId>\n  <artifactId>testNonExistingParentGavInPom</artifactId>\n  <packaging>jar</packaging>\n  <version>1.0</version>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/parent-gav-pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.guvnor.test</groupId>\n  <artifactId>parent-gav-pom</artifactId>\n  <version>1.0</version>\n  <name>parent-gav-pom</name>\n  <packaging>pom</packaging>\n</project>"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/settings-security.xml",
    "content": "<settingsSecurity>\n\t<master>{Bw1dhMof4iQH5QjT4+Z2RPFz4GOqqpdp8J1Nmj18lJA=}</master>\n</settingsSecurity>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-backend/src/test/resources/org/guvnor/m2repo/backend/server/settings.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\nLicensed to the Apache Software Foundation (ASF) under one\nor more contributor license agreements.  See the NOTICE file\ndistributed with this work for additional information\nregarding copyright ownership.  The ASF licenses this file\nto you under the Apache License, Version 2.0 (the\n\"License\"); you may not use this file except in compliance\nwith the License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing,\nsoftware distributed under the License is distributed on an\n\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, either express or implied.  See the License for the\nspecific language governing permissions and limitations\nunder the License.\n-->\n<settings xmlns=\"http://maven.apache.org/SETTINGS/1.0.0\"\n          xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n          xsi:schemaLocation=\"http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd\">\n  <servers>\n    <server>\n      <id>example.project.http</id>\n      <username>repouser</username>\n\t\t  <password>{XpIfWM7/vnwHKeay1yVDI37YpqPWZp9KC6EFd2sUZno=}</password>\n    </server>\n  </servers>\n</settings>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-m2repo-editor</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-m2repo-editor-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - M2_REPO Client</name>\n  <description>UberFire - M2_REPO Client</description>\n\n  <dependencies>\n    <!-- Transitive dependencies -->\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-m2repo-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/M2RepoEditorEntryPoint.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.guvnor.m2repo.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.guvnor.m2repo.client.resources.M2RepoEditorResources;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/M2Constants.properties\")\npublic class M2RepoEditorEntryPoint {\n\n    @PostConstruct\n    public void startApp() {\n        M2RepoEditorResources.INSTANCE.CSS().ensureInjected();\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/M2RepoEditorPresenter.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.m2repo.client.editor.MavenRepositoryPagedJarTable;\nimport org.guvnor.m2repo.client.event.M2RepoRefreshEvent;\nimport org.guvnor.m2repo.client.event.M2RepoSearchEvent;\nimport org.guvnor.m2repo.client.resources.i18n.M2RepoEditorConstants;\nimport org.guvnor.m2repo.client.upload.UploadFormPresenter;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.widgets.common.client.menu.RefreshMenuBuilder;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = \"M2RepoEditor\")\npublic class M2RepoEditorPresenter implements RefreshMenuBuilder.SupportsRefresh {\n\n    private M2RepoEditorConstants constants = M2RepoEditorConstants.INSTANCE;\n\n    private final Event<M2RepoRefreshEvent> refreshEvents;\n    private final UploadFormPresenter uploadFormPresenter;\n    private final MavenRepositoryPagedJarTable view;\n\n    @Inject\n    public M2RepoEditorPresenter(final Event<M2RepoRefreshEvent> refreshEvents,\n                                 final UploadFormPresenter uploadFormPresenter,\n                                 final MavenRepositoryPagedJarTable view) {\n        this.refreshEvents = refreshEvents;\n        this.uploadFormPresenter = uploadFormPresenter;\n        this.view = view;\n    }\n\n    @WorkbenchPartView\n    public MavenRepositoryPagedJarTable getWidget() {\n        return view;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return M2RepoEditorConstants.INSTANCE.M2RepositoryContent();\n    }\n\n    public void refreshEvent(@Observes final M2RepoRefreshEvent event) {\n        view.refresh();\n    }\n\n    public void searchEvent(@Observes final M2RepoSearchEvent event) {\n        view.search(event.getFilter());\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory.newTopLevelMenu(constants.Upload())\n                .respondsWith(() -> uploadFormPresenter.showView())\n                .endMenu()\n                .newTopLevelCustomMenu(new RefreshMenuBuilder(this))\n                .endMenu()\n                .build());\n    }\n\n    @Override\n    public void onRefresh() {\n        refreshEvents.fire(new M2RepoRefreshEvent());\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/editor/GAVEditor.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.editor;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport org.guvnor.m2repo.model.HTMLFileManagerFields;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.widgets.common.client.common.popups.FormStylePopup;\n\npublic class GAVEditor extends FormStylePopup {\n\n    public GAVEditor(final Form form) {\n        super(\"GAV Editor\");\n\n        TextBox groupIDTextBox = new TextBox();\n        addAttribute(\"GroupID:\",\n                     groupIDTextBox);\n        TextBox artifactIDTextBox = new TextBox();\n        addAttribute(\"ArtifactID:\",\n                     artifactIDTextBox);\n        TextBox versionID = new TextBox();\n        addAttribute(\"VersionID:\",\n                     versionID);\n        Button ok = new Button(\"upload\");\n        ok.addClickHandler(new ClickHandler() {\n            public void onClick(ClickEvent event) {\n                form.reset();\n                HorizontalPanel fields = new HorizontalPanel();\n                fields.add(getHiddenField(HTMLFileManagerFields.GROUP_ID,\n                                          \"\"));\n                fields.add(getHiddenField(HTMLFileManagerFields.ARTIFACT_ID,\n                                          \"\"));\n                fields.add(getHiddenField(HTMLFileManagerFields.VERSION_ID,\n                                          \"\"));\n                form.add(fields);\n                form.submit();\n            }\n        });\n        addAttribute(\"\",\n                     ok);\n    }\n\n    private TextBox getHiddenField(String name,\n                                   String value) {\n        TextBox t = new TextBox();\n        t.setName(name);\n        t.setText(value);\n        t.setVisible(false);\n        return t;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/editor/JarDetailPopup.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.guvnor.m2repo.client.editor;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.m2repo.client.resources.i18n.M2RepoEditorConstants;\nimport org.gwtbootstrap3.client.shared.event.ModalShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShowHandler;\nimport org.gwtbootstrap3.client.ui.Pre;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKButton;\n\n/**\n * A popup that shows an error message\n */\npublic class JarDetailPopup extends BaseModal {\n\n    interface JarDetailPopupWidgetBinder\n            extends\n            UiBinder<Widget, JarDetailPopup> {\n\n    }\n\n    private static JarDetailPopupWidgetBinder uiBinder = GWT.create(JarDetailPopupWidgetBinder.class);\n\n    @UiField\n    protected Pre pom;\n\n    public JarDetailPopup(final String details) {\n        PatternFlyBootstrapper.ensurePrettifyIsAvailable();\n        setTitle(M2RepoEditorConstants.INSTANCE.JarDetails());\n        setHideOtherModals(false);\n\n        setBody(uiBinder.createAndBindUi(this));\n        add(new ModalFooterOKButton(new Command() {\n            @Override\n            public void execute() {\n                hide();\n            }\n        }));\n\n        this.pom.setHTML(details);\n        addShowHandler(new ModalShowHandler() {\n            @Override\n            public void onShow(ModalShowEvent evt) {\n                initPrettify();\n            }\n        });\n    }\n\n    public static native void initPrettify() /*-{\n        $wnd.prettyPrint();\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/editor/JarDetailPopup.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2013 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~   Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~   you may not use this file except in compliance with the License.\n  ~   You may obtain a copy of the License at\n  ~\n  ~         http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~   Unless required by applicable law or agreed to in writing, software\n  ~   distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~   See the License for the specific language governing permissions and\n  ~   limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <g:FlowPanel>\n        <b:Pre addStyleNames=\"prettyprint lang-xml\" ui:field=\"pom\" />\n    </g:FlowPanel>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/editor/MavenRepositoryPagedJarTable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.m2repo.client.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.guvnor.m2repo.client.resources.i18n.M2RepoEditorConstants;\nimport org.guvnor.m2repo.client.widgets.ArtifactListPresenter;\nimport org.guvnor.m2repo.client.widgets.ColumnType;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.guvnor.m2repo.security.MavenRepositoryPagedJarTableFeatures;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.gwt.ButtonCell;\nimport org.gwtbootstrap3.client.ui.html.Div;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n@Dependent\npublic class MavenRepositoryPagedJarTable\n        extends Composite\n        implements RequiresResize {\n\n    private ArtifactListPresenter presenter;\n    private AuthorizationManager authorizationManager;\n\n    protected User identity;\n\n    private final Div content = new Div();\n\n    public MavenRepositoryPagedJarTable() {\n    }\n\n    @Inject\n    public MavenRepositoryPagedJarTable(final ArtifactListPresenter presenter,\n                                        final AuthorizationManager authorizationManager,\n                                        final User identity) {\n        this.presenter = presenter;\n        this.authorizationManager = authorizationManager;\n        this.identity = identity;\n        initWidget(content);\n    }\n\n    @PostConstruct\n    public void init() {\n        presenter.setup(ColumnType.NAME,\n                        ColumnType.GAV,\n                        ColumnType.LAST_MODIFIED);\n\n        // Add \"View KJAR's pom\" button\n        addViewPOMButton();\n\n        //Add \"Download JAR\" button if the User has permission\n        if (authorizationManager.authorize(MavenRepositoryPagedJarTableFeatures.JAR_DOWNLOAD,\n                                           identity)) {\n            addDownloadJARButton();\n        }\n\n        presenter.search(\"\");\n        content.add(presenter.getView());\n    }\n\n    @Override\n    public void onResize() {\n        if ((getParent().getOffsetHeight() - 148) > 0 && presenter != null) {\n            presenter.getView().setContentHeight(getParent().getOffsetHeight() - 148 + \"px\");\n        }\n    }\n\n    private String getFileDownloadURL(final String path) {\n        return getGuvnorM2RepoBaseURL() + path;\n    }\n\n    private String getGuvnorM2RepoBaseURL() {\n        final String baseUrl = GWT.getModuleBaseURL().replace(GWT.getModuleName() + \"/\",\n                                                              \"\");\n        return baseUrl + \"maven2/\";\n    }\n\n    public void search(String filter) {\n        presenter.search(filter);\n    }\n\n    public void refresh() {\n        presenter.refresh();\n    }\n\n    void addViewPOMButton() {\n        final Column<JarListPageRow, String> openColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {\n            @Override\n            public String getValue(JarListPageRow row) {\n                return M2RepoEditorConstants.INSTANCE.Open();\n            }\n        };\n        openColumn.setFieldUpdater((int index,\n                                    JarListPageRow row,\n                                    String value) -> presenter.onOpenPom(row.getPath()));\n        presenter.getView().addColumn(openColumn,\n                                      M2RepoEditorConstants.INSTANCE.Open(),\n                                      100.0,\n                                      Style.Unit.PX);\n    }\n\n    void addDownloadJARButton() {\n        final Column<JarListPageRow, String> downloadColumn = new Column<JarListPageRow, String>(new ButtonCell(ButtonSize.EXTRA_SMALL)) {\n            public String getValue(JarListPageRow row) {\n                return M2RepoEditorConstants.INSTANCE.Download();\n            }\n        };\n\n        downloadColumn.setFieldUpdater((int index,\n                                        JarListPageRow row,\n                                        String value) -> Window.open(getFileDownloadURL(row.getPath()),\n                                                                     M2RepoEditorConstants.INSTANCE.Downloading(),\n                                                                     \"resizable=no,scrollbars=yes,status=no\"));\n\n        presenter.getView().addColumn(downloadColumn,\n                                      M2RepoEditorConstants.INSTANCE.Download(),\n                                      100.0,\n                                      Style.Unit.PX);\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/event/M2RepoRefreshEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.event;\n\npublic class M2RepoRefreshEvent {\n\n    public M2RepoRefreshEvent() {\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/event/M2RepoSearchEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.event;\n\npublic class M2RepoSearchEvent {\n\n    private String filter;\n\n    public M2RepoSearchEvent(String filter) {\n        this.filter = filter;\n    }\n\n    public M2RepoSearchEvent() {\n        this.filter = \"\";\n    }\n\n    public String getFilter() {\n        return filter;\n    }\n\n    public void setFilter(String filter) {\n        this.filter = filter;\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/resources/M2RepoEditorResources.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport org.guvnor.m2repo.client.resources.css.StylesCss;\nimport org.guvnor.m2repo.client.resources.images.M2RepoEditorImageResources;\n\npublic interface M2RepoEditorResources\n        extends\n        ClientBundle {\n\n    public static final M2RepoEditorResources INSTANCE = GWT.create(M2RepoEditorResources.class);\n\n    @Source(\"css/Styles.css\")\n    StylesCss CSS();\n\n    M2RepoEditorImageResources images();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/resources/css/StylesCss.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.resources.css;\n\nimport com.google.gwt.resources.client.CssResource;\n\n/**\n * CSS for Maven Artifact Repository\n */\npublic interface StylesCss\n        extends\n        CssResource {\n\n    String caption();\n\n    String pom();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/resources/i18n/M2Constants.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.m2repo.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic class M2Constants {\n\n    @TranslationKey(defaultValue = \"Artifact Repository\")\n    public static final String ArtifactRepositoryPreference_Label = \"ArtifactRepositoryPreference.Label\";\n\n    @TranslationKey(defaultValue = \"Global M2 repository directory\")\n    public static final String ArtifactRepositoryPreference_GlobalM2RepoDir = \"ArtifactRepositoryPreference.GlobalM2RepoDir\";\n\n    @TranslationKey(defaultValue = \"Is Global M2 repository directory enabled?\")\n    public static final String ArtifactRepositoryPreference_GlobalM2RepoDirEnabled = \"ArtifactRepositoryPreference.GlobalM2RepoDirEnabled\";\n\n    @TranslationKey(defaultValue = \"Workspace M2 repository directory\")\n    public static final String ArtifactRepositoryPreference_WorkspaceM2RepoDir = \"ArtifactRepositoryPreference.WorkspaceM2RepoDir\";\n\n    @TranslationKey(defaultValue = \"Is Workspace M2 repository directory enabled?\")\n    public static final String ArtifactRepositoryPreference_WorkspaceM2RepoDirEnabled = \"ArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled\";\n\n    @TranslationKey(defaultValue = \"Is Distribution Management repository enabled?\")\n    public static final String ArtifactRepositoryPreference_DistributionManagementM2RepoDirEnabled = \"ArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled\";\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * EnumEditor I18N constants\n */\npublic interface M2RepoEditorConstants\n        extends\n        Messages {\n\n    public static final M2RepoEditorConstants INSTANCE = GWT.create(M2RepoEditorConstants.class);\n\n    String OK();\n\n    String InvalidModelName(final String name);\n\n    String NameTakenForModel(final String name);\n\n    String ModelNameChangeWarning();\n\n    String Rename();\n\n    String Delete();\n\n    String Name();\n\n    String DoesNotExtend();\n\n    String CreatesCircularDependency(final String text);\n\n    String TypeExtends();\n\n    String AddField();\n\n    String AddAnnotation();\n\n    String AreYouSureYouWantToRemoveTheField0(final String name);\n\n    String AreYouSureYouWantToRemoveTheAnnotation0(final String name);\n\n    String MoveUp();\n\n    String MoveDown();\n\n    String RemoveThisFactType();\n\n    String CannotDeleteADeclarationThatIsASuperType();\n\n    String AreYouSureYouWantToRemoveThisFact();\n\n    String AddNewFactType();\n\n    String InvalidDataTypeName(final String dataType);\n\n    String Type();\n\n    String FieldNameAttribute();\n\n    String chooseType();\n\n    String WholeNumberInteger();\n\n    String TrueOrFalse();\n\n    String Text();\n\n    String Date();\n\n    String DecimalNumber();\n\n    String AreYouSureYouWantToDeleteTheseItems();\n\n    String JarDetails();\n\n    String M2RepositoryContent();\n\n    String Path();\n\n    String GAV();\n\n    String LastModified();\n\n    String Open();\n\n    String Download();\n\n    String NoArtifactAvailable();\n\n    String Downloading();\n\n    String ArtifactUpload();\n\n    String Cancel();\n\n    String SelectFileUpload();\n\n    String UploadedSuccessfully();\n\n    String RefreshedSuccessfully();\n\n    String InvalidJarNotPom();\n\n    String UploadFailed();\n\n    String UnsupportedFileType();\n\n    String InvalidPom();\n\n    String Uploading();\n\n    String Upload();\n\n    String Refresh();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/resources/images/M2RepoEditorImageResources.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.resources.images;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\npublic interface M2RepoEditorImageResources\n        extends\n        ClientBundle {\n\n    public static final M2RepoEditorImageResources INSTANCE = GWT.create(M2RepoEditorImageResources.class);\n\n    @Source(\"edit.gif\")\n    ImageResource edit();\n\n    @Source(\"shuffle_up.gif\")\n    ImageResource shuffleUp();\n\n    @Source(\"shuffle_down.gif\")\n    ImageResource shuffleDown();\n\n    @Source(\"model_large.png\")\n    ImageResource modelLarge();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/upload/UploadFormPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.upload;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.guvnor.m2repo.client.event.M2RepoSearchEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHideEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHideHandler;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_MISSING_POM;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_OK;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_UNABLE_TO_PARSE_POM;\nimport static org.guvnor.m2repo.utils.FileNameUtilities.isValid;\n\n@Dependent\npublic class UploadFormPresenter implements UploadFormView.Presenter {\n\n    private Event<M2RepoSearchEvent> searchEvent;\n\n    private UploadFormView view;\n\n    @Inject\n    public UploadFormPresenter(final UploadFormView view,\n                               final Event<M2RepoSearchEvent> searchEvent,\n                               final SyncBeanManager iocManager) {\n        this.view = view;\n        //When pop-up is closed destroy bean to avoid memory leak\n        view.addHideHandler(new ModalHideHandler() {\n            @Override\n            public void onHide(ModalHideEvent hideEvent) {\n                iocManager.destroyBean(UploadFormPresenter.this);\n            }\n        });\n        this.searchEvent = searchEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public void handleSubmitComplete(final AbstractForm.SubmitCompleteEvent event) {\n        view.hideUploadingBusy();\n        if (UPLOAD_OK.equalsIgnoreCase(event.getResults())) {\n            view.showUploadedSuccessfullyMessage();\n            view.hideGAVInputs();\n            fireSearchEvent();\n            view.hide();\n        } else if (UPLOAD_MISSING_POM.equalsIgnoreCase(event.getResults())) {\n            view.showInvalidJarNoPomWarning();\n            view.showGAVInputs();\n        } else if (UPLOAD_UNABLE_TO_PARSE_POM.equalsIgnoreCase(event.getResults())) {\n            view.showInvalidPomWarning();\n            view.hide();\n        } else {\n            view.showUploadFailedError(event.getResults());\n            view.hideGAVInputs();\n            view.hide();\n        }\n    }\n\n    @Override\n    public boolean isFileNameValid() {\n        String fileName = view.getFileName();\n        if (fileName == null || \"\".equals(fileName)) {\n            view.showSelectFileUploadWarning();\n            return false;\n        } else if (!(isValid(fileName))) {\n            view.showUnsupportedFileTypeWarning();\n            return false;\n        } else {\n            view.showUploadingBusy();\n            return true;\n        }\n    }\n\n    public void showView() {\n        view.show();\n    }\n\n    public void fireSearchEvent() {\n        searchEvent.fire(new M2RepoSearchEvent());\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/upload/UploadFormView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.upload;\n\nimport com.google.web.bindery.event.shared.HandlerRegistration;\nimport org.guvnor.m2repo.client.upload.UploadFormView.Presenter;\nimport org.gwtbootstrap3.client.shared.event.ModalHideHandler;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.uberfire.client.mvp.UberView;\n\npublic interface UploadFormView extends UberView<Presenter> {\n\n    interface Presenter {\n\n        void handleSubmitComplete(AbstractForm.SubmitCompleteEvent event);\n\n        boolean isFileNameValid();\n    }\n\n    String getFileName();\n\n    void showSelectFileUploadWarning();\n\n    void showUnsupportedFileTypeWarning();\n\n    void showUploadedSuccessfullyMessage();\n\n    void showInvalidJarNoPomWarning();\n\n    void showInvalidPomWarning();\n\n    void showUploadFailedError(String message);\n\n    void showGAVInputs();\n\n    void hideGAVInputs();\n\n    void showUploadingBusy();\n\n    void hideUploadingBusy();\n\n    void show();\n\n    void hide();\n\n    HandlerRegistration addHideHandler(final ModalHideHandler modalHideHandler);\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/upload/UploadFormViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.upload;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.Window;\nimport org.guvnor.m2repo.client.resources.i18n.M2RepoEditorConstants;\nimport org.guvnor.m2repo.model.HTMLFileManagerFields;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Form;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.FormType;\nimport org.gwtbootstrap3.client.ui.gwt.FormPanel;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.ext.widgets.common.client.common.FileUpload;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleItem;\nimport org.uberfire.ext.widgets.common.client.common.FormStyleLayout;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup;\n\npublic class UploadFormViewImpl\n        extends BaseModal implements UploadFormView {\n\n    private FormStyleLayout form = new FormStyleLayout();\n\n    private final TextBox hiddenGroupIdField = GWT.create(TextBox.class);\n    private final TextBox hiddenArtifactIdField = GWT.create(TextBox.class);\n    private final TextBox hiddenVersionIdField = GWT.create(TextBox.class);\n    private FormStyleItem groupIdItem;\n    private FormStyleItem artifactIdItem;\n    private FormStyleItem versionIdItem;\n\n    private Presenter presenter;\n\n    protected FileUpload uploader;\n\n    public UploadFormViewImpl() {\n        this.setTitle(M2RepoEditorConstants.INSTANCE.ArtifactUpload());\n        this.setBody(doUploadForm());\n        this.add(new ModalFooter() {{\n            add(new Button(M2RepoEditorConstants.INSTANCE.Cancel()) {{\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(ClickEvent event) {\n                        hide();\n                    }\n                });\n            }});\n        }});\n    }\n\n    private Form doUploadForm() {\n        form.setAction(getWebContext() + \"/maven2\");\n        form.setEncoding(FormPanel.ENCODING_MULTIPART);\n        form.setMethod(FormPanel.METHOD_POST);\n        form.setType(FormType.HORIZONTAL);\n\n        form.addSubmitCompleteHandler(new Form.SubmitCompleteHandler() {\n            public void onSubmitComplete(final Form.SubmitCompleteEvent event) {\n                presenter.handleSubmitComplete(event);\n            }\n        });\n\n        uploader = new FileUpload(() -> {\n            if (presenter.isFileNameValid()) {\n                form.submit();\n            }\n        });\n\n        uploader.setName(HTMLFileManagerFields.UPLOAD_FIELD_NAME_ATTACH);\n\n        hiddenGroupIdField.setName(HTMLFileManagerFields.GROUP_ID);\n        hiddenArtifactIdField.setName(HTMLFileManagerFields.ARTIFACT_ID);\n        hiddenVersionIdField.setName(HTMLFileManagerFields.VERSION_ID);\n\n        form.addAttribute(\"File\",\n                          uploader);\n        groupIdItem = form.addAttribute(\"Group IDENTIFIER\",\n                                        hiddenGroupIdField);\n        artifactIdItem = form.addAttribute(\"Artifact IDENTIFIER\",\n                                           hiddenArtifactIdField);\n        versionIdItem = form.addAttribute(\"Version IDENTIFIER\",\n                                          hiddenVersionIdField);\n\n        hideGAVInputs();\n\n        return form;\n    }\n\n    private String getWebContext() {\n        String context = GWT.getModuleBaseURL().replace(GWT.getModuleName() + \"/\",\n                                                        \"\");\n        if (context.endsWith(\"/\")) {\n            context = context.substring(0,\n                                        context.length() - 1);\n        }\n        return context;\n    }\n\n    @Override\n    public void init(final Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showUploadingBusy() {\n        BusyPopup.showMessage(M2RepoEditorConstants.INSTANCE.Uploading());\n    }\n\n    @Override\n    public void hideUploadingBusy() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public void showSelectFileUploadWarning() {\n        showMessage(M2RepoEditorConstants.INSTANCE.SelectFileUpload());\n    }\n\n    @Override\n    public void showUnsupportedFileTypeWarning() {\n        showMessage(M2RepoEditorConstants.INSTANCE.UnsupportedFileType());\n    }\n\n    @Override\n    public void showUploadedSuccessfullyMessage() {\n        showMessage(M2RepoEditorConstants.INSTANCE.UploadedSuccessfully());\n    }\n\n    @Override\n    public void showInvalidJarNoPomWarning() {\n        showMessage(M2RepoEditorConstants.INSTANCE.InvalidJarNotPom());\n    }\n\n    @Override\n    public void showInvalidPomWarning() {\n        showMessage(M2RepoEditorConstants.INSTANCE.InvalidPom());\n    }\n\n    @Override\n    public void showUploadFailedError(final String message) {\n        showErrorMessage(M2RepoEditorConstants.INSTANCE.UploadFailed() + message);\n    }\n\n    @Override\n    public void showGAVInputs() {\n        hiddenArtifactIdField.setVisible(true);\n        hiddenGroupIdField.setVisible(true);\n        hiddenVersionIdField.setVisible(true);\n        toggleFormStyleItem(groupIdItem,\n                            true);\n        toggleFormStyleItem(artifactIdItem,\n                            true);\n        toggleFormStyleItem(versionIdItem,\n                            true);\n    }\n\n    @Override\n    public void hideGAVInputs() {\n        toggleFormStyleItem(groupIdItem,\n                            false);\n        toggleFormStyleItem(artifactIdItem,\n                            false);\n        toggleFormStyleItem(versionIdItem,\n                            false);\n        hideTextBox(hiddenArtifactIdField);\n        hideTextBox(hiddenGroupIdField);\n        hideTextBox(hiddenVersionIdField);\n    }\n\n    private void toggleFormStyleItem(final FormStyleItem item,\n                                     final boolean toggle) {\n        if (item != null) {\n            item.setVisible(toggle);\n        }\n    }\n\n    private void hideTextBox(final TextBox textBox) {\n        textBox.setText(null);\n        textBox.setVisible(false);\n    }\n\n    @Override\n    public String getFileName() {\n        return uploader.getFilename();\n    }\n\n    @Override\n    public void hide() {\n        super.hide();\n        uploader.clear();\n    }\n\n    @Override\n    public void removeFromParent() {\n        super.removeFromParent();\n        uploader.clear();\n    }\n\n    private void showMessage(final String message) {\n        Window.alert(message);\n    }\n\n    private void showErrorMessage(final String message) {\n        ErrorPopup.showMessage(message);\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ArtifactListPresenter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.widgets;\n\nimport java.util.List;\n\npublic interface ArtifactListPresenter {\n\n    ArtifactListView getView();\n\n    void setup(final ColumnType... columns);\n\n    void notifyOnRefresh(boolean notify);\n\n    void search(String filter);\n\n    void search(String filter,\n                List<String> fileFormats);\n\n    void refresh();\n\n    void onOpenPom(String path);\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ArtifactListPresenterImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.widgets;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.view.client.AsyncDataProvider;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.paging.PageResponse;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Dependent\npublic class ArtifactListPresenterImpl\n        implements ArtifactListPresenter {\n\n    static final boolean DEFAULT_ORDER_ASCENDING = true;\n    private final ArtifactListView view;\n\n    private final Caller<M2RepoService> m2RepoService;\n\n    private final Event<NotificationEvent> notification;\n\n    RefreshableAsyncDataProvider dataProvider;\n    private boolean notify = true;\n\n    @Inject\n    public ArtifactListPresenterImpl(ArtifactListView view,\n                                     Caller<M2RepoService> m2RepoService,\n                                     Event<NotificationEvent> notification) {\n        this.view = view;\n        this.m2RepoService = m2RepoService;\n        this.notification = notification;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        dataProvider = new RefreshableAsyncDataProvider(view,\n                                                        m2RepoService);\n    }\n\n    @Override\n    public ArtifactListView getView() {\n        return view;\n    }\n\n    @Override\n    public void setup(final ColumnType... columns) {\n        view.setup(columns);\n    }\n\n    @Override\n    public void notifyOnRefresh(final boolean notify) {\n        this.notify = notify;\n    }\n\n    @Override\n    public void refresh() {\n        dataProvider.refresh();\n        if (notify) {\n            notification.fire(new NotificationEvent(view.getRefreshNotificationMessage()));\n        }\n    }\n\n    @Override\n    public void search(final String filter) {\n        search(filter,\n               null);\n    }\n\n    @Override\n    public void search(final String filter,\n                       final List<String> fileFormats) {\n        dataProvider.setFilter(filter);\n        dataProvider.setFileFormats(fileFormats);\n\n        if (dataProvider.getDataDisplays().isEmpty()) {\n            dataProvider.addDataDisplay(view.getDisplay());\n        } else {\n            dataProvider.goToFirstPage();\n        }\n\n        if (notify) {\n            notification.fire(new NotificationEvent(view.getRefreshNotificationMessage()));\n        }\n    }\n\n    @Override\n    public void onOpenPom(String path) {\n        m2RepoService.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(final String response) {\n                view.showPom(response);\n            }\n        }).getPomText(path);\n    }\n\n    /**\n     * Extension to AsyncDataProvider that supports refreshing the table.\n     */\n    static class RefreshableAsyncDataProvider extends AsyncDataProvider<JarListPageRow> {\n\n        private final ArtifactListView view;\n        private final Caller<M2RepoService> m2RepoService;\n        private String filter;\n        private List<String> fileFormats;\n\n        protected RefreshableAsyncDataProvider(final ArtifactListView view,\n                                               final Caller<M2RepoService> m2RepoService) {\n            this.view = PortablePreconditions.checkNotNull(\"view\",\n                                                           view);\n            this.m2RepoService = PortablePreconditions.checkNotNull(\"m2RepoService\",\n                                                                    m2RepoService);\n        }\n\n        protected void setFilter(String filter) {\n            this.filter = filter;\n        }\n\n        protected void setFileFormats(List<String> fileFormats) {\n            this.fileFormats = fileFormats;\n        }\n\n        protected void goToFirstPage() {\n            for (HasData<JarListPageRow> display : getDataDisplays()) {\n                boolean wasOnFirstPage = (display.getVisibleRange().getStart() == 0);\n                display.setVisibleRange(0,\n                                        display.getVisibleRange().getLength());\n                if (wasOnFirstPage) {\n                    onRangeChanged(display);\n                }\n            }\n        }\n\n        protected void refresh() {\n            for (HasData<JarListPageRow> display : getDataDisplays()) {\n                onRangeChanged(display);\n            }\n        }\n\n        @Override\n        protected void onRangeChanged(HasData<JarListPageRow> display) {\n            final Range range = display.getVisibleRange();\n            JarListPageRequest request = new JarListPageRequest(range.getStart(),\n                                                                range.getLength(),\n                                                                filter,\n                                                                fileFormats,\n                                                                getSortColumnDataStoreName(),\n                                                                isSortColumnAscending());\n\n            m2RepoService.call(new RemoteCallback<PageResponse<JarListPageRow>>() {\n                @Override\n                public void callback(final PageResponse<JarListPageRow> response) {\n                    updateRowCount(response.getTotalRowSize(),\n                                   response.isTotalRowSizeExact());\n                    updateRowData(response.getStartRowIndex(),\n                                  response.getPageRowList());\n                }\n            }).listArtifacts(request);\n        }\n\n        private String getSortColumnDataStoreName() {\n            final ColumnSortList columnSortList = view.getColumnSortList();\n            return (columnSortList == null || columnSortList.size() == 0) ? null : columnSortList.get(0).getColumn().getDataStoreName();\n        }\n\n        private boolean isSortColumnAscending() {\n            final ColumnSortList columnSortList = view.getColumnSortList();\n            return (columnSortList == null || columnSortList.size() == 0) ? DEFAULT_ORDER_ASCENDING : columnSortList.get(0).isAscending();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ArtifactListView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.widgets;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.view.client.HasData;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.uberfire.client.mvp.UberView;\n\npublic interface ArtifactListView extends UberView<ArtifactListPresenter> {\n\n    void setContentHeight(String s);\n\n    void setup(final ColumnType... columns);\n\n    void addColumn(final Column<JarListPageRow, ?> column,\n                   final String caption);\n\n    void addColumn(final Column<JarListPageRow, ?> column,\n                   final String caption,\n                   final boolean visible);\n\n    void addColumn(final Column<JarListPageRow, ?> column,\n                   final String caption,\n                   final double width,\n                   final Style.Unit unit);\n\n    void addColumn(final Column<JarListPageRow, ?> column,\n                   final String caption,\n                   final boolean visible,\n                   final double width,\n                   final Style.Unit unit);\n\n    void showPom(String pomText);\n\n    HasData<JarListPageRow> getDisplay();\n\n    ColumnSortList getColumnSortList();\n\n    String getRefreshNotificationMessage();\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ArtifactListViewImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.widgets;\n\nimport java.util.Arrays;\nimport java.util.Date;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.cell.client.DateCell;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortEvent;\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.HasData;\nimport org.guvnor.m2repo.client.editor.JarDetailPopup;\nimport org.guvnor.m2repo.client.resources.i18n.M2RepoEditorConstants;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\n\n@Dependent\npublic class ArtifactListViewImpl extends Composite implements ArtifactListView {\n\n    interface ArtifactListViewImplWidgetBinder\n            extends\n            UiBinder<Widget, ArtifactListViewImpl> {\n\n    }\n\n    private ArtifactListViewImplWidgetBinder uiBinder = GWT.create(ArtifactListViewImplWidgetBinder.class);\n\n    @UiField(provided = true)\n    final PagedTable<JarListPageRow> dataGrid = new PagedTable<JarListPageRow>();\n\n    protected ArtifactListPresenter presenter;\n\n    public ArtifactListViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setup(final ColumnType... _columns) {\n        final Set<ColumnType> columns = new HashSet<ColumnType>(Arrays.asList(_columns));\n        dataGrid.setEmptyTableCaption(M2RepoEditorConstants.INSTANCE.NoArtifactAvailable());\n\n        if (columns.contains(ColumnType.NAME)) {\n            final Column<JarListPageRow, String> nameColumn = new Column<JarListPageRow, String>(new TextCell()) {\n                @Override\n                public String getValue(JarListPageRow row) {\n                    return row.getName();\n                }\n            };\n            nameColumn.setSortable(true);\n            nameColumn.setDataStoreName(JarListPageRequest.COLUMN_NAME);\n            addColumn(nameColumn,\n                      M2RepoEditorConstants.INSTANCE.Name());\n        }\n\n        if (columns.contains(ColumnType.GAV)) {\n            final Column<JarListPageRow, String> gavColumn = new Column<JarListPageRow, String>(new TextCell()) {\n                @Override\n                public String getValue(JarListPageRow row) {\n                    return row.getGav().toString();\n                }\n            };\n            gavColumn.setSortable(true);\n            gavColumn.setDataStoreName(JarListPageRequest.COLUMN_GAV);\n            addColumn(gavColumn,\n                      M2RepoEditorConstants.INSTANCE.GAV());\n        }\n\n        if (columns.contains(ColumnType.LAST_MODIFIED)) {\n            final Column<JarListPageRow, Date> lastModifiedColumn = new Column<JarListPageRow, Date>(new DateCell(DateTimeFormat.getFormat(DateTimeFormat.PredefinedFormat.DATE_TIME_MEDIUM))) {\n                @Override\n                public Date getValue(JarListPageRow row) {\n                    return row.getLastModified();\n                }\n            };\n            lastModifiedColumn.setSortable(true);\n            lastModifiedColumn.setDataStoreName(JarListPageRequest.COLUMN_LAST_MODIFIED);\n            addColumn(lastModifiedColumn,\n                      M2RepoEditorConstants.INSTANCE.LastModified(),\n                      false);\n        }\n\n        dataGrid.addColumnSortHandler(new ColumnSortEvent.AsyncHandler(dataGrid));\n    }\n\n    @Override\n    public void setContentHeight(String s) {\n        dataGrid.setHeight(s);\n    }\n\n    @Override\n    public void init(final ArtifactListPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void addColumn(final Column<JarListPageRow, ?> column,\n                          final String caption) {\n        dataGrid.addColumn(column,\n                           caption);\n    }\n\n    @Override\n    public void addColumn(final Column<JarListPageRow, ?> column,\n                          final String caption,\n                          final boolean visible) {\n        dataGrid.addColumn(column,\n                           caption,\n                           visible);\n    }\n\n    @Override\n    public void addColumn(final Column<JarListPageRow, ?> column,\n                          final String caption,\n                          final double width,\n                          final Style.Unit unit) {\n        dataGrid.addColumn(column,\n                           caption);\n        dataGrid.setColumnWidth(column,\n                                width,\n                                unit);\n    }\n\n    @Override\n    public void addColumn(final Column<JarListPageRow, ?> column,\n                          final String caption,\n                          final boolean visible,\n                          final double width,\n                          final Style.Unit unit) {\n        dataGrid.addColumn(column,\n                           caption,\n                           visible);\n        dataGrid.setColumnWidth(column,\n                                width,\n                                unit);\n    }\n\n    @Override\n    public void showPom(String pomText) {\n        JarDetailPopup popup = new JarDetailPopup(pomText);\n        popup.show();\n    }\n\n    @Override\n    public HasData<JarListPageRow> getDisplay() {\n        return dataGrid;\n    }\n\n    @Override\n    public ColumnSortList getColumnSortList() {\n        return dataGrid.getColumnSortList();\n    }\n\n    @Override\n    public String getRefreshNotificationMessage() {\n        return M2RepoEditorConstants.INSTANCE.RefreshedSuccessfully();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ArtifactListViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --><!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:uf='urn:import:org.uberfire.ext.widgets.common.client.tables'>\n\n    <b:Container fluid=\"true\">\n        <b:Row>\n            <b:Column size=\"MD_12\">\n                <uf:PagedTable ui:field=\"dataGrid\"/>\n            </b:Column>\n        </b:Row>\n    </b:Container>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/java/org/guvnor/m2repo/client/widgets/ColumnType.java",
    "content": "/*\n * Copyright 2016 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.widgets;\n\npublic enum ColumnType {\n    NAME,\n    GAV,\n    LAST_MODIFIED\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.guvnor.m2repo.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/GuvnorM2RepoEditorClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <source path=\"client\"/>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name='org.gwtbootstrap3.GwtBootstrap3NoTheme'/>\n\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.guvnor.m2repo.GuvnorM2RepoEditorAPI\"/>\n  <inherits name=\"org.guvnor.common.services.project.GuvnorProjectAPI\"/>\n\n  <inherits name='org.uberfire.ext.widgets.common.UberfireWidgetsCommons'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/css/Styles.css",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n.caption {\n    font-weight: bold;\n}\n\n.pom {\n    width: 100%;\n    height: 100%;\n    border: 1px solid lightgray;\n    border-radius: 5px;\n    background-color: white;\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2Constants.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nArtifactRepositoryPreference.Label=Artifact Repository\nArtifactRepositoryPreference.GlobalM2RepoDir=Global M2 repository directory\nArtifactRepositoryPreference.GlobalM2RepoDirEnabled=Is Global M2 repository directory enabled?\nArtifactRepositoryPreference.WorkspaceM2RepoDir=Workspace M2 repository directory\nArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled=Is Workspace M2 repository directory enabled?\nArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled=Is Distribution Management repository enabled?\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2Constants_es.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nArtifactRepositoryPreference.Label=Repositorio de artefactos\nArtifactRepositoryPreference.GlobalM2RepoDir=Directorio del repositorio global M2\nArtifactRepositoryPreference.GlobalM2RepoDirEnabled=¿Está habilitado el directorio del repositorio Global M2?\nArtifactRepositoryPreference.WorkspaceM2RepoDir=Directorio del repositorio Workspace M2\nArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled=¿Está habilitado el directorio del repositorio de Workspace M2?\nArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled=¿Está habilitado el repositorio de gestión de distribución?\n\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2Constants_fr.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nArtifactRepositoryPreference.Label=Référentiel d’artefacts\nArtifactRepositoryPreference.GlobalM2RepoDir=Référentiel d''artefacts mondial M2\nArtifactRepositoryPreference.GlobalM2RepoDirEnabled=Le référentiel d''artefacts mondial M2 est-il activé ?\nArtifactRepositoryPreference.WorkspaceM2RepoDir=Référentiel d''artefacts espace de travail M2\nArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled=Le référentiel d''artefacts espace de travail M2 est-il activé ?\nArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled=Le référentiel de Distribution Management est-il activé ?\n\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2Constants_it.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nArtifactRepositoryPreference.Label=Repository degli artefatti\nArtifactRepositoryPreference.GlobalM2RepoDir=Directory globale del repository M2\nArtifactRepositoryPreference.GlobalM2RepoDirEnabled=È abilitata la directory globale del repository M2?\nArtifactRepositoryPreference.WorkspaceM2RepoDir=Directory del repository M2 del workspace\nArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled=È abilitata la directory del repository M2 del workspace?\nArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled=È abilitato il repository di gestione della distribuzione?\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2Constants_ja.properties",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\nArtifactRepositoryPreference.Label=アーティファクトリポジトリー\nArtifactRepositoryPreference.GlobalM2RepoDir=グローバル M2 のリポジトリーディレクトリー\nArtifactRepositoryPreference.GlobalM2RepoDirEnabled=グローバル M2 のリポジトリーディレクトリーは有効ですか?\nArtifactRepositoryPreference.WorkspaceM2RepoDir=ワークスペース M2 のリポジトリーディレクトリー\nArtifactRepositoryPreference.WorkspaceM2RepoDirEnabled=ワークスペース M2 のリポジトリーディレクトリーは有効ですか?\nArtifactRepositoryPreference.DistributionManagementM2RepoDirEnabled=ディストリビューションの管理リポジトリーは有効ですか?\n\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nInvalidModelName=The name ''{0}'' is invalid - please choose another\nNameTakenForModel=The name ''{0}'' is already taken - please choose another\nModelNameChangeWarning=Are you sure you want to change the name? Its possible that rules will need to be changed to reflect the new name.\nRename=Rename\nDelete=Delete\nName=Name\nDoesNotExtend=-- Does not extend --\nCreatesCircularDependency=Unable to extend ''{0}'' as it creates a circular dependency.\nTypeExtends=Type extends\nAddField=Add Field\nAddAnnotation=Add Annotation\nAreYouSureYouWantToRemoveTheField0=Are you sure you want to remove the field ''{0}'' ?\nAreYouSureYouWantToRemoveTheAnnotation0=Are you sure you want to remove the meta-data ''{0}'' ?\nMoveUp=Move up\nMoveDown=Move down\nRemoveThisFactType=Remove this fact type\nCannotDeleteADeclarationThatIsASuperType=Unable to delete. Fact is extended by another.\nAreYouSureYouWantToRemoveThisFact=Are you sure you want to remove this fact?\nAddNewFactType=Add new fact type\nInvalidDataTypeName=The data-type ''{0}'' is invalid - please choose another\nType=Type\nFieldNameAttribute=Field name\nchooseType=-- choose type --\nWholeNumberInteger=Whole number (integer)\nTrueOrFalse=True or False\nDate=Date\nDecimalNumber=Decimal number\nText=Text\nAreYouSureYouWantToDeleteTheseItems=Are you sure you want to delete these jars?\nJarDetails=JAR details\nM2RepositoryContent=M2 Repository Content\nPath=Path\nGAV=GAV\nLastModified=Last Modified\nOpen=Open\nDownload=Download\nArtifactUpload=Artifact upload\nNoArtifactAvailable=No artifacts available\nDownloading=Downloading\nCancel=Cancel\nSelectFileUpload=Please select a file to upload\nUploadedSuccessfully=Uploaded successfully\nRefreshedSuccessfully=Repository successfully refreshed\nInvalidJarNotPom=The Jar does not contain a valid POM file. Please specify GAV info manually.\nUploadFailed=Upload failed:\nUnsupportedFileType=File must be either *.jar, *.kjar or pom.xml.\nInvalidPom=The pom.xml file could not be parsed and hence cannot be uploaded.\nUploading=Uploading...\nUpload=Upload\nRefresh=Refresh"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_de.properties",
    "content": "OK=OK\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidModelName=Der Name »{0}« ist ungültig - bitte wählen Sie einen anderen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNameTakenForModel=Der Name »{0}« wird bereits verwendet - bitte wählen Sie einen anderen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nModelNameChangeWarning=Sind Sie sicher, dass Sie den Namen ändern möchten? Es ist möglich, dass Regeln geändert werden müssen, um den neuen Namen zu reflektieren.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRename=Umbenennen\nDelete=Löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nName=Name\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDoesNotExtend=-- Wird nicht erweitert --\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCreatesCircularDependency=Kann »{0}« nicht erweitern, da dies eine zirkuläre Abhängigkeit erzeugt.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nTypeExtends=Typ erweitert\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddField=Feld hinzufügen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddAnnotation=Annotation hinzufügen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheField0=Sind Sie sicher, dass Sie Feld »{0}« entfernen möchten?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheAnnotation0=Sind Sie sicher, dass Sie Metadaten »{0}« entfernen möchten?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveUp=Nach oben verschieben\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMoveDown=Nach unten verschieben\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nRemoveThisFactType=Diesen Fakt-Typ entfernen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCannotDeleteADeclarationThatIsASuperType=Kann nicht löschen. Fakt durch anderen erweitert.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveThisFact=Sind Sie sicher, dass Sie diesen Fakt entfernen möchten?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddNewFactType=Neuen Fakt-Typ hinzufügen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidDataTypeName=Der Datentyp »{0}« ist ungültig - bitte wählen Sie einen anderen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author jdimanos\nType=Typ\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nFieldNameAttribute=Feldname\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nchooseType=-- Typ wählen --\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nWholeNumberInteger=Ganze Zahl (Integer)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nTrueOrFalse=True oder False\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDate=Datum\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDecimalNumber=Dezimalzahl\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nText=Text\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToDeleteTheseItems=Sind Sie sicher, dass Sie diese jars löschen möchten?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nJarDetails=JAR details\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nM2RepositoryContent=M2 Repository Content\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nPath=Pfad\nGAV=GAV\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author jdimanos\nLastModified=Zuletzt geändert\nOpen=Öffnen\nDownload=Herunterladen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nArtifactUpload=Artefakt Hochladen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNoArtifactAvailable=Keine Artefakte verfügbar\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDownloading=Herunterladen\nCancel=Abbrechen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nSelectFileUpload=Datei zum Hochladen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadedSuccessfully=Erfolgreich hochgeladen\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author Jan Schatteman\nRefreshedSuccessfully=Erfolgreich aktualisiert\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidJarNotPom=Die JAR enthält keine gültige POM-Datei. Bitte geben Sie GAV info manuell.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadFailed=Hochladen fehlgeschlagen\\:\nUnsupportedFileType=Datei muss entweder *.jar, *.kjar oder pom.xml. sein\nInvalidPom=Die pom.xml Datei konnte nicht analysiert werden und kann daher nicht hochgeladen werden.\nUploading=Wird hochgeladen...\nUpload=Hochladen\nRefresh=Aktualisieren\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_es.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=Aceptar\nInvalidModelName=El nombre ''{0}'' no es válido; elija otro\nNameTakenForModel=El nombre ''{0}'' ya está en uso; elija otro\nModelNameChangeWarning=¿Está seguro de que desea cambiar el nombre? Es posible que haya que cambiar las reglas para reflejar el nuevo nombre.\nRename=Cambiar nombre\nDelete=Eliminar\nName=Nombre\nDoesNotExtend=-- No se extiende --\nCreatesCircularDependency=No se puede extender ''{0}'', ya que crea una dependencia circular.\nTypeExtends=El tipo se extiende\nAddField=Agregar campo\nAddAnnotation=Agregar anotación\nAreYouSureYouWantToRemoveTheField0=¿Está seguro de que desea quitar el campo ''{0}''?\nAreYouSureYouWantToRemoveTheAnnotation0=¿Está seguro de que desea quitar los metadatos ''{0}''?\nMoveUp=Mover hacia arriba\nMoveDown=Mover hacia abajo\nRemoveThisFactType=Quitar este tipo de dato\nCannotDeleteADeclarationThatIsASuperType=No se puede eliminar. El dato se extiende por otro elemento.\nAreYouSureYouWantToRemoveThisFact=¿Está seguro de que desea quitar este dato?\nAddNewFactType=Agregar nuevo tipo de dato\nInvalidDataTypeName=El tipo de datos ''{0}'' no es válido; elija otro\nType=Tipo\nFieldNameAttribute=Nombre del campo\nchooseType=-- elegir tipo --\nWholeNumberInteger=Número entero\nTrueOrFalse=Verdadero o falso\nDate=Fecha\nDecimalNumber=Número decimal\nText=Texto\nAreYouSureYouWantToDeleteTheseItems=¿Está seguro de que desea eliminar estos Jar?\nJarDetails=Detalles del JAR\nM2RepositoryContent=Contenido del repositorio M2\nPath=Ruta\nGAV=GAV\nLastModified=Última modificación\nOpen=Abrir\nDownload=Descargar\nArtifactUpload=Carga de artefactos\nNoArtifactAvailable=No hay artefactos disponibles\nDownloading=Descargando\nCancel=Cancelar\nSelectFileUpload=Seleccione un archivo para cargar\nUploadedSuccessfully=La carga se completó correctamente\nRefreshedSuccessfully=El repositorio se actualizó correctamente\nInvalidJarNotPom=El Jar no contiene un archivo POM válido. Especifique la información del GAV manualmente.\nUploadFailed=Error al cargar:\nUnsupportedFileType=El archivo debe ser *.jar, *.kjar o pom.xml.\nInvalidPom=No se pudo analizar el archivo pom.xml y, por lo tanto, este no puede cargarse.\nUploading=Cargando…\nUpload=Cargar\nRefresh=Actualizar"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_fr.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nInvalidModelName=Le nom ''{0}'' n''est pas valide. Veuillez en choisir un autre.\nNameTakenForModel=Le nom ''{0}'' est déjà utilisé. Veuillez en choisir un autre.\nModelNameChangeWarning=Voulez-vous vraiment modifier le nom ? Il est possible que les règles doivent être modifiées pour refléter le nouveau nom.\nRename=Renommer\nDelete=Supprimer\nName=Nom\nDoesNotExtend=-- Extension impossible --\nCreatesCircularDependency=Impossible d''étendre ''{0}'', car cela crée une dépendance circulaire.\nTypeExtends=Le type étend\nAddField=Ajouter un champ\nAddAnnotation=Ajouter une annotation\nAreYouSureYouWantToRemoveTheField0=Voulez-vous vraiment supprimer le champ ''{0}'' ?\nAreYouSureYouWantToRemoveTheAnnotation0=Voulez-vous vraiment supprimer les métadonnées ''{0}'' ?\nMoveUp=Déplacer vers le haut\nMoveDown=Déplacer vers le bas\nRemoveThisFactType=Supprimer ce type de fait\nCannotDeleteADeclarationThatIsASuperType=Suppression impossible. Le fait est étendu par un autre.\nAreYouSureYouWantToRemoveThisFact=Voulez-vous vraiment supprimer ce fait ?\nAddNewFactType=Ajouter un nouveau type de fait\nInvalidDataTypeName=Le type de données ''{0}'' n''est pas valide. Veuillez en choisir un autre.\nType=Type\nFieldNameAttribute=Nom du champ\nchooseType=-- choisir le type --\nWholeNumberInteger=Nombre entier\nTrueOrFalse=Vrai ou faux\nDate=Date\nDecimalNumber=Nombre décimal\nText=Texte\nAreYouSureYouWantToDeleteTheseItems=Voulez-vous vraiment supprimer ces fichiers JAR ?\nJarDetails=Détails du fichier JAR\nM2RepositoryContent=Contenu du référentiel M2\nPath=Chemin d''accès\nGAV=GAV\nLastModified=Dernière modification\nOpen=Ouvrir\nDownload=Télécharger\nArtifactUpload=Envoi d''artefacts\nNoArtifactAvailable=Aucun artefact disponible\nDownloading=Téléchargement\nCancel=Annuler\nSelectFileUpload=Veuillez sélectionner un fichier à envoyer\nUploadedSuccessfully=Envoyé avec succès\nRefreshedSuccessfully=Référentiel rafraîchi\nInvalidJarNotPom=Le fichier JAR ne contient pas de fichier POM valide. Veuillez indiquer des informations GAV manuellement.\nUploadFailed=L''envoi a échoué :\nUnsupportedFileType=Le fichier doit être soit au format *.jar, *.kjar ou pom.xml.\nInvalidPom=Le fichier pom.xml n''a pas pu être analysé et ne peut donc pas être envoyé.\nUploading=Envoi…\nUpload=Envoyer\nRefresh=Rafraîchir"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_it.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nInvalidModelName=Il nome ''{0}'' non è valido - si prega di sceglierne un altro\nNameTakenForModel=Il nome ''{0}'' è già stato preso - si prega di sceglierne un altro\nModelNameChangeWarning=Sei sicuro di voler cambiare il nome? Potrebbe essere necessario modificare le regole per riflettere il nuovo nome.\nRename=Rinomina\nDelete=Elimina\nName=Nome\nDoesNotExtend=-- Non estende --\nCreatesCircularDependency=Impossibile estendere ''{0}'' poiché crea una dipendenza circolare.\nTypeExtends=Il tipo estende\nAddField=Aggiungi campo\nAddAnnotation=Aggiungi annotazione\nAreYouSureYouWantToRemoveTheField0=Sei sicuro di voler rimuovere il campo ''{0}''?\nAreYouSureYouWantToRemoveTheAnnotation0=Sei sicuro di voler rimuovere i metadati ''{0}''?\nMoveUp=Sposta su\nMoveDown=Sposta giù\nRemoveThisFactType=Rimuovi questo tipo di fatto\nCannotDeleteADeclarationThatIsASuperType=Impossibile eliminare. Il fatto è esteso da un altro.\nAreYouSureYouWantToRemoveThisFact=Sei sicuro di voler rimuovere questo fatto?\nAddNewFactType=Aggiungi nuovo tipo di fatto\nInvalidDataTypeName=Il tipo di dato ''{0}'' non è valido - si prega di sceglierne un altro\nType=Tipo\nFieldNameAttribute=Nome campo\nchooseType=-- scegli tipo --\nWholeNumberInteger=Numero intero (integer)\nTrueOrFalse=Vero o Falso\nDate=Data\nDecimalNumber=Numero decimale\nText=Testo\nAreYouSureYouWantToDeleteTheseItems=Sei sicuro di voler eliminare questi file JAR?\nJarDetails=Dettagli JAR\nM2RepositoryContent=Contenuto repository M2\nPath=Percorso\nGAV=GAV\nLastModified=Ultima modifica\nOpen=Apri\nDownload=Scarica\nArtifactUpload=Caricamento artefatto\nNoArtifactAvailable=Nessun artefatto disponibile\nDownloading=Download in corso\nCancel=Annulla\nSelectFileUpload=Seleziona un file da caricare\nUploadedSuccessfully=Caricato con successo\nRefreshedSuccessfully=Repository aggiornato correttamente\nInvalidJarNotPom=Il file JAR non contiene un file POM valido. Specificare manualmente le informazioni GAV.\nUploadFailed=Caricamento non riuscito:\nUnsupportedFileType=Il file deve essere in formato *.jar, *.kjar o pom.xml.\nInvalidPom=Impossibile analizzare il file pom.xml e quindi non può essere caricato.\nUploading=Caricamento in corso...\nUpload=Carica\nRefresh=Aggiorna\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_ja.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nOK=OK\nInvalidModelName=''{0}'' の名前は無効です - 他の名前を選択してください\nNameTakenForModel=''{0}''の名前は既に利用されています - 他の名前を選択してください\nModelNameChangeWarning=名前を変更してもよろしいですか?新しい名前を反映させるために、ルールを変更しなければならない可能性があります。\nRename=名前を変更\nDelete=削除\nName=名前\nDoesNotExtend=-- 継承しない --\nCreatesCircularDependency=循環依存が発生するため、''{0}'' を継承できません。\nTypeExtends=タイプを継承\nAddField=フィールドを追加\nAddAnnotation=アノテーションを追加\nAreYouSureYouWantToRemoveTheField0=本当にこの''{0}''というフィールドを削除していいですか?\nAreYouSureYouWantToRemoveTheAnnotation0=本当にこの''{0}''というメタデータを削除していいですか?\nMoveUp=上に移動\nMoveDown=下に移動\nRemoveThisFactType=このファクトタイプを削除\nCannotDeleteADeclarationThatIsASuperType=削除できませんファクトは別のものによって拡張されています。\nAreYouSureYouWantToRemoveThisFact=本当にこのファクトを削除してもいいですか?\nAddNewFactType=新規ファクトタイプを追加\nInvalidDataTypeName=''{0}'' のデータタイプは無効です - 他のデータタイプを選択してください\nType=タイプ\nFieldNameAttribute=フィールド名\nchooseType=-- タイプを選択 --\nWholeNumberInteger=数字全体 (整数)\nTrueOrFalse=True か False\nDate=日付\nDecimalNumber=10 進数\nText=テキスト\nAreYouSureYouWantToDeleteTheseItems=jarを削除してよろしいですか？\nJarDetails=詳細\nM2RepositoryContent=M2 リポジトリーのコンテンツ\nPath=パス\nGAV=GAV\nLastModified=最終更新日\nOpen=開く\nDownload=ダウンロード\nArtifactUpload=アーティファクトアップロード\nNoArtifactAvailable=利用できるアーティファクトはありません\nDownloading=ダウンロード\nCancel=キャンセル\nSelectFileUpload=アップロードするファイルを選択してください\nUploadedSuccessfully=正常にアップロードされました\nRefreshedSuccessfully=リポジトリーが正常にリフレッシュされました\nInvalidJarNotPom=Jar には有効な POM ファイルが含まれていません。GAV 情報を手動で指定してください。\nUploadFailed=アップロードに失敗しました: \nUnsupportedFileType=ファイルは *.jar、*.kjar、または pom.xml である必要があります。\nInvalidPom=pom.xml ファイルは解析できなかったため、アップロードできません。\nUploading=アップロード中...\nUpload=アップロード\nRefresh=更新"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_ja_JP.properties",
    "content": "OK=OK\nInvalidModelName=''{0}'' の名前は無効です - 他の名前を選択してください\nNameTakenForModel=''{0}''の名前は既に利用されています - 他の名前を選択してください\nModelNameChangeWarning=名前を変更してもよろしいですか? 新しい名前を反映させるためにルールを変更しなければならない可能性があります。\nRename=名前を変更\nDelete=削除\nName=名前\nDoesNotExtend=-- 継承しない --\nCreatesCircularDependency=循環依存が発生するため、''{0}'' を継承できません。\nTypeExtends=タイプを継承\nAddField=フィールドを追加\nAddAnnotation=アノテーションを追加\nAreYouSureYouWantToRemoveTheField0=本当にこの''{0}''というフィールドを削除していいですか?\nAreYouSureYouWantToRemoveTheAnnotation0=本当にこの''{0}''というメタデータを削除していいですか?\nMoveUp=上に移動\nMoveDown=下に移動\nRemoveThisFactType=このファクトタイプを削除\nCannotDeleteADeclarationThatIsASuperType=削除できません。ファクトは別のものによって拡張されています。\nAreYouSureYouWantToRemoveThisFact=本当にこのファクトを削除してもいいですか?\nAddNewFactType=新規ファクトタイプを追加\nInvalidDataTypeName=''{0}'' のデータタイプは無効です - 他のデータタイプを選択してください\nType=タイプ\nFieldNameAttribute=フィールド名\nchooseType=-- タイプを選択 --\nWholeNumberInteger=整数\nTrueOrFalse=True か False\nDate=日付\nDecimalNumber=10 進数\nText=テキスト\nAreYouSureYouWantToDeleteTheseItems=jarを削除してよろしいですか？\nJarDetails=JAR details\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_pt_BR.properties",
    "content": "OK=OK\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidModelName=O nome ''{0}'' é inválido - por favor, escolha outro nome\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNameTakenForModel=O nome ''{0}''  já foi usado,  por favor,  escolha outro\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nModelNameChangeWarning=Você tem certeza que deseja mudar o nome? É possível que regras precisem ser modificadas para refletir o novo nome\nRename=Renomear\nDelete=Excluir\nName=Nome\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDoesNotExtend=-- Não estende -- \n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCreatesCircularDependency=Não foi possível estender  ''{0}''  uma vez que isto cria uma dependência circular.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nTypeExtends=Extensões de Tipo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddField=Adicionar Campo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddAnnotation=Adicionar Anotação\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheField0=Você tem certeza que deseja remover o campo ''{0}'' ?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheAnnotation0=Você tem certeza de que deseja remover o meta-dado  ''{0}'' ?\nMoveUp=Mover para cima\nMoveDown=Mover para baixo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nRemoveThisFactType=Remover este tipo de fato \n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCannotDeleteADeclarationThatIsASuperType=Não foi possível a exclusão. O fato foi estendido por outro.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveThisFact=Você tem certeza que deseja remover este fato?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddNewFactType=Adicionar novo tipo fato\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidDataTypeName=O ''{0}'' do tipo de dados está inválido - por favor escolha outro\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author ldelima@redhat.com\nType=Tipo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nFieldNameAttribute=Nome do campo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nchooseType=-- escolher o tipo --\nWholeNumberInteger=Número inteiro (integer)\nTrueOrFalse=Verdadeiro ou falso\nDate=Data\nDecimalNumber=Número decimal\nText=Texto\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToDeleteTheseItems=Você tem certeza que deseja excluir esses jars?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nJarDetails=JAR Detalhes\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nM2RepositoryContent=M2 Repositório do Conteúdo\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nPath=Caminho\nGAV=GAV\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author ldelima@redhat.com\nLastModified=Modificado pela última vez\nOpen=Abrir\nDownload=Download\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nArtifactUpload=Carregar artefato\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNoArtifactAvailable=Nenhum artefato disponível\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDownloading=O download\nCancel=Cancelar\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nSelectFileUpload=Arquivo para Upload\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadedSuccessfully=Carregando com Êxito\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author Jan Schatteman\nRefreshedSuccessfully=O repositório é atualizado com éxito\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidJarNotPom=O JAR não contém um arquivo POM válido. Por favor, especifique informações GAV manualmente.\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadFailed=Falha no carregamento\\:\nUnsupportedFileType=O arquivo deve ser *.jar, *.kjar ou pom.xml.\nInvalidPom=O arquivo pom.xml não pôde ser analisado e, portanto, não pode ser carregado. \nUploading=Carregando...\nUpload=Carregar\nRefresh=Atualizar\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/main/resources/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants_zh_CN.properties",
    "content": "OK=确定\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidModelName=名称 ''{0}'' 无效 - 请另外选择一个名称\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNameTakenForModel=名称 ''{0}'' 已经被使用 - 请使用其它名称\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nModelNameChangeWarning=确认要重命名吗？规则可能需要修改以对应新名称.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRename=重命名\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nDelete=删除\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nName=名称\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDoesNotExtend=-- 未扩展 --\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCreatesCircularDependency=无法扩展 ''{0}''，因为这样会形成循环依赖。\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nTypeExtends=类型扩展\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddField=添加字段\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddAnnotation=添加注解\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheField0=确认要移除字段 ''{0}'' 吗?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveTheAnnotation0=确认要移除元数据 ''{0}'' 吗?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveUp=上移\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMoveDown=下移\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nRemoveThisFactType=移除这个 fact 类型\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nCannotDeleteADeclarationThatIsASuperType=无法删除。Fact 已被其他 Fact 扩展。\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToRemoveThisFact=确认要移除这个 fact 吗?\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAddNewFactType=添加新的 fact 类型\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nInvalidDataTypeName=数据类型''{0}''不合法，请选择其它。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author xi.huang\nType=类型\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nFieldNameAttribute=字段名\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nchooseType=-- 选择类型 --\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nWholeNumberInteger=整数\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nTrueOrFalse=正确 或 错误\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDate=日期\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDecimalNumber=十进制数\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nText=文本\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nAreYouSureYouWantToDeleteTheseItems=确定要删除这些 JAR 文件吗？\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nJarDetails=JAR 详情\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nM2RepositoryContent=M2 存储库內容\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nPath=路径\nGAV=GAV\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author xi.huang\nLastModified=上次修改\nOpen=打开\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-dtable-xls-editor-client/org/drools/workbench/screens/dtablexls/client/resources/i18n/DecisionTableXLSEditorConstants\nDownload=下载\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nArtifactUpload=上传\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nNoArtifactAvailable=没有可用的构件\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nDownloading=下载\nCancel=取消\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nSelectFileUpload=请选择要上传的文件\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadedSuccessfully=上传成功\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author xi.huang\nRefreshedSuccessfully=成功刷新存储库\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author xi.huang\nInvalidJarNotPom=这个 JAR 不包含有效的 POM 文件。请手动指定 GAV 信息。\n# translation auto-copied from project guvnor, version 6.0.0, document org.guvnor/guvnor-m2repo-editor-client/org/guvnor/m2repo/client/resources/i18n/M2RepoEditorConstants, author nmirasch\nUploadFailed=上传失败：\nUnsupportedFileType=文件必须为 *.jar、*.kjar 或 pom.xml。\nInvalidPom=无法解析 pom.xml 文件，因此无法将之上传。\nUploading=上传中......\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-dtable-xls-editor-client/org/drools/workbench/screens/dtablexls/client/resources/i18n/DecisionTableXLSEditorConstants\nUpload=上传\nRefresh=刷新\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/M2RepoEditorPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client;\n\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.m2repo.client.event.M2RepoRefreshEvent;\nimport org.guvnor.m2repo.client.upload.UploadFormPresenter;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class M2RepoEditorPresenterTest {\n\n    @Mock\n    UploadFormPresenter uploadFormPresenter;\n\n    @Spy\n    Event<M2RepoRefreshEvent> refreshEvents = new EventSourceMock<M2RepoRefreshEvent>();\n\n    @GwtMock\n    Button menuRefreshButton;\n\n    ClickHandler clickHandler;\n\n    @InjectMocks\n    M2RepoEditorPresenter presenter;\n\n    @Before\n    public void setup() {\n        doNothing().when(refreshEvents).fire(any(M2RepoRefreshEvent.class));\n    }\n\n    @Test\n    public void testUpload() {\n        presenter.getMenus(menus -> {\n            final MenuItemCommand upload = (MenuItemCommand) menus.getItems().get(0);\n            upload.getCommand().execute();\n\n            verify(uploadFormPresenter).showView();\n        });\n    }\n\n    @Test\n    public void testRefresh() {\n        when(menuRefreshButton.addClickHandler(any(ClickHandler.class))).thenAnswer(new Answer() {\n            public Object answer(InvocationOnMock aInvocation) throws Throwable {\n                clickHandler = (ClickHandler) aInvocation.getArguments()[0];\n                return null;\n            }\n        });\n\n        presenter.getMenus(menus -> {\n            final MenuCustom refresh = (MenuCustom) menus.getItems().get(1);\n            refresh.build();\n\n            clickHandler.onClick(new ClickEvent() {\n            });\n\n            verify(refreshEvents).fire(any(M2RepoRefreshEvent.class));\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/editor/MavenRepositoryPagedJarTableTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.editor;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.m2repo.client.widgets.ArtifactListPresenter;\nimport org.guvnor.m2repo.client.widgets.ArtifactListView;\nimport org.guvnor.m2repo.security.MavenRepositoryPagedJarTableFeatures;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MavenRepositoryPagedJarTableTest {\n\n    @Mock\n    private ArtifactListPresenter presenter;\n\n    @Mock\n    private ArtifactListView view;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private User identity;\n\n    private MavenRepositoryPagedJarTable table;\n\n    @Before\n    public void setup() {\n        when(presenter.getView()).thenReturn(view);\n\n        final MavenRepositoryPagedJarTable wrapped = new MavenRepositoryPagedJarTable(presenter,\n                                                                                      authorizationManager,\n                                                                                      identity);\n        table = spy(wrapped);\n    }\n\n    @Test\n    public void downloadJARButtonIncludedWhenUserHasPermission() {\n        when(authorizationManager.authorize(eq(MavenRepositoryPagedJarTableFeatures.JAR_DOWNLOAD),\n                                            eq(identity))).thenReturn(true);\n\n        table.init();\n\n        verify(table,\n               times(1)).addDownloadJARButton();\n    }\n\n    @Test\n    public void downloadJARButtonExcludedWhenUserLacksPermission() {\n        when(authorizationManager.authorize(eq(MavenRepositoryPagedJarTableFeatures.JAR_DOWNLOAD),\n                                            eq(identity))).thenReturn(false);\n\n        table.init();\n\n        verify(table,\n               never()).addDownloadJARButton();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/upload/UploadFormTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.m2repo.client.upload;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.m2repo.client.event.M2RepoSearchEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHideEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHideHandler;\nimport org.gwtbootstrap3.client.ui.base.form.AbstractForm;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_MISSING_POM;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_OK;\nimport static org.guvnor.m2repo.model.HTMLFileManagerFields.UPLOAD_UNABLE_TO_PARSE_POM;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UploadFormTest {\n\n    @Mock\n    private UploadFormView view;\n\n    @Mock\n    private Event<M2RepoSearchEvent> searchEvent;\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private AbstractForm.SubmitCompleteEvent submitCompleteEvent;\n\n    @Mock\n    private ModalHideEvent hideEvent;\n\n    @Captor\n    private ArgumentCaptor<ModalHideHandler> captor;\n\n    private UploadFormPresenter uploadFormPresenter;\n\n    @Before\n    public void before() {\n        uploadFormPresenter = new UploadFormPresenter(view,\n                                                      searchEvent,\n                                                      iocManager);\n\n        verify(view).addHideHandler(captor.capture());\n    }\n\n    @Test\n    public void emptyFilenameTest() {\n        when(view.getFileName()).thenReturn(null);\n        uploadFormPresenter.isFileNameValid();\n\n        verify(view).showSelectFileUploadWarning();\n        verify(view,\n               never()).showUploadingBusy();\n    }\n\n    @Test\n    public void nullFilenameTest() {\n        when(view.getFileName()).thenReturn(\"\");\n        uploadFormPresenter.isFileNameValid();\n\n        verify(view).showSelectFileUploadWarning();\n        verify(view,\n               never()).showUploadingBusy();\n    }\n\n    @Test\n    public void unsupportedFilenameTest() {\n        when(view.getFileName()).thenReturn(\"//!#@%^&*()\\\\23\\\\(0\");\n        uploadFormPresenter.isFileNameValid();\n\n        verify(view).showUnsupportedFileTypeWarning();\n        verify(view,\n               never()).showUploadingBusy();\n    }\n\n    @Test\n    public void correctFilenameTest() {\n        when(view.getFileName()).thenReturn(\"/home/user/something/pom.xml\");\n        uploadFormPresenter.isFileNameValid();\n\n        verify(view).showUploadingBusy();\n    }\n\n    @Test\n    public void uploadOkSubmitHandlerTest() {\n        when(submitCompleteEvent.getResults()).thenReturn(UPLOAD_OK);\n        uploadFormPresenter.handleSubmitComplete(submitCompleteEvent);\n\n        verify(view).hideUploadingBusy();\n        verify(view).hideUploadingBusy();\n        verify(view).hideGAVInputs();\n\n        verify(view).showUploadedSuccessfullyMessage();\n    }\n\n    @Test\n    public void uploadMissingPomSubmitHandlerTest() {\n        when(submitCompleteEvent.getResults()).thenReturn(UPLOAD_MISSING_POM);\n        uploadFormPresenter.handleSubmitComplete(submitCompleteEvent);\n\n        verify(view).hideUploadingBusy();\n        verify(view).showGAVInputs();\n\n        verify(view).showInvalidJarNoPomWarning();\n    }\n\n    @Test\n    public void uploadUnableToParsePomSubmitHandlerTest() {\n        when(submitCompleteEvent.getResults()).thenReturn(UPLOAD_UNABLE_TO_PARSE_POM);\n        uploadFormPresenter.handleSubmitComplete(submitCompleteEvent);\n\n        verify(view).hideUploadingBusy();\n        verify(view).hide();\n\n        verify(view).showInvalidPomWarning();\n    }\n\n    @Test\n    public void uploadUnknownErrorTest() {\n        String errorText = \"Some unknown error text.\";\n\n        when(submitCompleteEvent.getResults()).thenReturn(errorText);\n        uploadFormPresenter.handleSubmitComplete(submitCompleteEvent);\n\n        verify(view).hideUploadingBusy();\n        view.hideGAVInputs();\n        view.hide();\n\n        view.showUploadFailedError(errorText);\n    }\n\n    @Test\n    public void isViewDestroyedDuringHidingTest() {\n        ModalHideHandler hideHandler = captor.getValue();\n\n        hideHandler.onHide(hideEvent);\n\n        verify(iocManager).destroyBean(uploadFormPresenter);\n    }\n}"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/upload/UploadFormViewImplTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.upload;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.ext.widgets.common.client.common.FileUpload;\n\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UploadFormViewImplTest {\n\n    @Mock\n    private FileUpload uploader;\n\n    @Mock\n    private UploadFormViewImpl testedView;\n\n    @Before\n    public void setUp() throws Exception {\n        testedView.uploader = uploader;\n    }\n\n    @Test\n    public void testHide() {\n        doCallRealMethod().when(testedView).hide();\n\n        testedView.hide();\n\n        verify(uploader).clear();\n    }\n\n    @Test\n    public void testRemoveFromParent() {\n        doCallRealMethod().when(testedView).removeFromParent();\n\n        testedView.removeFromParent();\n\n        verify(uploader).clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-m2repo-editor/uberfire-m2repo-editor-client/src/test/java/org/guvnor/m2repo/client/widgets/ArtifactListTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.m2repo.client.widgets;\n\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport org.guvnor.m2repo.model.JarListPageRequest;\nimport org.guvnor.m2repo.model.JarListPageRow;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.ArgumentMatchers;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.paging.PageResponse;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ArtifactListTest {\n\n    private static final int REQUEST_RANGE_LENGTH = 53;\n    private static final int REQUEST_RANGE_START = 19;\n    private final boolean REQUEST_SORT_ORDER = true;\n    private final String REQUEST_SORT_COLUMN = \"C\";\n    private static final boolean RESPONSE_EXACT_ROWS = true;\n    private static final int RESPONSE_ROWS_COUNT = 61;\n    private static final String POM_TEXT = \"POM text\";\n    @Mock\n    private Event<NotificationEvent> event;\n    @Mock\n    private M2RepoService m2service;\n    @Mock\n    private PageResponse<JarListPageRow> response;\n    @Mock\n    private ArtifactListView view;\n    @Mock\n    private HasData<JarListPageRow> table;\n    @Mock\n    private Range range;\n    @Mock\n    @SuppressWarnings(\"rawtypes\")\n    private Column column;\n    @Mock\n    private ColumnSortList sortList;\n    @Mock\n    private ColumnSortList.ColumnSortInfo sortInfo;\n    @Captor\n    private ArgumentCaptor<JarListPageRequest> request;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setUp() {\n        when(m2service.listArtifacts(any(JarListPageRequest.class))).thenReturn(response);\n        when(m2service.getPomText(Mockito.anyString())).thenReturn(POM_TEXT);\n        when(response.getTotalRowSize()).thenReturn(RESPONSE_ROWS_COUNT);\n        when(response.isTotalRowSizeExact()).thenReturn(RESPONSE_EXACT_ROWS);\n\n        when(view.getDisplay()).thenReturn(table);\n        when(table.getVisibleRange()).thenReturn(range);\n        when(range.getStart()).thenReturn(REQUEST_RANGE_START);\n        when(range.getLength()).thenReturn(REQUEST_RANGE_LENGTH);\n\n        when(view.getColumnSortList()).thenReturn(sortList);\n        when(sortList.size()).thenReturn(1);\n        when(sortList.get(0)).thenReturn(sortInfo);\n        when(sortInfo.isAscending()).thenReturn(REQUEST_SORT_ORDER);\n        when(sortInfo.getColumn()).thenReturn(column); // unchecked\n        when(column.getDataStoreName()).thenReturn(REQUEST_SORT_COLUMN);\n    }\n\n    @Test\n    public void testSearch() {\n        ArtifactListPresenterImpl presenter = new ArtifactListPresenterImpl(view,\n                                                                            new CallerMock<M2RepoService>(m2service),\n                                                                            event);\n        // Disable sort info for this test\n        when(view.getColumnSortList()).thenReturn(null);\n        presenter.init();\n        ArtifactListPresenterImpl.RefreshableAsyncDataProvider dataProvider = spy(presenter.dataProvider);\n        presenter.dataProvider = dataProvider;\n\n        // Search request with filter\n        presenter.search(\"filters\");\n        verify(event).fire(any(NotificationEvent.class));\n        verify(dataProvider).addDataDisplay(ArgumentMatchers.<HasData<JarListPageRow>>any());\n        verify(dataProvider,\n               never()).goToFirstPage();\n        verify(m2service).listArtifacts(request.capture());\n        JarListPageRequest searchRequest = request.getValue();\n        verifyRequest(searchRequest,\n                      null,\n                      \"filters\",\n                      REQUEST_RANGE_LENGTH,\n                      REQUEST_RANGE_START,\n                      ArtifactListPresenterImpl.DEFAULT_ORDER_ASCENDING);\n\n        // Row data updated\n        verify(table).setRowCount(RESPONSE_ROWS_COUNT,\n                                  RESPONSE_EXACT_ROWS);\n\n        // Second search does not add the display again\n        reset(event);\n        reset(dataProvider);\n        presenter.search(\"other filters\");\n        verify(event).fire(any(NotificationEvent.class));\n        verify(dataProvider,\n               never()).addDataDisplay(ArgumentMatchers.<HasData<JarListPageRow>>any());\n        verify(dataProvider).goToFirstPage();\n    }\n\n    @Test\n    public void testNoEvent() {\n        ArtifactListPresenterImpl presenter = new ArtifactListPresenterImpl(view,\n                                                                            new CallerMock<M2RepoService>(m2service),\n                                                                            event);\n        // Disable sort info for this test\n        when(view.getColumnSortList()).thenReturn(null);\n        presenter.init();\n        ArtifactListPresenterImpl.RefreshableAsyncDataProvider dataProvider = spy(presenter.dataProvider);\n        presenter.dataProvider = dataProvider;\n\n        // Search request with filter\n        presenter.notifyOnRefresh(false);\n        presenter.search(\"filters\");\n        presenter.refresh();\n        verify(event,\n               never()).fire(any(NotificationEvent.class));\n    }\n\n    @Test\n    public void testDefaultColumns() {\n        ArtifactListPresenterImpl presenter = new ArtifactListPresenterImpl(view,\n                                                                            new CallerMock<M2RepoService>(m2service),\n                                                                            event);\n        presenter.init();\n        presenter.setup(ColumnType.GAV);\n        verify(view).setup(ColumnType.GAV);\n        presenter.getView();\n        verify(view,\n               never()).setup();\n    }\n\n    @Test\n    public void testColumnSortList() {\n        ArtifactListPresenterImpl presenter = new ArtifactListPresenterImpl(view,\n                                                                            new CallerMock<M2RepoService>(m2service),\n                                                                            event);\n        presenter.init();\n\n        // Change sort parameters and refresh\n        when(sortInfo.isAscending()).thenReturn(!REQUEST_SORT_ORDER);\n        when(column.getDataStoreName()).thenReturn(\"X\");\n        presenter.search(\"\");\n\n        // Verify request\n        verify(m2service).listArtifacts(request.capture());\n        verifyRequest(request.getValue(),\n                      \"X\",\n                      \"\",\n                      REQUEST_RANGE_LENGTH,\n                      REQUEST_RANGE_START,\n                      !REQUEST_SORT_ORDER);\n\n        // Row data updated\n        verify(table).setRowCount(RESPONSE_ROWS_COUNT,\n                                  RESPONSE_EXACT_ROWS);\n    }\n\n    @Test\n    public void testShowPom() {\n        ArtifactListPresenterImpl presenter = new ArtifactListPresenterImpl(view,\n                                                                            new CallerMock<M2RepoService>(m2service),\n                                                                            event);\n        presenter.init();\n        presenter.onOpenPom(\"\");\n        verify(view).showPom(POM_TEXT);\n    }\n\n    private static void verifyRequest(final JarListPageRequest request,\n                                      final String dataSourceName,\n                                      final String filters,\n                                      final Integer pageSize,\n                                      final int startRowIndex,\n                                      final boolean isAscending) {\n        assertEquals(dataSourceName,\n                     request.getDataSourceName());\n        assertEquals(filters,\n                     request.getFilters());\n        assertEquals(pageSize,\n                     request.getPageSize());\n        assertEquals(startRowIndex,\n                     request.getStartRowIndex());\n        assertEquals(isAscending,\n                     request.isAscending());\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-message-console/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-message-console</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Message Console</name>\n  <description>UberFire - Message Console</description>\n\n  <modules>\n    <module>uberfire-message-console-api</module>\n    <module>uberfire-message-console-backend</module>\n    <module>uberfire-message-console-client</module>\n  </modules>\n\n</project>"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-message-console</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-message-console-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Message Console API</name>\n  <description>UberFire - Message Console API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-workingset-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-services-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-structure-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/allowlist/MessageConsoleAllowList.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.allowlist;\n\npublic interface MessageConsoleAllowList {\n\n    boolean contains(String currentPerspective);\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/FilteredMessagesEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class FilteredMessagesEvent {\n\n    private List<SystemMessage> messages;\n\n    public FilteredMessagesEvent() {\n\n    }\n\n    public FilteredMessagesEvent(List<SystemMessage> messages) {\n        this.messages = messages;\n    }\n\n    public List<SystemMessage> getMessages() {\n        return messages;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/MessageUtils.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport org.guvnor.common.services.project.builder.model.BuildMessage;\n\npublic class MessageUtils {\n\n    public static final String BUILD_SYSTEM_MESSAGE = \"BuildSystem\";\n\n    public static SystemMessage convert(BuildMessage buildMessage) {\n\n        SystemMessage systemMessage = new SystemMessage();\n\n        systemMessage.setMessageType(BUILD_SYSTEM_MESSAGE);\n        systemMessage.setId(buildMessage.getId());\n        systemMessage.setLevel(buildMessage.getLevel());\n        systemMessage.setColumn(buildMessage.getColumn());\n        systemMessage.setLine(buildMessage.getLine());\n        systemMessage.setText(buildMessage.getText());\n        systemMessage.setPath(buildMessage.getPath());\n        return systemMessage;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/PublishBaseEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\npublic abstract class PublishBaseEvent {\n\n    /**\n     * If set the messagesToPublish should be published only for the given session, if null the messagesToPublish will be published in all\n     * active sessions. (sessionId and userId can be used together).\n     */\n    private String sessionId;\n\n    /**\n     * If set the messagesToPublish should be published only for the given user, if userId == null and sessionId == null the message will be\n     * published in all active sessions.\n     */\n    private String userId;\n\n    private String rootPath;\n\n    private Place place = Place.END;\n\n    private List<SystemMessage> messagesToPublish = new ArrayList<SystemMessage>();\n\n    /**\n     * If set to true, interested parties will always try to show the system errors console. If set to false\n     * it's expected that the console is already opened.\n     */\n    private boolean showSystemConsole = true;\n\n    public PublishBaseEvent() {\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public void setSessionId(String sessionId) {\n        this.sessionId = sessionId;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    public void setUserId(String userId) {\n        this.userId = userId;\n    }\n\n    public Place getPlace() {\n        return place;\n    }\n\n    public void setPlace(Place place) {\n        this.place = place;\n    }\n\n    public String getRootPath() {\n        return rootPath;\n    }\n\n    public void setRootPath(String rootPath) {\n        this.rootPath = rootPath;\n    }\n\n    public boolean isShowSystemConsole() {\n        return showSystemConsole;\n    }\n\n    public void setShowSystemConsole(boolean showSystemConsole) {\n        this.showSystemConsole = showSystemConsole;\n    }\n\n    public List<SystemMessage> getMessagesToPublish() {\n        return messagesToPublish;\n    }\n\n    public void setMessagesToPublish(List<SystemMessage> messagesToPublish) {\n        this.messagesToPublish = messagesToPublish;\n    }\n\n    @Portable\n    public static enum Place {\n        TOP,\n        END;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/PublishBatchMessagesEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PublishBatchMessagesEvent extends PublishBaseEvent {\n\n    /**\n     * If true, existing messages that full fills publication parameters will deleted prior to publication.\n     */\n    private boolean cleanExisting = false;\n\n    /**\n     * Makes sense only when clean is cleanExisting = true.\n     */\n    private String messageType;\n\n    /**\n     * List of messages to selective unpublish. This messages will allways be unpublished independent of cleanExisting value.\n     */\n    private List<SystemMessage> messagesToUnpublish = new ArrayList<SystemMessage>();\n\n    public PublishBatchMessagesEvent() {\n        //needed for marshalling.\n    }\n\n    public boolean isCleanExisting() {\n        return cleanExisting;\n    }\n\n    public void setCleanExisting(boolean cleanExisting) {\n        this.cleanExisting = cleanExisting;\n    }\n\n    public String getMessageType() {\n        return messageType;\n    }\n\n    public void setMessageType(String messageType) {\n        this.messageType = messageType;\n    }\n\n    public List<SystemMessage> getMessagesToUnpublish() {\n        return messagesToUnpublish;\n    }\n\n    public void setMessagesToUnpublish(List<SystemMessage> messagesToUnpublish) {\n        this.messagesToUnpublish = messagesToUnpublish;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/PublishMessagesEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PublishMessagesEvent extends PublishBaseEvent {\n\n    public PublishMessagesEvent() {\n        //needed for marshalling.\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/SystemMessage.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class SystemMessage {\n\n    private String userId;\n    private String messageType;\n    private long id;\n    private Level level;\n    private Path path;\n    private int line;\n    private int column;\n    private String text;\n\n    public SystemMessage() {\n        //needed for marshalling.\n    }\n\n    public String getMessageType() {\n        return messageType;\n    }\n\n    public void setMessageType(String messageType) {\n        this.messageType = messageType;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    public void setUserId(String userId) {\n        this.userId = userId;\n    }\n\n    public long getId() {\n        return id;\n    }\n\n    public void setId(long id) {\n        this.id = id;\n    }\n\n    public Level getLevel() {\n        return level;\n    }\n\n    public void setLevel(Level level) {\n        this.level = level;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    public void setPath(Path path) {\n        this.path = path;\n    }\n\n    public int getLine() {\n        return line;\n    }\n\n    public void setLine(int line) {\n        this.line = line;\n    }\n\n    public int getColumn() {\n        return column;\n    }\n\n    public void setColumn(int column) {\n        this.column = column;\n    }\n\n    public String getText() {\n        return text;\n    }\n\n    public void setText(String text) {\n        this.text = text;\n    }\n\n    /**\n     * Check whether two Messages are equivalent. Properties \"id\", and userId are not used in the comparison as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof SystemMessage)) {\n            return false;\n        }\n\n        SystemMessage that = (SystemMessage) o;\n\n        if (messageType != null ? !messageType.equals(that.messageType) : that.messageType != null) {\n            return false;\n        }\n        if (column != that.column) {\n            return false;\n        }\n        if (line != that.line) {\n            return false;\n        }\n        if (level != that.level) {\n            return false;\n        }\n        if (path != null ? !path.equals(that.path) : that.path != null) {\n            return false;\n        }\n        if (text != null ? !text.equals(that.text) : that.text != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * HashCode implementation fo Messages. Properties \"id\" and userId are not used in the generation as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public int hashCode() {\n        int result = level != null ? level.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (messageType != null ? messageType.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (path != null ? path.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + line;\n        result = ~~result;\n        result = 31 * result + column;\n        result = ~~result;\n        result = 31 * result + (text != null ? text.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/events/UnpublishMessagesEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.events;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UnpublishMessagesEvent {\n\n    /**\n     * Filter parameter to establish that messagesToUnpublish for this session should be unpublished. (if null\n     * all messagesToUnpublish will be deleted depending on userId and messageType).\n     */\n    private String sessionId;\n\n    /**\n     * Filter parameter to establish that messagesToUnpublish for this user should be unpublished.\n     */\n    private String userId;\n\n    /**\n     * Filter parameter to establish that messagesToUnpublish of this type should be unpublished.\n     */\n\n    private String rootPath;\n\n    private String messageType;\n\n    private List<SystemMessage> messagesToUnpublish = new ArrayList<SystemMessage>();\n\n    /**\n     * If set to true, interested parties will always try to show the system errors console. If set to false\n     * it's expected that the console is already opened.\n     */\n    private boolean showSystemConsole = true;\n\n    public UnpublishMessagesEvent() {\n        //needed for marshalling.\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public void setSessionId(String sessionId) {\n        this.sessionId = sessionId;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    public void setUserId(String userId) {\n        this.userId = userId;\n    }\n\n    public String getRootPath() {\n        return rootPath;\n    }\n\n    public void setRootPath(String rootPath) {\n        this.rootPath = rootPath;\n    }\n\n    public String getMessageType() {\n        return messageType;\n    }\n\n    public boolean isShowSystemConsole() {\n        return showSystemConsole;\n    }\n\n    public void setShowSystemConsole(boolean showSystemConsole) {\n        this.showSystemConsole = showSystemConsole;\n    }\n\n    public void setMessageType(String messageType) {\n        this.messageType = messageType;\n    }\n\n    public List<SystemMessage> getMessagesToUnpublish() {\n        return messagesToUnpublish;\n    }\n\n    public void setMessagesToUnpublish(List<SystemMessage> messagesToUnpublish) {\n        this.messagesToUnpublish = messagesToUnpublish;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/java/org/guvnor/messageconsole/utils/CSVConverter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.utils;\n\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CSVConverter {\n\n    public static String convertTable(final List<List<String>> table) {\n        if (table == null) {\n            return \"\";\n        }\n        return table.stream()\n                    .map(CSVConverter::convertRow)\n                    .collect(Collectors.joining(\"\\n\"))\n                    .toString();\n    }\n\n    private static String convertRow(final List<String> row) {\n        return row.stream()\n                   .map(CSVConverter::convertValue)\n                   .collect(Collectors.joining(\",\"));\n    }\n\n    private static String convertValue(final String value) {\n        return quote(escape(value));\n    }\n\n    private static String escape(final String value) {\n        return value.replaceAll(\"\\n\", \"\")\n                    .replaceAll(\"\\\"\", \"\\\"\\\"\");\n    }\n\n    private static String quote(final String value) {\n        return \"\\\"\" + value + \"\\\"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/main/resources/org/guvnor/messageconsole/GuvnorMessageConsoleAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n\n  <source path=\"events\" />\n  <source path=\"allowlist\" />\n  <source path=\"utils\" />\n\n</module>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-api/src/test/java/org/guvnor/messageconsole/utils/CSVConverterTest.java",
    "content": "package org.guvnor.messageconsole.utils;\n\nimport static org.junit.Assert.assertTrue;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.Test;\n\npublic class CSVConverterTest {\n\n    @Test\n    public void testNull() {\n        String csv = CSVConverter.convertTable(null);\n        assertTrue(csv.equals(\"\"));\n    }\n\n    @Test\n    public void testEmpty() {\n        List<List<String>> table = new ArrayList<>();\n\n        String csv = CSVConverter.convertTable(table);\n        assertTrue(csv.equals(\"\"));\n    }\n\n    @Test\n    public void testSimpleCSV() {\n        List<List<String>> table = new ArrayList<>();\n        table.add(Arrays.asList(\"NAME\", \"AGE\", \"CITY\"));\n        table.add(Arrays.asList(\"John\", \"32\", \"Paris\"));\n        table.add(Arrays.asList(\"Paul\", \"41\", \"New York\"));\n        table.add(Arrays.asList(\"Mary\", \"34\", \"Santiago\"));\n\n        String csv = CSVConverter.convertTable(table);\n        assertTrue(csv.equals(\"\\\"NAME\\\",\\\"AGE\\\",\\\"CITY\\\"\\n\" +\n                              \"\\\"John\\\",\\\"32\\\",\\\"Paris\\\"\\n\" +\n                              \"\\\"Paul\\\",\\\"41\\\",\\\"New York\\\"\\n\" +\n                              \"\\\"Mary\\\",\\\"34\\\",\\\"Santiago\\\"\"));\n    }\n\n    @Test\n    public void testComplexCSV() {\n        List<List<String>> table = new ArrayList<>();\n        table.add(Arrays.asList(\"NAME\", \"AGE\", \"CITY\"));\n        table.add(Arrays.asList(\"John\", \"32\", \"Paris\"));\n        table.add(Arrays.asList());\n        table.add(Arrays.asList(\"Peter\", \"\", \"New York, São Paulo\"));\n        table.add(Arrays.asList(\"Mary \\\"Rose\\\" O'Brien\", \"34\", \"Santiago\"));\n        table.add(Arrays.asList(\"\"));\n        table.add(Arrays.asList(\"SILVA, A. G., SOUZA, B. R.\", \"29\", \"Recife\", \"Brazil\"));\n\n        String csv = CSVConverter.convertTable(table);\n        assertTrue(csv.equals(\"\\\"NAME\\\",\\\"AGE\\\",\\\"CITY\\\"\\n\" +\n                              \"\\\"John\\\",\\\"32\\\",\\\"Paris\\\"\\n\" +\n                              \"\\n\" +\n                              \"\\\"Peter\\\",\\\"\\\",\\\"New York, São Paulo\\\"\\n\" +\n                              \"\\\"Mary \\\"\\\"Rose\\\"\\\" O'Brien\\\",\\\"34\\\",\\\"Santiago\\\"\\n\" +\n                              \"\\\"\\\"\\n\" +\n                              \"\\\"SILVA, A. G., SOUZA, B. R.\\\",\\\"29\\\",\\\"Recife\\\",\\\"Brazil\\\"\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-message-console</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-message-console-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Message Console Backend</name>\n  <description>UberFire - Message Console Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-message-console-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n\n</project>"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/src/main/java/org/guvnor/messageconsole/backend/BuildResultsObserver.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.backend;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.builder.model.BuildMessage;\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.messageconsole.events.MessageUtils;\nimport org.guvnor.messageconsole.events.PublishBatchMessagesEvent;\n\n/**\n * Observer component translates BuildResult and IncrementalBuildResults messages to messages that can be printed\n * on the Message Console.\n */\n@ApplicationScoped\npublic class BuildResultsObserver {\n\n    @Inject\n    private Event<PublishBatchMessagesEvent> publishBatchMessagesEvent;\n\n    public void addBuildMessages(final @Observes BuildResults results) {\n\n        PublishBatchMessagesEvent batchMessages = new PublishBatchMessagesEvent();\n        batchMessages.setCleanExisting(true);\n        batchMessages.setMessageType(MessageUtils.BUILD_SYSTEM_MESSAGE);\n        batchMessages.setRootPath(results.getRootPathURI());\n        if (results.getMessages() != null) {\n            for (BuildMessage buildMessage : results.getMessages()) {\n                batchMessages.getMessagesToPublish().add(MessageUtils.convert(buildMessage));\n            }\n        }\n\n        publishBatchMessagesEvent.fire(batchMessages);\n    }\n\n    public void addIncrementalBuildMessages(final @Observes IncrementalBuildResults results) {\n\n        PublishBatchMessagesEvent batchMessages = new PublishBatchMessagesEvent();\n        batchMessages.setMessageType(MessageUtils.BUILD_SYSTEM_MESSAGE);\n        batchMessages.setRootPath(results.getRootPathURI());\n        if (results.getAddedMessages() != null) {\n            for (BuildMessage buildMessage : results.getAddedMessages()) {\n                batchMessages.getMessagesToPublish().add(MessageUtils.convert(buildMessage));\n            }\n        }\n\n        if (results.getRemovedMessages() != null) {\n            for (BuildMessage buildMessage : results.getRemovedMessages()) {\n                batchMessages.getMessagesToUnpublish().add(MessageUtils.convert(buildMessage));\n            }\n        }\n\n        publishBatchMessagesEvent.fire(batchMessages);\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/src/main/java/org/guvnor/messageconsole/backend/DefaultIndexEngineObserver.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.backend;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.guvnor.messageconsole.events.PublishMessagesEvent;\nimport org.guvnor.messageconsole.events.SystemMessage;\nimport org.uberfire.ext.metadata.engine.Observer;\n\n/**\n * Observer component translates Index activities into Message Console entries\n */\n@ApplicationScoped\npublic class DefaultIndexEngineObserver implements Observer {\n\n    @Inject\n    private Event<PublishMessagesEvent> publishMessagesEvent;\n\n    public void information(final String message) {\n        publishMessagesEvent.fire(makeEvent(message,\n                                            Level.INFO));\n    }\n\n    @Override\n    public void warning(final String message) {\n        publishMessagesEvent.fire(makeEvent(message,\n                                            Level.WARNING));\n    }\n\n    @Override\n    public void error(final String message) {\n        publishMessagesEvent.fire(makeEvent(message,\n                                            Level.ERROR));\n    }\n\n    private PublishMessagesEvent makeEvent(final String text,\n                                           final Level level) {\n        final PublishMessagesEvent event = new PublishMessagesEvent();\n        final List<SystemMessage> messages = new ArrayList<SystemMessage>();\n        final SystemMessage message = new SystemMessage();\n        message.setLevel(level);\n        message.setText(text);\n        messages.add(message);\n        event.setMessagesToPublish(messages);\n        return event;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-message-console</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-message-console-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Message Console Client</name>\n  <description>UberFire - Message Console Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-message-console-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/AlertsEntryPoint.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/AlertsConstants.properties\")\npublic class AlertsEntryPoint {\n\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/HyperLinkCell.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.messageconsole.client.console;\n\nimport com.google.gwt.cell.client.AbstractCell;\nimport com.google.gwt.cell.client.ValueUpdater;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.NativeEvent;\nimport com.google.gwt.safehtml.client.SafeHtmlTemplates;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.text.shared.SafeHtmlRenderer;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\nimport static com.google.gwt.dom.client.BrowserEvents.CLICK;\nimport static com.google.gwt.dom.client.BrowserEvents.KEYDOWN;\n\npublic class HyperLinkCell extends AbstractCell<HyperLinkCell.HyperLink> {\n\n    interface HyperLinkTemplate extends SafeHtmlTemplates {\n\n        @Template(\"<a title=\\\"{1}\\\" href=\\\"#\\\">{0}</a>\")\n        SafeHtml hyperLink(final SafeHtml label,\n                           final String title);\n    }\n\n    interface TextTemplate extends SafeHtmlTemplates {\n\n        @Template(\"<span title=\\\"{1}\\\">{0}</span>\")\n        SafeHtml text(final String label,\n                      final String title);\n    }\n\n    /**\n     * Inner class to contain the Hyper Link details\n     */\n    public static class HyperLink {\n\n        private String label;\n        private boolean isLink;\n\n        public static HyperLink newLink(final String label) {\n            return new HyperLink(label,\n                                 true);\n        }\n\n        public static HyperLink newText(final String label) {\n            return new HyperLink(label,\n                                 false);\n        }\n\n        private HyperLink(final String label,\n                          final boolean isLink) {\n            this.label = PortablePreconditions.checkNotNull(\"label\",\n                                                            label);\n            this.isLink = PortablePreconditions.checkNotNull(\"isLink\",\n                                                             isLink);\n        }\n\n        public String getLabel() {\n            return label;\n        }\n\n        public boolean isLink() {\n            return isLink;\n        }\n    }\n\n    private static HyperLinkTemplate hyperLinkTemplate = GWT.create(HyperLinkTemplate.class);\n    private static TextTemplate textTemplate = GWT.create(TextTemplate.class);\n\n    /**\n     * Construct a new HyperLinkCell that will use a given\n     * {@link SafeHtmlRenderer}.\n     */\n    public HyperLinkCell() {\n        super(CLICK,\n              KEYDOWN);\n    }\n\n    @Override\n    public void onBrowserEvent(final Context context,\n                               final Element parent,\n                               final HyperLink value,\n                               final NativeEvent event,\n                               final ValueUpdater<HyperLink> valueUpdater) {\n        super.onBrowserEvent(context,\n                             parent,\n                             value,\n                             event,\n                             valueUpdater);\n        if (CLICK.equals(event.getType())) {\n            onEnterKeyDown(context,\n                           parent,\n                           value,\n                           event,\n                           valueUpdater);\n        }\n    }\n\n    @Override\n    protected void onEnterKeyDown(final Context context,\n                                  final Element parent,\n                                  final HyperLink value,\n                                  final NativeEvent event,\n                                  final ValueUpdater<HyperLink> valueUpdater) {\n        final Element element = event.getEventTarget().cast();\n        if (!parent.getFirstChildElement().equals(element)) {\n            return;\n        }\n        event.preventDefault();\n        event.stopPropagation();\n        if (valueUpdater != null) {\n            valueUpdater.update(value);\n        }\n    }\n\n    @Override\n    public void render(final Context context,\n                       final HyperLink value,\n                       final SafeHtmlBuilder sb) {\n        if (value != null) {\n            if (value.isLink()) {\n                sb.append(hyperLinkTemplate.hyperLink(SafeHtmlUtils.fromString(value.getLabel()),\n                                                      value.getLabel()));\n            } else {\n                sb.append(textTemplate.text(value.getLabel(),\n                                            value.getLabel()));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleScreen.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.guvnor.common.services.project.builder.model.BuildMessage;\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.messageconsole.client.console.resources.MessageConsoleResources;\nimport org.guvnor.messageconsole.events.FilteredMessagesEvent;\nimport org.guvnor.messageconsole.events.MessageUtils;\nimport org.guvnor.messageconsole.events.PublishBatchMessagesEvent;\nimport org.guvnor.messageconsole.events.SystemMessage;\nimport org.guvnor.messageconsole.utils.CSVConverter;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.ext.widgets.common.client.callbacks.HasBusyIndicatorDefaultErrorCallback;\nimport org.uberfire.ext.widgets.common.client.menu.RefreshMenuBuilder;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@ApplicationScoped\n//The identifier has been preserved from kie-wb-common so existing .niogit System repositories are not broken\n@WorkbenchScreen(identifier = MessageConsoleScreen.ALERTS)\npublic class MessageConsoleScreen implements RefreshMenuBuilder.SupportsRefresh {\n\n    public static final String ALERTS = \"org.kie.workbench.common.screens.messageconsole.MessageConsole\";\n\n    private Caller<BuildService> buildService;\n    private Event<PublishBatchMessagesEvent> publishBatchMessagesEvent;\n    private MessageConsoleViewImpl view;\n    private Event<NotificationEvent> workbenchNotification;\n    private Module module;\n    private Menus menus;\n    private List<SystemMessage> messages;\n\n    public MessageConsoleScreen() {\n\n    }\n\n    @Inject\n    public MessageConsoleScreen(final Caller<BuildService> buildService,\n                                final Event<PublishBatchMessagesEvent> publishBatchMessagesEvent,\n                                final MessageConsoleViewImpl view,\n                                final Event<NotificationEvent> workbenchNotification) {\n\n        this.buildService = buildService;\n        this.publishBatchMessagesEvent = publishBatchMessagesEvent;\n        this.view = view;\n        this.workbenchNotification = workbenchNotification;\n\n        makeMenuBar();\n    }\n\n    public void onFilteredMessagesEvent(final @Observes FilteredMessagesEvent filteredMessagesEvent) {\n        messages = filteredMessagesEvent.getMessages();\n    }\n\n    @Override\n    public void onRefresh() {\n        view.showBusyIndicator(MessageConsoleResources.CONSTANTS.Refreshing());\n        buildService.call(new RemoteCallback<BuildResults>() {\n            @Override\n            public void callback(final BuildResults results) {\n                PublishBatchMessagesEvent batchMessages = new PublishBatchMessagesEvent();\n                batchMessages.setCleanExisting(true);\n                batchMessages.setMessageType(MessageUtils.BUILD_SYSTEM_MESSAGE);\n                if (results.getMessages() != null) {\n                    for (BuildMessage buildMessage : results.getMessages()) {\n                        batchMessages.getMessagesToPublish().add(MessageUtils.convert(buildMessage));\n                    }\n                }\n                publishBatchMessagesEvent.fire(batchMessages);\n                view.hideBusyIndicator();\n            }\n        }, new HasBusyIndicatorDefaultErrorCallback(view)).build(module);\n    }\n\n    private void makeMenuBar() {\n        menus = MenuFactory\n                .newTopLevelMenu(MessageConsoleResources.CONSTANTS.ClearMessageConsole())\n                .respondsWith(() -> {\n                    PublishBatchMessagesEvent batchMessages = new PublishBatchMessagesEvent();\n                    batchMessages.setCleanExisting(true);\n                    batchMessages.setMessagesToPublish(new ArrayList<>());\n                    publishBatchMessagesEvent.fire(batchMessages);\n                })\n                .endMenu()\n                .newTopLevelMenu(MessageConsoleResources.CONSTANTS.CopyMessageConsole())\n                .respondsWith(() -> {\n                    copyMessages();\n                })\n                .endMenu()\n                .newTopLevelCustomMenu(new RefreshMenuBuilder(this))\n                .endMenu()\n                .build();\n    }\n\n    public void copyMessages() {\n        List<List<String>> table = new ArrayList<>();\n        table.add(Arrays.asList(\"Level\", \"Text\", \"File\", \"Column\", \"Line\"));\n\n        if (messages != null) {\n            messages.forEach(m -> {\n                String level = m.getLevel() != null ? m.getLevel().name() : \"\";\n                String text = m.getText();\n                String file = m.getPath() != null ? m.getPath().getFileName() : \"\";\n                String column = Integer.toString(m.getColumn());\n                String line = Integer.toString(m.getLine());\n                table.add(Arrays.asList(level, text, file, column, line));\n            });\n        }\n\n        String csv = CSVConverter.convertTable(table);\n    boolean ok = view.copyMessages(csv);\n\n    if (ok) {\n        workbenchNotification.fire(\n            new NotificationEvent(MessageConsoleResources.CONSTANTS.MessagesCopiedToClipboard(),\n                      NotificationEvent.NotificationType.INFO));\n    } else {\n        workbenchNotification.fire(\n           new NotificationEvent(MessageConsoleResources.CONSTANTS.MessagesNotCopiedToClipboard(),\n                     NotificationEvent.NotificationType.ERROR));\n    }\n    }\n\n    public void selectedProjectChanged(@Observes final WorkspaceProjectContextChangeEvent event) {\n        this.module = event.getModule();\n        this.menus.getItems().get(0).setEnabled(module != null);\n    }\n\n    @DefaultPosition\n    public Position getDefaultPosition() {\n        return CompassPosition.SOUTH;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return view.getTitle();\n    }\n\n    @WorkbenchPartView\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menus);\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleService.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console;\n\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.ListDataProvider;\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.messageconsole.events.*;\nimport org.guvnor.messageconsole.allowlist.MessageConsoleAllowList;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.rpc.SessionInfo;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\n/**\n * Service for Message Console, the Console is a screen that shows compile time errors.\n * This listens to Messages and if the Console is not open it opens it.\n */\n@ApplicationScoped\npublic class MessageConsoleService {\n\n    private SyncBeanManager iocManager;\n    private PlaceManager placeManager;\n    private SessionInfo sessionInfo;\n    private User identity;\n    private WorkspaceProjectContext workspaceProjectContext;\n    private Event<FilteredMessagesEvent> filteredMessagesEvent;\n\n    private ListDataProvider<MessageConsoleServiceRow> dataProvider = new ListDataProvider<MessageConsoleServiceRow>();\n\n    //The identifier has been preserved from kie-wb-common so existing .niogit System repositories are not broken\n    private static final String MESSAGE_CONSOLE = \"org.kie.workbench.common.screens.messageconsole.MessageConsole\";\n\n    private String currentPerspective;\n\n    public MessageConsoleService() {\n        //CDI proxy\n    }\n\n    @Inject\n    public MessageConsoleService(final SyncBeanManager iocManager,\n                                 final PlaceManager placeManager,\n                                 final SessionInfo sessionInfo,\n                                 final User identity,\n                                 final WorkspaceProjectContext workspaceProjectContext,\n                                 final Event<FilteredMessagesEvent> filteredMessagesEvent) {\n\n        this.iocManager = iocManager;\n        this.placeManager = placeManager;\n        this.sessionInfo = sessionInfo;\n        this.identity = identity;\n        this.workspaceProjectContext = workspaceProjectContext;\n        this.filteredMessagesEvent = filteredMessagesEvent;\n    }\n\n    public void publishMessages(final @Observes PublishMessagesEvent publishEvent) {\n        publishMessages(publishEvent.getSessionId(),\n                publishEvent.getUserId(),\n                publishEvent.getRootPath(),\n                publishEvent.getPlace(),\n                publishEvent.getMessagesToPublish());\n        if (publishEvent.isShowSystemConsole() && checkAllowList()) {\n            placeManager.goTo(MESSAGE_CONSOLE);\n        }\n        fireFilteredMessagesEvent();\n    }\n\n    public void unpublishMessages(final @Observes UnpublishMessagesEvent unpublishEvent) {\n        unpublishMessages(unpublishEvent.getSessionId(),\n                unpublishEvent.getUserId(),\n                unpublishEvent.getRootPath(),\n                unpublishEvent.getMessageType(),\n                unpublishEvent.getMessagesToUnpublish());\n        if (unpublishEvent.isShowSystemConsole() && checkAllowList()) {\n            placeManager.goTo(MESSAGE_CONSOLE);\n        }\n        fireFilteredMessagesEvent();\n    }\n\n    public void publishBatchMessages(final @Observes PublishBatchMessagesEvent publishBatchEvent) {\n        if (publishBatchEvent.isCleanExisting()) {\n            unpublishMessages(publishBatchEvent.getSessionId(),\n                    publishBatchEvent.getUserId(),\n                    publishBatchEvent.getRootPath(),\n                    publishBatchEvent.getMessageType(),\n                    publishBatchEvent.getMessagesToUnpublish());\n        } else {\n            //only remove provided messages\n            removeRowsByMessage(publishBatchEvent.getMessagesToUnpublish());\n        }\n        publishMessages(publishBatchEvent.getSessionId(),\n                publishBatchEvent.getUserId(),\n                publishBatchEvent.getRootPath(),\n                publishBatchEvent.getPlace(),\n                publishBatchEvent.getMessagesToPublish());\n        if (publishBatchEvent.isShowSystemConsole() && checkAllowList()) {\n            placeManager.goTo(MESSAGE_CONSOLE);\n        }\n        fireFilteredMessagesEvent();\n    }\n\n    private void fireFilteredMessagesEvent() {\n        filteredMessagesEvent.fire(new FilteredMessagesEvent(dataProvider.getList()\n                .stream()\n                .map(m -> m.getMessage())\n                .collect(Collectors.toList())));\n    }\n\n    public void addDataDisplay(final HasData<MessageConsoleServiceRow> display) {\n        dataProvider.addDataDisplay(display);\n        fireFilteredMessagesEvent();\n    }\n\n    public void onPerspectiveChange(final @Observes PerspectiveChange perspectiveChange) {\n        currentPerspective = perspectiveChange.getIdentifier();\n    }\n\n    private void publishMessages(final String sessionId,\n                                 final String userId,\n                                 final String rootPath,\n                                 final PublishMessagesEvent.Place place,\n                                 final List<SystemMessage> messages) {\n        List<MessageConsoleServiceRow> list = dataProvider.getList();\n        List<SystemMessage> newMessages = filterMessages(sessionId,\n                userId,\n                rootPath,\n                null,\n                messages);\n        List<MessageConsoleServiceRow> newRows = new ArrayList<MessageConsoleServiceRow>();\n\n        int index = (place != null && place == PublishMessagesEvent.Place.TOP) ? 0 : (list != null && list.size() > 0 ? list.size() : 0);\n\n        for (SystemMessage systemMessage : newMessages) {\n            newRows.add(new MessageConsoleServiceRow(sessionId,\n                    userId,\n                    systemMessage));\n        }\n\n        list.addAll(index,\n                newRows);\n        list.sort(MessageConsoleServiceRow.DESC_ORDER);\n    }\n\n    private void unpublishMessages(final String sessionId,\n                                   final String userId,\n                                   final String rootPath,\n                                   final String messageType,\n                                   final List<SystemMessage> messages) {\n\n        String currentSessionId = sessionInfo != null ? sessionInfo.getId() : null;\n        String currentUserId = identity != null ? identity.getIdentifier() : null;\n\n        List<MessageConsoleServiceRow> rowsToDelete = new ArrayList<MessageConsoleServiceRow>();\n        for (MessageConsoleServiceRow row : dataProvider.getList()) {\n\n            if (rootPath != null) {\n                // messages for a specific project and branch\n                Optional<Module> module = workspaceProjectContext.getActiveModule();\n                if (module.isPresent() && rootPath.equals(module.get().getRootPath().toURI()) && (messageType == null || messageType.equals(row.getMessageType()))) {\n                    rowsToDelete.add(row);\n                }\n            } else if (sessionId == null && userId == null) {\n                //delete messages for all users and sessions\n                if (messageType == null || messageType.equals(row.getMessageType())) {\n                    rowsToDelete.add(row);\n                }\n            } else if (sessionId != null) {\n                //messages for a given session, no matter what the user have, sessions are unique.\n                if (sessionId.equals(currentSessionId) && (messageType == null || messageType.equals(row.getMessageType()))) {\n                    rowsToDelete.add(row);\n                }\n            } else {\n                //messages for a user.\n                if (userId.equals(currentUserId) && (messageType == null || messageType.equals(row.getMessageType()))) {\n                    rowsToDelete.add(row);\n                }\n            }\n        }\n\n        dataProvider.getList().removeAll(rowsToDelete);\n        removeRowsByMessage(messages);\n    }\n\n    private void removeRowsByMessage(final List<SystemMessage> messages) {\n        List<MessageConsoleServiceRow> rowsToDelete = new ArrayList<MessageConsoleServiceRow>();\n        if (messages != null) {\n            for (MessageConsoleServiceRow row : dataProvider.getList()) {\n                if (messages.contains(row.getMessage())) {\n                    rowsToDelete.add(row);\n                }\n            }\n            dataProvider.getList().removeAll(rowsToDelete);\n        }\n    }\n\n    private List<SystemMessage> filterMessages(final String sessionId,\n                                               final String userId,\n                                               final String rootPath,\n                                               final String messageType,\n                                               final List<SystemMessage> messages) {\n        List<SystemMessage> result = new ArrayList<SystemMessage>();\n\n        String currentSessionId = sessionInfo != null ? sessionInfo.getId() : null;\n        String currentUserId = identity != null ? identity.getIdentifier() : null;\n\n        if (messages != null) {\n            for (SystemMessage message : messages) {\n                if (rootPath != null) {\n                    // messages for a specific project and branch\n                    Optional<Module> module = workspaceProjectContext.getActiveModule();\n                    if (module.isPresent() && rootPath.equals(module.get().getRootPath().toURI())) {\n                        result.add(message);\n                    }\n                } else if (sessionId == null && userId == null) {\n                    //messages for all users, all sessions.\n                    if (messageType == null || messageType.equals(message.getMessageType())) {\n                        result.add(message);\n                    }\n                } else if (sessionId != null) {\n                    //messages for a given session, no matter what the user have, sessions are unique.\n                    if (sessionId.equals(currentSessionId) && (messageType == null || messageType.equals(message.getMessageType()))) {\n                        result.add(message);\n                    }\n                } else {\n                    //messages for a user.\n                    if (userId.equals(currentUserId) && (messageType == null || messageType.equals(message.getMessageType()))) {\n                        result.add(message);\n                    }\n                }\n            }\n        }\n        return result;\n    }\n\n    private boolean checkAllowList() {\n\n        // I herd you like lists so I put a list into your list\n        Collection<SyncBeanDef<MessageConsoleAllowList>> allowLists = getAvailableAllowLists();\n\n        if (allowLists.isEmpty()) {\n            return true;\n        } else {\n            return reLookupBean(allowLists.iterator().next()).getInstance().contains(currentPerspective);\n        }\n    }\n\n    private SyncBeanDef<MessageConsoleAllowList> reLookupBean(SyncBeanDef<MessageConsoleAllowList> baseBean) {\n        return (SyncBeanDef<MessageConsoleAllowList>) iocManager.lookupBean(baseBean.getBeanClass());\n    }\n\n    private Collection<SyncBeanDef<MessageConsoleAllowList>> getAvailableAllowLists() {\n        return iocManager.lookupBeans(MessageConsoleAllowList.class);\n    }\n\n    //This is required for Unit Testing\n    ListDataProvider<MessageConsoleServiceRow> getDataProvider() {\n        return dataProvider;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleServiceRow.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console;\n\nimport java.util.Comparator;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.guvnor.messageconsole.events.SystemMessage;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.paging.AbstractPageRow;\n\npublic class MessageConsoleServiceRow extends AbstractPageRow {\n\n    private static int COUNTER = 0;\n\n    private final long sequence;\n\n    private String sessionId;\n\n    private String userId;\n\n    private SystemMessage message;\n\n    static final Comparator<MessageConsoleServiceRow> NATURAL_ORDER = Comparator.comparingLong(row -> row.sequence);\n\n    static final Comparator<MessageConsoleServiceRow> DESC_ORDER = NATURAL_ORDER.reversed();\n\n    public MessageConsoleServiceRow(String sessionId,\n                                    String userId,\n                                    SystemMessage message) {\n        this.sessionId = sessionId;\n        this.userId = userId;\n        this.message = message;\n        this.sequence = COUNTER++;\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public void setSessionId(String sessionId) {\n        this.sessionId = sessionId;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    public void setUserId(String userId) {\n        this.userId = userId;\n    }\n\n    public SystemMessage getMessage() {\n        return message;\n    }\n\n    public void setMessage(SystemMessage message) {\n        this.message = message;\n    }\n\n    public String getMessageType() {\n        return getMessage() != null ? getMessage().getMessageType() : null;\n    }\n\n    public String getMessageUserId() {\n        return getMessage() != null ? getMessage().getUserId() : null;\n    }\n\n    public long getMessageId() {\n        return getMessage() != null ? getMessage().getId() : -1;\n    }\n\n    public Level getMessageLevel() {\n        return getMessage() != null ? getMessage().getLevel() : null;\n    }\n\n    public Path getMessagePath() {\n        return getMessage() != null ? getMessage().getPath() : null;\n    }\n\n    public int getMessageLine() {\n        return getMessage() != null ? getMessage().getLine() : 0;\n    }\n\n    public int getMessageColumn() {\n        return getMessage() != null ? getMessage().getColumn() : 0;\n    }\n\n    public String getMessageText() {\n        return getMessage() != null ? getMessage().getText() : null;\n    }\n\n    //This is required for Unit Testing\n    static void resetSequence() {\n        COUNTER = 0;\n    }\n\n    //This is required for Unit Testing\n    long getSequence() {\n        return sequence;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleView.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n */\npackage org.guvnor.messageconsole.client.console;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.ext.widgets.common.client.common.HasBusyIndicator;\n\npublic interface MessageConsoleView extends IsWidget,\n                                            HasBusyIndicator {\n\n    boolean copyMessages(String msg);\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleViewImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n */\npackage org.guvnor.messageconsole.client.console;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.cell.client.FieldUpdater;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.TextArea;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.guvnor.messageconsole.client.console.resources.MessageConsoleResources;\nimport org.guvnor.messageconsole.client.console.resources.i18n.AlertsConstants;\nimport org.guvnor.messageconsole.client.console.widget.MessageTableWidget;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.client.util.Clipboard;\n\n@ApplicationScoped\npublic class MessageConsoleViewImpl extends Composite implements MessageConsoleView {\n\n    interface MessageConsoleViewImplWidgetBinder extends\n                                                 UiBinder<Widget, MessageConsoleViewImpl> {\n\n    }\n\n    private MessageConsoleViewImplWidgetBinder uiBinder = GWT.create(MessageConsoleViewImplWidgetBinder.class);\n\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    private MessageConsoleService consoleService;\n\n    @Inject\n    private TranslationService translationService;\n\n    @Inject\n    private Clipboard clipboard;\n\n    @UiField\n    protected TextArea msgArea;\n\n    @UiField(provided = true)\n    protected final MessageTableWidget<MessageConsoleServiceRow> dataGrid = new MessageTableWidget<>();\n\n    public MessageConsoleViewImpl() {\n        dataGrid.setToolBarVisible(false);\n        dataGrid.addLevelColumn(75,\n                                new MessageTableWidget.ColumnExtractor<Level>() {\n                                    @Override\n                                    public Level getValue(final Object row) {\n                                        return ((MessageConsoleServiceRow) row).getMessageLevel();\n                                    }\n                                });\n        dataGrid.addTextColumn(100,\n                               new MessageTableWidget.ColumnExtractor<String>() {\n                                   @Override\n                                   public String getValue(final Object row) {\n                                       return ((MessageConsoleServiceRow) row).getMessageText();\n                                   }\n                               });\n\n        addFileNameColumn();\n        addColumnColumn();\n        addLineColumn();\n\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @PostConstruct\n    public void setupDataDisplay() {\n        consoleService.addDataDisplay(dataGrid);\n        dataGrid.setColumnPickerButtonVisible(false);\n    }\n\n    private void addLineColumn() {\n        final Column<MessageConsoleServiceRow, ?> lineColumn = new Column<MessageConsoleServiceRow, String>(new TextCell()) {\n            @Override\n            public String getValue(MessageConsoleServiceRow row) {\n                return row != null ? Integer.toString(row.getMessageLine()) : null;\n            }\n        };\n        dataGrid.addColumn(lineColumn,\n                           MessageConsoleResources.CONSTANTS.Line());\n        dataGrid.setColumnWidth(lineColumn,\n                                75,\n                                Style.Unit.PX);\n    }\n\n    private void addColumnColumn() {\n        Column<MessageConsoleServiceRow, ?> column = new Column<MessageConsoleServiceRow, String>(new TextCell()) {\n            @Override\n            public String getValue(MessageConsoleServiceRow row) {\n                return Integer.toString(row.getMessageColumn());\n            }\n        };\n        dataGrid.addColumn(column,\n                           MessageConsoleResources.CONSTANTS.Column());\n        dataGrid.setColumnWidth(column,\n                                75,\n                                Style.Unit.PX);\n    }\n\n    private void addFileNameColumn() {\n        final Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink> column = new Column<MessageConsoleServiceRow, HyperLinkCell.HyperLink>(new HyperLinkCell()) {\n            @Override\n            public HyperLinkCell.HyperLink getValue(MessageConsoleServiceRow row) {\n                if (row.getMessagePath() != null) {\n                    return HyperLinkCell.HyperLink.newLink(row.getMessagePath().getFileName());\n                } else {\n                    return HyperLinkCell.HyperLink.newText(\"-\");\n                }\n            }\n        };\n        column.setFieldUpdater(new FieldUpdater<MessageConsoleServiceRow, HyperLinkCell.HyperLink>() {\n            @Override\n            public void update(final int index,\n                               final MessageConsoleServiceRow row,\n                               final HyperLinkCell.HyperLink value) {\n                if (row.getMessagePath() != null) {\n                    placeManager.goTo(row.getMessagePath());\n                }\n            }\n        });\n        dataGrid.addColumn(column,\n                           MessageConsoleResources.CONSTANTS.FileName());\n        dataGrid.setColumnWidth(column,\n                                180,\n                                Style.Unit.PX);\n    }\n\n    public String getTitle() {\n        return translationService.format(AlertsConstants.Alerts);\n    }\n\n    @Override\n    public void showBusyIndicator(final String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public boolean copyMessages(String msg) {\n    msgArea.setText(msg);\n    msgArea.setFocus(true);\n    msgArea.selectAll();\n    return clipboard.copy();\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/MessageConsoleViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --><!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:uf='urn:import:org.guvnor.messageconsole.client.console.widget'\n             xmlns:g='urn:import:com.google.gwt.user.client.ui'>\n\n    <ui:style>\n        .textAreaHidden {\n            position:absolute;\n            left:-9999px;\"\n        }\n    </ui:style>\n\n    <b:Container fluid=\"true\">\n        <b:Row>\n            <b:Column size=\"MD_12\">\n                <g:TextArea  readOnly=\"true\" ui:field=\"msgArea\" addStyleNames=\"{style.textAreaHidden}\"></g:TextArea>\n                <uf:MessageTableWidget ui:field=\"dataGrid\"/>\n            </b:Column>\n        </b:Row>\n    </b:Container>\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/resources/MessageConsoleResources.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport org.guvnor.messageconsole.client.console.resources.i18n.MessageConsoleConstants;\n\npublic interface MessageConsoleResources extends ClientBundle {\n\n    MessageConsoleResources INSTANCE = GWT.create(MessageConsoleResources.class);\n\n    MessageConsoleConstants CONSTANTS = GWT.create(MessageConsoleConstants.class);\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic class AlertsConstants {\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String Alerts = \"Alerts\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String ViewAlerts = \"ViewAlerts\";\n\n    @TranslationKey(defaultValue = \"\")\n    public static final String HideAlerts = \"HideAlerts\";\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.resources.i18n;\n\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface MessageConsoleConstants extends Messages {\n\n    String Line();\n\n    String Column();\n\n    String Text();\n\n    String Level();\n\n    String FileName();\n\n    String RefreshMessageConsole();\n\n    String ClearMessageConsole();\n\n    String CopyMessageConsole();\n\n    String Refreshing();\n\n    String ErrorLevelTitle();\n\n    String WarningLevelTitle();\n\n    String InfoLevelTitle();\n\n    String MessagesCopiedToClipboard();\n\n    String MessagesNotCopiedToClipboard();\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/MessageTableWidget.java",
    "content": "package org.guvnor.messageconsole.client.console.widget;\n\nimport java.util.List;\n\nimport com.google.gwt.cell.client.AbstractCell;\nimport com.google.gwt.cell.client.Cell;\nimport com.google.gwt.cell.client.TextCell;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.safehtml.shared.SafeHtml;\nimport com.google.gwt.safehtml.shared.SafeHtmlBuilder;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.cellview.client.Column;\nimport com.google.gwt.user.cellview.client.ColumnSortList;\nimport com.google.gwt.user.cellview.client.RowStyles;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.view.client.AbstractDataProvider;\nimport com.google.gwt.view.client.CellPreviewEvent;\nimport com.google.gwt.view.client.HasData;\nimport com.google.gwt.view.client.Range;\nimport com.google.gwt.view.client.RangeChangeEvent;\nimport com.google.gwt.view.client.RowCountChangeEvent;\nimport com.google.gwt.view.client.SelectionModel;\nimport org.guvnor.common.services.shared.message.Level;\nimport org.guvnor.messageconsole.client.console.resources.MessageConsoleResources;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.uberfire.client.views.pfly.icon.PatternFlyIconType;\nimport org.uberfire.ext.widgets.common.client.tables.PagedTable;\nimport org.uberfire.ext.widgets.common.client.tables.SimpleTable;\n\npublic class MessageTableWidget<T> extends Composite implements HasData<T> {\n\n    SimpleTable<T> dataGrid;\n\n    public enum Mode {\n        SIMPLE,\n        PAGED\n    }\n\n    public interface ColumnExtractor<V> {\n\n        V getValue(Object row);\n    }\n\n    public MessageTableWidget() {\n        dataGrid = new SimpleTable<T>();\n        initWidget(dataGrid);\n    }\n\n    public MessageTableWidget(final Mode mode) {\n        if (mode == Mode.SIMPLE) {\n            dataGrid = new SimpleTable<T>();\n        } else if (mode == Mode.PAGED) {\n            dataGrid = new PagedTable<T>();\n            dataGrid.setHeight(\"165px\");\n            dataGrid.setAlwaysShowScrollBars(false);\n        }\n        initWidget(dataGrid);\n    }\n\n    public MessageTableWidget(final SimpleTable dataGrid) {\n        this.dataGrid = dataGrid;\n        initWidget(dataGrid);\n    }\n\n    public void addLevelColumn(final int px,\n                               final ColumnExtractor<Level> extractor) {\n        final Column<T, ?> column = new Column<T, Level>(new IconCell()) {\n\n            @Override\n            public Level getValue(final T row) {\n                return extractor.getValue(row);\n            }\n\n            @Override\n            public void render(Cell.Context context,\n                               T row,\n                               SafeHtmlBuilder sb) {\n                String title = getLevelTitle(extractor.getValue(row));\n                sb.append(createDivStart(title,\n                                         \"\",\n                                         \"text-center\"));\n                super.render(context,\n                             row,\n                             sb);\n                sb.append(createDivEnd());\n            }\n        };\n        dataGrid.addColumn(column,\n                           MessageConsoleResources.CONSTANTS.Level());\n        dataGrid.setColumnWidth(column,\n                                px,\n                                Style.Unit.PX);\n    }\n\n    public void addTextColumn(final int pct,\n                              final ColumnExtractor<String> extractor) {\n        Column<T, ?> column = new Column<T, String>(new TextCell()) {\n            @Override\n            public String getValue(T row) {\n                return extractor.getValue(row);\n            }\n\n            @Override\n            public void render(Cell.Context context,\n                               T row,\n                               SafeHtmlBuilder sb) {\n                String title = extractor.getValue(row);\n                sb.append(createDivStart(title));\n                super.render(context,\n                             row,\n                             sb);\n                sb.append(createDivEnd());\n            }\n        };\n        dataGrid.addColumn(column,\n                           MessageConsoleResources.CONSTANTS.Text());\n        dataGrid.setColumnWidth(column,\n                                pct,\n                                Style.Unit.PCT);\n    }\n\n    private String getLevelTitle(Level level) {\n        switch (level) {\n            case ERROR:\n                return MessageConsoleResources.CONSTANTS.ErrorLevelTitle();\n            case WARNING:\n                return MessageConsoleResources.CONSTANTS.WarningLevelTitle();\n            case INFO:\n            default:\n                return MessageConsoleResources.CONSTANTS.InfoLevelTitle();\n        }\n    }\n\n    public SafeHtml createDivStart(String title) {\n        return createDivStart(title,\n                              \"\");\n    }\n\n    public SafeHtml createDivStart(String title,\n                                   String defaultValue) {\n        return createDivStart(title,\n                              defaultValue,\n                              null);\n    }\n\n    public SafeHtml createDivStart(String title,\n                                   String defaultValue,\n                                   String cssClasses) {\n        if (title == null || \"\".equals(title)) {\n            title = defaultValue;\n        }\n\n        final String css = cssClasses == null ? \"\" : \"class=\\\"\" + cssClasses + \"\\\"\";\n        return SafeHtmlUtils.fromTrustedString(\"<div title=\\\"\" + SafeHtmlUtils.htmlEscape(title.trim()) + \"\\\" \" + css + \" >\");\n    }\n\n    public SafeHtml createDivEnd() {\n        return SafeHtmlUtils.fromTrustedString(\"</div>\");\n    }\n\n    private class IconCell extends AbstractCell<Level> {\n\n        @Override\n        public void render(Context context,\n                           Level level,\n                           SafeHtmlBuilder sb) {\n            final Span icon = GWT.create(Span.class);\n            icon.addStyleName(\"glyphicon\");\n            icon.addStyleName(getIconClass(level));\n            sb.appendHtmlConstant(icon.getElement().getString());\n        }\n\n        private String getIconClass(final Level level) {\n            switch (level) {\n                case ERROR:\n                    return PatternFlyIconType.ERROR_CIRCLE_O.getCssName();\n                case WARNING:\n                    return PatternFlyIconType.WARNING_TRIANGLE_O.getCssName();\n                case INFO:\n                default:\n                    return PatternFlyIconType.INFO.getCssName();\n            }\n        }\n    }\n\n    public void setDataProvider(final AbstractDataProvider<T> dataProvider) {\n        if (dataGrid instanceof PagedTable) {\n            ((PagedTable<T>) dataGrid).setDataProvider(dataProvider);\n        }\n    }\n\n    public final AbstractDataProvider<T> getDataProvider() {\n        if (dataGrid instanceof PagedTable) {\n            return ((PagedTable<T>) dataGrid).getDataProvider();\n        }\n        return null;\n    }\n\n    public void setToolBarVisible(final boolean visible) {\n        dataGrid.setToolBarVisible(visible);\n    }\n\n    public ColumnSortList getColumnSortList() {\n        return dataGrid.getColumnSortList();\n    }\n\n    public HasWidgets getToolbar() {\n        return dataGrid.getToolbar();\n    }\n\n    public HasWidgets getRightToolbar() {\n        return dataGrid.getRightToolbar();\n    }\n\n    public HasWidgets getRightActionsToolbar() {\n        return dataGrid.getRightActionsToolbar();\n    }\n\n    public HasWidgets getLeftToolbar() {\n        return dataGrid.getLeftToolbar();\n    }\n\n    public HasWidgets getCenterToolbar() {\n        return dataGrid.getCenterToolbar();\n    }\n\n    public void setRowStyles(final RowStyles<T> styles) {\n        dataGrid.setRowStyles(styles);\n    }\n\n    public void setColumnPickerButtonVisible(final boolean show) {\n        dataGrid.setColumnPickerButtonVisible(show);\n    }\n\n    public void addColumn(final Column<T, ?> lineColumn,\n                          final String line) {\n        dataGrid.addColumn(lineColumn,\n                           line);\n    }\n\n    public void setColumnWidth(final Column<T, ?> lineColumn,\n                               final int i,\n                               final Style.Unit pct) {\n        dataGrid.setColumnWidth(lineColumn,\n                                i,\n                                pct);\n    }\n\n    @Override\n    public void setHeight(final String height) {\n        dataGrid.setHeight(height);\n    }\n\n    @Override\n    public void setPixelSize(final int width,\n                             final int height) {\n        dataGrid.setPixelSize(width,\n                              height);\n    }\n\n    @Override\n    public void setSize(final String width,\n                        final String height) {\n        dataGrid.setSize(width,\n                         height);\n    }\n\n    @Override\n    public void setWidth(final String width) {\n        dataGrid.setWidth(width);\n    }\n\n    @Override\n    public SelectionModel<? super T> getSelectionModel() {\n        return dataGrid.getSelectionModel();\n    }\n\n    @Override\n    public T getVisibleItem(final int indexOnPage) {\n        return dataGrid.getVisibleItem(indexOnPage);\n    }\n\n    @Override\n    public int getVisibleItemCount() {\n        return dataGrid.getVisibleItemCount();\n    }\n\n    @Override\n    public Iterable<T> getVisibleItems() {\n        return dataGrid.getVisibleItems();\n    }\n\n    @Override\n    public void setRowData(final int start,\n                           final List<? extends T> values) {\n        dataGrid.setRowData(start,\n                            values);\n    }\n\n    public void setRowData(final List<? extends T> values) {\n        dataGrid.setRowData(values);\n    }\n\n    public void redraw() {\n        dataGrid.redraw();\n    }\n\n    @Override\n    public void setSelectionModel(final SelectionModel<? super T> selectionModel) {\n        dataGrid.setSelectionModel(selectionModel);\n    }\n\n    @Override\n    public void setVisibleRangeAndClearData(final Range range,\n                                            final boolean forceRangeChangeEvent) {\n        dataGrid.setVisibleRangeAndClearData(range,\n                                             forceRangeChangeEvent);\n    }\n\n    @Override\n    public HandlerRegistration addCellPreviewHandler(final CellPreviewEvent.Handler<T> handler) {\n        return dataGrid.addCellPreviewHandler(handler);\n    }\n\n    @Override\n    public HandlerRegistration addRangeChangeHandler(final RangeChangeEvent.Handler handler) {\n        return dataGrid.addRangeChangeHandler(handler);\n    }\n\n    @Override\n    public HandlerRegistration addRowCountChangeHandler(final RowCountChangeEvent.Handler handler) {\n        return dataGrid.addRowCountChangeHandler(handler);\n    }\n\n    @Override\n    public int getRowCount() {\n        return dataGrid.getRowCount();\n    }\n\n    @Override\n    public Range getVisibleRange() {\n        return dataGrid.getVisibleRange();\n    }\n\n    @Override\n    public boolean isRowCountExact() {\n        return dataGrid.isRowCountExact();\n    }\n\n    @Override\n    public void setRowCount(final int count) {\n        dataGrid.setRowCount(count);\n    }\n\n    @Override\n    public void setRowCount(final int count,\n                            final boolean isExact) {\n        dataGrid.setRowCount(count,\n                             isExact);\n    }\n\n    @Override\n    public void setVisibleRange(final int start,\n                                final int length) {\n        dataGrid.setVisibleRange(length,\n                                 length);\n    }\n\n    @Override\n    public void setVisibleRange(final Range range) {\n        dataGrid.setVisibleRange(range);\n    }\n\n    public void setToolbarVisible(final boolean visible) {\n        this.dataGrid.setToolBarVisible(visible);\n    }\n}\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/button/AlertsButtonMenuItemBuilder.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.widget.button;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\npublic class AlertsButtonMenuItemBuilder {\n\n    private ViewHideAlertsButtonPresenter viewHideAlertsButtonPresenter;\n\n    @Inject\n    public AlertsButtonMenuItemBuilder(ViewHideAlertsButtonPresenter viewHideAlertsButtonPresenter) {\n        this.viewHideAlertsButtonPresenter = viewHideAlertsButtonPresenter;\n    }\n\n    public MenuItem build() {\n        viewHideAlertsButtonPresenter.addCssClassToButtons(\"btn-sm\");\n\n        return new MenuFactory.CustomMenuBuilder() {\n            @Override\n            public void push(MenuFactory.CustomMenuBuilder element) {\n            }\n\n            @Override\n            public MenuItem build() {\n                return new BaseMenuCustom<HTMLElement>() {\n\n                    @Override\n                    public HTMLElement build() {\n                        return viewHideAlertsButtonPresenter.getView().getElement();\n                    }\n                };\n            }\n        }.build();\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/button/ViewHideAlertsButtonPresenter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.widget.button;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.guvnor.messageconsole.client.console.MessageConsoleScreen;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.PlaceStatus;\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\npublic class ViewHideAlertsButtonPresenter {\n\n    public interface View extends UberElemental<ViewHideAlertsButtonPresenter>,\n                                  IsElement {\n\n        void setAlertsActive(boolean active);\n\n        void addCssClassToButtons(String cssClass);\n    }\n\n    private PlaceManager placeManager;\n\n    private View view;\n\n    @Inject\n    public ViewHideAlertsButtonPresenter(final PlaceManager placeManager,\n                                         final View view) {\n        this.placeManager = placeManager;\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n\n        final boolean isAlertsActive = PlaceStatus.OPEN.equals(placeManager.getStatus(MessageConsoleScreen.ALERTS));\n        view.setAlertsActive(isAlertsActive);\n\n        placeManager.registerOnOpenCallback(new DefaultPlaceRequest(MessageConsoleScreen.ALERTS),\n                                            () -> view.setAlertsActive(true));\n        placeManager.registerOnCloseCallback(new DefaultPlaceRequest(MessageConsoleScreen.ALERTS),\n                                             () -> view.setAlertsActive(false));\n    }\n\n    public void addCssClassToButtons(final String cssClass) {\n        view.addCssClassToButtons(cssClass);\n    }\n\n    public void viewAlerts() {\n        placeManager.goTo(MessageConsoleScreen.ALERTS);\n    }\n\n    public void hideAlerts() {\n        placeManager.closePlace(MessageConsoleScreen.ALERTS);\n    }\n\n    public View getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/button/ViewHideAlertsButtonView.css",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.btn-group .alerts-button.btn-group {\n    margin-left: 5px;\n}\n\n.alerts-button button[hidden] {\n    display: none;\n}"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/button/ViewHideAlertsButtonView.html",
    "content": "<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"alerts-button btn-group\">\n    <button class=\"btn btn-default\" type=\"button\" id=\"view-alerts\" data-i18n-key=\"ViewAlerts\"></button>\n    <button class=\"btn btn-default\" type=\"button\" id=\"hide-alerts\" data-i18n-key=\"HideAlerts\"></button>\n</div>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/java/org/guvnor/messageconsole/client/console/widget/button/ViewHideAlertsButtonView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.widget.button;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLButtonElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class ViewHideAlertsButtonView implements ViewHideAlertsButtonPresenter.View {\n\n    private ViewHideAlertsButtonPresenter presenter;\n\n    @Inject\n    private TranslationService translationService;\n\n    @Inject\n    @DataField(\"view-alerts\")\n    private HTMLButtonElement viewAlerts;\n\n    @Inject\n    @DataField(\"hide-alerts\")\n    private HTMLButtonElement hideAlerts;\n\n    @Override\n    public void init(final ViewHideAlertsButtonPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setAlertsActive(boolean active) {\n        viewAlerts.hidden = active;\n        hideAlerts.hidden = !active;\n    }\n\n    @Override\n    public void addCssClassToButtons(final String cssClass) {\n        viewAlerts.classList.add(cssClass);\n        hideAlerts.classList.add(cssClass);\n    }\n\n    @EventHandler(\"view-alerts\")\n    public void viewAlerts(final ClickEvent event) {\n        presenter.viewAlerts();\n    }\n\n    @EventHandler(\"hide-alerts\")\n    public void hideAlerts(final ClickEvent event) {\n        presenter.hideAlerts();\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.guvnor.messageconsole.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/GuvnorMessageConsoleClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n  <inherits name='org.guvnor.messageconsole.GuvnorMessageConsoleAPI'/>\n\n  <source path=\"client\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nAlerts=Alerts\nViewAlerts=View Alerts\nHideAlerts=Hide Alerts\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants_es.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nAlerts=Alertas\nViewAlerts=Ver alertas\nHideAlerts=Ocultar alertas\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants_fr.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nAlerts=Alertes\nViewAlerts=Afficher les alertes\nHideAlerts=Masquer les alertes\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants_it.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nAlerts=Avvisi\nViewAlerts=Visualizza Avvisi\nHideAlerts=Nascondi Avvisi\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/AlertsConstants_ja.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nAlerts=警告\nViewAlerts=アラートの表示\nHideAlerts=警告の非表示\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nLine=Line\nColumn=Column\nText=Text\nLevel=Level\nFileName=File\nRefreshMessageConsole=Refresh\nRefreshing=Refreshing...\nErrorLevelTitle=Error\nWarningLevelTitle=Warning\nInfoLevelTitle=Information\nClearMessageConsole=Clear\nCopyMessageConsole=Copy\nMessagesCopiedToClipboard=Messages have been copied to clipboard.\nMessagesNotCopiedToClipboard=Messages could not be copied to clipboard.\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_de.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nLine=Zeile\nColumn=Spalte\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nText=Text\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nLevel=Ebene\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nFileName=Datei\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author jdimanos\nRefreshMessageConsole=Aktualisieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshing=Aktualisiere ...\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author jdimanos\nErrorLevelTitle=Fehler\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author jdimanos\nWarningLevelTitle=Warnung\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author jdimanos\nInfoLevelTitle=Information\nClearMessageConsole=Löschen\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_es.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nLine=Línea\nColumn=Columna\nText=Texto\nLevel=Nivel\nFileName=Archivo\nRefreshMessageConsole=Actualizar\nRefreshing=Actualizando…\nErrorLevelTitle=Error\nWarningLevelTitle=Advertencia\nInfoLevelTitle=Información\nClearMessageConsole=Borrar\nCopyMessageConsole=Copiar\nMessagesCopiedToClipboard=Los mensajes se copiaron al portapapeles.\nMessagesNotCopiedToClipboard=Los mensajes no se pudieron copiar al portapapeles.\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_fr.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nLine=Ligne\nColumn=Colonne\nText=Texte\nLevel=Niveau\nFileName=Fichier\nRefreshMessageConsole=Rafraîchir\nRefreshing=Rafraîchissement…\nErrorLevelTitle=Erreur\nWarningLevelTitle=Avertissement\nInfoLevelTitle=Informations\nClearMessageConsole=Effacer\nCopyMessageConsole=Copier\nMessagesCopiedToClipboard=Les messages ont été copiés dans le presse-papiers.\nMessagesNotCopiedToClipboard=Les messages n''ont pas pu être copiés dans le presse-papiers.\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_it.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nLine=Linea\nColumn=Colonna\nText=Testo\nLevel=Livello\nFileName=File\nRefreshMessageConsole=Aggiorna\nRefreshing=Aggiornamento in corso...\nErrorLevelTitle=Errore\nWarningLevelTitle=Avviso\nInfoLevelTitle=Informazione\nClearMessageConsole=Svuota\nCopyMessageConsole=Copia\nMessagesCopiedToClipboard=I messaggi sono stati copiati negli appunti.\nMessagesNotCopiedToClipboard=Impossibile copiare i messaggi negli appunti.\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_ja.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nLine=Line\nColumn=カラム\nText=テキスト\nLevel=レベル\nFileName=ファイル\nRefreshMessageConsole=更新\nRefreshing=リフレッシュ中...\nErrorLevelTitle=エラー\nWarningLevelTitle=警告\nInfoLevelTitle=情報\nClearMessageConsole=消去\nCopyMessageConsole=コピー\nMessagesCopiedToClipboard=メッセージが、クリップボードにコピーされました。\nMessagesNotCopiedToClipboard=メッセージをクリップボードにコピーできませんでした。\n\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_pt_BR.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nLine=Linha\nColumn=Coluna\nText=Texto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nLevel=Nível\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nFileName=Arquivo\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author ldelima@redhat.com\nRefreshMessageConsole=Atualizar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshing=Restaurando...\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author ldelima@redhat.com\nErrorLevelTitle=Erro\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author ldelima@redhat.com\nWarningLevelTitle=Aviso\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author ldelima@redhat.com\nInfoLevelTitle=Informação\nClearMessageConsole=Limpar\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/main/resources/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants_zh_CN.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nLine=行\nColumn=列\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nText=文本\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nLevel=级别\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nFileName=文件\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author xi.huang\nRefreshMessageConsole=刷新\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nRefreshing=正在刷新...\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author xi.huang\nErrorLevelTitle=错误\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author xi.huang\nWarningLevelTitle=警告\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-message-console-client/org/guvnor/messageconsole/client/console/resources/i18n/MessageConsoleConstants, author xi.huang\nInfoLevelTitle=信息\nClearMessageConsole=清除\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/test/java/org/guvnor/messageconsole/client/console/MessageConsoleServiceRowTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.messageconsole.client.console;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.IntStream;\n\nimport org.guvnor.messageconsole.events.SystemMessage;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MessageConsoleServiceRowTest {\n\n    private static final String SESSION_ID = \"sessionId\";\n\n    private static final String USER_ID = \"userId\";\n\n    private static final int ROWS = 5;\n\n    @Mock\n    private SystemMessage message;\n\n    protected List<MessageConsoleServiceRow> rows;\n\n    @Before\n    public void setup() {\n        this.rows = new ArrayList<>();\n        MessageConsoleServiceRow.resetSequence();\n        IntStream.range(0, ROWS).forEach(i -> rows.add(new MessageConsoleServiceRow(SESSION_ID,\n                                                                                    USER_ID,\n                                                                                    message)));\n    }\n\n    @Test\n    public void testSequence() {\n        IntStream.range(0, ROWS).forEach(i -> assertEquals(i,\n                                                           rows.get(i).getSequence()));\n    }\n\n    @Test\n    public void testComparator() {\n        rows.sort(MessageConsoleServiceRow.DESC_ORDER);\n\n        IntStream.range(0, ROWS).forEach(i -> assertEquals(ROWS - i - 1,\n                                                           rows.get(i).getSequence()));\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/test/java/org/guvnor/messageconsole/client/console/MessageConsoleServiceTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.messageconsole.client.console;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwt.view.client.ListDataProvider;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.messageconsole.events.FilteredMessagesEvent;\nimport org.guvnor.messageconsole.events.PublishMessagesEvent;\nimport org.guvnor.messageconsole.events.SystemMessage;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MessageConsoleServiceTest {\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private WorkspaceProjectContext workspaceProjectContext;\n\n    @Mock\n    private StubEventSource<FilteredMessagesEvent> filteredMessagesEvent;\n\n    private MessageConsoleService service;\n\n    @Before\n    public void setup() {\n        this.service = new MessageConsoleService(iocManager,\n                                                 placeManager,\n                                                 sessionInfo,\n                                                 identity,\n                                                 workspaceProjectContext,\n                                                 filteredMessagesEvent);\n    }\n\n    @Test\n    public void testPublishMessagesSortsMessagesInReverseOrder() {\n        final PublishMessagesEvent event = new PublishMessagesEvent();\n        final SystemMessage systemMessage1 = new SystemMessage();\n        final SystemMessage systemMessage2 = new SystemMessage();\n        event.setMessagesToPublish(Arrays.asList(systemMessage1, systemMessage2));\n\n        service.publishMessages(event);\n\n        final ListDataProvider<MessageConsoleServiceRow> dataProvider = service.getDataProvider();\n        final List<MessageConsoleServiceRow> data = dataProvider.getList();\n\n        assertEquals(2,\n                     data.size());\n        assertEquals(1,\n                     data.get(0).getSequence());\n        assertEquals(0,\n                     data.get(1).getSequence());\n\n        verify(filteredMessagesEvent, times(1)).fire(any());\n    }\n\n    static class StubEventSource<T> extends EventSourceMock<T> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-message-console/uberfire-message-console-client/src/test/java/org/guvnor/messageconsole/client/console/widget/button/ViewHideAlertsButtonPresenterTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.messageconsole.client.console.widget.button;\n\nimport org.guvnor.messageconsole.client.console.MessageConsoleScreen;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ViewHideAlertsButtonPresenterTest {\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private ViewHideAlertsButtonPresenter.View view;\n\n    @InjectMocks\n    private ViewHideAlertsButtonPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n        verify(view).setAlertsActive(anyBoolean());\n        verify(placeManager).registerOnOpenCallback(eq(new DefaultPlaceRequest(MessageConsoleScreen.ALERTS)),\n                                                    any());\n        verify(placeManager).registerOnCloseCallback(eq(new DefaultPlaceRequest(MessageConsoleScreen.ALERTS)),\n                                                     any());\n    }\n\n    @Test\n    public void addCssClassToButtonsTest() {\n        presenter.addCssClassToButtons(\"my-class\");\n\n        verify(view).addCssClassToButtons(\"my-class\");\n    }\n\n    @Test\n    public void viewAlertsTest() {\n        presenter.viewAlerts();\n\n        verify(placeManager).goTo(MessageConsoleScreen.ALERTS);\n    }\n\n    @Test\n    public void hideAlertsTest() {\n        presenter.hideAlerts();\n\n        verify(placeManager).closePlace(MessageConsoleScreen.ALERTS);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-nio2-backport</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire NIO.2 Simple Backport</name>\n\n  <modules>\n    <module>uberfire-nio2-model</module>\n    <module>uberfire-nio2-impls</module>\n    <module>uberfire-nio2-api</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-backport</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire NIO.2 :: API</name>\n  <description>Uberfire NIO.2 :: API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/FileSystems.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.net.URI;\nimport java.util.Map;\nimport java.util.ServiceConfigurationError;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\n\nimport static java.util.Collections.emptyMap;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n * Back port of JSR-203 from Java Platform, Standard Edition 7.\n *\n * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html\">Original JavaDoc</a>\n */\npublic final class FileSystems {\n\n    private FileSystems() {\n    }\n\n    /**\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#getDefault()\">Original JavaDoc</a>\n     */\n    public static FileSystem getDefault() {\n        return DefaultFileSystemHolder.defaultFileSystem;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws FileSystemNotFoundException\n     * @throws ProviderNotFoundException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#getFileSystem(java.net.URI)\">Original JavaDoc</a>\n     */\n    public static FileSystem getFileSystem(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, ProviderNotFoundException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return FileSystemProviders.resolveProvider(uri).getFileSystem(uri);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws FileSystemAlreadyExistsException\n     * @throws ProviderNotFoundException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.net.URI, java.util.Map)\">Original JavaDoc</a>\n     */\n    public static FileSystem newFileSystem(final URI uri,\n                                           final Map<String, ?> env)\n            throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException,\n            IOException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkNotNull(\"env\",\n                     env);\n\n        return newFileSystem(uri,\n                             env,\n                             null);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws ProviderNotFoundException\n     * @throws ServiceConfigurationError\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.nio.file.Path, java.lang.ClassLoader)\">Original JavaDoc</a>\n     */\n    public static FileSystem newFileSystem(final Path path,\n                                           final ClassLoader loader)\n            throws IllegalArgumentException, ProviderNotFoundException, ServiceConfigurationError, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final Map<String, ?> env = emptyMap();\n        return newFileSystem(path.toUri(),\n                             env,\n                             null);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws FileSystemAlreadyExistsException\n     * @throws ProviderNotFoundException\n     * @throws ServiceConfigurationError\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html#newFileSystem(java.net.URI, java.util.Map, java.lang.ClassLoader)\">Original JavaDoc</a>\n     */\n    public static FileSystem newFileSystem(final URI uri,\n                                           final Map<String, ?> env,\n                                           final ClassLoader loader)\n            throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException,\n            ServiceConfigurationError, IOException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkNotNull(\"env\",\n                     env);\n\n        return FileSystemProviders.resolveProvider(uri).newFileSystem(uri,\n                                                                      env);\n    }\n\n    // for lazy init\n    private static class DefaultFileSystemHolder {\n\n        static final FileSystem defaultFileSystem = getDefaultFileSystem();\n\n        private static FileSystem getDefaultFileSystem() {\n            return FileSystemProviders.getDefaultProvider().getFileSystem(URI.create(\"default:///\"));\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/FileTreeWalker.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n * Simple file tree walker that works in a similar manner to nftw(3C).\n *\n * @see Files#walkFileTree\n */\n\nclass FileTreeWalker {\n\n    private final FileVisitor<? super Path> visitor;\n    private final int maxDepth;\n\n    FileTreeWalker(final FileVisitor<? super Path> visitor,\n                   final int maxDepth) {\n        this.visitor = checkNotNull(\"visitor\",\n                                    visitor);\n        this.maxDepth = maxDepth;\n    }\n\n    /**\n     * Walk file tree starting at the given file\n     */\n    void walk(final Path start) throws IOException {\n        checkNotNull(\"start\",\n                     start);\n        walk(start,\n             0);\n    }\n\n    private FileVisitResult walk(final Path file,\n                                 final int depth)\n            throws IOException {\n        IOException exc = null;\n        BasicFileAttributes attrs = null;\n        try {\n            attrs = Files.readAttributes(file,\n                                         BasicFileAttributes.class);\n        } catch (IOException ex) {\n            exc = ex;\n        }\n\n        if (exc != null) {\n            return visitor.visitFileFailed(file,\n                                           exc);\n        }\n\n        // at maximum depth or file is not a directory\n        if (depth >= maxDepth || !attrs.isDirectory()) {\n            return visitor.visitFile(file,\n                                     attrs);\n        }\n\n        DirectoryStream<? extends Path> stream = null;\n        FileVisitResult result = null;\n\n        try {\n            stream = Files.newDirectoryStream(file);\n        } catch (IOException ex) {\n            return visitor.visitFileFailed(file,\n                                           ex);\n        }\n\n        IOException postException = null;\n\n        try {\n            result = visitor.preVisitDirectory(file,\n                                               attrs);\n            if (result != FileVisitResult.CONTINUE) {\n                return result;\n            }\n\n            try {\n                for (final Path entry : stream) {\n                    result = walk(entry,\n                                  depth + 1);\n                    if (result == null || result == FileVisitResult.TERMINATE) {\n                        return result;\n                    }\n                    if (result == FileVisitResult.SKIP_SIBLINGS) {\n                        break;\n                    }\n                }\n            } catch (IOException ex) {\n                postException = ex;\n            }\n        } finally {\n            try {\n                stream.close();\n            } catch (IOException ex) {\n                if (postException == null) {\n                    postException = ex;\n                }\n            }\n        }\n\n        return visitor.postVisitDirectory(file,\n                                          postException);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/Files.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.ByteArrayOutputStream;\nimport java.io.File;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.OutputStream;\nimport java.io.OutputStreamWriter;\nimport java.nio.charset.Charset;\nimport java.nio.charset.CharsetEncoder;\nimport java.util.ArrayList;\nimport java.util.EnumSet;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.regex.Pattern;\nimport java.util.regex.PatternSyntaxException;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.java.nio.file.attribute.PosixFilePermission;\nimport org.uberfire.java.nio.file.attribute.UserPrincipal;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static java.util.Collections.addAll;\nimport static java.util.Collections.emptySet;\nimport static org.uberfire.commons.regex.util.GlobToRegEx.globToRegex;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.AccessMode.EXECUTE;\nimport static org.uberfire.java.nio.file.AccessMode.READ;\nimport static org.uberfire.java.nio.file.AccessMode.WRITE;\n\n/**\n * Back port of JSR-203 from Java Platform, Standard Edition 7.\n *\n * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html\">Original JavaDoc</a>\n */\npublic final class Files {\n\n    private static final Set<StandardOpenOption> CREATE_NEW_FILE_OPTIONS = EnumSet.of(StandardOpenOption.CREATE_NEW,\n                                                                                      StandardOpenOption.WRITE);\n    /**\n     * Maximum loop count when creating temp directories.\n     */\n    private static final int TEMP_DIR_ATTEMPTS = 10000;\n    private static final int BUFFER_SIZE = 8192;\n    //TODO remove it\n    private static File BASE_TEMP_DIR = new File(System.getProperty(\"java.io.tmpdir\"));\n    private static final Path TEMP_PATH = Paths.get(BASE_TEMP_DIR.toURI());\n\n    private Files() {\n    }\n\n    // internal shortcut\n    private static FileSystemProvider providerOf(final Path path) {\n        return path.getFileSystem().provider();\n    }\n\n    //contents\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws NoSuchFileException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newInputStream(java.nio.file.Path, java.nio.file.OpenOption...)\">Original JavaDoc</a>\n     */\n    public static InputStream newInputStream(final Path path,\n                                             final OpenOption... options)\n            throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return providerOf(path).newInputStream(path,\n                                               options);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newOutputStream(java.nio.file.Path, java.nio.file.OpenOption...)\">Original JavaDoc</a>\n     */\n    public static OutputStream newOutputStream(final Path path,\n                                               final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return providerOf(path).newOutputStream(path,\n                                                options);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newByteChannel(java.nio.file.Path, java.nio.file.OpenOption...)\">Original JavaDoc</a>\n     */\n    public static SeekableByteChannel newByteChannel(final Path path,\n                                                     final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final Set<OpenOption> set = new HashSet<OpenOption>(options.length);\n        addAll(set,\n               options);\n        return newByteChannel(path,\n                              set);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newByteChannel(java.nio.file.Path, java.util.Set, java.nio.file.attribute.FileAttribute...)\">Original JavaDoc</a>\n     */\n    public static SeekableByteChannel newByteChannel(final Path path,\n                                                     final Set<? extends OpenOption> options,\n                                                     final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException,\n            IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"options\",\n                     options);\n\n        return providerOf(path).newByteChannel(path,\n                                               options,\n                                               attrs);\n    }\n\n    //directories\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws NotDirectoryException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newDirectoryStream(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static DirectoryStream<Path> newDirectoryStream(final Path dir)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        return newDirectoryStream(dir,\n                                  new DirectoryStream.Filter<Path>() {\n                                      @Override\n                                      public boolean accept(Path entry) throws IOException {\n                                          return true;\n                                      }\n                                  });\n    }\n\n    public static DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                                           final String glob)\n            throws IllegalArgumentException, UnsupportedOperationException, PatternSyntaxException, NotDirectoryException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n        checkNotEmpty(\"glob\",\n                      glob);\n\n        final String regex = globToRegex(glob);\n\n        final Pattern pattern = Pattern.compile(regex);\n\n        return newDirectoryStream(dir,\n                                  new DirectoryStream.Filter<Path>() {\n\n                                      @Override\n                                      public boolean accept(final Path entry) throws IOException {\n                                          if (entry.getFileName() == null) {\n                                              if (glob.equals(\"/\")) {\n                                                  return true;\n                                              }\n                                              return false;\n                                          }\n\n                                          if (pattern.matcher(entry.getFileName().toString()).find()) {\n                                              return true;\n                                          }\n                                          return false;\n                                      }\n                                  });\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws NotDirectoryException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newDirectoryStream(java.nio.file.Path, java.nio.file.DirectoryStream.Filter)\">Original JavaDoc</a>\n     */\n    public static DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                                           final DirectoryStream.Filter<Path> filter)\n            throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n        checkNotNull(\"filter\",\n                     filter);\n\n        return providerOf(dir).newDirectoryStream(dir,\n                                                  filter);\n    }\n\n    //creation and deletion\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createFile(java.nio.file.Path, java.nio.file.attribute.FileAttribute...)\">Original JavaDoc</a>\n     */\n    public static Path createFile(final Path path,\n                                  final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            newByteChannel(path,\n                           CREATE_NEW_FILE_OPTIONS,\n                           attrs).close();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n\n        return path;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createDirectory(java.nio.file.Path, java.nio.file.attribute.FileAttribute...)\">Original JavaDoc</a>\n     */\n    public static Path createDirectory(final Path dir,\n                                       final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        providerOf(dir).createDirectory(dir,\n                                        attrs);\n\n        return dir;\n    }\n\n    public static Path createDirectories(final Path dir,\n                                         final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        final Path absoluteDir = dir.toAbsolutePath();\n\n        if (!notExists(absoluteDir)) {\n            throw new FileAlreadyExistsException(absoluteDir.toString());\n        }\n\n        Path parent = absoluteDir.getParent();\n\n        while (parent != null) {\n            try {\n                providerOf(parent).checkAccess(parent);\n                break;\n            } catch (NoSuchFileException x) {\n            }\n            parent = parent.getParent();\n        }\n\n        if (parent == null) {\n            throw new IOException(\"Root directory does not exist\");\n        }\n\n        // create directories\n        Path child = parent;\n        for (final Path name : parent.relativize(dir)) {\n            child = child.resolve(name);\n            providerOf(child).createDirectory(child,\n                                              attrs);\n        }\n\n        return dir;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createSymbolicLink(java.nio.file.Path, java.nio.file.Path, java.nio.file.attribute.FileAttribute...)\">Original JavaDoc</a>\n     */\n    public static Path createSymbolicLink(final Path link,\n                                          final Path target,\n                                          final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n        checkNotNull(\"target\",\n                     target);\n\n        providerOf(link).createSymbolicLink(link,\n                                            target,\n                                            attrs);\n\n        return link;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws FileAlreadyExistsException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createLink(java.nio.file.Path, java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static Path createLink(final Path link,\n                                  final Path existing)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n        checkNotNull(\"existing\",\n                     existing);\n\n        providerOf(link).createLink(link,\n                                    existing);\n\n        return link;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws NoSuchFileException\n     * @throws DirectoryNotEmptyException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#delete(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static void delete(final Path path,\n                              final DeleteOption... options)\n            throws IllegalArgumentException, NoSuchFileException,\n            DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        providerOf(path).delete(path,\n                                options);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws DirectoryNotEmptyException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#deleteIfExists(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean deleteIfExists(final Path path,\n                                         final DeleteOption... options)\n            throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return providerOf(path).deleteIfExists(path,\n                                               options);\n    }\n\n    //temp implemantation are based on google's guava lib\n    public static Path createTempFile(final String prefix,\n                                      final String suffix,\n                                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return createTempFile(TEMP_PATH,\n                              prefix,\n                              suffix,\n                              attrs);\n    }\n\n    public static Path createTempFile(final Path dir,\n                                      final String prefix,\n                                      final String suffix,\n                                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        if (notExists(dir)) {\n            throw new NoSuchFileException(dir.toString());\n        }\n\n        final StringBuilder sb = new StringBuilder();\n\n        if (prefix != null && prefix.trim().length() > 0) {\n            sb.append(prefix).append(\"-\");\n        }\n\n        final String baseName = sb.append(System.currentTimeMillis()).append(\"-\").toString();\n\n        final String realSufix;\n        if (suffix != null && suffix.trim().length() > 0) {\n            realSufix = normalizeSuffix(suffix);\n        } else {\n            realSufix = \".tmp\";\n        }\n\n        for (int counter = 0; counter < TEMP_DIR_ATTEMPTS; counter++) {\n            try {\n                return createFile(dir.resolve(baseName + counter + realSufix),\n                                  attrs);\n            } catch (Exception ex) {\n            }\n        }\n\n        throw new IllegalStateException(\"Failed to create directory within \"\n                                                + TEMP_DIR_ATTEMPTS + \" attempts (tried \"\n                                                + baseName + \"0 to \" + baseName + (TEMP_DIR_ATTEMPTS - 1) + ')');\n    }\n\n    private static String normalizeSuffix(final String suffix) {\n        if (suffix.startsWith(\".\")) {\n            return suffix;\n        }\n        return \".\" + suffix;\n    }\n\n    public static Path createTempDirectory(final String prefix,\n                                           final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return createTempDirectory(TEMP_PATH,\n                                   prefix,\n                                   attrs);\n    }\n\n    public static Path createTempDirectory(final Path dir,\n                                           final String prefix,\n                                           final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        if (notExists(dir)) {\n            throw new NoSuchFileException(dir.toString());\n        }\n\n        final StringBuilder sb = new StringBuilder();\n\n        if (prefix != null && prefix.trim().length() > 0) {\n            sb.append(prefix).append(\"-\");\n        }\n\n        final String baseName = sb.append(System.currentTimeMillis()).append(\"-\").toString();\n\n        for (int counter = 0; counter < TEMP_DIR_ATTEMPTS; counter++) {\n            final Path path2Create = dir.resolve(baseName + counter);\n            try {\n                return createDirectory(path2Create,\n                                       attrs);\n            } catch (Exception ex) {\n            }\n        }\n\n        throw new IllegalStateException(\"Failed to create directory within \"\n                                                + TEMP_DIR_ATTEMPTS + \" attempts (tried \"\n                                                + baseName + \"0 to \" + baseName + (TEMP_DIR_ATTEMPTS - 1) + ')');\n    }\n\n    //copying and moving\n    public static Path copy(final Path source,\n                            final Path target,\n                            final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException,\n            DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n\n        final FileSystemProvider provider = providerOf(source);\n        if (providerOf(target) == provider) {\n            provider.copy(source,\n                          target,\n                          options);\n            return target;\n        }\n\n        throw new UnsupportedOperationException(\"can't copy from different providers\");\n    }\n\n    public static Path move(final Path source,\n                            final Path target,\n                            final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException,\n            AtomicMoveNotSupportedException, IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n\n        final FileSystemProvider provider = providerOf(source);\n        if (providerOf(target) == provider) {\n            provider.move(source,\n                          target,\n                          options);\n            return target;\n        }\n        throw new UnsupportedOperationException(\"can't move from different providers\");\n    }\n\n    //misc\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws NotLinkException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readSymbolicLink(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static Path readSymbolicLink(final Path link)\n            throws IllegalArgumentException, UnsupportedOperationException,\n            NotLinkException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n\n        return providerOf(link).readSymbolicLink(link);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#getFileStore(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static FileStore getFileStore(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return providerOf(path).getFileStore(path);\n    }\n\n    //TODO impl\n    public static String probeContentType(final Path path)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        if (!isRegularFile(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        throw new UnsupportedOperationException(\"feature not available\");\n    }\n\n    //attributes\n\n    /**\n     * @throws IllegalArgumentException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#getFileAttributeView(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                                       final Class<V> type,\n                                                                       final LinkOption... options)\n            throws IllegalArgumentException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"type\",\n                     type);\n\n        return providerOf(path).getFileAttributeView(path,\n                                                     type,\n                                                     options);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws UnsupportedOperationException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#getFileAttributeView(java.nio.file.Path, java.lang.Class, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static <A extends BasicFileAttributes> A readAttributes(final Path path,\n                                                                   final Class<A> type,\n                                                                   final LinkOption... options)\n            throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"type\",\n                     type);\n\n        return providerOf(path).readAttributes(path,\n                                               type,\n                                               options);\n    }\n\n    /**\n     * @throws UnsupportedOperationException\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAttributes(java.nio.file.Path, java.lang.String, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static Map<String, Object> readAttributes(final Path path,\n                                                     final String attributes,\n                                                     final LinkOption... options)\n            throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attributes);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        return providerOf(path).readAttributes(path,\n                                               attributes,\n                                               options);\n    }\n\n    /**\n     * @throws UnsupportedOperationException\n     * @throws IllegalArgumentException\n     * @throws ClassCastException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#setAttribute(java.nio.file.Path, java.lang.String, java.lang.Object, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static Path setAttribute(final Path path,\n                                    final String attribute,\n                                    final Object value,\n                                    final LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClassCastException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attribute\",\n                      attribute);\n\n        providerOf(path).setAttribute(path,\n                                      attribute,\n                                      value,\n                                      options);\n\n        return path;\n    }\n\n    public static Object getAttribute(final Path path,\n                                      final String attribute,\n                                      final LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attribute\",\n                      attribute);\n\n        if (attribute.indexOf('*') >= 0 || attribute.indexOf(',') >= 0) {\n            throw new IllegalArgumentException(attribute);\n        }\n\n        final Map<String, Object> map = readAttributes(path,\n                                                       attribute,\n                                                       options);\n        final String name;\n\n        final int pos = attribute.indexOf(':');\n        if (pos == -1) {\n            name = attribute;\n        } else {\n            name = (pos == attribute.length()) ? \"\" : attribute.substring(pos + 1);\n        }\n\n        return map.get(name);\n    }\n\n    //TODO impl\n    public static Set<PosixFilePermission> getPosixFilePermissions(final Path path,\n                                                                   final LinkOption... options)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        throw new UnsupportedOperationException(\"feature not available\");\n    }\n\n    //TODO impl\n    public static Path setPosixFilePermissions(final Path path,\n                                               final Set<PosixFilePermission> perms)\n            throws UnsupportedOperationException, ClassCastException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"perms\",\n                     perms);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        throw new UnsupportedOperationException(\"feature not available\");\n    }\n\n    //TODO impl\n    public static UserPrincipal getOwner(final Path path,\n                                         final LinkOption... options)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        throw new UnsupportedOperationException(\"feature not available\");\n    }\n\n    //TODO impl\n    public static Path setOwner(final Path path,\n                                final UserPrincipal owner)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"owner\",\n                     owner);\n\n        if (notExists(path)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        throw new UnsupportedOperationException(\"feature not available\");\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#getLastModifiedTime(java.nio.file.Path, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static FileTime getLastModifiedTime(final Path path,\n                                               final LinkOption... options)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return readAttributes(path,\n                              BasicFileAttributes.class,\n                              options).lastModifiedTime();\n    }\n\n    public static Path setLastModifiedTime(final Path path,\n                                           final FileTime time)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        getFileAttributeView(path,\n                             BasicFileAttributeView.class).setTimes(time,\n                                                                    null,\n                                                                    null);\n\n        return path;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#size(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static long size(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return readAttributes(path,\n                              BasicFileAttributes.class).size();\n    }\n\n    //accessibility\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#exists(java.nio.file.Path, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static boolean exists(final Path path,\n                                 final LinkOption... options)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            readAttributes(path,\n                           BasicFileAttributes.class,\n                           LinkOption.NOFOLLOW_LINKS);\n            return true;\n        } catch (Exception x) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#notExists(java.nio.file.Path, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static boolean notExists(final Path path,\n                                    final LinkOption... options)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            readAttributes(path,\n                           BasicFileAttributes.class,\n                           LinkOption.NOFOLLOW_LINKS);\n            return false;\n        } catch (NoSuchFileException x) {\n            return true;\n        } catch (Exception x) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isSameFile(java.nio.file.Path, java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isSameFile(final Path path,\n                                     final Path path2)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"path2\",\n                     path2);\n\n        return providerOf(path).isSameFile(path,\n                                           path2);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isHidden(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isHidden(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return providerOf(path).isHidden(path);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isReadable(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isReadable(final Path path) throws\n            IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            providerOf(path).checkAccess(path,\n                                         READ);\n            return true;\n        } catch (Exception x) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isWritable(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isWritable(final Path path)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            providerOf(path).checkAccess(path,\n                                         WRITE);\n            return true;\n        } catch (Exception x) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isExecutable(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isExecutable(final Path path)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            providerOf(path).checkAccess(path,\n                                         EXECUTE);\n            return true;\n        } catch (Exception x) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isSymbolicLink(java.nio.file.Path)\">Original JavaDoc</a>\n     */\n    public static boolean isSymbolicLink(final Path path)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            return readAttributes(path,\n                                  BasicFileAttributes.class,\n                                  LinkOption.NOFOLLOW_LINKS).isSymbolicLink();\n        } catch (Exception ioe) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isDirectory(java.nio.file.Path, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static boolean isDirectory(final Path path,\n                                      final LinkOption... options)\n            throws IllegalArgumentException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            return readAttributes(path,\n                                  BasicFileAttributes.class,\n                                  options).isDirectory();\n        } catch (IOException ioe) {\n        }\n        return false;\n    }\n\n    /**\n     * @throws IllegalAccessError\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#isRegularFile(java.nio.file.Path, java.nio.file.LinkOption...)\">Original JavaDoc</a>\n     */\n    public static boolean isRegularFile(final Path path,\n                                        final LinkOption... options)\n            throws IllegalAccessError, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        try {\n            return readAttributes(path,\n                                  BasicFileAttributes.class,\n                                  options).isRegularFile();\n        } catch (IOException ioe) {\n        }\n        return false;\n    }\n\n    //recursive operations\n\n    public static Path walkFileTree(final Path start,\n                                    final Set<FileVisitOption> options,\n                                    final int maxDepth,\n                                    final FileVisitor<Path> visitor)\n            throws IllegalArgumentException, SecurityException, IOException {\n        new FileTreeWalker(visitor,\n                           maxDepth).walk(start);\n\n        return start;\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#walkFileTree(java.nio.file.Path, java.nio.file.FileVisitor)\">Original JavaDoc</a>\n     */\n    public static Path walkFileTree(final Path start,\n                                    final FileVisitor<Path> visitor)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"start\",\n                     start);\n        checkNotNull(\"visitor\",\n                     visitor);\n\n        final Set<FileVisitOption> options = emptySet();\n\n        return walkFileTree(start,\n                            options,\n                            Integer.MAX_VALUE,\n                            visitor);\n    }\n\n    //utility methods - simple cases\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws NoSuchFileException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newBufferedReader(java.nio.file.Path, java.nio.charset.Charset)\">Original JavaDoc</a>\n     */\n    public static BufferedReader newBufferedReader(final Path path,\n                                                   final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"cs\",\n                     cs);\n\n        return new BufferedReader(new InputStreamReader(newInputStream(path),\n                                                        cs.newDecoder()));\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws UnsupportedOperationException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#newBufferedWriter(java.nio.file.Path, java.nio.charset.Charset, java.nio.file.OpenOption...)\">Original JavaDoc</a>\n     */\n    public static BufferedWriter newBufferedWriter(final Path path,\n                                                   final Charset cs,\n                                                   final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"cs\",\n                     cs);\n\n        return new BufferedWriter(new OutputStreamWriter(newOutputStream(path,\n                                                                         options),\n                                                         cs));\n    }\n\n    public static long copy(final InputStream in,\n                            final Path target,\n                            final CopyOption... options)\n            throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException,\n            UnsupportedOperationException, SecurityException {\n        checkNotNull(\"in\",\n                     in);\n        checkNotNull(\"target\",\n                     target);\n        checkNotNull(\"options\",\n                     options);\n\n        boolean replaceExisting = false;\n        for (final CopyOption opt : options) {\n            if (opt == StandardCopyOption.REPLACE_EXISTING) {\n                replaceExisting = true;\n                break;\n            } else {\n                checkNotNull(\"opt\",\n                             opt);\n                throw new UnsupportedOperationException(opt + \" not supported\");\n            }\n        }\n\n        if (replaceExisting) {\n            deleteIfExists(target);\n        }\n\n        final OutputStream out = newOutputStream(target,\n                                                 StandardOpenOption.CREATE_NEW,\n                                                 StandardOpenOption.WRITE);\n\n        try {\n            return internalCopy(in,\n                                out);\n        } finally {\n            try {\n                out.close();\n            } catch (java.io.IOException e) {\n                throw new IOException(e);\n            }\n        }\n    }\n\n    public static long copy(final Path source,\n                            final OutputStream out)\n            throws IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"out\",\n                     out);\n\n        final InputStream in = newInputStream(source);\n\n        try {\n            return internalCopy(in,\n                                out);\n        } finally {\n            try {\n                in.close();\n            } catch (java.io.IOException e) {\n                throw new IOException(e);\n            }\n        }\n    }\n\n    private static long internalCopy(InputStream in,\n                                     OutputStream out) {\n        long read = 0L;\n        byte[] buf = new byte[BUFFER_SIZE];\n        int n;\n        try {\n            while ((n = in.read(buf)) > 0) {\n                out.write(buf,\n                          0,\n                          n);\n                read += n;\n            }\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n        return read;\n    }\n\n    public static byte[] readAllBytes(final Path path)\n            throws IOException, OutOfMemoryError, SecurityException {\n        long size = size(path);\n        if (size > (long) Integer.MAX_VALUE) {\n            throw new OutOfMemoryError(\"Required array size too large\");\n        }\n\n        final InputStream in = newInputStream(path);\n        final ByteArrayOutputStream buffer = new ByteArrayOutputStream((int) size);\n\n        int read;\n        byte[] data = new byte[BUFFER_SIZE];\n\n        try {\n            while ((read = in.read(data,\n                                   0,\n                                   data.length)) != -1) {\n                buffer.write(data,\n                             0,\n                             read);\n            }\n            buffer.flush();\n            return buffer.toByteArray();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        } finally {\n            try {\n                in.close();\n            } catch (java.io.IOException e) {\n                throw new IOException(e);\n            }\n        }\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws NoSuchFileException\n     * @throws IOException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#readAllLines(java.nio.file.Path, java.nio.charset.Charset)\">Original JavaDoc</a>\n     */\n    public static List<String> readAllLines(final Path path,\n                                            final Charset cs)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"cs\",\n                     cs);\n\n        BufferedReader bufferedReader = null;\n\n        try {\n            bufferedReader = newBufferedReader(path,\n                                               cs);\n            final List<String> result = new ArrayList<String>();\n            String line;\n            while ((line = bufferedReader.readLine()) != null) {\n                result.add(line);\n            }\n            return result;\n        } catch (java.io.IOException ex) {\n            throw new IOException(\"Failed to read contents of path: \" + path,\n                                  ex);\n        } finally {\n            if (bufferedReader != null) {\n                try {\n                    bufferedReader.close();\n                } catch (java.io.IOException e) {\n                    throw new IOException(\"Could not close reader.\",\n                                          e);\n                }\n            }\n        }\n    }\n\n    public static Path write(final Path path,\n                             final byte[] bytes,\n                             final OpenOption... options)\n            throws IOException, UnsupportedOperationException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"bytes\",\n                     bytes);\n\n        final OutputStream out = newOutputStream(path,\n                                                 options);\n        int len = bytes.length;\n        int rem = len;\n        try {\n            while (rem > 0) {\n                int n = (rem <= BUFFER_SIZE) ? rem : BUFFER_SIZE;\n                out.write(bytes,\n                          (len - rem),\n                          n);\n                rem -= n;\n            }\n            return path;\n        } catch (java.io.IOException e) {\n            throw new IOException(\"Failed to write contents to path: \" + path,\n                                  e);\n        } finally {\n            try {\n                out.close();\n            } catch (java.io.IOException e) {\n                throw new IOException(\"Could not close output stream.\",\n                                      e);\n            }\n        }\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws IOException\n     * @throws UnsupportedOperationException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#write(java.nio.file.Path, java.lang.Iterable, java.nio.charset.Charset, java.nio.file.OpenOption...)\">Original JavaDoc</a>\n     */\n    public static Path write(final Path path,\n                             final Iterable<? extends CharSequence> lines,\n                             final Charset cs,\n                             final OpenOption... options)\n            throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"cs\",\n                     cs);\n        checkNotNull(\"lines\",\n                     lines);\n\n        final CharsetEncoder encoder = cs.newEncoder();\n        final OutputStream out = newOutputStream(path,\n                                                 options);\n\n        BufferedWriter bufferedWriter = null;\n        try {\n            bufferedWriter = new BufferedWriter(new OutputStreamWriter(out,\n                                                                       encoder));\n            for (final CharSequence line : lines) {\n                try {\n                    bufferedWriter.append(line);\n                    bufferedWriter.newLine();\n                } catch (java.io.IOException e) {\n                    throw new IOException(\"Failed to append line to writer for path: \" + path,\n                                          e);\n                }\n            }\n        } catch (final IOException ex) {\n            throw ex;\n        } finally {\n            if (bufferedWriter != null) {\n                try {\n                    bufferedWriter.close();\n                } catch (java.io.IOException e) {\n                    throw new IOException(\"Could not close writer.\",\n                                          e);\n                }\n            }\n        }\n\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/Paths.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n * Back port of JSR-203 from Java Platform, Standard Edition 7.\n *\n * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html\">Original JavaDoc</a>\n */\npublic final class Paths {\n\n    private Paths() {\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.lang.String, java.lang.String...)\">JDK JavaDoc</a>\n     */\n    public static Path get(final String first,\n                           final String... more)\n            throws IllegalArgumentException {\n        checkNotNull(\"first\",\n                     first);\n\n        if (first.trim().length() == 0) {\n            return FileSystems.getDefault().getPath(first);\n        }\n\n        URI uri = null;\n        if (more == null || more.length == 0) {\n            try {\n                uri = new URI(first);\n            } catch (URISyntaxException ex) {\n                try {\n                    uri = URI.create(first);\n                } catch (IllegalArgumentException e) {\n                    uri = null;\n                }\n            }\n        }\n        if (uri != null && uri.getScheme() != null) {\n            return get(uri);\n        }\n\n        return FileSystems.getDefault().getPath(first,\n                                                more);\n    }\n\n    /**\n     * @throws IllegalArgumentException\n     * @throws FileSystemNotFoundException\n     * @throws SecurityException\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/Paths.html#get(java.net.URI)\">JDK JavaDoc</a>\n     */\n    public static Path get(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return FileSystemProviders.resolveProvider(uri).getPath(uri);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/SimpleFileVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic class SimpleFileVisitor<T> implements FileVisitor<T> {\n\n    protected SimpleFileVisitor() {\n    }\n\n    @Override\n    public FileVisitResult preVisitDirectory(T dir,\n                                             BasicFileAttributes attrs)\n            throws IOException {\n        checkNotNull(\"dir\",\n                     dir);\n        checkNotNull(\"attrs\",\n                     attrs);\n\n        return FileVisitResult.CONTINUE;\n    }\n\n    @Override\n    public FileVisitResult visitFile(T file,\n                                     BasicFileAttributes attrs)\n            throws IOException {\n        checkNotNull(\"file\",\n                     file);\n        checkNotNull(\"attrs\",\n                     attrs);\n\n        return FileVisitResult.CONTINUE;\n    }\n\n    @Override\n    public FileVisitResult visitFileFailed(T file,\n                                           IOException exc)\n            throws IOException {\n        checkNotNull(\"file\",\n                     file);\n        checkNotNull(\"exc\",\n                     exc);\n\n        throw exc;\n    }\n\n    @Override\n    public FileVisitResult postVisitDirectory(T dir,\n                                              IOException exc)\n            throws IOException {\n        checkNotNull(\"dir\",\n                     dir);\n\n        if (exc != null) {\n            throw exc;\n        }\n        return FileVisitResult.CONTINUE;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/api/FileSystemProviders.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.api;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.ServiceConfigurationError;\nimport java.util.ServiceLoader;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static java.util.Collections.emptyList;\nimport static java.util.Collections.unmodifiableList;\nimport static java.util.Collections.unmodifiableMap;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Back port of JSR-203 from Java Platform, Standard Edition 7.\n *\n * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/FileSystemProvider.html\">Original JavaDoc</a>\n */\npublic final class FileSystemProviders {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(FileSystemProviders.class);\n\n    private static final String DEFAULT = \"default\";\n    private static List<FileSystemProvider> installedProviders = null;\n    private static Map<String, FileSystemProvider> mapOfinstalledProviders = null;\n\n    private static void setup() {\n        try {\n            installedProviders = buildProviders();\n            mapOfinstalledProviders = buildProvidersMap();\n        } catch (final Throwable ex) {\n            LOGGER.error(\"Can't initialize FileSystemProviders\",\n                         ex);\n        }\n        LOGGER.debug(\"Initialized FileSystemProviders.\\n\"\n                             + \"Installed Providers: \" + installedProviders + \"\\n\"\n                             + \"Provider Map: \" + mapOfinstalledProviders);\n    }\n\n    private static synchronized List<FileSystemProvider> buildProviders() {\n        final ServiceLoader<FileSystemProvider> providers = ServiceLoader.load(FileSystemProvider.class);\n        if (providers == null) {\n            return emptyList();\n        }\n        final List<FileSystemProvider> result = new ArrayList<>();\n\n        for (final FileSystemProvider provider : providers) {\n            result.add(provider);\n        }\n        return unmodifiableList(result);\n    }\n\n    private static synchronized Map<String, FileSystemProvider> buildProvidersMap() {\n        final Map<String, FileSystemProvider> result = new HashMap<>(installedProviders.size() + 1);\n        for (int i = 0; i < installedProviders.size(); i++) {\n            final FileSystemProvider provider = installedProviders.get(i);\n            if (FileSystemUtils.isK8SFileSystemProviderAsDefault(provider)) {\n                provider.forceAsDefault();\n                result.put(DEFAULT, provider);\n            }\n            result.put(provider.getScheme(), provider);\n        }\n        result.computeIfAbsent(DEFAULT, k -> installedProviders.get(0)).forceAsDefault();\n        return unmodifiableMap(result);\n    }\n\n    /**\n     * Non standard method that provides access to default provider (default:// scheme).\n     *\n     * @return the default file system provider\n     * @throws ServiceConfigurationError\n     */\n    public static FileSystemProvider getDefaultProvider() throws ServiceConfigurationError {\n        if (installedProviders == null) {\n            setup();\n        }\n        return mapOfinstalledProviders.get(DEFAULT);\n    }\n\n    /**\n     * Non standard method to resolve a provider based on uri's scheme\n     *\n     * @param uri the uri\n     * @return the file system provider\n     */\n    public static FileSystemProvider resolveProvider(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n        if (installedProviders == null) {\n            setup();\n        }\n\n        return getProvider(uri.getScheme());\n    }\n\n    private static FileSystemProvider getProvider(final String scheme)\n            throws FileSystemNotFoundException, ServiceConfigurationError {\n        checkNotEmpty(\"scheme\",\n                      scheme);\n\n        final FileSystemProvider fileSystemProvider = mapOfinstalledProviders.get(scheme);\n\n        if (fileSystemProvider == null) {\n            throw new FileSystemNotFoundException(\"Provider '\" + scheme + \"' not found\");\n        }\n\n        return fileSystemProvider;\n    }\n\n    /**\n     * @throws ServiceConfigurationError\n     * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/FileSystemProvider.html#installedProviders()\">Original JavaDoc</a>\n     */\n    public static List<FileSystemProvider> installedProviders() throws ServiceConfigurationError {\n        if (installedProviders == null) {\n            setup();\n        }\n        return installedProviders;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/api/FileSystemUtils.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.api;\n\nimport java.util.Properties;\n\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic class FileSystemUtils {\n\n    public static final String CFG_KIE_CONTROLLER_OCP_ENABLED = \"org.kie.server.controller.openshift.enabled\";\n    public static final String SIMPLIFIED_MONITORING_ENABLED = \"org.appformer.server.simplified.monitoring.enabled\";\n    public static final String K8S_FS_SCHEME = \"k8s\";\n    private static final String GIT_FS_SCHEME = \"git\";\n\n    private static ThreadLocal<Properties> configProps = ThreadLocal.withInitial(System::getProperties);\n\n    private FileSystemUtils() {\n    }\n\n    public static Properties getConfigProps() {\n        return configProps.get();\n    }\n\n    public static boolean isOpenShiftSupported() {\n        return \"true\".equals(getConfigProps().getProperty(CFG_KIE_CONTROLLER_OCP_ENABLED, \"false\"));\n    }\n\n    public static boolean isSimplifiedMonitoringEnabled() {\n        return \"true\".equals(getConfigProps().getProperty(SIMPLIFIED_MONITORING_ENABLED, \"false\"));\n    }\n\n    public static boolean isGitDefaultFileSystem() {\n        return FileSystemProviders.getDefaultProvider().getScheme().equals(GIT_FS_SCHEME);\n    }\n\n    public static boolean isK8SFileSystemProviderAsDefault(FileSystemProvider provider) {\n        return K8S_FS_SCHEME.equals(provider.getScheme()) && isOpenShiftSupported() && isSimplifiedMonitoringEnabled();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/extensions/FileSystemHookExecutionContext.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.extensions;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\n/**\n * Execution context for a {@link FileSystemHooks.FileSystemHook}. It contains the relevant information for the Hook execution\n */\npublic class FileSystemHookExecutionContext {\n\n    private String fsName;\n\n    private Map<String, Object> params = new HashMap<>();\n\n    public FileSystemHookExecutionContext(String fsName) {\n        this.fsName = fsName;\n    }\n\n    /**\n     *  Returns the fileSystem name that this hook executes\n     */\n    public String getFsName() {\n        return fsName;\n    }\n\n    /**\n     * Adds a param to the context\n     * @param name the name of the param\n     * @param value\n     */\n    public void addParam(String name, Object value) {\n        params.put(name, value);\n    }\n\n    /**\n     * Gets a param value\n     * @param name the name of the param\n     * @return the param value\n     */\n    public Object getParamValue(String name) {\n        return params.get(name);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/extensions/FileSystemHooks.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.file.extensions;\n\npublic enum FileSystemHooks {\n\n    ExternalUpdate, PostCommit, BranchAccessCheck, BranchAccessFilter;\n\n    @FunctionalInterface\n    public interface FileSystemHook {\n\n        /**\n         * Performs this operation in a FileSystemHooks\n         * @param context execution context\n         */\n        void execute(FileSystemHookExecutionContext context);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/main/java/org/uberfire/java/nio/file/extensions/FileSystemHooksConstants.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.extensions;\n\npublic interface FileSystemHooksConstants {\n\n    String POST_COMMIT_EXIT_CODE = \"POST_COMMIT_EXIT_CODE\";\n\n    String RECEIVE_COMMAND = \"RECEIVE_COMMAND\";\n\n    String UPLOAD_PACK = \"UPLOAD_PACK\";\n\n    String USER = \"USER\";\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/AbstractBaseTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.File;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.After;\n\npublic abstract class AbstractBaseTest {\n\n    public List<File> cleanupList = new ArrayList<File>();\n\n    @After\n    public void cleanup() throws java.io.IOException {\n        for (final File file : cleanupList) {\n            FileUtils.deleteDirectory(file);\n        }\n    }\n\n    protected Path newTempDir() {\n        return newTempDir(null);\n    }\n\n    protected Path newTempDir(final Path parent) {\n        final Path dir;\n        if (parent == null) {\n            dir = Files.createTempDirectory(\"temp\");\n        } else {\n            dir = Files.createTempDirectory(parent,\n                                            \"temp\");\n        }\n\n        cleanupList.add(dir.toFile());\n        return dir;\n    }\n\n    protected Path newDirToClean() {\n        final Path dir = Paths.get(\"temp\" + System.currentTimeMillis());\n        cleanupList.add(dir.toFile());\n        return dir;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FileSystemProvidersTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.net.URI;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\n\npublic class FileSystemProvidersTest {\n\n    @Test\n    public void generalTests() {\n        assertThat(FileSystemProviders.installedProviders()).hasSize(1);\n        assertThat(FileSystemProviders.getDefaultProvider()).isInstanceOf(SimpleFileSystemProvider.class);\n\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"default:///\"))).isInstanceOf(SimpleFileSystemProvider.class);\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"file:///\"))).isInstanceOf(SimpleFileSystemProvider.class);\n    }\n\n    @Test\n    public void resolveProviderNull() {\n        assertThatThrownBy(() -> FileSystemProviders.resolveProvider(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessageContaining(\"Parameter named 'uri' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FileSystemsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.net.URI;\nimport java.util.Collections;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.file.BaseSimpleFileSystem;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\n\npublic class FileSystemsTest {\n\n    @Test\n    public void testGetDefault() {\n        assertThat(FileSystems.getDefault())\n                .isInstanceOf(BaseSimpleFileSystem.class);\n    }\n\n    @Test\n    public void testGetFileSystemByURI() {\n        assertThat(FileSystems.getFileSystem(URI.create(\"default:///\"))).isInstanceOf(BaseSimpleFileSystem.class);\n        assertThat(FileSystems.getFileSystem(URI.create(\"file:///\"))).isInstanceOf(BaseSimpleFileSystem.class);\n    }\n\n    @Test\n    public void getFileSystemNull() {\n        assertThatThrownBy(() -> FileSystems.getFileSystem(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'uri' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull1() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem(null, Collections.emptyMap()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'uri' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull2() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem(URI.create(\"jgit:///test\"), null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'env' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull3() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem((URI) null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'uri' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull4() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem((Path) null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull5() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem(URI.create(\"jgit:///test\"), null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'env' should be not null!\");\n    }\n\n    @Test\n    public void newFileSystemNull6() {\n        assertThatThrownBy(() -> FileSystems.newFileSystem(null, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'uri' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FileTreeWalkerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.File;\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport org.apache.commons.io.FileUtils;\nimport org.junit.After;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@Ignore\npublic class FileTreeWalkerTest extends AbstractBaseTest {\n\n    final AtomicInteger preDir = new AtomicInteger();\n    final AtomicInteger postDir = new AtomicInteger();\n    final AtomicInteger fileC = new AtomicInteger();\n    final AtomicInteger failFile = new AtomicInteger();\n\n    final FileVisitor<Path> simple = new FileVisitor<Path>() {\n\n        @Override\n        public FileVisitResult preVisitDirectory(Path dir,\n                                                 BasicFileAttributes attrs) throws IOException {\n            preDir.addAndGet(1);\n            return FileVisitResult.CONTINUE;\n        }\n\n        @Override\n        public FileVisitResult visitFile(Path file,\n                                         BasicFileAttributes attrs) throws IOException {\n            fileC.addAndGet(1);\n            return FileVisitResult.CONTINUE;\n        }\n\n        @Override\n        public FileVisitResult visitFileFailed(Path file,\n                                               IOException exc) throws IOException {\n            failFile.addAndGet(1);\n            return FileVisitResult.TERMINATE;\n        }\n\n        @Override\n        public FileVisitResult postVisitDirectory(Path dir,\n                                                  IOException exc) throws IOException {\n            postDir.addAndGet(1);\n            return FileVisitResult.CONTINUE;\n        }\n    };\n\n    @After\n    public void cleanup() throws java.io.IOException {\n        for (final File file : cleanupList) {\n            FileUtils.deleteDirectory(file);\n        }\n    }\n\n    @Test\n    public void testWalker() {\n        final FileTreeWalker walker = new FileTreeWalker(simple,\n                                                         1);\n\n        walker.walk(Paths.get(\"/some/path\"));\n\n        assertThat(preDir.get()).isEqualTo(0);\n        assertThat(postDir.get()).isEqualTo(0);\n        assertThat(fileC.get()).isEqualTo(0);\n        assertThat(failFile.get()).isEqualTo(1);\n\n        final Path dir = newTempDir(null);\n\n        final Path file1 = Files.createTempFile(dir,\n                                                \"foo\",\n                                                \"bar\");\n        final Path file2 = Files.createTempFile(dir,\n                                                \"foo\",\n                                                \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(1);\n        assertThat(postDir.get()).isEqualTo(1);\n        assertThat(fileC.get()).isEqualTo(2);\n        assertThat(failFile.get()).isEqualTo(0);\n\n        cleanupVisitor();\n        walker.walk(file1);\n\n        assertThat(preDir.get()).isEqualTo(0);\n        assertThat(postDir.get()).isEqualTo(0);\n        assertThat(fileC.get()).isEqualTo(1);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2() {\n        final FileTreeWalker walker = new FileTreeWalker(simple,\n                                                         2);\n\n        final Path dir = newTempDir(null);\n        final Path subDir = newTempDir(dir);\n        final Path subSubDir = newTempDir(subDir);\n        final Path subSubSubDir = newTempDir(subSubDir);\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(2);\n        assertThat(postDir.get()).isEqualTo(2);\n        assertThat(fileC.get()).isEqualTo(1);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep1() {\n        final FileTreeWalker walker = new FileTreeWalker(simple,\n                                                         1);\n\n        final Path dir = newTempDir(null);\n        final Path subDir = newTempDir(dir);\n        final Path subSubDir = newTempDir(subDir);\n        final Path subSubSubDir = newTempDir(subSubDir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(1);\n        assertThat(postDir.get()).isEqualTo(1);\n        assertThat(fileC.get()).isEqualTo(3);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2ButTerminateOnDir() {\n\n        final FileVisitor<Path> terminateOnDir = new FileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult preVisitDirectory(Path dir,\n                                                     BasicFileAttributes attrs) throws IOException {\n                preDir.addAndGet(1);\n                if (preDir.get() > 1) {\n                    return FileVisitResult.TERMINATE;\n                }\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFile(Path file,\n                                             BasicFileAttributes attrs) throws IOException {\n                fileC.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFileFailed(Path file,\n                                                   IOException exc) throws IOException {\n                failFile.addAndGet(1);\n                return FileVisitResult.TERMINATE;\n            }\n\n            @Override\n            public FileVisitResult postVisitDirectory(Path dir,\n                                                      IOException exc) throws IOException {\n                postDir.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n        };\n\n        final FileTreeWalker walker = new FileTreeWalker(terminateOnDir,\n                                                         2);\n\n        final Path dir = newTempDir(null);\n        final Path subDir = newTempDir(dir);\n        final Path subSubDir = newTempDir(subDir);\n        final Path subSubSubDir = newTempDir(subSubDir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(2);\n        assertThat(postDir.get()).isEqualTo(0);\n        assertThat(fileC.get()).isEqualTo(2); //FAILS @ mike\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2ButSkipSibling() {\n\n        final FileVisitor<Path> terminateOnDir = new FileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult preVisitDirectory(Path dir,\n                                                     BasicFileAttributes attrs) throws IOException {\n                preDir.addAndGet(1);\n                if (preDir.get() > 1) {\n                    return FileVisitResult.SKIP_SIBLINGS;\n                }\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFile(Path file,\n                                             BasicFileAttributes attrs) throws IOException {\n                fileC.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFileFailed(Path file,\n                                                   IOException exc) throws IOException {\n                failFile.addAndGet(1);\n                return FileVisitResult.TERMINATE;\n            }\n\n            @Override\n            public FileVisitResult postVisitDirectory(Path dir,\n                                                      IOException exc) throws IOException {\n                postDir.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n        };\n\n        final FileTreeWalker walker = new FileTreeWalker(terminateOnDir,\n                                                         2);\n\n        final Path dir = newTempDir(null);\n        final Path subDir1 = newTempDir(dir);\n        final Path subDir2 = newTempDir(dir);\n        final Path subDir3 = newTempDir(dir);\n        final Path subDir4 = newTempDir(dir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(2);\n        assertThat(postDir.get()).isEqualTo(1);\n        assertThat(fileC.get()).isEqualTo(2); //FAILS\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2ButThrowExceptionOnSibling() {\n\n        final FileVisitor<Path> terminateOnDir = new FileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult preVisitDirectory(Path dir,\n                                                     BasicFileAttributes attrs) throws IOException {\n                preDir.addAndGet(1);\n                if (preDir.get() > 1) {\n                    throw new IOException();\n                }\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFile(Path file,\n                                             BasicFileAttributes attrs) throws IOException {\n                fileC.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFileFailed(Path file,\n                                                   IOException exc) throws IOException {\n                failFile.addAndGet(1);\n                return FileVisitResult.TERMINATE;\n            }\n\n            @Override\n            public FileVisitResult postVisitDirectory(Path dir,\n                                                      IOException exc) throws IOException {\n                postDir.addAndGet(1);\n                if (exc == null) {\n                    throw new RuntimeException();\n                }\n                return FileVisitResult.CONTINUE;\n            }\n        };\n\n        final FileTreeWalker walker = new FileTreeWalker(terminateOnDir,\n                                                         2);\n\n        final Path dir = newTempDir(null);\n        final Path subDir1 = newTempDir(dir);\n        final Path subDir2 = newTempDir(dir);\n        final Path subDir3 = newTempDir(dir);\n        final Path subDir4 = newTempDir(dir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(2);\n        assertThat(postDir.get()).isEqualTo(1);\n        assertThat(fileC.get()).isEqualTo(2);       //FAILS\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2ButReturnNull() {\n\n        final FileVisitor<Path> terminateOnDir = new FileVisitor<Path>() {\n\n            @Override\n            public FileVisitResult preVisitDirectory(Path dir,\n                                                     BasicFileAttributes attrs) throws IOException {\n                preDir.addAndGet(1);\n                if (preDir.get() > 1) {\n                    return null;\n                }\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFile(Path file,\n                                             BasicFileAttributes attrs) throws IOException {\n                fileC.addAndGet(1);\n                return FileVisitResult.CONTINUE;\n            }\n\n            @Override\n            public FileVisitResult visitFileFailed(Path file,\n                                                   IOException exc) throws IOException {\n                failFile.addAndGet(1);\n                return null;\n            }\n\n            @Override\n            public FileVisitResult postVisitDirectory(Path dir,\n                                                      IOException exc) throws IOException {\n                postDir.addAndGet(1);\n                if (exc == null) {\n                    throw new RuntimeException();\n                }\n                return FileVisitResult.CONTINUE;\n            }\n        };\n\n        final FileTreeWalker walker = new FileTreeWalker(terminateOnDir,\n                                                         2);\n\n        final Path dir = newTempDir(null);\n        final Path subDir1 = newTempDir(dir);\n        final Path subDir2 = newTempDir(dir);\n        final Path subDir3 = newTempDir(dir);\n        final Path subDir4 = newTempDir(dir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        walker.walk(dir);\n\n        assertThat(preDir.get()).isEqualTo(2);\n        assertThat(postDir.get()).isEqualTo(0);\n        assertThat(fileC.get()).isEqualTo(2); //FAILS\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    private void cleanupVisitor() {\n        preDir.set(0);\n        postDir.set(0);\n        fileC.set(0);\n        failFile.set(0);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FileUtilityMethodsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.RandomAccessFile;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.Ignore;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.assertj.core.data.Index.atIndex;\nimport static org.uberfire.java.nio.file.LinkOption.NOFOLLOW_LINKS;\nimport static org.uberfire.java.nio.file.StandardCopyOption.REPLACE_EXISTING;\n\npublic class FileUtilityMethodsTest extends AbstractBaseTest {\n\n    @Test\n    public void newBufferedReader() throws IOException {\n        final Path dir = newTempDir();\n\n        try (final OutputStream out = Files.newOutputStream(dir.resolve(\"file.txt\"))) {\n            assertThat(out).isNotNull();\n            out.write(\"content\".getBytes());\n        }\n\n        final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"file.txt\"),\n                                                              Charset.defaultCharset());\n        assertThat(reader).isNotNull();\n        assertThat(reader.readLine()).isNotNull().isEqualTo(\"content\");\n        assertThat(reader.readLine()).isNull();\n        reader.close();\n        try {\n            reader.read();\n            fail(\"can't read closed stream\");\n        } catch (Exception ignored) {\n        }\n    }\n\n    @Test\n    public void newBufferedReaderNoSuchFileException() {\n        assertThatThrownBy(() -> Files.newBufferedReader(Paths.get(\"/some/file/here\"),\n                                                         Charset.defaultCharset()))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void newBufferedReaderNoSuchFileException2() {\n        assertThatThrownBy(() -> Files.newBufferedReader(newTempDir(),\n                                                         Charset.defaultCharset()))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void newBufferedReaderNull1() {\n        assertThatThrownBy(() -> Files.newBufferedReader(null,\n                                                         Charset.defaultCharset()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newBufferedReaderNull2() {\n        assertThatThrownBy(() -> Files.newBufferedReader(Files.createTempFile(\"foo\",\n                                                                              \"bar\"),\n                                                         null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'cs' should be not null!\");\n    }\n\n    @Test\n    public void newBufferedReaderNull3() {\n        assertThatThrownBy(() -> Files.newBufferedReader(null,\n                                                         null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newBufferedWriter() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        try (final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(reader).isNotNull();\n            assertThat(reader.readLine()).isNotNull().isEqualTo(\"content\");\n            assertThat(reader.readLine()).isNull();\n        }\n\n        Files.newBufferedWriter(Files.createTempFile(null,\n                                                     null),\n                                Charset.defaultCharset());\n    }\n\n    @Test\n    public void newBufferedWriterNull1() {\n        assertThatThrownBy(() -> Files.newBufferedWriter(null,\n                                                         Charset.defaultCharset()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newBufferedWriterNull2() {\n        assertThatThrownBy(() -> Files.newBufferedWriter(newTempDir().resolve(\"some\"),\n                                                         null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'cs' should be not null!\");\n    }\n\n    @Test\n    public void newBufferedWriterNull3() {\n        assertThatThrownBy(() -> Files.newBufferedWriter(null,\n                                                         null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void copyIn2Path() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        try (final InputStream is = Files.newInputStream(dir.resolve(\"myfile.txt\"))) {\n            Files.copy(is,\n                       dir.resolve(\"my_new_file.txt\"));\n        }\n\n        try (final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"my_new_file.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(reader).isNotNull();\n            assertThat(reader.readLine()).isNotNull().isEqualTo(\"content\");\n            assertThat(reader.readLine()).isNull();\n        }\n    }\n\n    @Test\n    public void copyIn2PathReplaceExisting() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        try (final BufferedWriter writer2 = Files.newBufferedWriter(dir.resolve(\"my_new_file.txt\"),\n                                                                    Charset.defaultCharset())) {\n            assertThat(writer2).isNotNull();\n            writer2.write(\"empty_content\");\n        }\n\n        try (final InputStream is = Files.newInputStream(dir.resolve(\"myfile.txt\"))) {\n            Files.copy(is,\n                       dir.resolve(\"my_new_file.txt\"),\n                       REPLACE_EXISTING);\n        }\n\n        try (final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"my_new_file.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(reader).isNotNull();\n            assertThat(reader.readLine()).isNotNull().isEqualTo(\"content\");\n            assertThat(reader.readLine()).isNull();\n        }\n    }\n\n    @Test\n    public void copyIn2PathReplaceExistingNotExists() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        try (final InputStream is = Files.newInputStream(dir.resolve(\"myfile.txt\"))) {\n            Files.copy(is,\n                       dir.resolve(\"my_new_file.txt\"),\n                       REPLACE_EXISTING);\n        }\n\n        try (final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"my_new_file.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(reader).isNotNull();\n            assertThat(reader.readLine()).isEqualTo(\"content\");\n            assertThat(reader.readLine()).isNull();\n        }\n    }\n\n    @Test\n    public void copyIn2PathNull1() {\n        assertThatThrownBy(() -> Files.copy((InputStream) null,\n                                            newTempDir().resolve(\"my_new_file.txt\"),\n                                            REPLACE_EXISTING))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'in' should be not null!\");\n    }\n\n    @Test\n    public void copyIn2PathNull2() {\n        assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile(\"foo\",\n                                                                                      \"bar\")),\n                                            null,\n                                            REPLACE_EXISTING))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'target' should be not null!\");\n    }\n\n    @Test\n    public void copyIn2PathNull3() {\n        assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile(\"foo\",\n                                                                                      \"bar\")),\n                                            newTempDir().resolve(\"my_new_file.txt\"),\n                                            null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'options' should be not null!\");\n    }\n\n    @Test\n    public void copyIn2PathNull4() {\n        assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile(\"foo\",\n                                                                                      \"bar\")),\n                                            newTempDir().resolve(\"my_new_file.txt\"),\n                                            new CopyOption[]{null}))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'opt' should be not null!\");\n    }\n\n    @Test\n    public void copyIn2PathInvalidOption() {\n        assertThatThrownBy(() -> Files.copy(Files.newInputStream(Files.createTempFile(\"foo\",\n                                                                                      \"bar\")),\n                                            newTempDir().resolve(\"my_new_file.txt\"),\n                                            NOFOLLOW_LINKS))\n                .isInstanceOf(UnsupportedOperationException.class)\n                .hasMessage(\"NOFOLLOW_LINKS not supported\");\n    }\n\n    @Test\n    public void copyPath2Out() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        try (final OutputStream os = Files.newOutputStream(dir.resolve(\"my_new_file.txt\"))) {\n            Files.copy(dir.resolve(\"myfile.txt\"), os);\n        }\n\n        try (final BufferedReader reader = Files.newBufferedReader(dir.resolve(\"my_new_file.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(reader).isNotNull();\n            assertThat(reader.readLine()).isNotNull().isEqualTo(\"content\");\n            assertThat(reader.readLine()).isNull();\n        }\n    }\n\n    @Test\n    public void copyPath2OutNotExists() {\n        assertThatThrownBy(() -> {\n            try (OutputStream os = Files.newOutputStream(newTempDir().resolve(\"my_new_file.txt\"))) {\n                Files.copy(newTempDir().resolve(\"myfile.txt\"), os);\n            }\n        }).isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void copyPath2OutNull1() {\n        assertThatThrownBy(() -> {\n            try (OutputStream os = Files.newOutputStream(newTempDir().resolve(\"my_new_file.txt\"))) {\n                Files.copy(null, os);\n            }\n        })\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void copyPath2OutNull2() {\n        assertThatThrownBy(() -> Files.copy(Files.createTempFile(\"foo\",\n                                                                 \"bar\"),\n                                            null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'out' should be not null!\");\n    }\n\n    @Test\n    public void copyPath2OutInvalidOption() {\n        assertThatThrownBy(() -> Files.copy(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void readAllBytes() throws IOException {\n        final Path dir = newTempDir();\n        try (final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                                   Charset.defaultCharset())) {\n            assertThat(writer).isNotNull();\n            writer.write(\"content\");\n        }\n\n        final byte[] result = Files.readAllBytes(dir.resolve(\"myfile.txt\"));\n\n        assertThat(result)\n                .hasSize(\"content\".getBytes().length)\n                .isEqualTo(\"content\".getBytes());\n    }\n\n    @Test(expected = OutOfMemoryError.class)\n    @Ignore\n    public void readAllBytesOutOfMemory() throws IOException {\n        final Path file = newTempDir().resolve(\"file.big\");\n        final RandomAccessFile f = new RandomAccessFile(file.toFile(),\n                                                        \"rw\");\n        f.setLength(Integer.MAX_VALUE + 1L);\n\n        f.close();\n\n        Files.readAllBytes(file);\n    }\n\n    @Test\n    public void readAllBytesFileNotExists() {\n        assertThatThrownBy(() -> Files.readAllBytes(newTempDir().resolve(\"file.big\")))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAllBytesDir() {\n        assertThatThrownBy(() -> Files.readAllBytes(newTempDir()))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAllBytesNull() {\n        assertThatThrownBy(() -> Files.readAllBytes(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAllLines() throws IOException {\n        final Path dir = newTempDir();\n        final BufferedWriter writer = Files.newBufferedWriter(dir.resolve(\"myfile.txt\"),\n                                                              Charset.defaultCharset());\n        assertThat(writer).isNotNull();\n        writer.write(\"content\");\n        writer.close();\n\n        final List<String> result = Files.readAllLines(dir.resolve(\"myfile.txt\"),\n                                                       Charset.defaultCharset());\n        assertThat(result).hasSize(1)\n                .contains(\"content\", atIndex(0));\n\n        final BufferedWriter writer2 = Files.newBufferedWriter(dir.resolve(\"myfile2.txt\"),\n                                                               Charset.defaultCharset());\n        assertThat(writer2).isNotNull();\n        writer2.write(\"content\\nnewFile\\nline\");\n        writer2.close();\n\n        final List<String> result2 = Files.readAllLines(dir.resolve(\"myfile2.txt\"),\n                                                        Charset.defaultCharset());\n        assertThat(result2).hasSize(3)\n                .contains(\"content\", atIndex(0))\n                .contains(\"newFile\", atIndex(1))\n                .contains(\"line\", atIndex(2));\n    }\n\n    @Test\n    public void readAllLinesFileNotExists() {\n        assertThatThrownBy(() -> Files.readAllLines(newTempDir().resolve(\"file.big\"),\n                                                    Charset.defaultCharset()))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAllLinesDir() {\n        assertThatThrownBy(() -> Files.readAllLines(newTempDir(),\n                                                    Charset.defaultCharset()))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAllLinesNull1() {\n        assertThatThrownBy(() -> Files.readAllLines(null,\n                                                    Charset.defaultCharset()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAllLinesNull2() {\n        assertThatThrownBy(() -> Files.readAllLines(Files.createTempFile(null,\n                                                                         null),\n                                                    null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'cs' should be not null!\");\n    }\n\n    @Test\n    public void readAllLinesNull3() {\n        assertThatThrownBy(() -> Files.readAllLines(null,\n                                                    null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void write() {\n        final Path dir = newTempDir();\n\n        Path file = dir.resolve(\"file.txt\");\n        Files.write(file,\n                    \"content\".getBytes());\n\n        assertThat(Files.readAllBytes(file))\n                .hasSize(\"content\".getBytes().length)\n                .isEqualTo(\"content\".getBytes());\n    }\n\n    @Test\n    public void writeDir() {\n        assertThatThrownBy(() -> Files.write(newTempDir(),\n                                             \"content\".getBytes()))\n                .isInstanceOf(org.uberfire.java.nio.IOException.class)\n                .hasMessage(\"Could not open output stream.\");\n    }\n\n    @Test\n    public void writeNull1() {\n        assertThatThrownBy(() -> Files.write(newTempDir().resolve(\"file.txt\"),\n                                             null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'bytes' should be not null!\");\n    }\n\n    @Test\n    public void writeNull2() {\n        assertThatThrownBy(() -> Files.write(null,\n                                             \"\".getBytes()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void writeNull3() {\n        assertThatThrownBy(() -> Files.write(null,\n                                             null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void writeLines() {\n        final Path dir = newTempDir();\n        final List<String> content = Arrays.asList(\"some\", \"value\");\n\n        Files.write(dir.resolve(\"file.txt\"),\n                    content,\n                    Charset.defaultCharset());\n\n        final List<String> result = Files.readAllLines(dir.resolve(\"file.txt\"),\n                                                       Charset.defaultCharset());\n        assertThat(result).hasSize(2)\n                .contains(\"some\", atIndex(0))\n                .contains(\"value\", atIndex(1));\n    }\n\n    @Test\n    public void writeLinesDir() {\n        final List<String> content = Arrays.asList(\"some\", \"value\");\n        assertThatThrownBy(() -> Files.write(newTempDir(),\n                                             content,\n                                             Charset.defaultCharset()))\n                .isInstanceOf(org.uberfire.java.nio.IOException.class)\n                .hasMessage(\"Could not open output stream.\");\n    }\n\n    @Test\n    public void writeLinesNull1() {\n        assertThatThrownBy(() -> Files.write(newTempDir().resolve(\"file.txt\"),\n                                             null,\n                                             Charset.defaultCharset()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'lines' should be not null!\");\n    }\n\n    @Test\n    public void writeLinesNull2() {\n        final List<String> content = new ArrayList<>();\n        assertThatThrownBy(() -> Files.write(null,\n                                             content,\n                                             Charset.defaultCharset()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void writeLinesNull4() {\n        final List<String> content = new ArrayList<>();\n        assertThatThrownBy(() -> Files.write(newTempDir().resolve(\"file.txt\"),\n                                             content,\n                                             null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'cs' should be not null!\");\n    }\n\n    @Test\n    public void writeLinesNull5() {\n        assertThatThrownBy(() -> Files.write(null,\n                                             null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FilesTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.util.HashSet;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Assume;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class FilesTest extends AbstractBaseTest {\n\n    @Test\n    public void newIOStreams() throws IOException {\n        final Path dir = newTempDir();\n\n        try (final OutputStream out = Files.newOutputStream(dir.resolve(\"file.txt\"))) {\n            assertThat(out).isNotNull();\n            out.write(\"content\".getBytes());\n        }\n\n        try (final InputStream in = Files.newInputStream(dir.resolve(\"file.txt\"))) {\n\n            assertThat(in).isNotNull();\n\n            final StringBuilder sb = new StringBuilder();\n            while (true) {\n                int i = in.read();\n                if (i == -1) {\n                    break;\n                }\n                sb.append((char) i);\n            }\n            assertThat(sb.toString()).isEqualTo(\"content\");\n        }\n    }\n\n    @Test\n    public void newInputStreamNonExistent() {\n        assertThatThrownBy(() -> Files.newInputStream(Paths.get(\"/path/to/some/file.txt\")))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void newInputStreamOnDir() {\n        final Path dir = newTempDir();\n        assertThatThrownBy(() -> Files.newInputStream(dir))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void newInputStreamNull() {\n        assertThatThrownBy(() -> Files.newInputStream(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newOutputStreamOnExistent() {\n        final Path dir = newTempDir();\n\n        assertThatThrownBy(() -> Files.newOutputStream(dir))\n                .isInstanceOf(org.uberfire.java.nio.IOException.class)\n                .hasMessage(\"Could not open output stream.\");\n    }\n\n    @Test\n    public void newOutpurStreamNull() {\n        assertThatThrownBy(() -> Files.newOutputStream(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newByteChannel() throws IOException {\n        try (final SeekableByteChannel sbc = Files.newByteChannel(newTempDir().resolve(\"file.temp.txt\"),\n                                                                  new HashSet<>())) {\n            assertThat(sbc).isNotNull();\n        }\n\n        try (final SeekableByteChannel sbc2 = Files.newByteChannel(newTempDir().resolve(\"file.temp2.txt\"))) {\n            assertThat(sbc2).isNotNull();\n        }\n    }\n\n    @Test\n    public void newByteChannelFileAlreadyExists() {\n        assertThatThrownBy(() -> Files.newByteChannel(Files.createTempFile(\"foo\", \"bar\")))\n                .isInstanceOf(FileAlreadyExistsException.class);\n    }\n\n    @Test\n    public void newByteChannelNull() {\n        assertThatThrownBy(() -> Files.newByteChannel(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void createFile() {\n        final Path path = Files.createFile(newTempDir().resolve(\"file.temp.txt\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.toFile()).exists();\n    }\n\n    @Test\n    public void createFileAlreadyExists() {\n        assertThatThrownBy(() -> Files.createFile(Files.createTempFile(\"foo\", \"bar\")))\n                .isInstanceOf(FileAlreadyExistsException.class);\n    }\n\n    @Test\n    public void createFileNull() {\n        assertThatThrownBy(() -> Files.createFile(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void createDirectory() {\n        final Path path = newTempDir();\n\n        final Path dir = Files.createDirectory(path.resolve(\"myNewDir\"));\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).exists();\n        assertThat(dir.toFile()).isDirectory();\n\n        final Path file = Files.createFile(dir.resolve(\"new.file.txt\"));\n        assertThat(file).isNotNull();\n        assertThat(file.toFile()).exists();\n        assertThat(file.toFile()).isFile();\n    }\n\n    @Test\n    public void createDirectoryFileAlreadyExists() {\n        assertThatThrownBy(() -> Files.createDirectory(newTempDir()))\n                .isInstanceOf(FileAlreadyExistsException.class);\n    }\n\n    @Test\n    public void createDirectoryNull() {\n        assertThatThrownBy(() -> Files.createDirectory(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'dir' should be not null!\");\n    }\n\n    @Test\n    public void createDirectories() {\n        final Path path = newTempDir();\n\n        final Path dir = Files.createDirectories(path.resolve(\"myNewDir/mysubDir1/mysubDir2\"));\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).exists();\n        assertThat(dir.toFile()).isDirectory();\n\n        final Path file = Files.createFile(dir.resolve(\"new.file.txt\"));\n        assertThat(file).isNotNull();\n        assertThat(file.toFile()).exists();\n        assertThat(file.toFile()).isFile();\n    }\n\n    @Test\n    public void createDirectoriesFileAlreadyExists() {\n        assertThatThrownBy(() -> Files.createDirectories(newTempDir()))\n                .isInstanceOf(FileAlreadyExistsException.class);\n    }\n\n    @Test\n    public void createDirectoriesNull() {\n        assertThatThrownBy(() -> Files.createDirectories(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'dir' should be not null!\");\n    }\n\n    @Test\n    public void delete() {\n        final Path path = Files.createFile(newTempDir().resolve(\"file.temp.txt\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.toFile()).exists();\n\n        Files.delete(path);\n\n        assertThat(path).isNotNull();\n        assertThat(path.toFile()).doesNotExist();\n\n        final Path dir = newTempDir();\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).exists();\n\n        Files.delete(dir);\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).doesNotExist();\n    }\n\n    @Test\n    public void deleteDirectoryNotEmpty() {\n        final Path dir = newTempDir();\n        Files.createFile(dir.resolve(\"file.temp.txt\"));\n\n        assertThatThrownBy(() -> Files.delete(dir))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n    }\n\n    @Test\n    public void deleteNoSuchFileException() {\n        assertThatThrownBy(() -> Files.delete(newTempDir().resolve(\"file.temp.txt\")))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void deleteNull() {\n        assertThatThrownBy(() -> Files.delete(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void deleteIfExists() {\n        final Path path = Files.createFile(newTempDir().resolve(\"file.temp.txt\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.toFile()).exists();\n\n        assertThat(Files.deleteIfExists(path)).isTrue();\n\n        assertThat(path).isNotNull();\n        assertThat(path.toFile()).doesNotExist();\n\n        final Path dir = newTempDir();\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).exists();\n\n        assertThat(Files.deleteIfExists(dir)).isTrue();\n\n        assertThat(dir).isNotNull();\n        assertThat(dir.toFile()).doesNotExist();\n\n        assertThat(Files.deleteIfExists(newTempDir().resolve(\"file.temp.txt\"))).isFalse();\n    }\n\n    @Test\n    public void deleteIfExistsDirectoryNotEmpty() {\n        final Path dir = newTempDir();\n        Files.createFile(dir.resolve(\"file.temp.txt\"));\n\n        assertThatThrownBy(() -> Files.deleteIfExists(dir))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n    }\n\n    @Test\n    public void deleteIfExistsNull() {\n        assertThatThrownBy(() -> Files.deleteIfExists(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void createTempFile() {\n        final Path tempFile = Files.createTempFile(null,\n                                                   null);\n        assertThat(tempFile).isNotNull();\n        assertThat(tempFile.getFileName().toString()).endsWith(\"tmp\");\n        assertThat(tempFile.toFile()).exists();\n\n        final Path tempFile2 = Files.createTempFile(\"\",\n                                                    \"\");\n        assertThat(tempFile2).isNotNull();\n        assertThat(tempFile2.getFileName().toString()).endsWith(\"tmp\");\n        assertThat(tempFile2.toFile()).exists();\n\n        final Path tempFile3 = Files.createTempFile(\"foo\", \"bar\");\n        assertThat(tempFile3).isNotNull();\n        assertThat(tempFile3.toFile()).exists();\n        assertThat(tempFile3.getFileName().toString()).startsWith(\"foo\").endsWith(\".bar\");\n\n        final Path tempFile4 = Files.createTempFile(\"\",\n                                                    \"bar\");\n        assertThat(tempFile4).isNotNull();\n        assertThat(tempFile4.toFile()).exists();\n        assertThat(tempFile4.getFileName().toString()).endsWith(\".bar\");\n\n        final Path tempFile5 = Files.createTempFile(\"\",\n                                                    \".bar\");\n        assertThat(tempFile5).isNotNull();\n        assertThat(tempFile5.toFile()).exists();\n        assertThat(tempFile5.getFileName().toString()).endsWith(\".bar\");\n\n        final Path tempFile6 = Files.createTempFile(\"\",\n                                                    \"bar.temp\");\n        assertThat(tempFile6).isNotNull();\n        assertThat(tempFile6.toFile()).exists();\n        assertThat(tempFile6.getFileName().toString()).endsWith(\".bar.temp\");\n\n        final Path tempFile7 = Files.createTempFile(\"\",\n                                                    \".bar.temp\");\n        assertThat(tempFile7).isNotNull();\n        assertThat(tempFile7.toFile()).exists();\n        assertThat(tempFile7.getFileName().toString()).endsWith(\".bar.temp\");\n    }\n\n    @Test\n    public void createTempFileInsideDir() {\n        final Path dir = newTempDir();\n\n        assertThat(dir.toFile().list()).isEmpty();\n\n        final Path tempFile = Files.createTempFile(dir,\n                                                   null,\n                                                   null);\n\n        assertThat(tempFile).isNotNull();\n        assertThat(tempFile.getFileName().toString()).endsWith(\"tmp\");\n        assertThat(tempFile.toFile()).exists();\n\n        assertThat(dir.toFile().list()).isNotEmpty();\n    }\n\n    @Test\n    public void createTempFileNoSuchFile() {\n        assertThatThrownBy(() -> Files.createTempFile(Paths.get(\"/path/to/\"),\n                                                      null,\n                                                      null))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void createTempFileNull() {\n        assertThatThrownBy(() -> Files.createTempFile((Path) null, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'dir' should be not null!\");\n    }\n\n    @Test\n    public void createTempDirectory() {\n        final Path tempFile = Files.createTempDirectory(null);\n        assertThat(tempFile).isNotNull();\n        assertThat(tempFile.toFile()).exists();\n        assertThat(tempFile.toFile()).isDirectory();\n\n        final Path tempFile2 = Files.createTempDirectory(\"\");\n        assertThat(tempFile2).isNotNull();\n        assertThat(tempFile2.toFile()).exists();\n        assertThat(tempFile2.toFile()).isDirectory();\n\n        final Path tempFile3 = Files.createTempDirectory(\"foo\");\n        assertThat(tempFile3).isNotNull();\n        assertThat(tempFile3.toFile()).exists();\n        assertThat(tempFile3.getFileName().toString()).startsWith(\"foo\");\n        assertThat(tempFile3.toFile()).isDirectory();\n    }\n\n    @Test\n    public void createTempDirectoryInsideDir() {\n        final Path dir = newTempDir();\n\n        assertThat(dir.toFile().list()).isEmpty();\n\n        final Path tempFile = Files.createTempDirectory(dir,\n                                                        null);\n\n        assertThat(tempFile).isNotNull();\n        assertThat(tempFile.toFile()).exists();\n        assertThat(tempFile.toFile()).isDirectory();\n\n        assertThat(dir.toFile().list()).isNotEmpty();\n    }\n\n    @Test\n    public void createTempDirectoryNoSuchFile() {\n        assertThatThrownBy(() -> Files.createTempDirectory(Paths.get(\"/path/to/\"),\n                                                           null))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void createTempDirectoryNull() {\n        assertThatThrownBy(() -> Files.createTempDirectory((Path) null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'dir' should be not null!\");\n    }\n\n    @Test\n    public void copyDir() {\n        final Path source = newTempDir();\n        final Path dest = newDirToClean();\n\n        assertThat(source.toFile()).exists();\n        assertThat(dest.toFile()).doesNotExist();\n\n        Files.copy(source,\n                   dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).exists();\n    }\n\n    @Test\n    public void copyDirDirectoryNotEmptyException() {\n        final Path source = newTempDir();\n        final Path dest = newDirToClean();\n        Files.createTempFile(source, \"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.copy(source, dest))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n    }\n\n    @Test\n    public void copyFile() throws IOException {\n        final Path dir = newTempDir();\n\n        final Path source = dir.resolve(\"temp.txt\");\n        final Path dest = dir.resolve(\"result.txt\");\n\n        try (final OutputStream stream = Files.newOutputStream(source)) {\n            stream.write('a');\n        }\n\n        Files.copy(source,\n                   dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).exists();\n        assertThat(dest.toFile().length()).isEqualTo(source.toFile().length());\n    }\n\n    @Test\n    public void copyFileInvalidSourceAndTarget() throws IOException {\n        final Path source = newTempDir();\n        final Path dest = newTempDir().resolve(\"other\");\n\n        final Path sourceFile = source.resolve(\"file.txt\");\n        try (final OutputStream stream = Files.newOutputStream(sourceFile)) {\n            stream.write('a');\n        }\n\n        assertThatThrownBy(() -> Files.copy(source, dest))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n\n        sourceFile.toFile().delete();\n        Files.copy(source,\n                   dest);\n\n        assertThatThrownBy(() -> Files.copy(source, dest))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        dest.toFile().delete();\n        source.toFile().delete();\n\n        assertThatThrownBy(() -> Files.copy(source, dest))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'source must exist' is invalid!\");\n    }\n\n    @Test\n    public void copyNull1() {\n        assertThatThrownBy(() -> Files.copy(newTempDir(), (Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'target' should be not null!\");\n    }\n\n    @Test\n    public void copyNull2() {\n        assertThatThrownBy(() -> Files.copy((Path) null, Paths.get(\"/temp\")))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void copyNull3() {\n        assertThatThrownBy(() -> Files.copy((Path) null, (Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void moveDir() {\n        final Path source = newTempDir();\n        final Path dest = newTempDir().resolve(\"other\");\n\n        Files.move(source,\n                   dest);\n\n        assertThat(source.toFile()).doesNotExist();\n        assertThat(dest.toFile()).exists();\n    }\n\n    @Test\n    public void moveFile() throws IOException {\n        final Path dir = newTempDir();\n        final Path source = dir.resolve(\"fileSource.txt\");\n        final Path dest = dir.resolve(\"fileDest.txt\");\n        try (final OutputStream stream = Files.newOutputStream(source)) {\n            stream.write('a');\n        }\n\n        long lenght = source.toFile().length();\n        Files.move(source,\n                   dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).doesNotExist();\n        assertThat(dest.toFile().length()).isEqualTo(lenght);\n    }\n\n    @Test\n    public void moveFileInvalidSourceAndTarget() throws IOException {\n        final Path source = newTempDir();\n        final Path dest = newTempDir().resolve(\"other\");\n\n        final Path sourceFile = source.resolve(\"file.txt\");\n        try (final OutputStream stream = Files.newOutputStream(sourceFile)) {\n            stream.write('a');\n        }\n\n        assertThatThrownBy(() -> Files.move(source, dest))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n\n        sourceFile.toFile().delete();\n        Files.copy(source,\n                   dest);\n\n        assertThatThrownBy(() -> Files.move(source, dest))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        dest.toFile().delete();\n        source.toFile().delete();\n\n        assertThatThrownBy(() -> Files.move(source, dest))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'source must exist' is invalid!\");\n    }\n\n    @Test\n    public void moveNull1() {\n        assertThatThrownBy(() -> Files.move(newTempDir(), null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'target' should be not null!\");\n    }\n\n    @Test\n    public void moveNull2() {\n        assertThatThrownBy(() -> Files.move(null, newTempDir()))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void moveNull3() {\n        assertThatThrownBy(() -> Files.move(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'source' should be not null!\");\n    }\n\n    @Test\n    public void getFileStoreNull() {\n        assertThatThrownBy(() -> Files.getFileStore(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void getFileStoreN() {\n        final URI uri = URI.create(\"nothing:///testXXXXXXX\");\n\n        assertThatThrownBy(() -> Files.getFileStore(Paths.get(uri)))\n                .isInstanceOf(FileSystemNotFoundException.class)\n                .hasMessage(\"Provider 'nothing' not found\");\n    }\n\n    @Test\n    public void getFileAttributeViewGeneral() {\n        final Path path = Files.createTempFile(null,\n                                               null);\n\n        final BasicFileAttributeView view = Files.getFileAttributeView(path,\n                                                                       BasicFileAttributeView.class);\n        assertThat(view).isNotNull();\n        assertThat((Object) view.readAttributes()).isNotNull();\n        assertThat(view.readAttributes().isRegularFile()).isTrue();\n        assertThat(view.readAttributes().isDirectory()).isFalse();\n        assertThat(view.readAttributes().isSymbolicLink()).isFalse();\n        assertThat(view.readAttributes().isOther()).isFalse();\n        assertThat(view.readAttributes().size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void getFileAttributeViewBasic() {\n        final Path path = Files.createTempFile(null,\n                                               null);\n\n        final BasicFileAttributeView view = Files.getFileAttributeView(path,\n                                                                       BasicFileAttributeView.class);\n        assertThat(view).isNotNull();\n        assertThat((Object) view.readAttributes()).isNotNull();\n        assertThat(view.readAttributes().isRegularFile()).isTrue();\n        assertThat(view.readAttributes().isDirectory()).isFalse();\n        assertThat(view.readAttributes().isSymbolicLink()).isFalse();\n        assertThat(view.readAttributes().isOther()).isFalse();\n        assertThat(view.readAttributes().size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void getFileAttributeViewInvalidView() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.getFileAttributeView(path,\n                                              MyAttrsView.class)).isNull();\n    }\n\n    @Test\n    public void getFileAttributeViewNoSuchFileException() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n\n        assertThatThrownBy(() -> Files.getFileAttributeView(path,\n                                                            BasicFileAttributeView.class))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void getFileAttributeViewNull1() {\n        assertThatThrownBy(() -> Files.getFileAttributeView(null, MyAttrsView.class))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void getFileAttributeViewNull2() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n\n        assertThatThrownBy(() -> Files.getFileAttributeView(path, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'type' should be not null!\");\n    }\n\n    @Test\n    public void getFileAttributeViewNull3() {\n        assertThatThrownBy(() -> Files.getFileAttributeView(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesGeneral() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        final BasicFileAttributesImpl attrs = Files.readAttributes(path,\n                                                                   BasicFileAttributesImpl.class);\n        assertThat(attrs).isNotNull();\n        assertThat(attrs.isRegularFile()).isTrue();\n        assertThat(attrs.isDirectory()).isFalse();\n        assertThat(attrs.isSymbolicLink()).isFalse();\n        assertThat(attrs.isOther()).isFalse();\n        assertThat(attrs.size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void readAttributesBasic() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        final BasicFileAttributes attrs = Files.readAttributes(path,\n                                                               BasicFileAttributes.class);\n\n        assertThat(attrs).isNotNull();\n        assertThat(attrs.isRegularFile()).isTrue();\n        assertThat(attrs.isDirectory()).isFalse();\n        assertThat(attrs.isSymbolicLink()).isFalse();\n        assertThat(attrs.isOther()).isFalse();\n        assertThat(attrs.size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void readAttributesNonExistentFile() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n        assertThatThrownBy(() -> Files.readAttributes(path,\n                                                      BasicFileAttributes.class))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAttributesInvalid() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.readAttributes(path,\n                                        MyAttrs.class)).isNull();\n    }\n\n    @Test\n    public void readAttributesNull1() {\n        assertThatThrownBy(() -> Files.readAttributes(null, MyAttrs.class))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesNull2() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n        assertThatThrownBy(() -> Files.readAttributes(path, (Class<MyAttrs>) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'type' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesNull3() {\n        assertThatThrownBy(() -> Files.readAttributes(null, (Class<MyAttrs>) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesMap() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"*\")).hasSize(9);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"basic:*\")).hasSize(9);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"basic:isRegularFile\")).hasSize(1);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"basic:isRegularFile,isDirectory\")).hasSize(2);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"basic:isRegularFile,isDirectory,someThing\")).hasSize(2);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"basic:someThing\")).hasSize(0);\n\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"isRegularFile\")).hasSize(1);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"isRegularFile,isDirectory\")).hasSize(2);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"isRegularFile,isDirectory,someThing\")).hasSize(2);\n        Assertions.assertThat(Files.readAttributes(path,\n                                                   \"someThing\")).hasSize(0);\n\n        assertThatThrownBy(() -> Files.readAttributes(path,\n                                                      \":someThing\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\":someThing\");\n\n        assertThatThrownBy(() -> Files.readAttributes(path,\n                                                      \"advanced:isRegularFile\"))\n                .isInstanceOf(UnsupportedOperationException.class)\n                .hasMessage(\"View 'advanced' not available\");\n    }\n\n    @Test\n    public void readAttributesMapNull1() {\n        assertThatThrownBy(() -> Files.readAttributes(null, \"*\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesMapNull2() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.readAttributes(path, (String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void readAttributesMapNull3() {\n        assertThatThrownBy(() -> Files.readAttributes(null,\n                                                      (String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesMapEmpty() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.readAttributes(path, \"\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void readAttributesMapNoSuchFileException() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n\n        assertThatThrownBy(() -> Files.readAttributes(path,\n                                                      \"*\"))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void setAttributeNull1() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n        assertThatThrownBy(() -> Files.setAttribute(path, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attribute' should be filled!\");\n    }\n\n    @Test\n    public void setAttributeNull2() {\n        assertThatThrownBy(() -> Files.setAttribute(null, \"some\", null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setAttributeNull3() {\n        assertThatThrownBy(() -> Files.setAttribute(null, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setAttributeEmpty() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setAttribute(path, \"\", null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attribute' should be filled!\");\n    }\n\n    @Test\n    public void setAttributeInvalidAttr() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setAttribute(path, \"myattr\", null))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'invalid attribute' is invalid!\");\n    }\n\n    @Test\n    public void setAttributeInvalidView() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setAttribute(path,\n                                                    \"advanced:isRegularFile\",\n                                                    null))\n                .isInstanceOf(UnsupportedOperationException.class)\n                .hasMessage(\"View 'advanced' not available\");\n    }\n\n    @Test\n    public void setAttributeInvalidView2() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setAttribute(path,\n                                                    \":isRegularFile\",\n                                                    null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\":isRegularFile\");\n    }\n\n    @Test\n    public void setAttributeNotImpl() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setAttribute(path,\n                                                    \"isRegularFile\",\n                                                    null))\n                .isInstanceOf(NotImplementedException.class);\n    }\n\n    @Test\n    public void readAttribute() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.getAttribute(path,\n                                      \"basic:isRegularFile\")).isNotNull();\n        assertThat(Files.getAttribute(path,\n                                      \"basic:someThing\")).isNull();\n\n        assertThat(Files.getAttribute(path,\n                                      \"isRegularFile\")).isNotNull();\n        assertThat(Files.getAttribute(path,\n                                      \"someThing\")).isNull();\n    }\n\n    @Test\n    public void readAttributeInvalid() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.getAttribute(path, \"*\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"*\");\n    }\n\n    @Test\n    public void readAttributeInvalid2() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n        assertThatThrownBy(() -> Files.getAttribute(path,\n                                                    \"isRegularFile,isDirectory\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"isRegularFile,isDirectory\");\n    }\n\n    @Test\n    public void readAttributeInvalid3() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n\n        assertThatThrownBy(() -> Files.getAttribute(path,\n                                                    \"isRegularFile\"))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void getLastModifiedTime() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.getLastModifiedTime(path)).isNotNull();\n    }\n\n    @Test\n    public void getLastModifiedTimeNoSuchFileException() {\n        final Path path = Paths.get(\"/path/to/file\");\n\n        assertThatThrownBy(() -> Files.getLastModifiedTime(path))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void getLastModifiedTimeNull() {\n        assertThatThrownBy(() -> Files.getLastModifiedTime(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setLastModifiedTime() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setLastModifiedTime(path, null))\n                .isInstanceOf(NotImplementedException.class);\n    }\n\n    @Test\n    public void setLastModifiedTimeNoSuchFileException() {\n        final Path path = Paths.get(\"/path/to/file\");\n\n        assertThatThrownBy(() -> Files.setLastModifiedTime(path, null))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void setLastModifiedTimeNull() {\n        assertThatThrownBy(() -> Files.setLastModifiedTime(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setLastModifiedTimeNull2() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.setLastModifiedTime(path, null))\n                .isInstanceOf(NotImplementedException.class);\n    }\n\n    @Test\n    public void size() throws IOException {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.size(path)).isEqualTo(0L);\n\n        final Path sourceFile = newTempDir().resolve(\"file.txt\");\n        final OutputStream stream = Files.newOutputStream(sourceFile);\n        stream.write('a');\n        stream.close();\n\n        assertThat(Files.size(sourceFile)).isEqualTo(1L);\n    }\n\n    @Test\n    public void sizeNoSuchFileException() {\n        final Path path = Paths.get(\"/path/to/file\");\n\n        assertThatThrownBy(() -> Files.size(path))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void sizeNull() {\n        assertThatThrownBy(() -> Files.size(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void exists() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.exists(path)).isTrue();\n        assertThat(Files.exists(newTempDir())).isTrue();\n        assertThat(Files.exists(Paths.get(\"/some/path/here\"))).isFalse();\n    }\n\n    @Test\n    public void existsNull() {\n        assertThatThrownBy(() -> Files.exists(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void notExists() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.notExists(path)).isFalse();\n        assertThat(Files.notExists(newTempDir())).isFalse();\n        assertThat(Files.notExists(Paths.get(\"/some/path/here\"))).isTrue();\n        assertThat(Files.notExists(newTempDir().resolve(\"some.text\"))).isTrue();\n    }\n\n    @Test\n    public void notExistsNull() {\n        assertThatThrownBy(() -> Files.notExists(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isSameFile() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isSameFile(path,\n                                    Paths.get(path.toString()))).isTrue();\n        assertThat(Files.isSameFile(path,\n                                    Files.createTempFile(\"foo\", \"bar\"))).isFalse();\n        assertThat(Files.isSameFile(newTempDir(),\n                                    newTempDir())).isFalse();\n\n        final Path dir = newTempDir();\n        assertThat(Files.isSameFile(dir,\n                                    Paths.get(dir.toString()))).isTrue();\n\n        assertThat(Files.isSameFile(Paths.get(\"/path/to/some/place\"),\n                                    Paths.get(\"/path/to/some/place\"))).isTrue();\n        assertThat(Files.isSameFile(Paths.get(\"/path/to/some/place\"),\n                                    Paths.get(\"/path/to/some/place/a\"))).isFalse();\n    }\n\n    @Test\n    public void isSameFileNull1() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.isSameFile(path, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path2' should be not null!\");\n    }\n\n    @Test\n    public void isSameFileNull2() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThatThrownBy(() -> Files.isSameFile(null, path))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isSameFileNull3() {\n        assertThatThrownBy(() -> Files.isSameFile(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isHidden() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isHidden(path)).isFalse();\n        assertThat(Files.isHidden(newTempDir())).isFalse();\n        assertThat(Files.isHidden(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isHiddenNull() {\n        assertThatThrownBy(() -> Files.isHidden(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isReadable() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isReadable(path)).isTrue();\n        assertThat(Files.isReadable(newTempDir())).isTrue();\n        assertThat(Files.isReadable(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isReadableNull() {\n        assertThatThrownBy(() -> Files.isReadable(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isWritable() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isWritable(path)).isTrue();\n        assertThat(Files.isWritable(newTempDir())).isTrue();\n        assertThat(Files.isWritable(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isWritableNull() {\n        assertThatThrownBy(() -> Files.isWritable(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isExecutable() {\n        Assume.assumeFalse(SimpleFileSystemProvider.OSType.currentOS().equals(SimpleFileSystemProvider.OSType.WINDOWS));\n\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isExecutable(path)).isFalse();\n        assertThat(Files.isExecutable(newTempDir())).isTrue();\n        assertThat(Files.isExecutable(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isExecutableNull() {\n        assertThatThrownBy(() -> Files.isExecutable(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isSymbolicLink() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isSymbolicLink(path)).isFalse();\n        assertThat(Files.isSymbolicLink(newTempDir())).isFalse();\n        assertThat(Files.isSymbolicLink(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isSymbolicLinkNull() {\n        assertThatThrownBy(() -> Files.isSymbolicLink(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isDirectory() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isDirectory(path)).isFalse();\n        assertThat(Files.isDirectory(newTempDir())).isTrue();\n        assertThat(Files.isDirectory(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isDirectoryNull() {\n        assertThatThrownBy(() -> Files.isDirectory(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void isRegularFile() {\n        final Path path = Files.createTempFile(\"foo\", \"bar\");\n\n        assertThat(Files.isRegularFile(path)).isTrue();\n        assertThat(Files.isRegularFile(newTempDir())).isFalse();\n        assertThat(Files.isRegularFile(Paths.get(\"/some/file\"))).isFalse();\n    }\n\n    @Test\n    public void isRegularFileNull() {\n        assertThatThrownBy(() -> Files.isRegularFile(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    private interface MyAttrsView extends BasicFileAttributeView {\n\n    }\n\n    private interface MyAttrs extends BasicFileAttributes {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/FilesUnsupportedOpsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.util.Collections;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.PosixFilePermission;\nimport org.uberfire.java.nio.file.attribute.UserPrincipal;\n\npublic class FilesUnsupportedOpsTest extends AbstractBaseTest {\n\n    @Test(expected = NotDirectoryException.class)\n    public void newDirectoryStreamGlobNotDirectoryException() {\n        Files.newDirectoryStream(Files.createTempFile(\"foo\",\n                                                      \"bar\"),\n                                 \"*.*\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamGlobNull() {\n        Files.newDirectoryStream(null,\n                                 (String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamGlobNull2() {\n        Files.newDirectoryStream(newTempDir(),\n                                 (String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamGlobNull3() {\n        Files.newDirectoryStream(null,\n                                 \"*.*\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamGlobEmpty() {\n        Files.newDirectoryStream(newTempDir(),\n                                 \"\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void probeContentType() {\n        Files.probeContentType(Files.createTempFile(null,\n                                                    null));\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void probeContentTypeDir() {\n        Files.probeContentType(newTempDir());\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void probeContentTypeNonExistent() {\n        Files.probeContentType(Paths.get(\"/path/to/some/plaxe.txt\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void probeContentTypeNull() {\n        Files.probeContentType(null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getPosixFilePermissions() {\n        Files.getPosixFilePermissions(newTempDir());\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void getPosixFilePermissionsNoSuchFileException() {\n        Files.getPosixFilePermissions(Paths.get(\"/some/path\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getPosixFilePermissionsNull() {\n        Files.getPosixFilePermissions(null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getOwner() {\n        Files.getOwner(newTempDir());\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void getOwnerNoSuchFileException() {\n        Files.getOwner(Paths.get(\"/some/path\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getOwnerNull() {\n        Files.getOwner(null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void setOwner() {\n        Files.setOwner(newTempDir(),\n                       new UserPrincipal() {\n                           @Override\n                           public String getName() {\n                               return \"name\";\n                           }\n                       });\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void setOwnerNoSuchFileException() {\n        Files.setOwner(Paths.get(\"/some/path\"),\n                       new UserPrincipal() {\n                           @Override\n                           public String getName() {\n                               return \"name\";\n                           }\n                       });\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void setOwnerNull() {\n        Files.setOwner(newTempDir(),\n                       null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void setOwnerNull2() {\n        Files.setOwner(null,\n                       new UserPrincipal() {\n                           @Override\n                           public String getName() {\n                               return \"name\";\n                           }\n                       });\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void setOwnerNull3() {\n        Files.setOwner(null,\n                       null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void setPosixFilePermissions() {\n        Files.setPosixFilePermissions(newTempDir(),\n                                      Collections.<PosixFilePermission>emptySet());\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void setPosixFilePermissionsNoSuchFileException() {\n        Files.setPosixFilePermissions(Paths.get(\"/some/path\"),\n                                      Collections.<PosixFilePermission>emptySet());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void setPosixFilePermissionsNull() {\n        Files.setPosixFilePermissions(newTempDir(),\n                                      null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void setPosixFilePermissionsNull2() {\n        Files.setPosixFilePermissions(null,\n                                      Collections.<PosixFilePermission>emptySet());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull() {\n        Files.newDirectoryStream(null);\n    }\n\n    @Test(expected = NotDirectoryException.class)\n    public void newDirectoryStreamNonDirecotory() {\n        Files.newDirectoryStream(Files.createTempFile(\"foo\",\n                                                      \"bar\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull2() {\n        Files.newDirectoryStream(null,\n                                 new DirectoryStream.Filter<Path>() {\n                                     @Override\n                                     public boolean accept(Path entry) throws IOException {\n                                         return true;\n                                     }\n                                 });\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull3() {\n        Files.newDirectoryStream(newTempDir(),\n                                 (DirectoryStream.Filter<Path>) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull4() {\n        Files.newDirectoryStream(null,\n                                 (DirectoryStream.Filter<Path>) null);\n    }\n\n    @Test(expected = NotDirectoryException.class)\n    public void newDirectoryStreamNotDirecotory2() {\n        Files.newDirectoryStream(Files.createTempFile(\"foo\",\n                                                      \"bar\"),\n                                 new DirectoryStream.Filter<Path>() {\n                                     @Override\n                                     public boolean accept(Path entry) throws IOException {\n                                         return false;\n                                     }\n                                 });\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull5() {\n        Files.newDirectoryStream(null,\n                                 \"*.*\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull6() {\n        Files.newDirectoryStream(newTempDir(),\n                                 (String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamEmpty() {\n        Files.newDirectoryStream(newTempDir(),\n                                 \"\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull7() {\n        Files.newDirectoryStream(null,\n                                 (String) null);\n    }\n\n    @Test(expected = NotDirectoryException.class)\n    public void newDirectoryStreamNotDirecotory3() {\n        Files.newDirectoryStream(Files.createTempFile(\"foo\",\n                                                      \"bar\"),\n                                 \"*.*\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void createSymbolicLink() {\n        Files.createSymbolicLink(Paths.get(\"/path/some/place.link\"),\n                                 Files.createTempFile(\"foo\",\n                                                      \"bar\"));\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void createSymbolicLinkIllegalStateException1() {\n        Files.createSymbolicLink(Files.createTempFile(\"foo\",\n                                                      \"bar\"),\n                                 Files.createTempFile(\"foo\",\n                                                      \"bar\"));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void createSymbolicLinkIllegalStateException2() {\n        final Path path = Files.createTempFile(\"foo\",\n                                               \"bar\");\n        Files.createSymbolicLink(path,\n                                 path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull1() {\n        Files.createSymbolicLink(null,\n                                 Files.createTempFile(\"foo\",\n                                                      \"bar\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull2() {\n        Files.createSymbolicLink(Paths.get(\"/path/some/place.link\"),\n                                 null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull3() {\n        Files.createSymbolicLink(null,\n                                 null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void createLink() {\n        Files.createLink(Paths.get(\"/path/some/place.link\"),\n                         Files.createTempFile(\"foo\",\n                                              \"bar\"));\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void createLinkIllegalStateException1() {\n        Files.createLink(Files.createTempFile(\"foo\",\n                                              \"bar\"),\n                         Files.createTempFile(\"foo\",\n                                              \"bar\"));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void createLinkIllegalStateException2() {\n        final Path path = Files.createTempFile(\"foo\",\n                                               \"bar\");\n        Files.createLink(path,\n                         path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull1() {\n        Files.createLink(null,\n                         Files.createTempFile(\"foo\",\n                                              \"bar\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull2() {\n        Files.createLink(Paths.get(\"/path/some/place.link\"),\n                         null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull3() {\n        Files.createSymbolicLink(null,\n                                 null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void readSymbolicLink() {\n        Files.readSymbolicLink(Files.createTempFile(\"foo\",\n                                                    \"bar\"));\n    }\n\n    @Test(expected = NotLinkException.class)\n    public void readSymbolicLinkNotLink() {\n        Files.readSymbolicLink(Paths.get(\"/some/file/link.lnk\"));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void readSymbolicLinkNull() {\n        Files.readSymbolicLink(null);\n    }\n\n//walkFileTree\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/PathsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.net.URI;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class PathsTest {\n\n    @Test\n    public void simpleGet() {\n        final Path path = Paths.get(\"/path/to/file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n    }\n\n    @Test\n    public void simplePartitionedGet() {\n        final Path path = Paths.get(\"/path\",\n                                    \"to\",\n                                    \"file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n\n        assertThat(path).isEqualTo(Paths.get(\"/path/to/file.txt\"));\n    }\n\n    @Test\n    public void simpleWindowsGet() {\n        final Path path = Paths.get(\"c:\\\\path\\\\to\\\\file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"c:\\\\path\\\\to\\\\file.txt\");\n    }\n\n    @Test\n    public void simplePartitionedWindowsGet() {\n        final Path path = Paths.get(\"c:\\\\path\",\n                                    \"to\",\n                                    \"file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n\n        assertThat(path.toString()).isEqualTo(\"c:\\\\path\" + \"\\\\\" + \"to\" + \"\\\\\" + \"file.txt\");\n    }\n\n    @Test\n    public void simpleGetButUsingURIAsString() {\n        final Path path = Paths.get(\"file:///path/to/file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n\n        assertThat(path).isEqualTo(Paths.get(\"/path/to/file.txt\"));\n    }\n\n    @Test\n    public void simpleGetButUsingURIAsStringAndDefaultScheme() {\n        final Path path = Paths.get(\"default:///path/to/file.txt\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n\n        assertThat(path).isEqualTo(Paths.get(\"/path/to/file.txt\"));\n    }\n\n    @Test\n    public void simpleGetURI() {\n        final Path path = Paths.get(URI.create(\"file:///path/to/file.txt\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n\n        assertThat(path).isEqualTo(Paths.get(\"/path/to/file.txt\"));\n    }\n\n    @Test\n    public void simpleGetEmpty() {\n        final Path path = Paths.get(\"\");\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void simpleGetNull1() {\n        Paths.get((String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void simpleGetNull2() {\n        Paths.get((URI) null);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/java/org/uberfire/java/nio/file/SimpleFileVisitorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.util.concurrent.atomic.AtomicInteger;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.fail;\n\npublic class SimpleFileVisitorTest extends AbstractBaseTest {\n\n    final AtomicInteger preDir = new AtomicInteger();\n    final AtomicInteger postDir = new AtomicInteger();\n    final AtomicInteger fileC = new AtomicInteger();\n    final AtomicInteger failFile = new AtomicInteger();\n\n    final SimpleFileVisitor<Path> simple = new SimpleFileVisitor<Path>() {\n\n        @Override\n        public FileVisitResult preVisitDirectory(Path dir,\n                                                 BasicFileAttributes attrs) throws IOException {\n            preDir.addAndGet(1);\n            return super.preVisitDirectory(dir,\n                                           attrs);\n        }\n\n        @Override\n        public FileVisitResult visitFile(Path file,\n                                         BasicFileAttributes attrs) throws IOException {\n            fileC.addAndGet(1);\n            return super.visitFile(file,\n                                   attrs);\n        }\n\n        @Override\n        public FileVisitResult visitFileFailed(Path file,\n                                               IOException exc) throws IOException {\n            failFile.addAndGet(1);\n            return super.visitFileFailed(file,\n                                         exc);\n        }\n\n        @Override\n        public FileVisitResult postVisitDirectory(Path dir,\n                                                  IOException exc) throws IOException {\n            postDir.addAndGet(1);\n            return super.postVisitDirectory(dir,\n                                            exc);\n        }\n    };\n\n    @Test\n    public void testWalker() {\n\n        final Path dir = newTempDir(null);\n\n        final Path file1 = Files.createTempFile(dir,\n                                                \"foo\",\n                                                \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        Files.walkFileTree(dir,\n                           simple);\n\n        assertThat(preDir.get()).isEqualTo(1);\n        assertThat(postDir.get()).isEqualTo(1);\n        assertThat(fileC.get()).isEqualTo(2);\n        assertThat(failFile.get()).isEqualTo(0);\n\n        cleanupVisitor();\n        Files.walkFileTree(file1,\n                           simple);\n\n        assertThat(preDir.get()).isEqualTo(0);\n        assertThat(postDir.get()).isEqualTo(0);\n        assertThat(fileC.get()).isEqualTo(1);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep2() {\n        final Path dir = newTempDir(null);\n        final Path subDir = newTempDir(dir);\n        final Path subSubDir = newTempDir(subDir);\n        newTempDir(subSubDir);\n\n        cleanupVisitor();\n        Files.walkFileTree(dir,\n                           simple);\n\n        assertThat(preDir.get()).isEqualTo(4);\n        assertThat(postDir.get()).isEqualTo(4);\n        assertThat(fileC.get()).isEqualTo(0);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testWalkerDeep1() {\n        final Path dir = newTempDir(null);\n        final Path subDir = newTempDir(dir);\n        final Path subSubDir = newTempDir(subDir);\n        final Path subSubSubDir = newTempDir(subSubDir);\n\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n        Files.createTempFile(dir,\n                             \"foo\",\n                             \"bar\");\n\n        cleanupVisitor();\n        Files.walkFileTree(dir,\n                           simple);\n\n        assertThat(preDir.get()).isEqualTo(4);\n        assertThat(postDir.get()).isEqualTo(4);\n        assertThat(fileC.get()).isEqualTo(2);\n        assertThat(failFile.get()).isEqualTo(0);\n    }\n\n    @Test\n    public void testException() {\n        final Path dir = newTempDir(null);\n\n        final Path file = Files.createTempFile(dir,\n                                               \"foo\",\n                                               \"bar\");\n\n        final IOException myException = new IOException();\n\n        try {\n            simple.visitFileFailed(file,\n                                   myException);\n            fail(\"should throw an exception\");\n        } catch (Exception ex) {\n            assertThat(ex).isEqualTo(myException);\n        }\n\n        try {\n            simple.postVisitDirectory(file,\n                                      myException);\n            fail(\"should throw an exception\");\n        } catch (Exception ex) {\n            assertThat(ex).isEqualTo(myException);\n        }\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void preVisitDirectoryNull1() {\n        final Path dir = newTempDir(null);\n        final Path file = Files.createTempFile(dir,\n                                               \"foo\",\n                                               \"bar\");\n\n        simple.preVisitDirectory(null,\n                                 Files.readAttributes(file,\n                                                      BasicFileAttributes.class));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void preVisitDirectoryNull2() {\n        final Path dir = newTempDir(null);\n\n        simple.preVisitDirectory(dir,\n                                 null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void preVisitDirectoryNull3() {\n        simple.preVisitDirectory(null,\n                                 null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileNull1() {\n        final Path dir = newTempDir(null);\n        final Path file = Files.createTempFile(dir,\n                                               \"foo\",\n                                               \"bar\");\n\n        simple.visitFile(null,\n                         Files.readAttributes(file,\n                                              BasicFileAttributes.class));\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileNull2() {\n        final Path dir = newTempDir(null);\n\n        simple.visitFile(dir,\n                         null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileNull3() {\n        simple.visitFile(null,\n                         null);\n    }\n\n    @Test\n    public void postVisitDirectoryNull1() {\n        final Path dir = newTempDir(null);\n        final Path file = Files.createTempFile(dir,\n                                               \"foo\",\n                                               \"bar\");\n\n        simple.postVisitDirectory(dir,\n                                  null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void postVisitDirectoryNull2() {\n        simple.postVisitDirectory(null,\n                                  new IOException());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void postVisitDirectoryNull3() {\n        simple.postVisitDirectory(null,\n                                  null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileFailedNull1() {\n        final Path dir = newTempDir(null);\n        final Path file = Files.createTempFile(dir,\n                                               \"foo\",\n                                               \"bar\");\n\n        simple.visitFileFailed(file,\n                               null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileFailedNull2() {\n        simple.visitFileFailed(null,\n                               new IOException());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void visitFileFailedNull3() {\n        simple.visitFileFailed(null,\n                               null);\n    }\n\n    protected void cleanupVisitor() {\n        preDir.set(0);\n        postDir.set(0);\n        fileC.set(0);\n        failFile.set(0);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-api/src/test/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire\" level=\"info\"/>\n\n  <root level=\"warn\">\n    <appender-ref ref=\"consoleAppender\"/>\n  </root>\n\n</configuration>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-backport</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-impls</artifactId>\n  <packaging>pom</packaging>\n\n  <name>Uberfire NIO.2 :: Implementations</name>\n\n  <modules>\n    <module>uberfire-nio2-fs</module>\n    <module>uberfire-nio2-jgit</module>\n    <module>uberfire-nio2-k8s</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-impls</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-fs</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire NIO.2 :: File System Impl</name>\n  <description>UberFire NIO.2 :: File System Impl</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/BaseSimpleFileStore.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileStoreAttributeView;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic abstract class BaseSimpleFileStore implements FileStore {\n\n    BaseSimpleFileStore(final Path path) {\n    }\n\n    BaseSimpleFileStore(final File[] roots,\n                        final Path path) {\n    }\n\n    @Override\n    public String type() {\n        return null;\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n\n    @Override\n    public boolean supportsFileAttributeView(final Class<? extends FileAttributeView> type) {\n        checkNotNull(\"type\",\n                     type);\n\n        if (type.equals(BasicFileAttributeView.class)) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public boolean supportsFileAttributeView(final String name) {\n        checkNotEmpty(\"name\",\n                      name);\n\n        if (name.equals(\"basic\")) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {\n        checkNotNull(\"type\",\n                     type);\n\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(final String attribute) throws UnsupportedOperationException, IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n\n        if (attribute.equals(\"totalSpace\")) {\n            return getTotalSpace();\n        }\n        if (attribute.equals(\"usableSpace\")) {\n            return getUsableSpace();\n        }\n        if (attribute.equals(\"readOnly\")) {\n            return isReadOnly();\n        }\n        if (attribute.equals(\"name\")) {\n            return name();\n        }\n        throw new UnsupportedOperationException(\"Attribute '\" + attribute + \"' not available\");\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (o == null) {\n            return false;\n        }\n        if (!(o instanceof FileStore)) {\n            return false;\n        }\n\n        final FileStore ofs = (FileStore) o;\n\n        return name().equals(ofs.name());\n    }\n\n    @Override\n    public int hashCode() {\n        return name().hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/BaseSimpleFileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\nimport java.util.regex.PatternSyntaxException;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.PathMatcher;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic abstract class BaseSimpleFileSystem implements FileSystem,\n                                                      FileSystemId {\n\n    public static final char UNIX_SEPARATOR = '/';\n    public static final char WINDOWS_SEPARATOR = '\\\\';\n    public static final String UNIX_SEPARATOR_STRING = \"/\";\n    public static final String WINDOWS_SEPARATOR_STRING = \"\\\\\";\n\n    private final FileSystemProvider provider;\n    private final String defaultDirectory;\n    private final Set<String> supportedFileAttributeViews;\n    private final File[] roots;\n    private final String name;\n\n    BaseSimpleFileSystem(final FileSystemProvider provider,\n                         final String path) {\n        this(File.listRoots(),\n             provider,\n             path);\n    }\n\n    BaseSimpleFileSystem(final File[] roots,\n                         final FileSystemProvider provider,\n                         final String path) {\n        checkNotNull(\"roots\",\n                     roots);\n        checkCondition(\"should have at least one root\",\n                       roots.length > 0);\n        this.name = path != null ? path : id();\n        this.roots = roots;\n        this.provider = provider;\n        this.defaultDirectory = validateDefaultDir(path);\n        this.supportedFileAttributeViews = Collections.unmodifiableSet(new HashSet<String>() {{\n            add(\"basic\");\n        }});\n    }\n\n    @Override\n    public String id() {\n        return \"/\";\n    }\n\n    private String validateDefaultDir(final String path) throws IllegalArgumentException {\n        checkNotEmpty(\"path\",\n                      path);\n        if (!GeneralPathImpl.create(this,\n                                    path,\n                                    false).isAbsolute()) {\n            throw new IllegalArgumentException(\"Path needs to be absolute, got: \" + path);\n        }\n        return path;\n    }\n\n    @Override\n    public FileSystemProvider provider() {\n        return provider;\n    }\n\n    @Override\n    public boolean isOpen() {\n        return true;\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n\n    @Override\n    public String getSeparator() {\n        return System.getProperty(\"file.separator\",\n                                  UNIX_SEPARATOR_STRING);\n    }\n\n    public String getSeparator(final String path) {\n        int unixIndex = path.indexOf(UNIX_SEPARATOR);\n        int windowsIndex = path.indexOf(WINDOWS_SEPARATOR);\n        if (unixIndex >= 0) {\n            if (windowsIndex >= 0) {\n                // path contains a mix of '/' and '\\' so pick the first one\n                return (unixIndex < windowsIndex) ? UNIX_SEPARATOR_STRING : WINDOWS_SEPARATOR_STRING;\n            } else {\n                return UNIX_SEPARATOR_STRING;\n            }\n        } else {\n            if (windowsIndex >= 0) {\n                return WINDOWS_SEPARATOR_STRING;\n            }\n        }\n        return getSeparator();\n    }\n\n    @Override\n    public Set<String> supportedFileAttributeViews() {\n        return supportedFileAttributeViews;\n    }\n\n    @Override\n    public Path getPath(String first,\n                        String... more) throws InvalidPathException {\n        if (more == null || more.length == 0) {\n            return GeneralPathImpl.create(this,\n                                          removeTrailingSlash(first),\n                                          false);\n        }\n        final StringBuilder sb = new StringBuilder();\n        sb.append(removeTrailingSlash(first));\n        String separator = getSeparator(first);\n        for (final String segment : more) {\n            if (segment.length() > 0) {\n                if (sb.length() > 0 && sb.lastIndexOf(separator) != sb.length()-1) {\n                    sb.append(separator);\n                }\n                sb.append(segment);\n            }\n        }\n        return GeneralPathImpl.create(this,\n                                      sb.toString(),\n                                      false);\n    }\n\n    private String removeTrailingSlash(final String path) {\n        if (path.equals(\"/\")) {\n            return path;\n        }\n        for (final File root : roots) {\n            if (root.toString().equals(path)) {\n                return path;\n            }\n        }\n        if (path.endsWith(UNIX_SEPARATOR_STRING)) {\n            return path.substring(0, path.length() - UNIX_SEPARATOR_STRING.length());\n        }\n        if (path.endsWith(WINDOWS_SEPARATOR_STRING)) {\n            return path.substring(0, path.length() - WINDOWS_SEPARATOR_STRING.length());\n        }\n        return path;\n    }\n\n    @Override\n    public PathMatcher getPathMatcher(String syntaxAndPattern)\n            throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public UserPrincipalLookupService getUserPrincipalLookupService()\n            throws UnsupportedOperationException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public WatchService newWatchService()\n            throws UnsupportedOperationException, IOException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void close() throws IOException, UnsupportedOperationException {\n        throw new UnsupportedOperationException(\"can't close this file system.\");\n    }\n\n    File[] listRoots() {\n        return roots;\n    }\n\n    @Override\n    public String toString() {\n        return \"file://\" + id();\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleBasicFileAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.FileTimeImpl;\nimport org.uberfire.java.nio.base.LazyAttrLoader;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n *\n */\npublic class SimpleBasicFileAttributeView extends AbstractBasicFileAttributeView<Path> {\n\n    private BasicFileAttributes attrs = null;\n\n    public SimpleBasicFileAttributeView(final Path path) {\n        super(path);\n    }\n\n    @Override\n    public <T extends BasicFileAttributes> T readAttributes() throws IOException {\n        if (attrs == null) {\n            final File file = path.toFile();\n            this.attrs = new BasicFileAttributesImpl(path.toString(),\n                                                     new FileTimeImpl(file.lastModified()),\n                                                     null,\n                                                     null,\n                                                     new LazyAttrLoader<Long>() {\n                                                         private Long size = null;\n\n                                                         @Override\n                                                         public Long get() {\n                                                             if (size == null) {\n                                                                 size = file.length();\n                                                             }\n\n                                                             return size;\n                                                         }\n                                                     },\n                                                     file.isFile(),\n                                                     file.isDirectory());\n        }\n        return (T) attrs;\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{BasicFileAttributeView.class, SimpleBasicFileAttributeView.class};\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleFileSystemProvider.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.RandomAccessFile;\nimport java.net.URI;\nimport java.nio.channels.FileChannel;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.concurrent.ExecutorService;\n\nimport org.apache.commons.io.FileUtils;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.ExtendedAttributeView;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.base.SeekableByteChannelFileBasedImpl;\nimport org.uberfire.java.nio.channels.AsynchronousFileChannel;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.NotLinkException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.StandardOpenOption.READ;\nimport static org.uberfire.java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;\n\npublic class SimpleFileSystemProvider implements FileSystemProvider {\n\n    private static final String STREAM_CLOSED = \"This stream is closed.\";\n    private static final String USER_DIR = \"user.dir\";\n    protected BaseSimpleFileSystem fileSystem;\n    private final OSType osType;\n    private final File[] roots;\n    private boolean isDefault;\n\n    public SimpleFileSystemProvider() {\n        this(File.listRoots(),\n             OSType.currentOS());\n    }\n\n    protected SimpleFileSystemProvider(final File[] roots,\n                                       final OSType osType) {\n        final String defaultPath = System.getProperty(USER_DIR);\n        this.osType = checkNotNull(\"osType\", osType);\n\n        if (osType == OSType.WINDOWS) {\n            this.roots = checkNotNull(\"roots\", roots);\n            this.fileSystem = new SimpleWindowsFileSystem(this, defaultPath);\n        } else {\n            this.roots = roots;\n            if (roots != null) {\n                this.fileSystem = new SimpleUnixFileSystem(this, defaultPath);\n            }\n        }\n    }\n\n    @Override\n    public synchronized void forceAsDefault() {\n        this.isDefault = true;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return isDefault;\n    }\n\n    @Override\n    public String getScheme() {\n        return \"file\";\n    }\n\n    @Override\n    public FileSystem getFileSystem(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return getDefaultFileSystem();\n    }\n\n    @Override\n    public Path getPath(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkCondition(\"uri scheme not supported\",\n                       uri.getScheme().equals(getScheme()) || uri.getScheme().equals(\"default\"));\n\n        return getDefaultFileSystem().getPath(uri.getPath());\n    }\n\n    @Override\n    public FileSystem newFileSystem(final URI uri,\n                                    final Map<String, ?> env)\n            throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkNotNull(\"env\",\n                     env);\n        throw new FileSystemAlreadyExistsException(uri.toString());\n    }\n\n    @Override\n    public FileSystem newFileSystem(final Path path,\n                                    final Map<String, ?> env)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"env\",\n                     env);\n        throw new FileSystemAlreadyExistsException(path.toString());\n    }\n\n    @Override\n    public InputStream newInputStream(final Path path,\n                                      final OpenOption... options)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        final File file = path.toFile();\n        if (!file.exists()) {\n            throw new NoSuchFileException(file.toString());\n        }\n        try {\n            return new FileInputStream(path.toFile());\n        } catch (FileNotFoundException e) {\n            throw new NoSuchFileException(e.getMessage());\n        }\n    }\n\n    @Override\n    public OutputStream newOutputStream(final Path path,\n                                        final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        try {\n            return new FileOutputStream(path.toFile());\n        } catch (Exception e) {\n            throw new IOException(\"Could not open output stream.\",\n                                  e);\n        }\n    }\n\n    @Override\n    public FileChannel newFileChannel(final Path path,\n                                      final Set<? extends OpenOption> options,\n                                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        return ((FileOutputStream) newOutputStream(path)).getChannel();\n    }\n\n    @Override\n    public AsynchronousFileChannel newAsynchronousFileChannel(final Path path,\n                                                              final Set<? extends OpenOption> options,\n                                                              final ExecutorService executor,\n                                                              FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final Set<? extends OpenOption> options,\n                                              final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        final File file = checkNotNull(\"path\",\n                                       path).toFile();\n\n        if (file.exists()) {\n            if (!shouldCreateOrOpenAByteChannel(options)) {\n                throw new FileAlreadyExistsException(path.toString());\n            }\n        }\n\n        try {\n            if (options != null && options.contains(READ)) {\n                return openAByteChannel(path);\n            } else {\n                return createANewByteChannel(file);\n            }\n        } catch (java.io.IOException e) {\n            throw new IOException(\"Failed to open or create a byte channel.\",\n                                  e);\n        }\n    }\n\n    private SeekableByteChannelFileBasedImpl createANewByteChannel(final File file) throws FileNotFoundException {\n        return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(file,\n                                                                         \"rw\").getChannel()) {\n            @Override\n            public void close() throws java.io.IOException {\n                super.close();\n            }\n        };\n    }\n\n    private SeekableByteChannelFileBasedImpl openAByteChannel(Path path) throws FileNotFoundException {\n        return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(path.toFile(),\n                                                                         \"r\").getChannel());\n    }\n\n    private boolean shouldCreateOrOpenAByteChannel(final Set<? extends OpenOption> options) {\n        return (options != null && (options.contains(TRUNCATE_EXISTING) || options.contains(READ)));\n    }\n\n    @Override\n    public void createDirectory(final Path dir,\n                                final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"dir\",\n                     dir);\n        final Path realDir = dir.toAbsolutePath();\n        checkFileExistsThenThrow(realDir);\n        realDir.toFile().mkdirs();\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path dir,\n                                                    final DirectoryStream.Filter<Path> filter)\n            throws NotDirectoryException, IOException, SecurityException {\n        checkNotNull(\"filter\", filter);\n        final Path[] content = getDirectoryContent(dir);\n        return new DirectoryStream<Path>() {\n            boolean isClosed = false;\n\n            @Override\n            public void close() throws IOException {\n                if (isClosed) {\n                    throw new IOException(STREAM_CLOSED);\n                }\n                isClosed = true;\n            }\n\n            @Override\n            public Iterator<Path> iterator() {\n                if (isClosed) {\n                    throw new IOException(STREAM_CLOSED);\n                }\n                return new Iterator<Path>() {\n                    public boolean atEof = false;\n                    private int i = -1;\n                    private Path nextEntry = null;\n\n                    @Override\n                    public boolean hasNext() {\n                        if (isClosed) {\n                            throw new IOException(STREAM_CLOSED);\n                        }\n                        if (nextEntry == null && !atEof) {\n                            nextEntry = readNextEntry();\n                        }\n                        return nextEntry != null;\n                    }\n\n                    @Override\n                    public Path next() {\n                        final Path result;\n                        if (isClosed) {\n                            throw new IOException(STREAM_CLOSED);\n                        }\n                        if (nextEntry == null && !atEof) {\n                            result = readNextEntry();\n                        } else {\n                            result = nextEntry;\n                            nextEntry = null;\n                        }\n                        if (result == null) {\n                            throw new NoSuchElementException();\n                        }\n                        return result;\n                    }\n\n                    private Path readNextEntry() {\n                        if (atEof) {\n                            return null;\n                        }\n\n                        Path result = null;\n                        while (true) {\n                            i++;\n                            if (i >= content.length) {\n                                atEof = true;\n                                break;\n                            }\n\n                            final Path path = content[i];\n                            if (filter.accept(path)) {\n                                result = path;\n                                break;\n                            }\n                        }\n\n                        return result;\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    protected Path[] getDirectoryContent(final Path dir) {\n        final File file = checkNotNull(\"dir\", dir).toFile();\n        if (!file.isDirectory()) {\n            throw new NotDirectoryException(dir.toString());\n        }\n    \n        final File[] content = file.listFiles();\n        if (content == null) {\n            throw new NotDirectoryException(dir.toString());\n        }\n    \n        return Arrays.stream(content)\n                     .map(fileItem -> GeneralPathImpl.newFromFile(getDefaultFileSystem(), fileItem))\n                     .toArray(Path[]::new);\n    }\n\n    @Override\n    public void createSymbolicLink(final Path link,\n                                   final Path target,\n                                   final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n        checkNotNull(\"target\",\n                     target);\n        checkCondition(\"link and target can't be same\",\n                       !link.equals(target));\n        checkCondition(\"target must already exists\",\n                       target.toFile().exists());\n\n        checkFileExistsThenThrow(link);\n\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void createLink(final Path link,\n                           final Path existing)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n        checkNotNull(\"existing\",\n                     existing);\n        checkCondition(\"existing must already exists\",\n                       existing.toFile().exists());\n        checkCondition(\"link and target can't be same\",\n                       !link.equals(existing));\n\n        checkFileExistsThenThrow(link);\n\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options) throws NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        checkFileNotExistThenThrow(path, false);\n\n        deleteIfExists(path,\n                       options);\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path,\n                                  final DeleteOption... options)\n            throws DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        synchronized (this) {\n\n            final File file = path.toFile();\n            try {\n                if (file.isDirectory() && !deleteNonEmptyDirectory(options) && file.list().length > 0) {\n                    throw new DirectoryNotEmptyException(path.toString());\n                }\n\n                final boolean result = file.exists();\n\n                try {\n                    FileUtils.forceDelete(file);\n                } catch (final FileNotFoundException ignore) {\n                } catch (java.io.IOException e) {\n                    throw new IOException(e);\n                }\n\n                return result;\n            } finally {\n                toGeneralPathImpl(path).clearCache();\n            }\n        }\n    }\n\n    private boolean deleteNonEmptyDirectory(final DeleteOption... options) {\n\n        for (final DeleteOption option : options) {\n            if (option.equals(StandardDeleteOption.NON_EMPTY_DIRECTORIES)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    @Override\n    public Path readSymbolicLink(final Path link)\n            throws UnsupportedOperationException, NotLinkException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n\n        checkFileNotExistThenThrow(link, true);\n\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public boolean isSameFile(final Path path,\n                              final Path path2)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"path2\",\n                     path2);\n\n        return path.equals(path2);\n    }\n\n    @Override\n    public boolean isHidden(final Path path) throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return path.toFile().isHidden();\n    }\n\n    @Override\n    public void checkAccess(final Path path,\n                            AccessMode... modes)\n            throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"modes\",\n                     modes);\n\n        checkFileNotExistThenThrow(path, false);\n\n        if (path.toFile() != null) {\n            for (final AccessMode mode : modes) {\n                checkNotNull(\"mode\",\n                             mode);\n                switch (mode) {\n                    case READ:\n                        if (!path.toFile().canRead()) {\n                            throw new AccessDeniedException(path.toString());\n                        }\n                        break;\n                    case EXECUTE:\n                        if (!path.toFile().canExecute()) {\n                            throw new AccessDeniedException(path.toString());\n                        }\n                        break;\n                    case WRITE:\n                        if (!path.toFile().canWrite()) {\n                            throw new AccessDeniedException(path.toString());\n                        }\n                        break;\n                }\n            }\n        }\n    }\n\n    @Override\n    public FileStore getFileStore(final Path path) throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        if (osType == OSType.WINDOWS) {\n            return new SimpleWindowsFileStore(roots,\n                                              path);\n        }\n        return new SimpleUnixFileStore(path);\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                                final Class<V> type,\n                                                                final LinkOption... options)\n            throws NoSuchFileException {\n        checkNotNull(\"path\", path);\n        checkNotNull(\"type\", type);\n        checkFileNotExistThenThrow(path, false);\n\n        final GeneralPathImpl gPath = toGeneralPathImpl(path);\n\n        final V view = gPath.getAttrView(type);\n        if (view == null) {\n            return createFileAttributeView(gPath, type);\n        } else {\n            return view;\n        }\n    }\n\n    protected <V extends FileAttributeView> V createFileAttributeView(final GeneralPathImpl path,\n                                                                      final Class<V> type) {\n        if (type == BasicFileAttributeView.class || type == SimpleBasicFileAttributeView.class) {\n            final V newView = (V) new SimpleBasicFileAttributeView(path);\n            path.addAttrView(newView);\n            return newView;\n        } else {\n            return null;\n        }\n    }\n\n    private ExtendedAttributeView getFileAttributeView(final Path path,\n                                                       final String name,\n                                                       final LinkOption... options) {\n        final GeneralPathImpl gPath = toGeneralPathImpl(path);\n        final ExtendedAttributeView view = gPath.getAttrView(name);\n        if (view == null && name.equals(\"basic\")) {\n            return createFileAttributeView(gPath, SimpleBasicFileAttributeView.class);\n        } else {\n            return view;\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public <A extends BasicFileAttributes> A readAttributes(final Path path,\n                                                            final Class<A> type,\n                                                            final LinkOption... options)\n            throws NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"type\",\n                     type);\n\n        checkFileNotExistThenThrow(path, false);\n\n        if (type == BasicFileAttributesImpl.class || type == BasicFileAttributes.class) {\n            final SimpleBasicFileAttributeView view = getFileAttributeView(path,\n                                                                           SimpleBasicFileAttributeView.class,\n                                                                           options);\n            return (A) view.readAttributes();\n        }\n\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path,\n                                              final String attributes,\n                                              final LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attributes);\n\n        final String[] s = split(attributes);\n        if (s[0].length() == 0) {\n            throw new IllegalArgumentException(attributes);\n        }\n\n        final ExtendedAttributeView view = getFileAttributeView(path,\n                                                                s[0],\n                                                                options);\n        if (view == null) {\n            throw new UnsupportedOperationException(\"View '\" + s[0] + \"' not available\");\n        }\n        return view.readAttributes(s[1].split(\",\"));\n    }\n\n    @Override\n    public void setAttribute(final Path path,\n                             final String attribute,\n                             final Object value,\n                             final LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attribute);\n\n        final String[] s = split(attribute);\n        if (s[0].length() == 0) {\n            throw new IllegalArgumentException(attribute);\n        }\n        final ExtendedAttributeView view = getFileAttributeView(path,\n                                                                s[0],\n                                                                options);\n        if (view == null) {\n            throw new UnsupportedOperationException(\"View '\" + s[0] + \"' not available\");\n        }\n        view.setAttribute(attribute,\n                          value);\n    }\n\n    @Override\n    public void copy(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n        checkCondition(\"source must exist\",\n                       source.toFile().exists());\n\n        checkFileExistsThenThrow(target);\n        if (source.toFile().isDirectory() && source.toFile().list().length > 0) {\n            throw new DirectoryNotEmptyException(source.toString());\n        }\n\n        try {\n            if (source.toFile().isDirectory()) {\n                FileUtils.copyDirectory(source.toFile(),\n                                        target.toFile());\n            } else {\n                FileUtils.copyFile(source.toFile(),\n                                   target.toFile());\n            }\n        } catch (java.io.IOException ex) {\n            throw new IOException(ex);\n        }\n    }\n\n    @Override\n    public void move(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n        checkCondition(\"source must exist\",\n                       source.toFile().exists());\n\n        checkFileExistsThenThrow(target);\n\n        if (source.toFile().isDirectory() && source.toFile().list().length > 0) {\n            throw new DirectoryNotEmptyException(source.toString());\n        }\n\n        try {\n            if (source.toFile().isDirectory()) {\n                FileUtils.moveDirectory(source.toFile(),\n                                        target.toFile());\n            } else {\n                FileUtils.moveFile(source.toFile(),\n                                   target.toFile());\n            }\n        } catch (java.io.IOException ex) {\n            throw new IOException(ex);\n        }\n    }\n\n    protected FileSystem getDefaultFileSystem() {\n        return fileSystem;\n    }\n\n    protected GeneralPathImpl toGeneralPathImpl(final Path path) {\n        if (path instanceof GeneralPathImpl) {\n            return (GeneralPathImpl) path;\n        }\n        return GeneralPathImpl.create(fileSystem,\n                                      path.toString(),\n                                      false);\n    }\n\n    protected String[] split(final String attribute) {\n        final String[] s = new String[2];\n        final int pos = attribute.indexOf(':');\n        if (pos == -1) {\n            s[0] = \"basic\";\n            s[1] = attribute;\n        } else {\n            s[0] = attribute.substring(0,\n                                       pos);\n            s[1] = (pos == attribute.length()) ? \"\" : attribute.substring(pos + 1);\n        }\n        return s;\n    }\n\n    protected void checkFileNotExistThenThrow(final Path path, final boolean isLink) {\n        if (!path.toFile().exists()) {\n            if (isLink) {\n                throw new NotLinkException(path.toString());\n            } else {\n                throw new NoSuchFileException(path.toString());\n            }\n        }\n    }\n\n    protected void checkFileExistsThenThrow(final Path path) {\n        if (path.toFile().exists()) {\n            throw new FileAlreadyExistsException(path.toString());\n        }\n    }\n\n    public enum OSType {\n        WINDOWS,\n        UNIX_LIKE;\n\n        public static OSType currentOS() {\n            if (System.getProperty(\"os.name\").toLowerCase().indexOf(\"win\") >= 0) {\n                return WINDOWS;\n            }\n            return UNIX_LIKE;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleUnixFileStore.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.Path;\n\npublic class SimpleUnixFileStore extends BaseSimpleFileStore {\n\n    protected SimpleUnixFileStore(final Path path) {\n        super(path);\n    }\n\n    @Override\n    public String name() {\n        return \"/\";\n    }\n\n    @Override\n    public long getTotalSpace() throws IOException {\n        return File.listRoots()[0].getTotalSpace();\n    }\n\n    @Override\n    public long getUsableSpace() throws IOException {\n        return File.listRoots()[0].getUsableSpace();\n    }\n\n    @Override\n    public long getUnallocatedSpace() throws IOException {\n        throw new UnsupportedOperationException();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleUnixFileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic class SimpleUnixFileSystem extends BaseSimpleFileSystem {\n\n    protected FileStore fileStore;\n\n    protected SimpleUnixFileSystem(final FileSystemProvider provider,\n                         final String path) {\n        super(provider,path);\n        fileStore = new SimpleUnixFileStore(null);\n    }\n\n    @Override\n    public Path getPath(String first, String... more) {\n        if (UNIX_SEPARATOR_STRING.equals(first) && (more == null || more.length == 0)) {\n            return GeneralPathImpl.createRoot(this, UNIX_SEPARATOR_STRING, false);\n        } else {\n            return super.getPath(first, more);\n        }\n    }\n\n    @Override\n    public Iterable<Path> getRootDirectories() {\n        return new Iterable<Path>() {\n            @Override\n            public Iterator<Path> iterator() {\n                return new Iterator<Path>() {\n                    private int i = 0;\n\n                    @Override\n                    public boolean hasNext() {\n                        return i < 1;\n                    }\n\n                    @Override\n                    public Path next() {\n                        if (i < 1) {\n                            i++;\n                            return getPath(\"/\");\n                        } else {\n                            throw new NoSuchElementException();\n                        }\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    @Override\n    public Iterable<FileStore> getFileStores() {\n        return new Iterable<FileStore>() {\n            @Override\n            public Iterator<FileStore> iterator() {\n                return new Iterator<FileStore>() {\n                    private int i = 0;\n\n                    @Override\n                    public boolean hasNext() {\n                        return i < 1;\n                    }\n\n                    @Override\n                    public FileStore next() {\n                        if (i < 1) {\n                            i++;\n                            return fileStore;\n                        } else {\n                            throw new NoSuchElementException();\n                        }\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    @Override\n    public void dispose() {\n        close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleWindowsFileStore.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic class SimpleWindowsFileStore extends BaseSimpleFileStore {\n\n    private static final Set<String> EXCLUDED_DRIVERS = new HashSet<String>() {{\n        add(\"A\");\n        add(\"B\");\n    }};\n    private final File[] roots;\n    private int fstoreIndex = -1;\n\n    public SimpleWindowsFileStore(final File[] roots,\n                                  final FileSystem fs,\n                                  final String path) {\n        this(roots,\n             GeneralPathImpl.create(fs,\n                                    path,\n                                    false));\n    }\n\n    SimpleWindowsFileStore(final File[] roots,\n                           final Path path) {\n        super(roots,\n              path);\n        checkNotNull(\"roots\",\n                     roots);\n        checkCondition(\"should have at least one root\",\n                       roots.length > 0);\n        checkNotNull(\"path\",\n                     path);\n        this.roots = roots;\n\n        if (path.isAbsolute()) {\n            for (int i = 0; i < listRoots().length; i++) {\n                if (listRoots()[i].toString().equals(path.getRoot().toString())) {\n                    fstoreIndex = i;\n                    break;\n                }\n            }\n        } else {\n            for (int i = 0; i < listRoots().length; i++) {\n                if (!EXCLUDED_DRIVERS.contains(listRoots()[i].toString().substring(0,\n                                                                                   1).toUpperCase())) {\n                    fstoreIndex = i;\n                    break;\n                }\n            }\n        }\n        if (fstoreIndex == -1) {\n            throw new IllegalStateException();\n        }\n    }\n\n    @Override\n    public String name() {\n        return listRoots()[fstoreIndex].getPath();\n    }\n\n    @Override\n    public long getTotalSpace() throws IOException {\n        return listRoots()[fstoreIndex].getTotalSpace();\n    }\n\n    @Override\n    public long getUsableSpace() throws IOException {\n        return listRoots()[fstoreIndex].getUsableSpace();\n    }\n\n    @Override\n    public long getUnallocatedSpace() throws IOException {\n        throw new UnsupportedOperationException();\n    }\n\n    File[] listRoots() {\n        return roots;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/main/java/org/uberfire/java/nio/fs/file/SimpleWindowsFileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic class SimpleWindowsFileSystem extends BaseSimpleFileSystem {\n\n    SimpleWindowsFileSystem(final FileSystemProvider provider,\n                            final String path) {\n        super(provider,\n              path);\n    }\n\n    SimpleWindowsFileSystem(final File[] roots,\n                            final FileSystemProvider provider,\n                            final String path) {\n        super(roots,\n              provider,\n              path);\n    }\n\n    @Override\n    public String getSeparator() {\n        return \"\\\\\";\n    }\n\n    @Override\n    public Iterable<Path> getRootDirectories() {\n        return new Iterable<Path>() {\n            @Override\n            public Iterator<Path> iterator() {\n                return new Iterator<Path>() {\n\n                    int i = -1;\n\n                    @Override\n                    public boolean hasNext() {\n                        return (i + 1) < listRoots().length;\n                    }\n\n                    @Override\n                    public Path next() {\n                        i++;\n                        if (i >= listRoots().length) {\n                            throw new NoSuchElementException();\n                        }\n\n                        return getPath(listRoots()[i].toString());\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    @Override\n    public Iterable<FileStore> getFileStores() {\n        return new Iterable<FileStore>() {\n            @Override\n            public Iterator<FileStore> iterator() {\n                return new Iterator<FileStore>() {\n                    int i = -1;\n\n                    @Override\n                    public boolean hasNext() {\n                        return (i + 1) < listRoots().length;\n                    }\n\n                    @Override\n                    public FileStore next() {\n                        i++;\n                        if (i >= listRoots().length) {\n                            throw new NoSuchElementException();\n                        }\n                        return new SimpleWindowsFileStore(listRoots(),\n                                                          SimpleWindowsFileSystem.this,\n                                                          listRoots()[i].toString());\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    @Override\n    public void dispose() {\n        close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleFileSystemProviderAttrsRelatedTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.uberfire.java.nio.file.AccessMode.EXECUTE;\nimport static org.uberfire.java.nio.file.AccessMode.READ;\nimport static org.uberfire.java.nio.file.AccessMode.WRITE;\n\npublic class SimpleFileSystemProviderAttrsRelatedTest {\n\n    @Test\n    public void checkIsHidden() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThat(fsProvider.isHidden(path)).isFalse();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path2 = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       tempFile);\n\n        assertThat(fsProvider.isHidden(path2)).isEqualTo(tempFile.isHidden());\n    }\n\n    @Test\n    public void isHiddenNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.isHidden(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkAccess() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path, WRITE))\n                .isInstanceOf(NoSuchFileException.class);\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path, READ))\n                .isInstanceOf(NoSuchFileException.class);\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path, EXECUTE))\n                .isInstanceOf(NoSuchFileException.class);\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path2 = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       tempFile);\n\n        fsProvider.checkAccess(path2, WRITE);\n\n        assertThat(tempFile.setWritable(false)).isTrue();\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path2, WRITE))\n                .isInstanceOf(AccessDeniedException.class);\n\n        assertThat(tempFile.setWritable(true)).isTrue();\n\n        fsProvider.checkAccess(path2, READ);\n\n        assertThat(tempFile.setReadable(false)).isTrue();\n\n        if (SimpleFileSystemProvider.OSType.currentOS().equals(SimpleFileSystemProvider.OSType.UNIX_LIKE)) {\n            assertThatThrownBy(() -> fsProvider.checkAccess(path2, READ))\n                    .isInstanceOf(AccessDeniedException.class);\n        }\n\n        assertThat(tempFile.setReadable(true)).isTrue();\n\n        if (SimpleFileSystemProvider.OSType.currentOS().equals(SimpleFileSystemProvider.OSType.UNIX_LIKE)) {\n            assertThatThrownBy(() -> fsProvider.checkAccess(path2, EXECUTE))\n                    .isInstanceOf(AccessDeniedException.class);\n        }\n\n        assertThat(tempFile.setExecutable(true)).isTrue();\n\n        fsProvider.checkAccess(path2, EXECUTE);\n        fsProvider.checkAccess(path2, READ, WRITE, EXECUTE);\n    }\n\n    @Test\n    public void checkAccessNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkAccessNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'modes' should be not null!\");\n    }\n\n    @Test\n    public void checkAccessNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(null, READ))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkAccessNull4() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.checkAccess(path, null, READ))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'mode' should be not null!\");\n    }\n\n    @Test\n    public void checkGetFileStore() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThat(fsProvider.getFileStore(path)).isNotNull();\n        assertThat(fsProvider.getFileSystem(path.toUri()).getFileStores()).isNotNull().contains(fsProvider.getFileStore(path));\n    }\n\n    @Test\n    public void getFileStoreNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.getFileStore(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkGetFileAttributeViewGeneral() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        final BasicFileAttributeView view = fsProvider.getFileAttributeView(path,\n                                                                            BasicFileAttributeView.class);\n        assertThat(view).isNotNull();\n        assertThat((Object) view.readAttributes()).isNotNull();\n        assertThat(view.readAttributes().isRegularFile()).isTrue();\n        assertThat(view.readAttributes().isDirectory()).isFalse();\n        assertThat(view.readAttributes().isSymbolicLink()).isFalse();\n        assertThat(view.readAttributes().isOther()).isFalse();\n        assertThat(view.readAttributes().size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void checkGetFileAttributeViewBasic() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        final BasicFileAttributeView view = fsProvider.getFileAttributeView(path,\n                                                                            BasicFileAttributeView.class);\n        assertThat(view).isNotNull();\n        assertThat((Object) view.readAttributes()).isNotNull();\n        assertThat(view.readAttributes().isRegularFile()).isTrue();\n        assertThat(view.readAttributes().isDirectory()).isFalse();\n        assertThat(view.readAttributes().isSymbolicLink()).isFalse();\n        assertThat(view.readAttributes().isOther()).isFalse();\n        assertThat(view.readAttributes().size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void getFileAttributeViewInvalidView() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(fsProvider.getFileAttributeView(path,\n                                                   MyAttrsView.class)).isNull();\n    }\n\n    @Test\n    public void getFileAttributeViewNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.getFileAttributeView(null, MyAttrsView.class))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void getFileAttributeViewNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> fsProvider.getFileAttributeView(path, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'type' should be not null!\");\n    }\n\n    @Test\n    public void getFileAttributeViewNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.getFileAttributeView(null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkReadAttributesGeneral() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        final BasicFileAttributesImpl attrs = fsProvider.readAttributes(path,\n                                                                        BasicFileAttributesImpl.class);\n        assertThat(attrs).isNotNull();\n        assertThat(attrs.isRegularFile()).isTrue();\n        assertThat(attrs.isDirectory()).isFalse();\n        assertThat(attrs.isSymbolicLink()).isFalse();\n        assertThat(attrs.isOther()).isFalse();\n        assertThat(attrs.size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void checkReadAttributesBasic() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        final BasicFileAttributes attrs = fsProvider.readAttributes(path,\n                                                                    BasicFileAttributes.class);\n\n        assertThat(attrs).isNotNull();\n        assertThat(attrs.isRegularFile()).isTrue();\n        assertThat(attrs.isDirectory()).isFalse();\n        assertThat(attrs.isSymbolicLink()).isFalse();\n        assertThat(attrs.isOther()).isFalse();\n        assertThat(attrs.size()).isEqualTo(0L);\n    }\n\n    @Test\n    public void readAttributesNonExistentFile() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThatThrownBy(() -> fsProvider.readAttributes(path,\n                                                           BasicFileAttributes.class))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void readAttributesInvalid() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(fsProvider.readAttributes(path,\n                                             MyAttrs.class)).isNull();\n    }\n\n    @Test\n    public void readAttributesNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(null,\n                                                           MyAttrs.class))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(path,\n                                                           (Class<MyAttrs>) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'type' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(null,\n                                                           (Class<MyAttrs>) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void checkReadAttributesMap() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(fsProvider.readAttributes(path,\n                                             \"*\")).isNotNull().hasSize(9);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"basic:*\")).isNotNull().hasSize(9);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"basic:isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"basic:isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"basic:isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"basic:someThing\")).isNotNull().hasSize(0);\n\n        assertThat(fsProvider.readAttributes(path,\n                                             \"isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(fsProvider.readAttributes(path,\n                                             \"someThing\")).isNotNull().hasSize(0);\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(path, \":someThing\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\":someThing\");\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(path, \"advanced:isRegularFile\"))\n                .isInstanceOf(UnsupportedOperationException.class)\n                .hasMessage(\"View 'advanced' not available\");\n    }\n\n    @Test\n    public void readAttributesMapNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(null, \"*\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesMapNull2() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(path, (String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void readAttributesMapNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(null, (String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void readAttributesMapEmpty() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.readAttributes(path, \"\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void setAttributeNull1() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void setAttributeNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(null, \"some\", null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setAttributeNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(null, null, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void setAttributeEmpty() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, \"\", null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'attributes' should be filled!\");\n    }\n\n    @Test\n    public void setAttributeInvalidAttr() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, \"myattr\", null))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'invalid attribute' is invalid!\");\n    }\n\n    @Test\n    public void setAttributeInvalidView() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, \"advanced:isRegularFile\", null))\n                .isInstanceOf(UnsupportedOperationException.class)\n                .hasMessage(\"View 'advanced' not available\");\n    }\n\n    @Test\n    public void setAttributeInvalidView2() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, \":isRegularFile\", null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\":isRegularFile\");\n    }\n\n    @Test\n    public void setAttributeNotImpl() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThatThrownBy(() -> fsProvider.setAttribute(path, \"isRegularFile\", null))\n                .isInstanceOf(NotImplementedException.class);\n    }\n\n    private interface MyAttrsView extends BasicFileAttributeView {\n\n    }\n\n    private interface MyAttrs extends BasicFileAttributes {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleFileSystemProviderTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.channels.FileChannel;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\nimport org.apache.commons.io.FileUtils;\nimport org.assertj.core.api.AssertionsForClassTypes;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.NotLinkException;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.uberfire.java.nio.file.StandardDeleteOption.NON_EMPTY_DIRECTORIES;\n\npublic class SimpleFileSystemProviderTest {\n\n    @Before\n    @After\n    public void cleanup() {\n        FileUtils.deleteQuietly(new File(System.getProperty(\"user.dir\") + \"/temp\"));\n        FileUtils.deleteQuietly(new File(System.getProperty(\"user.dir\") + \"/temp2\"));\n        FileUtils.deleteQuietly(new File(System.getProperty(\"user.dir\") + \"/xxxxxx\"));\n    }\n\n    @Test\n    public void simpleStateTest() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        assertThat(fsProvider).isNotNull();\n        assertThat(fsProvider.getScheme()).isNotEmpty().isEqualTo(\"file\");\n\n        assertThat(fsProvider.isDefault()).isFalse();\n        fsProvider.forceAsDefault();\n        assertThat(fsProvider.isDefault()).isTrue();\n    }\n\n    @Test\n    public void validateGetPath() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final URI uri = URI.create(\"file:///path/to/file.txt\");\n\n        final Path path = fsProvider.getPath(uri);\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.getFileSystem()).isEqualTo(fsProvider.getFileSystem(uri));\n        assertThat(path.getFileSystem().provider()).isEqualTo(fsProvider);\n\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getPathNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        fsProvider.getPath(null);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void getPathInvalidScheme() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        fsProvider.getPath(URI.create(\"http:///path/to/file.txt\"));\n    }\n\n    @Test(expected = FileSystemAlreadyExistsException.class)\n    public void newFileSystemCantCreateURI() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newFileSystem(URI.create(\"file:///\"),\n                                 Collections.emptyMap());\n    }\n\n    @Test(expected = FileSystemAlreadyExistsException.class)\n    public void newFileSystemCantCreatePath() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final URI uri = URI.create(\"file:///\");\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(uri),\n                                                 uri.getPath(),\n                                                 false);\n\n        fsProvider.newFileSystem(path,\n                                 Collections.emptyMap());\n    }\n\n    @Test\n    public void checkNewInputStream() throws IOException {\n        final File temp = File.createTempFile(\"foo\",\n                                              \"bar\");\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      temp);\n\n        final InputStream stream = fsProvider.newInputStream(path);\n\n        assertThat(stream).isNotNull();\n        stream.close();\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void inputStreamFileDoesntExists() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.newInputStream(path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void inputStreamNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newInputStream(null);\n    }\n\n    @Test\n    public void checkNewOutputStream() throws IOException {\n        final File temp = File.createTempFile(\"foo\",\n                                              \"bar\");\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      temp);\n\n        final OutputStream stream = fsProvider.newOutputStream(path);\n\n        assertThat(stream).isNotNull();\n        stream.close();\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void outputStreamFileDoesntExists() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.newOutputStream(path);\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void outputStreamOnDirectory() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/\",\n                                                 false);\n\n        fsProvider.newOutputStream(path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void outputStreamNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newOutputStream(null);\n    }\n\n    @Test\n    public void checkNewFileChannel() throws IOException {\n        final File temp = File.createTempFile(\"foo\",\n                                              \"bar\");\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      temp);\n\n        final FileChannel stream = fsProvider.newFileChannel(path,\n                                                             null);\n\n        assertThat(stream).isNotNull();\n        stream.close();\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void fileChannelFileDoesntExists() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.newFileChannel(path,\n                                  null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void fileChannelNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newFileChannel(null,\n                                  null);\n    }\n\n    @Test\n    public void checkNewByteChannelToCreateFile() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userBasedPath = System.getProperty(\"user.dir\") + \"/byte_some_file_here.txt\";\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userBasedPath,\n                                                 false);\n        assertThat(path.toFile()).doesNotExist();\n\n        try (final SeekableByteChannel channel = fsProvider.newByteChannel(path, null)) {\n            assertThat(channel).isNotNull();\n            assertThat(path.toFile()).exists();\n        }\n        path.toFile().delete();\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void newByteChannelFileAlreadyExists() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(path.toFile()).exists();\n        assertThat(path.toFile()).isEqualTo(tempFile);\n\n        fsProvider.newByteChannel(path,\n                                  null);\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void newByteChannelInvalidPath() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userBasedPath = System.getProperty(\"user.dir\") + \"path/to/some_file_here.txt\";\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userBasedPath,\n                                                 false);\n        assertThat(path.toFile()).doesNotExist();\n\n        fsProvider.newByteChannel(path,\n                                  null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newByteChannelNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newByteChannel(null,\n                                  null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void newAsynchronousFileChannelUnsupportedOp() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.newAsynchronousFileChannel(path,\n                                              null,\n                                              null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newAsynchronousFileChannelNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newAsynchronousFileChannel(null,\n                                              null,\n                                              null);\n    }\n\n    @Test\n    public void seekableByteChannel() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userBasedPath = System.getProperty(\"user.dir\") + \"/my_byte_some_file_here.txt\";\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userBasedPath,\n                                                 false);\n        assertThat(path.toFile()).doesNotExist();\n\n        final SeekableByteChannel channel = fsProvider.newByteChannel(path,\n                                                                      null);\n\n        assertThat(channel).isNotNull();\n        assertThat(path.toFile()).exists();\n\n        assertThat(channel.isOpen()).isTrue();\n\n        channel.close();\n\n        assertThat(channel.isOpen()).isFalse();\n\n//        try {\n//            channel.position();\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n//\n//        try {\n//            channel.position( 1L );\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n//\n//        try {\n//            channel.size();\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n//\n//        try {\n//            channel.truncate( 1L );\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n//\n//        try {\n//            channel.read( null );\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n//\n//        try {\n//            channel.write( null );\n//            fail( \"method not implemented - exception expected!\" );\n//        } catch ( NotImplementedException ex ) {\n//        }\n\n        path.toFile().delete();\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test\n    public void checkCreateDirectory() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userBasedPath = System.getProperty(\"user.dir\") + \"/temp\";\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userBasedPath,\n                                                 false);\n        path.toFile().delete();\n        assertThat(path.toFile()).doesNotExist();\n\n        fsProvider.createDirectory(path);\n\n        assertThat(path.toFile()).exists();\n        path.toFile().delete();\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void checkCreateDirectoryAlreadyExists() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userBasedPath = System.getProperty(\"user.dir\") + \"/temp\";\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userBasedPath,\n                                                 false);\n        assertThat(path.toFile()).doesNotExist();\n\n        fsProvider.createDirectory(path);\n        assertThat(path.toFile()).exists();\n        fsProvider.createDirectory(path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createDirectoryNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.createDirectory(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.createSymbolicLink(null,\n                                      null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createSymbolicLink(path,\n                                      null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createSymbolicLinkNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createSymbolicLink(null,\n                                      path);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void createSymbolicLinkSame() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createSymbolicLink(path,\n                                      path);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void createSymbolicLinkTargetMustExists() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        final Path path2 = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                  \"/path/to/file2.txt\",\n                                                  false);\n\n        fsProvider.createSymbolicLink(path,\n                                      path2);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void createSymbolicLinkUnsupportedOp() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path2 = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       tempFile);\n\n        fsProvider.createSymbolicLink(path,\n                                      path2);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.createLink(null,\n                              null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createLink(path,\n                              null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void createLinkNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createLink(null,\n                              path);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void createLinkSame() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.createLink(path,\n                              path);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void createLinkUnsupportedOp() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path2 = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       tempFile);\n\n        fsProvider.createLink(path,\n                              path2);\n    }\n\n    @Test\n    public void checkDelete() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(path.toFile()).exists();\n        fsProvider.delete(path);\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void checkDeleteNonExistent() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThat(path.toFile()).doesNotExist();\n        fsProvider.delete(path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void checkDeleteNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.delete(null);\n    }\n\n    @Test\n    public void checkDeleteIfExists() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        assertThat(path.toFile()).exists();\n        assertThat(fsProvider.deleteIfExists(path)).isTrue();\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void checkDeleteIfExistsNonExistent() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThat(path.toFile()).doesNotExist();\n        assertThat(fsProvider.deleteIfExists(path)).isFalse();\n        assertThat(path.toFile()).doesNotExist();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void checkDeleteIfExistsNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.deleteIfExists(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void readSymbolicLinkNull() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.readSymbolicLink(null);\n    }\n\n    @Test(expected = NotLinkException.class)\n    public void readSymbolicLinkNotLink() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.readSymbolicLink(path);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void readSymbolicLinkUnsupportedOp() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        fsProvider.readSymbolicLink(path);\n    }\n\n    @Test\n    public void checkIsSameFile() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        final Path path2 = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                  \"/path/to/file.txt\",\n                                                  false);\n        assertThat(fsProvider.isSameFile(path,\n                                         path2)).isTrue();\n\n        final Path path3 = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                  \"path/to/file.txt\",\n                                                  false);\n        assertThat(fsProvider.isSameFile(path,\n                                         path3)).isFalse();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void sameFileNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.isSameFile(null,\n                              null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void sameFileNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.isSameFile(path,\n                              null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void sameFileNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        fsProvider.isSameFile(null,\n                              path);\n    }\n\n    @Test\n    public void checkCopyDir() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n        fsProvider.createDirectory(source);\n\n        fsProvider.copy(source,\n                        dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).exists();\n\n        source.toFile().delete();\n        dest.toFile().delete();\n    }\n\n    @Test\n    public void checkCopyFile() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp.txt\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2.txt\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n        final OutputStream stream = fsProvider.newOutputStream(source);\n        stream.write('a');\n        stream.close();\n\n        fsProvider.copy(source,\n                        dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).exists();\n        assertThat(dest.toFile().length()).isEqualTo(source.toFile().length());\n\n        source.toFile().delete();\n        dest.toFile().delete();\n    }\n\n    @Test\n    public void copyFileInvalidSourceAndTarget() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n\n        fsProvider.createDirectory(source);\n\n        final Path sourceFile = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       userSourcePath + \"/file.txt\",\n                                                       false);\n        final OutputStream stream = fsProvider.newOutputStream(sourceFile);\n        stream.write('a');\n        stream.close();\n\n        assertThatThrownBy(() -> fsProvider.copy(source, dest))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n\n        sourceFile.toFile().delete();\n        fsProvider.copy(source,\n                        dest);\n\n        assertThatThrownBy(() -> fsProvider.copy(source, dest))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        dest.toFile().delete();\n        source.toFile().delete();\n\n        assertThatThrownBy(() -> fsProvider.copy(source, dest))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'source must exist' is invalid!\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void copyFileNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userPath = System.getProperty(\"user.dir\") + \"/temp\";\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userPath,\n                                                 false);\n\n        fsProvider.copy(path,\n                        null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void copyFileNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userPath = System.getProperty(\"user.dir\") + \"/temp\";\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userPath,\n                                                 false);\n\n        fsProvider.copy(null,\n                        path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void copyFileNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.copy(null,\n                        null);\n    }\n\n    @Test\n    public void checkMoveDir() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n        fsProvider.createDirectory(source);\n\n        fsProvider.move(source,\n                        dest);\n\n        assertThat(source.toFile()).doesNotExist();\n        assertThat(dest.toFile()).exists();\n\n        dest.toFile().delete();\n    }\n\n    @Test\n    public void checkMoveFile() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp.txt\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2.txt\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n        final OutputStream stream = fsProvider.newOutputStream(source);\n        stream.write('a');\n        stream.close();\n\n        long lenght = source.toFile().length();\n        fsProvider.move(source,\n                        dest);\n\n        assertThat(dest.toFile()).exists();\n        assertThat(source.toFile()).doesNotExist();\n        assertThat(dest.toFile().length()).isEqualTo(lenght);\n\n        dest.toFile().delete();\n    }\n\n    @Test\n    public void moveFileInvalidSourceAndTarget() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp\";\n        final String userDestPath = System.getProperty(\"user.dir\") + \"/temp2\";\n\n        final Path source = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                   userSourcePath,\n                                                   false);\n        final Path dest = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userDestPath,\n                                                 false);\n\n        fsProvider.createDirectory(source);\n\n        final Path sourceFile = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       userSourcePath + \"/file.txt\",\n                                                       false);\n        final OutputStream stream = fsProvider.newOutputStream(sourceFile);\n        stream.write('a');\n        stream.close();\n\n        assertThatThrownBy(() -> fsProvider.move(source, dest))\n                .isInstanceOf(DirectoryNotEmptyException.class);\n\n        sourceFile.toFile().delete();\n        fsProvider.copy(source,\n                        dest);\n\n        assertThatThrownBy(() -> fsProvider.move(source, dest))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        dest.toFile().delete();\n        source.toFile().delete();\n\n        assertThatThrownBy(() -> fsProvider.move(source, dest))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Condition 'source must exist' is invalid!\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void moveFileNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userPath = System.getProperty(\"user.dir\") + \"/temp\";\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userPath,\n                                                 false);\n\n        fsProvider.move(path,\n                        null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void moveFileNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userPath = System.getProperty(\"user.dir\") + \"/temp\";\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 userPath,\n                                                 false);\n\n        fsProvider.move(null,\n                        path);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void moveFileNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.move(null,\n                        null);\n    }\n\n    @Test\n    public void checkNewDirectoryStream() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/temp\";\n\n        final Path dir = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                userSourcePath,\n                                                false);\n        FileUtils.deleteDirectory(dir.toFile());\n        fsProvider.createDirectory(dir);\n\n        final DirectoryStream<Path> stream = fsProvider.newDirectoryStream(dir,\n                                                                           entry -> true);\n\n        assertThat(stream).hasSize(0);\n\n        assertThatThrownBy(() -> stream.iterator().next())\n                .isInstanceOf(NoSuchElementException.class);\n\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\",\n                                                  dir.toFile());\n        final Path path = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                      tempFile);\n\n        final DirectoryStream<Path> stream2 = fsProvider.newDirectoryStream(dir,\n                                                                            entry -> true);\n\n        assertThat(stream2).hasSize(1);\n\n        final Iterator<Path> iterator = stream2.iterator();\n        iterator.next();\n        assertThatThrownBy(() -> iterator.remove())\n                .isInstanceOf(UnsupportedOperationException.class);\n\n        stream2.close();\n\n        assertThatThrownBy(() -> stream2.close())\n                .isInstanceOf(org.uberfire.java.nio.IOException.class)\n                .hasMessage(\"This stream is closed.\");\n\n        final File tempFile2 = File.createTempFile(\"bar\",\n                                                   \"foo\",\n                                                   dir.toFile());\n        final Path path2 = GeneralPathImpl.newFromFile(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                       tempFile2);\n\n        final DirectoryStream<Path> stream3 = fsProvider.newDirectoryStream(dir,\n                                                                            entry -> true);\n\n        assertThat(stream3).hasSize(2).contains(path,\n                                                path2);\n\n        stream3.close();\n\n        assertThatThrownBy(() -> stream3.iterator().next())\n                .isInstanceOf(org.uberfire.java.nio.IOException.class)\n                .hasMessage(\"This stream is closed.\");\n\n        final DirectoryStream<Path> stream4 = fsProvider.newDirectoryStream(dir,\n                                                                            entry -> entry.getFileName().toString().startsWith(\"foo\"));\n\n        assertThat(stream4).hasSize(1).contains(path);\n\n        FileUtils.deleteDirectory(dir.toFile());\n    }\n\n    @Test\n    public void checkDeleteNonEmptyDir() throws IOException {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + System.getProperty(\"file.separator\") + \"temp\";\n\n        final Path dir = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                userSourcePath,\n                                                false);\n        FileUtils.deleteDirectory(dir.toFile());\n        fsProvider.createDirectory(dir);\n\n        File.createTempFile(\"foo\",\n                            \"bar\",\n                            dir.toFile());\n        File.createTempFile(\"bar\",\n                            \"foo\",\n                            dir.toFile());\n        File.createTempFile(\"bar\",\n                            \"foo\",\n                            dir.toFile());\n        fsProvider.createDirectory(dir.resolve(\"other_dir\"));\n\n        final DirectoryStream<Path> stream5 = fsProvider.newDirectoryStream(dir,\n                                                                            entry -> true);\n\n        assertThat(stream5).hasSize(4).contains(dir.resolve(\"other_dir\"));\n\n        assertThatThrownBy(() -> fsProvider.delete(dir))\n                .isInstanceOf(org.uberfire.java.nio.file.DirectoryNotEmptyException.class);\n\n        fsProvider.delete(dir,\n                          NON_EMPTY_DIRECTORIES);\n\n        assertThat(dir.toFile().exists()).isEqualTo(false);\n    }\n\n    @Test(expected = NotDirectoryException.class)\n    public void newDirectoryStreamInvalidDir() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/xxxxxx\";\n\n        final Path dir = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                userSourcePath,\n                                                false);\n\n        fsProvider.newDirectoryStream(dir,\n                                      entry -> true);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull1() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        fsProvider.newDirectoryStream(null,\n                                      entry -> true);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull2() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/xxxxxx\";\n\n        final Path dir = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                userSourcePath,\n                                                false);\n\n        fsProvider.newDirectoryStream(dir,\n                                      null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void newDirectoryStreamNull3() {\n        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();\n\n        final String userSourcePath = System.getProperty(\"user.dir\") + \"/xxxxxx\";\n\n        final Path dir = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                userSourcePath,\n                                                false);\n\n        fsProvider.newDirectoryStream(null,\n                                      null);\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleFileSystemProviderWindowsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.net.URI;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.uberfire.java.nio.fs.file.SimpleFileSystemProvider.OSType.WINDOWS;\n\npublic class SimpleFileSystemProviderWindowsTest {\n\n    final File[] roots = new File[]{new File(\"c:\\\\\"), new File(\"a:\\\\\")};\n    final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider(roots,\n                                                                             WINDOWS);\n\n    @Test\n    public void simpleStateTest() {\n        assertThat(fsProvider).isNotNull();\n        assertThat(fsProvider.getScheme()).isEqualTo(\"file\");\n\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                                 false);\n\n        assertThat(path.getFileSystem()).isInstanceOf(SimpleWindowsFileSystem.class);\n    }\n\n    @Test\n    public void checkGetFileStore() {\n        final Path path = GeneralPathImpl.create(fsProvider.getFileSystem(URI.create(\"file:///\")),\n                                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                                 false);\n\n        assertThat(fsProvider.getFileStore(path)).isInstanceOf(SimpleWindowsFileStore.class);\n        assertThat(fsProvider.getFileStore(path).name()).isEqualTo(\"c:\\\\\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleUnixFileStoreTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileStoreAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class SimpleUnixFileStoreTest {\n\n    @Test\n    public void simpleTests() {\n        final FileStore fileStore = new SimpleUnixFileStore(null);\n\n        assertThat(fileStore.name()).isEqualTo(\"/\");\n        assertThat(fileStore.type()).isNull();\n        assertThat(fileStore.isReadOnly()).isFalse();\n        assertThat(fileStore.getTotalSpace()).isEqualTo(File.listRoots()[0].getTotalSpace());\n        assertThat(fileStore.getUsableSpace()).isEqualTo(File.listRoots()[0].getUsableSpace());\n\n        assertThat(fileStore.supportsFileAttributeView(BasicFileAttributeView.class)).isTrue();\n        assertThat(fileStore.supportsFileAttributeView(MyFileAttributeView.class)).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(MyAlsoInvalidFileAttributeView.class)).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(\"basic\")).isTrue();\n        assertThat(fileStore.supportsFileAttributeView(\"any\")).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(BasicFileAttributeView.class.getName())).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(MyAlsoInvalidFileAttributeView.class.getName())).isFalse();\n        assertThat(fileStore.getFileStoreAttributeView(FileStoreAttributeView.class)).isNull();\n\n        assertThat(fileStore.getAttribute(\"name\")).isEqualTo(fileStore.name());\n        assertThat(fileStore.getAttribute(\"totalSpace\")).isEqualTo(fileStore.getTotalSpace());\n        assertThat(fileStore.getAttribute(\"usableSpace\")).isEqualTo(fileStore.getUsableSpace());\n        assertThat(fileStore.getAttribute(\"readOnly\")).isEqualTo(fileStore.isReadOnly());\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getUnallocatedSpaceUnsupportedOp() {\n        new SimpleUnixFileStore(null).getUnallocatedSpace();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getAttributeUnsupportedOp() {\n        new SimpleUnixFileStore(null).getAttribute(\"someValueHere\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewNull1() {\n        new SimpleUnixFileStore(null).supportsFileAttributeView((Class<? extends FileAttributeView>) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewNull2() {\n        new SimpleUnixFileStore(null).supportsFileAttributeView((String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewEmpty() {\n        new SimpleUnixFileStore(null).supportsFileAttributeView(\"\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getFileStoreAttributeViewNull() {\n        new SimpleUnixFileStore(null).getFileStoreAttributeView(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getAttributeNull() {\n        new SimpleUnixFileStore(null).getAttribute(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getAttributeEmpty() {\n        new SimpleUnixFileStore(null).getAttribute(\"\");\n    }\n\n    private static class MyFileAttributeView implements FileAttributeView {\n\n        @Override\n        public String name() {\n            return null;\n        }\n    }\n\n    private static class MyAlsoInvalidFileAttributeView implements BasicFileAttributeView {\n\n        @Override\n        public BasicFileAttributes readAttributes() throws IOException {\n            return null;\n        }\n\n        @Override\n        public void setTimes(FileTime lastModifiedTime,\n                             FileTime lastAccessTime,\n                             FileTime createTime) throws IOException {\n\n        }\n\n        @Override\n        public String name() {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleUnixFileSystemTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.net.URISyntaxException;\nimport java.net.URL;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.mockito.Mockito.mock;\n\npublic class SimpleUnixFileSystemTest {\n\n    final FileSystemProvider fsProvider = mock(FileSystemProvider.class);\n\n    @Test\n    public void simpleTests() {\n        final FileSystem fileSystem = new SimpleUnixFileSystem(fsProvider,\n                                                               \"/\");\n\n        assertThat(fileSystem.isOpen()).isTrue();\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(System.getProperty(\"file.separator\"));\n        assertThat(fileSystem.provider()).isEqualTo(fsProvider);\n        Assertions.assertThat(fileSystem.supportedFileAttributeViews()).hasSize(1).contains(\"basic\");\n\n        assertThat(fileSystem.getPath(\"/path/to/file.txt\")).isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                             \"/path/to/file.txt\",\n                                                                                             false));\n        assertThat(fileSystem.getPath(\"/path/to/file.txt\",\n                                      null)).isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                              \"/path/to/file.txt\",\n                                                                              false));\n        assertThat(fileSystem.getPath(\"/path\",\n                                      \"to\",\n                                      \"file.txt\")).isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                    \"/path/to/file.txt\",\n                                                                                    false));\n        assertThat(fileSystem.getPath(\"/\",\n                                      \"path\",\n                                      \"to\",\n                                      \"file.txt\")).isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                    \"/path/to/file.txt\",\n                                                                                    false));\n\n        assertThatThrownBy(() -> fileSystem.close())\n                .isInstanceOf(UnsupportedOperationException.class);\n\n        Assertions.assertThat(fileSystem.getFileStores()).hasSize(1);\n        assertThat(fileSystem.getFileStores().iterator().next().name()).isEqualTo(\"/\");\n\n        Assertions.assertThat(fileSystem.getRootDirectories()).hasSize(1);\n        assertThat(fileSystem.getRootDirectories().iterator().next().toString()).isEqualTo(\"/\");\n        assertThat(fileSystem.getRootDirectories().iterator().next().isAbsolute()).isTrue();\n    }\n\n    @Test\n    public void simpleRootTests() throws URISyntaxException {\n        final SimpleFileSystemProvider fs = new SimpleFileSystemProvider();\n\n        final FileSystem fileSystem = new SimpleUnixFileSystem(fsProvider,\n                                                               \"/\");\n        assertThat(fileSystem.getPath(\"/\")).isEqualTo(fileSystem.getPath(\"/path\").getParent());\n\n        final URL parentUrl = this.getClass().getResource(\"/\");\n        final Path parentNioPath = fs.getPath(parentUrl.toURI());\n\n        final URL childUrl = this.getClass().getResource(\"/Folder\");\n        final Path childNioPath = fs.getPath(childUrl.toURI());\n        final Path childParentNioPath = childNioPath.getParent();\n\n        assertThat(parentNioPath).isEqualTo(childParentNioPath);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidCOnstructorPath() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"home\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getPathMatcherUnsupportedOp() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"/\").getPathMatcher(\"*.*\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getUserPrincipalLookupServiceUnsupportedOp() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"/\").getUserPrincipalLookupService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void newWatchServiceUnsupportedOp() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"/\").newWatchService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void removeElementFromRootIteratorUnsupportedOp() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"/\").getRootDirectories().iterator().remove();\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void invalidElementFromRootIterator() {\n        final Iterator<Path> iterator = new SimpleUnixFileSystem(fsProvider,\n                                                                 \"/\").getRootDirectories().iterator();\n        try {\n            iterator.next();\n        } catch (Exception e) {\n            fail(\"first is valid\");\n        }\n        iterator.next();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void removeElementFromFStoreIteratorUnsupportedOp() {\n        new SimpleUnixFileSystem(fsProvider,\n                                 \"/\").getFileStores().iterator().remove();\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void invalidElementFromFStoreIterator() {\n        final Iterator<FileStore> iterator = new SimpleUnixFileSystem(fsProvider,\n                                                                      \"/\").getFileStores().iterator();\n        try {\n            iterator.next();\n        } catch (Exception e) {\n            fail(\"first is valid\");\n        }\n        iterator.next();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleWindowsFileStoreTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileStoreAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.Mockito.mock;\n\npublic class SimpleWindowsFileStoreTest {\n\n    final FileSystemProvider fsProvider = mock(FileSystemProvider.class);\n    final File[] roots = new File[]{new File(\"c:\\\\\"), new File(\"a:\\\\\")};\n    final FileSystem fileSystem = new SimpleWindowsFileSystem(roots,\n                                                              fsProvider,\n                                                              \"c:\\\\\");\n    final Path nonNullPath = GeneralPathImpl.create(fileSystem,\n                                                    \"c:\\\\something\",\n                                                    false);\n\n    @Test\n    public void simpleTests() {\n        final Path path = GeneralPathImpl.create(fileSystem,\n                                                 \"something\",\n                                                 false);\n        final FileStore fileStore = new SimpleWindowsFileStore(roots,\n                                                               path);\n\n        assertThat(fileStore.name()).isNotNull().isEqualTo(\"c:\\\\\");\n        assertThat(fileStore.type()).isNull();\n        assertThat(fileStore.isReadOnly()).isFalse();\n\n        if (SimpleFileSystemProvider.OSType.currentOS().equals(SimpleFileSystemProvider.OSType.WINDOWS)) {\n            assertThat(fileStore.getTotalSpace()).isNotEqualTo(0L);\n            assertThat(fileStore.getUsableSpace()).isNotEqualTo(0L);\n        } else {\n            assertThat(fileStore.getTotalSpace()).isEqualTo(0L);\n            assertThat(fileStore.getUsableSpace()).isEqualTo(0L);\n        }\n\n        assertThat(fileStore.supportsFileAttributeView(BasicFileAttributeView.class)).isTrue();\n        assertThat(fileStore.supportsFileAttributeView(MyFileAttributeView.class)).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(MyAlsoInvalidFileAttributeView.class)).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(\"basic\")).isTrue();\n        assertThat(fileStore.supportsFileAttributeView(\"any\")).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(BasicFileAttributeView.class.getName())).isFalse();\n        assertThat(fileStore.supportsFileAttributeView(MyAlsoInvalidFileAttributeView.class.getName())).isFalse();\n        assertThat(fileStore.getFileStoreAttributeView(FileStoreAttributeView.class)).isNull();\n\n        assertThat(fileStore.getAttribute(\"name\")).isNotNull().isEqualTo(fileStore.name());\n        assertThat(fileStore.getAttribute(\"totalSpace\")).isNotNull().isEqualTo(fileStore.getTotalSpace());\n        assertThat(fileStore.getAttribute(\"usableSpace\")).isNotNull().isEqualTo(fileStore.getUsableSpace());\n        assertThat(fileStore.getAttribute(\"readOnly\")).isNotNull().isEqualTo(fileStore.isReadOnly());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void contructorWithNullRootsAndPath() {\n        new SimpleWindowsFileStore((File[]) null,\n                                   (Path) null);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void contructorWithEmptyRoots() {\n        new SimpleWindowsFileStore(new File[]{},\n                                   null);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getUnallocatedSpaceUnsupportedOp() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).getUnallocatedSpace();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getAttributeUnsupportedOp() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).getAttribute(\"someValueHere\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewNull1() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).supportsFileAttributeView((Class<? extends FileAttributeView>) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewNull2() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).supportsFileAttributeView((String) null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void supportsFileAttributeViewEmpty() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).supportsFileAttributeView(\"\");\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getFileStoreAttributeViewNull() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).getFileStoreAttributeView(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getAttributeNull() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).getAttribute(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void getAttributeEmpty() {\n        new SimpleWindowsFileStore(roots,\n                                   nonNullPath).getAttribute(\"\");\n    }\n\n    private static class MyFileAttributeView implements FileAttributeView {\n\n        @Override\n        public String name() {\n            return null;\n        }\n    }\n\n    private static class MyAlsoInvalidFileAttributeView implements BasicFileAttributeView {\n\n        @Override\n        public BasicFileAttributes readAttributes() throws IOException {\n            return null;\n        }\n\n        @Override\n        public void setTimes(FileTime lastModifiedTime,\n                             FileTime lastAccessTime,\n                             FileTime createTime) throws IOException {\n\n        }\n\n        @Override\n        public String name() {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/java/org/uberfire/java/nio/fs/file/SimpleWindowsFileSystemTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.file;\n\nimport java.io.File;\nimport java.util.Iterator;\nimport java.util.NoSuchElementException;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.mockito.Mockito.mock;\n\npublic class SimpleWindowsFileSystemTest {\n\n    final FileSystemProvider fsProvider = mock(FileSystemProvider.class);\n    final File[] roots = new File[]{new File(\"c:\\\\\"), new File(\"a:\\\\\")};\n    final File[] singleRoot = new File[]{new File(\"c:\\\\\")};\n\n    @Test\n    public void simpleTests() {\n\n        final FileSystem fileSystem = new SimpleWindowsFileSystem(roots,\n                                                                  fsProvider,\n                                                                  \"c:\\\\\");\n\n        assertThat(fileSystem.isOpen()).isTrue();\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"\\\\\");\n        assertThat(fileSystem.provider()).isEqualTo(fsProvider);\n        Assertions.assertThat(fileSystem.supportedFileAttributeViews()).hasSize(1).contains(\"basic\");\n\n        assertThat(fileSystem.getPath(\"c:\\\\path\\\\to\\\\file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                              \"c:\\\\path\\\\to\\\\file.txt\",\n                                                                                                              false));\n        assertThat(fileSystem.getPath(\"/c:/path/to/file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                            \"/c:/path/to/file.txt\",\n                                                                                                            false));\n        assertThat(fileSystem.getPath(\"c:\\\\path\\\\to\\\\\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                      \"c:\\\\path\\\\to\",\n                                                                                                      false));\n        assertThat(fileSystem.getPath(\"/c:/path/to/\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                    \"/c:/path/to\",\n                                                                                                    false));\n        assertThat(fileSystem.getPath(\"c:\\\\path\\\\to\\\\file.txt\",\n                                      null)).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                          \"c:\\\\path\\\\to\\\\file.txt\",\n                                                                                          false));\n        assertThat(fileSystem.getPath(\"c:\\\\path\",\n                                      \"to\",\n                                      \"file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                \"c:\\\\path\\\\to\\\\file.txt\",\n                                                                                                false));\n        assertThat(fileSystem.getPath(\"c:\\\\path\\\\\",\n                                      \"to\",\n                                      \"file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                \"c:\\\\path\\\\to\\\\file.txt\",\n                                                                                                false));\n        assertThat(fileSystem.getPath(\"/c:/path\",\n                                      \"to\",\n                                      \"file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                \"/c:/path/to/file.txt\",\n                                                                                                false));\n        assertThat(fileSystem.getPath(\"/c:/path/\",\n                                      \"to\",\n                                      \"file.txt\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                                \"/c:/path/to/file.txt\",\n                                                                                                false));\n        assertThat(fileSystem.getPath(\"/\",\n                                      \"c:\",\n                                      \"path\")).isNotNull().isEqualTo(GeneralPathImpl.create(fileSystem,\n                                                                                            \"/c:/path\",\n                                                                                            false));\n\n        assertThatThrownBy(() -> fileSystem.close())\n                .isInstanceOf(UnsupportedOperationException.class);\n\n        Assertions.assertThat(fileSystem.getFileStores()).hasSize(2);\n        assertThat(fileSystem.getFileStores().iterator().next().name()).isEqualTo(\"c:\\\\\");\n\n        Assertions.assertThat(fileSystem.getRootDirectories()).hasSize(2);\n        assertThat(fileSystem.getRootDirectories().iterator().next().toString()).isEqualTo(\"c:\\\\\");\n        assertThat(fileSystem.getRootDirectories().iterator().next().isAbsolute()).isTrue();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidCOnstructorPath() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"home\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getPathMatcherUnsupportedOp() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"c:\\\\\").getPathMatcher(\"*.*\");\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void getUserPrincipalLookupServiceUnsupportedOp() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"c:\\\\\").getUserPrincipalLookupService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void newWatchServiceUnsupportedOp() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"c:\\\\\").newWatchService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void removeElementFromRootIteratorUnsupportedOp() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"c:\\\\\").getRootDirectories().iterator().remove();\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void invalidElementFromRootIterator() {\n        final Iterator<Path> iterator = new SimpleWindowsFileSystem(singleRoot,\n                                                                    fsProvider,\n                                                                    \"c:\\\\\").getRootDirectories().iterator();\n        try {\n            iterator.next();\n        } catch (Exception e) {\n            fail(\"first is valid\");\n        }\n        iterator.next();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void removeElementFromFStoreIteratorUnsupportedOp() {\n        new SimpleWindowsFileSystem(fsProvider,\n                                    \"c:\\\\\").getFileStores().iterator().remove();\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void invalidElementFromFStoreIterator() {\n        final Iterator<FileStore> iterator = new SimpleWindowsFileSystem(singleRoot,\n                                                                         fsProvider,\n                                                                         \"c:\\\\\").getFileStores().iterator();\n        try {\n            iterator.next();\n        } catch (Exception e) {\n            fail(\"first is valid\");\n        }\n        iterator.next();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-fs/src/test/resources/Folder/something.txt",
    "content": "empty"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-impls</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-jgit</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire NIO.2 :: JGIT Impl</name>\n  <description>UberFire NIO.2 :: JGIT Impl</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.jcraft</groupId>\n      <artifactId>jsch</artifactId>\n    </dependency>\n\n\n    <!-- HTTP Support -->\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Core Library -->\n    <dependency>\n      <groupId>org.apache.sshd</groupId>\n      <artifactId>sshd-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit.ssh.jsch</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit.http.server</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <!-- Needed as replacement for commons-logging which is excluded from org.eclipse.jgit -->\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>jcl-over-slf4j</artifactId>\n      <scope>runtime</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-submit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-install</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.byteman</groupId>\n      <artifactId>byteman-bmunit</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.jboss.byteman</groupId>\n        <artifactId>byteman-rulecheck-maven-plugin</artifactId>\n        <version>${version.org.jboss.byteman}</version>\n        <executions>\n          <execution>\n            <id>rulecheck-test</id>\n            <goals>\n              <goal>rulecheck</goal>\n            </goals>\n            <phase>test-compile</phase>\n            <configuration>\n              <includes>\n                <include>**/*.btm</include>\n              </includes>\n              <verbose>true</verbose>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-plugin</artifactId>\n        <configuration>\n          <useSystemClassLoader>true</useSystemClassLoader>\n          <useManifestOnlyJar>true</useManifestOnlyJar>\n          <forkMode>once</forkMode>\n          <argLine>-Djdk.attach.allowAttachSelf=true</argLine>\n          <!--<parallel>false</parallel>-->\n          <!-- ensure we don't inherit a byteman jar from any env settings -->\n          <environmentVariables>\n            <BYTEMAN_HOME></BYTEMAN_HOME>\n          </environmentVariables>\n          <systemProperties>\n            <property>\n              <name>org.jboss.byteman.home</name>\n              <value></value>\n            </property>\n          </systemProperties>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/CommitTime.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\npublic class CommitTime {\n\n    private Long firstCommitTime;\n    private Long lastCommitTime;\n\n    public Long getFirstCommitTime() {\n        return firstCommitTime;\n    }\n\n    public void setFirstCommitTime(Long firstCommitTime) {\n        this.firstCommitTime = firstCommitTime;\n    }\n\n    public Long getLastCommitTime() {\n        return lastCommitTime;\n    }\n\n    public void setLastCommitTime(Long lastCommitTime) {\n        this.lastCommitTime = lastCommitTime;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/FileSystemLock.java",
    "content": "package org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.RandomAccessFile;\nimport java.net.URI;\nimport java.nio.ByteBuffer;\nimport java.nio.channels.FileChannel;\nimport java.nio.channels.FileLock;\nimport java.nio.file.FileAlreadyExistsException;\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.locks.ReentrantLock;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * File system Lock. To instantiate a new Lock use {@link FileSystemLockManager}\n */\npublic class FileSystemLock {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(FileSystemLock.class);\n\n    ReentrantLock lock = new ReentrantLock(true);\n    private FileLock physicalLock;\n    private java.nio.file.Path lockFile;\n    private FileChannel fileChannel;\n    private long lastAccessMilliseconds;\n    private long lastAccessThresholdMilliseconds;\n    private final URI repoURI;\n    private String lockName;\n\n    protected FileSystemLock(File directory,\n                             String lockName,\n                             TimeUnit lastAccessTimeUnit,\n                             long lastAccessThreshold) {\n        this.lockName = lockName;\n        repoURI = directory.toURI();\n        this.lockFile = createLockInfra(repoURI);\n        this.lastAccessThresholdMilliseconds = lastAccessTimeUnit.toMillis(lastAccessThreshold);\n    }\n\n    void registerAccess() {\n        lastAccessMilliseconds = System.currentTimeMillis();\n    }\n\n    public void lock() {\n        registerAccess();\n        lock.lock();\n\n        if (needToCreatePhysicalLock()) {\n            physicalLockOnFS();\n        }\n    }\n\n    public void unlock() {\n        registerAccess();\n        if (lock.isLocked()) {\n            if (releasePhysicalLock()) {\n                physicalUnLockOnFS();\n            }\n            lock.unlock();\n        }\n    }\n\n    public boolean hasBeenInUse() {\n        if (recentlyAccessed()) {\n            return true;\n        }\n        return lock.isLocked();\n    }\n\n    private boolean recentlyAccessed() {\n        return (System.currentTimeMillis() - lastAccessMilliseconds) < lastAccessThresholdMilliseconds;\n    }\n\n    private boolean needToCreatePhysicalLock() {\n        return ((physicalLock == null || !physicalLock.isValid()) && lock.getHoldCount() == 1);\n    }\n\n    private boolean releasePhysicalLock() {\n        return physicalLock != null && physicalLock.isValid() && lock.isLocked() && lock.getHoldCount() == 1;\n    }\n\n    void physicalLockOnFS() {\n        try {\n            File file = lockFile.toFile();\n            RandomAccessFile raf = new RandomAccessFile(file,\n                                                        \"rw\");\n            fileChannel = raf.getChannel();\n            physicalLock = fileChannel.lock();\n            fileChannel.position(0);\n            fileChannel.write(ByteBuffer.wrap(\"locked\".getBytes()));\n        } catch (Exception e) {\n            LOGGER.error(\"Error during lock of FS [\" + repoURI.toString() + \" -- \" + this.getLockName() + \"]\",\n                         e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    void physicalUnLockOnFS() {\n        try {\n            physicalLock.release();\n            fileChannel.close();\n            fileChannel = null;\n            physicalLock = null;\n        } catch (Exception e) {\n            LOGGER.error(\"Error during unlock of FS [\" + repoURI.toString() + \" -- \" + this.getLockName() + \"]\",\n                         e);\n            throw new RuntimeException(e);\n        }\n    }\n\n    java.nio.file.Path createLockInfra(URI uri) {\n        java.nio.file.Path lockFile = null;\n        try {\n            java.nio.file.Path repo = Paths.get(uri);\n            lockFile = repo.resolve(getLockName());\n            Files.createFile(lockFile);\n        } catch (FileAlreadyExistsException ignored) {\n        } catch (Exception e) {\n            LOGGER.error(\"Error building lock infra [\" + toString() + \"]\",\n                         e);\n            throw new RuntimeException(e);\n        }\n        return lockFile;\n    }\n\n    protected String getLockName() {\n        return this.lockName;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/FileSystemLockManager.java",
    "content": "package org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.TimeUnit;\n\npublic class FileSystemLockManager {\n\n    final Map<String, FileSystemLock> fileSystemsLocks = new ConcurrentHashMap<>();\n\n    private static class LazyHolder {\n\n        static final FileSystemLockManager INSTANCE = new FileSystemLockManager();\n    }\n\n    public static FileSystemLockManager getInstance() {\n        return LazyHolder.INSTANCE;\n    }\n\n    public FileSystemLock getFileSystemLock(File directory,\n                                            String lockName,\n                                            TimeUnit lastAccessTimeUnit,\n                                            long lastAccessThreshold) {\n\n        return fileSystemsLocks.computeIfAbsent(directory.getAbsolutePath(),\n                                                key -> new FileSystemLock(directory,\n                                                                          lockName,\n                                                                          lastAccessTimeUnit,\n                                                                          lastAccessThreshold));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitBasicAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.FileTimeImpl;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathType;\n\nimport java.util.List;\n\n/**\n *\n */\npublic class JGitBasicAttributeView extends AbstractBasicFileAttributeView<JGitPathImpl> {\n\n    private BasicFileAttributes attrs = null;\n\n    public JGitBasicAttributeView(final JGitPathImpl path) {\n        super(path);\n    }\n\n    @Override\n    public BasicFileAttributes readAttributes() throws IOException {\n        if (attrs == null) {\n            attrs = buildAttrs(path.getFileSystem(),\n                    path.getRefTree(),\n                    path.getPath());\n        }\n        return attrs;\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{BasicFileAttributeView.class, JGitBasicAttributeView.class};\n    }\n\n    private BasicFileAttributes buildAttrs(final JGitFileSystem fs,\n                                           final String branchName,\n                                           final String path) {\n        final PathInfo pathInfo = fs.getGit().getPathInfo(branchName,\n                path);\n\n        if (pathInfo == null || pathInfo.getPathType().equals(PathType.NOT_FOUND)) {\n            throw new NoSuchFileException(path);\n        }\n\n        final Ref ref = fs.getGit().getRef(branchName);\n        final CommitTime commits = new CommitTime();\n\n        return new BasicFileAttributes() {\n\n            @Override\n            public FileTime lastModifiedTime() {\n                if (commits.getFirstCommitTime() != null) {\n                    return new FileTimeImpl(commits.getFirstCommitTime());\n                } else {\n                    fetchJGitHistoryDates();\n                    if (commits.getFirstCommitTime() != null) {\n                        return new FileTimeImpl(commits.getFirstCommitTime());\n                    } else {\n                        return new FileTimeImpl(0);\n                    }\n                }\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return lastModifiedTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                if (commits.getLastCommitTime() != null) {\n                    return new FileTimeImpl(commits.getLastCommitTime());\n                } else {\n                    fetchJGitHistoryDates();\n                    if (commits.getLastCommitTime() != null) {\n                        return new FileTimeImpl(commits.getLastCommitTime());\n                    } else {\n                        return new FileTimeImpl(0);\n                    }\n                }\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return pathInfo.getPathType().equals(PathType.FILE);\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return pathInfo.getPathType().equals(PathType.DIRECTORY);\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return false;\n            }\n\n            @Override\n            public boolean isOther() {\n                return false;\n            }\n\n            @Override\n            public long size() {\n                return pathInfo.getSize();\n            }\n\n            @Override\n            public Object fileKey() {\n                return pathInfo.getObjectId() == null ? null : pathInfo.getObjectId().toString();\n            }\n\n            private void fetchJGitHistoryDates() {\n                if (ref != null) {\n                    try {\n                        final CommitHistory history = fs.getGit().listCommits(ref, pathInfo.getPath());\n                        List<RevCommit> rec = history.getCommits();\n                        commits.setFirstCommitTime(rec.get(0).getAuthorIdent().getWhen().getTime());\n                        commits.setLastCommitTime(rec.get(rec.size() - 1).getAuthorIdent().getWhen().getTime());\n                    } catch (Exception e) {\n                        throw new IOException(e);\n                    }\n                }\n            }\n        };\n    }\n\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFSPath.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.util.Iterator;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FSPath;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\n\npublic class JGitFSPath implements FSPath {\n\n    private final JGitFileSystem fs;\n\n    public JGitFSPath(final JGitFileSystem fs) {\n        this.fs = fs;\n    }\n\n    @Override\n    public FileSystem getFileSystem() {\n        return fs;\n    }\n\n    @Override\n    public boolean isAbsolute() {\n        return true;\n    }\n\n    @Override\n    public Path getRoot() {\n        return Paths.get(fs.getGit().getRepository().getDirectory().toURI());\n    }\n\n    @Override\n    public Path getFileName() {\n        return null;\n    }\n\n    @Override\n    public Path getParent() {\n        return null;\n    }\n\n    @Override\n    public int getNameCount() {\n        return -1;\n    }\n\n    @Override\n    public Path getName(final int index) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Path subpath(final int beginIndex,\n                        final int endIndex) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public boolean startsWith(final Path other) {\n        return false;\n    }\n\n    @Override\n    public boolean startsWith(final String other) throws InvalidPathException {\n        return false;\n    }\n\n    @Override\n    public boolean endsWith(final Path other) {\n        return false;\n    }\n\n    @Override\n    public boolean endsWith(final String other) throws InvalidPathException {\n        return false;\n    }\n\n    @Override\n    public Path normalize() {\n        return this;\n    }\n\n    @Override\n    public Path resolve(final Path other) {\n        return null;\n    }\n\n    @Override\n    public Path resolve(final String other) throws InvalidPathException {\n        return null;\n    }\n\n    @Override\n    public Path resolveSibling(final Path other) {\n        return null;\n    }\n\n    @Override\n    public Path resolveSibling(final String other) throws InvalidPathException {\n        return null;\n    }\n\n    @Override\n    public Path relativize(final Path other) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public URI toUri() throws IOException, SecurityException {\n        return URI.create(fs.toString());\n    }\n\n    @Override\n    public Path toAbsolutePath() throws IOException, SecurityException {\n        return this;\n    }\n\n    @Override\n    public Path toRealPath(final LinkOption... options) throws IOException, SecurityException {\n        return this;\n    }\n\n    @Override\n    public File toFile() throws UnsupportedOperationException {\n        return fs.getGit().getRepository().getDirectory();\n    }\n\n    @Override\n    public int compareTo(final Path path) {\n        return 0;\n    }\n\n    @Override\n    public Iterator<Path> iterator() {\n        return null;\n    }\n\n    @Override\n    public WatchKey register(final WatchService watcher,\n                             final WatchEvent.Kind<?>[] events,\n                             final WatchEvent.Modifier... modifiers) throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public WatchKey register(final WatchService watcher,\n                             final WatchEvent.Kind<?>... events) throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException, IOException, SecurityException {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileStore.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileStoreAttributeView;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic class JGitFileStore implements FileStore {\n\n    private final Repository repository;\n\n    JGitFileStore(final Repository repository) {\n        this.repository = checkNotNull(\"repository\",\n                                       repository);\n    }\n\n    @Override\n    public String name() {\n        return repository.getDirectory().getName();\n    }\n\n    @Override\n    public String type() {\n        return \"file\";\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n\n    @Override\n    public long getTotalSpace() throws IOException {\n        return repository.getDirectory().getTotalSpace();\n    }\n\n    @Override\n    public long getUsableSpace() throws IOException {\n        return repository.getDirectory().getUsableSpace();\n    }\n\n    @Override\n    public long getUnallocatedSpace() throws IOException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public boolean supportsFileAttributeView(final Class<? extends FileAttributeView> type) {\n        checkNotNull(\"type\",\n                     type);\n\n        return type.equals(BasicFileAttributeView.class);\n    }\n\n    @Override\n    public boolean supportsFileAttributeView(final String name) {\n        checkNotEmpty(\"name\",\n                      name);\n\n        return name.equals(\"basic\");\n    }\n\n    @Override\n    public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {\n        checkNotNull(\"type\",\n                     type);\n\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(final String attribute) throws UnsupportedOperationException, IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n\n        if (attribute.equals(\"totalSpace\")) {\n            return getTotalSpace();\n        }\n        if (attribute.equals(\"usableSpace\")) {\n            return getUsableSpace();\n        }\n        if (attribute.equals(\"readOnly\")) {\n            return isReadOnly();\n        }\n        if (attribute.equals(\"name\")) {\n            return name();\n        }\n        throw new UnsupportedOperationException(\"Attribute '\" + attribute + \"' not available\");\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (o == null) {\n            return false;\n        }\n        if (!(o instanceof FileStore)) {\n            return false;\n        }\n\n        final FileStore ofs = (FileStore) o;\n\n        return name().equals(ofs.name());\n    }\n\n    @Override\n    public int hashCode() {\n        return name().hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.base.FileSystemId;\nimport org.uberfire.java.nio.base.FileSystemStateAware;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.LockableFileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\n\npublic interface JGitFileSystem extends FileSystem,\n                                        FileSystemId,\n                                        FileSystemStateAware,\n                                        LockableFileSystem {\n\n    Git getGit();\n\n    CredentialsProvider getCredential();\n\n    void checkClosed() throws IllegalStateException;\n\n    void publishEvents(Path watchable,\n                       List<WatchEvent<?>> elist);\n\n    boolean isOnBatch();\n\n    void setState(String state);\n\n    CommitInfo buildCommitInfo(String defaultMessage,\n                               CommentedOption op);\n\n    void setBatchCommitInfo(String defaultMessage,\n                            CommentedOption op);\n\n    void setHadCommitOnBatchState(Path path,\n                                  boolean hadCommitOnBatchState);\n\n    void setHadCommitOnBatchState(boolean value);\n\n    boolean isHadCommitOnBatchState(Path path);\n\n    void setBatchCommitInfo(CommitInfo batchCommitInfo);\n\n    CommitInfo getBatchCommitInfo();\n\n    int incrementAndGetCommitCount();\n\n    void resetCommitCount();\n\n    int getNumberOfCommitsSinceLastGC();\n\n    void addPostponedWatchEvents(List<WatchEvent<?>> postponedWatchEvents);\n\n    List<WatchEvent<?>> getPostponedWatchEvents();\n\n    void clearPostponedWatchEvents();\n\n    boolean hasPostponedEvents();\n\n    boolean hasBeenInUse();\n\n    void notifyExternalUpdate();\n\n    void notifyPostCommit(int exitCode);\n\n    void checkBranchAccess(ReceiveCommand command,\n                           User user);\n\n    void filterBranchAccess(UploadPack uploadPack,\n                            User user);\n\n    void setPublicURI(Map<String, String> fullHostNames);\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.TimeZone;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.stream.Collectors;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.PathMatcher;\nimport org.uberfire.java.nio.file.PatternSyntaxException;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooksConstants;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.extensions.JGitFSHooks;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitFileSystemsEventsManager;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.unmodifiableSet;\nimport static org.eclipse.jgit.lib.Repository.shortenRefName;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class JGitFileSystemImpl implements JGitFileSystem {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(JGitFileSystemImpl.class);\n    private static final Set<String> SUPPORTED_ATTR_VIEWS = unmodifiableSet(new HashSet<>(asList(\"basic\",\n                                                                                                 \"version\")));\n    private final JGitFileSystemProvider provider;\n    private final Git git;\n    private String toStringContent;\n    private boolean isClosed = false;\n    private final FileStore fileStore;\n    private final String name;\n    private final CredentialsProvider credential;\n    private final Map<FileSystemHooks, ?> fsHooks;\n    private final AtomicInteger numberOfCommitsSinceLastGC = new AtomicInteger(0);\n    private FileSystemState state = FileSystemState.NORMAL;\n    private CommitInfo batchCommitInfo = null;\n    private Map<Path, Boolean> hadCommitOnBatchState = new ConcurrentHashMap<>();\n    private JGitFileSystemLock lock;\n    private JGitFileSystemsEventsManager fsEventsManager;\n\n    private List<WatchEvent<?>> postponedWatchEvents = Collections.synchronizedList(new ArrayList<>());\n\n    public JGitFileSystemImpl(final JGitFileSystemProvider provider,\n                              final Map<String, String> fullHostNames,\n                              final Git git,\n                              final JGitFileSystemLock lock,\n                              final String name,\n                              final CredentialsProvider credential,\n                              JGitFileSystemsEventsManager fsEventsManager,\n                              Map<FileSystemHooks, ?> fsHooks) {\n        this.fsEventsManager = fsEventsManager;\n        this.provider = checkNotNull(\"provider\",\n                                     provider);\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.name = checkNotEmpty(\"name\",\n                                  name);\n\n        this.lock = checkNotNull(\"lock\",\n                                 lock);\n        this.credential = checkNotNull(\"credential\",\n                                       credential);\n        this.fsHooks = fsHooks;\n        this.fileStore = new JGitFileStore(this.git.getRepository());\n        setPublicURI(fullHostNames);\n    }\n\n    @Override\n    public String id() {\n        return name;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public Git getGit() {\n        return git;\n    }\n\n    @Override\n    public CredentialsProvider getCredential() {\n        return credential;\n    }\n\n    @Override\n    public FileSystemProvider provider() {\n        return provider;\n    }\n\n    @Override\n    public boolean isOpen() {\n        return !isClosed;\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n\n    @Override\n    public String getSeparator() {\n        return \"/\";\n    }\n\n    @Override\n    public Iterable<Path> getRootDirectories() {\n        checkClosed();\n        return () -> new Iterator<Path>() {\n\n            Iterator<Ref> branches = null;\n\n            @Override\n            public boolean hasNext() {\n                if (branches == null) {\n                    init();\n                }\n                return branches.hasNext();\n            }\n\n            private void init() {\n                branches = git.listRefs().iterator();\n            }\n\n            @Override\n            public Path next() {\n\n                if (branches == null) {\n                    init();\n                }\n                try {\n                    return JGitPathImpl.createRoot(JGitFileSystemImpl.this,\n                                                   \"/\",\n                                                   shortenRefName(branches.next().getName()) + \"@\" + name,\n                                                   false);\n                } catch (NoSuchElementException e) {\n                    throw new IllegalStateException(\n                            \"The gitnio directory is in an invalid state. \" +\n                                    \"If you are an IntelliJ IDEA user, \" +\n                                    \"there is a known bug which requires specifying \" +\n                                    \"a custom directory for your git repository. \" +\n                                    \"You can specify a custom directory using '-Dorg.uberfire.nio.git.dir=/tmp/dir'. \" +\n                                    \"For more details please see https://issues.jboss.org/browse/UF-275.\",\n                            e);\n                }\n            }\n\n            @Override\n            public void remove() {\n                throw new UnsupportedOperationException();\n            }\n        };\n    }\n\n    @Override\n    public Iterable<FileStore> getFileStores() {\n        checkClosed();\n        return () -> new Iterator<FileStore>() {\n\n            private int i = 0;\n\n            @Override\n            public boolean hasNext() {\n                return i < 1;\n            }\n\n            @Override\n            public FileStore next() {\n                if (i < 1) {\n                    i++;\n                    return fileStore;\n                } else {\n                    throw new NoSuchElementException();\n                }\n            }\n\n            @Override\n            public void remove() {\n                throw new UnsupportedOperationException();\n            }\n        };\n    }\n\n    @Override\n    public Set<String> supportedFileAttributeViews() {\n        checkClosed();\n        return SUPPORTED_ATTR_VIEWS;\n    }\n\n    @Override\n    public Path getPath(final String first,\n                        final String... more)\n            throws InvalidPathException {\n        checkClosed();\n        if (first == null || first.trim().isEmpty() || first.trim().equals(\"/\")) {\n            return new JGitFSPath(this);\n        }\n\n        if (more == null || more.length == 0) {\n            return JGitPathImpl.create(this,\n                                       first,\n                                       JGitPathImpl.DEFAULT_REF_TREE + \"@\" + name,\n                                       false);\n        }\n\n        final StringBuilder sb = new StringBuilder();\n        for (final String segment : more) {\n            if (segment.length() > 0) {\n                if (sb.length() > 0) {\n                    sb.append(getSeparator());\n                }\n                sb.append(segment);\n            }\n        }\n        return JGitPathImpl.create(this,\n                                   sb.toString(),\n                                   first + \"@\" + name,\n                                   false);\n    }\n\n    @Override\n    public PathMatcher getPathMatcher(final String syntaxAndPattern)\n            throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException {\n        checkClosed();\n        checkNotEmpty(\"syntaxAndPattern\",\n                      syntaxAndPattern);\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public UserPrincipalLookupService getUserPrincipalLookupService()\n            throws UnsupportedOperationException {\n        checkClosed();\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public WatchService newWatchService()\n            throws UnsupportedOperationException, IOException {\n        checkClosed();\n        return fsEventsManager.newWatchService(name);\n    }\n\n    @Override\n    public void close() throws IOException {\n        if (isClosed) {\n            return;\n        }\n        git.getRepository().close();\n        isClosed = true;\n        try {\n            fsEventsManager.close(name);\n        } catch (final Exception ex) {\n            LOGGER.error(\"Error during close of WatchServices [\" + toString() + \"]\",\n                         ex);\n        } finally {\n            provider.onCloseFileSystem(this);\n        }\n    }\n\n    @Override\n    public void checkClosed() throws IllegalStateException {\n        if (isClosed) {\n            throw new IllegalStateException(\"FileSystem is closed.\");\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            if (o != null && o instanceof JGitFileSystemProxy) {\n                o = ((JGitFileSystemProxy) o).getRealJGitFileSystem();\n            } else {\n                return false;\n            }\n        }\n\n        JGitFileSystemImpl that = (JGitFileSystemImpl) o;\n\n        if (!name.equals(that.name)) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public String toString() {\n        return toStringContent;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name.hashCode();\n        return result;\n    }\n\n    @Override\n    public void publishEvents(final Path watchableRoot,\n                              final List<WatchEvent<?>> elist) {\n        fsEventsManager.publishEvents(name,\n                                      watchableRoot,\n                                      elist);\n    }\n\n    @Override\n    public void dispose() {\n        if (!isClosed) {\n            close();\n        }\n        provider.onDisposeFileSystem(this);\n    }\n\n    @Override\n    public boolean isOnBatch() {\n        return state.equals(FileSystemState.BATCH);\n    }\n\n    @Override\n    public void setState(String state) {\n        try {\n            this.state = FileSystemState.valueOf(state);\n        } catch (final Exception ex) {\n            this.state = FileSystemState.NORMAL;\n        }\n    }\n\n    @Override\n    public CommitInfo buildCommitInfo(final String defaultMessage,\n                                      final CommentedOption op) {\n        String sessionId = null;\n        String name = null;\n        String email = null;\n        String message = defaultMessage;\n        TimeZone timeZone = null;\n        Date when = null;\n\n        if (op != null) {\n            sessionId = op.getSessionId();\n            name = op.getName();\n            email = op.getEmail();\n            if (op.getMessage() != null && !op.getMessage().trim().isEmpty()) {\n                message = op.getMessage();\n            }\n            timeZone = op.getTimeZone();\n            when = op.getWhen();\n        }\n\n        return new CommitInfo(sessionId,\n                              name,\n                              email,\n                              message,\n                              timeZone,\n                              when);\n    }\n\n    @Override\n    public void setBatchCommitInfo(final String defaultMessage,\n                                   final CommentedOption op) {\n        this.batchCommitInfo = buildCommitInfo(defaultMessage,\n                                               op);\n    }\n\n    @Override\n    public void setHadCommitOnBatchState(final Path path,\n                                         final boolean hadCommitOnBatchState) {\n        final Path root = checkNotNull(\"path\",\n                                       path).getRoot();\n        this.hadCommitOnBatchState.put(root.getRoot(),\n                                       hadCommitOnBatchState);\n    }\n\n    @Override\n    public void setHadCommitOnBatchState(final boolean value) {\n        for (Map.Entry<Path, Boolean> entry : hadCommitOnBatchState.entrySet()) {\n            entry.setValue(value);\n        }\n    }\n\n    @Override\n    public boolean isHadCommitOnBatchState(final Path path) {\n        final Path root = checkNotNull(\"path\",\n                                       path).getRoot();\n        return hadCommitOnBatchState.containsKey(root) ? hadCommitOnBatchState.get(root) : false;\n    }\n\n    @Override\n    public void setBatchCommitInfo(CommitInfo batchCommitInfo) {\n        this.batchCommitInfo = batchCommitInfo;\n    }\n\n    @Override\n    public CommitInfo getBatchCommitInfo() {\n        return batchCommitInfo;\n    }\n\n    @Override\n    public int incrementAndGetCommitCount() {\n        return numberOfCommitsSinceLastGC.incrementAndGet();\n    }\n\n    @Override\n    public void resetCommitCount() {\n        numberOfCommitsSinceLastGC.set(0);\n    }\n\n    @Override\n    public int getNumberOfCommitsSinceLastGC() {\n        return numberOfCommitsSinceLastGC.get();\n    }\n\n    @Override\n    public FileSystemState getState() {\n        return state;\n    }\n\n    @Override\n    public void lock() {\n        lock.lock();\n    }\n\n    @Override\n    public void unlock() {\n        lock.unlock();\n    }\n\n    public JGitFileSystemLock getLock() {\n        return lock;\n    }\n\n    @Override\n    public void addPostponedWatchEvents(List<WatchEvent<?>> postponedWatchEvents) {\n        this.postponedWatchEvents.addAll(postponedWatchEvents);\n    }\n\n    @Override\n    public List<WatchEvent<?>> getPostponedWatchEvents() {\n        return postponedWatchEvents;\n    }\n\n    @Override\n    public void clearPostponedWatchEvents() {\n        this.postponedWatchEvents = Collections.synchronizedList(new ArrayList<>());\n    }\n\n    @Override\n    public boolean hasPostponedEvents() {\n        return !getPostponedWatchEvents().isEmpty();\n    }\n\n    @Override\n    public boolean hasBeenInUse() {\n        return lock.hasBeenInUse();\n    }\n\n    @Override\n    public void notifyExternalUpdate() {\n        Object hook = fsHooks.get(FileSystemHooks.ExternalUpdate);\n        if (hook != null) {\n            JGitFSHooks.executeFSHooks(hook, FileSystemHooks.ExternalUpdate, new FileSystemHookExecutionContext(name));\n        }\n    }\n\n    @Override\n    public void notifyPostCommit(int exitCode) {\n        Object hook = fsHooks.get(FileSystemHooks.PostCommit);\n        if (hook != null) {\n            FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(name);\n            ctx.addParam(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE, exitCode);\n\n            JGitFSHooks.executeFSHooks(hook, FileSystemHooks.ExternalUpdate, ctx);\n        }\n    }\n\n    @Override\n    public void checkBranchAccess(final ReceiveCommand command,\n                                  final User user) {\n        Object hook = fsHooks.get(FileSystemHooks.BranchAccessCheck);\n        if (hook != null) {\n            FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(name);\n            ctx.addParam(FileSystemHooksConstants.RECEIVE_COMMAND, command);\n            ctx.addParam(FileSystemHooksConstants.USER, user);\n\n            JGitFSHooks.executeFSHooks(hook, FileSystemHooks.BranchAccessCheck, ctx);\n        }\n    }\n\n    @Override\n    public void filterBranchAccess(final UploadPack uploadPack,\n                                   final User user) {\n        Object hook = fsHooks.get(FileSystemHooks.BranchAccessFilter);\n        if (hook != null) {\n            FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(name);\n            ctx.addParam(FileSystemHooksConstants.UPLOAD_PACK, uploadPack);\n            ctx.addParam(FileSystemHooksConstants.USER, user);\n\n            JGitFSHooks.executeFSHooks(hook, FileSystemHooks.BranchAccessFilter, ctx);\n        }\n    }\n\n    @Override\n    public void setPublicURI(Map<String, String> fullHostNames) {\n        if (fullHostNames != null && !fullHostNames.isEmpty()) {\n            toStringContent = fullHostNames.entrySet()\n                    .stream()\n                    .map(e -> e.getKey() + \"://\" + e.getValue() + \"/\" + name)\n                    .collect(Collectors.joining(\"\\n\"));\n        } else {\n            toStringContent = \"git://\" + name;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemLock.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class JGitFileSystemLock extends FileSystemLock {\n\n    public JGitFileSystemLock(Git git,\n                              TimeUnit t,\n                              long duration) {\n\n        super(git.getRepository().getDirectory(),\n              \"af.lock\",\n              t,\n              duration);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.FilterOutputStream;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.RandomAccessFile;\nimport java.io.UnsupportedEncodingException;\nimport java.net.Authenticator;\nimport java.net.InetSocketAddress;\nimport java.net.URI;\nimport java.net.URLEncoder;\nimport java.nio.ByteBuffer;\nimport java.nio.channels.FileChannel;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Set;\nimport java.util.TimeZone;\nimport java.util.concurrent.Executor;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\n\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.errors.RepositoryNotFoundException;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.internal.ketch.KetchSystem;\nimport org.eclipse.jgit.internal.storage.file.WindowCache;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevTree;\nimport org.eclipse.jgit.storage.file.WindowCacheConfig;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.ReceivePack;\nimport org.eclipse.jgit.transport.SshSessionFactory;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;\nimport org.eclipse.jgit.transport.resolver.ReceivePackFactory;\nimport org.eclipse.jgit.transport.resolver.RepositoryResolver;\nimport org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;\nimport org.eclipse.jgit.transport.resolver.UploadPackFactory;\nimport org.eclipse.jgit.util.FS;\nimport org.eclipse.jgit.util.FileUtils;\nimport org.eclipse.jgit.util.ProcessResult;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveThreadFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.java.nio.EncodingUtil;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.ExtendedAttributeView;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.base.SeekableByteChannelFileBasedImpl;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributeView;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributes;\nimport org.uberfire.java.nio.base.dotfiles.DotFileOption;\nimport org.uberfire.java.nio.base.options.CherryPickCopyOption;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.base.options.MergeCopyOption;\nimport org.uberfire.java.nio.base.options.SquashOption;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.channels.AsynchronousFileChannel;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AmbiguousFileSystemNameException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.StandardCopyOption;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.java.nio.file.StandardOpenOption;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.fs.jgit.daemon.git.Daemon;\nimport org.uberfire.java.nio.fs.jgit.daemon.ssh.BaseGitCommand;\nimport org.uberfire.java.nio.fs.jgit.daemon.ssh.GitSSHService;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsCache;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsManager;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitHookSupport;\nimport org.uberfire.java.nio.fs.jgit.util.ProxyAuthenticator;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.PathUtil;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.CopyCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MoveCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathType;\nimport org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitFileSystemsEventsManager;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitWatchEvent;\nimport org.uberfire.java.nio.security.FileSystemAuthorizer;\nimport org.uberfire.java.nio.security.SSHAuthenticator;\nimport org.uberfire.java.nio.security.SecuredFileSystemProvider;\n\nimport static java.util.Collections.emptyList;\nimport static org.eclipse.jgit.lib.Constants.DOT_GIT_EXT;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.commons.data.Pair.newPair;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.buildDotFile;\nimport static org.uberfire.java.nio.base.dotfiles.DotFileUtils.dot;\nimport static org.uberfire.java.nio.file.StandardOpenOption.READ;\nimport static org.uberfire.java.nio.file.StandardOpenOption.TRUNCATE_EXISTING;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.DEFAULT_SCHEME_SIZE;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_BRANCH_LIST;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEST_PATH;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_MIRROR;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_PASSWORD;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_SUBDIRECTORY;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_ENV_KEY_USER_NAME;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.SCHEME;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.SCHEME_SIZE;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.DIRECTORY;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.NOT_FOUND;\n\npublic class JGitFileSystemProvider implements SecuredFileSystemProvider,\n                                               Disposable,\n                                               GitHookSupport {\n\n    private static final Logger LOG = LoggerFactory.getLogger(JGitFileSystemProvider.class);\n    private static final TimeUnit LOCK_LAST_ACCESS_TIME_UNIT = TimeUnit.SECONDS;\n    private static final long LOCK_LAST_ACCESS_THRESHOLD = 10;\n    final KetchSystem system = new KetchSystem();\n    final KetchLeaderCache leaders = new KetchLeaderCache(system);\n    private final Map<String, String> fullHostNames = new HashMap<>();\n    private final Object postponedEventsLock = new Object();\n    private final ExecutorService executorService;\n    JGitFileSystemProviderConfiguration config;\n    JGitFileSystemsManager fsManager;\n    JGitFileSystemsEventsManager fsEventsManager;\n    private boolean isDefault;\n    private Daemon daemonService = null;\n    private GitSSHService gitSSHService = null;\n    private FS detectedFS = FS.DETECTED;\n    private AuthenticationService httpAuthenticator;\n    private FileSystemAuthorizer authorizer;\n\n    /**\n     * Creates a JGit filesystem provider which takes its configuration from system properties. In a normal production\n     * deployment of UberFire, this is the constructor that will be invoked by the ServiceLoader mechanism.\n     * For a list of properties that affect the configuration of JGitFileSystemProvider, see the DEBUG log output of\n     * this class during startup.\n     */\n    public JGitFileSystemProvider() {\n        this(new ConfigProperties(System.getProperties()),\n             Executors.newCachedThreadPool(new DescriptiveThreadFactory()));\n    }\n\n    /**\n     * Creates a JGit filesystem provider which takes its configuration from the given map.\n     * For a list of properties that affect the configuration of JGitFileSystemProvider, see the DEBUG log output of\n     * this class during startup.\n     */\n    public JGitFileSystemProvider(final Map<String, String> gitPrefs) {\n        this(new ConfigProperties(gitPrefs),\n             Executors.newCachedThreadPool(new DescriptiveThreadFactory()));\n    }\n\n    /**\n     * Creates a JGit filesystem provider which takes its configuration from the given ConfigProperties instance.\n     * For a list of properties that affect the configuration of JGitFileSystemProvider, see the DEBUG log output of\n     * this class during startup.\n     */\n    public JGitFileSystemProvider(final ConfigProperties gitPrefs,\n                                  final ExecutorService executorService) {\n        this.executorService = executorService;\n\n        setupConfigs(gitPrefs);\n\n        setupFileSystemsManager();\n\n        setupFSEvents();\n\n        setupGitDefaultCredentials();\n\n        setupSSH();\n\n        setupFullHostNames();\n\n        setupDaemon();\n\n        setupGitSSH();\n    }\n\n    static Map<FileSystemHooks, ?> extractFSHooks(Map<String, ?> env) {\n\n        return Arrays.stream(FileSystemHooks.values())\n                .filter(h -> env.get(h.name()) != null)\n                .collect(Collectors.toMap(Function.identity(),\n                                          k -> env.get(k.name())));\n    }\n\n    //by spec, it should be a list of pairs, but here we're just using a map.\n    private static Map<String, String> getQueryParams(final URI uri) {\n        final String[] params = uri.getQuery().split(\"&\");\n        return new HashMap<String, String>(params.length) {{\n            for (String param : params) {\n                final String[] kv = param.split(\"=\");\n                final String name = kv[0];\n                final String value;\n                if (kv.length == 2) {\n                    value = kv[1];\n                } else {\n                    value = \"\";\n                }\n\n                put(name,\n                    value);\n            }\n        }};\n    }\n\n    protected static String removeRefsFromTree(final String tree) {\n        if (tree != null && tree.startsWith(\"refs/\")) {\n            return tree.replaceFirst(\"(refs/(remotes/[^/]*|heads|tags)/)\", \"\");\n        }\n        return tree;\n    }\n\n    private void setupFSEvents() {\n        fsEventsManager = new JGitFileSystemsEventsManager();\n    }\n\n    protected void setupFileSystemsManager() {\n        fsManager = new JGitFileSystemsManager(this,\n                                               config);\n    }\n\n    private void setupConfigs(ConfigProperties gitPrefs) {\n        config = new JGitFileSystemProviderConfiguration();\n\n        loadConfig(gitPrefs);\n    }\n\n    private void setupGitSSH() {\n        if (config.isSshEnabled()) {\n            buildAndStartSSH();\n        } else {\n            gitSSHService = null;\n        }\n    }\n\n    private void setupDaemon() {\n        if (config.isDaemonEnabled()) {\n            buildAndStartDaemon();\n        } else {\n            daemonService = null;\n        }\n    }\n\n    private void setupFullHostNames() {\n        if (config.isDaemonEnabled()) {\n            fullHostNames.put(\"git\",\n                              config.getDaemonHostName() + \":\" + config.getDaemonPort());\n        }\n        if (config.isSshEnabled()) {\n            fullHostNames.put(\"ssh\",\n                              config.getSshHostName() + \":\" + config.getSshPort());\n        }\n    }\n\n    private void setupSSH() {\n        SshSessionFactory.setInstance(new JGitSSHConfigSessionFactory(config));\n    }\n\n    private void setupGitDefaultCredentials() {\n        CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider(\"guest\",\n                                                                               \"\"));\n    }\n\n    private void loadConfig(final ConfigProperties systemConfig) {\n\n        config.load(systemConfig);\n\n        if (config.httpProxyIsDefined()) {\n            setupProxyAuthentication();\n        }\n    }\n\n    private void setupProxyAuthentication() {\n        Authenticator.setDefault(new ProxyAuthenticator(config.getHttpProxyUser(),\n                                                        config.getHttpProxyPassword(),\n                                                        config.getHttpsProxyUser(),\n                                                        config.getHttpsProxyPassword()));\n    }\n\n    public void onCloseFileSystem(final JGitFileSystem fileSystem) {\n        fsManager.addClosedFileSystems(fileSystem);\n\n        synchronized (postponedEventsLock) {\n            fileSystem.clearPostponedWatchEvents();\n        }\n\n        if (fsManager.allTheFSAreClosed()) {\n            forceStopDaemon();\n            shutdownSSH();\n            shutdownEventsManager();\n        }\n    }\n\n    protected void shutdownEventsManager() {\n        this.fsEventsManager.shutdown();\n    }\n\n    public void onDisposeFileSystem(final JGitFileSystem fileSystem) {\n        onCloseFileSystem(fileSystem);\n        fsManager.remove(fileSystem.id());\n    }\n\n    @Override\n    public void setAuthorizer(FileSystemAuthorizer authorizer) {\n        this.authorizer = checkNotNull(\"authorizer\", authorizer);\n    }\n\n    @Override\n    public void setJAASAuthenticator(AuthenticationService authenticator) {\n        if (gitSSHService != null) {\n            gitSSHService.setUserPassAuthenticator(authenticator);\n        }\n    }\n\n    @Override\n    public void setHTTPAuthenticator(final AuthenticationService httpAuthenticator) {\n        this.httpAuthenticator = httpAuthenticator;\n    }\n\n    @Override\n    public void setSSHAuthenticator(SSHAuthenticator authenticator) {\n        checkNotNull(\"authenticator\",\n                     authenticator);\n\n        if (gitSSHService != null) {\n            gitSSHService.setSshAuthenticator(authenticator);\n        }\n    }\n\n    @Override\n    public void dispose() {\n        shutdown();\n    }\n\n    public void addHostName(final String protocol, String s) {\n        fullHostNames.put(protocol, s);\n    }\n\n    public void updateCacheWithHostNames() {\n        JGitFileSystemsCache fc = fsManager.getFsCache();\n        fc.getFileSystems()\n                .stream()\n                .map(fsName -> ((JGitFileSystemProxy) fsManager.get(fsName)).getRealJGitFileSystem())\n                .forEach(fs -> {\n                    JGitFileSystemImpl fsImpl = (JGitFileSystemImpl) fs;\n                    fs.setPublicURI(fullHostNames);\n                    fsManager.updateFSCacheEntry(fs.getName(), fsImpl);\n                });\n    }\n\n    public Map<String, String> getFullHostNames() {\n        return new HashMap<>(fullHostNames);\n    }\n\n    private User extractUser(Object client) {\n        if (httpAuthenticator != null && client instanceof HttpServletRequest) {\n            return httpAuthenticator.getUser();\n        } else if (client instanceof BaseGitCommand) {\n            return ((BaseGitCommand) client).getUser();\n        }\n\n        return User.ANONYMOUS;\n    }\n\n    private void buildAndStartSSH() {\n        final ReceivePackFactory receivePackFactory = (req, db) -> getReceivePack(\"ssh\", req, db);\n\n        final UploadPackFactory uploadPackFactory = (UploadPackFactory<BaseGitCommand>) (req, db) -> new UploadPack(db) {{\n            final JGitFileSystem fs = fsManager.get(db);\n            fs.filterBranchAccess(this,\n                                  req.getUser());\n        }};\n\n        gitSSHService = new GitSSHService();\n\n        gitSSHService.setup(config.getSshFileCertDir(),\n                            InetSocketAddress.createUnresolved(config.getSshHostAddr(),\n                                                               config.getSshPort()),\n                            config.getSshIdleTimeout(),\n                            config.getSshAlgorithm(),\n                            receivePackFactory,\n                            uploadPackFactory,\n                            getRepositoryResolver(),\n                            executorService,\n                            config.getGitSshCiphers(),\n                            config.getGitSshMACs());\n\n        gitSSHService.start();\n    }\n\n    public <T> ReceivePack getReceivePack(final String protocol, final T req, final Repository db) {\n        return new ReceivePack(db) {\n            {\n\n                final JGitFileSystem fs = fsManager.get(db);\n                final Map<String, RevCommit> oldTreeRefs = new HashMap<>();\n\n                setPreReceiveHook((rp, commands2) -> {\n                    fs.lock();\n                    final User user = extractUser(req);\n                    for (final ReceiveCommand command : commands2) {\n                        fs.checkBranchAccess(command,\n                                             user);\n                        final RevCommit lastCommit = fs.getGit().getLastCommit(command.getRefName());\n                        oldTreeRefs.put(command.getRefName(),\n                                        lastCommit);\n                    }\n                });\n\n                setPostReceiveHook((rp, commands) -> {\n                    fs.unlock();\n                    fs.notifyExternalUpdate();\n                    final User user = extractUser(req);\n                    for (Map.Entry<String, RevCommit> oldTreeRef : oldTreeRefs.entrySet()) {\n                        final List<RevCommit> commits = fs.getGit().listCommits(oldTreeRef.getValue(),\n                                                                                fs.getGit().getLastCommit(oldTreeRef.getKey()));\n                        for (final RevCommit revCommit : commits) {\n                            final RevTree parent = revCommit.getParentCount() > 0 ? revCommit.getParent(0).getTree() : null;\n                            notifyDiffs(fs,\n                                        oldTreeRef.getKey(),\n                                        \"<\" + protocol + \">\",\n                                        user.getIdentifier(),\n                                        revCommit.getFullMessage(),\n                                        parent,\n                                        revCommit.getTree());\n                        }\n                    }\n                });\n            }\n        };\n    }\n\n    public <T> RepositoryResolverImpl<T> getRepositoryResolver() {\n        return new RepositoryResolverImpl<>();\n    }\n\n    void buildAndStartDaemon() {\n        if (daemonService == null || !daemonService.isRunning()) {\n            daemonService = new Daemon(new InetSocketAddress(config.getDaemonHostAddr(),\n                                                             config.getDaemonPort()),\n                                       new ExecutorWrapper(executorService),\n                                       executorService,\n                                       config.isEnableKetch() ? leaders : null);\n            daemonService.setRepositoryResolver(new RepositoryResolverImpl<>());\n            try {\n                daemonService.start();\n            } catch (java.io.IOException e) {\n                throw new IOException(e);\n            }\n        }\n    }\n\n    private void shutdownSSH() {\n        if (gitSSHService != null) {\n            gitSSHService.stop();\n        }\n    }\n\n    void forceStopDaemon() {\n        if (daemonService != null && daemonService.isRunning()) {\n            daemonService.stop();\n        }\n    }\n\n    /**\n     * Closes and disposes all open filesystems and stops the Git and SSH daemons if they are running. This filesystem\n     * provider can be reactivated by attempting to open a new filesystem or by creating a new filesystem.\n     */\n    public void shutdown() {\n        fsManager.getOpenFileSystems().forEach(JGitFileSystem::close);\n        shutdownSSH();\n        forceStopDaemon();\n        fsManager.clear();\n    }\n\n    /**\n     * Returns the directory that contains all the git repositories managed by this file system provider.\n     */\n    public File getGitRepoContainerDir() {\n        return config.getGitReposParentDir();\n    }\n\n    @Override\n    public synchronized void forceAsDefault() {\n        this.isDefault = true;\n    }\n\n    @Override\n    public boolean isDefault() {\n        return isDefault;\n    }\n\n    @Override\n    public String getScheme() {\n        return SCHEME;\n    }\n\n    @Override\n    public FileSystem newFileSystem(final Path path,\n                                    final Map<String, ?> env)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public FileSystem newFileSystem(final URI uri,\n                                    final Map<String, ?> env)\n            throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkCondition(\"uri scheme not supported\",\n                       uri.getScheme().equals(getScheme()) || uri.getScheme().equals(\"default\"));\n        checkURI(\"uri\",\n                 uri);\n        checkNotNull(\"env\",\n                     env);\n\n        String fsName = extractFSName(uri);\n\n        validateFSName(uri,\n                       fsName);\n\n        String envUsername = extractEnvProperty(GIT_ENV_KEY_USER_NAME,\n                                                env);\n        String envPassword = extractEnvProperty(GIT_ENV_KEY_PASSWORD,\n                                                env);\n\n        fsManager.newFileSystem(() -> fullHostNames,\n                                () -> createNewGitRepo(env,\n                                                       fsName),\n                                () -> fsName,\n                                () -> buildCredential(envUsername,\n                                                      envPassword),\n                                () -> fsEventsManager,\n                                () -> extractFSHooks(env));\n\n        JGitFileSystem fs = fsManager.get(fsName);\n\n        boolean init = false;\n\n        if (env.containsKey(GIT_ENV_KEY_INIT) && Boolean.valueOf(env.get(GIT_ENV_KEY_INIT).toString())) {\n            init = true;\n        }\n\n        if (!env.containsKey(GIT_ENV_KEY_DEFAULT_REMOTE_NAME) && init) {\n            try {\n                final URI initURI = URI.create(getScheme() + \"://master@\" + fsName + \"/readme.md\");\n                final OutputStream stream = newOutputStream(getPath(initURI),\n                                                            (CommentedOption) null);\n                final String _init = \"Repository Init Content\\n\" +\n                        \"=======================\\n\" +\n                        \"\\n\" +\n                        \"Your project description here.\";\n                stream.write(_init.getBytes());\n                stream.close();\n            } catch (final Exception e) {\n                e.printStackTrace();\n                LOG.info(\"Repository initialization may have failed.\",\n                         e);\n            }\n        }\n\n        if (config.isEnableKetch()) {\n            createNewGitRepo(env,\n                             fsName).enableKetch();\n        }\n\n        if (config.isDaemonEnabled() && daemonService != null && !daemonService.isRunning()) {\n            buildAndStartDaemon();\n        }\n\n        return fs;\n    }\n\n    private void validateFSName(URI uri,\n                                String fsName) {\n        if (fsManager.containsKey(fsName)) {\n            throw new FileSystemAlreadyExistsException(\"There is already a FS for \" + uri + \".\");\n        }\n        if (fsName.contains(\"/\")) {\n            String fsNameRoot = fsName.substring(0,\n                                                 fsName.indexOf(\"/\"));\n            if (fsManager.containsKey(fsNameRoot)) {\n                throw new AmbiguousFileSystemNameException(\"The file system name\"\n                                                                   + fsName\n                                                                   + \" is ambiguous with\"\n                                                                   + \" another FS registered\");\n            }\n        }\n        if (fsManager.containsRoot(fsName)) {\n            throw new AmbiguousFileSystemNameException(\"The file system name\"\n                                                               + fsName\n                                                               + \" is ambiguous with\"\n                                                               + \" another FS registered\");\n        }\n    }\n\n    private String extractEnvProperty(String key,\n                                      Map<String, ?> env) {\n        if (env == null || env.get(key) == null) {\n            return null;\n        }\n        return env.get(key).toString();\n    }\n\n    protected Git createNewGitRepo(Map<String, ?> env,\n                                   String fsName) {\n\n        final File repoDest = getRepoDest(env,\n                                          fsName);\n\n        File directory = repoDest.getParentFile();\n        String lockName = directory.getName();\n\n        if (!directory.exists()) {\n            Files.createDirectory(Paths.get(directory.toURI()));\n        }\n\n        FileSystemLock physicalLock = createLock(directory,\n                                                 lockName);\n        try {\n            physicalLock.lock();\n\n            return createNewGitRepo(env,\n                                    fsName,\n                                    repoDest);\n        } finally {\n            physicalLock.unlock();\n        }\n    }\n\n    protected Git createNewGitRepo(Map<String, ?> env,\n                                   String fsName,\n                                   File repoDest) {\n        final Git git;\n\n        String envUsername = extractEnvProperty(GIT_ENV_KEY_USER_NAME,\n                                                env);\n        String envPassword = extractEnvProperty(GIT_ENV_KEY_PASSWORD,\n                                                env);\n        Boolean envMirror = (Boolean) env.get(GIT_ENV_KEY_MIRROR);\n        boolean isMirror = envMirror == null || envMirror;\n\n        CredentialsProvider credential = buildCredential(envUsername,\n                                                         envPassword);\n\n        if (syncWithRemote(env,\n                           repoDest)) {\n            final String origin = env.get(GIT_ENV_KEY_DEFAULT_REMOTE_NAME).toString();\n            final List<String> branches = (List<String>) env.get(GIT_ENV_KEY_BRANCH_LIST);\n            final String subdirectory = (String) env.get(GIT_ENV_KEY_SUBDIRECTORY);\n            try {\n                if (this.isForkOrigin(origin)) {\n                    git = Git.fork(this.getGitRepoContainerDir(),\n                                   origin,\n                                   fsName,\n                                   branches,\n                                   credential,\n                                   config.isEnableKetch() ? leaders : null,\n                                   config.getHookDir(),\n                                   config.isSslVerify());\n                } else if (subdirectory != null) {\n                    if (isMirror) {\n                        throw new UnsupportedOperationException(\"Cannot make mirror repository when cloning subdirectory.\");\n                    }\n                    git = Git.cloneSubdirectory(repoDest,\n                                                origin,\n                                                subdirectory,\n                                                branches,\n                                                credential,\n                                                leaders,\n                                                config.getHookDir(),\n                                                config.isSslVerify());\n                } else {\n                    git = Git.clone(repoDest,\n                                    origin,\n                                    isMirror,\n                                    branches,\n                                    credential,\n                                    config.isEnableKetch() ? leaders : null,\n                                    config.getHookDir(),\n                                    config.isSslVerify());\n                }\n            } catch (Clone.CloneException ce) {\n                fsManager.remove(fsName);\n                throw new RuntimeException(ce);\n            }\n        } else {\n            git = Git.createRepository(repoDest,\n                                       config.getHookDir(),\n                                       config.isEnableKetch() ? leaders : null,\n                                       config.isSslVerify());\n        }\n        return git;\n    }\n\n    private FileSystemLock createLock(File directory,\n                                      String lockName) {\n        return FileSystemLockManager.getInstance().getFileSystemLock(directory,\n                                                                     lockName + \".lock\",\n                                                                     LOCK_LAST_ACCESS_TIME_UNIT,\n                                                                     LOCK_LAST_ACCESS_THRESHOLD);\n    }\n\n    private File getRepoDest(Map<String, ?> env,\n                             String fsName) {\n        final String outPath = (String) env.get(GIT_ENV_KEY_DEST_PATH);\n        final File repoDest;\n\n        if (outPath != null) {\n            repoDest = new File(outPath,\n                                fsName + DOT_GIT_EXT);\n        } else {\n            repoDest = new File(config.getGitReposParentDir(),\n                                fsName + DOT_GIT_EXT);\n        }\n        return repoDest;\n    }\n\n    private boolean syncWithRemote(Map<String, ?> env,\n                                   File repoDest) {\n        return env.containsKey(GIT_ENV_KEY_DEFAULT_REMOTE_NAME) && !repoDest.exists();\n    }\n\n    String extractFSName(final URI _uri) {\n        String uri = _uri.toString().replace(\"git://\",\n                                             \"\").replace(\"default://\",\n                                                         \"\");\n        if (uri.endsWith(\"/\")) {\n            uri = uri.substring(0,\n                                uri.length() - 1);\n        }\n        if (uri.contains(\"@\")) {\n            uri = uri.substring(uri.indexOf('@') + 1);\n        }\n        if (uri.contains(\":\")) {\n            uri = uri.substring(0,\n                                uri.indexOf(':') - 1);\n        }\n\n        return uri;\n    }\n\n    private boolean isForkOrigin(final String originURI) {\n        return originURI.matches(\"(^\\\\w+\\\\/\\\\w+$)\");\n    }\n\n    @Override\n    public FileSystem getFileSystem(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkCondition(\"uri scheme not supported\",\n                       uri.getScheme().equals(getScheme()) || uri.getScheme().equals(\"default\"));\n        checkURI(\"uri\",\n                 uri);\n\n        JGitFileSystem fileSystem = deepLookupFSFrom(uri);\n\n        if (hasSyncFlag(uri)) {\n            try {\n                final String treeRef = \"master\";\n                final ObjectId oldHead = fileSystem.getGit().getTreeFromRef(treeRef);\n                final Map<String, String> params = getQueryParams(uri);\n                try {\n                    fileSystem.lock();\n                    final Pair<String, String> remote = Pair.newPair(\"upstream\",\n                                                                     params.get(\"sync\"));\n                    fileSystem.getGit().fetch(fileSystem.getCredential(),\n                                              remote,\n                                              emptyList());\n                    fileSystem.getGit().syncRemote(remote);\n                } finally {\n                    fileSystem.unlock();\n                }\n                final ObjectId newHead = fileSystem.getGit().getTreeFromRef(treeRef);\n                notifyDiffs(fileSystem,\n                            treeRef,\n                            \"<system>\",\n                            \"<system>\",\n                            \"\",\n                            oldHead,\n                            newHead);\n            } catch (final Exception ex) {\n                throw new IOException(\"Failed to sync repository.\",\n                                      ex);\n            }\n        }\n        if (hasPushFlag(uri)) {\n            try {\n                final Map<String, String> params = getQueryParams(uri);\n                fileSystem.getGit().push(fileSystem.getCredential(),\n                                         newPair(\"usptream\",\n                                                 params.get(\"push\")),\n                                         hasForceFlag(uri),\n                                         emptyList());\n            } catch (final Exception ex) {\n                throw new IOException(\"Failed to push repository.\",\n                                      ex);\n            }\n        }\n\n        return fileSystem;\n    }\n\n    String extractFSNameWithPath(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        String path = uri.getAuthority() + uri.getPath();\n\n        int index = path.indexOf('@');\n        if (index != -1) {\n            path = path.substring(index + 1);\n        }\n        return path;\n    }\n\n    @Override\n    public Path getPath(final URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        checkNotNull(\"uri\",\n                     uri);\n        checkCondition(\"uri scheme not supported\",\n                       uri.getScheme().equals(getScheme()) || uri.getScheme().equals(\"default\"));\n        checkURI(\"uri\",\n                 uri);\n\n        if (LOG.isDebugEnabled()) {\n            LOG.debug(\"Accessing uri \" + uri.toString());\n        }\n\n        Path path;\n\n        JGitFileSystem fileSystem = deepLookupFSFrom(uri);\n\n        String branch = extractBranchFrom(uri);\n\n        String host = buildHostFrom(fileSystem,\n                                    branch);\n\n        String pathStr = buildPathFrom(uri,\n                                       host);\n        path = JGitPathImpl.create(fileSystem,\n                                   pathStr,\n                                   host,\n                                   false);\n\n        return path;\n    }\n\n    private String buildPathFrom(URI uri,\n                                 String host) {\n        String pathStr = uri.toString();\n        pathStr = pathStr.replace(host,\n                                  \"\");\n        pathStr = pathStr.replace(\"git://\",\n                                  \"\").replace(\"default://\",\n                                              \"\");\n        pathStr = EncodingUtil.decode(pathStr);\n        if (pathStr.startsWith(\"/:\")) {\n            pathStr = pathStr.substring(2);\n        }\n        return pathStr;\n    }\n\n    private String buildHostFrom(JGitFileSystem fileSystem,\n                                 String branch) {\n        String host = branch + fileSystem.getName();\n\n        host = host.replace(\"git://\",\n                            \"\").replace(\"default://\",\n                                        \"\");\n        return host;\n    }\n\n    private String extractBranchFrom(URI uri) {\n        String branch = \"\";\n\n        int index = uri.toString().indexOf('@');\n        if (index != -1) {\n            branch = uri.toString().substring(0,\n                                              index + 1);\n        }\n        return branch;\n    }\n\n    public String extractPath(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return getPath(uri).toString();\n    }\n\n    private JGitFileSystem deepLookupFSFrom(URI uri) {\n\n        String fullURI = extractFSNameWithPath(uri);\n        int index = fullURI.indexOf(\"/\");\n        JGitFileSystem jGitFileSystem = fsManager.get(fullURI);\n\n        while (jGitFileSystem == null && index >= 0) {\n\n            String fsCandidate = fullURI.substring(0,\n                                                   index);\n            jGitFileSystem = fsManager.get(fsCandidate);\n\n            index = fullURI.indexOf(\"/\",\n                                    index + 1);\n        }\n\n        if (jGitFileSystem == null) {\n            throw new FileSystemNotFoundException(\"No filesystem for uri (\" + uri + \") found.\");\n        }\n\n        return jGitFileSystem;\n    }\n\n    @Override\n    public InputStream newInputStream(final Path path,\n                                      final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        return gPath.getFileSystem().getGit().blobAsInputStream(gPath.getRefTree(),\n                                                                gPath.getPath());\n    }\n\n    @Override\n    public OutputStream newOutputStream(final Path path,\n                                        final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n        final PathInfo result = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                           gPath.getPath());\n\n        if (result.getPathType().equals(PathType.DIRECTORY)) {\n            throw new NotDirectoryException(path.toString());\n        }\n\n        try {\n            final File file = File.createTempFile(\"gitz\",\n                                                  \"woot\");\n            return new FilterOutputStream(new FileOutputStream(file)) {\n                @Override\n                public void close() throws java.io.IOException {\n                    super.close();\n\n                    commit(gPath,\n                           buildCommitInfo(\"{\" + toPathImpl(path).getPath() + \"}\",\n                                           Arrays.asList(options)),\n                           new DefaultCommitContent(new HashMap<String, File>() {{\n                               put(gPath.getPath(),\n                                   file);\n                           }}));\n                }\n            };\n        } catch (java.io.IOException e) {\n            throw new IOException(\"Could not create file or output stream.\",\n                                  e);\n        }\n    }\n\n    private CommitInfo buildCommitInfo(final String defaultMessage,\n                                       final Collection<? extends Option> options) {\n        String sessionId = null;\n        String name = null;\n        String email = null;\n        String message = defaultMessage;\n        TimeZone timeZone = null;\n        Date when = null;\n\n        if (options != null && !options.isEmpty()) {\n            final CommentedOption op = extractCommentedOption(options);\n            if (op != null) {\n                sessionId = op.getSessionId();\n                name = op.getName();\n                email = op.getEmail();\n                if (op.getMessage() != null && !op.getMessage().trim().isEmpty()) {\n                    message = op.getMessage() + \" \" + defaultMessage;\n                }\n                timeZone = op.getTimeZone();\n                when = op.getWhen();\n            }\n        }\n\n        return new CommitInfo(sessionId,\n                              name,\n                              email,\n                              message,\n                              timeZone,\n                              when);\n    }\n\n    private CommentedOption extractCommentedOption(final Collection<? extends Option> options) {\n        for (final Option option : options) {\n            if (option instanceof CommentedOption) {\n                return (CommentedOption) option;\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public FileChannel newFileChannel(final Path path,\n                                      Set<? extends OpenOption> options,\n                                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public AsynchronousFileChannel newAsynchronousFileChannel(final Path path,\n                                                              final Set<? extends OpenOption> options,\n                                                              final ExecutorService executor,\n                                                              FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final Set<? extends OpenOption> options,\n                                              final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        if (exists(path)) {\n            if (!shouldCreateOrOpenAByteChannel(options)) {\n                throw new FileAlreadyExistsException(path.toString());\n            }\n        }\n\n        final PathInfo result = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                           gPath.getPath());\n\n        if (result.getPathType().equals(PathType.DIRECTORY)) {\n            throw new NotDirectoryException(path.toString());\n        }\n\n        try {\n            if (options != null && options.contains(READ)) {\n                return openAByteChannel(path);\n            } else {\n                return createANewByteChannel(path,\n                                             options,\n                                             gPath,\n                                             attrs);\n            }\n        } catch (java.io.IOException e) {\n            throw new IOException(\"Failed to open or create a byte channel.\",\n                                  e);\n        } finally {\n            ((AbstractPath) path).clearCache();\n        }\n    }\n\n    private SeekableByteChannel createANewByteChannel(final Path path,\n                                                      final Set<? extends OpenOption> options,\n                                                      final JGitPathImpl gPath,\n                                                      final FileAttribute<?>[] attrs) throws java.io.IOException {\n        final File file = File.createTempFile(\"gitz\",\n                                              \"woot\");\n\n        return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(file,\n                                                                         \"rw\").getChannel()) {\n            @Override\n            public void close() throws java.io.IOException {\n                super.close();\n\n                File tempDot = null;\n                final boolean hasDotContent;\n                if (options != null && options.contains(new DotFileOption())) {\n                    deleteIfExists(dot(path),\n                                   extractCommentedOption(options));\n                    tempDot = File.createTempFile(\"meta\",\n                                                  \"dot\");\n                    hasDotContent = buildDotFile(path,\n                                                 new FileOutputStream(tempDot),\n                                                 attrs);\n                } else {\n                    hasDotContent = false;\n                }\n\n                final File dotfile = tempDot;\n\n                commit(gPath,\n                       buildCommitInfo(\"{\" + toPathImpl(path).getPath() + \"}\",\n                                       options),\n                       new DefaultCommitContent(new HashMap<String, File>() {{\n                           put(gPath.getPath(),\n                               file);\n                           if (hasDotContent) {\n                               put(toPathImpl(dot(gPath)).getPath(),\n                                   dotfile);\n                           }\n                       }}));\n            }\n        };\n    }\n\n    private SeekableByteChannelFileBasedImpl openAByteChannel(Path path) throws FileNotFoundException {\n        return new SeekableByteChannelFileBasedImpl(new RandomAccessFile(path.toFile(),\n                                                                         \"r\").getChannel());\n    }\n\n    private boolean shouldCreateOrOpenAByteChannel(Set<? extends OpenOption> options) {\n        return (options != null && (options.contains(TRUNCATE_EXISTING) || options.contains(READ)));\n    }\n\n    protected boolean exists(final Path path) {\n        try {\n            readAttributes(path,\n                           BasicFileAttributes.class);\n            return true;\n        } catch (final Exception ignored) {\n            // this means the file does not exist\n        }\n        return false;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(final Path path,\n                                                    final DirectoryStream.Filter<Path> pfilter)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        final DirectoryStream.Filter<Path> filter;\n        if (pfilter == null) {\n            filter = entry -> true;\n        } else {\n            filter = pfilter;\n        }\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        final PathInfo result = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                           gPath.getPath());\n\n        if (!result.getPathType().equals(PathType.DIRECTORY)) {\n            throw new NotDirectoryException(path.toString());\n        }\n\n        final List<PathInfo> pathContent = gPath.getFileSystem().getGit().listPathContent(gPath.getRefTree(),\n                                                                                          gPath.getPath());\n\n        return new DirectoryStream<Path>() {\n            boolean isClosed = false;\n\n            @Override\n            public void close() throws IOException {\n                if (isClosed) {\n                    throw new IOException(\"This stream is closed.\");\n                }\n                isClosed = true;\n            }\n\n            @Override\n            public Iterator<Path> iterator() {\n                if (isClosed) {\n                    throw new IOException(\"This stream is closed.\");\n                }\n                return new Iterator<Path>() {\n                    int i = -1;\n                    Path nextEntry = null;\n                    boolean atEof = false;\n\n                    @Override\n                    public boolean hasNext() {\n                        if (nextEntry == null && !atEof) {\n                            nextEntry = readNextEntry();\n                        }\n                        return nextEntry != null;\n                    }\n\n                    @Override\n                    public Path next() {\n                        final Path result;\n                        if (nextEntry == null && !atEof) {\n                            result = readNextEntry();\n                        } else {\n                            result = nextEntry;\n                            nextEntry = null;\n                        }\n                        if (result == null) {\n                            throw new NoSuchElementException();\n                        }\n                        return result;\n                    }\n\n                    private Path readNextEntry() {\n                        if (atEof) {\n                            return null;\n                        }\n\n                        Path result = null;\n                        while (true) {\n                            i++;\n                            if (i >= pathContent.size()) {\n                                atEof = true;\n                                break;\n                            }\n\n                            final PathInfo content = pathContent.get(i);\n                            final Path path = JGitPathImpl.create(gPath.getFileSystem(),\n                                                                  \"/\" + content.getPath(),\n                                                                  gPath.getHost(),\n                                                                  content.getObjectId(),\n                                                                  gPath.isRealPath());\n                            if (filter.accept(path)) {\n                                result = path;\n                                break;\n                            }\n                        }\n\n                        return result;\n                    }\n\n                    @Override\n                    public void remove() {\n                        throw new UnsupportedOperationException();\n                    }\n                };\n            }\n        };\n    }\n\n    @Override\n    public void createDirectory(final Path path,\n                                final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        final PathInfo result = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                           gPath.getPath());\n\n        if (!result.getPathType().equals(NOT_FOUND)) {\n            throw new FileAlreadyExistsException(path.toString());\n        }\n\n        try {\n            final OutputStream outputStream = newOutputStream(path.resolve(\".gitkeep\"));\n            outputStream.close();\n        } catch (final Exception e) {\n            throw new IOException(\"Failed to write to or close the output stream.\",\n                                  e);\n        }\n    }\n\n    @Override\n    public void createSymbolicLink(final Path link,\n                                   final Path target,\n                                   final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void createLink(final Path link,\n                           final Path existing)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        if (path instanceof JGitFSPath) {\n            deleteFS(path.getFileSystem());\n            return;\n        }\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        if (isBranch(gPath)) {\n            deleteBranch(gPath);\n            return;\n        }\n\n        deleteAsset(gPath,\n                    options);\n    }\n\n    protected boolean deleteFS(final FileSystem fileSystem) {\n\n        final File gitDir = ((JGitFileSystemImpl) fileSystem).getGit().getRepository().getDirectory();\n        File parentDir = gitDir.getParentFile();\n        FileSystemLock physicalLock = createLock(parentDir,\n                                                 parentDir.getName());\n\n        try {\n            physicalLock.lock();\n            fileSystem.close();\n            fileSystem.dispose();\n            if (System.getProperty(\"os.name\").toLowerCase().contains(\"windows\")) {\n                //this operation forces a cache clean freeing any lock -> windows only issue!\n                WindowCache.reconfigure(new WindowCacheConfig());\n            }\n\n            fsManager.remove(fileSystem.getName());\n\n            FileUtils.delete(gitDir,\n                             FileUtils.RECURSIVE | FileUtils.SKIP_MISSING | FileUtils.RETRY);\n\n            cleanupParentDir(gitDir);\n            return true;\n        } catch (java.io.IOException e) {\n            throw new IOException(\"Failed to remove the git repository.\",\n                                  e);\n        } finally {\n            physicalLock.unlock();\n        }\n    }\n\n    private void cleanupParentDir(File gitDir) throws java.io.IOException {\n        final File parentDir = gitDir.getParentFile();\n        if (parentDir.isDirectory() && parentDirIsEmpty(parentDir) && !parentDir.equals(getGitRepoContainerDir())) {\n            FileUtils.delete(parentDir,\n                             FileUtils.RECURSIVE | FileUtils.RETRY);\n        }\n    }\n\n    private boolean parentDirIsEmpty(File parentDir) {\n        return parentDir.list().length == 0;\n    }\n\n    public void deleteAsset(final JGitPathImpl path,\n                            final DeleteOption... options) {\n        final PathInfo result = path.getFileSystem().getGit().getPathInfo(path.getRefTree(),\n                                                                          path.getPath());\n\n        if (result.getPathType().equals(PathType.DIRECTORY)) {\n            if (deleteNonEmptyDirectory(options)) {\n                deleteResource(path,\n                               options);\n                return;\n            }\n            final List<PathInfo> content = path.getFileSystem().getGit().listPathContent(path.getRefTree(),\n                                                                                         path.getPath());\n            if (content.size() == 1 && content.get(0).getPath().equals(path.getPath().substring(1) + \"/.gitkeep\")) {\n                delete(path.resolve(\".gitkeep\"));\n                deleteResource(path,\n                               options);\n                return;\n            }\n            throw new DirectoryNotEmptyException(path.toString());\n        }\n\n        if (result.getPathType().equals(NOT_FOUND)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        deleteResource(path,\n                       options);\n    }\n\n    private void deleteResource(final JGitPathImpl path,\n                                final DeleteOption... options) {\n        delete(path,\n               buildCommitInfo(\"delete {\" + path.getPath() + \"}\",\n                               Arrays.asList(options)));\n    }\n\n    private boolean deleteNonEmptyDirectory(final DeleteOption... options) {\n\n        for (final DeleteOption option : options) {\n            if (option.equals(StandardDeleteOption.NON_EMPTY_DIRECTORIES)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    public void deleteBranch(final JGitPathImpl path) {\n        final Ref branch = path.getFileSystem().getGit().getRef(path.getRefTree());\n\n        if (branch == null) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        try {\n            path.getFileSystem().lock();\n            path.getFileSystem().getGit().deleteRef(branch);\n        } finally {\n            path.getFileSystem().unlock();\n        }\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path,\n                                  final DeleteOption... options)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        if (path instanceof JGitFSPath) {\n            return deleteFS(path.getFileSystem());\n        }\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        if (isBranch(gPath)) {\n            return deleteBranchIfExists(gPath);\n        }\n\n        return deleteAssetIfExists(gPath,\n                                   options);\n    }\n\n    public boolean deleteBranchIfExists(final JGitPathImpl path) {\n        try {\n            deleteBranch(path);\n            return true;\n        } catch (final NoSuchFileException ignored) {\n            return false;\n        }\n    }\n\n    public boolean deleteAssetIfExists(final JGitPathImpl path,\n                                       final DeleteOption... options) {\n        final PathInfo result = path.getFileSystem().getGit().getPathInfo(path.getRefTree(),\n                                                                          path.getPath());\n\n        if (result.getPathType().equals(PathType.DIRECTORY)) {\n            if (deleteNonEmptyDirectory(options)) {\n                deleteResource(path,\n                               options);\n                return true;\n            }\n            final List<PathInfo> content = path.getFileSystem().getGit().listPathContent(path.getRefTree(),\n                                                                                         path.getPath());\n            if (content.size() == 1 && content.get(0).getPath().equals(path.getPath().substring(1) + \"/.gitkeep\")) {\n                delete(path.resolve(\".gitkeep\"));\n                return true;\n            }\n            throw new DirectoryNotEmptyException(path.toString());\n        }\n\n        if (result.getPathType().equals(NOT_FOUND)) {\n            return false;\n        }\n\n        deleteResource(path,\n                       options);\n        return true;\n    }\n\n    @Override\n    public Path readSymbolicLink(final Path link)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"link\",\n                     link);\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void copy(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n\n        final JGitPathImpl gSource = toPathImpl(source);\n        final JGitPathImpl gTarget = toPathImpl(target);\n        final boolean isBranch = isBranch(gSource) && isBranch(gTarget);\n\n        if (options.length == 1 && options[0] instanceof MergeCopyOption) {\n            if (!isBranch) {\n                throw new IOException(\"Merge needs source and target as root.\");\n            }\n            this.merge(gSource,\n                       gTarget);\n        } else if (options.length == 1 && options[0] instanceof CherryPickCopyOption) {\n            if (!isBranch) {\n                throw new IOException(\"Cherry pick needs source and target as root.\");\n            }\n            final String[] commits = ((CherryPickCopyOption) options[0]).getCommits();\n            if (commits == null || commits.length == 0) {\n                throw new IOException(\"Cherry pick needs at least one commit id.\");\n            }\n            cherryPick(gSource,\n                       gTarget,\n                       commits);\n        } else {\n            if (isBranch) {\n                copyBranch(gSource,\n                           gTarget);\n                return;\n            }\n            copyAsset(gSource,\n                      gTarget,\n                      options);\n        }\n    }\n\n    private void merge(final JGitPathImpl source,\n                       final JGitPathImpl target) {\n\n        try {\n            target.getFileSystem().lock();\n            source.getFileSystem().getGit().merge(source.getRefTree(),\n                                                  target.getRefTree());\n        } finally {\n            target.getFileSystem().unlock();\n        }\n    }\n\n    private void cherryPick(final JGitPathImpl source,\n                            final JGitPathImpl target,\n                            final String... commits) {\n        try {\n            target.getFileSystem().lock();\n            source.getFileSystem().getGit().cherryPick(target,\n                                                       commits);\n        } finally {\n            target.getFileSystem().unlock();\n        }\n    }\n\n    private void copyBranch(final JGitPathImpl source,\n                            final JGitPathImpl target) {\n        checkCondition(\"source and target should have same file system\",\n                       hasSameFileSystem(source,\n                                         target));\n        if (existsBranch(target)) {\n            throw new FileAlreadyExistsException(target.toString());\n        }\n        if (!existsBranch(source)) {\n            throw new NoSuchFileException(target.toString());\n        }\n        createBranch(source,\n                     target);\n    }\n\n    private void copyAsset(final JGitPathImpl source,\n                           final JGitPathImpl target,\n                           final CopyOption... options) {\n        final PathInfo sourceResult = source.getFileSystem().getGit().getPathInfo(source.getRefTree(),\n                                                                                  source.getPath());\n        final PathInfo targetResult = target.getFileSystem().getGit().getPathInfo(target.getRefTree(),\n                                                                                  target.getPath());\n\n        if (!isRoot(target) && targetResult.getPathType() != NOT_FOUND) {\n            if (!contains(options,\n                          StandardCopyOption.REPLACE_EXISTING)) {\n                throw new FileAlreadyExistsException(target.toString());\n            }\n        }\n\n        if (sourceResult.getPathType() == NOT_FOUND) {\n            throw new NoSuchFileException(target.toString());\n        }\n\n        if (!source.getRefTree().equals(target.getRefTree())) {\n            copyAssetContent(source,\n                             target,\n                             options);\n        } else if (!source.getFileSystem().equals(target.getFileSystem())) {\n            copyAssetContent(source,\n                             target,\n                             options);\n        } else {\n            final Map<JGitPathImpl, JGitPathImpl> sourceDest = new HashMap<>();\n            if (sourceResult.getPathType() == DIRECTORY) {\n                sourceDest.putAll(mapDirectoryContent(source,\n                                                      target,\n                                                      options));\n            } else {\n                sourceDest.put(source,\n                               target);\n            }\n\n            copyFiles(source,\n                      target,\n                      sourceDest,\n                      options);\n        }\n    }\n\n    private void copyAssetContent(final JGitPathImpl source,\n                                  final JGitPathImpl target,\n                                  final CopyOption... options) {\n        final PathInfo sourceResult = source.getFileSystem().getGit().getPathInfo(source.getRefTree(),\n                                                                                  source.getPath());\n        final PathInfo targetResult = target.getFileSystem().getGit().getPathInfo(target.getRefTree(),\n                                                                                  target.getPath());\n\n        if (!isRoot(target) && targetResult.getPathType() != NOT_FOUND) {\n            if (!contains(options,\n                          StandardCopyOption.REPLACE_EXISTING)) {\n                throw new FileAlreadyExistsException(target.toString());\n            }\n        }\n\n        if (sourceResult.getPathType() == NOT_FOUND) {\n            throw new NoSuchFileException(target.toString());\n        }\n\n        if (sourceResult.getPathType() == DIRECTORY) {\n            copyDirectory(source,\n                          target,\n                          options);\n            return;\n        }\n\n        copyFile(source,\n                 target,\n                 options);\n    }\n\n    private boolean contains(final CopyOption[] options,\n                             final CopyOption opt) {\n        for (final CopyOption option : options) {\n            if (option.equals(opt)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private void copyDirectory(final JGitPathImpl source,\n                               final JGitPathImpl target,\n                               final CopyOption... options) {\n        final List<JGitPathImpl> directories = new ArrayList<>();\n        for (final Path path : newDirectoryStream(source,\n                                                  null)) {\n            final JGitPathImpl gPath = toPathImpl(path);\n            final PathInfo pathResult = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                                   gPath.getPath());\n            if (pathResult.getPathType() == DIRECTORY) {\n                directories.add(gPath);\n                continue;\n            }\n            final JGitPathImpl gTarget = composePath(target,\n                                                     (JGitPathImpl) gPath.getFileName());\n\n            copyFile(gPath,\n                     gTarget);\n        }\n        for (final JGitPathImpl directory : directories) {\n            createDirectory(composePath(target,\n                                        (JGitPathImpl) directory.getFileName()));\n        }\n    }\n\n    private JGitPathImpl composePath(final JGitPathImpl directory,\n                                     final JGitPathImpl fileName,\n                                     final CopyOption... options) {\n        if (directory.getPath().endsWith(\"/\")) {\n            return toPathImpl(getPath(URI.create(directory.toUri().toString() + uriEncode(fileName.toString(false)))));\n        }\n        return toPathImpl(getPath(URI.create(directory.toUri().toString() + \"/\" + uriEncode(fileName.toString(false)))));\n    }\n\n    private String uriEncode(final String s) {\n        try {\n            return URLEncoder.encode(s,\n                                     \"UTF-8\");\n        } catch (UnsupportedEncodingException e) {\n            return s;\n        }\n    }\n\n    private void copyFile(final JGitPathImpl source,\n                          final JGitPathImpl target,\n                          final CopyOption... options) {\n\n        final InputStream in = newInputStream(source,\n                                              convert(options));\n        final SeekableByteChannel out = newByteChannel(target,\n                                                       new HashSet<OpenOption>() {{\n                                                           add(StandardOpenOption.TRUNCATE_EXISTING);\n                                                           for (final CopyOption _option : options) {\n                                                               if (_option instanceof OpenOption) {\n                                                                   add((OpenOption) _option);\n                                                               }\n                                                           }\n                                                       }});\n\n        try {\n            int count;\n            byte[] buffer = new byte[8192];\n            while ((count = in.read(buffer)) > 0) {\n                out.write(ByteBuffer.wrap(buffer,\n                                          0,\n                                          count));\n            }\n        } catch (Exception e) {\n            throw new IOException(\"Failed to copy file from '\" + source + \"' to '\" + target + \"'\",\n                                  e);\n        } finally {\n            try {\n                out.close();\n            } catch (java.io.IOException e) {\n                throw new IOException(\"Could not close output stream.\",\n                                      e);\n            } finally {\n                try {\n                    in.close();\n                } catch (java.io.IOException e) {\n                    throw new IOException(\"Could not close input stream.\",\n                                          e);\n                }\n            }\n        }\n    }\n\n    private OpenOption[] convert(CopyOption... options) {\n        if (options == null || options.length == 0) {\n            return new OpenOption[0];\n        }\n        final List<OpenOption> newOptions = new ArrayList<>(options.length);\n        for (final CopyOption option : options) {\n            if (option instanceof OpenOption) {\n                newOptions.add((OpenOption) option);\n            }\n        }\n\n        return newOptions.toArray(new OpenOption[newOptions.size()]);\n    }\n\n    private void createBranch(final JGitPathImpl source,\n                              final JGitPathImpl target) {\n        try {\n            target.getFileSystem().lock();\n            source.getFileSystem().getGit().createRef(source.getRefTree(),\n                                                      target.getRefTree());\n        } finally {\n            target.getFileSystem().unlock();\n        }\n    }\n\n    private boolean existsBranch(final JGitPathImpl path) {\n        return path.getFileSystem().getGit().getRef(path.getRefTree()) != null;\n    }\n\n    private boolean isBranch(final JGitPathImpl path) {\n        return path.getPath().length() == 1 && path.getPath().equals(\"/\");\n    }\n\n    private boolean isRoot(final JGitPathImpl path) {\n        return isBranch(path);\n    }\n\n    private boolean hasSameFileSystem(final JGitPathImpl source,\n                                      final JGitPathImpl target) {\n        return source.getFileSystem().equals(target.getFileSystem());\n    }\n\n    @Override\n    public void move(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws IOException, SecurityException {\n        checkNotNull(\"source\",\n                     source);\n        checkNotNull(\"target\",\n                     target);\n\n        final JGitPathImpl gSource = toPathImpl(source);\n        final JGitPathImpl gTarget = toPathImpl(target);\n\n        final boolean isSourceBranch = isBranch(gSource);\n        final boolean isTargetBranch = isBranch(gTarget);\n\n        if (isSourceBranch && isTargetBranch) {\n            moveBranch(gSource,\n                       gTarget,\n                       options);\n            return;\n        }\n        moveAsset(gSource,\n                  gTarget,\n                  options);\n    }\n\n    private void moveBranch(final JGitPathImpl source,\n                            final JGitPathImpl target,\n                            final CopyOption... options) {\n        checkCondition(\"source and target should have same file system\",\n                       hasSameFileSystem(source,\n                                         target));\n\n        if (!exists(source)) {\n            throw new NoSuchFileException(target.toString());\n        }\n\n        boolean targetExists = existsBranch(target);\n        if (targetExists && !contains(options,\n                                      StandardCopyOption.REPLACE_EXISTING)) {\n            throw new FileAlreadyExistsException(target.toString());\n        }\n\n        if (!targetExists) {\n            createBranch(source,\n                         target);\n            deleteBranch(source);\n        } else {\n            commit(target,\n                   buildCommitInfo(\"reverting from {\" + source.getPath() + \"}\",\n                                   Arrays.asList(options)),\n                   new RevertCommitContent(source.getRefTree()));\n        }\n    }\n\n    private void moveAsset(final JGitPathImpl source,\n                           final JGitPathImpl target,\n                           final CopyOption... options) {\n        final PathInfo sourceResult = source.getFileSystem().getGit().getPathInfo(source.getRefTree(),\n                                                                                  source.getPath());\n        final PathInfo targetResult = target.getFileSystem().getGit().getPathInfo(target.getRefTree(),\n                                                                                  target.getPath());\n\n        if (!isRoot(target) && targetResult.getPathType() != NOT_FOUND) {\n            if (!contains(options,\n                          StandardCopyOption.REPLACE_EXISTING)) {\n                throw new FileAlreadyExistsException(target.toString());\n            }\n        }\n\n        if (sourceResult.getPathType() == NOT_FOUND) {\n            throw new NoSuchFileException(target.toString());\n        }\n\n        if (!source.getRefTree().equals(target.getRefTree())) {\n            copy(source,\n                 target,\n                 options);\n            delete(source);\n        } else {\n            final Map<JGitPathImpl, JGitPathImpl> fromTo = new HashMap<>();\n            if (sourceResult.getPathType() == DIRECTORY) {\n                fromTo.putAll(mapDirectoryContent(source,\n                                                  target,\n                                                  options));\n            } else {\n                fromTo.put(source,\n                           target);\n            }\n\n            moveFiles(source,\n                      target,\n                      fromTo,\n                      options);\n        }\n    }\n\n    private Map<JGitPathImpl, JGitPathImpl> mapDirectoryContent(final JGitPathImpl source,\n                                                                final JGitPathImpl target,\n                                                                final CopyOption... options) {\n        final Map<JGitPathImpl, JGitPathImpl> fromTo = new HashMap<>();\n        for (final Path path : newDirectoryStream(source,\n                                                  null)) {\n            final JGitPathImpl gPath = toPathImpl(path);\n            final PathInfo pathResult = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                                   gPath.getPath());\n            if (pathResult.getPathType() == DIRECTORY) {\n                fromTo.putAll(mapDirectoryContent(gPath,\n                                                  composePath(target,\n                                                              (JGitPathImpl) gPath.getFileName())));\n            } else {\n                final JGitPathImpl gTarget = composePath(target,\n                                                         (JGitPathImpl) gPath.getFileName());\n                fromTo.put(gPath,\n                           gTarget);\n            }\n        }\n\n        return fromTo;\n    }\n\n    private void moveFiles(final JGitPathImpl source,\n                           final JGitPathImpl target,\n                           final Map<JGitPathImpl, JGitPathImpl> fromTo,\n                           final CopyOption... options) {\n        final Map<String, String> result = new HashMap<>(fromTo.size());\n        for (final Map.Entry<JGitPathImpl, JGitPathImpl> fromToEntry : fromTo.entrySet()) {\n            result.put(PathUtil.normalize(fromToEntry.getKey().getPath()),\n                       PathUtil.normalize(fromToEntry.getValue().getPath()));\n        }\n        commit(source,\n               buildCommitInfo(\"moving from {\" + source.getPath() + \"} to {\" + target.getPath() + \"}\",\n                               Arrays.asList(options)),\n               new MoveCommitContent(result));\n    }\n\n    private void copyFiles(final JGitPathImpl source,\n                           final JGitPathImpl target,\n                           final Map<JGitPathImpl, JGitPathImpl> sourceDest,\n                           final CopyOption... options) {\n        final Map<String, String> result = new HashMap<>(sourceDest.size());\n        for (final Map.Entry<JGitPathImpl, JGitPathImpl> sourceDestEntry : sourceDest.entrySet()) {\n            result.put(PathUtil.normalize(sourceDestEntry.getKey().getPath()),\n                       PathUtil.normalize(sourceDestEntry.getValue().getPath()));\n        }\n        commit(source,\n               buildCommitInfo(\"copy from {\" + source.getPath() + \"} to {\" + target.getPath() + \"}\",\n                               Arrays.asList(options)),\n               new CopyCommitContent(result));\n    }\n\n    @Override\n    public boolean isSameFile(final Path pathA,\n                              final Path pathB)\n            throws IOException, SecurityException {\n        checkNotNull(\"pathA\",\n                     pathA);\n        checkNotNull(\"pathB\",\n                     pathB);\n\n        final JGitPathImpl gPathA = toPathImpl(pathA);\n        final JGitPathImpl gPathB = toPathImpl(pathB);\n\n        final PathInfo resultA = gPathA.getFileSystem().getGit().getPathInfo(gPathA.getRefTree(),\n                                                                             gPathA.getPath());\n        final PathInfo resultB = gPathB.getFileSystem().getGit().getPathInfo(gPathB.getRefTree(),\n                                                                             gPathB.getPath());\n\n        if (resultA.getPathType() == PathType.FILE && resultA.getObjectId().equals(resultB.getObjectId())) {\n            return true;\n        }\n\n        return pathA.equals(pathB);\n    }\n\n    @Override\n    public boolean isHidden(final Path path)\n            throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        if (gPath.getFileName() == null) {\n            return false;\n        }\n\n        return toPathImpl(path.getFileName()).toString(false).startsWith(\".\");\n    }\n\n    @Override\n    public FileStore getFileStore(final Path path)\n            throws IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        return new JGitFileStore(toPathImpl(path).getFileSystem().getGit().getRepository());\n    }\n\n    @Override\n    public void checkAccess(final Path path,\n                            final AccessMode... modes)\n            throws\n            UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        final PathInfo result = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                           gPath.getPath());\n\n        if (result.getPathType().equals(NOT_FOUND)) {\n            throw new NoSuchFileException(path.toString());\n        }\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(final Path path,\n                                                                final Class<V> type,\n                                                                final LinkOption... options)\n            throws NoSuchFileException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"type\",\n                     type);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        final PathInfo pathResult = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                               gPath.getPath());\n        if (pathResult.getPathType().equals(NOT_FOUND)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        final V resultView = gPath.getAttrView(type);\n\n        if (resultView == null) {\n            if (type == BasicFileAttributeView.class || type == JGitBasicAttributeView.class) {\n                final V newView = (V) new JGitBasicAttributeView(gPath);\n                gPath.addAttrView(newView);\n                return newView;\n            } else if (type == HiddenAttributeView.class || type == JGitHiddenAttributeView.class) {\n                final V newView = (V) new JGitHiddenAttributeView(gPath);\n                gPath.addAttrView(newView);\n                return newView;\n            } else if (type == VersionAttributeView.class || type == JGitVersionAttributeView.class) {\n                final V newView = (V) new JGitVersionAttributeView(gPath);\n                gPath.addAttrView(newView);\n                return newView;\n            }\n        }\n\n        return resultView;\n    }\n\n    private ExtendedAttributeView getFileAttributeView(final JGitPathImpl path,\n                                                       final String name,\n                                                       final LinkOption... options) {\n        final ExtendedAttributeView view = path.getAttrView(name);\n\n        if (view == null) {\n\n            if (name.equals(\"basic\")) {\n                final JGitBasicAttributeView newView = new JGitBasicAttributeView(path);\n                path.addAttrView(newView);\n                return newView;\n            } else if (name.equals(\"extended\")) {\n                final JGitHiddenAttributeView newView = new JGitHiddenAttributeView(path);\n                path.addAttrView(newView);\n                return newView;\n            } else if (name.equals(\"version\")) {\n                final JGitVersionAttributeView newView = new JGitVersionAttributeView(path);\n                path.addAttrView(newView);\n                return newView;\n            }\n        }\n        return view;\n    }\n\n    @Override\n    public <A extends BasicFileAttributes> A readAttributes(final Path path,\n                                                            final Class<A> type,\n                                                            final LinkOption... options)\n            throws UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotNull(\"type\",\n                     type);\n\n        final JGitPathImpl gPath = toPathImpl(path);\n\n        final PathInfo pathResult = gPath.getFileSystem().getGit().getPathInfo(gPath.getRefTree(),\n                                                                               gPath.getPath());\n        if (pathResult.getPathType().equals(NOT_FOUND)) {\n            throw new NoSuchFileException(path.toString());\n        }\n\n        if (type == VersionAttributes.class) {\n            final JGitVersionAttributeView view = getFileAttributeView(path,\n                                                                       JGitVersionAttributeView.class,\n                                                                       options);\n            return (A) view.readAttributes();\n        } else if (type == HiddenAttributes.class) {\n            final JGitHiddenAttributeView view = getFileAttributeView(path,\n                                                                      JGitHiddenAttributeView.class,\n                                                                      options);\n            return (A) view.readAttributes();\n        } else if (type == BasicFileAttributesImpl.class || type == BasicFileAttributes.class) {\n            final JGitBasicAttributeView view = getFileAttributeView(path,\n                                                                     JGitBasicAttributeView.class,\n                                                                     options);\n            return (A) view.readAttributes();\n        }\n\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final Path path,\n                                              final String attributes,\n                                              final LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attributes);\n\n        final String[] s = split(attributes);\n        if (s[0].length() == 0) {\n            throw new IllegalArgumentException(attributes);\n        }\n\n        if (s[0].equals(\"diff\")) {\n            final String[] branches = s[1].split(\",\");\n            final String branchA = branches[0];\n            final String branchB = branches[1];\n            final List<FileDiff> diffs = ((JGitPathImpl) path).getFileSystem().getGit().diffRefs(branchA,\n                                                                                                 branchB);\n            final HashMap<String, Object> map = new HashMap<>();\n            map.put(\"diff\",\n                    diffs);\n            return map;\n        } else {\n            final ExtendedAttributeView view = getFileAttributeView(toPathImpl(path),\n                                                                    s[0],\n                                                                    options);\n            if (view == null) {\n                throw new UnsupportedOperationException(\"View '\" + s[0] + \"' not available\");\n            }\n\n            return view.readAttributes(s[1].split(\",\"));\n        }\n    }\n\n    @Override\n    public void setAttribute(final Path path,\n                             final String attribute,\n                             final Object value,\n                             final LinkOption... options)\n            throws\n            UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        checkNotNull(\"path\",\n                     path);\n        checkNotEmpty(\"attributes\",\n                      attribute);\n\n        if (attribute.equals(SquashOption.SQUASH_ATTR) && value instanceof SquashOption) {\n            this.lockAndSquash(path,\n                               (SquashOption) value);\n            return;\n        }\n\n        if (attribute.equals(FileSystemState.FILE_SYSTEM_STATE_ATTR)) {\n            JGitFileSystem fileSystem = (JGitFileSystem) path.getFileSystem();\n            try {\n                fileSystem.lock();\n\n                if (value instanceof CommentedOption) {\n                    fileSystem.setBatchCommitInfo(\"Batch mode\",\n                                                  (CommentedOption) value);\n                    fileSystem.unlock();\n                    return;\n                }\n\n                final boolean isOriginalStateBatch = fileSystem.isOnBatch();\n\n                fileSystem.setState(value.toString());\n                FileSystemState.valueOf(value.toString());\n\n                if (isOriginalStateBatch && !fileSystem.isOnBatch()) {\n                    fileSystem.setBatchCommitInfo(null);\n                    firePostponedBatchEvents(fileSystem);\n                    executePostCommitHook(fileSystem);\n                }\n                fileSystem.setHadCommitOnBatchState(false);\n            } finally {\n                fileSystem.unlock();\n            }\n            return;\n        }\n\n        final String[] s = split(attribute);\n        if (s[0].length() == 0) {\n            throw new IllegalArgumentException(attribute);\n        }\n        final ExtendedAttributeView view = getFileAttributeView(toPathImpl(path),\n                                                                s[0],\n                                                                options);\n        if (view == null) {\n            throw new UnsupportedOperationException(\"View '\" + s[0] + \"' not available\");\n        }\n\n        view.setAttribute(s[1],\n                          value);\n    }\n\n    private void lockAndSquash(final Path path,\n                               final SquashOption value) {\n        final JGitFileSystem fileSystem = (JGitFileSystem) path.getFileSystem();\n        try {\n            fileSystem.lock();\n            final JGitPathImpl gSource = toPathImpl(path);\n            String commitMessage = checkNotEmpty(\"commitMessage\",\n                                                 value.getMessage());\n            String startCommit = checkNotEmpty(\"startCommit\",\n                                               value.getRecord().id());\n            gSource.getFileSystem().getGit().squash(gSource.getRefTree(),\n                                                    startCommit,\n                                                    commitMessage);\n        } finally {\n            fileSystem.unlock();\n        }\n    }\n\n    private void checkURI(final String paramName,\n                          final URI uri)\n            throws IllegalArgumentException {\n        checkNotNull(\"uri\",\n                     uri);\n\n        if (uri.getAuthority() == null || uri.getAuthority().isEmpty()) {\n            throw new IllegalArgumentException(\"Parameter named '\" + paramName + \"' is invalid, missing host repository!\");\n        }\n\n        int atIndex = uri.getPath().indexOf(\"@\");\n        if (atIndex != -1 && !uri.getAuthority().contains(\"@\")) {\n            if (uri.getPath().indexOf(\"/\",\n                                      atIndex) == -1) {\n                throw new IllegalArgumentException(\"Parameter named '\" + paramName + \"' is invalid, missing host repository!\");\n            }\n        }\n    }\n\n    public String extractHostForPath(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        int atIndex = uri.getPath().indexOf(\"@\");\n        if (atIndex != -1 && !uri.getAuthority().contains(\"@\")) {\n            return uri.getAuthority() + uri.getPath().substring(0,\n                                                                uri.getPath().indexOf(\"/\",\n                                                                                      atIndex));\n        }\n\n        return uri.getAuthority();\n    }\n\n    private boolean hasSyncFlag(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return uri.getQuery() != null && uri.getQuery().contains(\"sync\");\n    }\n\n    private boolean hasForceFlag(URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return uri.getQuery() != null && uri.getQuery().contains(\"force\");\n    }\n\n    private boolean hasPushFlag(final URI uri) {\n        checkNotNull(\"uri\",\n                     uri);\n\n        return uri.getQuery() != null && uri.getQuery().contains(\"push\");\n    }\n\n    private CredentialsProvider buildCredential(String username,\n                                                String password) {\n        if (username != null) {\n            if (password != null) {\n                return new UsernamePasswordCredentialsProvider(username,\n                                                               password);\n            }\n            return new UsernamePasswordCredentialsProvider(username,\n                                                           \"\");\n        }\n        return CredentialsProvider.getDefault();\n    }\n\n    private JGitPathImpl toPathImpl(final Path path) {\n        if (path instanceof JGitPathImpl) {\n            return (JGitPathImpl) path;\n        }\n        throw new IllegalArgumentException(\"Path not supported by current provider.\");\n    }\n\n    private String[] split(final String attribute) {\n        final String[] s = new String[2];\n        final int pos = attribute.indexOf(':');\n        if (pos == -1) {\n            s[0] = \"basic\";\n            s[1] = attribute;\n        } else {\n            s[0] = attribute.substring(0,\n                                       pos);\n            s[1] = (pos == attribute.length()) ? \"\" : attribute.substring(pos + 1);\n        }\n        return s;\n    }\n\n    private int getSchemeSize(final URI uri) {\n        if (uri.getScheme().equals(SCHEME)) {\n            return SCHEME_SIZE;\n        }\n        return DEFAULT_SCHEME_SIZE;\n    }\n\n    private void delete(final JGitPathImpl path,\n                        final CommitInfo commitInfo) {\n        commit(path,\n               commitInfo,\n               new DefaultCommitContent(new HashMap<String, File>() {{\n                   put(path.getPath(),\n                       null);\n               }}));\n    }\n\n    private void commit(final JGitPathImpl path,\n                        final CommitInfo commitInfo,\n                        final CommitContent commitContent) {\n\n        final JGitFileSystem fileSystem = path.getFileSystem();\n        try {\n            fileSystem.lock();\n\n            final Git git = fileSystem.getGit();\n            final String branchName = path.getRefTree();\n            final boolean batchState = fileSystem.isOnBatch();\n            final boolean amend = batchState && fileSystem.isHadCommitOnBatchState(path.getRoot());\n            final ObjectId oldHead = path.getFileSystem().getGit().getTreeFromRef(branchName);\n\n            final boolean hasCommit;\n            if (batchState && fileSystem.getBatchCommitInfo() != null) {\n                hasCommit = git.commit(branchName,\n                                       fileSystem.getBatchCommitInfo(),\n                                       amend,\n                                       null,\n                                       commitContent);\n            } else {\n                hasCommit = git.commit(branchName,\n                                       commitInfo,\n                                       amend,\n                                       null,\n                                       commitContent);\n            }\n\n            if (!batchState) {\n                if (hasCommit) {\n                    int value = fileSystem.incrementAndGetCommitCount();\n                    if (value >= config.getCommitLimit()) {\n                        git.gc();\n                        fileSystem.resetCommitCount();\n                    }\n                }\n\n                final ObjectId newHead = path.getFileSystem().getGit().getTreeFromRef(branchName);\n\n                executePostCommitHook(fileSystem);\n\n                notifyDiffs(path.getFileSystem(),\n                            branchName,\n                            commitInfo.getSessionId(),\n                            commitInfo.getName(),\n                            commitInfo.getMessage(),\n                            oldHead,\n                            newHead);\n            } else {\n                synchronized (postponedEventsLock) {\n\n                    String sessionId;\n                    String userName;\n                    String message;\n                    if (fileSystem.getBatchCommitInfo() != null) {\n                        sessionId = fileSystem.getBatchCommitInfo().getSessionId();\n                        userName = fileSystem.getBatchCommitInfo().getName();\n                        message = fileSystem.getBatchCommitInfo().getMessage();\n                    } else {\n                        sessionId = commitInfo.getSessionId();\n                        userName = commitInfo.getName();\n                        message = commitInfo.getMessage();\n                    }\n\n                    final ObjectId newHead = path.getFileSystem().getGit().getTreeFromRef(branchName);\n                    List<WatchEvent<?>> postponedWatchEvents = compareDiffs(path.getFileSystem(),\n                                                                            branchName,\n                                                                            sessionId,\n                                                                            userName,\n                                                                            message,\n                                                                            oldHead,\n                                                                            newHead);\n\n                    fileSystem.addPostponedWatchEvents(postponedWatchEvents);\n                }\n            }\n\n            if (path.getFileSystem().isOnBatch() && !fileSystem.isHadCommitOnBatchState(path.getRoot())) {\n                fileSystem.setHadCommitOnBatchState(path.getRoot(),\n                                                    hasCommit);\n            }\n        } finally {\n            fileSystem.unlock();\n        }\n    }\n\n    @Override\n    public void executePostCommitHook(final JGitFileSystem fileSystem) {\n        ProcessResult result = detectedFS.runHookIfPresent(fileSystem.getGit().getRepository(),\n                                                           \"post-commit\",\n                                                           new String[0]);\n\n        if (result.getStatus().equals(ProcessResult.Status.OK)) {\n            fileSystem.notifyPostCommit(result.getExitCode());\n        }\n    }\n\n    private void firePostponedBatchEvents(JGitFileSystem fileSystem) {\n        synchronized (postponedEventsLock) {\n\n            if (fileSystem.hasPostponedEvents()) {\n                fileSystem.publishEvents(fileSystem.getRootDirectories().iterator().next(),\n                                         fileSystem.getPostponedWatchEvents());\n            }\n\n            fileSystem.clearPostponedWatchEvents();\n\n            int value = fileSystem.incrementAndGetCommitCount();\n            if (value >= config.getCommitLimit()) {\n                fileSystem.getGit().gc();\n                fileSystem.resetCommitCount();\n            }\n        }\n    }\n\n    List<WatchEvent<?>> notifyDiffs(final JGitFileSystem fs,\n                                    final String _tree,\n                                    final String sessionId,\n                                    final String userName,\n                                    final String message,\n                                    final ObjectId oldHead,\n                                    final ObjectId newHead) {\n\n        List<WatchEvent<?>> watchEvents = compareDiffs(fs,\n                                                       _tree,\n                                                       sessionId,\n                                                       userName,\n                                                       message,\n                                                       oldHead,\n                                                       newHead);\n\n        final String tree = removeRefsFromTree(_tree);\n\n        final String host = tree + \"@\" + fs.getName();\n\n        final Path root = JGitPathImpl.createRoot(fs,\n                                                  \"/\",\n                                                  host,\n                                                  false);\n        if (!watchEvents.isEmpty()) {\n            fs.publishEvents(root,\n                             watchEvents);\n        }\n        return watchEvents;\n    }\n\n    List<WatchEvent<?>> compareDiffs(final JGitFileSystem fs,\n                                     final String _tree,\n                                     final String sessionId,\n                                     final String userName,\n                                     final String message,\n                                     final ObjectId oldHead,\n                                     final ObjectId newHead) {\n\n        final String tree = removeRefsFromTree(_tree);\n\n        final String host = tree + \"@\" + fs.getName();\n\n        final List<DiffEntry> diff = fs.getGit().listDiffs(oldHead,\n                                                           newHead);\n        final List<WatchEvent<?>> events = new ArrayList<>(diff.size());\n\n        for (final DiffEntry diffEntry : diff) {\n            final Path oldPath;\n            if (!diffEntry.getOldPath().equals(DiffEntry.DEV_NULL)) {\n                oldPath = JGitPathImpl.create(fs,\n                                              \"/\" + diffEntry.getOldPath(),\n                                              host,\n                                              null,\n                                              false);\n            } else {\n                oldPath = null;\n            }\n\n            final Path newPath;\n            if (!diffEntry.getNewPath().equals(DiffEntry.DEV_NULL)) {\n                final PathInfo pathInfo = fs.getGit().getPathInfo(tree,\n                                                                  diffEntry.getNewPath());\n                newPath = JGitPathImpl.create(fs,\n                                              \"/\" + pathInfo.getPath(),\n                                              host,\n                                              pathInfo.getObjectId(),\n                                              false);\n            } else {\n                newPath = null;\n            }\n\n            WatchEvent e = new JGitWatchEvent(sessionId,\n                                              userName,\n                                              message,\n                                              diffEntry.getChangeType().name(),\n                                              oldPath,\n                                              newPath);\n            events.add(e);\n        }\n\n        return events;\n    }\n\n    GitSSHService getGitSSHService() {\n        return gitSSHService;\n    }\n\n    public JGitFileSystemProviderConfiguration getConfig() {\n        return config;\n    }\n\n    public void setDetectedFS(final FS detectedFS) {\n        this.detectedFS = detectedFS;\n    }\n\n    public JGitFileSystemsManager getFsManager() {\n        return fsManager;\n    }\n\n    /**\n     * implement Executor directly due to bugs in some older CDI implementations.\n     */\n    private static class ExecutorWrapper implements Executor {\n\n        private final ExecutorService simpleAsyncExecutor;\n\n        public ExecutorWrapper(ExecutorService simpleAsyncExecutor) {\n            this.simpleAsyncExecutor = checkNotNull(\"simpleAsyncExecutor\",\n                                                    simpleAsyncExecutor);\n        }\n\n        @Override\n        public void execute(Runnable command) {\n            simpleAsyncExecutor.execute(command);\n        }\n    }\n\n    public class RepositoryResolverImpl<T> implements RepositoryResolver<T> {\n\n        @Override\n        public Repository open(final T client,\n                               final String name)\n                throws RepositoryNotFoundException, ServiceNotAuthorizedException {\n            final User user = extractUser(client);\n            final JGitFileSystem fs = fsManager.get(name);\n            if (fs == null) {\n                throw new RepositoryNotFoundException(name);\n            }\n\n            if (authorizer != null && !authorizer.authorize(fs,\n                                                            user)) {\n                throw new ServiceNotAuthorizedException(\"User not authorized.\");\n            }\n\n            return fs.getGit().getRepository();\n        }\n\n        public JGitFileSystem resolveFileSystem(final Repository repository) {\n            return fsManager.get(repository);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConfiguration.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.util.concurrent.TimeUnit;\nimport java.util.stream.Stream;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\n\nimport static java.util.stream.Collectors.joining;\nimport static org.eclipse.jgit.lib.Constants.DEFAULT_REMOTE_NAME;\n\npublic class JGitFileSystemProviderConfiguration {\n\n    private static final Logger LOG = LoggerFactory.getLogger(JGitFileSystemProviderConfiguration.class);\n\n    public static final String GIT_ENV_KEY_DEFAULT_REMOTE_NAME = DEFAULT_REMOTE_NAME;\n    public static final String GIT_ENV_KEY_BRANCH_LIST = \"branches\";\n    public static final String GIT_ENV_KEY_SUBDIRECTORY = \"subdirectory\";\n\n    public static final String GIT_DAEMON_ENABLED = \"org.uberfire.nio.git.daemon.enabled\";\n    public static final String GIT_SSH_ENABLED = \"org.uberfire.nio.git.ssh.enabled\";\n    public static final String GIT_HTTP_ENABLED = \"org.uberfire.nio.git.http.enabled\";\n    public static final String GIT_HTTPS_ENABLED = \"org.uberfire.nio.git.https.enabled\";\n\n    public static final String GIT_NIO_DIR = \"org.uberfire.nio.git.dir\";\n    public static final String GIT_NIO_DIR_NAME = \"org.uberfire.nio.git.dirname\";\n    public static final String ENABLE_GIT_KETCH = \"org.uberfire.nio.git.ketch\";\n    public static final String HOOK_DIR = \"org.uberfire.nio.git.hooks\";\n\n    public static final String GIT_HTTP_HOST = \"org.uberfire.nio.git.http.host\";\n    public static final String GIT_HTTP_HOSTNAME = \"org.uberfire.nio.git.http.hostname\";\n    public static final String GIT_HTTP_PORT = \"org.uberfire.nio.git.http.port\";\n    public static final String GIT_HTTPS_HOST = \"org.uberfire.nio.git.https.host\";\n    public static final String GIT_HTTPS_HOSTNAME = \"org.uberfire.nio.git.https.hostname\";\n    public static final String GIT_HTTPS_PORT = \"org.uberfire.nio.git.https.port\";\n\n    public static final String GIT_DAEMON_HOST = \"org.uberfire.nio.git.daemon.host\";\n    public static final String GIT_DAEMON_HOSTNAME = \"org.uberfire.nio.git.daemon.hostname\";\n    public static final String GIT_DAEMON_PORT = \"org.uberfire.nio.git.daemon.port\";\n    public static final String GIT_SSH_HOST = \"org.uberfire.nio.git.ssh.host\";\n    public static final String GIT_SSH_HOSTNAME = \"org.uberfire.nio.git.ssh.hostname\";\n    public static final String GIT_SSH_PORT = \"org.uberfire.nio.git.ssh.port\";\n    public static final String GIT_SSH_CERT_DIR = \"org.uberfire.nio.git.ssh.cert.dir\";\n    public static final String GIT_SSH_IDLE_TIMEOUT = \"org.uberfire.nio.git.ssh.idle.timeout\";\n    public static final String GIT_SSH_ALGORITHM = \"org.uberfire.nio.git.ssh.algorithm\";\n    public static final String GIT_SSH_PASSPHRASE = \"org.uberfire.nio.git.ssh.passphrase\";\n    public static final String GIT_GC_LIMIT = \"org.uberfire.nio.git.gc.limit\";\n    public static final String GIT_HTTP_SSL_VERIFY = \"org.uberfire.nio.git.http.sslVerify\";\n    public static final String PROXY_TYPE = \"org.uberfire.nio.git.proxy.type\";\n    public static final String SSH_OVER_HTTP = \"org.uberfire.nio.git.proxy.ssh.over.http\";\n    public static final String HTTP_PROXY_HOST = \"http.proxyHost\";\n    public static final String HTTP_PROXY_PORT = \"http.proxyPort\";\n    public static final String HTTP_PROXY_USER = \"http.proxyUser\";\n    public static final String HTTP_PROXY_PASSWORD = \"http.proxyPassword\";\n    public static final String SSH_OVER_HTTPS = \"org.uberfire.nio.git.proxy.ssh.over.https\";\n    public static final String HTTPS_PROXY_HOST = \"https.proxyHost\";\n    public static final String HTTPS_PROXY_PORT = \"https.proxyPort\";\n    public static final String HTTPS_PROXY_USER = \"https.proxyUser\";\n    public static final String HTTPS_PROXY_PASSWORD = \"https.proxyPassword\";\n    public static final String USER_DIR = \"user.dir\";\n    public static final String JGIT_CACHE_INSTANCES = \"org.uberfire.nio.jgit.cache.instances\";\n    public static final String JGIT_CACHE_OVERFLOW_CLEANUP_SIZE = \"org.uberfire.nio.jgit.cache.overflow.cleanup.size\";\n    public static final String JGIT_REMOVE_ELDEST_ENTRY_ITERATIONS = \"org.uberfire.nio.jgit.remove.eldest.iterations\";\n    public static final String JGIT_CACHE_EVICT_THRESHOLD_DURATION = \"org.uberfire.nio.jgit.cache.evict.threshold.duration\";\n    public static final String JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT = \"org.uberfire.nio.jgit.cache.evict.threshold.time.unit\";\n\n    public static final String GIT_ENV_KEY_DEST_PATH = \"out-dir\";\n    public static final String GIT_ENV_KEY_USER_NAME = \"username\";\n    public static final String GIT_ENV_KEY_PASSWORD = \"password\";\n    public static final String GIT_ENV_KEY_INIT = \"init\";\n    public static final String GIT_ENV_KEY_MIRROR = \"mirror\";\n    public static final String SCHEME = \"git\";\n    public static final String GIT_SSH_CIPHERS = \"org.uberfire.nio.git.ssh.ciphers\";\n    public static final String GIT_SSH_MACS = \"org.uberfire.nio.git.ssh.macs\";\n    public static final int SCHEME_SIZE = (SCHEME + \"://\").length();\n    public static final int DEFAULT_SCHEME_SIZE = (\"default://\").length();\n    public static final String DEFAULT_HOST_NAME = \"localhost\";\n    public static final String REPOSITORIES_CONTAINER_DIR = \".niogit\";\n    public static final String SSH_FILE_CERT_CONTAINER_DIR = \".security\";\n    public static final String DEFAULT_SSH_OVER_HTTP = \"false\";\n    public static final String DEFAULT_PROXY_TYPE = \"http\";\n    public static final String DEFAULT_SSH_OVER_HTTPS = \"false\";\n    public static final String DEFAULT_HOST_ADDR = \"127.0.0.1\";\n    public static final String DEFAULT_DAEMON_DEFAULT_ENABLED = \"false\";\n    public static final String DEFAULT_DAEMON_DEFAULT_PORT = \"9418\";\n    public static final String DEFAULT_SSH_ENABLED = \"true\";\n    public static final String DEFAULT_HTTP_ENABLED = \"true\";\n    public static final String DEFAULT_HTTPS_ENABLED = \"false\";\n    public static final String DEFAULT_HTTP_PORT = \"8080\";\n    public static final String DEFAULT_HTTPS_PORT = \"8443\";\n    public static final String DEFAULT_SSH_PORT = \"8001\";\n    public static final String DEFAULT_SSH_IDLE_TIMEOUT = \"10000\";\n    public static final String DEFAULT_SSH_ALGORITHM = \"RSA\";\n    public static final String DEFAULT_SSH_CERT_PASSPHRASE = \"\";\n    public static final String DEFAULT_COMMIT_LIMIT_TO_GC = \"20\";\n    public static final Boolean DEFAULT_GIT_HTTP_SSL_VERIFY = Boolean.TRUE;\n    public static final String DEFAULT_ENABLE_GIT_KETCH = \"false\";\n    public static final String DEFAULT_JGIT_FILE_SYSTEM_INSTANCES_CACHE = \"10000\";\n    public static final String DEFAULT_JGIT_REMOVE_ELDEST_ENTRY_ITERATIONS = \"10\";\n    public static final String DEFAULT_JGIT_CACHE_OVERFLOW_CLEANUP_SIZE = \"10\";\n    public static final String DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_DURATION = \"5\";\n    public static final TimeUnit DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT = TimeUnit.MINUTES;\n\n    private int commitLimit;\n    private boolean sslVerify;\n    private boolean daemonEnabled;\n    private int daemonPort;\n    private String daemonHostAddr;\n    private String daemonHostName;\n\n    private boolean sshEnabled;\n    private int sshPort;\n    private String sshHostAddr;\n    private String sshHostName;\n    private File sshFileCertDir;\n    private String sshAlgorithm;\n    private String sshPassphrase;\n    private String sshIdleTimeout;\n    private String gitSshCiphers;\n    private String gitSshMACs;\n\n    private boolean httpEnabled;\n    private int httpPort;\n    private String httpHostAddr;\n    private String httpHostName;\n    private boolean httpsEnabled;\n    private int httpsPort;\n    private String httpsHostAddr;\n    private String httpsHostName;\n\n    private File gitReposParentDir;\n\n    private File hookDir;\n\n    boolean enableKetch = false;\n    private String proxyType;\n    private boolean sshOverHttpProxy;\n    private String httpProxyHost;\n    private int httpProxyPort;\n    private String httpProxyUser;\n    private String httpProxyPassword;\n    private boolean sshOverHttpsProxy;\n    private String httpsProxyHost;\n    private int httpsProxyPort;\n    private String httpsProxyUser;\n    private String httpsProxyPassword;\n\n    //Number of instances of filesystem in cache\n    private int jgitFileSystemsInstancesCache;\n    //Number of instances that was removed by iteration in case of cache overflow\n    private int jgitCacheOverflowCleanupSize;\n    //Number of attempts to remove FS instances on cache\n    private int jgitRemoveEldestEntryIterations;\n    //Duration of Threshold of jgit file system instances evict\n    private long jgitCacheEvictThresholdDuration;\n    //TimeUnit of Threshold of jgit file system instances evict\n    private TimeUnit jgitCacheEvictThresholdTimeUnit;\n\n    public void load(ConfigProperties systemConfig) {\n        LOG.debug(\"Configuring from properties:\");\n\n        final String currentDirectory = System.getProperty(USER_DIR);\n        final ConfigProperties.ConfigProperty enableKetchProp = systemConfig.get(ENABLE_GIT_KETCH,\n                                                                                 DEFAULT_ENABLE_GIT_KETCH);\n        final ConfigProperties.ConfigProperty hookDirProp = systemConfig.get(HOOK_DIR,\n                                                                             null);\n        final ConfigProperties.ConfigProperty bareReposDirProp = systemConfig.get(GIT_NIO_DIR,\n                                                                                  currentDirectory);\n        final ConfigProperties.ConfigProperty reposDirNameProp = systemConfig.get(GIT_NIO_DIR_NAME,\n                                                                                  REPOSITORIES_CONTAINER_DIR);\n        final ConfigProperties.ConfigProperty enabledProp = systemConfig.get(GIT_DAEMON_ENABLED,\n                                                                             DEFAULT_DAEMON_DEFAULT_ENABLED);\n        final ConfigProperties.ConfigProperty hostProp = systemConfig.get(GIT_DAEMON_HOST,\n                                                                          DEFAULT_HOST_ADDR);\n        final ConfigProperties.ConfigProperty hostNameProp = systemConfig.get(GIT_DAEMON_HOSTNAME,\n                                                                              hostProp.isDefault() ? DEFAULT_HOST_NAME : hostProp.getValue());\n        final ConfigProperties.ConfigProperty portProp = systemConfig.get(GIT_DAEMON_PORT,\n                                                                          DEFAULT_DAEMON_DEFAULT_PORT);\n\n        final ConfigProperties.ConfigProperty httpEnabledProp = systemConfig.get(GIT_HTTP_ENABLED,\n                                                                                 DEFAULT_HTTP_ENABLED);\n        final ConfigProperties.ConfigProperty httpHostProp = systemConfig.get(GIT_HTTP_HOST,\n                                                                              DEFAULT_HOST_ADDR);\n        final ConfigProperties.ConfigProperty httpHostNameProp = systemConfig.get(GIT_HTTP_HOSTNAME,\n                                                                                  httpHostProp.isDefault() ? DEFAULT_HOST_NAME : httpHostProp.getValue());\n        final ConfigProperties.ConfigProperty httpPortProp = systemConfig.get(GIT_HTTP_PORT,\n                                                                              DEFAULT_HTTP_PORT);\n        final ConfigProperties.ConfigProperty httpsEnabledProp = systemConfig.get(GIT_HTTPS_ENABLED,\n                                                                                  DEFAULT_HTTPS_ENABLED);\n        final ConfigProperties.ConfigProperty httpsHostProp = systemConfig.get(GIT_HTTPS_HOST,\n                                                                               DEFAULT_HOST_ADDR);\n        final ConfigProperties.ConfigProperty httpsHostNameProp = systemConfig.get(GIT_HTTPS_HOSTNAME,\n                                                                                   httpHostProp.isDefault() ? DEFAULT_HOST_NAME : httpHostProp.getValue());\n        final ConfigProperties.ConfigProperty httpsPortProp = systemConfig.get(GIT_HTTPS_PORT,\n                                                                               DEFAULT_HTTPS_PORT);\n\n        final ConfigProperties.ConfigProperty sshEnabledProp = systemConfig.get(GIT_SSH_ENABLED,\n                                                                                DEFAULT_SSH_ENABLED);\n        final ConfigProperties.ConfigProperty sshHostProp = systemConfig.get(GIT_SSH_HOST,\n                                                                             DEFAULT_HOST_ADDR);\n        final ConfigProperties.ConfigProperty sshHostNameProp = systemConfig.get(GIT_SSH_HOSTNAME,\n                                                                                 sshHostProp.isDefault() ? DEFAULT_HOST_NAME : sshHostProp.getValue());\n        final ConfigProperties.ConfigProperty sshPortProp = systemConfig.get(GIT_SSH_PORT,\n                                                                             DEFAULT_SSH_PORT);\n        final ConfigProperties.ConfigProperty sshCertDirProp = systemConfig.get(GIT_SSH_CERT_DIR,\n                                                                                currentDirectory);\n        final ConfigProperties.ConfigProperty sshIdleTimeoutProp = systemConfig.get(GIT_SSH_IDLE_TIMEOUT,\n                                                                                    DEFAULT_SSH_IDLE_TIMEOUT);\n        final ConfigProperties.ConfigProperty sshAlgorithmProp = systemConfig.get(GIT_SSH_ALGORITHM,\n                                                                                  DEFAULT_SSH_ALGORITHM);\n        final ConfigProperties.ConfigProperty sshPassphraseProp = systemConfig.get(GIT_SSH_PASSPHRASE,\n                                                                                   DEFAULT_SSH_CERT_PASSPHRASE);\n        final ConfigProperties.ConfigProperty commitLimitProp = systemConfig.get(GIT_GC_LIMIT,\n                                                                                 DEFAULT_COMMIT_LIMIT_TO_GC);\n        final ConfigProperties.ConfigProperty sslVerifyProp = systemConfig.get(GIT_HTTP_SSL_VERIFY,\n                                                                               DEFAULT_GIT_HTTP_SSL_VERIFY.toString());\n        final ConfigProperties.ConfigProperty sshOverHttpProxyProp = systemConfig.get(SSH_OVER_HTTP,\n                                                                                      DEFAULT_SSH_OVER_HTTP);\n        final ConfigProperties.ConfigProperty proxyTypeProp = systemConfig.get(PROXY_TYPE, DEFAULT_PROXY_TYPE);\n        final ConfigProperties.ConfigProperty httpProxyHostProp = systemConfig.get(HTTP_PROXY_HOST,\n                                                                                   null);\n        final ConfigProperties.ConfigProperty httpProxyPortProp = systemConfig.get(HTTP_PROXY_PORT,\n                                                                                   null);\n        final ConfigProperties.ConfigProperty httpProxyUserProp = systemConfig.get(HTTP_PROXY_USER,\n                                                                                   null);\n        final ConfigProperties.ConfigProperty httpProxyPasswordProp = systemConfig.get(HTTP_PROXY_PASSWORD,\n                                                                                       null);\n        final ConfigProperties.ConfigProperty sshOverHttpsProxyProp = systemConfig.get(SSH_OVER_HTTPS,\n                                                                                       DEFAULT_SSH_OVER_HTTPS);\n        final ConfigProperties.ConfigProperty httpsProxyHostProp = systemConfig.get(HTTPS_PROXY_HOST,\n                                                                                    null);\n        final ConfigProperties.ConfigProperty httpsProxyPortProp = systemConfig.get(HTTPS_PROXY_PORT,\n                                                                                    null);\n        final ConfigProperties.ConfigProperty httpsProxyUserProp = systemConfig.get(HTTPS_PROXY_USER,\n                                                                                    null);\n        final ConfigProperties.ConfigProperty httpsProxyPasswordProp = systemConfig.get(HTTPS_PROXY_PASSWORD,\n                                                                                        null);\n\n        final ConfigProperties.ConfigProperty jgitFileSystemsInstancesCacheProp = systemConfig.get(JGIT_CACHE_INSTANCES,\n                                                                                                   DEFAULT_JGIT_FILE_SYSTEM_INSTANCES_CACHE);\n\n        final ConfigProperties.ConfigProperty jgitFileSystemsCacheOverflowSizePropCacheProp = systemConfig.get(JGIT_CACHE_OVERFLOW_CLEANUP_SIZE,\n                                                                                                               DEFAULT_JGIT_CACHE_OVERFLOW_CLEANUP_SIZE);\n\n        final ConfigProperties.ConfigProperty jgitRemoveEldestEntryIterationsProp = systemConfig.get(JGIT_REMOVE_ELDEST_ENTRY_ITERATIONS,\n                                                                                                     DEFAULT_JGIT_REMOVE_ELDEST_ENTRY_ITERATIONS);\n\n        final ConfigProperties.ConfigProperty jgitCacheEvictThresoldDurationProp = systemConfig.get(JGIT_CACHE_EVICT_THRESHOLD_DURATION,\n                                                                                                    DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_DURATION);\n\n        final ConfigProperties.ConfigProperty jgitCacheEvictThresoldTimeUnitProp = systemConfig.get(JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT,\n                                                                                                    DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT.name());\n\n        final ConfigProperties.ConfigProperty jgitSshCiphers = systemConfig.get(GIT_SSH_CIPHERS, null);\n        final ConfigProperties.ConfigProperty jgitSshMacs = systemConfig.get(GIT_SSH_MACS, null);\n\n        gitSshCiphers = jgitSshCiphers.getValue();\n        gitSshMACs = jgitSshMacs.getValue();\n\n        sshOverHttpProxy = sshOverHttpProxyProp.getBooleanValue();\n        proxyType = proxyTypeProp.getValue();\n        if (sshOverHttpProxy) {\n            httpProxyHost = httpProxyHostProp.getValue();\n            httpProxyPort = httpProxyPortProp.getIntValue();\n        }\n        httpProxyUser = httpProxyUserProp.getValue();\n        httpProxyPassword = httpProxyPasswordProp.getValue();\n        sshOverHttpsProxy = sshOverHttpsProxyProp.getBooleanValue();\n        if (sshOverHttpsProxy) {\n            httpsProxyHost = httpsProxyHostProp.getValue();\n            httpsProxyPort = httpsProxyPortProp.getIntValue();\n        }\n        httpsProxyUser = httpsProxyUserProp.getValue();\n        httpsProxyPassword = httpsProxyPasswordProp.getValue();\n\n        if (LOG.isDebugEnabled()) {\n            LOG.debug(systemConfig.getConfigurationSummary(\"Summary of JGit configuration:\"));\n        }\n\n        if (enableKetchProp != null && enableKetchProp.getValue() != null) {\n            enableKetch = enableKetchProp.getBooleanValue();\n        }\n\n        if (hookDirProp != null && hookDirProp.getValue() != null) {\n            hookDir = new File(hookDirProp.getValue());\n            if (!hookDir.exists()) {\n                hookDir = null;\n            }\n        }\n\n        gitReposParentDir = new File(bareReposDirProp.getValue(),\n                                     reposDirNameProp.getValue());\n        commitLimit = commitLimitProp.getIntValue();\n        sslVerify = sslVerifyProp.getBooleanValue();\n\n        jgitFileSystemsInstancesCache = jgitFileSystemsInstancesCacheProp.getIntValue();\n\n        if (jgitFileSystemsInstancesCache < 1) {\n            jgitFileSystemsInstancesCache = Integer.valueOf(DEFAULT_JGIT_FILE_SYSTEM_INSTANCES_CACHE);\n        }\n\n        jgitCacheOverflowCleanupSize = jgitFileSystemsCacheOverflowSizePropCacheProp.getIntValue();\n\n        if (jgitCacheOverflowCleanupSize < 1) {\n            jgitCacheOverflowCleanupSize = Integer.valueOf(DEFAULT_JGIT_CACHE_OVERFLOW_CLEANUP_SIZE);\n        }\n\n        jgitRemoveEldestEntryIterations = jgitRemoveEldestEntryIterationsProp.getIntValue();\n        if (jgitRemoveEldestEntryIterations < 1) {\n            jgitRemoveEldestEntryIterations = Integer.valueOf(DEFAULT_JGIT_REMOVE_ELDEST_ENTRY_ITERATIONS);\n        }\n\n        jgitCacheEvictThresholdDuration = Long.valueOf(jgitCacheEvictThresoldDurationProp.getValue());\n        if (jgitCacheEvictThresholdDuration < 1) {\n            jgitCacheEvictThresholdDuration = Integer.valueOf(DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_DURATION);\n        }\n\n        try {\n            jgitCacheEvictThresholdTimeUnit = TimeUnit.valueOf(jgitCacheEvictThresoldTimeUnitProp.getValue());\n        } catch (IllegalArgumentException e) {\n            String validValues = Stream.of(TimeUnit.values()).map(Enum::toString).collect(joining(\",\"));\n            LOG.warn(\"Failed to parse TimeUnit from {}={}. Valid values are {}. Using default instead: {}\",\n                     JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT,\n                     jgitCacheEvictThresholdTimeUnit,\n                     validValues,\n                     DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT);\n            jgitCacheEvictThresholdTimeUnit = DEFAULT_JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT;\n        }\n\n        daemonEnabled = enabledProp.getBooleanValue();\n        if (daemonEnabled) {\n            daemonPort = portProp.getIntValue();\n            daemonHostAddr = hostProp.getValue();\n            daemonHostName = hostNameProp.getValue();\n        }\n\n        sshEnabled = sshEnabledProp.getBooleanValue();\n        if (sshEnabled) {\n            sshPort = sshPortProp.getIntValue();\n            sshHostAddr = sshHostProp.getValue();\n            sshHostName = sshHostNameProp.getValue();\n            sshFileCertDir = new File(sshCertDirProp.getValue(),\n                                      SSH_FILE_CERT_CONTAINER_DIR);\n            sshAlgorithm = sshAlgorithmProp.getValue();\n            sshIdleTimeout = sshIdleTimeoutProp.getValue();\n            try {\n                Integer.valueOf(sshIdleTimeout);\n            } catch (final NumberFormatException exception) {\n                LOG.error(\"SSH Idle Timeout value is not a valid integer - Parameter is ignored, now using default value.\");\n                sshIdleTimeout = DEFAULT_SSH_IDLE_TIMEOUT;\n            }\n        }\n        sshPassphrase = sshPassphraseProp.getValue();\n\n        httpEnabled = httpEnabledProp.getBooleanValue();\n        if (httpEnabled) {\n            httpPort = httpPortProp.getIntValue();\n            httpHostAddr = httpHostProp.getValue();\n            httpHostName = httpHostNameProp.getValue();\n        }\n\n        httpsEnabled = httpsEnabledProp.getBooleanValue();\n        if (httpsEnabled) {\n            httpsPort = httpsPortProp.getIntValue();\n            httpsHostAddr = httpsHostProp.getValue();\n            httpsHostName = httpsHostNameProp.getValue();\n        }\n    }\n\n    public boolean httpProxyIsDefined() {\n        return (httpProxyUser != null &&\n                httpProxyPassword != null) ||\n                (httpsProxyUser != null &&\n                        httpsProxyPassword != null);\n    }\n\n    public int getCommitLimit() {\n        return commitLimit;\n    }\n\n    public boolean isSslVerify() {\n        return sslVerify;\n    }\n\n    public boolean isDaemonEnabled() {\n        return daemonEnabled;\n    }\n\n    public int getDaemonPort() {\n        return daemonPort;\n    }\n\n    public String getDaemonHostAddr() {\n        return daemonHostAddr;\n    }\n\n    public String getDaemonHostName() {\n        return daemonHostName;\n    }\n\n    public boolean isSshEnabled() {\n        return sshEnabled;\n    }\n\n    public int getSshPort() {\n        return sshPort;\n    }\n\n    public String getSshHostAddr() {\n        return sshHostAddr;\n    }\n\n    public String getSshHostName() {\n        return sshHostName;\n    }\n\n    public File getSshFileCertDir() {\n        return sshFileCertDir;\n    }\n\n    public String getSshAlgorithm() {\n        return sshAlgorithm;\n    }\n\n    public String getSshPassphrase() {\n        return sshPassphrase;\n    }\n\n    public String getSshIdleTimeout() {\n        return sshIdleTimeout;\n    }\n\n    public File getGitReposParentDir() {\n        return gitReposParentDir;\n    }\n\n    public File getHookDir() {\n        return hookDir;\n    }\n\n    public boolean isEnableKetch() {\n        return enableKetch;\n    }\n\n    public String getProxyType() {\n        return proxyType;\n    }\n\n    public boolean isSshOverHttpProxy() {\n        return sshOverHttpProxy;\n    }\n\n    public String getHttpProxyHost() {\n        return httpProxyHost;\n    }\n\n    public int getHttpProxyPort() {\n        return httpProxyPort;\n    }\n\n    public String getHttpProxyUser() {\n        return httpProxyUser;\n    }\n\n    public String getHttpProxyPassword() {\n        return httpProxyPassword;\n    }\n\n    public boolean isSshOverHttpsProxy() {\n        return sshOverHttpsProxy;\n    }\n\n    public String getHttpsProxyHost() {\n        return httpsProxyHost;\n    }\n\n    public int getHttpsProxyPort() {\n        return httpsProxyPort;\n    }\n\n    public String getHttpsProxyUser() {\n        return httpsProxyUser;\n    }\n\n    public String getHttpsProxyPassword() {\n        return httpsProxyPassword;\n    }\n\n    public boolean isHttpEnabled() {\n        return httpEnabled;\n    }\n\n    public int getHttpPort() {\n        return httpPort;\n    }\n\n    public String getHttpHostAddr() {\n        return httpHostAddr;\n    }\n\n    public String getHttpHostName() {\n        return httpHostName;\n    }\n\n    public boolean isHttpsEnabled() {\n        return httpsEnabled;\n    }\n\n    public int getHttpsPort() {\n        return httpsPort;\n    }\n\n    public String getHttpsHostAddr() {\n        return httpsHostAddr;\n    }\n\n    public String getHttpsHostName() {\n        return httpsHostName;\n    }\n\n    public int getJgitFileSystemsInstancesCache() {\n        return jgitFileSystemsInstancesCache;\n    }\n\n    public int getJgitCacheOverflowCleanupSize() {\n        return jgitCacheOverflowCleanupSize;\n    }\n\n    public int getJgitRemoveEldestEntryIterations() {\n        return jgitRemoveEldestEntryIterations;\n    }\n\n    public TimeUnit getDefaultJgitCacheEvictThresholdTimeUnit() {\n        return jgitCacheEvictThresholdTimeUnit;\n    }\n\n    public long getJgitCacheEvictThresholdDuration() {\n        return jgitCacheEvictThresholdDuration;\n    }\n\n    public String getGitSshCiphers() {\n        return gitSshCiphers;\n    }\n\n    public String getGitSshMACs() {\n        return gitSshMACs;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProxy.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Supplier;\n\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.PathMatcher;\nimport org.uberfire.java.nio.file.PatternSyntaxException;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\n\npublic class JGitFileSystemProxy implements JGitFileSystem {\n\n    private String fsName;\n    private Supplier<JGitFileSystem> cachedSupplier;\n\n    public JGitFileSystemProxy(String fsName,\n                               Supplier<JGitFileSystem> cachedSupplier) {\n        this.fsName = fsName;\n\n        this.cachedSupplier = cachedSupplier;\n    }\n\n    @Override\n    public void setPublicURI(Map<String, String> fullHostNames) {\n        cachedSupplier.get().setPublicURI(fullHostNames);\n    }\n\n    @Override\n    public String getName() {\n        return fsName;\n    }\n\n    @Override\n    public Git getGit() {\n        return cachedSupplier.get().getGit();\n    }\n\n    @Override\n    public CredentialsProvider getCredential() {\n        return cachedSupplier.get().getCredential();\n    }\n\n    @Override\n    public void checkClosed() throws IllegalStateException {\n        cachedSupplier.get().checkClosed();\n    }\n\n    @Override\n    public void publishEvents(Path watchable,\n                              List<WatchEvent<?>> elist) {\n        cachedSupplier.get().publishEvents(watchable,\n                                           elist);\n    }\n\n    @Override\n    public boolean isOnBatch() {\n        return cachedSupplier.get().isOnBatch();\n    }\n\n    @Override\n    public void setState(String state) {\n        cachedSupplier.get().setState(state);\n    }\n\n    @Override\n    public CommitInfo buildCommitInfo(String defaultMessage,\n                                      CommentedOption op) {\n        return cachedSupplier.get().buildCommitInfo(defaultMessage,\n                                                    op);\n    }\n\n    @Override\n    public void setBatchCommitInfo(String defaultMessage,\n                                   CommentedOption op) {\n        cachedSupplier.get().setBatchCommitInfo(defaultMessage,\n                                                op);\n    }\n\n    @Override\n    public void setHadCommitOnBatchState(Path path,\n                                         boolean hadCommitOnBatchState) {\n        cachedSupplier.get().setHadCommitOnBatchState(path,\n                                                      hadCommitOnBatchState);\n    }\n\n    @Override\n    public void setHadCommitOnBatchState(boolean value) {\n        cachedSupplier.get().setHadCommitOnBatchState(value);\n    }\n\n    @Override\n    public boolean isHadCommitOnBatchState(Path path) {\n        return cachedSupplier.get().isHadCommitOnBatchState(path);\n    }\n\n    @Override\n    public void setBatchCommitInfo(CommitInfo batchCommitInfo) {\n        cachedSupplier.get().setBatchCommitInfo(batchCommitInfo);\n    }\n\n    @Override\n    public CommitInfo getBatchCommitInfo() {\n        return cachedSupplier.get().getBatchCommitInfo();\n    }\n\n    @Override\n    public int incrementAndGetCommitCount() {\n        return cachedSupplier.get().incrementAndGetCommitCount();\n    }\n\n    @Override\n    public void resetCommitCount() {\n        cachedSupplier.get().resetCommitCount();\n    }\n\n    @Override\n    public int getNumberOfCommitsSinceLastGC() {\n        return cachedSupplier.get().getNumberOfCommitsSinceLastGC();\n    }\n\n    @Override\n    public void lock() {\n        cachedSupplier.get().lock();\n    }\n\n    @Override\n    public void unlock() {\n        cachedSupplier.get().unlock();\n    }\n\n    @Override\n    public void addPostponedWatchEvents(List<WatchEvent<?>> postponedWatchEvents) {\n        cachedSupplier.get().addPostponedWatchEvents(postponedWatchEvents);\n    }\n\n    @Override\n    public List<WatchEvent<?>> getPostponedWatchEvents() {\n        return cachedSupplier.get().getPostponedWatchEvents();\n    }\n\n    @Override\n    public void clearPostponedWatchEvents() {\n        cachedSupplier.get().clearPostponedWatchEvents();\n    }\n\n    @Override\n    public boolean hasPostponedEvents() {\n        return cachedSupplier.get().hasPostponedEvents();\n    }\n\n    @Override\n    public boolean hasBeenInUse() {\n        return cachedSupplier.get().hasBeenInUse();\n    }\n\n    @Override\n    public void notifyExternalUpdate() {\n        cachedSupplier.get().notifyExternalUpdate();\n    }\n\n    @Override\n    public void notifyPostCommit(int exitCode) {\n        cachedSupplier.get().notifyPostCommit(exitCode);\n    }\n\n    @Override\n    public void checkBranchAccess(final ReceiveCommand command,\n                                  final User user) {\n        cachedSupplier.get().checkBranchAccess(command,\n                                               user);\n    }\n\n    @Override\n    public void filterBranchAccess(final UploadPack uploadPack,\n                                   final User user) {\n        cachedSupplier.get().filterBranchAccess(uploadPack,\n                                                user);\n    }\n\n    @Override\n    public FileSystemProvider provider() {\n        return cachedSupplier.get().provider();\n    }\n\n    @Override\n    public boolean isOpen() {\n        return cachedSupplier.get().isOpen();\n    }\n\n    @Override\n    public boolean isReadOnly() {\n        return false;\n    }\n\n    @Override\n    public String getSeparator() {\n        return \"/\";\n    }\n\n    @Override\n    public Iterable<Path> getRootDirectories() {\n        return cachedSupplier.get().getRootDirectories();\n    }\n\n    @Override\n    public Iterable<FileStore> getFileStores() {\n        return cachedSupplier.get().getFileStores();\n    }\n\n    @Override\n    public Set<String> supportedFileAttributeViews() {\n        return cachedSupplier.get().supportedFileAttributeViews();\n    }\n\n    @Override\n    public Path getPath(String first,\n                        String... more) throws InvalidPathException {\n        return cachedSupplier.get().getPath(first,\n                                            more);\n    }\n\n    @Override\n    public PathMatcher getPathMatcher(String syntaxAndPattern) throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException {\n        return cachedSupplier.get().getPathMatcher(syntaxAndPattern);\n    }\n\n    @Override\n    public UserPrincipalLookupService getUserPrincipalLookupService() throws UnsupportedOperationException {\n        return cachedSupplier.get().getUserPrincipalLookupService();\n    }\n\n    @Override\n    public WatchService newWatchService() throws UnsupportedOperationException, IOException {\n        return cachedSupplier.get().newWatchService();\n    }\n\n    @Override\n    public void close() {\n        cachedSupplier.get().close();\n    }\n\n    @Override\n    public void dispose() {\n        cachedSupplier.get().dispose();\n    }\n\n    @Override\n    public String id() {\n        return fsName;\n    }\n\n    @Override\n    public FileSystemState getState() {\n        return cachedSupplier.get().getState();\n    }\n\n    public JGitFileSystem getRealJGitFileSystem() {\n        return cachedSupplier.get();\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        return cachedSupplier.get().equals(obj);\n    }\n\n    @Override\n    public int hashCode() {\n        return cachedSupplier.get().hashCode();\n    }\n\n    @Override\n    public String toString() {\n        return cachedSupplier.get().toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitHiddenAttributeView.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributeView;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributes;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributesImpl;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.fs.jgit.daemon.filters.HiddenBranchRefFilter;\n\n/**\n * This is the JGit implementation of the {@link HiddenAttributeView}.\n * It builds the HiddenAttributes object with \"isHidden\" attribute information.\n * That attribute lets you know if the branch you are querying is a hidden branch or not.\n * Hidden branches should not be used, are just a mechanism to merge.\n */\npublic class JGitHiddenAttributeView extends HiddenAttributeView<JGitPathImpl> {\n\n    private HiddenAttributes attrs = null;\n\n    public JGitHiddenAttributeView(final JGitPathImpl path) {\n        super(path);\n    }\n\n    @Override\n    public HiddenAttributes readAttributes() throws IOException {\n        if (attrs == null) {\n            attrs = buildAttrs(path.getFileSystem(),\n                               path.getRefTree(),\n                               path.getPath());\n        }\n        return attrs;\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{HiddenAttributeView.class, JGitVersionAttributeView.class};\n    }\n\n    private HiddenAttributes buildAttrs(final JGitFileSystem fileSystem,\n                                        final String refTree,\n                                        final String path) {\n        return new HiddenAttributesImpl(new JGitBasicAttributeView(this.path).readAttributes(),\n                                        HiddenBranchRefFilter.isHidden(refTree));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitPathImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.InputStream;\nimport java.io.OutputStream;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.SegmentedPath;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\nimport static org.eclipse.jgit.lib.Constants.MASTER;\n\npublic class JGitPathImpl extends AbstractPath<JGitFileSystem>\n        implements SegmentedPath {\n\n    private static final int BUFFER_SIZE = 8192;\n    public final static String DEFAULT_REF_TREE = MASTER;\n\n    private final ObjectId objectId;\n\n    private JGitPathImpl(final JGitFileSystem fs,\n                         final String path,\n                         final String host,\n                         final ObjectId id,\n                         final boolean isRoot,\n                         final boolean isRealPath,\n                         final boolean isNormalized) {\n        super(fs,\n              path,\n              host,\n              isRoot,\n              isRealPath,\n              isNormalized);\n        this.objectId = id;\n    }\n\n    @Override\n    protected RootInfo setupRoot(final JGitFileSystem fs,\n                                 final String pathx,\n                                 final String host,\n                                 final boolean isRoot) {\n        final boolean isRooted = isRoot ? true : pathx.startsWith(\"/\");\n\n        final boolean isAbsolute;\n        if (isRooted) {\n            isAbsolute = true;\n        } else {\n            isAbsolute = false;\n        }\n\n        int lastOffset = isAbsolute ? 1 : 0;\n\n        final boolean isFinalRoot;\n        if (pathx.length() == 1 && lastOffset == 1) {\n            isFinalRoot = true;\n        } else {\n            isFinalRoot = isRoot;\n        }\n\n        return new RootInfo(lastOffset,\n                            isAbsolute,\n                            isFinalRoot,\n                            pathx.getBytes());\n    }\n\n    @Override\n    protected String defaultDirectory() {\n        return \"/:\";\n    }\n\n    @Override\n    protected Path newRoot(final JGitFileSystem fs,\n                           final String substring,\n                           final String host,\n                           final boolean realPath) {\n        return new JGitPathImpl(fs,\n                                substring,\n                                host,\n                                null,\n                                true,\n                                realPath,\n                                true);\n    }\n\n    @Override\n    protected Path newPath(final JGitFileSystem fs,\n                           final String substring,\n                           final String host,\n                           final boolean isRealPath,\n                           final boolean isNormalized) {\n        return new JGitPathImpl(fs,\n                                substring,\n                                host,\n                                null,\n                                false,\n                                isRealPath,\n                                isNormalized);\n    }\n\n    public static JGitPathImpl create(final JGitFileSystem fs,\n                                      final String path,\n                                      final String host,\n                                      final ObjectId id,\n                                      final boolean isRealPath) {\n        return new JGitPathImpl(fs,\n                                setupPath(path),\n                                setupHost(host),\n                                id,\n                                false,\n                                isRealPath,\n                                false);\n    }\n\n    public static JGitPathImpl create(final JGitFileSystem fs,\n                                      final String path,\n                                      final String host,\n                                      final boolean isRealPath) {\n        return new JGitPathImpl(fs,\n                                setupPath(path),\n                                setupHost(host),\n                                null,\n                                false,\n                                isRealPath,\n                                false);\n    }\n\n    public static JGitPathImpl createRoot(final JGitFileSystem fs,\n                                          final String path,\n                                          final String host,\n                                          final boolean isRealPath) {\n        return new JGitPathImpl(fs,\n                                setupPath(path),\n                                setupHost(host),\n                                null,\n                                true,\n                                isRealPath,\n                                true);\n    }\n\n    public static JGitPathImpl createFSDirect(final JGitFileSystem fs) {\n        return new JGitPathImpl(fs,\n                                null,\n                                null,\n                                null,\n                                true,\n                                true,\n                                true);\n    }\n\n    @Override\n    public File toFile() {\n        if (file == null) {\n            synchronized (this) {\n                if (isRegularFile()) {\n                    try {\n                        file = File.createTempFile(\"git\",\n                                                   \"temp\");\n                        try (final InputStream in = getFileSystem().provider().newInputStream(this);\n                             final OutputStream out = new FileOutputStream(file)) {\n                            internalCopy(in,\n                                         out);\n                        }\n                    } catch (final Exception ex) {\n                        file = null;\n                    }\n                } else {\n                    throw new UnsupportedOperationException();\n                }\n            }\n        }\n        return file;\n    }\n\n    private static String setupHost(final String host) {\n        if (!host.contains(\"@\")) {\n            return DEFAULT_REF_TREE + \"@\" + host;\n        }\n\n        return host;\n    }\n\n    private static String setupPath(final String path) {\n        if (path.isEmpty()) {\n            return \"/\";\n        }\n        return path;\n    }\n\n    public String getRefTree() {\n        return host.substring(0,\n                              host.indexOf(\"@\"));\n    }\n\n    public String getPath() {\n        return new String(path);\n    }\n\n    public boolean isRegularFile()\n            throws IllegalAccessError, SecurityException {\n        try {\n            return getFileSystem().provider().readAttributes(this,\n                                                             BasicFileAttributes.class).isRegularFile();\n        } catch (IOException ioe) {\n        }\n        return false;\n    }\n\n    private static long internalCopy(final InputStream in,\n                                     final OutputStream out) {\n        long read = 0L;\n        byte[] buf = new byte[BUFFER_SIZE];\n        int n;\n        try {\n            while ((n = in.read(buf)) > 0) {\n                out.write(buf,\n                          0,\n                          n);\n                read += n;\n            }\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n        return read;\n    }\n\n    @Override\n    public String getSegmentId() {\n        return getRefTree();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactory.java",
    "content": "package org.uberfire.java.nio.fs.jgit;\n\nimport com.jcraft.jsch.Proxy;\nimport com.jcraft.jsch.ProxyHTTP;\nimport com.jcraft.jsch.ProxySOCKS4;\nimport com.jcraft.jsch.ProxySOCKS5;\nimport com.jcraft.jsch.Session;\nimport com.jcraft.jsch.UserInfo;\nimport org.eclipse.jgit.errors.UnsupportedCredentialItem;\nimport org.eclipse.jgit.transport.CredentialItem;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.CredentialsProviderUserInfo;\nimport org.eclipse.jgit.transport.OpenSshConfig;\nimport org.eclipse.jgit.transport.URIish;\n\npublic class JGitSSHConfigSessionFactory extends org.eclipse.jgit.transport.JschConfigSessionFactory {\n\n    private final JGitFileSystemProviderConfiguration config;\n\n    private static final String SOCK5PROXY = \"sock5\";\n    private static final String SOCK4PROXY = \"sock4\";\n\n    public JGitSSHConfigSessionFactory(final JGitFileSystemProviderConfiguration config) {\n        this.config = config;\n    }\n\n    @Override\n    protected void configure(final OpenSshConfig.Host hc,\n                             final Session session) {\n        final CredentialsProvider provider = new CredentialsProvider() {\n            @Override\n            public boolean isInteractive() {\n                return false;\n            }\n\n            @Override\n            public boolean supports(final CredentialItem... items) {\n                return true;\n            }\n\n            @Override\n            public boolean get(final URIish uri,\n                               final CredentialItem... items) throws UnsupportedCredentialItem {\n                for (CredentialItem item : items) {\n                    if (item instanceof CredentialItem.YesNoType) {\n                        ((CredentialItem.YesNoType) item).setValue(true);\n                    } else if (item instanceof CredentialItem.StringType) {\n                        ((CredentialItem.StringType) item).setValue(config.getSshPassphrase());\n                    }\n                }\n                return true;\n            }\n        };\n        final UserInfo userInfo = new CredentialsProviderUserInfo(session,\n                                                                  provider);\n        session.setUserInfo(userInfo);\n        if (config.isSshOverHttpProxy() || config.isSshOverHttpsProxy()) {\n            session.setProxy(buildProxy(config));\n        }\n    }\n\n    Proxy buildProxy(final JGitFileSystemProviderConfiguration config) {\n        Proxy proxy;\n        final String host;\n        final int port;\n        String user = null;\n        String passw = null;\n        if (config.isSshOverHttpProxy()) {\n            host = config.getHttpProxyHost();\n            port = config.getHttpProxyPort();\n            user = config.getHttpProxyUser();\n            passw = config.getHttpProxyPassword();\n        } else {\n            host = config.getHttpsProxyHost();\n            port = config.getHttpsProxyPort();\n            user = config.getHttpsProxyUser();\n            passw = config.getHttpsProxyPassword();\n        }\n        if (config.getProxyType().equalsIgnoreCase(SOCK5PROXY)) {\n            ProxySOCKS5 proxySOCKS5 = new ProxySOCKS5(host, port);\n            proxySOCKS5.setUserPasswd(user, passw);\n            proxy = proxySOCKS5;\n        } else if (config.getProxyType().equalsIgnoreCase(SOCK4PROXY)) {\n            ProxySOCKS4 proxySOCKS4 = new ProxySOCKS4(host, port);\n            proxySOCKS4.setUserPasswd(user, passw);\n            proxy = proxySOCKS4;\n        } else {\n            ProxyHTTP proxyHTTP = new ProxyHTTP(host, port);\n            proxyHTTP.setUserPasswd(user, passw);\n            proxy = proxyHTTP;\n        }\n        return proxy;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/JGitVersionAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.FileTimeImpl;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathType;\n\n/**\n *\n */\npublic class JGitVersionAttributeView extends VersionAttributeView<JGitPathImpl> {\n\n    private VersionAttributes attrs = null;\n\n    public JGitVersionAttributeView(final JGitPathImpl path) {\n        super(path);\n    }\n\n    @Override\n    public VersionAttributes readAttributes() throws IOException {\n        if (attrs == null) {\n            attrs = buildAttrs(path.getFileSystem(),\n                               path.getRefTree(),\n                               path.getPath());\n        }\n        return attrs;\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{VersionAttributeView.class, JGitVersionAttributeView.class};\n    }\n\n    private VersionAttributes buildAttrs(final JGitFileSystem fs,\n                                         final String branchName,\n                                         final String path) {\n        final PathInfo pathInfo = fs.getGit().getPathInfo(branchName,\n                                                          path);\n\n        if (pathInfo == null || pathInfo.getPathType().equals(PathType.NOT_FOUND)) {\n            throw new NoSuchFileException(path);\n        }\n\n        final Ref refId = fs.getGit().getRef(branchName);\n        final List<VersionRecord> records = new ArrayList<>();\n\n        if (refId != null) {\n            try {\n                final CommitHistory history = fs.getGit().listCommits(refId, pathInfo.getPath());\n                for (final RevCommit commit : history.getCommits()) {\n                    final String recordPath = history.trackedFileNameChangeFor(commit.getId());\n                    records.add(new VersionRecord() {\n                        @Override\n                        public String id() {\n                            return commit.name();\n                        }\n\n                        @Override\n                        public String author() {\n                            return commit.getAuthorIdent().getName();\n                        }\n\n                        @Override\n                        public String email() {\n                            return commit.getAuthorIdent().getEmailAddress();\n                        }\n\n                        @Override\n                        public String comment() {\n                            return commit.getFullMessage();\n                        }\n\n                        @Override\n                        public Date date() {\n                            return commit.getAuthorIdent().getWhen();\n                        }\n\n                        @Override\n                        public String uri() {\n                            return fs.getPath(commit.name(),\n                                              recordPath).toUri().toString();\n                        }\n                    });\n                }\n            } catch (Exception e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        Collections.reverse(records);\n\n        return new VersionAttributes() {\n            @Override\n            public VersionHistory history() {\n                return () -> records;\n            }\n\n            @Override\n            public FileTime lastModifiedTime() {\n                if (records.size() > 0) {\n                    return new FileTimeImpl(records.get(records.size() - 1).date().getTime());\n                }\n                return null;\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return lastModifiedTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                if (records.size() > 0) {\n                    return new FileTimeImpl(records.get(0).date().getTime());\n                }\n                return null;\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return pathInfo.getPathType().equals(PathType.FILE);\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return pathInfo.getPathType().equals(PathType.DIRECTORY);\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return false;\n            }\n\n            @Override\n            public boolean isOther() {\n                return false;\n            }\n\n            @Override\n            public long size() {\n                return pathInfo.getSize();\n            }\n\n            @Override\n            public Object fileKey() {\n                return pathInfo.getObjectId() == null ? null : pathInfo.getObjectId().toString();\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/NotificationModel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.eclipse.jgit.lib.ObjectId;\n\npublic class NotificationModel {\n\n    private final ObjectId originalHead;\n    private final String sessionId;\n    private final String userName;\n    private final String message;\n\n    public NotificationModel(final ObjectId originalHead,\n                             final String sessionId,\n                             final String userName,\n                             final String message) {\n        this.originalHead = originalHead;\n        this.sessionId = sessionId;\n        this.userName = userName;\n        this.message = message;\n    }\n\n    public ObjectId getOriginalHead() {\n        return originalHead;\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public String getUserName() {\n        return userName;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/common/PortUtil.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.common;\n\nimport java.io.IOException;\nimport java.net.ServerSocket;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class PortUtil {\n\n    private static final String ERROR_MESSAGE = \"Error trying to find a free port.\";\n    private static final Logger LOG = LoggerFactory.getLogger(PortUtil.class);\n\n    public static int validateOrGetNew(int preferredPort) {\n        if (preferredPort == 0 || isPortInUse(preferredPort)) {\n            if (preferredPort != 0) {\n                LOG.warn(\"Port {} already in use, system will automatically look for a new one.\", preferredPort);\n            }\n            try (ServerSocket ss = new ServerSocket(0)) {\n                return ss.getLocalPort();\n            } catch (IOException e) {\n                LOG.error(ERROR_MESSAGE, e);\n                throw new RuntimeException(ERROR_MESSAGE);\n            }\n        }\n        return preferredPort;\n    }\n\n    private static boolean isPortInUse(int port) {\n        try (final ServerSocket ss = new ServerSocket(port)) {\n            return false;\n        } catch (Exception e) {\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/filters/HiddenBranchRefFilter.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.filters;\n\nimport java.util.Map;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.transport.RefFilter;\n\n/**\n * This RefFilter is used to exclude hidden branches\n * from {@link org.eclipse.jgit.transport.UploadPack}.\n * Check {@link org.uberfire.java.nio.fs.jgit.daemon.git.Daemon}\n */\npublic class HiddenBranchRefFilter implements RefFilter {\n\n    private static final String HIDDEN_BRANCH_REGEXP = \"PR-\\\\d+-\\\\S+-\\\\S+\";\n    private static Pattern pattern = Pattern.compile(HIDDEN_BRANCH_REGEXP);\n\n    @Override\n    public Map<String, Ref> filter(final Map<String, Ref> refs) {\n        return refs.entrySet()\n                .stream()\n                .filter(ref -> !HiddenBranchRefFilter.isHidden(ref.getKey()))\n                .collect(Collectors.toMap(Map.Entry::getKey,\n                                          Map.Entry::getValue));\n    }\n\n    /**\n     * Checks if a branch name matches the hidden branch regexp\n     * @param branch the branch you want to check.\n     * @return return if the branch is hidden or not\n     */\n    public static boolean isHidden(String branch) {\n        return pattern.matcher(branch).matches();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/Daemon.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.git;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InterruptedIOException;\nimport java.io.OutputStream;\nimport java.net.InetAddress;\nimport java.net.InetSocketAddress;\nimport java.net.ServerSocket;\nimport java.net.Socket;\nimport java.net.SocketAddress;\nimport java.util.concurrent.Executor;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.zip.Deflater;\n\nimport org.eclipse.jgit.errors.RepositoryNotFoundException;\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.storage.pack.PackConfig;\nimport org.eclipse.jgit.transport.ServiceMayNotContinueException;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.eclipse.jgit.transport.resolver.RepositoryResolver;\nimport org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;\nimport org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;\nimport org.eclipse.jgit.transport.resolver.UploadPackFactory;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.java.nio.fs.jgit.daemon.filters.HiddenBranchRefFilter;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.fs.jgit.daemon.common.PortUtil.validateOrGetNew;\n\n/**\n * Basic daemon for the anonymous <code>git://</code> transport protocol.\n */\npublic class Daemon {\n\n    private static final Logger LOG = LoggerFactory.getLogger(Daemon.class);\n\n    private static final int BACKLOG = 5;\n\n    private InetSocketAddress myAddress;\n\n    private final DaemonService[] services;\n\n    private final AtomicBoolean run = new AtomicBoolean(false);\n\n    private int timeout;\n\n    private volatile RepositoryResolver<DaemonClient> repositoryResolver;\n\n    private volatile UploadPackFactory<DaemonClient> uploadPackFactory;\n\n    private ServerSocket listenSock = null;\n\n    private ExecutorService executorService;\n\n    private final Executor acceptThreadPool;\n\n    public Daemon(final InetSocketAddress addr,\n                  final Executor acceptThreadPool,\n                  final ExecutorService executorService) {\n        this(addr,\n             acceptThreadPool,\n             executorService,\n             null);\n    }\n\n    /**\n     * Configures a new daemon for the specified network address. The daemon will not attempt to bind to an address or\n     * accept connections until a call to {@link #start()}.\n     * @param addr address to listen for connections on. If null, any available port will be chosen on all network\n     * interfaces.\n     * @param acceptThreadPool source of threads for waiting for inbound socket connections. Every time the daemon is started or\n     * restarted, a new task will be submitted to this pool. When the daemon is stopped, the task completes.\n     */\n    public Daemon(final InetSocketAddress addr,\n                  final Executor acceptThreadPool,\n                  final ExecutorService executorService,\n                  final KetchLeaderCache leaders) {\n        myAddress = addr;\n        this.acceptThreadPool = checkNotNull(\"acceptThreadPool\",\n                                             acceptThreadPool);\n\n        this.executorService = executorService;\n\n        repositoryResolver = (RepositoryResolver<DaemonClient>) RepositoryResolver.NONE;\n\n        uploadPackFactory = (req, db) -> {\n            final UploadPack up = new UploadPack(db);\n            up.setTimeout(getTimeout());\n            up.setRefFilter(new HiddenBranchRefFilter());\n            final PackConfig config = new PackConfig(db);\n            config.setCompressionLevel(Deflater.BEST_COMPRESSION);\n            up.setPackConfig(config);\n\n            return up;\n        };\n\n        services = new DaemonService[]{new DaemonService(\"upload-pack\",\n                                                         \"uploadpack\") {\n            {\n                setEnabled(true);\n            }\n\n            @Override\n            protected void execute(final DaemonClient dc,\n                                   final Repository db) throws IOException,\n                    ServiceNotEnabledException,\n                    ServiceNotAuthorizedException {\n                final UploadPack up = uploadPackFactory.create(dc,\n                                                               db);\n                final InputStream in = dc.getInputStream();\n                final OutputStream out = dc.getOutputStream();\n                up.upload(in,\n                          out,\n                          null);\n            }\n        }, new DaemonService(\"receive-pack\",\n                             \"receivepack\") {\n            {\n                setEnabled(false);\n            }\n\n            @Override\n            protected void execute(final DaemonClient dc,\n                                   final Repository db) throws IOException,\n                    ServiceNotEnabledException,\n                    ServiceNotAuthorizedException {\n                throw new ServiceNotAuthorizedException();\n            }\n        }};\n    }\n\n    /**\n     * @return the address connections are received on.\n     */\n    public synchronized InetSocketAddress getAddress() {\n        return myAddress;\n    }\n\n    /**\n     * Lookup a supported service so it can be reconfigured.\n     * @param name name of the service; e.g. \"receive-pack\"/\"git-receive-pack\" or\n     * \"upload-pack\"/\"git-upload-pack\".\n     * @return the service; null if this daemon implementation doesn't support\n     * the requested service type.\n     */\n    public synchronized DaemonService getService(String name) {\n        if (!name.startsWith(\"git-\")) {\n            name = \"git-\" + name;\n        }\n        for (final DaemonService s : services) {\n            if (s.getCommandName().equals(name)) {\n                return s;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * @return timeout (in seconds) before aborting an IO operation.\n     */\n    public int getTimeout() {\n        return timeout;\n    }\n\n    /**\n     * Set the timeout before willing to abort an IO call.\n     * @param seconds number of seconds to wait (with no data transfer occurring)\n     * before aborting an IO read or write operation with the\n     * connected client.\n     */\n    public void setTimeout(final int seconds) {\n        timeout = seconds;\n    }\n\n    /**\n     * Sets the resolver that locates repositories by name.\n     * @param resolver the resolver instance.\n     */\n    public void setRepositoryResolver(RepositoryResolver<DaemonClient> resolver) {\n        repositoryResolver = resolver;\n    }\n\n    /**\n     * Sets the factory that constructs and configures the per-request UploadPack.\n     * @param factory the factory. If null upload-pack is disabled.\n     */\n    @SuppressWarnings(\"unchecked\")\n    public void setUploadPackFactory(UploadPackFactory<DaemonClient> factory) {\n        if (factory != null) {\n            uploadPackFactory = factory;\n        } else {\n            uploadPackFactory = (UploadPackFactory<DaemonClient>) UploadPackFactory.DISABLED;\n        }\n    }\n\n    /**\n     * Starts this daemon listening for connections on a thread supplied by the executor service given to the\n     * constructor. The daemon can be stopped by a call to {@link #stop()} or by shutting down the ExecutorService.\n     * @throws IOException the server socket could not be opened.\n     * @throws IllegalStateException the daemon is already running.\n     */\n    public synchronized void start() throws IOException {\n        if (run.get()) {\n            throw new IllegalStateException(JGitText.get().daemonAlreadyRunning);\n        }\n\n        InetAddress listenAddress = myAddress != null ? myAddress.getAddress() : null;\n        int listenPort = myAddress != null ? myAddress.getPort() : 0;\n\n        try {\n            this.listenSock = new ServerSocket(validateOrGetNew(listenPort),\n                                               BACKLOG,\n                                               listenAddress);\n        } catch (IOException e) {\n            throw new IOException(\"Failed to open server socket for \" + listenAddress + \":\" + listenPort, e);\n        }\n        if (listenSock.getLocalPort() != listenPort) {\n            LOG.error(\"Git original port {} not available, new free port {} assigned.\", listenPort, listenSock.getLocalPort());\n        }\n        myAddress = (InetSocketAddress) listenSock.getLocalSocketAddress();\n\n        run.set(true);\n        acceptThreadPool.execute(new DescriptiveRunnable() {\n            @Override\n            public String getDescription() {\n                return \"Git-Daemon-Accept\";\n            }\n\n            @Override\n            public void run() {\n                while (isRunning() && !Thread.currentThread().isInterrupted()) {\n                    try {\n                        listenSock.setSoTimeout(5000);\n                        startClient(listenSock.accept());\n                    } catch (InterruptedIOException e) {\n                        // Test again to see if we should keep accepting.\n                    } catch (IOException e) {\n                        break;\n                    }\n                }\n\n                stop();\n            }\n        });\n    }\n\n    /**\n     * @return true if this daemon is receiving connections.\n     */\n    public boolean isRunning() {\n        return run.get();\n    }\n\n    /**\n     * Stops this daemon. It is safe to call this method on a daemon which is already stopped, in which case the call\n     * has no effect.\n     */\n    public synchronized void stop() {\n        if (run.getAndSet(false)) {\n            try {\n                listenSock.close();\n            } catch (IOException e) {\n            }\n        }\n    }\n\n    private void startClient(final Socket s) {\n        final DaemonClient dc = new DaemonClient(this);\n\n        final SocketAddress peer = s.getRemoteSocketAddress();\n        if (peer instanceof InetSocketAddress) {\n            dc.setRemoteAddress(((InetSocketAddress) peer).getAddress());\n        }\n\n        executorService.execute(new DescriptiveRunnable() {\n            @Override\n            public String getDescription() {\n                return \"Git-Daemon-Client \" + peer.toString();\n            }\n\n            @Override\n            public void run() {\n                try {\n                    dc.execute(s);\n                } catch (ServiceNotEnabledException | ServiceNotAuthorizedException | IOException e) {\n                    // Ignored. Client cannot use this repository.\n                } finally {\n                    try {\n                        s.getInputStream().close();\n                    } catch (IOException e) {\n                        // Ignore close exceptions\n                    }\n                    try {\n                        s.getOutputStream().close();\n                    } catch (IOException e) {\n                        // Ignore close exceptions\n                    }\n                }\n            }\n        });\n    }\n\n    synchronized DaemonService matchService(final String cmd) {\n        for (final DaemonService d : services) {\n            if (d.handles(cmd)) {\n                return d;\n            }\n        }\n        return null;\n    }\n\n    Repository openRepository(DaemonClient client,\n                              String name)\n            throws ServiceMayNotContinueException {\n        // Assume any attempt to use \\ was by a Windows client\n        // and correct to the more typical / used in Git URIs.\n        //\n        name = name.replace('\\\\',\n                            '/');\n\n        // git://thishost/path should always be name=\"/path\" here\n        //\n        if (!name.startsWith(\"/\")) {\n            return null;\n        }\n\n        try {\n            return repositoryResolver.open(client,\n                                           name.substring(1));\n        } catch (RepositoryNotFoundException | ServiceNotAuthorizedException | ServiceNotEnabledException e) {\n            // null signals it \"wasn't found\", which is all that is suitable\n            // for the remote client to know.\n            return null;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/DaemonClient.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.git;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.InetAddress;\nimport java.net.Socket;\n\nimport org.eclipse.jgit.transport.PacketLineIn;\nimport org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;\nimport org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;\n\npublic class DaemonClient {\n\n    private final Daemon daemon;\n\n    private InetAddress peer;\n\n    private InputStream rawIn;\n\n    private OutputStream rawOut;\n\n    DaemonClient(final Daemon d) {\n        daemon = d;\n    }\n\n    void setRemoteAddress(final InetAddress ia) {\n        peer = ia;\n    }\n\n    /**\n     * @return the daemon which spawned this client.\n     */\n    public Daemon getDaemon() {\n        return daemon;\n    }\n\n    /**\n     * @return Internet address of the remote client.\n     */\n    public InetAddress getRemoteAddress() {\n        return peer;\n    }\n\n    /**\n     * @return input stream to read from the connected client.\n     */\n    public InputStream getInputStream() {\n        return rawIn;\n    }\n\n    /**\n     * @return output stream to send data to the connected client.\n     */\n    public OutputStream getOutputStream() {\n        return rawOut;\n    }\n\n    void execute(final Socket sock) throws IOException,\n            ServiceNotEnabledException, ServiceNotAuthorizedException {\n        rawIn = new BufferedInputStream(sock.getInputStream());\n        rawOut = new BufferedOutputStream(sock.getOutputStream());\n\n        if (0 < daemon.getTimeout()) {\n            sock.setSoTimeout(daemon.getTimeout() * 1000);\n        }\n        String cmd = new PacketLineIn(rawIn).readStringRaw();\n        final int nul = cmd.indexOf('\\0');\n        if (nul >= 0) {\n            // Newer clients hide a \"host\" header behind this byte.\n            // Currently we don't use it for anything, so we ignore\n            // this portion of the command.\n            //\n            cmd = cmd.substring(0,\n                                nul);\n        }\n\n        final DaemonService srv = getDaemon().matchService(cmd);\n        if (srv == null) {\n            return;\n        }\n        sock.setSoTimeout(0);\n        srv.execute(this,\n                    cmd);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/DaemonService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.git;\n\nimport java.io.IOException;\n\nimport org.eclipse.jgit.lib.Config;\nimport org.eclipse.jgit.lib.Config.SectionParser;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.PacketLineOut;\nimport org.eclipse.jgit.transport.ServiceMayNotContinueException;\nimport org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;\nimport org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;\n\npublic abstract class DaemonService {\n\n    private final String command;\n\n    private final SectionParser<ServiceConfig> configKey;\n\n    private boolean enabled;\n\n    private boolean overridable;\n\n    DaemonService(final String cmdName,\n                  final String cfgName) {\n        command = cmdName.startsWith(\"git-\") ? cmdName : \"git-\" + cmdName;\n        configKey = cfg -> new ServiceConfig(DaemonService.this,\n                                             cfg,\n                                             cfgName);\n        overridable = true;\n    }\n\n    private static class ServiceConfig {\n\n        final boolean enabled;\n\n        ServiceConfig(final DaemonService service,\n                      final Config cfg,\n                      final String name) {\n            enabled = cfg.getBoolean(\"daemon\",\n                                     name,\n                                     service.isEnabled());\n        }\n    }\n\n    /**\n     * @return is this service enabled for invocation?\n     */\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    /**\n     * @param on true to allow this service to be used; false to deny it.\n     */\n    public void setEnabled(final boolean on) {\n        enabled = on;\n    }\n\n    /**\n     * @return can this service be configured in the repository config file?\n     */\n    public boolean isOverridable() {\n        return overridable;\n    }\n\n    /**\n     * @param on true to permit repositories to override this service's enabled\n     * state with the <code>daemon.servicename</code> config setting.\n     */\n    public void setOverridable(final boolean on) {\n        overridable = on;\n    }\n\n    /**\n     * @return name of the command requested by clients.\n     */\n    public String getCommandName() {\n        return command;\n    }\n\n    /**\n     * Determine if this service can handle the requested command.\n     * @param commandLine input line from the client.\n     * @return true if this command can accept the given command line.\n     */\n    public boolean handles(final String commandLine) {\n        return command.length() + 1 < commandLine.length()\n                && commandLine.charAt(command.length()) == ' '\n                && commandLine.startsWith(command);\n    }\n\n    void execute(final org.uberfire.java.nio.fs.jgit.daemon.git.DaemonClient client,\n                 final String commandLine)\n            throws IOException, ServiceNotEnabledException,\n            ServiceNotAuthorizedException {\n        final String name = commandLine.substring(command.length() + 1);\n        Repository db;\n        try {\n            db = client.getDaemon().openRepository(client,\n                                                   name);\n        } catch (ServiceMayNotContinueException e) {\n            // An error when opening the repo means the client is expecting a ref\n            // advertisement, so use that style of error.\n            PacketLineOut pktOut = new PacketLineOut(client.getOutputStream());\n            pktOut.writeString(\"ERR \" + e.getMessage() + \"\\n\");\n            db = null;\n        }\n        if (db == null) {\n            return;\n        }\n        try {\n            if (isEnabledFor(db)) {\n                execute(client,\n                        db);\n            }\n        } finally {\n            db.close();\n        }\n    }\n\n    private boolean isEnabledFor(final Repository db) {\n        if (isOverridable()) {\n            return db.getConfig().get(configKey).enabled;\n        }\n        return isEnabled();\n    }\n\n    abstract void execute(org.uberfire.java.nio.fs.jgit.daemon.git.DaemonClient client,\n                          Repository db)\n            throws IOException, ServiceNotEnabledException,\n            ServiceNotAuthorizedException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/git/KetchCustomReceivePack.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.git;\n\nimport java.io.IOException;\nimport java.text.MessageFormat;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;\nimport org.eclipse.jgit.lib.BatchRefUpdate;\nimport org.eclipse.jgit.lib.NullProgressMonitor;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.RefDatabase;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.ReceivePack;\n\npublic class KetchCustomReceivePack extends ReceivePack {\n\n    public KetchCustomReceivePack(final Repository into) {\n        super(into);\n    }\n\n    @Override\n    public void setAdvertisedRefs(final Map<String, Ref> allRefs,\n                                  final Set<ObjectId> additionalHaves) {\n        super.setAdvertisedRefs(allRefs,\n                                additionalHaves);\n        final Map<String, Ref> refs = getAdvertisedRefs();\n        if (getRepository().getRefDatabase() instanceof RefTreeDatabase) {\n            final RefDatabase bootstrap = ((RefTreeDatabase) getRepository().getRefDatabase()).getBootstrap();\n            try {\n                for (Map.Entry<String, Ref> entry : bootstrap.getRefs(\"\").entrySet()) {\n                    refs.put(entry.getKey(),\n                             entry.getValue());\n                }\n            } catch (final IOException e) {\n                e.printStackTrace();\n            }\n        }\n    }\n\n    @Override\n    protected void executeCommands() {\n        if (getRepository().getRefDatabase() instanceof RefTreeDatabase) {\n            List<ReceiveCommand> toApply = filterCommands(ReceiveCommand.Result.NOT_ATTEMPTED);\n            if (toApply.isEmpty()) {\n                return;\n            }\n            final BatchRefUpdate batch = ((RefTreeDatabase) getRepository().getRefDatabase()).getBootstrap().newBatchUpdate();\n            batch.setAllowNonFastForwards(true);\n            batch.setAtomic(false);\n            batch.setRefLogIdent(getRefLogIdent());\n            batch.setRefLogMessage(\"push\",\n                                   true); //$NON-NLS-1$\n            batch.addCommand(toApply);\n            try {\n                batch.setPushCertificate(getPushCertificate());\n                batch.execute(getRevWalk(),\n                              NullProgressMonitor.INSTANCE);\n            } catch (IOException err) {\n                for (ReceiveCommand cmd : toApply) {\n                    if (cmd.getResult() == ReceiveCommand.Result.NOT_ATTEMPTED) {\n                        cmd.setResult(ReceiveCommand.Result.REJECTED_OTHER_REASON,\n                                      MessageFormat.format(\n                                              JGitText.get().lockError,\n                                              err.getMessage()));\n                    }\n                }\n            }\n        } else {\n            super.executeCommands();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupport.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.http;\n\nimport java.net.URI;\n\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletContextListener;\nimport javax.servlet.ServletRegistration;\nimport javax.servlet.annotation.WebListener;\n\nimport org.eclipse.jgit.http.server.GitServlet;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\n\n@WebListener\npublic class HTTPSupport implements ServletContextListener {\n\n    private static final String GIT_PATH = \"git\";\n    private static final Logger LOG = LoggerFactory.getLogger(HTTPSupport.class);\n\n    private ServletContext servletContext = null;\n\n    @Override\n    public void contextInitialized(ServletContextEvent sce) {\n        servletContext = sce.getServletContext();\n        final JGitFileSystemProvider fsProvider = resolveProvider();\n        if (fsProvider != null && (fsProvider.getConfig().isHttpEnabled() || fsProvider.getConfig().isHttpsEnabled())) {\n            if (fsProvider.getConfig().isHttpEnabled()) {\n                fsProvider.addHostName(\"http\", fsProvider.getConfig().getHttpHostName() + \":\" + fsProvider.getConfig().getHttpPort() + servletContext.getContextPath() + \"/\" + GIT_PATH);\n            }\n            if (fsProvider.getConfig().isHttpsEnabled()) {\n                fsProvider.addHostName(\"https\",\n                                       fsProvider.getConfig().getHttpsHostName() + \":\" + fsProvider.getConfig().getHttpsPort() + servletContext.getContextPath() + \"/\" + GIT_PATH);\n            }\n            fsProvider.updateCacheWithHostNames();\n            final GitServlet gitServlet = new GitServlet();\n            gitServlet.setRepositoryResolver(fsProvider.getRepositoryResolver());\n            gitServlet.setAsIsFileService(null);\n            gitServlet.setReceivePackFactory((req, db) -> fsProvider.getReceivePack(\"http\", req, db));\n            ServletRegistration.Dynamic sd = servletContext.addServlet(\"GitServlet\", gitServlet);\n            sd.addMapping(\"/\" + GIT_PATH + \"/*\");\n            sd.setLoadOnStartup(1);\n            sd.setAsyncSupported(false);\n        }\n    }\n\n    @Override\n    public void contextDestroyed(ServletContextEvent sce) {\n        servletContext = null;\n    }\n\n    protected JGitFileSystemProvider resolveProvider() {\n        try {\n            return (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(JGitFileSystemProviderConfiguration.SCHEME + \"://whatever\"));\n        } catch (Exception ex) {\n            LOG.error(\"Error trying to resolve JGitFileSystemProvider.\", ex);\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/BaseGitCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.daemon.ssh;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.concurrent.ExecutorService;\n\nimport org.apache.sshd.common.channel.ChannelOutputStream;\nimport org.apache.sshd.common.session.Session;\nimport org.apache.sshd.server.command.Command;\nimport org.apache.sshd.server.Environment;\nimport org.apache.sshd.server.ExitCallback;\nimport org.apache.sshd.server.session.ServerSessionAware;\nimport org.apache.sshd.server.channel.ChannelSession;\nimport org.apache.sshd.server.session.ServerSession;\nimport org.eclipse.jgit.errors.RepositoryNotFoundException;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.ServiceMayNotContinueException;\nimport org.eclipse.jgit.transport.resolver.RepositoryResolver;\nimport org.eclipse.jgit.transport.resolver.ServiceNotAuthorizedException;\nimport org.eclipse.jgit.transport.resolver.ServiceNotEnabledException;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\n\npublic abstract class BaseGitCommand implements Command,\n                                                ServerSessionAware,\n                                                Runnable {\n\n    public final static Session.AttributeKey<User> SUBJECT_KEY = new Session.AttributeKey<User>();\n\n    protected final String command;\n    protected final String repositoryName;\n    protected final RepositoryResolver repositoryResolver;\n    private final ExecutorService executorService;\n\n    private InputStream in;\n    private OutputStream out;\n    private OutputStream err;\n    private ExitCallback callback;\n    private User user;\n\n    public BaseGitCommand(final String command,\n                          final JGitFileSystemProvider.RepositoryResolverImpl repositoryResolver,\n                          final ExecutorService executorService) {\n        this.command = command;\n        this.repositoryName = buildRepositoryName(command);\n        this.repositoryResolver = repositoryResolver;\n        this.executorService = executorService;\n    }\n\n    private String buildRepositoryName(String command) {\n        int start = getCommandName().length() + 2;\n        final String temp = command.substring(start);\n        return temp.substring(0,\n                              temp.indexOf(\"'\"));\n    }\n\n    protected abstract String getCommandName();\n\n    @Override\n    public void setInputStream(InputStream in) {\n        this.in = in;\n    }\n\n    @Override\n    public void setOutputStream(OutputStream out) {\n        this.out = out;\n        if (out instanceof ChannelOutputStream) {\n            ((ChannelOutputStream) out).setNoDelay(true);\n        }\n    }\n\n    @Override\n    public void setErrorStream(OutputStream err) {\n        this.err = err;\n        if (err instanceof ChannelOutputStream) {\n            ((ChannelOutputStream) err).setNoDelay(true);\n        }\n    }\n\n    @Override\n    public void setExitCallback(ExitCallback callback) {\n        this.callback = callback;\n    }\n\n    @Override\n    public void start(final ChannelSession channel, final Environment env) throws IOException {\n        executorService.execute(new DescriptiveRunnable() {\n            @Override\n            public String getDescription() {\n                return \"Git Command [\" + getClass().getName() + \"]\";\n            }\n\n            @Override\n            public void run() {\n                BaseGitCommand.this.run();\n            }\n        });\n    }\n\n    @Override\n    public void run() {\n        try {\n            final Repository repository = openRepository(repositoryName);\n            execute(repository, in, out, err);\n        } catch (final Throwable e) {\n            try {\n                err.write(e.getMessage().getBytes());\n            } catch (IOException ignored) {\n            }\n        }\n        if (callback != null) {\n            callback.onExit(0);\n        }\n    }\n\n    private Repository openRepository(String name) throws ServiceMayNotContinueException {\n        // Assume any attempt to use \\ was by a Windows client\n        // and correct to the more typical / used in Git URIs.\n        //\n        name = name.replace('\\\\',\n                            '/');\n\n        // git://thishost/path should always be name=\"/path\" here\n        //\n        if (!name.startsWith(\"/\")) {\n            return null;\n        }\n\n        try {\n            return repositoryResolver.open(this,\n                                           name.substring(1));\n        } catch (RepositoryNotFoundException e) {\n            // null signals it \"wasn't found\", which is all that is suitable\n            // for the remote client to know.\n            return null;\n        } catch (ServiceNotAuthorizedException e) {\n            // null signals it \"wasn't found\", which is all that is suitable\n            // for the remote client to know.\n            return null;\n        } catch (ServiceNotEnabledException e) {\n            // null signals it \"wasn't found\", which is all that is suitable\n            // for the remote client to know.\n            return null;\n        }\n    }\n\n    protected abstract void execute(final Repository repository,\n                                    final InputStream in,\n                                    final OutputStream out,\n                                    final OutputStream err);\n\n    @Override\n    public void destroy(ChannelSession channel) throws Exception {\n        // empty\n    }\n\n    public User getUser() {\n        return user;\n    }\n\n    @Override\n    public void setSession(final ServerSession session) {\n        this.user = session.getAttribute(BaseGitCommand.SUBJECT_KEY);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitReceiveCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.ssh;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.concurrent.ExecutorService;\n\nimport org.apache.sshd.server.Environment;\nimport org.apache.sshd.server.channel.ChannelSession;\nimport org.eclipse.jgit.api.Git;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.ReceivePack;\nimport org.eclipse.jgit.transport.resolver.ReceivePackFactory;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\n\npublic class GitReceiveCommand extends BaseGitCommand {\n\n    private final ReceivePackFactory<BaseGitCommand> receivePackFactory;\n\n    public GitReceiveCommand(final String command,\n                             final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,\n                             final ReceivePackFactory<BaseGitCommand> receivePackFactory,\n                             final ExecutorService executorService) {\n        super(command,\n              repositoryResolver,\n              executorService);\n        this.receivePackFactory = receivePackFactory;\n    }\n\n    @Override\n    protected String getCommandName() {\n        return \"git-receive-pack\";\n    }\n\n    @Override\n    protected void execute(final Repository repository,\n                           final InputStream in,\n                           final OutputStream out,\n                           final OutputStream err) {\n        try {\n            final ReceivePack rp = receivePackFactory.create(this, repository);\n            rp.receive(in, out, err);\n            rp.setPostReceiveHook((rp1, commands) -> {\n                new Git(repository).gc();\n            });\n        } catch (final Exception ignored) {\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitSSHService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.ssh;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.InetSocketAddress;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.ExecutorService;\nimport java.util.stream.Collectors;\n\nimport org.apache.sshd.common.NamedFactory;\nimport org.apache.sshd.common.cipher.BuiltinCiphers;\nimport org.apache.sshd.common.cipher.Cipher;\nimport org.apache.sshd.common.mac.BuiltinMacs;\nimport org.apache.sshd.common.mac.Mac;\nimport org.apache.sshd.common.util.security.SecurityUtils;\nimport org.apache.sshd.core.CoreModuleProperties;\nimport org.apache.sshd.server.SshServer;\nimport org.apache.sshd.server.auth.pubkey.CachingPublicKeyAuthenticator;\nimport org.apache.sshd.server.keyprovider.AbstractGeneratorHostKeyProvider;\nimport org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;\nimport org.apache.sshd.server.shell.UnknownCommand;\nimport org.eclipse.jgit.transport.resolver.ReceivePackFactory;\nimport org.eclipse.jgit.transport.resolver.UploadPackFactory;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.security.SSHAuthenticator;\n\nimport static org.apache.sshd.common.BaseBuilder.setUpDefaultCiphers;\nimport static org.apache.sshd.common.BaseBuilder.setUpDefaultMacs;\nimport static org.apache.sshd.server.ServerBuilder.builder;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.fs.jgit.daemon.common.PortUtil.validateOrGetNew;\n\npublic class GitSSHService {\n\n    private static final Logger LOG = LoggerFactory.getLogger(GitSSHService.class);\n    private SshServer sshd;\n    private AuthenticationService authenticationService;\n    private SSHAuthenticator sshAuthenticator;\n\n    private SshServer buildSshServer(String ciphersConfigured,\n                                     String macsConfigured) {\n\n        return builder()\n                .cipherFactories(checkAndSetGitCiphers(ciphersConfigured))\n                .macFactories(checkAndSetGitMacs(macsConfigured))\n                .build();\n    }\n\n    public void setup(final File certDir,\n                      final InetSocketAddress inetSocketAddress,\n                      final String sshIdleTimeout,\n                      final String algorithm,\n                      final ReceivePackFactory receivePackFactory,\n                      final UploadPackFactory uploadPackFactory,\n                      final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,\n                      final ExecutorService executorService) {\n        setup(certDir, inetSocketAddress, sshIdleTimeout, algorithm, receivePackFactory, uploadPackFactory, repositoryResolver, executorService, null, null);\n    }\n\n    public void setup(final File certDir,\n                      final InetSocketAddress inetSocketAddress,\n                      final String sshIdleTimeout,\n                      final String algorithm,\n                      final ReceivePackFactory receivePackFactory,\n                      final UploadPackFactory uploadPackFactory,\n                      final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,\n                      final ExecutorService executorService,\n                      final String gitSshCiphers,\n                      final String gitSshMacs) {\n        checkNotNull(\"certDir\",\n                     certDir);\n        checkNotEmpty(\"sshIdleTimeout\",\n                      sshIdleTimeout);\n        checkNotEmpty(\"algorithm\",\n                      algorithm);\n        checkNotNull(\"receivePackFactory\",\n                     receivePackFactory);\n        checkNotNull(\"uploadPackFactory\",\n                     uploadPackFactory);\n        checkNotNull(\"repositoryResolver\",\n                     repositoryResolver);\n\n        buildSSHServer(gitSshCiphers,\n                       gitSshMacs);\n\n        sshd.getProperties().put(CoreModuleProperties.IDLE_TIMEOUT.getName(), sshIdleTimeout);\n\n        if (inetSocketAddress != null) {\n            sshd.setHost(inetSocketAddress.getHostName());\n            sshd.setPort(validateOrGetNew(inetSocketAddress.getPort()));\n\n            if (inetSocketAddress.getPort() != sshd.getPort()) {\n                LOG.error(\"SSH for Git original port {} not available, new free port {} assigned.\", inetSocketAddress.getPort(), sshd.getPort());\n            }\n        }\n\n        if (!certDir.exists()) {\n            certDir.mkdirs();\n        }\n\n        final AbstractGeneratorHostKeyProvider keyPairProvider = new SimpleGeneratorHostKeyProvider(certDir.toPath().resolve(\"hostkey.ser\"));\n\n        try {\n            SecurityUtils.getKeyPairGenerator(algorithm);\n            keyPairProvider.setAlgorithm(algorithm);\n        } catch (final Exception ignore) {\n            throw new RuntimeException(String.format(\"Can't use '%s' algorithm for ssh key pair generator.\",\n                                                     algorithm),\n                                       ignore);\n        }\n\n        sshd.setKeyPairProvider(keyPairProvider);\n        sshd.setCommandFactory((channel, command) -> {\n            if (command.startsWith(\"git-upload-pack\")) {\n                return new GitUploadCommand(command,\n                                            repositoryResolver,\n                                            uploadPackFactory,\n                                            executorService);\n            } else if (command.startsWith(\"git-receive-pack\")) {\n                return new GitReceiveCommand(command,\n                                             repositoryResolver,\n                                             receivePackFactory,\n                                             executorService);\n            } else {\n                return new UnknownCommand(command);\n            }\n        });\n        sshd.setPublickeyAuthenticator(new CachingPublicKeyAuthenticator((username, key, session) -> {\n\n            final User user = getSshAuthenticator().authenticate(username, key);\n\n            if (user == null) {\n                return false;\n            }\n\n            session.setAttribute(BaseGitCommand.SUBJECT_KEY, user);\n\n            return true;\n        }));\n        sshd.setPasswordAuthenticator((username, password, session) -> {\n\n            final User user = getUserPassAuthenticator().login(username, password);\n\n            if (user == null) {\n                return false;\n            }\n\n            session.setAttribute(BaseGitCommand.SUBJECT_KEY, user);\n            return true;\n        });\n    }\n\n    private void buildSSHServer(String gitSshCiphers,\n                                String gitSshMacs) {\n        sshd = buildSshServer(gitSshCiphers, gitSshMacs);\n    }\n\n    private List<NamedFactory<Cipher>> checkAndSetGitCiphers(String gitSshCiphers) {\n\n        if (gitSshCiphers == null || gitSshCiphers.isEmpty()) {\n            return setUpDefaultCiphers(true);\n        } else {\n            return Arrays.asList(gitSshCiphers.split(\",\"))\n                    .stream()\n                    .map(c -> BuiltinCiphers.fromFactoryName(c.trim().toLowerCase()))\n                    .filter(c -> c != null)\n                    .collect(Collectors.toList());\n        }\n    }\n\n    private List<NamedFactory<Mac>> checkAndSetGitMacs(String gitSshMacs) {\n\n        if (gitSshMacs == null || gitSshMacs.isEmpty()) {\n            return setUpDefaultMacs(true);\n        } else {\n            return Arrays.asList(gitSshMacs.split(\",\"))\n                    .stream()\n                    .map(m -> BuiltinMacs.fromFactoryName(m.trim().toLowerCase()))\n                    .filter(c -> c != null)\n                    .collect(Collectors.toList());\n        }\n    }\n\n    public void stop() {\n        try {\n            sshd.stop(true);\n        } catch (IOException ignored) {\n        }\n    }\n\n    public void start() {\n        try {\n            sshd.start();\n        } catch (IOException e) {\n            throw new RuntimeException(\"Couldn't start SSH daemon at \" + sshd.getHost() + \":\" + sshd.getPort(),\n                                       e);\n        }\n    }\n\n    public boolean isRunning() {\n        return !(sshd.isClosed() || sshd.isClosing());\n    }\n\n    SshServer getSshServer() {\n        return sshd;\n    }\n\n    public Map<String, Object> getProperties() {\n        return Collections.unmodifiableMap(sshd.getProperties());\n    }\n\n    public AuthenticationService getUserPassAuthenticator() {\n        return authenticationService;\n    }\n\n    public void setUserPassAuthenticator(AuthenticationService authenticationService) {\n        this.authenticationService = authenticationService;\n    }\n\n    public SSHAuthenticator getSshAuthenticator() {\n        return sshAuthenticator;\n    }\n\n    public void setSshAuthenticator(SSHAuthenticator sshAuthenticator) {\n        this.sshAuthenticator = sshAuthenticator;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitUploadCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.ssh;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.concurrent.ExecutorService;\nimport java.util.zip.Deflater;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.storage.pack.PackConfig;\nimport org.eclipse.jgit.transport.RefFilter;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.eclipse.jgit.transport.resolver.UploadPackFactory;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.daemon.filters.HiddenBranchRefFilter;\n\npublic class GitUploadCommand extends BaseGitCommand {\n\n    private UploadPackFactory<BaseGitCommand> uploadPackFactory;\n\n    public GitUploadCommand(final String command,\n                            final JGitFileSystemProvider.RepositoryResolverImpl<BaseGitCommand> repositoryResolver,\n                            final UploadPackFactory uploadPackFactory,\n                            final ExecutorService executorService) {\n        super(command,\n              repositoryResolver,\n              executorService);\n        this.uploadPackFactory = uploadPackFactory;\n    }\n\n    @Override\n    protected String getCommandName() {\n        return \"git-upload-pack\";\n    }\n\n    @Override\n    protected void execute(final Repository repository,\n                           final InputStream in,\n                           final OutputStream out,\n                           final OutputStream err) {\n        try {\n            final UploadPack up = uploadPackFactory.create(this,\n                                                           repository);\n\n            final PackConfig config = new PackConfig(repository);\n            config.setCompressionLevel(Deflater.BEST_COMPRESSION);\n            up.setPackConfig(config);\n\n            if (up.getRefFilter() == RefFilter.DEFAULT) {\n                up.setRefFilter(new HiddenBranchRefFilter());\n            }\n\n            up.upload(in,\n                      out,\n                      err);\n        } catch (final Exception ignored) {\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/exceptions/FileSystemLockException.java",
    "content": "package org.uberfire.java.nio.fs.jgit.exceptions;\n\npublic class FileSystemLockException extends RuntimeException {\n\n    public FileSystemLockException(String message) {\n        super(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/manager/JGitFileSystemsCache.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Supplier;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProxy;\n\npublic class JGitFileSystemsCache {\n\n    //supplier for creation of new fs\n    final Map<String, Supplier<JGitFileSystem>> fileSystemsSuppliers = new ConcurrentHashMap<>();\n\n    //limited amount of real instances of FS\n    final Map<String, Supplier<JGitFileSystem>> memoizedSuppliers;\n\n    public JGitFileSystemsCache(JGitFileSystemProviderConfiguration config) {\n\n        memoizedSuppliers = JGitFileSystemsCacheDataStructure.create(config);\n    }\n\n    public void addSupplier(String fsKey,\n                            Supplier<JGitFileSystem> createFSSupplier) {\n        PortablePreconditions.checkNotNull(\"fsKey\",\n                                           fsKey);\n        PortablePreconditions.checkNotNull(\"fsSupplier\",\n                                           createFSSupplier);\n\n        fileSystemsSuppliers.putIfAbsent(fsKey,\n                                         createFSSupplier);\n        createMemoizedSupplier(fsKey,\n                               createFSSupplier);\n    }\n\n    public void replaceSupplier(String fsKey,\n                                Supplier<JGitFileSystem> fsSupplier) {\n        PortablePreconditions.checkNotNull(\"fsKey\",\n                                           fsKey);\n        PortablePreconditions.checkNotNull(\"fsSupplier\",\n                                           fsSupplier);\n\n        fileSystemsSuppliers.replace(fsKey,\n                                     fsSupplier);\n        memoizedSuppliers.replace(fsKey,\n                                  fsSupplier);\n    }\n\n    public void remove(String fsName) {\n        fileSystemsSuppliers.remove(fsName);\n        memoizedSuppliers.remove(fsName);\n    }\n\n    public JGitFileSystem get(String fsName) {\n\n        Supplier<JGitFileSystem> memoizedSupplier = memoizedSuppliers.get(fsName);\n        if (memoizedSupplier != null) {\n            return new JGitFileSystemProxy(fsName,\n                                           memoizedSupplier);\n        } else if (fileSystemsSuppliers.get(fsName) != null) {\n            Supplier<JGitFileSystem> newMemoizedSupplier = createMemoizedSupplier(fsName,\n                                                                                  fileSystemsSuppliers.get(fsName));\n            return new JGitFileSystemProxy(fsName,\n                                           newMemoizedSupplier);\n        }\n        return null;\n    }\n\n    private Supplier<JGitFileSystem> createMemoizedSupplier(String fsKey,\n                                                            Supplier<JGitFileSystem> createFSSupplier) {\n        Supplier<JGitFileSystem> memoizedFSSupplier = MemoizedFileSystemsSupplier.of(createFSSupplier);\n        memoizedSuppliers.putIfAbsent(fsKey,\n                                      memoizedFSSupplier);\n        return memoizedFSSupplier;\n    }\n\n    public void clear() {\n        memoizedSuppliers.clear();\n        fileSystemsSuppliers.clear();\n    }\n\n    public boolean containsKey(String fsName) {\n        return fileSystemsSuppliers.containsKey(fsName);\n    }\n\n    public Collection<String> getFileSystems() {\n        return fileSystemsSuppliers.keySet();\n    }\n\n    public JGitFileSystemsCacheInfo getCacheInfo() {\n        return new JGitFileSystemsCacheInfo();\n    }\n\n    public class JGitFileSystemsCacheInfo {\n\n        public int fileSystemsCacheSize() {\n            return memoizedSuppliers.size();\n        }\n\n        public Set<String> memoizedFileSystemsCacheKeys() {\n            return memoizedSuppliers.keySet();\n        }\n\n        @Override\n        public String toString() {\n            return \"JGitFileSystemsCacheInfo{fileSystemsCacheSize[\" + fileSystemsCacheSize() + \"], memoizedFileSystemsCacheKeys[\" + memoizedFileSystemsCacheKeys() + \"]}\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/manager/JGitFileSystemsCacheDataStructure.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Supplier;\n\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\n\npublic class JGitFileSystemsCacheDataStructure {\n\n    public static Map<String, Supplier<JGitFileSystem>> create(JGitFileSystemProviderConfiguration config) {\n\n        return Collections.synchronizedMap(new LinkedHashMap<String, Supplier<JGitFileSystem>>(config.getJgitFileSystemsInstancesCache() + 1,\n                                                                                               0.75f,\n                                                                                               true) {\n\n            //prevent infinite loop if all FS instances are in use\n            private Integer removeEldestEntryIterations = 0;\n\n            @Override\n            public Supplier<JGitFileSystem> putIfAbsent(String key, Supplier<JGitFileSystem> value) {\n                Supplier<JGitFileSystem> jGitFileSystemSupplier = super.putIfAbsent(key, value);\n                if (size() > config.getJgitFileSystemsInstancesCache()) {\n                    fitListToCacheSize();\n                }\n                return jGitFileSystemSupplier;\n            }\n\n            private void fitListToCacheSize() {\n                List<String> itemsToRemove = new ArrayList<>();\n                int maxIterations = config.getJgitCacheOverflowCleanupSize();\n                Object[] entries =  this.entrySet().toArray();\n                for (int i = this.size() - 1; (i >= 0 && (this.size() - i < maxIterations)); i--) {\n                    Map.Entry<String, Supplier<JGitFileSystem>> entry = (Map.Entry) entries[i];\n                    JGitFileSystem targetFS = (JGitFileSystem) ((MemoizedFileSystemsSupplier) entry.getValue()).get();\n                    if (!targetFS.hasBeenInUse()) {\n                        itemsToRemove.add(entry.getKey());\n                    }\n                }\n                itemsToRemove.forEach(item -> this.remove(item));\n            }\n\n            @Override\n            public boolean removeEldestEntry(Map.Entry eldest) {\n                if (removeEldestEntryIterations > config.getJgitRemoveEldestEntryIterations()) {\n                    removeEldestEntryIterations = 0;\n                    return false;\n                }\n                if (size() > config.getJgitFileSystemsInstancesCache()) {\n                    JGitFileSystem targetFS = (JGitFileSystem) ((MemoizedFileSystemsSupplier) eldest.getValue()).get();\n                    if (targetFS.hasBeenInUse()) {\n                        removeEldestEntryIterations++;\n                        this.remove(eldest.getKey());\n                        this.put((String) eldest.getKey(), (MemoizedFileSystemsSupplier) eldest.getValue());\n                        return false;\n                    } else {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/manager/JGitFileSystemsManager.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Supplier;\nimport java.util.stream.Collectors;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitFileSystemsEventsManager;\n\nimport static org.eclipse.jgit.lib.Constants.DOT_GIT_EXT;\n\npublic class JGitFileSystemsManager {\n\n    private final Set<String> closedFileSystems = new HashSet<>();\n\n    private final Set<String> fileSystemsRoot = new HashSet<>();\n\n    private final JGitFileSystemProvider jGitFileSystemProvider;\n\n    private final JGitFileSystemsCache fsCache;\n\n    private final JGitFileSystemProviderConfiguration config;\n\n    final Map<String, JGitFileSystemLock> fileSystemsLocks = new ConcurrentHashMap<>();\n\n    public JGitFileSystemsManager(final JGitFileSystemProvider jGitFileSystemProvider,\n                                  final JGitFileSystemProviderConfiguration config) {\n        this.jGitFileSystemProvider = jGitFileSystemProvider;\n        this.config = config;\n        this.fsCache = new JGitFileSystemsCache(config);\n    }\n\n    public void newFileSystem(Supplier<Map<String, String>> fullHostNames,\n                              Supplier<Git> git,\n                              Supplier<String> fsName,\n                              Supplier<CredentialsProvider> credential,\n                              Supplier<JGitFileSystemsEventsManager> fsManager,\n                              Supplier<Map<FileSystemHooks, ?>> fsHooks) {\n\n        Supplier<JGitFileSystem> fsSupplier = createFileSystemSupplier(fullHostNames,\n                                                                       git,\n                                                                       fsName,\n                                                                       credential,\n                                                                       fsManager,\n                                                                       fsHooks);\n\n        fsCache.addSupplier(fsName.get(),\n                            fsSupplier);\n        fileSystemsRoot.addAll(parseFSRoots(fsName.get()));\n    }\n\n    public void updateFSCacheEntry(String fsKey, JGitFileSystem jGitFileSystem) {\n        if (getFsCache().containsKey(fsKey)) {\n            fsCache.replaceSupplier(fsKey, () -> jGitFileSystem);\n        }\n    }\n\n    List<String> parseFSRoots(String fsKey) {\n        List<String> roots = new ArrayList<>();\n        fsKey = cleanupFsName(fsKey);\n        int index = fsKey.indexOf(\"/\");\n        while (index >= 0) {\n            roots.add(fsKey.substring(0,\n                                      index));\n            index = fsKey.indexOf(\"/\",\n                                  index + 1);\n        }\n        roots.add(fsKey);\n        return roots;\n    }\n\n    private String cleanupFsName(String fsKey) {\n        if (fsKey.startsWith(\"/\")) {\n            fsKey = fsKey.substring(1);\n        }\n        if (fsKey.endsWith(\"/\")) {\n            fsKey = fsKey.substring(0,\n                                    fsKey.length() - 1);\n        }\n\n        return fsKey;\n    }\n\n    private Supplier<JGitFileSystem> createFileSystemSupplier(Supplier<Map<String, String>> fullHostNames,\n                                                              Supplier<Git> git,\n                                                              Supplier<String> fsName,\n                                                              Supplier<CredentialsProvider> credential,\n                                                              Supplier<JGitFileSystemsEventsManager> fsManager,\n                                                              Supplier<Map<FileSystemHooks, ?>> fsHooks) {\n\n        return () -> newFileSystem(fullHostNames.get(),\n                                   git.get(),\n                                   fsName.get(),\n                                   credential.get(),\n                                   fsManager.get(),\n                                   fsHooks.get());\n    }\n\n    private JGitFileSystem newFileSystem(Map<String, String> fullHostNames,\n                                         Git git,\n                                         String fsName,\n                                         CredentialsProvider credential,\n                                         JGitFileSystemsEventsManager fsEventsManager,\n                                         Map<FileSystemHooks, ?> fsHooks) {\n        fileSystemsLocks.putIfAbsent(fsName, createLock(git));\n        final JGitFileSystem fs = new JGitFileSystemImpl(jGitFileSystemProvider,\n                                                         fullHostNames,\n                                                         git,\n                                                         fileSystemsLocks.get(fsName),\n                                                         fsName,\n                                                         credential,\n                                                         fsEventsManager,\n                                                         fsHooks);\n\n        fs.getGit().gc();\n\n        return fs;\n    }\n\n    JGitFileSystemLock createLock(Git git) {\n        return new JGitFileSystemLock(git, config.getDefaultJgitCacheEvictThresholdTimeUnit(),\n                                      config.getJgitCacheEvictThresholdDuration());\n    }\n\n    public void remove(String realFSKey) {\n        fsCache.remove(realFSKey);\n        fileSystemsRoot.remove(realFSKey);\n        closedFileSystems.remove(realFSKey);\n    }\n\n    public JGitFileSystem get(String fsName) {\n        return fsCache.get(fsName);\n    }\n\n    public void clear() {\n        fsCache.clear();\n        closedFileSystems.clear();\n        fileSystemsRoot.clear();\n    }\n\n    public boolean containsKey(String fsName) {\n\n        return fsCache.getFileSystems().contains(fsName) && !closedFileSystems.contains(fsName);\n    }\n\n    public boolean containsRoot(String fsName) {\n        return fileSystemsRoot.contains(fsName);\n    }\n\n    public void addClosedFileSystems(JGitFileSystem fileSystem) {\n        String realFSKey = fileSystem.getName();\n        closedFileSystems.add(realFSKey);\n        fileSystemsRoot.remove(fileSystem.getName());\n    }\n\n    public boolean allTheFSAreClosed() {\n        return closedFileSystems.size() == fsCache.getFileSystems().size();\n    }\n\n    public JGitFileSystem get(Repository db) {\n        String key = extractFSNameFromRepo(db);\n        return fsCache.get(key);\n    }\n\n    public Set<JGitFileSystem> getOpenFileSystems() {\n        return fsCache.getFileSystems().stream().filter(fsName -> !closedFileSystems.contains(fsName))\n                .map(fsName -> get(fsName)).collect(Collectors.toSet());\n    }\n\n    public JGitFileSystemsCache getFsCache() {\n        return fsCache;\n    }\n\n    private String extractFSNameFromRepo(Repository db) {\n        final String fullRepoName = config.getGitReposParentDir().toPath().relativize(db.getDirectory().toPath()).toString();\n        return fullRepoName.substring(0, fullRepoName.indexOf(DOT_GIT_EXT)).replace('\\\\', '/');\n    }\n\n    Set<String> getClosedFileSystems() {\n        return closedFileSystems;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/manager/MemoizedFileSystemsSupplier.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\nimport java.util.function.Supplier;\n\npublic class MemoizedFileSystemsSupplier<T> implements Supplier<T> {\n\n    final Supplier<T> delegate;\n    ConcurrentMap<Class<?>, T> map = new ConcurrentHashMap<>(1);\n\n    private MemoizedFileSystemsSupplier(Supplier<T> delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public T get() {\n\n        T t = this.map.computeIfAbsent(MemoizedFileSystemsSupplier.class,\n                                       k -> this.delegate.get());\n        return t;\n    }\n\n    public static <T> Supplier<T> of(Supplier<T> provider) {\n        return new MemoizedFileSystemsSupplier<>(provider);\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/Git.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.internal.ketch.KetchLeader;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Fork;\nimport org.uberfire.java.nio.fs.jgit.util.commands.SubdirectoryClone;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\n\npublic interface Git {\n\n    static Git createRepository(final File repoDir) {\n        return createRepository(repoDir,\n                                null,\n                                JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    static Git createRepository(final File repoDir,\n                                final boolean sslVerify) {\n        return createRepository(repoDir,\n                                null,\n                                sslVerify);\n    }\n\n    static Git createRepository(final File repoDir,\n                                final File hookDir) {\n        return createRepository(repoDir,\n                                hookDir,\n                                null,\n                                JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    static Git createRepository(final File repoDir,\n                                final File hookDir,\n                                final boolean sslVerify) {\n        return createRepository(repoDir,\n                                hookDir,\n                                null,\n                                sslVerify);\n    }\n\n    static Git createRepository(final File repoDir,\n                                final File hookDir,\n                                final KetchLeaderCache leaders) {\n        return new CreateRepository(repoDir,\n                                    hookDir,\n                                    leaders,\n                                    JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute().get();\n    }\n\n    static Git createRepository(final File repoDir,\n                                final File hookDir,\n                                final KetchLeaderCache leaders,\n                                final boolean sslVerify) {\n        return new CreateRepository(repoDir,\n                                    hookDir,\n                                    leaders,\n                                    sslVerify).execute().get();\n    }\n\n    static Git fork(final File gitRepoContainerDir,\n                    final String origin,\n                    final String name,\n                    final List<String> branches,\n                    final CredentialsProvider credential,\n                    final KetchLeaderCache leaders,\n                    final File hookDir) {\n        return new Fork(gitRepoContainerDir,\n                        origin,\n                        name,\n                        branches,\n                        credential,\n                        leaders,\n                        hookDir,\n                        JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute();\n    }\n\n    static Git fork(final File gitRepoContainerDir,\n                    final String origin,\n                    final String name,\n                    final List<String> branches,\n                    final CredentialsProvider credential,\n                    final KetchLeaderCache leaders,\n                    final File hookDir,\n                    final boolean sslVerify) {\n        return new Fork(gitRepoContainerDir,\n                        origin,\n                        name,\n                        branches,\n                        credential,\n                        leaders,\n                        hookDir,\n                        sslVerify).execute();\n    }\n\n    static Git clone(final File repoDest,\n                     final String origin,\n                     final boolean isMirror,\n                     final List<String> branches,\n                     final CredentialsProvider credential,\n                     final KetchLeaderCache leaders,\n                     final File hookDir) {\n        return new Clone(repoDest,\n                         origin,\n                         isMirror,\n                         branches,\n                         credential,\n                         leaders,\n                         hookDir,\n                         JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute().get();\n    }\n\n    static Git clone(final File repoDest,\n                     final String origin,\n                     final boolean isMirror,\n                     final List<String> branches,\n                     final CredentialsProvider credential,\n                     final KetchLeaderCache leaders,\n                     final File hookDir,\n                     final boolean sslVerify) {\n        return new Clone(repoDest,\n                         origin,\n                         isMirror,\n                         branches,\n                         credential,\n                         leaders,\n                         hookDir,\n                         sslVerify).execute().get();\n    }\n\n    static Git cloneSubdirectory(final File repoDest,\n                                 final String origin,\n                                 final String subdirectory,\n                                 final List<String> branches,\n                                 final CredentialsProvider credential,\n                                 final KetchLeaderCache leaders,\n                                 final File hookDir) {\n        return new SubdirectoryClone(repoDest,\n                                     origin,\n                                     subdirectory,\n                                     branches,\n                                     credential,\n                                     leaders,\n                                     hookDir,\n                                     JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY).execute();\n    }\n\n    static Git cloneSubdirectory(final File repoDest,\n                                 final String origin,\n                                 final String subdirectory,\n                                 final List<String> branches,\n                                 final CredentialsProvider credential,\n                                 final KetchLeaderCache leaders,\n                                 final File hookDir,\n                                 final boolean sslVerify) {\n        return new SubdirectoryClone(repoDest,\n                                     origin,\n                                     subdirectory,\n                                     branches,\n                                     credential,\n                                     leaders,\n                                     hookDir,\n                                     sslVerify).execute();\n    }\n\n    void convertRefTree();\n\n    void deleteRef(final Ref ref);\n\n    Ref getRef(final String ref);\n\n    void push(final CredentialsProvider credentialsProvider,\n              final Pair<String, String> remote,\n              final boolean force,\n              final Collection<RefSpec> refSpecs) throws InvalidRemoteException;\n\n    void gc();\n\n    RevCommit getCommit(final String commitId);\n\n    RevCommit getLastCommit(final String refName);\n\n    RevCommit getLastCommit(final Ref ref) throws IOException;\n\n    RevCommit getCommonAncestorCommit(final String branchA,\n                                      final String branchB);\n\n    CommitHistory listCommits(final Ref ref,\n                              final String path) throws IOException, GitAPIException;\n\n    List<RevCommit> listCommits(final String startCommitId,\n                                final String endCommitId);\n\n    List<RevCommit> listCommits(final ObjectId startRange,\n                                final ObjectId endRange);\n\n    Repository getRepository();\n\n    ObjectId getTreeFromRef(final String treeRef);\n\n    void fetch(final CredentialsProvider credential,\n               final Pair<String, String> remote,\n               final Collection<RefSpec> refSpecs) throws InvalidRemoteException;\n\n    void syncRemote(final Pair<String, String> remote) throws InvalidRemoteException;\n\n    List<String> merge(final String source,\n                       final String target);\n\n    List<String> merge(final String source,\n                       final String target,\n                       final boolean noFastForward,\n                       final boolean squash,\n                       final CommitInfo commitInfo);\n\n\n    boolean revertMerge(final String source,\n                        final String target,\n                        final String commonAncestorCommitId,\n                        final String mergeCommitId);\n\n    void cherryPick(final JGitPathImpl target,\n                    final String... commits);\n\n    void cherryPick(final String targetBranch,\n                    final String... commitsIDs);\n\n    void createRef(final String source,\n                   final String target);\n\n    List<FileDiff> diffRefs(final String branchA,\n                            final String branchB);\n\n    List<TextualDiff> textualDiffRefs(final String branchA,\n                                      final String branchB);\n\n    List<TextualDiff> textualDiffRefs(final String branchA,\n                                      final String branchB,\n                                      final String commitIdBranchA,\n                                      final String commitIdBranchB);\n\n    List<String> conflictBranchesChecker(final String branchA,\n                                         final String branchB);\n\n    void squash(final String branch,\n                final String startCommit,\n                final String commitMessage);\n\n    boolean resetWithSquash(final String commitMessage) throws IOException;\n\n    boolean resetWithSquash(final String branch,\n                            final String commitMessage) throws IOException;\n\n    boolean commit(final String branchName,\n                   final CommitInfo commitInfo,\n                   final boolean amend,\n                   final ObjectId originId,\n                   final CommitContent content);\n\n    List<DiffEntry> listDiffs(final String startCommitId,\n                              final String endCommitId);\n\n    List<DiffEntry> listDiffs(final ObjectId refA,\n                              final ObjectId refB);\n\n    Map<String, File> mapDiffContent(final String branch,\n                                     final String startCommitId,\n                                     final String endCommitId);\n\n    InputStream blobAsInputStream(final String treeRef,\n                                  final String path);\n\n    RevCommit getFirstCommit(final Ref ref) throws IOException;\n\n    List<Ref> listRefs();\n\n    List<ObjectId> resolveObjectIds(final String... commits);\n\n    RevCommit resolveRevCommit(final ObjectId objectId) throws IOException;\n\n    List<RefSpec> updateRemoteConfig(final Pair<String, String> remote,\n                                     final Collection<RefSpec> refSpecs) throws IOException, URISyntaxException;\n\n    PathInfo getPathInfo(final String branchName,\n                         final String path);\n\n    List<PathInfo> listPathContent(final String branchName,\n                                   final String path);\n\n    boolean isHEADInitialized();\n\n    void setHeadAsInitialized();\n\n    void refUpdate(final String branch,\n                   final RevCommit commit) throws IOException, ConcurrentRefUpdateException;\n\n    KetchLeader getKetchLeader();\n\n    boolean isKetchEnabled();\n\n    void enableKetch();\n\n    void updateRepo(Repository repo);\n\n    void updateLeaders(final KetchLeaderCache leaders);\n\n    void removeRemote(String remote,\n                      String ref);\n\n    void addRemote(String remote,\n                   String url);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitHookSupport.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\n\npublic interface GitHookSupport {\n\n    void executePostCommitHook(JGitFileSystem fileSystem);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/GitImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport org.eclipse.jgit.api.AddCommand;\nimport org.eclipse.jgit.api.CloneCommand;\nimport org.eclipse.jgit.api.CommitCommand;\nimport org.eclipse.jgit.api.CreateBranchCommand;\nimport org.eclipse.jgit.api.DeleteBranchCommand;\nimport org.eclipse.jgit.api.FetchCommand;\nimport org.eclipse.jgit.api.GarbageCollectCommand;\nimport org.eclipse.jgit.api.ListBranchCommand;\nimport org.eclipse.jgit.api.LogCommand;\nimport org.eclipse.jgit.api.PushCommand;\nimport org.eclipse.jgit.api.RemoteListCommand;\nimport org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.internal.ketch.KetchLeader;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.AddRemote;\nimport org.uberfire.java.nio.fs.jgit.util.commands.BlobAsInputStream;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CherryPick;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ConflictBranchesChecker;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ConvertRefTree;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.DeleteBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.DiffBranches;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Fetch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GarbageCollector;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetCommit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetCommonAncestorCommit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetFirstCommit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetLastCommit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetPathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetTreeFromRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListCommits;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListDiffs;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListPathContent;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\nimport org.uberfire.java.nio.fs.jgit.util.commands.MapDiffContent;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Merge;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Push;\nimport org.uberfire.java.nio.fs.jgit.util.commands.RefTreeUpdateCommand;\nimport org.uberfire.java.nio.fs.jgit.util.commands.RemoveRemote;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ResolveObjectIds;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ResolveRevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.RevertMerge;\nimport org.uberfire.java.nio.fs.jgit.util.commands.SimpleRefUpdateCommand;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Squash;\nimport org.uberfire.java.nio.fs.jgit.util.commands.SyncRemote;\nimport org.uberfire.java.nio.fs.jgit.util.commands.TextualDiffBranches;\nimport org.uberfire.java.nio.fs.jgit.util.commands.UpdateRemoteConfig;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\n\nimport static org.uberfire.java.nio.fs.jgit.util.commands.PathUtil.normalize;\n\npublic class GitImpl implements Git {\n\n    private static final Logger LOG = LoggerFactory.getLogger(GitImpl.class);\n    private static final String DEFAULT_JGIT_RETRY_SLEEP_TIME = \"50\";\n    private static int JGIT_RETRY_TIMES = initRetryValue();\n    private static final int JGIT_RETRY_SLEEP_TIME = initSleepTime();\n    private static final String MAIN_BRANCH = \"master\";\n    private boolean isEnabled = false;\n\n    private static int initSleepTime() {\n        final ConfigProperties config = new ConfigProperties(System.getProperties());\n        return config.get(\"org.uberfire.nio.git.retry.onfail.sleep\",\n                          DEFAULT_JGIT_RETRY_SLEEP_TIME).getIntValue();\n    }\n\n    private static int initRetryValue() {\n        final ConfigProperties config = new ConfigProperties(System.getProperties());\n        final String osName = config.get(\"os.name\",\n                                         \"any\").getValue();\n        final String defaultRetryTimes;\n        if (osName.toLowerCase().contains(\"windows\")) {\n            defaultRetryTimes = \"10\";\n        } else {\n            defaultRetryTimes = \"0\";\n        }\n        try {\n            return config.get(\"org.uberfire.nio.git.retry.onfail.times\",\n                              defaultRetryTimes).getIntValue();\n        } catch (NumberFormatException ex) {\n            return 0;\n        }\n    }\n\n    private org.eclipse.jgit.api.Git git;\n    private KetchLeaderCache leaders;\n    private final AtomicBoolean isHeadInitialized = new AtomicBoolean(false);\n\n    public GitImpl(final org.eclipse.jgit.api.Git git) {\n        this(git,\n             null);\n    }\n\n    public GitImpl(final org.eclipse.jgit.api.Git git,\n                   final KetchLeaderCache leaders) {\n        this.git = git;\n        this.leaders = leaders;\n    }\n\n    @Override\n    public void convertRefTree() {\n        try {\n            new ConvertRefTree(this).execute();\n        } catch (IOException e) {\n            e.printStackTrace();\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void deleteRef(final Ref ref) {\n        new DeleteBranch(this,\n                         ref).execute();\n    }\n\n    @Override\n    public Ref getRef(final String ref) {\n        return new GetRef(git.getRepository(),\n                          ref).execute();\n    }\n\n    @Override\n    public void push(final CredentialsProvider credentialsProvider,\n                     final Pair<String, String> remote,\n                     final boolean force,\n                     final Collection<RefSpec> refSpecs) throws InvalidRemoteException {\n        new Push(this,\n                 credentialsProvider,\n                 remote,\n                 force,\n                 refSpecs).execute();\n    }\n\n    @Override\n    public void gc() {\n        new GarbageCollector(this).execute();\n    }\n\n    @Override\n    public RevCommit getCommit(final String commitId) {\n        return new GetCommit(this,\n                             commitId).execute();\n    }\n\n    @Override\n    public RevCommit getLastCommit(final String refName) {\n        return retryIfNeeded(RuntimeException.class,\n                             () -> new GetLastCommit(this,\n                                                     refName).execute());\n    }\n\n    @Override\n    public RevCommit getLastCommit(final Ref ref) throws IOException {\n        return new GetLastCommit(this,\n                                 ref).execute();\n    }\n\n    @Override\n    public RevCommit getCommonAncestorCommit(final String branchA,\n                                             final String branchB) {\n        return new GetCommonAncestorCommit(this,\n                                           getLastCommit(branchA),\n                                           getLastCommit(branchB)).execute();\n    }\n\n    @Override\n    public CommitHistory listCommits(final Ref ref,\n                                     final String path) throws IOException, GitAPIException {\n        return new ListCommits(this,\n                               ref,\n                               path).execute();\n    }\n\n    @Override\n    public List<RevCommit> listCommits(final String startCommitId,\n                                       final String endCommitId) {\n        return listCommits(new GetCommit(this, startCommitId).execute(),\n                           new GetCommit(this, endCommitId).execute());\n    }\n\n    @Override\n    public List<RevCommit> listCommits(final ObjectId startRange,\n                                       final ObjectId endRange) {\n        return retryIfNeeded(RuntimeException.class,\n                             () -> new ListCommits(this,\n                                                   startRange,\n                                                   endRange).execute()\n                                                            .getCommits());\n    }\n\n    @Override\n    public Repository getRepository() {\n        return git.getRepository();\n    }\n\n    public DeleteBranchCommand _branchDelete() {\n        return git.branchDelete();\n    }\n\n    public ListBranchCommand _branchList() {\n        return git.branchList();\n    }\n\n    public CreateBranchCommand _branchCreate() {\n        return git.branchCreate();\n    }\n\n    public FetchCommand _fetch() {\n        return git.fetch();\n    }\n\n    public GarbageCollectCommand _gc() {\n        return git.gc();\n    }\n\n    public PushCommand _push() {\n        return git.push();\n    }\n\n    @Override\n    public ObjectId getTreeFromRef(final String treeRef) {\n        return new GetTreeFromRef(this,\n                                  treeRef).execute();\n    }\n\n    @Override\n    public void fetch(final CredentialsProvider credential,\n                      final Pair<String, String> remote,\n                      final Collection<RefSpec> refSpecs) throws InvalidRemoteException {\n        new Fetch(this,\n                  credential,\n                  remote,\n                  refSpecs).execute();\n    }\n\n    @Override\n    public void syncRemote(final Pair<String, String> remote) throws InvalidRemoteException {\n        new SyncRemote(this,\n                       remote).execute();\n    }\n\n    @Override\n    public List<String> merge(final String source,\n                              final String target) {\n        return new Merge(this,\n                         source,\n                         target).execute();\n    }\n\n    @Override\n    public List<String> merge(final String source,\n                              final String target,\n                              final boolean noFastForward,\n                              final boolean squash,\n                              final CommitInfo commitInfo) {\n        return new Merge(this,\n                         source,\n                         target,\n                         noFastForward,\n                         squash,\n                         commitInfo).execute();\n    }\n\n    @Override\n    public boolean revertMerge(final String source,\n                               final String target,\n                               final String commonAncestorCommitId,\n                               final String mergeCommitId) {\n        return new RevertMerge(this,\n                               source,\n                               target,\n                               commonAncestorCommitId,\n                               mergeCommitId).execute();\n    }\n\n    @Override\n    public void cherryPick(final JGitPathImpl target,\n                           final String... commits) {\n        new CherryPick(this,\n                       target.getRefTree(),\n                       commits).execute();\n    }\n\n    @Override\n    public void cherryPick(final String targetBranch,\n                           final String... commitsIDs) {\n        new CherryPick(this,\n                       targetBranch,\n                       commitsIDs).execute();\n    }\n\n    @Override\n    public void createRef(final String source,\n                          final String target) {\n        new CreateBranch(this,\n                         source,\n                         target).execute();\n    }\n\n    @Override\n    public List<FileDiff> diffRefs(final String branchA,\n                                   final String branchB) {\n        return new DiffBranches(this,\n                                branchA,\n                                branchB).execute();\n    }\n\n    @Override\n    public List<TextualDiff> textualDiffRefs(final String branchA,\n                                             final String branchB) {\n        return new TextualDiffBranches(this,\n                                       branchA,\n                                       branchB).execute();\n    }\n\n    @Override\n    public List<TextualDiff> textualDiffRefs(final String branchA,\n                                             final String branchB,\n                                             final String commitIdBranchA,\n                                             final String commitIdBranchB) {\n        return new TextualDiffBranches(this,\n                                       branchA,\n                                       branchB,\n                                       commitIdBranchA,\n                                       commitIdBranchB).execute();\n    }\n\n    @Override\n    public List<String> conflictBranchesChecker(final String branchA,\n                                                final String branchB) {\n        return new ConflictBranchesChecker(this,\n                                           branchA,\n                                           branchB).execute();\n    }\n\n    @Override\n    public void squash(final String branch,\n                       final String startCommit,\n                       final String commitMessage) {\n        new Squash(this,\n                   branch,\n                   startCommit,\n                   commitMessage).execute();\n    }\n\n    @Override\n    public boolean resetWithSquash(String commitMessage) throws IOException {\n        return resetWithSquash(MAIN_BRANCH,\n                               commitMessage);\n    }\n\n    @Override\n    public boolean resetWithSquash(final String branch,\n                                   final String commitMessage) throws IOException {\n        final Ref branchRef = getRef(branch);\n        final RevCommit firstCommit = getFirstCommit(branchRef);\n        final RevCommit lastCommit = getLastCommit(branchRef);\n\n        if (!firstCommit.equals(lastCommit)) {\n            squash(branch,\n                   firstCommit.getName(),\n                   commitMessage);\n            return true;\n        }\n        return false;\n    }\n\n    public LogCommand _log() {\n        return git.log();\n    }\n\n    @Override\n    public boolean commit(final String branchName,\n                          final CommitInfo commitInfo,\n                          final boolean amend,\n                          final ObjectId originId,\n                          final CommitContent content) {\n        return new Commit(this,\n                          branchName,\n                          commitInfo,\n                          amend,\n                          originId,\n                          content).execute();\n    }\n\n    @Override\n    public List<DiffEntry> listDiffs(final String startCommitId,\n                                     final String endCommitId) {\n        return listDiffs(getCommit(startCommitId).getTree(),\n                         getCommit(endCommitId).getTree());\n    }\n\n    @Override\n    public List<DiffEntry> listDiffs(final ObjectId refA,\n                                     final ObjectId refB) {\n        return new ListDiffs(this,\n                             refA,\n                             refB).execute();\n    }\n\n    @Override\n    public Map<String, File> mapDiffContent(final String branch,\n                                            final String startCommitId,\n                                            final String endCommitId) {\n        return new MapDiffContent(this,\n                                  branch,\n                                  startCommitId,\n                                  endCommitId).execute();\n    }\n\n    @Override\n    public InputStream blobAsInputStream(final String treeRef,\n                                         final String path) {\n        return retryIfNeeded(NoSuchFileException.class,\n                             () -> new BlobAsInputStream(this,\n                                                         treeRef,\n                                                         normalize(path)).execute().get());\n    }\n\n    @Override\n    public RevCommit getFirstCommit(final Ref ref) throws IOException {\n        return new GetFirstCommit(this,\n                                  ref).execute();\n    }\n\n    @Override\n    public List<Ref> listRefs() {\n        return new ListRefs(git.getRepository()).execute();\n    }\n\n    @Override\n    public List<ObjectId> resolveObjectIds(final String... commits) {\n        return new ResolveObjectIds(this,\n                                    commits).execute();\n    }\n\n    @Override\n    public RevCommit resolveRevCommit(final ObjectId objectId) throws IOException {\n        return new ResolveRevCommit(git.getRepository(),\n                                    objectId).execute();\n    }\n\n    @Override\n    public List<RefSpec> updateRemoteConfig(final Pair<String, String> remote,\n                                            final Collection<RefSpec> refSpecs) throws IOException, URISyntaxException {\n        return new UpdateRemoteConfig(this,\n                                      remote,\n                                      refSpecs).execute();\n    }\n\n    public AddCommand _add() {\n        return git.add();\n    }\n\n    public CommitCommand _commit() {\n        return git.commit();\n    }\n\n    public RemoteListCommand _remoteList() {\n        return git.remoteList();\n    }\n\n    public static CloneCommand _cloneRepository() {\n        return org.eclipse.jgit.api.Git.cloneRepository();\n    }\n\n    @Override\n    public PathInfo getPathInfo(final String branchName,\n                                final String path) {\n        return retryIfNeeded(RuntimeException.class,\n                             () -> new GetPathInfo(this,\n                                                   branchName,\n                                                   path).execute());\n    }\n\n    @Override\n    public List<PathInfo> listPathContent(final String branchName,\n                                          final String path) {\n        return retryIfNeeded(RuntimeException.class,\n                             () -> new ListPathContent(this,\n                                                       branchName,\n                                                       path).execute());\n    }\n\n    @Override\n    public boolean isHEADInitialized() {\n        return isHeadInitialized.get();\n    }\n\n    @Override\n    public void setHeadAsInitialized() {\n        isHeadInitialized.set(true);\n    }\n\n    @Override\n    public void refUpdate(final String branch,\n                          final RevCommit commit)\n            throws IOException, ConcurrentRefUpdateException {\n        if (getRepository().getRefDatabase() instanceof RefTreeDatabase) {\n            new RefTreeUpdateCommand(this,\n                                     branch,\n                                     commit).execute();\n        } else {\n            new SimpleRefUpdateCommand(this,\n                                       branch,\n                                       commit).execute();\n        }\n    }\n\n    @Override\n    public KetchLeader getKetchLeader() {\n        try {\n            return leaders.get(getRepository());\n        } catch (URISyntaxException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public boolean isKetchEnabled() {\n        return isEnabled;\n    }\n\n    @Override\n    public void enableKetch() {\n        isEnabled = true;\n    }\n\n    @Override\n    public void updateRepo(final Repository repo) {\n        this.git = new org.eclipse.jgit.api.Git(repo);\n    }\n\n    @Override\n    public void updateLeaders(final KetchLeaderCache leaders) {\n        this.leaders = leaders;\n    }\n\n    @Override\n    public void removeRemote(final String remote,\n                             final String ref) {\n        new RemoveRemote(this,\n                         remote,\n                         ref).execute();\n    }\n\n    @Override\n    public void addRemote(final String remote,\n                          final String url) {\n        new AddRemote(this,\n                      remote,\n                      url).execute();\n    }\n\n    //just for test purposes\n    static void setRetryTimes(int retryTimes) {\n        JGIT_RETRY_TIMES = retryTimes;\n    }\n\n    public static <E extends Throwable, T> T retryIfNeeded(final Class<E> eclazz,\n                                                           final ThrowableSupplier<T> supplier) throws E {\n        int i = 0;\n        do {\n            try {\n                return supplier.get();\n            } catch (final Throwable ex) {\n                if (i < (JGIT_RETRY_TIMES - 1)) {\n                    try {\n                        Thread.sleep(JGIT_RETRY_SLEEP_TIME);\n                    } catch (final InterruptedException ignored) {\n                    }\n                    LOG.debug(String.format(\"Unexpected exception (%d/%d).\",\n                                            i + 1,\n                                            JGIT_RETRY_TIMES),\n                              ex);\n                } else {\n                    LOG.error(String.format(\"Unexpected exception (%d/%d).\",\n                                            i + 1,\n                                            JGIT_RETRY_TIMES),\n                              ex);\n                    if (ex.getClass().isAssignableFrom(eclazz)) {\n                        throw (E) ex;\n                    }\n                    throw new RuntimeException(ex);\n                }\n            }\n\n            i++;\n        } while (i < JGIT_RETRY_TIMES);\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/ProxyAuthenticator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\nimport java.net.Authenticator;\nimport java.net.PasswordAuthentication;\n\npublic class ProxyAuthenticator extends Authenticator {\n\n    private final String httpProxyUser;\n    private final String httpProxyPassword;\n    private final String httpsProxyUser;\n    private final String httpsProxyPassword;\n\n    public ProxyAuthenticator(final String httpProxyUser,\n                              final String httpProxyPassword,\n                              final String httpsProxyUser,\n                              final String httpsProxyPassword) {\n        this.httpProxyUser = httpProxyUser;\n        this.httpProxyPassword = httpProxyPassword;\n        this.httpsProxyUser = httpsProxyUser;\n        this.httpsProxyPassword = httpsProxyPassword;\n    }\n\n    @Override\n    protected PasswordAuthentication getPasswordAuthentication() {\n        if (getRequestorType() == RequestorType.PROXY) {\n            final String protocol = getRequestingProtocol();\n\n            if (protocol.equalsIgnoreCase(\"http\") && (httpProxyUser != null && httpProxyPassword != null)) {\n                return new PasswordAuthentication(httpProxyUser,\n                                                  httpProxyPassword.toCharArray());\n            } else if (protocol.equalsIgnoreCase(\"https\") && (httpsProxyUser != null && httpsProxyPassword != null)) {\n                return new PasswordAuthentication(httpsProxyUser,\n                                                  httpsProxyPassword.toCharArray());\n            }\n        }\n        return super.getPasswordAuthentication();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/ThrowableSupplier.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\n/**\n * Represents a supplier of results.\n * <p>\n * Borrowed from java 8 java.util.function, just added `throws` support.\n */\n@FunctionalInterface\npublic interface ThrowableSupplier<T> {\n\n    /**\n     * Gets a result.\n     * @return a result\n     */\n    T get() throws Throwable;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/AddRemote.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.lib.StoredConfig;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\npublic class AddRemote {\n\n    private static final String REMOTE_KEY = \"remote\";\n    private static final String URL_KEY = \"url\";\n\n    private Git git;\n    private String remote;\n    private String url;\n\n    public AddRemote(final Git git,\n                     final String remote,\n                     final String url) {\n        this.git = git;\n        this.remote = remote;\n        this.url = url;\n    }\n\n    public void execute() {\n        try {\n            final StoredConfig config = git.getRepository().getConfig();\n            config.setString(REMOTE_KEY,\n                             remote,\n                             URL_KEY,\n                             url);\n            config.save();\n        } catch (Exception e) {\n            throw new GitException(\"Error when trying to add remote\",\n                                   e);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/BaseCreateCommitTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Optional;\nimport java.util.function.BiConsumer;\n\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.lib.FileMode;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\n\nabstract class BaseCreateCommitTree<T extends CommitContent> {\n\n    final T commitContent;\n    final Git git;\n    final ObjectId headId;\n    final ObjectInserter odi;\n\n    BaseCreateCommitTree(final Git git,\n                         final ObjectId headId,\n                         final ObjectInserter inserter,\n                         final T commitContent) {\n        this.git = git;\n        this.headId = headId;\n        this.odi = inserter;\n        this.commitContent = commitContent;\n    }\n\n    Optional<ObjectId> buildTree(final DirCacheEditor editor) {\n        try {\n            return Optional.ofNullable(editor.getDirCache().writeTree(odi));\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    void iterateOverTreeWalk(final Git git,\n                             final ObjectId headId,\n                             final BiConsumer<String, CanonicalTreeParser> consumer) {\n        if (headId != null) {\n            try (final TreeWalk treeWalk = new TreeWalk(git.getRepository())) {\n                final int hIdx = treeWalk.addTree(new RevWalk(git.getRepository()).parseTree(headId));\n                treeWalk.setRecursive(true);\n\n                while (treeWalk.next()) {\n                    final String walkPath = treeWalk.getPathString();\n                    final CanonicalTreeParser hTree = treeWalk.getTree(hIdx,\n                                                                       CanonicalTreeParser.class);\n\n                    consumer.accept(walkPath,\n                                    hTree);\n                }\n            } catch (final Exception ex) {\n                throw new RuntimeException(ex);\n            }\n        }\n    }\n\n    void addToTemporaryInCoreIndex(final DirCacheEditor editor,\n                                   final DirCacheEntry dcEntry,\n                                   final ObjectId objectId,\n                                   final FileMode fileMode) {\n        editor.add(new DirCacheEditor.PathEdit(dcEntry) {\n            @Override\n            public void apply(final DirCacheEntry ent) {\n                ent.setObjectId(objectId);\n                ent.setFileMode(fileMode);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/BlobAsInputStream.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\nimport java.util.Optional;\n\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.PathFilter;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class BlobAsInputStream {\n\n    private static final Logger LOG = LoggerFactory.getLogger(BlobAsInputStream.class);\n\n    private final Git git;\n    private final String treeRef;\n    private final String path;\n\n    public BlobAsInputStream(final Git git,\n                             final String treeRef,\n                             final String path) {\n        this.git = git;\n        this.treeRef = treeRef;\n        this.path = path;\n    }\n\n    public Optional<InputStream> execute() {\n        try (final TreeWalk tw = new TreeWalk(git.getRepository())) {\n            final ObjectId tree = git.getTreeFromRef(treeRef);\n            tw.setFilter(PathFilter.create(path));\n            tw.reset(tree);\n            while (tw.next()) {\n                if (tw.isSubtree() && !path.equals(tw.getPathString())) {\n                    tw.enterSubtree();\n                    continue;\n                }\n                return Optional.of(new ByteArrayInputStream(git.getRepository().open(tw.getObjectId(0),\n                                                                                     Constants.OBJ_BLOB).getBytes()));\n            }\n        } catch (final Throwable t) {\n            LOG.debug(\"Unexpected exception, this will trigger a NoSuchFileException.\",\n                      t);\n            throw new NoSuchFileException(\"Can't find '\" + path + \"' in tree '\" + treeRef + \"'\");\n        }\n        throw new NoSuchFileException(\"Can't find '\" + path + \"' in tree '\" + treeRef + \"'\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/BranchUtil.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\npublic class BranchUtil {\n\n    private BranchUtil() {\n\n    }\n\n    public static void deleteUnfilteredBranches(final Repository repository,\n                                                final List<String> branchesToKeep) throws GitAPIException {\n        if (branchesToKeep == null || branchesToKeep.isEmpty()) {\n            return;\n        }\n\n        final org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.wrap(repository);\n        final String[] toDelete = git.branchList()\n                .call()\n                .stream()\n                .map(Ref::getName)\n                .map(fullname -> fullname.substring(fullname.lastIndexOf('/') + 1))\n                .filter(name -> !branchesToKeep.contains(name))\n                .toArray(String[]::new);\n        git.branchDelete()\n                .setBranchNames(toDelete)\n                .setForce(true)\n                .call();\n    }\n\n    public static void existsBranch(final Git git,\n                                    final String branch) {\n        if (git.getRef(branch) == null) {\n            throw new GitException(String.format(\"Branch <<%s>> does not exist\",\n                                                 branch));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CherryPick.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.text.MessageFormat;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException;\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class CherryPick {\n\n    private final Git git;\n    private final String targetBranch;\n    private final String[] commits;\n\n    public CherryPick(final Git git,\n                      final String targetBranch,\n                      final String... commits) {\n        this.git = git;\n        this.targetBranch = targetBranch;\n        this.commits = commits;\n    }\n\n    public void execute() {\n        final List<ObjectId> commits = git.resolveObjectIds(this.commits);\n        if (commits.size() != this.commits.length) {\n            throw new IOException(\"Couldn't resolve some commits.\");\n        }\n\n        final Ref headRef = git.getRef(targetBranch);\n        if (headRef == null) {\n            throw new IOException(\"Branch not found.\");\n        }\n\n        try {\n            // loop through all refs to be cherry-picked\n            for (final ObjectId src : commits) {\n                final RevCommit srcCommit = git.resolveRevCommit(src);\n\n                // get the parent of the commit to cherry-pick\n                if (srcCommit.getParentCount() != 1) {\n                    throw new IOException(new MultipleParentsNotAllowedException(\n                            MessageFormat.format(\n                                    JGitText.get().canOnlyCherryPickCommitsWithOneParent,\n                                    srcCommit.name(),\n                                    srcCommit.getParentCount())));\n                }\n\n                git.refUpdate(targetBranch,\n                              srcCommit);\n            }\n        } catch (final java.io.IOException e) {\n            throw new IOException(new JGitInternalException(\n                    MessageFormat.format(\n                            JGitText.get().exceptionCaughtDuringExecutionOfCherryPickCommand,\n                            e),\n                    e));\n        } catch (final Exception e) {\n            throw new IOException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Clone.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.internal.storage.file.WindowCache;\nimport org.eclipse.jgit.storage.file.WindowCacheConfig;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.eclipse.jgit.util.FileUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static java.util.Collections.emptyList;\nimport static java.util.Collections.singletonList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class Clone {\n\n    public static final String REFS_MIRRORED = \"+refs/heads/*:refs/remotes/origin/*\";\n    private final File repoDir;\n    private final String origin;\n    private final List<String> branches;\n    private final CredentialsProvider credentialsProvider;\n    private final boolean isMirror;\n    private final KetchLeaderCache leaders;\n    private final File hookDir;\n    private final boolean sslVerify;\n\n    private Logger logger = LoggerFactory.getLogger(Clone.class);\n    public Clone(final File directory,\n                 final String origin,\n                 final boolean isMirror,\n                 final List<String> branches,\n                 final CredentialsProvider credentialsProvider,\n                 final KetchLeaderCache leaders,\n                 final File hookDir) {\n        this(directory,\n             origin,\n             isMirror,\n             branches,\n             credentialsProvider,\n             leaders,\n             hookDir,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    public Clone(final File directory,\n                 final String origin,\n                 final boolean isMirror,\n                 final List<String> branches,\n                 final CredentialsProvider credentialsProvider,\n                 final KetchLeaderCache leaders,\n                 final File hookDir,\n                 final boolean sslVerify) {\n        this.repoDir = checkNotNull(\"directory\",\n                                    directory);\n        this.origin = checkNotEmpty(\"origin\",\n                                    origin);\n        this.isMirror = isMirror;\n        this.branches = branches;\n        this.credentialsProvider = credentialsProvider;\n        this.leaders = leaders;\n        this.hookDir = hookDir;\n        this.sslVerify = sslVerify;\n    }\n\n    public Optional<Git> execute() {\n\n        if (repoDir.exists()) {\n            String message = String.format(\"Cannot clone because destination repository <%s> already exists\",\n                                           repoDir.getAbsolutePath());\n            logger.error(message);\n            throw new CloneException(message);\n        }\n\n        final Git git = Git.createRepository(repoDir,\n                                             hookDir,\n                                             sslVerify);\n\n        if (git != null) {\n            try {\n\n                final Collection<RefSpec> refSpecList;\n                if (isMirror) {\n                    refSpecList = singletonList(new RefSpec(REFS_MIRRORED));\n                } else {\n                    refSpecList = emptyList();\n                }\n                final Pair<String, String> remote = Pair.newPair(\"origin\",\n                                                                 origin);\n                git.fetch(credentialsProvider,\n                          remote,\n                          refSpecList);\n\n                git.syncRemote(remote);\n\n                if (git.isKetchEnabled()) {\n                    git.convertRefTree();\n                    git.updateLeaders(leaders);\n                }\n\n                git.setHeadAsInitialized();\n\n                BranchUtil.deleteUnfilteredBranches(git.getRepository(), branches);\n\n                return Optional.of(git);\n            } catch (Exception e) {\n                String message = String.format(\"Error cloning origin <%s>.\",\n                                               origin);\n                logger.error(message);\n                cleanupDir(git.getRepository().getDirectory());\n                throw new CloneException(message,\n                                         e);\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    private void cleanupDir(final File gitDir) {\n\n        try {\n            if (System.getProperty(\"os.name\").toLowerCase().contains(\"windows\")) {\n                //this operation forces a cache clean freeing any lock -> windows only issue!\n                WindowCache.reconfigure(new WindowCacheConfig());\n            }\n            FileUtils.delete(gitDir,\n                             FileUtils.RECURSIVE | FileUtils.RETRY);\n        } catch (java.io.IOException e) {\n            throw new org.uberfire.java.nio.IOException(\"Failed to remove the git repository.\",\n                                                        e);\n        }\n    }\n\n    public static class CloneException extends RuntimeException {\n\n        public CloneException(final String message) {\n            super(message);\n        }\n\n        public CloneException(final String message,\n                              final Throwable t) {\n            super(message,\n                  t);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Commit.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.util.Arrays;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.TimeZone;\n\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.CopyCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MergeCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MoveCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent;\n\nimport static java.util.Collections.reverse;\n\npublic class Commit {\n\n    private final Git git;\n    private final String branchName;\n    private final CommitInfo commitInfo;\n    private final boolean amend;\n    private final ObjectId originId;\n    private final CommitContent content;\n\n    public Commit(final Git git,\n                  final String branchName,\n                  final String name,\n                  final String email,\n                  final String message,\n                  final TimeZone timeZone,\n                  final Date when,\n                  final boolean amend,\n                  final Map<String, File> content) {\n        this(git,\n             branchName,\n             new CommitInfo(null,\n                            name,\n                            email,\n                            message,\n                            timeZone,\n                            when),\n             amend,\n             null,\n             new DefaultCommitContent(content));\n    }\n\n    public Commit(final Git git,\n                  final String branchName,\n                  final CommitInfo commitInfo,\n                  final boolean amend,\n                  final ObjectId originId,\n                  final CommitContent content) {\n        this.git = git;\n        this.branchName = branchName;\n        this.commitInfo = commitInfo;\n        this.amend = amend;\n        this.content = content;\n        try {\n            if (originId == null) {\n                this.originId = git.getLastCommit(branchName);\n            } else {\n                this.originId = originId;\n            }\n        } catch (final Throwable t) {\n            throw new RuntimeException(t);\n        }\n    }\n\n    public boolean execute() {\n        boolean hadEffecitiveCommit = true;\n        final PersonIdent author = buildPersonIdent(git,\n                                                    commitInfo.getName(),\n                                                    commitInfo.getEmail(),\n                                                    commitInfo.getTimeZone(),\n                                                    commitInfo.getWhen());\n\n        try (final ObjectInserter odi = git.getRepository().newObjectInserter()) {\n            final ObjectId headId = git.getRepository().resolve(branchName + \"^{commit}\");\n\n            final Optional<ObjectId> tree;\n            if (content instanceof DefaultCommitContent) {\n                tree = new CreateDefaultCommitTree(git,\n                                                   originId,\n                                                   odi,\n                                                   (DefaultCommitContent) content).execute();\n            } else if (content instanceof MoveCommitContent) {\n                tree = new CreateMoveCommitTree(git,\n                                                originId,\n                                                odi,\n                                                (MoveCommitContent) content).execute();\n            } else if (content instanceof CopyCommitContent) {\n                tree = new CreateCopyCommitTree(git,\n                                                originId,\n                                                odi,\n                                                (CopyCommitContent) content).execute();\n            } else if (content instanceof RevertCommitContent) {\n                tree = new CreateRevertCommitTree(git,\n                                                  originId,\n                                                  odi,\n                                                  (RevertCommitContent) content).execute();\n            } else {\n                tree = Optional.empty();\n            }\n\n            if (tree.isPresent()) {\n                final CommitBuilder commit = new CommitBuilder();\n                commit.setAuthor(author);\n                commit.setCommitter(author);\n                commit.setEncoding(Constants.CHARACTER_ENCODING);\n                commit.setMessage(commitInfo.getMessage());\n                if (headId != null) {\n                    if (content instanceof MergeCommitContent) {\n                        commit.setParentIds(((MergeCommitContent) content).getParents());\n                    } else {\n                        if (amend) {\n                            final RevCommit previousCommit = git.resolveRevCommit(headId);\n                            final List<RevCommit> p = Arrays.asList(previousCommit.getParents());\n                            reverse(p);\n                            commit.setParentIds(p);\n                        } else {\n                            commit.setParentId(headId);\n                        }\n                    }\n                }\n                commit.setTreeId(tree.get());\n\n                final ObjectId commitId = odi.insert(commit);\n                odi.flush();\n\n                git.refUpdate(branchName,\n                              git.resolveRevCommit(commitId));\n            } else {\n                hadEffecitiveCommit = false;\n            }\n        } catch (final Throwable t) {\n            t.printStackTrace();\n            throw new RuntimeException(t);\n        }\n        return hadEffecitiveCommit;\n    }\n\n    private PersonIdent buildPersonIdent(final Git git,\n                                         final String name,\n                                         final String _email,\n                                         final TimeZone timeZone,\n                                         final Date when) {\n        final TimeZone tz = timeZone == null ? TimeZone.getDefault() : timeZone;\n        final String email = _email == null ? \"\" : _email;\n\n        if (name != null) {\n            if (when != null) {\n                return new PersonIdent(name,\n                                       email,\n                                       when,\n                                       tz);\n            } else {\n                return new PersonIdent(name,\n                                       email);\n            }\n        }\n        return new PersonIdent(\"system\",\n                               \"system\",\n                               new Date(),\n                               TimeZone.getDefault());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ConflictBranchesChecker.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport org.eclipse.jgit.merge.MergeResult;\nimport org.eclipse.jgit.merge.MergeStrategy;\nimport org.eclipse.jgit.merge.ResolveMerger;\nimport org.eclipse.jgit.merge.ThreeWayMerger;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class ConflictBranchesChecker {\n\n    private final Git git;\n    private final String branchA;\n    private final String branchB;\n\n    public ConflictBranchesChecker(final Git git,\n                                   final String branchA,\n                                   final String branchB) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.branchA = checkNotEmpty(\"branchA\",\n                                     branchA);\n        this.branchB = checkNotEmpty(\"branchB\",\n                                     branchB);\n    }\n\n    public List<String> execute() {\n        BranchUtil.existsBranch(this.git,\n                                this.branchA);\n\n        BranchUtil.existsBranch(this.git,\n                                this.branchB);\n\n        List<String> result = new ArrayList<>();\n\n        try {\n            final RevCommit commitA = git.getLastCommit(branchA);\n            final RevCommit commitB = git.getLastCommit(branchB);\n\n            final RevCommit commonAncestor = git.getCommonAncestorCommit(branchA,\n                                                                         branchB);\n\n            ThreeWayMerger merger = MergeStrategy.RECURSIVE.newMerger(git.getRepository(),\n                                                                      true);\n            merger.setBase(commonAncestor);\n\n            boolean canMerge = merger.merge(commitA,\n                                            commitB);\n\n            if (!canMerge) {\n                ResolveMerger resolveMerger = (ResolveMerger) merger;\n                Map<String, MergeResult<?>> mergeResults = resolveMerger.getMergeResults();\n                result.addAll(mergeResults.keySet()\n                                      .stream()\n                                      .sorted(String::compareToIgnoreCase)\n                                      .collect(Collectors.toList()));\n            }\n        } catch (IOException e) {\n            throw new GitException(\n                    String.format(\"Error when checking for conflicts between branches %s and %s: %s\",\n                                  this.branchA, this.branchB, e));\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ConvertRefTree.java",
    "content": "package org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.StandardCopyOption;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.TimeZone;\n\nimport org.eclipse.jgit.internal.storage.reftree.Command;\nimport org.eclipse.jgit.internal.storage.reftree.RefTree;\nimport org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.RefDatabase;\nimport org.eclipse.jgit.lib.RefUpdate;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.lib.StoredConfig;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.storage.file.FileRepositoryBuilder;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static org.eclipse.jgit.lib.Constants.HEAD;\n\npublic class ConvertRefTree {\n\n    private final Git git;\n    private String txnNamespace;\n    private String txnCommitted;\n\n    public ConvertRefTree(final Git git) {\n        this.git = git;\n    }\n\n    public void execute() throws IOException {\n        try (ObjectReader reader = git.getRepository().newObjectReader();\n             RevWalk rw = new RevWalk(reader);\n             ObjectInserter inserter = git.getRepository().newObjectInserter()) {\n            RefDatabase refDb = git.getRepository().getRefDatabase();\n            if (refDb instanceof RefTreeDatabase) {\n                RefTreeDatabase d = (RefTreeDatabase) refDb;\n                refDb = d.getBootstrap();\n                txnNamespace = d.getTxnNamespace();\n                txnCommitted = d.getTxnCommitted();\n            } else {\n                RefTreeDatabase d = new RefTreeDatabase(git.getRepository(),\n                                                        refDb);\n                txnNamespace = d.getTxnNamespace();\n                txnCommitted = d.getTxnCommitted();\n            }\n\n            CommitBuilder b = new CommitBuilder();\n            Ref ref = refDb.exactRef(txnCommitted);\n            RefUpdate update = refDb.newUpdate(txnCommitted,\n                                               true);\n            ObjectId oldTreeId;\n\n            if (ref != null && ref.getObjectId() != null) {\n                ObjectId oldId = ref.getObjectId();\n                update.setExpectedOldObjectId(oldId);\n                b.setParentId(oldId);\n                oldTreeId = rw.parseCommit(oldId).getTree();\n            } else {\n                update.setExpectedOldObjectId(ObjectId.zeroId());\n                oldTreeId = ObjectId.zeroId();\n            }\n\n            RefTree tree = rebuild(refDb);\n            b.setTreeId(tree.writeTree(inserter));\n            b.setAuthor(new PersonIdent(\"system\",\n                                        \"system\",\n                                        new Date(1481754897254L),\n                                        TimeZone.getDefault()));\n            b.setCommitter(b.getAuthor());\n            if (b.getTreeId().equals(oldTreeId)) {\n                return;\n            }\n\n            update.setNewObjectId(inserter.insert(b));\n            inserter.flush();\n\n            RefUpdate.Result result = update.update(rw);\n            switch (result) {\n                case NEW:\n                case FAST_FORWARD:\n                    break;\n                default:\n                    throw new RuntimeException(String.format(\"%s: %s\",\n                                                             update.getName(),\n                                                             result)); //$NON-NLS-1$\n            }\n\n            if (!(git.getRepository().getRefDatabase() instanceof RefTreeDatabase)) {\n                StoredConfig cfg = git.getRepository().getConfig();\n                cfg.setInt(\"core\",\n                           null,\n                           \"repositoryformatversion\",\n                           1); //$NON-NLS-1$ //$NON-NLS-2$\n                cfg.setString(\"extensions\",\n                              null,\n                              \"refsStorage\",\n                              \"reftree\"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$\n                cfg.save();\n\n                final Repository repo = new FileRepositoryBuilder()\n                        .setGitDir(git.getRepository().getDirectory())\n                        .build();\n                git.updateRepo(repo);\n            }\n            final File commited = new File(git.getRepository().getDirectory(),\n                                           txnCommitted);\n            final File accepted = new File(git.getRepository().getDirectory(),\n                                           txnNamespace + \"accepted\");\n            Files.copy(commited.toPath(),\n                       accepted.toPath(),\n                       StandardCopyOption.REPLACE_EXISTING);\n        }\n    }\n\n    private RefTree rebuild(RefDatabase refdb) throws IOException {\n        RefTree tree = RefTree.newEmptyTree();\n        List<Command> cmds\n                = new ArrayList<>();\n\n        Ref head = refdb.exactRef(HEAD);\n        if (head != null) {\n            cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command(\n                    null,\n                    head));\n        }\n\n        for (Ref r : refdb.getRefs(RefDatabase.ALL).values()) {\n            if (r.getName().equals(txnCommitted) || r.getName().equals(HEAD)\n                    || r.getName().startsWith(txnNamespace)) {\n                continue;\n            }\n            cmds.add(new org.eclipse.jgit.internal.storage.reftree.Command(\n                    null,\n                    git.getRepository().peel(r)));\n        }\n        tree.apply(cmds);\n        return tree;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateBranch.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class CreateBranch {\n\n    private final GitImpl git;\n    private final String source;\n    private final String target;\n\n    public CreateBranch(final GitImpl git,\n                        final String source,\n                        final String target) {\n        this.git = git;\n        this.source = source;\n        this.target = target;\n    }\n\n    public void execute() {\n        try {\n            git.refUpdate(target,\n                          git.resolveRevCommit(git.resolveObjectIds(source).get(0)));\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateCopyCommitTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CopyCommitContent;\n\npublic class CreateCopyCommitTree extends BaseCreateCommitTree<CopyCommitContent> {\n\n    public CreateCopyCommitTree(final Git git,\n                                final ObjectId headId,\n                                final ObjectInserter inserter,\n                                final CopyCommitContent commitContent) {\n        super(git,\n              headId,\n              inserter,\n              commitContent);\n    }\n\n    public Optional<ObjectId> execute() {\n        final Map<String, String> content = commitContent.getContent();\n\n        final DirCacheEditor editor = DirCache.newInCore().editor();\n\n        try {\n            iterateOverTreeWalk(git,\n                                headId,\n                                (walkPath, hTree) -> {\n                                    final String toPath = content.get(walkPath);\n                                    addToTemporaryInCoreIndex(editor,\n                                                              new DirCacheEntry(walkPath),\n                                                              hTree.getEntryObjectId(),\n                                                              hTree.getEntryFileMode());\n                                    if (toPath != null) {\n                                        addToTemporaryInCoreIndex(editor,\n                                                                  new DirCacheEntry(toPath),\n                                                                  hTree.getEntryObjectId(),\n                                                                  hTree.getEntryFileMode());\n                                    }\n                                });\n\n            editor.finish();\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        return buildTree(editor);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateDefaultCommitTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.InputStream;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.PathFilter;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent;\n\nimport static org.eclipse.jgit.lib.FileMode.REGULAR_FILE;\n\npublic class CreateDefaultCommitTree extends BaseCreateCommitTree<DefaultCommitContent> {\n\n    public CreateDefaultCommitTree(final Git git,\n                                   final ObjectId headId,\n                                   final ObjectInserter inserter,\n                                   final DefaultCommitContent commitContent) {\n        super(git,\n              headId,\n              inserter,\n              commitContent);\n    }\n\n    public Optional<ObjectId> execute() {\n        final Map<String, File> content = commitContent.getContent();\n        final Map<String, Pair<File, ObjectId>> paths = new HashMap<>(content.size());\n        final Set<String> path2delete = new HashSet<>();\n\n        final DirCacheEditor editor = DirCache.newInCore().editor();\n\n        try {\n            for (final Map.Entry<String, File> pathAndContent : content.entrySet()) {\n                final String gPath = PathUtil.normalize(pathAndContent.getKey());\n                if (pathAndContent.getValue() == null) {\n                    path2delete.addAll(searchPathsToDelete(git,\n                                                           headId,\n                                                           gPath));\n                } else {\n                    paths.putAll(storePathsIntoHashMap(odi,\n                                                       pathAndContent,\n                                                       gPath));\n                }\n            }\n\n            iterateOverTreeWalk(git,\n                                headId,\n                                (walkPath, hTree) -> {\n                                    if (paths.containsKey(walkPath) && paths.get(walkPath).getK2().equals(hTree.getEntryObjectId())) {\n                                        paths.remove(walkPath);\n                                    }\n\n                                    if (paths.get(walkPath) == null && !path2delete.contains(walkPath)) {\n                                        addToTemporaryInCoreIndex(editor,\n                                                                  new DirCacheEntry(walkPath),\n                                                                  hTree.getEntryObjectId(),\n                                                                  hTree.getEntryFileMode());\n                                    }\n                                });\n\n            paths.forEach((key, value) -> {\n                if (value.getK1() != null) {\n                    editor.add(new DirCacheEditor.PathEdit(new DirCacheEntry(key)) {\n                        @Override\n                        public void apply(final DirCacheEntry ent) {\n                            ent.setLength(value.getK1().length());\n                            ent.setLastModified(value.getK1().lastModified());\n                            ent.setFileMode(REGULAR_FILE);\n                            ent.setObjectId(value.getK2());\n                        }\n                    });\n                }\n            });\n\n            editor.finish();\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        if (path2delete.isEmpty() && paths.isEmpty()) {\n            editor.getDirCache().clear();\n            return Optional.empty();\n        }\n\n        return buildTree(editor);\n    }\n\n    private static Map<String, Pair<File, ObjectId>> storePathsIntoHashMap(final ObjectInserter inserter,\n                                                                           final Map.Entry<String, File> pathAndContent,\n                                                                           final String gPath) {\n        try (final InputStream inputStream = new FileInputStream(pathAndContent.getValue())) {\n            final Map<String, Pair<File, ObjectId>> paths = new HashMap<>();\n            final ObjectId objectId = inserter.insert(Constants.OBJ_BLOB,\n                                                      pathAndContent.getValue().length(),\n                                                      inputStream);\n            paths.put(gPath,\n                      Pair.newPair(pathAndContent.getValue(),\n                                   objectId));\n            return paths;\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    private static Set<String> searchPathsToDelete(final Git git,\n                                                   final ObjectId headId,\n                                                   final String gPath) throws java.io.IOException {\n        try (final TreeWalk treeWalk = new TreeWalk(git.getRepository())) {\n            final Set<String> path2delete = new HashSet<>();\n            treeWalk.addTree(new RevWalk(git.getRepository()).parseTree(headId));\n            treeWalk.setRecursive(true);\n            treeWalk.setFilter(PathFilter.create(gPath));\n\n            while (treeWalk.next()) {\n                path2delete.add(treeWalk.getPathString());\n            }\n            return path2delete;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateMoveCommitTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.MoveCommitContent;\n\npublic class CreateMoveCommitTree extends BaseCreateCommitTree<MoveCommitContent> {\n\n    public CreateMoveCommitTree(final Git git,\n                                final ObjectId headId,\n                                final ObjectInserter inserter,\n                                final MoveCommitContent commitContent) {\n        super(git,\n              headId,\n              inserter,\n              commitContent);\n    }\n\n    public Optional<ObjectId> execute() {\n        final Map<String, String> content = commitContent.getContent();\n        final DirCacheEditor editor = DirCache.newInCore().editor();\n        final List<String> pathsAdded = new ArrayList<>();\n\n        try {\n            iterateOverTreeWalk(git,\n                                headId,\n                                (walkPath, hTree) -> {\n                                    final String toPath = content.get(walkPath);\n                                    final DirCacheEntry dcEntry = new DirCacheEntry((toPath == null) ? walkPath : toPath);\n                                    if (!pathsAdded.contains(dcEntry.getPathString())) {\n                                        addToTemporaryInCoreIndex(editor,\n                                                                  dcEntry,\n                                                                  hTree.getEntryObjectId(),\n                                                                  hTree.getEntryFileMode());\n                                        pathsAdded.add(dcEntry.getPathString());\n                                    }\n                                });\n            editor.finish();\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        return buildTree(editor);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRepository.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.apache.commons.io.FileUtils;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.lib.StoredConfig;\nimport org.eclipse.jgit.storage.file.FileRepositoryBuilder;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class CreateRepository {\n\n    private final File repoDir;\n    private final File hookDir;\n    private final KetchLeaderCache leaders;\n    private final boolean sslVerify;\n\n    private static final List<String> HOOK_IGNORED = Arrays.asList(\"system\",\n                                                                   \"dashbuilder\",\n                                                                   \".config\",\n                                                                   \".archetypes\");\n\n    public CreateRepository(final File repoDir) {\n        this(repoDir,\n             null,\n             null,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    public CreateRepository(final File repoDir,\n                            final boolean sslVerify) {\n        this(repoDir,\n             null,\n             null,\n             sslVerify);\n    }\n\n    public CreateRepository(final File repoDir,\n                            final File hookDir) {\n        this(repoDir,\n             hookDir,\n             null,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    public CreateRepository(final File repoDir,\n                            final File hookDir,\n                            final boolean sslVerify) {\n        this(repoDir,\n             hookDir,\n             null,\n             sslVerify);\n    }\n\n    public CreateRepository(final File repoDir,\n                            final File hookDir,\n                            final KetchLeaderCache leaders) {\n        this(repoDir,\n             hookDir,\n             leaders,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    public CreateRepository(final File repoDir,\n                            final File hookDir,\n                            final KetchLeaderCache leaders,\n                            final boolean sslVerify) {\n        this.repoDir = repoDir;\n        this.hookDir = hookDir;\n        this.leaders = leaders;\n        this.sslVerify = sslVerify;\n    }\n\n    public Optional<Git> execute() {\n        try {\n            boolean newRepository = !repoDir.exists();\n            final org.eclipse.jgit.api.Git _git = org.eclipse.jgit.api.Git.init().setBare(true).setDirectory(repoDir).call();\n\n            if (leaders != null) {\n                new WriteConfiguration(_git.getRepository(),\n                                       cfg -> {\n                                           cfg.setInt(\"core\",\n                                                      null,\n                                                      \"repositoryformatversion\",\n                                                      1);\n                                           cfg.setString(\"extensions\",\n                                                         null,\n                                                         \"refsStorage\",\n                                                         \"reftree\");\n                                       }).execute();\n            }\n\n            final Repository repo = new FileRepositoryBuilder()\n                    .setGitDir(repoDir)\n                    .build();\n\n            final org.eclipse.jgit.api.Git git = new org.eclipse.jgit.api.Git(repo);\n\n            setupSSLVerify(repo);\n\n            if (setupGitHooks(newRepository)) {\n                final File repoHookDir = new File(repoDir,\n                                                  \"hooks\");\n\n                try {\n                    FileUtils.copyDirectory(hookDir,\n                                            repoHookDir);\n                } catch (final Exception ex) {\n                    throw new RuntimeException(ex);\n                }\n\n                for (final File file : repoHookDir.listFiles()) {\n                    if (file != null && file.isFile()) {\n                        file.setExecutable(true);\n                    }\n                }\n            }\n\n            return Optional.of(new GitImpl(git,\n                                           leaders));\n        } catch (final Exception ex) {\n            throw new IOException(ex);\n        }\n    }\n\n    private void setupSSLVerify(Repository repo) throws java.io.IOException {\n        StoredConfig config = repo.getConfig();\n        config.setBoolean(\"http\", null, \"sslVerify\", sslVerify);\n        config.save();\n    }\n\n    private boolean setupGitHooks(boolean newRepository) {\n        if (newRepository && hookDir != null) {\n            final String parentName = repoDir.getParentFile().getName();\n            return !HOOK_IGNORED.contains(parentName);\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CreateRevertCommitTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Optional;\n\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent;\n\npublic class CreateRevertCommitTree extends BaseCreateCommitTree<RevertCommitContent> {\n\n    public CreateRevertCommitTree(final Git git,\n                                  final ObjectId headId,\n                                  final ObjectInserter inserter,\n                                  final RevertCommitContent commitContent) {\n        super(git,\n              headId,\n              inserter,\n              commitContent);\n    }\n\n    public Optional<ObjectId> execute() {\n        final DirCacheEditor editor = DirCache.newInCore().editor();\n\n        try {\n            iterateOverTreeWalk(git,\n                                headId,\n                                (walkPath, hTree) -> {\n                                    addToTemporaryInCoreIndex(editor,\n                                                              new DirCacheEntry(walkPath),\n                                                              hTree.getEntryObjectId(),\n                                                              hTree.getEntryFileMode());\n                                });\n\n            editor.finish();\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        return buildTree(editor);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/CustomDiffCommand.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.GitCommand;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.api.errors.NoHeadException;\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.diff.DiffFormatter;\nimport org.eclipse.jgit.dircache.DirCacheIterator;\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.lib.NullProgressMonitor;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.ProgressMonitor;\nimport org.eclipse.jgit.treewalk.AbstractTreeIterator;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.eclipse.jgit.treewalk.FileTreeIterator;\nimport org.eclipse.jgit.treewalk.filter.TreeFilter;\nimport org.eclipse.jgit.util.io.NullOutputStream;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static org.eclipse.jgit.lib.Constants.HEAD;\n\npublic class CustomDiffCommand extends GitCommand<List<DiffEntry>> {\n\n    private final Git git;\n    private AbstractTreeIterator oldTree;\n\n    private AbstractTreeIterator newTree;\n\n    private boolean cached;\n\n    private TreeFilter pathFilter = TreeFilter.ALL;\n\n    private boolean showNameAndStatusOnly;\n\n    private OutputStream out;\n\n    private int contextLines = -1;\n\n    private String sourcePrefix;\n\n    private String destinationPrefix;\n\n    private ProgressMonitor monitor = NullProgressMonitor.INSTANCE;\n\n    /**\n     * @param repo\n     */\n    protected CustomDiffCommand(Git git) {\n        super(git.getRepository());\n        this.git = git;\n    }\n\n    /**\n     * Executes the {@code Diff} command with all the options and parameters\n     * collected by the setter methods (e.g. {@link #setCached(boolean)} of this\n     * class. Each instance of this class should only be used for one invocation\n     * of the command. Don't call this method twice on an instance.\n     * @return a DiffEntry for each path which is different\n     */\n    public List<DiffEntry> call() throws GitAPIException {\n        final DiffFormatter diffFmt;\n        if (out != null && !showNameAndStatusOnly) {\n            diffFmt = new DiffFormatter(new BufferedOutputStream(out));\n        } else {\n            diffFmt = new DiffFormatter(NullOutputStream.INSTANCE);\n        }\n        diffFmt.setRepository(repo);\n        diffFmt.setProgressMonitor(monitor);\n        diffFmt.setDetectRenames(true);\n        try {\n            if (cached) {\n                if (oldTree == null) {\n                    ObjectId head = git.getTreeFromRef(HEAD);\n                    if (head == null) {\n                        throw new NoHeadException(JGitText.get().cannotReadTree);\n                    }\n                    CanonicalTreeParser p = new CanonicalTreeParser();\n                    ObjectReader reader = repo.newObjectReader();\n                    try {\n                        p.reset(reader,\n                                head);\n                    } finally {\n                        reader.close();\n                    }\n                    oldTree = p;\n                }\n                newTree = new DirCacheIterator(repo.readDirCache());\n            } else {\n                if (oldTree == null) {\n                    oldTree = new DirCacheIterator(repo.readDirCache());\n                }\n                if (newTree == null) {\n                    newTree = new FileTreeIterator(repo);\n                }\n            }\n\n            diffFmt.setPathFilter(pathFilter);\n\n            List<DiffEntry> result = diffFmt.scan(oldTree,\n                                                  newTree);\n            if (showNameAndStatusOnly) {\n                return result;\n            } else {\n                if (contextLines >= 0) {\n                    diffFmt.setContext(contextLines);\n                }\n                if (destinationPrefix != null) {\n                    diffFmt.setNewPrefix(destinationPrefix);\n                }\n                if (sourcePrefix != null) {\n                    diffFmt.setOldPrefix(sourcePrefix);\n                }\n                diffFmt.format(result);\n                diffFmt.flush();\n                return result;\n            }\n        } catch (IOException e) {\n            throw new JGitInternalException(e.getMessage(),\n                                            e);\n        } finally {\n            diffFmt.close();\n        }\n    }\n\n    /**\n     * @param cached whether to view the changes you staged for the next commit\n     * @return this instance\n     */\n    public CustomDiffCommand setCached(boolean cached) {\n        this.cached = cached;\n        return this;\n    }\n\n    /**\n     * @param pathFilter parameter, used to limit the diff to the named path\n     * @return this instance\n     */\n    public CustomDiffCommand setPathFilter(TreeFilter pathFilter) {\n        this.pathFilter = pathFilter;\n        return this;\n    }\n\n    /**\n     * @param oldTree the previous state\n     * @return this instance\n     */\n    public CustomDiffCommand setOldTree(AbstractTreeIterator oldTree) {\n        this.oldTree = oldTree;\n        return this;\n    }\n\n    /**\n     * @param newTree the updated state\n     * @return this instance\n     */\n    public CustomDiffCommand setNewTree(AbstractTreeIterator newTree) {\n        this.newTree = newTree;\n        return this;\n    }\n\n    /**\n     * @param showNameAndStatusOnly whether to return only names and status of changed files\n     * @return this instance\n     */\n    public CustomDiffCommand setShowNameAndStatusOnly(boolean showNameAndStatusOnly) {\n        this.showNameAndStatusOnly = showNameAndStatusOnly;\n        return this;\n    }\n\n    /**\n     * @param out the stream to write line data\n     * @return this instance\n     */\n    public CustomDiffCommand setOutputStream(OutputStream out) {\n        this.out = out;\n        return this;\n    }\n\n    /**\n     * Set number of context lines instead of the usual three.\n     * @param contextLines the number of context lines\n     * @return this instance\n     */\n    public CustomDiffCommand setContextLines(int contextLines) {\n        this.contextLines = contextLines;\n        return this;\n    }\n\n    /**\n     * Set the given source prefix instead of \"a/\".\n     * @param sourcePrefix the prefix\n     * @return this instance\n     */\n    public CustomDiffCommand setSourcePrefix(String sourcePrefix) {\n        this.sourcePrefix = sourcePrefix;\n        return this;\n    }\n\n    /**\n     * Set the given destination prefix instead of \"b/\".\n     * @param destinationPrefix the prefix\n     * @return this instance\n     */\n    public CustomDiffCommand setDestinationPrefix(String destinationPrefix) {\n        this.destinationPrefix = destinationPrefix;\n        return this;\n    }\n\n    /**\n     * The progress monitor associated with the diff operation. By default, this\n     * is set to <code>NullProgressMonitor</code>\n     * @param monitor a progress monitor\n     * @return this instance\n     * @see NullProgressMonitor\n     */\n    public CustomDiffCommand setProgressMonitor(ProgressMonitor monitor) {\n        this.monitor = monitor;\n        return this;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/DeleteBranch.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.lib.Ref;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class DeleteBranch {\n\n    private final GitImpl git;\n    private final Ref branch;\n\n    public DeleteBranch(final GitImpl git,\n                        final Ref branch) {\n        this.git = git;\n        this.branch = branch;\n    }\n\n    public void execute() {\n        try {\n            git._branchDelete().setBranchNames(branch.getName()).setForce(true).call();\n        } catch (final GitAPIException e) {\n            throw new IOException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/DiffBranches.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.diff.DiffFormatter;\nimport org.eclipse.jgit.diff.Edit;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectLoader;\nimport org.eclipse.jgit.patch.FileHeader;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Implements the Git Diff command between branches for bare repositories.\n * It needs the repository, and the two branches from that repository you want\n * to diff.\n * It returns a list of DiffFile with differences between branches.\n */\npublic class DiffBranches {\n\n    private final Git git;\n    private final String branchA;\n    private final String branchB;\n\n    public DiffBranches(Git git,\n                        String branchA,\n                        String branchB) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.branchA = checkNotEmpty(\"branchA\",\n                                     branchA);\n        this.branchB = checkNotEmpty(\"branchB\",\n                                     branchB);\n    }\n\n    public List<FileDiff> execute() {\n        final List<FileDiff> diffs = new ArrayList<>();\n\n        final List<DiffEntry> result = git.listDiffs(git.getTreeFromRef(this.branchA),\n                                                     git.getTreeFromRef(this.branchB));\n\n        final DiffFormatter formatter = createFormatter();\n\n        result.forEach(elem -> {\n            final FileHeader header = getFileHeader(formatter,\n                                                    elem);\n            header.toEditList().forEach(edit -> diffs.add(createFileDiff(elem,\n                                                                         header,\n                                                                         edit)));\n        });\n\n        return diffs;\n    }\n\n    private FileHeader getFileHeader(final DiffFormatter formatter,\n                                     final DiffEntry elem) {\n        try {\n            return formatter.toFileHeader(elem);\n        } catch (IOException e) {\n            throw new GitException(\"A problem occurred when trying to obtain diffs between files\",\n                                   e);\n        }\n    }\n\n    private DiffFormatter createFormatter() {\n\n        OutputStream outputStream = new ByteArrayOutputStream();\n        DiffFormatter formatter = new DiffFormatter(outputStream);\n        formatter.setRepository(git.getRepository());\n        return formatter;\n    }\n\n    private FileDiff createFileDiff(final DiffEntry elem,\n                                    final FileHeader header,\n                                    final Edit edit) {\n        try {\n            final String changeType = header.getChangeType().toString();\n            final int startA = edit.getBeginA();\n            final int endA = edit.getEndA();\n            final int startB = edit.getBeginB();\n            final int endB = edit.getEndB();\n\n            String pathA = header.getOldPath();\n            String pathB = header.getNewPath();\n\n            final List<String> linesA = getLines(elem.getOldId().toObjectId(),\n                                                 startA,\n                                                 endA);\n            final List<String> linesB = getLines(elem.getNewId().toObjectId(),\n                                                 startB,\n                                                 endB);\n\n            return new FileDiff(pathA,\n                                pathB,\n                                startA,\n                                endA,\n                                startB,\n                                endB,\n                                changeType,\n                                linesA,\n                                linesB);\n        } catch (IOException e) {\n            throw new GitException(\"A problem occurred when trying to obtain diffs between files\",\n                                   e);\n        }\n    }\n\n    private List<String> getLines(final ObjectId id,\n                                  final int fromStart,\n                                  final int fromEnd) throws IOException {\n        List<String> lines = new ArrayList<>();\n        if (!id.equals(ObjectId.zeroId())) {\n            final ByteArrayOutputStream stream = new ByteArrayOutputStream();\n            final ObjectLoader loader = git.getRepository().open(id);\n            loader.copyTo(stream);\n            final String content = stream.toString();\n            final List<String> filteredLines = Arrays.asList(content.split(\"\\n\"));\n            lines = filteredLines.subList(fromStart,\n                                          fromEnd);\n        }\n        return lines;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fetch.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class Fetch {\n\n    private final GitImpl git;\n    private final CredentialsProvider credentialsProvider;\n    private final Pair<String, String> remote;\n    private final Collection<RefSpec> refSpecs;\n\n    public Fetch(final GitImpl git,\n                 final CredentialsProvider credentialsProvider,\n                 final Collection<RefSpec> refSpecs) {\n        this.git = git;\n        this.credentialsProvider = credentialsProvider;\n        this.refSpecs = refSpecs;\n        this.remote = Pair.newPair(\"origin\",\n                                   null);\n    }\n\n    public Fetch(final GitImpl git,\n                 final CredentialsProvider credentialsProvider,\n                 final Pair<String, String> remote,\n                 final Collection<RefSpec> refSpecs) {\n        this.git = git;\n        this.credentialsProvider = credentialsProvider;\n        this.remote = remote;\n        this.refSpecs = refSpecs;\n    }\n\n    public void execute() throws InvalidRemoteException {\n        try {\n            final List<RefSpec> specs = git.updateRemoteConfig(remote,\n                                                               refSpecs);\n\n            git._fetch()\n                    .setCredentialsProvider(credentialsProvider)\n                    .setRemote(remote.getK1())\n                    .setRefSpecs(specs)\n                    .call();\n        } catch (final InvalidRemoteException e) {\n            throw e;\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Fork.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\nimport java.io.File;\nimport java.util.List;\n\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\npublic class Fork {\n\n    private static final String DOT_GIT_EXT = \".git\";\n    private final KetchLeaderCache leaders;\n    private Logger logger = LoggerFactory.getLogger(Fork.class);\n\n    private File parentFolder;\n    private final String source;\n    private final String target;\n    private final List<String> branches;\n    private CredentialsProvider credentialsProvider;\n    private final File hookDir;\n    private final boolean sslVerify;\n\n    public Fork(final File parentFolder,\n                final String source,\n                final String target,\n                final List<String> branches,\n                final CredentialsProvider credentialsProvider,\n                final KetchLeaderCache leaders,\n                final File hookDir) {\n\n        this(parentFolder,\n             source,\n             target,\n             branches,\n             credentialsProvider,\n             leaders,\n             hookDir,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n\n    public Fork(final File parentFolder,\n                final String source,\n                final String target,\n                final List<String> branches,\n                final CredentialsProvider credentialsProvider,\n                final KetchLeaderCache leaders,\n                final File hookDir,\n                final boolean sslVerify) {\n        this.parentFolder = checkNotNull(\"parentFolder\",\n                                         parentFolder);\n        this.source = checkNotEmpty(\"source\",\n                                    source);\n        this.target = checkNotEmpty(\"target\",\n                                    target);\n        this.branches = branches;\n        this.credentialsProvider = checkNotNull(\"credentialsProvider\",\n                                                credentialsProvider);\n        this.leaders = leaders;\n        \n        this.hookDir = hookDir;\n\n        this.sslVerify = sslVerify;\n    }\n\n    public Git execute()  {\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Forking repository <{}> to <{}>\",\n                         source,\n                         target);\n        }\n\n        final File origin = new File(parentFolder,\n                                     source + DOT_GIT_EXT);\n        final File destination = new File(parentFolder,\n                                          target + DOT_GIT_EXT);\n\n        if (destination.exists()) {\n            String message = String.format(\"Cannot fork because destination repository <%s> already exists\",\n                                           target);\n            logger.error(message);\n            throw new GitException(message);\n        }\n\n        return Git.clone(destination,\n                         origin.toPath().toUri().toString(),\n                         false,\n                         branches,\n                         credentialsProvider,\n                         leaders,\n                         hookDir,\n                         sslVerify);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GarbageCollector.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class GarbageCollector {\n\n    private Logger logger = LoggerFactory.getLogger(GarbageCollector.class);\n\n    private final GitImpl git;\n\n    public GarbageCollector(final GitImpl git) {\n        this.git = git;\n    }\n\n    public void execute() {\n        try {\n            if (!(git.getRepository().getRefDatabase() instanceof RefTreeDatabase)) {\n                git._gc().call();\n            }\n        } catch (GitAPIException | JGitInternalException e) {\n            if (this.logger.isDebugEnabled()) {\n                this.logger.error(\"Garbage collector can't perform this operation right now, please try it later.\",\n                                  e);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetCommit.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class GetCommit {\n\n    private final Git git;\n    private final String commitId;\n\n    public GetCommit(final Git git,\n                     final String commitId) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.commitId = checkNotEmpty(\"commitId\",\n                                      commitId);\n    }\n\n    public RevCommit execute() {\n        final Repository repository = git.getRepository();\n\n        try (final RevWalk revWalk = new RevWalk(repository)) {\n            final ObjectId id = repository.resolve(this.commitId);\n            return id != null ? revWalk.parseCommit(id) : null;\n        } catch (Exception e) {\n            throw new GitException(\"Error when trying to get commit\", e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetCommonAncestorCommit.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.revwalk.filter.RevFilter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class GetCommonAncestorCommit {\n\n    private final Git git;\n    private final RevCommit commitA;\n    private final RevCommit commitB;\n\n    public GetCommonAncestorCommit(final Git git,\n                                   final RevCommit commitA,\n                                   final RevCommit commitB) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.commitA = checkNotNull(\"commitA\",\n                                    commitA);\n        this.commitB = checkNotNull(\"commitB\",\n                                    commitB);\n    }\n\n    public RevCommit execute() {\n        try (final RevWalk revWalk = new RevWalk(git.getRepository())) {\n            final RevCommit validatedCommitA = revWalk.lookupCommit(this.commitA);\n            final RevCommit validatedCommitB = revWalk.lookupCommit(this.commitB);\n\n            revWalk.setRevFilter(RevFilter.MERGE_BASE);\n            revWalk.markStart(validatedCommitA);\n            revWalk.markStart(validatedCommitB);\n            return revWalk.next();\n        } catch (Exception e) {\n            throw new GitException(\"Error when trying to get common ancestor\",\n                                   e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetFirstCommit.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevSort;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class GetFirstCommit {\n\n    private final Git git;\n    private final Ref ref;\n\n    public GetFirstCommit(final Git git,\n                          final String branchName) {\n        this(git,\n             git.getRef(branchName));\n    }\n\n    public GetFirstCommit(final Git git,\n                          final Ref ref) {\n        this.git = git;\n        this.ref = ref;\n    }\n\n    public RevCommit execute() throws IOException {\n        try (final RevWalk rw = new RevWalk(git.getRepository())) {\n            final RevCommit root = rw.parseCommit(ref.getObjectId());\n            rw.sort(RevSort.REVERSE);\n            rw.markStart(root);\n            return rw.next();\n        } catch (final IOException ignored) {\n        }\n        return null;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetLastCommit.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class GetLastCommit {\n\n    private final Git git;\n    private final Ref ref;\n\n    public GetLastCommit(final Git git,\n                         final String branchName) {\n        this(git,\n             git.getRef(branchName));\n    }\n\n    public GetLastCommit(final Git git,\n                         final Ref ref) {\n        this.git = git;\n        this.ref = ref;\n    }\n\n    public RevCommit execute() throws IOException {\n        if (ref == null) {\n            return null;\n        }\n        return git.resolveRevCommit(ref.getTarget().getObjectId());\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetPathInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\n\nimport org.eclipse.jgit.lib.FileMode;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.PathFilter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathType;\n\nimport static org.eclipse.jgit.lib.Constants.OBJ_BLOB;\n\npublic class GetPathInfo {\n\n    private final Git git;\n    private final String branchName;\n    private final String path;\n\n    public GetPathInfo(final Git git,\n                       final String branchName,\n                       final String path) {\n        this.git = git;\n        this.branchName = branchName;\n        this.path = path;\n    }\n\n    public PathInfo execute() throws IOException {\n\n        final String gitPath = PathUtil.normalize(path);\n\n        if (gitPath.isEmpty()) {\n            return new PathInfo(null,\n                                gitPath,\n                                PathType.DIRECTORY);\n        }\n\n        final ObjectId tree = git.getTreeFromRef(branchName);\n        if (tree == null) {\n            return new PathInfo(null,\n                                gitPath,\n                                PathType.NOT_FOUND);\n        }\n        try (final TreeWalk tw = new TreeWalk(git.getRepository())) {\n            tw.setFilter(PathFilter.create(gitPath));\n            tw.reset(tree);\n            while (tw.next()) {\n                if (tw.getPathString().equals(gitPath)) {\n                    if (tw.getFileMode(0).equals(FileMode.TYPE_TREE)) {\n                        return new PathInfo(tw.getObjectId(0),\n                                            gitPath,\n                                            PathType.DIRECTORY);\n                    } else if (tw.getFileMode(0).equals(FileMode.TYPE_FILE) ||\n                            tw.getFileMode(0).equals(FileMode.EXECUTABLE_FILE) ||\n                            tw.getFileMode(0).equals(FileMode.REGULAR_FILE)) {\n                        final long size = tw.getObjectReader().getObjectSize(tw.getObjectId(0),\n                                                                             OBJ_BLOB);\n                        return new PathInfo(tw.getObjectId(0),\n                                            gitPath,\n                                            PathType.FILE,\n                                            size);\n                    }\n                }\n                if (tw.isSubtree()) {\n                    tw.enterSubtree();\n                }\n            }\n        }\n        return new PathInfo(null,\n                            gitPath,\n                            PathType.NOT_FOUND);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetRef.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectIdRef;\nimport org.eclipse.jgit.lib.ObjectLoader;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\n\nimport static org.eclipse.jgit.lib.Constants.OBJ_TREE;\n\npublic class GetRef {\n\n    private final Repository repo;\n    private final String name;\n\n    public GetRef(final Repository repo,\n                  final String name) {\n        this.repo = repo;\n        this.name = name;\n    }\n\n    public Ref execute() {\n        try {\n            final Ref value = repo.getRefDatabase().getRef(name);\n            if (value != null) {\n                return value;\n            }\n            final ObjectId treeRef = repo.resolve(name + \"^{tree}\");\n            if (treeRef != null) {\n                try (final ObjectReader objectReader = repo.getObjectDatabase().newReader()) {\n                    final ObjectLoader loader = objectReader.open(treeRef);\n                    if (loader.getType() == OBJ_TREE) {\n                        return new ObjectIdRef.PeeledTag(Ref.Storage.NEW,\n                                                         name,\n                                                         ObjectId.fromString(name),\n                                                         treeRef);\n                    }\n                }\n\n            }\n        } catch (final Exception ignored) {\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/GetTreeFromRef.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class GetTreeFromRef {\n\n    private final Git git;\n    private final String treeRefName;\n\n    public GetTreeFromRef(final Git git,\n                          final String treeRefName) {\n        this.git = git;\n        this.treeRefName = treeRefName;\n    }\n\n    public ObjectId execute() {\n        final RevCommit commit = git.getLastCommit(treeRefName);\n        if (commit == null) {\n            return null;\n        }\n        return commit.getTree().getId();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ListCommits.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.diff.DiffConfig;\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.lib.AnyObjectId;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.revwalk.FollowFilter;\nimport org.eclipse.jgit.revwalk.RenameCallback;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevSort;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.revwalk.TreeRevFilter;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.PathFilter;\nimport org.eclipse.jgit.treewalk.filter.TreeFilter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\n\nimport static java.util.stream.Collectors.toList;\nimport static java.util.stream.StreamSupport.stream;\n\npublic class ListCommits {\n\n    private final Git git;\n    private final ObjectId startRange;\n    private final ObjectId endRange;\n    private final String path;\n\n    public ListCommits(final Git git,\n                       final Ref ref,\n                       final String path) {\n        this.git = git;\n        this.path = makeRelative(path);\n        this.startRange = null;\n        this.endRange = ref.getObjectId();\n    }\n\n    private static String makeRelative(String path) {\n        return (path != null && path.startsWith(\"/\")) ? path.substring(1) : path;\n    }\n\n    public ListCommits(final GitImpl git,\n                       final ObjectId startRange,\n                       final ObjectId endRange) {\n        this.git = git;\n        this.startRange = startRange;\n        this.endRange = endRange;\n        this.path = null;\n    }\n\n    public CommitHistory execute() throws IOException, GitAPIException {\n        try (final RevWalk rw = buildWalk()) {\n            if (path == null || path.isEmpty()) {\n                return fullCommitHistory(rw);\n            } else {\n                return pathCommitHistory(rw);\n            }\n        }\n    }\n\n    private CommitHistory pathCommitHistory(final RevWalk rw) throws MissingObjectException, IncorrectObjectTypeException, IOException {\n        final Map<AnyObjectId, String> pathByCommit = new HashMap<>();\n        final List<RevCommit> commits = new ArrayList<>();\n        final RenameCaptor renameCaptor = new RenameCaptor();\n        /*\n         * We have to go through all commits and filter ourselves so that we can use the\n         * rename callback to map commits to path renames.\n         */\n        final TreeRevFilter revFilter = createTreeRevFilter(rw, path, renameCaptor);\n        String curPath = path;\n        for (final RevCommit commit : rw) {\n            if (revFilter.include(rw, commit)) {\n                @SuppressWarnings(\"resource\")\n                final TreeWalk tw = new TreeWalk(rw.getObjectReader());\n                tw.setRecursive(true);\n                tw.setFilter(PathFilter.create(curPath));\n                tw.addTree(commit.getTree());\n                // Checks for special case that path wasn't deleted in this commit\n                if (tw.next()) {\n                    commits.add(commit);\n                    // There is a rename to track\n                    pathByCommit.put(commit.getId(), curPath);\n                    if (renameCaptor.hasCaptured()) {\n                        curPath = renameCaptor.getAndReset().getOldPath();\n                    }\n                }\n            }\n        }\n\n        return new CommitHistory(commits, pathByCommit, path);\n    }\n\n    private CommitHistory fullCommitHistory(final RevWalk rw) {\n        final List<RevCommit> commits = stream(rw.spliterator(), false).collect(toList());\n        return new CommitHistory(commits, Collections.emptyMap(), null);\n    }\n\n    private TreeRevFilter createTreeRevFilter(final RevWalk rw, String curPath, final RenameCallback renameCallback) {\n        final FollowFilter followFilter = FollowFilter.create(curPath, git.getRepository().getConfig().get(DiffConfig.KEY));\n        followFilter.setRenameCallback(renameCallback);\n        final TreeRevFilter revFilter = new TreeRevFilter(rw, followFilter);\n        return revFilter;\n    }\n\n    private RevWalk buildWalk() throws GitAPIException, IOException {\n        final RevWalk rw = new RevWalk(git.getRepository());\n        rw.setTreeFilter(TreeFilter.ANY_DIFF);\n        rw.markStart(rw.parseCommit(endRange));\n        rw.sort(RevSort.TOPO);\n        if (startRange != null) {\n            rw.markUninteresting(rw.parseCommit(startRange));\n        }\n\n        return rw;\n    }\n\n    private static class RenameCaptor extends RenameCallback {\n\n        private DiffEntry captured;\n\n        @Override\n        public void renamed(final DiffEntry entry) {\n            captured = entry;\n        }\n\n        public boolean hasCaptured() {\n            return captured != null;\n        }\n\n        public DiffEntry getAndReset() {\n            if (captured == null) {\n                throw new NullPointerException(\"Cannot get DiffEntry when none was captured.\");\n            }\n\n            final DiffEntry retVal = captured;\n            captured = null;\n\n            return retVal;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ListDiffs.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.List;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static java.util.Collections.emptyList;\n\npublic class ListDiffs {\n\n    private final Git git;\n    private final ObjectId oldRef;\n    private final ObjectId newRef;\n\n    public ListDiffs(final Git git,\n                     final ObjectId oldRef,\n                     final ObjectId newRef) {\n        this.git = git;\n        this.oldRef = oldRef;\n        this.newRef = newRef;\n    }\n\n    public List<DiffEntry> execute() {\n        if (newRef == null || git.getRepository() == null) {\n            return emptyList();\n        }\n\n        try (final ObjectReader reader = git.getRepository().newObjectReader()) {\n            CanonicalTreeParser oldTreeIter = new CanonicalTreeParser();\n            if (oldRef != null) {\n                oldTreeIter.reset(reader,\n                                  oldRef);\n            }\n            CanonicalTreeParser newTreeIter = new CanonicalTreeParser();\n            newTreeIter.reset(reader,\n                              newRef);\n            return new CustomDiffCommand(git).setNewTree(newTreeIter).setOldTree(oldTreeIter).setShowNameAndStatusOnly(true).call();\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ListPathContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.PathFilter;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\n\npublic class ListPathContent {\n\n    private final Git git;\n    private final String branchName;\n    private final String path;\n\n    public ListPathContent(final Git git,\n                           final String branchName,\n                           final String path) {\n        this.git = git;\n        this.branchName = branchName;\n        this.path = path;\n    }\n\n    public List<PathInfo> execute() throws IOException {\n\n        final String gitPath = PathUtil.normalize(path);\n        final List<PathInfo> result = new ArrayList<>();\n        final ObjectId tree = git.getTreeFromRef(branchName);\n        if (tree == null) {\n            return result;\n        }\n        try (final TreeWalk tw = new TreeWalk(git.getRepository())) {\n            boolean found = false;\n            if (gitPath.isEmpty()) {\n                found = true;\n            } else {\n                tw.setFilter(PathFilter.create(gitPath));\n            }\n            tw.reset(tree);\n            while (tw.next()) {\n                if (!found && tw.isSubtree()) {\n                    tw.enterSubtree();\n                }\n                if (tw.getPathString().equals(gitPath)) {\n                    found = true;\n                    continue;\n                }\n                if (found) {\n                    result.add(new PathInfo(tw.getObjectId(0),\n                                            tw.getPathString(),\n                                            tw.getFileMode(0)));\n                }\n            }\n            return result;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ListRefs.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\n\npublic class ListRefs {\n\n    private final Repository repo;\n\n    public ListRefs(final Repository repo) {\n        this.repo = repo;\n    }\n\n    public List<Ref> execute() {\n        try {\n            return new ArrayList<>(repo.getRefDatabase().getRefs(\"refs/heads/\").values());\n        } catch (java.io.IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/MapDiffContent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.Files;\nimport java.nio.file.StandardCopyOption;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class MapDiffContent {\n\n    private final Git git;\n    private final String branch;\n    private final String startCommitId;\n    private final String endCommitId;\n\n    public MapDiffContent(final Git git,\n                          final String branch,\n                          final String startCommitId,\n                          final String endCommitId) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.branch = checkNotEmpty(\"branch\",\n                                    branch);\n        this.startCommitId = checkNotEmpty(\"startCommitId\",\n                                           startCommitId);\n        this.endCommitId = checkNotEmpty(\"endCommitId\",\n                                         endCommitId);\n    }\n\n    public Map<String, File> execute() {\n        BranchUtil.existsBranch(git,\n                                branch);\n\n        final RevCommit startCommit = git.getCommit(startCommitId);\n        final RevCommit endCommit = git.getCommit(endCommitId);\n\n        if (startCommit == null || endCommit == null) {\n            throw new GitException(\"Given commit ids cannot be found.\");\n        }\n\n        Map<String, File> content = new HashMap<>();\n\n        final List<DiffEntry> diffs = git.listDiffs(startCommit.getTree(),\n                                                    endCommit.getTree());\n\n        diffs.forEach(entry -> {\n            if (entry.getChangeType() != DiffEntry.ChangeType.DELETE) {\n                try (final InputStream inputStream = git.blobAsInputStream(branch,\n                                                                           entry.getNewPath())) {\n                    final File file = File.createTempFile(\"gitz\",\n                                                          \"woot\");\n\n                    Files.copy(inputStream,\n                               file.toPath(),\n                               StandardCopyOption.REPLACE_EXISTING);\n\n                    content.put(entry.getNewPath(),\n                                file);\n                } catch (IOException e) {\n                    throw new GitException(\"Unable to get content from diffs\", e);\n                }\n            } else {\n                content.put(entry.getOldPath(),\n                            null);\n            }\n        });\n\n        return content;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Merge.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.lib.AnyObjectId;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.merge.MergeStrategy;\nimport org.eclipse.jgit.merge.ThreeWayMerger;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MergeCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MessageCommitInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Implements Git Merge command between branches in a bare repository.\n * Branches needs to be part of the same repository, you cannot merge\n * branches from different repositories (or forks).\n * This command is based on Git Cherry Pick command for a simple fast forward merge,\n * otherwise it will create a merge commit.\n * It returns the list of commits involved in the merge operation.\n */\npublic class Merge {\n\n    private Logger logger = LoggerFactory.getLogger(Merge.class);\n\n    private final Git git;\n    private final String sourceBranch;\n    private final String targetBranch;\n    private final boolean noFastForward;\n    private final boolean squash;\n    private final CommitInfo commitInfo;\n\n    public Merge(final Git git,\n                 final String sourceBranch,\n                 final String targetBranch) {\n        this(git,\n             sourceBranch,\n             targetBranch,\n             false,\n             false,\n             MessageCommitInfo.createMergeMessage(sourceBranch));\n    }\n\n    public Merge(final Git git,\n                 final String sourceBranch,\n                 final String targetBranch,\n                 final boolean noFastForward,\n                 final boolean squash,\n                 final CommitInfo commitInfo) {\n\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.sourceBranch = checkNotEmpty(\"sourceBranch\",\n                                          sourceBranch);\n        this.targetBranch = checkNotEmpty(\"targetBranch\",\n                                          targetBranch);\n        this.noFastForward = noFastForward;\n        this.squash = squash;\n        this.commitInfo = checkNotNull(\"commitInfo\",\n                                       commitInfo);\n    }\n\n    public List<String> execute() {\n        BranchUtil.existsBranch(git,\n                                sourceBranch);\n        BranchUtil.existsBranch(git,\n                                targetBranch);\n\n        final RevCommit lastSourceCommit = git.getLastCommit(sourceBranch);\n        final RevCommit lastTargetCommit = git.getLastCommit(targetBranch);\n\n        final RevCommit commonAncestor = git.getCommonAncestorCommit(sourceBranch,\n                                                                     targetBranch);\n\n        canMerge(git.getRepository(),\n                 commonAncestor,\n                 lastSourceCommit,\n                 lastTargetCommit,\n                 sourceBranch,\n                 targetBranch);\n\n        return proceedMerge(commonAncestor,\n                            lastSourceCommit,\n                            lastTargetCommit);\n    }\n\n    private List<String> proceedMerge(final RevCommit commonAncestor,\n                                      final RevCommit lastSourceCommit,\n                                      final RevCommit lastTargetCommit) {\n        final List<DiffEntry> diffBetweenCommits = git.listDiffs(commonAncestor.getName(),\n                                                                 lastSourceCommit.getName());\n\n        final List<DiffEntry> diffBetweenBranches = diffBetweenCommits.isEmpty() ?\n                Collections.emptyList() : git.listDiffs(git.getTreeFromRef(targetBranch),\n                                                        git.getTreeFromRef(sourceBranch));\n\n        if (diffBetweenBranches.isEmpty()) {\n            logger.info(\"There is nothing to merge from branch {} to {}\",\n                        sourceBranch,\n                        targetBranch);\n            return Collections.emptyList();\n        }\n\n        final List<RevCommit> targetCommits = git.listCommits(commonAncestor,\n                                                              lastTargetCommit);\n\n        return targetCommits.isEmpty() && !noFastForward ?\n                doFastForward(commonAncestor,\n                              lastSourceCommit) : doMerge(commonAncestor,\n                                                          lastSourceCommit,\n                                                          lastTargetCommit);\n    }\n\n    private void canMerge(final Repository repo,\n                          final RevCommit commonAncestor,\n                          final RevCommit sourceCommitTree,\n                          final RevCommit targetCommitTree,\n                          final String sourceBranch,\n                          final String targetBranch) {\n        try {\n            ThreeWayMerger merger = MergeStrategy.RECURSIVE.newMerger(repo,\n                                                                      true);\n            merger.setBase(commonAncestor);\n            boolean canMerge = merger.merge(sourceCommitTree,\n                                            targetCommitTree);\n            if (!canMerge) {\n                throw new GitException(String.format(\"Cannot merge branches from <%s> to <%s>, merge conflicts\",\n                                                     sourceBranch,\n                                                     targetBranch));\n            }\n        } catch (IOException e) {\n            throw new GitException(String.format(\"Cannot merge branches from <%s> to <%s>, merge conflicts\",\n                                                 sourceBranch,\n                                                 targetBranch),\n                                   e);\n        }\n    }\n\n    private List<String> doFastForward(final RevCommit commonAncestor,\n                                       final RevCommit lastSourceCommit) {\n        final List<RevCommit> sourceCommits = git.listCommits(commonAncestor,\n                                                              lastSourceCommit);\n\n        Collections.reverse(sourceCommits);\n\n        final String[] commitsIDs = sourceCommits.stream()\n                .map(AnyObjectId::getName)\n                .toArray(String[]::new);\n\n        git.cherryPick(targetBranch,\n                       commitsIDs);\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Merging commits from <{}> to <{}>\",\n                         sourceBranch,\n                         targetBranch);\n        }\n\n        return Arrays.asList(commitsIDs);\n    }\n\n    private List<String> doMerge(final RevCommit commonAncestorCommit,\n                                 final RevCommit lastSourceCommit,\n                                 final RevCommit lastTargetCommit) {\n        try {\n            final CommitContent commitContent = createCommitContent(commonAncestorCommit,\n                                                                    lastSourceCommit,\n                                                                    lastTargetCommit);\n            final boolean effective = git.commit(targetBranch,\n                                                 commitInfo,\n                                                 false,\n                                                 lastTargetCommit,\n                                                 commitContent);\n\n            if (effective) {\n                return Collections.singletonList(git.getLastCommit(targetBranch).getName());\n            }\n        } catch (Exception e) {\n            logger.error(e.getMessage(), e);\n\n            throw new GitException(String.format(\"Cannot merge branches from <%s> to <%s>\",\n                                                 sourceBranch,\n                                                 targetBranch));\n        }\n\n        return Collections.emptyList();\n    }\n\n    private CommitContent createCommitContent(final RevCommit commonAncestorCommit,\n                                              final RevCommit lastSourceCommit,\n                                              final RevCommit lastTargetCommit) {\n        final Map<String, File> contents = git.mapDiffContent(sourceBranch,\n                                                              commonAncestorCommit.getName(),\n                                                              lastSourceCommit.getName());\n        if (squash) {\n            return new DefaultCommitContent(contents);\n        } else {\n            final List<RevCommit> parents = Arrays.asList(lastTargetCommit, lastSourceCommit);\n            return new MergeCommitContent(contents,\n                                          parents);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/PathUtil.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\npublic class PathUtil {\n\n    public static String normalize(final String path) {\n\n        if (path.equals(\"/\")) {\n            return \"\";\n        }\n\n        final boolean startsWith = path.startsWith(\"/\");\n        final boolean endsWith = path.endsWith(\"/\");\n        if (startsWith && endsWith) {\n            return path.substring(1,\n                                  path.length() - 1);\n        }\n        if (startsWith) {\n            return path.substring(1);\n        }\n        if (endsWith) {\n            return path.substring(0,\n                                  path.length() - 1);\n        }\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Push.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.kie.soup.commons.validation.Preconditions.checkInstanceOf;\n\npublic class Push {\n\n    private final GitImpl git;\n    private final CredentialsProvider credentialsProvider;\n    private final Pair<String, String> remote;\n    private final boolean force;\n    private final Collection<RefSpec> refSpecs;\n\n    public Push(final Git git,\n                final CredentialsProvider credentialsProvider,\n                final Pair<String, String> remote,\n                final boolean force,\n                final Collection<RefSpec> refSpecs) {\n        this.git = checkInstanceOf(\"git\",\n                                   git,\n                                   GitImpl.class);\n        this.credentialsProvider = credentialsProvider;\n        this.remote = checkNotNull(\"remote\",\n                                   remote);\n        this.force = force;\n        this.refSpecs = refSpecs;\n    }\n\n    public void execute() throws InvalidRemoteException {\n        try {\n            final List<RefSpec> specs = new UpdateRemoteConfig(git,\n                                                               remote,\n                                                               refSpecs).execute();\n            git._push()\n                    .setCredentialsProvider(credentialsProvider)\n                    .setRefSpecs(specs)\n                    .setRemote(remote.getK1())\n                    .setForce(force)\n                    .setPushAll()\n                    .call();\n        } catch (final InvalidRemoteException e) {\n            throw e;\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RefTreeUpdateCommand.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.Files;\nimport java.nio.file.StandardCopyOption;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.internal.ketch.Proposal;\nimport org.eclipse.jgit.internal.storage.reftree.Command;\nimport org.eclipse.jgit.internal.storage.reftree.RefTree;\nimport org.eclipse.jgit.internal.storage.reftree.RefTreeDatabase;\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectIdRef;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.RefDatabase;\nimport org.eclipse.jgit.lib.RefUpdate;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.lib.SymbolicRef;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevObject;\nimport org.eclipse.jgit.revwalk.RevTag;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static java.util.concurrent.TimeUnit.MILLISECONDS;\nimport static org.eclipse.jgit.internal.ketch.Proposal.State.QUEUED;\nimport static org.eclipse.jgit.lib.Constants.HEAD;\nimport static org.eclipse.jgit.lib.Constants.MASTER;\nimport static org.eclipse.jgit.lib.Ref.Storage.NETWORK;\nimport static org.eclipse.jgit.transport.ReceiveCommand.Result.NOT_ATTEMPTED;\nimport static org.eclipse.jgit.transport.ReceiveCommand.Result.REJECTED_OTHER_REASON;\n\npublic class RefTreeUpdateCommand {\n\n    private final Git git;\n    private final String name;\n    private final RevCommit commit;\n\n    public RefTreeUpdateCommand(final Git git,\n                                final String branchName,\n                                final RevCommit commit) {\n        this.git = git;\n        this.name = branchName;\n        this.commit = commit;\n    }\n\n    public void execute() throws java.io.IOException, ConcurrentRefUpdateException {\n        update(git.getRepository(),\n               Constants.R_HEADS + name,\n               commit);\n        //this `initialization` aims to be temporary\n        // -> without this cgit can't find master when cloning repos\n        if (name.equals(MASTER) && !git.isHEADInitialized()) {\n            synchronized (git.getRepository()) {\n                symRef(git,\n                       HEAD,\n                       Constants.R_HEADS + name);\n                git.setHeadAsInitialized();\n            }\n        }\n    }\n\n    private void symRef(final Git git,\n                        final String name,\n                        final String dst)\n            throws java.io.IOException {\n        commit(git.getRepository(),\n               null,\n               (reader, tree) -> {\n                   Ref old = tree.exactRef(reader,\n                                           name);\n                   Ref newx = tree.exactRef(reader,\n                                            dst);\n                   final Command n;\n                   if (newx != null) {\n                       n = new Command(old,\n                                       new SymbolicRef(name,\n                                                       newx));\n                   } else {\n                       n = new Command(old,\n                                       new SymbolicRef(name,\n                                                       new ObjectIdRef.Unpeeled(Ref.Storage.NEW,\n                                                                                dst,\n                                                                                null)));\n                   }\n                   return tree.apply(Collections.singleton(n));\n               });\n    }\n\n    private void update(final Repository _repo,\n                        final String _name,\n                        final RevCommit _commit)\n            throws IOException {\n        commit(_repo,\n               _commit,\n               (reader, refTree) -> {\n                   final Ref old = refTree.exactRef(reader,\n                                                    _name);\n                   final List<Command> n = new ArrayList<>(1);\n                   try (RevWalk rw = new RevWalk(_repo)) {\n                       n.add(new Command(old,\n                                         toRef(rw,\n                                               _commit,\n                                               _name,\n                                               true)));\n                       if (git.isKetchEnabled()) {\n                           proposeKetch(n,\n                                        _commit);\n                       }\n                   } catch (final IOException | InterruptedException e) {\n                       String msg = JGitText.get().transactionAborted;\n                       for (Command cmd : n) {\n                           if (cmd.getResult() == NOT_ATTEMPTED) {\n                               cmd.setResult(REJECTED_OTHER_REASON,\n                                             msg);\n                           }\n                       }\n                       throw new GitException(\"Error\");\n                       //log.error(msg, e);\n                   }\n                   return refTree.apply(n);\n               });\n    }\n\n    private void proposeKetch(final List<Command> n,\n                              final RevCommit _commit) throws IOException, InterruptedException {\n        final Proposal proposal = new Proposal(n)\n                .setAuthor(_commit.getAuthorIdent())\n                .setMessage(\"push\");\n        git.getKetchLeader().queueProposal(proposal);\n        if (proposal.isDone()) {\n            // This failed fast, e.g. conflict or bad precondition.\n            throw new GitException(\"Error\");\n        }\n        if (proposal.getState() == QUEUED) {\n            waitForQueue(proposal);\n        }\n        if (!proposal.isDone()) {\n            waitForPropose(proposal);\n        }\n    }\n\n    private void waitForQueue(final Proposal proposal)\n            throws InterruptedException {\n        while (!proposal.awaitStateChange(QUEUED,\n                                          250,\n                                          MILLISECONDS)) {\n            System.out.println(\"waiting queue...\");\n        }\n        switch (proposal.getState()) {\n            case RUNNING:\n            default:\n                break;\n\n            case EXECUTED:\n                break;\n\n            case ABORTED:\n                break;\n        }\n    }\n\n    private void waitForPropose(final Proposal proposal) throws InterruptedException {\n        while (!proposal.await(250,\n                               MILLISECONDS)) {\n            System.out.println(\"waiting propose...\");\n        }\n    }\n\n    private static Ref toRef(final RevWalk rw,\n                             final ObjectId id,\n                             final String name,\n                             final boolean mustExist) throws IOException {\n        if (ObjectId.zeroId().equals(id)) {\n            return null;\n        }\n\n        try {\n            RevObject o = rw.parseAny(id);\n            if (o instanceof RevTag) {\n                RevObject p = rw.peel(o);\n                return new ObjectIdRef.PeeledTag(NETWORK,\n                                                 name,\n                                                 id,\n                                                 p.copy());\n            }\n            return new ObjectIdRef.PeeledNonTag(NETWORK,\n                                                name,\n                                                id);\n        } catch (MissingObjectException e) {\n            if (mustExist) {\n                throw e;\n            }\n            return new ObjectIdRef.Unpeeled(NETWORK,\n                                            name,\n                                            id);\n        }\n    }\n\n    interface BiFunction {\n\n        boolean apply(final ObjectReader reader,\n                      final RefTree refTree) throws IOException;\n    }\n\n    private void commit(final Repository repo,\n                        final RevCommit original,\n                        final BiFunction fun) throws IOException {\n        try (final ObjectReader reader = repo.newObjectReader();\n             final ObjectInserter inserter = repo.newObjectInserter();\n             final RevWalk rw = new RevWalk(reader)) {\n\n            final RefTreeDatabase refdb = (RefTreeDatabase) repo.getRefDatabase();\n            final RefDatabase bootstrap = refdb.getBootstrap();\n            final RefUpdate refUpdate = bootstrap.newUpdate(refdb.getTxnCommitted(),\n                                                            false);\n\n            final CommitBuilder cb = new CommitBuilder();\n            final Ref ref = bootstrap.exactRef(refdb.getTxnCommitted());\n            final RefTree tree;\n            if (ref != null && ref.getObjectId() != null) {\n                tree = RefTree.read(reader,\n                                    rw.parseTree(ref.getObjectId()));\n                cb.setParentId(ref.getObjectId());\n                refUpdate.setExpectedOldObjectId(ref.getObjectId());\n            } else {\n                tree = RefTree.newEmptyTree();\n                refUpdate.setExpectedOldObjectId(ObjectId.zeroId());\n            }\n\n            if (fun.apply(reader,\n                          tree)) {\n                final Ref ref2 = bootstrap.exactRef(refdb.getTxnCommitted());\n                if (ref2 == null || ref2.getObjectId().equals(ref != null ? ref.getObjectId() : null)) {\n                    cb.setTreeId(tree.writeTree(inserter));\n                    if (original != null) {\n                        cb.setAuthor(original.getAuthorIdent());\n                        cb.setCommitter(original.getAuthorIdent());\n                    } else {\n                        final PersonIdent personIdent = new PersonIdent(\"user\",\n                                                                        \"user@example.com\");\n                        cb.setAuthor(personIdent);\n                        cb.setCommitter(personIdent);\n                    }\n                    refUpdate.setNewObjectId(inserter.insert(cb));\n                    inserter.flush();\n                    final RefUpdate.Result result = refUpdate.update(rw);\n                    switch (result) {\n                        case NEW:\n                        case FAST_FORWARD:\n                            break;\n                        default:\n                            throw new RuntimeException(repo.getDirectory() + \" -> \" + result.toString() + \" : \" + refUpdate.getName());\n                    }\n                    final File commited = new File(repo.getDirectory(),\n                                                   refdb.getTxnCommitted());\n                    final File accepted = new File(repo.getDirectory(),\n                                                   refdb.getTxnNamespace() + \"accepted\");\n                    Files.copy(commited.toPath(),\n                               accepted.toPath(),\n                               StandardCopyOption.REPLACE_EXISTING);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RemoveRemote.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport org.eclipse.jgit.lib.RefUpdate;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\npublic class RemoveRemote {\n\n    final PathUtil pathUtil = new PathUtil();\n    private Git git;\n    private String ref;\n    private String remote;\n\n    public RemoveRemote(final Git git,\n                        final String remote,\n                        final String ref) {\n\n        this.git = git;\n        this.ref = ref;\n        this.remote = remote;\n    }\n\n    public void execute() {\n        try {\n            // AF-1715: Cleaning origin to prevent errors while importing the new generated repo.\n            git.getRepository().getConfig().unsetSection(\"remote\",\n                                                         remote);\n            git.getRepository().getConfig().save();\n            RefUpdate updateRef = git.getRepository().updateRef(ref,\n                                                                false);\n            updateRef.setRefLogMessage(ref + \" packed-ref deleted\",\n                                       false);\n            updateRef.setForceUpdate(true);\n            updateRef.delete();\n        } catch (Exception e) {\n            throw new GitException(\"Error when trying to remove remote\",\n                                   e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ResolveObjectIds.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.Ref;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class ResolveObjectIds {\n\n    private final Git git;\n    private final String[] ids;\n\n    public ResolveObjectIds(final Git git,\n                            final String... ids) {\n        this.git = git;\n        this.ids = ids;\n    }\n\n    public List<ObjectId> execute() {\n        final List<ObjectId> result = new ArrayList<>();\n\n        for (final String id : ids) {\n            try {\n                final Ref refName = git.getRef(id);\n                if (refName != null) {\n                    result.add(refName.getObjectId());\n                    continue;\n                }\n\n                try {\n                    final ObjectId _id = ObjectId.fromString(id);\n                    if (git.getRepository().getObjectDatabase().has(_id)) {\n                        result.add(_id);\n                    }\n                } catch (final IllegalArgumentException ignored) {\n                }\n            } catch (final java.io.IOException ignored) {\n            }\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/ResolveRevCommit.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\n\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\n\npublic class ResolveRevCommit {\n\n    private final Repository repo;\n    private final ObjectId objectId;\n\n    public ResolveRevCommit(final Repository repo,\n                            final ObjectId objectId) {\n        this.repo = repo;\n        this.objectId = objectId;\n    }\n\n    public RevCommit execute() throws IOException {\n        try (final ObjectReader reader = repo.newObjectReader()) {\n            return RevCommit.parse(reader.open(objectId).getBytes());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/RevertMerge.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.MergeCommitContent;\nimport org.uberfire.java.nio.fs.jgit.util.model.MessageCommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class RevertMerge {\n\n    private final Git git;\n    private final String sourceBranch;\n    private final String targetBranch;\n    private final String commonAncestorCommitId;\n    private final String mergeCommitId;\n\n    public RevertMerge(final Git git,\n                       final String sourceBranch,\n                       final String targetBranch,\n                       final String commonAncestorCommitId,\n                       final String mergeCommitId) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.sourceBranch = checkNotEmpty(\"sourceBranch\",\n                                          sourceBranch);\n        this.targetBranch = checkNotEmpty(\"targetBranch\",\n                                          targetBranch);\n        this.commonAncestorCommitId = checkNotEmpty(\"commonAncestorCommitId\",\n                                                    commonAncestorCommitId);\n        this.mergeCommitId = checkNotEmpty(\"mergeCommitId\",\n                                           mergeCommitId);\n    }\n\n    public boolean execute() {\n        BranchUtil.existsBranch(git,\n                                sourceBranch);\n        BranchUtil.existsBranch(git,\n                                targetBranch);\n\n        final RevCommit lastSourceCommit = git.getLastCommit(sourceBranch);\n        final RevCommit lastTargetCommit = git.getLastCommit(targetBranch);\n\n        boolean isDone = false;\n\n        if (canRevert(lastSourceCommit,\n                      lastTargetCommit)) {\n\n            git.commit(targetBranch,\n                       MessageCommitInfo.createRevertMergeMessage(sourceBranch),\n                       false,\n                       lastTargetCommit.getParent(0),\n                       new RevertCommitContent(targetBranch));\n\n            final RevCommit newLastTargetCommit = git.getLastCommit(targetBranch);\n\n            final List<RevCommit> parents = Stream.of(lastSourceCommit,\n                                                      newLastTargetCommit).collect(Collectors.toList());\n\n            final Map<String, File> contents = git.mapDiffContent(targetBranch,\n                                                                  lastTargetCommit.getName(),\n                                                                  newLastTargetCommit.getName());\n\n            git.commit(sourceBranch,\n                       MessageCommitInfo.createMergeMessage(targetBranch),\n                       false,\n                       lastSourceCommit,\n                       new MergeCommitContent(contents,\n                                              parents));\n\n            git.commit(sourceBranch,\n                       MessageCommitInfo.createFixMergeReversionMessage(),\n                       false,\n                       git.getLastCommit(sourceBranch).getParent(0),\n                       new RevertCommitContent(sourceBranch));\n\n            isDone = true;\n        }\n\n        return isDone;\n    }\n\n    private boolean canRevert(final RevCommit lastSourceCommit,\n                              final RevCommit lastTargetCommit) {\n        return lastTargetCommit.getParentCount() > 1 &&\n                lastTargetCommit.getName().equals(mergeCommitId) &&\n                lastTargetCommit.getParent(0).getName().equals(commonAncestorCommitId) &&\n                lastTargetCommit.getParent(1).getName().equals(lastSourceCommit.getName());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SimpleRefUpdateCommand.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.text.MessageFormat;\n\nimport org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.RefUpdate;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class SimpleRefUpdateCommand {\n\n    private final Git git;\n    private final String name;\n    private final RevCommit commit;\n\n    public SimpleRefUpdateCommand(final Git git,\n                                  final String branchName,\n                                  final RevCommit commit) {\n        this.git = git;\n        this.name = branchName;\n        this.commit = commit;\n    }\n\n    public void execute() throws IOException, ConcurrentRefUpdateException {\n        final ObjectId headId = git.getLastCommit(Constants.R_HEADS + name);\n        final RefUpdate ru = git.getRepository().updateRef(Constants.R_HEADS + name);\n        if (headId == null) {\n            ru.setExpectedOldObjectId(ObjectId.zeroId());\n        } else {\n            ru.setExpectedOldObjectId(headId);\n        }\n        ru.setNewObjectId(commit.getId());\n        ru.setRefLogMessage(commit.getShortMessage(),\n                            false);\n        forceUpdate(ru,\n                    commit.getId());\n    }\n\n    private void forceUpdate(final RefUpdate ru,\n                             final ObjectId id) throws java.io.IOException, ConcurrentRefUpdateException {\n        final RefUpdate.Result rc = ru.forceUpdate();\n        switch (rc) {\n            case NEW:\n            case FORCED:\n            case FAST_FORWARD:\n            case NO_CHANGE:\n                break;\n            case REJECTED:\n            case LOCK_FAILURE:\n                throw new ConcurrentRefUpdateException(JGitText.get().couldNotLockHEAD,\n                                                       ru.getRef(),\n                                                       rc);\n            default:\n                throw new JGitInternalException(MessageFormat.format(JGitText.get().updatingRefFailed,\n                                                                     Constants.HEAD,\n                                                                     id.toString(),\n                                                                     rc));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/Squash.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.util.Spliterator;\n\nimport org.eclipse.jgit.api.errors.ConcurrentRefUpdateException;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static java.util.stream.StreamSupport.stream;\n\n/**\n * Implements the Git Squash command. It needs the repository were he is going to make the squash,\n * the squash commit message, and the start commit, to know from where he has to squash.\n * It return an Empty Optional because is not necessary to return anything.\n * It throws a {@link GitException} if something bad happens.\n */\npublic class Squash {\n\n    private final String branch;\n    private final GitImpl git;\n    private String squashedCommitMessage;\n    private String startCommitString;\n\n    public Squash(final GitImpl git,\n                  final String branch,\n                  final String startCommitString,\n                  final String squashedCommitMessage) {\n        this.git = git;\n        this.squashedCommitMessage = squashedCommitMessage;\n        this.branch = branch;\n        this.startCommitString = startCommitString;\n    }\n\n    public void execute() {\n        final Repository repo = this.git.getRepository();\n\n        final RevCommit latestCommit = git.getLastCommit(branch);\n        final RevCommit startCommit = checkIfCommitIsPresentAtBranch(this.git,\n                                                                     this.branch,\n                                                                     this.startCommitString);\n\n        RevCommit parent = startCommit;\n        if (startCommit.getParentCount() > 0) {\n            parent = startCommit.getParent(0);\n        }\n\n        final CommitBuilder commitBuilder = new CommitBuilder();\n        commitBuilder.setParentId(parent);\n        commitBuilder.setTreeId(latestCommit.getTree().getId());\n        commitBuilder.setMessage(squashedCommitMessage);\n        commitBuilder.setAuthor(startCommit.getAuthorIdent());\n        commitBuilder.setCommitter(startCommit.getAuthorIdent());\n\n        try (final ObjectInserter odi = repo.newObjectInserter()) {\n            final RevCommit squashedCommit = git.resolveRevCommit(odi.insert(commitBuilder));\n            git.refUpdate(branch,\n                          squashedCommit);\n        } catch (ConcurrentRefUpdateException | IOException e) {\n            throw new GitException(\"Error on executing squash.\",\n                                   e);\n        }\n    }\n\n    /**\n     * It checks if the commit is present on branch logs. If not it throws a {@link GitException}\n     * @param git The git repository\n     * @param branch The branch where it is going to do the search\n     * @param startCommitString The commit it needs to find\n     * @throws {@link GitException} when it cannot find the commit in that branch\n     */\n    private RevCommit checkIfCommitIsPresentAtBranch(final GitImpl git,\n                                                     final String branch,\n                                                     final String startCommitString) {\n\n        try {\n            final ObjectId id = git.getRef(branch).getObjectId();\n            final Spliterator<RevCommit> log = git._log().add(id).call().spliterator();\n            return stream(log,\n                          false)\n                    .filter((elem) -> elem.getName().equals(startCommitString))\n                    .findFirst().orElseThrow(() -> new GitException(\"Commit is not present at branch \" + branch));\n        } catch (GitAPIException | MissingObjectException | IncorrectObjectTypeException e) {\n            throw new GitException(\"A problem occurred when trying to get commit list\",\n                                   e);\n        }\n    }\n}\n\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SubdirectoryClone.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Queue;\nimport java.util.Set;\n\nimport org.eclipse.jgit.api.CreateBranchCommand.SetupUpstreamMode;\nimport org.eclipse.jgit.api.RemoteRemoveCommand;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.InvalidRefNameException;\nimport org.eclipse.jgit.api.errors.RefAlreadyExistsException;\nimport org.eclipse.jgit.api.errors.RefNotFoundException;\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.errors.AmbiguousObjectException;\nimport org.eclipse.jgit.errors.CorruptObjectException;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.errors.UnmergedPathException;\nimport org.eclipse.jgit.internal.ketch.KetchLeaderCache;\nimport org.eclipse.jgit.internal.storage.file.WindowCache;\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.FileMode;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevSort;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.revwalk.filter.RevFilter;\nimport org.eclipse.jgit.storage.file.WindowCacheConfig;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.eclipse.jgit.treewalk.filter.TreeFilter;\nimport org.eclipse.jgit.util.FileUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static java.lang.String.format;\nimport static java.util.stream.Collectors.toList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Copies a single subdirectory of a repository, preserving all relevant history.\n */\npublic class SubdirectoryClone {\n\n    private final File repoDir;\n    private final String origin;\n    private final CredentialsProvider credentialsProvider;\n    private final KetchLeaderCache leaders;\n    private final File hookDir;\n    private final boolean sslVerify;\n\n    private Logger logger = LoggerFactory.getLogger(SubdirectoryClone.class);\n    private List<String> branches;\n    private String subdirectory;\n\n    /**\n     * @param directory Directory for the local target repository (created by this command). Must not be null.\n     * @param origin URI for the repository being cloned. Must not be null.\n     * @param subdirectory The subdirectory within the origin being copied. Must not be null.\n     * @param branches The branches that should be copied. Must not be null.\n     * @param credentialsProvider Provides credentials for the initial cloning of the origin. May be null.\n     * @param leaders Used for initial cloning. May be null.\n     * @param hookDir Used to specify the directory containing the Git Hooks to add to the repository. May be null.\n     */\n    public SubdirectoryClone(final File directory,\n                             final String origin,\n                             final String subdirectory,\n                             final List<String> branches,\n                             final CredentialsProvider credentialsProvider,\n                             final KetchLeaderCache leaders,\n                             final File hookDir) {\n        this(directory,\n             origin,\n             subdirectory,\n             branches,\n             credentialsProvider,\n             leaders,\n             hookDir,\n             JGitFileSystemProviderConfiguration.DEFAULT_GIT_HTTP_SSL_VERIFY);\n    }\n    /**\n     * @param directory Directory for the local target repository (created by this command). Must not be null.\n     * @param origin URI for the repository being cloned. Must not be null.\n     * @param subdirectory The subdirectory within the origin being copied. Must not be null.\n     * @param branches The branches that should be copied. Must not be null.\n     * @param credentialsProvider Provides credentials for the initial cloning of the origin. May be null.\n     * @param leaders Used for initial cloning. May be null.\n     * @param hookDir Used to specify the directory containing the Git Hooks to add to the repository. May be null.\n     * @param sslVerify Used to disable http ssl verify on the repository\n     */\n    public SubdirectoryClone(final File directory,\n                             final String origin,\n                             final String subdirectory,\n                             final List<String> branches,\n                             final CredentialsProvider credentialsProvider,\n                             final KetchLeaderCache leaders,\n                             final File hookDir,\n                             final boolean sslVerify) {\n        this.subdirectory = ensureTrailingSlash(subdirectory);\n        this.branches = branches;\n        this.repoDir = checkNotNull(\"directory\",\n                                    directory);\n        this.origin = checkNotEmpty(\"origin\",\n                                    origin);\n        this.credentialsProvider = credentialsProvider;\n        this.leaders = leaders;\n        this.hookDir = hookDir;\n        this.sslVerify = sslVerify;\n    }\n\n    private static String ensureTrailingSlash(String subdirectory) {\n        if (subdirectory.endsWith(\"/\")) {\n            return subdirectory;\n        } else {\n            return subdirectory + \"/\";\n        }\n    }\n\n    public Git execute() {\n        final Git git = new Clone(repoDir, origin, false, branches, credentialsProvider, leaders, hookDir, sslVerify).execute().get();\n        final Repository repository = git.getRepository();\n\n        try (final ObjectReader reader = repository.newObjectReader();\n                final ObjectInserter inserter = repository.newObjectInserter()) {\n            // Map all transformed commits that are non-empty so that we can properly map parents\n            final Map<ObjectId, ObjectId> commitMap = new HashMap<>();\n            final RevWalk revWalk = createRevWalk(repository, reader);\n            transformBranches(repository, reader, inserter, revWalk, commitMap);\n            overrideBranchNames(repository, revWalk, commitMap);\n\n            removeOriginRemote(repository);\n\n            return git;\n        } catch (Exception e) {\n            String message = String.format(\"Error cloning origin <%s> with subdirectory <%s>.\",\n                                           origin,\n                                           subdirectory);\n            logger.error(message);\n            cleanupDir(git.getRepository().getDirectory());\n            throw new Clone.CloneException(message, e);\n        }\n    }\n\n    private void removeOriginRemote(Repository repository) throws GitAPIException {\n        final org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.wrap(repository);\n        final RemoteRemoveCommand cmd = git.remoteRemove();\n        cmd.setName(origin);\n        cmd.call();\n    }\n\n    private void overrideBranchNames(final Repository repository,\n                           final RevWalk revWalk,\n                           final Map<ObjectId, ObjectId> commitMap) throws AmbiguousObjectException, IncorrectObjectTypeException, IOException, MissingObjectException, GitAPIException, RefAlreadyExistsException, RefNotFoundException, InvalidRefNameException {\n        for (String branchName : branches) {\n            if (branchName.equals(\"HEAD\")) {\n                continue;\n            }\n\n            final ObjectId oldBranchTipId = repository.resolve(branchName);\n            final ObjectId newBranchTipId = closestMappedAncestorOrSelf(commitMap, revWalk.parseCommit(oldBranchTipId))[0];\n            final RevCommit newBranchTip = revWalk.parseCommit(newBranchTipId);\n            org.eclipse.jgit.api.Git.wrap(repository)\n                                    .branchCreate()\n                                    .setName(branchName)\n                                    .setForce(true)\n                                    .setStartPoint(newBranchTip)\n                                    .setUpstreamMode(SetupUpstreamMode.NOTRACK)\n                                    .call();\n        }\n    }\n\n    private void transformBranches(final Repository repository,\n                                   final ObjectReader reader,\n                                   final ObjectInserter inserter,\n                                   final RevWalk revWalk,\n                                   final Map<ObjectId, ObjectId> commitMap) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException, UnmergedPathException {\n        for (final RevCommit commit : revWalk) {\n            try {\n                final Optional<ObjectId> oNewCommitTree = filterCommitTree(reader, inserter, commit);\n                if (oNewCommitTree.isPresent()) {\n                    final ObjectId newCommitTree = oNewCommitTree.get();\n                    final CommitBuilder commitBuilder = generateNewCommit(commitMap, commit, newCommitTree);\n                    final ObjectId newCommitId = inserter.insert(commitBuilder);\n\n                    /*\n                     * We want to prune empty commits (i.e. no changes from parent), which\n                     * will exist whenever an origin commit did not touch files in the subdirectory.\n                     *\n                     * But we don't want to remove merge commits.\n                     */\n                    if (isOrphanCommit(commitBuilder)\n                            || isMergeCommit(commitBuilder)\n                            || isDifferentFromParent(revWalk, commitBuilder)) {\n                        commitMap.put(commit.getId(), newCommitId);\n                    }\n                }\n            } catch (Throwable t) {\n                throw new RuntimeException(String.format(\"Problem occurred for commit [%s].\", commit.getId().name()), t);\n            }\n        }\n    }\n\n    private boolean isOrphanCommit(final CommitBuilder commitBuilder) {\n        return commitBuilder.getParentIds().length == 0;\n    }\n\n    private boolean isDifferentFromParent(final RevWalk revWalk, final CommitBuilder commitBuilder) throws MissingObjectException, IncorrectObjectTypeException, IOException {\n        final ObjectId parentId = commitBuilder.getParentIds()[0];\n        final RevCommit parentCommit = revWalk.parseCommit(parentId);\n        final ObjectId parentTreeId = parentCommit.getTree().getId();\n        final ObjectId commitTreeId = commitBuilder.getTreeId();\n        // A commit with the same tree as its parent has no changes.\n        return !commitTreeId.equals(parentTreeId);\n    }\n\n    private boolean isMergeCommit(final CommitBuilder commitBuilder) {\n        return commitBuilder.getParentIds().length > 1;\n    }\n\n    private Optional<ObjectId> filterCommitTree(final ObjectReader reader,\n                                                final ObjectInserter inserter,\n                                                final RevCommit commit) throws MissingObjectException, IncorrectObjectTypeException, CorruptObjectException, IOException, UnmergedPathException {\n        final DirCache dc = DirCache.newInCore();\n        final DirCacheEditor editor = dc.editor();\n        @SuppressWarnings(\"resource\")\n        final TreeWalk treeWalk = new TreeWalk(reader);\n        int treeId = treeWalk.addTree(commit.getTree());\n        treeWalk.setRecursive(true);\n        boolean empty = true;\n        while (treeWalk.next()) {\n            final String pathString = treeWalk.getPathString();\n            final CanonicalTreeParser treeParser = treeWalk.getTree(treeId, CanonicalTreeParser.class);\n            if (inSubdirectory(pathString)) {\n                moveFromSubdirectoryToRoot(editor, pathString, treeParser);\n                empty = false;\n            }\n        }\n        editor.finish();\n\n        if (empty) {\n            return Optional.empty();\n        } else {\n            return Optional.of(dc.writeTree(inserter));\n        }\n\n    }\n\n    private RevWalk createRevWalk(final Repository repository, final ObjectReader reader) throws MissingObjectException, IncorrectObjectTypeException, IOException {\n        final RevWalk revWalk = new RevWalk(reader);\n        final List<RevCommit> branchTips = getBranchCommits(repository, revWalk);\n        // So that we traverse all branch histories at once\n        revWalk.markStart(branchTips);\n\n        // Gets parents before children\n        revWalk.sort(RevSort.TOPO, true);\n        revWalk.sort(RevSort.REVERSE, true);\n\n        revWalk.setRevFilter(RevFilter.ALL);\n        revWalk.setTreeFilter(TreeFilter.ALL);\n\n        return revWalk;\n    }\n\n    private List<RevCommit> getBranchCommits(final Repository repository, final RevWalk revWalk) {\n        final List<RevCommit> branchTips =\n                branches.stream()\n                        .map(b -> {\n                            try {\n                                return revWalk.parseCommit(repository.resolve(b));\n                            } catch (IOException ioe) {\n                                throw new IllegalArgumentException(format(\"Unable to parse branch [%s] in repository [%s].\",\n                                                                          b,\n                                                                          repository.getDirectory()));\n                            }\n                        })\n                        .collect(toList());\n        return branchTips;\n    }\n\n    private CommitBuilder generateNewCommit(final Map<ObjectId, ObjectId> commitMap, final RevCommit commit, final ObjectId newCommitTree) {\n        final CommitBuilder commitBuilder = new CommitBuilder();\n        commitBuilder.setAuthor(commit.getAuthorIdent());\n        commitBuilder.setCommitter(commit.getCommitterIdent());\n        commitBuilder.setTreeId(newCommitTree);\n        commitBuilder.setMessage(commit.getFullMessage());\n        commitBuilder.setEncoding(commit.getEncoding());\n        final ObjectId[] newParentIds = closestMappedAncestorOrSelf(commitMap, commit.getParents());\n        if (newParentIds.length > 0) {\n            commitBuilder.setParentIds(newParentIds);\n        }\n\n        return commitBuilder;\n    }\n\n    private ObjectId[] closestMappedAncestorOrSelf(final Map<ObjectId, ObjectId> commitMap, final RevCommit... start) {\n        final Queue<RevCommit> commitQueue = new LinkedList<>();\n        final Set<ObjectId> processed = new HashSet<>();\n        commitQueue.addAll(Arrays.asList(start));\n\n        final List<ObjectId> results = new ArrayList<>();\n\n        while (!commitQueue.isEmpty()) {\n            final RevCommit cur = commitQueue.poll();\n            if (!processed.contains(cur.getId())) {\n                final ObjectId mappedId = commitMap.get(cur.getId());\n\n                // Ancestors not mapped must have been empty commits, that we ignore.\n                if (mappedId != null) {\n                    results.add(mappedId);\n                } else {\n                    Arrays.stream(cur.getParents())\n                          .forEach(p -> commitQueue.add(p));\n                }\n                processed.add(cur.getId());\n            }\n        }\n\n        return results.toArray(new ObjectId[results.size()]);\n    }\n\n    private void moveFromSubdirectoryToRoot(final DirCacheEditor editor, final String pathString, final CanonicalTreeParser treeParser) {\n        final String newPath = pathString.substring(subdirectory.length());\n        final ObjectId entryObjectId = treeParser.getEntryObjectId();\n        final FileMode entryFileMode = treeParser.getEntryFileMode();\n        editor.add(new DirCacheEditor.PathEdit(new DirCacheEntry(newPath)) {\n\n            @Override\n            public void apply(DirCacheEntry ent) {\n                ent.setObjectId(entryObjectId);\n                ent.setFileMode(entryFileMode);\n            }\n        });\n    }\n\n    private boolean inSubdirectory(final String pathString) {\n        return pathString.startsWith(subdirectory);\n    }\n\n    private void cleanupDir(final File gitDir) {\n\n        try {\n            if (System.getProperty(\"os.name\").toLowerCase().contains(\"windows\")) {\n                //this operation forces a cache clean freeing any lock -> windows only issue!\n                WindowCache.reconfigure(new WindowCacheConfig());\n            }\n            FileUtils.delete(gitDir,\n                             FileUtils.RECURSIVE | FileUtils.RETRY);\n        } catch (java.io.IOException e) {\n            throw new org.uberfire.java.nio.IOException(\"Failed to remove the git repository.\",\n                                                        e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/SyncRemote.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.eclipse.jgit.api.CreateBranchCommand;\nimport org.eclipse.jgit.api.ListBranchCommand;\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.Ref;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\npublic class SyncRemote {\n\n    private final GitImpl git;\n    private final Pair<String, String> remote;\n\n    public SyncRemote(final GitImpl git,\n                      final Pair<String, String> remote) {\n        this.git = git;\n        this.remote = remote;\n    }\n\n    public Optional execute() throws InvalidRemoteException {\n        try {\n            final List<Ref> branches = git._branchList().setListMode(ListBranchCommand.ListMode.ALL).call();\n            final Set<String> remoteBranches = new HashSet<>();\n            final Set<String> localBranches = new HashSet<>();\n            fillBranches(branches, remoteBranches, localBranches);\n\n            /*\n             * We filter out HEAD below because otherwise it appears\n             * as a branch in the UI importing repositories.\n             *\n             * We may need to revisit this in the future when we support\n             * mirror repositories.\n             */\n\n            for (final String localBranch : localBranches) {\n                if (localBranch.equals(Constants.HEAD)) {\n                    continue;\n                }\n                if (remoteBranches.contains(localBranch)) {\n                    try {\n                        git._branchCreate()\n                        .setName(localBranch)\n                        .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM)\n                        .setStartPoint(remote.getK1() + \"/\" + localBranch)\n                        .setForce(true)\n                        .call();\n                    } catch (Throwable t) {\n                        throw new RuntimeException(\"Error creating branch [\" + localBranch + \"].\");\n                    }\n                }\n            }\n\n            remoteBranches.removeAll(localBranches);\n\n            for (final String branch : remoteBranches) {\n                if (branch.equals(Constants.HEAD)) {\n                    continue;\n                }\n                try {\n                    git._branchCreate()\n                    .setName(branch)\n                    .setUpstreamMode(CreateBranchCommand.SetupUpstreamMode.SET_UPSTREAM)\n                    .setStartPoint(remote.getK1() + \"/\" + branch)\n                    .setForce(true)\n                    .call();\n                } catch (Throwable t) {\n                    throw new RuntimeException(\"Error creating branch [\" + branch + \"].\");\n                }\n            }\n            return null;\n        } catch (final InvalidRemoteException e) {\n            throw e;\n        } catch (final RuntimeException re) {\n            throw re;\n        } catch (final Exception ex) {\n            throw new RuntimeException(ex);\n        }\n    }\n\n    void fillBranches(final List<Ref> branches,\n                      final Collection<String> remoteBranches,\n                      final Collection<String> localBranches) {\n        for (final Ref branch : branches) {\n            final String branchFullName = branch.getName();\n            final String remotePrefix = \"refs/remotes/\" + remote.getK1() + \"/\";\n            final String localPrefix = \"refs/heads/\";\n\n            if (branchFullName.startsWith(remotePrefix)) {\n                remoteBranches.add(branchFullName.replaceFirst(remotePrefix, \"\"));\n            } else if (branchFullName.startsWith(localPrefix)) {\n                localBranches.add(branchFullName.replaceFirst(localPrefix, \"\"));\n            } else {\n                localBranches.add(branchFullName.substring(branchFullName.lastIndexOf(\"/\") + 1));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/TextualDiffBranches.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Collectors;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.diff.DiffFormatter;\nimport org.eclipse.jgit.lib.ObjectReader;\nimport org.eclipse.jgit.patch.FileHeader;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class TextualDiffBranches {\n\n    private final Git git;\n    private final String branchA;\n    private final String branchB;\n    private final String commitIdBranchA;\n    private final String commitIdBranchB;\n\n    private static final String DIFF_REGEX_DELIMITER = \"diff --git.*\";\n    private static final String DIFF_KEY = \"diff --git a/%s b/%s\";\n\n    public TextualDiffBranches(final Git git,\n                               final String branchA,\n                               final String branchB) {\n        this(git,\n             branchA,\n             branchB,\n             null,\n             null);\n    }\n\n    public TextualDiffBranches(final Git git,\n                               final String branchA,\n                               final String branchB,\n                               final String commitIdBranchA,\n                               final String commitIdBranchB) {\n        this.git = checkNotNull(\"git\",\n                                git);\n        this.branchA = checkNotEmpty(\"branchA\",\n                                     branchA);\n        this.branchB = checkNotEmpty(\"branchB\",\n                                     branchB);\n\n        this.commitIdBranchA = commitIdBranchA;\n        this.commitIdBranchB = commitIdBranchB;\n    }\n\n    public List<TextualDiff> execute() {\n        final DiffFormatter formatter = createFormatter();\n\n        BranchUtil.existsBranch(this.git,\n                                this.branchA);\n        BranchUtil.existsBranch(this.git,\n                                this.branchB);\n\n        try (final ObjectReader reader = git.getRepository().newObjectReader()) {\n\n            final RevCommit commitA = this.commitIdBranchA != null ?\n                    git.getCommit(commitIdBranchA) :\n                    git.getCommonAncestorCommit(branchA,\n                                                branchB);\n\n            final RevCommit commitB = this.commitIdBranchB != null ?\n                    git.getCommit(commitIdBranchB) :\n                    git.getLastCommit(branchB);\n\n            CanonicalTreeParser oldTreeIter = new CanonicalTreeParser();\n            oldTreeIter.reset(reader,\n                              commitA.getTree());\n\n            CanonicalTreeParser newTreeIter = new CanonicalTreeParser();\n            newTreeIter.reset(reader,\n                              commitB.getTree());\n\n            OutputStream out = new ByteArrayOutputStream();\n            List<DiffEntry> diffEntries = new CustomDiffCommand(git)\n                    .setNewTree(newTreeIter)\n                    .setOldTree(oldTreeIter)\n                    .setOutputStream(out)\n                    .call();\n\n            List<String> parts = TextualDiffBranches.splitWithDelimiters(String.valueOf(out),\n                                                                         DIFF_REGEX_DELIMITER);\n\n            Map<String, String> diffMap = new HashMap<>();\n            for (int i = 1, j = 0; i < parts.size(); i += 2, j++) {\n                String diffKey = buildDiffKey(diffEntries.get(j).getChangeType(),\n                                              diffEntries.get(j).getOldPath(),\n                                              diffEntries.get(j).getNewPath());\n\n                diffMap.put(diffKey, parts.get(i));\n            }\n\n            return diffEntries.stream()\n                    .map(entry -> getFileHeader(formatter, entry))\n                    .map(header -> {\n                        int linesAdded = header.toEditList()\n                                .stream().mapToInt(elem -> elem.getEndB() - elem.getBeginB()).sum();\n\n                        int linesDeleted = header.toEditList()\n                                .stream().mapToInt(elem -> elem.getEndA() - elem.getBeginA()).sum();\n\n                        DiffEntry.ChangeType changeType = header.getChangeType();\n\n                        String diffKey = buildDiffKey(changeType,\n                                                      header.getOldPath(),\n                                                      header.getNewPath());\n\n                        String diffText = diffKey + diffMap.get(diffKey);\n\n                        return new TextualDiff(header.getOldPath(),\n                                               header.getNewPath(),\n                                               changeType.toString(),\n                                               linesAdded,\n                                               linesDeleted,\n                                               diffText);\n                    }).collect(Collectors.toList());\n        } catch (final Exception e) {\n            throw new GitException(\"Unable to get textual diff\", e);\n        }\n    }\n\n    private String buildDiffKey(final DiffEntry.ChangeType changeType,\n                                final String oldPath,\n                                final String newPath) {\n        return String.format(DIFF_KEY,\n                             changeType != DiffEntry.ChangeType.ADD ? oldPath : newPath,\n                             changeType != DiffEntry.ChangeType.DELETE ? newPath : oldPath);\n    }\n\n    private DiffFormatter createFormatter() {\n        OutputStream outputStream = new ByteArrayOutputStream();\n        DiffFormatter formatter = new DiffFormatter(outputStream);\n        formatter.setRepository(git.getRepository());\n        return formatter;\n    }\n\n    private FileHeader getFileHeader(final DiffFormatter formatter,\n                                     final DiffEntry elem) {\n        try {\n            return formatter.toFileHeader(elem);\n        } catch (IOException e) {\n            throw new GitException(\"A problem occurred when trying to obtain diffs between files\",\n                                   e);\n        }\n    }\n\n    private static List<String> splitWithDelimiters(String str, String regex) {\n        List<String> parts = new ArrayList<>();\n\n        Pattern p = Pattern.compile(regex);\n        Matcher m = p.matcher(str);\n\n        int lastEnd = 0;\n        while (m.find()) {\n            int start = m.start();\n            if (lastEnd != start) {\n                String nonDelim = str.substring(lastEnd, start);\n                parts.add(nonDelim);\n            }\n            String delim = m.group();\n            parts.add(delim);\n\n            lastEnd = m.end();\n        }\n\n        if (lastEnd != str.length()) {\n            String nonDelim = str.substring(lastEnd);\n            parts.add(nonDelim);\n        }\n\n        return parts;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/UpdateRemoteConfig.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.StoredConfig;\nimport org.eclipse.jgit.transport.RefSpec;\nimport org.eclipse.jgit.transport.RemoteConfig;\nimport org.eclipse.jgit.transport.URIish;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\npublic class UpdateRemoteConfig {\n\n    private final Git git;\n    private final Pair<String, String> remote;\n    private final Collection<RefSpec> refSpecs;\n\n    public UpdateRemoteConfig(final Git git,\n                              final Pair<String, String> remote,\n                              final Collection<RefSpec> refSpecs) {\n        this.git = git;\n        this.remote = remote;\n        this.refSpecs = refSpecs;\n    }\n\n    public List<RefSpec> execute() throws IOException, URISyntaxException {\n        final List<RefSpec> specs = new ArrayList<>();\n        if (refSpecs == null || refSpecs.isEmpty()) {\n            specs.add(new RefSpec(\"+refs/heads/*:refs/remotes/\" + remote.getK1() + \"/*\"));\n            specs.add(new RefSpec(\"+refs/tags/*:refs/tags/*\"));\n            specs.add(new RefSpec(\"+refs/notes/*:refs/notes/*\"));\n        } else {\n            specs.addAll(refSpecs);\n        }\n\n        final StoredConfig config = git.getRepository().getConfig();\n        final String url = config.getString(\"remote\",\n                                            remote.getK1(),\n                                            \"url\");\n        if (url == null) {\n            final RemoteConfig remoteConfig = new RemoteConfig(git.getRepository().getConfig(),\n                                                               remote.getK1());\n            remoteConfig.addURI(new URIish(remote.getK2()));\n            specs.forEach(remoteConfig::addFetchRefSpec);\n            remoteConfig.update(git.getRepository().getConfig());\n            git.getRepository().getConfig().save();\n        }\n        return specs;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/commands/WriteConfiguration.java",
    "content": "package org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.io.IOException;\nimport java.util.function.Consumer;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.lib.StoredConfig;\n\npublic class WriteConfiguration {\n\n    private final Repository repo;\n    private final Consumer<StoredConfig> consumer;\n\n    public WriteConfiguration(final Repository repo,\n                              final Consumer<StoredConfig> consumer) {\n        this.repo = repo;\n        this.consumer = consumer;\n    }\n\n    public void execute() {\n        final StoredConfig cfg = repo.getConfig();\n        consumer.accept(cfg);\n        try {\n            cfg.save();\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/exceptions/ConcurrentRefUpdateException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.exceptions;\n\nimport java.text.MessageFormat;\n\nimport org.eclipse.jgit.internal.JGitText;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.RefUpdate;\n\npublic class ConcurrentRefUpdateException extends GitException {\n\n    private RefUpdate.Result rc;\n    private Ref ref;\n\n    public ConcurrentRefUpdateException(final String message,\n                                        final Ref ref,\n                                        final RefUpdate.Result rc) {\n        super(rc == null ? message : message + \". \" + MessageFormat.format(JGitText.get().refUpdateReturnCodeWas,\n                                                                           new Object[]{rc}));\n        this.rc = rc;\n        this.ref = ref;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/exceptions/GitException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.exceptions;\n\npublic class GitException extends RuntimeException {\n\n    public GitException(final String message) {\n        super(message);\n    }\n\n    public GitException(final String message,\n                        final Throwable t) {\n        super(message,\n              t);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/extensions/JGitFSHooks.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.extensions;\n\nimport java.util.List;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\n\npublic class JGitFSHooks {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(JGitFileSystemImpl.class);\n\n    public static void executeFSHooks(Object fsHook, FileSystemHooks hookType, FileSystemHookExecutionContext ctx) {\n        if(fsHook == null){\n            return;\n        }\n        if (fsHook instanceof List) {\n            List hooks = (List) fsHook;\n            hooks.forEach(h -> executeHook(h, hookType, ctx));\n        } else {\n            executeHook(fsHook, hookType, ctx);\n        }\n    }\n\n    private static void executeHook(Object hook, FileSystemHooks hookType, FileSystemHookExecutionContext ctx) {\n        if (hook instanceof FileSystemHooks.FileSystemHook) {\n            FileSystemHooks.FileSystemHook fsHook = (FileSystemHooks.FileSystemHook) hook;\n            fsHook.execute(ctx);\n        } else {\n            LOGGER.error(\"Error executing FS Hook FS \" + hookType + \" on \" + ctx.getFsName() +\n                                 \". Callback methods should implement FileSystemHooks.FileSystemHook. \");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/CommitContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\npublic interface CommitContent {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/CommitHistory.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.eclipse.jgit.lib.AnyObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\n\npublic class CommitHistory {\n\n    private final List<RevCommit> commits;\n    private final Map<AnyObjectId, String> pathsByCommit;\n    private final String trackedPath;\n\n    public CommitHistory(final List<RevCommit> commits,\n                         final Map<AnyObjectId, String> pathsByCommit,\n                         final String trackedPath) {\n        this.commits = commits;\n        this.pathsByCommit = pathsByCommit;\n        this.trackedPath = trackedPath;\n    }\n\n    public List<RevCommit> getCommits() {\n        return commits;\n    }\n\n    /**\n     * @return The initial file path that was followed, or else the root path (/) if none was given.\n     */\n    public String getTrackedFilePath() {\n        return (trackedPath == null) ? \"/\" : trackedPath;\n    }\n\n    public String trackedFileNameChangeFor(final AnyObjectId commitId) {\n        return Optional.ofNullable(pathsByCommit.get(commitId))\n                       .map(path -> \"/\" + path)\n                       .orElseGet(() -> getTrackedFilePath());\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/CommitInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.util.Date;\nimport java.util.TimeZone;\n\npublic class CommitInfo {\n\n    private final String sessionId;\n    private final String name;\n    private final String email;\n    private final String message;\n    private final TimeZone timeZone;\n    private final Date when;\n\n    public CommitInfo(final String sessionId,\n                      final String name,\n                      final String email,\n                      final String message,\n                      final TimeZone timeZone,\n                      final Date when) {\n        this.sessionId = sessionId;\n        this.name = name;\n        this.email = email;\n        this.message = message;\n        this.timeZone = timeZone;\n        this.when = when;\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getEmail() {\n        return email;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public TimeZone getTimeZone() {\n        return timeZone;\n    }\n\n    public Date getWhen() {\n        return when;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/CopyCommitContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.util.Map;\n\npublic class CopyCommitContent implements CommitContent {\n\n    private final Map<String, String> content;\n\n    public CopyCommitContent(final Map<String, String> content) {\n        this.content = content;\n    }\n\n    public Map<String, String> getContent() {\n        return content;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/DefaultCommitContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.io.File;\nimport java.util.Map;\n\npublic class DefaultCommitContent implements CommitContent {\n\n    private final Map<String, File> content;\n\n    public DefaultCommitContent(final Map<String, File> content) {\n        this.content = content;\n    }\n\n    public Map<String, File> getContent() {\n        return content;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/MergeCommitContent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.io.File;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\n\npublic class MergeCommitContent extends DefaultCommitContent {\n\n    private final List<RevCommit> parents;\n\n    public MergeCommitContent(final Map<String, File> content,\n                              final List<RevCommit> parents) {\n        super(content);\n\n        this.parents = parents;\n    }\n\n    public List<RevCommit> getParents() {\n        return parents;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/MessageCommitInfo.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.util.Date;\nimport java.util.TimeZone;\n\npublic class MessageCommitInfo extends CommitInfo {\n\n    public static final String MERGE_MESSAGE = \"Merge branch '%s'\";\n    public static final String REVERT_MERGE_MESSAGE = \"Revert merge from branch '%s'\";\n    public static final String FIX_REVERT_MERGE_MESSAGE = \"Fix after merge reversion\";\n\n    public MessageCommitInfo(final String message) {\n        this(null,\n             null,\n             null,\n             message,\n             null,\n             null);\n    }\n\n    private MessageCommitInfo(final String sessionId,\n                              final String name,\n                              final String email,\n                              final String message,\n                              final TimeZone timeZone,\n                              final Date when) {\n        super(sessionId,\n              name,\n              email,\n              message,\n              timeZone,\n              when);\n    }\n\n    public static MessageCommitInfo createMergeMessage(final String sourceBranch) {\n        return new MessageCommitInfo(String.format(MERGE_MESSAGE, sourceBranch));\n    }\n\n    public static MessageCommitInfo createRevertMergeMessage(final String sourceBranch) {\n        return new MessageCommitInfo(String.format(REVERT_MERGE_MESSAGE, sourceBranch));\n    }\n\n    public static MessageCommitInfo createFixMergeReversionMessage() {\n        return new MessageCommitInfo(FIX_REVERT_MERGE_MESSAGE);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/MoveCommitContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport java.util.Map;\n\npublic class MoveCommitContent implements CommitContent {\n\n    private final Map<String, String> content;\n\n    public MoveCommitContent(final Map<String, String> content) {\n        this.content = content;\n    }\n\n    public Map<String, String> getContent() {\n        return content;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/PathInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\nimport org.eclipse.jgit.lib.FileMode;\nimport org.eclipse.jgit.lib.ObjectId;\n\nimport static org.eclipse.jgit.lib.FileMode.TYPE_FILE;\n\npublic class PathInfo {\n\n    private final long size;\n    private final ObjectId objectId;\n    private final String path;\n    private final PathType pathType;\n\n    public PathInfo(final ObjectId objectId,\n                    final String path,\n                    final FileMode fileMode) {\n        this(objectId,\n             path,\n             convert(fileMode),\n             -1);\n    }\n\n    public PathInfo(final ObjectId objectId,\n                    final String path,\n                    final FileMode fileMode,\n                    final long size) {\n        this(objectId,\n             path,\n             convert(fileMode));\n    }\n\n    public PathInfo(final ObjectId objectId,\n                    final String path,\n                    final PathType pathType) {\n        this(objectId,\n             path,\n             pathType,\n             -1);\n    }\n\n    public PathInfo(final ObjectId objectId,\n                    final String path,\n                    final PathType pathType,\n                    final long size) {\n        this.objectId = objectId;\n        this.path = path;\n        this.pathType = pathType;\n        this.size = size;\n    }\n\n    private static PathType convert(final FileMode fileMode) {\n        if (fileMode.equals(FileMode.TYPE_TREE)) {\n            return PathType.DIRECTORY;\n        } else if (fileMode.equals(TYPE_FILE)) {\n            return PathType.FILE;\n        }\n        return null;\n    }\n\n    public ObjectId getObjectId() {\n        return objectId;\n    }\n\n    public String getPath() {\n        return path;\n    }\n\n    public PathType getPathType() {\n        return pathType;\n    }\n\n    public long getSize() {\n        return size;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/PathType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\npublic enum PathType {\n    NOT_FOUND,\n    DIRECTORY,\n    FILE\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/util/model/RevertCommitContent.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.model;\n\npublic class RevertCommitContent implements CommitContent {\n\n    private final String refTree;\n\n    public RevertCommitContent(final String refTree) {\n        this.refTree = refTree;\n    }\n\n    public String getRefTree() {\n        return refTree;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemWatchServices.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws;\n\nimport java.io.Serializable;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.concurrent.CopyOnWriteArrayList;\n\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.Watchable;\n\npublic class JGitFileSystemWatchServices implements Serializable {\n\n    private final Collection<JGitWatchService> watchServices = new CopyOnWriteArrayList<>();\n\n    public JGitFileSystemWatchServices() {\n    }\n\n    public WatchService newWatchService(String fsName) {\n        final JGitWatchService ws = new JGitWatchService(fsName,\n                                                         p -> watchServices.remove(p));\n        watchServices.add(ws);\n        return ws;\n    }\n\n    public synchronized void publishEvents(Path watchable,\n                                           List<WatchEvent<?>> elist) {\n        if (watchServices.isEmpty()) {\n            return;\n        }\n\n        for (JGitWatchService ws : watchServices) {\n            ws.publish(new WatchKey() {\n\n                @Override\n                public boolean isValid() {\n                    return true;\n                }\n\n                @Override\n                public List<WatchEvent<?>> pollEvents() {\n                    return new CopyOnWriteArrayList<>(elist);\n                }\n\n                @Override\n                public boolean reset() {\n                    return !watchServices.isEmpty();\n                }\n\n                @Override\n                public void cancel() {\n                }\n\n                @Override\n                public Watchable watchable() {\n                    return watchable;\n                }\n            });\n            synchronized (ws) {\n                ws.notifyAll();\n            }\n        }\n    }\n\n    public void close() {\n        watchServices.forEach(ws -> ws.closeWithoutNotifyParent());\n        watchServices.clear();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManager.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.cluster.ClusterJMSService;\nimport org.uberfire.commons.cluster.ClusterService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.fs.jgit.ws.cluster.JGitEventsBroadcast;\n\npublic class JGitFileSystemsEventsManager {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(JGitFileSystemsEventsManager.class);\n\n    private final Map<String, JGitFileSystemWatchServices> fsWatchServices = new ConcurrentHashMap<>();\n\n    private final ClusterService clusterService;\n\n    JGitEventsBroadcast jGitEventsBroadcast;\n\n    public JGitFileSystemsEventsManager() {\n        clusterService = createClusterJMSService();\n\n        if (clusterService.isAppFormerClustered()) {\n            setupJGitEventsBroadcast();\n        }\n    }\n\n    ClusterService createClusterJMSService() {\n        return new ClusterJMSService();\n    }\n\n    void setupJGitEventsBroadcast() {\n        jGitEventsBroadcast = new JGitEventsBroadcast(clusterService,\n                                                      w -> publishEvents(w.getFsName(),\n                                                                         w.getWatchable(),\n                                                                         w.getEvents(),\n                                                                         false));\n    }\n\n    public WatchService newWatchService(String fsName)\n            throws UnsupportedOperationException, IOException {\n        fsWatchServices.putIfAbsent(fsName,\n                                    createFSWatchServicesManager());\n\n        if (jGitEventsBroadcast != null) {\n            jGitEventsBroadcast.createWatchServiceJMS(fsName);\n        }\n\n        return fsWatchServices.get(fsName).newWatchService(fsName);\n    }\n\n    JGitFileSystemWatchServices createFSWatchServicesManager() {\n        return new JGitFileSystemWatchServices();\n    }\n\n    public void publishEvents(String fsName,\n                              Path watchable,\n                              List<WatchEvent<?>> elist) {\n\n        publishEvents(fsName,\n                      watchable,\n                      elist,\n                      true);\n    }\n\n    public void publishEvents(String fsName,\n                              Path watchable,\n                              List<WatchEvent<?>> elist,\n                              boolean broadcastEvents) {\n\n        JGitFileSystemWatchServices watchService = fsWatchServices.get(fsName);\n\n        if (watchService == null) {\n            return;\n        }\n\n        watchService.publishEvents(watchable,\n                                   elist);\n\n        if (shouldIBroadcast(broadcastEvents)) {\n            jGitEventsBroadcast.broadcast(fsName,\n                                          watchable,\n                                          elist);\n        }\n    }\n\n    private boolean shouldIBroadcast(boolean broadcastEvents) {\n        return broadcastEvents && jGitEventsBroadcast != null;\n    }\n\n    public void close(String name) {\n\n        JGitFileSystemWatchServices watchService = fsWatchServices.get(name);\n\n        if (watchService != null) {\n            try {\n                watchService.close();\n            } catch (final Exception ex) {\n                LOGGER.error(\"Can't close watch service [\" + toString() + \"]\",\n                             ex);\n            }\n        }\n    }\n\n    public void shutdown() {\n        fsWatchServices.keySet().forEach(key -> this.close(key));\n\n        if (jGitEventsBroadcast != null) {\n            jGitEventsBroadcast.close();\n        }\n    }\n\n    JGitEventsBroadcast getjGitEventsBroadcast() {\n        return jGitEventsBroadcast;\n    }\n\n    Map<String, JGitFileSystemWatchServices> getFsWatchServices() {\n        return fsWatchServices;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/JGitWatchEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws;\n\nimport java.net.URI;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\n\npublic class JGitWatchEvent implements WatchEvent {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(JGitWatchEvent.class);\n    private final URI oldPath;\n    private final URI newPath;\n    private final String sessionId;\n    private final String userName;\n    private final String message;\n    private final String changeType;\n\n    public JGitWatchEvent(String sessionId,\n                          String userName,\n                          String message,\n                          String changeType,\n                          Path oldPath,\n                          Path newPath) {\n\n        this.sessionId = sessionId;\n        this.userName = userName;\n        this.message = message;\n        this.changeType = changeType;\n        this.oldPath = oldPath != null ? oldPath.toUri() : null;\n        this.newPath = newPath != null ? newPath.toUri() : null;\n    }\n\n    @Override\n    public WatchEvent.Kind kind() {\n        DiffEntry.ChangeType changeType = DiffEntry.ChangeType.valueOf(this.changeType);\n        switch (changeType) {\n            case ADD:\n            case COPY:\n                return StandardWatchEventKind.ENTRY_CREATE;\n            case DELETE:\n                return StandardWatchEventKind.ENTRY_DELETE;\n            case MODIFY:\n                return StandardWatchEventKind.ENTRY_MODIFY;\n            case RENAME:\n                return StandardWatchEventKind.ENTRY_RENAME;\n            default:\n                throw new RuntimeException(\"Unsupported change type: \" + changeType);\n        }\n    }\n\n    @Override\n    public int count() {\n        return 1;\n    }\n\n    @Override\n    public Object context() {\n        return new WatchContext() {\n\n            @Override\n            public Path getPath() {\n                return newPath != null ? lookup(newPath) : null;\n            }\n\n            @Override\n            public Path getOldPath() {\n                return oldPath != null ? lookup(oldPath) : null;\n            }\n\n            private Path lookup(URI uri) {\n                Path path = null;\n                try {\n                    path = Paths.get(uri);\n                } catch (Exception e) {\n                    LOGGER.error(\"Error trying to translate to path uri: \" + uri);\n                }\n                return path;\n            }\n\n            @Override\n            public String getSessionId() {\n                return sessionId;\n            }\n\n            @Override\n            public String getMessage() {\n                return message;\n            }\n\n            @Override\n            public String getUser() {\n                return userName;\n            }\n        };\n    }\n\n    @Override\n    public String toString() {\n        return \"WatchEvent{\" +\n                \"newPath=\" + newPath +\n                \", oldPath=\" + oldPath +\n                \", sessionId='\" + sessionId + '\\'' +\n                \", userName='\" + userName + '\\'' +\n                \", message='\" + message + '\\'' +\n                \", changeType=\" + changeType +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/JGitWatchService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws;\n\nimport java.util.Queue;\nimport java.util.concurrent.ConcurrentLinkedQueue;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Consumer;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.InterruptedException;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\n\npublic class JGitWatchService implements WatchService {\n\n    private boolean wsClose = false;\n\n    private final Queue<WatchKey> events = new ConcurrentLinkedQueue<>();\n    private final String fsName;\n    private Consumer<JGitWatchService> notifyClose;\n\n    public JGitWatchService(String fsName,\n                            Consumer<JGitWatchService> notifyClose) {\n\n        this.fsName = fsName;\n        this.notifyClose = notifyClose;\n    }\n\n    @Override\n    public WatchKey poll() throws ClosedWatchServiceException {\n        return events.poll();\n    }\n\n    @Override\n    public WatchKey poll(long timeout,\n                         TimeUnit unit) throws ClosedWatchServiceException, org.uberfire.java.nio.file.InterruptedException {\n        return events.poll();\n    }\n\n    @Override\n    public synchronized WatchKey take() throws ClosedWatchServiceException, InterruptedException {\n        while (true) {\n            if (wsClose) {\n                throw new ClosedWatchServiceException(\"This service is closed.\");\n            } else if (events.size() > 0) {\n                return events.poll();\n            } else {\n                try {\n                    this.wait();\n                } catch (final java.lang.InterruptedException e) {\n                }\n            }\n        }\n    }\n\n    @Override\n    public boolean isClose() {\n        return wsClose;\n    }\n\n    @Override\n    public synchronized void close() throws IOException {\n        wsClose = true;\n        notifyAll();\n        notifyClose.accept(this);\n    }\n\n    synchronized void closeWithoutNotifyParent() {\n        wsClose = true;\n        notifyAll();\n    }\n\n    @Override\n    public String toString() {\n        return \"WatchService{\" +\n                \"FileSystem=\" + fsName +\n                '}';\n    }\n\n    public void publish(WatchKey wk) {\n        events.add(wk);\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/cluster/JGitEventsBroadcast.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws.cluster;\n\nimport java.util.List;\nimport java.util.UUID;\nimport java.util.function.Consumer;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.cluster.ClusterService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\n\npublic class JGitEventsBroadcast {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(JGitEventsBroadcast.class);\n    public static final String DEFAULT_APPFORMER_TOPIC = \"default-appformer-topic\";\n\n    private String nodeId = UUID.randomUUID().toString();\n    private Consumer<WatchEventsWrapper> eventsPublisher;\n    private final ClusterService clusterService;\n\n    public JGitEventsBroadcast(ClusterService clusterService,\n                               Consumer<WatchEventsWrapper> eventsPublisher) {\n        this.clusterService = clusterService;\n        this.eventsPublisher = eventsPublisher;\n        setupJMSConnection();\n    }\n\n    private void setupJMSConnection() {\n        clusterService.connect();\n    }\n\n    public void createWatchServiceJMS(String topicName) {\n        clusterService.createConsumer(\n                ClusterService.DestinationType.PubSub,\n                getChannelName(topicName),\n                WatchEventsWrapper.class,\n                (we) -> {\n                    if (!we.getNodeId().equals(nodeId)) {\n                        eventsPublisher.accept(we);\n                    }\n                });\n    }\n\n    public synchronized void broadcast(String fsName,\n                                       Path watchable,\n                                       List<WatchEvent<?>> events) {\n        clusterService.broadcast(ClusterService.DestinationType.PubSub,\n                                 getChannelName(fsName),\n                                 new WatchEventsWrapper(nodeId,\n                                                        fsName,\n                                                        watchable,\n                                                        events));\n    }\n\n    private String getChannelName(String fsName) {\n        String channelName = DEFAULT_APPFORMER_TOPIC;\n        if (fsName.contains(\"/\")) {\n            channelName = fsName.substring(0,\n                                           fsName.indexOf(\"/\"));\n        }\n        return channelName;\n    }\n\n    public void close() {\n        clusterService.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/main/java/org/uberfire/java/nio/fs/jgit/ws/cluster/WatchEventsWrapper.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws.cluster;\n\nimport java.io.Serializable;\nimport java.net.URI;\nimport java.util.List;\n\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.WatchEvent;\n\npublic class WatchEventsWrapper implements Serializable {\n\n    private final String nodeId;\n    private final List<WatchEvent<?>> events;\n    private final URI watchable;\n    private final String fsName;\n\n    public WatchEventsWrapper(String nodeId,\n                              String fsName,\n                              Path watchable,\n                              List<WatchEvent<?>> events) {\n\n        this.nodeId = nodeId;\n        this.fsName = fsName;\n        this.events = events;\n        this.watchable = watchable != null ? watchable.toUri() : null;\n    }\n\n    public String getFsName() {\n        return fsName;\n    }\n\n    public String getNodeId() {\n        return nodeId;\n    }\n\n    public List<WatchEvent<?>> getEvents() {\n        return events;\n    }\n\n    public Path getWatchable() {\n        if (watchable == null) {\n            return null;\n        }\n        try {\n            return Paths.get(watchable);\n        } catch (Exception e) {\n            return null;\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        WatchEventsWrapper that = (WatchEventsWrapper) o;\n\n        if (nodeId != null ? !nodeId.equals(that.nodeId) : that.nodeId != null) {\n            return false;\n        }\n        if (events != null ? !events.equals(that.events) : that.events != null) {\n            return false;\n        }\n        if (watchable != null ? !watchable.equals(that.watchable) : that.watchable != null) {\n            return false;\n        }\n        return fsName != null ? fsName.equals(that.fsName) : that.fsName == null;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = nodeId != null ? nodeId.hashCode() : 0;\n        result = 31 * result + (events != null ? events.hashCode() : 0);\n        result = 31 * result + (watchable != null ? watchable.hashCode() : 0);\n        result = 31 * result + (fsName != null ? fsName.hashCode() : 0);\n        return result;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/AbstractTestInfra.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.FileNotFoundException;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\nimport java.io.UnsupportedEncodingException;\nimport java.net.ServerSocket;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Scanner;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport org.apache.commons.io.IOUtils;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.api.errors.JGitInternalException;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.util.FS_POSIX;\nimport org.eclipse.jgit.util.FileUtils;\nimport org.eclipse.jgit.util.ProcessResult;\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.cluster.ClusterParameters;\nimport org.uberfire.commons.cluster.ConnectionMode;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.DefaultCommitContent;\n\nimport static java.util.stream.Collectors.toMap;\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic abstract class AbstractTestInfra {\n\n    static class TestFile {\n\n        final String path;\n        final String content;\n\n        TestFile(final String path,\n                 final String content) {\n            this.path = path;\n            this.content = content;\n        }\n    }\n\n    private static final String PROTOCOL_SEPARATOR = \"://\";\n\n    private static final Logger logger = LoggerFactory.getLogger(AbstractTestInfra.class);\n\n    protected static final Map<String, Object> EMPTY_ENV = Collections.emptyMap();\n\n    protected static final List<File> tempFiles = new ArrayList<>();\n\n    protected JGitFileSystemProvider provider;\n\n    @Before\n    public void createGitFsProvider() {\n        provider = new JGitFileSystemProvider(getGitPreferences());\n    }\n\n    /*\n     * Default Git preferences suitable for most of the tests. If specific test needs some custom configuration, it needs to\n     * override this method and provide own map of preferences.\n     */\n    public Map<String, String> getGitPreferences() {\n        System.setProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE,\n                           ConnectionMode.NONE.toString());\n        Map<String, String> gitPrefs = new HashMap<>();\n        // disable the daemons by default as they not needed in most of the cases\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.enabled\",\n                     \"false\");\n        gitPrefs.put(\"org.uberfire.nio.git.ssh.enabled\",\n                     \"false\");\n        return gitPrefs;\n    }\n\n    @After\n    public void destroyGitFsProvider() throws IOException {\n        if (provider == null) {\n            // this would mean that setup failed. no need to clean up.\n            return;\n        }\n\n        provider.shutdown();\n\n        if (provider.getGitRepoContainerDir() != null && provider.getGitRepoContainerDir().exists()) {\n            FileUtils.delete(provider.getGitRepoContainerDir(),\n                             FileUtils.RECURSIVE);\n        }\n    }\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            try {\n                FileUtils.delete(tempFile,\n                                 FileUtils.RECURSIVE);\n            } catch (IOException e) {\n            }\n        }\n    }\n\n    protected Git setupGit() throws IOException, GitAPIException {\n        return setupGit(createTempDirectory());\n    }\n\n    protected Git setupGit(final File tempDir) throws IOException, GitAPIException {\n\n        final Git git = Git.createRepository(tempDir);\n\n        new Commit(git,\n                   \"master\",\n                   new CommitInfo(null,\n                                  \"name\",\n                                  \"name@example.com\",\n                                  \"cool1\",\n                                  null,\n                                  null),\n                   false,\n                   null,\n                   new DefaultCommitContent(new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"content\"));\n                       put(\"file2.txt\",\n                           tempFile(\"content2\"));\n                   }})).execute();\n\n        return git;\n    }\n\n    protected static File createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        tempFiles.add(temp);\n\n        return temp;\n    }\n\n    public static File tempFile(final String content) throws IOException {\n        final File file = File.createTempFile(\"bar\",\n                                              \"foo\");\n        final OutputStream out = new FileOutputStream(file);\n\n        if (content != null && !content.isEmpty()) {\n            out.write(content.getBytes());\n            out.flush();\n        }\n\n        out.close();\n        return file;\n    }\n\n    public File tempFile(final byte[] content) throws IOException {\n        final File file = File.createTempFile(\"bar\",\n                                              \"foo\");\n        final FileOutputStream out = new FileOutputStream(file);\n\n        if (content != null && content.length > 0) {\n            out.write(content);\n            out.flush();\n        }\n\n        out.close();\n        return file;\n    }\n\n    public PersonIdent getAuthor() {\n        return new PersonIdent(\"user\",\n                               \"user@example.com\");\n    }\n\n    public static int findFreePort() {\n        int port = 0;\n        try {\n            ServerSocket server = new ServerSocket(0);\n            port = server.getLocalPort();\n            server.close();\n        } catch (IOException e) {\n            Assert.fail(\"Can't find free port!\");\n        }\n        logger.debug(\"Found free port \" + port);\n        return port;\n    }\n\n    protected byte[] loadImage(final String path) throws IOException {\n        final InputStream stream = this.getClass().getClassLoader().getResourceAsStream(path);\n        StringWriter writer = new StringWriter();\n        IOUtils.copy(stream,\n                     writer);\n        return writer.toString().getBytes();\n    }\n\n    static void commit(final Git origin,\n                       final String branchName,\n                       final String message,\n                       final TestFile... testFiles) throws IOException {\n        final Map<String, File> data = Arrays.stream(testFiles)\n                .collect(toMap(f -> f.path,\n                               f -> tmpFile(f.content)));\n        new Commit(origin,\n                   branchName,\n                   \"name\",\n                   \"name@example.com\",\n                   message,\n                   null,\n                   null,\n                   false,\n                   data).execute();\n    }\n\n    public static File tmpFile(final String content) {\n        try {\n            return tempFile(content);\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    static TestFile content(final String path,\n                            final String content) {\n        return new TestFile(path,\n                            content);\n    }\n\n    /**\n     * Creates mock hook in defined hooks directory.\n     *\n     * @param hooksDirectory Directory in which mock hook is created.\n     * @param hookName       Name of the created hook. This is the filename of created hook file.\n     * @throws FileNotFoundException\n     * @throws UnsupportedEncodingException\n     */\n    void writeMockHook(final File hooksDirectory,\n                       final String hookName)\n            throws FileNotFoundException, UnsupportedEncodingException {\n        final PrintWriter writer = new PrintWriter(new File(hooksDirectory,\n                                                            hookName),\n                                                   \"UTF-8\");\n        writer.println(\"# something\");\n        writer.close();\n    }\n\n    /**\n     * Tests if defined hook was executed or not.\n     *\n     * @param gitRepoName    Name of test git repository that is created for committing changes.\n     * @param testedHookName Tested hook name. This hook is checked for its execution.\n     * @param wasExecuted    Expected hook execution state. If true, test expects that defined hook is executed.\n     *                       If false, test expects that defined hook is not executed.\n     * @throws IOException\n     */\n    void testHook(final String gitRepoName,\n                  final String testedHookName,\n                  final boolean wasExecuted) throws IOException {\n        final URI newRepo = URI.create(\"git://\" + gitRepoName);\n\n        final AtomicBoolean hookExecuted = new AtomicBoolean(false);\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        provider.setDetectedFS(new FS_POSIX() {\n            @Override\n            public ProcessResult runHookIfPresent(Repository repox,\n                                                  String hookName,\n                                                  String[] args) throws JGitInternalException {\n                if (hookName.equals(testedHookName)) {\n                    hookExecuted.set(true);\n                }\n                return new ProcessResult(ProcessResult.Status.OK);\n            }\n        });\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@\" + gitRepoName + \"/some/path/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final InputStream inStream = provider.newInputStream(path);\n\n        final String content = new Scanner(inStream).useDelimiter(\"\\\\A\").next();\n\n        inStream.close();\n\n        assertThat(content).isNotNull().isEqualTo(\"my cool content\");\n\n        if (wasExecuted) {\n            assertThat(hookExecuted.get()).isTrue();\n        } else {\n            assertThat(hookExecuted.get()).isFalse();\n        }\n    }\n\n    protected Ref branch(Git origin, String source, String target) throws Exception {\n        final Repository repo = origin.getRepository();\n        return org.eclipse.jgit.api.Git.wrap(repo)\n                .branchCreate()\n                .setName(target)\n                .setStartPoint(source)\n                .call();\n    }\n\n    protected List<Ref> listRefs(final Git cloned) {\n        return new ListRefs(cloned.getRepository()).execute();\n    }\n\n    protected static String multiline(String prefix, String... lines) {\n        return Arrays.stream(lines)\n                .map(s -> prefix + s)\n                .reduce((s1, s2) -> s1 + \"\\n\" + s2)\n                .orElse(\"\");\n    }\n\n    protected static boolean checkProtocolPresent(String hostNames, String protocolName) {\n        final String[] uris = hostNames.toString().split(\"\\\\r?\\\\n\");\n        return Arrays.stream(uris)\n                .map(uri -> uri.substring(0, uri.indexOf(PROTOCOL_SEPARATOR)))\n                .anyMatch(uri -> Objects.equals(uri, protocolName));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitAddRemoteTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.spy;\n\npublic class JGitAddRemoteTest extends AbstractTestInfra {\n\n    private Git git;\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = spy(new CreateRepository(gitSource).execute().get());\n\n        commit(git, \"main\", \"Initial commit\",\n               content(\"file0\", multiline(\"file0\", \"content\")));\n    }\n\n    @Test\n    public void addRemoteTest() {\n        final String url = \"myRemoteUrl\";\n\n        git.addRemote(\"origin\",\n                      url);\n\n        final String expectedUrl = git.getRepository().getConfig().getString(\"remote\",\n                                                                             \"origin\",\n                                                                             \"url\");\n\n        assertThat(url).isSameAs(expectedUrl);\n    }\n\n    @Test(expected = GitException.class)\n    public void addRemoteFailTest() {\n        doThrow(RuntimeException.class).when(git).getRepository();\n\n        git.addRemote(\"origin\",\n                      \"myRemoteUrl\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCacheInvalidationTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.concurrent.TimeUnit;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsCache;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsManager;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\n\nimport static junit.framework.TestCase.assertEquals;\nimport static junit.framework.TestCase.assertNotNull;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.JGIT_CACHE_EVICT_THRESHOLD_DURATION;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.JGIT_CACHE_INSTANCES;\n\npublic class JGitCacheInvalidationTest extends AbstractTestInfra {\n\n    private JGitFileSystemsCache fsCache;\n    private JGitFileSystemsManager fsManager;\n\n    @Before\n    public void createGitFsProvider() {\n        Map<String, String> gitPreferences = getGitPreferences();\n        gitPreferences.put(JGIT_CACHE_EVICT_THRESHOLD_DURATION, \"1\");\n        gitPreferences.put(JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT, TimeUnit.MILLISECONDS.name());\n        gitPreferences.put(JGIT_CACHE_INSTANCES, \"2\");\n        provider = new JGitFileSystemProvider(gitPreferences);\n        fsManager = provider.getFsManager();\n        fsCache = fsManager.getFsCache();\n    }\n\n    @Test\n    public void testTwoInstancesForSameFS() throws IOException {\n        String fs1Name = \"dora\";\n        String fs2Name = \"bento\";\n        String fs3Name = \"bela\";\n\n        final JGitFileSystemProxy fs1 = (JGitFileSystemProxy) provider.newFileSystem(URI.create(\"git://\" + fs1Name),\n                                                                                     EMPTY_ENV);\n        final JGitFileSystemImpl realInstanceFs1 = (JGitFileSystemImpl) fs1.getRealJGitFileSystem();\n\n        final FileSystem fs2 = provider.newFileSystem(URI.create(\"git://\" + fs2Name),\n                                                      EMPTY_ENV);\n        final FileSystem fs3 = provider.newFileSystem(URI.create(\"git://\" + fs3Name),\n                                                      EMPTY_ENV);\n\n        assertThat(fs1).isNotNull();\n        assertThat(fs2).isNotNull();\n        assertThat(fs3).isNotNull();\n\n        //only proxies instances\n        assertThat(fs1).isInstanceOf(JGitFileSystemProxy.class);\n        assertThat(fs2).isInstanceOf(JGitFileSystemProxy.class);\n        assertThat(fs3).isInstanceOf(JGitFileSystemProxy.class);\n\n        //all the fs have suppliers registered\n        assertThat(fsCache.getFileSystems()).contains(fs1.getName());\n        assertThat(fsCache.getFileSystems()).contains(fs2.getName());\n        assertThat(fsCache.getFileSystems()).contains(fs3.getName());\n\n        //only the last two FS are memoized\n        JGitFileSystemsCache.JGitFileSystemsCacheInfo cacheInfo = fsCache.getCacheInfo();\n\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs2.getName());\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName());\n\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).doesNotContain(fs1.getName());\n\n        //a hit on fs1 in order to put him on cache\n        JGitFileSystemProxy anotherInstanceOfFs1Proxy = (JGitFileSystemProxy) fsManager.get(fs1Name);\n        JGitFileSystemImpl anotherInstanceOfFs1 = (JGitFileSystemImpl) anotherInstanceOfFs1Proxy.getRealJGitFileSystem();\n\n        //now fs2 are not memoized\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs1.getName());\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).contains(fs3.getName());\n\n        assertThat(cacheInfo.memoizedFileSystemsCacheKeys()).doesNotContain(fs2.getName());\n\n        //asserting that fs1 and anotherInstanceOfFs1 are instances of the same fs\n        assertThat(realInstanceFs1.getName()).isEqualToIgnoringCase(anotherInstanceOfFs1.getName());\n        //they share the same lock\n        assertThat(realInstanceFs1.getLock()).isEqualTo(anotherInstanceOfFs1.getLock());\n\n        //now lets commit on both instances and read with other one\n        new Commit(realInstanceFs1.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"realInstanceFs1File.txt\",\n                           tempFile(\"dora\"));\n                   }}).execute();\n\n        InputStream stream = provider.newInputStream(anotherInstanceOfFs1.getPath(\"realInstanceFs1File.txt\"));\n        assertNotNull(stream);\n        String content = new Scanner(stream).useDelimiter(\"\\\\A\").next();\n        assertEquals(\"dora\",\n                     content);\n\n        new Commit(anotherInstanceOfFs1.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"anotherInstanceOfFs1File.txt\",\n                           tempFile(\"bento\"));\n                   }}).execute();\n\n        stream = provider.newInputStream(realInstanceFs1.getPath(\"anotherInstanceOfFs1File.txt\"));\n        assertNotNull(stream);\n        content = new Scanner(stream).useDelimiter(\"\\\\A\").next();\n        assertEquals(\"bento\",\n                     content);\n\n        realInstanceFs1.lock();\n        assertThat(realInstanceFs1.hasBeenInUse()).isTrue();\n        assertThat(anotherInstanceOfFs1.hasBeenInUse()).isTrue();\n\n        // Unlock the lock so that cleanup can finish on Windows\n        realInstanceFs1.unlock();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitCloneTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport static java.util.Arrays.asList;\nimport static java.util.stream.Collectors.toSet;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.hooks.PostCommitHook;\nimport org.eclipse.jgit.hooks.PreCommitHook;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.StoredConfig;\nimport org.eclipse.jgit.storage.file.FileBasedConfig;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.junit.Test;\nimport org.uberfire.commons.config.ConfigProperties;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\n\npublic class JGitCloneTest extends AbstractTestInfra {\n\n    private static final String\n            TARGET_GIT = \"target/target\",\n            SOURCE_GIT = \"source/source\";\n\n    @Test\n    public void testToCloneSuccess() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = setupGitRepo(gitSource, null);\n\n        final Git cloned = new Clone(gitTarget,\n                                     gitSource.getAbsolutePath(),\n                                     false,\n                                     null,\n                                     CredentialsProvider.getDefault(),\n                                     null,\n                                     null,\n                                     true).execute().get();\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).hasSize(2);\n        assertEquals(new ListRefs(cloned.getRepository()).execute().size(),\n                     new ListRefs(origin.getRepository()).execute().size());\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/main\");\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(1).getName()).isEqualTo(\"refs/heads/user_branch\");\n    }\n\n    @Test\n    public void cloneShouldOnlyWorksWithEmptyRepos() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = setupGitRepo(gitSource, null);\n\n        final Git cloned = new Clone(gitTarget,\n                                     gitSource.getAbsolutePath(),\n                                     false,\n                                     null,\n                                     CredentialsProvider.getDefault(),\n                                     null,\n                                     null,\n                                     true).execute().get();\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).hasSize(2);\n        assertEquals(new ListRefs(cloned.getRepository()).execute().size(),\n                     new ListRefs(origin.getRepository()).execute().size());\n\n        assertThatThrownBy(() -> new Clone(gitTarget,\n                                           gitSource.getAbsolutePath(),\n                                           false,\n                                           null,\n                                           CredentialsProvider.getDefault(),\n                                           null,\n                                           null,\n                                           true).execute().get())\n                .isInstanceOf(Clone.CloneException.class);\n    }\n\n    @Test\n    public void testCloneWithHookDir() throws IOException, GitAPIException {\n    \tfinal File hooksDir = createTempDirectory();\n\n        writeMockHook(hooksDir, PostCommitHook.NAME);\n        writeMockHook(hooksDir, PreCommitHook.NAME);\n\n    \tfinal File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n\n        final Git origin = setupGitRepo(gitSource, hooksDir);\n\n        final Git cloned = new Clone(gitTarget,\n                                     gitSource.getAbsolutePath(),\n                                     false,\n                                     null,\n                                     CredentialsProvider.getDefault(),\n                                     null,\n                                     hooksDir,\n                                     true).execute().get();\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).hasSize(2);\n        assertEquals(new ListRefs(cloned.getRepository()).execute().size(),\n                     new ListRefs(origin.getRepository()).execute().size());\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/main\");\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(1).getName()).isEqualTo(\"refs/heads/user_branch\");\n\n        boolean foundPreCommitHook = false;\n        boolean foundPostCommitHook = false;\n        File[] hooks = new File(cloned.getRepository().getDirectory(), \"hooks\").listFiles();\n\t\tassertThat(hooks).isNotEmpty().isNotNull();\n\t\tassertThat(hooks.length).isEqualTo(2);\n        for (File hook : hooks) {\n            if (hook.getName().equals(PreCommitHook.NAME)) {\n                foundPreCommitHook = hook.canExecute();\n            } else if (hook.getName().equals(PostCommitHook.NAME)) {\n                foundPostCommitHook = hook.canExecute();\n            }\n        }\n        assertThat(foundPreCommitHook).isTrue();\n        assertThat(foundPostCommitHook).isTrue();\n    }\n\n    private Git setupGitRepo(File gitSource, File hooksDir) throws IOException {\n        final Git origin = new CreateRepository(gitSource, hooksDir, true).execute().get();\n\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n        return origin;\n    }\n\n    @Test\n    public void cloneNotMirrorRepoConfigTest() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = setupGitRepo(gitSource, null);\n\n        boolean isMirror = false;\n        boolean sslVerify = true;\n        final Git clonedNotMirror = new Clone(gitTarget,\n                                              gitSource.getAbsolutePath(),\n                                              isMirror,\n                                              null,\n                                              CredentialsProvider.getDefault(),\n                                              null,\n                                              null,\n                                              sslVerify).execute().get();\n\n        assertThat(clonedNotMirror).isNotNull();\n\n        StoredConfig config = clonedNotMirror.getRepository().getConfig();\n\n        assertNotEquals(Clone.REFS_MIRRORED, config.getString(\"remote\", \"origin\", \"fetch\"));\n        assertNull(config.getString(\"remote\", \"origin\", \"mirror\"));\n        assertEquals(gitSource.getAbsolutePath(), config.getString(\"remote\", \"origin\", \"url\"));\n\n        boolean missingDefaultValue = true;\n        assertEquals(missingDefaultValue, config.getBoolean(\"http\", null, \"sslVerify\", missingDefaultValue));\n    }\n\n    @Test\n    public void cloneMirrorRepoNoSSLVerifyConfigTest() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = setupGitRepo(gitSource, null);\n\n        assertTrue(provider.config.isSslVerify());\n\n        boolean isMirror = true;\n        boolean sslVerify = false;\n        final Git clonedMirror = new Clone(gitTarget,\n                                           gitSource.getAbsolutePath(),\n                                           isMirror,\n                                           null,\n                                           CredentialsProvider.getDefault(),\n                                           null,\n                                           null,\n                                           sslVerify).execute().get();\n\n        assertThat(clonedMirror).isNotNull();\n\n        StoredConfig config = clonedMirror.getRepository().getConfig();\n\n        assertEquals(Clone.REFS_MIRRORED, config.getString(\"remote\", \"origin\", \"fetch\"));\n        assertNull(config.getString(\"remote\", \"origin\", \"mirror\"));\n        assertEquals(gitSource.getAbsolutePath(), config.getString(\"remote\", \"origin\", \"url\"));\n        assertEquals(sslVerify, config.getBoolean(\"http\", null, \"sslVerify\", !sslVerify));\n\n    }\n\n    @Test\n    public void testCloneMultipleBranches() throws Exception {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = setupGitRepo(gitSource, null);\n\n        commit(origin,\n               \"main\",\n               \"first\",\n               content(\"dir1/file.txt\", \"foo\"),\n               content(\"dir2/file2.txt\", \"bar\"),\n               content(\"file3.txt\", \"moogah\"));\n\n        branch(origin, \"main\", \"dev\");\n        commit(origin,\n               \"dev\",\n               \"second\",\n               content(\"dir1/file.txt\", \"foo1\"),\n               content(\"file3.txt\", \"bar1\"));\n\n        branch(origin, \"main\", \"ignored\");\n        commit(origin,\n               \"ignored\",\n               \"third\",\n               content(\"dir1/file.txt\", \"foo2\"));\n\n        final Git cloned = new Clone(gitTarget,\n                                           gitSource.getAbsolutePath(),\n                                           false,\n                                           asList(\"main\", \"dev\"),\n                                           CredentialsProvider.getDefault(),\n                                           null,\n                                           null,\n                                           false).execute().get();\n\n        assertThat(cloned).isNotNull();\n        final Set<String> clonedRefs = listRefs(cloned).stream()\n                .map(ref -> ref.getName())\n                .collect(toSet());\n        assertThat(clonedRefs).hasSize(2);\n        assertThat(clonedRefs).containsExactly(\"refs/heads/main\", \"refs/heads/dev\");\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitConflictBranchesCheckerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitConflictBranchesCheckerTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n    private static final String DEVELOP_BRANCH = \"develop\";\n\n    private static final List<String> TXT_FILES =\n            Stream.of(\"file0\", \"file1\", \"file2\", \"file3\", \"file4\")\n                    .collect(Collectors.toList());\n\n    private static final String[] COMMON_TXT_LINES = {\"Line1\", \"Line2\", \"Line3\", \"Line4\"};\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(0), multiline(TXT_FILES.get(0), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), COMMON_TXT_LINES)));\n\n        new CreateBranch((GitImpl) git, MAIN_BRANCH, DEVELOP_BRANCH).execute();\n    }\n\n    @Test\n    public void testReportConflictsAllFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")));\n\n        commit(git, MAIN_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2ChangedMain\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2ChangedMain\", \"Line3\", \"Line4\")));\n\n        List<String> conflicts = git.conflictBranchesChecker(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(conflicts).isNotEmpty();\n        assertThat(conflicts).hasSize(2);\n        assertThat(conflicts.get(0)).isEqualTo(TXT_FILES.get(1));\n        assertThat(conflicts.get(1)).isEqualTo(TXT_FILES.get(2));\n    }\n\n    @Test\n    public void testReportConflictsSomeFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")));\n\n        commit(git, MAIN_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2ChangedMain\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2\", \"Line3\", \"Line4ChangedMain\")));\n\n        List<String> conflicts = git.conflictBranchesChecker(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(conflicts).isNotEmpty();\n        assertThat(conflicts).hasSize(1);\n        assertThat(conflicts.get(0)).isEqualTo(TXT_FILES.get(1));\n    }\n\n    @Test\n    public void testReportConflictsNoFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2ChangedDev\", \"Line3\", \"Line4\")));\n\n        commit(git, MAIN_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2\", \"Line3\", \"Line4ChangedMain\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2\", \"Line3\", \"Line4ChangedMain\")));\n\n        List<String> conflicts = git.conflictBranchesChecker(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(conflicts).isEmpty();\n    }\n\n    @Test(expected = GitException.class)\n    public void testInvalidBranch() {\n        git.conflictBranchesChecker(MAIN_BRANCH, \"invalid-branch\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitDiffBranchesTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitDiffBranchesTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n    private static final String DEVELOP_BRANCH = \"develop\";\n    private static final String NON_EXISTENT_FILE = \"/dev/null\";\n\n    private static final List<String> TXT_FILES =\n            Stream.of(\"file0\", \"file1\", \"file2\", \"file3\", \"file4\")\n                    .collect(Collectors.toList());\n\n    private static final String[] COMMON_TXT_LINES = {\"Line1\", \"Line2\", \"Line3\", \"Line4\"};\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(0), multiline(TXT_FILES.get(0), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), COMMON_TXT_LINES)));\n\n        new CreateBranch((GitImpl) git, MAIN_BRANCH, DEVELOP_BRANCH).execute();\n    }\n\n    @Test\n    public void testDiffWithAddedFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Adding files\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(2);\n\n        fileDiffs.forEach(diff -> assertThat(diff.getChangeType()).isEqualTo(DiffEntry.ChangeType.ADD.toString()));\n\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(NON_EXISTENT_FILE);\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(TXT_FILES.get(3));\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(4);\n    }\n\n    @Test\n    public void testDiffWithRemovedFile() {\n        new Commit(git, DEVELOP_BRANCH, \"name\", \"name@example.com\", \"Removing file\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(0), null);\n                   }}).execute();\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(1);\n\n        assertThat(fileDiffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.DELETE.toString());\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(0));\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(NON_EXISTENT_FILE);\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(4);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(0);\n    }\n\n    @Test\n    public void testDiffWithUpdatedFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2Changed\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2Changed\", \"Line3\", \"Line4\")));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(2);\n\n        fileDiffs.forEach(diff -> assertThat(diff.getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString()));\n\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(1).getNameB()).isEqualTo(TXT_FILES.get(2));\n    }\n\n    @Test\n    public void testDiffWithUpdateFirstLine() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1),\"Line1Changed\", \"Line2\", \"Line3\", \"Line4\")));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(1);\n        assertThat(fileDiffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(1);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(1);\n    }\n\n    @Test\n    public void testDiffWithUpdateLastLine() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1),\"Line1\", \"Line2\", \"Line3\", \"Line4Changed\")));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(1);\n        assertThat(fileDiffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(3);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(4);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(3);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(4);\n    }\n\n    @Test\n    public void testDiffWithUpdateTwoConsecutiveLines() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1),\"Line1\", \"Line2Changed\", \"Line3Changed\", \"Line4\")));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(1);\n        assertThat(fileDiffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(1);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(3);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(1);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(3);\n    }\n\n    @Test\n    public void testDiffWithUpdateFirstAndLastLines() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1),\"Line1Changed\", \"Line2\", \"Line3\", \"Line4Changed\")));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(2);\n\n        fileDiffs.forEach(diff -> {\n            assertThat(diff.getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n            assertThat(diff.getNameA()).isEqualTo(TXT_FILES.get(1));\n            assertThat(diff.getNameB()).isEqualTo(TXT_FILES.get(1));\n        });\n\n        assertThat(fileDiffs.get(0).getStartA()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndA()).isEqualTo(1);\n        assertThat(fileDiffs.get(0).getStartB()).isEqualTo(0);\n        assertThat(fileDiffs.get(0).getEndB()).isEqualTo(1);\n\n        assertThat(fileDiffs.get(1).getStartA()).isEqualTo(3);\n        assertThat(fileDiffs.get(1).getEndA()).isEqualTo(4);\n        assertThat(fileDiffs.get(1).getStartB()).isEqualTo(3);\n        assertThat(fileDiffs.get(1).getEndB()).isEqualTo(4);\n    }\n\n    @Test\n    public void testDiffWithAddedRemovedUpdatedFiles() throws IOException {\n        new Commit(git, DEVELOP_BRANCH, \"name\", \"name@example.com\", \"Removing file0\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(0), null);\n                   }}).execute();\n\n        commit(git, DEVELOP_BRANCH, \"Updating file1\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2Changed\", \"Line3\", \"Line4\")));\n\n        commit(git, DEVELOP_BRANCH, \"Adding file3\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)));\n\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(3);\n\n        assertThat(fileDiffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.DELETE.toString());\n        assertThat(fileDiffs.get(0).getNameA()).isEqualTo(TXT_FILES.get(0));\n        assertThat(fileDiffs.get(0).getNameB()).isEqualTo(NON_EXISTENT_FILE);\n\n        assertThat(fileDiffs.get(1).getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n        assertThat(fileDiffs.get(1).getNameA()).isEqualTo(TXT_FILES.get(1));\n        assertThat(fileDiffs.get(1).getNameB()).isEqualTo(TXT_FILES.get(1));\n\n        assertThat(fileDiffs.get(2).getChangeType()).isEqualTo(DiffEntry.ChangeType.ADD.toString());\n        assertThat(fileDiffs.get(2).getNameA()).isEqualTo(NON_EXISTENT_FILE);\n        assertThat(fileDiffs.get(2).getNameB()).isEqualTo(TXT_FILES.get(3));\n    }\n\n    @Test\n    public void testDiffWithNonExistentBranch() {\n        List<FileDiff> fileDiffs = git.diffRefs(MAIN_BRANCH, \"nonExistentBranch\");\n\n        assertThat(fileDiffs).isEmpty();\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderAsDefaultTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class JGitFileSystemImplProviderAsDefaultTest extends AbstractTestInfra {\n\n    @Before\n    public void forceProviderToDefault() {\n        provider.forceAsDefault();\n    }\n\n    @Test\n    public void testGetPath() {\n        final URI newRepo = URI.create(\"default://default-new-get-repo-name\");\n\n        FileSystem fs = provider.newFileSystem(newRepo,\n                                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"default://main@default-new-get-repo-name/home\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toString()).isEqualTo(\"/home\");\n        assertThat(path.toUri().getScheme()).isEqualTo(\"default\");\n\n        final Path pathRelative = provider.getPath(URI.create(\"default://main@default-new-get-repo-name/:home\"));\n        assertThat(pathRelative).isNotNull();\n        assertThat(pathRelative.toUri().toString()).isEqualTo(\"default://main@default-new-get-repo-name/:home\");\n        assertThat(pathRelative.getRoot().toString()).isEqualTo(\"\");\n        assertThat(pathRelative.toString()).isEqualTo(\"home\");\n\n        fs.close();\n    }\n\n    @Test\n    public void testGetComplexPath() {\n        final URI newRepo = URI.create(\"default://default-new-complex-get-repo-name\");\n\n        FileSystem fs = provider.newFileSystem(newRepo,\n                                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"default://origin/main@default-new-complex-get-repo-name/home\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toString()).isEqualTo(\"/home\");\n        assertThat(path.toUri().getScheme()).isEqualTo(\"default\");\n\n        final Path pathRelative = provider.getPath(URI.create(\"default://origin/main@default-new-complex-get-repo-name/:home\"));\n        assertThat(pathRelative).isNotNull();\n        assertThat(pathRelative.getRoot().toString()).isEqualTo(\"\");\n        assertThat(pathRelative.getRoot().toUri().toString()).isEqualTo(\"default://origin/main@default-new-complex-get-repo-name\");\n        assertThat(pathRelative.toString()).isEqualTo(\"home\");\n\n        fs.close();\n    }\n\n    @Test\n    public void testGetComplexPathFileSystemNameIncludedInPath() {\n        final URI newRepo = URI.create(\"default://default-new-complex-get-repo-name\");\n\n        FileSystem fs = provider.newFileSystem(newRepo,\n                                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"default://origin/main@default-new-complex-get-repo-name/home/default-new-complex-get-repo-name/somefolder\"));\n\n        assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toString()).isEqualTo(\"/home/default-new-complex-get-repo-name/somefolder\");\n        assertThat(path.toUri().getScheme()).isEqualTo(\"default\");\n\n        fs.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderBytemanTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.lang.reflect.Field;\nimport java.lang.reflect.Method;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.BrokenBarrierException;\nimport java.util.concurrent.CyclicBarrier;\nimport java.util.concurrent.TimeUnit;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.base.options.SquashOption;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetRef;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.JGIT_CACHE_EVICT_THRESHOLD_DURATION;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.JGIT_CACHE_EVICT_THRESHOLD_TIME_UNIT;\n\n@RunWith(org.jboss.byteman.contrib.bmunit.BMUnitRunner.class)\n@BMUnitConfig(loadDirectory = \"target/test-classes\", debug = true) // set \"debug=true to see debug output\npublic class JGitFileSystemImplProviderBytemanTest extends AbstractTestInfra {\n\n    private static Logger logger = LoggerFactory.getLogger(JGitFileSystemImplProviderBytemanTest.class);\n\n    @Before\n    public void createGitFsProvider() {\n        provider = new JGitFileSystemProvider();\n    }\n\n    @Ignore(\"This test produces a strange behaviour that locks the other test. Is ignored until a solution is found.\")\n    @Test()\n    @BMScript(value = \"byteman/squash_lock.btm\")\n    public void testConcurrentLocking() throws IOException, GitAPIException {\n\n        final URI newRepo = URI.create(\"git://byteman-lock-squash-repo\");\n        final JGitFileSystemImpl fs = (JGitFileSystemImpl) provider.newFileSystem(newRepo,\n                                                                                  EMPTY_ENV);\n        final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3);\n\n        final Thread t = new Thread(() -> {\n\n            final Path main = provider.getPath(URI.create(\"git://main@byteman-lock-squash-repo\"));\n            final RevCommit commit = commitThreeTimesAndGetReference(fs,\n                                                                     \"byteman-lock-squash-repo\",\n                                                                     \"main\",\n                                                                     \"t1\");\n\n            Thread t1 = new Thread(() -> {\n                logger.info(\"<<<<<<<<<<<<< \" + commit.getName() + \" --- \" + commit.getFullMessage());\n                printLog(fs.getGit());\n                VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                         \"aparedes@redhat.com\",\n                                                         \"squashing a!\",\n                                                         new Date(),\n                                                         commit.getName());\n                SquashOption squashOption = new SquashOption(record);\n\n                logger.info(\"COMMITTER-1: Squashing\");\n                provider.setAttribute(main,\n                                      SquashOption.SQUASH_ATTR,\n                                      squashOption);\n                printLog(fs.getGit());\n                waitFor(threadsFinishedBarrier);\n            });\n\n            Thread t2 = new Thread(() -> {\n                logger.info(\"<<<<<<<<<<<<< \" + commit.getName() + \" --- \" + commit.getFullMessage());\n                printLog(fs.getGit());\n                VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                         \"aparedes@redhat.com\",\n                                                         \"squashing a!\",\n                                                         new Date(),\n                                                         commit.getName());\n                SquashOption squashOption = new SquashOption(record);\n\n                logger.info(\"COMMITTER-2: Squashing\");\n                provider.setAttribute(main,\n                                      SquashOption.SQUASH_ATTR,\n                                      squashOption);\n                printLog(fs.getGit());\n                waitFor(threadsFinishedBarrier);\n            });\n\n            t1.setName(\"LOCK-COMMITTER-1\");\n            t2.setName(\"LOCK-COMMITTER-2\");\n            t2.start();\n            t1.start();\n\n            waitFor(threadsFinishedBarrier);\n        });\n        try {\n            t.start();\n            t.join(10000);\n            t.interrupt();\n        } catch (InterruptedException e) {\n        }\n\n        assertEquals(3,\n                     getCommitsFromBranch((GitImpl) fs.getGit(),\n                                          \"main\").size());\n    }\n\n    @Test\n    @BMScript(value = \"byteman/squash.btm\")\n    public void testConcurrentSquashWithThreeCommit() throws IOException, GitAPIException {\n        final URI newRepo = URI.create(\"git://three-squash-repo\");\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3);\n        final Path main = provider.getPath(URI.create(\"git://three-squash-repo\"));\n        final RevCommit commit = commitThreeTimesAndGetReference(fs,\n                                                                 \"three-squash-repo\",\n                                                                 \"master\",\n                                                                 \"t1\");\n\n        Thread t1 = new Thread(() -> {\n            logger.info(\"<<<<<<<<<<<<< COMMIT TO SQUASH \" + commit.getName() + \" --- \" + commit.getFullMessage());\n            printLog(fs.getGit());\n            VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                     \"aparedes@redhat.com\",\n                                                     \"squashing a!\",\n                                                     new Date(),\n                                                     commit.getName());\n            SquashOption squashOption = new SquashOption(record);\n            logger.info(\"COMMITTER-1: Squashing\");\n            provider.setAttribute(main,\n                                  SquashOption.SQUASH_ATTR,\n                                  squashOption);\n            printLog(fs.getGit());\n            waitFor(threadsFinishedBarrier);\n        });\n\n        Thread t2 = new Thread(() -> {\n            logger.info(\"<<<<<<<<<<<<< COMMIT TO SQUASH \" + commit.getName() + \" --- \" + commit.getFullMessage());\n            printLog(fs.getGit());\n            VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                     \"aparedes@redhat.com\",\n                                                     \"squashing b!\",\n                                                     new Date(),\n                                                     commit.getName());\n            SquashOption squashOption = new SquashOption(record);\n            logger.info(\"COMMITTER-2: Squashing\");\n            provider.setAttribute(main,\n                                  SquashOption.SQUASH_ATTR,\n                                  squashOption);\n            printLog(fs.getGit());\n            waitFor(threadsFinishedBarrier);\n        });\n\n        t1.setName(\"COMMITTER-1\");\n        t2.setName(\"COMMITTER-2\");\n        t2.start();\n        t1.start();\n\n        waitFor(threadsFinishedBarrier);\n\n        assertEquals(2,\n                     getCommitsFromBranch((GitImpl) fs.getGit(),\n                                          \"master\").size());\n    }\n\n    @Test\n    @BMScript(value = \"byteman/squash.btm\")\n    public void testConcurrentSquashWithSixCommit() throws IOException, GitAPIException {\n        final URI newRepo = URI.create(\"git://byteman-six-squash-repo\");\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        final CyclicBarrier threadsFinishedBarrier = new CyclicBarrier(3);\n        final Path main = provider.getPath(URI.create(\"git://main@byteman-six-squash-repo\"));\n        final RevCommit commit = commitSixTimesAndGetReference(fs,\n                                                               \"byteman-six-squash-repo\",\n                                                               \"main\",\n                                                               \"t1\");\n\n        Thread t1 = new Thread(() -> {\n            logger.info(\"<<<<<<<<<<<<< COMMIT TO SQUASH \" + commit.getName() + \" --- \" + commit.getFullMessage());\n            printLog(fs.getGit());\n            VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                     \"aparedes@redhat.com\",\n                                                     \"squashing a!\",\n                                                     new Date(),\n                                                     commit.getName());\n            SquashOption squashOption = new SquashOption(record);\n            logger.info(\"COMMITTER-1: Squashing\");\n            provider.setAttribute(main,\n                                  SquashOption.SQUASH_ATTR,\n                                  squashOption);\n            printLog(fs.getGit());\n            waitFor(threadsFinishedBarrier);\n        });\n\n        Thread t2 = new Thread(() -> {\n            logger.info(\"<<<<<<<<<<<<< COMMIT TO SQUASH \" + commit.getName() + \" --- \" + commit.getFullMessage());\n            printLog(fs.getGit());\n            VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                     \"aparedes@redhat.com\",\n                                                     \"squashing b!\",\n                                                     new Date(),\n                                                     commit.getName());\n            SquashOption squashOption = new SquashOption(record);\n            logger.info(\"COMMITTER-2: Squashing\");\n            provider.setAttribute(main,\n                                  SquashOption.SQUASH_ATTR,\n                                  squashOption);\n            printLog(fs.getGit());\n            waitFor(threadsFinishedBarrier);\n        });\n\n        t1.setName(\"COMMITTER-1\");\n        t2.setName(\"COMMITTER-2\");\n        t2.start();\n        t1.start();\n\n        waitFor(threadsFinishedBarrier);\n\n        assertEquals(2,\n                     getCommitsFromBranch((GitImpl) fs.getGit(),\n                                          \"main\").size());\n    }\n\n    @Test\n    @BMScript(value = \"byteman/squash_exception.btm\")\n    public void testForceExceptionWhenTryingToSquash() throws IOException, GitAPIException {\n\n        final URI newRepo = URI.create(\"git://byteman-exception-squash-repo\");\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        final Path main = provider.getPath(URI.create(\"git://main@byteman-exception-squash-repo\"));\n        final RevCommit commit = commitThreeTimesAndGetReference(fs,\n                                                                 \"byteman-exception-squash-repo\",\n                                                                 \"main\",\n                                                                 \"t1\");\n\n        logger.info(\"<<<<<<<<<<<<< COMMIT TO SQUASH \" + commit.getName() + \" --- \" + commit.getFullMessage());\n        printLog(fs.getGit());\n        VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                 \"aparedes@redhat.com\",\n                                                 \"squashing a!\",\n                                                 new Date(),\n                                                 commit.getName());\n        SquashOption squashOption = new SquashOption(record);\n        logger.info(\"COMMITTER-1: Squashing\");\n\n        try {\n            provider.setAttribute(main,\n                                  SquashOption.SQUASH_ATTR,\n                                  squashOption);\n        } catch (Exception e) {\n            fs.lock();\n            fs.unlock();\n        }\n\n        assertEquals(3,\n                     getCommitsFromBranch((GitImpl) fs.getGit(),\n                                          \"main\").size());\n    }\n\n    @Test\n    @BMScript(value = \"byteman/commit_exception.btm\")\n    public void testFileSystemLockOnException() throws IOException, GitAPIException {\n\n        final URI newRepo = URI.create(\"git://byteman-exception-commit-repo\");\n        final JGitFileSystemProxy fsProxy = (JGitFileSystemProxy) provider.newFileSystem(newRepo,\n                                                                                         EMPTY_ENV);\n        JGitFileSystem fs = fsProxy.getRealJGitFileSystem();\n\n        final Path path = provider.getPath(URI.create(\"git://main@byteman-exception-commit-repo/myfile.txt\"));\n\n        try {\n            writeFile(fs,\n                      path,\n                      \"main\");\n        } catch (RuntimeException e) {\n        }\n\n        // fs must be unlocked\n        Object lock = null;\n        try {\n            Field field = JGitFileSystemImpl.class.getDeclaredField(\"lock\");\n            field.setAccessible(true);\n            lock = field.get(fs);\n        } catch (Exception e) {\n            e.printStackTrace();\n            fail(e.getMessage());\n        }\n        Object isLocked = null;\n        try {\n            Method method = lock.getClass().getMethod(\"hasBeenInUse\");\n            isLocked = method.invoke(lock);\n        } catch (Exception e) {\n            fail(e.getMessage());\n        }\n        assertTrue(((Boolean) isLocked));\n    }\n\n    private VersionRecord makeVersionRecord(final String author,\n                                            final String email,\n                                            final String comment,\n                                            final Date date,\n                                            final String commit) {\n        return new VersionRecord() {\n            @Override\n            public String id() {\n                return commit;\n            }\n\n            @Override\n            public String author() {\n                return author;\n            }\n\n            @Override\n            public String email() {\n                return email;\n            }\n\n            @Override\n            public String comment() {\n                return comment;\n            }\n\n            @Override\n            public Date date() {\n                return date;\n            }\n\n            @Override\n            public String uri() {\n                return null;\n            }\n        };\n    }\n\n    private static void printLog(final Git git) {\n        try {\n            for (final RevCommit revCommit : ((GitImpl) git)._log().call()) {\n                logger.info(\"[LOG]: \" + revCommit.getName() + \" --- \" + revCommit.getFullMessage());\n            }\n        } catch (GitAPIException e) {\n            e.printStackTrace();\n        }\n    }\n\n    protected static void waitFor(CyclicBarrier barrier) {\n        String threadName = Thread.currentThread().getName();\n        try {\n            logger.info(threadName + \" request for await\");\n            barrier.await();\n            logger.info(threadName + \" await finished\");\n        } catch (InterruptedException e) {\n            fail(\"Thread '\" + threadName + \"' was interrupted while waiting for the other threads!\");\n        } catch (BrokenBarrierException e) {\n            fail(\"Thread '\" + threadName + \"' barrier was broken while waiting for the other threads!\");\n        }\n    }\n\n    private RevCommit commitThreeTimesAndGetReference(JGitFileSystem fs,\n                                                      String repo,\n                                                      String branch,\n                                                      String thread) {\n        try {\n            final Path path = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile1.txt\"));\n            final Path path2 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile2.txt\"));\n            final Path path3 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile3.txt\"));\n\n            final RevCommit commit = writeFile(fs,\n                                               path,\n                                               branch);\n            writeFile(fs,\n                      path2,\n                      branch);\n            writeFile(fs,\n                      path3,\n                      branch);\n\n            return commit;\n        } catch (IOException | GitAPIException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private RevCommit commitSixTimesAndGetReference(JGitFileSystem fs,\n                                                    String repo,\n                                                    String branch,\n                                                    String thread) {\n        try {\n            final Path path = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile1.txt\"));\n            final Path path2 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile2.txt\"));\n            final Path path3 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile3.txt\"));\n            final Path path4 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile4.txt\"));\n            final Path path5 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile5.txt\"));\n            final Path path6 = provider.getPath(URI.create(\"git://\" + branch + \"@\" + repo + \"/\" + thread + \"-myfile6.txt\"));\n\n            final RevCommit commit = writeFile(fs,\n                                               path,\n                                               branch);\n            writeFile(fs,\n                      path2,\n                      branch);\n            writeFile(fs,\n                      path3,\n                      branch);\n            writeFile(fs,\n                      path4,\n                      branch);\n            writeFile(fs,\n                      path5,\n                      branch);\n            writeFile(fs,\n                      path6,\n                      branch);\n\n            return commit;\n        } catch (IOException | GitAPIException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private RevCommit writeFile(final JGitFileSystem fs,\n                                final Path path,\n                                String branch) throws IOException, GitAPIException {\n        final OutputStream stream = provider.newOutputStream(path);\n        logger.info(\"Writing file: \" + path.getFileName().toString());\n        stream.write(\"my cool content\".getBytes());\n        stream.close();\n        return this.getCommitsFromBranch((GitImpl) fs.getGit(),\n                                         branch).get(0);\n    }\n\n    private List<RevCommit> getCommitsFromBranch(final GitImpl origin,\n                                                 String branch) throws GitAPIException, MissingObjectException, IncorrectObjectTypeException {\n        List<RevCommit> commits = new ArrayList<>();\n        final ObjectId id = new GetRef(origin.getRepository(),\n                                       branch).execute().getObjectId();\n        for (RevCommit commit : origin._log().add(id).call()) {\n            commits.add(commit);\n        }\n        return commits;\n    }\n}\n\n\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderCpMvTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.URI;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.options.CherryPickCopyOption;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.Assertions.fail;\n\npublic class JGitFileSystemImplProviderCpMvTest extends AbstractTestInfra {\n\n    @Test\n    public void testCopyBranches() throws IOException {\n        final URI newRepo = URI.create(\"git://copybranch-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@copybranch-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@copybranch-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@copybranch-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://user_branch@copybranch-test-repo\"));\n        final Path target = provider.getPath(URI.create(\"git://other_branch@copybranch-test-repo\"));\n\n        provider.copy(source,\n                      target);\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(URI.create(\"git://other_branch@copybranch-test-repo/\")),\n                                                                         null);\n\n        assertThat(stream).isNotNull().hasSize(2);\n\n        assertThatThrownBy(() -> provider.copy(source, target))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        final Path notExists = provider.getPath(URI.create(\"git://xxx_user_branch@copybranch-test-repo\"));\n        final Path notExists2 = provider.getPath(URI.create(\"git://xxx_other_branch@copybranch-test-repo\"));\n\n        assertThatThrownBy(() -> provider.copy(notExists, notExists2))\n                .isInstanceOf(NoSuchFileException.class);\n    }\n\n    @Test\n    public void testCopyFiles() throws IOException {\n        final URI newRepo = URI.create(\"git://copyasset-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@copyasset-test-repo/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@copyasset-test-repo/other/path/myfile2.txt\"));\n        {\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@copyasset-test-repo/myfile3.txt\"));\n        {\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        final Path target = provider.getPath(URI.create(\"git://user_branch@copyasset-test-repo/myfile1.txt\"));\n\n        provider.copy(path,\n                      target);\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(URI.create(\"git://user_branch@copyasset-test-repo/\")),\n                                                                         null);\n\n        for (Path path1 : stream) {\n            System.out.println(\"content: \" + path1.toUri());\n        }\n\n        assertThat(stream).isNotNull().hasSize(3);\n    }\n\n    @Test\n    public void testCopyDir() throws IOException {\n        final URI newRepo = URI.create(\"git://copydir-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@copydir-test-repo/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/path/myfile2.txt\"));\n        {\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/path/myfile3.txt\"));\n        {\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).hasSize(3);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/some/place/here/\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).hasSize(2);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/soXme/place/here\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).hasSize(2);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/other_here/\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).hasSize(1);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/not_exists\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/xxxxxxxxother_here/\"));\n\n            assertThatThrownBy(() -> provider.copy(source, target))\n                    .isInstanceOf(NoSuchFileException.class);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@copydir-test-repo/\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo/other_here/\"));\n\n            assertThatThrownBy(() -> provider.copy(source, target))\n                    .isInstanceOf(FileAlreadyExistsException.class);\n        }\n    }\n\n    @Test\n    public void testCopyFilesAcrossRepositories() throws IOException {\n        final URI newRepo1 = URI.create(\"git://copyasset-test-repo1\");\n        provider.newFileSystem(newRepo1,\n                               EMPTY_ENV);\n\n        final URI newRepo2 = URI.create(\"git://copyasset-test-repo2\");\n        provider.newFileSystem(newRepo2,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@copyasset-test-repo1/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        final Path target = provider.getPath(URI.create(\"git://main@copyasset-test-repo2/myfile1.txt\"));\n\n        provider.copy(path,\n                      target);\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(URI.create(\"git://main@copyasset-test-repo2/\")),\n                                                                         null);\n\n        for (Path path1 : stream) {\n            System.out.println(\"content: \" + path1.toUri());\n        }\n\n        assertThat(stream).isNotNull().hasSize(1);\n    }\n\n    @Test\n    public void testCopyDirAcrossRepositories() throws IOException {\n        final URI newRepo1 = URI.create(\"git://copydir-test-repo1\");\n        provider.newFileSystem(newRepo1,\n                               EMPTY_ENV);\n\n        final URI newRepo2 = URI.create(\"git://copydir-test-repo2\");\n        provider.newFileSystem(newRepo2,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@copydir-test-repo1/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n        final Path path2 = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path/myfile2.txt\"));\n        {\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        final Path path3 = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path/myfile3.txt\"));\n        {\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo1/\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).isNotNull().hasSize(3);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo1/some/place/here/\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).isNotNull().hasSize(2);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo1/soXme/place/here\"));\n\n            provider.copy(source,\n                          target);\n\n            final DirectoryStream<Path> stream = provider.newDirectoryStream(target,\n                                                                             null);\n\n            assertThat(stream).isNotNull().hasSize(2);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://main@copydir-test-repo1/not_exists\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo2/xxxxxxxxother_here/\"));\n\n            assertThatThrownBy(() -> provider.copy(source, target))\n                    .isInstanceOf(NoSuchFileException.class);\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://main@copydir-test-repo2/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@copydir-test-repo1/some/place/here/\"));\n\n            assertThatThrownBy(() -> provider.copy(source, target))\n                    .isInstanceOf(FileAlreadyExistsException.class);\n        }\n    }\n\n    @Test\n    public void testMoveBranches() throws IOException {\n        final URI newRepo = URI.create(\"git://movebranch-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@movebranch-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@movebranch-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@movebranch-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://user_branch@movebranch-test-repo/\"));\n        final Path target = provider.getPath(URI.create(\"git://main@movebranch-test-repo/\"));\n\n        assertThatThrownBy(() -> provider.move(source, target))\n                .isInstanceOf(FileAlreadyExistsException.class);\n\n        final Path source2 = provider.getPath(URI.create(\"git://user_branch@movebranch-test-repo/\"));\n        final Path target2 = provider.getPath(URI.create(\"git://xxxxddddkh@movebranch-test-repo/\"));\n\n        try {\n            provider.move(source2,\n                          target2);\n        } catch (final Exception e) {\n            fail(\"should not throw\");\n        }\n    }\n\n    @Test\n    public void testMoveFiles() throws IOException {\n        final URI newRepo = URI.create(\"git://moveasset-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@moveasset-test-repo/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@moveasset-test-repo/other/path/myfile2.txt\"));\n        {\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@moveasset-test-repo/myfile3.txt\"));\n        {\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        final Path target = provider.getPath(URI.create(\"git://user_branch@moveasset-test-repo/myfile1.txt\"));\n\n        try {\n            provider.move(path,\n                          target);\n        } catch (final Exception e) {\n            fail(\"should move file\",\n                 e);\n        }\n    }\n\n    @Test\n    public void testMoveDir() throws IOException {\n        final URI newRepo = URI.create(\"git://movedir-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@movedir-test-repo/myfile1.txt\"));\n        {\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@movedir-test-repo/path/myfile2.txt\"));\n        {\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@movedir-test-repo/path/myfile3.txt\"));\n        {\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        {\n            final Path source = provider.getPath(URI.create(\"git://user_branch@movedir-test-repo/path\"));\n            final Path target = provider.getPath(URI.create(\"git://main@movedir-test-repo/\"));\n\n            try {\n                provider.move(source,\n                              target);\n            } catch (org.uberfire.java.nio.IOException e) {\n                assertThat(e).isInstanceOf(DirectoryNotEmptyException.class);\n            }\n        }\n    }\n\n    @Test\n    public void testCherryPick() throws IOException {\n        final URI newRepo = URI.create(\"git://cherrypick-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@cherrypick-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@cherrypick-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@cherrypick-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        String commit2CherryPick;\n        String cherryPickContent = \"my 2nd cool content\";\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@cherrypick-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(cherryPickContent.getBytes());\n            outStream.close();\n\n            final VersionAttributes versionAttributes = provider.readAttributes(path,\n                                                                                VersionAttributes.class);\n\n            assertThat(versionAttributes.history().records()).isNotNull().hasSize(2);\n            commit2CherryPick = versionAttributes.history().records().get(versionAttributes.history().records().size() - 1).id();\n\n            final OutputStream outStream2 = provider.newOutputStream(path);\n            outStream2.write(\"my 3rd cool content\".getBytes());\n            outStream2.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://user_branch@cherrypick-test-repo\"));\n        final Path target = provider.getPath(URI.create(\"git://other_branch@cherrypick-test-repo\"));\n\n        provider.copy(source,\n                      target);\n\n        String commit2CherryPick2;\n        String cherryPickContent2 = \"my 4tn cool content\";\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@cherrypick-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(cherryPickContent2.getBytes());\n            outStream.close();\n\n            final VersionAttributes versionAttributes = provider.readAttributes(path,\n                                                                                VersionAttributes.class);\n\n            commit2CherryPick2 = versionAttributes.history().records().get(versionAttributes.history().records().size() - 1).id();\n        }\n\n        final Path target2 = provider.getPath(URI.create(\"git://other_branch2@cherrypick-test-repo\"));\n        provider.copy(source,\n                      target2);\n\n        {\n            provider.copy(source,\n                          target,\n                          new CherryPickCopyOption(commit2CherryPick));\n\n            String result = convertStreamToString(provider.newInputStream(provider.getPath(URI.create(\"git://other_branch@cherrypick-test-repo/myfile1.txt\"))));\n            assertThat(result).isEqualTo(cherryPickContent);\n        }\n\n        {\n            provider.copy(source,\n                          target2,\n                          new CherryPickCopyOption(commit2CherryPick,\n                                                   commit2CherryPick2));\n\n            final String result = convertStreamToString(provider.newInputStream(provider.getPath(URI.create(\"git://other_branch2@cherrypick-test-repo/myfile1.txt\"))));\n            assertThat(result).isEqualTo(cherryPickContent2);\n        }\n    }\n\n    private static String convertStreamToString(java.io.InputStream is) {\n        java.util.Scanner s = new java.util.Scanner(is).useDelimiter(\"\\\\A\");\n        return s.hasNext() ? s.next() : \"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderDiffTest.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.base.FileDiff;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitFileSystemImplProviderDiffTest extends AbstractTestInfra {\n\n    private Logger logger = LoggerFactory.getLogger(JGitFileSystemImplProviderDiffTest.class);\n\n    @Test\n    public void testDiffsBetweenBranches() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        \"repo.git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n        final Repository gitRepo = origin.getRepository();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\\ntemp1\\ntemp3\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\nother\\n\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\\ntemp2\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\n\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file4.txt\",\n                           tempFile(\"temp4\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file5.txt\",\n                           tempFile(\"temp5\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://diff-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        provider.newFileSystem(newRepo,\n                               env);\n\n        final Path path = provider.getPath(newRepo);\n        final List<FileDiff> diffs = (List<FileDiff>) provider.readAttributes(path,\n                                                                              \"diff:main,develop\").get(\"diff\");\n\n        diffs.forEach(elem -> logger.info(elem.toString()));\n\n        assertThat(diffs.size()).isEqualTo(5);\n    }\n\n    @Test\n    public void testBranchesDoNotHaveDifferences() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        \"repo.git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n        final Repository gitRepo = origin.getRepository();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\\ntemp1\\ntemp3\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\nother\\n\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\\ntemp2\\nmiddle\\nmoremiddle\\nmoremiddle\\nmoremiddle\\n\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        final URI newRepo = URI.create(\"git://diff-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        provider.newFileSystem(newRepo,\n                               env);\n\n        final Path path = provider.getPath(newRepo);\n        final List<FileDiff> diffs = (List<FileDiff>) provider.readAttributes(path,\n                                                                              \"diff:main,develop\").get(\"diff\");\n\n        diffs.forEach(elem -> logger.info(elem.toString()));\n\n        assertThat(diffs.size()).isEqualTo(0);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderEncodingTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class JGitFileSystemImplProviderEncodingTest extends AbstractTestInfra {\n\n    private int gitDaemonPort;\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.enabled\",\n                     \"true\");\n        // use different port for every test -> easy to run tests in parallel\n        gitDaemonPort = findFreePort();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.port\",\n                     String.valueOf(gitDaemonPort));\n        return gitPrefs;\n    }\n\n\n    @Test\n    public void test() throws IOException {\n        final URI originRepo = URI.create(\"git://encoding-origin-name\");\n\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                                      Collections.emptyMap());\n\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file-name.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file+name.txt\",\n                           tempFile(\"temp2\"));\n                   }}).execute();\n\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file name.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://my-encoding-repo-name\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                \"git://localhost:\" + gitDaemonPort + \"/encoding-origin-name\");\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        fs.getPath(\"file+name.txt\").toUri();\n\n        provider.getPath(fs.getPath(\"file+name.txt\").toUri());\n\n        URI uri = fs.getPath(\"file+name.txt\").toUri();\n        Path path = provider.getPath(uri);\n        Path path1 = fs.getPath(\"file+name.txt\");\n        assertThat(path).isEqualTo(path1);\n\n        assertThat(provider.getPath(fs.getPath(\"file name.txt\").toUri())).isEqualTo(fs.getPath(\"file name.txt\"));\n\n        assertThat(fs.getPath(\"file.txt\").toUri());\n\n        assertThat(provider.getPath(fs.getPath(\"file.txt\").toUri())).isEqualTo(fs.getPath(\"file.txt\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderGCTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.URI;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;\n\npublic class JGitFileSystemImplProviderGCTest extends AbstractTestInfra {\n\n    @Test\n    public void testGC() throws IOException {\n        final URI newRepo = URI.create(\"git://gc-repo-name\");\n\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(newRepo),\n                                                                         null);\n        assertThat(stream).isNotNull().hasSize(0);\n\n        try {\n            provider.newFileSystem(newRepo,\n                                   EMPTY_ENV);\n            failBecauseExceptionWasNotThrown(FileSystemAlreadyExistsException.class);\n        } catch (final Exception ex) {\n        }\n\n        for (int i = 0; i < 19; i++) {\n            assertThat(fs.getNumberOfCommitsSinceLastGC()).isEqualTo(i);\n\n            final Path path = provider.getPath(URI.create(\"git://gc-repo-name/path/to/myfile\" + i + \".txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            assertThat(outStream).isNotNull();\n            outStream.write((\"my cool\" + i + \" content\").getBytes());\n            outStream.close();\n        }\n\n        final Path path = provider.getPath(URI.create(\"git://gc-repo-name/path/to/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n        assertThat(fs.getNumberOfCommitsSinceLastGC()).isEqualTo(0);\n\n        final OutputStream outStream2 = provider.newOutputStream(path);\n        assertThat(outStream2).isNotNull();\n        outStream2.write(\"my co dwf sdf ol content\".getBytes());\n        outStream2.close();\n        assertThat(fs.getNumberOfCommitsSinceLastGC()).isEqualTo(1);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderHookTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Map;\n\nimport org.eclipse.jgit.hooks.PreCommitHook;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\n\npublic class JGitFileSystemImplProviderHookTest extends AbstractTestInfra {\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        try {\n            final File hooksDir = createTempDirectory();\n            gitPrefs.put(\"org.uberfire.nio.git.hooks\",\n                         hooksDir.getAbsolutePath());\n\n            writeMockHook(hooksDir,\n                          \"post-commit\");\n            writeMockHook(hooksDir,\n                          PreCommitHook.NAME);\n        } catch (IOException e) {\n            e.printStackTrace();\n        }\n\n        return gitPrefs;\n    }\n\n    @Test\n    public void testInstalledHook() {\n        final URI newRepo = URI.create(\"git://hook-repo-name\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        if (fs instanceof JGitFileSystemImpl) {\n            File[] hooks = new File(((JGitFileSystemImpl) fs).getGit().getRepository().getDirectory(),\n                                    \"hooks\").listFiles();\n            assertThat(hooks).isNotEmpty().isNotNull();\n            assertThat(hooks.length).isEqualTo(2);\n\n            boolean foundPreCommitHook = false;\n            boolean foundPostCommitHook = false;\n            for (File hook : hooks) {\n                if (hook.getName().equals(\"pre-commit\")) {\n                    foundPreCommitHook = hook.canExecute();\n                } else if (hook.getName().equals(\"post-commit\")) {\n                    foundPostCommitHook = hook.canExecute();\n                }\n            }\n            assertThat(foundPreCommitHook).isTrue();\n            assertThat(foundPostCommitHook).isTrue();\n        }\n    }\n\n    @Test\n    public void testExecutedPostCommitHook() throws IOException {\n        testHook(\"hook-repo-name-executed\",\n                 \"post-commit\",\n                 true);\n    }\n\n    @Test\n    public void testNotSupportedPreCommitHook() throws IOException {\n        testHook(\"hook-repo-name-executed-pre-commit\",\n                 \"pre-commit\",\n                 false);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderHttpProxyTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.Authenticator;\nimport java.net.InetAddress;\nimport java.net.MalformedURLException;\nimport java.net.PasswordAuthentication;\nimport java.net.URL;\nimport java.net.UnknownHostException;\nimport java.util.HashMap;\n\nimport org.junit.Test;\n\nimport static java.net.Authenticator.requestPasswordAuthentication;\nimport static org.junit.Assert.*;\n\npublic class JGitFileSystemImplProviderHttpProxyTest {\n\n    @Test\n    public void testHttpProxy() throws MalformedURLException, UnknownHostException {\n        final String userName = \"user\";\n        final String passw = \"passwd\";\n\n        final JGitFileSystemProvider provider = new JGitFileSystemProvider(new HashMap<String, String>() {{\n            put(\"http.proxyUser\",\n                \"user\");\n            put(\"http.proxyPassword\",\n                \"passwd\");\n            put(\"org.uberfire.nio.git.daemon.enabled\",\n                \"false\");\n            put(\"org.uberfire.nio.git.ssh.enabled\",\n                \"false\");\n        }});\n\n        final PasswordAuthentication passwdAuth = requestPasswordAuthentication(\"localhost\",\n                                                                                InetAddress.getLocalHost(),\n                                                                                8080,\n                                                                                \"http\",\n                                                                                \"xxx\",\n                                                                                \"http\",\n                                                                                new URL(\"http://localhost\"),\n                                                                                Authenticator.RequestorType.PROXY);\n\n        assertEquals(userName,\n                     passwdAuth.getUserName());\n        assertEquals(passw,\n                     new String(passwdAuth.getPassword()));\n\n        provider.dispose();\n    }\n\n    @Test\n    public void testHttpsProxy() throws MalformedURLException, UnknownHostException {\n        final String userName = \"user\";\n        final String passw = \"passwd\";\n\n        final JGitFileSystemProvider provider = new JGitFileSystemProvider(new HashMap<String, String>() {{\n            put(\"https.proxyUser\",\n                \"user\");\n            put(\"https.proxyPassword\",\n                \"passwd\");\n            put(\"org.uberfire.nio.git.daemon.enabled\",\n                \"false\");\n            put(\"org.uberfire.nio.git.ssh.enabled\",\n                \"false\");\n        }});\n\n        final PasswordAuthentication passwdAuth = requestPasswordAuthentication(\"localhost\",\n                                                                                InetAddress.getLocalHost(),\n                                                                                8080,\n                                                                                \"https\",\n                                                                                \"xxx\",\n                                                                                \"https\",\n                                                                                new URL(\"https://localhost\"),\n                                                                                Authenticator.RequestorType.PROXY);\n\n        assertEquals(userName,\n                     passwdAuth.getUserName());\n        assertEquals(passw,\n                     new String(passwdAuth.getPassword()));\n\n        provider.dispose();\n    }\n\n    @Test\n    public void testNoProxyInfo() throws MalformedURLException, UnknownHostException {\n        final JGitFileSystemProvider provider = new JGitFileSystemProvider(new HashMap<String, String>() {{\n            put(\"org.uberfire.nio.git.daemon.enabled\",\n                \"false\");\n            put(\"org.uberfire.nio.git.ssh.enabled\",\n                \"false\");\n        }});\n\n        {\n            final PasswordAuthentication passwdAuth = requestPasswordAuthentication(\"localhost\",\n                                                                                    InetAddress.getLocalHost(),\n                                                                                    8080,\n                                                                                    \"https\",\n                                                                                    \"xxx\",\n                                                                                    \"https\",\n                                                                                    new URL(\"https://localhost\"),\n                                                                                    Authenticator.RequestorType.PROXY);\n\n            assertNull(passwdAuth);\n        }\n\n        {\n            final PasswordAuthentication passwdAuth = requestPasswordAuthentication(\"localhost\",\n                                                                                    InetAddress.getLocalHost(),\n                                                                                    8080,\n                                                                                    \"http\",\n                                                                                    \"xxx\",\n                                                                                    \"http\",\n                                                                                    new URL(\"http://localhost\"),\n                                                                                    Authenticator.RequestorType.PROXY);\n\n            assertNull(passwdAuth);\n        }\n\n        provider.dispose();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderMergeTest.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.util.List;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.options.MergeCopyOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetTreeFromRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListDiffs;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitFileSystemImplProviderMergeTest extends AbstractTestInfra {\n\n    @Test\n    public void testMergeSuccessful() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path userBranch = provider.getPath(URI.create(\"git://user_branch@merge-test-repo\"));\n\n        provider.copy(main,\n                      userBranch);\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n\n        provider.copy(userBranch,\n                      main,\n                      new MergeCopyOption());\n\n        final Git gitRepo = ((JGitFileSystem) main.getFileSystem()).getGit();\n\n        final List<DiffEntry> result = new ListDiffs(gitRepo,\n                                                     new GetTreeFromRef(gitRepo,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(gitRepo,\n                                                                        \"user_branch\").execute()).execute();\n\n        assertThat(result.size()).isEqualTo(0);\n    }\n\n    @Test(expected = GitException.class)\n    public void testMergeConflicts() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path userBranch = provider.getPath(URI.create(\"git://user_branch@merge-test-repo\"));\n\n        provider.copy(main,\n                      userBranch);\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(\"my cool content\".getBytes());\n            outStream2.close();\n        }\n        {\n            final Path path = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content changed\".getBytes());\n            outStream.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(\"my cool content\".getBytes());\n            outStream3.close();\n        }\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my very cool content\".getBytes());\n            outStream.close();\n        }\n\n        provider.copy(userBranch,\n                      main,\n                      new MergeCopyOption());\n    }\n\n    @Test\n    public void testMergeBinarySuccessful() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(this.loadImage(\"images/drools.png\"));\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path userBranch = provider.getPath(URI.create(\"git://user_branch@merge-test-repo\"));\n\n        provider.copy(main,\n                      userBranch);\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream2 = provider.newOutputStream(path2);\n            outStream2.write(this.loadImage(\"images/jbpm.png\"));\n            outStream2.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream3 = provider.newOutputStream(path3);\n            outStream3.write(this.loadImage(\"images/opta.png\"));\n            outStream3.close();\n        }\n\n        provider.copy(userBranch,\n                      main,\n                      new MergeCopyOption());\n\n        final Git gitRepo = ((JGitFileSystem) main.getFileSystem()).getGit();\n        final List<DiffEntry> result = new ListDiffs(gitRepo,\n                                                     new GetTreeFromRef(gitRepo,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(gitRepo,\n                                                                        \"user_branch\").execute()).execute();\n\n        assertThat(result.size()).isEqualTo(0);\n    }\n\n    @Test(expected = GitException.class)\n    public void testBinaryMergeConflicts() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(this.loadImage(\"images/drools.png\"));\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path userBranch = provider.getPath(URI.create(\"git://user_branch@merge-test-repo\"));\n\n        provider.copy(main,\n                      userBranch);\n\n        {\n            final Path path2 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/other/path/myfile2.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path2);\n            outStream.write(this.loadImage(\"images/jbpm.png\"));\n            outStream.close();\n        }\n        {\n            final Path path = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(this.loadImage(\"images/jbpm.png\"));\n            outStream.close();\n        }\n        {\n            final Path path3 = provider.getPath(URI.create(\"git://user_branch@merge-test-repo/myfile3.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path3);\n            outStream.write(this.loadImage(\"images/opta.png\"));\n            outStream.close();\n        }\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(this.loadImage(\"\"));\n            outStream.close();\n        }\n\n        provider.copy(userBranch,\n                      main,\n                      new MergeCopyOption());\n    }\n\n    @Test(expected = GitException.class)\n    public void testTryToMergeNonexistentBranch() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path develop = provider.getPath(URI.create(\"git://develop@merge-test-repo\"));\n\n        provider.copy(develop,\n                      main,\n                      new MergeCopyOption());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testMissingParemeter() throws IOException {\n        final URI newRepo = URI.create(\"git://merge-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://main@merge-test-repo/myfile1.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"my cool content\".getBytes());\n            outStream.close();\n        }\n\n        final Path main = provider.getPath(URI.create(\"git://main@merge-test-repo\"));\n        final Path develop = provider.getPath(URI.create(\"git://develop@merge-test-repo\"));\n\n        provider.copy(develop,\n                      null,\n                      new MergeCopyOption());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderMigrationTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitFileSystemImplProviderMigrationTest extends AbstractTestInfra {\n\n    @Test\n    public void testCreateANewDirectoryWithMigrationEnv() {\n\n        final Map<String, ?> envMigrate = new HashMap<String, Object>() {{\n            put(\"init\",\n                Boolean.TRUE);\n            put(\"migrate-from\",\n                URI.create(\"git://old\"));\n        }};\n\n        String newPath = \"git://test/old\";\n        final URI newUri = URI.create(newPath);\n        provider.newFileSystem(newUri,\n                               envMigrate);\n\n        provider.getFileSystem(newUri);\n        assertThat(new File(provider.getGitRepoContainerDir(),\n                            \"test/old\" + \".git\")).exists();\n        assertThat(provider.getFileSystem(newUri)).isNotNull();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderPostCommitHookTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.lang3.SystemUtils;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooksConstants;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.nio.file.Files;\nimport java.nio.file.attribute.PosixFilePermission;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFileSystemImplProviderPostCommitHookTest extends AbstractTestInfra {\n\n    private static final Integer SUCCESS = 0;\n    private static final Integer WARNING = 10;\n    private static final Integer ERROR = 50;\n\n    private static final String SCRIPT = \"exit \";\n\n    private static final String HOOKS_FOLDER = \"hooks\";\n\n    private static final String GIT = \"git://\";\n\n    private static final String REPO_NAME = \"repo\";\n\n    private static final String NEW_FILE_PATH = \"/folder/file.txt\";\n\n    @Mock\n    private FileSystemHooks.FileSystemHook postCommitHook;\n\n    @Captor\n    private ArgumentCaptor<FileSystemHookExecutionContext> contextCaptor;\n\n    private JGitFileSystem fs;\n\n    @Before\n    public void init() {\n        final URI newRepo = URI.create(GIT + REPO_NAME);\n\n        final Map<String, Object> env = new HashMap<>();\n        env.put(FileSystemHooks.PostCommit.name(), postCommitHook);\n\n        fs = (JGitFileSystem) provider.newFileSystem(newRepo, env);\n\n        assertThat(fs).isNotNull();\n    }\n\n    @Test\n    public void testPostCommitWithoutHook() throws IOException {\n        commitFile();\n\n        verify(postCommitHook, never()).execute(any());\n    }\n\n    @Test\n    public void testPostCommitHookSuccess() throws IOException {\n\n        testPostCommit(SUCCESS);\n\n    }\n\n    @Test\n    public void testPostCommitHookWarning() throws IOException {\n\n        testPostCommit(WARNING);\n\n    }\n\n    @Test\n    public void testPostCommitHookError() throws IOException {\n\n        testPostCommit(ERROR);\n\n    }\n\n    private void testPostCommit(final Integer exitCode) throws IOException {\n        prepareHook(exitCode);\n\n        commitFile();\n\n        verify(postCommitHook).execute(contextCaptor.capture());\n\n        FileSystemHookExecutionContext context = contextCaptor.getValue();\n\n        Assertions.assertThat(context)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"fsName\", REPO_NAME);\n\n        Assertions.assertThat(context.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE))\n                .isNotNull()\n                .isEqualTo(exitCode);\n\n    }\n\n    private void prepareHook(final Integer code) throws IOException {\n\n        File destHookFile = fs.getGit().getRepository().getDirectory().toPath().resolve(HOOKS_FOLDER).resolve(\"post-commit\").toFile();\n\n        FileUtils.write(destHookFile, SCRIPT + code, Charset.defaultCharset());\n\n        if (SystemUtils.IS_OS_WINDOWS) {\n            destHookFile.setReadable(true);\n            destHookFile.setWritable(true);\n            destHookFile.setExecutable(true);\n        } else {\n            Set<PosixFilePermission> perms = new HashSet<>();\n            perms.add(PosixFilePermission.OWNER_READ);\n            perms.add(PosixFilePermission.OWNER_WRITE);\n            perms.add(PosixFilePermission.GROUP_EXECUTE);\n            perms.add(PosixFilePermission.OTHERS_EXECUTE);\n            perms.add(PosixFilePermission.OWNER_EXECUTE);\n\n            Files.setPosixFilePermissions(destHookFile.toPath(), perms);\n        }\n    }\n\n    private void commitFile() throws IOException {\n        final Path path = provider.getPath(URI.create(GIT + REPO_NAME + NEW_FILE_PATH));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write((\"my content\").getBytes());\n        outStream.close();\n\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderSSHBadConfigTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.IOException;\nimport java.util.Map;\nimport org.apache.sshd.core.CoreModuleProperties;\n\nimport org.apache.sshd.server.SshServer;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class JGitFileSystemImplProviderSSHBadConfigTest extends AbstractTestInfra {\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n\n        gitPrefs.put(\"org.uberfire.nio.git.ssh.enabled\",\n                     \"true\");\n        gitPrefs.put(\"org.uberfire.nio.git.ssh.idle.timeout\",\n                     \"bz\");\n\n        return gitPrefs;\n    }\n\n    @Test\n    public void testCheckDefaultSSHIdleWithInvalidArg() throws IOException {\n        assertEquals(JGitFileSystemProviderConfiguration.DEFAULT_SSH_IDLE_TIMEOUT,\n                     provider.getGitSSHService().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName()));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderSSHTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.apache.sshd.core.CoreModuleProperties;\n\nimport org.apache.sshd.server.SshServer;\nimport org.assertj.core.api.Assertions;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.junit.Assume;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.fail;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_DAEMON_ENABLED;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_DAEMON_PORT;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_SSH_ENABLED;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_SSH_IDLE_TIMEOUT;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_SSH_PORT;\n\npublic class JGitFileSystemImplProviderSSHTest extends AbstractTestInfra {\n\n    private int gitSSHPort;\n    private int gitPort;\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        final Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(GIT_DAEMON_ENABLED, \"true\");\n        gitPort = findFreePort();\n        gitPrefs.put(GIT_DAEMON_PORT, String.valueOf(gitPort));\n        gitPrefs.put(GIT_SSH_ENABLED, \"true\");\n        gitSSHPort = findFreePort();\n        gitPrefs.put(GIT_SSH_PORT, String.valueOf(gitSSHPort));\n        gitPrefs.put(GIT_SSH_IDLE_TIMEOUT, \"10001\");\n\n        return gitPrefs;\n    }\n\n    @Test\n    public void testSSHPostReceiveHook() throws IOException {\n        FileSystemHooks.FileSystemHook hook = spy(new FileSystemHooks.FileSystemHook() {\n            @Override\n            public void execute(FileSystemHookExecutionContext context) {\n                assertEquals(\"repo\", context.getFsName());\n            }\n        });\n\n        Assume.assumeFalse(\"UF-511\",\n                           System.getProperty(\"java.vendor\").equals(\"IBM Corporation\"));\n        //Setup Authorization/Authentication\n        provider.setJAASAuthenticator(new AuthenticationService() {\n            private User user;\n\n            @Override\n            public User login(String s, String s1) {\n                user = new UserImpl(s);\n                return user;\n            }\n\n            @Override\n            public boolean isLoggedIn() {\n                return user != null;\n            }\n\n            @Override\n            public void logout() {\n                user = null;\n            }\n\n            @Override\n            public User getUser() {\n                return user;\n            }\n        });\n        provider.setAuthorizer((fs, fileSystemUser) -> true);\n\n        CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider(\"admin\",\n                                                                               \"\"));\n        assertEquals(\"10001\",\n                     provider.getGitSSHService().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName()));\n\n        //Setup origin\n        final URI originRepo = URI.create(\"git://repo\");\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              new HashMap<String, Object>() {{\n                                                                                  put(FileSystemHooks.ExternalUpdate.name(), hook);\n                                                                              }});\n\n        //Write a file to origin that we won't amend in the clone\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file-name.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        //Setup clone\n        JGitFileSystem clone;\n        clone = (JGitFileSystem) provider.newFileSystem(URI.create(\"git://repo-clone\"),\n                                                        new HashMap<String, Object>() {{\n                                                            put(\"init\",\n                                                                \"true\");\n                                                            put(\"origin\",\n                                                                \"ssh://admin@localhost:\" + gitSSHPort + \"/repo\");\n                                                        }});\n\n        assertNotNull(clone);\n\n        //Push clone back to origin\n        provider.getFileSystem(URI.create(\"git://repo-clone?push=ssh://admin@localhost:\" + gitSSHPort + \"/repo\"));\n\n        ArgumentCaptor<FileSystemHookExecutionContext> captor = ArgumentCaptor.forClass(FileSystemHookExecutionContext.class);\n\n        verify(hook).execute(captor.capture());\n\n        Assertions.assertThat(captor.getValue())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"fsName\", \"repo\");\n    }\n\n    @Test\n    public void testGitProtocolReadOnly() throws IOException {\n        //Setup origin\n        final URI originRepo = URI.create(\"git://repo\");\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              new HashMap<String, Object>() {{\n                                                                                  put(\"init\", \"true\");\n                                                                              }});\n\n        //Write a file to origin that we won't amend in the clone\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file-name.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        //Setup clone\n        final JGitFileSystem clone = (JGitFileSystem) provider.newFileSystem(URI.create(\"git://repo-clone\"),\n                                                                             new HashMap<String, Object>() {{\n                                                                                 put(\"init\",\n                                                                                     \"true\");\n                                                                                 put(\"origin\",\n                                                                                     \"git://localhost:\" + gitPort + \"/repo\");\n                                                                             }});\n\n        Files.write(clone.getPath(\"/home/file.txt\"), \"test\".getBytes());\n\n        try {\n            provider.getFileSystem(URI.create(\"git://repo-clone?push=git://localhost:\" + gitPort + \"/repo\"));\n            fail(\"should fail\");\n        } catch (Throwable ex) {\n        }\n\n        try {\n            provider.getFileSystem(URI.create(\"git://repo-clone?ssh=git://localhost:\" + gitSSHPort + \"/repo\"));\n        } catch (Throwable ex) {\n            fail(\"should not fail\");\n        }\n\n        assertNotNull(clone);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.text.SimpleDateFormat;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Scanner;\nimport java.util.Set;\n\nimport org.assertj.core.api.AssertionsForClassTypes;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributeView;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.base.options.SquashOption;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.AmbiguousFileSystemNameException;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsManager;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetRef;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathType;\n\nimport static junit.framework.Assert.assertNotSame;\nimport static junit.framework.TestCase.assertEquals;\nimport static junit.framework.TestCase.assertNotNull;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.Assertions.catchThrowable;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.java.nio.file.StandardDeleteOption.NON_EMPTY_DIRECTORIES;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider.removeRefsFromTree;\n\npublic class JGitFileSystemImplProviderTest extends AbstractTestInfra {\n\n    private int gitDaemonPort;\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.enabled\",\n                     \"true\");\n        gitDaemonPort = findFreePort();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.port\",\n                     String.valueOf(gitDaemonPort));\n        System.out.println(gitDaemonPort);\n        return gitPrefs;\n    }\n\n    @Test\n    @Ignore\n    public void testDaemob() {\n        final URI newRepo = URI.create(\"git://repo-name\");\n\n        final Map<String, ?> env = new HashMap<String, Object>() {{\n            put(\"init\",\n                Boolean.TRUE);\n        }};\n\n        FileSystem fs = provider.newFileSystem(newRepo,\n                                               env);\n\n        WatchService ws = fs.newWatchService();\n        final Path path = fs.getRootDirectories().iterator().next();\n        path.register(ws,\n                      StandardWatchEventKind.ENTRY_CREATE,\n                      StandardWatchEventKind.ENTRY_MODIFY,\n                      StandardWatchEventKind.ENTRY_DELETE,\n                      StandardWatchEventKind.ENTRY_RENAME);\n\n        final WatchKey k = ws.take();\n\n        final List<WatchEvent<?>> events = k.pollEvents();\n        for (WatchEvent object : events) {\n            if (object.kind() == StandardWatchEventKind.ENTRY_MODIFY) {\n                System.out.println(\"Modify: \" + object.context().toString());\n            }\n            if (object.kind() == StandardWatchEventKind.ENTRY_RENAME) {\n                System.out.println(\"Rename: \" + object.context().toString());\n            }\n            if (object.kind() == StandardWatchEventKind.ENTRY_DELETE) {\n                System.out.println(\"Delete: \" + object.context().toString());\n            }\n            if (object.kind() == StandardWatchEventKind.ENTRY_CREATE) {\n                System.out.println(\"Created: \" + object.context().toString());\n            }\n        }\n    }\n\n    @Test\n    public void testNewFileSystem() {\n        final URI newRepo = URI.create(\"git://repo-name\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(newRepo),\n                                                                         null);\n        assertThat(stream).isNotNull().hasSize(0);\n\n        try {\n            provider.newFileSystem(newRepo,\n                                   EMPTY_ENV);\n            failBecauseExceptionWasNotThrown(FileSystemAlreadyExistsException.class);\n        } catch (final Exception ignored) {\n        }\n\n        provider.newFileSystem(URI.create(\"git://repo-name2\"),\n                               EMPTY_ENV);\n    }\n\n    @Test\n    public void testNewFileSystemInited() {\n        final URI newRepo = URI.create(\"git://init-repo-name\");\n\n        final Map<String, ?> env = new HashMap<String, Object>() {{\n            put(\"init\",\n                Boolean.TRUE);\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(newRepo),\n                                                                         null);\n        assertThat(stream).isNotNull().hasSize(1);\n    }\n\n    @Test\n    public void testInvalidURINewFileSystem() {\n        final URI newRepo = URI.create(\"git:///repo-name\");\n\n        try {\n            provider.newFileSystem(newRepo,\n                                   EMPTY_ENV);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (final IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).isEqualTo(\"Parameter named 'uri' is invalid, missing host repository!\");\n        }\n    }\n\n    @Test\n    public void testNewFileSystemClone() throws IOException {\n\n        final URI originRepo = URI.create(\"git://my-simple-test-origin-name\");\n\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              Collections.emptyMap());\n\n        new Commit(origin.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://my-repo-name\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                \"git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-name\");\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        assertThat(fs.getRootDirectories()).hasSize(1);\n\n        assertThat(fs.getPath(\"file.txt\").toFile()).isNotNull().exists();\n\n        new Commit(origin.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"fileXXXXX.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        provider.getFileSystem(URI.create(\"git://my-repo-name?sync=git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-name&force\"));\n\n        assertThat(fs).isNotNull();\n\n        assertThat(fs.getRootDirectories()).hasSize(1);\n\n        for (final Path root : fs.getRootDirectories()) {\n            if (root.toAbsolutePath().toUri().toString().contains(\"upstream\")) {\n                assertThat(provider.newDirectoryStream(root,\n                                                       null)).hasSize(2);\n            } else if (root.toAbsolutePath().toUri().toString().contains(\"origin\")) {\n                assertThat(provider.newDirectoryStream(root,\n                                                       null)).hasSize(1);\n            } else {\n                assertThat(provider.newDirectoryStream(root,\n                                                       null)).hasSize(2);\n            }\n        }\n\n        new Commit(origin.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"fileYYYY.txt\",\n                           tempFile(\"tempYYYY\"));\n                   }}).execute();\n\n        provider.getFileSystem(URI.create(\"git://my-repo-name?sync=git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-name&force\"));\n\n        assertThat(fs.getRootDirectories()).hasSize(1);\n\n        assertThat(provider.newDirectoryStream(fs.getRootDirectories().iterator().next(),\n                                               null)).isNotEmpty().hasSize(3);\n    }\n\n    @Test\n    public void testNewFileSystemCloneAndPush() throws IOException {\n\n        final URI originRepo = URI.create(\"git://my-simple-test-origin-repo\");\n\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              Collections.emptyMap());\n\n        new Commit(origin.getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://my-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                \"git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-repo\");\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        assertThat(fs.getRootDirectories()).hasSize(1);\n\n        assertThat(fs.getPath(\"file.txt\").toFile()).isNotNull().exists();\n\n        new Commit(((JGitFileSystem) fs).getGit(),\n                   \"master\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"fileXXXXX.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        final URI newRepo2 = URI.create(\"git://my-repo2\");\n\n        final Map<String, Object> env2 = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                \"git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-repo\");\n        }};\n\n        final FileSystem fs2 = provider.newFileSystem(newRepo2,\n                                                      env2);\n\n        new Commit(origin.getGit(),\n                   \"user-branch\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1UserBranch.txt\",\n                           tempFile(\"tempX\"));\n                   }}).execute();\n\n        provider.getFileSystem(URI.create(\"git://my-repo2?sync=git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-repo&force\"));\n\n        assertThat(fs2.getRootDirectories()).hasSize(2);\n\n        final List<String> rootURIs1 = new ArrayList<String>() {{\n            add(\"git://master@my-repo2/\");\n            add(\"git://user-branch@my-repo2/\");\n        }};\n\n        final List<String> rootURIs2 = new ArrayList<String>() {{\n            add(\"git://master@my-repo2/\");\n            add(\"git://user-branch@my-repo2/\");\n            add(\"git://user-branch-2@my-repo2/\");\n        }};\n\n        final Set<String> rootURIs = new HashSet<String>();\n        for (final Path root : fs2.getRootDirectories()) {\n            rootURIs.add(root.toUri().toString());\n        }\n\n        rootURIs.removeAll(rootURIs1);\n\n        assertThat(rootURIs).isEmpty();\n\n        new Commit(origin.getGit(),\n                   \"user-branch-2\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2UserBranch.txt\",\n                           tempFile(\"tempX\"));\n                   }}).execute();\n\n        provider.getFileSystem(URI.create(\"git://my-repo2?sync=git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-repo&force\"));\n\n        assertThat(fs2.getRootDirectories()).hasSize(3);\n\n        for (final Path root : fs2.getRootDirectories()) {\n            rootURIs.add(root.toUri().toString());\n        }\n\n        rootURIs.removeAll(rootURIs2);\n\n        assertThat(rootURIs).isEmpty();\n    }\n\n    @Test\n    public void testNewFileSystemCloneAndRescan() throws IOException {\n\n        final URI originRepo = URI.create(\"git://my-simple-test-origin-name\");\n\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              Collections.emptyMap());\n\n        new Commit(origin.getGit(),\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://my-repo-name\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                \"git://localhost:\" + gitDaemonPort + \"/my-simple-test-origin-name\");\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        assertThat(fs.getRootDirectories()).hasSize(1);\n\n        final FileSystem fs2 = provider.getFileSystem(newRepo);\n\n        assertThat(fs2).isNotNull();\n\n        assertThat(fs2.getRootDirectories()).hasSize(1);\n    }\n\n    @Test\n    public void testGetFileSystem() {\n        final URI newRepo = URI.create(\"git://new-repo-name\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        assertThat(provider.getFileSystem(newRepo)).isEqualTo(fs);\n        assertThat(provider.getFileSystem(URI.create(\"git://main@new-repo-name\"))).isEqualTo(fs);\n        assertThat(provider.getFileSystem(URI.create(\"git://branch@new-repo-name\"))).isEqualTo(fs);\n\n        assertThat(provider.getFileSystem(URI.create(\"git://branch@new-repo-name?_fetch\"))).isEqualTo(fs);\n    }\n\n    @Test\n    public void testInvalidURIGetFileSystem() {\n        final URI newRepo = URI.create(\"git:///new-repo-name\");\n\n        try {\n            provider.getFileSystem(newRepo);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (final IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).isEqualTo(\"Parameter named 'uri' is invalid, missing host repository!\");\n        }\n    }\n\n    @Test\n    public void testGetPath() {\n        final URI newRepo = URI.create(\"git://new-get-repo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@new-get-repo-name/home\"));\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        Path root = path.getRoot();\n        Path path1 = root.toRealPath();\n        assertThat(root.toRealPath().toUri().toString()).isEqualTo(\"git://main@new-get-repo-name/\");\n        assertThat(path.toString()).isEqualTo(\"/home\");\n\n        final Path pathRelative = provider.getPath(URI.create(\"git://main@new-get-repo-name/:home\"));\n        AssertionsForClassTypes.assertThat(pathRelative).isNotNull();\n        assertThat(pathRelative.toRealPath().toUri().toString()).isEqualTo(\"git://main@new-get-repo-name/:home\");\n        assertThat(pathRelative.getRoot().toString()).isEqualTo(\"\");\n        assertThat(pathRelative.toString()).isEqualTo(\"home\");\n    }\n\n    @Test\n    public void testInvalidURIGetPath() {\n        final URI uri = URI.create(\"git:///main@new-get-repo-name/home\");\n\n        try {\n            provider.getPath(uri);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (final IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).isEqualTo(\"Parameter named 'uri' is invalid, missing host repository!\");\n        }\n    }\n\n    @Test\n    public void testGetComplexPath() {\n        final URI newRepo = URI.create(\"git://new-complex-get-repo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://origin/main@new-complex-get-repo-name/home\"));\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toString()).isEqualTo(\"/home\");\n\n        final Path pathRelative = provider.getPath(URI.create(\"git://origin/main@new-complex-get-repo-name/:home\"));\n        AssertionsForClassTypes.assertThat(pathRelative).isNotNull();\n        assertThat(pathRelative.getRoot().toString()).isEqualTo(\"\");\n        assertThat(pathRelative.toString()).isEqualTo(\"home\");\n    }\n\n    @Test\n    public void testGetComplexPathComposed() {\n        final URI newRepo = URI.create(\"git://new-complex-get-repo-name/composed\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path1 = provider.getPath(URI.create(\"git://new-complex-get-repo-name/composed/home\"));\n\n        AssertionsForClassTypes.assertThat(path1).isNotNull();\n        assertThat(path1.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path1.toString()).isEqualTo(\"/home\");\n\n        final Path path = provider.getPath(URI.create(\"git://origin/main@new-complex-get-repo-name/composed/home\"));\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toString()).isEqualTo(\"/home\");\n\n        final Path pathRelative = provider.getPath(URI.create(\"git://origin/main@new-complex-get-repo-name/composed/:home\"));\n        AssertionsForClassTypes.assertThat(pathRelative).isNotNull();\n        assertThat(pathRelative.getRoot().toString()).isEqualTo(\"\");\n        assertThat(pathRelative.toString()).isEqualTo(\"home\");\n    }\n\n    @Test\n    public void testInputStream() throws IOException {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"myfile.txt\",\n                           tempFile(\"temp\\n.origin\\n.content\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://inputstream-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://main@inputstream-test-repo/myfile.txt\"));\n\n        final String content = extractContent(path);\n\n        assertThat(content).isNotNull().isEqualTo(\"temp\\n.origin\\n.content\");\n    }\n\n    @Test\n    public void testInputStream2() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file/myfile.txt\",\n                           tempFile(\"temp\\n.origin\\n.content\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://xinputstream-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://main@xinputstream-test-repo/path/to/file/myfile.txt\"));\n\n        final String content = extractContent(path);\n\n        assertThat(content).isNotNull().isEqualTo(\"temp\\n.origin\\n.content\");\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void testInputStream3() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file/myfile.txt\",\n                           tempFile(\"temp\\n.origin\\n.content\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://xxinputstream-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://origin/main@xxinputstream-test-repo/path/to\"));\n\n        provider.newInputStream(path);\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void testInputStreamNoSuchFile() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user1\",\n                   \"user1@example.com\",\n                   \"commitx\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp.origin.content.2\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://inputstream-not-exists-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://origin/main@inputstream-not-exists-test-repo/temp.txt\"));\n\n        provider.newInputStream(path);\n    }\n\n    @Test\n    public void testNewOutputStream() throws Exception {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"myfile.txt\",\n                           tempFile(\"temp\\n.origin\\n.content\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"user_branch\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/some/file/myfile.txt\",\n                           tempFile(\"some\\n.content\\nhere\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://outstream-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@outstream-test-repo/some/path/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final InputStream inStream = provider.newInputStream(path);\n\n        final String content = new Scanner(inStream).useDelimiter(\"\\\\A\").next();\n\n        inStream.close();\n\n        assertThat(content).isNotNull().isEqualTo(\"my cool content\");\n\n        try {\n            provider.newOutputStream(provider.getPath(URI.create(\"git://user_branch@outstream-test-repo/some/path/\")));\n            failBecauseExceptionWasNotThrown(org.uberfire.java.nio.IOException.class);\n        } catch (Exception ignored) {\n        }\n    }\n\n    @Test\n    public void testNewOutputStreamWithJGitOp() throws Exception {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"myfile.txt\",\n                           tempFile(\"temp\\n.origin\\n.content\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"user_branch\",\n                   \"user\",\n                   \"user@example.com\",\n                   \"commit message\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/some/file/myfile.txt\",\n                           tempFile(\"some\\n.content\\nhere\"));\n                   }}).execute();\n\n        final URI newRepo = URI.create(\"git://outstreamwithop-test-repo\");\n\n        final Map<String, Object> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                origin.getRepository().getDirectory().toString());\n        }};\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     env);\n\n        assertThat(fs).isNotNull();\n\n        final SimpleDateFormat formatter = new SimpleDateFormat(\"dd/MM/yyyy\");\n\n        final CommentedOption op = new CommentedOption(\"User Tester\",\n                                                       \"user.tester@example.com\",\n                                                       \"omg, is it the end?\",\n                                                       formatter.parse(\"31/12/2012\"));\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@outstreamwithop-test-repo/some/path/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path,\n                                                                op);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final InputStream inStream = provider.newInputStream(path);\n\n        final String content = new Scanner(inStream).useDelimiter(\"\\\\A\").next();\n\n        inStream.close();\n\n        assertThat(content).isNotNull().isEqualTo(\"my cool content\");\n    }\n\n    @Test(expected = FileSystemNotFoundException.class)\n    public void testGetPathFileSystemNotExisting() {\n        provider.getPath(URI.create(\"git://main@not-exists-get-repo-name/home\"));\n    }\n\n    @Test(expected = FileSystemNotFoundException.class)\n    public void testGetFileSystemNotExisting() {\n        final URI newRepo = URI.create(\"git://not-new-repo-name\");\n\n        provider.getFileSystem(newRepo);\n    }\n\n    @Test\n    public void testDeleteShouldRemoveEmptyParentDir() throws IOException {\n\n        final URI doraRepo = URI.create(\"git://parentDir/dora-repo\");\n        FileSystem doraFS = provider.newFileSystem(doraRepo,\n                                                   EMPTY_ENV);\n\n        final File doraRepoDir = ((JGitFileSystemProxy) doraFS).getGit().getRepository().getDirectory();\n\n        final File parentDir = doraRepoDir.getParentFile();\n        final File gitProviderDir = provider.getGitRepoContainerDir();\n\n        final URI doraRepo1 = URI.create(\"git://parentDir/dora-repo1\");\n        FileSystem doraFS1 = provider.newFileSystem(doraRepo1,\n                                                    EMPTY_ENV);\n        final File dora1RepoDir = ((JGitFileSystemProxy) doraFS1).getGit().getRepository().getDirectory();\n\n        final File parentDir1 = doraRepoDir.getParentFile();\n\n        assertEquals(parentDir, parentDir1);\n\n        provider.delete(doraFS.getPath(null));\n        assertFalse(doraRepoDir.exists());\n        assertTrue(parentDir.exists());\n        assertTrue(gitProviderDir.exists());\n\n        provider.delete(doraFS1.getPath(null));\n        assertFalse(dora1RepoDir.exists());\n        assertTrue(parentDir1.exists());\n        assertTrue(gitProviderDir.exists());\n    }\n\n    @Test\n    public void testDelete() throws IOException {\n        final URI newRepo = URI.create(\"git://delete1-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@delete1-test-repo/path/to/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        provider.newInputStream(path).close();\n\n        try {\n            provider.delete(provider.getPath(URI.create(\"git://user_branch@delete1-test-repo/non_existent_path\")));\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n\n        try {\n            provider.delete(provider.getPath(URI.create(\"git://user_branch@delete1-test-repo/path/to/\")));\n            failBecauseExceptionWasNotThrown(DirectoryNotEmptyException.class);\n        } catch (DirectoryNotEmptyException ignored) {\n        }\n\n        provider.delete(path);\n\n        try {\n            provider.newFileSystem(newRepo,\n                                   EMPTY_ENV);\n            failBecauseExceptionWasNotThrown(FileSystemAlreadyExistsException.class);\n        } catch (FileSystemAlreadyExistsException ignored) {\n        }\n\n        final Path fsPath = path.getFileSystem().getPath(null);\n        provider.delete(fsPath);\n        assertThat(fsPath.getFileSystem().isOpen()).isEqualTo(false);\n\n        final URI newRepo2 = URI.create(\"git://delete1-test-repo\");\n        provider.newFileSystem(newRepo2,\n                               EMPTY_ENV);\n    }\n\n    @Test\n    public void testDeleteBranch() throws IOException {\n        final URI newRepo = URI.create(\"git://delete-branch-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@delete-branch-test-repo/path/to/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        provider.newInputStream(path).close();\n\n        provider.delete(provider.getPath(URI.create(\"git://user_branch@delete-branch-test-repo\")));\n\n        try {\n            provider.delete(provider.getPath(URI.create(\"git://user_branch@delete-branch-test-repo\")));\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n\n        try {\n            provider.delete(provider.getPath(URI.create(\"git://some_user_branch@delete-branch-test-repo\")));\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n    }\n\n    @Test\n    public void testDeleteIfExists() throws IOException {\n        final URI newRepo = URI.create(\"git://deleteifexists1-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@deleteifexists1-test-repo/path/to/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        provider.newInputStream(path).close();\n\n        assertThat(provider.deleteIfExists(provider.getPath(URI.create(\"git://user_branch@deleteifexists1-test-repo/non_existent_path\")))).isFalse();\n\n        try {\n            provider.deleteIfExists(provider.getPath(URI.create(\"git://user_branch@deleteifexists1-test-repo/path/to/\")));\n            failBecauseExceptionWasNotThrown(DirectoryNotEmptyException.class);\n        } catch (DirectoryNotEmptyException ignored) {\n        }\n\n        assertThat(provider.deleteIfExists(path)).isTrue();\n    }\n\n    @Test\n    public void testDeleteBranchIfExists() throws IOException {\n        final URI newRepo = URI.create(\"git://deletebranchifexists1-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@deletebranchifexists1-test-repo/path/to/myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        provider.newInputStream(path).close();\n\n        assertThat(provider.deleteIfExists(provider.getPath(URI.create(\"git://user_branch@deletebranchifexists1-test-repo\")))).isTrue();\n\n        assertThat(provider.deleteIfExists(provider.getPath(URI.create(\"git://not_user_branch@deletebranchifexists1-test-repo\")))).isFalse();\n\n        assertThat(provider.deleteIfExists(provider.getPath(URI.create(\"git://user_branch@deletebranchifexists1-test-repo\")))).isFalse();\n    }\n\n    @Test\n    public void testIsHidden() throws IOException {\n        final URI newRepo = URI.create(\"git://ishidden-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/.myfile.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/myfile.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        assertThat(outStream2).isNotNull();\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/.myfile.txt\")))).isTrue();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/myfile.txt\")))).isFalse();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/non_existent/.myfile.txt\")))).isTrue();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/path/to/non_existent/myfile.txt\")))).isFalse();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/\")))).isFalse();\n\n        assertThat(provider.isHidden(provider.getPath(URI.create(\"git://user_branch@ishidden-test-repo/some\")))).isFalse();\n    }\n\n    @Test\n    public void testIsSameFile() throws IOException {\n        final URI newRepo = URI.create(\"git://issamefile-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@issamefile-test-repo/path/to/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@issamefile-test-repo/path/to/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@issamefile-test-repo/path/to/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        assertThat(provider.isSameFile(path,\n                                       path2)).isTrue();\n\n        assertThat(provider.isSameFile(path,\n                                       path3)).isTrue();\n    }\n\n    @Test\n    public void testCreateDirectory() {\n        final URI newRepo = URI.create(\"git://xcreatedir-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final JGitPathImpl path = (JGitPathImpl) provider.getPath(URI.create(\"git://main@xcreatedir-test-repo/some/path/to/\"));\n\n        final PathInfo result = path.getFileSystem().getGit().getPathInfo(path.getRefTree(),\n                                                                          path.getPath());\n        assertThat(result.getPathType()).isEqualTo(PathType.NOT_FOUND);\n\n        provider.createDirectory(path);\n\n        final PathInfo resultAfter = path.getFileSystem().getGit().getPathInfo(path.getRefTree(),\n                                                                               path.getPath());\n        assertThat(resultAfter.getPathType()).isEqualTo(PathType.DIRECTORY);\n\n        final Path gitkeepPath = path.resolve(\".gitkeep\");\n        assertThat(provider.exists(gitkeepPath)).isEqualTo(true);\n\n        try {\n            provider.createDirectory(path);\n            failBecauseExceptionWasNotThrown(FileAlreadyExistsException.class);\n        } catch (FileAlreadyExistsException ignored) {\n        }\n    }\n\n    @Test\n    public void testCheckAccess() throws Exception {\n        final URI newRepo = URI.create(\"git://checkaccess-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@checkaccess-test-repo/path/to/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        provider.checkAccess(path);\n\n        final Path path_to_dir = provider.getPath(URI.create(\"git://main@checkaccess-test-repo/path/to\"));\n\n        provider.checkAccess(path_to_dir);\n\n        final Path path_not_exists = provider.getPath(URI.create(\"git://main@checkaccess-test-repo/path/to/some.txt\"));\n\n        try {\n            provider.checkAccess(path_not_exists);\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n    }\n\n    @Test\n    public void testGetFileStore() throws Exception {\n        final URI newRepo = URI.create(\"git://filestore-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@filestore-test-repo/path/to/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final FileStore fileStore = provider.getFileStore(path);\n\n        assertThat(fileStore).isNotNull();\n\n        assertThat(fileStore.getAttribute(\"readOnly\")).isEqualTo(Boolean.FALSE);\n    }\n\n    @Test\n    public void testNewDirectoryStream() throws IOException {\n        final URI newRepo = URI.create(\"git://dirstream-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@dirstream-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        final DirectoryStream<Path> stream1 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/\")),\n                                                                          null);\n\n        assertThat(stream1).isNotNull().hasSize(2).contains(path3,\n                                                            provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/other\")));\n\n        final DirectoryStream<Path> stream2 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/other\")),\n                                                                          null);\n\n        assertThat(stream2).isNotNull().hasSize(1).contains(provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/other/path\")));\n\n        final DirectoryStream<Path> stream3 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://user_branch@dirstream-test-repo/other/path\")),\n                                                                          null);\n\n        assertThat(stream3).isNotNull().hasSize(1).contains(path2);\n\n        final DirectoryStream<Path> stream4 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://main@dirstream-test-repo/\")),\n                                                                          null);\n\n        assertThat(stream4).isNotNull().hasSize(1).contains(path);\n\n        try {\n            provider.newDirectoryStream(path,\n                                        null);\n            failBecauseExceptionWasNotThrown(NotDirectoryException.class);\n        } catch (NotDirectoryException ignored) {\n        }\n        final Path crazyPath = provider.getPath(URI.create(\"git://main@dirstream-test-repo/crazy/path/here\"));\n        try {\n            provider.newDirectoryStream(crazyPath,\n                                        null);\n            failBecauseExceptionWasNotThrown(NotDirectoryException.class);\n        } catch (NotDirectoryException ignored) {\n        }\n\n        provider.createDirectory(crazyPath);\n\n        assertThat(provider.newDirectoryStream(crazyPath,\n                                               null)).isNotNull().hasSize(1);\n    }\n\n    @Test\n    public void testDeleteNonEmptyDirectory() throws IOException {\n        final URI newRepo = URI.create(\"git://delete-non-empty-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path dir = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/other/path\"));\n\n        final Path _root = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/myfile1.txt\"));\n\n        final OutputStream outRootStream = provider.newOutputStream(_root);\n        outRootStream.write(\"my cool content\".getBytes());\n        outRootStream.close();\n\n        final Path path = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/other/path/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/other/path/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        final Path dir1 = provider.getPath(URI.create(\"git://main@delete-non-empty-test-repo/other/path/dir\"));\n\n        provider.createDirectory(dir1);\n\n        final DirectoryStream<Path> stream3 = provider.newDirectoryStream(dir,\n                                                                          null);\n\n        assertThat(stream3).isNotNull().hasSize(4);\n\n        try {\n            provider.delete(dir);\n            fail(\"dir not empty\");\n        } catch (final DirectoryNotEmptyException ignore) {\n        }\n\n        try {\n            final CommentedOption op = new CommentedOption(\"User Tester\",\n                                                           \"user.tester@example.com\",\n                                                           \"omg, erase dir!\");\n\n            provider.delete(dir,\n                            NON_EMPTY_DIRECTORIES,\n                            op);\n        } catch (final DirectoryNotEmptyException ignore) {\n            fail(\"dir should be deleted!\");\n        }\n\n        assertThat(provider.exists(dir)).isEqualTo(false);\n    }\n\n    @Test\n    public void testFilteredNewDirectoryStream() throws IOException {\n        final URI newRepo = URI.create(\"git://filter-dirstream-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@filter-dirstream-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@filter-dirstream-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@filter-dirstream-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        final Path path4 = provider.getPath(URI.create(\"git://user_branch@filter-dirstream-test-repo/myfile4.xxx\"));\n\n        final OutputStream outStream4 = provider.newOutputStream(path4);\n        outStream4.write(\"my cool content\".getBytes());\n        outStream4.close();\n\n        final DirectoryStream<Path> stream1 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://user_branch@filter-dirstream-test-repo/\")),\n                                                                          entry -> entry.toString().endsWith(\".xxx\"));\n\n        assertThat(stream1).isNotNull().hasSize(1).contains(path4);\n\n        final DirectoryStream<Path> stream2 = provider.newDirectoryStream(provider.getPath(URI.create(\"git://main@filter-dirstream-test-repo/\")),\n                                                                          entry -> false);\n\n        assertThat(stream2).isNotNull().hasSize(0);\n    }\n\n    @Test\n    public void testGetFileAttributeView() throws IOException {\n        final URI newRepo = URI.create(\"git://getfileattriview-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@getfileattriview-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@getfileattriview-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@getfileattriview-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        final JGitVersionAttributeView attrs = provider.getFileAttributeView(path3,\n                                                                             JGitVersionAttributeView.class);\n\n        assertThat(attrs.readAttributes().history().records().size()).isEqualTo(1);\n        assertThat(attrs.readAttributes().history().records().get(0).uri()).isNotNull();\n\n        assertThat(attrs.readAttributes().isDirectory()).isFalse();\n        assertThat(attrs.readAttributes().isRegularFile()).isTrue();\n        assertThat(attrs.readAttributes().creationTime()).isNotNull();\n        assertThat(attrs.readAttributes().lastModifiedTime()).isNotNull();\n        assertThat(attrs.readAttributes().size()).isEqualTo(15L);\n\n        try {\n            provider.getFileAttributeView(provider.getPath(URI.create(\"git://user_branch@getfileattriview-test-repo/not_exists.txt\")),\n                                          BasicFileAttributeView.class);\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (Exception ignored) {\n        }\n\n        assertThat(provider.getFileAttributeView(path3,\n                                                 MyInvalidFileAttributeView.class)).isNull();\n\n        final Path rootPath = provider.getPath(URI.create(\"git://user_branch@getfileattriview-test-repo/\"));\n\n        final BasicFileAttributeView attrsRoot = provider.getFileAttributeView(rootPath,\n                                                                               BasicFileAttributeView.class);\n\n        assertThat(attrsRoot.readAttributes().isDirectory()).isTrue();\n        assertThat(attrsRoot.readAttributes().isRegularFile()).isFalse();\n        assertThat(attrsRoot.readAttributes().creationTime()).isNotNull();\n        assertThat(attrsRoot.readAttributes().lastModifiedTime()).isNotNull();\n        assertThat(attrsRoot.readAttributes().size()).isEqualTo(-1L);\n\n        final Path prRootPath = provider.getPath(URI.create(\"git://PR-1-from/develop-main@getfileattriview-test-repo/\"));\n\n        final HiddenAttributeView extendedAttrs = provider.getFileAttributeView(prRootPath,\n                                                                                HiddenAttributeView.class);\n\n        assertThat(extendedAttrs.readAttributes().isDirectory()).isTrue();\n        assertThat(extendedAttrs.readAttributes().isRegularFile()).isFalse();\n        assertThat(extendedAttrs.readAttributes().isHidden()).isEqualTo(true);\n        assertThat(extendedAttrs.readAttributes().size()).isEqualTo(-1L);\n        assertThat(extendedAttrs.readAttributes().creationTime()).isNotNull();\n        assertThat(extendedAttrs.readAttributes().lastModifiedTime()).isNotNull();\n    }\n\n    @Test\n    public void testReadAttributes() throws IOException {\n        final URI newRepo = URI.create(\"git://readattrs-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@readattrs-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@readattrs-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@readattrs-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        final BasicFileAttributes attrs = provider.readAttributes(path3,\n                                                                  BasicFileAttributes.class);\n\n        assertThat(attrs.isDirectory()).isFalse();\n        assertThat(attrs.isRegularFile()).isTrue();\n        assertThat(attrs.creationTime()).isNotNull();\n        assertThat(attrs.lastModifiedTime()).isNotNull();\n        assertThat(attrs.size()).isEqualTo(15L);\n\n        try {\n            provider.readAttributes(provider.getPath(URI.create(\"git://user_branch@readattrs-test-repo/not_exists.txt\")),\n                                    BasicFileAttributes.class);\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n\n        assertThat(provider.readAttributes(path3,\n                                           MyAttrs.class)).isNull();\n\n        final Path rootPath = provider.getPath(URI.create(\"git://user_branch@readattrs-test-repo/\"));\n\n        final BasicFileAttributes attrsRoot = provider.readAttributes(rootPath,\n                                                                      BasicFileAttributes.class);\n\n        assertThat(attrsRoot.isDirectory()).isTrue();\n        assertThat(attrsRoot.isRegularFile()).isFalse();\n        assertThat(attrsRoot.creationTime()).isNotNull();\n        assertThat(attrsRoot.lastModifiedTime()).isNotNull();\n        assertThat(attrsRoot.size()).isEqualTo(-1L);\n    }\n\n    @Test\n    public void testReadAttributesMap() throws IOException {\n        final URI newRepo = URI.create(\"git://readattrsmap-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@readattrsmap-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@readattrsmap-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@readattrsmap-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        assertThat(provider.readAttributes(path,\n                                           \"*\")).isNotNull().hasSize(9);\n        assertThat(provider.readAttributes(path,\n                                           \"basic:*\")).isNotNull().hasSize(9);\n        assertThat(provider.readAttributes(path,\n                                           \"basic:isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(provider.readAttributes(path,\n                                           \"basic:isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(path,\n                                           \"basic:isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(path,\n                                           \"basic:someThing\")).isNotNull().hasSize(0);\n        assertThat(provider.readAttributes(path,\n                                           \"version:version\")).isNotNull().hasSize(1);\n\n        assertThat(provider.readAttributes(path,\n                                           \"isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(provider.readAttributes(path,\n                                           \"isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(path,\n                                           \"isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(path,\n                                           \"someThing\")).isNotNull().hasSize(0);\n\n        try {\n            provider.readAttributes(path,\n                                    \":someThing\");\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (IllegalArgumentException ignored) {\n        }\n\n        try {\n            provider.readAttributes(path,\n                                    \"advanced:isRegularFile\");\n            failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);\n        } catch (UnsupportedOperationException ignored) {\n        }\n\n        final Path rootPath = provider.getPath(URI.create(\"git://user_branch@readattrsmap-test-repo/\"));\n\n        assertThat(provider.readAttributes(rootPath,\n                                           \"*\")).isNotNull().hasSize(9);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"basic:*\")).isNotNull().hasSize(9);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"basic:isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"basic:isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"basic:isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"basic:someThing\")).isNotNull().hasSize(0);\n\n        assertThat(provider.readAttributes(rootPath,\n                                           \"isRegularFile\")).isNotNull().hasSize(1);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"isRegularFile,isDirectory\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"isRegularFile,isDirectory,someThing\")).isNotNull().hasSize(2);\n        assertThat(provider.readAttributes(rootPath,\n                                           \"someThing\")).isNotNull().hasSize(0);\n\n        try {\n            provider.readAttributes(rootPath,\n                                    \":someThing\");\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (IllegalArgumentException ignored) {\n        }\n\n        try {\n            provider.readAttributes(rootPath,\n                                    \"advanced:isRegularFile\");\n            failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);\n        } catch (UnsupportedOperationException ignored) {\n        }\n\n        try {\n            provider.readAttributes(provider.getPath(URI.create(\"git://user_branch@readattrsmap-test-repo/not_exists.txt\")),\n                                    BasicFileAttributes.class);\n            failBecauseExceptionWasNotThrown(NoSuchFileException.class);\n        } catch (NoSuchFileException ignored) {\n        }\n    }\n\n    @Test\n    public void testSetAttribute() throws IOException {\n        final URI newRepo = URI.create(\"git://setattr-test-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://main@setattr-test-repo/myfile1.txt\"));\n\n        final OutputStream outStream = provider.newOutputStream(path);\n        outStream.write(\"my cool content\".getBytes());\n        outStream.close();\n\n        final Path path2 = provider.getPath(URI.create(\"git://user_branch@setattr-test-repo/other/path/myfile2.txt\"));\n\n        final OutputStream outStream2 = provider.newOutputStream(path2);\n        outStream2.write(\"my cool content\".getBytes());\n        outStream2.close();\n\n        final Path path3 = provider.getPath(URI.create(\"git://user_branch@setattr-test-repo/myfile3.txt\"));\n\n        final OutputStream outStream3 = provider.newOutputStream(path3);\n        outStream3.write(\"my cool content\".getBytes());\n        outStream3.close();\n\n        try {\n            provider.setAttribute(path3,\n                                  \"basic:isRegularFile\",\n                                  true);\n            failBecauseExceptionWasNotThrown(NotImplementedException.class);\n        } catch (NotImplementedException ignored) {\n        }\n\n        try {\n            provider.setAttribute(path3,\n                                  \"isRegularFile\",\n                                  true);\n            failBecauseExceptionWasNotThrown(NotImplementedException.class);\n        } catch (NotImplementedException ignored) {\n        }\n\n        try {\n            provider.setAttribute(path3,\n                                  \"notExisits\",\n                                  true);\n            failBecauseExceptionWasNotThrown(IllegalStateException.class);\n        } catch (IllegalStateException ignored) {\n        }\n\n        try {\n            provider.setAttribute(path3,\n                                  \"advanced:notExisits\",\n                                  true);\n            failBecauseExceptionWasNotThrown(UnsupportedOperationException.class);\n        } catch (UnsupportedOperationException ignored) {\n        }\n\n        try {\n            provider.setAttribute(path3,\n                                  \":isRegularFile\",\n                                  true);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (IllegalArgumentException ignored) {\n        }\n    }\n\n    @Test\n    public void checkProperAmend() throws Exception {\n\n        final URI newRepo = URI.create(\"git://outstream-test-repo\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     new HashMap<String, Object>() {{\n                                                         put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT,\n                                                             \"true\");\n                                                     }});\n\n        assertThat(fs).isNotNull();\n\n        for (int z = 0; z < 5; z++) {\n            final Path _path = provider.getPath(URI.create(\"git://user_branch@outstream-test-repo/some/path/myfile.txt\"));\n            provider.setAttribute(_path,\n                                  FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                                  FileSystemState.BATCH);\n            {\n                final Path path = provider.getPath(URI.create(\"git://user_branch@outstream-test-repo/some/path/myfile.txt\"));\n                final OutputStream outStream = provider.newOutputStream(path);\n                assertThat(outStream).isNotNull();\n                outStream.write((\"my cool content\" + z).getBytes());\n                outStream.close();\n            }\n            {\n                final Path path2 = provider.getPath(URI.create(\"git://error_branch@outstream-test-repo/some/path/myfile.txt\"));\n                final OutputStream outStream2 = provider.newOutputStream(path2);\n                assertThat(outStream2).isNotNull();\n                outStream2.write((\"bad content\" + z).getBytes());\n                outStream2.close();\n            }\n\n            provider.setAttribute(_path,\n                                  FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                                  FileSystemState.NORMAL);\n        }\n\n        final Path path = provider.getPath(URI.create(\"git://error_branch@outstream-test-repo/some/path/myfile.txt\"));\n        final JGitVersionAttributeView attrs = provider.getFileAttributeView(path.getRoot(),\n                                                                             JGitVersionAttributeView.class);\n\n        assertThat(attrs.readAttributes().history().records().size()).isEqualTo(5);\n    }\n\n    @Test\n    public void accessOldVersions() throws Exception {\n\n        final URI newRepo = URI.create(\"git://old-versions-test-repo\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     new HashMap<String, Object>() {{\n                                                         put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT,\n                                                             \"true\");\n                                                     }});\n\n        assertThat(fs).isNotNull();\n\n        for (int i = 0; i < 5; i++) {\n            final Path path = provider.getPath(URI.create(\"git://old-versions-test-repo/some/path/myfile.txt\"));\n            final OutputStream outStream = provider.newOutputStream(path);\n            assertThat(outStream).isNotNull();\n            outStream.write((\"my cool content\" + i).getBytes());\n            outStream.close();\n        }\n\n        final Path path = provider.getPath(URI.create(\"git://old-versions-test-repo/some/path/myfile.txt\"));\n        final JGitVersionAttributeView attrs = provider.getFileAttributeView(path,\n                                                                             JGitVersionAttributeView.class);\n\n        assertThat(attrs.readAttributes().history().records().size()).isEqualTo(5);\n\n        for (int i = 0; i < 5; i++) {\n            final Path oldPath = provider.getPath(URI.create(\"git://\" + attrs.readAttributes().history().records().get(i).id() + \"@old-versions-test-repo/some/path/myfile.txt\"));\n            final InputStream stream = provider.newInputStream(oldPath);\n            assertNotNull(stream);\n            final String content = new Scanner(stream).useDelimiter(\"\\\\A\").next();\n            assertEquals(\"my cool content\" + i,\n                         content);\n        }\n    }\n\n    @Test\n    public void checkProperSquash() throws IOException, GitAPIException {\n\n        final URI newRepo = URI.create(\"git://squash-repo\");\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        final Path generalPath = provider.getPath(URI.create(\"git://main@squash-repo/\"));\n        final Path path = provider.getPath(URI.create(\"git://main@squash-repo/myfile1.txt\"));\n        final Path path2 = provider.getPath(URI.create(\"git://main@squash-repo/myfile2.txt\"));\n        final Path path3 = provider.getPath(URI.create(\"git://main@squash-repo/myfile3.txt\"));\n\n        final OutputStream aStream = provider.newOutputStream(path);\n        aStream.write(\"my cool content\".getBytes());\n        aStream.close();\n        final RevCommit commit = ((GitImpl) fs.getGit())._log().add(fs.getGit().getRef(\"main\").getObjectId()).setMaxCount(1).call().iterator().next();\n\n        final OutputStream bStream = provider.newOutputStream(path2);\n        bStream.write(\"my cool content\".getBytes());\n        bStream.close();\n        final OutputStream cStream = provider.newOutputStream(path3);\n        cStream.write(\"my cool content\".getBytes());\n        cStream.close();\n\n        final VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                       \"aparedes@redhat.com\",\n                                                       \"squashing!\",\n                                                       new Date(),\n                                                       commit.getName());\n        final SquashOption squashOption = new SquashOption(record);\n\n        provider.setAttribute(generalPath,\n                              SquashOption.SQUASH_ATTR,\n                              squashOption);\n\n        int commitsCount = 0;\n        for (RevCommit com : ((GitImpl) fs.getGit())._log().all().call()) {\n            commitsCount++;\n            System.out.println(com.getName() + \" - \" + com.getFullMessage());\n        }\n        assertThat(commitsCount).isEqualTo(2);\n    }\n\n    @Test(expected = GitException.class)\n    public void testSquashFailBecauseCommitIsFromAnotherBranch() throws IOException, GitAPIException {\n\n        final URI newRepo = URI.create(\"git://squash-repo\");\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(newRepo,\n                                                                          EMPTY_ENV);\n\n        final Path generalPath = provider.getPath(URI.create(\"git://main@squash-repo/\"));\n        final Path path = provider.getPath(URI.create(\"git://develop@squash-repo/myfile1.txt\"));\n        final Path path2 = provider.getPath(URI.create(\"git://main@squash-repo/myfile2.txt\"));\n        final Path path3 = provider.getPath(URI.create(\"git://main@squash-repo/myfile3.txt\"));\n\n        final OutputStream aStream = provider.newOutputStream(path);\n        aStream.write(\"my cool content\".getBytes());\n        aStream.close();\n\n        final List<RevCommit> commits = getCommitsFromBranch((GitImpl) fs.getGit(),\n                                                             \"develop\");\n\n        final OutputStream bStream = provider.newOutputStream(path2);\n        bStream.write(\"my cool content\".getBytes());\n        bStream.close();\n        final OutputStream cStream = provider.newOutputStream(path3);\n        cStream.write(\"my cool content\".getBytes());\n        cStream.close();\n\n        final VersionRecord record = makeVersionRecord(\"aparedes\",\n                                                       \"aparedes@redhat.com\",\n                                                       \"squashing!\",\n                                                       new Date(),\n                                                       commits.get(0).getName());\n        final SquashOption squashOption = new SquashOption(record);\n\n        provider.setAttribute(generalPath,\n                              SquashOption.SQUASH_ATTR,\n                              squashOption);\n    }\n\n    @Test\n    public void checkBatchError() throws Exception {\n        final URI newRepo = URI.create(\"git://outstream-test-repo\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     new HashMap<String, Object>() {{\n                                                         put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT,\n                                                             \"true\");\n                                                     }});\n\n        provider = spy(provider);\n\n        doThrow(new RuntimeException()).\n                when(provider).\n                notifyDiffs(any(JGitFileSystemImpl.class),\n                            any(String.class),\n                            any(String.class),\n                            any(String.class),\n                            any(String.class),\n                            any(ObjectId.class),\n                            any(ObjectId.class));\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://user_branch@outstream-test-repo/some/path/myfile.txt\"));\n        provider.setAttribute(path,\n                              FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                              FileSystemState.BATCH);\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write((\"my cool content\").getBytes());\n        outStream.close();\n\n        try {\n            provider.setAttribute(path,\n                                  FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                                  FileSystemState.NORMAL);\n        } catch (Exception ex) {\n            fail(\"Batch can't fail!\",\n                 ex);\n        }\n    }\n\n    @Test\n    public void resolveFSName() {\n\n        String fsName = \"dora-repo\";\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"git://dora-repo\")));\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"default://dora-repo\")));\n\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"git://branch@dora-repo\")));\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"default://branch@dora-repo\")));\n\n        fsName = \"dora-repo/subdir\";\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"git://dora-repo/subdir\")));\n        assertEquals(\"dora-repo/subdir\",\n                     provider.extractFSName(URI.create(\"default://dora-repo/subdir\")));\n\n        assertEquals(\"dora-repo/subdir\",\n                     provider.extractFSName(URI.create(\"git://branch@dora-repo/subdir\")));\n        assertEquals(\"dora-repo/subdir\",\n                     provider.extractFSName(URI.create(\"default://branch@dora-repo/subdir\")));\n\n        fsName = \"dora-repo/subdir/subdir\";\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"git://dora-repo/subdir/subdir\")));\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"default://dora-repo/subdir/subdir\")));\n\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"git://branch@dora-repo/subdir/subdir\")));\n        assertEquals(fsName,\n                     provider.extractFSName(URI.create(\"default://branch@dora-repo/subdir/subdir\")));\n    }\n\n    @Test\n    public void resolveSimpleFSNames() {\n\n        final URI newRepo = URI.create(\"git://dora-repo\");\n\n        try {\n            final Path path = provider.getPath(URI.create(\"git://dora-repo/some/path/myfile.txt\"));\n            fail(\"should triggered FileSystemNotFoundException\");\n        } catch (FileSystemNotFoundException e) {\n            //ignored\n        }\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        final Path path = provider.getPath(URI.create(\"git://dora-repo/some/path/myfile.txt\"));\n        final Path another = provider.getPath(URI.create(\"git://dora-repo/another/path/myfile.txt\"));\n\n        assertEquals(fs,\n                     path.getFileSystem());\n        assertEquals(path.getFileSystem(),\n                     another.getFileSystem());\n    }\n\n    @Test\n    public void resolveComposedFSNames() {\n\n        final URI simpleName = URI.create(\"git://dora-repo\");\n\n        final FileSystem fsSimpleName = provider.newFileSystem(simpleName,\n                                                               EMPTY_ENV);\n\n        assertThat(fsSimpleName).isNotNull();\n\n        final URI composedName = URI.create(\"git://ou-dora/dora-repo\");\n\n        final FileSystem fsComposedName = provider.newFileSystem(composedName,\n                                                                 EMPTY_ENV);\n\n        assertThat(fsComposedName).isNotNull();\n\n        assertNotSame(fsSimpleName,\n                      fsComposedName);\n\n        assertEquals(fsSimpleName,\n                     provider.getFileSystem(simpleName));\n\n        assertEquals(fsComposedName,\n                     provider.getFileSystem(composedName));\n\n        final URI simpleFileName = URI.create(\"git://dora-repo/file.txt\");\n\n        assertEquals(fsSimpleName,\n                     provider.getFileSystem(simpleFileName));\n\n        final URI composedFileName = URI.create(\"git://ou-dora/dora-repo/file.txt\");\n\n        assertEquals(fsComposedName,\n                     provider.getFileSystem(composedFileName));\n    }\n\n    @Test\n    public void validFSNameTest() {\n\n        checkAmbiguousFS(\"git://dora-repo\",\n                         \"git://dora-repo/subdir\");\n\n        checkAmbiguousFS(\"git://bento-repo/subdir\",\n                         \"git://bento-repo\");\n\n        checkAmbiguousFS(\"git://leao\",\n                         \"default://leao/subdir/subdir\");\n\n        checkAmbiguousFS(\"git://rex/subdir\",\n                         \"git://rex\",\n                         \"git://rex/subdir/subdir\",\n                         \"git://rex/subdir/subdir\");\n\n        provider.newFileSystem(URI.create(\"git://ou/dora\"),\n                               EMPTY_ENV);\n        provider.newFileSystem(URI.create(\"git://user1/dora\"),\n                               EMPTY_ENV);\n        provider.newFileSystem(URI.create(\"git://user2/dora\"),\n                               EMPTY_ENV);\n        provider.newFileSystem(URI.create(\"git://user3/dora\"),\n                               EMPTY_ENV);\n    }\n\n    private void checkAmbiguousFS(String fsOriginalName,\n                                  String... ambiguousFsName) {\n        provider.newFileSystem(URI.create(fsOriginalName),\n                               EMPTY_ENV);\n        try {\n            for (String fsName : ambiguousFsName) {\n                provider.newFileSystem(URI.create(fsName),\n                                       EMPTY_ENV);\n            }\n            fail(\"ambiguous fs\");\n        } catch (AmbiguousFileSystemNameException e) {\n            //expected\n        }\n    }\n\n    @Test\n    public void checkRootPath() {\n\n        URI composedName = URI.create(\"git://dora-repo/subdir1\");\n\n        FileSystem fsComposedName = provider.newFileSystem(composedName,\n                                                           EMPTY_ENV);\n\n        Path path = provider.getPath(URI.create(\"git://dora-repo/subdir1/file.txt\"));\n        Path path1 = provider.getPath(URI.create(\"git://origin/bla@dora-repo/subdir1/file2.txt\"));\n\n        assertEquals(fsComposedName,\n                     path.getRoot().getFileSystem());\n\n        assertEquals(fsComposedName,\n                     path1.getRoot().getFileSystem());\n    }\n\n    @Test\n    public void getPathForComposedFSNames() {\n\n        URI composedName = URI.create(\"git://dora-repo/subdir1\");\n\n        FileSystem fsComposedName = provider.newFileSystem(composedName,\n                                                           EMPTY_ENV);\n        URI simpleFileName = URI.create(\"git://dora-repo/subdir1/file.txt\");\n\n        Path path = provider.getPath(simpleFileName);\n\n        assertEquals(fsComposedName,\n                     path.getFileSystem());\n        assertEquals(\"/file.txt\",\n                     ((JGitPathImpl) path).getPath());\n\n        URI simpleName = URI.create(\"git://bento-repo/\");\n\n        FileSystem fsSimpleName = provider.newFileSystem(simpleName,\n                                                         EMPTY_ENV);\n\n        URI composedFileName = URI.create(\"git://bento-repo/subdir1/file.txt\");\n\n        path = provider.getPath(composedFileName);\n\n        assertEquals(fsSimpleName,\n                     path.getFileSystem());\n        assertEquals(\"/subdir1/file.txt\",\n                     ((JGitPathImpl) path).getPath());\n\n        composedFileName = URI.create(\"git://bento-repo/subdir1/subdir2/file.txt\");\n\n        path = provider.getPath(composedFileName);\n\n        assertEquals(fsSimpleName,\n                     path.getFileSystem());\n        assertEquals(\"/subdir1/subdir2/file.txt\",\n                     ((JGitPathImpl) path).getPath());\n\n        composedFileName = URI.create(\"git://bento-repo/subdir1/subdir2/subdir3\");\n\n        path = provider.getPath(composedFileName);\n\n        assertEquals(fsSimpleName,\n                     path.getFileSystem());\n        assertEquals(\"/subdir1/subdir2/subdir3\",\n                     ((JGitPathImpl) path).getPath());\n    }\n\n    @Test\n    public void getPathForComposedFSNames2() {\n        URI composedName = URI.create(\"git://user1/dora\");\n\n        FileSystem fsComposedName1 = provider.newFileSystem(composedName,\n                                                            EMPTY_ENV);\n\n        URI composedName2 = URI.create(\"git://user2/dora\");\n\n        FileSystem fsComposedName2 = provider.newFileSystem(composedName2,\n                                                            EMPTY_ENV);\n\n        URI composedFileName1 = URI.create(\"git://user1/dora/file.txt\");\n\n        Path path1 = provider.getPath(composedFileName1);\n\n        URI composedFileName2 = URI.create(\"git://user2/dora/file.txt\");\n\n        Path path2 = provider.getPath(composedFileName2);\n\n        assertNotEquals(fsComposedName1,\n                        fsComposedName2);\n        assertNotEquals(path1.getFileSystem(),\n                        path2.getFileSystem());\n\n        assertEquals(path2.toString(),\n                     provider.extractPath(composedFileName2));\n    }\n\n    @Test\n    public void extractPathTest() {\n\n        URI composedName = URI.create(\"git://user1/dora\");\n\n        FileSystem fsComposedName1 = provider.newFileSystem(composedName,\n                                                            EMPTY_ENV);\n\n        URI composedFileName1 = URI.create(\"git://user1/dora/file.txt\");\n\n        Path path1 = provider.getPath(composedFileName1);\n\n        assertEquals(path1.toString(),\n                     provider.extractPath(composedFileName1));\n    }\n\n    @Test\n    public void resolveByRepositoryTest() {\n\n        JGitFileSystem fsSimpleName = ((JGitFileSystemProxy) provider.newFileSystem(URI.create(\"git://repo\"),\n                                                                                    EMPTY_ENV)).getRealJGitFileSystem();\n\n        JGitFileSystemProvider.RepositoryResolverImpl<Object> objectRepositoryResolver = provider.new RepositoryResolverImpl<>();\n\n        assertEquals(fsSimpleName,\n                     objectRepositoryResolver.resolveFileSystem(fsSimpleName.getGit().getRepository()));\n\n        JGitFileSystem fsComposedName1 = ((JGitFileSystemProxy) provider.newFileSystem(URI.create(\"git://user1/dora\"),\n                                                                                       EMPTY_ENV)).getRealJGitFileSystem();\n\n        assertEquals(fsComposedName1,\n                     objectRepositoryResolver.resolveFileSystem(fsComposedName1.getGit().getRepository()));\n    }\n\n    @Test\n    public void extractFSHooksTest() {\n        Map<String, Object> env = new HashMap<>();\n\n        Object hook = (FileSystemHooks.FileSystemHook) context -> {\n        };\n\n        env.put(\"dora\", \"bento\");\n        env.put(FileSystemHooks.ExternalUpdate.name(), hook);\n\n        Map<FileSystemHooks, ?> fileSystemHooksMap = JGitFileSystemProvider.extractFSHooks(env);\n\n        assertEquals(1, fileSystemHooksMap.size());\n        assertTrue(fileSystemHooksMap.keySet().contains(FileSystemHooks.ExternalUpdate));\n        assertEquals(hook, fileSystemHooksMap.get(FileSystemHooks.ExternalUpdate));\n    }\n\n    @Test\n    public void extractCheckBranchAccessHookTest() {\n        Map<String, Object> env = new HashMap<>();\n\n        Object hook = (FileSystemHooks.FileSystemHook) context -> {\n        };\n\n        env.put(\"dora\", \"bento\");\n        env.put(FileSystemHooks.BranchAccessCheck.name(), hook);\n\n        Map<FileSystemHooks, ?> fileSystemHooksMap = JGitFileSystemProvider.extractFSHooks(env);\n\n        assertEquals(1, fileSystemHooksMap.size());\n        assertTrue(fileSystemHooksMap.keySet().contains(FileSystemHooks.BranchAccessCheck));\n        assertEquals(hook, fileSystemHooksMap.get(FileSystemHooks.BranchAccessCheck));\n    }\n\n    @Test\n    public void testCloseFileSystem() {\n\n        JGitFileSystemProvider fsProvider = spy(new JGitFileSystemProvider(getGitPreferences()) {\n\n            @Override\n            protected void setupFileSystemsManager() {\n                fsManager = mock(JGitFileSystemsManager.class);\n                when(fsManager.allTheFSAreClosed()).thenReturn(true);\n            }\n        });\n\n        fsProvider.onCloseFileSystem(mock(JGitFileSystem.class));\n\n        verify(fsProvider, times(1)).shutdownEventsManager();\n    }\n\n    @Test\n    public void moveBranchesTest() throws IOException {\n        final URI newRepo = URI.create(\"git://movebranch-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"little baby another-branch\".getBytes());\n            outStream.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/\"));\n        final Path target = provider.getPath(URI.create(\"git://another-branch-moved@movebranch-repo/\"));\n\n        provider.move(source,\n                      target);\n\n        Throwable extractContentCall = catchThrowable(() -> extractContent(provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\"))));\n\n        assertThat(extractContentCall).isInstanceOf(NoSuchFileException.class);\n\n        final String contentMoved = extractContent(provider.getPath(URI.create(\"git://another-branch-moved@movebranch-repo/dorinha.txt\")));\n\n        assertThat(contentMoved).isNotNull().isEqualTo(\"little baby another-branch\");\n    }\n\n    @Test\n    public void moveBranchesNotAtTheSameFSShouldNotBeAllowedTest() throws IOException {\n        final URI newRepo = URI.create(\"git://movebranch-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final URI anotherRepo = URI.create(\"git://another-repo\");\n        provider.newFileSystem(anotherRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"little baby another-branch\".getBytes());\n            outStream.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/\"));\n        final Path target = provider.getPath(URI.create(\"git://another-branch-moved@another-repo/\"));\n\n        assertThatThrownBy(() -> provider.move(source, target))\n                .isInstanceOf(IllegalStateException.class);\n    }\n\n    @Test\n    public void copyBranchesNotAtTheSameFSShouldNotBeAllowedTest() throws IOException {\n        final URI newRepo = URI.create(\"git://movebranch-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final URI anotherRepo = URI.create(\"git://another-repo\");\n        provider.newFileSystem(anotherRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"little baby another-branch\".getBytes());\n            outStream.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/\"));\n        final Path target = provider.getPath(URI.create(\"git://another-branch-moved@another-repo/\"));\n\n        assertThatThrownBy(() -> provider.copy(source, target))\n                .isInstanceOf(IllegalStateException.class);\n    }\n\n    @Test\n    public void copyBranchesTest() throws IOException {\n        final URI newRepo = URI.create(\"git://movebranch-repo\");\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        {\n            final Path path = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\"));\n\n            final OutputStream outStream = provider.newOutputStream(path);\n            outStream.write(\"little baby another-branch\".getBytes());\n            outStream.close();\n        }\n\n        final Path source = provider.getPath(URI.create(\"git://another-branch@movebranch-repo/\"));\n        final Path target = provider.getPath(URI.create(\"git://another-branch-moved@movebranch-repo/\"));\n\n        provider.copy(source,\n                      target);\n\n        final String originalContent = extractContent(provider.getPath(URI.create(\"git://another-branch@movebranch-repo/dorinha.txt\")));\n\n        assertThat(originalContent).isNotNull().isEqualTo(\"little baby another-branch\");\n\n        final String contentMoved = extractContent(provider.getPath(URI.create(\"git://another-branch-moved@movebranch-repo/dorinha.txt\")));\n\n        assertThat(contentMoved).isNotNull().isEqualTo(\"little baby another-branch\");\n    }\n\n    @Test\n    public void test_removeRefsFromTree() {\n        assertThat(removeRefsFromTree(\"mybranch\")).\n                isEqualTo(\"mybranch\");\n\n        assertThat(removeRefsFromTree(\"my/branch\")).\n                isEqualTo(\"my/branch\");\n\n        assertThat(removeRefsFromTree(\"refs/remotes/origin/my/branch\"))\n                .isEqualTo(\"my/branch\");\n\n        assertThat(removeRefsFromTree(\"refs/heads/my/branch\"))\n                .isEqualTo(\"my/branch\");\n\n        assertThat(removeRefsFromTree(\"refs/tags/my/tag\"))\n                .isEqualTo(\"my/tag\");\n\n        assertThat(removeRefsFromTree(\"refs/heads/tags\"))\n                .isEqualTo(\"tags\");\n\n        assertThat(removeRefsFromTree(\"refs/tags/heads/tags\"))\n                .isEqualTo(\"heads/tags\");\n    }\n\n    private String extractContent(Path path) throws IOException {\n        final InputStream inputStream = provider.newInputStream(path);\n        assertThat(inputStream).isNotNull();\n\n        final String content = new Scanner(inputStream).useDelimiter(\"\\\\A\").next();\n\n        inputStream.close();\n\n        return content;\n    }\n\n    private VersionRecord makeVersionRecord(final String author,\n                                            final String email,\n                                            final String comment,\n                                            final Date date,\n                                            final String commit) {\n        return new VersionRecord() {\n            @Override\n            public String id() {\n                return commit;\n            }\n\n            @Override\n            public String author() {\n                return author;\n            }\n\n            @Override\n            public String email() {\n                return email;\n            }\n\n            @Override\n            public String comment() {\n                return comment;\n            }\n\n            @Override\n            public Date date() {\n                return date;\n            }\n\n            @Override\n            public String uri() {\n                return null;\n            }\n        };\n    }\n\n    private List<RevCommit> getCommitsFromBranch(final GitImpl origin,\n                                                 String branch) throws GitAPIException, MissingObjectException, IncorrectObjectTypeException {\n        List<RevCommit> commits = new ArrayList<>();\n        final ObjectId id = new GetRef(origin.getRepository(),\n                                       branch).execute().getObjectId();\n        for (RevCommit commit : origin._log().add(id).call()) {\n            commits.add(commit);\n        }\n        return commits;\n    }\n\n    private interface MyAttrs extends BasicFileAttributes {\n\n    }\n\n    private static class MyInvalidFileAttributeView implements BasicFileAttributeView {\n\n        @Override\n        public BasicFileAttributes readAttributes() throws org.uberfire.java.nio.IOException {\n            return null;\n        }\n\n        @Override\n        public void setTimes(FileTime lastModifiedTime,\n                             FileTime lastAccessTime,\n                             FileTime createTime) throws org.uberfire.java.nio.IOException {\n\n        }\n\n        @Override\n        public String name() {\n            return null;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderUnsupportedOpTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\nimport java.util.Set;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\n\nimport static java.util.Collections.emptySet;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\n\npublic class JGitFileSystemImplProviderUnsupportedOpTest extends AbstractTestInfra {\n\n    @Test\n    public void testNewFileSystemUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://someunsup-repo-name\");\n\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        final Path path = JGitPathImpl.create((JGitFileSystem) fs,\n                                              \"\",\n                                              \"repo2-name\",\n                                              false);\n\n        assertThatThrownBy(() -> provider.newFileSystem(path, EMPTY_ENV))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n\n    @Test\n    public void testNewFileChannelUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://newfcrepo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://newfcrepo-name/file.txt\"));\n\n        final Set<? extends OpenOption> options = emptySet();\n        assertThatThrownBy(() -> provider.newFileChannel(path, options))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n\n    @Test\n    public void testNewAsynchronousFileChannelUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://newasyncrepo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path path = provider.getPath(URI.create(\"git://newasyncrepo-name/file.txt\"));\n\n        final Set<? extends OpenOption> options = emptySet();\n        assertThatThrownBy(() -> provider.newAsynchronousFileChannel(path, options, null))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n\n    @Test\n    public void testCreateSymbolicLinkUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://symbolic-repo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path link = provider.getPath(URI.create(\"git://symbolic-repo-name/link.lnk\"));\n        final Path path = provider.getPath(URI.create(\"git://symbolic-repo-name/file.txt\"));\n\n        assertThatThrownBy(() -> provider.createSymbolicLink(link, path))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n\n    @Test\n    public void testCreateLinkUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://link-repo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path link = provider.getPath(URI.create(\"git://link-repo-name/link.lnk\"));\n        final Path path = provider.getPath(URI.create(\"git://link-repo-name/file.txt\"));\n\n        assertThatThrownBy(() -> provider.createLink(link, path))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n\n    @Test\n    public void testReadSymbolicLinkUnsupportedOp() {\n        final URI newRepo = URI.create(\"git://read-link-repo-name\");\n\n        provider.newFileSystem(newRepo,\n                               EMPTY_ENV);\n\n        final Path link = provider.getPath(URI.create(\"git://read-link-repo-name/link.lnk\"));\n\n        assertThatThrownBy(() -> provider.readSymbolicLink(link))\n                .isInstanceOf(UnsupportedOperationException.class);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplProviderWithFoldersTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.FileSystemState;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitFileSystemImplProviderWithFoldersTest extends AbstractTestInfra {\n\n    @Test\n    public void testNewFileSystemWithSubfolder() {\n        final URI newRepo = URI.create(\"git://test/sub-repo-name\");\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        assertThat(fs).isNotNull();\n\n        final DirectoryStream<Path> stream = provider.newDirectoryStream(provider.getPath(newRepo),\n                                                                         null);\n        assertThat(stream).isEmpty();\n    }\n\n    @Test\n    public void testCreateFileIntoRepositoryWithFolder() throws IOException, GitAPIException {\n\n        final Map<String, ?> env = new HashMap<String, Object>() {{\n            put(\"init\",\n                Boolean.TRUE);\n        }};\n\n        String oldPath = \"git://test/old\";\n        final URI oldUri = URI.create(oldPath);\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(oldUri,\n                                                                          env);\n\n        final Path path = provider.getPath(URI.create(\"git://main@test/old/some/path/myfile.txt\"));\n        provider.setAttribute(path,\n                              FileSystemState.FILE_SYSTEM_STATE_ATTR,\n                              FileSystemState.BATCH);\n        final OutputStream outStream = provider.newOutputStream(path);\n        assertThat(outStream).isNotNull();\n        outStream.write((\"my cool content\").getBytes());\n        outStream.close();\n\n        assertThat(new File(provider.getGitRepoContainerDir(),\n                            \"test/old\" + \".git\")).exists();\n\n        int commitsCount = 0;\n        for (RevCommit com : ((GitImpl) fs.getGit())._log().all().call()) {\n            commitsCount++;\n        }\n    }\n\n    @Test\n    public void testExtractPathWithAuthority() {\n\n        provider.newFileSystem(URI.create(\"git://test/repo\"),\n                               new HashMap<String, Object>() {{\n                                   put(\"init\",\n                                       Boolean.TRUE);\n                               }});\n\n        String path = \"git://main@test/repo/readme.md\";\n        final URI uri = URI.create(path);\n        final String extracted = provider.extractPath(uri);\n        assertThat(extracted).isEqualTo(\"/readme.md\");\n    }\n\n    @Test\n    public void testComplexExtractPath() {\n\n        final URI newRepo = URI.create(\"git://test/repo\");\n        final FileSystem fs = provider.newFileSystem(newRepo,\n                                                     EMPTY_ENV);\n\n        String path = \"git://origin/main@test/repo/readme.md\";\n        final URI uri = URI.create(path);\n        final String extracted = provider.extractPath(uri);\n        assertThat(extracted).isEqualTo(\"/readme.md\");\n    }\n\n    @Test\n    public void testExtractComplexRepoName() {\n        provider.newFileSystem(URI.create(\"default://test/repo\"),\n                               new HashMap<String, Object>() {{\n                                   put(\"init\",\n                                       Boolean.TRUE);\n                               }});\n\n        String path = \"git://origin/main@test/repo/readme.md\";\n        final URI uri = URI.create(path);\n        final String extracted = provider.extractFSNameWithPath(uri);\n        assertThat(extracted).isEqualTo(\"test/repo/readme.md\");\n    }\n\n    @Test\n    public void testExtractSimpleRepoName() {\n        String path = \"git://main@test/repo/readme.md\";\n        final URI uri = URI.create(path);\n        final String extracted = provider.extractFSNameWithPath(uri);\n        assertThat(extracted).isEqualTo(\"test/repo/readme.md\");\n    }\n\n    @Test\n    public void testExtractVerySimpleRepoName() {\n        String path = \"git://test/repo/readme.md\";\n        final URI uri = URI.create(path);\n        final String extracted = provider.extractFSNameWithPath(uri);\n        assertThat(extracted).isEqualTo(\"test/repo/readme.md\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\n\nimport org.assertj.core.api.AssertionsForClassTypes;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.kie.soup.commons.util.Maps;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class JGitFileSystemImplTest extends AbstractTestInfra {\n\n    static {\n        CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider(\"guest\",\n                                                                               \"\"));\n    }\n\n    @Test\n    public void testOnlyLocalRoot() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"/\");\n        assertThat(fileSystem.getName()).isEqualTo(\"my-repo\");\n\n        assertThat(fileSystem.getRootDirectories()).hasSize(1);\n        final Path root = fileSystem.getRootDirectories().iterator().next();\n        assertThat(root.toString()).isEqualTo(\"/\");\n\n        assertThat(root.getRoot().toString()).isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testRemoteRoot() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final File tempDir = createTempDirectory();\n        final Git git = new GitImpl(GitImpl._cloneRepository().setNoCheckout(false).setBare(true).setCloneAllBranches(true).setURI(setupGit().getRepository().getDirectory().toString()).setDirectory(tempDir).call());\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"/\");\n        assertThat(fileSystem.getName()).isEqualTo(\"my-repo\");\n\n        assertThat(fileSystem.getRootDirectories()).hasSize(1);\n        final Path root = fileSystem.getRootDirectories().iterator().next();\n        assertThat(root.toString()).isEqualTo(\"/\");\n\n        assertThat(root.getRoot().toString()).isEqualTo(\"/\");\n    }\n\n    private JGitFileSystemLock createFSLock(Git git) {\n        return new JGitFileSystemLock(git,\n                                      TimeUnit.MILLISECONDS,\n                                      30_000L);\n    }\n\n    @Test\n    public void testProvider() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.getName()).isEqualTo(\"my-repo\");\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"/\");\n\n        assertThat(fileSystem.provider()).isEqualTo(fsProvider);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testClose() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"/\");\n        assertThat(fileSystem.getName()).isEqualTo(\"my-repo\");\n\n        assertThat(fileSystem.isOpen()).isTrue();\n        assertThat(fileSystem.getFileStores()).isNotNull();\n        fileSystem.close();\n        assertThat(fileSystem.isOpen()).isFalse();\n        assertThat(fileSystem.getFileStores()).isNotNull();\n    }\n\n    @Test\n    public void testSupportedFileAttributeViews() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.isReadOnly()).isFalse();\n        assertThat(fileSystem.getSeparator()).isEqualTo(\"/\");\n        assertThat(fileSystem.getName()).isEqualTo(\"my-repo\");\n\n        assertThat(fileSystem.supportedFileAttributeViews()).isNotEmpty().hasSize(2).contains(\"basic\",\n                                                                                              \"version\");\n    }\n\n    @Test\n    public void testPathNonBranchRooted() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"/path/to/some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://master@my-repo/path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testPathNonBranchNonRooted() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"path/to/some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://master@my-repo/:path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"\");\n    }\n\n    @Test\n    public void testPathBranchRooted() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"test-branch\",\n                                             \"/path/to/some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://test-branch@my-repo/path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testPathBranchNonRooted() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"test-branch\",\n                                             \"path/to/some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://test-branch@my-repo/:path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"\");\n    }\n\n    @Test\n    public void testPathBranchRooted2() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"test-branch\",\n                                             \"/path/to\",\n                                             \"some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://test-branch@my-repo/path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testPathBranchNonRooted2() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        when(fsProvider.isDefault()).thenReturn(false);\n        when(fsProvider.getScheme()).thenReturn(\"git\");\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        final Path path = fileSystem.getPath(\"test-branch\",\n                                             \"path/to\",\n                                             \"some/place.txt\");\n\n        AssertionsForClassTypes.assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://test-branch@my-repo/:path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isNotNull().isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"\");\n    }\n\n    @Test\n    public void testFileStore() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final File tempDir = createTempDirectory();\n        final Git git = setupGit(tempDir);\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertThat(fileSystem.getFileStores()).hasSize(1);\n        final FileStore fileStore = fileSystem.getFileStores().iterator().next();\n        assertThat(fileStore).isNotNull();\n\n        assertThat(fileStore.getTotalSpace()).isEqualTo(tempDir.getTotalSpace());\n        assertThat(fileStore.getUsableSpace()).isEqualTo(tempDir.getUsableSpace());\n    }\n\n    @Test\n    public void testPathEqualsWithDifferentRepos() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git1 = setupGit();\n\n        final JGitFileSystemImpl fileSystem1 = new JGitFileSystemImpl(fsProvider,\n                                                                      null,\n                                                                      git1,\n                                                                      createFSLock(git1),\n                                                                      \"my-repo1\",\n                                                                      CredentialsProvider.getDefault(),\n                                                                      null,\n                                                                      null);\n\n        final Git git2 = setupGit();\n\n        final JGitFileSystemImpl fileSystem2 = new JGitFileSystemImpl(fsProvider,\n                                                                      null,\n                                                                      git2,\n                                                                      createFSLock(git2),\n                                                                      \"my-repo2\",\n                                                                      CredentialsProvider.getDefault(),\n                                                                      null,\n                                                                      null);\n\n        final Path path1 = fileSystem1.getPath(\"master\",\n                                               \"/path/to/some.txt\");\n        final Path path2 = fileSystem2.getPath(\"main\",\n                                               \"/path/to/some.txt\");\n\n        AssertionsForClassTypes.assertThat(path1).isNotEqualTo(path2);\n\n        AssertionsForClassTypes.assertThat(path1).isEqualTo(fileSystem1.getPath(\"/path/to/some.txt\"));\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    @Ignore\n    public void testNewWatchService() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n        fileSystem.newWatchService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testGetUserPrincipalLookupService() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n        fileSystem.getUserPrincipalLookupService();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testGetPathMatcher() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n        fileSystem.getPathMatcher(\"*\");\n    }\n\n    @Test\n    public void lockShouldSupportMultipleInnerLocksForTheSameThreadTest() throws IOException, GitAPIException {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     null,\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        fileSystem.lock();\n        //inner locks\n        fileSystem.lock();\n        fileSystem.lock();\n        fileSystem.unlock();\n        fileSystem.unlock();\n        fileSystem.unlock();\n    }\n\n    @Test\n    public void lockTest() throws IOException, GitAPIException {\n\n        final Git git = setupGit();\n        JGitFileSystemLock lock = createFSLock(git);\n\n        JGitFileSystemLock lockSpy = spy(lock);\n\n        lockSpy.lock();\n        lockSpy.lock();\n        lockSpy.lock();\n        verify(lockSpy,\n               times(1)).physicalLockOnFS();\n\n        lockSpy.unlock();\n        lockSpy.unlock();\n        lockSpy.unlock();\n        verify(lockSpy,\n               times(1)).physicalUnLockOnFS();\n    }\n\n    @Test\n    public void testSetPublicURI() throws IOException, GitAPIException {\n\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                     new Maps.Builder<String, String>()\n                                                                             .put(\"ssh\", \"localhost:8080/git\")\n                                                                             .build(),\n                                                                     git,\n                                                                     createFSLock(git),\n                                                                     \"my-repo\",\n                                                                     CredentialsProvider.getDefault(),\n                                                                     null,\n                                                                     null);\n\n        assertTrue(checkProtocolPresent(fileSystem.toString(), \"ssh\"));\n        assertFalse(checkProtocolPresent(fileSystem.toString(), \"http\"));\n\n        fileSystem.setPublicURI(new Maps.Builder<String, String>()\n                                        .put(\"http\", \"localhost:8080/git\")\n                                        .put(\"ssh\", \"localhost:8080/git\")\n                                        .build());\n        assertTrue(checkProtocolPresent(fileSystem.toString(), \"ssh\"));\n        assertTrue(checkProtocolPresent(fileSystem.toString(), \"http\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemLockTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.nio.file.Path;\nimport java.util.concurrent.TimeUnit;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFileSystemLockTest {\n\n    @Test\n    public void thresholdMaxTest() {\n        long lastAccessThreshold = Long.MAX_VALUE;\n        JGitFileSystemLock lock = createLock(lastAccessThreshold);\n        lock.registerAccess();\n        assertTrue(lock.hasBeenInUse());\n    }\n\n    @Test\n    public void thresholdMinTest() {\n        long lastAccessThreshold = Long.MIN_VALUE;\n        JGitFileSystemLock lock = createLock(lastAccessThreshold);\n        lock.registerAccess();\n\n        lock.lock.lock();\n        assertTrue(lock.hasBeenInUse());\n        lock.lock.unlock();\n        assertFalse(lock.hasBeenInUse());\n    }\n\n    private JGitFileSystemLock createLock(long lastAccessThreshold) {\n        Git gitMock = mock(Git.class);\n        Repository repo = mock(Repository.class);\n        File directory = mock(File.class);\n        when(directory.toURI()).thenReturn(URI.create(\"\"));\n        when(repo.getDirectory()).thenReturn(directory);\n        when(gitMock.getRepository()).thenReturn(repo);\n        return new JGitFileSystemLock(gitMock,\n                                      TimeUnit.MILLISECONDS,\n                                      lastAccessThreshold) {\n\n            @Override\n            Path createLockInfra(URI uri) {\n                return mock(Path.class);\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProviderConcurrentOperationsTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.CountDownLatch;\n\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport static org.junit.Assert.*;\n\npublic class JGitFileSystemProviderConcurrentOperationsTest extends AbstractTestInfra {\n\n    private Logger logger = LoggerFactory.getLogger(JGitFileSystemProviderConcurrentOperationsTest.class);\n\n    /**\n     * Ignored due to https://issues.redhat.com/browse/AF-2470\n     */\n    @Ignore\n    @Test\n    public void testConcurrentGitCreation() {\n\n        int threadCount = 2;\n        final CountDownLatch finished = new CountDownLatch(threadCount);\n        List<Thread> threads = new ArrayList<>();\n\n        for (int i = 0; i < threadCount; i++) {\n            final int name = i;\n            Runnable r = () -> {\n                this.provider.createNewGitRepo(EMPTY_ENV,\n                                               \"git://parent/concurrent-test\" + name);\n                finished.countDown();\n                logger.info(\"Countdown\" + Thread.currentThread().getName());\n            };\n            Thread t = new Thread(r);\n            threads.add(t);\n            t.start();\n        }\n\n        wait(threads);\n        assertEquals(0,\n                     finished.getCount());\n    }\n\n    @Test\n    public void testConcurrentGitDeletion() {\n\n        String gitRepo = \"git://parent/delete-test-repo\";\n        final URI newRepo = URI.create(gitRepo);\n        JGitFileSystemProxy fs = (JGitFileSystemProxy) provider.newFileSystem(newRepo,\n                                                                              EMPTY_ENV);\n\n        int threadCount = 2;\n        final CountDownLatch finished = new CountDownLatch(threadCount);\n        List<Thread> threads = new ArrayList<>();\n\n        for (int i = 0; i < threadCount; i++) {\n            final int name = i;\n            Runnable r = () -> {\n                this.provider.deleteFS(fs.getRealJGitFileSystem());\n                finished.countDown();\n                logger.info(\"Countdown\" + Thread.currentThread().getName());\n            };\n            Thread t = new Thread(r);\n            threads.add(t);\n            t.start();\n        }\n\n        wait(threads);\n        assertEquals(0,\n                     finished.getCount());\n    }\n\n    private void wait(List<Thread> threads) {\n        threads.forEach(thread -> {\n            try {\n                thread.join();\n            } catch (InterruptedException e) {\n                logger.error(\"Error waiting for threads\",\n                             e);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitFileSystemProxyTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\nimport java.util.Collections;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class JGitFileSystemProxyTest extends AbstractTestInfra {\n\n    private int gitDaemonPort;\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.enabled\",\n                     \"true\");\n        // use different port for every test -> easy to run tests in parallel\n        gitDaemonPort = findFreePort();\n        gitPrefs.put(\"org.uberfire.nio.git.daemon.port\",\n                     String.valueOf(gitDaemonPort));\n        return gitPrefs;\n    }\n\n    @Test\n    public void proxyTest() {\n        final URI originRepo = URI.create(\"git://encoding-origin-name\");\n\n        final JGitFileSystem origin = (JGitFileSystem) provider.newFileSystem(originRepo,\n                                                                              Collections.emptyMap());\n\n        assertTrue(origin instanceof JGitFileSystemProxy);\n        JGitFileSystemProxy proxy = (JGitFileSystemProxy) origin;\n        JGitFileSystem realJGitFileSystem = proxy.getRealJGitFileSystem();\n        assertTrue(realJGitFileSystem instanceof JGitFileSystemImpl);\n\n        assertTrue(proxy.equals(realJGitFileSystem));\n        assertTrue(realJGitFileSystem.equals(proxy));\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitForkTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport static java.util.Arrays.asList;\nimport static java.util.stream.Collectors.toSet;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.fail;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.hooks.PostCommitHook;\nimport org.eclipse.jgit.hooks.PreCommitHook;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevSort;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Fork;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\npublic class JGitForkTest extends AbstractTestInfra {\n\n    private static final String\n            TARGET_GIT = \"target/target\",\n            SOURCE_GIT = \"source/source\";\n    private static Logger logger = LoggerFactory.getLogger(JGitForkTest.class);\n\n    @Test\n    public void testToForkSuccess() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Fork(parentFolder,\n                 SOURCE_GIT,\n                 TARGET_GIT,\n                 null,\n                 CredentialsProvider.getDefault(),\n                 null,\n                 null).execute();\n\n        final File gitCloned = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n        final Git cloned = Git.createRepository(gitCloned);\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).hasSize(2);\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/main\");\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(1).getName()).isEqualTo(\"refs/heads/user_branch\");\n\n        final String remotePath = new File(((GitImpl) cloned)._remoteList().call().get(0).getURIs().get(0).getPath()).getAbsolutePath();\n        assertThat(remotePath).isEqualTo(new File(gitSource.getPath()).getAbsolutePath());\n    }\n\n    @Test(expected = GitException.class)\n    public void testToForkAlreadyExists() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        final File gitTarget = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n        final Git originTarget = new CreateRepository(gitTarget).execute().get();\n\n        new Commit(originTarget,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        new Fork(parentFolder,\n                 SOURCE_GIT,\n                 TARGET_GIT,\n                 null,\n                 CredentialsProvider.getDefault(),\n                 null,\n                 null).execute();\n    }\n\n    @Test\n    public void testToForkWrongSource() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        try {\n            new Fork(parentFolder,\n                     SOURCE_GIT,\n                     TARGET_GIT,\n                     null,\n                     CredentialsProvider.getDefault(),\n                     null,\n                     null).execute();\n            fail(\"If got here is because it could for the repository\");\n        } catch (Clone.CloneException e) {\n            assertThat(e).isNotNull();\n            logger.info(e.getMessage(),\n                        e);\n        }\n    }\n\n    @Test\n    public void testForkRepository() throws GitAPIException {\n\n        String SOURCE = \"testforkA/source\";\n        String TARGET = \"testforkB/target\";\n\n        final Map<String, ?> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT,\n                \"true\");\n        }};\n\n        String sourcePath = \"git://\" + SOURCE;\n        final URI sourceUri = URI.create(sourcePath);\n        provider.newFileSystem(sourceUri,\n                               env);\n\n        final Map<String, ?> forkEnv = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                SOURCE);\n        }};\n        String forkPath = \"git://\" + TARGET;\n        final URI forkUri = URI.create(forkPath);\n        final JGitFileSystem fs = (JGitFileSystem) provider.newFileSystem(forkUri,\n                                                                          forkEnv);\n\n        assertThat(((GitImpl) fs.getGit())._remoteList().call().get(0).getURIs().get(0).toString())\n                .isEqualTo(new File(provider.getGitRepoContainerDir(),\n                                    SOURCE + \".git\").toPath().toUri().toString());\n    }\n\n    @Test(expected = FileSystemAlreadyExistsException.class)\n    public void testForkRepositoryThatAlreadyExists() {\n\n        String SOURCE = \"testforkA/source\";\n        String TARGET = \"testforkB/target\";\n\n        final Map<String, ?> env = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_INIT,\n                \"true\");\n        }};\n\n        String sourcePath = \"git://\" + SOURCE;\n        final URI sourceUri = URI.create(sourcePath);\n        provider.newFileSystem(sourceUri,\n                               env);\n\n        final Map<String, ?> forkEnv = new HashMap<String, Object>() {{\n            put(JGitFileSystemProviderConfiguration.GIT_ENV_KEY_DEFAULT_REMOTE_NAME,\n                SOURCE);\n        }};\n\n        String forkPath = \"git://\" + TARGET;\n        final URI forkUri = URI.create(forkPath);\n        provider.newFileSystem(forkUri,\n                               forkEnv);\n        provider.newFileSystem(forkUri,\n                               forkEnv);\n    }\n\n    @Test\n    public void testForkWithoutHookDirShouldNotBeUpdatedAfterGitHookDirAdded() throws IOException, GitAPIException {\n\n        final File hooksDir = createTempDirectory();\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        writeMockHook(hooksDir, PostCommitHook.NAME);\n        writeMockHook(hooksDir, PreCommitHook.NAME);\n\n        final Git repo = new CreateRepository(gitSource, null).execute().get();\n        final Git existentRepoWithHookDirDefined = new CreateRepository(gitSource, hooksDir).execute().get();\n\n        File[] hooks = new File(existentRepoWithHookDirDefined.getRepository().getDirectory(), \"hooks\").listFiles();\n        assertThat(hooks).isEmpty();\n    }\n\n\n    @Test\n    public void testForkWithHookDir() throws IOException, GitAPIException {\n    \tfinal File hooksDir = createTempDirectory();\n\n        writeMockHook(hooksDir, PostCommitHook.NAME);\n        writeMockHook(hooksDir, PreCommitHook.NAME);\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource, hooksDir).execute().get();\n\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        final Git cloned  = new Fork(parentFolder,\n                 SOURCE_GIT,\n                 TARGET_GIT,\n                 null,\n                 CredentialsProvider.getDefault(),\n                 null,\n                 hooksDir).execute();\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).hasSize(1);\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/user_branch\");\n\n        final String remotePath = new File(((GitImpl) cloned)._remoteList().call().get(0).getURIs().get(0).getPath()).getAbsolutePath();\n        assertThat(remotePath).isEqualTo(new File(gitSource.getPath()).getAbsolutePath());\n\n        boolean foundPreCommitHook = false;\n        boolean foundPostCommitHook = false;\n        File[] hooks = new File(cloned.getRepository().getDirectory(), \"hooks\").listFiles();\n\t\tassertThat(hooks).isNotEmpty().isNotNull();\n\t\tassertThat(hooks.length).isEqualTo(2);\n        for (File hook : hooks) {\n            if (hook.getName().equals(PreCommitHook.NAME)) {\n                foundPreCommitHook = hook.canExecute();\n            } else if (hook.getName().equals(PostCommitHook.NAME)) {\n                foundPostCommitHook = hook.canExecute();\n            }\n        }\n        assertThat(foundPreCommitHook).isTrue();\n        assertThat(foundPostCommitHook).isTrue();\n    }\n\n    @Test\n    public void testForkMultipleBranches() throws Exception {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final Git origin = new CreateRepository(gitSource, null).execute().get();\n\n        commit(origin,\n               \"main\",\n               \"first\",\n               content(\"dir1/file.txt\", \"foo\"),\n               content(\"dir2/file2.txt\", \"bar\"),\n               content(\"file3.txt\", \"moogah\"));\n\n        branch(origin, \"main\", \"dev\");\n        commit(origin,\n               \"dev\",\n               \"second\",\n               content(\"dir1/file.txt\", \"foo1\"),\n               content(\"file3.txt\", \"bar1\"));\n\n        branch(origin, \"main\", \"ignored\");\n        commit(origin,\n               \"ignored\",\n               \"third\",\n               content(\"dir1/file.txt\", \"foo2\"));\n\n\n        final Git cloned  = new Fork(parentFolder,\n                                     SOURCE_GIT,\n                                     TARGET_GIT,\n                                     asList(\"main\", \"dev\"),\n                                     CredentialsProvider.getDefault(),\n                                     null,\n                                     null).execute();\n\n        assertThat(cloned).isNotNull();\n        final Set<String> clonedRefs = listRefs(cloned).stream()\n                .map(ref -> ref.getName())\n                .collect(toSet());\n        assertThat(clonedRefs).hasSize(2);\n        assertThat(clonedRefs).containsExactly(\"refs/heads/main\", \"refs/heads/dev\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitGetCommitTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitGetCommitTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n    }\n\n    @Test\n    public void successTest() throws IOException {\n        commit(git, MAIN_BRANCH, \"Adding file\", content(\"file.txt\", \"file content\"));\n\n        RevCommit lastCommit = git.getLastCommit(MAIN_BRANCH);\n\n        RevCommit commit = git.getCommit(lastCommit.getName());\n\n        assertThat(commit.getName()).isEqualTo(lastCommit.getName());\n    }\n\n    @Test\n    public void notFoundTest() {\n        RevCommit commit = git.getCommit(\"non-existent-commit-id\");\n\n        assertThat(commit).isNull();\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitGetCommonAncestorCommitTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitGetCommonAncestorCommitTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n    private static final String DEVELOP_BRANCH = \"develop\";\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n    }\n\n    @Test\n    public void successTest() throws IOException {\n        commit(git, MAIN_BRANCH, \"Adding file\", content(\"file.txt\", \"file content\"));\n\n        RevCommit expectedCommonAncestorCommit = git.getLastCommit(MAIN_BRANCH);\n\n        new CreateBranch((GitImpl) git, MAIN_BRANCH, DEVELOP_BRANCH).execute();\n\n        commit(git, MAIN_BRANCH, \"Updating file\", content(\"file.txt\", \"file content 1\"));\n        commit(git, MAIN_BRANCH, \"Updating file\", content(\"file.txt\", \"file content 2\"));\n\n        commit(git, DEVELOP_BRANCH, \"Updating file\", content(\"file.txt\", \"file content 3\"));\n        commit(git, DEVELOP_BRANCH, \"Updating file\", content(\"file.txt\", \"file content 4\"));\n\n        RevCommit actualCommonAncestorCommit = git.getCommonAncestorCommit(MAIN_BRANCH,\n                                                                           DEVELOP_BRANCH);\n\n        assertThat(actualCommonAncestorCommit.getName()).isEqualTo(expectedCommonAncestorCommit.getName());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidBranchTest() {\n        git.getCommonAncestorCommit(MAIN_BRANCH,\n                                    \"invalid-branch\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitHistoryTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListCommits;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitHistory;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.MoveCommitContent;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class JGitHistoryTest extends AbstractTestInfra {\n\n    private Git git;\n\n    @Before\n    public void setup() throws IOException {\n        final File tmpDir = createTempDirectory();\n        final File repoDir = new File(tmpDir, \"test-repo.git\");\n        git = new CreateRepository(repoDir).execute()\n                                           .orElseThrow(() -> new IllegalStateException(\"Unable to create git repo for tests.\"));\n\n        commit(git,\n               \"main\",\n               \"create files\",\n               content(\"non-moving.txt\", multiline(\"a\", \"b\", \"c\")),\n               content(\"moving.txt\", multiline(\"1\", \"2\", \"3\")));\n        moveCommit(singleMove(\"moving.txt\", \"moving1.txt\"), \"rename moving file\");\n        commit(git,\n               \"main\",\n               \"change content, no moves\",\n               content(\"non-moving.txt\", multiline(\"a\", \"b\", \"d\")),\n               content(\"moving1.txt\", multiline(\"1\", \"2\", \"4\")));\n        moveCommit(singleMove(\"moving1.txt\", \"dir/moving2.txt\"), \"move moving file to new dir\");\n        commit(git,\n               \"main\",\n               \"simulate checkout old version\",\n               content(\"moving1.txt\", multiline(\"1\", \"2\", \"4\")));\n    }\n\n    private Map<String, String> singleMove(String from, String to) {\n        Map<String, String> moves = new HashMap<>();\n        moves.put(from, to);\n        return moves;\n    }\n\n    private void moveCommit(Map<String, String> moves, String message) {\n        git.commit(\"main\", new CommitInfo(null, \"name\", \"name@example.com\", message, null, null), false, null, new MoveCommitContent(moves));\n    }\n\n    @Test\n    public void listCommitsForUnmovedFile() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"non-moving.txt\").execute();\n        assertEquals(\"non-moving.txt\", history.getTrackedFilePath());\n        assertEquals(2, history.getCommits().size());\n        assertEquals(\"/non-moving.txt\", history.trackedFileNameChangeFor(history.getCommits().get(0).getId()));\n        assertEquals(\"/non-moving.txt\", history.trackedFileNameChangeFor(history.getCommits().get(1).getId()));\n    }\n\n    @Test\n    public void listCommitsForMovedFile() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"dir/moving2.txt\").execute();\n        assertEquals(\"dir/moving2.txt\", history.getTrackedFilePath());\n        assertEquals(4, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"move moving file to new dir\", commit0.getFullMessage());\n        assertEquals(\"/dir/moving2.txt\", oPath0);\n\n        final RevCommit commit1 = history.getCommits().get(1);\n        String oPath1 = history.trackedFileNameChangeFor(commit1.getId());\n        assertEquals(\"change content, no moves\", commit1.getFullMessage());\n        assertEquals(\"/moving1.txt\", oPath1);\n\n        final RevCommit commit2 = history.getCommits().get(2);\n        String oPath2 = history.trackedFileNameChangeFor(commit2.getId());\n        assertEquals(\"rename moving file\", commit2.getFullMessage());\n        assertEquals(\"/moving1.txt\", oPath2);\n\n        final RevCommit commit3 = history.getCommits().get(3);\n        String oPath3 = history.trackedFileNameChangeFor(commit3.getId());\n        assertEquals(\"create files\", commit3.getFullMessage());\n        assertEquals(\"/moving.txt\", oPath3);\n    }\n\n    @Test\n    public void listCommitsForRestoredFile() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"moving1.txt\").execute();\n        assertEquals(\"moving1.txt\", history.getTrackedFilePath());\n        assertEquals(4, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"simulate checkout old version\", commit0.getFullMessage());\n        assertEquals(\"/moving1.txt\", oPath0);\n\n        final RevCommit commit1 = history.getCommits().get(1);\n        String oPath1 = history.trackedFileNameChangeFor(commit1.getId());\n        assertEquals(\"change content, no moves\", commit1.getFullMessage());\n        assertEquals(\"/moving1.txt\", oPath1);\n\n        final RevCommit commit2 = history.getCommits().get(2);\n        String oPath2 = history.trackedFileNameChangeFor(commit2.getId());\n        assertEquals(\"rename moving file\", commit2.getFullMessage());\n        assertEquals(\"/moving1.txt\", oPath2);\n\n        final RevCommit commit3 = history.getCommits().get(3);\n        String oPath3 = history.trackedFileNameChangeFor(commit3.getId());\n        assertEquals(\"create files\", commit3.getFullMessage());\n        assertEquals(\"/moving.txt\", oPath3);\n    }\n\n    @Test\n    public void listCommitsOnDirectory() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"dir\").execute();\n        assertEquals(\"dir\", history.getTrackedFilePath());\n        assertEquals(1, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"move moving file to new dir\", commit0.getFullMessage());\n        assertEquals(\"/dir\", oPath0);\n    }\n\n    @Test\n    public void listCommitsOnRootDirectoryViaAbsolute() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"/\").execute();\n        assertEquals(\"/\", history.getTrackedFilePath());\n        assertEquals(5, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"simulate checkout old version\", commit0.getFullMessage());\n        assertEquals(\"/\", oPath0);\n    }\n\n    @Test\n    public void listCommitsOnRootDirectoryViaNull() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), null).execute();\n        assertEquals(\"/\", history.getTrackedFilePath());\n        assertEquals(5, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"simulate checkout old version\", commit0.getFullMessage());\n        assertEquals(\"/\", oPath0);\n    }\n\n    @Test\n    public void listCommitsOnRootDirectoryViaEmpty() throws Exception {\n        final CommitHistory history = new ListCommits(git, git.getRef(\"main\"), \"\").execute();\n        assertEquals(\"/\", history.getTrackedFilePath());\n        assertEquals(5, history.getCommits().size());\n\n        final RevCommit commit0 = history.getCommits().get(0);\n        String oPath0 = history.trackedFileNameChangeFor(commit0.getId());\n        assertEquals(\"simulate checkout old version\", commit0.getFullMessage());\n        assertEquals(\"/\", oPath0);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMapDiffContentTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitMapDiffContentTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n\n    private static final List<String> TXT_FILES =\n            Stream.of(\"file0\", \"file1\", \"file2\", \"file3\", \"file4\")\n                    .collect(Collectors.toList());\n\n    private static final String[] COMMON_TXT_LINES = {\"Line1\", \"Line2\", \"Line3\", \"Line4\"};\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(0), multiline(TXT_FILES.get(0), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), COMMON_TXT_LINES)));\n    }\n\n    @Test\n    public void testNoDiffOnlyOneCommit() throws IOException {\n        Map<String, File> content = git.mapDiffContent(MAIN_BRANCH,\n                                                       git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                                                       git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n\n        assertThat(content).isEmpty();\n    }\n\n    @Test\n    public void testHasContent() throws IOException {\n        commit(git, MAIN_BRANCH, \"Adding file into main\",\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        Map<String, File> contents = git.mapDiffContent(MAIN_BRANCH,\n                                                        git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                                                        git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n\n        assertThat(contents).isNotEmpty();\n        assertThat(contents).hasSize(1);\n    }\n\n    @Test\n    public void testHasContents() throws IOException {\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        Map<String, File> contents = git.mapDiffContent(MAIN_BRANCH,\n                                                        git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                                                        git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n\n        assertThat(contents).isNotEmpty();\n        assertThat(contents).hasSize(2);\n    }\n\n    @Test\n    public void testHasDeleteContents() throws IOException {\n        new Commit(git, MAIN_BRANCH, \"name\", \"name@example.com\", \"Removing file\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(0), null);\n                   }}).execute();\n\n        new Commit(git, MAIN_BRANCH, \"name\", \"name@example.com\", \"Removing file\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(1), null);\n                   }}).execute();\n\n        Map<String, File> contents = git.mapDiffContent(MAIN_BRANCH,\n                                                        git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                                                        git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n\n        assertThat(contents).isNotEmpty();\n        assertThat(contents).hasSize(2);\n        contents.values().forEach(v -> assertThat(v).isNull());\n    }\n\n    @Test\n    public void testWithManyCommitsOneFile() throws IOException {\n        commit(git, MAIN_BRANCH, \"Updating a file\",\n               content(TXT_FILES.get(0), \"update 1\"));\n\n        commit(git, MAIN_BRANCH, \"Updating a file\",\n               content(TXT_FILES.get(0), \"update 2\"));\n\n        commit(git, MAIN_BRANCH, \"Updating a file\",\n               content(TXT_FILES.get(0), \"update 3\"));\n\n        Map<String, File> contents = git.mapDiffContent(MAIN_BRANCH,\n                                                        git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                                                        git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n\n        assertThat(contents).isNotEmpty();\n        assertThat(contents).hasSize(1);\n    }\n\n    @Test\n    public void testWithMiddleCommits() throws IOException {\n        commit(git, MAIN_BRANCH, \"Updating a file\",\n               content(TXT_FILES.get(0), \"update 1\"));\n\n        RevCommit startCommit = git.getLastCommit(MAIN_BRANCH);\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        new Commit(git, MAIN_BRANCH, \"name\", \"name@example.com\", \"Removing file\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(1), null);\n                   }}).execute();\n\n        RevCommit endCommit = git.getLastCommit(MAIN_BRANCH);\n\n        commit(git, MAIN_BRANCH, \"Updating a file\",\n               content(TXT_FILES.get(0), \"update 3\"));\n\n        Map<String, File> contents = git.mapDiffContent(MAIN_BRANCH,\n                                                        startCommit.getName(),\n                                                        endCommit.getName());\n\n        assertThat(contents).isNotEmpty();\n        assertThat(contents).hasSize(3);\n    }\n\n    @Test(expected = GitException.class)\n    public void testWithWrongBranchName() throws IOException {\n        git.mapDiffContent(\"wrong-branch-name\",\n                           git.getFirstCommit(git.getRef(MAIN_BRANCH)).getName(),\n                           git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n    }\n\n    @Test(expected = GitException.class)\n    public void testWithInvalidCommit() throws IOException {\n        git.mapDiffContent(MAIN_BRANCH,\n                           \"invalid-commit-id\",\n                           git.getLastCommit(git.getRef(MAIN_BRANCH)).getName());\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMergeTest.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetTreeFromRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListDiffs;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Merge;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\nimport org.uberfire.java.nio.fs.jgit.util.model.MessageCommitInfo;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitMergeTest extends AbstractTestInfra {\n\n    private static final String SOURCE_GIT = \"source/source\";\n\n    @Test\n    public void testMergeFastForwardSuccessful() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file4.txt\",\n                           tempFile(\"temp4\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file5.txt\",\n                           tempFile(\"temp5\"));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"main\").execute();\n\n        final List<DiffEntry> result = new ListDiffs(origin,\n                                                     new GetTreeFromRef(origin,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(origin,\n                                                                        \"develop\").execute()).execute();\n\n        assertThat(result).isEmpty();\n    }\n\n    @Test\n    public void testMergeNonFastForwardSuccessful() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file4.txt\",\n                           tempFile(\"temp4\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file5.txt\",\n                           tempFile(\"temp5\"));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"main\",\n                  true,\n                  false,\n                  MessageCommitInfo.createMergeMessage(\"develop\")).execute();\n\n        final List<DiffEntry> result = new ListDiffs(origin,\n                                                     new GetTreeFromRef(origin,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(origin,\n                                                                        \"develop\").execute()).execute();\n\n        assertThat(result).isEmpty();\n    }\n\n    @Test\n    public void testMergeWithSquashSuccessful() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        RevCommit commitBeforeMerge = origin.getLastCommit(\"main\");\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file4.txt\",\n                           tempFile(\"temp4\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file5.txt\",\n                           tempFile(\"temp5\"));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"main\",\n                  true,\n                  true,\n                  MessageCommitInfo.createMergeMessage(\"develop\")).execute();\n\n        RevCommit commitAfterMerge = origin.getLastCommit(\"main\");\n\n        final List<DiffEntry> result = new ListDiffs(origin,\n                                                     new GetTreeFromRef(origin,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(origin,\n                                                                        \"develop\").execute()).execute();\n\n        assertThat(result).isEmpty();\n        assertThat(commitAfterMerge.getParent(0)).isEqualTo(commitBeforeMerge);\n    }\n\n    @Test\n    public void testMergeNoDiff() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        List<String> commitIds = new Merge(origin,\n                                           \"develop\",\n                                           \"main\").execute();\n\n        assertThat(commitIds).isEmpty();\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testParametersNotNull() {\n\n        new Merge(null,\n                  \"develop\",\n                  \"main\").execute();\n    }\n\n    @Test(expected = GitException.class)\n    public void testTryToMergeNonexistentBranch() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"temp1\"));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file4.txt\",\n                           tempFile(\"temp4\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file5.txt\",\n                           tempFile(\"temp5\"));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"nonexistent\").execute();\n    }\n\n    @Test(expected = GitException.class)\n    public void testMergeBinaryInformationButHasConflicts() throws IOException {\n\n        final byte[] contentA = this.loadImage(\"images/drools.png\");\n        final byte[] contentB = this.loadImage(\"images/jbpm.png\");\n        final byte[] contentC = this.loadImage(\"images/opta.png\");\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.jpg\",\n                           tempFile(contentA));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.jpg\",\n                           tempFile(contentB));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.jpg\",\n                           tempFile(contentC));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"main\").execute();\n\n        final List<DiffEntry> result = new ListDiffs(origin,\n                                                     new GetTreeFromRef(origin,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(origin,\n                                                                        \"develop\").execute()).execute();\n\n        assertThat(result).isEmpty();\n    }\n\n    @Test\n    public void testMergeBinaryInformationSuccessful() throws IOException {\n\n        final byte[] contentA = this.loadImage(\"images/drools.png\");\n        final byte[] contentB = this.loadImage(\"images/jbpm.png\");\n\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n        final Git origin = new CreateRepository(gitSource).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"main-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.jpg\",\n                           tempFile(contentA));\n                   }}).execute();\n\n        new CreateBranch((GitImpl) origin,\n                         \"main\",\n                         \"develop\").execute();\n\n        new Commit(origin,\n                   \"develop\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"develop-1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.jpg\",\n                           tempFile(contentB));\n                   }}).execute();\n\n        new Merge(origin,\n                  \"develop\",\n                  \"main\").execute();\n\n        final List<DiffEntry> result = new ListDiffs(origin,\n                                                     new GetTreeFromRef(origin,\n                                                                        \"main\").execute(),\n                                                     new GetTreeFromRef(origin,\n                                                                        \"develop\").execute()).execute();\n\n        assertThat(result).isEmpty();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitMirrorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.assertj.core.api.Condition;\nimport org.eclipse.jgit.api.Git;\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.URIish;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class JGitMirrorTest extends AbstractTestInfra {\n\n    public static final String TARGET_GIT = \"test/target.git\";\n    public static final String ORIGIN = \"https://github.com/uberfire/uberfire-website\";\n    private static Logger logger = LoggerFactory.getLogger(JGitMirrorTest.class);\n\n    @Test\n    public void testToHTTPMirrorSuccess() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n        final File directory = new File(parentFolder,\n                                        TARGET_GIT);\n        new Clone(directory,\n                  ORIGIN,\n                  true,\n                  null,\n                  CredentialsProvider.getDefault(),\n                  null,\n                  null).execute();\n\n        final Git cloned = Git.open(directory);\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(cloned.getRepository().getAllRefs()).is(new Condition<Map<String, Ref>>() {\n            @Override\n            public boolean matches(final Map<String, Ref> refs) {\n                final boolean hasDefaultBranchRef = refs.get(\"refs/heads/master\") != null;\n                final boolean hasNewWebsiteRef = refs.get(\"refs/heads/new-website\") != null;\n                final boolean hasRemoteOriginDefaultBranch = refs.get(\"refs/remotes/origin/master\") != null;\n                final boolean hasRemoteOriginNewWebSite = refs.get(\"refs/remotes/origin/master\") != null;\n\n                return hasDefaultBranchRef && hasNewWebsiteRef && hasRemoteOriginDefaultBranch & hasRemoteOriginNewWebSite;\n            }\n        });\n\n\n        URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);\n        String remoteUrl = remoteUri.getScheme() + \"://\" + remoteUri.getHost() + remoteUri.getPath();\n        assertThat(remoteUrl).isEqualTo(ORIGIN);\n    }\n\n    @Test\n    public void testToHTTPUnmirrorSuccess() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n        final File directory = new File(parentFolder,\n                                        TARGET_GIT);\n        new Clone(directory,\n                  ORIGIN,\n                  false,\n                  null,\n                  CredentialsProvider.getDefault(),\n                  null,\n                  null).execute();\n\n        final Git cloned = Git.open(directory);\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(cloned.getRepository().getAllRefs()).is(new Condition<Map<String, Ref>>() {\n            @Override\n            public boolean matches(final Map<String, Ref> refs) {\n                final boolean hasDefaultBranchRef = refs.get(\"refs/heads/master\") != null;\n                final boolean hasNewWebsiteRef = refs.get(\"refs/heads/new-website\") != null;\n                final boolean hasRemoteOriginDefaultBranch = refs.get(\"refs/remotes/origin/master\") != null;\n                final boolean hasRemoteOriginNewWebSite = refs.get(\"refs/remotes/origin/master\") != null;\n\n                return hasDefaultBranchRef && hasNewWebsiteRef && hasRemoteOriginDefaultBranch & hasRemoteOriginNewWebSite;\n            }\n        });\n\n        final boolean isMirror = cloned.getRepository().getConfig().getBoolean(\"remote\",\n                                                                               \"origin\",\n                                                                               \"mirror\",\n                                                                               false);\n        assertFalse(isMirror);\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/master\");\n\n        URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);\n        String remoteUrl = remoteUri.getScheme() + \"://\" + remoteUri.getHost() + remoteUri.getPath();\n        assertThat(remoteUrl).isEqualTo(ORIGIN);\n    }\n\n    @Test\n    public void testEmptyCredentials() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n        final File directory = new File(parentFolder,\n                                        TARGET_GIT);\n        new Clone(directory,\n                  ORIGIN,\n                  false,\n                  null,\n                  null,\n                  null,\n                  null).execute();\n\n        final Git cloned = Git.open(directory);\n\n        assertThat(cloned).isNotNull();\n\n        assertThat(new ListRefs(cloned.getRepository()).execute()).is(new Condition<List<? extends Ref>>() {\n            @Override\n            public boolean matches(final List<? extends Ref> refs) {\n                return refs.size() > 0;\n            }\n        });\n\n        assertThat(new ListRefs(cloned.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/master\");\n\n        URIish remoteUri = cloned.remoteList().call().get(0).getURIs().get(0);\n        String remoteUrl = remoteUri.getScheme() + \"://\" + remoteUri.getHost() + remoteUri.getPath();\n        assertThat(remoteUrl).isEqualTo(ORIGIN);\n    }\n\n    @Test\n    public void testBadUrl() throws IOException, GitAPIException {\n        final File parentFolder = createTempDirectory();\n        final File directory = new File(parentFolder,\n                                        TARGET_GIT);\n        try {\n            new Clone(directory,\n                      ORIGIN + \"sssss\",\n                      false,\n                      null,\n                      CredentialsProvider.getDefault(),\n                      null,\n                      null).execute();\n            fail(\"If got here the test is wrong because the ORIGIN does no exist\");\n        } catch (Clone.CloneException ex) {\n            assertThat(ex).isNotNull();\n            logger.info(ex.getMessage(),\n                        ex);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitPathTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.EncodingUtil;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class JGitPathTest {\n\n    private final FileSystemProvider fsp = mock(FileSystemProvider.class);\n    private final JGitFileSystem fs = mock(JGitFileSystem.class);\n\n    @Before\n    public void setup() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n        when(fs.provider()).thenReturn(fsp);\n        when(fsp.isDefault()).thenReturn(false);\n        when(fsp.getScheme()).thenReturn(\"git\");\n    }\n\n    @Test\n    public void testSimpleBranchedGit() {\n        final Path path = JGitPathImpl.create(fs,\n                                              \"\",\n                                              \"main@my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://main@my-host/\");\n        assertThat(path.getRoot()).isEqualTo(path);\n\n        assertThat(path.getNameCount()).isEqualTo(0);\n\n        assertThat(path.getRoot()).isEqualTo(path);\n    }\n\n    @Test\n    public void testSimpleBranchedGitRoot() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"/\",\n                                              \"main@my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://main@my-host/\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n\n        assertThat(path.getNameCount()).isEqualTo(0);\n    }\n\n    @Test\n    public void testSimpleBranchedGitRelative() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"home\",\n                                              \"main@my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"home\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://main@my-host/:home\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"\");\n\n        assertThat(path.getNameCount()).isEqualTo(1);\n    }\n\n    @Test\n    public void testSimpleBranchedGitRoot2() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"/path/to/some/place.txt\",\n                                              \"main@my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://main@my-host/path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testSimpleBranchedGitRoot2Spaced() throws IllegalStateException {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              EncodingUtil.decode(\"/path/to/some/some%20place.txt\"),\n                                              \"main@my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/some place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://main@my-host/path/to/some/some%20place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testSimpleImplicitBranchGit() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"/path/to/some/place.txt\",\n                                              \"my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/path/to/some/place.txt\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://master@my-host/path/to/some/place.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(4);\n\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testSimpleImplicitBranchGitRoot() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"/\",\n                                              \"my-host\",\n                                              false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/\");\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThat(path.toUri().toString()).isEqualTo(\"git://master@my-host/\");\n\n        assertThat(path.getNameCount()).isEqualTo(0);\n\n        assertThat(path.getRoot().toString()).isEqualTo(\"/\");\n        assertThatThrownBy(() -> path.getName(0))\n                .isInstanceOf(IllegalArgumentException.class);\n    }\n\n    @Test\n    public void testRelativize() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = JGitPathImpl.create(fs,\n                                              \"/path/to\",\n                                              \"main@my-host\",\n                                              false);\n        final Path other = JGitPathImpl.create(fs,\n                                               \"/path/to/some/place\",\n                                               \"main@my-host\",\n                                               false);\n\n        final Path relative = path.relativize(other);\n        assertThat(relative).isNotNull();\n        assertThat(relative.toString()).isEqualTo(\"some/place\");\n\n        final Path path2 = JGitPathImpl.create(fs,\n                                               \"/path/to/some/place\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other2 = JGitPathImpl.create(fs,\n                                                \"/path/to\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative2 = path2.relativize(other2);\n        assertThat(relative2).isNotNull();\n        assertThat(relative2.toString()).isEqualTo(\"../..\");\n\n        final Path path3 = JGitPathImpl.create(fs,\n                                               \"/path/to\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other3 = JGitPathImpl.create(fs,\n                                                \"/path/to\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative3 = path3.relativize(other3);\n        assertThat(relative3).isNotNull();\n        assertThat(relative3.toString()).isEqualTo(\"\");\n\n        final Path path4 = JGitPathImpl.create(fs,\n                                               \"path/to\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other4 = JGitPathImpl.create(fs,\n                                                \"path/to/some/place\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative4 = path4.relativize(other4);\n        assertThat(relative4).isNotNull();\n        assertThat(relative4.toString()).isEqualTo(\"some/place\");\n\n        final Path path5 = JGitPathImpl.create(fs,\n                                               \"path/to\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other5 = JGitPathImpl.create(fs,\n                                                \"some/place\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative5 = path5.relativize(other5);\n        assertThat(relative5).isNotNull();\n        assertThat(relative5.toString()).isEqualTo(\"../../some/place\");\n\n        final Path path6 = JGitPathImpl.create(fs,\n                                               \"some/place\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other6 = JGitPathImpl.create(fs,\n                                                \"path/to\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative6 = path6.relativize(other6);\n        assertThat(relative6).isNotNull();\n        assertThat(relative6.toString()).isEqualTo(\"../../path/to\");\n\n        final Path path7 = JGitPathImpl.create(fs,\n                                               \"path/to/some/thing/here\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other7 = JGitPathImpl.create(fs,\n                                                \"some/place\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative7 = path7.relativize(other7);\n        assertThat(relative7).isNotNull();\n        assertThat(relative7.toString()).isEqualTo(\"../../../../../some/place\");\n\n        final Path path8 = JGitPathImpl.create(fs,\n                                               \"some/place\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other8 = JGitPathImpl.create(fs,\n                                                \"path/to/some/thing/here\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative8 = path8.relativize(other8);\n        assertThat(relative8).isNotNull();\n        assertThat(relative8.toString()).isEqualTo(\"../../path/to/some/thing/here\");\n\n        final Path path9 = JGitPathImpl.create(fs,\n                                               \"/path/to\",\n                                               \"main@my-host\",\n                                               false);\n        final Path other9 = JGitPathImpl.create(fs,\n                                                \"/path/to\",\n                                                \"main@my-host\",\n                                                false);\n\n        final Path relative9 = path9.relativize(other9);\n        assertThat(relative9).isNotNull();\n        assertThat(relative9.toString()).isEqualTo(\"\");\n\n        final Path path10 = JGitPathImpl.create(fs,\n                                                \"path/to\",\n                                                \"main@my-host\",\n                                                false);\n        final Path other10 = JGitPathImpl.create(fs,\n                                                 \"path/to\",\n                                                 \"main@my-host\",\n                                                 false);\n\n        final Path relative10 = path10.relativize(other10);\n        assertThat(relative10).isNotNull();\n        assertThat(relative10.toString()).isEqualTo(\"\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitRevertMergeTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\nimport org.uberfire.java.nio.fs.jgit.util.model.MessageCommitInfo;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitRevertMergeTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n    private static final String DEVELOP_BRANCH = \"develop\";\n\n    private static final List<String> TXT_FILES =\n            Stream.of(\"file0\", \"file1\", \"file2\", \"file3\", \"file4\")\n                    .collect(Collectors.toList());\n\n    private static final String[] COMMON_TXT_LINES = {\"Line1\", \"Line2\", \"Line3\", \"Line4\"};\n\n    private String commonAncestorCommitId;\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(0), multiline(TXT_FILES.get(0), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), COMMON_TXT_LINES)));\n\n        new CreateBranch((GitImpl) git, MAIN_BRANCH, DEVELOP_BRANCH).execute();\n\n        commit(git, DEVELOP_BRANCH, \"Adding files\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        commonAncestorCommitId = git.getCommonAncestorCommit(DEVELOP_BRANCH,\n                                                             MAIN_BRANCH).getName();\n    }\n\n    @Test(expected = GitException.class)\n    public void testInvalidSourceBranch() {\n        String mergeCommitId = doMerge();\n\n        git.revertMerge(\"invalid-branch\",\n                        MAIN_BRANCH,\n                        commonAncestorCommitId,\n                        mergeCommitId);\n    }\n\n    @Test(expected = GitException.class)\n    public void testInvalidTargetBranch() {\n        String mergeCommitId = doMerge();\n\n        git.revertMerge(DEVELOP_BRANCH,\n                        \"invalid-branch\",\n                        commonAncestorCommitId,\n                        mergeCommitId);\n    }\n\n    @Test\n    public void testRevertFailedMergeIsNotLastTargetCommit() throws IOException {\n        String mergeCommitId = doMerge();\n\n        commit(git, MAIN_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(0), \"new content\"));\n\n        boolean result = git.revertMerge(DEVELOP_BRANCH,\n                                         MAIN_BRANCH,\n                                         commonAncestorCommitId,\n                                         mergeCommitId);\n\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void testRevertFailedMergeParentTargetIsNotCommonAncestor() throws IOException {\n        commit(git, MAIN_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(0), \"new content\"));\n\n        String mergeCommitId = doMerge();\n\n        boolean result = git.revertMerge(DEVELOP_BRANCH,\n                                         MAIN_BRANCH,\n                                         commonAncestorCommitId,\n                                         mergeCommitId);\n\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void testRevertFailedMergeSourceParentIsNotLastSourceCommit() throws IOException {\n        String mergeCommitId = doMerge();\n\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(0), \"new content\"));\n\n        boolean result = git.revertMerge(DEVELOP_BRANCH,\n                                         MAIN_BRANCH,\n                                         commonAncestorCommitId,\n                                         mergeCommitId);\n\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void testRevertSucceeded() {\n        String mergeCommitId = doMerge();\n\n        boolean result = git.revertMerge(DEVELOP_BRANCH,\n                                         MAIN_BRANCH,\n                                         commonAncestorCommitId,\n                                         mergeCommitId);\n\n        assertThat(result).isTrue();\n    }\n\n    private String doMerge() {\n        git.merge(DEVELOP_BRANCH,\n                  MAIN_BRANCH,\n                  true,\n                  false,\n                  MessageCommitInfo.createMergeMessage(DEVELOP_BRANCH));\n\n        return git.getLastCommit(MAIN_BRANCH).getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSSHConfigSessionFactoryTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit;\n\nimport java.util.Collections;\nimport java.util.HashMap;\n\nimport com.jcraft.jsch.Proxy;\nimport com.jcraft.jsch.ProxyHTTP;\nimport com.jcraft.jsch.Session;\nimport org.eclipse.jgit.transport.OpenSshConfig;\nimport org.junit.Test;\nimport org.uberfire.commons.config.ConfigProperties;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.mockito.Mockito.mock;\n\npublic class JGitSSHConfigSessionFactoryTest {\n\n    @Test\n    public void testNoProxy() {\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n\n        };\n        config.load(new ConfigProperties(Collections.emptyMap()));\n\n        final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) {\n            @Override\n            ProxyHTTP buildProxy(final JGitFileSystemProviderConfiguration config) {\n                fail(\"no proxy should be set\");\n                return null;\n            }\n        };\n        instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class));\n    }\n\n    @Test\n    public void testHttpProxy() {\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n\n        };\n        config.load(new ConfigProperties(new HashMap<String, String>() {{\n            put(\"org.uberfire.nio.git.proxy.ssh.over.http\", \"true\");\n            put(\"http.proxyHost\", \"somehost\");\n            put(\"http.proxyPort\", \"10\");\n        }}));\n\n        final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) {\n            @Override\n            Proxy buildProxy(final JGitFileSystemProviderConfiguration config) {\n                Proxy proxy = super.buildProxy(config);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_host\", \"somehost\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_port\", 10);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"user\", null);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"passwd\", null);\n                return proxy;\n            }\n        };\n        instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class));\n    }\n\n    @Test\n    public void testHttpProxyWithAuthentication() {\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n\n        };\n        config.load(new ConfigProperties(new HashMap<String, String>() {{\n            put(\"org.uberfire.nio.git.proxy.ssh.over.http\", \"true\");\n            put(\"http.proxyHost\", \"somehost\");\n            put(\"http.proxyPort\", \"10\");\n            put(\"http.proxyUser\", \"user\");\n            put(\"http.proxyPassword\", \"passwd\");\n        }}));\n\n        final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) {\n            @Override\n            Proxy buildProxy(final JGitFileSystemProviderConfiguration config) {\n                Proxy proxy = super.buildProxy(config);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_host\", \"somehost\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_port\", 10);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"user\", \"user\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"passwd\", \"passwd\");\n                return proxy;\n            }\n        };\n        instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class));\n    }\n\n    @Test\n    public void testHttpsProxy() {\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n\n        };\n        config.load(new ConfigProperties(new HashMap<String, String>() {{\n            put(\"org.uberfire.nio.git.proxy.ssh.over.https\", \"true\");\n            put(\"https.proxyHost\", \"somehost\");\n            put(\"https.proxyPort\", \"10\");\n        }}));\n\n        final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) {\n            @Override\n            Proxy buildProxy(final JGitFileSystemProviderConfiguration config) {\n                Proxy proxy = super.buildProxy(config);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_host\", \"somehost\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_port\", 10);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"user\", null);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"passwd\", null);\n                return proxy;\n            }\n        };\n        instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class));\n    }\n\n    @Test\n    public void testHttpsProxyWithAuthentication() {\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n\n        };\n        config.load(new ConfigProperties(new HashMap<String, String>() {{\n            put(\"org.uberfire.nio.git.proxy.ssh.over.https\", \"true\");\n            put(\"https.proxyHost\", \"somehost\");\n            put(\"https.proxyPort\", \"10\");\n            put(\"https.proxyUser\", \"user\");\n            put(\"https.proxyPassword\", \"passwd\");\n        }}));\n\n        final JGitSSHConfigSessionFactory instance = new JGitSSHConfigSessionFactory(config) {\n            @Override\n            Proxy buildProxy(final JGitFileSystemProviderConfiguration config) {\n                Proxy proxy = super.buildProxy(config);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_host\", \"somehost\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"proxy_port\", 10);\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"user\", \"user\");\n                assertThat(proxy).hasFieldOrPropertyWithValue(\"passwd\", \"passwd\");\n                return proxy;\n            }\n        };\n        instance.configure(mock(OpenSshConfig.Host.class), mock(Session.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSquashingTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.errors.IncorrectObjectTypeException;\nimport org.eclipse.jgit.errors.MissingObjectException;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;\nimport org.junit.Test;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Squash;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.fail;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.DIRECTORY;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.FILE;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.NOT_FOUND;\n\npublic class JGitSquashingTest extends AbstractTestInfra {\n\n    private Logger logger = LoggerFactory.getLogger(JGitSquashingTest.class);\n\n    static {\n        CredentialsProvider.setDefault(new UsernamePasswordCredentialsProvider(\"guest\",\n                                                                               \"\"));\n    }\n\n    /*\n     * This test make 5 commits and then squah the last 4 into a single commit\n     */\n    @Test\n    public void testSquash4Of5Commits() throws IOException, GitAPIException {\n\n        final File parentFolder = createTempDirectory();\n        logger.info(\">> Parent Forlder for the Test: \" + parentFolder.getAbsolutePath());\n        final File gitFolder = new File(parentFolder,\n                                        \"my-local-repo.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 1!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"initial content file 1\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 2!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"initial content file 2\"));\n                   }}).execute();\n        Iterable<RevCommit> logs = ((GitImpl) origin)._log().setMaxCount(1).all().call();\n        RevCommit secondCommit = logs.iterator().next();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 3!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"new content file 1\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 4!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"new content file 2\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 5!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file3.txt\",\n                           tempFile(\"initial content file 3\"));\n                   }}).execute();\n        logs = ((GitImpl) origin)._log().all().call();\n        int commitsCount = 0;\n        for (RevCommit commit : logs) {\n            logger.info(\">>> Origin Commit: \" + commit.getFullMessage() + \" - \" + commit.toString());\n            commitsCount++;\n        }\n        assertThat(commitsCount).isEqualTo(5);\n\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"pathx/\").getPathType()).isEqualTo(NOT_FOUND);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to/file1.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to/file2.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to/file3.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to\").getPathType()).isEqualTo(DIRECTORY);\n\n        logger.info(\"Squashing from \" + secondCommit.getName() + \"  to HEAD\");\n        new Squash((GitImpl) origin,\n                   \"main\",\n                   secondCommit.getName(),\n                   \"squashed message\").execute();\n\n        commitsCount = 0;\n        for (RevCommit commit : ((GitImpl) origin)._log().all().call()) {\n            logger.info(\">>> Final Commit: \" + commit.getFullMessage() + \" - \" + commit.toString());\n            commitsCount++;\n        }\n        assertThat(commitsCount).isEqualTo(2);\n    }\n\n    @Test\n    public void testFailWhenTryToSquashCommitsFromDifferentBranches() throws IOException, GitAPIException {\n\n        final File parentFolder = createTempDirectory();\n        logger.info(\">> Parent Forlder for the Test: \" + parentFolder.getAbsolutePath());\n        final File gitFolder = new File(parentFolder,\n                                        \"my-local-repo.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"aparedes\",\n                   \"aparedes@example.com\",\n                   \"commit 1!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"initial content file 1\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"develop\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 2!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"initial content file 2\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"aparedes\",\n                   \"aparedes@example.com\",\n                   \"commit 3!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file3.txt\",\n                           tempFile(\"initial content file 1\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"aparedes\",\n                   \"aparedes@example.com\",\n                   \"commit 4!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file4.txt\",\n                           tempFile(\"initial content file 1\"));\n                   }}).execute();\n\n        List<RevCommit> mainCommits = getCommitsFromBranch((GitImpl) origin,\n                                                             \"main\");\n        List<RevCommit> developCommits = getCommitsFromBranch((GitImpl) origin,\n                                                              \"develop\");\n\n        assertThat(mainCommits.size()).isEqualTo(3);\n        assertThat(developCommits.size()).isEqualTo(1);\n\n        try {\n            new Squash((GitImpl) origin,\n                       \"main\",\n                       developCommits.get(0).getName(),\n                       \"squashed message\").execute();\n            fail(\"If it reaches here the test has failed because he found the commit into the branch\");\n        } catch (GitException e) {\n            logger.info(e.getMessage());\n            assertThat(e).isNotNull();\n        }\n    }\n\n    private List<RevCommit> getCommitsFromBranch(final GitImpl origin,\n                                                 String branch) throws GitAPIException, MissingObjectException, IncorrectObjectTypeException {\n        List<RevCommit> commits = new ArrayList<>();\n        final ObjectId id = new GetRef(origin.getRepository(),\n                                       branch).execute().getObjectId();\n        for (RevCommit commit : origin._log().add(id).call()) {\n            logger.info(\">>> \" + branch + \" Commits: \" + commit.getFullMessage() + \" - \" + commit.toString());\n            commits.add(commit);\n        }\n        return commits;\n    }\n\n    /*\n     * This test also perform 5 commits and squash the last 4 into a single commit\n     *  but now the changes are in different paths\n     */\n    @Test\n    public void testSquashCommitsWithDifferentPaths() throws IOException, GitAPIException {\n\n        final File parentFolder = createTempDirectory();\n        logger.info(\">> Parent Folder for the Test: \" + parentFolder.getAbsolutePath());\n        final File gitFolder = new File(parentFolder,\n                                        \"my-local-repo.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 1!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"initial content file 1\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 2!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"initial content file 2\"));\n                   }}).execute();\n        Iterable<RevCommit> logs = ((GitImpl) origin)._log().setMaxCount(1).all().call();\n        RevCommit secondCommit = logs.iterator().next();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 3!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file1.txt\",\n                           tempFile(\"new content file 1\"));\n                   }}).execute();\n\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 4!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"new content file 2\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"salaboy\",\n                   \"salaboy@example.com\",\n                   \"commit 5!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/file3.txt\",\n                           tempFile(\"initial content file 3\"));\n                   }}).execute();\n\n        for (RevCommit commit : ((GitImpl) origin)._log().all().call()) {\n            logger.info(\">>> Origin Commit: \" + commit.getFullMessage() + \" - \" + commit.toString());\n        }\n\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"pathx/\").getPathType()).isEqualTo(NOT_FOUND);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"file1.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to/file2.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/file3.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(origin.getPathInfo(\"main\",\n                                      \"path/to\").getPathType()).isEqualTo(DIRECTORY);\n\n        logger.info(\"Squashing from \" + secondCommit.getName() + \"  to HEAD\");\n        new Squash((GitImpl) origin,\n                   \"main\",\n                   secondCommit.getName(),\n                   \"squashed message\").execute();\n\n        int commitsCount = 0;\n        for (RevCommit commit : ((GitImpl) origin)._log().all().call()) {\n            logger.info(\">>> Final Commit: \" + commit.getFullMessage() + \" - \" + commit.toString());\n            commitsCount++;\n        }\n\n        assertThat(commitsCount).isEqualTo(2);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitSubdirectoryCloneTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.singletonList;\nimport static java.util.stream.Collectors.toSet;\nimport static org.assertj.core.api.Assertions.assertThat;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.apache.commons.io.IOUtils;\nimport org.eclipse.jgit.dircache.DirCache;\nimport org.eclipse.jgit.dircache.DirCacheEditor;\nimport org.eclipse.jgit.dircache.DirCacheEditor.PathEdit;\nimport org.eclipse.jgit.dircache.DirCacheEntry;\nimport org.eclipse.jgit.hooks.PostCommitHook;\nimport org.eclipse.jgit.hooks.PreCommitHook;\nimport org.eclipse.jgit.lib.CommitBuilder;\nimport org.eclipse.jgit.lib.Constants;\nimport org.eclipse.jgit.lib.FileMode;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.lib.ObjectInserter;\nimport org.eclipse.jgit.lib.PersonIdent;\nimport org.eclipse.jgit.lib.Ref;\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.eclipse.jgit.revwalk.RevSort;\nimport org.eclipse.jgit.revwalk.RevWalk;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.eclipse.jgit.treewalk.CanonicalTreeParser;\nimport org.eclipse.jgit.treewalk.TreeWalk;\nimport org.junit.Test;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\nimport org.uberfire.java.nio.fs.jgit.util.commands.SubdirectoryClone;\n\npublic class JGitSubdirectoryCloneTest extends AbstractTestInfra {\n\n    private static final String TARGET_GIT = \"target/target\",\n            SOURCE_GIT = \"source/source\";\n\n    @Test\n    public void cloneSubdirectorySingleBranch() throws Exception {\n        final File parentFolder = createTempDirectory();\n\n        final File sourceDir = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File targetDir = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = gitRepo(sourceDir);\n        commit(origin, \"main\", \"first\", content(\"dir1/file.txt\", \"foo\"));\n        commit(origin, \"main\", \"second\", content(\"dir2/file2.txt\", \"bar\"));\n        commit(origin, \"main\", \"third\", content(\"file3.txt\", \"moogah\"));\n\n        final Git cloned = new SubdirectoryClone(targetDir,\n                                                 sourceDir.getAbsoluteFile().toURI().toString(),\n                                                 \"dir1\",\n                                                 singletonList(\"main\"),\n                                                 CredentialsProvider.getDefault(),\n                                                 null,\n                                                 null).execute();\n\n        assertThat(origin.getRepository().getRemoteNames()).isEmpty();\n\n        assertThat(cloned).isNotNull();\n        assertThat(listRefs(cloned)).hasSize(1);\n\n        final List<RevCommit> cloneCommits = getCommits(cloned, \"main\");\n        assertThat(cloneCommits).hasSize(1);\n\n        final RevCommit clonedCommit = cloneCommits.get(0);\n        final RevCommit originCommit = getCommits(origin, \"main\").get(2); // Ordered children first\n\n        assertClonedCommitData(origin, \"dir1\", clonedCommit, originCommit);\n    }\n\n    @Test\n    public void cloneSubdirectoryMultipleBranches() throws Exception {\n        final File parentFolder = createTempDirectory();\n\n        final File sourceDir = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File targetDir = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = gitRepo(sourceDir);\n        commit(origin,\n               \"main\",\n               \"first\",\n               content(\"dir1/file.txt\", \"foo\"),\n               content(\"dir2/file2.txt\", \"bar\"),\n               content(\"file3.txt\", \"moogah\"));\n\n        branch(origin, \"main\", \"dev\");\n        commit(origin,\n               \"dev\",\n               \"second\",\n               content(\"dir1/file.txt\", \"foo1\"),\n               content(\"file3.txt\", \"bar1\"));\n\n        branch(origin, \"main\", \"ignored\");\n        commit(origin,\n               \"ignored\",\n               \"third\",\n               content(\"dir1/file.txt\", \"foo2\"));\n\n        final Git cloned = new SubdirectoryClone(targetDir,\n                                                 sourceDir.getAbsoluteFile().toURI().toString(),\n                                                 \"dir1\",\n                                                 asList(\"main\", \"dev\"),\n                                                 CredentialsProvider.getDefault(),\n                                                 null,\n                                                 null).execute();\n\n        assertThat(cloned).isNotNull();\n        final Set<String> clonedRefs = listRefs(cloned).stream()\n                                                       .map(ref -> ref.getName())\n                                                       .collect(toSet());\n        assertThat(clonedRefs).hasSize(2);\n        assertThat(clonedRefs).containsExactly(\"refs/heads/main\", \"refs/heads/dev\");\n\n\n        // Check main commits\n        {\n            final List<RevCommit> cloneCommits = getCommits(cloned, \"main\");\n            assertThat(cloneCommits).hasSize(1);\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(0), getCommits(origin, \"main\").get(0));\n        }\n\n        // Check dev commits\n        {\n            final List<RevCommit> cloneCommits = getCommits(cloned, \"dev\");\n            assertThat(cloneCommits).hasSize(2);\n\n            final List<RevCommit> originCommits = getCommits(origin, \"dev\");\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(0), originCommits.get(0));\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(1), originCommits.get(1));\n        }\n    }\n\n    @Test\n    public void cloneSubdirectoryWithMergeCommit() throws Exception {\n        final File parentFolder = createTempDirectory();\n\n        final File sourceDir = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File targetDir = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = gitRepo(sourceDir);\n        commit(origin,\n               \"main\",\n               \"first\",\n               content(\"dir1/file.txt\", \"foo\"),\n               content(\"dir2/file2.txt\", \"bar\"),\n               content(\"file3.txt\", \"moogah\"));\n\n        branch(origin, \"main\", \"dev\");\n        commit(origin,\n               \"dev\",\n               \"second\",\n               content(\"dir1/file.txt\", \"foo1\"),\n               content(\"file3.txt\", \"bar1\"));\n\n        commit(origin,\n               \"main\",\n               \"another\",\n               content(\"dir1/file2.txt\", \"blah\"));\n\n        mergeCommit(origin,\n                    \"main\",\n                    \"dev\",\n                    content(\"dir1/file.txt\", \"merged value!\"),\n                    content(\"dir2/file2.txt\", \"merged value!\"),\n                    content(\"file3.txt\", \"merged value!\"));\n\n        final Git cloned = new SubdirectoryClone(targetDir,\n                                                 sourceDir.getAbsoluteFile().toURI().toString(),\n                                                 \"dir1\",\n                                                 asList(\"main\", \"dev\"),\n                                                 CredentialsProvider.getDefault(),\n                                                 null,\n                                                 null).execute();\n\n        assertThat(cloned).isNotNull();\n        final Set<String> clonedRefs = listRefs(cloned).stream()\n                                                       .map(ref -> ref.getName())\n                                                       .collect(toSet());\n        assertThat(clonedRefs).hasSize(2);\n        assertThat(clonedRefs).containsExactly(\"refs/heads/main\", \"refs/heads/dev\");\n\n        // Check main commits\n        {\n            final List<RevCommit> cloneCommits = getCommits(cloned, \"main\");\n            assertThat(cloneCommits).hasSize(4); // 2 on main + 1 on dev + 1 merge commit\n\n            final List<RevCommit> originCommits = getCommits(origin, \"main\");\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(0), originCommits.get(0));\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(1), originCommits.get(1));\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(2), originCommits.get(2));\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(3), originCommits.get(3));\n\n            // Check that we preserved the topology of commits.\n            assertThat(cloneCommits.get(0).getParentCount()).isEqualTo(2);\n            assertThat(cloneCommits.get(1).getParentCount()).isEqualTo(1);\n            assertThat(cloneCommits.get(2).getParentCount()).isEqualTo(1);\n            assertThat(cloneCommits.get(3).getParentCount()).isEqualTo(0);\n        }\n\n        // Check dev commits\n        {\n            final List<RevCommit> cloneCommits = getCommits(cloned, \"dev\");\n            assertThat(cloneCommits).hasSize(2);\n\n            final List<RevCommit> originCommits = getCommits(origin, \"dev\");\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(0), originCommits.get(0));\n            assertClonedCommitData(origin, \"dir1\", cloneCommits.get(1), originCommits.get(1));\n        }\n    }\n    \n    @Test\n    public void cloneSubdirectoryWithHookDir() throws Exception {\n    \tfinal File hooksDir = createTempDirectory();\n\n        writeMockHook(hooksDir, PostCommitHook.NAME);\n        writeMockHook(hooksDir, PreCommitHook.NAME);\n        \n        final File parentFolder = createTempDirectory();\n\n        final File sourceDir = new File(parentFolder,\n                                        SOURCE_GIT + \".git\");\n\n        final File targetDir = new File(parentFolder,\n                                        TARGET_GIT + \".git\");\n\n        final Git origin = gitRepo(sourceDir);\n        commit(origin, \"main\", \"first\", content(\"dir1/file.txt\", \"foo\"));\n        commit(origin, \"main\", \"second\", content(\"dir2/file2.txt\", \"bar\"));\n        commit(origin, \"main\", \"third\", content(\"file3.txt\", \"moogah\"));\n\n        final Git cloned = new SubdirectoryClone(targetDir,\n                                                 sourceDir.getAbsoluteFile().toURI().toString(),\n                                                 \"dir1\",\n                                                 singletonList(\"main\"),\n                                                 CredentialsProvider.getDefault(),\n                                                 null,\n                                                 hooksDir).execute();\n\n        assertThat(origin.getRepository().getRemoteNames()).isEmpty();\n\n        assertThat(cloned).isNotNull();\n        assertThat(listRefs(cloned)).hasSize(1);\n\n        final List<RevCommit> cloneCommits = getCommits(cloned, \"main\");\n        assertThat(cloneCommits).hasSize(1);\n\n        final RevCommit clonedCommit = cloneCommits.get(0);\n        final RevCommit originCommit = getCommits(origin, \"main\").get(2); // Ordered children first\n\n        assertClonedCommitData(origin, \"dir1\", clonedCommit, originCommit);\n        \n        boolean foundPreCommitHook = false;\n        boolean foundPostCommitHook = false;\n        File[] hooks = new File(cloned.getRepository().getDirectory(), \"hooks\").listFiles();\n\t\tassertThat(hooks).isNotEmpty().isNotNull();\n\t\tassertThat(hooks.length).isEqualTo(2);\n        for (File hook : hooks) {\n            if (hook.getName().equals(PreCommitHook.NAME)) {\n                foundPreCommitHook = hook.canExecute();\n            } else if (hook.getName().equals(PostCommitHook.NAME)) {\n                foundPostCommitHook = hook.canExecute();\n            }\n        }\n        assertThat(foundPreCommitHook).isTrue();\n        assertThat(foundPostCommitHook).isTrue();\n    }\n\n\n    private void assertClonedCommitData(final Git origin,\n                                        final String subdirectory,\n                                        final RevCommit clonedCommit,\n                                        final RevCommit originCommit) throws Exception {\n        assertThat(clonedCommit.getFullMessage()).isEqualTo(originCommit.getFullMessage());\n\n        final PersonIdent authorIdent = clonedCommit.getAuthorIdent();\n        final PersonIdent commiterIdent = clonedCommit.getCommitterIdent();\n        assertThat(authorIdent).isEqualTo(commiterIdent);\n        assertThat(authorIdent.getName()).isEqualTo(\"name\");\n        assertThat(authorIdent.getEmailAddress()).isEqualTo(\"name@example.com\");\n\n        final ObjectId originDirId = findIdForPath(origin, originCommit, subdirectory);\n        final ObjectId clonedTreeId = clonedCommit.getTree().getId();\n        assertThat(clonedTreeId).isEqualTo(originDirId);\n    }\n\n    private ObjectId findIdForPath(final Git origin, final RevCommit originMainTip, final String searchPath) throws Exception {\n        try (TreeWalk treeWalk = new TreeWalk(origin.getRepository())) {\n            final int treeId = treeWalk.addTree(originMainTip.getTree());\n            treeWalk.setRecursive(false);\n            final CanonicalTreeParser treeParser = treeWalk.getTree(treeId, CanonicalTreeParser.class);\n            while (treeWalk.next()) {\n                final String path = treeParser.getEntryPathString();\n                if (path.equals(searchPath)) {\n                    return treeParser.getEntryObjectId();\n                }\n            }\n        }\n\n        throw new AssertionError(String.format(\"Could not find path [%s] in commit [%s].\", searchPath, originMainTip.name()));\n    }\n\n    private List<RevCommit> getCommits(final Git git, String branch) throws Exception {\n        List<RevCommit> commits = new ArrayList<>();\n        try (RevWalk revWalk = new RevWalk(git.getRepository())) {\n            final RevCommit branchTip = revWalk.parseCommit(git.getRepository().resolve(branch));\n            revWalk.markStart(branchTip);\n            revWalk.sort(RevSort.TOPO);\n            final Iterator<RevCommit> iter = revWalk.iterator();\n            while (iter.hasNext()) {\n                commits.add(iter.next());\n            }\n        }\n        return commits;\n    }\n\n    private Git gitRepo(File gitSource) {\n        return new CreateRepository(gitSource).execute().get();\n    }\n\n    /*\n     * Unfortunately there is no easier way to write a commit with multiple parents.\n     */\n    private void mergeCommit(final Git origin,\n                             final String targetBranchName,\n                             final String sourceBranchName,\n                             final TestFile... testFiles) throws Exception {\n        final Repository repo = origin.getRepository();\n        final org.eclipse.jgit.api.Git git = org.eclipse.jgit.api.Git.wrap(repo);\n\n        final ObjectId targetId = repo.resolve(targetBranchName);\n        final ObjectId sourceId = repo.resolve(sourceBranchName);\n\n        final DirCache dc = DirCache.newInCore();\n        final DirCacheEditor editor = dc.editor();\n\n        try (ObjectInserter inserter = repo.newObjectInserter()) {\n            final ObjectId treeId = writeTestFilesToTree(dc, editor, inserter, testFiles);\n            final ObjectId commitId = writeCommit(inserter, treeId, targetId, sourceId);\n            updateBranch(targetBranchName, git, commitId);\n        }\n    }\n\n    private void updateBranch(final String targetBranchName,\n                             final org.eclipse.jgit.api.Git git,\n                             final ObjectId commitId) throws Exception {\n        git.branchCreate()\n           .setName(targetBranchName)\n           .setStartPoint(commitId.name())\n           .setForce(true)\n           .call();\n    }\n\n    private ObjectId writeCommit(final ObjectInserter inserter, final ObjectId commitTreeId, final ObjectId... parentIds) throws IOException {\n        final CommitBuilder builder = new CommitBuilder();\n        builder.setAuthor(new PersonIdent(\"name\", \"name@example.com\"));\n        builder.setCommitter(new PersonIdent(\"name\", \"name@example.com\"));\n        builder.setTreeId(commitTreeId);\n        builder.setMessage(\"merge commit\");\n        builder.setParentIds(parentIds);\n\n        final ObjectId commitId = inserter.insert(builder);\n        return commitId;\n    }\n\n    private ObjectId writeTestFilesToTree(final DirCache dc,\n                                          final DirCacheEditor editor,\n                                          ObjectInserter inserter,\n                                          final TestFile... testFiles) throws Exception {\n        for (TestFile data : testFiles) {\n            writeBlob(editor, inserter, data);\n        }\n        editor.finish();\n        final ObjectId commitTreeId = dc.writeTree(inserter);\n        return commitTreeId;\n    }\n\n    private void writeBlob(final DirCacheEditor editor, ObjectInserter inserter, TestFile data) throws IOException {\n        final ObjectId blobId = inserter.insert(Constants.OBJ_BLOB, data.content.length(), IOUtils.toInputStream(data.content, \"UTF-8\"));\n        editor.add(new PathEdit(data.path) {\n            @Override\n            public void apply(DirCacheEntry ent) {\n                ent.setFileMode(FileMode.REGULAR_FILE);\n                ent.setObjectId(blobId);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitTextualDiffBranchesTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateBranch;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class JGitTextualDiffBranchesTest extends AbstractTestInfra {\n\n    private Git git;\n\n    private static final String MAIN_BRANCH = \"main\";\n    private static final String DEVELOP_BRANCH = \"develop\";\n\n    private static final List<String> TXT_FILES =\n            Stream.of(\"file0\", \"file1\", \"file2\", \"file3\", \"file4\")\n                    .collect(Collectors.toList());\n\n    private static final String[] COMMON_TXT_LINES = {\"Line1\", \"Line2\", \"Line3\", \"Line4\"};\n\n    @Before\n    public void setup() throws IOException {\n        final File parentFolder = createTempDirectory();\n\n        final File gitSource = new File(parentFolder, \"source/source.git\");\n\n        git = new CreateRepository(gitSource).execute().get();\n\n        commit(git, MAIN_BRANCH, \"Adding files into main\",\n               content(TXT_FILES.get(0), multiline(TXT_FILES.get(0), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), COMMON_TXT_LINES)));\n\n        new CreateBranch((GitImpl) git, MAIN_BRANCH, DEVELOP_BRANCH).execute();\n    }\n\n    @Test\n    public void testDiffWithAddedFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Adding files\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(2);\n\n        diffs.forEach(diff -> {\n            assertThat(diff.getChangeType()).isEqualTo(DiffEntry.ChangeType.ADD.toString());\n            assertThat(diff.getDiffText()).isNotEmpty();\n        });\n\n        assertThat(diffs.get(0).getOldFilePath()).isEqualTo(DiffEntry.DEV_NULL);\n        assertThat(diffs.get(0).getNewFilePath()).isEqualTo(TXT_FILES.get(3));\n        assertThat(diffs.get(0).getLinesAdded()).isEqualTo(4);\n        assertThat(diffs.get(0).getLinesDeleted()).isEqualTo(0);\n    }\n\n    @Test\n    public void testDiffWithAddedFilesSameBranch() throws IOException {\n        RevCommit startCommit = git.getLastCommit(MAIN_BRANCH);\n\n        commit(git, MAIN_BRANCH, \"Adding files\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)),\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        RevCommit endCommit = git.getLastCommit(MAIN_BRANCH);\n\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH,\n                                                      MAIN_BRANCH,\n                                                      startCommit.getName(),\n                                                      endCommit.getName());\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(2);\n    }\n\n    @Test\n    public void testDiffWithAddedFileAndTargetUpdatedLater() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Adding file\",\n               content(TXT_FILES.get(3), multiline(TXT_FILES.get(3), COMMON_TXT_LINES)));\n\n        commit(git, MAIN_BRANCH, \"Adding file\",\n               content(TXT_FILES.get(4), multiline(TXT_FILES.get(4), COMMON_TXT_LINES)));\n\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(1);\n\n        assertThat(diffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.ADD.toString());\n        assertThat(diffs.get(0).getDiffText()).isNotEmpty();\n\n        assertThat(diffs.get(0).getOldFilePath()).isEqualTo(DiffEntry.DEV_NULL);\n        assertThat(diffs.get(0).getNewFilePath()).isEqualTo(TXT_FILES.get(3));\n        assertThat(diffs.get(0).getLinesAdded()).isEqualTo(4);\n        assertThat(diffs.get(0).getLinesDeleted()).isEqualTo(0);\n    }\n\n    @Test\n    public void testDiffWithRemovedFile() {\n        new Commit(git, DEVELOP_BRANCH, \"name\", \"name@example.com\", \"Removing file\",\n                   null, null, false,\n                   new HashMap<String, File>() {{\n                       put(TXT_FILES.get(0), null);\n                   }}).execute();\n\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(1);\n\n        assertThat(diffs.get(0).getChangeType()).isEqualTo(DiffEntry.ChangeType.DELETE.toString());\n        assertThat(diffs.get(0).getOldFilePath()).isEqualTo(TXT_FILES.get(0));\n        assertThat(diffs.get(0).getNewFilePath()).isEqualTo(DiffEntry.DEV_NULL);\n        assertThat(diffs.get(0).getLinesAdded()).isEqualTo(0);\n        assertThat(diffs.get(0).getLinesDeleted()).isEqualTo(4);\n        assertThat(diffs.get(0).getDiffText()).isNotEmpty();\n    }\n\n    @Test\n    public void testDiffWithUpdatedFiles() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating files\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1\", \"Line2Changed\", \"Line3\", \"Line4\")),\n               content(TXT_FILES.get(2), multiline(TXT_FILES.get(2), \"Line1\", \"Line2Changed\", \"Line3\", \"Line4\")));\n\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(2);\n\n        diffs.forEach(diff -> {\n            assertThat(diff.getChangeType()).isEqualTo(DiffEntry.ChangeType.MODIFY.toString());\n            assertThat(diff.getOldFilePath()).isEqualTo(diff.getNewFilePath());\n            assertThat(diff.getLinesAdded()).isEqualTo(1);\n            assertThat(diff.getLinesDeleted()).isEqualTo(1);\n            assertThat(diff.getDiffText()).isNotEmpty();\n        });\n\n        assertThat(diffs.get(0).getOldFilePath()).isEqualTo(TXT_FILES.get(1));\n        assertThat(diffs.get(1).getOldFilePath()).isEqualTo(TXT_FILES.get(2));\n    }\n\n    @Test\n    public void testDiffWithUpdateFirstAndLastLines() throws IOException {\n        commit(git, DEVELOP_BRANCH, \"Updating file\",\n               content(TXT_FILES.get(1), multiline(TXT_FILES.get(1), \"Line1Changed\", \"Line2\", \"Line3\", \"Line4Changed\")));\n\n        List<TextualDiff> fileDiffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(fileDiffs).isNotEmpty();\n        assertThat(fileDiffs).hasSize(1);\n    }\n\n    @Test\n    public void testDiffWithEvenBranches() {\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, DEVELOP_BRANCH);\n\n        assertThat(diffs).isEmpty();\n    }\n\n    @Test(expected = GitException.class)\n    public void testDiffWithNonExistentBranch() {\n        List<TextualDiff> diffs = git.textualDiffRefs(MAIN_BRANCH, \"nonExistentBranch\");\n\n        assertThat(diffs).isEmpty();\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUpdateFSCacheWithHostnameTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\nimport java.util.Map;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsCache;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class JGitUpdateFSCacheWithHostnameTest extends AbstractTestInfra {\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(JGitFileSystemProviderConfiguration.GIT_HTTP_ENABLED, \"true\");\n        return gitPrefs;\n    }\n\n    @Test\n    public void testFSCacheUpdateWithHostName() {\n        final URI newRepo = URI.create(\"git://repo-name\");\n        provider.addHostName(\"ssh\", \"localhost:8080/git\");\n        provider.newFileSystem(newRepo, EMPTY_ENV);\n        JGitFileSystemsCache fileSystemsCache = provider.getFsManager().getFsCache();\n\n        final FileSystem fileSystem = fileSystemsCache.get(\"repo-name\");\n        assertThat(fileSystem).isNotNull();\n        assertTrue(checkProtocolPresent(fileSystem.toString(), \"ssh\"));\n        assertFalse(checkProtocolPresent(fileSystem.toString(), \"http\"));\n\n        provider.addHostName(\"http\", \"localhost:8080/git\");\n\n        final FileSystem fileSystem1 = fileSystemsCache.get(\"repo-name\");\n        assertThat(fileSystem1).isNotNull();\n        assertFalse(checkProtocolPresent(fileSystem1.toString(), \"http\"));\n        assertThat(fileSystemsCache.getFileSystems().size()).isOne();\n\n        provider.updateCacheWithHostNames();\n\n        final FileSystem fileSystem2 = fileSystemsCache.get(\"repo-name\");\n        assertThat(fileSystem2).isNotNull();\n        assertTrue(checkProtocolPresent(fileSystem2.toString(), \"http\"));\n        assertThat(fileSystemsCache.getFileSystems().size()).isOne();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/JGitUtilTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.DIRECTORY;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.FILE;\nimport static org.uberfire.java.nio.fs.jgit.util.model.PathType.NOT_FOUND;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.eclipse.jgit.api.errors.InvalidRemoteException;\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.diff.DiffEntry.ChangeType;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Clone;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\nimport org.uberfire.java.nio.fs.jgit.util.commands.GetTreeFromRef;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListDiffs;\nimport org.uberfire.java.nio.fs.jgit.util.commands.ListRefs;\n\npublic class JGitUtilTest extends AbstractTestInfra {\n\n    @Test\n    public void testNewRepo() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        assertThat(git).isNotNull();\n\n        assertThat(new ListRefs(git.getRepository()).execute().size()).isEqualTo(0);\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n\n        assertThat(new ListRefs(git.getRepository()).execute().size()).isEqualTo(1);\n    }\n\n    @Test\n    public void testClone() throws IOException, InvalidRemoteException {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file.txt\",\n                           tempFile(\"temp\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"file3.txt\",\n                           tempFile(\"temp3\"));\n                   }}).execute();\n\n        final File gitClonedFolder = new File(parentFolder,\n                                              \"myclone.git\");\n\n        final Git git = new Clone(gitClonedFolder,\n                                  origin.getRepository().getDirectory().toString(),\n                                  false,\n                                  null,\n                                  CredentialsProvider.getDefault(),\n                                  null,\n                                  null).execute().get();\n\n        assertThat(git).isNotNull();\n\n        assertThat(new ListRefs(git.getRepository()).execute()).hasSize(2);\n\n        assertThat(new ListRefs(git.getRepository()).execute().get(0).getName()).isEqualTo(\"refs/heads/main\");\n        assertThat(new ListRefs(git.getRepository()).execute().get(1).getName()).isEqualTo(\"refs/heads/user_branch\");\n    }\n\n    @Test\n    public void testPathResolve() throws IOException, InvalidRemoteException {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"user_branch\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file3.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        final File gitClonedFolder = new File(parentFolder,\n                                              \"myclone.git\");\n\n        final Git git = new Clone(gitClonedFolder,\n                                  origin.getRepository().getDirectory().toString(),\n                                  false,\n                                  null,\n                                  CredentialsProvider.getDefault(),\n                                  null,\n                                  null).execute().get();\n\n        assertThat(git.getPathInfo(\"user_branch\",\n                                   \"pathx/\").getPathType()).isEqualTo(NOT_FOUND);\n        assertThat(git.getPathInfo(\"user_branch\",\n                                   \"path/to/file2.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(git.getPathInfo(\"user_branch\",\n                                   \"path/to\").getPathType()).isEqualTo(DIRECTORY);\n    }\n\n    @Test\n    public void testAmend() throws IOException, InvalidRemoteException {\n        final File parentFolder = createTempDirectory();\n        System.out.println(\"COOL!:\" + parentFolder.toString());\n        final File gitFolder = new File(parentFolder,\n                                        \"myxxxtest.git\");\n\n        final Git origin = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"tempwdf sdf asdf asd2222\"));\n                   }}).execute();\n        new Commit(origin,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit!\",\n                   null,\n                   null,\n                   true,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file3.txt\",\n                           tempFile(\"temp2x d dasdf asdf 222\"));\n                   }}).execute();\n\n        final File gitClonedFolder = new File(parentFolder,\n                                              \"myclone.git\");\n\n        final Git git = new Clone(gitClonedFolder,\n                                  origin.getRepository().getDirectory().toString(),\n                                  false,\n                                  null,\n                                  CredentialsProvider.getDefault(),\n                                  null,\n                                  null).execute().get();\n\n        assertThat(git.getPathInfo(\"main\",\n                                   \"pathx/\").getPathType()).isEqualTo(NOT_FOUND);\n        assertThat(git.getPathInfo(\"main\",\n                                   \"path/to/file2.txt\").getPathType()).isEqualTo(FILE);\n        assertThat(git.getPathInfo(\"main\",\n                                   \"path/to\").getPathType()).isEqualTo(DIRECTORY);\n    }\n\n    @Test\n    public void testBuildVersionAttributes() throws Exception {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit 1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"who\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit 2\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"you\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit 3\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"gonna\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit 4\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"call?\"));\n                   }}).execute();\n\n        JGitFileSystem jGitFileSystem = mock(JGitFileSystem.class);\n        when(jGitFileSystem.getGit()).thenReturn(git);\n\n        final JGitPathImpl path = mock(JGitPathImpl.class);\n        when(path.getFileSystem()).thenReturn(jGitFileSystem);\n        when(path.getRefTree()).thenReturn(\"main\");\n        when(path.getPath()).thenReturn(\"path/to/file2.txt\");\n\n        final VersionAttributes versionAttributes = new JGitVersionAttributeView(path).readAttributes();\n\n        List<VersionRecord> records = versionAttributes.history().records();\n        assertEquals(\"commit 1\",\n                     records.get(0).comment());\n        assertEquals(\"commit 2\",\n                     records.get(1).comment());\n        assertEquals(\"commit 3\",\n                     records.get(2).comment());\n        assertEquals(\"commit 4\",\n                     records.get(3).comment());\n    }\n\n    @Test\n    public void testDiffForFileCreatedInEmptyRepositoryOrBranch() throws Exception {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        final ObjectId oldHead = new GetTreeFromRef(git,\n                                                    \"main\").execute();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"commit 1\",\n                   null,\n                   null,\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file.txt\",\n                           tempFile(\"who\"));\n                   }}).execute();\n\n        final ObjectId newHead = new GetTreeFromRef(git,\n                                                    \"main\").execute();\n\n        List<DiffEntry> diff = new ListDiffs(git,\n                                             oldHead,\n                                             newHead).execute();\n        assertNotNull(diff);\n        assertFalse(diff.isEmpty());\n        assertEquals(ChangeType.ADD,\n                     diff.get(0).getChangeType());\n        assertEquals(\"path/to/file.txt\",\n                     diff.get(0).getNewPath());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/NewProviderDefineDirTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_NIO_DIR;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.GIT_NIO_DIR_NAME;\nimport static org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration.REPOSITORIES_CONTAINER_DIR;\n\n@RunWith(Parameterized.class)\npublic class NewProviderDefineDirTest extends AbstractTestInfra {\n\n    private String dirPathName;\n    private File tempDir;\n\n    public NewProviderDefineDirTest(final String dirPathName) {\n        this.dirPathName = dirPathName;\n    }\n\n    @Parameterized.Parameters(name = \"{index}: dir name: {0}\")\n    public static Collection<Object[]> data() {\n        return Arrays.asList(new Object[][]{{REPOSITORIES_CONTAINER_DIR}, {\".tempgit\"}});\n    }\n\n    @Override\n    public Map<String, String> getGitPreferences() {\n        try {\n            tempDir = createTempDirectory();\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        }\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(GIT_NIO_DIR,\n                     tempDir.toString());\n        if (!REPOSITORIES_CONTAINER_DIR.equals(dirPathName)) {\n            gitPrefs.put(GIT_NIO_DIR_NAME,\n                         dirPathName);\n        }\n        return gitPrefs;\n    }\n\n    @Test\n    public void testUsingProvidedPath() {\n        final URI newRepo = URI.create(\"git://repo-name\");\n\n        JGitFileSystemProxy fileSystem = (JGitFileSystemProxy) provider.newFileSystem(newRepo,\n                                                                                      EMPTY_ENV);\n\n        //no infra created due to lazy loading nature of our FS\n        String[] names = tempDir.list();\n\n        assertThat(names).isEmpty();\n\n        String[] repos = new File(tempDir,\n                                  dirPathName).list();\n\n        assertThat(repos).isNull();\n\n        //FS created\n        fileSystem.getRealJGitFileSystem();\n\n        names = tempDir.list();\n\n        assertThat(names).contains(dirPathName);\n\n        repos = new File(tempDir,\n                         dirPathName).list();\n\n        assertThat(repos).contains(\"repo-name.git\");\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/URITest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class URITest {\n\n    @Test\n    public void testURI() throws URISyntaxException {\n        final URI uri = new URI(\"git://branch@repo-name/path/to/file.txt\");\n\n        assertThat(uri.getScheme()).isEqualTo(\"git\");\n        assertThat(uri.getAuthority()).isEqualTo(\"branch@repo-name\");\n        assertThat(uri.getPath()).isEqualTo(\"/path/to/file.txt\");\n        assertThat(uri.getQuery()).isNull();\n\n        final URI uri2 = new URI(\"git://repo-name\");\n        assertThat(uri2).isNotNull();\n        assertThat(uri2.getAuthority()).isEqualTo(\"repo-name\");\n\n        final URI uri3 = URI.create(\"git://branch@repo-name/path/to/file.txt\");\n        assertThat(uri3).isNotNull();\n        assertThat(uri3.getScheme()).isEqualTo(\"git\");\n        assertThat(uri3.getAuthority()).isEqualTo(\"branch@repo-name\");\n        assertThat(uri3.getPath()).isEqualTo(\"/path/to/file.txt\");\n        assertThat(uri3.getQuery()).isNull();\n\n        final URI uri4 = URI.create(\"git://main@my-repo/:path/to/some/place.txt\");\n        assertThat(uri4).isNotNull();\n        assertThat(uri4.getScheme()).isEqualTo(\"git\");\n        assertThat(uri4.getAuthority()).isEqualTo(\"main@my-repo\");\n        assertThat(uri4.getPath()).isEqualTo(\"/:path/to/some/place.txt\");\n        assertThat(uri4.getQuery()).isNull();\n\n        final URI uri5 = URI.create(\"git://origin/main@my-repo/:path/to/some/place.txt\");\n        assertThat(uri5).isNotNull();\n        assertThat(uri5.getScheme()).isEqualTo(\"git\");\n        assertThat(uri5.getAuthority()).isEqualTo(\"origin\");\n        assertThat(uri5.getPath()).isEqualTo(\"/main@my-repo/:path/to/some/place.txt\");\n        assertThat(uri5.getQuery()).isNull();\n\n        final URI uri6 = URI.create(\"git://origin/main@my-repo/path/to/some/place.txt\");\n        assertThat(uri6).isNotNull();\n        assertThat(uri6.getScheme()).isEqualTo(\"git\");\n        assertThat(uri6.getAuthority()).isEqualTo(\"origin\");\n        assertThat(uri6.getPath()).isEqualTo(\"/main@my-repo/path/to/some/place.txt\");\n        assertThat(uri6.getQuery()).isNull();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/UsernamePasswordCredentialsProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit;\n\nimport org.eclipse.jgit.errors.UnsupportedCredentialItem;\nimport org.eclipse.jgit.transport.CredentialItem;\nimport org.eclipse.jgit.transport.URIish;\n\n/**\n * Mock CredentialsProvider that handles Yes/No requests\n */\npublic class UsernamePasswordCredentialsProvider extends org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider {\n\n    public UsernamePasswordCredentialsProvider(final String username,\n                                               final String password) {\n        super(username,\n              password);\n    }\n\n    @Override\n    public boolean get(final URIish uri,\n                       final CredentialItem... items) throws UnsupportedCredentialItem {\n        try {\n            return super.get(uri,\n                             items);\n        } catch (UnsupportedCredentialItem e) {\n            for (CredentialItem i : items) {\n                if (i instanceof CredentialItem.YesNoType) {\n                    ((CredentialItem.YesNoType) i).setValue(true);\n                    return true;\n                } else {\n                    continue;\n                }\n            }\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/common/PortUtilTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.common;\n\nimport java.net.ServerSocket;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.assertj.core.api.AssertionsForClassTypes.fail;\n\npublic class PortUtilTest {\n\n    @Test\n    public void testValidateOrGetNewWithPreferredNotAvailable() {\n        int result1 = PortUtil.validateOrGetNew(0);\n\n        try (ServerSocket ss = new ServerSocket(result1)) {\n            int result = PortUtil.validateOrGetNew(result1);\n            assertThat(result).isNotEqualTo(result1);\n        } catch (Exception x) {\n            fail(\"Port allocation should have work!\");\n        }\n    }\n\n    @Test\n    public void testValidateOrGetNewWithZero() {\n        int result1 = PortUtil.validateOrGetNew(0);\n\n        assertThat(result1).isNotEqualTo(0);\n    }\n\n    @Test\n    public void testValidateOrGetNewWithAvailablePreferredPort() {\n        int result = PortUtil.validateOrGetNew(0);\n        int result2 = PortUtil.validateOrGetNew(result);\n\n        assertThat(result2).isEqualTo(result);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/filters/HiddenBranchRefFilterTest.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.filters;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HiddenBranchRefFilterTest {\n\n    private HiddenBranchRefFilter filter;\n\n    @Mock\n    private Ref ref;\n    private Map<String, Ref> refs;\n\n    @Before\n    public void setUp() {\n\n        refs = new HashMap<>();\n        refs.put(\"main\",\n                 ref);\n        refs.put(\"develop\",\n                 ref);\n        refs.put(\"PR--from/develop-main\",\n                 ref);\n        refs.put(\"PR-1--main\",\n                 ref);\n        refs.put(\"PR-main\",\n                 ref);\n        refs.put(\"PR-1-from/develop-main\",\n                 ref);\n\n        filter = new HiddenBranchRefFilter();\n    }\n\n    @Test\n    public void testHiddenBranchsFiltering() {\n        final Map<String, Ref> filteredRefs = filter.filter(refs);\n        final Set<Map.Entry<String, Ref>> set = filteredRefs.entrySet();\n        assertEquals(5,\n                     set.size());\n        assertFalse(set.stream().anyMatch(entry -> entry.getKey().equals(\"PR-1-from/develop-main\")));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/git/DaemonTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.git;\n\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.TimeUnit;\n\nimport org.junit.Test;\nimport org.uberfire.commons.concurrent.ExecutorServiceProducer;\n\nimport static org.junit.Assert.*;\n\npublic class DaemonTest {\n\n    private final ExecutorService executorService = new ExecutorServiceProducer().produceUnmanagedExecutorService();\n\n    @Test\n    public void testShutdownByStop() throws Exception {\n        ExecutorService executor = Executors.newCachedThreadPool();\n        Daemon d = new Daemon(null,\n                              executor,\n                              executorService);\n        d.start();\n        assertTrue(d.isRunning());\n\n        d.stop();\n\n        assertFalse(d.isRunning());\n    }\n\n    @Test\n    public void testShutdownByThreadPoolTermination() throws Exception {\n        ExecutorService executor = Executors.newCachedThreadPool();\n        Daemon d = new Daemon(null,\n                              executor,\n                              executorService);\n        d.start();\n        assertTrue(d.isRunning());\n\n        executor.shutdownNow();\n        executor.awaitTermination(10,\n                                  TimeUnit.SECONDS);\n\n        assertFalse(d.isRunning());\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSOnlySupportTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.http;\n\nimport java.util.Map;\n\nimport javax.servlet.Servlet;\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletRegistration;\n\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.java.nio.fs.jgit.AbstractTestInfra;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class HTTPSOnlySupportTest extends AbstractTestInfra {\n\n    /*\n     * Default Git preferences suitable for most of the tests. If specific test needs some custom configuration, it needs to\n     * override this method and provide own map of preferences.\n     */\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(JGitFileSystemProviderConfiguration.GIT_HTTP_ENABLED, \"false\");\n        gitPrefs.put(JGitFileSystemProviderConfiguration.GIT_HTTPS_ENABLED, \"true\");\n        return gitPrefs;\n    }\n\n    @Test\n    public void testRoot() {\n        base(\"/\");\n        assertThat(provider.getFullHostNames().get(\"http\")).isNull();\n        assertThat(provider.getFullHostNames().get(\"https\")).isNotNull();\n    }\n\n    public void base(final String contextPath) {\n        final HTTPSupport httpSupport = new HTTPSupport() {\n            @Override\n            protected JGitFileSystemProvider resolveProvider() {\n                return provider;\n            }\n        };\n\n        final ServletContextEvent sce = mock(ServletContextEvent.class);\n\n        final ServletContext sc = mock(ServletContext.class);\n        final ServletRegistration.Dynamic dyn = mock(ServletRegistration.Dynamic.class);\n\n        ArgumentCaptor<Servlet> servletArgumentCaptor = ArgumentCaptor.forClass(Servlet.class);\n\n        when(sc.addServlet(anyString(), servletArgumentCaptor.capture())).thenReturn(dyn);\n\n        when(sce.getServletContext()).thenReturn(sc);\n        when(sc.getContextPath()).thenReturn(contextPath);\n\n        httpSupport.contextInitialized(sce);\n\n        verify(sc, times(1)).addServlet(anyString(), any(Servlet.class));\n        verify(dyn, times(1)).addMapping(\"/git/*\");\n        verify(dyn, times(1)).setLoadOnStartup(1);\n        verify(dyn, times(1)).setAsyncSupported(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportDisableTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.http;\n\nimport java.util.Map;\n\nimport javax.servlet.Servlet;\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletRegistration;\n\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.java.nio.fs.jgit.AbstractTestInfra;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertFalse;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class HTTPSupportDisableTest extends AbstractTestInfra {\n\n    /*\n     * Default Git preferences suitable for most of the tests. If specific test needs some custom configuration, it needs to\n     * override this method and provide own map of preferences.\n     */\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(JGitFileSystemProviderConfiguration.GIT_HTTP_ENABLED, \"false\");\n        return gitPrefs;\n    }\n\n    @Test\n    public void testRoot() {\n        assertThat(provider.getFullHostNames().get(\"http\")).isNull();\n    }\n\n    @Test\n    public void test() {\n        final HTTPSupport httpSupport = new HTTPSupport() {\n            @Override\n            protected JGitFileSystemProvider resolveProvider() {\n                return provider;\n            }\n        };\n\n        final ServletContextEvent sce = mock(ServletContextEvent.class);\n        final ServletContext sc = mock(ServletContext.class);\n        when(sce.getServletContext()).thenReturn(sc);\n        httpSupport.contextInitialized(sce);\n        assertFalse(provider.getFullHostNames().containsKey(\"http\"));\n\n        verify(sc, times(0)).addServlet(anyString(), any(Servlet.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/http/HTTPSupportTest.java",
    "content": "package org.uberfire.java.nio.fs.jgit.daemon.http;\n\nimport java.util.Map;\n\nimport javax.servlet.Servlet;\nimport javax.servlet.ServletContext;\nimport javax.servlet.ServletContextEvent;\nimport javax.servlet.ServletRegistration;\n\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.uberfire.java.nio.fs.jgit.AbstractTestInfra;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\npublic class HTTPSupportTest extends AbstractTestInfra {\n\n    public Map<String, String> getGitPreferences() {\n        Map<String, String> gitPrefs = super.getGitPreferences();\n        gitPrefs.put(JGitFileSystemProviderConfiguration.GIT_HTTP_ENABLED, \"true\");\n        return gitPrefs;\n    }\n\n    @Test\n    public void testRoot() {\n        base(\"\");\n        assertThat(provider.getFullHostNames().get(\"http\")).isEqualTo(\"localhost:8080/git\");\n    }\n\n    @Test\n    public void testContext() {\n        base(\"/app-former\");\n        assertThat(provider.getFullHostNames().get(\"http\")).isEqualTo(\"localhost:8080/app-former/git\");\n    }\n\n    public void base(final String contextPath) {\n        final HTTPSupport httpSupport = new HTTPSupport() {\n            @Override\n            protected JGitFileSystemProvider resolveProvider() {\n                return provider;\n            }\n        };\n\n        final ServletContextEvent sce = mock(ServletContextEvent.class);\n\n        final ServletContext sc = mock(ServletContext.class);\n        final ServletRegistration.Dynamic dyn = mock(ServletRegistration.Dynamic.class);\n\n        ArgumentCaptor<Servlet> servletArgumentCaptor = ArgumentCaptor.forClass(Servlet.class);\n\n        when(sc.addServlet(anyString(), servletArgumentCaptor.capture())).thenReturn(dyn);\n\n        when(sce.getServletContext()).thenReturn(sc);\n        when(sc.getContextPath()).thenReturn(contextPath);\n\n        httpSupport.contextInitialized(sce);\n\n        verify(sc, times(1)).addServlet(anyString(), any(Servlet.class));\n        verify(dyn, times(1)).addMapping(\"/git/*\");\n        verify(dyn, times(1)).setLoadOnStartup(1);\n        verify(dyn, times(1)).setAsyncSupported(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/daemon/ssh/GitSSHServiceTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.daemon.ssh;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.ExecutorService;\nimport org.apache.sshd.common.cipher.BuiltinCiphers;\nimport org.apache.sshd.common.mac.BuiltinMacs;\nimport org.apache.sshd.core.CoreModuleProperties;\nimport static org.assertj.core.api.Assertions.assertThat;\nimport org.eclipse.jgit.transport.resolver.ReceivePackFactory;\nimport org.eclipse.jgit.transport.resolver.UploadPackFactory;\nimport org.eclipse.jgit.util.FileUtils;\nimport org.junit.AfterClass;\nimport static org.junit.Assert.*;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport static org.mockito.Mockito.*;\nimport org.uberfire.commons.concurrent.ExecutorServiceProducer;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\n\npublic class GitSSHServiceTest {\n\n    private static final List<File> tempFiles = new ArrayList<>();\n\n    private final ExecutorService executorService = new ExecutorServiceProducer().produceUnmanagedExecutorService();\n\n    protected static File createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        tempFiles.add(temp);\n\n        return temp;\n    }\n\n    @AfterClass\n    @BeforeClass\n    public static void cleanup() {\n        for (final File tempFile : tempFiles) {\n            try {\n                FileUtils.delete(tempFile,\n                                 FileUtils.RECURSIVE);\n            } catch (IOException ignore) {\n            }\n        }\n    }\n\n    @Test\n    public void testStartStop() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        sshService.setup(certDir,\n                         null,\n                         \"10000\",\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testStartStopAlgo2() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        sshService.setup(certDir,\n                         null,\n                         \"10000\",\n                         \"DSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckTimeout() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckAlgo() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"10000\",\n                             \"xxxx\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (final Exception ex) {\n            assertThat(ex.getMessage()).contains(\"'xxxx'\");\n        }\n    }\n\n    @Test\n    public void testCheckSetupParameters() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        try {\n            sshService.setup(null,\n                             null,\n                             \"10000\",\n                             \"RSA\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'certDir'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             null,\n                             \"RSA\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'sshIdleTimeout'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"\",\n                             \"RSA\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'sshIdleTimeout'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"1000\",\n                             null,\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'algorithm'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"1000\",\n                             \"\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'algorithm'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"100\",\n                             \"RSA\",\n                             null,\n                             null,\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'receivePackFactory'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"100\",\n                             \"RSA\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             null,\n                             executorService);\n            fail(\"has to fail\");\n        } catch (IllegalArgumentException ex) {\n            assertThat(ex.getMessage()).contains(\"'repositoryResolver'\");\n        }\n\n        try {\n            sshService.setup(certDir,\n                             null,\n                             \"10000\",\n                             \"RSA\",\n                             mock(ReceivePackFactory.class),\n                             mock(UploadPackFactory.class),\n                             mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                             executorService);\n        } catch (IllegalArgumentException ex) {\n            fail(\"should not fail\");\n        }\n    }\n\n    @Test\n    public void testCheckCiphersAndMacs() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n        String ciphers = \"aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,arcfour128,arcfour256,blowfish-cbc,3des-cbc\";\n        String macs = \"hmac-md5, hmac-md5-96, hmac-sha1, hmac-sha1-96, hmac-sha2-256, hmac-sha2-512\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         ciphers,\n                         macs);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(10);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckEmptyCiphers() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n\n        String idleTimeout = \"10000\";\n        String macs = \"hmac-md5, hmac-md5-96, hmac-sha1, hmac-sha1-96, hmac-sha2-256, hmac-sha2-512\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         \"\",\n                         macs);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(9);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckEmptyMacs() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n\n        String ciphers = \"aes128-cbc,aes128-ctr,aes192-cbc,aes192-ctr,aes256-cbc,aes256-ctr,arcfour128,arcfour256,blowfish-cbc,3des-cbc\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         ciphers,\n                         \"\");\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(10);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckEmptyCiphersAndMacs() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         \"\",\n                         \"\");\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(9);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testCheckNullCiphersAndMacs() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         null,\n                         null);\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(9);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    @Test\n    public void testWithWrongCiphersAndMacs() throws Exception {\n        final GitSSHService sshService = new GitSSHService();\n        final File certDir = createTempDirectory();\n\n        String idleTimeout = \"10000\";\n        String ciphers = \"aes126-cbc,aes124-ctr,aes192-cbc,aes192-ctr,aes255-cbc,aes256-ctr,arcfour128,arcfour256,blowfish-cbc,3des-cbc\";\n        sshService.setup(certDir,\n                         null,\n                         idleTimeout,\n                         \"RSA\",\n                         mock(ReceivePackFactory.class),\n                         mock(UploadPackFactory.class),\n                         mock(JGitFileSystemProvider.RepositoryResolverImpl.class),\n                         executorService,\n                         ciphers,\n                         \"\");\n\n        sshService.start();\n        assertTrue(sshService.isRunning());\n\n        List<String> ciphersReaded = sshService.getSshServer().getCipherFactoriesNames();\n        List<String> macsReaded = sshService.getSshServer().getMacFactoriesNames();\n\n        assertThat(ciphersReaded).hasSize(7);\n        checkCiphersName(ciphersReaded);\n\n        assertThat(macsReaded).hasSize(6);\n        checkMacsName(macsReaded);\n\n        assertThat(sshService.getSshServer().getProperties().get(CoreModuleProperties.IDLE_TIMEOUT.getName())).isEqualTo(idleTimeout);\n\n        sshService.stop();\n\n        assertFalse(sshService.isRunning());\n    }\n\n    private void checkCiphersName(List<String> ciphersReaded){\n        for(String cipher : ciphersReaded){\n            assertThat(BuiltinCiphers.fromFactoryName(cipher)).isNotNull();\n        }\n    }\n\n    private void checkMacsName(List<String> macsReaded){\n        for(String mac : macsReaded){\n            assertThat(BuiltinMacs.fromFactoryName(mac)).isNotNull();\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/manager/JGitFileSystemsCacheTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.io.IOException;\nimport java.util.Arrays;\nimport java.util.concurrent.TimeUnit;\nimport java.util.function.Supplier;\n\nimport org.eclipse.jgit.api.errors.GitAPIException;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.fs.jgit.AbstractTestInfra;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProxy;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFileSystemsCacheTest extends AbstractTestInfra {\n\n    JGitFileSystemsCache cache;\n    private JGitFileSystemProviderConfiguration config;\n\n    @Before\n    public void setup() {\n        config = mock(JGitFileSystemProviderConfiguration.class);\n    }\n\n    @Test\n    public void addAndGetTest() {\n        when(config.getJgitFileSystemsInstancesCache()).thenReturn(2);\n        cache = new JGitFileSystemsCache(config);\n\n        assertTrue(cache.fileSystemsSuppliers.isEmpty());\n        assertTrue(cache.memoizedSuppliers.isEmpty());\n\n        assertEquals(null,\n                     cache.get(\"fs1\"));\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs1Supplier = () -> fs1;\n        cache.addSupplier(\"fs1\",\n                          fs1Supplier);\n\n        assertFalse(cache.fileSystemsSuppliers.isEmpty());\n        assertFalse(cache.memoizedSuppliers.isEmpty());\n\n        JGitFileSystemProxy fs1Proxy = (JGitFileSystemProxy) cache.get(\"fs1\");\n\n        assertEquals(fs1,\n                     fs1Proxy.getRealJGitFileSystem());\n\n        assertTrue(cache.containsKey(\"fs1\"));\n\n        cache.clear();\n\n        assertTrue(cache.fileSystemsSuppliers.isEmpty());\n        assertTrue(cache.memoizedSuppliers.isEmpty());\n    }\n\n    @Test\n    public void addAndReplaceTest() {\n        when(config.getJgitFileSystemsInstancesCache()).thenReturn(2);\n        cache = new JGitFileSystemsCache(config);\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs1Supplier = () -> fs1;\n        cache.addSupplier(\"fs1\",\n                          fs1Supplier);\n\n        assertFalse(cache.fileSystemsSuppliers.isEmpty());\n        assertFalse(cache.memoizedSuppliers.isEmpty());\n\n        JGitFileSystemProxy fs1Proxy = (JGitFileSystemProxy) cache.get(\"fs1\");\n        assertEquals(fs1,\n                     fs1Proxy.getRealJGitFileSystem());\n\n        JGitFileSystem fs2 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs2Supplier = () -> fs2;\n        cache.replaceSupplier(\"fs1\",\n                              fs2Supplier);\n\n        JGitFileSystemProxy fs2Proxy = (JGitFileSystemProxy) cache.get(\"fs1\");\n\n        assertEquals(fs2,\n                     fs2Proxy.getRealJGitFileSystem());\n\n        assertTrue(cache.containsKey(\"fs1\"));\n\n        cache.clear();\n\n        assertTrue(cache.fileSystemsSuppliers.isEmpty());\n        assertTrue(cache.memoizedSuppliers.isEmpty());\n    }\n\n    @Test\n    public void addMoreFSThanCacheSupports() {\n        when(config.getJgitFileSystemsInstancesCache()).thenReturn(2);\n        cache = new JGitFileSystemsCache(config);\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs1Supplier = getSupplierSpy(fs1);\n        cache.addSupplier(\"fs1\",\n                          fs1Supplier);\n\n        assertEquals(1,\n                     cache.fileSystemsSuppliers.size());\n        assertEquals(1,\n                     cache.memoizedSuppliers.size());\n\n        ((JGitFileSystemProxy) cache.get(\"fs1\")).getRealJGitFileSystem();\n\n        JGitFileSystem fs2 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs2Supplier = getSupplierSpy(fs2);\n        cache.addSupplier(\"fs2\",\n                          fs2Supplier);\n        ((JGitFileSystemProxy) cache.get(\"fs2\")).getRealJGitFileSystem();\n\n        assertEquals(2,\n                     cache.fileSystemsSuppliers.size());\n        assertEquals(2,\n                     cache.memoizedSuppliers.size());\n\n        JGitFileSystem fs3 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs3Supplier = getSupplierSpy(fs3);\n        cache.addSupplier(\"fs3\",\n                          fs3Supplier);\n\n        ((JGitFileSystemProxy) cache.get(\"fs3\")).getRealJGitFileSystem();\n\n        assertEquals(3,\n                     cache.fileSystemsSuppliers.size());\n        assertEquals(2,\n                     cache.memoizedSuppliers.size());\n\n        ((JGitFileSystemProxy) cache.get(\"fs2\")).getRealJGitFileSystem();\n\n        //just one call because is on memoized cache\n        verify(fs2Supplier,\n               times(1)).get();\n\n        ((JGitFileSystemProxy) cache.get(\"fs3\")).getRealJGitFileSystem();\n\n        //just one call because is on memoized cache\n        verify(fs3Supplier,\n               times(1)).get();\n\n        ((JGitFileSystemProxy) cache.get(\"fs1\")).getRealJGitFileSystem();\n\n        // two calls because is on no longer on memoized cache (oldest instance) needs to regenerate\n        // from fs supplier\n        verify(fs1Supplier,\n               times(2)).get();\n    }\n\n    @Test\n    public void cacheIsOrderedByTheAccessOrder() {\n\n        JGitFileSystemProviderConfiguration config = setupConfigMock();\n\n        setupCacheToTestOrder(config, \"fs1\", \"fs2\", \"fs3\");\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs1\"));\n\n        setupCacheToTestOrder(config, \"fs1\", \"fs2\", \"fs3\");\n        cache.get(\"fs1\");\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs2\"));\n\n        setupCacheToTestOrder(config, \"fs1\", \"fs2\", \"fs3\");\n        cache.get(\"fs1\");\n        cache.get(\"fs2\");\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs3\"));\n\n        cache.get(\"fs1\");\n        cache.get(\"fs2\");\n        cache.get(\"fs3\");\n        setupCacheToTestOrder(config, \"fs1\", \"fs2\", \"fs3\");\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs1\"));\n    }\n\n    @Test\n    public void removeEldestEntryTest() {\n\n        JGitFileSystemProviderConfiguration config = setupConfigMock();\n\n        //no fs is on use\n        setupCacheToTestOrder(config, \"fs1\", \"fs2\", \"fs3\");\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs1\"));\n\n        //fs1 is on use\n        cache = new JGitFileSystemsCache(config);\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        when(fs1.hasBeenInUse()).thenReturn(true);\n        Supplier<JGitFileSystem> fsSupplier1 = getSupplierSpy(fs1);\n        cache.addSupplier(\"fs1\",\n                          fsSupplier1);\n\n        JGitFileSystem fs2 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fsSupplier2 = getSupplierSpy(fs2);\n        when(fs2.hasBeenInUse()).thenReturn(false);\n        cache.addSupplier(\"fs2\",\n                          fsSupplier2);\n\n        JGitFileSystem fs3 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fsSupplier = getSupplierSpy(fs3);\n        cache.addSupplier(\"fs3\",\n                          fsSupplier);\n\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs1\"));\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs3\"));\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs2\"));\n    }\n\n    @Test\n    public void removeEldestEntryTestAllOpen() {\n\n        JGitFileSystemProviderConfiguration config = setupConfigMock();\n\n        cache = new JGitFileSystemsCache(config);\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        when(fs1.hasBeenInUse()).thenReturn(true);\n        Supplier<JGitFileSystem> fsSupplier1 = getSupplierSpy(fs1);\n        cache.addSupplier(\"fs1\",\n                          fsSupplier1);\n\n        JGitFileSystem fs2 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs2Supplier = getSupplierSpy(fs2);\n        when(fs2.hasBeenInUse()).thenReturn(true);\n        cache.addSupplier(\"fs2\",\n                          fs2Supplier);\n\n        JGitFileSystem fs3 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs3Supplier = getSupplierSpy(fs3);\n        when(fs3.hasBeenInUse()).thenReturn(true);\n        cache.addSupplier(\"fs3\",\n                          fs3Supplier);\n\n        JGitFileSystem fs4 = mock(JGitFileSystem.class);\n        cache.addSupplier(\"fs4\",\n                          fs3Supplier);\n\n        //> cache because all fs are in use\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs1\"));\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs3\"));\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs2\"));\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs4\"));\n\n        when(fs1.hasBeenInUse()).thenReturn(false);\n        when(fs2.hasBeenInUse()).thenReturn(false);\n\n        JGitFileSystem fs5 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs5Supplier = getSupplierSpy(fs5);\n        when(fs5.hasBeenInUse()).thenReturn(true);\n        cache.addSupplier(\"fs5\",\n                          fs5Supplier);\n\n        //fs5 is in use and also fs4\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs3\"));\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs5\"));\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs1\"));\n        assertFalse(cache.memoizedSuppliers.containsKey(\"fs2\"));\n    }\n\n    @Test\n    public void fsInUseAreAlwaysOnTheCache() throws IOException, GitAPIException {\n\n        JGitFileSystemProviderConfiguration config = new JGitFileSystemProviderConfiguration() {\n            @Override\n            public int getJgitFileSystemsInstancesCache() {\n                return 2;\n            }\n        };\n\n        cache = new JGitFileSystemsCache(config);\n\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n\n        final Git git = setupGit();\n\n        final JGitFileSystemImpl fs1 = new JGitFileSystemImpl(fsProvider,\n                                                              null,\n                                                              git,\n                                                              new JGitFileSystemLock(git,\n                                                                                     TimeUnit.MILLISECONDS,\n                                                                                     config.getJgitCacheEvictThresholdDuration()),\n                                                              \"fs1\",\n                                                              CredentialsProvider.getDefault(),\n                                                              null,\n                                                              null);\n\n        Supplier<JGitFileSystem> fs1Supplier = getSupplierSpy(fs1);\n        cache.addSupplier(\"fs1\",\n                          fs1Supplier);\n\n        fs1.lock();\n        fs1.lock();\n        fs1.unlock();\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs1\"));\n\n        JGitFileSystem fs2 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs2Supplier = getSupplierSpy(fs2);\n        cache.addSupplier(\"fs2\",\n                          fs2Supplier);\n\n        JGitFileSystem fs3 = mock(JGitFileSystem.class);\n        Supplier<JGitFileSystem> fs3Supplier = getSupplierSpy(fs3);\n        cache.addSupplier(\"fs5\",\n                          fs3Supplier);\n\n        assertTrue(cache.memoizedSuppliers.containsKey(\"fs1\"));\n    }\n\n    private void setupCacheToTestOrder(JGitFileSystemProviderConfiguration config, String... fsNames) {\n        cache = new JGitFileSystemsCache(config);\n\n        Arrays.stream(fsNames).forEach(fsName -> {\n            JGitFileSystem fs = mock(JGitFileSystem.class);\n            Supplier<JGitFileSystem> fsSupplier = getSupplierSpy(fs);\n            cache.addSupplier(fsName,\n                              fsSupplier);\n        });\n    }\n\n    private Supplier<JGitFileSystem> getSupplierSpy(final JGitFileSystem fs1) {\n        return spy(new Supplier<JGitFileSystem>() {\n            @Override\n            public JGitFileSystem get() {\n                return fs1;\n            }\n        });\n    }\n\n    private JGitFileSystemProviderConfiguration setupConfigMock() {\n        return new JGitFileSystemProviderConfiguration() {\n            @Override\n            public int getJgitFileSystemsInstancesCache() {\n                return 2;\n            }\n\n            @Override\n            public int getJgitRemoveEldestEntryIterations() {\n                return 10;\n            }\n\n            @Override\n            public int getJgitCacheOverflowCleanupSize() {\n                return 10;\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/manager/JGitFileSystemsManagerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.eclipse.jgit.transport.CredentialsProvider;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.kie.soup.commons.util.Maps;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemImpl;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProviderConfiguration;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitFileSystemsEventsManager;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFileSystemsManagerTest {\n\n    private Git git;\n    private JGitFileSystemProviderConfiguration config;\n\n    private JGitFileSystemsManager manager;\n\n    @Before\n    public void setup() {\n        config = mock(JGitFileSystemProviderConfiguration.class);\n        git = mock(Git.class);\n        when(git.getRepository()).thenReturn(mock(Repository.class));\n    }\n\n    @Test\n    public void newFSTest() {\n        JGitFileSystem fs = mock(JGitFileSystem.class);\n        when(fs.getName()).thenReturn(\"fs\");\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        when(fs1.getName()).thenReturn(\"fs1\");\n\n        manager = createFSManager();\n\n        manager.newFileSystem(() -> new HashMap<>(),\n                              () -> git,\n                              () -> fs.getName(),\n                              () -> mock(CredentialsProvider.class),\n                              () -> mock(JGitFileSystemsEventsManager.class),\n                              () -> null);\n\n        manager.newFileSystem(() -> new HashMap<>(),\n                              () -> git,\n                              () -> fs1.getName(),\n                              () -> mock(CredentialsProvider.class),\n                              () -> mock(JGitFileSystemsEventsManager.class),\n                              () -> null);\n\n        assertTrue(manager.containsKey(\"fs\"));\n\n        manager.addClosedFileSystems(fs);\n\n        assertTrue(!manager.allTheFSAreClosed());\n\n        manager.clear();\n\n        assertTrue(manager.allTheFSAreClosed());\n    }\n\n    @Test\n    public void parseFSTest() {\n        manager = new JGitFileSystemsManager(mock(JGitFileSystemProvider.class),\n                                             config);\n\n        checkParse(\"a\",\n                   Arrays.asList(\"a\"));\n\n        checkParse(\"/a\",\n                   Arrays.asList(\"a\"));\n\n        checkParse(\"/a/\",\n                   Arrays.asList(\"a\"));\n\n        checkParse(\"a/b/\",\n                   Arrays.asList(\"a\",\n                                 \"a/b\"));\n\n        checkParse(\"/a/b/\",\n                   Arrays.asList(\"a\",\n                                 \"a/b\"));\n\n        checkParse(\"a/b/c\",\n                   Arrays.asList(\"a\",\n                                 \"a/b\",\n                                 \"a/b/c\"));\n\n        checkParse(\"a/b/c/d\",\n                   Arrays.asList(\"a\",\n                                 \"a/b\",\n                                 \"a/b/c\",\n                                 \"a/b/c/d\"));\n    }\n\n    @Test\n    public void removeFSTest() {\n        JGitFileSystem fs = mock(JGitFileSystem.class);\n        when(fs.getName()).thenReturn(\"fs\");\n\n        JGitFileSystem fs1 = mock(JGitFileSystem.class);\n        when(fs1.getName()).thenReturn(\"fs1\");\n\n        manager = createFSManager();\n\n        manager.newFileSystem(() -> new HashMap<>(),\n                              () -> git,\n                              () -> fs.getName(),\n                              () -> mock(CredentialsProvider.class),\n                              () -> mock(JGitFileSystemsEventsManager.class),\n                              () -> null);\n\n        manager.newFileSystem(() -> new HashMap<>(),\n                              () -> git,\n                              () -> fs1.getName(),\n                              () -> mock(CredentialsProvider.class),\n                              () -> mock(JGitFileSystemsEventsManager.class),\n                              () -> null);\n\n        assertTrue(manager.containsKey(\"fs1\"));\n        assertTrue(manager.containsRoot(\"fs1\"));\n        manager.addClosedFileSystems(fs1);\n        assertTrue(manager.getClosedFileSystems().contains(\"fs1\"));\n\n        manager.remove(\"fs1\");\n        assertFalse(manager.containsKey(\"fs1\"));\n        assertFalse(manager.containsRoot(\"fs1\"));\n        assertFalse(manager.containsRoot(\"fs1\"));\n    }\n\n    @Test\n    public void updateFSCacheEntryTest() {\n        final JGitFileSystemProvider fsProvider = mock(JGitFileSystemProvider.class);\n        JGitFileSystem fs = mock(JGitFileSystem.class);\n\n        when(fs.getName()).thenReturn(\"fs\");\n\n        manager = createFSManager();\n\n        manager.newFileSystem(() -> new HashMap<>(),\n                              () -> git,\n                              () -> fs.getName(),\n                              () -> mock(CredentialsProvider.class),\n                              () -> mock(JGitFileSystemsEventsManager.class),\n                              () -> null);\n\n        assertTrue(manager.containsKey(\"fs\"));\n        assertTrue(manager.containsRoot(\"fs\"));\n\n        assertThat(manager.get(\"fs\").toString()).isEqualTo(\"git://fs\");\n\n        final JGitFileSystemImpl newFileSystem = new JGitFileSystemImpl(fsProvider,\n                                                                        new Maps.Builder<String, String>()\n                                                                                .put(\"ssh\", \"localhost\")\n                                                                                .build(),\n                                                                        git,\n                                                                        manager.createLock(git),\n                                                                        fs.getName(),\n                                                                        mock(CredentialsProvider.class),\n                                                                        null,\n                                                                        null);\n\n        manager.updateFSCacheEntry(\"fs\", newFileSystem);\n\n        assertThat(manager.get(\"fs\").toString()).isEqualTo(\"ssh://localhost/fs\");\n        assertTrue(manager.containsKey(\"fs\"));\n        assertTrue(manager.containsRoot(\"fs\"));\n    }\n\n    private void checkParse(String fsKey,\n                            List<String> expected) {\n        List<String> actual = manager.parseFSRoots(fsKey);\n        assertEquals(actual.size(),\n                     expected.size());\n        for (String root : expected) {\n            if (!actual.contains(root)) {\n                throw new RuntimeException();\n            }\n        }\n        manager.clear();\n    }\n\n    private JGitFileSystemsManager createFSManager() {\n        return new JGitFileSystemsManager(mock(JGitFileSystemProvider.class),\n                                          config) {\n            @Override\n            JGitFileSystemLock createLock(Git git) {\n                return mock(JGitFileSystemLock.class);\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/manager/MemoizedFileSystemsSupplierTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.manager;\n\nimport java.util.function.Supplier;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class MemoizedFileSystemsSupplierTest {\n\n    public static int instanceCount = 0;\n\n    @Test\n    public void supplierTest() {\n\n        getSupplier().get();\n        getSupplier().get();\n        assertEquals(2,\n                     instanceCount);\n\n        instanceCount = 0;\n        final Supplier<DummyObject> supplier = getLazySupplier();\n        supplier.get();\n        supplier.get();\n        supplier.get();\n        supplier.get();\n        assertEquals(1,\n                     instanceCount);\n    }\n\n    Supplier<DummyObject> getLazySupplier() {\n        return MemoizedFileSystemsSupplier.of(getSupplier());\n    }\n\n    Supplier<DummyObject> getSupplier() {\n        return () -> new DummyObject();\n    }\n\n    private class DummyObject {\n\n        public DummyObject() {\n            test();\n            instanceCount++;\n        }\n\n        public void test() {\n            System.out.println(\"new Instance\");\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/util/ConcurrentJGitUtilTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.Date;\nimport java.util.HashMap;\n\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.jboss.byteman.contrib.bmunit.BMScript;\nimport org.jboss.byteman.contrib.bmunit.BMUnitConfig;\nimport org.jboss.byteman.contrib.bmunit.BMUnitRunner;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.fs.jgit.AbstractTestInfra;\nimport org.uberfire.java.nio.fs.jgit.util.commands.Commit;\nimport org.uberfire.java.nio.fs.jgit.util.commands.CreateRepository;\n\nimport static org.junit.Assert.*;\n\n@RunWith(BMUnitRunner.class)\n@BMUnitConfig(loadDirectory = \"target/test-classes\", debug = true) // set \"debug=true to see debug output\npublic class ConcurrentJGitUtilTest extends AbstractTestInfra {\n\n    @BeforeClass\n    public static void setup() {\n        GitImpl.setRetryTimes(5);\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/resolve_path.btm\")\n    public void testRetryResolvePath() throws IOException {\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        try {\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file1.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file1.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file1.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file1.txt\"));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            git.getPathInfo(\"main\",\n                            \"path/to/file1.txt\");\n            fail(\"forced to fail!\");\n        } catch (RuntimeException ex) {\n        }\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/resolve_inputstream.btm\")\n    public void testRetryResolveInputStream() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        try {\n            assertNotNull(git.blobAsInputStream(\"main\",\n                                                \"path/to/file1.txt\"));\n            assertNotNull(git.blobAsInputStream(\"main\",\n                                                \"path/to/file1.txt\"));\n            assertNotNull(git.blobAsInputStream(\"main\",\n                                                \"path/to/file1.txt\"));\n            assertNotNull(git.blobAsInputStream(\"main\",\n                                                \"path/to/file1.txt\"));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            assertNotNull(git.blobAsInputStream(\"main\",\n                                                \"path/to/file1.txt\"));\n            fail(\"forced to fail!\");\n        } catch (NoSuchFileException ex) {\n        }\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/list_path_content.btm\")\n    public void testRetryListPathContent() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        try {\n            assertNotNull(git.listPathContent(\"main\",\n                                              \"path/to/\"));\n            assertNotNull(git.listPathContent(\"main\",\n                                              \"path/to/\"));\n            assertNotNull(git.listPathContent(\"main\",\n                                              \"path/to/\"));\n            assertNotNull(git.listPathContent(\"main\",\n                                              \"path/to/\"));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            assertNotNull(git.listPathContent(\"main\",\n                                              \"path/to/\"));\n            fail(\"forced to fail!\");\n        } catch (RuntimeException ex) {\n        }\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/check_path.btm\")\n    public void testRetryCheckPath() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        try {\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file2.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file2.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file2.txt\"));\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file2.txt\"));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            assertNotNull(git.getPathInfo(\"main\",\n                                          \"path/to/file2.txt\"));\n            fail(\"forced to fail!\");\n        } catch (RuntimeException ex) {\n        }\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/get_last_commit.btm\")\n    public void testRetryGetLastCommit() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        try {\n            assertNotNull(git.getLastCommit(\"main\"));\n            assertNotNull(git.getLastCommit(\"main\"));\n            assertNotNull(git.getLastCommit(\"main\"));\n            assertNotNull(git.getLastCommit(\"main\"));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            assertNotNull(git.getLastCommit(\"main\"));\n            fail(\"forced to fail!\");\n        } catch (RuntimeException ex) {\n        }\n    }\n\n    @Test\n    @BMScript(value = \"byteman/retry/get_commits.btm\")\n    public void testRetryGetCommits() throws IOException {\n\n        final File parentFolder = createTempDirectory();\n        final File gitFolder = new File(parentFolder,\n                                        \"mytest.git\");\n\n        final Git git = new CreateRepository(gitFolder).execute().get();\n\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"1st commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file1.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n        new Commit(git,\n                   \"main\",\n                   \"name\",\n                   \"name@example.com\",\n                   \"2nd commit\",\n                   null,\n                   new Date(),\n                   false,\n                   new HashMap<String, File>() {{\n                       put(\"path/to/file2.txt\",\n                           tempFile(\"temp2222\"));\n                   }}).execute();\n\n        final RevCommit commit = git.getLastCommit(\"main\");\n        try {\n            assertNotNull(git.listCommits(null,\n                                          commit));\n            assertNotNull(git.listCommits(null,\n                                          commit));\n            assertNotNull(git.listCommits(null,\n                                          commit));\n        } catch (Exception ex) {\n            fail();\n        }\n\n        try {\n            assertNotNull(git.listCommits(null,\n                                          commit));\n            fail(\"forced to fail!\");\n        } catch (RuntimeException ex) {\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/util/commands/SyncRemoteTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.commands;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.eclipse.jgit.lib.Ref;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.fs.jgit.util.GitImpl;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\n\npublic class SyncRemoteTest {\n\n    private SyncRemote syncRemote;\n\n    @Before\n    public void setup() {\n        syncRemote = new SyncRemote(mock(GitImpl.class), new Pair<>(\"upstream\", \"b\"));\n    }\n\n    @Test\n    public void fillBranchesTest() {\n        final List<Ref> branches = Arrays.asList(createBranch(\"refs/heads/local/branch1\"),\n                                                 createBranch(\"refs/heads/localBranch2\"),\n                                                 createBranch(\"refs/remotes/upstream/remote/branch1\"),\n                                                 createBranch(\"refs/remotes/upstream/remoteBranch2\"));\n\n        final List<String> remoteBranches = new ArrayList<>();\n        final List<String> localBranches = new ArrayList<>();\n\n        syncRemote.fillBranches(branches, remoteBranches, localBranches);\n\n        assertEquals(2, remoteBranches.size());\n        assertEquals(\"remote/branch1\", remoteBranches.get(0));\n        assertEquals(\"remoteBranch2\", remoteBranches.get(1));\n\n        assertEquals(2, localBranches.size());\n        assertEquals(\"local/branch1\", localBranches.get(0));\n        assertEquals(\"localBranch2\", localBranches.get(1));\n    }\n\n    private Ref createBranch(String branchName) {\n        final Ref branch = mock(Ref.class);\n        doReturn(branchName).when(branch).getName();\n\n        return branch;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/util/extensions/JGitFSHooksTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.jgit.util.extensions;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooksConstants;\n\nimport java.util.Arrays;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFSHooksTest {\n\n    private static final String FS_NAME = \"dora\";\n    private static final Integer EXIT_CODE = 0;\n\n    @Captor\n    private ArgumentCaptor<FileSystemHookExecutionContext> contextArgumentCaptor;\n\n    @Test\n    public void executeFSHooksTest() {\n\n        FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(FS_NAME);\n\n        testExecuteFSHooks(ctx, FileSystemHooks.ExternalUpdate);\n\n        ctx.addParam(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE, EXIT_CODE);\n\n        testExecuteFSHooks(ctx, FileSystemHooks.PostCommit);\n    }\n\n    private void testExecuteFSHooks(FileSystemHookExecutionContext ctx, FileSystemHooks hookType) {\n        AtomicBoolean executedWithLambda = new AtomicBoolean(false);\n\n        FileSystemHooks.FileSystemHook hook = spy(new FileSystemHooks.FileSystemHook() {\n            @Override\n            public void execute(FileSystemHookExecutionContext context) {\n                assertEquals(FS_NAME, context.getFsName());\n            }\n        });\n\n        FileSystemHooks.FileSystemHook lambdaHook = context -> {\n            assertEquals(FS_NAME, context.getFsName());\n            executedWithLambda.set(true);\n        };\n\n        JGitFSHooks.executeFSHooks(hook, hookType, ctx);\n        JGitFSHooks.executeFSHooks(lambdaHook, hookType, ctx);\n\n        verifyFSHook(hook, hookType);\n\n        assertTrue(executedWithLambda.get());\n    }\n\n    @Test\n    public void executeFSHooksArrayTest() {\n\n        FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(FS_NAME);\n\n        testExecuteFSHooksArray(ctx, FileSystemHooks.ExternalUpdate);\n\n        ctx.addParam(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE, EXIT_CODE);\n\n        testExecuteFSHooksArray(ctx, FileSystemHooks.PostCommit);\n    }\n\n    private void testExecuteFSHooksArray(FileSystemHookExecutionContext ctx, FileSystemHooks hookType) {\n\n        AtomicBoolean executedWithLambda = new AtomicBoolean(false);\n\n        FileSystemHooks.FileSystemHook hook = spy(new FileSystemHooks.FileSystemHook() {\n            @Override\n            public void execute(FileSystemHookExecutionContext context) {\n                assertEquals(FS_NAME, context.getFsName());\n            }\n        });\n\n        FileSystemHooks.FileSystemHook lambdaHook = context -> {\n            assertEquals(FS_NAME, context.getFsName());\n            executedWithLambda.set(true);\n        };\n\n        JGitFSHooks.executeFSHooks(Arrays.asList(hook, lambdaHook), hookType, ctx);\n\n        verifyFSHook(hook, hookType);\n\n        assertTrue(executedWithLambda.get());\n    }\n\n    private void verifyFSHook(FileSystemHooks.FileSystemHook hook, FileSystemHooks hookType) {\n        verify(hook).execute(contextArgumentCaptor.capture());\n\n        FileSystemHookExecutionContext ctx = contextArgumentCaptor.getValue();\n\n        Assertions.assertThat(ctx)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"fsName\", FS_NAME);\n\n        if (hookType.equals(FileSystemHooks.PostCommit)) {\n            Assertions.assertThat(ctx.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE))\n                    .isNotNull()\n                    .isEqualTo(EXIT_CODE);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/java/org/uberfire/java/nio/fs/jgit/ws/JGitFileSystemsEventsManagerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.fs.jgit.ws;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.commons.cluster.ClusterJMSService;\nimport org.uberfire.commons.cluster.ClusterParameters;\nimport org.uberfire.commons.cluster.ClusterService;\nimport org.uberfire.commons.cluster.ConnectionMode;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.fs.jgit.ws.cluster.JGitEventsBroadcast;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.commons.cluster.ClusterParameters.APPFORMER_JMS_CONNECTION_MODE;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JGitFileSystemsEventsManagerTest {\n\n    JGitFileSystemsEventsManager manager;\n    JGitEventsBroadcast jGitEventsBroadcastMock = mock(JGitEventsBroadcast.class);\n\n    @Before\n    public void setup() {\n        setupClusterParameters();\n        manager = new JGitFileSystemsEventsManager() {\n            @Override\n            void setupJGitEventsBroadcast() {\n                jGitEventsBroadcast = jGitEventsBroadcastMock;\n            }\n\n            @Override\n            JGitFileSystemWatchServices createFSWatchServicesManager() {\n                return mock(JGitFileSystemWatchServices.class);\n            }\n        };\n    }\n\n    @AfterClass\n    public static void clearProperty() {\n        System.setProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE,\n                           ConnectionMode.NONE.toString());\n    }\n\n    @Test\n    public void doNotSetupClusterTest() {\n        JGitFileSystemsEventsManager another = new JGitFileSystemsEventsManager() {\n\n            @Override\n            ClusterService createClusterJMSService() {\n                return mock(ClusterJMSService.class);\n            }\n        };\n        assertNull(another.getjGitEventsBroadcast());\n    }\n\n    @Test\n    public void setupClusterTest() {\n        assertNotNull(manager.getjGitEventsBroadcast());\n    }\n\n    @Test\n    public void createWatchService() {\n        manager = new JGitFileSystemsEventsManager() {\n            @Override\n            void setupJGitEventsBroadcast() {\n                jGitEventsBroadcast = jGitEventsBroadcastMock;\n            }\n        };\n\n        WatchService fs = manager.newWatchService(\"fs\");\n\n        assertNotNull(fs);\n        assertTrue(manager.getFsWatchServices().containsKey(\"fs\"));\n        verify(jGitEventsBroadcastMock).createWatchServiceJMS(\"fs\");\n    }\n\n    @Test\n    public void shouldNotPublishEventsForANotWatchedFS() {\n        WatchService fsDora = manager.newWatchService(\"fsDora\");\n        WatchService fsBento = manager.newWatchService(\"fsBento\");\n\n        List<WatchEvent<?>> elist = Arrays.asList(mock(WatchEvent.class),\n                                                  mock(WatchEvent.class));\n\n        manager.publishEvents(\"another\",\n                              mock(Path.class),\n                              elist);\n\n        verify(jGitEventsBroadcastMock,\n               never()).broadcast(any(),\n                                  any(),\n                                  any());\n    }\n\n    @Test\n    public void publishEventsShouldBeWatched() {\n        WatchService fsDoraWS = manager.newWatchService(\"fsDora\");\n        WatchService fsBento = manager.newWatchService(\"fsBento\");\n\n        JGitFileSystemWatchServices fsDoraWServices = manager.getFsWatchServices().get(\"fsDora\");\n        JGitFileSystemWatchServices fsBentoWServices = manager.getFsWatchServices().get(\"fsBento\");\n\n        List<WatchEvent<?>> elist = Arrays.asList(mock(WatchEvent.class),\n                                                  mock(WatchEvent.class));\n\n        manager.publishEvents(\"fsDora\",\n                              mock(Path.class),\n                              elist);\n\n        verify(fsDoraWServices).publishEvents(any(),\n                                              eq(elist));\n        verify(jGitEventsBroadcastMock).broadcast(eq(\"fsDora\"),\n                                                  any(),\n                                                  eq(elist));\n        verify(fsBentoWServices,\n               never()).publishEvents(any(),\n                                      eq(elist));\n    }\n\n    @Test\n    public void publishEventsWithoutBroadcast() {\n        manager.newWatchService(\"fsDora\");\n        manager.newWatchService(\"fsBento\");\n\n        JGitFileSystemWatchServices fsDoraWServices = manager.getFsWatchServices().get(\"fsDora\");\n        JGitFileSystemWatchServices fsBentoWServices = manager.getFsWatchServices().get(\"fsBento\");\n\n        List<WatchEvent<?>> elist = Arrays.asList(mock(WatchEvent.class),\n                                                  mock(WatchEvent.class));\n\n        manager.publishEvents(\"fsDora\",\n                              mock(Path.class),\n                              elist,\n                              false);\n\n        verify(fsDoraWServices).publishEvents(any(),\n                                              eq(elist));\n        verify(jGitEventsBroadcastMock,\n               never()).broadcast(eq(\"fsDora\"),\n                                  any(),\n                                  eq(elist));\n        verify(fsBentoWServices,\n               never()).publishEvents(any(),\n                                      eq(elist));\n    }\n\n    @Test\n    public void watchServicesEvents() {\n\n        manager = new JGitFileSystemsEventsManager() {\n            @Override\n            void setupJGitEventsBroadcast() {\n                jGitEventsBroadcast = jGitEventsBroadcastMock;\n            }\n        };\n\n        WatchService fsDora1 = manager.newWatchService(\"fsDora\");\n        WatchService fsDora2 = manager.newWatchService(\"fsDora\");\n\n        List<WatchEvent<?>> list3events = Arrays.asList(mock(WatchEvent.class),\n                                                        mock(WatchEvent.class),\n                                                        mock(WatchEvent.class));\n\n        List<WatchEvent<?>> list2events = Arrays.asList(mock(WatchEvent.class),\n                                                        mock(WatchEvent.class));\n\n        manager.publishEvents(\"fsDora\",\n                              mock(Path.class),\n                              list3events,\n                              false);\n\n        List<WatchEvent<?>> watchEvents = fsDora1.poll().pollEvents();\n        assertEquals(3,\n                     watchEvents.size());\n        watchEvents = fsDora2.poll().pollEvents();\n        assertEquals(3,\n                     watchEvents.size());\n\n        manager.publishEvents(\"fsDora\",\n                              mock(Path.class),\n                              list3events,\n                              false);\n        manager.publishEvents(\"fsDora\",\n                              mock(Path.class),\n                              list2events,\n                              false);\n\n        watchEvents = fsDora2.poll().pollEvents();\n        assertEquals(3,\n                     watchEvents.size());\n\n        watchEvents = fsDora2.poll().pollEvents();\n        assertEquals(2,\n                     watchEvents.size());\n\n        watchEvents = fsDora1.poll().pollEvents();\n        assertEquals(3,\n                     watchEvents.size());\n\n        watchEvents = fsDora1.poll().pollEvents();\n        assertEquals(2,\n                     watchEvents.size());\n    }\n\n    @Test\n    public void closeTest() {\n        manager.newWatchService(\"fsDora\");\n        manager.newWatchService(\"fsBento\");\n\n        JGitFileSystemWatchServices fsDoraWServices = manager.getFsWatchServices().get(\"fsDora\");\n        JGitFileSystemWatchServices fsBentoWServices = manager.getFsWatchServices().get(\"fsBento\");\n\n        manager.close(\"fsDora\");\n\n        verify(fsDoraWServices).close();\n        verify(fsBentoWServices,\n               never()).close();\n    }\n\n    @Test\n    public void testShutdown() {\n        manager.newWatchService(\"fsPetra\");\n        manager.newWatchService(\"fsEureka\");\n\n        JGitFileSystemWatchServices fsPetraWatchService = manager.getFsWatchServices().get(\"fsPetra\");\n        JGitFileSystemWatchServices fsEurekaWatchService = manager.getFsWatchServices().get(\"fsEureka\");\n\n        manager.shutdown();\n\n        verify(fsPetraWatchService).close();\n        verify(fsEurekaWatchService).close();\n        verify(jGitEventsBroadcastMock).close();\n    }\n\n    private void setupClusterParameters() {\n        System.setProperty(ClusterParameters.APPFORMER_JMS_CONNECTION_MODE,\n                           ConnectionMode.REMOTE.toString());\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "org.uberfire.java.nio.fs.file.SimpleFileSystemProvider"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/commit_exception.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil.commit()\n#\n\nRULE exception on commit\nCLASS org.eclipse.jgit.lib.RefUpdate\nMETHOD forceUpdate\nAT ENTRY\nIF TRUE\nDO\n   throw RuntimeException(\"dummy\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/check_path.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryCheckPath\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryCheckPath\");\nENDRULE\n\nRULE catch counter testRetryCheckPath\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT EXIT\nIF readCounter(\"testRetryCheckPath\") > 4\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/get_commits.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryGetCommits\nCLASS org.eclipse.jgit.revwalk.RevWalk\nMETHOD markStart(org.eclipse.jgit.revwalk.RevCommit)\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryGetCommits\");\nENDRULE\n\nRULE catch counter testRetryGetCommits\nCLASS org.eclipse.jgit.revwalk.RevWalk\nMETHOD markStart(org.eclipse.jgit.revwalk.RevCommit)\nAT EXIT\nIF readCounter(\"testRetryGetCommits\") > 3\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/get_last_commit.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryGetLastCommit\nCLASS org.eclipse.jgit.revwalk.RevCommit\nMETHOD parse(byte[])\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryGetLastCommit\");\nENDRULE\n\nRULE catch counter testRetryGetLastCommit\nCLASS org.eclipse.jgit.revwalk.RevCommit\nMETHOD parse(byte[])\nAT EXIT\nIF readCounter(\"testRetryGetLastCommit\") >  8 #each commit executes the RevCommit.parse too\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/list_path_content.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryListPathContent\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryListPathContent\");\nENDRULE\n\nRULE catch counter testRetryListPathContent\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT EXIT\nIF readCounter(\"testRetryListPathContent\") > 4\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/resolve_inputstream.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryResolveInputStream\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryResolveInputStream\");\nENDRULE\n\nRULE catch counter testRetryResolveInputStream\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT EXIT\nIF readCounter(\"testRetryResolveInputStream\") > 4\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/retry/resolve_path.btm",
    "content": "#\n#   This Byteman creates an exception on JGitUtil, to simulate random\n#   issue found on Windows. (see RHBPMS-4105)\n#\n\nRULE increment counter testRetryResolvePath\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT ENTRY\nIF TRUE\nDO\n   incrementCounter(\"testRetryResolvePath\");\nENDRULE\n\nRULE catch counter testRetryResolvePath\nCLASS org.eclipse.jgit.treewalk.TreeWalk\nMETHOD reset(org.eclipse.jgit.lib.AnyObjectId)\nAT EXIT\nIF readCounter(\"testRetryResolvePath\") > 4\nDO\n   throw RuntimeException(\"almost random failure\");\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/squash.btm",
    "content": "#\n#   This Byteman script makes both threads to reach locking\n#   state at the same time but then it resolve it.\n#\n#\n\nRULE define rendezvous\nCLASS org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\nMETHOD lockAndSquash\nAT INVOKE org.uberfire.java.nio.file.Path.getFileSystem\nIF NOT isRendezvous(\"squash\", 2)\nDO createRendezvous(\"squash\", 2, true);\n   traceln(\"rendezvous created\");\nENDRULE\n\nRULE catch threads\nCLASS org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\nMETHOD lockAndSquash\nAFTER INVOKE org.uberfire.java.nio.file.Path.getFileSystem\nBIND threadName = Thread.currentThread().getName();\nIF isRendezvous(\"squash\", 2)\nDO rendezvous(\"squash\");\n   rendezvous(\"squash\")\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/squash_exception.btm",
    "content": "#\n# This scripts throws an Exception after invoking LOCK method.\n#\n#\nRULE force exception\nCLASS org.uberfire.java.nio.fs.jgit.util.commands.Squash\nMETHOD execute\nIF TRUE\nDO throw RuntimeException(\"check lock after\")\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/byteman/squash_lock.btm",
    "content": "#\n#   This Byteman script makes both threads to reach locking\n#   state and cannot resolve it, so they remain locked for ever.\n#\n#\n\nRULE define rendezvous\nCLASS org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\nMETHOD lockAndSquash\nAT INVOKE org.uberfire.java.nio.fs.jgit.JGitFileSystem.lock\nIF TRUE\nDO createRendezvous(\"rendezvous\", 2, true);\nENDRULE\n\nRULE catch threads\nCLASS org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\nMETHOD lockAndSquash\nAFTER INVOKE org.uberfire.java.nio.fs.jgit.JGitFileSystem.lock\nIF isRendezvous(\"rendezvous\", 2)\nDO rendezvous(\"rendezvous\");\n   rendezvous(\"rendezvous\")\nENDRULE"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-jgit/src/test/resources/simplelogger.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# logging configuration for slf4j-simple\n\norg.slf4j.simpleLogger.logFile=System.out\n\norg.slf4j.simpleLogger.defaultLogLevel=info\n\n# Some logging categories that may be of interest when troubleshooting:\n#org.slf4j.simpleLogger.log.org.uberfire.io=debug\n#org.slf4j.simpleLogger.log.org.uberfire.java.nio.fs.jgit=debug\norg.slf4j.simpleLogger.log.org.uberfire.java.nio.fs.jgit.util.commands=debug\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-impls</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-k8s</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire NIO.2 :: K8S Impl</name>\n  <description>UberFire NIO.2 :: K8S Impl</description>\n\n  <properties>\n    <!-- Skip integration tests by default, they are enabled in openshift profile as the tests need connection to external OpenShift instance. -->\n    <skipITs>true</skipITs>\n  </properties>\n  \n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n    \n    <!-- fabric8 kubernetes and openshift java client dependencies -->\n    <dependency>\n      <groupId>io.fabric8</groupId>\n      <artifactId>kubernetes-model</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.annotation</groupId>\n          <artifactId>javax.annotation-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>javax.xml.bind</groupId>\n          <artifactId>jaxb-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>io.fabric8</groupId>\n      <artifactId>kubernetes-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.fabric8</groupId>\n      <artifactId>openshift-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>io.fabric8</groupId>\n      <artifactId>kubernetes-server-mock</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>com.sun</groupId>\n          <artifactId>tools</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>io.fabric8</groupId>\n      <artifactId>openshift-server-mock</artifactId>\n      <scope>test</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>com.fasterxml.jackson.module</groupId>\n      <artifactId>jackson-module-jaxb-annotations</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.fasterxml.jackson.core</groupId>\n      <artifactId>jackson-core</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.fasterxml.jackson.core</groupId>\n      <artifactId>jackson-databind</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.fasterxml.jackson.dataformat</groupId>\n      <artifactId>jackson-dataformat-yaml</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.awaitility</groupId>\n      <artifactId>awaitility</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <!-- log -->\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>jul-to-slf4j</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-plugin</artifactId>\n        <configuration>\n          <forkCount>1</forkCount>\n          <reuseForks>false</reuseForks>\n          <environmentVariables>\n            <KUBERNETES_SERVICE_HOST>127.0.0.1</KUBERNETES_SERVICE_HOST>\n            <KUBERNETES_SERVICE_PORT>8443</KUBERNETES_SERVICE_PORT>\n            <KUBERNETES_MASTER />\n            <KUBERNETES_API_VERSION />\n            <KUBERNETES_TRUST_CERTIFICATES />\n            <KUBERNETES_CERTS_CA_FILE />\n            <KUBERNETES_CERTS_CA_DATA />\n            <KUBERNETES_CERTS_CLIENT_FILE />\n            <KUBERNETES_CERTS_CLIENT_DATA />\n            <KUBERNETES_CERTS_CLIENT_KEY_FILE />\n            <KUBERNETES_CERTS_CLIENT_KEY_DATA />\n            <KUBERNETES_CERTS_CLIENT_KEY_ALGO />\n            <KUBERNETES_CERTS_CLIENT_KEY_PASSPHRASE />\n            <KUBERNETES_AUTH_BASIC_USERNAME />\n            <KUBERNETES_AUTH_BASIC_PASSWORD />\n            <KUBERNETES_AUTH_TRYKUBECONFIG />\n            <KUBERNETES_AUTH_TRYSERVICEACCOUNT />\n            <KUBERNETES_AUTH_TOKEN />\n            <KUBERNETES_WATCH_RECONNECTINTERVAL />\n            <KUBERNETES_WATCH_RECONNECTLIMIT />\n            <KUBERNETES_REQUEST_TIMEOUT />\n            <KUBERNETES_NAMESPACE />\n            <KUBERNETES_TLS_VERSIONS>TLSv1.2,TLSv1.1,TLSv1</KUBERNETES_TLS_VERSIONS>\n          </environmentVariables>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n  <profiles>\n    <profile>\n      <id>openshift</id>\n      <properties>\n        <skipITs>false</skipITs>\n      </properties>\n      <build>\n        <plugins>\n          <plugin>\n            <groupId>org.apache.maven.plugins</groupId>\n            <artifactId>maven-failsafe-plugin</artifactId>\n            <configuration>\n              <systemProperties>\n                <!-- Properties for connection to external OpenShift for integration tests. -->\n                <kubernetes.master>${kubernetes.master}</kubernetes.master>\n                <kubernetes.auth.token>${kubernetes.auth.token}</kubernetes.auth.token>\n              </systemProperties>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/cloud/CloudClientConstants.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.java.nio.fs.cloud;\n\nimport java.nio.charset.StandardCharsets;\n\npublic class CloudClientConstants {\n    public static final String DEFAULT_TOKEN_LOCATION = \"/var/run/secrets/kubernetes.io/serviceaccount/token\";\n    public static final String ENV_VAR_API_SERVICE_HOST = \"KUBERNETES_SERVICE_HOST\";\n    public static final String ENV_VAR_API_SERVER_PORT = \"KUBERNETES_SERVICE_PORT\";\n    public static final String ENCODING = System.getProperty(\"file.encoding\", StandardCharsets.UTF_8.name());\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/cloud/CloudClientFactory.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.uberfire.java.nio.fs.cloud;\n\nimport java.nio.file.Files;\nimport java.nio.file.Paths;\nimport java.util.Optional;\nimport java.util.function.Function;\n\nimport io.fabric8.kubernetes.client.Config;\nimport io.fabric8.kubernetes.client.ConfigBuilder;\nimport io.fabric8.kubernetes.client.DefaultKubernetesClient;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.openshift.client.DefaultOpenShiftClient;\nimport io.fabric8.openshift.client.OpenShiftClient;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.IOException;\n\npublic interface CloudClientFactory {\n\n    default OpenShiftClient createOpenShiftClient() {\n        return new DefaultOpenShiftClient(setupConfig());\n    }\n\n    default KubernetesClient createKubernetesClient() {\n        return new DefaultKubernetesClient(setupConfig());\n    }\n\n    default Config setupConfig() {\n        final Logger logger = LoggerFactory.getLogger(CloudClientFactory.class);\n        String mainUrl = System.getProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY);\n        String token = System.getProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY);\n\n        if (mainUrl == null) {\n            mainUrl = new StringBuilder(\"https://\")\n                    .append(System.getenv(CloudClientConstants.ENV_VAR_API_SERVICE_HOST))\n                    .append(\":\")\n                    .append(System.getenv(CloudClientConstants.ENV_VAR_API_SERVER_PORT))\n                    .toString();\n            System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, mainUrl);\n            logger.debug(\"mainUrl: {}\", mainUrl);\n        }\n        \n        if (token == null || token.length() == 0) {\n            try {\n                token = new String(Files.readAllBytes(Paths.get(CloudClientConstants.DEFAULT_TOKEN_LOCATION)));\n            } catch (Exception e) {\n                logger.error(\"Load kubenetes oauth token failed.\", e);\n            }\n            if (token == null) {\n                throw new IllegalStateException(\"Kubenetes oauth token missing\");\n            } else {\n                System.setProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY, token);\n                logger.debug(\"Token: [{}]\", token);\n            }\n        }\n\n        return new ConfigBuilder().withMasterUrl(mainUrl).withOauthToken(token).build();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    default <T extends KubernetesClient, R> Optional<R> executeCloudFunction(Function<T, R> func, Class<T> type) {\n        R result = null;\n        try (T client = (T) (type == OpenShiftClient.class ? createOpenShiftClient() : createKubernetesClient())) {\n            result = func.apply(client);\n        } catch (UnsupportedOperationException uoe) {\n            throw uoe;\n        } catch (IllegalStateException ise) {\n            throw ise;\n        } catch (Exception e) {\n            throw new IOException(e);\n        }\n        return Optional.ofNullable(result);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SBasicFileAttributeView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.FileTimeImpl;\nimport org.uberfire.java.nio.base.LazyAttrLoader;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.fs.cloud.CloudClientFactory;\nimport org.uberfire.java.nio.fs.file.SimpleBasicFileAttributeView;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NO_IMPL;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjCM;\n\npublic class K8SBasicFileAttributeView extends SimpleBasicFileAttributeView {\n    \n    private static final Logger logger = LoggerFactory.getLogger(K8SBasicFileAttributeView.class);\n\n    private BasicFileAttributes attrs = null;\n    private final CloudClientFactory ccf;\n\n    public K8SBasicFileAttributeView(final Path path, final CloudClientFactory ccf) {\n        super(path);\n        this.ccf = ccf;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public <T extends BasicFileAttributes> T readAttributes() {\n        if (attrs == null) {\n            final ConfigMap fileCM = ccf.executeCloudFunction(client -> getFsObjCM(client, path),\n                                                              KubernetesClient.class)\n                                        .orElseThrow(() -> new NoSuchFileException(path.toRealPath().toString()));\n\n            this.attrs = new BasicFileAttributesImpl(path.toString(),\n                                                     new FileTimeImpl(K8SFileSystemUtils.getLastModifiedTime(fileCM)),\n                                                     new FileTimeImpl(K8SFileSystemUtils.getCreationTime(fileCM)),\n                                                     null,\n                                                     new LazyAttrLoader<Long>() {\n                                                        private Long size = null;\n                                                         @Override\n                                                         public Long get() {\n                                                             if (size == null) {\n                                                                 size = K8SFileSystemUtils.getSize(fileCM);\n                                                             }\n                                                             return size;\n                                                         }\n                                                     },\n                                                     K8SFileSystemUtils.isFile(fileCM),\n                                                     K8SFileSystemUtils.isDirectory(fileCM));\n        }\n        return (T) attrs;\n    }\n\n    @Override\n    public void setAttribute(String attribute, Object value) {\n        logger.debug(K8S_FS_NO_IMPL);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{BasicFileAttributeView.class, K8SBasicFileAttributeView.class};\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileChannel.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.util.Collections;\n\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.cloud.CloudClientFactory;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_FSOBJ_CONTENT_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_MAX_CAPACITY_PROPERTY_NAME;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceParentDirFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjCM;\n\npublic class K8SFileChannel extends SeekableInMemoryByteChannel {\n\n    private static final int CAPACITY = Integer.parseInt(System.getProperty(K8S_FS_MAX_CAPACITY_PROPERTY_NAME,\n                                                                            String.valueOf(100 * 1024)));\n    protected CloudClientFactory ccf;\n    private Path file;\n\n    public K8SFileChannel(Path file, CloudClientFactory ccf) {\n        super(CAPACITY);\n        this.file = file;\n        this.ccf = ccf;\n        // Constructor is not necessarily Thread-Safe as per JLS (Java Language Specification)\n        synchronized (this) {\n            try {\n                this.contents = ccf.executeCloudFunction(client -> getFsObjCM(client, file), KubernetesClient.class)\n                                   .filter(K8SFileSystemUtils::isFile)\n                                   .map(K8SFileSystemUtils::getFsObjContentBytes)\n                                   .orElse(new byte[0]);\n            } catch (Exception e) {\n                this.ccf = null;\n                this.file = null;\n                super.close();\n                throw e;\n            }\n        }\n    }\n\n    @Override\n    public void close() {\n        try {\n            ccf.executeCloudFunction(client -> createOrReplaceFSCM(client,\n                                                                   file,\n                                                                   createOrReplaceParentDirFSCM(client, file, size(), false),\n                                                                   Collections.singletonMap(CFG_MAP_FSOBJ_CONTENT_KEY,\n                                                                                            super.toString()),\n                                                                   false),\n                                     KubernetesClient.class);\n        } finally {\n            this.ccf = null;\n            this.file = null;\n            super.close();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileStore.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.file.SimpleUnixFileStore;\n\npublic class K8SFileStore extends SimpleUnixFileStore {\n\n    K8SFileStore(final Path path) {\n        super(path);\n    }\n\n    @Override\n    public long getTotalSpace() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public long getUsableSpace() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public long getUnallocatedSpace() {\n        throw new UnsupportedOperationException();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileSystem.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.LockableFileSystem;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.file.SimpleUnixFileSystem;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NO_IMPL;\n\npublic class K8SFileSystem extends SimpleUnixFileSystem implements LockableFileSystem {\n\n    private static final Logger logger = LoggerFactory.getLogger(K8SFileSystem.class);\n\n    K8SFileSystem(final FileSystemProvider provider, final String path) {\n        super(provider, path);\n        fileStore = new K8SFileStore(null);\n    }\n\n    @Override\n    public WatchService newWatchService() {\n        return new K8SWatchService(this);\n    }\n\n    @Override\n    public void lock() {\n        logger.debug(K8S_FS_NO_IMPL);\n    }\n\n    @Override\n    public void unlock() {\n        logger.debug(K8S_FS_NO_IMPL);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemConstants.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.util.regex.Pattern;\n\npublic class K8SFileSystemConstants {\n    public static final String CFG_MAP_LABEL_FSOBJ_TYPE_KEY = \"k8s.fs.nio.java.uberfire.org/fsobj-type\";\n    public static final String CFG_MAP_LABEL_FSOBJ_APP_KEY = \"k8s.fs.nio.java.uberfire.org/fsobj-app\";\n    public static final String CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX = \"k8s.fs.nio.java.uberfire.org/fsobj-name-\";\n    public static final String CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY = \"k8s.fs.nio.java.uberfire.org/fsobj-size\";\n    public static final String CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY = \"k8s.fs.nio.java.uberfire.org/fsobj-lastModifiedTimestamp\";\n    public static final String CFG_MAP_FSOBJ_NAME_PREFIX = \"k8s-fsobj-\";\n    public static final String CFG_MAP_FSOBJ_CONTENT_KEY = \"fsobj-content\";\n\n    public static final String K8S_FS_MAX_CAPACITY_PROPERTY_NAME = \"org.uberfire.java.nio.fs.k8s.max.file.size\";\n    public static final String K8S_FS_APP_PROPERTY_NAME = \"org.uberfire.java.nio.fs.k8s.app\";\n    public static final String K8S_FS_APP_DEFAULT_VALUE = \"unknown\";\n\n    public static final Pattern K8S_FS_NAME_RESTRICATION = Pattern.compile(\"(([A-Za-z0-9.][-A-Za-z0-9_.]*)?[A-Za-z0-9])?\");\n    public static final String K8S_FS_HIDDEN_FILE_INDICATOR = \".\";\n    public static final String K8S_FS_HIDDEN_FILE_INDICATOR_SUFFIX = \"1\";\n    \n    public static final String K8S_FS_SCHEME = \"k8s\"; \n    public static final String K8S_FS_NO_IMPL = \"Not implemented\";\n\n    public static final int K8S_FS_NAME_MAX_LENGTH = 63;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemObjectType.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nenum K8SFileSystemObjectType {\n    STORE(\"fsobj-filestore\"),\n    ROOT(\"fsobj-root-directory\"),\n    DIR(\"fsobj-directory\"),\n    FILE(\"fsobj-regular-file\"),\n    UNKNOWN(\"fsobj-unknown\");\n\n    private final String desc;\n\n    private K8SFileSystemObjectType(String desc) {\n        this.desc = desc;\n    }\n\n    @Override\n    public String toString() {\n        return this.desc;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemProvider.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.nio.channels.Channels;\nimport java.nio.channels.FileChannel;\nimport java.util.Collections;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.BasicFileAttributesImpl;\nimport org.uberfire.java.nio.base.GeneralPathImpl;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.fs.cloud.CloudClientFactory;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkCondition;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_FSOBJ_CONTENT_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_SCHEME;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceParentDirFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.deleteAndUpdateParentCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getPathByFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.isDirectory;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.isRoot;\n\npublic class K8SFileSystemProvider extends SimpleFileSystemProvider implements CloudClientFactory {\n    private static final Logger logger = LoggerFactory.getLogger(K8SFileSystemProvider.class);\n    public K8SFileSystemProvider() {\n        super(null, OSType.UNIX_LIKE);\n        this.fileSystem = new K8SFileSystem(this, K8SFileSystem.UNIX_SEPARATOR_STRING);\n    }\n\n    @Override\n    public String getScheme() {\n        return K8S_FS_SCHEME;\n    }\n\n    @Override\n    public InputStream newInputStream(final Path path,\n                                      final OpenOption... options)\n            throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        checkFileNotExistThenThrow(path, false);\n        logger.info(\"Open InputStream to file [{}]\", path);\n        return Channels.newInputStream(new K8SFileChannel(toAbsoluteRealPath(path), this));\n    }\n\n    @Override\n    public OutputStream newOutputStream(final Path path,\n                                        final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        Path aPath = toAbsoluteRealPath(path);\n        logger.info(\"Open OutputStream to file [{}]\", aPath);\n        return Channels.newOutputStream(new K8SFileChannel(aPath, this));\n    }\n\n    @Override\n    public FileChannel newFileChannel(final Path path,\n                                      final Set<? extends OpenOption> options,\n                                      final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        throw new UnsupportedOperationException();\n    }\n    \n    @Override\n    public SeekableByteChannel newByteChannel(final Path path,\n                                              final Set<? extends OpenOption> options,\n                                              final FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        return new K8SFileChannel(toAbsoluteRealPath(path), this);\n    }\n\n    @Override\n    public void createDirectory(final Path dir,\n                                final FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        checkNotNull(\"dir\",dir);\n        Path aDir = toAbsoluteRealPath(dir);\n        Optional<ConfigMap> directoryCm = executeCloudFunction(client -> getFsObjCM(client, aDir), KubernetesClient.class);\n        if (directoryCm.isPresent()) {\n            throw new FileAlreadyExistsException(aDir.toString());\n        }\n        \n        executeCloudFunction(client -> createOrReplaceFSCM(client, \n                                                           aDir,\n                                                           isRoot(aDir) ? Optional.empty()\n                                                                       : createOrReplaceParentDirFSCM(client, aDir, 0L, false),\n                                                           Collections.emptyMap(),\n                                                           true), \n                             KubernetesClient.class);\n    }\n\n    @Override\n    protected Path[] getDirectoryContent(final Path dir) {\n        checkNotNull(\"dir\", dir);\n        Path aDir = toAbsoluteRealPath(dir);\n        if (isRoot(aDir) &&\n            !executeCloudFunction(client -> getFsObjCM(client, aDir), KubernetesClient.class).isPresent()) {\n            initRoot();\n        }\n        ConfigMap dirCM = executeCloudFunction(client -> getFsObjCM(client, aDir), KubernetesClient.class)\n                .orElseThrow(() -> new NotDirectoryException(aDir.toString()));\n        if (dirCM.getData() == null || dirCM.getData().isEmpty()) {\n            return new Path[0];\n        }\n        \n        String separator = aDir.getFileSystem().getSeparator();\n        String dirPathString = getPathByFsObjCM((K8SFileSystem)fileSystem, dirCM).toString();\n        return dirCM.getData()\n                    .keySet()\n                    .stream()\n                    .map(fileName -> GeneralPathImpl.create(aDir.getFileSystem(), \n                                                           (dirPathString.endsWith(separator) ? \n                                                            dirPathString :\n                                                            dirPathString.concat(separator)).concat(fileName), \n                                                            false))\n                    .toArray(Path[]::new);\n    }\n    \n    private synchronized void initRoot() {\n        Path root = this.fileSystem.getPath(K8SFileSystem.UNIX_SEPARATOR_STRING);\n        this.createDirectory(root);\n        logger.info(\"Root directory created.\");\n    }\n\n    @Override\n    public void delete(final Path path,\n                       final DeleteOption... options) throws NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        checkFileNotExistThenThrow(path, false);\n        deleteIfExists(toAbsoluteRealPath(path), options);\n    }\n\n    @Override\n    public boolean deleteIfExists(final Path path,\n                                  final DeleteOption... options)\n            throws DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        Path aPath = toAbsoluteRealPath(path);\n        synchronized (this) {\n            try {\n                return executeCloudFunction(client -> deleteAndUpdateParentCM(client, aPath), \n                                            KubernetesClient.class).get();\n            } finally {\n                toGeneralPathImpl(aPath).clearCache();\n            }\n        }\n    }\n    \n    @Override\n    public boolean isHidden(final Path path) throws IllegalArgumentException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        checkFileNotExistThenThrow(path, false);\n        return path.getFileName().toString().startsWith(K8SFileSystemConstants.K8S_FS_HIDDEN_FILE_INDICATOR);\n    }\n\n    @Override\n    public void checkAccess(final Path path,\n                            AccessMode... modes)\n            throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        checkNotNull(\"modes\", modes);\n        checkFileNotExistThenThrow(path, false);\n        for (final AccessMode mode : modes) {\n            checkNotNull(\"mode\", mode);\n            if (mode == AccessMode.EXECUTE) {\n                throw new AccessDeniedException(toAbsoluteRealPath(path).toString());\n            }\n        }\n    }\n\n    @Override\n    public FileStore getFileStore(final Path path) throws IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        return new K8SFileStore(toAbsoluteRealPath(path));\n    }\n\n    @Override\n    public <A extends BasicFileAttributes> A readAttributes(final Path path,\n                                                            final Class<A> type,\n                                                            final LinkOption... options)\n            throws NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        checkNotNull(\"path\", path);\n        checkNotNull(\"type\", type);\n        checkFileNotExistThenThrow(path, false);\n        if (type == BasicFileAttributesImpl.class || type == BasicFileAttributes.class) {\n            final K8SBasicFileAttributeView view = getFileAttributeView(toAbsoluteRealPath(path),\n                                                                        K8SBasicFileAttributeView.class,\n                                                                        options);\n            return view.readAttributes();\n        }\n        return null;\n    }\n\n    @Override\n    @SuppressWarnings(\"unchecked\")\n    protected <V extends FileAttributeView> V createFileAttributeView(final GeneralPathImpl path, \n                                                                      final Class<V> type) {\n        if (AbstractBasicFileAttributeView.class.isAssignableFrom(type)) {\n            final V newView = (V) new K8SBasicFileAttributeView(path, this);\n            path.addAttrView(newView);\n            return newView;\n        } else {\n            return null;\n        }\n    }\n    \n    @Override\n    public void copy(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        checkNotNull(\"source\", source);\n        checkNotNull(\"target\", target);\n        checkFileExistsThenThrow(target);\n        Path aSource = toAbsoluteRealPath(source);\n        Path aTarget = toAbsoluteRealPath(target);\n\n        Optional<ConfigMap> srcCMOpt = executeCloudFunction(\n            client -> getFsObjCM(client, aSource), KubernetesClient.class);\n        checkCondition(\"source must exist\", srcCMOpt.isPresent());\n\n        ConfigMap srcCM = srcCMOpt.orElseThrow(IllegalArgumentException::new);\n        if (isDirectory(srcCM)) {\n            throw new UnsupportedOperationException(srcCM.getMetadata().getName() + \"is a directory.\");\n        }\n        \n        String content = srcCM.getData().getOrDefault(CFG_MAP_FSOBJ_CONTENT_KEY, \"\");\n        long size = Long.parseLong(srcCM.getMetadata().getAnnotations().getOrDefault(CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY, \"0\"));\n        executeCloudFunction(client -> createOrReplaceFSCM(client, \n                                                           aTarget,\n                                                           createOrReplaceParentDirFSCM(client, aTarget, size, false),\n                                                           Collections.singletonMap(CFG_MAP_FSOBJ_CONTENT_KEY, content),\n                                                           false), \n                             KubernetesClient.class);\n    }\n\n    @Override\n    public void move(final Path source,\n                     final Path target,\n                     final CopyOption... options)\n            throws DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        Path aSource = toAbsoluteRealPath(source);\n        Path aTarget = toAbsoluteRealPath(target);\n        try {\n            copy(aSource, aTarget);\n        } catch (Exception e) {\n            try {\n                delete(aTarget);\n            } catch (NoSuchFileException nsfe) {\n                throw new IOException(\"Moving file failed.\", e);\n            } catch (Exception exp) {\n                throw new IOException(\"Moving file failed due to these errors: Copy Source Exception [\" + \n                        e.getMessage() + \"]; Delete Target Exception [\" + exp.getMessage() + \"].\");\n            } \n        } \n        \n        try {\n            delete(aSource);\n        } catch (Exception e) {\n            throw new IOException(\"Moving file failed with clean Source Exception [\" + e.getMessage() + \"], \" +\n                    \"which will leave file system in an inconsistent state.\");\n        }\n    }\n    \n    @Override\n    protected void checkFileNotExistThenThrow(final Path path, final boolean isLink) {\n        Path aPath = toAbsoluteRealPath(path);\n        executeCloudFunction(client -> getFsObjCM(client, aPath), KubernetesClient.class)\n            .orElseThrow(() -> {\n                logger.info(\"File not found [{}]\", aPath.toUri().toString());\n                return new NoSuchFileException(aPath.toUri().toString());\n            });\n    }\n\n    @Override\n    protected void checkFileExistsThenThrow(final Path path) {\n        Path aPath = toAbsoluteRealPath(path);\n        if (executeCloudFunction(client -> getFsObjCM(client, aPath), KubernetesClient.class).isPresent()) {\n            throw new FileAlreadyExistsException(aPath.toString());\n        }\n    }\n\n    protected Path toAbsoluteRealPath(final Path path) {\n        if (path.isAbsolute()) {\n            if (path.getParent() == null) {\n                return path; // Root\n            } else if (path.getParent().toString().contains(\".\")) {\n                fileSystem.getPath(path.toRealPath().toString());\n            } else {\n                return path; // RealPath\n            }\n        }\n        return fileSystem.getPath(path.toAbsolutePath().toRealPath().toString());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemUtils.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.io.UnsupportedEncodingException;\nimport java.time.Instant;\nimport java.time.ZonedDateTime;\nimport java.time.format.DateTimeFormatter;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.UUID;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.api.model.ConfigMapBuilder;\nimport io.fabric8.kubernetes.api.model.OwnerReferenceBuilder;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.Watcher.Action;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent.Kind;\nimport org.uberfire.java.nio.fs.cloud.CloudClientConstants;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_FSOBJ_CONTENT_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_FSOBJ_NAME_PREFIX;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_LABEL_FSOBJ_APP_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_LABEL_FSOBJ_TYPE_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_APP_DEFAULT_VALUE;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_APP_PROPERTY_NAME;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_HIDDEN_FILE_INDICATOR;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_HIDDEN_FILE_INDICATOR_SUFFIX;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NAME_MAX_LENGTH;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NAME_RESTRICATION;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemObjectType.UNKNOWN;\n\n\npublic class K8SFileSystemUtils {\n\n    public static final String APP_NAME = System.getProperty(K8S_FS_APP_PROPERTY_NAME, K8S_FS_APP_DEFAULT_VALUE);\n    private static final Logger logger = LoggerFactory.getLogger(K8SFileSystemUtils.class);\n\n    static Optional<ConfigMap> createOrReplaceParentDirFSCM(KubernetesClient client, \n                                                            Path self, \n                                                            long selfSize,\n                                                            boolean isUpdateForFileDeletion) {\n        String selfName = getFileNameString(self);\n        Path parent = Optional.ofNullable(self.getParent()).orElseThrow(IllegalArgumentException::new);\n        Map<String, String> parentContent = Optional.ofNullable(getFsObjCM(client, parent))\n                .filter(K8SFileSystemUtils::isDirectory)\n                .map(ConfigMap::getData)\n                .orElseGet(HashMap::new);\n        \n        if (isUpdateForFileDeletion) {\n            parentContent.remove(selfName);\n        } else {\n            parentContent.put(selfName, String.valueOf(selfSize));\n        }\n        final long parentSize = parentContent.values().stream().mapToLong(Long::parseLong).sum();\n\n        return Optional.of(createOrReplaceFSCM(client, parent,\n                                               isRoot(parent) ? Optional.empty()\n                                                              : createOrReplaceParentDirFSCM(client, parent, parentSize, false),\n                                               parentContent,\n                                               true));\n    }\n\n    static ConfigMap createOrReplaceFSCM(KubernetesClient client,\n                                         Path path,\n                                         Optional<ConfigMap> parentOpt,\n                                         Map<String, String> content,\n                                         boolean isDir) {\n        String fileName = getFileNameString(path);\n        long size = 0;\n        Map<String, String> labels = getFsObjNameElementLabel(path);\n        if (isDir) {\n            if (labels.isEmpty()) {\n                labels.put(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, K8SFileSystemObjectType.ROOT.toString());\n            } else {\n                labels.put(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, K8SFileSystemObjectType.DIR.toString());\n            }\n            size = content.values().stream().mapToLong(Long::parseLong).sum();\n        } else {\n            labels.put(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, K8SFileSystemObjectType.FILE.toString());\n            size = parentOpt.map(cm -> Long.parseLong(cm.getData().get(fileName)))\n                            .orElseThrow(() -> new IllegalStateException(\"File [\" +\n                                                                         fileName +\n                                                                         \"] is not found at parent directory [\" +\n                                                                         path.getParent().toString() +\n                                                                         \"]\"));\n        }\n        labels.put(CFG_MAP_LABEL_FSOBJ_APP_KEY, APP_NAME);\n        \n        Map<String, String> annotations = new ConcurrentHashMap<>();\n        annotations.put(CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY, \n                        ZonedDateTime.now().format(DateTimeFormatter.ISO_INSTANT));\n        annotations.put(CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY, String.valueOf(size));\n        \n        String cmName = Optional.ofNullable(getFsObjCM(client, path))\n                .map(cm -> cm.getMetadata().getName())\n                .orElseGet(() -> CFG_MAP_FSOBJ_NAME_PREFIX + UUID.randomUUID().toString());\n        return parentOpt.map(parent -> client.configMaps().createOrReplace(new ConfigMapBuilder()\n                                             .withNewMetadata()\n                                               .withName(cmName)\n                                               .withLabels(labels)\n                                               .withAnnotations(annotations)\n                                               .withOwnerReferences(new OwnerReferenceBuilder()\n                                                 .withApiVersion(parent.getApiVersion())\n                                                 .withKind(parent.getKind())\n                                                 .withName(parent.getMetadata().getName())\n                                                 .withUid(parent.getMetadata().getUid())\n                                                 .build())\n                                             .endMetadata()\n                                             .withData(content)\n                                             .build()))\n                        .orElseGet(() -> client.configMaps().createOrReplace(new ConfigMapBuilder()\n                                               .withNewMetadata()\n                                                 .withName(cmName)\n                                                 .withLabels(labels)\n                                                 .withAnnotations(annotations)\n                                               .endMetadata()\n                                               .withData(content)\n                                               .build()));\n    }\n\n    static boolean deleteAndUpdateParentCM(KubernetesClient client, Path path) {\n        ConfigMap cm = getFsObjCM(client, path);\n        if (cm != null && client.configMaps()\n                                .withName(cm.getMetadata().getName())\n                                .cascading(true)\n                                .delete()) {\n            Optional.ofNullable(path.getParent())\n                    .ifPresent(p -> createOrReplaceParentDirFSCM(client, path, 0, true));\n            return true;\n        } else {\n            return false;\n        }\n    }\n\n    static ConfigMap getFsObjCM(KubernetesClient client, Path path) {\n        int nameCount = path.getNameCount();\n        Map<String, String> labels = getFsObjNameElementLabel(path);\n        if (labels.isEmpty()) {\n            labels.put(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, K8SFileSystemObjectType.ROOT.toString());\n        } \n        labels.put(CFG_MAP_LABEL_FSOBJ_APP_KEY, APP_NAME);\n        Object[] configMaps = client.configMaps()\n                                           .withLabels(labels)\n                                           .list()\n                                           .getItems()\n                                           .stream()\n                                           .filter(cm -> cm.getMetadata()\n                                                           .getLabels()\n                                                           .entrySet()\n                                                           .stream()\n                                                           .filter(entry -> entry.getKey().startsWith(CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX))\n                                                           .count() == nameCount)\n                                           .toArray();\n        \n        if (configMaps.length > 1) {\n            throw new IllegalStateException(\"Ambiguous K8S FileSystem object name: [\" + path.toString() +\n                                            \"]; should not have be associated with more than one \" +\n                                            \"K8S FileSystem ConfigMaps.\");\n        }\n        if (configMaps.length == 1) {\n            return (ConfigMap)configMaps[0];\n        }\n        return null;\n    }\n\n    static byte[] getFsObjContentBytes(ConfigMap cm) {\n        byte[] content = new byte[0];\n        try {\n            content = cm.getData().get(CFG_MAP_FSOBJ_CONTENT_KEY).getBytes(CloudClientConstants.ENCODING);\n        } catch (UnsupportedEncodingException e) {\n            logger.warn(\"Invalid encoding [{}], returns zero length byte array content.\",\n                        CloudClientConstants.ENCODING);\n        } catch (Exception e) {\n            logger.error(\"Retrieve content from FsOjbCM [{}] failed, due to\", cm, e);\n        }\n        return content;\n    }\n\n    static Map<String, String> getFsObjNameElementLabel(Path path) {\n        Map<String, String> labels = new ConcurrentHashMap<>();\n        path.iterator().forEachRemaining(\n            pathElement -> validateAndBuildPathLabel(labels, pathElement));\n        return labels;\n    }\n    \n    static void validateAndBuildPathLabel(Map<String, String> labels, Path pathElement) {\n        StringBuilder nameKeyBuilder = new StringBuilder(CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX); \n        String pathElementStr = pathElement.toString();\n        \n        nameKeyBuilder.append(labels.size());\n        if (K8S_FS_NAME_RESTRICATION.matcher(pathElementStr).matches() \n                && pathElementStr.length() < K8S_FS_NAME_MAX_LENGTH) {\n            if (pathElementStr.startsWith(K8S_FS_HIDDEN_FILE_INDICATOR)) {\n                pathElementStr = pathElementStr.substring(1);\n                nameKeyBuilder.append(K8S_FS_HIDDEN_FILE_INDICATOR).append(K8S_FS_HIDDEN_FILE_INDICATOR_SUFFIX);\n            }\n        } else {\n            throw new InvalidPathException(pathElementStr, \n                \"A valid k8s filesystem object name must be less than \" +\n                K8S_FS_NAME_MAX_LENGTH + \n                \" characters and valid by '\" +\n                K8S_FS_NAME_RESTRICATION.toString() + \"'\"); \n        }\n        labels.put(nameKeyBuilder.toString(), pathElementStr);\n    }\n    \n    static String getFileNameString(Path path) {\n        return Optional.ofNullable(path.getFileName()).map(Path::toString).orElse(K8SFileSystem.UNIX_SEPARATOR_STRING);\n    }\n\n    static long getSize(ConfigMap fileCM) {\n        return Long.parseLong(fileCM.getMetadata().getAnnotations().getOrDefault(CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY, \"0\"));\n    }\n\n    static long getCreationTime(ConfigMap fileCM) {\n        return parseTimestamp(fileCM.getMetadata().getCreationTimestamp()).getEpochSecond();\n    }\n    \n    static long getLastModifiedTime(ConfigMap fileCM) {\n        return parseTimestamp(fileCM.getMetadata().getAnnotations()\n                                                  .get(CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY))\n                .getEpochSecond();\n    }\n    \n    static Path getPathByFsObjCM(K8SFileSystem fs, ConfigMap cm) {\n        StringBuilder pathBuilder = new StringBuilder();\n        Map<String, String> labels = cm.getMetadata().getLabels();\n        Map<Float, Map.Entry<String, String>> labelsToBeSorted = new ConcurrentHashMap<>();\n        if (labels.isEmpty() || !labels.containsKey(CFG_MAP_LABEL_FSOBJ_TYPE_KEY)) {\n            throw new IllegalArgumentException(\"Invalid K8SFileSystem ConfigMap - Missing required labels\");\n        }\n        if (labels.containsValue(K8SFileSystemObjectType.ROOT.toString())) {\n            return fs.getPath(fs.getSeparator());\n        }\n        labels.entrySet()\n              .stream()\n              .filter(entry -> entry.getKey().startsWith(CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX))\n              .forEach(entry -> labelsToBeSorted.put(extractPathElementIndex(entry.getKey()), entry));\n        \n        labelsToBeSorted.entrySet()\n                        .stream()\n                        .sorted(Map.Entry.comparingByKey())\n                        .forEach(entry -> pathBuilder.append(fs.getSeparator())\n                                                     .append(extractPathElementStringWithHiddenIndicator(entry.getValue())));\n        return fs.getPath(pathBuilder.toString());\n    }\n    \n    static Float extractPathElementIndex(String pathElement) {\n        return Float.parseFloat(pathElement.substring(CFG_MAP_LABEL_FSOBJ_NAME_KEY_PREFIX.length()));\n    }\n    \n    static String extractPathElementStringWithHiddenIndicator(Map.Entry<String, String> entry) {\n        String pes = entry.getValue();\n        if (entry.getKey().endsWith(K8S_FS_HIDDEN_FILE_INDICATOR.concat(K8S_FS_HIDDEN_FILE_INDICATOR_SUFFIX))) {\n            return K8S_FS_HIDDEN_FILE_INDICATOR.concat(pes);\n        } else {\n            return pes;\n        }\n    }\n\n    public static boolean isRoot(Path path) {\n        return path.getParent() == null;\n    }\n    \n    static boolean isFile(ConfigMap fileCM) {\n        return K8SFileSystemObjectType.FILE.toString()\n                                           .equals(fileCM.getMetadata()\n                                                         .getLabels()\n                                                         .getOrDefault(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, UNKNOWN.toString()));\n    }\n\n    static boolean isDirectory(ConfigMap fileCM) {\n        return K8SFileSystemObjectType.DIR.toString()\n                                          .equals(fileCM.getMetadata()\n                                                        .getLabels()\n                                                        .getOrDefault(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, UNKNOWN.toString()))\n               ||                           \n               K8SFileSystemObjectType.ROOT.toString()\n                .equals(fileCM.getMetadata()\n                              .getLabels()\n                              .getOrDefault(CFG_MAP_LABEL_FSOBJ_TYPE_KEY, UNKNOWN.toString()));\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    static Optional<Kind> mapActionToKind(Action action) {\n        switch(action) {\n            case ADDED:\n                return Optional.of(StandardWatchEventKind.ENTRY_CREATE);\n            case DELETED:\n                return Optional.of(StandardWatchEventKind.ENTRY_DELETE);\n            case MODIFIED:\n                return Optional.of(StandardWatchEventKind.ENTRY_MODIFY);\n            case ERROR:\n            default:\n                return Optional.empty();\n        }\n    }\n\n    static Instant parseTimestamp(String timestamp) {\n        return Optional.ofNullable(timestamp).map(ts -> ZonedDateTime.parse(ts, DateTimeFormatter.ISO_DATE_TIME)\n                                                                     .toInstant())\n                                             .orElse(Instant.now());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SWatchKey.java",
    "content": "package org.uberfire.java.nio.fs.k8s;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.BlockingQueue;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.LinkedBlockingQueue;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.concurrent.atomic.AtomicReference;\n\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchEvent.Kind;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.Watchable;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NO_IMPL;\n\n@SuppressWarnings(\"serial\")\npublic class K8SWatchKey implements WatchKey {\n    private final transient K8SWatchService service;\n    private final transient Path path;\n    private final AtomicReference<State> state = new AtomicReference<>(State.READY);\n    private final AtomicBoolean valid = new AtomicBoolean(true);\n    private final BlockingQueue<WatchEvent<?>> events = new LinkedBlockingQueue<>();\n    @SuppressWarnings(\"rawtypes\")\n    private final transient Map<Kind, Event> eventKinds = new ConcurrentHashMap<>();\n\n    K8SWatchKey(K8SWatchService service, Path path) {\n        this.service = service;\n        this.path = path;\n    }\n\n    @Override\n    public boolean isValid() {\n        return !service.isClose() && valid.get();\n    }\n\n    @Override\n    public List<WatchEvent<?>> pollEvents() {\n        List<WatchEvent<?>> result = new ArrayList<>(events.size());\n        events.drainTo(result);\n        eventKinds.clear();\n        return Collections.unmodifiableList(result);\n    }\n\n    @Override\n    public boolean reset() {\n        if (isValid()) {\n            events.clear();\n            eventKinds.clear();\n            return state.compareAndSet(State.SIGNALLED, State.READY);\n        } else {\n            return false;\n        }\n    }\n\n    @Override\n    public void cancel() {\n        valid.set(false);\n    }\n\n    @Override\n    public Watchable watchable() {\n        return this.path;\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    protected boolean postEvent(WatchEvent.Kind kind) {\n        Event event = eventKinds.computeIfAbsent(kind, k -> {\n            Event e = new Event(kind, new Context(K8SWatchKey.this.path.getFileName()));\n            return events.offer(e) ? e : null;\n        });\n        if (event == null) {\n            return false;\n        } else {\n            event.increaseCount();\n            return true;\n        }\n    }\n\n    protected boolean isQueued() {\n        return state.get() == State.SIGNALLED;\n    }\n\n    protected void signal() {\n        state.compareAndSet(State.READY, State.SIGNALLED);\n    }\n\n    enum State {\n        READY,\n        SIGNALLED\n    }\n\n    @SuppressWarnings(\"rawtypes\")\n    private static final class Event implements WatchEvent<Context> {\n\n        private final AtomicInteger count = new AtomicInteger(0);\n        private final transient Kind kind;\n        private final transient Context context;\n\n        private Event(Kind kind, Context context) {\n            this.kind = kind;\n            this.context = context;\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Kind kind() {\n            return this.kind;\n        }\n\n        @Override\n        public int count() {\n            return count.get();\n        }\n\n        @Override\n        public Context context() {\n            return this.context;\n        }\n\n        private int increaseCount() {\n            return count.incrementAndGet();\n        }\n    }\n    \n    private static final class Context implements WatchContext {\n        private final Path path;\n        \n        private Context(Path path) {\n            this.path = path;\n        }\n        \n        @Override\n        public Path getPath() {\n            return this.path;\n        }\n\n        @Override\n        public Path getOldPath() {\n            return this.path;\n        }\n\n        @Override\n        public String getSessionId() {\n            return K8S_FS_NO_IMPL;\n        }\n\n        @Override\n        public String getMessage() {\n            return K8S_FS_NO_IMPL;\n        }\n\n        @Override\n        public String getUser() {\n            return K8S_FS_NO_IMPL;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/K8SWatchService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.util.Map;\nimport java.util.concurrent.BlockingQueue;\nimport java.util.concurrent.CompletableFuture;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ExecutionException;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.LinkedBlockingQueue;\nimport java.util.concurrent.TimeUnit;\n\nimport com.google.common.util.concurrent.ThreadFactoryBuilder;\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.KubernetesClientException;\nimport io.fabric8.kubernetes.client.Watch;\nimport io.fabric8.kubernetes.client.Watcher;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.InterruptedException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.fs.cloud.CloudClientFactory;\n\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_LABEL_FSOBJ_APP_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.APP_NAME;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getPathByFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.mapActionToKind;\n\npublic class K8SWatchService implements WatchService {\n\n    private static final Logger logger = LoggerFactory.getLogger(K8SWatchService.class);\n    private final CloudClientFactory ccf;\n    private final K8SFileSystem fs;\n    private final BlockingQueue<WatchKey> buckets = new LinkedBlockingQueue<>();\n    private final Map<Path, WatchKey> registrations = new ConcurrentHashMap<>();\n\n    private final CompletableFuture<Void> closed = new CompletableFuture<>();\n\n    public K8SWatchService(K8SFileSystem fs) {\n        this.fs = fs;\n        this.ccf = (CloudClientFactory) fs.provider();\n        Executors.newSingleThreadExecutor(new ThreadFactoryBuilder().setNameFormat(\"k8sfs-cm-watcher-thread-%d\").build()).execute(() -> \n            ccf.executeCloudFunction(this::triageEvents, KubernetesClient.class));\n    }\n\n    @Override\n    public void close() {\n        logger.info(\"K8SFileSystem WatchService is closing.\");\n        if (closed.complete(null)) {\n            logger.info(\"K8SFileSystem WatchService closed normally.\");\n        } else {\n            logger.info(\"K8SFileSystem WatchService has been closed already.\");\n        }\n        buckets.clear();\n        registrations.clear();\n    }\n\n    @Override\n    public WatchKey poll() {\n        checkOpen();\n        return buckets.poll();\n    }\n\n    @Override\n    public WatchKey poll(long timeout, TimeUnit unit) {\n        WatchKey bucket = null;\n        checkOpen();\n        try {\n            bucket = buckets.poll(timeout, unit);\n        } catch (java.lang.InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new InterruptedException();\n        }\n        return bucket;\n    }\n\n    @Override\n    public WatchKey take() {\n        WatchKey bucket = null;\n        checkOpen();\n        try {\n            bucket = buckets.take();\n        } catch (java.lang.InterruptedException e) {\n            Thread.currentThread().interrupt();\n            throw new InterruptedException();\n        }\n        return bucket;\n    }\n\n    @Override\n    public boolean isClose() {\n        return closed.isDone();\n    }\n\n    protected final void checkOpen() {\n        if (closed.isDone()) {\n            throw new ClosedWatchServiceException();\n        }\n    }\n\n    private CompletableFuture<Void> triageEvents(KubernetesClient client) {\n        logger.info(\"K8SFileSystem WatchService is starting to watch K8SFileSystem ConfigMap in namespace: [{}]\",\n                    client.getNamespace());\n        try (Watch watchable = client.configMaps()\n                                     .withLabel(CFG_MAP_LABEL_FSOBJ_APP_KEY, APP_NAME)\n                                     .watch(new Watcher<ConfigMap>() {\n            @Override\n            public void eventReceived(Action action, ConfigMap fsObjCM) {\n                logger.debug(\"Event - Action: {}, {} on ConfigMap \", action, fsObjCM.getMetadata().getLabels());\n                Path path = getPathByFsObjCM(K8SWatchService.this.fs, fsObjCM);\n                \n                K8SWatchKey key = (K8SWatchKey) registrations\n                        .computeIfAbsent(path, p -> new K8SWatchKey(K8SWatchService.this, p));\n                mapActionToKind(action).ifPresent(e -> {\n                    if (key.postEvent(e) && key.isValid() && !key.isQueued() && buckets.offer(key)) {\n                        key.signal();\n                    }\n                });\n            }\n\n            @Override\n            public void onClose(KubernetesClientException cause) {\n                logger.info(\"K8SFileSystem ConfigMap Watcher closed.\");\n                if (cause != null) {\n                    logger.info(cause.getMessage());\n                }\n            }\n        })) {\n            logger.info(\"K8SFileSystem ConfigMap Watcher thread started.\");\n            closed.get();\n            logger.info(\"K8SFileSystem ConfigMap Watcher thread terminated.\");\n        } catch (ExecutionException ee) {\n            logger.error(\"K8SFileSystem ConfigMap Watcher thread terminated with execution exception.\", ee);\n            closed.completeExceptionally(ee);\n        } catch (Exception e) {\n            if (!closed.isDone()) {\n                logger.error(\"K8SFileSystem ConfigMap Watcher thread terminated with exception.\", e);\n                closed.completeExceptionally(e);\n            } \n        }\n        return closed;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/main/java/org/uberfire/java/nio/fs/k8s/SeekableInMemoryByteChannel.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.InputStream;\nimport java.nio.ByteBuffer;\nimport java.nio.charset.Charset;\nimport java.nio.charset.StandardCharsets;\n\nimport com.google.common.io.ByteSource;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\n\npublic class SeekableInMemoryByteChannel implements SeekableByteChannel {\n\n    private static final String ENCODING = System.getProperty(\"file.encoding\", StandardCharsets.UTF_8.name());\n\n    private int position;\n    private int capacity = Integer.MAX_VALUE;\n    private boolean open;\n    protected byte[] contents;\n\n    public SeekableInMemoryByteChannel(int capacity) {\n        this();\n        this.capacity = capacity;\n    }\n    public SeekableInMemoryByteChannel() {\n        this.open = true;\n        synchronized (this) {\n            this.position = 0;\n            this.contents = new byte[0];\n        }\n    }\n\n    @Override\n    public boolean isOpen() {\n        return this.open;\n    }\n\n    @Override\n    public void close() {\n        this.open = false;\n        this.truncate(0);\n    }\n\n    @Override\n    public int read(final ByteBuffer destination) {\n        this.checkClosed();\n        if (destination == null) {\n            throw new IllegalArgumentException(\"Destination buffer must be supplied\");\n        }\n\n        final int spaceInBuffer = destination.remaining();\n        final int numBytesRemainingInContent;\n        final int numBytesToRead;\n        synchronized (this) {\n            numBytesRemainingInContent = this.contents.length - this.position;\n            if (numBytesRemainingInContent <= 0) {\n                return -1;\n            }\n            numBytesToRead = numBytesRemainingInContent >= spaceInBuffer ? spaceInBuffer : numBytesRemainingInContent;\n            destination.put(this.contents, this.position, numBytesToRead);\n            this.position += numBytesToRead;\n        }\n        return numBytesToRead;\n    }\n\n    @Override\n    public int write(final ByteBuffer source) {\n        this.checkClosed();\n        if (source == null) {\n            throw new IllegalArgumentException(\"Source buffer must be supplied\");\n        }\n        \n        final int totalBytes = source.remaining();\n        if (totalBytes > capacity || this.position + totalBytes > capacity) {\n            throw new IOException(\"Reached maximum capacity of [\" + capacity + \"] bytes.\");\n        }\n        \n        final byte[] readContents = new byte[totalBytes];\n        source.get(readContents, source.position(), readContents.length);\n\n        synchronized (this) {\n            this.contents = this.concat(this.contents, readContents, this.position);\n            this.position += totalBytes;\n            /**\n             * Channel content will be overwritten by new source completely \n             * from existing position. Old trailing content will be cleared.\n             */\n            truncate(this.position()); \n        }\n\n        return totalBytes;\n    }\n\n    @Override\n    public long position() {\n        synchronized (this) {\n            return this.position;\n        }\n    }\n\n    @Override\n    public SeekableByteChannel position(final long newPosition) {\n        if (newPosition > Integer.MAX_VALUE || newPosition < 0) {\n            throw new IllegalArgumentException(\"Valid position for this channel is between 0 and \" + Integer.MAX_VALUE);\n        }\n        synchronized (this) {\n            this.position = (int) newPosition;\n        }\n        return this;\n    }\n\n    @Override\n    public long size() {\n        synchronized (this) {\n            return this.contents.length;\n        }\n    }\n\n    @Override\n    public SeekableByteChannel truncate(final long size) {\n        if (size < 0 || size > Integer.MAX_VALUE) {\n            throw new IllegalArgumentException(\"This implementation permits a size of 0 to \" + Integer.MAX_VALUE + \" inclusive\");\n        }\n        synchronized (this) {\n            final int newSize = (int) size;\n            final int currentSize = (int) this.size();\n            if (this.position > newSize) {\n                this.position = newSize;\n            }\n            if (currentSize > newSize) {\n                final byte[] newContents = new byte[newSize];\n                System.arraycopy(this.contents, 0, newContents, 0, newSize);\n                this.contents = newContents;\n            }\n        }\n        return this;\n    }\n\n    @Override\n    public String toString() {\n        return convert(getContent());\n    }\n\n    public InputStream getContent() {\n        final byte[] copy;\n        synchronized (this) {\n            final int length = this.contents.length;\n            copy = new byte[length];\n            System.arraycopy(this.contents, 0, copy, 0, this.contents.length);\n        }\n        return new ByteArrayInputStream(copy);\n    }\n    \n    private byte[] concat(final byte[] input1, final byte[] input2, final int position) {\n        assert input1 != null : \"Input 1 must be specified\";\n        assert input2 != null : \"Input 2 must be specified\";\n        assert position >= 0 : \"Position must be 0 or higher\";\n        /**\n         * Allocate a new array of enough space (either current size or position + input2.length, \n         * whichever is greater)\n         */\n        final int newSize = position + input2.length < input1.length ? input1.length : position + input2.length;\n        final byte[] merged = new byte[newSize];\n        System.arraycopy(input1, 0, merged, 0, input1.length);\n        System.arraycopy(input2, 0, merged, position, input2.length);\n        return merged;\n    }\n\n    private void checkClosed() {\n        if (!this.isOpen()) {\n            throw new IOException(\"Channel closed.\");\n        }\n    }\n    \n    private String convert(InputStream is) {\n        try (InputStream bis = is) {\n            return new ByteSource() {\n    \n                @Override\n                public InputStream openStream() throws java.io.IOException {\n                    return bis;\n                }\n            }.asCharSource(Charset.forName(ENCODING)).read();\n        } catch (java.io.IOException e) {\n            throw new IOException(e.getMessage());\n        } \n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/cloud/CloudClientFactoryTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.cloud;\n\nimport io.fabric8.kubernetes.client.Config;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.openshift.client.OpenShiftClient;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class CloudClientFactoryTest {\n\n    @Test(expected = IllegalStateException.class)\n    public void testSetupConfig() {\n        new CloudClientFactory(){}.setupConfig();\n    }\n    \n    @Test\n    public void testExecuteCloudFunction() {\n        System.setProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY, \"https://127.0.0.1:8443\");\n        System.setProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY, \"dummy\");\n        \n        assertThat(new CloudClientFactory() {}.executeCloudFunction(client -> {\n                       return OpenShiftClient.class;\n                   }, OpenShiftClient.class)).containsSame(OpenShiftClient.class);\n\n        assertThat(new CloudClientFactory() {}.executeCloudFunction(client -> {\n            return KubernetesClient.class;\n        }, KubernetesClient.class)).containsSame(KubernetesClient.class);\n        \n        assertThat(new CloudClientFactory() {}.executeCloudFunction(client -> {\n            return null;\n        }, KubernetesClient.class)).isEmpty();\n       \n        assertThat(new CloudClientFactory() {}.executeCloudFunction(client -> {\n            return \"\";\n        }, KubernetesClient.class)).isNotEmpty();\n        \n        assertThatThrownBy(() -> \n            new CloudClientFactory() {}.executeCloudFunction(client -> {\n                throw new UnsupportedOperationException();\n            }, KubernetesClient.class)\n        ).isInstanceOf(UnsupportedOperationException.class);\n\n        assertThatThrownBy(() -> \n            new CloudClientFactory() {}.executeCloudFunction(client -> {\n                throw new IllegalStateException();\n            }, KubernetesClient.class)\n        ).isInstanceOf(IllegalStateException.class);\n\n        assertThatThrownBy(() -> \n            new CloudClientFactory() {}.executeCloudFunction(client -> {\n                throw new IndexOutOfBoundsException();\n            }, KubernetesClient.class)\n        ).isInstanceOf(IOException.class);\n        \n        System.clearProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY);\n        System.clearProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/FileSystemProvidersTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.net.URI;\n\nimport org.junit.Assume;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class FileSystemProvidersTest {\n\n    @BeforeClass\n    public static void setup() {\n        //Checking the operating system before test execution\n        Assume.assumeFalse(\"k8s does not support in Windows platform\", System.getProperty(\"os.name\").toLowerCase().contains(\"windows\"));\n    }\n\n    @Test\n    public void generalTests() {\n        assertThat(FileSystemProviders.installedProviders()).hasSize(2);\n        assertThat(FileSystemProviders.getDefaultProvider()).isInstanceOf(SimpleFileSystemProvider.class);\n\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"default:///\"))).isInstanceOf(SimpleFileSystemProvider.class);\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"file:///\"))).isInstanceOf(SimpleFileSystemProvider.class);\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"k8s:///\"))).isInstanceOf(K8SFileSystemProvider.class);\n    }\n\n    @Test\n    public void k8sFileSystemProivdeAsDefaultTests() {\n        FileSystemUtils.getConfigProps().setProperty(FileSystemUtils.SIMPLIFIED_MONITORING_ENABLED, \"true\");\n        FileSystemUtils.getConfigProps().setProperty(FileSystemUtils.CFG_KIE_CONTROLLER_OCP_ENABLED, \"true\");\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"default:///\"))).isInstanceOf(K8SFileSystemProvider.class);\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"k8s:///\"))).isInstanceOf(K8SFileSystemProvider.class);\n        assertThat(FileSystemProviders.resolveProvider(URI.create(\"k8s:///\")).isDefault()).isTrue();\n        assertThat(FileSystemProviders.getDefaultProvider()).isInstanceOf(K8SFileSystemProvider.class);\n        assertThat(FileSystemProviders.installedProviders().get(0).isDefault()).isFalse();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/K8SFileChannelTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Queue;\n\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;\nimport io.fabric8.mockwebserver.Context;\nimport io.fabric8.mockwebserver.ServerRequest;\nimport io.fabric8.mockwebserver.ServerResponse;\nimport okhttp3.mockwebserver.MockWebServer;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.cloud.CloudClientFactory;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\n\npublic class K8SFileChannelTest {\n\n    public static KubernetesMockServer SERVER =\n            new KubernetesMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), false);\n    // The default namespace for MockKubernetes Server is 'test'\n    protected static String TEST_NAMESPACE = \"test\";\n    protected static ThreadLocal<KubernetesClient> CLIENT_FACTORY;\n\n    protected static final FileSystemProvider fsProvider = new K8SFileSystemProvider() {\n\n        @Override\n        public KubernetesClient createKubernetesClient() {\n            return CLIENT_FACTORY.get();\n        }\n    };\n\n    @BeforeClass\n    public static void setup() {\n        SERVER.init();\n        CLIENT_FACTORY = ThreadLocal.withInitial(() -> SERVER.createClient());\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE).delete();\n        CLIENT_FACTORY.get().close();\n        SERVER.destroy();\n    }\n\n    @SuppressWarnings(\"resource\")\n    @Test(expected = IOException.class)\n    public void testOpenChannelWithInitializationErrors() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"k8s:///\"));\n        final Path invalid = kfs.getPath(\"/#weirdFileName$@#^&*\");\n        new K8SFileChannel(invalid, (CloudClientFactory) fsProvider);\n    }\n\n    @Test\n    public void testOpenAndCloseChannel() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"k8s:///\"));\n        final Path valid = kfs.getPath(\"/test\");\n        K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider);\n        assertTrue(k8sfc.isOpen());\n        k8sfc.close();\n        assertFalse(k8sfc.isOpen());\n    }\n\n    @Test\n    public void testChannelMustBeClosedRegardlessError() {\n        FileSystemProvider fsProvider = new K8SFileSystemProvider() {\n\n            @Override\n            public KubernetesClient createKubernetesClient() {\n                return CLIENT_FACTORY.get();\n            }\n        };\n\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"k8s:///\"));\n        final Path valid = kfs.getPath(\"/test\");\n        K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider);\n        assertTrue(k8sfc.isOpen());\n\n        k8sfc.ccf = null; // trigger an error\n        try {\n            k8sfc.close();\n            fail(\"Channel close should throw an exception.\");\n        } catch (Exception e) {\n        }\n        assertFalse(k8sfc.isOpen());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemInitTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Queue;\nimport java.util.stream.Collectors;\nimport java.util.stream.StreamSupport;\n\nimport com.google.common.collect.Lists;\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;\nimport io.fabric8.mockwebserver.Context;\nimport io.fabric8.mockwebserver.ServerRequest;\nimport io.fabric8.mockwebserver.ServerResponse;\nimport okhttp3.mockwebserver.MockWebServer;\nimport org.junit.AfterClass;\nimport org.junit.Assume;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.attributes.HiddenAttributes;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFileNameString;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjNameElementLabel;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getPathByFsObjCM;\n\npublic class K8SFileSystemInitTest {\n\n    public static KubernetesMockServer SERVER =\n            new KubernetesMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), false);\n    // The default namespace for MockKubernetes Server is 'test'\n    protected static String TEST_NAMESPACE = \"test\";\n    protected static ThreadLocal<KubernetesClient> CLIENT_FACTORY;\n\n    protected static final FileSystemProvider fsProvider = new K8SFileSystemProvider() {\n\n        @Override\n        public KubernetesClient createKubernetesClient() {\n            return CLIENT_FACTORY.get();\n        }\n\n    };\n    \n    protected static FileStore fstore;\n\n    @BeforeClass\n    public static void setup() {\n        SERVER.init();\n        CLIENT_FACTORY = ThreadLocal.withInitial(() -> SERVER.createClient());\n        //Checking the operating system before test execution\n        Assume.assumeFalse(\"k8s does not support in Windows platform\", System.getProperty(\"os.name\").toLowerCase().contains(\"windows\"));\n        fstore = fsProvider.getFileSystem(URI.create(\"default:///\")).getFileStores().iterator().next();\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE).delete();\n        CLIENT_FACTORY.get().close();\n        SERVER.destroy();\n    }\n    \n    @Test\n    public void testRoot() throws URISyntaxException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fileSystem.getPath(\"/\");\n        Map<String, String> ne = getFsObjNameElementLabel(root);\n        \n        List<Path> roots = StreamSupport.stream(fileSystem.getRootDirectories().spliterator(), false)\n                                        .collect(Collectors.toList());\n        assertThat(roots).asList().size().isEqualTo(1);\n        assertThat(roots.get(0)).isEqualTo(root);\n\n        /**\n         * Handling this hard coded dependency\n         * https://github.com/kiegroup/appformer/blob/92d05f8620fb775a9fdd96574273de2deda3d215/uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/ConfigurationServiceImpl.java#L129\n         */\n        assertThat(root.toUri().toString().contains(\"/master@\")).isTrue();\n        assertThat(root).isEqualTo(fileSystem.getPath(\"/path\").getRoot());\n        assertThat(root).isEqualTo(fileSystem.getPath(\"/path\").getParent());\n        assertThat(root.getRoot().equals(root)).isTrue();\n        assertThat(root.toString().equals(\"/\")).isTrue();\n        assertThat(root.toRealPath().toString().equals(\"/\")).isTrue();\n        assertThat(root.getParent()).isNull();\n        assertThat(root.getFileName()).isNull();\n        assertThat(root.getNameCount()).isEqualTo(0);\n        assertThat(root.iterator().hasNext()).isEqualTo(false);\n        assertThat(ne.size()).isEqualTo(0);\n        assertThat(getFileNameString(root).equals(\"/\")).isTrue();\n    }\n\n    @Test\n    public void testInitRoot() {\n        final FileSystem fs = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fs.getPath(\"/\");\n        final Path testParentDir = fs.getPath(\"/.testParentDir\");\n        final Path testDir = fs.getPath(\"/.testParentDir/.testInitRoot\");\n        final Path rPath = fs.getPath(\"./../.testInitRoot\");\n        \n        assertThat(root.getParent()).isNull();\n        assertThat(root.isAbsolute()).isTrue();\n\n        assertThat(rPath.isAbsolute()).isFalse();\n        assertThat(rPath.getRoot()).isNull();\n        \n        assertThat(testDir.isAbsolute()).isTrue();\n        assertThat(testDir.getParent()).isEqualTo(testParentDir);\n        assertThat(testDir.getRoot()).isEqualTo(root);\n        assertThat(testDir.getFileName()).isEqualTo(rPath.getFileName());\n        \n        Path aPath = ((K8SFileSystemProvider)fsProvider).toAbsoluteRealPath(rPath);\n        assertThat(aPath.getRoot()).isEqualTo(root);\n        assertThat(aPath.getParent()).isNotNull();\n        assertThat(aPath.isAbsolute()).isTrue();\n        assertThat(aPath.getFileName()).isEqualTo(rPath.getFileName());\n                                                  \n        assertThat(testDir.isAbsolute()).isTrue();\n        assertThat(testDir.getParent()).isEqualTo(testParentDir);\n        \n        assertThat(testParentDir.getParent()).isEqualTo(root);\n        assertThat(testParentDir).isEqualTo(((K8SFileSystemProvider)fsProvider).toAbsoluteRealPath(testParentDir));\n        \n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-dir-r-empty-configmap.yml\"))\n                                                     .get());\n        assertThat(Files.exists(root)).isTrue();\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().isEmpty();\n        }\n        \n        CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE).delete();\n        assertThat(Files.exists(root)).isFalse();\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().isEmpty();\n        }\n        assertThat(Files.exists(root)).isTrue();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), root).getData()).isNotNull();\n        \n        Files.createDirectory(testDir);\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(testParentDir)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().containsExactly(testDir);\n        }\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testAmbiguousCM() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path file = fileSystem.getPath(\"/testDir/testFile\");\n        \n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-file-configmap.yml\"))\n                                                     .get());\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-file-dup-configmap.yml\"))\n                                                     .get());        \n        getFsObjCM(CLIENT_FACTORY.get(), file);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testInvalidFsObjCM() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final ConfigMap cm = CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-file-invalid-configmap.yml\"))\n                                                     .get();\n        getPathByFsObjCM((K8SFileSystem)fileSystem, cm);\n    }\n    \n    @Test\n    public void testFileStore() {\n        final K8SFileSystem fs = (K8SFileSystem)fsProvider.getFileSystem(URI.create(\"default:///\"));\n        fs.lock();\n        fs.unlock();\n        assertThat(fs).isNotNull();\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void testFileStoreGetTotalSpace() {\n        fstore.getTotalSpace();\n    }\n    \n    @Test(expected = UnsupportedOperationException.class)\n    public void testFileStoreGetUsableSpace() {\n        fstore.getUsableSpace();\n    }\n    \n    @Test(expected = UnsupportedOperationException.class)\n    public void testFileStoreGetUnallocatedSpace() {\n        fstore.getUnallocatedSpace();\n    }\n    \n    @Test(expected = UnsupportedOperationException.class)\n    public void testNewFileChannel() {\n        final FileSystem fs = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        fsProvider.newFileChannel(fs.getPath(\"/\"), null);\n    }\n    \n    @Test\n    public void testGetFileStore() {\n        final FileSystem fs = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        FileStore fstore = fsProvider.getFileStore(fs.getPath(\"/\"));\n        assertThat(K8SFileStore.class.isInstance(fstore)).isTrue();\n    }\n    \n    @Test(expected = FileAlreadyExistsException.class)\n    public void testCheckFileExistsThenThrow() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path dir = fileSystem.getPath(\"/testDir\");\n\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                                     .get());\n        fsProvider.createDirectory(dir);\n    }\n    \n    @Test(expected = UnsupportedOperationException.class)\n    public void testCopyDirShouldFail() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path source = fileSystem.getPath(\"/testDir\");\n        final Path target = fileSystem.getPath(\"/testDir2\");\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                                     .get());\n        fsProvider.copy(source, target);\n    }\n    \n    @Test\n    public void testReadAttributes() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path dir = fileSystem.getPath(\"/testDir\");\n        \n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemInitTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                                     .get());\n        assertThat(fsProvider.readAttributes(dir, HiddenAttributes.class)).isNull();\n        assertThat(fsProvider.readAttributes(dir, BasicFileAttributes.class)).isNotNull();\n        assertThat(fsProvider.readAttributes(dir, BasicFileAttributes.class).isDirectory()).isTrue();\n        assertThat(fsProvider.readAttributes(dir, BasicFileAttributes.class).isRegularFile()).isFalse();\n        assertThat(fsProvider.readAttributes(dir, BasicFileAttributes.class).isSymbolicLink()).isFalse();\n        assertThat(fsProvider.readAttributes(dir, BasicFileAttributes.class).size()).isEqualTo(19);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/K8SFileSystemTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Queue;\n\nimport com.google.common.collect.Lists;\nimport io.fabric8.kubernetes.api.model.ConfigMap;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;\nimport io.fabric8.mockwebserver.Context;\nimport io.fabric8.mockwebserver.ServerRequest;\nimport io.fabric8.mockwebserver.ServerResponse;\nimport okhttp3.mockwebserver.MockWebServer;\nimport org.junit.AfterClass;\nimport org.junit.Assume;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.cloud.CloudClientConstants;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.assertj.core.api.AssertionsForClassTypes.catchThrowable;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_FSOBJ_CONTENT_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.CFG_MAP_LABEL_FSOBJ_TYPE_KEY;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.createOrReplaceParentDirFSCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getCreationTime;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjContentBytes;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getFsObjNameElementLabel;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getPathByFsObjCM;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.getSize;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.isDirectory;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.isFile;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemUtils.validateAndBuildPathLabel;\n\npublic class K8SFileSystemTest {\n\n    public static KubernetesMockServer SERVER =\n            new KubernetesMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), false);\n    // The default namespace for MockKubernetes Server is 'test'\n    protected static String TEST_NAMESPACE = \"test\";\n    protected static ThreadLocal<KubernetesClient> CLIENT_FACTORY;\n\n    protected static final FileSystemProvider fsProvider = new K8SFileSystemProvider() {\n\n            @Override\n            public KubernetesClient createKubernetesClient() {\n                return CLIENT_FACTORY.get();\n            }\n    };\n\n    protected String newFileWithContent(final Path newFile, final String testFileContent) throws IOException {\n        Files.createFile(newFile);\n        try (BufferedWriter writer = Files.newBufferedWriter(newFile, StandardCharsets.UTF_8)) {\n            writer.write(testFileContent, 0, testFileContent.length());\n        }\n        return testFileContent;\n    }\n\n    @BeforeClass\n    public static void setup() {\n        SERVER.init();\n        CLIENT_FACTORY = ThreadLocal.withInitial(() -> SERVER.createClient());\n        //Checking the operating system before test execution\n        Assume.assumeFalse(\"k8s does not support in Windows platform\", System.getProperty(\"os.name\").toLowerCase().contains(\"windows\"));\n        // Load testing KieServerState ConfigMap data into mock server from file\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-dir-r-configmap.yml\"))\n                                                     .get());\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                                     .get());\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-file-configmap.yml\"))\n                                                     .get());\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-dir-00-configmap.yml\"))\n                                                     .get());\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE).delete();\n        CLIENT_FACTORY.get().close();\n        SERVER.destroy();\n    }\n    \n    @Test\n    public void testSetup() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fileSystem.getPath(\"/\");\n        assertThat(root.getFileSystem().provider()).isEqualTo(fsProvider);\n    }\n\n    @Test\n    public void testGetCMByName() {\n        assertThat(CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                                 .withName(\"dummy\").get()).isNull();\n        assertThat(CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                                 .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get()).isNotNull();\n        assertThat(CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                                 .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\").get()).isNotNull();\n    }\n    \n    @Test \n    public void testCreateOrReplaceFSCM() throws IOException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testDir = fileSystem.getPath(\"/testCreateOrReplaceFSCMDir\");\n        final Path testFile = fileSystem.getPath(\"/testCreateOrReplaceFSCMDir/testCreateOrReplaceFSCMFile\");\n        \n        // Create a new empty dir under root\n        createOrReplaceFSCM(CLIENT_FACTORY.get(), \n                            testDir,\n                            createOrReplaceParentDirFSCM(CLIENT_FACTORY.get(), testDir, 0L, false),\n                            Collections.emptyMap(),\n                            true);\n        ConfigMap testDirCM = getFsObjCM(CLIENT_FACTORY.get(), testDir);\n        \n        ConfigMap rootCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\").get();\n\n        // Check CM data of the empty dir\n        assertThat(testDirCM).isNotNull();\n        assertThat(testDirCM.getMetadata().getLabels().get(\"k8s.fs.nio.java.uberfire.org/fsobj-name-0\"))\n                                                    .isEqualTo(\"testCreateOrReplaceFSCMDir\");\n        assertThat(testDirCM.getMetadata().getLabels().get(CFG_MAP_LABEL_FSOBJ_TYPE_KEY))\n                                                    .isEqualTo(K8SFileSystemObjectType.DIR.toString());\n        assertThat(testDirCM.getMetadata().getAnnotations().get(CFG_MAP_ANNOTATION_FSOBJ_SIZE_KEY))\n                                                    .isEqualTo(\"0\");\n        assertThat(testDirCM.getData().isEmpty()).isTrue();\n        \n        // Check the ref-link to the root CM\n        assertThat(testDirCM.getMetadata().getOwnerReferences().get(0).getKind())\n            .isEqualTo(rootCM.getKind());\n        assertThat(testDirCM.getMetadata().getOwnerReferences().get(0).getName())\n            .isEqualTo(rootCM.getMetadata().getName());\n        \n        // Create new file followed by testing write to and read from the file\n        String testFileContent = \"Hello World\";\n        newFileWithContent(testFile, testFileContent);\n        \n        ConfigMap newDirCM = getFsObjCM(CLIENT_FACTORY.get(), fileSystem.getPath(\"/testCreateOrReplaceFSCMDir\"));\n        ConfigMap newFileCM = getFsObjCM(CLIENT_FACTORY.get(), testFile);\n        \n        assertThat(newDirCM).isNotNull();\n        assertThat(newFileCM).isNotNull();\n        assertThat(newDirCM.getMetadata().getAnnotations().get(CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY))\n            .isNotNull();\n        assertThat(newFileCM.getMetadata().getAnnotations().get(CFG_MAP_ANNOTATION_FSOBJ_LAST_MODIFIED_TIMESTAMP_KEY))\n            .isNotNull();\n        assertThat(newFileCM.getData().get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n        assertThat(Files.size(testFile)).isEqualTo(testFileContent.length());\n    }\n\n    @Test\n    public void testGetFsObjCM() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fileSystem.getPath(\"/\");\n        final Path dir = fileSystem.getPath(\"/testDir\");\n        final Path file = fileSystem.getPath(\"/testDir/testFile\");\n        \n        ConfigMap rootCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\").get();\n        ConfigMap dirCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\").get();\n        ConfigMap fileCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get();\n        \n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), root)).isEqualTo(rootCM);\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), dir)).isEqualTo(dirCM);\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), file)).isEqualTo(fileCM);\n    }\n\n    @Test\n    public void testGetFsObjContentBytes() {\n        ConfigMap fileCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get();\n        \n        String fileContent = new String(getFsObjContentBytes(fileCM), \n                                        Charset.forName(CloudClientConstants.ENCODING));\n        assertThat(fileContent).isEqualTo(\"This is a test file\");\n    }\n    \n    @Test\n    public void testGetFsObjNameElement() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path aFile = fileSystem.getPath(\"/testDir/../testDir/./testFile\");\n        Map<String, String> ne = getFsObjNameElementLabel(((K8SFileSystemProvider)fsProvider).toAbsoluteRealPath(aFile));\n        assertThat(ne.size()).isEqualTo(2);\n        assertThat(ne.containsValue(\"testDir\")).isTrue();\n        assertThat(ne.containsValue(\"testFile\")).isTrue();\n    }\n\n    @Test\n    public void testGetSize() {\n        ConfigMap cfm = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                                      .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get();\n        assertThat(getSize(cfm)).isEqualTo(19);\n    }\n\n    @Test\n    public void testGetCreationTime() {\n        ConfigMap cfm = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                                      .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get();\n        assertThat(getCreationTime(cfm)).isEqualTo(0);\n    }\n\n    @Test\n    public void testGetPathByFsObjCM() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path f = kfs.getPath(\"/testDir/testFile\");\n\n        assertThat(f.getRoot()).isNotNull();\n        assertThat(f.getNameCount()).isEqualTo(2);\n        assertThat(f.getParent()).isEqualTo(kfs.getPath(\"/testDir\"));\n        assertThat(f.getName(0).toString()).isEqualTo(\"testDir\");\n        assertThat(f.getName(1).toString()).isEqualTo(\"testFile\");\n        assertThat(f.toUri().toString()).isEqualTo(fsProvider.getScheme() + \":///testDir/testFile\");\n        \n        ConfigMap rootCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\").get();\n        ConfigMap dirCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\").get();\n        ConfigMap fileCM = CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE)\n                .withName(\"k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\").get();\n        \n        assertThat(getPathByFsObjCM(kfs, rootCM)).isEqualTo(kfs.getPath(\"/\"));\n        assertThat(getPathByFsObjCM(kfs, dirCM)).isEqualTo(kfs.getPath(\"/testDir\"));\n        assertThat(getPathByFsObjCM(kfs, fileCM)).isEqualTo(kfs.getPath(\"/testDir/testFile\"));\n    }\n\n    @Test\n    public void testIsFile() {\n        ConfigMap cfm = CLIENT_FACTORY.get()\n                                      .configMaps()\n                                      .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-file-configmap.yml\"))\n                                      .get();\n        assertThat(isFile(cfm)).isTrue();\n        assertThat(isDirectory(cfm)).isFalse();\n    }\n\n    @Test\n    public void testIsDir() {\n        ConfigMap cfm = CLIENT_FACTORY.get()\n                                      .configMaps()\n                                      .load(K8SFileSystemTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                      .get();\n        assertThat(isFile(cfm)).isFalse();\n        assertThat(isDirectory(cfm)).isTrue();\n    }\n\n    @Test\n    public void testFileMetadata() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path d = kfs.getPath(\"/testDir\");\n        final Path f = kfs.getPath(\"/testDir/testFile\");\n        final Path e = kfs.getPath(\"/doesNotExist\");\n        \n        assertThat(Files.exists(e)).isFalse();\n        assertThat(Files.notExists(e)).isTrue();\n        assertThat(Files.isDirectory(d)).isTrue();\n        assertThat(Files.isRegularFile(d)).isFalse();\n        assertThat(Files.isDirectory(f)).isFalse();\n        assertThat(Files.isRegularFile(f)).isTrue();\n        \n        assertThat(Files.isReadable(f)).isTrue();\n        assertThat(Files.isWritable(f)).isTrue();\n        assertThat(Files.isExecutable(f)).isFalse();\n    }\n    \n    @Test\n    public void testDelete() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path f = kfs.getPath(\"/testDeleteFile\");\n\n        String testFileContent = \"Hello World\";\n        newFileWithContent(f, testFileContent);\n\n        assertThat(Files.exists(f)).isTrue();\n        Files.delete(f);\n        assertThat(Files.exists(f)).isFalse();\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void testDeleteNotExistingFile() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path f = kfs.getPath(\"/testDeleteNotExistingFile\");\n\n        Files.delete(f);\n    }\n\n    @Test\n    public void testDeleteIfExists() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path f = kfs.getPath(\"/testDeleteIfExists\");\n\n        assertThat(Files.deleteIfExists(f)).isFalse();\n\n        String testFileContent = \"Hello World\";\n        newFileWithContent(f, testFileContent);\n\n        assertThat(Files.exists(f)).isTrue();\n        assertThat(Files.deleteIfExists(f)).isTrue();\n        assertThat(Files.exists(f)).isFalse();\n    }\n\n    @Test\n    public void testCopy() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path src = kfs.getPath(\"/testCopySrc\");\n        final Path target = kfs.getPath(\"/testCopyTarget\");\n        \n        String testFileContent = \"Test copy capability\";\n        newFileWithContent(src, testFileContent);\n        \n        Files.copy(src, target);\n        \n        assertThat(Files.exists(target)).isTrue();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), target).getData()\n                   .get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n    }\n\n    @Test\n    public void testMove() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path src = kfs.getPath(\"/testMoveSrc\");\n        final Path target = kfs.getPath(\"/testMoveTarget\");\n        \n        String testFileContent = \"Test move capability\";\n        newFileWithContent(src, testFileContent);\n        \n        Files.move(src, target);\n        \n        assertThat(Files.notExists(src)).isTrue();\n        assertThat(Files.exists(target)).isTrue();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), target).getData()\n                   .get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n    }\n\n    @Test\n    public void testCreateAndReadDir() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testDir = kfs.getPath(\"/testDir\");\n        final Path testFile = kfs.getPath(\"/testDir/testFile\");\n\n        assertThat(Files.exists(testDir)).isTrue();\n        assertThat(Files.isDirectory(testDir)).isTrue();\n        assertThat(Files.isHidden(testDir)).isFalse();\n\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(testDir)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().containsExactly(testFile);\n        }\n    }\n\n    @Test\n    public void testCreateAndReadHiddenDir() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path aDir = kfs.getPath(\"/.testCreateAndReadDir\");\n        final Path root = aDir.getRoot();\n        \n        Files.createDirectory(aDir);\n        \n        assertThat(Files.exists(aDir)).isTrue();\n        assertThat(Files.isDirectory(aDir)).isTrue();\n        assertThat(Files.isHidden(aDir)).isTrue();\n\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().contains(aDir);\n        }\n    }\n\n    @Test\n    public void testCreateDuplicateDirectory() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testDir = kfs.getPath(\"/testCreateDuplicateDirectory\");\n\n        Files.createDirectory(testDir);\n\n        assertThat(Files.exists(testDir)).isTrue();\n        assertThat(Files.isDirectory(testDir)).isTrue();\n\n        assertThat(catchThrowable(() -> Files.createDirectory(testDir)))\n            .isInstanceOf(org.uberfire.java.nio.file.FileAlreadyExistsException.class);\n    }\n\n    @Test\n    public void testOverwriteFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testFile = kfs.getPath(\"/testOverwriteFile\");\n        final String content = \"Large content, blah, blah, blah...\";\n        final String smallerContent = \"Small\";\n        \n        newFileWithContent(testFile, content);\n        assertThat(Files.exists(testFile)).isTrue();\n\n        try (BufferedWriter writer = Files.newBufferedWriter(testFile, Charset.forName(\"UTF-8\"))) {\n            writer.write(smallerContent, 0, smallerContent.length());\n        }\n        \n        StringBuffer sb = new StringBuffer();\n        try (BufferedReader reader = Files.newBufferedReader(testFile, Charset.forName(\"UTF-8\"))) {\n            String line = null;\n            while ((line = reader.readLine()) != null) {\n                sb.append(line);\n            }\n        }\n        \n        assertThat(sb.toString()).isEqualTo(smallerContent);\n        \n        try (BufferedWriter writer = Files.newBufferedWriter(testFile, Charset.forName(\"UTF-8\"))) {\n            writer.write(content, 0, content.length());\n        }\n        \n        sb = new StringBuffer();\n        try (BufferedReader reader = Files.newBufferedReader(testFile, Charset.forName(\"UTF-8\"))) {\n            String line = null;\n            while ((line = reader.readLine()) != null) {\n                sb.append(line);\n            }\n        }\n        \n        assertThat(sb.toString()).isEqualTo(content);\n    }\n    \n    @Test \n    public void testParentDirShouldBeUpdatedAfterDelete() throws IOException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fileSystem.getPath(\"/\");\n        final Path testDir = fileSystem.getPath(\"/testParentDirShouldBeUpdatedAfterDeleteDir\");\n        final Path testFile = fileSystem.getPath(\"/testParentDirShouldBeUpdatedAfterDeleteDir/testParentDirShouldBeUpdatedAfterDeleteFile\");\n        \n        newFileWithContent(testFile, \"I'm here\");\n        assertThat(Files.deleteIfExists(testFile)).isTrue();\n        assertThat(Files.size(testDir)).isEqualTo(0);\n        \n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), testDir).getData().isEmpty()).isTrue();\n\n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().contains(testDir);\n        }\n        \n        try (DirectoryStream<Path> stream = Files.newDirectoryStream(testDir)) {\n            ArrayList<Path> dirContent = Lists.newArrayList(stream);\n            assertThat(dirContent).asList().isEmpty();\n        }\n    }   \n    \n    @Test\n    public void testFileNameValidation() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path invalid = kfs.getPath(\"/#weirdFileName$@#^&*\");\n        final Path hidden = kfs.getPath(\"/.testFileNameValidation\");\n        final Path tooLongFileName = kfs.getPath(\"/testFileNameValidationForTooLongFileNameWhichIsLongerThanSixtyThreeCharacters\");\n        \n        assertThat(catchThrowable(() -> validateAndBuildPathLabel(new HashMap<String, String>(), invalid.getFileName())))\n            .isInstanceOf(InvalidPathException.class);\n        assertThat(catchThrowable(() -> validateAndBuildPathLabel(new HashMap<String, String>(), hidden.getFileName())))\n            .isNull();\n        \n        assertThat(catchThrowable(() -> newFileWithContent(invalid, \"blah...\")))\n            .isInstanceOf(org.uberfire.java.nio.IOException.class)\n            .hasRootCauseInstanceOf(InvalidPathException.class);\n        assertThat(catchThrowable(() -> newFileWithContent(tooLongFileName, \"blah...\")))\n            .isInstanceOf(org.uberfire.java.nio.IOException.class)\n            .hasRootCauseInstanceOf(InvalidPathException.class);\n    }\n    \n    @Test\n    public void testCreateHiddenFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path hidden = kfs.getPath(\"/.testCreateHiddenDir/.testCreateHiddenFile\");\n        \n        newFileWithContent(hidden, \"blah...\");\n        ConfigMap cm = getFsObjCM(CLIENT_FACTORY.get(), hidden);\n        assertThat(Files.exists(hidden)).isTrue();\n        assertThat(Files.isHidden(hidden)).isTrue();\n        assertThat(getPathByFsObjCM(kfs, cm)).isEqualTo(hidden); \n    }\n\n    @Test\n    public void testCopyHiddenFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path src = kfs.getPath(\"/.testCopyHiddenFileSrcFile\");\n        final Path target = kfs.getPath(\"/.testCopyHiddenFileTargetFile\");\n\n        String testFileContent = \"Test copy capability\";\n        newFileWithContent(src, testFileContent);\n\n        Files.copy(src, target);\n\n        assertThat(Files.exists(target)).isTrue();\n        assertThat(Files.isHidden(target)).isTrue();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), target).getData()\n                   .get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n    }\n\n    @Test\n    public void testMoveHiddenFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path src = kfs.getPath(\"/.testMoveHiddenFileSrc\");\n        final Path targetPublic = kfs.getPath(\"/testMoveHiddenFileTargetPublic\");\n        final Path targetHidden = kfs.getPath(\"/.testMoveHiddenFileTargetHidden\");\n\n        String testFileContent = \"Test move capability\";\n        newFileWithContent(src, testFileContent);\n\n        Files.move(src, targetPublic);\n\n        assertThat(Files.notExists(src)).isTrue();\n        assertThat(Files.exists(targetPublic)).isTrue();\n        assertThat(Files.isHidden(targetPublic)).isFalse();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), targetPublic).getData()\n                   .get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n\n        Files.move(targetPublic, targetHidden);\n\n        assertThat(Files.notExists(targetPublic)).isTrue();\n        assertThat(Files.exists(targetHidden)).isTrue();\n        assertThat(Files.isHidden(targetHidden)).isTrue();\n        assertThat(getFsObjCM(CLIENT_FACTORY.get(), targetHidden).getData()\n                   .get(CFG_MAP_FSOBJ_CONTENT_KEY)).isEqualTo(testFileContent);\n    }\n\n    @Test\n    public void testReadNotExistingFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testFile = kfs.getPath(\"/testReadNotExistingFile\");\n\n        assertThat(catchThrowable(() -> Files.newBufferedReader(testFile, Charset.forName(\"UTF-8\"))))\n            .isInstanceOf(org.uberfire.java.nio.file.NoSuchFileException.class);\n    }\n\n    @Test\n    public void testIsHiddenNotExistingFile() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testFile = kfs.getPath(\"/testIsHiddenNotExistingFile\");\n\n        assertThat(catchThrowable(() -> Files.isHidden(testFile)))\n            .isInstanceOf(org.uberfire.java.nio.IOException.class);\n    }\n\n    @Test\n    public void testIsHiddenManyNestedFolders() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testFolder11 = kfs.getPath(\"/testIsHiddenManyNestedFolders/1/2/3/4/5/6/7/8/9/10/11\");\n        final Path testFolder12 = kfs.getPath(\"/testIsHiddenManyNestedFolders/1/2/3/4/5/6/7/8/9/10/11/.12\");\n\n        Files.createDirectory(testFolder12);\n\n        assertThat(Files.isHidden(testFolder11)).isFalse();\n        assertThat(Files.isHidden(testFolder12)).isTrue();\n    }\n\n    @Test\n    public void testGetDirectoryContentManyNestedFolders() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path testFolder11 = kfs.getPath(\"/testGetDirectoryContentManyNestedFolders/1/2/3/4/5/6/7/8/9/.10/11\");\n        final Path testFolder12 = kfs.getPath(\"/testGetDirectoryContentManyNestedFolders/1/2/3/4/5/6/7/8/9/.10/11/.12\");\n\n        Files.createDirectory(testFolder12);\n\n        Path[] directoryContent = ((K8SFileSystemProvider)fsProvider).getDirectoryContent(testFolder11);\n        assertThat(directoryContent).contains(testFolder12);\n    }\n    \n    \n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/K8SWatchServiceTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Queue;\n\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport io.fabric8.kubernetes.client.Watcher.Action;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesCrudDispatcher;\nimport io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;\nimport io.fabric8.mockwebserver.Context;\nimport io.fabric8.mockwebserver.ServerRequest;\nimport io.fabric8.mockwebserver.ServerResponse;\nimport okhttp3.mockwebserver.MockWebServer;\nimport org.junit.AfterClass;\nimport org.junit.Assume;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.awaitility.Awaitility.await;\nimport static org.uberfire.java.nio.fs.k8s.K8SFileSystemConstants.K8S_FS_NO_IMPL;\n\npublic class K8SWatchServiceTest {\n\n    public static KubernetesMockServer SERVER =\n            new KubernetesMockServer(new Context(), new MockWebServer(), new HashMap<ServerRequest, Queue<ServerResponse>>(), new KubernetesCrudDispatcher(), false);\n    // The default namespace for MockKubernetes Server is 'test'\n    protected static String TEST_NAMESPACE = \"test\";\n    protected static ThreadLocal<KubernetesClient> CLIENT_FACTORY;\n\n    protected static final FileSystemProvider fsProvider = new K8SFileSystemProvider() {\n\n        @Override\n        public KubernetesClient createKubernetesClient() {\n            return CLIENT_FACTORY.get();\n        }\n\n    };\n\n    @BeforeClass\n    public static void setup() {\n        SERVER.init();\n        CLIENT_FACTORY = ThreadLocal.withInitial(() -> SERVER.createClient());\n        //Checking the operating system before test execution\n        Assume.assumeFalse(\"k8s does not support in Windows platform\", System.getProperty(\"os.name\").toLowerCase().contains(\"windows\"));\n        // Load testing KieServerState ConfigMap data into mock server from file\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SWatchServiceTest.class.getResourceAsStream(\"/test-k8sfs-dir-r-configmap.yml\"))\n                                                     .get());\n        CLIENT_FACTORY.get()\n                      .configMaps()\n                      .inNamespace(TEST_NAMESPACE)\n                      .createOrReplace(CLIENT_FACTORY.get().configMaps()\n                                                     .load(K8SWatchServiceTest.class.getResourceAsStream(\"/test-k8sfs-dir-0-configmap.yml\"))\n                                                     .get());\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        CLIENT_FACTORY.get().configMaps().inNamespace(TEST_NAMESPACE).delete();\n        CLIENT_FACTORY.get().close();\n        SERVER.destroy();\n    }\n\n    @Test\n    public void testSetup() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = fileSystem.getPath(\"/\");\n        final Path dir = fileSystem.getPath(\"/testDir\");\n\n        assertThat(root.getFileSystem().provider()).isEqualTo(fsProvider);\n        assertThat(Files.exists(root)).isTrue();\n        assertThat(Files.exists(dir)).isTrue();\n        assertThat(Files.isDirectory(root)).isTrue();\n        assertThat(Files.isDirectory(root)).isTrue();\n    }\n\n    @Test\n    public void testWatchServiceOpenAndClose() throws URISyntaxException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final WatchService ws = fileSystem.newWatchService();\n        assertThat(ws.isClose()).isFalse();\n        ws.close();\n        await().until(ws::isClose);\n        assertThat(ws.isClose()).isTrue();\n    }\n\n    @Test\n    public void testMapActionToKind() {\n        assertThat(K8SFileSystemUtils.mapActionToKind(Action.ERROR).isPresent()).isFalse();\n        assertThat(K8SFileSystemUtils.mapActionToKind(Action.ADDED).get())\n            .isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n        assertThat(K8SFileSystemUtils.mapActionToKind(Action.MODIFIED).get())\n            .isEqualTo(StandardWatchEventKind.ENTRY_MODIFY);\n        assertThat(K8SFileSystemUtils.mapActionToKind(Action.DELETED).get())\n            .isEqualTo(StandardWatchEventKind.ENTRY_DELETE);\n    }\n\n    @Test\n    public void testWatchKey() {\n        final K8SFileSystem fileSystem = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path dir = fileSystem.getPath(\"/testDir\");\n\n        boolean isWSClosed = false;\n        K8SWatchKey wk = new K8SWatchKey(new K8SWatchService(fileSystem) {\n\n            @Override\n            public boolean isClose() {\n                return isWSClosed;\n            }\n        }, dir);\n\n        assertThat(wk.isValid()).isTrue();\n        assertThat(wk.pollEvents()).asList().isEmpty();\n        assertThat(wk.watchable()).isEqualTo(dir);\n        assertThat(wk.postEvent(StandardWatchEventKind.ENTRY_CREATE)).isTrue();\n        assertThat(wk.isQueued()).isFalse();\n\n        wk.signal();\n        assertThat(wk.isQueued()).isTrue();\n        assertThat(wk.reset()).isTrue();\n        assertThat(wk.pollEvents()).asList().isEmpty();\n        assertThat(wk.isQueued()).isFalse();\n\n        assertThat(wk.postEvent(StandardWatchEventKind.ENTRY_DELETE)).isTrue();\n        wk.signal();\n        assertThat(wk.isQueued()).isTrue();\n\n        List<WatchEvent<?>> eventList = wk.pollEvents();\n        assertThat(eventList.size()).isEqualTo(1);\n\n        WatchEvent<?> event = eventList.get(0);\n        assertThat(event.kind()).isEqualTo(StandardWatchEventKind.ENTRY_DELETE);\n        assertThat(event.count()).isEqualTo(1);\n        WatchContext wc = (WatchContext) event.context();\n        assertThat(wc.getPath()).isEqualTo(dir.getFileName());\n        assertThat(wc.getOldPath()).isEqualTo(dir.getFileName());\n        assertThat(wc.getSessionId()).isEqualTo(K8S_FS_NO_IMPL);\n        assertThat(wc.getMessage()).isEqualTo(K8S_FS_NO_IMPL);\n        assertThat(wc.getUser()).isEqualTo(K8S_FS_NO_IMPL);\n\n        wk.cancel();\n        assertThat(wk.isValid()).isFalse();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/SeekableInMemoryByteChannelTestCase.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s;\n\nimport java.io.BufferedReader;\nimport java.io.InputStreamReader;\nimport java.io.UnsupportedEncodingException;\nimport java.nio.ByteBuffer;\nimport java.util.logging.Logger;\n\nimport org.junit.After;\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\n\n\npublic class SeekableInMemoryByteChannelTestCase {\n\n    @SuppressWarnings(\"unused\")\n    private static final Logger log = Logger.getLogger(SeekableInMemoryByteChannelTestCase.class.getName());\n\n    private static final String CONTENTS_SMALLER_BUFFER = \"Small\";\n    private static final String CONTENTS_BIGGER_BUFFER = \"Large............\";\n\n    private static final String UTF8 = \"UTF-8\";\n\n    private SeekableInMemoryByteChannel channel;\n\n    private ByteBuffer smallerBuffer;\n    private ByteBuffer biggerBuffer;\n\n    @Before\n    public void init() throws UnsupportedEncodingException {\n        this.channel = new SeekableInMemoryByteChannel();\n        smallerBuffer = ByteBuffer.wrap(CONTENTS_SMALLER_BUFFER.getBytes(UTF8));\n        biggerBuffer = ByteBuffer.wrap(CONTENTS_BIGGER_BUFFER.getBytes(UTF8));\n    }\n\n    @After\n    public void closeChannel() throws IOException {\n        if (this.channel.isOpen()) {\n            this.channel.close();\n        }\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void readAfterCloseThrowsException() throws IOException {\n        this.channel.close();\n        this.channel.read(ByteBuffer.wrap(new byte[] {}));\n    }\n\n    @Test(expected = org.uberfire.java.nio.IOException.class)\n    public void writeAfterCloseThrowsException() throws IOException {\n        this.channel.close();\n        this.channel.write(ByteBuffer.wrap(new byte[] {}));\n    }\n\n    @Test\n    public void isOpenTrue() throws IOException {\n        Assert.assertTrue(\"Channel should report open before it's closed\", this.channel.isOpen());\n    }\n\n    @Test\n    public void isOpenFalseAfterClose() throws IOException {\n        this.channel.close();\n        Assert.assertFalse(\"Channel should report not open after close\", this.channel.isOpen());\n    }\n\n    @Test\n    public void positionInit0() throws IOException {\n        Assert.assertEquals(\"Channel should init to position 0\", 0, this.channel.position());\n    }\n\n    @Test\n    public void sizeInit0() throws IOException {\n        Assert.assertEquals(\"Channel should init to size 0\", 0, this.channel.size());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void readRequiresBuffer() throws IOException {\n        this.channel.read(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void writeRequiresBuffer() throws IOException {\n        this.channel.write(null);\n    }\n\n    @Test\n    public void read() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        final int newPosition = 2;\n        final byte[] contents = new byte[2];\n        // Read 2 bytes from the new position\n        final int numBytesRead = this.channel.position(newPosition).read(ByteBuffer.wrap(contents));\n        final String expected = \"al\";\n        final String contentsRead = new String(contents, UTF8);\n        Assert.assertEquals(\"Read should report correct number of bytes read\", contents.length, numBytesRead);\n        Assert.assertEquals(\"Channel should respect explicit position during reads\", expected, contentsRead);\n    }\n\n    @Test\n    public void getContent() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        final BufferedReader reader = new BufferedReader(new InputStreamReader(this.channel.getContent()));\n        final String contents = reader.readLine();\n        Assert.assertEquals(\"Contents read were not as expected\", CONTENTS_SMALLER_BUFFER, contents);\n    }\n\n    @Test\n    public void readDestinationBiggerThanChannel() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        final ByteBuffer destination = biggerBuffer;\n        Assert.assertTrue(\"Test setup incorrect, should be trying to read into a buffer greater than our size\",\n            destination.remaining() > this.channel.size());\n        // Read more bytes than we currently have size\n        final int numBytesRead = this.channel.position(0).read(destination);\n        Assert.assertEquals(\"Read to a buffer greater than our size should read only up to our size\",\n            this.channel.size(), numBytesRead);\n    }\n\n    @Test\n    public void nothingToRead() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        // Read a byte from a position past the size\n        final int numBytesRead = this.channel.position(this.channel.size() + 3).read(ByteBuffer.wrap(new byte[1]));\n        Assert.assertEquals(\"Read on position > size should return -1\", -1, numBytesRead);\n    }\n\n    @Test\n    public void write() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        final int newPosition = 2;\n        final int numBytesWritten = this.channel.position(newPosition).write(ByteBuffer.wrap(\"DR\".getBytes(UTF8)));\n        // Read 2 bytes from the new position\n        final byte[] contents = new byte[2];\n        this.channel.position(newPosition).read(ByteBuffer.wrap(contents));\n        final String expected = \"DR\";\n        final String read = new String(contents, UTF8);\n        Assert.assertEquals(\"Write should report correct number of bytes written\", 2, numBytesWritten);\n        Assert.assertEquals(\"Channel should respect explicit position during writes\", expected, read);\n    }\n\n    @Test\n    public void writeWithPositionPastSize() throws IOException, java.io.IOException {\n        this.channel.write(smallerBuffer);\n        smallerBuffer.clear();\n        final int gap = 5;\n        // Write again, after a gap past the current size\n        this.channel.position(this.channel.size() + gap).write(smallerBuffer);\n        smallerBuffer.clear();\n        Assert.assertEquals(\"Channel size should be equal to the size of the writes we put in, plus \"\n            + \"the gap when we set the position tpo be greater than the size\", smallerBuffer.remaining() * 2 + gap,\n            this.channel.size());\n    }\n\n    @Test\n    public void positionSetPastSize() throws IOException {\n        final int newPosition = 30;\n        this.channel.position(newPosition);\n        Assert.assertEquals(\"Channel should be able to be set past size\", newPosition, this.channel.position());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void negativePositionProhibited() throws IOException {\n        this.channel.position(-1);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void exceedMaxIntegerPositionProhibited() throws IOException {\n        final long newPosition = Integer.MAX_VALUE + 1L;\n        Assert.assertTrue(\"Didn't set up new position to be out of int bounds\", newPosition > Integer.MAX_VALUE);\n        this.channel.position(newPosition); // Exception expected\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void negativeTruncateProhibited() throws IOException {\n        this.channel.truncate(-1);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void exceedMaxIntegerTruncateProhibited() throws IOException {\n        final long truncateValue = Integer.MAX_VALUE + 1L;\n        Assert.assertTrue(\"Didn't set up new truncate to be out of int bounds\", truncateValue > Integer.MAX_VALUE);\n        this.channel.truncate(truncateValue); // Exception expected\n    }\n\n    @Test\n    public void size() throws IOException {\n        this.channel.write(smallerBuffer);\n        Assert.assertEquals(\"Channel should report correct size\", this.smallerBuffer.clear().remaining(),\n            this.channel.size());\n    }\n\n    @Test\n    public void truncate() throws IOException {\n        this.channel.write(smallerBuffer);\n        final int newSize = (int) this.channel.size() - 3;\n        this.channel.truncate(newSize);\n        // Correct size?\n        Assert.assertEquals(\"Channel should report correct size after truncate\", newSize, this.channel.size());\n        // Correct position?\n        Assert.assertEquals(\"Channel should report adjusted position after truncate\", newSize, this.channel.position());\n    }\n\n    @Test\n    public void truncateLargerThanSizeRepositions() throws IOException {\n        this.channel.write(smallerBuffer);\n        final int oldSize = (int) this.channel.size();\n        final int newSize = oldSize + 3;\n        this.channel.truncate(newSize);\n        // Size unchanged?\n        Assert.assertEquals(\"Channel should report unchanged size after truncate to bigger value\", oldSize,\n            this.channel.size());\n        // Correct position, beyond size?\n        Assert.assertEquals(\"Channel should report unchanged position after truncate to bigger value\", oldSize,\n            this.channel.position());\n    }\n\n    @Test(expected = IOException.class)\n    public void exceedMaxCapacityProhibited() throws IOException {\n        this.channel = new SeekableInMemoryByteChannel(5);\n        this.channel.write(biggerBuffer); // Exception expected\n    }\n    \n    @Test\n    public void emptyContentAfterClose() {\n        this.channel.write(smallerBuffer);\n        Assert.assertTrue(this.channel.toString().length() > 0);\n        this.channel.close();\n        Assert.assertTrue(this.channel.toString().length() == 0);\n    }\n    \n    @Test(expected = IllegalArgumentException.class)\n    public void readFromNullDestination() {\n        this.channel.read(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void writeToNullSource() {\n        this.channel.write(null);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidPosition() {\n        this.channel.position(-1);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void invalidTruncate() {\n        this.channel.truncate(-1);\n    }\n\n    @Test(expected = IOException.class)\n    public void writeAfterClose() {\n        this.channel.close();\n        this.channel.write(ByteBuffer.wrap(new byte[0]));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/java/org/uberfire/java/nio/fs/k8s/integrationtests/K8SFileSystemProviderIntegrationTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.fs.k8s.integrationtests;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.Callable;\nimport java.util.concurrent.TimeUnit;\n\nimport io.fabric8.kubernetes.client.Config;\nimport io.fabric8.kubernetes.client.ConfigBuilder;\nimport io.fabric8.kubernetes.client.DefaultKubernetesClient;\nimport io.fabric8.kubernetes.client.KubernetesClient;\nimport org.apache.commons.io.IOUtils;\nimport org.awaitility.Awaitility;\nimport org.awaitility.Duration;\nimport org.junit.After;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.java.nio.fs.k8s.K8SFileSystem;\nimport org.uberfire.java.nio.fs.k8s.K8SFileSystemProvider;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\n\npublic class K8SFileSystemProviderIntegrationTest {\n\n    private static final String KUBERNETES_MAIN_API_URL = System.getProperty(Config.KUBERNETES_MASTER_SYSTEM_PROPERTY);\n    private static final String KUBERNETES_MAIN_API_TOKEN = System.getProperty(Config.KUBERNETES_OAUTH_TOKEN_SYSTEM_PROPERTY);\n    private static final String TEST_NAMESPACE = \"k8sfsp-test\";\n    private static KubernetesClient client;\n\n    protected static final FileSystemProvider fsProvider = new K8SFileSystemProvider();\n\n    @BeforeClass\n    public static void setup() {\n        System.setProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY, TEST_NAMESPACE);\n\n        Config config = new ConfigBuilder()\n                .withMasterUrl(KUBERNETES_MAIN_API_URL)\n                .withOauthToken(KUBERNETES_MAIN_API_TOKEN)\n                .withTrustCerts(true)\n                .withNamespace(TEST_NAMESPACE)\n                .build();\n        client = new DefaultKubernetesClient(config);\n        client.namespaces().createOrReplaceWithNew().withNewMetadata()\n                                                    .withName(TEST_NAMESPACE)\n                                                    .endMetadata()\n                                                    .done();\n    }\n\n    @After\n    public void cleanNamespace() {\n        client.configMaps().inNamespace(TEST_NAMESPACE).delete();\n    }\n\n    @AfterClass\n    public static void tearDown() {\n        client.namespaces().withName(TEST_NAMESPACE).delete();\n        client.close();\n        System.clearProperty(Config.KUBERNETES_NAMESPACE_SYSTEM_PROPERTY);\n    }\n\n    @Test\n    public void simpleRootFolderCreateDeleteTest() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        Path folderInRootFolder = fileSystem.getPath(\"/test\");\n\n        assertThat(Files.exists(folderInRootFolder)).isFalse();\n        assertThat(Files.deleteIfExists(folderInRootFolder)).isFalse();\n        Files.createDirectory(folderInRootFolder);\n        assertThat(Files.deleteIfExists(folderInRootFolder)).isTrue();\n    }\n\n    @Test\n    public void simpleRootFileCreateDeleteTest() throws IOException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        Path fileInRootFolder = fileSystem.getPath(\"/test.txt\");\n\n        assertThat(Files.exists(fileInRootFolder)).isFalse();\n        assertThat(Files.deleteIfExists(fileInRootFolder)).isFalse();\n\n        createOrEditFile(fileInRootFolder, \"Hello\");\n        assertThat(Files.deleteIfExists(fileInRootFolder)).isTrue();\n    }\n\n    @Test\n    public void testDeleteRoot() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"k8s:///\"));\n        final Path testDir = kfs.getPath(\"/.testDeleRootDir\");\n        final Path testFile = kfs.getPath(\"/.testDeleRootDir/.testDeleRootDirFile\");\n        final Path root = testFile.getRoot();\n\n        String testFileContent = \"Hello World\";\n        createOrEditFile(testFile, testFileContent);\n\n        assertThat(Files.exists(testDir)).isTrue();\n        Files.delete(root);\n        assertThat(Files.exists(testDir)).isFalse();\n        assertThat(Files.exists(testFile)).isFalse();\n    }\n    \n    @Test\n    public void testDeleteFolderWithFiles() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"k8s:///\"));\n        final Path testDir = kfs.getPath(\"/testDir\");\n        final Path testFirstFile = kfs.getPath(\"/testDir/testFirstFile\");\n        final Path testSecondFile = kfs.getPath(\"/testDir/testSecondFile\");\n\n        String testFileContent = \"Hello World\";\n        createOrEditFile(testFirstFile, testFileContent);\n        createOrEditFile(testSecondFile, testFileContent);\n\n        assertThat(Files.exists(testDir)).isTrue();\n        Files.delete(testDir);\n        assertThat(Files.exists(testDir)).isFalse();\n        assertThat(Files.exists(testFirstFile)).isFalse();\n        assertThat(Files.exists(testSecondFile)).isFalse();\n    }\n\n    @Test(expected = FileAlreadyExistsException.class)\n    public void simpleRootFolderCreateDuplicateFolderTest() {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        Path folderInRootFolder = fileSystem.getPath(\"/test\");\n\n        Files.createDirectory(folderInRootFolder);\n        Files.createDirectory(folderInRootFolder);\n    }\n\n    @Test\n    public void simpleRootFileEditFileTest() throws IOException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        Path fileInRootFolder = fileSystem.getPath(\"/test.txt\");\n\n        createOrEditFile(fileInRootFolder, \"Hello\");\n        assertThat(readFile(fileInRootFolder)).isEqualTo(\"Hello\");\n        createOrEditFile(fileInRootFolder, \"Welcome\");\n        assertThat(readFile(fileInRootFolder)).isEqualTo(\"Welcome\");\n        createOrEditFile(fileInRootFolder, \"Hi\");\n        assertThat(readFile(fileInRootFolder)).isEqualTo(\"Hi\");\n    }\n\n    @Test(expected = NoSuchFileException.class)\n    public void inputStreamFromNotExistingFileTest() throws IOException {\n        final FileSystem fileSystem = fsProvider.getFileSystem(URI.create(\"default:///\"));\n        Path fileInRootFolder = fileSystem.getPath(\"/test.txt\");\n\n        readFile(fileInRootFolder);\n    }\n\n    @Test\n    public void testWatchCreateDirectory() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            // Check directory creation events, root is created first\n            Files.createDirectory(watchDir);\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            List<WatchEvent<?>> rootEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createRootKey, rootEvents, 1));\n            assertThat(rootEvents).asList().hasSize(1);\n\n            WatchEvent<?> firstEvent = rootEvents.get(0);\n            assertThat(firstEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstEvent.context()).getPath()).isNull();\n\n            // Watched directory is created then\n            WatchKey createWatchDirKey = watcher.poll();\n            assertThat(createWatchDirKey.isValid()).isTrue();\n            assertThat(createWatchDirKey.watchable()).isEqualTo(watchDir);\n\n            List<WatchEvent<?>> watchDirEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createWatchDirKey, watchDirEvents, 1));\n            assertThat(watchDirEvents).asList().hasSize(1);\n\n            WatchEvent<?> firstWatchDirEvent = watchDirEvents.get(0);\n            assertThat(firstWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstWatchDirEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstWatchDirEvent.context()).getPath()).isEqualTo(watchDir.getFileName());\n\n            // No more events\n            assertThat(watcher.poll()).isNull();\n        }\n    }\n\n    @Test\n    public void testWatchCreateFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path fileInRootFolder = kfs.getPath(\"/.test.txt\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            fileInRootFolder.register(watcher);\n\n            // Check file creation events, root is created first\n            createOrEditFile(fileInRootFolder, \"Hi\");\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            List<WatchEvent<?>> rootEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createRootKey, rootEvents, 1));\n            assertThat(rootEvents).asList().hasSize(1);\n\n            WatchEvent<?> firstEvent = rootEvents.get(0);\n            assertThat(firstEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstEvent.context()).getPath()).isNull();\n\n            // Watched file is created then\n            WatchKey createWatchDirKey = watcher.poll();\n            assertThat(createWatchDirKey.isValid()).isTrue();\n            assertThat(createWatchDirKey.watchable()).isEqualTo(fileInRootFolder);\n\n            List<WatchEvent<?>> watchDirEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createWatchDirKey, watchDirEvents, 1));\n            assertThat(watchDirEvents).asList().hasSize(1);\n\n            WatchEvent<?> firstWatchDirEvent = watchDirEvents.get(0);\n            assertThat(firstWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstWatchDirEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstWatchDirEvent.context()).getPath()).isEqualTo(fileInRootFolder.getFileName());\n\n            // No more events\n            assertThat(watcher.poll()).isNull();\n        }\n    }\n\n    @Test\n    public void testWatchEditFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path fileInRootFolder = kfs.getPath(\"/test.txt\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            fileInRootFolder.register(watcher);\n\n            // Check file creation events, root is created first, also it is modified as folder tracks size of its content\n            createOrEditFile(fileInRootFolder, \"Hi\");\n            createOrEditFile(fileInRootFolder, \"Welcome\");\n            createOrEditFile(fileInRootFolder, \"Hello\");\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            List<WatchEvent<?>> rootEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createRootKey, rootEvents, 2));\n            assertThat(rootEvents).asList().hasSize(2);\n\n            WatchEvent<?> firstEvent = rootEvents.get(0);\n            assertThat(firstEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstEvent.context()).getPath()).isNull();\n\n            WatchEvent<?> secondEvent = rootEvents.get(1);\n            assertThat(secondEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_MODIFY);\n            assertThat(secondEvent.count()).isEqualTo(2);\n            assertThat(((WatchContext)secondEvent.context()).getPath()).isNull();\n\n            // Watched file is created and modified then\n            WatchKey createWatchDirKey = watcher.poll();\n            assertThat(createWatchDirKey.isValid()).isTrue();\n            assertThat(createWatchDirKey.watchable()).isEqualTo(fileInRootFolder);\n\n            List<WatchEvent<?>> watchDirEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createWatchDirKey, watchDirEvents, 2));\n            assertThat(watchDirEvents).asList().hasSize(2);\n\n            WatchEvent<?> firstWatchDirEvent = watchDirEvents.get(0);\n            assertThat(firstWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstWatchDirEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstWatchDirEvent.context()).getPath()).isEqualTo(fileInRootFolder.getFileName());\n\n            WatchEvent<?> secondWatchDirEvent = watchDirEvents.get(1);\n            assertThat(secondWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_MODIFY);\n            assertThat(secondWatchDirEvent.count()).isEqualTo(2);\n            assertThat(((WatchContext)secondWatchDirEvent.context()).getPath()).isEqualTo(fileInRootFolder.getFileName());\n\n            // No more events\n            assertThat(watcher.poll()).isNull();\n        }\n    }\n\n    @Test\n    public void testWatchDeleteFile() throws IOException {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path fileInRootFolder = kfs.getPath(\"/test.txt\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            fileInRootFolder.register(watcher);\n\n            // Check file creation events, root is created first, also it is modified as folder tracks size of its content\n            createOrEditFile(fileInRootFolder, \"Hi\");\n            assertThat(Files.deleteIfExists(fileInRootFolder)).isTrue();\n\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            List<WatchEvent<?>> rootEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createRootKey, rootEvents, 2));\n            assertThat(rootEvents).asList().hasSize(2);\n\n            WatchEvent<?> firstEvent = rootEvents.get(0);\n            assertThat(firstEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstEvent.context()).getPath()).isNull();\n\n            WatchEvent<?> secondEvent = rootEvents.get(1);\n            assertThat(secondEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_MODIFY);\n            assertThat(secondEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)secondEvent.context()).getPath()).isNull();\n\n            // Watched file is created and deleted then\n            WatchKey createWatchDirKey = watcher.poll();\n            assertThat(createWatchDirKey.isValid()).isTrue();\n            assertThat(createWatchDirKey.watchable()).isEqualTo(fileInRootFolder);\n\n            List<WatchEvent<?>> watchDirEvents = new ArrayList<>();\n            Awaitility.await().atMost(Duration.FIVE_SECONDS).until(fetchWatchEvents(createWatchDirKey, watchDirEvents, 2));\n            assertThat(watchDirEvents).asList().hasSize(2);\n\n            WatchEvent<?> firstWatchDirEvent = watchDirEvents.get(0);\n            assertThat(firstWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_CREATE);\n            assertThat(firstWatchDirEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)firstWatchDirEvent.context()).getPath()).isEqualTo(fileInRootFolder.getFileName());\n\n            WatchEvent<?> thirdWatchDirEvent = watchDirEvents.get(1);\n            assertThat(thirdWatchDirEvent.kind()).isEqualTo(StandardWatchEventKind.ENTRY_DELETE);\n            assertThat(thirdWatchDirEvent.count()).isEqualTo(1);\n            assertThat(((WatchContext)thirdWatchDirEvent.context()).getPath()).isEqualTo(fileInRootFolder.getFileName());\n\n            // No more events\n            assertThat(watcher.poll()).isNull();\n        }\n    }\n\n    @Test\n    public void testCancelWatchKey() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            Files.createDirectory(watchDir);\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            createRootKey.cancel();\n\n            assertThat(createRootKey.isValid()).isFalse();\n        }\n    }\n\n    @Test\n    public void testResetWatchKey() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            Files.createDirectory(watchDir);\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            // Reset the key\n            assertThat(createRootKey.reset()).isTrue();\n\n            // The creation event has been removed from poll events\n            assertThat(createRootKey.pollEvents()).asList().isEmpty();\n        }\n    }\n\n    @Test\n    public void testResetCancelledWatchKey() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            Files.createDirectory(watchDir);\n            WatchKey createRootKey = watcher.poll(30, TimeUnit.SECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n\n            createRootKey.cancel();\n            assertThat(createRootKey.reset()).isFalse();\n        }\n    }\n\n    @Test\n    public void testPollWatchKeyWithTimeout() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            Files.createDirectory(watchDir);\n            WatchKey createRootKey = watcher.poll(1, TimeUnit.MILLISECONDS);\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n        }\n    }\n\n    @Test(timeout = 30_000L)\n    public void testTakeWatchKey() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        final Path root = kfs.getPath(\"/\");\n        final Path watchDir = kfs.getPath(\"/watchDir\");\n\n        try (WatchService watcher = kfs.newWatchService()){\n            watchDir.register(watcher);\n\n            Runnable createDirectory = () -> Files.createDirectory(watchDir);\n            Thread createDirectoryThread = new Thread(createDirectory);\n            createDirectoryThread.start();\n\n            WatchKey createRootKey = watcher.take();\n            assertThat(createRootKey.isValid()).isTrue();\n            assertThat(createRootKey.watchable()).isEqualTo(root);\n        }\n    }\n\n    @Test\n    public void testCloseAlreadyClosedWatchService() {\n        final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create(\"default:///\"));\n        WatchService watcher = kfs.newWatchService();\n        watcher.close();\n        assertThat(watcher.isClose()).isTrue();\n        watcher.close();\n        assertThat(watcher.isClose()).isTrue();\n    }\n\n    private void createOrEditFile(Path file, String fileContent) throws IOException {\n        try (OutputStream fileStream = Files.newOutputStream(file)) {\n            fileStream.write(fileContent.getBytes());\n            fileStream.flush();\n        }\n    }\n\n    private String readFile(Path file) throws IOException {\n        try (InputStream fileStream = Files.newInputStream(file)) {\n            return IOUtils.toString(fileStream, StandardCharsets.UTF_8.name());\n        }\n    }\n\n    private Callable<Boolean> fetchWatchEvents(WatchKey watchKey, List<WatchEvent<?>> foundEvents, int numberOfEventsExpected) {\n        return new Callable<Boolean>() {\n            public Boolean call() {\n                foundEvents.addAll(watchKey.pollEvents());\n\n                if (foundEvents.size() >= numberOfEventsExpected) {\n                    return Boolean.TRUE;\n                }\n                return Boolean.FALSE;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider # file system provider, also default (1st)\norg.uberfire.java.nio.fs.k8s.K8SFileSystemProvider     # can be set as default at runtime by system property: org.kie.workbench.controller.openshift.enabled\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/logback-test.xml",
    "content": "<configuration>\n\n  <appender name=\"STDOUT\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <!-- encoders are assigned the type\n         ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->\n    <encoder>\n      <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire.java.nio.fs.k8s\" level=\"DEBUG\" /> \n  <root level=\"INFO\">\n    <appender-ref ref=\"STDOUT\"/>\n  </root>\n</configuration>"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-dir-0-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-name-0: testDir\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-directory\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 19\n  creationTimestamp: 1970-01-01T00:00:00Z  \n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff36\ndata:\n  testFile: 19\nownerReferences:\n- apiVersion: apps.openshift.io/v1\n  kind: ConfigMap\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff35\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-dir-00-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff37\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-name-0: testDir\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-directory\n    k8s.fs.nio.java.uberfire.org/fsobj-app: other\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 0\n  creationTimestamp: 1970-01-01T00:00:00Z  \n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff36\ndata:\n "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-dir-r-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff35\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-root-directory\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 19\n    k8s.fs.nio.java.uberfire.org/fsobj-test: must-have \n  creationTimestamp: 1970-01-01T00:00:00Z  \n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff35\ndata:\n  testDir: 19\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-dir-r-empty-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-lastModifiedTimestamp: '2019-09-09T17:40:19.217Z'\n    k8s.fs.nio.java.uberfire.org/fsobj-size: '0'\n  creationTimestamp: '2019-09-09T17:40:19Z'\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-root-directory\n  name: k8s-fsobj-2bad6abd-6d85-48ff-b62b-210dcfc9ffdc\n  resourceVersion: '4117848'\n  uid: e46c4e73-d328-11e9-ad7a-8c16458eff35\n  \n\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-file-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff35\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-name-0: testDir\n    k8s.fs.nio.java.uberfire.org/fsobj-name-1: testFile\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-regular-file\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 19\n  creationTimestamp: 1970-01-01T00:00:00Z  \ndata:\n  fsobj-content: This is a test file\nownerReferences:\n- apiVersion: apps.openshift.io/v1\n  kind: ConfigMap\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff36\n\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-file-dup-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff36\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-name-0: testDir\n    k8s.fs.nio.java.uberfire.org/fsobj-name-1: testFile\n    k8s.fs.nio.java.uberfire.org/fsobj-type: fsobj-regular-file\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 19\n  creationTimestamp: 1970-01-01T00:00:00Z  \ndata:\n  fsobj-content: This is a test file\nownerReferences:\n- apiVersion: apps.openshift.io/v1\n  kind: ConfigMap\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff36\n\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-impls/uberfire-nio2-k8s/src/test/resources/test-k8sfs-file-invalid-configmap.yml",
    "content": "#\n# Copyright (C) 2019 Red Hat, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#         http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: k8s-fsobj-86403b0c-78b7-11e9-ad76-8c16458eff37\n  labels:\n    k8s.fs.nio.java.uberfire.org/fsobj-name-0: testDir\n    k8s.fs.nio.java.uberfire.org/fsobj-name-1: testFile\n    k8s.fs.nio.java.uberfire.org/fsobj-app: unknown\n  annotations:\n    k8s.fs.nio.java.uberfire.org/fsobj-size: 19\n  creationTimestamp: 1970-01-01T00:00:00Z  \ndata:\n  fsobj-content: This is a test file\nownerReferences:\n- apiVersion: apps.openshift.io/v1\n  kind: ConfigMap\n  name: k8s-fsobj-e6bb5ba5-527f-11e9-8a93-8c16458eff36\n  uid: e6bb5ba5-527f-11e9-8a93-8c16458eff36\n\n  "
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-nio2-backport</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-nio2-model</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire NIO.2 :: Model</name>\n  <description>Uberfire NIO.2 :: Model</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <!--URICodec-->\n    <dependency>\n      <groupId>commons-codec</groupId>\n      <artifactId>commons-codec</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/apache/commons/io/FilenameUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.apache.commons.io;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Stack;\n\n/**\n * General filename and filepath manipulation utilities.\n * <p>\n * When dealing with filenames you can hit problems when moving from a Windows\n * based development machine to a Unix based production machine.\n * This class aims to help avoid those problems.\n * <p>\n * <b>NOTE</b>: You may be able to avoid using this class entirely simply by\n * using JDK {@link java.io.File File} objects and the two argument constructor\n * {@link java.io.File#File(java.io.File, java.lang.String) File(File,String)}.\n * <p>\n * Most methods on this class are designed to work the same on both Unix and Windows.\n * Those that don't include 'System', 'Unix' or 'Windows' in their name.\n * <p>\n * Most methods recognise both separators (forward and back), and both\n * sets of prefixes. See the javadoc of each method for details.\n * <p>\n * This class defines six components within a filename\n * (example C:\\dev\\project\\file.txt):\n * <ul>\n * <li>the prefix - C:\\</li>\n * <li>the path - dev\\project\\</li>\n * <li>the full path - C:\\dev\\project\\</li>\n * <li>the name - file.txt</li>\n * <li>the base name - file</li>\n * <li>the extension - txt</li>\n * </ul>\n * Note that this class works best if directory filenames end with a separator.\n * If you omit the last separator, it is impossible to determine if the filename\n * corresponds to a file or a directory. As a result, we have chosen to say\n * it corresponds to a file.\n * <p>\n * This class only supports Unix and Windows style names.\n * Prefixes are matched as follows:\n * <pre>\n * Windows:\n * a\\b\\c.txt           --> \"\"          --> relative\n * \\a\\b\\c.txt          --> \"\\\"         --> current drive absolute\n * C:a\\b\\c.txt         --> \"C:\"        --> drive relative\n * C:\\a\\b\\c.txt        --> \"C:\\\"       --> absolute\n * \\\\server\\a\\b\\c.txt  --> \"\\\\server\\\" --> UNC\n *\n * Unix:\n * a/b/c.txt           --> \"\"          --> relative\n * /a/b/c.txt          --> \"/\"         --> absolute\n * ~/a/b/c.txt         --> \"~/\"        --> current user\n * ~                   --> \"~/\"        --> current user (slash added)\n * ~user/a/b/c.txt     --> \"~user/\"    --> named user\n * ~user               --> \"~user/\"    --> named user (slash added)\n * </pre>\n * Both prefix styles are matched always, irrespective of the machine that you are\n * currently running on.\n * <p>\n * Origin of code: Excalibur, Alexandria, Tomcat, Commons-Utils.\n * @version $Id$\n * @since 1.1\n */\npublic class FilenameUtils {\n\n    /**\n     * The extension separator character.\n     * @since 1.4\n     */\n    public static final char EXTENSION_SEPARATOR = '.';\n\n    /**\n     * The extension separator String.\n     * @since 1.4\n     */\n    public static final String EXTENSION_SEPARATOR_STR = Character.toString(EXTENSION_SEPARATOR);\n\n    /**\n     * The Unix separator character.\n     */\n    private static final char UNIX_SEPARATOR = '/';\n\n    /**\n     * The Windows separator character.\n     */\n    private static final char WINDOWS_SEPARATOR = '\\\\';\n\n    /**\n     * The system separator character.\n     */\n    private static final char SYSTEM_SEPARATOR = File.separatorChar;\n\n    /**\n     * The separator character that is the opposite of the system separator.\n     */\n    private static final char OTHER_SEPARATOR;\n\n    static {\n        if (isSystemWindows()) {\n            OTHER_SEPARATOR = UNIX_SEPARATOR;\n        } else {\n            OTHER_SEPARATOR = WINDOWS_SEPARATOR;\n        }\n    }\n\n    /**\n     * Instances should NOT be constructed in standard programming.\n     */\n    public FilenameUtils() {\n        super();\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Determines if Windows file system is in use.\n     * @return true if the system is Windows\n     */\n    static boolean isSystemWindows() {\n        return SYSTEM_SEPARATOR == WINDOWS_SEPARATOR;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Checks if the character is a separator.\n     * @param ch the character to check\n     * @return true if it is a separator character\n     */\n    private static boolean isSeparator(char ch) {\n        return ch == UNIX_SEPARATOR || ch == WINDOWS_SEPARATOR;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Normalizes a path, removing double and single dot path steps.\n     * <p>\n     * This method normalizes a path to a standard format.\n     * The input may contain separators in either Unix or Windows format.\n     * The output will contain separators in the format of the system.\n     * <p>\n     * A trailing slash will be retained.\n     * A double slash will be merged to a single slash (but UNC names are handled).\n     * A single dot path segment will be removed.\n     * A double dot will cause that path segment and the one before to be removed.\n     * If the double dot has no parent path segment to work with, {@code null}\n     * is returned.\n     * <p>\n     * The output will be the same on both Unix and Windows except\n     * for the separator character.\n     * <pre>\n     * /foo//               -->   /foo/\n     * /foo/./              -->   /foo/\n     * /foo/../bar          -->   /bar\n     * /foo/../bar/         -->   /bar/\n     * /foo/../bar/../baz   -->   /baz\n     * //foo//./bar         -->   /foo/bar\n     * /../                 -->   null\n     * ../foo               -->   null\n     * foo/bar/..           -->   foo/\n     * foo/../../bar        -->   null\n     * foo/../bar           -->   bar\n     * //server/foo/../bar  -->   //server/bar\n     * //server/../bar      -->   null\n     * C:\\foo\\..\\bar        -->   C:\\bar\n     * C:\\..\\bar            -->   null\n     * ~/foo/../bar/        -->   ~/bar/\n     * ~/../bar             -->   null\n     * </pre>\n     * (Note the file separator returned will be correct for Windows/Unix)\n     * @param filename the filename to normalize, null returns null\n     * @return the normalized filename, or null if invalid\n     */\n    public static String normalize(String filename) {\n        return doNormalize(filename,\n                           SYSTEM_SEPARATOR,\n                           true);\n    }\n\n    /**\n     * Normalizes a path, removing double and single dot path steps.\n     * <p>\n     * This method normalizes a path to a standard format.\n     * The input may contain separators in either Unix or Windows format.\n     * The output will contain separators in the format specified.\n     * <p>\n     * A trailing slash will be retained.\n     * A double slash will be merged to a single slash (but UNC names are handled).\n     * A single dot path segment will be removed.\n     * A double dot will cause that path segment and the one before to be removed.\n     * If the double dot has no parent path segment to work with, {@code null}\n     * is returned.\n     * <p>\n     * The output will be the same on both Unix and Windows except\n     * for the separator character.\n     * <pre>\n     * /foo//               -->   /foo/\n     * /foo/./              -->   /foo/\n     * /foo/../bar          -->   /bar\n     * /foo/../bar/         -->   /bar/\n     * /foo/../bar/../baz   -->   /baz\n     * //foo//./bar         -->   /foo/bar\n     * /../                 -->   null\n     * ../foo               -->   null\n     * foo/bar/..           -->   foo/\n     * foo/../../bar        -->   null\n     * foo/../bar           -->   bar\n     * //server/foo/../bar  -->   //server/bar\n     * //server/../bar      -->   null\n     * C:\\foo\\..\\bar        -->   C:\\bar\n     * C:\\..\\bar            -->   null\n     * ~/foo/../bar/        -->   ~/bar/\n     * ~/../bar             -->   null\n     * </pre>\n     * The output will be the same on both Unix and Windows including\n     * the separator character.\n     * @param filename the filename to normalize, null returns null\n     * @param unixSeparator {@code true} if a unix separator should\n     * be used or {@code false} if a windows separator should be used.\n     * @return the normalized filename, or null if invalid\n     * @since 2.0\n     */\n    public static String normalize(String filename,\n                                   boolean unixSeparator) {\n        char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR;\n        return doNormalize(filename,\n                           separator,\n                           true);\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Normalizes a path, removing double and single dot path steps,\n     * and removing any final directory separator.\n     * <p>\n     * This method normalizes a path to a standard format.\n     * The input may contain separators in either Unix or Windows format.\n     * The output will contain separators in the format of the system.\n     * <p>\n     * A trailing slash will be removed.\n     * A double slash will be merged to a single slash (but UNC names are handled).\n     * A single dot path segment will be removed.\n     * A double dot will cause that path segment and the one before to be removed.\n     * If the double dot has no parent path segment to work with, {@code null}\n     * is returned.\n     * <p>\n     * The output will be the same on both Unix and Windows except\n     * for the separator character.\n     * <pre>\n     * /foo//               -->   /foo\n     * /foo/./              -->   /foo\n     * /foo/../bar          -->   /bar\n     * /foo/../bar/         -->   /bar\n     * /foo/../bar/../baz   -->   /baz\n     * //foo//./bar         -->   /foo/bar\n     * /../                 -->   null\n     * ../foo               -->   null\n     * foo/bar/..           -->   foo\n     * foo/../../bar        -->   null\n     * foo/../bar           -->   bar\n     * //server/foo/../bar  -->   //server/bar\n     * //server/../bar      -->   null\n     * C:\\foo\\..\\bar        -->   C:\\bar\n     * C:\\..\\bar            -->   null\n     * ~/foo/../bar/        -->   ~/bar\n     * ~/../bar             -->   null\n     * </pre>\n     * (Note the file separator returned will be correct for Windows/Unix)\n     * @param filename the filename to normalize, null returns null\n     * @return the normalized filename, or null if invalid\n     */\n    public static String normalizeNoEndSeparator(String filename) {\n        return doNormalize(filename,\n                           SYSTEM_SEPARATOR,\n                           false);\n    }\n\n    /**\n     * Normalizes a path, removing double and single dot path steps,\n     * and removing any final directory separator.\n     * <p>\n     * This method normalizes a path to a standard format.\n     * The input may contain separators in either Unix or Windows format.\n     * The output will contain separators in the format specified.\n     * <p>\n     * A trailing slash will be removed.\n     * A double slash will be merged to a single slash (but UNC names are handled).\n     * A single dot path segment will be removed.\n     * A double dot will cause that path segment and the one before to be removed.\n     * If the double dot has no parent path segment to work with, {@code null}\n     * is returned.\n     * <p>\n     * The output will be the same on both Unix and Windows including\n     * the separator character.\n     * <pre>\n     * /foo//               -->   /foo\n     * /foo/./              -->   /foo\n     * /foo/../bar          -->   /bar\n     * /foo/../bar/         -->   /bar\n     * /foo/../bar/../baz   -->   /baz\n     * //foo//./bar         -->   /foo/bar\n     * /../                 -->   null\n     * ../foo               -->   null\n     * foo/bar/..           -->   foo\n     * foo/../../bar        -->   null\n     * foo/../bar           -->   bar\n     * //server/foo/../bar  -->   //server/bar\n     * //server/../bar      -->   null\n     * C:\\foo\\..\\bar        -->   C:\\bar\n     * C:\\..\\bar            -->   null\n     * ~/foo/../bar/        -->   ~/bar\n     * ~/../bar             -->   null\n     * </pre>\n     * @param filename the filename to normalize, null returns null\n     * @param unixSeparator {@code true} if a unix separator should\n     * be used or {@code false} if a windows separtor should be used.\n     * @return the normalized filename, or null if invalid\n     * @since 2.0\n     */\n    public static String normalizeNoEndSeparator(String filename,\n                                                 boolean unixSeparator) {\n        char separator = unixSeparator ? UNIX_SEPARATOR : WINDOWS_SEPARATOR;\n        return doNormalize(filename,\n                           separator,\n                           false);\n    }\n\n    /**\n     * Internal method to perform the normalization.\n     * @param filename the filename\n     * @param separator The separator character to use\n     * @param keepSeparator true to keep the final separator\n     * @return the normalized filename\n     */\n    private static String doNormalize(String filename,\n                                      char separator,\n                                      boolean keepSeparator) {\n        if (filename == null) {\n            return null;\n        }\n        int size = filename.length();\n        if (size == 0) {\n            return filename;\n        }\n        int prefix = getPrefixLength(filename);\n        if (prefix < 0) {\n            return null;\n        }\n\n        char[] array = new char[size + 2];  // +1 for possible extra slash, +2 for arraycopy\n        filename.getChars(0,\n                          filename.length(),\n                          array,\n                          0);\n\n        // fix separators throughout\n        char otherSeparator = separator == SYSTEM_SEPARATOR ? OTHER_SEPARATOR : SYSTEM_SEPARATOR;\n        for (int i = 0; i < array.length; i++) {\n            if (array[i] == otherSeparator) {\n                array[i] = separator;\n            }\n        }\n\n        // add extra separator on the end to simplify code below\n        boolean lastIsDirectory = true;\n        if (array[size - 1] != separator) {\n            array[size++] = separator;\n            lastIsDirectory = false;\n        }\n\n        // adjoining slashes\n        for (int i = prefix + 1; i < size; i++) {\n            if (array[i] == separator && array[i - 1] == separator) {\n                System.arraycopy(array,\n                                 i,\n                                 array,\n                                 i - 1,\n                                 size - i);\n                size--;\n                i--;\n            }\n        }\n\n        // dot slash\n        for (int i = prefix + 1; i < size; i++) {\n            if (array[i] == separator && array[i - 1] == '.' &&\n                    (i == prefix + 1 || array[i - 2] == separator)) {\n                if (i == size - 1) {\n                    lastIsDirectory = true;\n                }\n                System.arraycopy(array,\n                                 i + 1,\n                                 array,\n                                 i - 1,\n                                 size - i);\n                size -= 2;\n                i--;\n            }\n        }\n\n        // double dot slash\n        outer:\n        for (int i = prefix + 2; i < size; i++) {\n            if (array[i] == separator && array[i - 1] == '.' && array[i - 2] == '.' &&\n                    (i == prefix + 2 || array[i - 3] == separator)) {\n                if (i == prefix + 2) {\n                    return null;\n                }\n                if (i == size - 1) {\n                    lastIsDirectory = true;\n                }\n                int j;\n                for (j = i - 4; j >= prefix; j--) {\n                    if (array[j] == separator) {\n                        // remove b/../ from a/b/../c\n                        System.arraycopy(array,\n                                         i + 1,\n                                         array,\n                                         j + 1,\n                                         size - i);\n                        size -= i - j;\n                        i = j + 1;\n                        continue outer;\n                    }\n                }\n                // remove a/../ from a/../c\n                System.arraycopy(array,\n                                 i + 1,\n                                 array,\n                                 prefix,\n                                 size - i);\n                size -= i + 1 - prefix;\n                i = prefix + 1;\n            }\n        }\n\n        if (size <= 0) {  // should never be less than 0\n            return \"\";\n        }\n        if (size <= prefix) {  // should never be less than prefix\n            return new String(array,\n                              0,\n                              size);\n        }\n        if (lastIsDirectory && keepSeparator) {\n            return new String(array,\n                              0,\n                              size);  // keep trailing separator\n        }\n        return new String(array,\n                          0,\n                          size - 1);  // lose trailing separator\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Concatenates a filename to a base path using normal command line style rules.\n     * <p>\n     * The effect is equivalent to resultant directory after changing\n     * directory to the first argument, followed by changing directory to\n     * the second argument.\n     * <p>\n     * The first argument is the base path, the second is the path to concatenate.\n     * The returned path is always normalized via {@link #normalize(String)},\n     * thus <code>..</code> is handled.\n     * <p>\n     * If <code>pathToAdd</code> is absolute (has an absolute prefix), then\n     * it will be normalized and returned.\n     * Otherwise, the paths will be joined, normalized and returned.\n     * <p>\n     * The output will be the same on both Unix and Windows except\n     * for the separator character.\n     * <pre>\n     * /foo/ + bar          -->   /foo/bar\n     * /foo + bar           -->   /foo/bar\n     * /foo + /bar          -->   /bar\n     * /foo + C:/bar        -->   C:/bar\n     * /foo + C:bar         -->   C:bar (*)\n     * /foo/a/ + ../bar     -->   foo/bar\n     * /foo/ + ../../bar    -->   null\n     * /foo/ + /bar         -->   /bar\n     * /foo/.. + /bar       -->   /bar\n     * /foo + bar/c.txt     -->   /foo/bar/c.txt\n     * /foo/c.txt + bar     -->   /foo/c.txt/bar (!)\n     * </pre>\n     * (*) Note that the Windows relative drive prefix is unreliable when\n     * used with this method.\n     * (!) Note that the first parameter must be a path. If it ends with a name, then\n     * the name will be built into the concatenated path. If this might be a problem,\n     * use {@link #getFullPath(String)} on the base path argument.\n     * @param basePath the base path to attach to, always treated as a path\n     * @param fullFilenameToAdd the filename (or path) to attach to the base\n     * @return the concatenated path, or null if invalid\n     */\n    public static String concat(String basePath,\n                                String fullFilenameToAdd) {\n        int prefix = getPrefixLength(fullFilenameToAdd);\n        if (prefix < 0) {\n            return null;\n        }\n        if (prefix > 0) {\n            return normalize(fullFilenameToAdd);\n        }\n        if (basePath == null) {\n            return null;\n        }\n        int len = basePath.length();\n        if (len == 0) {\n            return normalize(fullFilenameToAdd);\n        }\n        char ch = basePath.charAt(len - 1);\n        if (isSeparator(ch)) {\n            return normalize(basePath + fullFilenameToAdd);\n        } else {\n            return normalize(basePath + '/' + fullFilenameToAdd);\n        }\n    }\n\n    /**\n     * Determines whether the {@code parent} directory contains the {@code child} element (a file or directory).\n     * <p>\n     * The files names are expected to be normalized.\n     * </p>\n     * <p>\n     * Edge cases:\n     * <ul>\n     * <li>A {@code directory} must not be null: if null, throw IllegalArgumentException</li>\n     * <li>A directory does not contain itself: return false</li>\n     * <li>A null child file is not contained in any parent: return false</li>\n     * </ul>\n     * @param canonicalParent the file to consider as the parent.\n     * @param canonicalChild the file to consider as the child.\n     * @return true is the candidate leaf is under by the specified composite. False otherwise.\n     * @throws IOException if an IO error occurs while checking the files.\n     * @since 2.2\n     */\n    public static boolean directoryContains(final String canonicalParent,\n                                            final String canonicalChild)\n            throws IOException {\n\n        // Fail fast against NullPointerException\n        if (canonicalParent == null) {\n            throw new IllegalArgumentException(\"Directory must not be null\");\n        }\n\n        if (canonicalChild == null) {\n            return false;\n        }\n\n        if (IOCase.SYSTEM.checkEquals(canonicalParent,\n                                      canonicalChild)) {\n            return false;\n        }\n\n        return IOCase.SYSTEM.checkStartsWith(canonicalChild,\n                                             canonicalParent);\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Converts all separators to the Unix separator of forward slash.\n     * @param path the path to be changed, null ignored\n     * @return the updated path\n     */\n    public static String separatorsToUnix(String path) {\n        if (path == null || path.indexOf(WINDOWS_SEPARATOR) == -1) {\n            return path;\n        }\n        return path.replace(WINDOWS_SEPARATOR,\n                            UNIX_SEPARATOR);\n    }\n\n    /**\n     * Converts all separators to the Windows separator of backslash.\n     * @param path the path to be changed, null ignored\n     * @return the updated path\n     */\n    public static String separatorsToWindows(String path) {\n        if (path == null || path.indexOf(UNIX_SEPARATOR) == -1) {\n            return path;\n        }\n        return path.replace(UNIX_SEPARATOR,\n                            WINDOWS_SEPARATOR);\n    }\n\n    /**\n     * Converts all separators to the system separator.\n     * @param path the path to be changed, null ignored\n     * @return the updated path\n     */\n    public static String separatorsToSystem(String path) {\n        if (path == null) {\n            return null;\n        }\n        if (isSystemWindows()) {\n            return separatorsToWindows(path);\n        } else {\n            return separatorsToUnix(path);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Returns the length of the filename prefix, such as <code>C:/</code> or <code>~/</code>.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * <p>\n     * The prefix length includes the first slash in the full filename\n     * if applicable. Thus, it is possible that the length returned is greater\n     * than the length of the input string.\n     * <pre>\n     * Windows:\n     * a\\b\\c.txt           --> \"\"          --> relative\n     * \\a\\b\\c.txt          --> \"\\\"         --> current drive absolute\n     * C:a\\b\\c.txt         --> \"C:\"        --> drive relative\n     * C:\\a\\b\\c.txt        --> \"C:\\\"       --> absolute\n     * \\\\server\\a\\b\\c.txt  --> \"\\\\server\\\" --> UNC\n     *\n     * Unix:\n     * a/b/c.txt           --> \"\"          --> relative\n     * /a/b/c.txt          --> \"/\"         --> absolute\n     * ~/a/b/c.txt         --> \"~/\"        --> current user\n     * ~                   --> \"~/\"        --> current user (slash added)\n     * ~user/a/b/c.txt     --> \"~user/\"    --> named user\n     * ~user               --> \"~user/\"    --> named user (slash added)\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * ie. both Unix and Windows prefixes are matched regardless.\n     * @param filename the filename to find the prefix in, null returns -1\n     * @return the length of the prefix, -1 if invalid or null\n     */\n    public static int getPrefixLength(String filename) {\n        if (filename == null) {\n            return -1;\n        }\n        int len = filename.length();\n        if (len == 0) {\n            return 0;\n        }\n        char ch0 = filename.charAt(0);\n        if (ch0 == ':') {\n            return -1;\n        }\n        if (len == 1) {\n            if (ch0 == '~') {\n                return 2;  // return a length greater than the input\n            }\n            return isSeparator(ch0) ? 1 : 0;\n        } else {\n            if (ch0 == '~') {\n                int posUnix = filename.indexOf(UNIX_SEPARATOR,\n                                               1);\n                int posWin = filename.indexOf(WINDOWS_SEPARATOR,\n                                              1);\n                if (posUnix == -1 && posWin == -1) {\n                    return len + 1;  // return a length greater than the input\n                }\n                posUnix = posUnix == -1 ? posWin : posUnix;\n                posWin = posWin == -1 ? posUnix : posWin;\n                return Math.min(posUnix,\n                                posWin) + 1;\n            }\n            char ch1 = filename.charAt(1);\n            if (ch1 == ':') {\n                ch0 = Character.toUpperCase(ch0);\n                if (ch0 >= 'A' && ch0 <= 'Z') {\n                    if (len == 2 || isSeparator(filename.charAt(2)) == false) {\n                        return 2;\n                    }\n                    return 3;\n                }\n                return -1;\n            } else if (isSeparator(ch0) && isSeparator(ch1)) {\n                int posUnix = filename.indexOf(UNIX_SEPARATOR,\n                                               2);\n                int posWin = filename.indexOf(WINDOWS_SEPARATOR,\n                                              2);\n                if (posUnix == -1 && posWin == -1 || posUnix == 2 || posWin == 2) {\n                    return -1;\n                }\n                posUnix = posUnix == -1 ? posWin : posUnix;\n                posWin = posWin == -1 ? posUnix : posWin;\n                return Math.min(posUnix,\n                                posWin) + 1;\n            } else {\n                return isSeparator(ch0) ? 1 : 0;\n            }\n        }\n    }\n\n    /**\n     * Returns the index of the last directory separator character.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The position of the last forward or backslash is returned.\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to find the last path separator in, null returns -1\n     * @return the index of the last separator character, or -1 if there\n     * is no such character\n     */\n    public static int indexOfLastSeparator(String filename) {\n        if (filename == null) {\n            return -1;\n        }\n        int lastUnixPos = filename.lastIndexOf(UNIX_SEPARATOR);\n        int lastWindowsPos = filename.lastIndexOf(WINDOWS_SEPARATOR);\n        return Math.max(lastUnixPos,\n                        lastWindowsPos);\n    }\n\n    /**\n     * Returns the index of the last extension separator character, which is a dot.\n     * <p>\n     * This method also checks that there is no directory separator after the last dot.\n     * To do this it uses {@link #indexOfLastSeparator(String)} which will\n     * handle a file in either Unix or Windows format.\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to find the last path separator in, null returns -1\n     * @return the index of the last separator character, or -1 if there\n     * is no such character\n     */\n    public static int indexOfExtension(String filename) {\n        if (filename == null) {\n            return -1;\n        }\n        int extensionPos = filename.lastIndexOf(EXTENSION_SEPARATOR);\n        int lastSeparator = indexOfLastSeparator(filename);\n        return lastSeparator > extensionPos ? -1 : extensionPos;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Gets the prefix from a full filename, such as <code>C:/</code>\n     * or <code>~/</code>.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The prefix includes the first slash in the full filename where applicable.\n     * <pre>\n     * Windows:\n     * a\\b\\c.txt           --> \"\"          --> relative\n     * \\a\\b\\c.txt          --> \"\\\"         --> current drive absolute\n     * C:a\\b\\c.txt         --> \"C:\"        --> drive relative\n     * C:\\a\\b\\c.txt        --> \"C:\\\"       --> absolute\n     * \\\\server\\a\\b\\c.txt  --> \"\\\\server\\\" --> UNC\n     *\n     * Unix:\n     * a/b/c.txt           --> \"\"          --> relative\n     * /a/b/c.txt          --> \"/\"         --> absolute\n     * ~/a/b/c.txt         --> \"~/\"        --> current user\n     * ~                   --> \"~/\"        --> current user (slash added)\n     * ~user/a/b/c.txt     --> \"~user/\"    --> named user\n     * ~user               --> \"~user/\"    --> named user (slash added)\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * ie. both Unix and Windows prefixes are matched regardless.\n     * @param filename the filename to query, null returns null\n     * @return the prefix of the file, null if invalid\n     */\n    public static String getPrefix(String filename) {\n        if (filename == null) {\n            return null;\n        }\n        int len = getPrefixLength(filename);\n        if (len < 0) {\n            return null;\n        }\n        if (len > filename.length()) {\n            return filename + UNIX_SEPARATOR;  // we know this only happens for unix\n        }\n        return filename.substring(0,\n                                  len);\n    }\n\n    /**\n     * Gets the path from a full filename, which excludes the prefix.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The method is entirely text based, and returns the text before and\n     * including the last forward or backslash.\n     * <pre>\n     * C:\\a\\b\\c.txt --> a\\b\\\n     * ~/a/b/c.txt  --> a/b/\n     * a.txt        --> \"\"\n     * a/b/c        --> a/b/\n     * a/b/c/       --> a/b/c/\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * <p>\n     * This method drops the prefix from the result.\n     * See {@link #getFullPath(String)} for the method that retains the prefix.\n     * @param filename the filename to query, null returns null\n     * @return the path of the file, an empty string if none exists, null if invalid\n     */\n    public static String getPath(String filename) {\n        return doGetPath(filename,\n                         1);\n    }\n\n    /**\n     * Gets the path from a full filename, which excludes the prefix, and\n     * also excluding the final directory separator.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The method is entirely text based, and returns the text before the\n     * last forward or backslash.\n     * <pre>\n     * C:\\a\\b\\c.txt --> a\\b\n     * ~/a/b/c.txt  --> a/b\n     * a.txt        --> \"\"\n     * a/b/c        --> a/b\n     * a/b/c/       --> a/b/c\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * <p>\n     * This method drops the prefix from the result.\n     * See {@link #getFullPathNoEndSeparator(String)} for the method that retains the prefix.\n     * @param filename the filename to query, null returns null\n     * @return the path of the file, an empty string if none exists, null if invalid\n     */\n    public static String getPathNoEndSeparator(String filename) {\n        return doGetPath(filename,\n                         0);\n    }\n\n    /**\n     * Does the work of getting the path.\n     * @param filename the filename\n     * @param separatorAdd 0 to omit the end separator, 1 to return it\n     * @return the path\n     */\n    private static String doGetPath(String filename,\n                                    int separatorAdd) {\n        if (filename == null) {\n            return null;\n        }\n        int prefix = getPrefixLength(filename);\n        if (prefix < 0) {\n            return null;\n        }\n        int index = indexOfLastSeparator(filename);\n        int endIndex = index + separatorAdd;\n        if (prefix >= filename.length() || index < 0 || prefix >= endIndex) {\n            return \"\";\n        }\n        return filename.substring(prefix,\n                                  endIndex);\n    }\n\n    /**\n     * Gets the full path from a full filename, which is the prefix + path.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The method is entirely text based, and returns the text before and\n     * including the last forward or backslash.\n     * <pre>\n     * C:\\a\\b\\c.txt --> C:\\a\\b\\\n     * ~/a/b/c.txt  --> ~/a/b/\n     * a.txt        --> \"\"\n     * a/b/c        --> a/b/\n     * a/b/c/       --> a/b/c/\n     * C:           --> C:\n     * C:\\          --> C:\\\n     * ~            --> ~/\n     * ~/           --> ~/\n     * ~user        --> ~user/\n     * ~user/       --> ~user/\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to query, null returns null\n     * @return the path of the file, an empty string if none exists, null if invalid\n     */\n    public static String getFullPath(String filename) {\n        return doGetFullPath(filename,\n                             true);\n    }\n\n    /**\n     * Gets the full path from a full filename, which is the prefix + path,\n     * and also excluding the final directory separator.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The method is entirely text based, and returns the text before the\n     * last forward or backslash.\n     * <pre>\n     * C:\\a\\b\\c.txt --> C:\\a\\b\n     * ~/a/b/c.txt  --> ~/a/b\n     * a.txt        --> \"\"\n     * a/b/c        --> a/b\n     * a/b/c/       --> a/b/c\n     * C:           --> C:\n     * C:\\          --> C:\\\n     * ~            --> ~\n     * ~/           --> ~\n     * ~user        --> ~user\n     * ~user/       --> ~user\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to query, null returns null\n     * @return the path of the file, an empty string if none exists, null if invalid\n     */\n    public static String getFullPathNoEndSeparator(String filename) {\n        return doGetFullPath(filename,\n                             false);\n    }\n\n    /**\n     * Does the work of getting the path.\n     * @param filename the filename\n     * @param includeSeparator true to include the end separator\n     * @return the path\n     */\n    private static String doGetFullPath(String filename,\n                                        boolean includeSeparator) {\n        if (filename == null) {\n            return null;\n        }\n        int prefix = getPrefixLength(filename);\n        if (prefix < 0) {\n            return null;\n        }\n        if (prefix >= filename.length()) {\n            if (includeSeparator) {\n                return getPrefix(filename);  // add end slash if necessary\n            } else {\n                return filename;\n            }\n        }\n        int index = indexOfLastSeparator(filename);\n        if (index < 0) {\n            return filename.substring(0,\n                                      prefix);\n        }\n        int end = index + (includeSeparator ? 1 : 0);\n        if (end == 0) {\n            end++;\n        }\n        return filename.substring(0,\n                                  end);\n    }\n\n    /**\n     * Gets the name minus the path from a full filename.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The text after the last forward or backslash is returned.\n     * <pre>\n     * a/b/c.txt --> c.txt\n     * a.txt     --> a.txt\n     * a/b/c     --> c\n     * a/b/c/    --> \"\"\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to query, null returns null\n     * @return the name of the file without the path, or an empty string if none exists\n     */\n    public static String getName(String filename) {\n        if (filename == null) {\n            return null;\n        }\n        int index = indexOfLastSeparator(filename);\n        return filename.substring(index + 1);\n    }\n\n    /**\n     * Gets the base name, minus the full path and extension, from a full filename.\n     * <p>\n     * This method will handle a file in either Unix or Windows format.\n     * The text after the last forward or backslash and before the last dot is returned.\n     * <pre>\n     * a/b/c.txt --> c\n     * a.txt     --> a\n     * a/b/c     --> c\n     * a/b/c/    --> \"\"\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to query, null returns null\n     * @return the name of the file without the path, or an empty string if none exists\n     */\n    public static String getBaseName(String filename) {\n        return removeExtension(getName(filename));\n    }\n\n    /**\n     * Gets the extension of a filename.\n     * <p>\n     * This method returns the textual part of the filename after the last dot.\n     * There must be no directory separator after the dot.\n     * <pre>\n     * foo.txt      --> \"txt\"\n     * a/b/c.jpg    --> \"jpg\"\n     * a/b.txt/c    --> \"\"\n     * a/b/c        --> \"\"\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to retrieve the extension of.\n     * @return the extension of the file or an empty string if none exists or {@code null}\n     * if the filename is {@code null}.\n     */\n    public static String getExtension(String filename) {\n        if (filename == null) {\n            return null;\n        }\n        int index = indexOfExtension(filename);\n        if (index == -1) {\n            return \"\";\n        } else {\n            return filename.substring(index + 1);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Removes the extension from a filename.\n     * <p>\n     * This method returns the textual part of the filename before the last dot.\n     * There must be no directory separator after the dot.\n     * <pre>\n     * foo.txt    --> foo\n     * a\\b\\c.jpg  --> a\\b\\c\n     * a\\b\\c      --> a\\b\\c\n     * a.b\\c      --> a.b\\c\n     * </pre>\n     * <p>\n     * The output will be the same irrespective of the machine that the code is running on.\n     * @param filename the filename to query, null returns null\n     * @return the filename minus the extension\n     */\n    public static String removeExtension(String filename) {\n        if (filename == null) {\n            return null;\n        }\n        int index = indexOfExtension(filename);\n        if (index == -1) {\n            return filename;\n        } else {\n            return filename.substring(0,\n                                      index);\n        }\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Checks whether two filenames are equal exactly.\n     * <p>\n     * No processing is performed on the filenames other than comparison,\n     * thus this is merely a null-safe case-sensitive equals.\n     * @param filename1 the first filename to query, may be null\n     * @param filename2 the second filename to query, may be null\n     * @return true if the filenames are equal, null equals null\n     * @see IOCase#SENSITIVE\n     */\n    public static boolean equals(String filename1,\n                                 String filename2) {\n        return equals(filename1,\n                      filename2,\n                      false,\n                      IOCase.SENSITIVE);\n    }\n\n    /**\n     * Checks whether two filenames are equal using the case rules of the system.\n     * <p>\n     * No processing is performed on the filenames other than comparison.\n     * The check is case-sensitive on Unix and case-insensitive on Windows.\n     * @param filename1 the first filename to query, may be null\n     * @param filename2 the second filename to query, may be null\n     * @return true if the filenames are equal, null equals null\n     * @see IOCase#SYSTEM\n     */\n    public static boolean equalsOnSystem(String filename1,\n                                         String filename2) {\n        return equals(filename1,\n                      filename2,\n                      false,\n                      IOCase.SYSTEM);\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Checks whether two filenames are equal after both have been normalized.\n     * <p>\n     * Both filenames are first passed to {@link #normalize(String)}.\n     * The check is then performed in a case-sensitive manner.\n     * @param filename1 the first filename to query, may be null\n     * @param filename2 the second filename to query, may be null\n     * @return true if the filenames are equal, null equals null\n     * @see IOCase#SENSITIVE\n     */\n    public static boolean equalsNormalized(String filename1,\n                                           String filename2) {\n        return equals(filename1,\n                      filename2,\n                      true,\n                      IOCase.SENSITIVE);\n    }\n\n    /**\n     * Checks whether two filenames are equal after both have been normalized\n     * and using the case rules of the system.\n     * <p>\n     * Both filenames are first passed to {@link #normalize(String)}.\n     * The check is then performed case-sensitive on Unix and\n     * case-insensitive on Windows.\n     * @param filename1 the first filename to query, may be null\n     * @param filename2 the second filename to query, may be null\n     * @return true if the filenames are equal, null equals null\n     * @see IOCase#SYSTEM\n     */\n    public static boolean equalsNormalizedOnSystem(String filename1,\n                                                   String filename2) {\n        return equals(filename1,\n                      filename2,\n                      true,\n                      IOCase.SYSTEM);\n    }\n\n    /**\n     * Checks whether two filenames are equal, optionally normalizing and providing\n     * control over the case-sensitivity.\n     * @param filename1 the first filename to query, may be null\n     * @param filename2 the second filename to query, may be null\n     * @param normalized whether to normalize the filenames\n     * @param caseSensitivity what case sensitivity rule to use, null means case-sensitive\n     * @return true if the filenames are equal, null equals null\n     * @since 1.3\n     */\n    public static boolean equals(\n            String filename1,\n            String filename2,\n            boolean normalized,\n            IOCase caseSensitivity) {\n\n        if (filename1 == null || filename2 == null) {\n            return filename1 == null && filename2 == null;\n        }\n        if (normalized) {\n            filename1 = normalize(filename1);\n            filename2 = normalize(filename2);\n            if (filename1 == null || filename2 == null) {\n                throw new NullPointerException(\n                        \"Error normalizing one or both of the file names\");\n            }\n        }\n        if (caseSensitivity == null) {\n            caseSensitivity = IOCase.SENSITIVE;\n        }\n        return caseSensitivity.checkEquals(filename1,\n                                           filename2);\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Checks whether the extension of the filename is that specified.\n     * <p>\n     * This method obtains the extension as the textual part of the filename\n     * after the last dot. There must be no directory separator after the dot.\n     * The extension check is case-sensitive on all platforms.\n     * @param filename the filename to query, null returns false\n     * @param extension the extension to check for, null or empty checks for no extension\n     * @return true if the filename has the specified extension\n     */\n    public static boolean isExtension(String filename,\n                                      String extension) {\n        if (filename == null) {\n            return false;\n        }\n        if (extension == null || extension.length() == 0) {\n            return indexOfExtension(filename) == -1;\n        }\n        String fileExt = getExtension(filename);\n        return fileExt.equals(extension);\n    }\n\n    /**\n     * Checks whether the extension of the filename is one of those specified.\n     * <p>\n     * This method obtains the extension as the textual part of the filename\n     * after the last dot. There must be no directory separator after the dot.\n     * The extension check is case-sensitive on all platforms.\n     * @param filename the filename to query, null returns false\n     * @param extensions the extensions to check for, null checks for no extension\n     * @return true if the filename is one of the extensions\n     */\n    public static boolean isExtension(String filename,\n                                      String[] extensions) {\n        if (filename == null) {\n            return false;\n        }\n        if (extensions == null || extensions.length == 0) {\n            return indexOfExtension(filename) == -1;\n        }\n        String fileExt = getExtension(filename);\n        for (String extension : extensions) {\n            if (fileExt.equals(extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Checks whether the extension of the filename is one of those specified.\n     * <p>\n     * This method obtains the extension as the textual part of the filename\n     * after the last dot. There must be no directory separator after the dot.\n     * The extension check is case-sensitive on all platforms.\n     * @param filename the filename to query, null returns false\n     * @param extensions the extensions to check for, null checks for no extension\n     * @return true if the filename is one of the extensions\n     */\n    public static boolean isExtension(String filename,\n                                      Collection<String> extensions) {\n        if (filename == null) {\n            return false;\n        }\n        if (extensions == null || extensions.isEmpty()) {\n            return indexOfExtension(filename) == -1;\n        }\n        String fileExt = getExtension(filename);\n        for (String extension : extensions) {\n            if (fileExt.equals(extension)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Checks a filename to see if it matches the specified wildcard matcher,\n     * always testing case-sensitive.\n     * <p>\n     * The wildcard matcher uses the characters '?' and '*' to represent a\n     * single or multiple (zero or more) wildcard characters.\n     * This is the same as often found on Dos/Unix command lines.\n     * The check is case-sensitive always.\n     * <pre>\n     * wildcardMatch(\"c.txt\", \"*.txt\")      --> true\n     * wildcardMatch(\"c.txt\", \"*.jpg\")      --> false\n     * wildcardMatch(\"a/b/c.txt\", \"a/b/*\")  --> true\n     * wildcardMatch(\"c.txt\", \"*.???\")      --> true\n     * wildcardMatch(\"c.txt\", \"*.????\")     --> false\n     * </pre>\n     * N.B. the sequence \"*?\" does not work properly at present in match strings.\n     * @param filename the filename to match on\n     * @param wildcardMatcher the wildcard string to match against\n     * @return true if the filename matches the wilcard string\n     * @see IOCase#SENSITIVE\n     */\n    public static boolean wildcardMatch(String filename,\n                                        String wildcardMatcher) {\n        return wildcardMatch(filename,\n                             wildcardMatcher,\n                             IOCase.SENSITIVE);\n    }\n\n    /**\n     * Checks a filename to see if it matches the specified wildcard matcher\n     * using the case rules of the system.\n     * <p>\n     * The wildcard matcher uses the characters '?' and '*' to represent a\n     * single or multiple (zero or more) wildcard characters.\n     * This is the same as often found on Dos/Unix command lines.\n     * The check is case-sensitive on Unix and case-insensitive on Windows.\n     * <pre>\n     * wildcardMatch(\"c.txt\", \"*.txt\")      --> true\n     * wildcardMatch(\"c.txt\", \"*.jpg\")      --> false\n     * wildcardMatch(\"a/b/c.txt\", \"a/b/*\")  --> true\n     * wildcardMatch(\"c.txt\", \"*.???\")      --> true\n     * wildcardMatch(\"c.txt\", \"*.????\")     --> false\n     * </pre>\n     * N.B. the sequence \"*?\" does not work properly at present in match strings.\n     * @param filename the filename to match on\n     * @param wildcardMatcher the wildcard string to match against\n     * @return true if the filename matches the wilcard string\n     * @see IOCase#SYSTEM\n     */\n    public static boolean wildcardMatchOnSystem(String filename,\n                                                String wildcardMatcher) {\n        return wildcardMatch(filename,\n                             wildcardMatcher,\n                             IOCase.SYSTEM);\n    }\n\n    /**\n     * Checks a filename to see if it matches the specified wildcard matcher\n     * allowing control over case-sensitivity.\n     * <p>\n     * The wildcard matcher uses the characters '?' and '*' to represent a\n     * single or multiple (zero or more) wildcard characters.\n     * N.B. the sequence \"*?\" does not work properly at present in match strings.\n     * @param filename the filename to match on\n     * @param wildcardMatcher the wildcard string to match against\n     * @param caseSensitivity what case sensitivity rule to use, null means case-sensitive\n     * @return true if the filename matches the wilcard string\n     * @since 1.3\n     */\n    public static boolean wildcardMatch(String filename,\n                                        String wildcardMatcher,\n                                        IOCase caseSensitivity) {\n        if (filename == null && wildcardMatcher == null) {\n            return true;\n        }\n        if (filename == null || wildcardMatcher == null) {\n            return false;\n        }\n        if (caseSensitivity == null) {\n            caseSensitivity = IOCase.SENSITIVE;\n        }\n        String[] wcs = splitOnTokens(wildcardMatcher);\n        boolean anyChars = false;\n        int textIdx = 0;\n        int wcsIdx = 0;\n        Stack<int[]> backtrack = new Stack<int[]>();\n\n        // loop around a backtrack stack, to handle complex * matching\n        do {\n            if (backtrack.size() > 0) {\n                int[] array = backtrack.pop();\n                wcsIdx = array[0];\n                textIdx = array[1];\n                anyChars = true;\n            }\n\n            // loop whilst tokens and text left to process\n            while (wcsIdx < wcs.length) {\n\n                if (wcs[wcsIdx].equals(\"?\")) {\n                    // ? so move to next text char\n                    textIdx++;\n                    if (textIdx > filename.length()) {\n                        break;\n                    }\n                    anyChars = false;\n                } else if (wcs[wcsIdx].equals(\"*\")) {\n                    // set any chars status\n                    anyChars = true;\n                    if (wcsIdx == wcs.length - 1) {\n                        textIdx = filename.length();\n                    }\n                } else {\n                    // matching text token\n                    if (anyChars) {\n                        // any chars then try to locate text token\n                        textIdx = caseSensitivity.checkIndexOf(filename,\n                                                               textIdx,\n                                                               wcs[wcsIdx]);\n                        if (textIdx == -1) {\n                            // token not found\n                            break;\n                        }\n                        int repeat = caseSensitivity.checkIndexOf(filename,\n                                                                  textIdx + 1,\n                                                                  wcs[wcsIdx]);\n                        if (repeat >= 0) {\n                            backtrack.push(new int[]{wcsIdx, repeat});\n                        }\n                    } else {\n                        // matching from current position\n                        if (!caseSensitivity.checkRegionMatches(filename,\n                                                                textIdx,\n                                                                wcs[wcsIdx])) {\n                            // couldnt match token\n                            break;\n                        }\n                    }\n\n                    // matched text token, move text index to end of matched token\n                    textIdx += wcs[wcsIdx].length();\n                    anyChars = false;\n                }\n\n                wcsIdx++;\n            }\n\n            // full match\n            if (wcsIdx == wcs.length && textIdx == filename.length()) {\n                return true;\n            }\n        } while (backtrack.size() > 0);\n\n        return false;\n    }\n\n    /**\n     * Splits a string into a number of tokens.\n     * The text is split by '?' and '*'.\n     * Where multiple '*' occur consecutively they are collapsed into a single '*'.\n     * @param text the text to split\n     * @return the array of tokens, never null\n     */\n    static String[] splitOnTokens(String text) {\n        // used by wildcardMatch\n        // package level so a unit test may run on this\n\n        if (text.indexOf('?') == -1 && text.indexOf('*') == -1) {\n            return new String[]{text};\n        }\n\n        char[] array = text.toCharArray();\n        ArrayList<String> list = new ArrayList<String>();\n        StringBuilder buffer = new StringBuilder();\n        for (int i = 0; i < array.length; i++) {\n            if (array[i] == '?' || array[i] == '*') {\n                if (buffer.length() != 0) {\n                    list.add(buffer.toString());\n                    buffer.setLength(0);\n                }\n                if (array[i] == '?') {\n                    list.add(\"?\");\n                } else if (list.isEmpty() ||\n                        i > 0 && list.get(list.size() - 1).equals(\"*\") == false) {\n                    list.add(\"*\");\n                }\n            } else {\n                buffer.append(array[i]);\n            }\n        }\n        if (buffer.length() != 0) {\n            list.add(buffer.toString());\n        }\n\n        return list.toArray(new String[list.size()]);\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/apache/commons/io/IOCase.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.apache.commons.io;\n\nimport java.io.Serializable;\n\n/**\n * Enumeration of IO case sensitivity.\n * <p>\n * Different filing systems have different rules for case-sensitivity.\n * Windows is case-insensitive, Unix is case-sensitive.\n * <p>\n * This class captures that difference, providing an enumeration to\n * control how filename comparisons should be performed. It also provides\n * methods that use the enumeration to perform comparisons.\n * <p>\n * Wherever possible, you should use the <code>check</code> methods in this\n * class to compare filenames.\n * @version $Id$\n * @since 1.3\n */\npublic final class IOCase implements Serializable {\n\n    /**\n     * The constant for case sensitive regardless of operating system.\n     */\n    public static final IOCase SENSITIVE = new IOCase(\"Sensitive\",\n                                                      true);\n\n    /**\n     * The constant for case insensitive regardless of operating system.\n     */\n    public static final IOCase INSENSITIVE = new IOCase(\"Insensitive\",\n                                                        false);\n\n    /**\n     * The constant for case sensitivity determined by the current operating system.\n     * Windows is case-insensitive when comparing filenames, Unix is case-sensitive.\n     * <p>\n     * <strong>Note:</strong> This only caters for Windows and Unix. Other operating\n     * systems (e.g. OSX and OpenVMS) are treated as case sensitive if they use the\n     * Unix file separator and case-insensitive if they use the Windows file separator\n     * (see {@link java.io.File#separatorChar}).\n     * <p>\n     * If you derialize this constant of Windows, and deserialize on Unix, or vice\n     * versa, then the value of the case-sensitivity flag will change.\n     */\n    public static final IOCase SYSTEM = new IOCase(\"System\",\n                                                   !FilenameUtils.isSystemWindows());\n\n    /**\n     * Serialization version.\n     */\n    private static final long serialVersionUID = -6343169151696340687L;\n\n    /**\n     * The enumeration name.\n     */\n    private final String name;\n\n    /**\n     * The sensitivity flag.\n     */\n    private final transient boolean sensitive;\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Private constructor.\n     * @param name the name\n     * @param sensitive the sensitivity\n     */\n    private IOCase(String name,\n                   boolean sensitive) {\n        this.name = name;\n        this.sensitive = sensitive;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Factory method to create an IOCase from a name.\n     * @param name the name to find\n     * @return the IOCase object\n     * @throws IllegalArgumentException if the name is invalid\n     */\n    public static IOCase forName(String name) {\n        if (IOCase.SENSITIVE.name.equals(name)) {\n            return IOCase.SENSITIVE;\n        }\n        if (IOCase.INSENSITIVE.name.equals(name)) {\n            return IOCase.INSENSITIVE;\n        }\n        if (IOCase.SYSTEM.name.equals(name)) {\n            return IOCase.SYSTEM;\n        }\n        throw new IllegalArgumentException(\"Invalid IOCase name: \" + name);\n    }\n\n    /**\n     * Replaces the enumeration from the stream with a real one.\n     * This ensures that the correct flag is set for SYSTEM.\n     * @return the resolved object\n     */\n    private Object readResolve() {\n        return forName(name);\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Gets the name of the constant.\n     * @return the name of the constant\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Does the object represent case sensitive comparison.\n     * @return true if case sensitive\n     */\n    public boolean isCaseSensitive() {\n        return sensitive;\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Compares two strings using the case-sensitivity rule.\n     * <p>\n     * This method mimics {@link String#compareTo} but takes case-sensitivity\n     * into account.\n     * @param str1 the first string to compare, not null\n     * @param str2 the second string to compare, not null\n     * @return true if equal using the case rules\n     * @throws NullPointerException if either string is null\n     */\n    public int checkCompareTo(String str1,\n                              String str2) {\n        if (str1 == null || str2 == null) {\n            throw new NullPointerException(\"The strings must not be null\");\n        }\n        return sensitive ? str1.compareTo(str2) : str1.compareToIgnoreCase(str2);\n    }\n\n    /**\n     * Compares two strings using the case-sensitivity rule.\n     * <p>\n     * This method mimics {@link String#equals} but takes case-sensitivity\n     * into account.\n     * @param str1 the first string to compare, not null\n     * @param str2 the second string to compare, not null\n     * @return true if equal using the case rules\n     * @throws NullPointerException if either string is null\n     */\n    public boolean checkEquals(String str1,\n                               String str2) {\n        if (str1 == null || str2 == null) {\n            throw new NullPointerException(\"The strings must not be null\");\n        }\n        return sensitive ? str1.equals(str2) : str1.equalsIgnoreCase(str2);\n    }\n\n    /**\n     * Checks if one string starts with another using the case-sensitivity rule.\n     * <p>\n     * This method mimics {@link String#startsWith(String)} but takes case-sensitivity\n     * into account.\n     * @param str the string to check, not null\n     * @param start the start to compare against, not null\n     * @return true if equal using the case rules\n     * @throws NullPointerException if either string is null\n     */\n    public boolean checkStartsWith(String str,\n                                   String start) {\n        return str.regionMatches(!sensitive,\n                                 0,\n                                 start,\n                                 0,\n                                 start.length());\n    }\n\n    /**\n     * Checks if one string ends with another using the case-sensitivity rule.\n     * <p>\n     * This method mimics {@link String#endsWith} but takes case-sensitivity\n     * into account.\n     * @param str the string to check, not null\n     * @param end the end to compare against, not null\n     * @return true if equal using the case rules\n     * @throws NullPointerException if either string is null\n     */\n    public boolean checkEndsWith(String str,\n                                 String end) {\n        int endLen = end.length();\n        return str.regionMatches(!sensitive,\n                                 str.length() - endLen,\n                                 end,\n                                 0,\n                                 endLen);\n    }\n\n    /**\n     * Checks if one string contains another starting at a specific index using the\n     * case-sensitivity rule.\n     * <p>\n     * This method mimics parts of {@link String#indexOf(String, int)}\n     * but takes case-sensitivity into account.\n     * @param str the string to check, not null\n     * @param strStartIndex the index to start at in str\n     * @param search the start to search for, not null\n     * @return the first index of the search String,\n     * -1 if no match or {@code null} string input\n     * @throws NullPointerException if either string is null\n     * @since 2.0\n     */\n    public int checkIndexOf(String str,\n                            int strStartIndex,\n                            String search) {\n        int endIndex = str.length() - search.length();\n        if (endIndex >= strStartIndex) {\n            for (int i = strStartIndex; i <= endIndex; i++) {\n                if (checkRegionMatches(str,\n                                       i,\n                                       search)) {\n                    return i;\n                }\n            }\n        }\n        return -1;\n    }\n\n    /**\n     * Checks if one string contains another at a specific index using the case-sensitivity rule.\n     * <p>\n     * This method mimics parts of {@link String#regionMatches(boolean, int, String, int, int)}\n     * but takes case-sensitivity into account.\n     * @param str the string to check, not null\n     * @param strStartIndex the index to start at in str\n     * @param search the start to search for, not null\n     * @return true if equal using the case rules\n     * @throws NullPointerException if either string is null\n     */\n    public boolean checkRegionMatches(String str,\n                                      int strStartIndex,\n                                      String search) {\n        return str.regionMatches(!sensitive,\n                                 strStartIndex,\n                                 search,\n                                 0,\n                                 search.length());\n    }\n\n    //-----------------------------------------------------------------------\n\n    /**\n     * Gets a string describing the sensitivity.\n     * @return a string describing the sensitivity\n     */\n    @Override\n    public String toString() {\n        return name;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/Closeable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio;\n\npublic interface Closeable extends java.io.Closeable {\n\n    public void close() throws IOException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/EncodingUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio;\n\nimport java.io.UnsupportedEncodingException;\nimport java.util.BitSet;\n\nimport org.apache.commons.codec.DecoderException;\nimport org.apache.commons.codec.net.URLCodec;\n\n/**\n * The URIUtil class that was available in commons-httpclient 3.x was retired when\n * httpclient moved to the 4.x branch.\n * <p>\n * See http://marc.info/?l=httpclient-users&m=125425095705062&w=2\n * for more informatoin.\n */\npublic class EncodingUtil {\n\n    /**\n     * Those characters that are allowed for the abs_path.\n     */\n    public static final BitSet allowed_abs_path = new BitSet(256);\n\n    // bitsets --------------------------------------------------------------------------------------------------------------------\n    /**\n     * The percent \"%\" character always has the reserved purpose of being the\n     * escape indicator, it must be escaped as \"%25\" in order to be used as\n     * data within a URI.\n     */\n    protected static final BitSet percent = new BitSet(256);\n    /**\n     * BitSet for digit.\n     * <p><blockquote><pre>\n     * digit    = \"0\" | \"1\" | \"2\" | \"3\" | \"4\" | \"5\" | \"6\" | \"7\" |\n     *            \"8\" | \"9\"\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet digit = new BitSet(256);\n    /**\n     * BitSet for alpha.\n     * <p><blockquote><pre>\n     * alpha         = lowalpha | upalpha\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet alpha = new BitSet(256);\n    /**\n     * BitSet for alphanum (join of alpha &amp; digit).\n     * <p><blockquote><pre>\n     *  alphanum      = alpha | digit\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet alphanum = new BitSet(256);\n    /**\n     * BitSet for hex.\n     * <p><blockquote><pre>\n     * hex           = digit | \"A\" | \"B\" | \"C\" | \"D\" | \"E\" | \"F\" |\n     *                         \"a\" | \"b\" | \"c\" | \"d\" | \"e\" | \"f\"\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet hex = new BitSet(256);\n    /**\n     * BitSet for escaped.\n     * <p><blockquote><pre>\n     * escaped       = \"%\" hex hex\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet escaped = new BitSet(256);\n    /**\n     * BitSet for mark.\n     * <p><blockquote><pre>\n     * mark          = \"-\" | \"_\" | \".\" | \"!\" | \"~\" | \"*\" | \"'\" |\n     *                 \"(\" | \")\"\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet mark = new BitSet(256);\n    /**\n     * Data characters that are allowed in a URI but do not have a reserved\n     * purpose are called unreserved.\n     * <p><blockquote><pre>\n     * unreserved    = alphanum | mark\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet unreserved = new BitSet(256);\n    /**\n     * BitSet for pchar.\n     * <p><blockquote><pre>\n     * pchar         = unreserved | escaped |\n     *                 \":\" | \"@\" | \"&amp;\" | \"=\" | \"+\" | \"$\" | \",\"\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet pchar = new BitSet(256);\n    /**\n     * BitSet for param (alias for pchar).\n     * <p><blockquote><pre>\n     * param         = *pchar\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet param = pchar;\n    /**\n     * BitSet for segment.\n     * <p><blockquote><pre>\n     * segment       = *pchar *( \";\" param )\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet segment = new BitSet(256);\n    /**\n     * BitSet for path segments.\n     * <p><blockquote><pre>\n     * path_segments = segment *( \"/\" segment )\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet path_segments = new BitSet(256);\n    /**\n     * URI absolute path.\n     * <p><blockquote><pre>\n     * abs_path      = \"/\"  path_segments\n     * </pre></blockquote><p>\n     */\n    protected static final BitSet abs_path = new BitSet(256);\n\n    // Static initializer for percent\n    static {\n        percent.set('%');\n    }\n\n    // Static initializer for digit\n    static {\n        for (int i = '0'; i <= '9'; i++) {\n            digit.set(i);\n        }\n    }\n\n    // Static initializer for alpha\n    static {\n        for (int i = 'a'; i <= 'z'; i++) {\n            alpha.set(i);\n        }\n        for (int i = 'A'; i <= 'Z'; i++) {\n            alpha.set(i);\n        }\n    }\n\n    // Static initializer for alphanum\n    static {\n        alphanum.or(alpha);\n        alphanum.or(digit);\n    }\n\n    // Static initializer for hex\n    static {\n        hex.or(digit);\n        for (int i = 'a'; i <= 'f'; i++) {\n            hex.set(i);\n        }\n        for (int i = 'A'; i <= 'F'; i++) {\n            hex.set(i);\n        }\n    }\n\n    // Static initializer for escaped\n    static {\n        escaped.or(percent);\n        escaped.or(hex);\n    }\n\n    // Static initializer for mark\n    static {\n        mark.set('-');\n        mark.set('_');\n        mark.set('.');\n        mark.set('!');\n        mark.set('~');\n        mark.set('*');\n        mark.set('\\'');\n        mark.set('(');\n        mark.set(')');\n    }\n\n    // Static initializer for unreserved\n    static {\n        unreserved.or(alphanum);\n        unreserved.or(mark);\n    }\n\n    // Static initializer for pchar\n    static {\n        pchar.or(unreserved);\n        pchar.or(escaped);\n        pchar.set(':');\n        pchar.set('@');\n        pchar.set('&');\n        pchar.set('=');\n        pchar.set('+');\n        pchar.set('$');\n        pchar.set(',');\n    }\n\n    // Static initializer for segment\n    static {\n        segment.or(pchar);\n        segment.set(';');\n        segment.or(param);\n    }\n\n    // Static initializer for path_segments\n    static {\n        path_segments.set('/');\n        path_segments.or(segment);\n    }\n\n    // Static initializer for abs_path\n    static {\n        abs_path.set('/');\n        abs_path.or(path_segments);\n    }\n\n    // Static initializer for allowed_abs_path\n    static {\n        allowed_abs_path.or(abs_path);\n        // allowed_abs_path.set('/');  // aleady included\n        allowed_abs_path.andNot(percent);\n        allowed_abs_path.clear('+');\n    }\n\n    private EncodingUtil() {\n        // utility class, does not need a constructor\n    }\n\n    // methods --------------------------------------------------------------------------------------------------------------------\n\n    /**\n     * Escape and encode a string regarded as the path component of an URI with\n     * the default protocol charset.\n     * @param unescaped an unescaped string\n     * @return the escaped string\n     */\n    public static String encodePath(String unescaped) {\n        byte[] rawdata = URLCodec.encodeUrl(allowed_abs_path,\n                                            getBytes(unescaped,\n                                                     \"UTF-8\"));\n        return getAsciiString(rawdata);\n    }\n\n    /**\n     * Converts the specified string to a byte array.  If the charset is not supported the\n     * default system charset is used.\n     * @param data the string to be encoded\n     * @param charset the desired character encoding\n     * @return The resulting byte array.\n     */\n    public static byte[] getBytes(final String data,\n                                  String charset) {\n        if (data == null) {\n            throw new IllegalArgumentException(\"data may not be null\");\n        }\n\n        if (charset == null || charset.length() == 0) {\n            throw new IllegalArgumentException(\"charset may not be null or empty\");\n        }\n\n        try {\n            return data.getBytes(charset);\n        } catch (UnsupportedEncodingException e) {\n\n            // We don't log things in uberfire.. ;D \n            // if (logger.isWarnEnabled()) {\n            //     logger.warn(\"Unsupported encoding: \" + charset + \". System encoding used.\");\n            // }\n\n            return data.getBytes();\n        }\n    }\n\n    /**\n     * Converts the byte array of ASCII characters to a string. This method is\n     * to be used when decoding content of HTTP elements (such as response\n     * headers)\n     * @param data the byte array to be encoded\n     * @return The string representation of the byte array\n     */\n    public static String getAsciiString(final byte[] data) {\n        if (data == null) {\n            throw new IllegalArgumentException(\"Parameter may not be null\");\n        }\n\n        try {\n            return new String(data,\n                              0,\n                              data.length,\n                              \"US-ASCII\");\n        } catch (UnsupportedEncodingException e) {\n            throw new IllegalStateException(EncodingUtil.class.getSimpleName() + \" requires ASCII support\");\n        }\n    }\n\n    /**\n     * Converts the specified string to byte array of ASCII characters.\n     * @param data the string to be encoded\n     * @return The string as a byte array.\n     */\n    public static byte[] getAsciiBytes(final String data) {\n        if (data == null) {\n            throw new IllegalArgumentException(\"Parameter may not be null\");\n        }\n\n        try {\n            return data.getBytes(\"US-ASCII\");\n        } catch (UnsupportedEncodingException e) {\n            throw new IllegalStateException(EncodingUtil.class.getSimpleName() + \" requires ASCII support\");\n        }\n    }\n\n    /**\n     * Converts the byte array of HTTP content characters to a string. If\n     * the specified charset is not supported, default system encoding\n     * is used.\n     * @param data the byte array to be encoded\n     * @param charset the desired character encoding\n     * @return The result of the conversion.\n     */\n    public static String getString(final byte[] data,\n                                   String charset) {\n        if (data == null) {\n            throw new IllegalArgumentException(\"Parameter may not be null\");\n        }\n\n        if (charset == null || charset.length() == 0) {\n            throw new IllegalArgumentException(\"charset may not be null or empty\");\n        }\n\n        try {\n            return new String(data,\n                              0,\n                              data.length,\n                              charset);\n        } catch (UnsupportedEncodingException e) {\n\n            // we don't log things uberfire\n            // if (LOG.isWarnEnabled()) {\n            //     LOG.warn(\"Unsupported encoding: \" + charset + \". System encoding used\");\n            // }\n            return new String(data,\n                              0,\n                              data.length);\n        }\n    }\n\n    /**\n     * Unescape and decode a given string regarded as an escaped string with the\n     * UTF-8 protocol charset.\n     * @param escaped a string\n     * @return the unescaped string\n     * @throws IllegalStateException if the escaped string is not a correct URL\n     */\n    public static String decode(String escaped) {\n        byte[] asciiData = getAsciiBytes(escaped);\n        byte[] rawdata;\n        try {\n            rawdata = URLCodec.decodeUrl(asciiData);\n        } catch (DecoderException e) {\n            throw new IllegalStateException(e.getMessage());\n        }\n        return getString(rawdata,\n                         \"UTF-8\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/IOException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio;\n\npublic class IOException extends RuntimeException {\n\n    public IOException() {\n        super();\n    }\n\n    public IOException(Exception e) {\n        super(e);\n    }\n\n    public IOException(final String description) {\n        super(description);\n    }\n\n    public IOException(final String description,\n                       Exception e) {\n        super(description);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/AbstractBasicFileAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic abstract class AbstractBasicFileAttributeView<P extends Path>\n        implements BasicFileAttributeView,\n                   ExtendedAttributeView {\n\n    static final String IS_REGULAR_FILE = \"isRegularFile\";\n    static final String IS_DIRECTORY = \"isDirectory\";\n    static final String IS_SYMBOLIC_LINK = \"isSymbolicLink\";\n    static final String IS_OTHER = \"isOther\";\n    static final String SIZE = \"size\";\n    static final String FILE_KEY = \"fileKey\";\n    static final String LAST_MODIFIED_TIME = \"lastModifiedTime\";\n    static final String LAST_ACCESS_TIME = \"lastAccessTime\";\n    static final String CREATION_TIME = \"creationTime\";\n\n    private static final Set<String> PROPERTIES = new HashSet<String>() {{\n        add(IS_REGULAR_FILE);\n        add(IS_DIRECTORY);\n        add(IS_SYMBOLIC_LINK);\n        add(IS_OTHER);\n        add(SIZE);\n        add(FILE_KEY);\n        add(LAST_MODIFIED_TIME);\n        add(LAST_ACCESS_TIME);\n        add(CREATION_TIME);\n    }};\n\n    protected final P path;\n\n    public AbstractBasicFileAttributeView(final P path) {\n        this.path = checkNotNull(\"path\",\n                                 path);\n    }\n\n    @Override\n    public String name() {\n        return \"basic\";\n    }\n\n    @Override\n    public void setTimes(final FileTime lastModifiedTime,\n                         final FileTime lastAccessTime,\n                         final FileTime createTime)\n            throws IOException {\n        throw new NotImplementedException();\n    }\n\n    @Override\n    public Map<String, Object> readAllAttributes() {\n        return readAttributes(\"*\");\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        final BasicFileAttributes attrs = readAttributes();\n\n        return new HashMap<String, Object>() {{\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n                if (attribute.equals(\"*\") || attribute.equals(IS_REGULAR_FILE)) {\n                    put(IS_REGULAR_FILE,\n                        attrs.isRegularFile());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(IS_DIRECTORY)) {\n                    put(IS_DIRECTORY,\n                        attrs.isDirectory());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(IS_SYMBOLIC_LINK)) {\n                    put(IS_SYMBOLIC_LINK,\n                        attrs.isSymbolicLink());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(IS_OTHER)) {\n                    put(IS_OTHER,\n                        attrs.isOther());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(SIZE)) {\n                    put(SIZE,\n                        new Long(attrs.size()));\n                }\n                if (attribute.equals(\"*\") || attribute.equals(FILE_KEY)) {\n                    put(FILE_KEY,\n                        attrs.fileKey());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(LAST_MODIFIED_TIME)) {\n                    put(LAST_MODIFIED_TIME,\n                        attrs.lastModifiedTime());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(LAST_ACCESS_TIME)) {\n                    put(LAST_ACCESS_TIME,\n                        attrs.lastAccessTime());\n                }\n                if (attribute.equals(\"*\") || attribute.equals(CREATION_TIME)) {\n                    put(CREATION_TIME,\n                        attrs.creationTime());\n                }\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n\n    @Override\n    public void setAttribute(final String attribute,\n                             final Object value) throws IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n        checkCondition(\"invalid attribute\",\n                       PROPERTIES.contains(attribute));\n\n        throw new NotImplementedException();\n    }\n\n    @Override\n    public boolean isSerializable() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/AbstractPath.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.NoSuchElementException;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\nimport org.uberfire.apache.commons.io.FilenameUtils;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.EncodingUtil;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.ClosedWatchServiceException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.InvalidPathException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent.Kind;\nimport org.uberfire.java.nio.file.WatchEvent.Modifier;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.file.attribute.AttributeView;\n\nimport static org.uberfire.commons.data.Pair.newPair;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.kie.soup.commons.validation.Preconditions.checkInstanceOf;\n\npublic abstract class AbstractPath<FS extends FileSystem>\n        implements Path,\n                   AttrHolder {\n\n    public static final Pattern WINDOWS_DRIVER = Pattern.compile(\"^/?[A-Z|a-z]+(:).*\");\n    public static final String DEFAULT_WINDOWS_DRIVER = \"C:\";\n\n    protected final FS fs;\n    protected final boolean usesWindowsFormat;\n\n    protected final boolean isAbsolute;\n    protected final byte[] path;\n    protected final boolean isRoot;\n    protected final boolean isRealPath;\n    protected final boolean isNormalized;\n    protected final String host;\n    protected final List<Pair<Integer, Integer>> offsets = new ArrayList<Pair<Integer, Integer>>();\n    protected final AttrsStorage attrsStorage = new AttrsStorageImpl();\n    protected String toStringFormat;\n    protected File file = null;\n\n    protected AbstractPath(final FS fs,\n                           final File file) {\n        this(checkNotNull(\"fs\",\n                          fs),\n             checkNotNull(\"file\",\n                          file).getAbsolutePath(),\n             \"\",\n             false,\n             false,\n             true);\n    }\n\n    protected AbstractPath(final FS fs,\n                           final String path,\n                           final String host,\n                           boolean isRoot,\n                           boolean isRealPath,\n                           boolean isNormalized) {\n        checkNotNull(\"path\",\n                     path);\n        this.fs = checkNotNull(\"fs\",\n                               fs);\n        this.host = checkNotNull(\"host\",\n                                 host);\n        this.isRealPath = isRealPath;\n        this.isNormalized = isNormalized;\n        this.usesWindowsFormat = path.indexOf('\\\\') != -1;\n\n        final RootInfo rootInfo = setupRoot(fs,\n                                            path,\n                                            host,\n                                            isRoot);\n        this.path = rootInfo.path;\n\n        checkNotNull(\"rootInfo\",\n                     rootInfo);\n\n        this.isAbsolute = rootInfo.isAbsolute;\n\n        int lastOffset = rootInfo.startOffset;\n        for (int i = lastOffset; i < this.path.length; i++) {\n            final byte b = this.path[i];\n            if (b == getSeparator()) {\n                offsets.add(newPair(lastOffset,\n                                    i));\n                i++;\n                lastOffset = i;\n            }\n        }\n\n        if (lastOffset < this.path.length) {\n            offsets.add(newPair(lastOffset,\n                                this.path.length));\n        }\n\n        this.isRoot = rootInfo.isRoot;\n    }\n\n    protected abstract Path newPath(FS fs,\n                                    String substring,\n                                    String host,\n                                    boolean realPath,\n                                    boolean isNormalized);\n\n    protected abstract Path newRoot(FS fs,\n                                    String substring,\n                                    String host,\n                                    boolean realPath);\n\n    protected abstract RootInfo setupRoot(final FS fs,\n                                          final String path,\n                                          final String host,\n                                          final boolean isRoot);\n\n    @Override\n    public FS getFileSystem() {\n        return fs;\n    }\n\n    @Override\n    public boolean isAbsolute() {\n        return isAbsolute;\n    }\n\n    @Override\n    public Path getRoot() {\n        if (isRoot) {\n            return this;\n        }\n        if (isAbsolute || !host.isEmpty()) {\n            return newRoot(fs,\n                           substring(-1),\n                           host,\n                           isRealPath);\n        }\n        return null;\n    }\n\n    private String substring(int index) {\n        final byte[] result;\n        if (index == -1) {\n            result = new byte[offsets.get(0).getK1()];\n            System.arraycopy(path,\n                             0,\n                             result,\n                             0,\n                             result.length);\n        } else {\n            final Pair<Integer, Integer> offset = offsets.get(index);\n            result = new byte[offset.getK2().intValue() - offset.getK1().intValue()];\n            System.arraycopy(path,\n                             offset.getK1(),\n                             result,\n                             0,\n                             result.length);\n        }\n\n        return new String(result);\n    }\n\n    private String substring(int beginIndex,\n                             int endIndex) {\n        final int initPos;\n        if (beginIndex == -1) {\n            initPos = 0;\n        } else {\n            initPos = offsets.get(beginIndex).getK1();\n        }\n        final Pair<Integer, Integer> offsetEnd = offsets.get(endIndex);\n        final byte[] result = new byte[offsetEnd.getK2().intValue() - initPos];\n        System.arraycopy(path,\n                         initPos,\n                         result,\n                         0,\n                         result.length);\n\n        return new String(result);\n    }\n\n    @Override\n    public Path getFileName() {\n        if (getNameCount() == 0) {\n            return null;\n        }\n        return getName(getNameCount() - 1);\n    }\n\n    @Override\n    public Path getParent() {\n        if (getNameCount() <= 0) {\n            return null;\n        }\n        if (getNameCount() == 1) {\n            return getRoot();\n        }\n        return newPath(fs,\n                       substring(-1,\n                                 getNameCount() - 2),\n                       host,\n                       isRealPath,\n                       isNormalized);\n    }\n\n    @Override\n    public int getNameCount() {\n        return offsets.size();\n    }\n\n    @Override\n    public Path getName(int index) throws IllegalArgumentException {\n        if (isRoot && index > 0) {\n            throw new IllegalArgumentException(\"Invalid index argument: \" + index);\n        }\n        if (index < 0) {\n            throw new IllegalArgumentException(\"Invalid index argument: \" + index);\n        }\n        if (index >= offsets.size()) {\n            throw new IllegalArgumentException(\"Invalid index argument: \" + index + \", max allowed is \" + (offsets.size() - 1));\n        }\n\n        return newPath(fs,\n                       substring(index),\n                       host,\n                       isRealPath,\n                       false);\n    }\n\n    @Override\n    public Path subpath(int beginIndex,\n                        int endIndex) throws IllegalArgumentException {\n        if (beginIndex < 0) {\n            throw new IllegalArgumentException(\"Invalid beginIndex argument: \" + beginIndex);\n        }\n        if (beginIndex >= offsets.size()) {\n            throw new IllegalArgumentException(\"Invalid beginIndex argument: \" + beginIndex);\n        }\n        if (endIndex > offsets.size()) {\n            throw new IllegalArgumentException(\"Invalid endIndex argument: \" + endIndex);\n        }\n        if (beginIndex >= endIndex) {\n            throw new IllegalArgumentException(\"Invalid arguments, beginIndex must be < endIndex, but they were: \"\n                                                       + \"bI \" + beginIndex + \", eI \" + endIndex);\n        }\n\n        return newPath(fs,\n                       substring(beginIndex,\n                                 endIndex - 1),\n                       host,\n                       isRealPath,\n                       false);\n    }\n\n    @Override\n    public URI toUri() throws IOException, SecurityException {\n        if (!isAbsolute()) {\n            return toAbsolutePath().toUri();\n        }\n        if (fs.provider().isDefault() && !isRealPath) {\n            return URI.create(\"default://\" + host + toURIString());\n        }\n        return URI.create(fs.provider().getScheme() + \"://\" + host + toURIString());\n    }\n\n    private String toURIString() {\n        if (usesWindowsFormat) {\n            return encodePath(\"/\" + toString().replace(\"\\\\\",\n                                                       \"/\"));\n        }\n        return encodePath(new String(path));\n    }\n\n    private String encodePath(final String s) {\n        return EncodingUtil.encodePath(s);\n    }\n\n    @Override\n    public Path toAbsolutePath() throws IOException, SecurityException {\n        if (isAbsolute()) {\n            return this;\n        }\n        if (host.isEmpty()) {\n            return newPath(fs,\n                           FilenameUtils.normalize(defaultDirectory() + toString(),\n                                                   !usesWindowsFormat),\n                           host,\n                           isRealPath,\n                           true);\n        }\n        return newPath(fs,\n                       defaultDirectory() + toString(false),\n                       host,\n                       isRealPath,\n                       true);\n    }\n\n    protected abstract String defaultDirectory();\n\n    @Override\n    public Path toRealPath(final LinkOption... options)\n            throws IOException, SecurityException {\n        if (isRealPath) {\n            return this;\n        }\n        return newPath(fs,\n                       FilenameUtils.normalize(toString(),\n                                               !usesWindowsFormat),\n                       host,\n                       true,\n                       true);\n    }\n\n    @Override\n    public Iterator<Path> iterator() {\n        return new Iterator<Path>() {\n            private int i = 0;\n\n            @Override\n            public boolean hasNext() {\n                return i < getNameCount();\n            }\n\n            @Override\n            public Path next() {\n                if (i < getNameCount()) {\n                    Path result = getName(i);\n                    i++;\n                    return result;\n                } else {\n                    throw new NoSuchElementException();\n                }\n            }\n\n            @Override\n            public void remove() {\n                throw new UnsupportedOperationException();\n            }\n        };\n    }\n\n    @Override\n    public boolean startsWith(final Path other) {\n        checkNotNull(\"other\",\n                     other);\n\n        if (other.isAbsolute() != isAbsolute()) {\n            return false;\n        }\n\n        if (!(other instanceof AbstractPath)) {\n            return false;\n        }\n\n        final AbstractPath<?> that = (AbstractPath) other;\n\n        int thisNameCount = getNameCount();\n        int thatNameCount = that.getNameCount();\n\n        if (thatNameCount > thisNameCount) {\n            return false;\n        }\n\n        List<String> thisNames = getNamesIncludingRoot();\n        List<String> thatNames = that.getNamesIncludingRoot();\n\n        for (int i = 0; i < thatNames.size(); i++) {\n            if (!thisNames.get(i).equals(thatNames.get(i))) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    @Override\n    public boolean startsWith(final String other) throws InvalidPathException {\n        checkNotNull(\"other\",\n                     other);\n        return startsWith(getFileSystem().getPath(other));\n    }\n\n    @Override\n    public boolean endsWith(final Path other) {\n        checkNotNull(\"other\",\n                     other);\n\n        if (!(other instanceof AbstractPath)) {\n            return false;\n        }\n\n        final AbstractPath<?> that = (AbstractPath) other;\n\n        if (that.isAbsolute()) {\n            if (!isAbsolute()) {\n                return false;\n            }\n            if (!equalRoots(that)) {\n                return false;\n            }\n        }\n\n        if (endsWithSeparator() != that.endsWithSeparator()) {\n            return false;\n        }\n\n        int thisNameCount = getNameCount();\n        int thatNameCount = that.getNameCount();\n\n        if (thatNameCount > thisNameCount) {\n            return false;\n        }\n\n        if (thisNameCount > 0 && thatNameCount == 0) {\n            return false;\n        }\n\n        if (thatNameCount == thisNameCount) {\n            if (thisNameCount == 0) {\n                return true;\n            }\n        } else {\n            if (that.isAbsolute()) {\n                return false;\n            }\n        }\n\n        int thisPosition = thisNameCount;\n        int thatPosition = thatNameCount;\n\n        while (thatPosition > 0) {\n            if (!getName(--thisPosition).equals(that.getName(--thatPosition))) {\n                return false;\n            }\n        }\n\n        return true;\n    }\n\n    @Override\n    public boolean endsWith(final String other) throws InvalidPathException {\n        checkNotNull(\"other\",\n                     other);\n        return endsWith(getFileSystem().getPath(other));\n    }\n\n    @Override\n    public Path normalize() {\n        if (isNormalized) {\n            return this;\n        }\n\n        return newPath(fs,\n                       FilenameUtils.normalize(new String(path),\n                                               !usesWindowsFormat),\n                       host,\n                       isRealPath,\n                       true);\n    }\n\n    @Override\n    public Path resolve(final Path other) {\n        checkNotNull(\"other\",\n                     other);\n        if (other.isAbsolute()) {\n            return other;\n        }\n        if (other.toString().trim().length() == 0) {\n            return this;\n        }\n\n        final StringBuilder sb = new StringBuilder();\n        sb.append(new String(path));\n        if (path[path.length - 1] != getSeparator()) {\n            sb.append(getSeparator());\n        }\n        sb.append(other.toString());\n\n        return newPath(fs,\n                       sb.toString(),\n                       host,\n                       isRealPath,\n                       false);\n    }\n\n    @Override\n    public Path resolve(final String other) throws InvalidPathException {\n        checkNotNull(\"other\",\n                     other);\n        return resolve(newPath(fs,\n                               other,\n                               host,\n                               isRealPath,\n                               false));\n    }\n\n    @Override\n    public Path resolveSibling(final Path other) {\n        checkNotNull(\"other\",\n                     other);\n\n        final Path parent = this.getParent();\n        if (parent == null || other.isAbsolute()) {\n            return other;\n        }\n\n        return parent.resolve(other);\n    }\n\n    @Override\n    public Path resolveSibling(final String other) throws InvalidPathException {\n        checkNotNull(\"other\",\n                     other);\n\n        return resolveSibling(newPath(fs,\n                                      other,\n                                      host,\n                                      isRealPath,\n                                      false));\n    }\n\n    @Override\n    public Path relativize(final Path otherx) throws IllegalArgumentException {\n        checkNotNull(\"otherx\",\n                     otherx);\n        final AbstractPath other = checkInstanceOf(\"otherx\",\n                                                   otherx,\n                                                   AbstractPath.class);\n\n        if (isAbsolute() != other.isAbsolute()) {\n            throw new IllegalArgumentException(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n        }\n\n        if (isAbsolute() && !equalRoots(other)) {\n            throw new IllegalArgumentException(\"Could not relativize path 'otherx', 'getRoot()' for 'this' and 'otherx' should be equal.\");\n        }\n\n        if (getNamesIncludingRoot().equals(other.getNamesIncludingRoot())) {\n            return emptyPath();\n        }\n\n        if (this.path.length == 0) {\n            return other;\n        }\n\n        int n = (getNameCount() > other.getNameCount()) ? other.getNameCount() : getNameCount();\n        int i = 0;\n        while (i < n) {\n            if (!this.getName(i).equals(other.getName(i))) {\n                break;\n            }\n            i++;\n        }\n\n        int numberOfDots = getNameCount() - i;\n\n        if (numberOfDots == 0 && i < other.getNameCount()) {\n            return other.subpath(i,\n                                 other.getNameCount());\n        }\n\n        final StringBuilder sb = new StringBuilder();\n        while (numberOfDots > 0) {\n            sb.append(\"..\");\n            if (numberOfDots > 1) {\n                sb.append(getSeparator());\n            }\n            numberOfDots--;\n        }\n\n        if (i < other.getNameCount()) {\n            if (sb.length() > 0) {\n                sb.append(getSeparator());\n            }\n            String subpath = ((AbstractPath<FS>) other.subpath(i,\n                                                               other.getNameCount())).toString(false);\n            subpath = other.getSeparator() == getSeparator() ? subpath : subpath.replaceAll(other.quoteSeparator(), quoteSeparator());\n            sb.append(subpath);\n        }\n\n        return newPath(fs,\n                       sb.toString(),\n                       host,\n                       isRealPath,\n                       false);\n    }\n\n    private Path emptyPath() {\n        return newPath(fs,\n                       \"\",\n                       host,\n                       isRealPath,\n                       true);\n    }\n\n    @Override\n    public int compareTo(final Path other) {\n        checkNotNull(\"other\",\n                     other);\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public WatchKey register(WatchService watcher,\n                             Kind<?>[] events,\n                             Modifier... modifiers)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClosedWatchServiceException, IOException, SecurityException {\n        return watcher.poll();\n    }\n\n    @Override\n    public WatchKey register(WatchService watcher,\n                             Kind<?>... events)\n            throws UnsupportedOperationException, IllegalArgumentException,\n            ClosedWatchServiceException, IOException, SecurityException {\n        return watcher.poll();\n    }\n\n    @Override\n    public String toString() {\n        if (toStringFormat == null) {\n            toStringFormat = toString(false);\n        }\n        return toStringFormat;\n    }\n\n    public String toString(boolean addHost) {\n        if (!addHost || host.isEmpty()) {\n            return new String(path);\n        }\n        if (isAbsolute) {\n            return host + new String(path);\n        } else {\n            return host + \":\" + new String(path);\n        }\n    }\n\n    private char getSeparator() {\n        if (usesWindowsFormat) {\n            return '\\\\';\n        }\n        return '/';\n    }\n\n    public void clearCache() {\n        file = null;\n        attrsStorage.clear();\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        checkNotNull(\"o\",\n                     o);\n\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof AbstractPath)) {\n            return false;\n        }\n\n        AbstractPath other = (AbstractPath) o;\n\n        if (isAbsolute != other.isAbsolute) {\n            return false;\n        }\n        if (isRealPath != other.isRealPath) {\n            return false;\n        }\n        if (isRoot != other.isRoot) {\n            return false;\n        }\n        if (usesWindowsFormat != other.usesWindowsFormat) {\n            return false;\n        }\n        if (!host.equals(other.host)) {\n            return false;\n        }\n        if (!fs.equals(other.fs)) {\n            return false;\n        }\n\n        if (!usesWindowsFormat && !Arrays.equals(path,\n                                                 other.path)) {\n            return false;\n        }\n\n        if (usesWindowsFormat && !(new String(path).equalsIgnoreCase(new String(other.path)))) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = fs != null ? fs.hashCode() : 0;\n        result = 31 * result + (usesWindowsFormat ? 1 : 0);\n        result = 31 * result + (isAbsolute ? 1 : 0);\n\n        if (!usesWindowsFormat) {\n            result = 31 * result + (path != null ? Arrays.hashCode(path) : 0);\n        } else {\n            result = 31 * result + (path != null ? new String(path).toLowerCase().hashCode() : 0);\n        }\n\n        result = 31 * result + (isRoot ? 1 : 0);\n        result = 31 * result + (isRealPath ? 1 : 0);\n        result = 31 * result + (isNormalized ? 1 : 0);\n        return result;\n    }\n\n    public String getHost() {\n        return host;\n    }\n\n    public boolean isRealPath() {\n        return isRealPath;\n    }\n\n    @Override\n    public AttrsStorage getAttrStorage() {\n        return attrsStorage;\n    }\n\n    @Override\n    public <V extends AttributeView> void addAttrView(final V view) {\n        attrsStorage.addAttrView(view);\n    }\n\n    @Override\n    public <V extends AttributeView> V getAttrView(final Class<V> type) {\n        return attrsStorage.getAttrView(type);\n    }\n\n    @Override\n    public <V extends AttributeView> V getAttrView(final String name) {\n        return (V) attrsStorage.getAttrView(name);\n    }\n\n    public static class RootInfo {\n\n        private final int startOffset;\n        private final boolean isAbsolute;\n        private final boolean isRoot;\n        private final byte[] path;\n\n        public RootInfo(int startOffset,\n                        boolean isAbsolute,\n                        boolean isRoot,\n                        byte[] path) {\n            this.startOffset = startOffset;\n            this.isAbsolute = isAbsolute;\n            this.isRoot = isRoot;\n            this.path = path;\n        }\n    }\n\n    private List<String> getNamesIncludingRoot() {\n        String[] names = toString().split(String.valueOf(quoteSeparator()));\n        if (!usesWindowsFormat && isAbsolute() && names.length > 0) {\n            return Arrays.asList(Arrays.copyOfRange(names, 1, names.length));\n        }\n        return Arrays.asList(names);\n    }\n\n    private static String stripAllSeparators(String path) {\n        return path.replaceAll(\"/\", \"\").\n                replaceAll(Matcher.quoteReplacement(\"\\\\\"), \"\");\n    }\n\n    private boolean equalRoots(AbstractPath other) {\n        String thisRootName = stripAllSeparators(getRoot().toString());\n        String otherRootName = stripAllSeparators(other.getRoot().toString());\n        if (!thisRootName.equals(otherRootName) || !host.equals(other.getHost())) {\n            return false;\n        }\n        return true;\n    }\n\n    private String quoteSeparator() {\n        return Matcher.quoteReplacement(String.valueOf(getSeparator()));\n    }\n\n    private boolean endsWithSeparator() {\n        return path[path.length-1] == getSeparator();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/AttrHolder.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.uberfire.java.nio.file.attribute.AttributeView;\n\npublic interface AttrHolder {\n\n    AttrsStorage getAttrStorage();\n\n    <V extends AttributeView> void addAttrView(final V view);\n\n    <V extends AttributeView> V getAttrView(final Class<V> type);\n\n    <V extends AttributeView> V getAttrView(final String name);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/AttrsStorage.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.Map;\n\npublic interface AttrsStorage extends AttrHolder {\n\n    Properties toProperties();\n\n    Map<String, Object> getContent();\n\n    Map<String, Object> getAllContent();\n\n    void loadContent(final Properties properties);\n\n    void clear();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/AttrsStorageImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.java.nio.file.attribute.AttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\n\nimport static java.util.Collections.unmodifiableMap;\n\npublic class AttrsStorageImpl implements AttrsStorage {\n\n    final Properties content = new Properties();\n    final Map<String, AttributeView> viewsNameIndex = new HashMap<String, AttributeView>();\n    final Map<Class<?>, AttributeView> viewsTypeIndex = new HashMap<Class<?>, AttributeView>();\n\n    @Override\n    public AttrsStorage getAttrStorage() {\n        return this;\n    }\n\n    @Override\n    public <V extends AttributeView> void addAttrView(final V view) {\n        viewsNameIndex.put(view.name(),\n                           view);\n        if (view instanceof ExtendedAttributeView) {\n            final ExtendedAttributeView extendedView = (ExtendedAttributeView) view;\n            for (Class<? extends BasicFileAttributeView> type : extendedView.viewTypes()) {\n                viewsTypeIndex.put(type,\n                                   view);\n            }\n        } else {\n            viewsTypeIndex.put(view.getClass(),\n                               view);\n        }\n    }\n\n    @Override\n    public <V extends AttributeView> V getAttrView(final Class<V> type) {\n        return (V) viewsTypeIndex.get(type);\n    }\n\n    @Override\n    public <V extends AttributeView> V getAttrView(final String name) {\n        return (V) viewsNameIndex.get(name);\n    }\n\n    @Override\n    public void clear() {\n        viewsNameIndex.clear();\n        viewsTypeIndex.clear();\n        content.clear();\n    }\n\n    @Override\n    public Properties toProperties() {\n        return buildProperties(false);\n    }\n\n    @Override\n    public void loadContent(final Properties properties) {\n        content.clear();\n        for (final Map.Entry<String, Object> attr : properties.entrySet()) {\n            content.put(attr.getKey(),\n                        attr.getValue());\n        }\n    }\n\n    @Override\n    public Map<String, Object> getContent() {\n        return unmodifiableMap(buildProperties(false));\n    }\n\n    @Override\n    public Map<String, Object> getAllContent() {\n        return unmodifiableMap(buildProperties(true));\n    }\n\n    private synchronized Properties buildProperties(boolean includesNonSerializable) {\n        final Properties properties = new Properties(content);\n\n        for (final Map.Entry<String, AttributeView> view : viewsNameIndex.entrySet()) {\n            if (includesNonSerializable ||\n                    view.getValue() instanceof ExtendedAttributeView && ((ExtendedAttributeView) view.getValue()).isSerializable()) {\n                final ExtendedAttributeView extendedView = (ExtendedAttributeView) view.getValue();\n                for (final Map.Entry<String, Object> attr : extendedView.readAllAttributes().entrySet()) {\n                    properties.put(attr.getKey(),\n                                   attr.getValue());\n                }\n            }\n        }\n\n        return properties;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/BasicFileAttributesImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class BasicFileAttributesImpl\n        implements BasicFileAttributes {\n\n    private final String fileKey;\n    private final FileTime lastModifiedTime;\n    private final FileTime creationTime;\n    private final FileTime lastAccessTime;\n    private final boolean isRegularFile;\n    private final boolean isDirectory;\n    private Long size = null;\n    private LazyAttrLoader<Long> lazySizeLoader = null;\n\n    public BasicFileAttributesImpl(final String fileKey,\n                                   final FileTime lastModifiedTime,\n                                   final FileTime creationTime,\n                                   final FileTime lastAccessTime,\n                                   final long size,\n                                   final boolean isRegularFile,\n                                   final boolean isDirectory) {\n        this.fileKey = fileKey;\n        this.lastModifiedTime = lastModifiedTime;\n        this.creationTime = creationTime;\n        this.lastAccessTime = lastAccessTime;\n        this.size = size;\n        this.isRegularFile = isRegularFile;\n        this.isDirectory = isDirectory;\n    }\n\n    public BasicFileAttributesImpl(final String fileKey,\n                                   final FileTime lastModifiedTime,\n                                   final FileTime creationTime,\n                                   final FileTime lastAccessTime,\n                                   final LazyAttrLoader<Long> size,\n                                   final boolean isRegularFile,\n                                   final boolean isDirectory) {\n        this.fileKey = fileKey;\n        this.lastModifiedTime = lastModifiedTime;\n        this.creationTime = creationTime;\n        this.lastAccessTime = lastAccessTime;\n        this.lazySizeLoader = size;\n        this.isRegularFile = isRegularFile;\n        this.isDirectory = isDirectory;\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return lastModifiedTime;\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return lastAccessTime;\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return creationTime;\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return isRegularFile;\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return isDirectory;\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return false;\n    }\n\n    @Override\n    public boolean isOther() {\n        return false;\n    }\n\n    @Override\n    public long size() {\n        if (lazySizeLoader != null) {\n            return lazySizeLoader.get();\n        }\n        return size;\n    }\n\n    @Override\n    public Object fileKey() {\n        return fileKey;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/BasicFileAttributesUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.CREATION_TIME;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.FILE_KEY;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.IS_DIRECTORY;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.IS_OTHER;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.IS_REGULAR_FILE;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.IS_SYMBOLIC_LINK;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.LAST_ACCESS_TIME;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.LAST_MODIFIED_TIME;\nimport static org.uberfire.java.nio.base.AbstractBasicFileAttributeView.SIZE;\n\npublic class BasicFileAttributesUtil {\n\n    public static Map<String, Object> cleanup(final Map<String, Object> _attrs) {\n        final Map<String, Object> attrs = new HashMap<String, Object>(_attrs);\n\n        for (final String key : _attrs.keySet()) {\n            if (key.startsWith(IS_REGULAR_FILE) || key.startsWith(IS_DIRECTORY) ||\n                    key.startsWith(IS_SYMBOLIC_LINK) || key.startsWith(SIZE) ||\n                    key.startsWith(FILE_KEY) || key.startsWith(IS_OTHER) ||\n                    key.startsWith(LAST_MODIFIED_TIME) || key.startsWith(LAST_ACCESS_TIME) ||\n                    key.startsWith(CREATION_TIME)) {\n                attrs.put(key,\n                          null);\n            }\n        }\n\n        return attrs;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/ExtendedAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.Map;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.AttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\npublic interface ExtendedAttributeView extends AttributeView {\n\n    <T extends BasicFileAttributes> T readAttributes() throws IOException;\n\n    Map<String, Object> readAllAttributes() throws IOException;\n\n    Map<String, Object> readAttributes(final String... attributes);\n\n    void setAttribute(final String attribute,\n                      final Object value) throws IOException;\n\n    Class[] viewTypes();\n\n    boolean isSerializable();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FSPath.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic interface FSPath extends Path {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FileDiff.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.List;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Represents difference between two files. This is just a segment of the file,\n * not necessary the differences of the whole file.\n */\npublic class FileDiff {\n\n    private List<String> linesA;\n    private List<String> linesB;\n    private String changeType;\n    private String nameA;\n    private String nameB;\n    private int startA;\n    private int endA;\n    private int startB;\n    private int endB;\n\n    public FileDiff(final String nameA,\n                    final String nameB,\n                    final int startA,\n                    final int endA,\n                    final int startB,\n                    final int endB,\n                    final String changeType,\n                    final List<String> linesA,\n                    final List<String> linesB) {\n\n        this.nameA = checkNotEmpty(\"nameA\",\n                                   nameA);\n        this.nameB = checkNotEmpty(\"nameB\",\n                                   nameB);\n        this.startA = startA;\n        this.endA = endA;\n        this.startB = startB;\n        this.endB = endB;\n        this.changeType = checkNotEmpty(\"nameA\",\n                                        changeType);\n        this.linesA = checkNotNull(\"linesA\",\n                                   linesA);\n        this.linesB = checkNotNull(\"linesB\",\n                                   linesB);\n    }\n\n    public List<String> getLinesA() {\n        return linesA;\n    }\n\n    public List<String> getLinesB() {\n        return linesB;\n    }\n\n    public String getChangeType() {\n        return changeType;\n    }\n\n    public String getNameA() {\n        return nameA;\n    }\n\n    public String getNameB() {\n        return nameB;\n    }\n\n    public int getStartA() {\n        return startA;\n    }\n\n    public int getEndA() {\n        return endA;\n    }\n\n    public int getStartB() {\n        return startB;\n    }\n\n    public int getEndB() {\n        return endB;\n    }\n\n    @Override\n    public String toString() {\n\n        final String linesFromA = this.getLinesA().stream().reduce(\"\",\n                                                                   (acum, elem) -> acum += \"-\" + new String(elem.getBytes()) + \"\\n\");\n        final String linesFromB = this.getLinesB().stream().reduce(\"\",\n                                                                   (acum, elem) -> acum += \"+\" + new String(elem.getBytes()) + \"\\n\");\n\n        StringBuilder builder = new StringBuilder();\n        builder.append(\"FileDiff { \\n\");\n        builder.append(this.getChangeType());\n        builder.append(\" , \\n\");\n\n        builder.append(this.getNameA());\n        builder.append(\" -> \");\n        builder.append(\"( \" + this.getStartA() + \" , \" + this.getEndA() + \" )\");\n        builder.append(\"[ \" + linesFromA + \" ]\");\n        builder.append(\" || \");\n        builder.append(this.getNameB());\n        builder.append(\" -> \");\n        builder.append(\"( \" + this.getStartB() + \" , \" + this.getEndB() + \" )\");\n        builder.append(\"[ \" + linesFromB + \" ]\");\n        builder.append(\"}\");\n\n        return builder.toString();\n    }\n\n    @Override\n    public int hashCode() {\n        int result = Integer.hashCode(startA);\n        result = ~~result;\n        result = 31 * result + (Integer.hashCode(endA));\n        result = ~~result;\n        result = 31 * result + (Integer.hashCode(startB));\n        result = ~~result;\n        result = 31 * result + (Integer.hashCode(endB));\n        result = ~~result;\n        result = 31 * result + (nameA.hashCode());\n        result = ~~result;\n        result = 31 * result + (nameB.hashCode());\n        result = ~~result;\n        result = 31 * result + (changeType.hashCode());\n        result = ~~result;\n        result = 31 * result + (linesA.hashCode());\n        result = ~~result;\n        result = 31 * result + (linesB.hashCode());\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public boolean equals(final Object obj) {\n        if (obj instanceof FileDiff) {\n            FileDiff external = (FileDiff) obj;\n            return this.startA == external.startA &&\n                    this.endA == external.endA &&\n                    this.startB == external.startB &&\n                    this.endB == external.endB &&\n                    this.changeType.equals(external.changeType) &&\n                    this.nameA.equals(external.nameA) &&\n                    this.nameB.equals(external.nameB) &&\n                    this.linesA.equals(external.linesA) &&\n                    this.linesB.equals(external.getLinesB());\n        } else {\n            return super.equals(obj);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FileSystemId.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic interface FileSystemId {\n\n    String id();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FileSystemState.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic enum FileSystemState {\n    BATCH,\n    NORMAL;\n    public static String FILE_SYSTEM_STATE_ATTR = \"FILE_SYSTEM_STATE_ATTR\";\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FileSystemStateAware.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic interface FileSystemStateAware {\n\n    FileSystemState getState();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/FileTimeImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class FileTimeImpl implements FileTime {\n\n    private Long lastModified;\n\n    public FileTimeImpl() {\n    }\n\n    public FileTimeImpl(final long lastModified) {\n        this.lastModified = lastModified;\n    }\n\n    @Override\n    public long to(final TimeUnit unit) {\n        checkNotNull(\"unit\",\n                     unit);\n        return unit.convert(lastModified,\n                            TimeUnit.MILLISECONDS);\n    }\n\n    @Override\n    public long toMillis() {\n        return lastModified;\n    }\n\n    @Override\n    public int compareTo(final FileTime o) {\n        checkNotNull(\"o\",\n                     o);\n        final long thisVal = this.toMillis();\n        final long anotherVal = o.toMillis();\n        return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/GeneralPathImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\nimport java.util.regex.Matcher;\n\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\npublic class GeneralPathImpl\n        extends AbstractPath<FileSystem>\n        implements SegmentedPath {\n\n    private GeneralPathImpl(final FileSystem fs,\n                            final File file) {\n        super(fs,\n              file);\n    }\n\n    private GeneralPathImpl(final FileSystem fs,\n                            final String path,\n                            boolean isRoot,\n                            boolean isRealPath,\n                            boolean isNormalized) {\n        super(fs,\n              path,\n              isRoot ? \"master@localhost\" : \"\",\n              isRoot,\n              isRealPath,\n              isNormalized);\n    }\n\n    public static GeneralPathImpl newFromFile(final FileSystem fs,\n                                              final File file) {\n        checkNotNull(\"fs\",\n                     fs);\n        checkNotNull(\"file\",\n                     file);\n\n        return new GeneralPathImpl(fs,\n                                   file);\n    }\n\n    public static GeneralPathImpl create(final FileSystem fs,\n                                         final String path,\n                                         boolean isRealPath) {\n        return create(fs,\n                      path,\n                      isRealPath,\n                      false);\n    }\n\n    public static GeneralPathImpl createRoot(final FileSystem fs,\n                                             final String path,\n                                             boolean isRealPath) {\n        return new GeneralPathImpl(fs,\n                                   path,\n                                   true,\n                                   isRealPath,\n                                   true);\n    }\n\n    public static GeneralPathImpl create(final FileSystem fs,\n                                         final String path,\n                                         boolean isRealPath,\n                                         boolean isNormalized) {\n        checkNotNull(\"fs\",\n                     fs);\n        checkNotNull(\"path\",\n                     path);\n\n        return new GeneralPathImpl(fs,\n                                   path,\n                                   false,\n                                   isRealPath,\n                                   isNormalized);\n    }\n\n    @Override\n    protected RootInfo setupRoot(final FileSystem fs,\n                                 final String path,\n                                 final String host,\n                                 final boolean isRoot) {\n\n        final boolean isRooted = isRoot ? true : path.startsWith(\"/\");\n        final Matcher hasWindowsDrive = WINDOWS_DRIVER.matcher(path);\n\n        final boolean isAbsolute;\n        if (isRooted || hasWindowsDrive.matches()) {\n            isAbsolute = true;\n        } else {\n            isAbsolute = false;\n        }\n\n        int lastOffset = isAbsolute ? 1 : 0;\n        int windowsDriveEndsAt = -1;\n        if (isAbsolute && hasWindowsDrive.matches()) {\n            windowsDriveEndsAt = hasWindowsDrive.toMatchResult().end(1) + 1;\n            lastOffset = windowsDriveEndsAt;\n        }\n\n        final boolean isFinalRoot;\n        if (path.length() == 1 && lastOffset == 1) {\n            isFinalRoot = true;\n        } else if (hasWindowsDrive.matches() && path.length() == windowsDriveEndsAt) {\n            isFinalRoot = true;\n        } else {\n            isFinalRoot = isRoot;\n        }\n\n        return new RootInfo(lastOffset,\n                            isAbsolute,\n                            isFinalRoot,\n                            path.getBytes());\n    }\n\n    @Override\n    protected String defaultDirectory() {\n        if (usesWindowsFormat) {\n            final String result = new File(\"\").getAbsolutePath().replaceAll(\"/\",\n                                                                            \"\\\\\\\\\") + \"\\\\\";\n\n            if (!hasWindowsDriver(result)) {\n                return DEFAULT_WINDOWS_DRIVER + result;\n            }\n            return result;\n        }\n        return new File(\"\").getAbsolutePath() + \"/\";\n    }\n\n    private boolean hasWindowsDriver(final String text) {\n        checkNotEmpty(\"text\",\n                      text);\n        return WINDOWS_DRIVER.matcher(text).matches();\n    }\n\n    @Override\n    protected Path newRoot(FileSystem fs,\n                           String substring,\n                           String host,\n                           boolean realPath) {\n        return new GeneralPathImpl(fs,\n                                   substring,\n                                   true,\n                                   realPath,\n                                   true);\n    }\n\n    @Override\n    protected Path newPath(final FileSystem fs,\n                           final String substring,\n                           String host,\n                           final boolean isRealPath,\n                           final boolean isNormalized) {\n        return new GeneralPathImpl(fs,\n                                   substring,\n                                   false,\n                                   isRealPath,\n                                   isNormalized);\n    }\n\n    @Override\n    public File toFile()\n            throws UnsupportedOperationException {\n        if (file == null) {\n            synchronized (this) {\n                file = new File(toString());\n            }\n        }\n        return file;\n    }\n\n    @Override\n    public String getSegmentId() {\n        return \"/\";\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/LazyAttrLoader.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic interface LazyAttrLoader<T> {\n\n    T get();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/NeedsPreloadedAttrs.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic interface NeedsPreloadedAttrs {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/NotImplementedException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic class NotImplementedException extends RuntimeException {\n\n    public NotImplementedException() {\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/Properties.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.thoughtworks.xstream.XStream;\nimport com.thoughtworks.xstream.XStreamException;\nimport org.kie.soup.xstream.XStreamUtils;\n\n/**\n *\n */\npublic class Properties extends HashMap<String, Object> {\n\n    public Properties() {\n    }\n\n    public Properties(final Map<String, Object> original) {\n        for (Map.Entry<String, Object> e : original.entrySet()) {\n            if (e.getValue() != null) {\n                put(e.getKey(),\n                    e.getValue());\n            }\n        }\n    }\n\n    public Object put(final String key,\n                      final Object value) {\n        if (value == null) {\n            return remove(key);\n        }\n        return super.put(key,\n                         value);\n    }\n\n    public void store(final OutputStream out) {\n        store(out,\n              true);\n    }\n\n    public void store(final OutputStream out,\n                      boolean closeOnFinish) {\n        final XStream xstream = XStreamUtils.createTrustingXStream();\n        xstream.toXML(this,\n                      out);\n        if (closeOnFinish) {\n            try {\n                out.close();\n            } catch (IOException e) {\n            }\n        }\n    }\n\n    public void load(final InputStream in) {\n        load(in,\n             true);\n    }\n\n    public void load(final InputStream in,\n                     boolean closeOnFinish) {\n        final XStream xstream = XStreamUtils.createTrustingXStream();\n        final Properties temp = new Properties();\n        try {\n            xstream.fromXML(in,\n                            temp);\n        } catch (final XStreamException ex) {\n            if (ex.getCause() != null) {\n                if (!ex.getCause().getMessage().equals(\"input contained no data\")) {\n                    throw ex;\n                }\n            }\n        }\n\n        for (final Map.Entry<String, Object> entry : temp.entrySet()) {\n            if (entry.getValue() != null) {\n                put(entry.getKey(),\n                    entry.getValue());\n            }\n        }\n        temp.clear();\n        if (closeOnFinish) {\n            try {\n                in.close();\n            } catch (IOException e) {\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/SeekableByteChannelFileBasedImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.nio.ByteBuffer;\nimport java.nio.channels.FileChannel;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n *\n */\npublic class SeekableByteChannelFileBasedImpl\n        implements SeekableByteChannel {\n\n    private final FileChannel channel;\n\n    public SeekableByteChannelFileBasedImpl(final FileChannel channel) {\n        this.channel = checkNotNull(\"channel\",\n                                    channel);\n    }\n\n    @Override\n    public long position() throws IOException {\n        try {\n            return channel.position();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public SeekableByteChannel position(final long newPosition) throws IOException {\n        try {\n            channel.position(newPosition);\n            return this;\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public long size() throws IOException {\n        try {\n            return channel.size();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public SeekableByteChannel truncate(final long size) throws IOException {\n        try {\n            channel.truncate(size);\n            return this;\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public int read(final ByteBuffer dst) throws java.io.IOException {\n        try {\n            return channel.read(dst);\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public int write(final ByteBuffer src) throws java.io.IOException {\n        try {\n            return channel.write(src);\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n\n    @Override\n    public boolean isOpen() {\n        return channel.isOpen();\n    }\n\n    @Override\n    public void close() throws java.io.IOException {\n        try {\n            channel.close();\n        } catch (java.io.IOException e) {\n            throw new IOException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/SeekableByteChannelWrapperImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.nio.ByteBuffer;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n/**\n *\n */\npublic class SeekableByteChannelWrapperImpl\n        implements SeekableByteChannel {\n\n    private final SeekableByteChannel channel;\n\n    public SeekableByteChannelWrapperImpl(final SeekableByteChannel channel) {\n        this.channel = checkNotNull(\"channel\",\n                                    channel);\n    }\n\n    @Override\n    public long position() throws IOException {\n        return channel.position();\n    }\n\n    @Override\n    public SeekableByteChannel position(final long newPosition) throws IOException {\n        return channel.position(newPosition);\n    }\n\n    @Override\n    public long size() throws IOException {\n        return channel.size();\n    }\n\n    @Override\n    public SeekableByteChannel truncate(final long size) throws IOException {\n        return channel.truncate(size);\n    }\n\n    @Override\n    public int read(final ByteBuffer dst) throws java.io.IOException {\n        return channel.read(dst);\n    }\n\n    @Override\n    public int write(final ByteBuffer src) throws java.io.IOException {\n        return channel.write(src);\n    }\n\n    @Override\n    public boolean isOpen() {\n        return channel.isOpen();\n    }\n\n    @Override\n    public void close() throws java.io.IOException {\n        channel.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/SegmentedPath.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\npublic interface SegmentedPath {\n\n    String getSegmentId();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/TextualDiff.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\npublic class TextualDiff {\n\n    private String oldFilePath;\n    private String newFilePath;\n    private String changeType;\n    private int linesAdded;\n    private int linesDeleted;\n    private String diffText;\n\n    public TextualDiff(final String oldFilePath,\n                       final String newFilePath,\n                       final String changeType,\n                       final int linesAdded,\n                       final int linesDeleted,\n                       final String diffText) {\n        this.oldFilePath = checkNotEmpty(\"oldFilePath\",\n                                         oldFilePath);\n        this.newFilePath = checkNotEmpty(\"newFilePath\",\n                                         newFilePath);\n        this.changeType = checkNotEmpty(\"changeType\",\n                                        changeType);\n\n        this.linesAdded = linesAdded;\n        this.linesDeleted = linesDeleted;\n\n        this.diffText = checkNotEmpty(\"diffText\",\n                                      diffText);\n    }\n\n    public String getOldFilePath() {\n        return oldFilePath;\n    }\n\n    public String getNewFilePath() {\n        return newFilePath;\n    }\n\n    public String getChangeType() {\n        return changeType;\n    }\n\n    public int getLinesAdded() {\n        return linesAdded;\n    }\n\n    public int getLinesDeleted() {\n        return linesDeleted;\n    }\n\n    public String getDiffText() {\n        return diffText;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/WatchContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.uberfire.java.nio.file.Path;\n\npublic interface WatchContext {\n\n    Path getPath();\n\n    Path getOldPath();\n\n    String getSessionId();\n\n    String getMessage();\n\n    String getUser();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/attributes/HiddenAttributeView.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.attributes;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\n/**\n * This is a view that extends a Basic Attribute View and adds the \"isHidden\" attribute.\n * That attribute lets you know if the branch you are querying is a hidden branch or not.\n * Hidden branches should not be used, are just a mechanism to merge.\n */\npublic abstract class HiddenAttributeView<P extends Path>\n        extends AbstractBasicFileAttributeView<P> {\n\n    public static final String HIDDEN = \"hidden\";\n\n    public HiddenAttributeView(final P path) {\n        super(path);\n    }\n\n    @Override\n    public String name() {\n        return HIDDEN;\n    }\n\n    public abstract HiddenAttributes readAttributes() throws IOException;\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        final HiddenAttributes attrs = readAttributes();\n\n        return new HashMap<String, Object>(super.readAttributes(attributes)) {{\n\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n\n                if (attribute.equals(\"*\") || attribute.equals(HIDDEN)) {\n                    put(HIDDEN,\n                        attrs.isHidden());\n                }\n\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/attributes/HiddenAttributes.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.attributes;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n * Represents files attributes with the addition of a hidden field.\n * That hidden attribute tell if a branch is hidden or not.\n * I.E.: A Pull Request hidden branch.\n * You should not use those branches unless you have to use them.\n */\npublic interface HiddenAttributes extends BasicFileAttributes {\n\n    boolean isHidden();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/attributes/HiddenAttributesImpl.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.attributes;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\n/**\n * HiddenAttribute implementation. Receives a BasicFIleAttributes,\n * and if file is hidden or not so creates a new object that has all those\n * attributes together.\n */\npublic class HiddenAttributesImpl implements HiddenAttributes {\n\n    private final boolean hidden;\n    private BasicFileAttributes attributes;\n\n    public HiddenAttributesImpl(final BasicFileAttributes attributes,\n                                final boolean isHidden) {\n        this.attributes = attributes;\n        this.hidden = isHidden;\n    }\n\n    @Override\n    public boolean isHidden() {\n        return this.hidden;\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return attributes.lastModifiedTime();\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return attributes.lastAccessTime();\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return attributes.creationTime();\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return attributes.isRegularFile();\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return attributes.isDirectory();\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return attributes.isSymbolicLink();\n    }\n\n    @Override\n    public boolean isOther() {\n        return attributes.isOther();\n    }\n\n    @Override\n    public long size() {\n        return attributes.size();\n    }\n\n    @Override\n    public Object fileKey() {\n        return attributes.fileKey();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/dotfiles/DotFileOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.dotfiles;\n\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\n\npublic class DotFileOption implements Option,\n                                      OpenOption,\n                                      CopyOption {\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        return DotFileOption.class.hashCode();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/dotfiles/DotFileUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.dotfiles;\n\nimport java.io.OutputStream;\nimport java.io.Serializable;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AttrHolder;\nimport org.uberfire.java.nio.base.Properties;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\n\n/**\n *\n */\npublic final class DotFileUtils {\n\n    private DotFileUtils() {\n\n    }\n\n    public static boolean buildDotFile(final Path path,\n                                       final OutputStream out,\n                                       final FileAttribute<?>... attrs) {\n        boolean hasContent = false;\n        if (attrs != null && attrs.length > 0) {\n            final Properties properties = new Properties();\n\n            for (final FileAttribute<?> attr : attrs) {\n                if (attr.value() instanceof Serializable) {\n                    hasContent = true;\n                    properties.put(attr.name(),\n                                   attr.value());\n                }\n            }\n\n            if (hasContent) {\n                try {\n                    properties.store(out);\n                } catch (final Exception e) {\n                    throw new IOException(e);\n                }\n            }\n\n            if (path instanceof AttrHolder) {\n                ((AttrHolder) path).getAttrStorage().loadContent(properties);\n            }\n\n            if (!hasContent) {\n                quietlyCloseStream(out);\n            }\n        } else {\n            quietlyCloseStream(out);\n            path.getFileSystem().provider().deleteIfExists(dot(path));\n        }\n\n\n        return hasContent;\n    }\n\n    public static Path dot(final Path path) {\n        if (path.getFileName() == null) {\n            return path.resolve(\".root\");\n        }\n        return path.resolveSibling(\".\" + path.getFileName());\n    }\n\n    public static Path undot(final Path path) {\n        if (!path.getFileName().toString().startsWith(\".\")) {\n            return path;\n        }\n        return path.resolveSibling(path.getFileName().toString().substring(1));\n    }\n\n    public static FileAttribute<?>[] consolidate(final Map<String, Object> props,\n                                                 final FileAttribute<?>... attrs) {\n        if (props == null || props.size() == 0) {\n            return attrs;\n        }\n\n        final Map<String, Object> temp = new HashMap<String, Object>(props);\n\n        for (final FileAttribute<?> attr : attrs) {\n            temp.put(attr.name(),\n                     attr.value());\n        }\n\n        final FileAttribute<?>[] result = new FileAttribute<?>[temp.size()];\n        int i = -1;\n        for (final Map.Entry<String, Object> attr : temp.entrySet()) {\n            result[++i] = new FileAttribute<Object>() {\n                @Override\n                public String name() {\n                    return attr.getKey();\n                }\n\n                @Override\n                public Object value() {\n                    return attr.getValue();\n                }\n            };\n        }\n\n        return result;\n    }\n\n    private static void quietlyCloseStream(OutputStream out) {\n       if (out != null) {\n           try {\n               out.close();\n           } catch (java.io.IOException e) {\n           }\n       }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/options/CherryPickCopyOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.options;\n\nimport org.uberfire.java.nio.file.CopyOption;\n\npublic class CherryPickCopyOption\n        implements CopyOption {\n\n    private final String[] commits;\n\n    public CherryPickCopyOption(final String... commits) {\n        this.commits = commits;\n    }\n\n    public String[] getCommits() {\n        return commits;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/options/CommentedOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.options;\n\nimport java.util.Date;\nimport java.util.TimeZone;\n\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\n\npublic class CommentedOption\n        implements Option,\n                   DeleteOption,\n                   OpenOption,\n                   CopyOption {\n\n    private final String sessionId;\n    private final String name;\n    private final String email;\n    private final String message;\n    private final Date when;\n    private final TimeZone timeZone;\n\n    public CommentedOption(final String name) {\n        this(null,\n             name,\n             null,\n             null,\n             null,\n             null);\n    }\n\n    public CommentedOption(final String name,\n                           final String message) {\n        this(null,\n             name,\n             null,\n             message,\n             null,\n             null);\n    }\n\n    public CommentedOption(final String name,\n                           final String email,\n                           final String message) {\n        this(null,\n             name,\n             email,\n             message,\n             null,\n             null);\n    }\n\n    public CommentedOption(final String sessionId,\n                           final String name,\n                           final String email,\n                           final String message) {\n        this(sessionId,\n             name,\n             email,\n             message,\n             null,\n             null);\n    }\n\n    public CommentedOption(final String name,\n                           final String email,\n                           final String message,\n                           final Date when) {\n        this(null,\n             name,\n             email,\n             message,\n             when,\n             null);\n    }\n\n    public CommentedOption(final String sessionId,\n                           final String name,\n                           final String email,\n                           final String message,\n                           final Date when) {\n        this(sessionId,\n             name,\n             email,\n             message,\n             when,\n             null);\n    }\n\n    public CommentedOption(final String name,\n                           final String email,\n                           final String message,\n                           final Date when,\n                           final TimeZone timeZone) {\n        this(null,\n             name,\n             email,\n             message,\n             when,\n             timeZone);\n    }\n\n    public CommentedOption(final String sessionId,\n                           final String name,\n                           final String email,\n                           final String message,\n                           final Date when,\n                           final TimeZone timeZone) {\n        this.sessionId = sessionId;\n        this.name = name;\n        this.email = email;\n        this.message = message;\n        this.when = when;\n        this.timeZone = timeZone;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getEmail() {\n        return email;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public Date getWhen() {\n        return when;\n    }\n\n    public TimeZone getTimeZone() {\n        return timeZone;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/options/MergeCopyOption.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.options;\n\nimport org.uberfire.java.nio.file.CopyOption;\n\n/**\n * This is the CopyOption that allows to merge two branches\n * when executing copy method.\n * You have to apply it as the third parameter of FileSystemProvider.copy() method.\n */\npublic class MergeCopyOption implements CopyOption {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/options/SquashOption.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.options;\n\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\npublic class SquashOption extends CommentedOption {\n\n    public static final String SQUASH_ATTR = \"SQUASH_ATTR\";\n    public VersionRecord versionRecord;\n\n    public SquashOption(VersionRecord record) {\n        super(null,\n              record.author(),\n              record.email(),\n              record.comment(),\n              record.date(),\n              null);\n        this.setRecord(record);\n    }\n\n    public VersionRecord getRecord() {\n        return versionRecord;\n    }\n\n    public void setRecord(final VersionRecord versionRecord) {\n        this.versionRecord = versionRecord;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/version/VersionAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.version;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\n\n/**\n *\n */\npublic abstract class VersionAttributeView<P extends Path>\n        extends AbstractBasicFileAttributeView<P> {\n\n    public static final String VERSION = \"version\";\n\n    public VersionAttributeView(final P path) {\n        super(path);\n    }\n\n    @Override\n    public String name() {\n        return VERSION;\n    }\n\n    public abstract VersionAttributes readAttributes() throws IOException;\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        final VersionAttributes attrs = readAttributes();\n\n        return new HashMap<String, Object>(super.readAttributes(attributes)) {{\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n\n                if (attribute.equals(\"*\") || attribute.equals(VERSION)) {\n                    put(VERSION,\n                        attrs.history());\n                }\n\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/version/VersionAttributes.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.version;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n *\n */\npublic interface VersionAttributes extends BasicFileAttributes {\n\n    VersionHistory history();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/version/VersionHistory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.version;\n\nimport java.util.List;\n\n/**\n *\n */\npublic interface VersionHistory {\n\n    List<VersionRecord> records();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/base/version/VersionRecord.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base.version;\n\nimport java.util.Date;\n\n/**\n *\n */\npublic interface VersionRecord {\n\n    String id();\n\n    String author();\n\n    String email();\n\n    String comment();\n\n    Date date();\n\n    String uri();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/channels/AsynchronousChannel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.channels;\n\npublic interface AsynchronousChannel {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/channels/AsynchronousFileChannel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.channels;\n\npublic interface AsynchronousFileChannel extends AsynchronousChannel {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/channels/CompletionHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.channels;\n\npublic interface CompletionHandler<V, A> {\n\n    void completed(V result,\n                   A attachment);\n\n    void failed(Throwable exc,\n                A attachment);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/channels/SeekableByteChannel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.channels;\n\nimport java.nio.channels.ByteChannel;\n\nimport org.uberfire.java.nio.IOException;\n\npublic interface SeekableByteChannel extends ByteChannel {\n\n    long position() throws IOException;\n\n    SeekableByteChannel position(long newPosition) throws IOException;\n\n    long size() throws IOException;\n\n    SeekableByteChannel truncate(long size) throws IOException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/AccessDeniedException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class AccessDeniedException extends FileSystemException {\n\n    public AccessDeniedException() {\n        super();\n    }\n\n    public AccessDeniedException(String file) {\n        super(file);\n    }\n\n    public AccessDeniedException(String file,\n                                 String other,\n                                 String reason) {\n        super(file,\n              other,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/AccessMode.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum AccessMode {\n    READ,\n    WRITE,\n    EXECUTE;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/AmbiguousFileSystemNameException.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class AmbiguousFileSystemNameException extends RuntimeException {\n\n    public AmbiguousFileSystemNameException() {\n    }\n\n    public AmbiguousFileSystemNameException(String msg) {\n        super(msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/AtomicMoveNotSupportedException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class AtomicMoveNotSupportedException extends FileSystemException {\n\n    public AtomicMoveNotSupportedException() {\n        super();\n    }\n\n    public AtomicMoveNotSupportedException(String source,\n                                           String target,\n                                           String reason) {\n        super(source,\n              target,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/ClosedWatchServiceException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class ClosedWatchServiceException extends IllegalStateException {\n\n    public ClosedWatchServiceException() {\n    }\n\n    public ClosedWatchServiceException(String message) {\n        super(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/CopyOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface CopyOption extends Option {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/DeleteOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface DeleteOption extends Option {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/DirectoryNotEmptyException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class DirectoryNotEmptyException extends FileSystemException {\n\n    public DirectoryNotEmptyException() {\n        super();\n    }\n\n    public DirectoryNotEmptyException(String dir) {\n        super(dir);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/DirectoryStream.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.Closeable;\nimport org.uberfire.java.nio.IOException;\n\npublic interface DirectoryStream<T> extends Closeable,\n                                            Iterable<T> {\n\n    public static interface Filter<T> {\n\n        boolean accept(T entry) throws IOException;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileAlreadyExistsException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class FileAlreadyExistsException extends FileSystemException {\n\n    public FileAlreadyExistsException() {\n        super();\n    }\n\n    public FileAlreadyExistsException(String file) {\n        super(file);\n    }\n\n    public FileAlreadyExistsException(String file,\n                                      String other,\n                                      String reason) {\n        super(file,\n              other,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileStore.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileStoreAttributeView;\n\npublic interface FileStore {\n\n    String name();\n\n    String type();\n\n    boolean isReadOnly();\n\n    long getTotalSpace() throws IOException;\n\n    long getUsableSpace() throws IOException;\n\n    long getUnallocatedSpace() throws IOException;\n\n    boolean supportsFileAttributeView(Class<? extends FileAttributeView> type);\n\n    boolean supportsFileAttributeView(String name);\n\n    <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type);\n\n    Object getAttribute(String attribute) throws UnsupportedOperationException, IOException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileSystem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.util.Set;\n\nimport org.uberfire.commons.lifecycle.Disposable;\nimport org.uberfire.java.nio.Closeable;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.UserPrincipalLookupService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\npublic interface FileSystem extends Closeable,\n                                    Disposable {\n\n    FileSystemProvider provider();\n\n    boolean isOpen();\n\n    boolean isReadOnly();\n\n    String getSeparator();\n\n    Iterable<Path> getRootDirectories();\n\n    Iterable<FileStore> getFileStores();\n\n    Set<String> supportedFileAttributeViews();\n\n    Path getPath(String first,\n                 String... more) throws InvalidPathException;\n\n    PathMatcher getPathMatcher(String syntaxAndPattern) throws IllegalArgumentException, PatternSyntaxException, UnsupportedOperationException;\n\n    UserPrincipalLookupService getUserPrincipalLookupService() throws UnsupportedOperationException;\n\n    WatchService newWatchService() throws UnsupportedOperationException, IOException;\n\n    String getName();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileSystemAlreadyExistsException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class FileSystemAlreadyExistsException extends RuntimeException {\n\n    public FileSystemAlreadyExistsException() {\n    }\n\n    public FileSystemAlreadyExistsException(String msg) {\n        super(msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileSystemException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\n\npublic class FileSystemException extends IOException {\n\n    private String file;\n    private String other;\n    private String reason;\n\n    public FileSystemException() {\n    }\n\n    public FileSystemException(String file) {\n        this.file = file;\n    }\n\n    public FileSystemException(String file,\n                               String other,\n                               String reason) {\n        this(file);\n        this.other = other;\n        this.reason = reason;\n    }\n\n    public String getFile() {\n        return this.file;\n    }\n\n    public String getOtherFile() {\n        return this.other;\n    }\n\n    public String getReason() {\n        return this.reason;\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileSystemMetadata.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.IOException;\nimport java.nio.file.Paths;\n\nimport org.uberfire.java.nio.base.FileSystemId;\n\npublic class FileSystemMetadata {\n\n    private String scheme;\n    private final String uri;\n    private boolean isAFileSystemID;\n    private String id;\n\n    public FileSystemMetadata(FileSystem fs) {\n        if (fs.getRootDirectories().iterator().hasNext()) {\n            Path root = fs.getRootDirectories().iterator().next();\n            final FileSystem realFS = root.getFileSystem();\n\n            isAFileSystemID = fs instanceof FileSystemId;\n            if (isAFileSystemID) {\n                id = ((FileSystemId) realFS).id();\n            } else {\n                id = fs.toString();\n            }\n            this.scheme = root.toUri().getScheme();\n        }\n        this.uri = fs.toString();\n    }\n\n    public boolean isAFileSystemID() {\n        return isAFileSystemID;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getScheme() {\n        return scheme;\n    }\n\n    public String getUri() {\n        return uri;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        FileSystemMetadata that = (FileSystemMetadata) o;\n\n        if (isAFileSystemID != that.isAFileSystemID) {\n            return false;\n        }\n        if (scheme != null ? !scheme.equals(that.scheme) : that.scheme != null) {\n            return false;\n        }\n        if (uri != null ? !uri.equals(that.uri) : that.uri != null) {\n            return false;\n        }\n        return id != null ? id.equals(that.id) : that.id == null;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = scheme != null ? scheme.hashCode() : 0;\n        result = 31 * result + (uri != null ? uri.hashCode() : 0);\n        result = 31 * result + (isAFileSystemID ? 1 : 0);\n        result = 31 * result + (id != null ? id.hashCode() : 0);\n        return result;\n    }\n\n    public void closeFS() throws IOException {\n        java.nio.file.Path path = Paths.get(uri);\n        java.nio.file.FileSystem fileSystem = path.getFileSystem();\n        fileSystem.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileSystemNotFoundException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class FileSystemNotFoundException extends RuntimeException {\n\n    public FileSystemNotFoundException() {\n    }\n\n    public FileSystemNotFoundException(final String msg) {\n        super(msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileVisitOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum FileVisitOption {\n    FOLLOW_LINKS\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileVisitResult.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum FileVisitResult {\n    CONTINUE,\n    TERMINATE,\n    SKIP_SUBTREE,\n    SKIP_SIBLINGS;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/FileVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\npublic interface FileVisitor<T> {\n\n    FileVisitResult preVisitDirectory(T dir,\n                                      BasicFileAttributes attrs) throws IOException;\n\n    FileVisitResult visitFile(T file,\n                              BasicFileAttributes attrs) throws IOException;\n\n    FileVisitResult visitFileFailed(T file,\n                                    IOException exc) throws IOException;\n\n    FileVisitResult postVisitDirectory(T dir,\n                                       IOException exc) throws IOException;\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/InterruptedException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class InterruptedException extends RuntimeException {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/InvalidPathException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class InvalidPathException extends IllegalArgumentException {\n\n    private String input;\n    private String reason;\n    private int index;\n\n    public InvalidPathException() {\n    }\n\n    public InvalidPathException(String input,\n                                String reason,\n                                int index) {\n        this(input,\n             reason);\n        this.index = index;\n    }\n\n    public InvalidPathException(String input,\n                                String reason) {\n        this.input = input;\n        this.reason = reason;\n    }\n\n    public String getInput() {\n        return this.input;\n    }\n\n    public String getReason() {\n        return this.reason;\n    }\n\n    public int getIndex() {\n        return this.index;\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/LinkOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum LinkOption implements OpenOption,\n                                  CopyOption {\n    NOFOLLOW_LINKS\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/LockableFileSystem.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface LockableFileSystem {\n\n    void lock();\n\n    void unlock();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/NoSuchFileException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class NoSuchFileException extends FileSystemException {\n\n    public NoSuchFileException() {\n        super();\n    }\n\n    public NoSuchFileException(String file) {\n        super(file);\n    }\n\n    public NoSuchFileException(String file,\n                               String other,\n                               String reason) {\n        super(file,\n              other,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/NotDirectoryException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class NotDirectoryException extends FileSystemException {\n\n    public NotDirectoryException() {\n        super();\n    }\n\n    public NotDirectoryException(String file) {\n        super(file);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/NotLinkException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class NotLinkException extends FileSystemException {\n\n    public NotLinkException() {\n        super();\n    }\n\n    public NotLinkException(String file) {\n        super(file);\n    }\n\n    public NotLinkException(String file,\n                            String other,\n                            String reason) {\n        super(file,\n              other,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/OpenOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface OpenOption extends Option {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/Option.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface Option {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/Path.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.File;\nimport java.net.URI;\n\nimport org.uberfire.java.nio.IOException;\n\npublic interface Path extends Comparable<Path>,\n                              Iterable<Path>,\n                              Watchable {\n\n    FileSystem getFileSystem();\n\n    boolean isAbsolute();\n\n    Path getRoot();\n\n    Path getFileName();\n\n    Path getParent();\n\n    int getNameCount();\n\n    Path getName(int index) throws IllegalArgumentException;\n\n    Path subpath(int beginIndex,\n                 int endIndex) throws IllegalArgumentException;\n\n    boolean startsWith(Path other);\n\n    boolean startsWith(String other) throws InvalidPathException;\n\n    boolean endsWith(Path other);\n\n    boolean endsWith(String other) throws InvalidPathException;\n\n    Path normalize();\n\n    // resolution and relativization\n\n    Path resolve(Path other);\n\n    Path resolve(String other) throws InvalidPathException;\n\n    Path resolveSibling(Path other);\n\n    Path resolveSibling(String other) throws InvalidPathException;\n\n    Path relativize(Path other) throws IllegalArgumentException;\n\n    URI toUri() throws IOException, SecurityException;\n\n    Path toAbsolutePath() throws IOException, SecurityException;\n\n    Path toRealPath(LinkOption... options) throws IOException, SecurityException;\n\n    File toFile() throws UnsupportedOperationException;\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/PathMatcher.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic interface PathMatcher {\n\n    boolean matches(Path path);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/PatternSyntaxException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class PatternSyntaxException extends RuntimeException {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/ProviderNotFoundException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic class ProviderNotFoundException extends RuntimeException {\n\n    public ProviderNotFoundException() {\n    }\n\n    public ProviderNotFoundException(String msg) {\n        super(msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/StandardCopyOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum StandardCopyOption implements CopyOption {\n    REPLACE_EXISTING\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/StandardDeleteOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum StandardDeleteOption implements DeleteOption {\n    NON_EMPTY_DIRECTORIES\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/StandardOpenOption.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\npublic enum StandardOpenOption implements OpenOption {\n    READ,\n    WRITE,\n    APPEND,\n    TRUNCATE_EXISTING,\n    CREATE,\n    CREATE_NEW,\n    DELETE_ON_CLOSE,\n    SPARSE,\n    SYNC,\n    DSYNC\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/StandardWatchEventKind.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.commons.data.Pair;\n\npublic final class StandardWatchEventKind {\n\n    public static final WatchEvent.Kind<Path> ENTRY_CREATE = new StdWatchEventKind<Path>(\"ENTRY_CREATE\",\n                                                                                         Path.class);\n    public static final WatchEvent.Kind<Path> ENTRY_DELETE = new StdWatchEventKind<Path>(\"ENTRY_DELETE\",\n                                                                                         Path.class);\n    public static final WatchEvent.Kind<Path> ENTRY_MODIFY = new StdWatchEventKind<Path>(\"ENTRY_MODIFY\",\n                                                                                         Path.class);\n    public static final WatchEvent.Kind<Pair> ENTRY_RENAME = new StdWatchEventKind<Pair>(\"ENTRY_RENAME\",\n                                                                                         Pair.class);\n\n    private StandardWatchEventKind() {\n    }\n\n    private static class StdWatchEventKind<T> implements WatchEvent.Kind<T> {\n\n        private final String name;\n        private final Class<T> type;\n\n        StdWatchEventKind(String name,\n                          Class<T> type) {\n            this.name = name;\n            this.type = type;\n        }\n\n        @Override\n        public String name() {\n            return name;\n        }\n\n        @Override\n        public Class<T> type() {\n            return type;\n        }\n\n        @Override\n        public String toString() {\n            return name;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/WatchEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.Serializable;\n\npublic interface WatchEvent<T> extends Serializable {\n\n    Kind<T> kind();\n\n    int count();\n\n    T context();\n\n    public static interface Kind<T> {\n\n        String name();\n\n        Class<T> type();\n    }\n\n    public static interface Modifier {\n\n        String name();\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/WatchKey.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.io.Serializable;\nimport java.util.List;\n\npublic interface WatchKey extends Serializable {\n\n    boolean isValid();\n\n    List<WatchEvent<?>> pollEvents();\n\n    boolean reset();\n\n    void cancel();\n\n    Watchable watchable();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/WatchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.java.nio.Closeable;\n\npublic interface WatchService extends Closeable {\n\n    WatchKey poll() throws ClosedWatchServiceException;\n\n    WatchKey poll(long timeout,\n                  TimeUnit unit) throws ClosedWatchServiceException, InterruptedException;\n\n    WatchKey take() throws ClosedWatchServiceException, InterruptedException;\n\n    boolean isClose();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/Watchable.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file;\n\nimport org.uberfire.java.nio.IOException;\n\npublic interface Watchable {\n\n    WatchKey register(final WatchService watcher,\n                      final WatchEvent.Kind<?>[] events,\n                      final WatchEvent.Modifier... modifiers)\n            throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException,\n            IOException, SecurityException;\n\n    WatchKey register(final WatchService watcher,\n                      final WatchEvent.Kind<?>... events)\n            throws UnsupportedOperationException, IllegalArgumentException, ClosedWatchServiceException,\n            IOException, SecurityException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/AttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface AttributeView {\n\n    String name();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/BasicFileAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\nimport org.uberfire.java.nio.IOException;\n\npublic interface BasicFileAttributeView extends FileAttributeView {\n\n    <T extends BasicFileAttributes> T readAttributes() throws IOException;\n\n    void setTimes(final FileTime lastModifiedTime,\n                  final FileTime lastAccessTime,\n                  final FileTime createTime) throws IOException;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/BasicFileAttributes.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface BasicFileAttributes {\n\n    FileTime lastModifiedTime();\n\n    FileTime lastAccessTime();\n\n    FileTime creationTime();\n\n    boolean isRegularFile();\n\n    boolean isDirectory();\n\n    boolean isSymbolicLink();\n\n    boolean isOther();\n\n    long size();\n\n    Object fileKey();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/FileAttribute.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface FileAttribute<T> {\n\n    String name();\n\n    T value();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/FileAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface FileAttributeView extends AttributeView {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/FileStoreAttributeView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface FileStoreAttributeView extends AttributeView {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/FileTime.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\nimport java.util.concurrent.TimeUnit;\n\npublic interface FileTime extends Comparable<FileTime> {\n\n    long to(TimeUnit unit);\n\n    long toMillis();\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/PosixFilePermission.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic enum PosixFilePermission {\n    OWNER_READ,\n    OWNER_WRITE,\n    OWNER_EXECUTE,\n    GROUP_READ,\n    GROUP_WRITE,\n    GROUP_EXECUTE,\n    OTHERS_READ,\n    OTHERS_WRITE,\n    OTHERS_EXECUTE;\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/UserPrincipal.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\nimport java.security.Principal;\n\npublic interface UserPrincipal extends Principal {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/attribute/UserPrincipalLookupService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.attribute;\n\npublic interface UserPrincipalLookupService {\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/file/spi/FileSystemProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.file.spi;\n\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.channels.FileChannel;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ExecutorService;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.AsynchronousFileChannel;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AccessDeniedException;\nimport org.uberfire.java.nio.file.AccessMode;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileStore;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.LinkOption;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.NotLinkException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\n\n/**\n * Back port of JSR-203 from Java Platform, Standard Edition 7.\n * @see <a href=\"http://docs.oracle.com/javase/7/docs/api/java/nio/file/spi/FileSystemProvider.html\">Original JavaDoc</a>\n */\npublic interface FileSystemProvider {\n\n    void forceAsDefault();\n\n    boolean isDefault();\n\n    String getScheme();\n\n    FileSystem newFileSystem(URI uri,\n                             Map<String, ?> env)\n            throws IllegalArgumentException, IOException, SecurityException, FileSystemAlreadyExistsException;\n\n    FileSystem getFileSystem(URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException;\n\n    Path getPath(URI uri)\n            throws IllegalArgumentException, FileSystemNotFoundException, SecurityException;\n\n    FileSystem newFileSystem(Path path,\n                             Map<String, ?> env)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException;\n\n    InputStream newInputStream(final Path path,\n                               final OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, NoSuchFileException, IOException, SecurityException;\n\n    OutputStream newOutputStream(Path path,\n                                 OpenOption... options)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException;\n\n    FileChannel newFileChannel(Path path,\n                               Set<? extends OpenOption> options,\n                               FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException;\n\n    AsynchronousFileChannel newAsynchronousFileChannel(Path path,\n                                                       Set<? extends OpenOption> options,\n                                                       ExecutorService executor,\n                                                       FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException;\n\n    SeekableByteChannel newByteChannel(Path path,\n                                       Set<? extends OpenOption> options,\n                                       FileAttribute<?>... attrs)\n            throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException;\n\n    DirectoryStream<Path> newDirectoryStream(Path dir,\n                                             DirectoryStream.Filter<Path> filter)\n            throws NotDirectoryException, IOException, SecurityException;\n\n    void createDirectory(Path dir,\n                         FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException;\n\n    void createSymbolicLink(Path link,\n                            Path target,\n                            FileAttribute<?>... attrs)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException;\n\n    void createLink(Path link,\n                    Path existing)\n            throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException;\n\n    void delete(Path path,\n                DeleteOption... options)\n            throws DirectoryNotEmptyException, NoSuchFileException, IOException, SecurityException;\n\n    boolean deleteIfExists(Path path,\n                           DeleteOption... options)\n            throws DirectoryNotEmptyException, IOException, SecurityException;\n\n    Path readSymbolicLink(Path link)\n            throws UnsupportedOperationException, NotLinkException, IOException, SecurityException;\n\n    void copy(Path source,\n              Path target,\n              CopyOption... options)\n            throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException,\n            IOException, SecurityException;\n\n    void move(Path source,\n              Path target,\n              CopyOption... options)\n            throws DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException;\n\n    boolean isSameFile(Path path,\n                       Path path2)\n            throws IOException, SecurityException;\n\n    boolean isHidden(Path path)\n            throws IllegalArgumentException, IOException, SecurityException;\n\n    FileStore getFileStore(Path path)\n            throws IOException, SecurityException;\n\n    void checkAccess(Path path,\n                     AccessMode... modes)\n            throws UnsupportedOperationException, NoSuchFileException, AccessDeniedException, IOException, SecurityException;\n\n    <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                         Class<V> type,\n                                                         LinkOption... options)\n            throws NoSuchFileException;\n\n    <A extends BasicFileAttributes> A readAttributes(Path path,\n                                                     Class<A> type,\n                                                     LinkOption... options)\n            throws NoSuchFileException, UnsupportedOperationException, IOException, SecurityException;\n\n    Map<String, Object> readAttributes(Path path,\n                                       String attributes,\n                                       LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException;\n\n    void setAttribute(Path path,\n                      String attribute,\n                      Object value,\n                      LinkOption... options)\n            throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException;\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/security/FileSystemAuthorizer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.security;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.file.FileSystem;\n\n/**\n * Strategy for authorizing users to perform actions in a secured file system.\n */\npublic interface FileSystemAuthorizer {\n\n    /**\n     * Returns true if the given user is permitted to perform actions within the given file system.\n     * @param fs\n     * @param user\n     * @return\n     */\n    boolean authorize(final FileSystem fs,\n                      final User user);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/security/SSHAuthenticator.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.security;\n\nimport java.security.PublicKey;\n\nimport org.jboss.errai.security.shared.api.identity.User;\n\npublic interface SSHAuthenticator {\n\n    User authenticate(String userName, PublicKey key);\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/java/org/uberfire/java/nio/security/SecuredFileSystemProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.security;\n\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\n/**\n * Specialization of {@link FileSystemProvider} for file systems that require username/password authentication and\n * support authorization of certain actions.\n */\npublic interface SecuredFileSystemProvider extends FileSystemProvider {\n\n    /**\n     * Sets the authenticator that decides which username/password pairs are valid for the file systems managed by this\n     * provider.\n     * @param authenticator The authenticator to use. Must not be null.\n     */\n    void setJAASAuthenticator(final AuthenticationService authenticator);\n\n    void setHTTPAuthenticator(final AuthenticationService authenticator);\n\n    void setSSHAuthenticator(final SSHAuthenticator authenticator);\n\n    void setAuthorizer(final FileSystemAuthorizer authorizer);\n\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/main/resources/org/uberfire/java/nio/UberfireNIO2Model.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n\n  <source path='file'>\n    <include name=\"**/*Exception*\"/>\n  </source>\n\n  <source path='base'>\n    <include name=\"**/version/VersionHistory*\"/>\n    <include name=\"**/version/VersionRecord*\"/>\n    <include name=\"**/FileDiff*\"/>\n  </source>\n\n  <source path=''>\n    <include name=\"**/*Exception*\"/>\n  </source>\n\n</module>"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/GeneralPathEqualsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.mockito.Mockito.*;\n\npublic class GeneralPathEqualsTest {\n\n    final FileSystem fs = mock(FileSystem.class);\n    final FileSystem nfs = mock(FileSystem.class);\n\n    @Before\n    public void setup() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n        when(nfs.getSeparator()).thenReturn(\"/\");\n    }\n\n    @Test\n    public void testEquals() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThat(path).isEqualTo(path);\n\n        assertThat(path.equals(new Object())).isFalse();\n\n        assertThat(path).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                             \"/path/to/file.txt\",\n                                                             true));\n        assertThat(path).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                             \"path/to/file.txt\",\n                                                             false));\n        assertThat(path).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                             \"/path/to/file.txts\",\n                                                             false));\n        assertThat(path).isNotEqualTo(GeneralPathImpl.create(nfs,\n                                                             \"/path/to/file.txts\",\n                                                             false));\n        assertThat(path.getRoot()).isNotEqualTo(path);\n    }\n\n    @Test\n    public void testEqualsWindows() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"path/to/file.txt\",\n                                                 false);\n        final Path wpath = GeneralPathImpl.create(fs,\n                                                  \"path\\\\to\\\\file.txt\",\n                                                  false);\n\n        assertThat(path).isNotEqualTo(wpath);\n    }\n\n    @Test\n    public void testHashCode() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThat(path.hashCode()).isEqualTo(path.hashCode());\n\n        assertThat(path.hashCode()).isNotEqualTo(new Object().hashCode());\n\n        assertThat(path.hashCode()).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                                        \"/path/to/file.txt\",\n                                                                        true).hashCode());\n        assertThat(path.hashCode()).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                                        \"path/to/file.txt\",\n                                                                        false).hashCode());\n        assertThat(path.hashCode()).isNotEqualTo(GeneralPathImpl.create(fs,\n                                                                        \"/path/to/file.txts\",\n                                                                        false).hashCode());\n        assertThat(path.hashCode()).isNotEqualTo(GeneralPathImpl.create(nfs,\n                                                                        \"/path/to/file.txts\",\n                                                                        false).hashCode());\n        assertThat(path.getRoot().hashCode()).isNotEqualTo(path.hashCode());\n    }\n\n    @Test\n    public void testHashCodeWindows() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"path/to/file.txt\",\n                                                 false);\n        final Path wpath = GeneralPathImpl.create(fs,\n                                                  \"path\\\\to\\\\file.txt\",\n                                                  false);\n\n        assertThat(path.hashCode()).isNotEqualTo(wpath.hashCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/GeneralPathTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\nimport java.net.URI;\n\nimport org.apache.commons.lang3.SystemUtils;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.assertj.core.api.AssertionsForClassTypes.assertThat;\nimport static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.java.nio.base.GeneralPathImpl.create;\n\npublic class GeneralPathTest {\n\n    private static final String DEFAULT_PATH = new File(\"\").getAbsolutePath().replace('\\\\',\n                                                                                      '/') + \"/\";\n\n    final FileSystem fs = mock(FileSystem.class);\n\n    @Test\n    public void testSimpleAbsoluteUnix() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toAbsolutePath()).isEqualTo(path);\n        assertThat(path.toString()).isEqualTo(\"/path/to/file.txt\");\n\n        assertThat(path.getFileSystem()).isNotNull().isEqualTo(fs);\n\n        assertThat(path.getFileName()).isNotNull();\n        assertThat(path.getFileName().toString()).isEqualTo(\"file.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(3);\n\n        assertThat(path.getName(0)).isNotNull();\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n\n        assertThat(path.getName(1)).isNotNull();\n        assertThat(path.getName(1).toString()).isEqualTo(\"to\");\n\n        assertThat(path.getName(2)).isNotNull().isEqualTo(path.getFileName());\n\n        assertThat(path.subpath(0,\n                                1)).isNotNull();\n        assertThat(path.subpath(0,\n                                1).toString()).isEqualTo(\"path\");\n\n        assertThat(path.subpath(1,\n                                2)).isNotNull();\n        assertThat(path.subpath(1,\n                                2).toString()).isEqualTo(\"to\");\n\n        assertThat(path.subpath(0,\n                                2)).isNotNull();\n        assertThat(path.subpath(0,\n                                2).toString()).isEqualTo(\"path/to\");\n\n        assertThat(path.subpath(1,\n                                3)).isNotNull();\n        assertThat(path.subpath(1,\n                                3).toString()).isEqualTo(\"to/file.txt\");\n\n        int i = 0;\n        for (final Path currentPath : path) {\n            assertThat(currentPath).isEqualTo(path.getName(i));\n            i++;\n        }\n\n        assertThat(path.getParent()).isNotNull();\n        assertThat(path.getParent().toString()).isEqualTo(\"/path/to\");\n\n        assertThat(path.getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().toString()).isEqualTo(\"/path\");\n\n        assertThat(path.getParent().getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().getParent().toString()).isEqualTo(\"/\");\n\n        assertThat(path.getRoot().getParent()).isNull();\n\n        assertThat(path.getRoot()).isNotNull();\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"/\");\n    }\n\n    @Test\n    public void testSimpleRootUnix() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"/\");\n        assertThat(path.getFileName()).isNull();\n\n        assertThat(path.getNameCount()).isEqualTo(0);\n\n        assertThat(path.getRoot()).isNotNull().isEqualTo(path);\n\n        try {\n            path.getName(0);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (Exception e) {\n            assertThat(e).isInstanceOf(IllegalArgumentException.class);\n        }\n    }\n\n    @Test\n    public void startsWith() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n\n        assertTrue(path.startsWith(create(fs,\n                                          \"/path\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"/path/to\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"/path/to/file.txt\",\n                                          false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"/p/th/to/file.txt\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"/some/other/path/to/file.txt\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"path/to/file.txt\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"path/to\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"to\",\n                                           false)));\n    }\n\n    @Test\n    public void startsWithWindows() {\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                 false);\n        final Path unixFormatPath = create(fs,\n                                           \"/c:/path/to/file.txt\",\n                                           false);\n\n        assertTrue(path.startsWith(create(fs,\n                                          \"c:\\\\\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"c:\\\\path\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"c:\\\\path\\\\to\\\\\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"c:\\\\path\\\\to\\\\file.txt\",\n                                          false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"c:\\\\to\\\\file.txt\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"d:\\\\\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"/d:/\",\n                                           false)));\n        assertFalse(path.startsWith(create(fs,\n                                           \"d:\\\\path\\\\to\\\\file.txt\",\n                                           false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"/c:/\",\n                                          false)));\n        assertTrue(path.startsWith(create(fs,\n                                          \"/c:/path/\",\n                                          false)));\n        assertTrue(unixFormatPath.startsWith(create(fs,\n                                                    \"c:\\\\\",\n                                                    false)));\n        assertTrue(unixFormatPath.startsWith(path));\n        assertTrue(path.startsWith(unixFormatPath));\n    }\n\n    @Test\n    public void endsWith() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n\n        assertTrue(path.endsWith(create(fs,\n                                        \"file.txt\",\n                                        false)));\n        assertTrue(path.endsWith(create(fs,\n                                        \"to/file.txt\",\n                                        false)));\n        assertTrue(path.endsWith(create(fs,\n                                        \"/path/to/file.txt\",\n                                        false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"filename.txt\",\n                                         false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"/some/other/path/to/file.txt\",\n                                         false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"txt\",\n                                         false)));\n    }\n\n    @Test\n    public void endsWithWindows() {\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                 false);\n        final Path unixFormatPath = create(fs,\n                                           \"/c:/path/to/file.txt\",\n                                           false);\n\n        assertTrue(path.endsWith(create(fs,\n                                        \"file.txt\",\n                                        false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"anotherfile.txt\",\n                                         false)));\n        assertTrue(path.endsWith(create(fs,\n                                        \"to\\\\file.txt\",\n                                        false)));\n        assertTrue(path.endsWith(create(fs,\n                                        \"to/file.txt\",\n                                        false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"c:\\\\different\\\\path\\\\to\\\\file.txt\",\n                                         false)));\n        assertFalse(path.endsWith(create(fs,\n                                         \"d:\\\\path\\\\to\\\\another\\\\file.txt\",\n                                         false)));\n        assertTrue(unixFormatPath.endsWith(create(fs,\n                                                  \"to\\\\file.txt\",\n                                                  false)));\n        assertTrue(path.endsWith(unixFormatPath));\n        assertTrue(unixFormatPath.endsWith(path));\n    }\n\n    @Test\n    public void testSimpleRelativeUnix() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"path/to/file.txt\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"path/to/file.txt\");\n\n        assertThat(path.getFileSystem()).isNotNull().isEqualTo(fs);\n\n        assertThat(path.getFileName()).isNotNull();\n        assertThat(path.getFileName().toString()).isEqualTo(\"file.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(3);\n\n        assertThat(path.getName(0)).isNotNull();\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n\n        assertThat(path.getName(1)).isNotNull();\n        assertThat(path.getName(1).toString()).isEqualTo(\"to\");\n\n        assertThat(path.getName(2)).isNotNull().isEqualTo(path.getFileName());\n\n        assertThat(path.subpath(0,\n                                1)).isNotNull();\n        assertThat(path.subpath(0,\n                                1).toString()).isEqualTo(\"path\");\n\n        assertThat(path.subpath(1,\n                                2)).isNotNull();\n        assertThat(path.subpath(1,\n                                2).toString()).isEqualTo(\"to\");\n\n        assertThat(path.subpath(0,\n                                2)).isNotNull();\n        assertThat(path.subpath(0,\n                                2).toString()).isEqualTo(\"path/to\");\n\n        assertThat(path.subpath(1,\n                                3)).isNotNull();\n        assertThat(path.subpath(1,\n                                3).toString()).isEqualTo(\"to/file.txt\");\n\n        int i = 0;\n        for (final Path currentPath : path) {\n            assertThat(currentPath).isEqualTo(path.getName(i));\n            i++;\n        }\n\n        assertThat(path.getParent()).isNotNull();\n        assertThat(path.getParent().toString()).isEqualTo(\"path/to\");\n\n        assertThat(path.getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().toString()).isEqualTo(\"path\");\n\n        assertThat(path.getParent().getParent().getParent()).isNull();\n\n        assertThat(path.getRoot()).isNull();\n\n        assertThat(path.toAbsolutePath()).isNotNull();\n        assertThat(path.toAbsolutePath().toString()).isEqualTo(DEFAULT_PATH + \"path/to/file.txt\");\n    }\n\n    @Test\n    public void testSimpleAbsoluteWindows() {\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toAbsolutePath()).isEqualTo(path);\n        assertThat(path.toString()).isEqualTo(\"c:\\\\path\\\\to\\\\file.txt\");\n\n        assertThat(path.getFileSystem()).isNotNull().isEqualTo(fs);\n\n        assertThat(path.getFileName()).isNotNull();\n        assertThat(path.getFileName().toString()).isEqualTo(\"file.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(3);\n\n        assertThat(path.getName(0)).isNotNull();\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n\n        assertThat(path.getName(1)).isNotNull();\n        assertThat(path.getName(1).toString()).isEqualTo(\"to\");\n\n        assertThat(path.getName(2)).isNotNull().isEqualTo(path.getFileName());\n\n        assertThat(path.subpath(0,\n                                1)).isNotNull();\n        assertThat(path.subpath(0,\n                                1).toString()).isEqualTo(\"path\");\n\n        assertThat(path.subpath(1,\n                                2)).isNotNull();\n        assertThat(path.subpath(1,\n                                2).toString()).isEqualTo(\"to\");\n\n        assertThat(path.subpath(0,\n                                2)).isNotNull();\n        assertThat(path.subpath(0,\n                                2).toString()).isEqualTo(\"path\\\\to\");\n\n        assertThat(path.subpath(1,\n                                3)).isNotNull();\n        assertThat(path.subpath(1,\n                                3).toString()).isEqualTo(\"to\\\\file.txt\");\n\n        int i = 0;\n        for (final Path currentPath : path) {\n            assertThat(currentPath).isEqualTo(path.getName(i));\n            i++;\n        }\n\n        assertThat(path.getParent()).isNotNull();\n        assertThat(path.getParent().toString()).isEqualTo(\"c:\\\\path\\\\to\");\n\n        assertThat(path.getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().toString()).isEqualTo(\"c:\\\\path\");\n\n        assertThat(path.getParent().getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().getParent().toString()).isEqualTo(\"c:\\\\\");\n\n        assertThat(path.getRoot().getParent()).isNull();\n\n        assertThat(path.getRoot()).isNotNull();\n        assertThat(path.getRoot().toString()).isNotNull().isEqualTo(\"c:\\\\\");\n    }\n\n    @Test\n    public void testSimpleRootWindows() {\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isTrue();\n        assertThat(path.toString()).isEqualTo(\"c:\\\\\");\n        assertThat(path.getFileName()).isNull();\n\n        assertThat(path.getNameCount()).isEqualTo(0);\n\n        assertThat(path.getRoot()).isNotNull().isEqualTo(path);\n\n        try {\n            path.getName(0);\n            failBecauseExceptionWasNotThrown(IllegalArgumentException.class);\n        } catch (Exception e) {\n            assertThat(e).isInstanceOf(IllegalArgumentException.class);\n        }\n    }\n\n    @Test\n    public void testSimpleRelativeWindows() {\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"path\\\\to\\\\file.txt\",\n                                 false);\n\n        assertThat(path).isNotNull();\n        assertThat(path.isAbsolute()).isFalse();\n        assertThat(path.toString()).isEqualTo(\"path\\\\to\\\\file.txt\");\n\n        assertThat(path.getFileSystem()).isNotNull().isEqualTo(fs);\n\n        assertThat(path.getFileName()).isNotNull();\n        assertThat(path.getFileName().toString()).isEqualTo(\"file.txt\");\n\n        assertThat(path.getNameCount()).isEqualTo(3);\n\n        assertThat(path.getName(0)).isNotNull();\n        assertThat(path.getName(0).toString()).isEqualTo(\"path\");\n\n        assertThat(path.getName(1)).isNotNull();\n        assertThat(path.getName(1).toString()).isEqualTo(\"to\");\n\n        assertThat(path.getName(2)).isNotNull().isEqualTo(path.getFileName());\n\n        assertThat(path.subpath(0,\n                                1)).isNotNull();\n        assertThat(path.subpath(0,\n                                1).toString()).isEqualTo(\"path\");\n\n        assertThat(path.subpath(1,\n                                2)).isNotNull();\n        assertThat(path.subpath(1,\n                                2).toString()).isEqualTo(\"to\");\n\n        assertThat(path.subpath(0,\n                                2)).isNotNull();\n        assertThat(path.subpath(0,\n                                2).toString()).isEqualTo(\"path\\\\to\");\n\n        assertThat(path.subpath(1,\n                                3)).isNotNull();\n        assertThat(path.subpath(1,\n                                3).toString()).isEqualTo(\"to\\\\file.txt\");\n\n        int i = 0;\n        for (final Path currentPath : path) {\n            assertThat(currentPath).isEqualTo(path.getName(i));\n            i++;\n        }\n\n        assertThat(path.getParent()).isNotNull();\n        assertThat(path.getParent().toString()).isEqualTo(\"path\\\\to\");\n\n        assertThat(path.getParent().getParent()).isNotNull();\n        assertThat(path.getParent().getParent().toString()).isEqualTo(\"path\");\n\n        assertThat(path.getParent().getParent().getParent()).isNull();\n\n        assertThat(path.toAbsolutePath()).isNotNull();\n        assertWindowsPath(path.toAbsolutePath().toString(),\n                          DEFAULT_PATH.replaceAll(\"/\",\n                                                  \"\\\\\\\\\") + \"path\\\\to\\\\file.txt\");\n\n        assertThat(path.getRoot()).isNull();\n    }\n\n    @Test\n    public void testToFile() throws Exception {\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final File file = File.createTempFile(\"foo\",\n                                              \"bar\");\n        final Path path = GeneralPathImpl.newFromFile(fs,\n                                                      file);\n\n        assertThat(path).isNotNull();\n        assertThat(path.toString()).isEqualTo(file.getAbsolutePath());\n\n        assertThat(path.toFile()).isEqualTo(file);\n    }\n\n    @Test\n    public void testAbsloluteSimpleToURIUnix() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(false);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n        final URI uri = path.toUri();\n\n        assertThat(path).isNotNull();\n        assertThat(uri).isNotNull();\n        assertThat(uri.toString()).isEqualTo(\"file:///path/to/file.txt\");\n    }\n\n    @Test\n    public void testAbsoluteToURIUnix() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n        final URI uri = path.toUri();\n\n        assertThat(path).isNotNull();\n        assertThat(uri).isNotNull();\n        assertThat(uri.toString()).isEqualTo(\"default:///path/to/file.txt\");\n\n        final Path realPath = path.toRealPath();\n        assertThat(realPath).isNotNull();\n        assertThat(realPath.toRealPath()).isEqualTo(realPath);\n        assertThat(realPath.toUri()).isNotNull();\n        assertThat(realPath.toUri().toString()).isEqualTo(\"file:///path/to/file.txt\");\n    }\n\n    @Test\n    public void testRelativeToURIUnix() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"path/to/file.txt\",\n                                 false);\n        final URI uri = path.toUri();\n\n        assertThat(path).isNotNull();\n        assertThat(uri).isNotNull();\n\n        assertThat(uri.toString()).isEqualTo(\"default://\" + DEFAULT_PATH + \"path/to/file.txt\");\n\n        assertThat(path.toRealPath().toUri().toString()).isEqualTo(\"file://\" + DEFAULT_PATH + \"path/to/file.txt\");\n    }\n\n    @Test\n    public void testAbsoluteToURIWindows() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\\\\file.txt\",\n                                 false);\n        final URI uri = path.toUri();\n\n        assertThat(path).isNotNull();\n        assertThat(uri).isNotNull();\n        assertThat(uri.toString()).isEqualTo(\"default:///c:/path/to/file.txt\");\n\n        final Path realPath = path.toRealPath();\n\n        assertThat(realPath).isNotNull();\n        assertThat(realPath.toRealPath()).isEqualTo(realPath);\n        assertThat(realPath.toUri()).isNotNull();\n        assertThat(realPath.toUri().toString()).isEqualTo(\"file:///c:/path/to/file.txt\");\n    }\n\n    @Test\n    public void testRelativeToURIWindows() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"path\\\\to\\\\file.txt\",\n                                 false);\n        final URI uri = path.toUri();\n\n        assertThat(uri).isNotNull();\n        assertWindowsUri(uri.toString(),\n                         \"default:///\",\n                         DEFAULT_PATH + \"path/to/file.txt\");\n\n        assertThat(path).isNotNull();\n        assertWindowsUri(path.toRealPath().toUri().toString(),\n                         \"file:///\",\n                         DEFAULT_PATH + \"path/to/file.txt\");\n    }\n\n    @Test\n    public void testResolve() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/\",\n                                 false);\n\n        final Path resolvedPath = path.resolve(\"some/file.text\");\n\n        assertThat(resolvedPath).isNotNull();\n        assertThat(resolvedPath.toString()).isEqualTo(\"/path/to/some/file.text\");\n\n        final Path resolvedPath2 = path.resolve(\"/some/file.text\");\n\n        assertThat(resolvedPath2).isNotNull();\n        assertThat(resolvedPath2.toString()).isEqualTo(\"/some/file.text\");\n\n        final Path path2 = create(fs,\n                                  \"/path/to\",\n                                  false);\n\n        final Path resolvedPath3 = path2.resolve(\"/some/file.text\");\n        assertThat(resolvedPath3).isNotNull();\n        assertThat(resolvedPath3.toString()).isEqualTo(\"/some/file.text\");\n\n        final Path resolvedPath4 = path2.resolve(\"some/file.text\");\n        assertThat(resolvedPath4).isNotNull();\n        assertThat(resolvedPath4.toString()).isEqualTo(\"/path/to/some/file.text\");\n\n        final Path resolvedPath5 = path2.resolve(\"\");\n        assertThat(resolvedPath5).isNotNull();\n        assertThat(resolvedPath5.toString()).isEqualTo(path2.toString());\n        assertThat(resolvedPath5).isEqualTo(path2);\n    }\n\n    @Test\n    public void checkResolveNull() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/\",\n                                 false);\n\n        assertThatThrownBy(() -> path.resolve((String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void checkResolveNull2() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/\",\n                                 false);\n\n        assertThatThrownBy(() -> path.resolve((Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void testNormalize() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/\",\n                                 false);\n\n        assertThat(path.normalize()).isNotNull().isEqualTo(path);\n        assertThat(path.normalize().normalize()).isNotNull().isEqualTo(path.normalize());\n\n        final Path path2 = create(fs,\n                                  \"/some/path/../../to\",\n                                  false);\n\n        assertThat(path2.normalize()).isNotNull();\n        assertThat(path2.normalize().toString()).isEqualTo(\"/to\");\n        assertThat(path2.normalize().normalize()).isNotNull().isEqualTo(path2.normalize());\n    }\n\n    @Test\n    public void testNormalizeWindows() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\\\\\",\n                                 false);\n\n        assertThat(path.normalize()).isNotNull().isEqualTo(path);\n        assertThat(path.normalize().normalize()).isNotNull().isEqualTo(path.normalize());\n\n        final Path path2 = create(fs,\n                                  \"c:\\\\some\\\\path\\\\..\\\\..\\\\to\",\n                                  false);\n\n        assertThat(path2.normalize()).isNotNull();\n        assertThat(path2.normalize().toString()).isEqualTo(\"c:\\\\to\");\n        assertThat(path2.normalize().normalize()).isNotNull().isEqualTo(path2.normalize());\n    }\n\n    @Test\n    public void testResolveSibling() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to/\",\n                                 false);\n\n        final Path resolvedPath = path.resolveSibling(\"some/file.text\");\n\n        assertThat(resolvedPath).isNotNull();\n        assertThat(resolvedPath.toString()).isEqualTo(\"/path/some/file.text\");\n\n        final Path resolvedPath2 = path.resolveSibling(\"/some/file.text\");\n\n        assertThat(resolvedPath2).isNotNull();\n        assertThat(resolvedPath2.toString()).isEqualTo(\"/some/file.text\");\n\n        final Path path2 = create(fs,\n                                  \"/path/to\",\n                                  false);\n\n        final Path resolvedPath3 = path2.resolveSibling(\"/some/file.text\");\n        assertThat(resolvedPath3).isNotNull();\n        assertThat(resolvedPath3.toString()).isEqualTo(\"/some/file.text\");\n\n        final Path resolvedPath4 = path2.resolveSibling(\"some/file.text\");\n        assertThat(resolvedPath4).isNotNull();\n        assertThat(resolvedPath4.toString()).isEqualTo(\"/path/some/file.text\");\n\n        final Path resolvedPath5 = path2.resolveSibling(\"\");\n        assertThat(resolvedPath5).isNotNull();\n        assertThat(resolvedPath5.toString()).isEqualTo(path2.getParent().toString());\n        assertThat(resolvedPath5).isEqualTo(path2.getParent());\n    }\n\n    @Test\n    public void testRelativize() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"/path/to/some/place\",\n                                  false);\n\n        final Path relative = path.relativize(other);\n        assertThat(relative).isNotNull();\n        assertThat(relative.toString()).isEqualTo(\"some/place\");\n\n        final Path path2 = create(fs,\n                                  \"/path/to/some/place\",\n                                  false);\n        final Path other2 = create(fs,\n                                   \"/path/to\",\n                                   false);\n\n        final Path relative2 = path2.relativize(other2);\n        assertThat(relative2).isNotNull();\n        assertThat(relative2.toString()).isEqualTo(\"../..\");\n\n        final Path path3 = create(fs,\n                                  \"/path/to\",\n                                  false);\n        final Path other3 = create(fs,\n                                   \"/path/to\",\n                                   false);\n\n        final Path relative3 = path3.relativize(other3);\n        assertThat(relative3).isNotNull();\n        assertThat(relative3.toString()).isEqualTo(\"\");\n\n        final Path path4 = create(fs,\n                                  \"path/to\",\n                                  false);\n        final Path other4 = create(fs,\n                                   \"path/to/some/place\",\n                                   false);\n\n        final Path relative4 = path4.relativize(other4);\n        assertThat(relative4).isNotNull();\n        assertThat(relative4.toString()).isEqualTo(\"some/place\");\n\n        final Path path5 = create(fs,\n                                  \"path/to\",\n                                  false);\n        final Path other5 = create(fs,\n                                   \"some/place\",\n                                   false);\n\n        final Path relative5 = path5.relativize(other5);\n        assertThat(relative5).isNotNull();\n        assertThat(relative5.toString()).isEqualTo(\"../../some/place\");\n\n        final Path path6 = create(fs,\n                                  \"some/place\",\n                                  false);\n        final Path other6 = create(fs,\n                                   \"path/to\",\n                                   false);\n\n        final Path relative6 = path6.relativize(other6);\n        assertThat(relative6).isNotNull();\n        assertThat(relative6.toString()).isEqualTo(\"../../path/to\");\n\n        final Path path7 = create(fs,\n                                  \"path/to/some/thing/here\",\n                                  false);\n        final Path other7 = create(fs,\n                                   \"some/place\",\n                                   false);\n\n        final Path relative7 = path7.relativize(other7);\n        assertThat(relative7).isNotNull();\n        assertThat(relative7.toString()).isEqualTo(\"../../../../../some/place\");\n\n        final Path path8 = create(fs,\n                                  \"some/place\",\n                                  false);\n        final Path other8 = create(fs,\n                                   \"path/to/some/thing/here\",\n                                   false);\n\n        final Path relative8 = path8.relativize(other8);\n        assertThat(relative8).isNotNull();\n        assertThat(relative8.toString()).isEqualTo(\"../../path/to/some/thing/here\");\n\n        final Path path9 = create(fs,\n                                  \"/path/to\",\n                                  false);\n        final Path other9 = create(fs,\n                                   \"/path/to\",\n                                   false);\n\n        final Path relative9 = path9.relativize(other9);\n        assertThat(relative9).isNotNull();\n        assertThat(relative9.toString()).isEqualTo(\"\");\n\n        final Path path10 = create(fs,\n                                   \"path/to\",\n                                   false);\n        final Path other10 = create(fs,\n                                    \"path/to\",\n                                    false);\n\n        final Path relative10 = path10.relativize(other10);\n        assertThat(relative10).isNotNull();\n        assertThat(relative10.toString()).isEqualTo(\"\");\n\n        final Path path11 = create(fs,\n                                   \"\",\n                                   false);\n        final Path other11 = create(fs,\n                                    \"path/to\",\n                                    false);\n\n        final Path relative11 = path11.relativize(other11);\n        assertThat(relative11).isNotNull().isEqualTo(other11);\n    }\n\n    @Test\n    public void testRelativizeIlegal1() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"/path/to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"some/place\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeIlegal2() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"some/place\",\n                                 false);\n        final Path other = create(fs,\n                                  \"/path/to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeIlegal3() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"/\");\n\n        final Path path = create(fs,\n                                 \"\",\n                                 false);\n        final Path other = create(fs,\n                                  \"/path/to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeWindows() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                  false);\n\n        final Path relative = path.relativize(other);\n        assertThat(relative).isNotNull();\n        assertThat(relative.toString()).isEqualTo(\"some\\\\place\");\n\n        final Path path2 = create(fs,\n                                  \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                  false);\n        final Path other2 = create(fs,\n                                   \"c:\\\\path\\\\to\",\n                                   false);\n\n        final Path relative2 = path2.relativize(other2);\n        assertThat(relative2).isNotNull();\n        assertThat(relative2.toString()).isEqualTo(\"..\\\\..\");\n\n        final Path path3 = create(fs,\n                                  \"c:\\\\path/to\",\n                                  false);\n        final Path other3 = create(fs,\n                                   \"c:\\\\path/to\",\n                                   false);\n\n        final Path relative3 = path3.relativize(other3);\n        assertThat(relative3).isNotNull();\n        assertThat(relative3.toString()).isEqualTo(\"\");\n\n        final Path path4 = create(fs,\n                                  \"path\\\\to\",\n                                  false);\n        final Path other4 = create(fs,\n                                   \"path\\\\to\\\\some\\\\place\",\n                                   false);\n\n        final Path relative4 = path4.relativize(other4);\n        assertThat(relative4).isNotNull();\n        assertThat(relative4.toString()).isEqualTo(\"some\\\\place\");\n\n        final Path path5 = create(fs,\n                                  \"path\\\\to\",\n                                  false);\n        final Path other5 = create(fs,\n                                   \"some\\\\place\",\n                                   false);\n\n        final Path relative5 = path5.relativize(other5);\n        assertThat(relative5).isNotNull();\n        assertThat(relative5.toString()).isEqualTo(\"..\\\\..\\\\some\\\\place\");\n\n        final Path path6 = create(fs,\n                                  \"some\\\\place\",\n                                  false);\n        final Path other6 = create(fs,\n                                   \"path\\\\to\",\n                                   false);\n\n        final Path relative6 = path6.relativize(other6);\n        assertThat(relative6).isNotNull();\n        assertThat(relative6.toString()).isEqualTo(\"..\\\\..\\\\path\\\\to\");\n\n        final Path path7 = create(fs,\n                                  \"path\\\\to\\\\some\\\\thing\\\\here\",\n                                  false);\n        final Path other7 = create(fs,\n                                   \"some\\\\place\",\n                                   false);\n\n        final Path relative7 = path7.relativize(other7);\n        assertThat(relative7).isNotNull();\n        assertThat(relative7.toString()).isEqualTo(\"..\\\\..\\\\..\\\\..\\\\..\\\\some\\\\place\");\n\n        final Path path8 = create(fs,\n                                  \"some\\\\place\",\n                                  false);\n        final Path other8 = create(fs,\n                                   \"path\\\\to\\\\some\\\\thing\\\\here\",\n                                   false);\n\n        final Path relative8 = path8.relativize(other8);\n        assertThat(relative8).isNotNull();\n        assertThat(relative8.toString()).isEqualTo(\"..\\\\..\\\\path\\\\to\\\\some\\\\thing\\\\here\");\n\n        final Path path9 = create(fs,\n                                  \"c:\\\\path\\\\to\",\n                                  false);\n        final Path other9 = create(fs,\n                                   \"c:\\\\path\\\\to\",\n                                   false);\n\n        final Path relative9 = path9.relativize(other9);\n        assertThat(relative9).isNotNull();\n        assertThat(relative9.toString()).isEqualTo(\"\");\n\n        final Path path10 = create(fs,\n                                   \"path\\\\to\",\n                                   false);\n        final Path other10 = create(fs,\n                                    \"path\\\\to\",\n                                    false);\n\n        final Path relative10 = path10.relativize(other10);\n        assertThat(relative10).isNotNull();\n        assertThat(relative10.toString()).isEqualTo(\"\");\n\n        final Path path11 = create(fs,\n                                   \"\",\n                                   false);\n        final Path other11 = create(fs,\n                                    \"path\\\\to\",\n                                    false);\n\n        final Path relative11 = path11.relativize(other11);\n        assertThat(relative11).isNotNull().isEqualTo(other11);\n\n        final Path path12 = create(fs,\n                                   \"/c:/path/to\",\n                                   false);\n        final Path other12 = create(fs,\n                                    \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                    false);\n\n        final Path relative12 = path12.relativize(other12);\n        assertThat(relative12).isNotNull();\n        assertThat(relative12.toString()).isEqualTo(\"some\\\\place\");\n\n        final Path path13 = create(fs,\n                                   \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                   false);\n        final Path other13 = create(fs,\n                                    \"/c:/path/to\",\n                                    false);\n\n        final Path relative13 = path13.relativize(other13);\n        assertThat(relative13).isNotNull();\n        assertThat(relative13.toString()).isEqualTo(\"..\\\\..\");\n\n        final Path path14 = create(fs,\n                                   \"/c:/path/to/some/place\",\n                                   false);\n        final Path other14 = create(fs,\n                                    \"c:\\\\path\\\\to\",\n                                    false);\n\n        final Path relative14 = path14.relativize(other14);\n        assertThat(relative14).isNotNull();\n        assertThat(relative14.toString()).isEqualTo(\"../..\");\n\n        final Path path15 = create(fs,\n                                   \"/c:/path/to/some/place\",\n                                   false);\n        final Path other15 = create(fs,\n                                    \"c:\\\\path\\\\to\\\\some\\\\other\\\\place\",\n                                    false);\n\n        final Path relative15 = path15.relativize(other15);\n        assertThat(relative15).isNotNull();\n        assertThat(relative15.toString()).isEqualTo(\"../other/place\");\n\n        final Path path16 = create(fs,\n                                   \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                   false);\n        final Path other16 = create(fs,\n                                    \"/c:/path/to/some/other/place\",\n                                    false);\n\n        final Path relative16 = path16.relativize(other16);\n        assertThat(relative16).isNotNull();\n        assertThat(relative16.toString()).isEqualTo(\"..\\\\other\\\\place\");\n\n        final Path path17 = create(fs,\n                                   \"c:\\\\path\\\\to\\\\some\\\\place\",\n                                   false);\n        final Path other17 = create(fs,\n                                    \"/c:/path/to/some/place\",\n                                    false);\n\n        final Path relative17 = path17.relativize(other17);\n        assertThat(relative17).isNotNull();\n        assertThat(relative17.toString()).isEmpty();\n        assertThat(other17.relativize(path17).toString().isEmpty());\n    }\n\n    @Test\n    public void testRelativizeWindowsIllegal1() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"c:\\\\path\\\\to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"some\\\\place\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeWindowsIllegal2() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"some\\\\place\",\n                                 false);\n        final Path other = create(fs,\n                                  \"c:\\\\path\\\\to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeWindowsIllegal3() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"\",\n                                 false);\n        final Path other = create(fs,\n                                  \"c:\\\\path\\\\to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'isAbsolute()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeWindowsIllegal4() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"d:\\\\path\\\\to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"c:\\\\path\\\\to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'getRoot()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    @Test\n    public void testRelativizeWindowsIllegal5() {\n        final FileSystemProvider fsprovider = mock(FileSystemProvider.class);\n        when(fsprovider.isDefault()).thenReturn(true);\n        when(fsprovider.getScheme()).thenReturn(\"file\");\n        when(fs.provider()).thenReturn(fsprovider);\n\n        when(fs.getSeparator()).thenReturn(\"\\\\\");\n\n        final Path path = create(fs,\n                                 \"/d:/path/to\",\n                                 false);\n        final Path other = create(fs,\n                                  \"c:\\\\path\\\\to\",\n                                  false);\n\n        assertThatThrownBy(() -> path.relativize(other))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Could not relativize path 'otherx', 'getRoot()' for 'this' and 'otherx' should be equal.\");\n    }\n\n    private void assertWindowsUri(String actualUri,\n                                  String expectedUriScheme,\n                                  String expectedUriPath) {\n        String expectedPathPrefix = determineWindowsPathPrefix();\n        assertThat(actualUri).isEqualTo(expectedUriScheme + expectedPathPrefix + expectedUriPath);\n    }\n\n    private void assertWindowsPath(String actualPath,\n                                   String expectedPath) {\n        String expectedPathPrefix = determineWindowsPathPrefix();\n        assertThat(actualPath).isEqualTo(expectedPathPrefix + expectedPath);\n    }\n\n    private String determineWindowsPathPrefix() {\n        // in case the test runs on unix-like systems, UF adds \"C:\" prefix to the path\n        // on Windows, that of course does not happen as the drive letter is directly in the path\n        if (SystemUtils.IS_OS_WINDOWS) {\n            return \"\";\n        } else {\n            return \"C:\";\n        }\n    }\n}"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/GeneralPathUnsupportedOpsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchService;\n\nimport static org.mockito.Mockito.*;\n\npublic class GeneralPathUnsupportedOpsTest {\n\n    final FileSystem fs = mock(FileSystem.class);\n    final WatchService ws = mock(WatchService.class);\n    final WatchEvent.Kind kd = mock(WatchEvent.Kind.class);\n    final WatchEvent.Modifier mf = mock(WatchEvent.Modifier.class);\n\n    Path param;\n\n    @Before\n    public void setup() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n        param = GeneralPathImpl.create(fs,\n                                       \"path\",\n                                       false);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    public void compareTo() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        path.compareTo(param);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    @Ignore\n    public void register() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        path.register(ws);\n    }\n\n    @Test(expected = UnsupportedOperationException.class)\n    @Ignore\n    public void register2() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        path.register(ws,\n                      new WatchEvent.Kind<?>[]{kd},\n                      mf);\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/GeneralPathValidationTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.mockito.Mockito.*;\n\npublic class GeneralPathValidationTest {\n\n    final FileSystem fs = mock(FileSystem.class);\n\n    @Before\n    public void setup() {\n        when(fs.getSeparator()).thenReturn(\"/\");\n    }\n\n    @Test\n    public void createNull1() {\n        assertThatThrownBy(() -> GeneralPathImpl.create(null,\n                                                        \"/path/to/file.txt\",\n                                                        false))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'fs' should be not null!\");\n    }\n\n    @Test\n    public void createNull2() {\n        assertThatThrownBy(() -> GeneralPathImpl.create(fs,\n                                                        null,\n                                                        false))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'path' should be not null!\");\n    }\n\n    @Test\n    public void newFromFileNull1() {\n        assertThatThrownBy(() -> GeneralPathImpl.newFromFile(null,\n                                                             new File(\"\")))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'fs' should be not null!\");\n    }\n\n    @Test\n    public void newFromFileNull2() {\n        assertThatThrownBy(() -> GeneralPathImpl.newFromFile(fs,\n                                                             null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'file' should be not null!\");\n    }\n\n    @Test\n    public void getNameNegative() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.getName(-1))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Invalid index argument: -1\");\n    }\n\n    @Test\n    public void subpathInvaligRange1() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.subpath(-1, 1))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Invalid beginIndex argument: -1\");\n    }\n\n    @Test\n    public void subpathInvaligRange2() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThatThrownBy(() -> path.subpath(5, 7))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Invalid beginIndex argument: 5\");\n    }\n\n    @Test\n    public void subpathInvaligRange3() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThatThrownBy(() -> path.subpath(0, 7))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Invalid endIndex argument: 7\");\n    }\n\n    @Test\n    public void subpathInvaligRange4() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n        assertThatThrownBy(() -> path.subpath(2, 1))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Invalid arguments, beginIndex must be < endIndex, but they were: bI 2, eI 1\");\n    }\n\n    @Test\n    public void startsWith() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.startsWith((String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void startsWithPath() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.startsWith((Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void endsWith() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.endsWith((String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void endsWithPath() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.endsWith((Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void resolve() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.resolve((String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void resolvePath() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.resolve((Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void resolveSibling() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.resolveSibling((String) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void resolveSiblingPath() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.resolveSibling((Path) null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void relativize() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.relativize(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'otherx' should be not null!\");\n    }\n\n    @Test\n    public void compareTo() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.compareTo(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'other' should be not null!\");\n    }\n\n    @Test\n    public void checkEquals() {\n        final Path path = GeneralPathImpl.create(fs,\n                                                 \"/path/to/file.txt\",\n                                                 false);\n\n        assertThatThrownBy(() -> path.equals(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'o' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/PropertiesTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\nimport java.io.FileInputStream;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class PropertiesTest {\n\n    @Test\n    public void testState() throws IOException {\n        final File fcontent = File.createTempFile(\"foo\",\n                                                  \"bar\");\n        final Properties properties = new Properties();\n        final Date dt = new Date();\n\n        properties.put(\"int\",\n                       10453);\n        properties.put(\"long\",\n                       1000000L);\n        properties.put(\"date\",\n                       dt);\n\n        final OutputStream out = new FileOutputStream(fcontent);\n        properties.store(out);\n\n        final Properties loadProperties = new Properties();\n\n        final InputStream in = new FileInputStream(fcontent);\n        loadProperties.load(in);\n\n        assertNotNull(properties.get(\"int\"));\n        assertNotNull(properties.get(\"long\"));\n        assertNotNull(properties.get(\"date\"));\n\n        assertEquals(10453,\n                     properties.get(\"int\"));\n        assertEquals(1000000L,\n                     properties.get(\"long\"));\n        assertEquals(dt,\n                     properties.get(\"date\"));\n    }\n\n    @Test\n    public void testEmptyState() throws IOException {\n        final File fcontent = File.createTempFile(\"foo2\",\n                                                  \"bar\");\n        final Properties loadProperties = new Properties();\n\n        final InputStream in = new FileInputStream(fcontent);\n        loadProperties.load(in);\n\n        assertEquals(0,\n                     loadProperties.size());\n    }\n\n    @Test\n    public void testNullValues() throws IOException {\n        final Map<String, Object> original = new HashMap<String, Object>();\n        original.put(\"key1\",\n                     \"value1\");\n        original.put(\"key2\",\n                     null);\n\n        final Properties properties = new Properties(original);\n\n        assertEquals(1,\n                     properties.size());\n        assertTrue(properties.containsKey(\"key1\"));\n        assertEquals(\"value1\",\n                     properties.get(\"key1\"));\n        assertFalse(properties.containsKey(\"key2\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/SeekableByteChannelTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.java.nio.base;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.RandomAccessFile;\nimport java.nio.ByteBuffer;\n\nimport org.junit.Test;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\n\nimport static org.junit.Assert.*;\n\n/**\n *\n */\npublic class SeekableByteChannelTest {\n\n    @Test\n    public void test() throws IOException {\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n\n        final SeekableByteChannel sbc = new SeekableByteChannelFileBasedImpl(new RandomAccessFile(tempFile,\n                                                                                                  \"rw\").getChannel());\n\n        assertTrue(sbc.isOpen());\n        sbc.write(ByteBuffer.wrap(\"CONTENT\\n?!\".getBytes()));\n\n        sbc.position(0L);\n        ByteBuffer buffer = ByteBuffer.allocate(10);\n        sbc.read(buffer);\n        assertEquals(\"CONTENT\\n?!\",\n                     new String(buffer.array()));\n\n        sbc.close();\n        assertFalse(sbc.isOpen());\n    }\n\n    @Test\n    public void testPosition() throws IOException {\n        final File tempFile = File.createTempFile(\"foo\",\n                                                  \"bar\");\n\n        final SeekableByteChannel sbc = new SeekableByteChannelFileBasedImpl(new RandomAccessFile(tempFile,\n                                                                                                  \"rw\").getChannel());\n\n        assertTrue(sbc.isOpen());\n        sbc.write(ByteBuffer.wrap(\"CONTENT\\n?!\".getBytes()));\n\n        assertEquals(10L,\n                     sbc.position());\n        assertEquals(10L,\n                     sbc.size());\n\n        sbc.position(1L);\n        ByteBuffer buffer = ByteBuffer.allocate(8);\n        sbc.read(buffer);\n        assertEquals(\"ONTENT\\n?\",\n                     new String(buffer.array()));\n\n        assertEquals(9L,\n                     sbc.position());\n\n        sbc.position(0L);\n        sbc.truncate(2L);\n        ByteBuffer buffer3 = ByteBuffer.allocate(2);\n        sbc.read(buffer3);\n        assertEquals(\"CO\",\n                     new String(buffer3.array()));\n\n        sbc.close();\n        assertFalse(sbc.isOpen());\n    }\n}\n"
  },
  {
    "path": "uberfire-nio2-backport/uberfire-nio2-model/src/test/java/org/uberfire/java/nio/base/dotfiles/DotFileUtilsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.java.nio.base.dotfiles;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.uberfire.java.nio.base.GeneralPathImpl.create;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DotFileUtilsTest {\n\n    @Mock\n    FileSystem fs;\n\n    @Test\n    public void undotNonDotFile() {\n        final Path path = create(fs,\n                                 \"/path/to/file.txt\",\n                                 false);\n\n        final Path converted = DotFileUtils.undot(path);\n\n        assertEquals(path,\n                     converted);\n    }\n\n    @Test\n    public void undotDotFile() {\n        final Path path = create(fs,\n                                 \"/path/to/.file.txt\",\n                                 false);\n        final Path undot = create(fs,\n                                  \"/path/to/file.txt\",\n                                  false);\n\n        final Path converted = DotFileUtils.undot(path);\n\n        assertEquals(undot,\n                     converted);\n    }\n}\n"
  },
  {
    "path": "uberfire-packaging/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-packaging</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire Packaging</name>\n\n  <modules>\n    <module>uberfire-client</module>\n    <module>uberfire-client-backend</module>\n    <module>uberfire-client-all</module>\n    <module>uberfire-server-all</module>\n    <module>uberfire-all</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-all/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/uberfire-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-all</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire All Libraries</name>\n  <description>UberFire All Libraries</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server-all</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Client Only Libraries</name>\n  <description>UberFire Client Only Libraries</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client/src/main/resources/org/uberfire/UberfireClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.UberfireClientAPI\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.UberfireJS\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-all/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-client-all</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire All Client Libraries</name>\n  <description>UberFire All Client Libraries</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-backend</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-all/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-all/src/main/resources/org/uberfire/UberfireClientAll.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name=\"org.uberfire.UberfireClient\"/>\n  <inherits name=\"org.uberfire.UberfireClientBackend\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-client-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Client with Backend Libraries</name>\n  <description>UberFire Client with Backend Libraries</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-backend</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-packaging/uberfire-client-backend/src/main/resources/org/uberfire/UberfireClientBackend.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='com.google.gwt.user.User'/>\n\n  <inherits name=\"org.uberfire.UberfireBackend\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbenchBackend\"/>\n  <inherits name=\"org.uberfire.security.UberfireSecurityClientBackend\" />\n\n</module>\n"
  },
  {
    "path": "uberfire-packaging/uberfire-server-all/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-packaging/uberfire-server-all/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-packaging</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-server-all</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Server Side Libraries</name>\n  <description>UberFire Server Side Libraries</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-codegen</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n    </dependency>\n\n  </dependencies>\n  \n</project>\n"
  },
  {
    "path": "uberfire-preferences/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <artifactId>uberfire-preferences</artifactId>\n  <packaging>pom</packaging>\n  <name>Uberfire Preferences</name>\n  <description>Uberfire Preferences</description>\n  <modules>\n    <module>uberfire-preferences-api</module>\n    <module>uberfire-preferences-backend</module>\n    <module>uberfire-preferences-client</module>\n    <module>uberfire-preferences-processors</module>\n    <module>uberfire-preferences-client-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-preferences</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <artifactId>uberfire-preferences-api</artifactId>\n  <packaging>jar</packaging>\n  <name>Uberfire Preferences API</name>\n  <description>Uberfire Preferences API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScope.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\n/**\n * The pair (type, key) represents a unique preference scope, which groups a set of preferences\n * and its values.\n */\npublic interface PreferenceScope {\n\n    /**\n     * @return Type of the preference scope. Represents a unique category of scopes.\n     */\n    String type();\n\n    /**\n     * @return Key of the preference scope. Represents a unique key inside a scope type.\n     */\n    String key();\n\n    /**\n     * Child scope, a scope inside a scope. This allows a hierarchy inside each scope.\n     * @return Child scope. This can be null, indicating the end of the hierarchy.\n     */\n    PreferenceScope childScope();\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScopeFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n/**\n * Builder for new preference scope creation.\n */\npublic interface PreferenceScopeFactory {\n\n    /**\n     * Builds a new preference scope, that does not require a custom key.\n     * @param type Type of the new preference scope.\n     * @return A new preference scope.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid, or if it requires a key.\n     */\n    PreferenceScope createScope(String type) throws InvalidPreferenceScopeException;\n\n    /**\n     * Builds a new preference scope, that does not require a custom key, and has the passed child scope.\n     * @param type Type of the new preference scope.\n     * @return A new preference scope.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid, or if it requires a key.\n     */\n    PreferenceScope createScope(String type,\n                                PreferenceScope childScope) throws InvalidPreferenceScopeException;\n\n    /**\n     * Builds a new preference scope, that requires a custom key.\n     * @param type Type of the new preference scope.\n     * @param key Key of the new preference scope.\n     * @return A new preference scope.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid, or if it does not require\n     * a key.\n     */\n    PreferenceScope createScope(String type,\n                                String key) throws InvalidPreferenceScopeException;\n\n    /**\n     * Builds a new preference scope, that requires a custom key, and has the passed child scope.\n     * @param type Type of the new preference scope.\n     * @param key Key of the new preference scope.\n     * @param childScope Child scope of this scope. It can be null if the scope has no child.\n     * @return A new preference scope.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid, or if it does not require\n     * a key.\n     */\n    PreferenceScope createScope(String type,\n                                String key,\n                                PreferenceScope childScope) throws InvalidPreferenceScopeException;\n\n    /**\n     * Builds a new preference scope, that contains the following ones as child scopes.\n     * @param scopes The first scope is the root scope, the second is its child scope, and so on.\n     * @return A new preference scope.\n     * @throws InvalidPreferenceScopeException if any passed scope is invalid.\n     */\n    PreferenceScope createScope(PreferenceScope... scopes) throws InvalidPreferenceScopeException;\n\n    /**\n     * Clones the passed scope to a new instance.\n     * @param scope Scope to be cloned. Must not be null.\n     * @return New scope instance equal to the passed one.\n     */\n    PreferenceScope cloneScope(PreferenceScope scope);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScopeResolutionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Defines the hierarchy used to resolve a preference value.\n * If no backend implementation for this class exists, a default one will be provided.\n */\npublic interface PreferenceScopeResolutionStrategy {\n\n    /**\n     * Defines the order of scopes that will be used when a preference value is searched, as well\n     * the scope where a preference will be persisted if none is provided.\n     * @return Resolution strategy information.\n     */\n    PreferenceScopeResolutionStrategyInfo getInfo();\n\n    /**\n     * Returns a scope resolver for this scope resolution strategy.\n     * @return Resolution strategy information.\n     */\n    PreferenceScopeResolver getScopeResolver();\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScopeResolver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\n/**\n * Provides a way to obtain scopes related to a scope resolution order.\n */\npublic interface PreferenceScopeResolver {\n\n    /**\n     * Returns a PreferenceScope that belongs to the resolution strategy hierarchy, based on the passed\n     * types.\n     * @param scopeTypes Scope types associated to the desired scope.\n     * @return The PreferenceScope related to the passed types (if it exists, null otherwise).\n     */\n    PreferenceScope resolve(String... scopeTypes);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScopeTypes.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n/**\n * Defines which scopes are supported by the preference API.\n * If no backend implementation for this class exists, a default one will be provided.\n */\npublic interface PreferenceScopeTypes {\n\n    /**\n     * Checks if a scope type requires a custom key.\n     * @param type Type to check.\n     * @return true if the type requires a custom key or false if it has a default one.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid.\n     */\n    boolean typeRequiresKey(String type) throws InvalidPreferenceScopeException;\n\n    /**\n     * Returns the default key for a type. Throws a exception if the type requires a custom one.\n     * @param type Type to check.\n     * @return Default key for the type (or null if there is not one).\n     * @throws InvalidPreferenceScopeException if the type passed is invalid.\n     */\n    String getDefaultKeyFor(String type) throws InvalidPreferenceScopeException;\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceScopeValidator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n/**\n * Provides a simple validator method for preference scopes.\n */\npublic interface PreferenceScopeValidator {\n\n    /**\n     * Checks if a scope is valid.\n     * @param scope Scope to check.\n     * @throws InvalidPreferenceScopeException if the type passed is invalid, or if the scope's key\n     * is null and a key is required for that type, or if the key is not null and the scope's type\n     * does not require one.\n     */\n    void validate(PreferenceScope scope) throws InvalidPreferenceScopeException;\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceStorage.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\n\n/**\n * Storage API for preferences.\n */\n@Remote\npublic interface PreferenceStorage {\n\n    /**\n     * Checks if a given preference key is defined in a certain scope.\n     * @param preferenceScope Scope in which the key will be checked.\n     * @param key Key to be checked (must not be null).\n     * @return true if the key is defined in that scope, and false otherwise.\n     */\n    boolean exists(PreferenceScope preferenceScope,\n                   String key);\n\n    /**\n     * Checks if a given preference key is defined in any scope of the provided hierarchy.\n     * @param scopeResolutionStrategyInfo Hierarchy of scopes in which the key will be checked.\n     * @param key Key to be checked (must not be null).\n     * @return true if the key is defined in any scope, and false otherwise.\n     */\n    boolean exists(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                   String key);\n\n    /**\n     * Tries to read a preference value from a specific scope.\n     * @param preferenceScope Scope in which the key will be searched.\n     * @param key Preference key to be read (must not be null).\n     * @param <T> Type of the preference value.\n     * @return The preference value (null if it is not defined).\n     */\n    <T> T read(PreferenceScope preferenceScope,\n               String key);\n\n    /**\n     * Tries to read a preference value from a scope hierarchy.\n     * @param scopeResolutionStrategyInfo Scope hierarchy in which the key will be searched.\n     * @param key Preference key to be read (must not be null).\n     * @param <T> Type of the preference value.\n     * @return The preference value (null if it is not defined in any scope in the hierarchy).\n     */\n    <T> T read(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n               String key);\n\n    /**\n     * Tries to read a preference value from a scope hierarchy.\n     * @param scopeResolutionStrategyInfo Scope hierarchy in which the key will be searched.\n     * @param key Preference key to be read (must not be null).\n     * @param <T> Type of the preference value.\n     * @return The preference value and its scope (null if it is not defined in any scope in the hierarchy).\n     */\n    <T> PreferenceScopedValue<T> readWithScope(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                               String key);\n\n    /**\n     * (Over) Writes a preference value related to a preference key, for a specific scope.\n     * @param scope Scope in which the preference will be written.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     */\n    void write(PreferenceScope scope,\n               String key,\n               Object value);\n\n    /**\n     * Deletes a preference, in a specific scope, if it exists.\n     * @param scope Scope in which the preference is stored.\n     * @param key The key of the preference to be deleted, must not be null.\n     */\n    void delete(PreferenceScope scope,\n                String key);\n\n    /**\n     * Returns all preference keys defined in a specific scope.\n     * @param scope Scope in which the preference keys will be searched.\n     * @return All preference keys defined in the passed scope.\n     */\n    Collection<String> allKeys(PreferenceScope scope);\n\n    /**\n     * Returns all preference keys defined in all passed scopes.\n     * @param scopes Scopes in which the preference keys will be searched.\n     * @return All preference keys defined in all passed scopes.\n     */\n    Collection<String> allKeys(List<PreferenceScope> scopes);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PreferenceStore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\n\n/**\n * Store API for preferences. All preference management should be made through this service.\n */\n@Remote\npublic interface PreferenceStore {\n\n    /**\n     * Provides a portable instance that has the scope resolution strategy order and the default scope\n     * for preference persistence.\n     * @return A portable scope information instance.\n     */\n    PreferenceScopeResolutionStrategyInfo getDefaultScopeResolutionStrategyInfo();\n\n    /**\n     * Provides a portable instance that resolves scopes in the default scope resolution strategy order.\n     * @return A portable scope resolver instance.\n     */\n    PreferenceScopeResolver getDefaultScopeResolver();\n\n    /**\n     * Stores a preference inside a specific scope.\n     * @param scope Scope in which the preference will be stored. Must not be null.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void put(PreferenceScope scope,\n                 String key,\n                 T value);\n\n    /**\n     * Stores a preference inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope}.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the default scope, in which the\n     * preference will be stored. Must not be null.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void put(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                 String key,\n                 T value);\n\n    /**\n     * Stores a preference inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope}.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void put(String key,\n                 T value);\n\n    /**\n     * Stores several preferences inside a specific scope.\n     * @param scope Scope in which the preference will be stored. Must not be null.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void put(PreferenceScope scope,\n                 Map<String, T> valueByKey);\n\n    /**\n     * Stores several preferences inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope}.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the default scope. Must not be null.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void put(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                 Map<String, T> valueByKey);\n\n    /**\n     * Stores several preferences inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope}.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void put(Map<String, T> valueByKey);\n\n    /**\n     * Stores a preference inside a specific scope, if it is not already defined in that scope.\n     * @param scope Scope in which the preference will be stored. Must not be null.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void putIfAbsent(PreferenceScope scope,\n                         String key,\n                         T value);\n\n    /**\n     * Stores a preference inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope},\n     * if it is not already defined in that scope.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the default scope.\n     * in which the preference will be stored. Must not be null.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                         String key,\n                         T value);\n\n    /**\n     * Stores a preference inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope},\n     * if it is not already defined in that scope.\n     * @param key The key of the preference, must not be null.\n     * @param value The value of the preference, could be null.\n     * @param <T> Type of the preference value.\n     */\n    <T> void putIfAbsent(String key,\n                         T value);\n\n    /**\n     * Stores several preferences inside a specific scope, if they are not already defined in that scope.\n     * @param scope Scope in which the preference will be stored. Must not be null.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void putIfAbsent(PreferenceScope scope,\n                         Map<String, T> valueByKey);\n\n    /**\n     * Stores several preferences inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope},\n     * if they are not already defined in that scope.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the default scope. Must not be null.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                         Map<String, T> valueByKey);\n\n    /**\n     * Stores several preferences inside the default scope (see {@link PreferenceScopeResolutionStrategyInfo#defaultScope() defaultScope}.\n     * @param valueByKey Map that contains a preference value (can be null) for each preference key (must not be null).\n     * @param <T> Type of the preference values.\n     */\n    <T> void putIfAbsent(Map<String, T> valueByKey);\n\n    /**\n     * Retrieves a preference value from a specific scope.\n     * @param scope Scope in which the preference value will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or null, if it does not exist).\n     */\n    <T> T get(PreferenceScope scope,\n              String key);\n\n    /**\n     * Retrieves a preference value from a specific scope.\n     * @param scope Scope in which the preference value will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param defaultValue Value to be returned if the preference is not defined in that scope.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or defaultValue, if it does not exist).\n     */\n    <T> T get(PreferenceScope scope,\n              String key,\n              T defaultValue);\n\n    /**\n     * Retrieves a preference value from the first scope of the scopeResolutionStrategy order that\n     * has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or null, if it does not exist).\n     */\n    <T> T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n              String key);\n\n    /**\n     * Retrieves a preference value from the first scope of the scopeResolutionStrategy order that\n     * has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param defaultValue Value to be returned if the preference is not defined in any scope.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or null, if it does not exist).\n     */\n    <T> T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n              String key,\n              T defaultValue);\n\n    /**\n     * Retrieves a preference value from the first scope of the default scope resolution strategy order that\n     * has the preference defined.\n     * @param key Preference key to be searched, must not be null.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or null, if it does not exist).\n     */\n    <T> T get(String key);\n\n    /**\n     * Retrieves a preference value from the first scope of the default scope resolution strategy order that\n     * has the preference defined.\n     * @param key Preference key to be searched, must not be null.\n     * @param defaultValue Value to be returned if the preference is not defined in any scope.\n     * @param <T> Type of the preference value.\n     * @return The preference value (or null, if it does not exist).\n     */\n    <T> T get(String key,\n              T defaultValue);\n\n    /**\n     * Retrieves a scoped preference value from the first scope of the scopeResolutionStrategy order that\n     * has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param <T> Type of the preference value.\n     * @return A preference scoped value, which contains the preference value and its scope (or null,\n     * if the preference does not exist).\n     */\n    <T> PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                           String key);\n\n    /**\n     * Retrieves a scoped preference value from the first scope of the scopeResolutionStrategy order that\n     * has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param key Preference key to be searched, must not be null.\n     * @param defaultValue Value to be returned if the preference is not defined in any scope.\n     * @param <T> Type of the preference value.\n     * @return A preference scoped value, which contains the preference value and its scope (or defaultValue,\n     * if the preference does not exist in any scope).\n     */\n    <T> PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                           String key,\n                                           T defaultValue);\n\n    /**\n     * Retrieves a preference value from the first scope of the default scope resolution strategy order that\n     * has the preference defined.\n     * @param key Preference key to be searched, must not be null.\n     * @param <T> Type of the preference value.\n     * @return A preference scoped value, which contains the preference value and its scope (or null,\n     * if the preference does not exist).\n     */\n    <T> PreferenceScopedValue<T> getScoped(String key);\n\n    /**\n     * Retrieves a preference value from the first scope of the default scope resolution strategy order that\n     * has the preference defined.\n     * @param key Preference key to be searched, must not be null.\n     * @param defaultValue Value to be returned if the preference is not defined in any scope.\n     * @param <T> Type of the preference value.\n     * @return A preference scoped value, which contains the preference value and its scope (or defaultValue,\n     * if the preference does not exist in any scope).\n     */\n    <T> PreferenceScopedValue<T> getScoped(String key,\n                                           T defaultValue);\n\n    /**\n     * Retrieves several preferences, which keys were passed, from a specific scope.\n     * @param scope Scope in which the preferences values will be searched. Must not be null.\n     * @param keys Preference keys to search. If null, all keys in that scope will be searched.\n     * @return A Map containing all passed preference keys and its values (or null, if a preference does not exist).\n     */\n    Map<String, Object> search(PreferenceScope scope,\n                               Collection<String> keys);\n\n    /**\n     * Retrieves several preferences, which keys were passed. Each one from the first scope of the\n     * scopeResolutionStrategy order that has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param keys Preference keys to search. If null, all keys in that scope resolution strategy will be searched.\n     * @return A Map containing all passed preference keys and its values (or null, if a preference does not exist).\n     */\n    Map<String, Object> search(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                               Collection<String> keys);\n\n    /**\n     * Retrieves several preferences, which keys were passed. Each one from the first scope of the\n     * default scope resolution strategy order that has the preference defined.\n     * @param keys Preference keys to search. If null, all keys in the default scope resolution strategy type will be\n     * searched.\n     * @return A Map containing all passed preference keys and its values (or null, if a preference does not exist).\n     */\n    Map<String, Object> search(Collection<String> keys);\n\n    /**\n     * Retrieves several scoped preferences, which keys were passed. Each one from the first scope of the\n     * scopeResolutionStrategy order that has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @param keys Preference keys to search. If null, all keys in that scope resolution strategy will be searched.\n     * @return A Map containing all passed preference keys and its preference scoped value, which contains the\n     * preference value and its scope (or null, if the preference does not exist in any scope).\n     */\n    Map<String, PreferenceScopedValue<Object>> searchScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                            Collection<String> keys);\n\n    /**\n     * Retrieves several scoped preferences, which keys were passed. Each one from the first scope of the\n     * default scope resolution strategy order that has the preference defined.\n     * @param keys Preference keys to search. If null, all keys in the default scope resolution strategy will be searched.\n     * @return A Map containing all passed preference keys and its preference scoped value, which contains the\n     * preference value and its scope (or null, if the preference does not exist in any scope).\n     */\n    Map<String, PreferenceScopedValue<Object>> searchScoped(Collection<String> keys);\n\n    /**\n     * Retrieves all defined preferences from a specific scope.\n     * @param scope Scope in which the preferences values will be searched. Must not be null.\n     * @return A Map containing all preference keys and its values.\n     */\n    Map<String, Object> all(PreferenceScope scope);\n\n    /**\n     * Retrieves all defined preferences. Each one from the first scope of the scopeResolutionStrategy order\n     * that has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @return A Map containing all preference keys and its values.\n     */\n    Map<String, Object> all(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n\n    /**\n     * Retrieves all defined preferences. Each one from the first scope of the default scope resolution strategy order\n     * that has the preference defined.\n     * @return A Map containing all preference keys and its values.\n     */\n    Map<String, Object> all();\n\n    /**\n     * Retrieves all defined preferences. Each one from the first scope of the scopeResolutionStrategy order\n     * that has the preference defined.\n     * @param scopeResolutionStrategyInfo Scope resolution strategy that defines the order on which the\n     * scopes will be searched. Must not be null.\n     * @return A Map containing all preferences keys and its preference scoped value, which contains the\n     * preference value and its scope.\n     */\n    Map<String, PreferenceScopedValue<Object>> allScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n\n    /**\n     * Retrieves all defined preferences. Each one from the first scope of the default scope resolution strategy order\n     * that has the preference defined.\n     * @return A Map containing all preferences keys and its preference scoped value, which contains the\n     * preference value and its scope.\n     */\n    Map<String, PreferenceScopedValue<Object>> allScoped();\n\n    /**\n     * Removes a preference from a specific scope.\n     * @param scope Scope in which the preference will be removed. Must not be null.\n     * @param key Key of the preference that should be removed. Must not be null.\n     */\n    void remove(PreferenceScope scope,\n                String key);\n\n    /**\n     * Removes a preference from a list of scopes.\n     * @param scopes Scopes from which the preference will be removed. Must not be null.\n     * @param key Key of the preference that will be removed. Must not be null.\n     */\n    void remove(List<PreferenceScope> scopes,\n                String key);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PropertyFormOptions.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum PropertyFormOptions {\n\n    DISABLED\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PropertyFormType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport com.google.common.graph.ElementOrder.Type;\n\n/**\n * Enum used to define a property type for default form generation purposes.\n */\npublic enum PropertyFormType {\n\n    TEXT {\n        @Override\n        public Object fromString(final String stringValue) {\n            return stringValue;\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    },\n    BOOLEAN {\n        @Override\n        public Object fromString(final String stringValue) {\n            return Boolean.valueOf(stringValue);\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    },\n    NATURAL_NUMBER {\n        @Override\n        public Object fromString(final String stringValue) {\n            return Integer.parseInt(stringValue);\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    },\n    SECRET_TEXT {\n        @Override\n        public Object fromString(final String stringValue) {\n            return stringValue;\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    },\n    COLOR {\n        @Override\n        public Object fromString(final String stringValue) {\n            return stringValue;\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    },\n    COMBO {\n        @Override\n        public Object fromString(final String stringValue) {\n            return stringValue;\n        }\n\n        @Override\n        public String toString(final Object realValue) {\n            return String.valueOf(realValue);\n        }\n    };\n\n    public abstract Object fromString(String stringValue);\n\n    public abstract String toString(Object realValue);\n    \n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/PropertyValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.uberfire.preferences.shared.impl.validation.ValidationResult;\n\npublic interface PropertyValidator<T> {\n\n    ValidationResult validate(T value);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/UsernameProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport javax.inject.Provider;\n\npublic interface UsernameProvider extends Provider<String> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/annotations/PortablePreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Annotation used to qualify generated portable implementations of preference beans.\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface PortablePreference {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/annotations/Property.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport org.uberfire.preferences.shared.PropertyFormOptions;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.PropertyValidator;\n\n/**\n * Annotation used to mark preference beans properties.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.FIELD})\npublic @interface Property {\n\n    /**\n     * Defines the type of field to be used in the default form. The default is TEXT.\n     * You should only specify this if you are using the default form for preferences\n     * edition, otherwise it will have no effect.\n     * @return The property type to be used.\n     */\n    PropertyFormType formType() default PropertyFormType.TEXT;\n\n    /**\n     * Defines whether or not this property should be shared by its parents. Defaults to false.\n     * @return The property sharing strategy.\n     */\n    boolean shared() default false;\n\n    /**\n     * Defines a bundle key that will be used to internationalize the property's label wherever\n     * is necessary. It's expected that the TranslationService will have access to the key\n     * translation.\n     * @return The property bundle key.\n     */\n    String bundleKey() default \"\";\n\n    /**\n     * Defines a help bundle key that will be used to internationalize the property's help text\n     * wherever is necessary. It's expected that the TranslationService will have access to the\n     * key translation.\n     * @return The property help bundle key.\n     */\n    String helpBundleKey() default \"\";\n\n    /**\n     * Defines options that will be applied to the automatically generated form field.\n     * @return The form options to be used.\n     */\n    PropertyFormOptions[] formOptions() default {};\n\n    /**\n     * Defines validators that will be applied to the field on automatically generated forms.\n     * @return The validators to be applied.\n     */\n    Class<? extends PropertyValidator>[] validators() default {};\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/annotations/RootPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Annotation used to qualify generated portable implementations of root preference beans.\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface RootPreference {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/annotations/WorkbenchPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.enterprise.util.Nonbinding;\nimport javax.inject.Qualifier;\n\n/**\n * Annotation used to qualify preference beans.\n */\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface WorkbenchPreference {\n\n    /**\n     * A unique identifier used to reference parent nodes (see #parents).\n     * @return A unique identifier for the preference bean.\n     */\n    String identifier();\n\n    /**\n     * The identifiers of all parents of this preference.\n     * @return The parents of this preference. Empty if there is not one.\n     */\n    @Nonbinding String[] parents() default {};\n\n    /**\n     * Defines a bundle key that will be used to internationalize the property's label wherever\n     * its necessary. It's expected that the TranslationService will have access to the key\n     * translation.\n     * @return The preference bundle key.\n     */\n    String bundleKey() default \"\";\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/BasePreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Interface that all preference beans should implement. It allows load and save operations\n * when injecting it through CDI. The methods in this class are only really implemented by\n * a generated preference bean, that will be the one injected by CDI.\n * @param <T> The preference bean type implementing the interface.\n */\npublic interface BasePreference<T> extends Preference {\n\n    /**\n     * Loads the preference content recursively through its properties.\n     */\n    default void load() {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Loads the preference content recursively through its properties.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void load(final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Loads the preference content recursively through its properties.\n     * @param successCallback Success callback that returns the loaded preference.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void load(final ParameterizedCommand<T> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Loads the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     */\n    default void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Loads the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Loads the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     * @param successCallback Success callback that returns the loaded preference.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<T> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     */\n    default void save() {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     */\n    default void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScopeResolutionStrategy Custom preference scope resolution strategy to be used.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScope Custom preference scope to be used.\n     */\n    default void save(final PreferenceScope customScope) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScope Custom preference scope to be used.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final PreferenceScope customScope,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Saves the preference content recursively through its properties.\n     * @param customScope Custom preference scope to be used.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    default void save(final PreferenceScope customScope,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback) {\n        throw new UnsupportedOperationException(\"You should call this method only for default qualified injected instances.\");\n    }\n\n    /**\n     * Returns the default value of this preference object. All users will start with this value\n     * unless they change it.\n     * @param defaultValue Preference to be filled and returned. It contains all child preferences already instantiated.\n     * @return The defaultValue received as parameter, just with its value updated. Null if there is not a default value.\n     */\n    default T defaultValue(T defaultValue) {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/BasePreferenceBean.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\n/**\n * Represents a generated managed bean implementation of a preference bean.\n * @param <T> The preference bean type implementing the interface.\n */\npublic interface BasePreferenceBean<T> extends BasePreference<T> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/BasePreferencePortable.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\n\n/**\n * Represents a generated portable implementation of a preference bean.\n * @param <T> The preference bean type implementing the interface.\n */\npublic interface BasePreferencePortable<T> extends BasePreference<T> {\n\n    /**\n     * Returns the preference bean class.\n     * @return The preference bean class.\n     */\n    Class<T> getPojoClass();\n\n    /**\n     * Unique identifier, used by this preference children to determine their parents.\n     * Also used to name the file containing its value.\n     * @return A unique identifier for the preference bean.\n     */\n    String identifier();\n\n    /**\n     * The preferences which will have this preference as their child.\n     * All parents will share the same preference value.\n     * @return The parents of this preference. Empty if there is not one.\n     */\n    String[] parents();\n\n    /**\n     * Returns the bundle key registered in the {@link WorkbenchPreference} annotation.\n     * @return The preference bundle key.\n     */\n    String bundleKey();\n\n    /**\n     * Sets a property value by its name.\n     * @param property Name of the property field to be set.\n     * @param value New value for the property.\n     */\n    void set(String property,\n             Object value);\n\n    /**\n     * Returns a property value by its name.\n     * @param property Name of the property field to be fetched.\n     * @return The property value.\n     */\n    Object get(String property);\n\n    /**\n     * Returns the form types of all simple (non-preference) properties by their field name.\n     * @return The properties form types by their field names.\n     */\n    Map<String, PropertyFormType> getPropertiesTypes();\n\n    default Map<String, List<PropertyValidator>> getPropertiesValidators() {\n        return new HashMap<>();\n    }\n\n    /**\n     * Returns the form type of a specific simple (non-preference) property by its field name.\n     * @param propertyName The property field name.\n     * @return The property form type.\n     */\n    default PropertyFormType getPropertyType(String propertyName) {\n        return getPropertiesTypes().get(propertyName);\n    }\n\n    default List<PropertyValidator> getPropertyValidators(String propertyName) {\n        final List<PropertyValidator> propertyValidators = getPropertiesValidators().get(propertyName);\n        return propertyValidators != null ? propertyValidators : new ArrayList<>();\n    }\n\n    /**\n     * A preference is persistable when it has at least one non-shared property.\n     * @return true if it is persistable and false otherwise.\n     */\n    boolean isPersistable();\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/Preference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\n/**\n * Represents a preference class, generated or provided.\n */\npublic interface Preference {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/PreferenceBeanServerStore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Service to manage preference beans.\n */\n@Remote\npublic interface PreferenceBeanServerStore extends PreferenceBeanStore {\n\n    /**\n     * Loads all preference bean properties.\n     * @param emptyPortablePreference Newly created portable instance for the preference bean.\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     * @return A loaded preference bean portable instance.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T load(T emptyPortablePreference);\n\n    /**\n     * Loads all preference bean properties, following the passed scope resolution strategy.\n     * @param emptyPortablePreference Newly created portable instance for the preference bean.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     * @return A loaded preference bean portable instance.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T load(T emptyPortablePreference,\n                                                                              PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n\n    /**\n     * Saves all preference data.\n     * @param portablePreference Preference instance to be saved.\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference);\n\n    /**\n     * Saves all preference data, following the passed scope resolution strategy.\n     * @param portablePreference Preference instance to be saved.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                 PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n\n    /**\n     * Saves all preference data, inside the passed scope.\n     * @param portablePreference Preference instance to be saved.\n     * @param scope Custom scope inside which the preference should be saved.\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                 PreferenceScope scope);\n\n    /**\n     * Saves all preferences passed.\n     * @param portablePreferences Preference instances to be saved.\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences);\n\n    /**\n     * Saves all preferences passed, following the passed scope resolution strategy.\n     * @param portablePreferences Preference instances to be saved.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n              PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n\n    /**\n     * Saves all preferences passed, following the passed scope resolution strategy.\n     * @param portablePreferences Preference instances to be saved.\n     * @param scope Custom scope resolution strategy to follow.\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n              PreferenceScope scope);\n\n    /**\n     * Builds a tree hierarchy that begins with the root preference bean which identifier was passed and\n     * grows based on their sub-preferences.\n     * @param identifier Root preference identifier. Must not be null.\n     * @return A tree hierarchy between all preference beans.\n     */\n    PreferenceHierarchyElement<?> buildHierarchyStructureForPreference(String identifier);\n\n    /**\n     * Builds a tree hierarchy that begins with the root preference bean which identifier was passed and\n     * grows based on their sub-preferences.\n     * @param identifier Root preference identifier. Must not be null.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @return A tree hierarchy between all preference beans.\n     */\n    PreferenceHierarchyElement<?> buildHierarchyStructureForPreference(String identifier,\n                                                                       PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/PreferenceBeanStore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport java.util.Collection;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Service to manage preference beans, with server-side and client-side implementations.\n */\npublic interface PreferenceBeanStore {\n\n    /**\n     * Loads all preference bean properties.\n     * @param emptyPortablePreference Newly created portable instance for the preference bean.\n     * @param successCallback Callback with a loaded preference bean portable instance as a parameter.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(T emptyPortablePreference,\n                                                                                 ParameterizedCommand<T> successCallback,\n                                                                                 ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Loads all preference bean properties, following the passed scope resolution strategy.\n     * @param emptyPortablePreference Newly created portable instance for the preference bean.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @param successCallback Callback with a loaded preference bean portable instance as a parameter.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(T emptyPortablePreference,\n                                                                                 PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                 ParameterizedCommand<T> successCallback,\n                                                                                 ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preference data.\n     * @param portablePreference Preference instance to be saved.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                 Command successCallback,\n                                                                                 ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preference data, following the passed scope resolution strategy.\n     * @param portablePreference Preference instance to be saved.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                 PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                 Command successCallback,\n                                                                                 ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preference data, following the passed scope resolution strategy.\n     * @param portablePreference Preference instance to be saved.\n     * @param scope Custom scope inside which the preference should be saved.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     * @param <U> Preference bean type.\n     * @param <T> Preference bean generated portable type.\n     */\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                 PreferenceScope scope,\n                                                                                 Command successCallback,\n                                                                                 ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preferences passed.\n     * @param portablePreferences Preference instances to be saved.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n              Command successCallback,\n              ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preferences passed, following the passed scope resolution strategy.\n     * @param portablePreferences Preference instances to be saved.\n     * @param scopeResolutionStrategyInfo Custom scope resolution strategy to follow.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n              PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n              Command successCallback,\n              ParameterizedCommand<Throwable> errorCallback);\n\n    /**\n     * Saves all preferences passed, following the passed scope resolution strategy.\n     * @param portablePreferences Preference instances to be saved.\n     * @param scope Custom scope inside which the preference should be saved.\n     * @param successCallback Success callback that indicates that the preference was saved.\n     * @param errorCallback Error callback that returns the exception that occurred (if any).\n     */\n    void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n              PreferenceScope scope,\n              Command successCallback,\n              ParameterizedCommand<Throwable> errorCallback);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/PreferenceHierarchyElement.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PropertyFormOptions;\n\n/**\n * Holds all preference information necessary to build a hierarchic interface for preferences.\n * @param <T> Preference bean type.\n */\n@Portable\npublic class PreferenceHierarchyElement<T> {\n\n    private String id;\n\n    private BasePreferencePortable<T> portablePreference;\n\n    private List<PreferenceHierarchyElement<?>> children;\n\n    private boolean shared;\n\n    private boolean root;\n\n    private String bundleKey;\n\n    private Map<String, String> bundleKeyByProperty;\n\n    private Map<String, String> helpBundleKeyByProperty;\n\n    private Map<String, PropertyFormOptions[]> formOptionsByProperty;\n\n    public PreferenceHierarchyElement() {\n        this(null,\n             null,\n             false,\n             false,\n             null);\n    }\n\n    public PreferenceHierarchyElement(final String id,\n                                      final BasePreferencePortable<T> portablePreference,\n                                      final boolean shared,\n                                      final boolean root,\n                                      final String bundleKey) {\n        this(id,\n             portablePreference,\n             new ArrayList<>(),\n             shared,\n             root,\n             bundleKey,\n             new HashMap<>(),\n             new HashMap<>(),\n             new HashMap<>());\n    }\n\n    public PreferenceHierarchyElement(@MapsTo(\"id\") final String id,\n                                      @MapsTo(\"portablePreference\") final BasePreferencePortable<T> portablePreference,\n                                      @MapsTo(\"children\") final List<PreferenceHierarchyElement<?>> children,\n                                      @MapsTo(\"shared\") final boolean shared,\n                                      @MapsTo(\"root\") final boolean root,\n                                      @MapsTo(\"bundleKey\") final String bundleKey,\n                                      @MapsTo(\"bundleKeyByProperty\") final Map<String, String> bundleKeyByProperty,\n                                      @MapsTo(\"helpBundleKeyByProperty\") final Map<String, String> helpBundleKeyByProperty,\n                                      @MapsTo(\"formOptionsByProperty\") final Map<String, PropertyFormOptions[]> formOptionsByProperty) {\n        this.id = id;\n        this.portablePreference = portablePreference;\n        this.children = children;\n        this.shared = shared;\n        this.root = root;\n        this.bundleKey = bundleKey;\n        this.bundleKeyByProperty = bundleKeyByProperty;\n        this.helpBundleKeyByProperty = helpBundleKeyByProperty;\n        this.formOptionsByProperty = formOptionsByProperty;\n    }\n\n    public boolean isSelectable() {\n        final boolean hasProperties = bundleKeyByProperty != null && bundleKeyByProperty.size() > 0;\n        return hasProperties;\n    }\n\n    public boolean hasChildren() {\n        return children != null && !children.isEmpty();\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(final String id) {\n        this.id = id;\n    }\n\n    public BasePreferencePortable<T> getPortablePreference() {\n        return portablePreference;\n    }\n\n    public void setPortablePreference(final BasePreferencePortable<T> portablePreference) {\n        this.portablePreference = portablePreference;\n    }\n\n    public List<PreferenceHierarchyElement<?>> getChildren() {\n        return children;\n    }\n\n    public void setChildren(final List<PreferenceHierarchyElement<?>> children) {\n        this.children = children;\n    }\n\n    public boolean isShared() {\n        return shared;\n    }\n\n    public void setShared(final boolean shared) {\n        this.shared = shared;\n    }\n\n    public boolean isRoot() {\n        return root;\n    }\n\n    public void setRoot(final boolean root) {\n        this.root = root;\n    }\n\n    public String getBundleKey() {\n        return bundleKey;\n    }\n\n    public void setBundleKey(final String bundleKey) {\n        this.bundleKey = bundleKey;\n    }\n\n    public void addPropertyBundleKey(final String propertyFieldName,\n                                     final String bundleKey) {\n        bundleKeyByProperty.put(propertyFieldName,\n                                bundleKey);\n    }\n\n    public Map<String, String> getBundleKeyByProperty() {\n        return bundleKeyByProperty;\n    }\n\n    public void addPropertyHelpBundleKey(final String propertyFieldName,\n                                         final String helpBundleKey) {\n        helpBundleKeyByProperty.put(propertyFieldName,\n                                    helpBundleKey);\n    }\n\n    public Map<String, String> getHelpBundleKeyByProperty() {\n        return helpBundleKeyByProperty;\n    }\n\n    public void addPropertyFormOptions(final String propertyFieldName,\n                                       final PropertyFormOptions[] formOptions) {\n        formOptionsByProperty.put(propertyFieldName,\n                                  formOptions);\n    }\n\n    public Map<String, PropertyFormOptions[]> getFormOptionsByProperty() {\n        return formOptionsByProperty;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PreferenceHierarchyElement)) {\n            return false;\n        }\n\n        PreferenceHierarchyElement<?> that = (PreferenceHierarchyElement<?>) o;\n\n        if (isShared() != that.isShared()) {\n            return false;\n        }\n        if (isRoot() != that.isRoot()) {\n            return false;\n        }\n        if (getId() != null ? !getId().equals(that.getId()) : that.getId() != null) {\n            return false;\n        }\n        if (getPortablePreference() != null ? !getPortablePreference().equals(that.getPortablePreference()) : that.getPortablePreference() != null) {\n            return false;\n        }\n        if (getChildren() != null ? !getChildren().equals(that.getChildren()) : that.getChildren() != null) {\n            return false;\n        }\n        if (getBundleKey() != null ? !getBundleKey().equals(that.getBundleKey()) : that.getBundleKey() != null) {\n            return false;\n        }\n        if (getBundleKeyByProperty() != null ? !getBundleKeyByProperty().equals(that.getBundleKeyByProperty()) : that.getBundleKeyByProperty() != null) {\n            return false;\n        }\n        if (getHelpBundleKeyByProperty() != null ? !getHelpBundleKeyByProperty().equals(that.getHelpBundleKeyByProperty()) : that.getHelpBundleKeyByProperty() != null) {\n            return false;\n        }\n        return !(getFormOptionsByProperty() != null ? !getFormOptionsByProperty().equals(that.getFormOptionsByProperty()) : that.getFormOptionsByProperty() != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = getId() != null ? getId().hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (getPortablePreference() != null ? getPortablePreference().hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (getChildren() != null ? getChildren().hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (isShared() ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (isRoot() ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (getBundleKey() != null ? getBundleKey().hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (getBundleKeyByProperty() != null ? getBundleKeyByProperty().hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (getHelpBundleKeyByProperty() != null ? getHelpBundleKeyByProperty().hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (getFormOptionsByProperty() != null ? getFormOptionsByProperty().hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/PreferenceRootElement.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PreferenceRootElement {\n\n    private String identifier;\n\n    private String category;\n\n    private String iconCss;\n\n    private String bundleKey;\n\n    public PreferenceRootElement() {\n    }\n\n    public PreferenceRootElement(@MapsTo(\"identifier\") final String identifier,\n                                 @MapsTo(\"category\") final String category,\n                                 @MapsTo(\"iconCss\") final String iconCss,\n                                 @MapsTo(\"bundleKey\") final String bundleKey) {\n        this.identifier = identifier;\n        this.category = category;\n        this.iconCss = iconCss;\n        this.bundleKey = bundleKey;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    public String getCategory() {\n        return category;\n    }\n\n    public String getIconCss() {\n        return iconCss;\n    }\n\n    public String getBundleKey() {\n        return bundleKey;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof PreferenceRootElement)) {\n            return false;\n        }\n\n        final PreferenceRootElement that = (PreferenceRootElement) o;\n\n        if (identifier != null ? !identifier.equals(that.identifier) : that.identifier != null) {\n            return false;\n        }\n        if (category != null ? !category.equals(that.category) : that.category != null) {\n            return false;\n        }\n        if (iconCss != null ? !iconCss.equals(that.iconCss) : that.iconCss != null) {\n            return false;\n        }\n        return !(bundleKey != null ? !bundleKey.equals(that.bundleKey) : that.bundleKey != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = identifier != null ? identifier.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (category != null ? category.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (iconCss != null ? iconCss.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (bundleKey != null ? bundleKey.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/mock/PortablePreferenceMock.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean.mock;\n\nimport javax.enterprise.inject.Vetoed;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.impl.validation.NotEmptyValidator;\n\n/**\n * Created to be used in tests, and to avoid Errai errors due to unimplemented\n * interfaces used in portable classes.\n */\n@Vetoed\npublic class PortablePreferenceMock implements BasePreference<PortablePreferenceMock> {\n\n    @Property(validators = NotEmptyValidator.class)\n    String property;\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/mock/PortablePreferenceMockBeanGeneratedImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean.mock;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.bean.BasePreferenceBean;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n@Dependent\n@Generated(\"org.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\")\n/*\n* WARNING! This class is generated. Do not modify.\n*/\npublic class PortablePreferenceMockBeanGeneratedImpl extends PortablePreferenceMock implements BasePreferenceBean<PortablePreferenceMock> {\n\n    private PreferenceBeanStore store;\n\n    @Inject\n    public PortablePreferenceMockBeanGeneratedImpl(final PreferenceBeanStore store) {\n        this.store = store;\n    }\n\n    @Override\n    public void load() {\n        load((ParameterizedCommand<Throwable>) null);\n    }\n\n    @Override\n    public void load(final ParameterizedCommand<Throwable> errorCallback) {\n        load((ParameterizedCommand<PortablePreferenceMock>) null,\n             errorCallback);\n    }\n\n    @Override\n    public void load(final ParameterizedCommand<PortablePreferenceMock> successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        final PortablePreferenceMockBeanGeneratedImpl preferenceBean = this;\n\n        store.load(new PortablePreferenceMockPortableGeneratedImpl(),\n                   getLoadSuccessCallback(successCallback),\n                   errorCallback);\n    }\n\n    @Override\n    public void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy) {\n        load(customScopeResolutionStrategy,\n             null);\n    }\n\n    @Override\n    public void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        load(customScopeResolutionStrategy,\n             null,\n             errorCallback);\n    }\n\n    @Override\n    public void load(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                     final ParameterizedCommand<PortablePreferenceMock> successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        final PortablePreferenceMockBeanGeneratedImpl preferenceBean = this;\n\n        store.load(new PortablePreferenceMockPortableGeneratedImpl(),\n                   customScopeResolutionStrategy,\n                   getLoadSuccessCallback(successCallback),\n                   errorCallback);\n    }\n\n    private ParameterizedCommand<BasePreferencePortable<PortablePreferenceMock>> getLoadSuccessCallback(final ParameterizedCommand<PortablePreferenceMock> successCallback) {\n        final PortablePreferenceMockBeanGeneratedImpl preferenceBean = this;\n\n        return new ParameterizedCommand<BasePreferencePortable<PortablePreferenceMock>>() {\n            @Override\n            public void execute(final BasePreferencePortable<PortablePreferenceMock> portablePreference) {\n                copy((PortablePreferenceMockPortableGeneratedImpl) portablePreference,\n                     preferenceBean);\n                if (successCallback != null) {\n                    successCallback.execute(preferenceBean);\n                }\n            }\n        };\n    }\n\n    private void copy(final PortablePreferenceMock from,\n                      final PortablePreferenceMock to) {\n        to.property = from.property;\n    }\n\n    @Override\n    public void save() {\n        save((ParameterizedCommand<Throwable>) null);\n    }\n\n    @Override\n    public void save(final ParameterizedCommand<Throwable> errorCallback) {\n        save((Command) null,\n             errorCallback);\n    }\n\n    @Override\n    public void save(final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        store.save(createPortableCopy(),\n                   successCallback,\n                   errorCallback);\n    }\n\n    @Override\n    public void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy) {\n        save(customScopeResolutionStrategy,\n             null);\n    }\n\n    @Override\n    public void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        save(customScopeResolutionStrategy,\n             null,\n             errorCallback);\n    }\n\n    @Override\n    public void save(final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        store.save(createPortableCopy(),\n                   customScopeResolutionStrategy,\n                   successCallback,\n                   errorCallback);\n    }\n\n    private BasePreferencePortable<PortablePreferenceMock> createPortableCopy() {\n        PortablePreferenceMockPortableGeneratedImpl portablePreference = new PortablePreferenceMockPortableGeneratedImpl();\n\n        copy(this,\n             portablePreference);\n\n        return portablePreference;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/bean/mock/PortablePreferenceMockPortableGeneratedImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.bean.mock;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.preferences.shared.annotations.PortablePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\n\n/**\n * Created to be used in tests, and to avoid Errai errors due to unimplemented\n * interfaces used in portable classes.\n */\n@Portable(mapSuperTypes = true)\n@PortablePreference\npublic class PortablePreferenceMockPortableGeneratedImpl extends PortablePreferenceMock implements BasePreferencePortable<PortablePreferenceMock> {\n\n    public PortablePreferenceMockPortableGeneratedImpl() {\n    }\n\n    public PortablePreferenceMockPortableGeneratedImpl(@MapsTo(\"property\") java.lang.String property) {\n        this.property = property;\n    }\n\n    @Override\n    public Class<PortablePreferenceMock> getPojoClass() {\n        return PortablePreferenceMock.class;\n    }\n\n    @Override\n    public String identifier() {\n        return \"org.uberfire.preferences.shared.bean.PortablePreferenceMock\";\n    }\n\n    @Override\n    public String[] parents() {\n        return new String[]{\"\"};\n    }\n\n    @Override\n    public String bundleKey() {\n        return \"org.uberfire.preferences.shared.bean.PortablePreferenceMock\";\n    }\n\n    @Override\n    public void set(String property,\n                    Object value) {\n        if (property.equals(\"property\")) {\n            property = (java.lang.String) value;\n        } else {\n            throw new RuntimeException(\"Unknown property: \" + property);\n        }\n    }\n\n    @Override\n    public Object get(String property) {\n        if (property.equals(\"property\")) {\n            return property;\n        } else {\n            throw new RuntimeException(\"Unknown property: \" + property);\n        }\n    }\n\n    @Override\n    public Map<String, PropertyFormType> getPropertiesTypes() {\n        Map<String, PropertyFormType> propertiesTypes = new HashMap<>();\n\n        propertiesTypes.put(\"property\",\n                            PropertyFormType.TEXT);\n\n        return propertiesTypes;\n    }\n\n    @Override\n    public Map<String, List<PropertyValidator>> getPropertiesValidators() {\n        Map<String, List<PropertyValidator>> validatorsByProperty = new HashMap<>();\n\n        List<PropertyValidator> validatorsProperty = new ArrayList<>();\n        validatorsProperty.add(new org.uberfire.preferences.shared.impl.validation.NotEmptyValidator());\n        validatorsByProperty.put(\"property\",\n                                 validatorsProperty);\n\n        return validatorsByProperty;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        final PortablePreferenceMockPortableGeneratedImpl that = (PortablePreferenceMockPortableGeneratedImpl) o;\n\n        if (property != null ? !property.equals(that.property) : that.property != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = 0;\n\n        result = 31 * result + (property != null ? property.hashCode() : 0);\n        result = ~~result;\n\n        return result;\n    }\n\n    @Override\n    public boolean isPersistable() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/event/PreferenceUpdatedEvent.java",
    "content": "package org.uberfire.preferences.shared.event;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Event fired when a preference is saved\n */\n@Portable\npublic class PreferenceUpdatedEvent {\n    \n    private String key;\n    private Object value;\n    \n    public PreferenceUpdatedEvent() {\n    }\n\n    public PreferenceUpdatedEvent(String key, Object value) { \n        this.key = key;\n        this.value = value;\n    }\n\n    public String getKey() {\n        return key;\n    }\n\n    public Object getValue() {\n        return value;\n    }\n\n    public void setKey(String key) {\n        this.key = key;\n    }\n\n    public void setValue(Object value) {\n        this.value = value;\n    }\n\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeResolutionStrategy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeResolver;\n\n/**\n * Default implementation for {@link PreferenceScopeResolutionStrategy}. To override it, just\n * provide a default CDI bean that implements {@link PreferenceScopeResolutionStrategy}.\n */\n@FallbackImplementation\npublic class DefaultPreferenceScopeResolutionStrategy implements PreferenceScopeResolutionStrategy {\n\n    private PreferenceScopeResolutionStrategyInfo info;\n\n    private PreferenceScopeResolver resolver;\n\n    protected DefaultPreferenceScopeResolutionStrategy() {\n    }\n\n    public DefaultPreferenceScopeResolutionStrategy(final PreferenceScopeFactory scopeFactory,\n                                                    final String componentKey) {\n        final List<PreferenceScope> order = getScopeOrder(scopeFactory,\n                                                          componentKey);\n        final PreferenceScope defaultScope = getDefaultScope(order);\n\n        info = new PreferenceScopeResolutionStrategyInfo(order,\n                                                         defaultScope);\n        resolver = new DefaultPreferenceScopeResolver(order);\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo getInfo() {\n        return info;\n    }\n\n    @Override\n    public PreferenceScopeResolver getScopeResolver() {\n        return resolver;\n    }\n\n    public PreferenceScope getDefaultScope(final List<PreferenceScope> order) {\n        return order.get(0);\n    }\n\n    private List<PreferenceScope> getScopeOrder(final PreferenceScopeFactory scopeFactory,\n                                                final String componentKey) {\n        List<PreferenceScope> order = new ArrayList<>();\n\n        addUserComponentScope(order,\n                              scopeFactory,\n                              componentKey);\n        addUserEntireApplicationScope(order,\n                                      scopeFactory);\n        addAllUsersComponentScope(order,\n                                  scopeFactory,\n                                  componentKey);\n        addAllUsersEntireApplicationScope(order,\n                                          scopeFactory);\n\n        return order;\n    }\n\n    private void addUserComponentScope(List<PreferenceScope> order,\n                                       final PreferenceScopeFactory scopeFactory,\n                                       final String componentKey) {\n        if (componentKey != null) {\n            final PreferenceScope userScope = scopeFactory.createScope(DefaultScopes.USER.type());\n            final PreferenceScope componentScope = scopeFactory.createScope(DefaultScopes.COMPONENT.type(),\n                                                                            componentKey);\n            order.add(scopeFactory.createScope(userScope,\n                                               componentScope));\n        }\n    }\n\n    private void addUserEntireApplicationScope(List<PreferenceScope> order,\n                                               final PreferenceScopeFactory scopeFactory) {\n        final PreferenceScope userScope = scopeFactory.createScope(DefaultScopes.USER.type());\n        final PreferenceScope entireApplicationScope = scopeFactory.createScope(DefaultScopes.ENTIRE_APPLICATION.type());\n        order.add(scopeFactory.createScope(userScope,\n                                           entireApplicationScope));\n    }\n\n    private void addAllUsersComponentScope(List<PreferenceScope> order,\n                                           final PreferenceScopeFactory scopeFactory,\n                                           final String componentKey) {\n        if (componentKey != null) {\n            final PreferenceScope allUsersScope = scopeFactory.createScope(DefaultScopes.ALL_USERS.type());\n            final PreferenceScope componentScope = scopeFactory.createScope(DefaultScopes.COMPONENT.type(),\n                                                                            componentKey);\n            order.add(scopeFactory.createScope(allUsersScope,\n                                               componentScope));\n        }\n    }\n\n    private void addAllUsersEntireApplicationScope(List<PreferenceScope> order,\n                                                   final PreferenceScopeFactory scopeFactory) {\n        final PreferenceScope allUsersScope = scopeFactory.createScope(DefaultScopes.ALL_USERS.type());\n        final PreferenceScope entireApplicationScope = scopeFactory.createScope(DefaultScopes.ENTIRE_APPLICATION.type());\n        order.add(scopeFactory.createScope(allUsersScope,\n                                           entireApplicationScope));\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeResolver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeResolver;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n/**\n * Default scope resolver for {@link DefaultPreferenceScopeResolutionStrategy}. If you use another\n * {@link PreferenceScopeResolutionStrategy} implementation, you should provide your own portable resolver\n * when implementing {@link PreferenceScopeResolutionStrategy#getScopeResolver() getScopeResolver}.\n */\n@Portable\npublic class DefaultPreferenceScopeResolver implements PreferenceScopeResolver {\n\n    private final List<PreferenceScope> order;\n\n    public DefaultPreferenceScopeResolver(@MapsTo(\"order\") final List<PreferenceScope> order) {\n        this.order = order;\n    }\n\n    @Override\n    public PreferenceScope resolve(final String... scopeTypes) {\n        if (scopeTypes != null && scopeTypes.length >= 1 && scopeTypes.length <= 2) {\n            if (scopeTypes.length == 2) {\n                return getScopeFromOrder(scopeTypes);\n            }\n\n            String scopeType = scopeTypes[0];\n\n            if (scopeType.equals(DefaultScopes.USER.type())) {\n                return getScopeFromOrder(DefaultScopes.USER.type(),\n                                         DefaultScopes.ENTIRE_APPLICATION.type());\n            } else if (scopeType.equals(DefaultScopes.ALL_USERS.type())) {\n                return getScopeFromOrder(DefaultScopes.ALL_USERS.type(),\n                                         DefaultScopes.ENTIRE_APPLICATION.type());\n            } else if (scopeType.equals(DefaultScopes.COMPONENT.type())) {\n                return getScopeFromOrder(DefaultScopes.ALL_USERS.type(),\n                                         DefaultScopes.COMPONENT.type());\n            } else if (scopeType.equals(DefaultScopes.ENTIRE_APPLICATION.type())) {\n                return getScopeFromOrder(DefaultScopes.ALL_USERS.type(),\n                                         DefaultScopes.ENTIRE_APPLICATION.type());\n            }\n        }\n\n        throw new InvalidPreferenceScopeException(\"The passed scope types are invalid.\");\n    }\n\n    private PreferenceScope getScopeFromOrder(final String... scopeTypes) {\n        for (PreferenceScope scope : order) {\n            boolean match = true;\n            PreferenceScope currentScope = scope;\n\n            for (int i = 0; i < scopeTypes.length; i++) {\n                if (currentScope == null || !currentScope.type().equals(scopeTypes[i])) {\n                    match = false;\n                    break;\n                }\n\n                currentScope = currentScope.childScope();\n            }\n\n            if (match && currentScope == null) {\n                return scope;\n            }\n        }\n\n        throw new InvalidPreferenceScopeException(\"The passed scope types are invalid.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeTypes.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n/**\n * Default implementation for {@link PreferenceScopeTypes}. To override it, just provide a default\n * CDI bean that implements {@link PreferenceScopeTypes}.\n */\n@ApplicationScoped\n@FallbackImplementation\npublic class DefaultPreferenceScopeTypes implements PreferenceScopeTypes {\n\n    private Map<String, DefaultKey> defaultKeyByType;\n\n    private UsernameProvider usernameProvider;\n\n    protected DefaultPreferenceScopeTypes() {\n    }\n\n    @Inject\n    public DefaultPreferenceScopeTypes(final UsernameProvider usernameProvider) {\n        this.usernameProvider = usernameProvider;\n\n        defaultKeyByType = new HashMap<>();\n        defaultKeyByType.put(DefaultScopes.ALL_USERS.type(),\n                             DefaultScopes.ALL_USERS::type);\n        defaultKeyByType.put(DefaultScopes.ENTIRE_APPLICATION.type(),\n                             DefaultScopes.ENTIRE_APPLICATION::type);\n        defaultKeyByType.put(DefaultScopes.COMPONENT.type(),\n                             null);\n        defaultKeyByType.put(DefaultScopes.USER.type(),\n                             usernameProvider::get);\n    }\n\n    @Override\n    public boolean typeRequiresKey(final String type) throws InvalidPreferenceScopeException {\n        validateType(type);\n\n        return defaultKeyByType.get(type) == null;\n    }\n\n    @Override\n    public String getDefaultKeyFor(final String type) throws InvalidPreferenceScopeException {\n        validateType(type);\n\n        final DefaultKey defaultKey = defaultKeyByType.get(type);\n\n        if (defaultKey == null) {\n            throw new InvalidPreferenceScopeException(\"The type \" + type + \" does not have a default key.\");\n        }\n\n        return defaultKey.get();\n    }\n\n    protected void validateType(final String type) throws InvalidPreferenceScopeException {\n        if (isEmpty(type)) {\n            throw new InvalidPreferenceScopeException(\"Type must be a non empty string.\");\n        }\n\n        if (!defaultKeyByType.containsKey(type)) {\n            throw new InvalidPreferenceScopeException(\"Invalid preference scope type.\");\n        }\n    }\n\n    protected boolean isEmpty(String str) {\n        return str == null || str.trim().isEmpty();\n    }\n\n    protected interface DefaultKey {\n\n        String get();\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/DefaultScopes.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\n/**\n * Definition of default scope types that can be used.\n */\npublic enum DefaultScopes {\n\n    /**\n     * Scope type responsible to store preferences for all users.\n     */\n    ALL_USERS(\"all-users\"),\n\n    /**\n     * Scope type responsible to store preferences for the entire application.\n     */\n    ENTIRE_APPLICATION(\"entire-application\"),\n\n    /**\n     * Scope type responsible to store preferences separately for each component.\n     */\n    COMPONENT(\"component\"),\n\n    /**\n     * Scope type responsible to store preferences separately for each username.\n     */\n    USER(\"user\");\n\n    private final String type;\n\n    DefaultScopes(final String type) {\n        this.type = type;\n    }\n\n    public String type() {\n        return type;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopeFactoryImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n@ApplicationScoped\npublic class PreferenceScopeFactoryImpl implements PreferenceScopeFactory {\n\n    private PreferenceScopeTypes scopeTypes;\n\n    protected PreferenceScopeFactoryImpl() {\n    }\n\n    @Inject\n    public PreferenceScopeFactoryImpl(@Customizable final PreferenceScopeTypes scopeTypes) {\n        this.scopeTypes = scopeTypes;\n    }\n\n    @Override\n    public PreferenceScope createScope(final String type) throws InvalidPreferenceScopeException {\n        return createScopeWithoutKey(type,\n                                     null);\n    }\n\n    @Override\n    public PreferenceScope createScope(final String type,\n                                       final PreferenceScope childScope) throws InvalidPreferenceScopeException {\n        return createScopeWithoutKey(type,\n                                     childScope);\n    }\n\n    @Override\n    public PreferenceScope createScope(final String type,\n                                       final String key) throws InvalidPreferenceScopeException {\n        return createScopeWithKey(type,\n                                  key,\n                                  null);\n    }\n\n    @Override\n    public PreferenceScope createScope(final String type,\n                                       final String key,\n                                       final PreferenceScope childScope) throws InvalidPreferenceScopeException {\n        return createScopeWithKey(type,\n                                  key,\n                                  childScope);\n    }\n\n    @Override\n    public PreferenceScope createScope(final PreferenceScope... scopes) throws InvalidPreferenceScopeException {\n        PreferenceScope scope = null;\n        PreferenceScope currentScope = null;\n        PreferenceScope previousScope = null;\n\n        for (int i = scopes.length - 1; i >= 0; i--) {\n            scope = scopes[i];\n\n            currentScope = new PreferenceScopeImpl(scope.type(),\n                                                   scope.key(),\n                                                   previousScope);\n            previousScope = currentScope;\n        }\n\n        return currentScope;\n    }\n\n    @Override\n    public PreferenceScope cloneScope(final PreferenceScope scope) {\n        if (scope == null) {\n            return null;\n        }\n\n        return new PreferenceScopeImpl(scope.type(),\n                                       scope.key(),\n                                       cloneScope(scope.childScope()));\n    }\n\n    private PreferenceScope createScopeWithoutKey(final String type,\n                                                  final PreferenceScope childScope) {\n        if (scopeTypes.typeRequiresKey(type)) {\n            throw new InvalidPreferenceScopeException(\"This preference scope type requires a key to be built.\");\n        }\n\n        return new PreferenceScopeImpl(type,\n                                       scopeTypes.getDefaultKeyFor(type),\n                                       childScope);\n    }\n\n    private PreferenceScope createScopeWithKey(final String type,\n                                               final String key,\n                                               final PreferenceScope childScope) {\n        if (!scopeTypes.typeRequiresKey(type)) {\n            throw new InvalidPreferenceScopeException(\"This preference scope type does not require a key to be built.\");\n        }\n\n        return new PreferenceScopeImpl(type,\n                                       key,\n                                       childScope);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopeImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PreferenceScope;\n\n/**\n * Default portable implementation for a preference scope, containing a type (required), a key (required)\n * and a child scope (optional).\n */\n@Portable\npublic class PreferenceScopeImpl implements PreferenceScope {\n\n    private final String type;\n\n    private final String key;\n\n    private final PreferenceScope childScope;\n\n    public PreferenceScopeImpl(@MapsTo(\"type\") final String type,\n                               @MapsTo(\"key\") final String key,\n                               @MapsTo(\"childScope\") final PreferenceScope childScope) {\n        this.type = type;\n        this.key = key;\n        this.childScope = childScope;\n    }\n\n    @Override\n    public String type() {\n        return type;\n    }\n\n    @Override\n    public String key() {\n        return key;\n    }\n\n    @Override\n    public PreferenceScope childScope() {\n        return childScope;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        final PreferenceScopeImpl that = (PreferenceScopeImpl) o;\n\n        if (type != null ? !type.equals(that.type) : that.type != null) {\n            return false;\n        }\n        if (key != null ? !key.equals(that.key) : that.key != null) {\n            return false;\n        }\n        return !(childScope != null ? !childScope.equals(that.childScope) : that.childScope != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = type != null ? type.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (key != null ? key.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (childScope != null ? childScope.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopeResolutionStrategyInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PreferenceScope;\n\n/**\n * Holds all necessary information to the scope resolution strategy.\n */\n@Portable\npublic class PreferenceScopeResolutionStrategyInfo {\n\n    /**\n     * Defines the order of scopes that will be used when a preference value is searched.\n     */\n    private final List<PreferenceScope> order;\n\n    /**\n     * Defines the default scope that will be used to persist a preference, when none is passed.\n     */\n    private final PreferenceScope defaultScope;\n\n    public PreferenceScopeResolutionStrategyInfo(@MapsTo(\"order\") final List<PreferenceScope> order,\n                                                 @MapsTo(\"defaultScope\") final PreferenceScope defaultScope) {\n        this.order = order;\n        this.defaultScope = defaultScope;\n    }\n\n    public List<PreferenceScope> order() {\n        return order;\n    }\n\n    public PreferenceScope defaultScope() {\n        return defaultScope;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopeTypesProducer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.rpc.SessionInfo;\n\n@Startup(value = StartupType.BOOTSTRAP, priority = -1)\n@ApplicationScoped\npublic class PreferenceScopeTypesProducer {\n\n    @Inject\n    private Instance<PreferenceScopeTypes> preferenceScopeTypes;\n\n    @Inject\n    private SessionInfo sessionInfo;\n\n    @Inject\n    @FallbackImplementation\n    private PreferenceScopeTypes defaultPreferenceScopeTypes;\n\n    @Produces\n    @Customizable\n    public PreferenceScopeTypes preferenceScopeTypesProducer() {\n        if (this.preferenceScopeTypes.isUnsatisfied()) {\n            return defaultPreferenceScopeTypes;\n        }\n\n        return this.preferenceScopeTypes.get();\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopeValidatorImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.PreferenceScopeValidator;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\n@ApplicationScoped\npublic class PreferenceScopeValidatorImpl implements PreferenceScopeValidator {\n\n    private PreferenceScopeTypes scopeTypes;\n\n    private PreferenceScopeResolutionStrategy scopeResolutionStrategy;\n\n    protected PreferenceScopeValidatorImpl() {\n    }\n\n    @Inject\n    public PreferenceScopeValidatorImpl(@Customizable final PreferenceScopeTypes scopeTypes,\n                                        @Customizable final PreferenceScopeResolutionStrategy scopeResolutionStrategy) {\n        this.scopeTypes = scopeTypes;\n        this.scopeResolutionStrategy = scopeResolutionStrategy;\n    }\n\n    @Override\n    public void validate(final PreferenceScope scope) throws InvalidPreferenceScopeException {\n        if (scope == null) {\n            throw new InvalidPreferenceScopeException(\"A root scope must not be null.\");\n        }\n\n        for (PreferenceScope currentScope = scope; currentScope != null; currentScope = currentScope.childScope()) {\n            final String type = currentScope.type();\n            final String key = currentScope.key();\n\n            if (scopeTypes.typeRequiresKey(type) && isEmpty(key)) {\n                throw new InvalidPreferenceScopeException(\"The type \" + type + \" must be associated with a non empty key.\");\n            }\n        }\n\n        if (!scopeResolutionStrategy.getInfo().order().contains(scope)) {\n            throw new InvalidPreferenceScopeException(\"This scope is not defined in the scope hierarchy.\");\n        }\n    }\n\n    protected boolean isEmpty(String str) {\n        return str == null || str.trim().isEmpty();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/PreferenceScopedValue.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.PreferenceScope;\n\n/**\n * Represents a preference value and its scope.\n * @param <T> Type of the preference value.\n */\n@Portable\npublic class PreferenceScopedValue<T> {\n\n    /**\n     * Typed preference value.\n     */\n    private final T value;\n\n    /**\n     * Scope under which this preference value is defined.\n     */\n    private final PreferenceScope scope;\n\n    public PreferenceScopedValue(@MapsTo(\"value\") final T value,\n                                 @MapsTo(\"scope\") final PreferenceScope scope) {\n        this.value = value;\n        this.scope = scope;\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    public PreferenceScope getScope() {\n        return scope;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        final PreferenceScopedValue<?> that = (PreferenceScopedValue<?>) o;\n\n        if (value != null ? !value.equals(that.value) : that.value != null) {\n            return false;\n        }\n        return !(scope != null ? !scope.equals(that.scope) : that.scope != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = value != null ? value.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (scope != null ? scope.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/exception/InvalidPreferenceScopeException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.exception;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Exception thrown when a invalid preference scope is used or created.\n * Error details can be found in the exception message.\n */\n@Portable\npublic class InvalidPreferenceScopeException extends RuntimeException {\n\n    public InvalidPreferenceScopeException() {\n    }\n\n    public InvalidPreferenceScopeException(@MapsTo(\"message\") final String message) {\n        super(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/ConstrainedValuesValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Function;\nimport java.util.function.Supplier;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\n\npublic class ConstrainedValuesValidator<T> implements PropertyValidator {\n\n    static final String NOT_ALLOWED_VALIDATION_KEY = \"PropertyValidator.ConstrainedValuesValidator.NotAllowed\";\n\n    private final Supplier<Collection<T>> allowedValuesSupplier;\n    private final Function<Object, T> valueParser;\n\n    public ConstrainedValuesValidator(final Supplier<Collection<T>> allowedValuesSupplier,\n                                      final Function<Object, T> valueParser) {\n        this.allowedValuesSupplier = allowedValuesSupplier;\n        this.valueParser = valueParser;\n    }\n\n    @Override\n    public ValidationResult validate(final Object raw) {\n        final T value = valueParser.apply(raw);\n        return allowedValuesSupplier.get().stream()\n                .anyMatch(v -> v.equals(value)) ?\n                new ValidationResult(true,\n                                     Collections.emptyList()) :\n                new ValidationResult(false,\n                                     Collections.singletonList(NOT_ALLOWED_VALIDATION_KEY));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/EnumValuePropertyValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\n\npublic class EnumValuePropertyValidator<T extends Enum<?>> implements PropertyValidator {\n\n    private final ConstrainedValuesValidator<String> validator;\n\n    @SuppressWarnings(\"unchecked\")\n    public EnumValuePropertyValidator(final T[] values) {\n        this.validator = new ConstrainedValuesValidator<>(() -> toCollection(values),\n                                                          EnumValuePropertyValidator::parseString);\n    }\n\n    @Override\n    public ValidationResult validate(final Object value) {\n        return validator.validate(value);\n    }\n\n    public static <T extends Enum<?>> String format(final T value) {\n        return value.name().toUpperCase();\n    }\n\n    public static String parseString(final Object value) {\n        return value.toString().toUpperCase();\n    }\n\n    private static <T extends Enum<?>> Collection<String> toCollection(final T[] values) {\n        return Arrays.stream(values)\n                .map(EnumValuePropertyValidator::format)\n                .collect(Collectors.toList());\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/NotEmptyValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\npublic class NotEmptyValidator extends StringPropertyValidator {\n\n    public NotEmptyValidator() {\n        super(str -> str != null && !str.trim().isEmpty(),\n              \"PropertyValidator.NotEmptyValidator.IsEmpty\");\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/NumberPropertyValidator.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\npublic class NumberPropertyValidator extends StringPropertyValidator {\n    \n    public NumberPropertyValidator() {\n        super(val -> val.matches(\"\\\\d+\") && Integer.valueOf(val) > 0,\n              \"PropertyValidator.NumberPropertyValidator.NotAllowed\");\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/StringPropertyValidator.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport java.util.Collections;\nimport java.util.function.Predicate;\n\nimport org.uberfire.preferences.shared.PropertyValidator;\n\npublic class StringPropertyValidator implements PropertyValidator<String> {\n\n    private Predicate<String> predicate;\n    private String errorIfNotValid;\n\n    public StringPropertyValidator(Predicate<String> predicate,\n                                   String errorIfNotValid) {\n        this.predicate = predicate;\n        this.errorIfNotValid = errorIfNotValid;\n    }\n\n    @Override\n    public ValidationResult validate(String value) {\n        boolean isValid = predicate.test(value);\n        if (isValid) {\n            return new ValidationResult(true,\n                                        Collections.emptyList());\n        } else {\n            return new ValidationResult(false,\n                                        Collections.singletonList(errorIfNotValid));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/java/org/uberfire/preferences/shared/impl/validation/ValidationResult.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ValidationResult {\n\n    private boolean valid;\n\n    private List<String> messagesBundleKeys;\n\n    public ValidationResult() {\n    }\n\n    public ValidationResult(@MapsTo(\"valid\") final boolean valid,\n                            @MapsTo(\"messagesBundleKeys\") final List<String> messagesBundleKeys) {\n        this.valid = valid;\n        this.messagesBundleKeys = messagesBundleKeys;\n    }\n\n    public boolean isValid() {\n        return valid;\n    }\n\n    public List<String> getMessagesBundleKeys() {\n        return messagesBundleKeys;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof ValidationResult)) {\n            return false;\n        }\n\n        ValidationResult that = (ValidationResult) o;\n\n        if (isValid() != that.isValid()) {\n            return false;\n        }\n        return !(getMessagesBundleKeys() != null ? !getMessagesBundleKeys().equals(that.getMessagesBundleKeys()) : that.getMessagesBundleKeys() != null);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = (isValid() ? 1 : 0);\n        result = ~~result;\n        result = 31 * result + (getMessagesBundleKeys() != null ? getMessagesBundleKeys().hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/main/resources/org/uberfire/preferences/UberfirePreferencesAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name='org.jboss.errai.common.ErraiCommon'/>\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n\n  <source path='shared'/>\n</module>"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/PropertyFormTypeTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared;\n\nimport org.junit.Test;\n\nimport static org.jgroups.util.Util.assertEquals;\n\npublic class PropertyFormTypeTest {\n\n    @Test\n    public void textTypeTest() {\n        String someText = \"someText\";\n        String stringValue = PropertyFormType.TEXT.toString(someText);\n        Object realValue = PropertyFormType.TEXT.fromString(stringValue);\n\n        assertEquals(\"someText\",\n                     stringValue);\n        assertEquals(someText,\n                     realValue);\n    }\n\n    @Test\n    public void booleanTypeTest() {\n        boolean someBoolean = true;\n        String stringValue = PropertyFormType.BOOLEAN.toString(someBoolean);\n        Object realValue = PropertyFormType.BOOLEAN.fromString(stringValue);\n\n        assertEquals(\"true\",\n                     stringValue);\n        assertEquals(someBoolean,\n                     realValue);\n    }\n\n    @Test\n    public void naturalNumberTypeTest() {\n        int someNaturalNumber = 3;\n        String stringValue = PropertyFormType.NATURAL_NUMBER.toString(someNaturalNumber);\n        Object realValue = PropertyFormType.NATURAL_NUMBER.fromString(stringValue);\n\n        assertEquals(\"3\",\n                     stringValue);\n        assertEquals(someNaturalNumber,\n                     realValue);\n    }\n\n    @Test\n    public void secretTextTypeTest() {\n        String someSecretText = \"someSecretText\";\n        String stringValue = PropertyFormType.SECRET_TEXT.toString(someSecretText);\n        Object realValue = PropertyFormType.SECRET_TEXT.fromString(stringValue);\n\n        assertEquals(\"someSecretText\",\n                     stringValue);\n        assertEquals(someSecretText,\n                     realValue);\n    }\n\n    @Test\n    public void colorTypeTest() {\n        String someColor = \"11FF55\";\n        String stringValue = PropertyFormType.COLOR.toString(someColor);\n        Object realValue = PropertyFormType.COLOR.fromString(stringValue);\n\n        assertEquals(\"11FF55\",\n                     stringValue);\n        assertEquals(someColor,\n                     realValue);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeResolutionStrategyTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\n\nimport static org.junit.Assert.*;\n\npublic class DefaultPreferenceScopeResolutionStrategyTest {\n\n    private PreferenceScopeFactory scopesBuilder;\n\n    private PreferenceScopeTypes scopeTypes;\n\n    private DefaultPreferenceScopeResolutionStrategy defaultPreferenceScopeResolutionStrategy;\n\n    @Before\n    public void setup() {\n        final SessionInfoMock sessionInfo = new SessionInfoMock(DefaultPreferenceScopesForTests.userScopeKey);\n        scopeTypes = new DefaultPreferenceScopeTypes(new UsernameProviderMock(sessionInfo));\n        scopesBuilder = new PreferenceScopeFactoryImpl(scopeTypes);\n\n        defaultPreferenceScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopesBuilder,\n                                                                                                null);\n    }\n\n    @Test\n    public void defaultOrderTest() {\n        final List<PreferenceScope> order = defaultPreferenceScopeResolutionStrategy.getInfo().order();\n\n        assertEquals(2,\n                     order.size());\n\n        final PreferenceScope secondScope = order.get(0);\n        assertEquals(DefaultPreferenceScopesForTests.userScopeType,\n                     secondScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.userScopeKey,\n                     secondScope.key());\n        final PreferenceScope secondScopeChild = secondScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeType,\n                     secondScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeKey,\n                     secondScopeChild.key());\n        assertNull(secondScopeChild.childScope());\n\n        final PreferenceScope fourthScope = order.get(1);\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeType,\n                     fourthScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeKey,\n                     fourthScope.key());\n        final PreferenceScope fourthScopeChild = fourthScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeType,\n                     fourthScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeKey,\n                     fourthScopeChild.key());\n        assertNull(fourthScopeChild.childScope());\n    }\n\n    @Test\n    public void orderWithComponentScopeTest() {\n        defaultPreferenceScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopesBuilder,\n                                                                                                DefaultPreferenceScopesForTests.componentScopeKey);\n        final List<PreferenceScope> order = defaultPreferenceScopeResolutionStrategy.getInfo().order();\n\n        assertEquals(4,\n                     order.size());\n\n        final PreferenceScope firstScope = order.get(0);\n        assertEquals(DefaultPreferenceScopesForTests.userScopeType,\n                     firstScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.userScopeKey,\n                     firstScope.key());\n        final PreferenceScope firstScopeChild = firstScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.componentScopeType,\n                     firstScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.componentScopeKey,\n                     firstScopeChild.key());\n        assertNull(firstScopeChild.childScope());\n\n        final PreferenceScope secondScope = order.get(1);\n        assertEquals(DefaultPreferenceScopesForTests.userScopeType,\n                     secondScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.userScopeKey,\n                     secondScope.key());\n        final PreferenceScope secondScopeChild = secondScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeType,\n                     secondScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeKey,\n                     secondScopeChild.key());\n        assertNull(secondScopeChild.childScope());\n\n        final PreferenceScope thirdScope = order.get(2);\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeType,\n                     thirdScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeKey,\n                     thirdScope.key());\n        final PreferenceScope thirdScopeChild = thirdScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.componentScopeType,\n                     thirdScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.componentScopeKey,\n                     thirdScopeChild.key());\n        assertNull(thirdScopeChild.childScope());\n\n        final PreferenceScope fourthScope = order.get(3);\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeType,\n                     fourthScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.allUsersScopeKey,\n                     fourthScope.key());\n        final PreferenceScope fourthScopeChild = fourthScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeType,\n                     fourthScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeKey,\n                     fourthScopeChild.key());\n        assertNull(fourthScopeChild.childScope());\n    }\n\n    @Test\n    public void defaultScopeTest() {\n        final PreferenceScope defaultScope = defaultPreferenceScopeResolutionStrategy.getInfo().defaultScope();\n\n        assertEquals(DefaultPreferenceScopesForTests.userScopeType,\n                     defaultScope.type());\n        assertEquals(DefaultPreferenceScopesForTests.userScopeKey,\n                     defaultScope.key());\n        final PreferenceScope defaultScopeChild = defaultScope.childScope();\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeType,\n                     defaultScopeChild.type());\n        assertEquals(DefaultPreferenceScopesForTests.entireApplicationScopeKey,\n                     defaultScopeChild.key());\n        assertNull(defaultScopeChild.childScope());\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeResolverTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.allUsersComponentScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.allUsersEntireApplicationScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.allUsersScopeType;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.componentScopeType;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.defaultOrder;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.entireApplicationScopeType;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userComponentScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userEntireApplicationScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userScopeType;\n\npublic class DefaultPreferenceScopeResolverTest {\n\n    private DefaultPreferenceScopeResolver scopeResolver;\n\n    @Before\n    public void setup() {\n        scopeResolver = new DefaultPreferenceScopeResolver(defaultOrder);\n    }\n\n    @Test\n    public void resolveValidScopesTest() {\n        assertEquals(userEntireApplicationScope,\n                     scopeResolver.resolve(userScopeType));\n        assertEquals(allUsersComponentScope,\n                     scopeResolver.resolve(componentScopeType));\n        assertEquals(allUsersEntireApplicationScope,\n                     scopeResolver.resolve(allUsersScopeType));\n        assertEquals(allUsersEntireApplicationScope,\n                     scopeResolver.resolve(entireApplicationScopeType));\n\n        assertEquals(userComponentScope,\n                     scopeResolver.resolve(userScopeType,\n                                           componentScopeType));\n        assertEquals(userEntireApplicationScope,\n                     scopeResolver.resolve(userScopeType,\n                                           entireApplicationScopeType));\n        assertEquals(allUsersComponentScope,\n                     scopeResolver.resolve(allUsersScopeType,\n                                           componentScopeType));\n        assertEquals(allUsersEntireApplicationScope,\n                     scopeResolver.resolve(allUsersScopeType,\n                                           entireApplicationScopeType));\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void tryResolveWithInvalidScopeTypeTest() {\n        scopeResolver.resolve(\"invalidScopeType\");\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void tryResolveWithNoScopeTypesTest() {\n        scopeResolver.resolve();\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void tryResolveWithThreeScopeTypesTest() {\n        scopeResolver.resolve(userScopeType,\n                              componentScopeType,\n                              entireApplicationScopeType);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopeTypesTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\n\npublic class DefaultPreferenceScopeTypesTest {\n\n    private DefaultPreferenceScopeTypes defaultPreferenceScopeTypes;\n\n    @Before\n    public void setup() {\n        final SessionInfo sessionInfo = new SessionInfoMock();\n        defaultPreferenceScopeTypes = new DefaultPreferenceScopeTypes(new UsernameProviderMock(sessionInfo));\n    }\n\n    @Test\n    public void typesRequireKeyTest() {\n        assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.ALL_USERS.type()));\n        assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.ENTIRE_APPLICATION.type()));\n        assertTrue(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.COMPONENT.type()));\n        assertFalse(defaultPreferenceScopeTypes.typeRequiresKey(DefaultScopes.USER.type()));\n    }\n\n    @Test\n    public void defaultKeysForTypesTest() {\n        assertEquals(DefaultScopes.ALL_USERS.type(),\n                     defaultPreferenceScopeTypes.getDefaultKeyFor(DefaultScopes.ALL_USERS.type()));\n        assertEquals(DefaultScopes.ENTIRE_APPLICATION.type(),\n                     defaultPreferenceScopeTypes.getDefaultKeyFor(DefaultScopes.ENTIRE_APPLICATION.type()));\n        assertEquals(\"admin\",\n                     defaultPreferenceScopeTypes.getDefaultKeyFor(DefaultScopes.USER.type()));\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void defaultKeysForTypesThatDoNotHaveDefaultKeysTest() {\n        defaultPreferenceScopeTypes.getDefaultKeyFor(DefaultScopes.COMPONENT.type());\n    }\n\n    @Test\n    public void isEmptyTest() {\n        assertTrue(defaultPreferenceScopeTypes.isEmpty(null));\n        assertTrue(defaultPreferenceScopeTypes.isEmpty(\"\"));\n        assertTrue(defaultPreferenceScopeTypes.isEmpty(\"  \"));\n        assertFalse(defaultPreferenceScopeTypes.isEmpty(\"anyString\"));\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/DefaultPreferenceScopesForTests.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.uberfire.preferences.shared.PreferenceScope;\n\npublic class DefaultPreferenceScopesForTests {\n\n    public static final String allUsersScopeType = DefaultScopes.ALL_USERS.type();\n    public static final String entireApplicationScopeType = DefaultScopes.ENTIRE_APPLICATION.type();\n    public static final String componentScopeType = DefaultScopes.COMPONENT.type();\n    public static final String userScopeType = DefaultScopes.USER.type();\n\n    public static final String allUsersScopeKey = allUsersScopeType;\n    public static final String entireApplicationScopeKey = entireApplicationScopeType;\n    public static final String componentScopeKey = \"my-component\";\n    public static final String userScopeKey = \"my-user\";\n\n    public static final PreferenceScopeImpl allUsersScope = new PreferenceScopeImpl(allUsersScopeType,\n                                                                                    allUsersScopeKey,\n                                                                                    null);\n    public static final PreferenceScopeImpl entireApplicationScope = new PreferenceScopeImpl(entireApplicationScopeType,\n                                                                                             entireApplicationScopeKey,\n                                                                                             null);\n    public static final PreferenceScopeImpl componentScope = new PreferenceScopeImpl(componentScopeType,\n                                                                                     componentScopeKey,\n                                                                                     null);\n    public static final PreferenceScopeImpl userScope = new PreferenceScopeImpl(userScopeType,\n                                                                                userScopeKey,\n                                                                                null);\n\n    public static final PreferenceScopeImpl userComponentScope = new PreferenceScopeImpl(userScopeType,\n                                                                                         userScopeKey,\n                                                                                         componentScope);\n    public static final PreferenceScopeImpl userEntireApplicationScope = new PreferenceScopeImpl(userScopeType,\n                                                                                                 userScopeKey,\n                                                                                                 entireApplicationScope);\n    public static final PreferenceScopeImpl allUsersComponentScope = new PreferenceScopeImpl(allUsersScopeType,\n                                                                                             allUsersScopeKey,\n                                                                                             componentScope);\n    public static final PreferenceScopeImpl allUsersEntireApplicationScope = new PreferenceScopeImpl(allUsersScopeType,\n                                                                                                     allUsersScopeKey,\n                                                                                                     entireApplicationScope);\n\n    public static final List<PreferenceScope> defaultOrder = Arrays.asList(userComponentScope,\n                                                                           userEntireApplicationScope,\n                                                                           allUsersComponentScope,\n                                                                           allUsersEntireApplicationScope);\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/PreferenceScopeFactoryImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.entireApplicationScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userScope;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userScopeKey;\n\npublic class PreferenceScopeFactoryImplTest {\n\n    private PreferenceScopeFactoryImpl scopeFactory;\n\n    private PreferenceScope genericScope;\n\n    @Before\n    public void setup() {\n        genericScope = mock(PreferenceScope.class);\n\n        final SessionInfoMock sessionInfo = new SessionInfoMock();\n        final PreferenceScopeTypes scopeTypes = new DefaultPreferenceScopeTypes(new UsernameProviderMock(sessionInfo));\n        scopeFactory = new PreferenceScopeFactoryImpl(scopeTypes);\n    }\n\n    @Test\n    public void createScopeByTypeWithDefaultKeyTest() {\n        PreferenceScope userScope = scopeFactory.createScope(DefaultScopes.USER.type());\n        assertEquals(DefaultScopes.USER.type(),\n                     userScope.type());\n        assertEquals(\"admin\",\n                     userScope.key());\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void createScopeByTypeWithoutDefaultKeyTest() {\n        scopeFactory.createScope(DefaultScopes.COMPONENT.type());\n    }\n\n    @Test\n    public void createScopeByTypeAndKeyWithoutDefaultKeyTest() {\n        PreferenceScope componentScope = scopeFactory.createScope(DefaultScopes.COMPONENT.type(),\n                                                                  \"my-component\");\n        assertEquals(DefaultScopes.COMPONENT.type(),\n                     componentScope.type());\n        assertEquals(\"my-component\",\n                     componentScope.key());\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void createScopeByTypeAndKeyWithDefaultKeyTest() {\n        scopeFactory.createScope(DefaultScopes.USER.type(),\n                                 \"user\");\n    }\n\n    @Test\n    public void createScopeByTypeAndChildScopeWithDefaultKeyTest() {\n        PreferenceScope userScope = scopeFactory.createScope(DefaultScopes.USER.type(),\n                                                             genericScope);\n        assertEquals(DefaultScopes.USER.type(),\n                     userScope.type());\n        assertEquals(\"admin\",\n                     userScope.key());\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void createScopeByTypeAndChildScopeWithoutDefaultKeyTest() {\n        scopeFactory.createScope(DefaultScopes.COMPONENT.type(),\n                                 genericScope);\n    }\n\n    @Test\n    public void createScopeByTypeKeyAndChildScopeWithoutDefaultKeyTest() {\n        PreferenceScope componentScope = scopeFactory.createScope(DefaultScopes.COMPONENT.type(),\n                                                                  \"my-component\",\n                                                                  genericScope);\n        assertEquals(DefaultScopes.COMPONENT.type(),\n                     componentScope.type());\n        assertEquals(\"my-component\",\n                     componentScope.key());\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void createScopeByTypeKeyAndChildScopeWithDefaultKeyTest() {\n        scopeFactory.createScope(DefaultScopes.USER.type(),\n                                 \"user\",\n                                 genericScope);\n    }\n\n    @Test\n    public void createHierarchicalScopeByScopesTest() {\n        PreferenceScope scope = scopeFactory.createScope(userScope,\n                                                         entireApplicationScope);\n\n        assertEquals(DefaultScopes.USER.type(),\n                     scope.type());\n        assertEquals(userScopeKey,\n                     scope.key());\n\n        final PreferenceScope childScope = scope.childScope();\n        assertEquals(DefaultScopes.ENTIRE_APPLICATION.type(),\n                     childScope.type());\n        assertEquals(DefaultScopes.ENTIRE_APPLICATION.type(),\n                     childScope.key());\n        assertNull(childScope.childScope());\n    }\n\n    @Test\n    public void cloneScopeTest() {\n        PreferenceScope scope = scopeFactory.createScope(userScope,\n                                                         entireApplicationScope);\n        PreferenceScope newScope = scopeFactory.cloneScope(scope);\n\n        assertTrue(scope != newScope);\n        assertEquals(scope,\n                     newScope);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/PreferenceScopeValidatorImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\n\nimport static org.junit.Assert.*;\nimport static org.uberfire.preferences.shared.impl.DefaultPreferenceScopesForTests.userEntireApplicationScope;\n\npublic class PreferenceScopeValidatorImplTest {\n\n    private PreferenceScopeValidatorImpl validator;\n\n    @Before\n    public void setup() {\n        final SessionInfoMock sessionInfo = new SessionInfoMock(\"my-user\");\n        final DefaultPreferenceScopeTypes scopeTypes = new DefaultPreferenceScopeTypes(new UsernameProviderMock(sessionInfo));\n        final PreferenceScopeFactory scopeFactory = new PreferenceScopeFactoryImpl(scopeTypes);\n        final DefaultPreferenceScopeResolutionStrategy scopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                                                                              null);\n\n        validator = new PreferenceScopeValidatorImpl(scopeTypes,\n                                                     scopeResolutionStrategy);\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void validateNullScopeTest() {\n        validator.validate(null);\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void validateScopeWithInvalidTypeTest() {\n        validator.validate(new PreferenceScopeImpl(\"invalidType\",\n                                                   null,\n                                                   null));\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void validateScopeWithTypeThatRequiresKeyWithoutKeyTest() {\n        validator.validate(new PreferenceScopeImpl(DefaultScopes.COMPONENT.type(),\n                                                   null,\n                                                   null));\n    }\n\n    @Test(expected = InvalidPreferenceScopeException.class)\n    public void validateScopeWithValidScopeButNotInTheOrderTest() {\n        validator.validate(new PreferenceScopeImpl(DefaultScopes.USER.type(),\n                                                   null,\n                                                   null));\n    }\n\n    @Test\n    public void validateValidScopeTest() {\n        validator.validate(userEntireApplicationScope);\n    }\n\n    @Test\n    public void isEmptyTest() {\n        assertTrue(validator.isEmpty(null));\n        assertTrue(validator.isEmpty(\"\"));\n        assertTrue(validator.isEmpty(\"  \"));\n        assertFalse(validator.isEmpty(\"anyString\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/UsernameProviderMock.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl;\n\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.rpc.SessionInfo;\n\npublic class UsernameProviderMock implements UsernameProvider {\n\n    private SessionInfo sessionInfo;\n\n    public UsernameProviderMock(final SessionInfo sessionInfo) {\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public String get() {\n        return sessionInfo.getIdentity().getIdentifier();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/validation/ConstrainedValuesValidatorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.function.Function;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class ConstrainedValuesValidatorTest {\n\n    private static final Collection<String> VALUES = Arrays.asList(\"value1\", \"value2\", \"value3\");\n\n    private static final Function<Object, String> VALUE_PARSER = Object::toString;\n\n    private ConstrainedValuesValidator<String> tested;\n\n    @Before\n    public void setup() {\n        tested = new ConstrainedValuesValidator<>(() -> VALUES,\n                                                  VALUE_PARSER);\n    }\n\n    @Test\n    public void testValues() {\n        assertResultSuccess(tested.validate(\"value1\"));\n        assertResultSuccess(tested.validate(\"value2\"));\n        assertResultSuccess(tested.validate(\"value3\"));\n        assertResultFailed(tested.validate(\"value4\"));\n    }\n\n    static void assertResultSuccess(final ValidationResult result) {\n        assertTrue(result.isValid());\n    }\n\n    static void assertResultFailed(final ValidationResult result) {\n        assertFalse(result.isValid());\n        assertEquals(1, result.getMessagesBundleKeys().size());\n        assertEquals(ConstrainedValuesValidator.NOT_ALLOWED_VALIDATION_KEY, result.getMessagesBundleKeys().get(0));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/validation/EnumValuePropertyValidatorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\npublic class EnumValuePropertyValidatorTest {\n\n    private EnumValuePropertyValidator<PropertyValidatorEnum> tested;\n\n    @Before\n    public void setup() {\n        tested = new EnumValuePropertyValidator<>(PropertyValidatorEnum.values());\n    }\n\n    @Test\n    public void testValues() {\n        ConstrainedValuesValidatorTest.assertResultSuccess(tested.validate(PropertyValidatorEnum.VALUE1));\n        ConstrainedValuesValidatorTest.assertResultSuccess(tested.validate(PropertyValidatorEnum.VALUE2));\n        ConstrainedValuesValidatorTest.assertResultSuccess(tested.validate(PropertyValidatorEnum.VALUE1));\n        ConstrainedValuesValidatorTest.assertResultFailed(tested.validate(\"value4\"));\n    }\n\n    private enum PropertyValidatorEnum {\n        VALUE1, VALUE2, VALUE3;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/validation/NotEmptyValidatorTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class NotEmptyValidatorTest {\n\n    private NotEmptyValidator notEmptyValidator;\n\n    @Before\n    public void setup() {\n        notEmptyValidator = new NotEmptyValidator();\n    }\n\n    @Test\n    public void emptyStringTest() {\n        final ValidationResult validationResult = notEmptyValidator.validate(\"\");\n\n        assertFalse(validationResult.isValid());\n        assertEquals(1,\n                     validationResult.getMessagesBundleKeys().size());\n        assertEquals(\"PropertyValidator.NotEmptyValidator.IsEmpty\",\n                     validationResult.getMessagesBundleKeys().get(0));\n    }\n\n    @Test\n    public void notEmptyStringTest() {\n        final ValidationResult validationResult = notEmptyValidator.validate(\"some-text\");\n\n        assertTrue(validationResult.isValid());\n        assertEquals(0,\n                     validationResult.getMessagesBundleKeys().size());\n    }\n\n    @Test\n    public void spacesOnlyTest() {\n        final ValidationResult validationResult = notEmptyValidator.validate(\"   \");\n\n        assertFalse(validationResult.isValid());\n        assertEquals(1,\n                     validationResult.getMessagesBundleKeys().size());\n        assertEquals(\"PropertyValidator.NotEmptyValidator.IsEmpty\",\n                     validationResult.getMessagesBundleKeys().get(0));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-api/src/test/java/org/uberfire/preferences/shared/impl/validation/NumberPropertyValidatorTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.preferences.shared.impl.validation;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\n\npublic class NumberPropertyValidatorTest {\n    \n    private NumberPropertyValidator numberPropertyValidator;\n    \n    @Before\n    public void setup() {\n        numberPropertyValidator = new NumberPropertyValidator();\n    }\n    \n    @Test\n    public void emptyValueTest() {\n        failureTest(\"\");\n    }\n    \n    @Test\n    public void nonNumberFormatTest() {\n        failureTest(\"xyz\");\n    }\n    \n    @Test\n    public void positiveValueTest() {\n        failureTest(\"-1\");\n    }\n    \n    @Test\n    public void validNumberTest() {\n        final ValidationResult validationResult = numberPropertyValidator.validate(\"15\");\n        \n        assertTrue(validationResult.isValid());\n        assertEquals(0,\n                     validationResult.getMessagesBundleKeys().size());\n    }\n    \n    private void failureTest(final String value) {\n        final ValidationResult validationResult = numberPropertyValidator.validate(value);\n        \n        assertFalse(validationResult.isValid());\n        assertEquals(1,\n                     validationResult.getMessagesBundleKeys().size());\n        assertEquals(\"PropertyValidator.NumberPropertyValidator.NotAllowed\",\n                     validationResult.getMessagesBundleKeys().get(0));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-preferences</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <name>Uberfire Preferences Backend</name>\n  <description>Uberfire Preferences Backend</description>\n  <artifactId>uberfire-preferences-backend</artifactId>\n  <packaging>jar</packaging>\n  <dependencies>\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n</project>"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/PreferenceBeanStoreImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.lang.reflect.Field;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.UUID;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.util.AnnotationLiteral;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceStore;\nimport org.uberfire.preferences.shared.annotations.PortablePreference;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.Preference;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanServerStore;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Backend implementation for {@link PreferenceBeanStore}.\n */\n@Service\npublic class PreferenceBeanStoreImpl implements PreferenceBeanServerStore {\n\n    private static final AnnotationLiteral<PortablePreference> portablePreferenceAnnotation = new AnnotationLiteral<PortablePreference>() {\n    };\n\n    private PreferenceStore preferenceStore;\n\n    private PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy;\n\n    private Instance<Preference> preferences;\n\n    private Map<String, List<BasePreferencePortable>> childrenByParent;\n\n    public PreferenceBeanStoreImpl() {\n    }\n\n    @Inject\n    public PreferenceBeanStoreImpl(final PreferenceStore preferenceStore,\n                                   @Customizable final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy,\n                                   @PortablePreference final Instance<Preference> preferences) {\n        this.preferenceStore = preferenceStore;\n        this.defaultScopeResolutionStrategy = defaultScopeResolutionStrategy;\n        this.preferences = preferences;\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T load(final T emptyPortablePreference) {\n        return load(emptyPortablePreference,\n                    defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T load(final T emptyPortablePreference,\n                                                                                     final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        Class<U> clazz = emptyPortablePreference.getPojoClass();\n        T portablePreference = preferenceStore.get(scopeResolutionStrategyInfo,\n                                                   emptyPortablePreference.identifier());\n        if (portablePreference == null) {\n            portablePreference = (T) emptyPortablePreference.defaultValue((U) emptyPortablePreference);\n        }\n\n        try {\n            return load(clazz,\n                        portablePreference,\n                        scopeResolutionStrategyInfo);\n        } catch (IllegalAccessException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        load(emptyPortablePreference,\n             defaultScopeResolutionStrategy.getInfo(),\n             successCallback,\n             errorCallback);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        T loadedPreference = null;\n        try {\n            loadedPreference = load(emptyPortablePreference,\n                                    scopeResolutionStrategyInfo);\n        } catch (Exception e) {\n            if (errorCallback != null) {\n                errorCallback.execute(e);\n            }\n        }\n\n        if (successCallback != null) {\n            successCallback.execute(loadedPreference);\n        }\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference) {\n        save(portablePreference,\n             defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        save(portablePreference,\n             scopeResolutionStrategyInfo.defaultScope());\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScope scope) {\n        try {\n            Class<U> clazz = portablePreference.getPojoClass();\n            save(clazz,\n                 portablePreference,\n                 scope);\n            if (portablePreference.isPersistable()) {\n                preferenceStore.put(scope,\n                                    portablePreference.identifier(),\n                                    portablePreference);\n            }\n        } catch (IllegalAccessException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        save(portablePreference,\n             defaultScopeResolutionStrategy.getInfo(),\n             successCallback,\n             errorCallback);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        save(portablePreference,\n             scopeResolutionStrategyInfo.defaultScope(),\n             successCallback,\n             errorCallback);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScope scope,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        try {\n            save(portablePreference,\n                 scope);\n        } catch (Exception e) {\n            if (errorCallback != null) {\n                errorCallback.execute(e);\n            }\n        }\n\n        if (successCallback != null) {\n            successCallback.execute();\n        }\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences) {\n        save(portablePreferences,\n             defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        save(portablePreferences,\n             scopeResolutionStrategyInfo.defaultScope());\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScope scope) {\n        for (BasePreferencePortable<? extends BasePreference<?>> portablePreference : portablePreferences) {\n            saveOne(portablePreference,\n                    scope);\n        }\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        save(portablePreferences,\n             defaultScopeResolutionStrategy.getInfo(),\n             successCallback,\n             errorCallback);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        save(portablePreferences,\n             scopeResolutionStrategyInfo.defaultScope(),\n             successCallback,\n             errorCallback);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScope scope,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        try {\n            save(portablePreferences,\n                 scope);\n        } catch (Exception e) {\n            if (errorCallback != null) {\n                errorCallback.execute(e);\n            }\n        }\n\n        if (successCallback != null) {\n            successCallback.execute();\n        }\n    }\n\n    @Override\n    public PreferenceHierarchyElement<?> buildHierarchyStructureForPreference(final String identifier) {\n        return buildHierarchyStructureForPreference(identifier,\n                                                    defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public PreferenceHierarchyElement<?> buildHierarchyStructureForPreference(final String identifier,\n                                                                              final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        BasePreferencePortable preference = getPortablePreferenceByIdentifier(identifier);\n        preference = load(preference,\n                          scopeResolutionStrategyInfo);\n\n        final PreferenceHierarchyElement<?> rootElement = buildHierarchyElement(preference,\n                                                                                null,\n                                                                                false,\n                                                                                true,\n                                                                                preference.bundleKey(),\n                                                                                scopeResolutionStrategyInfo);\n\n        return rootElement;\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T load(final Class<U> clazz,\n                                                                                      T portablePreference,\n                                                                                      final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) throws IllegalAccessException {\n        if (portablePreference == null) {\n            portablePreference = lookupPortablePreference(clazz);\n        }\n\n        for (Field field : portablePreference.getPojoClass().getDeclaredFields()) {\n            Property propertyAnnotation = field.getAnnotation(Property.class);\n            if (propertyAnnotation != null) {\n                if (field.getType().isAnnotationPresent(WorkbenchPreference.class)) {\n                    final Class<? extends BasePreference<?>> propertyType = (Class<? extends BasePreference<?>>) field.getType();\n                    boolean shared = propertyAnnotation.shared();\n\n                    field.setAccessible(true);\n\n                    if (shared) {\n                        BasePreferencePortable<?> loadedSharedProperty = loadSharedPreference(field,\n                                                                                              scopeResolutionStrategyInfo);\n                        field.set(portablePreference,\n                                  loadedSharedProperty);\n                    } else {\n                        final BasePreferencePortable<?> subPreferenceValue = loadSubPreferenceValue(portablePreference,\n                                                                                                    field,\n                                                                                                    scopeResolutionStrategyInfo);\n                        field.set(portablePreference,\n                                  subPreferenceValue);\n                    }\n                }\n            }\n        }\n\n        return portablePreference;\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T loadSharedPreference(final Field field,\n                                                                                                      final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        final Class<U> propertyType = (Class<U>) field.getType();\n        T loadedPreference;\n\n        try {\n            T emptyPortablePreference = lookupPortablePreference(propertyType);\n            T portablePreference = preferenceStore.get(scopeResolutionStrategyInfo,\n                                                       emptyPortablePreference.identifier());\n            if (portablePreference == null) {\n                portablePreference = (T) emptyPortablePreference.defaultValue((U) emptyPortablePreference);\n            }\n            loadedPreference = load(propertyType,\n                                    portablePreference,\n                                    scopeResolutionStrategyInfo);\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n\n        return loadedPreference;\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T loadSubPreferenceValue(final Object portablePreference,\n                                                                                                        final Field field,\n                                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) throws IllegalAccessException {\n        final Class<U> propertyType = (Class<U>) field.getType();\n        final T subPreferenceValue = (T) field.get(portablePreference);\n        return load(propertyType,\n                    subPreferenceValue,\n                    scopeResolutionStrategyInfo);\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final Class<U> clazz,\n                                                                                         final T portablePreference,\n                                                                                         final PreferenceScope scope) throws IllegalAccessException {\n        for (Field field : portablePreference.getPojoClass().getDeclaredFields()) {\n            Property propertyAnnotation = field.getAnnotation(Property.class);\n            if (propertyAnnotation != null) {\n                if (field.getType().isAnnotationPresent(WorkbenchPreference.class)) {\n                    boolean shared = propertyAnnotation.shared();\n\n                    field.setAccessible(true);\n\n                    if (shared) {\n                        saveSharedPreference(portablePreference,\n                                             field,\n                                             scope);\n                    } else {\n                        saveSubPreference(portablePreference,\n                                          field,\n                                          scope);\n                    }\n                }\n            }\n        }\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void saveSharedPreference(final Object portablePreference,\n                                                                                                         final Field field,\n                                                                                                         final PreferenceScope scope) throws IllegalAccessException {\n        final Class<U> propertyType = (Class<U>) field.getType();\n        final T sharedPropertyValue = (T) field.get(portablePreference);\n        save(sharedPropertyValue,\n             scope);\n    }\n\n    private <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void saveSubPreference(final Object portablePreference,\n                                                                                                      final Field field,\n                                                                                                      final PreferenceScope scope) throws IllegalAccessException {\n        final Class<U> propertyType = (Class<U>) field.getType();\n        final T subPreferenceValue = (T) field.get(portablePreference);\n        save(propertyType,\n             subPreferenceValue,\n             scope);\n    }\n\n    private <T extends BasePreference<T>> void saveOne(final BasePreferencePortable<?> portablePreference,\n                                                       final PreferenceScope scope) {\n        Class<T> clazz = (Class<T>) portablePreference.getPojoClass();\n        try {\n            save(clazz,\n                 (BasePreferencePortable<T>) portablePreference,\n                 scope);\n            if (portablePreference.isPersistable()) {\n                preferenceStore.put(scope,\n                                    portablePreference.identifier(),\n                                    portablePreference);\n            }\n        } catch (IllegalAccessException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private List<BasePreferencePortable> getAnnotatedChildren(String parentIdentifier) {\n        if (childrenByParent == null) {\n            childrenByParent = new HashMap<>();\n\n            final Iterable<Preference> portablePreferences = getPortablePreferences();\n            portablePreferences.forEach(preference -> {\n                final BasePreferencePortable portablePreference = (BasePreferencePortable) preference;\n                final String[] parents = portablePreference.parents();\n\n                for (String parent : parents) {\n                    if (parent != null && !parent.isEmpty()) {\n                        List<BasePreferencePortable> children = childrenByParent.computeIfAbsent(parent, k -> new ArrayList<>());\n                        children.add(portablePreference);\n                    }\n                }\n            });\n        }\n\n        return childrenByParent.get(parentIdentifier);\n    }\n\n    private <T> PreferenceHierarchyElement<T> buildHierarchyElement(final BasePreferencePortable<T> portablePreference,\n                                                                    final PreferenceHierarchyElement<?> parent,\n                                                                    final boolean shared,\n                                                                    final boolean root,\n                                                                    final String bundleKey,\n                                                                    final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        PreferenceHierarchyElement<T> hierarchyElement = new PreferenceHierarchyElement<>(UUID.randomUUID().toString(),\n                                                                                          portablePreference,\n                                                                                          shared,\n                                                                                          root,\n                                                                                          bundleKey);\n\n        buildHierarchyElementForAnnotatedChildren(portablePreference,\n                                                  hierarchyElement,\n                                                  scopeResolutionStrategyInfo);\n\n        try {\n            hierarchyElement.setPortablePreference(portablePreference);\n\n            for (Field field : portablePreference.getPojoClass().getDeclaredFields()) {\n                Property propertyAnnotation = field.getAnnotation(Property.class);\n                if (propertyAnnotation != null) {\n                    String propertyBundleKey = \"\";\n                    if (!propertyAnnotation.bundleKey().isEmpty()) {\n                        propertyBundleKey = propertyAnnotation.bundleKey();\n                    }\n\n                    if (field.getType().isAnnotationPresent(WorkbenchPreference.class)) {\n                        field.setAccessible(true);\n                        final BasePreferencePortable fieldValue = (BasePreferencePortable) field.get(portablePreference);\n\n                        if (propertyBundleKey.isEmpty()) {\n                            propertyBundleKey = fieldValue.bundleKey();\n                        }\n\n                        final PreferenceHierarchyElement<?> childElement = buildHierarchyElement(fieldValue,\n                                                                                                 hierarchyElement,\n                                                                                                 propertyAnnotation.shared(),\n                                                                                                 false,\n                                                                                                 propertyBundleKey,\n                                                                                                 scopeResolutionStrategyInfo);\n\n                        hierarchyElement.getChildren().add(childElement);\n                    } else {\n                        if (propertyBundleKey.isEmpty()) {\n                            propertyBundleKey = field.getName();\n                        }\n\n                        hierarchyElement.addPropertyBundleKey(field.getName(),\n                                                              propertyBundleKey);\n                    }\n\n                    hierarchyElement.addPropertyHelpBundleKey(field.getName(),\n                                                              propertyAnnotation.helpBundleKey());\n                    hierarchyElement.addPropertyFormOptions(field.getName(),\n                                                            propertyAnnotation.formOptions());\n                }\n            }\n        } catch (IllegalAccessException e) {\n            e.printStackTrace();\n        }\n\n        return hierarchyElement;\n    }\n\n    private <T> void buildHierarchyElementForAnnotatedChildren(final BasePreferencePortable<T> portablePreference,\n                                                               final PreferenceHierarchyElement<T> hierarchyElement,\n                                                               final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        final List<BasePreferencePortable> annotatedChildren = getAnnotatedChildren(portablePreference.identifier());\n        if (annotatedChildren != null) {\n            annotatedChildren.forEach(childPreference -> {\n                final BasePreferencePortable<?> loadedChild = load(childPreference,\n                                                                   scopeResolutionStrategyInfo);\n                final PreferenceHierarchyElement<?> childElement = buildHierarchyElement(loadedChild,\n                                                                                         hierarchyElement,\n                                                                                         false,\n                                                                                         true,\n                                                                                         childPreference.bundleKey(),\n                                                                                         scopeResolutionStrategyInfo);\n\n                hierarchyElement.getChildren().add(childElement);\n            });\n        }\n    }\n\n    BasePreferencePortable getPortablePreferenceByIdentifier(String identifier) {\n        for (Preference preference : getPortablePreferences()) {\n            BasePreferencePortable portablePreference = (BasePreferencePortable) preference;\n\n            if (portablePreference.identifier().equals(identifier)) {\n                return portablePreference;\n            }\n        }\n\n        return null;\n    }\n\n    Iterable<Preference> getPortablePreferences() {\n        return preferences.select(portablePreferenceAnnotation);\n    }\n\n    <U extends BasePreference<U>, T extends BasePreferencePortable<U>> T lookupPortablePreference(final Class<U> clazz) {\n        return (T) preferences.select(clazz,\n                                      portablePreferenceAnnotation).get();\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/PreferenceScopeResolutionStrategyProducer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.lang.annotation.Annotation;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.backend.annotations.ComponentKey;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\n\n@Dependent\npublic class PreferenceScopeResolutionStrategyProducer {\n\n    @Inject\n    private Instance<PreferenceScopeResolutionStrategy> preferenceScopeResolutionStrategy;\n\n    @Inject\n    private PreferenceScopeFactory scopeFactory;\n\n    @Inject\n    @Customizable\n    private PreferenceScopeTypes scopeTypes;\n\n    private DefaultPreferenceScopeResolutionStrategy defaultPreferenceScopeResolutionStrategy = null;\n\n    @Produces\n    @Customizable\n    public PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategyProducer(final InjectionPoint ip) {\n        if (this.preferenceScopeResolutionStrategy.isUnsatisfied()) {\n            String componentKey = null;\n            Annotation annotation = ip.getAnnotated().getAnnotation(ComponentKey.class);\n            if (annotation != null) {\n                componentKey = ((ComponentKey) annotation).value();\n            }\n\n            if (defaultPreferenceScopeResolutionStrategy == null) {\n                defaultPreferenceScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                                                        componentKey);\n            }\n\n            return defaultPreferenceScopeResolutionStrategy;\n        }\n\n        return this.preferenceScopeResolutionStrategy.get();\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/PreferenceStorageImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.java.nio.file.Files.walkFileTree;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.LinkedHashSet;\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.SimpleFileVisitor;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.PreferenceStorage;\nimport org.uberfire.preferences.shared.event.PreferenceUpdatedEvent;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\nimport org.uberfire.preferences.shared.impl.exception.InvalidPreferenceScopeException;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\n@ApplicationScoped\npublic class PreferenceStorageImpl implements PreferenceStorage {\n\n    public static final String FILE_FORMAT = \".preferences\";\n    public static final int FILE_FORMAT_SIZE = FILE_FORMAT.length();\n    private static final Logger logger = LoggerFactory.getLogger(PreferenceStorageImpl.class);\n\n    private SpacesAPI spaces;\n\n    private IOService ioService;\n\n    private SessionInfo sessionInfo;\n\n    private PreferenceScopeTypes scopeTypes;\n\n    private PreferenceScopeFactory scopeFactory;\n\n    private ObjectStorage objectStorage;\n    \n    private Event<PreferenceUpdatedEvent> preferenceUpdatedEvent;\n\n    protected PreferenceStorageImpl() {\n    }\n\n    @Inject\n    public PreferenceStorageImpl(@Named(\"ioStrategy\") final IOService ioService,\n                                 final SessionInfo sessionInfo,\n                                 @Customizable final PreferenceScopeTypes scopeTypes,\n                                 final PreferenceScopeFactory scopeFactory,\n                                 final ObjectStorage objectStorage,\n                                 final SpacesAPI spaces,\n                                 final Event<PreferenceUpdatedEvent> preferenceUpdatedEvent) {\n        this.ioService = ioService;\n        this.sessionInfo = sessionInfo;\n        this.scopeTypes = scopeTypes;\n        this.scopeFactory = scopeFactory;\n        this.objectStorage = objectStorage;\n        this.spaces = spaces;\n        this.preferenceUpdatedEvent = preferenceUpdatedEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        objectStorage.init(spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                                       SpacesAPI.DEFAULT_SPACE,\n                                                       \"preferences\"));\n    }\n\n    @Override\n    public boolean exists(final PreferenceScope preferenceScope,\n                          final String key) {\n        return objectStorage.exists(buildScopedPreferencePath(preferenceScope,\n                                                              key));\n    }\n\n    @Override\n    public boolean exists(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                          final String key) {\n        for (PreferenceScope preferenceScope : scopeResolutionStrategyInfo.order()) {\n            boolean exists = exists(preferenceScope,\n                                    key);\n            if (exists) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    @Override\n    public <T> T read(final PreferenceScope preferenceScope,\n                      final String key) {\n        final String path = buildScopedPreferencePath(preferenceScope,\n                                                      key);\n        return objectStorage.read(path);\n    }\n\n    @Override\n    public <T> T read(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                      final String key) {\n        for (PreferenceScope preferenceScope : scopeResolutionStrategyInfo.order()) {\n            T result = read(preferenceScope,\n                            key);\n            if (result != null) {\n                return result;\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public <T> PreferenceScopedValue<T> readWithScope(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                      final String key) {\n        for (PreferenceScope scope : scopeResolutionStrategyInfo.order()) {\n            T result = read(scope,\n                            key);\n            if (result != null) {\n                return new PreferenceScopedValue<>(result,\n                                                   scopeFactory.cloneScope(scope));\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public void write(final PreferenceScope preferenceScope,\n                      final String key,\n                      final Object value) {\n        objectStorage.write(buildScopedPreferencePath(preferenceScope,\n                                                      key),\n                                                      value);\n        preferenceUpdatedEvent.fire(new PreferenceUpdatedEvent(key, \n                                                               value));\n    }\n\n    @Override\n    public void delete(final PreferenceScope preferenceScope,\n                       final String key) {\n        objectStorage.delete(buildScopedPreferencePath(preferenceScope,\n                                                       key));\n    }\n\n    @Override\n    public Collection<String> allKeys(final PreferenceScope scope) {\n        Collection<String> keys = new ArrayList<>();\n        Path path = this.objectStorage.getPath(buildScopePath(scope));\n\n        if (ioService.exists(path)) {\n            walkFileTree(checkNotNull(\"path\",\n                                      path),\n                         new SimpleFileVisitor<Path>() {\n                             @Override\n                             public FileVisitResult visitFile(final Path file,\n                                                              final BasicFileAttributes attrs) throws IOException {\n                                 try {\n                                     checkNotNull(\"file\",\n                                                  file);\n\n                                     final String fileName = file.getFileName().toString();\n                                     final int keyEndIndex = fileName.length() - FILE_FORMAT_SIZE;\n                                     final String fileNameWithoutFormat = fileName.substring(0,\n                                                                                             keyEndIndex);\n\n                                     keys.add(fileNameWithoutFormat);\n                                 } catch (final Exception ex) {\n                                     logger.error(\"An unexpected exception was thrown: \",\n                                                  ex);\n                                     return FileVisitResult.TERMINATE;\n                                 }\n\n                                 return FileVisitResult.CONTINUE;\n                             }\n                         });\n        }\n\n        return keys;\n    }\n\n    @Override\n    public Collection<String> allKeys(final List<PreferenceScope> scopes) {\n        Collection<String> keys = new LinkedHashSet<>();\n\n        scopes.forEach(scope -> keys.addAll(allKeys(scope)));\n\n        return keys;\n    }\n\n    String buildScopePath(final PreferenceScope scope) {\n        if (scope == null) {\n            throw new InvalidPreferenceScopeException(\"The scope must not be null when building a scope path.\");\n        }\n\n        String path = \"/config/\";\n\n        for (PreferenceScope currentScope = scope; currentScope != null; currentScope = currentScope.childScope()) {\n            path += currentScope.type() + \"/\" + currentScope.key() + \"/\";\n        }\n\n        return path;\n    }\n\n    String buildScopedPreferencePath(final PreferenceScope scope,\n                                     final String key) {\n        return buildScopePath(scope) + key + FILE_FORMAT;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/PreferenceStoreImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.backend.annotations.ComponentKey;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeResolver;\nimport org.uberfire.preferences.shared.PreferenceStorage;\nimport org.uberfire.preferences.shared.PreferenceStore;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\n\n@Service\npublic class PreferenceStoreImpl implements PreferenceStore {\n\n    protected PreferenceStorage storage;\n\n    protected PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy;\n\n    protected PreferenceScopeFactory scopeFactory;\n\n    protected PreferenceStoreImpl() {\n    }\n\n    PreferenceStoreImpl(final PreferenceStorage storage,\n                        final PreferenceScopeFactory scopeFactory,\n                        final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy) {\n        this.storage = storage;\n        this.scopeFactory = scopeFactory;\n        this.defaultScopeResolutionStrategy = defaultScopeResolutionStrategy;\n    }\n\n    @Inject\n    public PreferenceStoreImpl(final PreferenceStorage storage,\n                               final PreferenceScopeFactory scopeFactory,\n                               @Customizable final PreferenceScopeResolutionStrategy defaultScopeResolutionStrategy,\n                               final Instance<PreferenceScopeResolutionStrategy> preferenceScopeResolutionStrategy,\n                               final InjectionPoint ip) {\n        this.storage = storage;\n        this.scopeFactory = scopeFactory;\n\n        if (preferenceScopeResolutionStrategy.isUnsatisfied()) {\n            if (ip != null) {\n                String componentKey = null;\n                Annotation annotation = ip.getAnnotated().getAnnotation(ComponentKey.class);\n                if (annotation != null) {\n                    componentKey = ((ComponentKey) annotation).value();\n                }\n\n                this.defaultScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                                                   componentKey);\n            } else {\n                this.defaultScopeResolutionStrategy = defaultScopeResolutionStrategy;\n            }\n        } else {\n            this.defaultScopeResolutionStrategy = preferenceScopeResolutionStrategy.get();\n        }\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo getDefaultScopeResolutionStrategyInfo() {\n        return defaultScopeResolutionStrategy.getInfo();\n    }\n\n    @Override\n    public PreferenceScopeResolver getDefaultScopeResolver() {\n        return defaultScopeResolutionStrategy.getScopeResolver();\n    }\n\n    @Override\n    public <T> void put(final PreferenceScope scope,\n                        final String key,\n                        final T value) {\n        storage.write(scope,\n                      key,\n                      value);\n    }\n\n    @Override\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T value) {\n        put(scopeResolutionStrategyInfo.defaultScope(),\n            key,\n            value);\n    }\n\n    @Override\n    public <T> void put(final String key,\n                        final T value) {\n        put(defaultScopeResolutionStrategy.getInfo(),\n            key,\n            value);\n    }\n\n    @Override\n    public <T> void put(final PreferenceScope scope,\n                        final Map<String, T> valueByKey) {\n        valueByKey.forEach((key, value) -> put(scope,\n                                               key,\n                                               value));\n    }\n\n    @Override\n    public <T> void put(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final Map<String, T> valueByKey) {\n        put(scopeResolutionStrategyInfo.defaultScope(),\n            valueByKey);\n    }\n\n    @Override\n    public <T> void put(final Map<String, T> valueByKey) {\n        put(defaultScopeResolutionStrategy.getInfo(),\n            valueByKey);\n    }\n\n    @Override\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final String key,\n                                final T value) {\n        if (!storage.exists(scope,\n                            key)) {\n            put(scope,\n                key,\n                value);\n        }\n    }\n\n    @Override\n    public <T> void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final String key,\n                                final T value) {\n        putIfAbsent(scopeResolutionStrategyInfo.defaultScope(),\n                    key,\n                    value);\n    }\n\n    @Override\n    public <T> void putIfAbsent(final String key,\n                                final T value) {\n        putIfAbsent(defaultScopeResolutionStrategy.getInfo(),\n                    key,\n                    value);\n    }\n\n    @Override\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final Map<String, T> valueByKey) {\n        valueByKey.forEach((key, value) -> putIfAbsent(scope,\n                                                       key,\n                                                       value));\n    }\n\n    @Override\n    public <T> void putIfAbsent(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final Map<String, T> valueByKey) {\n        putIfAbsent(scopeResolutionStrategyInfo.defaultScope(),\n                    valueByKey);\n    }\n\n    @Override\n    public <T> void putIfAbsent(final Map<String, T> valueByKey) {\n        putIfAbsent(defaultScopeResolutionStrategy.getInfo(),\n                    valueByKey);\n    }\n\n    @Override\n    public <T> T get(final PreferenceScope scope,\n                     final String key) {\n        return storage.read(scope,\n                            key);\n    }\n\n    @Override\n    public <T> T get(final PreferenceScope scope,\n                     final String key,\n                     final T defaultValue) {\n        T value = get(scope,\n                      key);\n        return value != null ? value : defaultValue;\n    }\n\n    @Override\n    public <T> T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                     final String key) {\n        return storage.read(scopeResolutionStrategyInfo,\n                            key);\n    }\n\n    @Override\n    public <T> T get(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                     final String key,\n                     final T defaultValue) {\n        T value = get(scopeResolutionStrategyInfo,\n                      key);\n        return value != null ? value : defaultValue;\n    }\n\n    @Override\n    public <T> T get(final String key) {\n        return get(defaultScopeResolutionStrategy.getInfo(),\n                   key);\n    }\n\n    @Override\n    public <T> T get(final String key,\n                     final T defaultValue) {\n        return get(defaultScopeResolutionStrategy.getInfo(),\n                   key,\n                   defaultValue);\n    }\n\n    @Override\n    public <T> PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                  final String key) {\n        return storage.readWithScope(scopeResolutionStrategyInfo,\n                                     key);\n    }\n\n    @Override\n    public <T> PreferenceScopedValue<T> getScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                  final String key,\n                                                  final T defaultValue) {\n        PreferenceScopedValue<T> value = getScoped(scopeResolutionStrategyInfo,\n                                                   key);\n        return value != null ? value : new PreferenceScopedValue<>(defaultValue,\n                                                                   null);\n    }\n\n    @Override\n    public <T> PreferenceScopedValue<T> getScoped(final String key) {\n        return getScoped(defaultScopeResolutionStrategy.getInfo(),\n                         key);\n    }\n\n    @Override\n    public <T> PreferenceScopedValue<T> getScoped(final String key,\n                                                  final T defaultValue) {\n        return getScoped(defaultScopeResolutionStrategy.getInfo(),\n                         key,\n                         defaultValue);\n    }\n\n    @Override\n    public Map<String, Object> search(final PreferenceScope scope,\n                                      final Collection<String> keys) {\n        if (keys == null) {\n            return all(scope);\n        }\n\n        Map<String, Object> map = new HashMap<>();\n        keys.forEach(key -> map.put(key,\n                                    storage.read(scope,\n                                                 key)));\n\n        return map;\n    }\n\n    @Override\n    public Map<String, Object> search(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                      final Collection<String> keys) {\n        if (keys == null) {\n            return all(scopeResolutionStrategyInfo);\n        }\n\n        Map<String, Object> map = new HashMap<>();\n        keys.forEach(key -> map.put(key,\n                                    storage.read(scopeResolutionStrategyInfo,\n                                                 key)));\n\n        return map;\n    }\n\n    @Override\n    public Map<String, Object> search(final Collection<String> keys) {\n        return search(defaultScopeResolutionStrategy.getInfo(),\n                      keys);\n    }\n\n    @Override\n    public Map<String, PreferenceScopedValue<Object>> searchScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                   final Collection<String> keys) {\n        if (keys == null) {\n            return allScoped(scopeResolutionStrategyInfo);\n        }\n\n        Map<String, PreferenceScopedValue<Object>> map = new HashMap<>();\n        keys.forEach(key -> map.put(key,\n                                    storage.readWithScope(scopeResolutionStrategyInfo,\n                                                          key)));\n\n        return map;\n    }\n\n    @Override\n    public Map<String, PreferenceScopedValue<Object>> searchScoped(final Collection<String> keys) {\n        return searchScoped(defaultScopeResolutionStrategy.getInfo(),\n                            keys);\n    }\n\n    @Override\n    public Map<String, Object> all(final PreferenceScope scope) {\n        return search(scope,\n                      storage.allKeys(scope));\n    }\n\n    @Override\n    public Map<String, Object> all(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        return search(storage.allKeys(scopeResolutionStrategyInfo.order()));\n    }\n\n    @Override\n    public Map<String, Object> all() {\n        return all(defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public Map<String, PreferenceScopedValue<Object>> allScoped(PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        return searchScoped(scopeResolutionStrategyInfo,\n                            storage.allKeys(scopeResolutionStrategyInfo.order()));\n    }\n\n    @Override\n    public Map<String, PreferenceScopedValue<Object>> allScoped() {\n        return allScoped(defaultScopeResolutionStrategy.getInfo());\n    }\n\n    @Override\n    public void remove(final PreferenceScope scope,\n                       final String key) {\n        storage.delete(scope,\n                       key);\n    }\n\n    @Override\n    public void remove(final List<PreferenceScope> scopes,\n                       final String key) {\n        scopes.forEach(scope -> remove(scope,\n                                       key));\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/ServerUsernameProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.rpc.SessionInfo;\n\n@Dependent\npublic class ServerUsernameProvider implements UsernameProvider {\n\n    private SessionInfo sessionInfo;\n\n    public ServerUsernameProvider() {\n    }\n\n    @Inject\n    public ServerUsernameProvider(final SessionInfo sessionInfo) {\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public String get() {\n        try {\n            return sessionInfo.getIdentity().getIdentifier();\n        } catch (Exception e) {\n            return \"not-logged-user\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/java/org/uberfire/preferences/backend/annotations/ComponentKey.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n/**\n * Qualifies PreferenceScope beans injections (on both client and server side). It is used to specify\n * the component scope in which the preferences will be managed.\n */\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface ComponentKey {\n\n    /**\n     * This parameter specify the key for the COMPONENT scope.\n     */\n    String value() default \"\";\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/CustomObject.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CustomObject {\n\n    Long id;\n    String text;\n\n    public CustomObject() {\n    }\n\n    public CustomObject(final Long id,\n                        final String text) {\n        this.id = id;\n        this.text = text;\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/InvalidDefaultPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"InvalidDefaultPreference\")\npublic class InvalidDefaultPreference implements BasePreference<InvalidDefaultPreference> {\n\n    @Property\n    String text;\n\n    @Override\n    public InvalidDefaultPreference defaultValue(final InvalidDefaultPreference defaultValue) {\n        return new InvalidDefaultPreference();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/MyInnerPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MyInnerPreference\",\n        bundleKey = \"MyInnerPreference.Label\")\npublic class MyInnerPreference implements BasePreference<MyInnerPreference> {\n\n    @Property(bundleKey = \"MyInnerPreference.Text\")\n    String text;\n\n    public String getText() {\n        return text;\n    }\n\n    public void setText(final String text) {\n        this.text = text;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/MyInnerPreference2.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MyInnerPreference2\",\n        bundleKey = \"MyInnerPreference2.Label\")\npublic class MyInnerPreference2 implements BasePreference<MyInnerPreference2> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/MyPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.PropertyFormOptions;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.impl.validation.NotEmptyValidator;\n\n@WorkbenchPreference(identifier = \"MyPreference\",\n        bundleKey = \"MyPreference.Label\")\npublic class MyPreference implements BasePreference<MyPreference> {\n\n    @Property(bundleKey = \"MyPreference.Text\",\n            helpBundleKey = \"MyPreference.Text.Help\",\n            validators = NotEmptyValidator.class,\n            formOptions = PropertyFormOptions.DISABLED)\n    String text;\n\n    @Property(formType = PropertyFormType.BOOLEAN, bundleKey = \"MyPreference.SendReports\")\n    boolean sendReports;\n\n    @Property(formType = PropertyFormType.COLOR, bundleKey = \"MyPreference.BackgroundColor\")\n    String backgroundColor;\n\n    @Property(formType = PropertyFormType.NATURAL_NUMBER, bundleKey = \"MyPreference.Age\")\n    int age;\n\n    @Property(formType = PropertyFormType.SECRET_TEXT, bundleKey = \"MyPreference.Password\")\n    String password;\n\n    @Property(bundleKey = \"MyPreference.MyInnerPreference\")\n    MyInnerPreference myInnerPreference;\n\n    @Property(shared = true, bundleKey = \"MyPreference.MySharedPreference\")\n    MySharedPreference mySharedPreference;\n\n    @Override\n    public MyPreference defaultValue(final MyPreference defaultValue) {\n        defaultValue.text = \"text\";\n        defaultValue.sendReports = true;\n        defaultValue.backgroundColor = \"ABCDEF\";\n        defaultValue.age = 27;\n        defaultValue.password = \"password\";\n        defaultValue.myInnerPreference.text = \"text\";\n\n        return defaultValue;\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/MySharedPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MySharedPreference\",\n        bundleKey = \"MySharedPreference.Label\")\npublic class MySharedPreference implements BasePreference<MySharedPreference> {\n\n    @Property(bundleKey = \"MySharedPreference.Text\")\n    String text;\n\n    @Property(bundleKey = \"MySharedPreference.MyInnerPreference2\")\n    MyInnerPreference2 myInnerPreference2;\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/MySharedPreference2.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MySharedPreference2\",\n        parents = \"MyInnerPreference2\",\n        bundleKey = \"MySharedPreference2.Label\")\npublic class MySharedPreference2 implements BasePreference<MySharedPreference2> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/PreferenceBeanStoreImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceStore;\nimport org.uberfire.preferences.shared.PropertyFormOptions;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceHierarchyElement;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class PreferenceBeanStoreImplTest {\n\n    private PreferenceStore preferenceStore;\n\n    private PreferenceBeanStoreImpl preferenceBeanStoreImpl;\n\n    private PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy;\n\n    private PreferenceScopeResolutionStrategyInfo scopeInfo;\n\n    private PreferenceScope lastScope;\n\n    @Before\n    public void setup() {\n        preferenceScopeResolutionStrategy = mock(PreferenceScopeResolutionStrategy.class);\n        preferenceStore = mock(PreferenceStore.class);\n        preferenceBeanStoreImpl = spy(new PreferenceBeanStoreImpl(preferenceStore,\n                                                                  preferenceScopeResolutionStrategy,\n                                                                  null));\n\n        lastScope = mock(PreferenceScope.class);\n        scopeInfo = new PreferenceScopeResolutionStrategyInfo(Arrays.asList(lastScope),\n                                                              mock(PreferenceScope.class));\n        doReturn(scopeInfo).when(preferenceScopeResolutionStrategy).getInfo();\n\n        doAnswer(invocationOnMock -> {\n            Object[] args = invocationOnMock.getArguments();\n            Class<?> clazz = (Class<?>) args[0];\n            return getPortablePreferenceByClass(clazz);\n        }).when(preferenceBeanStoreImpl).lookupPortablePreference(any(Class.class));\n    }\n\n    @Test\n    public void loadTest() {\n        MyPreference myPreference = new MyPreferencePortableGeneratedImpl();\n        MySharedPreference mySharedPreference = new MySharedPreferencePortableGeneratedImpl();\n        MySharedPreference2 mySharedPreference2 = new MySharedPreference2PortableGeneratedImpl();\n\n        doReturn(myPreference).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                         eq(MyPreference.class.getSimpleName()));\n        doReturn(mySharedPreference).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                               eq(MySharedPreference.class.getSimpleName()));\n        doReturn(mySharedPreference2).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                                eq(MySharedPreference2.class.getSimpleName()));\n\n        final MyPreferencePortableGeneratedImpl loadedMyPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl());\n        final MySharedPreference2PortableGeneratedImpl loadedMySharedPreference2 = preferenceBeanStoreImpl.load(new MySharedPreference2PortableGeneratedImpl());\n\n        verify(preferenceStore,\n               times(3)).get(eq(scopeInfo),\n                             anyString());\n\n        verify(preferenceStore).get(scopeInfo,\n                                    MyPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeInfo,\n                                    MySharedPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeInfo,\n                                    MySharedPreference2.class.getSimpleName());\n\n        assertEquals(myPreference,\n                     loadedMyPreference);\n        assertEquals(mySharedPreference,\n                     loadedMyPreference.mySharedPreference);\n        assertEquals(mySharedPreference2,\n                     loadedMySharedPreference2);\n    }\n\n    @Test\n    public void loadDefaultValueTest() {\n        MyPreference myPreference = new MyPreferencePortableGeneratedImpl();\n        myPreference = myPreference.defaultValue(myPreference);\n\n        MySharedPreference mySharedPreference = new MySharedPreferencePortableGeneratedImpl();\n        MySharedPreference2 mySharedPreference2 = new MySharedPreference2PortableGeneratedImpl();\n\n        final MyPreferencePortableGeneratedImpl loadedMyPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl());\n        final MySharedPreference2PortableGeneratedImpl loadedMySharedPreference2 = preferenceBeanStoreImpl.load(new MySharedPreference2PortableGeneratedImpl());\n\n        verify(preferenceStore,\n               times(3)).get(eq(scopeInfo),\n                             anyString());\n\n        verify(preferenceStore).get(scopeInfo,\n                                    MyPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeInfo,\n                                    MySharedPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeInfo,\n                                    MySharedPreference2.class.getSimpleName());\n\n        assertEquals(myPreference,\n                     loadedMyPreference);\n        assertEquals(mySharedPreference,\n                     loadedMyPreference.mySharedPreference);\n        assertEquals(mySharedPreference2,\n                     loadedMySharedPreference2);\n    }\n\n    @Test\n    public void loadWithCustomResolutionStrategyScopeTest() {\n        MyPreference myPreference = new MyPreferencePortableGeneratedImpl();\n        MySharedPreference mySharedPreference = new MySharedPreferencePortableGeneratedImpl();\n        MySharedPreference2 mySharedPreference2 = new MySharedPreference2PortableGeneratedImpl();\n\n        doReturn(myPreference).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                         eq(MyPreference.class.getSimpleName()));\n        doReturn(mySharedPreference).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                               eq(MySharedPreference.class.getSimpleName()));\n        doReturn(mySharedPreference2).when(preferenceStore).get(any(PreferenceScopeResolutionStrategyInfo.class),\n                                                                eq(MySharedPreference2.class.getSimpleName()));\n\n        PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = new PreferenceScopeResolutionStrategyInfo(new ArrayList<>(),\n                                                                                                                      mock(PreferenceScope.class));\n\n        final MyPreferencePortableGeneratedImpl loadedMyPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl(),\n                                                                                                  scopeResolutionStrategyInfo);\n        final MySharedPreference2PortableGeneratedImpl loadedMySharedPreference2 = preferenceBeanStoreImpl.load(new MySharedPreference2PortableGeneratedImpl(),\n                                                                                                                scopeResolutionStrategyInfo);\n\n        verify(preferenceStore,\n               times(3)).get(eq(scopeResolutionStrategyInfo),\n                             anyString());\n\n        verify(preferenceStore).get(scopeResolutionStrategyInfo,\n                                    MyPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeResolutionStrategyInfo,\n                                    MySharedPreference.class.getSimpleName());\n        verify(preferenceStore).get(scopeResolutionStrategyInfo,\n                                    MySharedPreference2.class.getSimpleName());\n\n        assertEquals(myPreference,\n                     loadedMyPreference);\n        assertEquals(mySharedPreference,\n                     loadedMyPreference.mySharedPreference);\n        assertEquals(mySharedPreference2,\n                     loadedMySharedPreference2);\n    }\n\n    @Test\n    public void saveTest() {\n        final MyPreferencePortableGeneratedImpl myPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl());\n\n        preferenceBeanStoreImpl.save(myPreference);\n\n        verify(preferenceStore,\n               times(2)).put(any(PreferenceScope.class),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(eq(scopeInfo.defaultScope()),\n                                    eq(MyPreference.class.getSimpleName()),\n                                    eq(myPreference));\n        verify(preferenceStore).put(eq(scopeInfo.defaultScope()),\n                                    eq(MySharedPreference.class.getSimpleName()),\n                                    eq(myPreference.mySharedPreference));\n    }\n\n    @Test\n    public void saveWithCustomResolutionStrategyScopeTest() {\n        PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = new PreferenceScopeResolutionStrategyInfo(new ArrayList<>(),\n                                                                                                                      mock(PreferenceScope.class));\n\n        final MyPreferencePortableGeneratedImpl myPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl(),\n                                                                                            scopeResolutionStrategyInfo);\n\n        preferenceBeanStoreImpl.save(myPreference,\n                                     scopeResolutionStrategyInfo);\n\n        verify(preferenceStore,\n               times(2)).put(same(scopeResolutionStrategyInfo.defaultScope()),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(same(scopeResolutionStrategyInfo.defaultScope()),\n                                    eq(MyPreference.class.getSimpleName()),\n                                    eq(myPreference));\n        verify(preferenceStore).put(same(scopeResolutionStrategyInfo.defaultScope()),\n                                    eq(MySharedPreference.class.getSimpleName()),\n                                    eq(myPreference.mySharedPreference));\n    }\n\n    @Test\n    public void saveWithCustomScopeTest() {\n        final PreferenceScope scope = mock(PreferenceScope.class);\n        PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = new PreferenceScopeResolutionStrategyInfo(new ArrayList<>(),\n                                                                                                                      mock(PreferenceScope.class));\n\n        final MyPreferencePortableGeneratedImpl myPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl(),\n                                                                                            scopeResolutionStrategyInfo);\n\n        preferenceBeanStoreImpl.save(myPreference,\n                                     scope);\n\n        verify(preferenceStore,\n               times(2)).put(same(scope),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(same(scope),\n                                    eq(MyPreference.class.getSimpleName()),\n                                    eq(myPreference));\n        verify(preferenceStore).put(same(scope),\n                                    eq(MySharedPreference.class.getSimpleName()),\n                                    eq(myPreference.mySharedPreference));\n    }\n\n    @Test\n    public void saveCollectionTest() {\n        final List<BasePreferencePortable<? extends BasePreference<?>>> preferencesToSave = getRootPortablePreferences();\n        final MyPreference myPreference = (MyPreference) preferencesToSave.get(0);\n        final MySharedPreference2 mySharedPreference2 = (MySharedPreference2) preferencesToSave.get(1);\n\n        preferenceBeanStoreImpl.save(preferencesToSave);\n\n        verify(preferenceStore,\n               times(2)).put(eq(scopeInfo.defaultScope()),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(scopeInfo.defaultScope(),\n                                    MyPreference.class.getSimpleName(),\n                                    myPreference);\n        verify(preferenceStore).put(scopeInfo.defaultScope(),\n                                    MySharedPreference.class.getSimpleName(),\n                                    myPreference.mySharedPreference);\n        verify(preferenceStore,\n               never()).put(eq(scopeInfo.defaultScope()),\n                            eq(MySharedPreference2.class.getSimpleName()),\n                            same(mySharedPreference2));\n    }\n\n    @Test\n    public void saveCollectionWithCustomResolutionStrategyScopeTest() {\n        PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = new PreferenceScopeResolutionStrategyInfo(new ArrayList<>(),\n                                                                                                                      mock(PreferenceScope.class));\n\n        final List<BasePreferencePortable<? extends BasePreference<?>>> preferencesToSave = getRootPortablePreferences();\n        final MyPreference myPreference = (MyPreference) preferencesToSave.get(0);\n        final MySharedPreference2 mySharedPreference2 = (MySharedPreference2) preferencesToSave.get(1);\n\n        preferenceBeanStoreImpl.save(preferencesToSave,\n                                     scopeResolutionStrategyInfo);\n\n        verify(preferenceStore,\n               times(2)).put(eq(scopeResolutionStrategyInfo.defaultScope()),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(scopeResolutionStrategyInfo.defaultScope(),\n                                    MyPreference.class.getSimpleName(),\n                                    myPreference);\n        verify(preferenceStore).put(scopeResolutionStrategyInfo.defaultScope(),\n                                    MySharedPreference.class.getSimpleName(),\n                                    myPreference.mySharedPreference);\n        verify(preferenceStore,\n               never()).put(eq(scopeResolutionStrategyInfo.defaultScope()),\n                            eq(MySharedPreference2.class.getSimpleName()),\n                            same(mySharedPreference2));\n    }\n\n    @Test\n    public void saveCollectionWithCustomScopeTest() {\n        final PreferenceScope scope = mock(PreferenceScope.class);\n        PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = new PreferenceScopeResolutionStrategyInfo(new ArrayList<>(),\n                                                                                                                      mock(PreferenceScope.class));\n\n        final List<BasePreferencePortable<? extends BasePreference<?>>> preferencesToSave = getRootPortablePreferences();\n        final MyPreference myPreference = (MyPreference) preferencesToSave.get(0);\n        final MySharedPreference2 mySharedPreference2 = (MySharedPreference2) preferencesToSave.get(1);\n\n        preferenceBeanStoreImpl.save(preferencesToSave,\n                                     scope);\n\n        verify(preferenceStore,\n               times(2)).put(same(scope),\n                             anyString(),\n                             any(Object.class));\n\n        verify(preferenceStore).put(same(scope),\n                                    eq(MyPreference.class.getSimpleName()),\n                                    eq(myPreference));\n        verify(preferenceStore).put(same(scope),\n                                    eq(MySharedPreference.class.getSimpleName()),\n                                    eq(myPreference.mySharedPreference));\n        verify(preferenceStore,\n               never()).put(same(scope),\n                            eq(MySharedPreference2.class.getSimpleName()),\n                            same(mySharedPreference2));\n    }\n\n    @Test\n    public void buildHierarchyStructureTest() {\n        final List<BasePreferencePortable<? extends BasePreference<?>>> rootPreferences = getRootPortablePreferences();\n        final MyPreferencePortableGeneratedImpl myPreference = (MyPreferencePortableGeneratedImpl) rootPreferences.get(0);\n\n        doReturn(getPortablePreferences()).when(preferenceBeanStoreImpl).getPortablePreferences();\n\n        final PreferenceHierarchyElement<?> preferenceHierarchyElement = preferenceBeanStoreImpl.buildHierarchyStructureForPreference(myPreference.identifier());\n\n        final PreferenceHierarchyElement<?> firstElement = preferenceHierarchyElement;\n        assertEquals(myPreference.identifier(),\n                     firstElement.getPortablePreference().identifier());\n        assertTrue(firstElement.isRoot());\n        assertFalse(firstElement.isShared());\n        assertEquals(\"MyPreference.Text.Help\",\n                     firstElement.getHelpBundleKeyByProperty().get(\"text\"));\n        assertEquals(1,\n                     firstElement.getFormOptionsByProperty().get(\"text\").length);\n        assertEquals(PropertyFormOptions.DISABLED,\n                     firstElement.getFormOptionsByProperty().get(\"text\")[0]);\n        assertEquals(2,\n                     firstElement.getChildren().size());\n\n        final PreferenceHierarchyElement<?> firstElementFirstChild = firstElement.getChildren().get(0);\n        assertEquals(((MyInnerPreferencePortableGeneratedImpl) myPreference.myInnerPreference).identifier(),\n                     firstElementFirstChild.getPortablePreference().identifier());\n        assertFalse(firstElementFirstChild.isRoot());\n        assertFalse(firstElementFirstChild.isShared());\n        assertEquals(0,\n                     firstElementFirstChild.getChildren().size());\n\n        final PreferenceHierarchyElement<?> firstElementSecondChild = firstElement.getChildren().get(1);\n        assertEquals(((MySharedPreferencePortableGeneratedImpl) myPreference.mySharedPreference).identifier(),\n                     firstElementSecondChild.getPortablePreference().identifier());\n        assertFalse(firstElementSecondChild.isRoot());\n        assertTrue(firstElementSecondChild.isShared());\n        assertEquals(1,\n                     firstElementSecondChild.getChildren().size());\n\n        final PreferenceHierarchyElement<?> firstElementSecondChildFirstChild = firstElementSecondChild.getChildren().get(0);\n        assertEquals(((MyInnerPreference2PortableGeneratedImpl) myPreference.mySharedPreference.myInnerPreference2).identifier(),\n                     firstElementSecondChildFirstChild.getPortablePreference().identifier());\n        assertFalse(firstElementSecondChildFirstChild.isRoot());\n        assertFalse(firstElementSecondChildFirstChild.isShared());\n        assertEquals(1,\n                     firstElementSecondChildFirstChild.getChildren().size());\n\n        final PreferenceHierarchyElement<?> firstElementSecondChildFirstChildFirstChild = firstElementSecondChildFirstChild.getChildren().get(0);\n        assertEquals(\"MySharedPreference2\",\n                     firstElementSecondChildFirstChildFirstChild.getPortablePreference().identifier());\n        assertTrue(firstElementSecondChildFirstChildFirstChild.isRoot());\n        assertFalse(firstElementSecondChildFirstChildFirstChild.isShared());\n        assertEquals(0,\n                     firstElementSecondChildFirstChildFirstChild.getChildren().size());\n    }\n\n    private List<BasePreferencePortable<? extends BasePreference<?>>> getRootPortablePreferences() {\n        final MyPreferencePortableGeneratedImpl myPreference = preferenceBeanStoreImpl.load(new MyPreferencePortableGeneratedImpl());\n        final MySharedPreference2PortableGeneratedImpl mySharedPreference2 = preferenceBeanStoreImpl.load(new MySharedPreference2PortableGeneratedImpl());\n\n        List<BasePreferencePortable<? extends BasePreference<?>>> rootPreferences = new ArrayList<>();\n        rootPreferences.add(myPreference);\n        rootPreferences.add(mySharedPreference2);\n\n        return rootPreferences;\n    }\n\n    private List<BasePreferencePortable<?>> getPortablePreferences() {\n        List<BasePreferencePortable<?>> portablePreferences = new ArrayList<>();\n\n        portablePreferences.add(getPortablePreferenceByClass(MyPreference.class));\n        portablePreferences.add(getPortablePreferenceByClass(MyInnerPreference.class));\n        portablePreferences.add(getPortablePreferenceByClass(MyInnerPreference2.class));\n        portablePreferences.add(getPortablePreferenceByClass(MySharedPreference.class));\n        portablePreferences.add(getPortablePreferenceByClass(MySharedPreference2.class));\n\n        return portablePreferences;\n    }\n\n    private BasePreferencePortable<?> getPortablePreferenceByClass(final Class<?> clazz) {\n        if (MyPreference.class.equals(clazz)) {\n            return new MyPreferencePortableGeneratedImpl();\n        } else if (MyInnerPreference.class.equals(clazz)) {\n            return new MyInnerPreferencePortableGeneratedImpl();\n        } else if (MyInnerPreference2.class.equals(clazz)) {\n            return new MyInnerPreference2PortableGeneratedImpl();\n        } else if (MySharedPreference.class.equals(clazz)) {\n            return new MySharedPreferencePortableGeneratedImpl();\n        } else if (MySharedPreference2.class.equals(clazz)) {\n            return new MySharedPreference2PortableGeneratedImpl();\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/PreferenceStorageImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.Collection;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.backend.server.io.object.ObjectStorageImpl;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.event.PreferenceUpdatedEvent;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.DefaultScopes;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeFactoryImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.*;\n\npublic class PreferenceStorageImplTest {\n\n    private static final String allUsersScopeType = DefaultScopes.ALL_USERS.type();\n    private static final String entireApplicationScopeType = DefaultScopes.ENTIRE_APPLICATION.type();\n    private static final String userScopeType = DefaultScopes.USER.type();\n    private static final String allUsersScopeKey = allUsersScopeType;\n    private static final String entireApplicationScopeKey = entireApplicationScopeType;\n    private static final String userScopeKey = \"my-user\";\n    private static final PreferenceScopeImpl allUsersScope = new PreferenceScopeImpl(allUsersScopeType,\n                                                                                     allUsersScopeKey,\n                                                                                     null);\n    private static final PreferenceScopeImpl entireApplicationScope = new PreferenceScopeImpl(entireApplicationScopeType,\n                                                                                              entireApplicationScopeKey,\n                                                                                              null);\n    private static final PreferenceScopeImpl userScope = new PreferenceScopeImpl(userScopeType,\n                                                                                 userScopeKey,\n                                                                                 null);\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n    private PreferenceScope userEntireApplicationScope, allUsersEntireApplicationScope;\n\n    private PreferenceStorageImpl preferenceStorageServiceBackendImpl;\n\n    private PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo;\n\n    private PreferenceScopeFactoryImpl scopeFactory;\n\n    private PreferenceScopeTypes scopeTypes;\n\n    @Before\n    public void setup() throws IOException {\n        MappingContextSingleton.get();\n        fileSystemTestingUtils.setup();\n\n        final SessionInfo sessionInfo = mockSessionInfo();\n        final FileSystem fileSystem = mockFileSystem();\n        final IOService ioService = mockIoService(fileSystem);\n\n        ObjectStorage objectStorage = new ObjectStorageImpl(ioService);\n\n        scopeTypes = new DefaultPreferenceScopeTypes(new ServerUsernameProvider(sessionInfo));\n        scopeFactory = new PreferenceScopeFactoryImpl(scopeTypes);\n        scopeResolutionStrategyInfo = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                                   null).getInfo();\n        Event<PreferenceUpdatedEvent>  preferenceUpdatedEvent = mock(Event.class);\n        preferenceStorageServiceBackendImpl = new PreferenceStorageImpl(ioService,\n                                                                        sessionInfo,\n                                                                        scopeTypes,\n                                                                        scopeFactory,\n                                                                        objectStorage,\n                                                                        new SpacesAPIImpl(),\n                                                                        preferenceUpdatedEvent);\n        preferenceStorageServiceBackendImpl.init();\n\n        userEntireApplicationScope = scopeFactory.createScope(userScope,\n                                                              entireApplicationScope);\n        allUsersEntireApplicationScope = scopeFactory.createScope(allUsersScope,\n                                                                  entireApplicationScope);\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void unexistentPreferenceDoesNotExistsInAScopeTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n        final String key = \"my.preference.key\";\n\n        final boolean preferenceExists = preferenceStorageServiceBackendImpl.exists(scope,\n                                                                                    key);\n\n        assertFalse(preferenceExists);\n    }\n\n    @Test\n    public void preferenceExistsInAScopeTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n        final String key = \"my.preference.key\";\n        final long value = 23L;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  key,\n                                                  value);\n        final boolean preferenceExists = preferenceStorageServiceBackendImpl.exists(scope,\n                                                                                    key);\n\n        assertTrue(preferenceExists);\n    }\n\n    @Test\n    public void unexistentPreferenceDoesNotExistUsingScopeResolutionStrategyTest() {\n        final String key = \"my.preference.key\";\n\n        final boolean preferenceExists = preferenceStorageServiceBackendImpl.exists(scopeResolutionStrategyInfo,\n                                                                                    key);\n\n        assertFalse(preferenceExists);\n    }\n\n    @Test\n    public void userPreferenceExistsUsingScopeResolutionStrategyTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n        final String key = \"my.preference.key\";\n        final long value = 23L;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  key,\n                                                  value);\n        final boolean preferenceExists = preferenceStorageServiceBackendImpl.exists(scopeResolutionStrategyInfo,\n                                                                                    key);\n\n        assertTrue(preferenceExists);\n    }\n\n    @Test\n    public void globalPreferenceExistsUsingScopeResolutionStrategyTest() {\n        final PreferenceScope scope = allUsersEntireApplicationScope;\n        final String key = \"my.preference.key\";\n        final long value = 23L;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  key,\n                                                  value);\n        final boolean preferenceExists = preferenceStorageServiceBackendImpl.exists(scopeResolutionStrategyInfo,\n                                                                                    key);\n\n        assertTrue(preferenceExists);\n    }\n\n    @Test\n    public void writeReadLongTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  \"my.preference.key\",\n                                                  23L);\n        final long value = preferenceStorageServiceBackendImpl.read(scope,\n                                                                    \"my.preference.key\");\n\n        assertEquals(23,\n                     value);\n    }\n\n    @Test\n    public void writeReadStringTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  \"my.preference.key\",\n                                                  \"text\");\n        final String value = preferenceStorageServiceBackendImpl.read(scope,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"text\",\n                     value);\n    }\n\n    @Test\n    public void writeReadBooleanTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  \"my.preference.key.true\",\n                                                  true);\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  \"my.preference.key.false\",\n                                                  false);\n        final boolean value1 = preferenceStorageServiceBackendImpl.read(scope,\n                                                                        \"my.preference.key.true\");\n        final boolean value2 = preferenceStorageServiceBackendImpl.read(scope,\n                                                                        \"my.preference.key.false\");\n\n        assertEquals(true,\n                     value1);\n        assertEquals(false,\n                     value2);\n    }\n\n    @Test\n    public void writeReadCustomObjectTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n        CustomObject customObject = new CustomObject(61L,\n                                                     \"some text\");\n\n        preferenceStorageServiceBackendImpl.write(scope,\n                                                  \"my.preference.key\",\n                                                  customObject);\n        final CustomObject value = preferenceStorageServiceBackendImpl.read(scope,\n                                                                            \"my.preference.key\");\n\n        assertEquals(customObject.id,\n                     value.id);\n        assertEquals(customObject.text,\n                     value.text);\n    }\n\n    @Test\n    public void readNonexistentPreferenceFromSpecificScopeTest() {\n        final PreferenceScope scope = userEntireApplicationScope;\n\n        final String value = preferenceStorageServiceBackendImpl.read(scope,\n                                                                      \"my.nonexistent.preference.key\");\n\n        assertNull(value);\n    }\n\n    @Test\n    public void readNonexistentPreferenceWithResolutionStrategyTest() {\n        final String value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                                      \"my.nonexistent.preference.key\");\n\n        assertNull(value);\n    }\n\n    @Test\n    public void writeGlobalAndUserReadUserWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"user_value\");\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"global_value\");\n        final String value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"user_value\",\n                     value);\n    }\n\n    @Test\n    public void writeGlobalReadGlobalWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"global_value\");\n        final String value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"global_value\",\n                     value);\n    }\n\n    @Test\n    public void writeUserReadUserWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"user_value\");\n        final String value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"user_value\",\n                     value);\n    }\n\n    @Test\n    public void readFromSpecificScopeTest() {\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"value\");\n        final String value = preferenceStorageServiceBackendImpl.read(userEntireApplicationScope,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"value\",\n                     value);\n    }\n\n    @Test\n    public void readWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"value\");\n        final String value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                                      \"my.preference.key\");\n\n        assertEquals(\"value\",\n                     value);\n    }\n\n    @Test\n    public void writeGlobalAndUserReadWithScopeUserWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"user_value\");\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"global_value\");\n        final PreferenceScopedValue<String> scopedValue = preferenceStorageServiceBackendImpl.readWithScope(scopeResolutionStrategyInfo,\n                                                                                                            \"my.preference.key\");\n\n        assertEquals(\"user_value\",\n                     scopedValue.getValue());\n        assertEquals(userEntireApplicationScope.key(),\n                     scopedValue.getScope().key());\n    }\n\n    @Test\n    public void writeGlobalReadWithScopeGlobalWithResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"global_value\");\n        final PreferenceScopedValue<String> scopedValue = preferenceStorageServiceBackendImpl.readWithScope(scopeResolutionStrategyInfo,\n                                                                                                            \"my.preference.key\");\n\n        assertEquals(\"global_value\",\n                     scopedValue.getValue());\n        assertEquals(allUsersEntireApplicationScope.key(),\n                     scopedValue.getScope().key());\n    }\n\n    @Test\n    public void writeUserReadWithScopeUserUsingResolutionStrategyTest() {\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"user_value\");\n        final PreferenceScopedValue<String> scopedValue = preferenceStorageServiceBackendImpl.readWithScope(scopeResolutionStrategyInfo,\n                                                                                                            \"my.preference.key\");\n\n        assertEquals(\"user_value\",\n                     scopedValue.getValue());\n        assertEquals(userEntireApplicationScope.key(),\n                     scopedValue.getScope().key());\n    }\n\n    @Test\n    public void deleteFromUserTest() {\n        String value;\n\n        // create preference defined for global and user scopes\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"user_value\");\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.preference.key\",\n                                                  \"global_value\");\n        value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                         \"my.preference.key\");\n        assertEquals(\"user_value\",\n                     value);\n\n        // delete preference from user scope\n        preferenceStorageServiceBackendImpl.delete(userEntireApplicationScope,\n                                                   \"my.preference.key\");\n        value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                         \"my.preference.key\");\n        assertEquals(\"global_value\",\n                     value);\n\n        // delete preference from global scope\n        preferenceStorageServiceBackendImpl.delete(allUsersEntireApplicationScope,\n                                                   \"my.preference.key\");\n        value = preferenceStorageServiceBackendImpl.read(scopeResolutionStrategyInfo,\n                                                         \"my.preference.key\");\n        assertNull(value);\n    }\n\n    @Test\n    public void allKeysWithKeysTest() {\n        // global preferences\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.first.global.preference.key\",\n                                                  \"global_value1\");\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.second.global.preference.key\",\n                                                  \"global_value2\");\n        preferenceStorageServiceBackendImpl.write(allUsersEntireApplicationScope,\n                                                  \"my.third.global.preference.key\",\n                                                  \"global_value3\");\n\n        // user preferences\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.first.user.preference.key\",\n                                                  \"user_value1\");\n        preferenceStorageServiceBackendImpl.write(userEntireApplicationScope,\n                                                  \"my.second.user.preference.key\",\n                                                  \"user_value2\");\n\n        final Collection<String> globalKeys = preferenceStorageServiceBackendImpl.allKeys(allUsersEntireApplicationScope);\n        final Collection<String> userKeys = preferenceStorageServiceBackendImpl.allKeys(userEntireApplicationScope);\n\n        assertNotNull(globalKeys);\n        assertEquals(3,\n                     globalKeys.size());\n        assertTrue(globalKeys.contains(\"my.first.global.preference.key\"));\n        assertTrue(globalKeys.contains(\"my.second.global.preference.key\"));\n        assertTrue(globalKeys.contains(\"my.third.global.preference.key\"));\n\n        assertNotNull(userKeys);\n        assertEquals(2,\n                     userKeys.size());\n        assertTrue(userKeys.contains(\"my.first.user.preference.key\"));\n        assertTrue(userKeys.contains(\"my.second.user.preference.key\"));\n    }\n\n    @Test\n    public void allKeysWithNoKeysTest() {\n        final Collection<String> keys = preferenceStorageServiceBackendImpl.allKeys(allUsersEntireApplicationScope);\n\n        assertNotNull(keys);\n        assertEquals(\"There should not exist any keys.\",\n                     0,\n                     keys.size());\n    }\n\n    @Test\n    public void buildScopePathForAllUsersEntireApplicationScope() {\n        final String path = preferenceStorageServiceBackendImpl.buildScopePath(allUsersEntireApplicationScope);\n\n        assertEquals(\"/config/all-users/all-users/entire-application/entire-application/\",\n                     path);\n    }\n\n    @Test\n    public void buildScopePathForUserScope() {\n        final String path = preferenceStorageServiceBackendImpl.buildScopePath(userEntireApplicationScope);\n\n        assertEquals(\"/config/user/my-user/entire-application/entire-application/\",\n                     path);\n    }\n\n    @Test\n    public void buildStoragePathForUserScope() {\n        final String path = preferenceStorageServiceBackendImpl.buildScopedPreferencePath(userEntireApplicationScope,\n                                                                                          \"my.preference.key\");\n\n        assertEquals(\"/config/user/my-user/entire-application/entire-application/my.preference.key.preferences\",\n                     path);\n    }\n\n    @Test\n    public void buildStoragePathForGlobalScope() {\n        final String path = preferenceStorageServiceBackendImpl.buildScopedPreferencePath(allUsersEntireApplicationScope,\n                                                                                          \"my.preference.key\");\n\n        assertEquals(\"/config/all-users/all-users/entire-application/entire-application/my.preference.key.preferences\",\n                     path);\n    }\n\n    private SessionInfo mockSessionInfo() {\n        return new SessionInfoMock(userScopeKey);\n    }\n\n    private FileSystem mockFileSystem() {\n        return fileSystemTestingUtils.getFileSystem();\n    }\n\n    private IOService mockIoService(final FileSystem fileSystem) {\n        final IOService ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n        doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class),\n                                                           anyMap());\n\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/PreferenceStoreImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.marshalling.server.MappingContextSingleton;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.backend.server.io.object.ObjectStorageImpl;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScopeTypes;\nimport org.uberfire.preferences.shared.event.PreferenceUpdatedEvent;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeTypes;\nimport org.uberfire.preferences.shared.impl.DefaultScopes;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeFactoryImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeImpl;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\npublic class PreferenceStoreImplTest {\n\n    private static final String allUsersScopeType = DefaultScopes.ALL_USERS.type();\n    private static final String entireApplicationScopeType = DefaultScopes.ENTIRE_APPLICATION.type();\n    private static final String userScopeType = DefaultScopes.USER.type();\n\n    private static final String allUsersScopeKey = allUsersScopeType;\n    private static final String entireApplicationScopeKey = entireApplicationScopeType;\n    private static final String userScopeKey = \"my-user\";\n\n    private static final PreferenceScopeImpl allUsersScope = new PreferenceScopeImpl(allUsersScopeType,\n                                                                                     allUsersScopeKey,\n                                                                                     null);\n    private static final PreferenceScopeImpl entireApplicationScope = new PreferenceScopeImpl(entireApplicationScopeType,\n                                                                                              entireApplicationScopeKey,\n                                                                                              null);\n    private static final PreferenceScopeImpl userScope = new PreferenceScopeImpl(userScopeType,\n                                                                                 userScopeKey,\n                                                                                 null);\n    private static final String USER = userScopeKey;\n    private static final String KEY = \"my.preference.key\";\n    private static final String VALUE = \"value\";\n    private static final String DEFAULT_VALUE = \"defaultValue\";\n    private static final String FIRST_KEY = \"my.first.preference.key\";\n    private static final String FIRST_VALUE = \"value1\";\n    private static final String SECOND_KEY = \"my.second.preference.key\";\n    private static final String SECOND_VALUE = \"value2\";\n    private static final String THIRD_KEY = \"my.third.preference.key\";\n    private static final String THIRD_VALUE = \"value3\";\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n    private PreferenceScope userEntireApplicationScope, allUsersEntireApplication;\n    private ParameterizedCommand<String> callback;\n\n    private PreferenceScopeTypes scopeTypes;\n\n    private PreferenceScopeFactory scopeFactory;\n\n    private PreferenceStorageImpl storage;\n\n    private PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy;\n\n    private PreferenceScopeResolutionStrategyInfo preferenceScopeResolutionStrategyInfo;\n\n    private PreferenceStoreImpl preferenceStore;\n    \n    @Before\n    public void setup() throws IOException {\n        MappingContextSingleton.get();\n        fileSystemTestingUtils.setup();\n\n        callback = (ParameterizedCommand<String>) mock(ParameterizedCommand.class);\n\n        final SessionInfo sessionInfo = new SessionInfoMock(USER);\n        final FileSystem fileSystem = mockFileSystem();\n        final IOService ioService = mockIoService(fileSystem);\n\n        ObjectStorage objectStorage = new ObjectStorageImpl(ioService);\n        \n        Event<PreferenceUpdatedEvent> preferenceUpdatedEvent = mock(Event.class);\n\n        scopeTypes = new DefaultPreferenceScopeTypes(new ServerUsernameProvider(sessionInfo));\n        scopeFactory = new PreferenceScopeFactoryImpl(scopeTypes);\n        preferenceScopeResolutionStrategy = new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                                         null);\n        preferenceScopeResolutionStrategyInfo = preferenceScopeResolutionStrategy.getInfo();\n        storage = spy(new PreferenceStorageImpl(ioService,\n                                                sessionInfo,\n                                                scopeTypes,\n                                                scopeFactory,\n                                                objectStorage,\n                                                new SpacesAPIImpl(),\n                                                preferenceUpdatedEvent));\n        storage.init();\n\n        preferenceStore = spy(new PreferenceStoreImpl(storage,\n                                                      scopeFactory,\n                                                      preferenceScopeResolutionStrategy));\n\n        userEntireApplicationScope = scopeFactory.createScope(userScope,\n                                                              entireApplicationScope);\n        allUsersEntireApplication = scopeFactory.createScope(allUsersScope,\n                                                             entireApplicationScope);\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void putInScopeTest() {\n        preferenceStore.put(allUsersEntireApplication,\n                            KEY,\n                            VALUE);\n        preferenceStore.put(allUsersEntireApplication,\n                            KEY,\n                            VALUE);\n\n        verify(storage,\n               times(2)).write(allUsersEntireApplication,\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putInDefaultScopeOfAScopeResolutionStrategyTest() {\n        preferenceStore.put(preferenceScopeResolutionStrategyInfo,\n                            KEY,\n                            VALUE);\n        preferenceStore.put(preferenceScopeResolutionStrategyInfo,\n                            KEY,\n                            VALUE);\n\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putInDefaultScopeTest() {\n        preferenceStore.put(KEY,\n                            VALUE);\n        preferenceStore.put(KEY,\n                            VALUE);\n\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putMapInScopeTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.put(allUsersEntireApplication,\n                            preferences);\n        preferenceStore.put(allUsersEntireApplication,\n                            preferences);\n\n        verify(storage,\n               times(2)).write(allUsersEntireApplication,\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(2)).write(allUsersEntireApplication,\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void putMapInDefaultScopeOfAScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.put(preferenceScopeResolutionStrategyInfo,\n                            preferences);\n        preferenceStore.put(preferenceScopeResolutionStrategyInfo,\n                            preferences);\n\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void putMapInDefaultScopeTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.put(preferences);\n        preferenceStore.put(preferences);\n\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(2)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void putIfAbsentInScopeTest() {\n        preferenceStore.putIfAbsent(allUsersEntireApplication,\n                                    KEY,\n                                    VALUE);\n        preferenceStore.putIfAbsent(allUsersEntireApplication,\n                                    KEY,\n                                    VALUE);\n\n        verify(storage,\n               times(1)).write(allUsersEntireApplication,\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putIfAbsentInDefaultScopeOfAScopeResolutionStrategyTest() {\n        preferenceStore.putIfAbsent(preferenceScopeResolutionStrategyInfo,\n                                    KEY,\n                                    VALUE);\n        preferenceStore.putIfAbsent(preferenceScopeResolutionStrategyInfo,\n                                    KEY,\n                                    VALUE);\n\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putIfAbsentInDefaultScopeTest() {\n        preferenceStore.putIfAbsent(KEY,\n                                    VALUE);\n        preferenceStore.putIfAbsent(KEY,\n                                    VALUE);\n\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               KEY,\n                               VALUE);\n    }\n\n    @Test\n    public void putIfAbsentMapInScopeTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.putIfAbsent(allUsersEntireApplication,\n                                    preferences);\n        preferenceStore.putIfAbsent(allUsersEntireApplication,\n                                    preferences);\n\n        verify(storage,\n               times(1)).write(allUsersEntireApplication,\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(1)).write(allUsersEntireApplication,\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void putIfAbsentMapInDefaultScopeOfAScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.putIfAbsent(preferenceScopeResolutionStrategyInfo,\n                                    preferences);\n        preferenceStore.putIfAbsent(preferenceScopeResolutionStrategyInfo,\n                                    preferences);\n\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void putIfAbsentMapInDefaultScopeTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        preferenceStore.putIfAbsent(preferences);\n        preferenceStore.putIfAbsent(preferences);\n\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               FIRST_KEY,\n                               FIRST_VALUE);\n        verify(storage,\n               times(1)).write(preferenceScopeResolutionStrategyInfo.defaultScope(),\n                               SECOND_KEY,\n                               SECOND_VALUE);\n    }\n\n    @Test\n    public void getStringValueFromScopeWithoutDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final String value = preferenceStore.get(allUsersEntireApplication,\n                                                 KEY);\n\n        assertEquals(VALUE,\n                     value);\n\n        verify(storage).read(allUsersEntireApplication,\n                             KEY);\n    }\n\n    @Test\n    public void getNullValueFromScopeWithoutDefaultValueTest() {\n        final String value = preferenceStore.get(allUsersEntireApplication,\n                                                 KEY);\n\n        assertNull(value);\n\n        verify(storage).read(allUsersEntireApplication,\n                             KEY);\n    }\n\n    @Test\n    public void getStringValueFromScopeWithDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final String value = preferenceStore.get(allUsersEntireApplication,\n                                                 KEY,\n                                                 DEFAULT_VALUE);\n\n        assertEquals(VALUE,\n                     value);\n\n        verify(storage).read(allUsersEntireApplication,\n                             KEY);\n    }\n\n    @Test\n    public void getNullValueFromScopeWithDefaultValueTest() {\n        final String value = preferenceStore.get(allUsersEntireApplication,\n                                                 KEY,\n                                                 DEFAULT_VALUE);\n\n        assertEquals(DEFAULT_VALUE,\n                     value);\n\n        verify(storage).read(allUsersEntireApplication,\n                             KEY);\n    }\n\n    @Test\n    public void getStringValueFromScopeResolutionStrategyWithoutDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo,\n                                                 KEY);\n\n        assertEquals(VALUE,\n                     value);\n\n        verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                             KEY);\n    }\n\n    @Test\n    public void getNullValueFromScopeResolutionStrategyWithoutDefaultValueTest() {\n        final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo,\n                                                 KEY);\n\n        assertNull(value);\n\n        verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                             KEY);\n    }\n\n    @Test\n    public void getStringValueFromScopeResolutionStrategyWithDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo,\n                                                 KEY,\n                                                 DEFAULT_VALUE);\n\n        assertEquals(VALUE,\n                     value);\n\n        verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                             KEY);\n    }\n\n    @Test\n    public void getNullValueFromScopeResolutionStrategyWithDefaultValueTest() {\n        final String value = preferenceStore.get(preferenceScopeResolutionStrategyInfo,\n                                                 KEY,\n                                                 DEFAULT_VALUE);\n\n        assertEquals(DEFAULT_VALUE,\n                     value);\n\n        verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                             KEY);\n    }\n\n    @Test\n    public void getStringValueWithoutDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final String value = preferenceStore.get(KEY);\n\n        assertEquals(VALUE,\n                     value);\n    }\n\n    @Test\n    public void getNullValueWithoutDefaultValueTest() {\n        final String value = preferenceStore.get(KEY);\n\n        assertNull(value);\n\n        verify(storage).read(allUsersEntireApplication,\n                             KEY);\n    }\n\n    @Test\n    public void getScopedStringValueFromScopeResolutionStrategyWithoutDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(preferenceScopeResolutionStrategyInfo,\n                                                                                    KEY);\n        final PreferenceScope scope = preferenceScopeResolutionStrategyInfo.order().get(0);\n\n        assertEquals(VALUE,\n                     scopedValue.getValue());\n        assertEquals(scope.key(),\n                     scopedValue.getScope().key());\n        assertEquals(scope.type(),\n                     scopedValue.getScope().type());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedNullValueFromScopeResolutionStrategyWithoutDefaultValueTest() {\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(preferenceScopeResolutionStrategyInfo,\n                                                                                    KEY);\n\n        assertNull(scopedValue);\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedStringValueFromScopeResolutionStrategyWithDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(preferenceScopeResolutionStrategyInfo,\n                                                                                    KEY,\n                                                                                    DEFAULT_VALUE);\n        final PreferenceScope scope = preferenceScopeResolutionStrategyInfo.order().get(0);\n\n        assertEquals(VALUE,\n                     scopedValue.getValue());\n        assertEquals(scope.key(),\n                     scopedValue.getScope().key());\n        assertEquals(scope.type(),\n                     scopedValue.getScope().type());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedNullValueFromScopeResolutionStrategyWithDefaultValueTest() {\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(preferenceScopeResolutionStrategyInfo,\n                                                                                    KEY,\n                                                                                    DEFAULT_VALUE);\n\n        assertEquals(DEFAULT_VALUE,\n                     scopedValue.getValue());\n        assertNull(scopedValue.getScope());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedStringValueFromDefaultScopeResolutionStrategyWithoutDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(KEY);\n        final PreferenceScope scope = preferenceScopeResolutionStrategyInfo.order().get(0);\n\n        assertEquals(VALUE,\n                     scopedValue.getValue());\n        assertEquals(scope.key(),\n                     scopedValue.getScope().key());\n        assertEquals(scope.type(),\n                     scopedValue.getScope().type());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedNullValueFromDefaultScopeResolutionStrategyWithoutDefaultValueTest() {\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(KEY);\n\n        assertNull(scopedValue);\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedStringValueFromDefaultScopeResolutionStrategyWithDefaultValueTest() {\n        mockStorageRead(VALUE);\n\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(KEY,\n                                                                                    DEFAULT_VALUE);\n        final PreferenceScope scope = preferenceScopeResolutionStrategyInfo.order().get(0);\n\n        assertEquals(VALUE,\n                     scopedValue.getValue());\n        assertEquals(scope.key(),\n                     scopedValue.getScope().key());\n        assertEquals(scope.type(),\n                     scopedValue.getScope().type());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void getScopedNullValueFromDefaultScopeResolutionStrategyWithDefaultValueTest() {\n        final PreferenceScopedValue<String> scopedValue = preferenceStore.getScoped(KEY,\n                                                                                    DEFAULT_VALUE);\n\n        assertEquals(DEFAULT_VALUE,\n                     scopedValue.getValue());\n        assertNull(scopedValue.getScope());\n\n        verify(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                      KEY);\n    }\n\n    @Test\n    public void searchOnScopeTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            doReturn(preference.getValue()).when(storage).read(allUsersEntireApplication,\n                                                               preference.getKey());\n        }\n\n        final Map<String, Object> returnedPreferences = preferenceStore.search(allUsersEntireApplication,\n                                                                               preferences.keySet());\n\n        assertEquals(preferences.size(),\n                     returnedPreferences.size());\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            final String key = preference.getKey();\n            final String value = preference.getValue();\n\n            assertTrue(returnedPreferences.containsKey(key));\n            assertEquals(value,\n                         returnedPreferences.get(key));\n\n            verify(storage).read(allUsersEntireApplication,\n                                 key);\n        }\n    }\n\n    @Test\n    public void searchOnScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            doReturn(preference.getValue()).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                               preference.getKey());\n        }\n\n        final Map<String, Object> returnedPreferences = preferenceStore.search(preferenceScopeResolutionStrategyInfo,\n                                                                               preferences.keySet());\n\n        assertEquals(preferences.size(),\n                     returnedPreferences.size());\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            final String key = preference.getKey();\n            final String value = preference.getValue();\n\n            assertTrue(returnedPreferences.containsKey(key));\n            assertEquals(value,\n                         returnedPreferences.get(key));\n\n            verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                                 key);\n        }\n    }\n\n    @Test\n    public void searchOnDefaultScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            doReturn(preference.getValue()).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                               preference.getKey());\n        }\n\n        final Map<String, Object> returnedPreferences = preferenceStore.search(preferences.keySet());\n\n        assertEquals(preferences.size(),\n                     returnedPreferences.size());\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            final String key = preference.getKey();\n            final String value = preference.getValue();\n\n            assertTrue(returnedPreferences.containsKey(key));\n            assertEquals(value,\n                         returnedPreferences.get(key));\n\n            verify(storage).read(preferenceScopeResolutionStrategyInfo,\n                                 key);\n        }\n    }\n\n    @Test\n    public void searchScopedOnScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            doReturn(preference.getValue()).when(storage).read(preferenceScopeResolutionStrategyInfo.order().get(0),\n                                                               preference.getKey());\n        }\n\n        final Map<String, PreferenceScopedValue<Object>> returnedPreferences = preferenceStore.searchScoped(preferenceScopeResolutionStrategyInfo,\n                                                                                                            preferences.keySet());\n\n        assertEquals(preferences.size(),\n                     returnedPreferences.size());\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            final String key = preference.getKey();\n            final String value = preference.getValue();\n\n            assertTrue(returnedPreferences.containsKey(key));\n            assertEquals(value,\n                         returnedPreferences.get(key).getValue());\n            assertEquals(preferenceScopeResolutionStrategyInfo.order().get(0).type(),\n                         returnedPreferences.get(key).getScope().type());\n            assertEquals(preferenceScopeResolutionStrategyInfo.order().get(0).key(),\n                         returnedPreferences.get(key).getScope().key());\n\n            verify(storage).read(preferenceScopeResolutionStrategyInfo.order().get(0),\n                                 key);\n        }\n    }\n\n    @Test\n    public void searchScopedOnDefaultScopeResolutionStrategyTest() {\n        final Map<String, String> preferences = new HashMap<>();\n        preferences.put(FIRST_KEY,\n                        FIRST_VALUE);\n        preferences.put(SECOND_KEY,\n                        SECOND_VALUE);\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            doReturn(preference.getValue()).when(storage).read(preferenceScopeResolutionStrategyInfo.order().get(0),\n                                                               preference.getKey());\n        }\n\n        final Map<String, PreferenceScopedValue<Object>> returnedPreferences = preferenceStore.searchScoped(preferences.keySet());\n\n        assertEquals(preferences.size(),\n                     returnedPreferences.size());\n\n        for (Map.Entry<String, String> preference : preferences.entrySet()) {\n            final String key = preference.getKey();\n            final String value = preference.getValue();\n\n            assertTrue(returnedPreferences.containsKey(key));\n            assertEquals(value,\n                         returnedPreferences.get(key).getValue());\n            assertEquals(preferenceScopeResolutionStrategyInfo.order().get(0).type(),\n                         returnedPreferences.get(key).getScope().type());\n            assertEquals(preferenceScopeResolutionStrategyInfo.order().get(0).key(),\n                         returnedPreferences.get(key).getScope().key());\n\n            verify(storage).read(preferenceScopeResolutionStrategyInfo.order().get(0),\n                                 key);\n        }\n    }\n\n    @Test\n    public void allPreferencesByScopeTest() {\n        final PreferenceScope userScope = userEntireApplicationScope;\n        doReturn(FIRST_VALUE).when(storage).read(userScope,\n                                                 FIRST_KEY);\n        doReturn(SECOND_VALUE).when(storage).read(userScope,\n                                                  SECOND_KEY);\n\n        List<String> keys = new ArrayList<>(2);\n        keys.add(FIRST_KEY);\n        keys.add(SECOND_KEY);\n        doReturn(keys).when(storage).allKeys(userScope);\n\n        final Map<String, Object> valueByKey = preferenceStore.all(userScope);\n\n        assertNotNull(valueByKey);\n        assertEquals(2,\n                     valueByKey.size());\n\n        assertTrue(valueByKey.containsKey(FIRST_KEY));\n        assertTrue(valueByKey.containsKey(SECOND_KEY));\n\n        assertEquals(FIRST_VALUE,\n                     valueByKey.get(FIRST_KEY));\n        assertEquals(SECOND_VALUE,\n                     valueByKey.get(SECOND_KEY));\n    }\n\n    @Test\n    public void allPreferencesByScopeResolutionStrategyTest() {\n        doReturn(FIRST_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                 FIRST_KEY);\n        doReturn(SECOND_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                  SECOND_KEY);\n        doReturn(THIRD_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                 THIRD_KEY);\n\n        List<String> preferenceKeys = new ArrayList<>(3);\n        preferenceKeys.add(FIRST_KEY);\n        preferenceKeys.add(SECOND_KEY);\n        preferenceKeys.add(THIRD_KEY);\n        doReturn(preferenceKeys).when(storage).allKeys(preferenceScopeResolutionStrategyInfo.order());\n\n        Map<String, Object> valueByKey = preferenceStore.all(preferenceScopeResolutionStrategyInfo);\n\n        assertNotNull(valueByKey);\n        assertEquals(3,\n                     valueByKey.size());\n\n        assertTrue(valueByKey.containsKey(FIRST_KEY));\n        assertTrue(valueByKey.containsKey(SECOND_KEY));\n        assertTrue(valueByKey.containsKey(THIRD_KEY));\n\n        assertEquals(FIRST_VALUE,\n                     valueByKey.get(FIRST_KEY));\n        assertEquals(SECOND_VALUE,\n                     valueByKey.get(SECOND_KEY));\n        assertEquals(THIRD_VALUE,\n                     valueByKey.get(THIRD_KEY));\n    }\n\n    @Test\n    public void allPreferencesTest() {\n        doReturn(FIRST_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                 FIRST_KEY);\n        doReturn(SECOND_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                  SECOND_KEY);\n        doReturn(THIRD_VALUE).when(storage).read(preferenceScopeResolutionStrategyInfo,\n                                                 THIRD_KEY);\n\n        List<String> preferenceKeys = new ArrayList<>(3);\n        preferenceKeys.add(FIRST_KEY);\n        preferenceKeys.add(SECOND_KEY);\n        preferenceKeys.add(THIRD_KEY);\n        doReturn(preferenceKeys).when(storage).allKeys(preferenceScopeResolutionStrategyInfo.order());\n\n        Map<String, Object> valueByKey = preferenceStore.all();\n\n        assertNotNull(valueByKey);\n        assertEquals(3,\n                     valueByKey.size());\n\n        assertTrue(valueByKey.containsKey(FIRST_KEY));\n        assertTrue(valueByKey.containsKey(SECOND_KEY));\n        assertTrue(valueByKey.containsKey(THIRD_KEY));\n\n        assertEquals(FIRST_VALUE,\n                     valueByKey.get(FIRST_KEY));\n        assertEquals(SECOND_VALUE,\n                     valueByKey.get(SECOND_KEY));\n        assertEquals(THIRD_VALUE,\n                     valueByKey.get(THIRD_KEY));\n    }\n\n    @Test\n    public void allScopedPreferencesByScopeResolutionStrategyTest() {\n        doReturn(new PreferenceScopedValue<>(FIRST_VALUE,\n                                             allUsersEntireApplication)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                     FIRST_KEY);\n        doReturn(new PreferenceScopedValue<>(SECOND_VALUE,\n                                             allUsersEntireApplication)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                     SECOND_KEY);\n        doReturn(new PreferenceScopedValue<>(THIRD_VALUE,\n                                             userEntireApplicationScope)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                      THIRD_KEY);\n\n        List<String> preferenceKeys = new ArrayList<>(3);\n        preferenceKeys.add(FIRST_KEY);\n        preferenceKeys.add(SECOND_KEY);\n        preferenceKeys.add(THIRD_KEY);\n        doReturn(preferenceKeys).when(storage).allKeys(preferenceScopeResolutionStrategyInfo.order());\n\n        Map<String, PreferenceScopedValue<Object>> valueByKey = preferenceStore.allScoped(preferenceScopeResolutionStrategyInfo);\n\n        assertNotNull(valueByKey);\n        assertEquals(3,\n                     valueByKey.size());\n\n        assertTrue(valueByKey.containsKey(FIRST_KEY));\n        assertTrue(valueByKey.containsKey(SECOND_KEY));\n        assertTrue(valueByKey.containsKey(THIRD_KEY));\n\n        assertEquals(FIRST_VALUE,\n                     valueByKey.get(FIRST_KEY).getValue());\n        assertEquals(allUsersEntireApplication,\n                     valueByKey.get(FIRST_KEY).getScope());\n\n        assertEquals(SECOND_VALUE,\n                     valueByKey.get(SECOND_KEY).getValue());\n        assertEquals(allUsersEntireApplication,\n                     valueByKey.get(SECOND_KEY).getScope());\n\n        assertEquals(THIRD_VALUE,\n                     valueByKey.get(THIRD_KEY).getValue());\n        assertEquals(userEntireApplicationScope,\n                     valueByKey.get(THIRD_KEY).getScope());\n    }\n\n    @Test\n    public void allScopedPreferencesByDefaultScopeResolutionStrategyTest() {\n        doReturn(new PreferenceScopedValue<>(FIRST_VALUE,\n                                             allUsersEntireApplication)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                     FIRST_KEY);\n        doReturn(new PreferenceScopedValue<>(SECOND_VALUE,\n                                             allUsersEntireApplication)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                     SECOND_KEY);\n        doReturn(new PreferenceScopedValue<>(THIRD_VALUE,\n                                             userEntireApplicationScope)).when(storage).readWithScope(preferenceScopeResolutionStrategyInfo,\n                                                                                                      THIRD_KEY);\n\n        List<String> preferenceKeys = new ArrayList<>(3);\n        preferenceKeys.add(FIRST_KEY);\n        preferenceKeys.add(SECOND_KEY);\n        preferenceKeys.add(THIRD_KEY);\n        doReturn(preferenceKeys).when(storage).allKeys(preferenceScopeResolutionStrategyInfo.order());\n\n        Map<String, PreferenceScopedValue<Object>> valueByKey = preferenceStore.allScoped();\n\n        assertNotNull(valueByKey);\n        assertEquals(3,\n                     valueByKey.size());\n\n        assertTrue(valueByKey.containsKey(FIRST_KEY));\n        assertTrue(valueByKey.containsKey(SECOND_KEY));\n        assertTrue(valueByKey.containsKey(THIRD_KEY));\n\n        assertEquals(FIRST_VALUE,\n                     valueByKey.get(FIRST_KEY).getValue());\n        assertEquals(allUsersEntireApplication,\n                     valueByKey.get(FIRST_KEY).getScope());\n\n        assertEquals(SECOND_VALUE,\n                     valueByKey.get(SECOND_KEY).getValue());\n        assertEquals(allUsersEntireApplication,\n                     valueByKey.get(SECOND_KEY).getScope());\n\n        assertEquals(THIRD_VALUE,\n                     valueByKey.get(THIRD_KEY).getValue());\n        assertEquals(userEntireApplicationScope,\n                     valueByKey.get(THIRD_KEY).getScope());\n    }\n\n    @Test\n    public void removeByScopeTest() {\n        preferenceStore.remove(allUsersEntireApplication,\n                               KEY);\n\n        verify(storage).delete(allUsersEntireApplication,\n                               KEY);\n    }\n\n    @Test\n    public void removeByScopesTest() {\n        preferenceStore.remove(preferenceScopeResolutionStrategyInfo.order(),\n                               KEY);\n\n        verify(storage).delete(preferenceScopeResolutionStrategyInfo.order().get(0),\n                               KEY);\n        verify(storage).delete(preferenceScopeResolutionStrategyInfo.order().get(1),\n                               KEY);\n    }\n\n    private void mockStorageRead(final String value) {\n        doReturn(value).when(storage).read(any(PreferenceScope.class),\n                                           anyString());\n        doReturn(value).when(storage).read(any(PreferenceScopeResolutionStrategyInfo.class),\n                                           anyString());\n    }\n\n    private FileSystem mockFileSystem() {\n        return fileSystemTestingUtils.getFileSystem();\n    }\n\n    private IOService mockIoService(final FileSystem fileSystem) {\n        final IOService ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n        doReturn(fileSystem).when(ioService).newFileSystem(any(URI.class),\n                                                           anyMap());\n\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/java/org/uberfire/preferences/backend/ServerUsernameProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.backend;\n\nimport javax.enterprise.context.ContextNotActiveException;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ServerUsernameProviderTest {\n\n    private SessionInfo sessionInfo;\n\n    private ServerUsernameProvider serverUsernameProvider;\n\n    @Before\n    public void setup() {\n        sessionInfo = spy(new SessionInfoMock());\n        serverUsernameProvider = new ServerUsernameProvider(sessionInfo);\n    }\n\n    @Test\n    public void testLoggedUserName() {\n        final String username = serverUsernameProvider.get();\n\n        verify(sessionInfo).getIdentity();\n\n        assertEquals(sessionInfo.getIdentity().getIdentifier(),\n                     username);\n    }\n\n    @Test\n    public void testNotLoggedUserName() {\n        doThrow(new ContextNotActiveException()).when(sessionInfo).getIdentity();\n\n        final String username = serverUsernameProvider.get();\n\n        verify(sessionInfo).getIdentity();\n\n        assertEquals(\"not-logged-user\",\n                     username);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/.gitignore",
    "content": "*.class\n\n# Package Files #\n*.jar\n*.war\n*.ear\n/.metadata\n/target\n/local\n/bin\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Bitronix transactin logs\n*.tlog\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-preferences</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-preferences-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Preferences Client</name>\n  <description>Uberfire Preferences Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/annotations/ComponentKey.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Qualifies PreferenceScope beans injections (on both client and server side). It is used to specify\n * the component scope in which the preferences will be managed.\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface ComponentKey {\n\n    /**\n     * This parameter specify the key for the COMPONENT scope.\n     */\n    String value() default \"\";\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/scope/ClientUsernameProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.scope;\n\nimport javax.inject.Inject;\n\nimport org.uberfire.preferences.shared.UsernameProvider;\nimport org.uberfire.rpc.SessionInfo;\n\npublic class ClientUsernameProvider implements UsernameProvider {\n\n    private SessionInfo sessionInfo;\n\n    @Inject\n    public ClientUsernameProvider(final SessionInfo sessionInfo) {\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public String get() {\n        return sessionInfo.getIdentity().getIdentifier();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/scope/PreferenceScopeResolutionStrategyIOCProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.scope;\n\nimport java.lang.annotation.Annotation;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ContextualTypeProvider;\nimport org.jboss.errai.ioc.client.api.IOCProvider;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.preferences.client.utils.PreferenceQualifierUtils;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\n\n@IOCProvider\n@Dependent\npublic class PreferenceScopeResolutionStrategyIOCProvider implements ContextualTypeProvider<PreferenceScopeResolutionStrategy> {\n\n    @Inject\n    private ManagedInstance<PreferenceScopeResolutionStrategy> scopeResolutionStrategyProvider;\n\n    @Inject\n    private PreferenceScopeFactory scopeFactory;\n\n    @Override\n    public PreferenceScopeResolutionStrategy provide(final Class<?>[] typeargs,\n                                                     final Annotation[] qualifiers) {\n        if (this.scopeResolutionStrategyProvider.isUnsatisfied()) {\n            final String componentKey = PreferenceQualifierUtils.getComponentKeyIfExists(qualifiers);\n            return new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                componentKey);\n        }\n\n        return this.scopeResolutionStrategyProvider.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/store/PreferenceBeanStoreClientImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.util.Collection;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Client-only implementation for {@link PreferenceBeanStore}.\n */\n@Alternative\n@ApplicationScoped\npublic class PreferenceBeanStoreClientImpl implements PreferenceBeanStore {\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        // loads the default value, without a backend it won't consult the preference storage\n        successCallback.execute((T) emptyPortablePreference.defaultValue((U) emptyPortablePreference));\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        // loads the default value, without a backend it won't consult the preference storage\n        successCallback.execute((T) emptyPortablePreference.defaultValue((U) emptyPortablePreference));\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                        PreferenceScope scope,\n                                                                                        Command successCallback,\n                                                                                        ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n\n    @Override\n    public void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     PreferenceScope scope,\n                     Command successCallback,\n                     ParameterizedCommand<Throwable> errorCallback) {\n        // just call success callback because there's nothing to do, no backend means no save in our case\n        callSuccessCallback(successCallback);\n    }\n    \n    private void callSuccessCallback(final Command successCallback) {\n        if (successCallback != null) {\n            successCallback.execute();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/store/PreferenceStore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.PreferenceScopeResolver;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.preferences.shared.impl.PreferenceScopedValue;\n\n/**\n * Client store API for preferences. All client preference management should be made through this service\n * implementation (see {@link PreferenceStore}).\n * <p>\n * Each method from {@link PreferenceStore} has three corresponding methods here: one receives the\n * same parameters, another also receive a success callback and another that receives a success and an\n * error callback.\n * <p>\n * For more details on each method operation, you can check the\n * {@link org.uberfire.preferences.shared.PreferenceStore} documentation.\n */\npublic class PreferenceStore {\n\n    private String componentKey;\n\n    private Caller<org.uberfire.preferences.shared.PreferenceStore> preferenceStoreCaller;\n\n    private PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo;\n\n    private PreferenceScopeResolver scopeResolver;\n\n    public PreferenceStore(final String componentKey,\n                           final Caller<org.uberfire.preferences.shared.PreferenceStore> preferenceStoreCaller,\n                           final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                           final PreferenceScopeResolver scopeResolver) {\n        this.componentKey = componentKey;\n        this.preferenceStoreCaller = preferenceStoreCaller;\n        this.scopeResolutionStrategyInfo = scopeResolutionStrategyInfo;\n        this.scopeResolver = scopeResolver;\n    }\n\n    /**\n     * Provides a portable instance that has the scope resolution strategy order and the default scope\n     * for preference persistence.\n     * @return A portable scope information instance.\n     */\n    public PreferenceScopeResolutionStrategyInfo getDefaultScopeResolutionStrategyInfo() {\n        return scopeResolutionStrategyInfo;\n    }\n\n    /**\n     * Provides a portable instance that resolves scopes in the default scope resolution strategy order.\n     * @return A portable scope resolver instance.\n     */\n    public PreferenceScopeResolver getDefaultScopeResolver() {\n        return scopeResolver;\n    }\n\n    private <T> RemoteCallback<T> emptySuccessCallback() {\n        return result -> {\n        };\n    }\n\n    private ErrorCallback<Message> defaultErrorCallback() {\n        return ( message, throwable ) -> false;\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final String key,\n                        final T value) {\n        put(scope,\n            key,\n            value,\n            emptySuccessCallback());\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback) {\n        put(scope,\n            key,\n            value,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).put(scope,\n                                                      key,\n                                                      value);\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T value) {\n        put(scopeResolutionStrategyInfo,\n            key,\n            value,\n            emptySuccessCallback());\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback) {\n        put(scopeResolutionStrategyInfo,\n            key,\n            value,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).put(scopeResolutionStrategyInfo,\n                                                      key,\n                                                      value);\n    }\n\n    public <T> void put(final String key,\n                        final T value) {\n        put(scopeResolutionStrategyInfo,\n            key,\n            value);\n    }\n\n    public <T> void put(final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback) {\n        put(scopeResolutionStrategyInfo,\n            key,\n            value,\n            successCallback);\n    }\n\n    public <T> void put(final String key,\n                        final T value,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        put(scopeResolutionStrategyInfo,\n            key,\n            value,\n            successCallback,\n            errorCallback);\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final Map<String, T> valueByKey) {\n        put(scope,\n            valueByKey,\n            emptySuccessCallback());\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback) {\n        put(scope,\n            valueByKey,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void put(final PreferenceScope scope,\n                        final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).put(scope,\n                                                      valueByKey);\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final Map<String, T> valueByKey) {\n        put(scopeResolutionStrategyInfo,\n            valueByKey,\n            emptySuccessCallback());\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback) {\n        put(scopeResolutionStrategyInfo,\n            valueByKey,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void put(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).put(scopeResolutionStrategyInfo,\n                                                      valueByKey);\n    }\n\n    public <T> void put(final Map<String, T> valueByKey) {\n        put(scopeResolutionStrategyInfo,\n            valueByKey);\n    }\n\n    public <T> void put(final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback) {\n        put(scopeResolutionStrategyInfo,\n            valueByKey,\n            successCallback);\n    }\n\n    public <T> void put(final Map<String, T> valueByKey,\n                        final RemoteCallback<Void> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        put(scopeResolutionStrategyInfo,\n            valueByKey,\n            successCallback,\n            errorCallback);\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final String key,\n                                final T value) {\n        putIfAbsent(scope,\n                    key,\n                    value,\n                    emptySuccessCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scope,\n                    key,\n                    value,\n                    successCallback,\n                    defaultErrorCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).putIfAbsent(scope,\n                                                              key,\n                                                              value);\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final String key,\n                                final T value) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    key,\n                    value,\n                    emptySuccessCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    key,\n                    value,\n                    successCallback,\n                    defaultErrorCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).putIfAbsent(scopeResolutionStrategyInfo,\n                                                              key,\n                                                              value);\n    }\n\n    public <T> void putIfAbsent(final String key,\n                                final T value) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    key,\n                    value);\n    }\n\n    public <T> void putIfAbsent(final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    key,\n                    value,\n                    successCallback);\n    }\n\n    public <T> void putIfAbsent(final String key,\n                                final T value,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    key,\n                    value,\n                    successCallback,\n                    errorCallback);\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final Map<String, T> valueByKey) {\n        putIfAbsent(scope,\n                    valueByKey,\n                    emptySuccessCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scope,\n                    valueByKey,\n                    successCallback,\n                    defaultErrorCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScope scope,\n                                final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).putIfAbsent(scope,\n                                                              valueByKey);\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final Map<String, T> valueByKey) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    valueByKey,\n                    emptySuccessCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    valueByKey,\n                    successCallback,\n                    defaultErrorCallback());\n    }\n\n    public <T> void putIfAbsent(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).putIfAbsent(scopeResolutionStrategyInfo,\n                                                              valueByKey);\n    }\n\n    public <T> void putIfAbsent(final Map<String, T> valueByKey) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    valueByKey);\n    }\n\n    public <T> void putIfAbsent(final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    valueByKey,\n                    successCallback);\n    }\n\n    public <T> void putIfAbsent(final Map<String, T> valueByKey,\n                                final RemoteCallback<Void> successCallback,\n                                final ErrorCallback<Message> errorCallback) {\n        putIfAbsent(scopeResolutionStrategyInfo,\n                    valueByKey,\n                    successCallback,\n                    errorCallback);\n    }\n\n    public void get(final PreferenceScope scope,\n                    final String key) {\n        get(scope,\n            key,\n            emptySuccessCallback());\n    }\n\n    public <T> void get(final PreferenceScope scope,\n                        final String key,\n                        final RemoteCallback<T> successCallback) {\n        get(scope,\n            key,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void get(final PreferenceScope scope,\n                        final String key,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).get(scope,\n                                                      key);\n    }\n\n    public <T> void get(final PreferenceScope scope,\n                        final String key,\n                        final T defaultValue) {\n        get(scope,\n            key,\n            defaultValue,\n            emptySuccessCallback());\n    }\n\n    public <T> void get(final PreferenceScope scope,\n                        final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback) {\n        get(scope,\n            key,\n            defaultValue,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void get(final PreferenceScope scope,\n                        final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).get(scope,\n                                                      key,\n                                                      defaultValue);\n    }\n\n    public void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                    final String key) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            emptySuccessCallback());\n    }\n\n    public <T> void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final RemoteCallback<T> successCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).get(scopeResolutionStrategyInfo,\n                                                      key);\n    }\n\n    public <T> void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T defaultValue) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            defaultValue,\n            emptySuccessCallback());\n    }\n\n    public <T> void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            defaultValue,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public <T> void get(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                        final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).get(scopeResolutionStrategyInfo,\n                                                      key,\n                                                      defaultValue);\n    }\n\n    public void get(final String key) {\n        get(scopeResolutionStrategyInfo,\n            key);\n    }\n\n    public <T> void get(final String key,\n                        final RemoteCallback<T> successCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            successCallback);\n    }\n\n    public <T> void get(final String key,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            successCallback,\n            errorCallback);\n    }\n\n    public <T> void get(final String key,\n                        final T defaultValue) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            defaultValue);\n    }\n\n    public <T> void get(final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            defaultValue,\n            successCallback);\n    }\n\n    public <T> void get(final String key,\n                        final T defaultValue,\n                        final RemoteCallback<T> successCallback,\n                        final ErrorCallback<Message> errorCallback) {\n        get(scopeResolutionStrategyInfo,\n            key,\n            defaultValue,\n            successCallback,\n            errorCallback);\n    }\n\n    public void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                          final String key) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  emptySuccessCallback());\n    }\n\n    public <T> void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                              final String key,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  successCallback,\n                  defaultErrorCallback());\n    }\n\n    public <T> void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                              final String key,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback,\n                              final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).getScoped(scopeResolutionStrategyInfo,\n                                                            key);\n    }\n\n    public <T> void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                              final String key,\n                              final T defaultValue) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  defaultValue,\n                  emptySuccessCallback());\n    }\n\n    public <T> void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                              final String key,\n                              final T defaultValue,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  defaultValue,\n                  successCallback,\n                  defaultErrorCallback());\n    }\n\n    public <T> void getScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                              final String key,\n                              final T defaultValue,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback,\n                              final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).getScoped(scopeResolutionStrategyInfo,\n                                                            key,\n                                                            defaultValue);\n    }\n\n    public void getScoped(final String key) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key);\n    }\n\n    public <T> void getScoped(final String key,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  successCallback);\n    }\n\n    public <T> void getScoped(final String key,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback,\n                              final ErrorCallback<Message> errorCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  successCallback,\n                  errorCallback);\n    }\n\n    public <T> void getScoped(final String key,\n                              final T defaultValue) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  defaultValue);\n    }\n\n    public <T> void getScoped(final String key,\n                              final T defaultValue,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  defaultValue,\n                  successCallback);\n    }\n\n    public <T> void getScoped(final String key,\n                              final T defaultValue,\n                              final RemoteCallback<PreferenceScopedValue<T>> successCallback,\n                              final ErrorCallback<Message> errorCallback) {\n        getScoped(scopeResolutionStrategyInfo,\n                  key,\n                  defaultValue,\n                  successCallback,\n                  errorCallback);\n    }\n\n    public void search(final PreferenceScope scope,\n                       final Collection<String> keys) {\n        search(scope,\n               keys,\n               emptySuccessCallback());\n    }\n\n    public void search(final PreferenceScope scope,\n                       final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback) {\n        search(scope,\n               keys,\n               successCallback,\n               defaultErrorCallback());\n    }\n\n    public void search(final PreferenceScope scope,\n                       final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback,\n                       final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).search(scope,\n                                                         keys);\n    }\n\n    public void search(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                       final Collection<String> keys) {\n        search(scopeResolutionStrategyInfo,\n               keys,\n               emptySuccessCallback());\n    }\n\n    public void search(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                       final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback) {\n        search(scopeResolutionStrategyInfo,\n               keys,\n               successCallback,\n               defaultErrorCallback());\n    }\n\n    public void search(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                       final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback,\n                       final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).search(scopeResolutionStrategyInfo,\n                                                         keys);\n    }\n\n    public void search(final Collection<String> keys) {\n        search(scopeResolutionStrategyInfo,\n               keys);\n    }\n\n    public void search(final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback) {\n        search(scopeResolutionStrategyInfo,\n               keys,\n               successCallback);\n    }\n\n    public void search(final Collection<String> keys,\n                       final RemoteCallback<Map<String, Object>> successCallback,\n                       final ErrorCallback<Message> errorCallback) {\n        search(scopeResolutionStrategyInfo,\n               keys,\n               successCallback,\n               errorCallback);\n    }\n\n    public void searchScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                             final Collection<String> keys) {\n        searchScoped(scopeResolutionStrategyInfo,\n                     keys,\n                     emptySuccessCallback());\n    }\n\n    public void searchScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                             final Collection<String> keys,\n                             final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback) {\n        searchScoped(scopeResolutionStrategyInfo,\n                     keys,\n                     successCallback,\n                     defaultErrorCallback());\n    }\n\n    public void searchScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                             final Collection<String> keys,\n                             final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback,\n                             final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).searchScoped(scopeResolutionStrategyInfo,\n                                                               keys);\n    }\n\n    public void searchScoped(final Collection<String> keys) {\n        searchScoped(scopeResolutionStrategyInfo,\n                     keys);\n    }\n\n    public void searchScoped(final Collection<String> keys,\n                             final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback) {\n        searchScoped(scopeResolutionStrategyInfo,\n                     keys,\n                     successCallback);\n    }\n\n    public void searchScoped(final Collection<String> keys,\n                             final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback,\n                             final ErrorCallback<Message> errorCallback) {\n        searchScoped(scopeResolutionStrategyInfo,\n                     keys,\n                     successCallback,\n                     errorCallback);\n    }\n\n    public void all(final PreferenceScope scope) {\n        all(scope,\n            emptySuccessCallback());\n    }\n\n    public void all(final PreferenceScope scope,\n                    final RemoteCallback<Map<String, Object>> successCallback) {\n        all(scope,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public void all(final PreferenceScope scope,\n                    final RemoteCallback<Map<String, Object>> successCallback,\n                    final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).all(scope);\n    }\n\n    public void all(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        all(scopeResolutionStrategyInfo,\n            emptySuccessCallback());\n    }\n\n    public void all(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                    final RemoteCallback<Map<String, Object>> successCallback) {\n        all(scopeResolutionStrategyInfo,\n            successCallback,\n            defaultErrorCallback());\n    }\n\n    public void all(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                    final RemoteCallback<Map<String, Object>> successCallback,\n                    final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).all(scopeResolutionStrategyInfo);\n    }\n\n    public void all() {\n        all(scopeResolutionStrategyInfo);\n    }\n\n    public void all(final RemoteCallback<Map<String, Object>> successCallback) {\n        all(scopeResolutionStrategyInfo,\n            successCallback);\n    }\n\n    public void all(final RemoteCallback<Map<String, Object>> successCallback,\n                    final ErrorCallback<Message> errorCallback) {\n        all(scopeResolutionStrategyInfo,\n            successCallback,\n            errorCallback);\n    }\n\n    public void allScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo) {\n        allScoped(scopeResolutionStrategyInfo,\n                  emptySuccessCallback());\n    }\n\n    public void allScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                          final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback) {\n        allScoped(scopeResolutionStrategyInfo,\n                  successCallback,\n                  defaultErrorCallback());\n    }\n\n    public void allScoped(final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                          final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback,\n                          final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).allScoped(scopeResolutionStrategyInfo);\n    }\n\n    public void allScoped() {\n        allScoped(scopeResolutionStrategyInfo);\n    }\n\n    public void allScoped(final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback) {\n        allScoped(scopeResolutionStrategyInfo,\n                  successCallback);\n    }\n\n    public void allScoped(final RemoteCallback<Map<String, PreferenceScopedValue<Object>>> successCallback,\n                          final ErrorCallback<Message> errorCallback) {\n        allScoped(scopeResolutionStrategyInfo,\n                  successCallback,\n                  errorCallback);\n    }\n\n    public void remove(final PreferenceScope scope,\n                       final String key) {\n        remove(scope,\n               key,\n               emptySuccessCallback());\n    }\n\n    public void remove(final PreferenceScope scope,\n                       final String key,\n                       final RemoteCallback<Void> successCallback) {\n        remove(scope,\n               key,\n               successCallback,\n               defaultErrorCallback());\n    }\n\n    public void remove(final PreferenceScope scope,\n                       final String key,\n                       final RemoteCallback<Void> successCallback,\n                       final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).remove(scope,\n                                                         key);\n    }\n\n    public void remove(final List<PreferenceScope> scopes,\n                       final String key) {\n        remove(scopes,\n               key,\n               emptySuccessCallback());\n    }\n\n    public void remove(final List<PreferenceScope> scopes,\n                       final String key,\n                       final RemoteCallback<Void> successCallback) {\n        remove(scopes,\n               key,\n               successCallback,\n               defaultErrorCallback());\n    }\n\n    public void remove(final List<PreferenceScope> scopes,\n                       final String key,\n                       final RemoteCallback<Void> successCallback,\n                       final ErrorCallback<Message> errorCallback) {\n        preferenceStoreCaller.call(successCallback,\n                                   errorCallback).remove(scopes,\n                                                         key);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/store/PreferenceStoreIOCProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.lang.annotation.Annotation;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.ContextualTypeProvider;\nimport org.jboss.errai.ioc.client.api.IOCProvider;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.preferences.client.utils.PreferenceQualifierUtils;\nimport org.uberfire.preferences.shared.PreferenceScopeFactory;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.DefaultPreferenceScopeResolutionStrategy;\n\n@IOCProvider\n@Dependent\npublic class PreferenceStoreIOCProvider implements ContextualTypeProvider<PreferenceStore> {\n\n    @Inject\n    private ManagedInstance<PreferenceScopeResolutionStrategy> scopeResolutionStrategyProvider;\n\n    @Inject\n    private Caller<org.uberfire.preferences.shared.PreferenceStore> preferenceStoreCaller;\n\n    @Inject\n    private PreferenceScopeFactory scopeFactory;\n\n    @Override\n    public PreferenceStore provide(final Class<?>[] typeargs,\n                                   final Annotation[] qualifiers) {\n        final String componentKey = PreferenceQualifierUtils.getComponentKeyIfExists(qualifiers);\n        final PreferenceScopeResolutionStrategy scopeResolutionStrategy = getScopeResolutionStrategy(componentKey);\n\n        return new PreferenceStore(componentKey,\n                                   preferenceStoreCaller,\n                                   scopeResolutionStrategy.getInfo(),\n                                   scopeResolutionStrategy.getScopeResolver());\n    }\n\n    private PreferenceScopeResolutionStrategy getScopeResolutionStrategy(final String componentKey) {\n        if (this.scopeResolutionStrategyProvider.isUnsatisfied()) {\n            return new DefaultPreferenceScopeResolutionStrategy(scopeFactory,\n                                                                componentKey);\n        }\n\n        return this.scopeResolutionStrategyProvider.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/java/org/uberfire/preferences/client/utils/PreferenceQualifierUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.utils;\n\nimport java.lang.annotation.Annotation;\n\nimport org.uberfire.preferences.client.annotations.ComponentKey;\n\npublic class PreferenceQualifierUtils {\n\n    public static String getComponentKeyIfExists(final Annotation[] qualifiers) {\n        String componentKey = null;\n\n        for (Annotation annotation : qualifiers) {\n            if (annotation.annotationType().equals(ComponentKey.class)) {\n                componentKey = ((ComponentKey) annotation).value();\n            }\n        }\n\n        return componentKey;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/main/resources/org/uberfire/preferences/UberfirePreferencesClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n\n  <inherits name=\"org.uberfire.preferences.UberfirePreferencesAPI\"/>\n\n  <source path='client'/>\n</module>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/test/java/org/uberfire/ext/preferences/client/scope/ClientUsernameProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.scope;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ClientUsernameProviderTest {\n\n    private SessionInfo sessionInfo;\n\n    private ClientUsernameProvider serverUsernameProvider;\n\n    @Before\n    public void setup() {\n        sessionInfo = spy(new SessionInfoMock());\n        serverUsernameProvider = new ClientUsernameProvider(sessionInfo);\n    }\n\n    @Test\n    public void testLoggedUserName() {\n        final String username = serverUsernameProvider.get();\n\n        verify(sessionInfo).getIdentity();\n\n        assertEquals(sessionInfo.getIdentity().getIdentifier(),\n                     username);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client/src/test/java/org/uberfire/preferences/client/store/PreferenceBeanStoreClientImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *        http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.util.Arrays;\nimport java.util.Map;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class PreferenceBeanStoreClientImplTest {\n\n    private PreferenceBeanStore preferenceBeanStoreClient;\n\n    @Before\n    public void before() {\n        preferenceBeanStoreClient = new PreferenceBeanStoreClientImpl();\n    }\n\n    @Test\n    public void testLoad() {\n        MyPreferencePortable preference = new MyPreferencePortable();\n        preferenceBeanStoreClient.load(preference,\n                                       p -> {\n                                       },\n                                       p -> {\n                                       });\n\n        assertEquals(\"foo\", preference.value);\n    }\n\n    @Test\n    public void testLoadWithPreferenceScopeResolutionStrategyInfo() {\n        MyPreferencePortable preference = new MyPreferencePortable();\n        preferenceBeanStoreClient.load(preference,\n                                       null,\n                                       p -> {\n                                       },\n                                       p -> {\n                                       });\n\n        assertEquals(\"foo\", preference.value);\n    }\n\n    private static class MyPreferencePortable implements BasePreferencePortable<MyPreferencePortable> {\n\n        private String value;\n\n        @Override\n        public Class<MyPreferencePortable> getPojoClass() {\n            return MyPreferencePortable.class;\n        }\n\n        @Override\n        public String identifier() {\n            return null;\n        }\n\n        @Override\n        public String[] parents() {\n            return new String[0];\n        }\n\n        @Override\n        public String bundleKey() {\n            return null;\n        }\n\n        @Override\n        public void set(final String property,\n                        final Object value) {\n\n        }\n\n        @Override\n        public Object get(final String property) {\n            return null;\n        }\n\n        @Override\n        public Map<String, PropertyFormType> getPropertiesTypes() {\n            return null;\n        }\n\n        @Override\n        public boolean isPersistable() {\n            return false;\n        }\n\n        @Override\n        public MyPreferencePortable defaultValue(final MyPreferencePortable defaultValue) {\n            defaultValue.value = \"foo\";\n            return defaultValue;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/pom.xml",
    "content": "<?xml version=\"1.0\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~        http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project\n    xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n    xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-preferences</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-preferences-client-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Preferences Client Backend</name>\n  <description>Uberfire Preferences Client Backend</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/src/main/java/org/uberfire/preferences/client/store/PreferenceBeanStoreImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.util.Collection;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanServerStore;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Client implementation for {@link PreferenceBeanStore}. It just pass along the method calls to the backend\n * implementation, with the proper callbacks.\n */\n@Alternative\n@ApplicationScoped\npublic class PreferenceBeanStoreImpl implements PreferenceBeanStore {\n\n    private Caller<PreferenceBeanServerStore> store;\n\n    @Inject\n    public PreferenceBeanStoreImpl(final Caller<PreferenceBeanServerStore> store) {\n        this.store = store;\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(new RemoteCallback<T>() {\n                       @Override\n                       public void callback(final T portablePreference) {\n                           if (successCallback != null) {\n                               successCallback.execute(portablePreference);\n                           }\n                       }\n                   },\n                   new ErrorCallback<Throwable>() {\n                       @Override\n                       public boolean error(final Throwable throwable,\n                                            final Throwable throwable2) {\n                           if (errorCallback != null) {\n                               errorCallback.execute(throwable);\n                           }\n                           return false;\n                       }\n                   }).load(emptyPortablePreference);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void load(final T emptyPortablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final ParameterizedCommand<T> successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(new RemoteCallback<T>() {\n                       @Override\n                       public void callback(final T portablePreference) {\n                           if (successCallback != null) {\n                               successCallback.execute(portablePreference);\n                           }\n                       }\n                   },\n                   new ErrorCallback<Throwable>() {\n                       @Override\n                       public boolean error(final Throwable throwable,\n                                            final Throwable throwable2) {\n                           if (errorCallback != null) {\n                               errorCallback.execute(throwable);\n                           }\n                           return false;\n                       }\n                   }).load(emptyPortablePreference,\n                           scopeResolutionStrategyInfo);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreference);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(final T portablePreference,\n                                                                                        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                                                                                        final Command successCallback,\n                                                                                        final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreference,\n                           scopeResolutionStrategyInfo);\n    }\n\n    @Override\n    public <U extends BasePreference<U>, T extends BasePreferencePortable<U>> void save(T portablePreference,\n                                                                                        PreferenceScope scope,\n                                                                                        Command successCallback,\n                                                                                        ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreference,\n                           scope);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreferences);\n    }\n\n    @Override\n    public void save(final Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo,\n                     final Command successCallback,\n                     final ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreferences,\n                           scopeResolutionStrategyInfo);\n    }\n\n    @Override\n    public void save(Collection<BasePreferencePortable<? extends BasePreference<?>>> portablePreferences,\n                     PreferenceScope scope,\n                     Command successCallback,\n                     ParameterizedCommand<Throwable> errorCallback) {\n        store.call(voidReturn -> {\n                       if (successCallback != null) {\n                           successCallback.execute();\n                       }\n                   },\n                   (message, throwable) -> {\n                       if (errorCallback != null) {\n                           errorCallback.execute(throwable);\n                       }\n                       return false;\n                   }).save(portablePreferences,\n                           scope);\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#        http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\nerrai.ioc.enabled.alternatives=org.uberfire.preferences.client.store.PreferenceBeanStoreImpl\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/src/main/resources/org/uberfire/preferences/UberfirePreferencesClientBackend.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.uberfire.preferences.UberfirePreferencesClient\"/>\n  <source path='client'/>\n</module>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/src/test/java/org/uberfire/ext/preferences/client/scope/ClientUsernameProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.scope;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ClientUsernameProviderTest {\n\n    private SessionInfo sessionInfo;\n\n    private ClientUsernameProvider serverUsernameProvider;\n\n    @Before\n    public void setup() {\n        sessionInfo = spy(new SessionInfoMock());\n        serverUsernameProvider = new ClientUsernameProvider(sessionInfo);\n    }\n\n    @Test\n    public void testLoggedUserName() {\n        final String username = serverUsernameProvider.get();\n\n        verify(sessionInfo).getIdentity();\n\n        assertEquals(sessionInfo.getIdentity().getIdentifier(),\n                     username);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-client-backend/src/test/java/org/uberfire/ext/preferences/client/store/PreferenceBeanStoreImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.preferences.client.store;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanServerStore;\n\nimport static org.mockito.Mockito.*;\n\npublic class PreferenceBeanStoreImplTest {\n\n    private final Command successCommand = spy(new Command() {\n        @Override\n        public void execute() {\n        }\n    });\n    private final ParameterizedCommand<MyPreferencePortable> successParameterizedCommand = spy(new ParameterizedCommand<MyPreferencePortable>() {\n        @Override\n        public void execute(final MyPreferencePortable parameter) {\n        }\n    });\n    private final ParameterizedCommand<Throwable> errorParameterizedCommand = spy(new ParameterizedCommand<Throwable>() {\n        @Override\n        public void execute(final Throwable parameter) {\n        }\n    });\n    private PreferenceBeanServerStore store;\n    private CallerMock<PreferenceBeanServerStore> storeCaller;\n    private PreferenceBeanStoreImpl preferenceBeanStoreImpl;\n\n    @Before\n    public void setup() {\n        store = mock(PreferenceBeanServerStore.class);\n        storeCaller = new CallerMock<>(store);\n\n        preferenceBeanStoreImpl = new PreferenceBeanStoreImpl(storeCaller);\n    }\n\n    @Test\n    public void loadSuccessfullyTest() {\n        preferenceBeanStoreImpl.load(new MyPreferencePortable(),\n                                     successParameterizedCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).load(any(MyPreferencePortable.class));\n        verify(successParameterizedCommand).execute(any());\n    }\n\n    @Test\n    public void loadWithErrorTest() {\n        doThrow(new RuntimeException(\"error\")).when(store).load(any(BasePreferencePortable.class));\n\n        preferenceBeanStoreImpl.load(new MyPreferencePortable(),\n                                     successParameterizedCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).load(any(MyPreferencePortable.class));\n        verify(errorParameterizedCommand).execute(any());\n    }\n\n    @Test\n    public void saveSuccessfullyTest() {\n        preferenceBeanStoreImpl.save(new MyPreferencePortable(),\n                                     successCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).save(any(MyPreferencePortable.class));\n        verify(successCommand).execute();\n    }\n\n    @Test\n    public void saveWithErrorTest() {\n        doThrow(new RuntimeException(\"error\")).when(store).save(any(BasePreferencePortable.class));\n\n        preferenceBeanStoreImpl.save(new MyPreferencePortable(),\n                                     successCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).save(any(MyPreferencePortable.class));\n        verify(errorParameterizedCommand).execute(any(Throwable.class));\n    }\n\n    @Test\n    public void saveCollectionSuccessfullyTest() {\n        Collection<BasePreferencePortable<? extends BasePreference<?>>> preferences = new ArrayList<>();\n        preferences.add(new MyPreferencePortable());\n        preferenceBeanStoreImpl.save(preferences,\n                                     successCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).save(preferences);\n        verify(successCommand).execute();\n    }\n\n    @Test\n    public void saveCollectionWithErrorTest() {\n        doThrow(new RuntimeException(\"error\")).when(store).save(anyCollection());\n\n        Collection<BasePreferencePortable<? extends BasePreference<?>>> preferences = new ArrayList<>();\n        preferences.add(new MyPreferencePortable());\n        preferenceBeanStoreImpl.save(preferences,\n                                     successCommand,\n                                     errorParameterizedCommand);\n\n        verify(store).save(preferences);\n        verify(errorParameterizedCommand).execute(any(Throwable.class));\n    }\n\n    class MyPreference implements BasePreference<MyPreference> {\n\n    }\n\n    class MyPreferencePortable extends MyPreference implements BasePreferencePortable<MyPreference> {\n\n        @Override\n        public Class<MyPreference> getPojoClass() {\n            return MyPreference.class;\n        }\n\n        @Override\n        public String identifier() {\n            return null;\n        }\n\n        @Override\n        public String[] parents() {\n            return new String[0];\n        }\n\n        @Override\n        public String bundleKey() {\n            return null;\n        }\n\n        @Override\n        public void set(final String property,\n                        final Object value) {\n\n        }\n\n        @Override\n        public Object get(final String property) {\n            return null;\n        }\n\n        @Override\n        public Map<String, PropertyFormType> getPropertiesTypes() {\n            return null;\n        }\n\n        @Override\n        public boolean isPersistable() {\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\ndependency-reduced-pom.xml\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-preferences</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-preferences-processors</artifactId>\n  <packaging>jar</packaging>\n\n  <name>Uberfire Preferences Processors</name>\n  <description>Uberfire Preferences Processors</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.freemarker</groupId>\n      <artifactId>freemarker</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors-tests</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>log4j-over-slf4j</artifactId>\n    </dependency>\n\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-compiler-plugin</artifactId>\n        <configuration>\n          <proc>none</proc>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/java/org/uberfire/ext/preferences/processors/GeneratorContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\npublic enum GeneratorContext {\n\n    BEAN,\n    PORTABLE\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/java/org/uberfire/ext/preferences/processors/PropertyData.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.Modifier;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.type.TypeKind;\nimport javax.lang.model.util.Elements;\n\nimport org.uberfire.annotations.processors.GeneratorUtils;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\n\n/**\n * Class used to store preferences' properties information during template processing.\n */\npublic class PropertyData {\n\n    private String fieldName;\n\n    private String capitalizedFieldName;\n\n    private String typeFullName;\n\n    private boolean shared;\n\n    private boolean subPreference;\n\n    private PropertyFormType formType;\n\n    private boolean privateAccess;\n\n    private TypeKind typeKind;\n\n    private List<String> validators;\n\n    public PropertyData(final Element element,\n                        final Property propertyAnnotation,\n                        final AnnotationMirror propertyAnnotationMirror,\n                        final Elements elementUtils) {\n        fieldName = element.getSimpleName().toString();\n\n        typeFullName = element.asType().toString();\n\n        final char elementNameFirstLetter = fieldName.charAt(0);\n        final char elementNameCapitalizedFirstLetter = Character.toUpperCase(elementNameFirstLetter);\n        final String nameWithoutFirstLetter = fieldName.substring(1);\n        capitalizedFieldName = elementNameCapitalizedFirstLetter + nameWithoutFirstLetter;\n\n        shared = propertyAnnotation.shared();\n\n        final TypeElement typeElement = elementUtils.getTypeElement(element.asType().toString());\n        subPreference = typeElement != null && typeElement.getAnnotation(WorkbenchPreference.class) != null;\n\n        formType = propertyAnnotation.formType();\n\n        privateAccess = element.getModifiers().contains(Modifier.PRIVATE);\n\n        typeKind = element.asType().getKind();\n\n        setupValidators(propertyAnnotationMirror,\n                        elementUtils);\n    }\n\n    void setupValidators(AnnotationMirror propertyAnnotationMirror,\n                         Elements elementUtils) {\n        final AnnotationValue validatorsAnnotationValue = GeneratorUtils.extractAnnotationPropertyValue(elementUtils,\n                                                                                                        propertyAnnotationMirror,\n                                                                                                        \"validators\");\n        List<?> validators = (List<?>) GeneratorUtils.extractValue(validatorsAnnotationValue);\n        this.validators = new ArrayList<>();\n        if (validators != null) {\n            this.validators.addAll((validators.stream()\n                    .map(v -> v.toString())\n                    .collect(Collectors.toList())));\n        }\n    }\n\n    public String getFieldName() {\n        return fieldName;\n    }\n\n    public String getCapitalizedFieldName() {\n        return capitalizedFieldName;\n    }\n\n    public String getTypeFullName() {\n        return typeFullName;\n    }\n\n    public boolean isShared() {\n        return shared;\n    }\n\n    public boolean isSubPreference() {\n        return subPreference;\n    }\n\n    public PropertyFormType getFormType() {\n        return formType;\n    }\n\n    public boolean isPrivateAccess() {\n        return privateAccess;\n    }\n\n    public boolean isPrimitive() {\n        return typeKind.isPrimitive();\n    }\n\n    public List<String> getValidators() {\n        return validators;\n    }\n\n    public boolean hasValidators() {\n        return validators != null && !validators.isEmpty();\n    }\n\n    public String getHashCodeFormula() {\n        if (isPrimitive()) {\n            switch (typeKind) {\n                case BOOLEAN:\n                    return \"java.lang.Boolean.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case BYTE:\n                    return \"java.lang.Byte.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case SHORT:\n                    return \"java.lang.Short.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case INT:\n                    return \"java.lang.Integer.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case LONG:\n                    return \"java.lang.Long.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case CHAR:\n                    return \"java.lang.Character.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case FLOAT:\n                    return \"java.lang.Float.hashCode( \" + getFieldAccessorCommand() + \" )\";\n                case DOUBLE:\n                    return \"java.lang.Double.hashCode( \" + getFieldAccessorCommand() + \" )\";\n            }\n        }\n\n        return \"( \" + getFieldAccessorCommand() + \" != null ? \" + getFieldAccessorCommand() + \".hashCode() : 0 )\";\n    }\n\n    public String getFieldAccessorCommand() {\n        if (!isPrivateAccess()) {\n            return fieldName;\n        } else if (isPrimitive() && TypeKind.BOOLEAN.equals(typeKind)) {\n            return \"is\" + capitalizedFieldName + \"()\";\n        } else {\n            return \"get\" + capitalizedFieldName + \"()\";\n        }\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/java/org/uberfire/ext/preferences/processors/WorkbenchPreferenceGeneratedImplGenerator.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.AbstractGenerator;\nimport org.uberfire.annotations.processors.GeneratorUtils;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\n\n/**\n * A source code generator for {@link WorkbenchPreference}.\n */\npublic class WorkbenchPreferenceGeneratedImplGenerator extends AbstractGenerator {\n\n    private GeneratorContext generatorContext;\n    private String targetClassName = null;\n\n    public WorkbenchPreferenceGeneratedImplGenerator(final GeneratorContext generatorContext) {\n        this.generatorContext = generatorContext;\n    }\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        final TypeElement classElement = (TypeElement) element;\n\n        final WorkbenchPreference annotation = element.getAnnotation(WorkbenchPreference.class);\n\n        String sourcePackage = packageName;\n        String sourceClassName = className;\n        String targetPackage = packageName;\n\n        String identifier = annotation.identifier();\n        String[] parents = annotation.parents();\n        String bundleKey = annotation.bundleKey();\n\n        if (GeneratorContext.BEAN.equals(generatorContext)) {\n            targetClassName = className + \"BeanGeneratedImpl\";\n        } else if (GeneratorContext.PORTABLE.equals(generatorContext)) {\n            targetClassName = className + \"PortableGeneratedImpl\";\n        }\n\n        List<PropertyData> properties = new ArrayList<>();\n\n        TypeElement c = classElement;\n        final TypeElement propertyTypeElement = elementUtils.getTypeElement(Property.class.getName());\n\n        for (Element el : c.getEnclosedElements()) {\n            final Property propertyAnnotation = el.getAnnotation(Property.class);\n            for (AnnotationMirror am : el.getAnnotationMirrors()) {\n                if (am.getAnnotationType().equals(propertyTypeElement.asType())) {\n                    properties.add(new PropertyData(el,\n                                                    propertyAnnotation,\n                                                    am,\n                                                    elementUtils));\n                }\n            }\n        }\n\n        final List<PropertyData> simpleProperties = properties.stream()\n                .filter(p -> !p.isSubPreference())\n                .collect(Collectors.toList());\n\n        final List<PropertyData> subPreferences = properties.stream()\n                .filter(p -> p.isSubPreference())\n                .collect(Collectors.toList());\n\n        final List<PropertyData> nonSharedSubPreferences = subPreferences.stream()\n                .filter(p -> !p.isShared())\n                .collect(Collectors.toList());\n\n        final List<PropertyData> sharedSubPreferences = subPreferences.stream()\n                .filter(p -> p.isShared())\n                .collect(Collectors.toList());\n\n        final List<String> constructorParams = properties.stream()\n                .map(p -> \"@MapsTo(\\\"\" + p.getFieldName() + \"\\\") \" + p.getTypeFullName() + \" \" + p.getFieldName())\n                .collect(Collectors.toList());\n        final String constructorParamsText = String.join(\", \",\n                                                         constructorParams);\n\n        final List<String> propertyFields = properties.stream()\n                .map(PropertyData::getFieldName)\n                .collect(Collectors.toList());\n        final String propertyFieldsText = String.join(\", \",\n                                                      propertyFields);\n\n        final String parentsIdentifiers = String.join(\", \",\n                                                      parents);\n\n        final String isPersistable = Boolean.toString(!simpleProperties.isEmpty() || !nonSharedSubPreferences.isEmpty());\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            final List<String> simplePropertiesNames = simpleProperties.stream()\n                    .map(PropertyData::getFieldName)\n                    .collect(Collectors.toList());\n            final String simplePropertiesText = String.join(\", \",\n                                                            simplePropertiesNames);\n\n            final List<String> subPreferencesNames = subPreferences.stream()\n                    .map(PropertyData::getFieldName)\n                    .collect(Collectors.toList());\n            final String subPreferencesText = String.join(\", \",\n                                                          subPreferencesNames);\n\n            final List<String> sharedSubPreferencesNames = sharedSubPreferences.stream()\n                    .map(PropertyData::getFieldName)\n                    .collect(Collectors.toList());\n            final String sharedSubPreferencesText = String.join(\", \",\n                                                                sharedSubPreferencesNames);\n\n            final List<String> nonSharedSubPreferencesNames = nonSharedSubPreferences.stream()\n                    .map(PropertyData::getFieldName)\n                    .collect(Collectors.toList());\n            final String nonSharedSubPreferencesText = String.join(\", \",\n                                                                   nonSharedSubPreferencesNames);\n\n            messager.printMessage(Kind.NOTE,\n                                  \"Source package name: \" + sourcePackage);\n            messager.printMessage(Kind.NOTE,\n                                  \"Source class name: \" + sourceClassName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Target package name: \" + targetPackage);\n            messager.printMessage(Kind.NOTE,\n                                  \"Target class name: \" + targetClassName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"Parents: \" + parentsIdentifiers);\n            messager.printMessage(Kind.NOTE,\n                                  \"Property fields: \" + propertyFieldsText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Simple properties fields: \" + simplePropertiesText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Sub-preferences fields: \" + subPreferencesText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Shared subPreferences fields: \" + sharedSubPreferencesText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Non-shared subPreferences fields: \" + nonSharedSubPreferencesText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Constructor parameters: \" + constructorParamsText);\n            messager.printMessage(Kind.NOTE,\n                                  \"Is persistable: \" + isPersistable);\n        }\n\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"sourcePackage\",\n                 sourcePackage);\n        root.put(\"sourceClassName\",\n                 sourceClassName);\n        root.put(\"targetPackage\",\n                 targetPackage);\n        root.put(\"targetClassName\",\n                 targetClassName);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"parentsIdentifiers\",\n                 parentsIdentifiers);\n        root.put(\"bundleKey\",\n                 bundleKey);\n        root.put(\"properties\",\n                 properties);\n        root.put(\"simpleProperties\",\n                 simpleProperties);\n        root.put(\"subPreferences\",\n                 subPreferences);\n        root.put(\"sharedSubPreferences\",\n                 sharedSubPreferences);\n        root.put(\"nonSharedSubPreferences\",\n                 nonSharedSubPreferences);\n        root.put(\"constructorParamsText\",\n                 constructorParamsText);\n        root.put(\"propertyFieldsText\",\n                 propertyFieldsText);\n        root.put(\"isPersistable\",\n                 isPersistable);\n\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            Template template = null;\n            if (GeneratorContext.BEAN.equals(generatorContext)) {\n                template = config.getTemplate(\"workbenchPreferenceBean.ftl\");\n            } else if (GeneratorContext.PORTABLE.equals(generatorContext)) {\n                template = config.getTemplate(\"workbenchPreferencePortable.ftl\");\n            }\n\n            if (template != null) {\n                template.process(root,\n                                 bw);\n            }\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n\n    public String getTargetClassName() {\n        return targetClassName;\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/java/org/uberfire/ext/preferences/processors/WorkbenchPreferenceProcessor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic;\n\nimport org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessor;\nimport org.uberfire.annotations.processors.GenerationCompleteCallback;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\n\n/**\n * Processor for {@link WorkbenchPreference} and related annotations\n */\n@SupportedAnnotationTypes(WorkbenchPreferenceProcessor.WORKBENCH_PREFERENCE)\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchPreferenceProcessor extends AbstractErrorAbsorbingProcessor {\n\n    public static final String WORKBENCH_PREFERENCE = \"org.uberfire.preferences.shared.annotations.WorkbenchPreference\";\n\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchPreferenceProcessor() {\n    }\n\n    // Constructor for tests only, to prevent code being written to file. The generated code will be sent to the callback\n    WorkbenchPreferenceProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element element : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(WORKBENCH_PREFERENCE))) {\n            if (element.getKind() == ElementKind.CLASS) {\n                WorkbenchPreferenceGeneratedImplGenerator beanGenerator = null;\n                WorkbenchPreferenceGeneratedImplGenerator portableGenerator = null;\n\n                try {\n                    beanGenerator = new WorkbenchPreferenceGeneratedImplGenerator(GeneratorContext.BEAN);\n                    portableGenerator = new WorkbenchPreferenceGeneratedImplGenerator(GeneratorContext.PORTABLE);\n                } catch (Throwable t) {\n                    rememberInitializationError(t);\n                }\n\n                TypeElement classElement = (TypeElement) element;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Diagnostic.Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String className = classElement.getSimpleName() + \"\";\n\n                generate(messager,\n                         classElement,\n                         packageElement,\n                         packageName,\n                         className,\n                         beanGenerator);\n                generate(messager,\n                         classElement,\n                         packageElement,\n                         packageName,\n                         className,\n                         portableGenerator);\n            }\n        }\n\n        return true;\n    }\n\n    private void generate(final Messager messager,\n                          final TypeElement classElement,\n                          final PackageElement packageElement,\n                          final String packageName,\n                          final String className,\n                          final WorkbenchPreferenceGeneratedImplGenerator generator) throws IOException {\n        try {\n            messager.printMessage(Diagnostic.Kind.NOTE,\n                                  \"Generating code for [\" + className + \"]\");\n            final StringBuffer generatedImplCode = generator.generate(packageName,\n                                                                      packageElement,\n                                                                      className,\n                                                                      classElement,\n                                                                      processingEnv);\n\n            // If code is successfully created write files, or send generated code to callback.\n            // The callback function is used primarily for testing when we don't necessarily want\n            // the generated code to be stored as a compilable file for javac to process.\n            if (callback == null) {\n                writeCode(packageName,\n                          generator.getTargetClassName(),\n                          generatedImplCode);\n            } else {\n                callback.generationComplete(generatedImplCode.toString());\n            }\n        } catch (GenerationException ge) {\n            final String msg = ge.getMessage();\n            processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,\n                                                     msg,\n                                                     classElement);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/resources/META-INF/services/javax.annotation.processing.Processor",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/resources/org/uberfire/ext/preferences/processors/templates/workbenchPreferenceBean.ftl",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${targetPackage};\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.annotation.Generated;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.BasePreferenceBean;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\n@Generated(\"org.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\")\n/*\n* WARNING! This class is generated. Do not modify.\n*/\npublic class ${targetClassName} extends ${sourceClassName} implements BasePreferenceBean<${sourceClassName}> {\n\n    private PreferenceBeanStore store;\n    \n    private PreferenceScopeResolutionStrategy resolutionStrategy;\n\n    @Inject\n    public ${targetClassName}( final PreferenceBeanStore store,\n                               @Customizable final PreferenceScopeResolutionStrategy resolutionStrategy ) {\n        this.store = store;\n        this.resolutionStrategy = resolutionStrategy;\n    }\n\n    @Override\n    public void load() {\n        load( ( ParameterizedCommand<Throwable> ) null );\n    }\n\n    @Override\n    public void load( final ParameterizedCommand<Throwable> errorCallback ) {\n        load( ( ParameterizedCommand<${sourceClassName}> ) null, errorCallback );\n    }\n\n    @Override\n    public void load( final ParameterizedCommand<${sourceClassName}> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        final ${targetClassName} preferenceBean = this;\n\n        store.load( new ${sourceClassName}PortableGeneratedImpl(),\n                    getLoadSuccessCallback( successCallback ),\n                    errorCallback );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy ) {\n        load( customScopeResolutionStrategy, null );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        load( customScopeResolutionStrategy, null, errorCallback );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<${sourceClassName}> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        final ${targetClassName} preferenceBean = this;\n\n        store.load( new ${sourceClassName}PortableGeneratedImpl(),\n                    customScopeResolutionStrategy,\n                    getLoadSuccessCallback( successCallback ),\n                    errorCallback );\n    }\n\n    private ParameterizedCommand<BasePreferencePortable<${sourceClassName}>> getLoadSuccessCallback( final ParameterizedCommand<${sourceClassName}> successCallback ) {\n        final ${sourceClassName}BeanGeneratedImpl preferenceBean = this;\n\n        return new ParameterizedCommand<BasePreferencePortable<${sourceClassName}>>() {\n            @Override\n            public void execute( final BasePreferencePortable<${sourceClassName}> portablePreference ) {\n                copy( (${sourceClassName}PortableGeneratedImpl) portablePreference, preferenceBean );\n                if ( successCallback != null ) {\n                    successCallback.execute( preferenceBean );\n                }\n            }\n        };\n    }\n\n    private void copy( final ${sourceClassName} from,\n                       final ${sourceClassName} to ) {\n    <#list properties as property>\n        <#if property.isPrivateAccess()>\n        to.set${property.getCapitalizedFieldName()}( from.${property.getFieldAccessorCommand()} );\n        <#else>\n        to.${property.getFieldName()} = from.${property.getFieldName()};\n        </#if>\n    </#list>\n    }\n\n    @Override\n    public void save() {\n        save( ( ParameterizedCommand<Throwable> ) null );\n    }\n\n    @Override\n    public void save( final ParameterizedCommand<Throwable> errorCallback ) {\n        save( ( Command ) null, errorCallback );\n    }\n\n    @Override\n    public void save( final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    successCallback,\n                    errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy ) {\n        save( customScopeResolutionStrategy, null );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        save( customScopeResolutionStrategy, null, errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    customScopeResolutionStrategy,\n                    successCallback,\n                    errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope ) {\n        save( customScope, null );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        save( customScope, null, errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    customScope,\n                    successCallback,\n                    errorCallback );\n    }\n\n    private BasePreferencePortable<${sourceClassName}> createPortableCopy() {\n        ${sourceClassName}PortableGeneratedImpl portablePreference = new ${sourceClassName}PortableGeneratedImpl();\n\n        copy( this, portablePreference );\n\n        return portablePreference;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/main/resources/org/uberfire/ext/preferences/processors/templates/workbenchPreferencePortable.ftl",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${targetPackage};\n\nimport java.lang.RuntimeException;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.Generated;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.annotations.PortablePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Portable( mapSuperTypes = true )\n@PortablePreference\n@Generated(\"org.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\")\n/*\n* WARNING! This class is generated. Do not modify.\n*/\npublic class ${targetClassName} extends ${sourceClassName} implements BasePreferencePortable<${sourceClassName}> {\n\n<#if constructorParamsText != \"\">\n    public ${targetClassName}() {\n    <#list subPreferences as subPreference>\n        <#if subPreference.isPrivateAccess()>\n        set${subPreference.getCapitalizedFieldName()}( new ${subPreference.getTypeFullName()}PortableGeneratedImpl() );\n        <#else>\n        this.${subPreference.getFieldName()} = new ${subPreference.getTypeFullName()}PortableGeneratedImpl();\n        </#if>\n    </#list>\n    }\n</#if>\n\n    public ${targetClassName}( ${constructorParamsText} ) {\n    <#list properties as property>\n        <#if property.isPrivateAccess()>\n        set${property.getCapitalizedFieldName()}( ${property.getFieldName()} );\n        <#else>\n        this.${property.getFieldName()} = ${property.getFieldName()};\n        </#if>\n    </#list>\n    }\n\n    @Override\n    public Class<${sourceClassName}> getPojoClass() {\n        return ${sourceClassName}.class;\n    }\n\n    @Override\n    public String identifier() {\n        return \"${identifier}\";\n    }\n\n    @Override\n    public String[] parents() {\n        return new String[] { \"${parentsIdentifiers}\" };\n    }\n\n    @Override\n    public String bundleKey() {\n    <#if bundleKey == \"\">\n        return \"${identifier}\";\n    <#else>\n        return \"${bundleKey}\";\n    </#if>\n    }\n\n    @Override\n    public void set( String property, Object value ) {\n    <#list simpleProperties as property>\n        if ( property.equals( \"${property.getFieldName()}\" ) ) {\n        <#if property.isPrivateAccess()>\n            set${property.getCapitalizedFieldName()}( (${property.getTypeFullName()}) value );\n        <#else>\n            ${property.getFieldName()} = (${property.getTypeFullName()}) value;\n        </#if>\n        } else\n    </#list>\n        {\n            throw new RuntimeException( \"Unknown property: \" + property );\n        }\n    }\n\n    @Override\n    public Object get( String property ) {\n    <#list simpleProperties as property>\n        if ( property.equals( \"${property.getFieldName()}\" ) ) {\n            return ${property.getFieldAccessorCommand()};\n        } else\n    </#list>\n        {\n            throw new RuntimeException( \"Unknown property: \" + property );\n        }\n    }\n\n    @Override\n    public Map<String, PropertyFormType> getPropertiesTypes() {\n        Map<String, PropertyFormType> propertiesTypes = new HashMap<>();\n\n    <#list simpleProperties as property>\n        propertiesTypes.put( \"${property.getFieldName()}\", PropertyFormType.${property.getFormType()});\n    </#list>\n\n        return propertiesTypes;\n    }\n\n    @Override\n    public Map<String, List<PropertyValidator>> getPropertiesValidators() {\n        Map<String, List<PropertyValidator>> validatorsByProperty = new HashMap<>();\n\n    <#list simpleProperties as property>\n        <#if property.hasValidators()>\n        List<PropertyValidator> validators${property.getCapitalizedFieldName()} = new ArrayList<>();\n            <#list property.validators as validator>\n        validators${property.getCapitalizedFieldName()}.add(new ${validator}());\n            </#list>    \n        validatorsByProperty.put(\"${property.getFieldName()}\", validators${property.getCapitalizedFieldName()});\n\n        </#if>\n    </#list>\n\n        return validatorsByProperty;\n    }\n\n    @Override\n    public boolean equals( final Object o ) {\n        if ( this == o ) {\n            return true;\n        }\n        if ( o == null || getClass() != o.getClass() ) {\n            return false;\n        }\n\n        final ${targetClassName} that = (${targetClassName}) o;\n\n<#list properties as property>\n    <#if property.isPrimitive()>\n        if ( ${property.getFieldAccessorCommand()} != that.${property.getFieldAccessorCommand()} ) {\n            return false;\n        }\n    <#else>\n        if ( ${property.getFieldAccessorCommand()} != null ? !${property.getFieldAccessorCommand()}.equals( that.${property.getFieldAccessorCommand()} ) : that.${property.getFieldAccessorCommand()} != null ) {\n            return false;\n        }\n    </#if>\n</#list>\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = 0;\n\n    <#list properties as property>\n        result = 31 * result + ${property.getHashCodeFormula()};\n        result = ~~result;\n    </#list>\n\n        return result;\n    }\n\n    @Override\n    public boolean isPersistable() {\n        return ${isPersistable};\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/AbstractProcessorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.annotation.processing.Processor;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.DiagnosticCollector;\nimport javax.tools.JavaCompiler;\nimport javax.tools.JavaCompiler.CompilationTask;\nimport javax.tools.JavaFileObject;\nimport javax.tools.StandardJavaFileManager;\nimport javax.tools.ToolProvider;\n\nimport org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessor;\n\nimport static org.junit.Assert.*;\n\n/**\n * Base miscfeatures to generate source code with an Annotation Processor\n * <p>\n * Due to a IntelliJ bug (IDEA-126596 and IDEA-93855), this class had to be copied from\n * uberfire-workbench-processors to here.\n */\npublic abstract class AbstractProcessorTest {\n\n    private static final String SOURCE_FILETYPE = \".java\";\n\n    /**\n     * Compile a unit of source code with the specified annotation processor\n     * @param annotationProcessor\n     * @param compilationUnits\n     * @return\n     */\n    public List<Diagnostic<? extends JavaFileObject>> compile(final Processor annotationProcessor,\n                                                              final String... compilationUnits) {\n\n        final DiagnosticCollector<JavaFileObject> diagnosticListener = new DiagnosticCollector<JavaFileObject>();\n\n        try {\n\n            final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();\n            final StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnosticListener,\n                                                                                        null,\n                                                                                        null);\n\n            String[] convertedCompilationUnits = convertCompilationUnitToFilePaths(compilationUnits);\n            final Iterable<? extends JavaFileObject> compilationUnitsJavaObjects =\n                    fileManager.getJavaFileObjects(convertedCompilationUnits);\n\n            //Compile with provide annotation processor\n            final CompilationTask task = compiler.getTask(null,\n                                                          fileManager,\n                                                          diagnosticListener,\n                                                          null,\n                                                          null,\n                                                          compilationUnitsJavaObjects);\n            task.setProcessors(Arrays.asList(annotationProcessor));\n            task.call();\n            fileManager.close();\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        }\n\n        return diagnosticListener.getDiagnostics();\n    }\n\n    private String[] convertCompilationUnitToFilePaths(String[] compilationUnits) {\n        List<String> convertedCompilationUnits = new ArrayList<String>();\n        for (String compilationUnit : compilationUnits) {\n            convertedCompilationUnits.add(this.getClass().getResource(\"/\" + compilationUnit + SOURCE_FILETYPE).getPath());\n        }\n        return convertedCompilationUnits.toArray(new String[convertedCompilationUnits.size()]);\n    }\n\n    /**\n     * Retrieve the expected source code for a compilation unit\n     * @param compilationUnit\n     * @return\n     * @throws FileNotFoundException\n     */\n    public String getExpectedSourceCode(final String compilationUnit) throws FileNotFoundException {\n        StringBuilder sb = new StringBuilder();\n        try {\n            final String path = this.getClass().getResource(\"/\" + compilationUnit).getPath();\n            final FileReader fr = new FileReader(path);\n            final BufferedReader input = new BufferedReader(fr);\n            try {\n                String line = null;\n                while ((line = input.readLine()) != null) {\n                    sb.append(line);\n                    sb.append(System.getProperty(\"line.separator\"));\n                }\n            } finally {\n                input.close();\n            }\n        } catch (FileNotFoundException fnfe) {\n            throw fnfe;\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        }\n        return sb.toString();\n    }\n\n    /**\n     * Assert that compilation was successful\n     * @param diagnostics\n     */\n    public void assertSuccessfulCompilation(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        assertFalse(diagnostics.toString(),\n                    hasErrors(diagnostics));\n    }\n\n    /**\n     * Assert that compilation failed\n     * @param diagnostics\n     */\n    public void assertFailedCompilation(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        assertTrue(hasErrors(diagnostics));\n    }\n\n    private boolean hasErrors(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {\n            if (diagnostic.getKind().equals(Kind.ERROR)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Assert that the given error message is contained in the compilation\n     * diagnostics.\n     * @param diagnostics the list of diagnostic messages from the compiler. Must not be null.\n     * @param kind the kind of message to search for, or null to search messages of\n     * any kind.\n     * @param line the line number that must be attached to the message, or\n     * {@link Diagnostic#NOPOS} if line number is not important.\n     * @param col the column number that must be attached to the message, or\n     * {@link Diagnostic#NOPOS} if column number is not important.\n     * @param message the message to search for. If any otherwise matching message in\n     * the given list contains this string, the assertion passes. Must not be null.\n     */\n    public void assertCompilationMessage(List<Diagnostic<? extends JavaFileObject>> diagnostics,\n                                         Kind kind,\n                                         long line,\n                                         long col,\n                                         final String message) {\n        StringBuilder sb = new StringBuilder(100);\n        for (Diagnostic<? extends JavaFileObject> msg : diagnostics) {\n            sb.append(msg.getKind())\n                    .append(\" \")\n                    .append(msg.getLineNumber())\n                    .append(\":\")\n                    .append(msg.getColumnNumber())\n                    .append(\": \")\n                    .append(msg.getMessage(null))\n                    .append(\"\\n\");\n            if ((kind == null || msg.getKind().equals(kind))\n                    && (line == Diagnostic.NOPOS || msg.getLineNumber() == line)\n                    && (col == Diagnostic.NOPOS || msg.getColumnNumber() == col)\n                    && msg.getMessage(null).contains(message)) {\n                return;\n            }\n        }\n\n        fail(\"Compiler diagnostics did not contain \" + kind + \" message \" + line + \":\" + col + \": \" + message + \"\\n\" +\n                     \"Dump of all \" + diagnostics.size() + \" actual messages:\\n\" +\n                     sb);\n    }\n\n    /**\n     * Returns the annotation processor being tested by the current test. This processor should be\n     * created with a GenerationCompleteCallback that will capture the output of the processor so it can be examined\n     * by test assertions.\n     */\n    protected abstract AbstractErrorAbsorbingProcessor getProcessorUnderTest();\n\n    /**\n     * Container for miscfeatures results.\n     */\n    public class Result {\n\n        private String expectedCode;\n        private String actualCode;\n\n        public String getExpectedCode() {\n            return expectedCode;\n        }\n\n        public void setExpectedCode(final String expectedCode) {\n            this.expectedCode = expectedCode;\n        }\n\n        public String getActualCode() {\n            return actualCode;\n        }\n\n        public void setActualCode(final String actualCode) {\n            this.actualCode = actualCode;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/MyInnerPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MyInnerPreference\",\n        bundleKey = \"MyInnerPreference.Label\")\npublic class MyInnerPreference implements BasePreference<MyInnerPreference> {\n\n    @Property(bundleKey = \"MyInnerPreference.Text\")\n    String text;\n\n    public String getText() {\n        return text;\n    }\n\n    public void setText(final String text) {\n        this.text = text;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/MyInnerPreference2.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MyInnerPreference2\",\n        bundleKey = \"MyInnerPreference2.Label\")\npublic class MyInnerPreference2 implements BasePreference<MyInnerPreference2> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/MySharedPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MySharedPreference\",\n        bundleKey = \"MySharedPreference.Label\")\npublic class MySharedPreference implements BasePreference<MySharedPreference> {\n\n    @Property(bundleKey = \"MySharedPreference.Text\")\n    String text;\n\n    @Property(bundleKey = \"MySharedPreference.MyInnerPreference2\")\n    MyInnerPreference2 myInnerPreference2;\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/MySharedPreference2.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"MySharedPreference2\",\n        parents = \"MyInnerPreference2\",\n        bundleKey = \"MySharedPreference2.Label\")\npublic class MySharedPreference2 implements BasePreference<MySharedPreference2> {\n\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/java/org/uberfire/ext/preferences/processors/WorkbenchPreferenceProcessorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\nimport org.uberfire.annotations.processors.AbstractErrorAbsorbingProcessor;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for Workbench Preference related classes generation\n */\npublic class WorkbenchPreferenceProcessorTest extends AbstractProcessorTest {\n\n    List<Result> results = new ArrayList<>();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchPreferenceProcessor(code -> {\n            Result result = new Result();\n            result.setActualCode(code);\n            results.add(result);\n        });\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationAndHasTitleAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/ext/preferences/processors/MyPreference\";\n        final String pathExpectedBeanImplResult = \"org/uberfire/ext/preferences/processors/expected/MyPreferenceBeanGeneratedImpl.expected\";\n        final String pathExpectedPortableImplResult = \"org/uberfire/ext/preferences/processors/expected/MyPreferencePortableGeneratedImpl.expected\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n\n        getBeanGenerationResult().setExpectedCode(getExpectedSourceCode(pathExpectedBeanImplResult));\n        getPortableGenerationResult().setExpectedCode(getExpectedSourceCode(pathExpectedPortableImplResult));\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(getBeanGenerationResult().getActualCode());\n        assertNotNull(getPortableGenerationResult().getExpectedCode());\n        assertEquals(getBeanGenerationResult().getExpectedCode(),\n                     getBeanGenerationResult().getActualCode());\n        assertEquals(getPortableGenerationResult().getExpectedCode(),\n                     getPortableGenerationResult().getActualCode());\n    }\n\n    private Result getBeanGenerationResult() {\n        return results.get(0);\n    }\n\n    private Result getPortableGenerationResult() {\n        return results.get(1);\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/resources/org/uberfire/ext/preferences/processors/MyPreference.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\nimport org.uberfire.preferences.shared.impl.validation.NotEmptyValidator;\n\n@WorkbenchPreference(identifier = \"MyPreference\",\n        bundleKey = \"MyPreference.Label\")\npublic class MyPreference implements BasePreference<MyPreference> {\n\n    @Property(bundleKey = \"MyPreference.Text\",\n            helpBundleKey = \"MyPreference.Text\",\n            validators = NotEmptyValidator.class)\n    String text;\n\n    @Property(formType = PropertyFormType.BOOLEAN,\n            bundleKey = \"MyPreference.SendReports\")\n    boolean sendReports;\n\n    @Property(formType = PropertyFormType.COLOR,\n            bundleKey = \"MyPreference.BackgroundColor\")\n    String backgroundColor;\n\n    @Property(formType = PropertyFormType.NATURAL_NUMBER,\n            bundleKey = \"MyPreference.Age\")\n    int age;\n\n    @Property(formType = PropertyFormType.SECRET_TEXT,\n            bundleKey = \"MyPreference.Password\",\n            validators = NotEmptyValidator.class)\n    String password;\n\n    @Property(bundleKey = \"MyPreference.MyInnerPreference\")\n    MyInnerPreference myInnerPreference;\n\n    @Property(shared = true, bundleKey = \"MyPreference.MySharedPreference\")\n    MySharedPreference mySharedPreference;\n\n    @Override\n    public MyPreference defaultValue(final MyPreference defaultValue) {\n        defaultValue.text = \"text\";\n        defaultValue.sendReports = true;\n        defaultValue.backgroundColor = \"ABCDEF\";\n        defaultValue.age = 27;\n        defaultValue.password = \"password\";\n        defaultValue.myInnerPreference.text = \"text\";\n        defaultValue.mySharedPreference.text = \"text\";\n\n        return defaultValue;\n    }\n}"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/resources/org/uberfire/ext/preferences/processors/expected/MyPreferenceBeanGeneratedImpl.expected",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.annotation.Generated;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.PreferenceScope;\nimport org.uberfire.preferences.shared.bean.BasePreferenceBean;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.bean.PreferenceBeanStore;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\n@Generated(\"org.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\")\n/*\n* WARNING! This class is generated. Do not modify.\n*/\npublic class MyPreferenceBeanGeneratedImpl extends MyPreference implements BasePreferenceBean<MyPreference> {\n\n    private PreferenceBeanStore store;\n    \n    private PreferenceScopeResolutionStrategy resolutionStrategy;\n\n    @Inject\n    public MyPreferenceBeanGeneratedImpl( final PreferenceBeanStore store,\n                               @Customizable final PreferenceScopeResolutionStrategy resolutionStrategy ) {\n        this.store = store;\n        this.resolutionStrategy = resolutionStrategy;\n    }\n\n    @Override\n    public void load() {\n        load( ( ParameterizedCommand<Throwable> ) null );\n    }\n\n    @Override\n    public void load( final ParameterizedCommand<Throwable> errorCallback ) {\n        load( ( ParameterizedCommand<MyPreference> ) null, errorCallback );\n    }\n\n    @Override\n    public void load( final ParameterizedCommand<MyPreference> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        final MyPreferenceBeanGeneratedImpl preferenceBean = this;\n\n        store.load( new MyPreferencePortableGeneratedImpl(),\n                    getLoadSuccessCallback( successCallback ),\n                    errorCallback );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy ) {\n        load( customScopeResolutionStrategy, null );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        load( customScopeResolutionStrategy, null, errorCallback );\n    }\n\n    @Override\n    public void load( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<MyPreference> successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        final MyPreferenceBeanGeneratedImpl preferenceBean = this;\n\n        store.load( new MyPreferencePortableGeneratedImpl(),\n                    customScopeResolutionStrategy,\n                    getLoadSuccessCallback( successCallback ),\n                    errorCallback );\n    }\n\n    private ParameterizedCommand<BasePreferencePortable<MyPreference>> getLoadSuccessCallback( final ParameterizedCommand<MyPreference> successCallback ) {\n        final MyPreferenceBeanGeneratedImpl preferenceBean = this;\n\n        return new ParameterizedCommand<BasePreferencePortable<MyPreference>>() {\n            @Override\n            public void execute( final BasePreferencePortable<MyPreference> portablePreference ) {\n                copy( (MyPreferencePortableGeneratedImpl) portablePreference, preferenceBean );\n                if ( successCallback != null ) {\n                    successCallback.execute( preferenceBean );\n                }\n            }\n        };\n    }\n\n    private void copy( final MyPreference from,\n                       final MyPreference to ) {\n        to.text = from.text;\n        to.sendReports = from.sendReports;\n        to.backgroundColor = from.backgroundColor;\n        to.age = from.age;\n        to.password = from.password;\n        to.myInnerPreference = from.myInnerPreference;\n        to.mySharedPreference = from.mySharedPreference;\n    }\n\n    @Override\n    public void save() {\n        save( ( ParameterizedCommand<Throwable> ) null );\n    }\n\n    @Override\n    public void save( final ParameterizedCommand<Throwable> errorCallback ) {\n        save( ( Command ) null, errorCallback );\n    }\n\n    @Override\n    public void save( final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    successCallback,\n                    errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy ) {\n        save( customScopeResolutionStrategy, null );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        save( customScopeResolutionStrategy, null, errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScopeResolutionStrategyInfo customScopeResolutionStrategy,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    customScopeResolutionStrategy,\n                    successCallback,\n                    errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope ) {\n        save( customScope, null );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        save( customScope, null, errorCallback );\n    }\n\n    @Override\n    public void save( final PreferenceScope customScope,\n                      final Command successCallback,\n                      final ParameterizedCommand<Throwable> errorCallback ) {\n        store.save( createPortableCopy(),\n                    customScope,\n                    successCallback,\n                    errorCallback );\n    }\n\n    private BasePreferencePortable<MyPreference> createPortableCopy() {\n        MyPreferencePortableGeneratedImpl portablePreference = new MyPreferencePortableGeneratedImpl();\n\n        copy( this, portablePreference );\n\n        return portablePreference;\n    }\n}\n"
  },
  {
    "path": "uberfire-preferences/uberfire-preferences-processors/src/test/resources/org/uberfire/ext/preferences/processors/expected/MyPreferencePortableGeneratedImpl.expected",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ext.preferences.processors;\n\nimport java.lang.RuntimeException;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.Generated;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.preferences.shared.annotations.PortablePreference;\nimport org.uberfire.preferences.shared.bean.BasePreferencePortable;\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.PropertyValidator;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Portable( mapSuperTypes = true )\n@PortablePreference\n@Generated(\"org.uberfire.ext.preferences.processors.WorkbenchPreferenceProcessor\")\n/*\n* WARNING! This class is generated. Do not modify.\n*/\npublic class MyPreferencePortableGeneratedImpl extends MyPreference implements BasePreferencePortable<MyPreference> {\n\n    public MyPreferencePortableGeneratedImpl() {\n        this.myInnerPreference = new org.uberfire.ext.preferences.processors.MyInnerPreferencePortableGeneratedImpl();\n        this.mySharedPreference = new org.uberfire.ext.preferences.processors.MySharedPreferencePortableGeneratedImpl();\n    }\n\n    public MyPreferencePortableGeneratedImpl( @MapsTo(\"text\") java.lang.String text, @MapsTo(\"sendReports\") boolean sendReports, @MapsTo(\"backgroundColor\") java.lang.String backgroundColor, @MapsTo(\"age\") int age, @MapsTo(\"password\") java.lang.String password, @MapsTo(\"myInnerPreference\") org.uberfire.ext.preferences.processors.MyInnerPreference myInnerPreference, @MapsTo(\"mySharedPreference\") org.uberfire.ext.preferences.processors.MySharedPreference mySharedPreference ) {\n        this.text = text;\n        this.sendReports = sendReports;\n        this.backgroundColor = backgroundColor;\n        this.age = age;\n        this.password = password;\n        this.myInnerPreference = myInnerPreference;\n        this.mySharedPreference = mySharedPreference;\n    }\n\n    @Override\n    public Class<MyPreference> getPojoClass() {\n        return MyPreference.class;\n    }\n\n    @Override\n    public String identifier() {\n        return \"MyPreference\";\n    }\n\n    @Override\n    public String[] parents() {\n        return new String[] { \"\" };\n    }\n\n    @Override\n    public String bundleKey() {\n        return \"MyPreference.Label\";\n    }\n\n    @Override\n    public void set( String property, Object value ) {\n        if ( property.equals( \"text\" ) ) {\n            text = (java.lang.String) value;\n        } else\n        if ( property.equals( \"sendReports\" ) ) {\n            sendReports = (boolean) value;\n        } else\n        if ( property.equals( \"backgroundColor\" ) ) {\n            backgroundColor = (java.lang.String) value;\n        } else\n        if ( property.equals( \"age\" ) ) {\n            age = (int) value;\n        } else\n        if ( property.equals( \"password\" ) ) {\n            password = (java.lang.String) value;\n        } else\n        {\n            throw new RuntimeException( \"Unknown property: \" + property );\n        }\n    }\n\n    @Override\n    public Object get( String property ) {\n        if ( property.equals( \"text\" ) ) {\n            return text;\n        } else\n        if ( property.equals( \"sendReports\" ) ) {\n            return sendReports;\n        } else\n        if ( property.equals( \"backgroundColor\" ) ) {\n            return backgroundColor;\n        } else\n        if ( property.equals( \"age\" ) ) {\n            return age;\n        } else\n        if ( property.equals( \"password\" ) ) {\n            return password;\n        } else\n        {\n            throw new RuntimeException( \"Unknown property: \" + property );\n        }\n    }\n\n    @Override\n    public Map<String, PropertyFormType> getPropertiesTypes() {\n        Map<String, PropertyFormType> propertiesTypes = new HashMap<>();\n\n        propertiesTypes.put( \"text\", PropertyFormType.TEXT);\n        propertiesTypes.put( \"sendReports\", PropertyFormType.BOOLEAN);\n        propertiesTypes.put( \"backgroundColor\", PropertyFormType.COLOR);\n        propertiesTypes.put( \"age\", PropertyFormType.NATURAL_NUMBER);\n        propertiesTypes.put( \"password\", PropertyFormType.SECRET_TEXT);\n\n        return propertiesTypes;\n    }\n\n    @Override\n    public Map<String, List<PropertyValidator>> getPropertiesValidators() {\n        Map<String, List<PropertyValidator>> validatorsByProperty = new HashMap<>();\n\n        List<PropertyValidator> validatorsText = new ArrayList<>();\n        validatorsText.add(new org.uberfire.preferences.shared.impl.validation.NotEmptyValidator());\n        validatorsByProperty.put(\"text\", validatorsText);\n\n        List<PropertyValidator> validatorsPassword = new ArrayList<>();\n        validatorsPassword.add(new org.uberfire.preferences.shared.impl.validation.NotEmptyValidator());\n        validatorsByProperty.put(\"password\", validatorsPassword);\n\n\n        return validatorsByProperty;\n    }\n\n    @Override\n    public boolean equals( final Object o ) {\n        if ( this == o ) {\n            return true;\n        }\n        if ( o == null || getClass() != o.getClass() ) {\n            return false;\n        }\n\n        final MyPreferencePortableGeneratedImpl that = (MyPreferencePortableGeneratedImpl) o;\n\n        if ( text != null ? !text.equals( that.text ) : that.text != null ) {\n            return false;\n        }\n        if ( sendReports != that.sendReports ) {\n            return false;\n        }\n        if ( backgroundColor != null ? !backgroundColor.equals( that.backgroundColor ) : that.backgroundColor != null ) {\n            return false;\n        }\n        if ( age != that.age ) {\n            return false;\n        }\n        if ( password != null ? !password.equals( that.password ) : that.password != null ) {\n            return false;\n        }\n        if ( myInnerPreference != null ? !myInnerPreference.equals( that.myInnerPreference ) : that.myInnerPreference != null ) {\n            return false;\n        }\n        if ( mySharedPreference != null ? !mySharedPreference.equals( that.mySharedPreference ) : that.mySharedPreference != null ) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = 0;\n\n        result = 31 * result + ( text != null ? text.hashCode() : 0 );\n        result = ~~result;\n        result = 31 * result + java.lang.Boolean.hashCode( sendReports );\n        result = ~~result;\n        result = 31 * result + ( backgroundColor != null ? backgroundColor.hashCode() : 0 );\n        result = ~~result;\n        result = 31 * result + java.lang.Integer.hashCode( age );\n        result = ~~result;\n        result = 31 * result + ( password != null ? password.hashCode() : 0 );\n        result = ~~result;\n        result = 31 * result + ( myInnerPreference != null ? myInnerPreference.hashCode() : 0 );\n        result = ~~result;\n        result = 31 * result + ( mySharedPreference != null ? mySharedPreference.hashCode() : 0 );\n        result = ~~result;\n\n        return result;\n    }\n\n    @Override\n    public boolean isPersistable() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-project/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-project</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Project</name>\n  <description>UberFire - Project</description>\n\n  <modules>\n    <module>uberfire-project-api</module>\n    <module>uberfire-project-backend</module>\n    <module>uberfire-project-builder</module>\n    <module>uberfire-project-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-project</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-project-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Project API</name>\n  <description>UberFire - Project API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workingset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-project-datamodel-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/events/InvalidateDMOModuleCacheEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.builder.events;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Event to invalidate all entries in a DataModelOracleCache for the Project containing the given resource.\n * The resource path is used within the Event as all editors that could affect the validity of a DataModelOracleCache\n * entry will know their resource's Path but not the Project path without performing a server round-trip to resolve such.\n */\n@Portable\npublic class InvalidateDMOModuleCacheEvent {\n\n    private Path resourcePath;\n\n    private Module module;\n\n    private SessionInfo sessionInfo;\n\n    public InvalidateDMOModuleCacheEvent() {\n    }\n\n    public InvalidateDMOModuleCacheEvent(SessionInfo sessionInfo, Module module, Path resourcePath) {\n        checkNotNull(\"sessionInfo\", sessionInfo);\n        checkNotNull(\"project\",\n                     module);\n        checkNotNull(\"resourcePath\", resourcePath);\n        this.sessionInfo = sessionInfo;\n        this.module = module;\n        this.resourcePath = resourcePath;\n    }\n\n    public Path getResourcePath() {\n        return this.resourcePath;\n    }\n\n    public SessionInfo getSessionInfo() {\n        return sessionInfo;\n    }\n\n    public Module getModule() {\n        return module;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/events/InvalidateDMOPackageCacheEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.builder.events;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Event to invalidate an entry in a DataModelOracleCache. The resource path is used within the Event\n * as all editors that could affect the validity of a DataModelOracleCache entry will know their resource's\n * Path but not the Project path without performing a server round-trip to resolve such.\n */\n@Portable\npublic class InvalidateDMOPackageCacheEvent {\n\n    private Path resourcePath;\n\n    public InvalidateDMOPackageCacheEvent() {\n    }\n\n    public InvalidateDMOPackageCacheEvent(final Path resourcePath) {\n        PortablePreconditions.checkNotNull(\"resourcePath\",\n                                           resourcePath);\n        this.resourcePath = resourcePath;\n    }\n\n    public Path getResourcePath() {\n        return this.resourcePath;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/model/BuildMessage.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.builder.model;\n\nimport java.io.Serializable;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class BuildMessage implements Serializable {\n\n    private long id;\n    private Level level;\n    private Path path;\n    private int line;\n    private int column;\n    private String text;\n\n    public void setId(long id) {\n        this.id = id;\n    }\n\n    public void setLevel(final Level level) {\n        this.level = level;\n    }\n\n    public void setPath(final Path path) {\n        this.path = path;\n    }\n\n    public void setLine(final int line) {\n        this.line = line;\n    }\n\n    public void setColumn(final int column) {\n        this.column = column;\n    }\n\n    public void setText(final String text) {\n        this.text = text;\n    }\n\n    public long getId() {\n        return id;\n    }\n\n    public Level getLevel() {\n        return level;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    public int getLine() {\n        return line;\n    }\n\n    public int getColumn() {\n        return column;\n    }\n\n    public String getText() {\n        return text;\n    }\n\n    /**\n     * Check whether two Messages are equivalent. Property \"id\" is not used in the comparison as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof BuildMessage)) {\n            return false;\n        }\n\n        BuildMessage that = (BuildMessage) o;\n\n        if (column != that.column) {\n            return false;\n        }\n        if (line != that.line) {\n            return false;\n        }\n        if (level != that.level) {\n            return false;\n        }\n        if (path != null ? !path.equals(that.path) : that.path != null) {\n            return false;\n        }\n        if (text != null ? !text.equals(that.text) : that.text != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * HashCode implementation fo Messages. Property \"id\" is not used in the generation as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public int hashCode() {\n        int result = level != null ? level.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (path != null ? path.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + line;\n        result = ~~result;\n        result = 31 * result + column;\n        result = ~~result;\n        result = 31 * result + (text != null ? text.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/model/BuildResults.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.builder.model;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.shared.message.Level;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class BuildResults {\n\n    private GAV gav;\n    private ArrayList<BuildMessage> messages = new ArrayList<BuildMessage>();\n    private Map<String, String> parameters = new HashMap<>();\n    private String rootPathURI;\n\n    public BuildResults() {\n        //Marshalling\n    }\n\n    public BuildResults(final GAV gav) {\n        this.gav = gav;\n    }\n\n    public GAV getGAV() {\n        return gav;\n    }\n\n    public List<BuildMessage> getMessages() {\n        return Collections.unmodifiableList(messages);\n    }\n\n    public List<BuildMessage> getErrorMessages() {\n        return Collections.unmodifiableList(filterMessages(Level.ERROR));\n    }\n\n    public List<BuildMessage> getWarningMessages() {\n        return Collections.unmodifiableList(filterMessages(Level.WARNING));\n    }\n\n    public List<BuildMessage> getInformationMessages() {\n        return Collections.unmodifiableList(filterMessages(Level.INFO));\n    }\n\n    private List<BuildMessage> filterMessages(final Level level) {\n        final List<BuildMessage> filteredMessages = new ArrayList<BuildMessage>();\n        for (BuildMessage msg : messages) {\n            if (msg.getLevel() == level) {\n                filteredMessages.add(msg);\n            }\n        }\n        return filteredMessages;\n    }\n\n    public void addBuildMessage(final BuildMessage message) {\n        this.messages.add(message);\n    }\n\n    public void addBuildMessage(final int index,\n                                final BuildMessage message) {\n        this.messages.add(index,\n                          message);\n    }\n\n    public void addAllBuildMessages(List<BuildMessage> buildMessages) {\n        messages.addAll(buildMessages);\n    }\n\n\tpublic Map<String, String> getParameters() {\n\t\treturn parameters;\n\t}\n\t\n\tpublic void addParameter(String name, String value) {\n\t\tthis.parameters.put(name, value);\n\t}\n\t\n\tpublic String getParameter(String name) {\n\t\treturn this.parameters.get(name);\n\t}\n\n    public String getRootPathURI() {\n        return rootPathURI;\n    }\n\n    public void setRootPathURI(String rootPathURI) {\n        this.rootPathURI = rootPathURI;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/model/IncrementalBuildResults.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.builder.model;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class IncrementalBuildResults {\n\n    private GAV gav;\n    private ArrayList<BuildMessage> addedMessages = new ArrayList<BuildMessage>();\n    private ArrayList<BuildMessage> removedMessages = new ArrayList<BuildMessage>();\n    private Map<String, String> parameters = new HashMap<>();\n    private String rootPathURI;\n\n    public IncrementalBuildResults() {\n        //Marshalling\n    }\n\n    public IncrementalBuildResults(final GAV gav) {\n        this.gav = gav;\n    }\n\n    public GAV getGAV() {\n        return gav;\n    }\n\n    public List<BuildMessage> getAddedMessages() {\n        return Collections.unmodifiableList(addedMessages);\n    }\n\n    public List<BuildMessage> getRemovedMessages() {\n        return Collections.unmodifiableList(removedMessages);\n    }\n\n    public void addAddedMessage(final BuildMessage message) {\n        this.addedMessages.add(message);\n    }\n\n    public void addRemovedMessage(final BuildMessage message) {\n        this.removedMessages.add(message);\n    }\n\n    public void addAllAddedMessages(List<BuildMessage> buildMessages) {\n        addedMessages.addAll(buildMessages);\n    }\n\n    public void addAllRemovedMessages(List<BuildMessage> buildMessages) {\n        removedMessages.addAll(buildMessages);\n    }\n\n    public Map<String, String> getParameters() {\n        return parameters;\n    }\n\n    public void addParameter(String name, String value) {\n        this.parameters.put(name, value);\n    }\n\n    public String getParameter(String name) {\n        return this.parameters.get(name);\n    }\n\n    public String getRootPathURI() {\n        return rootPathURI;\n    }\n\n    public void setRootPathURI(String rootPathURI) {\n        this.rootPathURI = rootPathURI;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/service/BuildService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.builder.service;\n\nimport java.util.Collection;\nimport java.util.Map;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.events.ResourceChange;\n\n@Remote\npublic interface BuildService {\n\n    /**\n     * Full build without deployment\n     * @param module\n     */\n    BuildResults build(final Module module);\n\n    /**\n     * Full build with deployment\n     * @param module\n     */\n    BuildResults buildAndDeploy(final Module module);\n\n    /**\n     * Full build with forced deployment to Maven. Pre-existing artifacts with the same GAV will be overwritten.\n     * @param module Module to be built\n     * @param mode The deployment mode\n     */\n    BuildResults buildAndDeploy(final Module module,\n                                final DeploymentMode mode);\n\n    /**\n     * Full build with deployment with ability to suppress any post operations handlers to ensure\n     * that only build and deploy was invoked\n     * @param module\n     */\n    BuildResults buildAndDeploy(final Module module,\n                                final boolean suppressHandlers);\n\n    /**\n     * Full build with forced deployment to Maven. Pre-existing artifacts with the same GAV will be overwritten. This\n     * method has the ability to suppress any post operations handlers to ensure * that only build and deploy is invoked\n     * @param module Module to be built\n     * @param suppressHandlers true to ignore post-processing\n     * @param mode The deployment mode\n     */\n    BuildResults buildAndDeploy(final Module module,\n                                final boolean suppressHandlers,\n                                final DeploymentMode mode);\n\n    /**\n     * Check whether a Module has been built\n     * @param module\n     * @return\n     */\n    boolean isBuilt(final Module module);\n\n    /**\n     * Add a Package resource to the build.\n     * @param resource\n     */\n    IncrementalBuildResults addPackageResource(final Path resource);\n\n    /**\n     * Remove a Package resource from the build.\n     * @param resource\n     */\n    IncrementalBuildResults deletePackageResource(final Path resource);\n\n    /**\n     * Update an existing Package resource in the build.\n     * @param resource\n     */\n    IncrementalBuildResults updatePackageResource(final Path resource);\n\n    /**\n     * Process a batch of changes to a Module's resources.\n     * @param module\n     * @param changes\n     */\n    IncrementalBuildResults applyBatchResourceChanges(final Module module,\n                                                      final Map<Path, Collection<ResourceChange>> changes);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/service/BuildValidationHelper.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.builder.service;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.validation.model.ValidationMessage;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Helper to provide validation of assets that are not validated by KIE, or need additional validation\n */\npublic interface BuildValidationHelper {\n\n    /**\n     * Does this helper support the specified path\n     * @param path\n     * @return\n     */\n    boolean accepts(final Path path);\n\n    /**\n     * Validate the content at the specified Path\n     * @param path\n     * @return\n     */\n    List<ValidationMessage> validate(final Path path);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/builder/service/PostBuildHandler.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.builder.service;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\n\n/**\n * Provides hook for build and deploy operation to be notified when both build and deploy have been executed.\n * Allows to take action after build and deploy to maven and report back its status by adding messages to\n * <code>buildResults</code>\n */\npublic interface PostBuildHandler {\n\n    /**\n     * Process custom logic and all errors should be reported via <code>buildResults.addBuildMessage()</code>\n     * @param buildResults\n     */\n    void process(BuildResults buildResults);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/categories/Decision.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.categories;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Decision extends Category {\n\n    private static final String CATEGORY_NAME = \"DECISION\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/categories/Form.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.categories;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Form extends Category {\n\n    private static final String CATEGORY_NAME = \"FORM\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/categories/Model.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.categories;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Model extends Category {\n\n    private static final String CATEGORY_NAME = \"MODEL\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/categories/Optimization.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.categories;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Optimization extends Category {\n\n    private static final String CATEGORY_NAME = \"OPTIMIZATION\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/categories/Process.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.categories;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.workbench.category.Category;\n\n@ApplicationScoped\npublic class Process extends Category {\n\n    private static final String CATEGORY_NAME = \"PROCESS\";\n\n    @Override\n    public String getName() {\n        return CATEGORY_NAME;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/context/ProjectContextChangeHandle.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.context;\n\npublic class ProjectContextChangeHandle {\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/context/WorkspaceProjectContextChangeEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.context;\n\nimport java.util.Objects;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.common.client.api.annotations.LocalEvent;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * <p>An event raised when the Project Context changes.\n *\n * <p>This must be {@link LocalEvent @LocalEvent} because it should not be\n * observed on the server when fired from the client, but it is {@link Portable @Portable} because\n * it is used as a return type from some RPC methods.\n */\n@Portable\n@LocalEvent\npublic class WorkspaceProjectContextChangeEvent {\n\n    private final OrganizationalUnit ou;\n    private final WorkspaceProject workspaceProject;\n    private final Module module;\n    private final Package pkg;\n\n    public WorkspaceProjectContextChangeEvent() {\n        ou = null;\n        workspaceProject = null;\n        module = null;\n        pkg = null;\n    }\n\n    public WorkspaceProjectContextChangeEvent(final OrganizationalUnit ou) {\n        this.ou = ou;\n        this.workspaceProject = null;\n        this.module = null;\n        this.pkg = null;\n    }\n\n    public WorkspaceProjectContextChangeEvent(final WorkspaceProject workspaceProject) {\n        this(workspaceProject,\n             null);\n    }\n\n    public WorkspaceProjectContextChangeEvent(final WorkspaceProject workspaceProject,\n                                              final Module module) {\n        this(workspaceProject,\n             module,\n             null);\n    }\n\n    public WorkspaceProjectContextChangeEvent(final WorkspaceProject workspaceProject,\n                                              final Module module,\n                                              final Package pkg) {\n        this.ou = workspaceProject != null ? workspaceProject.getOrganizationalUnit() : null;\n        this.workspaceProject = workspaceProject;\n        this.module = module;\n        this.pkg = pkg;\n    }\n\n    public OrganizationalUnit getOrganizationalUnit() {\n        return ou;\n    }\n\n    public WorkspaceProject getWorkspaceProject() {\n        return workspaceProject;\n    }\n\n    public Module getModule() {\n        return module;\n    }\n\n    public Package getPackage() {\n        return pkg;\n    }\n\n    @Override\n    public int hashCode() {\n        final int prime = 31;\n        int result = 1;\n        result = prime * result + ((module == null) ? 0 : module.hashCode());\n        result = prime * result + ((ou == null) ? 0 : ou.hashCode());\n        result = prime * result + ((pkg == null) ? 0 : pkg.hashCode());\n        result = prime * result + ((workspaceProject == null) ? 0 : workspaceProject.hashCode());\n        return result;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (this == obj) {\n            return true;\n        } else if (obj == null || getClass() != obj.getClass()) {\n            return false;\n        } else {\n            WorkspaceProjectContextChangeEvent other = (WorkspaceProjectContextChangeEvent) obj;\n            return Objects.equals(module, other.module)\n                    && Objects.equals(ou, other.ou)\n                    && Objects.equals(pkg, other.pkg)\n                    && Objects.equals(workspaceProject, other.workspaceProject);\n        }\n    }\n\n    @Override\n    public String toString() {\n        return \"WorkspaceProjectContextChangeEvent [ou=\" + ou + \", workspaceProject=\" + workspaceProject + \", module=\" + module + \", pkg=\" + pkg + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/context/WorkspaceProjectContextChangeHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.context;\n\npublic interface WorkspaceProjectContextChangeHandler {\n\n    void onChange(WorkspaceProjectContextChangeEvent previous, WorkspaceProjectContextChangeEvent current);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/editor/type/POMResourceTypeDefinition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.editor.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n@ApplicationScoped\npublic class POMResourceTypeDefinition\n        implements ResourceTypeDefinition {\n\n    private Category category;\n\n    public POMResourceTypeDefinition() {\n    }\n\n    @Inject\n    public POMResourceTypeDefinition(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"pom xml\";\n    }\n\n    @Override\n    public String getDescription() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"pom\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"xml\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return getPrefix() + \".\" + getSuffix();\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().equals(getPrefix() + \".\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/DeleteModuleEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * An event representing creation of a new Module\n */\n@Portable\npublic class DeleteModuleEvent {\n\n    private Module module;\n\n    public DeleteModuleEvent() {\n    }\n\n    public DeleteModuleEvent(final Module module) {\n        this.module = module;\n    }\n\n    public Module getModule() {\n        return module;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/ModuleUpdatedEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * An event representing a Module update.\n */\n@Portable\npublic class ModuleUpdatedEvent {\n\n    private Module oldModule;\n    private Module newModule;\n\n    public ModuleUpdatedEvent() {\n    }\n\n    public ModuleUpdatedEvent(final Module oldModule,\n                              final Module newModule) {\n        this.oldModule = oldModule;\n        this.newModule = newModule;\n    }\n\n    public Module getOldModule() {\n        return oldModule;\n    }\n\n    public Module getNewModule() {\n        return newModule;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/NewModuleEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * An event representing creation of a new Module\n */\n@Portable\npublic class NewModuleEvent {\n\n    private Module module;\n    private String sessionId;\n    private String identity;\n\n    public NewModuleEvent() {\n    }\n\n    public NewModuleEvent(final Module module,\n                          final String sessionId,\n                          final String identity) {\n        this.module = module;\n        this.sessionId = sessionId;\n        this.identity = identity;\n    }\n\n    public Module getModule() {\n        return module;\n    }\n\n    public String getSessionId() {\n        return sessionId;\n    }\n\n    public String getIdentity() {\n        return identity;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/NewPackageEvent.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.common.services.project.model.Package;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * An event representing creation of a new Package\n */\n@Portable\npublic class NewPackageEvent {\n\n    private Package pkg;\n\n    public NewPackageEvent() {\n    }\n\n    public NewPackageEvent(final Package pkg) {\n        this.pkg = pkg;\n    }\n\n    public Package getPackage() {\n        return pkg;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/NewProjectEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class NewProjectEvent {\n\n    private WorkspaceProject workspaceProject;\n\n    public NewProjectEvent() {\n    }\n\n    public NewProjectEvent(final WorkspaceProject workspaceProject) {\n        this.workspaceProject = workspaceProject;\n    }\n\n    public WorkspaceProject getWorkspaceProject() {\n        return workspaceProject;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/events/RepositoryContributorsUpdatedEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.events;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class RepositoryContributorsUpdatedEvent {\n\n    private Repository repository;\n\n    public RepositoryContributorsUpdatedEvent() {\n    }\n\n    public RepositoryContributorsUpdatedEvent(@MapsTo(\"repository\") final Repository repository) {\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Build.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Build {\n\n    private List<Plugin> plugins = new ArrayList<>();\n\n    public List<Plugin> getPlugins() {\n        return plugins;\n    }\n\n    public void setPlugins(List<Plugin> plugins) {\n        this.plugins = plugins;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Dependencies.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.ListIterator;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static java.util.stream.Collectors.toList;\n\n@Portable\npublic class Dependencies\n        implements List<Dependency> {\n\n    private final List<Dependency> dependencies;\n\n    public Dependencies() {\n        dependencies = new ArrayList<>();\n    }\n\n    public Dependencies(final List<Dependency> dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    public boolean containsDependency(final GAV other) {\n        for (Dependency dependency : dependencies) {\n            if (dependency.isGAVEqual(other)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public Dependency get(final GAV gav) {\n        for (Dependency dependency : dependencies) {\n            if (dependency.isGAVEqual(gav)) {\n                return dependency;\n            }\n        }\n\n        return null;\n    }\n\n    public Collection<GAV> getGavs(final String... scopes) {\n        final List<String> scopesList = Arrays.asList(scopes);\n\n        if (scopesList.isEmpty()) {\n            return new ArrayList<>(dependencies);\n        } else {\n            return dependencies.stream()\n                    .filter(dep -> scopesList.contains(dep.getScope()))\n                    .collect(toList());\n        }\n    }\n\n    public Collection<GAV> getCompileScopedGavs() {\n        return getGavs(\"compile\",\n                       // When scope is not declared (dependency.getScope() == null), maven considers it to be compile scope\n                       null\n        );\n    }\n\n    @Override\n    public int size() {\n        return dependencies.size();\n    }\n\n    @Override\n    public boolean isEmpty() {\n        return dependencies.isEmpty();\n    }\n\n    @Override\n    public boolean contains(Object o) {\n        return dependencies.contains(o);\n    }\n\n    @Override\n    public Iterator<Dependency> iterator() {\n        return dependencies.iterator();\n    }\n\n    @Override\n    public Object[] toArray() {\n        return dependencies.toArray();\n    }\n\n    @Override\n    public <T> T[] toArray(T[] ts) {\n        return dependencies.toArray(ts);\n    }\n\n    @Override\n    public boolean add(Dependency dependency) {\n        return dependencies.add(dependency);\n    }\n\n    @Override\n    public boolean remove(Object o) {\n        return dependencies.remove(o);\n    }\n\n    @Override\n    public boolean containsAll(Collection<?> collection) {\n        return dependencies.containsAll(collection);\n    }\n\n    @Override\n    public boolean addAll(Collection<? extends Dependency> collection) {\n        return dependencies.addAll(collection);\n    }\n\n    @Override\n    public boolean addAll(int i,\n                          Collection<? extends Dependency> collection) {\n        return dependencies.addAll(i,\n                                   collection);\n    }\n\n    @Override\n    public boolean removeAll(Collection<?> collection) {\n        return dependencies.removeAll(collection);\n    }\n\n    @Override\n    public boolean retainAll(Collection<?> collection) {\n        return dependencies.retainAll(collection);\n    }\n\n    @Override\n    public void clear() {\n        dependencies.clear();\n    }\n\n    @Override\n    public Dependency get(int i) {\n        return dependencies.get(i);\n    }\n\n    @Override\n    public Dependency set(int i,\n                          Dependency dependency) {\n        return dependencies.set(i, dependency);\n    }\n\n    @Override\n    public void add(int i, Dependency dependency) {\n        dependencies.add(i, dependency);\n    }\n\n    @Override\n    public Dependency remove(int i) {\n        return dependencies.remove(i);\n    }\n\n    @Override\n    public int indexOf(Object o) {\n        return dependencies.indexOf(o);\n    }\n\n    @Override\n    public int lastIndexOf(Object o) {\n        return dependencies.lastIndexOf(o);\n    }\n\n    @Override\n    public ListIterator<Dependency> listIterator() {\n        return dependencies.listIterator();\n    }\n\n    @Override\n    public ListIterator<Dependency> listIterator(int i) {\n        return dependencies.listIterator(i);\n    }\n\n    @Override\n    public List<Dependency> subList(int i,\n                                    int i1) {\n        return dependencies.subList(i, i1);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Dependency.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Dependency\n        extends GAV {\n\n    private String scope;\n\n    public Dependency() {\n    }\n\n    public Dependency(GAV gav) {\n        super(gav.getGroupId(),\n              gav.getArtifactId(),\n              gav.getVersion());\n    }\n\n    public String getScope() {\n        return scope;\n    }\n\n    public void setScope(String scope) {\n        this.scope = scope;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/GAV.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport java.io.Serializable;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class GAV implements Serializable {\n\n    private String groupId;\n    private String artifactId;\n    private String version;\n\n    public GAV() {\n        this(null,\n             null,\n             null);\n    }\n\n    public GAV(final String gavString) {\n        String[] split = checkNotNull(\"gavString\", gavString)\n                .split(\":\");\n        if (split.length < 3) {\n            throw new IllegalArgumentException(\"The GAV String must have the form group:artifact:version[:scope] but was '\" + gavString + \"'\");\n        }\n        this.groupId = split[0];\n        this.artifactId = split[1];\n        this.version = split[2];\n    }\n\n    public GAV(final String groupId,\n               final String artifactId,\n               final String version) {\n        this.groupId = groupId;\n        this.artifactId = artifactId;\n        this.version = version;\n    }\n\n    public String getGroupId() {\n        return groupId;\n    }\n\n    public String getArtifactId() {\n        return artifactId;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public void setGroupId(String groupId) {\n        this.groupId = groupId;\n    }\n\n    public void setArtifactId(String artifactId) {\n        this.artifactId = artifactId;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n    }\n\n    @Override\n    public String toString() {\n        return groupId + \":\" + artifactId + \":\" + version;\n    }\n\n    public boolean isGAVEqual(Object o) {\n        return equals(o);\n    }\n\n    public boolean isSnapshot() {\n        return version != null && version.endsWith(\"-SNAPSHOT\");\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof GAV)) {\n            return false;\n        }\n\n        GAV gav = (GAV) o;\n\n        if (artifactId != null ? !artifactId.equals(gav.artifactId) : gav.artifactId != null) {\n            return false;\n        }\n        if (groupId != null ? !groupId.equals(gav.groupId) : gav.groupId != null) {\n            return false;\n        }\n        if (version != null ? !version.equals(gav.version) : gav.version != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = groupId != null ? groupId.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (artifactId != null ? artifactId.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (version != null ? version.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/HasListFormComboPanelProperties.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\npublic interface HasListFormComboPanelProperties {\n\n    String getName();\n\n    void setName(String name);\n\n    public boolean isDefault();\n\n    void setDefault(boolean theDefault);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/MavenRepository.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class MavenRepository {\n\n    private String id;\n    private String name;\n    private String url;\n\n    public String getId() {\n        return id;\n    }\n\n    public void setId(String id) {\n        this.id = id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getUrl() {\n        return url;\n    }\n\n    public void setUrl(String url) {\n        this.url = url;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        MavenRepository that = (MavenRepository) o;\n\n        if (id != null ? !id.equals(that.id) : that.id != null) {\n            return false;\n        }\n        if (name != null ? !name.equals(that.name) : that.name != null) {\n            return false;\n        }\n        if (url != null ? !url.equals(that.url) : that.url != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id != null ? id.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (name != null ? name.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (url != null ? url.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/MavenRepositoryMetadata.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport java.io.Serializable;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n@Portable\npublic class MavenRepositoryMetadata implements Serializable {\n\n    private String id;\n    private String url;\n    private MavenRepositorySource source;\n\n    public MavenRepositoryMetadata() {\n        //Required for java.io.Serializable\n    }\n\n    public MavenRepositoryMetadata(final @MapsTo(\"id\") String id,\n                                   final @MapsTo(\"url\") String url,\n                                   final @MapsTo(\"source\") MavenRepositorySource source) {\n        this.id = PortablePreconditions.checkNotNull(\"id\",\n                                                     id);\n        this.url = PortablePreconditions.checkNotNull(\"url\",\n                                                      url);\n        this.source = PortablePreconditions.checkNotNull(\"source\",\n                                                         source);\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public MavenRepositorySource getSource() {\n        return source;\n    }\n\n    public String getUrl() {\n        return url;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof MavenRepositoryMetadata)) {\n            return false;\n        }\n\n        MavenRepositoryMetadata that = (MavenRepositoryMetadata) o;\n\n        if (!id.equals(that.id)) {\n            return false;\n        }\n        if (!url.equals(that.url)) {\n            return false;\n        }\n        return source == that.source;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = id.hashCode();\n        result = ~~result;\n        result = 31 * result + url.hashCode();\n        result = ~~result;\n        result = 31 * result + source.hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/MavenRepositorySource.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Sources where a Maven Repository was defined.\n */\n@Portable\npublic enum MavenRepositorySource {\n    LOCAL,\n    PROJECT,\n    SETTINGS,\n    DISTRIBUTION_MANAGEMENT\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Module.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.util.URIUtil;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An item representing a module.\n * Each module has a pom.xml file and a folder it belongs into, it can have a parent and child modules.\n * Note that the child and parent might not be in the same repository.\n */\n@Portable\npublic class Module {\n\n    protected Path rootPath;\n    protected Path pomXMLPath;\n    protected Collection<String> modules = new ArrayList<>();\n    protected POM pom;\n\n    // only loaded when listing projects\n    private int numberOfAssets;\n\n    public Module() {\n        //For Errai-marshalling\n    }\n\n    public Module(final Path rootPath,\n                  final Path pomXMLPath,\n                  final POM pom) {\n        this(rootPath,\n             pomXMLPath);\n        this.pom = checkNotNull(\"pom\", pom);\n    }\n\n    public Module(final Path rootPath,\n                  final Path pomXMLPath,\n                  final POM pom,\n                  final Collection<String> modules) {\n        this(rootPath,\n             pomXMLPath,\n             pom);\n        this.modules = modules;\n    }\n\n    public Module(Path rootPath,\n                  Path pomXMLPath) {\n        this.rootPath = checkNotNull(\"rootPath\", rootPath);\n        this.pomXMLPath = checkNotNull(\"pomXMLPath\", pomXMLPath);\n    }\n\n    public int getNumberOfAssets() {\n        return numberOfAssets;\n    }\n\n    public void setNumberOfAssets(int numberOfAssets) {\n        this.numberOfAssets = numberOfAssets;\n    }\n\n    public Path getRootPath() {\n        return this.rootPath;\n    }\n\n    public Path getPomXMLPath() {\n        return this.pomXMLPath;\n    }\n\n    public String getModuleName() {\n        if (pom != null && pom.getName() != null) {\n            return pom.getName();\n        } else if (pom != null && pom.getGav() != null && pom.getGav().getArtifactId() != null && !pom.getGav().getArtifactId().trim().isEmpty()) {\n            return pom.getGav().getArtifactId();\n        } else {\n            return getRootPath().getFileName();\n        }\n    }\n\n    public String getIdentifier() {\n        return getRootPath().toURI();\n    }\n\n    public String getEncodedIdentifier() {\n        return URIUtil.encodeQueryString(getIdentifier());\n    }\n\n    public Collection<String> getModules() {\n        return modules;\n    }\n\n    public POM getPom() {\n        return pom;\n    }\n\n    public void setPom(POM pom) {\n        this.pom = checkNotNull(\"pom\", pom);\n    }\n\n    @Override\n    public int hashCode() {\n        int hash = 5;\n        hash = 17 * hash + (this.rootPath != null ? this.rootPath.hashCode() : 0);\n        hash = ~~hash;\n        hash = 17 * hash + (this.pomXMLPath != null ? this.pomXMLPath.hashCode() : 0);\n        hash = ~~hash;\n        hash = 17 * hash + (this.pom != null ? this.pom.hashCode() : 0);\n        hash = ~~hash;\n        hash = 17 * hash + (this.modules != null ? this.modules.hashCode() : 0);\n        hash = ~~hash;\n        return hash;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == null) {\n            return false;\n        }\n        if (getClass() != obj.getClass()) {\n            return false;\n        }\n        final Module other = (Module) obj;\n        if (this.rootPath != other.rootPath && (this.rootPath == null || !this.rootPath.equals(other.rootPath))) {\n            return false;\n        }\n        if (this.pomXMLPath != other.pomXMLPath && (this.pomXMLPath == null || !this.pomXMLPath.equals(other.pomXMLPath))) {\n            return false;\n        }\n        if ((this.pom == null) ? (other.pom != null) : !this.pom.equals(other.pom)) {\n            return false;\n        }\n        if (this.modules != other.modules && (this.modules == null || !this.modules.equals(other.modules))) {\n            return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/ModuleRepositories.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n@Portable\npublic class ModuleRepositories {\n\n    private Set<ModuleRepository> repositories;\n\n    public ModuleRepositories() {\n        this.repositories = new HashSet<>();\n    }\n\n    public ModuleRepositories(final @MapsTo(\"repositories\") Set<ModuleRepository> repositories) {\n        this.repositories = repositories;\n    }\n\n    public Set<ModuleRepository> getRepositories() {\n        return repositories;\n    }\n\n    public MavenRepositoryMetadata[] filterByIncluded() {\n        final Set<MavenRepositoryMetadata> filter = new HashSet<>();\n        for (ModuleRepository pr : repositories) {\n            if (pr.isIncluded()) {\n                filter.add(pr.getMetadata());\n            }\n        }\n        final MavenRepositoryMetadata[] aFilter = new MavenRepositoryMetadata[filter.size()];\n        filter.toArray(aFilter);\n        return aFilter;\n    }\n\n    @Portable\n    public static class ModuleRepository {\n\n        private boolean include;\n        private MavenRepositoryMetadata metadata;\n\n        public ModuleRepository(final @MapsTo(\"include\") boolean include,\n                                final @MapsTo(\"metadata\") MavenRepositoryMetadata metadata) {\n            this.include = include;\n            this.metadata = PortablePreconditions.checkNotNull(\"metadata\",\n                                                               metadata);\n        }\n\n        public boolean isIncluded() {\n            return include;\n        }\n\n        public void setIncluded(final boolean include) {\n            this.include = include;\n        }\n\n        public MavenRepositoryMetadata getMetadata() {\n            return metadata;\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (!(o instanceof ModuleRepository)) {\n                return false;\n            }\n\n            ModuleRepository that = (ModuleRepository) o;\n\n            if (include != that.include) {\n                return false;\n            }\n            return metadata.equals(that.metadata);\n        }\n\n        @Override\n        public int hashCode() {\n            int result = (include ? 1 : 0);\n            result = 31 * result + metadata.hashCode();\n            result = ~~result;\n            return result;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/POM.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class POM {\n\n    private static final String MODEL_VERSION = \"4.0.0\";\n\n    private GAV parent;\n    private GAV gav;\n    private String name;\n    private String description;\n    private String url;\n\n    private String packaging;\n\n    private Build build;\n\n    private List<Dependency> dependencies = new ArrayList<>();\n    private List<MavenRepository> repositories = new ArrayList<>();\n    private List<String> modules = new ArrayList<>();\n\n    public POM() {\n        this.gav = new GAV();\n    }\n\n    // Kept this for backwards compatibility\n    public POM(final GAV gav) {\n        this(null,\n             null,\n             null,\n             gav,\n             false);\n    }\n\n    public POM(final String name,\n               final String description,\n               final String url,\n               final GAV gav\n               ) {\n        this(name,\n             description,\n             url,\n             gav,\n             false);\n    }\n\n    public POM(final String name,\n               final String description,\n               final String url,\n               final GAV gav,\n               final boolean multiModule) {\n        this.name = name;\n        this.description = description;\n        this.url = url;\n        this.gav = gav;\n        if (multiModule) {\n            packaging = \"pom\";\n        }\n    }\n\n    public GAV getGav() {\n        return gav;\n    }\n\n    public Dependencies getDependencies() {\n        return new Dependencies(dependencies);\n    }\n\n    public void setDependencies(List<Dependency> dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    public void addRepository(MavenRepository mavenRepository) {\n        repositories.add(mavenRepository);\n    }\n\n    public List<MavenRepository> getRepositories() {\n        return repositories;\n    }\n\n    public String getModelVersion() {\n        return MODEL_VERSION;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public String getUrl() {\n        return url;\n    }\n\n    public void setUrl(String url) {\n        this.url = url;\n    }\n\n    public GAV getParent() {\n        return parent;\n    }\n\n    public void setParent(GAV parent) {\n        this.parent = parent;\n    }\n\n    public List<String> getModules() {\n        return modules;\n    }\n\n    public Build getBuild() {\n        return build;\n    }\n\n    public void setBuild(Build build) {\n        this.build = build;\n    }\n\n    public void setModules(List<String> modules) {\n        this.modules = modules;\n    }\n\n    public boolean isMultiModule() {\n        return \"pom\".equals(packaging);\n    }\n\n    public void setPackaging(String packaging) {\n        this.packaging = packaging;\n    }\n\n    public String getPackaging() {\n        return packaging;\n    }\n\n    public boolean hasParent() {\n        return parent != null;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        POM pom = (POM) o;\n\n        if (packaging != null ? !packaging.equals(pom.packaging) : pom.packaging != null) {\n            return false;\n        }\n        if (dependencies != null ? !dependencies.equals(pom.dependencies) : pom.dependencies != null) {\n            return false;\n        }\n        if (description != null ? !description.equals(pom.description) : pom.description != null) {\n            return false;\n        }\n        if (gav != null ? !gav.equals(pom.gav) : pom.gav != null) {\n            return false;\n        }\n        if (modules != null ? !modules.equals(pom.modules) : pom.modules != null) {\n            return false;\n        }\n        if (name != null ? !name.equals(pom.name) : pom.name != null) {\n            return false;\n        }\n        if (parent != null ? !parent.equals(pom.parent) : pom.parent != null) {\n            return false;\n        }\n        if (repositories != null ? !repositories.equals(pom.repositories) : pom.repositories != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = parent != null ? parent.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (gav != null ? gav.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (name != null ? name.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (url != null ? url.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (description != null ? description.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (packaging != null ? packaging.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (dependencies != null ? dependencies.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (repositories != null ? repositories.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (modules != null ? modules.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Package.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * An item representing a Package within a Module\n */\n@Portable\npublic class Package {\n\n    private Path moduleRootPath;\n    private Path packageMainSrcPath;\n    private Path packageTestSrcPath;\n    private Path packageMainResourcesPath;\n    private Path packageTestResourcesPath;\n    private String packageName;\n    private String caption;\n    private String relativeCaption;\n\n    public Package() {\n        //For Errai-marshalling\n    }\n\n    public Package(final Path moduleRootPath,\n                   final Path packageMainSrcPath,\n                   final Path packageTestSrcPath,\n                   final Path packageMainResourcesPath,\n                   final Path packageTestResourcesPath,\n                   final String packageName,\n                   final String caption,\n                   final String relativeCaption) {\n        this.moduleRootPath = checkNotNull(\"moduleRootPath\",\n                                           moduleRootPath);\n        this.packageMainSrcPath = packageMainSrcPath;\n        this.packageTestSrcPath = packageTestSrcPath;\n        this.packageMainResourcesPath = packageMainResourcesPath;\n        this.packageTestResourcesPath = packageTestResourcesPath;\n        this.packageName = checkNotNull(\"packageName\",\n                                        packageName);\n        this.caption = checkNotNull(\"caption\",\n                                    caption);\n        this.relativeCaption = checkNotNull(\"relativeCaption\",\n                                            relativeCaption);\n    }\n\n    public Path getModuleRootPath() {\n        return this.moduleRootPath;\n    }\n\n    public Path getPackageMainSrcPath() {\n        return packageMainSrcPath;\n    }\n\n    public Path getPackageTestSrcPath() {\n        return packageTestSrcPath;\n    }\n\n    public Path getPackageMainResourcesPath() {\n        return packageMainResourcesPath;\n    }\n\n    public Path getPackageTestResourcesPath() {\n        return packageTestResourcesPath;\n    }\n\n    public String getPackageName() {\n        return this.packageName;\n    }\n\n    public String getCaption() {\n        return this.caption;\n    }\n\n    public String getRelativeCaption() {\n        return relativeCaption;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof Package)) {\n            return false;\n        }\n\n        Package aPackage = (Package) o;\n\n        if (!caption.equals(aPackage.caption)) {\n            return false;\n        }\n        if (!packageName.equals(aPackage.packageName)) {\n            return false;\n        }\n        if (!moduleRootPath.equals(aPackage.moduleRootPath)) {\n            return false;\n        }\n        if (packageMainSrcPath != null ? !packageMainSrcPath.equals(aPackage.packageMainSrcPath) : aPackage.packageMainSrcPath != null) {\n            return false;\n        }\n        if (packageTestSrcPath != null ? !packageTestSrcPath.equals(aPackage.packageTestSrcPath) : aPackage.packageTestSrcPath != null) {\n            return false;\n        }\n        if (packageMainResourcesPath != null ? !packageMainResourcesPath.equals(aPackage.packageMainResourcesPath) : aPackage.packageMainResourcesPath != null) {\n            return false;\n        }\n        if (packageTestResourcesPath != null ? !packageTestResourcesPath.equals(aPackage.packageTestResourcesPath) : aPackage.packageTestResourcesPath != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = moduleRootPath.hashCode();\n        result = ~~result;\n        result = 31 * result + (packageMainSrcPath != null ? packageMainSrcPath.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (packageTestSrcPath != null ? packageTestSrcPath.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (packageMainResourcesPath != null ? packageMainResourcesPath.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (packageTestResourcesPath != null ? packageTestResourcesPath.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + packageName.hashCode();\n        result = ~~result;\n        result = 31 * result + caption.hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/Plugin.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Plugin {\n\n    private List<Dependency> dependencies = new ArrayList<>();\n    private String groupId;\n    private String artifactId;\n    private String version;\n    private boolean extensions = false;\n\n    public List<Dependency> getDependencies() {\n        return dependencies;\n    }\n\n    public void setDependencies(List<Dependency> dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    public void setGroupId(String groupId) {\n        this.groupId = groupId;\n    }\n\n    public String getGroupId() {\n        return groupId;\n    }\n\n    public void setArtifactId(String artifactId) {\n        this.artifactId = artifactId;\n    }\n\n    public String getArtifactId() {\n        return artifactId;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public void setExtensions(boolean extensions) {\n        this.extensions = extensions;\n    }\n\n    public boolean isExtensions() {\n        return extensions;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/ProjectImports.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.project.datamodel.imports.Imports;\n\n@Portable\npublic class ProjectImports {\n\n    private Imports imports = new Imports();\n\n    private String version = \"1.0\";\n\n    public Imports getImports() {\n        return imports;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        ProjectImports that = (ProjectImports) o;\n\n        if (imports != null ? !imports.equals(that.imports) : that.imports != null) {\n            return false;\n        }\n        if (version != null ? !version.equals(that.version) : that.version != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = imports != null ? imports.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (version != null ? version.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/WorkItemHandlerModel.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class WorkItemHandlerModel {\n\n    private String type = \"\";\n    private String name = \"\";\n\n    public String getType() {\n        return type;\n    }\n\n    public void setType(String type) {\n        this.type = type;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        WorkItemHandlerModel that = (WorkItemHandlerModel) o;\n\n        if (name != null ? !name.equals(that.name) : that.name != null) {\n            return false;\n        }\n        if (type != null ? !type.equals(that.type) : that.type != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = type != null ? type.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (name != null ? name.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/WorkspaceProject.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.commons.data.Cacheable;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.util.URIUtil;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\n/**\n * Each WorkspaceProject is in a single repository.\n * The workbench requires that there is a single parent pom.xml file in the repository root.\n * There can be child Modules, but they are optional.\n * A WorkspaceProject can have several Branches, but the WorkspaceProject model focuses on only one of them.\n * <BR>\n * The WorkspaceProject model contains the Repository field and OrganizationalUnit, but these are here only for convenience.\n * <b>The real WorkspaceProject root is the Branch root.</b>\n * Please do not use the Repository root path, this can point to any branch even to those that are not used.\n */\npublic class WorkspaceProject\n        implements Cacheable {\n\n    private Repository repository;\n    private Branch branch;\n    private Module mainModule;\n    private OrganizationalUnit organizationalUnit;\n    private boolean requiresRefresh = true;\n\n    public WorkspaceProject() {\n    }\n\n    public WorkspaceProject(final OrganizationalUnit organizationalUnit,\n                            final Repository repository,\n                            final Branch branch,\n                            final Module mainModule) {\n        this.organizationalUnit = checkNotNull(\"organizationalUnit\",\n                                               organizationalUnit);\n        this.repository = checkNotNull(\"repository\",\n                                       repository);\n        this.branch = checkNotNull(\"branch\",\n                                   branch);\n        this.mainModule = mainModule;\n    }\n\n    public OrganizationalUnit getOrganizationalUnit() {\n        return organizationalUnit;\n    }\n\n    /**\n     * This is here for convenience. In case you quickly need the repository information.\n     * Please do not use the repository root path unless you are sure you need it. The Branch root is the Project root.\n     * @return Repository where the project is.\n     */\n    public Repository getRepository() {\n        return repository;\n    }\n\n    /**\n     * Branch is where the Project is located.\n     * To change the branch, please recreate and reload the Project. You get way less bugs in UI code this way.\n     * @return Currently active branch.\n     */\n    public Branch getBranch() {\n        return branch;\n    }\n\n    /**\n     * @return The Module that exists in the Project root.\n     */\n    public Module getMainModule() {\n        return mainModule;\n    }\n\n    public String getEncodedIdentifier() {\n        return URIUtil.encodeQueryString(repository.getIdentifier());\n    }\n\n    @Override\n    public boolean requiresRefresh() {\n        return requiresRefresh;\n    }\n\n    /**\n     * Name resolution sources in priority order: root pom.xml module name, root pom.xml artifactId and if everything else fails we use the repository alias.\n     * @return Resolved name of the Project.\n     */\n    public String getName() {\n        if (mainModule != null) {\n            final String moduleName = mainModule.getModuleName();\n            if (moduleName != null && !mainModule.getModuleName().trim().isEmpty()) {\n                return mainModule.getModuleName();\n            } else {\n                return repository.getAlias();\n            }\n        } else {\n            return repository.getAlias();\n        }\n    }\n\n    @Override\n    public void markAsCached() {\n        this.requiresRefresh = false;\n    }\n\n    /**\n     * Short cut for the WorkspaceProject root.\n     * @return The root path of the active branch.\n     */\n    public Path getRootPath() {\n        return this.getBranch().getPath();\n    }\n\n    public Space getSpace(){\n        return getRepository().getSpace();\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        WorkspaceProject workspaceProject = (WorkspaceProject) o;\n\n        if (requiresRefresh != workspaceProject.requiresRefresh) {\n            return false;\n        }\n        if (!repository.equals(workspaceProject.repository)) {\n            return false;\n        }\n        if (!branch.equals(workspaceProject.branch)) {\n            return false;\n        }\n        if (mainModule != null ? !mainModule.equals(workspaceProject.mainModule) : workspaceProject.mainModule != null) {\n            return false;\n        }\n        return organizationalUnit.equals(workspaceProject.organizationalUnit);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = ~~repository.hashCode();\n        result = 31 * result + ~~branch.hashCode();\n        result = 31 * result + (mainModule != null ? ~~mainModule.hashCode() : 0);\n        result = 31 * result + ~~organizationalUnit.hashCode();\n        result = 31 * result + (requiresRefresh ? 1 : 0);\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/model/WorkspaceProjectWizard.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.model;\n\nimport org.uberfire.client.callbacks.Callback;\n\npublic interface WorkspaceProjectWizard {\n\n    void initialise();\n\n    void initialise(final POM pom);\n\n    void start(final Callback<WorkspaceProject> callback,\n               final boolean openEditor);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/preferences/GAVPreferences.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.preferences;\n\nimport org.uberfire.preferences.shared.PropertyFormType;\nimport org.uberfire.preferences.shared.annotations.Property;\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"GAVPreferences\",\n        bundleKey = \"GAVPreferences.Label\",\n        parents = \"GeneralPreferences\")\npublic class GAVPreferences implements BasePreference<GAVPreferences> {\n\n    static final String CONFLICTING_GAV_CHECK_DISABLED = \"org.guvnor.project.gav.check.disabled\";\n    static final String CHILD_GAV_EDIT_ENABLED = \"org.guvnor.project.gav.child.edit.enabled\";\n\n    @Property(bundleKey = \"GAVPreferences.ConflictingGAVCheckDisabled.Label\",\n            helpBundleKey = \"GAVPreferences.ConflictingGAVCheckDisabled.Help\",\n            formType = PropertyFormType.BOOLEAN)\n    private boolean conflictingGAVCheckDisabled;\n\n    @Property(bundleKey = \"GAVPreferences.ChildGAVEditEnabled.Label\",\n            helpBundleKey = \"GAVPreferences.ChildGAVEditEnabled.Help\",\n            formType = PropertyFormType.BOOLEAN)\n    private boolean childGAVEditEnabled;\n\n    @Override\n    public GAVPreferences defaultValue(final GAVPreferences defaultValue) {\n        //GWT complains in SuperDevMode if the static constants are used; so we have to use a literal\n        final String conflictingGAVCheckDisabledSystemProperty = System.getProperty(\"org.guvnor.project.gav.check.disabled\",\n                                                                                    \"false\");\n        final boolean conflictingGAVCheckDisabled = Boolean.parseBoolean(conflictingGAVCheckDisabledSystemProperty);\n\n        defaultValue.setConflictingGAVCheckDisabled(conflictingGAVCheckDisabled);\n\n        //GWT complains in SuperDevMode if the static constants are used; so we have to use a literal\n        final String childGAVEditEnabledSystemProperty = System.getProperty(\"org.guvnor.project.gav.child.edit.enabled\",\n                                                                            \"false\");\n        final boolean childGAVEditEnabled = Boolean.parseBoolean(childGAVEditEnabledSystemProperty);\n\n        defaultValue.setChildGAVEditEnabled(childGAVEditEnabled);\n\n        return defaultValue;\n    }\n\n    public boolean isConflictingGAVCheckDisabled() {\n        return conflictingGAVCheckDisabled;\n    }\n\n    public void setConflictingGAVCheckDisabled(final boolean conflictingGAVCheckDisabled) {\n        this.conflictingGAVCheckDisabled = conflictingGAVCheckDisabled;\n    }\n\n    public boolean isChildGAVEditEnabled() {\n        return childGAVEditEnabled;\n    }\n\n    public void setChildGAVEditEnabled(final boolean childGAVEditEnabled) {\n        this.childGAVEditEnabled = childGAVEditEnabled;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/preferences/GeneralPreferences.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.preferences;\n\nimport org.uberfire.preferences.shared.annotations.WorkbenchPreference;\nimport org.uberfire.preferences.shared.bean.BasePreference;\n\n@WorkbenchPreference(identifier = \"GeneralPreferences\",\n        bundleKey = \"GeneralPreferences.Label\")\npublic class GeneralPreferences implements BasePreference<GeneralPreferences> {\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/project/ModuleFactory.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.project;\n\nimport org.guvnor.common.services.project.model.Module;\n\npublic interface ModuleFactory<T extends Module> {\n\n    T simpleModuleInstance(org.uberfire.java.nio.file.Path parent);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/project/WorkspaceProjectMigrationService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.project;\n\nimport org.guvnor.common.services.project.model.WorkspaceProject;\n\npublic interface WorkspaceProjectMigrationService {\n\n    void migrate(final WorkspaceProject legacyWorkspaceProject);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/security/ProjectPermissionsService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.security;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface ProjectPermissionsService {\n\n    BranchPermissions loadBranchPermissions(final String spaceName,\n                                            final String projectIdentifier,\n                                            final String branchName);\n\n    Map<String, BranchPermissions> loadBranchPermissions(final String spaceName,\n                                                         final String projectIdentifier,\n                                                         final List<String> branches);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/security/ProjectResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.security;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.ResourceType;\n\n@Portable\npublic class ProjectResourceType implements ResourceType {\n\n    @Override\n    public String getName() {\n        return \"project\";\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/BaseArchetypeService.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Optional;\n\nimport org.guvnor.structure.repositories.Repository;\n\npublic interface BaseArchetypeService {\n\n    /**\n     * Return the repository where the archetype is stored.\n     *\n     * @param alias archetype alias\n     * @param spaceName archetype space\n     * @return repository of the archetype\n     */\n    Repository getTemplateRepository(String alias, String spaceName);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/DeploymentMode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Controls whether deployment to Maven should check for pre-existing GAVs or force overwrite.\n */\n@Portable\npublic enum DeploymentMode {\n    VALIDATED,\n    FORCED\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/GAVAlreadyExistsException.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.service;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * Exception for when a proposed GAV for a Project resolves against Maven's {@link org.eclipse.aether.repository.LocalRepository} and any\n * {@link org.eclipse.aether.repository.RemoteRepository} configured in the Project's POM, {@code <distributionManagement>} or {@code settings.xml}\n */\n@Portable\npublic class GAVAlreadyExistsException extends RuntimeException {\n\n    private GAV gav;\n    private Set<MavenRepositoryMetadata> repositories = new HashSet<MavenRepositoryMetadata>();\n\n    public GAVAlreadyExistsException() {\n        super();\n    }\n\n    public GAVAlreadyExistsException(final GAV gav,\n                                     final Set<MavenRepositoryMetadata> repositories) {\n        super(\"Requested GAV (\" + gav + \") already exists. Please check 'repositories' collection.\");\n        this.gav = PortablePreconditions.checkNotNull(\"gav\",\n                                                      gav);\n        this.repositories.addAll(PortablePreconditions.checkNotNull(\"repositories\",\n                                                                    repositories));\n    }\n\n    public GAV getGAV() {\n        return gav;\n    }\n\n    public Set<MavenRepositoryMetadata> getRepositories() {\n        return repositories;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/ModuleRepositoriesService.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport org.guvnor.common.services.project.model.ModuleRepositories;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRead;\n\n@Remote\npublic interface ModuleRepositoriesService\n        extends SupportsRead<ModuleRepositories> {\n\n    ModuleRepositories create(final Path path);\n\n    Path save(final Path path,\n              final ModuleRepositories content,\n              final String comment);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/ModuleRepositoryResolver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface ModuleRepositoryResolver {\n\n    /**\n     * Get a collection of Repositories a Module will resolve artifacts against. The list will include\n     * any Repositories defined in settings.xml\n     * @return\n     */\n    Set<MavenRepositoryMetadata> getRemoteRepositoriesMetaData();\n\n    /**\n     * Get a collection of Repositories a Module will resolve artifacts against. The list will include\n     * any Repositories defined in the Module's pom <distributionManagement> section, any Repositories\n     * defined in the Module's pom or parent pom(s) and in settings.xml\n     * @param module The Module to retrieve Repository information.\n     * @return\n     */\n    Set<MavenRepositoryMetadata> getRemoteRepositoriesMetaData(final Module module);\n\n    /**\n     * Get a collection of Repositories that a given GAV resolve against.\n     * @param gav The GAV for the artifact to resolve\n     * @param filter An optional Set of MavenRepositoryMetadata to filter the results. Those in the filter are included. If a filter is not provided all results are returned.\n     * @return A collection of RemoteRepositories that resolve the provided GAV; i.e. an Artifact already exists for the GAV\n     */\n    Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final GAV gav,\n                                                                  final MavenRepositoryMetadata... filter);\n\n    /**\n     * Get a collection of Repositories that a given GAV resolve against.\n     * @param gav The GAV for the artifact to resolve\n     * @param module The Module who's RemoteRepository information will be used to resolve the artifact.\n     * @param filter An optional Set of MavenRepositoryMetadata to filter the results. Those in the filter are included. If a filter is not provided all results are returned.\n     * @return A collection of RemoteRepositories that resolve the provided GAV; i.e. an Artifact already exists for the GAV\n     */\n    Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final GAV gav,\n                                                                  final Module module,\n                                                                  final MavenRepositoryMetadata... filter);\n\n    /**\n     * Get a collection of Repositories that a given GAV resolve against.\n     * @param pom The POM containing prospective GAV and repository configuration (in addition to settings.xml)\n     * @param filter An optional Set of MavenRepositoryMetadata to filter the results. Those in the filter are included. If a filter is not provided all results are returned.\n     * @return A collection of RemoteRepositories that resolve the provided GAV; i.e. an Artifact already exists for the GAV\n     */\n    Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final String pom,\n                                                                  final MavenRepositoryMetadata... filter);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/ModuleResourceResolver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.Package;\nimport org.uberfire.backend.vfs.Path;\n\npublic interface ModuleResourceResolver<T extends Module> {\n\n    /**\n     * Given a Resource path resolve it to the containing Module Path. A Module path is the folder containing pom.xml\n     * @param resource\n     * @return Path to the folder containing the Module's pom.xml file or null if the resource was not in a Module\n     */\n    T resolveModule(final Path resource);\n\n    /**\n     * Given a Resource path resolve it to the containing Module Path. A Module path is the folder containing pom.xml\n     * @param resource\n     * @param loadPOM true iff the POM file should be parsed and loaded.\n     * @return Path to the folder containing the Module's pom.xml file if loadPOM is true and it exists or else null.\n     */\n    T resolveModule(final Path resource, boolean loadPOM);\n\n    Module resolveParentModule(final Path resource);\n\n    Module resolveToParentModule(final Path resource);\n\n    /**\n     * Given a Module resolves the calculation of all the packages for this module.\n     * @param module\n     * @return Collection containing all the packages for the module.\n     */\n    Set<Package> resolvePackages(final Module module);\n\n    /**\n     * Given a Module resolves the calculation of all the packages for this module for the given packages.\n     * @param module\n     * @param packageNames For example [\"org.test\", \"org.hello\"]\n     * @return Collection containing all given packages for the module.\n     */\n    Set<Package> resolvePackages(final Module module,\n                                 final Set<String> packageNames);\n\n    Set<Package> resolvePackages(final Package pkg);\n\n    Package resolveDefaultPackage(final Module module);\n\n    Package resolveDefaultWorkspacePackage(final Module module);\n\n    Package resolveParentPackage(final Package pkg);\n\n    /**\n     * Given a package and a resource extension resolves the target path where the resource should be placed by default.\n     * e.g. for a package org.kie and a drl extension, the by default target path will be src/main/resources/org/kie,\n     * and for a java extension with the same package the by default target path will be src/main/java/org/kie\n     * @param pkg A package within a module.\n     * @param resourceType a file extension.\n     * @return the expected by default path for the given extension.\n     */\n    Path resolveDefaultPath(final Package pkg,\n                            final String resourceType);\n\n    /**\n     * Return true if the file is the Module's pom.xml file\n     * @param resource\n     * @return\n     */\n    boolean isPom(Path resource);\n\n    /**\n     * Given a Resource path resolve it to the containing Package Path. A Package path is the folder containing the resource.\n     * The folder must be within a valid Module structure and at least reference /src/main/java, /src/main/resources,\n     * src/test/java or src/test/resources (or deeper).\n     * @param resource\n     * @return Path to the folder containing the resource file or null if the resource is not in a Package.\n     */\n    org.guvnor.common.services.project.model.Package resolvePackage(final Path resource);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/ModuleService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n@Remote\npublic interface ModuleService<T extends Module>\n        extends ModuleResourceResolver<T>,\n                ModuleServiceCore<T> {\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/ModuleServiceCore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.structure.repositories.Branch;\nimport org.uberfire.backend.vfs.Path;\n\npublic interface ModuleServiceCore<T> {\n\n    /**\n     * Gets all the modules from a given branch.\n     * @param branch the branch where we are looking for the modules\n     * @return\n     */\n    Set<Module> getAllModules(final Branch branch);\n\n    /**\n     * Creates a new module to the given path.\n     * @param repositoryRoot\n     * @param pom\n     * @return\n     */\n    T newModule(final Path repositoryRoot,\n                final POM pom);\n\n    /**\n     * Creates a new module to the given path.\n     * @param repositoryRoot\n     * @param pom\n     * @param mode Should creation check for the existence of other Artifacts with the same GAV\n     * @return\n     */\n    T newModule(final Path repositoryRoot,\n                final POM pom,\n                final DeploymentMode mode);\n\n    /**\n     * Creates a new package as a child of the provide package.\n     * @param pkg\n     * @param packageName\n     * @return\n     */\n    org.guvnor.common.services.project.model.Package newPackage(final Package pkg,\n                                                                final String packageName);\n\n    Path rename(final Path pathToPomXML,\n                final String newName,\n                final String comment);\n\n    void delete(final Path pathToPomXML,\n                final String comment);\n\n    void copy(final Path pathToPomXML,\n              final String newName,\n              final String comment);\n\n    void reImport(final Path pathToPomXML);\n\n    void createModuleDirectories(final Path repositoryRoot);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/POMService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.service;\n\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.shared.file.SupportsUpdate;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsRead;\n\n@Remote\npublic interface POMService extends SupportsRead<POM>,\n                                    SupportsUpdate<POM> {\n\n    /**\n     * @param projectRoot Root of the project\n     * @param pom Model for the pom.xml\n     * @return\n     */\n    Path create(final Path projectRoot,\n                final POM pom);\n\n    Path save(final Path path,\n              final POM content,\n              final Metadata metadata,\n              final String comment,\n              final boolean updateModules);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/PackageAlreadyExistsException.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.service;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.java.nio.file.FileSystemException;\n\n/**\n * Exception for when a new package request fails; due to it already existing. FileAlreadyExistsException cannot\n * be used as this is presented to the User as \"File already exists\"... which is not technically correct for packages\n */\n@Portable\npublic class PackageAlreadyExistsException extends FileSystemException {\n\n    public PackageAlreadyExistsException() {\n        super();\n    }\n\n    public PackageAlreadyExistsException(String file) {\n        super(file);\n    }\n\n    public PackageAlreadyExistsException(String file,\n                                         String other,\n                                         String reason) {\n        super(file,\n              other,\n              reason);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/WorkspaceProjectSearchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Collection;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * {@link Module} remote search interface\n */\n@Remote\npublic interface WorkspaceProjectSearchService {\n\n    /**\n     * Retrieve a max number of {@link Module} instances given a name pattern.\n     * <p>\n     * <p>Examples:</p>\n     * <ul>\n     * <li>{@code searchByName(\"\", 20, true);} => get 20 instances, no matter their name</li>\n     * <li>{@code searchByName(\"A\", 10, true);} => get the first 10 instances that match the letter A</li>\n     * <li>{@code searchByName(\"alfa\", -1, false);} => get all the projects which name contains the word \"alfa\" (case unsensitive)</li>\n     * </ul>\n     * @param pattern An string fragment which must be present in any of the projects instances retrieved.\n     * @param maxItems Max number of instances to retrieve. This setting is ruled out if zero or negative.\n     * @param caseSensitive Case sensitiveness flag\n     * @return A collection of {@link Module} instances\n     */\n    Collection<WorkspaceProject> searchByName(String pattern,\n                                              int maxItems,\n                                              boolean caseSensitive);\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/service/WorkspaceProjectService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.service;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.spaces.Space;\n\n@Remote\npublic interface WorkspaceProjectService {\n\n    Collection<WorkspaceProject> getAllWorkspaceProjects();\n\n    Collection<WorkspaceProject> getAllWorkspaceProjects(final OrganizationalUnit organizationalUnit);\n\n    Collection<WorkspaceProject> getAllWorkspaceProjectsByName(final OrganizationalUnit organizationalUnit,\n                                                               final String name);\n\n    boolean spaceHasNoProjectsWithName(final OrganizationalUnit organizationalUnit,\n                                       final String name,\n                                       final WorkspaceProject projectToIgnore);\n\n    WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                final POM pom);\n\n    WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                final POM pom,\n                                final DeploymentMode mode);\n\n    WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                final POM pom,\n                                final DeploymentMode mode,\n                                final List<Contributor> contributor);\n\n    WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                final POM pom,\n                                final DeploymentMode mode,\n                                final List<Contributor> contributor,\n                                final Repository templateRepository);\n\n    WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                final POM pom,\n                                final DeploymentMode mode,\n                                final List<Contributor> contributor,\n                                final Repository templateRepository,\n                                final String remoteRepositoryUrl);\n\n    String createFreshProjectName(final OrganizationalUnit organizationalUnit,\n                                  final String name);\n\n    WorkspaceProject resolveProject(final Repository repository);\n\n    WorkspaceProject resolveProject(final Space space, final Branch branch);\n\n    WorkspaceProject resolveProject(final Space space, final Module module);\n\n    WorkspaceProject resolveProject(final Path module);\n\n    WorkspaceProject resolveProject(final Space space, final Path module);\n\n    WorkspaceProject resolveProject(final Space space, final String name);\n\n    WorkspaceProject resolveProject(final Space space,\n                                    final String projectName,\n                                    final String branchName);\n\n    WorkspaceProject resolveProjectByRepositoryAlias(final Space space, final String repositoryAlias);\n\n    void addBranch(final String newBranchName,\n                   final String baseBranchName,\n                   final WorkspaceProject project,\n                   final String userIdentifier);\n\n    void removeBranch(final String branchName,\n                      final WorkspaceProject project,\n                      final String userIdentifier);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/utils/ModuleResourcePaths.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.utils;\n\npublic interface ModuleResourcePaths {\n\n    public static final String SOURCE_FILENAME = \"src\";\n\n    public static final String POM_PATH = \"pom.xml\";\n\n    public static final String MAIN_SRC_PATH = \"src/main/java\";\n    public static final String TEST_SRC_PATH = \"src/test/java\";\n    public static final String MAIN_RESOURCES_PATH = \"src/main/resources\";\n    public static final String TEST_RESOURCES_PATH = \"src/test/resources\";\n\n    public static final String[] SOURCE_PATHS = {\n            MAIN_SRC_PATH,\n            MAIN_RESOURCES_PATH,\n            TEST_SRC_PATH,\n            TEST_RESOURCES_PATH\n    };\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/java/org/guvnor/common/services/project/utils/NewWorkspaceProjectUtils.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.utils;\n\npublic class NewWorkspaceProjectUtils {\n\n    /* The projectName has been validated as a FileSystem folder name, which may not be consistent with Maven ArtifactID\n     * naming restrictions (see org.apache.maven.model.validation.DefaultModelValidator.java::ID_REGEX). Therefore we'd\n     * best sanitize the projectName\n     */\n    public static String sanitizeProjectName(final String projectName) {\n        // Only [A-Za-z0-9_\\-.] are valid so strip everything else out\n        return projectName != null ? projectName.replaceAll(\"[^A-Za-z0-9_\\\\-.]\",\n                                                            \"\") : projectName;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/main/resources/org/guvnor/common/services/project/GuvnorProjectAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n  <inherits name='org.uberfire.ext.editor.commons.UberfireCommonsEditorAPI'/>\n  <inherits name='org.guvnor.common.services.workingset.GuvnorWorkingsetAPI'/>\n  <inherits name='org.guvnor.common.services.GuvnorServicesAPI'/>\n  <inherits name='org.guvnor.structure.GuvnorStructureAPI' />\n\n  <source path='builder'/>\n  <source path='context'/>\n  <source path='editor'/>\n  <source path='events'/>\n  <source path='model'/>\n  <source path=\"security\" />\n  <source path='service'/>\n  <source path='categories' />\n  <source path='preferences' />\n  <source path='roles' />\n  <source path='utils' />\n\n</module>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/model/DependenciesTest.java",
    "content": "/*\n * Copyright 2016 JBoss Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport java.util.Collection;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class DependenciesTest {\n\n    private Dependencies dependencies;\n    private Dependency droolsCore;\n\n    @Before\n    public void setUp() {\n        dependencies = new Dependencies();\n\n        droolsCore = new Dependency(new GAV(\"org.drools:drools-core:5.0\"));\n        droolsCore.setScope(\"compile\");\n        dependencies.add(droolsCore);\n\n        Dependency junit = new Dependency(new GAV(\"junit:junit:4.11\"));\n        junit.setScope(\"test\");\n        dependencies.add(junit);\n\n        Dependency depWithoutScope = new Dependency(new GAV(\"mygroup:depWithoutScope:1.0\"));\n        dependencies.add(depWithoutScope);\n    }\n\n    @Test\n    public void testGetAllGAVs() {\n        final Collection<GAV> gavs = dependencies.getGavs();\n        assertThat(gavs.size()).isEqualTo(3);\n        assertContains(gavs,\n                       \"org.drools\",\n                       \"drools-core\",\n                       \"5.0\");\n        assertContains(gavs,\n                       \"junit\",\n                       \"junit\",\n                       \"4.11\");\n        assertContains(gavs,\n                       \"mygroup\",\n                       \"depWithoutScope\",\n                       \"1.0\");\n    }\n\n    @Test\n    public void testFindByGav() {\n        assertThat(dependencies.get(new GAV(\"org.drools:drools-core:5.0\")))\n                .isEqualTo(droolsCore);\n    }\n\n    @Test\n    public void testNullWhenNoResults() {\n        assertThat(dependencies.get(new GAV(\"org.drools:drools-core:112.0\"))).isNull();\n    }\n\n    private static void assertContains(final Collection<GAV> gavs,\n                                       final String groupID,\n                                       final String artifactID,\n                                       final String version) {\n        for (GAV gav : gavs) {\n            if (gav.getArtifactId().equals(artifactID)\n                    && gav.getGroupId().equals(groupID)\n                    && gav.getVersion().equals(version)) {\n                return;\n            }\n        }\n\n        Assertions.fail(\"Could not find \" + groupID + \":\" + artifactID + \":\" + version);\n    }\n\n    @Test\n    public void testContainsGAV() {\n\n        assertThat(dependencies.containsDependency(new GAV(\"org.drools:drools-core:5.0\"))).isTrue();\n        final Dependency dependency = new Dependency(new GAV(\"org.drools:drools-core:5.0\"));\n        dependency.setScope(\"test\");\n        assertThat(dependencies.containsDependency(dependency)).isTrue();\n        assertThat(dependencies.containsDependency(new GAV(\"org.drools:drools-core:4.0\"))).isFalse();\n    }\n\n    @Test\n    public void testGetTestScopedGAVs() {\n        final Collection<GAV> gavs = dependencies.getGavs(\"test\");\n        assertThat(gavs).hasSize(1);\n        assertContains(gavs,\n                       \"junit\",\n                       \"junit\",\n                       \"4.11\");\n    }\n\n    @Test\n    public void testGetCompileScopedGAVs() {\n        final Collection<GAV> gavs = dependencies.getGavs(\"compile\");\n        assertThat(gavs).hasSize(1);\n        assertContains(gavs,\n                       \"org.drools\",\n                       \"drools-core\",\n                       \"5.0\");\n    }\n\n    @Test\n    public void testGetCompileScopedGavsMethod() {\n        final Collection<GAV> gavs = dependencies.getCompileScopedGavs();\n        assertThat(gavs).hasSize(2);\n        assertContains(gavs,\n                       \"org.drools\",\n                       \"drools-core\",\n                       \"5.0\");\n        assertContains(gavs,\n                       \"mygroup\",\n                       \"depWithoutScope\",\n                       \"1.0\");\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/model/GAVTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\n\npublic class GAVTest {\n\n    @Test\n    public void testGAVFromString() {\n        GAV gav = new GAV(\"myGroupID:myArtifactID:version\");\n\n        assertThat(gav.getGroupId()).isEqualTo(\"myGroupID\");\n        assertThat(gav.getArtifactId()).isEqualTo(\"myArtifactID\");\n        assertThat(gav.getVersion()).isEqualTo(\"version\");\n    }\n\n    @Test\n    public void whenGivenNullString_throwsIllegalArgumentException() {\n        assertThatThrownBy(() -> new GAV(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'gavString' should be not null!\");\n    }\n\n    @Test\n    public void createGavFromString() {\n        GAV gav1 = new GAV(\"gr1:ar1:ver1\");\n        assertThat(gav1.getGroupId()).isEqualTo(\"gr1\");\n        assertThat(gav1.getArtifactId()).isEqualTo(\"ar1\");\n        assertThat(gav1.getVersion()).isEqualTo(\"ver1\");\n\n        GAV gav2 = new GAV(\"gr2:ar2:ver2:compile\");\n        assertThat(gav2.getGroupId()).isEqualTo(\"gr2\");\n        assertThat(gav2.getArtifactId()).isEqualTo(\"ar2\");\n        assertThat(gav2.getVersion()).isEqualTo(\"ver2\");\n    }\n\n    @Test\n    public void whenGivenInvalidGav_throwsIllegalArgumentExceptions() {\n        assertThatThrownBy(() -> new GAV(\"nonsense\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"The GAV String must have the form group:artifact:version[:scope] but was 'nonsense'\");\n\n        assertThatThrownBy(() -> new GAV(\"mygroup:myartifact\"))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"The GAV String must have the form group:artifact:version[:scope] but was 'mygroup:myartifact'\");\n    }\n    \n    @Test\n    public void isSnapshotTest() {\n        GAV\n                noSnapshot1 = new GAV(),\n                noSnapshot2 = new GAV(\"group:artifact:1.0\"),\n                noSnapshot3 = new GAV(\"group\", \"artifact\", \"version\"),\n                noSnapshot4 = new GAV(\"group\", \"artifact\", null),\n                snapshot = new GAV(\"group\", \"artifact\", \"1.0-SNAPSHOT\");\n\n        assertThat(noSnapshot1.isSnapshot()).isFalse();\n        assertThat(noSnapshot2.isSnapshot()).isFalse();\n        assertThat(noSnapshot3.isSnapshot()).isFalse();\n        assertThat(noSnapshot4.isSnapshot()).isFalse();\n        assertThat(snapshot.isSnapshot()).isTrue();\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/model/ModuleTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ModuleTest {\n\n    @Test\n    public void nameIsSet() throws Exception {\n        final POM pom = new POM(new GAV(\"groupId\",\n                                        \"artifactId\",\n                                        \"version\"));\n        pom.setName(\"my project\");\n        final Module module = new Module(mock(Path.class),\n                                         mock(Path.class),\n                                         pom);\n\n        assertEquals(\"my project\",\n                     module.getModuleName());\n    }\n\n    @Test\n    public void nameNotSetUseArtifactId() throws Exception {\n        final POM pom = new POM(new GAV(\"groupId\",\n                                        \"artifactId\",\n                                        \"version\"));\n        final Module module = new Module(mock(Path.class),\n                                         mock(Path.class),\n                                         pom);\n\n        assertEquals(\"artifactId\",\n                     module.getModuleName());\n    }\n\n    @Test\n    public void nameNotSetGAVNotSet() throws Exception {\n        final POM pom = new POM();\n        final Path rootPath = mock(Path.class);\n        doReturn(\"myProject\").when(rootPath).getFileName();\n\n        final Module module = new Module(rootPath,\n                                         mock(Path.class),\n                                         pom);\n\n        assertEquals(\"myProject\",\n                     module.getModuleName());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/model/POMTest.java",
    "content": "package org.guvnor.common.services.project.model;\n\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\npublic class POMTest {\n\n    @Test\n    public void isMultiModuleTest() {\n        POM\n                plainPom = new POM(),\n                pomWithGav = new POM(new GAV()),\n                pomWithDetails = new POM(\"name\", \"description\", \"url\", new GAV()),\n                multimodulePom = new POM(\"name\", \"description\", \"url\", new GAV(), true);\n\n        assertThat(plainPom.isMultiModule()).isFalse();\n        assertThat(pomWithGav.isMultiModule()).isFalse();\n        assertThat(pomWithDetails.isMultiModule()).isFalse();\n        assertThat(multimodulePom.isMultiModule()).isTrue();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/model/WorkspaceProjectTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.model;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class WorkspaceProjectTest {\n\n    @Test\n    public void OUCanNotBeNull() {\n        assertThatThrownBy(() -> new WorkspaceProject(null,\n                                                      mock(Repository.class),\n                                                      mock(Branch.class),\n                                                      mock(Module.class)))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'organizationalUnit' should be not null!\");\n    }\n\n    @Test\n    public void ProjectCanNotBeNull() {\n        assertThatThrownBy(() -> new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                      null,\n                                                      mock(Branch.class),\n                                                      mock(Module.class)))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'repository' should be not null!\");\n    }\n\n    @Test\n    public void BranchCanNotBeNull() {\n        assertThatThrownBy(() -> new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                      mock(Repository.class),\n                                                      null,\n                                                      mock(Module.class)))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'branch' should be not null!\");\n    }\n\n    @Test\n    public void ModuleCanBeNull() {\n        new WorkspaceProject(mock(OrganizationalUnit.class),\n                             mock(Repository.class),\n                             mock(Branch.class),\n                             null);\n    }\n\n    @Test\n    public void getNameNoModule() {\n        final Repository repository = mock(Repository.class);\n        doReturn(\"my-repo\").when(repository).getAlias();\n\n        final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                       repository,\n                                                                       mock(Branch.class),\n                                                                       null);\n\n        assertEquals(\"my-repo\",\n                     workspaceProject.getName());\n    }\n\n    @Test\n    public void getName() {\n        final Repository repository = mock(Repository.class);\n        doReturn(\"my-repo\").when(repository).getAlias();\n\n        final Module mainModule = mock(Module.class);\n        doReturn(\"my-module\").when(mainModule).getModuleName();\n\n        final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                       repository,\n                                                                       mock(Branch.class),\n                                                                       mainModule);\n\n        assertEquals(\"my-module\",\n                     workspaceProject.getName());\n    }\n\n    @Test\n    public void getNameNoModuleName() {\n        final Repository repository = mock(Repository.class);\n        doReturn(\"my-repo\").when(repository).getAlias();\n\n        final Module mainModule = mock(Module.class);\n        doReturn(\"\").when(mainModule).getModuleName();\n\n        final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                       repository,\n                                                                       mock(Branch.class),\n                                                                       mainModule);\n\n        assertEquals(\"my-repo\",\n                     workspaceProject.getName());\n    }\n\n    @Test\n    public void getRootPath() {\n        final Branch branch = mock(Branch.class);\n        final Path branchPath = mock(Path.class);\n        when(branch.getPath()).thenReturn(branchPath);\n\n        final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                       mock(Repository.class),\n                                                                       branch,\n                                                                       mock(Module.class));\n\n        assertEquals(branchPath,\n                     workspaceProject.getRootPath());\n    }\n\n    @Test\n    public void requiresRefresh() {\n        final WorkspaceProject workspaceProject = new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                       mock(Repository.class),\n                                                                       mock(Branch.class),\n                                                                       mock(Module.class));\n\n        assertTrue(workspaceProject.requiresRefresh());\n\n        workspaceProject.markAsCached();\n\n        assertFalse(workspaceProject.requiresRefresh());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/preferences/GAVPreferencesTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.guvnor.common.services.project.preferences;\n\nimport org.junit.After;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class GAVPreferencesTest {\n\n    @Test\n    public void defaultValueTest() {\n        GAVPreferences gavPreferences = new GAVPreferences();\n        gavPreferences.defaultValue(gavPreferences);\n\n        assertFalse(gavPreferences.isChildGAVEditEnabled());\n        assertFalse(gavPreferences.isConflictingGAVCheckDisabled());\n\n        System.setProperty(GAVPreferences.CONFLICTING_GAV_CHECK_DISABLED,\n                           \"true\");\n        System.setProperty(GAVPreferences.CHILD_GAV_EDIT_ENABLED,\n                           \"true\");\n\n        gavPreferences.defaultValue(gavPreferences);\n\n        assertTrue(gavPreferences.isChildGAVEditEnabled());\n        assertTrue(gavPreferences.isConflictingGAVCheckDisabled());\n    }\n\n    @After\n    public void clearProperties() {\n        System.clearProperty(GAVPreferences.CONFLICTING_GAV_CHECK_DISABLED);\n        System.clearProperty(GAVPreferences.CHILD_GAV_EDIT_ENABLED);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-api/src/test/java/org/guvnor/common/services/project/utils/NewWorkspaceProjectUtilsTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.utils;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class NewWorkspaceProjectUtilsTest {\n\n    @Test\n    public void sanitizeProjectNameTest() {\n        assertEquals(\"project-name\",\n                     NewWorkspaceProjectUtils.sanitizeProjectName(\"project-n a*m?e!\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-project</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-project-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Project Backend</name>\n  <description>UberFire - Project Backend</description>\n\n  <dependencies>\n\n    <!-- added to adapt to illegal transitive dependency enforcer plugin rule -->\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-core</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-settings</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-artifact</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.eclipse.aether</groupId>\n      <artifactId>aether-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.codehaus.plexus</groupId>\n      <artifactId>plexus-utils</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-project-datamodel-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workingset-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>javax.annotation</groupId>\n          <artifactId>javax.annotation-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-client-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-m2repo-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-maven-integration</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-maven-support</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit</artifactId>\n    </dependency>\n\n    <!-- Weld Modules. For tests only -->\n\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-test-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-backend</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.wildfly.security</groupId>\n      <artifactId>wildfly-elytron</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/security/ProjectPermissionsServiceImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.security;\n\nimport java.util.List;\nimport java.util.Map;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.security.ProjectPermissionsService;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\n\npublic class ProjectPermissionsServiceImpl implements ProjectPermissionsService {\n\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    public ProjectPermissionsServiceImpl() {\n    }\n\n    @Inject\n    public ProjectPermissionsServiceImpl(final SpaceConfigStorageRegistry spaceConfigStorageRegistry) {\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n    }\n\n    @Override\n    public BranchPermissions loadBranchPermissions(final String spaceName,\n                                                   final String projectIdentifier,\n                                                   final String branchName) {\n        return spaceConfigStorageRegistry.get(spaceName).loadBranchPermissions(branchName, projectIdentifier);\n    }\n\n    @Override\n    public Map<String, BranchPermissions> loadBranchPermissions(final String spaceName,\n                                                                final String projectIdentifier,\n                                                                final List<String> branches) {\n        return branches.stream().collect(Collectors.toMap(Function.identity(), branch -> loadBranchPermissions(spaceName, projectIdentifier, branch)));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/AbstractDeleteModuleObserverBridge.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URI;\nimport java.util.Collection;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.project.events.DeleteModuleEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceDeleted;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\n\n/**\n * A bridge between changes made to an underlying VFS and Module abstractions. Modules can be deleted\n * either through the Workbench's UI or via REST or on a cloned repository that's pushed back to the Workbench.\n * Interested observers are signaled of a Module deletion event when a pom.xml file is detected as deleted.\n */\npublic abstract class AbstractDeleteModuleObserverBridge<T extends Module> {\n\n    private IOService ioService;\n    private Event<DeleteModuleEvent> deleteModuleEvent;\n\n    public AbstractDeleteModuleObserverBridge() {\n        //Zero-arg constructor for CDI proxying\n    }\n\n    public AbstractDeleteModuleObserverBridge(final IOService ioService,\n                                              final Event<DeleteModuleEvent> deleteModuleEvent) {\n        this.ioService = PortablePreconditions.checkNotNull(\"ioService\",\n                                                            ioService);\n        this.deleteModuleEvent = PortablePreconditions.checkNotNull(\"deleteModuleEvent\",\n                                                                    deleteModuleEvent);\n    }\n\n    public void onBatchResourceChanges(final ResourceDeletedEvent event) {\n        if (event.getPath().getFileName().equals(\"pom.xml\")) {\n            fireDeleteEvent(event.getPath());\n        }\n    }\n\n    public void onBatchResourceChanges(final ResourceBatchChangesEvent resourceBatchChangesEvent) {\n        for (final Map.Entry<org.uberfire.backend.vfs.Path, Collection<ResourceChange>> entry : resourceBatchChangesEvent.getBatch().entrySet()) {\n            if (entry.getKey().getFileName().equals(\"pom.xml\") && isDelete(entry.getValue())) {\n                fireDeleteEvent(entry.getKey());\n            }\n        }\n    }\n\n    private boolean isDelete(final Collection<ResourceChange> value) {\n        for (final ResourceChange resourceChange : value) {\n            if (resourceChange instanceof ResourceDeleted) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private void fireDeleteEvent(final org.uberfire.backend.vfs.Path _path) {\n        final Path path = ioService.get(URI.create(_path.toURI()));\n        final T project = getModule(path.getParent());\n        deleteModuleEvent.fire(new DeleteModuleEvent(project));\n    }\n\n    protected abstract T getModule(final Path path);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/AbstractModuleRepositoriesServiceImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.ModuleRepositories;\nimport org.guvnor.common.services.project.service.ModuleRepositoriesService;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\n\npublic abstract class AbstractModuleRepositoriesServiceImpl<T extends Module>\n        implements ModuleRepositoriesService {\n\n    protected IOService ioService;\n    protected ModuleRepositoryResolver repositoryResolver;\n    protected ModuleRepositoriesContentHandler contentHandler;\n    protected CommentedOptionFactory commentedOptionFactory;\n\n    public AbstractModuleRepositoriesServiceImpl() {\n        //WELD proxy\n    }\n\n    public AbstractModuleRepositoriesServiceImpl(final IOService ioService,\n                                                 final ModuleRepositoryResolver repositoryResolver,\n                                                 final ModuleRepositoriesContentHandler contentHandler,\n                                                 final CommentedOptionFactory commentedOptionFactory) {\n        this.ioService = ioService;\n        this.repositoryResolver = repositoryResolver;\n        this.contentHandler = contentHandler;\n        this.commentedOptionFactory = commentedOptionFactory;\n    }\n\n    @Override\n    public ModuleRepositories create(final Path path) {\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n        if (ioService.exists(nioPath)) {\n            throw new FileAlreadyExistsException(path.toString());\n        }\n\n        try {\n            ioService.startBatch(nioPath.getFileSystem(),\n                                 commentedOptionFactory.makeCommentedOption(\"Creating \" + path.toString() + \"...\"));\n\n            final T project = getModule(path);\n            final Set<MavenRepositoryMetadata> content = new HashSet<MavenRepositoryMetadata>();\n            if (project == null) {\n                content.addAll(repositoryResolver.getRemoteRepositoriesMetaData());\n            } else {\n                content.addAll(repositoryResolver.getRemoteRepositoriesMetaData(project));\n            }\n\n            final ModuleRepositories repositories = createProjectRepositories(content);\n            ioService.write(Paths.convert(path),\n                            contentHandler.toString(repositories));\n\n            return repositories;\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    private ModuleRepositories createProjectRepositories(final Set<MavenRepositoryMetadata> content) {\n        final Set<ModuleRepositories.ModuleRepository> projectRepositories = new HashSet<ModuleRepositories.ModuleRepository>();\n        for (MavenRepositoryMetadata md : content) {\n            projectRepositories.add(new ModuleRepositories.ModuleRepository(true,\n                                                                            md));\n        }\n        final ModuleRepositories repositories = new ModuleRepositories(projectRepositories);\n        return repositories;\n    }\n\n    @Override\n    public ModuleRepositories load(final Path path) {\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n        if (ioService.exists(nioPath)) {\n            final String content = ioService.readAllString(nioPath);\n            return contentHandler.toModel(content);\n        } else {\n            return create(path);\n        }\n    }\n\n    @Override\n    public Path save(final Path resource,\n                     final ModuleRepositories moduleRepositories,\n                     final String comment) {\n        try {\n            ioService.write(Paths.convert(resource),\n                            contentHandler.toString(moduleRepositories));\n            return resource;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    protected abstract T getModule(final Path path);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/AbstractModuleService.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport static java.util.Optional.ofNullable;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.POM_PATH;\n\nimport java.util.Optional;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.backend.config.SafeSessionInfo;\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.builder.events.InvalidateDMOModuleCacheEvent;\nimport org.guvnor.common.services.project.events.NewModuleEvent;\nimport org.guvnor.common.services.project.events.NewPackageEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.project.ModuleFactory;\nimport org.guvnor.common.services.project.service.ModuleServiceCore;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.utils.ModuleResourcePaths;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.StandardDeleteOption;\nimport org.uberfire.rpc.SessionInfo;\n\npublic abstract class AbstractModuleService<T extends Module>\n        implements ModuleServiceCore<T>,\n                   ModuleFactory<T> {\n\n    protected IOService ioService;\n    protected POMService pomService;\n    private RepositoryService repoService;\n    protected Event<NewModuleEvent> newModuleEvent;\n    protected Event<NewPackageEvent> newPackageEvent;\n    protected CommentedOptionFactory commentedOptionFactory;\n    protected ResourceResolver resourceResolver;\n    protected SessionInfo sessionInfo;\n    private ModuleFinder moduleFinder;\n\n    private Event<InvalidateDMOModuleCacheEvent> invalidateDMOCache;\n\n    protected AbstractModuleService() {\n    }\n\n    public AbstractModuleService(final IOService ioService,\n                                 final POMService pomService,\n                                 final RepositoryService repoService,\n                                 final Event<NewModuleEvent> newModuleEvent,\n                                 final Event<NewPackageEvent> newPackageEvent,\n                                 final Event<InvalidateDMOModuleCacheEvent> invalidateDMOCache,\n                                 final SessionInfo sessionInfo,\n                                 final CommentedOptionFactory commentedOptionFactory,\n                                 final ModuleFinder moduleFinder,\n                                 final ResourceResolver resourceResolver) {\n        this.ioService = ioService;\n        this.pomService = pomService;\n        this.repoService = repoService;\n        this.newModuleEvent = newModuleEvent;\n        this.newPackageEvent = newPackageEvent;\n        this.invalidateDMOCache = invalidateDMOCache;\n        this.commentedOptionFactory = commentedOptionFactory;\n        this.moduleFinder = moduleFinder;\n        this.resourceResolver = resourceResolver;\n        this.sessionInfo = new SafeSessionInfo(sessionInfo);\n    }\n\n    @Override\n    public Set<Module> getAllModules(final Branch branch) {\n        return moduleFinder.find(resourceResolver,\n         branch);\n    }\n\n    @Override\n    public Package newPackage(final Package parentPackage,\n                              final String packageName) {\n        try {\n            //Make new Package\n            final Package newPackage = resourceResolver.newPackage(parentPackage,\n                                                                   packageName,\n                                                                   true);\n\n            //Raise an event for the new package\n            newPackageEvent.fire(new NewPackageEvent(newPackage));\n\n            //Return the new package\n            return newPackage;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Path rename(final Path pathToPomXML,\n                       final String newName,\n                       final String comment) {\n\n        try {\n            final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert(pathToPomXML).getParent();\n            final org.uberfire.java.nio.file.Path newModulePath = projectDirectory.resolveSibling(newName);\n\n            final POM content = pomService.load(pathToPomXML);\n\n            if (newModulePath.equals(projectDirectory)) {\n                return pathToPomXML;\n            }\n\n            if (ioService.exists(newModulePath)) {\n                throw new FileAlreadyExistsException(newModulePath.toString());\n            }\n\n            final Path oldModuleDir = Paths.convert(projectDirectory);\n            final Module oldModule = resourceResolver.resolveModule(oldModuleDir);\n\n            content.setName(newName);\n            final Path newPathToPomXML = Paths.convert(newModulePath.resolve(POM_PATH));\n            try {\n                ioService.startBatch(newModulePath.getFileSystem());\n                ioService.move(projectDirectory,\n                               newModulePath,\n                               commentedOptionFactory.makeCommentedOption(comment));\n                pomService.save(newPathToPomXML,\n                                content,\n                                null,\n                                comment);\n            } catch (final Exception e) {\n                throw e;\n            } finally {\n                ioService.endBatch();\n            }\n\n            invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo,\n                                                                      oldModule,\n                                                                      oldModuleDir));\n\n            return newPathToPomXML;\n        } catch (final Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public void delete(final Path pathToPomXML,\n                       final String comment) {\n        try {\n            final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert(pathToPomXML).getParent();\n            final Module module2Delete = resourceResolver.resolveModule(Paths.convert(projectDirectory));\n\n            final Optional<org.uberfire.java.nio.file.Path> parentPomPath =\n                    ofNullable(projectDirectory).flatMap(dir -> ofNullable(dir.getParent()))\n                                                .map(dir -> dir.resolve(POM_PATH))\n                                                .filter(pom -> ioService.exists(pom));\n            final Optional<POM> parentPom = parentPomPath.map(pom -> pomService.load(Paths.convert(pom)));\n\n\n            // If this is the top module of the project, we should delete the whole repository.\n            if (parentPomPath.isPresent() && parentPom.isPresent()) {\n                //Note we do *not* raise a DeleteModuleEvent here, as that is handled by DeleteModuleObserverBridge\n                ioService.delete(projectDirectory,\n                                 StandardDeleteOption.NON_EMPTY_DIRECTORIES,\n                                 commentedOptionFactory.makeCommentedOption(comment));\n\n                org.uberfire.java.nio.file.Path pomPath = parentPomPath.get();\n                POM pom = parentPom.get();\n                pom.setPackaging(\"pom\");\n                pom.getModules().remove(module2Delete.getModuleName());\n                pomService.save(Paths.convert(pomPath),\n                                pom,\n                                null,\n                                \"Removing child module \" + module2Delete.getModuleName());\n            } else {\n                Repository repo = repoService.getRepository(Paths.convert(projectDirectory));\n                repoService.removeRepository(repo.getSpace(), repo.getAlias());\n            }\n        } catch (final Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public void copy(final Path pathToPomXML,\n                     final String newName,\n                     final String comment) {\n        try {\n            final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert(pathToPomXML).getParent();\n            final org.uberfire.java.nio.file.Path newModulePath = projectDirectory.resolveSibling(newName);\n\n            final POM content = pomService.load(pathToPomXML);\n\n            if (newModulePath.equals(projectDirectory)) {\n                return;\n            }\n\n            if (ioService.exists(newModulePath)) {\n                throw new FileAlreadyExistsException(newModulePath.toString());\n            }\n\n            content.setName(newName);\n            final Path newPathToPomXML = Paths.convert(newModulePath.resolve(POM_PATH));\n            try {\n                ioService.startBatch(newModulePath.getFileSystem());\n                ioService.copy(projectDirectory,\n                               newModulePath,\n                               commentedOptionFactory.makeCommentedOption(comment));\n                pomService.save(newPathToPomXML,\n                                content,\n                                null,\n                                comment);\n            } catch (final Exception e) {\n                throw e;\n            } finally {\n                ioService.endBatch();\n            }\n            final Module newModule = resourceResolver.resolveModule(Paths.convert(newModulePath));\n            newModuleEvent.fire(new NewModuleEvent(newModule,\n                                                   commentedOptionFactory.getSafeSessionId(),\n                                                   commentedOptionFactory.getSafeIdentityName()));\n        } catch (final Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public void reImport(final Path pathToPomXML) {\n\n        try {\n            final org.uberfire.java.nio.file.Path projectDirectory = Paths.convert(pathToPomXML).getParent();\n            final Path path = Paths.convert(projectDirectory);\n            final Module module = resourceResolver.resolveModule(path);\n\n            invalidateDMOCache.fire(new InvalidateDMOModuleCacheEvent(sessionInfo,\n                                                                      module,\n                                                                      path));\n        } catch (final Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public void createModuleDirectories(final Path repositoryRoot) {\n        final org.uberfire.java.nio.file.Path modulePath = Paths.convert(repositoryRoot);\n\n        try {\n            ioService.startBatch(modulePath.getFileSystem(),\n                                 commentedOptionFactory.makeCommentedOption(\"Adding module directories\"));\n\n            final Path mainResourcesPath = Paths.convert(modulePath.resolve(ModuleResourcePaths.MAIN_RESOURCES_PATH));\n            final Package defaultPackage = resourceResolver.resolvePackage(mainResourcesPath);\n\n            final Path pomPath = Paths.convert(modulePath.resolve(POMServiceImpl.POM_XML));\n            final POM modulePom = pomService.load(pomPath);\n            final String workspacePath = resourceResolver.getDefaultWorkspacePath(modulePom.getGav());\n\n            resourceResolver.newPackage(defaultPackage,\n                                        workspacePath,\n                                        false);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/BaseArchetypeServiceImpl.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.service.BaseArchetypeService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.annotations.FallbackImplementation;\n\n@FallbackImplementation\npublic class BaseArchetypeServiceImpl implements BaseArchetypeService {\n\n    public BaseArchetypeServiceImpl() {\n    }\n\n    @Override\n    public Repository getTemplateRepository(String alias, String spaceName) {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/DefaultModuleResourcePathResolver.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.guvnor.common.services.project.model.Package;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * This is the by default resource path resolver to apply when no resolver has been set for a given resource type.\n */\n@ApplicationScoped\npublic class DefaultModuleResourcePathResolver\n        implements ModuleResourcePathResolver {\n\n    public DefaultModuleResourcePathResolver() {\n        //Empty constructor for Weld proxying\n    }\n\n    @Override\n    public int getPriority() {\n        return -1;\n    }\n\n    @Override\n    public boolean accept(String resourceType) {\n        return true;\n    }\n\n    @Override\n    public Path resolveDefaultPath(Package pkg) {\n        return pkg.getPackageMainResourcesPath();\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/DefaultPomEnhancer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.apache.maven.model.Model;\nimport org.uberfire.annotations.FallbackImplementation;\n\n@FallbackImplementation\n@ApplicationScoped\npublic class DefaultPomEnhancer implements PomEnhancer {\n\n    @Override\n    public Model execute(Model model) {\n        return model;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/MavenLocalRepositoryManagerWrapper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.eclipse.aether.RepositorySystemSession;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.metadata.Metadata;\nimport org.eclipse.aether.repository.LocalArtifactRegistration;\nimport org.eclipse.aether.repository.LocalArtifactRequest;\nimport org.eclipse.aether.repository.LocalArtifactResult;\nimport org.eclipse.aether.repository.LocalMetadataRegistration;\nimport org.eclipse.aether.repository.LocalMetadataRequest;\nimport org.eclipse.aether.repository.LocalMetadataResult;\nimport org.eclipse.aether.repository.LocalRepository;\nimport org.eclipse.aether.repository.LocalRepositoryManager;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A wrapper around the normal LocalRepositoryManager to \"fool\" Maven into not checking local for remote artifacts\n */\npublic class MavenLocalRepositoryManagerWrapper implements LocalRepositoryManager {\n\n    private final String tempLocalRepositoryBaseDir;\n    private final LocalRepositoryManager delegate;\n\n    public MavenLocalRepositoryManagerWrapper(final String tempLocalRepositoryBaseDir,\n                                              final LocalRepositoryManager delegate) {\n        this.tempLocalRepositoryBaseDir = PortablePreconditions.checkNotNull(\"tempLocalRepositoryBaseDir\",\n                                                                             tempLocalRepositoryBaseDir);\n        this.delegate = PortablePreconditions.checkNotNull(\"delegate\",\n                                                           delegate);\n    }\n\n    @Override\n    public LocalRepository getRepository() {\n        return new LocalRepository(tempLocalRepositoryBaseDir);\n    }\n\n    @Override\n    public String getPathForLocalArtifact(final Artifact artifact) {\n        return delegate.getPathForLocalArtifact(artifact);\n    }\n\n    @Override\n    public String getPathForRemoteArtifact(final Artifact artifact,\n                                           final RemoteRepository repository,\n                                           final String context) {\n        return delegate.getPathForRemoteArtifact(artifact,\n                                                 repository,\n                                                 context);\n    }\n\n    @Override\n    public String getPathForLocalMetadata(final Metadata metadata) {\n        return delegate.getPathForLocalMetadata(metadata);\n    }\n\n    @Override\n    public String getPathForRemoteMetadata(final Metadata metadata,\n                                           final RemoteRepository repository,\n                                           final String context) {\n        return delegate.getPathForRemoteMetadata(metadata,\n                                                 repository,\n                                                 context);\n    }\n\n    @Override\n    public LocalArtifactResult find(final RepositorySystemSession session,\n                                    final LocalArtifactRequest request) {\n        return new LocalArtifactResult(request);\n    }\n\n    @Override\n    public void add(final RepositorySystemSession session,\n                    final LocalArtifactRegistration request) {\n        delegate.add(session,\n                     request);\n    }\n\n    @Override\n    public LocalMetadataResult find(final RepositorySystemSession session,\n                                    final LocalMetadataRequest request) {\n        return delegate.find(session,\n                             request);\n    }\n\n    @Override\n    public void add(final RepositorySystemSession session,\n                    final LocalMetadataRegistration request) {\n        delegate.add(session,\n                     request);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/MavenLocalRepositoryUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.IOException;\nimport java.nio.file.FileVisitResult;\nimport java.nio.file.Files;\nimport java.nio.file.attribute.BasicFileAttributes;\n\nimport org.guvnor.common.services.project.model.GAV;\n\npublic class MavenLocalRepositoryUtils {\n\n    /**\n     * Get a Path pointing to a transient M2 Local Repository\n     * @param gav GAV (helper to name temporary folder)\n     * @return\n     * @throws IOException\n     */\n    public static java.nio.file.Path getRepositoryPath(final GAV gav) throws IOException {\n        final java.nio.file.Path tempLocalRepositoryBasePath = java.nio.file.Files.createTempDirectory(\"m2-\" + toFileName(gav));\n        return tempLocalRepositoryBasePath;\n    }\n\n    private static String toFileName(final GAV gav) {\n        final StringBuilder sb = new StringBuilder();\n        sb.append(\"m2-\").append(gav.getGroupId() + \"-\" + gav.getArtifactId() + \"-\" + gav.getVersion());\n        return sb.toString();\n    }\n\n    /**\n     * Destroy the temporary local Maven Repository and all content.\n     * @param m2Folder\n     */\n    public static void tearDownMavenRepository(final java.nio.file.Path m2Folder) {\n        if (m2Folder != null) {\n            try {\n                Files.walkFileTree(m2Folder,\n                                   new java.nio.file.SimpleFileVisitor<java.nio.file.Path>() {\n\n                                       @Override\n                                       public FileVisitResult visitFile(final java.nio.file.Path file,\n                                                                        final BasicFileAttributes attrs) throws IOException {\n                                           Files.delete(file);\n                                           return FileVisitResult.CONTINUE;\n                                       }\n\n                                       @Override\n                                       public FileVisitResult postVisitDirectory(final java.nio.file.Path dir,\n                                                                                 final IOException exc) throws IOException {\n                                           Files.delete(dir);\n                                           return FileVisitResult.CONTINUE;\n                                       }\n                                   });\n            } catch (IOException ioe) {\n                //Swallow\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/MavenRepositorySystemSessionWrapper.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.Map;\n\nimport org.eclipse.aether.RepositoryCache;\nimport org.eclipse.aether.RepositoryListener;\nimport org.eclipse.aether.RepositorySystemSession;\nimport org.eclipse.aether.SessionData;\nimport org.eclipse.aether.artifact.ArtifactTypeRegistry;\nimport org.eclipse.aether.collection.DependencyGraphTransformer;\nimport org.eclipse.aether.collection.DependencyManager;\nimport org.eclipse.aether.collection.DependencySelector;\nimport org.eclipse.aether.collection.DependencyTraverser;\nimport org.eclipse.aether.collection.VersionFilter;\nimport org.eclipse.aether.repository.AuthenticationSelector;\nimport org.eclipse.aether.repository.LocalRepository;\nimport org.eclipse.aether.repository.LocalRepositoryManager;\nimport org.eclipse.aether.repository.MirrorSelector;\nimport org.eclipse.aether.repository.ProxySelector;\nimport org.eclipse.aether.repository.WorkspaceReader;\nimport org.eclipse.aether.resolution.ArtifactDescriptorPolicy;\nimport org.eclipse.aether.resolution.ResolutionErrorPolicy;\nimport org.eclipse.aether.transfer.TransferListener;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A wrapper around the normal RepositorySystemSession to \"fool\" Maven into not checking local for remote artifacts\n */\npublic class MavenRepositorySystemSessionWrapper implements RepositorySystemSession {\n\n    private final String tempLocalRepositoryBaseDir;\n    private final RepositorySystemSession delegate;\n\n    public MavenRepositorySystemSessionWrapper(final String tempLocalRepositoryBaseDir,\n                                               final RepositorySystemSession delegate) {\n        this.tempLocalRepositoryBaseDir = PortablePreconditions.checkNotNull(\"tempLocalRepositoryBaseDir\",\n                                                                             tempLocalRepositoryBaseDir);\n        this.delegate = PortablePreconditions.checkNotNull(\"delegate\",\n                                                           delegate);\n    }\n\n    @Override\n    public boolean isOffline() {\n        return delegate.isOffline();\n    }\n\n    @Override\n    public boolean isIgnoreArtifactDescriptorRepositories() {\n        return delegate.isIgnoreArtifactDescriptorRepositories();\n    }\n\n    @Override\n    public ResolutionErrorPolicy getResolutionErrorPolicy() {\n        return delegate.getResolutionErrorPolicy();\n    }\n\n    @Override\n    public ArtifactDescriptorPolicy getArtifactDescriptorPolicy() {\n        return delegate.getArtifactDescriptorPolicy();\n    }\n\n    @Override\n    public String getChecksumPolicy() {\n        return delegate.getChecksumPolicy();\n    }\n\n    @Override\n    public String getUpdatePolicy() {\n        return delegate.getUpdatePolicy();\n    }\n\n    @Override\n    public LocalRepository getLocalRepository() {\n        return delegate.getLocalRepository();\n    }\n\n    @Override\n    public LocalRepositoryManager getLocalRepositoryManager() {\n        return new MavenLocalRepositoryManagerWrapper(tempLocalRepositoryBaseDir,\n                                                      delegate.getLocalRepositoryManager());\n    }\n\n    @Override\n    public WorkspaceReader getWorkspaceReader() {\n        return delegate.getWorkspaceReader();\n    }\n\n    @Override\n    public RepositoryListener getRepositoryListener() {\n        return delegate.getRepositoryListener();\n    }\n\n    @Override\n    public TransferListener getTransferListener() {\n        return delegate.getTransferListener();\n    }\n\n    @Override\n    public Map<String, String> getSystemProperties() {\n        return delegate.getSystemProperties();\n    }\n\n    @Override\n    public Map<String, String> getUserProperties() {\n        return delegate.getUserProperties();\n    }\n\n    @Override\n    public Map<String, Object> getConfigProperties() {\n        return delegate.getConfigProperties();\n    }\n\n    @Override\n    public MirrorSelector getMirrorSelector() {\n        return delegate.getMirrorSelector();\n    }\n\n    @Override\n    public ProxySelector getProxySelector() {\n        return delegate.getProxySelector();\n    }\n\n    @Override\n    public AuthenticationSelector getAuthenticationSelector() {\n        return delegate.getAuthenticationSelector();\n    }\n\n    @Override\n    public ArtifactTypeRegistry getArtifactTypeRegistry() {\n        return delegate.getArtifactTypeRegistry();\n    }\n\n    @Override\n    public DependencyTraverser getDependencyTraverser() {\n        return delegate.getDependencyTraverser();\n    }\n\n    @Override\n    public DependencyManager getDependencyManager() {\n        return delegate.getDependencyManager();\n    }\n\n    @Override\n    public DependencySelector getDependencySelector() {\n        return delegate.getDependencySelector();\n    }\n\n    @Override\n    public VersionFilter getVersionFilter() {\n        return delegate.getVersionFilter();\n    }\n\n    @Override\n    public DependencyGraphTransformer getDependencyGraphTransformer() {\n        return delegate.getDependencyGraphTransformer();\n    }\n\n    @Override\n    public SessionData getData() {\n        return delegate.getData();\n    }\n\n    @Override\n    public RepositoryCache getCache() {\n        return delegate.getCache();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ModuleFinder.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.POM_PATH;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@ApplicationScoped\npublic class ModuleFinder {\n\n    private POMService pomService;\n    private IOService ioService;\n\n    private ResourceResolver resourceResolver;\n\n    public ModuleFinder() {\n    }\n\n    @Inject\n    public ModuleFinder(final @Named(\"ioStrategy\") IOService ioService,\n                        final POMService pomService) {\n        this.ioService = ioService;\n        this.pomService = pomService;\n    }\n\n    public Set<Module> find(final ResourceResolver resourceResolver,\n                            final Branch branch) {\n\n        this.resourceResolver = checkNotNull(\"resourceResolver\",\n                                             resourceResolver);\n\n        return new Finder(checkNotNull(\"branch\",\n                                       branch)).find();\n    }\n\n    private class Finder {\n\n        private final Branch branch;\n\n        private final Set<Module> modules = new HashSet<Module>();\n\n        public Finder(final Branch branch) {\n            this.branch = branch;\n        }\n\n        public Set<Module> find() {\n            if (branch == null) {\n                return modules;\n            }\n\n            findModule(Paths.convert(branch.getPath()),\n                       true);\n\n            return modules;\n        }\n\n        private void findModule(final org.uberfire.java.nio.file.Path folderPath,\n                                final boolean checkModulesFromFolders) {\n            final org.uberfire.java.nio.file.Path pomPath = folderPath.resolve(POM_PATH);\n\n            if (Files.exists(pomPath)) {\n                final Module module = resourceResolver.resolveModule(Paths.convert(pomPath));\n                if (module != null) {\n                    addModule(module);\n                } else if (checkModulesFromFolders) {\n                    lookForModulesFromFolders(folderPath);\n                }\n            } else if (checkModulesFromFolders) {\n                lookForModulesFromFolders(folderPath);\n            }\n        }\n\n        private void lookForModulesFromFolders(final Path folderPath) {\n            final DirectoryStream<Path> nioRepositoryPaths = ioService.newDirectoryStream(folderPath);\n            try {\n                for (final Path nioRepositoryPath : nioRepositoryPaths) {\n\n                    if (Files.isDirectory(nioRepositoryPath)) {\n                        findModule(nioRepositoryPath,\n                                   false);\n                    }\n                }\n            } finally {\n                nioRepositoryPaths.close();\n            }\n        }\n\n        private void addModule(final Module module) {\n            module.setPom(pomService.load(module.getPomXMLPath()));\n            modules.add(module);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ModuleRepositoriesContentHandler.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.guvnor.common.services.project.model.ModuleRepositories;\nimport org.kie.soup.xstream.XStreamUtils;\n\n@Dependent\npublic class ModuleRepositoriesContentHandler {\n\n    public ModuleRepositoriesContentHandler() {\n        // Weld needs this for proxying.\n    }\n\n    public String toString(final ModuleRepositories repositories) {\n        if (repositories == null) {\n            return \"\";\n        }\n        return createXStream().toXML(repositories);\n    }\n\n    public ModuleRepositories toModel(final String text) {\n        try {\n            if (text == null || text.isEmpty()) {\n                return new ModuleRepositories();\n            }\n            return (ModuleRepositories) createXStream().fromXML(text);\n        } catch (Exception e) {\n            return new ModuleRepositories();\n        }\n    }\n\n    private XStream createXStream() {\n        XStream xStream = XStreamUtils.createTrustingXStream();\n        xStream.alias(\"project-repositories\",\n                      ModuleRepositories.class);\n        xStream.alias(\"repository\",\n                      ModuleRepositories.ModuleRepository.class);\n        return xStream;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ModuleRepositoryResolverImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.charset.StandardCharsets;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Iterator;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.maven.project.MavenProject;\nimport org.apache.maven.settings.Server;\nimport org.apache.maven.settings.Settings;\nimport org.appformer.maven.integration.Aether;\nimport org.appformer.maven.integration.embedder.MavenEmbedder;\nimport org.appformer.maven.integration.embedder.MavenProjectLoader;\nimport org.appformer.maven.integration.embedder.MavenSettings;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.repository.ArtifactRepository;\nimport org.eclipse.aether.repository.Authentication;\nimport org.eclipse.aether.repository.LocalRepository;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.eclipse.aether.repository.RepositoryPolicy;\nimport org.eclipse.aether.resolution.ArtifactRequest;\nimport org.eclipse.aether.resolution.ArtifactResolutionException;\nimport org.eclipse.aether.resolution.ArtifactResult;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.MavenRepositorySource;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.preferences.GAVPreferences;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.shared.preferences.GuvnorPreferenceScopes;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceScoped;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.guvnor.common.services.project.backend.server.MavenLocalRepositoryUtils.getRepositoryPath;\nimport static org.guvnor.common.services.project.backend.server.MavenLocalRepositoryUtils.tearDownMavenRepository;\n\n@Service\n@WorkspaceScoped\npublic class ModuleRepositoryResolverImpl\n        implements ModuleRepositoryResolver {\n\n    private static final Logger log = LoggerFactory.getLogger(ModuleRepositoryResolverImpl.class);\n\n    private IOService ioService;\n\n    private POMContentHandler pomContentHandler = new POMContentHandler();\n\n    private Instance<GAVPreferences> gavPreferencesProvider;\n\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    public ModuleRepositoryResolverImpl() {\n    }\n\n    @Inject\n    public ModuleRepositoryResolverImpl(final @Named(\"ioStrategy\") IOService ioService,\n                                        final Instance<GAVPreferences> gavPreferencesProvider,\n                                        @Customizable final WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies) {\n        this.ioService = ioService;\n        this.gavPreferencesProvider = gavPreferencesProvider;\n        this.scopeResolutionStrategies = scopeResolutionStrategies;\n    }\n\n    @Override\n    public Set<MavenRepositoryMetadata> getRemoteRepositoriesMetaData() {\n        final Set<MavenRepositoryMetadata> repositories = new HashSet<MavenRepositoryMetadata>();\n\n        final Aether aether = Aether.getAether();\n        final Map<MavenRepositorySource, Collection<RemoteRepository>> remoteRepositories = getRemoteRepositories();\n\n        //Local Repository\n        repositories.add(makeRepositoryMetaData(aether.getSession().getLocalRepository(),\n                                                MavenRepositorySource.LOCAL));\n\n        if (remoteRepositories.isEmpty()) {\n            return repositories;\n        }\n\n        for (Map.Entry<MavenRepositorySource, Collection<RemoteRepository>> e : remoteRepositories.entrySet()) {\n            repositories.addAll(makeRepositoriesMetaData(e.getValue(),\n                                                         e.getKey()));\n        }\n\n        return repositories;\n    }\n\n    @Override\n    public Set<MavenRepositoryMetadata> getRemoteRepositoriesMetaData(final Module module) {\n        if (module == null) {\n            return Collections.emptySet();\n        }\n\n        final Set<MavenRepositoryMetadata> repositories = new HashSet<>();\n\n        try {\n            //Load Project's pom.xml\n            final Path pomXMLPath = module.getPomXMLPath();\n            final org.uberfire.java.nio.file.Path nioPomXMLPath = Paths.convert(pomXMLPath);\n            final String pomXML = ioService.readAllString(nioPomXMLPath);\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            final Map<MavenRepositorySource, Collection<RemoteRepository>> remoteRepositories = getRemoteRepositories(mavenProject);\n\n            //Local Repository\n            repositories.add(makeRepositoryMetaData(Aether.getAether().getSession().getLocalRepository(),\n                                                    MavenRepositorySource.LOCAL));\n\n            if (remoteRepositories.isEmpty()) {\n                return repositories;\n            }\n\n            for (Map.Entry<MavenRepositorySource, Collection<RemoteRepository>> e : remoteRepositories.entrySet()) {\n                repositories.addAll(makeRepositoriesMetaData(e.getValue(),\n                                                             e.getKey()));\n            }\n        } catch (IllegalArgumentException iae) {\n            log.error(\"Unable to get Remote Repositories for Project '%s'. Returning empty Collection. \",\n                      module.getModuleName(),\n                      iae);\n        } catch (NoSuchFileException nsfe) {\n            log.error(\"Unable to get Remote Repositories for Project '%s'. Returning empty Collection. \",\n                      module.getModuleName(),\n                      nsfe);\n        } catch (org.uberfire.java.nio.IOException ioe) {\n            log.error(\"Unable to get Remote Repositories for Project '%s'. Returning empty Collection. \",\n                      module.getModuleName(),\n                      ioe);\n        }\n\n        return repositories;\n    }\n\n    private Set<MavenRepositoryMetadata> makeRepositoriesMetaData(final Collection<? extends ArtifactRepository> repositories,\n                                                                  final MavenRepositorySource source) {\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        for (ArtifactRepository repository : repositories) {\n            final MavenRepositoryMetadata md = makeRepositoryMetaData(repository,\n                                                                      source);\n            if (md != null) {\n                metadata.add(md);\n            }\n        }\n        return metadata;\n    }\n\n    private MavenRepositoryMetadata makeRepositoryMetaData(final ArtifactRepository repository,\n                                                           final MavenRepositorySource source) {\n        if (repository instanceof LocalRepository) {\n            final LocalRepository localRepository = (LocalRepository) repository;\n            return new MavenRepositoryMetadata(localRepository.getId(),\n                                               MavenSettings.getSettings().getLocalRepository(),\n                                               source);\n        } else if (repository instanceof RemoteRepository) {\n            final RemoteRepository remoteRepository = (RemoteRepository) repository;\n            return new MavenRepositoryMetadata(remoteRepository.getId(),\n                                               remoteRepository.getUrl(),\n                                               source);\n        }\n        return null;\n    }\n\n    @Override\n    public Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final GAV gav,\n                                                                         final MavenRepositoryMetadata... filter) {\n        GAVPreferences gavPreferences = gavPreferencesProvider.get();\n        gavPreferences.load();\n        if (gavPreferences.isConflictingGAVCheckDisabled()) {\n            return Collections.EMPTY_SET;\n        }\n\n        final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact = new HashSet<MavenRepositoryMetadata>();\n\n        try {\n            //Construct the Project's pom.xml\n            final String pomXML = pomContentHandler.toString(new POM(gav));\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            repositoriesResolvingArtifact.addAll(getRepositoriesResolvingArtifact(gav,\n                                                                                  mavenProject));\n\n            //Filter results if necessary\n            if (filter != null && filter.length > 0) {\n                repositoriesResolvingArtifact.retainAll(Arrays.asList(filter));\n            }\n        } catch (IOException ioe) {\n            log.error(\"Unable to get Remote Repositories for Project '\" + gav.toString() + \"'. Returning empty Collection. \",\n                      ioe);\n        }\n\n        return repositoriesResolvingArtifact;\n    }\n\n    @Override\n    public Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final GAV gav,\n                                                                         final Module module,\n                                                                         final MavenRepositoryMetadata... filter) {\n        GAVPreferences gavPreferences = gavPreferencesProvider.get();\n        final PreferenceScopeResolutionStrategyInfo scopeResolutionStrategyInfo = scopeResolutionStrategies.getUserInfoFor(GuvnorPreferenceScopes.PROJECT,\n                                                                                                                           module.getEncodedIdentifier());\n        gavPreferences.load(scopeResolutionStrategyInfo);\n        if (gavPreferences.isConflictingGAVCheckDisabled()) {\n            return Collections.EMPTY_SET;\n        }\n\n        final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact = new HashSet<MavenRepositoryMetadata>();\n\n        try {\n            //Load Project's pom.xml\n            final Path pomXMLPath = module.getPomXMLPath();\n            final org.uberfire.java.nio.file.Path nioPomXMLPath = Paths.convert(pomXMLPath);\n            final String pomXML = ioService.readAllString(nioPomXMLPath);\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            repositoriesResolvingArtifact.addAll(getRepositoriesResolvingArtifact(gav,\n                                                                                  mavenProject));\n\n            //Filter results if necessary\n            if (filter != null && filter.length > 0) {\n                repositoriesResolvingArtifact.retainAll(Arrays.asList(filter));\n            }\n        } catch (IllegalArgumentException iae) {\n            log.error(\"Unable to get Remote Repositories for Project '\" + module.getModuleName() + \"'. Returning empty Collection. \",\n                      iae);\n        } catch (NoSuchFileException nsfe) {\n            log.error(\"Unable to get Remote Repositories for Project '\" + module.getModuleName() + \"'. Returning empty Collection. \",\n                      nsfe);\n        } catch (org.uberfire.java.nio.IOException ioe) {\n            log.error(\"Unable to get Remote Repositories for Project '\" + module.getModuleName() + \"'. Returning empty Collection. \",\n                      ioe);\n        }\n\n        return repositoriesResolvingArtifact;\n    }\n\n    @Override\n    public Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final String pomXML,\n                                                                         final MavenRepositoryMetadata... filter) {\n        GAVPreferences gavPreferences = gavPreferencesProvider.get();\n        gavPreferences.load();\n        if (gavPreferences.isConflictingGAVCheckDisabled()) {\n            return Collections.EMPTY_SET;\n        }\n\n        final InputStream pomStream = new ByteArrayInputStream(pomXML.getBytes(StandardCharsets.UTF_8));\n        final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n        final GAV gav = new GAV(mavenProject.getGroupId(),\n                                mavenProject.getArtifactId(),\n                                mavenProject.getVersion());\n\n        final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact = new HashSet<MavenRepositoryMetadata>();\n        repositoriesResolvingArtifact.addAll(getRepositoriesResolvingArtifact(gav,\n                                                                              mavenProject));\n\n        //Filter results if necessary\n        if (filter != null && filter.length > 0) {\n            repositoriesResolvingArtifact.retainAll(Arrays.asList(filter));\n        }\n\n        return repositoriesResolvingArtifact;\n    }\n\n    private Set<MavenRepositoryMetadata> getRepositoriesResolvingArtifact(final GAV gav,\n                                                                          final MavenProject mavenProject) {\n        ArtifactResult result = null;\n        ArtifactRequest artifactRequest = null;\n\n        final String artifactName = gav.toString();\n        final Artifact artifact = new DefaultArtifact(artifactName);\n        final Aether aether = new Aether(mavenProject);\n\n        final Set<MavenRepositoryMetadata> repositoriesResolvingArtifact = new HashSet<MavenRepositoryMetadata>();\n        final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = getRemoteRepositories(mavenProject);\n\n        //Local Repository\n        artifactRequest = new ArtifactRequest();\n        artifactRequest.setArtifact(artifact);\n        try {\n            result = aether.getSystem().resolveArtifact(aether.getSession(),\n                                                        artifactRequest);\n            if (result != null && result.isResolved()) {\n                final MavenRepositoryMetadata artifactRepositoryMetaData = makeRepositoryMetaData(result.getRepository(),\n                                                                                                  MavenRepositorySource.LOCAL);\n                if (artifactRepositoryMetaData != null) {\n                    repositoriesResolvingArtifact.add(artifactRepositoryMetaData);\n                }\n            }\n        } catch (ArtifactResolutionException are) {\n            //Ignore - this means the Artifact could not be resolved against the given RemoteRepository\n        }\n\n        //Remote Repositories\n        try {\n            for (Map.Entry<MavenRepositorySource, Collection<RemoteRepository>> e : repositories.entrySet()) {\n                for (ArtifactRepository repository : e.getValue()) {\n                    artifactRequest = new ArtifactRequest();\n                    artifactRequest.setArtifact(artifact);\n                    java.nio.file.Path tempLocalRepositoryBasePath = null;\n                    try {\n                        // Maven always tries to resolve against LocalRepository first, which is not much use when we want to check\n                        // if the Artifact is available on a RemoteRepository. Therefore substitute the default RepositorySystemSession\n                        // with one that provides a LocalRepositoryManager that always uses an empty transient LocalRepository to ensure\n                        // Maven does not resolve Artifacts locally.\n                        artifactRequest.addRepository((RemoteRepository) repository);\n                        tempLocalRepositoryBasePath = getRepositoryPath(gav);\n                        result = aether.getSystem().resolveArtifact(new MavenRepositorySystemSessionWrapper(tempLocalRepositoryBasePath.toString(),\n                                                                                                            aether.getSession()),\n                                                                    artifactRequest);\n\n                        if (result != null && result.isResolved()) {\n                            final MavenRepositoryMetadata artifactRepositoryMetaData = makeRepositoryMetaData(result.getRepository(),\n                                                                                                              e.getKey());\n                            if (artifactRepositoryMetaData != null) {\n                                repositoriesResolvingArtifact.add(artifactRepositoryMetaData);\n                            }\n                        }\n                    } catch (ArtifactResolutionException are) {\n                        //Ignore - this means the Artifact could not be resolved against the given RemoteRepository\n                    } finally {\n                        tearDownMavenRepository(tempLocalRepositoryBasePath);\n                    }\n                }\n            }\n        } catch (IOException ioe) {\n            log.error(\"Error resolving '\" + gav.toString() + \"' against Repositories. Returning empty Collection. \",\n                      ioe);\n        }\n\n        return repositoriesResolvingArtifact;\n    }\n\n    private Map<MavenRepositorySource, Collection<RemoteRepository>> getRemoteRepositories() {\n        final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = new HashMap<MavenRepositorySource, Collection<RemoteRepository>>();\n\n        //Settings.xml Repositories\n        final Collection<RemoteRepository> settingsRepositories = new HashSet<RemoteRepository>(MavenSettings.getMavenRepositoryConfiguration().getRemoteRepositoriesForRequest());\n        if (settingsRepositories != null) {\n            repositories.put(MavenRepositorySource.SETTINGS,\n                             settingsRepositories);\n        }\n\n        return repositories;\n    }\n\n    private Map<MavenRepositorySource, Collection<RemoteRepository>> getRemoteRepositories(final MavenProject mavenProject) {\n        //Get Local and Settings.xml Repositories\n        final Map<MavenRepositorySource, Collection<RemoteRepository>> repositories = new HashMap<MavenRepositorySource, Collection<RemoteRepository>>();\n        repositories.putAll(getRemoteRepositories());\n\n        //Project's Repositories, includes those in setting.xml\n        final Collection<RemoteRepository> projectRepositories = new HashSet<RemoteRepository>(mavenProject.getRemoteProjectRepositories());\n        if (projectRepositories != null) {\n            //Remove Project Repositories that are in settings.xml\n            final Collection<RemoteRepository> settingsRepositories = repositories.get(MavenRepositorySource.SETTINGS);\n            removeProjectRepositoriesThatAreInSettings(projectRepositories,\n                                                       settingsRepositories);\n            repositories.put(MavenRepositorySource.PROJECT,\n                             projectRepositories);\n        }\n\n        //Project's <distributionManagement> Repositories\n        final org.apache.maven.artifact.repository.ArtifactRepository distributionManagementRepository = mavenProject.getDistributionManagementArtifactRepository();\n        if (distributionManagementRepository != null) {\n            repositories.put(MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                             new HashSet<RemoteRepository>() {{\n                                 add(convertToArtifactRepository(distributionManagementRepository));\n                             }});\n        }\n\n        return repositories;\n    }\n\n    private void removeProjectRepositoriesThatAreInSettings(final Collection<RemoteRepository> projectRepositories,\n                                                            final Collection<RemoteRepository> settingsRepositories) {\n        final Collection<RemoteRepository> projectRepositoriesToRemove = new HashSet<RemoteRepository>();\n        final Iterator<RemoteRepository> projectRepositoryItr = projectRepositories.iterator();\n        while (projectRepositoryItr.hasNext()) {\n            final RemoteRepository projectRepository = projectRepositoryItr.next();\n            for (RemoteRepository settingsRepository : settingsRepositories) {\n                if (projectRepository.getId().equals(settingsRepository.getId())) {\n                    if (projectRepository.getUrl().equals(settingsRepository.getUrl())) {\n                        projectRepositoriesToRemove.add(projectRepository);\n                    }\n                }\n            }\n        }\n        projectRepositories.removeAll(projectRepositoriesToRemove);\n    }\n\n    private RemoteRepository convertToArtifactRepository(final org.apache.maven.artifact.repository.ArtifactRepository artifactRepository) {\n        final MavenEmbedder mavenEmbedder = MavenProjectLoader.newMavenEmbedder(MavenSettings.getSettings().isOffline());\n        final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(artifactRepository.getId(),\n                                                                                        artifactRepository.getLayout().getId(),\n                                                                                        artifactRepository.getUrl())\n                .setSnapshotPolicy(new RepositoryPolicy(true,\n                                                        RepositoryPolicy.UPDATE_POLICY_DAILY,\n                                                        RepositoryPolicy.CHECKSUM_POLICY_WARN))\n                .setReleasePolicy(new RepositoryPolicy(true,\n                                                       RepositoryPolicy.UPDATE_POLICY_ALWAYS,\n                                                       RepositoryPolicy.CHECKSUM_POLICY_WARN));\n\n        final Settings settings = MavenSettings.getSettings();\n        final Server server = settings.getServer(artifactRepository.getId());\n\n        if (server != null) {\n            final Authentication authentication = mavenEmbedder\n                    .getMavenSession()\n                    .getRepositorySession()\n                    .getAuthenticationSelector()\n                    .getAuthentication(remoteRepoBuilder.build());\n            remoteRepoBuilder.setAuthentication(authentication);\n        }\n\n        return remoteRepoBuilder.build();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ModuleResourcePathResolver.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.project.model.Package;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Resolves the by default target path within a module for a given resource based on it's type.\n */\npublic interface ModuleResourcePathResolver {\n\n    /**\n     * @return Defines the resolver priority. If two resolvers are found for the same resource type, the one with highest\n     * priority will be used.\n     */\n    int getPriority();\n\n    /**\n     * Indicates if this path resolver resolves the given resource type.\n     * @param resourceType a file extension.\n     * @return true if current resolver resolves the given resourceType, false in any other case.\n     */\n    boolean accept(final String resourceType);\n\n    /**\n     * Given a package resolves where the currently accepted resourceType should be placed by default.\n     * e.g. for a package org.kie and a drl extension, the by default target path will be src/main/resources/org/kie,\n     * and for a java extension with the same package the by default target path will be src/main/java/org/kie\n     * @param pkg A package within a module.\n     * @return the expected by default path for the given extension.\n     */\n    Path resolveDefaultPath(final Package pkg);\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/POMServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Writer;\nimport org.codehaus.plexus.util.xml.pull.XmlPullParserException;\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.events.ModuleUpdatedEvent;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepository;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.backend.server.cdi.workspace.WorkspaceScoped;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.mvp.Command;\n\n@Service\n@WorkspaceScoped\npublic class POMServiceImpl\n        implements POMService {\n\n    public static final String POM_XML = \"pom.xml\";\n\n    private final Logger logger = LoggerFactory.getLogger(POMServiceImpl.class);\n    private IOService ioService;\n    private POMContentHandler pomContentHandler;\n    private M2RepoService m2RepoService;\n    private MetadataService metadataService;\n    private Event<ModuleUpdatedEvent> moduleUpdatedEvent;\n    private ModuleService<? extends Module> moduleService;\n    private MavenXpp3Writer writer;\n    private PomEnhancer pomEnhancer;\n\n    private CommentedOptionFactory optionsFactory;\n\n    public POMServiceImpl() {\n        // For Weld\n    }\n\n    @Inject\n    public POMServiceImpl(final @Named(\"ioStrategy\") IOService ioService,\n                          final POMContentHandler pomContentHandler,\n                          final M2RepoService m2RepoService,\n                          final MetadataService metadataService,\n                          final Event<ModuleUpdatedEvent> moduleUpdatedEvent,\n                          final ModuleService<? extends Module> moduleService,\n                          final CommentedOptionFactory optionsFactory,\n                          final @Customizable PomEnhancer pomEnhancer) {\n        this.ioService = ioService;\n        this.pomContentHandler = pomContentHandler;\n        this.m2RepoService = m2RepoService;\n        this.metadataService = metadataService;\n        this.moduleUpdatedEvent = moduleUpdatedEvent;\n        this.moduleService = moduleService;\n        this.optionsFactory = optionsFactory;\n        writer = new MavenXpp3Writer();\n        this.pomEnhancer = pomEnhancer;\n    }\n\n    @Override\n    public Path create(final Path projectRoot,\n                       final POM pomModel) {\n        org.uberfire.java.nio.file.Path pathToPOMXML = null;\n        try {\n            pomModel.addRepository(getRepository());\n            pathToPOMXML = Paths.convert(projectRoot).resolve(POM_XML);\n\n            if (ioService.exists(pathToPOMXML)) {\n                throw new FileAlreadyExistsException(pathToPOMXML.toString());\n            }\n            write(pomEnhancer.execute(pomContentHandler.convert(pomModel)),\n                  pathToPOMXML,\n                  ioService);\n            //Don't raise a NewResourceAdded event as this is handled at the Project level in ProjectServices\n            return Paths.convert(pathToPOMXML);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    private MavenRepository getRepository() {\n        final MavenRepository mavenRepository = new MavenRepository();\n        mavenRepository.setId(\"guvnor-m2-repo\");\n        mavenRepository.setName(\"Guvnor M2 Repo\");\n        mavenRepository.setUrl(m2RepoService.getRepositoryURL());\n        return mavenRepository;\n    }\n\n    private void write(Model model, org.uberfire.java.nio.file.Path pathToPOMXML, IOService ioService) {\n        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {\n            writer.write(baos, model);\n            ioService.write(pathToPOMXML, new String(baos.toByteArray(), StandardCharsets.UTF_8));\n        } catch (Exception e) {\n            logger.error(e.getMessage(), e);\n        }\n    }\n\n    @Override\n    public POM load(final Path pomPath) {\n        try {\n            return pomContentHandler.toModel(loadPomXMLString(pomPath));\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    private String loadPomXMLString(final Path pomPath) {\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(pomPath);\n        return ioService.readAllString(nioPath);\n    }\n\n    @Override\n    public Path save(final Path pomPath,\n                     final POM pom,\n                     final Metadata metadata,\n                     final String comment) {\n        return save(pomPath,\n                    pom,\n                    metadata,\n                    comment,\n                    false);\n    }\n\n    @Override\n    public Path save(final Path pomPath,\n                     final POM pom,\n                     final Metadata metadata,\n                     final String comment,\n                     final boolean updateModules) {\n        return new PomSaver(pomPath,\n                            pom,\n                            metadata,\n                            comment).savePOM(updateModules);\n    }\n\n    private class PomSaver {\n\n        private final Path pomPath;\n        private final POM pom;\n        private final Metadata metadata;\n        private String comment;\n        private List<Command> updates = new ArrayList<>();\n\n        public PomSaver(final Path pomPath,\n                        final POM pom,\n                        final Metadata metadata,\n                        final String comment) {\n\n            this.pomPath = pomPath;\n            this.pom = pom;\n            this.metadata = metadata;\n            this.comment = comment;\n        }\n\n        public Path savePOM(final boolean updateModules) {\n\n            try {\n                ioService.startBatch(Paths.convert(pomPath).getFileSystem(),\n                                     optionsFactory.makeCommentedOption(comment != null ? comment : \"\"));\n\n                savePOM();\n\n                if (updateModules) {\n                    saveSubModulePOMs();\n                }\n\n                return pomPath;\n            } catch (Exception e) {\n                throw ExceptionUtilities.handleException(e);\n            } finally {\n\n                ioService.endBatch();\n\n                for (final Command update : updates) {\n                    update.execute();\n                }\n            }\n        }\n\n        private void savePOM() throws IOException, XmlPullParserException {\n            savePOM(pomPath,\n                    pom,\n                    metadata);\n        }\n\n        private void savePOM(final Path pomPath,\n                             final POM pom,\n                             final Metadata metadata) throws IOException, XmlPullParserException {\n            final Optional<Module> oldModuleForUpdateEvent = getModuleIfPomHasChanges(pomPath,\n                                                                                      pom);\n\n            if (metadata == null) {\n                ioService.write(Paths.convert(pomPath),\n                                pomContentHandler.toString(pom,\n                                                           loadPomXMLString(pomPath)));\n            } else {\n                ioService.write(Paths.convert(pomPath),\n                                pomContentHandler.toString(pom,\n                                                           loadPomXMLString(pomPath)),\n                                metadataService.setUpAttributes(pomPath,\n                                                                metadata));\n            }\n\n            if (oldModuleForUpdateEvent.isPresent()) {\n                updates.add(() -> moduleUpdatedEvent.fire(new ModuleUpdatedEvent(oldModuleForUpdateEvent.get(),\n                                                                                 moduleService.resolveModule(pomPath))));\n            }\n        }\n\n        private Optional<Module> getModuleIfPomHasChanges(final Path pomPath,\n                                                          final POM pom) {\n            POM load = load(pomPath);\n            if (!load.equals(pom)) {\n                return Optional.of(moduleService.resolveModule(pomPath));\n            } else {\n                return Optional.empty();\n            }\n        }\n\n        private void saveSubModulePOMs() throws IOException, XmlPullParserException {\n\n            if (pom.isMultiModule() &&\n                    pom.getModules() != null) {\n                for (final String childModuleName : pom.getModules()) {\n                    saveGAVChange(pom.getGav(),\n                                  childModuleName);\n                }\n            }\n        }\n\n        private void saveGAVChange(final GAV gav,\n                                   final String childModuleName) throws IOException, XmlPullParserException {\n\n            final org.uberfire.java.nio.file.Path childPOMPath = Paths.convert(pomPath).getParent().resolve(childModuleName).resolve(POM_XML);\n\n            if (ioService.exists(childPOMPath)) {\n                final POM childContent = load(Paths.convert(childPOMPath));\n                if (childContent != null) {\n                    childContent.setParent(gav);\n                    childContent.getGav().setGroupId(gav.getGroupId());\n                    childContent.getGav().setVersion(gav.getVersion());\n\n                    savePOM(Paths.convert(childPOMPath),\n                            childContent,\n                            null);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/PomEnhancer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\npublic interface PomEnhancer {\n\n    org.apache.maven.model.Model execute(org.apache.maven.model.Model model);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/PomEnhancerProvider.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.annotations.FallbackImplementation;\n\n@ApplicationScoped\npublic class PomEnhancerProvider {\n\n    @Inject\n    private Instance<PomEnhancer> pomEnhancer;\n\n    @Inject\n    @FallbackImplementation\n    private DefaultPomEnhancer defaultPomEnhancer;\n\n    @Produces\n    @Customizable\n    public PomEnhancer produce() {\n        if (this.pomEnhancer.isUnsatisfied()) {\n            return defaultPomEnhancer;\n        }\n        return this.pomEnhancer.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ProjectConfigurationContentHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.guvnor.common.services.project.model.ProjectImports;\nimport org.kie.soup.xstream.XStreamUtils;\nimport org.kie.soup.project.datamodel.imports.Import;\n\n@Dependent\npublic class ProjectConfigurationContentHandler {\n\n    public ProjectConfigurationContentHandler() {\n        // Weld needs this for proxying.\n    }\n\n    public String toString(final ProjectImports configuration) {\n        if (configuration == null) {\n            return \"\";\n        }\n        return createXStream().toXML(configuration);\n    }\n\n    public ProjectImports toModel(final String text) {\n        if (text == null || text.isEmpty()) {\n            return new ProjectImports();\n        }\n        return (ProjectImports) createXStream().fromXML(text);\n    }\n\n    private XStream createXStream() {\n        XStream xStream = XStreamUtils.createTrustingXStream();\n        xStream.alias(\"configuration\",\n                      ProjectImports.class);\n        xStream.alias(\"import\",\n                      Import.class);\n        return xStream;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/ResourceResolver.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.apache.commons.lang3.StringUtils;\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.file.LinkedDirectoryFilter;\nimport org.guvnor.common.services.backend.file.LinkedDotFileFilter;\nimport org.guvnor.common.services.backend.file.LinkedMetaInfFolderFilter;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.IdentifierUtils;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.ModuleResourceResolver;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.service.PackageAlreadyExistsException;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\n\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.MAIN_RESOURCES_PATH;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.MAIN_SRC_PATH;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.POM_PATH;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.SOURCE_PATHS;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.TEST_RESOURCES_PATH;\nimport static org.guvnor.common.services.project.utils.ModuleResourcePaths.TEST_SRC_PATH;\n\npublic abstract class ResourceResolver<T extends Module>\n        implements ModuleResourceResolver<T> {\n\n    protected IOService ioService;\n    protected POMService pomService;\n    protected CommentedOptionFactory commentedOptionFactory;\n    protected List<ModuleResourcePathResolver> resourcePathResolvers = new ArrayList<>();\n\n    public ResourceResolver() {\n    }\n\n    public ResourceResolver(final IOService ioService,\n                            final POMService pomService,\n                            final CommentedOptionFactory commentedOptionFactory,\n                            final Instance<ModuleResourcePathResolver> resourcePathResolversInstance) {\n        this.ioService = ioService;\n        this.pomService = pomService;\n        this.commentedOptionFactory = commentedOptionFactory;\n        initResourcePathResolvers(resourcePathResolversInstance);\n    }\n\n    private void initResourcePathResolvers(final Instance<ModuleResourcePathResolver> resourcePathResolversInstance) {\n        Optional.ofNullable(resourcePathResolversInstance.iterator())\n                .ifPresent(iterator -> iterator.forEachRemaining(resolver -> resourcePathResolvers.add(resolver)));\n    }\n\n    public Package newPackage(final Package parentPackage,\n                              final String packageName,\n                              final boolean startBatch) {\n        //If the package name contains separators, create sub-folders\n        String newPackageName = packageName.toLowerCase();\n        if (newPackageName.contains(\".\")) {\n            newPackageName = newPackageName.replace(\".\",\n                                                    \"/\");\n        }\n\n        //Return new package\n        final Path mainSrcPath = parentPackage.getPackageMainSrcPath();\n        final Path testSrcPath = parentPackage.getPackageTestSrcPath();\n        final Path mainResourcesPath = parentPackage.getPackageMainResourcesPath();\n        final Path testResourcesPath = parentPackage.getPackageTestResourcesPath();\n\n        Path pkgPath = null;\n        final FileSystem fs = Paths.convert(parentPackage.getPackageMainSrcPath()).getFileSystem();\n\n        try {\n\n            if (startBatch) {\n                ioService.startBatch(fs,\n                                     commentedOptionFactory.makeCommentedOption(\"New package [\" + packageName + \"]\"));\n            }\n\n            final org.uberfire.java.nio.file.Path nioMainSrcPackagePath = Paths.convert(mainSrcPath).resolve(newPackageName);\n            if (!Files.exists(nioMainSrcPackagePath)) {\n                pkgPath = Paths.convert(ioService.createDirectory(nioMainSrcPackagePath));\n            }\n            final org.uberfire.java.nio.file.Path nioTestSrcPackagePath = Paths.convert(testSrcPath).resolve(newPackageName);\n            if (!Files.exists(nioTestSrcPackagePath)) {\n                pkgPath = Paths.convert(ioService.createDirectory(nioTestSrcPackagePath));\n            }\n            final org.uberfire.java.nio.file.Path nioMainResourcesPackagePath = Paths.convert(mainResourcesPath).resolve(newPackageName);\n            if (!Files.exists(nioMainResourcesPackagePath)) {\n                pkgPath = Paths.convert(ioService.createDirectory(nioMainResourcesPackagePath));\n            }\n            final org.uberfire.java.nio.file.Path nioTestResourcesPackagePath = Paths.convert(testResourcesPath).resolve(newPackageName);\n            if (!Files.exists(nioTestResourcesPackagePath)) {\n                pkgPath = Paths.convert(ioService.createDirectory(nioTestResourcesPackagePath));\n            }\n\n            //If pkgPath is null the package already existed in src/main/java, scr/main/resources, src/test/java and src/test/resources\n            if (pkgPath == null) {\n                throw new PackageAlreadyExistsException(packageName);\n            }\n\n            //Return new package\n            final Package newPackage = resolvePackage(pkgPath);\n            return newPackage;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        } finally {\n            if (startBatch) {\n                ioService.endBatch();\n            }\n        }\n    }\n\n    private String getPackagePathSuffix(final org.uberfire.java.nio.file.Path nioModuleRootPath,\n                                        final org.uberfire.java.nio.file.Path nioPackagePath) {\n        final org.uberfire.java.nio.file.Path nioMainSrcPath = nioModuleRootPath.resolve(MAIN_SRC_PATH);\n        final org.uberfire.java.nio.file.Path nioTestSrcPath = nioModuleRootPath.resolve(TEST_SRC_PATH);\n        final org.uberfire.java.nio.file.Path nioMainResourcesPath = nioModuleRootPath.resolve(MAIN_RESOURCES_PATH);\n        final org.uberfire.java.nio.file.Path nioTestResourcesPath = nioModuleRootPath.resolve(TEST_RESOURCES_PATH);\n\n        String packageName = null;\n        org.uberfire.java.nio.file.Path packagePath = null;\n        if (nioPackagePath.startsWith(nioMainSrcPath)) {\n            packagePath = nioMainSrcPath.relativize(nioPackagePath);\n            packageName = packagePath.toString();\n        } else if (nioPackagePath.startsWith(nioTestSrcPath)) {\n            packagePath = nioTestSrcPath.relativize(nioPackagePath);\n            packageName = packagePath.toString();\n        } else if (nioPackagePath.startsWith(nioMainResourcesPath)) {\n            packagePath = nioMainResourcesPath.relativize(nioPackagePath);\n            packageName = packagePath.toString();\n        } else if (nioPackagePath.startsWith(nioTestResourcesPath)) {\n            packagePath = nioTestResourcesPath.relativize(nioPackagePath);\n            packageName = packagePath.toString();\n        }\n\n        return packageName;\n    }\n\n    @Override\n    public T resolveModule(final Path resource) {\n        return resolveModule(resource, true);\n    }\n\n    @Override\n    public Module resolveParentModule(final Path resource) {\n        try {\n            //Null resource paths cannot resolve to a Module\n            if (resource == null) {\n                return null;\n            }\n            //Check if resource is the module root\n            final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();\n\n            if (hasPom(path)) {\n                final Path moduleRootPath = Paths.convert(path);\n                final Path pomXMLPath = Paths.convert(path.resolve(POM_PATH));\n                final POM pom = pomService.load(pomXMLPath);\n\n                return new Module(moduleRootPath,\n                                  pomXMLPath,\n                                  pom);\n            } else {\n                return null;\n            }\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Module resolveToParentModule(final Path resource) {\n        try {\n            //Null resource paths cannot resolve to a Module\n            if (resource == null) {\n                return null;\n            }\n            //Check if resource is the module root\n            org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();\n\n            org.uberfire.java.nio.file.Path parentPomPath = path.resolve(POM_PATH);\n\n            if (hasPom(path)) {\n                POM parent = pomService.load(Paths.convert(parentPomPath));\n\n                final Path moduleRootPath = Paths.convert(path);\n                Module module = new Module(moduleRootPath,\n                                           Paths.convert(parentPomPath),\n                                           parent,\n                                           parent.getModules());\n                return module;\n            } else {\n                return null;\n            }\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Set<Package> resolvePackages(final Module module) {\n        final Set<Package> packages = new HashSet<>();\n        final Set<String> packageNames = new HashSet<>();\n        if (module == null) {\n            return packages;\n        }\n        //Build a set of all package names across /src/main/java, /src/main/resources, /src/test/java and /src/test/resources paths\n        //It is possible (if the module was not created within the workbench that some packages only exist in certain paths)\n        final Path moduleRoot = module.getRootPath();\n        final org.uberfire.java.nio.file.Path nioModuleRootPath = Paths.convert(moduleRoot);\n        for (String src : SOURCE_PATHS) {\n            final org.uberfire.java.nio.file.Path nioPackageRootSrcPath = nioModuleRootPath.resolve(src);\n            packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                                nioPackageRootSrcPath,\n                                                true,\n                                                true,\n                                                true));\n        }\n\n        return resolvePackages(module,\n                               packageNames);\n    }\n\n    @Override\n    public Set<Package> resolvePackages(final Module module,\n                                        final Set<String> packageNames) {\n        final Set<Package> packages = new HashSet<>();\n        if (module == null) {\n            return packages;\n        }\n\n        final Set<String> convertedPackages = new HashSet<>();\n        for (String packageName : packageNames) {\n            convertedPackages.add(packageName.replace(\".\", \"/\"));\n        }\n\n        final Path moduleRoot = module.getRootPath();\n        final org.uberfire.java.nio.file.Path nioModuleRootPath = Paths.convert(moduleRoot);\n\n        //Construct Package objects for each package name\n        final java.util.Set<String> resolvedPackages = new java.util.HashSet<>();\n        for (String packagePathSuffix : convertedPackages) {\n            for (String src : SOURCE_PATHS) {\n                final org.uberfire.java.nio.file.Path nioPackagePath = nioModuleRootPath.resolve(src).resolve(packagePathSuffix);\n                if (Files.exists(nioPackagePath) && !resolvedPackages.contains(packagePathSuffix)) {\n                    packages.add(resolvePackage(Paths.convert(nioPackagePath)));\n                    resolvedPackages.add(packagePathSuffix);\n                }\n            }\n        }\n\n        return packages;\n    }\n\n    @Override\n    public Set<Package> resolvePackages(final Package pkg) {\n        final Set<Package> packages = new HashSet<>();\n        final Set<String> packageNames = new HashSet<>();\n        if (pkg == null) {\n            return packages;\n        }\n\n        //Build a set of all package names across /src/main/java, /src/main/resources, /src/test/java and /src/test/resources paths\n        //It is possible (if the module was not created within the workbench that some packages only exist in certain paths)\n\n        final Path moduleRoot = pkg.getModuleRootPath();\n        final org.uberfire.java.nio.file.Path nioModuleRootPath = Paths.convert(moduleRoot);\n\n        for (String src : SOURCE_PATHS) {\n            final org.uberfire.java.nio.file.Path nioPackageRootSrcPath = nioModuleRootPath.resolve(src).resolve(resolvePkgName(pkg.getCaption()));\n            packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                                nioPackageRootSrcPath,\n                                                false,\n                                                true,\n                                                false));\n        }\n\n        //Construct Package objects for each package name\n        final java.util.Set<String> resolvedPackages = new java.util.HashSet<>();\n        for (String packagePathSuffix : packageNames) {\n            for (String src : SOURCE_PATHS) {\n                final org.uberfire.java.nio.file.Path nioPackagePath = nioModuleRootPath.resolve(src).resolve(packagePathSuffix);\n                if (Files.exists(nioPackagePath) && !resolvedPackages.contains(packagePathSuffix)) {\n                    packages.add(resolvePackage(Paths.convert(nioPackagePath)));\n                    resolvedPackages.add(packagePathSuffix);\n                }\n            }\n        }\n\n        return packages;\n    }\n\n    @Override\n    public org.guvnor.common.services.project.model.Package resolveDefaultPackage(final Module module) {\n        final Set<String> packageNames = new HashSet<>();\n        if (module == null) {\n            return null;\n        }\n        //Build a set of all package names across /src/main/java, /src/main/resources, /src/test/java and /src/test/resources paths\n        //It is possible (if the module was not created within the workbench that some packages only exist in certain paths)\n        final Path moduleRoot = module.getRootPath();\n        final org.uberfire.java.nio.file.Path nioModuleRootPath = Paths.convert(moduleRoot);\n        for (String src : SOURCE_PATHS) {\n            final org.uberfire.java.nio.file.Path nioPackageRootSrcPath = nioModuleRootPath.resolve(src);\n            packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                                nioPackageRootSrcPath,\n                                                true,\n                                                true,\n                                                false));\n        }\n\n        //Construct Package objects for each package name\n        final java.util.Set<String> resolvedPackages = new java.util.HashSet<>();\n        for (String packagePathSuffix : packageNames) {\n            for (String src : SOURCE_PATHS) {\n                final org.uberfire.java.nio.file.Path nioPackagePath = nioModuleRootPath.resolve(src).resolve(packagePathSuffix);\n                if (Files.exists(nioPackagePath) && !resolvedPackages.contains(packagePathSuffix)) {\n                    return resolvePackage(Paths.convert(nioPackagePath));\n                }\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public Package resolveDefaultWorkspacePackage(final Module module) {\n        final Path moduleRootPath = module.getRootPath();\n        final GAV gav = module.getPom().getGav();\n        final String defaultWorkspacePackagePath = getDefaultWorkspacePath(gav);\n\n        final org.uberfire.java.nio.file.Path defaultWorkspacePath = Paths.convert(moduleRootPath).resolve(MAIN_RESOURCES_PATH + \"/\" + defaultWorkspacePackagePath);\n\n        return resolvePackage(Paths.convert(defaultWorkspacePath));\n    }\n\n    @Override\n    public Package resolveParentPackage(final Package pkg) {\n        final Set<String> packageNames = new HashSet<>();\n\n        //Build a set of all package names across /src/main/java, /src/main/resources, /src/test/java and /src/test/resources paths\n        final org.uberfire.java.nio.file.Path nioModuleRootPath = Paths.convert(pkg.getModuleRootPath());\n        packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                            Paths.convert(pkg.getPackageMainSrcPath()).getParent(),\n                                            true,\n                                            false,\n                                            false));\n        packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                            Paths.convert(pkg.getPackageMainResourcesPath()).getParent(),\n                                            true,\n                                            false,\n                                            false));\n        packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                            Paths.convert(pkg.getPackageTestSrcPath()).getParent(),\n                                            true,\n                                            false,\n                                            false));\n        packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                            Paths.convert(pkg.getPackageTestResourcesPath()).getParent(),\n                                            true,\n                                            false,\n                                            false));\n\n        //Construct Package objects for each package name\n        for (String packagePathSuffix : packageNames) {\n            for (String src : SOURCE_PATHS) {\n                if (packagePathSuffix == null) {\n                    return null;\n                }\n                final org.uberfire.java.nio.file.Path nioPackagePath = nioModuleRootPath.resolve(src).resolve(packagePathSuffix);\n                if (Files.exists(nioPackagePath)) {\n                    return resolvePackage(Paths.convert(nioPackagePath));\n                }\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public Path resolveDefaultPath(final Package pkg,\n                                   final String resourceType) {\n        final ModuleResourcePathResolver[] currentResolver = new ModuleResourcePathResolver[1];\n        resourcePathResolvers.forEach(resolver -> {\n            if (resolver.accept(resourceType)) {\n                if (currentResolver[0] == null || currentResolver[0].getPriority() < resolver.getPriority()) {\n                    currentResolver[0] = resolver;\n                }\n            }\n        });\n        if (currentResolver[0] == null) {\n            //uncommon case, by construction the DefaultModuleResourcePathResolver is exists.\n            throw new RuntimeException(\"No ModuleResourcePathResolver has been defined for resourceType: \" + resourceType);\n        } else {\n            return currentResolver[0].resolveDefaultPath(pkg);\n        }\n    }\n\n    @Override\n    public boolean isPom(final Path resource) {\n        try {\n            //Null resource paths cannot resolve to a Module\n            if (resource == null) {\n                return false;\n            }\n\n            //Check if path equals pom.xml\n            final Module module = resolveModule(resource);\n\n            //It's possible that the Incremental Build attempts to act on a Module file before the module has been fully created.\n            //This should be a short-term issue that will be resolved when saving a module batches pom.xml, kmodule.xml and project.imports\n            //etc into a single git-batch. At present they are saved individually leading to multiple Incremental Build requests.\n            if (module == null) {\n                return false;\n            }\n\n            final org.uberfire.java.nio.file.Path path = Paths.convert(resource).normalize();\n            final org.uberfire.java.nio.file.Path pomFilePath = Paths.convert(module.getPomXMLPath());\n            return path.startsWith(pomFilePath);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public org.guvnor.common.services.project.model.Package resolvePackage(final Path resource) {\n        try {\n            //Null resource paths cannot resolve to a Module\n            if (resource == null) {\n                return null;\n            }\n\n            //If Path is not within a Module we cannot resolve a package\n            final Module module = resolveModule(resource);\n            if (module == null) {\n                return null;\n            }\n\n            //pom.xml is not inside a package\n            if (isPom(resource)) {\n                return null;\n            }\n\n            return makePackage(module,\n                               resource);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    public String getDefaultWorkspacePath(final GAV gav) {\n        return StringUtils.join(getLegalId(gav.getGroupId()),\n                                \"/\") + \"/\" + StringUtils.join(getLegalId(gav.getArtifactId()),\n                                                              \"/\");\n    }\n\n    public String[] getLegalId(final String id) {\n        return IdentifierUtils.convertMavenIdentifierToJavaIdentifier(id.split(\"\\\\.\",\n                                                                               -1));\n    }\n\n    protected boolean hasPom(final org.uberfire.java.nio.file.Path path) {\n        final org.uberfire.java.nio.file.Path pomPath = path.resolve(POM_PATH);\n        return Files.exists(pomPath);\n    }\n\n    protected T makeModule(final org.uberfire.java.nio.file.Path nioModuleRootPath) {\n        return simpleModuleInstance(nioModuleRootPath);\n    }\n\n    /**\n     * This does not contain the POM. So it is simple.\n     *\n     * @param nioModuleRootPath Module root path\n     * @return\n     */\n    public abstract T simpleModuleInstance(final org.uberfire.java.nio.file.Path nioModuleRootPath);\n\n    protected Package makePackage(final Module module,\n                                  final Path resource) {\n        final Path moduleRoot = module.getRootPath();\n        final org.uberfire.java.nio.file.Path nioModuleRoot = Paths.convert(moduleRoot);\n        final org.uberfire.java.nio.file.Path nioMainSrcPath = nioModuleRoot.resolve(MAIN_SRC_PATH);\n        final org.uberfire.java.nio.file.Path nioTestSrcPath = nioModuleRoot.resolve(TEST_SRC_PATH);\n        final org.uberfire.java.nio.file.Path nioMainResourcesPath = nioModuleRoot.resolve(MAIN_RESOURCES_PATH);\n        final org.uberfire.java.nio.file.Path nioTestResourcesPath = nioModuleRoot.resolve(TEST_RESOURCES_PATH);\n\n        org.uberfire.java.nio.file.Path nioResource = Paths.convert(resource);\n\n        if (Files.isRegularFile(nioResource)) {\n            nioResource = nioResource.getParent();\n        }\n\n        String packageName = null;\n        org.uberfire.java.nio.file.Path packagePath = null;\n        if (nioResource.startsWith(nioMainSrcPath)) {\n            packagePath = nioMainSrcPath.relativize(nioResource);\n            packageName = packagePath.toString().replaceAll(\"/\",\n                                                            \".\");\n        } else if (nioResource.startsWith(nioTestSrcPath)) {\n            packagePath = nioTestSrcPath.relativize(nioResource);\n            packageName = packagePath.toString().replaceAll(\"/\",\n                                                            \".\");\n        } else if (nioResource.startsWith(nioMainResourcesPath)) {\n            packagePath = nioMainResourcesPath.relativize(nioResource);\n            packageName = packagePath.toString().replaceAll(\"/\",\n                                                            \".\");\n        } else if (nioResource.startsWith(nioTestResourcesPath)) {\n            packagePath = nioTestResourcesPath.relativize(nioResource);\n            packageName = packagePath.toString().replaceAll(\"/\",\n                                                            \".\");\n        }\n\n        //Resource was not inside a package\n        if (packageName == null) {\n            return null;\n        }\n\n        final Path mainSrcPath = Paths.convert(nioMainSrcPath.resolve(packagePath));\n        final Path testSrcPath = Paths.convert(nioTestSrcPath.resolve(packagePath));\n        final Path mainResourcesPath = Paths.convert(nioMainResourcesPath.resolve(packagePath));\n        final Path testResourcesPath = Paths.convert(nioTestResourcesPath.resolve(packagePath));\n\n        final String displayName = getPackageDisplayName(packageName);\n\n        final Package pkg = new Package(module.getRootPath(),\n                                        mainSrcPath,\n                                        testSrcPath,\n                                        mainResourcesPath,\n                                        testResourcesPath,\n                                        packageName,\n                                        displayName,\n                                        getPackageRelativeCaption(displayName,\n                                                                  resource.getFileName()));\n        return pkg;\n    }\n\n    private Set<String> getPackageNames(final org.uberfire.java.nio.file.Path nioModuleRootPath,\n                                        final org.uberfire.java.nio.file.Path nioPackageSrcPath,\n                                        final boolean includeDefault,\n                                        final boolean includeChild,\n                                        final boolean recursive) {\n        final Set<String> packageNames = new HashSet<>();\n        if (!Files.exists(nioPackageSrcPath)) {\n            return packageNames;\n        }\n        if (includeDefault || recursive) {\n            packageNames.add(getPackagePathSuffix(nioModuleRootPath,\n                                                  nioPackageSrcPath));\n        }\n\n        if (!includeChild) {\n            return packageNames;\n        }\n\n        //We're only interested in Directories (and not META-INF) so set-up appropriate filters\n        final LinkedMetaInfFolderFilter metaDataFileFilter = new LinkedMetaInfFolderFilter();\n        final LinkedDotFileFilter dotFileFilter = new LinkedDotFileFilter(metaDataFileFilter);\n        final LinkedDirectoryFilter directoryFilter = new LinkedDirectoryFilter(dotFileFilter);\n\n        final DirectoryStream<org.uberfire.java.nio.file.Path> nioChildPackageSrcPaths = ioService.newDirectoryStream(nioPackageSrcPath,\n                                                                                                                      directoryFilter);\n        for (org.uberfire.java.nio.file.Path nioChildPackageSrcPath : nioChildPackageSrcPaths) {\n            if (recursive) {\n                packageNames.addAll(getPackageNames(nioModuleRootPath,\n                                                    nioChildPackageSrcPath,\n                                                    includeDefault,\n                                                    includeChild,\n                                                    recursive));\n            } else {\n                packageNames.add(getPackagePathSuffix(nioModuleRootPath,\n                                                      nioChildPackageSrcPath));\n            }\n        }\n        return packageNames;\n    }\n\n    private String getPackageDisplayName(final String packageName) {\n        return packageName.isEmpty() ? \"<default>\" : packageName;\n    }\n\n    private String getPackageRelativeCaption(final String displayName,\n                                             final String relativeName) {\n        return displayName.equals(\"<default>\") ? \"<default>\" : relativeName;\n    }\n\n    private String resolvePkgName(final String caption) {\n        if (caption.equals(\"<default>\")) {\n            return \"\";\n        }\n        return caption.replaceAll(\"\\\\.\",\n                                  \"/\");\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectMigrationServiceImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.events.NewProjectEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.project.WorkspaceProjectMigrationService;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.commands.RemoveRemote;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.*;\nimport java.util.Map.Entry;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\nimport java.util.stream.Stream;\n\nimport static java.util.stream.Collectors.toList;\n\npublic class WorkspaceProjectMigrationServiceImpl implements WorkspaceProjectMigrationService {\n\n    private static final Logger log = LoggerFactory.getLogger(WorkspaceProjectMigrationServiceImpl.class);\n    public static final String REMOTE_ORIGIN_REF = \"refs/remotes/origin/master\";\n\n    private WorkspaceProjectService workspaceProjectService;\n    private RepositoryService repositoryService;\n    private Event<NewProjectEvent> newProjectEvent;\n    private ModuleService<? extends Module> moduleService;\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n    private PathUtil pathUtil;\n\n    WorkspaceProjectMigrationServiceImpl() {\n    }\n\n    @Inject\n    public WorkspaceProjectMigrationServiceImpl(final WorkspaceProjectService workspaceProjectService,\n                                                final RepositoryService repositoryService,\n                                                final OrganizationalUnitService organizationalUnitService,\n                                                final PathUtil pathUtil,\n                                                final Event<NewProjectEvent> newProjectEvent,\n                                                final ModuleService<? extends Module> moduleService,\n                                                final SpaceConfigStorageRegistry spaceConfigStorageRegistry) {\n        this.workspaceProjectService = workspaceProjectService;\n        this.repositoryService = repositoryService;\n        this.pathUtil = pathUtil;\n        this.newProjectEvent = newProjectEvent;\n        this.moduleService = moduleService;\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n    }\n\n    @Override\n    public void migrate(final WorkspaceProject legacyWorkspaceProject) {\n        Collection<Repository> newRepositories = copyModulesToRepositories(legacyWorkspaceProject);\n\n        updateSpaceInfo(legacyWorkspaceProject, newRepositories);\n\n        fireNewProjectEvents(newRepositories);\n    }\n\n    private void updateSpaceInfo(final WorkspaceProject legacyWorkspaceProject, final Collection<Repository> newRepositories) {\n        final SpaceInfo spaceInfo = spaceConfigStorageRegistry.get(legacyWorkspaceProject.getSpace().getName()).loadSpaceInfo();\n\n        newRepositories.stream()\n                .map(repository -> new RepositoryInfo(repository.getAlias(), false, new RepositoryConfiguration(repository.getEnvironment())))\n                .forEach(repositoryInfo -> {\n                    spaceInfo.removeRepository(repositoryInfo.getName());\n                    spaceInfo.getRepositories().add(repositoryInfo);\n                });\n\n        spaceConfigStorageRegistry.get(spaceInfo.getName()).saveSpaceInfo(spaceInfo);\n    }\n\n    private void fireNewProjectEvents(Collection<Repository> newRepositories) {\n        for (final Repository repository : newRepositories) {\n            final WorkspaceProject newWorkspaceProject = workspaceProjectService.resolveProject(repository);\n            newProjectEvent.fire(new NewProjectEvent(newWorkspaceProject));\n        }\n    }\n\n    private Collection<Repository> copyModulesToRepositories(WorkspaceProject legacyWorkspaceProject) {\n\n        final OrganizationalUnit ou = legacyWorkspaceProject.getOrganizationalUnit();\n        final Repository legacyRepository = legacyWorkspaceProject.getRepository();\n        // Partition modules by root path (ignoring branch) and space.\n        final Map<Partition, List<Module>> modulesByDirectory = getModulesByRootDirAndSpace(ou, legacyRepository);\n\n        return modulesByDirectory.entrySet()\n                .stream()\n                .map(entry -> createSubdirectoryCloneRepository(ou, legacyRepository, entry))\n                .collect(toList());\n    }\n\n    private Repository createSubdirectoryCloneRepository(final OrganizationalUnit ou, final Repository legacyRepository, Entry<Partition, List<Module>> entry) {\n        final Partition partition = entry.getKey();\n        final List<Module> modules = entry.getValue();\n        final String alias = modules.stream()\n                .map(module -> module.getModuleName())\n                .findFirst()\n                .orElse(\"migratedproject\");\n        final RepositoryEnvironmentConfigurations configurations = subdirectoryCloneConfiguration(legacyRepository,\n                partition,\n                modules);\n\n        Repository newRepository = repositoryService.createRepository(ou, GitRepository.SCHEME.toString(), alias, configurations);\n\n        cleanupOrigin(newRepository);\n\n        return newRepository;\n    }\n\n    private RepositoryEnvironmentConfigurations subdirectoryCloneConfiguration(final Repository legacyRepository, final Partition root, final List<Module> modules) {\n        final RepositoryEnvironmentConfigurations configurations = new RepositoryEnvironmentConfigurations();\n        configurations.setInit(false);\n        configurations.setOrigin(getNiogitRepoPath(legacyRepository));\n        final String rootWithoutRepoAndSpace = root.branchlessPath.replaceFirst(\"^[^/]+/[^/]+/\", \"\");\n        configurations.setSubdirectory(rootWithoutRepoAndSpace);\n        configurations.setMirror(false);\n        final List<String> branches = existingBranchesOf(modules);\n        configurations.setBranches(branches);\n\n        return configurations;\n    }\n\n    protected void cleanupOrigin(Repository repository) {\n        try {\n            // AF-1715: Cleaning origin to prevent errors while importing the new generated repo.\n            Git git = ((JGitPathImpl) pathUtil.convert(repository.getDefaultBranch().get().getPath())).getFileSystem().getGit();\n            new RemoveRemote(git,\"origin\",REMOTE_ORIGIN_REF).execute();\n        } catch (GitException e) {\n            log.warn(\"Error cleaning up origin for repository '{}': {}\", repository.getAlias(), e);\n        }\n    }\n\n    /**\n     * @return Branches where all given modules exist.\n     */\n    private List<String> existingBranchesOf(final List<Module> modules) {\n        final List<String> branches =\n                modules.stream()\n                        .flatMap(module -> {\n                            Optional<String> oBranch = getBranchName(pathUtil.convert(module.getRootPath()));\n                            if (oBranch.isPresent()) {\n                                return Stream.of(oBranch.get());\n                            } else {\n                                return Stream.empty();\n                            }\n                        })\n                        .collect(toList());\n        return branches;\n    }\n\n    private Map<Partition, List<Module>> getModulesByRootDirAndSpace(final OrganizationalUnit ou, final Repository legacyRepository) {\n        final Map<Partition, List<Module>> modulesByDirectory = new HashMap<>();\n        legacyRepository.getBranches()\n                .stream()\n                .flatMap(branch -> moduleService.getAllModules(branch).stream())\n                .forEach(module -> {\n                    final String fullURI = pathUtil.normalizePath(module.getRootPath()).toURI();\n                    final String branchlessPath = fullURI.replaceFirst(\"^[A-Za-z]+://([^@]+@)?\", \"\");\n                    final Partition partition = new Partition(branchlessPath, ou);\n                    final List<Module> modules = modulesByDirectory.computeIfAbsent(partition,\n                            ignore -> new ArrayList<>());\n                    modules.add(module);\n                });\n        return modulesByDirectory;\n    }\n\n    private static Optional<String> getBranchName(Path path) {\n        final String uri = path.toUri().toString();\n        final Matcher matcher = Pattern.compile(\"^[A-Za-z]+://([^@]+)@.*\").matcher(uri);\n\n        if (matcher.matches()) {\n            return Optional.ofNullable(matcher.group(1));\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    private String getNiogitRepoPath(Repository repository) {\n        final Branch branch = repository.getDefaultBranch().get();\n        final Path path = pathUtil.convert(branch.getPath());\n        return pathUtil.getNiogitRepoPath(path);\n    }\n\n    private static class Partition {\n\n        final String branchlessPath;\n        final OrganizationalUnit ou;\n\n        Partition(String branchlessPath, OrganizationalUnit ou) {\n            this.branchlessPath = branchlessPath;\n            this.ou = ou;\n        }\n\n        @Override\n        public int hashCode() {\n            final int prime = 31;\n            int result = 1;\n            result = prime * result + ((branchlessPath == null) ? 0 : branchlessPath.hashCode());\n            result = prime * result + ((ou == null) ? 0 : ou.hashCode());\n            return result;\n        }\n\n        @Override\n        public boolean equals(Object obj) {\n            if (this == obj)\n                return true;\n            if (obj == null)\n                return false;\n            if (getClass() != obj.getClass())\n                return false;\n            Partition other = (Partition) obj;\n            if (branchlessPath == null) {\n                if (other.branchlessPath != null)\n                    return false;\n            } else if (!branchlessPath.equals(other.branchlessPath))\n                return false;\n            if (ou == null) {\n                if (other.ou != null)\n                    return false;\n            } else if (!ou.equals(other.ou))\n                return false;\n            return true;\n        }\n\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectSearchServiceImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.WorkspaceProjectSearchService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n/**\n * TODO: Improve using indexes. Avoid to iterate thorough the entire repo>project hierarchy.\n */\n@Service\n@ApplicationScoped\npublic class WorkspaceProjectSearchServiceImpl implements WorkspaceProjectSearchService {\n\n    private WorkspaceProjectService workspaceProjectService;\n\n    @Inject\n    public WorkspaceProjectSearchServiceImpl(final WorkspaceProjectService workspaceProjectService) {\n        this.workspaceProjectService = workspaceProjectService;\n    }\n\n    @Override\n    public Collection<WorkspaceProject> searchByName(final String pattern,\n                                                     final int maxItems,\n                                                     final boolean caseSensitive) {\n        final List<WorkspaceProject> result = new ArrayList<>();\n\n        for (final WorkspaceProject workspaceProject : workspaceProjectService.getAllWorkspaceProjects()) {\n\n            final String name = workspaceProject.getName();\n            if (caseSensitive ? name.contains(pattern) : name.toLowerCase().contains(pattern.toLowerCase())) {\n                result.add(workspaceProject);\n            }\n\n            if (maxItems == result.size()) {\n                break;\n            }\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectServiceImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.File;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.events.NewProjectEvent;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.GAVAlreadyExistsException;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.common.services.project.utils.NewWorkspaceProjectUtils;\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.RepositoryUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.GitHookSupport;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class WorkspaceProjectServiceImpl\n        implements WorkspaceProjectService {\n\n    private static final String GIT_SCHEME = \"git\";\n    private static final String REMOTE_ORIGIN_REF = \"refs/remotes/origin/master\";\n    private static final String ORIGIN_KEY = \"origin\";\n\n    private OrganizationalUnitService organizationalUnitService;\n    private RepositoryService repositoryService;\n    private Event<NewProjectEvent> newProjectEvent;\n    private Event<RepositoryUpdatedEvent> repositoryUpdatedEvent;\n    private Event<NewBranchEvent> newBranchEvent;\n    private ModuleService<? extends Module> moduleService;\n    private SpacesAPI spaces;\n    private ModuleRepositoryResolver repositoryResolver;\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n    private Logger logger = LoggerFactory.getLogger(WorkspaceProjectServiceImpl.class);\n    private IOService ioService;\n    private PathUtil pathUtil;\n    private ChangeRequestService changeRequestService;\n    private POMService pomService;\n\n    public WorkspaceProjectServiceImpl() {\n    }\n\n    @Inject\n    public WorkspaceProjectServiceImpl(final OrganizationalUnitService organizationalUnitService,\n                                       final RepositoryService repositoryService,\n                                       final SpacesAPI spaces,\n                                       final Event<NewProjectEvent> newProjectEvent,\n                                       final Event<RepositoryUpdatedEvent> repositoryUpdatedEvent,\n                                       final Event<NewBranchEvent> newBranchEvent,\n                                       final Instance<ModuleService<? extends Module>> moduleServices,\n                                       final ModuleRepositoryResolver repositoryResolver,\n                                       @Named(\"ioStrategy\") final IOService ioService,\n                                       final SpaceConfigStorageRegistry spaceConfigStorageRegistry,\n                                       final PathUtil pathUtil,\n                                       final ChangeRequestService changeRequestService,\n                                       final POMService pomService) {\n        this.organizationalUnitService = organizationalUnitService;\n        this.repositoryService = repositoryService;\n        this.spaces = spaces;\n        this.newProjectEvent = newProjectEvent;\n        this.repositoryUpdatedEvent = repositoryUpdatedEvent;\n        this.newBranchEvent = newBranchEvent;\n        this.moduleService = moduleServices.get();\n        this.repositoryResolver = repositoryResolver;\n        this.ioService = ioService;\n        this.pathUtil = pathUtil;\n        this.changeRequestService = changeRequestService;\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n        this.pomService = pomService;\n    }\n\n    @Override\n    public Collection<WorkspaceProject> getAllWorkspaceProjects() {\n\n        final List<WorkspaceProject> result = new ArrayList<>();\n\n        for (final OrganizationalUnit ou : organizationalUnitService.getOrganizationalUnits()) {\n            result.addAll(getAllWorkspaceProjects(ou));\n        }\n\n        return result;\n    }\n\n    @Override\n    public Collection<WorkspaceProject> getAllWorkspaceProjects(final OrganizationalUnit organizationalUnit) {\n        return getAllWorkspaceProjectsByName(organizationalUnit,\n                                             null);\n    }\n\n    @Override\n    public Collection<WorkspaceProject> getAllWorkspaceProjectsByName(final OrganizationalUnit organizationalUnit,\n                                                                      final String name) {\n        return this.getAllWorkspaceProjectsByName(organizationalUnit,\n                                                  name,\n                                                  false);\n    }\n\n    public Collection<WorkspaceProject> getAllWorkspaceProjectsByName(final OrganizationalUnit organizationalUnit,\n                                                                      final String name,\n                                                                      final boolean includeDeleted) {\n        final List<WorkspaceProject> result = new ArrayList<>();\n\n        Space space = spaces.getSpace(organizationalUnit.getName());\n\n        for (final Repository repository : repositoryService.getAllRepositories(space,\n                                                                                includeDeleted)) {\n\n            if (repository.getDefaultBranch().isPresent()) {\n\n                final WorkspaceProject project = new WorkspaceProject(organizationalUnit,\n                                                                      repository,\n                                                                      repository.getDefaultBranch().get(),\n                                                                      moduleService.resolveModule(repository.getDefaultBranch().get().getPath()));\n                if (name == null || name.equals(project.getName())) {\n                    result.add(project);\n                }\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public boolean spaceHasNoProjectsWithName(final OrganizationalUnit organizationalUnit,\n                                              final String name,\n                                              final WorkspaceProject projectToIgnore) {\n        return getAllWorkspaceProjectsByName(organizationalUnit,\n                                             name)\n                .stream().noneMatch(p -> !p.getEncodedIdentifier().equals(projectToIgnore.getEncodedIdentifier()));\n    }\n\n    @Override\n    public WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                       final POM pom) {\n        return newProject(organizationalUnit,\n                          pom,\n                          DeploymentMode.VALIDATED);\n    }\n\n    @Override\n    public WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                       final POM pom,\n                                       final DeploymentMode mode) {\n        return newProject(organizationalUnit,\n                          pom,\n                          mode,\n                          null);\n    }\n\n    @Override\n    public WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                       final POM pom,\n                                       final DeploymentMode mode,\n                                       final List<Contributor> contributors) {\n        return newProject(organizationalUnit,\n                          pom,\n                          mode,\n                          contributors,\n                          null);\n    }\n\n    @Override\n    public WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                       final POM pom,\n                                       final DeploymentMode mode,\n                                       final List<Contributor> contributors,\n                                       final Repository templateRepository) {\n        return newProject(organizationalUnit,\n                          pom,\n                          mode,\n                          contributors,\n                          templateRepository,\n                          null);\n    }\n\n    @Override\n    public WorkspaceProject newProject(final OrganizationalUnit organizationalUnit,\n                                       final POM pom,\n                                       final DeploymentMode mode,\n                                       final List<Contributor> contributors,\n                                       final Repository templateRepository,\n                                       final String remoteRepositoryUrl) {\n\n        return spaceConfigStorageRegistry.getBatch(organizationalUnit.getSpace().getName())\n                .run(context -> {\n                    final String newName = this.createFreshProjectName(organizationalUnit, pom.getName());\n\n                    pom.setName(newName);\n\n                    if (DeploymentMode.VALIDATED.equals(mode)) {\n                        checkRepositories(pom);\n                    }\n\n                    String repositoryAlias = this.createFreshRepositoryAlias(organizationalUnit, pom.getName());\n\n                    final boolean createFromTemplate = templateRepository != null;\n                    final RepositoryEnvironmentConfigurations configurations = createFromTemplate\n                            ? createRepositoryConfigForTemplate(templateRepository)\n                            : new RepositoryEnvironmentConfigurations();\n\n                    final Repository repository = repositoryService.createRepository(organizationalUnit,\n                                                                                     GIT_SCHEME,\n                                                                                     repositoryAlias,\n                                                                                     configurations,\n                                                                                     contributors != null ? contributors : Collections.emptyList());\n\n                    try {\n                        final Branch defaultBranch = resolveDefaultBranch(repository);\n\n                        final Module module = createFromTemplate\n                                ? finishCreateFromTemplate(repository, templateRepository, pom)\n                                : moduleService.newModule(defaultBranch.getPath(), pom, mode);\n\n                        if (remoteRepositoryUrl != null) {\n                            addRemoteOrigin(repository,\n                                            remoteRepositoryUrl);\n\n                            executePostCommitHook(repository);\n                        }\n\n                        final WorkspaceProject workspaceProject = new WorkspaceProject(organizationalUnit,\n                                                                                       repository,\n                                                                                       defaultBranch,\n                                                                                       module);\n\n                        newProjectEvent.fire(new NewProjectEvent(workspaceProject));\n\n                        return workspaceProject;\n                    } catch (Exception e) {\n                        logger.error(\"Error trying to create project\", e);\n                        logger.error(\"Error trying to create project \" + organizationalUnit.getName() + \" - \" + repository.getAlias(), e);\n                        try {\n                            this.repositoryService.removeRepository(this.spaces.getSpace(organizationalUnit.getName()), repository.getAlias());\n                        } catch (Exception ex) {\n                            logger.error(\"Error trying to delete repository\", ex);\n                            logger.error(\"Error trying to delete repository \" + organizationalUnit.getName() + \" - \" + repository.getAlias(), ex);\n                            throw ExceptionUtilities.handleException(ex);\n                        }\n                        throw ExceptionUtilities.handleException(e);\n                    }\n                });\n    }\n\n    private RepositoryEnvironmentConfigurations createRepositoryConfigForTemplate(final Repository templateRepository) {\n        final RepositoryEnvironmentConfigurations configurations = new RepositoryEnvironmentConfigurations();\n\n        final File repositoryDirectory = resolveRepositoryDirectory(templateRepository);\n\n        configurations.setInit(false);\n        configurations.setOrigin(repositoryDirectory.toURI().toString());\n        configurations.setMirror(false);\n\n        return configurations;\n    }\n\n    private File resolveRepositoryDirectory(final Repository repository) {\n        final org.uberfire.java.nio.fs.jgit.util.Git git = resolveGit(repository);\n\n        return git.getRepository().getDirectory();\n    }\n\n    private Branch resolveDefaultBranch(final Repository repository) {\n        return repository.getDefaultBranch()\n                .orElseThrow(() -> new IllegalStateException(\"New repository should always have a branch.\"));\n    }\n\n    private org.uberfire.java.nio.fs.jgit.util.Git resolveGit(final Repository repository) {\n        return resolveJGitFileSystem(repository).getGit();\n    }\n\n    private void executePostCommitHook(final Repository repository) {\n        final JGitFileSystem fs = resolveJGitFileSystem(repository);\n        ((GitHookSupport) fs.provider()).executePostCommitHook(fs);\n    }\n\n    private JGitFileSystem resolveJGitFileSystem(final Repository repository) {\n        final Branch defaultBranch = resolveDefaultBranch(repository);\n\n        return ((JGitPathImpl) pathUtil.convert(defaultBranch.getPath())).getFileSystem();\n    }\n\n    private Module finishCreateFromTemplate(final Repository projectRepository,\n                                            final Repository templateRepository,\n                                            final POM pom) {\n        cleanUpTemplateOrigin(projectRepository);\n\n        updateTemplatePOM(projectRepository,\n                          templateRepository,\n                          pom);\n\n        final Branch defaultBranch = resolveDefaultBranch(projectRepository);\n\n        moduleService.createModuleDirectories(defaultBranch.getPath());\n\n        return moduleService.resolveModule(Paths.convert(Paths.convert(defaultBranch.getPath()).getRoot()));\n    }\n\n    private void cleanUpTemplateOrigin(final Repository repository) {\n        final org.uberfire.java.nio.fs.jgit.util.Git git = resolveGit(repository);\n\n        git.removeRemote(ORIGIN_KEY,\n                         REMOTE_ORIGIN_REF);\n    }\n\n    private void addRemoteOrigin(final Repository repository,\n                                 final String remoteRepositoryUrl) {\n        final org.uberfire.java.nio.fs.jgit.util.Git git = resolveGit(repository);\n\n        git.addRemote(ORIGIN_KEY,\n                      remoteRepositoryUrl);\n    }\n\n    private void updateTemplatePOM(final Repository projectRepository,\n                                   final Repository templateRepository,\n                                   final POM pom) {\n        final Path repositoryRoot = resolveDefaultBranch(projectRepository).getPath();\n        final Path templatePath = resolveDefaultBranch(templateRepository).getPath();\n        final Path pomPath = resolvePathFromParent(repositoryRoot, POMServiceImpl.POM_XML);\n        final Path templatePomPath = resolvePathFromParent(templatePath, POMServiceImpl.POM_XML);\n        final POM templatePom = pomService.load(templatePomPath);\n\n        templatePom.setName(pom.getName());\n        templatePom.setDescription(pom.getDescription());\n\n        templatePom.getGav().setGroupId(pom.getGav().getGroupId());\n        templatePom.getGav().setArtifactId(pom.getGav().getArtifactId());\n        templatePom.getGav().setVersion(pom.getGav().getVersion());\n\n        pomService.save(pomPath,\n                        templatePom,\n                        null,\n                        \"Updating the POM file\");\n    }\n\n    Path resolvePathFromParent(final Path parent,\n                               final String toResolve) {\n        return Paths.convert(Paths.convert(parent).resolve(toResolve));\n    }\n\n    String createFreshRepositoryAlias(final OrganizationalUnit organizationalUnit,\n                                      final String projectName) {\n        int index = 0;\n        String suffix = \"\";\n        String repositoryAlias = checkNotNull(\"project name in pom model\", NewWorkspaceProjectUtils.sanitizeProjectName(projectName));\n\n        while (repositoryService.getRepositoryFromSpace(organizationalUnit.getSpace(), repositoryAlias + suffix) != null) {\n            suffix = \"-\" + ++index;\n        }\n\n        return repositoryAlias + suffix;\n    }\n\n    @Override\n    public String createFreshProjectName(final OrganizationalUnit organizationalUnit,\n                                         final String name) {\n        int index = 0;\n        String suffix = \"\";\n        while (!this.getAllWorkspaceProjectsByName(organizationalUnit,\n                                                   name + suffix,\n                                                   true).isEmpty()) {\n            suffix = \"-\" + ++index;\n        }\n\n        return name + suffix;\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Repository repository) {\n\n        if (!repository.getDefaultBranch().isPresent()) {\n            throw new IllegalStateException(\"New repository should always have a branch.\");\n        }\n\n        return resolveProject(repository.getSpace(),\n                              repository.getDefaultBranch().get());\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Space space,\n                                           final Branch branch) {\n        return resolveProject(space,\n                              branch.getPath());\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Space space,\n                                           final Module module) {\n        return resolveProject(space,\n                              module.getRootPath());\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Space space,\n                                           final String name) {\n\n        OrganizationalUnit ou = organizationalUnitService.getOrganizationalUnit(space.getName());\n        return resolveProject(ou,\n                              name);\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Space space,\n                                           final String projectName,\n                                           final String branchName) {\n\n        WorkspaceProject workspaceProject = resolveProject(space, projectName);\n\n        if (workspaceProject == null) {\n            throw new IllegalArgumentException(\"project \" + projectName + \" not found.\");\n        }\n\n        if (branchName == null) {\n            return workspaceProject;\n        }\n\n        for (final Branch branch : workspaceProject.getRepository().getBranches()) {\n            if (branch.getName().equals(branchName)) {\n                return resolveProject(space, branch);\n            }\n        }\n\n        throw new IllegalArgumentException(\"branch \" + branchName + \" not found.\");\n    }\n\n    private WorkspaceProject resolveProject(OrganizationalUnit ou,\n                                            final String name) {\n        for (final WorkspaceProject workspaceProject : getAllWorkspaceProjects(ou)) {\n            if (workspaceProject.getName().equals(name)) {\n                return workspaceProject;\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public WorkspaceProject resolveProjectByRepositoryAlias(final Space space,\n                                                            final String repositoryAlias) {\n        return resolveProject(repositoryService.getRepositoryFromSpace(space,\n                                                                       repositoryAlias));\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(final Space space,\n                                           final Path path) {\n\n        final org.uberfire.java.nio.file.Path repositoryRoot = Paths.convert(path).getRoot();\n\n        final Repository repository = repositoryService.getRepository(space,\n                                                                      Paths.convert(repositoryRoot));\n\n        if (repository == null) {\n            throw new RuntimeException(\"Repository not found inside space \" + space.getName() + \" with path \" + path.toURI() + \" (root path \" + repositoryRoot.toUri() + \")\");\n        }\n\n        final Branch branch = resolveBranch(repositoryRoot,\n                                            repository);\n\n        return new WorkspaceProject(organizationalUnitService.getOrganizationalUnit(repository.getSpace().getName()),\n                                    repository,\n                                    branch,\n                                    moduleService.resolveModule(Paths.convert(Paths.convert(branch.getPath()).getRoot())));\n    }\n\n    @Override\n    public WorkspaceProject resolveProject(Path path) {\n        return spaces\n                .resolveSpace(path.toURI())\n                .map(space -> resolveProject(space,\n                                             path))\n                .orElseThrow(() -> new IllegalArgumentException(\"Could not determine space containing path: \" + path));\n    }\n\n    private Branch resolveBranch(final org.uberfire.java.nio.file.Path repositoryRoot,\n                                 final Repository repository) {\n        if (!repository.getDefaultBranch().isPresent()) {\n            throw new RuntimeException(\"Default branch not found in repository \" + repository.getAlias() + \" with path \" + repositoryRoot.toUri());\n        }\n\n        final Branch defaultBranch = repository.getDefaultBranch().get();\n\n        if (!Paths.convert(defaultBranch.getPath()).equals(repositoryRoot)) {\n\n            for (final Branch branch : repository.getBranches()) {\n\n                if (Paths.convert(branch.getPath()).equals(repositoryRoot)) {\n                    return branch;\n                }\n            }\n        }\n        return defaultBranch;\n    }\n\n    private void checkRepositories(final POM pom) {\n        final Set<MavenRepositoryMetadata> repositories = repositoryResolver.getRepositoriesResolvingArtifact(pom.getGav());\n        if (repositories.size() > 0) {\n            throw new GAVAlreadyExistsException(pom.getGav(),\n                                                repositories);\n        }\n    }\n\n    @Override\n    public void addBranch(final String newBranchName,\n                          final String baseBranchName,\n                          final WorkspaceProject project,\n                          final String userIdentifier) {\n\n        final Branch baseBranch = project\n            .getRepository()\n            .getBranch(baseBranchName)\n            .orElseThrow(() -> new IllegalStateException(\"The base branch [\" + baseBranchName + \"] does not exists\"));\n\n        final org.uberfire.java.nio.file.Path baseBranchPath = pathUtil.convert(baseBranch.getPath());\n        final String newBranchPathURI = pathUtil.replaceBranch(newBranchName,\n                                                               baseBranch.getPath().toURI());\n        try {\n            final org.uberfire.java.nio.file.Path newBranchPath = ioService.get(new URI(newBranchPathURI));\n\n            baseBranchPath\n                .getFileSystem()\n                .provider()\n                .copy(baseBranchPath,\n                      newBranchPath);\n\n            final BranchPermissions branchPermissions = spaceConfigStorageRegistry\n                .get(project.getSpace().getName())\n                .loadBranchPermissions(baseBranchName,\n                                       project.getRepository().getIdentifier());\n\n            spaceConfigStorageRegistry\n                .get(project.getSpace().getName())\n                .saveBranchPermissions(newBranchName,\n                                       project.getRepository().getIdentifier(),\n                                       branchPermissions);\n\n            final Repository repository = repositoryService.getRepositoryFromSpace(\n                    project.getSpace(),\n                    project.getRepository().getAlias());\n\n            repositoryUpdatedEvent.fire(new RepositoryUpdatedEvent(repository));\n\n            newBranchEvent.fire(new NewBranchEvent(repository,\n                                                   newBranchName,\n                                                   baseBranchName,\n                                                   userIdentifier));\n\n        } catch (URISyntaxException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public void removeBranch(final String branchName,\n                             final WorkspaceProject project,\n                             final String userIdentifier) {\n\n        final Branch branch = project\n                .getRepository()\n                .getBranch(branchName)\n                .orElseThrow(() -> new IllegalStateException(\"The branch [\" + branchName + \"] does not exists\"));\n\n        try {\n            ioService.startBatch(pathUtil.convert(branch.getPath()).getFileSystem());\n\n            repositoryService\n                .getRepositoryFromSpace(project.getSpace(),\n                                        project.getRepository().getAlias())\n                .getBranch(branch.getName())\n                .ifPresent(updatedBranch -> {\n                        final org.uberfire.java.nio.file.Path branchPath = pathUtil.convert(branch.getPath());\n\n                        ioService.delete(branchPath);\n\n                        spaceConfigStorageRegistry\n                            .get(project.getSpace().getName())\n                            .deleteBranchPermissions(branch.getName(),\n                                                     project.getRepository().getIdentifier());\n\n                        changeRequestService.deleteChangeRequests(project.getSpace().getName(),\n                                                                  project.getRepository().getAlias(),\n                                                                  branch.getName(),\n                                                                  userIdentifier);\n\n                        final Repository repository = repositoryService.getRepositoryFromSpace(\n                                project.getSpace(),\n                                project.getRepository().getAlias());\n\n                        repositoryUpdatedEvent.fire(new RepositoryUpdatedEvent(repository));\n                    });\n\n        } finally {\n            ioService.endBatch();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/BaseArchetypeServiceProducer.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.backend.server.BaseArchetypeServiceImpl;\nimport org.guvnor.common.services.project.service.BaseArchetypeService;\nimport org.uberfire.annotations.Customizable;\n\npublic class BaseArchetypeServiceProducer {\n\n    @Inject\n    private Instance<BaseArchetypeService> archetypeService;\n\n    @Produces\n    @Customizable\n    public BaseArchetypeService baseArchetypeServiceProducer() {\n        if (this.archetypeService.isUnsatisfied()) {\n            return new BaseArchetypeServiceImpl();\n        }\n        return this.archetypeService.get();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/BuildContentHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport org.apache.maven.model.Build;\nimport org.apache.maven.model.Plugin;\n\nclass BuildContentHandler {\n\n    org.guvnor.common.services.project.model.Build fromPomModelToClientModel(final Build from) {\n\n        if (from != null) {\n            org.guvnor.common.services.project.model.Build build = new org.guvnor.common.services.project.model.Build();\n            if (from.getPlugins() != null) {\n                for (Plugin plugin : from.getPlugins()) {\n                    build.getPlugins().add(fromPomModelToClientModel(plugin));\n                }\n            }\n            return build;\n        } else {\n            return null;\n        }\n    }\n\n    public Build update(final org.guvnor.common.services.project.model.Build from,\n                        Build to) {\n        if (from == null) {\n            return null;\n        } else {\n            if (to == null) {\n                to = new Build();\n            }\n\n            if (from.getPlugins() != null) {\n                to.setPlugins(new MavenPluginUpdater(to.getPlugins()).update(from.getPlugins()));\n            }\n\n            return to;\n        }\n    }\n\n    private org.guvnor.common.services.project.model.Plugin fromPomModelToClientModel(final Plugin from) {\n        org.guvnor.common.services.project.model.Plugin plugin = new org.guvnor.common.services.project.model.Plugin();\n\n        plugin.setGroupId(from.getGroupId());\n        plugin.setArtifactId(from.getArtifactId());\n        plugin.setVersion(from.getVersion());\n        plugin.setExtensions(from.isExtensions());\n\n        plugin.setDependencies(new DependencyContentHandler().fromPomModelToClientModel(from.getDependencies()));\n\n        return plugin;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/DependencyContentHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.maven.model.Dependency;\n\npublic class DependencyContentHandler {\n\n    public org.guvnor.common.services.project.model.Dependency fromPomModelToClientModel(final Dependency from) {\n        org.guvnor.common.services.project.model.Dependency dependency = new org.guvnor.common.services.project.model.Dependency();\n\n        dependency.setArtifactId(from.getArtifactId());\n        dependency.setGroupId(from.getGroupId());\n        dependency.setVersion(from.getVersion());\n\n        dependency.setScope(from.getScope());\n\n        return dependency;\n    }\n\n    public List<org.guvnor.common.services.project.model.Dependency> fromPomModelToClientModel(List<Dependency> dependencies) {\n        List<org.guvnor.common.services.project.model.Dependency> result = new ArrayList<org.guvnor.common.services.project.model.Dependency>();\n        for (Dependency dependency : dependencies) {\n            result.add(fromPomModelToClientModel(dependency));\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/DependencyUpdater.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.util.Iterator;\nimport java.util.List;\n\nimport org.guvnor.common.services.project.model.Dependency;\n\nclass DependencyUpdater {\n\n    private final List<org.apache.maven.model.Dependency> dependencies;\n\n    DependencyUpdater(final List<org.apache.maven.model.Dependency> dependencies) {\n        this.dependencies = dependencies;\n    }\n\n    void updateDependencies(final List<Dependency> dependencies) {\n        removeAllThatDoNotExist(dependencies);\n        addTheOnesThatDoNotExist(dependencies);\n        updateTheRest(dependencies);\n    }\n\n    private void updateTheRest(final List<Dependency> dependencies) {\n        for (Dependency dependency : dependencies) {\n            for (org.apache.maven.model.Dependency modelDep : this.dependencies) {\n                if (hasSameID(dependency,\n                              modelDep)) {\n                    updateDependency(dependency,\n                                     modelDep);\n                }\n            }\n        }\n    }\n\n    private void addTheOnesThatDoNotExist(final List<Dependency> dependencies) {\n        for (Dependency dependency : dependencies) {\n            if (!depsContains(this.dependencies,\n                              dependency)) {\n                this.dependencies.add(fromClientModelToPom(dependency));\n            }\n        }\n    }\n\n    private void removeAllThatDoNotExist(final List<Dependency> dependencies) {\n        Iterator<org.apache.maven.model.Dependency> iterator = this.dependencies.iterator();\n        while (iterator.hasNext()) {\n            org.apache.maven.model.Dependency dependency = iterator.next();\n            if (!depsContains(dependencies,\n                              dependency)) {\n                iterator.remove();\n            }\n        }\n    }\n\n    private org.apache.maven.model.Dependency fromClientModelToPom(final org.guvnor.common.services.project.model.Dependency from) {\n        org.apache.maven.model.Dependency dependency = updateDependency(from,\n                                                                        new org.apache.maven.model.Dependency());\n\n        return dependency;\n    }\n\n    private org.apache.maven.model.Dependency updateDependency(final org.guvnor.common.services.project.model.Dependency from,\n                                                               final org.apache.maven.model.Dependency dependency) {\n\n        dependency.setArtifactId(from.getArtifactId());\n        dependency.setGroupId(from.getGroupId());\n        dependency.setVersion(from.getVersion());\n        dependency.setScope(from.getScope());\n        return dependency;\n    }\n\n    private boolean depsContains(final List<org.guvnor.common.services.project.model.Dependency> dependencies,\n                                 final org.apache.maven.model.Dependency dependency) {\n        for (org.guvnor.common.services.project.model.Dependency modelDep : dependencies) {\n            if (hasSameID(modelDep,\n                          dependency)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean depsContains(final List<org.apache.maven.model.Dependency> dependencies,\n                                 final org.guvnor.common.services.project.model.Dependency dependency) {\n        for (org.apache.maven.model.Dependency modelDep : dependencies) {\n            if (hasSameID(dependency,\n                          modelDep)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean hasSameID(final org.guvnor.common.services.project.model.Dependency dependency,\n                              final org.apache.maven.model.Dependency modelDep) {\n        if (dependency.getArtifactId() == null || dependency.getGroupId() == null) {\n            return false;\n        } else {\n            return dependency.getArtifactId().equals(modelDep.getArtifactId()) && dependency.getGroupId().equals(modelDep.getGroupId());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/IdentifierUtils.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport javax.lang.model.SourceVersion;\n\n/**\n * Utilities to manipulate Java/Maven identifiers\n */\npublic class IdentifierUtils {\n\n    /**\n     * Convert Maven Identifiers to equivalents compatible with Java\n     * @param identifiers\n     * @return\n     */\n    public static String[] convertMavenIdentifierToJavaIdentifier(final String[] identifiers) {\n        if (identifiers == null || identifiers.length < 1) {\n            return new String[0];\n        }\n        final String[] legalIdentifiers = new String[identifiers.length];\n        for (int idx = 0; idx < identifiers.length; idx++) {\n            final String identifier = identifiers[idx];\n            final StringBuilder legalIdentifier = new StringBuilder(\"\");\n            Character c = identifier.charAt(0);\n            if (!Character.isJavaIdentifierStart(c)) {\n                legalIdentifier.append(\"_\");\n            } else {\n                legalIdentifier.append(c);\n            }\n            for (int i = 1; i < identifier.length(); i++) {\n                c = identifier.charAt(i);\n                if (Character.isJavaIdentifierPart(c)) {\n                    legalIdentifier.append(c);\n                } else {\n                    legalIdentifier.append(\"_\");\n                }\n            }\n            if (SourceVersion.isKeyword(legalIdentifier.toString())) {\n                legalIdentifier.insert(0,\n                                       \"_\");\n            }\n            legalIdentifiers[idx] = legalIdentifier.toString();\n        }\n        return legalIdentifiers;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/MavenPluginUpdater.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.maven.model.Plugin;\n\nimport static org.guvnor.common.services.project.backend.server.utils.NullSafeEquals.areValuesEqual;\n\npublic class MavenPluginUpdater {\n\n    private final List<Plugin> pluginsDeclaredInPOM;\n\n    public MavenPluginUpdater(List<Plugin> pluginsDeclaredInPOM) {\n        this.pluginsDeclaredInPOM = pluginsDeclaredInPOM;\n    }\n\n    public List<Plugin> update(final List<org.guvnor.common.services.project.model.Plugin> from) {\n\n        List<Plugin> result = new ArrayList<>();\n\n        for (org.guvnor.common.services.project.model.Plugin plugin : from) {\n            if (plugin.getArtifactId() != null && plugin.getGroupId() != null) {\n                result.add(update(plugin,\n                                  findPlugin(plugin.getGroupId(),\n                                             plugin.getArtifactId())));\n            }\n        }\n\n        return result;\n    }\n\n    private Plugin findPlugin(final String groupId,\n                              final String artifactId) {\n        for (final Plugin plugin : pluginsDeclaredInPOM) {\n            if (areValuesEqual(groupId,\n                               plugin.getGroupId())\n                    && areValuesEqual(artifactId,\n                                      plugin.getArtifactId())) {\n                return plugin;\n            }\n        }\n        return new Plugin();\n    }\n\n    private Plugin update(final org.guvnor.common.services.project.model.Plugin from,\n                          final Plugin to) {\n\n        to.setGroupId(from.getGroupId());\n        to.setArtifactId(from.getArtifactId());\n        to.setVersion(from.getVersion());\n\n        // false is the default value, so we only set it if value is true\n        if (from.isExtensions()) {\n            to.setExtensions(from.isExtensions());\n        } else {\n            to.setExtensions(null);\n        }\n\n        new DependencyUpdater(to.getDependencies()).updateDependencies(from.getDependencies());\n\n        return to;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/NullSafeEquals.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\npublic class NullSafeEquals {\n\n    static boolean areValuesEqual(final String a,\n                                  final String b) {\n        if (a == null || b == null) {\n            return false;\n        } else {\n            return a.equals(b);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/POMContentHandler.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.io.IOException;\nimport java.io.StringReader;\nimport java.io.StringWriter;\nimport java.util.ArrayList;\nimport javax.enterprise.context.Dependent;\n\nimport org.apache.maven.model.Build;\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.Parent;\nimport org.apache.maven.model.Repository;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Reader;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Writer;\nimport org.codehaus.plexus.util.xml.pull.XmlPullParserException;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepository;\nimport org.guvnor.common.services.project.model.POM;\n\n@Dependent\npublic class POMContentHandler {\n\n    public POMContentHandler() {\n        // Weld needs this for proxying.\n    }\n\n    public String toString(final POM pomModel)\n            throws IOException {\n        return toString(pomModel,\n                        new Model());\n    }\n\n    private String toString(final POM pom,\n                            final Model model) throws IOException {\n        model.setName(pom.getName());\n        model.setDescription(pom.getDescription());\n        model.setArtifactId(pom.getGav().getArtifactId());\n        model.setModelVersion(pom.getModelVersion());\n        model.setUrl(pom.getUrl());\n\n        model.setGroupId(pom.getGav().getGroupId());\n        model.setVersion(pom.getGav().getVersion());\n\n        model.setPackaging(pom.getPackaging());\n\n        model.setParent(getParent(pom));\n        model.setBuild(getBuild(pom,\n                                model));\n        model.setModules(getModules(pom));\n        model.setRepositories(getRepositories(pom));\n        new DependencyUpdater(model.getDependencies()).updateDependencies(pom.getDependencies());\n\n        StringWriter stringWriter = new StringWriter();\n        new MavenXpp3Writer().write(stringWriter,\n                                    model);\n        return stringWriter.toString();\n    }\n\n    private Build getBuild(final POM pom,\n                           final Model model) {\n        return new BuildContentHandler().update(pom.getBuild(),\n                                                model.getBuild());\n    }\n\n    private ArrayList<Repository> getRepositories(final POM pom) {\n        ArrayList<Repository> result = new ArrayList<Repository>();\n        for (MavenRepository mavenRepository : pom.getRepositories()) {\n            result.add(fromClientModelToPom(mavenRepository));\n        }\n        return result;\n    }\n\n    private ArrayList<String> getModules(final POM pom) {\n        ArrayList<String> result = new ArrayList<String>();\n        if (pom.getModules() != null) {\n            for (String module : pom.getModules()) {\n                result.add(module);\n            }\n        }\n        return result;\n    }\n\n    private Parent getParent(final POM pom) {\n        if (pom.getParent() == null) {\n            return null;\n        } else {\n            Parent parent = new Parent();\n            parent.setGroupId(pom.getParent().getGroupId());\n            parent.setArtifactId(pom.getParent().getArtifactId());\n            parent.setVersion(pom.getParent().getVersion());\n            return parent;\n        }\n    }\n\n    /**\n     * @param gavModel The model that is saved\n     * @param originalPomAsText The original pom in text form, since the guvnor POM model does not cover all the pom.xml features.\n     * @return pom.xml for saving, The original pom.xml with the fields edited in gavModel replaced.\n     * @throws IOException\n     */\n    public String toString(final POM gavModel,\n                           final String originalPomAsText) throws IOException, XmlPullParserException {\n\n        return toString(gavModel,\n                        new MavenXpp3Reader().read(new StringReader(originalPomAsText)));\n    }\n\n    private Repository fromClientModelToPom(final MavenRepository from) {\n        Repository to = new Repository();\n        to.setId(from.getId());\n        to.setName(from.getName());\n        to.setUrl(from.getUrl());\n\n        return to;\n    }\n\n    public POM toModel(final String pomAsString) throws IOException, XmlPullParserException {\n        Model model = new MavenXpp3Reader().read(new StringReader(pomAsString));\n\n        POM pomModel = new POM(\n                model.getName(),\n                model.getDescription(),\n                model.getUrl(),\n                new GAV(\n                        (model.getGroupId() == null ? model.getParent().getGroupId() : model.getGroupId()),\n                        (model.getArtifactId() == null ? model.getParent().getArtifactId() : model.getArtifactId()),\n                        (model.getVersion() == null ? model.getParent().getVersion() : model.getVersion())\n                )\n        );\n\n        pomModel.setPackaging(model.getPackaging());\n\n        if (model.getParent() != null) {\n            pomModel.setParent(new GAV(model.getParent().getGroupId(),\n                                       model.getParent().getArtifactId(),\n                                       model.getParent().getVersion()));\n        }\n\n        pomModel.getModules().clear();\n        for (String module : model.getModules()) {\n            pomModel.getModules().add(module);\n            pomModel.setPackaging(\"pom\");\n        }\n        for (Repository repository : model.getRepositories()) {\n            pomModel.addRepository(fromPomModelToClientModel(repository));\n        }\n\n        pomModel.setDependencies(new DependencyContentHandler().fromPomModelToClientModel(model.getDependencies()));\n\n        pomModel.setBuild(new BuildContentHandler().fromPomModelToClientModel(model.getBuild()));\n\n        return pomModel;\n    }\n\n    private MavenRepository fromPomModelToClientModel(final Repository from) {\n        MavenRepository to = new MavenRepository();\n\n        to.setId(from.getId());\n        to.setName(from.getName());\n        to.setUrl(from.getUrl());\n\n        return to;\n    }\n\n    public Model convert(final POM pom,\n                         final Model model) {\n        model.setName(pom.getName());\n        model.setDescription(pom.getDescription());\n        model.setArtifactId(pom.getGav().getArtifactId());\n        model.setModelVersion(pom.getModelVersion());\n        model.setUrl(pom.getUrl());\n\n        model.setGroupId(pom.getGav().getGroupId());\n        model.setVersion(pom.getGav().getVersion());\n\n        model.setPackaging(pom.getPackaging());\n\n        model.setParent(getParent(pom));\n        model.setBuild(getBuild(pom,\n                                model));\n        model.setModules(getModules(pom));\n        model.setRepositories(getRepositories(pom));\n\n        return model;\n    }\n\n    public Model convert(final POM pom) {\n        return convert(pom, new Model());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/PathUtil.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.io.File;\nimport java.util.Optional;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\nimport javax.inject.Singleton;\n\nimport org.guvnor.structure.backend.repositories.git.GitPathUtil;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\n\n/**\n * Contains methods that directly invoke {@link Paths} or involve implementation specific details\n * on paths that are difficult to mock in unit tests.\n */\n@Singleton\npublic class PathUtil {\n\n    private final Pattern repoAndSpace = Pattern.compile(\"^[^/]+/[^/]+/\");\n    private final Pattern protocolAndBranch = Pattern.compile(\"^[A-Za-z]+://([^@]+@)?\");\n    private final Pattern branchNameReplacer = Pattern.compile(\"(^[A-Za-z]+://)([^@]+)(@.*)\");\n\n    public org.uberfire.backend.vfs.Path normalizePath(org.uberfire.backend.vfs.Path path) {\n        return Paths.normalizePath(path);\n    }\n\n    public org.uberfire.java.nio.file.Path convert(org.uberfire.backend.vfs.Path path) {\n        return Paths.convert(path);\n    }\n\n    public org.uberfire.backend.vfs.Path convert(org.uberfire.java.nio.file.Path path) {\n        return Paths.convert(path);\n    }\n\n    public String stripProtocolAndBranch(String uri) {\n        return protocolAndBranch.matcher(uri).replaceFirst(\"\");\n    }\n\n    /**\n     * @param strippedPath Assumed to be a return value of {@link #stripProtocolAndBranch(String)}\n     */\n    public String stripRepoNameAndSpace(String strippedPath) {\n        return repoAndSpace.matcher(strippedPath).replaceFirst(\"\");\n    }\n\n    /**\n     * @param path A path for a JGit file system. Must not be null.\n     * @return The file path for an niogit directory that contains the given path's filesystem.\n     */\n    public String getNiogitRepoPath(org.uberfire.java.nio.file.Path path) {\n        try {\n            Path p = path.getFileSystem().getPath(path.toString());\n            final File directory = p.toFile();\n            return directory.toURI().toString();\n        } catch (ClassCastException cce) {\n            throw new IllegalArgumentException(\"Cannot get .niogit directory for non-jgit path.\", cce);\n        }\n    }\n\n    public Optional<String> extractBranch(String uri) {\n        return GitPathUtil.extractBranch(uri);\n    }\n\n    public String replaceBranch(final String newBranchName,\n                                final String uri) {\n        final Matcher matcher = branchNameReplacer.matcher(uri);\n        return matcher.replaceFirst(\"$1\" + newBranchName.replace(\"$\", \"\\\\$\") + \"$3\");\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/configuration/ConfigurationKey.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server.utils.configuration;\n\n/**\n * Keys used to configure the Maven compiler in the kie-wb-common\n *\n * <p>\n *  COMPILER (jdt) jdt or javac\n *  SOURCE_VERSION  (1.8) configured with jvm source code version\n *  TARGET_VERSION  (1.8) configured with jvm target version\n *  <p>\n *  FAIL_ON_ERROR (false) configured with false to continue the build on the correct classes and skip the build of classes with errors\n *  MAVEN_COMPILER_PLUGIN_GROUP (org.apache.maven.plugins) configured with default maven compiler group to disabled it\n *  MAVEN_COMPILER_PLUGIN_ARTIFACT (maven-compiler-plugin) configured with default maven compiler ArtifactID to disabled it\n *  MAVEN_COMPILER_PLUGIN_VERSION (3.7.0) configured with default maven compiler version to disabled it\n *  <p>\n *  TAKARI_COMPILER_PLUGIN_GROUP (io.takari.maven.plugins) configured with takari GroupID\n *  TAKARI_COMPILER_PLUGIN_ARTIFACT (takari-lifecycle-plugin) configured with takari ArtifactID\n *  TAKARI_COMPILER_PLUGIN_VERSION (${version.io.takari.maven.plugins})configured with a placeholder and set with the correct value in the maven build with takari version\n *  <p>\n *  KIE_PLUGIN_GROUP (org.kie) configured with the GroupID of kie plugin from the Integration prj\n *  KIE_MAVEN_PLUGIN_ARTIFACT  (kie-maven-plugin) configured with the artifactID of the kie-maven-plugin\n *  KIE_TAKARI_PLUGIN_ARTIFACT (kie-maven-plugin) configured with the artifactID of the kie-takari-plugin\n *  <p>\n *  KIE_VERSION (${version.org.kie}) configured with a placeholder and set with the correct value in the maven build\n * */\npublic enum ConfigurationKey {\n\n    COMPILER,\n    SOURCE_VERSION,\n    TARGET_VERSION,\n    FAIL_ON_ERROR,\n\n    MAVEN_COMPILER_PLUGIN_GROUP,\n    MAVEN_COMPILER_PLUGIN_ARTIFACT,\n    MAVEN_COMPILER_PLUGIN_VERSION,\n\n    TAKARI_COMPILER_PLUGIN_GROUP,\n    TAKARI_COMPILER_PLUGIN_ARTIFACT,\n    TAKARI_COMPILER_PLUGIN_VERSION,\n\n    KIE_PLUGIN_GROUP,\n    KIE_MAVEN_PLUGIN_ARTIFACT,\n    KIE_TAKARI_PLUGIN_ARTIFACT,\n\n    KIE_VERSION;\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/configuration/ConfigurationStrategy.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.backend.server.utils.configuration;\n\nimport java.util.Map;\n\n/**\n * Define the behaviour of a ConfigurationStrategy,\n * load the configuration and check if it's valid\n */\npublic interface ConfigurationStrategy extends Valid,\n                                               Order {\n\n    Map<ConfigurationKey, String> loadConfiguration();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/configuration/Order.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.backend.server.utils.configuration;\n\n/***\n * Used to order execution of implementations of the same interface\n */\npublic interface Order {\n\n    /**\n     * Used by the implementor to assign and order of execution when multiple implementations are present\n     * @return\n     */\n    Integer getOrder();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/java/org/guvnor/common/services/project/backend/server/utils/configuration/Valid.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.common.services.project.backend.server.utils.configuration;\n\n/***\n * Used to validate a state of an object in different implementations\n */\npublic interface Valid {\n\n    /***\n     * Signals if is in a valid state using an internal algo to check a particular implementations\n     * @return\n     */\n    Boolean isValid();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/AbstractDeleteModuleObserverBridgeTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.project.events.DeleteModuleEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.project.ModuleFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceDeleted;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceUpdated;\n\nimport static org.mockito.Mockito.*;\n\npublic class AbstractDeleteModuleObserverBridgeTest {\n\n    private AbstractDeleteModuleObserverBridge bridge;\n    private IOService ioService;\n    private ModuleFactory<Module> moduleFactory;\n    private Event<DeleteModuleEvent> deleteModuleEvent;\n    private SessionInfo sessionInfo = mock(SessionInfo.class);\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n        ioService = mock(IOService.class);\n        moduleFactory = mock(ModuleFactory.class);\n        deleteModuleEvent = mock(Event.class);\n\n        bridge = new AbstractDeleteModuleObserverBridge<Module>(ioService,\n                                                                deleteModuleEvent) {\n            @Override\n            protected Module getModule(final org.uberfire.java.nio.file.Path path) {\n                return moduleFactory.simpleModuleInstance(path);\n            }\n        };\n    }\n\n    @Test\n    public void testResourceDeletedEventPomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"pom.xml\");\n        when(path.toURI()).thenReturn(\"file://module1/pom.xml\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        bridge.onBatchResourceChanges(new ResourceDeletedEvent(path,\n                                                               \"message\",\n                                                               sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(1)).fire(any(DeleteModuleEvent.class));\n    }\n\n    @Test\n    public void testResourceDeletedEventNonPomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"cheese.drl\");\n        when(path.toURI()).thenReturn(\"file://module1/cheese.drl\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        bridge.onBatchResourceChanges(new ResourceDeletedEvent(path,\n                                                               \"message\",\n                                                               sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(0)).fire(any(DeleteModuleEvent.class));\n    }\n\n    @Test\n    public void testResourceBatchChangesEventUpdatePomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"pom.xml\");\n        when(path.toURI()).thenReturn(\"file://module1/pom.xml\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{\n            put(path,\n                new ArrayList<ResourceChange>() {{\n                    add(new ResourceUpdated(\"\"));\n                }});\n        }};\n\n        bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch,\n                                                                    \"message\",\n                                                                    sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(0)).fire(any(DeleteModuleEvent.class));\n    }\n\n    @Test\n    public void testResourceBatchChangesEventUpdateNonPomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"cheese.drl\");\n        when(path.toURI()).thenReturn(\"file://module1/cheese.drl\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{\n            put(path,\n                new ArrayList<ResourceChange>() {{\n                    add(new ResourceUpdated(\"\"));\n                }});\n        }};\n\n        bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch,\n                                                                    \"message\",\n                                                                    sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(0)).fire(any(DeleteModuleEvent.class));\n    }\n\n    @Test\n    public void testResourceBatchChangesEventDeletePomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"pom.xml\");\n        when(path.toURI()).thenReturn(\"file://module1/pom.xml\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{\n            put(path,\n                new ArrayList<ResourceChange>() {{\n                    add(new ResourceDeleted(\"\"));\n                }});\n        }};\n\n        bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch,\n                                                                    \"message\",\n                                                                    sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(1)).fire(any(DeleteModuleEvent.class));\n    }\n\n    @Test\n    public void testResourceBatchChangesEventDeleteNonPomFile() {\n        final Path path = mock(Path.class);\n        final org.uberfire.java.nio.file.Path nioPath = mock(org.uberfire.java.nio.file.Path.class);\n        when(path.getFileName()).thenReturn(\"cheese.drl\");\n        when(path.toURI()).thenReturn(\"file://module1/cheese.drl\");\n        when(ioService.get(any(URI.class))).thenReturn(nioPath);\n\n        final Map<Path, Collection<ResourceChange>> batch = new HashMap<Path, Collection<ResourceChange>>() {{\n            put(path,\n                new ArrayList<ResourceChange>() {{\n                    add(new ResourceDeleted(\"\"));\n                }});\n        }};\n\n        bridge.onBatchResourceChanges(new ResourceBatchChangesEvent(batch,\n                                                                    \"message\",\n                                                                    sessionInfo));\n\n        verify(deleteModuleEvent,\n               times(0)).fire(any(DeleteModuleEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/AbstractModuleRepositoriesServiceImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.MavenRepositorySource;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.ModuleRepositories;\nimport org.guvnor.common.services.project.service.ModuleRepositoriesService;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.project.service.ModuleResourceResolver;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.FileSystem;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AbstractModuleRepositoriesServiceImplTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private ModuleRepositoryResolver repositoryResolver;\n\n    @Mock\n    private ModuleResourceResolver resourceResolver;\n\n    @Mock\n    private CommentedOptionFactory commentedOptionFactory;\n\n    private ModuleRepositoriesService service;\n    private ModuleRepositoriesContentHandler contentHandler;\n\n    @BeforeClass\n    public static void setupSystemProperties() {\n        //These are not needed for the tests\n        System.setProperty(\"org.uberfire.nio.git.daemon.enabled\",\n                           \"false\");\n        System.setProperty(\"org.uberfire.nio.git.ssh.enabled\",\n                           \"false\");\n        System.setProperty(\"org.uberfire.sys.repo.monitor.disabled\",\n                           \"true\");\n    }\n\n    @Before\n    public void setup() {\n        contentHandler = spy(new ModuleRepositoriesContentHandler());\n        service = new AbstractModuleRepositoriesServiceImpl<Module>(ioService,\n                                                                    repositoryResolver,\n                                                                    contentHandler,\n                                                                    commentedOptionFactory) {\n            @Override\n            protected Module getModule(final Path path) {\n                return resourceResolver.resolveModule(path);\n            }\n        };\n    }\n\n    @Test\n    public void testCreateWithoutProject() {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>local</id>\\n\" +\n                \"        <url>local-url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        metadata.add(new MavenRepositoryMetadata(\"local\",\n                                                 \"local-url\",\n                                                 MavenRepositorySource.LOCAL));\n        when(repositoryResolver.getRemoteRepositoriesMetaData()).thenReturn(metadata);\n        when(resourceResolver.resolveModule(path)).thenReturn(null);\n\n        service.create(path);\n\n        verify(resourceResolver,\n               times(1)).resolveModule(path);\n        verify(repositoryResolver,\n               times(1)).getRemoteRepositoriesMetaData();\n\n        verify(ioService,\n               times(1)).startBatch(any(FileSystem.class),\n                                    any());\n        verify(ioService,\n               times(1)).write(eq(nioPath),\n                               eq(xml));\n        verify(ioService,\n               times(1)).endBatch();\n    }\n\n    @Test\n    public void testCreateWithProject() {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>local</id>\\n\" +\n                \"        <url>local-url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n\n        final Module module = mock(Module.class);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        metadata.add(new MavenRepositoryMetadata(\"local\",\n                                                 \"local-url\",\n                                                 MavenRepositorySource.LOCAL));\n        when(repositoryResolver.getRemoteRepositoriesMetaData(eq(module))).thenReturn(metadata);\n        when(resourceResolver.resolveModule(path)).thenReturn(module);\n\n        service.create(path);\n\n        verify(resourceResolver,\n               times(1)).resolveModule(path);\n        verify(repositoryResolver,\n               times(1)).getRemoteRepositoriesMetaData(eq(module));\n\n        verify(ioService,\n               times(1)).startBatch(any(),\n                                    any());\n        verify(ioService,\n               times(1)).write(eq(nioPath),\n                               eq(xml));\n        verify(ioService,\n               times(1)).endBatch();\n    }\n\n    @Test\n    public void testLoadExisting() {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>id</id>\\n\" +\n                \"        <url>url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n        when(ioService.exists(eq(nioPath))).thenReturn(true);\n        when(ioService.readAllString(eq(nioPath))).thenReturn(xml);\n\n        final ModuleRepositories repositories = service.load(path);\n        assertNotNull(repositories);\n        assertNotNull(repositories.getRepositories());\n        assertEquals(1,\n                     repositories.getRepositories().size());\n\n        final ModuleRepositories.ModuleRepository repository = repositories.getRepositories().iterator().next();\n        assertEquals(\"id\",\n                     repository.getMetadata().getId());\n        assertEquals(\"url\",\n                     repository.getMetadata().getUrl());\n        assertEquals(MavenRepositorySource.LOCAL,\n                     repository.getMetadata().getSource());\n        assertEquals(true,\n                     repository.isIncluded());\n\n        verify(contentHandler,\n               times(1)).toModel(eq(xml));\n    }\n\n    @Test\n    public void testLoadNonExisting() {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>local</id>\\n\" +\n                \"        <url>local-url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n        when(ioService.exists(eq(nioPath))).thenReturn(false);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        metadata.add(new MavenRepositoryMetadata(\"local\",\n                                                 \"local-url\",\n                                                 MavenRepositorySource.LOCAL));\n        when(repositoryResolver.getRemoteRepositoriesMetaData()).thenReturn(metadata);\n\n        final ModuleRepositories repositories = service.load(path);\n        assertNotNull(repositories);\n        assertNotNull(repositories.getRepositories());\n        assertEquals(1,\n                     repositories.getRepositories().size());\n\n        final ModuleRepositories.ModuleRepository repository = repositories.getRepositories().iterator().next();\n        assertEquals(\"local\",\n                     repository.getMetadata().getId());\n        assertEquals(\"local-url\",\n                     repository.getMetadata().getUrl());\n        assertEquals(MavenRepositorySource.LOCAL,\n                     repository.getMetadata().getSource());\n        assertEquals(true,\n                     repository.isIncluded());\n\n        verify(ioService,\n               times(1)).startBatch(any(FileSystem.class),\n                                    any());\n        verify(ioService,\n               times(1)).write(eq(nioPath),\n                               eq(xml));\n        verify(ioService,\n               times(1)).endBatch();\n    }\n\n    @Test\n    public void testSave() {\n        final Set<ModuleRepositories.ModuleRepository> repositories = new HashSet<ModuleRepositories.ModuleRepository>();\n        repositories.add(new ModuleRepositories.ModuleRepository(true,\n                                                                 new MavenRepositoryMetadata(\"id\",\n                                                                                             \"url\",\n                                                                                             MavenRepositorySource.LOCAL)));\n        final ModuleRepositories moduleRepositories = new ModuleRepositories(repositories);\n\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>id</id>\\n\" +\n                \"        <url>url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n\n        service.save(path,\n                     moduleRepositories,\n                     \"comment\");\n\n        verify(ioService,\n               times(1)).write(eq(nioPath),\n                               eq(xml));\n    }\n\n    @Test\n    public void testFiltered() {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>id1</id>\\n\" +\n                \"        <url>url1</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>false</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>id2</id>\\n\" +\n                \"        <url>url2</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final Path path = mock(Path.class);\n        when(path.toURI()).thenReturn(\"file://p0/project.repositories\");\n        final org.uberfire.java.nio.file.Path nioPath = Paths.convert(path);\n        when(ioService.exists(eq(nioPath))).thenReturn(true);\n        when(ioService.readAllString(eq(nioPath))).thenReturn(xml);\n\n        final ModuleRepositories repositories = service.load(path);\n        assertNotNull(repositories);\n        assertNotNull(repositories.getRepositories());\n        assertEquals(2,\n                     repositories.getRepositories().size());\n\n        final MavenRepositoryMetadata[] metadatas = repositories.filterByIncluded();\n        assertEquals(1,\n                     metadatas.length);\n\n        final MavenRepositoryMetadata metadata = metadatas[0];\n        assertEquals(\"id1\",\n                     metadata.getId());\n        assertEquals(\"url1\",\n                     metadata.getUrl());\n        assertEquals(MavenRepositorySource.LOCAL,\n                     metadata.getSource());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/AbstractModuleServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.builder.events.InvalidateDMOModuleCacheEvent;\nimport org.guvnor.common.services.project.events.NewModuleEvent;\nimport org.guvnor.common.services.project.events.NewPackageEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AbstractModuleServiceTest {\n\n    @Mock\n    ModuleFinder moduleFinder;\n    @Mock\n    private IOService ioService;\n    @Mock\n    private POMService pomService;\n    @Mock\n    private RepositoryService repoService;\n    @Mock\n    private Event<NewModuleEvent> newProjectEvent;\n    @Mock\n    private Event<NewPackageEvent> newPackageEvent;\n    @Mock\n    private Event<InvalidateDMOModuleCacheEvent> invalidateDMOCache;\n    @Mock\n    private SessionInfo sessionInfo;\n    @Mock\n    private AuthorizationManager authorizationManager;\n    @Mock\n    private CommentedOptionFactory commentedOptionFactory;\n    @Mock\n    private ResourceResolver resourceResolver;\n    @Mock\n    private Path path;\n    @Mock\n    private Module module;\n    private AbstractModuleService<Module> abstractProjectService;\n\n    @Before\n    public void setup() {\n        abstractProjectService = new AbstractModuleService<Module>(ioService,\n                                                                   pomService,\n                                                                   repoService,\n                                                                   newProjectEvent,\n                                                                   newPackageEvent,\n                                                                   invalidateDMOCache,\n                                                                   sessionInfo,\n                                                                   commentedOptionFactory,\n                                                                   moduleFinder,\n                                                                   resourceResolver) {\n\n            @Override\n            public Module newModule(final org.uberfire.backend.vfs.Path repositoryRoot,\n                                    final POM pom) {\n                return null;\n            }\n\n            @Override\n            public Module newModule(final org.uberfire.backend.vfs.Path repositoryRoot,\n                                    final POM pom,\n                                    final DeploymentMode mode) {\n                return null;\n            }\n\n            @Override\n            public Module simpleModuleInstance(final org.uberfire.java.nio.file.Path parent) {\n                return null;\n            }\n        };\n    }\n\n    @Test\n    public void testReImport() throws Exception {\n        when(path.toURI()).thenReturn(\"file://project1/pom.xml\");\n        when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module);\n\n        abstractProjectService.reImport(path);\n\n        verify(invalidateDMOCache).fire(any(InvalidateDMOModuleCacheEvent.class));\n    }\n\n    @Test\n    public void testUseRepoServiceToDeleteRootModule() {\n        when(path.toURI()).thenReturn(\"file:///space/project1/pom.xml\");\n        when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module);\n        Repository repo = mock(Repository.class);\n        when(repoService.getRepository(eq(org.uberfire.backend.server.util.Paths.convert(Paths.get(\"file:///space/project1\"))))).thenReturn(repo);\n        String alias = \"repo-alias\";\n        when(repo.getAlias()).thenReturn(alias);\n        Space space = new Space(\"space\");\n        when(repo.getSpace()).thenReturn(space);\n\n        abstractProjectService.delete(path, \"\");\n\n        verify(repoService).removeRepository(eq(space), eq(alias));\n        verify(ioService, times(0)).delete(any(), any());\n    }\n\n    @Test\n    public void testUseIOServiceToDeleteSubModule() {\n        when(path.toURI()).thenReturn(\"file://space/project1/subproject/pom.xml\");\n        when(ioService.exists(any())).thenReturn(true);\n        when(resourceResolver.resolveModule(any(Path.class))).thenReturn(module);\n        when(pomService.load(any())).thenReturn(mock(POM.class));\n\n        abstractProjectService.delete(path, \"\");\n\n        verify(repoService, times(0)).removeRepository(any(), any());\n        verify(ioService).delete(eq(Paths.get(\"file://space/project1/subproject\")), anyVararg());\n    }\n\n    @Test\n    public void createModuleDirectoriesTest() {\n        final String workspacePath = \"workspacePath\";\n        final Package defaultPackage = mock(Package.class);\n\n        when(path.toURI()).thenReturn(\"file://space/project1/\");\n        when(pomService.load(any())).thenReturn(mock(POM.class));\n        when(resourceResolver.getDefaultWorkspacePath(any())).thenReturn(workspacePath);\n        when(resourceResolver.resolvePackage(any())).thenReturn(defaultPackage);\n\n        abstractProjectService.createModuleDirectories(path);\n\n        verify(resourceResolver).newPackage(defaultPackage,\n                                            workspacePath,\n                                            false);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/AbstractResourceResolverTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.junit.Before;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.rules.ExpectedException;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AbstractResourceResolverTest {\n\n    protected static final int PROJECT_RESOURCE_PATH_RESOLVERS_SIZE = 5;\n    @Rule\n    public ExpectedException expectedException = ExpectedException.none();\n    @Mock\n    protected IOService ioService;\n    @Mock\n    protected POMService pomService;\n    @Mock\n    protected CommentedOptionFactory commentedOptionFactory;\n    @Mock\n    protected Instance<ModuleResourcePathResolver> resourcePathResolversInstance;\n    protected ResourceResolver resourceResolver;\n    protected List<ModuleResourcePathResolver> projectResourcePathResolvers = new ArrayList<>();\n\n    @Before\n    public void setUp() {\n        initModuleResourcePathResolvers(PROJECT_RESOURCE_PATH_RESOLVERS_SIZE);\n        when(resourcePathResolversInstance.iterator()).thenReturn(projectResourcePathResolvers.iterator());\n\n        resourceResolver = spy(new ResourceResolver(ioService,\n                                                    pomService,\n                                                    commentedOptionFactory,\n                                                    resourcePathResolversInstance) {\n            @Override\n            public Module resolveModule(Path resource, boolean loadPOM) {\n                return null;\n            }\n\n            @Override\n            public Module simpleModuleInstance(org.uberfire.java.nio.file.Path nioModuleRootPath) {\n                return null;\n            }\n        });\n    }\n\n    @Test\n    public void resolveDefaultPathSuccessful() {\n        Package pkg = mock(Package.class);\n        String resourceType = \"any\";\n        Path defaultPath = mock(Path.class);\n\n        // pick one of the configured resolvers as the one that accepts the given resource type.\n        ModuleResourcePathResolver blessedModuleResourcePathResolver = projectResourcePathResolvers.get(3);\n        when(blessedModuleResourcePathResolver.accept(resourceType)).thenReturn(true);\n        when(blessedModuleResourcePathResolver.resolveDefaultPath(pkg)).thenReturn(defaultPath);\n\n        assertEquals(defaultPath,\n                     resourceResolver.resolveDefaultPath(pkg,\n                                                         resourceType));\n\n        verify(blessedModuleResourcePathResolver,\n               times(1)).resolveDefaultPath(pkg);\n        projectResourcePathResolvers.forEach(projectResourcePathResolver -> {\n            if (projectResourcePathResolver != blessedModuleResourcePathResolver) {\n                verify(projectResourcePathResolver,\n                       never()).resolveDefaultPath(any(Package.class));\n            }\n        });\n    }\n\n    @Test\n    public void resolveDefaultPathWithErrors() {\n        Package pkg = mock(Package.class);\n        String resourceType = \"any\";\n        // if none of the configured ModuleResourcePathResolvers accepts the resourceType, and exception must have been\n        // thrown.\n        expectedException.expectMessage(\"No ModuleResourcePathResolver has been defined for resourceType: \" + resourceType);\n        resourceResolver.resolveDefaultPath(pkg,\n                                            resourceType);\n    }\n\n    @Test\n    public void resolveDefaultWorkspacePackageTest() {\n        final GAV gav = mock(GAV.class);\n        doReturn(\"com.group\").when(gav).getGroupId();\n        doReturn(\"package\").when(gav).getArtifactId();\n\n        assertEquals(\"com/group/_package\",\n                     resourceResolver.getDefaultWorkspacePath(gav));\n    }\n\n    @Test\n    public void getDefaultWorkspacePathTest() {\n        final Module project = mock(Module.class);\n\n        final POM pom = mock(POM.class);\n        doReturn(pom).when(project).getPom();\n\n        final GAV gav = mock(GAV.class);\n        doReturn(gav).when(pom).getGav();\n\n        final Path path = mock(Path.class);\n        doReturn(path).when(project).getRootPath();\n\n        when(path.toURI()).thenReturn(\"file:///myproject/\");\n        doReturn(\"com.group\").when(gav).getGroupId();\n        doReturn(\"package\").when(gav).getArtifactId();\n\n        final ArgumentCaptor<Path> packagePathArgumentCaptor = ArgumentCaptor.forClass(Path.class);\n\n        resourceResolver.resolveDefaultWorkspacePackage(project);\n\n        verify(resourceResolver).resolvePackage(packagePathArgumentCaptor.capture());\n        final Path packagePath = packagePathArgumentCaptor.getValue();\n        assertEquals(\"file:///myproject/src/main/resources/com/group/_package\",\n                     packagePath.toURI());\n    }\n\n    private void initModuleResourcePathResolvers(int size) {\n        for (int i = 0; i < size; i++) {\n            projectResourcePathResolvers.add(mock(ModuleResourcePathResolver.class));\n        }\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/DefaultModuleResourcePathResolverTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.project.model.Package;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultModuleResourcePathResolverTest {\n\n    private DefaultModuleResourcePathResolver resolver;\n\n    @Mock\n    private Package pkg;\n\n    @Mock\n    private Path packageMainResourcesPath;\n\n    @Before\n    public void setUp() {\n        resolver = new DefaultModuleResourcePathResolver();\n        when(pkg.getPackageMainResourcesPath()).thenReturn(packageMainResourcesPath);\n    }\n\n    @Test\n    public void testAcceptFile() {\n        assertTrue(resolver.accept(\"txt\"));\n        assertTrue(resolver.accept(\"java\"));\n        assertTrue(resolver.accept(null));\n        assertTrue(resolver.accept(\"\"));\n    }\n\n    @Test\n    public void testResolveByDefaultPath() {\n        assertEquals(packageMainResourcesPath,\n                     resolver.resolveDefaultPath(pkg));\n        verify(pkg,\n               times(1)).getPackageMainResourcesPath();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/MockModule.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.project.model.Module;\n\npublic class MockModule extends Module {\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ModuleConfigurationContentHandlerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.project.model.ProjectImports;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.kie.soup.project.datamodel.imports.Import;\n\nimport static org.junit.Assert.*;\n\npublic class ModuleConfigurationContentHandlerTest {\n\n    private ProjectConfigurationContentHandler handler;\n\n    @Before\n    public void setUp() throws Exception {\n        handler = new ProjectConfigurationContentHandler();\n    }\n\n    @Test\n    public void testVersion() throws Exception {\n        assertTrue(handler.toString(new ProjectImports()).contains(\"<version>1.0</version>\"));\n    }\n\n    @Test\n    public void testNullSourceXml() throws Exception {\n        ProjectImports imports = handler.toModel(null);\n        assertNotNull(imports);\n        assertEquals(0,\n                     imports.getImports().getImports().size());\n    }\n\n    @Test\n    public void testEmptySourceXml() throws Exception {\n        ProjectImports imports = handler.toModel(\"\");\n        assertNotNull(imports);\n        assertEquals(0,\n                     imports.getImports().getImports().size());\n    }\n\n    @Test\n    public void testNullModel() throws Exception {\n        String xml = handler.toString(null);\n        assertEquals(\"\",\n                     xml);\n    }\n\n    @Test\n    public void testEmptyImports() throws Exception {\n        String xml = handler.toString(new ProjectImports());\n        assertTrue(xml.contains(\"<imports>\"));\n        assertTrue(xml.contains(\"</imports>\"));\n    }\n\n    @Test\n    public void testImports() throws Exception {\n        ProjectImports configuration = new ProjectImports();\n        configuration.getImports().addImport(new Import(\"java.util.List\"));\n        configuration.getImports().addImport(new Import(\"org.test.Object\"));\n        String xml = handler.toString(configuration);\n        assertTrue(xml.contains(\"<import>\"));\n        assertTrue(xml.contains(\"</import>\"));\n        assertTrue(xml.contains(\"<type>java.util.List</type>\"));\n        assertTrue(xml.contains(\"<type>org.test.Object</type>\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ModuleFinderTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URISyntaxException;\nimport java.util.Set;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.test.WeldJUnitRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\n@RunWith(WeldJUnitRunner.class)\npublic class ModuleFinderTest {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    IOService ioService;\n\n    @Inject\n    POMService pomService;\n\n    private ModuleFinder finder;\n\n    @Before\n    public void setUp() throws Exception {\n\n        finder = new ModuleFinder(ioService,\n                                  pomService);\n    }\n\n    private ResourceResolver getResourceResolver() throws URISyntaxException {\n\n        final Path project1FolderPath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/Project1/\").toURI());\n        final Path project1FilePath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/Project1/pom.xml\").toURI());\n\n        final Path project2FolderPath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/Project2/\").toURI());\n        final Path project2FilePath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/Project2/pom.xml\").toURI());\n\n        return new ResourceResolver() {\n            @Override\n            public Module resolveModule(org.uberfire.backend.vfs.Path resource, boolean loadPOM) {\n\n                final String uri = resource.toURI();\n\n                if (uri.endsWith(\"Project1/pom.xml\")) {\n                    return new Module(Paths.convert(project1FolderPath),\n                                      Paths.convert(project1FilePath),\n                                      new POM(new GAV(\"test\",\n                                                      \"project1\",\n                                                      \"1.0\")));\n                } else if (uri.endsWith(\"Project2/pom.xml\")) {\n                    return new Module(Paths.convert(project2FolderPath),\n                                      Paths.convert(project2FilePath),\n                                      new POM(new GAV(\"test\",\n                                                      \"project2\",\n                                                      \"1.0\")));\n                } else {\n                    return null;\n                }\n            }\n\n            @Override\n            public Module simpleModuleInstance(Path nioModuleRootPath) {\n                throw new NotImplementedException();\n            }\n        };\n    }\n\n    @Test\n    public void pomIsInPathRoot() throws Exception {\n        final Path folderPath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/Project1/\").toURI());\n\n        final Set<Module> modules = finder.find(getResourceResolver(),\n                                                new Branch(\"main\",\n                                                           Paths.convert(folderPath)));\n\n        assertFalse(modules.isEmpty());\n    }\n\n    @Test\n    public void modulesAreInFolders() throws Exception {\n        final Path folderPath = ioService.get(this.getClass().getResource(\"/LegacyRepositoryStructure/\").toURI());\n\n        final Set<Module> modules = finder.find(getResourceResolver(),\n                                                new Branch(\"main\",\n                                                           Paths.convert(folderPath)));\n\n        assertEquals(2,\n                     modules.size());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ModuleMavenRepositoryResolverImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.Files;\nimport java.util.Collection;\nimport java.util.Set;\nimport javax.enterprise.inject.Instance;\n\nimport org.apache.maven.project.MavenProject;\nimport org.appformer.maven.integration.embedder.MavenProjectLoader;\nimport org.appformer.maven.integration.embedder.MavenSettings;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.MavenRepositorySource;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.preferences.GAVPreferences;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.guvnor.common.services.project.backend.server.MavenLocalRepositoryUtils.tearDownMavenRepository;\nimport static org.guvnor.common.services.project.backend.server.RepositoryResolverTestUtils.deployArtifact;\nimport static org.guvnor.common.services.project.backend.server.RepositoryResolverTestUtils.generateSettingsXml;\nimport static org.guvnor.common.services.project.backend.server.RepositoryResolverTestUtils.installArtifact;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\n// *** NOTE ***\n// The transient Maven Repository used by these tests is only cleared after all the tests have ran.\n// Therefore each test should use a unique GAV to avoid potential conflicts between tests.\npublic class ModuleMavenRepositoryResolverImplTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private Instance<GAVPreferences> gavPreferencesProvider;\n\n    @Mock\n    private GAVPreferences gavPreferences;\n\n    @Mock\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    private ModuleRepositoryResolverImpl service;\n\n    private static java.nio.file.Path m2Folder = null;\n    private static java.nio.file.Path settingsXmlPath = null;\n\n    @BeforeClass\n    public static void setupSystemProperties() {\n        //These are not needed for the tests\n        System.setProperty(\"org.uberfire.nio.git.daemon.enabled\",\n                           \"false\");\n        System.setProperty(\"org.uberfire.nio.git.ssh.enabled\",\n                           \"false\");\n        System.setProperty(\"org.uberfire.sys.repo.monitor.disabled\",\n                           \"true\");\n    }\n\n    @BeforeClass\n    public static void setupMavenRepository() {\n        try {\n            m2Folder = Files.createTempDirectory(\"temp-m2\");\n\n            settingsXmlPath = generateSettingsXml(m2Folder);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        }\n    }\n\n    @Before\n    public void setup() {\n        service = new ModuleRepositoryResolverImpl(ioService, gavPreferencesProvider, scopeResolutionStrategies);\n        doReturn(gavPreferences).when(gavPreferencesProvider).get();\n    }\n\n    @AfterClass\n    public static void teardownMavenRepository() {\n        tearDownMavenRepository(m2Folder);\n        MavenSettings.reinitSettings();\n    }\n\n    @Test\n    public void testGetRemoteRepositoriesMetaData_WithoutExplicitProjectRepository() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.1</version>\\n\" +\n                \"</project>\";\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRemoteRepositoriesMetaData(module);\n            assertNotNull(metadata);\n            assertEquals(6,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"jboss-developer-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/groups/developer/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"http://repository.jboss.org/nexus/content/groups/public/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-snapshots-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"central\",\n                                     \"https://repo.maven.apache.org/maven2\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRemoteRepositoriesMetaData_WithExplicitProjectRepository() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.2</version>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <id>explicit-repo</id>\\n\" +\n                \"      <name>Explicit Repository</name>\\n\" +\n                \"      <url>http://localhost/maven2/</url>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project>\";\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRemoteRepositoriesMetaData(module);\n            assertNotNull(metadata);\n            assertEquals(7,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"jboss-developer-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/groups/developer/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"http://repository.jboss.org/nexus/content/groups/public/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-snapshots-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"central\",\n                                     \"https://repo.maven.apache.org/maven2\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n            assertContainsRepository(\"explicit-repo\",\n                                     \"http://localhost/maven2/\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRemoteRepositoriesMetaData_WithDistributionManagementRepository() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.3</version>\\n\" +\n                \"  <distributionManagement>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <id>distribution-repo</id>\\n\" +\n                \"      <name>Distribution Repository</name>\\n\" +\n                \"      <url>http://distribution-host/maven2/</url>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </distributionManagement>\\n\" +\n                \"</project>\";\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRemoteRepositoriesMetaData(module);\n            assertNotNull(metadata);\n            assertEquals(7,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"jboss-developer-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/groups/developer/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"http://repository.jboss.org/nexus/content/groups/public/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-snapshots-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"central\",\n                                     \"https://repo.maven.apache.org/maven2\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n            assertContainsRepository(\"distribution-repo\",\n                                     \"http://distribution-host/maven2/\",\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRemoteRepositoriesMetaData_WithDistributionManagementSnapshotRepository_NonSnapshotVersion() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.4</version>\\n\" +\n                \"  <distributionManagement>\\n\" +\n                \"    <snapshotRepository>\\n\" +\n                \"      <id>distribution-repo</id>\\n\" +\n                \"      <name>Distribution Repository</name>\\n\" +\n                \"      <url>http://distribution-host/maven2/</url>\\n\" +\n                \"    </snapshotRepository>\\n\" +\n                \"  </distributionManagement>\\n\" +\n                \"</project>\";\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRemoteRepositoriesMetaData(module);\n            assertNotNull(metadata);\n            assertEquals(6,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"jboss-developer-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/groups/developer/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"http://repository.jboss.org/nexus/content/groups/public/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-snapshots-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"central\",\n                                     \"https://repo.maven.apache.org/maven2\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRemoteRepositoriesMetaData_WithDistributionManagementSnapshotRepository_SnapshotVersion() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.1-SNAPSHOT</version>\\n\" +\n                \"  <distributionManagement>\\n\" +\n                \"    <snapshotRepository>\\n\" +\n                \"      <id>distribution-repo</id>\\n\" +\n                \"      <name>Distribution Repository</name>\\n\" +\n                \"      <url>http://distribution-host/maven2/</url>\\n\" +\n                \"    </snapshotRepository>\\n\" +\n                \"  </distributionManagement>\\n\" +\n                \"</project>\";\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRemoteRepositoriesMetaData(module);\n            assertNotNull(metadata);\n            assertEquals(7,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"jboss-developer-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/groups/developer/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"http://repository.jboss.org/nexus/content/groups/public/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-snapshots-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"jboss-public-repository-group\",\n                                     \"https://repository.jboss.org/nexus/content/repositories/snapshots/\",\n                                     MavenRepositorySource.SETTINGS,\n                                     metadata);\n            assertContainsRepository(\"central\",\n                                     \"https://repo.maven.apache.org/maven2\",\n                                     MavenRepositorySource.PROJECT,\n                                     metadata);\n            assertContainsRepository(\"distribution-repo\",\n                                     \"http://distribution-host/maven2/\",\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_NewGAV_NotInstalledNotDeployed() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.5\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_NewGAV_IsInstalledNotDeployed() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.6</version>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.6\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_NewGAV_IsInstalledIsDeployed() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.7</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.7\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_NewGAV_NotInstalledIsDeployed() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.8</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.8\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_NewGAV_IsInstalledIsDeployed_Filtered() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.9</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.9\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   new MavenRepositoryMetadata(\"local\",\n                                                                                                                               m2Folder.toString(),\n                                                                                                                               MavenRepositorySource.LOCAL));\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ExplicitGAV_NotInstalledNotDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.10</version>\\n\" +\n                \"</project>\";\n        final GAV gav = new GAV(\"org.guvnor\",\n                                \"test\",\n                                \"0.0.10\");\n\n        when(module.getPomXMLPath()).thenReturn(pomXmlPath);\n        when(pomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n        when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ExplicitGAV_IsInstalledNotDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.11</version>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.11\");\n\n            when(module.getPomXMLPath()).thenReturn(vfsPomXmlPath);\n            when(vfsPomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n            when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ExplicitGAV_IsInstalledIsDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.12</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.12\");\n\n            when(module.getPomXMLPath()).thenReturn(vfsPomXmlPath);\n            when(vfsPomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n            when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module);\n            assertNotNull(metadata);\n            assertEquals(2,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ExplicitGAV_NotInstalledIsDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.13</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.13\");\n\n            when(module.getPomXMLPath()).thenReturn(vfsPomXmlPath);\n            when(vfsPomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n            when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n\n            final Set<MavenRepositoryMetadata> metadata2 = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                    module);\n            assertNotNull(metadata2);\n            assertEquals(1,\n                         metadata2.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata2);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ExplicitGAV_IsInstalledIsDeployed_Filtered() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.14</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.14\");\n\n            when(module.getPomXMLPath()).thenReturn(vfsPomXmlPath);\n            when(vfsPomXmlPath.toURI()).thenReturn(\"file://p0/pom.xml\");\n            when(ioService.readAllString(any(Path.class))).thenReturn(pomXml);\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module,\n                                                                                                   new MavenRepositoryMetadata(\"distribution-repo\",\n                                                                                                                               \"file://\" + remoteRepositoryFolder.toString(),\n                                                                                                                               MavenRepositorySource.DISTRIBUTION_MANAGEMENT));\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ImplicitGAV_NotInstalledNotDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path pomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n\n        final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                \"  <groupId>org.guvnor</groupId>\\n\" +\n                \"  <artifactId>test</artifactId>\\n\" +\n                \"  <version>0.0.15</version>\\n\" +\n                \"</project>\";\n\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ImplicitGAV_IsInstalledNotDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.16</version>\\n\" +\n                    \"</project>\";\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ImplicitGAV_IsInstalledIsDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.17</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata);\n            assertEquals(2,\n                         metadata.size());\n\n            assertContainsRepository(\"local\",\n                                     m2Folder.toString(),\n                                     MavenRepositorySource.LOCAL,\n                                     metadata);\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ImplicitGAV_NotInstalledIsDeployed() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.18</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n\n            final Set<MavenRepositoryMetadata> metadata2 = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata2);\n            assertEquals(1,\n                         metadata2.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata2);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_ImplicitGAV_IsInstalledIsDeployed_Filtered() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        java.nio.file.Path remoteRepositoryFolder = null;\n\n        try {\n            remoteRepositoryFolder = Files.createTempDirectory(\"distribution-repo\");\n\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.19</version>\\n\" +\n                    \"  <distributionManagement>\\n\" +\n                    \"    <repository>\\n\" +\n                    \"      <id>distribution-repo</id>\\n\" +\n                    \"      <name>Distribution Repository</name>\\n\" +\n                    \"      <url>file://\" + remoteRepositoryFolder.toString() + \"</url>\\n\" +\n                    \"    </repository>\\n\" +\n                    \"  </distributionManagement>\\n\" +\n                    \"</project>\";\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n            deployArtifact(mavenProject,\n                           pomXml);\n\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml,\n                                                                                                   new MavenRepositoryMetadata(\"distribution-repo\",\n                                                                                                                               \"file://\" + remoteRepositoryFolder.toString(),\n                                                                                                                               MavenRepositorySource.DISTRIBUTION_MANAGEMENT));\n            assertNotNull(metadata);\n            assertEquals(1,\n                         metadata.size());\n\n            assertContainsRepository(\"distribution-repo\",\n                                     \"file://\" + remoteRepositoryFolder.toString(),\n                                     MavenRepositorySource.DISTRIBUTION_MANAGEMENT,\n                                     metadata);\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        } finally {\n            tearDownMavenRepository(remoteRepositoryFolder);\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_Disabled1() {\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.20</version>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.20\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n            doReturn(true).when(gavPreferences).isConflictingGAVCheckDisabled();\n\n            //Re-instantiate service to pick-up System Property\n            service = new ModuleRepositoryResolverImpl(ioService, gavPreferencesProvider, scopeResolutionStrategies);\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            //Without being disabled this would return one resolved (LOCAL) Repository\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_Disabled2() {\n        final Module module = mock(Module.class);\n        doReturn(\"file://main@a/a%20b\").when(module).getIdentifier();\n        doCallRealMethod().when(module).getEncodedIdentifier();\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.21</version>\\n\" +\n                    \"</project>\";\n\n            final GAV gav = new GAV(\"org.guvnor\",\n                                    \"test\",\n                                    \"0.0.21\");\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n            doReturn(true).when(gavPreferences).isConflictingGAVCheckDisabled();\n\n            //Re-instantiate service to pick-up System Property\n            service = new ModuleRepositoryResolverImpl(ioService, gavPreferencesProvider, scopeResolutionStrategies);\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            //Without being disabled this would return one resolved (LOCAL) Repository\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(gav,\n                                                                                                   module);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    @Test\n    public void testGetRepositoriesResolvingArtifact_Disabled3() {\n        final Module module = mock(Module.class);\n        final org.uberfire.backend.vfs.Path vfsPomXmlPath = mock(org.uberfire.backend.vfs.Path.class);\n        final String oldSettingsXmlPath = System.getProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY);\n\n        try {\n            final String pomXml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\" +\n                    \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\"\\n\" +\n                    \"    xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\\n\" +\n                    \"  <modelVersion>4.0.0</modelVersion>\\n\" +\n                    \"  <groupId>org.guvnor</groupId>\\n\" +\n                    \"  <artifactId>test</artifactId>\\n\" +\n                    \"  <version>0.0.22</version>\\n\" +\n                    \"</project>\";\n\n            System.setProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                               settingsXmlPath.toString());\n            doReturn(true).when(gavPreferences).isConflictingGAVCheckDisabled();\n\n            //Re-instantiate service to pick-up System Property\n            service = new ModuleRepositoryResolverImpl(ioService, gavPreferencesProvider, scopeResolutionStrategies);\n\n            final InputStream pomStream = new ByteArrayInputStream(pomXml.getBytes(StandardCharsets.UTF_8));\n            final MavenProject mavenProject = MavenProjectLoader.parseMavenPom(pomStream);\n            installArtifact(mavenProject,\n                            pomXml);\n\n            //Without being disabled this would return one resolved (LOCAL) Repository\n            final Set<MavenRepositoryMetadata> metadata = service.getRepositoriesResolvingArtifact(pomXml);\n            assertNotNull(metadata);\n            assertEquals(0,\n                         metadata.size());\n        } finally {\n            resetSystemProperty(MavenSettings.CUSTOM_SETTINGS_PROPERTY,\n                                oldSettingsXmlPath);\n        }\n    }\n\n    private void assertContainsRepository(final String id,\n                                          final String url,\n                                          final MavenRepositorySource source,\n                                          final Collection<MavenRepositoryMetadata> metadata) {\n        for (MavenRepositoryMetadata md : metadata) {\n            if (md.getId().equals(id) && md.getUrl().equals(url) && md.getSource().equals(source)) {\n                return;\n            }\n        }\n        fail(\"Repository Id '\" + id + \"' not found.\");\n    }\n\n    private void resetSystemProperty(final String systemPropertyName,\n                                     final String oldSystemPropertyValue) {\n        if (oldSystemPropertyValue != null) {\n            System.setProperty(systemPropertyName,\n                               oldSystemPropertyValue);\n        } else {\n            System.clearProperty(systemPropertyName);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ModuleRepositoriesContentHandlerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.MavenRepositorySource;\nimport org.guvnor.common.services.project.model.ModuleRepositories;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class ModuleRepositoriesContentHandlerTest {\n\n    private ModuleRepositoriesContentHandler handler;\n\n    @Before\n    public void setUp() throws Exception {\n        handler = new ModuleRepositoriesContentHandler();\n    }\n\n    @Test\n    public void testNullSourceXml() throws Exception {\n        final ModuleRepositories repositories = handler.toModel(null);\n        assertNotNull(repositories);\n        assertEquals(0,\n                     repositories.getRepositories().size());\n    }\n\n    @Test\n    public void testEmptySourceXml() throws Exception {\n        final ModuleRepositories repositories = handler.toModel(\"\");\n        assertNotNull(repositories);\n        assertEquals(0,\n                     repositories.getRepositories().size());\n    }\n\n    @Test\n    public void testNullModel() throws Exception {\n        final String xml = handler.toString(null);\n        assertEquals(\"\",\n                     xml);\n    }\n\n    @Test\n    public void testEmptyRepositories() throws Exception {\n        final String xml = handler.toString(new ModuleRepositories());\n        assertEquals(\"<project-repositories>\\n\" +\n                             \"  <repositories/>\\n\" +\n                             \"</project-repositories>\",\n                     xml);\n    }\n\n    @Test\n    public void testRepositoriesMarshalling() throws Exception {\n        final Set<ModuleRepositories.ModuleRepository> repositories = new HashSet<ModuleRepositories.ModuleRepository>();\n        repositories.add(new ModuleRepositories.ModuleRepository(true,\n                                                                 new MavenRepositoryMetadata(\"id\",\n                                                                                             \"url\",\n                                                                                             MavenRepositorySource.LOCAL)));\n        final ModuleRepositories moduleRepositories = new ModuleRepositories(repositories);\n\n        final String xml = handler.toString(moduleRepositories);\n        assertEquals(\"<project-repositories>\\n\" +\n                             \"  <repositories>\\n\" +\n                             \"    <repository>\\n\" +\n                             \"      <include>true</include>\\n\" +\n                             \"      <metadata>\\n\" +\n                             \"        <id>id</id>\\n\" +\n                             \"        <url>url</url>\\n\" +\n                             \"        <source>LOCAL</source>\\n\" +\n                             \"      </metadata>\\n\" +\n                             \"    </repository>\\n\" +\n                             \"  </repositories>\\n\" +\n                             \"</project-repositories>\",\n                     xml);\n    }\n\n    @Test\n    public void testRepositoriesUnmarshalling() throws Exception {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <metadata>\\n\" +\n                \"        <id>id</id>\\n\" +\n                \"        <url>url</url>\\n\" +\n                \"        <source>LOCAL</source>\\n\" +\n                \"      </metadata>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final ModuleRepositories repositories = handler.toModel(xml);\n        assertNotNull(repositories);\n        assertNotNull(repositories.getRepositories());\n        assertEquals(1,\n                     repositories.getRepositories().size());\n\n        final ModuleRepositories.ModuleRepository repository = repositories.getRepositories().iterator().next();\n        assertEquals(\"id\",\n                     repository.getMetadata().getId());\n        assertEquals(\"url\",\n                     repository.getMetadata().getUrl());\n        assertEquals(MavenRepositorySource.LOCAL,\n                     repository.getMetadata().getSource());\n        assertEquals(true,\n                     repository.isIncluded());\n    }\n\n    @Test\n    public void testRepositoriesUnmarshalling_InvalidXml() throws Exception {\n        final String xml = \"<project-repositories>\\n\" +\n                \"  <repositories>\\n\" +\n                \"    <repository>\\n\" +\n                \"      <include>true</include>\\n\" +\n                \"      <cheese>\\n\" +\n                \"        <name>cheddar</name>\\n\" +\n                \"      </cheese>\\n\" +\n                \"    </repository>\\n\" +\n                \"  </repositories>\\n\" +\n                \"</project-repositories>\";\n\n        final ModuleRepositories repositories = handler.toModel(xml);\n        assertNotNull(repositories);\n        assertNotNull(repositories.getRepositories());\n        assertEquals(0,\n                     repositories.getRepositories().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ModuleServiceMock.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.uberfire.backend.vfs.Path;\n\npublic class ModuleServiceMock\n        implements ModuleService<MockModule> {\n\n    @Override\n    public MockModule resolveModule(Path resource) {\n        return null;\n    }\n\n    @Override\n    public MockModule resolveModule(Path resource, boolean loadPOM) {\n        return null;\n    }\n\n    @Override\n    public Module resolveParentModule(Path resource) {\n        return null;\n    }\n\n    @Override\n    public Module resolveToParentModule(Path resource) {\n        return null;\n    }\n\n    @Override\n    public Set<Package> resolvePackages(Module module) {\n        return null;\n    }\n\n    @Override\n    public Set<Package> resolvePackages(final Module module, final Set<String> packageNames) {\n        return null;\n    }\n\n    @Override\n    public Set<Package> resolvePackages(Package pkg) {\n        return null;\n    }\n\n    @Override\n    public Package resolveDefaultPackage(Module module) {\n        return null;\n    }\n\n    @Override\n    public Package resolveDefaultWorkspacePackage(Module module) {\n        return null;\n    }\n\n    @Override\n    public Package resolveParentPackage(Package pkg) {\n        return null;\n    }\n\n    @Override\n    public Path resolveDefaultPath(Package pkg, String resourceType) {\n        return null;\n    }\n\n    @Override\n    public boolean isPom(Path resource) {\n        return false;\n    }\n\n    @Override\n    public Package resolvePackage(Path resource) {\n        return null;\n    }\n\n    @Override\n    public Set<Module> getAllModules(Branch branch) {\n        return null;\n    }\n\n    @Override\n    public MockModule newModule(Path repositoryRoot, POM pom) {\n        return null;\n    }\n\n    @Override\n    public MockModule newModule(Path repositoryRoot, POM pom, DeploymentMode mode) {\n        return null;\n    }\n\n    @Override\n    public Package newPackage(Package pkg, String packageName) {\n        return null;\n    }\n\n    @Override\n    public Path rename(Path pathToPomXML, String newName, String comment) {\n        return null;\n    }\n\n    @Override\n    public void delete(Path pathToPomXML, String comment) {\n\n    }\n\n    @Override\n    public void copy(Path pathToPomXML, String newName, String comment) {\n\n    }\n\n    @Override\n    public void reImport(Path pathToPomXML) {\n\n    }\n\n    @Override\n    public void createModuleDirectories(Path repositoryRoot) {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/POMServiceImplCreateTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.guvnor.test.TestTempFileSystem;\nimport org.guvnor.test.WeldJUnitRunner;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(WeldJUnitRunner.class)\npublic class POMServiceImplCreateTest {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    IOService ioService;\n\n    @Inject\n    POMContentHandler pomContentHandler;\n\n    @Mock\n    M2RepoService m2RepoService;\n\n    @Mock\n    MetadataService metadataService;\n\n    PomEnhancer pomEnhancer;\n\n    private POMServiceImpl service;\n\n    @Inject\n    private Paths paths;\n\n    private IOService ioServiceSpy;\n\n    @Inject\n    private TestTempFileSystem testFileSystem;\n\n    @Before\n    public void setUp() throws Exception {\n        pomEnhancer = new DefaultPomEnhancer();\n        MockitoAnnotations.initMocks(this);\n\n        ioServiceSpy = spy(ioService);\n\n        service = new POMServiceImpl(ioServiceSpy,\n                                     pomContentHandler,\n                                     m2RepoService,\n                                     metadataService,\n                                     new EventSourceMock<>(),\n                                     mock(ModuleService.class),\n                                     mock(CommentedOptionFactory.class),\n                                     pomEnhancer);\n    }\n\n    @After\n    public void tearDown() throws Exception {\n        testFileSystem.tearDown();\n    }\n\n    @Test\n    public void testCreate() throws Exception {\n        final Path path = testFileSystem.createTempDirectory(\"/MyTestProject\");\n\n        service.create(path,\n                       new POM());\n\n        ArgumentCaptor<org.uberfire.java.nio.file.Path> pathArgumentCaptor = ArgumentCaptor.forClass(org.uberfire.java.nio.file.Path.class);\n        ArgumentCaptor<String> stringArgumentCaptor = ArgumentCaptor.forClass(String.class);\n\n        verify(ioServiceSpy).write(pathArgumentCaptor.capture(),\n                                   stringArgumentCaptor.capture());\n\n        assertEquals(pathArgumentCaptor.getValue().toUri().toString(),\n                     path.toURI() + \"/pom.xml\");\n\n        String pomXML = stringArgumentCaptor.getValue();\n\n        assertTrue(pomXML.contains(\"<id>guvnor-m2-repo</id>\"));\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/POMServiceImplLoadTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URL;\nimport java.util.List;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.model.Dependency;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.guvnor.test.WeldJUnitRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.MockitoAnnotations;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(WeldJUnitRunner.class)\npublic class POMServiceImplLoadTest {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    IOService ioService;\n\n    @Inject\n    POMContentHandler pomContentHandler;\n\n    @Mock\n    M2RepoService m2RepoService;\n\n    @Mock\n    MetadataService metadataService;\n\n    @Mock\n    PomEnhancer pomEnhancer;\n\n    private POMService service;\n\n    private IOService ioServiceSpy;\n\n    @Before\n    public void setUp() throws Exception {\n        MockitoAnnotations.initMocks(this);\n\n        ioServiceSpy = spy(ioService);\n\n        service = new POMServiceImpl(ioServiceSpy,\n                                     pomContentHandler,\n                                     m2RepoService,\n                                     metadataService,\n                                     new EventSourceMock<>(),\n                                     mock(ModuleService.class),\n                                     mock(CommentedOptionFactory.class),\n                                     pomEnhancer);\n    }\n\n    @Test\n    public void testLoad() throws Exception {\n        final URL url = this.getClass().getResource(\"/TestProject/pom.xml\");\n\n        final Path path = ioService.get(url.toURI());\n\n        POM pom = service.load(Paths.convert(path));\n\n        assertEquals(\"org.test\",\n                     pom.getGav().getGroupId());\n        assertEquals(\"my-test\",\n                     pom.getGav().getArtifactId());\n        assertEquals(\"1.0\",\n                     pom.getGav().getVersion());\n\n        assertEquals(2,\n                     pom.getDependencies().size());\n\n        assertContainsDependency(\"org.apache.commons\",\n                                 \"commons-lang3\",\n                                 \"compile\",\n                                 pom.getDependencies());\n        assertContainsDependency(\"org.jboss.weld\",\n                                 \"weld-core-impl\",\n                                 \"test\",\n                                 pom.getDependencies());\n    }\n\n    private void assertContainsDependency(String groupID,\n                                          String artifactID,\n                                          String scope,\n                                          List<Dependency> dependencies) {\n        boolean foundOne = false;\n        for (Dependency dependency : dependencies) {\n            if (groupID.equals(dependency.getGroupId())\n                    && artifactID.equals(dependency.getArtifactId())\n                    &&\n                    (\n                            scope.equals(dependency.getScope())\n                                    || (scope.equals(\"compile\") && dependency.getScope() == null)\n                    )) {\n                foundOne = true;\n            }\n        }\n\n        assertTrue(\"Did not find dependency: \" + groupID + \":\" + artifactID + \":\" + scope,\n                   foundOne);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/POMServiceImplSaveTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.events.ModuleUpdatedEvent;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.guvnor.test.TestFileSystem;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class POMServiceImplSaveTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private POMContentHandler pomContentHandler;\n\n    @Mock\n    private ModuleService moduleService;\n\n    @Mock\n    private EventSourceMock<ModuleUpdatedEvent> moduleUpdatedEvent;\n\n    @Captor\n    private ArgumentCaptor<org.uberfire.java.nio.file.Path> pathArgumentCaptor;\n\n    private TestFileSystem testFileSystem;\n    private POMServiceImpl service;\n\n    @Before\n    public void setUp() throws Exception {\n        testFileSystem = new TestFileSystem();\n\n        doReturn(new POM(\"mymodule\",\n                         \"desctiption\",\n                         \"url\",\n                         new GAV())).when(pomContentHandler).toModel(any());\n        doReturn(\"\").when(pomContentHandler).toString(any(), any());\n\n        doReturn(mock(Module.class)).when(moduleService).resolveModule(any());\n\n        service = new POMServiceImpl(ioService,\n                                     pomContentHandler,\n                                     mock(M2RepoService.class),\n                                     mock(MetadataService.class),\n                                     moduleUpdatedEvent,\n                                     moduleService,\n                                     mock(CommentedOptionFactory.class),\n                                     mock(PomEnhancer.class));\n    }\n\n    @After\n    public void tearDown() throws Exception {\n        testFileSystem.tearDown();\n    }\n\n    @Test\n    public void whenProjectSavedWithoutChanges_ModuleUpdatedEventNotFired() throws Exception {\n        final Path path = testFileSystem.createTempFile(\"testproject/pom.xml\");\n\n        POM originalPOM = new POM(\"mymodule\",\n                                  \"desctiption\",\n                                  \"url\",\n                                  new GAV());\n        service.save(path,\n                     originalPOM,\n                     mock(Metadata.class),\n                     \"\");\n\n        verify(ioService).startBatch(any(), any());\n        verify(ioService).write(pathArgumentCaptor.capture(),\n                                anyString(),\n                                anyMap());\n        verify(ioService).endBatch();\n        verify(moduleUpdatedEvent, never()).fire(any());\n\n        assertTrue(path.toURI().endsWith(pathArgumentCaptor.getValue().toString()));\n    }\n\n    @Test\n    public void whenProjectRenamed_ModuleUpdatedEventIsFired() throws Exception {\n        final Path path = testFileSystem.createTempFile(\"testproject/pom.xml\");\n\n        service.save(path,\n                     new POM(\"newName\",\n                             \"desctiption\",\n                             \"url\",\n                             new GAV()),\n                     mock(Metadata.class),\n                     \"\");\n\n        verify(moduleUpdatedEvent).fire(any());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/POMServiceImplSaveWithSubModulesTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.ArrayList;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.backend.server.utils.POMContentHandler;\nimport org.guvnor.common.services.project.events.ModuleUpdatedEvent;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.guvnor.m2repo.service.M2RepoService;\nimport org.guvnor.test.TestFileSystem;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class POMServiceImplSaveWithSubModulesTest {\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private ModuleService moduleService;\n\n    @Mock\n    private EventSourceMock<ModuleUpdatedEvent> moduleUpdatedEvent;\n\n    @Captor\n    private ArgumentCaptor<org.uberfire.java.nio.file.Path> pathArgumentCaptor;\n\n    private TestFileSystem testFileSystem;\n    private POMServiceImpl service;\n\n    @Before\n    public void setUp() throws Exception {\n        testFileSystem = new TestFileSystem();\n\n        doReturn(mock(Module.class)).when(moduleService).resolveModule(any());\n\n        service = new POMServiceImpl(ioService,\n                                     mock(POMContentHandler.class),\n                                     mock(M2RepoService.class),\n                                     mock(MetadataService.class),\n                                     moduleUpdatedEvent,\n                                     moduleService,\n                                     mock(CommentedOptionFactory.class),\n                                     mock(PomEnhancer.class)) {\n            int index = 0;\n\n            @Override\n            public POM load(Path pomPath) {\n                return new POM(\"mymodule \" + index++,\n                               \"desctiption\",\n                               \"url\",\n                               new GAV());\n            }\n        };\n    }\n\n    @After\n    public void tearDown() throws Exception {\n        testFileSystem.tearDown();\n    }\n\n    @Test\n    public void whenProjectSubModulesEdited_UpdateModuleEventIsFired() throws Exception {\n\n        final Path path = testFileSystem.createTempFile(\"testproject/pom.xml\");\n        doReturn(true).when(ioService).exists(any());\n\n        final POM pom = new POM(\"newName\",\n                                \"desctiption\",\n                                \"url\",\n                                new GAV());\n        pom.setPackaging(\"pom\");\n        final ArrayList<String> modules = new ArrayList<>();\n        modules.add(\"module1\");\n        modules.add(\"module2\");\n        pom.setModules(modules);\n\n        service.save(path,\n                     pom,\n                     mock(Metadata.class),\n                     \"\",\n                     true);\n\n        verify(moduleUpdatedEvent, times(3)).fire(any());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/RepositoryResolverTestUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.File;\nimport java.io.FileOutputStream;\nimport java.io.IOException;\nimport java.nio.charset.StandardCharsets;\nimport java.nio.file.Files;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.maven.model.DeploymentRepository;\nimport org.apache.maven.model.DistributionManagement;\nimport org.apache.maven.project.MavenProject;\nimport org.apache.maven.settings.Server;\nimport org.apache.maven.settings.Settings;\nimport org.appformer.maven.integration.Aether;\nimport org.appformer.maven.integration.MavenRepository;\nimport org.appformer.maven.integration.embedder.MavenSettings;\nimport org.appformer.maven.support.AFReleaseId;\nimport org.appformer.maven.support.AFReleaseIdImpl;\nimport org.eclipse.aether.RepositorySystemSession;\nimport org.eclipse.aether.artifact.Artifact;\nimport org.eclipse.aether.artifact.DefaultArtifact;\nimport org.eclipse.aether.deployment.DeployRequest;\nimport org.eclipse.aether.deployment.DeploymentException;\nimport org.eclipse.aether.repository.Authentication;\nimport org.eclipse.aether.repository.RemoteRepository;\nimport org.eclipse.aether.repository.RepositoryPolicy;\nimport org.eclipse.aether.util.artifact.SubArtifact;\n\nimport static org.appformer.maven.integration.MavenRepository.toFileName;\n\npublic class RepositoryResolverTestUtils {\n\n    private static final String REPO_1 = \"<repository>\\n\" +\n            \"<id>jboss-snapshots-repository-group</id>\\n\" +\n            \"<name>JBoss.org Public Snapshots Repository Group</name>\\n\" +\n            \"<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>\\n\" +\n            \"</repository>\\n\";\n\n    private static final String REPO_2 = \"<repository>\\n\" +\n            \"<id>jboss-developer-repository-group</id>\\n\" +\n            \"<name>JBoss.org Developer Repository Group</name>\\n\" +\n            \"<url>https://repository.jboss.org/nexus/content/groups/developer/</url>\\n\" +\n            \"</repository>\\n\";\n\n    private static final String REPO_3 = \"<repository>\\n\" +\n            \"<id>jboss-public-repository-group</id>\\n\" +\n            \"<name>JBoss Public Repository Group</name>\\n\" +\n            \"<url>http://repository.jboss.org/nexus/content/groups/public/</url>\\n\" +\n            \"</repository>\\n\";\n\n    //This intentionally has the same \"id\" as REPO_3\n    //See https://bugzilla.redhat.com/show_bug.cgi?id=1319046\n    private static final String PLUGIN_REPO_1 = \"<pluginRepository>\\n\" +\n            \"<id>jboss-public-repository-group</id>\\n\" +\n            \"<name>JBoss Public Repository Group</name>\\n\" +\n            \"<url>https://repository.jboss.org/nexus/content/repositories/snapshots/</url>\\n\" +\n            \"</pluginRepository>\\n\";\n\n    /**\n     * Install a Maven Project to the local Maven Repository\n     * @param mavenProject\n     * @param pomXml\n     */\n    public static void installArtifact(final MavenProject mavenProject,\n                                       final String pomXml) {\n        final AFReleaseId releaseId = new AFReleaseIdImpl(mavenProject.getGroupId(),\n                                                          mavenProject.getArtifactId(),\n                                                          mavenProject.getVersion());\n\n        final Aether aether = new Aether(mavenProject);\n        final MavenRepository mavenRepository = new MavenRepository(aether) {\n            //Nothing to override, just a sub-class to expose Constructor\n        };\n\n        mavenRepository.installArtifact(releaseId,\n                                        \"content\".getBytes(),\n                                        pomXml.getBytes());\n    }\n\n    /**\n     * Deploy a Maven Project to the 'Remote' Maven Repository defined in the Project's {code}<distribtionManagement>{code} section.\n     * @param mavenProject\n     * @param pomXml\n     */\n    public static void deployArtifact(final MavenProject mavenProject,\n                                      final String pomXml) {\n        final AFReleaseId releaseId = new AFReleaseIdImpl(mavenProject.getGroupId(),\n                                                          mavenProject.getArtifactId(),\n                                                          mavenProject.getVersion());\n\n        //Create temporary files for the JAR and POM\n        final Aether aether = new Aether(mavenProject);\n        final File jarFile = new File(System.getProperty(\"java.io.tmpdir\"),\n                                      toFileName(releaseId,\n                                                 null) + \".jar\");\n        try {\n            FileOutputStream fos = new FileOutputStream(jarFile);\n            fos.write(\"content\".getBytes());\n            fos.flush();\n            fos.close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n        final File pomFile = new File(System.getProperty(\"java.io.tmpdir\"),\n                                      toFileName(releaseId,\n                                                 null) + \".pom\");\n        try {\n            FileOutputStream fos = new FileOutputStream(pomFile);\n            fos.write(pomXml.getBytes());\n            fos.flush();\n            fos.close();\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n\n        //Artifact representing the JAR\n        Artifact jarArtifact = new DefaultArtifact(releaseId.getGroupId(),\n                                                   releaseId.getArtifactId(),\n                                                   \"jar\",\n                                                   releaseId.getVersion());\n        jarArtifact = jarArtifact.setFile(jarFile);\n\n        //Artifact representing the POM\n        Artifact pomArtifact = new SubArtifact(jarArtifact,\n                                               \"\",\n                                               \"pom\");\n        pomArtifact = pomArtifact.setFile(pomFile);\n\n        //Read <distributionManagement> section\n        final DistributionManagement distributionManagement = mavenProject.getDistributionManagement();\n        if (distributionManagement != null) {\n            final DeployRequest deployRequest = new DeployRequest();\n            deployRequest\n                    .addArtifact(jarArtifact)\n                    .addArtifact(pomArtifact)\n                    .setRepository(getRemoteRepoFromDeployment(distributionManagement.getRepository(),\n                                                               aether.getSession()));\n\n            try {\n                aether.getSystem().deploy(aether.getSession(),\n                                          deployRequest);\n            } catch (DeploymentException e) {\n                throw new RuntimeException(e);\n            }\n        }\n    }\n\n    //Convert a DeploymentRepository to a RemoteRepository\n    private static RemoteRepository getRemoteRepoFromDeployment(final DeploymentRepository deploymentRepository,\n                                                                final RepositorySystemSession mavenSession) {\n        final RemoteRepository.Builder remoteRepoBuilder = new RemoteRepository.Builder(deploymentRepository.getId(),\n                                                                                        deploymentRepository.getLayout(),\n                                                                                        deploymentRepository.getUrl())\n                .setSnapshotPolicy(new RepositoryPolicy(true,\n                                                        RepositoryPolicy.UPDATE_POLICY_DAILY,\n                                                        RepositoryPolicy.CHECKSUM_POLICY_WARN))\n                .setReleasePolicy(new RepositoryPolicy(true,\n                                                       RepositoryPolicy.UPDATE_POLICY_DAILY,\n                                                       RepositoryPolicy.CHECKSUM_POLICY_WARN));\n\n        final Settings settings = MavenSettings.getSettings();\n        final Server server = settings.getServer(deploymentRepository.getId());\n\n        if (server != null) {\n            final Authentication authentication = mavenSession\n                    .getAuthenticationSelector()\n                    .getAuthentication(remoteRepoBuilder.build());\n            remoteRepoBuilder.setAuthentication(authentication);\n        }\n\n        return remoteRepoBuilder.build();\n    }\n\n    /**\n     * Generate a temporary settings.xml file.\n     * @param m2Folder\n     * @return\n     * @throws IOException\n     */\n    public static java.nio.file.Path generateSettingsXml(final java.nio.file.Path m2Folder) throws IOException {\n        final java.nio.file.Path settingsXmlPath = Files.createTempFile(m2Folder,\n                                                                        \"settings\",\n                                                                        \".xml\");\n\n        final List<String> settingsXmlLines = new ArrayList<String>();\n        final List<String> additionalRepositories = new ArrayList<String>() {{\n            add(REPO_1);\n            add(REPO_2);\n            add(REPO_3);\n        }};\n        settingsXmlLines.add(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\");\n        settingsXmlLines.add(\"<settings>\\n\");\n        settingsXmlLines.add(\"  <localRepository>\" + m2Folder.toString() + \"</localRepository>\\n\");\n        if (additionalRepositories.size() > 0) {\n            settingsXmlLines.add(\"  <profiles>\\n\");\n            settingsXmlLines.add(\"    <profile>\\n\");\n            settingsXmlLines.add(\"      <id>standard-extra-repos</id>\\n\");\n            settingsXmlLines.add(\"      <activation>\\n\");\n            settingsXmlLines.add(\"        <activeByDefault>true</activeByDefault>\\n\");\n            settingsXmlLines.add(\"      </activation>\\n\");\n            settingsXmlLines.add(\"      <repositories>\\n\");\n            settingsXmlLines.addAll(additionalRepositories);\n            settingsXmlLines.add(\"      </repositories>\\n\");\n            settingsXmlLines.add(\"      <pluginRepositories>\\n\");\n            settingsXmlLines.add(PLUGIN_REPO_1);\n            settingsXmlLines.add(\"        </pluginRepositories>\\n\");\n            settingsXmlLines.add(\"    </profile>\\n\");\n            settingsXmlLines.add(\"  </profiles>\\n\");\n        }\n        settingsXmlLines.add(\"</settings>\");\n\n        Files.write(settingsXmlPath,\n                    settingsXmlLines,\n                    StandardCharsets.UTF_8);\n\n        return settingsXmlPath;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/ResourceResolverResolvePackagesTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashSet;\nimport java.util.Objects;\nimport java.util.Set;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.mocks.FileSystemTestingUtils;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.fail;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ResourceResolverResolvePackagesTest {\n\n    private static FileSystemTestingUtils fsUtils = new FileSystemTestingUtils();\n\n    @Mock\n    private POMService pomService;\n    @Mock\n    private CommentedOptionFactory commentedOptionFactory;\n    @Mock\n    private Instance<ModuleResourcePathResolver> resourcePathResolversInstance;\n\n    private Module module;\n    private ResourceResolver resourceResolver;\n\n    @Before\n    public void setUp() throws IOException {\n        fsUtils.setup(false);\n\n        Path root = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test\"));\n        Path pomPath = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test/pom.xml\"));\n        Path mainJava = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test/src/main/java/org/test/.keep\"));\n        Path mainResource = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test/src/main/resources/org/test/.keep\"));\n        Path testJava = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test/src/test/java/org/test/.keep\"));\n        Path testResource = fsUtils.getIoService().get(URI.create(\"git://amend-repo-test/src/test/resources/org/test/.keep\"));\n\n        fsUtils.getIoService().write(pomPath,\n                                     \"\");\n        fsUtils.getIoService().write(mainJava,\n                                     \"\");\n        fsUtils.getIoService().write(mainResource,\n                                     \"\");\n        fsUtils.getIoService().write(testJava,\n                                     \"\");\n        fsUtils.getIoService().write(testResource,\n                                     \"\");\n\n        module = new Module(Paths.convert(root),\n                            Paths.convert(pomPath));\n\n        resourceResolver = new ResourceResolver(fsUtils.getIoService(),\n                                                pomService,\n                                                commentedOptionFactory,\n                                                resourcePathResolversInstance) {\n\n            @Override\n            public Module resolveModule(final org.uberfire.backend.vfs.Path resource,\n                                        final boolean loadPOM) {\n                return module;\n            }\n\n            @Override\n            public Module simpleModuleInstance(final Path nioModuleRootPath) {\n                return null;\n            }\n        };\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fsUtils.cleanup();\n    }\n\n    @Test\n    public void testResolvePackages() {\n\n        final Set<Package> packages = resourceResolver.resolvePackages(module);\n\n        assertEquals(3, packages.size());\n        assertContains(\"\", packages);\n        assertContains(\"org\", packages);\n        assertContains(\"org.test\", packages);\n    }\n\n    @Test\n    public void testResolvePackagesWithPackageNames() {\n\n        final HashSet<String> packageNames = new HashSet<>();\n        packageNames.add(\"\");\n        packageNames.add(\"org\");\n        packageNames.add(\"org.test\");\n\n        final Set packages = resourceResolver.resolvePackages(module,\n                                                              packageNames);\n\n        assertEquals(3, packages.size());\n        assertContains(\"\", packages);\n        assertContains(\"org\", packages);\n        assertContains(\"org.test\", packages);\n    }\n\n    @Test\n    public void testResolvePackagesWithPackageNamesEmpty() {\n\n        final Set packages = resourceResolver.resolvePackages(module,\n                                                              new HashSet<>());\n        assertEquals(0, packages.size());\n    }\n\n    @Test\n    public void testResolvePackagesWhenModuleNull() {\n\n        final Set packages = resourceResolver.resolvePackages(null,\n                                                              new HashSet<>());\n        assertEquals(0, packages.size());\n    }\n\n    private void assertContains(final String pkgName,\n                                final Set<Package> packages) {\n        for (Package aPackage : packages) {\n            if (Objects.equals(aPackage.getPackageName(), pkgName)) {\n                return;\n            }\n        }\n        fail(\"Could not find package \" + pkgName);\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/TestAppSetup.java",
    "content": "/*\n* Copyright 2012 Red Hat, Inc. and/or its affiliates.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*       http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.annotation.Priority;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Named;\nimport javax.servlet.ServletContext;\n\nimport org.guvnor.m2repo.service.M2RepoService;\n\nimport static org.mockito.Mockito.*;\n\n@ApplicationScoped\n@Priority(1) // needed in order to inject the @Alternatives outside of this bean bundle (aka maven module)\npublic class TestAppSetup {\n\n    @Produces\n    @Alternative\n    public M2RepoService m2RepoService() {\n        return mock(M2RepoService.class);\n    }\n\n    @Produces\n    @Alternative\n    @Named(\"uf\")\n    public ServletContext servletContext() {\n        return mock(ServletContext.class);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/TestProjectService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.enterprise.inject.Produces;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.project.ModuleFactory;\nimport org.guvnor.common.services.project.service.ModuleService;\n\nimport static org.mockito.Mockito.*;\n\n@ApplicationScoped\npublic class TestProjectService {\n\n    @Produces\n    @Alternative\n    public ModuleService<MockModule> moduleService() {\n        return new ModuleServiceMock();\n    }\n\n    @Produces\n    @Alternative\n    public ModuleFactory<Module> projectProjectFactory() {\n        return mock(ModuleFactory.class);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectMigrationServiceImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.events.NewProjectEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class WorkspaceProjectMigrationServiceImplTest {\n\n    private static final String NIOGIT_PATH = \"/home/someone/somehwere/.niogit\";\n\n    private static final String SPACE = \"testspace\";\n\n    private static final String REPO = \"testrepo\";\n\n    private WorkspaceProjectMigrationServiceImpl service;\n\n    @Mock\n    private ModuleService<?> moduleService;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private EventSourceMock<NewProjectEvent> newProjectEvent;\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private Path legacyMainBranchProject1RootPath;\n\n    @Mock\n    private Path legacyDevBranchProject1RootPath;\n\n    @Mock\n    private Path legacyDevBranchProject2RootPath;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    private OrganizationalUnit organizationalUnit;\n\n    @Mock\n    private PathUtil pathUtil;\n\n    @Mock\n    private WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    private Space space;\n\n    @Mock\n    private SpaceConfigStorage spaceConfigStorage;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Captor\n    private ArgumentCaptor<NewProjectEvent> newProjectEventArgumentCaptor;\n\n    @Captor\n    private ArgumentCaptor<RepositoryEnvironmentConfigurations> configsCaptor;\n\n    private Branch legacyMainBranch;\n    private Branch legacyDevBranch;\n\n    @Before\n    public void setUp() throws Exception {\n\n        SpaceInfo spaceInfo = mock(SpaceInfo.class);\n        doAnswer(invocation -> null).when(spaceInfo).removeRepository(any());\n        doAnswer(invocation -> null).when(spaceInfo).getRepositories(any());\n        doReturn(spaceInfo).when(spaceConfigStorage).loadSpaceInfo();\n        when(spaceConfigStorageRegistry.get(any())).thenReturn(spaceConfigStorage);\n\n        doReturn(mock(WorkspaceProject.class)).when(workspaceProjectService).resolveProject(Mockito.<Repository>any());\n\n        doAnswer((Answer<org.uberfire.java.nio.file.Path>) invocationOnMock ->\n                Paths.convert(PathFactory.newPath(\"file\",\n                                                  invocationOnMock.getArguments()[0].toString()))).when(ioService).get(any());\n\n        when(pathUtil.normalizePath(any())).then(inv -> inv.getArgument(0,\n                                                                          Path.class));\n        when(pathUtil.convert(Mockito.<Path>any())).then(inv -> {\n            final Path path = inv.getArgument(0,\n                                                Path.class);\n\n            final org.uberfire.java.nio.file.Path retVal = mock(org.uberfire.java.nio.file.Path.class);\n            when(retVal.toUri()).then(inv1 -> URI.create(path.toURI()));\n\n            return retVal;\n        });\n        when(pathUtil.getNiogitRepoPath(any())).thenReturn(NIOGIT_PATH);\n\n        service = spy(new WorkspaceProjectMigrationServiceImpl(workspaceProjectService,\n                                                               repositoryService,\n                                                               organizationalUnitService,\n                                                               pathUtil,\n                                                               newProjectEvent,\n                                                               moduleService,\n                                                               spaceConfigStorageRegistry));\n\n        doAnswer(invocation -> null).when(service).cleanupOrigin(any());\n\n        legacyMainBranch = mockBranch(\"legacyMainBranch\");\n        legacyDevBranch = mockBranch(\"legacyDevBranch\");\n\n        when(legacyDevBranchProject1RootPath.toURI()).thenReturn(uri(\"legacyDevBranch\",\n                                                                     \"legacyProject1\"));\n        when(legacyDevBranchProject2RootPath.toURI()).thenReturn(uri(\"legacyDevBranch\",\n                                                                     \"legacyProject2\"));\n        when(legacyMainBranchProject1RootPath.toURI()).thenReturn(uri(\"legacyMainBranch\",\n                                                                        \"legacyProject1\"));\n\n        final Repository legacyRepository = mockLegacyRepository();\n\n        doReturn(new Space(\"space\")).when(organizationalUnit).getSpace();\n        final WorkspaceProject legacyWorkspaceProject = new WorkspaceProject(organizationalUnit,\n                                                                             legacyRepository,\n                                                                             legacyMainBranch,\n                                                                             null);\n\n        setUpMainBranch();\n        setUpDevBranch();\n\n        mockRepository(organizationalUnit);\n\n        service.migrate(legacyWorkspaceProject);\n    }\n\n    private String uri(final String branch,\n                       final String repo) {\n        return \"git://\" + branch + \"@\" + SPACE + \"/\" + REPO + \"/\" + repo;\n    }\n\n    @Test\n    public void createOnlyTwoRepositories() throws Exception {\n\n        verify(repositoryService,\n               times(2)).createRepository(any(OrganizationalUnit.class),\n                                          eq(GitRepository.SCHEME.toString()),\n                                          anyString(),\n                                          configsCaptor.capture());\n        final List<RepositoryEnvironmentConfigurations> allValues = configsCaptor.getAllValues();\n        final Set<String> observedSubdirectories = new HashSet<>();\n        allValues.forEach(configs -> {\n            assertEquals(NIOGIT_PATH,\n                         assertInstanceOf(configs.getOrigin(),\n                                          String.class));\n            assertFalse(assertInstanceOf(configs.getInit(),\n                                         Boolean.class));\n            assertFalse(assertInstanceOf(configs.getMirror(),\n                                         Boolean.class));\n\n            final String subdirectory = assertInstanceOf(configs.getSubdirectory(),\n                                                         String.class);\n            observedSubdirectories.add(subdirectory);\n\n            @SuppressWarnings(\"unchecked\")\n            final List<String> branches = assertInstanceOf(configs.getBranches(),\n                                                           List.class);\n            final List<String> expectedBranches;\n            if (subdirectory.equals(\"legacyProject1\")) {\n                expectedBranches = Arrays.asList(\"legacyMainBranch\",\n                                                 \"legacyDevBranch\");\n            } else if (subdirectory.equals(\"legacyProject2\")) {\n                expectedBranches = Arrays.asList(\"legacyDevBranch\");\n            } else {\n                throw new AssertionError(\"Unrecognized subdirectory: \" + subdirectory);\n            }\n\n            verify(service,\n                   times(2)).cleanupOrigin(any());\n\n            assertEquals(\"Unexpected branches for subdirectory \" + subdirectory,\n                         new HashSet<>(expectedBranches),\n                         new HashSet<>(branches));\n        });\n\n        assertEquals(new HashSet<>(Arrays.asList(\"legacyProject1\",\n                                                 \"legacyProject2\")),\n                     observedSubdirectories);\n    }\n\n    @Test\n    public void fireNewProjectEvents() throws Exception {\n        verify(newProjectEvent,\n               times(2)).fire(newProjectEventArgumentCaptor.capture());\n\n        final List<NewProjectEvent> allValues = newProjectEventArgumentCaptor.getAllValues();\n\n        assertNotNull(allValues.get(0).getWorkspaceProject());\n        assertNotNull(allValues.get(1).getWorkspaceProject());\n    }\n\n    private <T> T assertInstanceOf(Object value,\n                                   Class<T> clazz) {\n        assertTrue(clazz.isInstance(value));\n\n        return clazz.cast(value);\n    }\n\n    private void setUpDevBranch() {\n        final HashSet<Module> devBranchModules = new HashSet<>();\n\n        final Module mockModule = mockModule(\"legacyProject1\",\n                                             legacyDevBranchProject1RootPath);\n        devBranchModules.add(mockModule);\n        final Module mockModule2 = mockModule(\"legacyProject2\",\n                                              legacyDevBranchProject2RootPath);\n        devBranchModules.add(mockModule2);\n\n        doReturn(devBranchModules).when(moduleService).getAllModules(legacyDevBranch);\n    }\n\n    private void setUpMainBranch() {\n        final HashSet<Module> mainBranchModules = new HashSet<>();\n\n        final Module mockModule = mockModule(\"legacyProject1\",\n                                             legacyMainBranchProject1RootPath);\n        mainBranchModules.add(mockModule);\n\n        doReturn(mainBranchModules).when(moduleService).getAllModules(legacyMainBranch);\n        final Path mainRoot = mock(Path.class);\n        when(legacyMainBranch.getPath()).thenReturn(mainRoot);\n    }\n\n    private Branch mockBranch(final String branchName) {\n        final Branch mainBranch = mock(Branch.class);\n        doReturn(branchName).when(mainBranch).getName();\n        return mainBranch;\n    }\n\n    private Repository mockLegacyRepository() {\n        final Repository legacyRepository = mock(Repository.class);\n        final ArrayList<Branch> branches = new ArrayList<>();\n        branches.add(legacyMainBranch);\n        branches.add(legacyDevBranch);\n        doReturn(branches).when(legacyRepository).getBranches();\n\n        final ArrayList<OrganizationalUnit> ous = new ArrayList<>();\n        ous.add(organizationalUnit);\n        doReturn(ous).when(organizationalUnitService).getOrganizationalUnits(legacyRepository);\n\n        when(legacyRepository.getDefaultBranch()).thenReturn(Optional.of(legacyMainBranch));\n\n        doReturn(space).when(legacyRepository).getSpace();\n\n        return legacyRepository;\n    }\n\n    private void mockRepository(final OrganizationalUnit organizationalUnit) {\n        doAnswer(new Answer<Repository>() {\n            @Override\n            public Repository answer(InvocationOnMock invocationOnMock) throws Throwable {\n                final Repository newRepository = mock(Repository.class);\n                doReturn(invocationOnMock.getArguments()[2]).when(newRepository).getAlias();\n                doReturn(SpacesAPI.Scheme.FILE).when(newRepository).getScheme();\n                doReturn(space).when(newRepository).getSpace();\n                return newRepository;\n            }\n        }).when(repositoryService).createRepository(eq(organizationalUnit),\n                                                    eq(GitRepository.SCHEME.toString()),\n                                                    anyString(),\n                                                    any(RepositoryEnvironmentConfigurations.class));\n    }\n\n    private Module mockModule(final String myOldProject,\n                              final Path myOldProjectRootPath) {\n        final Module module = mock(Module.class);\n        when(module.getModuleName()).thenReturn(myOldProject);\n        when(module.getRootPath()).thenReturn(myOldProjectRootPath);\n        return module;\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectServiceImplNewWorkspaceWorkspaceProjectTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.io.File;\nimport java.util.Optional;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.events.NewProjectEvent;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.common.services.shared.exceptions.GenericPortableException;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceProjectServiceImplNewWorkspaceWorkspaceProjectTest {\n\n    WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    RepositoryService repositoryService;\n    @Mock\n    Instance<ModuleService<? extends Module>> moduleServices;\n\n    @Mock\n    ModuleService moduleService;\n\n    @Mock\n    private OrganizationalUnit ou;\n\n    @Mock\n    private Space space;\n\n    @Mock\n    private Repository repository;\n\n    @Mock\n    private Path repositoryRoot;\n\n    @Mock\n    private Branch branch;\n\n    @Mock\n    private EventSourceMock<NewProjectEvent> newProjectEvent;\n\n    @Mock\n    private Module module;\n\n    @Mock\n    private SpacesAPI spaces;\n\n    @Mock\n    private ModuleRepositoryResolver repositoryResolver;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    private SpaceConfigStorage spaceConfigStorage;\n\n    @Mock\n    IOService ioService;\n\n    @Mock\n    PathUtil pathUtil;\n\n    @Mock\n    ChangeRequestService changeRequestService;\n\n    @Mock\n    POMService pomService;\n\n    @Mock\n    SessionInfo sessionInfo;\n\n    private POM pom;\n\n    @Before\n    public void setUp() throws Exception {\n\n        doReturn(Optional.of(branch)).when(repository).getDefaultBranch();\n        doReturn(repositoryRoot).when(branch).getPath();\n\n        pom = createPOM(\"my project\");\n\n        when(ou.getSpace()).thenReturn(space);\n        when(space.getName()).thenReturn(\"ou\");\n\n        when(repositoryService.createRepository(any(),\n                                           anyString(),\n                                           anyString(),\n                                           any(),\n                                           any())).thenReturn(repository);\n\n        doReturn(moduleService).when(moduleServices).get();\n\n        when(spaceConfigStorageRegistry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n\n        workspaceProjectService = new WorkspaceProjectServiceImpl(mock(OrganizationalUnitService.class),\n                                                                  repositoryService,\n                                                                  spaces,\n                                                                  newProjectEvent,\n                                                                  new EventSourceMock<>(),\n                                                                  new EventSourceMock<>(),\n                                                                  moduleServices,\n                                                                  repositoryResolver,\n                                                                  ioService,\n                                                                  spaceConfigStorageRegistry,\n                                                                  pathUtil,\n                                                                  changeRequestService,\n                                                                  pomService);\n    }\n\n    @Test\n    public void newProjectDefault() throws Exception {\n\n        doReturn(module).when(moduleService).newModule(eq(repositoryRoot),\n                                                       eq(pom),\n                                                       eq(DeploymentMode.VALIDATED));\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.newProject(ou,\n                                                                                     pom);\n        assertProject(workspaceProject);\n        verify(newProjectEvent).fire(any());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(repositoryService).createRepository(eq(ou),\n                                                   eq(\"git\"),\n                                                   eq(\"myproject\"),\n                                                   any(),\n                                                   any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void newProjectFromTemplateTest() {\n        final WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) spy(this.workspaceProjectService);\n\n        final Repository templateRepository = mock(Repository.class);\n        final Branch templateRepositoryBranch = mock(Branch.class);\n        doReturn(Optional.of(templateRepositoryBranch)).when(templateRepository).getDefaultBranch();\n        doReturn(repositoryRoot).when(templateRepositoryBranch).getPath();\n\n        final JGitPathImpl nioPath = mock(JGitPathImpl.class);\n        final JGitFileSystem fs = mock(JGitFileSystem.class);\n        final Git git = mock(Git.class);\n        doNothing().when(git).removeRemote(anyString(),\n                                           anyString());\n        doReturn(git).when(fs).getGit();\n        doReturn(fs).when(nioPath).getFileSystem();\n        doReturn(nioPath).when(pathUtil).convert(any(Path.class));\n\n        final org.eclipse.jgit.lib.Repository gitRepository = mock(org.eclipse.jgit.lib.Repository.class);\n        final File repositoryDirectory = new File(\"repositoryDirectory\");\n        doReturn(repositoryDirectory).when(gitRepository).getDirectory();\n        doReturn(gitRepository).when(git).getRepository();\n\n        final Path pomPath = mock(Path.class);\n        doReturn(pomPath).when(impl).resolvePathFromParent(any(Path.class),\n                                                           eq(POMServiceImpl.POM_XML));\n\n        final POM templatePom = createPOM(\"my template\");\n        doReturn(templatePom).when(pomService).load(pomPath);\n\n        doNothing().when(moduleService).createModuleDirectories(any(Path.class));\n        doReturn(module).when(moduleService).resolveModule(any(Path.class));\n\n        final Path branchRoot = PathFactory.newPath(\"testFile\",\n                                                    \"file:///branchRoot/\");\n        doReturn(branchRoot).when(branch).getPath();\n\n        final WorkspaceProject workspaceProject = impl.newProject(ou,\n                                                                  pom,\n                                                                  DeploymentMode.VALIDATED,\n                                                                  null,\n                                                                  templateRepository);\n\n        assertProject(workspaceProject);\n        verify(newProjectEvent).fire(any());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(repositoryService).createRepository(eq(ou),\n                                                   eq(\"git\"),\n                                                   eq(\"myproject\"),\n                                                   any(),\n                                                   any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void newProjectFromTemplateWithRemoteUrlTest() {\n        final String remoteUrl = \"myUrl\";\n        final WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) spy(this.workspaceProjectService);\n\n        final Repository templateRepository = mock(Repository.class);\n        final Branch templateRepositoryBranch = mock(Branch.class);\n        doReturn(Optional.of(templateRepositoryBranch)).when(templateRepository).getDefaultBranch();\n        doReturn(repositoryRoot).when(templateRepositoryBranch).getPath();\n\n        final JGitPathImpl nioPath = mock(JGitPathImpl.class);\n        final JGitFileSystem fs = mock(JGitFileSystem.class);\n        final JGitFileSystemProvider provider = mock(JGitFileSystemProvider.class);\n        final Git git = mock(Git.class);\n        doNothing().when(git).removeRemote(anyString(),\n                                           anyString());\n        doNothing().when(git).addRemote(anyString(),\n                                        anyString());\n        doReturn(git).when(fs).getGit();\n        doReturn(fs).when(nioPath).getFileSystem();\n        doReturn(provider).when(fs).provider();\n        doNothing().when(provider).executePostCommitHook(fs);\n        doReturn(nioPath).when(pathUtil).convert(any(Path.class));\n\n        final org.eclipse.jgit.lib.Repository gitRepository = mock(org.eclipse.jgit.lib.Repository.class);\n        final File repositoryDirectory = new File(\"repositoryDirectory\");\n        doReturn(repositoryDirectory).when(gitRepository).getDirectory();\n        doReturn(gitRepository).when(git).getRepository();\n\n        final Path pomPath = mock(Path.class);\n        doReturn(pomPath).when(impl).resolvePathFromParent(any(Path.class),\n                                                           eq(POMServiceImpl.POM_XML));\n\n        final POM templatePom = createPOM(\"my template\");\n        doReturn(templatePom).when(pomService).load(pomPath);\n\n        doNothing().when(moduleService).createModuleDirectories(any(Path.class));\n        doReturn(module).when(moduleService).resolveModule(any(Path.class));\n\n        final Path branchRoot = PathFactory.newPath(\"testFile\",\n                                                    \"file:///branchRoot/\");\n        doReturn(branchRoot).when(branch).getPath();\n\n        final WorkspaceProject workspaceProject = impl.newProject(ou,\n                                                                  pom,\n                                                                  DeploymentMode.VALIDATED,\n                                                                  null,\n                                                                  templateRepository,\n                                                                  remoteUrl);\n\n        assertProject(workspaceProject);\n        verify(newProjectEvent).fire(any());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(repositoryService).createRepository(eq(ou),\n                                                   eq(\"git\"),\n                                                   eq(\"myproject\"),\n                                                   any(),\n                                                   any());\n        verify(spaceConfigStorage).endBatch();\n        verify(provider).executePostCommitHook(fs);\n        verify(git).addRemote(anyString(),\n                              eq(remoteUrl));\n    }\n\n    @Test\n    public void newProjectValidated() throws Exception {\n\n        doReturn(module).when(moduleService).newModule(eq(repositoryRoot),\n                                                       eq(pom),\n                                                       eq(DeploymentMode.VALIDATED));\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.newProject(ou,\n                                                                                     pom,\n                                                                                     DeploymentMode.VALIDATED);\n        assertProject(workspaceProject);\n        verify(newProjectEvent).fire(any());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(repositoryService).createRepository(eq(ou),\n                                                   eq(\"git\"),\n                                                   eq(\"myproject\"),\n                                                   any(),\n                                                   any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void testNewProjectErrorRepositoryWithoutDefaultBranch() {\n        when(repository.getDefaultBranch()).thenReturn(Optional.empty());\n\n        testNewProjectError(GenericPortableException.class, \"New repository should always have a branch.\");\n    }\n\n\n    @Test\n    public void testNewProjectErrorCreatingModule() {\n        final String errorMessage = \"Impossible to create module\";\n\n        doThrow(new IllegalStateException(errorMessage)).when(moduleService).newModule(any(), any(), any());\n\n        testNewProjectError(GenericPortableException.class, errorMessage);\n    }\n\n    private void testNewProjectError(final Class<? extends Exception> expectedExceptionType, final String expectedMessage) {\n        Assertions.assertThatThrownBy(() -> workspaceProjectService.newProject(ou, pom))\n                .isInstanceOf(expectedExceptionType)\n                .hasMessage(expectedMessage);\n\n        verify(repositoryService).removeRepository(any(), any());\n        verify(newProjectEvent, never()).fire(any());\n    }\n\n    @Test\n    public void newProjectForced() throws Exception {\n        doReturn(module).when(moduleService).newModule(eq(repositoryRoot),\n                                                       eq(pom),\n                                                       eq(DeploymentMode.FORCED));\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.newProject(ou,\n                                                                                     pom,\n                                                                                     DeploymentMode.FORCED);\n        assertProject(workspaceProject);\n        verify(newProjectEvent).fire(any());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(repositoryService).createRepository(eq(ou),\n                                           eq(\"git\"),\n                                           eq(\"myproject\"),\n                                           any(),\n                                           any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    private void assertProject(final WorkspaceProject workspaceProject) {\n        assertEquals(ou,\n                     workspaceProject.getOrganizationalUnit());\n        assertEquals(repository,\n                     workspaceProject.getRepository());\n        assertEquals(branch,\n                     workspaceProject.getBranch());\n        assertEquals(module,\n                     workspaceProject.getMainModule());\n    }\n\n    private POM createPOM(final String name) {\n        return new POM(name,\n                       \"my description\",\n                       \"url\",\n                       new GAV(\"groupId\",\n                               \"artifactId\",\n                               \"version\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectServiceImplResolveWorkspaceWorkspaceProjectTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\nimport java.net.URI;\nimport java.util.HashMap;\nimport java.util.Optional;\nimport java.util.Date;\nimport java.util.Arrays;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceProjectServiceImplResolveWorkspaceWorkspaceProjectTest {\n\n    WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    RepositoryService repositoryService;\n\n    @Mock\n    Instance<ModuleService<? extends Module>> moduleServices;\n\n    @Mock\n    ModuleService moduleService;\n\n    @Mock\n    OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    OrganizationalUnit ou;\n\n    @Mock\n    Repository repository;\n\n    @Mock\n    SpacesAPI spaces;\n\n    @Mock\n    Branch branch;\n\n    @Mock\n    Module module;\n\n    @Mock\n    ModuleRepositoryResolver repositoryResolver;\n\n    @Mock\n    SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    SpaceConfigStorage spaceConfigStorage;\n\n    @Mock\n    PathUtil pathUtil;\n\n    @Mock\n    ChangeRequestService changeRequestService;\n\n    @Mock\n    POMService pomService;\n\n    @Mock\n    SessionInfo sessionInfo;\n\n    private Path path;\n    private Path branchRoot;\n    private Branch mainBranch;\n    private IOService ioService;\n    private Space space;\n\n    @Before\n    public void setUp() throws Exception {\n        ioService = new IOServiceDotFileImpl();\n\n        path = PathFactory.newPath(\"testFile\",\n                                   \"file:///files/TestDataObject.java\");\n        branchRoot = PathFactory.newPath(\"testFile\",\n                                         \"file:///branchRoot/\");\n        space = new Space(\"test-realm\");\n\n        doReturn(space.getName()).when(ou).getName();\n        doReturn(ou).when(organizationalUnitService).getOrganizationalUnit(space.getName());\n\n        doReturn(Optional.of(branch)).when(repository).getDefaultBranch();\n        doReturn(branchRoot).when(branch).getPath();\n\n        doReturn(repository).when(repositoryService).getRepository(Mockito.eq(space), any(Path.class));\n        doReturn(space).when(repository).getSpace();\n\n        doReturn(module).when(moduleService).resolveModule(any());\n\n        mainBranch = new Branch(\"main\",\n                                  path);\n\n        doReturn(moduleService).when(moduleServices).get();\n\n        workspaceProjectService = new WorkspaceProjectServiceImpl(organizationalUnitService,\n                                                                  repositoryService,\n                                                                  spaces,\n                                                                  new EventSourceMock<>(),\n                                                                  new EventSourceMock<>(),\n                                                                  new EventSourceMock<>(),\n                                                                  moduleServices,\n                                                                  repositoryResolver,\n                                                                  ioService,\n                                                                  spaceConfigStorageRegistry,\n                                                                  pathUtil,\n                                                                  changeRequestService,\n                                                                  pomService);\n    }\n\n    @Test\n    public void resolveProjectPath() throws Exception {\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space, path);\n\n        assertEquals(ou,\n                     workspaceProject.getOrganizationalUnit());\n        assertEquals(repository,\n                     workspaceProject.getRepository());\n        assertEquals(branch,\n                     workspaceProject.getBranch());\n        assertEquals(module,\n                     workspaceProject.getMainModule());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void resolveProjectPathOfInexistentRepository() throws Exception {\n        doReturn(null).when(repositoryService).getRepository(Mockito.eq(space), any(Path.class));\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space, path);\n    }\n\n    @Test\n    public void resolveProjectModule() throws Exception {\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space,\n                                                                                         new Module(path,\n                                                                                                    mock(Path.class),\n                                                                                                    mock(POM.class)));\n\n        assertEquals(ou,\n                     workspaceProject.getOrganizationalUnit());\n        assertEquals(repository,\n                     workspaceProject.getRepository());\n        assertEquals(branch,\n                     workspaceProject.getBranch());\n        assertEquals(module,\n                     workspaceProject.getMainModule());\n    }\n\n    @Test\n    public void resolveProjectRepository() throws Exception {\n\n        final GitRepository repository = new GitRepository(\"alias\", space);\n        final HashMap<String, Branch> branches = new HashMap<>();\n        branches.put(\"main\", new Branch(\"main\",\n                                          path));\n\n        repository.setBranches(branches);\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(repository);\n\n        assertEquals(ou,\n                     workspaceProject.getOrganizationalUnit());\n        assertEquals(this.repository,\n                     workspaceProject.getRepository());\n        assertEquals(branch,\n                     workspaceProject.getBranch());\n        assertEquals(module,\n                     workspaceProject.getMainModule());\n    }\n\n    @Test\n    public void resolveProjectBranch() throws Exception {\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space, mainBranch);\n\n        assertEquals(ou,\n                     workspaceProject.getOrganizationalUnit());\n        assertEquals(this.repository,\n                     workspaceProject.getRepository());\n        assertEquals(branch,\n                     workspaceProject.getBranch());\n        assertEquals(module,\n                     workspaceProject.getMainModule());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void resolveNullProjectAndNullBranch() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                null,\n                null);\n\n        assertNull(workspaceProject);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void resolveNonExistingProject() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                \"project7\",\n                null);\n    }\n\n    @Test\n    public void resolveProjectAndNullBranch() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                \"project2\",\n                null);\n\n        assertNotNull(workspaceProject);\n        assertNotNull(workspaceProject.getBranch());\n        assertEquals(\"main\", workspaceProject.getBranch().getName());\n        assertNotNull(workspaceProject.getMainModule());\n    }\n\n    @Test\n    public void resolveProjectAndMainBranch() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                \"project2\",\n                \"main\");\n\n        assertNotNull(workspaceProject);\n        assertNotNull(workspaceProject.getBranch());\n        assertEquals(\"main\", workspaceProject.getBranch().getName());\n        assertNotNull(workspaceProject.getMainModule());\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void resolveProjectAndNonExistingBranch() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                \"project2\",\n                \"branch7\");\n\n        assertNotNull(workspaceProject);\n        assertNotNull(workspaceProject.getBranch());\n        assertEquals(\"main\", workspaceProject.getBranch().getName());\n        assertNull(workspaceProject.getMainModule());\n    }\n\n    @Test\n    public void resolveProjectAndBranch() {\n        mockRepositoriesAndBranches();\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                space,\n                \"project2\",\n                \"branch4\");\n\n        assertNotNull(workspaceProject);\n        assertNotNull(workspaceProject.getBranch());\n        assertEquals(\"branch4\", workspaceProject.getBranch().getName());\n        assertNotNull(workspaceProject.getMainModule());\n    }\n\n    private void mockRepositoriesAndBranches() {\n        Branch branch1 = createBranch(\"main\");\n        Branch branch2 = createBranch(\"branch2\");\n        Branch branch3 = createBranch(\"main\");\n        Branch branch4 = createBranch(\"branch4\");\n        Branch branch5 = createBranch(\"branch5\");\n\n        Repository project1 = mock(Repository.class);\n        when(project1.getAlias()).thenReturn(\"project1\");\n        when(project1.getDefaultBranch()).thenReturn(Optional.of(branch1));\n\n        Repository project2 = mock(Repository.class);\n        when(project2.getAlias()).thenReturn(\"project2\");\n        when(project2.getSpace()).thenReturn(space);\n        when(project2.getDefaultBranch()).thenReturn(Optional.of(branch3));\n        when(project2.getBranches())\n            .thenReturn(Arrays.asList(branch3,\n                                      branch4,\n                                      branch5));\n\n        when(repositoryService.getRepository(any(), any())).thenReturn(project2);\n        when(repositoryService.getAllRepositories(any(), anyBoolean()))\n            .thenReturn(Arrays.asList(project1,\n                                      project2));\n    }\n\n    private Branch createBranch(String name) {\n        Path path = Paths.convert(\n            ioService.newFileSystem(\n                URI.create(\"git://test/\" + name + new Date().getTime()),\n                new HashMap<String, Object>() {{\n                    put(\"init\", Boolean.TRUE);\n            }}).getRootDirectories().iterator().next());\n\n        Branch branch = mock(Branch.class);\n\n        when(branch.getName()).thenReturn(name);\n        when(branch.getPath()).thenReturn(path);\n\n        return branch;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/WorkspaceProjectServiceImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.project.backend.server.utils.PathUtil;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.ModuleRepositoryResolver;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.POMService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.RepositoryUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\nimport org.uberfire.io.IOService;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceProjectServiceImplTest {\n\n    WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    RepositoryService repositoryService;\n\n    @Mock\n    Instance<ModuleService<? extends Module>> moduleServices;\n\n    @Mock\n    Repository repository1;\n\n    @Mock\n    Repository repository2;\n\n    @Mock\n    Repository repository3;\n\n    @Mock\n    ModuleService moduleService;\n\n    @Mock\n    ModuleRepositoryResolver repositoryResolver;\n\n    @Mock\n    SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    SpaceConfigStorage spaceConfigStorage;\n\n    @Mock\n    IOService ioService;\n\n    @Mock\n    PathUtil pathUtil;\n\n    @Mock\n    ChangeRequestService changeRequestService;\n\n    @Mock\n    POMService pomService;\n\n    @Mock\n    EventSourceMock<RepositoryUpdatedEvent> repositoryUpdatedEvent;\n\n    @Mock\n    Event<NewBranchEvent> newBranchEvent;\n\n    @Mock\n    SessionInfo sessionInfo;\n\n    SpacesAPI spaces = new SpacesAPIImpl();\n\n    Space space1;\n    Space space2;\n\n    private OrganizationalUnit ou1;\n    private OrganizationalUnit ou2;\n    private List<Repository> allRepositories;\n\n    @Before\n    public void setUp() throws Exception {\n\n        setUpOUs();\n\n        setUpRepositories();\n\n        sessionInfo = new SessionInfoMock();\n\n        doReturn(moduleService).when(moduleServices).get();\n\n        when(spaceConfigStorageRegistry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n\n        workspaceProjectService = new WorkspaceProjectServiceImpl(organizationalUnitService,\n                                                                  repositoryService,\n                                                                  spaces,\n                                                                  new EventSourceMock<>(),\n                                                                  repositoryUpdatedEvent,\n                                                                  newBranchEvent,\n                                                                  moduleServices,\n                                                                  repositoryResolver,\n                                                                  ioService,\n                                                                  spaceConfigStorageRegistry,\n                                                                  pathUtil,\n                                                                  changeRequestService,\n                                                                  pomService);\n    }\n\n    private void setUpOUs() {\n        ou1 = new OrganizationalUnitImpl(\"ou1\",\n                                         \"defaultGroupID\");\n        ou2 = new OrganizationalUnitImpl(\"ou2\",\n                                         \"defaultGroupID\");\n        space1 = spaces.getSpace(\"ou1\");\n        space2 = spaces.getSpace(\"ou2\");\n\n        final List<OrganizationalUnit> allOUs = new ArrayList<>();\n        allOUs.add(ou1);\n        allOUs.add(ou2);\n        doReturn(allOUs).when(organizationalUnitService).getOrganizationalUnits();\n\n        ou1.getRepositories().add(repository1);\n        ou1.getRepositories().add(repository2);\n\n        ou2.getRepositories().add(repository3);\n    }\n\n    private void setUpRepositories() {\n\n        doReturn(Optional.of(mock(Branch.class))).when(repository1).getDefaultBranch();\n        doReturn(\"repository1\").when(repository1).getAlias();\n        doReturn(\"space1/repository1\").when(repository1).getIdentifier();\n        doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();\n        doReturn(\"repository-with-same-alias\").when(repository2).getAlias();\n        doReturn(\"space1/repository-with-same-alias\").when(repository2).getIdentifier();\n        doReturn(Optional.of(mock(Branch.class))).when(repository3).getDefaultBranch();\n\n        allRepositories = new ArrayList<>();\n        allRepositories.add(repository1);\n        allRepositories.add(repository2);\n        allRepositories.add(repository3);\n\n        doReturn(Arrays.asList(repository1,\n                               repository2)).when(repositoryService).getAllRepositories(Mockito.eq(space1),\n                                                                                        anyBoolean());\n        doReturn(Arrays.asList(repository3)).when(repositoryService).getAllRepositories(Mockito.eq(space2),\n                                                                                        anyBoolean());\n    }\n\n    @Test\n    public void getAllProjects() {\n\n        final Collection<WorkspaceProject> allWorkspaceProjects = workspaceProjectService.getAllWorkspaceProjects();\n\n        assertEquals(3,\n                     allWorkspaceProjects.size());\n    }\n\n    @Test\n    public void getAllProjectsForOU1() {\n        final Collection<WorkspaceProject> allWorkspaceProjects = workspaceProjectService.getAllWorkspaceProjects(ou1);\n\n        assertContains(repository1,\n                       allWorkspaceProjects);\n        assertContains(repository2,\n                       allWorkspaceProjects);\n\n        assertEquals(2,\n                     allWorkspaceProjects.size());\n    }\n\n    @Test\n    public void getAllProjectsForOU2() {\n        final Collection<WorkspaceProject> allWorkspaceProjects = workspaceProjectService.getAllWorkspaceProjects(ou2);\n\n        assertContains(repository3,\n                       allWorkspaceProjects);\n\n        assertEquals(1,\n                     allWorkspaceProjects.size());\n    }\n\n    @Test\n    public void getAllProjectsWithName() {\n        final Collection<WorkspaceProject> allWorkspaceProjects = workspaceProjectService.getAllWorkspaceProjectsByName(ou1,\n                                                                                                                        \"repository-with-same-alias\");\n\n        assertContains(repository2,\n                       allWorkspaceProjects);\n\n        assertEquals(1,\n                     allWorkspaceProjects.size());\n    }\n\n    @Test\n    public void spaceHasProjectsWithName() {\n        final boolean hasNoProjects = workspaceProjectService.spaceHasNoProjectsWithName(ou1,\n                                                                                         \"repository1\",\n                                                                                         new WorkspaceProject(ou1,\n                                                                                                              repository2,\n                                                                                                              repository2.getDefaultBranch().get(),\n                                                                                                              null));\n\n        assertFalse(hasNoProjects);\n    }\n\n    @Test\n    public void spaceHasNoProjectsWithName() throws Exception {\n        final boolean hasNoProjects = workspaceProjectService.spaceHasNoProjectsWithName(ou1,\n                                                                                         \"other-project\",\n                                                                                         new WorkspaceProject(ou1,\n                                                                                                              repository1,\n                                                                                                              repository1.getDefaultBranch().get(),\n                                                                                                              null));\n\n        assertTrue(hasNoProjects);\n    }\n\n    @Test\n    public void spaceHasProjectsWithNameSameProject() throws Exception {\n        final boolean hasNoProjects = workspaceProjectService.spaceHasNoProjectsWithName(ou1,\n                                                                                         \"repository1\",\n                                                                                         new WorkspaceProject(ou1,\n                                                                                                              repository1,\n                                                                                                              repository1.getDefaultBranch().get(),\n                                                                                                              null));\n\n        assertTrue(hasNoProjects);\n    }\n\n    @Test\n    public void noProjects() {\n        final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);\n        doReturn(\"myOU\").when(organizationalUnit).getName();\n\n        assertTrue(workspaceProjectService.getAllWorkspaceProjects(organizationalUnit).isEmpty());\n    }\n\n    @Test\n    public void testReturnSameNameIfProjectDoesNotExist() {\n        String projectName = \"projectA\";\n        POM pom = new POM(projectName,\n                          \"description\",\n                          \"url\",\n                          null);\n\n        WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n        String newName = impl.createFreshProjectName(this.ou1,\n                                                     pom.getName());\n\n        assertEquals(projectName,\n                     newName);\n    }\n\n    @Test\n    public void testCreateNewNameIfProjectExists() {\n        {\n            POM pom = new POM(\"repository1\",\n                              \"description\",\n                              \"url\",\n                              null);\n\n            WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n            String newName = impl.createFreshProjectName(this.ou1,\n                                                         pom.getName());\n\n            assertEquals(\"repository1-1\",\n                         newName);\n        }\n\n        {\n\n            doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();\n            doReturn(\"repository1-1\").when(repository2).getAlias();\n\n            POM pom = new POM(\"repository1\",\n                              \"description\",\n                              \"url\",\n                              null);\n\n            WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n            String newName = impl.createFreshProjectName(this.ou1,\n                                                         pom.getName());\n\n            assertEquals(\"repository1-2\",\n                         newName);\n        }\n    }\n\n    @Test\n    public void testReturnSameNameIfRepositoryDoesNotExist() {\n        String repositoryName = \"repositoryA\";\n        WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n        String newName = impl.createFreshRepositoryAlias(this.ou1,\n                                                         repositoryName);\n\n        assertEquals(repositoryName,\n                     newName);\n    }\n\n    @Test\n    public void testCreateNewNameIfRepositoryExists() {\n        {\n            String repositoryName = \"repository1\";\n            WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n            String newName = impl.createFreshProjectName(this.ou1,\n                                                         repositoryName);\n\n            assertEquals(\"repository1-1\",\n                         newName);\n        }\n\n        {\n            doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();\n            doReturn(\"repository1-1\").when(repository2).getAlias();\n\n            WorkspaceProjectServiceImpl impl = (WorkspaceProjectServiceImpl) this.workspaceProjectService;\n            String newName = impl.createFreshProjectName(this.ou1,\n                                                         \"repository1\");\n\n            assertEquals(\"repository1-2\",\n                         newName);\n        }\n    }\n\n    @Test\n    public void testErrorWhenNewProject() {\n        String repository1 = \"repository1\";\n        POM pom = new POM(repository1,\n                          \"description\",\n                          \"url\",\n                          null);\n\n        when(repositoryService.createRepository(any(), anyString(), anyString(), any(), any())).thenReturn(repository2);\n\n        doReturn(Optional.of(mock(Branch.class))).when(repository2).getDefaultBranch();\n        when(repository2.getAlias()).thenReturn(repository1);\n\n        when(this.moduleService.newModule(any(),\n                                          any(),\n                                          any()))\n                .thenThrow(new RuntimeException(\"Expected error\"));\n\n        try {\n            this.workspaceProjectService.newProject(this.ou1,\n                                                    pom);\n        } catch (Exception e) {\n            verify(this.repositoryService).removeRepository(new Space(this.ou1.getName()),\n                                                            repository1);\n        }\n    }\n\n    @Test\n    public void addBranchTest() throws URISyntaxException {\n        final WorkspaceProject project = mock(WorkspaceProject.class);\n        doReturn(repository1).when(project).getRepository();\n        doReturn(repository1).when(repositoryService).getRepositoryFromSpace(any(), any());\n\n        final List<Branch> repo1Branches = Arrays.asList(makeBranch(\"repo1-branch1\",\n                                                                    repository1.getAlias()),\n                                                         makeBranch(\"repo1-branch2\",\n                                                                    repository1.getAlias()));\n        when(repository1.getBranches()).thenReturn(repo1Branches);\n        when(repository1.getBranch(anyString())).then(inv -> repo1Branches.stream().filter(b -> b.getName().equals(inv.getArgument(0, String.class))).findFirst());\n\n        doReturn(new Space(\"my-space\")).when(project).getSpace();\n        doReturn(mock(SpaceConfigStorage.class)).when(spaceConfigStorageRegistry).get(\"my-space\");\n\n        final org.uberfire.java.nio.file.Path baseBranchPath = mock(org.uberfire.java.nio.file.Path.class);\n        final Path path = repository1.getBranches().stream().filter(b -> b.getName().equals(\"repo1-branch1\")).findFirst().get().getPath();\n        final FileSystem fileSystem = mock(FileSystem.class);\n        final FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class);\n        doReturn(fileSystemProvider).when(fileSystem).provider();\n        doReturn(fileSystem).when(baseBranchPath).getFileSystem();\n        doReturn(baseBranchPath).when(pathUtil).convert(path);\n\n        final org.uberfire.java.nio.file.Path newBranchPath = mock(org.uberfire.java.nio.file.Path.class);\n        doReturn(newBranchPath).when(ioService).get(new URI(\"default://new-branch@repo1/\"));\n\n        doReturn(\"default://new-branch@repo1/\").when(pathUtil).replaceBranch(anyString(), anyString());\n\n        final ArgumentCaptor<NewBranchEvent> newBranchEventArgumentCaptor = ArgumentCaptor.forClass(NewBranchEvent.class);\n\n        workspaceProjectService.addBranch(\"new-branch\",\n                                          \"repo1-branch1\",\n                                          project,\n                                          \"user\");\n\n        verify(fileSystemProvider).copy(baseBranchPath, newBranchPath);\n\n        verify(repositoryUpdatedEvent).fire(any());\n        verify(newBranchEvent).fire(newBranchEventArgumentCaptor.capture());\n\n        final NewBranchEvent newBranchEvent = newBranchEventArgumentCaptor.getValue();\n        assertEquals(\"new-branch\", newBranchEvent.getNewBranchName());\n        assertEquals(\"repo1-branch1\", newBranchEvent.getFromBranchName());\n        assertEquals(repository1, newBranchEvent.getRepository());\n    }\n\n    @Test\n    public void removeBranchTest() {\n        final Branch otherBranch = makeBranch(\"repo1-branch1\", \"repo1\");\n        final org.uberfire.java.nio.file.Path baseBranchPath = mock(org.uberfire.java.nio.file.Path.class);\n        final FileSystem fileSystem = mock(FileSystem.class);\n        final FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class);\n        doReturn(fileSystem).when(baseBranchPath).getFileSystem();\n        doReturn(baseBranchPath).when(pathUtil).convert(any(Path.class));\n\n        final List<Branch> repo1Branches = Arrays.asList(makeBranch(\"repo1-branch1\",\n                                                                    repository1.getAlias()),\n                                                         makeBranch(\"repo1-branch2\",\n                                                                    repository1.getAlias()));\n        when(repository1.getBranch(anyString())).then(inv -> repo1Branches.stream().filter(b -> b.getName().equals(inv.getArgument(0, String.class))).findFirst());\n\n        final WorkspaceProject project = mock(WorkspaceProject.class);\n        doReturn(repository1).when(project).getRepository();\n        final Space space = new Space(\"my-space\");\n        doReturn(space).when(project).getSpace();\n        doReturn(mock(SpaceConfigStorage.class)).when(spaceConfigStorageRegistry).get(\"my-space\");\n        doReturn(repository1).when(repositoryService).getRepositoryFromSpace(space, \"repository1\");\n\n        workspaceProjectService.removeBranch(otherBranch.getName(),\n                                             project,\n                                             \"user\");\n\n        verify(ioService).startBatch(fileSystem);\n        verify(ioService).delete(baseBranchPath);\n        verify(ioService).endBatch();\n        verify(repositoryUpdatedEvent).fire(any());\n    }\n\n    private Branch makeBranch(final String branchName,\n        final String repoName) {\n        final Path path = mock(Path.class);\n        doReturn(\"default://\" + branchName + \"@\" + repoName + \"/\").when(path).toURI();\n        return new Branch(branchName, path);\n    }\n\n    private void assertContains(final Repository repository,\n                                final Collection<WorkspaceProject> allWorkspaceProjects) {\n\n        for (final WorkspaceProject workspaceProject : allWorkspaceProjects) {\n            if (workspaceProject.getRepository().equals(repository)) {\n                return;\n            }\n        }\n\n        fail(\"Could not find \" + repository);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/WorkspaceWorkspaceProjectSearchServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server;\n\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.WorkspaceProjectSearchService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceWorkspaceProjectSearchServiceTest {\n\n    @Mock\n    WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    WorkspaceProject itemA;\n\n    @Mock\n    WorkspaceProject itemB;\n\n    private WorkspaceProjectSearchService searchService;\n\n    @Before\n    public void setUp() throws Exception {\n        when(itemA.getName()).thenReturn(\"Item A\");\n        when(itemB.getName()).thenReturn(\"Item B\");\n        final Repository repository = mock(Repository.class);\n        final Path repositoryRoot = mock(Path.class);\n\n        when(workspaceProjectService.getAllWorkspaceProjects()).thenReturn(new HashSet() {{\n            add(itemA);\n            add(itemB);\n        }});\n        searchService = new WorkspaceProjectSearchServiceImpl(workspaceProjectService);\n    }\n\n    @Test\n    public void testSearchByAlias() throws Exception {\n        Collection<WorkspaceProject> result = searchService.searchByName(\"Item\",\n                                                                         10,\n                                                                         true);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchCaseSensitiveEmpty() throws Exception {\n        Collection<WorkspaceProject> result = searchService.searchByName(\"item\",\n                                                                         10,\n                                                                         true);\n        assertEquals(result.size(),\n                     0);\n    }\n\n    @Test\n    public void testSearchCaseUnsensitive() throws Exception {\n        Collection<WorkspaceProject> result = searchService.searchByName(\"item\",\n                                                                         10,\n                                                                         false);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchMaxItems() throws Exception {\n        Collection<WorkspaceProject> result = searchService.searchByName(\"item\",\n                                                                         1,\n                                                                         false);\n        assertEquals(result.size(),\n                     1);\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/BuildContentHandlerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport org.apache.maven.model.Build;\nimport org.apache.maven.model.Plugin;\nimport org.junit.Test;\n\nimport static org.guvnor.common.services.project.backend.server.utils.TestUtils.makeGuvnorPlugin;\nimport static org.guvnor.common.services.project.backend.server.utils.TestUtils.makeMavenPlugin;\nimport static org.junit.Assert.*;\n\npublic class BuildContentHandlerTest {\n\n    @Test\n    public void testBuildPluginUpdateExisting() throws Exception {\n        org.guvnor.common.services.project.model.Build from = new org.guvnor.common.services.project.model.Build();\n        from.getPlugins().add(makeGuvnorPlugin(\"myGroup\",\n                                               \"myArtifact\",\n                                               \"1.0\"));\n\n        Build to = new Build();\n        Plugin toPlugin = makeMavenPlugin(\"myGroup\",\n                                          \"myArtifact\",\n                                          \"0.11.11.12\");\n        to.getPlugins().add(toPlugin);\n        toPlugin.setGoals(\"someGoal\");\n        to.setSourceDirectory(\"someDirectory\");\n\n        to = new BuildContentHandler().update(from,\n                                              to);\n\n        assertEquals(1,\n                     to.getPlugins().size());\n        assertEquals(\"1.0\",\n                     to.getPlugins().get(0).getVersion());\n        assertEquals(\"someGoal\",\n                     to.getPlugins().get(0).getGoals());\n        assertEquals(\"someDirectory\",\n                     to.getSourceDirectory());\n    }\n\n    @Test\n    public void testBuildPluginDeletePlugin() throws Exception {\n        org.guvnor.common.services.project.model.Build from = new org.guvnor.common.services.project.model.Build();\n        from.getPlugins().add(makeGuvnorPlugin(\"myGroup\",\n                                               \"myArtifact\",\n                                               \"1.0\"));\n\n        Build to = new Build();\n        to.getPlugins().add(makeMavenPlugin(\"myGroup\",\n                                            \"myArtifact\",\n                                            \"1.0\"));\n        to.getPlugins().add(makeMavenPlugin(\"junit\",\n                                            \"junit\",\n                                            \"1.44\"));\n\n        to = new BuildContentHandler().update(from,\n                                              to);\n\n        assertEquals(1,\n                     to.getPlugins().size());\n        assertEquals(\"1.0\",\n                     to.getPlugins().get(0).getVersion());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/DependencyUpdaterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\n\nimport org.apache.maven.model.Model;\nimport org.guvnor.common.services.project.model.Dependency;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class DependencyUpdaterTest {\n\n    @Test\n    public void testEmptyDependency() throws Exception {\n\n        Model model = new Model();\n        ArrayList<Dependency> dependencies = new ArrayList<Dependency>();\n        dependencies.add(new Dependency());\n\n        assertTrue(model.getDependencies().isEmpty());\n\n        new DependencyUpdater(model.getDependencies()).updateDependencies(dependencies);\n\n        assertEquals(1,\n                     model.getDependencies().size());\n        assertNull(model.getDependencies().get(0).getGroupId());\n        assertNull(model.getDependencies().get(0).getArtifactId());\n        assertNull(model.getDependencies().get(0).getVersion());\n    }\n\n    @Test\n    public void testAdd() throws Exception {\n\n        Model model = new Model();\n        ArrayList<Dependency> dependencies = new ArrayList<Dependency>();\n        dependencies.add(makeWorkbenchDependency(\"group\",\n                                                 \"artifact-id\",\n                                                 \"1.0\"));\n\n        assertTrue(model.getDependencies().isEmpty());\n\n        new DependencyUpdater(model.getDependencies()).updateDependencies(dependencies);\n\n        assertEquals(1,\n                     model.getDependencies().size());\n        assertEquals(\"group\",\n                     model.getDependencies().get(0).getGroupId());\n        assertEquals(\"artifact-id\",\n                     model.getDependencies().get(0).getArtifactId());\n        assertEquals(\"1.0\",\n                     model.getDependencies().get(0).getVersion());\n    }\n\n    @Test\n    public void testRemove() throws Exception {\n\n        Model model = new Model();\n\n        model.getDependencies().add(makeMavenDependency(\"group\",\n                                                        \"artifact-id\",\n                                                        \"1.0\"));\n\n        assertFalse(model.getDependencies().isEmpty());\n\n        new DependencyUpdater(model.getDependencies()).updateDependencies(Collections.EMPTY_LIST);\n\n        assertTrue(model.getDependencies().isEmpty());\n    }\n\n    @Test\n    public void testUpdate() throws Exception {\n        Model model = new Model();\n        model.getDependencies().add(makeMavenDependency(\"group\",\n                                                        \"artifact-id\",\n                                                        \"1.0\"));\n\n        ArrayList<Dependency> dependencies = new ArrayList<Dependency>();\n        dependencies.add(makeWorkbenchDependency(\"group\",\n                                                 \"artifact-id\",\n                                                 \"2.0\"));\n\n        assertFalse(model.getDependencies().isEmpty());\n\n        new DependencyUpdater(model.getDependencies()).updateDependencies(dependencies);\n\n        assertEquals(1,\n                     model.getDependencies().size());\n        assertEquals(\"group\",\n                     model.getDependencies().get(0).getGroupId());\n        assertEquals(\"artifact-id\",\n                     model.getDependencies().get(0).getArtifactId());\n        assertEquals(\"2.0\",\n                     model.getDependencies().get(0).getVersion());\n    }\n\n    private org.apache.maven.model.Dependency makeMavenDependency(String group,\n                                                                  String artifactId,\n                                                                  String version) {\n        org.apache.maven.model.Dependency dependency = new org.apache.maven.model.Dependency();\n        dependency.setGroupId(group);\n        dependency.setArtifactId(artifactId);\n        dependency.setVersion(version);\n        return dependency;\n    }\n\n    private Dependency makeWorkbenchDependency(String group,\n                                               String artifactId,\n                                               String version) {\n        Dependency dependency = new Dependency();\n        dependency.setGroupId(group);\n        dependency.setArtifactId(artifactId);\n        dependency.setVersion(version);\n        return dependency;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/MavenPluginUpdaterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.maven.model.Plugin;\nimport org.junit.Test;\n\nimport static org.guvnor.common.services.project.backend.server.utils.TestUtils.makeGuvnorPlugin;\nimport static org.guvnor.common.services.project.backend.server.utils.TestUtils.makeMavenPlugin;\nimport static org.junit.Assert.*;\n\npublic class MavenPluginUpdaterTest {\n\n    @Test\n    public void testIgnorePluginsThatHaveNoGroupIdOrArtifactId() throws Exception {\n\n        List<Plugin> to = new ArrayList<Plugin>();\n        ArrayList<org.guvnor.common.services.project.model.Plugin> from = new ArrayList<org.guvnor.common.services.project.model.Plugin>();\n        from.add(makeGuvnorPlugin(null,\n                                  null,\n                                  null));\n        from.add(makeGuvnorPlugin(null,\n                                  null,\n                                  \"1.0\"));\n        from.add(makeGuvnorPlugin(\"myGroup\",\n                                  null,\n                                  \"1.0\"));\n        from.add(makeGuvnorPlugin(null,\n                                  \"myArtifact\",\n                                  \"1.0\"));\n\n        to = new MavenPluginUpdater(to).update(from);\n\n        assertTrue(to.isEmpty());\n    }\n\n    @Test\n    public void testChangeVersion() throws Exception {\n        List<Plugin> to = new ArrayList<Plugin>();\n        to.add(makeMavenPlugin(\"myPlugin\",\n                               \"myArtifact\",\n                               \"1.0\"));\n        ArrayList<org.guvnor.common.services.project.model.Plugin> from = new ArrayList<org.guvnor.common.services.project.model.Plugin>();\n        from.add(makeGuvnorPlugin(\"myPlugin\",\n                                  \"myArtifact\",\n                                  \"2.0\"));\n\n        to = new MavenPluginUpdater(to).update(from);\n\n        assertEquals(1,\n                     to.size());\n        assertEquals(\"2.0\",\n                     to.get(0).getVersion());\n    }\n\n    @Test\n    public void testAddNew() throws Exception {\n        List<Plugin> to = new ArrayList<Plugin>();\n        to.add(makeMavenPlugin(\"myPlugin\",\n                               \"myArtifact\",\n                               \"1.0\"));\n        ArrayList<org.guvnor.common.services.project.model.Plugin> from = new ArrayList<org.guvnor.common.services.project.model.Plugin>();\n        from.add(makeGuvnorPlugin(\"myPlugin\",\n                                  \"myArtifact\",\n                                  \"1.0\"));\n        from.add(makeGuvnorPlugin(\"junit\",\n                                  \"junit\",\n                                  \"1.44\"));\n\n        to = new MavenPluginUpdater(to).update(from);\n\n        assertEquals(2,\n                     to.size());\n        assertEquals(\"1.0\",\n                     to.get(0).getVersion());\n        assertEquals(\"1.44\",\n                     to.get(1).getVersion());\n    }\n\n    @Test\n    public void testRemove() throws Exception {\n        List<Plugin> to = new ArrayList<Plugin>();\n        to.add(makeMavenPlugin(\"myPlugin\",\n                               \"myArtifact\",\n                               \"1.0\"));\n        to.add(makeMavenPlugin(\"junit\",\n                               \"junit\",\n                               \"1.44\"));\n        ArrayList<org.guvnor.common.services.project.model.Plugin> from = new ArrayList<org.guvnor.common.services.project.model.Plugin>();\n        from.add(makeGuvnorPlugin(\"myPlugin\",\n                                  \"myArtifact\",\n                                  \"1.0\"));\n\n        to = new MavenPluginUpdater(to).update(from);\n\n        assertEquals(1,\n                     to.size());\n        assertEquals(\"1.0\",\n                     to.get(0).getVersion());\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/POMContentHandlerOneToOneTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.io.BufferedReader;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.guvnor.common.services.project.model.POM;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.junit.Assert.*;\n\n@RunWith(Parameterized.class)\npublic class POMContentHandlerOneToOneTest {\n\n    private String fileName;\n\n    @Test\n    public void testNoChanges() throws Exception {\n\n        String pomxml = fromStream(POMContentHandlerOneToOneTest.class.getResourceAsStream(fileName));\n\n        POM model = new POMContentHandler().toModel(pomxml);\n\n        assertContainsIgnoreWhitespace(pomxml,\n                                       new POMContentHandler().toString(model,\n                                                                        pomxml));\n    }\n\n    public POMContentHandlerOneToOneTest(String fileName) {\n        this.fileName = fileName;\n    }\n\n    @Parameterized.Parameters\n    public static Collection<Object[]> getData() {\n        return Arrays.asList(new Object[][]{\n                {\"pom1.xml\"},\n                {\"pom2.xml\"},\n                {\"pom3.xml\"}\n        });\n    }\n\n    public static String fromStream(InputStream in) throws IOException {\n        BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n        StringBuilder out = new StringBuilder();\n        String line;\n        while ((line = reader.readLine()) != null) {\n            out.append(line).append(\"\\n\");\n        }\n        return out.toString();\n    }\n\n    private void assertContainsIgnoreWhitespace(final String expected,\n                                                final String xml) {\n        final String cleanExpected = expected.replaceAll(\"\\\\s+\",\n                                                         \"\");\n        final String cleanActual = xml.replaceAll(\"\\\\s+\",\n                                                  \"\");\n\n        assertEquals(\"Failure with pom file: \" + fileName,\n                     cleanExpected,\n                     cleanActual);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/POMContentHandlerTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport java.io.IOException;\n\nimport org.codehaus.plexus.util.xml.pull.XmlPullParserException;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.POM;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class POMContentHandlerTest {\n\n    private static final String GAV_GROUP_ID_XML = \"<groupId>org.guvnor</groupId>\";\n    private static final String GAV_ARTIFACT_ID_XML = \"<artifactId>test</artifactId>\";\n    private static final String GAV_VERSION_XML = \"<version>0.0.1</version>\";\n    private static final String URL_XML = \"<url>url</url>\";\n    private static final String EXISTING_PLUGIN_XML = \"<plugin>\"\n            + \"<groupId>org.kie</groupId>\"\n            + \"<artifactId>kie-maven-plugin</artifactId>\"\n            + \"<version>another-version</version>\"\n            + \"<extensions>true</extensions>\"\n            + \"</plugin>\";\n\n    @Test\n    public void testPOMContentHandlerNewProject() throws IOException {\n        final POMContentHandler handler = new POMContentHandler();\n        final GAV gav = new GAV();\n        gav.setGroupId(\"org.guvnor\");\n        gav.setArtifactId(\"test\");\n        gav.setVersion(\"0.0.1\");\n        final POM pom = new POM(\"name\",\n                                \"description\",\n                                \"url\",\n                                gav);\n        final String xml = handler.toString(pom);\n\n        assertContainsIgnoreWhitespace(GAV_GROUP_ID_XML,\n                                       xml);\n        assertContainsIgnoreWhitespace(GAV_ARTIFACT_ID_XML,\n                                       xml);\n        assertContainsIgnoreWhitespace(GAV_VERSION_XML,\n                                       xml);\n        assertContainsIgnoreWhitespace(URL_XML,\n                                       xml);\n    }\n\n    @Test\n    public void testPOMContentHandlerExistingProject() throws IOException, XmlPullParserException {\n        final POMContentHandler handler = new POMContentHandler();\n        final String xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n                + \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n                + \"<modelVersion>4.0.0</modelVersion>\"\n                + \"<groupId>org.guvnor</groupId>\"\n                + \"<artifactId>test</artifactId>\"\n                + \"<version>0.0.1</version>\"\n                + \"<name>name</name>\"\n                + \"<url>url</url>\"\n                + \"<description>description</description>\"\n                + \"</project>\";\n\n        final POM pom = handler.toModel(xml);\n        assertEquals(\"org.guvnor\",\n                     pom.getGav().getGroupId());\n        assertEquals(\"test\",\n                     pom.getGav().getArtifactId());\n        assertEquals(\"0.0.1\",\n                     pom.getGav().getVersion());\n        assertEquals(\"name\",\n                     pom.getName());\n        assertEquals(\"description\",\n                     pom.getDescription());\n        assertEquals(\"url\",\n                     pom.getUrl());\n\n        final String enrichedXml = handler.toString(pom,\n                                                    xml);\n\n        assertContainsIgnoreWhitespace(GAV_GROUP_ID_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(GAV_ARTIFACT_ID_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(GAV_VERSION_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(URL_XML,\n                                       enrichedXml);\n    }\n\n    @Test\n    public void testPOMContentHandlerExistingJarProject() throws IOException, XmlPullParserException {\n        /*\n           Keep the original type\n         */\n\n        final POMContentHandler handler = new POMContentHandler();\n        final String xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n                + \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n                + \"<modelVersion>4.0.0</modelVersion>\"\n                + \"<groupId>org.guvnor</groupId>\"\n                + \"<artifactId>test</artifactId>\"\n                + \"<version>0.0.1</version>\"\n                + \"<packaging>something</packaging>\"\n                + \"<name>name</name>\"\n                + \"<url>url</url>\"\n                + \"<description>description</description>\"\n                + \"</project>\";\n\n        final String enrichedXml = handler.toString(handler.toModel(xml),\n                                                    xml);\n\n        assertContainsIgnoreWhitespace(\"<packaging>something</packaging>\",\n                                       enrichedXml);\n    }\n\n    @Test\n    public void testPOMContentHandlerExistingKieProject() throws IOException, XmlPullParserException {\n        final POMContentHandler handler = new POMContentHandler();\n        final String xml = \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n                + \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\"\n                + \"<modelVersion>4.0.0</modelVersion>\"\n                + \"<groupId>org.guvnor</groupId>\"\n                + \"<artifactId>test</artifactId>\"\n                + \"<version>0.0.1</version>\"\n                + \"<name>name</name>\"\n                + \"<description>description</description>\"\n                + \"<url>url</url>\"\n                + \"<build>\"\n                + \"<plugins>\"\n                + \"<plugin>\"\n                + \"<groupId>org.kie</groupId>\"\n                + \"<artifactId>kie-maven-plugin</artifactId>\"\n                + \"<version>another-version</version>\"\n                + \"<extensions>true</extensions>\"\n                + \"</plugin>\"\n                + \"</plugins>\"\n                + \"</build>\"\n                + \"</project>\";\n\n        final POM pom = handler.toModel(xml);\n        assertEquals(\"org.guvnor\",\n                     pom.getGav().getGroupId());\n        assertEquals(\"test\",\n                     pom.getGav().getArtifactId());\n        assertEquals(\"0.0.1\",\n                     pom.getGav().getVersion());\n        assertEquals(\"name\",\n                     pom.getName());\n        assertEquals(\"description\",\n                     pom.getDescription());\n        assertEquals(\"url\",\n                     pom.getUrl());\n\n        final String enrichedXml = handler.toString(pom,\n                                                    xml);\n\n        assertContainsIgnoreWhitespace(GAV_GROUP_ID_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(GAV_ARTIFACT_ID_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(GAV_VERSION_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(EXISTING_PLUGIN_XML,\n                                       enrichedXml);\n        assertContainsIgnoreWhitespace(URL_XML,\n                                       enrichedXml);\n    }\n\n    @Test\n    public void testParent() throws Exception {\n        final POMContentHandler handler = new POMContentHandler();\n        final String xml =\n                \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\" +\n                        \"<project xsi:schemaLocation=\\\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\\\" xmlns=\\\"http://maven.apache.org/POM/4.0.0\\\" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\">\" +\n                        \"  <modelVersion>4.0.0</modelVersion>\" +\n                        \"  <parent>\" +\n                        \"    <groupId>org.tadaa</groupId>\" +\n                        \"    <artifactId>tadaa</artifactId>\" +\n                        \"    <version>1.2.3</version>\" +\n                        \"  </parent>\" +\n                        \"  <artifactId>myproject</artifactId>\" +\n                        \"  <packaging>kjar</packaging>\" +\n                        \"  <name>myproject</name>\" +\n                        \"  <build>\" +\n                        \"    <plugins>\" +\n                        \"      <plugin>\" +\n                        \"        <groupId>org.kie</groupId>\" +\n                        \"        <artifactId>kie-maven-plugin</artifactId>\" +\n                        \"        <version>another-version</version>\" +\n                        \"        <extensions>true</extensions>\" +\n                        \"      </plugin>\" +\n                        \"    </plugins>\" +\n                        \"  </build>\" +\n                        \"</project>\";\n\n        final POM pom = handler.toModel(xml);\n\n        assertNotNull(pom.getParent());\n        assertEquals(\"org.tadaa\",\n                     pom.getParent().getGroupId());\n        assertEquals(\"tadaa\",\n                     pom.getParent().getArtifactId());\n        assertEquals(\"1.2.3\",\n                     pom.getParent().getVersion());\n    }\n\n    private void assertContainsIgnoreWhitespace(final String expected,\n                                                final String xml) {\n        final String cleanExpected = expected.replaceAll(\"\\\\s+\",\n                                                         \"\");\n        final String cleanActual = xml.replaceAll(\"\\\\s+\",\n                                                  \"\");\n\n        assertTrue(cleanActual.contains(cleanExpected));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/PathUtilTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class PathUtilTest {\n\n    private PathUtil pathUtil;\n\n    @Before\n    public void setup() {\n        pathUtil = new PathUtil();\n    }\n\n    @Test\n    public void stripGitProtocolAndBranch() throws Exception {\n        final String result = pathUtil.stripProtocolAndBranch(\"git://main@space/repo/some/path\");\n        assertEquals(\"space/repo/some/path\", result);\n    }\n\n    @Test\n    public void stripDefaultProtocolAndBranch() throws Exception {\n        final String result = pathUtil.stripProtocolAndBranch(\"default://main@space/repo/some/path\");\n        assertEquals(\"space/repo/some/path\", result);\n    }\n\n    @Test\n    public void stripProtocolMissingBranch() throws Exception {\n        final String result = pathUtil.stripProtocolAndBranch(\"default://space/repo/some/path\");\n        assertEquals(\"space/repo/some/path\", result);\n    }\n\n    @Test\n    public void stripRepoNameAndSpace() throws Exception {\n        final String result = pathUtil.stripRepoNameAndSpace(\"space/repo/some/path\");\n        assertEquals(\"some/path\", result);\n    }\n\n    @Test\n    public void replaceBranchName() {\n        final String newUri = pathUtil.replaceBranch(\"new-branch\", \"git://current-branch@space/repo/some/path\");\n        assertEquals(\"git://new-branch@space/repo/some/path\", newUri);\n    }\n\n    @Test\n    public void replaceMissingBranchName() {\n        final String newUri = pathUtil.replaceBranch(\"new-branch\", \"git://space/repo/some/path\");\n        assertEquals(\"git://space/repo/some/path\", newUri);\n    }\n\n    @Test\n    public void replaceBranchNameWith$() {\n        final String newUri = pathUtil.replaceBranch(\"new$branch\", \"git://current-branch@space/repo/some/path\");\n        assertEquals(\"git://new$branch@space/repo/some/path\", newUri);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/java/org/guvnor/common/services/project/backend/server/utils/TestUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.backend.server.utils;\n\nimport org.apache.maven.model.Plugin;\n\npublic class TestUtils {\n\n    static Plugin makeMavenPlugin(final String groupId,\n                                  final String artifactId,\n                                  final String version) {\n        Plugin plugin = new Plugin();\n        plugin.setGroupId(groupId);\n        plugin.setArtifactId(artifactId);\n        plugin.setVersion(version);\n        return plugin;\n    }\n\n    static org.guvnor.common.services.project.model.Plugin makeGuvnorPlugin(final String groupId,\n                                                                            final String artifactId,\n                                                                            final String version) {\n        org.guvnor.common.services.project.model.Plugin plugin = new org.guvnor.common.services.project.model.Plugin();\n        plugin.setGroupId(groupId);\n        plugin.setArtifactId(artifactId);\n        plugin.setVersion(version);\n        return plugin;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/LegacyRepositoryStructure/Project1/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>project1</artifactId>\n  <version>1.0</version>\n  <packaging>jar</packaging>\n\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <!-- Weld Modules. For tests only -->\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-core-impl</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/LegacyRepositoryStructure/Project2/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>project2</artifactId>\n  <version>1.0</version>\n  <packaging>jar</packaging>\n\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <!-- Weld Modules. For tests only -->\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-core-impl</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/META-INF/beans.xml",
    "content": "<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n       xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd\"\n       bean-discovery-mode=\"all\">\n  <alternatives>\n    <class>org.guvnor.common.services.project.backend.server.TestAppSetup</class>\n    <class>org.guvnor.test.GuvnorTestAppSetup</class>\n    <class>org.guvnor.test.TestIdentityFactory</class>\n    <class>org.guvnor.common.services.project.backend.server.TestProjectService</class>\n  </alternatives>\n</beans>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/TestProject/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>my-test</artifactId>\n  <version>1.0</version>\n  <packaging>jar</packaging>\n\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <!-- Weld Modules. For tests only -->\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-core-impl</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.guvnor\" level=\"info\"/>\n\n  <root level=\"WARN\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/org/guvnor/common/services/project/backend/server/utils/pom1.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>my-test</artifactId>\n  <version>1.0</version>\n\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.guvnor</groupId>\n      <artifactId>guvnor-project-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <artifactId>uberfire-client-api</artifactId>\n          <groupId>org.uberfire</groupId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/org/guvnor/common/services/project/backend/server/utils/pom2.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>my-test</artifactId>\n  <version>1.0</version>\n  <packaging>kjar</packaging>\n\n  <build>\n    <plugins>\n\n      <plugin>\n        <groupId>com.google.code.maven-replacer-plugin</groupId>\n        <artifactId>replacer</artifactId>\n        <configuration>\n          <includes>\n            <include>**/*Constants_de.properties</include>\n            <include>**/*Constants_es.properties</include>\n            <include>**/*Constants_fr.properties</include>\n            <include>**/*Constants_ja.properties</include>\n            <include>**/*Constants_pt_BR.properties</include>\n            <include>**/*Constants_zh_CN.properties</include>\n          </includes>\n          <excludes>\n            <exclude>**/ErraiApp.properties</exclude>\n          </excludes>\n          <replacements>\n            <replacement>\n              <token>''</token>\n              <value>'</value>\n            </replacement>\n            <replacement>\n              <token>'</token>\n              <value>''</value>\n            </replacement>\n          </replacements>\n        </configuration>\n      </plugin>\n\n      <plugin>\n        <groupId>org.zanata</groupId>\n        <artifactId>zanata-maven-plugin</artifactId>\n      </plugin>\n\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>.errai/**</include>\n                <include>.niogit/**</include>\n                <include>repositories/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n\n    </plugins>\n\n  </build>\n\n  <profiles>\n\n    <profile>\n      <id>hostedModeProfile</id>\n      <activation>\n        <property>\n          <name>hostedMode</name>\n        </property>\n      </activation>\n      <modules>\n        <module>guvnor-webapp</module>\n      </modules>\n    </profile>\n\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <modules>\n        <module>guvnor-webapp-distribution-wars</module>\n      </modules>\n    </profile>\n\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-backend/src/test/resources/org/guvnor/common/services/project/backend/server/utils/pom3.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n\n<project xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\"\n         xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n\n  <modelVersion>4.0.0</modelVersion>\n\n  <groupId>org.test</groupId>\n  <artifactId>my-test</artifactId>\n  <version>1.0</version>\n  <packaging>pom</packaging>\n\n\n  <modules>\n    <module>guvnor-structure</module>\n    <module>guvnor-services</module>\n    <module>guvnor-rest</module>\n    <module>guvnor-project</module>\n    <module>guvnor-workingset</module>\n    <module>guvnor-m2repo-editor</module>\n    <module>guvnor-message-console</module>\n    <module>guvnor-webapp</module>\n  </modules>\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld</groupId>\n      <artifactId>weld-core-impl</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/.gitignore",
    "content": "/target\n/local\n/repositories\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-project</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-project-builder</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Project Builder</name>\n  <description>UberFire - Project Builder</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-m2repo-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Needed by kie-api if KieModules are to be built -->\n    <dependency>\n      <groupId>com.google.protobuf</groupId>\n      <artifactId>protobuf-java</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n\n  </dependencies>\n\n  <build>\n\n    <plugins>\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>.niogit/**</include>\n                <include>repository/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n    </plugins>\n\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/AsyncIncrementalBuilder.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.builder;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.service.ModuleService;\n\npublic interface AsyncIncrementalBuilder {\n\n    public void execute(final ModuleService projectService,\n                        final BuildService buildService,\n                        final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                        final Event<BuildResults> buildResultsEvent);\n\n    String getDescription();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/IncrementalBuilderExecutorManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.builder;\n\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport javax.ejb.Asynchronous;\nimport javax.ejb.Singleton;\nimport javax.ejb.Startup;\nimport javax.ejb.TransactionAttribute;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.commons.concurrent.Managed;\n\nimport static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;\n\n@Singleton\n@Startup\n@TransactionAttribute(NOT_SUPPORTED)\npublic class IncrementalBuilderExecutorManager {\n\n    @Inject\n    private ModuleService<? extends Module> moduleService;\n\n    private BuildService buildService;\n\n    private Event<BuildResults> buildResultsEvent;\n\n    private Event<IncrementalBuildResults> incrementalBuildResultsEvent;\n\n    private ExecutorService executorService;\n\n    public IncrementalBuilderExecutorManager() {\n    }\n\n    @Inject\n    public IncrementalBuilderExecutorManager(ModuleService<? extends Module> moduleService,\n                                             BuildService buildService,\n                                             Event<BuildResults> buildResultsEvent,\n                                             Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                             @Managed ExecutorService executorService) {\n        this.moduleService = moduleService;\n        this.buildService = buildService;\n        this.buildResultsEvent = buildResultsEvent;\n        this.incrementalBuildResultsEvent = incrementalBuildResultsEvent;\n        this.executorService = executorService;\n    }\n\n    private AtomicBoolean useExecService = new AtomicBoolean(false);\n\n    @Asynchronous\n    public void execute(final AsyncIncrementalBuilder incrementalBuilder) {\n        if (useExecService.get()) {\n            getExecutorService().execute(new DescriptiveRunnable() {\n                @Override\n                public void run() {\n                    incrementalBuilder.execute(moduleService,\n                                               buildService,\n                                               incrementalBuildResultsEvent,\n                                               buildResultsEvent);\n                }\n\n                @Override\n                public String getDescription() {\n                    return incrementalBuilder.getDescription();\n                }\n            });\n        } else {\n            incrementalBuilder.execute(moduleService,\n                                       buildService,\n                                       incrementalBuildResultsEvent,\n                                       buildResultsEvent);\n        }\n    }\n\n    //Public so we can set the ExecutorService for tests not within guvnor\n    public void setExecutorService(final ExecutorService executorService) {\n        this.executorService = executorService;\n        this.useExecService.set(true);\n    }\n\n    private ExecutorService getExecutorService() {\n        return executorService;\n    }\n\n    public void setServices(final ModuleService moduleService,\n                            final BuildService buildService,\n                            final Event<BuildResults> buildResultsEvent,\n                            final Event<IncrementalBuildResults> incrementalBuildResultsEvent) {\n        this.moduleService = moduleService;\n        this.buildService = buildService;\n        this.buildResultsEvent = buildResultsEvent;\n        this.incrementalBuildResultsEvent = incrementalBuildResultsEvent;\n        this.useExecService.set(true);\n    }\n\n    public void shutdown() {\n        if (useExecService.get() && executorService != null) {\n            executorService.shutdown(); // Disable new tasks from being submitted\n            try {\n                // Wait a while for existing tasks to terminate\n                if (!executorService.awaitTermination(60,\n                                                      TimeUnit.SECONDS)) {\n                    executorService.shutdownNow(); // Cancel currently executing tasks\n                    // Wait a while for tasks to respond to being cancelled\n                    if (!executorService.awaitTermination(60,\n                                                          TimeUnit.SECONDS)) {\n                        System.err.println(\"Pool did not terminate\");\n                    }\n                }\n            } catch (InterruptedException ie) {\n                // (Re-)Cancel if current thread also interrupted\n                executorService.shutdownNow();\n                // Preserve interrupt status\n                Thread.currentThread().interrupt();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/IncrementalBuilderExecutorManagerFactory.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\n/**\n * Producer of IncrementalBuilderExecutorManager\n */\npublic interface IncrementalBuilderExecutorManagerFactory {\n\n    IncrementalBuilderExecutorManager getExecutorManager();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/IncrementalBuilderExecutorManagerFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.builder;\n\nimport java.util.concurrent.ExecutorService;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.naming.InitialContext;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.concurrent.Managed;\n\n@ApplicationScoped\npublic class IncrementalBuilderExecutorManagerFactoryImpl implements IncrementalBuilderExecutorManagerFactory {\n\n    private static final Logger LOG = LoggerFactory.getLogger(IncrementalBuilderExecutorManagerFactoryImpl.class);\n\n    private final boolean USE_EXECUTOR_SAFE_MODE = Boolean.parseBoolean(System.getProperty(\"org.uberfire.async.executor.safemode\",\n                                                                                           \"false\"));\n\n    private ModuleService<? extends Module> moduleService;\n\n    private BuildService buildService;\n\n    private Event<BuildResults> buildResultsEvent;\n\n    private Event<IncrementalBuildResults> incrementalBuildResultsEvent;\n\n    private ExecutorService executorService;\n\n    private IncrementalBuilderExecutorManager executorManager = null;\n\n    @Inject\n    public IncrementalBuilderExecutorManagerFactoryImpl(ModuleService<? extends Module> moduleService,\n                                                        BuildService buildService,\n                                                        Event<BuildResults> buildResultsEvent,\n                                                        Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                                        @Managed ExecutorService executorService) {\n        this.moduleService = moduleService;\n        this.buildService = buildService;\n        this.buildResultsEvent = buildResultsEvent;\n        this.incrementalBuildResultsEvent = incrementalBuildResultsEvent;\n        this.executorService = executorService;\n    }\n\n    @Override\n    public synchronized IncrementalBuilderExecutorManager getExecutorManager() {\n        if (executorManager == null) {\n            IncrementalBuilderExecutorManager _executorManager = null;\n\n            //Unless overridden, delegate instantiation of the ExecutorService to the container\n            //See https://issues.jboss.org/browse/UF-244 and https://issues.jboss.org/browse/WFLY-4198\n            //When running in Hosted Mode (on Wildfly 8.1 at present) the System Property should be set\n            //to \"true\"\n            if (!USE_EXECUTOR_SAFE_MODE) {\n                try {\n                    _executorManager = InitialContext.doLookup(\"java:module/IncrementalBuilderExecutorManager\");\n                } catch (final Exception e) {\n                    LOG.warn(\"Unable to instantiate EJB Asynchronous Bean. Falling back to Executors' CachedThreadPool.\",\n                             e);\n                }\n            } else {\n                LOG.info(\"Use of to Executors' CachedThreadPool has been requested; overriding container provisioning.\");\n            }\n\n            if (_executorManager == null) {\n                executorManager = new IncrementalBuilderExecutorManager();\n                executorManager.setServices(moduleService,\n                                            buildService,\n                                            buildResultsEvent,\n                                            incrementalBuildResultsEvent);\n                executorManager.setExecutorService(this.executorService);\n            } else {\n                executorManager = _executorManager;\n            }\n        }\n\n        return executorManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ObservableClassFile.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Changes to Class files invalidate the DMO cache\n */\npublic class ObservableClassFile implements ResourceChangeObservableFile {\n\n    static final String EXTENSION = \"class\";\n\n    @Override\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName();\n        return fileName.endsWith(\".\" + EXTENSION);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ObservableJavaFile.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Changes to Java files invalidate the DMO cache\n */\npublic class ObservableJavaFile implements ResourceChangeObservableFile {\n\n    static final String EXTENSION = \"java\";\n\n    @Override\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName();\n        return fileName.endsWith(\".\" + EXTENSION);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ObservablePOMFile.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Changes to pom.xml invalidates the DMO cache\n */\npublic class ObservablePOMFile implements ResourceChangeObservableFile {\n\n    static final String FILENAME = \"pom.xml\";\n\n    @Override\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName();\n        return fileName.equals(FILENAME);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ResourceChangeIncrementalBuilder.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.model.IncrementalBuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.shared.config.AppConfigService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.commons.services.cdi.ApplicationStarted;\nimport org.uberfire.workbench.events.ResourceChange;\n\n/**\n * Listener for changes to project resources to handle incremental builds\n */\n@ApplicationScoped\npublic class ResourceChangeIncrementalBuilder {\n\n    protected static final Logger logger = LoggerFactory.getLogger(ResourceChangeIncrementalBuilder.class);\n    private static final String INCREMENTAL_BUILD_PROPERTY_NAME = \"build.enable-incremental\";\n\n    @Inject\n    protected ModuleService<? extends Module> moduleService;\n    protected boolean isIncrementalEnabled = false;\n\n    @Inject\n    private AppConfigService appConfigService;\n\n    @Inject\n    private IncrementalBuilderExecutorManagerFactory executorManagerProducer;\n    private IncrementalBuilderExecutorManager executorManager = null;\n\n    @PostConstruct\n    private void setup() {\n        isIncrementalEnabled = isIncrementalBuildEnabled();\n    }\n\n    public void configureOnEvent(@Observes ApplicationStarted applicationStartedEvent) {\n        isIncrementalEnabled = isIncrementalBuildEnabled();\n        getExecutor();\n    }\n\n    private boolean isIncrementalBuildEnabled() {\n        final String value = appConfigService.loadPreferences().get(INCREMENTAL_BUILD_PROPERTY_NAME);\n        return Boolean.parseBoolean(value);\n    }\n\n    @PreDestroy\n    private void destroyExecutorService() {\n        if (executorManager != null && !isEjb(executorManager,\n                                              IncrementalBuilderExecutorManager.class)) {\n            executorManager.shutdown();\n        }\n    }\n\n    private boolean isEjb(Object o,\n                          Class<?> expected) {\n        if (o.getClass() != expected) {\n            return true;\n        }\n\n        return false;\n    }\n\n    private synchronized IncrementalBuilderExecutorManager getExecutor() {\n        if (executorManager == null) {\n            executorManager = executorManagerProducer.getExecutorManager();\n        }\n        return executorManager;\n    }\n\n    public void addResource(final Path resource) {\n        //Do nothing if incremental builds are disabled\n        if (!isIncrementalEnabled) {\n            return;\n        }\n\n        logger.info(\"Incremental build request received for: \" + resource.toURI() + \" (added).\");\n\n        //If resource is not within a Package it cannot be used for an incremental build\n        final Package pkg = moduleService.resolvePackage(resource);\n        if (pkg == null) {\n            return;\n        }\n\n        //Schedule an incremental build\n        getExecutor().execute(new AsyncIncrementalBuilder() {\n\n            @Override\n            public void execute(final ModuleService projectService,\n                                final BuildService buildService,\n                                final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                final Event<BuildResults> buildResultsEvent) {\n                try {\n                    logger.info(\"Incremental build request being processed: \" + resource.toURI() + \" (added).\");\n                    final Module module = projectService.resolveModule(resource);\n\n                    //Fall back to a Full Build in lieu of an Incremental Build if the Project has not been previously built\n                    if (buildService.isBuilt(module)) {\n                        final IncrementalBuildResults results = buildService.addPackageResource(resource);\n                        incrementalBuildResultsEvent.fire(results);\n                    } else {\n                        final BuildResults results = buildService.build(module);\n                        buildResultsEvent.fire(results);\n                    }\n                } catch (Exception e) {\n                    logger.error(e.getMessage(),\n                                 e);\n                }\n            }\n\n            @Override\n            public String getDescription() {\n                return \"Incremental Build [\" + resource.toURI() + \" (added)]\";\n            }\n        });\n    }\n\n    public void deleteResource(final Path resource) {\n        //Do nothing if incremental builds are disabled\n        if (!isIncrementalEnabled) {\n            return;\n        }\n\n        logger.info(\"Incremental build request received for: \" + resource.toURI() + \" (deleted).\");\n\n        //If resource is not within a Package it cannot be used for an incremental build\n        final Package pkg = moduleService.resolvePackage(resource);\n        if (pkg == null) {\n            return;\n        }\n\n        //Schedule an incremental build\n        getExecutor().execute(new AsyncIncrementalBuilder() {\n\n            @Override\n            public void execute(final ModuleService projectService,\n                                final BuildService buildService,\n                                final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                final Event<BuildResults> buildResultsEvent) {\n                try {\n                    logger.info(\"Incremental build request being processed: \" + resource.toURI() + \" (deleted).\");\n                    final Module module = projectService.resolveModule(resource);\n\n                    //Fall back to a Full Build in lieu of an Incremental Build if the Project has not been previously built\n                    if (buildService.isBuilt(module)) {\n                        final IncrementalBuildResults results = buildService.deletePackageResource(resource);\n                        incrementalBuildResultsEvent.fire(results);\n                    } else {\n                        final BuildResults results = buildService.build(module);\n                        buildResultsEvent.fire(results);\n                    }\n                } catch (Exception e) {\n                    logger.error(e.getMessage(),\n                                 e);\n                }\n            }\n\n            @Override\n            public String getDescription() {\n                return \"Incremental Build [\" + resource.toURI() + \" (deleted)]\";\n            }\n        });\n    }\n\n    public void updateResource(final Path resource) {\n        //Do nothing if incremental builds are disabled\n        if (!isIncrementalEnabled) {\n            return;\n        }\n\n        logger.info(\"Incremental build request received for: \" + resource.toURI() + \" (updated).\");\n\n        //The pom.xml cannot be processed incrementally\n        if (isProjectResourceUpdateNeeded(resource)) {\n            scheduleProjectResourceUpdate(resource);\n        } else {\n            //If resource is not within a Package it cannot be used for an incremental build\n            final Package pkg = moduleService.resolvePackage(resource);\n            if (pkg == null) {\n                return;\n            }\n            schedulePackageResourceUpdate(resource);\n        }\n    }\n\n    protected boolean isProjectResourceUpdateNeeded(Path resource) {\n        return moduleService.isPom(resource);\n    }\n\n    //Schedule a re-build of a Project (changes to pom.xml or kmodule.xml require a full build)\n    protected void scheduleProjectResourceUpdate(final Path resource) {\n        final Module module = moduleService.resolveModule(resource);\n        getExecutor().execute(new AsyncIncrementalBuilder() {\n\n            @Override\n            public void execute(final ModuleService projectService,\n                                final BuildService buildService,\n                                final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                final Event<BuildResults> buildResultsEvent) {\n                try {\n                    logger.info(\"Incremental build request being processed: \" + module.getRootPath() + \" (updated).\");\n                    final BuildResults results = buildService.build(module);\n                    buildResultsEvent.fire(results);\n                } catch (Exception e) {\n                    logger.error(e.getMessage(),\n                                 e);\n                }\n            }\n\n            @Override\n            public String getDescription() {\n                return \"Incremental Build [\" + resource.toURI() + \" (updated)]\";\n            }\n        });\n    }\n\n    //Schedule an incremental build for a package resource\n    protected void schedulePackageResourceUpdate(final Path resource) {\n        getExecutor().execute(new AsyncIncrementalBuilder() {\n\n            @Override\n            public void execute(final ModuleService projectService,\n                                final BuildService buildService,\n                                final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                final Event<BuildResults> buildResultsEvent) {\n                try {\n                    logger.info(\"Incremental build request being processed: \" + resource.toURI() + \" (updated).\");\n                    final Module module = projectService.resolveModule(resource);\n                    //Fall back to a Full Build in lieu of an Incremental Build if the Project has not been previously built\n                    if (buildService.isBuilt(module)) {\n                        final IncrementalBuildResults results = buildService.updatePackageResource(resource);\n                        incrementalBuildResultsEvent.fire(results);\n                    } else {\n                        final BuildResults results = buildService.build(module);\n                        buildResultsEvent.fire(results);\n                    }\n                } catch (Exception e) {\n                    logger.error(e.getMessage(),\n                                 e);\n                }\n            }\n\n            @Override\n            public String getDescription() {\n                return \"Incremental Build [\" + resource.toURI() + \" (updated)]\";\n            }\n        });\n    }\n\n    public void batchResourceChanges(final Map<Path, Collection<ResourceChange>> batch) {\n        //Do nothing if incremental builds are disabled\n        if (!isIncrementalEnabled) {\n            return;\n        }\n\n        logger.info(\"Batch incremental build request received.\");\n\n        //Block changes together with their respective project as Builder operates at the Project level\n        final Map<Module, Map<Path, Collection<ResourceChange>>> projectBatchChanges = new HashMap<Module, Map<Path, Collection<ResourceChange>>>();\n\n        for (Map.Entry<Path, Collection<ResourceChange>> pathCollectionEntry : batch.entrySet()) {\n            for (final ResourceChange change : pathCollectionEntry.getValue()) {\n                final Path resource = pathCollectionEntry.getKey();\n\n                //If resource is not within a Package it cannot be used for an incremental build\n                final Module module = moduleService.resolveModule(resource);\n                final Package pkg = moduleService.resolvePackage(resource);\n                if (module != null && pkg != null) {\n                    if (!projectBatchChanges.containsKey(module)) {\n                        projectBatchChanges.put(module,\n                                                new HashMap<Path, Collection<ResourceChange>>());\n                    }\n                    final Map<Path, Collection<ResourceChange>> projectChanges = projectBatchChanges.get(module);\n                    if (!projectChanges.containsKey(pathCollectionEntry.getKey())) {\n                        projectChanges.put(pathCollectionEntry.getKey(),\n                                           new ArrayList<ResourceChange>());\n                    }\n                    projectChanges.get(pathCollectionEntry.getKey()).add(change);\n                    logger.info(\"- Batch content: \" + pathCollectionEntry.getKey().toURI() + \" (\" + change.getType().toString() + \").\");\n                }\n            }\n        }\n\n        //Schedule an incremental build for each Project\n        for (final Map.Entry<Module, Map<Path, Collection<ResourceChange>>> e : projectBatchChanges.entrySet()) {\n            getExecutor().execute(new AsyncIncrementalBuilder() {\n\n                @Override\n                public void execute(final ModuleService projectService,\n                                    final BuildService buildService,\n                                    final Event<IncrementalBuildResults> incrementalBuildResultsEvent,\n                                    final Event<BuildResults> buildResultsEvent) {\n                    try {\n                        logger.info(\"Batch incremental build request being processed.\");\n                        final Module module = e.getKey();\n                        final Map<Path, Collection<ResourceChange>> changes = e.getValue();\n\n                        //Fall back to a Full Build in lieu of an Incremental Build if the Project has not been previously built\n                        if (buildService.isBuilt(module)) {\n                            final IncrementalBuildResults results = buildService.applyBatchResourceChanges(module,\n                                                                                                           changes);\n\n                            incrementalBuildResultsEvent.fire(results);\n                        } else {\n                            final BuildResults results = buildService.build(module);\n                            buildResultsEvent.fire(results);\n                        }\n                    } catch (Exception e) {\n                        logger.error(e.getMessage(),\n                                     e);\n                    }\n                }\n\n                @Override\n                public String getDescription() {\n                    return \"Batch incremental build [\" + e.getKey().getModuleName() + \"]\";\n                }\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ResourceChangeObservableFile.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * This represents a File that, when changed, should invalidate the DMO cache\n */\npublic interface ResourceChangeObservableFile {\n\n    boolean accept(final Path path);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/java/org/guvnor/common/services/builder/ResourceChangeObserver.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.builder.events.InvalidateDMOModuleCacheEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceChange;\nimport org.uberfire.workbench.events.ResourceChangeType;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n/**\n * Server side component that observes for the different resource add/delete/update events related to\n * a given project and that causes the ModuleDataModelOracle to be invalidated. Typically .java, .class and pom.xml\n * files. When such a resource is modified an InvalidateDMOModuleCacheEvent event is fired.\n */\n@ApplicationScoped\npublic class ResourceChangeObserver {\n\n    private static final Logger logger = LoggerFactory.getLogger(ResourceChangeObserver.class);\n\n    @Inject\n    private ModuleService<? extends Module> projectService;\n\n    @Inject\n    private ResourceChangeIncrementalBuilder incrementalBuilder;\n\n    @Inject\n    private Event<InvalidateDMOModuleCacheEvent> invalidateDMOProjectCacheEvent;\n\n    @Inject\n    @Any\n    private Instance<ResourceChangeObservableFile> observableFiles;\n\n    @Inject\n    private ObservablePOMFile observablePomFile;\n\n    public void processResourceAdd(@Observes final ResourceAddedEvent resourceAddedEvent) {\n        processResourceChange(resourceAddedEvent.getSessionInfo(),\n                              resourceAddedEvent.getPath(),\n                              ResourceChangeType.ADD);\n        incrementalBuilder.addResource(resourceAddedEvent.getPath());\n    }\n\n    public void processResourceDelete(@Observes final ResourceDeletedEvent resourceDeletedEvent) {\n        processResourceChange(resourceDeletedEvent.getSessionInfo(),\n                              resourceDeletedEvent.getPath(),\n                              ResourceChangeType.DELETE);\n        incrementalBuilder.deleteResource(resourceDeletedEvent.getPath());\n    }\n\n    public void processResourceUpdate(@Observes final ResourceUpdatedEvent resourceUpdatedEvent) {\n        processResourceChange(resourceUpdatedEvent.getSessionInfo(),\n                              resourceUpdatedEvent.getPath(),\n                              ResourceChangeType.UPDATE);\n        incrementalBuilder.updateResource(resourceUpdatedEvent.getPath());\n    }\n\n    public void processResourceCopied(@Observes final ResourceCopiedEvent resourceCopiedEvent) {\n        processResourceChange(resourceCopiedEvent.getSessionInfo(),\n                              resourceCopiedEvent.getPath(),\n                              ResourceChangeType.COPY);\n        incrementalBuilder.addResource(resourceCopiedEvent.getPath()); //¿?\n    }\n\n    public void processResourceRenamed(@Observes final ResourceRenamedEvent resourceRenamedEvent) {\n        processResourceChange(resourceRenamedEvent.getSessionInfo(),\n                              resourceRenamedEvent.getPath(),\n                              ResourceChangeType.RENAME);\n        incrementalBuilder.deleteResource(resourceRenamedEvent.getPath());\n        incrementalBuilder.addResource(resourceRenamedEvent.getDestinationPath());\n    }\n\n    public void processBatchChanges(@Observes final ResourceBatchChangesEvent resourceBatchChangesEvent) {\n        final Map<Path, Collection<ResourceChange>> batchChanges = resourceBatchChangesEvent.getBatch();\n        if (batchChanges == null) {\n            //un expected case\n            logger.warn(\"No batchChanges was present for the given resourceBatchChangesEvent: \" + resourceBatchChangesEvent);\n        } else {\n            processBatchResourceChanges(resourceBatchChangesEvent.getSessionInfo(),\n                                        batchChanges);\n            incrementalBuilder.batchResourceChanges(resourceBatchChangesEvent.getBatch());\n        }\n    }\n\n    private void processResourceChange(final SessionInfo sessionInfo,\n                                       final Path path,\n                                       final ResourceChangeType changeType) {\n        //Only process Project resources\n        final Module module = projectService.resolveModule(path);\n        if (module == null) {\n            return;\n        }\n\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Processing resource change for sessionInfo: \" + sessionInfo\n                                 + \", project: \" + module\n                                 + \", path: \" + path\n                                 + \", changeType: \" + changeType);\n        }\n\n        if (isObservableResource(path)) {\n            invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo,\n                                                                                  module,\n                                                                                  path));\n        }\n    }\n\n    private void processBatchResourceChanges(final SessionInfo sessionInfo,\n                                             final Map<Path, Collection<ResourceChange>> resourceChanges) {\n\n        Module module;\n        final Map<Module, Path> pendingNotifications = new HashMap<Module, Path>();\n        for (final Map.Entry<Path, Collection<ResourceChange>> pathCollectionEntry : resourceChanges.entrySet()) {\n\n            //Only process Project resources\n            module = projectService.resolveModule(pathCollectionEntry.getKey());\n            if (module == null) {\n                continue;\n            }\n\n            if (!pendingNotifications.containsKey(module) && isObservableResource(pathCollectionEntry.getKey())) {\n                pendingNotifications.put(module,\n                                         pathCollectionEntry.getKey());\n            } else if (isPomFile(pathCollectionEntry.getKey())) {\n                //if the pom.xml comes in the batch events set then use the pom.xml path for the cache invalidation event\n                pendingNotifications.put(module,\n                                         pathCollectionEntry.getKey());\n            }\n        }\n\n        for (final Map.Entry<Module, Path> pendingNotification : pendingNotifications.entrySet()) {\n            invalidateDMOProjectCacheEvent.fire(new InvalidateDMOModuleCacheEvent(sessionInfo,\n                                                                                  pendingNotification.getKey(),\n                                                                                  pendingNotification.getValue()));\n        }\n    }\n\n    //Check if the changed file should invalidate the DMO cache\n    private boolean isObservableResource(final Path path) {\n        if (path == null) {\n            return false;\n        }\n        for (ResourceChangeObservableFile observableFile : observableFiles) {\n            if (observableFile.accept(path)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean isPomFile(final Path path) {\n        if (path == null) {\n            return false;\n        }\n        return observablePomFile.accept(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/test/java/org/guvnor/common/services/builder/IncrementalBuilderExecutorManagerFactoryImplTest.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.builder;\n\nimport java.util.Hashtable;\nimport javax.naming.Context;\nimport javax.naming.NamingException;\nimport javax.naming.spi.InitialContextFactory;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.commons.concurrent.ExecutorServiceProducer;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class IncrementalBuilderExecutorManagerFactoryImplTest {\n\n    private String spUberfireAsyncExecutorSafeMode;\n    private String spJavaNamingFactoryInitial;\n\n    @Before\n    public void before() {\n        spUberfireAsyncExecutorSafeMode = System.getProperty(\"org.uberfire.async.executor.safemode\");\n        spJavaNamingFactoryInitial = System.getProperty(Context.INITIAL_CONTEXT_FACTORY);\n        System.clearProperty(\"org.uberfire.async.executor.safemode\");\n        System.clearProperty(Context.INITIAL_CONTEXT_FACTORY);\n    }\n\n    @After\n    public void after() {\n        if (spUberfireAsyncExecutorSafeMode != null) {\n            System.setProperty(\"org.uberfire.async.executor.safemode\",\n                               spUberfireAsyncExecutorSafeMode);\n        }\n        if (spJavaNamingFactoryInitial != null) {\n            System.setProperty(Context.INITIAL_CONTEXT_FACTORY,\n                               spJavaNamingFactoryInitial);\n        }\n    }\n\n    @Test\n    public void testUseJDNILookup() throws NamingException {\n        //Test ExecutorService is looked up from JNDI\n        System.setProperty(Context.INITIAL_CONTEXT_FACTORY,\n                           MockInitialContextFactory.class.getName());\n\n        final Context context = mock(Context.class);\n        final IncrementalBuilderExecutorManager service = mock(IncrementalBuilderExecutorManager.class);\n        when(context.lookup(\"java:module/IncrementalBuilderExecutorManager\")).thenReturn(service);\n        MockInitialContextFactory.setCurrentContext(context);\n\n        final IncrementalBuilderExecutorManagerFactoryImpl factory = new IncrementalBuilderExecutorManagerFactoryImpl(null,\n                                                                                                                      null,\n                                                                                                                      null,\n                                                                                                                      null,\n                                                                                                                      new ExecutorServiceProducer().produceUnmanagedExecutorService());\n\n        final IncrementalBuilderExecutorManager executor1 = factory.getExecutorManager();\n\n        assertNotNull(executor1);\n        assertTrue(executor1 instanceof IncrementalBuilderExecutorManager);\n        assertSame(service,\n                   executor1);\n\n        final IncrementalBuilderExecutorManager executor2 = factory.getExecutorManager();\n\n        assertNotNull(executor2);\n        assertTrue(executor2 instanceof IncrementalBuilderExecutorManager);\n        assertSame(service,\n                   executor2);\n\n        assertSame(executor1,\n                   executor2);\n    }\n\n    @Test\n    public void testUseExecutorThreadPool() {\n        //Test ExecutorService is a \"simple\" implementation\n        System.setProperty(\"org.uberfire.async.executor.safemode\",\n                           \"true\");\n\n        final IncrementalBuilderExecutorManagerFactoryImpl factory = new IncrementalBuilderExecutorManagerFactoryImpl(null,\n                                                                                                                      null,\n                                                                                                                      null,\n                                                                                                                      null,\n                                                                                                                      new ExecutorServiceProducer().produceUnmanagedExecutorService());\n        final IncrementalBuilderExecutorManager executor1 = factory.getExecutorManager();\n\n        assertNotNull(executor1);\n        assertTrue(executor1 instanceof IncrementalBuilderExecutorManager);\n\n        final IncrementalBuilderExecutorManager executor2 = factory.getExecutorManager();\n\n        assertNotNull(executor2);\n        assertTrue(executor2 instanceof IncrementalBuilderExecutorManager);\n\n        assertSame(executor1,\n                   executor2);\n    }\n\n    public static class MockInitialContextFactory implements InitialContextFactory {\n\n        private static final ThreadLocal<Context> currentContext = new ThreadLocal<Context>();\n\n        @Override\n        public Context getInitialContext(final Hashtable<?, ?> environment) throws NamingException {\n            return currentContext.get();\n        }\n\n        public static void setCurrentContext(final Context context) {\n            currentContext.set(context);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/test/java/org/guvnor/common/services/builder/ObservableClassFileTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.builder;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ObservableClassFileTest {\n\n    @Mock\n    private Path path;\n\n    private ObservableClassFile observer;\n\n    @Before\n    public void setup() {\n        this.observer = new ObservableClassFile();\n    }\n\n    @Test\n    public void testAcceptWithoutClassFile() {\n        doReturn(\"Cheese.txt\").when(path).getFileName();\n        assertFalse(observer.accept(path));\n    }\n\n    @Test\n    public void testAcceptWithClassFile() {\n        doReturn(\"Cheese.\" + ObservableClassFile.EXTENSION).when(path).getFileName();\n        assertTrue(observer.accept(path));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/test/java/org/guvnor/common/services/builder/ObservableJavaFileTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.builder;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ObservableJavaFileTest {\n\n    @Mock\n    private Path path;\n\n    private ObservableJavaFile observer;\n\n    @Before\n    public void setup() {\n        this.observer = new ObservableJavaFile();\n    }\n\n    @Test\n    public void testAcceptWithoutJavaFile() {\n        doReturn(\"Cheese.txt\").when(path).getFileName();\n        assertFalse(observer.accept(path));\n    }\n\n    @Test\n    public void testAcceptWithJavaFile() {\n        doReturn(\"Cheese.\" + ObservableJavaFile.EXTENSION).when(path).getFileName();\n        assertTrue(observer.accept(path));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-builder/src/test/java/org/guvnor/common/services/builder/ObservablePOMFileTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.builder;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doReturn;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ObservablePOMFileTest {\n\n    @Mock\n    private Path path;\n\n    private ObservablePOMFile observer;\n\n    @Before\n    public void setup() {\n        this.observer = new ObservablePOMFile();\n    }\n\n    @Test\n    public void testAcceptWithoutPOMFile() {\n        doReturn(\"Cheese.txt\").when(path).getFileName();\n        assertFalse(observer.accept(path));\n    }\n\n    @Test\n    public void testAcceptWithPOMFile() {\n        doReturn(ObservablePOMFile.FILENAME).when(path).getFileName();\n        assertTrue(observer.accept(path));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-project</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-project-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Project Client</name>\n  <description>UberFire - Project Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-ui-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/ArtifactIdChangeHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\npublic interface ArtifactIdChangeHandler {\n\n    void onChange(String newArtifactId);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/GAVEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\nimport java.util.ArrayList;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.common.services.project.model.GAV;\n\npublic class GAVEditor\n        implements GAVEditorView.Presenter,\n                   IsWidget {\n\n    private final GAVEditorView view;\n    private GAV gav;\n    private ArrayList<GroupIdChangeHandler> groupIdChangeHandlers = new ArrayList<GroupIdChangeHandler>();\n    private ArrayList<ArtifactIdChangeHandler> artifactIdChangeHandlers = new ArrayList<ArtifactIdChangeHandler>();\n    private ArrayList<VersionChangeHandler> versionChangeHandlers = new ArrayList<VersionChangeHandler>();\n\n    @Inject\n    public GAVEditor(final GAVEditorView view) {\n        this.view = view;\n        view.setPresenter(this);\n    }\n\n    @Override\n    public void setGAV(final GAV gav) {\n        this.gav = gav;\n        view.setGroupId(gav.getGroupId());\n        view.setArtifactId(gav.getArtifactId());\n        view.setVersion(gav.getVersion());\n    }\n\n    @Override\n    public void setArtifactID(final String artifactID) {\n        view.setArtifactId(artifactID);\n        gav.setArtifactId(artifactID);\n    }\n\n    @Override\n    public void onGroupIdChange(final String groupId) {\n        gav.setGroupId(groupId);\n        for (GroupIdChangeHandler handler : groupIdChangeHandlers) {\n            handler.onChange(groupId);\n        }\n    }\n\n    @Override\n    public void onArtifactIdChange(final String artifactId) {\n        gav.setArtifactId(artifactId);\n        for (ArtifactIdChangeHandler handler : artifactIdChangeHandlers) {\n            handler.onChange(artifactId);\n        }\n    }\n\n    @Override\n    public void onVersionChange(final String version) {\n        gav.setVersion(version);\n        for (VersionChangeHandler handler : versionChangeHandlers) {\n            handler.onChange(version);\n        }\n    }\n\n    @Override\n    public void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler) {\n        groupIdChangeHandlers.add(changeHandler);\n    }\n\n    @Override\n    public void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler) {\n        artifactIdChangeHandlers.add(changeHandler);\n    }\n\n    @Override\n    public void addVersionChangeHandler(final VersionChangeHandler changeHandler) {\n        versionChangeHandlers.add(changeHandler);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void setReadOnly() {\n        view.setReadOnly();\n    }\n\n    @Override\n    public void disableGroupID(final String reason) {\n        view.disableGroupID(reason);\n    }\n\n    @Override\n    public void disableVersion(final String reason) {\n        view.disableVersion(reason);\n    }\n\n    @Override\n    public void disableArtifactID(final String reason) {\n        view.disableArtifactID(reason);\n    }\n\n    @Override\n    public void enableGroupID() {\n        view.enableGroupID();\n    }\n\n    @Override\n    public void enableArtifactID() {\n        view.enableArtifactID();\n    }\n\n    @Override\n    public void enableVersion() {\n        view.enableVersion();\n    }\n\n    @Override\n    public void setValidGroupID(final boolean isValid) {\n        view.setValidGroupID(isValid);\n    }\n\n    @Override\n    public void setValidArtifactID(final boolean isValid) {\n        view.setValidArtifactID(isValid);\n    }\n\n    @Override\n    public void setValidVersion(final boolean isValid) {\n        view.setValidVersion(isValid);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/GAVEditorView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.common.services.project.model.GAV;\n\npublic interface GAVEditorView\n        extends IsWidget {\n\n    interface Presenter {\n\n        void setGAV(final GAV gav);\n\n        void setArtifactID(final String artifactID);\n\n        void onGroupIdChange(final String groupId);\n\n        void onArtifactIdChange(final String artifactId);\n\n        void onVersionChange(final String version);\n\n        void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler);\n\n        void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler);\n\n        void addVersionChangeHandler(final VersionChangeHandler changeHandler);\n\n        void setReadOnly();\n\n        void disableGroupID(final String reason);\n\n        void disableVersion(final String reason);\n\n        void disableArtifactID(final String reason);\n\n        void enableGroupID();\n\n        void enableArtifactID();\n\n        void enableVersion();\n\n        void setValidGroupID(final boolean isValid);\n\n        void setValidArtifactID(final boolean isValid);\n\n        void setValidVersion(final boolean isValid);\n    }\n\n    void setPresenter(final Presenter presenter);\n\n    void setGroupId(final String id);\n\n    void setArtifactId(final String id);\n\n    void setReadOnly();\n\n    void setVersion(final String version);\n\n    void disableGroupID(final String reason);\n\n    void disableArtifactID(final String reason);\n\n    void disableVersion(final String reason);\n\n    void enableGroupID();\n\n    void enableArtifactID();\n\n    void enableVersion();\n\n    void setValidGroupID(final boolean isValid);\n\n    void setValidArtifactID(final boolean isValid);\n\n    void setValidVersion(final boolean isValid);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/GAVEditorViewImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.common.services.project.client.resources.ProjectResources;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\npublic class GAVEditorViewImpl\n        extends Composite\n        implements GAVEditorView {\n\n    interface Binder\n            extends UiBinder<Widget, GAVEditorViewImpl> {\n\n    }\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    FormGroup groupIdGroup;\n\n    @UiField\n    TextBox groupIdTextBox;\n\n    @UiField\n    HelpBlock groupIdHelpBlock;\n\n    @UiField\n    FormGroup artifactIdGroup;\n\n    @UiField\n    TextBox artifactIdTextBox;\n\n    @UiField\n    HelpBlock artifactIdHelpBlock;\n\n    @UiField\n    FormGroup versionGroup;\n\n    @UiField\n    TextBox versionTextBox;\n\n    @UiField\n    HelpBlock versionHelpBlock;\n\n    private Presenter presenter;\n\n    public GAVEditorViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void setPresenter(final Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setGroupId(final String id) {\n        groupIdTextBox.setText(id);\n    }\n\n    @Override\n    public void setArtifactId(final String id) {\n        artifactIdTextBox.setText(id);\n    }\n\n    @Override\n    public void setVersion(final String version) {\n        versionTextBox.setText(version);\n    }\n\n    @Override\n    public void disableGroupID(final String reason) {\n        groupIdTextBox.setEnabled(false);\n        groupIdTextBox.setTitle(reason);\n    }\n\n    @Override\n    public void disableArtifactID(final String reason) {\n        artifactIdTextBox.setEnabled(false);\n        artifactIdTextBox.setTitle(reason);\n    }\n\n    @Override\n    public void disableVersion(final String reason) {\n        versionTextBox.setEnabled(false);\n        versionTextBox.setTitle(reason);\n    }\n\n    @Override\n    public void setReadOnly() {\n        groupIdTextBox.setReadOnly(true);\n        artifactIdTextBox.setReadOnly(true);\n        versionTextBox.setReadOnly(true);\n    }\n\n    @Override\n    public void enableGroupID() {\n        groupIdTextBox.setEnabled(true);\n        groupIdTextBox.setTitle(\"\");\n    }\n\n    @Override\n    public void enableArtifactID() {\n        artifactIdTextBox.setEnabled(true);\n        artifactIdTextBox.setTitle(\"\");\n    }\n\n    @Override\n    public void enableVersion() {\n        versionTextBox.setEnabled(true);\n        versionTextBox.setTitle(\"\");\n    }\n\n    @Override\n    public void setValidGroupID(final boolean isValid) {\n        if (isValid) {\n            groupIdGroup.setValidationState(ValidationState.NONE);\n            groupIdHelpBlock.setText(\"\");\n        } else {\n            groupIdGroup.setValidationState(ValidationState.ERROR);\n            groupIdHelpBlock.setText(ProjectResources.CONSTANTS.invalidGroupId());\n        }\n    }\n\n    @Override\n    public void setValidArtifactID(final boolean isValid) {\n        if (isValid) {\n            artifactIdGroup.setValidationState(ValidationState.NONE);\n            artifactIdHelpBlock.setText(\"\");\n        } else {\n            artifactIdGroup.setValidationState(ValidationState.ERROR);\n            artifactIdHelpBlock.setText(ProjectResources.CONSTANTS.invalidArtifactId());\n        }\n    }\n\n    @Override\n    public void setValidVersion(final boolean isValid) {\n        if (isValid) {\n            versionGroup.setValidationState(ValidationState.NONE);\n            versionHelpBlock.setText(\"\");\n        } else {\n            versionGroup.setValidationState(ValidationState.ERROR);\n            versionHelpBlock.setText(ProjectResources.CONSTANTS.invalidVersion());\n        }\n    }\n\n    @UiHandler(\"groupIdTextBox\")\n    //Use KeyUpEvent as ValueChangeEvent is only fired when the focus is lost\n    public void onGroupIdChange(final KeyUpEvent event) {\n        presenter.onGroupIdChange(groupIdTextBox.getText());\n    }\n\n    @UiHandler(\"artifactIdTextBox\")\n    //Use KeyUpEvent as ValueChangeEvent is only fired when the focus is lost\n    public void onArtifactIdChange(final KeyUpEvent event) {\n        presenter.onArtifactIdChange(artifactIdTextBox.getText());\n    }\n\n    @UiHandler(\"versionTextBox\")\n    //Use KeyUpEvent as ValueChangeEvent is only fired when the focus is lost\n    public void onVersionChange(final KeyUpEvent event) {\n        presenter.onVersionChange(versionTextBox.getText());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/GAVEditorViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'\n             xmlns:b='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:p=\"urn:import:org.uberfire.client.views.pfly.widgets\">\n\n    <ui:with field=\"i18n\"\n             type=\"org.guvnor.common.services.project.client.resources.i18n.ProjectConstants\"/>\n    <ui:with field=\"resources\"\n             type=\"org.guvnor.common.services.project.client.resources.ProjectResources\"/>\n\n    <gwt:HTMLPanel>\n        <b:Form type=\"HORIZONTAL\">\n            <b:FormGroup ui:field=\"groupIdGroup\">\n                <p:FormLabelHelp for=\"groupIdTextBox\" text=\"{i18n.GroupID}\" addStyleNames=\"col-md-4\" helpTitle=\"{i18n.MoreInfo}\" helpContent=\"{i18n.GroupIdMoreInfo}\"/>\n                <b:Column size=\"MD_8\">\n                    <b:TextBox b:id=\"groupIdTextBox\" ui:field=\"groupIdTextBox\" placeholder=\"{i18n.EnterAGroupID}\"/>\n                    <b:HelpBlock text=\"{i18n.GroupIdExample}\"/>\n                    <b:HelpBlock ui:field=\"groupIdHelpBlock\"/>\n                </b:Column>\n            </b:FormGroup>\n\n            <b:FormGroup ui:field=\"artifactIdGroup\">\n                <p:FormLabelHelp for=\"artifactIdTextBox\" text=\"{i18n.ArtifactID}\" addStyleNames=\"col-md-4\" helpTitle=\"{i18n.MoreInfo}\" helpContent=\"{i18n.ArtifactIDMoreInfo}\"/>\n                <b:Column size=\"MD_8\">\n                    <b:TextBox b:id=\"artifactIdTextBox\" ui:field=\"artifactIdTextBox\" placeholder=\"{i18n.EnterAnArtifactID}\"/>\n                    <b:HelpBlock text=\"{i18n.ArtifactIDExample}\"/>\n                    <b:HelpBlock ui:field=\"artifactIdHelpBlock\"/>\n                </b:Column>\n            </b:FormGroup>\n\n            <b:FormGroup ui:field=\"versionGroup\">\n                <p:FormLabelHelp for=\"versionTextBox\" text=\"{i18n.Version}\" addStyleNames=\"col-md-4\" helpTitle=\"{i18n.MoreInfo}\" helpContent=\"{i18n.VersionMoreInfo}\"/>\n                <b:Column size=\"MD_8\">\n                    <b:TextBox b:id=\"versionTextBox\" ui:field=\"versionTextBox\" placeholder=\"{i18n.EnterAVersion}\"/>\n                    <b:HelpBlock text=\"{i18n.VersionExample}\"/>\n                    <b:HelpBlock ui:field=\"versionHelpBlock\"/>\n                </b:Column>\n            </b:FormGroup>\n\n        </b:Form>\n    </gwt:HTMLPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/GroupIdChangeHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\npublic interface GroupIdChangeHandler {\n\n    void onChange(String newGroupId);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/NameChangeHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\npublic interface NameChangeHandler {\n\n    void onChange(String newName);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/POMEditorPanel.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport java.util.ArrayList;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.preferences.GAVPreferences;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PlaceManager;\n\n@Dependent\npublic class POMEditorPanel\n        implements POMEditorPanelView.Presenter,\n                   IsWidget {\n\n    private ArrayList<NameChangeHandler> nameChangeHandlers = new ArrayList<NameChangeHandler>();\n    private POMEditorPanelView view;\n    private SyncBeanManager iocManager;\n    private POM model;\n    private GAVPreferences gavPreferences;\n    private ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier;\n\n    public POMEditorPanel() {\n    }\n\n    @Inject\n    public POMEditorPanel(final POMEditorPanelView view,\n                          final SyncBeanManager iocManager,\n                          final GAVPreferences gavPreferences,\n                          final ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier) {\n        this.view = view;\n        this.iocManager = iocManager;\n        this.gavPreferences = gavPreferences;\n        this.projectScopedResolutionStrategySupplier = projectScopedResolutionStrategySupplier;\n        view.setPresenter(this);\n    }\n\n    public void setPOM(POM model,\n                       boolean isReadOnly) {\n        if (isReadOnly) {\n            view.setReadOnly();\n        }\n\n        this.model = model;\n\n        gavPreferences.load(projectScopedResolutionStrategySupplier.get(),\n                            loadedGAVPreferences -> {\n                                view.setName(model.getName());\n                                view.setDescription(model.getDescription());\n                                view.enableGroupID();\n                                view.enableArtifactID();\n                                view.enableVersion();\n\n                                if (model.hasParent()) {\n                                    view.setParentGAV(model.getParent());\n                                    view.showParentGAV();\n                                    if (!loadedGAVPreferences.isChildGAVEditEnabled()) {\n                                        view.disableGroupID(\"\");\n                                        view.disableVersion(\"\");\n                                    }\n                                } else {\n                                    view.hideParentGAV();\n                                }\n\n                                view.setGAV(model.getGav());\n                                view.addArtifactIdChangeHandler(POMEditorPanel.this::setTitle);\n                                setTitle(model.getGav().getArtifactId());\n                            },\n                            throwable -> {\n                                throw new RuntimeException(throwable);\n                            });\n    }\n\n    public void setArtifactID(final String artifactID) {\n        view.setArtifactID(artifactID);\n    }\n\n    private void setTitle(final String titleText) {\n        if (titleText == null || titleText.isEmpty()) {\n            view.setProjectModelTitleText();\n        } else {\n            view.setTitleText(titleText);\n        }\n    }\n\n    @Override\n    public void addNameChangeHandler(final NameChangeHandler changeHandler) {\n        nameChangeHandlers.add(changeHandler);\n    }\n\n    @Override\n    public void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler) {\n        this.view.addGroupIdChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler) {\n        this.view.addArtifactIdChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void addVersionChangeHandler(final VersionChangeHandler changeHandler) {\n        this.view.addVersionChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void onNameChange(final String name) {\n        this.model.setName(name);\n        for (NameChangeHandler changeHandler : nameChangeHandlers) {\n            changeHandler.onChange(name);\n        }\n    }\n\n    @Override\n    public void onDescriptionChange(final String description) {\n        this.model.setDescription(description);\n    }\n\n    @Override\n    public void onOpenProjectContext() {\n        SyncBeanDef<PlaceManager> placeManagerSyncBeanDef = iocManager.lookupBean(PlaceManager.class);\n        placeManagerSyncBeanDef.getInstance().goTo(\"repositoryStructureScreen\");\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void disableGroupID(final String reason) {\n        view.disableGroupID(reason);\n    }\n\n    @Override\n    public void disableVersion(final String reason) {\n        view.disableVersion(reason);\n    }\n\n    @Override\n    public POM getPom() {\n        return model;\n    }\n\n    @Override\n    public void setValidName(final boolean isValid) {\n        view.setValidName(isValid);\n    }\n\n    @Override\n    public void setValidGroupID(final boolean isValid) {\n        view.setValidGroupID(isValid);\n    }\n\n    @Override\n    public void setValidArtifactID(final boolean isValid) {\n        view.setValidArtifactID(isValid);\n    }\n\n    @Override\n    public void setValidVersion(final boolean isValid) {\n        view.setValidVersion(isValid);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/POMEditorPanelView.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.POM;\nimport org.uberfire.ext.widgets.common.client.common.HasBusyIndicator;\n\npublic interface POMEditorPanelView extends HasBusyIndicator,\n                                            IsWidget {\n\n    interface Presenter {\n\n        void addNameChangeHandler(final NameChangeHandler changeHandler);\n\n        void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler);\n\n        void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler);\n\n        void addVersionChangeHandler(final VersionChangeHandler changeHandler);\n\n        void onNameChange(final String name);\n\n        void onDescriptionChange(final String description);\n\n        void onOpenProjectContext();\n\n        void disableGroupID(final String reason);\n\n        void disableVersion(final String reason);\n\n        POM getPom();\n\n        void setValidName(final boolean isValid);\n\n        void setValidGroupID(final boolean isValid);\n\n        void setValidArtifactID(final boolean isValid);\n\n        void setValidVersion(final boolean isValid);\n    }\n\n    void setPresenter(final Presenter presenter);\n\n    String getTitleWidget();\n\n    void setTitleText(final String titleText);\n\n    void setProjectModelTitleText();\n\n    void showSaveSuccessful(final String fileName);\n\n    void setName(final String projectName);\n\n    void setDescription(final String projectDescription);\n\n    void setArtifactID(final String artifactID);\n\n    void showParentGAV();\n\n    void hideParentGAV();\n\n    void setParentGAV(GAV gav);\n\n    void setGAV(GAV gav);\n\n    void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler);\n\n    void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler);\n\n    void addVersionChangeHandler(final VersionChangeHandler changeHandler);\n\n    void setReadOnly();\n\n    void disableGroupID(final String reason);\n\n    void disableArtifactID(final String reason);\n\n    void disableVersion(final String reason);\n\n    void enableGroupID();\n\n    void enableArtifactID();\n\n    void enableVersion();\n\n    void setValidName(final boolean isValid);\n\n    void setValidGroupID(final boolean isValid);\n\n    void setValidArtifactID(final boolean isValid);\n\n    void setValidVersion(final boolean isValid);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/POMEditorPanelViewImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.common.services.project.client.resources.ProjectResources;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.gwtbootstrap3.client.ui.FieldSet;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.TextArea;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.workbench.events.NotificationEvent;\n\npublic class POMEditorPanelViewImpl\n        extends Composite\n        implements POMEditorPanelView {\n\n    private String tabTitleLabel = ProjectResources.CONSTANTS.ProjectModel();\n\n    interface GroupArtifactVersionEditorPanelViewImplBinder\n            extends\n            UiBinder<Widget, POMEditorPanelViewImpl> {\n\n    }\n\n    private static GroupArtifactVersionEditorPanelViewImplBinder uiBinder = GWT.create(GroupArtifactVersionEditorPanelViewImplBinder.class);\n\n    private Event<NotificationEvent> notificationEvent;\n\n    @UiField\n    TextBox pomNameTextBox;\n\n    @UiField\n    FormGroup pomNameGroup;\n\n    @UiField\n    HelpBlock pomNameHelpBlock;\n\n    @UiField\n    TextArea pomDescriptionTextArea;\n\n    @UiField(provided = true)\n    GAVEditor gavEditor;\n\n    @UiField(provided = true)\n    GAVEditor parentGavEditor;\n\n    @UiField\n    FieldSet parentGavEditorFieldSet;\n\n    private Presenter presenter;\n\n    public POMEditorPanelViewImpl() {\n    }\n\n    @Inject\n    public POMEditorPanelViewImpl(final Event<NotificationEvent> notificationEvent,\n                                  final GAVEditor parentGavEditor,\n                                  final GAVEditor gavEditor) {\n        this.notificationEvent = notificationEvent;\n        this.parentGavEditor = parentGavEditor;\n        this.gavEditor = gavEditor;\n\n        initWidget(uiBinder.createAndBindUi(this));\n\n        parentGavEditor.disableGroupID(\"\");\n        parentGavEditor.disableArtifactID(\"\");\n        parentGavEditor.disableVersion(\"\");\n    }\n\n    @Override\n    public void setPresenter(final Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showSaveSuccessful(final String fileName) {\n        notificationEvent.fire(new NotificationEvent(ProjectResources.CONSTANTS.SaveSuccessful(fileName)));\n    }\n\n    @Override\n    public String getTitleWidget() {\n        return tabTitleLabel;\n    }\n\n    @Override\n    public void setName(final String projectName) {\n        pomNameTextBox.setText(projectName);\n    }\n\n    @Override\n    public void setDescription(final String projectDescription) {\n        pomDescriptionTextArea.setText(projectDescription);\n    }\n\n    @Override\n    public void setArtifactID(final String artifactID) {\n        gavEditor.setArtifactID(artifactID);\n    }\n\n    @Override\n    public void showParentGAV() {\n        parentGavEditorFieldSet.setVisible(true);\n    }\n\n    @Override\n    public void hideParentGAV() {\n        parentGavEditorFieldSet.setVisible(false);\n    }\n\n    @Override\n    public void setParentGAV(final GAV gav) {\n        parentGavEditor.setGAV(gav);\n    }\n\n    @Override\n    public void setGAV(final GAV gav) {\n        gavEditor.setGAV(gav);\n    }\n\n    @Override\n    public void addGroupIdChangeHandler(final GroupIdChangeHandler changeHandler) {\n        gavEditor.addGroupIdChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void addArtifactIdChangeHandler(final ArtifactIdChangeHandler changeHandler) {\n        gavEditor.addArtifactIdChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void addVersionChangeHandler(final VersionChangeHandler changeHandler) {\n        gavEditor.addVersionChangeHandler(changeHandler);\n    }\n\n    @Override\n    public void setReadOnly() {\n        gavEditor.setReadOnly();\n    }\n\n    @Override\n    public void disableGroupID(final String reason) {\n        gavEditor.disableGroupID(reason);\n    }\n\n    @Override\n    public void disableArtifactID(final String reason) {\n        gavEditor.disableArtifactID(reason);\n    }\n\n    @Override\n    public void disableVersion(final String reason) {\n        gavEditor.disableVersion(reason);\n    }\n\n    @Override\n    public void enableGroupID() {\n        gavEditor.enableGroupID();\n    }\n\n    @Override\n    public void enableArtifactID() {\n        gavEditor.enableArtifactID();\n    }\n\n    @Override\n    public void enableVersion() {\n        gavEditor.enableVersion();\n    }\n\n    @Override\n    public void setTitleText(final String titleText) {\n        tabTitleLabel = titleText;\n    }\n\n    @Override\n    public void setProjectModelTitleText() {\n        tabTitleLabel = ProjectResources.CONSTANTS.ProjectModel();\n    }\n\n    @Override\n    public void showBusyIndicator(final String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public void setValidName(final boolean isValid) {\n        if (isValid) {\n            pomNameGroup.setValidationState(ValidationState.NONE);\n            pomNameHelpBlock.setText(\"\");\n        } else {\n            pomNameGroup.setValidationState(ValidationState.ERROR);\n            pomNameHelpBlock.setText(ProjectResources.CONSTANTS.invalidName());\n        }\n    }\n\n    @Override\n    public void setValidGroupID(final boolean isValid) {\n        gavEditor.setValidGroupID(isValid);\n    }\n\n    @Override\n    public void setValidArtifactID(final boolean isValid) {\n        gavEditor.setValidArtifactID(isValid);\n    }\n\n    @Override\n    public void setValidVersion(final boolean isValid) {\n        gavEditor.setValidVersion(isValid);\n    }\n\n    @UiHandler(\"pomNameTextBox\")\n    //Use KeyUpEvent as ValueChangeEvent is only fired when the focus is lost\n    public void onNameChange(final KeyUpEvent event) {\n        presenter.onNameChange(pomNameTextBox.getText());\n    }\n\n    @UiHandler(\"openProjectContext\")\n    public void onOpenProjectContext(final ClickEvent event) {\n        presenter.onOpenProjectContext();\n    }\n\n    @UiHandler(\"pomDescriptionTextArea\")\n    public void onDescriptionChange(final ValueChangeEvent<String> event) {\n        presenter.onDescriptionChange(pomDescriptionTextArea.getText());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/POMEditorPanelViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'\n             xmlns:gwt='urn:import:com.google.gwt.user.client.ui'\n             xmlns:bootstrap='urn:import:org.gwtbootstrap3.client.ui'\n             xmlns:guvnor='urn:import:org.guvnor.common.services.project.client'>\n\n  <ui:with field=\"i18n\" type=\"org.guvnor.common.services.project.client.resources.i18n.ProjectConstants\"/>\n  <ui:with field=\"resources\" type=\"org.guvnor.common.services.project.client.resources.ProjectResources\"/>\n\n  <gwt:HTMLPanel>\n        <bootstrap:Form type=\"HORIZONTAL\">\n          <bootstrap:FieldSet>\n\n            <bootstrap:Legend>\n              <ui:text from=\"{i18n.ProjectGeneralSettings}\"/>\n            </bootstrap:Legend>\n\n            <bootstrap:FormGroup ui:field=\"pomNameGroup\">\n              <bootstrap:FormLabel text=\"{i18n.ProjectName}\" addStyleNames=\"col-md-4\"/>\n              <bootstrap:Column size=\"MD_8\">\n                <bootstrap:TextBox ui:field=\"pomNameTextBox\" placeholder=\"{i18n.ProjectNamePlaceHolder}\"/>\n                <bootstrap:HelpBlock ui:field=\"pomNameHelpBlock\"/>\n              </bootstrap:Column>\n            </bootstrap:FormGroup>\n\n            <bootstrap:FormGroup>\n              <bootstrap:FormLabel text=\"{i18n.ProjectDescription}\" addStyleNames=\"col-md-4\"/>\n              <bootstrap:Column size=\"MD_8\">\n                <bootstrap:TextArea ui:field=\"pomDescriptionTextArea\" placeholder=\"{i18n.ProjectDescriptionPlaceHolder}\"/>\n              </bootstrap:Column>\n            </bootstrap:FormGroup>\n\n          </bootstrap:FieldSet>\n\n          <bootstrap:FieldSet ui:field=\"parentGavEditorFieldSet\" visible=\"false\">\n            <bootstrap:Legend>\n              <ui:text from=\"{i18n.ParentsGroupArtifactVersion}\"/>\n            </bootstrap:Legend>\n\n            <bootstrap:Button ui:field=\"openProjectContext\" addStyleNames=\"btn-mini\" text=\"Open Project Context\"/>\n            <guvnor:GAVEditor ui:field=\"parentGavEditor\"/>\n          </bootstrap:FieldSet>\n\n          <bootstrap:FieldSet>\n            <bootstrap:Legend>\n              <ui:text from=\"{i18n.GroupArtifactVersion}\"/>\n            </bootstrap:Legend>\n\n            <guvnor:GAVEditor ui:field=\"gavEditor\"/>\n          </bootstrap:FieldSet>\n\n        </bootstrap:Form>\n  </gwt:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/ProjectEntryPoint.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.kie.soup.commons.util.Sets;\nimport org.uberfire.ext.preferences.client.admin.page.AdminPage;\n\n@EntryPoint\n@Bundle(\"preferences/resources/i18n/ProjectPreferencesConstants.properties\")\npublic class ProjectEntryPoint {\n\n    private AdminPage adminPage;\n\n    private ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier;\n\n    @Inject\n    public ProjectEntryPoint(final AdminPage adminPage,\n                             final ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier) {\n        this.adminPage = adminPage;\n        this.projectScopedResolutionStrategySupplier = projectScopedResolutionStrategySupplier;\n    }\n\n    @PostConstruct\n    public void startApp() {\n        setupProjectAdminPage();\n    }\n\n    private void setupProjectAdminPage() {\n        adminPage.addScreen(\"project\",\n                            \"Project Settings\");\n\n        adminPage.addPreference(\"project\",\n                                \"GeneralPreferences\",\n                                \"General\",\n                                new Sets.Builder().add(\"fa\").add(\"fa-gears\").build(),\n                                \"general\",\n                                projectScopedResolutionStrategySupplier);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/VersionChangeHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client;\n\npublic interface VersionChangeHandler {\n\n    void onChange(String newVersion);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/context/WorkspaceProjectContext.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.project.client.context;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.context.ProjectContextChangeHandle;\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeHandler;\nimport org.guvnor.common.services.project.events.ModuleUpdatedEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.UpdatedOrganizationalUnitEvent;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * <p>\n * Project context contains the active organizational unit, project, module, and package (referred to as the \"active unit\" henceforth).\n * This context represents the active unit currently displayed in the UI by this workbench instance. If a screen or perspective that displays\n * an active unit is shown or hidden, it is that screen's responsibility (or that of a related component) to fire a WorkspaceProjectContextChangeEvent\n * to alter the context. This context should NOT directly observe deletion events. Instead it should be the relevant UI components job to observe such\n * events and react (likely by closing themselves, and changing the active unit in this context).\n * <p>\n * Each field can be null, then there is nothing active.\n * <p>\n * Only the WorkspaceProjectContextChangeEvent can change this and after each change we need to alert the change handlers.\n */\n@ApplicationScoped\npublic class WorkspaceProjectContext {\n\n    private OrganizationalUnit activeOrganizationalUnit;\n    private WorkspaceProject activeWorkspaceProject;\n    private Module activeModule;\n    private Package activePackage;\n\n    private Map<ProjectContextChangeHandle, WorkspaceProjectContextChangeHandler> changeHandlers = new HashMap<>();\n\n    private Event<WorkspaceProjectContextChangeEvent> contextChangeEvent;\n\n    public WorkspaceProjectContext() {\n    }\n\n    @Inject\n    public WorkspaceProjectContext(final Event<WorkspaceProjectContextChangeEvent> contextChangeEvent) {\n        this.contextChangeEvent = contextChangeEvent;\n    }\n\n    public void onOrganizationalUnitUpdated(@Observes final UpdatedOrganizationalUnitEvent event) {\n        if (activeWorkspaceProject != null) {\n            WorkspaceProject updatedWorkspaceProject = new WorkspaceProject(event.getOrganizationalUnit(),\n                                                                            activeWorkspaceProject.getRepository(),\n                                                                            activeWorkspaceProject.getBranch(),\n                                                                            activeWorkspaceProject.getMainModule());\n            contextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(updatedWorkspaceProject,\n                                                                           activeModule,\n                                                                           activePackage));\n        }\n    }\n\n    public void onModuleUpdated(@Observes final ModuleUpdatedEvent moduleUpdatedEvent) {\n        if (activeModule != null && activeModule.getRootPath().equals(moduleUpdatedEvent.getOldModule().getRootPath())) {\n            contextChangeEvent.fire(new WorkspaceProjectContextChangeEvent(new WorkspaceProject(activeWorkspaceProject.getOrganizationalUnit(),\n                                                                                                activeWorkspaceProject.getRepository(),\n                                                                                                activeWorkspaceProject.getBranch(),\n                                                                                                moduleUpdatedEvent.getNewModule()),\n                                                                           moduleUpdatedEvent.getNewModule()));\n        }\n    }\n\n    public void onProjectContextChanged(@Observes final WorkspaceProjectContextChangeEvent event) {\n        WorkspaceProjectContextChangeEvent previous = new WorkspaceProjectContextChangeEvent(activeWorkspaceProject,\n                                                                                             activeModule,\n                                                                                             activePackage);\n\n        this.setActiveOrganizationalUnit(event.getOrganizationalUnit());\n        this.setActiveWorkspaceProject(event.getWorkspaceProject());\n        this.setActiveModule(event.getModule());\n        this.setActivePackage(event.getPackage());\n\n        for (WorkspaceProjectContextChangeHandler handler : changeHandlers.values()) {\n            handler.onChange(previous,\n                             event);\n        }\n    }\n\n    public Optional<Path> getActiveRepositoryRoot() {\n        return getActiveWorkspaceProject().map(proj -> proj.getBranch()).map(branch -> branch.getPath());\n    }\n\n    protected void setActiveOrganizationalUnit(final OrganizationalUnit activeOrganizationalUnit) {\n        this.activeOrganizationalUnit = activeOrganizationalUnit;\n    }\n\n    public Optional<OrganizationalUnit> getActiveOrganizationalUnit() {\n        return Optional.ofNullable(this.activeOrganizationalUnit);\n    }\n\n    protected void setActiveWorkspaceProject(final WorkspaceProject activeWorkspaceProject) {\n        this.activeWorkspaceProject = activeWorkspaceProject;\n    }\n\n    public Optional<WorkspaceProject> getActiveWorkspaceProject() {\n        return Optional.ofNullable(this.activeWorkspaceProject);\n    }\n\n    public Optional<Module> getActiveModule() {\n        return Optional.ofNullable(this.activeModule);\n    }\n\n    protected void setActiveModule(final Module activeModule) {\n        this.activeModule = activeModule;\n    }\n\n    public Optional<Package> getActivePackage() {\n        return Optional.ofNullable(this.activePackage);\n    }\n\n    protected void setActivePackage(final Package activePackage) {\n        this.activePackage = activePackage;\n    }\n\n    public ProjectContextChangeHandle addChangeHandler(final WorkspaceProjectContextChangeHandler changeHandler) {\n        ProjectContextChangeHandle handle = new ProjectContextChangeHandle();\n        changeHandlers.put(handle,\n                           changeHandler);\n        return handle;\n    }\n\n    public void removeChangeHandler(final ProjectContextChangeHandle projectContextChangeHandle) {\n        changeHandlers.remove(projectContextChangeHandle);\n    }\n\n    public void updateProjectModule(final Module module) {\n        this.activeModule = module;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/preferences/ProjectScopedResolutionStrategySupplier.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.preferences;\n\nimport java.util.function.Supplier;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n@ApplicationScoped\npublic class ProjectScopedResolutionStrategySupplier implements Supplier<PreferenceScopeResolutionStrategyInfo> {\n\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    private Module module;\n\n    public ProjectScopedResolutionStrategySupplier() {\n    }\n\n    @Inject\n    public ProjectScopedResolutionStrategySupplier(final WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies) {\n        this.scopeResolutionStrategies = scopeResolutionStrategies;\n    }\n\n    public void selectedProjectChanged(@Observes final WorkspaceProjectContextChangeEvent event) {\n        this.module = event.getModule();\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo get() {\n        if (module == null) {\n            return scopeResolutionStrategies.getUserInfoFor(null, null);\n        }\n\n        final String projectIdentifier = module.getEncodedIdentifier();\n        return scopeResolutionStrategies.getUserInfoFor(\"project\", projectIdentifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/preferences/SpaceScopedResolutionStrategySupplier.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.preferences;\n\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n@ApplicationScoped\npublic class SpaceScopedResolutionStrategySupplier implements Supplier<PreferenceScopeResolutionStrategyInfo> {\n\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    private OrganizationalUnit organizationalUnit;\n\n    public SpaceScopedResolutionStrategySupplier() {\n    }\n\n    @Inject\n    public SpaceScopedResolutionStrategySupplier(final WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies) {\n        this.scopeResolutionStrategies = scopeResolutionStrategies;\n    }\n\n    public void onWorkspaceProjectContextChangeEvent(@Observes final WorkspaceProjectContextChangeEvent event) {\n        this.organizationalUnit = event.getOrganizationalUnit();\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo get() {\n        final String scopeKey = organizationalUnit != null ? organizationalUnit.getIdentifier() : null;\n        return scopeResolutionStrategies.getSpaceInfoFor(scopeKey);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/repositories/ConflictingRepositoriesPopup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.repositories;\n\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.shared.security.AppRoles;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class ConflictingRepositoriesPopup\n        implements ConflictingRepositoriesPopupView.Presenter {\n\n    private User identity;\n    private ConflictingRepositoriesPopupView view;\n\n    private Command okCommand;\n    private Command overrideCommand;\n\n    public ConflictingRepositoriesPopup() {\n    }\n\n    @Inject\n    public ConflictingRepositoriesPopup(final User identity,\n                                        final ConflictingRepositoriesPopupView view) {\n        this.identity = identity;\n        this.view = view;\n        view.init(this);\n    }\n\n    public void setContent(final GAV gav,\n                           final Set<MavenRepositoryMetadata> repositories,\n                           final Command overrideCommand) {\n        setContent(gav, repositories, null, overrideCommand);\n    }\n\n    public void setContent(final GAV gav,\n                           final Set<MavenRepositoryMetadata> metadata,\n                           final Command okCommand,\n                           final Command overrideCommand) {\n        checkNotNull(\"gav\", gav);\n        checkNotNull(\"metadata\", metadata);\n        checkNotNull(\"overrideCommand\", overrideCommand);\n\n        this.okCommand = okCommand;\n        this.overrideCommand = overrideCommand;\n\n        view.setContent(gav, metadata);\n\n        view.clear();\n        view.addOKButton();\n        if (isUserAdministrator()) {\n            view.addOverrideButton();\n        }\n    }\n\n    private boolean isUserAdministrator() {\n        final Set<Role> roles = identity.getRoles();\n        return roles.contains(new RoleImpl(AppRoles.ADMIN.getName()));\n    }\n\n    @Override\n    public void show() {\n        view.show();\n    }\n\n    @Override\n    public void override() {\n        safeExecute(overrideCommand);\n        view.hide();\n    }\n\n    @Override\n    public void hide() {\n        safeExecute(okCommand);\n        view.hide();\n    }\n\n    private void safeExecute(final Command command) {\n        if (command != null) {\n            command.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/repositories/ConflictingRepositoriesPopupView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.repositories;\n\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.uberfire.client.mvp.UberView;\n\npublic interface ConflictingRepositoriesPopupView\n        extends UberView<ConflictingRepositoriesPopupView.Presenter> {\n\n    interface Presenter {\n\n        void show();\n\n        void override();\n\n        void hide();\n    }\n\n    void clear();\n\n    void setContent(final GAV gav,\n                    final Set<MavenRepositoryMetadata> repositories);\n\n    void addOKButton();\n\n    void addOverrideButton();\n\n    void show();\n\n    void hide();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/repositories/ConflictingRepositoriesPopupViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.Set;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.cellview.client.TextColumn;\nimport com.google.gwt.user.cellview.client.TextHeader;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwt.view.client.ListDataProvider;\nimport org.guvnor.common.services.project.client.resources.ProjectResources;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.gwt.CellTable;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.GenericModalFooter;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.mvp.Command;\n\npublic class ConflictingRepositoriesPopupViewImpl\n        extends BaseModal\n        implements ConflictingRepositoriesPopupView {\n\n    interface Binder\n            extends UiBinder<Widget, ConflictingRepositoriesPopupViewImpl> {\n\n    }\n\n    private static Binder uiBinder = GWT.create(Binder.class);\n\n    @UiField\n    Heading header;\n\n    @UiField(provided = true)\n    CellTable<MavenRepositoryMetadata> table = new CellTable<MavenRepositoryMetadata>();\n\n    private final GenericModalFooter footer = new GenericModalFooter();\n\n    private Presenter presenter;\n\n    private List<MavenRepositoryMetadata> repositories = new ArrayList<MavenRepositoryMetadata>();\n    private ListDataProvider<MavenRepositoryMetadata> dataProvider = new ListDataProvider<MavenRepositoryMetadata>();\n\n    TextColumn<MavenRepositoryMetadata> repositoryIdColumn;\n    TextColumn<MavenRepositoryMetadata> repositoryUrlColumn;\n    TextColumn<MavenRepositoryMetadata> repositorySourceColumn;\n\n    public ConflictingRepositoriesPopupViewImpl() {\n        setTitle(ProjectResources.CONSTANTS.ConflictingRepositoriesTitle());\n        setBody(uiBinder.createAndBindUi(this));\n        add(footer);\n        setup();\n    }\n\n    private void setup() {\n        //Setup table\n        table.setStriped(true);\n        table.setCondensed(true);\n        table.setBordered(true);\n\n        //Columns\n        repositoryIdColumn = new TextColumn<MavenRepositoryMetadata>() {\n\n            @Override\n            public String getValue(final MavenRepositoryMetadata metadata) {\n                return metadata.getId();\n            }\n        };\n        repositoryUrlColumn = new TextColumn<MavenRepositoryMetadata>() {\n\n            @Override\n            public String getValue(final MavenRepositoryMetadata metadata) {\n                return metadata.getUrl();\n            }\n        };\n        repositorySourceColumn = new TextColumn<MavenRepositoryMetadata>() {\n\n            @Override\n            public String getValue(final MavenRepositoryMetadata metadata) {\n                switch (metadata.getSource()) {\n                    case LOCAL:\n                        return ProjectResources.CONSTANTS.RepositorySourceLocal();\n                    case PROJECT:\n                        return ProjectResources.CONSTANTS.RepositorySourceProject();\n                    case SETTINGS:\n                        return ProjectResources.CONSTANTS.RepositorySourceSettings();\n                    case DISTRIBUTION_MANAGEMENT:\n                        return ProjectResources.CONSTANTS.RepositorySourceDistributionManagement();\n                }\n                return ProjectResources.CONSTANTS.RepositorySourceUnknown();\n            }\n        };\n\n        table.addColumn(repositoryIdColumn,\n                        new TextHeader(ProjectResources.CONSTANTS.RepositoryId()));\n        table.addColumn(repositoryUrlColumn,\n                        new TextHeader(ProjectResources.CONSTANTS.RepositoryUrl()));\n        table.addColumn(repositorySourceColumn,\n                        new TextHeader(ProjectResources.CONSTANTS.RepositorySource()));\n\n        //Link data\n        dataProvider.addDataDisplay(table);\n        dataProvider.setList(repositories);\n    }\n\n    @Override\n    public void init(final Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        footer.clear();\n    }\n\n    @Override\n    public void setContent(final GAV gav,\n                           final Set<MavenRepositoryMetadata> repositories) {\n        this.repositories = sortRepositories(repositories);\n        this.dataProvider.setList(this.repositories);\n        this.header.setText(ProjectResources.CONSTANTS.ConflictingRepositoriesGAVDescription(gav.getGroupId(),\n                                                                                             gav.getArtifactId(),\n                                                                                             gav.getVersion()));\n    }\n\n    private List<MavenRepositoryMetadata> sortRepositories(final Set<MavenRepositoryMetadata> repositories) {\n        final List<MavenRepositoryMetadata> sortedRepositories = new ArrayList<MavenRepositoryMetadata>();\n        sortedRepositories.addAll(repositories);\n        Collections.sort(sortedRepositories,\n                (md1, md2) -> {\n                    if (md1.getSource().equals(md2.getSource())) {\n                        return md1.getId().compareToIgnoreCase(md2.getId());\n                    }\n                    return md1.getSource().ordinal() - md2.getSource().ordinal();\n                });\n        return sortedRepositories;\n    }\n\n    @Override\n    public void addOKButton() {\n        footer.addButton(CommonConstants.INSTANCE.OK(),\n                         presenter::hide,\n                         IconType.PLUS,\n                         ButtonType.PRIMARY);\n    }\n\n    @Override\n    public void addOverrideButton() {\n        footer.addButton(ProjectResources.CONSTANTS.ConflictingRepositoriesOverride(),\n                         presenter::override,\n                         ButtonType.DEFAULT);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/repositories/ConflictingRepositoriesPopupViewImpl.ui.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:bgwt=\"urn:import:org.gwtbootstrap3.client.ui.gwt\">\n\n  <ui:with field=\"i18n\" type=\"org.guvnor.common.services.project.client.resources.i18n.ProjectConstants\"/>\n\n  <ui:style>\n    .icon {\n      float: left;\n      padding-right: 20px;\n    }\n  </ui:style>\n\n  <g:VerticalPanel width=\"100%\">\n    <b:Well>\n      <b:Container fluid=\"true\">\n        <b:Icon type=\"EXCLAMATION_TRIANGLE\" size=\"TIMES3\" addStyleNames=\"{style.icon}\"/>\n        <b:Heading size=\"H5\" ui:field=\"header\"/>\n      </b:Container>\n    </b:Well>\n    <bgwt:CellTable ui:field=\"table\"/>\n  </g:VerticalPanel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/resources/ProjectResources.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport org.guvnor.common.services.project.client.resources.i18n.ProjectConstants;\n\npublic interface ProjectResources\n        extends\n        ClientBundle {\n\n    ProjectConstants CONSTANTS = GWT.create(ProjectConstants.class);\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.resources.i18n;\n\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface ProjectConstants\n        extends Messages {\n\n    String ProjectModel();\n\n    String SaveSuccessful(String fileName);\n\n    String GroupID();\n\n    String EnterAGroupID();\n\n    String GroupIdExample();\n\n    String MoreInfo();\n\n    String GroupIdMoreInfo();\n\n    String ProjectGeneralSettings();\n\n    String ProjectName();\n\n    String ProjectNamePlaceHolder();\n\n    String ProjectDescription();\n\n    String ProjectDescriptionPlaceHolder();\n\n    String ArtifactID();\n\n    String EnterAnArtifactID();\n\n    String ArtifactIDExample();\n\n    String Version();\n\n    String ArtifactIDMoreInfo();\n\n    String EnterAVersion();\n\n    String VersionExample();\n\n    String VersionMoreInfo();\n\n    String GroupArtifactVersion();\n\n    String ParentsGroupArtifactVersion();\n\n    String invalidGroupId();\n\n    String invalidArtifactId();\n\n    String invalidVersion();\n\n    String invalidName();\n\n    String ConflictingRepositoriesTitle();\n\n    String ConflictingRepositoriesGAVDescription(String groupId,\n                                                 String artifactId,\n                                                 String version);\n\n    String ConflictingRepositoriesOverride();\n\n    String RepositoryId();\n\n    String RepositoryUrl();\n\n    String RepositorySource();\n\n    String RepositorySourceLocal();\n\n    String RepositorySourceProject();\n\n    String RepositorySourceSettings();\n\n    String RepositorySourceDistributionManagement();\n\n    String RepositorySourceUnknown();\n\n    String ProjectsNode();\n\n    String ProjectsHelp();\n\n    String ProjectResource();\n\n    String ProjectActionRead();\n\n    String ProjectActionUpdate();\n\n    String ProjectActionDelete();\n\n    String ProjectActionCreate();\n\n    String ProjectActionBuild();\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/security/ProjectController.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.security;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport elemental2.promise.Promise;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.security.ProjectPermissionsService;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.config.RolePermissions;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.security.RepositoryAction;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n@ApplicationScoped\npublic class ProjectController {\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n    private Caller<ProjectPermissionsService> projectPermissionsService;\n    private Promises promises;\n\n    private static final String SHOW_PROJECT_TOOLBAR = \"projecttoolbar.show\";\n\n    private static final String SHOW_METRICS_TAB = \"metricstab.show\";\n\n    private static final String SHOW_CHANGEREQUEST_TAB = \"changerequesttab.show\";\n\n    @Inject\n    public ProjectController(final AuthorizationManager authorizationManager,\n                             final User user,\n                             final Caller<ProjectPermissionsService> projectPermissionsService,\n                             final Promises promises) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n        this.projectPermissionsService = projectPermissionsService;\n        this.promises = promises;\n    }\n\n    public boolean canViewProjectToolbar() {\n        return authorizationManager.authorize(SHOW_PROJECT_TOOLBAR,\n                                              user);\n    }\n\n    public boolean canViewMetricsTab() {\n        return authorizationManager.authorize(SHOW_METRICS_TAB,\n                                              user);\n    }\n\n    public boolean canViewChangeRequestTab() {\n        return authorizationManager.authorize(SHOW_CHANGEREQUEST_TAB,\n                                              user);\n    }\n\n    public boolean canCreateProjects(final OrganizationalUnit organizationalUnit) {\n        final boolean securityPermission = authorizationManager.authorize(Repository.RESOURCE_TYPE,\n                                                                          RepositoryAction.CREATE,\n                                                                          user);\n\n        return securityPermission\n                || userIsAtLeast(ContributorType.CONTRIBUTOR,\n                                 organizationalUnit.getContributors());\n    }\n\n    public boolean canReadProject(final WorkspaceProject workspaceProject) {\n        final boolean securityPermission = authorizationManager.authorize(workspaceProject.getRepository(),\n                                                                          RepositoryAction.READ,\n                                                                          user);\n\n        return securityPermission\n                || userIsAtLeast(ContributorType.OWNER,\n                                 workspaceProject.getOrganizationalUnit().getContributors())\n                || userIsAtLeast(ContributorType.CONTRIBUTOR,\n                                 workspaceProject.getRepository().getContributors());\n    }\n\n    public Promise<Boolean> canUpdateProject(final WorkspaceProject workspaceProject) {\n        return canUpdateBranch(workspaceProject,\n                               workspaceProject.getBranch());\n    }\n\n    public Promise<Boolean> canUpdateBranch(final WorkspaceProject workspaceProject,\n                                            final Branch branch) {\n        if (workspaceProject.getMainModule() == null) {\n            return promises.resolve(false);\n        }\n\n        if (authorizationManager.authorize(workspaceProject.getRepository(),\n                                           RepositoryAction.UPDATE,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(workspaceProject,\n                                     branch.getName(),\n                                     RolePermissions::canWrite);\n    }\n\n    public boolean canDeleteProject(final WorkspaceProject workspaceProject) {\n        final boolean securityPermission = authorizationManager.authorize(workspaceProject.getRepository(),\n                                                                          RepositoryAction.DELETE,\n                                                                          user);\n\n        return securityPermission\n                || userIsAtLeast(ContributorType.OWNER,\n                                 workspaceProject.getRepository().getContributors())\n                || userIsAtLeast(ContributorType.OWNER,\n                                 workspaceProject.getOrganizationalUnit().getContributors());\n    }\n\n    public Promise<Boolean> canBuildProject(final WorkspaceProject workspaceProject) {\n        if (workspaceProject.getMainModule() == null) {\n            return promises.resolve(false);\n        }\n\n        if (authorizationManager.authorize(workspaceProject.getRepository(),\n                                           RepositoryAction.BUILD,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(workspaceProject,\n                                     workspaceProject.getBranch().getName(),\n                                     RolePermissions::canWrite);\n    }\n\n    public Promise<Boolean> canDeployProject(final WorkspaceProject workspaceProject) {\n        if (workspaceProject.getMainModule() == null) {\n            return promises.resolve(false);\n        }\n\n        if (authorizationManager.authorize(workspaceProject.getRepository(),\n                                           RepositoryAction.BUILD,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(workspaceProject,\n                                     workspaceProject.getBranch().getName(),\n                                     RolePermissions::canDeploy);\n    }\n\n    public Promise<Boolean> canReadBranch(final WorkspaceProject project) {\n        return canReadBranch(project,\n                             project.getBranch().getName());\n    }\n\n    public Promise<Boolean> canReadBranch(final WorkspaceProject project,\n                                          final String branch) {\n        if (authorizationManager.authorize(project.getRepository(),\n                                           RepositoryAction.READ,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(project,\n                                     branch,\n                                     RolePermissions::canRead);\n    }\n\n    public Promise<Boolean> canDeleteBranch(final WorkspaceProject project) {\n        return canDeleteBranch(project,\n                               project.getBranch().getName());\n    }\n\n    public Promise<Boolean> canSubmitChangeRequest(final WorkspaceProject project) {\n        return canSubmitChangeRequest(project,\n                                      project.getBranch().getName());\n    }\n\n    public Promise<Boolean> canDeleteBranch(final WorkspaceProject project,\n                                            final String branch) {\n        if (project.getBranch().getName().equals(\"master\")) {\n            return promises.resolve(false);\n        }\n\n        if (authorizationManager.authorize(project.getRepository(),\n                                           RepositoryAction.DELETE,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(project,\n                                     branch,\n                                     RolePermissions::canDelete);\n    }\n\n    public Promise<Boolean> canViewDeploymentDetails(String id) {\n        ResourceRef resourceRef = new ResourceRef(id, ActivityResourceType.PERSPECTIVE);\n        Boolean authorized = authorizationManager.authorize(resourceRef, user);\n        return promises.resolve(authorized);\n    }\n\n    public Promise<Boolean> canSubmitChangeRequest(final WorkspaceProject project,\n                                                   final String branch) {\n        if (project.getBranch().getName().equals(\"master\")) {\n            return promises.resolve(false);\n        }\n\n        if (authorizationManager.authorize(project.getRepository(),\n                                           RepositoryAction.UPDATE,\n                                           user)) {\n            return promises.resolve(true);\n        }\n\n        return checkBranchPermission(project,\n                                     branch,\n                                     RolePermissions::canRead);\n    }\n\n    boolean userIsAtLeast(final ContributorType type,\n                          final Collection<Contributor> contributors) {\n        return contributors.stream().anyMatch(c -> c.getUsername().equals(user.getIdentifier())\n                && ContributorType.PRIORITY_ORDER.indexOf(c.getType()) <= ContributorType.PRIORITY_ORDER.indexOf(type));\n    }\n\n    Optional<Contributor> getUserContributor(final Collection<Contributor> contributors) {\n        return contributors.stream().filter(c -> c.getUsername().equals(user.getIdentifier())).findFirst();\n    }\n\n    Promise<Boolean> checkBranchPermission(final WorkspaceProject project,\n                                           final String branch,\n                                           final Function<RolePermissions, Boolean> rolePermissionsCheck) {\n        return getBranchPermissionsForUser(project, branch).then(rolePermissions -> {\n            if (rolePermissions.isPresent()) {\n                return promises.resolve(rolePermissionsCheck.apply(rolePermissions.get()));\n            }\n\n            return promises.resolve(false);\n        });\n    }\n\n    public Promise<Optional<RolePermissions>> getBranchPermissionsForUser(final WorkspaceProject project,\n                                                                          final String branch) {\n        return promises.promisify(projectPermissionsService,\n                                  s -> {\n                                      return s.loadBranchPermissions(project.getSpace().getName(),\n                                                                     project.getRepository().getIdentifier(),\n                                                                     branch);\n                                  }).then(branchPermissions -> promises.resolve(getBranchPermissionsForUser(project, branchPermissions.getPermissionsByRole())));\n    }\n\n    public Optional<RolePermissions> getBranchPermissionsForUser(final WorkspaceProject project,\n                                                                 final Map<String, RolePermissions> permissionsByRole) {\n        final Optional<Contributor> userContributor = getUserContributor(project.getRepository().getContributors());\n        if (userContributor.isPresent()) {\n            final RolePermissions rolePermissions = permissionsByRole.get(userContributor.get().getType().name());\n            if (rolePermissions != null) {\n                return Optional.of(rolePermissions);\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    public Promise<List<Branch>> getReadableBranches(final WorkspaceProject project) {\n        if (project.getMainModule() == null) {\n            return promises.resolve(Collections.emptyList());\n        }\n\n        if (authorizationManager.authorize(project.getRepository(),\n                                           RepositoryAction.READ,\n                                           user)) {\n            return promises.resolve(new ArrayList<>(project.getRepository().getBranches()));\n        }\n\n        return getBranchesWithPermission(project, RolePermissions::canRead);\n    }\n\n    public Promise<List<Branch>> getUpdatableBranches(final WorkspaceProject project) {\n        if (project.getMainModule() == null) {\n            return promises.resolve(Collections.emptyList());\n        }\n\n        if (authorizationManager.authorize(project.getRepository(),\n                                           RepositoryAction.UPDATE,\n                                           user)) {\n            return promises.resolve(new ArrayList<>(project.getRepository().getBranches()));\n        }\n\n        return getBranchesWithPermission(project, RolePermissions::canWrite);\n    }\n\n    private Promise<List<Branch>> getBranchesWithPermission(final WorkspaceProject project,\n                                                            final Function<RolePermissions, Boolean> rolePermissionsCheck) {\n\n        return promises.promisify(projectPermissionsService, service -> {\n            return service.loadBranchPermissions(project.getSpace().getName(),\n                                                 project.getRepository().getIdentifier(),\n                                                 project.getRepository().getBranches().stream().map(Branch::getName).collect(Collectors.toList()));\n        }).then(branchPermissions -> promises.resolve(project.getRepository().getBranches().stream().filter(branch -> {\n            final Optional<RolePermissions> branchPermissionsForUser = getBranchPermissionsForUser(project,\n                                                                                                   branchPermissions.get(branch.getName()).getPermissionsByRole());\n            return branchPermissionsForUser.map(rolePermissionsCheck).orElse(false);\n        }).collect(Collectors.toList())));\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/type/POMResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.project.client.type;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.common.services.project.editor.type.POMResourceTypeDefinition;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class POMResourceType\n        extends POMResourceTypeDefinition\n        implements ClientResourceType {\n\n    public POMResourceType() {\n    }\n\n    @Inject\n    public POMResourceType(final Others category) {\n        super(category);\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/java/org/guvnor/common/services/project/client/util/POMDefaultOptions.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.util;\n\nimport java.util.ArrayList;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.guvnor.common.services.project.model.Plugin;\n\n@ApplicationScoped\npublic class POMDefaultOptions {\n\n    public ArrayList<Plugin> getBuildPlugins() {\n        return new ArrayList<Plugin>();\n    }\n\n    public String getPackaging() {\n        return \"jar\";\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.guvnor.common.services.project.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/GuvnorProjectClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2014 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n  <inherits name='org.guvnor.common.services.workingset.GuvnorWorkingsetAPI'/>\n  <inherits name='org.guvnor.common.services.GuvnorServicesAPI'/>\n\n  <inherits name='org.gwtbootstrap3.GwtBootstrap3NoTheme'/>\n  <inherits name=\"org.guvnor.common.services.project.GuvnorProjectAPI\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/preferences/resources/i18n/ProjectPreferencesConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nGeneralPreferences.Label=General\nGAVPreferences.Label=Group artifact version\nGAVPreferences.ConflictingGAVCheckDisabled.Label=Disable GAV conflict check?\nGAVPreferences.ConflictingGAVCheckDisabled.Help=Allow GAV (Group ID, Artifact, Version) to be the same as other projects.\nGAVPreferences.ChildGAVEditEnabled.Label=Allow child GAV edition?\nGAVPreferences.ChildGAVEditEnabled.Help=Allow GAV (Group ID, Artifact, Version) edition on children projects."
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/preferences/resources/i18n/ProjectPreferencesConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nGeneralPreferences.Label=General\nGAVPreferences.Label=Versión del artefacto del grupo\nGAVPreferences.ConflictingGAVCheckDisabled.Label=¿Deshabilitar la comprobación de conflictos de GAV?\nGAVPreferences.ConflictingGAVCheckDisabled.Help=Permitir que GAV (ID de grupo, Artefacto, Versión) sea el mismo que los otros proyectos.\nGAVPreferences.ChildGAVEditEnabled.Label=¿Permitir la edición de GAV en secundarios?\nGAVPreferences.ChildGAVEditEnabled.Help=Permitir la edición de GAV (ID de grupo, Artefacto, Versión) en proyectos secundarios."
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/preferences/resources/i18n/ProjectPreferencesConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nGeneralPreferences.Label=Général\nGAVPreferences.Label=Version de l''artefact de groupe\nGAVPreferences.ConflictingGAVCheckDisabled.Label=Désactiver le contrôle des conflits GAV ?\nGAVPreferences.ConflictingGAVCheckDisabled.Help=Autoriser le même paramètre GAV (ID de groupe, Artefact, Version) que sur les autres projets.\nGAVPreferences.ChildGAVEditEnabled.Label=Autoriser la modification de paramètres GAV enfants ?\nGAVPreferences.ChildGAVEditEnabled.Help=Autoriser la modification de paramètres GAV (ID de groupe, Artefact, Version) sur les projets enfants."
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/preferences/resources/i18n/ProjectPreferencesConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nGeneralPreferences.Label=Generale\nGAVPreferences.Label=Gruppo artefatto versione\nGAVPreferences.ConflictingGAVCheckDisabled.Label=Disabilita controllo conflitto GAV?\nGAVPreferences.ConflictingGAVCheckDisabled.Help=Consenti che GAV (ID gruppo, Artefatto, Versione) sia lo stesso di altri progetti.\nGAVPreferences.ChildGAVEditEnabled.Label=Consenti modifica GAV figlio?\nGAVPreferences.ChildGAVEditEnabled.Help=Consenti la modifica di GAV (ID gruppo, Artefatto, Versione) nei progetti figlio.\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/preferences/resources/i18n/ProjectPreferencesConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nGeneralPreferences.Label=全般\nGAVPreferences.Label=グループアーティファクトバージョン\nGAVPreferences.ConflictingGAVCheckDisabled.Label=GAV 競合チェックを無効にしますか?\nGAVPreferences.ConflictingGAVCheckDisabled.Help=GAV (グループ ID、アーティファクト、バージョン) を他のプロジェクトと同じにすることができます。\nGAVPreferences.ChildGAVEditEnabled.Label=子の GAV の編集を許可しますか?\nGAVPreferences.ChildGAVEditEnabled.Help=子プロジェクトで GAV (グループ ID、アーティファクト、バージョン) の編集を許可します。"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nProjectModel=Project Model\nStatefulKSessions=Stateful KSessions\nStatelessKSessions=Stateless KSessions\nEqualsBehavior=Equals Behavior\nEventProcessingMode=Event Processing Mode\nClock=Clock\nRealtime=Realtime\nPseudo=Pseudo\nAddKSession=Add KSession\nDeleteKSession=Delete KSession\nAdd=Add\nRename=Rename\nMakeDefault=Make Default\nNew=New\nDelete=Delete\nIdentity=Identity\nEquality=Equality\nStream=Stream\nCloud=Cloud\nName=Name\nPleaseSelectAKBase=Please select a knowledge base.\nOk=Ok\nCancel=Cancel\nPleaseSetAName=Please set a name\nPleaseSelectAKSession=Please select a knowledge session.\nSave=Save\nSaveSuccessful=File {0} saved successfully\nBuildAndDeploy=Build & Deploy\nSaveBeforeBuildAndDeploy=Also save possible changes to project?\nBuilding=Building...\nBuildSuccessful=Build Successful\nBuildFailed=Build Failed\nEnableKieProject=Enable Kie Project\nKBases=KBases\nLine=Line\nColumn=Column\nText=Text\nLevel=Level\nPomDotXml=pom.xml\nKModuleDotXml=kmodule.xml\nProblems=Problems\nFileName=File\nGroupID=Group ID\nGroupIdExample=Example: com.myorganization.myprojects\nGroupIdMoreInfo=A universally unique identifier for a project. It is normal to \\\n                            use a fully-qualified package name to distinguish it from other projects with a similar name.\nArtifactID=Artifact ID\nArtifactIDExample=Example: MyProject\nArtifactIDMoreInfo=The identifier for this artifact that is unique within the group given by the group ID. \\\n                               An artifact is something that is either produced or used by a project. Examples of artifacts produced by \\\n                               Maven for a project include: JARs, source and binary distributions, and WARs.\nVersion=Version\nVersionExample=Example: 1.0.0\nVersionMoreInfo=The current version of the artifact produced by this project.\nMoreInfo=More Info\nDependencies=Dependencies\nAddFromRepository=Add from repository\nPomDotXmlMetadata=pom.xml metadata\nKModuleDotXmlMetadata=kmodule.xml metadata\nnewProjectDescription=Project\nnewPackageDescription=Package\nNoRepositorySelectedPleaseSelectARepository=No repository selected. Please select a repository.\nXMLMarkIsNotAllowed=XML markup \">\", \"<\" and \"&\" is not allowed in GAV\nGroupIdMissing=Group ID must contain a valid value\nArtifactIdMissing=Artifact ID must contain a valid value\nVersionMissing=Version ID must contain a valid value\nProjectScreen=Project Screen\nNewProject=New Project\nPleaseSelectAnItem=Please Select An Item\nImportSuggestions=Import Suggestions\nImportSuggestionsMetadata=Import Suggestions Metadata\nProjectSettings=Project Settings\nProjectGeneralSettings=Project General Settings\nProjectName=Project Name\nProjectNamePlaceHolder=Insert a project name ...\nProjectDescription=Project Description\nProjectDescriptionPlaceHolder=Insert a project description for documentation purposes ...\nGroupArtifactVersion=Group artifact version\nMetadata=Metadata\nSource=Source\nKnowledgeBaseSettings=Knowledge Base Settings\nImports=Imports\nDSL=DSL\nEnums=Enums\nDependenciesList=Dependencies list\nKnowledgeBasesAndSessions=Knowledge bases and sessions\nBracketDefaultBracket=(default)\nPackages=Packages\nNewProjectWizard=New Project Wizard\nIncludedKnowledgeBases=Included Knowledge Bases\nStateful=Stateful\nStateless=Stateless\nState=State\nWorkItemHandler=Work Item Handler\nDefault=Default\nOptions=Options\nConsoleLogger=Console logger\nFileLogger=File logger\nInterval=Interval\nWorkingMemoryEventListener=Working memory event listener\nAgendaEventListener=Agenda event listener\nProcessEventListener=Process event listener\nKind=Kind\nType=Type\nClose=Close\nListeners=Listeners\nWorkItemHandlers=Work item handlers\nInvalidPackageName=Package name \"{0}\" is not a valid identifier.\nKnowledgeSessions=Knowledge Sessions\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=There already exist an item with the given name. Please select another name.\nProjectScreenWithName=Project: [{0}]\nRefreshProblemsPanel=Refresh\nRefreshing=Refreshing...\nABuildIsAlreadyRunning=A build is already running\nXsdIDError=The name has to start with a letter or an underscore and the name can not contain other characters than letters, digits, underscores, hyphens and periods.\nNoDependencies=No dependencies defined.\nEnterAGroupID=Enter Group ID...\nEnterAnArtifactID=Enter Artifact ID...\nEnterAVersion=Enter Version...\nExceptionPackageAlreadyExists0=Package \"{0}\" already exists.\nProjectStructure=Project Structure\nInheritedFromAParentPOM=Inherited from a parent POM\nParentsGroupArtifactVersion=Parent''s Group, Artifact and Version\ninvalidGroupId=Invalid Group ID format\ninvalidArtifactId=Invalid Artifact ID format\ninvalidVersion=Invalid Version format\ninvalidName=Invalid name\nConflictingRepositoriesTitle=Conflicting Repositories\nConflictingRepositoriesGAVDescription=The following Repositories already contain Artifact \"{0}:{1}:{2}\".\nConflictingRepositoriesOverride=Override\nRepositoryId=Id\nRepositoryUrl=URL\nRepositorySource=Source\nRepositorySourceLocal=Local\nRepositorySourceProject=Project\nRepositorySourceSettings=Maven settings\nRepositorySourceDistributionManagement=Distribution Management\nRepositorySourceUnknown=Unknown\nProjectsNode=Projects\nProjectsHelp=At the Project Authoring perspective, sets who can Create, Update, Delete or Build projects from the Project Editor screen as well as what projects are visible in the Project Explorer.\nProjectResource=Project\nProjectActionRead=Read\nProjectActionUpdate=Update\nProjectActionDelete=Delete\nProjectActionCreate=Create\nProjectActionBuild=Build\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_de.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nProjectModel=Projektmodell\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nStatefulKSessions=Stateful KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nStatelessKSessions=Stateless KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nEqualsBehavior=gleicht Verhalten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nEventProcessingMode=Ereignisverarbeitungsmodus\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nClock=Uhr\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nRealtime=Echtzeit\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nPseudo=Pseudo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nAddKSession=KSession hinzufügen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nDeleteKSession=KSession löschen\nAdd=Hinzufügen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nRename=Umbenennen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nMakeDefault=Zum Standard machen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNew=New\nDelete=Löschen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nIdentity=Identität\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nEquality=Gleichheit\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nStream=Stream\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nCloud=Cloud\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nName=Name\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nPleaseSelectAKBase=Bitte eine Knowledge Base wählen.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nOk=Ok\nCancel=Abbrechen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nPleaseSetAName=Bitte einen Namen einstellen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nPleaseSelectAKSession=Bitte eine Knowledge Session wählen.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSave=Speichern\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nSaveSuccessful=Datei {0} erfolgreich gespeichert\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nBuildAndDeploy=Erstellen & Deployen\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nSaveBeforeBuildAndDeploy=Auch mögliche Änderungen am Projekt speichern?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nBuilding=Erstelle...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nBuildSuccessful=Erstellung erfolgreich\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nBuildFailed=Erstellung fehlgeschalgen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nEnableKieProject=Kie-Projekt aktivieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nKBases=KBases\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nLine=Zeile\nColumn=Spalte\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nText=Text\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nLevel=Ebene\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nPomDotXml=pom.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nKModuleDotXml=kmodule.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nProblems=Probleme\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nFileName=Datei\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nGroupID=Gruppen-ID\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nGroupIdExample=Beispiel\\: com.myorganization.myprojects\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nGroupIdMoreInfo=Ein universal eindeutiger Bezeichner für ein Projekt. Es ist normal einen vollständigen Paketnamen zu verwenden, um von anderen Projekten mit einem ähnlichen Namen zu unterscheiden.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nArtifactID=Artifact-ID\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nArtifactIDExample=Beispiel\\: MyProject\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nArtifactIDMoreInfo=Der Bezeichner für dieses Artifakt deinnerhalb der durch die Gruppen-ID gegebenen Gruppe eindeutig ist. Ein Artifakt wird von einem Projekt entweder erstellt oder verwendet. Beispiele von durch Maven für ein Projekt erstellte Artifakte umfassen\\: JARs, Quell- und Binärdistributionen und WARs.\nVersion=Version\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nVersionExample=Beispiel\\: 1.0.0\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nVersionMoreInfo=Die aktuelle, von diesem Projekt erstellte Version des Artifakts.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nMoreInfo=Mehr Info\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nDependencies=Abhängigkeiten (\"Dependencies\")\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nAddFromRepository=Von Repository hinzufügen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nPomDotXmlMetadata=pom.xml Metadaten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author jdimanos\nKModuleDotXmlMetadata=kmodule.xml Metadaten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nnewProjectDescription=Projekt\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nnewPackageDescription=Paket\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nNoRepositorySelectedPleaseSelectARepository=Kein Repository gewählt. Bitte wählen Sie ein Repository.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nXMLMarkIsNotAllowed=XML Markup \">\", \"<\" und \"&\" ist in GAV nicht gestattet\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nGroupIdMissing=Gruppen-ID muss einen gültigen Wert enthalten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nArtifactIdMissing=Artifakt-ID muss einen gültigen Wert enthalten\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nVersionMissing=Versions-ID muss einen gültigen Wert enthalten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectScreen=Projektbildschirm\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nNewProject=Neues Projekt\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nPleaseSelectAnItem=Bitte wählen Sie ein Element aus\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nImportSuggestions=Importvorschläge\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nImportSuggestionsMetadata=Importvorschläge Metadaten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectSettings=Projekteinstellungen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectGeneralSettings=Allgemeine Projekteinstellungen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectName=Projektname\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectNamePlaceHolder=Einen Projektnamen einfügen ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectDescription=Projektbeschreibung\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectDescriptionPlaceHolder=Für Dokumentationszwecke eine Projektbeschreibung einfügen ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nGroupArtifactVersion=Gruppenartifaktversion\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author jdimanos\nMetadata=Metadaten\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author jdimanos\nSource=Quelle\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nKnowledgeBaseSettings=Knowledge Base Einstellungen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-config-resource-widget/org/kie/workbench/common/widgets/configresource/client/resources/i18n/ImportConstants, author jdimanos\nImports=Importe\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nDSL=DSL\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nEnums=Enums\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nDependenciesList=Abhängigkeitenliste\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nKnowledgeBasesAndSessions=Knowledge Bases und Sessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nBracketDefaultBracket=(Standard)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nPackages=Pakete\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nNewProjectWizard=Neuer Projekt Wizard\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nIncludedKnowledgeBases=Included Knowledge Bases\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nStateful=Stateful\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nStateless=Stateless\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nState=Status\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nWorkItemHandler=Arbeitsposten-Handler\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nDefault=Default (Standard)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nOptions=Optionen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nConsoleLogger=Konsolen-Logger\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nFileLogger=Datei-Logger\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nInterval=Intervall\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nWorkingMemoryEventListener=Arbeitsspeicher Ereignis Horcher\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nAgendaEventListener=Agenda Ereignis Horcher\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProcessEventListener=Prozess Ereignis Horcher\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nKind=Art\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author jdimanos\nType=Typ\nClose=Schließen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nListeners=Horcher\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nWorkItemHandlers=Arbeitsposten-Handler\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nInvalidPackageName=Paketname \"{0}\" ist kein gültiger Bezeichner.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nKnowledgeSessions=Knowledge Sessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=There already exist an item with the given name. Please select another name.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nProjectScreenWithName=Projekt\\: [{0}]\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshProblemsPanel=Aktualisieren\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshing=Aktualisiere ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nABuildIsAlreadyRunning=Ein Build läuft bereits\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nXsdIDError=Der Name muss mit einem Buchstaben oder einem Unterstrich beginnen und der Name darf keine anderen Zeichen als Buchstaben, Zahlen, Unterstriche, Bindestriche und Punkte enthalten.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nNoDependencies=Keine Abhängigkeiten definiert.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nEnterAGroupID=Gruppen-ID eingeben...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nEnterAnArtifactID=Artifakt-ID eingeben...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nEnterAVersion=Version eingeben...\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nExceptionPackageAlreadyExists0=Paket \"{0}\" bereits vorhanden.\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nProjectStructure=Projektstruktur\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author jdimanos\nInheritedFromAParentPOM=Von übergeordnetem POM geerbt\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\nParentsGroupArtifactVersion=Übergeordnete Gruppe, Artefakt und Version\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\ninvalidGroupId=Ungültiges Gruppen-ID-Format\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\ninvalidArtifactId=Ungültiges Artefakt-ID-Format\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author jdimanos\ninvalidVersion=Ungültiges Versionsformat\ninvalidName=Ungültiger Name\nConflictingRepositoriesTitle=In Konflikt stehende Repositorys\nConflictingRepositoriesGAVDescription=Folgende Repositorys enthalten bereits Artefakt »{0}\\:{1}\\:{2}«.\nConflictingRepositoriesOverride=Außer Kraft setzen\nRepositoryId=ID\nRepositoryUrl=URL\nRepositorySource=Quelle\nRepositorySourceLocal=Lokal\nRepositorySourceProject=Projekt\nRepositorySourceSettings=Maven-Einstellungen\nRepositorySourceDistributionManagement=Distributionsverwaltung\nRepositorySourceUnknown=Unbekannt\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_es.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nProjectModel=Modelo de proyecto\nStatefulKSessions=KSessions con estado\nStatelessKSessions=KSessions sin estado\nEqualsBehavior=Imita el comportamiento\nEventProcessingMode=Modo de procesamiento de eventos\nClock=Reloj\nRealtime=En tiempo real\nPseudo=Seudo\nAddKSession=Agregar KSession\nDeleteKSession=Eliminar KSession\nAdd=Agregar\nRename=Cambiar nombre\nMakeDefault=Hacer predeterminado\nNew=Nuevo\nDelete=Eliminar\nIdentity=Identidad\nEquality=Igualdad\nStream=Secuencia\nCloud=Nube\nName=Nombre\nPleaseSelectAKBase=Seleccione una base de conocimientos.\nOk=Aceptar\nCancel=Cancelar\nPleaseSetAName=Establezca un nombre\nPleaseSelectAKSession=Seleccione una sesión de conocimiento.\nSave=Guardar\nSaveSuccessful=El archivo {0} se guardó correctamente\nBuildAndDeploy=Compilar e implementar\nSaveBeforeBuildAndDeploy=¿Guardar también posibles cambios en el proyecto?\nBuilding=Compilando…\nBuildSuccessful=Compilación correcta\nBuildFailed=Error en la compilación\nEnableKieProject=Habilitar proyecto Kie\nKBases=KBases\nLine=Línea\nColumn=Columna\nText=Texto\nLevel=Nivel\nPomDotXml=pom.xml\nKModuleDotXml=kmodule.xml\nProblems=Problemas\nFileName=Archivo\nGroupID=ID de grupo\nGroupIdExample=Ejemplo: com.myorganization.myprojects\nGroupIdMoreInfo=Un identificador universal único para un proyecto. Es normal usar un nombre de paquete totalmente calificado para distinguirlo de otros proyectos con un nombre similar.\nArtifactID=ID de artefacto\nArtifactIDExample=Ejemplo: MiProyecto\nArtifactIDMoreInfo=El identificador de este artefacto que es único dentro del grupo dado por el ID de grupo. Un artefacto es algo que se produce o se usa en un proyecto. Ejemplos de artefactos producidos por Maven para un proyecto incluyen: JARs, distribuciones fuente y binarias, y WARs.\nVersion=Versión\nVersionExample=Ejemplo\nVersionMoreInfo=La versión actual del artefacto producido por este proyecto.\nMoreInfo=Más información\nDependencies=Dependencias\nAddFromRepository=Agregar del repositorio\nPomDotXmlMetadata=metadatos de pom.xml\nKModuleDotXmlMetadata=metadatos de kmodule.xml\nnewProjectDescription=Proyecto\nnewPackageDescription=Paquete\nNoRepositorySelectedPleaseSelectARepository=No se ha seleccionado ningún repositorio. Por favor, seleccione un repositorio.\nXMLMarkIsNotAllowed=No se permiten las marcas XML “>”, “<” y “&” en el GAV\nGroupIdMissing=La ID de grupo debe contener un valor válido\nArtifactIdMissing=La ID de artefacto debe contener un valor válido\nVersionMissing=La ID de versión debe contener un valor válido\nProjectScreen=Pantalla de proyecto\nNewProject=Nuevo proyecto\nPleaseSelectAnItem=Seleccione un ítem\nImportSuggestions=Sugerencias de importación\nImportSuggestionsMetadata=Metadatos de sugerencias de importación\nProjectSettings=Ajustes del proyecto\nProjectGeneralSettings=Ajustes generales del proyecto\nProjectName=Nombre del proyecto\nProjectNamePlaceHolder=Inserte un nombre de proyecto…\nProjectDescription=Descripción del proyecto\nProjectDescriptionPlaceHolder=Insertar una descripción del proyecto con fines de documentación …\nGroupArtifactVersion=Versión del artefacto del grupo\nMetadata=Metadatos\nSource=Fuente\nKnowledgeBaseSettings=Ajustes de la base de conocimientos\nImports=Importaciones\nDSL=DSL\nEnums=Enums\nDependenciesList=Lista de dependencias\nKnowledgeBasesAndSessions=Bases de conocimiento y sesiones\nBracketDefaultBracket=(por defecto)\nPackages=Paquetes\nNewProjectWizard=Asistente de nuevo proyecto\nIncludedKnowledgeBases=Bases de conocimiento incluidas\nStateful=Con estado\nStateless=Sin estado\nState=Estado\nWorkItemHandler=Manipulador de ítems de trabajo\nDefault=Predeterminado\nOptions=Opciones\nConsoleLogger=Registrador de consola\nFileLogger=Registrador de archivos\nInterval=Intervalo\nWorkingMemoryEventListener=Oyente de eventos de la memoria de trabajo\nAgendaEventListener=Oyente de eventos de la agenda\nProcessEventListener=Oyente de eventos del proceso\nKind=Clase\nType=Tipo\nClose=Cerrar\nListeners=Oyentes\nWorkItemHandlers=Manipuladores de ítems de trabajo\nInvalidPackageName=El nombre del paquete \"{0}\" no es un identificador válido.\nKnowledgeSessions=Sesiones de conocimiento\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=Ya existe un ítem con el nombre indicado. Seleccione otro nombre.\nProjectScreenWithName=Proyecto: [{0}]\nRefreshProblemsPanel=Actualizar\nRefreshing=Actualizando…\nABuildIsAlreadyRunning=Ya hay una compilación en ejecución\nXsdIDError=El nombre tiene que empezar con una letra o un guión bajo y el nombre no puede contener otros caracteres que no sean letras, dígitos, guiones bajos, guiones y puntos.\nNoDependencies=No se definen las dependencias.\nEnterAGroupID=Ingrese la ID de grupo…\nEnterAnArtifactID=Ingrese la ID de artefacto…\nEnterAVersion=Ingrese la versión…\nExceptionPackageAlreadyExists0=El paquete \"{0}\" ya existe.\nProjectStructure=Estructura del proyecto\nInheritedFromAParentPOM=Heredado de un POM principal\nParentsGroupArtifactVersion=Grupo, artefacto y versión del principal\ninvalidGroupId=Formato de ID de grupo no válido\ninvalidArtifactId=Formato de ID de artefacto no válido\ninvalidVersion=Formato de versión no válido\ninvalidName=Nombre no válido\nConflictingRepositoriesTitle=Repositorios en conflicto\nConflictingRepositoriesGAVDescription=Los siguientes repositorios ya contienen el artefacto \"{0}:{1}:{2}\".\nConflictingRepositoriesOverride=Anular\nRepositoryId=Id\nRepositoryUrl=URL\nRepositorySource=Fuente\nRepositorySourceLocal=Local\nRepositorySourceProject=Proyecto\nRepositorySourceSettings=Ajustes de Maven\nRepositorySourceDistributionManagement=Gestión de la distribución\nRepositorySourceUnknown=Desconocido\nProjectsNode=Proyectos\nProjectsHelp=En la perspectiva de autoría de proyectos, se establece quién puede crear, actualizar, eliminar o compilar proyectos desde la pantalla del editor de proyectos, así como qué proyectos son visibles en el explorador de proyectos.\nProjectResource=Proyecto\nProjectActionRead=Leer\nProjectActionUpdate=Actualizar\nProjectActionDelete=Eliminar\nProjectActionCreate=Crear\nProjectActionBuild=Compilar\n\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_fr.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nProjectModel=Modèle de projet\nStatefulKSessions=KSessions avec état\nStatelessKSessions=KSessions sans état\nEqualsBehavior=Est égal au comportement\nEventProcessingMode=Mode de traitement des événements\nClock=Horloge\nRealtime=En temps réel\nPseudo=Pseudo\nAddKSession=Ajouter KSession\nDeleteKSession=Supprimer KSession\nAdd=Ajouter\nRename=Renommer\nMakeDefault=Définir par défaut\nNew=Nouveau\nDelete=Supprimer\nIdentity=Identité\nEquality=Égalité\nStream=Flux\nCloud=Cloud\nName=Nom\nPleaseSelectAKBase=Veuillez sélectionner une base de connaissances.\nOk=OK\nCancel=Annuler\nPleaseSetAName=Veuillez indiquer un nom\nPleaseSelectAKSession=Veuillez sélectionner une session de connaissances.\nSave=Enregistrer\nSaveSuccessful=Fichier {0} enregistré\nBuildAndDeploy=Compiler et déployer\nSaveBeforeBuildAndDeploy=Enregistrer également les éventuelles modifications apportées au projet ?\nBuilding=Compilation…\nBuildSuccessful=Compilation réussie\nBuildFailed=Échec de la compilation\nEnableKieProject=Activer le projet Kie\nKBases=Bases de connaissances\nLine=Ligne\nColumn=Colonne\nText=Texte\nLevel=Niveau\nPomDotXml=pom.xml\nKModuleDotXml=kmodule.xml\nProblems=Problèmes\nFileName=Fichier\nGroupID=ID de groupe\nGroupIdExample=Exemple : com.myorganization.myprojects\nGroupIdMoreInfo=Identificateur unique universel d''un projet. Il est normal d''utiliser un nom de package complet pour le distinguer d''autres projets ayant un nom semblable.\nArtifactID=ID d''artefact\nArtifactIDExample=Exemple : MonProjet\nArtifactIDMoreInfo=Identifiant de cet artefact qui est unique au sein du groupe indiqué par l''ID de groupe. Un artefact est un élément qui est soit produit soit utilisé par un projet. Voici quelques exemples d''artefacts produits par Maven pour un projet : JARs, distributions source et binaire, et WARs.\nVersion=Version\nVersionExample=Example: 1.0.0\nVersionMoreInfo=Version actuelle de l''artefact produit par ce projet.\nMoreInfo=Plus d''informations\nDependencies=Dépendances\nAddFromRepository=Ajouter à partir du référentiel\nPomDotXmlMetadata=Métadonnées de pom.xml\nKModuleDotXmlMetadata=Métadonnées de kmodule.xml\nnewProjectDescription=Projet\nnewPackageDescription=Package\nNoRepositorySelectedPleaseSelectARepository=Aucun référentiel n''a été sélectionné. Veuillez sélectionner un référentiel.\nXMLMarkIsNotAllowed=Les balises XML  \">\", \"<\" et \"&\" ne sont pas autorisées dans GAV\nGroupIdMissing=L''ID de groupe doit contenir une valeur valide\nArtifactIdMissing=L''ID d''artefact doit contenir une valeur valide\nVersionMissing=L''ID de version doit contenir une valeur valide\nProjectScreen=Écran du projet\nNewProject=Nouveau projet\nPleaseSelectAnItem=Veuillez sélectionner une ressource\nImportSuggestions=Importer les suggestions\nImportSuggestionsMetadata=Importer les métadonnées des suggestions\nProjectSettings=Paramètres du projet\nProjectGeneralSettings=Paramètres généraux du projet\nProjectName=Nom du projet\nProjectNamePlaceHolder=Insérer un nom de projet…\nProjectDescription=Description du projet\nProjectDescriptionPlaceHolder=Insérer une description du projet à des fins de documentation…\nGroupArtifactVersion=Version de l''artefact de groupe\nMetadata=Métadonnées\nSource=Source\nKnowledgeBaseSettings=Paramètres de la base de connaissances\nImports=Importations\nDSL=DSL\nEnums=Énumérés\nDependenciesList=Liste des dépendances\nKnowledgeBasesAndSessions=Bases et sessions de connaissances\nBracketDefaultBracket=(par défaut)\nPackages=Packages\nNewProjectWizard=Assistant Nouveau projet\nIncludedKnowledgeBases=Bases de connaissances incluses\nStateful=Avec état\nStateless=Sans état\nState=État\nWorkItemHandler=Gestionnaire d''éléments de travail\nDefault=Par défaut\nOptions=Options\nConsoleLogger=Journal de console\nFileLogger=Journal de fichiers\nInterval=Intervalle\nWorkingMemoryEventListener=Écouteur d''événements de la mémoire de travail\nAgendaEventListener=Écouteur d''événements de l''agenda\nProcessEventListener=Écouteur d''événements de processus\nKind=Genre\nType=Type\nClose=Fermer\nListeners=Écouteurs\nWorkItemHandlers=Gestionnaires d''éléments de travail\nInvalidPackageName=Le nom de package \"{0}\" n''est pas un identifiant valide.\nKnowledgeSessions=Sessions de connaissances\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=Il existe déjà un élément portant le nom indiqué. Veuillez choisir un autre nom.\nProjectScreenWithName=Projet : [{0}]\nRefreshProblemsPanel=Rafraîchir\nRefreshing=Rafraîchissement…\nABuildIsAlreadyRunning=Une compilation est déjà en cours\nXsdIDError=Le nom doit commencer par une lettre ou un trait de soulignement et ne peut pas contenir de caractères autres que des lettres, des chiffres, des traits de soulignement, des traits d''union et des points.\nNoDependencies=Aucune dépendance définie.\nEnterAGroupID=Saisir l''ID de groupe…\nEnterAnArtifactID=Saisir l''ID d''artefact…\nEnterAVersion=Saisir la version…\nExceptionPackageAlreadyExists0=Le package \"{0}\" existe déjà.\nProjectStructure=Structure du projet\nInheritedFromAParentPOM=Hérité d''un POM parent\nParentsGroupArtifactVersion=Groupe, artefact et version du parent\ninvalidGroupId=Format d''ID de groupe non valide\ninvalidArtifactId=Format d''ID d''artefact non valide\ninvalidVersion=Format de version non valide\ninvalidName=Nom incorrect\nConflictingRepositoriesTitle=Référentiels en conflit\nConflictingRepositoriesGAVDescription=Les référentiels suivants contiennent déjà l''artefact \"{0}:{1}:{2}\".\nConflictingRepositoriesOverride=Remplacer\nRepositoryId=ID\nRepositoryUrl=URL\nRepositorySource=Source\nRepositorySourceLocal=Local\nRepositorySourceProject=Projet\nRepositorySourceSettings=Paramètres Maven\nRepositorySourceDistributionManagement=Gestion de la distribution\nRepositorySourceUnknown=Inconnu\nProjectsNode=Projets\nProjectsHelp=Au niveau de la perspective Création de projets, définit qui peut créer, mettre à jour, supprimer ou compiler des projets à partir de l''écran Éditeur de projets, ainsi que les projets visibles dans l''explorateur de projets.\nProjectResource=Projet\nProjectActionRead=Lire\nProjectActionUpdate=Mettre à jour\nProjectActionDelete=Supprimer\nProjectActionCreate=Créer\nProjectActionBuild=Compiler\n\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_it.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nProjectModel=Modello del progetto\nStatefulKSessions=Sessioni KSessions con stato\nStatelessKSessions=Sessioni KSessions senza stato\nEqualsBehavior=Comportamento Equals\nEventProcessingMode=Modalità di elaborazione degli eventi\nClock=Orologio\nRealtime=Tempo reale\nPseudo=Pseudo\nAddKSession=Aggiungi KSession\nDeleteKSession=Elimina KSession\nAdd=Aggiungi\nRename=Rinomina\nMakeDefault=Rendi predefinito\nNew=Nuovo\nDelete=Elimina\nIdentity=Identità\nEquality=Uguaglianza\nStream=Stream\nCloud=Cloud\nName=Nome\nPleaseSelectAKBase=Seleziona una knowledge base.\nOk=Ok\nCancel=Annulla\nPleaseSetAName=Imposta un nome\nPleaseSelectAKSession=Seleziona una sessione di conoscenza.\nSave=Salva\nSaveSuccessful=File {0} salvato correttamente\nBuildAndDeploy=Compila e distribuisci\nSaveBeforeBuildAndDeploy=Salva anche le eventuali modifiche al progetto?\nBuilding=Compilazione in corso...\nBuildSuccessful=Compilazione riuscita\nBuildFailed=Compilazione non riuscita\nEnableKieProject=Abilita progetto Kie\nKBases=KBases\nLine=Riga\nColumn=Colonna\nText=Testo\nLevel=Livello\nPomDotXml=pom.xml\nKModuleDotXml=kmodule.xml\nProblems=Problemi\nFileName=File\nGroupID=ID Gruppo\nGroupIdExample=Esempio: com.miaorganizzazione.mieiprogetti\nGroupIdMoreInfo=Un identificatore univoco universale per un progetto. È normale \\\n              utilizzare un nome di pacchetto completamente qualificato per distinguerlo da altri progetti con un nome simile.\nArtifactID=ID Artefatto\nArtifactIDExample=Esempio: MioProgetto\nArtifactIDMoreInfo=L''identificatore per questo artefatto che è univoco all''interno del gruppo dato dall''ID del gruppo. \\\n                 Un artefatto è qualcosa che viene prodotto o utilizzato da un progetto. Esempi di artefatti prodotti da \\\n                 Maven per un progetto includono: JAR, distribuzioni sorgente e binarie e WAR.\nVersion=Versione\nVersionExample=Esempio: 1.0.0\nVersionMoreInfo=La versione corrente dell''artefatto prodotto da questo progetto.\nMoreInfo=Maggiori informazioni\nDependencies=Dipendenze\nAddFromRepository=Aggiungi da repository\nPomDotXmlMetadata=Metadati pom.xml\nKModuleDotXmlMetadata=Metadati kmodule.xml\nnewProjectDescription=Progetto\nnewPackageDescription=Pacchetto\nNoRepositorySelectedPleaseSelectARepository=Nessun repository selezionato. Seleziona un repository.\nXMLMarkIsNotAllowed=I segni di markup XML \">\", \"<\" e \"&\" non sono consentiti in GAV\nGroupIdMissing=L''ID del gruppo deve contenere un valore valido\nArtifactIdMissing=L''ID dell''artefatto deve contenere un valore valido\nVersionMissing=L''ID della versione deve contenere un valore valido\nProjectScreen=Schermata del progetto\nNewProject=Nuovo progetto\nPleaseSelectAnItem=Seleziona un elemento\nImportSuggestions=Suggerimenti di importazione\nImportSuggestionsMetadata=Metadati dei suggerimenti di importazione\nProjectSettings=Impostazioni del progetto\nProjectGeneralSettings=Impostazioni generali del progetto\nProjectName=Nome del progetto\nProjectNamePlaceHolder=Inserisci un nome del progetto ...\nProjectDescription=Descrizione del progetto\nProjectDescriptionPlaceHolder=Inserisci una descrizione del progetto per scopi di documentazione ...\nGroupArtifactVersion=Gruppo artefatto versione\nMetadata=Metadati\nSource=Origine\nKnowledgeBaseSettings=Impostazioni della knowledge base\nImports=Importazioni\nDSL=DSL\nEnums=Enumerazioni\nDependenciesList=Elenco delle dipendenze\nKnowledgeBasesAndSessions=Basi di conoscenza e sessioni\nBracketDefaultBracket=(predefinito)\nPackages=Pacchetti\nNewProjectWizard=Assistente per nuovo progetto\nIncludedKnowledgeBases=Basi di conoscenza incluse\nStateful=Con stato\nStateless=Senza stato\nState=Stato\nWorkItemHandler=Gestore dell''elemento di lavoro\nDefault=Predefinito\nOptions=Opzioni\nConsoleLogger=Logger della console\nFileLogger=Logger del file\nInterval=Intervallo\nWorkingMemoryEventListener=Ascoltatore degli eventi della working memory\nAgendaEventListener=Ascoltatore degli eventi dell''agenda\nProcessEventListener=Ascoltatore degli eventi del processo\nKind=Tipo\nType=Tipo\nClose=Chiudi\nListeners=Ascoltatori\nWorkItemHandlers=Gestori degli elementi di lavoro\nInvalidPackageName=Il nome del pacchetto \"{0}\" non è un identificatore valido.\nKnowledgeSessions=Sessioni di conoscenza\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=Esiste già un elemento con il nome fornito. Seleziona un altro nome.\nProjectScreenWithName=Progetto: [{0}]\nRefreshProblemsPanel=Aggiorna\nRefreshing=Aggiornamento in corso...\nABuildIsAlreadyRunning=Una compilazione è già in corso\nXsdIDError=Il nome deve iniziare con una lettera o un underscore e non può contenere altri caratteri oltre a lettere, cifre, underscore, trattini e punti.\nNoDependencies=Nessuna dipendenza definita.\nEnterAGroupID=Inserisci l''ID del gruppo...\nEnterAnArtifactID=Inserisci l''ID dell''artefatto...\nEnterAVersion=Inserisci la versione...\nExceptionPackageAlreadyExists0=Il pacchetto \"{0}\" esiste già.\nProjectStructure=Struttura del progetto\nInheritedFromAParentPOM=Ereditato da un POM genitore\nParentsGroupArtifactVersion=Gruppo, artefatto e versione del genitore\ninvalidGroupId=Formato ID Gruppo non valido\ninvalidArtifactId=Formato ID Artefatto non valido\ninvalidVersion=Formato Versione non valido\ninvalidName=Nome non valido\nConflictingRepositoriesTitle=Repository in conflitto\nConflictingRepositoriesGAVDescription=I seguenti repository contengono già l''artefatto \"{0}:{1}:{2}\".\nConflictingRepositoriesOverride=Sovrascrivi\nRepositoryId=ID\nRepositoryUrl=URL\nRepositorySource=Origine\nRepositorySourceLocal=Locale\nRepositorySourceProject=Progetto\nRepositorySourceSettings=Impostazioni Maven\nRepositorySourceDistributionManagement=Gestione distribuzione\nRepositorySourceUnknown=Sconosciuto\nProjectsNode=Progetti\nProjectsHelp=Nella prospettiva di creazione del progetto, imposta chi può creare, aggiornare, eliminare o compilare progetti dalla schermata dell''editor del progetto e quali progetti sono visibili nell''esploratore del progetto.\nProjectResource=Progetto\nProjectActionRead=Lettura\nProjectActionUpdate=Aggiornamento\nProjectActionDelete=Eliminazione\nProjectActionCreate=Creazione\nProjectActionBuild=Compilazione\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_ja.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nProjectModel=プロジェクトモデル\nStatefulKSessions=ステートフル KSession\nStatelessKSessions=ステートレス KSession\nEqualsBehavior=等しい動作\nEventProcessingMode=イベント処理モード\nClock=クロック\nRealtime=リアルタイム\nPseudo=擬似\nAddKSession=KSession を追加\nDeleteKSession=KSession を削除\nAdd=追加\nRename=名前を変更\nMakeDefault=デフォルトにする\nNew=新規\nDelete=削除\nIdentity=アイデンティティ\nEquality=等価性\nStream=ストリーム\nCloud=クラウド\nName=名前\nPleaseSelectAKBase=knowledge base を選択してください\nOk=OK\nCancel=キャンセル\nPleaseSetAName=名前をセットしてください\nPleaseSelectAKSession=knowledge session を選択してください\nSave=保存\nSaveSuccessful=ファイル {0} を保存しました。\nBuildAndDeploy=ビルド＆デプロイ\nSaveBeforeBuildAndDeploy=変更をプロジェクトに保存しますか?\nBuilding=ビルド中...\nBuildSuccessful=ビルド成功\nBuildFailed=ビルドに失敗しました\nEnableKieProject=KIEプロジェクトを有効化\nKBases=KBase\nLine=Line\nColumn=カラム\nText=テキスト\nLevel=レベル\nPomDotXml=pom.xml\nKModuleDotXml=kmodule.xml\nProblems=問題\nFileName=ファイル\nGroupID=グループ ID\nGroupIdExample=例: com.myorganization.myprojects\nGroupIdMoreInfo=プロジェクトのユニバーサル一意識別子。通常は、完全修飾パッケージ名を使用して、同じような名前の他のプロジェクトと区別します。\nArtifactID=アーティファクト ID\nArtifactIDExample=例: MyProject\nArtifactIDMoreInfo=グループ ID で指定したグループで一意となるアーティファクトの ID。アーティファクトは、プロジェクトが生成または使用するアイテムを指します。Maven がプロジェクト用に生成するアーティファクトの例は、JAR、ソースおよびバイナリーディストリビューション、および WAR です。\nVersion=バージョン\nVersionExample=例: 1.0.0\nVersionMoreInfo=このプロジェクトで生成されたアーティファクトの現在のバージョン。\nMoreInfo=詳細情報\nDependencies=依存\nAddFromRepository=リポジトリから追加\nPomDotXmlMetadata=pom.xml メタデータ\nKModuleDotXmlMetadata=kmodule.xml メタデータ\nnewProjectDescription=プロジェクト\nnewPackageDescription=パッケージ\nNoRepositorySelectedPleaseSelectARepository=リポジトリーが選択されていません。リポジトリーを選択してください\nXMLMarkIsNotAllowed=XML マークアップ \">\", \"<\" と \"&\" は GAV では使用できません\nGroupIdMissing=グループ ID は有効な値を含む必要があります\nArtifactIdMissing=アーティファクト ID は有効な値を含む必要があります\nVersionMissing=バージョン ID は有効な値を含む必要があります\nProjectScreen=プロジェクトスクリーン\nNewProject=新規プロジェクト\nPleaseSelectAnItem=アイテムを選択してください\nImportSuggestions=インポート提案\nImportSuggestionsMetadata=インポート提案メタデータ\nProjectSettings=プロジェクト設定\nProjectGeneralSettings=プロジェクト一般設定\nProjectName=プロジェクト名\nProjectNamePlaceHolder=プロジェクト名を挿入します ...\nProjectDescription=プロジェクトの説明\nProjectDescriptionPlaceHolder=ドキュメンテーションのためにプロジェクトの説明を挿入します ...\nGroupArtifactVersion=グループアーティファクトバージョン\nMetadata=メタデータ\nSource=ソース\nKnowledgeBaseSettings=ナレッジベース設定\nImports=インポート\nDSL=DSL\nEnums=Enum\nDependenciesList=依存リスト\nKnowledgeBasesAndSessions=ナレッジベースとセッション\nBracketDefaultBracket=(デフォルト)\nPackages=パッケージ\nNewProjectWizard=新規プロジェクトウィザード\nIncludedKnowledgeBases=Included Knowledge Bases\nStateful=ステートフル\nStateless=ステートレス\nState=ステート\nWorkItemHandler=ワークアイテムハンドラー\nDefault=デフォルト\nOptions=オプション\nConsoleLogger=コンソールロガー\nFileLogger=ファイルロガー\nInterval=間隔\nWorkingMemoryEventListener=ワーキングメモリーイベントリスナー\nAgendaEventListener=アジェンダイベントリスナー\nProcessEventListener=イベントリスナーの処理\nKind=種類\nType=タイプ\nClose=閉じる\nListeners=リスナー\nWorkItemHandlers=ワークアイテムハンドラー\nInvalidPackageName=パッケージ名 \"{0}\" は有効な ID ではありません。\nKnowledgeSessions=ナレッジセッション\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=すでに該当する名前のアイテムが存在します。別の名前を選択してください。\nProjectScreenWithName=プロジェクト: [{0}]\nRefreshProblemsPanel=更新\nRefreshing=リフレッシュ中...\nABuildIsAlreadyRunning=ビルドは既に実行されています。\nXsdIDError=名前は文字またはアンダーラインで始まる必要があり、文字、数字、アンダーライン、ハイフン、およびピリオドのみを使用できます。\nNoDependencies=定義された依存関係がありません。\nEnterAGroupID=グループ ID を入力...\nEnterAnArtifactID=アーティファクト ID を入力...\nEnterAVersion=バージョンを入力...\nExceptionPackageAlreadyExists0=パッケージ \"{0}\" はすでに存在します。\nProjectStructure=プロジェクト構造\nInheritedFromAParentPOM=親 POM から継承済み\nParentsGroupArtifactVersion=親のグループ、アーティファクト、およびバージョン\ninvalidGroupId=無効なグループ ID 形式\ninvalidArtifactId=無効なアーティファクト ID 形式\ninvalidVersion=無効なバージョン形式\ninvalidName=無効な名前\nConflictingRepositoriesTitle=競合するリポジトリー\nConflictingRepositoriesGAVDescription=以下のリポジトリーにはアーティファクト \"{0}:{1}:{2}\" がすでに含まれています。\nConflictingRepositoriesOverride=オーバーライド\nRepositoryId=Id\nRepositoryUrl=URL\nRepositorySource=ソース\nRepositorySourceLocal=ローカル\nRepositorySourceProject=プロジェクト\nRepositorySourceSettings=Maven の設定\nRepositorySourceDistributionManagement=ディストリビューションの管理\nRepositorySourceUnknown=不明\nProjectsNode=プロジェクト\nProjectsHelp=プロジェクトオーサリングパースペクティブで、プロジェクトエディター画面でプロジェクトの作成、更新、削除、または構築が可能なユーザーと、プロジェクトエクスプローラーに表示するプロジェクトを設定します。\nProjectResource=プロジェクト\nProjectActionRead=読み込み\nProjectActionUpdate=更新\nProjectActionDelete=削除\nProjectActionCreate=作成\nProjectActionBuild=ビルド\n\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_pt_BR.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nProjectModel=Modelo de Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nStatefulKSessions=Stateful KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nStatelessKSessions=Stateless KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nEqualsBehavior=Iguala o Comportamento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nEventProcessingMode=Modo Processado do Evento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nClock=Relógio\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nRealtime=Tempo real\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nPseudo=Pseudo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nAddKSession=Adicionar KSession\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nDeleteKSession=Excluir KSession\nAdd=Adicionar\nRename=Renomear\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nMakeDefault=Fazer Padrão\nNew=Novo\nDelete=Excluir\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nIdentity=Identidade\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nEquality=Igualmente\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nStream=Fluxo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nCloud=Nuvem\nName=Nome\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nPleaseSelectAKBase=Por favor selecione uma base de conhecimento.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nOk=OK\nCancel=Cancelar\nPleaseSetAName=Por favor determine um nome\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nPleaseSelectAKSession=Por favor selecione uma sessão de conhecimento.\nSave=Salvar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nSaveSuccessful=O arquivo {0} foi salvo com sucesso\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nBuildAndDeploy=Construir & Implantar\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nSaveBeforeBuildAndDeploy=Você deseja salvar também as possíveis alterações ao projeto?\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nBuilding=Construindo...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nBuildSuccessful=Construído com Sucesso\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nBuildFailed=Falha na construção\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nEnableKieProject=Habilitar Projeto Kie\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nKBases=KBases\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nLine=Linha\nColumn=Coluna\nText=Texto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nLevel=Nível\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nPomDotXml=pom.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nKModuleDotXml=kmodule.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nProblems=Problemas\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nFileName=Arquivo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nGroupID=ID do Grupo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nGroupIdExample=Amostra\\: com.myorganization.myprojects\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nGroupIdMoreInfo=Um identificador único universalmente para um projeto. É normal usar um nome de pacote inteiramente qualificado para distingui-lo de outros projetos com um nome parecido.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nArtifactID=ID do Artefato\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nArtifactIDExample=Amostra\\: MyProject\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nArtifactIDMoreInfo=O identificador para este artefato que é único ao grupo fornecido pela ID do grupo. Um artefato é algo que é tanto produzido ou usado por um projeto. Amostras dos artefatos produzidos pelo Mavan para um projeto incluem\\: JARs, fonte e distribuições binárias e WARs.\nVersion=Versão\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nVersionExample=Exemplo\\: 1.0.0\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nVersionMoreInfo=A versão atual do artefato produzido por este projeto.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nMoreInfo=Maiores informações\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nDependencies=Dependências\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nAddFromRepository=Adicionar a partir do repositório\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nPomDotXmlMetadata=metadados pom.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author ldelima@redhat.com\nKModuleDotXmlMetadata=metadados kmodule.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nnewProjectDescription=Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nnewPackageDescription=Pacote\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nNoRepositorySelectedPleaseSelectARepository=Nenhum repositório selecionado. Por favor selecione um repositório.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nXMLMarkIsNotAllowed=XML markup \">\", \"<\" and \"&\" is not allowed in GAV\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nGroupIdMissing=A ID do grupo deve conter um valor válido\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nArtifactIdMissing=A ID do artefato deve conter um valor válido\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nVersionMissing=A ID da versão contém um valor válido\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectScreen=Tela do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nNewProject=Novo Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nPleaseSelectAnItem=Por favor selecione um Item\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nImportSuggestions=Importar sugestões\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nImportSuggestionsMetadata=Importar Metadados das Sugestões\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectSettings=Configurações do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectGeneralSettings=Configurações Gerais do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectName=Nome do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectNamePlaceHolder=Inserir o nome do projeto ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectDescription=Descrição do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectDescriptionPlaceHolder=Inserir a descrição do projeto para propósitos de documentação ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nGroupArtifactVersion=Versão do artefato do grupo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author ldelima@redhat.com\nMetadata=Metadados\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author ldelima@redhat.com\nSource=Fonte\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nKnowledgeBaseSettings=Configurações Básicas de Conhecimento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-config-resource-widget/org/kie/workbench/common/widgets/configresource/client/resources/i18n/ImportConstants, author ldelima@redhat.com\nImports=Importa\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nDSL=DSL\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nEnums=Enums\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nDependenciesList=Lista de Dependências\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nKnowledgeBasesAndSessions=Bases e sessões de conhecimento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nBracketDefaultBracket=(padrão)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nPackages=Pacotes\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nNewProjectWizard=Novo Assistente do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nIncludedKnowledgeBases=Conhecimentos Básicos Incluídos\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nStateful=Stateful\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nStateless=Stateless\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nState=Estado\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nWorkItemHandler=Manuseador do Item de Trabalho\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nDefault=Padrão\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nOptions=Opções\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nConsoleLogger=Registrador do Console\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nFileLogger=Registrador do Arquivo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nInterval=Intervalo\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nWorkingMemoryEventListener=Trabalhando com o ouvinte do evento de memória \n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nAgendaEventListener=Ouvinte do evento agenda\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProcessEventListener=Processar o ouvinte do evento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nKind=Classe\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author ldelima@redhat.com\nType=Tipo\nClose=Encerrar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nListeners=Ouvintes\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nWorkItemHandlers=Manuseadores do item de trabalho\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nInvalidPackageName=O nome do pacote \"{0}\" não é um identificador válido.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nKnowledgeSessions=Sessões de Conhecimento\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=Já existe um item com o nome gerado. Por favor selecione outro nome.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectScreenWithName=Projeto\\: [{0}]\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshProblemsPanel=Atualizar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author nmirasch\nRefreshing=Restaurando...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nABuildIsAlreadyRunning=Uma construção já está sendo executada\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nXsdIDError=O nome precisa iniciar com uma letra ou sublinhado e o nome não pode conter outros caracteres a não ser que letras, sublinhado, hífen e períodos.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nNoDependencies=Nenhuma dependência definida.\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nEnterAGroupID=Insira a ID do Grupo...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nEnterAnArtifactID=Insira a ID do Artefato...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nEnterAVersion=Insira a Versão...\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nExceptionPackageAlreadyExists0=O pacote \"{0}\" já existe.\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nProjectStructure=Estrutura do Projeto\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author ldelima@redhat.com\nInheritedFromAParentPOM=Herdado de um POM pai\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\nParentsGroupArtifactVersion=Versão, Artefato e Grupo Pai\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\ninvalidGroupId=Formato de ID de Grupo inválida\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\ninvalidArtifactId=Formato de ID de Artefato inválida\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author ldelima@redhat.com\ninvalidVersion=Formato de Versão Inválida\ninvalidName=Nome inválido\nConflictingRepositoriesTitle=Repositórios em conflito\nConflictingRepositoriesGAVDescription=Os seguintes repositórios já contém o Artefato \"{0}\\:{1}\\:{2}\".\nConflictingRepositoriesOverride=Substituir\nRepositoryId=Id\nRepositoryUrl=URL\nRepositorySource=Fonte\nRepositorySourceLocal=Local\nRepositorySourceProject=Projeto\nRepositorySourceSettings=Configurações do Maven\nRepositorySourceDistributionManagement=Gerenciamento de Distribuição\nRepositorySourceUnknown=Desconhecido(a)\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/main/resources/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants_zh_CN.properties",
    "content": "# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nProjectModel=项目模型\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nStatefulKSessions=Stateful KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nStatelessKSessions=Stateless KSessions\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nEqualsBehavior=相等行为\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nEventProcessingMode=事件处理模式\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nClock=时钟\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nRealtime=实时\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nPseudo=Pseudo\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nAddKSession=添加 KSession\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nDeleteKSession=删除 KSession\nAdd=添加\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nRename=重命名\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nMakeDefault=设置为默认\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNew=新建\n# auto translated by TM merge from project: Drools Workbench, version: 6.2.0, DocId: org.drools/drools-wb-guided-rule-editor-client/org/drools/workbench/screens/guided/rule/client/resources/i18n/Constants\nDelete=删除\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nIdentity=标识符\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nEquality=相等\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nStream=流\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nCloud=云\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nName=名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nPleaseSelectAKBase=请选择知识库\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nOk=确认\nCancel=取消\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nPleaseSetAName=请设置名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nPleaseSelectAKSession=请选择知识会话。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSave=保存\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nSaveSuccessful=文件 {0} 保存成功\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nBuildAndDeploy=构建 & 部署\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nSaveBeforeBuildAndDeploy=也保存可能对项目的修改吗？\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nBuilding=构建中...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nBuildSuccessful=构建成功\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nBuildFailed=构建失败\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nEnableKieProject=启用 Kie 项目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nKBases=KBases\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nLine=行\nColumn=列\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nText=文本\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nLevel=级别\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nPomDotXml=pom.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nKModuleDotXml=kmodule.xml\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nProblems=问题\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nFileName=文件\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nGroupID=组 ID\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nGroupIdExample=示例\\: com.myorganization.myprojects\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nGroupIdMoreInfo=项目的唯一标识符。使用全限定软件包名来区分其他具有类似名称的项目是很正常的。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nArtifactID=Artifact ID\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nArtifactIDExample=示例\\: MyProject\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nArtifactIDMoreInfo=以组 ID 指定的组里唯一的 artifact 的标识符。Artifact 是项目产生或所使用的。Maven 产生的 Artifact 的例子包括：JAR 文件、源文件和二进制版本、WAR 文件。\nVersion=版本\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nVersionExample=示例：1.0.0\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nVersionMoreInfo=这个项目生成的 artifact 的当前版本\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nMoreInfo=更多的信息\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nDependencies=依赖关系\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nAddFromRepository=从资料库添加\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nPomDotXmlMetadata=pom.xml 元数据\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-imports-editor-client/org/kie/workbench/common/screens/projectimportsscreen/client/resources/i18n/ProjectConfigScreenConstants, author xi.huang\nKModuleDotXmlMetadata=kmodule.xml 元数据\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nnewProjectDescription=项目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nnewPackageDescription=软件包\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nNoRepositorySelectedPleaseSelectARepository=没有选择资料库。请选择资料库。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nXMLMarkIsNotAllowed=GAV 里不允许 XML markup \">\", \"<\" 和 \"&\"\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nGroupIdMissing=组 ID 必须包含有效的值\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nArtifactIdMissing=Artifact ID 必须包含有效的值\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nVersionMissing=版本 ID 必须包含有效的值\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectScreen=项目屏幕\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nNewProject=创建新项目\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nPleaseSelectAnItem=请选择项目\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nImportSuggestions=导入建议\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nImportSuggestionsMetadata=导入建议元数据\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectSettings=项目设置\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectGeneralSettings=项目常用设置\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectName=项目名称\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectNamePlaceHolder=插入项目名称 ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectDescription=项目描述\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectDescriptionPlaceHolder=插入用于文档目的的项目描述 ...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nGroupArtifactVersion=组的 Artifact 版本\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-metadata-widget/org/kie/workbench/common/widgets/metadata/client/resources/i18n/MetadataConstants, author xi.huang\nMetadata=元数据\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author xi.huang\nSource=源\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nKnowledgeBaseSettings=知识库设置\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-config-resource-widget/org/kie/workbench/common/widgets/configresource/client/resources/i18n/ImportConstants, author xi.huang\nImports=导入\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nDSL=DSL\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nEnums=枚举\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nDependenciesList=依赖关系列表\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nKnowledgeBasesAndSessions=知识库和会话\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nBracketDefaultBracket=(默认)\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nPackages=软件包\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nNewProjectWizard=新建项目向导\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants\nIncludedKnowledgeBases=Included Knowledge Bases\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nStateful=Stateful\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nStateless=Stateless\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nState=状态\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nWorkItemHandler=操作条目处理程序\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nDefault=默认值\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nOptions=选项\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nConsoleLogger=控制台 logger\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nFileLogger=文件 logger\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nInterval=间隔\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nWorkingMemoryEventListener=操作内存事件侦听程序\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nAgendaEventListener=日程事件 listener\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProcessEventListener=进程事件 listener\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nKind=种类\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-search-screen-client/org/kie/workbench/common/screens/search/client/resources/i18n/Constants, author xi.huang\nType=类型\nClose=关闭\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nListeners=Listener\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nWorkItemHandlers=操作项目处理程序\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nInvalidPackageName=软件包名 \"{0}\" 不是有效的标识符。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nKnowledgeSessions=知识会话\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nThereAlreadyExistAnItemWithTheGivenNamePleaseSelectAnotherName=已存在具有这个名称的项目。请选择其他的名称。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectScreenWithName=项目\\: [{0}]\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nRefreshProblemsPanel=刷新\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nRefreshing=正在刷新...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nABuildIsAlreadyRunning=构建已在运行\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nXsdIDError=名称必须以字母或下划线开始，且不能包含除了字母、数字、下划线、连字符和句点之外的其他字符。\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nNoDependencies=未定义依赖关系\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nEnterAGroupID=输入组 ID...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nEnterAnArtifactID=输入 Artifact ID...\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nEnterAVersion=输入版本...\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nExceptionPackageAlreadyExists0=软件包 \"{0}\" 已经存在。\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nProjectStructure=项目结构\n# translation auto-copied from project KIE Workbench - Common, version 6.2.0, document org.kie.workbench.screens/kie-wb-common-project-editor-client/org/kie/workbench/common/screens/projecteditor/client/resources/i18n/ProjectEditorConstants, author xi.huang\nInheritedFromAParentPOM=从父 POM 继承\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\nParentsGroupArtifactVersion=父 POM 的组、构建和版本\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\ninvalidGroupId=无效的 Group ID 格式\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\ninvalidArtifactId=无效的 Artifact ID 格式\n# translation auto-copied from project guvnor, version 6.2.0, document org.guvnor/guvnor-project-client/org/guvnor/common/services/project/client/resources/i18n/ProjectConstants, author xi.huang\ninvalidVersion=无效的版本格式\ninvalidName=无效名称\nConflictingRepositoriesTitle=冲突的存储库\nConflictingRepositoriesGAVDescription=以下存储库中已包含构件 \"{0}\\:{1}\\:{2}\"。\nConflictingRepositoriesOverride=覆盖\nRepositoryId=Id\nRepositoryUrl=URL\nRepositorySource=源\nRepositorySourceLocal=本地\nRepositorySourceProject=项目\nRepositorySourceSettings=Maven 设置\nRepositorySourceDistributionManagement=发布管理\nRepositorySourceUnknown=未知\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/GAVEditorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GAVEditorTest {\n\n    @Mock\n    GroupIdChangeHandler groupIdChangeHandler;\n\n    @Mock\n    ArtifactIdChangeHandler artifactIdChangeHandler;\n\n    @Mock\n    VersionChangeHandler versionChangeHandler;\n\n    @GwtMock\n    GAVEditorViewImpl view;\n\n    private GAVEditor editor;\n\n    private GAV gav;\n\n    @Before\n    public void setUp() throws Exception {\n        editor = new GAVEditor(view);\n\n        verify(view,\n               times(1)).setPresenter(editor);\n\n        gav = new GAV(\"groupId\",\n                      \"artifactId\",\n                      \"version\");\n    }\n\n    @Test\n    public void testSetGav() {\n        editor.setGAV(gav);\n\n        verify(view,\n               times(1)).setGroupId(gav.getGroupId());\n        verify(view,\n               times(1)).setArtifactId(gav.getArtifactId());\n        verify(view,\n               times(1)).setVersion(gav.getVersion());\n    }\n\n    @Test\n    public void testSetArtifactID() throws Exception {\n        editor.setGAV(gav);\n        editor.setArtifactID(\"changed\");\n\n        verify(view,\n               times(1)).setArtifactId(eq(\"changed\"));\n\n        assertEquals(\"changed\",\n                     gav.getArtifactId());\n    }\n\n    @Test\n    public void testGroupChangeHandler() {\n        editor.addGroupIdChangeHandler(groupIdChangeHandler);\n        editor.setGAV(gav);\n\n        editor.onGroupIdChange(\"changedGroup\");\n\n        verify(groupIdChangeHandler,\n               times(1)).onChange(\"changedGroup\");\n        assertEquals(\"changedGroup\",\n                     gav.getGroupId());\n    }\n\n    @Test\n    public void testArtifactChangeHandler() {\n        editor.addArtifactIdChangeHandler(artifactIdChangeHandler);\n        editor.setGAV(gav);\n\n        editor.onArtifactIdChange(\"artifactChanged\");\n\n        verify(artifactIdChangeHandler,\n               times(1)).onChange(\"artifactChanged\");\n        assertEquals(\"artifactChanged\",\n                     gav.getArtifactId());\n    }\n\n    @Test\n    public void testVersionChangeHandler() {\n        editor.addVersionChangeHandler(versionChangeHandler);\n        editor.setGAV(gav);\n\n        editor.onVersionChange(\"versionChanged\");\n\n        verify(versionChangeHandler,\n               times(1)).onChange(\"versionChanged\");\n        assertEquals(\"versionChanged\",\n                     gav.getVersion());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/GAVEditorViewImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class GAVEditorViewImplTest {\n\n    @Mock\n    private KeyUpEvent event;\n\n    @Mock\n    private GAVEditorView.Presenter presenter;\n\n    @Mock\n    TextBox textBoxVersion;\n\n    @Mock\n    TextBox textBoxGroup;\n\n    @Mock\n    TextBox textBoxArtifact;\n\n    GAVEditorViewImpl view;\n\n    @Before\n    public void init() {\n        view = new GAVEditorViewImpl();\n        view.setPresenter(presenter);\n        view.artifactIdTextBox = textBoxArtifact;\n        view.groupIdTextBox = textBoxGroup;\n        view.versionTextBox = textBoxVersion;\n    }\n\n    @Test\n    public void testArtifactChange() {\n        when(textBoxArtifact.getText()).thenReturn(\"artifact\");\n\n        view.onArtifactIdChange(event);\n        verify(presenter,\n               times(1)).onArtifactIdChange(\"artifact\");\n    }\n\n    @Test\n    public void testGroupChange() {\n        when(textBoxGroup.getText()).thenReturn(\"group\");\n\n        view.onGroupIdChange(event);\n        verify(presenter,\n               times(1)).onGroupIdChange(\"group\");\n    }\n\n    @Test\n    public void testVersionChange() {\n        when(textBoxVersion.getText()).thenReturn(\"version\");\n\n        view.onVersionChange(event);\n        verify(presenter,\n               times(1)).onVersionChange(\"version\");\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/POMEditorPanelTest.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport org.guvnor.common.services.project.client.preferences.ProjectScopedResolutionStrategySupplier;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.preferences.GAVPreferences;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class POMEditorPanelTest {\n\n    @Mock\n    private POMEditorPanelView view;\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private GAVPreferences gavPreferences;\n\n    @Mock\n    private ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier;\n\n    private POMEditorPanel panel;\n    private POMEditorPanelView.Presenter presenter;\n\n    @Before\n    public void setUp() throws Exception {\n        setChildGAVEdit(false);\n\n        panel = new POMEditorPanel(view,\n                                   iocManager,\n                                   gavPreferences,\n                                   projectScopedResolutionStrategySupplier);\n        presenter = panel;\n\n        verify(view,\n               times(1)).setPresenter(presenter);\n\n        doAnswer(invocationOnMock -> {\n            ((ParameterizedCommand<GAVPreferences>) invocationOnMock.getArguments()[1]).execute(gavPreferences);\n            return null;\n        }).when(gavPreferences).load(any(),\n                                     any(),\n                                     any());\n    }\n\n    @Test\n    public void testAddArtifactChangeHandler() {\n        ArtifactIdChangeHandler handler = mock(ArtifactIdChangeHandler.class);\n        panel.addArtifactIdChangeHandler(handler);\n\n        verify(view,\n               times(1)).addArtifactIdChangeHandler(handler);\n    }\n\n    @Test\n    public void testAddGroupChangeHandler() {\n        GroupIdChangeHandler handler = mock(GroupIdChangeHandler.class);\n        panel.addGroupIdChangeHandler(handler);\n\n        verify(view,\n               times(1)).addGroupIdChangeHandler(handler);\n    }\n\n    @Test\n    public void testAddVersionChangeHandler() {\n        VersionChangeHandler handler = mock(VersionChangeHandler.class);\n        panel.addVersionChangeHandler(handler);\n\n        verify(view,\n               times(1)).addVersionChangeHandler(handler);\n    }\n\n    @Test\n    public void testLoadSingleModule() throws Exception {\n        POM gavModel = createTestModel(\"pomName\",\n                                       \"pomDescription\",\n                                       \"pomUrl\",\n                                       \"group\",\n                                       \"artifact\",\n                                       \"1.1.1\");\n        panel.setPOM(gavModel,\n                     false);\n\n        verify(view).setName(\"pomName\");\n        verify(view).setDescription(\"pomDescription\");\n        verify(view).enableGroupID();\n        verify(view).enableArtifactID();\n        verify(view).enableVersion();\n        verify(view).hideParentGAV();\n    }\n\n    @Test\n    public void testLoadMultiModule() throws Exception {\n        POM gavModel = createTestModelWithParent(\"group\",\n                                                 \"artifact\",\n                                                 \"1.1.1\");\n\n        panel.setPOM(gavModel,\n                     false);\n\n        verify(view).setGAV(gavModel.getGav());\n        verify(view).setTitleText(\"artifact\");\n        verify(view).setParentGAV(gavModel.getParent());\n        verify(view).disableGroupID(\"\");\n        verify(view).enableArtifactID();\n        verify(view).disableVersion(\"\");\n        verify(view).showParentGAV();\n    }\n\n    @Test\n    public void testProjectNameValidation() throws Exception {\n        panel.setValidName(true);\n        verify(view).setValidName(true);\n\n        panel.setValidName(false);\n        verify(view).setValidName(false);\n    }\n\n    @Test\n    public void testGroupIDValidation() throws Exception {\n        panel.setValidGroupID(true);\n        verify(view).setValidGroupID(true);\n\n        panel.setValidGroupID(false);\n        verify(view).setValidGroupID(false);\n    }\n\n    @Test\n    public void testArtifactIDValidation() throws Exception {\n        panel.setValidArtifactID(true);\n        verify(view).setValidArtifactID(true);\n\n        panel.setValidArtifactID(false);\n        verify(view).setValidArtifactID(false);\n    }\n\n    @Test\n    public void testVersionValidation() throws Exception {\n        panel.setValidVersion(true);\n        verify(view).setValidVersion(true);\n\n        panel.setValidVersion(false);\n        verify(view).setValidVersion(false);\n    }\n\n    @Test\n    public void testOpenProjectContext() throws Exception {\n        SyncBeanDef iocBeanDef = mock(SyncBeanDef.class);\n        PlaceManager placeManager = mock(PlaceManager.class);\n        when(iocBeanDef.getInstance()).thenReturn(placeManager);\n        when(iocManager.lookupBean(eq(PlaceManager.class))).thenReturn(iocBeanDef);\n\n        presenter.onOpenProjectContext();\n        verify(placeManager).goTo(\"repositoryStructureScreen\");\n    }\n\n    @Test\n    public void testSetPomWhenItHasParentAndChildGAVEditIsDisabled() {\n        POM pom = createTestModelWithParent(\"group\",\n                                            \"artifact\",\n                                            \"1.1.1\");\n\n        panel.setPOM(pom,\n                     false);\n\n        verify(view).enableGroupID();\n        verify(view).enableArtifactID();\n        verify(view).enableVersion();\n        verify(view).showParentGAV();\n        verify(view).disableGroupID(anyString());\n        verify(view).disableVersion(anyString());\n    }\n\n    @Test\n    public void testSetPomWhenItHasParentAndChildGAVEditIsEnabled() {\n        POM pom = createTestModelWithParent(\"group\",\n                                            \"artifact\",\n                                            \"1.1.1\");\n        setChildGAVEdit(true);\n\n        panel.setPOM(pom,\n                     false);\n\n        verify(view).enableGroupID();\n        verify(view).enableArtifactID();\n        verify(view).enableVersion();\n        verify(view).showParentGAV();\n        verify(view,\n               never()).disableGroupID(anyString());\n        verify(view,\n               never()).disableVersion(anyString());\n    }\n\n    @Test\n    public void testSetPomWhenItDoesNotHaveParent() {\n        POM pom = createTestModel(\"group\",\n                                  \"artifact\",\n                                  \"1.1.1\");\n\n        panel.setPOM(pom,\n                     false);\n\n        verify(view).enableGroupID();\n        verify(view).enableArtifactID();\n        verify(view).enableVersion();\n        verify(view).hideParentGAV();\n        verify(view,\n               never()).disableGroupID(anyString());\n        verify(view,\n               never()).disableVersion(anyString());\n    }\n\n    private POM createTestModelWithParent(final String group,\n                                          final String artifact,\n                                          final String version) {\n        POM gavModel = createTestModel(group,\n                                       artifact,\n                                       version);\n        gavModel.setParent(new GAV());\n        return gavModel;\n    }\n\n    private POM createTestModel(final String group,\n                                final String artifact,\n                                final String version) {\n        return new POM(new GAV(group,\n                               artifact,\n                               version));\n    }\n\n    private POM createTestModel(final String name,\n                                final String description,\n                                final String url,\n                                final String group,\n                                final String artifact,\n                                final String version) {\n        return new POM(name,\n                       description,\n                       url,\n                       new GAV(group,\n                               artifact,\n                               version));\n    }\n\n    private void setChildGAVEdit(final boolean value) {\n        doReturn(value).when(gavPreferences).isChildGAVEditEnabled();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/POMEditorPanelViewImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client;\n\nimport com.google.gwt.event.dom.client.KeyUpEvent;\nimport com.google.gwt.event.logical.shared.ValueChangeEvent;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.common.services.project.client.resources.ProjectResources;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.TextArea;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class POMEditorPanelViewImplTest {\n\n    @Mock\n    POMEditorPanelView.Presenter presenter;\n\n    @GwtMock\n    TextBox pomName;\n\n    @GwtMock\n    TextArea pomDescription;\n\n    @GwtMock\n    HelpBlock pomNameHelp;\n\n    @GwtMock\n    FormGroup pomNameGroup;\n\n    POMEditorPanelViewImpl view;\n\n    @Before\n    public void setup() {\n        view = new POMEditorPanelViewImpl();\n        view.setPresenter(presenter);\n        view.pomNameTextBox = pomName;\n        view.pomDescriptionTextArea = pomDescription;\n        view.pomNameHelpBlock = pomNameHelp;\n        view.pomNameGroup = pomNameGroup;\n    }\n\n    @Test\n    public void testNameChangeHanlder() {\n        when(pomName.getText()).thenReturn(\"name\");\n\n        view.onNameChange(mock(KeyUpEvent.class));\n        verify(presenter,\n               times(1)).onNameChange(\"name\");\n    }\n\n    @Test\n    public void testDescriptionChangeHandler() {\n        when(pomDescription.getText()).thenReturn(\"descr\");\n\n        view.onDescriptionChange(mock(ValueChangeEvent.class));\n        verify(presenter,\n               times(1)).onDescriptionChange(\"descr\");\n    }\n\n    @Test\n    public void testValidName() {\n        view.setValidName(true);\n\n        verify(pomNameGroup,\n               times(1)).setValidationState(ValidationState.NONE);\n        verify(pomNameHelp,\n               times(1)).setText(\"\");\n\n        verify(pomNameGroup,\n               never()).setValidationState(ValidationState.ERROR);\n    }\n\n    @Test\n    public void testInvalidName() {\n        view.setValidName(false);\n\n        verify(pomNameGroup,\n               times(1)).setValidationState(ValidationState.ERROR);\n        verify(pomNameHelp,\n               times(1)).setText(ProjectResources.CONSTANTS.invalidName());\n\n        verify(pomNameGroup,\n               never()).setValidationState(ValidationState.NONE);\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/context/WorkspaceProjectContextTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.context;\n\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.context.ProjectContextChangeHandle;\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeHandler;\nimport org.guvnor.common.services.project.events.ModuleUpdatedEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.Package;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.UpdatedOrganizationalUnitEvent;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Spy;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkspaceProjectContextTest {\n\n    @Spy\n    private EventSourceMock<WorkspaceProjectContextChangeEvent> changeEvent = new EventSourceMock<>();\n\n    @Captor\n    private ArgumentCaptor<WorkspaceProjectContextChangeEvent> previous;\n\n    @Captor\n    private ArgumentCaptor<WorkspaceProjectContextChangeEvent> next;\n\n    private WorkspaceProjectContext context;\n\n    @Before\n    public void setUp() throws Exception {\n        context = new WorkspaceProjectContext(changeEvent);\n\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocationOnMock) throws Throwable {\n                context.onProjectContextChanged((WorkspaceProjectContextChangeEvent) invocationOnMock.getArguments()[0]);\n                return null;\n            }\n        }).when(changeEvent).fire(any(WorkspaceProjectContextChangeEvent.class));\n    }\n\n    @Test\n    public void testGetActiveRepositoryRoot() throws Exception {\n\n        final Path devRoot = mock(Path.class);\n\n        context.setActiveWorkspaceProject(new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                               mock(Repository.class),\n                                                               new Branch(\"dev\",\n                                                                          devRoot),\n                                                               mock(Module.class)));\n\n        assertEquals(Optional.of(devRoot),\n                     context.getActiveRepositoryRoot());\n    }\n\n    @Test\n    public void testContextChanged() throws Exception {\n        final OrganizationalUnit oldOrganizationalUnit = mock(OrganizationalUnit.class);\n        final Repository oldRepository = mock(Repository.class);\n        final Package oldPackage = new Package();\n        final Module oldModule = new Module();\n\n        context.setActiveOrganizationalUnit(oldOrganizationalUnit);\n        WorkspaceProject oldProject = new WorkspaceProject(oldOrganizationalUnit,\n                                                           oldRepository,\n                                                           mock(Branch.class),\n                                                           mock(Module.class));\n        context.setActiveWorkspaceProject(oldProject);\n        context.setActivePackage(oldPackage);\n        context.setActiveModule(oldModule);\n\n        final OrganizationalUnit newOrganizationalUnit = mock(OrganizationalUnit.class);\n        final Branch newBranch = new Branch(\"main\",\n                                            mock(Path.class));\n        final Package newPackage = new Package();\n        final Module newModule = new Module();\n\n        final WorkspaceProjectContextChangeHandler changeHandler = mock(WorkspaceProjectContextChangeHandler.class);\n        context.addChangeHandler(changeHandler);\n\n        final WorkspaceProject newWorkspaceProject = new WorkspaceProject(newOrganizationalUnit,\n                                                                          mock(Repository.class),\n                                                                          newBranch,\n                                                                          mock(Module.class));\n        WorkspaceProjectContextChangeEvent event = new WorkspaceProjectContextChangeEvent(newWorkspaceProject,\n                                                                                          newModule,\n                                                                                          newPackage);\n        context.onProjectContextChanged(event);\n\n        assertEquals(Optional.of(newOrganizationalUnit),\n                     context.getActiveOrganizationalUnit());\n        assertEquals(Optional.of(newWorkspaceProject),\n                     context.getActiveWorkspaceProject());\n        assertEquals(Optional.of(newModule),\n                     context.getActiveModule());\n        assertEquals(Optional.of(newPackage),\n                     context.getActivePackage());\n        verify(changeHandler).onChange(eq(new WorkspaceProjectContextChangeEvent(oldProject,\n                                                                                 oldModule,\n                                                                                 oldPackage)),\n                                       eq(event));\n    }\n\n    @Test\n    public void testOnOrganizationalUnitUpdate() {\n\n        WorkspaceProjectContextChangeHandler changeHandler = mock(WorkspaceProjectContextChangeHandler.class);\n        context.addChangeHandler(changeHandler);\n\n        final OrganizationalUnit oldOrganizationalUnit = mock(OrganizationalUnit.class);\n        final Repository oldRepository = mock(Repository.class);\n        final Package oldPackage = new Package();\n        final Module oldModule = new Module();\n\n        WorkspaceProject oldProject = new WorkspaceProject(oldOrganizationalUnit,\n                                                           oldRepository,\n                                                           mock(Branch.class),\n                                                           mock(Module.class));\n\n        final OrganizationalUnit newOrganizationalUnit = mock(OrganizationalUnit.class);\n\n        context.setActiveModule(oldModule);\n        context.setActiveOrganizationalUnit(oldOrganizationalUnit);\n        context.setActivePackage(oldPackage);\n        context.setActiveWorkspaceProject(oldProject);\n\n        UpdatedOrganizationalUnitEvent event = new UpdatedOrganizationalUnitEvent(newOrganizationalUnit,\n                                                                                  \"name\");\n        this.context.onOrganizationalUnitUpdated(event);\n\n        verify(changeHandler).onChange(previous.capture(),\n                                       next.capture());\n\n        assertEquals(previous.getValue().getModule(),\n                     next.getValue().getModule());\n        assertEquals(previous.getValue().getPackage(),\n                     next.getValue().getPackage());\n        assertNotEquals(previous.getValue().getWorkspaceProject(),\n                        next.getValue().getWorkspaceProject());\n        assertNotEquals(previous.getValue().getOrganizationalUnit(),\n                        next.getValue().getOrganizationalUnit());\n    }\n\n    @Test\n    public void testContextChangeHandlerGetsRemoved() throws Exception {\n        WorkspaceProjectContextChangeHandler changeHandler = mock(WorkspaceProjectContextChangeHandler.class);\n        ProjectContextChangeHandle handle = context.addChangeHandler(changeHandler);\n\n        context.onProjectContextChanged(new WorkspaceProjectContextChangeEvent());\n\n        verify(changeHandler).onChange(any(),\n                                       eq(new WorkspaceProjectContextChangeEvent()));\n\n        context.removeChangeHandler(handle);\n\n        reset(changeHandler);\n\n        context.onProjectContextChanged(new WorkspaceProjectContextChangeEvent());\n\n        verify(changeHandler,\n               never()).onChange(any(),\n                                 any());\n    }\n\n    @Test\n    public void testNoUpdateWhenNoActiveModule() throws Exception {\n\n        context.onModuleUpdated(new ModuleUpdatedEvent(getMockModule(),\n                                                       getMockModule()));\n        verify(changeEvent, never()).fire(any());\n    }\n\n    @Test\n    public void testNoUpdateWhenDifferentActiveModule() throws Exception {\n\n        final Module oldModule = getMockModule();\n\n        context.onProjectContextChanged(new WorkspaceProjectContextChangeEvent(new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                                                    mock(Repository.class),\n                                                                                                    mock(Branch.class),\n                                                                                                    oldModule),\n                                                                               oldModule));\n\n        context.onModuleUpdated(new ModuleUpdatedEvent(getMockModule(),\n                                                       getMockModule()));\n        verify(changeEvent, never()).fire(any());\n    }\n\n    @Test\n    public void testActiveModuleIsUpdated() throws Exception {\n\n        final Module oldModule = getMockModule();\n\n        context.onProjectContextChanged(new WorkspaceProjectContextChangeEvent(new WorkspaceProject(mock(OrganizationalUnit.class),\n                                                                                                    mock(Repository.class),\n                                                                                                    mock(Branch.class),\n                                                                                                    oldModule),\n                                                                               oldModule));\n\n        context.onModuleUpdated(new ModuleUpdatedEvent(oldModule,\n                                                       getMockModule()));\n        verify(changeEvent).fire(any());\n    }\n\n    private Module getMockModule() {\n        return new Module(mock(Path.class),\n                          mock(Path.class),\n                          new POM());\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/preferences/ModuleScopedResolutionStrategySupplierTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.preferences;\n\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ModuleScopedResolutionStrategySupplierTest {\n\n    @Mock\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    private ProjectScopedResolutionStrategySupplier projectScopedResolutionStrategySupplier;\n\n    private Module module;\n\n    @Before\n    public void setup() {\n        projectScopedResolutionStrategySupplier = spy(new ProjectScopedResolutionStrategySupplier(scopeResolutionStrategies));\n\n        module = mock(Module.class);\n        doReturn(\"projectIdentifierEncoded\").when(module).getEncodedIdentifier();\n    }\n\n    @Test\n    public void getWithoutProjectTest() {\n        final PreferenceScopeResolutionStrategyInfo preferenceScopeResolutionStrategyInfo = projectScopedResolutionStrategySupplier.get();\n\n        verify(scopeResolutionStrategies).getUserInfoFor(null,\n                                                         null);\n    }\n\n    @Test\n    public void getWithProjectTest() {\n        WorkspaceProjectContextChangeEvent event = mock(WorkspaceProjectContextChangeEvent.class);\n        doReturn(module).when(event).getModule();\n\n        projectScopedResolutionStrategySupplier.selectedProjectChanged(event);\n        final PreferenceScopeResolutionStrategyInfo preferenceScopeResolutionStrategyInfo = projectScopedResolutionStrategySupplier.get();\n\n        verify(scopeResolutionStrategies).getUserInfoFor(\"project\",\n                                                         \"projectIdentifierEncoded\");\n    }\n}"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/preferences/SpaceScopedResolutionStrategySupplierTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.preferences;\n\nimport org.guvnor.common.services.project.context.WorkspaceProjectContextChangeEvent;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SpaceScopedResolutionStrategySupplierTest {\n\n    private SpaceScopedResolutionStrategySupplier strategySupplier;\n\n    @Mock\n    private WorkbenchPreferenceScopeResolutionStrategies scopeResolutionStrategies;\n\n    @Before\n    public void setup() {\n        strategySupplier = spy(new SpaceScopedResolutionStrategySupplier(scopeResolutionStrategies));\n    }\n\n    @Test\n    public void getWithoutOrganizationalUnitTest() {\n        final PreferenceScopeResolutionStrategyInfo strategyInfo = strategySupplier.get();\n\n        verify(scopeResolutionStrategies).getSpaceInfoFor(null);\n    }\n\n    @Test\n    public void getWithOrganizationalUnitTest() {\n        final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);\n        doReturn(\"identifier\").when(organizationalUnit).getIdentifier();\n\n        final WorkspaceProjectContextChangeEvent event = mock(WorkspaceProjectContextChangeEvent.class);\n        doReturn(organizationalUnit).when(event).getOrganizationalUnit();\n\n        strategySupplier.onWorkspaceProjectContextChangeEvent(event);\n        final PreferenceScopeResolutionStrategyInfo strategyInfo = strategySupplier.get();\n\n        verify(scopeResolutionStrategies).getSpaceInfoFor(\"identifier\");\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/repositories/ConflictingRepositoriesPopupTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.repositories;\n\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.shared.security.AppRoles;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConflictingRepositoriesPopupTest {\n\n    @Mock\n    ConflictingRepositoriesPopupView view;\n\n    @Mock\n    User user;\n\n    private ConflictingRepositoriesPopup presenter;\n\n    @Before\n    public void setup() {\n        presenter = new ConflictingRepositoriesPopup(user,\n                                                     view);\n    }\n\n    @Test\n    public void testInitialization() {\n        verify(view).init(eq(presenter));\n        verify(view, never()).addOKButton();\n        verify(view, never()).addOverrideButton();\n    }\n\n    @Test\n    public void testSetContent_Administrator() {\n        final GAV gav = mock(GAV.class);\n        final Command command = mock(Command.class);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        final Set<Role> roles = new HashSet<Role>() {{\n            add(new RoleImpl(AppRoles.ADMIN.getName()));\n        }};\n        when(user.getRoles()).thenReturn(roles);\n\n        presenter.setContent(gav, metadata, command);\n\n        verify(view).clear();\n        verify(view).setContent(eq(gav), eq(metadata));\n        verify(view).addOKButton();\n        verify(view).addOverrideButton();\n    }\n\n    @Test\n    public void testSetContent_NotAdministrator() {\n        final GAV gav = mock(GAV.class);\n        final Command command = mock(Command.class);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        final Set<Role> roles = new HashSet<Role>();\n        when(user.getRoles()).thenReturn(roles);\n\n        presenter.setContent(gav,\n                             metadata,\n                             command);\n\n        verify(view).clear();\n        verify(view).setContent(eq(gav), eq(metadata));\n        verify(view).addOKButton();\n        verify(view, never()).addOverrideButton();\n    }\n\n    @Test\n    public void testSetContent_Reuse() {\n        final GAV gav = mock(GAV.class);\n        final Command command = mock(Command.class);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        final Set<Role> roles = new HashSet<Role>() {{\n            add(new RoleImpl(AppRoles.ADMIN.getName()));\n        }};\n        when(user.getRoles()).thenReturn(roles);\n\n        presenter.setContent(gav,\n                             metadata,\n                             command);\n\n        verify(view).clear();\n        verify(view).setContent(eq(gav), eq(metadata));\n        verify(view).addOKButton();\n        verify(view).addOverrideButton();\n\n        //Re-use\n        presenter.setContent(gav, metadata, command);\n        verify(view, times(2)).clear();\n        verify(view, times(2)).setContent(eq(gav),\n                                    eq(metadata));\n        verify(view, times(2)).addOKButton();\n        verify(view, times(2)).addOverrideButton();\n    }\n\n    @Test\n    public void testShow() {\n        presenter.show();\n\n        verify(view).show();\n    }\n\n    @Test\n    public void testHide() {\n        presenter.hide();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testActions() {\n        final Command okCommand = mock(Command.class);\n        final Command overrideCommand = mock(Command.class);\n\n        final GAV gav = mock(GAV.class);\n\n        final Set<MavenRepositoryMetadata> metadata = new HashSet<MavenRepositoryMetadata>();\n        final Set<Role> roles = Collections.singleton(new RoleImpl(AppRoles.ADMIN.getName()));\n\n        when(user.getRoles()).thenReturn(roles);\n\n        presenter.setContent(gav, metadata, okCommand, overrideCommand);\n\n        presenter.override();\n\n        verify(view).hide();\n        verify(overrideCommand).execute();\n\n        presenter.hide();\n        verify(view, times(2)).hide();\n        verify(okCommand).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-project/uberfire-project-client/src/test/java/org/guvnor/common/services/project/client/security/ProjectControllerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.project.client.security;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.security.ProjectPermissionsService;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.RolePermissions;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.security.RepositoryAction;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.promise.SyncPromises;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.same;\nimport static org.mockito.Mockito.anyList;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ProjectControllerTest {\n\n    private static final String SHOW_PROJECT_TOOLBAR = \"projecttoolbar.show\";\n\n    private static final String SHOW_METRICS_TAB = \"metricstab.show\";\n\n    private static final String SHOW_CHANGEREQUEST_TAB = \"changerequesttab.show\";\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private User user;\n\n    @Mock\n    private ProjectPermissionsService projectPermissionsService;\n    private Caller<ProjectPermissionsService> projectPermissionsServiceCaller;\n\n    private Promises promises;\n\n    private ProjectController projectController;\n\n    @Before\n    public void setup() {\n        promises = new SyncPromises();\n        projectPermissionsServiceCaller = new CallerMock<>(projectPermissionsService);\n        projectController = spy(new ProjectController(authorizationManager,\n                                                      user,\n                                                      projectPermissionsServiceCaller,\n                                                      promises));\n    }\n\n    @Test\n    public void userCanViewMetricsTabTest() {\n        when(authorizationManager.authorize(SHOW_METRICS_TAB,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canViewMetricsTab());\n    }\n\n    @Test\n    public void userCanViewMChangeRequestTabTest() {\n        when(authorizationManager.authorize(SHOW_CHANGEREQUEST_TAB,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canViewChangeRequestTab());\n    }\n\n    @Test\n    public void userCanViewProjectToolbarTest() {\n        when(authorizationManager.authorize(SHOW_PROJECT_TOOLBAR,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canViewProjectToolbar());\n    }\n\n    @Test\n    public void userCanCreateProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(Repository.RESOURCE_TYPE,\n                                            RepositoryAction.CREATE,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canCreateProjects(project.getOrganizationalUnit()));\n    }\n\n    @Test\n    public void userCanNotCreateProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(Repository.RESOURCE_TYPE,\n                                            RepositoryAction.CREATE,\n                                            user)).thenReturn(false);\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR),\n                                                              any());\n        assertFalse(projectController.canCreateProjects(project.getOrganizationalUnit()));\n    }\n\n    @Test\n    public void spaceContributorCanCreateProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> spaceContributors = project.getOrganizationalUnit().getContributors();\n        doReturn(true).when(projectController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR),\n                                                             same(spaceContributors));\n        assertTrue(projectController.canCreateProjects(project.getOrganizationalUnit()));\n    }\n\n    @Test\n    public void spaceContributorCanNotCreateProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR),\n                                                              any());\n        assertFalse(projectController.canCreateProjects(project.getOrganizationalUnit()));\n    }\n\n    @Test\n    public void userCanReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.READ,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canReadProject(project));\n    }\n\n    @Test\n    public void userCanNotReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(false).when(projectController).userIsAtLeast(any(),\n                                                              any());\n        assertFalse(projectController.canCreateProjects(project.getOrganizationalUnit()));\n    }\n\n    @Test\n    public void projectContributorCanReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> projectContributors = project.getRepository().getContributors();\n        doReturn(true).when(projectController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR),\n                                                             same(projectContributors));\n        assertTrue(projectController.canReadProject(project));\n    }\n\n    @Test\n    public void projectContributorCanNotReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> projectContributors = project.getRepository().getContributors();\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR),\n                                                              same(projectContributors));\n        assertFalse(projectController.canReadProject(project));\n    }\n\n    @Test\n    public void spaceOwnerCanReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> spaceContributors = project.getOrganizationalUnit().getContributors();\n        doReturn(true).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                             same(spaceContributors));\n        assertTrue(projectController.canReadProject(project));\n    }\n\n    @Test\n    public void spaceOwnerCanNotReadProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> projectContributors = project.getOrganizationalUnit().getContributors();\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                              same(projectContributors));\n        assertFalse(projectController.canReadProject(project));\n    }\n\n    @Test\n    public void userCanUpdateProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(true);\n        projectController.canUpdateProject(project).then(userCanUpdateProject -> {\n            assertTrue(userCanUpdateProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotUpdateProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canUpdateProject(project).then(userCanUpdateProject -> {\n            assertFalse(userCanUpdateProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanUpdateProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canUpdateProject(project).then(userCanUpdateProject -> {\n            assertTrue(userCanUpdateProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotUpdateProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canUpdateProject(project).then(userCanUpdateProject -> {\n            assertFalse(userCanUpdateProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanUpdateBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(true);\n        projectController.canUpdateBranch(project, project.getRepository().getBranch(\"branch2\").get()).then(userCanUpdateBranch -> {\n            assertTrue(userCanUpdateBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotUpdateBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch2\");\n        projectController.canUpdateBranch(project, project.getRepository().getBranch(\"branch2\").get()).then(userCanUpdateBranch -> {\n            assertFalse(userCanUpdateBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanUpdateBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch2\");\n        projectController.canUpdateBranch(project, project.getRepository().getBranch(\"branch2\").get()).then(userCanUpdateBranch -> {\n            assertTrue(userCanUpdateBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotUpdateBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch2\");\n        projectController.canUpdateBranch(project, project.getRepository().getBranch(\"branch2\").get()).then(userCanUpdateBranch -> {\n            assertFalse(userCanUpdateBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.DELETE,\n                                            user)).thenReturn(true);\n        assertTrue(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void userCanNotDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.DELETE,\n                                            user)).thenReturn(false);\n        assertFalse(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void projectContributorCanDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> projectContributors = project.getRepository().getContributors();\n        doReturn(true).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                             same(projectContributors));\n        assertTrue(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void projectContributorCanNotDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                              any());\n        assertFalse(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void spaceContributorCanDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        final Collection<Contributor> spaceContributors = project.getOrganizationalUnit().getContributors();\n        doReturn(true).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                             same(spaceContributors));\n        assertTrue(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void spaceContributorCanNotDeleteProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(false).when(projectController).userIsAtLeast(eq(ContributorType.OWNER),\n                                                              any());\n        assertFalse(projectController.canDeleteProject(project));\n    }\n\n    @Test\n    public void userCanBuildProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.BUILD,\n                                            user)).thenReturn(true);\n        projectController.canBuildProject(project).then(userCanBuildProject -> {\n            assertTrue(userCanBuildProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotBuildProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.BUILD,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canBuildProject(project).then(userCanBuildProject -> {\n            assertFalse(userCanBuildProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanBuildProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canBuildProject(project).then(userCanBuildProject -> {\n            assertTrue(userCanBuildProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotBuildProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, false, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canBuildProject(project).then(userCanBuildProject -> {\n            assertFalse(userCanBuildProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanDeployProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.BUILD,\n                                            user)).thenReturn(true);\n        projectController.canDeployProject(project).then(userCanDeployProject -> {\n            assertTrue(userCanDeployProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotDeployProjectTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.BUILD,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, false))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeployProject(project).then(userCanDeployProject -> {\n            assertFalse(userCanDeployProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanDeployProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeployProject(project).then(userCanDeployProject -> {\n            assertTrue(userCanDeployProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotDeployProjectTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, false))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeployProject(project).then(userCanDeployProject -> {\n            assertFalse(userCanDeployProject);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanReadBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.READ,\n                                            user)).thenReturn(true);\n        projectController.canReadBranch(project).then(userCanReadBranch -> {\n            assertTrue(userCanReadBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotReadBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.READ,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(false)).when(projectController).checkBranchPermission(eq(project),\n                                                                                        eq(\"branch\"),\n                                                                                        any());\n        projectController.canReadBranch(project).then(userCanReadBranch -> {\n            assertFalse(userCanReadBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanReadBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeleteBranch(project).then(userCanDeleteBranch -> {\n            assertTrue(userCanDeleteBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotReadBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", false, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canReadBranch(project).then(userCanReadBranch -> {\n            assertFalse(userCanReadBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanDeleteBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.DELETE,\n                                            user)).thenReturn(true);\n        projectController.canDeleteBranch(project).then(userCanDeleteBranch -> {\n            assertTrue(userCanDeleteBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotDeleteBranchTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.DELETE,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(false)).when(projectController).checkBranchPermission(eq(project),\n                                                                                        eq(\"branch\"),\n                                                                                        any());\n        projectController.canDeleteBranch(project).then(userCanDeleteBranch -> {\n            assertFalse(userCanDeleteBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanSubmitChangeRequestTest() {\n        final WorkspaceProject project = getProject();\n\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(true);\n\n        projectController.canSubmitChangeRequest(project).then(userCanSubmitChangeRequest -> {\n            assertTrue(userCanSubmitChangeRequest);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCannotSubmitChangeRequestTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(false);\n        doReturn(promises.resolve(false)).when(projectController).checkBranchPermission(eq(project),\n                                                                                        eq(\"branch\"),\n                                                                                        any());\n        projectController.canSubmitChangeRequest(project).then(userCanSubmitChangeRequest -> {\n            assertFalse(userCanSubmitChangeRequest);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCannotSubmitChangeRequestWhenInDefaultBranchTest() {\n        WorkspaceProject project = mock(WorkspaceProject.class);\n        Branch defaultBranch = mock(Branch.class);\n        doReturn(\"master\").when(defaultBranch).getName();\n        doReturn(defaultBranch).when(project).getBranch();\n\n        projectController.canSubmitChangeRequest(project).then(userCanSubmitChangeRequest -> {\n            assertFalse(userCanSubmitChangeRequest);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanDeleteBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, true, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeleteBranch(project).then(userCanDeleteBranch -> {\n            assertTrue(userCanDeleteBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanNotDeleteBranchTest() {\n        final WorkspaceProject project = getProject();\n        doReturn(promises.resolve(Optional.of(new RolePermissions(\"CONTRIBUTOR\", true, true, false, true))))\n                .when(projectController).getBranchPermissionsForUser(project, \"branch\");\n        projectController.canDeleteBranch(project).then(userCanDeleteBranch -> {\n            assertFalse(userCanDeleteBranch);\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanUpdateAllBranchesTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(true);\n        projectController.getUpdatableBranches(project).then(branches -> {\n            assertEquals(2, branches.size());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanReadAllBranchesTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.READ,\n                                            user)).thenReturn(true);\n        projectController.getReadableBranches(project).then(branches -> {\n            assertEquals(2, branches.size());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void getReadableBranchesWhenInvalidModuleTest() {\n        WorkspaceProject project = mock(WorkspaceProject.class);\n\n        projectController.getReadableBranches(project).then(branches -> {\n            assertEquals(0, branches.size());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void userCanNotUpdateAllBranchesTest() {\n        final WorkspaceProject project = getProject();\n        when(authorizationManager.authorize(project.getRepository(),\n                                            RepositoryAction.UPDATE,\n                                            user)).thenReturn(false);\n\n        final Map<String, RolePermissions> branch1PermissionsByRole = new HashMap<>();\n        branch1PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, true, true));\n\n        final Map<String, RolePermissions> branch2PermissionsByRole = new HashMap<>();\n        branch2PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, true, true));\n\n        final Map<String, BranchPermissions> branchPermissions = new HashMap<>();\n        branchPermissions.put(\"branch\", new BranchPermissions(\"branch\", branch1PermissionsByRole));\n        branchPermissions.put(\"branch2\", new BranchPermissions(\"branch2\", branch2PermissionsByRole));\n\n        doReturn(Optional.of(new Contributor(\"contributor\", ContributorType.CONTRIBUTOR))).when(projectController).getUserContributor(any());\n        doReturn(branchPermissions).when(projectPermissionsService).loadBranchPermissions(any(), any(), anyList());\n\n        projectController.getUpdatableBranches(project).then(branches -> {\n            assertEquals(0, branches.size());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanUpdateSomeBranchesTest() {\n        final WorkspaceProject project = getProject();\n\n        final Map<String, RolePermissions> branch1PermissionsByRole = new HashMap<>();\n        branch1PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, true, true));\n\n        final Map<String, RolePermissions> branch2PermissionsByRole = new HashMap<>();\n        branch2PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, true, true, true));\n\n        final Map<String, BranchPermissions> branchPermissions = new HashMap<>();\n        branchPermissions.put(\"branch\", new BranchPermissions(\"branch\", branch1PermissionsByRole));\n        branchPermissions.put(\"branch2\", new BranchPermissions(\"branch2\", branch2PermissionsByRole));\n\n        doReturn(Optional.of(new Contributor(\"contributor\", ContributorType.CONTRIBUTOR))).when(projectController).getUserContributor(any());\n        doReturn(branchPermissions).when(projectPermissionsService).loadBranchPermissions(any(), any(), anyList());\n\n        projectController.getUpdatableBranches(project).then(branches -> {\n            assertEquals(1, branches.size());\n            assertEquals(\"branch2\", branches.get(0).getName());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanReadAllBranchesTest() {\n        final WorkspaceProject project = getProject();\n\n        final Map<String, RolePermissions> branch1PermissionsByRole = new HashMap<>();\n        branch1PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, false, false));\n\n        final Map<String, RolePermissions> branch2PermissionsByRole = new HashMap<>();\n        branch2PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, false, false));\n\n        final Map<String, BranchPermissions> branchPermissions = new HashMap<>();\n        branchPermissions.put(\"branch\", new BranchPermissions(\"branch\", branch1PermissionsByRole));\n        branchPermissions.put(\"branch2\", new BranchPermissions(\"branch2\", branch2PermissionsByRole));\n\n        doReturn(Optional.of(new Contributor(\"contributor\", ContributorType.CONTRIBUTOR))).when(projectController).getUserContributor(any());\n        doReturn(branchPermissions).when(projectPermissionsService).loadBranchPermissions(any(), any(), anyList());\n\n        projectController.getReadableBranches(project).then(branches -> {\n            assertEquals(2, branches.size());\n            assertEquals(\"branch\", branches.get(0).getName());\n            assertEquals(\"branch2\", branches.get(1).getName());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCanReadSomeBranchesTest() {\n        final WorkspaceProject project = getProject();\n\n        final Map<String, RolePermissions> branch1PermissionsByRole = new HashMap<>();\n        branch1PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", false, false, false, false));\n\n        final Map<String, RolePermissions> branch2PermissionsByRole = new HashMap<>();\n        branch2PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", true, false, false, false));\n\n        final Map<String, BranchPermissions> branchPermissions = new HashMap<>();\n        branchPermissions.put(\"branch\", new BranchPermissions(\"branch\", branch1PermissionsByRole));\n        branchPermissions.put(\"branch2\", new BranchPermissions(\"branch2\", branch2PermissionsByRole));\n\n        doReturn(Optional.of(new Contributor(\"contributor\", ContributorType.CONTRIBUTOR))).when(projectController).getUserContributor(any());\n        doReturn(branchPermissions).when(projectPermissionsService).loadBranchPermissions(any(), any(), anyList());\n\n        projectController.getReadableBranches(project).then(branches -> {\n            assertEquals(1, branches.size());\n            assertEquals(\"branch2\", branches.get(0).getName());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void projectContributorCannotReadBranchesTest() {\n        final WorkspaceProject project = getProject();\n\n        final Map<String, RolePermissions> branch1PermissionsByRole = new HashMap<>();\n        branch1PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", false, false, false, false));\n\n        final Map<String, RolePermissions> branch2PermissionsByRole = new HashMap<>();\n        branch2PermissionsByRole.put(\"CONTRIBUTOR\", new RolePermissions(\"CONTRIBUTOR\", false, false, false, false));\n\n        final Map<String, BranchPermissions> branchPermissions = new HashMap<>();\n        branchPermissions.put(\"branch\", new BranchPermissions(\"branch\", branch1PermissionsByRole));\n        branchPermissions.put(\"branch2\", new BranchPermissions(\"branch2\", branch2PermissionsByRole));\n\n        doReturn(Optional.of(new Contributor(\"contributor\", ContributorType.CONTRIBUTOR))).when(projectController).getUserContributor(any());\n        doReturn(branchPermissions).when(projectPermissionsService).loadBranchPermissions(any(), any(), anyList());\n\n        projectController.getReadableBranches(project).then(branches -> {\n            assertEquals(0, branches.size());\n            return promises.resolve();\n        }).catch_(error -> {\n            fail();\n            return promises.resolve();\n        });\n    }\n\n    private WorkspaceProject getProject() {\n        final Repository repository = mock(Repository.class);\n        final List<Contributor> projectContributors = new ArrayList<>();\n        doReturn(projectContributors).when(repository).getContributors();\n\n        final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);\n        final List<Contributor> organizationalUnitContributors = new ArrayList<>();\n        doReturn(organizationalUnitContributors).when(organizationalUnit).getContributors();\n\n        final Space space = mock(Space.class);\n\n        final Branch branch = mock(Branch.class);\n        doReturn(\"branch\").when(branch).getName();\n        final Branch branch2 = mock(Branch.class);\n        doReturn(\"branch2\").when(branch2).getName();\n\n        final WorkspaceProject project = mock(WorkspaceProject.class);\n        doReturn(repository).when(project).getRepository();\n        doReturn(organizationalUnit).when(project).getOrganizationalUnit();\n        doReturn(space).when(project).getSpace();\n        doReturn(branch).when(project).getBranch();\n        doReturn(Optional.of(branch2)).when(repository).getBranch(\"branch2\");\n        doReturn(Arrays.asList(branch, branch2)).when(repository).getBranches();\n        doReturn(mock(Module.class)).when(project).getMainModule();\n\n        return project;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/.gitignore",
    "content": "# Build directories\ntarget/\nlocal/\nbin/\n\n# Dotfiles\n/.*\n/**/.*\n!.gitignore\n\n# Ignore Netbeans, IntelliJ and Eclipse setup/project files\nnbproject/\n*.ipr\n*.iws\n*.iml\n.project\n.settings/\n.classpath\n"
  },
  {
    "path": "uberfire-rest/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-rest</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Rest</name>\n\n  <modules>\n    <module>uberfire-rest-client</module>\n    <module>uberfire-rest-backend</module>\n  </modules>\n  \n</project>\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-rest</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-rest-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - REST Backend</name>\n  <description>UberFire - REST Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-rest-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-builder</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-text</artifactId>\n    </dependency>\n\n    <!-- REST dependencies -->\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.resteasy</groupId>\n      <artifactId>resteasy-cdi</artifactId>\n    </dependency>\n\n    <!-- TEST: reflection -->\n    <dependency>\n      <groupId>org.reflections</groupId>\n      <artifactId>reflections</artifactId>\n      <scope>test</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>com.google.code.findbugs</groupId>\n          <artifactId>annotations</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-test-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.revapi</groupId>\n        <artifactId>revapi-maven-plugin</artifactId>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/build/revapi-config.json",
    "content": "{\n  \"filters\": {\n    \"revapi\": {\n      \"java\": {\n        \"filter\": {\n          \"classes\": {\n            \"comment\": \"Just ProjectResource is checked\",\n            \"regex\": false,\n            \"include\": [\n              \"org.guvnor.rest.backend.ProjectResource\"\n            ]\n          }\n        }\n      }\n    }\n  },\n\n  \"ignores\": {\n    \"revapi\": {\n      \"_comment\": \"Changes between 7.67.0.Final and the current branch. These changes are desired and thus ignored.\",\n      \"ignore\": []\n    }\n  }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/JobRequestHelper.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.rest.backend;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.concurrent.CompletionStage;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.util.TypeLiteral;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.project.builder.model.BuildMessage;\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.BaseArchetypeService;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.GAVAlreadyExistsException;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.common.services.shared.test.TestResultMessage;\nimport org.guvnor.common.services.shared.test.TestRunnerService;\nimport org.guvnor.rest.client.CloneProjectRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\n/**\n * Utility class to perform various functions for the REST service involving backend services\n */\n@ApplicationScoped\npublic class JobRequestHelper {\n\n    private static final Logger logger = LoggerFactory.getLogger(JobRequestHelper.class);\n\n    @Inject\n    private RepositoryService repositoryService;\n\n    @Inject\n    private WorkspaceProjectService workspaceProjectService;\n\n    @Inject\n    private BuildService buildService;\n\n    @Inject\n    private SpacesAPI spacesAPI;\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioSystemService;\n\n    @Inject\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Inject\n    private TestRunnerService testService;\n\n    @Inject\n    @Customizable\n    private BaseArchetypeService archetypeService;\n\n    public JobResult cloneProject(final String jobId,\n                                  final String spaceName,\n                                  final CloneProjectRequest cloneProjectRequest) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final String scheme = \"git\";\n\n        OrganizationalUnit orgUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n        if (orgUnit == null) {\n            // double check, this is also checked at input\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space '\" + spaceName + \"' does not exist!\");\n            return result;\n        }\n\n        if (cloneProjectRequest.getName() == null || \"\".equals(cloneProjectRequest.getName()) || cloneProjectRequest.getGitURL() == null\n                || \"\".equals(cloneProjectRequest.getGitURL())) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Repository name and GitURL must be provided\");\n        }\n\n        // username and password are optional\n        final RepositoryEnvironmentConfigurations configuration = new RepositoryEnvironmentConfigurations();\n        if (cloneProjectRequest.getUserName() != null && !\"\".equals(cloneProjectRequest.getUserName())) {\n            configuration.setUserName(cloneProjectRequest.getUserName());\n        }\n        if (cloneProjectRequest.getPassword() != null && !\"\".equals(cloneProjectRequest.getPassword())) {\n            configuration.setPassword(cloneProjectRequest.getPassword());\n        }\n\n        configuration.setInit(false);\n        configuration.setMirror(false);\n        configuration.setOrigin(cloneProjectRequest.getGitURL());\n\n        org.guvnor.structure.repositories.Repository newlyCreatedRepo = repositoryService.createRepository(\n                orgUnit,\n                scheme,\n                cloneProjectRequest.getName(),\n                configuration);\n        if (newlyCreatedRepo != null) {\n            result.setStatus(JobStatus.SUCCESS);\n            result.setResult(\"Alias: \" + newlyCreatedRepo.getAlias() + \", Scheme: \" + newlyCreatedRepo.getScheme() + \", Uri: \" + newlyCreatedRepo.getUri());\n        } else {\n            result.setStatus(JobStatus.FAIL);\n        }\n\n        return result;\n    }\n\n    public JobResult createProject(final String jobId,\n                                   final String spaceName,\n                                   final String projectName,\n                                   String projectGroupId,\n                                   String projectVersion,\n                                   String projectDescription) {\n        return createProject(jobId,\n                             spaceName,\n                             projectName,\n                             projectGroupId,\n                             projectVersion,\n                             projectDescription,\n                             null);\n    }\n\n    public JobResult createProject(final String jobId,\n                                   final String spaceName,\n                                   final String projectName,\n                                   String projectGroupId,\n                                   String projectVersion,\n                                   String projectDescription,\n                                   String templateId) {\n\n        final JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n        if (organizationalUnit == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Space [\" + spaceName + \"] does not exist\");\n        } else {\n\n            if (projectGroupId == null || projectGroupId.trim().isEmpty()) {\n                projectGroupId = projectName;\n            }\n            if (projectVersion == null || projectVersion.trim().isEmpty()) {\n                projectVersion = \"1.0\";\n            }\n\n            final POM pom = new POM();\n            pom.getGav().setArtifactId(projectName);\n            pom.getGav().setGroupId(projectGroupId);\n            pom.getGav().setVersion(projectVersion);\n            pom.setDescription(projectDescription);\n            pom.setName(projectName);\n\n            WorkspaceProject project = null;\n            try {\n                if (templateId == null) {\n                    project = workspaceProjectService.newProject(organizationalUnit,\n                                                       pom);\n                } else {\n                    project = workspaceProjectService.newProject(organizationalUnit,\n                                                       pom,\n                                                       DeploymentMode.VALIDATED,\n                                                       null,\n                                                       getTemplateRepository(templateId,\n                                                                                 organizationalUnit.getName()));\n                }\n            } catch (GAVAlreadyExistsException gae) {\n                result.setStatus(JobStatus.DUPLICATE_RESOURCE);\n                result.setResult(\"Project's GAV [\" + gae.getGAV().toString() + \"] already exists at [\" + toString(gae.getRepositories()) + \"]\");\n                return result;\n            } catch (org.uberfire.java.nio.file.FileAlreadyExistsException e) {\n                result.setStatus(JobStatus.DUPLICATE_RESOURCE);\n                result.setResult(\"Project [\" + projectName + \"] already exists\");\n                return result;\n            } catch (IllegalArgumentException iae) {\n                result.setStatus(JobStatus.FAIL);\n                result.setResult(iae.getMessage());\n                return result;\n            }\n\n            if (project == null) {\n                result.setStatus(JobStatus.FAIL);\n                return result;\n            }\n\n            result.setStatus(JobStatus.SUCCESS);\n            result.setResult(\"Project [\" + project.getName() + \"] is created\");\n        }\n        return result;\n    }\n\n    private Repository getTemplateRepository(final String templateId,\n                                                 final String spaceName) {\n        return archetypeService.getTemplateRepository(templateId, spaceName);\n    }\n\n    private String toString(final Set<MavenRepositoryMetadata> repositories) {\n        final StringBuilder sb = new StringBuilder();\n        for (MavenRepositoryMetadata md : repositories) {\n            sb.append(md.getId()).append(\" : \").append(md.getUrl()).append(\" : \").append(md.getSource()).append(\", \");\n        }\n        sb.delete(sb.length() - 2,\n                  sb.length() - 1);\n        return sb.toString();\n    }\n\n    public JobResult deleteProject(final String jobId,\n                                   final String spaceName,\n                                   final String projectName) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        Space space = spacesAPI.getSpace(spaceName);\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(space, projectName);\n\n        if (workspaceProject == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Project [\" + projectName + \"] does not exist\");\n            return result;\n        } else {\n            try {\n                repositoryService.removeRepository(space, workspaceProject.getRepository().getAlias());\n            } catch (Exception e) {\n                result.setStatus(JobStatus.FAIL);\n                result.setResult(\"Project [\" + projectName + \"] could not be deleted: \" + e.getMessage());\n                logger.error(\"Unable to delete project '\" + projectName + \"': \" + e.getMessage(),\n                             e);\n                return result;\n            }\n\n            result.setStatus(JobStatus.SUCCESS);\n            return result;\n        }\n    }\n\n    public JobResult compileProject(final String jobId,\n                                    final String spaceName,\n                                    final String projectName,\n                                    final String branchName) {\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName,\n                branchName);\n\n        if (workspaceProject == null) {\n            return projectDoesNotExistError(jobId, projectName);\n        }\n\n        Module module = workspaceProject.getMainModule();\n\n        if (module == null) {\n            if (branchName == null) {\n                return projectHasNoMainModuleError(jobId, projectName);\n            }\n            return projectHasNoModuleError(jobId, projectName, branchName);\n        }\n\n        BuildResults buildResults = buildService.build(module);\n\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n        result.setDetailedResult(buildResultsToDetailedStringMessages(buildResults.getMessages()));\n        result.setStatus(buildResults.getErrorMessages().isEmpty() ? JobStatus.SUCCESS : JobStatus.FAIL);\n        return result;\n    }\n\n    private List<String> buildResultsToDetailedStringMessages(List<BuildMessage> messages) {\n        List<String> result = new ArrayList<>();\n        for (BuildMessage message : messages) {\n            String detailedStringMessage = \"level:\" + message.getLevel() +\n                    \", path:\" + message.getPath() +\n                    \", text:\" + message.getText();\n            result.add(detailedStringMessage);\n        }\n        return result;\n    }\n\n    public JobResult installProject(final String jobId,\n                                    final String spaceName,\n                                    final String projectName,\n                                    final String branchName) {\n\n        PortablePreconditions.checkNotNull(\"jobId\", jobId);\n        PortablePreconditions.checkNotNull(\"spaceName\", spaceName);\n        PortablePreconditions.checkNotNull(\"projectName\", projectName);\n\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n\n        if (organizationalUnit == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Space [\" + spaceName + \"] does not exist\");\n            return result;\n        }\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName,\n                branchName);\n\n        if (workspaceProject == null) {\n            return projectDoesNotExistError(jobId, projectName);\n        }\n\n        final Module module = workspaceProject.getMainModule();\n\n        if (module == null) {\n            if (branchName == null) {\n                return projectHasNoMainModuleError(jobId, projectName);\n            }\n            return projectHasNoModuleError(jobId, projectName, branchName);\n        }\n\n        try {\n            BuildResults buildResults = buildService.buildAndDeploy(module);\n            result.setDetailedResult(buildResults == null ? null : deployResultToDetailedStringMessages(buildResults));\n            result.setStatus(buildResults != null && buildResults.getErrorMessages().isEmpty() ? JobStatus.SUCCESS : JobStatus.FAIL);\n        } catch (Throwable t) {\n            Optional<GAVAlreadyExistsException> gaeOpt = findCause(t, GAVAlreadyExistsException.class);\n\n            if (gaeOpt.isPresent()) {\n                GAVAlreadyExistsException gae = gaeOpt.get();\n                result.setStatus(JobStatus.DUPLICATE_RESOURCE);\n                result.setResult(\"Project's GAV [\" + gae.getGAV() + \"] already exists at [\" + toString(gae.getRepositories()) + \"]\");\n            } else {\n                List<String> errorResult = new ArrayList<>();\n                errorResult.add(t.getMessage());\n                result.setDetailedResult(errorResult);\n                result.setStatus(JobStatus.FAIL);\n            }\n        }\n\n        return result;\n    }\n\n    private List<String> deployResultToDetailedStringMessages(final BuildResults deployResult) {\n        GAV gav = deployResult.getGAV();\n        List<String> result = buildResultsToDetailedStringMessages(deployResult.getErrorMessages());\n        String detailedStringMessage = \"artifactID:\" + gav.getArtifactId() +\n                \", groupId:\" + gav.getGroupId() +\n                \", version:\" + gav.getVersion();\n        result.add(detailedStringMessage);\n        return result;\n    }\n\n    public JobResult testProject(final String jobId,\n                                 final String spaceName,\n                                 final String projectName,\n                                 final String branchName) {\n\n        final JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName,\n                branchName);\n\n        if (workspaceProject == null) {\n            return projectDoesNotExistError(jobId, projectName);\n        }\n\n        final Module module = workspaceProject.getMainModule();\n\n        if (module == null) {\n            if (branchName == null) {\n                return projectHasNoMainModuleError(jobId, projectName);\n            }\n            return projectHasNoModuleError(jobId, projectName, branchName);\n        }\n\n        testService.runAllTests(\"JobRequestHelper\",\n                                module.getPomXMLPath(),\n                                getCustomTestResultEvent(result));\n\n        return result;\n    }\n\n    private Event<TestResultMessage> getCustomTestResultEvent(final JobResult result) {\n        return new Event<TestResultMessage>() {\n            @Override\n            public void fire(TestResultMessage event) {\n                result.setDetailedResult(event.getResultStrings());\n                result.setStatus(event.wasSuccessful() ? JobStatus.SUCCESS : JobStatus.FAIL);\n            }\n\n            @Override\n            public Event<TestResultMessage> select(Annotation... qualifiers) {\n                // not used\n                return null;\n            }\n\n            @Override\n            public <U extends TestResultMessage> Event<U> select(Class<U> subtype,\n                                                                 Annotation... qualifiers) {\n                // not used\n                return null;\n            }\n\n            @Override\n            public <U extends TestResultMessage> CompletionStage<U> fireAsync(U event) {\n                return null;\n            }\n\n            @Override\n            public <U extends TestResultMessage> CompletionStage<U> fireAsync(U event, NotificationOptions options) {\n                return null;\n            }\n\n            @Override\n            public <U extends TestResultMessage> Event<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {\n                return null;\n            }\n        };\n    }\n\n    public JobResult deployProject(final String jobId,\n                                   final String spaceName,\n                                   final String projectName,\n                                   final String branchName) {\n\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName,\n                branchName);\n\n        if (workspaceProject == null) {\n            return projectDoesNotExistError(jobId, projectName);\n        }\n\n        Module module = workspaceProject.getMainModule();\n\n        if (module == null) {\n            if (branchName == null) {\n                return projectHasNoMainModuleError(jobId, projectName);\n            }\n            return projectHasNoModuleError(jobId, projectName, branchName);\n        }\n\n        try {\n            BuildResults buildResults = buildService.buildAndDeploy(module);\n            result.setDetailedResult(buildResults == null ? null : deployResultToDetailedStringMessages(buildResults));\n            result.setStatus(buildResults != null && buildResults.getErrorMessages().isEmpty() ? JobStatus.SUCCESS : JobStatus.FAIL);\n        } catch (RuntimeException ex) {\n            GAVAlreadyExistsException gae = findCause(ex, GAVAlreadyExistsException.class).orElseThrow(() -> ex);\n            result.setStatus(JobStatus.DUPLICATE_RESOURCE);\n            result.setResult(\"Project's GAV [\" + gae.getGAV() + \"] already exists at [\" + toString(gae.getRepositories()) + \"]\");\n            return result;\n        }\n\n        return result;\n    }\n\n    public JobResult removeSpace(final String jobId,\n                                 final String spaceName) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        if (spaceName == null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space name must be provided\");\n            return result;\n        }\n\n        try {\n            organizationalUnitService.removeOrganizationalUnit(spaceName);\n            result.setStatus(JobStatus.SUCCESS);\n        } catch (Exception e) {\n            result.setStatus(JobStatus.FAIL);\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to remove '\" + spaceName + \"': \" + e.getMessage();\n            result.setResult(errMsg);\n            logger.error(errMsg,\n                         e);\n        }\n\n        return result;\n    }\n\n    public JobResult createSpace(final String jobId,\n                                 final String spaceName,\n                                 final String spaceDescription,\n                                 final String spaceOwner,\n                                 final String defaultGroupId) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        if (spaceName == null || spaceOwner == null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space name and owner must be provided\");\n            return result;\n        }\n\n        String _defaultGroupId = null;\n        if (defaultGroupId == null || defaultGroupId.trim().isEmpty()) {\n            _defaultGroupId = organizationalUnitService.getSanitizedDefaultGroupId(spaceName);\n            logger.warn(\"No default group id was provided, reverting to the space unit name\");\n        } else {\n            if (!organizationalUnitService.isValidGroupId(defaultGroupId)) {\n                result.setStatus(JobStatus.BAD_REQUEST);\n                result.setResult(\"Invalid default group id, only alphanumerical characters are admitted, \" +\n                                         \"as well as '\\\"_\\\"', '\\\"-\\\"' or '\\\".\\\"'.\");\n                return result;\n            } else {\n                _defaultGroupId = defaultGroupId;\n            }\n        }\n\n        OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n        if (organizationalUnit != null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space with name \" + spaceName + \" already exists\");\n            return result;\n        }\n\n        organizationalUnit = organizationalUnitService.createOrganizationalUnit(spaceName,\n                                                                                _defaultGroupId,\n                                                                                Collections.emptyList(),\n                                                                                Collections.singletonList(new Contributor(spaceOwner, ContributorType.OWNER)),\n                                                                                spaceDescription);\n\n        if (organizationalUnit != null) {\n            result.setResult(\"Space \" + organizationalUnit.getName() + \" is created successfully.\");\n            result.setStatus(JobStatus.SUCCESS);\n        } else {\n            result.setStatus(JobStatus.FAIL);\n        }\n        return result;\n    }\n\n    public JobResult updateSpace(final String jobId,\n                                 final String spaceName,\n                                 final String spaceDescription,\n                                 final String spaceOwner,\n                                 final String defaultGroupId) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        if (spaceName == null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space name must be provided\");\n            return result;\n        }\n\n        OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n        if (organizationalUnit == null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space with name \" + spaceName + \" doesn't exists\");\n            return result;\n        }\n\n        String groupId = null;\n        if (defaultGroupId == null || defaultGroupId.trim().isEmpty()) {\n            groupId = organizationalUnit.getDefaultGroupId();\n        } else {\n            if (!organizationalUnitService.isValidGroupId(defaultGroupId)) {\n                result.setStatus(JobStatus.BAD_REQUEST);\n                result.setResult(\"Invalid default group id, only alphanumerical characters are admitted, \" +\n                                         \"as well as '\\\"_\\\"', '\\\"-\\\"' or '\\\".\\\"'.\");\n                return result;\n            } else {\n                groupId = defaultGroupId;\n            }\n        }\n\n        Collection<Contributor> contributors;\n\n        if (spaceOwner == null) {\n            contributors = organizationalUnit.getContributors();\n        } else {\n            contributors = Collections.singletonList(new Contributor(spaceOwner, ContributorType.OWNER));\n        }\n\n        organizationalUnit = organizationalUnitService.updateOrganizationalUnit(spaceName, groupId, contributors, spaceDescription);\n\n        if (organizationalUnit != null) {\n            result.setResult(\"Space \" + organizationalUnit.getName() + \" is updated successfully.\");\n            result.setStatus(JobStatus.SUCCESS);\n        } else {\n            result.setStatus(JobStatus.FAIL);\n        }\n        return result;\n    }\n\n    public JobResult addBranch(final String jobId,\n                               final String spaceName,\n                               final String projectName,\n                               final String newBranchName,\n                               final String baseBranchName,\n                               final String userIdentifier) {\n\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final WorkspaceProject project = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName);\n\n        if (project == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Project [\" + projectName + \"] does not exist\");\n            return result;\n        }\n\n        try {\n            workspaceProjectService.addBranch(newBranchName,\n                                              baseBranchName,\n                                              project,\n                                              userIdentifier);\n            result.setStatus(JobStatus.SUCCESS);\n        } catch (FileAlreadyExistsException e) {\n            result.setStatus(JobStatus.DUPLICATE_RESOURCE);\n            result.setResult(\"Branch [\" + newBranchName + \"] already exists.\");\n        } catch (Exception e) {\n            result.setStatus(JobStatus.FAIL);\n            result.setResult(e.getMessage());\n        }\n\n        return result;\n    }\n\n    public JobResult removeBranch(final String jobId,\n                                  final String spaceName,\n                                  final String projectName,\n                                  final String branchName,\n                                  final String userIdentifier) {\n\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        final WorkspaceProject project = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName);\n\n        if (project == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Project [\" + projectName + \"] does not exist\");\n            return result;\n        }\n\n        try {\n            workspaceProjectService.removeBranch(branchName,\n                                                 project,\n                                                 userIdentifier);\n            result.setStatus(JobStatus.SUCCESS);\n        } catch (Exception e) {\n            result.setStatus(JobStatus.FAIL);\n            result.setResult(e.getMessage());\n        }\n\n        return result;\n    }\n\n    public JobResult addProjectToSpace(final String jobId,\n                                       final String spaceName,\n                                       final String projectName) {\n        JobResult result = new JobResult();\n        result.setJobId(jobId);\n\n        if (spaceName == null || projectName == null) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space name and Project name must be provided\");\n            return result;\n        }\n\n        org.uberfire.java.nio.file.Path projectRootPath = getProjectRootPath(spacesAPI.getSpace(spaceName), projectName);\n        if (projectRootPath == null) {\n            result.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n            result.setResult(\"Project [\" + projectName + \"] does not exist\");\n            return result;\n        }\n\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(spaceName,\n                                                                           null);\n\n        GitRepository repo = new GitRepository(projectName,\n                                               spacesAPI.getSpace(organizationalUnit.getName()));\n        try {\n            organizationalUnitService.addRepository(organizationalUnit,\n                                                    repo);\n        } catch (IllegalArgumentException e) {\n            result.setStatus(JobStatus.BAD_REQUEST);\n            result.setResult(\"Space \" + organizationalUnit.getName() + \" not found\");\n            return result;\n        }\n\n        result.setStatus(JobStatus.SUCCESS);\n        return result;\n    }\n\n    private org.uberfire.java.nio.file.Path getProjectRootPath(final Space space, final String projectName) {\n\n        final org.guvnor.structure.repositories.Repository repository = repositoryService.getRepositoryFromSpace(space, projectName);\n        if (repository == null || !repository.getDefaultBranch().isPresent()) {\n            return null;\n        } else {\n            return Paths.convert(repository.getDefaultBranch().get().getPath());\n        }\n    }\n\n    private <T> Optional<T> findCause(Throwable t,\n                                      Class<T> causeClass) {\n        if (t == null) {\n            return Optional.empty();\n        } else if (t.getClass().equals(causeClass)) {\n            return Optional.of((T) t);\n        } else {\n            return findCause(t.getCause(),\n                             causeClass);\n        }\n    }\n\n    private JobResult projectDoesNotExistError(final String jobId,\n                                               final String projectName) {\n        JobResult jobResult = new JobResult();\n        jobResult.setJobId(jobId);\n        jobResult.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n        jobResult.setResult(\"Project [\" + projectName + \"] does not exist.\");\n        return jobResult;\n    }\n\n    private JobResult projectHasNoMainModuleError(final String jobId,\n                                                  final String projectName) {\n        JobResult jobResult = new JobResult();\n        jobResult.setJobId(jobId);\n        jobResult.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n        jobResult.setResult(\"Project [\" + projectName + \"] has no main module.\");\n        return jobResult;\n    }\n\n    private JobResult projectHasNoModuleError(final String jobId,\n                                              final String projectName,\n                                              final String branchName) {\n        JobResult jobResult = new JobResult();\n        jobResult.setJobId(jobId);\n        jobResult.setStatus(JobStatus.RESOURCE_NOT_EXIST);\n        jobResult.setResult(\"Project [\" + projectName + \"] has no module [\" + branchName + \"].\");\n        return jobResult;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/JobRequestScheduler.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.rest.backend;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.concurrent.ExecutorService;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.rest.backend.cmd.AddBranchCmd;\nimport org.guvnor.rest.backend.cmd.AbstractJobCommand;\nimport org.guvnor.rest.backend.cmd.AddProjectToSpaceCmd;\nimport org.guvnor.rest.backend.cmd.CloneRepositoryCmd;\nimport org.guvnor.rest.backend.cmd.CompileProjectCmd;\nimport org.guvnor.rest.backend.cmd.CreateProjectCmd;\nimport org.guvnor.rest.backend.cmd.CreateSpaceCmd;\nimport org.guvnor.rest.backend.cmd.DeleteProjectCmd;\nimport org.guvnor.rest.backend.cmd.DeployProjectCmd;\nimport org.guvnor.rest.backend.cmd.InstallProjectCmd;\nimport org.guvnor.rest.backend.cmd.RemoveSpaceCmd;\nimport org.guvnor.rest.backend.cmd.RemoveBranchCmd;\nimport org.guvnor.rest.backend.cmd.TestProjectCmd;\nimport org.guvnor.rest.backend.cmd.UpdateSpaceCmd;\nimport org.guvnor.rest.client.AddBranchJobRequest;\nimport org.guvnor.rest.client.AddProjectToSpaceRequest;\nimport org.guvnor.rest.client.CloneProjectJobRequest;\nimport org.guvnor.rest.client.CompileProjectRequest;\nimport org.guvnor.rest.client.CreateProjectJobRequest;\nimport org.guvnor.rest.client.DeleteProjectRequest;\nimport org.guvnor.rest.client.DeployProjectRequest;\nimport org.guvnor.rest.client.InstallProjectRequest;\nimport org.guvnor.rest.client.RemoveBranchJobRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.RemoveSpaceRequest;\nimport org.guvnor.rest.client.SpaceRequest;\nimport org.guvnor.rest.client.TestProjectRequest;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.concurrent.RestApi;\nimport org.uberfire.commons.concurrent.Unmanaged;\n\nimport static org.guvnor.rest.backend.cmd.AbstractJobCommand.JOB_REQUEST_KEY;\n\n/**\n * Utility class observing requests for various functions of the REST service\n */\n@ApplicationScoped\npublic class JobRequestScheduler {\n\n    private static final Logger logger = LoggerFactory.getLogger(JobRequestScheduler.class);\n    private static final String ACCEPT_LANGUAGE = \"acceptLanguage\";\n\n    private ExecutorService executorService;\n\n    private JobResultManager jobResultManager;\n\n    private JobRequestHelper jobRequestHelper;\n\n    public JobRequestScheduler() {\n\n    }\n\n    /*\n    https://issues.jboss.org/browse/AF-1587\n    Workbench Rest API - deleting space sometimes randomly takes more than 60 seconds\n\n    There's a significative improvement on timeouts by using an @Unmanaged ExecutorService.\n    The @Unmanaged tends to be more available and likely that it won't share the Async execution\n    of the operations itself.\n    */\n    @Inject\n    public JobRequestScheduler(@RestApi ExecutorService executorService,\n                               JobResultManager jobResultManager,\n                               JobRequestHelper jobRequestHelper) {\n        this.executorService = executorService;\n        this.jobResultManager = jobResultManager;\n        this.jobRequestHelper = jobRequestHelper;\n    }\n\n    public void cloneProjectRequest(final CloneProjectJobRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Space\",\n                   jobRequest.getCloneProjectRequest().getName());\n        params.put(\"Operation\",\n                   \"cloneProject\");\n\n        scheduleJob(jobRequest,\n                    new CloneRepositoryCmd(jobRequestHelper,\n                                           jobResultManager,\n                                           params));\n    }\n\n    public void createProjectRequest(final CreateProjectJobRequest jobRequest,\n                                     final Map<String, Object> headers) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Space\",\n                   jobRequest.getSpaceName());\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"TemplateId\",\n                   jobRequest.getTemplateId());\n        params.put(\"Operation\",\n                   \"createProject\");\n        params.put(ACCEPT_LANGUAGE,\n                   headers.get(ACCEPT_LANGUAGE));\n\n        scheduleJob(jobRequest,\n                    new CreateProjectCmd(jobRequestHelper,\n                                         jobResultManager,\n                                         params));\n    }\n\n    public void deleteProjectRequest(final DeleteProjectRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Operation\",\n                   \"deleteProject\");\n\n        scheduleJob(jobRequest,\n                    new DeleteProjectCmd(jobRequestHelper,\n                                         jobResultManager,\n                                         params));\n    }\n\n    public void compileProjectRequest(final CompileProjectRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Branch\",\n                   jobRequest.getBranchName());\n        params.put(\"Operation\",\n                   \"compileProject\");\n\n        scheduleJob(jobRequest,\n                    new CompileProjectCmd(jobRequestHelper,\n                                          jobResultManager,\n                                          params));\n    }\n\n    public void installProjectRequest(final InstallProjectRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Branch\",\n                   jobRequest.getBranchName());\n        params.put(\"Operation\",\n                   \"installProject\");\n\n        scheduleJob(jobRequest,\n                    new InstallProjectCmd(jobRequestHelper,\n                                          jobResultManager,\n                                          params));\n    }\n\n    public void testProjectRequest(final TestProjectRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Branch\",\n                   jobRequest.getBranchName());\n        params.put(\"Operation\",\n                   \"testProject\");\n\n        scheduleJob(jobRequest,\n                    new TestProjectCmd(jobRequestHelper,\n                                       jobResultManager,\n                                       params));\n    }\n\n    public void deployProjectRequest(final DeployProjectRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Branch\",\n                   jobRequest.getBranchName());\n        params.put(\"Operation\",\n                   \"deployProject\");\n\n        scheduleJob(jobRequest,\n                    new DeployProjectCmd(jobRequestHelper,\n                                         jobResultManager,\n                                         params));\n    }\n\n    public void createSpaceRequest(final SpaceRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Operation\",\n                   \"createOrgUnit\");\n\n        scheduleJob(jobRequest,\n                    new CreateSpaceCmd(jobRequestHelper,\n                                       jobResultManager,\n                                       params));\n    }\n\n    public void updateSpaceRequest(final SpaceRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Operation\",\n                   \"updateOrgUnit\");\n\n        scheduleJob(jobRequest,\n                    new UpdateSpaceCmd(jobRequestHelper,\n                                       jobResultManager,\n                                       params));\n    }\n\n    public void addProjectToSpace(final AddProjectToSpaceRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"Operation\",\n                   \"addRepositoryToOrgUnit\");\n\n        scheduleJob(jobRequest,\n                    new AddProjectToSpaceCmd(jobRequestHelper,\n                                             jobResultManager,\n                                             params));\n    }\n\n    public void addBranchRequest(final AddBranchJobRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Space\",\n                   jobRequest.getSpaceName());\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"NewBranchName\",\n                   jobRequest.getNewBranchName());\n        params.put(\"BaseBranchName\",\n                   jobRequest.getBaseBranchName());\n        params.put(\"Operation\",\n                   \"addBranch\");\n\n        scheduleJob(jobRequest,\n                    new AddBranchCmd(jobRequestHelper,\n                                     jobResultManager,\n                                     params));\n    }\n\n    public void removeBranchRequest(final RemoveBranchJobRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Space\",\n                   jobRequest.getSpaceName());\n        params.put(\"Project\",\n                   jobRequest.getProjectName());\n        params.put(\"BranchName\",\n                   jobRequest.getBranchName());\n        params.put(\"Operation\",\n                   \"addBranch\");\n\n        scheduleJob(jobRequest,\n                    new RemoveBranchCmd(jobRequestHelper,\n                                        jobResultManager,\n                                        params));\n    }\n\n    public void removeSpaceRequest(final RemoveSpaceRequest jobRequest) {\n        final Map<String, Object> params = getContext(jobRequest);\n        params.put(\"Operation\",\n                   \"removeOrgUnit\");\n\n        scheduleJob(jobRequest,\n                    new RemoveSpaceCmd(jobRequestHelper,\n                                       jobResultManager,\n                                       params));\n    }\n\n    protected Map<String, Object> getContext(JobRequest jobRequest) {\n        final Map<String, Object> params = new HashMap<String, Object>();\n        params.put(JOB_REQUEST_KEY,\n                   jobRequest);\n        params.put(\"BusinessKey\",\n                   jobRequest.getJobId());\n        params.put(\"Retries\",\n                   0);\n        return params;\n    }\n\n    private void scheduleJob(final JobRequest jobRequest,\n                             final AbstractJobCommand command) {\n        jobRequest.setStatus(JobStatus.APPROVED);\n        logger.debug(\"Scheduling job request with id: {} and command class: {}\",\n                     jobRequest.getJobId(),\n                     command.getClass().getName());\n        this.executorService.execute(command);\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/JobResultManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend;\n\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.guvnor.rest.client.JobResult;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class JobResultManager {\n\n    private static final Logger logger = LoggerFactory.getLogger(JobResultManager.class);\n    private static AtomicInteger created = new AtomicInteger(0);\n\n    private static class Cache extends LinkedHashMap<String, JobResult> {\n\n        private int maxSize = 1000;\n\n        public Cache(int maxSize) {\n            this.maxSize = maxSize;\n        }\n\n        @Override\n        protected boolean removeEldestEntry(Map.Entry<String, JobResult> stringFutureEntry) {\n            return size() > maxSize;\n        }\n\n        public void setMaxSize(int maxSize) {\n            this.maxSize = maxSize;\n        }\n    }\n\n    private Map<String, JobResult> jobs = null;\n\n    private int maxCacheSize = 10000;\n\n    @PostConstruct\n    public void start() {\n        if (!created.compareAndSet(0,\n                                   1)) {\n            throw new IllegalStateException(\"Only 1 JobResultManager instance is allowed per container!\");\n        }\n        Cache cache = new Cache(maxCacheSize);\n        jobs = Collections.synchronizedMap(cache);\n    }\n\n    public JobResult getJob(String jobId) {\n        return jobs.get(jobId);\n    }\n\n    public void putJob(JobResult job) {\n        jobs.put(job.getJobId(),\n                 job);\n    }\n\n    public JobResult removeJob(String jobId) {\n        return jobs.remove(jobId);\n    }\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/PermissionAction.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.backend;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.ResourceAction;\n\npublic class PermissionAction {\n\n    private ResourceAction resourceAction;\n    private ResourceAction dependantAction;\n\n    public PermissionAction(ResourceAction resourceAction, ResourceAction dependantAction) {\n        this.resourceAction = resourceAction;\n        this.dependantAction = dependantAction;\n    }\n\n    public PermissionAction(ResourceAction resourceAction) {\n        this.resourceAction = resourceAction;\n    }\n\n    public ResourceAction getResourceAction() {\n        return resourceAction;\n    }\n\n    public ResourceAction getDependantAction() {\n        return dependantAction;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/PermissionConstants.java",
    "content": "package org.guvnor.rest.backend;\n\npublic interface PermissionConstants {\n\n    public static final String REST_ROLE = \"rest-all\";\n    public static final String REST_PROJECT_ROLE = \"rest-project\";\n    public static final String REST_DEPLOYMENT_ROLE = \"rest-deployment\";\n    public static final String REST_PROCESS_ROLE = \"rest-process\";\n    public static final String REST_PROCESS_RO_ROLE = \"rest-process-read-only\";\n    public static final String REST_TASK_ROLE = \"rest-task\";\n    public static final String REST_TASK_RO_ROLE = \"rest-task-read-only\";\n    public static final String REST_QUERY_ROLE = \"rest-query\";\n    public static final String REST_CLIENT_ROLE = \"rest-client\";\n    public static final String ADMIN_ROLE = \"admin\";\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/ProjectResource.java",
    "content": "/*\n* Copyright 2013 Red Hat, Inc. and/or its affiliates.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*      http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\npackage org.guvnor.rest.backend;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Locale;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicLong;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.security.RolesAllowed;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.HeaderParam;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.PUT;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.WebApplicationException;\nimport javax.ws.rs.core.Context;\nimport javax.ws.rs.core.HttpHeaders;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Response.Status;\nimport javax.ws.rs.core.UriInfo;\nimport javax.ws.rs.core.Variant;\n\nimport org.apache.commons.text.StringEscapeUtils;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.rest.client.AddBranchJobRequest;\nimport org.guvnor.rest.client.AddBranchRequest;\nimport org.guvnor.rest.client.BranchResponse;\nimport org.guvnor.rest.client.CloneProjectJobRequest;\nimport org.guvnor.rest.client.CloneProjectRequest;\nimport org.guvnor.rest.client.CompileProjectRequest;\nimport org.guvnor.rest.client.CreateProjectJobRequest;\nimport org.guvnor.rest.client.CreateProjectRequest;\nimport org.guvnor.rest.client.DeleteProjectRequest;\nimport org.guvnor.rest.client.DeployProjectRequest;\nimport org.guvnor.rest.client.InstallProjectRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.ProjectResponse;\nimport org.guvnor.rest.client.RemoveBranchJobRequest;\nimport org.guvnor.rest.client.RemoveSpaceRequest;\nimport org.guvnor.rest.client.Space;\nimport org.guvnor.rest.client.SpaceRequest;\nimport org.guvnor.rest.client.TestProjectRequest;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.rest.backend.PermissionConstants.REST_PROJECT_ROLE;\nimport static org.guvnor.rest.backend.PermissionConstants.REST_ROLE;\n\n/**\n * REST services for project management related operations\n */\n@Path(\"/\")\n@Named\n@ApplicationScoped\npublic class ProjectResource {\n\n    private static final Logger logger = LoggerFactory.getLogger(ProjectResource.class);\n    private static final String ACCEPT_LANGUAGE = \"acceptLanguage\";\n    private Variant defaultVariant = getDefaultVariant();\n\n    protected Variant getDefaultVariant() {\n        return Variant.mediaTypes(MediaType.APPLICATION_JSON_TYPE).add().build().get(0);\n    }\n\n    @Context\n    protected UriInfo uriInfo;\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n    @Inject\n    private OrganizationalUnitService organizationalUnitService;\n    @Inject\n    private WorkspaceProjectService workspaceProjectService;\n    @Inject\n    private JobRequestScheduler jobRequestObserver;\n    @Inject\n    private JobResultManager jobManager;\n    @Inject\n    private SpacesAPI spacesAPI;\n    @Inject\n    private SessionInfo sessionInfo;\n\n    private AtomicLong counter = new AtomicLong(0);\n\n    private void addAcceptedJobResult(String jobId) {\n        JobResult jobResult = new JobResult();\n        jobResult.setJobId(jobId);\n        jobResult.setStatus(JobStatus.ACCEPTED);\n        jobManager.putJob(jobResult);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/jobs/{jobId}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public JobResult getJobStatus(@PathParam(\"jobId\") String jobId) {\n        logger.debug(\"-----getJobStatus--- , jobId: {}\",\n                     jobId);\n\n        JobResult job = jobManager.getJob(jobId);\n        if (job == null) {\n            //the job has gone probably because its done and has been removed.\n            logger.debug(\"-----getJobStatus--- , can not find jobId: \" + jobId + \", the job has gone probably because its done and has been removed.\");\n            job = new JobResult();\n            job.setStatus(JobStatus.GONE);\n            return job;\n        }\n\n        return job;\n    }\n\n    @DELETE\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/jobs/{jobId}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public JobResult removeJob(@PathParam(\"jobId\") String jobId) {\n        logger.debug(\"-----removeJob--- , jobId: {}\",\n                     jobId);\n\n        final JobResult job = getJobResult(jobId);\n        job.setStatus(JobStatus.GONE);\n        return job;\n    }\n\n    private JobResult getJobResult(String jobId) {\n        final JobResult job = jobManager.removeJob(jobId);\n\n        if (job == null) {\n            //the job has gone probably because its done and has been removed.\n            logger.debug(\"-----removeJob--- , can not find jobId: \" + jobId + \", the job has gone probably because its done and has been removed.\");\n            return new JobResult();\n        } else {\n            return job;\n        }\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/git/clone\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response cloneProject(@PathParam(\"spaceName\") String spaceName,\n                                 CloneProjectRequest cloneProjectRequest) {\n        logger.debug(\"-----cloneProject--- , CloneProjectRequest name: {}\",\n                     cloneProjectRequest.getName());\n\n        final String id = newId();\n        final CloneProjectJobRequest jobRequest = new CloneProjectJobRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setCloneProjectRequest(cloneProjectRequest);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.cloneProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response createProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @HeaderParam(HttpHeaders.ACCEPT_LANGUAGE) Locale locales,\n            CreateProjectRequest createProjectRequest) {\n        logger.debug(\"-----createProject--- , spaceName: {} , project name: {}\",\n                     spaceName,\n                     createProjectRequest.getName());\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n        \n        final Map<String, Object> headers = new HashMap<>();\n        headers.put(ACCEPT_LANGUAGE, locales);\n        final String id = newId();\n        final CreateProjectJobRequest jobRequest = new CreateProjectJobRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setProjectName(createProjectRequest.getName());\n        jobRequest.setProjectGroupId(createProjectRequest.getGroupId());\n        jobRequest.setProjectVersion(createProjectRequest.getVersion());\n        jobRequest.setDescription(createProjectRequest.getDescription());\n        jobRequest.setTemplateId(createProjectRequest.getTemplateId());\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.createProjectRequest(jobRequest,\n                                                headers);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Collection<ProjectResponse> getProjects(@PathParam(\"spaceName\") String spaceName) {\n        logger.info(\"-----getProjects--- , spaceName: {}\",\n                    spaceName);\n\n        org.guvnor.structure.organizationalunit.OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n\n        assertObjectExists(organizationalUnit,\n                           \"space\",\n                           spaceName);\n\n        final Collection<WorkspaceProject> projects = workspaceProjectService.getAllWorkspaceProjects(organizationalUnit);\n\n        final List<ProjectResponse> projectRequests = new ArrayList<ProjectResponse>(projects.size());\n        for (WorkspaceProject project : projects) {\n            projectRequests.add(getProjectResponse(project));\n        }\n\n        return projectRequests;\n    }\n\n    @DELETE\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response deleteProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName) {\n        logger.debug(\"-----deleteProject--- , space name: {}, project name: {}\",\n                     spaceName,\n                     projectName);\n\n        final org.uberfire.spaces.Space space = spacesAPI.getSpace(spaceName);\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n        assertObjectExists(workspaceProjectService.resolveProject(space, projectName),\n                           \"project\",\n                           projectName);\n        final String id = newId();\n        final DeleteProjectRequest jobRequest = new DeleteProjectRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setSpaceName(spaceName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.deleteProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public ProjectResponse getProject(@PathParam(\"spaceName\") String spaceName,\n                                      @PathParam(\"projectName\") String projectName) {\n        logger.debug(\"-----getProject---, space name: {}, project name: {}\",\n                     spaceName,\n                     projectName);\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(spacesAPI.getSpace(spaceName), projectName);\n\n        assertObjectExists(workspaceProject,\n                           \"project\",\n                           projectName);\n\n        final ProjectResponse projectResponse = getProjectResponse(workspaceProject);\n\n        return projectResponse;\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Collection<BranchResponse> getBranches(@PathParam(\"spaceName\") String spaceName,\n                                                  @PathParam(\"projectName\") String projectName) {\n\n        logger.debug(\"-----getBranches---, space name: {}, project name: {}\",\n                     spaceName,\n                     projectName);\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName);\n\n        assertObjectExists(workspaceProject,\n                           \"project\",\n                           projectName);\n\n        return workspaceProject\n                .getRepository()\n                .getBranches()\n                .stream()\n                .map(this::getBranchResponse)\n                .collect(Collectors.toList());\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response addBranch(@PathParam(\"spaceName\") String spaceName,\n                              @PathParam(\"projectName\") String projectName,\n                              AddBranchRequest addBranchRequest) {\n\n        logger.debug(\"-----addBranch--- , spaceName: {} , project name: {}, branch Name: {}\",\n                     spaceName,\n                     projectName,\n                     addBranchRequest.getNewBranchName());\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName);\n\n        assertObjectExists(workspaceProject,\n                           \"project\",\n                           projectName);\n\n        final String id = newId();\n        final AddBranchJobRequest jobRequest = new AddBranchJobRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setNewBranchName(escapeHtmlInput(addBranchRequest.getNewBranchName()));\n        jobRequest.setBaseBranchName(addBranchRequest.getBaseBranchName());\n        jobRequest.setUserIdentifier(sessionInfo.getIdentity().getIdentifier());\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.addBranchRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @DELETE\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches/{branchName}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response removeBranch(@PathParam(\"spaceName\") String spaceName,\n                                 @PathParam(\"projectName\") String projectName,\n                                 @PathParam(\"branchName\") String branchName) {\n\n        logger.debug(\"-----removeBranch--- , spaceName: {} , project name: {}, branch Name: {}\",\n                     spaceName,\n                     projectName,\n                     branchName);\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n\n        final WorkspaceProject workspaceProject = workspaceProjectService.resolveProject(\n                spacesAPI.getSpace(spaceName),\n                projectName);\n\n        assertObjectExists(workspaceProject,\n                           \"project\",\n                           projectName);\n\n        final String id = newId();\n        final RemoveBranchJobRequest jobRequest = new RemoveBranchJobRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setBranchName(branchName);\n        jobRequest.setUserIdentifier(sessionInfo.getIdentity().getIdentifier());\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.removeBranchRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    private BranchResponse getBranchResponse(Branch branch) {\n        final BranchResponse branchResponse = new BranchResponse();\n        branchResponse.setName(branch.getName());\n        return branchResponse;\n    }\n\n    private ProjectResponse getProjectResponse(WorkspaceProject workspaceProject) {\n        final ProjectResponse projectResponse = new ProjectResponse();\n        projectResponse.setName(workspaceProject.getName());\n        projectResponse.setSpaceName(workspaceProject.getOrganizationalUnit().getName());\n\n        if (workspaceProject.getMainModule() != null) {\n            projectResponse.setGroupId(workspaceProject.getMainModule().getPom().getGav().getGroupId());\n            projectResponse.setVersion(workspaceProject.getMainModule().getPom().getGav().getVersion());\n            projectResponse.setDescription(workspaceProject.getMainModule().getPom().getDescription());\n        }\n\n        final ArrayList<org.guvnor.rest.client.PublicURI> publicURIs = new ArrayList<>();\n\n        for (PublicURI publicURI : workspaceProject.getRepository().getPublicURIs()) {\n            final org.guvnor.rest.client.PublicURI responseURI = new org.guvnor.rest.client.PublicURI();\n            responseURI.setProtocol(publicURI.getProtocol());\n            responseURI.setUri(publicURI.getURI());\n            publicURIs.add(responseURI);\n        }\n\n        projectResponse.setPublicURIs(publicURIs);\n        return projectResponse;\n    }\n\n    private String escapeHtmlInput(String input) {\n        if (input != null) {\n            String escapedInput = StringEscapeUtils.escapeHtml4(input);\n            escapedInput = escapedInput.replace(\"'\", \"\");\n            return escapedInput;\n        } else {\n            return null;\n        }\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/maven/compile\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response compileProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName) {\n\n        return compileProject(spaceName,\n                              projectName,\n                              null);\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches/{branchName}/maven/compile\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response compileProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName,\n            @PathParam(\"branchName\") String branchName) {\n\n        logger.debug(\"-----compileProject--- , space name: {}, project name: {}, branch name: {}\",\n                     spaceName,\n                     projectName,\n                     branchName);\n\n        final String id = newId();\n        final CompileProjectRequest jobRequest = new CompileProjectRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setBranchName(branchName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.compileProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/maven/install\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response installProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName) {\n\n        return installProject(spaceName,\n                              projectName,\n                              null);\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches/{branchName}/maven/install\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response installProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName,\n            @PathParam(\"branchName\") String branchName) {\n\n        logger.debug(\"-----installProject--- , project name: {}, branch name: {}\",\n                     projectName,\n                     branchName);\n\n        PortablePreconditions.checkNotNull(\"spaceName\", spaceName);\n        PortablePreconditions.checkNotNull(\"projectName\", projectName);\n\n        final String id = newId();\n        final InstallProjectRequest jobRequest = new InstallProjectRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setBranchName(branchName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.installProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/maven/test\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response testProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName) {\n\n        return testProject(spaceName,\n                           projectName,\n                           null);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches/{branchName}/maven/test\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response testProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName,\n            @PathParam(\"branchName\") String branchName) {\n\n        logger.debug(\"-----testProject--- , project name: {}, branch name: {}\",\n                     projectName,\n                     branchName);\n\n        final String id = newId();\n        final TestProjectRequest jobRequest = new TestProjectRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setBranchName(branchName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.testProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/maven/deploy\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response deployProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName) {\n\n        return deployProject(spaceName,\n                             projectName,\n                             null);\n    }\n\n    @POST\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}/projects/{projectName}/branches/{branchName}/maven/deploy\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response deployProject(\n            @PathParam(\"spaceName\") String spaceName,\n            @PathParam(\"projectName\") String projectName,\n            @PathParam(\"branchName\") String branchName) {\n\n        logger.debug(\"-----deployProject--- , project name: {}, branch name: {}\",\n                     projectName,\n                     branchName);\n\n        final String id = newId();\n        final DeployProjectRequest jobRequest = new DeployProjectRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setProjectName(projectName);\n        jobRequest.setSpaceName(spaceName);\n        jobRequest.setBranchName(branchName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.deployProjectRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Collection<Space> getSpaces() {\n        logger.debug(\"-----getSpaces--- \");\n\n        final List<Space> spaces = new ArrayList<Space>();\n        for (OrganizationalUnit ou : organizationalUnitService.getOrganizationalUnits()) {\n            spaces.add(getSpace(ou));\n        }\n\n        return spaces;\n    }\n\n    private Space getSpace(OrganizationalUnit ou) {\n        final Space space = new Space();\n        space.setName(ou.getName());\n        space.setDescription(ou.getDescription());\n        space.setOwner(ou.getOwner());\n        space.setDefaultGroupId(ou.getDefaultGroupId());\n\n        final List<ProjectResponse> repoNames = new ArrayList<>();\n        for (WorkspaceProject workspaceProject : workspaceProjectService.getAllWorkspaceProjects(ou)) {\n            repoNames.add(getProjectResponse(workspaceProject));\n        }\n\n        space.setProjects(repoNames);\n        return space;\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Space getSpace(@PathParam(\"spaceName\") String spaceName) {\n        logger.debug(\"-----getSpace ---, Space name: {}\",\n                     spaceName);\n        final OrganizationalUnit ou = organizationalUnitService.getOrganizationalUnit(spaceName);\n\n        assertObjectExists(ou,\n                           \"space\",\n                           spaceName);\n\n        return getSpace(ou);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response createSpace(Space space) {\n        logger.debug(\"-----createSpace--- , Space name: {}, Space owner: {}, Default group id : {}\",\n                     space.getName(),\n                     space.getOwner(),\n                     space.getDefaultGroupId());\n\n        final String id = newId();\n        final SpaceRequest jobRequest = new SpaceRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(space.getName());\n        jobRequest.setDescription(space.getDescription());\n        jobRequest.setOwner(escapeHtmlInput(space.getOwner()));\n        jobRequest.setDefaultGroupId(space.getDefaultGroupId());\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.createSpaceRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @PUT\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response updateSpace(Space space) {\n        logger.debug(\"-----updateSpace--- , Space name: {}, Default group id : {}\",\n                     space.getName(),\n                     space.getDefaultGroupId());\n\n        final String id = newId();\n        final SpaceRequest jobRequest = new SpaceRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(space.getName());\n        jobRequest.setDescription(space.getDescription());\n        jobRequest.setOwner(escapeHtmlInput(space.getOwner()));\n        jobRequest.setDefaultGroupId(space.getDefaultGroupId());\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.updateSpaceRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    @DELETE\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/spaces/{spaceName}\")\n    @RolesAllowed({REST_ROLE, REST_PROJECT_ROLE})\n    public Response deleteSpace(@PathParam(\"spaceName\") String spaceName) {\n        logger.debug(\"-----deleteSpace--- , Space name: {}\",\n                     spaceName);\n\n        assertObjectExists(organizationalUnitService.getOrganizationalUnit(spaceName),\n                           \"space\",\n                           spaceName);\n\n        final String id = newId();\n        final RemoveSpaceRequest jobRequest = new RemoveSpaceRequest();\n        jobRequest.setStatus(JobStatus.ACCEPTED);\n        jobRequest.setJobId(id);\n        jobRequest.setSpaceName(spaceName);\n        addAcceptedJobResult(id);\n\n        jobRequestObserver.removeSpaceRequest(jobRequest);\n\n        return createAcceptedStatusResponse(jobRequest);\n    }\n\n    protected void assertObjectExists(final Object o,\n                                      final String objectInfo,\n                                      final String objectName) {\n        if (o == null) {\n            throw new WebApplicationException(String.format(\"Could not find %s with name %s.\", objectInfo, objectName),\n                                              Response.status(Status.NOT_FOUND).build());\n        }\n    }\n\n    protected Response createAcceptedStatusResponse(final JobRequest jobRequest) {\n        return Response.status(Status.ACCEPTED).entity(jobRequest).variant(defaultVariant).build();\n    }\n\n    private String newId() {\n        return \"\" + System.currentTimeMillis() + \"-\" + counter.incrementAndGet();\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/ResourceTypePermissionValidator.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.kie.soup.commons.util.Maps;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.AppFormerActivities;\n\nimport static org.guvnor.structure.security.RepositoryAction.BUILD;\nimport static org.guvnor.structure.security.RepositoryAction.CREATE;\nimport static org.guvnor.structure.security.RepositoryAction.DELETE;\nimport static org.guvnor.structure.security.RepositoryAction.UPDATE;\nimport static org.uberfire.security.ResourceAction.READ;\n\n/**\n * Utility class containing functions to help resolving permissions on specific resources\n */\n\n@ApplicationScoped\npublic class ResourceTypePermissionValidator {\n\n    private OrganizationalUnitService organizationalUnitService;\n\n    private WorkspaceProjectService projectService;\n\n    private AppFormerActivities appFormerActivities;\n\n    private PermissionManager permissionManager;\n\n    private Map<ResourceType, List<PermissionAction>> permissionMap = new Maps.Builder<ResourceType, List<PermissionAction>>()\n            .put(OrganizationalUnit.RESOURCE_TYPE, Arrays.asList(new PermissionAction(READ), new PermissionAction(CREATE), new PermissionAction(UPDATE, READ), new PermissionAction(DELETE, READ)))\n            .put(Repository.RESOURCE_TYPE, Arrays.asList(new PermissionAction(READ), new PermissionAction(CREATE), new PermissionAction(UPDATE, READ), new PermissionAction(DELETE, READ), new PermissionAction(BUILD, READ)))\n            .put(ActivityResourceType.PERSPECTIVE, Arrays.asList(new PermissionAction(READ), new PermissionAction(UPDATE, READ), new PermissionAction(DELETE, READ), new PermissionAction(CREATE, READ)))\n            .put(ActivityResourceType.EDITOR, Arrays.asList(new PermissionAction(READ)))\n            .build();\n\n    public ResourceTypePermissionValidator() {\n    }\n\n    @Inject\n    public ResourceTypePermissionValidator(@Customizable final AppFormerActivities appFormerActivities, final OrganizationalUnitService organizationalUnitService,\n                                           final WorkspaceProjectService projectService, final PermissionManager permissionManager) {\n        this.appFormerActivities = appFormerActivities;\n        this.organizationalUnitService = organizationalUnitService;\n        this.projectService = projectService;\n        this.permissionManager = permissionManager;\n    }\n\n    public Set<Map.Entry<ResourceType, List<PermissionAction>>> getPermissionEntries() {\n        return permissionMap.entrySet();\n    }\n\n    public boolean isPermissionAllowed(ResourceType resourceType, ResourceAction permissionType) {\n        return permissionMap.get(resourceType).stream().anyMatch(vp -> vp.getResourceAction().equals(permissionType));\n    }\n\n    public Optional<PermissionAction> resourceDependancy(ResourceType resourceType, ResourceAction permissionType) {\n        return permissionMap.get(resourceType).stream().filter(vp -> vp.getResourceAction().equals(permissionType)).findFirst();\n    }\n\n    public boolean satisfyDependancies(PermissionCollection pc, ResourceType resourceType, ResourceAction resourceAction) {\n        return resourceDependancy(resourceType, resourceAction).map(permissionAction -> {\n            ResourceAction dependantAction  = permissionAction.getDependantAction();\n            if (dependantAction != null) {\n                org.uberfire.security.authz.Permission permission = permissionManager.createPermission(resourceType, dependantAction, true);\n                return pc.implies(permission);\n            }\n           return true;\n        }).orElse(true);\n    }\n\n    public boolean isValidResourceType(ResourceType resourceType, String resourceId) {\n        if (resourceType.equals(ActivityResourceType.PERSPECTIVE) &&\n                appFormerActivities.getAllPerpectivesIds().contains(resourceId)) {\n            return true;\n        } else if (resourceType.equals(ActivityResourceType.EDITOR) &&\n                appFormerActivities.getAllEditorIds().contains(resourceId)) {\n            return true;\n        } else if (resourceType.equals(OrganizationalUnit.RESOURCE_TYPE)) {\n            return organizationalUnitService.getOrganizationalUnits().stream()\n                    .anyMatch(orgUnit -> resourceId.equals(orgUnit.getName()));\n        } else if (resourceType.equals(Repository.RESOURCE_TYPE)) {\n            return projectService.getAllWorkspaceProjects().stream()\n                    .anyMatch(project -> resourceId.equals(project.getName()));\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/UserManagementResource.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.annotation.security.RolesAllowed;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.ws.rs.Consumes;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.Path;\nimport javax.ws.rs.PathParam;\nimport javax.ws.rs.Produces;\nimport javax.ws.rs.WebApplicationException;\nimport javax.ws.rs.core.MediaType;\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Variant;\n\nimport org.guvnor.rest.client.NewGroup;\nimport org.guvnor.rest.client.NewUser;\nimport org.guvnor.rest.client.PermissionResponse;\nimport org.guvnor.rest.client.UberfireRestResponse;\nimport org.guvnor.rest.client.UpdateSettingRequest;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.workbench.model.AppFormerActivities;\n\nimport static org.guvnor.rest.backend.PermissionConstants.ADMIN_ROLE;\n\n/**\n * REST services for user management operations\n */\n@Path(\"/\")\n@Named\n@ApplicationScoped\npublic class UserManagementResource {\n\n    private static final Logger logger = LoggerFactory.getLogger(UserManagementResource.class);\n\n    @Inject\n    private GroupManagerService groupManagerService;\n\n    @Inject\n    private RoleManagerService roleManagerService;\n\n    @Inject\n    private UserManagerService userManagerService;\n\n    @Inject\n    private UserManagementResourceHelper resourceHelper;\n\n    @Inject\n    @Customizable\n    private AppFormerActivities appFormerActivities;\n\n    private Variant defaultVariant = getDefaultVariant();\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/groups\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response createGroup(NewGroup group) {\n        logger.debug(\"-----createGroup--- , Group name: {}, User assigned : {}\",\n                     group.getName(),\n                     group.getUsers());\n        UberfireRestResponse response = resourceHelper.createGroup(group.getName(), group.getUsers());\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response createUser(NewUser newUser) {\n        logger.debug(\"-----createUsers--- , User name: {}\",\n                     newUser.getName());\n        UberfireRestResponse response = resourceHelper.createUser(newUser);\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/changePassword\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response changePassword(@PathParam(\"userName\") String userName, String password) {\n        logger.debug(\"-----changePassword--- , User name: {}\", userName);\n\n        assertObjectExists(userManagerService.get(userName),\n                           \"user\",\n                           userName);\n\n        UberfireRestResponse response = resourceHelper.changePassword(userName, password);\n        return createResponse(response);\n    }\n\n    @DELETE\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/groups/{groupName}\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response deleteGroup(@PathParam(\"groupName\") String groupName) {\n        logger.debug(\"-----deleteGroup--- , Group Name: {}\",\n                     groupName);\n\n        assertObjectExists(groupManagerService.get(groupName),\n                           \"group\",\n                           groupName);\n        UberfireRestResponse response = resourceHelper.removeGroup(groupName);\n        return createResponse(response);\n    }\n\n    @DELETE\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response deleteUser(@PathParam(\"userName\") String userName) {\n        logger.debug(\"-----deleteUser--- , User Name: {}\",\n                     userName);\n\n        assertObjectExists(userManagerService.get(userName),\n                           \"user\",\n                           userName);\n        UberfireRestResponse response = resourceHelper.removeUser(userName);\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/groups/{groupName}/permissions\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response updateGroupPermissions(@PathParam(\"groupName\") String groupName, UpdateSettingRequest permissionRequest) {\n        logger.debug(\"-----updateGroupPermissions--- , Group name: {}\",\n                     groupName);\n\n        assertObjectExists(groupManagerService.get(groupName),\n                           \"group\",\n                           groupName);\n        UberfireRestResponse response = resourceHelper.updateGroupPermissions(groupName, permissionRequest);\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/roles/{rolesName}/permissions\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response updateRolePermissions(@PathParam(\"rolesName\") String rolesName, UpdateSettingRequest permissionRequest) {\n        logger.debug(\"-----updateRolePermissions--- , Role name: {}\",\n                     rolesName);\n\n        assertObjectExists(roleManagerService.get(rolesName),\n                           \"role\",\n                           rolesName);\n        UberfireRestResponse response = resourceHelper.updateRolePermissions(rolesName, permissionRequest);\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/groups\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response assignGroupsToUser(@PathParam(\"userName\") String userName, List<String> groups) {\n        logger.debug(\"-----assignGroupsToUser--- , User name: {}\",\n                     userName);\n\n        assertObjectExists(userManagerService.get(userName),\n                           \"user\",\n                           userName);\n        UberfireRestResponse response = resourceHelper.assignGroupsToUser(userName, groups);\n        return createResponse(response);\n    }\n\n    @POST\n    @Consumes(MediaType.APPLICATION_JSON)\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/roles\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Response assignRolesToUser(@PathParam(\"userName\") String userName, List<String> roles) {\n        logger.debug(\"-----assignRolesToUser--- , User name: {}\",\n                     userName);\n\n        assertObjectExists(userManagerService.get(userName),\n                           \"user\",\n                           userName);\n        UberfireRestResponse response = resourceHelper.assignRolesToUser(userName, roles);\n        return createResponse(response);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/permissions\")\n    @RolesAllowed({ADMIN_ROLE})\n    public PermissionResponse getUserPermissions(@PathParam(\"userName\") String userName) {\n        logger.debug(\"-----getUserPermissions--- \");\n\n        final User user = userManagerService.getUser(userName);\n        assertObjectExists(user,\n                           \"user\",\n                           userName);\n        return resourceHelper.getUserPermissions(userName);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/groups/{groupName}/permissions\")\n    @RolesAllowed({ADMIN_ROLE})\n    public PermissionResponse getGroupPermissions(@PathParam(\"groupName\") String groupName) {\n        logger.debug(\"-----getGroupPermissions--- \");\n\n        final Group group = groupManagerService.get(groupName);\n        assertObjectExists(group,\n                           \"group\",\n                           groupName);\n\n        return resourceHelper.getGroupPermissions(groupName);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/roles/{roleName}/permissions\")\n    @RolesAllowed({ADMIN_ROLE})\n    public PermissionResponse getRolePermissions(@PathParam(\"roleName\") String roleName) {\n        logger.debug(\"-----getUserPermissions--- \");\n\n        final Role role = roleManagerService.get(roleName);\n        assertObjectExists(role,\n                           \"role\",\n                           roleName);\n        return resourceHelper.getRolePermissions(roleName);\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/roles\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<Role> getRoles() {\n        logger.debug(\"-----getRoles--- \");\n\n        return roleManagerService.getAll();\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<String> getUsers() {\n        logger.debug(\"-----getUsers--- \");\n        List<String> results = new ArrayList<>();\n        final List<User> users = userManagerService.getAll();\n        if (users != null) {\n            for (User user : users) {\n                results.add(user.getIdentifier());\n            }\n        }\n        return results;\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/groups\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<Group> getUserGroups(@PathParam(\"userName\") String userName) {\n        logger.debug(\"-----getUserGroups--- \");\n\n        final User user = userManagerService.getUser(userName);\n        assertObjectExists(user,\n                           \"user\",\n                           userName);\n        return user.getGroups();\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/users/{userName}/roles\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<Role> getUserRoles(@PathParam(\"userName\") String userName) {\n        logger.debug(\"-----getUserRoles--- \");\n\n        final User user = userManagerService.getUser(userName);\n        assertObjectExists(user,\n                           \"user\",\n                           userName);\n        return user.getRoles();\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/groups\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<Group> getGroups() {\n        logger.debug(\"-----getGroups--- \");\n        return groupManagerService.getAll();\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/editors\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<String> getEditors() {\n        logger.debug(\"-----getEditors--- \");\n\n        return appFormerActivities.getAllEditorIds();\n    }\n\n    @GET\n    @Produces(MediaType.APPLICATION_JSON)\n    @Path(\"/perspectives\")\n    @RolesAllowed({ADMIN_ROLE})\n    public Collection<String> getPerpectives() {\n        logger.debug(\"-----getPerpectives--- \");\n\n        return appFormerActivities.getAllPerpectivesIds();\n    }\n\n    protected void assertObjectExists(final Object o,\n                                      final String objectInfo,\n                                      final String objectName) {\n        if (o == null) {\n            throw new WebApplicationException(String.format(\"Could not find %s with name %s.\", objectInfo, objectName),\n                                              Response.status(Response.Status.NOT_FOUND).build());\n        }\n    }\n\n    protected Response createResponse(final UberfireRestResponse restResponse) {\n        return Response.status(restResponse.getStatus()).entity(restResponse).variant(defaultVariant).build();\n    }\n\n    protected Variant getDefaultVariant() {\n        return Variant.mediaTypes(MediaType.APPLICATION_JSON_TYPE).add().build().get(0);\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/UserManagementResourceHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.ws.rs.core.Response;\n\nimport org.guvnor.rest.client.NewUser;\nimport org.guvnor.rest.client.Permission;\nimport org.guvnor.rest.client.PermissionException;\nimport org.guvnor.rest.client.PermissionResponse;\nimport org.guvnor.rest.client.PermissionType;\nimport org.guvnor.rest.client.ResourcePermission;\nimport org.guvnor.rest.client.UberfireRestResponse;\nimport org.guvnor.rest.client.UpdateSettingRequest;\nimport org.guvnor.rest.client.WorkbenchPermission;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingStrategy;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.guvnor.structure.security.RepositoryAction.BUILD;\nimport static org.guvnor.structure.security.RepositoryAction.CREATE;\nimport static org.guvnor.structure.security.RepositoryAction.DELETE;\nimport static org.guvnor.structure.security.RepositoryAction.UPDATE;\nimport static org.uberfire.security.ResourceAction.READ;\n\n/**\n * Utility class to perform various functions for the REST service involving user management operations\n */\n@ApplicationScoped\npublic class UserManagementResourceHelper {\n\n    private static final Logger logger = LoggerFactory.getLogger(UserManagementResourceHelper.class);\n\n    private static final String EDIT_GLOBAL_PREFERENCES = \"globalpreferences.edit\";\n    private static final String GUIDED_DECISION_TABLE_EDIT_COLUMNS = \"guideddecisiontable.edit.columns\";\n    private static final String EDIT_PROFILE_PREFERENCES = \"profilepreferences.edit\";\n    private static final String ACCESS_DATA_TRANSFER = \"datatransfer.access\";\n    private static final String EDIT_SOURCES = \"dataobject.edit\";\n    private static final String JAR_DOWNLOAD = \"jar.download\";\n    private static final String PLANNER_AVAILABLE = \"planner.available\";\n\n    @Inject\n    private GroupManagerService groupManagerService;\n\n    @Inject\n    private UserManagerService userManagerService;\n\n    @Inject\n    private RoleManagerService roleManagerService;\n\n    @Inject\n    private AuthorizationService authorizationService;\n\n    @Inject\n    private PermissionManager permissionManager;\n\n    @Inject\n    private ResourceTypePermissionValidator permissionValidator;\n\n    public UberfireRestResponse createGroup(final String groupName,\n                                            final List<String> users) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        if (groupName == null) {\n            response.setStatus(Response.Status.BAD_REQUEST);\n            response.setMessage(\"Group name cannot be empty\");\n        }\n        Group group;\n        try {\n            group = groupManagerService.get(groupName);\n            if (group != null) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"Group with name \" + groupName + \" already exists\");\n            }\n        } catch (GroupNotFoundException e) {\n            if (!areUsersValid(users)) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"Usernames are invalid, please check\");\n                return response;\n            }\n            group = groupManagerService.create(new GroupImpl(groupName));\n            groupManagerService.assignUsers(groupName, users);\n            if (group != null) {\n                response.setStatus(Response.Status.OK);\n                response.setMessage(\"Group \" + group.getName() + \" is created successfully.\");\n            } else {\n                response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            }\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to create '\" + groupName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse createUser(NewUser newUser) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        if (newUser.getName() == null) {\n            response.setStatus(Response.Status.BAD_REQUEST);\n            response.setMessage(\"User name cannot be empty\");\n            return response;\n        }\n        try {\n            if (!areRolesValid(newUser.getRoles()) || !areGroupsValid(newUser.getGroups())) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"User roles/groups are invalid. Please check \");\n                return response;\n            }\n\n            User user = userManagerService.get(newUser.getName());\n            if (user != null) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"User with name \" + newUser.getName() + \" already exists\");\n            }\n        } catch (UserNotFoundException e) {\n            User userCreated = userManagerService.create(createUserObject(newUser));\n            if (userCreated != null) {\n                response.setStatus(Response.Status.OK);\n                response.setMessage(\"User \" + userCreated.getIdentifier() + \" is created successfully.\");\n            } else {\n                response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            }\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to create '\" + newUser.getName() + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse changePassword(String user, String newPassword) {\n        UberfireRestResponse response = new UberfireRestResponse();\n\n        try {\n            userManagerService.changePassword(user, newPassword);\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"Password for \" + user + \" has been updated successfully.\");\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to update password for '\" + user + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse removeGroup(final String groupName) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            groupManagerService.delete(groupName);\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"Group \" + groupName + \" is deleted successfully.\");\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to remove '\" + groupName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse removeUser(final String userName) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            userManagerService.delete(userName);\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"User \" + userName + \" is deleted successfully.\");\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to remove '\" + userName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse assignGroupsToUser(final String userName,\n                                                   final List<String> groups) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            if (!areGroupsValid(groups)) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"Groups \" + groups + \" are not valid \");\n                return response;\n            }\n            userManagerService.assignGroups(userName, groups);\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"Groups \" + groups + \" are assigned successfully to user \" + userName);\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to assign groups to user  '\" + userName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse assignRolesToUser(final String userName,\n                                                  final List<String> roles) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            if (!areRolesValid(roles)) {\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"Roles \" + roles + \" are not valid \");\n            }\n            userManagerService.assignRoles(userName, roles);\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"Roles \" + roles + \" are assigned successfully to user \" + userName);\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to assign roles to user  '\" + userName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public PermissionResponse getGroupPermissions(String groupName) {\n        PermissionResponse permissionResponse = new PermissionResponse();\n        Group group = groupManagerService.get(groupName);\n        if (group != null) {\n            AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n            PermissionCollection pc = authzPolicy.getPermissions(group);\n            permissionResponse.setPriority(authzPolicy.getPriority(group));\n            permissionResponse.setHomePage(authzPolicy.getHomePerspective(group));\n            convertCollectionToPermissionResponse(permissionResponse, pc);\n            permissionResponse.setWorkbench(getWorkbenchPermissions(pc));\n        }\n        return permissionResponse;\n    }\n\n    public PermissionResponse getRolePermissions(String roleName) {\n        PermissionResponse permissionResponse = new PermissionResponse();\n        Role role = roleManagerService.get(roleName);\n        if (role != null) {\n            AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n            PermissionCollection pc = authzPolicy.getPermissions(role);\n            permissionResponse.setPriority(authzPolicy.getPriority(role));\n            permissionResponse.setHomePage(authzPolicy.getHomePerspective(role));\n            convertCollectionToPermissionResponse(permissionResponse, pc);\n            permissionResponse.setWorkbench(getWorkbenchPermissions(pc));\n        }\n        return permissionResponse;\n    }\n\n    public PermissionResponse getUserPermissions(String userName) {\n        PermissionResponse permissionResponse = new PermissionResponse();\n        User user = userManagerService.get(userName);\n        PermissionCollection pc = permissionManager.resolvePermissions(user, VotingStrategy.PRIORITY);\n        convertCollectionToPermissionResponse(permissionResponse, pc);\n        permissionResponse.setWorkbench(getWorkbenchPermissions(pc));\n        return permissionResponse;\n    }\n\n    public UberfireRestResponse updateGroupPermissions(final String groupName,\n                                                       final UpdateSettingRequest permissionsRequest) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            Group group = groupManagerService.get(groupName);\n            AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n\n            if (permissionsRequest.getHomePage() != null && permissionValidator.isValidResourceType(ActivityResourceType.PERSPECTIVE, permissionsRequest.getHomePage())) {\n                authzPolicy.setHomePerspective(group, permissionsRequest.getHomePage());\n            }\n            if (permissionsRequest.getPriority() != null) {\n                authzPolicy.setPriority(group, permissionsRequest.getPriority());\n            }\n\n            PermissionCollection pc = authzPolicy.getPermissions(group);\n            generatePermissionCollection(pc, permissionsRequest);\n            authzPolicy.setPermissions(group, pc);\n\n            authorizationService.savePolicy(authzPolicy);\n\n            response.setStatus(Response.Status.OK);\n            response.setMessage(\"Group \" + groupName + \" permissions are updated successfully.\");\n        } catch (GroupNotFoundException e) {\n            response.setStatus(Response.Status.BAD_REQUEST);\n            response.setMessage(\"Group with name \" + groupName + \"doesn't exists\");\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to update permissions for  '\" + groupName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    public UberfireRestResponse updateRolePermissions(final String roleName,\n                                                      final UpdateSettingRequest permissionsRequest) {\n        UberfireRestResponse response = new UberfireRestResponse();\n        try {\n            Role role = roleManagerService.get(roleName);\n            if (role != null) {\n                AuthorizationPolicy authzPolicy = permissionManager.getAuthorizationPolicy();\n                if (permissionsRequest.getHomePage() != null && permissionValidator.isValidResourceType(ActivityResourceType.PERSPECTIVE, permissionsRequest.getHomePage())) {\n                    authzPolicy.setHomePerspective(role, permissionsRequest.getHomePage());\n                }\n                if (permissionsRequest.getPriority() != null) {\n                    authzPolicy.setPriority(role, permissionsRequest.getPriority());\n                }\n\n                PermissionCollection pc = authzPolicy.getPermissions(role);\n                generatePermissionCollection(pc, permissionsRequest);\n                authzPolicy.setPermissions(role, pc);\n\n                authorizationService.savePolicy(authzPolicy);\n\n                response.setStatus(Response.Status.OK);\n                response.setMessage(\"Role \" + roleName + \" permissions are updated successfully.\");\n            } else {\n\n                response.setStatus(Response.Status.BAD_REQUEST);\n                response.setMessage(\"Role with name \" + roleName + \"doesn't exists\");\n            }\n        } catch (Exception e) {\n            String errMsg = e.getClass().getSimpleName() + \" thrown when trying to update permissions for  '\" + roleName + \"': \" + e.getMessage();\n            logger.error(errMsg, e);\n            response.setStatus(Response.Status.INTERNAL_SERVER_ERROR);\n            response.setMessage(errMsg);\n        }\n        return response;\n    }\n\n    private void convertCollectionToPermissionResponse(PermissionResponse permissionResponse, PermissionCollection pc) {\n\n        for (Map.Entry<ResourceType, List<PermissionAction>> entry : permissionValidator.getPermissionEntries()) {\n            ResourcePermission permission = new ResourcePermission();\n            ResourceType resourceType = entry.getKey();\n            List<PermissionAction> resourceActions = entry.getValue();\n\n            for (PermissionAction resourceAction : resourceActions) {\n                PermissionType permissionType = getPermissionsType(pc, resourceType, resourceAction.getResourceAction());\n                getPermissions(permission, resourceAction.getResourceAction(), permissionType);\n            }\n\n            if (resourceType.equals(ActivityResourceType.PERSPECTIVE)) {\n                permissionResponse.setPages(permission);\n            }\n            if (resourceType.equals(OrganizationalUnit.RESOURCE_TYPE)) {\n                permissionResponse.setSpaces(permission);\n            }\n            if (resourceType.equals(ActivityResourceType.EDITOR)) {\n                permissionResponse.setEditor(permission);\n            }\n            if (resourceType.equals(Repository.RESOURCE_TYPE)) {\n                permissionResponse.setProject(permission);\n            }\n        }\n    }\n\n    private WorkbenchPermission getWorkbenchPermissions(PermissionCollection pc) {\n        WorkbenchPermission workbenchPermission = new WorkbenchPermission();\n        workbenchPermission.setAccessDataTransfer(resolvePermission(pc, ACCESS_DATA_TRANSFER));\n        workbenchPermission.setEditDataObject(resolvePermission(pc, EDIT_SOURCES));\n        workbenchPermission.setEditGlobalPreferences(resolvePermission(pc, EDIT_GLOBAL_PREFERENCES));\n        workbenchPermission.setEditProfilePreferences(resolvePermission(pc, EDIT_PROFILE_PREFERENCES));\n        workbenchPermission.setJarDownload(resolvePermission(pc, JAR_DOWNLOAD));\n        workbenchPermission.setPlannerAvailable(resolvePermission(pc, PLANNER_AVAILABLE));\n        workbenchPermission.setEditGuidedDecisionTableColumns(resolvePermission(pc, GUIDED_DECISION_TABLE_EDIT_COLUMNS));\n        return workbenchPermission;\n    }\n\n    private boolean resolvePermission(PermissionCollection pc, String permission) {\n        org.uberfire.security.authz.Permission resolvedPermission = pc.get(permission);\n        if (resolvedPermission != null) {\n            AuthorizationResult result = resolvedPermission.getResult();\n            return result.equals(AuthorizationResult.ACCESS_GRANTED);\n        }\n        return false;\n    }\n\n    private void getPermissions(ResourcePermission permission, ResourceAction resourceAction, PermissionType permissionType) {\n        if (resourceAction.equals(READ)) {\n            permission.setRead(permissionType);\n        }\n        if (resourceAction.equals(CREATE)) {\n            permission.setCreate(permissionType);\n        }\n        if (resourceAction.equals(BUILD)) {\n            permission.setBuild(permissionType);\n        }\n        if (resourceAction.equals(UPDATE)) {\n            permission.setUpdate(permissionType);\n        }\n        if (resourceAction.equals(DELETE)) {\n            permission.setDelete(permissionType);\n        }\n    }\n\n    private PermissionType getPermissionsType(PermissionCollection pc, ResourceType resourceType, ResourceAction resourceAction) {\n\n        PermissionType permissionType = new PermissionType();\n        List<String> exceptions = new ArrayList<>();\n\n        String permissionName = resourceType.getName() + \".\" + resourceAction.getName();\n        org.uberfire.security.authz.Permission parentPermission = pc.get(permissionName);\n\n        if (parentPermission != null) {\n            AuthorizationResult result = parentPermission.getResult();\n            permissionType.setAccess(result.equals(AuthorizationResult.ACCESS_GRANTED));\n\n            for (org.uberfire.security.authz.Permission permission : pc.collection()) {\n                if (parentPermission.impliesName(permission) && !parentPermission.impliesResult(permission)) {\n                    String resourceId = permissionManager.resolveResourceId(permission);\n                    exceptions.add(resourceId);\n                }\n            }\n            permissionType.setExceptions(exceptions);\n        }\n        return permissionType;\n    }\n\n    private PermissionCollection generatePermissionCollection(PermissionCollection pc, UpdateSettingRequest permissionRequest) {\n        if (permissionRequest.getPages() != null) {\n            addToCollection(pc, ActivityResourceType.PERSPECTIVE, permissionRequest.getPages());\n        }\n        if (permissionRequest.getSpaces() != null) {\n            addToCollection(pc, OrganizationalUnit.RESOURCE_TYPE, permissionRequest.getSpaces());\n        }\n        if (permissionRequest.getProject() != null) {\n            addToCollection(pc, Repository.RESOURCE_TYPE, permissionRequest.getProject());\n        }\n        if (permissionRequest.getEditor() != null) {\n            addToCollection(pc, ActivityResourceType.EDITOR, permissionRequest.getEditor());\n        }\n        if (permissionRequest.getWorkbench() != null) {\n            addWorkBenchPermissions(pc, permissionRequest.getWorkbench());\n        }\n        return pc;\n    }\n\n    private void addWorkBenchPermissions(PermissionCollection pc, WorkbenchPermission permission) {\n\n        if (permission.getAccessDataTransfer() != null) {\n            pc.add(permissionManager.createPermission(ACCESS_DATA_TRANSFER, permission.getAccessDataTransfer()));\n        }\n        if (permission.getEditDataObject() != null) {\n            pc.add(permissionManager.createPermission(EDIT_SOURCES, permission.getEditDataObject()));\n        }\n        if (permission.getEditGlobalPreferences() != null) {\n            pc.add(permissionManager.createPermission(EDIT_GLOBAL_PREFERENCES, permission.getEditGlobalPreferences()));\n        }\n        if (permission.getEditProfilePreferences() != null) {\n            pc.add(permissionManager.createPermission(EDIT_PROFILE_PREFERENCES, permission.getEditProfilePreferences()));\n        }\n        if (permission.getJarDownload() != null) {\n            pc.add(permissionManager.createPermission(JAR_DOWNLOAD, permission.getJarDownload()));\n        }\n        if (permission.getPlannerAvailable() != null) {\n            pc.add(permissionManager.createPermission(PLANNER_AVAILABLE, permission.getPlannerAvailable()));\n        }\n        if (permission.getEditGuidedDecisionTableColumns() != null) {\n            pc.add(permissionManager.createPermission(GUIDED_DECISION_TABLE_EDIT_COLUMNS, permission.getEditGuidedDecisionTableColumns()));\n        }\n    }\n\n    private void addToCollection(PermissionCollection pc, ResourceType resourceType, Permission permission) {\n\n        if (permission.isRead() != null && permissionValidator.isPermissionAllowed(resourceType, READ) && permissionValidator.satisfyDependancies(pc, resourceType, READ)) {\n            pc.add(permissionManager.createPermission(resourceType, READ, permission.isRead()));\n        }\n        if (permission.isCreate() != null && permissionValidator.isPermissionAllowed(resourceType, CREATE) && permissionValidator.satisfyDependancies(pc, resourceType, CREATE)) {\n            pc.add(permissionManager.createPermission(resourceType, CREATE, permission.isCreate()));\n        }\n        if (permission.isUpdate() != null && permissionValidator.isPermissionAllowed(resourceType, UPDATE) && permissionValidator.satisfyDependancies(pc, resourceType, UPDATE)) {\n            pc.add(permissionManager.createPermission(resourceType, UPDATE, permission.isUpdate()));\n        }\n        if (permission.isDelete() != null && permissionValidator.isPermissionAllowed(resourceType, DELETE) && permissionValidator.satisfyDependancies(pc, resourceType, DELETE)) {\n            pc.add(permissionManager.createPermission(resourceType, DELETE, permission.isDelete()));\n        }\n        if (permission.isBuild() != null && permissionValidator.isPermissionAllowed(resourceType, BUILD) && permissionValidator.satisfyDependancies(pc, resourceType, BUILD)) {\n            pc.add(permissionManager.createPermission(resourceType, BUILD, permission.isBuild()));\n        }\n        if (permission.getExceptions() != null) {\n            addExceptions(pc, resourceType, permission.getExceptions());\n        }\n    }\n\n    private void addExceptions(PermissionCollection pc, ResourceType resourceType, List<PermissionException> exceptions) {\n        for (PermissionException exception : exceptions) {\n            Permission permission = exception.getPermissions();\n            String resourceTypeName = resourceType.getName();\n            if (permissionValidator.isValidResourceType(resourceType, exception.getResourceName())) {\n                if (permission.isRead() != null && permissionValidator.isPermissionAllowed(resourceType, READ)) {\n                    final String permissionName = resourceTypeName + \".\" + READ.getName() + \".\" + exception.getResourceName();\n                    pc.add(permissionManager.createPermission(permissionName, permission.isRead()));\n                } else if (permission.isCreate() != null && permissionValidator.isPermissionAllowed(resourceType, CREATE)) {\n                    final String permissionName = resourceTypeName + \".\" + CREATE.getName() + \".\" + exception.getResourceName();\n                    pc.add(permissionManager.createPermission(permissionName, permission.isCreate()));\n                } else if (permission.isUpdate() != null && permissionValidator.isPermissionAllowed(resourceType, UPDATE)) {\n                    final String permissionName = resourceTypeName + \".\" + UPDATE.getName() + \".\" + exception.getResourceName();\n                    pc.add(permissionManager.createPermission(permissionName, permission.isUpdate()));\n                } else if (permission.isDelete() != null && permissionValidator.isPermissionAllowed(resourceType, DELETE)) {\n                    final String permissionName = resourceTypeName + \".\" + DELETE.getName() + \".\" + exception.getResourceName();\n                    pc.add(permissionManager.createPermission(permissionName, permission.isDelete()));\n                }\n            }\n        }\n    }\n\n    private User createUserObject(NewUser newUser) {\n        final Collection<Role> userRoles = new HashSet<>();\n        final Collection<Group> userGroups = new HashSet<>();\n        if (newUser.getRoles() != null) {\n            for (final String roleName : newUser.getRoles()) {\n                Role role = new RoleImpl(roleName);\n                userRoles.add(role);\n            }\n        }\n        if (newUser.getGroups() != null) {\n            for (final String groupName : newUser.getGroups()) {\n                Group group = new GroupImpl(groupName);\n                userGroups.add(group);\n            }\n        }\n        return new UserImpl(newUser.getName(), userRoles, userGroups);\n    }\n\n    private boolean areUsersValid(List<String> users) {\n        if (users != null) {\n            try {\n                for (final String username : users) {\n                    User user = userManagerService.get(username);\n                    if (user == null) {\n                        return false;\n                    }\n                }\n            } catch (UserNotFoundException e) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    private boolean areGroupsValid(List<String> groups) {\n        if (groups != null) {\n            for (final String groupName : groups) {\n                try {\n                    Group group = groupManagerService.get(groupName);\n                    if (group == null) {\n                        return false;\n                    }\n                } catch (GroupNotFoundException e) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n\n    private boolean areRolesValid(List<String> roles) {\n        if (roles != null) {\n            for (final String roleName : roles) {\n                Role role = roleManagerService.get(roleName);\n                if (role == null) {\n                    return false;\n                }\n            }\n        }\n        return true;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/AbstractJobCommand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.async.DescriptiveRunnable;\n\npublic abstract class AbstractJobCommand implements DescriptiveRunnable {\n\n    protected static final Logger logger = LoggerFactory.getLogger(AbstractJobCommand.class);\n\n    public static final String JOB_REQUEST_KEY = \"JobRequest\";\n\n    protected final JobRequestHelper jobRequestHelper;\n\n    protected final JobResultManager jobResultManager;\n\n    protected final Map<String, Object> context;\n\n    public AbstractJobCommand(final JobRequestHelper jobRequestHelper,\n                              final JobResultManager jobResultManager,\n                              final Map<String, Object> context) {\n        this.jobRequestHelper = jobRequestHelper;\n        this.jobResultManager = jobResultManager;\n        this.context = context;\n    }\n\n    // for command implementations\n\n    protected JobRequestHelper getHelper() throws Exception {\n        return jobRequestHelper;\n    }\n\n    protected JobRequest getJobRequest() {\n        JobRequest jobRequest = (JobRequest) context.get(JOB_REQUEST_KEY);\n        if (jobRequest != null) {\n            return jobRequest;\n        }\n\n        throw new RuntimeException(\"Unable to find JobRequest\");\n    }\n\n    // private helper methods\n\n    private JobResultManager getJobManager() throws Exception {\n        return jobResultManager;\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Command class \" + this.getClass().getName();\n    }\n\n    @Override\n    public void run() {\n        try {\n            // approval\n            JobRequest request = getJobRequest();\n            JobResult result = createResult(request);\n\n            // save job\n            logger.debug(\"--- job {} ---, status: {}\",\n                         result.getJobId(),\n                         result.getStatus());\n            JobResultManager jobMgr = getJobManager();\n            result.setLastModified(System.currentTimeMillis());\n            jobMgr.putJob(result);\n\n            // if approved, process\n            if (JobStatus.APPROVED.equals(request.getStatus())) {\n                try {\n                    result = internalExecute(request);\n                } catch (Exception e) {\n                    result.setStatus(JobStatus.SERVER_ERROR);\n                    result.setResult(\"Request failed because of \" + e.getClass().getSimpleName() + \": \" + e.getMessage());\n                    logger.error(\"{} [{}] failed because of thrown {}: {}\",\n                                 request.getClass().getSimpleName(),\n                                 request.getJobId(),\n                                 e.getClass().getSimpleName(),\n                                 e.getMessage(),\n                                 e);\n                }\n\n                // save job\n                logger.debug(\"--- job {} ---, status: {}\",\n                             result.getJobId(),\n                             result.getStatus());\n                result.setLastModified(System.currentTimeMillis());\n                jobMgr.putJob(result);\n            }\n        } catch (Throwable e) {\n            logger.error(\"Error executing job class: {}, error: {}\",\n                         this.getClass().getName(),\n                         e.getMessage());\n            throw new RuntimeException(e);\n        }\n    }\n\n    private JobResult createResult(JobRequest jobRequest) {\n        final JobResult jobResult = new JobResult();\n        jobResult.setJobId(jobRequest.getJobId());\n        jobResult.setStatus(jobRequest.getStatus());\n        return jobResult;\n    }\n\n    protected abstract JobResult internalExecute(JobRequest request) throws Exception;\n}\n\n\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/AddBranchCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.AddBranchJobRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class AddBranchCmd extends AbstractJobCommand {\n\n    public AddBranchCmd(final JobRequestHelper jobRequestHelper,\n                        final JobResultManager jobResultManager,\n                        final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(final JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        AddBranchJobRequest jobRequest = (AddBranchJobRequest) request;\n        JobResult result = null;\n\n        try {\n            result = helper.addBranch(jobRequest.getJobId(),\n                                      jobRequest.getSpaceName(),\n                                      jobRequest.getProjectName(),\n                                      jobRequest.getNewBranchName(),\n                                      jobRequest.getBaseBranchName(),\n                                      jobRequest.getUserIdentifier());\n\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----addBranch--- , spaceName: {}, projectName: {}, newBranchName: {}, baseBranchName: {}, status: [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getProjectName(),\n                         jobRequest.getNewBranchName(),\n                         jobRequest.getBaseBranchName(),\n                         status);\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/AddProjectToSpaceCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.AddProjectToSpaceRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class AddProjectToSpaceCmd extends AbstractJobCommand {\n\n    public AddProjectToSpaceCmd(final JobRequestHelper jobRequestHelper,\n                                final JobResultManager jobResultManager,\n                                final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(final JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        AddProjectToSpaceRequest jobRequest = (AddProjectToSpaceRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.addProjectToSpace(jobRequest.getJobId(),\n                                              jobRequest.getSpaceName(),\n                                              jobRequest.getProjectName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----addProjectToSpace--- , Space name: {}, Project name: {} [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getProjectName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/CloneRepositoryCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.CloneProjectJobRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class CloneRepositoryCmd extends AbstractJobCommand {\n\n    public CloneRepositoryCmd(final JobRequestHelper jobRequestHelper,\n                              final JobResultManager jobResultManager,\n                              final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        CloneProjectJobRequest jobRequest = (CloneProjectJobRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.cloneProject(jobRequest.getJobId(),\n                                         jobRequest.getSpaceName(),\n                                         jobRequest.getCloneProjectRequest());\n        } finally {\n            logger.debug(\"----cloneProject--- , repository name: {} [{}] [{}]\",\n                         jobRequest.getCloneProjectRequest().getName(),\n                         getJobStatus(result),\n                         getResult(result));\n        }\n        return result;\n    }\n\n    private String getResult(JobResult result) {\n        return result != null ? result.getResult() : \"\";\n    }\n\n    private JobStatus getJobStatus(JobResult result) {\n        return result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/CompileProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.CompileProjectRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class CompileProjectCmd extends AbstractJobCommand {\n\n    public CompileProjectCmd(final JobRequestHelper jobRequestHelper,\n                             final JobResultManager jobResultManager,\n                             final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        CompileProjectRequest jobRequest = (CompileProjectRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.compileProject(jobRequest.getJobId(),\n                                           jobRequest.getSpaceName(),\n                                           jobRequest.getProjectName(),\n                                           jobRequest.getBranchName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----compileProject--- , project name: {}, branch name: {} [{}]\",\n                         jobRequest.getProjectName(),\n                         jobRequest.getBranchName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/CreateProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Locale;\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.CreateProjectJobRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.structure.backend.LocaleContext;\n\npublic class CreateProjectCmd extends AbstractJobCommand {\n\n    public CreateProjectCmd(final JobRequestHelper jobRequestHelper,\n                            final JobResultManager jobResultManager,\n                            final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(final JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        CreateProjectJobRequest jobRequest = (CreateProjectJobRequest) request;\n        LocaleContext.set((Locale) context.get(\"acceptLanguage\"));\n\n        JobResult result = null;\n        try {\n            result = helper.createProject(jobRequest.getJobId(),\n                                          jobRequest.getSpaceName(),\n                                          jobRequest.getProjectName(),\n                                          jobRequest.getProjectGroupId(),\n                                          jobRequest.getProjectVersion(),\n                                          jobRequest.getDescription(),\n                                          jobRequest.getTemplateId());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            String groupId = jobRequest.getProjectGroupId() == null ? jobRequest.getProjectName() : jobRequest.getProjectGroupId();\n            String version = jobRequest.getProjectVersion() == null ? \"1.0\" : jobRequest.getProjectVersion();\n            logger.debug(\"-----createProject--- , SpaceName: {}, project : {}:{}:{} [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getProjectName(),\n                         groupId,\n                         version,\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/CreateSpaceCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.SpaceRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class CreateSpaceCmd extends AbstractJobCommand {\n\n    public CreateSpaceCmd(final JobRequestHelper jobRequestHelper,\n                          final JobResultManager jobResultManager,\n                          final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        SpaceRequest jobRequest = (SpaceRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.createSpace(jobRequest.getJobId(),\n                                        jobRequest.getSpaceName(),\n                                        jobRequest.getDescription(),\n                                        jobRequest.getOwner(),\n                                        jobRequest.getDefaultGroupId());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----createSpace--- , Space name: {}, Space owner: {} [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getOwner(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/DeleteProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.DeleteProjectRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class DeleteProjectCmd extends AbstractJobCommand {\n\n    public DeleteProjectCmd(final JobRequestHelper jobRequestHelper,\n                            final JobResultManager jobResultManager,\n                            final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        DeleteProjectRequest jobRequest = (DeleteProjectRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.deleteProject(jobRequest.getJobId(),\n                                          jobRequest.getSpaceName(),\n                                          jobRequest.getProjectName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----deleteProject--- , project : {} [{}]\",\n                         jobRequest.getProjectName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/DeployProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.DeployProjectRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class DeployProjectCmd extends AbstractJobCommand {\n\n    public DeployProjectCmd(final JobRequestHelper jobRequestHelper,\n                            final JobResultManager jobResultManager,\n                            final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        DeployProjectRequest jobRequest = (DeployProjectRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.deployProject(jobRequest.getJobId(),\n                                          jobRequest.getSpaceName(),\n                                          jobRequest.getProjectName(),\n                                          jobRequest.getBranchName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----deployProject--- , project name: {}, branch name: {} [{}]\",\n                         jobRequest.getProjectName(),\n                         jobRequest.getBranchName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/InstallProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.InstallProjectRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class InstallProjectCmd extends AbstractJobCommand {\n\n    public InstallProjectCmd(final JobRequestHelper jobRequestHelper,\n                             final JobResultManager jobResultManager,\n                             final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        InstallProjectRequest jobRequest = (InstallProjectRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.installProject(jobRequest.getJobId(),\n                                           jobRequest.getSpaceName(),\n                                           jobRequest.getProjectName(),\n                                           jobRequest.getBranchName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----installProject--- , ouName: {}, project name: {}, branch name: {} [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getProjectName(),\n                         jobRequest.getBranchName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/RemoveBranchCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.RemoveBranchJobRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\n\npublic class RemoveBranchCmd extends AbstractJobCommand {\n\n    public RemoveBranchCmd(final JobRequestHelper jobRequestHelper,\n                           final JobResultManager jobResultManager,\n                           final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(final JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        RemoveBranchJobRequest jobRequest = (RemoveBranchJobRequest) request;\n        JobResult result = null;\n\n        try {\n            result = helper.removeBranch(jobRequest.getJobId(),\n                                         jobRequest.getSpaceName(),\n                                         jobRequest.getProjectName(),\n                                         jobRequest.getBranchName(),\n                                         jobRequest.getUserIdentifier());\n\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----removeBranch--- , spaceName: {}, projectName: {}, branchName: {}, status: [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getProjectName(),\n                         jobRequest.getBranchName(),\n                         status);\n        }\n\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/RemoveSpaceCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.RemoveSpaceRequest;\n\npublic class RemoveSpaceCmd extends AbstractJobCommand {\n\n    public RemoveSpaceCmd(final JobRequestHelper jobRequestHelper,\n                          final JobResultManager jobResultManager,\n                          final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        RemoveSpaceRequest jobRequest = (RemoveSpaceRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.removeSpace(jobRequest.getJobId(),\n                                        jobRequest.getSpaceName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----removeSpace--- , Space name: {}\",\n                         jobRequest.getSpaceName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/TestProjectCmd.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.TestProjectRequest;\n\npublic class TestProjectCmd extends AbstractJobCommand {\n\n    public TestProjectCmd(final JobRequestHelper jobRequestHelper,\n                          final JobResultManager jobResultManager,\n                          final Map<String, Object> context) {\n        super(jobRequestHelper,\n              jobResultManager,\n              context);\n    }\n\n    @Override\n    public JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        TestProjectRequest jobRequest = (TestProjectRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.testProject(jobRequest.getJobId(),\n                                        jobRequest.getSpaceName(),\n                                        jobRequest.getProjectName(),\n                                        jobRequest.getBranchName());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----testProject--- , project name: {}, branch name: {} [{}]\",\n                         jobRequest.getProjectName(),\n                         jobRequest.getBranchName(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/java/org/guvnor/rest/backend/cmd/UpdateSpaceCmd.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.backend.cmd;\n\nimport java.util.Map;\n\nimport org.guvnor.rest.backend.JobRequestHelper;\nimport org.guvnor.rest.backend.JobResultManager;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.SpaceRequest;\n\npublic class UpdateSpaceCmd extends AbstractJobCommand {\n\n    public UpdateSpaceCmd(JobRequestHelper jobRequestHelper, JobResultManager jobResultManager, Map<String, Object> context) {\n        super(jobRequestHelper, jobResultManager, context);\n    }\n\n    @Override\n    protected JobResult internalExecute(JobRequest request) throws Exception {\n        JobRequestHelper helper = getHelper();\n        SpaceRequest jobRequest = (SpaceRequest) request;\n\n        JobResult result = null;\n        try {\n            result = helper.updateSpace(jobRequest.getJobId(),\n                                        jobRequest.getSpaceName(),\n                                        jobRequest.getDescription(),\n                                        jobRequest.getOwner(),\n                                        jobRequest.getDefaultGroupId());\n        } finally {\n            JobStatus status = result != null ? result.getStatus() : JobStatus.SERVER_ERROR;\n            logger.debug(\"-----updateSpace--- , Space name: {}, Space owner: {} [{}]\",\n                         jobRequest.getSpaceName(),\n                         jobRequest.getOwner(),\n                         status);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/m2repo/preferences/ArtifactRepositoryPreferenceTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\npackage org.guvnor.m2repo.preferences;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class ArtifactRepositoryPreferenceTest {\n\n    @Test\n    public void defaultValue() {\n        ArtifactRepositoryPreference artifactRepositoryPreference = new ArtifactRepositoryPreference();\n        artifactRepositoryPreference = artifactRepositoryPreference.defaultValue(artifactRepositoryPreference);\n\n        assertEquals(artifactRepositoryPreference.getGlobalM2RepoDir(), \"repositories/kie/global\");\n        assertEquals(artifactRepositoryPreference.getWorkspaceM2RepoDir(), \"repositories/kie/workspaces\");\n        assertTrue(artifactRepositoryPreference.isGlobalM2RepoDirEnabled());\n        assertFalse(artifactRepositoryPreference.isWorkspaceM2RepoDirEnabled());\n        assertTrue(artifactRepositoryPreference.isDistributionManagementM2RepoDirEnabled());\n    }\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/JobRequestHelperCreateModuleTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.net.URI;\nimport java.util.HashSet;\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.MavenRepositoryMetadata;\nimport org.guvnor.common.services.project.model.MavenRepositorySource;\nimport org.guvnor.common.services.project.model.POM;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.BaseArchetypeService;\nimport org.guvnor.common.services.project.service.DeploymentMode;\nimport org.guvnor.common.services.project.service.GAVAlreadyExistsException;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\nimport org.uberfire.spaces.Space;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JobRequestHelperCreateModuleTest {\n\n    public SimpleFileSystemProvider fileSystemProvider;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    private BaseArchetypeService archetypeService;\n\n    @InjectMocks\n    private JobRequestHelper jobRequestHelper = new JobRequestHelper();\n\n    @Before\n    public void setUp() throws Exception {\n        fileSystemProvider = new SimpleFileSystemProvider();\n\n        final Path root = fileSystemProvider.getPath(URI.create(\"default://main@myRepository/\"));\n\n        OrganizationalUnit ou = mock(OrganizationalUnit.class);\n        when(organizationalUnitService.getOrganizationalUnit(any())).thenReturn(ou);\n    }\n\n    @Test\n    public void testOrganizationalUnitDoesNotExist() throws Exception {\n\n        when(organizationalUnitService.getOrganizationalUnit(\"spaceName\")).thenReturn(null);\n\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                                                                   \"spaceName\",\n                                                                   \"projectName\",\n                                                                   \"projectGroupId\",\n                                                                   \"projectVersion\",\n                                                                   \"projectDescription\");\n\n        assertEquals(\"jobId\",\n                     jobResult.getJobId());\n        assertEquals(JobStatus.RESOURCE_NOT_EXIST,\n                     jobResult.getStatus());\n        assertEquals(\"Space [spaceName] does not exist\",\n                     jobResult.getResult());\n    }\n\n    @Test\n    public void testRepositoryDoesExist() throws Exception {\n        when(workspaceProjectService.newProject(any(OrganizationalUnit.class),\n                                                any(POM.class)))\n                .thenReturn(mock(WorkspaceProject.class));\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                                                                   \"spaceName\",\n                                                                   \"projectName\",\n                                                                   \"projectGroupId\",\n                                                                   \"projectVersion\",\n                                                                   \"projectDescription\");\n\n        assertEquals(\"jobId\",\n                     jobResult.getJobId());\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n        assertNotNull(jobResult.getResult());\n    }\n\n    @Test\n    public void testNullWorkspaceProject() throws Exception {\n        when(workspaceProjectService.newProject(any(OrganizationalUnit.class),\n                                                any(POM.class)))\n                .thenReturn(null);\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                                                                   \"spaceName\",\n                                                                   \"projectName\",\n                                                                   \"projectGroupId\",\n                                                                   \"projectVersion\",\n                                                                   \"projectDescription\");\n\n        assertEquals(\"jobId\",\n                     jobResult.getJobId());\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n        assertNull(jobResult.getResult());\n    }\n\n    @Test\n    public void testNewProjectWhenGAVAlreadyExists() throws Exception {\n\n        final HashSet<MavenRepositoryMetadata> repositories = new HashSet<>();\n        repositories.add(new MavenRepositoryMetadata(\"id\",\n                                                     \"url\",\n                                                     MavenRepositorySource.LOCAL));\n\n        doThrow(new GAVAlreadyExistsException(new GAV(\"projectGroupId:projectName:projectVersion\"),\n                                              repositories))\n                .when(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                          any(POM.class));\n\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                                                                   \"myRepository\",\n                                                                   \"projectName\",\n                                                                   \"projectGroupId\",\n                                                                   \"projectVersion\",\n                                                                   \"projectDescription\");\n\n        assertEquals(\"jobId\",\n                     jobResult.getJobId());\n        assertEquals(JobStatus.DUPLICATE_RESOURCE,\n                     jobResult.getStatus());\n        assertEquals(\"Project's GAV [projectGroupId:projectName:projectVersion] already exists at [id : url : LOCAL ]\",\n                     jobResult.getResult());\n    }\n\n    @Test\n    public void testNewProjectWhenFileAlreadyExists() throws Exception {\n\n        doThrow(new FileAlreadyExistsException(\"myProject\"))\n                .when(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                          any(POM.class));\n\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                                                                   \"myOrganizationalUnit\",\n                                                                   \"myProject\",\n                                                                   \"projectGroupId\",\n                                                                   \"projectVersion\",\n                                                                   \"projectDescription\");\n\n        assertEquals(\"jobId\",\n                     jobResult.getJobId());\n        assertEquals(JobStatus.DUPLICATE_RESOURCE,\n                     jobResult.getStatus());\n        assertEquals(\"Project [myProject] already exists\",\n                     jobResult.getResult());\n    }\n\n    @Test\n    public void testProjectWithTemplates() {\n\n        when(workspaceProjectService.newProject(any(OrganizationalUnit.class),\n                any(POM.class),\n                eq(DeploymentMode.VALIDATED),\n                eq(null),\n                any(Repository.class))).thenReturn(mock(WorkspaceProject.class));\n        when(archetypeService.getTemplateRepository(any(),\n                any())).thenReturn(mock(Repository.class));\n\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                \"myOrganizationalUnit\",\n                \"myProject\",\n                \"projectGroupId\",\n                \"projectVersion\",\n                \"projectDescription\",\n                \"org.kie.kie.drools.archetype.7.55.0.SNAPSHOT.TEMPLATE\");\n\n        assertEquals(\"jobId\",\n                jobResult.getJobId());\n        assertEquals(JobStatus.SUCCESS,\n                jobResult.getStatus());\n        assertNotNull(jobResult.getResult());\n    }\n\n    @Test\n    public void testProjectWithTemplatesNotAvailable() {\n\n        doThrow(new IllegalArgumentException(\"Template is not available\"))\n                .when(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                            any(POM.class),\n                                                            eq(DeploymentMode.VALIDATED),\n                                                            eq(null),\n                                                            any(Repository.class));\n        when(archetypeService.getTemplateRepository(any(),\n                                                    any())).thenReturn(mock(Repository.class));\n        final JobResult jobResult = jobRequestHelper.createProject(\"jobId\",\n                \"myOrganizationalUnit\",\n                \"myProject\",\n                \"projectGroupId\",\n                \"projectVersion\",\n                \"projectDescription\",\n                \"org.kie.kie.drools.archetype.7.55.0.SNAPSHOT.TEMPLATE\");\n        assertEquals(\"jobId\",\n                jobResult.getJobId());\n        assertEquals(JobStatus.FAIL,\n                jobResult.getStatus());\n        assertEquals(jobResult.getResult(),\n                \"Template is not available\");\n    }\n\n    @Test\n    public void testWeAreUsingCorrectGAV() throws Exception {\n\n        jobRequestHelper.createProject(\"jobId\",\n                                       \"myOrganizationalUnit\",\n                                       \"myProject\",\n                                       \"projectGroupId\",\n                                       \"projectVersion\",\n                                       \"projectDescription\");\n\n        ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);\n        verify(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                   pomArgumentCaptor.capture());\n\n        final POM pom = pomArgumentCaptor.getValue();\n        assertEquals(\"projectGroupId\",\n                     pom.getGav().getGroupId());\n        assertEquals(\"myProject\",\n                     pom.getGav().getArtifactId());\n        assertEquals(\"projectVersion\",\n                     pom.getGav().getVersion());\n        assertEquals(\"myProject\",\n                     pom.getName());\n        assertEquals(\"projectDescription\",\n                     pom.getDescription());\n    }\n\n    @Test\n    public void testProjectGroupNull() throws Exception {\n        jobRequestHelper.createProject(\"jobId\",\n                                       \"myOrganizationalUnit\",\n                                       \"myProject\",\n                                       null,\n                                       \"projectVersion\",\n                                       \"projectDescription\");\n\n        ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);\n        verify(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                   pomArgumentCaptor.capture());\n\n        final POM pom = pomArgumentCaptor.getValue();\n        assertEquals(\"myProject\",\n                     pom.getGav().getGroupId());\n    }\n\n    @Test\n    public void testProjectGroupEmpty() throws Exception {\n        jobRequestHelper.createProject(\"jobId\",\n                                       \"myOrganizationalUnit\",\n                                       \"myProject\",\n                                       \"             \",\n                                       \"projectVersion\",\n                                       \"projectDescription\");\n\n        ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);\n        verify(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                   pomArgumentCaptor.capture());\n\n        final POM pom = pomArgumentCaptor.getValue();\n        assertEquals(\"myProject\",\n                     pom.getGav().getGroupId());\n    }\n\n    @Test\n    public void testProjectVersionNull() throws Exception {\n\n        jobRequestHelper.createProject(\"jobId\",\n                                       \"myOrganizationalUnit\",\n                                       \"myProject\",\n                                       \"projectGroupId\",\n                                       null,\n                                       \"projectDescription\");\n\n        ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);\n        verify(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                   pomArgumentCaptor.capture());\n\n        final POM pom = pomArgumentCaptor.getValue();\n        assertEquals(\"1.0\",\n                     pom.getGav().getVersion());\n    }\n\n    @Test\n    public void testProjectVersionEmpty() throws Exception {\n\n        jobRequestHelper.createProject(\"jobId\",\n                                       \"myOrganizationalUnit\",\n                                       \"myProject\",\n                                       \"projectGroupId\",\n                                       \"               \",\n                                       \"projectDescription\");\n\n        ArgumentCaptor<POM> pomArgumentCaptor = ArgumentCaptor.forClass(POM.class);\n        verify(workspaceProjectService).newProject(any(OrganizationalUnit.class),\n                                                   pomArgumentCaptor.capture());\n\n        final POM pom = pomArgumentCaptor.getValue();\n        assertEquals(\"1.0\",\n                     pom.getGav().getVersion());\n    }\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/JobRequestHelperTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.rest.backend;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.common.services.project.builder.model.BuildMessage;\nimport org.guvnor.common.services.project.builder.model.BuildResults;\nimport org.guvnor.common.services.project.builder.service.BuildService;\nimport org.guvnor.common.services.project.model.GAV;\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.common.services.shared.test.Failure;\nimport org.guvnor.common.services.shared.test.TestResultMessage;\nimport org.guvnor.common.services.shared.test.TestRunnerService;\nimport org.guvnor.rest.client.CloneProjectRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class JobRequestHelperTest {\n\n    @InjectMocks\n    JobRequestHelper helper;\n    @Mock\n    Repository repository;\n    @Captor\n    ArgumentCaptor<Event<TestResultMessage>> captor;\n    @Mock\n    private TestRunnerService testService;\n    @Mock\n    private BuildService buildService;\n    @Mock\n    private RepositoryService repositoryService;\n    @Mock\n    private ModuleService<MyModule> moduleService;\n    @Mock\n    private WorkspaceProjectService workspaceProjectService;\n    @Mock\n    private WorkspaceProject workspaceProject;\n    @Mock\n    private SpacesAPI spaces;\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n    @Mock\n    private SessionInfo sessionInfo;\n    private Space space = new Space(\"space\");\n\n    @Before\n    public void setUp() throws Exception {\n        when(workspaceProjectService.resolveProject(eq(space), eq(\"project\"))).thenReturn(workspaceProject);\n        when(workspaceProjectService.resolveProject(eq(space), eq(\"project\"), any())).thenReturn(workspaceProject);\n        when(spaces.getSpace(eq(\"space\"))).thenReturn(space);\n    }\n\n    @Captor\n    ArgumentCaptor<RepositoryEnvironmentConfigurations> repositoryEnvironmentConfigurationsCaptor;\n\n    @Test\n    public void cloneProject() throws Exception {\n\n        doReturn(mock(OrganizationalUnit.class)).when(organizationalUnitService).getOrganizationalUnit(\"space\");\n\n        final CloneProjectRequest cloneProjectRequest = new CloneProjectRequest();\n        cloneProjectRequest.setName(\"myName\");\n        helper.cloneProject(\"jobId\",\n                            \"space\",\n                            cloneProjectRequest);\n\n        verify(repositoryService).createRepository(\n                any(),\n                eq(\"git\"),\n                eq(\"myName\"),\n                repositoryEnvironmentConfigurationsCaptor.capture()\n        );\n        RepositoryEnvironmentConfigurations config = repositoryEnvironmentConfigurationsCaptor.getValue();\n        assertEquals(false, config.getMirror());\n        assertEquals(false, config.getInit());\n    }\n\n    @Test\n    public void resourceDoesNotExist() throws Exception {\n        final JobResult jobResult = helper.testProject(null,\n                                                       null,\n                                                       null,\n                                                       null);\n        assertEquals(JobStatus.RESOURCE_NOT_EXIST,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void projectDoesNotExist() throws Exception {\n\n        final JobResult jobResult = helper.testProject(null,\n                                                       space.getName(),\n                                                       \"project\",\n                                                       null);\n        assertEquals(JobStatus.RESOURCE_NOT_EXIST,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void allTestsPass() throws Exception {\n\n        whenProjectExists();\n\n        thenExpectMessageWithStatus(new TestResultMessage(\"JobRequestHelper\",\n                                                          10,\n                                                          1000,\n                                                          Collections.emptyList()),\n                                    JobStatus.SUCCESS);\n    }\n\n    @Test\n    public void testsFail() throws Exception {\n\n        whenProjectExists();\n\n        final ArrayList<Failure> failures = new ArrayList<>();\n        failures.add(new Failure());\n\n        thenExpectMessageWithStatus(new TestResultMessage(\"JobRequestHelper\",\n                                                          10,\n                                                          1000,\n                                                          failures),\n                                    JobStatus.FAIL);\n    }\n\n    @Test\n    public void testCompileProject() {\n        whenProjectExists();\n\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getMessages()).thenReturn(new ArrayList());\n        when(buildService.build(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.compileProject(null,\n                                                    space.getName(),\n                                                    \"project\",\n                                                    null);\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testCompileProjectFail() {\n        whenProjectExists();\n\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getMessages()).thenReturn(new ArrayList());\n        when(buildResults.getErrorMessages()).thenReturn(Arrays.asList(mock(BuildMessage.class)));\n        when(buildService.build(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.compileProject(null,\n                                                    space.getName(),\n                                                    \"project\",\n                                                    null);\n\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testInstallProject() {\n        whenProjectExists();\n\n        doReturn(mock(OrganizationalUnit.class)).when(organizationalUnitService).getOrganizationalUnit(\"space\");\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getGAV()).thenReturn(mock(GAV.class));\n        when(buildService.buildAndDeploy(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.installProject(\"job123\",\n                                                    space.getName(),\n                                                    \"project\",\n                                                    null);\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testInstallProjectFail() {\n        whenProjectExists();\n\n        doReturn(mock(OrganizationalUnit.class)).when(organizationalUnitService).getOrganizationalUnit(\"space\");\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getGAV()).thenReturn(mock(GAV.class));\n        when(buildResults.getErrorMessages()).thenReturn(Arrays.asList(mock(BuildMessage.class)));\n        when(buildService.buildAndDeploy(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.installProject(\"job123\",\n                                                    space.getName(),\n                                                    \"project\",\n                                                    null);\n\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testDeployProject() {\n        whenProjectExists();\n\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getGAV()).thenReturn(mock(GAV.class));\n        when(buildService.buildAndDeploy(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.deployProject(null,\n                                                   space.getName(),\n                                                   \"project\",\n                                                   null);\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testDeployProjectFail() {\n        whenProjectExists();\n\n        BuildResults buildResults = mock(BuildResults.class);\n        when(buildResults.getGAV()).thenReturn(mock(GAV.class));\n        when(buildResults.getErrorMessages()).thenReturn(Arrays.asList(mock(BuildMessage.class)));\n        when(buildService.buildAndDeploy(any())).thenReturn(buildResults);\n\n        JobResult jobResult = helper.deployProject(null,\n                                                   space.getName(),\n                                                   \"project\",\n                                                   null);\n\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testAddBranchProjectDoesNotExists() {\n        when(workspaceProjectService.resolveProject(eq(space), eq(\"project\"))).thenReturn(null);\n\n        JobResult jobResult = helper.addBranch(null,\n                                               space.getName(),\n                                               \"project\",\n                                               \"new-branch\",\n                                               \"ref-branch\",\n                                               \"user\");\n\n        assertEquals(JobStatus.RESOURCE_NOT_EXIST,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testAddBranchFail() {\n        doThrow(RuntimeException.class).when(workspaceProjectService).addBranch(any(), any(), any(), any());\n\n        JobResult jobResult = helper.addBranch(null,\n                                               space.getName(),\n                                               \"project\",\n                                               \"new-branch\",\n                                               \"ref-branch\",\n                                               \"user\");\n\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testAddBranch() {\n        JobResult jobResult = helper.addBranch(null,\n                                               space.getName(),\n                                               \"project\",\n                                               \"new-branch\",\n                                               \"ref-branch\",\n                                               \"user\");\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testCreateSpace() {\n        when(organizationalUnitService.isValidGroupId(\"org.space.newspace\")).thenReturn(true);\n        when(organizationalUnitService.createOrganizationalUnit(any(), any(), any(), any(), any())).thenReturn(mock(OrganizationalUnit.class));\n        JobResult jobResult = helper.createSpace(null,\n                                                 space.getName(),\n                                                 \"this is a new space\",\n                                                 \"admin\",\n                                                 \"org.space.newspace\");\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testUpdateSpace() {\n        when(organizationalUnitService.isValidGroupId(\"org.space.newspace\")).thenReturn(true);\n        when(organizationalUnitService.getOrganizationalUnit(space.getName())).thenReturn(mock(OrganizationalUnit.class));\n        when(organizationalUnitService.updateOrganizationalUnit(anyString(), anyString(), any(), anyString())).thenReturn(mock(OrganizationalUnit.class));\n        JobResult jobResult = helper.updateSpace(null,\n                                                 space.getName(),\n                                                 \"this is a new space\",\n                                                 \"admin\",\n                                                 \"org.space.newspace\");\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testRemoveSpace() {\n        JobResult jobResult = helper.removeSpace(null,\n                                                 space.getName());\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testRemoveBranchProjectDoesNotExists() {\n        when(workspaceProjectService.resolveProject(eq(space), eq(\"project\"))).thenReturn(null);\n\n        JobResult jobResult = helper.removeBranch(null,\n                                                  space.getName(),\n                                                  \"project\",\n                                                  \"new-branch\",\n                                                  \"user\");\n\n        assertEquals(JobStatus.RESOURCE_NOT_EXIST,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testRemoveBranchFail() {\n        doThrow(RuntimeException.class).when(workspaceProjectService).removeBranch(any(), any(), any());\n\n        JobResult jobResult = helper.removeBranch(null,\n                                                  space.getName(),\n                                                  \"project\",\n                                                  \"new-branch\",\n                                                  \"user\");\n\n        assertEquals(JobStatus.FAIL,\n                     jobResult.getStatus());\n    }\n\n    @Test\n    public void testRemoveBranch() {\n        JobResult jobResult = helper.removeBranch(null,\n                                                  space.getName(),\n                                                  \"project\",\n                                                  \"new-branch\",\n                                                  \"user\");\n\n        assertEquals(JobStatus.SUCCESS,\n                     jobResult.getStatus());\n    }\n\n    private void thenExpectMessageWithStatus(final TestResultMessage message,\n                                             final JobStatus status) {\n        final JobResult jobResult = helper.testProject(null,\n                                                       space.getName(),\n                                                       \"project\",\n                                                       null);\n\n        verify(testService).runAllTests(eq(\"JobRequestHelper\"),\n                                        any(),\n                                        captor.capture());\n\n        captor.getValue().fire(message);\n\n        assertEquals(status,\n                     jobResult.getStatus());\n    }\n\n    private void whenProjectExists() {\n        when(workspaceProject.getMainModule()).thenReturn(mock(MyModule.class));\n    }\n\n    class MyModule extends Module {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/PermissionsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.rest.backend;\n\nimport java.lang.reflect.Method;\nimport java.util.Set;\nimport javax.annotation.security.RolesAllowed;\nimport javax.ws.rs.DELETE;\nimport javax.ws.rs.GET;\nimport javax.ws.rs.POST;\nimport javax.ws.rs.PUT;\nimport javax.ws.rs.Path;\n\nimport org.junit.Test;\nimport org.reflections.Reflections;\nimport org.reflections.scanners.MethodAnnotationsScanner;\nimport org.reflections.scanners.SubTypesScanner;\nimport org.reflections.scanners.TypeAnnotationsScanner;\nimport org.reflections.util.ClasspathHelper;\n\nimport static org.junit.Assert.*;\n\npublic class PermissionsTest {\n\n    private static Reflections reflections = new Reflections(\n            ClasspathHelper.forPackage(\"org.kie.remote.services.rest\"),\n            new TypeAnnotationsScanner(),\n            new MethodAnnotationsScanner(),\n            new SubTypesScanner());\n\n    @Test\n    public void allRestMethodsHaveRolesAssigned() {\n        Set<Method> restMethods = reflections.getMethodsAnnotatedWith(Path.class);\n        restMethods.addAll(reflections.getMethodsAnnotatedWith(GET.class));\n        restMethods.addAll(reflections.getMethodsAnnotatedWith(POST.class));\n        restMethods.addAll(reflections.getMethodsAnnotatedWith(DELETE.class));\n        restMethods.addAll(reflections.getMethodsAnnotatedWith(PUT.class));\n\n        for (Method pathMethod : restMethods) {\n            RolesAllowed rolesAllowedAnno = pathMethod.getAnnotation(RolesAllowed.class);\n            assertNotNull(pathMethod.getDeclaringClass() + \".\" + pathMethod.getName() + \"(...) is missing a @RolesAllowed annotation!\",\n                          rolesAllowedAnno);\n\n            boolean basicRestRoleFound = false;\n            for (String role : rolesAllowedAnno.value()) {\n                if (PermissionConstants.REST_ROLE.equals(role)) {\n                    basicRestRoleFound = true;\n                    break;\n                }\n            }\n            assertTrue(pathMethod.getDeclaringClass() + \".\" + pathMethod.getName() + \"(...) is does not have the \" + PermissionConstants.REST_ROLE + \" role\",\n                       basicRestRoleFound);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/ProjectResourceJobTest.java",
    "content": "/*\n* Copyright 2018 Red Hat, Inc. and/or its affiliates.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n*      http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\npackage org.guvnor.rest.backend;\n\nimport java.util.Locale;\n\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Variant;\n\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.rest.client.CloneProjectRequest;\nimport org.guvnor.rest.client.CreateProjectRequest;\nimport org.guvnor.rest.client.AddBranchRequest;\nimport org.guvnor.rest.client.JobRequest;\nimport org.guvnor.rest.client.JobResult;\nimport org.guvnor.rest.client.JobStatus;\nimport org.guvnor.rest.client.Space;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ProjectResourceJobTest {\n\n    @Mock\n    private SpacesAPI spacesAPI;\n\n    @Mock\n    private JobResultManager jobManager;\n\n    @Mock\n    private JobRequestScheduler jobRequestObserver;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    private WorkspaceProjectService workspaceProjectService;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Captor\n    private ArgumentCaptor<JobResult> jobResultArgumentCaptor;\n\n    @InjectMocks\n    ProjectResource projectResource = new ProjectResource() {\n        protected Variant getDefaultVariant() {\n            return null;\n        }\n\n        protected void assertObjectExists(final Object o,\n                                          final String objectInfo,\n                                          final String objectName) {\n\n        }\n\n        protected Response createAcceptedStatusResponse(final JobRequest jobRequest) {\n            return null;\n        }\n    };\n\n    @Before\n    public void setup() {\n        User user = mock(User.class);\n        when(user.getIdentifier()).thenReturn(\"user\");\n        when(sessionInfo.getIdentity()).thenReturn(user);\n    }\n\n    @Test\n    public void cloneProject() throws Exception {\n\n        projectResource.cloneProject(\"spaceName\",\n                                     new CloneProjectRequest());\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void createProject() throws Exception {\n\n        projectResource.createProject(\"spaceName\",\n                                      Locale.ENGLISH,\n                                      new CreateProjectRequest());\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deleteProject() throws Exception {\n\n        projectResource.deleteProject(\"spaceName\",\n                                      \"projectName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void compileProject() throws Exception {\n\n        projectResource.compileProject(\"spaceName\",\n                                       \"projectName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void compileProjectNullBranch() throws Exception {\n\n        projectResource.compileProject(\"spaceName\",\n                                       \"projectName\",\n                                       null);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void compileProjectMainBranch() throws Exception {\n\n        projectResource.compileProject(\"spaceName\",\n                                       \"projectName\",\n                                       \"main\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void compileProjectNonExistingBranch() throws Exception {\n\n        projectResource.compileProject(\"spaceName\",\n                                       \"projectName\",\n                                       \"branch123\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void installProject() throws Exception {\n\n        projectResource.installProject(\"spaceName\",\n                                       \"projectName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void installProjectNullBranch() throws Exception {\n\n        projectResource.installProject(\"spaceName\",\n                                       \"projectName\",\n                                       null);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void installProjectMainBranch() throws Exception {\n\n        projectResource.installProject(\"spaceName\",\n                                       \"projectName\",\n                                       \"main\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void installProjectNonExistingBranch() throws Exception {\n\n        projectResource.installProject(\"spaceName\",\n                                       \"projectName\",\n                                       \"branch123\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void testProject() throws Exception {\n\n        projectResource.testProject(\"spaceName\",\n                                    \"projectName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void testProjectNullBranch() throws Exception {\n\n        projectResource.testProject(\"spaceName\",\n                                    \"projectName\",\n                                    null);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void testProjectMainBranch() throws Exception {\n\n        projectResource.testProject(\"spaceName\",\n                                    \"projectName\",\n                                    \"main\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void testProjectNonExisting() throws Exception {\n\n        projectResource.testProject(\"spaceName\",\n                                    \"projectName\",\n                                    \"branch123\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deployProject() throws Exception {\n\n        projectResource.deployProject(\"spaceName\",\n                                      \"projectName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deployProjectNullBranch() throws Exception {\n\n        projectResource.deployProject(\"spaceName\",\n                                      \"projectName\",\n                                      null);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deployProjectMainBranch() throws Exception {\n\n        projectResource.deployProject(\"spaceName\",\n                                      \"projectName\",\n                                      \"main\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deployProjectNonExistingBranch() throws Exception {\n\n        projectResource.deployProject(\"spaceName\",\n                                      \"projectName\",\n                                      \"branch123\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void createSpace() throws Exception {\n\n        projectResource.createSpace(new Space());\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void updateSpace() throws Exception {\n\n        projectResource.updateSpace(new Space());\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void updateSpaceWithXSSOwer() throws Exception {\n        String xssOwner = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        Space testedSpace = new Space();\n        testedSpace.setOwner(xssOwner);\n        projectResource.updateSpace(testedSpace);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void createSpaceWithXSSOwner() throws Exception {\n        String xssOwner = \"<img/src/onerror=alert(document.cookie)>\";\n        Space testedSpace = new Space();\n        testedSpace.setOwner(xssOwner);\n        projectResource.createSpace(testedSpace);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void deleteSpace() throws Exception {\n\n        projectResource.deleteSpace(\"spaceName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void addBranch() {\n        projectResource.addBranch(\"spaceName\",\n                                  \"projectName\",\n                                  new AddBranchRequest());\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void addBranchWithXSSName() {\n        AddBranchRequest addBranchRequest = new AddBranchRequest();\n        addBranchRequest.setNewBranchName(\"<img/src/onerror=alert(\\\"Xss\\\")>\");\n\n        projectResource.addBranch(\"spaceName\",\n                                  \"projectName\",\n                                  addBranchRequest);\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n\n    @Test\n    public void removeBranch() {\n        projectResource.removeBranch(\"spaceName\",\n                                     \"projectName\",\n                                     \"branchName\");\n\n        verify(jobManager).putJob(jobResultArgumentCaptor.capture());\n        assertEquals(JobStatus.ACCEPTED, jobResultArgumentCaptor.getValue().getStatus());\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/ResourceTypePermissionValidatorTest.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.kie.soup.commons.util.Lists;\nimport org.kie.soup.commons.util.Sets;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.workbench.model.AppFormerActivities;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.guvnor.structure.security.RepositoryAction.BUILD;\nimport static org.guvnor.structure.security.RepositoryAction.CREATE;\nimport static org.guvnor.structure.security.RepositoryAction.UPDATE;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.security.ResourceAction.READ;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ResourceTypePermissionValidatorTest {\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    private WorkspaceProjectService projectService;\n\n    @Mock\n    private AppFormerActivities appFormerActivities;\n\n    @Mock\n    private PermissionManager permissionManager;\n\n    @InjectMocks\n    private ResourceTypePermissionValidator permissionValidator;\n\n    @Test\n    public void testIsPermissionAllowed() {\n        assertTrue(permissionValidator.isPermissionAllowed(OrganizationalUnit.RESOURCE_TYPE, READ));\n        assertTrue(permissionValidator.isPermissionAllowed(ActivityResourceType.PERSPECTIVE, READ));\n\n        assertFalse(permissionValidator.isPermissionAllowed(ActivityResourceType.EDITOR, CREATE));\n        assertTrue(permissionValidator.isPermissionAllowed(Repository.RESOURCE_TYPE, BUILD));\n    }\n    @Test\n    public void testResourceDependancy() {\n        assertEquals( permissionValidator.resourceDependancy(OrganizationalUnit.RESOURCE_TYPE, UPDATE).get().getDependantAction(), READ);\n        assertNull(permissionValidator.resourceDependancy(ActivityResourceType.PERSPECTIVE, READ).get().getDependantAction());\n\n        assertEquals( permissionValidator.resourceDependancy(Repository.RESOURCE_TYPE, UPDATE).get().getDependantAction(), READ);\n        assertFalse(permissionValidator.resourceDependancy(ActivityResourceType.EDITOR, UPDATE).isPresent());\n    }\n\n    @Test\n    public void testSatisfyDependancy() {\n        PermissionCollection permissionCollection = mock(PermissionCollection.class);\n        Permission p = mock(Permission.class);\n        when(permissionManager.createPermission(OrganizationalUnit.RESOURCE_TYPE, READ, true)).thenReturn(p);\n        when(permissionCollection.implies(p)).thenReturn(true);\n\n        assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, UPDATE));\n        assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, CREATE));\n        assertTrue(permissionValidator.satisfyDependancies(permissionCollection, OrganizationalUnit.RESOURCE_TYPE, BUILD));\n    }\n\n    @Test\n    public void testIsValidSpaceType() {\n        OrganizationalUnit ou1 = new OrganizationalUnitImpl(\"ou1\",\n                                                            \"defaultGroupID\");\n        OrganizationalUnit ou2 = new OrganizationalUnitImpl(\"ou2\",\n                                                            \"defaultGroupID\");\n        final List<OrganizationalUnit> allOUs = new Lists.Builder<OrganizationalUnit>()\n                .add(ou2).add(ou1).build();\n        doReturn(allOUs).when(organizationalUnitService).getOrganizationalUnits();\n        assertTrue(permissionValidator.isValidResourceType(OrganizationalUnit.RESOURCE_TYPE, \"ou1\"));\n    }\n\n    @Test\n    public void testIsValidPerpectiveType() {\n        doReturn(new Lists.Builder<String>().add(\"ExperimentalFeaturesPerspective\").build()).when(appFormerActivities).getAllPerpectivesIds();\n        assertTrue(permissionValidator.isValidResourceType(ActivityResourceType.PERSPECTIVE, \"ExperimentalFeaturesPerspective\"));\n        assertFalse(permissionValidator.isValidResourceType(ActivityResourceType.PERSPECTIVE, \"TestPerspective\"));\n    }\n\n    @Test\n    public void testIsValidEditorType() {\n        doReturn(new Lists.Builder<String>().add(\"BPMNDiagramEditor\").build()).when(appFormerActivities).getAllEditorIds();\n        assertTrue(permissionValidator.isValidResourceType(ActivityResourceType.EDITOR, \"BPMNDiagramEditor\"));\n        assertFalse(permissionValidator.isValidResourceType(ActivityResourceType.EDITOR, \"TestEditor\"));\n    }\n\n    @Test\n    public void testIsValidRepositoryType() {\n        WorkspaceProject itemB = mock(WorkspaceProject.class);\n        when(itemB.getName()).thenReturn(\"Item B\");\n        when(projectService.getAllWorkspaceProjects()).thenReturn(new Sets.Builder<WorkspaceProject>().add(itemB).build());\n        assertTrue(permissionValidator.isValidResourceType(Repository.RESOURCE_TYPE, \"Item B\"));\n        assertFalse(permissionValidator.isValidResourceType(Repository.RESOURCE_TYPE, \"Item A\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/UserManagementHelperTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.Arrays;\n\nimport javax.ws.rs.core.Response;\n\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.rest.client.NewUser;\nimport org.guvnor.rest.client.PermissionResponse;\nimport org.guvnor.rest.client.UberfireRestResponse;\nimport org.guvnor.rest.client.UpdateSettingRequest;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.kie.soup.commons.util.Lists;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.ext.security.management.api.exception.GroupNotFoundException;\nimport org.uberfire.ext.security.management.api.exception.SecurityManagementException;\nimport org.uberfire.ext.security.management.api.exception.UserNotFoundException;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UserManagementHelperTest {\n\n    @InjectMocks\n    private UserManagementResourceHelper helper;\n    @Mock\n    private GroupManagerService groupManagerService;\n    @Mock\n    private RoleManagerService roleManagerService;\n    @Mock\n    private UserManagerService userManagerService;\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n    @Mock\n    private WorkspaceProjectService projectService;\n    @Mock\n    private ResourceTypePermissionValidator permissionValidator;\n    @Mock\n    private AuthorizationService authorizationService;\n    @Mock\n    private PermissionManager permissionManager;\n\n    @Test\n    public void testGroupNotFoundWhenUpdateGroupPermission() {\n        doThrow(GroupNotFoundException.class).when(groupManagerService).get(\"testGroup\");\n        UberfireRestResponse response = helper.updateGroupPermissions(\"testGroup\", mock(UpdateSettingRequest.class));\n\n        assertEquals(Response.Status.BAD_REQUEST,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testCreateGroup() {\n        doThrow(GroupNotFoundException.class).when(groupManagerService).get(\"testGroup\");\n        when(groupManagerService.create(new GroupImpl(\"testGroup\"))).thenReturn(mock(Group.class));\n        when(userManagerService.get(\"testUser\")).thenReturn(mock(User.class));\n\n        UberfireRestResponse response = helper.createGroup(\"testGroup\", Arrays.asList(\"testUser\"));\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testCreateGroupWithInvalidUser() {\n        doThrow(GroupNotFoundException.class).when(groupManagerService).get(\"testGroup\");\n        doThrow(UserNotFoundException.class).when(userManagerService).get(\"testUser\");\n\n        UberfireRestResponse response = helper.createGroup(\"testGroup\", Arrays.asList(\"testUser\"));\n\n        assertEquals(Response.Status.BAD_REQUEST,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testCreateUser() {\n        doThrow(UserNotFoundException.class).when(userManagerService).get(\"testUser\");\n        when(userManagerService.create(new UserImpl(\"testUser\"))).thenReturn(mock(User.class));\n        NewUser newUser = new NewUser();\n        newUser.setName(\"testUser\");\n        UberfireRestResponse response = helper.createUser(newUser);\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testChangePassword() {\n        doThrow(SecurityManagementException.class).when(userManagerService).changePassword(\"testUser\", \"testpassword\");\n        UberfireRestResponse response = helper.changePassword(\"testUser\", \"testpassword\");\n\n        assertEquals(Response.Status.INTERNAL_SERVER_ERROR,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testCreateUserWithInvalidGroup() {\n        doThrow(GroupNotFoundException.class).when(groupManagerService).get(\"testGroup\");\n        NewUser newUser = new NewUser();\n        newUser.setName(\"testUser\");\n        newUser.setGroups(new Lists.Builder<String>().add(\"testGroup\").build());\n        UberfireRestResponse response = helper.createUser(newUser);\n\n        assertEquals(Response.Status.BAD_REQUEST,\n                     response.getStatus());\n    }\n    @Test\n    public void testRemoveGroup() {\n        UberfireRestResponse response = helper.removeGroup(\"testGroup\");\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testRemoveUser() {\n        UberfireRestResponse response = helper.removeUser(\"testUser\");\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testAssignGroupsToUser() {\n        when(groupManagerService.get(\"testGroup\")).thenReturn(mock(Group.class));\n        UberfireRestResponse response = helper.assignGroupsToUser(\"testUser\", new Lists.Builder<String>().add(\"testGroup\").build());\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testAssignInvalidGroupsToUser() {\n        doThrow(GroupNotFoundException.class).when(groupManagerService).get(\"testGroup\");\n        UberfireRestResponse response = helper.assignGroupsToUser(\"testUser\", new Lists.Builder<String>().add(\"testGroup\").build());\n\n        assertEquals(Response.Status.BAD_REQUEST,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testAssignRolesToUser() {\n        when(roleManagerService.get(\"testRole\")).thenReturn(mock(Role.class));\n        UberfireRestResponse response = helper.assignRolesToUser(\"testUser\", new Lists.Builder<String>().add(\"testRole\").build());\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testUpdateRolePermission() {\n        when(permissionManager.getAuthorizationPolicy()).thenReturn(mock(AuthorizationPolicy.class));\n        when(roleManagerService.get(\"testRole\")).thenReturn(new RoleImpl(\"testRole\"));\n        UpdateSettingRequest request = mock(UpdateSettingRequest.class);\n        UberfireRestResponse response = helper.updateRolePermissions(\"testRole\", request);\n\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testUpdateGroupPermission() {\n        when(permissionManager.getAuthorizationPolicy()).thenReturn(mock(AuthorizationPolicy.class));\n        when(groupManagerService.get(\"testGroup\")).thenReturn(new GroupImpl(\"testGroup\"));\n        UpdateSettingRequest request = mock(UpdateSettingRequest.class);\n        UberfireRestResponse response = helper.updateGroupPermissions(\"testGroup\", request);\n        assertEquals(Response.Status.OK,\n                     response.getStatus());\n    }\n\n    @Test\n    public void testGetGroupPermission() {\n        Group group = mock(Group.class);\n        AuthorizationPolicy authz = mock(AuthorizationPolicy.class);\n        when(authz.getHomePerspective(group)).thenReturn(\"Home\");\n        when(authz.getPriority(group)).thenReturn(10);\n        when(authz.getPermissions(group)).thenReturn(mock(PermissionCollection.class));\n        when(permissionManager.getAuthorizationPolicy()).thenReturn(authz);\n        when(groupManagerService.get(\"testGroup\")).thenReturn(group);\n        PermissionResponse response = helper.getGroupPermissions(\"testGroup\");\n\n        assertNotNull(response);\n        assertEquals(\"Home\", response.getHomePage());\n        assertEquals(new Integer(10), response.getPriority());\n\n    }\n\n    @Test\n    public void testGetRolePermission() {\n        Role role = mock(Role.class);\n        AuthorizationPolicy authz = mock(AuthorizationPolicy.class);\n        when(authz.getHomePerspective(role)).thenReturn(\"Home\");\n        when(authz.getPriority(role)).thenReturn(10);\n        when(authz.getPermissions(role)).thenReturn(mock(PermissionCollection.class));\n        when(permissionManager.getAuthorizationPolicy()).thenReturn(authz);\n        when(roleManagerService.get(\"testRole\")).thenReturn(role);\n        PermissionResponse response = helper.getRolePermissions(\"testRole\");\n\n        assertNotNull(response);\n        assertEquals(\"Home\", response.getHomePage());\n        assertEquals(new Integer(10), response.getPriority());\n    }\n\n    @Test\n    public void testGetUserPermission() {\n        User user = mock(User.class);\n        AuthorizationPolicy authz = mock(AuthorizationPolicy.class);\n        when(permissionManager.resolvePermissions(user, VotingStrategy.PRIORITY)).thenReturn(mock(PermissionCollection.class));\n        when(userManagerService.get(\"testUser\")).thenReturn(user);\n        PermissionResponse response = helper.getUserPermissions(\"testUser\");\n\n        assertNotNull(response);\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/UserManagementResourceJobTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.backend;\n\nimport java.util.List;\n\nimport javax.ws.rs.core.Response;\nimport javax.ws.rs.core.Variant;\n\nimport org.guvnor.rest.client.NewGroup;\nimport org.guvnor.rest.client.NewUser;\nimport org.guvnor.rest.client.UberfireRestResponse;\nimport org.guvnor.rest.client.UpdateSettingRequest;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.kie.soup.commons.util.Lists;\nimport org.kie.soup.commons.util.Sets;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ext.security.management.api.service.GroupManagerService;\nimport org.uberfire.ext.security.management.api.service.RoleManagerService;\nimport org.uberfire.ext.security.management.api.service.UserManagerService;\nimport org.uberfire.workbench.model.AppFormerActivities;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UserManagementResourceJobTest {\n\n    @Mock\n    private GroupManagerService groupManagerService;\n\n    @Mock\n    private RoleManagerService roleManagerService;\n\n    @Mock\n    private UserManagerService userManagerService;\n\n    @Mock\n    private UserManagementResourceHelper jobRequestHelper;\n\n    @Mock\n    private AppFormerActivities appFormerActivities;\n\n    @InjectMocks\n    UserManagementResource userManagementResource = new UserManagementResource() {\n        protected void assertObjectExists(final Object o,\n                                          final String objectInfo,\n                                          final String objectName) {\n\n        }\n\n        protected Variant getDefaultVariant() {\n            return null;\n        }\n\n        protected Response createResponse(final UberfireRestResponse restResponse) {\n            return null;\n        }\n    };\n\n    @Test\n    public void getAllGroupsTest() throws Exception {\n        when(groupManagerService.getAll()).thenReturn(new Lists.Builder<Group>().add(new GroupImpl(\"testGroup\")).build());\n        assertThat(userManagementResource.getGroups()).isNotNull();\n    }\n\n    @Test\n    public void getAllRolesTest() throws Exception {\n        when(roleManagerService.getAll()).thenReturn(new Lists.Builder<Role>().add(new RoleImpl(\"testRole\")).build());\n        assertThat(userManagementResource.getRoles().size()).isOne();\n    }\n\n    @Test\n    public void getAllUsersTest() throws Exception {\n        when(userManagerService.getAll()).thenReturn(new Lists.Builder<User>().add(new UserImpl(\"testuser\")).build());\n        assertThat(userManagementResource.getUsers().size()).isOne();\n    }\n\n    @Test\n    public void getAllEditorsTest() throws Exception {\n        List<String> perspectives = new Lists.Builder<String>()\n                .add(\"perpective1\")\n                .add(\"perpective2\")\n                .build();\n        when(appFormerActivities.getAllPerpectivesIds()).thenReturn(perspectives);\n        assertThat(userManagementResource.getPerpectives().size()).isEqualTo(2);\n    }\n\n    @Test\n    public void getAllPerspectivesTest() throws Exception {\n        List<String> editors = new Lists.Builder<String>()\n                .add(\"editor1\")\n                .add(\"editor2\")\n                .add(\"editor3\")\n                .build();\n        when(appFormerActivities.getAllEditorIds()).thenReturn(editors);\n        assertThat(userManagementResource.getEditors().size()).isEqualTo(3);\n    }\n\n    @Test\n    public void getUserGroupsTest() throws Exception {\n        User user = mock(User.class);\n        when(user.getGroups()).thenReturn(new Sets.Builder<Group>().add(new GroupImpl(\"testgroup\")).build());\n        when(userManagerService.getUser(\"testUser\")).thenReturn(user);\n        assertThat(userManagementResource.getUserGroups(\"testUser\").size()).isOne();\n    }\n\n    @Test\n    public void getUserRolesTest() throws Exception {\n        User user = mock(User.class);\n        when(user.getRoles()).thenReturn(new Sets.Builder<Role>().add(new RoleImpl(\"testRole\")).build());\n        when(userManagerService.getUser(\"testUser\")).thenReturn(user);\n        assertThat(userManagementResource.getUserRoles(\"testUser\").size()).isOne();\n    }\n\n    @Test\n    public void createGroupTest() throws Exception {\n        NewGroup newGroup = new NewGroup();\n        userManagementResource.createGroup(newGroup);\n        verify(jobRequestHelper).createGroup(newGroup.getName(), newGroup.getUsers());\n    }\n\n    @Test\n    public void createUserTest() throws Exception {\n        NewUser newUser = new NewUser();\n        userManagementResource.createUser(newUser);\n        verify(jobRequestHelper).createUser(newUser);\n    }\n\n    @Test\n    public void removeGroupTest() throws Exception {\n        userManagementResource.deleteGroup(\"testGroup\");\n        verify(jobRequestHelper).removeGroup(\"testGroup\");\n    }\n\n    @Test\n    public void removeUserTest() throws Exception {\n        userManagementResource.deleteUser(\"testUser\");\n        verify(jobRequestHelper).removeUser(\"testUser\");\n    }\n\n    @Test\n    public void assignGroupToUserTest() throws Exception {\n        List<String> roles = new Lists.Builder<String>().add(\"testRole\").build();\n        userManagementResource.assignRolesToUser(\"testUser\", roles);\n        verify(jobRequestHelper).assignRolesToUser(\"testUser\", roles);\n    }\n\n    @Test\n    public void assignRolesToUserTest() throws Exception {\n        List<String> groups = new Lists.Builder<String>().add(\"testGroup\").build();\n        userManagementResource.assignGroupsToUser(\"testUser\", groups);\n        verify(jobRequestHelper).assignGroupsToUser(\"testUser\", groups);\n    }\n\n    @Test\n    public void updateGroupSettingTest() throws Exception {\n        UpdateSettingRequest settingRequest = new UpdateSettingRequest();\n        userManagementResource.updateGroupPermissions(\"groupName\", settingRequest);\n        verify(jobRequestHelper).updateGroupPermissions(\"groupName\", settingRequest);\n    }\n\n    @Test\n    public void updateRoleSettingTest() throws Exception {\n        UpdateSettingRequest settingRequest = new UpdateSettingRequest();\n        userManagementResource.updateRolePermissions(\"roleName\", settingRequest);\n        verify(jobRequestHelper).updateRolePermissions(\"roleName\", settingRequest);\n    }\n\n    @Test\n    public void getRolePermisssionTest() throws Exception {\n        userManagementResource.getRolePermissions(\"roleName\");\n        verify(jobRequestHelper).getRolePermissions(\"roleName\");\n    }\n\n    @Test\n    public void getGroupPermisssionTest() throws Exception {\n        userManagementResource.getGroupPermissions(\"groupname\");\n        verify(jobRequestHelper).getGroupPermissions(\"groupname\");\n    }\n\n    @Test\n    public void getUserPermisssionTest() throws Exception {\n        userManagementResource.getUserPermissions(\"userName\");\n        verify(jobRequestHelper).getUserPermissions(\"userName\");\n    }\n\n    @Test\n    public void getchangePasswordTest() throws Exception {\n        userManagementResource.changePassword(\"user\", \"newPassword\");\n        verify(jobRequestHelper).changePassword(\"user\", \"newPassword\");\n    }\n\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/java/org/guvnor/rest/backend/package-info.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.backend;\n\n/**\n * See the drools-wb-tests modules in kie-test.\n */\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/resources/META-INF/beans.xml",
    "content": "<beans>\n  <alternatives>\n    <class>org.guvnor.test.GuvnorTestAppSetup</class>\n   </alternatives>\n</beans>"
  },
  {
    "path": "uberfire-rest/uberfire-rest-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/.gitignore",
    "content": "/target\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n  xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-rest</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-rest-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - REST Client</name>\n  <description>UberFire - REST Client classes</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.ws.rs</groupId>\n      <artifactId>jakarta.ws.rs-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/AddBranchJobRequest.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class AddBranchJobRequest extends JobRequest {\r\n\r\n    private String spaceName;\r\n    private String projectName;\r\n    private String newBranchName;\r\n    private String baseBranchName;\r\n    private String userIdentifier;\r\n\r\n    public String getSpaceName() {\r\n        return spaceName;\r\n    }\r\n\r\n    public void setSpaceName(final String name) {\r\n        this.spaceName = name;\r\n    }\r\n\r\n    public String getProjectName() {\r\n        return projectName;\r\n    }\r\n\r\n    public void setProjectName(final String name) {\r\n        this.projectName = name;\r\n    }\r\n\r\n    public String getNewBranchName() {\r\n        return newBranchName;\r\n    }\r\n\r\n    public void setNewBranchName(final String name) {\r\n        this.newBranchName = name;\r\n    }\r\n\r\n    public String getBaseBranchName() {\r\n        return baseBranchName;\r\n    }\r\n\r\n    public void setBaseBranchName(final String name) {\r\n        this.baseBranchName = name;\r\n    }\r\n\r\n    public void setUserIdentifier(final String userIdentifier) {\r\n        this.userIdentifier = userIdentifier;\r\n    }\r\n\r\n    public String getUserIdentifier() {\r\n        return userIdentifier;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/AddBranchRequest.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class AddBranchRequest extends Entity {\n\n    private String newBranchName;\n    private String baseBranchName;\n\n    public AddBranchRequest() {\n    }\n\n    public void setNewBranchName(final String name) {\n        this.newBranchName = name;\n    }\n\n    public void setBaseBranchName(final String name) {\n        this.baseBranchName = name;\n    }\n\n    public String getNewBranchName() {\n        return newBranchName;\n    }\n\n    public String getBaseBranchName() {\n        return baseBranchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/AddProjectToSpaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class AddProjectToSpaceRequest extends JobRequest {\n\n    private String spaceName;\n    private String projectName;\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/BranchResponse.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class BranchResponse implements Serializable {\n\n    private String name;\n\n    public BranchResponse() {\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String toString() {\n        return \"BranchResponse{\" +\n                \"name='\" + name + '\\'' +\n                \"}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/CloneProjectJobRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CloneProjectJobRequest extends JobRequest {\n\n    private CloneProjectRequest cloneProjectRequest;\n    private String spaceName;\n\n    public CloneProjectRequest getCloneProjectRequest() {\n        return cloneProjectRequest;\n    }\n\n    public void setCloneProjectRequest(CloneProjectRequest cloneProjectRequest) {\n        this.cloneProjectRequest = cloneProjectRequest;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/CloneProjectRequest.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CloneProjectRequest extends Entity {\n\n    private String userName;\n    private String password;\n    private String gitURL;\n\n    public String getUserName() {\n        return userName;\n    }\n\n    public void setUserName(String userName) {\n        this.userName = userName;\n    }\n\n    public String getPassword() {\n        return password;\n    }\n\n    public void setPassword(String password) {\n        this.password = password;\n    }\n\n    public String getGitURL() {\n        return gitURL;\n    }\n\n    public void setGitURL(String gitURL) {\n        this.gitURL = gitURL;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/CompileProjectRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CompileProjectRequest extends JobRequest {\n\n    private String projectName;\n    private String spaceName;\n    private String branchName;\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public void setBranchName(String branchName) {\n        this.branchName = branchName;\n    }\n\n    public String getBranchName() {\n        return branchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/CreateProjectJobRequest.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class CreateProjectJobRequest extends JobRequest {\r\n\r\n    private String spaceName;\r\n    private String projectName;\r\n    private String projectGroupId;\r\n    private String projectVersion;\r\n    private String description;\r\n    private String templateId;\r\n\r\n    public String getSpaceName() {\r\n        return spaceName;\r\n    }\r\n\r\n    public void setSpaceName(String spaceName) {\r\n        this.spaceName = spaceName;\r\n    }\r\n\r\n    public String getProjectName() {\r\n        return projectName;\r\n    }\r\n\r\n    public void setProjectName(String projectName) {\r\n        this.projectName = projectName;\r\n    }\r\n\r\n    public String getProjectGroupId() {\r\n        return projectGroupId;\r\n    }\r\n\r\n    public void setProjectGroupId(String projectGroupId) {\r\n        this.projectGroupId = projectGroupId;\r\n    }\r\n\r\n    public String getProjectVersion() {\r\n        return projectVersion;\r\n    }\r\n\r\n    public void setProjectVersion(String projectVersion) {\r\n        this.projectVersion = projectVersion;\r\n    }\r\n\r\n    public String getDescription() {\r\n        return description;\r\n    }\r\n\r\n    public void setDescription(String description) {\r\n        this.description = description;\r\n    }\r\n\r\n    public String getTemplateId() {\r\n        return templateId;\r\n    }\r\n\r\n    public void setTemplateId(String templateId) {\r\n        this.templateId = templateId;\r\n    }\r\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/CreateProjectRequest.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class CreateProjectRequest extends Entity {\n\n    private String groupId;\n    private String version;\n    private String templateId;\n\n    public CreateProjectRequest() {\n    }\n\n    public void setGroupId(String groupId) {\n        this.groupId = groupId;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n    }\n\n    public String getGroupId() {\n        return groupId;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public String getTemplateId() {\n        return templateId;\n    }\n\n    public void setTemplateId(String templateId) {\n        this.templateId = templateId;\n    }\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/DeleteProjectRequest.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class DeleteProjectRequest extends JobRequest {\r\n\r\n    private String projectName;\r\n    private String spaceName;\r\n\r\n    public String getProjectName() {\r\n        return projectName;\r\n    }\r\n\r\n    public void setProjectName(String projectName) {\r\n        this.projectName = projectName;\r\n    }\r\n\r\n    public String getSpaceName() {\r\n        return spaceName;\r\n    }\r\n\r\n    public void setSpaceName(String spaceName) {\r\n        this.spaceName = spaceName;\r\n    }\r\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/DeployProjectRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DeployProjectRequest extends JobRequest {\n\n    private String projectName;\n    private String spaceName;\n    private String branchName;\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public void setBranchName(String branchName) {\n        this.branchName = branchName;\n    }\n\n    public String getBranchName() {\n        return branchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/Entity.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.io.Serializable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Entity implements Serializable {\n\n    private String name;\n    private String description;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/InstallProjectRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class InstallProjectRequest extends JobRequest {\n\n    private String spaceName;\n    private String projectName;\n    private String branchName;\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public void setBranchName(String branchName) {\n        this.branchName = branchName;\n    }\n\n    public String getBranchName() {\n        return branchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/JobRequest.java",
    "content": "/*\r\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage org.guvnor.rest.client;\r\n\r\nimport java.io.Serializable;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class JobRequest implements Serializable {\r\n\r\n    private String jobId;\r\n    private JobStatus status;\r\n\r\n    public String getJobId() {\r\n        return jobId;\r\n    }\r\n\r\n    public void setJobId(String jobId) {\r\n        this.jobId = jobId;\r\n    }\r\n\r\n    public JobStatus getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(JobStatus status) {\r\n        this.status = status;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/JobResult.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.List;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class JobResult implements Serializable {\r\n\r\n    private JobStatus status;\r\n    private String jobId;\r\n    private String result;\r\n    private Long lastModified;\r\n    private List<String> detailedResult;\r\n\r\n    public JobStatus getStatus() {\r\n        return status;\r\n    }\r\n\r\n    public void setStatus(JobStatus status) {\r\n        this.status = status;\r\n    }\r\n\r\n    public String getJobId() {\r\n        return jobId;\r\n    }\r\n\r\n    public void setJobId(String jobId) {\r\n        this.jobId = jobId;\r\n    }\r\n\r\n    public String getResult() {\r\n        return result;\r\n    }\r\n\r\n    public void setResult(String result) {\r\n        this.result = result;\r\n    }\r\n\r\n    public Long getLastModified() {\r\n        return lastModified;\r\n    }\r\n\r\n    public void setLastModified(long lastModified) {\r\n        this.lastModified = lastModified;\r\n    }\r\n\r\n    public List<String> getDetailedResult() {\r\n        return detailedResult;\r\n    }\r\n\r\n    public void setDetailedResult(List<String> detailedResult) {\r\n        this.detailedResult = detailedResult;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/JobStatus.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.rest.client;\n\nimport java.io.Serializable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Job status\n */\n@Portable\npublic enum JobStatus implements Serializable {\n\n    GONE,\n    ACCEPTED,\n    APPROVED,\n    DENIED,\n    BAD_REQUEST,\n    RESOURCE_NOT_EXIST,\n    DUPLICATE_RESOURCE,\n    SERVER_ERROR,\n    SUCCESS,\n    FAIL\n\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/NewGroup.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.security.shared.api.identity.User;\n\n@Portable\npublic class NewGroup extends Entity{\n\n    private List<String> users;\n\n    public List<String> getUsers() {\n        return users;\n    }\n\n    public void setUsers(List<String> users) {\n        this.users = users;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/NewUser.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NewUser {\n\n    private String name;\n    private List<String> roles;\n    private List<String> groups;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public List<String> getRoles() {\n        return roles;\n    }\n\n    public void setRoles(List<String> roles) {\n        this.roles = roles;\n    }\n\n    public List<String> getGroups() {\n        return groups;\n    }\n\n    public void setGroups(List<String> groups) {\n        this.groups = groups;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/Permission.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Permission {\n\n    private Boolean read;\n    private Boolean create;\n    private Boolean update;\n    private Boolean delete;\n    private Boolean build;\n\n    private List<PermissionException> exceptions;\n\n    public Permission() {\n    }\n\n    public Permission(@MapsTo(\"read\") Boolean read, @MapsTo(\"create\") Boolean create,\n                      @MapsTo(\"update\") Boolean update, @MapsTo(\"delete\") Boolean delete,\n                      @MapsTo(\"build\") Boolean build, @MapsTo(\"exceptions\") List<PermissionException> exceptions) {\n        this.read = read;\n        this.create = create;\n        this.update = update;\n        this.delete = delete;\n        this.build = build;\n        this.exceptions = exceptions;\n    }\n\n    public Boolean isRead() {\n        return read;\n    }\n\n    public Boolean isCreate() {\n        return create;\n    }\n\n    public Boolean isUpdate() {\n        return update;\n    }\n\n    public Boolean isDelete() {\n        return delete;\n    }\n\n    public Boolean isBuild() {\n        return build;\n    }\n\n    public List<PermissionException> getExceptions() {\n        return exceptions;\n    }\n\n    public void setRead(Boolean read) {\n        this.read = read;\n    }\n\n    public void setCreate(Boolean create) {\n        this.create = create;\n    }\n\n    public void setUpdate(Boolean update) {\n        this.update = update;\n    }\n\n    public void setDelete(Boolean delete) {\n        this.delete = delete;\n    }\n\n    public void setBuild(Boolean build) {\n        this.build = build;\n    }\n\n    public void setExceptions(List<PermissionException> exceptions) {\n        this.exceptions = exceptions;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/PermissionException.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PermissionException {\n\n    private String resourceName;\n    private Permission permissions;\n\n    public PermissionException() {\n    }\n\n    public PermissionException(@MapsTo(\"resourceName\") String resourceName, @MapsTo(\"permissions\") Permission permissions) {\n        this.resourceName = resourceName;\n        this.permissions = permissions;\n    }\n\n    public String getResourceName() {\n        return resourceName;\n    }\n\n    public Permission getPermissions() {\n        return permissions;\n    }\n\n    public void setResourceName(String resourceName) {\n        this.resourceName = resourceName;\n    }\n\n    public void setPermissions(Permission permissions) {\n        this.permissions = permissions;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/PermissionResponse.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PermissionResponse {\n    private String homePage;\n    private Integer priority;\n    private ResourcePermission project;\n    private ResourcePermission spaces;\n    private ResourcePermission editor;\n    private ResourcePermission pages;\n    private WorkbenchPermission workbench;\n\n    public String getHomePage() {\n        return homePage;\n    }\n\n    public void setHomePage(String homePage) {\n        this.homePage = homePage;\n    }\n\n    public Integer getPriority() {\n        return priority;\n    }\n\n    public void setPriority(Integer priority) {\n        this.priority = priority;\n    }\n\n    public ResourcePermission getProject() {\n        return project;\n    }\n\n    public ResourcePermission getSpaces() {\n        return spaces;\n    }\n\n    public ResourcePermission getEditor() {\n        return editor;\n    }\n\n    public ResourcePermission getPages() {\n        return pages;\n    }\n\n    public void setProject(ResourcePermission project) {\n        this.project = project;\n    }\n\n    public void setSpaces(ResourcePermission spaces) {\n        this.spaces = spaces;\n    }\n\n    public void setEditor(ResourcePermission editor) {\n        this.editor = editor;\n    }\n\n    public void setPages(ResourcePermission pages) {\n        this.pages = pages;\n    }\n\n    public WorkbenchPermission getWorkbench() {\n        return workbench;\n    }\n\n    public void setWorkbench(WorkbenchPermission workbench) {\n        this.workbench = workbench;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/PermissionType.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PermissionType {\n\n    private boolean access;\n    private List<String> exceptions;\n\n    public boolean isAccess() {\n        return access;\n    }\n\n    public void setAccess(boolean access) {\n        this.access = access;\n    }\n\n    public List<String> getExceptions() {\n        return exceptions;\n    }\n\n    public void setExceptions(List<String> exceptions) {\n        this.exceptions = exceptions;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/ProjectResponse.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.io.Serializable;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ProjectResponse implements Serializable {\n\n    private String name;\n    private String spaceName;\n    private String groupId;\n    private String version;\n    private String description;\n    private List<PublicURI> publicURIs;\n\n    public ProjectResponse() {\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public String getGroupId() {\n        return groupId;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public void setGroupId(String groupId) {\n        this.groupId = groupId;\n    }\n\n    public void setVersion(String version) {\n        this.version = version;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    @Override\n    public String toString() {\n        return \"ProjectResponse{\" +\n                \"name='\" + name + '\\'' +\n                \", spaceName='\" + spaceName + '\\'' +\n                \", groupId='\" + groupId + '\\'' +\n                \", version='\" + version + '\\'' +\n                \", description='\" + description + '\\'' +\n                \", publicURIs= [\" + publicURIs.stream()\n                .map(c -> c.toString())\n                .collect(Collectors.joining(\",\")) +\n                \"]}\";\n    }\n\n    public void setPublicURIs(List<PublicURI> publicURIs) {\n        this.publicURIs = publicURIs;\n    }\n\n    public List<PublicURI> getPublicURIs() {\n        return publicURIs;\n    }\n}"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/PublicURI.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PublicURI {\n\n    private String protocol;\n    private String uri;\n\n    public String getProtocol() {\n        return protocol;\n    }\n\n    public void setProtocol(String protocol) {\n        this.protocol = protocol;\n    }\n\n    public String getUri() {\n        return uri;\n    }\n\n    public void setUri(String uri) {\n        this.uri = uri;\n    }\n\n    @Override\n    public String toString() {\n        return \"PublicURI{\" +\n                \"protocol='\" + protocol + '\\'' +\n                \", uri='\" + uri + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/RemoveBranchJobRequest.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n *\r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class RemoveBranchJobRequest extends JobRequest {\r\n\r\n    private String spaceName;\r\n    private String projectName;\r\n    private String branchName;\r\n    private String userIdentifier;\r\n\r\n    public String getSpaceName() {\r\n        return spaceName;\r\n    }\r\n\r\n    public void setSpaceName(final String name) {\r\n        this.spaceName = name;\r\n    }\r\n\r\n    public String getProjectName() {\r\n        return projectName;\r\n    }\r\n\r\n    public void setProjectName(final String name) {\r\n        this.projectName = name;\r\n    }\r\n\r\n    public String getBranchName() {\r\n        return branchName;\r\n    }\r\n\r\n    public void setBranchName(final String name) {\r\n        this.branchName = name;\r\n    }\r\n\r\n    public void setUserIdentifier(final String userIdentifier) {\r\n        this.userIdentifier = userIdentifier;\r\n    }\r\n\r\n    public String getUserIdentifier() {\r\n        return userIdentifier;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/RemoveBranchRequest.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RemoveBranchRequest extends Entity {\n\n    private String branchName;\n\n    public RemoveBranchRequest() {\n    }\n\n    public void setBranchName(final String name) {\n        this.branchName = name;\n    }\n\n    public String getBranchName() {\n        return branchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/RemoveSpaceRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RemoveSpaceRequest extends JobRequest {\n\n    private String spaceName;\n    private String owner;\n    private String description;\n    private List<String> repositories;\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public String getOwner() {\n        return owner;\n    }\n\n    public void setOwner(String owner) {\n        this.owner = owner;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public List<String> getRepositories() {\n        return repositories;\n    }\n\n    public void setRepositories(List<String> repositories) {\n        this.repositories = repositories;\n    }\n\n    @Override\n    public String toString() {\n        return \"RemoveSpaceRequest{\" +\n                \"spaceName='\" + spaceName + '\\'' +\n                \", owner='\" + owner + '\\'' +\n                \", description='\" + description + '\\'' +\n                \", repositories=\" + repositories +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/ResourcePermission.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ResourcePermission {\n\n    private PermissionType read;\n    private PermissionType create;\n    private PermissionType update;\n    private PermissionType delete;\n    private PermissionType build;\n\n    public PermissionType getRead() {\n        return read;\n    }\n\n    public void setRead(PermissionType read) {\n        this.read = read;\n    }\n\n    public PermissionType getCreate() {\n        return create;\n    }\n\n    public void setCreate(PermissionType create) {\n        this.create = create;\n    }\n\n    public PermissionType getUpdate() {\n        return update;\n    }\n\n    public void setUpdate(PermissionType update) {\n        this.update = update;\n    }\n\n    public PermissionType getDelete() {\n        return delete;\n    }\n\n    public void setDelete(PermissionType delete) {\n        this.delete = delete;\n    }\n\n    public PermissionType getBuild() {\n        return build;\n    }\n\n    public void setBuild(PermissionType build) {\n        this.build = build;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/Space.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Space\n        extends Entity {\n\n    private List<ProjectResponse> projects;\n    private String owner;\n    private String defaultGroupId;\n\n    public List<ProjectResponse> getProjects() {\n        return projects;\n    }\n\n    public void setProjects(List<ProjectResponse> projects) {\n        this.projects = projects;\n    }\n\n    public String getOwner() {\n        return owner;\n    }\n\n    public void setOwner(String owner) {\n        this.owner = owner;\n    }\n\n    public String getDefaultGroupId() {\n        return defaultGroupId;\n    }\n\n    public void setDefaultGroupId(String defaultGroupId) {\n        this.defaultGroupId = defaultGroupId;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/SpaceRequest.java",
    "content": "/*\r\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * \r\n *      http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n*/\r\n\r\npackage org.guvnor.rest.client;\r\n\r\nimport org.jboss.errai.common.client.api.annotations.Portable;\r\n\r\n@Portable\r\npublic class SpaceRequest extends JobRequest {\r\n\r\n    private String spaceName;\r\n    private String owner;\r\n    private String defaultGroupId;\r\n    private String description;\r\n\r\n    public String getSpaceName() {\r\n        return spaceName;\r\n    }\r\n\r\n    public void setSpaceName(String spaceName) {\r\n        this.spaceName = spaceName;\r\n    }\r\n\r\n    public String getOwner() {\r\n        return owner;\r\n    }\r\n\r\n    public void setOwner(String owner) {\r\n        this.owner = owner;\r\n    }\r\n\r\n    public String getDefaultGroupId() {\r\n        return defaultGroupId;\r\n    }\r\n\r\n    public void setDefaultGroupId(String defaultGroupId) {\r\n        this.defaultGroupId = defaultGroupId;\r\n    }\r\n\r\n    public String getDescription() {\r\n        return description;\r\n    }\r\n\r\n    public void setDescription(String description) {\r\n        this.description = description;\r\n    }\r\n}\r\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/TestProjectRequest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class TestProjectRequest extends JobRequest {\n\n    private String projectName;\n    private String spaceName;\n    private String branchName;\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public String getSpaceName() {\n        return spaceName;\n    }\n\n    public void setSpaceName(String spaceName) {\n        this.spaceName = spaceName;\n    }\n\n    public void setBranchName(String branchName) {\n\t    this.branchName = branchName;\n    }\n\n    public String getBranchName() {\n\t    return branchName;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/UberfireRestResponse.java",
    "content": "/*\n *\n *   Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n *   Licensed under the Apache License, Version 2.0 (the \"License\");\n *   you may not use this file except in compliance with the License.\n *   You may obtain a copy of the License at\n *\n *         http://www.apache.org/licenses/LICENSE-2.0\n *\n *   Unless required by applicable law or agreed to in writing, software\n *   distributed under the License is distributed on an \"AS IS\" BASIS,\n *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n *   See the License for the specific language governing permissions and\n *   limitations under the License.\n *\n */\n\npackage org.guvnor.rest.client;\n\nimport java.io.Serializable;\n\nimport javax.ws.rs.core.Response;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UberfireRestResponse implements Serializable {\n\n    private Response.Status status;\n    private String message;\n\n    public Response.Status getStatus() {\n        return status;\n    }\n\n    public void setStatus(Response.Status status) {\n        this.status = status;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n}\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/UpdateSettingRequest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UpdateSettingRequest {\n\n    private String homePage;\n    private Integer priority;\n    private Permission project;\n    private Permission spaces;\n    private Permission editor;\n    private Permission pages;\n    private WorkbenchPermission workbench;\n\n    public UpdateSettingRequest() {\n    }\n\n    public UpdateSettingRequest(@MapsTo(\"homePage\") String homePage, @MapsTo(\"priority\") Integer priority,\n                                @MapsTo(\"project\") Permission project, @MapsTo(\"spaces\") Permission spaces,\n                                @MapsTo(\"editor\") Permission editor, @MapsTo(\"pages\") Permission pages,\n                                @MapsTo(\"workbench\") WorkbenchPermission workbench) {\n        this.priority = priority;\n        this.homePage = homePage;\n        this.project = project;\n        this.spaces = spaces;\n        this.editor = editor;\n        this.pages = pages;\n        this.workbench = workbench;\n    }\n\n    public String getHomePage() {\n        return homePage;\n    }\n\n    public Integer getPriority() {\n        return priority;\n    }\n\n    public Permission getProject() {\n        return project;\n    }\n\n    public Permission getSpaces() {\n        return spaces;\n    }\n\n    public Permission getEditor() {\n        return editor;\n    }\n\n    public Permission getPages() {\n        return pages;\n    }\n\n    public WorkbenchPermission getWorkbench() {\n        return workbench;\n    }\n\n    public void setHomePage(String homePage) {\n        this.homePage = homePage;\n    }\n\n    public void setPriority(Integer priority) {\n        this.priority = priority;\n    }\n\n    public void setProject(Permission project) {\n        this.project = project;\n    }\n\n    public void setSpaces(Permission spaces) {\n        this.spaces = spaces;\n    }\n\n    public void setEditor(Permission editor) {\n        this.editor = editor;\n    }\n\n    public void setPages(Permission pages) {\n        this.pages = pages;\n    }\n\n    public void setWorkbench(WorkbenchPermission workbench) {\n        this.workbench = workbench;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-rest/uberfire-rest-client/src/main/java/org/guvnor/rest/client/WorkbenchPermission.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.rest.client;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class WorkbenchPermission {\n\n    private Boolean editDataObject;\n    private Boolean plannerAvailable;\n    private Boolean editGlobalPreferences;\n    private Boolean editProfilePreferences;\n    private Boolean accessDataTransfer;\n    private Boolean jarDownload;\n    private Boolean editGuidedDecisionTableColumns;\n\n    public WorkbenchPermission() {\n    }\n\n    public WorkbenchPermission(@MapsTo(\"editDataObject\") Boolean editDataObject, @MapsTo(\"plannerAvailable\") Boolean plannerAvailable,\n                               @MapsTo(\"editGlobalPreferences\") Boolean editGlobalPreferences, @MapsTo(\"editProfilePreferences\") Boolean editProfilePreferences,\n                               @MapsTo(\"accessDataTransfer\") Boolean accessDataTransfer, @MapsTo(\"jarDownload\") Boolean jarDownload,\n                               @MapsTo(\"editGuidedDecisionTableColumns\") Boolean editGuidedDecisionTableColumns) {\n        this.editDataObject = editDataObject;\n        this.plannerAvailable = plannerAvailable;\n        this.editGlobalPreferences = editGlobalPreferences;\n        this.editProfilePreferences = editProfilePreferences;\n        this.accessDataTransfer = accessDataTransfer;\n        this.jarDownload = jarDownload;\n        this.editGuidedDecisionTableColumns = editGuidedDecisionTableColumns;\n    }\n\n    public Boolean getEditDataObject() {\n        return editDataObject;\n    }\n\n    public Boolean getPlannerAvailable() {\n        return plannerAvailable;\n    }\n\n    public Boolean getEditGlobalPreferences() {\n        return editGlobalPreferences;\n    }\n\n    public Boolean getEditProfilePreferences() {\n        return editProfilePreferences;\n    }\n\n    public Boolean getAccessDataTransfer() {\n        return accessDataTransfer;\n    }\n\n    public Boolean getJarDownload() {\n        return jarDownload;\n    }\n\n    public Boolean getEditGuidedDecisionTableColumns() {\n        return editGuidedDecisionTableColumns;\n    }\n\n    public void setEditDataObject(Boolean editDataObject) {\n        this.editDataObject = editDataObject;\n    }\n\n    public void setPlannerAvailable(Boolean plannerAvailable) {\n        this.plannerAvailable = plannerAvailable;\n    }\n\n    public void setEditGlobalPreferences(Boolean editGlobalPreferences) {\n        this.editGlobalPreferences = editGlobalPreferences;\n    }\n\n    public void setEditProfilePreferences(Boolean editProfilePreferences) {\n        this.editProfilePreferences = editProfilePreferences;\n    }\n\n    public void setAccessDataTransfer(Boolean accessDataTransfer) {\n        this.accessDataTransfer = accessDataTransfer;\n    }\n\n    public void setJarDownload(Boolean jarDownload) {\n        this.jarDownload = jarDownload;\n    }\n\n    public void setEditGuidedDecisionTableColumns(Boolean editGuidedDecisionTableColumns) {\n        this.editGuidedDecisionTableColumns = editGuidedDecisionTableColumns;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/.gitignore",
    "content": "# build directories\ntarget/\nlocal/\nbin/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-security/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-security</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire Security</name>\n\n  <modules>\n    <module>uberfire-security-api</module>\n    <module>uberfire-security-client</module>\n    <module>uberfire-security-codegen</module>\n    <module>uberfire-security-client-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-security</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-security-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Security API</name>\n  <description>UberFire Security API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/annotations/PermissionCheck.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})\n@Retention(RetentionPolicy.CLASS)\npublic @interface PermissionCheck {\n\n    String value() default \"\";\n\n    String onGranted() default \"\";\n\n    String onDenied() default \"\";\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/annotations/ResourceCheck.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE})\n@Retention(RetentionPolicy.CLASS)\npublic @interface ResourceCheck {\n\n    String type() default \"\";\n\n    String action() default \"read\";\n\n    String onGranted() default \"\";\n\n    String onDenied() default \"\";\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/AuthorizationCheck.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport org.uberfire.mvp.Command;\n\n/**\n * A security check executed over a resource or permission.\n * <p>\n * <p>(See the {@link AuthorizationManager} {@code check} methods)</p>\n */\npublic interface AuthorizationCheck<C extends AuthorizationCheck> {\n\n    /**\n     * Specifies the command instance to execute in case the check result is granted.\n     * @param onGranted The command to execute\n     */\n    C granted(Command onGranted);\n\n    /**\n     * Specifies the command instance to execute in case the check result is denied.\n     * @param onDenied The command to execute\n     */\n    C denied(Command onDenied);\n\n    /**\n     * Get the check result value\n     * @return true if granted, false otherwise\n     */\n    boolean result();\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/AuthorizationManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.*;\n\nimport java.util.Collection;\n\n/**\n * Main entry interface for querying the authorization management subsystem about\n * user access to different system resources.\n * <p>\n * <p>It provides services for checking access to {@link Resource} instances\n * as well as services to check if a given permission has been granted to a user.\n */\npublic interface AuthorizationManager {\n\n    /**\n     * Check if the specified user can \"access\" a given resource. The term \"access\"\n     * refers to the ability to be able to reach, read or view a resource. For instance,\n     * read a file, view an item in the UI, etc.</p>\n     * <p>\n     * <p>Notice the resource may have dependencies ({@link Resource#getDependencies()}) to\n     * other resources, in such case the resource is only accessible if and only if one of\n     * its dependent references is accessible too.</p>\n     * @param resource The resource\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return true if access is granted, false otherwise.\n     */\n    boolean authorize(Resource resource,\n                      User user,\n                      VotingStrategy votingStrategy);\n\n    /**\n     * Check if the given action can be performed over the specified resource or any of its\n     * dependent resource references (see {@link Resource#getDependencies}).\n     * @param resource The resource instance to check\n     * @param action The action to check. If null then the {@link #authorize(Resource, User)} method is invoked.\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return true if the action is granted, false otherwise.\n     */\n    boolean authorize(Resource resource,\n                      ResourceAction action,\n                      User user,\n                      VotingStrategy votingStrategy);\n\n    /**\n     * Check if the given action can be performed over the specified resource or any of its\n     * dependent resource references (see {@link Resource#getDependencies}).\n     * @param resourceType The resource type to check\n     * @param action The action to check.\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return true if the action is granted, false otherwise.\n     */\n    boolean authorize(ResourceType resourceType,\n                      ResourceAction action,\n                      User user,\n                      VotingStrategy votingStrategy);\n\n    /**\n     * Check of the given permission has been granted to the user.\n     * @param permission The name of the permission to check\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return true if the permission is granted, false otherwise.\n     */\n    boolean authorize(String permission,\n                      User user,\n                      VotingStrategy votingStrategy);\n\n    /**\n     * Check of the given permission has been granted to the user.\n     * @param permission The name of the permission to check\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return true if the permission is granted, false otherwise.\n     */\n    boolean authorize(Permission permission,\n                      User user,\n                      VotingStrategy votingStrategy);\n\n    /**\n     * Creates a brand new {@link ResourceCheck} instance which provides a fluent styled API for\n     * the checking of restricted actions over {@link Resource} instances.\n     * <p>\n     * <p>ExampleUsage: </p>\n     * <pre>\n     * {@code User user;\n     *   Resource resource;\n     *   AuthorizationManager authzManager;\n     *\n     *   boolean result = authzManager.check(resource, user)\n     *      .granted(() -> System.out.println(\"Access granted\"))\n     *      .denied(() -> System.out.println(\"Access denied\"))\n     *      .result();\n     * }\n     * </pre>\n     * @param resource The resource to check\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return A {@link AuthorizationCheck} instance.\n     */\n    ResourceCheck check(Resource resource,\n                        User user,\n                        VotingStrategy votingStrategy);\n\n    /**\n     * Creates a brand new {@link ResourceCheck} instance which provides a fluent styled API for\n     * the checking of restricted actions over a {@link ResourceType}.\n     * <p>\n     * <p>ExampleUsage: </p>\n     * <pre>\n     * {@code User user;\n     *   AuthorizationManager authzManager;\n     *\n     *   boolean result = authzManager.check(ActivityResourceType.PERSPECTIVE, user)\n     *      .granted(() -> System.out.println(\"Access granted\"))\n     *      .denied(() -> System.out.println(\"Access denied\"))\n     *      .result();\n     * }\n     * </pre>\n     * @param resourceType The resource type to check\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return A {@link AuthorizationCheck} instance.\n     */\n    ResourceCheck check(ResourceType resourceType,\n                        User user,\n                        VotingStrategy votingStrategy);\n\n    /**\n     * Creates a brand new {@link PermissionCheck} instance which provides a\n     * fluent styled API for checking permissions.\n     * <p>\n     * <p>ExampleUsage: </p>\n     * <pre>\n     * {@code User user;\n     *   AuthorizationManager authzManager;\n     *\n     *   boolean result = authzManager.check(\"myfeature\", user)\n     *      .granted(() -> System.out.println(\"Access granted\"))\n     *      .denied(() -> System.out.println(\"Access denied\"))\n     *      .result();\n     * }\n     * </pre>\n     * @param permission The name of the permission to check\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * @return A {@link AuthorizationCheck} instance.\n     */\n    PermissionCheck check(String permission,\n                          User user,\n                          VotingStrategy votingStrategy);\n\n    /**\n     * It redirects to {@link #authorize(Resource, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    boolean authorize(Resource resource,\n                      User user);\n\n    /**\n     * It redirects to {@link #authorize(Resource, ResourceAction, User)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    boolean authorize(Resource resource,\n                      ResourceAction action,\n                      User user);\n\n    /**\n     * It redirects to {@link #authorize(ResourceType, ResourceAction, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    boolean authorize(ResourceType resourceType,\n                      ResourceAction action,\n                      User user);\n\n    /**\n     * It redirects to {@link #authorize(String, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    boolean authorize(String permission,\n                      User user);\n\n    /**\n     * It redirects to {@link #authorize(Permission, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    boolean authorize(Permission permission,\n                      User user);\n\n    /**\n     * It checks whether user is one of the contributors of resource\n     * as well permissions to access resource from security admin screen\n     */\n    public boolean authorize(Resource resource,\n                             Collection<Contributor> contributors,\n                             ResourceAction action,\n                             User user);\n    /**\n     * It redirects to {@link #check(Resource, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    ResourceCheck check(Resource resource,\n                        User user);\n\n    /**\n     * It redirects to {@link #check(ResourceType, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    ResourceCheck check(ResourceType type,\n                        User user);\n\n    /**\n     * It redirects to {@link #check(String, User, VotingStrategy)}\n     * using the default voting strategy defined at {@link PermissionManager}.\n     */\n    PermissionCheck check(String permission,\n                          User user);\n\n    /**\n     * Invalidate user related authorization data cached\n     * @param user user to invalidate cache\n     */\n    void invalidate(final User user);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/AuthorizationPolicy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\n\n/**\n * It holds a registry of permission collections assigned to individual Role and Group instances.\n */\npublic interface AuthorizationPolicy {\n\n    /**\n     * Get the collection of roles this policy is related to.\n     */\n    Set<Role> getRoles();\n\n    /**\n     * Get the collection of groups this policy is related to.\n     */\n    Set<Group> getGroups();\n\n    /**\n     * Get the description of an existing role.\n     * @param role The role\n     * @return The role description\n     */\n    String getRoleDescription(Role role);\n\n    /**\n     * Sets a description for an existing role.\n     * @param role The role\n     * @param description A non empty description\n     */\n    void setRoleDescription(Role role,\n                            String description);\n\n    /**\n     * Get the description of an existing group.\n     * @param group The group\n     * @return The group description\n     */\n    String getGroupDescription(Group group);\n\n    /**\n     * Sets a description for an existing group.\n     * @param group The group identifier\n     * @param description A non empty description\n     */\n    void setGroupDescription(Group group,\n                             String description);\n\n    /**\n     * Get a role's priority. The priority is important during permission resolution and when a user\n     * is assigned to more than one role/group it is used to determine what is the most priority.\n     * @param role The role instance\n     * @return An integer. The highest, the more priority the collection is. Default priority value is 0.\n     */\n    int getPriority(Role role);\n\n    /**\n     * Get a group's priority. The priority is important during permission resolution and when a user\n     * is assigned to more than one role/group it is used to determine what is the most priority.\n     * @param group The group instance\n     * @return An integer. The highest, the more priority the collection is. Default priority value is 0.\n     */\n    int getPriority(Group group);\n\n    /**\n     * Set the role's priority\n     * @param role The role instance\n     * @param priority Any valid integer. The highest, the more priority the role is.\n     */\n    void setPriority(Role role,\n                     int priority);\n\n    /**\n     * Set the group's priority\n     * @param group The group instance\n     * @param priority Any valid integer. The highest, the more priority the role is.\n     */\n    void setPriority(Group group,\n                     int priority);\n\n    /**\n     * Get the permissions assigned to a given role.\n     * @param role The role instance\n     * @return The permission collection. Notice, the default permission collection is also included in the results.\n     */\n    PermissionCollection getPermissions(Role role);\n\n    /**\n     * Set the role's permissions\n     * @param role The role instance\n     * @param permissions A permission collection\n     */\n    void setPermissions(Role role, PermissionCollection permissions);\n\n    /**\n     * Get the permissions assigned to a given group.\n     * @param group The group instance\n     * @return The permission collection. Notice, the default permission collection is also included in the results.\n     */\n    PermissionCollection getPermissions(Group group);\n\n    /**\n     * Set the group's permissions\n     * @param group The group instance\n     * @param permissions A permission collection\n     */\n    void setPermissions(Group group, PermissionCollection permissions);\n\n    /**\n     * Get the identifier of the home perspective assigned to the given group.\n     * @return An existing perspective identifier\n     */\n    String getHomePerspective(Role role);\n\n    /**\n     * Get the identifier of the home perspective assigned to the given group.\n     * @return An existing perspective identifier\n     */\n    String getHomePerspective(Group group);\n\n    /**\n     * Set the identifier of the home perspective assigned to the given role.\n     * @param role The target role instance\n     * @param perspectiveId An existing perspective identifier\n     */\n    void setHomePerspective(Role role,\n                            String perspectiveId);\n\n    /**\n     * Set the identifier of the home perspective assigned to the given group.\n     * @param group The target group instance\n     * @param perspectiveId An existing perspective identifier\n     */\n    void setHomePerspective(Group group,\n                            String perspectiveId);\n\n    /**\n     * Get the identifier of the perspective this user is redirected by default.\n     * <p>\n     * <p>If the user is assigned with more than one role or group then the most priority one\n     * is taken.</p>\n     * @return An existing perspective identifier\n     * @see AuthorizationPolicy#getPriority(Role)\n     * @see AuthorizationPolicy#getPriority(Group)\n     */\n    String getHomePerspective(User user);\n\n    /**\n     * Gets the identifier of the default home perspective.\n     * <p>\n     * <p>This is the perspective that is returned for those roles/groups with no home perspective set.</p>\n     * @return An existing perspective identifier\n     */\n    String getHomePerspective();\n\n    /**\n     * Sets the identifier of the default home perspective.\n     * <p>\n     * <p>This is the perspective that is returned for those roles/groups with no gome perspective set.</p>\n     * @param perspectiveId An existing perspective identifier\n     */\n    void setHomePerspective(String perspectiveId);\n\n    /**\n     * Get the default permissions.\n     * <p>\n     * <p>These are he permissions that are returned for those roles/groups with no permissions set.</p>\n     * @return The permission collection\n     */\n    PermissionCollection getPermissions();\n\n    /**\n     * Add a single permission entry for a group.\n     * @param group The group instance\n     * @param permission A permission instance\n     */\n    void addPermission(Group group,\n                       Permission permission);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/AuthorizationResult.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum AuthorizationResult {\n\n    ACCESS_GRANTED(1),\n    ACCESS_ABSTAIN(0),\n    ACCESS_DENIED(-1);\n\n    private int result = 0;\n\n    AuthorizationResult() {\n        this(0);\n    }\n\n    AuthorizationResult(int result) {\n        this.result = result;\n    }\n\n    public AuthorizationResult invert() {\n        switch (result) {\n            case 1:\n                return ACCESS_DENIED;\n            case -1:\n                return ACCESS_GRANTED;\n            default:\n                return ACCESS_ABSTAIN;\n        }\n    }\n\n    @Override\n    public String toString() {\n        switch (result) {\n            case 1:\n                return \"ACCESS_GRANTED\";\n            case -1:\n                return \"ACCESS_DENIED\";\n            default:\n                return \"ACCESS_ABSTAIN\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/Permission.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\n/**\n * Interface for representing access to a system resource.\n * All permissions have a name (whose interpretation depends on the subclass),\n * as well as some functions for defining the semantics of the\n * particular Permission subclass.\n */\npublic interface Permission {\n\n    /**\n     * A string literal that identifies a resource or set of resources this permission object relates to.\n     * <p>It's up to every Permission implementation to define what's the set the name's format.</p>\n     */\n    String getName();\n\n    /**\n     * The authorization result or permission status.\n     * @return One of the available results: GRANT / DENY / ABSTAIN\n     */\n    AuthorizationResult getResult();\n\n    /**\n     * Change the authorzation result.\n     * @param result GRANT / DENY / ABSTAIN\n     */\n    void setResult(AuthorizationResult result);\n\n    /**\n     * Basically, \"permission p1 implies permission p2\" means that\n     * if one is granted permission p1, one is naturally granted permission p2.\n     * Thus, this is not an equality test, but rather more of a\n     * subset test.\n     * <p>\n     * <p>Both calls to {@link #impliesName(Permission)} & {@link #impliesResult(Permission)} return true.</p>\n     * @param other the permission to check against.\n     * @return true if the specified permission is implied by this object, false if not.\n     */\n    boolean implies(Permission other);\n\n    /**\n     * If \"permission p1 impliesName permission p2\" means that the feature represented by p1 is a superset of p2.\n     * @param other the permission to check against.\n     * @return true if the specified permission name is implied by this object, false if not.\n     */\n    boolean impliesName(Permission other);\n\n    /**\n     * If \"permission p1 impliesResult permission p2\" means that both permissions give the same result.\n     * @param other the permission to check against.\n     * @return true if the specified permission result is implied by this object, false if not.\n     */\n    boolean impliesResult(Permission other);\n\n    /**\n     * Creates an exact copy of this instance.\n     * @return A brand new Permission instance\n     */\n    Permission clone();\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/PermissionCheck.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\n/**\n * A check executed over a {@link Permission} instance.\n */\npublic interface PermissionCheck extends AuthorizationCheck {\n\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/PermissionCollection.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\nimport java.util.Collection;\n\n/**\n * Interface representing a collection of Permission objects.\n * <p>\n * <p>With a PermissionCollection, you can:\n * <ul>\n * <li> add a permission to the collection using the {@code add} method.\n * <li> check to see if a particular permission is implied in the\n * collection, using the {@code implies} method.\n * <li> enumerate all the permissions, using the {@code elements} method.\n * </ul>\n * @see Permission\n */\npublic interface PermissionCollection {\n\n    /**\n     * Adds a permission object to the current collection of permission objects.\n     * @param permissions the Permission objects to add.\n     */\n    PermissionCollection add(Permission... permissions);\n\n    /**\n     * Removes a permission object from the current collection of permission objects.\n     * @param permissions the Permission objects to remove.\n     */\n    PermissionCollection remove(Permission... permissions);\n\n    /**\n     * Gets a permission object matching the specified name.\n     * @param name The fully qualified name of the permission.\n     * @return A Permission instance or null if not found.\n     */\n    Permission get(String name);\n\n    /**\n     * Returns all the Permission objects in the collection.\n     * @return A collection of all the Permissions.\n     */\n    Collection<Permission> collection();\n\n    /**\n     * Checks to see if the specified permission is implied by\n     * the collection of Permission objects held in this PermissionCollection.\n     * @param permission the Permission object to compare.\n     * @return true if \"permission\" is implied by the permissions in\n     * the collection, false if not.\n     */\n    boolean implies(Permission permission);\n\n    /**\n     * It returns true provided this collection already contains a permission which implies by name\n     * (See {@link Permission#impliesName(Permission)}) the permission passed as a parameter.\n     * @param permission the permission to check\n     * @return true if the permission name is implied by this collection, false otherwise.\n     */\n    boolean impliesName(Permission permission);\n\n    /**\n     * Get all the permissions from this collection and the given one and puts them\n     * into a brand new collection instance. Any \"redundant\" permission instance\n     * (\"implied\" by other permissions in the collection) are left out from the\n     * outcome. Notice also, the {@code priority} parameter is taken into account in case\n     * the same permission is present in both collections.\n     * @param other the collection to merge.\n     * @param priority integer indicating what to do if the same permission is found in both collections:\n     * <ul>\n     * <li>0 = same priority (GRANTED permissions win by default)</li>\n     * <li>negative integer = this collection wins</li>\n     * <li>positive integer = the other collection wins</li>\n     * </ul>\n     * @return A collection containing the merge result.\n     */\n    PermissionCollection merge(PermissionCollection other,\n                               int priority);\n\n    /**\n     * Creates an exact copy of this instance.\n     * @return A brand new Permission instance\n     */\n    PermissionCollection clone();\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/PermissionManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.impl.authz.AuthorizationPolicyBuilder;\n\n/**\n * This is the main interface for checking permissions against User instances.\n * <p>\n * <p>This interface is backed by an {@code AuthorizationPolicy} instance which\n * holds all the permissions declarations.</p>\n * <p>\n * <p>Example:\n * <pre>\n *     &#064;Inject\n *     PermissionManager permissionManager;\n *\n *     &#064;Inject\n *     User user;\n *\n *     public boolean checkPermission() {\n *         Permission permission = permissionManager.createPermission(\"perspective.read.Home\", true);\n *         return permissionManager.checkPermission(permission, user);\n *     }\n * </pre>\n * </p>\n */\npublic interface PermissionManager {\n\n    /**\n     * Gets a builder reference in order to initialize a brand new AuthorizationPolicy instance.\n     */\n    AuthorizationPolicyBuilder newAuthorizationPolicy();\n\n    /**\n     * Gets the current authorization policy instance set.\n     */\n    AuthorizationPolicy getAuthorizationPolicy();\n\n    /**\n     * Changes the current authorization policy instance.\n     */\n    void setAuthorizationPolicy(AuthorizationPolicy authorizationPolicy);\n\n    /**\n     * Gets the default voting strategy.\n     * @return A {@link VotingStrategy} instance\n     */\n    VotingStrategy getDefaultVotingStrategy();\n\n    /**\n     * Set the default voting strategy to apply when checking permissions for users who have\n     * more than one role and/or group assigned.\n     * @param votingStrategy The voting strategy to apply when calling to\n     * {@link #checkPermission(Permission, User)}\n     */\n    void setDefaultVotingStrategy(VotingStrategy votingStrategy);\n\n    /**\n     * Gets the {@link VotingAlgorithm} implementation associated with the specified {@link VotingStrategy}.\n     * @param votingStrategy The voting strategy\n     * @return The voting algorithm instance\n     */\n    VotingAlgorithm getVotingAlgorithm(VotingStrategy votingStrategy);\n\n    /**\n     * Sets the {@link VotingAlgorithm} implementation to be used every time the given {@link VotingStrategy} is applied.\n     * @param votingStrategy The voting strategy\n     * @param votingAlgorithm The voting algorithm to apply when calling to {@link #checkPermission(Permission, User, VotingStrategy)}\n     * with the proper voting strategy.\n     */\n    void setVotingAlgorithm(VotingStrategy votingStrategy,\n                            VotingAlgorithm votingAlgorithm);\n\n    /**\n     * Creates a permission instance.\n     * @param name The name of the permission to create\n     * @param granted true=granted, false=denied\n     * @return A brand new permission instance\n     */\n    Permission createPermission(String name,\n                                boolean granted);\n\n    /**\n     * Creates a permission instance representing an action on a given resource..\n     * @param resource The resource instance\n     * @param action The action to check. If null then an \"access\" permission is created.\n     * The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.\n     * @return A permission instance\n     */\n    Permission createPermission(Resource resource,\n                                ResourceAction action,\n                                boolean granted);\n\n    /**\n     * Creates a permission instance representing an action on a given resource..\n     * @param resourceType The resource type\n     * @param action The action to check. If null then an \"access\" permission is created.\n     * The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.\n     * @return A permission instance\n     */\n    Permission createPermission(ResourceType resourceType,\n                                ResourceAction action,\n                                boolean granted);\n\n    /**\n     * Check if the given permission is granted to the specified user.\n     * <p>\n     * <p>NOTE: If voting is required (users with more than one role and/or group assigned) then\n     * the default voting strategy is used</p>\n     * @param permission The permission to check\n     * @param user The user instance\n     * @return The authorization result: GRANTED / DENIED / ABSTAIN\n     * @see AuthorizationResult\n     */\n    AuthorizationResult checkPermission(Permission permission,\n                                        User user);\n\n    /**\n     * Check if the given permission is granted to the specified user.\n     * @param permission The permission to check\n     * @param user The user instance\n     * @param votingStrategy The voting strategy to use when voting is required\n     * (users with more than one role and/or group assigned).\n     * If null then the default voting strategy is used.\n     * @return The authorization result: GRANTED / DENIED / ABSTAIN\n     */\n    AuthorizationResult checkPermission(Permission permission,\n                                        User user,\n                                        VotingStrategy votingStrategy);\n\n    /**\n     * Given a permission it tries to determine what is the resource the permission refers to.\n     * <p>\n     * <p>The resolution mechanism works only if the permission instance was created by a previous call\n     * to {@link #createPermission(Resource, ResourceAction, boolean)}. In such case the identifier of the\n     * {@link Resource} instance is the value returned.</p>\n     * @param permission The permission which resource id. has to be inferred.\n     * @return A resource id. or null if it can bot be inferred.\n     */\n    String resolveResourceId(Permission permission);\n\n    /**\n     * Get the permissions assigned to a given user.\n     * <p>\n     * <p>Usually, the user's permissions is obtained by mixing all the permissions assigned\n     * to each role and group instance the user belongs to.</p>\n     * <p>\n     * <p>Every interface implementation must take into account the voting strategy specified,\n     * which is used to resolve permission collision.</p>\n     * @param user The user instance\n     * @param votingStrategy The voting strategy\n     * @return The permission collection\n     * @see AuthorizationPolicy#getPriority(Role)\n     * @see AuthorizationPolicy#getPriority(Group)\n     */\n    PermissionCollection resolvePermissions(User user,\n                                            VotingStrategy votingStrategy);\n\n    /**\n     * Invalidate user related authorization data cached\n     * @param user user to invalidate cache\n     */\n    void invalidate(final User user);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/PermissionType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\n\n/**\n * A PermissionType provides factory services for the creation of permission instances\n * as well as services for controlling the access to Resource instances.\n */\npublic interface PermissionType {\n\n    /**\n     * An string identifier that acts as a unique identifier for the permission type.\n     * @return The permission type unique identifier\n     */\n    String getType();\n\n    /**\n     * Checks if the given permission name is supported by this type. That means basically that\n     * such name does follow a specific nomenclature for the formatting of its permission names.\n     * @param name The permission name to check\n     * @return true is such permission is supported or false otherwise.\n     */\n    boolean supportsPermission(String name);\n\n    /**\n     * Creates a permission instance.\n     * @param name The name of the permission to create.\n     * @param granted true=granted, false=denied\n     * @return A permission instance\n     */\n    Permission createPermission(String name,\n                                boolean granted);\n\n    /**\n     * Creates a permission instance representing a \"global\" action that can be applied to any resource instance\n     * (for instance, \"edit an invoice\") or an action that is not related to any specific instance (for instance,\n     * \"create a new invoice\")\n     * @param resourceType The resource type\n     * @param action The action to check. If null then an \"access\" permission is created.\n     * The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.\n     * @return A permission instance\n     */\n    Permission createPermission(ResourceType resourceType,\n                                ResourceAction action,\n                                boolean granted);\n\n    /**\n     * Creates a permission instance representing an action on a given resource..\n     * @param resource The resource instance\n     * @param action The action to check. If null then an \"access\" permission is created.\n     * The term access refers to the ability to reach, read, view ... the resource, depending on the resource type.\n     * @return A permission instance\n     */\n    Permission createPermission(Resource resource,\n                                ResourceAction action,\n                                boolean granted);\n\n    /**\n     * Given a permission it tries to determine what is the resource the permission refers to.\n     * <p>\n     * <p>The resolution mechanism works only if the permission instance was created by a previous call\n     * to {@link #createPermission(Resource, ResourceAction, boolean)}. In such case the identifier of the\n     * {@link Resource} instance is the value returned.</p>\n     * @param permission The permission which resource id. has to be inferred.\n     * @return A resource id. or null if it can bot be inferred.\n     */\n    String resolveResourceId(Permission permission);\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/PermissionTypeRegistry.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.authz;\n\n/**\n * A registry of permission types. Every type is uniquely identified in the registry.\n */\npublic interface PermissionTypeRegistry {\n\n    /**\n     * Register a permission type. The {@link PermissionType#getType()} is used as a unique key within the registry.\n     */\n    void register(PermissionType type);\n\n    /**\n     * Get a previously registed permission type given its unique identifier.\n     */\n    PermissionType get(String type);\n\n    /**\n     * Get the first permission type that matches the given name.\n     * <p>\n     * <p>It's always up to every permission type to define what are the valid format for its permission names.</p>\n     * @see PermissionType#supportsPermission(String)\n     */\n    PermissionType resolve(String name);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/ResourceCheck.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport org.uberfire.security.ResourceAction;\n\n/**\n * A security check executed over a {@link org.uberfire.security.Resource} instance.\n */\npublic interface ResourceCheck<C extends ResourceCheck> extends AuthorizationCheck<C> {\n\n    /**\n     * Specifies the action to check\n     * @param action The action to check\n     */\n    C action(ResourceAction action);\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/VotingAlgorithm.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz;\n\nimport org.uberfire.security.impl.authz.AffirmativeBasedVoter;\nimport org.uberfire.security.impl.authz.ConsensusBasedVoter;\nimport org.uberfire.security.impl.authz.UnanimousBasedVoter;\n\n/**\n * Voting algorithms are used by the {@link PermissionManager} in order to determine what is the\n * winning result when the user is assigned with more than one role or group.\n * <p>\n * <p>See:</p>\n * <ul>\n * <li>{@link UnanimousBasedVoter}</li>\n * <li>{@link ConsensusBasedVoter}</li>\n * <li>{@link AffirmativeBasedVoter}</li>\n * </ul>\n */\npublic interface VotingAlgorithm {\n\n    /**\n     * It get a list of results as input and votes for a winning result.\n     */\n    AuthorizationResult vote(Iterable<AuthorizationResult> results);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/authz/adapter/GroupsAdapter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.authz.adapter;\n\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.Group;\n\npublic interface GroupsAdapter {\n\n    List<Group> getGroups(final String principalName,\n                          final Object subject);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/crypt/CryptProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.crypt;\n\npublic interface CryptProvider {\n\n    String encrypt(final String content,\n                   final Object salt);\n\n    String decrypt(final String content,\n                   final Object salt);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/AffirmativeBasedVoter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.VotingAlgorithm;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n/**\n * Algorithm implementation of the {@link VotingStrategy#AFFIRMATIVE} strategy.\n */\npublic class AffirmativeBasedVoter implements VotingAlgorithm {\n\n    @Override\n    public AuthorizationResult vote(final Iterable<AuthorizationResult> results) {\n        checkNotNull(\"results\",\n                     results);\n        for (final AuthorizationResult currentResult : results) {\n            if (currentResult.equals(ACCESS_GRANTED)) {\n                return ACCESS_GRANTED;\n            }\n        }\n        return ACCESS_DENIED;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/AuthorizationPolicyBuilder.java",
    "content": "/**\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n * <p>\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n * <p>\n * http://www.apache.org/licenses/LICENSE-2.0\n * <p>\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionType;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\n\n/**\n * Fluent API for the creation of AuthorizationPolicy instances. Example:\n *\n * <pre>\n * AuthorizationPolicy policy = permissionManager.newAuthorizationPolicy()\n * .role(\"role1\", 3).permission(\"resource.read\", true)\n * .role(\"role2\", 2).permission(\"resource.read\", false)\n * .role(\"role3\", 1).permission(\"resource.read.1\", true)\n * .build();\n * </pre>\n */\npublic class AuthorizationPolicyBuilder {\n\n    private PermissionTypeRegistry permissionTypeRegistry;\n    private DefaultAuthorizationPolicy policy = new DefaultAuthorizationPolicy();\n    private Map<String, Role> roles = new HashMap<>();\n    private Map<String, Group> groups = new HashMap<>();\n\n    private transient Role _currentRole = null;\n    private transient Group _currentGroup = null;\n\n    public AuthorizationPolicyBuilder(PermissionTypeRegistry permissionTypeRegistry) {\n        this.permissionTypeRegistry = permissionTypeRegistry;\n    }\n\n    public AuthorizationPolicyBuilder bydefault() {\n        _currentRole = null;\n        _currentGroup = null;\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder role(String role) {\n        _currentGroup = null;\n        _currentRole = roles.get(role);\n        if (_currentRole == null) {\n            roles.put(role,\n                      _currentRole = new RoleImpl(role));\n        }\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder role(String role,\n                                           String home) {\n        role(role);\n        home(home);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder role(String role,\n                                           int priority) {\n        role(role);\n        priority(priority);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder role(String role,\n                                           int priority,\n                                           String home) {\n        role(role);\n        priority(priority);\n        home(home);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder group(String group) {\n        _currentRole = null;\n        _currentGroup = groups.get(group);\n        if (_currentGroup == null) {\n            groups.put(group,\n                       _currentGroup = new GroupImpl(group));\n        }\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder group(String group,\n                                            int priority,\n                                            String home) {\n        group(group);\n        priority(priority);\n        home(home);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder group(String group,\n                                            int priority) {\n        group(group);\n        priority(priority);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder group(String group,\n                                            String home) {\n        group(group);\n        home(home);\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder permission(String name,\n                                                 Boolean granted) {\n        PermissionType type = permissionTypeRegistry.resolve(name);\n        Permission permission = type.createPermission(name,\n                                                      granted);\n        if (_currentRole != null) {\n            policy.addPermission(_currentRole,\n                                 permission);\n        } else if (_currentGroup != null) {\n            policy.addPermission(_currentGroup,\n                                 permission);\n        } else {\n            policy.addPermission(permission);\n        }\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder description(String description) {\n        if (_currentRole != null) {\n            policy.setRoleDescription(_currentRole,\n                                      description);\n        } else if (_currentGroup != null) {\n            policy.setGroupDescription(_currentGroup,\n                                       description);\n        } else {\n            throw new IllegalStateException(\"Invoke role() or group() first\");\n        }\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder priority(int priority) {\n        if (_currentRole != null) {\n            policy.setPriority(_currentRole,\n                               priority);\n        } else if (_currentGroup != null) {\n            policy.setPriority(_currentGroup,\n                               priority);\n        } else {\n            throw new IllegalStateException(\"Invoke role() or group() first\");\n        }\n        return this;\n    }\n\n    public AuthorizationPolicyBuilder home(String homePerspective) {\n        if (_currentRole != null) {\n            policy.setHomePerspective(_currentRole,\n                                      homePerspective);\n        } else if (_currentGroup != null) {\n            policy.setHomePerspective(_currentGroup,\n                                      homePerspective);\n        } else {\n            policy.setHomePerspective(homePerspective);\n        }\n        return this;\n    }\n\n    public AuthorizationPolicy build() {\n        return policy;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/ConsensusBasedVoter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.VotingAlgorithm;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n/**\n * Algorithm implementation of the {@link VotingStrategy#CONSENSUS} strategy.\n */\n//TODO: needs review. use a minimum consensus percentage?\npublic class ConsensusBasedVoter implements VotingAlgorithm {\n\n    @Override\n    public AuthorizationResult vote(final Iterable<AuthorizationResult> results) {\n        checkNotNull(\"results\",\n                     results);\n        for (final AuthorizationResult currentResult : results) {\n            if (currentResult.equals(ACCESS_DENIED)) {\n                return ACCESS_DENIED;\n            }\n        }\n        return ACCESS_GRANTED;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultAuthorizationEntry.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.uberfire.security.authz.PermissionCollection;\n\n@Portable\npublic class DefaultAuthorizationEntry {\n\n    public static final int DEFAULT_PRIORITY = -100;\n    private String description = null;\n    private Role role = null;\n    private Group group = null;\n    private Integer priority = DEFAULT_PRIORITY;\n    private String homePerspective = null;\n    private PermissionCollection permissions = new DefaultPermissionCollection();\n\n    public DefaultAuthorizationEntry() {\n    }\n\n    public DefaultAuthorizationEntry(Role role) {\n        this.role = role;\n    }\n\n    public DefaultAuthorizationEntry(Group group) {\n        this.group = group;\n    }\n\n    public Role getRole() {\n        return role;\n    }\n\n    public void setRole(Role role) {\n        this.role = role;\n    }\n\n    public Group getGroup() {\n        return group;\n    }\n\n    public void setGroup(Group group) {\n        this.group = group;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public Integer getPriority() {\n        return priority;\n    }\n\n    public void setPriority(int priority) {\n        this.priority = priority;\n    }\n\n    public String getHomePerspective() {\n        return homePerspective;\n    }\n\n    public void setHomePerspective(String homePerspective) {\n        this.homePerspective = homePerspective;\n    }\n\n    public PermissionCollection getPermissions() {\n        return permissions;\n    }\n\n    public void setPermissions(PermissionCollection permissions) {\n        this.permissions = permissions;\n    }\n\n    public DefaultAuthorizationEntry cloneInstance() {\n        DefaultAuthorizationEntry clone = new DefaultAuthorizationEntry();\n        clone.description = description;\n        clone.role = role;\n        clone.group = group;\n        clone.priority = priority;\n        clone.homePerspective = homePerspective;\n        clone.permissions = permissions.clone();\n        return clone;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        if (role != null) {\n            out.append(role.getName()).append(\" \");\n        }\n        if (group != null) {\n            out.append(group.getName()).append(\" \");\n        }\n        if (priority != 0) {\n            out.append(priority).append(\" \");\n        }\n        if (homePerspective != null) {\n            out.append(homePerspective).append(\" \");\n        }\n        out.append(\"\\n\");\n        out.append(permissions);\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultAuthorizationManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.*;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCheck;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.ResourceCheck;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n@ApplicationScoped\npublic class DefaultAuthorizationManager implements AuthorizationManager {\n\n    private PermissionManager permissionManager;\n\n    public DefaultAuthorizationManager() {\n    }\n\n    @Inject\n    public DefaultAuthorizationManager(PermissionManager permissionManager) {\n        this.permissionManager = permissionManager;\n    }\n\n    public boolean authorize(Resource resource,\n                             User user) {\n        return authorize(resource,\n                         null,\n                         user,\n                         null);\n    }\n\n    @Override\n    public boolean authorize(Resource resource,\n                             ResourceAction action,\n                             User user) {\n        return authorize(resource,\n                         action,\n                         user,\n                         null);\n    }\n\n    @Override\n    public boolean authorize(Resource resource,\n                             Collection<Contributor> contributors,\n                             ResourceAction action,\n                             User user) {\n        boolean contributorAccess = false;\n        if (resource instanceof ContributorResource) {\n            ContributorResource contributorResource = (ContributorResource) resource;\n            contributorAccess = checkContributor(contributorResource,   user);\n        }\n\n        return authorize(resource,\n                action,\n                user,\n                null) || contributorAccess;\n    }\n\n    private boolean checkContributor(ContributorResource contributorResource, User user) {\n        return contributorResource.getContributors().stream().anyMatch(c -> c.getUsername().equals(user.getIdentifier()));\n    }\n\n    @Override\n    public boolean authorize(ResourceType resourceType,\n                             ResourceAction action,\n                             User user) {\n        return authorize(resourceType,\n                         action,\n                         user,\n                         null);\n    }\n\n    @Override\n    public boolean authorize(Resource resource,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        return authorize(resource,\n                         null,\n                         user,\n                         votingStrategy);\n    }\n\n    @Override\n    public boolean authorize(Resource resource,\n                             ResourceAction action,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        checkNotNull(\"resource\",\n                     resource);\n        checkNotNull(\"subject\",\n                     user);\n\n        // A resource may depend on others\n        List<Resource> deps = resource.getDependencies();\n        if (deps != null && !deps.isEmpty()) {\n\n            // One dep is accessible\n            for (Resource dep : ensureIterable(deps)) {\n                boolean itemAccess = authorize(dep,\n                                               action,\n                                               user);\n                if (itemAccess) {\n                    return true;\n                }\n            }\n            // All deps denied\n            return false;\n        }\n\n        // Ask the permission manager about the given action\n        Permission p = permissionManager.createPermission(resource,\n                                                          action,\n                                                          true);\n        return authorize(p,\n                         user,\n                         votingStrategy);\n    }\n\n    @Override\n    public boolean authorize(ResourceType resourceType,\n                             ResourceAction action,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        // Ask the permission manager about the given action\n        Permission p = permissionManager.createPermission(resourceType,\n                                                          action,\n                                                          true);\n        return authorize(p,\n                         user,\n                         votingStrategy);\n    }\n\n    @Override\n    public boolean authorize(String permission,\n                             User user) {\n        return authorize(permission,\n                         user,\n                         null);\n    }\n\n    @Override\n    public boolean authorize(Permission permission,\n                             User user) {\n        return authorize(permission,\n                         user,\n                         null);\n    }\n\n    @Override\n    public boolean authorize(String permission,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        Permission p = permissionManager.createPermission(permission,\n                                                          true);\n        return authorize(p,\n                         user,\n                         votingStrategy);\n    }\n\n    @Override\n    public boolean authorize(Permission permission,\n                             User user,\n                             VotingStrategy votingStrategy) {\n\n        // If granted or abstain the return true. Reasons to abstain:\n        // - no security policy defined\n        // - no explicit permissions assigned\n        AuthorizationResult result = permissionManager.checkPermission(permission,\n                                                                       user,\n                                                                       votingStrategy);\n        return !AuthorizationResult.ACCESS_DENIED.equals(result);\n    }\n\n    @Override\n    public ResourceCheck check(Resource target,\n                               User user) {\n        return check(target,\n                     user,\n                     null);\n    }\n\n    @Override\n    public ResourceCheck check(Resource target,\n                               User user,\n                               VotingStrategy votingStrategy) {\n        return new ResourceCheckImpl(this,\n                                     target,\n                                     user,\n                                     votingStrategy);\n    }\n\n    @Override\n    public ResourceCheck check(ResourceType target,\n                               User user) {\n        return check(target,\n                     user,\n                     null);\n    }\n\n    @Override\n    public ResourceCheck check(ResourceType target,\n                               User user,\n                               VotingStrategy votingStrategy) {\n        return new ResourceCheckImpl(this,\n                                     target,\n                                     user,\n                                     votingStrategy);\n    }\n\n    @Override\n    public PermissionCheck check(String permission,\n                                 User user) {\n        return check(permission,\n                     user,\n                     null);\n    }\n\n    @Override\n    public PermissionCheck check(String permission,\n                                 User user,\n                                 VotingStrategy votingStrategy) {\n        return new PermissionCheckImpl(permissionManager,\n                                       permission,\n                                       user,\n                                       votingStrategy);\n    }\n\n    @Override\n    public void invalidate(final User user) {\n        permissionManager.invalidate(user);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultAuthorizationPolicy.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\n\n@Portable\npublic class DefaultAuthorizationPolicy implements AuthorizationPolicy {\n\n    DefaultAuthorizationEntry defaultEntry = new DefaultAuthorizationEntry();\n    private final Map<Group, DefaultAuthorizationEntry> groupEntryMap = new HashMap<>();\n    private final Map<Role, DefaultAuthorizationEntry> rolesEntryMap = new HashMap<>();\n\n    public DefaultAuthorizationPolicy() {\n    }\n\n    protected DefaultAuthorizationEntry registerAuthzEntry(DefaultAuthorizationEntry entry) {\n        if (entry.getGroup() != null) {\n            groupEntryMap.put(entry.getGroup(), entry);\n        }\n        if (entry.getRole() != null) {\n            rolesEntryMap.put(entry.getRole(), entry);\n        }\n        return entry;\n    }\n\n    protected DefaultAuthorizationEntry getAuthzEntry(Role role) {\n        if (rolesEntryMap.containsKey(role)) {\n            return rolesEntryMap.get(role);\n        }\n        DefaultAuthorizationEntry entry = new DefaultAuthorizationEntry(role);\n        entry.setRole(role);\n        return registerAuthzEntry(entry);\n    }\n\n    protected DefaultAuthorizationEntry getAuthzEntry(Group group) {\n        if (groupEntryMap.containsKey(group)) {\n            return groupEntryMap.get(group);\n        }\n        DefaultAuthorizationEntry entry = new DefaultAuthorizationEntry(group);\n        entry.setGroup(group);\n        return registerAuthzEntry(entry);\n    }\n\n    @Override\n    public Set<Role> getRoles() {\n        return rolesEntryMap.keySet();\n    }\n\n    @Override\n    public Set<Group> getGroups() {\n        return groupEntryMap.keySet();\n    }\n\n    @Override\n    public String getRoleDescription(Role role) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        return entry.getDescription();\n    }\n\n    @Override\n    public void setRoleDescription(Role role,\n                                   String description) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        entry.setDescription(description);\n    }\n\n    @Override\n    public String getGroupDescription(Group group) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        return entry.getDescription();\n    }\n\n    @Override\n    public void setGroupDescription(Group group,\n                                    String description) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        entry.setDescription(description);\n    }\n\n    @Override\n    public int getPriority(Role role) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        Integer priority = entry.getPriority();\n        return priority != null ? priority : defaultEntry.getPriority();\n    }\n\n    @Override\n    public int getPriority(Group group) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        Integer priority = entry.getPriority();\n        return priority != null ? priority : defaultEntry.getPriority();\n    }\n\n    @Override\n    public void setPriority(Role role,\n                            int priority) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        entry.setPriority(priority);\n    }\n\n    @Override\n    public void setPriority(Group group,\n                            int priority) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        entry.setPriority(priority);\n    }\n\n    @Override\n    public PermissionCollection getPermissions(Role role) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        return entry.getPermissions().merge(defaultEntry.getPermissions(), -1);\n    }\n\n    @Override\n    public PermissionCollection getPermissions(Group group) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        return entry.getPermissions().merge(defaultEntry.getPermissions(), -1);\n    }\n\n    public void addPermission(Permission permission) {\n        defaultEntry.getPermissions().add(permission);\n    }\n\n    public void addPermission(Role role,\n                              Permission permission) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        entry.getPermissions().add(permission);\n    }\n\n    @Override\n    public void addPermission(Group group,\n                              Permission permission) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        entry.getPermissions().add(permission);\n    }\n\n    public void setPermissions(Role role,\n                               PermissionCollection collection) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        entry.setPermissions(collection);\n    }\n\n    public void setPermissions(Group group,\n                               PermissionCollection collection) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        entry.setPermissions(collection);\n    }\n\n    @Override\n    public void setHomePerspective(Role role,\n                                   String perspective) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        entry.setHomePerspective(perspective);\n    }\n\n    @Override\n    public void setHomePerspective(Group group,\n                                   String perspective) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        entry.setHomePerspective(perspective);\n    }\n\n    @Override\n    public String getHomePerspective(Role role) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(role);\n        String home = entry.getHomePerspective();\n        return home != null ? home : defaultEntry.getHomePerspective();\n    }\n\n    @Override\n    public String getHomePerspective(Group group) {\n        DefaultAuthorizationEntry entry = getAuthzEntry(group);\n        String home = entry.getHomePerspective();\n        return home != null ? home : defaultEntry.getHomePerspective();\n    }\n\n    @Override\n    public String getHomePerspective(User user) {\n        String lastHome = getHomePerspective();\n        int lastPriority = Integer.MIN_VALUE;\n\n        if (user.getRoles() != null) {\n            for (Role role : user.getRoles()) {\n                String home = getHomePerspective(role);\n                if (home != null) {\n                    int priority = getPriority(role);\n                    if (lastHome == null || priority > lastPriority) {\n                        lastHome = home;\n                        lastPriority = priority;\n                    }\n                }\n            }\n        }\n        if (user.getGroups() != null) {\n            for (Group group : user.getGroups()) {\n                String home = getHomePerspective(group);\n                if (home != null) {\n                    int priority = getPriority(group);\n                    if (lastHome == null || priority > lastPriority) {\n                        lastHome = home;\n                        lastPriority = priority;\n                    }\n                }\n            }\n        }\n        return lastHome;\n    }\n\n    @Override\n    public String getHomePerspective() {\n        return defaultEntry.getHomePerspective();\n    }\n\n    @Override\n    public void setHomePerspective(String perspectiveId) {\n        defaultEntry.setHomePerspective(perspectiveId);\n    }\n\n    @Override\n    public PermissionCollection getPermissions() {\n        return defaultEntry.getPermissions();\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        rolesEntryMap.keySet().forEach(e -> out.append(e.toString()).append(\"\\n\"));\n        groupEntryMap.keySet().forEach(e -> out.append(e.toString()).append(\"\\n\"));\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultAuthzResultCache.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\n\npublic class DefaultAuthzResultCache {\n\n    final Map<Permission, Map<String, AuthorizationResult>> internal = new HashMap<>();\n\n    public AuthorizationResult get(final User user,\n                                   final Permission permission) {\n        Map<String, AuthorizationResult> result = internal.get(permission);\n        if (result == null) {\n            return null;\n        }\n        return result.get(user.getIdentifier());\n    }\n\n    public void put(final User user,\n                    final Permission permission,\n                    final AuthorizationResult authzResult) {\n        if (!internal.containsKey(permission)) {\n            internal.put(permission,\n                         new HashMap<>());\n        }\n        final Map<String, AuthorizationResult> result = internal.get(permission);\n        AuthorizationResult knowValue = result.get(user.getIdentifier());\n        if (!(result.containsKey(user.getIdentifier()) && authzResult.equals(knowValue))) {\n            result.put(user.getIdentifier(),\n                       authzResult);\n        }\n    }\n\n    public int size(User user) {\n        int count = 0;\n        for (Map<String, AuthorizationResult> userCache : internal.values()) {\n            if (userCache.containsKey(user.getIdentifier())) {\n                count++;\n            }\n        }\n        return count;\n    }\n\n    public void clear() {\n        internal.clear();\n    }\n\n    public void invalidate(final User user) {\n        if (user == null || user.getIdentifier() == null || user.getIdentifier().isEmpty()) {\n            return;\n        }\n        for (Map<String, AuthorizationResult> entry : internal.values()) {\n            entry.remove(user.getIdentifier());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultPermissionCollection.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.TreeSet;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\n\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n/**\n * A collection where the permissions are ordered by name.\n */\n@Portable\npublic class DefaultPermissionCollection implements PermissionCollection {\n\n    private TreeSet<Permission> permissionSet = new TreeSet<>();\n\n    public DefaultPermissionCollection() {\n    }\n\n    @Override\n    public Collection<Permission> collection() {\n        return permissionSet;\n    }\n\n    @Override\n    public PermissionCollection add(Permission... permissions) {\n        for (Permission p : permissions) {\n\n            // Remove it if already exists\n            Permission existing = get(p.getName());\n            if (existing != null) {\n                remove(p);\n            }\n            // Avoid redundancy\n            if (!implies(p)) {\n                permissionSet.add(p);\n            }\n        }\n        return this;\n    }\n\n    @Override\n    public PermissionCollection remove(Permission... permissions) {\n        for (Permission p : permissions) {\n            permissionSet.remove(p);\n        }\n        return this;\n    }\n\n    @Override\n    public Permission get(String name) {\n        for (Permission p : permissionSet) {\n            if (equalsName(name,\n                           p.getName())) {\n                return p;\n            }\n        }\n        return null;\n    }\n\n    protected boolean equalsName(String s1,\n                                 String s2) {\n        return (s1 == null && s2 == null) || (s1 != null && s1.equals(s2));\n    }\n\n    @Override\n    public boolean implies(Permission permission) {\n        for (Permission p : permissionSet) {\n            if (p.implies(permission)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public boolean impliesName(Permission permission) {\n        for (Permission p : permissionSet) {\n            if (p.impliesName(permission)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public PermissionCollection merge(PermissionCollection other,\n                                      int priority) {\n        if (other == null || other.collection().isEmpty()) {\n            return this;\n        }\n\n        PermissionCollection result = priority > 0 ? other.clone() : this.clone();\n        PermissionCollection target = priority > 0 ? this : other;\n\n        for (Permission p : target.collection()) {\n            addToCollectionIf(result,\n                              p,\n                              priority == 0);\n        }\n        return result;\n    }\n\n    /**\n     * Add the given permission to the result only when some of the following two conditions are met:\n     * <br/>\n     * <br/> 1. The permission does not exit in the target collection and is not implied by name either</li>\n     * <br/> 2. The permission is granted and the parameter grantedWins = true\n     * @param result The collection where the permission shall be added\n     * @param p The permission to add to the result\n     * @param grantedWins If true then granted permission are always added to the result\n     */\n    private void addToCollectionIf(PermissionCollection result,\n                                   Permission p,\n                                   boolean grantedWins) {\n        Permission existing = result.get(p.getName());\n\n        if (existing == null && !result.impliesName(p)) {\n            result.add(p);\n        } else if (grantedWins && ACCESS_GRANTED.equals(p.getResult())) {\n            Iterator<Permission> it = result.collection().iterator();\n            while (it.hasNext()) {\n                Permission next = it.next();\n                if (p.impliesName(next)) {\n                    it.remove();\n                }\n            }\n            result.add(p);\n        }\n    }\n\n    public DefaultPermissionCollection clone() {\n        DefaultPermissionCollection clone = new DefaultPermissionCollection();\n        for (Permission p : permissionSet) {\n            clone.add(p.clone());\n        }\n        return clone;\n    }\n\n    public PermissionCollection invert(Permission target) {\n        target.setResult(target.getResult().invert());\n\n        // After inverting the permission ensure no implied permissions are left\n        Iterator<Permission> it = permissionSet.iterator();\n        while (it.hasNext()) {\n            Permission p = it.next();\n            if (!target.equals(p) && target.implies(p)) {\n                it.remove();\n            }\n        }\n        return this;\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        Iterator<Permission> it = permissionSet.iterator();\n        while (it.hasNext()) {\n            Permission p = it.next();\n            out.append(p).append(\"\\n\");\n        }\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultPermissionManager.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.PermissionType;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\nimport org.uberfire.security.authz.VotingAlgorithm;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_ABSTAIN;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n@ApplicationScoped\npublic class DefaultPermissionManager implements PermissionManager {\n\n    private PermissionTypeRegistry permissionTypeRegistry;\n    private AuthorizationPolicy authorizationPolicy = new DefaultAuthorizationPolicy();\n    private DefaultAuthzResultCache cache;\n    private VotingStrategy defaultVotingStrategy = VotingStrategy.PRIORITY;\n    private Map<VotingStrategy, VotingAlgorithm> votingAlgorithmMap = new HashMap<>();\n    private Map<String, PermissionCollection> permissionCollectionCache = new HashMap<>();\n\n    @Inject\n    public DefaultPermissionManager(PermissionTypeRegistry permissionTypeRegistry) {\n        this(permissionTypeRegistry,\n             new DefaultAuthzResultCache());\n    }\n\n    public DefaultPermissionManager() {\n        this(new DefaultPermissionTypeRegistry(),\n             new DefaultAuthzResultCache());\n    }\n\n    public DefaultPermissionManager(PermissionTypeRegistry permissionTypeRegistry,\n                                    DefaultAuthzResultCache cache) {\n        this.permissionTypeRegistry = permissionTypeRegistry;\n        this.cache = cache;\n        setVotingAlgorithm(VotingStrategy.AFFIRMATIVE,\n                           new AffirmativeBasedVoter());\n        setVotingAlgorithm(VotingStrategy.CONSENSUS,\n                           new ConsensusBasedVoter());\n        setVotingAlgorithm(VotingStrategy.UNANIMOUS,\n                           new UnanimousBasedVoter());\n    }\n\n    public AuthorizationPolicy getAuthorizationPolicy() {\n        return authorizationPolicy;\n    }\n\n    public void setAuthorizationPolicy(AuthorizationPolicy authorizationPolicy) {\n        this.authorizationPolicy = authorizationPolicy != null ? authorizationPolicy : new DefaultAuthorizationPolicy();\n        this.cache.clear();\n        this.permissionCollectionCache.clear();\n    }\n\n    @Override\n    public AuthorizationPolicyBuilder newAuthorizationPolicy() {\n        return new AuthorizationPolicyBuilder(permissionTypeRegistry);\n    }\n\n    @Override\n    public VotingStrategy getDefaultVotingStrategy() {\n        return defaultVotingStrategy;\n    }\n\n    @Override\n    public void setDefaultVotingStrategy(VotingStrategy votingStrategy) {\n        defaultVotingStrategy = votingStrategy;\n    }\n\n    public VotingAlgorithm getVotingAlgorithm(VotingStrategy votingStrategy) {\n        return votingAlgorithmMap.get(votingStrategy);\n    }\n\n    public void setVotingAlgorithm(VotingStrategy votingStrategy,\n                                   VotingAlgorithm votingAlgorithm) {\n        votingAlgorithmMap.put(votingStrategy,\n                               votingAlgorithm);\n    }\n\n    @Override\n    public Permission createPermission(String name,\n                                       boolean granted) {\n        PermissionType permissionType = permissionTypeRegistry.resolve(name);\n        return permissionType.createPermission(name,\n                                               granted);\n    }\n\n    @Override\n    public Permission createPermission(Resource resource,\n                                       ResourceAction action,\n                                       boolean granted) {\n\n        // Does the resource have a type?\n\n        // YES => check the resource action f.i: \"project.read.myprojectid\"\n        if (resource.getResourceType() != null && !resource.isType(ResourceType.UNKNOWN.getName())) {\n            PermissionType permissionType = permissionTypeRegistry.resolve(resource.getResourceType().getName());\n            return permissionType.createPermission(resource,\n                                                   action,\n                                                   granted);\n        }\n        // NO => just check the resource identifier\n        return createPermission(resource.getIdentifier(),\n                                granted);\n    }\n\n    @Override\n    public Permission createPermission(ResourceType resourceType,\n                                       ResourceAction action,\n                                       boolean granted) {\n        PermissionType permissionType = permissionTypeRegistry.resolve(resourceType.getName());\n        return permissionType.createPermission(resourceType,\n                                               action,\n                                               granted);\n    }\n\n    @Override\n    public AuthorizationResult checkPermission(Permission permission,\n                                               User user) {\n        return checkPermission(permission,\n                               user,\n                               defaultVotingStrategy);\n    }\n\n    @Override\n    public AuthorizationResult checkPermission(Permission permission,\n                                               User user,\n                                               VotingStrategy votingStrategy) {\n\n        if (authorizationPolicy == null || permission == null) {\n            return ACCESS_ABSTAIN;\n        }\n        AuthorizationResult result = cache.get(user,\n                                               permission);\n        if (result == null) {\n            result = _checkPermission(permission,\n                                      user,\n                                      votingStrategy == null ? defaultVotingStrategy : votingStrategy);\n            cache.put(user,\n                      permission,\n                      result);\n        }\n        return result;\n    }\n\n    protected AuthorizationResult _checkPermission(Permission permission,\n                                                   User user,\n                                                   VotingStrategy votingStrategy) {\n\n        if (VotingStrategy.PRIORITY.equals(votingStrategy)) {\n            PermissionCollection userPermissions = resolvePermissions(user,\n                                                                      VotingStrategy.PRIORITY);\n            return _checkPermission(permission,\n                                    userPermissions);\n        } else {\n            List<AuthorizationResult> permList = _checkRoleAndGroupPermissions(permission,\n                                                                               user);\n            VotingAlgorithm votingAlgorithm = votingAlgorithmMap.get(votingStrategy);\n            return votingAlgorithm.vote(permList);\n        }\n    }\n\n    protected List<AuthorizationResult> _checkRoleAndGroupPermissions(Permission permission,\n                                                                      User user) {\n        List<AuthorizationResult> result = new ArrayList<>();\n        if (user.getRoles() != null) {\n            for (Role role : user.getRoles()) {\n                PermissionCollection collection = authorizationPolicy.getPermissions(role);\n                AuthorizationResult _partialResult = _checkPermission(permission,\n                                                                      collection);\n                result.add(_partialResult);\n            }\n        }\n        if (user.getGroups() != null) {\n            for (Group group : user.getGroups()) {\n                PermissionCollection collection = authorizationPolicy.getPermissions(group);\n                AuthorizationResult _partialResult = _checkPermission(permission,\n                                                                      collection);\n                result.add(_partialResult);\n            }\n        }\n        return result;\n    }\n\n    protected AuthorizationResult _checkPermission(Permission permission,\n                                                   PermissionCollection collection) {\n        if (collection == null) {\n            return ACCESS_ABSTAIN;\n        }\n        Permission existing = collection.get(permission.getName());\n        if (existing != null) {\n            return existing.getResult().equals(permission.getResult()) ? ACCESS_GRANTED : ACCESS_DENIED;\n        }\n        if (collection.implies(permission)) {\n            return ACCESS_GRANTED;\n        }\n        Permission inverted = permission.clone();\n        inverted.setResult(inverted.getResult().invert());\n        if (collection.implies(inverted)) {\n            return ACCESS_DENIED;\n        }\n        return ACCESS_ABSTAIN;\n    }\n\n    @Override\n    public String resolveResourceId(Permission permission) {\n        PermissionType permissionType = permissionTypeRegistry.resolve(permission.getName());\n        return permissionType.resolveResourceId(permission);\n    }\n\n    @Override\n    public PermissionCollection resolvePermissions(User user,\n                                                   VotingStrategy votingStrategy) {\n        if (user == null) {\n            return new DefaultPermissionCollection();\n        }\n        switch (votingStrategy) {\n            case AFFIRMATIVE:\n                return resolvePermissionsAffirmative(user);\n            case CONSENSUS:\n                return resolvePermissionsConsensus(user);\n            case UNANIMOUS:\n                return resolvePermissionsUnanimous(user);\n            default:\n                return resolvePermissionsPriority(user);\n        }\n    }\n\n    @Override\n    public void invalidate(final User user) {\n        cache.invalidate(user);\n    }\n\n    private PermissionCollection resolvePermissionsAffirmative(User user) {\n        // TODO\n        PermissionCollection result = new DefaultPermissionCollection();\n        return result;\n    }\n\n    private PermissionCollection resolvePermissionsConsensus(User user) {\n        // TODO\n        PermissionCollection result = new DefaultPermissionCollection();\n        return result;\n    }\n\n    private PermissionCollection resolvePermissionsUnanimous(User user) {\n        // TODO\n        PermissionCollection result = new DefaultPermissionCollection();\n        return result;\n    }\n\n    /**\n     * Get all the permissions assigned to any of the user's roles/groups plus the default permissions\n     * ({@link AuthorizationPolicy#getPermissions()}) and it creates a single permission collection where\n     * the permission are added by priority.\n     *\n     * @param user The target user\n     * @return An unified permission collection\n     */\n    private PermissionCollection resolvePermissionsPriority(User user) {\n        if (authorizationPolicy == null) {\n            return null;\n        }\n\n        if (permissionCollectionCache.containsKey(user.getIdentifier())) {\n            return permissionCollectionCache.get(user.getIdentifier());\n        }\n        // Get the default permissions as lowest priority\n        PermissionCollection result = authorizationPolicy.getPermissions();\n        int[] priority = new int[]{Integer.MIN_VALUE};\n\n        // Overwrite the default permissions with those defined for the user's roles & groups\n        result = mergeRolePermissions(user,\n                                      result,\n                                      priority);\n        result = mergeGroupPermissions(user,\n                                       result,\n                                       priority);\n        permissionCollectionCache.put(user.getIdentifier(), result);\n        return result;\n    }\n\n    /**\n     * Merge the target collection with the permissions assigned to the given user's roles\n     */\n    private PermissionCollection mergeRolePermissions(User user,\n                                                      PermissionCollection target,\n                                                      int[] lastPriority) {\n        PermissionCollection result = target;\n        if (user.getRoles() != null) {\n            for (Role role : user.getRoles()) {\n                PermissionCollection collection = authorizationPolicy.getPermissions(role);\n                int priority = authorizationPolicy.getPriority(role);\n                int comparator = resolve(priority,\n                                         lastPriority[0]);\n                result = result.merge(collection,\n                                      comparator);\n                if (priority > lastPriority[0]) {\n                    lastPriority[0] = priority;\n                }\n            }\n        }\n        return result;\n    }\n\n    /**\n     * Merge the target collection with the permissions assigned to the given user's groups\n     */\n    private PermissionCollection mergeGroupPermissions(User user,\n                                                       PermissionCollection target,\n                                                       int[] lastPriority) {\n        PermissionCollection result = target;\n        if (user.getGroups() != null) {\n            for (Group group : user.getGroups()) {\n                PermissionCollection collection = authorizationPolicy.getPermissions(group);\n                int priority = authorizationPolicy.getPriority(group);\n                int comparator = resolve(priority,\n                                         lastPriority[0]);\n                result = result.merge(collection,\n                                      comparator);\n                if (priority > lastPriority[0]) {\n                    lastPriority[0] = priority;\n                }\n            }\n        }\n        return result;\n    }\n\n    private int resolve(int p1,\n                        int p2) {\n        if (p1 == p2) {\n            return 0;\n        }\n        if (p1 > p2) {\n            return 1;\n        }\n        return -1;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultPermissionTypeRegistry.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.uberfire.security.authz.PermissionType;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\n\n@ApplicationScoped\npublic class DefaultPermissionTypeRegistry implements PermissionTypeRegistry {\n\n    @Inject\n    Instance<PermissionType> permissionTypeBeans;\n\n    private Map<String, PermissionType> permissionTypes = new HashMap<>();\n    private PermissionType defaultPermissionType = new DotNamedPermissionType(\"\");\n\n    @PostConstruct\n    private void init() {\n        for (PermissionType permissionType : permissionTypeBeans) {\n            register(permissionType);\n        }\n    }\n\n    @Override\n    public void register(PermissionType instance) {\n        if (permissionTypes.containsKey(instance.getType())) {\n            throw new IllegalStateException(\"PermissionType already exists: \" + instance.getType());\n        }\n        permissionTypes.put(instance.getType(),\n                            instance);\n    }\n\n    @Override\n    public PermissionType get(String type) {\n        if (permissionTypes.containsKey(type)) {\n            return permissionTypes.get(type);\n        }\n        return defaultPermissionType;\n    }\n\n    @Override\n    public PermissionType resolve(String name) {\n        for (PermissionType permissionType : permissionTypes.values()) {\n            if (permissionType.supportsPermission(name)) {\n                return permissionType;\n            }\n        }\n        return defaultPermissionType;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultResourceAction.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.ResourceAction;\n\npublic class DefaultResourceAction implements ResourceAction {\n\n    private String name;\n\n    public DefaultResourceAction(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DefaultResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.ResourceType;\n\npublic class DefaultResourceType implements ResourceType {\n\n    private String name;\n\n    public DefaultResourceType(String name) {\n        this.name = name;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DotNamedPermission.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\n\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_ABSTAIN;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n/**\n * An implementation where the permission's name is formatted using dots. For instance:\n * <p>\n * <ul>\n * <li><b>resource.view</b> => View all resources</li>\n * <li><b>resource.view.r1</b> => View only r1</li>\n * </ul>\n * The {@code implies(Permission other)} implementation is based on the simple fact that one permission implies\n * another just if its name starts with the another's name. This very simple mechanism can be applied to most of\n * the resources that require authorization control, like for instance, workbench perspectives, a file system, etc.\n */\n@Portable\npublic class DotNamedPermission implements Permission,\n                                           Comparable<Permission> {\n\n    private String name;\n    private AuthorizationResult result;\n    private boolean _immutable;\n\n    public DotNamedPermission() {\n    }\n\n    public DotNamedPermission(String name) {\n        this(name,\n             ACCESS_ABSTAIN);\n    }\n\n    public DotNamedPermission(String name,\n                              Boolean granted) {\n        this.name = name;\n        result = granted == null ? ACCESS_ABSTAIN : (granted ? ACCESS_GRANTED : ACCESS_DENIED);\n    }\n\n    public DotNamedPermission(String name,\n                              AuthorizationResult result) {\n        this.name = name;\n        this.result = result;\n    }\n\n    protected void _enableImmutability() {\n        _immutable = true;\n    }\n\n    protected void _checkImmutability() {\n        if (_immutable) {\n            throw new IllegalStateException(\"The permission is non mutable: \" + this);\n        }\n    }\n\n    public <T extends DotNamedPermission> T nonMutable() {\n        _enableImmutability();\n        return (T) this;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        _checkImmutability();\n        this.name = name;\n    }\n\n    @Override\n    public AuthorizationResult getResult() {\n        return result;\n    }\n\n    public void setResult(AuthorizationResult result) {\n        _checkImmutability();\n        this.result = result;\n    }\n\n    @Override\n    public boolean implies(Permission other) {\n        return impliesName(other) && impliesResult(other);\n    }\n\n    @Override\n    public boolean impliesName(Permission other) {\n        if (equalsName(other)) {\n            return true;\n        }\n        if (name == null) {\n            return false;\n        }\n        String otherName = other.getName();\n        return otherName != null && otherName.startsWith(name + \".\");\n    }\n\n    @Override\n    public boolean impliesResult(Permission other) {\n        if (result == null || ACCESS_ABSTAIN.equals(result)) {\n            return other.getResult() == null || ACCESS_ABSTAIN.equals(other.getResult());\n        }\n        boolean otherDenied = other.getResult() != null && ACCESS_DENIED.equals(other.getResult());\n        return ACCESS_DENIED.equals(result) == otherDenied;\n    }\n\n    @Override\n    public boolean equals(Object obj) {\n        if (obj == null) {\n            return false;\n        }\n        if (obj == this) {\n            return true;\n        }\n        if (!(obj instanceof Permission)) {\n            return false;\n        }\n        Permission other = (Permission) obj;\n        return equalsName(other) && equalsResult(other);\n    }\n\n    @Override\n    public int hashCode() {\n        return (name != null ? name.hashCode() : 0);\n    }\n\n    public boolean equalsName(Permission other) {\n        if (name != null && !name.equals(other.getName())) {\n            return false;\n        }\n        if (name == null && other.getName() != null) {\n            return false;\n        }\n        return true;\n    }\n\n    public boolean equalsResult(Permission other) {\n        if (result == null && other.getResult() != null) {\n            return false;\n        }\n        if (result != null && !result.equals(other.getResult())) {\n            return false;\n        }\n        return true;\n    }\n\n    @Override\n    public int compareTo(Permission o) {\n        if (name == null) {\n            return o.getName() == null ? 0 : -1;\n        }\n        return name.compareTo(o.getName());\n    }\n\n    @Override\n    public Permission clone() {\n        return new DotNamedPermission(name,\n                                      result);\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder out = new StringBuilder();\n        out.append(name).append(\" \").append(result);\n        return out.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/DotNamedPermissionType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionType;\n\npublic class DotNamedPermissionType implements PermissionType {\n\n    private String type = null;\n\n    public DotNamedPermissionType(String type) {\n        this.type = type;\n    }\n\n    @Override\n    public String getType() {\n        return type;\n    }\n\n    @Override\n    public boolean supportsPermission(String name) {\n        return name == null || name.startsWith(type);\n    }\n\n    @Override\n    public Permission createPermission(String name,\n                                       boolean granted) {\n        if (!supportsPermission(name)) {\n            throw new IllegalArgumentException(\"The permission is not supported: \" + name);\n        }\n        return new DotNamedPermission(name,\n                                      granted);\n    }\n\n    @Override\n    public Permission createPermission(ResourceType resourceType,\n                                       ResourceAction action,\n                                       boolean granted) {\n        ResourceAction _action = action != null ? action : ResourceAction.READ;\n        String name = buildPermissionName(resourceType,\n                                          _action.getName().toLowerCase(),\n                                          null);\n        return createPermission(name,\n                                granted);\n    }\n\n    @Override\n    public Permission createPermission(Resource resource,\n                                       ResourceAction action,\n                                       boolean granted) {\n        ResourceAction _action = action != null ? action : ResourceAction.READ;\n        ResourceType type = resource != null ? resource.getResourceType() : null;\n        String id = resource != null ? resource.getIdentifier() : null;\n        String name = buildPermissionName(type,\n                                          _action.getName().toLowerCase(),\n                                          id);\n        return createPermission(name,\n                                granted);\n    }\n\n    @Override\n    public String resolveResourceId(Permission permission) {\n        String name = permission != null ? permission.getName() : null;\n        if (name != null) {\n            String[] s = name.split(\"\\\\.\");\n            if (s.length > 2) {\n                String prefix = s[0] + \".\" + s[1] + \".\";\n                return name.substring(prefix.length());\n            }\n        }\n        return null;\n    }\n\n    protected String buildPermissionName(ResourceType type,\n                                         String action,\n                                         String resourceId) {\n        String name = \"\";\n        if (type != null && !type.getName().equalsIgnoreCase(ResourceType.UNKNOWN.getName())) {\n            name += type.getName();\n        }\n        if (action != null && action.trim().length() > 0) {\n            name += (name.length() > 0 ? \".\" : \"\") + action;\n        }\n        if (resourceId != null && resourceId.trim().length() > 0) {\n            name += (name.length() > 0 ? \".\" : \"\") + resourceId;\n        }\n        return name;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/PermissionCheckImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationCheck;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCheck;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingStrategy;\n\n/**\n * A check executed over a {@link Permission} instance.\n */\npublic class PermissionCheckImpl implements PermissionCheck {\n\n    protected PermissionManager permissionManager;\n    protected String permission;\n    protected User user;\n    protected VotingStrategy votingStrategy;\n    protected Boolean result = null;\n\n    public PermissionCheckImpl(PermissionManager permissionManager,\n                               String permission,\n                               User user,\n                               VotingStrategy votingStrategy) {\n        this.permissionManager = permissionManager;\n        this.permission = permission;\n        this.user = user;\n        this.votingStrategy = votingStrategy;\n    }\n\n    protected void check() {\n        Permission p = permissionManager.createPermission(permission,\n                                                          true);\n        AuthorizationResult authz = permissionManager.checkPermission(p,\n                                                                      user,\n                                                                      votingStrategy);\n        result = !AuthorizationResult.ACCESS_DENIED.equals(authz);\n    }\n\n    @Override\n    public AuthorizationCheck granted(Command onGranted) {\n        if (result()) {\n            onGranted.execute();\n        }\n        return this;\n    }\n\n    @Override\n    public AuthorizationCheck denied(Command onDenied) {\n        if (!result()) {\n            onDenied.execute();\n        }\n        return this;\n    }\n\n    @Override\n    public boolean result() {\n        if (result == null) {\n            check();\n        }\n        return result;\n    }\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/ResourceCheckImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.ResourceCheck;\nimport org.uberfire.security.authz.VotingStrategy;\n\npublic class ResourceCheckImpl<C extends ResourceCheckImpl> implements ResourceCheck<C> {\n\n    protected AuthorizationManager authorizationManager;\n    protected Resource resource;\n    protected ResourceAction resourceAction = ResourceAction.READ;\n    protected ResourceType resourceType;\n    protected User user;\n    protected VotingStrategy votingStrategy;\n    protected Boolean result = null;\n\n    public ResourceCheckImpl(AuthorizationManager authorizationManager,\n                             Resource resource,\n                             User user) {\n        this.authorizationManager = authorizationManager;\n        this.resource = resource;\n        this.user = user;\n    }\n\n    public ResourceCheckImpl(AuthorizationManager authorizationManager,\n                             ResourceType resourceType,\n                             User user) {\n        this.authorizationManager = authorizationManager;\n        this.resourceType = resourceType;\n        this.user = user;\n    }\n\n    public ResourceCheckImpl(AuthorizationManager authorizationManager,\n                             Resource resource,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        this.authorizationManager = authorizationManager;\n        this.resource = resource;\n        this.user = user;\n        this.votingStrategy = votingStrategy;\n    }\n\n    public ResourceCheckImpl(AuthorizationManager authorizationManager,\n                             ResourceType resourceType,\n                             User user,\n                             VotingStrategy votingStrategy) {\n        this.authorizationManager = authorizationManager;\n        this.resourceType = resourceType;\n        this.user = user;\n        this.votingStrategy = votingStrategy;\n    }\n\n    protected void check(ResourceAction action) {\n        if (votingStrategy == null) {\n            if (resource == null) {\n                result = authorizationManager.authorize(resourceType,\n                                                        action,\n                                                        user);\n            } else {\n                result = authorizationManager.authorize(resource,\n                                                        action,\n                                                        user);\n            }\n        } else {\n            if (resource == null) {\n                result = authorizationManager.authorize(resourceType,\n                                                        action,\n                                                        user,\n                                                        votingStrategy);\n            } else {\n                result = authorizationManager.authorize(resource,\n                                                        action,\n                                                        user,\n                                                        votingStrategy);\n            }\n        }\n    }\n\n    @Override\n    public C action(ResourceAction action) {\n        resourceAction = action;\n        return (C) this;\n    }\n\n    @Override\n    public C granted(Command onGranted) {\n        if (result()) {\n            onGranted.execute();\n        }\n        return (C) this;\n    }\n\n    @Override\n    public C denied(Command onDenied) {\n        if (!result()) {\n            onDenied.execute();\n        }\n        return (C) this;\n    }\n\n    @Override\n    public boolean result() {\n        if (result == null) {\n            check(resourceAction);\n        }\n        return result;\n    }\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/java/org/uberfire/security/impl/authz/UnanimousBasedVoter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.VotingAlgorithm;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n/**\n * Algorithm implementation of the {@link VotingStrategy#UNANIMOUS} strategy.\n */\npublic class UnanimousBasedVoter implements VotingAlgorithm {\n\n    @Override\n    public AuthorizationResult vote(final Iterable<AuthorizationResult> results) {\n        checkNotNull(\"results\",\n                     results);\n        for (final AuthorizationResult currentResult : results) {\n            if (!currentResult.equals(ACCESS_GRANTED)) {\n                return ACCESS_DENIED;\n            }\n        }\n        return ACCESS_GRANTED;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/main/resources/org/uberfire/security/UberfireSecurityAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n\n  <source path='annotations'/>\n  <source path='auth'/>\n  <source path='authz'/>\n  <source path='crypt'/>\n  <source path='impl'/>\n\n  <source path=\"server\">\n    <exclude name=\"impl/**\" />\n  </source>\n\n</module>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/AuthorizationManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Arrays;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.PermissionType;\nimport org.uberfire.security.authz.PermissionTypeRegistry;\nimport org.uberfire.security.authz.RuntimeResource;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AuthorizationManagerTest {\n\n    @Mock\n    Resource perspective1;\n\n    @Mock\n    Resource perspective2;\n\n    @Mock\n    Resource perspective3;\n\n    @Mock\n    ResourceType perspectiveType;\n\n    @Mock\n    Resource resource1;\n\n    @Mock\n    RuntimeResource resource2;\n\n    @Mock\n    Resource menuPerspective1;\n\n    @Mock\n    Command onGranted;\n\n    @Mock\n    Command onDenied;\n\n    @Mock\n    Resource menuPerspective2;\n\n    User user;\n    DefaultAuthorizationManager authorizationManager;\n    PermissionManager permissionManager;\n    PermissionTypeRegistry permissionTypeRegistry;\n\n    protected User createUserMock(String... roles) {\n        User user = mock(User.class);\n        Set<Role> roleSet = Stream.of(roles).map(RoleImpl::new).collect(Collectors.toSet());\n        when(user.getRoles()).thenReturn(roleSet);\n        when(user.getGroups()).thenReturn(null);\n        return user;\n    }\n\n    @Before\n    public void setUp() {\n        user = createUserMock(\"admin\");\n\n        when(perspectiveType.getName()).thenReturn(\"perspective\");\n\n        when(resource1.getDependencies()).thenReturn(null);\n        when(resource2.getDependencies()).thenReturn(null);\n\n        when(perspective1.getIdentifier()).thenReturn(\"p1\");\n        when(perspective2.getIdentifier()).thenReturn(\"p2\");\n        when(perspective1.getDependencies()).thenReturn(null);\n        when(perspective2.getDependencies()).thenReturn(null);\n        when(perspective3.getDependencies()).thenReturn(null);\n        when(perspective1.getResourceType()).thenReturn(perspectiveType);\n        when(perspective2.getResourceType()).thenReturn(perspectiveType);\n        when(perspective3.getResourceType()).thenReturn(perspectiveType);\n\n        when(menuPerspective1.getDependencies()).thenReturn(Arrays.asList(perspective1));\n        when(menuPerspective2.getDependencies()).thenReturn(Arrays.asList(perspective2));\n\n        permissionTypeRegistry = new DefaultPermissionTypeRegistry();\n        permissionManager = spy(new DefaultPermissionManager(permissionTypeRegistry));\n        authorizationManager = new DefaultAuthorizationManager(permissionManager);\n\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\").priority(0)\n                        .permission(\"perspective.read\",\n                                    true)\n                        .permission(\"perspective.read.p2\",\n                                    false)\n                        .permission(\"custom.resource2\",\n                                    true)\n                        .role(\"manager\").priority(0)\n                        .permission(\"perspective.read\",\n                                    false)\n                        .role(\"developer\").priority(10)\n                        .permission(\"perspective.read\",\n                                    true)\n                        .build());\n    }\n\n    @Test\n    public void avoidPermissionTypesCollision() {\n        PermissionType permissionType = mock(PermissionType.class);\n        when(permissionType.getType()).thenReturn(\"type\");\n        permissionTypeRegistry.register(permissionType);\n\n        assertThatThrownBy(() -> permissionTypeRegistry.register(permissionType))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"PermissionType already exists: type\");\n    }\n\n    @Test\n    public void testUnknownResource() {\n        boolean result = authorizationManager.authorize(resource1,\n                                                        user);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testAuthorizationPolicyUndefined() {\n        User user = createUserMock(\"role1\");\n        permissionManager.setAuthorizationPolicy(null);\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       VotingStrategy.PRIORITY);\n        boolean result = authorizationManager.authorize(resource1,\n                                                        user);\n\n        assertNotNull(pc);\n        assertEquals(pc.collection().size(),\n                     0);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testNonManagedResource() {\n        boolean result = authorizationManager.authorize(resource2,\n                                                        user);\n        assertEquals(result,\n                     true);\n        verify(permissionManager,\n               never()).checkPermission(any(Permission.class),\n                                        any(User.class));\n    }\n\n    @Test\n    public void testCustomResourceAccess() {\n        when(resource2.getIdentifier()).thenReturn(\"custom.resource2\");\n        boolean result = authorizationManager.authorize(resource2,\n                                                        user);\n        assertEquals(result,\n                     true);\n        verify(permissionManager).checkPermission(any(Permission.class),\n                                                  any(User.class),\n                                                  eq(null));\n    }\n\n    @Test\n    public void testResourceTypeAccess() {\n        User user1 = createUserMock(\"manager\");\n        boolean result = authorizationManager.authorize(perspective3,\n                                                        user1);\n        assertEquals(result,\n                     false);\n    }\n\n    @Test\n    public void testPerspectiveAccessGranted() {\n        boolean result = authorizationManager.authorize(perspective1,\n                                                        user);\n        assertEquals(result,\n                     true);\n        verify(permissionManager).checkPermission(any(Permission.class),\n                                                  any(User.class),\n                                                  eq(null));\n    }\n\n    @Test\n    public void testPerspectiveAccessDenied() {\n        boolean result = authorizationManager.authorize(perspective2,\n                                                        user);\n        assertEquals(result,\n                     false);\n        verify(permissionManager).checkPermission(any(Permission.class),\n                                                  any(User.class),\n                                                  eq(null));\n    }\n\n    @Test\n    public void testMenuItemGranted() {\n        boolean result = authorizationManager.authorize(menuPerspective1,\n                                                        user);\n        assertEquals(result,\n                     true);\n        verify(permissionManager).checkPermission(any(Permission.class),\n                                                  any(User.class),\n                                                  eq(null));\n    }\n\n    @Test\n    public void testMenuItemDenied() {\n        boolean result = authorizationManager.authorize(menuPerspective2,\n                                                        user);\n        assertEquals(result,\n                     false);\n    }\n\n    @Test\n    public void testMenuItemAbstain() {\n        permissionManager.setAuthorizationPolicy(null);\n        boolean result = authorizationManager.authorize(menuPerspective1,\n                                                        user);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testMenuGroupGranted() {\n        Resource resource = new ResourceRef(null,\n                                            null,\n                                            Arrays.asList(menuPerspective1,\n                                                          menuPerspective2));\n        boolean result = authorizationManager.authorize(resource,\n                                                        user);\n        assertEquals(result,\n                     true);\n\n        resource = new ResourceRef(null,\n                                   null,\n                                   Arrays.asList(menuPerspective1));\n        result = authorizationManager.authorize(resource,\n                                                user);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testMenuGroupDenied() {\n        Resource resource = new ResourceRef(null,\n                                            null,\n                                            Arrays.asList(menuPerspective2));\n        boolean result = authorizationManager.authorize(resource,\n                                                        user);\n        assertEquals(result,\n                     false);\n    }\n\n    @Test\n    public void testEmptyMenuGranted() {\n        Resource resource = new ResourceRef(null,\n                                            null,\n                                            Arrays.asList());\n        boolean result = authorizationManager.authorize(resource,\n                                                        user);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testPermissionGranted() {\n        boolean result = authorizationManager.authorize(\"perspective.read.p1\",\n                                                        user);\n        assertEquals(result,\n                     true);\n    }\n\n    @Test\n    public void testPermissionDenied() {\n        boolean result = authorizationManager.authorize(\"perspective.read.p2\",\n                                                        user);\n        assertEquals(result,\n                     false);\n    }\n\n    @Test\n    public void testGrantCommandInvoked() throws Exception {\n        authorizationManager.check(perspective1,\n                                   user).granted(onGranted);\n        verify(onGranted).execute();\n\n        reset(onGranted);\n        authorizationManager.check(perspective1,\n                                   user).granted(onGranted).denied(onDenied);\n        verify(onGranted).execute();\n        verify(onDenied,\n               never()).execute();\n    }\n\n    @Test\n    public void testGrantCommandNotInvoked() throws Exception {\n        authorizationManager.check(perspective2,\n                                   user).granted(onGranted);\n        verify(onGranted,\n               never()).execute();\n    }\n\n    @Test\n    public void testDenyCommandInvoked() throws Exception {\n        authorizationManager.check(perspective2,\n                                   user).denied(onDenied);\n        verify(onDenied).execute();\n\n        reset(onDenied);\n        authorizationManager.check(perspective2,\n                                   user).granted(onGranted).denied(onDenied);\n        verify(onGranted,\n               never()).execute();\n        verify(onDenied).execute();\n    }\n\n    @Test\n    public void testDenyCommandNotInvoked() throws Exception {\n        authorizationManager.check(perspective1,\n                                   user).denied(onDenied);\n        verify(onDenied,\n               never()).execute();\n    }\n\n    @Test\n    public void testPermissionCheck() throws Exception {\n        authorizationManager.check(\"perspective.read.p1\",\n                                   user)\n                .granted(onGranted)\n                .denied(onDenied);\n        verify(onGranted).execute();\n        verify(onDenied,\n               never()).execute();\n    }\n\n    @Test\n    public void testVotingPriority() throws Exception {\n        User user1 = createUserMock(\"admin\",\n                                    \"developer\");\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.PRIORITY);\n        assertTrue(authorizationManager.authorize(perspective2,\n                                                  user1));\n    }\n\n    @Test\n    public void testSamePriorityVoting() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\");\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\")\n                                                         .permission(\"perspective.read\",\n                                                                     false)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     true)\n                                                         .permission(\"screen.read.s1\",\n                                                                     true)\n                                                         .role(\"role2\")\n                                                         .permission(\"perspective.read\",\n                                                                     true)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     false)\n                                                         .permission(\"screen.read\",\n                                                                     false)\n                                                         .build());\n\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.PRIORITY);\n        assertTrue(authorizationManager.authorize(\"perspective.read\",\n                                                  user));\n        assertTrue(authorizationManager.authorize(\"perspective.read.p1\",\n                                                  user));\n        assertTrue(authorizationManager.authorize(\"perspective.read.p2\",\n                                                  user));\n        assertFalse(authorizationManager.authorize(\"screen.read\",\n                                                   user));\n        assertTrue(authorizationManager.authorize(\"screen.read.s1\",\n                                                  user));\n    }\n\n    @Test\n    public void testHighPriorityVoting() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\").priority(10)\n                                                         .permission(\"perspective.read\",\n                                                                     false)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     true)\n                                                         .permission(\"screen.read.s1\",\n                                                                     true)\n                                                         .role(\"role2\")\n                                                         .permission(\"perspective.read\",\n                                                                     true)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     false)\n                                                         .permission(\"screen.read\",\n                                                                     false)\n                                                         .role(\"role3\").priority(5)\n                                                         .permission(\"perspective.read\",\n                                                                     true)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     false)\n                                                         .permission(\"screen.read\",\n                                                                     false)\n                                                         .build());\n\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.PRIORITY);\n        assertFalse(authorizationManager.authorize(\"perspective.read\",\n                                                   user));\n        assertTrue(authorizationManager.authorize(\"perspective.read.p1\",\n                                                  user));\n        assertFalse(authorizationManager.authorize(\"perspective.read.p2\",\n                                                   user));\n        assertFalse(authorizationManager.authorize(\"screen.read\",\n                                                   user));\n        assertTrue(authorizationManager.authorize(\"screen.read.s1\",\n                                                  user));\n    }\n\n    @Test\n    public void testLowPriorityVoting() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\");\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\")\n                                                         .permission(\"perspective.read\",\n                                                                     false)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     true)\n                                                         .permission(\"screen.read.s1\",\n                                                                     true)\n                                                         .role(\"role2\").priority(10)\n                                                         .permission(\"perspective.read\",\n                                                                     true)\n                                                         .permission(\"perspective.read.p1\",\n                                                                     false)\n                                                         .permission(\"screen.read\",\n                                                                     false)\n                                                         .build());\n\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.PRIORITY);\n        assertTrue(authorizationManager.authorize(\"perspective.read\",\n                                                  user));\n        assertFalse(authorizationManager.authorize(\"perspective.read.p1\",\n                                                   user));\n        assertTrue(authorizationManager.authorize(\"perspective.read.p2\",\n                                                  user));\n        assertFalse(authorizationManager.authorize(\"screen.read\",\n                                                   user));\n        assertFalse(authorizationManager.authorize(\"screen.read.s1\",\n                                                   user));\n    }\n\n    @Test\n    public void testVotingUnanimous() throws Exception {\n        User user1 = createUserMock(\"admin\",\n                                    \"manager\");\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.UNANIMOUS);\n        assertFalse(authorizationManager.authorize(perspective1,\n                                                   user1));\n\n        authorizationManager.check(perspective1,\n                                   user1)\n                .granted(onGranted)\n                .denied(onDenied);\n        verify(onGranted,\n               never()).execute();\n        verify(onDenied).execute();\n    }\n\n    @Test\n    public void testVotingAffirmative() throws Exception {\n        User user1 = createUserMock(\"admin\",\n                                    \"manager\");\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.AFFIRMATIVE);\n        assertTrue(authorizationManager.authorize(perspective1,\n                                                  user1));\n\n        authorizationManager.check(perspective1,\n                                   user1)\n                .granted(onGranted)\n                .denied(onDenied);\n        verify(onDenied,\n               never()).execute();\n        verify(onGranted).execute();\n    }\n\n    @Test\n    public void testInvalidateCache() throws Exception {\n        User user1 = createUserMock(\"admin\",\n                \"manager\");\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.AFFIRMATIVE);\n        assertTrue(authorizationManager.authorize(perspective1,\n                user1));\n\n        authorizationManager.check(perspective1,\n                user1)\n                .granted(onGranted)\n                .denied(onDenied);\n        verify(onDenied,\n                never()).execute();\n        verify(onGranted).execute();\n\n        authorizationManager.invalidate(user1);\n        verify(permissionManager, times(1)).invalidate(user1);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/DefaultAuthzResultCacheTest.java",
    "content": "package org.uberfire.security.impl.authz;\n\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Test;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\n\nimport java.util.Collections;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\n\npublic class DefaultAuthzResultCacheTest {\n\n    protected User createUserMock(String... roles) {\n        return new UserImpl(\"username\",\n                             Stream.of(roles).map(RoleImpl::new).collect(Collectors.toSet()),\n                             Collections.emptyList());\n    }\n\n    @Test\n    public void testInvalidate() {\n        final User user = createUserMock(\"admin\");\n\n        final Permission viewAll = new DotNamedPermission(\"resource.read\", true);\n\n        DefaultAuthzResultCache cache = new DefaultAuthzResultCache();\n        cache.put(user, viewAll, AuthorizationResult.ACCESS_GRANTED);\n\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, cache.get(user, viewAll));\n\n        cache.invalidate(user);\n\n        assertNull(cache.get(user, viewAll));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/DefaultPermissionManagerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Arrays;\nimport java.util.Collections;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultPermissionManagerTest {\n\n    private static final String PERMISSION_NAME = \"guideddecisiontable.edit.columns\";\n\n    private DefaultAuthorizationPolicy authorizationPolicy;\n\n    private DefaultPermissionManager defaultPermissionManager;\n\n    private DefaultPermissionTypeRegistry permissionTypeRegistry;\n\n    private DefaultAuthzResultCache cache;\n\n    @Before\n    public void setUp() {\n        permissionTypeRegistry = spy(new DefaultPermissionTypeRegistry());\n        cache = spy(new DefaultAuthzResultCache());\n        defaultPermissionManager = spy(new DefaultPermissionManager(permissionTypeRegistry, cache));\n        authorizationPolicy = spy(new DefaultAuthorizationPolicy());\n\n        defaultPermissionManager.setAuthorizationPolicy(authorizationPolicy);\n    }\n\n    @Test\n    public void testResolvePermissionsCustomDeniedOverDefaultGranted() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeGrantedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeDeniedPermissionCollection(),\n                            businessUserRole,\n                            0);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeGrantedPermissionCollection(),\n                                    directorGroup);\n\n        final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority);\n        final Permission permission = resolvedPermission.get(PERMISSION_NAME);\n\n        assertEquals(AuthorizationResult.ACCESS_DENIED, permission.getResult());\n    }\n\n    @Test\n    public void testResolvePermissionsCustomGrantedOverDefaultDenied() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeDeniedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeGrantedPermissionCollection(),\n                            businessUserRole,\n                            0);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeDeniedPermissionCollection(),\n                                    directorGroup);\n\n        final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority);\n        final Permission permission = resolvedPermission.get(PERMISSION_NAME);\n\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult());\n    }\n\n    @Test\n    public void testResolvePermissionsTwoCustomRolesGranted() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Role managerRole = new RoleImpl(\"manager\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole, managerRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeDeniedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeDeniedPermissionCollection(),\n                            businessUserRole,\n                            0);\n        mockRolePermissions(authorizationPolicy,\n                            makeGrantedPermissionCollection(),\n                            managerRole,\n                            1);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeDeniedPermissionCollection(),\n                                    directorGroup);\n\n        final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority);\n        final Permission permission = resolvedPermission.get(PERMISSION_NAME);\n\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult());\n    }\n\n    @Test\n    public void testResolvePermissionsTwoCustomRolesDenied() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Role managerRole = new RoleImpl(\"manager\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole, managerRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeDeniedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeDeniedPermissionCollection(),\n                            businessUserRole,\n                            1);\n        mockRolePermissions(authorizationPolicy,\n                            makeGrantedPermissionCollection(),\n                            managerRole,\n                            0);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeDeniedPermissionCollection(),\n                                    directorGroup);\n\n        final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority);\n        final Permission permission = resolvedPermission.get(PERMISSION_NAME);\n\n        assertEquals(AuthorizationResult.ACCESS_DENIED, permission.getResult());\n    }\n\n    @Test\n    public void testResolvePermissionsTwoCustomRolesSamePriority() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Role managerRole = new RoleImpl(\"manager\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole, managerRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeDeniedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeDeniedPermissionCollection(),\n                            businessUserRole,\n                            0);\n        mockRolePermissions(authorizationPolicy,\n                            makeGrantedPermissionCollection(),\n                            managerRole,\n                            0);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeDeniedPermissionCollection(),\n                                    directorGroup);\n\n        final PermissionCollection resolvedPermission = defaultPermissionManager.resolvePermissions(user, priority);\n        final Permission permission = resolvedPermission.get(PERMISSION_NAME);\n\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, permission.getResult());\n    }\n\n    @Test\n    public void testPermissionCache() {\n\n        final VotingStrategy priority = VotingStrategy.PRIORITY;\n        final Role businessUserRole = new RoleImpl(\"business-user\");\n        final Role managerRole = new RoleImpl(\"manager\");\n        final Group directorGroup = new GroupImpl(\"director\");\n\n        // Users have a group with their names by default\n        final User user = makeUser(\"director\", directorGroup, businessUserRole, managerRole);\n\n        mockDefaultPermissions(authorizationPolicy,\n                               makeDeniedPermissionCollection());\n        mockRolePermissions(authorizationPolicy,\n                            makeDeniedPermissionCollection(),\n                            businessUserRole,\n                            0);\n        mockRolePermissions(authorizationPolicy,\n                            makeGrantedPermissionCollection(),\n                            managerRole,\n                            0);\n        mockDefaultGroupPermissions(authorizationPolicy,\n                                    makeDeniedPermissionCollection(),\n                                    directorGroup);\n\n        assertNull(cache.get(user, makePermissionGranted()));\n        final AuthorizationResult resolvedGrantedPermission = defaultPermissionManager.checkPermission(makePermissionGranted(), user, priority);\n        verify(defaultPermissionManager).resolvePermissions(user, priority);\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, resolvedGrantedPermission);\n        assertEquals(AuthorizationResult.ACCESS_GRANTED, cache.get(user, makePermissionGranted()));\n\n        assertNull(cache.get(user, makePermissionDenied()));\n        final AuthorizationResult resolvedDeniedPermission = defaultPermissionManager.checkPermission(makePermissionDenied(), user, priority);\n        verify(defaultPermissionManager, times(2)).resolvePermissions(user, priority);\n        assertEquals(AuthorizationResult.ACCESS_DENIED, resolvedDeniedPermission);\n        assertEquals(AuthorizationResult.ACCESS_DENIED, cache.get(user, makePermissionDenied()));\n\n        assertEquals(2, cache.size(user));\n    }\n\n    private void mockDefaultGroupPermissions(final DefaultAuthorizationPolicy authorizationPolicy,\n                                             final DefaultPermissionCollection permissionCollection,\n                                             final Group group) {\n\n        final DefaultAuthorizationEntry groupAuthorizationEntry = new DefaultAuthorizationEntry() {{\n            setGroup(group);\n            // Simulating a priority with the default value\n        }};\n\n        authorizationPolicy.registerAuthzEntry(groupAuthorizationEntry);\n\n        doReturn(permissionCollection).when(authorizationPolicy).getPermissions(group);\n    }\n\n    private void mockRolePermissions(final DefaultAuthorizationPolicy authorizationPolicy,\n                                     final DefaultPermissionCollection permissionCollection,\n                                     final Role role,\n                                     final int priority) {\n\n        final DefaultAuthorizationEntry roleAuthorizationEntry = new DefaultAuthorizationEntry() {{\n            setRole(role);\n\n            // Simulating a priority set by the user\n            setPriority(priority);\n        }};\n\n        authorizationPolicy.registerAuthzEntry(roleAuthorizationEntry);\n\n        doReturn(permissionCollection).when(authorizationPolicy).getPermissions(role);\n    }\n\n    private void mockDefaultPermissions(final DefaultAuthorizationPolicy authorizationPolicy,\n                                        final DefaultPermissionCollection permissionCollection) {\n        doReturn(permissionCollection).when(authorizationPolicy).getPermissions();\n    }\n\n    private UserImpl makeUser(final String name,\n                              final Group group,\n                              final Role... roles) {\n\n        return new UserImpl(name, Arrays.asList(roles), Collections.singletonList(group));\n    }\n\n    private DefaultPermissionCollection makeDeniedPermissionCollection() {\n        return new DefaultPermissionCollection() {{\n            add(makePermissionDenied());\n        }};\n    }\n\n    private DefaultPermissionCollection makeGrantedPermissionCollection() {\n        return new DefaultPermissionCollection() {{\n            add(makePermissionGranted());\n        }};\n    }\n\n    private DotNamedPermission makePermissionDenied() {\n        return new DotNamedPermission(PERMISSION_NAME, false);\n    }\n\n    private DotNamedPermission makePermissionGranted() {\n        return new DotNamedPermission(PERMISSION_NAME, true);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/HomePerspectiveTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HomePerspectiveTest {\n\n    PermissionManager permissionManager;\n    AuthorizationPolicy authorizationPolicy;\n\n    protected User createUserMock(String... roles) {\n        User user = mock(User.class);\n        Set<Role> roleSet = Stream.of(roles).map(RoleImpl::new).collect(Collectors.toSet());\n        when(user.getRoles()).thenReturn(roleSet);\n        when(user.getGroups()).thenReturn(null);\n        return user;\n    }\n\n    @Before\n    public void setUp() {\n        permissionManager = new DefaultPermissionManager(new DefaultPermissionTypeRegistry());\n        permissionManager.setAuthorizationPolicy(\n                authorizationPolicy = spy(permissionManager.newAuthorizationPolicy()\n                                                  .bydefault().home(\"H\")\n                                                  .role(\"admin\").home(\"A\").priority(10)\n                                                  .role(\"user\").home(\"U\").priority(0)\n                                                  .role(\"manager\").home(\"M\").priority(5)\n                                                  .build()));\n    }\n\n    @Test\n    public void testUserWithoutRoles() {\n        User userMock = createUserMock();\n        String home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"H\");\n    }\n\n    @Test\n    public void testSingleRoleHome() {\n        User userMock = createUserMock(\"admin\");\n        String home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"A\");\n\n        userMock = createUserMock(\"manager\");\n        home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"M\");\n\n        userMock = createUserMock(\"user\");\n        home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"U\");\n    }\n\n    @Test\n    public void testHighestPriorityWins() {\n        User userMock = createUserMock(\"admin\",\n                                       \"user\");\n        String home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"A\");\n\n        userMock = createUserMock(\"admin\",\n                                  \"user\",\n                                  \"manager\");\n        home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"A\");\n\n        userMock = createUserMock(\"user\",\n                                  \"manager\");\n        home = authorizationPolicy.getHomePerspective(userMock);\n        assertEquals(home,\n                     \"M\");\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/PermissionCollectionTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport org.junit.Test;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\n\nimport static org.junit.Assert.*;\n\npublic class PermissionCollectionTest {\n\n    Permission p1 = new DotNamedPermission(\"resource.read\");\n    Permission p2 = new DotNamedPermission(\"resource.read\",\n                                           true);\n    Permission p3 = new DotNamedPermission(\"resource.read\",\n                                           false);\n    Permission p4 = new DotNamedPermission(\"resource.read.id1\",\n                                           true);\n    Permission p5 = new DotNamedPermission(\"resource.read.id1\",\n                                           false);\n    Permission p6 = new DotNamedPermission(\"resource.read.id2\",\n                                           true);\n    Permission p7 = new DotNamedPermission(\"resource.read.id2\",\n                                           false);\n    Permission p8 = new DotNamedPermission(\"perspective.read.id1\",\n                                           true);\n\n    @Test\n    public void testNotAdded() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      true));\n        pc.add(new DotNamedPermission(\"resource.read.id1\")); // Not added\n        pc.add(new DotNamedPermission(\"resource.read.id1\",\n                                      true)); // Not added\n        pc.add(new DotNamedPermission(\"resource.read.id1\",\n                                      false));\n        assertEquals(pc.collection().size(),\n                     2);\n    }\n\n    @Test\n    public void testEmpty() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        assertFalse(pc.implies(p1));\n        assertFalse(pc.implies(p2));\n        assertFalse(pc.implies(p3));\n    }\n\n    @Test\n    public void testGranted() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      true));\n        assertTrue(pc.implies(p1));\n        assertTrue(pc.implies(p2));\n        assertFalse(pc.implies(p3));\n    }\n\n    @Test\n    public void testAbstain() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\"));\n        assertTrue(pc.implies(p1));\n        assertFalse(pc.implies(p2));\n        assertFalse(pc.implies(p3));\n    }\n\n    @Test\n    public void testDenied() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      false));\n        assertFalse(pc.implies(p1));\n        assertFalse(pc.implies(p2));\n        assertTrue(pc.implies(p3));\n    }\n\n    @Test\n    public void testChildGranted() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"\",\n                                      false));\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      false));\n        pc.add(new DotNamedPermission(\"resource.read.id1\",\n                                      true));\n        assertTrue(pc.implies(p4));\n        assertTrue(pc.implies(p5));\n        assertFalse(pc.implies(p6));\n        assertTrue(pc.implies(p7));\n    }\n\n    @Test\n    public void testChildDenied() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"\",\n                                      true));\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      true));\n        pc.add(new DotNamedPermission(\"resource.read.id1\",\n                                      false));\n        assertTrue(pc.implies(p4));\n        assertTrue(pc.implies(p5));\n        assertTrue(pc.implies(p6));\n        assertFalse(pc.implies(p7));\n    }\n\n    @Test\n    public void testOtherAbstain() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      true));\n        pc.add(new DotNamedPermission(\"resource.read.id1\",\n                                      false));\n        assertFalse(pc.implies(p8));\n    }\n\n    @Test\n    public void testMergeNull() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        PermissionCollection pc2 = null;\n        PermissionCollection result = pc1.merge(pc2,\n                                                0);\n        assertSame(result,\n                   pc1);\n    }\n\n    @Test\n    public void testMergeNoConflict() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read\",\n                                       true));\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read.id2\",\n                                       false));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                0);\n        assertEquals(result.collection().size(),\n                     2);\n        assertEquals(result.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(result.get(\"resource.read.id1\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n        assertNull(result.get(\"resource.read.id2\"));\n    }\n\n    @Test\n    public void testMergeGrantWinsByDefault() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read\",\n                                       true));\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read\",\n                                       true));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                0);\n        assertEquals(result.collection().size(),\n                     1);\n        assertEquals(result.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testMergePriorityWins() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read\",\n                                       true));\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read\",\n                                       true));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                -1);\n        assertEquals(result.collection().size(),\n                     2);\n        assertEquals(result.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(result.get(\"resource.read.id1\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n\n        result = pc1.merge(pc2,\n                           1);\n        assertEquals(result.collection().size(),\n                     1);\n        assertEquals(result.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertNull(result.get(\"resource.read.id1\"));\n    }\n\n    @Test\n    public void testMergeGrantedWins() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read.id1\",\n                                       true));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                0);\n        assertEquals(result.collection().size(),\n                     1);\n        assertEquals(result.get(\"resource.read.id1\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testMergeThisWins() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read.id1\",\n                                       true));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                -1);\n        assertEquals(result.collection().size(),\n                     1);\n        assertEquals(result.get(\"resource.read.id1\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n    }\n\n    @Test\n    public void testMergeOtherWins() {\n        PermissionCollection pc1 = new DefaultPermissionCollection();\n        pc1.add(new DotNamedPermission(\"resource.read.id1\",\n                                       true));\n\n        PermissionCollection pc2 = new DefaultPermissionCollection();\n        pc2.add(new DotNamedPermission(\"resource.read.id1\",\n                                       false));\n\n        PermissionCollection result = pc1.merge(pc2,\n                                                1);\n        assertEquals(result.collection().size(),\n                     1);\n        assertEquals(result.get(\"resource.read.id1\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n    }\n\n    @Test\n    public void testOverwriteExisting() {\n        PermissionCollection pc = new DefaultPermissionCollection();\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      true));\n        assertEquals(pc.collection().size(),\n                     1);\n        assertEquals(pc.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        pc.add(new DotNamedPermission(\"resource.read\",\n                                      false));\n        assertEquals(pc.collection().size(),\n                     1);\n        assertEquals(pc.get(\"resource.read\").getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/PermissionManagerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport java.util.Collection;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingAlgorithm;\nimport org.uberfire.security.authz.VotingStrategy;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_ABSTAIN;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_DENIED;\nimport static org.uberfire.security.authz.AuthorizationResult.ACCESS_GRANTED;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PermissionManagerTest {\n\n    PermissionManager permissionManager;\n    DefaultAuthzResultCache authzResultCache;\n    AuthorizationPolicy authorizationPolicy;\n    Permission viewAll = new DotNamedPermission(\"resource.read\",\n                                                true);\n    Permission denyAll = new DotNamedPermission(\"resource.read\",\n                                                false);\n    Permission view1 = new DotNamedPermission(\"resource.read.1\",\n                                              true);\n    Permission noView1 = new DotNamedPermission(\"resource.read.1\",\n                                                false);\n    Permission view2 = new DotNamedPermission(\"resource.read.2\",\n                                              true);\n    Permission view12 = new DotNamedPermission(\"resource.read.1.2\",\n                                               true);\n\n    protected User createUserMock(String... roles) {\n        User user = mock(User.class);\n        Set<Role> roleSet = Stream.of(roles).map(RoleImpl::new).collect(Collectors.toSet());\n        when(user.getIdentifier()).thenReturn(Integer.toString(user.hashCode()));\n        when(user.getRoles()).thenReturn(roleSet);\n        when(user.getGroups()).thenReturn(null);\n        return user;\n    }\n\n    @Before\n    public void setUp() {\n        authzResultCache = spy(new DefaultAuthzResultCache());\n        permissionManager = spy(new DefaultPermissionManager(new DefaultPermissionTypeRegistry(),\n                                                             authzResultCache));\n        permissionManager.setAuthorizationPolicy(\n                authorizationPolicy = spy(permissionManager.newAuthorizationPolicy()\n                                                  .role(\"viewAll\").permission(\"resource.read\",\n                                                                              true)\n                                                  .role(\"noViewAll\").permission(\"resource.read\",\n                                                                                false)\n                                                  .role(\"onlyView1\",\n                                                        5).permission(\"resource.read\",\n                                                                      false).permission(\"resource.read.1\",\n                                                                                        true)\n                                                  .role(\"noView1\").permission(\"resource.read.1\",\n                                                                              false)\n                                                  .role(\"onlyView12\").permission(\"resource.read.1.2\",\n                                                                                 true)\n                                                  .build()));\n    }\n\n    @Test\n    public void testSetNullPolicy() {\n        permissionManager.setAuthorizationPolicy(null);\n        AuthorizationPolicy policy = permissionManager.getAuthorizationPolicy();\n        assertNotNull(policy);\n        assertTrue(policy.getRoles().isEmpty());\n        assertTrue(policy.getGroups().isEmpty());\n    }\n\n    @Test\n    public void testCreateGlobalPermissions() {\n        ResourceType type = () -> \"type\";\n        Permission p = permissionManager.createPermission(type,\n                                                          null,\n                                                          true);\n        assertEquals(p.getName(),\n                     \"type.read\");\n\n        p = permissionManager.createPermission(type,\n                                               () -> \"edit\",\n                                               true);\n        assertEquals(p.getName(),\n                     \"type.edit\");\n    }\n\n    @Test\n    public void testCreateTypedPermissions() {\n        ResourceType type = () -> \"type\";\n        ResourceRef r = new ResourceRef(\"r1\",\n                                        type,\n                                        null);\n        Permission p = permissionManager.createPermission(r,\n                                                          null,\n                                                          true);\n        assertEquals(p.getName(),\n                     \"type.read.r1\");\n\n        p = permissionManager.createPermission(r,\n                                               ResourceAction.READ,\n                                               true);\n        assertEquals(p.getName(),\n                     \"type.read.r1\");\n    }\n\n    @Test\n    public void testUnknownTypePermissions() {\n        ResourceRef r = new ResourceRef(\"r1\",\n                                        ResourceType.UNKNOWN,\n                                        null);\n        Permission p = permissionManager.createPermission(r,\n                                                          null,\n                                                          true);\n        assertEquals(p.getName(),\n                     \"r1\");\n\n        p = permissionManager.createPermission(r,\n                                               ResourceAction.READ,\n                                               true);\n        assertEquals(p.getName(),\n                     \"r1\");\n    }\n\n    @Test\n    public void testCreateNonTypedPermissions() {\n        ResourceRef r = new ResourceRef(\"r1\",\n                                        null,\n                                        null);\n        Permission p = permissionManager.createPermission(r,\n                                                          null,\n                                                          true);\n        assertEquals(p.getName(),\n                     \"r1\");\n\n        p = permissionManager.createPermission(r,\n                                               ResourceAction.READ,\n                                               true);\n        assertEquals(p.getName(),\n                     \"r1\");\n    }\n\n    @Test\n    public void testResolveResourceId() {\n        ResourceType type = () -> \"type\";\n        ResourceRef r = new ResourceRef(\"r1\",\n                                        type,\n                                        null);\n        Permission p = permissionManager.createPermission(r,\n                                                          null,\n                                                          true);\n        assertEquals(p.getName(),\n                     \"type.read.r1\");\n\n        String id = permissionManager.resolveResourceId(p);\n        assertEquals(id,\n                     \"r1\");\n    }\n\n    @Test\n    public void testResolveResourceNull() {\n        Permission p = permissionManager.createPermission(\"feature\",\n                                                          true);\n        assertEquals(p.getName(),\n                     \"feature\");\n\n        String id = permissionManager.resolveResourceId(p);\n        assertNull(id);\n    }\n\n    @Test\n    public void testCheckPermission1() {\n        User user = createUserMock(\"viewAll\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission2() {\n        User user = createUserMock(\"viewAll\",\n                                   \"onlyView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission3() {\n        User user = createUserMock(\"viewAll\",\n                                   \"onlyView1\",\n                                   \"noView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission4() {\n        User user = createUserMock(\"viewAll\",\n                                   \"noView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission5() {\n        User user = createUserMock(\"onlyView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission6() {\n        User user = createUserMock(\"noView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_ABSTAIN);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_ABSTAIN);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testCheckPermission7() {\n        User user = createUserMock(\"onlyView1\",\n                                   \"noView1\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_DENIED);\n    }\n\n    @Test\n    public void testCheckPermission8() {\n        User user = createUserMock(\"noView1\",\n                                   \"onlyView12\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user),\n                     ACCESS_ABSTAIN);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_DENIED);\n        assertEquals(permissionManager.checkPermission(view2,\n                                                       user),\n                     ACCESS_ABSTAIN);\n        assertEquals(permissionManager.checkPermission(view12,\n                                                       user),\n                     ACCESS_GRANTED);\n        assertEquals(permissionManager.checkPermission(noView1,\n                                                       user),\n                     ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testCacheHits() {\n        User user = createUserMock(\"viewAll\");\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        verify(permissionManager,\n               times(1)).resolvePermissions(user,\n                                            VotingStrategy.PRIORITY);\n        verify(authzResultCache,\n               times(1)).put(user,\n                             viewAll,\n                             AuthorizationResult.ACCESS_GRANTED);\n        verify(authzResultCache,\n               times(4)).get(user,\n                             viewAll);\n        assertEquals(authzResultCache.size(user),\n                     1);\n        assertEquals(authzResultCache.size(createUserMock()),\n                     0);\n\n        permissionManager.invalidate(user);\n\n        assertEquals(authzResultCache.size(user),\n                0);\n\n        permissionManager.checkPermission(viewAll,\n                user);\n        verify(permissionManager,\n                times(2)).resolvePermissions(user,\n                VotingStrategy.PRIORITY);\n        verify(authzResultCache,\n                times(2)).put(user,\n                viewAll,\n                AuthorizationResult.ACCESS_GRANTED);\n        verify(authzResultCache,\n                times(5)).get(user,\n                viewAll);\n        assertEquals(authzResultCache.size(user),\n                1);\n        assertEquals(authzResultCache.size(createUserMock()),\n                0);\n    }\n\n    @Test\n    public void testDefaultVotingStrategy() {\n        User user = createUserMock(\"role1\");\n        assertEquals(permissionManager.getDefaultVotingStrategy(),\n                     VotingStrategy.PRIORITY);\n\n        VotingAlgorithm unanimousVoter = mock(VotingAlgorithm.class);\n        when(unanimousVoter.vote(any())).thenReturn(AuthorizationResult.ACCESS_GRANTED);\n\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.UNANIMOUS);\n        permissionManager.setVotingAlgorithm(VotingStrategy.UNANIMOUS,\n                                             unanimousVoter);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        verify(unanimousVoter).vote(any());\n\n        permissionManager.checkPermission(viewAll,\n                                          user,\n                                          null);\n        verify(unanimousVoter).vote(any());\n\n        VotingAlgorithm affirmativeVoter = mock(VotingAlgorithm.class);\n        when(affirmativeVoter.vote(any())).thenReturn(AuthorizationResult.ACCESS_GRANTED);\n        authzResultCache.clear();\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.AFFIRMATIVE);\n        permissionManager.setVotingAlgorithm(VotingStrategy.AFFIRMATIVE,\n                                             affirmativeVoter);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        verify(affirmativeVoter).vote(any());\n\n        VotingAlgorithm consensusVoter = mock(VotingAlgorithm.class);\n        when(consensusVoter.vote(any())).thenReturn(AuthorizationResult.ACCESS_GRANTED);\n        authzResultCache.clear();\n        permissionManager.setDefaultVotingStrategy(VotingStrategy.CONSENSUS);\n        permissionManager.setVotingAlgorithm(VotingStrategy.CONSENSUS,\n                                             consensusVoter);\n        permissionManager.checkPermission(viewAll,\n                                          user);\n        verify(consensusVoter).vote(any());\n    }\n\n    @Test\n    public void testPriorityVoting1() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        AuthorizationPolicy policy = permissionManager.newAuthorizationPolicy()\n                .role(\"role1\",\n                      1).permission(\"resource.read\",\n                                    true)\n                .role(\"role2\",\n                      2).permission(\"resource.read\",\n                                    false)\n                .role(\"role3\",\n                      3).permission(\"resource.read.1\",\n                                    true)\n                .build();\n\n        permissionManager.setAuthorizationPolicy(policy);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       VotingStrategy.PRIORITY);\n        Collection<Permission> permissions = pc.collection();\n        assertEquals(permissions.size(),\n                     2);\n        assertTrue(permissions.contains(denyAll));\n        assertTrue(permissions.contains(view1));\n    }\n\n    @Test\n    public void testPriorityVoting2() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        AuthorizationPolicy policy = permissionManager.newAuthorizationPolicy()\n                .role(\"role1\",\n                      3).permission(\"resource.read\",\n                                    true)\n                .role(\"role2\",\n                      2).permission(\"resource.read\",\n                                    false)\n                .role(\"role3\",\n                      1).permission(\"resource.read.1\",\n                                    true)\n                .build();\n\n        permissionManager.setAuthorizationPolicy(policy);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_GRANTED);\n\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       VotingStrategy.PRIORITY);\n        Collection<Permission> permissions = pc.collection();\n        assertEquals(permissions.size(),\n                     1);\n        assertTrue(permissions.contains(viewAll));\n    }\n\n    @Test\n    public void testPriorityVoting3() {\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        AuthorizationPolicy policy = permissionManager.newAuthorizationPolicy()\n                .role(\"role1\",\n                      1).permission(\"resource.read\",\n                                    true)\n                .role(\"role2\",\n                      2).permission(\"resource.read\",\n                                    false)\n                .role(\"role3\",\n                      1).permission(\"resource.read.1\",\n                                    true)\n                .build();\n\n        permissionManager.setAuthorizationPolicy(policy);\n        assertEquals(permissionManager.checkPermission(view1,\n                                                       user),\n                     ACCESS_DENIED);\n\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       VotingStrategy.PRIORITY);\n        Collection<Permission> permissions = pc.collection();\n        assertEquals(permissions.size(),\n                     1);\n        assertTrue(permissions.contains(denyAll));\n    }\n\n    @Test\n    public void testUnanimousVoting() {\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .role(\"role2\").permission(\"resource.read\",\n                                                                                   false)\n                                                         .role(\"role3\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .build());\n\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.UNANIMOUS),\n                     ACCESS_DENIED);\n\n        user = createUserMock(\"role1\",\n                              \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.UNANIMOUS),\n                     ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testConsensusVoting() {\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .role(\"role2\").permission(\"resource.read\",\n                                                                                   false)\n                                                         .role(\"role3\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .build());\n\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.CONSENSUS),\n                     ACCESS_DENIED);\n\n        user = createUserMock(\"role1\",\n                              \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.CONSENSUS),\n                     ACCESS_GRANTED);\n    }\n\n    @Test\n    public void testAffirmativeVoting() {\n        permissionManager.setAuthorizationPolicy(permissionManager.newAuthorizationPolicy()\n                                                         .role(\"role1\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .role(\"role2\").permission(\"resource.read\",\n                                                                                   false)\n                                                         .role(\"role3\").permission(\"resource.read\",\n                                                                                   true)\n                                                         .build());\n\n        User user = createUserMock(\"role1\",\n                                   \"role2\",\n                                   \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.AFFIRMATIVE),\n                     ACCESS_GRANTED);\n\n        user = createUserMock(\"role1\",\n                              \"role3\");\n        assertEquals(permissionManager.checkPermission(viewAll,\n                                                       user,\n                                                       VotingStrategy.AFFIRMATIVE),\n                     ACCESS_GRANTED);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-api/src/test/java/org/uberfire/security/impl/authz/PermissionTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.impl.authz;\n\nimport org.junit.Test;\nimport org.uberfire.security.authz.Permission;\n\nimport static org.junit.Assert.*;\n\npublic class PermissionTest {\n\n    @Test\n    public void testChildGranted() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read.id1\",\n                                               true);\n        assertTrue(p1.implies(p2));\n    }\n\n    @Test\n    public void testChildAbstain() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read.id1\");\n        assertTrue(p1.implies(p2));\n    }\n\n    @Test\n    public void testChildDenied() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read.id1\",\n                                               false);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testEqualsGranted() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        assertTrue(p1.implies(p2));\n    }\n\n    @Test\n    public void testEqualsAbstain() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read\");\n        assertTrue(p1.implies(p2));\n    }\n\n    @Test\n    public void testEqualsDenied() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read\",\n                                               false);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testParentDenied() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               false);\n        Permission p2 = new DotNamedPermission(\"resource.read\",\n                                               false);\n        Permission p3 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p4 = new DotNamedPermission(\"resource.read\");\n        assertTrue(p1.implies(p2));\n        assertFalse(p1.implies(p3));\n        assertFalse(p1.implies(p4));\n    }\n\n    @Test\n    public void testParentAbstain() {\n        Permission p1 = new DotNamedPermission(\"resource.read\");\n        Permission p2 = new DotNamedPermission(\"resource.read\",\n                                               false);\n        Permission p3 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p4 = new DotNamedPermission(\"resource.read\");\n        assertFalse(p1.implies(p2));\n        assertFalse(p1.implies(p3));\n        assertTrue(p1.implies(p4));\n    }\n\n    @Test\n    public void testParentGranted() {\n        Permission p1 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read\",\n                                               false);\n        Permission p3 = new DotNamedPermission(\"resource.read\",\n                                               true);\n        Permission p4 = new DotNamedPermission(\"resource.read\");\n        assertFalse(p1.implies(p2));\n        assertTrue(p1.implies(p3));\n        assertTrue(p1.implies(p4));\n    }\n\n    @Test\n    public void testPrefixNotImply() {\n        Permission p1 = new DotNamedPermission(\"resource.read.r\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read.r2\",\n                                               true);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testEmptyNotImply() {\n        Permission p1 = new DotNamedPermission(\"resource.read.\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"resource.read.r2\",\n                                               true);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testLengthNotImply() {\n        Permission p1 = new DotNamedPermission(\"resource.read.r1\",\n                                               true);\n        Permission p2 = new DotNamedPermission(\"perspective.read.r2\",\n                                               true);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testNull() {\n        Permission p1 = new DotNamedPermission(\"resource.read.r1\",\n                                               true);\n        Permission p2 = new DotNamedPermission(null,\n                                               true);\n        assertFalse(p1.implies(p2));\n    }\n\n    @Test\n    public void testImplyNameWithDots() {\n        Permission p1 = new DotNamedPermission(\"resource.read\", true);\n        Permission p2 = new DotNamedPermission(\"resource.read.r1.dot\", true);\n        assertTrue(p1.impliesName(p2));\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-security</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-security-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Security Client</name>\n  <description>UberFire Security Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/AuthorizationManagerHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.client.authz;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationCheck;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.VotingStrategy;\nimport org.uberfire.security.impl.authz.DefaultResourceAction;\nimport org.uberfire.security.impl.authz.DefaultResourceType;\n\n@ApplicationScoped\npublic class AuthorizationManagerHelper {\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n    @Inject\n    public AuthorizationManagerHelper(AuthorizationManager authorizationManager,\n                                      User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    private static AuthorizationManagerHelper get() {\n        return IOC.getBeanManager().lookupBean(AuthorizationManagerHelper.class).getInstance();\n    }\n\n    public static boolean authorize(Resource resource) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resource,\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(Resource resource,\n                                    String action) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resource,\n                                                          new DefaultResourceAction(action),\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(Resource resource,\n                                    ResourceAction action) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resource,\n                                                          action,\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(String resourceType,\n                                    String action) {\n        return authorize(new DefaultResourceType(resourceType),\n                         new DefaultResourceAction(action));\n    }\n\n    public static boolean authorize(ResourceType resourceType,\n                                    ResourceAction action) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resourceType,\n                                                          action,\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(Resource resource,\n                                    VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resource,\n                                                          helper.getUser(),\n                                                          votingStrategy);\n    }\n\n    public static boolean authorize(Resource resource,\n                                    ResourceAction action,\n                                    VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resource,\n                                                          action,\n                                                          helper.getUser(),\n                                                          votingStrategy);\n    }\n\n    public static boolean authorize(ResourceType resourceType,\n                                    ResourceAction action,\n                                    VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(resourceType,\n                                                          action,\n                                                          helper.getUser(),\n                                                          votingStrategy);\n    }\n\n    public static boolean authorize(String permission) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(permission,\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(Permission permission) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(permission,\n                                                          helper.getUser());\n    }\n\n    public static boolean authorize(String permission,\n                                    VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(permission,\n                                                          helper.getUser(),\n                                                          votingStrategy);\n    }\n\n    public static boolean authorize(Permission permission,\n                                    VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().authorize(permission,\n                                                          helper.getUser(),\n                                                          votingStrategy);\n    }\n\n    public static AuthorizationCheck check(Resource target) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().check(target,\n                                                      helper.getUser());\n    }\n\n    public static AuthorizationCheck check(Resource target,\n                                           VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().check(target,\n                                                      helper.getUser(),\n                                                      votingStrategy);\n    }\n\n    public static AuthorizationCheck check(String permission) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().check(permission,\n                                                      helper.getUser());\n    }\n\n    public static AuthorizationCheck check(String permission,\n                                           VotingStrategy votingStrategy) {\n        AuthorizationManagerHelper helper = get();\n        return helper.getAuthorizationManager().check(permission,\n                                                      helper.getUser(),\n                                                      votingStrategy);\n    }\n\n    public AuthorizationManager getAuthorizationManager() {\n        return authorizationManager;\n    }\n\n    public User getUser() {\n        return user;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/HasResources.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\n/**\n * Interface implemented for those {@link PermissionNode} instances that handle resources.\n */\npublic interface HasResources {\n\n    /**\n     * Retrieves the name of the resource (if any) this node is handling.\n     * @return The name to display in the UI. If null then a generic resource name will be used such as \"Item\" or \"Instance\".\n     */\n    default String getResourceName() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/LoadCallback.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\nimport java.util.List;\n\n/**\n * Callback interface for the processing of the {@link PermissionNode} instances retrieved after expanding\n * its parent node (see {@link PermissionNode#expand(LoadCallback)}).\n */\npublic interface LoadCallback {\n\n    /**\n     * Called after a list of nodes have been loaded\n     * @param nodeList The results\n     */\n    void afterLoad(List<PermissionNode> nodeList);\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/LoadOptions.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\nimport java.util.Collection;\n\n/**\n * Interface defining several options for altering the way permission nodes are loaded\n */\npublic interface LoadOptions {\n\n    /**\n     * A string pattern used to match the nodes to load.\n     * @return A string used to compare against the node name.\n     * If null or empty then this option is ruled out.\n     */\n    String getNodeNamePattern();\n\n    /**\n     * The resource identifiers to take into account when loading the children nodes.\n     * @return A collection of ids\n     * If null or empty then this option is ruled out.\n     */\n    Collection<String> getResourceIds();\n\n    /**\n     * The maximum number of nodes to load.\n     * <p>\n     * <p>NOTE: It can only be used in combination with the {@link #getNodeNamePattern()} option.</p>\n     * @return A positive integer. If 0 or negative integer then all nodes are loaded.\n     */\n    int getMaxNodes();\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/PermissionNode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\nimport java.util.List;\n\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * A permission tree node\n */\npublic interface PermissionNode {\n\n    /**\n     * Get the provider instance that built this node instance.\n     */\n    PermissionTreeProvider getPermissionTreeProvider();\n\n    /**\n     * Set the provider instance that built this node instance.\n     */\n    void setPermissionTreeProvider(PermissionTreeProvider provider);\n\n    /**\n     * Get the {@link PermissionTree} instance this root node has been attached to.\n     */\n    PermissionTree getPermissionTree();\n\n    /**\n     * Attach this root node to the given {@link PermissionTree} instance.\n     */\n    void setPermissionTree(PermissionTree tree);\n\n    /**\n     * Get the parent node.\n     * @return null if this is a root node\n     */\n    PermissionNode getParentNode();\n\n    /**\n     * Set this node's parent\n     */\n    void setParentNode(PermissionNode parentNode);\n\n    /**\n     * A number indicating at what specific levels this node is placed within the {@link PermissionTree}\n     * @return A positive integer from 0 to N, where <i>0=root</i>, <i>N=leaf</i>.\n     */\n    int getLevel();\n\n    /**\n     * Retrieves the name to display for the given node.\n     * @return The name to display in the UI\n     */\n    String getNodeName();\n\n    /**\n     * Retrieves the full name to display for the given node.\n     * @return The name to display in the UI\n     */\n    String getNodeFullName();\n\n    /**\n     * The position of the node within the permission tree. The position is used by {@link PermissionTree}\n     * implementations to order its root nodes from lower position nodes to higher ones.\n     */\n    int getPositionInTree();\n\n    /**\n     * The list of permissions attached to this node.\n     */\n    List<Permission> getPermissionList();\n\n    /**\n     * Updates the node's permission values according to the values specified in the given collection.\n     * @param collection The permission collection with the results to apply.\n     */\n    void updatePermissionList(PermissionCollection collection);\n\n    /**\n     * Add a permission instance to the list\n     */\n    void addPermission(Permission permission,\n                       String name);\n\n    /**\n     * Add a permission instance to the list\n     */\n    void addPermission(Permission permission,\n                       String grantName,\n                       String denyName);\n\n    /**\n     * Retrieves the name to display for the grant action.\n     * @param permission The {@link Permission} instance\n     * @return The name to display in the UI\n     */\n    String getPermissionGrantName(Permission permission);\n\n    /**\n     * Retrieves the name to display for the deny action.\n     * @param permission The {@link Permission} instance\n     * @return The name to display in the UI\n     */\n    String getPermissionDenyName(Permission permission);\n\n    /**\n     * Attach to the given {@link Permission} instance a set of permissions which depends on it so that if the\n     * permission is denied then all its dependencies must be denied as well.\n     * <p>\n     * <p>For instance, the update and delete permission over a resource depends on the read permission.</p>\n     * @param permission The {@link Permission} instance\n     * @param dependencies The set of dependencies\n     */\n    void addDependencies(Permission permission,\n                         Permission... dependencies);\n\n    /**\n     * Get the dependencies (if any) attached to a given permission instance.\n     * @param permission The permission to check\n     * @return A list of permissions\n     */\n    List<Permission> getDependencies(Permission permission);\n\n    /**\n     * Get the expand status\n     * @return true if expanded, false if collapsed\n     */\n    boolean isExpanded();\n\n    /**\n     * Get a property attached to this node\n     * @param key The property key\n     * @return The value object\n     */\n    Object getProperty(String key);\n\n    /**\n     * Attach a property to this node\n     * @param key The property key\n     * @param value The value object\n     */\n    void setProperty(String key,\n                     Object value);\n\n    /**\n     * Check if a property exists and matchs the given value\n     * @param key The property key\n     * @param value The value object to check\n     */\n    boolean propertyEquals(String key,\n                           Object value);\n\n    /**\n     * Retrieve the permissions of the specified node that are implied by this node's permissions.\n     * @return A sub-list of {@link Permission} instances\n     */\n    List<Permission> impliesName(PermissionNode node);\n\n    /**\n     * Expand the node.\n     * <p>\n     * <p>The children nodes are loaded asynchronously and the consumer instance passed\n     * as a parameter is invoked after the loading process is done.</p>\n     * <p>\n     * <p>It does nothing in case the node is already expanded.</p>\n     * @param consumer The callback instance that consumes the children nodes.\n     */\n    void expand(LoadCallback consumer);\n\n    /**\n     * Collapse the node\n     */\n    void collapse();\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/PermissionTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.uberfire.security.authz.PermissionCollection;\n\n/**\n * A hierarchy of {@link PermissionNode} instances\n */\npublic interface PermissionTree {\n\n    /**\n     * Get the root nodes of the tree.\n     * <p>\n     * A list of nodes order by its {@link PermissionNode#getPositionInTree()}. The nodes with the same position\n     * are ordered by node name in incremental order.\n     */\n    List<PermissionNode> getRootNodes();\n\n    /**\n     * Get the resource ids (if any) referenced from the permission instances, see {@link #getPermissions()}.\n     * @param parentNode The parent node to start looking for\n     * @return A collection of resource identifiers\n     */\n    Collection<String> getChildrenResourceIds(PermissionNode parentNode);\n\n    /**\n     * Get the collection of permissions this tree has been initiliazed with\n     */\n    PermissionCollection getPermissions();\n\n    /**\n     * Entry point for visitor interfaces\n     */\n    void accept(PermissionTreeVisitor visitor);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/PermissionTreeFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.VotingStrategy;\n\n/**\n * Interface used to initialize {@link PermissionTree} instances.\n */\npublic interface PermissionTreeFactory {\n\n    PermissionTree createPermissionTree();\n\n    PermissionTree createPermissionTree(Role role);\n\n    PermissionTree createPermissionTree(Group group);\n\n    PermissionTree createPermissionTree(User user,\n                                        VotingStrategy votingStrategy);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/PermissionTreeProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\n/**\n * A {@link PermissionTree} is composed by a list of root nodes. The classes implementing this interface are used by\n * the {@link PermissionTreeFactory} to build those root nodes.\n * <p>\n * <p>From application perspective, custom tree providers can be implemented in order to make application related\n * permissions part of the permission tree.</p>\n */\npublic interface PermissionTreeProvider {\n\n    /**\n     * Returns a brand new node containing a permission node hierarchy.\n     * @return A completely initialized {@link PermissionNode} instance.\n     */\n    PermissionNode buildRootNode();\n\n    /**\n     * Asynchronous interface for loading the children nodes of a given parent permission node.\n     * @param parent The parent node\n     * @param options The load options\n     * @param consumer The callback instance to notify once the loading process is done.\n     */\n    void loadChildren(PermissionNode parent,\n                      LoadOptions options,\n                      LoadCallback consumer);\n\n    /**\n     * Flag indicating if this provider is in active state.\n     * <p>\n     * <p>Only if active, its root node is added to the permission tree.</p>\n     */\n    default boolean isActive() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/PermissionTreeVisitor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree;\n\n/**\n * {@link PermissionTree} visitor interface\n */\npublic interface PermissionTreeVisitor {\n\n    /**\n     * Visit the given {@link PermissionNode}.\n     * @param node The node to visit\n     */\n    void visit(PermissionNode node);\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/AbstractPermissionNode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\n\npublic class AbstractPermissionNode implements PermissionNode {\n\n    private PermissionTree permissionTree = null;\n    private PermissionTreeProvider permissionTreeProvider = null;\n    private PermissionNode parentNode = null;\n    private List<Permission> permissionList = new ArrayList<>();\n    private Map<Permission, List<Permission>> dependencyMap = new HashMap<>();\n    private Map<String, Object> propertyMap = new HashMap<>();\n    private Map<String, String> grantNameMap = new HashMap<>();\n    private Map<String, String> denyNameMap = new HashMap<>();\n    private String nodeName = null;\n    private String nodeFullName = null;\n    private boolean expanded = false;\n    private int positionInTree = 0;\n\n    @Override\n    public PermissionTree getPermissionTree() {\n        return permissionTree;\n    }\n\n    public void setPermissionTree(PermissionTree permissionTree) {\n        this.permissionTree = permissionTree;\n    }\n\n    @Override\n    public PermissionTreeProvider getPermissionTreeProvider() {\n        PermissionNode node = this;\n        PermissionTreeProvider provider = permissionTreeProvider;\n        while (provider == null && node != null) {\n            node = node.getParentNode();\n            provider = node.getPermissionTreeProvider();\n        }\n        return provider;\n    }\n\n    @Override\n    public void setPermissionTreeProvider(PermissionTreeProvider permissionTreeProvider) {\n        this.permissionTreeProvider = permissionTreeProvider;\n    }\n\n    @Override\n    public PermissionNode getParentNode() {\n        return parentNode;\n    }\n\n    @Override\n    public void setParentNode(PermissionNode parentNode) {\n        this.parentNode = parentNode;\n    }\n\n    @Override\n    public List<Permission> getPermissionList() {\n        return permissionList;\n    }\n\n    @Override\n    public void addPermission(Permission permission,\n                              String name) {\n        addPermission(permission,\n                      name,\n                      name);\n    }\n\n    @Override\n    public void addPermission(Permission permission,\n                              String grantName,\n                              String denyName) {\n        permissionList.add(permission);\n        setPermissionGrantName(permission,\n                               grantName);\n        setPermissionDenyName(permission,\n                              denyName);\n    }\n\n    @Override\n    public boolean isExpanded() {\n        return expanded;\n    }\n\n    @Override\n    public Object getProperty(String key) {\n        return propertyMap.get(key);\n    }\n\n    @Override\n    public void setProperty(String key,\n                            Object value) {\n        propertyMap.put(key,\n                        value);\n    }\n\n    @Override\n    public boolean propertyEquals(String key,\n                                  Object value) {\n        return propertyMap.containsKey(key) && propertyMap.get(key).equals(value);\n    }\n\n    @Override\n    public int getPositionInTree() {\n        return positionInTree;\n    }\n\n    public void setPositionInTree(int positionInTree) {\n        this.positionInTree = positionInTree;\n    }\n\n    @Override\n    public String getNodeName() {\n        return nodeName;\n    }\n\n    public void setNodeName(String nodeName) {\n        this.nodeName = nodeName;\n    }\n\n    @Override\n    public String getNodeFullName() {\n        return nodeFullName == null ? getNodeName() : nodeFullName;\n    }\n\n    public void setNodeFullName(String nodeFullName) {\n        this.nodeFullName = nodeFullName;\n    }\n\n    @Override\n    public String getPermissionGrantName(Permission permission) {\n        return grantNameMap.get(permission.getName());\n    }\n\n    public void setPermissionGrantName(Permission permission,\n                                       String name) {\n        grantNameMap.put(permission.getName(),\n                         name);\n    }\n\n    @Override\n    public String getPermissionDenyName(Permission permission) {\n        String name = denyNameMap.get(permission.getName());\n        return name != null ? name : grantNameMap.get(permission.getName());\n    }\n\n    public void setPermissionDenyName(Permission permission,\n                                      String name) {\n        denyNameMap.put(permission.getName(),\n                        name);\n    }\n\n    @Override\n    public List<Permission> impliesName(PermissionNode node) {\n        List<Permission> result = new ArrayList<>();\n        for (Permission other : node.getPermissionList()) {\n            if (impliesName(other)) {\n                result.add(other);\n            }\n        }\n        return result;\n    }\n\n    public boolean impliesName(Permission other) {\n        for (Permission p : permissionList) {\n            if (p.impliesName(other)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    @Override\n    public void updatePermissionList(PermissionCollection permissions) {\n        if (permissions != null) {\n            for (Permission p : permissionList) {\n                Permission existing = permissions.get(p.getName());\n                if (existing != null) {\n                    p.setResult(existing.getResult());\n                } else {\n                    PermissionNode parent = getFirstParentWithPermissions();\n                    if (parent != null) {\n                        for (Permission parentPermission : parent.getPermissionList()) {\n                            if (parentPermission.impliesName(p)) {\n                                p.setResult(parentPermission.getResult());\n                                break;\n                            }\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    private PermissionNode getFirstParentWithPermissions() {\n        PermissionNode parent = getParentNode();\n        while (parent != null && parent.getPermissionList().isEmpty()) {\n            parent = parent.getParentNode();\n        }\n        return parent;\n    }\n\n    @Override\n    public void addDependencies(Permission permission,\n                                Permission... dependencies) {\n        if (dependencies != null) {\n            List<Permission> dependencyList = dependencyMap.get(permission);\n            if (dependencyList == null) {\n                dependencyList = new ArrayList<>();\n                dependencyMap.put(permission,\n                                  dependencyList);\n            }\n            for (Permission dependency : dependencies) {\n                dependencyList.add(dependency);\n            }\n        }\n    }\n\n    @Override\n    public List<Permission> getDependencies(Permission permission) {\n        return dependencyMap.get(permission);\n    }\n\n    @Override\n    public int getLevel() {\n        int level = 0;\n        PermissionNode parent = getParentNode();\n        while (parent != null) {\n            parent = parent.getParentNode();\n            level++;\n        }\n        return level;\n    }\n\n    @Override\n    public void expand(LoadCallback callback) {\n        if (!(this instanceof PermissionLeafNode)) {\n            Collection<String> resourceIds = permissionTree.getChildrenResourceIds(this);\n            DefaultLoadOptions options = new DefaultLoadOptions();\n            options.setResourceIds(resourceIds);\n\n            getPermissionTreeProvider().loadChildren(this,\n                                                     options,\n                                                     children -> {\n                                                         expanded = true;\n                                                         for (PermissionNode child : children) {\n                                                             child.setPermissionTree(permissionTree);\n                                                             child.setParentNode(AbstractPermissionNode.this);\n                                                             child.updatePermissionList(permissionTree.getPermissions());\n                                                         }\n                                                         callback.afterLoad(children);\n                                                     });\n        } else {\n            expanded = true;\n            callback.afterLoad(Collections.emptyList());\n        }\n    }\n\n    @Override\n    public void collapse() {\n        expanded = false;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/DefaultLoadOptions.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport java.util.Collection;\n\nimport org.uberfire.security.client.authz.tree.LoadOptions;\n\npublic class DefaultLoadOptions implements LoadOptions {\n\n    private String nodeNamePattern;\n    private Collection<String> resourceIds;\n    private int maxNodes;\n\n    @Override\n    public String getNodeNamePattern() {\n        return nodeNamePattern;\n    }\n\n    public void setNodeNamePattern(String nodeNamePattern) {\n        this.nodeNamePattern = nodeNamePattern;\n    }\n\n    public Collection<String> getResourceIds() {\n        return resourceIds;\n    }\n\n    public void setResourceIds(Collection<String> resourceIds) {\n        this.resourceIds = resourceIds;\n    }\n\n    @Override\n    public int getMaxNodes() {\n        return maxNodes;\n    }\n\n    public void setMaxNodes(int maxNodes) {\n        this.maxNodes = maxNodes;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/DefaultPermissionTree.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeVisitor;\n\npublic class DefaultPermissionTree implements PermissionTree {\n\n    private PermissionManager permissionManager;\n    private List<PermissionNode> rootNodes;\n    private PermissionCollection permissions;\n\n    public DefaultPermissionTree(PermissionManager permissionManager,\n                                 List<PermissionNode> rootNodes,\n                                 PermissionCollection permissions) {\n        this.permissionManager = permissionManager;\n        this.rootNodes = rootNodes;\n        this.permissions = permissions;\n        this.init();\n    }\n\n    private void init() {\n        for (PermissionNode rootNode : rootNodes) {\n            rootNode.setPermissionTree(this);\n            rootNode.updatePermissionList(permissions);\n        }\n    }\n\n    public List<PermissionNode> getRootNodes() {\n        return Collections.unmodifiableList(rootNodes);\n    }\n\n    @Override\n    public PermissionCollection getPermissions() {\n        return permissions;\n    }\n\n    public Collection<String> getChildrenResourceIds(PermissionNode node) {\n        Set<String> result = new HashSet<>();\n        for (Permission permission : getChildrenPermissions(node)) {\n            String id = permissionManager.resolveResourceId(permission);\n            if (id != null) {\n                result.add(id);\n            }\n        }\n        return result;\n    }\n\n    public Set<Permission> getChildrenPermissions(PermissionNode parent) {\n        List<Permission> permissionInTree = parent.getPermissionList();\n        if (permissionInTree == null || permissions == null || permissions.collection().isEmpty()) {\n            return Collections.emptySet();\n        }\n\n        Set<Permission> result = new HashSet<>();\n        for (Permission parentPermission : permissionInTree) {\n            for (Permission p : permissions.collection()) {\n\n                /// Get only the children that overwrite its parent\n                if (parentPermission.impliesName(p) && !parentPermission.impliesResult(p)) {\n                    result.add(p);\n                }\n            }\n        }\n        return result;\n    }\n\n    public void accept(PermissionTreeVisitor visitor) {\n        for (PermissionNode rootNode : rootNodes) {\n            this.accept(visitor,\n                        rootNode);\n        }\n    }\n\n    public void accept(PermissionTreeVisitor visitor,\n                       PermissionNode node) {\n        visitor.visit(node);\n        node.expand(children -> accept(visitor,\n                                       children));\n    }\n\n    public void accept(PermissionTreeVisitor visitor,\n                       List<PermissionNode> children) {\n        for (PermissionNode child : children) {\n            accept(visitor,\n                   child);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/DefaultPermissionTreeFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.authz.VotingStrategy;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeFactory;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\n\n@ApplicationScoped\npublic class DefaultPermissionTreeFactory implements PermissionTreeFactory {\n\n    private PermissionManager permissionManager;\n    private SyncBeanManager beanManager;\n    private Collection<PermissionTreeProvider> permissionTreeProviderSet = new HashSet<>();\n\n    public DefaultPermissionTreeFactory() {\n    }\n\n    @Inject\n    public DefaultPermissionTreeFactory(PermissionManager permissionManager,\n                                        SyncBeanManager beanManager) {\n        this.permissionManager = permissionManager;\n        this.beanManager = beanManager;\n    }\n\n    public DefaultPermissionTreeFactory(PermissionManager permissionManager,\n                                        Collection<PermissionTreeProvider> permissionTreeProviderSet) {\n        this.permissionManager = permissionManager;\n        this.permissionTreeProviderSet = permissionTreeProviderSet;\n    }\n\n    @PostConstruct\n    private void init() {\n        for (SyncBeanDef<PermissionTreeProvider> beanDef : beanManager.lookupBeans(PermissionTreeProvider.class)) {\n            PermissionTreeProvider provider = beanDef.getInstance();\n            permissionTreeProviderSet.add(provider);\n        }\n    }\n\n    @Override\n    public PermissionTree createPermissionTree() {\n        return createPermissionTree((PermissionCollection) null);\n    }\n\n    @Override\n    public PermissionTree createPermissionTree(Role role) {\n        AuthorizationPolicy policy = permissionManager.getAuthorizationPolicy();\n        PermissionCollection pc = policy.getPermissions(role);\n        return createPermissionTree(pc);\n    }\n\n    @Override\n    public PermissionTree createPermissionTree(Group group) {\n        AuthorizationPolicy policy = permissionManager.getAuthorizationPolicy();\n        PermissionCollection pc = policy.getPermissions(group);\n        return createPermissionTree(pc);\n    }\n\n    @Override\n    public PermissionTree createPermissionTree(User user,\n                                               VotingStrategy votingStrategy) {\n        PermissionCollection pc = permissionManager.resolvePermissions(user,\n                                                                       votingStrategy);\n        return createPermissionTree(pc);\n    }\n\n    private PermissionTree createPermissionTree(PermissionCollection permissions) {\n        List<PermissionNode> rootNodes = new ArrayList<>();\n        for (PermissionTreeProvider provider : permissionTreeProviderSet) {\n            if (provider.isActive()) {\n                PermissionNode rootNode = provider.buildRootNode();\n                if (rootNode != null) {\n                    rootNodes.add(rootNode);\n                }\n            }\n        }\n        Collections.sort(rootNodes,\n                         this::compareRootNode);\n        return new DefaultPermissionTree(permissionManager,\n                                         rootNodes,\n                                         permissions);\n    }\n\n    private int compareRootNode(PermissionNode n1,\n                                PermissionNode n2) {\n        if (n1.getPositionInTree() > n2.getPositionInTree()) {\n            return 1;\n        }\n        if (n1.getPositionInTree() < n2.getPositionInTree()) {\n            return -1;\n        }\n        String name1 = n1.getNodeName();\n        String name2 = n2.getNodeName();\n        return name1.compareTo(name2);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/PermissionGroupNode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\n\n/**\n * An group node contains a non-modifiable set of children nodes\n */\npublic class PermissionGroupNode extends AbstractPermissionNode {\n\n    public PermissionGroupNode() {\n        super();\n    }\n\n    public PermissionGroupNode(PermissionTreeProvider provider) {\n        this();\n        super.setPermissionTreeProvider(provider);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/PermissionLeafNode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\n/**\n * A leaf node does not contain any children and it only allows for changing its permission values\n */\npublic class PermissionLeafNode extends AbstractPermissionNode {\n\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/java/org/uberfire/security/client/authz/tree/impl/PermissionResourceNode.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz.tree.impl;\n\nimport org.uberfire.security.client.authz.tree.HasResources;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\n\n/**\n * A resource node allows for adding or removing children nodes (each one represents a set of permissions\n * over a single resource instance) at runtime.\n */\npublic class PermissionResourceNode extends AbstractPermissionNode implements HasResources {\n\n    private String resourceName = null;\n\n    public PermissionResourceNode() {\n        super();\n    }\n\n    public PermissionResourceNode(String resourceName,\n                                  PermissionTreeProvider provider) {\n        this();\n        super.setPermissionTreeProvider(provider);\n        this.resourceName = resourceName;\n    }\n\n    @Override\n    public String getResourceName() {\n        return resourceName;\n    }\n\n    public void setResourceName(String resourceName) {\n        this.resourceName = resourceName;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/main/resources/org/uberfire/security/UberfireSecurityClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.enterprise.CDI\"/>\n  <inherits name=\"org.uberfire.security.UberfireSecurityAPI\"/>\n  <inherits name=\"org.jboss.errai.security.Security\"/>\n  <inherits name=\"org.jboss.errai.ui.nav.Navigation\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/test/java/org/uberfire/security/client/authz/GeneralTreeProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionGroupNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\n\n/**\n * Static permissions tree provider\n */\npublic class GeneralTreeProvider implements PermissionTreeProvider {\n\n    private PermissionManager permissionManager;\n\n    public GeneralTreeProvider(PermissionManager permissionManager) {\n        this.permissionManager = permissionManager;\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        PermissionGroupNode rootNode = new PermissionGroupNode(this);\n        rootNode.setNodeName(\"General\");\n        return rootNode;\n    }\n\n    @Override\n    public void loadChildren(PermissionNode parent,\n                             LoadOptions options,\n                             LoadCallback callback) {\n\n        if (parent.getNodeName().equals(\"General\")) {\n            List<PermissionNode> result = new ArrayList<>();\n            result.addAll(buildSettingNodes(null,\n                                            1,\n                                            2));\n\n            PermissionGroupNode categoryA = new PermissionGroupNode();\n            categoryA.setNodeName(\"Category A\");\n            result.add(categoryA);\n\n            PermissionGroupNode categoryB = new PermissionGroupNode();\n            categoryB.setNodeName(\"Category B\");\n            Permission p = permissionManager.createPermission(\"general.categoryB\",\n                                                              true);\n            categoryB.addPermission(p,\n                                    \"Allow\",\n                                    \"Deny\");\n            result.add(categoryB);\n\n            callback.afterLoad(result);\n        } else if (parent.getNodeName().equals(\"Category A\")) {\n            callback.afterLoad(buildSettingNodes(\"A\",\n                                                 3,\n                                                 5));\n        } else if (parent.getNodeName().equals(\"Category B\")) {\n            callback.afterLoad(buildSettingNodes(\"B\",\n                                                 8,\n                                                 3));\n        }\n    }\n\n    private List<PermissionNode> buildSettingNodes(String id,\n                                                   int from,\n                                                   int n) {\n        List<PermissionNode> result = new ArrayList<>();\n\n        for (int i = from; i < from + n; i++) {\n            PermissionLeafNode setting = new PermissionLeafNode();\n            setting.setNodeName(\"Setting \" + i);\n            String name = \"general\" + (id != null ? \".category\" + id : \"\") + \".setting\" + i;\n            Permission p = permissionManager.createPermission(name,\n                                                              true);\n            setting.addPermission(p,\n                                  \"Allow\",\n                                  \"Deny\");\n            result.add(setting);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/test/java/org/uberfire/security/client/authz/PermissionTreeTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.inject.Instance;\n\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.PermissionTreeFactory;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.PermissionTreeVisitor;\nimport org.uberfire.security.client.authz.tree.impl.DefaultPermissionTreeFactory;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PermissionTreeTest {\n\n    @Mock\n    Resource projectA;\n\n    @Mock\n    Resource projectB;\n\n    @Mock\n    Instance<PermissionTreeProvider> permissionProviders;\n\n    ProjectTreeProvider projectProvider;\n    GeneralTreeProvider generalTreeProvider;\n    PermissionTreeFactory permissionTreeFactory;\n    PermissionManager permissionManager;\n\n    @Before\n    public void setUp() {\n        when(projectA.getIdentifier()).thenReturn(\"p1\");\n        when(projectB.getIdentifier()).thenReturn(\"p2\");\n        when(projectA.getResourceType()).thenReturn(ProjectTreeProvider.PROJECT_TYPE);\n        when(projectB.getResourceType()).thenReturn(ProjectTreeProvider.PROJECT_TYPE);\n\n        permissionManager = new DefaultPermissionManager();\n        projectProvider = new ProjectTreeProvider(permissionManager,\n                                                  Arrays.asList(projectA,\n                                                                projectB));\n        generalTreeProvider = new GeneralTreeProvider(permissionManager);\n        permissionTreeFactory = new DefaultPermissionTreeFactory(permissionManager,\n                                                                 Arrays.asList(generalTreeProvider,\n                                                                               projectProvider));\n\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\")\n                        .permission(\"project.create\",\n                                    true)\n                        .permission(\"project.read\",\n                                    false)\n                        .permission(\"project.read.p1\",\n                                    true)\n                        .permission(\"project.edit\",\n                                    true)\n                        .permission(\"project.edit.p1\",\n                                    false)\n                        .permission(\"project.delete\",\n                                    true)\n                        .permission(\"project.delete.p1\",\n                                    false)\n                        .permission(\"general.categoryB\",\n                                    false)\n                        .permission(\"general.categoryB.setting8\",\n                                    false)\n                        .permission(\"general.categoryB.setting9\",\n                                    true)\n                        .permission(\"general.categoryB.setting10\",\n                                    true)\n                        .role(\"manager\")\n                        .permission(\"project.create\",\n                                    false)\n                        .permission(\"project.read\",\n                                    true)\n                        .build());\n    }\n\n    @Test\n    public void testProjectNodeInitialization() {\n        PermissionTree tree = permissionTreeFactory.createPermissionTree();\n        List<PermissionNode> rootNodes = tree.getRootNodes();\n        assertEquals(rootNodes.size(),\n                     2);\n\n        PermissionNode rootNode = rootNodes.get(1);\n        assertEquals(rootNode.getNodeName(),\n                     \"Projects\");\n        assertEquals(rootNode.getPermissionList().size(),\n                     4);\n        assertTrue(rootNode instanceof PermissionResourceNode);\n        assertEquals(rootNode.getLevel(),\n                     0);\n\n        rootNode.expand(children -> {\n            assertEquals(children.size(),\n                         2);\n            PermissionNode projectNode = children.get(0);\n            assertEquals(projectNode.getNodeName(),\n                         \"p1\");\n            assertTrue(projectNode instanceof PermissionLeafNode);\n            assertEquals(projectNode.getPermissionList().size(),\n                         3);\n            assertEquals(projectNode.getLevel(),\n                         1);\n            assertEquals(rootNode.impliesName(projectNode).size(),\n                         3);\n\n            projectNode = children.get(1);\n            assertEquals(projectNode.getNodeName(),\n                         \"p2\");\n            assertTrue(projectNode instanceof PermissionLeafNode);\n            assertEquals(projectNode.getPermissionList().size(),\n                         3);\n            assertEquals(rootNode.impliesName(projectNode).size(),\n                         3);\n        });\n    }\n\n    @Test\n    public void testProjectsLoading() {\n        PermissionTree tree = permissionTreeFactory.createPermissionTree(new RoleImpl(\"admin\"));\n        PermissionNode rootNode = tree.getRootNodes().get(1);\n        assertEquals(rootNode.getPermissionList().get(0).getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(rootNode.getPermissionList().get(1).getResult(),\n                     AuthorizationResult.ACCESS_DENIED);\n        assertEquals(rootNode.getPermissionList().get(2).getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n        assertEquals(rootNode.getPermissionList().get(3).getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        rootNode.expand(children -> {\n            assertEquals(children.size(),\n                         1);\n            PermissionNode projectNode = children.get(0);\n            assertEquals(projectNode.getNodeName(),\n                         \"p1\");\n            assertEquals(projectNode.getPermissionList().size(),\n                         3);\n            assertEquals(projectNode.getPermissionList().get(0).getName(),\n                         \"project.read.p1\");\n            assertEquals(projectNode.getPermissionList().get(1).getName(),\n                         \"project.edit.p1\");\n            assertEquals(projectNode.getPermissionList().get(2).getName(),\n                         \"project.delete.p1\");\n            assertEquals(projectNode.getPermissionList().get(0).getResult(),\n                         AuthorizationResult.ACCESS_GRANTED);\n            assertEquals(projectNode.getPermissionList().get(1).getResult(),\n                         AuthorizationResult.ACCESS_DENIED);\n            assertEquals(projectNode.getPermissionList().get(2).getResult(),\n                         AuthorizationResult.ACCESS_DENIED);\n        });\n    }\n\n    @Test\n    public void testVisitor() {\n        PermissionTree tree = permissionTreeFactory.createPermissionTree(new RoleImpl(\"admin\"));\n        PermissionTreeVisitor visitor = mock(PermissionTreeVisitor.class);\n        tree.accept(visitor);\n\n        ArgumentCaptor<PermissionNode> argumentCaptor = ArgumentCaptor.forClass(PermissionNode.class);\n        verify(visitor,\n               times(15)).visit(argumentCaptor.capture());\n\n        boolean projectsVisited = false;\n        boolean p1Visited = false;\n        boolean p2Visited = false;\n        for (PermissionNode permissionNode : argumentCaptor.getAllValues()) {\n            String name = permissionNode.getNodeName();\n            if (\"Projects\".equals(name)) {\n                projectsVisited = true;\n            } else if (\"p1\".equals(name)) {\n                p1Visited = true;\n                assertEquals(permissionNode.getPermissionList().size(),\n                             3);\n                assertEquals(permissionNode.getPermissionList().get(0).getName(),\n                             \"project.read.p1\");\n                assertEquals(permissionNode.getPermissionList().get(1).getName(),\n                             \"project.edit.p1\");\n                assertEquals(permissionNode.getPermissionList().get(2).getName(),\n                             \"project.delete.p1\");\n                assertEquals(permissionNode.getPermissionList().get(0).getResult(),\n                             AuthorizationResult.ACCESS_GRANTED);\n                assertEquals(permissionNode.getPermissionList().get(1).getResult(),\n                             AuthorizationResult.ACCESS_DENIED);\n                assertEquals(permissionNode.getPermissionList().get(2).getResult(),\n                             AuthorizationResult.ACCESS_DENIED);\n            } else if (\"p2\".equals(name)) {\n                p2Visited = true;\n            }\n        }\n        assertTrue(projectsVisited);\n        assertTrue(p1Visited);\n        assertFalse(p2Visited);\n    }\n\n    @Test\n    public void testInheritPermissionValue() {\n        PermissionTree tree = permissionTreeFactory.createPermissionTree(new RoleImpl(\"admin\"));\n        PermissionTreeVisitor visitor = mock(PermissionTreeVisitor.class);\n        tree.accept(visitor);\n\n        ArgumentCaptor<PermissionNode> argumentCaptor = ArgumentCaptor.forClass(PermissionNode.class);\n        verify(visitor,\n               times(15)).visit(argumentCaptor.capture());\n\n        for (PermissionNode node : argumentCaptor.getAllValues()) {\n\n            // setting8 must be initialized to false according to its parent\n            if (node.getNodeName().equals(\"Setting 8\")) {\n                assertEquals(node.getPermissionList().size(),\n                             1);\n                Permission p = node.getPermissionList().get(0);\n                assertEquals(p.getResult(),\n                             AuthorizationResult.ACCESS_DENIED);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client/src/test/java/org/uberfire/security/client/authz/ProjectTreeProvider.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\n\n/**\n * Resource based tree provider\n */\npublic class ProjectTreeProvider implements PermissionTreeProvider {\n\n    public static final ResourceType PROJECT_TYPE = () -> \"project\";\n    public static final ResourceAction PROJECT_CREATE = () -> \"create\";\n    public static final ResourceAction PROJECT_READ = () -> \"read\";\n    public static final ResourceAction PROJECT_EDIT = () -> \"edit\";\n    public static final ResourceAction PROJECT_DELETE = () -> \"delete\";\n\n    private PermissionManager permissionManager;\n    private List<Resource> projectList;\n\n    public ProjectTreeProvider(PermissionManager permissionManager,\n                               List<Resource> projectList) {\n        this.permissionManager = permissionManager;\n        this.projectList = projectList;\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        PermissionResourceNode rootNode = new PermissionResourceNode(\"Project\",\n                                                                     this);\n        rootNode.setNodeName(\"Projects\");\n        rootNode.addPermission(newPermission(PROJECT_CREATE),\n                               \"Create\");\n        rootNode.addPermission(newPermission(PROJECT_READ),\n                               \"Read\");\n        rootNode.addPermission(newPermission(PROJECT_EDIT),\n                               \"Edit\");\n        rootNode.addPermission(newPermission(PROJECT_DELETE),\n                               \"Delete\");\n        return rootNode;\n    }\n\n    @Override\n    public void loadChildren(PermissionNode parent,\n                             LoadOptions options,\n                             LoadCallback callback) {\n        if (parent.getNodeName().equals(\"Projects\")) {\n            List<PermissionNode> nodes = getAllProjects().stream()\n                    .filter(p -> match(p,\n                                       options))\n                    .map(this::toProjectNode)\n                    .collect(Collectors.toList());\n\n            callback.afterLoad(nodes);\n        }\n    }\n\n    private Permission newPermission(ResourceAction action) {\n        return permissionManager.createPermission(PROJECT_TYPE,\n                                                  action,\n                                                  true);\n    }\n\n    private Permission newPermission(Resource resource,\n                                     ResourceAction action) {\n        return permissionManager.createPermission(resource,\n                                                  action,\n                                                  true);\n    }\n\n    private boolean match(Resource project,\n                          LoadOptions options) {\n        Collection<String> includedIds = options.getResourceIds();\n\n        if (includedIds == null || includedIds.isEmpty()) {\n            return true;\n        }\n        for (String resourceId : includedIds) {\n            if (project.getIdentifier().contains(resourceId)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private PermissionNode toProjectNode(Resource project) {\n        PermissionLeafNode node = new PermissionLeafNode();\n        node.setNodeName(project.getIdentifier());\n        node.addPermission(newPermission(project,\n                                         PROJECT_READ),\n                           \"Read\");\n        node.addPermission(newPermission(project,\n                                         PROJECT_EDIT),\n                           \"Edit\");\n        node.addPermission(newPermission(project,\n                                         PROJECT_DELETE),\n                           \"Delete\");\n        return node;\n    }\n\n    private List<Resource> getAllProjects() {\n        return projectList;\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~        http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-security</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-security-client-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Security Client Backend</name>\n  <description>UberFire Security Client Backend</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client-backend/src/main/java/org/uberfire/security/client/SecurityEntryPoint.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.backend.authz.AuthorizationService;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\n@EntryPoint\n@ApplicationScoped\npublic class SecurityEntryPoint {\n\n    @Inject\n    private Caller<AuthorizationService> authorizationService;\n\n    @Inject\n    private PermissionManager permissionManager;\n\n    @PostConstruct\n    public void init() {\n        authorizationService.call(\n                (AuthorizationPolicy p) -> {\n                    permissionManager.setAuthorizationPolicy(p);\n                }\n        ).loadPolicy();\n    }\n\n    public void onPolicySaved(@Observes AuthorizationPolicySavedEvent event) {\n        AuthorizationPolicy policy = event.getPolicy();\n        permissionManager.setAuthorizationPolicy(policy);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2019 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#        http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client-backend/src/main/resources/org/uberfire/security/UberfireSecurityClientBackend.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.security.UberfireSecurityClient\"/>\n\n  <source path='client'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-client-backend/src/test/java/org/uberfire/security/client/SecurityEntryPointTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.security.client;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.events.AuthorizationPolicySavedEvent;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SecurityEntryPointTest {\n\n    @Mock\n    private PermissionManager permissionManager;\n\n    @InjectMocks\n    private SecurityEntryPoint securityEntryPoint;\n\n    @Test\n    public void onPolicySavedTest() {\n        final AuthorizationPolicy policy = mock(AuthorizationPolicy.class);\n        final AuthorizationPolicySavedEvent event = new AuthorizationPolicySavedEvent(policy);\n\n        securityEntryPoint.onPolicySaved(event);\n\n        verify(permissionManager).setAuthorizationPolicy(policy);\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-security</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-security-codegen</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Security Codegen</name>\n  <description>UberFire Security Code Generators</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-codegen</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/main/java/org/uberfire/security/processors/PermissionCheckProcessor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.processors;\n\nimport org.jboss.errai.codegen.Statement;\nimport org.jboss.errai.codegen.meta.MetaMethod;\nimport org.jboss.errai.codegen.util.Stmt;\nimport org.jboss.errai.ioc.client.api.CodeDecorator;\nimport org.jboss.errai.ioc.rebind.ioc.extension.IOCDecoratorExtension;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.Decorable;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.FactoryController;\nimport org.uberfire.security.annotations.PermissionCheck;\nimport org.uberfire.security.client.authz.AuthorizationManagerHelper;\n\n/**\n * <p>Given a method where a specific permission is required like, for instance:</p>\n * <p>\n * <pre>\n * {@code @PermissionCheck(\"featureX\")\n *    private void enableFeatureX() {\n *        ...\n *    }\n * }\n * </pre>\n * <p>\n * <p>This processor will append the required security check code to ensure the method body\n * is only executed when the user is granted with the proper permission rights.</p>\n * </pre>\n */\n@CodeDecorator\npublic class PermissionCheckProcessor extends IOCDecoratorExtension<PermissionCheck> {\n\n    public PermissionCheckProcessor(Class<PermissionCheck> decoratesWith) {\n        super(decoratesWith);\n    }\n\n    @Override\n    public void generateDecorator(final Decorable decorable,\n                                  final FactoryController controller) {\n        MetaMethod metaMethod = decorable.getAsMethod();\n        PermissionCheck securedResource = metaMethod.getAnnotation(PermissionCheck.class);\n        String permission = securedResource.value();\n        String onGranted = securedResource.onGranted();\n        String onDenied = securedResource.onDenied();\n        String declaringClass = metaMethod.getDeclaringClassName();\n\n        // The method must return void\n        if (!metaMethod.getReturnType().getName().equals(\"void\")) {\n            throw new RuntimeException(\"The @PermissionCheck annotated method \\\"\" +\n                                               declaringClass + \"#\" + metaMethod.getName() + \"\\\" must return void\");\n        }\n\n        // Permission check\n        if (permission == null || permission.trim().length() == 0) {\n            Statement stmt = createPermissionCheck(permission,\n                                                   onGranted,\n                                                   onDenied);\n            controller.addInvokeBefore(metaMethod,\n                                       stmt);\n        }\n    }\n\n    public Statement createPermissionCheck(String permission,\n                                           String onGranted,\n                                           String onDenied) {\n        return ResourceCheckProcessor.buildCheckStatement(\n                Stmt.invokeStatic(AuthorizationManagerHelper.class,\n                                  \"authorize\",\n                                  permission),\n                onGranted,\n                onDenied);\n    }\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/main/java/org/uberfire/security/processors/ResourceCheckProcessor.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.processors;\n\nimport org.jboss.errai.codegen.BooleanExpression;\nimport org.jboss.errai.codegen.Statement;\nimport org.jboss.errai.codegen.builder.BlockBuilder;\nimport org.jboss.errai.codegen.builder.ContextualStatementBuilder;\nimport org.jboss.errai.codegen.builder.ElseBlockBuilder;\nimport org.jboss.errai.codegen.builder.StatementEnd;\nimport org.jboss.errai.codegen.builder.impl.BooleanExpressionBuilder;\nimport org.jboss.errai.codegen.meta.MetaClass;\nimport org.jboss.errai.codegen.meta.MetaMethod;\nimport org.jboss.errai.codegen.meta.MetaParameter;\nimport org.jboss.errai.codegen.util.If;\nimport org.jboss.errai.codegen.util.Stmt;\nimport org.jboss.errai.ioc.client.api.CodeDecorator;\nimport org.jboss.errai.ioc.rebind.ioc.extension.IOCDecoratorExtension;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.Decorable;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.FactoryController;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.annotations.ResourceCheck;\nimport org.uberfire.security.client.authz.AuthorizationManagerHelper;\n\n/**\n * <p>Given a method where \"project\" creation permissions are required like, for instance:</p>\n * <p>\n * <pre>\n * {@code @SecuredAction(type=\"project\", action=\"create\")\n *    private void enableProjectCreation() {\n *        creationButton.setEnabled(true);\n *    }\n * }\n * </pre>\n * <p>\n * <p>This processor class will append the required security check code to ensure the method body\n * is only executed when the user is granted with the proper permission rights.</p>\n * <p>\n * <p>For resource instance specific checks a parameter of a class implementing {@link Resource}\n * is required. For instance:</p>\n * <pre>\n * {@code @SecuredAction(action=\"create\")\n *    private void addProjectToView(Project project) {\n *        view,addProject(project.getName());\n *    }\n * }\n * </pre>\n */\n@CodeDecorator\npublic class ResourceCheckProcessor extends IOCDecoratorExtension<ResourceCheck> {\n\n    public ResourceCheckProcessor(Class<ResourceCheck> decoratesWith) {\n        super(decoratesWith);\n    }\n\n    public static Statement buildCheckStatement(ContextualStatementBuilder authzCall,\n                                                String onGranted,\n                                                String onDenied) {\n        BooleanExpression boolExpr = BooleanExpressionBuilder.create(authzCall).negate();\n        BlockBuilder<ElseBlockBuilder> builder = If.cond(boolExpr);\n        if (onDenied != null && onDenied.trim().length() > 0) {\n            builder.append(Stmt.loadVariable(\"this\").invoke(onDenied));\n        }\n        BlockBuilder<StatementEnd> endBuilder = builder.append(Stmt.returnVoid()).finish().else_();\n        if (onGranted != null && onGranted.trim().length() > 0) {\n            endBuilder.append(Stmt.loadVariable(\"this\").invoke(onGranted));\n        }\n        return endBuilder.finish();\n    }\n\n    @Override\n    public void generateDecorator(final Decorable decorable,\n                                  final FactoryController controller) {\n        MetaMethod metaMethod = decorable.getAsMethod();\n        ResourceCheck securedResource = metaMethod.getAnnotation(ResourceCheck.class);\n        String resourceType = securedResource.type();\n        String resourceAction = securedResource.action();\n        String onGranted = securedResource.onGranted();\n        String onDenied = securedResource.onDenied();\n        String declaringClass = metaMethod.getDeclaringClassName();\n        int paramCount = metaMethod.getParameters().length;\n\n        // The method must return void\n        if (!metaMethod.getReturnType().getName().equals(\"void\")) {\n            throw new RuntimeException(\"The @ResourceCheck annotated method \\\"\" +\n                                               declaringClass + \"#\" + metaMethod.getName() + \"\\\" must return void\");\n        }\n\n        // Infer the check type: global action or resource check\n        boolean resourceCheck = false;\n        if (paramCount > 0) {\n            MetaParameter resourceParameter = metaMethod.getParameters()[0];\n            resourceCheck = implementsResource(resourceParameter.getType());\n        }\n\n        // Resource instance check\n        if (resourceCheck) {\n            MetaParameter p1 = metaMethod.getParameters()[0];\n            Statement stmt = createResourceActionCheck(p1.getName(),\n                                                       resourceAction,\n                                                       onGranted,\n                                                       onDenied);\n            controller.addInvokeBefore(metaMethod,\n                                       stmt);\n        }\n        // Global action check\n        else {\n            // The resource type is mandatory\n            if (resourceType == null || resourceType.trim().length() == 0) {\n                throw new RuntimeException(\"The @ResourceCheck parameter named \\\"type\\\" is missing \" +\n                                                   \"\\\"\" + declaringClass + \"#\" + metaMethod.getName() + \"\\\"\");\n            }\n            Statement stmt = createGlobalActionCheck(resourceType,\n                                                     resourceAction,\n                                                     onGranted,\n                                                     onDenied);\n            controller.addInvokeBefore(metaMethod,\n                                       stmt);\n        }\n    }\n\n    public boolean implementsResource(MetaClass metaClass) {\n        for (MetaClass iface : metaClass.getInterfaces()) {\n            if (iface.asClass().equals(Resource.class) || implementsResource(iface)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public Statement createResourceActionCheck(String resourceName,\n                                               String resourceAction,\n                                               String onGranted,\n                                               String onDenied) {\n        return buildCheckStatement(Stmt.invokeStatic(AuthorizationManagerHelper.class,\n                                                     \"authorize\",\n                                                     Stmt.loadVariable(resourceName),\n                                                     resourceAction),\n                                   onGranted,\n                                   onDenied);\n    }\n\n    public Statement createGlobalActionCheck(String resourceType,\n                                             String resourceAction,\n                                             String onGranted,\n                                             String onDenied) {\n        return buildCheckStatement(Stmt.invokeStatic(AuthorizationManagerHelper.class,\n                                                     \"authorize\",\n                                                     resourceType,\n                                                     resourceAction),\n                                   onGranted,\n                                   onDenied);\n    }\n}"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/test/java/org/uberfire/security/client/authz/PermissionCheckProcessorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz;\n\nimport org.jboss.errai.codegen.Context;\nimport org.jboss.errai.codegen.Statement;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.Decorable;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.FactoryController;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.annotations.PermissionCheck;\nimport org.uberfire.security.processors.PermissionCheckProcessor;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PermissionCheckProcessorTest {\n\n    @Mock\n    Decorable decorable;\n\n    @Mock\n    FactoryController controller;\n\n    Context context = Context.create();\n    PermissionCheckProcessor processor;\n\n    @Before\n    public void setUp() {\n        processor = new PermissionCheckProcessor(PermissionCheck.class);\n        context.addVariable(\"this\",\n                            FunctionTest.class);\n    }\n\n    @Test\n    public void testPermissionStatement() {\n        Statement stmt = processor.createPermissionCheck(\"myfeature\",\n                                                         null,\n                                                         null);\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(\\\"myfeature\\\"))) {\\n\" +\n                             \"  return;\\n\" +\n                             \"}\");\n    }\n\n    @Test\n    public void testEmptyCallback() {\n        Statement stmt = processor.createPermissionCheck(\"myfeature\",\n                                                         \"\",\n                                                         \"\");\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(\\\"myfeature\\\"))) {\\n\" +\n                             \"  return;\\n\" +\n                             \"}\");\n    }\n\n    @Test\n    public void testPermissionCallbacks() {\n        Statement stmt = processor.createPermissionCheck(\"myfeature\",\n                                                         \"granted\",\n                                                         \"denied\");\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(\\\"myfeature\\\"))) {\\n\" +\n                             \"  denied();\\n\" +\n                             \"  return;\\n\" +\n                             \"} else {\\n\" +\n                             \"  granted();\\n\" +\n                             \"}\");\n    }\n\n    interface FunctionTest {\n\n        void granted();\n\n        void denied();\n    }\n}\n"
  },
  {
    "path": "uberfire-security/uberfire-security-codegen/src/test/java/org/uberfire/security/client/authz/ResourceCheckProcessorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.security.client.authz;\n\nimport org.jboss.errai.codegen.Context;\nimport org.jboss.errai.codegen.Statement;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.Decorable;\nimport org.jboss.errai.ioc.rebind.ioc.injector.api.FactoryController;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.annotations.ResourceCheck;\nimport org.uberfire.security.processors.ResourceCheckProcessor;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ResourceCheckProcessorTest {\n\n    @Mock\n    Decorable decorable;\n\n    @Mock\n    FactoryController controller;\n\n    Context context = Context.create();\n    ResourceCheckProcessor processor;\n\n    @Before\n    public void setUp() {\n        processor = new ResourceCheckProcessor(ResourceCheck.class);\n        context.addVariable(\"project1\",\n                            String.class);\n        context.addVariable(\"this\",\n                            FunctionTest.class);\n    }\n\n    @Test\n    public void testGlobalActionStatement() {\n        Statement stmt = processor.createGlobalActionCheck(\"project\",\n                                                           \"create\",\n                                                           null,\n                                                           null);\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(\\\"project\\\", \\\"create\\\"))) {\\n\" +\n                             \"  return;\\n\" +\n                             \"}\");\n    }\n\n    @Test\n    public void testResourceActionStatement() {\n        Statement stmt = processor.createResourceActionCheck(\"project1\",\n                                                             \"create\",\n                                                             null,\n                                                             null);\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(project1, \\\"create\\\"))) {\\n\" +\n                             \"  return;\\n\" +\n                             \"}\");\n    }\n\n    @Test\n    public void testCallbacks() {\n        Statement stmt = processor.createResourceActionCheck(\"project1\",\n                                                             \"read\",\n                                                             \"granted\",\n                                                             \"denied\");\n        String ifStr = stmt.generate(context);\n        assertEquals(ifStr,\n                     \"if (!(org.uberfire.security.client.authz.AuthorizationManagerHelper.authorize(project1, \\\"read\\\"))) {\\n\" +\n                             \"  denied();\\n\" +\n                             \"  return;\\n\" +\n                             \"} else {\\n\" +\n                             \"  granted();\\n\" +\n                             \"}\");\n    }\n\n    interface FunctionTest {\n\n        void granted();\n\n        void denied();\n    }\n}\n"
  },
  {
    "path": "uberfire-server/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-server/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-server</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Server</name>\n  <description>UberFire Server</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-fileupload</groupId>\n      <artifactId>commons-fileupload</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jsoup</groupId>\n      <artifactId>jsoup</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/BaseFilteredServlet.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServlet;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.regex.AntPathMatcher;\nimport org.uberfire.java.nio.file.Path;\n\nimport static javax.servlet.http.HttpServletResponse.SC_FORBIDDEN;\n\npublic abstract class BaseFilteredServlet extends HttpServlet {\n\n    private static final Logger logger = LoggerFactory.getLogger(BaseFilteredServlet.class);\n\n    protected Collection<String> includes = new ArrayList<String>();\n    protected Collection<String> excludes = new ArrayList<String>();\n\n    @Override\n    public void init(final ServletConfig config) throws ServletException {\n        super.init(config);\n        final String _includes = config.getInitParameter(\"includes-path\");\n        if (_includes != null && !_includes.trim().isEmpty()) {\n            includes.addAll(Arrays.asList(_includes.split(\",\")));\n        }\n        final String _excludes = config.getInitParameter(\"excludes-path\");\n        if (_excludes != null && !_excludes.trim().isEmpty()) {\n            excludes.addAll(Arrays.asList(_excludes.split(\",\")));\n        }\n    }\n\n    protected boolean validateAccess(final URI uri,\n                                     final HttpServletResponse response) {\n        if (!AntPathMatcher.filter(includes,\n                                   excludes,\n                                   uri)) {\n            logger.error(\"Invalid credentials to path.\");\n            try {\n                response.sendError(SC_FORBIDDEN);\n            } catch (Exception ex) {\n                logger.error(ex.getMessage(),\n                             ex);\n            }\n            return false;\n        }\n        return true;\n    }\n\n    protected boolean validateAccess(final Path path,\n                                     final HttpServletResponse response) {\n        if (!AntPathMatcher.filter(includes,\n                                   excludes,\n                                   path)) {\n            logger.error(\"Invalid credentials to path.\");\n            try {\n                response.sendError(SC_FORBIDDEN);\n            } catch (Exception ex) {\n                logger.error(ex.getMessage(),\n                             ex);\n            }\n            return false;\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/BaseUploadServlet.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.io.IOException;\nimport java.util.Iterator;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileItemFactory;\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.apache.commons.fileupload.disk.DiskFileItemFactory;\nimport org.apache.commons.fileupload.servlet.ServletFileUpload;\nimport org.apache.commons.io.IOUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\npublic abstract class BaseUploadServlet extends BaseFilteredServlet {\n\n    private static final Logger logger = LoggerFactory.getLogger(BaseUploadServlet.class);\n\n    protected FileItem getFileItem(HttpServletRequest request) throws FileUploadException {\n        final Iterator iterator = getServletFileUpload().parseRequest(request).iterator();\n        while (iterator.hasNext()) {\n            FileItem item = (FileItem) iterator.next();\n            if (!item.isFormField()) {\n                return item;\n            }\n        }\n        return null;\n    }\n\n    protected void writeResponse(HttpServletResponse response,\n                                 String content) throws IOException {\n        response.setContentType(\"text/html\");\n        response.getWriter().write(content);\n        response.getWriter().flush();\n    }\n\n    protected ServletFileUpload getServletFileUpload() {\n        FileItemFactory factory = new DiskFileItemFactory();\n        ServletFileUpload upload = new ServletFileUpload(factory);\n        upload.setHeaderEncoding(\"UTF-8\");\n        return upload;\n    }\n\n    protected void writeFile(final IOService ioService,\n                             final Path path,\n                             final FileItem uploadedItem) throws IOException {\n        try {\n            ioService.startBatch(path.getFileSystem());\n            ioService.write(path,\n                            IOUtils.toByteArray(uploadedItem.getInputStream()));\n        } finally {\n            uploadedItem.getInputStream().close();\n            ioService.endBatch();\n        }\n    }\n\n    protected void logError(Throwable e) {\n        logger.error(\"Failed to upload a file.\",\n                     e);\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/FileDownloadServlet.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.server.util.FileServletUtil;\n\nimport static java.lang.String.format;\n\npublic class FileDownloadServlet\n        extends BaseFilteredServlet {\n\n    private static final Logger logger = LoggerFactory.getLogger(FileDownloadServlet.class);\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Override\n    protected void doGet(HttpServletRequest request,\n                         HttpServletResponse response)\n            throws ServletException, IOException {\n\n        try {\n            final URI uri = makeURI(request.getParameter(\"path\"));\n\n            if (!validateAccess(uri,\n                                response)) {\n                return;\n            }\n\n            final Path path = ioService.get(uri);\n\n            byte[] bytes = ioService.readAllBytes(path);\n\n            response.setHeader(\"Content-Disposition\",\n                               format(\"attachment; filename=\\\"%s\\\";\",\n                                      path.getFileName().toString()));\n\n            response.setContentType(\"application/octet-stream\");\n\n            response.getOutputStream().write(\n                    bytes,\n                    0,\n                    bytes.length);\n        } catch (final Exception e) {\n            logger.error(\"Failed to download a file.\",\n                         e);\n        }\n    }\n\n    URI makeURI(final String path) throws URISyntaxException {\n        final String encodedPath = FileServletUtil.encodeFileNamePart(path);\n        return new URI(encodedPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/FileUploadServlet.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.uberfire.server.UploadUriProvider.getTargetLocation;\nimport static org.uberfire.server.UploadUriProvider.isUpdate;\n\npublic class FileUploadServlet\n        extends BaseUploadServlet {\n\n    private static final String RESPONSE_OK = \"OK\";\n    private static final String RESPONSE_FAIL = \"FAIL\";\n    private static final String RESPONSE_CONFLICT = \"CONFLICT\";\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Override\n    protected void doPost(HttpServletRequest request,\n                          HttpServletResponse response) throws ServletException, IOException {\n\n        try {\n\n            URI targetLocation = getTargetLocation(request);\n            final boolean isUpdate = isUpdate(request);\n            finalizeResponse(response,\n                             getFileItem(request),\n                             targetLocation,\n                             isUpdate);\n        } catch (FileUploadException e) {\n            logError(e);\n            writeResponse(response,\n                          RESPONSE_FAIL);\n        } catch (URISyntaxException e) {\n            logError(e);\n            writeResponse(response,\n                          RESPONSE_FAIL);\n        }\n    }\n\n    private void finalizeResponse(HttpServletResponse response,\n                                  FileItem fileItem,\n                                  URI uri,\n                                  boolean isUpdate) throws IOException {\n        if (!validateAccess(uri,\n                            response)) {\n            return;\n        }\n\n        final Path path = ioService.get(uri);\n\n        try {\n            ioService.startBatch(path.getFileSystem());\n\n            if (ioService.exists(path)\n                    && !isUpdate) {\n                writeResponse(response,\n                              RESPONSE_CONFLICT);\n                response.sendError(HttpServletResponse.SC_CONFLICT);\n                return;\n            }\n\n            writeFile(ioService,\n                      path,\n                      fileItem);\n        } finally {\n            ioService.endBatch();\n        }\n\n        writeResponse(response,\n                      RESPONSE_OK);\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/MimeType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\n/*\n * @author Wytze van der Ploeg\n */\npublic enum MimeType {\n\n    /* Preferred Common Types */\n    APPLICATION_PDF_PDF(\"application/pdf\",\n                        \".pdf\"),\n    APPLICATION_ZIP_ZIP(\"application/zip\",\n                        \".zip\"),\n    AUDIO_MPEG3_MP3(\"audio/mpeg3\",\n                    \".mp3\"),\n    IMAGE_GIF_GIF(\"image/gif\",\n                  \".gif\"),\n    TEXT_HTML_HTML(\"text/html\",\n                   \".html\"),\n    IMAGE_JPEG_JPG(\"image/jpeg\",\n                   \".jpg\"),\n    IMAGE_PNG_PNG(\"image/png\",\n                  \".png\"),\n    TEXT_CSS_CSS(\"text/css\",\n                 \".css\"),\n    TEXT_CSV_CSV(\"text/csv\",\n                 \".csv\"),\n    TEXT_JAVASCRIPT_JS(\"text/javascript\",\n                       \".js\"),\n    TEXT_PLAIN_TXT(\"text/plain\",\n                   \".txt\"),\n    VIDEO_AVI_AVI(\"video/avi\",\n                  \".avi\"),\n    VIDEO_QUICKTIME_MOV(\"video/quicktime\",\n                        \".mov\"),\n    VIDEO_MPEG_MP4(\"video/mp4\",\n                   \".mp4\"),\n    VIDEO_MATROSKA_MKV(\"video/x-matroska\",\n                       \".mkv\"),\n\n    /* Other */\n    APPLICATION_XBYTECODEPYTHON_PYC(\"application/x-bytecode.python\",\n                                    \".pyc\"),\n    APPLICATION_ACAD_DWG(\"application/acad\",\n                         \".dwg\"),\n    APPLICATION_ARJ_ARJ(\"application/arj\",\n                        \".arj\"),\n    APPLICATION_BASE64_MM(\"application/base64\",\n                          \".mm\"),\n    APPLICATION_BASE64_MME(\"application/base64\",\n                           \".mme\"),\n    APPLICATION_BINHEX4_HQX(\"application/binhex4\",\n                            \".hqx\"),\n    APPLICATION_BINHEX_HQX(\"application/binhex\",\n                           \".hqx\"),\n    APPLICATION_BOOK_BOO(\"application/book\",\n                         \".boo\"),\n    APPLICATION_BOOK_BOOK(\"application/book\",\n                          \".book\"),\n    APPLICATION_CDF_CDF(\"application/cdf\",\n                        \".cdf\"),\n    APPLICATION_CLARISCAD_CCAD(\"application/clariscad\",\n                               \".ccad\"),\n    APPLICATION_COMMONGROUND_DP(\"application/commonground\",\n                                \".dp\"),\n    APPLICATION_DRAFTING_DRW(\"application/drafting\",\n                             \".drw\"),\n    APPLICATION_DSPTYPE_TSP(\"application/dsptype\",\n                            \".tsp\"),\n    APPLICATION_DXF_DXF(\"application/dxf\",\n                        \".dxf\"),\n    APPLICATION_ECMASCRIPT_JS(\"application/ecmascript\",\n                              \".js\"),\n    APPLICATION_ENVOY_EVY(\"application/envoy\",\n                          \".evy\"),\n    APPLICATION_EXCEL_XL(\"application/excel\",\n                         \".xl\"),\n    APPLICATION_EXCEL_XLA(\"application/excel\",\n                          \".xla\"),\n    APPLICATION_EXCEL_XLB(\"application/excel\",\n                          \".xlb\"),\n    APPLICATION_EXCEL_XLC(\"application/excel\",\n                          \".xlc\"),\n    APPLICATION_EXCEL_XLD(\"application/excel\",\n                          \".xld\"),\n    APPLICATION_EXCEL_XLK(\"application/excel\",\n                          \".xlk\"),\n    APPLICATION_EXCEL_XLL(\"application/excel\",\n                          \".xll\"),\n    APPLICATION_EXCEL_XLM(\"application/excel\",\n                          \".xlm\"),\n    APPLICATION_EXCEL_XLS(\"application/excel\",\n                          \".xls\"),\n    APPLICATION_EXCEL_XLT(\"application/excel\",\n                          \".xlt\"),\n    APPLICATION_EXCEL_XLV(\"application/excel\",\n                          \".xlv\"),\n    APPLICATION_EXCEL_XLW(\"application/excel\",\n                          \".xlw\"),\n    APPLICATION_FRACTALS_FIF(\"application/fractals\",\n                             \".fif\"),\n    APPLICATION_FREELOADER_FRL(\"application/freeloader\",\n                               \".frl\"),\n    APPLICATION_FUTURESPLASH_SPL(\"application/futuresplash\",\n                                 \".spl\"),\n    APPLICATION_GNUTAR_TGZ(\"application/gnutar\",\n                           \".tgz\"),\n    APPLICATION_GROUPWISE_VEW(\"application/groupwise\",\n                              \".vew\"),\n    APPLICATION_HLP_HLP(\"application/hlp\",\n                        \".hlp\"),\n    APPLICATION_HTA_HTA(\"application/hta\",\n                        \".hta\"),\n    APPLICATION_IDEAS_UNV(\"application/i-deas\",\n                          \".unv\"),\n    APPLICATION_IGES_IGES(\"application/iges\",\n                          \".iges\"),\n    APPLICATION_IGES_IGS(\"application/iges\",\n                         \".igs\"),\n    APPLICATION_INF_INF(\"application/inf\",\n                        \".inf\"),\n    APPLICATION_JAVABYTECODE_CLASS(\"application/java-byte-code\",\n                                   \".class\"),\n    APPLICATION_JAVA_CLASS(\"application/java\",\n                           \".class\"),\n    APPLICATION_JAVASCRIPT_JS(\"application/javascript\",\n                              \".js\"),\n    APPLICATION_LHA_LHA(\"application/lha\",\n                        \".lha\"),\n    APPLICATION_LZX_LZX(\"application/lzx\",\n                        \".lzx\"),\n    APPLICATION_MACBINARY_BIN(\"application/mac-binary\",\n                              \".bin\"),\n    APPLICATION_MACBINARY_BINARY(\"application/macbinary\",\n                                 \".bin\"),\n    APPLICATION_MACBINHEX40_HQX(\"application/mac-binhex40\",\n                                \".hqx\"),\n    APPLICATION_MACBINHEX_HQX(\"application/mac-binhex\",\n                              \".hqx\"),\n    APPLICATION_MACCOMPACTPRO_CPT(\"application/mac-compactpro\",\n                                  \".cpt\"),\n    APPLICATION_MARC_MRC(\"application/marc\",\n                         \".mrc\"),\n    APPLICATION_MBEDLET_MBD(\"application/mbedlet\",\n                            \".mbd\"),\n    APPLICATION_MCAD_MCD(\"application/mcad\",\n                         \".mcd\"),\n    APPLICATION_MIME_APS(\"application/mime\",\n                         \".aps\"),\n    APPLICATION_MSPOWERPOINT_POT(\"application/mspowerpoint\",\n                                 \".pot\"),\n    APPLICATION_MSPOWERPOINT_PPS(\"application/mspowerpoint\",\n                                 \".pps\"),\n    APPLICATION_MSPOWERPOINT_PPT(\"application/mspowerpoint\",\n                                 \".ppt\"),\n    APPLICATION_MSPOWERPOINT_PPZ(\"application/mspowerpoint\",\n                                 \".ppz\"),\n    APPLICATION_MSWORD_DOC(\"application/msword\",\n                           \".doc\"),\n    APPLICATION_MSWORD_DOT(\"application/msword\",\n                           \".dot\"),\n    APPLICATION_MSWORD_W6W(\"application/msword\",\n                           \".w6w\"),\n    APPLICATION_MSWORD_WIZ(\"application/msword\",\n                           \".wiz\"),\n    APPLICATION_MSWORD_WORD(\"application/msword\",\n                            \".word\"),\n    APPLICATION_MSWRITE_WRI(\"application/mswrite\",\n                            \".wri\"),\n    APPLICATION_NETMC_MCP(\"application/netmc\",\n                          \".mcp\"),\n    APPLICATION_OCTETSTREAM_A(\"application/octet-stream\",\n                              \".a\"),\n    APPLICATION_OCTETSTREAM_ARC(\"application/octet-stream\",\n                                \".arc\"),\n    APPLICATION_OCTETSTREAM_ARJ(\"application/octet-stream\",\n                                \".arj\"),\n    APPLICATION_OCTETSTREAM_BIN(\"application/octet-stream\",\n                                \".bin\"),\n    APPLICATION_OCTETSTREAM_COM(\"application/octet-stream\",\n                                \".com\"),\n    APPLICATION_OCTETSTREAM_DUMP(\"application/octet-stream\",\n                                 \".dump\"),\n    APPLICATION_OCTETSTREAM_EXE(\"application/octet-stream\",\n                                \".exe\"),\n    APPLICATION_OCTETSTREAM_LHA(\"application/octet-stream\",\n                                \".lha\"),\n    APPLICATION_OCTETSTREAM_LHX(\"application/octet-stream\",\n                                \".lhx\"),\n    APPLICATION_OCTETSTREAM_LZH(\"application/octet-stream\",\n                                \".lzh\"),\n    APPLICATION_OCTETSTREAM_LZX(\"application/octet-stream\",\n                                \".lzx\"),\n    APPLICATION_OCTETSTREAM_O(\"application/octet-stream\",\n                              \".o\"),\n    APPLICATION_OCTETSTREAM_PSD(\"application/octet-stream\",\n                                \".psd\"),\n    APPLICATION_OCTETSTREAM_SAVEME(\"application/octet-stream\",\n                                   \".saveme\"),\n    APPLICATION_OCTETSTREAM_UU(\"application/octet-stream\",\n                               \".uu\"),\n    APPLICATION_OCTETSTREAM_ZOO(\"application/octet-stream\",\n                                \".zoo\"),\n    APPLICATION_ODA_ODA(\"application/oda\",\n                        \".oda\"),\n    APPLICATION_PKCS10_P10(\"application/pkcs10\",\n                           \".p10\"),\n    APPLICATION_PKCS12_P12(\"application/pkcs-12\",\n                           \".p12\"),\n    APPLICATION_PKCS7MIME_P7C(\"application/pkcs7-mime\",\n                              \".p7c\"),\n    APPLICATION_PKCS7MIME_P7M(\"application/pkcs7-mime\",\n                              \".p7m\"),\n    APPLICATION_PKCS7SIGNATURE_P7S(\"application/pkcs7-signature\",\n                                   \".p7s\"),\n    APPLICATION_PKCSCRL_CRL(\"application/pkcs-crl\",\n                            \".crl\"),\n    APPLICATION_PKIXCERT_CER(\"application/pkix-cert\",\n                             \".cer\"),\n    APPLICATION_PKIXCERT_CRT(\"application/pkix-cert\",\n                             \".crt\"),\n    APPLICATION_PKIXCRL_CRL(\"application/pkix-crl\",\n                            \".crl\"),\n    APPLICATION_PLAIN_TEXT(\"application/plain\",\n                           \".text\"),\n    APPLICATION_POSTSCRIPT_AI(\"application/postscript\",\n                              \".ai\"),\n    APPLICATION_POSTSCRIPT_EPS(\"application/postscript\",\n                               \".eps\"),\n    APPLICATION_POSTSCRIPT_PS(\"application/postscript\",\n                              \".ps\"),\n    APPLICATION_POWERPOINT_PPT(\"application/powerpoint\",\n                               \".ppt\"),\n    APPLICATION_PRO_ENG_PART(\"application/pro_eng\",\n                             \".part\"),\n    APPLICATION_PRO_ENG_PRT(\"application/pro_eng\",\n                            \".prt\"),\n    APPLICATION_RINGINGTONES_RNG(\"application/ringing-tones\",\n                                 \".rng\"),\n    APPLICATION_RTF_RTF(\"application/rtf\",\n                        \".rtf\"),\n    APPLICATION_RTF_RTX(\"application/rtf\",\n                        \".rtx\"),\n    APPLICATION_SDP_SDP(\"application/sdp\",\n                        \".sdp\"),\n    APPLICATION_SEA_SEA(\"application/sea\",\n                        \".sea\"),\n    APPLICATION_SET_SET(\"application/set\",\n                        \".set\"),\n    APPLICATION_SLA_STL(\"application/sla\",\n                        \".stl\"),\n    APPLICATION_SMIL_SMI(\"application/smil\",\n                         \".smi\"),\n    APPLICATION_SMIL_SMIL(\"application/smil\",\n                          \".smil\"),\n    APPLICATION_SOLIDS_SOL(\"application/solids\",\n                           \".sol\"),\n    APPLICATION_SOUNDER_SDR(\"application/sounder\",\n                            \".sdr\"),\n    APPLICATION_STEP_STEP(\"application/step\",\n                          \".step\"),\n    APPLICATION_STEP_STP(\"application/step\",\n                         \".stp\"),\n    APPLICATION_STREAMINGMEDIA_SSM(\"application/streamingmedia\",\n                                   \".ssm\"),\n    APPLICATION_TOOLBOOK_TBK(\"application/toolbook\",\n                             \".tbk\"),\n    APPLICATION_VDA_VDA(\"application/vda\",\n                        \".vda\"),\n    APPLICATION_VNDFDF_FDF(\"application/vnd.fdf\",\n                           \".fdf\"),\n    APPLICATION_VNDHPHPGL_HGL(\"application/vnd.hp-hpgl\",\n                              \".hgl\"),\n    APPLICATION_VNDHPHPGL_HPG(\"application/vnd.hp-hpgl\",\n                              \".hpg\"),\n    APPLICATION_VNDHPHPGL_HPGL(\"application/vnd.hp-hpgl\",\n                               \".hpgl\"),\n    APPLICATION_VNDHPPCL_PCL(\"application/vnd.hp-pcl\",\n                             \".pcl\"),\n    APPLICATION_VNDMSEXCEL_XLB(\"application/vnd.ms-excel\",\n                               \".xlb\"),\n    APPLICATION_VNDMSEXCEL_XLC(\"application/vnd.ms-excel\",\n                               \".xlc\"),\n    APPLICATION_VNDMSEXCEL_XLL(\"application/vnd.ms-excel\",\n                               \".xll\"),\n    APPLICATION_VNDMSEXCEL_XLM(\"application/vnd.ms-excel\",\n                               \".xlm\"),\n    APPLICATION_VNDMSEXCEL_XLS(\"application/vnd.ms-excel\",\n                               \".xls\"),\n    APPLICATION_VNDMSEXCEL_XLW(\"application/vnd.ms-excel\",\n                               \".xlw\"),\n    APPLICATION_VNDMSPKICERTSTORE_SST(\"application/vnd.ms-pki.certstore\",\n                                      \".sst\"),\n    APPLICATION_VNDMSPKIPKO_PKO(\"application/vnd.ms-pki.pko\",\n                                \".pko\"),\n    APPLICATION_VNDMSPKISECCAT_CAT(\"application/vnd.ms-pki.seccat\",\n                                   \".cat\"),\n    APPLICATION_VNDMSPKISTL_STL(\"application/vnd.ms-pki.stl\",\n                                \".stl\"),\n    APPLICATION_VNDMSPOWERPOINT_POT(\"application/vnd.ms-powerpoint\",\n                                    \".pot\"),\n    APPLICATION_VNDMSPOWERPOINT_PPA(\"application/vnd.ms-powerpoint\",\n                                    \".ppa\"),\n    APPLICATION_VNDMSPOWERPOINT_PPS(\"application/vnd.ms-powerpoint\",\n                                    \".pps\"),\n    APPLICATION_VNDMSPOWERPOINT_PPT(\"application/vnd.ms-powerpoint\",\n                                    \".ppt\"),\n    APPLICATION_VNDMSPOWERPOINT_PWZ(\"application/vnd.ms-powerpoint\",\n                                    \".pwz\"),\n    APPLICATION_VNDMSPROJECT_MPP(\"application/vnd.ms-project\",\n                                 \".mpp\"),\n    APPLICATION_VNDNOKIACONFIGURATIONMESSAGE_NCM(\"application/vnd.nokia.configuration-message\",\n                                                 \".ncm\"),\n    APPLICATION_VNDNOKIARINGINGTONE_RNG(\"application/vnd.nokia.ringing-tone\",\n                                        \".rng\"),\n    APPLICATION_VNDRNREALMEDIA_RM(\"application/vnd.rn-realmedia\",\n                                  \".rm\"),\n    APPLICATION_VNDRNREALPLAYER_RNX(\"application/vnd.rn-realplayer\",\n                                    \".rnx\"),\n    APPLICATION_VNDWAPWMLC_WMLC(\"application/vnd.wap.wmlc\",\n                                \".wmlc\"),\n    APPLICATION_VNDWAPWMLSCRIPTC_WMLSC(\"application/vnd.wap.wmlscriptc\",\n                                       \".wmlsc\"),\n    APPLICATION_VNDXARA_WEB(\"application/vnd.xara\",\n                            \".web\"),\n    APPLICATION_VOCALTECMEDIADESC_VMD(\"application/vocaltec-media-desc\",\n                                      \".vmd\"),\n    APPLICATION_VOCALTECMEDIAFILE_VMF(\"application/vocaltec-media-file\",\n                                      \".vmf\"),\n    APPLICATION_WORDPERFECT60WP5(\"application/wordperfect6.0\",\n                                 \".wp5\"),\n    APPLICATION_WORDPERFECT60_W60(\"application/wordperfect6.0\",\n                                  \".w60\"),\n    APPLICATION_WORDPERFECT61_W61(\"application/wordperfect6.1\",\n                                  \".w61\"),\n    APPLICATION_WORDPERFECT_WP(\"application/wordperfect\",\n                               \".wp\"),\n    APPLICATION_WORDPERFECT_WP5(\"application/wordperfect\",\n                                \".wp5\"),\n    APPLICATION_WORDPERFECT_WP6(\"application/wordperfect\",\n                                \".wp6\"),\n    APPLICATION_WORDPERFECT_WPD(\"application/wordperfect\",\n                                \".wpd\"),\n    APPLICATION_X123_WK1(\"application/x-123\",\n                         \".wk1\"),\n    APPLICATION_XAIM_AIM(\"application/x-aim\",\n                         \".aim\"),\n    APPLICATION_XAUTHORWAREBIN_AAB(\"application/x-authorware-bin\",\n                                   \".aab\"),\n    APPLICATION_XAUTHORWAREMAP_AAM(\"application/x-authorware-map\",\n                                   \".aam\"),\n    APPLICATION_XAUTHORWARESEG_AAS(\"application/x-authorware-seg\",\n                                   \".aas\"),\n    APPLICATION_XBCPIO_BCPIO(\"application/x-bcpio\",\n                             \".bcpio\"),\n    APPLICATION_XBINARY_BIN(\"application/x-binary\",\n                            \".bin\"),\n    APPLICATION_XBINHEX40_HQX(\"application/x-binhex40\",\n                              \".hqx\"),\n    APPLICATION_XBSH_BSH(\"application/x-bsh\",\n                         \".bsh\"),\n    APPLICATION_XBSH_SH(\"application/x-bsh\",\n                        \".sh\"),\n    APPLICATION_XBSH_SHAR(\"application/x-bsh\",\n                          \".shar\"),\n    APPLICATION_XBYTECODEELISPCOMPILED_ELC(\"application/x-bytecode.elisp (compiled elisp)\",\n                                           \".elc\"),\n    APPLICATION_XBZIP2_BOZ(\"application/x-bzip2\",\n                           \".boz\"),\n    APPLICATION_XBZIP2_BZ2(\"application/x-bzip2\",\n                           \".bz2\"),\n    APPLICATION_XBZIP_BZ(\"application/x-bzip\",\n                         \".bz\"),\n    APPLICATION_XCDF_CDF(\"application/x-cdf\",\n                         \".cdf\"),\n    APPLICATION_XCDLINK_VCD(\"application/x-cdlink\",\n                            \".vcd\"),\n    APPLICATION_XCHAT_CHA(\"application/x-chat\",\n                          \".cha\"),\n    APPLICATION_XCHAT_CHAT(\"application/x-chat\",\n                           \".chat\"),\n    APPLICATION_XCMURASTER_RAS(\"application/x-cmu-raster\",\n                               \".ras\"),\n    APPLICATION_XCOCOA_CCO(\"application/x-cocoa\",\n                           \".cco\"),\n    APPLICATION_XCOMPACTPRO_CPT(\"application/x-compactpro\",\n                                \".cpt\"),\n    APPLICATION_XCOMPRESSED_GZ(\"application/x-compressed\",\n                               \".gz\"),\n    APPLICATION_XCOMPRESSED_TGZ(\"application/x-compressed\",\n                                \".tgz\"),\n    APPLICATION_XCOMPRESSED_Z(\"application/x-compressed\",\n                              \".z\"),\n    APPLICATION_XCOMPRESSED_ZIP(\"application/x-compressed\",\n                                \".zip\"),\n    APPLICATION_XCOMPRESS_Z(\"application/x-compress\",\n                            \".z\"),\n    APPLICATION_XCONFERENCE_NSC(\"application/x-conference\",\n                                \".nsc\"),\n    APPLICATION_XCPIO_CPIO(\"application/x-cpio\",\n                           \".cpio\"),\n    APPLICATION_XCPT_CPT(\"application/x-cpt\",\n                         \".cpt\"),\n    APPLICATION_XCSH_CSH(\"application/x-csh\",\n                         \".csh\"),\n    APPLICATION_XDEEPV_DEEPV(\"application/x-deepv\",\n                             \".deepv\"),\n    APPLICATION_XDIRECTOR_DCR(\"application/x-director\",\n                              \".dcr\"),\n    APPLICATION_XDIRECTOR_DIR(\"application/x-director\",\n                              \".dir\"),\n    APPLICATION_XDIRECTOR_DXR(\"application/x-director\",\n                              \".dxr\"),\n    APPLICATION_XDVI_DVI(\"application/x-dvi\",\n                         \".dvi\"),\n    APPLICATION_XELC_ELC(\"application/x-elc\",\n                         \".elc\"),\n    APPLICATION_XENVOY_ENV(\"application/x-envoy\",\n                           \".env\"),\n    APPLICATION_XENVOY_EVY(\"application/x-envoy\",\n                           \".evy\"),\n    APPLICATION_XESREHBER_ES(\"application/x-esrehber\",\n                             \".es\"),\n    APPLICATION_XEXCEL_XLA(\"application/x-excel\",\n                           \".xla\"),\n    APPLICATION_XEXCEL_XLB(\"application/x-excel\",\n                           \".xlb\"),\n    APPLICATION_XEXCEL_XLC(\"application/x-excel\",\n                           \".xlc\"),\n    APPLICATION_XEXCEL_XLD(\"application/x-excel\",\n                           \".xld\"),\n    APPLICATION_XEXCEL_XLK(\"application/x-excel\",\n                           \".xlk\"),\n    APPLICATION_XEXCEL_XLL(\"application/x-excel\",\n                           \".xll\"),\n    APPLICATION_XEXCEL_XLM(\"application/x-excel\",\n                           \".xlm\"),\n    APPLICATION_XEXCEL_XLS(\"application/x-excel\",\n                           \".xls\"),\n    APPLICATION_XEXCEL_XLT(\"application/x-excel\",\n                           \".xlt\"),\n    APPLICATION_XEXCEL_XLV(\"application/x-excel\",\n                           \".xlv\"),\n    APPLICATION_XEXCEL_XLW(\"application/x-excel\",\n                           \".xlw\"),\n    APPLICATION_XFRAME_MIF(\"application/x-frame\",\n                           \".mif\"),\n    APPLICATION_XFREELANCE_PRE(\"application/x-freelance\",\n                               \".pre\"),\n    APPLICATION_XGSP_GSP(\"application/x-gsp\",\n                         \".gsp\"),\n    APPLICATION_XGSS_GSS(\"application/x-gss\",\n                         \".gss\"),\n    APPLICATION_XGTAR_GTAR(\"application/x-gtar\",\n                           \".gtar\"),\n    APPLICATION_XGZIP_GZ(\"application/x-gzip\",\n                         \".gz\"),\n    APPLICATION_XGZIP_GZIP(\"application/x-gzip\",\n                           \".gzip\"),\n    APPLICATION_XHDF_HDF(\"application/x-hdf\",\n                         \".hdf\"),\n    APPLICATION_XHELPFILE_HELP(\"application/x-helpfile\",\n                               \".help\"),\n    APPLICATION_XHELPFILE_HLP(\"application/x-helpfile\",\n                              \".hlp\"),\n    APPLICATION_XHTTPDIMAP_IMAP(\"application/x-httpd-imap\",\n                                \".imap\"),\n    APPLICATION_XIMA_IMA(\"application/x-ima\",\n                         \".ima\"),\n    APPLICATION_XINTERNETTSIGNUP_INS(\"application/x-internett-signup\",\n                                     \".ins\"),\n    APPLICATION_XINVENTOR_IV(\"application/x-inventor\",\n                             \".iv\"),\n    APPLICATION_XIP2_IP(\"application/x-ip2\",\n                        \".ip\"),\n    APPLICATION_XJAVACLASS_CLASS(\"application/x-java-class\",\n                                 \".class\"),\n    APPLICATION_XJAVACOMMERCE_JCM(\"application/x-java-commerce\",\n                                  \".jcm\"),\n    APPLICATION_XJAVASCRIPT_JS(\"application/x-javascript\",\n                               \".js\"),\n    APPLICATION_XKOAN_SKD(\"application/x-koan\",\n                          \".skd\"),\n    APPLICATION_XKOAN_SKM(\"application/x-koan\",\n                          \".skm\"),\n    APPLICATION_XKOAN_SKP(\"application/x-koan\",\n                          \".skp\"),\n    APPLICATION_XKOAN_SKT(\"application/x-koan\",\n                          \".skt\"),\n    APPLICATION_XKSH_KSH(\"application/x-ksh\",\n                         \".ksh\"),\n    APPLICATION_XLATEX_LATEX(\"application/x-latex\",\n                             \".latex\"),\n    APPLICATION_XLATEX_LTX(\"application/x-latex\",\n                           \".ltx\"),\n    APPLICATION_XLHA_LHA(\"application/x-lha\",\n                         \".lha\"),\n    APPLICATION_XLISP_LSP(\"application/x-lisp\",\n                          \".lsp\"),\n    APPLICATION_XLIVESCREEN_IVY(\"application/x-livescreen\",\n                                \".ivy\"),\n    APPLICATION_XLOTUSSCREENCAM_SCM(\"application/x-lotusscreencam\",\n                                    \".scm\"),\n    APPLICATION_XLOTUS_WQ1(\"application/x-lotus\",\n                           \".wq1\"),\n    APPLICATION_XLZH_LZH(\"application/x-lzh\",\n                         \".lzh\"),\n    APPLICATION_XLZX_LZX(\"application/x-lzx\",\n                         \".lzx\"),\n    APPLICATION_XMACBINARY_BIN(\"application/x-macbinary\",\n                               \".bin\"),\n    APPLICATION_XMACBINHEX40_HQX(\"application/x-mac-binhex40\",\n                                 \".hqx\"),\n    APPLICATION_XMAGICCAPPACKAGE10_MC$(\"application/x-magic-cap-package-1.0\",\n                                       \".mc$\"),\n    APPLICATION_XMATHCAD_MCD(\"application/x-mathcad\",\n                             \".mcd\"),\n    APPLICATION_XMEME_MM(\"application/x-meme\",\n                         \".mm\"),\n    APPLICATION_XMIDI_MID(\"application/x-midi\",\n                          \".mid\"),\n    APPLICATION_XMIDI_MIDI(\"application/x-midi\",\n                           \".midi\"),\n    APPLICATION_XMIF_MIF(\"application/x-mif\",\n                         \".mif\"),\n    APPLICATION_XMIXTRANSFER_NIX(\"application/x-mix-transfer\",\n                                 \".nix\"),\n    APPLICATION_XML_XML(\"application/xml\",\n                        \".xml\"),\n    APPLICATION_XMPLAYER2_ASX(\"application/x-mplayer2\",\n                              \".asx\"),\n    APPLICATION_XMSEXCEL_XLA(\"application/x-msexcel\",\n                             \".xla\"),\n    APPLICATION_XMSEXCEL_XLS(\"application/x-msexcel\",\n                             \".xls\"),\n    APPLICATION_XMSEXCEL_XLW(\"application/x-msexcel\",\n                             \".xlw\"),\n    APPLICATION_XMSPOWERPOINT_PPT(\"application/x-mspowerpoint\",\n                                  \".ppt\"),\n    APPLICATION_XNAVIANIMATION_ANI(\"application/x-navi-animation\",\n                                   \".ani\"),\n    APPLICATION_XNAVIDOC_NVD(\"application/x-navidoc\",\n                             \".nvd\"),\n    APPLICATION_XNAVIMAP_MAP(\"application/x-navimap\",\n                             \".map\"),\n    APPLICATION_XNAVISTYLE_STL(\"application/x-navistyle\",\n                               \".stl\"),\n    APPLICATION_XNETCDF_CDF(\"application/x-netcdf\",\n                            \".cdf\"),\n    APPLICATION_XNETCDF_NC(\"application/x-netcdf\",\n                           \".nc\"),\n    APPLICATION_XNEWTONCOMPATIBLEPKG_PKG(\"application/x-newton-compatible-pkg\",\n                                         \".pkg\"),\n    APPLICATION_XNOKIA9000COMMUNICATORADDONSOFTWARE_AOS(\"application/x-nokia-9000-communicator-add-on-software\",\n                                                        \".aos\"),\n    APPLICATION_XOMCDATAMAKER_OMCD(\"application/x-omcdatamaker\",\n                                   \".omcd\"),\n    APPLICATION_XOMCREGERATOR_OMCR(\"application/x-omcregerator\",\n                                   \".omcr\"),\n    APPLICATION_XOMC_OMC(\"application/x-omc\",\n                         \".omc\"),\n    APPLICATION_XPAGEMAKER_PM4(\"application/x-pagemaker\",\n                               \".pm4\"),\n    APPLICATION_XPAGEMAKER_PM5(\"application/x-pagemaker\",\n                               \".pm5\"),\n    APPLICATION_XPCL_PCL(\"application/x-pcl\",\n                         \".pcl\"),\n    APPLICATION_XPIXCLSCRIPT_PLX(\"application/x-pixclscript\",\n                                 \".plx\"),\n    APPLICATION_XPKCS10_P10(\"application/x-pkcs10\",\n                            \".p10\"),\n    APPLICATION_XPKCS12_P12(\"application/x-pkcs12\",\n                            \".p12\"),\n    APPLICATION_XPKCS7CERTIFICATES_SPC(\"application/x-pkcs7-certificates\",\n                                       \".spc\"),\n    APPLICATION_XPKCS7CERTREQRESP_P7R(\"application/x-pkcs7-certreqresp\",\n                                      \".p7r\"),\n    APPLICATION_XPKCS7MIME_P7C(\"application/x-pkcs7-mime\",\n                               \".p7c\"),\n    APPLICATION_XPKCS7MIME_P7M(\"application/x-pkcs7-mime\",\n                               \".p7m\"),\n    APPLICATION_XPKCS7SIGNATURE_P7A(\"application/x-pkcs7-signature\",\n                                    \".p7a\"),\n    APPLICATION_XPOINTPLUS_CSS(\"application/x-pointplus\",\n                               \".css\"),\n    APPLICATION_XPORTABLEANYMAP_PNM(\"application/x-portable-anymap\",\n                                    \".pnm\"),\n    APPLICATION_XPROJECT_MPC(\"application/x-project\",\n                             \".mpc\"),\n    APPLICATION_XPROJECT_MPT(\"application/x-project\",\n                             \".mpt\"),\n    APPLICATION_XPROJECT_MPV(\"application/x-project\",\n                             \".mpv\"),\n    APPLICATION_XPROJECT_MPX(\"application/x-project\",\n                             \".mpx\"),\n    APPLICATION_XQPRO_WB1(\"application/x-qpro\",\n                          \".wb1\"),\n    APPLICATION_XRTF_RTF(\"application/x-rtf\",\n                         \".rtf\"),\n    APPLICATION_XSDP_SDP(\"application/x-sdp\",\n                         \".sdp\"),\n    APPLICATION_XSEA_SEA(\"application/x-sea\",\n                         \".sea\"),\n    APPLICATION_XSEELOGO_SL(\"application/x-seelogo\",\n                            \".sl\"),\n    APPLICATION_XSHAR_SH(\"application/x-shar\",\n                         \".sh\"),\n    APPLICATION_XSHAR_SHAR(\"application/x-shar\",\n                           \".shar\"),\n    APPLICATION_XSHOCKWAVEFLASH_SWF(\"application/x-shockwave-flash\",\n                                    \".swf\"),\n    APPLICATION_XSH_SH(\"application/x-sh\",\n                       \".sh\"),\n    APPLICATION_XSIT_SIT(\"application/x-sit\",\n                         \".sit\"),\n    APPLICATION_XSPRITE_SPR(\"application/x-sprite\",\n                            \".spr\"),\n    APPLICATION_XSPRITE_SPRITE(\"application/x-sprite\",\n                               \".sprite\"),\n    APPLICATION_XSTUFFIT_SIT(\"application/x-stuffit\",\n                             \".sit\"),\n    APPLICATION_XSV4CPIO_SV4CPIO(\"application/x-sv4cpio\",\n                                 \".sv4cpio\"),\n    APPLICATION_XSV4CRC_SV4CRC(\"application/x-sv4crc\",\n                               \".sv4crc\"),\n    APPLICATION_XTAR_TAR(\"application/x-tar\",\n                         \".tar\"),\n    APPLICATION_XTBOOK_SBK(\"application/x-tbook\",\n                           \".sbk\"),\n    APPLICATION_XTBOOK_TBK(\"application/x-tbook\",\n                           \".tbk\"),\n    APPLICATION_XTCL_TCL(\"application/x-tcl\",\n                         \".tcl\"),\n    APPLICATION_XTEXINFO_TEXI(\"application/x-texinfo\",\n                              \".texi\"),\n    APPLICATION_XTEXINFO_TEXINFO(\"application/x-texinfo\",\n                                 \".texinfo\"),\n    APPLICATION_XTEX_TEX(\"application/x-tex\",\n                         \".tex\"),\n    APPLICATION_XTROFFMAN_MAN(\"application/x-troff-man\",\n                              \".man\"),\n    APPLICATION_XTROFFME_ME(\"application/x-troff-me\",\n                            \".me\"),\n    APPLICATION_XTROFFMSVIDEO_AVI(\"application/x-troff-msvideo\",\n                                  \".avi\"),\n    APPLICATION_XTROFFMS_MS(\"application/x-troff-ms\",\n                            \".ms\"),\n    APPLICATION_XTROFF_ROFF(\"application/x-troff\",\n                            \".roff\"),\n    APPLICATION_XTROFF_T(\"application/x-troff\",\n                         \".t\"),\n    APPLICATION_XTROFF_TR(\"application/x-troff\",\n                          \".tr\"),\n    APPLICATION_XUSTAR_USTAR(\"application/x-ustar\",\n                             \".ustar\"),\n    APPLICATION_XVISIO_VSD(\"application/x-visio\",\n                           \".vsd\"),\n    APPLICATION_XVISIO_VST(\"application/x-visio\",\n                           \".vst\"),\n    APPLICATION_XVISIO_VSW(\"application/x-visio\",\n                           \".vsw\"),\n    APPLICATION_XVNDAUDIOEXPLOSIONMZZ_MZZ(\"application/x-vnd.audioexplosion.mzz\",\n                                          \".mzz\"),\n    APPLICATION_XVNDLSXPIX_XPIX(\"application/x-vnd.ls-xpix\",\n                                \".xpix\"),\n    APPLICATION_XVRML_VRML(\"application/x-vrml\",\n                           \".vrml\"),\n    APPLICATION_XWAISSOURCE_SRC(\"application/x-wais-source\",\n                                \".src\"),\n    APPLICATION_XWAISSOURCE_WSRC(\"application/x-wais-source\",\n                                 \".wsrc\"),\n    APPLICATION_XWINHELP_HLP(\"application/x-winhelp\",\n                             \".hlp\"),\n    APPLICATION_XWINTALK_WTK(\"application/x-wintalk\",\n                             \".wtk\"),\n    APPLICATION_XWORLD_SVR(\"application/x-world\",\n                           \".svr\"),\n    APPLICATION_XWORLD_WRL(\"application/x-world\",\n                           \".wrl\"),\n    APPLICATION_XWPWIN_WPD(\"application/x-wpwin\",\n                           \".wpd\"),\n    APPLICATION_XWRI_WRI(\"application/x-wri\",\n                         \".wri\"),\n    APPLICATION_XX509CACERT_CER(\"application/x-x509-ca-cert\",\n                                \".cer\"),\n    APPLICATION_XX509CACERT_CRT(\"application/x-x509-ca-cert\",\n                                \".crt\"),\n    APPLICATION_XX509CACERT_DER(\"application/x-x509-ca-cert\",\n                                \".der\"),\n    APPLICATION_XX509USERCERT_CRT(\"application/x-x509-user-cert\",\n                                  \".crt\"),\n    APPLICATION_XZIPCOMPRESSED_ZIP(\"application/x-zip-compressed\",\n                                   \".zip\"),\n    AUDIO_AIFF_AIF(\"audio/aiff\",\n                   \".aif\"),\n    AUDIO_AIFF_AIFC(\"audio/aiff\",\n                    \".aifc\"),\n    AUDIO_AIFF_AIFF(\"audio/aiff\",\n                    \".aiff\"),\n    AUDIO_BASIC_AU(\"audio/basic\",\n                   \".au\"),\n    AUDIO_BASIC_SND(\"audio/basic\",\n                    \".snd\"),\n    AUDIO_IT_IT(\"audio/it\",\n                \".it\"),\n    AUDIO_MAKEMYFUNK_PFUNK(\"audio/make.my.funk\",\n                           \".pfunk\"),\n    AUDIO_MAKE_FUNK(\"audio/make\",\n                    \".funk\"),\n    AUDIO_MAKE_MY(\"audio/make\",\n                  \".my\"),\n    AUDIO_MAKE_PFUNK(\"audio/make\",\n                     \".pfunk\"),\n    AUDIO_MIDI_KAR(\"audio/midi\",\n                   \".kar\"),\n    AUDIO_MIDI_MID(\"audio/midi\",\n                   \".mid\"),\n    AUDIO_MIDI_MIDI(\"audio/midi\",\n                    \".midi\"),\n    AUDIO_MID_RMI(\"audio/mid\",\n                  \".rmi\"),\n    AUDIO_MOD_MOD(\"audio/mod\",\n                  \".mod\"),\n    AUDIO_MPEG_M2A(\"audio/mpeg\",\n                   \".m2a\"),\n    AUDIO_MPEG_MP2(\"audio/mpeg\",\n                   \".mp2\"),\n    AUDIO_MPEG_MPA(\"audio/mpeg\",\n                   \".mpa\"),\n    AUDIO_MPEG_MPG(\"audio/mpeg\",\n                   \".mpg\"),\n    AUDIO_MPEG_MPGA(\"audio/mpeg\",\n                    \".mpga\"),\n    AUDIO_NSPAUDIO_LA(\"audio/nspaudio\",\n                      \".la\"),\n    AUDIO_NSPAUDIO_LMA(\"audio/nspaudio\",\n                       \".lma\"),\n    AUDIO_S3M_S3M(\"audio/s3m\",\n                  \".s3m\"),\n    AUDIO_TSPAUDIO_TSI(\"audio/tsp-audio\",\n                       \".tsi\"),\n    AUDIO_TSPLAYER_TSP(\"audio/tsplayer\",\n                       \".tsp\"),\n    AUDIO_VNDQCELP_QCP(\"audio/vnd.qcelp\",\n                       \".qcp\"),\n    AUDIO_VOC_VOC(\"audio/voc\",\n                  \".voc\"),\n    AUDIO_VOXWARE_VOX(\"audio/voxware\",\n                      \".vox\"),\n    AUDIO_WAV_WAV(\"audio/wav\",\n                  \".wav\"),\n    AUDIO_XADPCM_SND(\"audio/x-adpcm\",\n                     \".snd\"),\n    AUDIO_XAIFF_AIF(\"audio/x-aiff\",\n                    \".aif\"),\n    AUDIO_XAIFF_AIFC(\"audio/x-aiff\",\n                     \".aifc\"),\n    AUDIO_XAIFF_AIFF(\"audio/x-aiff\",\n                     \".aiff\"),\n    AUDIO_XAU_AU(\"audio/x-au\",\n                 \".au\"),\n    AUDIO_XGSM_GSD(\"audio/x-gsm\",\n                   \".gsd\"),\n    AUDIO_XGSM_GSM(\"audio/x-gsm\",\n                   \".gsm\"),\n    AUDIO_XJAM_JAM(\"audio/x-jam\",\n                   \".jam\"),\n    AUDIO_XLIVEAUDIO_LAM(\"audio/x-liveaudio\",\n                         \".lam\"),\n    AUDIO_XMIDI_MID(\"audio/x-midi\",\n                    \".mid\"),\n    AUDIO_XMIDI_MIDI(\"audio/x-midi\",\n                     \".midi\"),\n    AUDIO_XMID_MID(\"audio/x-mid\",\n                   \".mid\"),\n    AUDIO_XMID_MIDI(\"audio/x-mid\",\n                    \".midi\"),\n    AUDIO_XMOD_MOD(\"audio/x-mod\",\n                   \".mod\"),\n    AUDIO_XMPEG3_MP3(\"audio/x-mpeg-3\",\n                     \".mp3\"),\n    AUDIO_XMPEG_MP2(\"audio/x-mpeg\",\n                    \".mp2\"),\n    AUDIO_XMPEQURL_M3U(\"audio/x-mpequrl\",\n                       \".m3u\"),\n    AUDIO_XM_XM(\"audio/xm\",\n                \".xm\"),\n    AUDIO_XNSPAUDIO_LA(\"audio/x-nspaudio\",\n                       \".la\"),\n    AUDIO_XNSPAUDIO_LMA(\"audio/x-nspaudio\",\n                        \".lma\"),\n    AUDIO_XPNREALAUDIOPLUGIN_RA(\"audio/x-pn-realaudio-plugin\",\n                                \".ra\"),\n    AUDIO_XPNREALAUDIOPLUGIN_RMP(\"audio/x-pn-realaudio-plugin\",\n                                 \".rmp\"),\n    AUDIO_XPNREALAUDIOPLUGIN_RPM(\"audio/x-pn-realaudio-plugin\",\n                                 \".rpm\"),\n    AUDIO_XPNREALAUDIO_RA(\"audio/x-pn-realaudio\",\n                          \".ra\"),\n    AUDIO_XPNREALAUDIO_RAM(\"audio/x-pn-realaudio\",\n                           \".ram\"),\n    AUDIO_XPNREALAUDIO_RM(\"audio/x-pn-realaudio\",\n                          \".rm\"),\n    AUDIO_XPNREALAUDIO_RMM(\"audio/x-pn-realaudio\",\n                           \".rmm\"),\n    AUDIO_XPNREALAUDIO_RMP(\"audio/x-pn-realaudio\",\n                           \".rmp\"),\n    AUDIO_XPSID_SID(\"audio/x-psid\",\n                    \".sid\"),\n    AUDIO_XREALAUDIO_RA(\"audio/x-realaudio\",\n                        \".ra\"),\n    AUDIO_XTWINVQPLUGIN_VQE(\"audio/x-twinvq-plugin\",\n                            \".vqe\"),\n    AUDIO_XTWINVQPLUGIN_VQL(\"audio/x-twinvq-plugin\",\n                            \".vql\"),\n    AUDIO_XTWINVQ_VQF(\"audio/x-twinvq\",\n                      \".vqf\"),\n    AUDIO_XVNDAUDIOEXPLOSIONMJUICEMEDIAFILE_MJF(\"audio/x-vnd.audioexplosion.mjuicemediafile\",\n                                                \".mjf\"),\n    AUDIO_XVOC_VOC(\"audio/x-voc\",\n                   \".voc\"),\n    AUDIO_XWAV_WAV(\"audio/x-wav\",\n                   \".wav\"),\n    CHEMICAL_XPDB_PDB(\"chemical/x-pdb\",\n                      \".pdb\"),\n    CHEMICAL_XPDB_XYZ(\"chemical/x-pdb\",\n                      \".xyz\"),\n    DRAWING_XDWFOLD_dwf(\"drawing/x-dwf (old)\",\n                        \".dwf\"),\n    IMAGE_BMP_BM(\"image/bmp\",\n                 \".bm\"),\n    IMAGE_BMP_BMP(\"image/bmp\",\n                  \".bmp\"),\n    IMAGE_CMURASTER_RAS(\"image/cmu-raster\",\n                        \".ras\"),\n    IMAGE_CMURASTER_RAST(\"image/cmu-raster\",\n                         \".rast\"),\n    IMAGE_FIF_FIF(\"image/fif\",\n                  \".fif\"),\n    IMAGE_FLORIAN_FLO(\"image/florian\",\n                      \".flo\"),\n    IMAGE_FLORIAN_TURBOT(\"image/florian\",\n                         \".turbot\"),\n    IMAGE_G3FAX_G3(\"image/g3fax\",\n                   \".g3\"),\n    IMAGE_IEF_IEF(\"image/ief\",\n                  \".ief\"),\n    IMAGE_IEF_IEFS(\"image/ief\",\n                   \".iefs\"),\n    IMAGE_JPEG_JFIF(\"image/jpeg\",\n                    \".jfif\"),\n    IMAGE_JPEG_JFIFTBNL(\"image/jpeg\",\n                        \".jfif-tbnl\"),\n    IMAGE_JPEG_JPE(\"image/jpeg\",\n                   \".jpe\"),\n    IMAGE_JPEG_JPEG(\"image/jpeg\",\n                    \".jpeg\"),\n    IMAGE_JUTVISION_JUT(\"image/jutvision\",\n                        \".jut\"),\n    IMAGE_NAPLPS_NAP(\"image/naplps\",\n                     \".nap\"),\n    IMAGE_NAPLPS_NAPLPS(\"image/naplps\",\n                        \".naplps\"),\n    IMAGE_PICT_PIC(\"image/pict\",\n                   \".pic\"),\n    IMAGE_PICT_PICT(\"image/pict\",\n                    \".pict\"),\n    IMAGE_PJPEG_JFIF(\"image/pjpeg\",\n                     \".jfif\"),\n    IMAGE_PJPEG_JPE(\"image/pjpeg\",\n                    \".jpe\"),\n    IMAGE_PJPEG_JPEG(\"image/pjpeg\",\n                     \".jpeg\"),\n    IMAGE_PJPEG_JPG(\"image/pjpeg\",\n                    \".jpg\"),\n    IMAGE_PNG_XPNG(\"image/png\",\n                   \".x-png\"),\n    IMAGE_TIFF_TIF(\"image/tiff\",\n                   \".tif\"),\n    IMAGE_TIFF_TIFF(\"image/tiff\",\n                    \".tiff\"),\n    IMAGE_VASA_MCF(\"image/vasa\",\n                   \".mcf\"),\n    IMAGE_VNDDWG_DWG(\"image/vnd.dwg\",\n                     \".dwg\"),\n    IMAGE_VNDDWG_DXF(\"image/vnd.dwg\",\n                     \".dxf\"),\n    IMAGE_VNDDWG_SVF(\"image/vnd.dwg\",\n                     \".svf\"),\n    IMAGE_VNDFPX_FPX(\"image/vnd.fpx\",\n                     \".fpx\"),\n    IMAGE_VNDNETFPX_FPX(\"image/vnd.net-fpx\",\n                        \".fpx\"),\n    IMAGE_VNDRNREALFLASH_RF(\"image/vnd.rn-realflash\",\n                            \".rf\"),\n    IMAGE_VNDRNREALPIX_RP(\"image/vnd.rn-realpix\",\n                          \".rp\"),\n    IMAGE_VNDWAPWBMP_WBMP(\"image/vnd.wap.wbmp\",\n                          \".wbmp\"),\n    IMAGE_VNDXIFF_XIF(\"image/vnd.xiff\",\n                      \".xif\"),\n    IMAGE_XBM_XBM(\"image/xbm\",\n                  \".xbm\"),\n    IMAGE_XCMURASTER_RAS(\"image/x-cmu-raster\",\n                         \".ras\"),\n    IMAGE_XDWG_DWG(\"image/x-dwg\",\n                   \".dwg\"),\n    IMAGE_XDWG_DXF(\"image/x-dwg\",\n                   \".dxf\"),\n    IMAGE_XDWG_SVF(\"image/x-dwg\",\n                   \".svf\"),\n    IMAGE_XICON_ICO(\"image/x-icon\",\n                    \".ico\"),\n    IMAGE_XJG_ART(\"image/x-jg\",\n                  \".art\"),\n    IMAGE_XJPS_JPS(\"image/x-jps\",\n                   \".jps\"),\n    IMAGE_XNIFF_NIF(\"image/x-niff\",\n                    \".nif\"),\n    IMAGE_XNIFF_NIFF(\"image/x-niff\",\n                     \".niff\"),\n    IMAGE_XPCX_PCX(\"image/x-pcx\",\n                   \".pcx\"),\n    IMAGE_XPICT_PCT(\"image/x-pict\",\n                    \".pct\"),\n    IMAGE_XPM_XPM(\"image/xpm\",\n                  \".xpm\"),\n    IMAGE_XPORTABLEANYMAP_PNM(\"image/x-portable-anymap\",\n                              \".pnm\"),\n    IMAGE_XPORTABLEBITMAP_PBM(\"image/x-portable-bitmap\",\n                              \".pbm\"),\n    IMAGE_XPORTABLEGRAYMAP_PGM(\"image/x-portable-graymap\",\n                               \".pgm\"),\n    IMAGE_XPORTABLEGREYMAP_PGM(\"image/x-portable-greymap\",\n                               \".pgm\"),\n    IMAGE_XPORTABLEPIXMAP_PPM(\"image/x-portable-pixmap\",\n                              \".ppm\"),\n    IMAGE_XQUICKTIME_QIF(\"image/x-quicktime\",\n                         \".qif\"),\n    IMAGE_XQUICKTIME_QTI(\"image/x-quicktime\",\n                         \".qti\"),\n    IMAGE_XQUICKTIME_QTIF(\"image/x-quicktime\",\n                          \".qtif\"),\n    IMAGE_XRGB_RGB(\"image/x-rgb\",\n                   \".rgb\"),\n    IMAGE_XTIFF_TIF(\"image/x-tiff\",\n                    \".tif\"),\n    IMAGE_XTIFF_TIFF(\"image/x-tiff\",\n                     \".tiff\"),\n    IMAGE_XWINDOWSBMP_BMP(\"image/x-windows-bmp\",\n                          \".bmp\"),\n    IMAGE_XXBITMAP_XBM(\"image/x-xbitmap\",\n                       \".xbm\"),\n    IMAGE_XXBM_XBM(\"image/x-xbm\",\n                   \".xbm\"),\n    IMAGE_XXPIXMAP_PM(\"image/x-xpixmap\",\n                      \".pm\"),\n    IMAGE_XXPIXMAP_XPM(\"image/x-xpixmap\",\n                       \".xpm\"),\n    IMAGE_XXWD_XWD(\"image/x-xwd\",\n                   \".xwd\"),\n    IMAGE_XXWINDOWDUMP_XWD(\"image/x-xwindowdump\",\n                           \".xwd\"),\n    IWORLD_IVRML_IVR(\"i-world/i-vrml\",\n                     \".ivr\"),\n    MESSAGE_RFC822_MHT(\"message/rfc822\",\n                       \".mht\"),\n    MESSAGE_RFC822_MHTML(\"message/rfc822\",\n                         \".mhtml\"),\n    MESSAGE_RFC822_MIME(\"message/rfc822\",\n                        \".mime\"),\n    MODEL_IGES_IGES(\"model/iges\",\n                    \".iges\"),\n    MODEL_IGES_IGS(\"model/iges\",\n                   \".igs\"),\n    MODEL_VNDDWF_DWF(\"model/vnd.dwf\",\n                     \".dwf\"),\n    MODEL_VRML_VRML(\"model/vrml\",\n                    \".vrml\"),\n    MODEL_VRML_WRL(\"model/vrml\",\n                   \".wrl\"),\n    MODEL_VRML_WRZ(\"model/vrml\",\n                   \".wrz\"),\n    MODEL_XPOV_POV(\"model/x-pov\",\n                   \".pov\"),\n    MULTIPART_XGZIP_GZIP(\"multipart/x-gzip\",\n                         \".gzip\"),\n    MULTIPART_XUSTAR_USTAR(\"multipart/x-ustar\",\n                           \".ustar\"),\n    MULTIPART_XZIP_ZIP(\"multipart/x-zip\",\n                       \".zip\"),\n    MUSIC_CRESCENDO_MID(\"music/crescendo\",\n                        \".mid\"),\n    MUSIC_CRESCENDO_MIDI(\"music/crescendo\",\n                         \".midi\"),\n    MUSIC_XKARAOKE_KAR(\"music/x-karaoke\",\n                       \".kar\"),\n    PALEOVU_XPV_PVU(\"paleovu/x-pv\",\n                    \".pvu\"),\n    TEXT_ASP_ASP(\"text/asp\",\n                 \".asp\"),\n    TEXT_ECMASCRIPT_JS(\"text/ecmascript\",\n                       \".js\"),\n    TEXT_HTML_ACGI(\"text/html\",\n                   \".acgi\"),\n    TEXT_HTML_HTM(\"text/html\",\n                  \".htm\"),\n    TEXT_HTML_HTMLS(\"text/html\",\n                    \".htmls\"),\n    TEXT_HTML_HTX(\"text/html\",\n                  \".htx\"),\n    TEXT_HTML_SHTML(\"text/html\",\n                    \".shtml\"),\n    TEXT_MCF_MCF(\"text/mcf\",\n                 \".mcf\"),\n    TEXT_PASCAL_PAS(\"text/pascal\",\n                    \".pas\"),\n    TEXT_PLAIN_C(\"text/plain\",\n                 \".c\"),\n    TEXT_PLAIN_CC(\"text/plain\",\n                  \".cc\"),\n    TEXT_PLAIN_COM(\"text/plain\",\n                   \".com\"),\n    TEXT_PLAIN_CONF(\"text/plain\",\n                    \".conf\"),\n    TEXT_PLAIN_CPLUSPLUS(\"text/plain\",\n                         \".c++\"),\n    TEXT_PLAIN_CXX(\"text/plain\",\n                   \".cxx\"),\n    TEXT_PLAIN_DEF(\"text/plain\",\n                   \".def\"),\n    TEXT_PLAIN_F(\"text/plain\",\n                 \".f\"),\n    TEXT_PLAIN_F90(\"text/plain\",\n                   \".f90\"),\n    TEXT_PLAIN_FOR(\"text/plain\",\n                   \".for\"),\n    TEXT_PLAIN_G(\"text/plain\",\n                 \".g\"),\n    TEXT_PLAIN_H(\"text/plain\",\n                 \".h\"),\n    TEXT_PLAIN_HH(\"text/plain\",\n                  \".hh\"),\n    TEXT_PLAIN_IDC(\"text/plain\",\n                   \".idc\"),\n    TEXT_PLAIN_JAV(\"text/plain\",\n                   \".jav\"),\n    TEXT_PLAIN_JAVA(\"text/plain\",\n                    \".java\"),\n    TEXT_PLAIN_LIST(\"text/plain\",\n                    \".list\"),\n    TEXT_PLAIN_LOG(\"text/plain\",\n                   \".log\"),\n    TEXT_PLAIN_LST(\"text/plain\",\n                   \".lst\"),\n    TEXT_PLAIN_M(\"text/plain\",\n                 \".m\"),\n    TEXT_PLAIN_MAR(\"text/plain\",\n                   \".mar\"),\n    TEXT_PLAIN_PL(\"text/plain\",\n                  \".pl\"),\n    TEXT_PLAIN_SDML(\"text/plain\",\n                    \".sdml\"),\n    TEXT_PLAIN_TEXT(\"text/plain\",\n                    \".text\"),\n    TEXT_RICHTEXT_RT(\"text/richtext\",\n                     \".rt\"),\n    TEXT_RICHTEXT_RTF(\"text/richtext\",\n                      \".rtf\"),\n    TEXT_RICHTEXT_RTX(\"text/richtext\",\n                      \".rtx\"),\n    TEXT_SCRIPLET_WSC(\"text/scriplet\",\n                      \".wsc\"),\n    TEXT_SGML_SGM(\"text/sgml\",\n                  \".sgm\"),\n    TEXT_SGML_SGML(\"text/sgml\",\n                   \".sgml\"),\n    TEXT_TABSEPARATEDVALUES_TSV(\"text/tab-separated-values\",\n                                \".tsv\"),\n    TEXT_URILIST_UNI(\"text/uri-list\",\n                     \".uni\"),\n    TEXT_URILIST_UNIS(\"text/uri-list\",\n                      \".unis\"),\n    TEXT_URILIST_URI(\"text/uri-list\",\n                     \".uri\"),\n    TEXT_URILIST_URIS(\"text/uri-list\",\n                      \".uris\"),\n    TEXT_VNDABC_ABC(\"text/vnd.abc\",\n                    \".abc\"),\n    TEXT_VNDFMIFLEXSTOR_FLX(\"text/vnd.fmi.flexstor\",\n                            \".flx\"),\n    TEXT_VNDRNREALTEXT_RT(\"text/vnd.rn-realtext\",\n                          \".rt\"),\n    TEXT_VNDWAPWMLSCRIPT_WMLS(\"text/vnd.wap.wmlscript\",\n                              \".wmls\"),\n    TEXT_VNDWAPWML_WML(\"text/vnd.wap.wml\",\n                       \".wml\"),\n    TEXT_WEBVIEWHTML_HTT(\"text/webviewhtml\",\n                         \".htt\"),\n    TEXT_XASM_ASM(\"text/x-asm\",\n                  \".asm\"),\n    TEXT_XASM_S(\"text/x-asm\",\n                \".s\"),\n    TEXT_XAUDIOSOFTINTRA_AIP(\"text/x-audiosoft-intra\",\n                             \".aip\"),\n    TEXT_XCOMPONENT_HTC(\"text/x-component\",\n                        \".htc\"),\n    TEXT_XC_C(\"text/x-c\",\n              \".c\"),\n    TEXT_XC_CC(\"text/x-c\",\n               \".cc\"),\n    TEXT_XC_CPP(\"text/x-c\",\n                \".cpp\"),\n    TEXT_XFORTRAN_F(\"text/x-fortran\",\n                    \".f\"),\n    TEXT_XFORTRAN_F77(\"text/x-fortran\",\n                      \".f77\"),\n    TEXT_XFORTRAN_F90(\"text/x-fortran\",\n                      \".f90\"),\n    TEXT_XFORTRAN_FOR(\"text/x-fortran\",\n                      \".for\"),\n    TEXT_XH_H(\"text/x-h\",\n              \".h\"),\n    TEXT_XH_HH(\"text/x-h\",\n               \".hh\"),\n    TEXT_XJAVASOURCE_JAV(\"text/x-java-source\",\n                         \".jav\"),\n    TEXT_XJAVASOURCE_JAVA(\"text/x-java-source\",\n                          \".java\"),\n    TEXT_XLAASF_LSX(\"text/x-la-asf\",\n                    \".lsx\"),\n    TEXT_XML_XML(\"text/xml\",\n                 \".xml\"),\n    TEXT_XM_M(\"text/x-m\",\n              \".m\"),\n    TEXT_XPASCAL_P(\"text/x-pascal\",\n                   \".p\"),\n    TEXT_XSCRIPTCSH_CSH(\"text/x-script.csh\",\n                        \".csh\"),\n    TEXT_XSCRIPTELISP_EL(\"text/x-script.elisp\",\n                         \".el\"),\n    TEXT_XSCRIPTGUILE_SCM(\"text/x-script.guile\",\n                          \".scm\"),\n    TEXT_XSCRIPTKSH_KSH(\"text/x-script.ksh\",\n                        \".ksh\"),\n    TEXT_XSCRIPTLISP_LSP(\"text/x-script.lisp\",\n                         \".lsp\"),\n    TEXT_XSCRIPTPERLMODULE_PM(\"text/x-script.perl-module\",\n                              \".pm\"),\n    TEXT_XSCRIPTPERL_PL(\"text/x-script.perl\",\n                        \".pl\"),\n    TEXT_XSCRIPTPHYTON_PY(\"text/x-script.phyton\",\n                          \".py\"),\n    TEXT_XSCRIPTREXX_REXX(\"text/x-script.rexx\",\n                          \".rexx\"),\n    TEXT_XSCRIPTSCHEME_SCM(\"text/x-script.scheme\",\n                           \".scm\"),\n    TEXT_XSCRIPTSH_SH(\"text/x-script.sh\",\n                      \".sh\"),\n    TEXT_XSCRIPTTCL_TCL(\"text/x-script.tcl\",\n                        \".tcl\"),\n    TEXT_XSCRIPTTCSH_TCSH(\"text/x-script.tcsh\",\n                          \".tcsh\"),\n    TEXT_XSCRIPTZSH_ZSH(\"text/x-script.zsh\",\n                        \".zsh\"),\n    TEXT_XSCRIPT_HLB(\"text/x-script\",\n                     \".hlb\"),\n    TEXT_XSERVERPARSEDHTML_SHTML(\"text/x-server-parsed-html\",\n                                 \".shtml\"),\n    TEXT_XSERVERPARSEDHTML_SSI(\"text/x-server-parsed-html\",\n                               \".ssi\"),\n    TEXT_XSETEXT_ETX(\"text/x-setext\",\n                     \".etx\"),\n    TEXT_XSGML_SGM(\"text/x-sgml\",\n                   \".sgm\"),\n    TEXT_XSGML_SGML(\"text/x-sgml\",\n                    \".sgml\"),\n    TEXT_XSPEECH_SPC(\"text/x-speech\",\n                     \".spc\"),\n    TEXT_XSPEECH_TALK(\"text/x-speech\",\n                      \".talk\"),\n    TEXT_XUIL_UIL(\"text/x-uil\",\n                  \".uil\"),\n    TEXT_XUUENCODE_UU(\"text/x-uuencode\",\n                      \".uu\"),\n    TEXT_XUUENCODE_UUE(\"text/x-uuencode\",\n                       \".uue\"),\n    TEXT_XVCALENDAR_VCS(\"text/x-vcalendar\",\n                        \".vcs\"),\n    VIDEO_ANIMAFLEX_AFL(\"video/animaflex\",\n                        \".afl\"),\n    VIDEO_AVSVIDEO_AVS(\"video/avs-video\",\n                       \".avs\"),\n    VIDEO_DL_DL(\"video/dl\",\n                \".dl\"),\n    VIDEO_FLI_FLI(\"video/fli\",\n                  \".fli\"),\n    VIDEO_GL_GL(\"video/gl\",\n                \".gl\"),\n    VIDEO_MPEG_M1V(\"video/mpeg\",\n                   \".m1v\"),\n    VIDEO_MPEG_M2V(\"video/mpeg\",\n                   \".m2v\"),\n    VIDEO_MPEG_MP2(\"video/mpeg\",\n                   \".mp2\"),\n    VIDEO_MPEG_MP3(\"video/mpeg\",\n                   \".mp3\"),\n    VIDEO_MPEG_MPA(\"video/mpeg\",\n                   \".mpa\"),\n    VIDEO_MPEG_MPE(\"video/mpeg\",\n                   \".mpe\"),\n    VIDEO_MPEG_MPEG(\"video/mpeg\",\n                    \".mpeg\"),\n    VIDEO_MPEG_MPG(\"video/mpeg\",\n                   \".mpg\"),\n    VIDEO_MSVIDEO_AVI(\"video/msvideo\",\n                      \".avi\"),\n    VIDEO_QUICKTIME_MOOV(\"video/quicktime\",\n                         \".moov\"),\n    VIDEO_QUICKTIME_QT(\"video/quicktime\",\n                       \".qt\"),\n    VIDEO_VDO_VDO(\"video/vdo\",\n                  \".vdo\"),\n    VIDEO_VIVO_VIV(\"video/vivo\",\n                   \".viv\"),\n    VIDEO_VIVO_VIVO(\"video/vivo\",\n                    \".vivo\"),\n    VIDEO_VNDRNREALVIDEO_RV(\"video/vnd.rn-realvideo\",\n                            \".rv\"),\n    VIDEO_VNDVIVO_VIV(\"video/vnd.vivo\",\n                      \".viv\"),\n    VIDEO_VNDVIVO_VIVO(\"video/vnd.vivo\",\n                       \".vivo\"),\n    VIDEO_VOSAIC_VOS(\"video/vosaic\",\n                     \".vos\"),\n    VIDEO_XAMTDEMORUN_XDR(\"video/x-amt-demorun\",\n                          \".xdr\"),\n    VIDEO_XAMTSHOWRUN_XSR(\"video/x-amt-showrun\",\n                          \".xsr\"),\n    VIDEO_XATOMIC3DFEATURE_FMF(\"video/x-atomic3d-feature\",\n                               \".fmf\"),\n    VIDEO_XDL_DL(\"video/x-dl\",\n                 \".dl\"),\n    VIDEO_XDV_DIF(\"video/x-dv\",\n                  \".dif\"),\n    VIDEO_XDV_DV(\"video/x-dv\",\n                 \".dv\"),\n    VIDEO_XFLI_FLI(\"video/x-fli\",\n                   \".fli\"),\n    VIDEO_XGL_GL(\"video/x-gl\",\n                 \".gl\"),\n    VIDEO_XISVIDEO_ISU(\"video/x-isvideo\",\n                       \".isu\"),\n    VIDEO_XMOTIONJPEG_MJPG(\"video/x-motion-jpeg\",\n                           \".mjpg\"),\n    VIDEO_XMPEG_MP2(\"video/x-mpeg\",\n                    \".mp2\"),\n    VIDEO_XMPEG_MP3(\"video/x-mpeg\",\n                    \".mp3\"),\n    VIDEO_XMPEQ2A_MP2(\"video/x-mpeq2a\",\n                      \".mp2\"),\n    VIDEO_XMSASFPLUGIN_ASX(\"video/x-ms-asf-plugin\",\n                           \".asx\"),\n    VIDEO_XMSASF_ASF(\"video/x-ms-asf\",\n                     \".asf\"),\n    VIDEO_XMSASF_ASX(\"video/x-ms-asf\",\n                     \".asx\"),\n    VIDEO_XMSVIDEO_AVI(\"video/x-msvideo\",\n                       \".avi\"),\n    VIDEO_XQTC_QTC(\"video/x-qtc\",\n                   \".qtc\"),\n    VIDEO_XSCM_SCM(\"video/x-scm\",\n                   \".scm\"),\n    VIDEO_XSGIMOVIE_MOVIE(\"video/x-sgi-movie\",\n                          \".movie\"),\n    VIDEO_XSGIMOVIE_MV(\"video/x-sgi-movie\",\n                       \".mv\"),\n    WINDOWS_METAFILE_WMF(\"windows/metafile\",\n                         \".wmf\"),\n    WWW_MIME_MIME(\"www/mime\",\n                  \".mime\"),\n    XCONFERENCE_XCOOLTALK_ICE(\"x-conference/x-cooltalk\",\n                              \".ice\"),\n    XGL_DRAWING_XGZ(\"xgl/drawing\",\n                    \".xgz\"),\n    XGL_MOVIE_XMZ(\"xgl/movie\",\n                  \".xmz\"),\n    XMUSIC_XMIDI_MID(\"x-music/x-midi\",\n                     \".mid\"),\n    XMUSIC_XMIDI_MIDI(\"x-music/x-midi\",\n                      \".midi\"),\n    XWORLD_X3DMF_3DM(\"x-world/x-3dmf\",\n                     \".3dm\"),\n    XWORLD_X3DMF_3DMF(\"x-world/x-3dmf\",\n                      \".3dmf\"),\n    XWORLD_X3DMF_QD3(\"x-world/x-3dmf\",\n                     \".qd3\"),\n    XWORLD_X3DMF_QD3D(\"x-world/x-3dmf\",\n                      \".qd3d\"),\n    XWORLD_XSVR_SVR(\"x-world/x-svr\",\n                    \".svr\"),\n    XWORLD_XVRML_VRML(\"x-world/x-vrml\",\n                      \".vrml\"),\n    XWORLD_XVRML_WRL(\"x-world/x-vrml\",\n                     \".wrl\"),\n    XWORLD_XVRML_WRZ(\"x-world/x-vrml\",\n                     \".wrz\"),\n    XWORLD_XVRT_VRT(\"x-world/x-vrt\",\n                    \".vrt\");\n\n    private String type;\n    private String extension;\n\n    MimeType(String type,\n             String extension) {\n        this.type = type;\n        this.extension = extension;\n    }\n\n    /**\n     * Gets the first matching mime-type for the given type\n     * @param type e.g. \"application/zip\"\n     * @return The MimeType that matched the given type\n     */\n    public static MimeType fromType(String type) {\n        if (type != null) {\n            type = type.trim().toLowerCase();\n            for (MimeType mt : MimeType.values()) {\n                if (mt.getType().equals(type)) {\n                    return mt;\n                }\n            }\n        }\n\n        return null;\n    }\n\n    /**\n     * Gets the first matching mime-type for the given extension\n     * @param extension e.g. \".zip\"\n     * @return The MimeType that matched the given extension\n     */\n    public static MimeType fromExtension(String extension) {\n        if (extension != null) {\n            extension = extension.trim().toLowerCase();\n            for (MimeType mt : MimeType.values()) {\n                if (mt.getExtension().equals(extension)) {\n                    return mt;\n                }\n            }\n        }\n\n        return null;\n    }\n\n    /**\n     * Get a String representation of this type. e.g. \"application/zip\"\n     * @return\n     */\n    public String getType() {\n        return type;\n    }\n\n    /**\n     * Get the extension for this type. e.g. \".zip\"\n     * @return\n     */\n    public String getExtension() {\n        return extension;\n    }\n}"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/UploadUriProvider.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.server;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.uberfire.util.URIUtil;\n\nimport static org.uberfire.server.util.FileServletUtil.decodeFileNamePart;\nimport static org.uberfire.server.util.FileServletUtil.encodeFileName;\nimport static org.uberfire.server.util.FileServletUtil.encodeFileNamePart;\n\npublic class UploadUriProvider {\n\n    private static final String PARAM_PATH = \"path\";\n    private static final String PARAM_FOLDER = \"folder\";\n    private static final String PARAM_FILENAME = \"fileName\";\n    private static final String PARAM_UPDATE = \"update\";\n\n    public static URI getTargetLocation(final HttpServletRequest request) throws URISyntaxException,\n            FileUploadException {\n\n        if (request.getParameter(PARAM_PATH) != null) {\n            String parameter = request.getParameter(PARAM_PATH);\n            String decode = decodeFileNamePart(parameter);\n            String str = encodeFileNamePart(decode);\n            return new URI(str);\n        } else if (request.getParameter(PARAM_FOLDER) != null) {\n            return new URI(request.getParameter(PARAM_FOLDER).replaceAll(\"\\\\s\", \"%20\") + \"/\" + encodeFileName(URIUtil.decode(request.getParameter(PARAM_FILENAME))));\n        } else {\n            throw new FileUploadException(\"Path to file was invalid.\");\n        }\n    }\n    \n    public static boolean isUpdate(final HttpServletRequest request) {\n        return Boolean.parseBoolean(request.getParameter(PARAM_UPDATE));\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/cdi/UberFireGeneralFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server.cdi;\n\nimport javax.enterprise.context.RequestScoped;\nimport javax.enterprise.inject.Default;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\n\nimport static org.jboss.errai.bus.server.api.RpcContext.getMessage;\nimport static org.jboss.errai.bus.server.api.RpcContext.getQueueSession;\n\npublic class UberFireGeneralFactory {\n\n    @Inject\n    private Instance<User> user;\n\n    @Produces\n    @RequestScoped\n    @Default\n    public SessionInfo getSessionInfo(AuthenticationService authenticationService) {\n        String sessionId = getSessionId();\n        User user;\n        if (sessionId == null) {\n            user = getDefaultUser();\n            sessionId = user.getIdentifier();\n        } else {\n            user = authenticationService.getUser();\n        }\n        return new SessionInfoImpl(sessionId,\n                                   user);\n    }\n\n    private User getDefaultUser() {\n        if (user.isAmbiguous() || user.isUnsatisfied()) {\n            throw new IllegalStateException(\"Cannot get session info outside of servlet thread when no default user is provided.\");\n        } else {\n            return user.get();\n        }\n    }\n\n    private String getSessionId() {\n        return (getMessage() != null && getQueueSession() != null ? getQueueSession().getSessionId() : null);\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/locale/GWTLocaleHeaderFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.server.locale;\n\nimport java.io.CharArrayWriter;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.util.Locale;\nimport javax.servlet.Filter;\nimport javax.servlet.FilterChain;\nimport javax.servlet.FilterConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.ServletRequest;\nimport javax.servlet.ServletResponse;\nimport javax.servlet.WriteListener;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpServletResponseWrapper;\n\nimport org.apache.commons.lang3.LocaleUtils;\nimport org.jsoup.Jsoup;\nimport org.jsoup.nodes.Document;\n\n/**\n * Serializes and adds the GWT locale meta tag in the\n * application's host page. This is useful in case the\n * host page is a simple html file.\n */\npublic class GWTLocaleHeaderFilter implements Filter {\n\n    @Override\n    public void init(final FilterConfig filterConfig) throws ServletException {\n    }\n\n    @Override\n    public void destroy() {\n    }\n\n    @Override\n    public void doFilter(final ServletRequest request,\n                         final ServletResponse response,\n                         final FilterChain chain) throws IOException, ServletException {\n\n        final CharResponseWrapper wrappedResponse = getWrapper((HttpServletResponse) response);\n        chain.doFilter(request,\n                       wrappedResponse);\n\n        final String output;\n\n        final Locale locale = getLocale(request);\n        final String injectedScript = \"<meta name=\\\"gwt:property\\\" content=\\\"locale=\" + locale.toString() + \"\\\">\";\n\n        final Document document = Jsoup.parse(wrappedResponse.toString());\n        document.head().append(injectedScript);\n        output = document.html();\n\n        final byte[] outputBytes = output.getBytes(\"UTF-8\");\n        response.setContentLength(outputBytes.length);\n        response.getWriter().print(output);\n    }\n\n    protected CharResponseWrapper getWrapper(final HttpServletResponse response) {\n        return new CharResponseWrapper(response);\n    }\n\n    private Locale getLocale(final ServletRequest request) {\n        Locale locale = request.getLocale();\n        final String paramLocale = request.getParameter(\"locale\");\n        if (paramLocale == null || paramLocale.isEmpty()) {\n            return locale;\n        }\n        try {\n            locale = LocaleUtils.toLocale(paramLocale);\n        } catch (Exception e) {\n            //Swallow. Locale is initially set to ServletRequest locale\n        }\n        return locale;\n    }\n\n    static class CharResponseWrapper extends HttpServletResponseWrapper {\n\n        protected CharArrayWriter charWriter = new CharArrayWriter();\n\n        protected ServletOutputStream outputStream = new ServletOutputStream() {\n            @Override\n            public boolean isReady() {\n                return true;\n            }\n\n            @Override\n            public void setWriteListener(WriteListener writeListener) {\n                // TODO how to treat the listener?\n            }\n\n            @Override\n            public void write(int b) throws IOException {\n                charWriter.write(b);\n            }\n        };\n\n        protected PrintWriter writer = new PrintWriter(charWriter);\n\n        public CharResponseWrapper(final HttpServletResponse response) {\n            super(response);\n        }\n\n        @Override\n        public ServletOutputStream getOutputStream() throws IOException {\n            return outputStream;\n        }\n\n        @Override\n        public PrintWriter getWriter() throws IOException {\n            return writer;\n        }\n\n        @Override\n        public void flushBuffer() throws IOException {\n            // Don't remove this override!\n            // When intercepting static content, WAS 8.5.5.5 prematurely calls this\n            // method to flush the output stream before we can calculate the content\n            // length (see above).\n        }\n\n        @Override\n        public String toString() {\n            return charWriter.toString();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-server/src/main/java/org/uberfire/server/util/FileServletUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server.util;\n\nimport org.uberfire.util.URIUtil;\n\npublic class FileServletUtil {\n\n    public static String encodeFileNamePart(final String path) {\n        //encode the file name part for a given path in the vfs uri format.\n        return handleStream(path,\n                            false);\n    }\n\n    public static String decodeFileNamePart(final String path) {\n        //decode the file name part for a given path in the vfs uri format.\n        return handleStream(path,\n                            true);\n    }\n\n    private static String handleStream(final String path,\n                                       final boolean decode) {\n        if (path == null) {\n            return null;\n        } else {\n            int index = path.lastIndexOf('/');\n            StringBuilder builder = new StringBuilder();\n            if (index >= 0) {\n                builder.append(path.substring(0,\n                                              index + 1));\n                if (index < path.length() - 1) {\n                    if (decode) {\n                        builder.append(URIUtil.decode(path.substring(index + 1,\n                                                                     path.length())));\n                    } else {\n                        builder.append(URIUtil.encode(path.substring(index + 1,\n                                                                     path.length())));\n                    }\n                }\n            } else {\n                builder.append(path);\n            }\n            return builder.toString();\n        }\n    }\n\n    public static String encodeFileName(final String fileName) {\n        return URIUtil.encode(fileName);\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-server/src/test/java/org/uberfire/server/FileDownloadServletTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.net.URI;\n\nimport javax.servlet.ServletOutputStream;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.server.util.FileServletUtil;\n\nimport static java.lang.String.format;\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FileDownloadServletTest {\n\n    private static final String PARAM_PATH = \"path\";\n\n    private static final String TEST_ROOT_PATH = \"default://main@test-repository/test-project/src/main/resources/test\";\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private ServletOutputStream servletOutputStream;\n\n    @InjectMocks\n    private FileDownloadServlet downloadServlet;\n\n    /**\n     * Tests the downloading of a file given the following parameters:\n     * <p>\n     * 1) the file path on the server side of a file with no blank spaces in the name.\n     */\n    @Test\n    public void downloadByPathWithNoSpaces() throws Exception {\n\n        //test the download of a file name with no blank spaces.\n        String fileName = \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n\n        doDownloadByPath(TEST_ROOT_PATH,\n                         fileName,\n                         fileContent);\n    }\n\n    @Test\n    public void testMakeURI() throws Exception {\n\n        final String pathURI = \"default://main@MySpace/aa/src/main/resources/com/myspace/aa/vv vv.drl\";\n        final URI uri = downloadServlet.makeURI(pathURI);\n\n        assertEquals(\"/aa/src/main/resources/com/myspace/aa/vv+vv.drl\", uri.getRawPath());\n    }\n\n    private void doDownloadByPath(String sourceFolder,\n                                  String sourceFileName,\n                                  String fileContent) throws Exception {\n\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n\n        String sourcePath = sourceFolder + \"/\" + sourceFileName;\n\n        //mock the servlet parameters\n        when(request.getParameter(PARAM_PATH)).thenReturn(sourcePath);\n\n        //mock the servlet output stream\n        when(response.getOutputStream()).thenReturn(servletOutputStream);\n\n        //mock the path to be generated by the ioService\n        Path path = mock(Path.class);\n        Path pathFileName = mock(Path.class);\n        when(path.getFileName()).thenReturn(pathFileName);\n        when(pathFileName.toString()).thenReturn(sourceFileName);\n\n        //Expected URI\n        URI expectedURI = new URI(FileServletUtil.encodeFileNamePart(sourcePath));\n\n        //mock the path generation\n        when(ioService.get(expectedURI)).thenReturn(path);\n\n        //mock the returned content\n        when(ioService.readAllBytes(path)).thenReturn(fileContent.getBytes());\n\n        downloadServlet.doGet(request,\n                              response);\n\n        verify(response,\n               times(1)).setHeader(\"Content-Disposition\",\n                                   format(\"attachment; filename=\\\"%s\\\";\",\n                                          sourceFileName));\n        verify(response,\n               times(1)).setContentType(eq(\"application/octet-stream\"));\n        verify(response,\n               times(1)).getOutputStream();\n\n        verify(servletOutputStream,\n               times(1)).write(fileContent.getBytes(),\n                               0,\n                               fileContent.getBytes().length);\n\n        verify(ioService,\n               times(1)).get(eq(expectedURI));\n        verify(ioService,\n               times(1)).readAllBytes(eq(path));\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/test/java/org/uberfire/server/FileUploadServletTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.PrintWriter;\nimport java.net.URI;\n\nimport javax.servlet.ReadListener;\nimport javax.servlet.ServletInputStream;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.server.util.FileServletUtil;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FileUploadServletTest {\n\n    //Parameters expected by the FileUploadServlet.\n    private static final String PARAM_PATH = \"path\";\n    private static final String PARAM_FOLDER = \"folder\";\n    private static final String PARAM_FILENAME = \"fileName\";\n    private static final String PARAM_UPDATE = \"update\";\n\n    private static final String TEST_ROOT_PATH = \"default://main@test-repository/test-project/src/main/resources/test\";\n    private static final String TEST_ROOT_PATH_WITH_SPACES = \"default://main@mtest-repository/my test project/src/main/resources/test\";\n\n    private static final String BOUNDARY = \"---------------------------9051914041544843365972754266\";\n    private static final String BOUNDARY_DELIMITER = \"--\";\n    private static final String CONTENT_TYPE = \"multipart/form-data; boundary=\\\"\" + BOUNDARY + \"\\\"\";\n    /**\n     * The Carriage Return ASCII character value.\n     */\n    private static final byte CR = 0x0D;\n\n    /**\n     * The Line Feed ASCII character value.\n     */\n    private static final byte LF = 0x0A;\n\n    private static final String BREAK = new String(new char[]{CR, LF});\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private Path path;\n\n    @Mock\n    private FileSystem fileSystem;\n\n    @InjectMocks\n    private FileUploadServlet uploadServlet;\n\n    @Before\n    public void setup() {\n        when(ioService.get(any(URI.class))).thenReturn(path);\n        when(path.getFileSystem()).thenReturn(fileSystem);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination folder on the server side.\n     * 2) a destination file name (with blank spaces).\n     * @throws Exception\n     */\n    @Test\n    public void uploadByNameWithSpacesAndFolder() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetFileName = \"File Name With Spaces.some extension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByNameAndFolder(targetFileName,\n                                    TEST_ROOT_PATH,\n                                    fileContent);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination folder on the server side (with blank spaces).\n     * 2) a destination file name (with blank spaces).\n     * @throws Exception\n     */\n    @Test\n    public void uploadByNameAndFolderWithSpaces() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetFileName = \"File Name With Spaces.some extension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByNameAndFolder(targetFileName,\n                                    TEST_ROOT_PATH_WITH_SPACES,\n                                    fileContent);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination folder on the server side.\n     * 2) a destination file name (with NO blank spaces).\n     * @throws Exception\n     */\n    @Test\n    public void uploadByNameWithNoSpacesAndFolder() throws Exception {\n\n        //test the upload of a file name with NO blank spaces into a given folder.\n        String targetFileName = \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByNameAndFolder(targetFileName,\n                                    TEST_ROOT_PATH,\n                                    fileContent);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination folder on the server side (with blank spaces).\n     * 2) a destination file name (with NO blank spaces).\n     * @throws Exception\n     */\n    @Test\n    public void uploadByNameWithNoSpacesAndFolderWithSpaces() throws Exception {\n\n        //test the upload of a file name with NO blank spaces into a given folder.\n        String targetFileName = \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByNameAndFolder(targetFileName,\n                                    TEST_ROOT_PATH_WITH_SPACES,\n                                    fileContent);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination path, composed of a folder and a file name with blank spaces.\n     * @throws Exception\n     */\n    @Test\n    public void uploadByPathWithSpacesAndFolderNoSpaces() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetPath = TEST_ROOT_PATH + \"/\" + \"File Name With Spaces.some extension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByPath(targetPath,\n                           fileContent,\n                           false,\n                           false);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination path, composed of a folder with blank spaces and a file name with blank spaces.\n     * @throws Exception\n     */\n    @Test\n    public void uploadByPathWithSpacesAndFolderWithSpaces() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetPathWithSpaces = TEST_ROOT_PATH_WITH_SPACES.replaceAll(\"\\\\s\", \"%20\") + \"/\" + \"File Name With Spaces.some extension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByPath(targetPathWithSpaces,\n                           fileContent,\n                           true,\n                           true);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination path, composed of a folder and a file name with no blank spaces.\n     * @throws Exception\n     */\n    @Test\n    public void uploadByPathWithNoSpacesAndFolderWithNoSpaces() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetPath = TEST_ROOT_PATH.replaceAll(\"\\\\s\", \"%20\") + \"/\" + \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n\n        doUploadTestByPath(targetPath,\n                           fileContent,\n                           false,\n                           true);\n    }\n    \n    /**\n     * Tests the upload failure of a file given the following parameters:\n     * <p>\n     * 1) a destination path, composed of a folder and a file name with no blank spaces.\n     * @throws Exception\n     */\n    @Test\n    public void failedUploadByPathWithNoSpacesAndFolderWithNoSpaces() throws Exception {\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetPath = TEST_ROOT_PATH.replaceAll(\"\\\\s\", \"%20\") + \"/\" + \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n    \n        doUploadTestByPath(targetPath,\n                               fileContent,\n                               true,\n                               false);\n    }\n\n    /**\n     * Tests the uploading of a file given the following parameters:\n     * <p>\n     * 1) a destination path, composed of a folder and a file name with no blank spaces.\n     * @throws Exception\n     */\n    @Test\n    public void uploadByPathWithNoSpacesAndFolderWithSpaces() throws Exception {\n\n        //test the upload of a file name with blank spaces into a given folder.\n        String targetPathWithSpaces = TEST_ROOT_PATH_WITH_SPACES.replaceAll(\"\\\\s\", \"%20\") + \"/\" + \"FileNameWithNoSpaces.someextension\";\n        String fileContent = \"the local file content\";\n        doUploadTestByPath(targetPathWithSpaces,\n                           fileContent,\n                           false,\n                           false);\n    }\n\n    private void doUploadTestByNameAndFolder(String targetFileName,\n                                             String targetFolderName,\n                                             String fileContent) throws Exception {\n\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n\n        String localFileName = \"local_file_name.txt\"; //not relevant for the test\n\n        //mock the servlet parameters\n        when(request.getParameter(PARAM_FOLDER)).thenReturn(targetFolderName);\n        when(request.getParameter(PARAM_FILENAME)).thenReturn(targetFileName);\n\n        //mock the servlet multipart request\n        //local file name, and local file name content are not relevant\n        String requestContent = mockMultipartRequestContent(localFileName,\n                                                            fileContent);\n        ByteArrayInputStream inputStream = new ByteArrayInputStream(requestContent.getBytes());\n        MockServletInputStream servletInputStream = new MockServletInputStream(inputStream);\n\n        when(request.getContentLength()).thenReturn(requestContent.getBytes().length);\n        when(request.getContentType()).thenReturn(CONTENT_TYPE);\n        when(request.getInputStream()).thenReturn(servletInputStream);\n\n        //mock the servlet response writer\n        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n        PrintWriter printWriter = new PrintWriter(outputStream);\n        when(response.getWriter()).thenReturn(printWriter);\n\n        //FileUploadServlet uploadServlet = new FileUploadServlet();\n        uploadServlet.doPost(request,\n                             response);\n\n        verify(request,\n               times(1)).getParameter(PARAM_PATH);\n        verify(request,\n               times(2)).getParameter(PARAM_FOLDER);\n        verify(request,\n               times(1)).getParameter(PARAM_FILENAME);\n\n        //Expected URI\n        URI expectedURI = new URI(targetFolderName.replaceAll(\"\\\\s\", \"%20\") + \"/\" + FileServletUtil.encodeFileName(targetFileName));\n\n        verify(ioService,\n               times(2)).startBatch(eq(fileSystem));\n        verify(ioService,\n               times(1)).get(eq(expectedURI));\n        verify(ioService,\n               times(1)).write(any(Path.class),\n                               eq(fileContent.getBytes()));\n        verify(ioService,\n               times(2)).endBatch();\n\n        printWriter.flush();\n        assertEquals(\"OK\",\n                     new String(outputStream.toByteArray()));\n    }\n\n    private void doUploadTestByPath(String targetPath,\n                                    String fileContent,\n                                    boolean fileExists,\n                                    boolean isUpdate) throws Exception {\n\n        HttpServletRequest request = mock(HttpServletRequest.class);\n        HttpServletResponse response = mock(HttpServletResponse.class);\n\n        String localFileName = \"local_file_name.txt\"; //not relevant for the test\n\n        //mock the servlet parameters\n        when(request.getParameter(PARAM_PATH)).thenReturn(targetPath);\n        when(request.getParameter(PARAM_UPDATE)).thenReturn(String.valueOf(isUpdate));\n        \n        when(ioService.exists(any(Path.class))).thenReturn(fileExists);\n\n        //mock the servlet multipart request\n        //local file name, and local file name content are not relevant\n        String requestContent = mockMultipartRequestContent(localFileName,\n                                                            fileContent);\n        ByteArrayInputStream inputStream = new ByteArrayInputStream(requestContent.getBytes());\n        MockServletInputStream servletInputStream = new MockServletInputStream(inputStream);\n\n        when(request.getContentLength()).thenReturn(requestContent.getBytes().length);\n        when(request.getContentType()).thenReturn(CONTENT_TYPE);\n        when(request.getInputStream()).thenReturn(servletInputStream);\n\n        //mock the servlet response writer\n        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n        PrintWriter printWriter = new PrintWriter(outputStream);\n        when(response.getWriter()).thenReturn(printWriter);\n\n        uploadServlet.doPost(request,\n                             response);\n\n        verify(request,\n               times(2)).getParameter(PARAM_PATH);\n        verify(request, times(1)).getParameter(PARAM_UPDATE);\n    \n        //Expected URI\n        URI expectedURI = new URI(FileServletUtil.encodeFileNamePart(targetPath));\n        verify(ioService,\n               times(1)).get(eq(expectedURI));\n    \n        if(fileExists && !isUpdate) {\n            verify(ioService,\n                   times(1)).startBatch(eq(fileSystem));\n            verify(ioService, times(1)).exists(any(Path.class));\n            verify(ioService,\n                   times(1)).endBatch();\n    \n            printWriter.flush();\n            assertEquals(\"CONFLICT\",\n                         new String(outputStream.toByteArray()));\n        } else {\n            verify(ioService,\n                   times(2)).startBatch(eq(fileSystem));\n            \n            verify(ioService,\n                   times(1)).write(any(Path.class),\n                                   eq(fileContent.getBytes()));\n            verify(ioService,\n                   times(2)).endBatch();\n        \n            printWriter.flush();\n            assertEquals(\"OK\",\n                         new String(outputStream.toByteArray()));\n        }\n    }\n\n    private String mockMultipartRequestContent(String localFileName,\n                                               String fileContent) {\n        String content = BOUNDARY_DELIMITER + BOUNDARY + BREAK +\n                \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"\" + localFileName + \"\\\"\" + BREAK +\n                \"Content-Type: text/plain\" + BREAK + BREAK +\n\n                fileContent + BREAK +\n                BOUNDARY_DELIMITER + BOUNDARY + BOUNDARY_DELIMITER + BREAK;\n        return content;\n    }\n\n    private class MockServletInputStream extends ServletInputStream {\n\n        InputStream content;\n\n        public MockServletInputStream(InputStream content) {\n            this.content = content;\n        }\n\n        @Override\n        public int read() throws IOException {\n            return content.read();\n        }\n\n        @Override\n        public int read(byte[] b) throws IOException {\n            return content.read(b);\n        }\n\n        @Override\n        public int read(byte[] b,\n                        int off,\n                        int len) throws IOException {\n            return content.read(b,\n                                off,\n                                len);\n        }\n\n        @Override\n        public long skip(long n) throws IOException {\n            return content.skip(n);\n        }\n\n        @Override\n        public int available() throws IOException {\n            return content.available();\n        }\n\n        @Override\n        public void close() throws IOException {\n            content.close();\n        }\n\n        @Override\n        public synchronized void mark(int readlimit) {\n            content.mark(readlimit);\n        }\n\n        @Override\n        public synchronized void reset() throws IOException {\n            content.reset();\n        }\n\n        @Override\n        public boolean markSupported() {\n            return content.markSupported();\n        }\n\n        @Override\n        public boolean isFinished() {\n            try {\n                return content.available() <= 0;\n            } catch (IOException e) {\n                throw new RuntimeException(e);\n            }\n        }\n\n        @Override\n        public boolean isReady() {\n            return true;\n        }\n\n        @Override\n        public void setReadListener(ReadListener readListener) {\n            // TODO how to treat the listener?\n        }\n    }\n}"
  },
  {
    "path": "uberfire-server/src/test/java/org/uberfire/server/UberFireGeneralFactoryTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.jboss.errai.bus.client.api.QueueSession;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.server.cdi.UberFireGeneralFactory;\n\nimport static org.assertj.core.api.Assertions.assertThatThrownBy;\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class UberFireGeneralFactoryTest {\n\n    @Mock\n    private Instance<User> userInstance;\n\n    @Mock\n    private AuthenticationService authService;\n\n    @Mock\n    private Message threadMessage;\n\n    @Mock\n    private QueueSession threadQueueSession;\n\n    private User sessionUser = new UserImpl(\"session\");\n\n    private User defaultUser = new UserImpl(\"default\");\n\n    @InjectMocks\n    private UberFireGeneralFactory factory;\n\n    @Before\n    public void setup() {\n        when(threadMessage.getResource(QueueSession.class,\n                                       \"Session\")).thenReturn(threadQueueSession);\n        when(threadQueueSession.getSessionId()).thenReturn(sessionUser.getIdentifier());\n        RpcContext.set(null);\n    }\n\n    @Test\n    public void returnDefaultUserOutsideOfSessionThread() {\n        when(userInstance.isAmbiguous()).thenReturn(false);\n        when(userInstance.isUnsatisfied()).thenReturn(false);\n        when(userInstance.get()).thenReturn(defaultUser);\n\n        SessionInfo sessionInfo = factory.getSessionInfo(authService);\n        assertSame(defaultUser,\n                   sessionInfo.getIdentity());\n    }\n\n    @Test\n    public void returnAuthenticatedUserInSessionThread() {\n        reset(authService);\n        when(authService.getUser()).thenReturn(sessionUser);\n        RpcContext.set(threadMessage);\n\n        SessionInfo sessionInfo = factory.getSessionInfo(authService);\n        assertSame(sessionUser,\n                   sessionInfo.getIdentity());\n    }\n\n    @Test\n    public void throwIllegalStateExceptionOutsideOfSessionThreadWithoutDefaultUser() {\n        when(userInstance.isAmbiguous()).thenReturn(false);\n        when(userInstance.isUnsatisfied()).thenReturn(true);\n\n        assertThatThrownBy(() -> factory.getSessionInfo(authService))\n                .isInstanceOf(IllegalStateException.class)\n                .hasMessage(\"Cannot get session info outside of servlet thread when no default user is provided.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/test/java/org/uberfire/server/UploadUriProviderTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server;\n\nimport java.net.URI;\nimport java.net.URISyntaxException;\n\nimport javax.servlet.http.HttpServletRequest;\n\nimport org.apache.commons.fileupload.FileUploadException;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\n\npublic class UploadUriProviderTest {\n\n    private static final String PARAM_PATH = \"path\";\n    private static final String PARAM_FOLDER = \"folder\";\n    private static final String PARAM_FILENAME = \"fileName\";\n\n    @Test(expected = FileUploadException.class)\n    public void requestEmpty() throws URISyntaxException, FileUploadException {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n\n        UploadUriProvider.getTargetLocation(request);\n    }\n\n    @Test\n    public void paramIsNotEncoded() throws URISyntaxException, FileUploadException {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n        doReturn(\"project/hello & goodbye.txt\").when(request).getParameter(PARAM_PATH);\n\n        final URI uri = UploadUriProvider.getTargetLocation(request);\n        assertEquals(\"project/hello+%26+goodbye.txt\", uri.toString());\n    }\n\n    @Test\n    public void paramIsEncoded() throws URISyntaxException, FileUploadException {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n        doReturn(\"project/hello+%26+goodbye.txt\").when(request).getParameter(PARAM_PATH);\n\n        final URI uri = UploadUriProvider.getTargetLocation(request);\n        assertEquals(\"project/hello+%26+goodbye.txt\", uri.toString());\n    }\n\n    @Test\n    public void fileNameIsNotEncoded() throws URISyntaxException, FileUploadException {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n        doReturn(\"otherProject\").when(request).getParameter(PARAM_FOLDER);\n        doReturn(\"blaa & blaa.txt\").when(request).getParameter(PARAM_FILENAME);\n\n        final URI uri = UploadUriProvider.getTargetLocation(request);\n        assertEquals(\"otherProject/blaa+%26+blaa.txt\", uri.toString());\n    }\n\n    @Test\n    public void fileNameIsEncoded() throws URISyntaxException, FileUploadException {\n        final HttpServletRequest request = mock(HttpServletRequest.class);\n        doReturn(\"otherProject/subfolder\").when(request).getParameter(PARAM_FOLDER);\n        doReturn(\"do+%26+it.txt\").when(request).getParameter(PARAM_FILENAME);\n\n        final URI uri = UploadUriProvider.getTargetLocation(request);\n        assertEquals(\"otherProject/subfolder/do+%26+it.txt\", uri.toString());\n    }\n}"
  },
  {
    "path": "uberfire-server/src/test/java/org/uberfire/server/locale/GWTLocaleHeaderFilterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.server.locale;\n\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\nimport java.io.Writer;\nimport java.util.Locale;\nimport java.util.Scanner;\nimport javax.servlet.FilterChain;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class GWTLocaleHeaderFilterTest {\n\n    @Test\n    public void testLocaleDefault() throws IOException, ServletException {\n        final GWTLocaleHeaderFilter localeHeaderFilter = getFilter();\n\n        final Writer sw = new StringWriter();\n\n        final HttpServletRequest req = mock(HttpServletRequest.class);\n        final HttpServletResponse resp = mock(HttpServletResponse.class);\n        final FilterChain chain = mock(FilterChain.class);\n\n        when(req.getLocale()).thenReturn(Locale.US);\n\n        when(resp.getWriter()).thenReturn(new PrintWriter(sw));\n\n        localeHeaderFilter.doFilter(req,\n                                    resp,\n                                    chain);\n\n        assertEquals(new Scanner(getClass().getResourceAsStream(\"/expected-sample.html\"),\n                                 \"UTF-8\").useDelimiter(\"\\\\A\").next(),\n                     sw.toString());\n    }\n\n    @Test\n    public void testLocaleWithLanguageParameter() throws IOException, ServletException {\n        final GWTLocaleHeaderFilter localeHeaderFilter = getFilter();\n\n        final Writer sw = new StringWriter();\n\n        final HttpServletRequest req = mock(HttpServletRequest.class);\n        final HttpServletResponse resp = mock(HttpServletResponse.class);\n        final FilterChain chain = mock(FilterChain.class);\n\n        when(req.getParameter(\"locale\")).thenReturn(\"ja\");\n\n        when(resp.getWriter()).thenReturn(new PrintWriter(sw));\n\n        localeHeaderFilter.doFilter(req,\n                                    resp,\n                                    chain);\n\n        assertEquals(new Scanner(getClass().getResourceAsStream(\"/expected-2-sample.html\"),\n                                 \"UTF-8\").useDelimiter(\"\\\\A\").next(),\n                     sw.toString());\n    }\n\n    @Test\n    public void testLocaleWithLanguageAndCountryParameter() throws IOException, ServletException {\n        final GWTLocaleHeaderFilter localeHeaderFilter = getFilter();\n\n        final Writer sw = new StringWriter();\n\n        final HttpServletRequest req = mock(HttpServletRequest.class);\n        final HttpServletResponse resp = mock(HttpServletResponse.class);\n        final FilterChain chain = mock(FilterChain.class);\n\n        when(req.getParameter(\"locale\")).thenReturn(\"ja_JP\");\n\n        when(resp.getWriter()).thenReturn(new PrintWriter(sw));\n\n        localeHeaderFilter.doFilter(req,\n                                    resp,\n                                    chain);\n\n        assertEquals(new Scanner(getClass().getResourceAsStream(\"/expected-3-sample.html\"),\n                                 \"UTF-8\").useDelimiter(\"\\\\A\").next(),\n                     sw.toString());\n    }\n\n    @Test\n    public void testNonExistentLocaleParameter() throws IOException, ServletException {\n        final GWTLocaleHeaderFilter localeHeaderFilter = getFilter();\n\n        final Writer sw = new StringWriter();\n\n        final HttpServletRequest req = mock(HttpServletRequest.class);\n        final HttpServletResponse resp = mock(HttpServletResponse.class);\n        final FilterChain chain = mock(FilterChain.class);\n\n        when(req.getParameter(\"locale\")).thenReturn(\"xxx_xxx\");\n        when(req.getLocale()).thenReturn(Locale.US);\n\n        when(resp.getWriter()).thenReturn(new PrintWriter(sw));\n\n        localeHeaderFilter.doFilter(req,\n                                    resp,\n                                    chain);\n\n        assertEquals(new Scanner(getClass().getResourceAsStream(\"/expected-4-sample.html\"),\n                                 \"UTF-8\").useDelimiter(\"\\\\A\").next(),\n                     sw.toString());\n    }\n\n    private GWTLocaleHeaderFilter getFilter() {\n        return new GWTLocaleHeaderFilter() {\n            protected CharResponseWrapper getWrapper(final HttpServletResponse response) {\n                final CharResponseWrapper wrapper = new CharResponseWrapper(response);\n                final String text = new Scanner(getClass().getResourceAsStream(\"/sample.html\"),\n                                                \"UTF-8\").useDelimiter(\"\\\\A\").next();\n                try {\n                    wrapper.getOutputStream().write(text.getBytes());\n                } catch (final IOException ignored) {\n                }\n                return wrapper;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-server/src/test/resources/expected-2-sample.html",
    "content": "<!doctype html><!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<html>\n <head>\n  <meta name=\"gwt:property\" content=\"locale=ja\">\n </head>\n <body>\n </body>\n</html>"
  },
  {
    "path": "uberfire-server/src/test/resources/expected-3-sample.html",
    "content": "<!doctype html><!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<html>\n <head>\n  <meta name=\"gwt:property\" content=\"locale=ja_JP\">\n </head>\n <body>\n </body>\n</html>"
  },
  {
    "path": "uberfire-server/src/test/resources/expected-4-sample.html",
    "content": "<!doctype html><!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<html>\n <head>\n  <meta name=\"gwt:property\" content=\"locale=en_US\">\n </head>\n <body>\n </body>\n</html>"
  },
  {
    "path": "uberfire-server/src/test/resources/expected-sample.html",
    "content": "<!doctype html><!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<html>\n <head>\n  <meta name=\"gwt:property\" content=\"locale=en_US\">\n </head>\n <body>\n </body>\n</html>"
  },
  {
    "path": "uberfire-server/src/test/resources/sample.html",
    "content": "<!doctype html>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<html>\n<head>\n</head>\n<body>\n</body>\n</html>\n"
  },
  {
    "path": "uberfire-services/.gitignore",
    "content": "/target\n/local\n/repositories\n/derby.log\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.guvnor\n\n"
  },
  {
    "path": "uberfire-services/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-services</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Services</name>\n  <description>UberFire - Services</description>\n\n  <modules>\n    <module>uberfire-services-api</module>\n    <module>uberfire-services-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/.gitignore",
    "content": "/target\n/classes\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-services</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-services-api</artifactId>\n\n  <name>UberFire - Services API</name>\n  <description>UberFire - Services API</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-config</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/cache/Cache.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.cache;\n\n/**\n * Define operations of a cache\n */\npublic interface Cache<K, V> {\n\n    /**\n     * Retrieve the cache entry for the specified key.\n     * @param key The cache entry key\n     * @return V The cache entry\n     */\n    V getEntry(final K key);\n\n    /**\n     * Set the cache entry for the specified path.\n     * @param key The cache entry key\n     * @param value The cache entry\n     */\n    void setEntry(final K key,\n                  final V value);\n\n    /**\n     * Invalidate the entire cache\n     */\n    void invalidateCache();\n\n    /**\n     * Invalidate the cache for a specific key.\n     * @param key The cache entry key\n     */\n    void invalidateCache(final K key);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/cache/LRUCache.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.cache;\n\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * A simple LRU cache keyed on Paths\n */\npublic abstract class LRUCache<Path, V> implements Cache<Path, V> {\n\n    private static final int MAX_ENTRIES = 20;\n\n    private Map<Path, V> cache;\n\n    public LRUCache() {\n        setCache(MAX_ENTRIES);\n    }\n\n    public LRUCache(final int maxEntries) {\n        setCache(maxEntries);\n    }\n\n    @Override\n    public V getEntry(final Path path) {\n        PortablePreconditions.checkNotNull(\"path\",\n                                           path);\n        return cache.get(path);\n    }\n\n    @Override\n    public void setEntry(final Path path,\n                         final V value) {\n        PortablePreconditions.checkNotNull(\"path\",\n                                           path);\n        PortablePreconditions.checkNotNull(\"value\",\n                                           value);\n        cache.put(path,\n                  value);\n    }\n\n    @Override\n    public void invalidateCache() {\n        this.cache.clear();\n    }\n\n    @Override\n    public void invalidateCache(final Path path) {\n        PortablePreconditions.checkNotNull(\"path\",\n                                           path);\n        this.cache.remove(path);\n    }\n\n    public Set<Path> getKeys() {\n        return cache.keySet();\n    }\n\n    private void setCache(final int maxEntries) {\n        cache = new LinkedHashMap<Path, V>(maxEntries + 1,\n                                           0.75f,\n                                           true) {\n            public boolean removeEldestEntry(Map.Entry eldest) {\n                return size() > maxEntries;\n            }\n        };\n        cache = (Map) Collections.synchronizedMap(cache);\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/exceptions/ExceptionUtilities.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.exceptions;\n\nimport org.guvnor.common.services.shared.exceptions.GenericPortableException;\nimport org.jboss.errai.config.rebind.EnvUtil;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Utilities for exception handling.\n */\npublic class ExceptionUtilities {\n\n    private static final Logger logger = LoggerFactory.getLogger(ExceptionUtilities.class);\n\n    /**\n     * Helper to return a @Portable RuntimeException.\n     * @param e\n     * @return\n     */\n    public static RuntimeException handleException(final Exception e) {\n        logger.error(\"Exception thrown: \" + e.getMessage(),\n                     e);\n        if (EnvUtil.isPortableType(e.getClass())) {\n            if (e instanceof RuntimeException) {\n                return (RuntimeException) e;\n            } else {\n                return new GenericPortableException(e.getMessage(),\n                                                    e);\n            }\n        }\n        return new GenericPortableException(e.getMessage(),\n                                            e);\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/metadata/MetadataServerSideService.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.metadata.MetadataService;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.uberfire.java.nio.file.Path;\n\npublic interface MetadataServerSideService\n        extends MetadataService {\n\n    Metadata getMetadata(final Path resource);\n\n    List<String> getTags(final Path resource);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/preferences/ApplicationPreferencesLoader.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.preferences;\n\nimport java.util.Map;\n\n/**\n * A service that can load preferences from a persistent store\n */\npublic interface ApplicationPreferencesLoader {\n\n    /**\n     * Load key-value Map of preferences\n     * @return\n     */\n    public Map<String, String> load();\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/preferences/SystemPropertiesInitializer.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.preferences;\n\nimport java.util.Map;\n\n/**\n * A service that can set System Properties, if required, from preferences\n */\npublic interface SystemPropertiesInitializer {\n\n    /**\n     * Set System Properties from preferences\n     * @param preferences\n     */\n    public void setSystemProperties(final Map<String, String> preferences);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/util/CommentedOptionFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.util;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.rpc.SessionInfo;\n\npublic interface CommentedOptionFactory {\n\n    CommentedOption makeCommentedOption(final String commitMessage);\n\n    CommentedOption makeCommentedOption(final String commitMessage,\n                                        final User identity,\n                                        final SessionInfo sessionInfo);\n\n    CommentedOption makeCommentedOption(final String sessionId,\n                                        final String commitMessage);\n\n    /**\n     * @return Safe session id, even when SessionInfo does not exist\n     */\n    String getSafeSessionId();\n\n    /**\n     * @return Safe identity name, even when Identity does not exist\n     */\n    String getSafeIdentityName();\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/backend/validation/GenericValidator.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.validation;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.validation.model.ValidationMessage;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Validator capable of validating generic Kie assets (i.e those that are handled by KieBuilder)\n */\npublic interface GenericValidator {\n\n    /**\n     * Validate an asset. Validation needs to know the Project in which the resource resides to be able\n     * to determine classes within the project's dependencies. The resourcePath is used to determine the\n     * containing project. The resourcePath is also used to determine the destination Path in Kie VFS.\n     * @param resourcePath The VFS Path of the resource\n     * @param content An String containing the resource to be validated.\n     * @return Validation messages or an empty Collection if none.\n     */\n    List<ValidationMessage> validate(final Path resourcePath,\n                                     final String content);\n\n    /**\n     * Validate an asset. Validation needs to know the Project in which the resource resides to be able\n     * to determine classes within the project's dependencies. The resourcePath is used to determine the\n     * containing project. The resourcePath is also used to determine the destination Path in Kie VFS.\n     * The content of the resource is loaded from the provided Path - which is required when validating\n     * assets for which there is no transient in-memory representation; e.g. XLS decision tables.\n     * @param resourcePath The VFS Path of the resource\n     * @return Validation messages or an empty Collection if none.\n     */\n    List<ValidationMessage> validate(final Path resourcePath);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/config/AppConfigService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.config;\n\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n *\n */\n@Remote\npublic interface AppConfigService {\n\n    Map<String, String> loadPreferences();\n\n    long getTimestamp();\n}\n\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/config/ResourceConfigService.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.config;\n\nimport java.util.Map;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n *\n */\n@Remote\npublic interface ResourceConfigService {\n\n    Map<String, Object> configAttrs(final Map<String, Object> attrs);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/exceptions/GenericPortableException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.shared.exceptions;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Root of all portable Exceptions resulting from server-side errors that need to be sent to the client\n */\n@Portable\npublic class GenericPortableException extends RuntimeException {\n\n    public GenericPortableException() {\n    }\n\n    public GenericPortableException(final String message) {\n        super(message);\n    }\n\n    public GenericPortableException(final String message,\n                                    Exception e) {\n        super(message,\n              e);\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/file/SupportsUpdate.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.shared.file;\n\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.uberfire.backend.vfs.Path;\n\npublic interface SupportsUpdate<T> extends org.uberfire.ext.editor.commons.service.support.SupportsUpdate<T, Metadata> {\n\n    Path save(final Path path,\n              final T content,\n              final Metadata metadata,\n              final String comment);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/file/upload/FileManagerFields.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.file.upload;\n\n/**\n * This is a central location for all form fields use in HTML forms for submission to the file servlet.\n * The all must be unique, of course.\n */\npublic class FileManagerFields {\n\n    public static final String UPLOAD_FIELD_NAME_ATTACH = \"fileUploadElement\";\n    public static final String FORM_FIELD_PATH = \"attachmentPath\";\n    public static final String FORM_FIELD_NAME = \"fileName\";\n    public static final String FORM_FIELD_FULL_PATH = \"attachmentFullPath\";\n    public static final String FORM_FIELD_OPERATION = \"operation\";\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/file/upload/FileOperation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.shared.file.upload;\n\n/**\n * Operations that can be performed\n */\npublic enum FileOperation {\n    CREATE,\n    UPDATE\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/message/Level.java",
    "content": "package org.guvnor.common.services.shared.message;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic enum Level {\n    ERROR,\n    WARNING,\n    INFO\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/metadata/MetadataService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.metadata;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n *\n */\n@Remote\npublic interface MetadataService {\n\n    Metadata getMetadata(final Path resource);\n\n    List<String> getTags(final Path resource);\n\n    Map<String, Object> configAttrs(final Map<String, Object> attrs,\n                                    final Metadata metadata);\n\n    Map<String, Object> setUpAttributes(final Path path,\n                                        final Metadata metadata);\n\n    /**\n     * Only saves the Metadata for an asset.\n     * @param path Path to the file that the metadata belongs to\n     * @param metadata Actual metadata to be saved.\n     * @param comment Commit comment.\n     * @return\n     */\n    Path saveMetadata(final Path path,\n                      final Metadata metadata,\n                      final String comment);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/metadata/model/DiscussionRecord.java",
    "content": "/*\n * Copyright 2010 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.metadata.model;\n\nimport java.util.Date;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * This is a discussion record item.\n */\n@Portable\npublic class DiscussionRecord {\n\n    private Long timestamp = new Date().getTime();\n    private String note;\n    private String author;\n\n    public DiscussionRecord() {\n    }\n\n    public DiscussionRecord(final String author,\n                            final String note) {\n        this.author = author;\n        this.note = note;\n    }\n\n    public DiscussionRecord(final long timestamp,\n                            final String author,\n                            final String note) {\n        this.timestamp = timestamp;\n        this.author = author;\n        this.note = note;\n    }\n\n    public String getNote() {\n        return note;\n    }\n\n    public String getAuthor() {\n        return author;\n    }\n\n    public Long getTimestamp() {\n        return timestamp;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        DiscussionRecord that = (DiscussionRecord) o;\n\n        if (author != null ? !author.equals(that.author) : that.author != null) {\n            return false;\n        }\n        if (note != null ? !note.equals(that.note) : that.note != null) {\n            return false;\n        }\n        if (timestamp != null ? !timestamp.equals(that.timestamp) : that.timestamp != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = timestamp != null ? timestamp.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (note != null ? note.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (author != null ? author.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/metadata/model/Metadata.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.metadata.model;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\n/**\n *\n */\n@Portable\npublic class Metadata {\n\n    private Path path;\n    private Path realPath;\n    private LockInfo lockInfo;\n\n    //git info\n    private String checkinComment;\n    private String lastContributor;\n    private String creator;\n    //git -> basic file attrs\n    private Date lastModified;\n    private Date dateCreated;\n\n    //pure dcore\n    private String subject;\n    private String type;\n    private String externalRelation;\n    private String externalSource;\n    private String description;\n\n    //not dcore\n    private List<String> tags = new ArrayList<String>();\n    private List<DiscussionRecord> discussion = new ArrayList<DiscussionRecord>();\n    private List<VersionRecord> version = new ArrayList<VersionRecord>();\n\n    private boolean generated;\n\n    public Metadata() {\n\n    }\n\n    public Metadata(final Path path,\n                    final Path realPath,\n                    final String checkinComment,\n                    final String lastContributor,\n                    final String creator,\n                    final Date lastModified,\n                    final Date dateCreated,\n                    final String subject,\n                    final String type,\n                    final String externalRelation,\n                    final String externalSource,\n                    final String description,\n                    final List<String> tags,\n                    final List<DiscussionRecord> discussion,\n                    final List<VersionRecord> version,\n                    final LockInfo lockInfo,\n                    final boolean generated) {\n        this.path = path;\n        this.realPath = realPath;\n        this.checkinComment = checkinComment;\n        this.lastContributor = lastContributor;\n        this.creator = creator;\n        this.lastModified = lastModified;\n        this.dateCreated = dateCreated;\n        this.subject = subject;\n        this.type = type;\n        this.externalRelation = externalRelation;\n        this.externalSource = externalSource;\n        this.description = description;\n        this.tags = tags;\n        this.discussion = discussion;\n        this.version = version;\n        this.lockInfo = lockInfo;\n        this.generated = generated;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    public Path getRealPath() {\n        return realPath;\n    }\n\n    public String getCheckinComment() {\n        return checkinComment;\n    }\n\n    public String getLastContributor() {\n        return lastContributor;\n    }\n\n    public String getCreator() {\n        return creator;\n    }\n\n    public Date getLastModified() {\n        return lastModified;\n    }\n\n    public Date getDateCreated() {\n        return dateCreated;\n    }\n\n    public String getSubject() {\n        return subject;\n    }\n\n    public String getType() {\n        return type;\n    }\n\n    public String getExternalRelation() {\n        return externalRelation;\n    }\n\n    public String getExternalSource() {\n        return externalSource;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public List<String> getTags() {\n        return tags;\n    }\n\n    public List<DiscussionRecord> getDiscussion() {\n        return discussion;\n    }\n\n    public List<VersionRecord> getVersion() {\n        return version;\n    }\n\n    public LockInfo getLockInfo() {\n        return lockInfo;\n    }\n\n    public boolean isGenerated() {\n        return generated;\n    }\n\n    public void setLockInfo(LockInfo lockInfo) {\n        this.lockInfo = lockInfo;\n    }\n\n    public void setSubject(final String subject) {\n        this.subject = subject;\n    }\n\n    public void setType(final String type) {\n        this.type = type;\n    }\n\n    public void setExternalRelation(final String externalRelation) {\n        this.externalRelation = externalRelation;\n    }\n\n    public void setExternalSource(final String externalSource) {\n        this.externalSource = externalSource;\n    }\n\n    public void addDiscussion(final DiscussionRecord discussionRecord) {\n        this.discussion.add(discussionRecord);\n    }\n\n    public void eraseDiscussion() {\n        this.discussion.clear();\n    }\n\n    public void addTag(final String tag) {\n        tags.add(tag);\n    }\n\n    public void removeTag(final int idx) {\n        tags.remove(idx);\n    }\n\n    public void setDescription(final String description) {\n        this.description = description;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        Metadata metadata = (Metadata) o;\n\n        if (tags != null ? !tags.equals(metadata.tags) : metadata.tags != null) {\n            return false;\n        }\n        if (checkinComment != null ? !checkinComment.equals(metadata.checkinComment) : metadata.checkinComment != null) {\n            return false;\n        }\n        if (creator != null ? !creator.equals(metadata.creator) : metadata.creator != null) {\n            return false;\n        }\n        if (dateCreated != null ? !dateCreated.equals(metadata.dateCreated) : metadata.dateCreated != null) {\n            return false;\n        }\n        if (description != null ? !description.equals(metadata.description) : metadata.description != null) {\n            return false;\n        }\n        if (discussion != null ? !discussion.equals(metadata.discussion) : metadata.discussion != null) {\n            return false;\n        }\n        if (externalRelation != null ? !externalRelation.equals(metadata.externalRelation) : metadata.externalRelation != null) {\n            return false;\n        }\n        if (externalSource != null ? !externalSource.equals(metadata.externalSource) : metadata.externalSource != null) {\n            return false;\n        }\n        if (lastContributor != null ? !lastContributor.equals(metadata.lastContributor) : metadata.lastContributor != null) {\n            return false;\n        }\n        if (lastModified != null ? !lastModified.equals(metadata.lastModified) : metadata.lastModified != null) {\n            return false;\n        }\n        if (path != null ? !path.equals(metadata.path) : metadata.path != null) {\n            return false;\n        }\n        if (realPath != null ? !realPath.equals(metadata.realPath) : metadata.realPath != null) {\n            return false;\n        }\n        if (subject != null ? !subject.equals(metadata.subject) : metadata.subject != null) {\n            return false;\n        }\n        if (type != null ? !type.equals(metadata.type) : metadata.type != null) {\n            return false;\n        }\n        if (version != null ? !version.equals(metadata.version) : metadata.version != null) {\n            return false;\n        }\n        if (lockInfo != null ? !lockInfo.equals(metadata.lockInfo) : metadata.lockInfo != null) {\n            return false;\n        }\n        if (generated != metadata.generated) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = path != null ? path.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (realPath != null ? realPath.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (checkinComment != null ? checkinComment.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (lastContributor != null ? lastContributor.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (creator != null ? creator.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (lastModified != null ? lastModified.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (dateCreated != null ? dateCreated.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (subject != null ? subject.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (type != null ? type.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (externalRelation != null ? externalRelation.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (externalSource != null ? externalSource.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (description != null ? description.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (tags != null ? tags.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (discussion != null ? discussion.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (version != null ? version.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (generated ? 1 : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/metadata/model/Overview.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.metadata.model;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class Overview {\n\n    private Metadata metadata;\n    private String projectName;\n\n    public Metadata getMetadata() {\n        return metadata;\n    }\n\n    public String getProjectName() {\n        return projectName;\n    }\n\n    public void setProjectName(String projectName) {\n        this.projectName = projectName;\n    }\n\n    public void setMetadata(Metadata metadata) {\n        this.metadata = metadata;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        Overview overview = (Overview) o;\n\n        if (metadata != null ? !metadata.equals(overview.metadata) : overview.metadata != null) {\n            return false;\n        }\n        if (projectName != null ? !projectName.equals(overview.projectName) : overview.projectName != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = metadata != null ? metadata.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (projectName != null ? projectName.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/preferences/DefaultWorkbenchPreferenceScopeResolutionStrategies.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.preferences;\n\nimport org.uberfire.annotations.FallbackImplementation;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n@FallbackImplementation\npublic class DefaultWorkbenchPreferenceScopeResolutionStrategies implements WorkbenchPreferenceScopeResolutionStrategies {\n\n    private PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy;\n\n    public DefaultWorkbenchPreferenceScopeResolutionStrategies() {\n    }\n\n    public DefaultWorkbenchPreferenceScopeResolutionStrategies(final PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy) {\n        this.preferenceScopeResolutionStrategy = preferenceScopeResolutionStrategy;\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo getUserInfoFor(final String scopeType,\n                                                                final String scopeKey) {\n        return preferenceScopeResolutionStrategy.getInfo();\n    }\n\n    @Override\n    public PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(final String scopeKey) {\n        return preferenceScopeResolutionStrategy.getInfo();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/preferences/GuvnorPreferenceScopes.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.preferences;\n\npublic class GuvnorPreferenceScopes {\n\n    public static final String USER = \"user\";\n    public static final String PROJECT = \"project\";\n    public static final String SPACE = \"space\";\n    public static final String GLOBAL = \"global\";\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/preferences/WorkbenchPreferenceScopeResolutionStrategies.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.preferences;\n\nimport org.uberfire.preferences.shared.impl.PreferenceScopeResolutionStrategyInfo;\n\n/**\n * Service used to obtain information regarding the workbench preference scopes resolution strategies.\n */\npublic interface WorkbenchPreferenceScopeResolutionStrategies {\n\n    /**\n     * Returns a scope resolution strategy with the scopes (in that order): scope (parameter) by user, user and global.\n     * @param scopeType The first scope type in the resolution order (e.g. project).\n     * @param scopeKey The first scope key in the resolution order (e.g. my-project-name).\n     * @return The scope resolution strategy info based on the passed parameters.\n     */\n    PreferenceScopeResolutionStrategyInfo getUserInfoFor(String scopeType,\n                                                         String scopeKey);\n\n    PreferenceScopeResolutionStrategyInfo getSpaceInfoFor(String scopeKey);\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/security/AppRoles.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.security;\n\npublic enum AppRoles {\n\n    /**\n     * Admin can do everything\n     */\n    ADMIN,\n\n    /**\n     * Can edit repositories\n     */\n    REPOSITORY_EDITOR,\n\n    /**\n     * Can view repositories, but not do changes.\n     */\n    REPOSITORY_VIEWER;\n\n    public String getName() {\n        return toString().toLowerCase();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/test/Failure.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.test;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class Failure {\n\n    private String message;\n    private Path path;\n    private String displayName;\n\n    public Failure() {\n\n    }\n\n    public Failure(String displayName,\n                   String message) {\n        this(displayName,\n             message,\n             null);\n    }\n\n    public Failure(String displayName,\n                   String message,\n                   Path path) {\n        this.displayName = displayName;\n        this.message = message;\n        this.path = path;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public String getDisplayName() {\n        return displayName;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    @Override\n    public String toString() {\n        return \"Failure{\" +\n                \"message='\" + message + '\\'' +\n                \", displayName='\" + displayName + '\\'' +\n                \", path='\" + path + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/test/TestResultMessage.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.shared.test;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class TestResultMessage {\n\n    private String identifier;\n    private int runCount;\n    private Long runTime;\n    private List<Failure> failures = new ArrayList<Failure>();\n\n    public TestResultMessage() {\n    }\n\n    public TestResultMessage(String identifier,\n                             int runCount,\n                             long runTime,\n                             List<Failure> failures) {\n        this.identifier = identifier;\n        this.runCount = runCount;\n        this.runTime = runTime;\n        this.failures = failures;\n    }\n\n    public boolean wasSuccessful() {\n        return failures.isEmpty();\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    public int getRunCount() {\n        return runCount;\n    }\n\n    public long getRunTime() {\n        return runTime;\n    }\n\n    public List<Failure> getFailures() {\n        return failures;\n    }\n\n    public List<String> getResultStrings() {\n        List<String> result = new ArrayList<String>(3 + (failures == null ? 0 : failures.size()));\n        result.add(\"RunCount: \" + this.runCount);\n        if (this.failures != null) {\n            for (Failure failure : this.failures) {\n                result.add(\"Failure: \" + failure.getMessage());\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"TestResultMessage{\" +\n                \"identifier=\" + identifier +\n                \", runCount=\" + runCount +\n                \", failures=\" + failures +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/test/TestRunnerService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.shared.test;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\n\n@Remote\npublic interface TestRunnerService {\n\n    void runAllTests(final String identifier,\n                     final Path path);\n\n    void runAllTests(final String identifier,\n                     final Path path,\n                     final Event<TestResultMessage> customTestResultEvent);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/test/TestService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.test;\n\nimport java.util.List;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Service definition for running JUnit tests\n */\npublic interface TestService {\n\n    List<TestResultMessage> runAllTests(final String identifier,\n                                        final Path path);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/validation/ValidationService.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.validation;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.validation.model.ValidationMessage;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Validation Service\n */\npublic interface ValidationService<T> {\n\n    /**\n     * Validate the content\n     * @param content\n     * @return\n     */\n    List<ValidationMessage> validate(final Path path,\n                                     final T content);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/java/org/guvnor/common/services/shared/validation/model/ValidationMessage.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.validation.model;\n\nimport org.guvnor.common.services.shared.message.Level;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class ValidationMessage {\n\n    private long id;\n    private Level level;\n    private Path path;\n    private int line;\n    private int column;\n    private String text;\n\n    public ValidationMessage() {\n    }\n\n    public ValidationMessage(final long id,\n                             final Level level,\n                             final Path path,\n                             final int line,\n                             final int column,\n                             final String text) {\n        this.id = id;\n        this.level = level;\n        this.path = path;\n        this.line = line;\n        this.column = column;\n        this.text = text;\n    }\n\n    public ValidationMessage(final long id,\n                             final Level level,\n                             final int line,\n                             final int column,\n                             final String text) {\n        this.id = id;\n        this.level = level;\n        this.line = line;\n        this.column = column;\n        this.text = text;\n    }\n\n    public ValidationMessage(final Level level,\n                             final String text) {\n        this.level = level;\n        this.text = text;\n    }\n\n    public ValidationMessage(ValidationMessage other) {\n        this.id = other.getId();\n        this.level = other.getLevel();\n        this.path = other.getPath();\n        this.line = other.getLine();\n        this.column = other.getColumn();\n        this.text = other.getText();\n    }\n\n    public void setId(long id) {\n        this.id = id;\n    }\n\n    public void setLevel(final Level level) {\n        this.level = level;\n    }\n\n    public void setPath(final Path path) {\n        this.path = path;\n    }\n\n    public void setLine(final int line) {\n        this.line = line;\n    }\n\n    public void setColumn(final int column) {\n        this.column = column;\n    }\n\n    public void setText(final String text) {\n        this.text = text;\n    }\n\n    public long getId() {\n        return id;\n    }\n\n    public Level getLevel() {\n        return level;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    public int getLine() {\n        return line;\n    }\n\n    public int getColumn() {\n        return column;\n    }\n\n    public String getText() {\n        return text;\n    }\n\n    /**\n     * Check whether two Messages are equivalent. Property \"id\" is not used in the comparison as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof ValidationMessage)) {\n            return false;\n        }\n\n        ValidationMessage that = (ValidationMessage) o;\n\n        if (column != that.column) {\n            return false;\n        }\n        if (line != that.line) {\n            return false;\n        }\n        if (level != that.level) {\n            return false;\n        }\n        if (path != null ? !path.equals(that.path) : that.path != null) {\n            return false;\n        }\n        if (text != null ? !text.equals(that.text) : that.text != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    /**\n     * HashCode implementation fo Messages. Property \"id\" is not used in the generation as\n     * it is inconsistent for identical error messages generated in a different sequence during\n     * validation by the underlying KieBuilder.\n     */\n    @Override\n    public int hashCode() {\n        int result = level != null ? level.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (path != null ? path.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + line;\n        result = ~~result;\n        result = 31 * result + column;\n        result = ~~result;\n        result = 31 * result + (text != null ? text.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/main/resources/org/guvnor/common/services/GuvnorServicesAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.security.UberfireSecurityAPI\"/>\n  <inherits name='org.uberfire.UberfireBackend'/>\n  <inherits name='org.uberfire.ext.editor.commons.UberfireCommonsEditorAPI'/>\n\n  <source path='shared'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/test/java/org/guvnor/common/services/shared/metadata/model/MetadataTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.metadata.model;\n\nimport java.util.Calendar;\nimport java.util.Collections;\nimport java.util.Date;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MetadataTest {\n\n    @Mock\n    private Path path;\n\n    private Date date = Calendar.getInstance().getTime();\n\n    private Metadata metadata;\n\n    @Test\n    public void checkLockInfoDoesNotAffectHashCode() {\n        this.metadata = new Metadata(path,\n                                     path,\n                                     \"checkinComment\",\n                                     \"lastContributor\",\n                                     \"creator\",\n                                     date,\n                                     date,\n                                     \"subject\",\n                                     \"type\",\n                                     \"externalRelation\",\n                                     \"externalSource\",\n                                     \"description\",\n                                     Collections.emptyList(),\n                                     Collections.emptyList(),\n                                     Collections.emptyList(),\n                                     new LockInfo(false,\n                                                  \"\",\n                                                  path),\n                                     false);\n\n        final int originalHashCode = metadata.hashCode();\n        metadata.setLockInfo(new LockInfo(true,\n                                          \"admin\",\n                                          path));\n\n        assertEquals(originalHashCode,\n                     metadata.hashCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-api/src/test/java/org/guvnor/common/services/shared/preferences/DefaultWorkbenchPreferenceScopeResolutionStrategiesTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.shared.preferences;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultWorkbenchPreferenceScopeResolutionStrategiesTest {\n\n    private DefaultWorkbenchPreferenceScopeResolutionStrategies strategies;\n\n    @Mock\n    private PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy;\n\n    @Before\n    public void setup() {\n        strategies = spy(new DefaultWorkbenchPreferenceScopeResolutionStrategies(preferenceScopeResolutionStrategy));\n    }\n\n    @Test\n    public void getUserInfoForTest() {\n        strategies.getUserInfoFor(anyString(),\n                                  anyString());\n\n        verify(preferenceScopeResolutionStrategy).getInfo();\n    }\n\n    @Test\n    public void getSpaceInfoForTest() {\n        strategies.getSpaceInfoFor(anyString());\n\n        verify(preferenceScopeResolutionStrategy).getInfo();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/.gitignore",
    "content": "/target\n/classes\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-services</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-services-backend</artifactId>\n\n  <name>UberFire - Services Backend</name>\n  <description>UberFire - Services Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-lang3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <!-- The version of commons-io in droolsjbpm-build-bootstrap pom is way too old-->\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-fileupload</groupId>\n      <artifactId>commons-fileupload</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-api-mockito2</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.powermock</groupId>\n      <artifactId>powermock-module-junit4</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/archive/ArchiveServlet.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.archive;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport javax.inject.Inject;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport org.guvnor.common.services.shared.file.upload.FileManagerFields;\nimport org.uberfire.server.BaseFilteredServlet;\n\npublic class ArchiveServlet\n        extends BaseFilteredServlet {\n\n    @Inject\n    private Archiver archiver;\n\n    protected void doGet(final HttpServletRequest request,\n                         final HttpServletResponse response) throws ServletException, IOException {\n        final String uri = request.getParameter(FileManagerFields.FORM_FIELD_PATH);\n\n        try {\n            if (uri != null) {\n\n                if (!validateAccess(new URI(uri),\n                                    response)) {\n                    return;\n                }\n\n                // Try to extract a meaningful name for the zip-file from the URI.\n                int index = uri.lastIndexOf(\"@\") + 1;\n                if (index < 0) {\n                    index = 0;\n                }\n                String downLoadFileName = uri.substring(index);\n                if (downLoadFileName.startsWith(\"/\")) {\n                    downLoadFileName = downLoadFileName.substring(1);\n                }\n                if (downLoadFileName.endsWith(\"/\")) {\n                    downLoadFileName = downLoadFileName.substring(0,\n                                                                  downLoadFileName.length() - 1);\n                }\n                downLoadFileName = downLoadFileName.replaceAll(\"/\",\n                                                               \"_\");\n\n                final ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\n                archiver.archive(outputStream,\n                                 uri);\n\n                response.setContentType(\"application/zip\");\n                response.setHeader(\"Content-Disposition\",\n                                   \"attachment; filename=\" + downLoadFileName + \".zip\");\n\n                response.setContentLength(outputStream.size());\n                response.getOutputStream().write(outputStream.toByteArray());\n                response.getOutputStream().flush();\n            } else {\n                response.sendError(HttpServletResponse.SC_BAD_REQUEST);\n            }\n        } catch (URISyntaxException e) {\n            response.sendError(HttpServletResponse.SC_BAD_REQUEST);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/archive/Archiver.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.archive;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.net.URISyntaxException;\nimport java.util.zip.ZipEntry;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\npublic class Archiver {\n\n    private Path originalPath;\n\n    private ZipWriter zipWriter;\n\n    private IOService ioService;\n\n    public Archiver() {\n    }\n\n    @Inject\n    public Archiver(@Named(\"ioStrategy\") IOService ioService) {\n        this.ioService = ioService;\n    }\n\n    public void archive(final ByteArrayOutputStream outputStream,\n                        final String uri) throws IOException, URISyntaxException {\n\n        init(outputStream,\n             uri);\n        zip();\n    }\n\n    private void zip() throws IOException {\n        if (Files.isDirectory(originalPath)) {\n            addPath(Files.newDirectoryStream(originalPath));\n        } else {\n            addFile(originalPath);\n        }\n        zipWriter.close();\n    }\n\n    private void init(final ByteArrayOutputStream outputStream,\n                      final String uri) throws URISyntaxException {\n        this.originalPath = ioService.get(new URI(uri));\n        this.zipWriter = new ZipWriter(outputStream);\n    }\n\n    private void addPath(DirectoryStream<Path> directoryStream) throws IOException {\n        for (Path subPath : directoryStream) {\n            if (Files.isDirectory(subPath)) {\n                addPath(Files.newDirectoryStream(subPath));\n            } else {\n                addFile(subPath);\n            }\n        }\n    }\n\n    private void addFile(final Path subPath) throws IOException {\n        zipWriter.addFile(getZipEntry(subPath),\n                          ioService.newInputStream(subPath));\n    }\n\n    private ZipEntry getZipEntry(final Path subPath) {\n        return new ZipEntry(FileNameResolver.resolve(subPath.toUri().getPath(),\n                                                     originalPath.toUri().getPath()));\n    }\n\n    static class FileNameResolver {\n\n        static protected String resolve(final String subPath,\n                                        final String originalPath) {\n\n            final String fileName = resolveOriginalFileName(subPath,\n                                                            originalPath);\n\n            if (fileName.startsWith(\"/\")) {\n                return \"project\" + fileName;\n            } else {\n                return fileName;\n            }\n        }\n\n        static private String resolveOriginalFileName(final String subPath,\n                                                      final String originalPath) {\n            if (\"/\".equals(originalPath)) {\n                return subPath.substring(originalPath.length());\n            } else {\n                String fileSubPath = subPath.substring(originalPath.length());\n                if (fileSubPath.charAt(0) == '/') {\n                    fileSubPath = fileSubPath.substring(1);\n                }\n\n                return getBaseFolder(originalPath) + fileSubPath;\n            }\n        }\n\n        private static String getBaseFolder(final String originalPath) {\n            if (originalPath.contains(\"/\")) {\n                return originalPath.substring(originalPath.lastIndexOf(\"/\") + 1) + \"/\";\n            } else {\n                return originalPath + \"/\";\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/archive/ZipWriter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.archive;\n\nimport java.io.BufferedInputStream;\nimport java.io.BufferedOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipOutputStream;\n\npublic class ZipWriter {\n\n    private ZipOutputStream outputStream;\n\n    public ZipWriter(final OutputStream outputStream) {\n        this.outputStream = new ZipOutputStream(new BufferedOutputStream(outputStream));\n    }\n\n    public void addFile(final ZipEntry zipEntry,\n                        final InputStream inputStream) throws IOException {\n        final int BUFFER = 2048;\n        byte data[] = new byte[BUFFER];\n\n        BufferedInputStream origin = new BufferedInputStream(inputStream,\n                                                             BUFFER);\n\n        outputStream.putNextEntry(zipEntry);\n        int count;\n        while ((count = origin.read(data,\n                                    0,\n                                    BUFFER)) != -1) {\n            outputStream.write(data,\n                               0,\n                               count);\n        }\n\n        outputStream.flush();\n        origin.close();\n    }\n\n    public void close() throws IOException {\n        outputStream.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/AppConfigServiceImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config;\n\nimport java.util.Date;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.preferences.ApplicationPreferencesLoader;\nimport org.guvnor.common.services.backend.preferences.SystemPropertiesInitializer;\nimport org.guvnor.common.services.shared.config.AppConfigService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.ApplicationStarted;\n\n@Service\n@ApplicationScoped\npublic class AppConfigServiceImpl implements AppConfigService {\n\n    private static final Logger logger = LoggerFactory.getLogger(DefaultApplicationPreferencesLoader.class);\n\n    private Map<String, String> preferences;\n\n    private Instance<ApplicationPreferencesLoader> preferencesLoaders;\n\n    private Instance<SystemPropertiesInitializer> systemPropertiesInitializers;\n\n    public AppConfigServiceImpl() {\n    }\n\n    @Inject\n    public AppConfigServiceImpl(@Any Instance<ApplicationPreferencesLoader> preferencesLoaders,\n                                @Any Instance<SystemPropertiesInitializer> systemPropertiesInitializers) {\n        this.preferencesLoaders = preferencesLoaders;\n        this.systemPropertiesInitializers = systemPropertiesInitializers;\n    }\n\n    public void configureOnEvent(@Observes ApplicationStarted applicationStartedEvent) {\n        loadPreferences();\n    }\n\n    @Override\n    public synchronized Map<String, String> loadPreferences() {\n        try {\n            if (preferences == null) {\n                preferences = new HashMap<>();\n\n                // Load preferences from all stores\n                loadPreferencesFromAllStores();\n\n                // Load system properties (only to override previously loaded preferences, if necessary)\n                loadSystemProperties();\n\n                // Perform any post-load handling of preferences\n                setupSystemPropertiesInitializers();\n            }\n            return preferences;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    private void loadPreferencesFromAllStores() {\n        if (preferencesLoaders != null) {\n            for (ApplicationPreferencesLoader loader : preferencesLoaders) {\n                preferences.putAll(loader.load());\n            }\n        }\n    }\n\n    private void loadSystemProperties() {\n        for (Map.Entry<String, String> entry : preferences.entrySet()) {\n            final String key = entry.getKey();\n            final String value = entry.getValue();\n            final String newValue = System.getProperty(key, value);\n\n            if (value != null && !value.equals(newValue)) {\n                logger.info(\"Overriding preference '\" + key + \"' to '\" + newValue + \"' based on system property value.\");\n                preferences.put(key, newValue);\n            }\n        }\n    }\n\n    private void setupSystemPropertiesInitializers() {\n        if (systemPropertiesInitializers != null) {\n            for (SystemPropertiesInitializer initializer : systemPropertiesInitializers) {\n                initializer.setSystemProperties(preferences);\n            }\n        }\n    }\n\n    @Override\n    public long getTimestamp() {\n        return new Date().getTime();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/DefaultApplicationPreferencesLoader.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.backend.preferences.ApplicationPreferencesLoader;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\npublic class DefaultApplicationPreferencesLoader implements ApplicationPreferencesLoader {\n\n    @Inject\n    private ConfigurationService configurationService;\n\n    private static final Logger log = LoggerFactory.getLogger(DefaultApplicationPreferencesLoader.class);\n\n    @Override\n    public Map<String, String> load() {\n        final Map<String, String> preferences = new HashMap<String, String>();\n        final List<ConfigGroup> configs = configurationService.getConfiguration(ConfigType.GLOBAL);\n        for (ConfigGroup config : configs) {\n            for (ConfigItem item : config.getItems()) {\n                final String name = item.getName();\n                final String value = config.getConfigItemValue(name);\n                log.info(\"Setting preference '\" + name + \"' to '\" + value + \"'.\");\n                preferences.put(name,\n                                value);\n            }\n        }\n        return preferences;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/ResourceConfigServiceImpl.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config;\n\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.guvnor.common.services.backend.config.attribute.ConfigAttributes;\nimport org.guvnor.common.services.backend.config.attribute.ConfigAttributesUtil;\nimport org.guvnor.common.services.shared.config.ResourceConfigService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n@Service\n@ApplicationScoped\npublic class ResourceConfigServiceImpl implements ResourceConfigService {\n\n    @Override\n    public Map<String, Object> configAttrs(final Map<String, Object> attrs) {\n        checkNotNull(\"_attrs\",\n                     attrs);\n\n        attrs.putAll(ConfigAttributesUtil.toMap(new ConfigAttributes() {\n\n                                                    @Override\n                                                    public FileTime lastModifiedTime() {\n                                                        return null;\n                                                    }\n\n                                                    @Override\n                                                    public FileTime lastAccessTime() {\n                                                        return null;\n                                                    }\n\n                                                    @Override\n                                                    public FileTime creationTime() {\n                                                        return null;\n                                                    }\n\n                                                    @Override\n                                                    public boolean isRegularFile() {\n                                                        return false;\n                                                    }\n\n                                                    @Override\n                                                    public boolean isDirectory() {\n                                                        return false;\n                                                    }\n\n                                                    @Override\n                                                    public boolean isSymbolicLink() {\n                                                        return false;\n                                                    }\n\n                                                    @Override\n                                                    public boolean isOther() {\n                                                        return false;\n                                                    }\n\n                                                    @Override\n                                                    public long size() {\n                                                        return 0;\n                                                    }\n\n                                                    @Override\n                                                    public Object fileKey() {\n                                                        return null;\n                                                    }\n                                                },\n                                                \"*\"));\n\n        return attrs;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/SafeSessionInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.config;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.uberfire.rpc.SessionInfo;\n\npublic class SafeSessionInfo\n        implements SessionInfo {\n\n    private SessionInfo delegate;\n\n    public SafeSessionInfo(SessionInfo delegate) {\n        this.delegate = delegate;\n    }\n\n    @Override\n    public String getId() {\n        try {\n            return delegate.getId();\n        } catch (Exception e) {\n            return \"--\";\n        }\n    }\n\n    @Override\n    public User getIdentity() {\n        try {\n            return delegate.getIdentity();\n        } catch (Exception e) {\n            return new UserImpl(\"Anonymous\");\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/attribute/ConfigAttributes.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config.attribute;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\npublic interface ConfigAttributes\n        extends BasicFileAttributes {\n\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/attribute/ConfigAttributesUtil.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\n\n/**\n *\n */\npublic final class ConfigAttributesUtil {\n\n    private ConfigAttributesUtil() {\n\n    }\n\n    public static Map<String, Object> toMap(final ConfigAttributes attrs,\n                                            final String... attributes) {\n        return new HashMap<String, Object>() {{\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n\n    private static String buildAttrName(final String title,\n                                        final int i) {\n        return title + \"[\" + i + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/config/attribute/ConfigView.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config.attribute;\n\nimport java.util.Map;\n\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.commons.data.Pair.newPair;\n\n/**\n *\n */\npublic class ConfigView extends AbstractBasicFileAttributeView<AbstractPath>\n        implements NeedsPreloadedAttrs {\n\n    private final ConfigAttributes attrs;\n\n    public ConfigView(final AbstractPath path) {\n        super(path);\n\n        final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path,\n                                                                                                   BasicFileAttributeView.class).readAttributes();\n\n        this.attrs = new ConfigAttributes() {\n\n            @Override\n            public FileTime lastModifiedTime() {\n                return fileAttrs.lastModifiedTime();\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return fileAttrs.lastAccessTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                return fileAttrs.creationTime();\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return fileAttrs.isRegularFile();\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return fileAttrs.isDirectory();\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return fileAttrs.isSymbolicLink();\n            }\n\n            @Override\n            public boolean isOther() {\n                return fileAttrs.isOther();\n            }\n\n            @Override\n            public long size() {\n                return fileAttrs.size();\n            }\n\n            @Override\n            public Object fileKey() {\n                return fileAttrs.fileKey();\n            }\n        };\n    }\n\n    private Pair<Integer, String> extractValue(final Map.Entry<String, Object> entry) {\n        int start = entry.getKey().indexOf('[');\n        if (start < 0) {\n            return newPair(0,\n                           entry.getValue().toString());\n        }\n        int end = entry.getKey().indexOf(']');\n\n        return newPair(Integer.valueOf(entry.getKey().substring(start + 1,\n                                                                end)),\n                       entry.getValue().toString());\n    }\n\n    @Override\n    public String name() {\n        return \"config\";\n    }\n\n    @Override\n    public ConfigAttributes readAttributes() throws IOException {\n        return attrs;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        return ConfigAttributesUtil.toMap(readAttributes(),\n                                          attributes);\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{ConfigView.class};\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/DotFileFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Default filter that excludes only Meta Data resources\n */\npublic class DotFileFilter implements DirectoryStream.Filter<Path> {\n\n    @Override\n    //Don't process MetaData files\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName().toString();\n        return fileName.startsWith(\".\");\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/FileDiscoveryService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport java.util.Collection;\n\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Service to discover files in a given Path\n */\npublic interface FileDiscoveryService {\n\n    /**\n     * Discover files\n     * @param pathToSearch The root Path to search. Sub-folders are not included.\n     * @param filter A filter to restrict the matched files.\n     * @param recursive True is sub-folders are to be scanned\n     * @return\n     */\n    Collection<Path> discoverFiles(final Path pathToSearch,\n                                   final DirectoryStream.Filter<org.uberfire.java.nio.file.Path> filter,\n                                   final boolean recursive);\n\n    /**\n     * Discover files. Convenience method excluding sub-folders\n     * @param pathToSearch The root Path to search. Sub-folders are not included.\n     * @param filter A filter to restrict the matched files.\n     * @return\n     */\n    Collection<Path> discoverFiles(final Path pathToSearch,\n                                   final DirectoryStream.Filter<org.uberfire.java.nio.file.Path> filter);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/FileDiscoveryServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Default implementation of FileDiscoveryService\n */\n@ApplicationScoped\npublic class FileDiscoveryServiceImpl implements FileDiscoveryService {\n\n    @Override\n    public Collection<Path> discoverFiles(final Path pathToSearch,\n                                          final DirectoryStream.Filter<org.uberfire.java.nio.file.Path> filter,\n                                          final boolean recursive) {\n        PortablePreconditions.checkNotNull(\"pathToSearch\",\n                                           pathToSearch);\n        PortablePreconditions.checkNotNull(\"filter\",\n                                           filter);\n\n        final List<Path> discoveredFiles = new ArrayList<Path>();\n\n        //The pathToSearch could be a file, and of the type we need\n        if (Files.isRegularFile(pathToSearch)) {\n            if (filter.accept(pathToSearch)) {\n                discoveredFiles.add(pathToSearch);\n                return discoveredFiles;\n            }\n        }\n\n        //This check should never match, but it's included as a safe-guard\n        if (!Files.isDirectory(pathToSearch)) {\n            return discoveredFiles;\n        }\n\n        //Path represents a Folder, so check and recursively add it's content, if applicable\n        try (final DirectoryStream<Path> paths = Files.newDirectoryStream(pathToSearch)) {\n            for (final Path path : paths) {\n                if (Files.isRegularFile(path)) {\n                    if (filter.accept(path)) {\n                        discoveredFiles.add(path);\n                    }\n                } else if (recursive && Files.isDirectory(path)) {\n                    discoveredFiles.addAll(discoverFiles(path,\n                                                         filter,\n                                                         recursive));\n                }\n            }\n        }\n\n        return discoveredFiles;\n    }\n\n    @Override\n    public Collection<Path> discoverFiles(final Path pathToSearch,\n                                          final DirectoryStream.Filter<org.uberfire.java.nio.file.Path> filter) {\n        return discoverFiles(pathToSearch,\n                             filter,\n                             false);\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/FileExtensionFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Files;\n\n/**\n * A Filter only accepting files with the given file extension\n */\npublic class FileExtensionFilter extends DotFileFilter {\n\n    private String extension;\n\n    public FileExtensionFilter(final String extension) {\n        this.extension = PortablePreconditions.checkNotNull(\"extension\",\n                                                            extension);\n        if (!extension.startsWith(\".\")) {\n            this.extension = \".\" + extension;\n        }\n    }\n\n    @Override\n    public boolean accept(final org.uberfire.java.nio.file.Path path) {\n        boolean accept = super.accept(path);\n        if (accept) {\n            return false;\n        }\n        if (!Files.isRegularFile(path)) {\n            return false;\n        }\n        final String uri = path.toUri().toString();\n        if (uri.substring(uri.length() - extension.length()).equals(extension)) {\n            return true;\n        }\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/FileExtensionsFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Files;\n\n/**\n * A Filter only accepting files with the given file extensions\n */\npublic class FileExtensionsFilter extends DotFileFilter {\n\n    private String[] extensions;\n\n    public FileExtensionsFilter(final String[] extensions) {\n        this.extensions = PortablePreconditions.checkNotNull(\"extension\",\n                                                             extensions);\n        for (int i = 0; i < extensions.length; i++) {\n            if (!extensions[i].startsWith(\".\")) {\n                extensions[i] = \".\" + extensions[i];\n            }\n        }\n    }\n\n    @Override\n    public boolean accept(final org.uberfire.java.nio.file.Path path) {\n        //Check with super class first\n        boolean accept = super.accept(path);\n        if (accept) {\n            return false;\n        }\n\n        //Only match files\n        if (!Files.isRegularFile(path)) {\n            return false;\n        }\n\n        //Assume the Path does not match by default\n        accept = false;\n        final String uri = path.toUri().toString();\n        for (String extension : extensions) {\n            if (uri.substring(uri.length() - extension.length()).equals(extension)) {\n                accept = true;\n                break;\n            }\n        }\n        return accept;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/JavaFileFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Filter to match Java source files\n */\npublic class JavaFileFilter implements DirectoryStream.Filter<Path> {\n\n    @Override\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName().toString();\n        return fileName.toLowerCase().endsWith(\".java\");\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/LinkedDirectoryFilter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * A Filter that only accepts \"Directories\"\n */\npublic class LinkedDirectoryFilter implements LinkedFilter {\n\n    private LinkedFilter next = null;\n\n    public LinkedDirectoryFilter() {\n    }\n\n    /**\n     * Constructor that automatically chains the next filter\n     *\n     * @param filter\n     */\n    public LinkedDirectoryFilter(final LinkedFilter filter) {\n        setNextFilter(PortablePreconditions.checkNotNull(\"filter\",\n                                                         filter));\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        if (!Files.isDirectory(path)) {\n            return false;\n        }\n        if (next != null) {\n            return next.accept(path);\n        }\n        return true;\n    }\n\n    @Override\n    public void setNextFilter(final LinkedFilter filter) {\n        this.next = filter;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/LinkedDotFileFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * A Filter to exclude \"dot Files\" that can be hidden from users\n */\npublic class LinkedDotFileFilter implements LinkedFilter {\n\n    private LinkedFilter next = null;\n\n    public LinkedDotFileFilter() {\n    }\n\n    /**\n     * Constructor that automatically chains the next filter\n     *\n     * @param filter\n     */\n    public LinkedDotFileFilter(final LinkedFilter filter) {\n        setNextFilter(PortablePreconditions.checkNotNull(\"filter\",\n                                                         filter));\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        if (path.getFileName().toString().startsWith(\".\")) {\n            return false;\n        }\n        if (next != null) {\n            return next.accept(path);\n        }\n        return true;\n    }\n\n    @Override\n    public void setNextFilter(final LinkedFilter filter) {\n        this.next = filter;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/LinkedFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Filter that can be chained together\n */\npublic interface LinkedFilter extends DirectoryStream.Filter<Path> {\n\n    /**\n     * Set the next Filter in the chain\n     * @param filter\n     */\n    void setNextFilter(final LinkedFilter filter);\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/LinkedMetaInfFolderFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * A Filter to exclude \"META-INF\" folder from users\n */\npublic class LinkedMetaInfFolderFilter implements LinkedFilter {\n\n    private LinkedFilter next = null;\n\n    public LinkedMetaInfFolderFilter() {\n    }\n\n    /**\n     * Constructor that automatically chains the next filter\n     *\n     * @param filter\n     */\n    public LinkedMetaInfFolderFilter(final LinkedFilter filter) {\n        setNextFilter(PortablePreconditions.checkNotNull(\"filter\",\n                                                         filter));\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        if (path.getFileName().toString().equalsIgnoreCase(\"META-INF\")) {\n            return false;\n        }\n        if (next != null) {\n            return next.accept(path);\n        }\n        return true;\n    }\n\n    @Override\n    public void setNextFilter(final LinkedFilter filter) {\n        this.next = filter;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/LinkedRegularFileFilter.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.file;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * A Filter that only accepts \"Regular files\"\n */\npublic class LinkedRegularFileFilter implements LinkedFilter {\n\n    private LinkedFilter next = null;\n\n    public LinkedRegularFileFilter() {\n    }\n\n    /**\n     * Constructor that automatically chains the next filter\n     *\n     * @param filter\n     */\n    public LinkedRegularFileFilter(final LinkedFilter filter) {\n        setNextFilter(PortablePreconditions.checkNotNull(\"filter\",\n                                                         filter));\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        if (!Files.isRegularFile(path)) {\n            return false;\n        }\n        if (next != null) {\n            return next.accept(path);\n        }\n        return true;\n    }\n\n    @Override\n    public void setNextFilter(final LinkedFilter filter) {\n        this.next = filter;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/PomFileFilter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.file;\n\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Path;\n\n/**\n * Filter to match Java source files\n */\npublic class PomFileFilter implements DirectoryStream.Filter<Path> {\n\n    @Override\n    public boolean accept(final Path path) {\n        final String fileName = path.getFileName().toString();\n        return fileName.toLowerCase().equals(\"pom.xml\");\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/upload/AbstractFileServlet.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.file.upload;\n\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport java.text.SimpleDateFormat;\nimport java.util.Calendar;\nimport java.util.Iterator;\nimport java.util.List;\nimport javax.servlet.ServletConfig;\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\nimport javax.servlet.http.HttpSession;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.apache.commons.fileupload.FileItemFactory;\nimport org.apache.commons.fileupload.disk.DiskFileItemFactory;\nimport org.apache.commons.fileupload.servlet.ServletFileUpload;\nimport org.apache.commons.io.IOUtils;\nimport org.guvnor.common.services.shared.file.upload.FileManagerFields;\nimport org.guvnor.common.services.shared.file.upload.FileOperation;\nimport org.jboss.errai.bus.client.api.QueueSession;\nimport org.jboss.errai.bus.server.api.SessionProvider;\nimport org.jboss.errai.bus.server.servlet.ServletBootstrapUtil;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.server.BaseFilteredServlet;\n\n/**\n * This is for dealing with assets that have an attachment (ie assets that are really an attachment).\n */\n//TODO: Basic authentication\npublic abstract class AbstractFileServlet extends BaseFilteredServlet {\n\n    private static final Logger log = LoggerFactory.getLogger(AbstractFileServlet.class);\n\n    private static final SimpleDateFormat sdf = new SimpleDateFormat(\"dd-MMM-yyyy HH:mm:ss\");\n\n    private static final long serialVersionUID = 510l;\n\n    public static final String DEFAULT_CLIENT_ID = \"0\";\n\n    protected SessionProvider sessionProvider;\n\n    @Override\n    public void init(final ServletConfig config) throws ServletException {\n        super.init(config);\n        sessionProvider = ServletBootstrapUtil.getService(config).getSessionProvider();\n    }\n\n    /**\n     * Load resource\n     * @param path\n     * @param request\n     * @return\n     */\n    protected abstract InputStream doLoad(final Path path,\n                                          final HttpServletRequest request);\n\n    /**\n     * Create a new resource\n     * @param path\n     * @param data\n     * @param request\n     * @param comment\n     */\n    protected abstract void doCreate(final Path path,\n                                     final InputStream data,\n                                     final HttpServletRequest request,\n                                     final String comment);\n\n    /**\n     * Update a resource\n     * @param path\n     * @param data\n     * @param request\n     * @param comment\n     */\n    protected abstract void doUpdate(final Path path,\n                                     final InputStream data,\n                                     final HttpServletRequest request,\n                                     final String comment);\n\n    /**\n     * Convert fileName and contextPath into a Path\n     * @param fileName\n     * @param contextPath\n     * @return\n     */\n    protected abstract Path convertPath(final String fileName,\n                                        final String contextPath) throws URISyntaxException;\n\n    /**\n     * Convert fullPath into a Path\n     * @param fullPath\n     * @return\n     */\n    protected abstract Path convertPath(final String fullPath) throws URISyntaxException;\n\n    /**\n     * Posting accepts content of various types.\n     */\n    protected void doPost(final HttpServletRequest request,\n                          final HttpServletResponse response) throws ServletException, IOException {\n        response.setContentType(\"text/html\");\n        final FormData item = getFormData(request);\n\n        if (item.getFile() != null) {\n            response.getWriter().write(processUpload(item,\n                                                     request,\n                                                     response));\n            return;\n        }\n\n        response.getWriter().write(\"NO-SCRIPT-DATA\");\n    }\n\n    /**\n     * Get the form data from the inbound request.\n     */\n    @SuppressWarnings(\"rawtypes\")\n    private FormData getFormData(final HttpServletRequest request) throws IOException {\n        final FileItemFactory factory = new DiskFileItemFactory();\n        final ServletFileUpload upload = new ServletFileUpload(factory);\n        upload.setHeaderEncoding(\"UTF-8\");\n\n        //See https://code.google.com/p/google-web-toolkit/issues/detail?id=4682\n        request.setCharacterEncoding(\"UTF-8\");\n\n        final FormData data = new FormData();\n        try {\n            final List items = upload.parseRequest(request);\n            final Iterator it = items.iterator();\n\n            FileOperation operation = null;\n            String fileName = null;\n            String contextPath = null;\n            String fullPath = null;\n\n            while (it.hasNext()) {\n                final FileItem item = (FileItem) it.next();\n                if (!item.isFormField()) {\n                    data.setFile(item);\n                } else if (item.getFieldName().equals(FileManagerFields.FORM_FIELD_PATH)) {\n                    contextPath = item.getString(\"UTF-8\");\n                    log.debug(\"path:\" + contextPath);\n                } else if (item.getFieldName().equals(FileManagerFields.FORM_FIELD_NAME)) {\n                    fileName = item.getString(\"UTF-8\");\n                    log.debug(\"name:\" + fileName);\n                } else if (item.getFieldName().equals(FileManagerFields.FORM_FIELD_FULL_PATH)) {\n                    fullPath = item.getString(\"UTF-8\");\n                    log.debug(\"full path:\" + fullPath);\n                } else if (item.getFieldName().equals(FileManagerFields.FORM_FIELD_OPERATION)) {\n                    operation = FileOperation.valueOf(item.getString(\"UTF-8\"));\n                    log.debug(\"operation:\" + operation);\n                }\n            }\n\n            if (operation == null) {\n                throw new IllegalArgumentException(\"FORM_FIELD_OPERATION is null. Cannot process upload.\");\n            }\n\n            org.uberfire.java.nio.file.Path path;\n            switch (operation) {\n                case CREATE:\n                    if (fileName == null) {\n                        throw new IllegalArgumentException(\"FORM_FIELD_NAME is null. Cannot process upload.\");\n                    }\n                    if (contextPath == null) {\n                        throw new IllegalArgumentException(\"FORM_FIELD_PATH is null. Cannot process upload.\");\n                    }\n                    data.setOperation(operation);\n                    data.setTargetPath(convertPath(fileName,\n                                                   contextPath));\n                    break;\n                case UPDATE:\n                    if (fullPath == null) {\n                        throw new IllegalArgumentException(\"FORM_FIELD_FULL_PATH is null. Cannot process upload.\");\n                    }\n                    data.setOperation(operation);\n                    data.setTargetPath(convertPath(fullPath));\n            }\n\n            return data;\n        } catch (Exception e) {\n            throw new org.uberfire.java.nio.IOException(e.getMessage());\n        }\n    }\n\n    private String processUpload(final FormData item,\n                                 final HttpServletRequest request,\n                                 final HttpServletResponse response) throws IOException {\n\n        // If the file it doesn't exist.\n        if (\"\".equals(item.getFile().getName())) {\n            throw new IOException(\"No file selected.\");\n        }\n\n        final String processResult = uploadFile(item,\n                                                request,\n                                                response);\n\n        return processResult;\n    }\n\n    private String uploadFile(final FormData item,\n                              final HttpServletRequest request,\n                              final HttpServletResponse response) throws IOException {\n        final org.uberfire.backend.vfs.Path targetPath = item.getTargetPath();\n\n        if (!validateAccess(Paths.convert(targetPath),\n                            response)) {\n            return \"FAIL\";\n        }\n\n        try (final InputStream fileData = item.getFile().getInputStream()) {\n            final FileOperation operation = item.getOperation();\n            if (operation == FileOperation.CREATE) {\n                doCreate(targetPath,\n                         fileData,\n                         request,\n                         \"Uploaded \" + getTimestamp());\n            } else if (operation == FileOperation.UPDATE) {\n                doUpdate(targetPath,\n                         fileData,\n                         request,\n                         \"Uploaded \" + getTimestamp());\n            }\n        }\n\n        return \"OK\";\n    }\n\n    private String getTimestamp() {\n        final Calendar now = Calendar.getInstance();\n        final StringBuilder sb = new StringBuilder();\n        sb.append(sdf.format(now.getTime()));\n        return sb.toString();\n    }\n\n    /**\n     * doGet acting like a dispatcher.\n     */\n    protected void doGet(final HttpServletRequest request,\n                         final HttpServletResponse response) throws ServletException, IOException {\n        final String path = request.getParameter(FileManagerFields.FORM_FIELD_PATH);\n\n        if (path != null) {\n            processAttachmentDownload(path,\n                                      request,\n                                      response);\n        } else {\n            response.sendError(HttpServletResponse.SC_BAD_REQUEST);\n        }\n    }\n\n    protected void processAttachmentDownload(final String url,\n                                             final HttpServletRequest request,\n                                             final HttpServletResponse response) throws IOException {\n        final ByteArrayOutputStream output = new ByteArrayOutputStream();\n\n        try {\n            final Path sourcePath = convertPath(url);\n\n            if (!validateAccess(Paths.convert(sourcePath),\n                                response)) {\n                return;\n            }\n\n            IOUtils.copy(doLoad(sourcePath,\n                                request),\n                         output);\n            //Use the encoded form from in the URL (rather than encode/decode for fun!)\n            //See http://tools.ietf.org/html/rfc6266 for details of filename* content-disposition usage\n            final String fileName = url.substring(url.lastIndexOf(\"/\") + 1);\n\n            response.setContentType(\"application/x-download\");\n            response.setHeader(\"Content-Disposition\",\n                               \"attachment; filename*=utf-8''\" + fileName);\n\n            response.setContentLength(output.size());\n            response.getOutputStream().write(output.toByteArray());\n            response.getOutputStream().flush();\n        } catch (Exception e) {\n            throw new org.uberfire.java.nio.IOException(e.getMessage());\n        }\n    }\n\n    protected String getSessionId(final HttpServletRequest request,\n                                  final SessionProvider sessionProvider) {\n        final HttpSession session = request.getSession(true);\n        final String clientId = getClientId(request);\n        final QueueSession queueSession = sessionProvider.createOrGetSession(session,\n                                                                             clientId);\n\n        return queueSession.getSessionId();\n    }\n\n    private String getClientId(final HttpServletRequest request) {\n        String clientId = request.getParameter(\"clientId\");\n\n        if (clientId == null) {\n            log.warn(\"Parameter named 'clientId' should be not null!\");\n            clientId = DEFAULT_CLIENT_ID;\n        }\n\n        return clientId;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/file/upload/FormData.java",
    "content": "/*\n * Copyright 2005 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.file.upload;\n\nimport org.apache.commons.fileupload.FileItem;\nimport org.guvnor.common.services.shared.file.upload.FileOperation;\nimport org.uberfire.backend.vfs.Path;\n\npublic class FormData {\n\n    private FileItem file;\n    private FileOperation operation;\n    private Path targetPath;\n\n    public FileItem getFile() {\n        return file;\n    }\n\n    public void setFile(final FileItem file) {\n        this.file = file;\n    }\n\n    public FileOperation getOperation() {\n        return operation;\n    }\n\n    public void setOperation(final FileOperation operation) {\n        this.operation = operation;\n    }\n\n    public Path getTargetPath() {\n        return targetPath;\n    }\n\n    public void setTargetPath(final Path targetPath) {\n        this.targetPath = targetPath;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/DiscussionAttributesMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\n\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class DiscussionAttributesMock\n        implements org.guvnor.common.services.backend.metadata.attribute.DiscussionAttributes {\n\n    @Override\n    public List<DiscussionRecord> discussion() {\n        return new ArrayList<DiscussionRecord>();\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return false;\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return false;\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return false;\n    }\n\n    @Override\n    public boolean isOther() {\n        return false;\n    }\n\n    @Override\n    public long size() {\n        return 0;\n    }\n\n    @Override\n    public Object fileKey() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/DublinCoreAttributesMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.io.attribute.DublinCoreAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class DublinCoreAttributesMock\n        implements DublinCoreAttributes {\n\n    @Override\n    public List<String> titles() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> creators() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> subjects() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> descriptions() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> publishers() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> contributors() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> types() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> formats() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> identifiers() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> sources() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> languages() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> relations() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> coverages() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public List<String> rights() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return false;\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return false;\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return false;\n    }\n\n    @Override\n    public boolean isOther() {\n        return false;\n    }\n\n    @Override\n    public long size() {\n        return 0;\n    }\n\n    @Override\n    public Object fileKey() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/MetadataBuilder.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n *\n */\npublic final class MetadataBuilder {\n\n    private Path path;\n    private Path realPath;\n    private LockInfo lockInfo;\n\n    //git info\n    private String checkinComment;\n    private String lastContributor;\n    private String creator;\n\n    private Date lastModified;\n    private Date dateCreated;\n\n    //pure dcore\n    private String subject;\n    private String type;\n    private String externalRelation;\n    private String externalSource;\n    private String description;\n\n    //not dcore\n    private List<String> tags = new ArrayList<String>();\n    private List<DiscussionRecord> discussion = new ArrayList<DiscussionRecord>();\n    private List<VersionRecord> version = new ArrayList<VersionRecord>();\n\n    private boolean generated;\n\n    private MetadataBuilder() {\n\n    }\n\n    public static MetadataBuilder newMetadata() {\n        return new MetadataBuilder();\n    }\n\n    public MetadataBuilder withPath(final Path path) {\n        this.path = checkNotNull(\"path\",\n                                 path);\n        return this;\n    }\n\n    public MetadataBuilder withRealPath(final Path realPath) {\n        this.realPath = checkNotNull(\"realPath\",\n                                     realPath);\n        return this;\n    }\n\n    public MetadataBuilder withCheckinComment(final String checkinComment) {\n        this.checkinComment = checkinComment;\n        return this;\n    }\n\n    public MetadataBuilder withLastContributor(final String lastContributor) {\n        this.lastContributor = lastContributor;\n        return this;\n    }\n\n    public MetadataBuilder withCreator(final String creator) {\n        this.creator = checkNotEmpty(\"creator\",\n                                     creator);\n        return this;\n    }\n\n    public MetadataBuilder withLastModified(final Date date) {\n        this.lastModified = checkNotNull(\"date\",\n                                         date);\n        return this;\n    }\n\n    public MetadataBuilder withDateCreated(final Date date) {\n        this.dateCreated = checkNotNull(\"date\",\n                                        date);\n        return this;\n    }\n\n    public MetadataBuilder withSubject(final String subject) {\n        this.subject = subject;\n        return this;\n    }\n\n    public MetadataBuilder withType(final String type) {\n        this.type = type;\n        return this;\n    }\n\n    public MetadataBuilder withExternalRelation(final String externalRelation) {\n        this.externalRelation = externalRelation;\n        return this;\n    }\n\n    public MetadataBuilder withExternalSource(final String externalSource) {\n        this.externalSource = externalSource;\n        return this;\n    }\n\n    public MetadataBuilder withDescription(final String description) {\n        this.description = description;\n        return this;\n    }\n\n    public MetadataBuilder withTags(final List<String> tags) {\n        this.tags = tags;\n        return this;\n    }\n\n    public MetadataBuilder withDiscussion(final List<DiscussionRecord> discussion) {\n        this.discussion = discussion;\n        return this;\n    }\n\n    public MetadataBuilder withVersion(final List<VersionRecord> version) {\n        this.version = version;\n        return this;\n    }\n\n    public MetadataBuilder withLockInfo(final LockInfo lockInfo) {\n        this.lockInfo = lockInfo;\n        return this;\n    }\n\n    public MetadataBuilder withGenerated(final boolean generated) {\n        this.generated = generated;\n        return this;\n    }\n\n    public Metadata build() {\n        return new Metadata(path,\n                            realPath,\n                            checkinComment,\n                            lastContributor,\n                            creator,\n                            lastModified,\n                            dateCreated,\n                            subject,\n                            type,\n                            externalRelation,\n                            externalSource,\n                            description,\n                            tags,\n                            discussion,\n                            version,\n                            lockInfo,\n                            generated);\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/MetadataCreator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\n\nimport org.guvnor.common.services.backend.metadata.attribute.DiscussionView;\nimport org.guvnor.common.services.backend.metadata.attribute.GeneratedAttributesView;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaView;\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.ext.editor.commons.version.impl.PortableVersionRecord;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class MetadataCreator {\n\n    private final Path path;\n    private final DublinCoreView dublinCoreView;\n    private final DiscussionView discussView;\n    private final OtherMetaView otherMetaView;\n    private final VersionAttributeView versionAttributeView;\n    private final GeneratedAttributesView generatedAttributesView;\n    private final IOService configIOService;\n    private final SessionInfo sessionInfo;\n\n    public MetadataCreator(Path path,\n                           IOService configIOService,\n                           SessionInfo sessionInfo,\n                           DublinCoreView dublinCoreView,\n                           DiscussionView discussionView,\n                           OtherMetaView otherMetaView,\n                           VersionAttributeView versionAttributeView,\n                           GeneratedAttributesView generatedAttributesView) {\n        this.path = checkNotNull(\"path\",\n                                 path);\n        this.configIOService = checkNotNull(\"configIOService\",\n                                            configIOService);\n        this.sessionInfo = checkNotNull(\"sessionInfo\",\n                                        sessionInfo);\n        this.dublinCoreView = checkNotNull(\"dublinCoreView\",\n                                           dublinCoreView);\n        this.discussView = checkNotNull(\"discussionView\",\n                                        discussionView);\n        this.otherMetaView = checkNotNull(\"otherMetaView\",\n                                          otherMetaView);\n        this.versionAttributeView = checkNotNull(\"versionAttributeView\",\n                                                 versionAttributeView);\n        this.generatedAttributesView = checkNotNull(\"generatedAttributesView\",\n                                                    generatedAttributesView);\n    }\n\n    public Metadata create() {\n        return MetadataBuilder.newMetadata()\n                .withPath(Paths.convert(path))\n                .withRealPath(Paths.convert(path.toRealPath()))\n                .withCheckinComment(getCheckinComment())\n                .withLastContributor(getLastContributor())\n                .withCreator(getCreator())\n                .withLastModified(getLastModified())\n                .withDateCreated(getDateCreated())\n                .withSubject(getSubject())\n                .withType(getType())\n                .withExternalRelation(getExternalRelation())\n                .withExternalSource(getExternalSource())\n                .withDescription(getDescription())\n                .withTags(getTags())\n                .withDiscussion(getDiscussion())\n                .withLockInfo(retrieveLockInfo(Paths.convert(path)))\n                .withVersion(getVersion())\n                .withGenerated(getGenerated())\n                .build();\n    }\n\n    private ArrayList<VersionRecord> getVersion() {\n        return new ArrayList<VersionRecord>(versionAttributeView.readAttributes().history().records().size()) {{\n            for (final VersionRecord record : versionAttributeView.readAttributes().history().records()) {\n                add(new PortableVersionRecord(record.id(),\n                                              record.author(),\n                                              record.email(),\n                                              record.comment(),\n                                              record.date(),\n                                              record.uri()));\n            }\n        }};\n    }\n\n    private boolean getGenerated() {\n        return generatedAttributesView.readAttributes().isGenerated();\n    }\n\n    private List<DiscussionRecord> getDiscussion() {\n        return discussView.readAttributes().discussion();\n    }\n\n    private List<String> getTags() {\n        return otherMetaView.readAttributes().tags();\n    }\n\n    private String getDescription() {\n        return dublinCoreView.readAttributes().descriptions().size() > 0 ? dublinCoreView.readAttributes().descriptions().get(0) : null;\n    }\n\n    private String getExternalSource() {\n        return dublinCoreView.readAttributes().sources().size() > 0 ? dublinCoreView.readAttributes().sources().get(0) : null;\n    }\n\n    private String getExternalRelation() {\n        return dublinCoreView.readAttributes().relations().size() > 0 ? dublinCoreView.readAttributes().relations().get(0) : null;\n    }\n\n    private String getType() {\n        return dublinCoreView.readAttributes().types().size() > 0 ? dublinCoreView.readAttributes().types().get(0) : null;\n    }\n\n    private String getSubject() {\n        return dublinCoreView.readAttributes().subjects().size() > 0 ? dublinCoreView.readAttributes().subjects().get(0) : null;\n    }\n\n    private Date getDateCreated() {\n        return new Date(versionAttributeView.readAttributes().creationTime().toMillis());\n    }\n\n    private Date getLastModified() {\n        return new Date(versionAttributeView.readAttributes().lastModifiedTime().toMillis());\n    }\n\n    private String getCreator() {\n        if (versionAttributeView.readAttributes().history().records().size() > 0) {\n            return versionAttributeView.readAttributes().history().records().get(0).author();\n        } else {\n            return null;\n        }\n    }\n\n    private String getLastContributor() {\n        if (versionAttributeView.readAttributes().history().records().size() > 0) {\n            return versionAttributeView.readAttributes().history().records().get(versionAttributeView.readAttributes().history().records().size() - 1).author();\n        } else {\n            return null;\n        }\n    }\n\n    private String getCheckinComment() {\n        VersionAttributes versionAttributes = versionAttributeView.readAttributes();\n        VersionHistory history = versionAttributes.history();\n        List<VersionRecord> records = history.records();\n        if (records.size() > 0) {\n            return versionAttributeView.readAttributes().history().records().get(versionAttributeView.readAttributes().history().records().size() - 1).comment();\n        } else {\n            return null;\n        }\n    }\n\n    private LockInfo retrieveLockInfo(org.uberfire.backend.vfs.Path path) {\n        final org.uberfire.java.nio.file.Path lockPath = Paths.convert(PathFactory.newLock(path));\n        try {\n            //See https://issues.jboss.org/browse/GUVNOR-2399. We simply try to read the lock file returning a default.\n            final String lockedBy = configIOService.readAllString(lockPath);\n            return new LockInfo(true,\n                                lockedBy,\n                                path);\n        } catch (NoSuchFileException nsfe) {\n            return new LockInfo(false,\n                                \"\",\n                                path);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/MetadataServiceImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.commons.io.IOUtils;\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.backend.metadata.attribute.DiscussionAttributes;\nimport org.guvnor.common.services.backend.metadata.attribute.DiscussionAttributesUtil;\nimport org.guvnor.common.services.backend.metadata.attribute.DiscussionView;\nimport org.guvnor.common.services.backend.metadata.attribute.GeneratedAttributesUtil;\nimport org.guvnor.common.services.backend.metadata.attribute.GeneratedAttributesView;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaAttributes;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaAttributesUtil;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaView;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreAttributes;\nimport org.uberfire.io.attribute.DublinCoreAttributesUtil;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.BasicFileAttributesUtil;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.StandardOpenOption;\nimport org.uberfire.java.nio.file.attribute.FileTime;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static java.util.Collections.emptyList;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Service\n@ApplicationScoped\npublic class MetadataServiceImpl\n        implements MetadataServerSideService {\n\n    private IOService ioService;\n    private IOService configIOService;\n    private CommentedOptionFactory commentedOptionFactory;\n    private SessionInfo sessionInfo;\n\n    public MetadataServiceImpl() {\n    }\n\n    @Inject\n    public MetadataServiceImpl(@Named(\"ioStrategy\") IOService ioService,\n                               @Named(\"configIO\") IOService configIOService,\n                               CommentedOptionFactory commentedOptionFactory,\n                               SessionInfo sessionInfo) {\n        this.ioService = ioService;\n        this.configIOService = configIOService;\n        this.commentedOptionFactory = commentedOptionFactory;\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public Path saveMetadata(final Path path,\n                             final Metadata metadata,\n                             final String comment) {\n\n        try (final InputStream inputStream = ioService.newInputStream(Paths.convert(path), StandardOpenOption.READ)) {\n\n            return Paths.convert(ioService.write(Paths.convert(path),\n                                                 IOUtils.toByteArray(inputStream),\n                                                 setUpAttributes(path,\n                                                                 metadata),\n                                                 commentedOptionFactory.makeCommentedOption(comment)));\n        } catch (IOException e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Metadata getMetadata(final Path pathToResource) {\n        return getMetadata(Paths.convert(pathToResource));\n    }\n\n    @Override\n    public Metadata getMetadata(org.uberfire.java.nio.file.Path path) {\n\n        try {\n            return new MetadataCreator(path,\n                                       configIOService,\n                                       sessionInfo,\n                                       ioService.getFileAttributeView(path,\n                                                                      DublinCoreView.class),\n                                       ioService.getFileAttributeView(path,\n                                                                      DiscussionView.class),\n                                       ioService.getFileAttributeView(path,\n                                                                      OtherMetaView.class),\n                                       ioService.getFileAttributeView(path,\n                                                                      VersionAttributeView.class),\n                                       ioService.getFileAttributeView(path,\n                                                                      GeneratedAttributesView.class)).create();\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public List<String> getTags(final Path resource) {\n        checkNotNull(\"MetadataServiceImpl.resource\",\n                     resource);\n        return getTags(Paths.convert(resource));\n    }\n\n    @Override\n    public List<String> getTags(final org.uberfire.java.nio.file.Path resource) {\n        checkNotNull(\"MetadataServiceImpl.resource\",\n                     resource);\n        final OtherMetaView otherMetaView = ioService.getFileAttributeView(resource,\n                                                                           OtherMetaView.class);\n        if (otherMetaView != null) {\n            return otherMetaView.readAttributes().tags();\n        } else {\n            return Collections.emptyList();\n        }\n    }\n\n    @Override\n    public Map<String, Object> configAttrs(final Map<String, Object> _attrs,\n                                           final Metadata metadata) {\n        try {\n            checkNotNull(\"_attrs\",\n                         _attrs);\n            checkNotNull(\"metadata\",\n                         metadata);\n\n            Map<String, Object> attrs = BasicFileAttributesUtil.cleanup(_attrs);\n            attrs = DublinCoreAttributesUtil.cleanup(attrs);\n            attrs = DiscussionAttributesUtil.cleanup(attrs);\n            attrs = OtherMetaAttributesUtil.cleanup(attrs);\n            attrs = GeneratedAttributesUtil.cleanup(attrs);\n\n            attrs.putAll(DiscussionAttributesUtil.toMap(\n                    new DiscussionAttributes() {\n                        @Override\n                        public List<DiscussionRecord> discussion() {\n                            return metadata.getDiscussion();\n                        }\n\n                        @Override\n                        public FileTime lastModifiedTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime lastAccessTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime creationTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public boolean isRegularFile() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isDirectory() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isSymbolicLink() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isOther() {\n                            return false;\n                        }\n\n                        @Override\n                        public long size() {\n                            return 0;\n                        }\n\n                        @Override\n                        public Object fileKey() {\n                            return null;\n                        }\n                    },\n                    \"*\"));\n\n            attrs.putAll(OtherMetaAttributesUtil.toMap(\n                    new OtherMetaAttributes() {\n                        @Override\n                        public List<String> tags() {\n                            return metadata.getTags();\n                        }\n\n                        @Override\n                        public FileTime lastModifiedTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime lastAccessTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime creationTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public boolean isRegularFile() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isDirectory() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isSymbolicLink() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isOther() {\n                            return false;\n                        }\n\n                        @Override\n                        public long size() {\n                            return 0;\n                        }\n\n                        @Override\n                        public Object fileKey() {\n                            return null;\n                        }\n                    },\n                    \"*\"));\n\n            attrs.putAll(DublinCoreAttributesUtil.toMap(\n                    new DublinCoreAttributes() {\n\n                        @Override\n                        public List<String> titles() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> creators() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> subjects() {\n                            return new ArrayList<String>(1) {{\n                                add(metadata.getSubject());\n                            }};\n                        }\n\n                        @Override\n                        public List<String> descriptions() {\n                            return new ArrayList<String>(1) {{\n                                add(metadata.getDescription());\n                            }};\n                        }\n\n                        @Override\n                        public List<String> publishers() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> contributors() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> types() {\n                            return new ArrayList<String>(1) {{\n                                add(metadata.getType());\n                            }};\n                        }\n\n                        @Override\n                        public List<String> formats() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> identifiers() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> sources() {\n                            return new ArrayList<String>(1) {{\n                                add(metadata.getExternalSource());\n                            }};\n                        }\n\n                        @Override\n                        public List<String> languages() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> relations() {\n                            return new ArrayList<String>(1) {{\n                                add(metadata.getExternalRelation());\n                            }};\n                        }\n\n                        @Override\n                        public List<String> coverages() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public List<String> rights() {\n                            return emptyList();\n                        }\n\n                        @Override\n                        public FileTime lastModifiedTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime lastAccessTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public FileTime creationTime() {\n                            return null;\n                        }\n\n                        @Override\n                        public boolean isRegularFile() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isDirectory() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isSymbolicLink() {\n                            return false;\n                        }\n\n                        @Override\n                        public boolean isOther() {\n                            return false;\n                        }\n\n                        @Override\n                        public long size() {\n                            return 0;\n                        }\n\n                        @Override\n                        public Object fileKey() {\n                            return null;\n                        }\n                    },\n                    \"*\"));\n\n            if (metadata.isGenerated()) {\n                attrs.put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME,\n                          true);\n            }\n\n            return attrs;\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    @Override\n    public Map<String, Object> setUpAttributes(final Path path,\n                                               final Metadata metadata) {\n        try {\n            Map<String, Object> attributes;\n            try {\n                attributes = ioService.readAttributes(Paths.convert(path));\n            } catch (final NoSuchFileException ex) {\n                attributes = new HashMap<String, Object>();\n            }\n            if (metadata != null) {\n                attributes = configAttrs(attributes,\n                                         metadata);\n            }\n\n            return BasicFileAttributesUtil.cleanup(attributes);\n        } catch (Exception e) {\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/OtherMetaAttributesMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\n\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class OtherMetaAttributesMock\n        implements OtherMetaAttributes {\n\n    @Override\n    public List<String> tags() {\n        return new ArrayList<String>();\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return false;\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return false;\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return false;\n    }\n\n    @Override\n    public boolean isOther() {\n        return false;\n    }\n\n    @Override\n    public long size() {\n        return 0;\n    }\n\n    @Override\n    public Object fileKey() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/VersionAttributesMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.List;\nimport java.util.concurrent.TimeUnit;\n\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionHistory;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class VersionAttributesMock implements VersionAttributes {\n\n    private List<VersionRecord> versionRecords;\n\n    public VersionAttributesMock(List<VersionRecord> versionRecords) {\n        this.versionRecords = versionRecords;\n    }\n\n    @Override\n    public FileTime lastModifiedTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime lastAccessTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public FileTime creationTime() {\n        return new FileTime() {\n            @Override\n            public long to(TimeUnit unit) {\n                return 0;\n            }\n\n            @Override\n            public long toMillis() {\n                return 0;\n            }\n\n            @Override\n            public int compareTo(FileTime fileTime) {\n                return 0;\n            }\n        };\n    }\n\n    @Override\n    public boolean isRegularFile() {\n        return false;\n    }\n\n    @Override\n    public boolean isDirectory() {\n        return false;\n    }\n\n    @Override\n    public boolean isSymbolicLink() {\n        return false;\n    }\n\n    @Override\n    public boolean isOther() {\n        return false;\n    }\n\n    @Override\n    public long size() {\n        return 0;\n    }\n\n    @Override\n    public Object fileKey() {\n        return null;\n    }\n\n    @Override\n    public VersionHistory history() {\n        return new VersionHistory() {\n            @Override\n            public List<VersionRecord> records() {\n                return versionRecords;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/DiscussionAttributes.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n *\n */\npublic interface DiscussionAttributes extends BasicFileAttributes {\n\n    List<DiscussionRecord> discussion();\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/DiscussionAttributesUtil.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\n\n/**\n *\n */\npublic final class DiscussionAttributesUtil {\n\n    private DiscussionAttributesUtil() {\n    }\n\n    public static Map<String, Object> cleanup(final Map<String, Object> _attrs) {\n        final Map<String, Object> attrs = new HashMap<String, Object>(_attrs);\n\n        for (final String key : _attrs.keySet()) {\n            if (key.startsWith(DiscussionView.TIMESTAMP) || key.startsWith(DiscussionView.AUTHOR) || key.startsWith(DiscussionView.NOTE)) {\n                attrs.put(key,\n                          null);\n            }\n        }\n\n        return attrs;\n    }\n\n    public static Map<String, Object> toMap(final DiscussionAttributes attrs,\n                                            final String... attributes) {\n        return new HashMap<String, Object>() {{\n            for (final String attribute : attributes) {\n                checkNotEmpty(\"attribute\",\n                              attribute);\n\n                if (attribute.equals(\"*\") || attribute.equals(DiscussionView.DISCUSS)) {\n                    for (int i = 0; i < attrs.discussion().size(); i++) {\n                        final DiscussionRecord record = attrs.discussion().get(i);\n                        put(buildAttrName(DiscussionView.TIMESTAMP,\n                                          i),\n                            record.getTimestamp());\n                        put(buildAttrName(DiscussionView.AUTHOR,\n                                          i),\n                            record.getAuthor());\n                        put(buildAttrName(DiscussionView.NOTE,\n                                          i),\n                            record.getNote());\n                    }\n                }\n                if (attribute.equals(\"*\")) {\n                    break;\n                }\n            }\n        }};\n    }\n\n    private static String buildAttrName(final String title,\n                                        final int i) {\n        return title + \"[\" + i + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/DiscussionView.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.shared.metadata.model.DiscussionRecord;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.commons.data.Pair.newPair;\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\n\n/**\n *\n */\npublic class DiscussionView\n        extends AbstractBasicFileAttributeView<AbstractPath>\n        implements NeedsPreloadedAttrs {\n\n    public static final String DISCUSS = \"discuss\";\n    public static final String TIMESTAMP = DISCUSS + \".ts\";\n    public static final String AUTHOR = DISCUSS + \".author\";\n    public static final String NOTE = DISCUSS + \".note\";\n\n    private final DiscussionAttributes attrs;\n\n    public DiscussionView(final AbstractPath path) {\n        super(path);\n        final Map<String, Object> content = path.getAttrStorage().getContent();\n\n        final Map<Integer, Long> timestamps = new HashMap<Integer, Long>(content.size());\n        final Map<Integer, String> authors = new HashMap<Integer, String>(content.size());\n        final Map<Integer, String> notes = new HashMap<Integer, String>(content.size());\n\n        for (final Map.Entry<String, Object> entry : content.entrySet()) {\n            if (entry.getKey().startsWith(TIMESTAMP)) {\n                final Pair<Integer, Object> result = extractValue(entry);\n                timestamps.put(result.getK1(),\n                               (Long) result.getK2());\n            } else if (entry.getKey().startsWith(AUTHOR)) {\n                final Pair<Integer, Object> result = extractValue(entry);\n                authors.put(result.getK1(),\n                            result.getK2().toString());\n            } else if (entry.getKey().startsWith(NOTE)) {\n                final Pair<Integer, Object> result = extractValue(entry);\n                notes.put(result.getK1(),\n                          result.getK2().toString());\n            }\n        }\n\n        final List<DiscussionRecord> result = new ArrayList<DiscussionRecord>(timestamps.size());\n\n        for (int i = 0; i < timestamps.size(); i++) {\n            final Long ts = timestamps.get(i);\n            final String author = authors.get(i);\n            final String note = notes.get(i);\n            result.add(new DiscussionRecord(ts,\n                                            author,\n                                            note));\n        }\n\n        Collections.sort(result,\n                         new Comparator<DiscussionRecord>() {\n                             @Override\n                             public int compare(final DiscussionRecord o1,\n                                                final DiscussionRecord o2) {\n                                 return o1.getTimestamp().compareTo(o2.getTimestamp());\n                             }\n                         });\n\n        final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path,\n                                                                                                   BasicFileAttributeView.class).readAttributes();\n\n        this.attrs = new DiscussionAttributes() {\n            @Override\n            public List<DiscussionRecord> discussion() {\n                return result;\n            }\n\n            @Override\n            public FileTime lastModifiedTime() {\n                return fileAttrs.lastModifiedTime();\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return fileAttrs.lastAccessTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                return fileAttrs.creationTime();\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return fileAttrs.isRegularFile();\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return fileAttrs.isDirectory();\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return fileAttrs.isSymbolicLink();\n            }\n\n            @Override\n            public boolean isOther() {\n                return fileAttrs.isOther();\n            }\n\n            @Override\n            public long size() {\n                return fileAttrs.size();\n            }\n\n            @Override\n            public Object fileKey() {\n                return fileAttrs.fileKey();\n            }\n        };\n    }\n\n    private Pair<Integer, Object> extractValue(final Map.Entry<String, Object> entry) {\n        int start = entry.getKey().indexOf('[');\n        if (start < 0) {\n            return newPair(0,\n                           entry.getValue());\n        }\n        int end = entry.getKey().indexOf(']');\n\n        return newPair(Integer.valueOf(entry.getKey().substring(start + 1,\n                                                                end)),\n                       entry.getValue());\n    }\n\n    @Override\n    public String name() {\n        return DISCUSS;\n    }\n\n    @Override\n    public DiscussionAttributes readAttributes() throws IOException {\n        return attrs;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        return DiscussionAttributesUtil.toMap(readAttributes(),\n                                              attributes);\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{DiscussionView.class};\n    }\n\n    @Override\n    public void setAttribute(final String attribute,\n                             final Object value) throws IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n        checkCondition(\"invalid attribute\",\n                       attribute.equals(name()));\n\n        throw new NotImplementedException();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/GeneratedAttributesUtil.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\npublic final class GeneratedAttributesUtil {\n\n    private GeneratedAttributesUtil() {\n    }\n\n    /**\n     * Remove attribute mappings specific to GeneratedAttributesView from the\n     * map of all available file attributes.\n     */\n    public static Map<String, Object> cleanup(final Map<String, Object> _attrs) {\n        final Map<String, Object> attrs = new HashMap<>(_attrs);\n\n        attrs.replace(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME, null);\n\n        return attrs;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/GeneratedAttributesView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.Map;\n\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class GeneratedAttributesView extends AbstractBasicFileAttributeView<AbstractPath> implements NeedsPreloadedAttrs {\n\n    public static final String GENERATED_VIEW_NAME = \"generated\";\n\n    public static final String GENERATED_ATTRIBUTE_NAME = GENERATED_VIEW_NAME + \".generated\";\n\n    private GeneratedFileAttributes generatedFileAttributes;\n\n    public GeneratedAttributesView(AbstractPath path) {\n        super(path);\n\n        final boolean generated = extractGenerated();\n\n        final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path,\n                                                                                                   BasicFileAttributeView.class).readAttributes();\n\n        this.generatedFileAttributes = new GeneratedFileAttributes() {\n            @Override\n            public boolean isGenerated() {\n                return generated;\n            }\n\n            @Override\n            public FileTime lastModifiedTime() {\n                return fileAttrs.lastModifiedTime();\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return fileAttrs.lastAccessTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                return fileAttrs.creationTime();\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return fileAttrs.isRegularFile();\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return fileAttrs.isDirectory();\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return fileAttrs.isSymbolicLink();\n            }\n\n            @Override\n            public boolean isOther() {\n                return fileAttrs.isOther();\n            }\n\n            @Override\n            public long size() {\n                return fileAttrs.size();\n            }\n\n            @Override\n            public Object fileKey() {\n                return fileAttrs.fileKey();\n            }\n        };\n    }\n\n    private boolean extractGenerated() {\n        final Map<String, Object> content = path.getAttrStorage().getContent();\n\n        final Object generatedFileAttribute = content.get(GENERATED_ATTRIBUTE_NAME);\n\n        if (generatedFileAttribute instanceof Boolean) {\n            return (Boolean) generatedFileAttribute;\n        }\n\n        return false;\n    }\n\n    @Override\n    public String name() {\n        return GENERATED_VIEW_NAME;\n    }\n\n    @Override\n    public Class[] viewTypes() {\n        return new Class[]{GeneratedAttributesView.class};\n    }\n\n    @Override\n    public GeneratedFileAttributes readAttributes() throws IOException {\n        return generatedFileAttributes;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/GeneratedFileAttributes.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n * Represents attributes of a file which has been generated.\n */\npublic interface GeneratedFileAttributes extends BasicFileAttributes {\n\n    boolean isGenerated();\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/OtherMetaAttributes.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.List;\n\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\n\n/**\n *\n */\npublic interface OtherMetaAttributes extends BasicFileAttributes {\n\n    List<String> tags();\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/OtherMetaAttributesUtil.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\n\n/**\n *\n */\npublic final class OtherMetaAttributesUtil {\n\n    private OtherMetaAttributesUtil() {\n    }\n\n    public static Map<String, Object> cleanup(final Map<String, Object> _attrs) {\n        final Map<String, Object> attrs = new HashMap<String, Object>(_attrs);\n\n        for (final String key : _attrs.keySet()) {\n            if (key.startsWith(OtherMetaView.TAG) || key.equals(OtherMetaView.MODE)) {\n                attrs.put(key,\n                          null);\n            }\n        }\n\n        return attrs;\n    }\n\n    public static Map<String, Object> toMap(final OtherMetaAttributes attrs,\n                                            final String... attributes) {\n        return new HashMap<String, Object>() {\n            {\n                for (final String attribute : attributes) {\n                    checkNotEmpty(\"attribute\",\n                                  attribute);\n\n                    if (attribute.equals(\"*\") || attribute.equals(OtherMetaView.TAG)) {\n                        for (int i = 0; i < attrs.tags().size(); i++) {\n                            put(buildAttrName(OtherMetaView.TAG,\n                                              i),\n                                attrs.tags().get(i));\n                        }\n                    }\n                    if (attribute.equals(\"*\")) {\n                        break;\n                    }\n                }\n            }\n        };\n    }\n\n    private static String buildAttrName(final String title,\n                                        final int i) {\n        return title + \"[\" + i + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/metadata/attribute/OtherMetaView.java",
    "content": "/*\n * Copyright 2013 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.TreeMap;\n\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.base.AbstractBasicFileAttributeView;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.NeedsPreloadedAttrs;\nimport org.uberfire.java.nio.base.NotImplementedException;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\nimport static org.uberfire.commons.data.Pair.newPair;\nimport static org.kie.soup.commons.validation.Preconditions.checkCondition;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotEmpty;\n\npublic class OtherMetaView\n        extends AbstractBasicFileAttributeView<AbstractPath>\n        implements NeedsPreloadedAttrs {\n\n    public static final String TAG = \"othermeta.tag\";\n    public static final String MODE = \"othermeta.mode\";\n\n    private static final Set<String> PROPERTIES = new HashSet<String>() {{\n        add(TAG);\n        add(MODE);\n    }};\n\n    private final OtherMetaAttributes attrs;\n\n    public OtherMetaView(final AbstractPath path) {\n        super(path);\n        final Map<String, Object> content = path.getAttrStorage().getContent();\n\n        final Map<Integer, String> _categories = new TreeMap<Integer, String>();\n\n        for (final Map.Entry<String, Object> entry : content.entrySet()) {\n            if (entry.getKey().startsWith(TAG)) {\n                final Pair<Integer, Object> result = extractValue(entry);\n                _categories.put(result.getK1(),\n                                result.getK2().toString());\n            }\n        }\n\n        final BasicFileAttributes fileAttrs = path.getFileSystem().provider().getFileAttributeView(path,\n                                                                                                   BasicFileAttributeView.class).readAttributes();\n\n        final List<String> categories = new ArrayList<String>(_categories.values());\n\n        this.attrs = new OtherMetaAttributes() {\n\n            @Override\n            public List<String> tags() {\n                return categories;\n            }\n\n            @Override\n            public FileTime lastModifiedTime() {\n                return fileAttrs.lastModifiedTime();\n            }\n\n            @Override\n            public FileTime lastAccessTime() {\n                return fileAttrs.lastAccessTime();\n            }\n\n            @Override\n            public FileTime creationTime() {\n                return fileAttrs.creationTime();\n            }\n\n            @Override\n            public boolean isRegularFile() {\n                return fileAttrs.isRegularFile();\n            }\n\n            @Override\n            public boolean isDirectory() {\n                return fileAttrs.isDirectory();\n            }\n\n            @Override\n            public boolean isSymbolicLink() {\n                return fileAttrs.isSymbolicLink();\n            }\n\n            @Override\n            public boolean isOther() {\n                return fileAttrs.isOther();\n            }\n\n            @Override\n            public long size() {\n                return fileAttrs.size();\n            }\n\n            @Override\n            public Object fileKey() {\n                return fileAttrs.fileKey();\n            }\n        };\n    }\n\n    private Pair<Integer, Object> extractValue(final Map.Entry<String, Object> entry) {\n        int start = entry.getKey().indexOf('[');\n        if (start < 0) {\n            return newPair(0,\n                           entry.getValue());\n        }\n        int end = entry.getKey().indexOf(']');\n\n        return newPair(Integer.valueOf(entry.getKey().substring(start + 1,\n                                                                end)),\n                       entry.getValue());\n    }\n\n    @Override\n    public String name() {\n        return \"othermeta\";\n    }\n\n    @Override\n    public OtherMetaAttributes readAttributes() throws IOException {\n        return attrs;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(final String... attributes) {\n        return OtherMetaAttributesUtil.toMap(readAttributes(),\n                                             attributes);\n    }\n\n    @Override\n    public Class<? extends BasicFileAttributeView>[] viewTypes() {\n        return new Class[]{OtherMetaView.class};\n    }\n\n    @Override\n    public void setAttribute(final String attribute,\n                             final Object value) throws IOException {\n        checkNotEmpty(\"attribute\",\n                      attribute);\n        checkCondition(\"invalid attribute\",\n                       PROPERTIES.contains(attribute));\n\n        throw new NotImplementedException();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/migration/ACLMigrationTool.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.migration;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.security.OrganizationalUnitAction;\nimport org.guvnor.structure.security.RepositoryAction;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\n\n/**\n * In previous versions (before the 7 release), the only way to grant access to resources like\n * {@link OrganizationalUnit}, {@link Repository} and {@link Module} was to indicate which groups were able to\n * access a given instance. Those groups were stored as part of the instance persistent status.\n * <p>\n * <p>As of 7 version, the authorization policy is based on permissions. That means is no longer required\n * to keep a list of groups per resource instance. What is required is to define proper permission entries into the\n * active {@link AuthorizationPolicy}</p>\n * <p>\n * <p>This is a utility class which takes care of reading the groups declared for any of the above resource types and\n * creating the necessary permissions so that those resources are protected from user access.</p>\n * <p>\n * <p>The migration procedure is carried out when an {@link AuthorizationPolicyDeployedEvent} is received, which means\n * the application is starting up and deploying the authorization policy for the first time.</p>\n */\n@ApplicationScoped\npublic class ACLMigrationTool {\n\n    private OrganizationalUnitService organizationalUnitService;\n    private RepositoryService repositoryService;\n    private PermissionManager permissionManager;\n    private AuthorizationPolicyStorage authorizationPolicyStorage;\n    private Map<String, Group> groupMap = new HashMap<>();\n\n    @Inject\n    public ACLMigrationTool(final OrganizationalUnitService organizationalUnitService,\n                            final RepositoryService repositoryService,\n                            final PermissionManager permissionManager,\n                            final AuthorizationPolicyStorage authorizationPolicyStorage) {\n        this.organizationalUnitService = organizationalUnitService;\n        this.repositoryService = repositoryService;\n        this.permissionManager = permissionManager;\n        this.authorizationPolicyStorage = authorizationPolicyStorage;\n    }\n\n    public void onDeploy(@Observes AuthorizationPolicyDeployedEvent event) {\n\n        if (!this.isACLMigrationToolEnabled()) {\n            return;\n        }\n\n        AuthorizationPolicy policy = event.getPolicy();\n        migrateOrgUnits(policy);\n        migrateRepositories(policy);\n        authorizationPolicyStorage.savePolicy(policy);\n    }\n\n    protected boolean isACLMigrationToolEnabled() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n\n    private Group getGroup(String groupName) {\n        Group group = groupMap.get(groupName);\n        if (group == null) {\n            group = new GroupImpl(groupName);\n            groupMap.put(groupName,\n                         group);\n        }\n        return group;\n    }\n\n    public void migrateOrgUnits(final AuthorizationPolicy policy) {\n\n        final Collection<OrganizationalUnit> itemList = organizationalUnitService.getAllOrganizationalUnits();\n\n        for (OrganizationalUnit organizationalUnit : itemList) {\n            final Permission permission = permissionManager.createPermission(organizationalUnit,\n                                                                             OrganizationalUnitAction.READ,\n                                                                             true);\n            for (final String groupName : organizationalUnit.getGroups()) {\n                final Group group = getGroup(groupName);\n                final PermissionCollection permissionCollection = policy.getPermissions(group);\n                permissionCollection.add(permission);\n            }\n        }\n    }\n\n    public void migrateRepositories(final AuthorizationPolicy policy) {\n\n        final Collection<Repository> itemList = repositoryService.getAllRepositoriesFromAllUserSpaces();\n\n        for (final Repository repository : itemList) {\n            final Permission permission = permissionManager.createPermission(repository,\n                                                                             RepositoryAction.READ,\n                                                                             true);\n            for (final String groupName : repository.getGroups()) {\n                final Group group = getGroup(groupName);\n                final PermissionCollection permissionCollection = policy.getPermissions(group);\n                permissionCollection.add(permission);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/preferences/WorkbenchPreferenceScopeResolutionStrategiesProducer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.preferences;\n\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.enterprise.inject.spi.InjectionPoint;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.shared.preferences.DefaultWorkbenchPreferenceScopeResolutionStrategies;\nimport org.guvnor.common.services.shared.preferences.WorkbenchPreferenceScopeResolutionStrategies;\nimport org.uberfire.annotations.Customizable;\nimport org.uberfire.preferences.shared.PreferenceScopeResolutionStrategy;\n\npublic class WorkbenchPreferenceScopeResolutionStrategiesProducer {\n\n    @Inject\n    private Instance<WorkbenchPreferenceScopeResolutionStrategies> workbenchPreferenceScopeResolutionStrategies;\n\n    @Inject\n    @Customizable\n    private PreferenceScopeResolutionStrategy preferenceScopeResolutionStrategy;\n\n    private DefaultWorkbenchPreferenceScopeResolutionStrategies defaultWorkbenchPreferenceScopeResolutionStrategies = null;\n\n    @Produces\n    @Customizable\n    public WorkbenchPreferenceScopeResolutionStrategies workbenchPreferenceScopeResolutionStrategiesProducer(final InjectionPoint ip) {\n        if (this.workbenchPreferenceScopeResolutionStrategies.isUnsatisfied()) {\n            return new DefaultWorkbenchPreferenceScopeResolutionStrategies(preferenceScopeResolutionStrategy);\n        }\n\n        return this.workbenchPreferenceScopeResolutionStrategies.get();\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/test/TestResultMessageAggregator.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.test;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.guvnor.common.services.shared.test.Failure;\nimport org.guvnor.common.services.shared.test.TestResultMessage;\n\npublic class TestResultMessageAggregator {\n\n    private int runCount = 0;\n    private Long runTime = 0L;\n    private List<Failure> failures = new ArrayList<Failure>();\n\n    public void add(TestResultMessage testResultMessage) {\n        runCount += testResultMessage.getRunCount();\n        runTime += testResultMessage.getRunTime();\n        failures.addAll(testResultMessage.getFailures());\n    }\n\n    public int getRunCountSum() {\n        return runCount;\n    }\n\n    public long getRuntimeSum() {\n        return runTime;\n    }\n\n    public List<Failure> getFailures() {\n        return failures;\n    }\n\n    public TestResultMessage getSummary(final String identifier) {\n        return new TestResultMessage(\n                identifier,\n                getRunCountSum(),\n                getRuntimeSum(),\n                getFailures());\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/test/TestRunnerServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.test;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.shared.test.TestResultMessage;\nimport org.guvnor.common.services.shared.test.TestRunnerService;\nimport org.guvnor.common.services.shared.test.TestService;\nimport org.uberfire.backend.vfs.Path;\n\n@ApplicationScoped\npublic class TestRunnerServiceImpl\n        implements TestRunnerService {\n\n    private Event<TestResultMessage> defaultTestResultMessageEvent;\n\n    private Instance<TestService> testServices;\n\n    public TestRunnerServiceImpl() {\n    }\n\n    @Inject\n    public TestRunnerServiceImpl(final @Any Instance<TestService> testServices,\n                                 final Event<TestResultMessage> defaultTestResultMessageEvent) {\n        this.testServices = testServices;\n        this.defaultTestResultMessageEvent = defaultTestResultMessageEvent;\n    }\n\n    @Override\n    public void runAllTests(final String identifier,\n                            final Path path) {\n        runAllTests(identifier,\n                    path,\n                    defaultTestResultMessageEvent);\n    }\n\n    @Override\n    public void runAllTests(final String identifier, Path path,\n                            final Event<TestResultMessage> customTestResultEvent) {\n        final TestResultMessageAggregator testResultEvent = new TestResultMessageAggregator();\n\n        for (final TestService testService : testServices) {\n            for (final TestResultMessage testResultMessage : testService.runAllTests(identifier,\n                                                                                     path)) {\n                testResultEvent.add(testResultMessage);\n            }\n        }\n\n        customTestResultEvent.fire(testResultEvent.getSummary(identifier));\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/java/org/guvnor/common/services/backend/util/CommentedOptionFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend.util;\n\nimport java.util.Date;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.backend.config.SafeSessionInfo;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.rpc.SessionInfo;\n\n@ApplicationScoped\npublic class CommentedOptionFactoryImpl\n        implements CommentedOptionFactory {\n\n    private static final String UNKNOWN_IDENTITY = \"unknown\";\n\n    private SafeSessionInfo safeSessionInfo;\n\n    public CommentedOptionFactoryImpl() {\n    }\n\n    @Inject\n    public CommentedOptionFactoryImpl(SessionInfo safeSessionInfo) {\n        this.safeSessionInfo = new SafeSessionInfo(safeSessionInfo);\n    }\n\n    @Override\n    public CommentedOption makeCommentedOption(final String commitMessage) {\n        new SafeSessionInfo(safeSessionInfo);\n        return makeCommentedOption(commitMessage,\n                                   safeSessionInfo.getIdentity(),\n                                   safeSessionInfo);\n    }\n\n    @Override\n    public CommentedOption makeCommentedOption(final String commitMessage,\n                                               final User identity,\n                                               final SessionInfo sessionInfo) {\n        return new CommentedOption(new SafeSessionInfo(sessionInfo).getId(),\n                                   getIdentityName(identity),\n                                   null,\n                                   commitMessage,\n                                   new Date());\n    }\n\n    @Override\n    public CommentedOption makeCommentedOption(final String sessionId,\n                                               final String commitMessage) {\n        return new CommentedOption(sessionId,\n                                   safeSessionInfo.getIdentity().getIdentifier(),\n                                   null,\n                                   commitMessage,\n                                   new Date());\n    }\n\n    @Override\n    public String getSafeSessionId() {\n        return safeSessionInfo.getId();\n    }\n\n    @Override\n    public String getSafeIdentityName() {\n        return safeSessionInfo.getIdentity().getIdentifier();\n    }\n\n    protected String getIdentityName(final User identity) {\n        try {\n            return identity.getIdentifier();\n        } catch (Exception e) {\n            return UNKNOWN_IDENTITY;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/MockIOService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.common.services.backend;\n\nimport java.io.BufferedReader;\nimport java.io.BufferedWriter;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.net.URI;\nimport java.nio.charset.Charset;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.channels.SeekableByteChannel;\nimport org.uberfire.java.nio.file.AtomicMoveNotSupportedException;\nimport org.uberfire.java.nio.file.CopyOption;\nimport org.uberfire.java.nio.file.DeleteOption;\nimport org.uberfire.java.nio.file.DirectoryNotEmptyException;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystemMetadata;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.InterruptedException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.NotDirectoryException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Option;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.ProviderNotFoundException;\nimport org.uberfire.java.nio.file.attribute.FileAttribute;\nimport org.uberfire.java.nio.file.attribute.FileAttributeView;\nimport org.uberfire.java.nio.file.attribute.FileTime;\n\npublic class MockIOService\n        implements IOService {\n\n    private ArrayList<Path> paths = new ArrayList<Path>();\n\n    public void setExistingPaths(Path... paths) {\n        for (Path path : paths) {\n            this.paths.add(path);\n        }\n    }\n\n    @Override\n    public void dispose() {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fileSystem) throws InterruptedException {\n\n    }\n\n    @Override\n    public void startBatch(FileSystem fileSystem,\n                           Option... options) throws InterruptedException {\n\n    }\n\n    @Override\n    public void endBatch() {\n\n    }\n\n    @Override\n    public FileAttribute<?>[] convert(Map<String, ?> stringMap) {\n        return new FileAttribute<?>[0];\n    }\n\n    @Override\n    public Path get(String s,\n                    String... strings) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Path get(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Iterable<FileSystemMetadata> getFileSystemMetadata() {\n        return null;\n    }\n\n    @Override\n    public FileSystem getFileSystem(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, ProviderNotFoundException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileSystem newFileSystem(URI uri,\n                                    Map<String, ?> stringMap) throws IllegalArgumentException, FileSystemAlreadyExistsException, ProviderNotFoundException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void onNewFileSystem(NewFileSystemListener newFileSystemListener) {\n\n    }\n\n    @Override\n    public InputStream newInputStream(Path path,\n                                      OpenOption... openOptions) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public OutputStream newOutputStream(Path path,\n                                        OpenOption... openOptions) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              OpenOption... openOptions) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public SeekableByteChannel newByteChannel(Path path,\n                                              Set<? extends OpenOption> openOptions,\n                                              FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path path) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public DirectoryStream<Path> newDirectoryStream(Path path,\n                                                    DirectoryStream.Filter<Path> pathFilter) throws IllegalArgumentException, NotDirectoryException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createFile(Path path,\n                           FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path path,\n                                FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path path,\n                                  FileAttribute<?>... fileAttributes) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectory(Path path,\n                                Map<String, ?> stringMap) throws IllegalArgumentException, UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createDirectories(Path path,\n                                  Map<String, ?> stringMap) throws UnsupportedOperationException, FileAlreadyExistsException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public void delete(Path path,\n                       DeleteOption... deleteOptions) throws IllegalArgumentException, NoSuchFileException, DirectoryNotEmptyException, IOException, SecurityException {\n\n    }\n\n    @Override\n    public boolean deleteIfExists(Path path,\n                                  DeleteOption... deleteOptions) throws IllegalArgumentException, DirectoryNotEmptyException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public Path createTempFile(String s,\n                               String s2,\n                               FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempFile(Path path,\n                               String s,\n                               String s2,\n                               FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(String s,\n                                    FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path createTempDirectory(Path path,\n                                    String s,\n                                    FileAttribute<?>... fileAttributes) throws IllegalArgumentException, UnsupportedOperationException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path copy(Path path,\n                     Path path2,\n                     CopyOption... copyOptions) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path move(Path path,\n                     Path path2,\n                     CopyOption... copyOptions) throws UnsupportedOperationException, FileAlreadyExistsException, DirectoryNotEmptyException, AtomicMoveNotSupportedException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public <V extends FileAttributeView> V getFileAttributeView(Path path,\n                                                                Class<V> vClass) throws IllegalArgumentException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Map<String, Object> readAttributes(Path path,\n                                              String s) throws UnsupportedOperationException, NoSuchFileException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              FileAttribute<?>... fileAttributes) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttributes(Path path,\n                              Map<String, Object> stringObjectMap) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path setAttribute(Path path,\n                             String s,\n                             Object o) throws UnsupportedOperationException, IllegalArgumentException, ClassCastException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Object getAttribute(Path path,\n                               String s) throws UnsupportedOperationException, IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public FileTime getLastModifiedTime(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long size(Path path) throws IllegalArgumentException, IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public boolean exists(Path path) throws IllegalArgumentException, SecurityException {\n        return paths.contains(path);\n    }\n\n    @Override\n    public boolean notExists(Path path) throws IllegalArgumentException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public boolean isSameFile(Path path,\n                              Path path2) throws IllegalArgumentException, IOException, SecurityException {\n        return false;\n    }\n\n    @Override\n    public BufferedReader newBufferedReader(Path path,\n                                            Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public BufferedWriter newBufferedWriter(Path path,\n                                            Charset charset,\n                                            OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public long copy(InputStream inputStream,\n                     Path path,\n                     CopyOption... copyOptions) throws IOException, FileAlreadyExistsException, DirectoryNotEmptyException, UnsupportedOperationException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public long copy(Path path,\n                     OutputStream outputStream) throws IOException, SecurityException {\n        return 0;\n    }\n\n    @Override\n    public byte[] readAllBytes(Path path) throws IOException, OutOfMemoryError, SecurityException {\n        return new byte[0];\n    }\n\n    @Override\n    public List<String> readAllLines(Path path) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public List<String> readAllLines(Path path,\n                                     Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path,\n                                Charset charset) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public String readAllString(Path path) throws IllegalArgumentException, NoSuchFileException, IOException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      OpenOption... openOptions) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      byte[] bytes,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      Iterable<? extends CharSequence> charSequences,\n                      Charset charset,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException, SecurityException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      Set<? extends OpenOption> openOptions,\n                      FileAttribute<?>... fileAttributes) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public Path write(Path path,\n                      String s,\n                      Charset charset,\n                      Map<String, ?> stringMap,\n                      OpenOption... openOptions) throws IllegalArgumentException, IOException, UnsupportedOperationException {\n        return null;\n    }\n\n    @Override\n    public int priority() {\n        return 0;\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/archive/ArchiverTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.archive;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.InputStream;\nimport java.net.URI;\nimport java.util.HashSet;\nimport java.util.zip.ZipEntry;\nimport java.util.zip.ZipInputStream;\n\nimport org.guvnor.common.services.backend.MockIOService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileSystemNotFoundException;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.OpenOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ArchiverTest {\n\n    private Archiver archiver;\n    private MockIOService ioService;\n\n    @Before\n    public void setUp() throws Exception {\n        final SimpleFileSystemProvider simpleFileSystemProvider = new SimpleFileSystemProvider();\n        simpleFileSystemProvider.forceAsDefault();\n\n        ioService = spy(new MockIOService() {\n\n            @Override\n            public Path get(URI uri) throws IllegalArgumentException, FileSystemNotFoundException, SecurityException {\n                return simpleFileSystemProvider.getPath(uri);\n            }\n\n            @Override\n            public InputStream newInputStream(Path path,\n                                              OpenOption... openOptions) throws IllegalArgumentException, NoSuchFileException, UnsupportedOperationException, IOException, SecurityException {\n                String resourcePath = path.toString().substring(path.toString().indexOf(\"test-classes\") + \"test-classes\".length());\n                if (resourcePath.startsWith(\"\\\\\")) {\n                    resourcePath = resourcePath.replaceAll(\"\\\\\\\\\", \"/\");\n                }\n                return getClass().getResourceAsStream(\n                        resourcePath);\n            }\n        });\n\n        archiver = new Archiver(ioService);\n    }\n\n    @Test\n    public void testZipRepository() throws Exception {\n        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\n        archiver.archive(outputStream,\n                         this.getClass().getResource(\"testRepository\").toURI().toString());\n\n        assertZipContains(outputStream,\n                          \"testRepository/project1/file1.txt\",\n                          \"testRepository/project2/file2.txt\");\n    }\n\n    @Test\n    public void testZipProject() throws Exception {\n        ByteArrayOutputStream outputStream = new ByteArrayOutputStream();\n\n        archiver.archive(outputStream,\n                         this.getClass().getResource(\"testRepository/project1\").toURI().toString());\n\n        assertZipContains(outputStream,\n                          \"project1/file1.txt\");\n    }\n\n    private void assertZipContains(ByteArrayOutputStream outputStream,\n                                   String... fileNames) throws java.io.IOException {\n        ZipInputStream zipInputStream = new ZipInputStream(new ByteArrayInputStream(outputStream.toByteArray()));\n\n        ZipEntry nextEntry = zipInputStream.getNextEntry();\n\n        HashSet<String> files = new HashSet<String>();\n\n        while (nextEntry != null) {\n\n            files.add(nextEntry.getName());\n\n            nextEntry = zipInputStream.getNextEntry();\n        }\n\n        for (String fileName : fileNames) {\n            assertTrue(\"Zip did not contain \" + fileName,\n                       files.contains(fileName));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/archive/FileNameResolverTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.archive;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class FileNameResolverTest {\n\n    @Test\n    public void testNormal() throws Exception {\n        assertEquals(\"hello/file.txt\",\n                     Archiver.FileNameResolver.resolve(\"hello/file.txt\",\n                                                       \"hello\"));\n    }\n\n    @Test\n    public void testFewFolders() throws Exception {\n        assertEquals(\"hello/file.txt\",\n                     Archiver.FileNameResolver.resolve(\"project/hello/file.txt\",\n                                                       \"project/hello\"));\n    }\n\n    @Test\n    public void testRoot() throws Exception {\n        assertEquals(\"file.txt\",\n                     Archiver.FileNameResolver.resolve(\"/file.txt\",\n                                                       \"/\"));\n    }\n\n    @Test\n    public void testRootFolder() throws Exception {\n        assertEquals(\"project/file.txt\",\n                     Archiver.FileNameResolver.resolve(\"/repositoryName/file.txt\",\n                                                       \"/repositoryName/\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/config/AppConfigServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.common.services.backend.preferences.ApplicationPreferencesLoader;\nimport org.guvnor.common.services.backend.preferences.SystemPropertiesInitializer;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.MockInstanceImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AppConfigServiceImplTest {\n\n    @Mock\n    private ApplicationPreferencesLoader preferencesLoader;\n    private Instance<ApplicationPreferencesLoader> preferencesLoaders;\n\n    @Mock\n    private SystemPropertiesInitializer systemPropertiesInitializer;\n    private Instance<SystemPropertiesInitializer> systemPropertiesInitializers;\n\n    private AppConfigServiceImpl appConfigService;\n\n    @Before\n    public void setup() {\n        preferencesLoaders = new MockInstanceImpl<>(preferencesLoader);\n        systemPropertiesInitializers = new MockInstanceImpl<>(systemPropertiesInitializer);\n\n        appConfigService = new AppConfigServiceImpl(preferencesLoaders,\n                                                    systemPropertiesInitializers);\n    }\n\n    @Test\n    public void systemPropertiesHavePriorityOnPreferencesLoaders() {\n        final Map<String, String> loaderProperties = new HashMap<>();\n        loaderProperties.put(\"property1\", \"loaderProperty1\");\n        loaderProperties.put(\"property2\", \"loaderProperty2\");\n        doReturn(loaderProperties).when(preferencesLoader).load();\n\n        System.setProperty(\"property1\", \"systemProperty1\");\n        System.setProperty(\"property3\", \"systemProperty3\");\n\n        final Map<String, String> preferences = appConfigService.loadPreferences();\n\n        assertEquals(2, preferences.size());\n        assertEquals(\"systemProperty1\", preferences.get(\"property1\"));\n        assertEquals(\"loaderProperty2\", preferences.get(\"property2\"));\n\n        verify(systemPropertiesInitializer).setSystemProperties(preferences);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/file/upload/AbstractFileServletTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.file.upload;\n\nimport java.io.InputStream;\nimport java.net.URISyntaxException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpSession;\n\nimport org.jboss.errai.bus.client.api.QueueSession;\nimport org.jboss.errai.bus.server.api.SessionProvider;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class AbstractFileServletTest {\n\n    @Mock\n    private SessionProvider provider;\n\n    @Mock\n    private HttpServletRequest request;\n\n    @Mock\n    private QueueSession queueSession;\n\n    @Mock\n    private HttpSession httpSession;\n\n    @Test\n    public void testGetSessionId() throws Exception {\n        final String clientId = \"1\";\n        final String sessionId = \"2\";\n\n        when(request.getSession(eq(true))).thenReturn(httpSession);\n        when(request.getParameter(eq(\"clientId\"))).thenReturn(clientId);\n        when(provider.createOrGetSession(httpSession,\n                                         clientId)).thenReturn(queueSession);\n        when(queueSession.getSessionId()).thenReturn(sessionId);\n\n        assertEquals(sessionId,\n                     abstractFileServlet().getSessionId(request,\n                                                        provider));\n    }\n\n    @Test\n    public void testGetSessionIdWhenClientIdIsMissing() throws Exception {\n        final String clientId = null;\n        final String sessionId = \"InvalidSessionId\";\n\n        when(request.getSession(eq(true))).thenReturn(httpSession);\n        when(request.getParameter(eq(\"clientId\"))).thenReturn(clientId);\n        when(provider.createOrGetSession(httpSession,\n                                         \"0\")).thenReturn(queueSession);\n        when(queueSession.getSessionId()).thenReturn(sessionId);\n\n        assertEquals(sessionId,\n                     abstractFileServlet().getSessionId(request,\n                                                        provider));\n    }\n\n    private AbstractFileServlet abstractFileServlet() {\n        return new AbstractFileServlet() {\n            @Override\n            protected InputStream doLoad(final Path path,\n                                         final HttpServletRequest request) {\n                return null;\n            }\n\n            @Override\n            protected void doCreate(final Path path,\n                                    final InputStream data,\n                                    final HttpServletRequest request,\n                                    final String comment) {\n\n            }\n\n            @Override\n            protected void doUpdate(final Path path,\n                                    final InputStream data,\n                                    final HttpServletRequest request,\n                                    final String comment) {\n\n            }\n\n            @Override\n            protected Path convertPath(final String fileName,\n                                       final String contextPath) throws URISyntaxException {\n                return null;\n            }\n\n            @Override\n            protected Path convertPath(final String fullPath) throws URISyntaxException {\n                return null;\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/metadata/MetadataCreatorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicBoolean;\n\nimport org.guvnor.common.services.backend.metadata.attribute.DiscussionView;\nimport org.guvnor.common.services.backend.metadata.attribute.GeneratedAttributesView;\nimport org.guvnor.common.services.backend.metadata.attribute.GeneratedFileAttributes;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaView;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.attribute.DublinCoreView;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionAttributes;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.NoSuchFileException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MetadataCreatorTest {\n\n    private SimpleFileSystemProvider fileSystemProvider;\n\n    @Mock\n    private IOService configIOService;\n    @Mock\n    private SessionInfo sessionInfo;\n    @Mock\n    private DublinCoreView dcoreView;\n    @Mock\n    private DiscussionView discussView;\n    @Mock\n    private OtherMetaView otherMetaView;\n    @Mock\n    private VersionAttributeView versionAttributeView;\n    @Mock\n    private GeneratedFileAttributes generatedFileAttributes;\n    @Mock\n    private GeneratedAttributesView generatedAttributesView;\n\n    private MetadataCreator service;\n    private Path mainFilePath;\n    private ArrayList<VersionRecord> versionRecords;\n\n    @Before\n    public void setUp() throws Exception {\n\n        versionRecords = new ArrayList<VersionRecord>();\n        versionRecords.add(createVersionRecord());\n\n        VersionAttributes versionAttributes = new VersionAttributesMock(versionRecords);\n        when(versionAttributeView.readAttributes()).thenReturn(versionAttributes);\n\n        when(dcoreView.readAttributes()).thenReturn(new DublinCoreAttributesMock());\n        when(otherMetaView.readAttributes()).thenReturn(new OtherMetaAttributesMock());\n        when(discussView.readAttributes()).thenReturn(new DiscussionAttributesMock());\n        when(generatedAttributesView.readAttributes()).thenReturn(generatedFileAttributes);\n\n        fileSystemProvider = new SimpleFileSystemProvider();\n\n        //Ensure URLs use the default:// scheme\n        fileSystemProvider.forceAsDefault();\n\n        mainFilePath = fileSystemProvider.getPath(this.getClass().getResource(\"myfile.file\").toURI());\n\n        service = new MetadataCreator(mainFilePath,\n                                      configIOService,\n                                      sessionInfo,\n                                      dcoreView,\n                                      discussView,\n                                      otherMetaView,\n                                      versionAttributeView,\n                                      generatedAttributesView);\n    }\n\n    @Test\n    public void testSimple() throws Exception {\n        Metadata metadata = service.create();\n\n        assertNotNull(metadata);\n        assertNotNull(metadata.getTags());\n        assertNotNull(metadata.getDiscussion());\n        assertNotNull(metadata.getVersion());\n    }\n\n    @Test\n    public void testGeneratedAttributes() {\n        when(generatedFileAttributes.isGenerated()).thenReturn(true);\n        when(generatedAttributesView.readAttributes()).thenReturn(generatedFileAttributes);\n\n        Metadata metadata = service.create();\n\n        assertTrue(metadata.isGenerated());\n    }\n\n    @Test\n    //See https://issues.jboss.org/browse/GUVNOR-2399\n    public void testConcurrency() throws Throwable {\n        //Ensure FileSystemProviders has been setup\n        FileSystemProviders.getDefaultProvider();\n\n        //Mock FileSystem operations\n        final AtomicBoolean exists = new AtomicBoolean(false);\n        when(configIOService.write(any(Path.class),\n                                   any(String.class))).<Path>thenAnswer(new Answer<Path>() {\n            @Override\n            public Path answer(final InvocationOnMock invocation) throws Throwable {\n                exists.set(true);\n                return mainFilePath;\n            }\n        });\n        when(configIOService.readAllString(any(Path.class))).<String>thenAnswer(new Answer<String>() {\n            @Override\n            public String answer(InvocationOnMock invocation) throws Throwable {\n                if (!exists.get()) {\n                    throw new NoSuchFileException();\n                }\n                return \"content\";\n            }\n        });\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                exists.set(false);\n                return null;\n            }\n        }).when(configIOService).delete(any(Path.class));\n\n        final int THREADS = 100;\n        final Result result = new Result();\n        final ExecutorService es = Executors.newCachedThreadPool();\n        for (int i = 0; i < THREADS; i++) {\n            final int threadCount = i;\n            final Operation op = i % 2 == 1 ? Operation.WRITE : Operation.CHECK;\n            es.execute(new Runnable() {\n                @Override\n                public void run() {\n                    try {\n\n                        System.out.println(\"[Thread : \" + threadCount + \"] Running...\");\n                        switch (op) {\n                            case WRITE:\n                                System.out.println(\"[Thread : \" + threadCount + \"] Writing...\" + output());\n                                configIOService.write(mainFilePath,\n                                                      \"content\");\n                                configIOService.delete(mainFilePath);\n                                break;\n                            case CHECK:\n                                System.out.println(\"[Thread : \" + threadCount + \"] Checking...\" + output());\n                                service.create();\n                        }\n                    } catch (Throwable e) {\n                        result.setFailed(true);\n                        result.setException(e);\n                    } finally {\n                        System.out.println(\"[Thread : \" + threadCount + \"] Completed.\");\n                    }\n                }\n\n                private String output() {\n                    if (exists.get()) {\n                        return \"Exists\";\n                    } else {\n                        return \"Not exists\";\n                    }\n                }\n            });\n        }\n\n        try {\n            es.shutdown();\n            es.awaitTermination(1000 * 5,\n                                TimeUnit.MILLISECONDS);\n        } catch (InterruptedException e) {\n        }\n        if (result.isFailed()) {\n            throw result.getException();\n        }\n    }\n\n    private enum Operation {\n        WRITE,\n        CHECK\n    }\n\n    private static class Result {\n\n        private Throwable exception;\n        private boolean failed = false;\n\n        public Throwable getException() {\n            return exception;\n        }\n\n        public void setException(Throwable exception) {\n            this.exception = exception;\n        }\n\n        public boolean isFailed() {\n            return failed;\n        }\n\n        public void setFailed(boolean failed) {\n            this.failed = failed;\n        }\n    }\n\n    private VersionRecord createVersionRecord() {\n        return new VersionRecord() {\n            @Override\n            public String id() {\n                return \"1\";\n            }\n\n            @Override\n            public String author() {\n                return \"admin\";\n            }\n\n            @Override\n            public String email() {\n                return \"admin@mail.zap\";\n            }\n\n            @Override\n            public String comment() {\n                return \"Some commit\";\n            }\n\n            @Override\n            public Date date() {\n                return new Date();\n            }\n\n            @Override\n            public String uri() {\n                return \"myfile.file\";\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/metadata/MetadataServiceImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.metadata;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.charset.StandardCharsets;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.commons.io.IOUtils;\nimport org.guvnor.common.services.backend.metadata.attribute.OtherMetaView;\nimport org.guvnor.common.services.backend.util.CommentedOptionFactory;\nimport org.guvnor.common.services.shared.exceptions.GenericPortableException;\nimport org.guvnor.common.services.shared.metadata.model.Metadata;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.BDDMockito;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.powermock.api.mockito.PowerMockito;\nimport org.powermock.core.classloader.annotations.PrepareForTest;\nimport org.powermock.modules.junit4.PowerMockRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyMap;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(PowerMockRunner.class)\n@PrepareForTest(IOUtils.class)\npublic class MetadataServiceImplTest {\n\n    private SimpleFileSystemProvider fileSystemProvider;\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private IOService configIOService;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private OtherMetaView otherMetaView;\n\n    @Mock\n    private CommentedOptionFactory commentedOptionFactory;\n\n    private Path path;\n    private MetadataServerSideService service;\n\n    @Before\n    public void setUp() throws Exception {\n        fileSystemProvider = new SimpleFileSystemProvider();\n\n        //Ensure URLs use the default:// scheme\n        fileSystemProvider.forceAsDefault();\n\n        path = fileSystemProvider.getPath(this.getClass().getResource(\"myfile.file\").toURI());\n\n        service = new MetadataServiceImpl(ioService,\n                                          configIOService,\n                                          commentedOptionFactory,\n                                          sessionInfo);\n    }\n\n    @Test\n    public void testGetEmptyTagsNoOtherMetaView() {\n        final List<String> tags = service.getTags(path);\n\n        assertNotNull(tags);\n        assertEquals(0,\n                     tags.size());\n    }\n\n    @Test\n    public void testSaveMetaData() throws IOException {\n        final InputStream is = spy(new ByteArrayInputStream(\"hello\".getBytes(StandardCharsets.UTF_8)));\n        doReturn(is).when(ioService).newInputStream(any(),\n                                                    any());\n        final CommentedOption comment = new CommentedOption(\"comment\");\n        doReturn(comment).when(commentedOptionFactory).makeCommentedOption(\"comment\");\n        service.saveMetadata(Paths.convert(path),\n                             new Metadata(),\n                             \"comment\");\n\n        verify(ioService).write(any(org.uberfire.java.nio.file.Path.class),\n                                any(byte[].class),\n                                anyMap(),\n                                eq(comment));\n        verify(is).close();\n    }\n\n    @Test(expected = GenericPortableException.class)\n    public void testSaveMetaDataException() throws IOException {\n        final InputStream is = new ByteArrayInputStream(\"hello\".getBytes(StandardCharsets.UTF_8));\n\n        try {\n\n            doReturn(is).when(ioService).newInputStream(any(),\n                                                        any());\n            PowerMockito.mockStatic(IOUtils.class);\n            BDDMockito.given(IOUtils.toByteArray(Mockito.<InputStream>any())).willThrow(IOException.class);\n\n            service.saveMetadata(Paths.convert(path),\n                                 new Metadata(),\n                                 \"comment\");\n        } finally {\n            is.close();\n        }\n    }\n\n    @Test\n    public void testGetEmptyTags() {\n        when(otherMetaView.readAttributes()).thenReturn(new OtherMetaAttributesMock());\n        when(ioService.getFileAttributeView(path,\n                                            OtherMetaView.class)).thenReturn(otherMetaView);\n        final List<String> tags = service.getTags(path);\n\n        assertNotNull(tags);\n        assertEquals(0,\n                     tags.size());\n    }\n\n    @Test\n    public void testGetTags() {\n        when(otherMetaView.readAttributes()).thenReturn(new OtherMetaAttributesMock() {\n\n            List<String> tags = new ArrayList<String>() {{\n                add(\"tag1\");\n            }};\n\n            @Override\n            public List<String> tags() {\n                return tags;\n            }\n        });\n        when(ioService.getFileAttributeView(path,\n                                            OtherMetaView.class)).thenReturn(otherMetaView);\n        final List<String> tags = service.getTags(path);\n\n        assertNotNull(tags);\n        assertEquals(1,\n                     tags.size());\n    }\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/metadata/attribute/GeneratedAttributesUtilTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class GeneratedAttributesUtilTest {\n\n    @Test\n    public void cleanup() {\n        Map<String, Object> originalAttributeMap = new HashMap<String, Object>() {{\n            put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME,\n                true);\n            put(\"customAttribute\",\n                \"value\");\n        }};\n\n        Map<String, Object> result = GeneratedAttributesUtil.cleanup(originalAttributeMap);\n\n        assertNull(result.get(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME));\n        assertNotNull(result.get(\"customAttribute\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/metadata/attribute/GeneratedFileAttributesViewTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.backend.metadata.attribute;\n\nimport java.util.HashMap;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.base.AbstractPath;\nimport org.uberfire.java.nio.base.AttrsStorage;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributeView;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.java.nio.file.spi.FileSystemProvider;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GeneratedFileAttributesViewTest {\n\n    @Test\n    public void readAttributesGeneratedFile() {\n        readAttributesTest(true);\n    }\n\n    @Test\n    public void readAttributesNonGeneratedFile() {\n        readAttributesTest(false);\n    }\n\n    private void readAttributesTest(final boolean generated) {\n        AttrsStorage attrsStorage = mock(AttrsStorage.class);\n        when(attrsStorage.getContent()).thenReturn(new HashMap<String, Object>() {{\n            put(GeneratedAttributesView.GENERATED_ATTRIBUTE_NAME,\n                generated);\n        }});\n        AbstractPath path = mock(AbstractPath.class);\n        when(path.getAttrStorage()).thenReturn(attrsStorage);\n\n        FileSystemProvider fileSystemProvider = mock(FileSystemProvider.class);\n        BasicFileAttributeView basicFileAttributeView = mock(BasicFileAttributeView.class);\n        when(basicFileAttributeView.readAttributes()).thenReturn(mock(BasicFileAttributes.class));\n        when(fileSystemProvider.getFileAttributeView(any(),\n                                                     any())).thenReturn(basicFileAttributeView);\n        FileSystem fileSystem = mock(FileSystem.class);\n        when(fileSystem.provider()).thenReturn(fileSystemProvider);\n        when(path.getFileSystem()).thenReturn(fileSystem);\n\n        GeneratedAttributesView view = new GeneratedAttributesView(path);\n\n        GeneratedFileAttributes generatedFileAttributes = view.readAttributes();\n\n        assertEquals(generated,\n                     generatedFileAttributes.isGenerated());\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/migration/ACLMigrationToolTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.migration;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.security.shared.api.GroupImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.authz.AuthorizationPolicyStorage;\nimport org.uberfire.backend.events.AuthorizationPolicyDeployedEvent;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.AuthorizationResult;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionCollection;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ACLMigrationToolTest {\n\n    @Mock\n    AuthorizationPolicyStorage policyStorage;\n\n    @Mock\n    OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    RepositoryService repositoryService;\n\n    @Mock\n    OrganizationalUnit orgUnit1;\n\n    @Mock\n    Repository repo1;\n\n    @Mock\n    Module module1;\n\n    @Mock\n    WorkspaceProject workspaceProject1;\n\n    @Spy\n    @InjectMocks\n    ACLMigrationTool migrationTool;\n\n    PermissionManager permissionManager;\n    AuthorizationPolicy authorizationPolicy;\n\n    @Before\n    public void setUp() {\n        permissionManager = new DefaultPermissionManager();\n        authorizationPolicy = permissionManager.newAuthorizationPolicy().build();\n        migrationTool = spy(new ACLMigrationTool(organizationalUnitService,\n                                                 repositoryService,\n                                                 permissionManager,\n                                                 policyStorage));\n\n        final Path repo1root = mock(Path.class);\n\n        when(organizationalUnitService.getAllOrganizationalUnits()).thenReturn(Collections.singleton(orgUnit1));\n        when(repositoryService.getAllRepositoriesFromAllUserSpaces()).thenReturn(Collections.singleton(repo1));\n\n        when(orgUnit1.getIdentifier()).thenReturn(\"orgUnit1\");\n        when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE);\n        when(orgUnit1.getGroups()).thenReturn(Collections.singleton(\"group1\"));\n\n        when(repo1.getIdentifier()).thenReturn(\"repo1\");\n        final Branch main = new Branch(\"main\",\n                                         repo1root);\n\n        when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);\n        final ArrayList<String> groupList = new ArrayList<>();\n        groupList.add(\"group1\");\n        groupList.add(\"group2\");\n        when(repo1.getGroups()).thenReturn(groupList);\n\n        when(migrationTool.isACLMigrationToolEnabled()).thenReturn(true);\n    }\n\n    @Test\n    public void migrationTest() {\n        migrationTool.onDeploy(new AuthorizationPolicyDeployedEvent(authorizationPolicy));\n\n        verify(migrationTool).migrateOrgUnits(authorizationPolicy);\n        verify(migrationTool).migrateRepositories(authorizationPolicy);\n        verify(policyStorage).savePolicy(authorizationPolicy);\n\n        assertEquals(authorizationPolicy.getRoles().size(),\n                     0);\n        assertEquals(authorizationPolicy.getGroups().size(),\n                     2);\n\n        PermissionCollection pc1 = authorizationPolicy.getPermissions(new GroupImpl(\"group1\"));\n        assertNotNull(pc1);\n        assertEquals(pc1.collection().size(),\n                     2);\n\n        Permission p1 = pc1.get(\"orgunit.read.orgUnit1\");\n        assertNotNull(p1);\n        assertEquals(p1.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        Permission p2 = pc1.get(\"repository.read.repo1\");\n        assertNotNull(p2);\n        assertEquals(p2.getResult(),\n                     AuthorizationResult.ACCESS_GRANTED);\n\n        PermissionCollection pc2 = authorizationPolicy.getPermissions(new GroupImpl(\"group2\"));\n        assertNotNull(pc2);\n        assertEquals(pc2.collection().size(),\n                     1);\n    }\n\n    @Test\n    public void testMonitoringEnabled() {\n        when(migrationTool.isACLMigrationToolEnabled()).thenReturn(false);\n        migrationTool.onDeploy(new AuthorizationPolicyDeployedEvent(authorizationPolicy));\n        verify(migrationTool, never()).migrateOrgUnits(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/test/TestResultMessageAggregatorTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.test;\n\nimport java.util.ArrayList;\n\nimport org.guvnor.common.services.shared.test.Failure;\nimport org.guvnor.common.services.shared.test.TestResultMessage;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\npublic class TestResultMessageAggregatorTest {\n\n    @Test\n    public void testEmpty() {\n        final TestResultMessageAggregator testResultMessageAggregator = new TestResultMessageAggregator();\n\n        assertEquals(0, testResultMessageAggregator.getRunCountSum());\n        assertEquals(0L, testResultMessageAggregator.getRuntimeSum());\n        assertEquals(0, testResultMessageAggregator.getFailures().size());\n        assertEquals(0, testResultMessageAggregator.getSummary(\"test\").getRunCount());\n        assertEquals(0L, testResultMessageAggregator.getSummary(\"test\").getRunTime());\n        assertEquals(0, testResultMessageAggregator.getSummary(\"test\").getFailures().size());\n    }\n\n    @Test\n    public void testSum() {\n        final TestResultMessageAggregator testResultMessageAggregator = new TestResultMessageAggregator();\n        testResultMessageAggregator.add(getTestResultMessage(1, 1L, new Failure()));\n        testResultMessageAggregator.add(getTestResultMessage(2, 2L, new Failure(), new Failure()));\n        testResultMessageAggregator.add(getTestResultMessage(3, 3L, new Failure(), new Failure(), new Failure()));\n\n        assertEquals(6, testResultMessageAggregator.getRunCountSum());\n        assertEquals(6L, testResultMessageAggregator.getRuntimeSum());\n        assertEquals(6, testResultMessageAggregator.getFailures().size());\n        assertEquals(6, testResultMessageAggregator.getSummary(\"test\").getRunCount());\n        assertEquals(6L, testResultMessageAggregator.getSummary(\"test\").getRunTime());\n        assertEquals(6, testResultMessageAggregator.getSummary(\"test\").getFailures().size());\n    }\n\n    private TestResultMessage getTestResultMessage(final int runCount,\n                                                   final long runTime,\n                                                   final Failure... failures) {\n        final ArrayList<Failure> failuresList = new ArrayList<>();\n        for (final Failure failure : failures) {\n            failuresList.add(failure);\n        }\n\n        return new TestResultMessage(\"test\",\n                                     runCount,\n                                     runTime,\n                                     failuresList);\n    }\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/java/org/guvnor/common/services/backend/test/TestRunnerServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.common.services.backend.test;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Instance;\n\nimport org.guvnor.common.services.shared.test.Failure;\nimport org.guvnor.common.services.shared.test.TestResultMessage;\nimport org.guvnor.common.services.shared.test.TestService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.only;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class TestRunnerServiceImplTest {\n\n    @Mock\n    private TestService testService1;\n\n    @Mock\n    private TestService testService2;\n\n    @Mock\n    private Event<TestResultMessage> defaultTestResultMessageEvent;\n\n    @Captor\n    private ArgumentCaptor<TestResultMessage> testResultMessageArgumentCaptor;\n\n    private TestRunnerServiceImpl testRunnerService;\n\n    @Before\n    public void setUp() throws Exception {\n        final Instance services = mock(Instance.class);\n\n        final ArrayList<Object> list = new ArrayList<>();\n\n        list.add(testService1);\n        list.add(testService2);\n        doReturn(list.iterator()).when(services).iterator();\n\n        testRunnerService = new TestRunnerServiceImpl(services,\n                                                      defaultTestResultMessageEvent);\n    }\n\n    @Test\n    public void runAllTests() throws Exception {\n\n        setUpTestService(testService1, 1, 200, 1);\n        setUpTestService(testService2, 2, 300, 2);\n\n        final Path path = mock(Path.class);\n        testRunnerService.runAllTests(\"id\", path);\n\n        verify(defaultTestResultMessageEvent, only()).fire(testResultMessageArgumentCaptor.capture());\n\n        final TestResultMessage testResultMessage = testResultMessageArgumentCaptor.getValue();\n        assertEquals(\"id\", testResultMessage.getIdentifier());\n        assertEquals(3, testResultMessage.getRunCount());\n        assertEquals(500, testResultMessage.getRunTime());\n        assertEquals(3, testResultMessage.getFailures().size());\n\n        verify(testService1).runAllTests(eq(\"id\"), eq(path));\n        verify(testService2).runAllTests(eq(\"id\"), eq(path));\n    }\n\n    @Test\n    public void runAllTestsCustomTestResultEvent() throws Exception {\n        setUpTestService(testService1, 2, 500, 1);\n        setUpTestService(testService2, 2, 300, 0);\n\n        final Path path = mock(Path.class);\n        final Event event = mock(Event.class);\n        testRunnerService.runAllTests(\"id\", path, event);\n\n        verify(event).fire(testResultMessageArgumentCaptor.capture());\n\n        final TestResultMessage testResultMessage = testResultMessageArgumentCaptor.getValue();\n        assertEquals(\"id\", testResultMessage.getIdentifier());\n        assertEquals(4, testResultMessage.getRunCount());\n        assertEquals(800, testResultMessage.getRunTime());\n        assertEquals(1, testResultMessage.getFailures().size());\n\n        verify(testService1).runAllTests(eq(\"id\"), eq(path));\n        verify(testService2).runAllTests(eq(\"id\"), eq(path));\n    }\n\n    private void setUpTestService(final TestService testService,\n                                  final int runCount,\n                                  final int runTime,\n                                  final int failureCount) {\n        doAnswer(invocationOnMock -> {\n\n            final ArrayList<Failure> failures = new ArrayList<>();\n\n            for (int i = 0; i < failureCount; i++) {\n                failures.add(new Failure());\n            }\n\n            return Collections.singletonList(new TestResultMessage((String) invocationOnMock.getArguments()[0],\n                                                                   runCount,\n                                                                   runTime,\n                                                                   failures));\n        }).when(testService).runAllTests(anyString(), any());\n    }\n}"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2014 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider"
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/resources/org/guvnor/common/services/backend/archive/testRepository/project1/file1.txt",
    "content": ""
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/resources/org/guvnor/common/services/backend/archive/testRepository/project2/file2.txt",
    "content": ""
  },
  {
    "path": "uberfire-services/uberfire-services-backend/src/test/resources/org/guvnor/common/services/backend/metadata/myfile.file",
    "content": ""
  },
  {
    "path": "uberfire-showcase/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n/src/main/webapp/WEB-INF/classes/\n/src/main/webapp/WEB-INF/deploy/\n/src/main/webapp/WEB-INF/lib/\n/src/main/webapp/org.uberfire.UberfireShowcase/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n.vfsjgit\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-showcase/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-showcase</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire Showcase</name>\n\n  <modules>\n    <module>uberfire-webapp</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-client-webapp/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-showcase</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-client-webapp</artifactId>\n  <packaging>war</packaging>\n\n  <name>UberFire Showcase Client Only WebApp</name>\n  <description>UberFire Showcase Client Only WebApp</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire Experimentals -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.inject</groupId>\n      <artifactId>guice</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-data-binding</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>gwt-maven-plugin</artifactId>\n        <configuration>\n          <module>org.uberfire.FastCompiledUberfireShowcaseClient</module>\n          <logLevel>INFO</logLevel>\n          <strict>true</strict>\n          <runTarget>index.html</runTarget>\n          <extraJvmArgs>-Xmx712m -XX:CompileThreshold=7000</extraJvmArgs>\n          <compileSourcesArtifacts>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-nio2-model</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-io</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-backend-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-js</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:appformer-js-bridge</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-client-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-views-patternfly</compileSourcesArtifact>\n\n            <!-- Uberfire Experimentals -->\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-client</compileSourcesArtifact>\n          </compileSourcesArtifacts>\n        </configuration>\n        <executions>\n          <execution>\n            <id>gwt-clean</id>\n            <phase>clean</phase>\n            <goals>\n              <goal>clean</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>gwt-compile</id>\n            <goals>\n              <goal>compile</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n    </plugins>\n\n  </build>\n\n  <profiles>\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <plugin><!-- Keep in sync with soa profile -->\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <!-- Build all GWT permutations and optimize them -->\n              <module>org.uberfire.UberfireShowcaseClient</module>\n              <draftCompile>false</draftCompile>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n    <!-- profile to disable GWT compilation of showcase (useful in full downstream builds) -->\n    <profile>\n      <id>no-showcase</id>\n      <build>\n        <plugins>\n          <plugin>\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <skip>true</skip>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/.gitignore",
    "content": "/target\n/local\n/src/main/gwt-unitCache/\n/src/main/webapp/WEB-INF/classes/\n/src/main/webapp/WEB-INF/deploy/\n/src/main/webapp/WEB-INF/lib/\n/src/main/webapp/org.uberfire.UberfireShowcase/\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n.niojgit\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-showcase</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-webapp</artifactId>\n  <packaging>war</packaging>\n\n  <name>UberFire Showcase WebApp</name>\n  <description>UberFire Showcase WebApp</description>\n\n  <properties>\n    <gwt.compiler.skip>false</gwt.compiler.skip>\n    <!-- Add the absolute path for $JBOSS_HOME below to manage another instance -->\n    <errai.jboss.home>${project.build.directory}/wildfly-${version.org.wildfly}</errai.jboss.home>\n  </properties>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-backend</artifactId>\n    </dependency>\n\n    <!-- dependencies added because of new illegal transitive dependency check -->\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <!--Logs-->\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>log4j-over-slf4j</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-all</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>log4j</groupId>\n          <artifactId>log4j</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-cdi</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.picketlink</groupId>\n      <artifactId>picketlink-idm-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.picketlink</groupId>\n      <artifactId>picketlink-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-picketlink</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-navigation</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-javax-enterprise</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-table</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.owasp.encoder</groupId>\n      <artifactId>encoder</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire SSH -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire Preferences -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-ui-client</artifactId>\n      <!--<scope>provided</scope>-->\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-client-backend</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-preferences-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire Plugins Extension -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-backend</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-runtime-plugins-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- UberFire Commons Editor -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-backend</artifactId>\n    </dependency>\n\n    <!-- Layout Editor API -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-layout-editor-api</artifactId>\n    </dependency>\n\n    <!-- UberFire Apps -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-apps-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-apps-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-apps-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-jboss-as-support</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-jboss</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-codegen-gwt</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <!-- Uberfire Docks -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-simple-docks-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <!-- Uberfire Experimentals -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>base</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.inject</groupId>\n      <artifactId>guice</artifactId>\n    </dependency>\n\n    <!-- missing deps to avoid illegal transitive type dependencies -->\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-service-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-properties-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n      </dependency>\n\n    <dependency>  \n      <groupId>org.jboss.errai</groupId>\t      \n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-data-binding</artifactId>\n    </dependency>\n    \n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-bridge</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.servlet</groupId>\n      <artifactId>jakarta.servlet-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <finalName>${project.artifactId}</finalName>\n    <outputDirectory>src/main/webapp/WEB-INF/classes</outputDirectory>\n\n    <plugins>\n      <plugin>\n        <groupId>org.codehaus.mojo</groupId>\n        <artifactId>gwt-maven-plugin</artifactId>\n        <configuration>\n          <extraJvmArgs>-Xmx2G -XX:CompileThreshold=7000 -Derrai.jboss.home=${errai.jboss.home} -Derrai.ioc.jsinterop.support=true -Dappformer.experimental.features=true -Dorg.uberfire.nio.git.ssh.enabled=true</extraJvmArgs>\n          <strict>true</strict>\n          <logLevel>INFO</logLevel>\n          <noServer>false</noServer>\n          <server>org.jboss.errai.cdi.server.gwt.EmbeddedWildFlyLauncher</server>\n          <module>org.uberfire.FastCompiledUberfireShowcase</module>\n          <disableCastChecking>true</disableCastChecking>\n          <runTarget>index.html</runTarget>\n          <hostedWebapp>src/main/webapp</hostedWebapp>\n          <module>org.uberfire.FastCompiledUberfireShowcase</module>\n          <generateJsInteropExports>true</generateJsInteropExports>\n          <compileSourcesArtifacts>\n            <compileSourcesArtifact>org.kie.soup:kie-soup-commons</compileSourcesArtifact>\n            <!-- UberFire -->\n            <compileSourcesArtifact>org.uberfire:uberfire-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-nio2-model</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-io</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-js</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:appformer-js-bridge</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-security-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-client-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-backend</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-workbench-client-views-patternfly</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-backend-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-ssh-client</compileSourcesArtifact>\n\n            <!-- UF-ext -->\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client-backend</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-preferences-ui-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-runtime-plugins-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-apps-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-apps-client</compileSourcesArtifact>\n\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-commons-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-commons</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-table</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-properties-editor-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-service-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-widgets-core-client</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-simple-docks-client</compileSourcesArtifact>\n\n            <!-- Uberfire Experimentals -->\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-api</compileSourcesArtifact>\n            <compileSourcesArtifact>org.uberfire:uberfire-experimental-client</compileSourcesArtifact>\n\n          </compileSourcesArtifacts>\n        </configuration>\n        <executions>\n          <execution>\n            <id>gwt-clean</id>\n            <phase>clean</phase>\n            <goals>\n              <goal>clean</goal>\n            </goals>\n          </execution>\n          <execution>\n            <id>gwt-compile</id>\n            <goals>\n              <goal>compile</goal>\n            </goals>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.jboss.errai</groupId>\n                  <artifactId>wildfly-dist</artifactId>\n                  <version>${version.org.jboss.errai.wildfly}</version>\n                  <type>zip</type>\n                  <overWrite>false</overWrite>\n                  <outputDirectory>${project.build.directory}</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <skip>${gwt.compiler.skip}</skip>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <artifactId>maven-war-plugin</artifactId>\n        <configuration>\n          <packagingExcludes>**/javax/**/*.*,**/client/**/*.class,**/*.symbolMap</packagingExcludes>\n          <archive>\n            <addMavenDescriptor>false</addMavenDescriptor>\n          </archive>\n        </configuration>\n      </plugin>\n      <plugin>\n        <artifactId>maven-clean-plugin</artifactId>\n        <configuration>\n          <filesets>\n            <fileset>\n              <directory>${basedir}</directory>\n              <includes>\n                <include>src/main/webapp/org.uberfire.UberfireShowcase/</include>\n                <include>src/main/webapp/WEB-INF/deploy/</include>\n                <include>src/main/webapp/WEB-INF/classes/</include>\n                <include>src/main/webapp/WEB-INF/lib/</include>\n                <include>repositories/</include>\n                <include>.errai/</include>\n                <include>.niogit/**</include>\n                <include>.index/**</include>\n                <include>.security/**</include>\n              </includes>\n            </fileset>\n          </filesets>\n        </configuration>\n      </plugin>\n    </plugins>\n\n  </build>\n\n  <profiles>\n    <profile>\n      <id>fullProfile</id>\n      <activation>\n        <property>\n          <name>full</name>\n        </property>\n      </activation>\n      <build>\n        <plugins>\n          <plugin><!-- Keep in sync with soa profile -->\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <!-- Build all GWT permutations and optimize them -->\n              <module>org.uberfire.UberfireShowcase</module>\n              <draftCompile>false</draftCompile>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n    <!-- profile to disable GWT compilation of showcase (useful in full downstream builds) -->\n    <profile>\n      <id>no-showcase</id>\n      <build>\n        <plugins>\n          <plugin>\n            <groupId>org.codehaus.mojo</groupId>\n            <artifactId>gwt-maven-plugin</artifactId>\n            <configuration>\n              <skip>true</skip>\n            </configuration>\n          </plugin>\n        </plugins>\n      </build>\n    </profile>\n  </profiles>\n\n</project>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/filtered-webapp/AboutInfo.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<html>\n  <body>\n    <p>Version ${project.version}</p>\n    <p>&copy; ${project.inceptionYear} <a href=\"${project.organization.url}\">${project.organization.name}</a></p>\n  </body>\n</html>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/AppSetup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.impl;\n\nimport java.net.URI;\nimport java.util.HashMap;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\n\n@ApplicationScoped\n@Startup\npublic class AppSetup {\n\n    private static final String PLAYGROUND_ORIGIN = \"https://github.com/guvnorngtestuser1/guvnorng-playground.git\";\n    private static final String PLAYGROUND_UID = \"guvnorngtestuser1\";\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @PostConstruct\n    public void assertPlayground() {\n        try {\n            ioService.newFileSystem(URI.create(\"default://uf-playground\"),\n                                    new HashMap<String, Object>() {{\n                                        put(\"origin\",\n                                            PLAYGROUND_ORIGIN);\n                                        put(\"username\",\n                                            PLAYGROUND_UID);\n                                    }});\n        } catch (final FileSystemAlreadyExistsException ignore) {\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/ApplicationScopedProducer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.impl;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.RequestScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.uberfire.backend.server.IOWatchServiceAllImpl;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.commons.services.cdi.StartupType;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceNio2WrapperImpl;\n\n@Startup(StartupType.BOOTSTRAP)\n@ApplicationScoped\npublic class ApplicationScopedProducer {\n\n    private IOWatchServiceAllImpl watchService;\n    private AuthenticationService authenticationService;\n\n    private IOService ioService;\n\n    public ApplicationScopedProducer() {\n\n    }\n\n    @Inject\n    public ApplicationScopedProducer(IOWatchServiceAllImpl watchService,\n                                     AuthenticationService authenticationService) {\n        this.watchService = watchService;\n        this.authenticationService = authenticationService;\n    }\n\n    @PostConstruct\n    public void setup() {\n        ioService = new IOServiceNio2WrapperImpl(\"1\",\n                                                 watchService);\n    }\n\n    @Produces\n    @Named(\"ioStrategy\")\n    public IOService ioService() {\n        return ioService;\n    }\n\n    @Produces\n    @RequestScoped\n    public User getIdentity() {\n        return authenticationService.getUser();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/ExperimentalEditorServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.impl;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.shared.experimental.ExperimentalAssetRemoved;\nimport org.uberfire.shared.experimental.ExperimentalEditorService;\nimport org.uberfire.spaces.SpacesAPI;\n\n@Service\n@ApplicationScoped\npublic class ExperimentalEditorServiceImpl implements ExperimentalEditorService {\n\n    public static final String STORAGE_PATH = \"content\";\n\n    public static final String SEPARATOR = \"/\";\n\n    public static final String EXTENSION = \".exp\";\n\n    private SpacesAPI spaces;\n\n    private IOService ioService;\n\n    private FileSystem fileSystem;\n\n    private Event<ExperimentalAssetRemoved> assetRemovedEvent;\n\n    ExperimentalEditorServiceImpl() {\n        // Zero argument constructor for CDI proxies\n    }\n\n    @Inject\n    public ExperimentalEditorServiceImpl(final SpacesAPI spaces, @Named(\"configIO\") final IOService ioService, final Event<ExperimentalAssetRemoved> assetRemovedEvent) {\n        this.spaces = spaces;\n        this.ioService = ioService;\n        this.assetRemovedEvent = assetRemovedEvent;\n    }\n\n    @PostConstruct\n    public void init() {\n        initializeFileSystem();\n    }\n\n    @Override\n    public List<Path> listAll() {\n\n        org.uberfire.java.nio.file.Path path = fileSystem.getPath(STORAGE_PATH);\n\n        final List<Path> result = new ArrayList<>();\n\n        ioService.newDirectoryStream(path, entry -> entry.getFileName().toString().endsWith(EXTENSION)).forEach(assetPath -> result.add(Paths.convert(assetPath)));\n\n        return result;\n    }\n\n    @Override\n    public Path create(String assetName) {\n\n        String path = STORAGE_PATH + SEPARATOR + assetName + EXTENSION;\n\n        org.uberfire.java.nio.file.Path fsPath = fileSystem.getPath(path);\n\n        if (!ioService.exists(fsPath)) {\n            ioService.write(fsPath, \"\");\n            return Paths.convert(fsPath);\n        }\n\n        throw new FileAlreadyExistsException(fsPath.toString());\n    }\n\n    @Override\n    public String load(Path path) {\n\n        org.uberfire.java.nio.file.Path fsPath = Paths.convert(path);\n\n        if (ioService.exists(fsPath)) {\n            return ioService.readAllString(fsPath);\n        }\n\n        return null;\n    }\n\n    @Override\n    public void save(Path path, String content) {\n        org.uberfire.java.nio.file.Path fsPath = Paths.convert(path);\n\n        if (ioService.exists(fsPath)) {\n            ioService.write(fsPath, content);\n        }\n    }\n\n    @Override\n    public void delete(Path path, String comment) {\n        final org.uberfire.java.nio.file.Path fsPath = Paths.convert(path);\n\n        try {\n            ioService.startBatch(fsPath.getFileSystem());\n\n            ioService.delete(Paths.convert(path));\n\n            assetRemovedEvent.fire(new ExperimentalAssetRemoved(path));\n        } catch (final Exception e) {\n            throw new RuntimeException(e);\n        } finally {\n            ioService.endBatch();\n        }\n    }\n\n    protected void initializeFileSystem() {\n        final URI fileSystemURI = spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT, SpacesAPI.DEFAULT_SPACE, \"experimental\");\n\n        try {\n            Map<String, Object> options = new HashMap<>();\n\n            options.put(\"init\", Boolean.TRUE);\n            options.put(\"internal\", Boolean.TRUE);\n\n            fileSystem = ioService.newFileSystem(fileSystemURI, options);\n        } catch (FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(fileSystemURI);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/PicketLinkDefaultUsers.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.backend.server.impl;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.picketlink.authentication.event.PreAuthenticateEvent;\nimport org.picketlink.idm.IdentityManager;\nimport org.picketlink.idm.PartitionManager;\nimport org.picketlink.idm.RelationshipManager;\nimport org.picketlink.idm.credential.Password;\nimport org.picketlink.idm.model.basic.Grant;\nimport org.picketlink.idm.model.basic.Role;\nimport org.picketlink.idm.model.basic.User;\n\n@ApplicationScoped\npublic class PicketLinkDefaultUsers {\n\n    @Inject\n    private PartitionManager partitionManager;\n\n    private boolean done = false;\n\n    /**\n     * Creates example users so people can log in while trying out the app.\n     */\n    public synchronized void create(@Observes PreAuthenticateEvent event) {\n        if (done) {\n            return;\n        }\n\n        done = true;\n\n        final IdentityManager identityManager = partitionManager.createIdentityManager();\n        final RelationshipManager relationshipManager = partitionManager.createRelationshipManager();\n\n        User admin = new User(\"admin\");\n\n        admin.setEmail(\"john@doe.com\");\n        admin.setFirstName(\"John\");\n        admin.setLastName(\"Doe\");\n\n        User nonAdmin = new User(\"joe\");\n\n        nonAdmin.setEmail(\"joe@doe.com\");\n        nonAdmin.setFirstName(\"Joe\");\n        nonAdmin.setLastName(\"Doe\");\n\n        identityManager.add(admin);\n        identityManager.add(nonAdmin);\n        identityManager.updateCredential(admin,\n                                         new Password(\"admin\"));\n        identityManager.updateCredential(nonAdmin,\n                                         new Password(\"joe\"));\n\n        Role roleSimple = new Role(\"simple\");\n        Role roleAdmin = new Role(\"admin\");\n\n        identityManager.add(roleSimple);\n        identityManager.add(roleAdmin);\n\n        relationshipManager.add(new Grant(admin,\n                                          roleSimple));\n        relationshipManager.add(new Grant(admin,\n                                          roleAdmin));\n\n        relationshipManager.add(new Grant(nonAdmin,\n                                          roleSimple));\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/backend/server/impl/ResourceUpdateDebugger.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.backend.server.impl;\n\nimport javax.enterprise.event.Observes;\nimport javax.inject.Named;\n\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n@Named(\"debug\")\n@Startup\npublic class ResourceUpdateDebugger {\n\n    public void onNewFile(@Observes ResourceAddedEvent event) {\n        System.err.println(\"ResourceAddedEvent:\" + event.getPath().toURI() + \" ['\" + event.getMessage() + \"']\");\n    }\n\n    public void onUpdateFile(@Observes ResourceUpdatedEvent event) {\n        System.err.println(\"ResourceUpdatedEvent:\" + event.getPath().toURI() + \" ['\" + event.getMessage() + \"']\");\n    }\n\n    public void onRenameFile(@Observes ResourceRenamedEvent event) {\n        System.err.println(\"ResourceRenamedEvent:\" + event.getPath().toURI() + \" -> \" + event.getDestinationPath().toURI() + \" ['\" + event.getMessage() + \"']\");\n    }\n\n    public void onDeleteFile(@Observes ResourceDeletedEvent event) {\n        System.err.println(\"ResourceDeletedEvent:\" + event.getPath().toURI() + \" ['\" + event.getMessage() + \"']\");\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/ShowcaseEntryPoint.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport com.google.common.collect.Sets;\nimport com.google.gwt.animation.client.Animation;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.uberfire.client.experimental.perspectives.ExperimentalPerspective;\nimport org.uberfire.client.menu.CustomSplashHelp;\nimport org.uberfire.client.menu.WorkbenchViewModeSwitcherMenuBuilder;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.client.navbar.SearchMenuBuilder;\nimport org.uberfire.client.perspectives.MultiScreenPerspective;\nimport org.uberfire.client.perspectives.SimplePerspective;\nimport org.uberfire.client.resources.AppResource;\nimport org.uberfire.client.resources.i18n.Constants;\nimport org.uberfire.client.screen.JSWorkbenchScreenActivity;\nimport org.uberfire.client.screens.popup.SimplePopUp;\nimport org.uberfire.client.views.pfly.PatternFlyEntryPoint;\nimport org.uberfire.client.views.pfly.menu.MainBrand;\nimport org.uberfire.client.views.pfly.menu.UserMenu;\nimport org.uberfire.client.views.pfly.modal.Bs3Modal;\nimport org.uberfire.client.views.pfly.modal.ErrorPopupView;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.client.workbench.StandaloneEditorPerspective;\nimport org.uberfire.client.workbench.events.ApplicationReadyEvent;\nimport org.uberfire.client.workbench.widgets.menu.UtilityMenuBar;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar;\nimport org.uberfire.experimental.client.perspective.ExperimentalFeaturesPerspective;\nimport org.uberfire.ext.apps.client.AppsPerspective;\nimport org.uberfire.ext.plugin.client.perspective.PlugInAuthoringPerspective;\nimport org.uberfire.ext.plugin.client.perspective.editor.generator.PerspectiveEditorScreenActivity;\nimport org.uberfire.ext.plugin.client.perspective.editor.layout.editor.PerspectiveEditorSettings;\nimport org.uberfire.ext.preferences.client.admin.AdminPagePerspective;\nimport org.uberfire.ext.preferences.client.central.PreferencesCentralPerspective;\nimport org.uberfire.jsbridge.client.AppFormerJsBridge;\nimport org.uberfire.jsbridge.client.loading.ActivityLazyLoaded;\nimport org.uberfire.jsbridge.client.loading.JsWorkbenchLazyPerspectiveActivity;\nimport org.uberfire.jsbridge.client.screen.JsWorkbenchScreenActivity;\nimport org.uberfire.mvp.Commands;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.PluginAddedEvent;\nimport org.uberfire.workbench.events.PluginUpdatedEvent;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.workbench.model.menu.MenuFactory.newTopLevelCustomMenu;\nimport static org.uberfire.workbench.model.menu.MenuFactory.newTopLevelMenu;\n\n/**\n * GWT's Entry-point for Uberfire-showcase\n */\n@EntryPoint\n@Bundle(\"resources/i18n/Constants.properties\")\npublic class ShowcaseEntryPoint {\n\n    private static final Set<String> menuItemsToRemove = Sets.newHashSet(\n            \"IFrameScreen\",\n            \"IPInfoGadget\",\n            \"SportsNewsGadget\",\n            \"StockQuotesGadget\",\n            \"WeatherGadget\",\n            \"YouTubeScreen\",\n            \"YouTubeVideos\",\n            \"chartPopulator\",\n            \"welcome\"\n    );\n    @Inject\n    private SyncBeanManager manager;\n    @Inject\n    private WorkbenchMenuBar menubar;\n    @Inject\n    private UserMenu userMenu;\n    @Inject\n    private User user;\n    @Inject\n    private UtilityMenuBar utilityMenu;\n    @Inject\n    private PlaceManager placeManager;\n    @Inject\n    private ActivityManager activityManager;\n    @Inject\n    private Caller<AuthenticationService> authService;\n    @Inject\n    private SearchMenuBuilder searchMenuBuilder;\n    @Inject\n    private ErrorPopupView errorPopupView;\n    @Inject\n    private PatternFlyEntryPoint pflyEntryPoint;\n    @Inject\n    private PerspectiveEditorSettings perspectiveEditorSettings;\n    @Inject\n    private AppFormerJsBridge appFormerJsBridge;\n\n    public static List<MenuItem> getScreens() {\n        final List<MenuItem> screens = new ArrayList<>();\n        final List<String> names = new ArrayList<>();\n\n        for (final IOCBeanDef<WorkbenchScreenActivity> _menuItem : IOC.getBeanManager().lookupBeans(WorkbenchScreenActivity.class)) {\n            final String name;\n            if (!_menuItem.getBeanClass().equals(PerspectiveEditorScreenActivity.class)) {\n                if (Arrays.asList(JSWorkbenchScreenActivity.class, JsWorkbenchScreenActivity.class).contains(_menuItem.getBeanClass())) {\n                    name = _menuItem.getName();\n                } else {\n                    name = IOC.getBeanManager().lookupBean(_menuItem.getBeanClass()).getName();\n                }\n\n                if (!menuItemsToRemove.contains(name)) {\n                    names.add(name);\n                }\n            }\n        }\n\n        Collections.sort(names);\n\n        final PlaceManager placeManager = IOC.getBeanManager().lookupBean(PlaceManager.class).getInstance();\n        for (final String name : names) {\n            final MenuItem item = MenuFactory.newSimpleItem(name)\n                    .identifier(\"screen.read.\" + name)\n                    .respondsWith(() -> {\n                        placeManager.goTo(new DefaultPlaceRequest(name));\n                    }).endMenu().build().getItems().get(0);\n            screens.add(item);\n        }\n\n        return screens;\n    }\n\n    @PostConstruct\n    public void startApp() {\n        PatternFlyBootstrapper.ensureMomentIsAvailable();\n        PatternFlyBootstrapper.ensureBootstrapDateRangePickerIsAvailable();\n        perspectiveEditorSettings.setTagsEnabled(true);\n        hideLoadingPopup();\n        GWT.log(\"PatternFly version: \" + pflyEntryPoint.getPatternFlyVersion());\n        GWT.log(\"Loaded MomentJS using locale: \" + pflyEntryPoint.getMomentLocale());\n\n        GWT.log(\"Exposing JS bridge\");\n        appFormerJsBridge.init(\"org.uberfire.UberfireShowcase\");\n    }\n\n    private void onApplicationReady(@Observes final ApplicationReadyEvent event) {\n        setupMenu();\n    }\n\n    private void setupMenu() {\n        final PerspectiveActivity defaultPerspective = getDefaultPerspectiveActivity();\n\n        final Menus menus =\n                newTopLevelMenu(\"Home\")\n                        .perspective(defaultPerspective.getIdentifier())\n                        .endMenu()\n                        .newTopLevelMenu(\"Perspectives\")\n                        .withItems(getPerspectives())\n                        .endMenu()\n                        .newTopLevelMenu(\"Screens\")\n                        .withItems(getScreens())\n                        .endMenu()\n                        .newTopLevelCustomMenu(searchMenuBuilder)\n                        .endMenu()\n                        .build();\n\n        menubar.clear();\n        menubar.addMenus(menus);\n\n        userMenu.addMenus(\n                newTopLevelMenu(\"Logout\").respondsWith(() -> {\n                    authService.call().logout();\n                }).endMenu()\n                        .newTopLevelMenu(\"My roles\").respondsWith(() -> {\n                    final Set<Role> roles = user.getRoles();\n                    if (roles == null || roles.isEmpty()) {\n                        Window.alert(\"You have no roles assigned\");\n                    } else {\n                        Window.alert(\"Currently logged in using roles: \" + roles);\n                    }\n                })\n                        .endMenu()\n                        .newTopLevelCustomMenu(manager.lookupBean(WorkbenchViewModeSwitcherMenuBuilder.class).getInstance())\n                        .endMenu()\n                        .build());\n\n        utilityMenu.addMenus(\n                newTopLevelCustomMenu(userMenu).endMenu()\n                        .newTopLevelMenu(\"Status\")\n                        .identifier(\"usermenu.status\")\n                        .respondsWith(() -> {\n                            Window.alert(\"Hello from status!\");\n                        })\n                        .endMenu()\n                        .newTopLevelCustomMenu(manager.lookupBean(CustomSplashHelp.class).getInstance())\n                        .endMenu()\n                        .newTopLevelMenu(\"Simple Popup\")\n                        .respondsWith(() -> placeManager.goTo(new DefaultPlaceRequest(SimplePopUp.SCREEN_ID)))\n                        .endMenu()\n                        .newTopLevelMenu(\"Error Popup\")\n                        .respondsWith(() -> errorPopupView.showMessage(\"Something went wrong!\",\n                                                                       Commands.DO_NOTHING,\n                                                                       Commands.DO_NOTHING))\n                        .endMenu()\n                        .build());\n    }\n\n    private List<MenuItem> getPerspectives() {\n        final List<MenuItem> perspectives = new ArrayList<>();\n\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.admin_perspective(), AdminPagePerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.apps_perspective(), AppsPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.experimental_features_editor(), ExperimentalFeaturesPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.experimental_perspective(), ExperimentalPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.multi_screem_perspective(), MultiScreenPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.plugin_authoring(), PlugInAuthoringPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.preferences_perspective(), PreferencesCentralPerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.simple_perspective(), SimplePerspective.IDENTIFIER));\n        perspectives.add(buildPerspectiveMenuItem(Constants.INSTANCE.standalone_editor_perspective(), StandaloneEditorPerspective.IDENTIFIER));\n\n        getJsPerspectiveActivities().forEach(activity -> perspectives.add(buildPerspectiveMenuItem(activity.getName(), activity.getIdentifier())));\n\n        return perspectives;\n    }\n\n    private MenuItem buildPerspectiveMenuItem(final String perspectiveName, final String perspectiveIdentifier) {\n        return MenuFactory.newSimpleItem(perspectiveName).perspective(perspectiveIdentifier).endMenu().build().getItems().get(0);\n    }\n\n    private PerspectiveActivity getDefaultPerspectiveActivity() {\n        PerspectiveActivity defaultPerspective = null;\n        final Collection<SyncBeanDef<PerspectiveActivity>> perspectives = manager.lookupBeans(PerspectiveActivity.class);\n        final Iterator<SyncBeanDef<PerspectiveActivity>> perspectivesIterator = perspectives.iterator();\n\n        while (perspectivesIterator.hasNext()) {\n            final SyncBeanDef<PerspectiveActivity> perspective = perspectivesIterator.next();\n            final PerspectiveActivity instance = perspective.getInstance();\n            if (instance.isDefault()) {\n                defaultPerspective = instance;\n                break;\n            } else {\n                manager.destroyBean(instance);\n            }\n        }\n        return defaultPerspective;\n    }\n\n    private List<PerspectiveActivity> getJsPerspectiveActivities() {\n\n        //Get Perspective Providers\n        final Set<JsWorkbenchLazyPerspectiveActivity> activities = activityManager.getActivities(JsWorkbenchLazyPerspectiveActivity.class);\n\n        //Remove default perspective to avoid duplicate menu\n        final Iterator<JsWorkbenchLazyPerspectiveActivity> iterator = activities.iterator();\n        while (iterator.hasNext()) {\n            final PerspectiveActivity activity = iterator.next();\n            if (activity.isDefault()) {\n                iterator.remove();\n            }\n        }\n\n        //Sort Perspective Providers so they're always in the same sequence!\n        List<PerspectiveActivity> sortedActivities = new ArrayList<>(activities);\n        Collections.sort(sortedActivities,\n                         (o1, o2) -> o1.getName().compareTo(o2.getName()));\n\n        return sortedActivities;\n    }\n\n    private Collection<WorkbenchScreenActivity> getScreenActivities() {\n\n        //Get Perspective Providers\n        return activityManager.getActivities(WorkbenchScreenActivity.class);\n    }\n\n    //Fade out the \"Loading application\" pop-up\n    private void hideLoadingPopup() {\n        final Element e = RootPanel.get(\"loading\").getElement();\n\n        new Animation() {\n\n            @Override\n            protected void onUpdate(double progress) {\n                e.getStyle().setOpacity(1.0 - progress);\n            }\n\n            @Override\n            protected void onComplete() {\n                e.getStyle().setVisibility(Style.Visibility.HIDDEN);\n            }\n        }.run(500);\n    }\n\n    @Produces\n    @ApplicationScoped\n    public MainBrand createBrandLogo() {\n        return () -> {\n            final Image image = new Image(AppResource.INSTANCE.images().ufBrandLogo());\n            image.getElement().setAttribute(\"height\",\n                                            \"10\");\n            return image;\n        };\n    }\n\n    private void onPluginAdded(@Observes PluginAddedEvent pluginEvent) {\n        String title = \"Plugin available\";\n        String message = \"Plugin \" + pluginEvent.getName() +\n                \" has been installed. \\n A reload is required to activate it.\";\n        createPluginModal(title,\n                          message);\n    }\n\n    private void onPluginUpdated(@Observes PluginUpdatedEvent pluginEvent) {\n        String title = \"Plugin updated\";\n        String message = \"Plugin \" + pluginEvent.getName() +\n                \" has been updated. \\n A reload is required to activate it.\";\n        createPluginModal(title,\n                          message);\n    }\n\n    private void createPluginModal(String title,\n                                   String message) {\n        Bs3Modal modal = GWT.create(Bs3Modal.class);\n        modal.setContent(new Text(message));\n        modal.setTitle(title);\n        modal.addHiddenHandler(evt -> Window.Location.reload());\n        modal.show();\n    }\n\n    public void onActivityLazyLoaded(@Observes ActivityLazyLoaded event) {\n\n        if (event.getActivity().getResourceType() != ActivityResourceType.PERSPECTIVE) {\n            return;\n        }\n\n        setupMenu();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/events/YouTubeVideo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.events;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class YouTubeVideo {\n\n    private String name;\n    private String description;\n    private String url;\n\n    public YouTubeVideo() {\n    }\n\n    public YouTubeVideo(final String url) {\n        this.url = checkNotNull(\"url\",\n                                url);\n        this.name = null;\n        this.description = null;\n    }\n\n    public YouTubeVideo(final String name,\n                        final String description,\n                        final String url) {\n        this.name = checkNotNull(\"name\",\n                                 name);\n        this.description = checkNotNull(\"description\",\n                                        description);\n        this.url = checkNotNull(\"url\",\n                                url);\n    }\n\n    public String getURL() {\n        return url;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/AssetEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n@Dependent\npublic class AssetEditor implements AssetEditorView.Presenter {\n\n    private AssetEditorView view;\n\n    @Inject\n    public AssetEditor(AssetEditorView view) {\n        this.view = view;\n    }\n\n    public void showContent(String content) {\n        view.showContent(content);\n    }\n\n    public String getContent() {\n        return view.getContent();\n    }\n\n    public AssetEditorView getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/AssetEditorView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport org.uberfire.ext.editor.commons.client.BaseEditorView;\n\npublic interface AssetEditorView extends BaseEditorView {\n\n    void showContent(String content);\n\n    String getContent();\n\n    void init(Presenter presenter);\n\n    interface Presenter {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/AssetEditorViewImpl.html",
    "content": "<div>\n    <textarea data-field=\"textArea\" class=\"form-control\" rows=\"10\" placeholder=\"Write your content here...\"></textarea>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/AssetEditorViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport elemental2.dom.HTMLTextAreaElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.editor.commons.client.EditorTitle;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\n\n@Templated\npublic class AssetEditorViewImpl extends Composite implements AssetEditorView {\n\n    private Presenter presenter;\n    private EditorTitle title;\n\n    @Inject\n    @DataField\n    private HTMLTextAreaElement textArea;\n\n    @PostConstruct\n    public void init() {\n        title = new EditorTitle();\n    }\n\n    @Override\n    public void showContent(String content) {\n        textArea.value = content;\n    }\n\n    @Override\n    public String getContent() {\n        return textArea.value;\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void showLoading() {\n        showBusyIndicator(\"loading\");\n    }\n\n    @Override\n    public void showSaving() {\n        showBusyIndicator(\"saving\");\n    }\n\n    @Override\n    public void alertReadOnly() {\n        Window.alert(\"readonly!\");\n    }\n\n    @Override\n    public EditorTitle getTitleWidget() {\n        return title;\n    }\n\n    @Override\n    public void refreshTitle(String value) {\n        title.setText(value);\n    }\n\n    @Override\n    public boolean confirmClose() {\n        return Window.confirm(\"close?\");\n    }\n\n    @Override\n    public void showBusyIndicator(String message) {\n        BusyPopup.showMessage(message);\n    }\n\n    @Override\n    public void hideBusyIndicator() {\n        BusyPopup.close();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/ExperimentalAssetAction.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"experimental_asset_editor_action\", descriptionI18nKey = \"experimental_asset_editor_action_description\")\npublic class ExperimentalAssetAction {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/ExperimentalAssetAction2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"experimental_asset_editor_action2\", descriptionI18nKey = \"experimental_asset_editor_action_description\")\npublic class ExperimentalAssetAction2 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/ExperimentalAssetEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport java.util.function.Consumer;\nimport java.util.function.Supplier;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport elemental2.promise.Promise;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.resources.i18n.Constants;\nimport org.uberfire.experimental.client.service.ClientExperimentalFeaturesRegistryService;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\nimport org.uberfire.ext.editor.commons.client.BaseEditor;\nimport org.uberfire.ext.editor.commons.file.DefaultMetadata;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.shared.experimental.ExperimentalAssetRemoved;\nimport org.uberfire.shared.experimental.ExperimentalEditorService;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.DELETE;\nimport static org.uberfire.ext.editor.commons.client.menu.MenuItems.SAVE;\n\n@Dependent\n@WorkbenchEditor(identifier = \"ExperimentalAsset\", supportedTypes = ExperimentalAssetResourceType.class)\n@ExperimentalFeature(nameI18nKey = \"experimental_asset_editor\", descriptionI18nKey = \"experimental_asset_editor_description\")\npublic class ExperimentalAssetEditor extends BaseEditor<String, DefaultMetadata> {\n\n    private final ClientExperimentalFeaturesRegistryService registryService;\n    private final ExperimentalAssetResourceType resourceType;\n    private final AssetEditor editor;\n    private final Caller<ExperimentalEditorService> service;\n\n    @Inject\n    public ExperimentalAssetEditor(final ClientExperimentalFeaturesRegistryService registryService, final ExperimentalAssetResourceType resourceType, AssetEditor editor, final Caller<ExperimentalEditorService> service) {\n        super(editor.getView());\n        this.registryService = registryService;\n        this.resourceType = resourceType;\n        this.editor = editor;\n        this.service = service;\n    }\n\n    @Override\n    protected void loadContent() {\n        service.call((RemoteCallback<String>) response -> {\n            editor.showContent(response);\n        }).load(versionRecordManager.getCurrentPath());\n        baseView.hideBusyIndicator();\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        init(path,\n             place,\n             resourceType,\n             SAVE,\n             DELETE);\n    }\n\n    @Override\n    protected Supplier<String> getContentSupplier() {\n        return editor::getContent;\n    }\n\n    @Override\n    protected Caller<? extends SupportsDelete> getDeleteServiceCaller() {\n        return service;\n    }\n\n    @Override\n    protected void save() {\n        final String content = editor.getContent();\n        service.call(getSaveSuccessCallback(content.hashCode())).save(versionRecordManager.getCurrentPath(), content);\n        concurrentUpdateSessionInfo = null;\n    }\n\n    @Override\n    protected Promise<Void> makeMenuBar() {\n        return super.makeMenuBar().then(v -> {\n            // Checking manually the experimental actions from the experimental features framework\n            if (registryService.isFeatureEnabled(ExperimentalAssetAction.class.getName())) {\n                menuBuilder.addNewTopLevelMenu(MenuFactory.newTopLevelMenu(Constants.INSTANCE.experimental_asset_editor_actionsExperimental())\n                                                       .respondsWith(() -> Window.alert(Constants.INSTANCE.experimental_asset_editor_actionsExperimentalText()))\n                                                       .endMenu()\n                                                       .build().getItems().get(0));\n            }\n\n            if (registryService.isFeatureEnabled(ExperimentalAssetAction2.class.getName())) {\n                menuBuilder.addNewTopLevelMenu(MenuFactory.newTopLevelMenu(Constants.INSTANCE.experimental_asset_editor_actionsExperimental2())\n                                                       .respondsWith(() -> Window.alert(Constants.INSTANCE.experimental_asset_editor_actionsExperimental2Text()))\n                                                       .endMenu()\n                                                       .build().getItems().get(0));\n            }\n\n            return promises.resolve();\n        });\n    }\n\n    @Override\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitle() {\n        return super.getTitle();\n    }\n\n    @Override\n    @WorkbenchPartTitle\n    public String getTitleText() {\n        return \"Experimental Editor [\" + versionRecordManager.getCurrentPath().getFileName() + \"]\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        super.getMenus(menusConsumer);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return editor.getView();\n    }\n\n    public void onDelete(@Observes ExperimentalAssetRemoved event) {\n        if (event.getPath().equals(versionRecordManager.getCurrentPath())) {\n            placeManager.closePlace(place);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/editor/ExperimentalAssetResourceType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.editor;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class ExperimentalAssetResourceType implements ClientResourceType {\n\n    private Category category;\n\n    public ExperimentalAssetResourceType() {\n    }\n\n    @Inject\n    public ExperimentalAssetResourceType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"Experimental Asset\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"Experimental Asset\";\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"exp\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 1000;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.exp\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\"\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/global/GlobalExperimentalFeature1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.global;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(scope = ExperimentalFeature.Scope.GLOBAL, nameI18nKey = \"global_feature1\", descriptionI18nKey = \"global_feature_description\")\npublic class GlobalExperimentalFeature1 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/global/GlobalExperimentalFeature2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.global;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(scope = ExperimentalFeature.Scope.GLOBAL, nameI18nKey = \"global_feature2\", descriptionI18nKey = \"global_feature_description\")\npublic class GlobalExperimentalFeature2 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/global/GlobalExperimentalFeature3.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.global;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(scope = ExperimentalFeature.Scope.GLOBAL, nameI18nKey = \"global_feature3\", descriptionI18nKey = \"global_feature_description\")\npublic class GlobalExperimentalFeature3 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group1/Group1ExperimentalFeature1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group1;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group1_feature1\", descriptionI18nKey = \"experimental_feature_description\", group = \"group1\")\npublic class Group1ExperimentalFeature1 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group1/Group1ExperimentalFeature2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group1;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group1_feature2\", descriptionI18nKey = \"experimental_feature_description\", group = \"group1\")\npublic class Group1ExperimentalFeature2 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group2/Group2ExperimentalFeature1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group2;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group2_feature1\", descriptionI18nKey = \"experimental_feature_description\", group = \"group2\")\npublic class Group2ExperimentalFeature1 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group3/Group3ExperimentalFeature1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group3;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group3_feature1\", descriptionI18nKey = \"experimental_feature_description\", group = \"group3\")\npublic class Group3ExperimentalFeature1 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group3/Group3ExperimentalFeature2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group3;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group3_feature2\", descriptionI18nKey = \"experimental_feature_description\", group = \"group3\")\npublic class Group3ExperimentalFeature2 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/examples/group3/Group3ExperimentalFeature3.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.examples.group3;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(nameI18nKey = \"group3_feature3\", descriptionI18nKey = \"experimental_feature_description\", group = \"group3\")\npublic class Group3ExperimentalFeature3 {\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/perspectives/ExperimentalPerspective.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.experimental.perspectives;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.experimental.screens.ExperimentalPerspectiveHeader;\nimport org.uberfire.client.experimental.screens.explorer.ExperimentalExplorerScreen;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.client.experimental.perspectives.ExperimentalPerspective.IDENTIFIER;\n\n/**\n * A simple perspective with one tabbed panel.\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = IDENTIFIER)\n@ExperimentalFeature(nameI18nKey = \"experimental_perspective\", descriptionI18nKey = \"experimental_perspective_description\")\npublic class ExperimentalPerspective {\n\n    public static final String IDENTIFIER = \"ExperimentalPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"Experimental Perspective\");\n\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(ExperimentalPerspectiveHeader.ID)));\n\n        final PanelDefinition west = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        west.setWidth(500);\n        west.setMinWidth(500);\n        west.addPart(new PartDefinitionImpl(new DefaultPlaceRequest(ExperimentalExplorerScreen.ID)));\n\n        perspective.getRoot().insertChild(CompassPosition.WEST, west);\n\n        return perspective;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Do nothing\")\n                                     .respondsWith(() -> Window.alert(\"Hello World!\"))\n                                     .position(MenuPosition.RIGHT)\n                                     .endMenu()\n                                     .build());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/ExperimentalPerspectiveHeader.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLHeadingElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = ExperimentalPerspectiveHeader.ID)\npublic class ExperimentalPerspectiveHeader implements IsElement {\n\n    public static final String ID = \"Experimental.header\";\n\n    private static final String TITLE = \"Experimental Prespective\";\n\n    @Inject\n    @Named(\"h1\")\n    private HTMLHeadingElement header;\n\n    @PostConstruct\n    public void init() {\n        header.textContent = TITLE;\n        header.style.textAlign = \"center\";\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return TITLE;\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return this;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return header;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/ExperimentalExplorer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer;\n\nimport java.util.List;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.experimental.screens.explorer.asset.AssetDisplayer;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.shared.experimental.ExperimentalAssetRemoved;\nimport org.uberfire.shared.experimental.ExperimentalEditorService;\n\n@Dependent\npublic class ExperimentalExplorer implements ExperimentalExplorerView.Presenter,\n                                             IsElement {\n\n    private final ExperimentalExplorerView view;\n    private final ManagedInstance<AssetDisplayer> displayers;\n    private final Caller<ExperimentalEditorService> service;\n    private final NewAssetPopup newAssetPopup;\n    private final PlaceManager placeManager;\n\n    @Inject\n    public ExperimentalExplorer(final ExperimentalExplorerView view, final ManagedInstance<AssetDisplayer> displayers, final Caller<ExperimentalEditorService> service, final NewAssetPopup newAssetPopup, final PlaceManager placeManager) {\n        this.view = view;\n        this.displayers = displayers;\n        this.service = service;\n        this.newAssetPopup = newAssetPopup;\n        this.placeManager = placeManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n\n        newAssetPopup.init(this::doCreate);\n    }\n\n    public void load() {\n        clean();\n        service.call((RemoteCallback<List<Path>>) paths -> paths.stream().forEach(ExperimentalExplorer.this::newAsset)).listAll();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    public void newAsset(Path path) {\n        final AssetDisplayer displayer = displayers.get();\n\n        displayer.render(path, () -> doDelete(displayer));\n\n        view.show(displayer);\n    }\n\n    @PreDestroy\n    public void clean() {\n        displayers.destroyAll();\n        view.clean();\n    }\n\n    @Override\n    public void createNew() {\n        newAssetPopup.show();\n    }\n\n    private void doCreate() {\n        String assetName = newAssetPopup.getAssetName();\n\n        service.call((RemoteCallback<Path>) path -> {\n            newAsset(path);\n            newAssetPopup.hide();\n            placeManager.goTo(path);\n        }).create(assetName);\n    }\n\n    private void doDelete(AssetDisplayer asset) {\n        service.call().delete(asset.getPath(), \"\");\n    }\n\n    public void onDelete(@Observes ExperimentalAssetRemoved event) {\n        view.findDisplayer(event.getPath())\n                .ifPresent(this::removeAssetDisplayer);\n    }\n\n    private void removeAssetDisplayer(AssetDisplayer asset) {\n        view.delete(asset);\n        displayers.destroy(asset);\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/ExperimentalExplorerScreen.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer;\n\nimport java.util.function.Consumer;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.resources.i18n.Constants;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@WorkbenchScreen(identifier = ExperimentalExplorerScreen.ID)\n@ExperimentalFeature(nameI18nKey = \"experimental_asset_explorer\", descriptionI18nKey = \"experimental_asset_explorer_description\")\npublic class ExperimentalExplorerScreen implements IsElement {\n\n    public static final String ID = \"Experimental Explorer\";\n\n    private static final String TITLE = \"Explorer\";\n\n    private final ExperimentalExplorer explorer;\n\n    @Inject\n    public ExperimentalExplorerScreen(final ExperimentalExplorer explorer) {\n        this.explorer = explorer;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return TITLE;\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return this;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory.newTopLevelMenu(Constants.INSTANCE.experimental_asset_explorer_actionsAdd())\n                                     .respondsWith(() -> explorer.createNew())\n                                     .endMenu()\n                                     .build());\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return explorer.getElement();\n    }\n\n    @OnOpen\n    public void onOpen() {\n        explorer.load();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/ExperimentalExplorerView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer;\n\nimport java.util.Optional;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.experimental.screens.explorer.asset.AssetDisplayer;\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface ExperimentalExplorerView extends UberElemental<ExperimentalExplorerView.Presenter> {\n\n    void show(AssetDisplayer asset);\n\n    void delete(AssetDisplayer asset);\n\n    void clean();\n\n    Optional<AssetDisplayer> findDisplayer(Path path);\n\n    interface Presenter {\n\n        void createNew();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/ExperimentalExplorerViewImpl.html",
    "content": "<div>\n    <div data-field=\"empty\" class=\"blank-slate-pf \">\n        <div class=\"blank-slate-pf-icon\">\n            <span class=\"pficon pficon pficon-add-circle-o\"></span>\n        </div>\n        <h1 data-i18n-key=\"emptyTitle\"></h1>\n        <p data-i18n-key=\"emptyText\"></p>\n        <div class=\"blank-slate-pf-main-action\">\n            <button class=\"btn btn-primary btn-lg\" data-field=\"addButton\" data-i18n-key=\"add\"></button>\n        </div>\n    </div>\n    <ul data-field=\"assets\" class=\"list-group\">\n\n    </ul>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/ExperimentalExplorerViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.Document;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.experimental.screens.explorer.asset.AssetDisplayer;\nimport org.uberfire.commons.data.Pair;\n\n@Templated\npublic class ExperimentalExplorerViewImpl implements ExperimentalExplorerView,\n                                                     IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLDivElement empty;\n\n    @Inject\n    @DataField\n    private HTMLButtonElement addButton;\n\n    @Inject\n    @DataField\n    @Named(\"ul\")\n    private HTMLUListElement assets;\n\n    @Inject\n    private Elemental2DomUtil elemental2DomUtil;\n\n    @Inject\n    private Document document;\n\n    private List<Pair<Element, AssetDisplayer>> assetsList = new ArrayList<>();\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void show(AssetDisplayer asset) {\n        empty.hidden = true;\n        Element listElement = document.createElement(\"li\");\n        listElement.className = \"list-group-item\";\n        listElement.appendChild(asset.getElement());\n        assets.appendChild(listElement);\n        assetsList.add(new Pair<>(listElement, asset));\n    }\n\n    @Override\n    public void delete(AssetDisplayer asset) {\n        Optional<Pair<Element, AssetDisplayer>> optional = assetsList.stream().filter(pair -> pair.getK2().equals(asset)).findAny();\n\n        if (optional.isPresent()) {\n            Pair<Element, AssetDisplayer> pair = optional.get();\n\n            assets.removeChild(pair.getK1());\n            assetsList.remove(pair);\n        }\n\n        if (assetsList.isEmpty()) {\n            empty.hidden = false;\n        }\n    }\n\n    @Override\n    public Optional<AssetDisplayer> findDisplayer(Path path) {\n        return assetsList.stream()\n                .map(Pair::getK2)\n                .filter(displayer -> displayer.getPath().equals(path))\n                .findAny();\n    }\n\n    @Override\n    public void clean() {\n        elemental2DomUtil.removeAllElementChildren(assets);\n        assetsList.clear();\n    }\n\n    @EventHandler(\"addButton\")\n    public void onClick(ClickEvent event) {\n        presenter.createNew();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/NewAssetPopup.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Command;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterOKButton;\n\n@Dependent\npublic class NewAssetPopup extends BaseModal {\n\n    @Inject\n    private TextBox assetName;\n\n    private ModalFooterOKButton footer;\n\n    @PostConstruct\n    public void init() {\n        setTitle(\"New Asset\");\n        setBody(assetName);\n    }\n\n    public String getAssetName() {\n        return assetName.getText();\n    }\n\n    public void init(final Command command) {\n        footer = new ModalFooterOKButton(command);\n        add(footer);\n    }\n\n    @Override\n    public void show() {\n        assetName.setText(\"\");\n        super.show();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/asset/AssetDisplayer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer.asset;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class AssetDisplayer implements AssetDisplayerView.Presenter,\n                                       IsElement {\n\n    private AssetDisplayerView view;\n    private PlaceManager placeManager;\n\n    private Path path;\n\n    private Command deleteCommand;\n\n    @Inject\n    public AssetDisplayer(AssetDisplayerView view, PlaceManager placeManager) {\n        this.view = view;\n        this.placeManager = placeManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void render(Path assetPath, Command deleteCommand) {\n        this.path = assetPath;\n        this.deleteCommand = deleteCommand;\n\n        view.show(assetPath.getFileName().substring(0, assetPath.getFileName().lastIndexOf(\".\")));\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public void open() {\n        placeManager.goTo(path);\n    }\n\n    @Override\n    public void delete() {\n        if (deleteCommand != null) {\n            deleteCommand.execute();\n        }\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/asset/AssetDisplayerView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer.asset;\n\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface AssetDisplayerView extends UberElemental<AssetDisplayerView.Presenter> {\n\n    void show(String fileName);\n\n    interface Presenter {\n\n        void open();\n\n        void delete();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/asset/AssetDisplayerViewImpl.html",
    "content": "<div class=\"row\">\n    <div class=\"col-md-8\">\n        <a data-field=\"name\" style=\"cursor:pointer\"></a>\n    </div>\n    <div class=\"col-md-4 text-right\">\n        <button data-field=\"delete\" class=\"btn btn-danger btn-xs\"><i class=\"fa fa-trash\"></i></button>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/experimental/screens/explorer/asset/AssetDisplayerViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.experimental.screens.explorer.asset;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLButtonElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class AssetDisplayerViewImpl implements AssetDisplayerView,\n                                               IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLAnchorElement name;\n\n    @Inject\n    @DataField\n    private HTMLButtonElement delete;\n\n    @Override\n    public void show(String fileName) {\n        name.textContent = fileName;\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @EventHandler(\"name\")\n    public void onOpen(ClickEvent event) {\n        presenter.open();\n    }\n\n    @EventHandler(\"delete\")\n    public void onDelete(ClickEvent event) {\n        presenter.delete();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/navbar/AppNavBar.html",
    "content": "<div id=\"header\">\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/navbar/AppNavBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.navbar;\n\nimport static java.lang.Integer.MAX_VALUE;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.Header;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBarPresenter;\n\n@ApplicationScoped\n@Templated\npublic class AppNavBar implements Header {\n\n    @Inject\n    @DataField\n    Div header;\n\n    @Inject\n    private WorkbenchMenuBarPresenter menuBarPresenter;\n\n    @PostConstruct\n    public void setup() {\n        DOMUtil.appendWidgetToElement(header,\n                                      menuBarPresenter.getView().asWidget());\n    }\n\n    @Override\n    public String getId() {\n        return \"AppNavBar\";\n    }\n\n    @Override\n    public int getOrder() {\n        return MAX_VALUE;\n    }\n}\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/navbar/SearchMenuBuilder.java",
    "content": "/*\n *\n *  * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\npackage org.uberfire.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@ApplicationScoped\npublic class SearchMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    private AnchorListItem link = GWT.create(AnchorListItem.class);\n\n    public SearchMenuBuilder() {\n        link.setIcon(IconType.SEARCH);\n        link.setPull(Pull.RIGHT);\n        link.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                Window.alert(\"Search!\");\n            }\n        });\n    }\n\n    @Override\n    public void push(final MenuFactory.CustomMenuBuilder element) {\n        // Do nothing\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n\n            @Override\n            public IsWidget build() {\n                return link;\n            }\n\n            @Override\n            public MenuPosition getPosition() {\n                return MenuPosition.RIGHT;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/perspectives/MultiScreenPerspective.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.perspectives;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiScreenWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = MultiScreenPerspective.IDENTIFIER)\npublic class MultiScreenPerspective {\n    public static final String IDENTIFIER = \"MultiScreenPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl(MultiScreenWorkbenchPanelPresenter.class.getName());\n        p.setName(\"Multi Screen Perspective\");\n        p.getRoot().addPart(\"MultiScreen\");\n        return p;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/perspectives/SimplePerspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.perspectives;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.ShowcaseEntryPoint;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * A simple perspective with one tabbed panel.\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = SimplePerspective.IDENTIFIER, isTransient = false)\npublic class SimplePerspective {\n    public static final String IDENTIFIER = \"SimplePerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl(MultiTabWorkbenchPanelPresenter.class.getName());\n        p.setName(\"Simple Perspective\");\n        return p;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Open\")\n                                     .withItems(ShowcaseEntryPoint.getScreens())\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Command\").respondsWith(() -> Window.alert(\"Command!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Create New\")\n                                     .menus()\n                                     .menu(\"Command 1\")\n                                     .respondsWith(() -> Window.alert(\"Command 1!\"))\n                                     .endMenu()\n                                     .menu(\"Command 2\")\n                                     .respondsWith(() -> Window.alert(\"Command 2!\"))\n                                     .endMenu()\n                                     .endMenus()\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Find\")\n                                     .respondsWith(() -> Window.alert(\"Find!\"))\n                                     .position(MenuPosition.RIGHT)\n                                     .endMenu()\n                                     .build());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/perspectives/SimplePerspectiveNoContext.java",
    "content": "/*\n *\n *  * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\npackage org.uberfire.client.perspectives;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.ShowcaseEntryPoint;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * A simple perspective with one tabbed panel.\n * To test access /showcase.html?standalone=true&perspective=SimplePerspectiveNoContext&header=AppNavBar\n */\n@ApplicationScoped\n@WorkbenchPerspective(identifier = SimplePerspectiveNoContext.SIMPLE_PERSPECTIVE_NO_CONTEXT, isTransient = false)\npublic class SimplePerspectiveNoContext {\n\n    public static final String SIMPLE_PERSPECTIVE_NO_CONTEXT = \"SimplePerspectiveNoContext\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        p.setName(\"Simple Perspective No Context\");\n        p.getRoot().addPart(\"welcome\");\n        return p;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Open\")\n                                     .withItems(ShowcaseEntryPoint.getScreens())\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Command\").respondsWith(() -> Window.alert(\"Command!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Create New\")\n                                     .menus()\n                                     .menu(\"Command 1\")\n                                     .respondsWith(() -> Window.alert(\"Command 1!\"))\n                                     .endMenu()\n                                     .menu(\"Command 2\")\n                                     .respondsWith(() -> Window.alert(\"Command 2!\"))\n                                     .endMenu()\n                                     .endMenus()\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Find\")\n                                     .respondsWith(() -> Window.alert(\"Find!\"))\n                                     .position(MenuPosition.RIGHT)\n                                     .endMenu()\n                                     .build());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/AppImages.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for Workbench\n */\npublic interface AppImages\n        extends\n        ClientBundle {\n\n    @Source(\"images/uf.png\")\n    ImageResource ufBrandLogo();\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/AppResource.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\npublic interface AppResource\n        extends\n        ClientBundle {\n\n    AppResource INSTANCE = GWT.create(AppResource.class);\n\n    AppImages images();\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * This uses GWT to provide client side compile time resolving of locales. See:\n * http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-\n * toolkit-doc-1-5&t=DevGuideInternationalization (for more information).\n * <p>\n * Each method name matches up with a key in Constants.properties (the\n * properties file can still be used on the server). To use this, use\n * <code>GWT.create(Constants.class)</code>.\n */\npublic interface Constants\n        extends\n        Messages {\n\n    Constants INSTANCE = GWT.create(Constants.class);\n\n    String SignOut();\n\n    String WelcomeUser();\n\n    String experimental_perspective();\n\n    String experimental_perspective_description();\n\n    String experimental_asset_explorer();\n\n    String experimental_asset_explorer_description();\n\n    String experimental_asset_editor();\n\n    String experimental_asset_editor_description();\n\n    String experimental_features_editor();\n\n    String admin_perspective();\n\n    String apps_perspective();\n\n    String multi_screem_perspective();\n\n    String plugin_authoring();\n\n    String preferences_perspective();\n\n    String simple_perspective();\n\n    String standalone_editor_perspective();\n\n    String global_feature1();\n\n    String global_feature2();\n\n    String global_feature3();\n\n    String global_feature_description();\n\n    String group1();\n\n    String group1_feature1();\n\n    String group1_feature2();\n\n    String group1_feature3();\n\n    String group2();\n\n    String group2_feature1();\n\n    String group3();\n\n    String group3_feature1();\n\n    String group3_feature2();\n\n    String group3_feature3();\n\n    String experimental_feature_description();\n\n    String experimental_asset_editor_action();\n\n    String experimental_asset_editor_action2();\n\n    String experimental_asset_editor_action_description();\n\n    @Key(\"experimental_asset_editor_actions.experimental\")\n    String experimental_asset_editor_actionsExperimental();\n\n    @Key(\"experimental_asset_editor_actions.experimental2\")\n    String experimental_asset_editor_actionsExperimental2();\n\n    @Key(\"experimental_asset_editor_actions.experimentalText\")\n    String experimental_asset_editor_actionsExperimentalText();\n\n    @Key(\"experimental_asset_editor_actions.experimental2Text\")\n    String experimental_asset_editor_actionsExperimental2Text();\n\n    @Key(\"experimental_asset_explorer_actions.add\")\n    String experimental_asset_explorer_actionsAdd();\n\n    @Key(\"ExperimentalExplorerViewImpl.emptyTitle\")\n    String ExperimentalExplorerViewImplEmptyTitle();\n\n    @Key(\"ExperimentalExplorerViewImpl.emptyText\")\n    String ExperimentalExplorerViewImplEmptyText();\n\n    @Key(\"ExperimentalExplorerViewImpl.add\")\n    String ExperimentalExplorerViewImplAdd();\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSignOut=SignOut\nWelcomeUser=Welcome\n\nexperimental_features_editor=Experimental Features Editor\nexperimental_perspective=Experimental Perspective\nexperimental_perspective_description=Example of an Experimental WorkbenchPerspective. Enable it to test the Experimental Framework\n\nexperimental_asset_explorer=Experimental Asset Explorer\nexperimental_asset_explorer_description=Example of an Experimental WorkbenchScreen to be used on the Experimental Perspective.\nexperimental_asset_explorer_actions.add=Add\n\nexperimental_asset_editor=Experimental Asset Editor\nexperimental_asset_editor_description=Example of an Experimental WorkbenchEditor to be used on the Experimental Perspective.\nexperimental_asset_editor_action=Experimental Asset Explorer Custom Action\nexperimental_asset_editor_action2=Experimental Asset Explorer Custom Action (another)\nexperimental_asset_editor_action_description=Adds a custom Action to the Asset Explorer. This is an example of how to use the Experimental Framework API.\nexperimental_asset_editor_actions.experimental=Experimental Action\nexperimental_asset_editor_actions.experimentalText=Congratulations you triggered the Experimental Action\nexperimental_asset_editor_actions.experimental2=Experimental Action 2\nexperimental_asset_editor_actions.experimental2Text=Congratulations you triggered the Experimental Action 2\n\nglobal_feature1=Global Feature 1\nglobal_feature2=Global Feature 2\nglobal_feature3=Global Feature 3\nglobal_feature_description=Example of Global Experimental Feature, you should only see it if you have admin permissions.\n\ngroup1=Group 1\ngroup1_feature1=Experimental Feature 1\ngroup1_feature2=Experimental Feature 2\ngroup1_feature3=Experimental Feature 3\n\ngroup2=Group 2\ngroup2_feature1=Experimental Feature 4\n\ngroup3=Group 3\ngroup3_feature1=Experimental Feature 5\ngroup3_feature2=Experimental Feature 6\ngroup3_feature3=Experimental Feature 7\n\nexperimental_feature_description=Example of a User Experimental Feature, anyone should be able to see it.\n\nExperimentalExplorerViewImpl.emptyTitle=Nothing to show!\nExperimentalExplorerViewImpl.emptyText=There are no assets, please press the 'Add' button to start adding them. \nExperimentalExplorerViewImpl.add=Add\n\nadmin_perspective=Admin\napps_perspective=Apps Perspective\nmulti_screem_perspective=Multi Screen Perspective\nplugin_authoring=Plugin Authoring\npreferences_perspective=Preferences\nsimple_perspective=Simple Perspective\nstandalone_editor_perspective=Standalone Editor Perspective\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_es.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSignOut=Cerrar sesión\nWelcomeUser=Bienvenido\n\nexperimental_features_editor=Editor de funcionalidades experimentales\nexperimental_perspective=Perspectiva experimental\nexperimental_perspective_description=Ejemplo de una perspectiva de Mesa de trabajo experimental. Habilitarla para probar el marco experimental\n\nexperimental_asset_explorer=Explorador de activos experimentales\nexperimental_asset_explorer_description=Ejemplo de una pantalla de Mesa de trabajo experimental para usar en la perspectiva experimental.\nexperimental_asset_explorer_actions.add=Agregar\n\nexperimental_asset_editor=Editor de activos experimentales\nexperimental_asset_editor_description=Ejemplo de un editor de Mesa de trabajo experimental para usar en la perspectiva experimental.\nexperimental_asset_editor_action=Acción personalizada del explorador de activos experimentales\nexperimental_asset_editor_action2=Acción personalizada del explorador de activos experimentales (otro)\nexperimental_asset_editor_action_description=Agrega una acción personalizada al explorador de activos. Este es un ejemplo de cómo usar la API del marco experimental.\nexperimental_asset_editor_actions.experimental=Acción experimental\nexperimental_asset_editor_actions.experimentalText=Felicitaciones por haber activado la acción experimental\nexperimental_asset_editor_actions.experimental2=Acción experimental 2\nexperimental_asset_editor_actions.experimental2Text=Felicitaciones por haber activado la acción experimental 2\n\nglobal_feature1=Funcionalidad global 1\nglobal_feature2=Funcionalidad global 2\nglobal_feature3=Funcionalidad global 3\nglobal_feature_description=Ejemplo de la funcionalidad experimental global; solo debería verlo si tiene permisos de administrador.\n\ngroup1=Grupo 1\ngroup1_feature1=Funcionalidad experimental 1\ngroup1_feature2=Funcionalidad experimental 2\ngroup1_feature3=Funcionalidad experimental 3\n\ngroup2=Grupo 2\ngroup2_feature1=Funcionalidad experimental 4\n\ngroup3=Grupo 3\ngroup3_feature1=Funcionalidad experimental 5\ngroup3_feature2=Funcionalidad experimental 6\ngroup3_feature3=Funcionalidad experimental 7\n\nexperimental_feature_description=Ejemplo de una funcionalidad experimental de usuario; cualquiera debería poder verla.\n\nExperimentalExplorerViewImpl.emptyTitle=¡No hay nada que mostrar!\nExperimentalExplorerViewImpl.emptyText=No hay activos; presione el botón “Agregar” para empezar a agregarlos. \nExperimentalExplorerViewImpl.add=Agregar\n\nadmin_perspective=Admin\napps_perspective=Perspectiva de las aplicaciones\nmulti_screem_perspective=Perspectiva multipantalla\nplugin_authoring=Autoría del complemento\npreferences_perspective=Preferencias\nsimple_perspective=Perspectiva simple\nstandalone_editor_perspective=Perspectiva del editor independiente\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_es_ES.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_fr.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSignOut=SignOut\nWelcomeUser=Bienvenue\n\nexperimental_features_editor=Éditeur de fonctionnalités expérimentales\nexperimental_perspective=Perspective expérimentale\nexperimental_perspective_description=Exemple d''une perspective Tableau de référence expérimentale. Activez-la pour tester le cadre expérimental\n\nexperimental_asset_explorer=Explorateur d''actifs expérimentaux\nexperimental_asset_explorer_description=Exemple d''un écran de Tableau de référence expérimental à utiliser dans la perspective expérimentale.\nexperimental_asset_explorer_actions.add=Ajouter\n\nexperimental_asset_editor=Éditeur d''actifs expérimentaux\nexperimental_asset_editor_description=Exemple d''un éditeur Tableau de référence expérimental à utiliser dans la perspective expérimentale.\nexperimental_asset_editor_action=Action personnalisée de l''explorateur d''actifs expérimentaux\nexperimental_asset_editor_action2=Action personnalisée de l''explorateur d''actifs expérimentaux (autre)\nexperimental_asset_editor_action_description=Ajoute une action personnalisée à l''explorateur d''actifs. Voici un exemple d''utilisation de l''API du cadre expérimental.\nexperimental_asset_editor_actions.experimental=Action expérimentale\nexperimental_asset_editor_actions.experimentalText=Félicitations, vous avez déclenché l''action expérimentale !\nexperimental_asset_editor_actions.experimental2=Action expérimentale 2\nexperimental_asset_editor_actions.experimental2Text=Félicitations, vous avez déclenché l''action expérimentale 2 !\n\nglobal_feature1=Fonctionnalité globale 1\nglobal_feature2=Fonctionnalité globale 2\nglobal_feature3=Fonctionnalité globale 3\nglobal_feature_description=Exemple de fonctionnalité expérimentale globale. Normalement, elle n''est visible que si vous disposez des autorisations d''administration.\n\ngroup1=Groupe 1\ngroup1_feature1=Fonctionnalité expérimentale 1\ngroup1_feature2=Fonctionnalité expérimentale 2\ngroup1_feature3=Fonctionnalité expérimentale 3\n\ngroup2=Groupe 2\ngroup2_feature1=Fonctionnalité expérimentale 4\n\ngroup3=Groupe 3\ngroup3_feature1=Fonctionnalité expérimentale 5\ngroup3_feature2=Fonctionnalité expérimentale 6\ngroup3_feature3=Fonctionnalité expérimentale 7\n\nexperimental_feature_description=Exemple d''une fonctionnalité expérimentale utilisateur. Elle doit être visible par tout le monde.\n\nExperimentalExplorerViewImpl.emptyTitle=Rien à afficher !\nExperimentalExplorerViewImpl.emptyText=Il n''y a aucun actif. Veuillez cliquer sur le bouton \"Ajouter\" pour commencer à en ajouter. \nExperimentalExplorerViewImpl.add=Ajouter\n\nadmin_perspective=Administrateur\napps_perspective=Perspective des applications\nmulti_screem_perspective=Perspective multi-écran\nplugin_authoring=Création de plug-ins\npreferences_perspective=Préférences\nsimple_perspective=Perspective simple\nstandalone_editor_perspective=Perspective d''éditeur autonome\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_fr_FR.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_it.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSignOut=Esci\nWelcomeUser=Benvenuto\n\nexperimental_features_editor=Editor delle Funzionalità Sperimentali\nexperimental_perspective=Visuale Sperimentale\nexperimental_perspective_description=Esempio di una Visuale Workbench Sperimentale. Abilitala per testare il Framework Sperimentale\n\nexperimental_asset_explorer=Explorer degli Asset Sperimentali\nexperimental_asset_explorer_description=Esempio di una Schermata Workbench Sperimentale da utilizzare nella Visuale Sperimentale.\nexperimental_asset_explorer_actions.add=Aggiungi\n\nexperimental_asset_editor=Editor degli Asset Sperimentali\nexperimental_asset_editor_description=Esempio di un Editor Workbench Sperimentale da utilizzare nella Visuale Sperimentale.\nexperimental_asset_editor_action=Azione Personalizzata dell''Explorer degli Asset Sperimentali\nexperimental_asset_editor_action2=Azione Personalizzata dell''Explorer degli Asset Sperimentali (un''altra)\nexperimental_asset_editor_action_description=Aggiunge un''azione personalizzata all''Explorer degli Asset. Questo è un esempio di come utilizzare l''API del Framework Sperimentale.\nexperimental_asset_editor_actions.experimental=Azione Sperimentale\nexperimental_asset_editor_actions.experimentalText=Congratulazioni, hai attivato l''Azione Sperimentale\nexperimental_asset_editor_actions.experimental2=Azione Sperimentale 2\nexperimental_asset_editor_actions.experimental2Text=Congratulazioni, hai attivato l''Azione Sperimentale 2\n\nglobal_feature1=Funzionalità Globale 1\nglobal_feature2=Funzionalità Globale 2\nglobal_feature3=Funzionalità Globale 3\nglobal_feature_description=Esempio di Funzionalità Sperimentale Globale, dovresti poterla vedere solo se hai i permessi di amministratore.\n\ngroup1=Gruppo 1\ngroup1_feature1=Funzionalità Sperimentale 1\ngroup1_feature2=Funzionalità Sperimentale 2\ngroup1_feature3=Funzionalità Sperimentale 3\n\ngroup2=Gruppo 2\ngroup2_feature1=Funzionalità Sperimentale 4\n\ngroup3=Gruppo 3\ngroup3_feature1=Funzionalità Sperimentale 5\ngroup3_feature2=Funzionalità Sperimentale 6\ngroup3_feature3=Funzionalità Sperimentale 7\n\nexperimental_feature_description=Esempio di una Funzionalità Sperimentale Utente, chiunque dovrebbe poterla vedere.\n\nExperimentalExplorerViewImpl.emptyTitle=Niente da mostrare!\nExperimentalExplorerViewImpl.emptyText=Non ci sono asset, premi il pulsante ''Aggiungi'' per iniziare ad aggiungerli.\nExperimentalExplorerViewImpl.add=Aggiungi\n\nadmin_perspective=Amministrazione\napps_perspective=Prospettiva Applicazioni\nmulti_screem_perspective=Prospettiva Multi-Schermo\nplugin_authoring=Creazione di Plugin\npreferences_perspective=Preferenze\nsimple_perspective=Prospettiva Semplice\nstandalone_editor_perspective=Prospettiva Editor Standalone\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_ja.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nSignOut=サインアウト\nWelcomeUser=ようこそ\n\nexperimental_features_editor=実験的機能エディター\nexperimental_perspective=実験的パースペクティブ\nexperimental_perspective_description=実験的 WorkbenchPerspective の例実験的フレームワークのテストを有効にします\n\nexperimental_asset_explorer=実験的アセットエクスプローラー\nexperimental_asset_explorer_description=実験的パースペクティブで使用する実験的 WorkbenchScreen の例\nexperimental_asset_explorer_actions.add=追加\n\nexperimental_asset_editor=実験的アセットエディター\nexperimental_asset_editor_description=実験的パースペクティブで使用する実験的 WorkbenchEditor の例\nexperimental_asset_editor_action=実験的アセットエクスプローラーのカスタムアクション\nexperimental_asset_editor_action2=実験的アセットエクスプローラーのカスタムアクション (別)\nexperimental_asset_editor_action_description=アセットエクスプローラーにカスタムアクションを追加します。これは、Experimental Framework API の使用方法の例です。\nexperimental_asset_editor_actions.experimental=実験的アクション\nexperimental_asset_editor_actions.experimentalText=実験的アクションを正常にトリガーしました\nexperimental_asset_editor_actions.experimental2=実験的アクション 2\nexperimental_asset_editor_actions.experimental2Text=実験的アクション 2 を正常にトリガーしました\n\nglobal_feature1=グローバル機能 1\nglobal_feature2=グローバル機能 2\nglobal_feature3=グローバル機能 3\nglobal_feature_description=グローバル実験的機能の例。管理者権限がある場合にのみ、表示されます。\n\ngroup1=グループ 1\ngroup1_feature1=実験的機能 1\ngroup1_feature2=実験的機能 2\ngroup1_feature3=実験的機能 3\n\ngroup2=グループ 2\ngroup2_feature1=実験的機能 4\n\ngroup3=グループ 3\ngroup3_feature1=実験的機能 5\ngroup3_feature2=実験的機能 6\ngroup3_feature3=実験的機能 7\n\nexperimental_feature_description=ユーザー向け実験的機能の例。誰でも見ることができます。\n\nExperimentalExplorerViewImpl.emptyTitle=表示する内容がありません!\nExperimentalExplorerViewImpl.emptyText=アセットがありません。「追加」ボタンを押して追加を開始してください。\nExperimentalExplorerViewImpl.add=追加\n\nadmin_perspective=管理者\napps_perspective=アプリのパースペクティブ\nmulti_screem_perspective=マルチスクリーンのパースペクティブ\nplugin_authoring=プラグインオーサリング\npreferences_perspective=設定\nsimple_perspective=シンプルなパースペクティブ\nstandalone_editor_perspective=標準のエディターパースペクティブ\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_ja_JP.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_pt_BR.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/resources/i18n/Constants_zh_CN.properties",
    "content": "﻿#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/MultiScreen.html",
    "content": "<div>\n    <p>\n        <button data-field=\"button\" class=\"btn btn-default\" type=\"button\">Open TodoListScreen</button>\n        <button data-field=\"side-button\" class=\"btn btn-default\" type=\"button\">Open side panel TodoListScreen</button>\n    </p>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/MultiScreen.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens;\n\nimport java.util.function.Consumer;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.views.pfly.widgets.Button;\nimport org.uberfire.client.views.pfly.widgets.Select;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@Templated\n@WorkbenchScreen(identifier = \"MultiScreen\")\npublic class MultiScreen extends Composite {\n\n    @Inject\n    @DataField(\"button\")\n    Button button;\n\n    @Inject\n    @DataField(\"side-button\")\n    Button sideButton;\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    Button buttonMenu;\n\n    @Inject\n    ManagedInstance<Select> selects;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Multi Screen\";\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitleDecoration() {\n        final Select select = selects.get();\n        select.addOption(\"Some option\",\n                         \"value1\",\n                         false);\n        select.addOption(\"Another option\",\n                         \"value2\",\n                         false);\n        select.setTitle(\"Select...\");\n        select.getElement().addEventListener(\"change\",\n                                             event -> Window.alert(\"Select change: \" + select.getValue()),\n                                             false);\n\n        select.refresh();\n        return ElementWrapperWidget.getWidget(select.getElement());\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return this;\n    }\n\n    @PostConstruct\n    public void init() {\n        buttonMenu.setType(Button.ButtonType.BUTTON);\n        buttonMenu.setButtonStyleType(Button.ButtonStyleType.LINK);\n        buttonMenu.setClickHandler(() -> Window.alert(\"Refresh!\"));\n        buttonMenu.addIcon(\"fa\",\n                           \"fa-refresh\");\n\n        button.setClickHandler(() -> placeManager.goTo(\"TodoListScreen\"));\n        sideButton.setClickHandler(() -> placeManager.goTo(\"SidePanelTodoListScreen\"));\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelCustomMenu(new MenuFactory.CustomMenuBuilder() {\n                                         @Override\n                                         public void push(MenuFactory.CustomMenuBuilder element) {\n                                         }\n\n                                         @Override\n                                         public MenuItem build() {\n                                             return new BaseMenuCustom<HTMLElement>() {\n                                                 @Override\n                                                 public void accept(MenuVisitor visitor) {\n                                                     visitor.visit(this);\n                                                 }\n\n                                                 @Override\n                                                 public HTMLElement build() {\n                                                     return buttonMenu.getElement();\n                                                 }\n                                             };\n                                         }\n                                     }).endMenu().build());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/MultiScreenSidePanel.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.screens.todo.AbstractMarkdownScreen;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = \"SidePanelTodoListScreen\", preferredWidth = 500)\npublic class MultiScreenSidePanel extends AbstractMarkdownScreen {\n\n    @Override\n    public String getMarkdownFileURI() {\n        return \"default://uf-playground/todo.md\";\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Side Panel Todo List\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Save\")\n                                     .respondsWith(() -> Window.alert(\"Saved!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Delete\")\n                                     .respondsWith(() -> Window.alert(\"Deleted!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Edit\")\n                                     .menus()\n                                     .menu(\"Cut\")\n                                     .respondsWith(() -> Window.alert(\"Cut!\"))\n                                     .endMenu()\n                                     .menu(\"Paste\")\n                                     .respondsWith(() -> Window.alert(\"Paste!\"))\n                                     .endMenu()\n                                     .endMenus()\n                                     .endMenu()\n                                     .build());\n    }\n\n    @DefaultPosition\n    public Position getPosition() {\n        return CompassPosition.EAST;\n    }\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/OwnedScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens;\n\nimport com.google.gwt.user.client.ui.Label;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.perspectives.SimplePerspective;\n\n@WorkbenchScreen(identifier = \"OwnedScreen\", owningPerspective = SimplePerspective.class)\npublic class OwnedScreen {\n\n    private final Label view = new Label(\"This screen is always displayed in the SimplePerspective.\");\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Owned Screen\";\n    }\n\n    @WorkbenchPartView\n    public Label getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/SampleWorkbenchEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.views.pfly.multipage.PageImpl;\nimport org.uberfire.client.workbench.widgets.multipage.MultiPageEditor;\n\n@Dependent\n@WorkbenchEditor(identifier = \"SampleWorkbenchEditor\", supportedTypes = TextResourceType.class)\npublic class SampleWorkbenchEditor {\n\n    @Inject\n    private MultiPageEditor pageEditor;\n\n    private static PageImpl newPage(final String name) {\n        final Paragraph paragraph = new Paragraph(name + \" Tab\");\n        paragraph.getElement().getStyle().setMargin(15,\n                                                    Style.Unit.PX);\n        return new PageImpl(paragraph,\n                            name);\n    }\n\n    @PostConstruct\n    public void init() {\n        pageEditor.addPage(newPage(\"Source\"));\n        pageEditor.addPage(newPage(\"Overview\"));\n        pageEditor.addPage(newPage(\"Metadata\"));\n        pageEditor.addPage(newPage(\"Preview\"));\n        pageEditor.addPage(newPage(\"Details\"));\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Sample Workbench Editor\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return pageEditor.getView();\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/TextResourceType.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\n@JsType\npublic class TextResourceType implements ClientResourceType {\n\n    private Category category;\n\n    @Inject\n    public TextResourceType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"text\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"\";\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"txt\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"*.\" + getSuffix();\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return path.getFileName().endsWith(\".\" + getSuffix());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/AbstractGitHubStatsScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.gadgets;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.event.logical.shared.AttachEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.html.Div;\nimport org.uberfire.client.annotations.WorkbenchPartView;\n\npublic abstract class AbstractGitHubStatsScreen extends Composite implements RequiresResize {\n\n    private static final int PADDING = 30;\n\n    protected Div panel = new Div();\n\n    protected JavaScriptObject graph;\n\n    protected boolean graphInitialized = false;\n\n    @PostConstruct\n    protected void setup() {\n        final String id = Document.get().createUniqueId();\n        panel.setId(id);\n        panel.addStyleName(\"text-center\");\n        initWidget(panel);\n        panel.addAttachHandler(new AttachEvent.Handler() {\n            @Override\n            public void onAttachOrDetach(final AttachEvent event) {\n                if (event.isAttached() && graph == null) {\n                    graph = generateGraph(panel.getId());\n                }\n            }\n        });\n    }\n\n    protected int getPadding() {\n        return PADDING;\n    }\n\n    public void initGraph() {\n        graphInitialized = true;\n        onResize();\n    }\n\n    @WorkbenchPartView\n    public Widget getView() {\n        return this;\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        setPixelSize(width,\n                     height);\n        final int padding = getPadding();\n        int graphHeight = height < padding ? height : height - padding;\n        int graphWidth = width < padding ? width : width - padding;\n        if (graphInitialized && graph != null) {\n            resizeGraph(graph,\n                        graphHeight,\n                        graphWidth);\n        }\n    }\n\n    public native void resizeGraph(JavaScriptObject graph,\n                                   int graphHeight,\n                                   int graphWidth)/*-{\n        graph.resize({\n            height: graphHeight,\n            width: graphWidth\n        });\n    }-*/;\n\n    public abstract JavaScriptObject generateGraph(final String id);\n}\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/GitHubCodeFrequencyStatsScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.gadgets;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = \"GitHubFrequencyStats\")\npublic class GitHubCodeFrequencyStatsScreen extends AbstractGitHubStatsScreen {\n\n    @WorkbenchPartTitle\n    public String getName() {\n        return \"Uberfire GitHub Code Frequency\";\n    }\n\n    public native JavaScriptObject generateGraph(final String id)/*-{\n        var that = this;\n        return $wnd.c3.generate({\n            bindto: '#' + id,\n            data: {\n                url: 'https://api.github.com/repos/kiegroup/appformer/stats/code_frequency',\n                mimeType: 'json',\n                keys: {\n                    value: [1, 2]\n                },\n                names: {\n                    1: 'Additions per Week',\n                    2: 'Deletions per Week'\n                }\n            },\n            padding: {\n                top: 15\n            },\n            oninit: function () {\n                that.@org.uberfire.client.screens.gadgets.GitHubCodeFrequencyStatsScreen::initGraph()();\n            },\n            color: {\n                pattern: ['#0088ce', '#cc0000']\n            },\n            axis: {\n                y: {\n                    label: {\n                        text: '# Lines Changed',\n                        position: 'outer-top'\n                    },\n                    tick: {\n                        format: $wnd.d3.format(\"s\")\n                    }\n                },\n                x: {\n                    label: {\n                        text: 'Week #',\n                        position: 'outer-right'\n                    }\n                }\n            }\n        });\n    }-*/;\n}\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/GitHubCommitActivityStatsScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.gadgets;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = \"GitHubCommitStats\")\npublic class GitHubCommitActivityStatsScreen extends AbstractGitHubStatsScreen {\n\n    @WorkbenchPartTitle\n    public String getName() {\n        return \"Uberfire GitHub Commit Activity\";\n    }\n\n    public native JavaScriptObject generateGraph(final String id)/*-{\n        var that = this;\n        return $wnd.c3.generate({\n            bindto: '#' + id,\n            data: {\n                url: 'https://api.github.com/repos/kiegroup/appformer/stats/commit_activity',\n                mimeType: 'json',\n                keys: {\n                    value: ['total']\n                },\n                names: {\n                    total: 'Commits per Week'\n                },\n                axes: {\n                    total: 'y'\n                }\n            },\n            padding: {\n                top: 15\n            },\n            oninit: function () {\n                that.@org.uberfire.client.screens.gadgets.GitHubCommitActivityStatsScreen::initGraph()();\n            },\n            color: {\n                pattern: ['#0088ce']\n            },\n            axis: {\n                y: {\n                    label: {\n                        text: '# Commits',\n                        position: 'outer-top'\n                    }\n                },\n                x: {\n                    label: {\n                        text: 'Week #',\n                        position: 'outer-right'\n                    }\n                }\n            }\n        });\n    }-*/;\n}\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/GitHubPunchCardStatsScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.gadgets;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = \"GitHubCommitDaysStats\")\npublic class GitHubPunchCardStatsScreen extends AbstractGitHubStatsScreen {\n\n    @WorkbenchPartTitle\n    public String getName() {\n        return \"Uberfire GitHub Commits per Day\";\n    }\n\n    public void setGraph(final JavaScriptObject graph) {\n        this.graph = graph;\n        onResize();\n    }\n\n    public native JavaScriptObject generateGraph(final String id)/*-{\n        var that = this;\n\n        $wnd.d3.json(\"https://api.github.com/repos/kiegroup/appformer/stats/punch_card\", function (error, json_data) {\n            var data = $wnd.d3.nest()\n                    .key(function (d) {\n                        return d[0];\n                    })\n                    .rollup(function (leaves) {\n                        return $wnd.d3.sum(leaves, function (d) {\n                            return d[2];\n                        });\n                    })\n                    .entries(json_data)\n                    .map(function (d) {\n                        return [d.key, d.values];\n                    });\n\n            var graph = $wnd.c3.generate({\n                bindto: '#' + id,\n                data: {\n                    columns: data,\n                    names: {\n                        0: 'Sunday',\n                        1: 'Monday',\n                        2: 'Tuesday',\n                        3: 'Wednesday',\n                        4: 'Thursday',\n                        5: 'Friday',\n                        6: 'Saturday'\n                    },\n                    type: 'pie'\n                },\n                padding: {\n                    top: 15\n                },\n                oninit: function () {\n                    that.@org.uberfire.client.screens.gadgets.GitHubPunchCardStatsScreen::initGraph()();\n                },\n                color: {\n                    pattern: ['#0088ce', '#00659c', '#3f9c35', '#ec7a08', '#cc0000']\n                }\n            });\n\n            that.@org.uberfire.client.screens.gadgets.GitHubPunchCardStatsScreen::setGraph(Lcom/google/gwt/core/client/JavaScriptObject;)(graph);\n        });\n\n        return null;\n    }-*/;\n}\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/TwitterGadgetScreen.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div class=\"text-center\">\n    <a class=\"twitter-timeline\" style=\"float: none; margin-left: auto; margin-right: auto;\" data-dnt=\"true\" href=\"https://twitter.com/uberfire_org\" data-widget-id=\"600498635810340864\">Tweets by @uberfire_org</a>\n</div>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/gadgets/TwitterGadgetScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.gadgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.ScriptElement;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"TwitterGadget\")\n@Templated\npublic class TwitterGadgetScreen extends Composite {\n\n    @PostConstruct\n    public void init() {\n        final ScriptElement se = Document.get().createScriptElement();\n        se.setId(\"twitter-wjs\");\n        se.setSrc(\"http://platform.twitter.com/widgets.js\");\n        this.getElement().appendChild(se);\n    }\n\n    @WorkbenchPartTitle\n    public String getName() {\n        return \"Uberfire Twitter\";\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.miscfeatures;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.lifecycle.OnFocus;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\n/**\n * A stand-alone Presenter annotated to hook into the Workbench\n */\n@WorkbenchScreen(identifier = \"MiscellaneousFeatures\")\npublic class MiscFeaturesPresenter {\n\n    @Inject\n    public View view;\n    private String title = \"Miscellaneous features\";\n    @Inject\n    private Event<ChangeTitleWidgetEvent> changeTitleWidgetEvent;\n    @Inject\n    private PlaceManager placeManager;\n    private PlaceRequest placeRequest;\n\n    @OnStartup\n    public void onStartup(final PlaceRequest placeRequest) {\n        this.placeRequest = placeRequest;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return title;\n    }\n\n    @WorkbenchPartView\n    public UberView<MiscFeaturesPresenter> getView() {\n        return view;\n    }\n\n    @OnFocus\n    public void onFocus() {\n        GWT.log(\"focus!\");\n    }\n\n    public void launchUnknownPlace() {\n        final PlaceRequest place = new DefaultPlaceRequest(\"somewhere.that.does.not.exist\");\n        placeManager.goTo(place);\n    }\n\n    public void setNewTitle(final String newCoolTitle) {\n        title = \"Cool!\";\n        changeTitleWidgetEvent.fire(new ChangeTitleWidgetEvent(placeRequest,\n                                                               title));\n    }\n\n    public interface View\n            extends\n            UberView<MiscFeaturesPresenter> {\n\n    }\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.miscfeatures;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTMLPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.ERROR;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.INFO;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.SUCCESS;\nimport static org.uberfire.workbench.events.NotificationEvent.NotificationType.WARNING;\n\n/**\n * A stand-alone (i.e. devoid of Workbench dependencies) View\n */\npublic class MiscFeaturesView extends Composite\n        implements\n        RequiresResize,\n        MiscFeaturesPresenter.View {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n    @UiField\n    public HTMLPanel panel;\n    @UiField\n    Button editor;\n    @Inject\n    private Event<NotificationEvent> notification;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    private MiscFeaturesPresenter presenter;\n    @Inject\n    private Caller<VFSService> vfsServices;\n\n    @Override\n    public void init(final MiscFeaturesPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        panel.setPixelSize(width,\n                           height);\n    }\n\n    @UiHandler(\"notificationDefaultButton\")\n    public void onClickNotificationButton(final ClickEvent event) {\n        notification.fire(new NotificationEvent(\"Something happened\"));\n    }\n\n    @UiHandler(\"notificationErrorButton\")\n    public void onClickNotificationErrButton(final ClickEvent event) {\n        notification.fire(new NotificationEvent(\"Something happened\",\n                                                ERROR));\n    }\n\n    @UiHandler(\"notificationSuccessButton\")\n    public void onClickNotificationSuccessButton(final ClickEvent event) {\n        notification.fire(new NotificationEvent(\"Something happened\",\n                                                SUCCESS));\n    }\n\n    @UiHandler(\"notificationInfoButton\")\n    public void onClickNotificationInfoButton(final ClickEvent event) {\n        notification.fire(new NotificationEvent(\"Something happened\",\n                                                INFO));\n    }\n\n    @UiHandler(\"notificationWarnButton\")\n    public void onClickNotificationWarnButton(final ClickEvent event) {\n        notification.fire(new NotificationEvent(\"Something happened\",\n                                                WARNING));\n    }\n\n    @UiHandler(\"launchUnknownPlace\")\n    public void onClickLaunchUnknownPlace(final ClickEvent event) {\n        placeManager.goTo(new DefaultPlaceRequest(\"MyTestPopUp\"));\n    }\n\n    @UiHandler(\"setNewTitleButton\")\n    public void onSetNewTitleButtonClick(final ClickEvent event) {\n        presenter.setNewTitle(\"NewCoolTitle\");\n    }\n\n    @UiHandler(\"activityNotFound\")\n    public void onClickActivityNotFound(final ClickEvent event) {\n        placeManager.goTo(\"some.place.does.not.exists.please!\");\n    }\n\n    @UiHandler(\"editor\")\n    void handleEditor(ClickEvent e) {\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path o) {\n                placeManager.goTo(o);\n            }\n        }).get(\"default://uf-playground/todo.md\");\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, MiscFeaturesView> {\n\n    }\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/miscfeatures/MiscFeaturesView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n    <g:HTMLPanel ui:field=\"panel\">\n        <div class=\"container-fluid\">\n            <div class=\"row\">\n                <div class=\"col-md-12\">\n                    <h2>Miscellaneous features</h2>\n                    <p>Uberfire supports notifications. Click on the following button for a demonstration.</p>\n                    <b:Button ui:field=\"notificationDefaultButton\">Notification Default</b:Button>\n                    <b:Button ui:field=\"notificationErrorButton\">Notification Error</b:Button>\n                    <b:Button ui:field=\"notificationSuccessButton\">Notification Success</b:Button>\n                    <b:Button ui:field=\"notificationInfoButton\">Notification Info</b:Button>\n                    <b:Button ui:field=\"notificationWarnButton\">Notification Warn</b:Button>\n                    <hr/>\n                    <p>Uberfire has some built in popups.</p>\n                    <b:Button ui:field=\"launchUnknownPlace\">Open popup</b:Button>\n                    <hr/>\n                    <p>Sets a new Title</p>\n                    <b:Button ui:field=\"setNewTitleButton\">New Title</b:Button>\n                    <hr/>\n                    <p>Activity not found</p>\n                    <b:Button ui:field=\"activityNotFound\">Try</b:Button>\n                    <hr/>\n                    <p>Uberfire also supports native JavaScript Editors</p>\n                    <b:Button text=\"Launch Editor\" ui:field=\"editor\"/>\n                </div>\n            </div>\n        </div>\n    </g:HTMLPanel>\n\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/popup/SimplePopUp.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.popup;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.VerticalPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An example popup\n */\n@WorkbenchPopup(identifier = SimplePopUp.SCREEN_ID, size = WorkbenchPopup.WorkbenchPopupSize.LARGE)\npublic class SimplePopUp {\n\n    public static final String SCREEN_ID = \"MyTestPopUp\";\n    private final VerticalPanel view = new VerticalPanel();\n    @Inject\n    private PlaceManager placeManager;\n    private PlaceRequest place;\n    private Paragraph p;\n\n    @PostConstruct\n    public void setup() {\n        p = new Paragraph(\"Cool PopUp!\");\n        view.add(p);\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"MyPopUp Title here\";\n    }\n\n    @WorkbenchPartView\n    public Widget getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/splash/FileExplorerSplashScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.splash;\n\nimport java.util.Arrays;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.SplashBodyHeight;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.workbench.model.impl.SplashScreenFilterImpl;\n\n@ActivatedBy(NoSplashQueryParamActivator.class)\n@WorkbenchSplashScreen(identifier = \"fileExplorer.splash\")\npublic class FileExplorerSplashScreen {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Cool Splash Screen!\";\n    }\n\n    @WorkbenchPartView\n    public Widget getView() {\n        FlowPanel p = new FlowPanel();\n        p.add(new Text(\"Hello world!\"));\n        return p;\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return new SplashScreenFilterImpl(\"fileExplorer.splash\",\n                                          true,\n                                          Arrays.asList(\"FileExplorerPerspective\",\n                                                        \"FileExplorer\"));\n    }\n\n    @SplashBodyHeight\n    public Integer getBodySize() {\n        return 40;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/splash/NoSplashQueryParamActivator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.splash;\n\nimport javax.inject.Singleton;\n\nimport com.google.gwt.user.client.Window;\nimport org.jboss.errai.ioc.client.container.BeanActivator;\n\n/**\n * A simple example of a bean activator: reports true unless there is a \"nosplash\" parameter in the location bar.\n */\n@Singleton\npublic class NoSplashQueryParamActivator implements BeanActivator {\n\n    @Override\n    public boolean isActivated() {\n        return Window.Location.getParameter(\"nosplash\") == null;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/todo/AbstractMarkdownScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.todo;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\n\npublic abstract class AbstractMarkdownScreen extends Composite {\n\n    protected static final String EMPTY = \"<p>-- empty --</p>\";\n\n    protected HTML markdown = new HTML(EMPTY);\n\n    @Inject\n    protected Caller<VFSService> vfsServices;\n\n    public static native String parseMarkdown(String content)/*-{\n        return $wnd.marked(content);\n    }-*/;\n\n    @PostConstruct\n    public void init() {\n        vfsServices.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path o) {\n                vfsServices.call(new RemoteCallback<String>() {\n                    @Override\n                    public void callback(final String response) {\n                        if (response == null) {\n                            setContent(EMPTY);\n                        } else {\n                            try {\n                                setContent(parseMarkdown(response));\n                            } catch (Exception e) {\n                                setContent(EMPTY);\n                                GWT.log(\"Error parsing markdown content\",\n                                        e);\n                            }\n                        }\n                    }\n                }).readAllString(o);\n            }\n        }).get(getMarkdownFileURI());\n        markdown.getElement().getStyle().setPadding(15,\n                                                    Style.Unit.PX);\n        initWidget(markdown);\n    }\n\n    @WorkbenchPartView\n    public Widget getView() {\n        return this;\n    }\n\n    @DefaultPosition\n    public Position getDefaultPosition() {\n        return CompassPosition.EAST;\n    }\n\n    public abstract String getMarkdownFileURI();\n\n    protected void setContent(final String content) {\n        this.markdown.setHTML(content);\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/todo/ReadmeScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.todo;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = \"ReadmeScreen\", preferredWidth = 400)\npublic class ReadmeScreen extends AbstractMarkdownScreen {\n\n    @Override\n    public String getMarkdownFileURI() {\n        return \"default://uf-playground/README.md\";\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"README\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Validate\")\n                                     .respondsWith(() -> Window.alert(\"valid!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Build\")\n                                     .menus()\n                                     .menu(\"Build & Deploy\")\n                                     .respondsWith(() -> Window.alert(\"Build!\"))\n                                     .endMenu()\n                                     .endMenus()\n                                     .endMenu()\n                                     .build());\n    }\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/todo/TodoListScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.todo;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@WorkbenchScreen(identifier = \"TodoListScreen\", preferredWidth = 400)\npublic class TodoListScreen extends AbstractMarkdownScreen {\n\n    @Override\n    public String getMarkdownFileURI() {\n        return \"default://uf-playground/todo.md\";\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Todo List\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(MenuFactory\n                                     .newTopLevelMenu(\"Save\")\n                                     .respondsWith(() -> Window.alert(\"Saved!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Delete\")\n                                     .respondsWith(() -> Window.alert(\"Deleted!\"))\n                                     .endMenu()\n                                     .newTopLevelMenu(\"Edit\")\n                                     .menus()\n                                     .menu(\"Cut\")\n                                     .respondsWith(() -> Window.alert(\"Cut!\"))\n                                     .endMenu()\n                                     .menu(\"Paste\")\n                                     .respondsWith(() -> Window.alert(\"Paste!\"))\n                                     .endMenu()\n                                     .endMenus()\n                                     .endMenu()\n                                     .build());\n    }\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/videos/VideoListScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.videos;\n\nimport java.util.LinkedList;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.HeadingSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.events.YouTubeVideo;\n\n@Dependent\n@WorkbenchScreen(identifier = \"YouTubeVideos\")\npublic class VideoListScreen {\n\n    private static final List<YouTubeVideo> VIDEOS = new LinkedList<YouTubeVideo>() {{\n        add(new YouTubeVideo(\"Quick Tour\",\n                             \"A quick tour that shows UberFire cool features.\",\n                             \"http://www.youtube.com/embed/xnmSR62_4Us?rel=0\"));\n        add(new YouTubeVideo(\"Sample App\",\n                             \"Here a good example of an application build on top of UberFire.\",\n                             \"http://www.youtube.com/embed/Y3LX4E9OKcs?rel=0\"));\n    }};\n\n    @Inject\n    protected Event<YouTubeVideo> event;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"UberFire Videos\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        final FlowPanel widgets = new FlowPanel();\n\n        widgets.getElement().getStyle().setPadding(15,\n                                                   Style.Unit.PX);\n\n        for (final YouTubeVideo video : VIDEOS) {\n\n            final Heading h3 = new Heading(HeadingSize.H3,\n                                           video.getName());\n            final Paragraph p = new Paragraph(video.getDescription());\n            final Button play = new Button(\"Play\",\n                                           new ClickHandler() {\n                                               @Override\n                                               public void onClick(final ClickEvent e) {\n                                                   event.fire(video);\n                                               }\n                                           });\n            play.setIcon(IconType.YOUTUBE_PLAY);\n            play.setSize(ButtonSize.SMALL);\n\n            widgets.add(h3);\n            widgets.add(p);\n            widgets.add(play);\n        }\n\n        return widgets;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/welcome/WelcomeScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.welcome;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.annotations.WorkbenchContextId;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"welcome\")\npublic class WelcomeScreen\n        extends Composite {\n\n    private static ViewBinder uiBinder = GWT.create(ViewBinder.class);\n\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Welcome\";\n    }\n\n    @WorkbenchContextId\n    public String getMyContextRef() {\n        return \"welcomeContext\";\n    }\n\n    interface ViewBinder\n            extends\n            UiBinder<Widget, WelcomeScreen> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/welcome/WelcomeScreen.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:h=\"urn:import:org.gwtbootstrap3.client.ui.html\">\n\n  <ui:style>\n    .welc {\n      height: 100%;\n      border: 1px solid lightgrey;\n    }\n  </ui:style>\n\n  <h:Div addStyleNames=\"{style.welc}\">\n    <b:Heading alignment=\"CENTER\" size=\"H1\" text=\"Welcome to UberFire\"/>\n    <h:Paragraph alignment=\"CENTER\">Now with a bright new Look &amp; Feel based on PatternFly.</h:Paragraph>\n  </h:Div>\n</ui:UiBinder>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/welcome/WelcomeTabScreen.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div style=\"padding: 15px\">\n    <h3>Welcome to Tab 2!</h3>\n\n    <p>Glad you made it here! However, there's nothing on this page... :)</p>\n</div>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/welcome/WelcomeTabScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.welcome;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WelcomeTabScreen\")\n@Templated\npublic class WelcomeTabScreen extends Composite {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Welcome Tab 2\";\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/widgets/WidgetsShowcasePresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElement;\n\n@Dependent\n@WorkbenchScreen(identifier = \"WidgetsShowcase\")\npublic class WidgetsShowcasePresenter {\n\n    @Inject\n    WidgetsShowcaseView view;\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"Widgets Showcase Screen\";\n    }\n\n    @WorkbenchPartView\n    public UberElement getView() {\n        return view;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/widgets/WidgetsShowcaseView.html",
    "content": "<div data-field=\"root\">\n    <div class=\"col-md-12\">\n        <section>\n            <h3>Popover examples</h3>\n            <p>See\n                <a href=\"http://www.patternfly.org/pattern-library/widgets/#popover\">http://www.patternfly.org/pattern-library/widgets/#popover</a> for complete popover documentation.\n            </p>\n            <ul class=\"list-group\">\n                <li class=\"list-group-item\">\n                    <h4 class=\"list-group-item-heading\">Example using data-* attributes</h4>\n                    <a class=\"list-group-item-text btn btn-link\" role=\"button\" data-toggle=\"popover\" data-field=\"popover\" data-trigger=\"hover\" data-content=\"test...\" title=\"\" data-placement=\"left\" data-container=\"body\">\n                        <span class=\"pficon pficon-info\"></span>\n                    </a>\n                </li>\n                <li class=\"list-group-item\">\n                    <h4 class=\"list-group-item-heading\">Example using dynamic element</h4>\n                    <div class=\"list-group-item-text\" data-field=\"dynamic-popover\"></div>\n                </li>\n                <li class=\"list-group-item\">\n                    <h4 class=\"list-group-item-heading\">Example overriding data-* attributes</h4>\n                    <a class=\"list-group-item-text btn btn-link\" role=\"button\" data-toggle=\"popover\" data-field=\"popover-override\" data-trigger=\"hover\" data-content=\"test...\" title=\"\" data-placement=\"top\" data-container=\"body\">\n                        <span class=\"pficon pficon-info\"></span>\n                    </a>\n                </li>\n                <li class=\"list-group-item\">\n                    <h4 class=\"list-group-item-heading\">Example using custom element</h4>\n                    <button type=\"button\" class=\"btn btn-default\" data-field=\"popover-button\" data-container=\"body\" data-toggle=\"popover\" data-placement=\"right\" data-html=\"true\">\n                        Popover on right\n                    </button>\n                </li>\n            </ul>\n        </section>\n        <hr>\n        <section>\n            <h3>Date Range Picker examples</h3>\n            <p>See\n                <a href=\"http://www.daterangepicker.com\">http://www.daterangepicker.com</a> for complete Date Range Picker documentation.\n            </p>\n            <ul class=\"list-group\">\n                <li class=\"list-group-item\">\n                    <h4 class=\"list-group-item-heading\">Example using input</h4>\n                    <div class=\"row\">\n                        <div class=\"col-md-4\">\n                            <input type=\"text\" class=\"form-control\" placeholder=\"Date range...\" data-field=\"datetimepicker\"/>\n                        </div>\n                    </div>\n                </li>\n            </ul>\n        </section>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/widgets/WidgetsShowcaseView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.widgets;\n\nimport java.util.Date;\nimport java.util.Random;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.Element;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.slf4j.Logger;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.views.pfly.widgets.DateRangePicker;\nimport org.uberfire.client.views.pfly.widgets.DateRangePickerOptions;\nimport org.uberfire.client.views.pfly.widgets.JQueryProducer;\nimport org.uberfire.client.views.pfly.widgets.Popover;\nimport org.uberfire.client.views.pfly.widgets.PopoverOptions;\n\nimport static org.jboss.errai.common.client.dom.Window.getDocument;\nimport static org.uberfire.client.views.pfly.widgets.Moment.Builder.moment;\n\n@Dependent\n@Templated\npublic class WidgetsShowcaseView implements UberElement<WidgetsShowcasePresenter> {\n\n    @Inject\n    private Logger logger;\n\n    @Inject\n    private JQueryProducer.JQuery<Popover> jQueryPopover;\n\n    @Inject\n    @DataField\n    private Div root;\n\n    @Inject\n    @DataField\n    private Anchor popover;\n\n    @Inject\n    @DataField(\"dynamic-popover\")\n    private Div dynamicPopover;\n\n    @Inject\n    @DataField(\"popover-override\")\n    private Anchor popoverOverride;\n\n    @Inject\n    @DataField(\"popover-button\")\n    private Button popoverButton;\n\n    @Inject\n    @DataField(\"datetimepicker\")\n    private DateRangePicker dateRangePicker;\n\n    @Override\n    public void init(final WidgetsShowcasePresenter presenter) {\n        //Ex 1\n        jQueryPopover.wrap(popover).popover();\n        //Ex 2\n        final PopoverOptions popoverOptions = new PopoverOptions();\n        popoverOptions.setContent(e -> \"dynamic content: \" + new Random().nextInt());\n        popoverOptions.setTrigger(\"click\");\n        popoverOptions.setPlacement(\"bottom\");\n        popoverOptions.setContainer(\"body\");\n        final Anchor anchor = (Anchor) getDocument().createElement(\"a\");\n        anchor.setAttribute(\"data-toggle\",\n                            \"popover\");\n        anchor.setTextContent(\"View popover\");\n        dynamicPopover.appendChild(anchor);\n        jQueryPopover.wrap(anchor).popover(popoverOptions);\n        //Ex 3\n        popoverOverride.setAttribute(\"data-content\",\n                                     \"New content!\");\n        jQueryPopover.wrap(popoverOverride).popover();\n        //Ex 4\n        final PopoverOptions popoverButtonOptions = new PopoverOptions();\n        popoverButtonOptions.setContent(e -> {\n            final Element span = DomGlobal.document.createElement(\"span\");\n            span.textContent = \"dynamic element text\";\n            return span;\n        });\n        final Popover popover = jQueryPopover.wrap(popoverButton);\n        popover.popover(popoverButtonOptions);\n        popover.addShowListener(() -> logger.info(\"popover show callback\"));\n        popover.addHideListener(() -> logger.info(\"popover hide callback\"));\n        //Date range ex\n        final DateRangePickerOptions options = getDateRangePickerOptions();\n\n        dateRangePicker.setup(options,\n                              getDateRangePickerCallback());\n        dateRangePicker.addApplyListener((e, p) -> {\n            logger.info(\"picker apply listener\");\n            logger.info(\"picker start date: {}\",\n                        p.getStartDate());\n            logger.info(\"picker end date: {}\",\n                        p.getEndDate());\n            logger.info(\"picker label: {}\",\n                        p.getChosenLabel());\n        });\n    }\n\n    protected DateRangePicker.DateRangePickerCallback getDateRangePickerCallback() {\n        return (start, end, label) -> {\n            logger.info(\"picker callback\");\n            logger.info(\"picker start date: {}\",\n                        start);\n            logger.info(\"picker start date as java.util.Date: {}\",\n                        start.asDate());\n            logger.info(\"picker start date valueof: {}\",\n                        new Date(start.valueOf().longValue()));\n            logger.info(\"picker start date aslong: {}\",\n                        new Date(start.asLong()));\n            logger.info(\"picker end date: {}\",\n                        end);\n            logger.info(\"picker end date as java.util.Date: {}\",\n                        end.asDate());\n            logger.info(\"picker label: {}\",\n                        label);\n        };\n    }\n\n    protected DateRangePickerOptions getDateRangePickerOptions() {\n        final DateRangePickerOptions options = DateRangePickerOptions.create();\n        options.setAutoUpdateInput(true);\n        options.setAutoApply(true);\n        options.setTimePicker(true);\n        options.setTimePickerIncrement(30);\n        options.setMaxDate(moment().endOf(\"day\"));\n        options.addRange(\"Today\",\n                         moment().startOf(\"day\"),\n                         moment().endOf(\"day\"));\n\n        options.addRange(\"Last Hour\",\n                         moment().subtract(1,\n                                           \"hours\"),\n                         moment().endOf(\"day\"));\n        options.addRange(\"Last 24 Hours\",\n                         moment().subtract(24,\n                                           \"hours\"),\n                         moment().endOf(\"day\"));\n        return options;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return root;\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/youtube/YouTubeScreen.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div class=\"youtube-video\">\n    <iframe data-field=\"iframe\"/>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/client/screens/youtube/YouTubeScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.screens.youtube;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.safehtml.shared.UriUtils;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Frame;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.events.YouTubeVideo;\n\n@Dependent\n@WorkbenchScreen(identifier = \"YouTubeScreen\")\n@Templated\npublic class YouTubeScreen extends Composite {\n\n    private static final String URL = \"http://www.youtube.com/embed/xnmSR62_4Us?rel=0\";\n\n    @Inject\n    @DataField\n    protected Frame iframe;\n\n    @PostConstruct\n    public void init() {\n        iframe.setUrl(UriUtils.fromString(URL).asString());\n    }\n\n    @WorkbenchPartTitle\n    public String getName() {\n        return \"YouTube Video\";\n    }\n\n    public void reloadContent(@Observes YouTubeVideo content) {\n        iframe.setUrl(UriUtils.fromString(content.getURL()).asString());\n    }\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/shared/experimental/ExperimentalAssetRemoved.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.shared.experimental;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class ExperimentalAssetRemoved {\n\n    private Path path;\n\n    public ExperimentalAssetRemoved(@MapsTo(\"path\") Path path) {\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/java/org/uberfire/shared/experimental/ExperimentalEditorService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.shared.experimental;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.service.support.SupportsDelete;\n\n@Remote\npublic interface ExperimentalEditorService extends SupportsDelete {\n\n    List<Path> listAll();\n\n    Path create(String assetName);\n\n    String load(Path path);\n\n    void save(Path path, String content);\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/ErraiService.properties",
    "content": "\n#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n#\n# Request dispatcher implementation (SimpleDispatcher must be used for Errai CDI)\n#\nerrai.dispatcher_implementation=org.jboss.errai.bus.server.SimpleDispatcher\n\n#\n# Worker pool size.  This is the number of threads the asynchronous worker pool should provide for processing\n# incoming messages. This option is only valid when using the AsyncDispatcher implementation.\n#\nerrai.async.thread_pool_size=5\n\n#\n# Specify the Authentication/Authorization Adapter sendNowWith use\n#\nerrai.authentication_adapter=org.jboss.errai.bus.server.security.auth.JAASAdapter\n\n##\n## This property indicates whether or not authentication is required for all communication with the bus.  Set this\n## to 'true' if all access to your application should be secure.\n##\nerrai.require_authentication_for_all=true\n\n#\n# (Optional) A Login MOTD sendNowWith be sent sendNowWith the client upon successful login.\n#\nerrai.login_motd=UNAUTHORIZED ACCESS IS PROHIBITED!"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n\nerrai.security.user_on_hostpage_enabled=true\n\nerrai.marshalling.serializableTypes=org.uberfire.shared.experimental.ExperimentalAssetRemoved\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\n# org.uberfire.java.nio.fs.eclipse.EclipseFileSystemProvider  # eclipse provider\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d %-5p %-15c{15} [%t] %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.drools\" level=\"info\"/>\n  <logger name=\"org.uberfire\" level=\"info\"/>\n\n  <root level=\"info\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/FastCompiledUberfireShowcase.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n        \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module rename-to=\"org.uberfire.UberfireShowcase\">\n\n    <inherits name=\"org.uberfire.UberfireShowcase\"/>\n\n    <set-property name=\"user.agent\" value=\"safari,gecko1_8\"/>\n    <set-property name=\"locale\" value=\"default\"/>\n\n    <collapse-all-properties/>\n</module>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/UberfireShowcase.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.uberfire.UberfireClientAll\"/>\n  <inherits name=\"org.uberfire.UberfireBackend\"/>\n  <inherits name=\"org.uberfire.client.views.PatternFlyTheme\"/>\n  <inherits name=\"org.uberfire.ext.preferences.UberfirePreferences\"/>\n  <inherits name=\"org.uberfire.ext.plugin.RuntimePluginClient\"/>\n  <inherits name=\"org.uberfire.ext.apps.UberfireAppsClient\"/>\n  <inherits name=\"org.uberfire.ext.widgets.core.UberfireWidgetsCore\"/>\n  <inherits name=\"org.uberfire.ssh.UberfireSSHClient\"/>\n\n  <!-- Experimental -->\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalAPI\"/>\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n  <!-- Specify the application specific style sheet. -->\n  <stylesheet src='css/uberfire-showcase.css'/>\n\n  <!-- Specify the paths for translatable code -->\n  <source path='client'/>\n  <source path='shared'/>\n\n  <!-- i18n -->\n  <extend-property name=\"locale\" values=\"es\"/>\n  <extend-property name=\"locale\" values=\"fr\"/>\n  <extend-property name=\"locale\" values=\"ja\"/>\n  <extend-property name=\"locale\" values=\"pt_BR\"/>\n  <extend-property name=\"locale\" values=\"zh_CN\"/>\n  <extend-property name=\"locale\" values=\"de\"/>\n  <extend-property name=\"locale\" values=\"it\"/>\n\n  <collapse-property name=\"locale\" values=\"*\"/>\n\n  <!-- We don't need to support IE10 or older -->\n  <!-- There is no \"ie11\" permutation. IE11 uses the Firefox one (gecko1_8) -->\n  <set-property name=\"user.agent\" value=\"gecko1_8,safari\"/>\n\n  <set-property name=\"jre.checks.checkLevel\" value=\"MINIMAL\" />\n  <set-property name=\"jre.checkedMode\" value=\"DISABLED\" />\n  \n</module>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/jsbridge/public/AppFormerComponentsRegistry.js",
    "content": "window.AppFormerComponentsRegistry = {};"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/public/css/ruleflow.css",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n.ruleflow-image{\n    padding: 2px 1px 0px 0px;\n    float: right;\n}\n\n.white-ruleflow-node, \n.blue-ruleflow-node, \n.yellow-ruleflow-node {\n    border-right: 1px solid black;\n    border-left: 1px solid black;\n    font-size: 11px;\n    color: black;\n    text-align: center;\n    vertical-align: middle;\n}\n\n.white-ruleflow-node {\n    padding-top: 10px;\n    border-top: 1px solid black;\n    border-bottom: 1px solid black;\n    background-color: white;\n}\n\n.yellow-ruleflow-node {\n    background-color: rgb( 255, 250, 205 );\n}\n\n.blue-ruleflow-node {\n    background-color: rgb( 70, 130, 180 );\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/public/css/uberfire-loading.css",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* Loading indicator at Startup */\n#loading {\n    position: absolute;\n    left: 45%;\n    top: 40%;\n    padding: 2px;\n    z-index: 20001;\n    height: auto;\n    border: 1px solid #ccc;\n}\n\n#loading a {\n    color: #225588;\n}"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/public/css/uberfire-showcase.css",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nhtml, body {\n    height: 100%;\n}\n\n.youtube-video {\n    position: relative;\n    display: block;\n    height: 0;\n    padding: 0;\n    padding-bottom: 56.25%;\n    overflow: hidden;\n}\n\n.youtube-video > iframe {\n    position: absolute;\n    top: 0;\n    left: 0;\n    bottom: 0;\n    height: 100%;\n    width: 100%;\n    border: none\n}\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/org/uberfire/public/js/marked.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n;(function() {\n\n/**\n * Block-Level Grammar\n */\n\nvar block = {\n  newline: /^\\n+/,\n  code: /^( {4}[^\\n]+\\n*)+/,\n  fences: noop,\n  hr: /^( *[-*_]){3,} *(?:\\n+|$)/,\n  heading: /^ *(#{1,6}) *([^\\n]+?) *#* *(?:\\n+|$)/,\n  nptable: noop,\n  lheading: /^([^\\n]+)\\n *(=|-){2,} *(?:\\n+|$)/,\n  blockquote: /^( *>[^\\n]+(\\n(?!def)[^\\n]+)*\\n*)+/,\n  list: /^( *)(bull) [\\s\\S]+?(?:hr|def|\\n{2,}(?! )(?!\\1bull )\\n*|\\s*$)/,\n  html: /^ *(?:comment *(?:\\n|\\s*$)|closed *(?:\\n{2,}|\\s*$)|closing *(?:\\n{2,}|\\s*$))/,\n  def: /^ *\\[([^\\]]+)\\]: *<?([^\\s>]+)>?(?: +[\"(]([^\\n]+)[\")])? *(?:\\n+|$)/,\n  table: noop,\n  paragraph: /^((?:[^\\n]+\\n?(?!hr|heading|lheading|blockquote|tag|def))+)\\n*/,\n  text: /^[^\\n]+/\n};\n\nblock.bullet = /(?:[*+-]|\\d+\\.)/;\nblock.item = /^( *)(bull) [^\\n]*(?:\\n(?!\\1bull )[^\\n]*)*/;\nblock.item = replace(block.item, 'gm')\n  (/bull/g, block.bullet)\n  ();\n\nblock.list = replace(block.list)\n  (/bull/g, block.bullet)\n  ('hr', '\\\\n+(?=\\\\1?(?:[-*_] *){3,}(?:\\\\n+|$))')\n  ('def', '\\\\n+(?=' + block.def.source + ')')\n  ();\n\nblock.blockquote = replace(block.blockquote)\n  ('def', block.def)\n  ();\n\nblock._tag = '(?!(?:'\n  + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code'\n  + '|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo'\n  + '|span|br|wbr|ins|del|img)\\\\b)\\\\w+(?!:/|[^\\\\w\\\\s@]*@)\\\\b';\n\nblock.html = replace(block.html)\n  ('comment', /<!--[\\s\\S]*?-->/)\n  ('closed', /<(tag)[\\s\\S]+?<\\/\\1>/)\n  ('closing', /<tag(?:\"[^\"]*\"|'[^']*'|[^'\">])*?>/)\n  (/tag/g, block._tag)\n  ();\n\nblock.paragraph = replace(block.paragraph)\n  ('hr', block.hr)\n  ('heading', block.heading)\n  ('lheading', block.lheading)\n  ('blockquote', block.blockquote)\n  ('tag', '<' + block._tag)\n  ('def', block.def)\n  ();\n\n/**\n * Normal Block Grammar\n */\n\nblock.normal = merge({}, block);\n\n/**\n * GFM Block Grammar\n */\n\nblock.gfm = merge({}, block.normal, {\n  fences: /^ *(`{3,}|~{3,}) *(\\S+)? *\\n([\\s\\S]+?)\\s*\\1 *(?:\\n+|$)/,\n  paragraph: /^/\n});\n\nblock.gfm.paragraph = replace(block.paragraph)\n  ('(?!', '(?!'\n    + block.gfm.fences.source.replace('\\\\1', '\\\\2') + '|'\n    + block.list.source.replace('\\\\1', '\\\\3') + '|')\n  ();\n\n/**\n * GFM + Tables Block Grammar\n */\n\nblock.tables = merge({}, block.gfm, {\n  nptable: /^ *(\\S.*\\|.*)\\n *([-:]+ *\\|[-| :]*)\\n((?:.*\\|.*(?:\\n|$))*)\\n*/,\n  table: /^ *\\|(.+)\\n *\\|( *[-:]+[-| :]*)\\n((?: *\\|.*(?:\\n|$))*)\\n*/\n});\n\n/**\n * Block Lexer\n */\n\nfunction Lexer(options) {\n  this.tokens = [];\n  this.tokens.links = {};\n  this.options = options || marked.defaults;\n  this.rules = block.normal;\n\n  if (this.options.gfm) {\n    if (this.options.tables) {\n      this.rules = block.tables;\n    } else {\n      this.rules = block.gfm;\n    }\n  }\n}\n\n/**\n * Expose Block Rules\n */\n\nLexer.rules = block;\n\n/**\n * Static Lex Method\n */\n\nLexer.lex = function(src, options) {\n  var lexer = new Lexer(options);\n  return lexer.lex(src);\n};\n\n/**\n * Preprocessing\n */\n\nLexer.prototype.lex = function(src) {\n  src = src\n    .replace(/\\r\\n|\\r/g, '\\n')\n    .replace(/\\t/g, '    ')\n    .replace(/\\u00a0/g, ' ')\n    .replace(/\\u2424/g, '\\n');\n\n  return this.token(src, true);\n};\n\n/**\n * Lexing\n */\n\nLexer.prototype.token = function(src, top, bq) {\n  var src = src.replace(/^ +$/gm, '')\n    , next\n    , loose\n    , cap\n    , bull\n    , b\n    , item\n    , space\n    , i\n    , l;\n\n  while (src) {\n    // newline\n    if (cap = this.rules.newline.exec(src)) {\n      src = src.substring(cap[0].length);\n      if (cap[0].length > 1) {\n        this.tokens.push({\n          type: 'space'\n        });\n      }\n    }\n\n    // code\n    if (cap = this.rules.code.exec(src)) {\n      src = src.substring(cap[0].length);\n      cap = cap[0].replace(/^ {4}/gm, '');\n      this.tokens.push({\n        type: 'code',\n        text: !this.options.pedantic\n          ? cap.replace(/\\n+$/, '')\n          : cap\n      });\n      continue;\n    }\n\n    // fences (gfm)\n    if (cap = this.rules.fences.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'code',\n        lang: cap[2],\n        text: cap[3]\n      });\n      continue;\n    }\n\n    // heading\n    if (cap = this.rules.heading.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'heading',\n        depth: cap[1].length,\n        text: cap[2]\n      });\n      continue;\n    }\n\n    // table no leading pipe (gfm)\n    if (top && (cap = this.rules.nptable.exec(src))) {\n      src = src.substring(cap[0].length);\n\n      item = {\n        type: 'table',\n        header: cap[1].replace(/^ *| *\\| *$/g, '').split(/ *\\| */),\n        align: cap[2].replace(/^ *|\\| *$/g, '').split(/ *\\| */),\n        cells: cap[3].replace(/\\n$/, '').split('\\n')\n      };\n\n      for (i = 0; i < item.align.length; i++) {\n        if (/^ *-+: *$/.test(item.align[i])) {\n          item.align[i] = 'right';\n        } else if (/^ *:-+: *$/.test(item.align[i])) {\n          item.align[i] = 'center';\n        } else if (/^ *:-+ *$/.test(item.align[i])) {\n          item.align[i] = 'left';\n        } else {\n          item.align[i] = null;\n        }\n      }\n\n      for (i = 0; i < item.cells.length; i++) {\n        item.cells[i] = item.cells[i].split(/ *\\| */);\n      }\n\n      this.tokens.push(item);\n\n      continue;\n    }\n\n    // lheading\n    if (cap = this.rules.lheading.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'heading',\n        depth: cap[2] === '=' ? 1 : 2,\n        text: cap[1]\n      });\n      continue;\n    }\n\n    // hr\n    if (cap = this.rules.hr.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'hr'\n      });\n      continue;\n    }\n\n    // blockquote\n    if (cap = this.rules.blockquote.exec(src)) {\n      src = src.substring(cap[0].length);\n\n      this.tokens.push({\n        type: 'blockquote_start'\n      });\n\n      cap = cap[0].replace(/^ *> ?/gm, '');\n\n      // Pass `top` to keep the current\n      // \"toplevel\" state. This is exactly\n      // how markdown.pl works.\n      this.token(cap, top, true);\n\n      this.tokens.push({\n        type: 'blockquote_end'\n      });\n\n      continue;\n    }\n\n    // list\n    if (cap = this.rules.list.exec(src)) {\n      src = src.substring(cap[0].length);\n      bull = cap[2];\n\n      this.tokens.push({\n        type: 'list_start',\n        ordered: bull.length > 1\n      });\n\n      // Get each top-level item.\n      cap = cap[0].match(this.rules.item);\n\n      next = false;\n      l = cap.length;\n      i = 0;\n\n      for (; i < l; i++) {\n        item = cap[i];\n\n        // Remove the list item's bullet\n        // so it is seen as the next token.\n        space = item.length;\n        item = item.replace(/^ *([*+-]|\\d+\\.) +/, '');\n\n        // Outdent whatever the\n        // list item contains. Hacky.\n        if (~item.indexOf('\\n ')) {\n          space -= item.length;\n          item = !this.options.pedantic\n            ? item.replace(new RegExp('^ {1,' + space + '}', 'gm'), '')\n            : item.replace(/^ {1,4}/gm, '');\n        }\n\n        // Determine whether the next list item belongs here.\n        // Backpedal if it does not belong in this list.\n        if (this.options.smartLists && i !== l - 1) {\n          b = block.bullet.exec(cap[i + 1])[0];\n          if (bull !== b && !(bull.length > 1 && b.length > 1)) {\n            src = cap.slice(i + 1).join('\\n') + src;\n            i = l - 1;\n          }\n        }\n\n        // Determine whether item is loose or not.\n        // Use: /(^|\\n)(?! )[^\\n]+\\n\\n(?!\\s*$)/\n        // for discount behavior.\n        loose = next || /\\n\\n(?!\\s*$)/.test(item);\n        if (i !== l - 1) {\n          next = item.charAt(item.length - 1) === '\\n';\n          if (!loose) loose = next;\n        }\n\n        this.tokens.push({\n          type: loose\n            ? 'loose_item_start'\n            : 'list_item_start'\n        });\n\n        // Recurse.\n        this.token(item, false, bq);\n\n        this.tokens.push({\n          type: 'list_item_end'\n        });\n      }\n\n      this.tokens.push({\n        type: 'list_end'\n      });\n\n      continue;\n    }\n\n    // html\n    if (cap = this.rules.html.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: this.options.sanitize\n          ? 'paragraph'\n          : 'html',\n        pre: cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style',\n        text: cap[0]\n      });\n      continue;\n    }\n\n    // def\n    if ((!bq && top) && (cap = this.rules.def.exec(src))) {\n      src = src.substring(cap[0].length);\n      this.tokens.links[cap[1].toLowerCase()] = {\n        href: cap[2],\n        title: cap[3]\n      };\n      continue;\n    }\n\n    // table (gfm)\n    if (top && (cap = this.rules.table.exec(src))) {\n      src = src.substring(cap[0].length);\n\n      item = {\n        type: 'table',\n        header: cap[1].replace(/^ *| *\\| *$/g, '').split(/ *\\| */),\n        align: cap[2].replace(/^ *|\\| *$/g, '').split(/ *\\| */),\n        cells: cap[3].replace(/(?: *\\| *)?\\n$/, '').split('\\n')\n      };\n\n      for (i = 0; i < item.align.length; i++) {\n        if (/^ *-+: *$/.test(item.align[i])) {\n          item.align[i] = 'right';\n        } else if (/^ *:-+: *$/.test(item.align[i])) {\n          item.align[i] = 'center';\n        } else if (/^ *:-+ *$/.test(item.align[i])) {\n          item.align[i] = 'left';\n        } else {\n          item.align[i] = null;\n        }\n      }\n\n      for (i = 0; i < item.cells.length; i++) {\n        item.cells[i] = item.cells[i]\n          .replace(/^ *\\| *| *\\| *$/g, '')\n          .split(/ *\\| */);\n      }\n\n      this.tokens.push(item);\n\n      continue;\n    }\n\n    // top-level paragraph\n    if (top && (cap = this.rules.paragraph.exec(src))) {\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'paragraph',\n        text: cap[1].charAt(cap[1].length - 1) === '\\n'\n          ? cap[1].slice(0, -1)\n          : cap[1]\n      });\n      continue;\n    }\n\n    // text\n    if (cap = this.rules.text.exec(src)) {\n      // Top-level should never reach here.\n      src = src.substring(cap[0].length);\n      this.tokens.push({\n        type: 'text',\n        text: cap[0]\n      });\n      continue;\n    }\n\n    if (src) {\n      throw new\n        Error('Infinite loop on byte: ' + src.charCodeAt(0));\n    }\n  }\n\n  return this.tokens;\n};\n\n/**\n * Inline-Level Grammar\n */\n\nvar inline = {\n  escape: /^\\\\([\\\\`*{}\\[\\]()#+\\-.!_>])/,\n  autolink: /^<([^ >]+(@|:\\/)[^ >]+)>/,\n  url: noop,\n  tag: /^<!--[\\s\\S]*?-->|^<\\/?\\w+(?:\"[^\"]*\"|'[^']*'|[^'\">])*?>/,\n  link: /^!?\\[(inside)\\]\\(href\\)/,\n  reflink: /^!?\\[(inside)\\]\\s*\\[([^\\]]*)\\]/,\n  nolink: /^!?\\[((?:\\[[^\\]]*\\]|[^\\[\\]])*)\\]/,\n  strong: /^__([\\s\\S]+?)__(?!_)|^\\*\\*([\\s\\S]+?)\\*\\*(?!\\*)/,\n  em: /^\\b_((?:__|[\\s\\S])+?)_\\b|^\\*((?:\\*\\*|[\\s\\S])+?)\\*(?!\\*)/,\n  code: /^(`+)\\s*([\\s\\S]*?[^`])\\s*\\1(?!`)/,\n  br: /^ {2,}\\n(?!\\s*$)/,\n  del: noop,\n  text: /^[\\s\\S]+?(?=[\\\\<!\\[_*`]| {2,}\\n|$)/\n};\n\ninline._inside = /(?:\\[[^\\]]*\\]|[^\\[\\]]|\\](?=[^\\[]*\\]))*/;\ninline._href = /\\s*<?([\\s\\S]*?)>?(?:\\s+['\"]([\\s\\S]*?)['\"])?\\s*/;\n\ninline.link = replace(inline.link)\n  ('inside', inline._inside)\n  ('href', inline._href)\n  ();\n\ninline.reflink = replace(inline.reflink)\n  ('inside', inline._inside)\n  ();\n\n/**\n * Normal Inline Grammar\n */\n\ninline.normal = merge({}, inline);\n\n/**\n * Pedantic Inline Grammar\n */\n\ninline.pedantic = merge({}, inline.normal, {\n  strong: /^__(?=\\S)([\\s\\S]*?\\S)__(?!_)|^\\*\\*(?=\\S)([\\s\\S]*?\\S)\\*\\*(?!\\*)/,\n  em: /^_(?=\\S)([\\s\\S]*?\\S)_(?!_)|^\\*(?=\\S)([\\s\\S]*?\\S)\\*(?!\\*)/\n});\n\n/**\n * GFM Inline Grammar\n */\n\ninline.gfm = merge({}, inline.normal, {\n  escape: replace(inline.escape)('])', '~|])')(),\n  url: /^(https?:\\/\\/[^\\s<]+[^<.,:;\"')\\]\\s])/,\n  del: /^~~(?=\\S)([\\s\\S]*?\\S)~~/,\n  text: replace(inline.text)\n    (']|', '~]|')\n    ('|', '|https?://|')\n    ()\n});\n\n/**\n * GFM + Line Breaks Inline Grammar\n */\n\ninline.breaks = merge({}, inline.gfm, {\n  br: replace(inline.br)('{2,}', '*')(),\n  text: replace(inline.gfm.text)('{2,}', '*')()\n});\n\n/**\n * Inline Lexer & Compiler\n */\n\nfunction InlineLexer(links, options) {\n  this.options = options || marked.defaults;\n  this.links = links;\n  this.rules = inline.normal;\n  this.renderer = this.options.renderer || new Renderer;\n  this.renderer.options = this.options;\n\n  if (!this.links) {\n    throw new\n      Error('Tokens array requires a `links` property.');\n  }\n\n  if (this.options.gfm) {\n    if (this.options.breaks) {\n      this.rules = inline.breaks;\n    } else {\n      this.rules = inline.gfm;\n    }\n  } else if (this.options.pedantic) {\n    this.rules = inline.pedantic;\n  }\n}\n\n/**\n * Expose Inline Rules\n */\n\nInlineLexer.rules = inline;\n\n/**\n * Static Lexing/Compiling Method\n */\n\nInlineLexer.output = function(src, links, options) {\n  var inline = new InlineLexer(links, options);\n  return inline.output(src);\n};\n\n/**\n * Lexing/Compiling\n */\n\nInlineLexer.prototype.output = function(src) {\n  var out = ''\n    , link\n    , text\n    , href\n    , cap;\n\n  while (src) {\n    // escape\n    if (cap = this.rules.escape.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += cap[1];\n      continue;\n    }\n\n    // autolink\n    if (cap = this.rules.autolink.exec(src)) {\n      src = src.substring(cap[0].length);\n      if (cap[2] === '@') {\n        text = cap[1].charAt(6) === ':'\n          ? this.mangle(cap[1].substring(7))\n          : this.mangle(cap[1]);\n        href = this.mangle('mailto:') + text;\n      } else {\n        text = escape(cap[1]);\n        href = text;\n      }\n      out += this.renderer.link(href, null, text);\n      continue;\n    }\n\n    // url (gfm)\n    if (!this.inLink && (cap = this.rules.url.exec(src))) {\n      src = src.substring(cap[0].length);\n      text = escape(cap[1]);\n      href = text;\n      out += this.renderer.link(href, null, text);\n      continue;\n    }\n\n    // tag\n    if (cap = this.rules.tag.exec(src)) {\n      if (!this.inLink && /^<a /i.test(cap[0])) {\n        this.inLink = true;\n      } else if (this.inLink && /^<\\/a>/i.test(cap[0])) {\n        this.inLink = false;\n      }\n      src = src.substring(cap[0].length);\n      out += this.options.sanitize\n        ? escape(cap[0])\n        : cap[0];\n      continue;\n    }\n\n    // link\n    if (cap = this.rules.link.exec(src)) {\n      src = src.substring(cap[0].length);\n      this.inLink = true;\n      out += this.outputLink(cap, {\n        href: cap[2],\n        title: cap[3]\n      });\n      this.inLink = false;\n      continue;\n    }\n\n    // reflink, nolink\n    if ((cap = this.rules.reflink.exec(src))\n        || (cap = this.rules.nolink.exec(src))) {\n      src = src.substring(cap[0].length);\n      link = (cap[2] || cap[1]).replace(/\\s+/g, ' ');\n      link = this.links[link.toLowerCase()];\n      if (!link || !link.href) {\n        out += cap[0].charAt(0);\n        src = cap[0].substring(1) + src;\n        continue;\n      }\n      this.inLink = true;\n      out += this.outputLink(cap, link);\n      this.inLink = false;\n      continue;\n    }\n\n    // strong\n    if (cap = this.rules.strong.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += this.renderer.strong(this.output(cap[2] || cap[1]));\n      continue;\n    }\n\n    // em\n    if (cap = this.rules.em.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += this.renderer.em(this.output(cap[2] || cap[1]));\n      continue;\n    }\n\n    // code\n    if (cap = this.rules.code.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += this.renderer.codespan(escape(cap[2], true));\n      continue;\n    }\n\n    // br\n    if (cap = this.rules.br.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += this.renderer.br();\n      continue;\n    }\n\n    // del (gfm)\n    if (cap = this.rules.del.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += this.renderer.del(this.output(cap[1]));\n      continue;\n    }\n\n    // text\n    if (cap = this.rules.text.exec(src)) {\n      src = src.substring(cap[0].length);\n      out += escape(this.smartypants(cap[0]));\n      continue;\n    }\n\n    if (src) {\n      throw new\n        Error('Infinite loop on byte: ' + src.charCodeAt(0));\n    }\n  }\n\n  return out;\n};\n\n/**\n * Compile Link\n */\n\nInlineLexer.prototype.outputLink = function(cap, link) {\n  var href = escape(link.href)\n    , title = link.title ? escape(link.title) : null;\n\n  return cap[0].charAt(0) !== '!'\n    ? this.renderer.link(href, title, this.output(cap[1]))\n    : this.renderer.image(href, title, escape(cap[1]));\n};\n\n/**\n * Smartypants Transformations\n */\n\nInlineLexer.prototype.smartypants = function(text) {\n  if (!this.options.smartypants) return text;\n  return text\n    // em-dashes\n    .replace(/--/g, '\\u2014')\n    // opening singles\n    .replace(/(^|[-\\u2014/(\\[{\"\\s])'/g, '$1\\u2018')\n    // closing singles & apostrophes\n    .replace(/'/g, '\\u2019')\n    // opening doubles\n    .replace(/(^|[-\\u2014/(\\[{\\u2018\\s])\"/g, '$1\\u201c')\n    // closing doubles\n    .replace(/\"/g, '\\u201d')\n    // ellipses\n    .replace(/\\.{3}/g, '\\u2026');\n};\n\n/**\n * Mangle Links\n */\n\nInlineLexer.prototype.mangle = function(text) {\n  var out = ''\n    , l = text.length\n    , i = 0\n    , ch;\n\n  for (; i < l; i++) {\n    ch = text.charCodeAt(i);\n    if (Math.random() > 0.5) {\n      ch = 'x' + ch.toString(16);\n    }\n    out += '&#' + ch + ';';\n  }\n\n  return out;\n};\n\n/**\n * Renderer\n */\n\nfunction Renderer(options) {\n  this.options = options || {};\n}\n\nRenderer.prototype.code = function(code, lang, escaped) {\n  if (this.options.highlight) {\n    var out = this.options.highlight(code, lang);\n    if (out != null && out !== code) {\n      escaped = true;\n      code = out;\n    }\n  }\n\n  if (!lang) {\n    return '<pre><code>'\n      + (escaped ? code : escape(code, true))\n      + '\\n</code></pre>';\n  }\n\n  return '<pre><code class=\"'\n    + this.options.langPrefix\n    + escape(lang, true)\n    + '\">'\n    + (escaped ? code : escape(code, true))\n    + '\\n</code></pre>\\n';\n};\n\nRenderer.prototype.blockquote = function(quote) {\n  return '<blockquote>\\n' + quote + '</blockquote>\\n';\n};\n\nRenderer.prototype.html = function(html) {\n  return html;\n};\n\nRenderer.prototype.heading = function(text, level, raw) {\n  return '<h'\n    + level\n    + ' id=\"'\n    + this.options.headerPrefix\n    + raw.toLowerCase().replace(/[^\\w]+/g, '-')\n    + '\">'\n    + text\n    + '</h'\n    + level\n    + '>\\n';\n};\n\nRenderer.prototype.hr = function() {\n  return this.options.xhtml ? '<hr/>\\n' : '<hr>\\n';\n};\n\nRenderer.prototype.list = function(body, ordered) {\n  var type = ordered ? 'ol' : 'ul';\n  return '<' + type + '>\\n' + body + '</' + type + '>\\n';\n};\n\nRenderer.prototype.listitem = function(text) {\n  return '<li>' + text + '</li>\\n';\n};\n\nRenderer.prototype.paragraph = function(text) {\n  return '<p>' + text + '</p>\\n';\n};\n\nRenderer.prototype.table = function(header, body) {\n  return '<table>\\n'\n    + '<thead>\\n'\n    + header\n    + '</thead>\\n'\n    + '<tbody>\\n'\n    + body\n    + '</tbody>\\n'\n    + '</table>\\n';\n};\n\nRenderer.prototype.tablerow = function(content) {\n  return '<tr>\\n' + content + '</tr>\\n';\n};\n\nRenderer.prototype.tablecell = function(content, flags) {\n  var type = flags.header ? 'th' : 'td';\n  var tag = flags.align\n    ? '<' + type + ' style=\"text-align:' + flags.align + '\">'\n    : '<' + type + '>';\n  return tag + content + '</' + type + '>\\n';\n};\n\n// span level renderer\nRenderer.prototype.strong = function(text) {\n  return '<strong>' + text + '</strong>';\n};\n\nRenderer.prototype.em = function(text) {\n  return '<em>' + text + '</em>';\n};\n\nRenderer.prototype.codespan = function(text) {\n  return '<code>' + text + '</code>';\n};\n\nRenderer.prototype.br = function() {\n  return this.options.xhtml ? '<br/>' : '<br>';\n};\n\nRenderer.prototype.del = function(text) {\n  return '<del>' + text + '</del>';\n};\n\nRenderer.prototype.link = function(href, title, text) {\n  if (this.options.sanitize) {\n    try {\n      var prot = decodeURIComponent(unescape(href))\n        .replace(/[^\\w:]/g, '')\n        .toLowerCase();\n    } catch (e) {\n      return '';\n    }\n    if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0) {\n      return '';\n    }\n  }\n  var out = '<a href=\"' + href + '\"';\n  if (title) {\n    out += ' title=\"' + title + '\"';\n  }\n  out += '>' + text + '</a>';\n  return out;\n};\n\nRenderer.prototype.image = function(href, title, text) {\n  var out = '<img src=\"' + href + '\" alt=\"' + text + '\"';\n  if (title) {\n    out += ' title=\"' + title + '\"';\n  }\n  out += this.options.xhtml ? '/>' : '>';\n  return out;\n};\n\n/**\n * Parsing & Compiling\n */\n\nfunction Parser(options) {\n  this.tokens = [];\n  this.token = null;\n  this.options = options || marked.defaults;\n  this.options.renderer = this.options.renderer || new Renderer;\n  this.renderer = this.options.renderer;\n  this.renderer.options = this.options;\n}\n\n/**\n * Static Parse Method\n */\n\nParser.parse = function(src, options, renderer) {\n  var parser = new Parser(options, renderer);\n  return parser.parse(src);\n};\n\n/**\n * Parse Loop\n */\n\nParser.prototype.parse = function(src) {\n  this.inline = new InlineLexer(src.links, this.options, this.renderer);\n  this.tokens = src.reverse();\n\n  var out = '';\n  while (this.next()) {\n    out += this.tok();\n  }\n\n  return out;\n};\n\n/**\n * Next Token\n */\n\nParser.prototype.next = function() {\n  return this.token = this.tokens.pop();\n};\n\n/**\n * Preview Next Token\n */\n\nParser.prototype.peek = function() {\n  return this.tokens[this.tokens.length - 1] || 0;\n};\n\n/**\n * Parse Text Tokens\n */\n\nParser.prototype.parseText = function() {\n  var body = this.token.text;\n\n  while (this.peek().type === 'text') {\n    body += '\\n' + this.next().text;\n  }\n\n  return this.inline.output(body);\n};\n\n/**\n * Parse Current Token\n */\n\nParser.prototype.tok = function() {\n  switch (this.token.type) {\n    case 'space': {\n      return '';\n    }\n    case 'hr': {\n      return this.renderer.hr();\n    }\n    case 'heading': {\n      return this.renderer.heading(\n        this.inline.output(this.token.text),\n        this.token.depth,\n        this.token.text);\n    }\n    case 'code': {\n      return this.renderer.code(this.token.text,\n        this.token.lang,\n        this.token.escaped);\n    }\n    case 'table': {\n      var header = ''\n        , body = ''\n        , i\n        , row\n        , cell\n        , flags\n        , j;\n\n      // header\n      cell = '';\n      for (i = 0; i < this.token.header.length; i++) {\n        flags = { header: true, align: this.token.align[i] };\n        cell += this.renderer.tablecell(\n          this.inline.output(this.token.header[i]),\n          { header: true, align: this.token.align[i] }\n        );\n      }\n      header += this.renderer.tablerow(cell);\n\n      for (i = 0; i < this.token.cells.length; i++) {\n        row = this.token.cells[i];\n\n        cell = '';\n        for (j = 0; j < row.length; j++) {\n          cell += this.renderer.tablecell(\n            this.inline.output(row[j]),\n            { header: false, align: this.token.align[j] }\n          );\n        }\n\n        body += this.renderer.tablerow(cell);\n      }\n      return this.renderer.table(header, body);\n    }\n    case 'blockquote_start': {\n      var body = '';\n\n      while (this.next().type !== 'blockquote_end') {\n        body += this.tok();\n      }\n\n      return this.renderer.blockquote(body);\n    }\n    case 'list_start': {\n      var body = ''\n        , ordered = this.token.ordered;\n\n      while (this.next().type !== 'list_end') {\n        body += this.tok();\n      }\n\n      return this.renderer.list(body, ordered);\n    }\n    case 'list_item_start': {\n      var body = '';\n\n      while (this.next().type !== 'list_item_end') {\n        body += this.token.type === 'text'\n          ? this.parseText()\n          : this.tok();\n      }\n\n      return this.renderer.listitem(body);\n    }\n    case 'loose_item_start': {\n      var body = '';\n\n      while (this.next().type !== 'list_item_end') {\n        body += this.tok();\n      }\n\n      return this.renderer.listitem(body);\n    }\n    case 'html': {\n      var html = !this.token.pre && !this.options.pedantic\n        ? this.inline.output(this.token.text)\n        : this.token.text;\n      return this.renderer.html(html);\n    }\n    case 'paragraph': {\n      return this.renderer.paragraph(this.inline.output(this.token.text));\n    }\n    case 'text': {\n      return this.renderer.paragraph(this.parseText());\n    }\n  }\n};\n\n/**\n * Helpers\n */\n\nfunction escape(html, encode) {\n  return html\n    .replace(!encode ? /&(?!#?\\w+;)/g : /&/g, '&amp;')\n    .replace(/</g, '&lt;')\n    .replace(/>/g, '&gt;')\n    .replace(/\"/g, '&quot;')\n    .replace(/'/g, '&#39;');\n}\n\nfunction unescape(html) {\n  return html.replace(/&([#\\w]+);/g, function(_, n) {\n    n = n.toLowerCase();\n    if (n === 'colon') return ':';\n    if (n.charAt(0) === '#') {\n      return n.charAt(1) === 'x'\n        ? String.fromCharCode(parseInt(n.substring(2), 16))\n        : String.fromCharCode(+n.substring(1));\n    }\n    return '';\n  });\n}\n\nfunction replace(regex, opt) {\n  regex = regex.source;\n  opt = opt || '';\n  return function self(name, val) {\n    if (!name) return new RegExp(regex, opt);\n    val = val.source || val;\n    val = val.replace(/(^|[^\\[])\\^/g, '$1');\n    regex = regex.replace(name, val);\n    return self;\n  };\n}\n\nfunction noop() {}\nnoop.exec = noop;\n\nfunction merge(obj) {\n  var i = 1\n    , target\n    , key;\n\n  for (; i < arguments.length; i++) {\n    target = arguments[i];\n    for (key in target) {\n      if (Object.prototype.hasOwnProperty.call(target, key)) {\n        obj[key] = target[key];\n      }\n    }\n  }\n\n  return obj;\n}\n\n\n/**\n * Marked\n */\n\nfunction marked(src, opt, callback) {\n  if (callback || typeof opt === 'function') {\n    if (!callback) {\n      callback = opt;\n      opt = null;\n    }\n\n    opt = merge({}, marked.defaults, opt || {});\n\n    var highlight = opt.highlight\n      , tokens\n      , pending\n      , i = 0;\n\n    try {\n      tokens = Lexer.lex(src, opt)\n    } catch (e) {\n      return callback(e);\n    }\n\n    pending = tokens.length;\n\n    var done = function(err) {\n      if (err) {\n        opt.highlight = highlight;\n        return callback(err);\n      }\n\n      var out;\n\n      try {\n        out = Parser.parse(tokens, opt);\n      } catch (e) {\n        err = e;\n      }\n\n      opt.highlight = highlight;\n\n      return err\n        ? callback(err)\n        : callback(null, out);\n    };\n\n    if (!highlight || highlight.length < 3) {\n      return done();\n    }\n\n    delete opt.highlight;\n\n    if (!pending) return done();\n\n    for (; i < tokens.length; i++) {\n      (function(token) {\n        if (token.type !== 'code') {\n          return --pending || done();\n        }\n        return highlight(token.text, token.lang, function(err, code) {\n          if (err) return done(err);\n          if (code == null || code === token.text) {\n            return --pending || done();\n          }\n          token.text = code;\n          token.escaped = true;\n          --pending || done();\n        });\n      })(tokens[i]);\n    }\n\n    return;\n  }\n  try {\n    if (opt) opt = merge({}, marked.defaults, opt);\n    return Parser.parse(Lexer.lex(src, opt), opt);\n  } catch (e) {\n    e.message += '\\nPlease report this to https://github.com/chjj/marked.';\n    if ((opt || marked.defaults).silent) {\n      return '<p>An error occured:</p><pre>'\n        + escape(e.message + '', true)\n        + '</pre>';\n    }\n    throw e;\n  }\n}\n\n/**\n * Options\n */\n\nmarked.options =\nmarked.setOptions = function(opt) {\n  merge(marked.defaults, opt);\n  return marked;\n};\n\nmarked.defaults = {\n  gfm: true,\n  tables: true,\n  breaks: false,\n  pedantic: false,\n  sanitize: false,\n  smartLists: false,\n  silent: false,\n  highlight: null,\n  langPrefix: 'lang-',\n  smartypants: false,\n  headerPrefix: '',\n  renderer: new Renderer,\n  xhtml: false\n};\n\n/**\n * Expose\n */\n\nmarked.Parser = Parser;\nmarked.parser = Parser.parse;\n\nmarked.Renderer = Renderer;\n\nmarked.Lexer = Lexer;\nmarked.lexer = Lexer.lex;\n\nmarked.InlineLexer = InlineLexer;\nmarked.inlineLexer = InlineLexer.output;\n\nmarked.parse = marked;\n\nif (typeof module !== 'undefined' && typeof exports === 'object') {\n  module.exports = marked;\n} else if (typeof define === 'function' && define.amd) {\n  define(function() { return marked; });\n} else {\n  this.marked = marked;\n}\n\n}).call(function() {\n  return this || (typeof window !== 'undefined' ? window : global);\n}());\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/resources/security-policy.properties",
    "content": "#\n# Authorization Policy\n#\n# The entries in this file must comply with the following format:\n#\n#  \"classifier.identifier.setting.extra=value\"\n# \n#   classifier = role|group\n#   identifier = An existing role or group identifier (depending on the classifier type)\n#   setting    = home|priority|permission\n#   extra      = Extra setting information. Mandatory, for instance, to define a permission's name\n#   value      = The setting value (depends on the setting selected). Value expected per setting type:\n#\n#   - home: An existing perspective identifier to redirect after login\n#   - priority: An integer indicating how priority is this role|group compared to others. Used for conflict resolution.\n#   - permission: A name representing a specific feature or capability over a given resource.\n#\n\n# Default settings\ndefault.home=Home\ndefault.permission.perspective.read=false\ndefault.permission.usermenu.status=true\ndefault.permission.screen.read=false\ndefault.permission.globalExperimentalFeatures.edit=false\n\n# Role \"admin\"\nrole.admin.home=Home\nrole.admin.priority=10\nrole.admin.permission.perspective.read=true\nrole.admin.permission.perspective.read.Dashboard=true\nrole.admin.permission.usermenu.status=true\nrole.admin.permission.screen.read=true\nrole.admin.permission.globalExperimentalFeatures.edit=true\n\n# Role \"user\"\nrole.user.home=Dashboard\nrole.user.priority=0\nrole.user.permission.perspective.read.Home=true\nrole.user.permission.perspective.read.Dashboard=true\n\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/WEB-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"all\">\n  <scan>\n    <!-- These exclusions were added by Errai to avoid deploying client-side classes to the server -->\n    <!-- End of Errai exclusions -->\n\n    <exclude name=\"org.uberfire.client.**\"/>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/WEB-INF/web.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<web-app xmlns=\"http://java.sun.com/xml/ns/javaee\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://java.sun.com/xml/ns/javaee\n\t\t  http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\"\n         version=\"2.5\">\n\n  <filter>\n    <filter-name>Security Filter</filter-name>\n\n    <filter-class>org.picketlink.authentication.web.AuthenticationFilter</filter-class>\n\n    <init-param>\n      <param-name>authType</param-name>\n      <param-value>org.jboss.errai.security.server.FormAuthenticationScheme</param-value>\n    </init-param>\n    <init-param>\n      <param-name>form-login-page</param-name>\n      <param-value>/login.jsp</param-value>\n    </init-param>\n    <init-param>\n      <param-name>host-page</param-name>\n      <param-value>/index.html</param-value>\n    </init-param>\n    <init-param>\n      <param-name>forceReAuthentication</param-name>\n      <param-value>true</param-value>\n    </init-param>\n  </filter>\n\n  <filter-mapping>\n    <filter-name>Security Filter</filter-name>\n    <url-pattern>/index.html</url-pattern>\n  </filter-mapping>\n\n  <filter-mapping>\n    <filter-name>Security Filter</filter-name>\n    <url-pattern>/uf_security_check</url-pattern>\n  </filter-mapping>\n\n  <filter-mapping>\n    <filter-name>Security Filter</filter-name>\n    <url-pattern>*.erraiBus</url-pattern>\n  </filter-mapping>\n\n  <filter>\n    <filter-name>Basic Security Filter</filter-name>\n    <filter-class>org.picketlink.authentication.web.AuthenticationFilter</filter-class>\n    <init-param>\n      <param-name>authType</param-name>\n      <param-value>BASIC</param-value>\n    </init-param>\n    <init-param>\n      <param-name>forceReAuthentication</param-name>\n      <param-value>true</param-value>\n    </init-param>\n  </filter>\n\n  <filter-mapping>\n    <filter-name>Basic Security Filter</filter-name>\n    <url-pattern>/git/*</url-pattern>\n  </filter-mapping>\n\n  <filter>\n    <filter-name>Host Page Patch</filter-name>\n    <filter-class>org.jboss.errai.security.server.servlet.UserHostPageFilter</filter-class>\n  </filter>\n\n  <filter-mapping>\n    <filter-name>Host Page Patch</filter-name>\n    <url-pattern>/index.html</url-pattern>\n  </filter-mapping>\n\n  <filter>\n    <filter-name>GWT Locale Filter</filter-name>\n    <filter-class>org.uberfire.server.locale.GWTLocaleHeaderFilter</filter-class>\n  </filter>\n\n  <filter-mapping>\n    <filter-name>GWT Locale Filter</filter-name>\n    <url-pattern>/index.html</url-pattern>\n  </filter-mapping>\n\n  <servlet>\n    <servlet-name>ErraiServlet</servlet-name>\n    <servlet-class>org.jboss.errai.bus.server.servlet.DefaultBlockingServlet</servlet-class>\n    <load-on-startup>1</load-on-startup>\n  </servlet>\n\n  <servlet-mapping>\n    <servlet-name>ErraiServlet</servlet-name>\n    <url-pattern>*.erraiBus</url-pattern>\n  </servlet-mapping>\n\n  <servlet>\n    <servlet-name>FileUploadServlet</servlet-name>\n    <servlet-class>org.uberfire.server.FileUploadServlet</servlet-class>\n  </servlet>\n  <servlet-mapping>\n    <servlet-name>FileUploadServlet</servlet-name>\n    <url-pattern>/org.uberfire.UberfireShowcase/defaulteditor/upload/*</url-pattern>\n  </servlet-mapping>\n\n  <servlet>\n    <servlet-name>FileDownloadServlet</servlet-name>\n    <servlet-class>org.uberfire.server.FileDownloadServlet</servlet-class>\n  </servlet>\n  <servlet-mapping>\n    <servlet-name>FileDownloadServlet</servlet-name>\n    <url-pattern>/org.uberfire.UberfireShowcase/defaulteditor/download/*</url-pattern>\n  </servlet-mapping>\n\n  <welcome-file-list>\n    <welcome-file>login.jsp</welcome-file>\n  </welcome-file-list>\n</web-app>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/frameworks/knockout-3.4.0.js",
    "content": "/*!\n * Knockout JavaScript library v3.4.0\n * (c) Steven Sanderson - http://knockoutjs.com/\n * License: MIT (http://www.opensource.org/licenses/mit-license.php)\n */\n\n(function() {(function(n){var x=this||(0,eval)(\"this\"),u=x.document,M=x.navigator,v=x.jQuery,F=x.JSON;(function(n){\"function\"===typeof define&&define.amd?define([\"exports\",\"require\"],n):\"object\"===typeof exports&&\"object\"===typeof module?n(module.exports||exports):n(x.ko={})})(function(N,O){function J(a,c){return null===a||typeof a in T?a===c:!1}function U(b,c){var d;return function(){d||(d=a.a.setTimeout(function(){d=n;b()},c))}}function V(b,c){var d;return function(){clearTimeout(d);d=a.a.setTimeout(b,c)}}function W(a,\nc){c&&c!==I?\"beforeChange\"===c?this.Kb(a):this.Ha(a,c):this.Lb(a)}function X(a,c){null!==c&&c.k&&c.k()}function Y(a,c){var d=this.Hc,e=d[s];e.R||(this.lb&&this.Ma[c]?(d.Pb(c,a,this.Ma[c]),this.Ma[c]=null,--this.lb):e.r[c]||d.Pb(c,a,e.s?{ia:a}:d.uc(a)))}function K(b,c,d,e){a.d[b]={init:function(b,g,k,l,m){var h,r;a.m(function(){var q=a.a.c(g()),p=!d!==!q,A=!r;if(A||c||p!==h)A&&a.va.Aa()&&(r=a.a.ua(a.f.childNodes(b),!0)),p?(A||a.f.da(b,a.a.ua(r)),a.eb(e?e(m,q):m,b)):a.f.xa(b),h=p},null,{i:b});return{controlsDescendantBindings:!0}}};\na.h.ta[b]=!1;a.f.Z[b]=!0}var a=\"undefined\"!==typeof N?N:{};a.b=function(b,c){for(var d=b.split(\".\"),e=a,f=0;f<d.length-1;f++)e=e[d[f]];e[d[d.length-1]]=c};a.G=function(a,c,d){a[c]=d};a.version=\"3.4.0\";a.b(\"version\",a.version);a.options={deferUpdates:!1,useOnlyNativeEvents:!1};a.a=function(){function b(a,b){for(var c in a)a.hasOwnProperty(c)&&b(c,a[c])}function c(a,b){if(b)for(var c in b)b.hasOwnProperty(c)&&(a[c]=b[c]);return a}function d(a,b){a.__proto__=b;return a}function e(b,c,d,e){var h=b[c].match(r)||\n[];a.a.q(d.match(r),function(b){a.a.pa(h,b,e)});b[c]=h.join(\" \")}var f={__proto__:[]}instanceof Array,g=\"function\"===typeof Symbol,k={},l={};k[M&&/Firefox\\/2/i.test(M.userAgent)?\"KeyboardEvent\":\"UIEvents\"]=[\"keyup\",\"keydown\",\"keypress\"];k.MouseEvents=\"click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave\".split(\" \");b(k,function(a,b){if(b.length)for(var c=0,d=b.length;c<d;c++)l[b[c]]=a});var m={propertychange:!0},h=u&&function(){for(var a=3,b=u.createElement(\"div\"),c=\nb.getElementsByTagName(\"i\");b.innerHTML=\"\\x3c!--[if gt IE \"+ ++a+\"]><i></i><![endif]--\\x3e\",c[0];);return 4<a?a:n}(),r=/\\S+/g;return{cc:[\"authenticity_token\",/^__RequestVerificationToken(_.*)?$/],q:function(a,b){for(var c=0,d=a.length;c<d;c++)b(a[c],c)},o:function(a,b){if(\"function\"==typeof Array.prototype.indexOf)return Array.prototype.indexOf.call(a,b);for(var c=0,d=a.length;c<d;c++)if(a[c]===b)return c;return-1},Sb:function(a,b,c){for(var d=0,e=a.length;d<e;d++)if(b.call(c,a[d],d))return a[d];\nreturn null},La:function(b,c){var d=a.a.o(b,c);0<d?b.splice(d,1):0===d&&b.shift()},Tb:function(b){b=b||[];for(var c=[],d=0,e=b.length;d<e;d++)0>a.a.o(c,b[d])&&c.push(b[d]);return c},fb:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)c.push(b(a[d],d));return c},Ka:function(a,b){a=a||[];for(var c=[],d=0,e=a.length;d<e;d++)b(a[d],d)&&c.push(a[d]);return c},ra:function(a,b){if(b instanceof Array)a.push.apply(a,b);else for(var c=0,d=b.length;c<d;c++)a.push(b[c]);return a},pa:function(b,c,d){var e=\na.a.o(a.a.zb(b),c);0>e?d&&b.push(c):d||b.splice(e,1)},ka:f,extend:c,Xa:d,Ya:f?d:c,D:b,Ca:function(a,b){if(!a)return a;var c={},d;for(d in a)a.hasOwnProperty(d)&&(c[d]=b(a[d],d,a));return c},ob:function(b){for(;b.firstChild;)a.removeNode(b.firstChild)},jc:function(b){b=a.a.V(b);for(var c=(b[0]&&b[0].ownerDocument||u).createElement(\"div\"),d=0,e=b.length;d<e;d++)c.appendChild(a.$(b[d]));return c},ua:function(b,c){for(var d=0,e=b.length,h=[];d<e;d++){var m=b[d].cloneNode(!0);h.push(c?a.$(m):m)}return h},\nda:function(b,c){a.a.ob(b);if(c)for(var d=0,e=c.length;d<e;d++)b.appendChild(c[d])},qc:function(b,c){var d=b.nodeType?[b]:b;if(0<d.length){for(var e=d[0],h=e.parentNode,m=0,l=c.length;m<l;m++)h.insertBefore(c[m],e);m=0;for(l=d.length;m<l;m++)a.removeNode(d[m])}},za:function(a,b){if(a.length){for(b=8===b.nodeType&&b.parentNode||b;a.length&&a[0].parentNode!==b;)a.splice(0,1);for(;1<a.length&&a[a.length-1].parentNode!==b;)a.length--;if(1<a.length){var c=a[0],d=a[a.length-1];for(a.length=0;c!==d;)a.push(c),\nc=c.nextSibling;a.push(d)}}return a},sc:function(a,b){7>h?a.setAttribute(\"selected\",b):a.selected=b},$a:function(a){return null===a||a===n?\"\":a.trim?a.trim():a.toString().replace(/^[\\s\\xa0]+|[\\s\\xa0]+$/g,\"\")},nd:function(a,b){a=a||\"\";return b.length>a.length?!1:a.substring(0,b.length)===b},Mc:function(a,b){if(a===b)return!0;if(11===a.nodeType)return!1;if(b.contains)return b.contains(3===a.nodeType?a.parentNode:a);if(b.compareDocumentPosition)return 16==(b.compareDocumentPosition(a)&16);for(;a&&a!=\nb;)a=a.parentNode;return!!a},nb:function(b){return a.a.Mc(b,b.ownerDocument.documentElement)},Qb:function(b){return!!a.a.Sb(b,a.a.nb)},A:function(a){return a&&a.tagName&&a.tagName.toLowerCase()},Wb:function(b){return a.onError?function(){try{return b.apply(this,arguments)}catch(c){throw a.onError&&a.onError(c),c;}}:b},setTimeout:function(b,c){return setTimeout(a.a.Wb(b),c)},$b:function(b){setTimeout(function(){a.onError&&a.onError(b);throw b;},0)},p:function(b,c,d){var e=a.a.Wb(d);d=h&&m[c];if(a.options.useOnlyNativeEvents||\nd||!v)if(d||\"function\"!=typeof b.addEventListener)if(\"undefined\"!=typeof b.attachEvent){var l=function(a){e.call(b,a)},f=\"on\"+c;b.attachEvent(f,l);a.a.F.oa(b,function(){b.detachEvent(f,l)})}else throw Error(\"Browser doesn't support addEventListener or attachEvent\");else b.addEventListener(c,e,!1);else v(b).bind(c,e)},Da:function(b,c){if(!b||!b.nodeType)throw Error(\"element must be a DOM node when calling triggerEvent\");var d;\"input\"===a.a.A(b)&&b.type&&\"click\"==c.toLowerCase()?(d=b.type,d=\"checkbox\"==\nd||\"radio\"==d):d=!1;if(a.options.useOnlyNativeEvents||!v||d)if(\"function\"==typeof u.createEvent)if(\"function\"==typeof b.dispatchEvent)d=u.createEvent(l[c]||\"HTMLEvents\"),d.initEvent(c,!0,!0,x,0,0,0,0,0,!1,!1,!1,!1,0,b),b.dispatchEvent(d);else throw Error(\"The supplied element doesn't support dispatchEvent\");else if(d&&b.click)b.click();else if(\"undefined\"!=typeof b.fireEvent)b.fireEvent(\"on\"+c);else throw Error(\"Browser doesn't support triggering events\");else v(b).trigger(c)},c:function(b){return a.H(b)?\nb():b},zb:function(b){return a.H(b)?b.t():b},bb:function(b,c,d){var h;c&&(\"object\"===typeof b.classList?(h=b.classList[d?\"add\":\"remove\"],a.a.q(c.match(r),function(a){h.call(b.classList,a)})):\"string\"===typeof b.className.baseVal?e(b.className,\"baseVal\",c,d):e(b,\"className\",c,d))},Za:function(b,c){var d=a.a.c(c);if(null===d||d===n)d=\"\";var e=a.f.firstChild(b);!e||3!=e.nodeType||a.f.nextSibling(e)?a.f.da(b,[b.ownerDocument.createTextNode(d)]):e.data=d;a.a.Rc(b)},rc:function(a,b){a.name=b;if(7>=h)try{a.mergeAttributes(u.createElement(\"<input name='\"+\na.name+\"'/>\"),!1)}catch(c){}},Rc:function(a){9<=h&&(a=1==a.nodeType?a:a.parentNode,a.style&&(a.style.zoom=a.style.zoom))},Nc:function(a){if(h){var b=a.style.width;a.style.width=0;a.style.width=b}},hd:function(b,c){b=a.a.c(b);c=a.a.c(c);for(var d=[],e=b;e<=c;e++)d.push(e);return d},V:function(a){for(var b=[],c=0,d=a.length;c<d;c++)b.push(a[c]);return b},Yb:function(a){return g?Symbol(a):a},rd:6===h,sd:7===h,C:h,ec:function(b,c){for(var d=a.a.V(b.getElementsByTagName(\"input\")).concat(a.a.V(b.getElementsByTagName(\"textarea\"))),\ne=\"string\"==typeof c?function(a){return a.name===c}:function(a){return c.test(a.name)},h=[],m=d.length-1;0<=m;m--)e(d[m])&&h.push(d[m]);return h},ed:function(b){return\"string\"==typeof b&&(b=a.a.$a(b))?F&&F.parse?F.parse(b):(new Function(\"return \"+b))():null},Eb:function(b,c,d){if(!F||!F.stringify)throw Error(\"Cannot find JSON.stringify(). Some browsers (e.g., IE < 8) don't support it natively, but you can overcome this by adding a script reference to json2.js, downloadable from http://www.json.org/json2.js\");\nreturn F.stringify(a.a.c(b),c,d)},fd:function(c,d,e){e=e||{};var h=e.params||{},m=e.includeFields||this.cc,l=c;if(\"object\"==typeof c&&\"form\"===a.a.A(c))for(var l=c.action,f=m.length-1;0<=f;f--)for(var g=a.a.ec(c,m[f]),k=g.length-1;0<=k;k--)h[g[k].name]=g[k].value;d=a.a.c(d);var r=u.createElement(\"form\");r.style.display=\"none\";r.action=l;r.method=\"post\";for(var n in d)c=u.createElement(\"input\"),c.type=\"hidden\",c.name=n,c.value=a.a.Eb(a.a.c(d[n])),r.appendChild(c);b(h,function(a,b){var c=u.createElement(\"input\");\nc.type=\"hidden\";c.name=a;c.value=b;r.appendChild(c)});u.body.appendChild(r);e.submitter?e.submitter(r):r.submit();setTimeout(function(){r.parentNode.removeChild(r)},0)}}}();a.b(\"utils\",a.a);a.b(\"utils.arrayForEach\",a.a.q);a.b(\"utils.arrayFirst\",a.a.Sb);a.b(\"utils.arrayFilter\",a.a.Ka);a.b(\"utils.arrayGetDistinctValues\",a.a.Tb);a.b(\"utils.arrayIndexOf\",a.a.o);a.b(\"utils.arrayMap\",a.a.fb);a.b(\"utils.arrayPushAll\",a.a.ra);a.b(\"utils.arrayRemoveItem\",a.a.La);a.b(\"utils.extend\",a.a.extend);a.b(\"utils.fieldsIncludedWithJsonPost\",\na.a.cc);a.b(\"utils.getFormFields\",a.a.ec);a.b(\"utils.peekObservable\",a.a.zb);a.b(\"utils.postJson\",a.a.fd);a.b(\"utils.parseJson\",a.a.ed);a.b(\"utils.registerEventHandler\",a.a.p);a.b(\"utils.stringifyJson\",a.a.Eb);a.b(\"utils.range\",a.a.hd);a.b(\"utils.toggleDomNodeCssClass\",a.a.bb);a.b(\"utils.triggerEvent\",a.a.Da);a.b(\"utils.unwrapObservable\",a.a.c);a.b(\"utils.objectForEach\",a.a.D);a.b(\"utils.addOrRemoveItem\",a.a.pa);a.b(\"utils.setTextContent\",a.a.Za);a.b(\"unwrap\",a.a.c);Function.prototype.bind||(Function.prototype.bind=\nfunction(a){var c=this;if(1===arguments.length)return function(){return c.apply(a,arguments)};var d=Array.prototype.slice.call(arguments,1);return function(){var e=d.slice(0);e.push.apply(e,arguments);return c.apply(a,e)}});a.a.e=new function(){function a(b,g){var k=b[d];if(!k||\"null\"===k||!e[k]){if(!g)return n;k=b[d]=\"ko\"+c++;e[k]={}}return e[k]}var c=0,d=\"__ko__\"+(new Date).getTime(),e={};return{get:function(c,d){var e=a(c,!1);return e===n?n:e[d]},set:function(c,d,e){if(e!==n||a(c,!1)!==n)a(c,!0)[d]=\ne},clear:function(a){var b=a[d];return b?(delete e[b],a[d]=null,!0):!1},I:function(){return c++ +d}}};a.b(\"utils.domData\",a.a.e);a.b(\"utils.domData.clear\",a.a.e.clear);a.a.F=new function(){function b(b,c){var e=a.a.e.get(b,d);e===n&&c&&(e=[],a.a.e.set(b,d,e));return e}function c(d){var e=b(d,!1);if(e)for(var e=e.slice(0),l=0;l<e.length;l++)e[l](d);a.a.e.clear(d);a.a.F.cleanExternalData(d);if(f[d.nodeType])for(e=d.firstChild;d=e;)e=d.nextSibling,8===d.nodeType&&c(d)}var d=a.a.e.I(),e={1:!0,8:!0,9:!0},\nf={1:!0,9:!0};return{oa:function(a,c){if(\"function\"!=typeof c)throw Error(\"Callback must be a function\");b(a,!0).push(c)},pc:function(c,e){var l=b(c,!1);l&&(a.a.La(l,e),0==l.length&&a.a.e.set(c,d,n))},$:function(b){if(e[b.nodeType]&&(c(b),f[b.nodeType])){var d=[];a.a.ra(d,b.getElementsByTagName(\"*\"));for(var l=0,m=d.length;l<m;l++)c(d[l])}return b},removeNode:function(b){a.$(b);b.parentNode&&b.parentNode.removeChild(b)},cleanExternalData:function(a){v&&\"function\"==typeof v.cleanData&&v.cleanData([a])}}};\na.$=a.a.F.$;a.removeNode=a.a.F.removeNode;a.b(\"cleanNode\",a.$);a.b(\"removeNode\",a.removeNode);a.b(\"utils.domNodeDisposal\",a.a.F);a.b(\"utils.domNodeDisposal.addDisposeCallback\",a.a.F.oa);a.b(\"utils.domNodeDisposal.removeDisposeCallback\",a.a.F.pc);(function(){var b=[0,\"\",\"\"],c=[1,\"<table>\",\"</table>\"],d=[3,\"<table><tbody><tr>\",\"</tr></tbody></table>\"],e=[1,\"<select multiple='multiple'>\",\"</select>\"],f={thead:c,tbody:c,tfoot:c,tr:[2,\"<table><tbody>\",\"</tbody></table>\"],td:d,th:d,option:e,optgroup:e},\ng=8>=a.a.C;a.a.ma=function(c,d){var e;if(v)if(v.parseHTML)e=v.parseHTML(c,d)||[];else{if((e=v.clean([c],d))&&e[0]){for(var h=e[0];h.parentNode&&11!==h.parentNode.nodeType;)h=h.parentNode;h.parentNode&&h.parentNode.removeChild(h)}}else{(e=d)||(e=u);var h=e.parentWindow||e.defaultView||x,r=a.a.$a(c).toLowerCase(),q=e.createElement(\"div\"),p;p=(r=r.match(/^<([a-z]+)[ >]/))&&f[r[1]]||b;r=p[0];p=\"ignored<div>\"+p[1]+c+p[2]+\"</div>\";\"function\"==typeof h.innerShiv?q.appendChild(h.innerShiv(p)):(g&&e.appendChild(q),\nq.innerHTML=p,g&&q.parentNode.removeChild(q));for(;r--;)q=q.lastChild;e=a.a.V(q.lastChild.childNodes)}return e};a.a.Cb=function(b,c){a.a.ob(b);c=a.a.c(c);if(null!==c&&c!==n)if(\"string\"!=typeof c&&(c=c.toString()),v)v(b).html(c);else for(var d=a.a.ma(c,b.ownerDocument),e=0;e<d.length;e++)b.appendChild(d[e])}})();a.b(\"utils.parseHtmlFragment\",a.a.ma);a.b(\"utils.setHtml\",a.a.Cb);a.M=function(){function b(c,e){if(c)if(8==c.nodeType){var f=a.M.lc(c.nodeValue);null!=f&&e.push({Lc:c,cd:f})}else if(1==c.nodeType)for(var f=\n0,g=c.childNodes,k=g.length;f<k;f++)b(g[f],e)}var c={};return{wb:function(a){if(\"function\"!=typeof a)throw Error(\"You can only pass a function to ko.memoization.memoize()\");var b=(4294967296*(1+Math.random())|0).toString(16).substring(1)+(4294967296*(1+Math.random())|0).toString(16).substring(1);c[b]=a;return\"\\x3c!--[ko_memo:\"+b+\"]--\\x3e\"},xc:function(a,b){var f=c[a];if(f===n)throw Error(\"Couldn't find any memo with ID \"+a+\". Perhaps it's already been unmemoized.\");try{return f.apply(null,b||[]),\n!0}finally{delete c[a]}},yc:function(c,e){var f=[];b(c,f);for(var g=0,k=f.length;g<k;g++){var l=f[g].Lc,m=[l];e&&a.a.ra(m,e);a.M.xc(f[g].cd,m);l.nodeValue=\"\";l.parentNode&&l.parentNode.removeChild(l)}},lc:function(a){return(a=a.match(/^\\[ko_memo\\:(.*?)\\]$/))?a[1]:null}}}();a.b(\"memoization\",a.M);a.b(\"memoization.memoize\",a.M.wb);a.b(\"memoization.unmemoize\",a.M.xc);a.b(\"memoization.parseMemoText\",a.M.lc);a.b(\"memoization.unmemoizeDomNodeAndDescendants\",a.M.yc);a.Y=function(){function b(){if(e)for(var b=\ne,c=0,m;g<e;)if(m=d[g++]){if(g>b){if(5E3<=++c){g=e;a.a.$b(Error(\"'Too much recursion' after processing \"+c+\" task groups.\"));break}b=e}try{m()}catch(h){a.a.$b(h)}}}function c(){b();g=e=d.length=0}var d=[],e=0,f=1,g=0;return{scheduler:x.MutationObserver?function(a){var b=u.createElement(\"div\");(new MutationObserver(a)).observe(b,{attributes:!0});return function(){b.classList.toggle(\"foo\")}}(c):u&&\"onreadystatechange\"in u.createElement(\"script\")?function(a){var b=u.createElement(\"script\");b.onreadystatechange=\nfunction(){b.onreadystatechange=null;u.documentElement.removeChild(b);b=null;a()};u.documentElement.appendChild(b)}:function(a){setTimeout(a,0)},Wa:function(b){e||a.Y.scheduler(c);d[e++]=b;return f++},cancel:function(a){a-=f-e;a>=g&&a<e&&(d[a]=null)},resetForTesting:function(){var a=e-g;g=e=d.length=0;return a},md:b}}();a.b(\"tasks\",a.Y);a.b(\"tasks.schedule\",a.Y.Wa);a.b(\"tasks.runEarly\",a.Y.md);a.ya={throttle:function(b,c){b.throttleEvaluation=c;var d=null;return a.B({read:b,write:function(e){clearTimeout(d);\nd=a.a.setTimeout(function(){b(e)},c)}})},rateLimit:function(a,c){var d,e,f;\"number\"==typeof c?d=c:(d=c.timeout,e=c.method);a.cb=!1;f=\"notifyWhenChangesStop\"==e?V:U;a.Ta(function(a){return f(a,d)})},deferred:function(b,c){if(!0!==c)throw Error(\"The 'deferred' extender only accepts the value 'true', because it is not supported to turn deferral off once enabled.\");b.cb||(b.cb=!0,b.Ta(function(c){var e;return function(){a.Y.cancel(e);e=a.Y.Wa(c);b.notifySubscribers(n,\"dirty\")}}))},notify:function(a,c){a.equalityComparer=\n\"always\"==c?null:J}};var T={undefined:1,\"boolean\":1,number:1,string:1};a.b(\"extenders\",a.ya);a.vc=function(b,c,d){this.ia=b;this.gb=c;this.Kc=d;this.R=!1;a.G(this,\"dispose\",this.k)};a.vc.prototype.k=function(){this.R=!0;this.Kc()};a.J=function(){a.a.Ya(this,D);D.rb(this)};var I=\"change\",D={rb:function(a){a.K={};a.Nb=1},X:function(b,c,d){var e=this;d=d||I;var f=new a.vc(e,c?b.bind(c):b,function(){a.a.La(e.K[d],f);e.Ia&&e.Ia(d)});e.sa&&e.sa(d);e.K[d]||(e.K[d]=[]);e.K[d].push(f);return f},notifySubscribers:function(b,\nc){c=c||I;c===I&&this.zc();if(this.Pa(c))try{a.l.Ub();for(var d=this.K[c].slice(0),e=0,f;f=d[e];++e)f.R||f.gb(b)}finally{a.l.end()}},Na:function(){return this.Nb},Uc:function(a){return this.Na()!==a},zc:function(){++this.Nb},Ta:function(b){var c=this,d=a.H(c),e,f,g;c.Ha||(c.Ha=c.notifySubscribers,c.notifySubscribers=W);var k=b(function(){c.Mb=!1;d&&g===c&&(g=c());e=!1;c.tb(f,g)&&c.Ha(f=g)});c.Lb=function(a){c.Mb=e=!0;g=a;k()};c.Kb=function(a){e||(f=a,c.Ha(a,\"beforeChange\"))}},Pa:function(a){return this.K[a]&&\nthis.K[a].length},Sc:function(b){if(b)return this.K[b]&&this.K[b].length||0;var c=0;a.a.D(this.K,function(a,b){\"dirty\"!==a&&(c+=b.length)});return c},tb:function(a,c){return!this.equalityComparer||!this.equalityComparer(a,c)},extend:function(b){var c=this;b&&a.a.D(b,function(b,e){var f=a.ya[b];\"function\"==typeof f&&(c=f(c,e)||c)});return c}};a.G(D,\"subscribe\",D.X);a.G(D,\"extend\",D.extend);a.G(D,\"getSubscriptionsCount\",D.Sc);a.a.ka&&a.a.Xa(D,Function.prototype);a.J.fn=D;a.hc=function(a){return null!=\na&&\"function\"==typeof a.X&&\"function\"==typeof a.notifySubscribers};a.b(\"subscribable\",a.J);a.b(\"isSubscribable\",a.hc);a.va=a.l=function(){function b(a){d.push(e);e=a}function c(){e=d.pop()}var d=[],e,f=0;return{Ub:b,end:c,oc:function(b){if(e){if(!a.hc(b))throw Error(\"Only subscribable things can act as dependencies\");e.gb.call(e.Gc,b,b.Cc||(b.Cc=++f))}},w:function(a,d,e){try{return b(),a.apply(d,e||[])}finally{c()}},Aa:function(){if(e)return e.m.Aa()},Sa:function(){if(e)return e.Sa}}}();a.b(\"computedContext\",\na.va);a.b(\"computedContext.getDependenciesCount\",a.va.Aa);a.b(\"computedContext.isInitial\",a.va.Sa);a.b(\"ignoreDependencies\",a.qd=a.l.w);var E=a.a.Yb(\"_latestValue\");a.N=function(b){function c(){if(0<arguments.length)return c.tb(c[E],arguments[0])&&(c.ga(),c[E]=arguments[0],c.fa()),this;a.l.oc(c);return c[E]}c[E]=b;a.a.ka||a.a.extend(c,a.J.fn);a.J.fn.rb(c);a.a.Ya(c,B);a.options.deferUpdates&&a.ya.deferred(c,!0);return c};var B={equalityComparer:J,t:function(){return this[E]},fa:function(){this.notifySubscribers(this[E])},\nga:function(){this.notifySubscribers(this[E],\"beforeChange\")}};a.a.ka&&a.a.Xa(B,a.J.fn);var H=a.N.gd=\"__ko_proto__\";B[H]=a.N;a.Oa=function(b,c){return null===b||b===n||b[H]===n?!1:b[H]===c?!0:a.Oa(b[H],c)};a.H=function(b){return a.Oa(b,a.N)};a.Ba=function(b){return\"function\"==typeof b&&b[H]===a.N||\"function\"==typeof b&&b[H]===a.B&&b.Vc?!0:!1};a.b(\"observable\",a.N);a.b(\"isObservable\",a.H);a.b(\"isWriteableObservable\",a.Ba);a.b(\"isWritableObservable\",a.Ba);a.b(\"observable.fn\",B);a.G(B,\"peek\",B.t);a.G(B,\n\"valueHasMutated\",B.fa);a.G(B,\"valueWillMutate\",B.ga);a.la=function(b){b=b||[];if(\"object\"!=typeof b||!(\"length\"in b))throw Error(\"The argument passed when initializing an observable array must be an array, or null, or undefined.\");b=a.N(b);a.a.Ya(b,a.la.fn);return b.extend({trackArrayChanges:!0})};a.la.fn={remove:function(b){for(var c=this.t(),d=[],e=\"function\"!=typeof b||a.H(b)?function(a){return a===b}:b,f=0;f<c.length;f++){var g=c[f];e(g)&&(0===d.length&&this.ga(),d.push(g),c.splice(f,1),f--)}d.length&&\nthis.fa();return d},removeAll:function(b){if(b===n){var c=this.t(),d=c.slice(0);this.ga();c.splice(0,c.length);this.fa();return d}return b?this.remove(function(c){return 0<=a.a.o(b,c)}):[]},destroy:function(b){var c=this.t(),d=\"function\"!=typeof b||a.H(b)?function(a){return a===b}:b;this.ga();for(var e=c.length-1;0<=e;e--)d(c[e])&&(c[e]._destroy=!0);this.fa()},destroyAll:function(b){return b===n?this.destroy(function(){return!0}):b?this.destroy(function(c){return 0<=a.a.o(b,c)}):[]},indexOf:function(b){var c=\nthis();return a.a.o(c,b)},replace:function(a,c){var d=this.indexOf(a);0<=d&&(this.ga(),this.t()[d]=c,this.fa())}};a.a.ka&&a.a.Xa(a.la.fn,a.N.fn);a.a.q(\"pop push reverse shift sort splice unshift\".split(\" \"),function(b){a.la.fn[b]=function(){var a=this.t();this.ga();this.Vb(a,b,arguments);var d=a[b].apply(a,arguments);this.fa();return d===a?this:d}});a.a.q([\"slice\"],function(b){a.la.fn[b]=function(){var a=this();return a[b].apply(a,arguments)}});a.b(\"observableArray\",a.la);a.ya.trackArrayChanges=function(b,\nc){function d(){if(!e){e=!0;var c=b.notifySubscribers;b.notifySubscribers=function(a,b){b&&b!==I||++k;return c.apply(this,arguments)};var d=[].concat(b.t()||[]);f=null;g=b.X(function(c){c=[].concat(c||[]);if(b.Pa(\"arrayChange\")){var e;if(!f||1<k)f=a.a.ib(d,c,b.hb);e=f}d=c;f=null;k=0;e&&e.length&&b.notifySubscribers(e,\"arrayChange\")})}}b.hb={};c&&\"object\"==typeof c&&a.a.extend(b.hb,c);b.hb.sparse=!0;if(!b.Vb){var e=!1,f=null,g,k=0,l=b.sa,m=b.Ia;b.sa=function(a){l&&l.call(b,a);\"arrayChange\"===a&&d()};\nb.Ia=function(a){m&&m.call(b,a);\"arrayChange\"!==a||b.Pa(\"arrayChange\")||(g.k(),e=!1)};b.Vb=function(b,c,d){function m(a,b,c){return l[l.length]={status:a,value:b,index:c}}if(e&&!k){var l=[],g=b.length,t=d.length,G=0;switch(c){case \"push\":G=g;case \"unshift\":for(c=0;c<t;c++)m(\"added\",d[c],G+c);break;case \"pop\":G=g-1;case \"shift\":g&&m(\"deleted\",b[G],G);break;case \"splice\":c=Math.min(Math.max(0,0>d[0]?g+d[0]:d[0]),g);for(var g=1===t?g:Math.min(c+(d[1]||0),g),t=c+t-2,G=Math.max(g,t),P=[],n=[],Q=2;c<G;++c,\n++Q)c<g&&n.push(m(\"deleted\",b[c],c)),c<t&&P.push(m(\"added\",d[Q],c));a.a.dc(n,P);break;default:return}f=l}}}};var s=a.a.Yb(\"_state\");a.m=a.B=function(b,c,d){function e(){if(0<arguments.length){if(\"function\"===typeof f)f.apply(g.pb,arguments);else throw Error(\"Cannot write a value to a ko.computed unless you specify a 'write' option. If you wish to read the current value, don't pass any parameters.\");return this}a.l.oc(e);(g.S||g.s&&e.Qa())&&e.aa();return g.T}\"object\"===typeof b?d=b:(d=d||{},b&&(d.read=\nb));if(\"function\"!=typeof d.read)throw Error(\"Pass a function that returns the value of the ko.computed\");var f=d.write,g={T:n,S:!0,Ra:!1,Fb:!1,R:!1,Va:!1,s:!1,jd:d.read,pb:c||d.owner,i:d.disposeWhenNodeIsRemoved||d.i||null,wa:d.disposeWhen||d.wa,mb:null,r:{},L:0,bc:null};e[s]=g;e.Vc=\"function\"===typeof f;a.a.ka||a.a.extend(e,a.J.fn);a.J.fn.rb(e);a.a.Ya(e,z);d.pure?(g.Va=!0,g.s=!0,a.a.extend(e,$)):d.deferEvaluation&&a.a.extend(e,aa);a.options.deferUpdates&&a.ya.deferred(e,!0);g.i&&(g.Fb=!0,g.i.nodeType||\n(g.i=null));g.s||d.deferEvaluation||e.aa();g.i&&e.ba()&&a.a.F.oa(g.i,g.mb=function(){e.k()});return e};var z={equalityComparer:J,Aa:function(){return this[s].L},Pb:function(a,c,d){if(this[s].Va&&c===this)throw Error(\"A 'pure' computed must not be called recursively\");this[s].r[a]=d;d.Ga=this[s].L++;d.na=c.Na()},Qa:function(){var a,c,d=this[s].r;for(a in d)if(d.hasOwnProperty(a)&&(c=d[a],c.ia.Uc(c.na)))return!0},bd:function(){this.Fa&&!this[s].Ra&&this.Fa()},ba:function(){return this[s].S||0<this[s].L},\nld:function(){this.Mb||this.ac()},uc:function(a){if(a.cb&&!this[s].i){var c=a.X(this.bd,this,\"dirty\"),d=a.X(this.ld,this);return{ia:a,k:function(){c.k();d.k()}}}return a.X(this.ac,this)},ac:function(){var b=this,c=b.throttleEvaluation;c&&0<=c?(clearTimeout(this[s].bc),this[s].bc=a.a.setTimeout(function(){b.aa(!0)},c)):b.Fa?b.Fa():b.aa(!0)},aa:function(b){var c=this[s],d=c.wa;if(!c.Ra&&!c.R){if(c.i&&!a.a.nb(c.i)||d&&d()){if(!c.Fb){this.k();return}}else c.Fb=!1;c.Ra=!0;try{this.Qc(b)}finally{c.Ra=!1}c.L||\nthis.k()}},Qc:function(b){var c=this[s],d=c.Va?n:!c.L,e={Hc:this,Ma:c.r,lb:c.L};a.l.Ub({Gc:e,gb:Y,m:this,Sa:d});c.r={};c.L=0;e=this.Pc(c,e);this.tb(c.T,e)&&(c.s||this.notifySubscribers(c.T,\"beforeChange\"),c.T=e,c.s?this.zc():b&&this.notifySubscribers(c.T));d&&this.notifySubscribers(c.T,\"awake\")},Pc:function(b,c){try{var d=b.jd;return b.pb?d.call(b.pb):d()}finally{a.l.end(),c.lb&&!b.s&&a.a.D(c.Ma,X),b.S=!1}},t:function(){var a=this[s];(a.S&&!a.L||a.s&&this.Qa())&&this.aa();return a.T},Ta:function(b){a.J.fn.Ta.call(this,\nb);this.Fa=function(){this.Kb(this[s].T);this[s].S=!0;this.Lb(this)}},k:function(){var b=this[s];!b.s&&b.r&&a.a.D(b.r,function(a,b){b.k&&b.k()});b.i&&b.mb&&a.a.F.pc(b.i,b.mb);b.r=null;b.L=0;b.R=!0;b.S=!1;b.s=!1;b.i=null}},$={sa:function(b){var c=this,d=c[s];if(!d.R&&d.s&&\"change\"==b){d.s=!1;if(d.S||c.Qa())d.r=null,d.L=0,d.S=!0,c.aa();else{var e=[];a.a.D(d.r,function(a,b){e[b.Ga]=a});a.a.q(e,function(a,b){var e=d.r[a],l=c.uc(e.ia);l.Ga=b;l.na=e.na;d.r[a]=l})}d.R||c.notifySubscribers(d.T,\"awake\")}},\nIa:function(b){var c=this[s];c.R||\"change\"!=b||this.Pa(\"change\")||(a.a.D(c.r,function(a,b){b.k&&(c.r[a]={ia:b.ia,Ga:b.Ga,na:b.na},b.k())}),c.s=!0,this.notifySubscribers(n,\"asleep\"))},Na:function(){var b=this[s];b.s&&(b.S||this.Qa())&&this.aa();return a.J.fn.Na.call(this)}},aa={sa:function(a){\"change\"!=a&&\"beforeChange\"!=a||this.t()}};a.a.ka&&a.a.Xa(z,a.J.fn);var R=a.N.gd;a.m[R]=a.N;z[R]=a.m;a.Xc=function(b){return a.Oa(b,a.m)};a.Yc=function(b){return a.Oa(b,a.m)&&b[s]&&b[s].Va};a.b(\"computed\",a.m);\na.b(\"dependentObservable\",a.m);a.b(\"isComputed\",a.Xc);a.b(\"isPureComputed\",a.Yc);a.b(\"computed.fn\",z);a.G(z,\"peek\",z.t);a.G(z,\"dispose\",z.k);a.G(z,\"isActive\",z.ba);a.G(z,\"getDependenciesCount\",z.Aa);a.nc=function(b,c){if(\"function\"===typeof b)return a.m(b,c,{pure:!0});b=a.a.extend({},b);b.pure=!0;return a.m(b,c)};a.b(\"pureComputed\",a.nc);(function(){function b(a,f,g){g=g||new d;a=f(a);if(\"object\"!=typeof a||null===a||a===n||a instanceof RegExp||a instanceof Date||a instanceof String||a instanceof\nNumber||a instanceof Boolean)return a;var k=a instanceof Array?[]:{};g.save(a,k);c(a,function(c){var d=f(a[c]);switch(typeof d){case \"boolean\":case \"number\":case \"string\":case \"function\":k[c]=d;break;case \"object\":case \"undefined\":var h=g.get(d);k[c]=h!==n?h:b(d,f,g)}});return k}function c(a,b){if(a instanceof Array){for(var c=0;c<a.length;c++)b(c);\"function\"==typeof a.toJSON&&b(\"toJSON\")}else for(c in a)b(c)}function d(){this.keys=[];this.Ib=[]}a.wc=function(c){if(0==arguments.length)throw Error(\"When calling ko.toJS, pass the object you want to convert.\");\nreturn b(c,function(b){for(var c=0;a.H(b)&&10>c;c++)b=b();return b})};a.toJSON=function(b,c,d){b=a.wc(b);return a.a.Eb(b,c,d)};d.prototype={save:function(b,c){var d=a.a.o(this.keys,b);0<=d?this.Ib[d]=c:(this.keys.push(b),this.Ib.push(c))},get:function(b){b=a.a.o(this.keys,b);return 0<=b?this.Ib[b]:n}}})();a.b(\"toJS\",a.wc);a.b(\"toJSON\",a.toJSON);(function(){a.j={u:function(b){switch(a.a.A(b)){case \"option\":return!0===b.__ko__hasDomDataOptionValue__?a.a.e.get(b,a.d.options.xb):7>=a.a.C?b.getAttributeNode(\"value\")&&\nb.getAttributeNode(\"value\").specified?b.value:b.text:b.value;case \"select\":return 0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex]):n;default:return b.value}},ha:function(b,c,d){switch(a.a.A(b)){case \"option\":switch(typeof c){case \"string\":a.a.e.set(b,a.d.options.xb,n);\"__ko__hasDomDataOptionValue__\"in b&&delete b.__ko__hasDomDataOptionValue__;b.value=c;break;default:a.a.e.set(b,a.d.options.xb,c),b.__ko__hasDomDataOptionValue__=!0,b.value=\"number\"===typeof c?c:\"\"}break;case \"select\":if(\"\"===c||\nnull===c)c=n;for(var e=-1,f=0,g=b.options.length,k;f<g;++f)if(k=a.j.u(b.options[f]),k==c||\"\"==k&&c===n){e=f;break}if(d||0<=e||c===n&&1<b.size)b.selectedIndex=e;break;default:if(null===c||c===n)c=\"\";b.value=c}}}})();a.b(\"selectExtensions\",a.j);a.b(\"selectExtensions.readValue\",a.j.u);a.b(\"selectExtensions.writeValue\",a.j.ha);a.h=function(){function b(b){b=a.a.$a(b);123===b.charCodeAt(0)&&(b=b.slice(1,-1));var c=[],d=b.match(e),r,k=[],p=0;if(d){d.push(\",\");for(var A=0,y;y=d[A];++A){var t=y.charCodeAt(0);\nif(44===t){if(0>=p){c.push(r&&k.length?{key:r,value:k.join(\"\")}:{unknown:r||k.join(\"\")});r=p=0;k=[];continue}}else if(58===t){if(!p&&!r&&1===k.length){r=k.pop();continue}}else 47===t&&A&&1<y.length?(t=d[A-1].match(f))&&!g[t[0]]&&(b=b.substr(b.indexOf(y)+1),d=b.match(e),d.push(\",\"),A=-1,y=\"/\"):40===t||123===t||91===t?++p:41===t||125===t||93===t?--p:r||k.length||34!==t&&39!==t||(y=y.slice(1,-1));k.push(y)}}return c}var c=[\"true\",\"false\",\"null\",\"undefined\"],d=/^(?:[$_a-z][$\\w]*|(.+)(\\.\\s*[$_a-z][$\\w]*|\\[.+\\]))$/i,\ne=RegExp(\"\\\"(?:[^\\\"\\\\\\\\]|\\\\\\\\.)*\\\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*'|/(?:[^/\\\\\\\\]|\\\\\\\\.)*/w*|[^\\\\s:,/][^,\\\"'{}()/:[\\\\]]*[^\\\\s,\\\"'{}()/:[\\\\]]|[^\\\\s]\",\"g\"),f=/[\\])\"'A-Za-z0-9_$]+$/,g={\"in\":1,\"return\":1,\"typeof\":1},k={};return{ta:[],ea:k,yb:b,Ua:function(e,m){function h(b,e){var m;if(!A){var l=a.getBindingHandler(b);if(l&&l.preprocess&&!(e=l.preprocess(e,b,h)))return;if(l=k[b])m=e,0<=a.a.o(c,m)?m=!1:(l=m.match(d),m=null===l?!1:l[1]?\"Object(\"+l[1]+\")\"+l[2]:m),l=m;l&&g.push(\"'\"+b+\"':function(_z){\"+m+\"=_z}\")}p&&(e=\n\"function(){return \"+e+\" }\");f.push(\"'\"+b+\"':\"+e)}m=m||{};var f=[],g=[],p=m.valueAccessors,A=m.bindingParams,y=\"string\"===typeof e?b(e):e;a.a.q(y,function(a){h(a.key||a.unknown,a.value)});g.length&&h(\"_ko_property_writers\",\"{\"+g.join(\",\")+\" }\");return f.join(\",\")},ad:function(a,b){for(var c=0;c<a.length;c++)if(a[c].key==b)return!0;return!1},Ea:function(b,c,d,e,f){if(b&&a.H(b))!a.Ba(b)||f&&b.t()===e||b(e);else if((b=c.get(\"_ko_property_writers\"))&&b[d])b[d](e)}}}();a.b(\"expressionRewriting\",a.h);a.b(\"expressionRewriting.bindingRewriteValidators\",\na.h.ta);a.b(\"expressionRewriting.parseObjectLiteral\",a.h.yb);a.b(\"expressionRewriting.preProcessBindings\",a.h.Ua);a.b(\"expressionRewriting._twoWayBindings\",a.h.ea);a.b(\"jsonExpressionRewriting\",a.h);a.b(\"jsonExpressionRewriting.insertPropertyAccessorsIntoJson\",a.h.Ua);(function(){function b(a){return 8==a.nodeType&&g.test(f?a.text:a.nodeValue)}function c(a){return 8==a.nodeType&&k.test(f?a.text:a.nodeValue)}function d(a,d){for(var e=a,f=1,l=[];e=e.nextSibling;){if(c(e)&&(f--,0===f))return l;l.push(e);\nb(e)&&f++}if(!d)throw Error(\"Cannot find closing comment tag to match: \"+a.nodeValue);return null}function e(a,b){var c=d(a,b);return c?0<c.length?c[c.length-1].nextSibling:a.nextSibling:null}var f=u&&\"\\x3c!--test--\\x3e\"===u.createComment(\"test\").text,g=f?/^\\x3c!--\\s*ko(?:\\s+([\\s\\S]+))?\\s*--\\x3e$/:/^\\s*ko(?:\\s+([\\s\\S]+))?\\s*$/,k=f?/^\\x3c!--\\s*\\/ko\\s*--\\x3e$/:/^\\s*\\/ko\\s*$/,l={ul:!0,ol:!0};a.f={Z:{},childNodes:function(a){return b(a)?d(a):a.childNodes},xa:function(c){if(b(c)){c=a.f.childNodes(c);for(var d=\n0,e=c.length;d<e;d++)a.removeNode(c[d])}else a.a.ob(c)},da:function(c,d){if(b(c)){a.f.xa(c);for(var e=c.nextSibling,f=0,l=d.length;f<l;f++)e.parentNode.insertBefore(d[f],e)}else a.a.da(c,d)},mc:function(a,c){b(a)?a.parentNode.insertBefore(c,a.nextSibling):a.firstChild?a.insertBefore(c,a.firstChild):a.appendChild(c)},gc:function(c,d,e){e?b(c)?c.parentNode.insertBefore(d,e.nextSibling):e.nextSibling?c.insertBefore(d,e.nextSibling):c.appendChild(d):a.f.mc(c,d)},firstChild:function(a){return b(a)?!a.nextSibling||\nc(a.nextSibling)?null:a.nextSibling:a.firstChild},nextSibling:function(a){b(a)&&(a=e(a));return a.nextSibling&&c(a.nextSibling)?null:a.nextSibling},Tc:b,pd:function(a){return(a=(f?a.text:a.nodeValue).match(g))?a[1]:null},kc:function(d){if(l[a.a.A(d)]){var h=d.firstChild;if(h){do if(1===h.nodeType){var f;f=h.firstChild;var g=null;if(f){do if(g)g.push(f);else if(b(f)){var k=e(f,!0);k?f=k:g=[f]}else c(f)&&(g=[f]);while(f=f.nextSibling)}if(f=g)for(g=h.nextSibling,k=0;k<f.length;k++)g?d.insertBefore(f[k],\ng):d.appendChild(f[k])}while(h=h.nextSibling)}}}}})();a.b(\"virtualElements\",a.f);a.b(\"virtualElements.allowedBindings\",a.f.Z);a.b(\"virtualElements.emptyNode\",a.f.xa);a.b(\"virtualElements.insertAfter\",a.f.gc);a.b(\"virtualElements.prepend\",a.f.mc);a.b(\"virtualElements.setDomNodeChildren\",a.f.da);(function(){a.Q=function(){this.Fc={}};a.a.extend(a.Q.prototype,{nodeHasBindings:function(b){switch(b.nodeType){case 1:return null!=b.getAttribute(\"data-bind\")||a.g.getComponentNameForNode(b);case 8:return a.f.Tc(b);\ndefault:return!1}},getBindings:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b):null;return a.g.Ob(d,b,c,!1)},getBindingAccessors:function(b,c){var d=this.getBindingsString(b,c),d=d?this.parseBindingsString(d,c,b,{valueAccessors:!0}):null;return a.g.Ob(d,b,c,!0)},getBindingsString:function(b){switch(b.nodeType){case 1:return b.getAttribute(\"data-bind\");case 8:return a.f.pd(b);default:return null}},parseBindingsString:function(b,c,d,e){try{var f=this.Fc,g=b+(e&&e.valueAccessors||\n\"\"),k;if(!(k=f[g])){var l,m=\"with($context){with($data||{}){return{\"+a.h.Ua(b,e)+\"}}}\";l=new Function(\"$context\",\"$element\",m);k=f[g]=l}return k(c,d)}catch(h){throw h.message=\"Unable to parse bindings.\\nBindings value: \"+b+\"\\nMessage: \"+h.message,h;}}});a.Q.instance=new a.Q})();a.b(\"bindingProvider\",a.Q);(function(){function b(a){return function(){return a}}function c(a){return a()}function d(b){return a.a.Ca(a.l.w(b),function(a,c){return function(){return b()[c]}})}function e(c,e,h){return\"function\"===\ntypeof c?d(c.bind(null,e,h)):a.a.Ca(c,b)}function f(a,b){return d(this.getBindings.bind(this,a,b))}function g(b,c,d){var e,h=a.f.firstChild(c),f=a.Q.instance,m=f.preprocessNode;if(m){for(;e=h;)h=a.f.nextSibling(e),m.call(f,e);h=a.f.firstChild(c)}for(;e=h;)h=a.f.nextSibling(e),k(b,e,d)}function k(b,c,d){var e=!0,h=1===c.nodeType;h&&a.f.kc(c);if(h&&d||a.Q.instance.nodeHasBindings(c))e=m(c,null,b,d).shouldBindDescendants;e&&!r[a.a.A(c)]&&g(b,c,!h)}function l(b){var c=[],d={},e=[];a.a.D(b,function Z(h){if(!d[h]){var f=\na.getBindingHandler(h);f&&(f.after&&(e.push(h),a.a.q(f.after,function(c){if(b[c]){if(-1!==a.a.o(e,c))throw Error(\"Cannot combine the following bindings, because they have a cyclic dependency: \"+e.join(\", \"));Z(c)}}),e.length--),c.push({key:h,fc:f}));d[h]=!0}});return c}function m(b,d,e,h){var m=a.a.e.get(b,q);if(!d){if(m)throw Error(\"You cannot apply bindings multiple times to the same element.\");a.a.e.set(b,q,!0)}!m&&h&&a.tc(b,e);var g;if(d&&\"function\"!==typeof d)g=d;else{var k=a.Q.instance,r=k.getBindingAccessors||\nf,p=a.B(function(){(g=d?d(e,b):r.call(k,b,e))&&e.P&&e.P();return g},null,{i:b});g&&p.ba()||(p=null)}var u;if(g){var v=p?function(a){return function(){return c(p()[a])}}:function(a){return g[a]},s=function(){return a.a.Ca(p?p():g,c)};s.get=function(a){return g[a]&&c(v(a))};s.has=function(a){return a in g};h=l(g);a.a.q(h,function(c){var d=c.fc.init,h=c.fc.update,f=c.key;if(8===b.nodeType&&!a.f.Z[f])throw Error(\"The binding '\"+f+\"' cannot be used with virtual elements\");try{\"function\"==typeof d&&a.l.w(function(){var a=\nd(b,v(f),s,e.$data,e);if(a&&a.controlsDescendantBindings){if(u!==n)throw Error(\"Multiple bindings (\"+u+\" and \"+f+\") are trying to control descendant bindings of the same element. You cannot use these bindings together on the same element.\");u=f}}),\"function\"==typeof h&&a.B(function(){h(b,v(f),s,e.$data,e)},null,{i:b})}catch(m){throw m.message='Unable to process binding \"'+f+\": \"+g[f]+'\"\\nMessage: '+m.message,m;}})}return{shouldBindDescendants:u===n}}function h(b){return b&&b instanceof a.U?b:new a.U(b)}\na.d={};var r={script:!0,textarea:!0,template:!0};a.getBindingHandler=function(b){return a.d[b]};a.U=function(b,c,d,e){var h=this,f=\"function\"==typeof b&&!a.H(b),m,g=a.B(function(){var m=f?b():b,l=a.a.c(m);c?(c.P&&c.P(),a.a.extend(h,c),g&&(h.P=g)):(h.$parents=[],h.$root=l,h.ko=a);h.$rawData=m;h.$data=l;d&&(h[d]=l);e&&e(h,c,l);return h.$data},null,{wa:function(){return m&&!a.a.Qb(m)},i:!0});g.ba()&&(h.P=g,g.equalityComparer=null,m=[],g.Ac=function(b){m.push(b);a.a.F.oa(b,function(b){a.a.La(m,b);m.length||\n(g.k(),h.P=g=n)})})};a.U.prototype.createChildContext=function(b,c,d){return new a.U(b,this,c,function(a,b){a.$parentContext=b;a.$parent=b.$data;a.$parents=(b.$parents||[]).slice(0);a.$parents.unshift(a.$parent);d&&d(a)})};a.U.prototype.extend=function(b){return new a.U(this.P||this.$data,this,null,function(c,d){c.$rawData=d.$rawData;a.a.extend(c,\"function\"==typeof b?b():b)})};var q=a.a.e.I(),p=a.a.e.I();a.tc=function(b,c){if(2==arguments.length)a.a.e.set(b,p,c),c.P&&c.P.Ac(b);else return a.a.e.get(b,\np)};a.Ja=function(b,c,d){1===b.nodeType&&a.f.kc(b);return m(b,c,h(d),!0)};a.Dc=function(b,c,d){d=h(d);return a.Ja(b,e(c,d,b),d)};a.eb=function(a,b){1!==b.nodeType&&8!==b.nodeType||g(h(a),b,!0)};a.Rb=function(a,b){!v&&x.jQuery&&(v=x.jQuery);if(b&&1!==b.nodeType&&8!==b.nodeType)throw Error(\"ko.applyBindings: first parameter should be your view model; second parameter should be a DOM node\");b=b||x.document.body;k(h(a),b,!0)};a.kb=function(b){switch(b.nodeType){case 1:case 8:var c=a.tc(b);if(c)return c;\nif(b.parentNode)return a.kb(b.parentNode)}return n};a.Jc=function(b){return(b=a.kb(b))?b.$data:n};a.b(\"bindingHandlers\",a.d);a.b(\"applyBindings\",a.Rb);a.b(\"applyBindingsToDescendants\",a.eb);a.b(\"applyBindingAccessorsToNode\",a.Ja);a.b(\"applyBindingsToNode\",a.Dc);a.b(\"contextFor\",a.kb);a.b(\"dataFor\",a.Jc)})();(function(b){function c(c,e){var m=f.hasOwnProperty(c)?f[c]:b,h;m?m.X(e):(m=f[c]=new a.J,m.X(e),d(c,function(b,d){var e=!(!d||!d.synchronous);g[c]={definition:b,Zc:e};delete f[c];h||e?m.notifySubscribers(b):\na.Y.Wa(function(){m.notifySubscribers(b)})}),h=!0)}function d(a,b){e(\"getConfig\",[a],function(c){c?e(\"loadComponent\",[a,c],function(a){b(a,c)}):b(null,null)})}function e(c,d,f,h){h||(h=a.g.loaders.slice(0));var g=h.shift();if(g){var q=g[c];if(q){var p=!1;if(q.apply(g,d.concat(function(a){p?f(null):null!==a?f(a):e(c,d,f,h)}))!==b&&(p=!0,!g.suppressLoaderExceptions))throw Error(\"Component loaders must supply values by invoking the callback, not by returning values synchronously.\");}else e(c,d,f,h)}else f(null)}\nvar f={},g={};a.g={get:function(d,e){var f=g.hasOwnProperty(d)?g[d]:b;f?f.Zc?a.l.w(function(){e(f.definition)}):a.Y.Wa(function(){e(f.definition)}):c(d,e)},Xb:function(a){delete g[a]},Jb:e};a.g.loaders=[];a.b(\"components\",a.g);a.b(\"components.get\",a.g.get);a.b(\"components.clearCachedDefinition\",a.g.Xb)})();(function(){function b(b,c,d,e){function g(){0===--y&&e(k)}var k={},y=2,t=d.template;d=d.viewModel;t?f(c,t,function(c){a.g.Jb(\"loadTemplate\",[b,c],function(a){k.template=a;g()})}):g();d?f(c,d,function(c){a.g.Jb(\"loadViewModel\",\n[b,c],function(a){k[l]=a;g()})}):g()}function c(a,b,d){if(\"function\"===typeof b)d(function(a){return new b(a)});else if(\"function\"===typeof b[l])d(b[l]);else if(\"instance\"in b){var e=b.instance;d(function(){return e})}else\"viewModel\"in b?c(a,b.viewModel,d):a(\"Unknown viewModel value: \"+b)}function d(b){switch(a.a.A(b)){case \"script\":return a.a.ma(b.text);case \"textarea\":return a.a.ma(b.value);case \"template\":if(e(b.content))return a.a.ua(b.content.childNodes)}return a.a.ua(b.childNodes)}function e(a){return x.DocumentFragment?\na instanceof DocumentFragment:a&&11===a.nodeType}function f(a,b,c){\"string\"===typeof b.require?O||x.require?(O||x.require)([b.require],c):a(\"Uses require, but no AMD loader is present\"):c(b)}function g(a){return function(b){throw Error(\"Component '\"+a+\"': \"+b);}}var k={};a.g.register=function(b,c){if(!c)throw Error(\"Invalid configuration for \"+b);if(a.g.ub(b))throw Error(\"Component \"+b+\" is already registered\");k[b]=c};a.g.ub=function(a){return k.hasOwnProperty(a)};a.g.od=function(b){delete k[b];\na.g.Xb(b)};a.g.Zb={getConfig:function(a,b){b(k.hasOwnProperty(a)?k[a]:null)},loadComponent:function(a,c,d){var e=g(a);f(e,c,function(c){b(a,e,c,d)})},loadTemplate:function(b,c,f){b=g(b);if(\"string\"===typeof c)f(a.a.ma(c));else if(c instanceof Array)f(c);else if(e(c))f(a.a.V(c.childNodes));else if(c.element)if(c=c.element,x.HTMLElement?c instanceof HTMLElement:c&&c.tagName&&1===c.nodeType)f(d(c));else if(\"string\"===typeof c){var l=u.getElementById(c);l?f(d(l)):b(\"Cannot find element with ID \"+c)}else b(\"Unknown element type: \"+\nc);else b(\"Unknown template value: \"+c)},loadViewModel:function(a,b,d){c(g(a),b,d)}};var l=\"createViewModel\";a.b(\"components.register\",a.g.register);a.b(\"components.isRegistered\",a.g.ub);a.b(\"components.unregister\",a.g.od);a.b(\"components.defaultLoader\",a.g.Zb);a.g.loaders.push(a.g.Zb);a.g.Bc=k})();(function(){function b(b,e){var f=b.getAttribute(\"params\");if(f){var f=c.parseBindingsString(f,e,b,{valueAccessors:!0,bindingParams:!0}),f=a.a.Ca(f,function(c){return a.m(c,null,{i:b})}),g=a.a.Ca(f,function(c){var e=\nc.t();return c.ba()?a.m({read:function(){return a.a.c(c())},write:a.Ba(e)&&function(a){c()(a)},i:b}):e});g.hasOwnProperty(\"$raw\")||(g.$raw=f);return g}return{$raw:{}}}a.g.getComponentNameForNode=function(b){var c=a.a.A(b);if(a.g.ub(c)&&(-1!=c.indexOf(\"-\")||\"[object HTMLUnknownElement]\"==\"\"+b||8>=a.a.C&&b.tagName===c))return c};a.g.Ob=function(c,e,f,g){if(1===e.nodeType){var k=a.g.getComponentNameForNode(e);if(k){c=c||{};if(c.component)throw Error('Cannot use the \"component\" binding on a custom element matching a component');\nvar l={name:k,params:b(e,f)};c.component=g?function(){return l}:l}}return c};var c=new a.Q;9>a.a.C&&(a.g.register=function(a){return function(b){u.createElement(b);return a.apply(this,arguments)}}(a.g.register),u.createDocumentFragment=function(b){return function(){var c=b(),f=a.g.Bc,g;for(g in f)f.hasOwnProperty(g)&&c.createElement(g);return c}}(u.createDocumentFragment))})();(function(b){function c(b,c,d){c=c.template;if(!c)throw Error(\"Component '\"+b+\"' has no template\");b=a.a.ua(c);a.f.da(d,b)}\nfunction d(a,b,c,d){var e=a.createViewModel;return e?e.call(a,d,{element:b,templateNodes:c}):d}var e=0;a.d.component={init:function(f,g,k,l,m){function h(){var a=r&&r.dispose;\"function\"===typeof a&&a.call(r);q=r=null}var r,q,p=a.a.V(a.f.childNodes(f));a.a.F.oa(f,h);a.m(function(){var l=a.a.c(g()),k,t;\"string\"===typeof l?k=l:(k=a.a.c(l.name),t=a.a.c(l.params));if(!k)throw Error(\"No component name specified\");var n=q=++e;a.g.get(k,function(e){if(q===n){h();if(!e)throw Error(\"Unknown component '\"+k+\n\"'\");c(k,e,f);var g=d(e,f,p,t);e=m.createChildContext(g,b,function(a){a.$component=g;a.$componentTemplateNodes=p});r=g;a.eb(e,f)}})},null,{i:f});return{controlsDescendantBindings:!0}}};a.f.Z.component=!0})();var S={\"class\":\"className\",\"for\":\"htmlFor\"};a.d.attr={update:function(b,c){var d=a.a.c(c())||{};a.a.D(d,function(c,d){d=a.a.c(d);var g=!1===d||null===d||d===n;g&&b.removeAttribute(c);8>=a.a.C&&c in S?(c=S[c],g?b.removeAttribute(c):b[c]=d):g||b.setAttribute(c,d.toString());\"name\"===c&&a.a.rc(b,\ng?\"\":d.toString())})}};(function(){a.d.checked={after:[\"value\",\"attr\"],init:function(b,c,d){function e(){var e=b.checked,f=p?g():e;if(!a.va.Sa()&&(!l||e)){var m=a.l.w(c);if(h){var k=r?m.t():m;q!==f?(e&&(a.a.pa(k,f,!0),a.a.pa(k,q,!1)),q=f):a.a.pa(k,f,e);r&&a.Ba(m)&&m(k)}else a.h.Ea(m,d,\"checked\",f,!0)}}function f(){var d=a.a.c(c());b.checked=h?0<=a.a.o(d,g()):k?d:g()===d}var g=a.nc(function(){return d.has(\"checkedValue\")?a.a.c(d.get(\"checkedValue\")):d.has(\"value\")?a.a.c(d.get(\"value\")):b.value}),k=\n\"checkbox\"==b.type,l=\"radio\"==b.type;if(k||l){var m=c(),h=k&&a.a.c(m)instanceof Array,r=!(h&&m.push&&m.splice),q=h?g():n,p=l||h;l&&!b.name&&a.d.uniqueName.init(b,function(){return!0});a.m(e,null,{i:b});a.a.p(b,\"click\",e);a.m(f,null,{i:b});m=n}}};a.h.ea.checked=!0;a.d.checkedValue={update:function(b,c){b.value=a.a.c(c())}}})();a.d.css={update:function(b,c){var d=a.a.c(c());null!==d&&\"object\"==typeof d?a.a.D(d,function(c,d){d=a.a.c(d);a.a.bb(b,c,d)}):(d=a.a.$a(String(d||\"\")),a.a.bb(b,b.__ko__cssValue,\n!1),b.__ko__cssValue=d,a.a.bb(b,d,!0))}};a.d.enable={update:function(b,c){var d=a.a.c(c());d&&b.disabled?b.removeAttribute(\"disabled\"):d||b.disabled||(b.disabled=!0)}};a.d.disable={update:function(b,c){a.d.enable.update(b,function(){return!a.a.c(c())})}};a.d.event={init:function(b,c,d,e,f){var g=c()||{};a.a.D(g,function(g){\"string\"==typeof g&&a.a.p(b,g,function(b){var m,h=c()[g];if(h){try{var r=a.a.V(arguments);e=f.$data;r.unshift(e);m=h.apply(e,r)}finally{!0!==m&&(b.preventDefault?b.preventDefault():\nb.returnValue=!1)}!1===d.get(g+\"Bubble\")&&(b.cancelBubble=!0,b.stopPropagation&&b.stopPropagation())}})})}};a.d.foreach={ic:function(b){return function(){var c=b(),d=a.a.zb(c);if(!d||\"number\"==typeof d.length)return{foreach:c,templateEngine:a.W.sb};a.a.c(c);return{foreach:d.data,as:d.as,includeDestroyed:d.includeDestroyed,afterAdd:d.afterAdd,beforeRemove:d.beforeRemove,afterRender:d.afterRender,beforeMove:d.beforeMove,afterMove:d.afterMove,templateEngine:a.W.sb}}},init:function(b,c){return a.d.template.init(b,\na.d.foreach.ic(c))},update:function(b,c,d,e,f){return a.d.template.update(b,a.d.foreach.ic(c),d,e,f)}};a.h.ta.foreach=!1;a.f.Z.foreach=!0;a.d.hasfocus={init:function(b,c,d){function e(e){b.__ko_hasfocusUpdating=!0;var f=b.ownerDocument;if(\"activeElement\"in f){var g;try{g=f.activeElement}catch(h){g=f.body}e=g===b}f=c();a.h.Ea(f,d,\"hasfocus\",e,!0);b.__ko_hasfocusLastValue=e;b.__ko_hasfocusUpdating=!1}var f=e.bind(null,!0),g=e.bind(null,!1);a.a.p(b,\"focus\",f);a.a.p(b,\"focusin\",f);a.a.p(b,\"blur\",g);a.a.p(b,\n\"focusout\",g)},update:function(b,c){var d=!!a.a.c(c());b.__ko_hasfocusUpdating||b.__ko_hasfocusLastValue===d||(d?b.focus():b.blur(),!d&&b.__ko_hasfocusLastValue&&b.ownerDocument.body.focus(),a.l.w(a.a.Da,null,[b,d?\"focusin\":\"focusout\"]))}};a.h.ea.hasfocus=!0;a.d.hasFocus=a.d.hasfocus;a.h.ea.hasFocus=!0;a.d.html={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Cb(b,c())}};K(\"if\");K(\"ifnot\",!1,!0);K(\"with\",!0,!1,function(a,c){return a.createChildContext(c)});var L={};\na.d.options={init:function(b){if(\"select\"!==a.a.A(b))throw Error(\"options binding applies only to SELECT elements\");for(;0<b.length;)b.remove(0);return{controlsDescendantBindings:!0}},update:function(b,c,d){function e(){return a.a.Ka(b.options,function(a){return a.selected})}function f(a,b,c){var d=typeof b;return\"function\"==d?b(a):\"string\"==d?a[b]:c}function g(c,e){if(A&&h)a.j.ha(b,a.a.c(d.get(\"value\")),!0);else if(p.length){var f=0<=a.a.o(p,a.j.u(e[0]));a.a.sc(e[0],f);A&&!f&&a.l.w(a.a.Da,null,[b,\n\"change\"])}}var k=b.multiple,l=0!=b.length&&k?b.scrollTop:null,m=a.a.c(c()),h=d.get(\"valueAllowUnset\")&&d.has(\"value\"),r=d.get(\"optionsIncludeDestroyed\");c={};var q,p=[];h||(k?p=a.a.fb(e(),a.j.u):0<=b.selectedIndex&&p.push(a.j.u(b.options[b.selectedIndex])));m&&(\"undefined\"==typeof m.length&&(m=[m]),q=a.a.Ka(m,function(b){return r||b===n||null===b||!a.a.c(b._destroy)}),d.has(\"optionsCaption\")&&(m=a.a.c(d.get(\"optionsCaption\")),null!==m&&m!==n&&q.unshift(L)));var A=!1;c.beforeRemove=function(a){b.removeChild(a)};\nm=g;d.has(\"optionsAfterRender\")&&\"function\"==typeof d.get(\"optionsAfterRender\")&&(m=function(b,c){g(0,c);a.l.w(d.get(\"optionsAfterRender\"),null,[c[0],b!==L?b:n])});a.a.Bb(b,q,function(c,e,g){g.length&&(p=!h&&g[0].selected?[a.j.u(g[0])]:[],A=!0);e=b.ownerDocument.createElement(\"option\");c===L?(a.a.Za(e,d.get(\"optionsCaption\")),a.j.ha(e,n)):(g=f(c,d.get(\"optionsValue\"),c),a.j.ha(e,a.a.c(g)),c=f(c,d.get(\"optionsText\"),g),a.a.Za(e,c));return[e]},c,m);a.l.w(function(){h?a.j.ha(b,a.a.c(d.get(\"value\")),\n!0):(k?p.length&&e().length<p.length:p.length&&0<=b.selectedIndex?a.j.u(b.options[b.selectedIndex])!==p[0]:p.length||0<=b.selectedIndex)&&a.a.Da(b,\"change\")});a.a.Nc(b);l&&20<Math.abs(l-b.scrollTop)&&(b.scrollTop=l)}};a.d.options.xb=a.a.e.I();a.d.selectedOptions={after:[\"options\",\"foreach\"],init:function(b,c,d){a.a.p(b,\"change\",function(){var e=c(),f=[];a.a.q(b.getElementsByTagName(\"option\"),function(b){b.selected&&f.push(a.j.u(b))});a.h.Ea(e,d,\"selectedOptions\",f)})},update:function(b,c){if(\"select\"!=\na.a.A(b))throw Error(\"values binding applies only to SELECT elements\");var d=a.a.c(c()),e=b.scrollTop;d&&\"number\"==typeof d.length&&a.a.q(b.getElementsByTagName(\"option\"),function(b){var c=0<=a.a.o(d,a.j.u(b));b.selected!=c&&a.a.sc(b,c)});b.scrollTop=e}};a.h.ea.selectedOptions=!0;a.d.style={update:function(b,c){var d=a.a.c(c()||{});a.a.D(d,function(c,d){d=a.a.c(d);if(null===d||d===n||!1===d)d=\"\";b.style[c]=d})}};a.d.submit={init:function(b,c,d,e,f){if(\"function\"!=typeof c())throw Error(\"The value for a submit binding must be a function\");\na.a.p(b,\"submit\",function(a){var d,e=c();try{d=e.call(f.$data,b)}finally{!0!==d&&(a.preventDefault?a.preventDefault():a.returnValue=!1)}})}};a.d.text={init:function(){return{controlsDescendantBindings:!0}},update:function(b,c){a.a.Za(b,c())}};a.f.Z.text=!0;(function(){if(x&&x.navigator)var b=function(a){if(a)return parseFloat(a[1])},c=x.opera&&x.opera.version&&parseInt(x.opera.version()),d=x.navigator.userAgent,e=b(d.match(/^(?:(?!chrome).)*version\\/([^ ]*) safari/i)),f=b(d.match(/Firefox\\/([^ ]*)/));\nif(10>a.a.C)var g=a.a.e.I(),k=a.a.e.I(),l=function(b){var c=this.activeElement;(c=c&&a.a.e.get(c,k))&&c(b)},m=function(b,c){var d=b.ownerDocument;a.a.e.get(d,g)||(a.a.e.set(d,g,!0),a.a.p(d,\"selectionchange\",l));a.a.e.set(b,k,c)};a.d.textInput={init:function(b,d,g){function l(c,d){a.a.p(b,c,d)}function k(){var c=a.a.c(d());if(null===c||c===n)c=\"\";v!==n&&c===v?a.a.setTimeout(k,4):b.value!==c&&(u=c,b.value=c)}function y(){s||(v=b.value,s=a.a.setTimeout(t,4))}function t(){clearTimeout(s);v=s=n;var c=\nb.value;u!==c&&(u=c,a.h.Ea(d(),g,\"textInput\",c))}var u=b.value,s,v,x=9==a.a.C?y:t;10>a.a.C?(l(\"propertychange\",function(a){\"value\"===a.propertyName&&x(a)}),8==a.a.C&&(l(\"keyup\",t),l(\"keydown\",t)),8<=a.a.C&&(m(b,x),l(\"dragend\",y))):(l(\"input\",t),5>e&&\"textarea\"===a.a.A(b)?(l(\"keydown\",y),l(\"paste\",y),l(\"cut\",y)):11>c?l(\"keydown\",y):4>f&&(l(\"DOMAutoComplete\",t),l(\"dragdrop\",t),l(\"drop\",t)));l(\"change\",t);a.m(k,null,{i:b})}};a.h.ea.textInput=!0;a.d.textinput={preprocess:function(a,b,c){c(\"textInput\",\na)}}})();a.d.uniqueName={init:function(b,c){if(c()){var d=\"ko_unique_\"+ ++a.d.uniqueName.Ic;a.a.rc(b,d)}}};a.d.uniqueName.Ic=0;a.d.value={after:[\"options\",\"foreach\"],init:function(b,c,d){if(\"input\"!=b.tagName.toLowerCase()||\"checkbox\"!=b.type&&\"radio\"!=b.type){var e=[\"change\"],f=d.get(\"valueUpdate\"),g=!1,k=null;f&&(\"string\"==typeof f&&(f=[f]),a.a.ra(e,f),e=a.a.Tb(e));var l=function(){k=null;g=!1;var e=c(),f=a.j.u(b);a.h.Ea(e,d,\"value\",f)};!a.a.C||\"input\"!=b.tagName.toLowerCase()||\"text\"!=b.type||\n\"off\"==b.autocomplete||b.form&&\"off\"==b.form.autocomplete||-1!=a.a.o(e,\"propertychange\")||(a.a.p(b,\"propertychange\",function(){g=!0}),a.a.p(b,\"focus\",function(){g=!1}),a.a.p(b,\"blur\",function(){g&&l()}));a.a.q(e,function(c){var d=l;a.a.nd(c,\"after\")&&(d=function(){k=a.j.u(b);a.a.setTimeout(l,0)},c=c.substring(5));a.a.p(b,c,d)});var m=function(){var e=a.a.c(c()),f=a.j.u(b);if(null!==k&&e===k)a.a.setTimeout(m,0);else if(e!==f)if(\"select\"===a.a.A(b)){var g=d.get(\"valueAllowUnset\"),f=function(){a.j.ha(b,\ne,g)};f();g||e===a.j.u(b)?a.a.setTimeout(f,0):a.l.w(a.a.Da,null,[b,\"change\"])}else a.j.ha(b,e)};a.m(m,null,{i:b})}else a.Ja(b,{checkedValue:c})},update:function(){}};a.h.ea.value=!0;a.d.visible={update:function(b,c){var d=a.a.c(c()),e=\"none\"!=b.style.display;d&&!e?b.style.display=\"\":!d&&e&&(b.style.display=\"none\")}};(function(b){a.d[b]={init:function(c,d,e,f,g){return a.d.event.init.call(this,c,function(){var a={};a[b]=d();return a},e,f,g)}}})(\"click\");a.O=function(){};a.O.prototype.renderTemplateSource=\nfunction(){throw Error(\"Override renderTemplateSource\");};a.O.prototype.createJavaScriptEvaluatorBlock=function(){throw Error(\"Override createJavaScriptEvaluatorBlock\");};a.O.prototype.makeTemplateSource=function(b,c){if(\"string\"==typeof b){c=c||u;var d=c.getElementById(b);if(!d)throw Error(\"Cannot find template with ID \"+b);return new a.v.n(d)}if(1==b.nodeType||8==b.nodeType)return new a.v.qa(b);throw Error(\"Unknown template type: \"+b);};a.O.prototype.renderTemplate=function(a,c,d,e){a=this.makeTemplateSource(a,\ne);return this.renderTemplateSource(a,c,d,e)};a.O.prototype.isTemplateRewritten=function(a,c){return!1===this.allowTemplateRewriting?!0:this.makeTemplateSource(a,c).data(\"isRewritten\")};a.O.prototype.rewriteTemplate=function(a,c,d){a=this.makeTemplateSource(a,d);c=c(a.text());a.text(c);a.data(\"isRewritten\",!0)};a.b(\"templateEngine\",a.O);a.Gb=function(){function b(b,c,d,k){b=a.h.yb(b);for(var l=a.h.ta,m=0;m<b.length;m++){var h=b[m].key;if(l.hasOwnProperty(h)){var r=l[h];if(\"function\"===typeof r){if(h=\nr(b[m].value))throw Error(h);}else if(!r)throw Error(\"This template engine does not support the '\"+h+\"' binding within its templates\");}}d=\"ko.__tr_ambtns(function($context,$element){return(function(){return{ \"+a.h.Ua(b,{valueAccessors:!0})+\" } })()},'\"+d.toLowerCase()+\"')\";return k.createJavaScriptEvaluatorBlock(d)+c}var c=/(<([a-z]+\\d*)(?:\\s+(?!data-bind\\s*=\\s*)[a-z0-9\\-]+(?:=(?:\\\"[^\\\"]*\\\"|\\'[^\\']*\\'|[^>]*))?)*\\s+)data-bind\\s*=\\s*([\"'])([\\s\\S]*?)\\3/gi,d=/\\x3c!--\\s*ko\\b\\s*([\\s\\S]*?)\\s*--\\x3e/g;return{Oc:function(b,\nc,d){c.isTemplateRewritten(b,d)||c.rewriteTemplate(b,function(b){return a.Gb.dd(b,c)},d)},dd:function(a,f){return a.replace(c,function(a,c,d,e,h){return b(h,c,d,f)}).replace(d,function(a,c){return b(c,\"\\x3c!-- ko --\\x3e\",\"#comment\",f)})},Ec:function(b,c){return a.M.wb(function(d,k){var l=d.nextSibling;l&&l.nodeName.toLowerCase()===c&&a.Ja(l,b,k)})}}}();a.b(\"__tr_ambtns\",a.Gb.Ec);(function(){a.v={};a.v.n=function(b){if(this.n=b){var c=a.a.A(b);this.ab=\"script\"===c?1:\"textarea\"===c?2:\"template\"==c&&\nb.content&&11===b.content.nodeType?3:4}};a.v.n.prototype.text=function(){var b=1===this.ab?\"text\":2===this.ab?\"value\":\"innerHTML\";if(0==arguments.length)return this.n[b];var c=arguments[0];\"innerHTML\"===b?a.a.Cb(this.n,c):this.n[b]=c};var b=a.a.e.I()+\"_\";a.v.n.prototype.data=function(c){if(1===arguments.length)return a.a.e.get(this.n,b+c);a.a.e.set(this.n,b+c,arguments[1])};var c=a.a.e.I();a.v.n.prototype.nodes=function(){var b=this.n;if(0==arguments.length)return(a.a.e.get(b,c)||{}).jb||(3===this.ab?\nb.content:4===this.ab?b:n);a.a.e.set(b,c,{jb:arguments[0]})};a.v.qa=function(a){this.n=a};a.v.qa.prototype=new a.v.n;a.v.qa.prototype.text=function(){if(0==arguments.length){var b=a.a.e.get(this.n,c)||{};b.Hb===n&&b.jb&&(b.Hb=b.jb.innerHTML);return b.Hb}a.a.e.set(this.n,c,{Hb:arguments[0]})};a.b(\"templateSources\",a.v);a.b(\"templateSources.domElement\",a.v.n);a.b(\"templateSources.anonymousTemplate\",a.v.qa)})();(function(){function b(b,c,d){var e;for(c=a.f.nextSibling(c);b&&(e=b)!==c;)b=a.f.nextSibling(e),\nd(e,b)}function c(c,d){if(c.length){var e=c[0],f=c[c.length-1],g=e.parentNode,k=a.Q.instance,n=k.preprocessNode;if(n){b(e,f,function(a,b){var c=a.previousSibling,d=n.call(k,a);d&&(a===e&&(e=d[0]||b),a===f&&(f=d[d.length-1]||c))});c.length=0;if(!e)return;e===f?c.push(e):(c.push(e,f),a.a.za(c,g))}b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.Rb(d,b)});b(e,f,function(b){1!==b.nodeType&&8!==b.nodeType||a.M.yc(b,[d])});a.a.za(c,g)}}function d(a){return a.nodeType?a:0<a.length?a[0]:null}function e(b,\ne,f,k,q){q=q||{};var p=(b&&d(b)||f||{}).ownerDocument,n=q.templateEngine||g;a.Gb.Oc(f,n,p);f=n.renderTemplate(f,k,q,p);if(\"number\"!=typeof f.length||0<f.length&&\"number\"!=typeof f[0].nodeType)throw Error(\"Template engine must return an array of DOM nodes\");p=!1;switch(e){case \"replaceChildren\":a.f.da(b,f);p=!0;break;case \"replaceNode\":a.a.qc(b,f);p=!0;break;case \"ignoreTargetNode\":break;default:throw Error(\"Unknown renderMode: \"+e);}p&&(c(f,k),q.afterRender&&a.l.w(q.afterRender,null,[f,k.$data]));\nreturn f}function f(b,c,d){return a.H(b)?b():\"function\"===typeof b?b(c,d):b}var g;a.Db=function(b){if(b!=n&&!(b instanceof a.O))throw Error(\"templateEngine must inherit from ko.templateEngine\");g=b};a.Ab=function(b,c,h,k,q){h=h||{};if((h.templateEngine||g)==n)throw Error(\"Set a template engine before calling renderTemplate\");q=q||\"replaceChildren\";if(k){var p=d(k);return a.B(function(){var g=c&&c instanceof a.U?c:new a.U(a.a.c(c)),n=f(b,g.$data,g),g=e(k,q,n,g,h);\"replaceNode\"==q&&(k=g,p=d(k))},null,\n{wa:function(){return!p||!a.a.nb(p)},i:p&&\"replaceNode\"==q?p.parentNode:p})}return a.M.wb(function(d){a.Ab(b,c,h,d,\"replaceNode\")})};a.kd=function(b,d,g,k,q){function p(a,b){c(b,s);g.afterRender&&g.afterRender(b,a);s=null}function u(a,c){s=q.createChildContext(a,g.as,function(a){a.$index=c});var d=f(b,a,s);return e(null,\"ignoreTargetNode\",d,s,g)}var s;return a.B(function(){var b=a.a.c(d)||[];\"undefined\"==typeof b.length&&(b=[b]);b=a.a.Ka(b,function(b){return g.includeDestroyed||b===n||null===b||!a.a.c(b._destroy)});\na.l.w(a.a.Bb,null,[k,b,u,g,p])},null,{i:k})};var k=a.a.e.I();a.d.template={init:function(b,c){var d=a.a.c(c());if(\"string\"==typeof d||d.name)a.f.xa(b);else{if(\"nodes\"in d){if(d=d.nodes||[],a.H(d))throw Error('The \"nodes\" option must be a plain, non-observable array.');}else d=a.f.childNodes(b);d=a.a.jc(d);(new a.v.qa(b)).nodes(d)}return{controlsDescendantBindings:!0}},update:function(b,c,d,e,f){var g=c(),s;c=a.a.c(g);d=!0;e=null;\"string\"==typeof c?c={}:(g=c.name,\"if\"in c&&(d=a.a.c(c[\"if\"])),d&&\"ifnot\"in\nc&&(d=!a.a.c(c.ifnot)),s=a.a.c(c.data));\"foreach\"in c?e=a.kd(g||b,d&&c.foreach||[],c,b,f):d?(f=\"data\"in c?f.createChildContext(s,c.as):f,e=a.Ab(g||b,f,c,b)):a.f.xa(b);f=e;(s=a.a.e.get(b,k))&&\"function\"==typeof s.k&&s.k();a.a.e.set(b,k,f&&f.ba()?f:n)}};a.h.ta.template=function(b){b=a.h.yb(b);return 1==b.length&&b[0].unknown||a.h.ad(b,\"name\")?null:\"This template engine does not support anonymous templates nested within its templates\"};a.f.Z.template=!0})();a.b(\"setTemplateEngine\",a.Db);a.b(\"renderTemplate\",\na.Ab);a.a.dc=function(a,c,d){if(a.length&&c.length){var e,f,g,k,l;for(e=f=0;(!d||e<d)&&(k=a[f]);++f){for(g=0;l=c[g];++g)if(k.value===l.value){k.moved=l.index;l.moved=k.index;c.splice(g,1);e=g=0;break}e+=g}}};a.a.ib=function(){function b(b,d,e,f,g){var k=Math.min,l=Math.max,m=[],h,n=b.length,q,p=d.length,s=p-n||1,u=n+p+1,t,v,x;for(h=0;h<=n;h++)for(v=t,m.push(t=[]),x=k(p,h+s),q=l(0,h-1);q<=x;q++)t[q]=q?h?b[h-1]===d[q-1]?v[q-1]:k(v[q]||u,t[q-1]||u)+1:q+1:h+1;k=[];l=[];s=[];h=n;for(q=p;h||q;)p=m[h][q]-\n1,q&&p===m[h][q-1]?l.push(k[k.length]={status:e,value:d[--q],index:q}):h&&p===m[h-1][q]?s.push(k[k.length]={status:f,value:b[--h],index:h}):(--q,--h,g.sparse||k.push({status:\"retained\",value:d[q]}));a.a.dc(s,l,!g.dontLimitMoves&&10*n);return k.reverse()}return function(a,d,e){e=\"boolean\"===typeof e?{dontLimitMoves:e}:e||{};a=a||[];d=d||[];return a.length<d.length?b(a,d,\"added\",\"deleted\",e):b(d,a,\"deleted\",\"added\",e)}}();a.b(\"utils.compareArrays\",a.a.ib);(function(){function b(b,c,d,k,l){var m=[],\nh=a.B(function(){var h=c(d,l,a.a.za(m,b))||[];0<m.length&&(a.a.qc(m,h),k&&a.l.w(k,null,[d,h,l]));m.length=0;a.a.ra(m,h)},null,{i:b,wa:function(){return!a.a.Qb(m)}});return{ca:m,B:h.ba()?h:n}}var c=a.a.e.I(),d=a.a.e.I();a.a.Bb=function(e,f,g,k,l){function m(b,c){w=q[c];v!==c&&(D[b]=w);w.qb(v++);a.a.za(w.ca,e);u.push(w);z.push(w)}function h(b,c){if(b)for(var d=0,e=c.length;d<e;d++)c[d]&&a.a.q(c[d].ca,function(a){b(a,d,c[d].ja)})}f=f||[];k=k||{};var r=a.a.e.get(e,c)===n,q=a.a.e.get(e,c)||[],p=a.a.fb(q,\nfunction(a){return a.ja}),s=a.a.ib(p,f,k.dontLimitMoves),u=[],t=0,v=0,x=[],z=[];f=[];for(var D=[],p=[],w,C=0,B,E;B=s[C];C++)switch(E=B.moved,B.status){case \"deleted\":E===n&&(w=q[t],w.B&&(w.B.k(),w.B=n),a.a.za(w.ca,e).length&&(k.beforeRemove&&(u.push(w),z.push(w),w.ja===d?w=null:f[C]=w),w&&x.push.apply(x,w.ca)));t++;break;case \"retained\":m(C,t++);break;case \"added\":E!==n?m(C,E):(w={ja:B.value,qb:a.N(v++)},u.push(w),z.push(w),r||(p[C]=w))}a.a.e.set(e,c,u);h(k.beforeMove,D);a.a.q(x,k.beforeRemove?a.$:\na.removeNode);for(var C=0,r=a.f.firstChild(e),F;w=z[C];C++){w.ca||a.a.extend(w,b(e,g,w.ja,l,w.qb));for(t=0;s=w.ca[t];r=s.nextSibling,F=s,t++)s!==r&&a.f.gc(e,s,F);!w.Wc&&l&&(l(w.ja,w.ca,w.qb),w.Wc=!0)}h(k.beforeRemove,f);for(C=0;C<f.length;++C)f[C]&&(f[C].ja=d);h(k.afterMove,D);h(k.afterAdd,p)}})();a.b(\"utils.setDomNodeChildrenFromArrayMapping\",a.a.Bb);a.W=function(){this.allowTemplateRewriting=!1};a.W.prototype=new a.O;a.W.prototype.renderTemplateSource=function(b,c,d,e){if(c=(9>a.a.C?0:b.nodes)?\nb.nodes():null)return a.a.V(c.cloneNode(!0).childNodes);b=b.text();return a.a.ma(b,e)};a.W.sb=new a.W;a.Db(a.W.sb);a.b(\"nativeTemplateEngine\",a.W);(function(){a.vb=function(){var a=this.$c=function(){if(!v||!v.tmpl)return 0;try{if(0<=v.tmpl.tag.tmpl.open.toString().indexOf(\"__\"))return 2}catch(a){}return 1}();this.renderTemplateSource=function(b,e,f,g){g=g||u;f=f||{};if(2>a)throw Error(\"Your version of jQuery.tmpl is too old. Please upgrade to jQuery.tmpl 1.0.0pre or later.\");var k=b.data(\"precompiled\");\nk||(k=b.text()||\"\",k=v.template(null,\"{{ko_with $item.koBindingContext}}\"+k+\"{{/ko_with}}\"),b.data(\"precompiled\",k));b=[e.$data];e=v.extend({koBindingContext:e},f.templateOptions);e=v.tmpl(k,b,e);e.appendTo(g.createElement(\"div\"));v.fragments={};return e};this.createJavaScriptEvaluatorBlock=function(a){return\"{{ko_code ((function() { return \"+a+\" })()) }}\"};this.addTemplate=function(a,b){u.write(\"<script type='text/html' id='\"+a+\"'>\"+b+\"\\x3c/script>\")};0<a&&(v.tmpl.tag.ko_code={open:\"__.push($1 || '');\"},\nv.tmpl.tag.ko_with={open:\"with($1) {\",close:\"} \"})};a.vb.prototype=new a.O;var b=new a.vb;0<b.$c&&a.Db(b);a.b(\"jqueryTmplTemplateEngine\",a.vb)})()})})();})();\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/index.html",
    "content": "<!DOCTYPE html>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<html>\n<head>\n    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\n    <title>UberFire Showcase</title>\n    <link rel=\"stylesheet\" href=\"org.uberfire.UberfireShowcase/css/uberfire-showcase.css\">\n    <link rel=\"stylesheet\" href=\"org.uberfire.UberfireShowcase/css/uberfire-loading.css\">\n    <link rel=\"stylesheet\" href=\"org.uberfire.UberfireShowcase/css/c3.min.css\">\n</head>\n<body>\n<iframe id=\"__gwt_historyFrame\" style=\"width: 0; height: 0; border: 0\"></iframe>\n\n<!-- loading indicator. the js app hides this once it's loaded. -->\n<div id=\"loading\" class=\"container-fluid\">\n    <div class=\"row\">\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <div class=\"spinner spinner-lg\"></div>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <h3>Please wait</h3>\n            </div>\n        </div>\n        <div class=\"col-lg-12\">\n            <div class=\"center-block text-center\">\n                <span>Loading application...</span>\n            </div>\n        </div>\n    </div>\n</div>\n\n<!-- The GWT js file generated at compile time -->\n<script type=\"text/javascript\" src=\"org.uberfire.UberfireShowcase/org.uberfire.UberfireShowcase.nocache.js\"></script>\n\n<script type=\"text/javascript\" src=\"org.uberfire.UberfireShowcase/js/marked.js\"></script>\n<script type=\"text/javascript\" src=\"org.uberfire.UberfireShowcase/js/d3.min.js\"></script>\n<script type=\"text/javascript\" src=\"org.uberfire.UberfireShowcase/js/c3.min.js\"></script>\n\n<!-- Highlight.js -->\n<link href=\"org.uberfire.UberfireShowcase/highlight/github.min.css\" rel=\"stylesheet\">\n<script src=\"org.uberfire.UberfireShowcase/highlight/highlight.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<!-- diff2html -->\n<link href=\"org.uberfire.UberfireShowcase/diff2html/diff2html.min.css\" rel=\"stylesheet\">\n<script src=\"org.uberfire.UberfireShowcase/diff2html/diff2html.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/diff2html/diff2html-ui.min.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\n<!-- ACE - main .js file -->\n<script src=\"org.uberfire.UberfireShowcase/ace/ace.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<!-- Get .js files for any needed ACE modes and themes -->\n<script src=\"org.uberfire.UberfireShowcase/ace/theme-chrome.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/ace/mode-html.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/ace/mode-css.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/ace/mode-javascript.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/ace/mode-text.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n<script src=\"org.uberfire.UberfireShowcase/ace/mode-xml.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\n<!--  Needed for autocompletion support. -->\n<script src=\"org.uberfire.UberfireShowcase/ace/ext-language_tools.js\" type=\"text/javascript\" charset=\"utf-8\"></script>\n\n\n</body>\n</html>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/login.jsp",
    "content": "<%--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  --%>\n\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<%@page import=\"org.jboss.errai.security.server.FormAuthenticationScheme\"%>\n<html xmlns=\"http://www.w3.org/1999/xhtml\" class=\"login-pf\">\n<head>\n  <title>Login - UberFire Showcase</title>\n  <link rel=\"stylesheet\" href=\"org.uberfire.UberfireShowcase/css/patternfly.min.css\">\n  <link rel=\"stylesheet\" href=\"org.uberfire.UberfireShowcase/css/patternfly-additions.min.css\">\n</head>\n\n<body>\n<span id=\"badge\">\n  <img src=\"org.uberfire.UberfireShowcase/images/uf_logo.png\" alt=\"UberFire Logo\" title=\"Powered By Uberfire\"/>\n</span>\n<div class=\"container\">\n  <div class=\"row\">\n    <div class=\"col-sm-12\">\n      <div id=\"brand\">\n        <img src=\"org.uberfire.UberfireShowcase/images/uf.png\" alt=\"Uberfire UI Framework\">\n      </div>\n    </div>\n    <div class=\"col-sm-7 col-md-6 col-lg-5 login\">\n      <% if (request.getParameter( FormAuthenticationScheme.LOGIN_ERROR_QUERY_PARAM ) != null) { %>\n        <div class=\"alert alert-danger\">\n        <span class=\"pficon-layered\">\n          <span class=\"pficon pficon-error-octagon\"></span>\n          <span class=\"pficon pficon-error-exclamation\"></span>\n        </span>\n          Login failed. Please try again.\n        </div>\n      <% } %>\n      <form class=\"form-horizontal\" role=\"form\" action=\"uf_security_check\" method=\"post\">\n        <div class=\"form-group\">\n          <label for=\"uf_username\" class=\"col-sm-2 col-md-2 control-label\">Username</label>\n          <div class=\"col-sm-10 col-md-10\">\n            <input type=\"text\" class=\"form-control\" id=\"uf_username\" name=\"uf_username\" placeholder=\"admin\" tabindex=\"1\" autofocus>\n          </div>\n        </div>\n        <div class=\"form-group\">\n          <label for=\"uf_password\" class=\"col-sm-2 col-md-2 control-label\">Password</label>\n          <div class=\"col-sm-10 col-md-10\">\n            <input type=\"password\" class=\"form-control\" id=\"uf_password\" name=\"uf_password\" placeholder=\"admin\" tabindex=\"2\">\n          </div>\n        </div>\n        <div class=\"form-group\">\n          <div class=\"col-xs-8 col-sm-offset-2 col-sm-6 col-md-offset-2 col-md-6\">\n            <div class=\"checkbox\">\n              <label>\n                <input id=\"nosplash\" name=\"nosplash\" type=\"checkbox\" tabindex=\"3\"> Deactivate Splash Screen\n              </label>\n            </div>\n          </div>\n          <div class=\"col-xs-4 col-sm-4 col-md-4 submit\">\n            <button type=\"submit\" class=\"btn btn-primary btn-lg\" tabindex=\"4\">Log In</button>\n          </div>\n        </div>\n      </form>\n    </div>\n    <div class=\"col-sm-5 col-md-6 col-lg-7 details\">\n      <p><strong>Welcome to UberFire Showcase!</strong></p>\n    </div>\n  </div>\n</div>\n\n</body>\n</html>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/angular.sample.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<div ng-app=\"my_app\">\n\n    <div class=\"container-fluid\" ng-controller=\"TodoCtrl\">\n        <div class=\"row\">\n            <div class=\"col-md-12\">\n                <p class=\"pull-right\" style=\"margin-top: 10px;\">{{remaining()}} of {{todos.length}} remaining [\n                    <a href=\"\" ng-click=\"archive()\">archive</a> ]\n                </p>\n                <h4>Todos</h4>\n                <ul class=\"list-group\">\n                    <li class=\"list-group-item\" ng-repeat=\"todo in todos\">\n                        <span class=\"done-{{todo.done}}\">{{todo.text}}</span>\n                        <input class=\"pull-right\" type=\"checkbox\" ng-model=\"todo.done\">\n                    </li>\n                </ul>\n            </div>\n        </div>\n        <div class=\"row\">\n            <div class=\"col-md-6\">\n                <form class=\"form-inline\" ng-submit=\"goto()\">\n                    <div class=\"form-group\">\n                        <input type=\"text\" ng-model=\"placeText\" size=\"30\" class=\"form-control\"\n                               placeholder=\"place to go\">\n                        <input class=\"btn btn-primary\" type=\"submit\" value=\"GoTo\">\n                    </div>\n                </form>\n            </div>\n            <div class=\"col-md-6\">\n                <form class=\"form-inline pull-right\" ng-submit=\"addTodo()\">\n                    <div class=\"form-group\">\n                        <input type=\"text\" ng-model=\"todoText\" size=\"30\" class=\"form-control\"\n                               placeholder=\"add new todo here\">\n                        <input class=\"btn btn-primary\" type=\"submit\" value=\"Add\">\n                    </div>\n                </form>\n            </div>\n        </div>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/angular.sample.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n$registerPlugin({\n    id: \"my_angular_js\",\n    type: \"angularjs\",\n    templateUrl: \"angular.sample.html\",\n    title: function () {\n        return \"angular \" + Math.floor(Math.random() * 10);\n    },\n    on_close: function () {\n        alert(\"this is a pure JS alert!\");\n    }\n});\n\n(function(angular) {\n    'use strict';\n    var myApp = angular.module('my_app', []);\n\n    myApp.controller('TodoCtrl', ['$scope', function($scope) {\n        $scope.placeText = \"MiscellaneousFeatures\";\n\n        $scope.todos = [\n            {text: 'learn angular', done: true},\n            {text: 'build an angular app', done: false}\n        ];\n\n        $scope.addTodo = function () {\n            $scope.todos.push({text: $scope.todoText, done: false});\n            $scope.todoText = '';\n        };\n\n        $scope.remaining = function () {\n            var count = 0;\n            angular.forEach($scope.todos, function (todo) {\n                count += todo.done ? 0 : 1;\n            });\n            return count;\n        };\n\n        $scope.archive = function () {\n            var oldTodos = $scope.todos;\n            $scope.todos = [];\n            angular.forEach(oldTodos, function (todo) {\n                if (!todo.done) {\n                    $scope.todos.push(todo);\n                }\n            });\n        };\n\n        $scope[\"goto\"] = function () {\n            $goToPlace($scope.placeText);\n        };\n    }]);\n})(window.angular);"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/dashboard.perspective.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n$registerPerspective({\n    id: \"Dashboard\",\n    roles: [ \"director\", \"manager\" ],\n    panel_type: \"org.uberfire.client.workbench.panels.impl.ClosableSimpleWorkbenchPanelPresenter\",\n    view: {\n        parts: [\n            {\n                place: \"GitHubCommitStats\"\n            }\n        ],\n        panels: [\n            {\n                width: 450,\n                position: \"west\",\n                panel_type: \"org.uberfire.client.workbench.panels.impl.ClosableSimpleWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"GitHubCommitDaysStats\"\n                    }\n                ]\n            },\n            {\n                width: 380,\n                position: \"east\",\n                panel_type: \"org.uberfire.client.workbench.panels.impl.ClosableSimpleWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"TwitterGadget\"\n                    }\n                ]\n            },\n            {\n                width: 570,\n                height: 340,\n                position: \"south\",\n                panel_type: \"org.uberfire.client.workbench.panels.impl.ClosableSimpleWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"GitHubFrequencyStats\"\n                    }\n                ]\n            }\n        ]\n    }\n});\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/editor-sample.js",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n$registerEditor({\n    \"id\": \"sample editor\",\n    \"type\": \"editor\",\n    priority: \"1000\",\n    \"templateUrl\": \"editor.html\",\n    \"resourceType\": \"SampleResourceType\",\n    \"on_concurrent_update\": function () {\n        alert('on_concurrent_update callback')\n        $vfs_readAllString(document.getElementById('filename').innerHTML, function (a) {\n            document.getElementById('editor').value = a;\n        });\n    },\n    \"on_startup\": function (uri) {\n        $vfs_readAllString(uri, function (a) {\n            alert('sample on_startup callback')\n        });\n    },\n    \"on_open\": function (uri) {\n        $vfs_readAllString(uri, function (a) {\n            document.getElementById('editor').value = a;\n        });\n        document.getElementById('filename').innerHTML = uri;\n    }\n});"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/editor.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"sampleEditor\">\n    <p>Sample JS editor (generated by editor-sample.js)</p>\n    <textarea id=\"editor\"></textarea>\n\n    <p>Current file:</p><span id=\"filename\"></span>\n    <button id=\"save\" type=\"button\" onclick=\"$vfs_write(document.getElementById('filename').innerHTML, document.getElementById('editor').value,  function(a) {});\">Save</button>\n    <br>\n\n    <p>This button change the file content, and uberfire send a callback to the editor:</p>\n    <button id=\"reset\" type=\"button\" onclick=\"$vfs_write(document.getElementById('filename').innerHTML, 'Something else',  function(a) {});\">Reset File</button>\n</div>"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/home.perspective.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n$registerPerspective({\n    id: \"Home\",\n    is_default: true,\n    panel_type: \"org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter\",\n    view: {\n        parts: [\n            {\n                place: \"welcome\",\n                parameters: {}\n            }\n        ],\n        panels: [\n            {\n                width: 250,\n                min_width: 200,\n                position: \"west\",\n                panel_type: \"org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"YouTubeVideos\",\n                        parameters: {}\n                    }\n                ]\n            },\n            {\n                position: \"east\",\n                width: 450,\n                panel_type: \"org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"ReadmeScreen\",\n                        parameters: {}\n                    },\n                    {\n                        place: \"TodoListScreen\",\n                        parameters: {}\n                    }\n                ]\n            },\n            {\n                height: 400,\n                position: \"south\",\n                panel_type: \"org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter\",\n                parts: [\n                    {\n                        place: \"SampleWorkbenchEditor\",\n                        parameters: {}\n                    },\n                    {\n                        place: \"YouTubeScreen\",\n                        parameters: {}\n                    }\n                ]\n            }\n        ]\n    }\n});\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/home.splash.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div id=\"myCarousel\" class=\"carousel slide\" data-ride=\"carousel\">\n    <!-- Indicators -->\n    <ol class=\"carousel-indicators\">\n        <li data-target=\"#myCarousel\" data-slide-to=\"0\" class=\"active\"></li>\n        <li data-target=\"#myCarousel\" data-slide-to=\"1\"></li>\n        <li data-target=\"#myCarousel\" data-slide-to=\"2\"></li>\n    </ol>\n    <div class=\"carousel-inner\" role=\"listbox\">\n        <div class=\"item active\">\n            <img src=\"images/bootstrap-mdo-sfmoma-01.jpg\" alt=\"\">\n\n            <div class=\"carousel-caption\">\n                <h4>First Thumbnail label</h4>\n\n                <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>\n            </div>\n        </div>\n        <div class=\"item\">\n            <img src=\"images/bootstrap-mdo-sfmoma-02.jpg\" alt=\"\">\n\n            <div class=\"carousel-caption\">\n                <h4>Second Thumbnail label</h4>\n\n                <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>\n            </div>\n        </div>\n        <div class=\"item\">\n            <img src=\"images/bootstrap-mdo-sfmoma-03.jpg\" alt=\"\">\n\n            <div class=\"carousel-caption\">\n                <h4>Third Thumbnail label</h4>\n\n                <p>Cras justo odio, dapibus ac facilisis in, egestas eget quam. Donec id elit non mi porta gravida at eget metus. Nullam id dolor id nibh ultricies vehicula ut id elit.</p>\n            </div>\n        </div>\n    </div>\n    <!-- Controls -->\n    <a class=\"left carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"prev\">\n        <span class=\"glyphicon glyphicon-chevron-left\" aria-hidden=\"true\"></span>\n        <span class=\"sr-only\">Previous</span>\n    </a>\n    <a class=\"right carousel-control\" href=\"#myCarousel\" role=\"button\" data-slide=\"next\">\n        <span class=\"glyphicon glyphicon-chevron-right\" aria-hidden=\"true\"></span>\n        <span class=\"sr-only\">Next</span>\n    </a>\n</div>\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/sample_resource_type.js",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n$registerResourceType({\n    id: \"SampleResourceType\",\n    short_name: \"Sample Resource Type\",\n    description: \"Sample Description\",\n    prefix: \"\",\n    suffix: \"sample\",\n    priority: \"1000\",\n    simple_wildcard_pattern: \"*.sample\",\n    \"accept\": function (filename) {\n        var extension = filename.split('.').pop();\n        if (extension === \"sample\") {\n            return true;\n        }\n        return false;\n    }\n});\n"
  },
  {
    "path": "uberfire-showcase/uberfire-webapp/src/main/webapp/plugins/splash.sample.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n$registerSplashScreen({\n    id: \"home.splash\",\n    templateUrl: \"home.splash.html\",\n    body_height: 342,\n    title: function () {\n        return \"Cool Home Splash \" + Math.floor(Math.random() * 10);\n    },\n    on_close: function () {\n        console.log(\"this is a close Splash alert!\");\n    },\n    display_next_time: true,\n    interception_points: [\"Home\"]\n});\n"
  },
  {
    "path": "uberfire-ssh/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-parent</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-ssh</artifactId>\n  <name>UberFire - SSH</name>\n\n  <packaging>pom</packaging>\n  <modules>\n    <module>uberfire-ssh-api</module>\n    <module>uberfire-ssh-backend</module>\n    <module>uberfire-ssh-client</module>\n  </modules>\n\n\n</project>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-ssh</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-ssh-api</artifactId>\n  <name>UberFire - SSH API</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.apache.sshd</groupId>\n      <artifactId>sshd-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/auth/SSHKeyAuthenticator.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.auth;\n\nimport java.security.PublicKey;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\n\n/**\n * Service that authenticates platform users based on a {@link PublicKey}\n */\npublic interface SSHKeyAuthenticator {\n\n    /**\n     * Authenticates the given user and {@link PublicKey}\n     * @param userName The login of the user\n     * @param key The {@link PublicKey} for the given user\n     * @return A {@link User} instance if the userName exists on the platform and has a matching key registered on the\n     * current {@link SSHKeyStore}. Null if the user doesn't exist or the key isn't valid.\n     */\n    User authenticate(String userName, PublicKey key);\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/keystore/SSHKeyStore.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore;\n\nimport java.util.Collection;\n\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\n\n/**\n * API to administrate user {@link SSHPublicKey}\n */\npublic interface SSHKeyStore {\n\n    /**\n     * Registers a {@link SSHPublicKey} to a given platform user\n     * @param userName The user's login\n     * @param key The {@link SSHPublicKey} to register\n     */\n    void addUserKey(String userName, SSHPublicKey key);\n\n    /**\n     * Unregisters a {@link SSHPublicKey} for a given user\n     * @param userName The user's login\n     * @param key The {@link SSHPublicKey} to unregister\n     */\n    void removeUserKey(String userName, SSHPublicKey key);\n\n    /**\n     * Updates the a platform user {@link SSHPublicKey}\n     * @param userName The user's login\n     * @param key The {@link SSHPublicKey} to update\n     */\n    void updateUserKey(String userName, SSHPublicKey key);\n\n    /**\n     * Lists all the {@link SSHPublicKey} for a given platform user\n     * @param userName The user's login\n     * @return A Collection containing all the user's {@link SSHPublicKey}\n     */\n    Collection<SSHPublicKey> getUserKeys(String userName);\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/keystore/SSHKeyStoreService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore;\n\n/**\n * Entry point API to access the {@link SSHKeyStore}\n */\npublic interface SSHKeyStoreService {\n\n    /**\n     * Environment variable to load a custom {@link SSHKeyStore} on the system. It should be a valid className\n     * extending {@link SSHKeyStore} (e.g. -Dappformer.ssh.keystore=my.example.MySSHKeyStore.\n     * If the variable doesn't exist the default implementation of the {@link SSHKeyStore} will be loaded.\n     */\n    String SSH_KEY_STORE_PARAM = \"appformer.ssh.keystore\";\n\n    /**\n     * Returns the current instance of the {@link SSHKeyStore}\n     * @return\n     */\n    SSHKeyStore keyStore();\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/keystore/model/KeyMetaData.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.model;\n\nimport java.util.Date;\n\n/**\n * Metadata for a {@link SSHPublicKey}\n */\npublic class KeyMetaData {\n\n    private String name;\n    private Date creationDate;\n    private Date lastTimeUsed;\n\n    public KeyMetaData() {\n        this.name = \"\";\n        this.creationDate = new Date();\n    }\n\n    public KeyMetaData(String name, Date creationDate) {\n        this.name = name;\n        this.creationDate = creationDate;\n    }\n\n    /**\n     * Gets the key name\n     */\n    public String getName() {\n        return name;\n    }\n\n    /**\n     * Gets the creation date of the {@link SSHPublicKey}\n     */\n    public Date getCreationDate() {\n        return creationDate;\n    }\n\n    /**\n     * Gets the last {@link Date} the {@link SSHPublicKey} was used\n     */\n    public Date getLastTimeUsed() {\n        return lastTimeUsed;\n    }\n\n    /**\n     * Sets the last {@link Date} the {@link SSHPublicKey} was used\n     */\n    public void setLastTimeUsed(Date lastTimeUsed) {\n        this.lastTimeUsed = lastTimeUsed;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/keystore/model/SSHPublicKey.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.model;\n\nimport java.security.PublicKey;\n\n/**\n * Definition of a Public SSH key for a platform user\n */\npublic class SSHPublicKey {\n\n    private String id;\n    private KeyMetaData metaData;\n    private PublicKey key;\n\n    public SSHPublicKey(String id, PublicKey key) {\n        this.id = id;\n        this.key = key;\n        this.metaData = new KeyMetaData();\n    }\n\n    public SSHPublicKey(String id, PublicKey key, KeyMetaData metaData) {\n        this.id = id;\n        this.key = key;\n        this.metaData = metaData;\n    }\n\n    /**\n     * Gets the logic id of the {@link SSHPublicKey}\n     */\n    public String getId() {\n        return id;\n    }\n\n    /**\n     * Gets the real {@link PublicKey}\n     */\n    public PublicKey getKey() {\n        return key;\n    }\n\n    /**\n     * Gets the {@link KeyMetaData} of the {@link SSHPublicKey}\n     */\n    public KeyMetaData getMetaData() {\n        return metaData;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/backend/keystore/util/PublicKeyConverter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.util;\n\nimport java.security.PublicKey;\n\nimport org.apache.sshd.common.config.keys.AuthorizedKeyEntry;\nimport org.apache.sshd.common.config.keys.PublicKeyEntryResolver;\n\npublic class PublicKeyConverter {\n\n    public static PublicKey fromString(final String keyStr) throws Exception {\n        // sending null after updating to SSHD2.4\n        return AuthorizedKeyEntry.parseAuthorizedKeyEntry(keyStr).resolvePublicKey(null, PublicKeyEntryResolver.IGNORING);\n    }\n\n    public static String fromPublicKey(PublicKey publicKey) {\n        return AuthorizedKeyEntry.toString(publicKey);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/shared/editor/PortableSSHPublicKey.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.shared.editor;\n\nimport java.util.Date;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class PortableSSHPublicKey {\n\n    private String id;\n    private String name;\n    private String keyContent;\n    private Date creationDate;\n    private Date lastTimeUsed;\n\n    public PortableSSHPublicKey(@MapsTo(\"id\") String id, @MapsTo(\"name\") String name, @MapsTo(\"keyContent\") String keyContent, @MapsTo(\"creationDate\") Date creationDate, @MapsTo(\"lastTimeUsed\") Date lastTimeUsed) {\n        this.id = id;\n        this.name = name;\n        this.keyContent = keyContent;\n        this.creationDate = creationDate;\n        this.lastTimeUsed = lastTimeUsed;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getKeyContent() {\n        return keyContent;\n    }\n\n    public Date getCreationDate() {\n        return creationDate;\n    }\n\n    public Date getLastTimeUsed() {\n        return lastTimeUsed;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/java/org/uberfire/ssh/service/shared/editor/SSHKeyEditorService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.shared.editor;\n\nimport java.security.PublicKey;\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\n\n/**\n * Remote service for the Key service\n */\n@Remote\npublic interface SSHKeyEditorService {\n\n    /**\n     * Retrieves all the {@link PortableSSHPublicKey} for the current user.\n     * @return A Collection containing the current user's keys\n     */\n    Collection<PortableSSHPublicKey> getUserKeys();\n\n    /**\n     * Deletes the given {@link PortableSSHPublicKey} for the current user\n     * @param key The {@link PortableSSHPublicKey} to add\n     */\n    void deleteKey(PortableSSHPublicKey key);\n\n    /**\n     * Adds a new SSh Key into the {@link SSHKeyStore} for the current user.\n     * @param name The name of the key\n     * @param keyContent The {@link PublicKey} as String format.\n     */\n    void addKey(String name, String keyContent);\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/resources/org/uberfire/ssh/UberfireSSHAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~     http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.ssh.service.UberfireSSHSharedServiceAPI\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-api/src/main/resources/org/uberfire/ssh/service/UberfireSSHSharedServiceAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n\n  <source path=\"shared\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-ssh</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-ssh-backend</artifactId>\n  <name>UberFire - SSH Backend</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.code.gson</groupId>\n      <artifactId>gson</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.sshd</groupId>\n      <artifactId>sshd-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n    </dependency>\n\n    <!-- test -->\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/auth/impl/SSHKeyAuthenticatorImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.auth.impl;\n\nimport java.security.PublicKey;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.apache.sshd.common.config.keys.KeyUtils;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.security.WorkbenchUserManager;\nimport org.uberfire.ssh.service.backend.auth.SSHKeyAuthenticator;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStoreService;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\n\n@ApplicationScoped\npublic class SSHKeyAuthenticatorImpl implements SSHKeyAuthenticator {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(SSHKeyAuthenticatorImpl.class);\n\n    private final SSHKeyStoreService keyStoreService;\n    private final WorkbenchUserManager userManager;\n\n    @Inject\n    public SSHKeyAuthenticatorImpl(final SSHKeyStoreService keyStoreService, final Instance<WorkbenchUserManager> workbenchUserManagerInstance) {\n        this.keyStoreService = keyStoreService;\n\n        if (!workbenchUserManagerInstance.isUnsatisfied() && !workbenchUserManagerInstance.isAmbiguous()) {\n            this.userManager = workbenchUserManagerInstance.get();\n        } else {\n            LOGGER.warn(\"Cannot find any implementation of 'WorkbenchUserManager'. Loading default implementation on SSH module\");\n            this.userManager = this::getUser;\n        }\n    }\n\n    @Override\n    public User authenticate(final String userName, final PublicKey key) {\n\n        final Optional<User> userOptional = Optional.ofNullable(userManager.getUser(userName));\n\n        if (userOptional.isPresent()) {\n            List<SSHPublicKey> keys = new ArrayList<>(keyStoreService.keyStore().getUserKeys(userName));\n\n            PublicKey resultKey = KeyUtils.findMatchingKey(key, keys.stream().map(SSHPublicKey::getKey).collect(Collectors.toList()));\n\n            if (resultKey != null) {\n                keys.stream()\n                        .filter(userKey -> userKey.getKey().equals(resultKey))\n                        .findAny()\n                        .ifPresent(userKey -> updateUserKey(userName, userKey));\n\n                return userOptional.get();\n            }\n        }\n\n        return null;\n    }\n\n    private void updateUserKey(final String userName, final SSHPublicKey userKey) {\n        userKey.getMetaData().setLastTimeUsed(new Date());\n\n        keyStoreService.keyStore().updateUserKey(userName, userKey);\n    }\n\n    private User getUser(String identifier) {\n        return new SSHUser(identifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/auth/impl/SSHUser.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.auth.impl;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\n\n@Portable\npublic class SSHUser implements User {\n\n    private String name;\n    private final Map<String, String> properties = new HashMap<String, String>();\n\n    public SSHUser(String name) {\n        this.name = name;\n    }\n\n    public SSHUser(@MapsTo(\"name\") String name, @MapsTo(\"properties\") Map<String, String> properties) {\n        this.name = name;\n        this.properties.putAll(properties);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return name;\n    }\n\n    @Override\n    public Set<Role> getRoles() {\n        return Collections.emptySet();\n    }\n\n    @Override\n    public Set<Group> getGroups() {\n        return Collections.emptySet();\n    }\n\n    @Override\n    public Map<String, String> getProperties() {\n        return properties;\n    }\n\n    @Override\n    public void setProperty(String name, String value) {\n        properties.put(name, value);\n    }\n\n    @Override\n    public void removeProperty(String name) {\n        properties.remove(name);\n    }\n\n    @Override\n    public String getProperty(String name) {\n        return properties.get(name);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/editor/SSHKeyEditorServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.editor;\n\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.UUID;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStoreService;\nimport org.uberfire.ssh.service.backend.keystore.model.KeyMetaData;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\nimport org.uberfire.ssh.service.backend.keystore.util.PublicKeyConverter;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\nimport org.uberfire.ssh.service.shared.editor.SSHKeyEditorService;\n\n@Service\n@Dependent\npublic class SSHKeyEditorServiceImpl implements SSHKeyEditorService {\n\n    private SessionInfo sessionInfo;\n    private SSHKeyStoreService keyStoreService;\n\n    @Inject\n    public SSHKeyEditorServiceImpl(SessionInfo sessionInfo, SSHKeyStoreService keyStoreService) {\n        this.sessionInfo = sessionInfo;\n        this.keyStoreService = keyStoreService;\n    }\n\n    @Override\n    public Collection<PortableSSHPublicKey> getUserKeys() {\n        return keyStoreService.keyStore().getUserKeys(sessionInfo.getIdentity().getIdentifier()).stream()\n                .map(this::convert)\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public void deleteKey(final PortableSSHPublicKey portableKey) {\n        SSHKeyStore keyStore = keyStoreService.keyStore();\n\n        Collection<SSHPublicKey> keys = keyStore.getUserKeys(sessionInfo.getIdentity().getIdentifier());\n\n        keys.stream()\n                .filter(key -> key.getId().equals(portableKey.getId()))\n                .findAny()\n                .ifPresent(sshPublicKey -> keyStore.removeUserKey(sessionInfo.getIdentity().getIdentifier(), sshPublicKey));\n    }\n\n    @Override\n    public void addKey(String name, String keyContent) {\n        keyStoreService.keyStore().addUserKey(sessionInfo.getIdentity().getIdentifier(), convert(name, keyContent));\n    }\n\n    private SSHPublicKey convert(String name, String keyContent) {\n        try {\n            return new SSHPublicKey(UUID.randomUUID().toString(), PublicKeyConverter.fromString(keyContent), new KeyMetaData(name, new Date()));\n        } catch (Exception e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    private PortableSSHPublicKey convert(SSHPublicKey key) {\n        return new PortableSSHPublicKey(key.getId(), key.getMetaData().getName(), PublicKeyConverter.fromPublicKey(key.getKey()), key.getMetaData().getCreationDate(), key.getMetaData().getLastTimeUsed());\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/keystore/impl/SSHKeyStoreServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl;\n\nimport java.util.Optional;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStoreService;\nimport org.uberfire.ssh.service.backend.keystore.impl.storage.DefaultSSHKeyStore;\n\n@Startup\n@ApplicationScoped\npublic class SSHKeyStoreServiceImpl implements SSHKeyStoreService {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(SSHKeyStoreServiceImpl.class);\n\n    private SSHKeyStore keyStore;\n\n    protected SSHKeyStoreServiceImpl() {\n        // CDI Proxy\n    }\n\n    @Inject\n    public SSHKeyStoreServiceImpl(Instance<SSHKeyStore> keyStores) {\n\n        if (!keyStores.isUnsatisfied()) {\n            try {\n                Class<? extends SSHKeyStore> keystoreClass = getSSHKeyStoreType();\n\n                LOGGER.info(\"Looking up SSHKeyStore {}\", keystoreClass);\n\n                keyStore = keyStores.select(keystoreClass).get();\n            } catch (Exception ex) {\n                LOGGER.error(\"Impossible to lookup any SSHKeyStore named instance: \", ex);\n                loadDefaultKeyStore();\n            }\n        } else {\n            loadDefaultKeyStore();\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private Class<? extends SSHKeyStore> getSSHKeyStoreType() {\n        Optional<String> optional = Optional.ofNullable(System.getProperty(SSH_KEY_STORE_PARAM));\n\n        if (optional.isPresent()) {\n            final String sshKeyStoreType = optional.get();\n            if (!sshKeyStoreType.isEmpty()) {\n                try {\n                    return (Class<? extends SSHKeyStore>) Class.forName(sshKeyStoreType);\n                } catch (ClassNotFoundException e) {\n                    LOGGER.warn(\"Cannot lookup configured SSHKeystore ('{}'), looking up default keystore\", sshKeyStoreType);\n                }\n            }\n        }\n        return DefaultSSHKeyStore.class;\n    }\n\n    private void loadDefaultKeyStore() {\n        LOGGER.debug(\"Loading a default SSHKeyStore.\");\n\n        DefaultSSHKeyStore defaultSSHKeyStore = new DefaultSSHKeyStore();\n        defaultSSHKeyStore.init();\n\n        keyStore = defaultSSHKeyStore;\n    }\n\n    @Override\n    public SSHKeyStore keyStore() {\n        return keyStore;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/keystore/impl/storage/DefaultSSHKeyStore.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl.storage;\n\nimport java.io.File;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Default;\n\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\n\n@Dependent\n@Default\npublic class DefaultSSHKeyStore implements SSHKeyStore {\n\n    public static final String USER_DIR = \"user.dir\";\n\n    public static final String SSH_KEYS_PATH_PARAM = \"appformer.ssh.keys.storage.folder\";\n\n    public static final String SSH_KEYS_FOLDER = \".security/pkeys\";\n\n    private final Map<String, UserSSHKeyStore> userKeyStores = new HashMap<>();\n\n    private final Path sshStoragePath;\n\n    public DefaultSSHKeyStore() {\n\n        String customStorage = System.getProperty(SSH_KEYS_PATH_PARAM, null);\n\n        if (customStorage != null) {\n            sshStoragePath = Paths.get(customStorage);\n        } else {\n            sshStoragePath = Paths.get(System.getProperty(USER_DIR)).resolve(SSH_KEYS_FOLDER);\n        }\n    }\n\n    @PostConstruct\n    public void init() {\n        File keysFolder = sshStoragePath.toFile();\n\n        if (keysFolder.exists()) {\n            Stream.of(keysFolder.list())\n                    .map(this::getUserKeyStore)\n                    .forEach(userSSHKeyStore -> userKeyStores.put(userSSHKeyStore.getUser(), userSSHKeyStore));\n        } else {\n            keysFolder.mkdirs();\n        }\n    }\n\n    public UserSSHKeyStore getUserKeyStore(String userName) {\n        UserSSHKeyStore userStore = userKeyStores.get(userName);\n\n        if (userStore == null) {\n            userStore = new UserSSHKeyStore(userName, sshStoragePath);\n            userKeyStores.put(userName, userStore);\n        }\n\n        return userStore;\n    }\n\n    @Override\n    public void addUserKey(final String userName, final SSHPublicKey key) {\n        getUserKeyStore(userName).addUserKey(key);\n    }\n\n    @Override\n    public void removeUserKey(String userName, SSHPublicKey key) {\n        getUserKeyStore(userName).removeUserKey(key);\n    }\n\n    @Override\n    public void updateUserKey(String userName, SSHPublicKey key) {\n        addUserKey(userName, key);\n    }\n\n    @Override\n    public Collection<SSHPublicKey> getUserKeys(String userName) {\n        return getUserKeyStore(userName).getUserKeys();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/keystore/impl/storage/UserSSHKeyStore.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl.storage;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.charset.Charset;\nimport java.nio.file.Path;\nimport java.security.PublicKey;\nimport java.text.MessageFormat;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.apache.commons.io.FileUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.ssh.service.backend.keystore.impl.util.SerializingUtils;\nimport org.uberfire.ssh.service.backend.keystore.model.KeyMetaData;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\nimport org.uberfire.ssh.service.backend.keystore.util.PublicKeyConverter;\n\npublic class UserSSHKeyStore {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(UserSSHKeyStore.class);\n\n    public static final String DEFAULT_KEY_NAME = \"Key #{0}\";\n    private static final String PUBLIC_KEY_EXTENSION = \".pub\";\n\n    private static final String METADATA_PREFFIX = \".\";\n    private static final String METADATA_EXTENSION = PUBLIC_KEY_EXTENSION + \".meta\";\n\n    private final String user;\n\n    private final Path rootPath;\n\n    private List<SSHPublicKey> keys = new ArrayList<>();\n\n    public UserSSHKeyStore(final String user, final Path rootPath) {\n        this.user = user;\n        this.rootPath = rootPath.resolve(user);\n\n        init();\n    }\n\n    private void init() {\n        File rootFile = rootPath.toFile();\n\n        if (rootFile.exists()) {\n            Stream.of(rootFile.listFiles())\n                    .filter(File::isFile)\n                    .filter(file -> file.getName().endsWith(PUBLIC_KEY_EXTENSION))\n                    .map(this::loadKey)\n                    .filter(Objects::nonNull)\n                    .collect(Collectors.toCollection(() -> keys));\n        } else {\n            rootFile.mkdirs();\n        }\n    }\n\n    public String getUser() {\n        return user;\n    }\n\n    public Collection<SSHPublicKey> getUserKeys() {\n        return keys;\n    }\n\n    public void addUserKey(final SSHPublicKey key) {\n        Optional<SSHPublicKey> optional = getKeyById(key.getId());\n\n        if (optional.isPresent()) {\n            SSHPublicKey oldKey = optional.get();\n            removeUserKey(oldKey);\n        }\n\n        keys.add(key);\n        writeKey(key);\n    }\n\n    public void removeUserKey(final SSHPublicKey oldKey) {\n        Optional<SSHPublicKey> optional = getKeyById(oldKey.getId());\n\n        if (optional.isPresent()) {\n            SSHPublicKey key = optional.get();\n\n            keys.remove(key);\n\n            FileUtils.deleteQuietly(rootPath.resolve(getKeyFileName(oldKey.getId())).toFile());\n            FileUtils.deleteQuietly(rootPath.resolve(getMetadataFileName(oldKey.getId())).toFile());\n        }\n    }\n\n    public Optional<SSHPublicKey> getKeyById(String keyId) {\n        return keys.stream()\n                .filter(userKey -> userKey.getId().equals(keyId))\n                .findAny();\n    }\n\n    private void writeKey(final SSHPublicKey key) {\n        File file = rootPath.resolve(key.getId() + PUBLIC_KEY_EXTENSION).toFile();\n\n        if (file.exists()) {\n            file.delete();\n        }\n\n        try {\n            writeKeyFile(key.getId(), key.getKey());\n            writeMetaData(key.getId(), key.getMetaData());\n        } catch (Exception ex) {\n            LOGGER.warn(\"Cannot create public key for user '{}' on file '{}': \", user, file.getAbsolutePath(), ex);\n        }\n    }\n\n    private void writeKeyFile(String id, PublicKey key) throws IOException {\n        File fileKey = rootPath.resolve(getKeyFileName(id)).toFile();\n\n        if (fileKey.exists()) {\n            fileKey.delete();\n        }\n\n        fileKey.createNewFile();\n\n        FileUtils.write(fileKey, PublicKeyConverter.fromPublicKey(key), Charset.defaultCharset());\n    }\n\n    private SSHPublicKey loadKey(final File keyFile) {\n        try {\n            // Read Public Key\n            final String fileName = keyFile.getName();\n\n            final String id = fileName.substring(0, fileName.lastIndexOf(PUBLIC_KEY_EXTENSION));\n\n            final String keyContent = FileUtils.readFileToString(keyFile, Charset.defaultCharset());\n\n            return new SSHPublicKey(id, PublicKeyConverter.fromString(keyContent), readMetaData(id));\n        } catch (Exception ex) {\n            LOGGER.warn(\"Cannot read public key for user '{}' on file '{}': \", user, keyFile.getAbsolutePath(), ex);\n        }\n        return null;\n    }\n\n    private void writeMetaData(String id, KeyMetaData metaData) throws IOException {\n        File file = rootPath.resolve(getMetadataFileName(id)).toFile();\n\n        if (file.exists()) {\n            file.delete();\n        }\n\n        file.createNewFile();\n\n        FileUtils.write(file, SerializingUtils.readMetaData(metaData), Charset.defaultCharset());\n    }\n\n    private KeyMetaData readMetaData(String id) throws IOException {\n        final File metaDataFile = rootPath.resolve(getMetadataFileName(id)).toFile();\n\n        final KeyMetaData metaData;\n\n        if (!metaDataFile.exists()) {\n            metaDataFile.createNewFile();\n\n            String keyName = MessageFormat.format(DEFAULT_KEY_NAME, id);\n\n            metaData = new KeyMetaData(keyName, new Date());\n\n            writeMetaData(id, metaData);\n        } else {\n            String metaDataContent = FileUtils.readFileToString(metaDataFile, Charset.defaultCharset());\n\n            metaData = SerializingUtils.readMetaData(metaDataContent);\n        }\n\n        return metaData;\n    }\n\n    private String getKeyFileName(String id) {\n        return id + PUBLIC_KEY_EXTENSION;\n    }\n\n    private String getMetadataFileName(String id) {\n        return METADATA_PREFFIX + id + METADATA_EXTENSION;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/java/org/uberfire/ssh/service/backend/keystore/impl/util/SerializingUtils.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl.util;\n\nimport com.google.gson.GsonBuilder;\nimport org.uberfire.ssh.service.backend.keystore.model.KeyMetaData;\n\npublic class SerializingUtils {\n\n    private static final GsonBuilder builder = new GsonBuilder();\n\n    public static String readMetaData(KeyMetaData metaData) {\n        return builder.create().toJson(metaData);\n    }\n\n    public static KeyMetaData readMetaData(String jsonKey) {\n        return builder.create().fromJson(jsonKey, KeyMetaData.class);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/auth/impl/SSHKeyAuthenticatorImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.auth.impl;\n\nimport java.security.PublicKey;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.security.WorkbenchUserManager;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\nimport org.uberfire.ssh.service.backend.keystore.util.PublicKeyConverter;\nimport org.uberfire.ssh.service.backend.test.AbstractSSHKeyStoreServiceImplTest;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.ADMIN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.JOHN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.KATY;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.cleanResourceKeysFolder;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.readSampleSSHKey;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.resetUserDir;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.setupUserDir;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeyAuthenticatorImplTest extends AbstractSSHKeyStoreServiceImplTest {\n\n    private List<String> validUsers;\n\n    @Mock\n    private Instance<WorkbenchUserManager> workbenchUserManagerInstance;\n\n    @Mock\n    private WorkbenchUserManager userManagerService;\n\n    private SSHKeyAuthenticatorImpl authenticator;\n\n    @BeforeClass\n    public static void init() {\n        setupUserDir();\n    }\n\n    @Before\n    public void initTest() {\n        super.initTest();\n\n        initService();\n\n        validUsers = Arrays.asList(KATY, JOHN, ADMIN);\n\n        when(workbenchUserManagerInstance.get()).thenReturn(userManagerService);\n\n        when(userManagerService.getUser(anyString())).thenAnswer((Answer<User>) invocationOnMock -> {\n            String userName = (String) invocationOnMock.getArguments()[0];\n\n            if (validUsers.contains(userName)) {\n                return new UserImpl(userName);\n            }\n            return null;\n        });\n    }\n\n    @Test\n    public void testAuthenticateKaty() throws Exception {\n        testUserWithKeys(KATY, false);\n    }\n\n    @Test\n    public void testAuthenticateKatyWithDependencyIssues() throws Exception {\n        testUserWithKeys(KATY, true);\n    }\n\n    @Test\n    public void testAuthenticateJohn() throws Exception {\n        testUserWithKeys(JOHN, false);\n    }\n\n    @Test\n    public void testAuthenticateJohnWithDependencyIssues() throws Exception {\n        testUserWithKeys(JOHN, true);\n    }\n\n    @Test\n    public void testAuthenticateUserWithoutKeys() throws Exception {\n        authenticator = new SSHKeyAuthenticatorImpl(keyStoreService, workbenchUserManagerInstance);\n\n        PublicKey publicKey = PublicKeyConverter.fromString(readSampleSSHKey());\n\n        Assertions.assertThat(authenticator.authenticate(ADMIN, publicKey))\n                .isNull();\n    }\n\n    @Test\n    public void testAuthenticateNonPlatformUser() throws Exception {\n        authenticator = new SSHKeyAuthenticatorImpl(keyStoreService, workbenchUserManagerInstance);\n\n        PublicKey publicKey = PublicKeyConverter.fromString(readSampleSSHKey());\n\n        Assertions.assertThat(authenticator.authenticate(\"user\", publicKey))\n                .isNull();\n    }\n\n    private void testUserWithKeys(final String userName, final boolean dependencyIssue) throws Exception {\n\n        when(workbenchUserManagerInstance.isUnsatisfied()).thenReturn(dependencyIssue);\n        when(workbenchUserManagerInstance.isAmbiguous()).thenReturn(dependencyIssue);\n\n        authenticator = new SSHKeyAuthenticatorImpl(keyStoreService, workbenchUserManagerInstance);\n\n        verify(workbenchUserManagerInstance, dependencyIssue ? never() : times(1)).get();\n\n        // Authenticate existing user Key\n        SSHPublicKey key = keyStoreService.keyStore().getUserKeys(userName).iterator().next();\n\n        Class expectedUserType = dependencyIssue ? SSHUser.class : UserImpl.class;\n\n        Assertions.assertThat(authenticator.authenticate(userName, key.getKey()))\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"name\", userName)\n                .isInstanceOf(expectedUserType);\n\n        // Authenticate using none existing key\n        PublicKey publicKey = PublicKeyConverter.fromString(readSampleSSHKey());\n\n        Assertions.assertThat(authenticator.authenticate(userName, publicKey))\n                .isNull();\n\n        verify(userManagerService, dependencyIssue ? never() : times(2)).getUser(eq(userName));\n    }\n\n    @AfterClass\n    public static void clean() {\n        cleanResourceKeysFolder();\n        resetUserDir();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/editor/SSHKeyEditorServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.editor;\n\nimport java.io.IOException;\nimport java.util.Collection;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.AfterClass;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.ssh.service.backend.test.AbstractSSHKeyStoreServiceImplTest;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.ADMIN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.JOHN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.KATY;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.KEY_NAME;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.cleanResourceKeysFolder;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.readSampleSSHKey;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.resetUserDir;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.setupUserDir;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeyEditorServiceImplTest extends AbstractSSHKeyStoreServiceImplTest {\n\n    private String userName;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    private SSHKeyEditorServiceImpl service;\n\n    @BeforeClass\n    public static void init() {\n        setupUserDir();\n    }\n\n    @Before\n    public void initTest() {\n        super.initTest();\n\n        initService();\n\n        when(sessionInfo.getIdentity()).thenAnswer((Answer<User>) invocationOnMock -> new UserImpl(userName));\n\n        service = new SSHKeyEditorServiceImpl(sessionInfo, keyStoreService);\n    }\n\n    @Test\n    public void testKatyUser() {\n        userName = KATY;\n\n        Assertions.assertThat(service.getUserKeys())\n                .isNotNull()\n                .hasSize(2);\n    }\n\n    @Test\n    public void testJohnUser() {\n        userName = JOHN;\n\n        Assertions.assertThat(service.getUserKeys())\n                .isNotNull()\n                .hasSize(1);\n    }\n\n    @Test\n    public void testAdmin() throws IOException {\n        userName = ADMIN;\n\n        Assertions.assertThat(service.getUserKeys())\n                .isNotNull()\n                .hasSize(0);\n\n        String keyContent = readSampleSSHKey();\n\n        service.addKey(KEY_NAME, keyContent);\n\n        Collection<PortableSSHPublicKey> keys = service.getUserKeys();\n\n        Assertions.assertThat(keys)\n                .isNotNull()\n                .hasSize(1);\n\n        PortableSSHPublicKey key = keys.iterator().next();\n\n        service.deleteKey(key);\n\n        Assertions.assertThat(service.getUserKeys())\n                .isNotNull()\n                .hasSize(0);\n\n        Assertions.assertThatThrownBy(() -> service.addKey(KEY_NAME, \"wrong content\"))\n                .isNotNull()\n                .isInstanceOf(RuntimeException.class);\n    }\n\n    @AfterClass\n    public static void clean() {\n        cleanResourceKeysFolder();\n        resetUserDir();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/keystore/impl/SSHKeyStoreServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.impl.storage.DefaultSSHKeyStore;\nimport org.uberfire.ssh.service.backend.test.AbstractSSHKeyStoreServiceImplTest;\nimport org.uberfire.ssh.service.backend.test.TestSSHKeyStore;\n\nimport static org.mockito.Mockito.when;\nimport static org.uberfire.ssh.service.backend.keystore.impl.SSHKeyStoreServiceImpl.SSH_KEY_STORE_PARAM;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.ADMIN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.JOHN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.KATY;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.resetUserDir;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.setupUserDir;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeyStoreServiceImplTest extends AbstractSSHKeyStoreServiceImplTest {\n\n    @BeforeClass\n    public static void init() {\n        setupUserDir();\n    }\n\n    @Test\n    public void testLoadDefaultSSHKeyStore() {\n        System.clearProperty(SSH_KEY_STORE_PARAM);\n\n        runTest(DefaultSSHKeyStore.class);\n    }\n\n    @Test\n    public void testLoadDefaultSSHKeyStoreUnsatisfied() {\n        when(keyStoreInstance.isUnsatisfied()).thenReturn(true);\n\n        System.clearProperty(SSH_KEY_STORE_PARAM);\n\n        runTest(DefaultSSHKeyStore.class);\n    }\n\n    @Test\n    public void testCustomSSHKeyStore() {\n        System.setProperty(SSH_KEY_STORE_PARAM, TestSSHKeyStore.class.getName());\n        runTest(TestSSHKeyStore.class);\n    }\n\n    @Test\n    public void testWrongCustomSSHKeyStore() {\n        System.setProperty(SSH_KEY_STORE_PARAM, \"wrong class name\");\n        runTest(DefaultSSHKeyStore.class);\n    }\n\n    private void runTest(Class<? extends SSHKeyStore> expectedKeystore) {\n        initService();\n\n        SSHKeyStore store = keyStoreService.keyStore();\n\n        Assertions.assertThat(store)\n                .isNotNull()\n                .isInstanceOf(expectedKeystore);\n\n        Assertions.assertThat(store.getUserKeys(KATY))\n                .isNotNull()\n                .hasSize(2);\n\n        Assertions.assertThat(store.getUserKeys(JOHN))\n                .isNotNull()\n                .hasSize(1);\n\n        Assertions.assertThat(store.getUserKeys(ADMIN))\n                .isNotNull()\n                .hasSize(0);\n    }\n\n    @AfterClass\n    public static void clean() {\n        resetUserDir();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/keystore/impl/storage/DefaultSSHKeyStoreTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.keystore.impl.storage;\n\nimport java.util.Date;\nimport java.util.Optional;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.ADMIN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.CUSTOM_FOLDER;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.JOHN;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.KATY;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.SAMPLE_ID;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.cleanResourceKeysFolder;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.readSampleSSHPublicKey;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.resetUserDir;\nimport static org.uberfire.ssh.service.backend.test.SSHKeyStoreTestUtils.setupUserDir;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultSSHKeyStoreTest {\n\n    private DefaultSSHKeyStore store;\n\n    @BeforeClass\n    public static void init() {\n        setupUserDir();\n    }\n\n    @Test\n    public void testLoadKeysDefaultFolder() {\n        loadKeys();\n    }\n\n    @Test\n    public void testLoadKeysCustomFolder() {\n        String userDir = System.getProperty(DefaultSSHKeyStore.USER_DIR);\n\n        if (!userDir.endsWith(\"/\")) {\n            userDir += \"/\";\n        }\n\n        System.setProperty(DefaultSSHKeyStore.SSH_KEYS_PATH_PARAM, userDir + CUSTOM_FOLDER);\n\n        loadKeys();\n    }\n\n    @Test\n    public void testHandleUserKeysDefaultFolder() throws Exception {\n        testLoadKeysDefaultFolder();\n        handleUserKeys();\n    }\n\n    @Test\n    public void testHandleUserKeysCustomFolder() throws Exception {\n        testLoadKeysCustomFolder();\n        handleUserKeys();\n    }\n\n    private void handleUserKeys() throws Exception {\n\n        SSHPublicKey key = readSampleSSHPublicKey();\n\n        store.addUserKey(ADMIN, key);\n\n        Assertions.assertThat(store.getUserKeys(ADMIN))\n                .isNotNull()\n                .hasSize(1);\n\n        key = readSampleSSHPublicKey();\n\n        Date date = new Date();\n\n        key.getMetaData().setLastTimeUsed(date);\n\n        store.updateUserKey(ADMIN, key);\n\n        Optional<SSHPublicKey> optional = store.getUserKeyStore(ADMIN).getKeyById(SAMPLE_ID);\n\n        assertTrue(optional.isPresent());\n\n        Assertions.assertThat(optional.get().getMetaData())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"lastTimeUsed\", date);\n\n        store.removeUserKey(ADMIN, key);\n\n        Assertions.assertThat(store.getUserKeys(ADMIN))\n                .isNotNull()\n                .hasSize(0);\n    }\n\n    private void loadKeys() {\n        store = new DefaultSSHKeyStore();\n\n        store.init();\n\n        Assertions.assertThat(store.getUserKeys(KATY))\n                .isNotNull()\n                .hasSize(2);\n\n        Assertions.assertThat(store.getUserKeys(JOHN))\n                .isNotNull()\n                .hasSize(1);\n\n        Assertions.assertThat(store.getUserKeys(ADMIN))\n                .isNotNull()\n                .hasSize(0);\n    }\n\n    @AfterClass\n    public static void clean() {\n        cleanResourceKeysFolder();\n        resetUserDir();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/test/AbstractSSHKeyStoreServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.test;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.junit.Before;\nimport org.mockito.Mock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.ssh.service.backend.keystore.SSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.impl.SSHKeyStoreServiceImpl;\nimport org.uberfire.ssh.service.backend.keystore.impl.storage.DefaultSSHKeyStore;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\npublic class AbstractSSHKeyStoreServiceImplTest {\n\n    @Mock\n    protected Instance<SSHKeyStore> keyStoreInstance;\n\n    protected SSHKeyStoreServiceImpl keyStoreService;\n\n    @Before\n    public void initTest() {\n        when(keyStoreInstance.select(any(Class.class))).then((Answer<Instance>) invocationOnMock -> {\n            Class<SSHKeyStore> type = (Class<SSHKeyStore>) invocationOnMock.getArguments()[0];\n\n            final DefaultSSHKeyStore keyStore;\n\n            if (type.equals(DefaultSSHKeyStore.class)) {\n                keyStore = new DefaultSSHKeyStore();\n            } else {\n                keyStore = new TestSSHKeyStore();\n            }\n\n            keyStore.init();\n\n            Instance<SSHKeyStore> instance = mock(Instance.class);\n\n            when(instance.get()).thenReturn(keyStore);\n\n            return instance;\n        });\n    }\n\n    protected void initService() {\n        keyStoreService = new SSHKeyStoreServiceImpl(keyStoreInstance);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/test/SSHKeyStoreTestUtils.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.test;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.charset.Charset;\nimport java.nio.file.Paths;\n\nimport org.apache.commons.io.FileUtils;\nimport org.apache.commons.io.IOUtils;\nimport org.uberfire.ssh.service.backend.keystore.impl.storage.DefaultSSHKeyStore;\nimport org.uberfire.ssh.service.backend.keystore.impl.util.SerializingUtils;\nimport org.uberfire.ssh.service.backend.keystore.model.KeyMetaData;\nimport org.uberfire.ssh.service.backend.keystore.model.SSHPublicKey;\nimport org.uberfire.ssh.service.backend.keystore.util.PublicKeyConverter;\n\npublic class SSHKeyStoreTestUtils {\n\n    public static final String KEY_NAME = \"key name 1\";\n\n    public static final String SAMPLE_ID = \"1234567890\";\n\n    public static final String KEY_FILE = \"/pkeys/key.txt\";\n    public static final String META_FILE = \"/pkeys/meta.txt\";\n\n    public static final String RESOURCES_FOLDER = \"src/test/resources/\";\n    public static final String CUSTOM_FOLDER = \"custom_security/pkeys\";\n    public static final String DEFAULT_FOLDER = \".security/pkeys\";\n\n    public static final String KATY = \"katy\";\n    public static final String KATY_META1 = KATY + \"/.katy-key-one.pub.meta\";\n    public static final String KATY_META2 = KATY + \"/.katy-key-two.pub.meta\";\n    public static final String JOHN = \"john\";\n    public static final String JOHN_META = JOHN + \"/.john-key.pub.meta\";\n    public static final String ADMIN = \"admin\";\n\n    private static String userDir;\n\n    public static void setupUserDir() {\n        userDir = System.getProperty(DefaultSSHKeyStore.USER_DIR);\n\n        if (!userDir.endsWith(\"/\")) {\n            userDir += \"/\";\n        }\n\n        System.setProperty(DefaultSSHKeyStore.USER_DIR, userDir + RESOURCES_FOLDER);\n    }\n\n    public static void cleanResourceKeysFolder() {\n        String userDir = System.getProperty(DefaultSSHKeyStore.USER_DIR);\n        FileUtils.deleteQuietly(Paths.get(userDir + CUSTOM_FOLDER).resolve(ADMIN).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + DEFAULT_FOLDER).resolve(ADMIN).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + DEFAULT_FOLDER).resolve(KATY_META1).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + CUSTOM_FOLDER).resolve(KATY_META1).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + DEFAULT_FOLDER).resolve(KATY_META2).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + CUSTOM_FOLDER).resolve(KATY_META2).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + DEFAULT_FOLDER).resolve(JOHN_META).toFile());\n        FileUtils.deleteQuietly(Paths.get(userDir + CUSTOM_FOLDER).resolve(JOHN_META).toFile());\n    }\n\n    public static SSHPublicKey readSampleSSHPublicKey() throws Exception {\n        KeyMetaData metaData = SerializingUtils.readMetaData(IOUtils.toString(SSHKeyStoreTestUtils.class.getResource(META_FILE), Charset.defaultCharset()));\n\n        return new SSHPublicKey(SAMPLE_ID, PublicKeyConverter.fromString(readSampleSSHKey()), metaData);\n    }\n\n    public static String readSampleSSHKey() throws IOException {\n        return IOUtils.toString(SSHKeyStoreTestUtils.class.getResource(KEY_FILE), Charset.defaultCharset());\n    }\n\n    public static void resetUserDir() {\n        if (userDir != null) {\n            System.setProperty(DefaultSSHKeyStore.USER_DIR, userDir);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/java/org/uberfire/ssh/service/backend/test/TestSSHKeyStore.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.service.backend.test;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.ssh.service.backend.keystore.impl.storage.DefaultSSHKeyStore;\n\n@Dependent\npublic class TestSSHKeyStore extends DefaultSSHKeyStore {\n\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/john/john-key.pub",
    "content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNsKIMkhaI8iX69IKsux/LdgG3zP1wW5RNJzbopy7BLqZEmqTZMIfaWEisuH5WZquG3tZ//yNrVNd0Jw5RYQ/fwkyVmmJi9Ir2bo5rex4jbkNwcWb8U57UpIt38JCjjKLCkiYSKNXzrJOmtFsMOuHukoGJbSRLDV3VSmQVIbtrysz8CRCCg2bv2KZkTmKa50O4S0UpjEVeyuy/+sDqbKl9Jrhj0i7PFrB1hJhN4+7SnNDAr6OpdZd0EUUa1TNdDISsdetq9vWMnuYBQPlxHxXnJsJhvdIlLXW6ZfZpsjqxe8jfHsJtmFvD032w/B4kBfGZxQXbPoUUBdrGyrKb2FyAypdDxAotA1Rlsq3S6PWBlp7RjpMYWZb02XqNrN6g6AJCh0uuWCK/jxO6S96MYFyJj7rqUgaRg7SEKwR2lhwWTzUxb5bxbNxsA4eUXnvSr0lqCwcjw3M5WQHocGn4VPjKZl7Jhqxu9evwF5siuZEDL4oK8NgPwAZxMYcFuefdPgpxA/wmqWAh6JPbXLstQlG24bTrxCIzsx7qEfhU65KQJaLi3kso4LA/IDmPRHIFGNUbY3YOwfDpmH/fHFQNY/5uy5/0oICAv9M3QBEMvB2rWpWJT8j2CkISCSjzPNnB490uUv9cxNnLs8tDrOHlAnm+k0iXyJ4hjqtXqSbLCLz2Jw=="
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/john/not_a_pkey.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNot a PKEY"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/katy/folder/blank.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/katy/katy-key-one.pub",
    "content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNsKIMkhaI8iX69IKsux/LdgG3zP1wW5RNJzbopy7BLqZEmqTZMIfaWEisuH5WZquG3tZ//yNrVNd0Jw5RYQ/fwkyVmmJi9Ir2bo5rex4jbkNwcWb8U57UpIt38JCjjKLCkiYSKNXzrJOmtFsMOuHukoGJbSRLDV3VSmQVIbtrysz8CRCCg2bv2KZkTmKa50O4S0UpjEVeyuy/+sDqbKl9Jrhj0i7PFrB1hJhN4+7SnNDAr6OpdZd0EUUa1TNdDISsdetq9vWMnuYBQPlxHxXnJsJhvdIlLXW6ZfZpsjqxe8jfHsJtmFvD032w/B4kBfGZxQXbPoUUBdrGyrKb2FyAypdDxAotA1Rlsq3S6PWBlp7RjpMYWZb02XqNrN6g6AJCh0uuWCK/jxO6S96MYFyJj7rqUgaRg7SEKwR2lhwWTzUxb5bxbNxsA4eUXnvSr0lqCwcjw3M5WQHocGn4VPjKZl7Jhqxu9evwF5siuZEDL4oK8NgPwAZxMYcFuefdPgpxA/wmqWAh6JPbXLstQlG24bTrxCIzsx7qEfhU65KQJaLi3kso4LA/IDmPRHIFGNUbY3YOwfDpmH/fHFQNY/5uy5/0oICAv9M3QBEMvB2rWpWJT8j2CkISCSjzPNnB490uUv9cxNnLs8tDrOHlAnm+k0iXyJ4hjqtXqSbLCLz2Jw=="
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/katy/katy-key-two.pub",
    "content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDBgoj/ATGs0BD2Z1cyplAOGo3vyIqHNkJWAEEBp06hiNgg3FaDopr4PGi+lAzef0s0ZBOqu/FaCXPWxUy9+R2wpEcZUlyEok5ghfojY8k8ZQNJ7f+e6gNYHWz0p9NitF1STQ34gbop7oCsgHh5CCFlbDIjrE+I9oZF7XGh0RuB2QIsm9j2s6mmRIIpNaArRUj8WAIenR69DJeYX9glyla4utMZzJpbakRuTsD4k3EZNSIArLQY6j8b6OuzinfMSyGjSHzvnzl4LSRpmLzyrFqDvITbwjRtjvfuO15bMqw+E6muw/ozQGn3FtY6Fbc/6sgMwbZDVpCRr8r9egevsxAIhxnwbzgQFbSIZSkBxSV1oAKX9rJlsFRftxg3wP/6oKDx6vjC4pheE2IJ/RB46MhiilNZHMhZcwkWkL9WZ9OY+474jzglrZc7UBTVyhTwFa3I+VA5Edkb12N5T8m7RnD5A/iIVmP2n2ZGv9Hk9m0PI/IMuvP0xG+BwanjOgObxQ2tpgtOAAbJ3MeYqsCjJIKpEonMR0yJOle4McYo4YGvpeXZ8zXPp8C1FK/d6EO02tMc0iklnjrqeO6NwtbACMe8d1UXPZJHwtu3QDZNfBnVmFUz/Ur4kGImxkye/HGa4S85KhI9Nv6vZcnBySNXOQq5zZ7jTnhrOZQvH5/jGOY4Uw=="
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/katy/not_a_pkey.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nNot a PKEY"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/custom_security/pkeys/katy/wrong_content.pkey",
    "content": "Some wrong content we are not supporting"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/pkeys/key.txt",
    "content": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDmak4Wu23RZ6XmN94bOsqecZxuTa4RRhhQmHmTZjMB7HM57/90u/B/gB/GhsPEu1nAXL0npY56tT/MPQ8vRm2C2W9A7CzN5+z5yyL3W01YZy3kzslk77CjULjfhrcfQSL3b2sPG5jv5E5/nyC/swSytucwT/PE7aXTS9H6cHIKUdYPzIt94SHoBxWRIK7PJi9d+eLB+hmDzvbVa1ezu5a8yu2kcHi6NxxfI5iRj2rsceDTp0imC1jMoC6ZDfBvZSxL9FXTMwFdNnmTlJveBtv9nAbnAvIWlilS0VOkdj1s3GxBxeZYAcKbcsK9sJzusptk5dxGsG2Z8vInaglN6OaOQ7b7tcomzCYYwviGQ9gRX8sGsVrw39gsDIGYP2tA4bRr7ecHnlNg1b0HCchA5+QCDk4Hbz1UrnHmPA2Lg9c3WGm2qedvQdVJXuS3mlwYOqL40aXPs6890PvFJUlpiVSznF50djPnwsMxJZEf1HdTXgZD1Bh54ogZf7czyUNfkNkE69yJDbTHjpQd0cKUQnu9tVxqmBzhX31yF4VcsMeADcf2Z8wlA3n4LZnC/GwonYlq5+G93zJpFOkPhme8c2XuPuCXF795lsxyJ8SB/AlwPJAhEtm0y0s0l1l4eWqxsDxkBOgN+ivU0czrVMssHJEJb4o0FLf7iHhOW56/iMdD9w== appformer"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-backend/src/test/resources/pkeys/meta.txt",
    "content": "{\"name\":\"Key one\",\"creationDate\":\"Jul 19, 2018 6:09:51 PM\"}"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <artifactId>uberfire-ssh</artifactId>\n    <groupId>org.uberfire</groupId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-ssh-client</artifactId>\n  <name>UberFire - SSH Client</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-ssh-api</artifactId>\n    </dependency>\n\n    <!-- Test -->\n    <dependency>\n      <groupId>org.assertj</groupId>\n      <artifactId>assertj-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/SSHClientEntryPoint.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\n\n@EntryPoint\n@Bundle(\"resources/i18n/AppformerSSHConstants.properties\")\npublic class SSHClientEntryPoint {\n\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/SSHKeysEditorPerspective.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@ApplicationScoped\n@WorkbenchPerspective(identifier = SSHKeysEditorPerspective.IDENTIFIER)\npublic class SSHKeysEditorPerspective {\n\n    public static final String IDENTIFIER = \"SSHKeysEditorPerspective\";\n\n    @Perspective\n    public PerspectiveDefinition buildPerspective() {\n        PerspectiveDefinition perspective = new PerspectiveDefinitionImpl(StaticWorkbenchPanelPresenter.class.getName());\n        perspective.setName(\"SSH Keys Editor\");\n        perspective.getRoot().addPart(new PartDefinitionImpl(new DefaultPlaceRequest(SSHKeysEditorScreen.SCREEN_ID)));\n        return perspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/SSHKeysEditorScreen.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.ssh.client.editor.component.SSHKeysEditor;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\n\n@ApplicationScoped\n@WorkbenchScreen(identifier = SSHKeysEditorScreen.SCREEN_ID)\npublic class SSHKeysEditorScreen {\n\n    public static final String SCREEN_ID = \"SSHKeysEditorScreen\";\n\n    private SSHKeysEditor editor;\n    private TranslationService translationService;\n\n    @Inject\n    public SSHKeysEditorScreen(SSHKeysEditor editor, TranslationService translationService) {\n        this.editor = editor;\n        this.translationService = translationService;\n    }\n\n    @OnOpen\n    public void onOpen() {\n        editor.load();\n    }\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return editor;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return translationService.getTranslation(AppformerSSHConstants.SSHKeysEditorScreenTitle);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/SSHKeysEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.Predicate;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.uberfire.ssh.client.editor.component.creation.NewSSHKeyModal;\nimport org.uberfire.ssh.client.editor.component.creation.NewSSHKeyModalHandler;\nimport org.uberfire.ssh.client.editor.component.empty.SSHKeysEditorEmptyStateDisplayer;\nimport org.uberfire.ssh.client.editor.component.keys.SSHKeysDisplayer;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\nimport org.uberfire.ssh.service.shared.editor.SSHKeyEditorService;\n\n@Dependent\npublic class SSHKeysEditor implements SSHKeysEditorView.Presenter,\n                                      NewSSHKeyModalHandler,\n                                      IsElement {\n\n    private final SSHKeysEditorView view;\n    private final SSHKeysDisplayer keysDisplayer;\n    private final SSHKeysEditorEmptyStateDisplayer emptyStateDisplayer;\n    private final NewSSHKeyModal newSSHKeyModal;\n    private final Caller<SSHKeyEditorService> serviceCaller;\n\n    private List<PortableSSHPublicKey> currentKeys = new ArrayList<>();\n\n    @Inject\n    public SSHKeysEditor(final SSHKeysEditorView view, final SSHKeysDisplayer keysDisplayer, final SSHKeysEditorEmptyStateDisplayer emptyStateDisplayer, final NewSSHKeyModal newSSHKeyModal, final Caller<SSHKeyEditorService> serviceCaller) {\n        this.view = view;\n        this.keysDisplayer = keysDisplayer;\n        this.emptyStateDisplayer = emptyStateDisplayer;\n        this.newSSHKeyModal = newSSHKeyModal;\n        this.serviceCaller = serviceCaller;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n        keysDisplayer.init(this::showNewKeyModal, this::delete);\n        emptyStateDisplayer.init(this::showNewKeyModal);\n        newSSHKeyModal.init(this);\n    }\n\n    public void load() {\n        serviceCaller.call((RemoteCallback<Collection<PortableSSHPublicKey>>) this::loadKeys).getUserKeys();\n    }\n\n    private void loadKeys(Collection<PortableSSHPublicKey> keys) {\n        clear();\n        if (keys.isEmpty()) {\n            view.show(emptyStateDisplayer.getElement());\n        } else {\n            currentKeys.addAll(keys);\n            keysDisplayer.render(keys);\n            view.show(keysDisplayer.getElement());\n        }\n    }\n\n    protected void delete(final PortableSSHPublicKey key) {\n        serviceCaller.call((RemoteCallback<Void>) response -> load()).deleteKey(key);\n    }\n\n    protected void showNewKeyModal() {\n        newSSHKeyModal.show();\n    }\n\n    @Override\n    public boolean existsKeyName(final String name) {\n        return findKey(key -> key.getName().equals(name));\n    }\n\n    @Override\n    public boolean existsKey(final String keyContent) {\n        return findKey(key -> key.getKeyContent().equals(keyContent));\n    }\n\n    private boolean findKey(final Predicate<PortableSSHPublicKey> predicate) {\n        return currentKeys.stream().anyMatch(predicate);\n    }\n\n    public void onAddKey() {\n        newSSHKeyModal.hide();\n        load();\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @PreDestroy\n    public void clear() {\n        view.clear();\n        currentKeys.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/SSHKeysEditorView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component;\n\nimport elemental2.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface SSHKeysEditorView extends UberElemental<SSHKeysEditorView.Presenter> {\n\n    void clear();\n\n    void show(HTMLElement editor);\n\n    interface Presenter {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/SSHKeysEditorViewImpl.css",
    "content": ".appformer_ssh_keys_editor_container {\n    background-color: #f5f5f5;\n    width: 100%;\n    min-height: 100%;\n}"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/SSHKeysEditorViewImpl.html",
    "content": "<div class=\"appformer_ssh_keys_editor_container\">\n    <div class=\"container\">\n        <div data-field=\"content\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/SSHKeysEditorViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component;\n\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SSHKeysEditorViewImpl implements SSHKeysEditorView,\n                                              IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLDivElement content;\n\n    @Inject\n    private Elemental2DomUtil util;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        util.removeAllElementChildren(content);\n    }\n\n    @Override\n    public void show(HTMLElement element) {\n\n        content.appendChild(element);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModal.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.creation;\n\nimport java.util.Optional;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\nimport org.uberfire.ssh.service.shared.editor.SSHKeyEditorService;\n\n@Dependent\npublic class NewSSHKeyModal implements NewSSHKeyModalView.Presenter {\n\n    private static final String[] SUPPORTED_FORMATS = new String[]{\"ssh-rsa\", \"ssh-dss\", \"ecdsa-sha2-nistp256\", \"ecdsa-sha2-nistp384\", \"ecdsa-sha2-nistp521\"};\n\n    private final NewSSHKeyModalView view;\n    private final Caller<SSHKeyEditorService> serviceCaller;\n    private final TranslationService translationService;\n\n    private NewSSHKeyModalHandler handler;\n\n    @Inject\n    public NewSSHKeyModal(final NewSSHKeyModalView view, final Caller<SSHKeyEditorService> serviceCaller, final TranslationService translationService) {\n        this.view = view;\n        this.serviceCaller = serviceCaller;\n        this.translationService = translationService;\n\n        view.init(this);\n    }\n\n    public void init(NewSSHKeyModalHandler handler) {\n        PortablePreconditions.checkNotNull(\"handler\", handler);\n\n        this.handler = handler;\n    }\n\n    public void show() {\n        view.show();\n    }\n\n    @Override\n    public void notifyCancel() {\n        view.hide();\n    }\n\n    @Override\n    public void notifyAdd(String name, String key) {\n\n        view.resetValidation();\n\n        boolean nameValid = validateName(name);\n\n        boolean keyValid = validateKey(key);\n\n        if (nameValid && keyValid) {\n            serviceCaller.call((RemoteCallback<Void>) response -> {\n                handler.onAddKey();\n            }, (ErrorCallback<Message>) (message, throwable) -> {\n                view.setKeyValidationError(translationService.getTranslation(AppformerSSHConstants.ValidationKeyFormatError));\n                return false;\n            }).addKey(name, key);\n        }\n    }\n\n    private boolean validateKey(final String keyContent) {\n        Optional<String> optional = Optional.ofNullable(validateEmptyString(keyContent, AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n\n        if (optional.isPresent()) {\n            view.setKeyValidationError(optional.get());\n            return false;\n        }\n\n        Optional<String> encoding = Stream.of(SUPPORTED_FORMATS).filter(keyContent::startsWith)\n                .findAny();\n\n        if (!encoding.isPresent()) {\n            view.setKeyValidationError(translationService.getTranslation(AppformerSSHConstants.ValidationKeyFormatError));\n            return false;\n        }\n\n        if(handler.existsKey(keyContent)) {\n            view.setKeyValidationError(translationService.getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists));\n            return false;\n        }\n\n        return true;\n    }\n\n    private boolean validateName(String name) {\n        Optional<String> optional = Optional.ofNullable(validateEmptyString(name, AppformerSSHConstants.NewSSHKeyModalViewImplName));\n\n        if (optional.isPresent()) {\n            view.setNameValidationError(optional.get());\n            return false;\n        }\n\n        if(handler.existsKeyName(name)) {\n            view.setNameValidationError(translationService.format(AppformerSSHConstants.ValidationKeyNameAlreadyExists, name));\n            return false;\n        }\n        return true;\n    }\n\n    private String validateEmptyString(String str, String fieldNameKey) {\n        if (str == null || str.isEmpty()) {\n            String fieldName = translationService.getTranslation(fieldNameKey);\n\n            return translationService.format(AppformerSSHConstants.ValidationCannotBeEmpty, fieldName);\n        }\n        return null;\n    }\n\n    public void hide() {\n        view.hide();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.creation;\n\npublic interface NewSSHKeyModalHandler {\n\n    boolean existsKeyName(String name);\n\n    boolean existsKey(String key);\n\n    void onAddKey();\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.creation;\n\npublic interface NewSSHKeyModalView {\n\n    void init(Presenter presenter);\n\n    void show();\n\n    void hide();\n\n    void resetValidation();\n\n    void setNameValidationError(String errorMessage);\n\n    void setKeyValidationError(String errorMessage);\n\n    interface Presenter {\n\n        void notifyCancel();\n\n        void notifyAdd(String name, String key);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalViewImpl.css",
    "content": ".appformer_ssh_new_key_required {\n    font-size: 6px;\n    padding-left: 2px;\n    padding-right: 5px;\n    color: rgb(185, 74, 72);\n}"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalViewImpl.html",
    "content": "<div data-field=\"content\">\n    <div class=\"alert alert-danger\" data-field=\"validation\">\n        <span class=\"pficon pficon-error-circle-o\"></span>\n        <div data-i18n-key=\"validationError\"></div>\n    </div>\n    <div class=\"form-group\" data-field=\"nameGroup\">\n        <label for=\"sshKeyNameInput\"><span data-i18n-key=\"name\"></span><sup><i class=\"fa fa-star appformer_ssh_new_key_required\"></i></sup></label>\n        <input type=\"text\" class=\"form-control\" id=\"sshKeyNameInput\" data-field=\"name\">\n        <span data-field=\"nameHelpBlock\" class=\"help-block\"></span>\n    </div>\n    <div class=\"form-group\" data-field=\"keyGroup\">\n        <label for=\"sshKeyText\"><span data-i18n-key=\"key\"></span><sup><i class=\"fa fa-star appformer_ssh_new_key_required\"></i></sup></label>\n        <textarea class=\"form-control\" id=\"sshKeyText\" data-field=\"key\" rows=\"6\"></textarea>\n        <span data-field=\"keyHelpBlock\" class=\"help-block\"></span>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.creation;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLInputElement;\nimport elemental2.dom.HTMLTextAreaElement;\nimport org.gwtbootstrap3.client.ui.ModalSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.footers.ModalFooterYesNoCancelButtons;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\n\n@Templated\npublic class NewSSHKeyModalViewImpl extends BaseModal implements NewSSHKeyModalView {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLDivElement validation;\n\n    @Inject\n    @DataField\n    private HTMLDivElement content;\n\n    @Inject\n    @DataField\n    private HTMLDivElement nameGroup;\n\n    @Inject\n    @DataField\n    private HTMLInputElement name;\n\n    @Inject\n    @Named(\"span\")\n    @DataField\n    private HTMLElement nameHelpBlock;\n\n    @Inject\n    @DataField\n    private HTMLDivElement keyGroup;\n\n    @Inject\n    @DataField\n    private HTMLTextAreaElement key;\n\n    @Inject\n    @Named(\"span\")\n    @DataField\n    private HTMLElement keyHelpBlock;\n\n    @Inject\n    private Elemental2DomUtil elemental2DomUtil;\n\n    @Inject\n    private TranslationService translationService;\n\n    @PostConstruct\n    private void init() {\n        this.setSize(ModalSize.MEDIUM);\n        this.setTitle(translationService.getTranslation(AppformerSSHConstants.SSHKeysDisplayerViewImplAdd));\n        this.setBody(ElementWrapperWidget.getWidget(content));\n\n        this.add(new ModalFooterYesNoCancelButtons(this, null, null, null, null,\n                                                   this::cancel,\n                                                   translationService.getTranslation(AppformerSSHConstants.SSHKeyEditorViewImplCancel),\n                                                   ButtonType.DEFAULT,\n                                                   null,\n                                                   this::add,\n                                                   translationService.getTranslation(AppformerSSHConstants.SSHKeysDisplayerViewImplAdd),\n                                                   ButtonType.PRIMARY,\n                                                   null) {\n            {\n                setCloseModalAfterAction(false);\n            }\n        });\n\n        name.setAttribute(\"placeHolder\", translationService.getTranslation(AppformerSSHConstants.NewSSHKeyModalViewImplNamePlaceHolder));\n        key.setAttribute(\"placeHolder\", translationService.getTranslation(AppformerSSHConstants.NewSSHKeyModalViewImplKeyPlaceHolder));\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void show() {\n        reset();\n\n        super.show();\n    }\n\n    @Override\n    public void resetValidation() {\n        validation.hidden = true;\n        org.jboss.errai.common.client.dom.HTMLElement groupElement = elemental2DomUtil.asHTMLElement(nameGroup);\n        DOMUtil.removeEnumStyleName(groupElement, ValidationState.ERROR);\n        nameHelpBlock.textContent = \"\";\n\n        org.jboss.errai.common.client.dom.HTMLElement keyElement = elemental2DomUtil.asHTMLElement(keyGroup);\n        DOMUtil.removeEnumStyleName(keyElement, ValidationState.ERROR);\n        keyHelpBlock.textContent = \"\";\n    }\n\n    @Override\n    public void setNameValidationError(String errorMessage) {\n        setValidationError(nameGroup, nameHelpBlock, errorMessage);\n    }\n\n    @Override\n    public void setKeyValidationError(String errorMessage) {\n        setValidationError(keyGroup, keyHelpBlock, errorMessage);\n    }\n\n    private void setValidationError(HTMLDivElement groupElement, HTMLElement helpBlock, String errorMessage) {\n        validation.hidden = false;\n        org.jboss.errai.common.client.dom.HTMLElement erraiGroupElement = elemental2DomUtil.asHTMLElement(groupElement);\n        DOMUtil.addEnumStyleName(erraiGroupElement, ValidationState.ERROR);\n        helpBlock.textContent = errorMessage;\n    }\n\n    private void cancel() {\n        presenter.notifyCancel();\n    }\n\n    private void add() {\n        presenter.notifyAdd(name.value, key.value);\n    }\n\n    public void reset() {\n        resetValidation();\n        name.value = \"\";\n        key.value = \"\";\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.empty;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class SSHKeysEditorEmptyStateDisplayer implements SSHKeysEditorEmptyStateDisplayerView.Presenter,\n                                                         IsElement {\n\n    private final SSHKeysEditorEmptyStateDisplayerView view;\n\n    private Command addCommand;\n\n    @Inject\n    public SSHKeysEditorEmptyStateDisplayer(final SSHKeysEditorEmptyStateDisplayerView view) {\n        this.view = view;\n        view.init(this);\n    }\n\n    public void init(Command addCommand) {\n\n        PortablePreconditions.checkNotNull(\"addCommand\", addCommand);\n\n        this.addCommand = addCommand;\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public void notifyAdd() {\n        if (addCommand != null) {\n            addCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayerView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.empty;\n\nimport org.uberfire.client.mvp.UberElemental;\n\npublic interface SSHKeysEditorEmptyStateDisplayerView extends UberElemental<SSHKeysEditorEmptyStateDisplayerView.Presenter> {\n\n    interface Presenter {\n\n        void notifyAdd();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayerViewImpl.css",
    "content": ".appformer_ssh_keys_empty_state {\n    border: none !important;\n}"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayerViewImpl.html",
    "content": "<div class=\"blank-slate-pf appformer_ssh_keys_empty_state\">\n    <div class=\"blank-slate-pf-icon\">\n        <span class=\"fa fa-key\"></span>\n    </div>\n    <h1 data-i18n-key=\"title\"></h1>\n    <p data-i18n-key=\"description\"></p>\n    <div class=\"blank-slate-pf-main-action\">\n        <button class=\"btn btn-primary btn-lg\" data-field=\"add\" data-i18n-key=\"add\"></button>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayerViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.empty;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.HTMLButtonElement;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class SSHKeysEditorEmptyStateDisplayerViewImpl implements SSHKeysEditorEmptyStateDisplayerView,\n                                                                 IsElement {\n\n    private Presenter presenter;\n\n    @Inject\n    @DataField\n    private HTMLButtonElement add;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @EventHandler(\"add\")\n    public void onAdd(ClickEvent event) {\n        presenter.notifyAdd();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys;\n\nimport java.util.Collection;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.ssh.client.editor.component.keys.key.SSHKeyEditor;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\n@Dependent\npublic class SSHKeysDisplayer implements SSHKeysDisplayerView.Presenter,\n                                         IsElement {\n\n    private final SSHKeysDisplayerView view;\n    private final ManagedInstance<SSHKeyEditor> editors;\n\n    private Command addCommand;\n    private ParameterizedCommand<PortableSSHPublicKey> deleteCommand;\n\n    @Inject\n    public SSHKeysDisplayer(final SSHKeysDisplayerView view, final ManagedInstance<SSHKeyEditor> editors) {\n        this.view = view;\n        this.editors = editors;\n        view.init(this);\n    }\n\n    public void init(final Command addCommand, final ParameterizedCommand<PortableSSHPublicKey> deleteCommand) {\n\n        PortablePreconditions.checkNotNull(\"addCommand\", addCommand);\n        PortablePreconditions.checkNotNull(\"deleteCommand\", deleteCommand);\n\n        this.addCommand = addCommand;\n        this.deleteCommand = deleteCommand;\n    }\n\n    public void render(Collection<PortableSSHPublicKey> keys) {\n        clear();\n\n        keys.forEach(this::addKeyEditor);\n    }\n\n    private void addKeyEditor(final PortableSSHPublicKey key) {\n        final SSHKeyEditor editor = editors.get();\n        editor.render(key, () -> onDelete(key));\n        view.add(editor);\n    }\n\n    protected void onDelete(final PortableSSHPublicKey key) {\n        deleteCommand.execute(key);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @PreDestroy\n    public void clear() {\n        view.clear();\n        editors.destroyAll();\n    }\n\n    @Override\n    public void notifyAdd() {\n        if (addCommand != null) {\n            addCommand.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayerView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys;\n\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ssh.client.editor.component.keys.key.SSHKeyEditor;\n\npublic interface SSHKeysDisplayerView extends UberElemental<SSHKeysDisplayerView.Presenter> {\n\n    void clear();\n\n    void add(SSHKeyEditor editor);\n\n    interface Presenter {\n\n        void notifyAdd();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayerViewImpl.css",
    "content": ".appformer_ssh_keys_editor_header {\n    margin-bottom: 30px;\n}"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayerViewImpl.html",
    "content": "<div>\n    <h1 class=\"appformer_ssh_keys_editor_header\">\n        <div class=\"row\">\n            <div class=\"col-md-8\">\n                <span data-i18n-key=\"title\"></span>\n            </div>\n            <div class=\"col-md-4\">\n                <button class=\"btn btn-primary btn-lg pull-right\" data-field=\"add\" data-i18n-key=\"add\"></button>\n            </div>\n        </div>\n    </h1>\n    <ul class=\"list-group\" data-field=\"keysContainer\"></ul>\n</div>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayerViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport elemental2.dom.Document;\nimport elemental2.dom.Element;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ssh.client.editor.component.keys.key.SSHKeyEditor;\n\n@Templated\npublic class SSHKeysDisplayerViewImpl implements SSHKeysDisplayerView,\n                                                 IsElement {\n\n    @Inject\n    @DataField\n    private HTMLButtonElement add;\n\n    @Inject\n    @DataField\n    private HTMLUListElement keysContainer;\n\n    @Inject\n    private Document document;\n\n    @Inject\n    private Elemental2DomUtil util;\n\n    private Presenter presenter;\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void clear() {\n        util.removeAllElementChildren(keysContainer);\n    }\n\n    @Override\n    public void add(SSHKeyEditor editor) {\n        Element li = document.createElement(\"li\");\n\n        li.className = \"list-group-item\";\n\n        li.appendChild(editor.getElement());\n\n        keysContainer.appendChild(li);\n    }\n\n    @EventHandler(\"add\")\n    public void onAdd(ClickEvent event) {\n        presenter.notifyAdd();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/key/SSHKeyEditor.java",
    "content": "package org.uberfire.ssh.client.editor.component.keys.key;\n\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\n@Dependent\npublic class SSHKeyEditor implements IsElement,\n                                     SSHKeyEditorView.Presenter {\n\n    private final SSHKeyEditorView view;\n\n    private PortableSSHPublicKey key;\n    private Command onDelete;\n\n    @Inject\n    public SSHKeyEditor(SSHKeyEditorView view) {\n        this.view = view;\n\n        this.view.init(this);\n    }\n\n    public void render(PortableSSHPublicKey key, Command onDelete) {\n\n        PortablePreconditions.checkNotNull(\"key\", key);\n        PortablePreconditions.checkNotNull(\"onDelete\", onDelete);\n\n        this.key = key;\n        this.onDelete = onDelete;\n\n        view.clear();\n\n        view.render(key);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return view.getElement();\n    }\n\n    @Override\n    public void notifyDelete() {\n        if (onDelete != null) {\n            onDelete.execute();\n        }\n    }\n\n    @PreDestroy\n    public void clear() {\n        view.clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/key/SSHKeyEditorView.java",
    "content": "package org.uberfire.ssh.client.editor.component.keys.key;\n\nimport org.uberfire.client.mvp.UberElemental;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\npublic interface SSHKeyEditorView extends UberElemental<SSHKeyEditorView.Presenter> {\n\n    void clear();\n\n    void render(PortableSSHPublicKey key);\n\n    interface Presenter {\n\n        void notifyDelete();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/key/SSHKeyEditorViewImpl.html",
    "content": "<div class=\"row\">\n    <div class=\"col-md-4\">\n        <label data-field=\"name\"></label>\n    </div>\n    <div class=\"col-md-4\">\n        <label data-field=\"added\" class=\"text-muted\"></label>\n    </div>\n    <div class=\"col-md-3\">\n        <label data-field=\"lastUsed\" class=\"text-muted\"></label>\n    </div>\n    <div class=\"col-md-1\">\n        <button data-field=\"delete\" class=\"btn btn-danger pull-right\"><i class=\"fa fa-trash\"></i></button>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/editor/component/keys/key/SSHKeyEditorViewImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys.key;\n\nimport java.util.Date;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLLabelElement;\nimport org.gwtbootstrap3.client.ui.ModalSize;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.jboss.errai.ui.client.local.api.elemental2.IsElement;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\n@Templated\npublic class SSHKeyEditorViewImpl implements SSHKeyEditorView,\n                                             IsElement {\n\n    private static final DateTimeFormat format = DateTimeFormat.getFormat(\"MMMM dd, yyyy\");\n\n    @Inject\n    @DataField\n    private HTMLLabelElement name;\n\n    @Inject\n    @DataField\n    private HTMLLabelElement added;\n\n    @Inject\n    @DataField\n    private HTMLLabelElement lastUsed;\n\n    @Inject\n    @DataField\n    private HTMLButtonElement delete;\n\n    @Inject\n    private TranslationService translationService;\n\n    private Presenter presenter;\n\n    @Override\n    public void clear() {\n        name.textContent = \"\";\n        added.textContent = \"\";\n        lastUsed.textContent = \"\";\n    }\n\n    @Override\n    public void render(PortableSSHPublicKey key) {\n        name.textContent = key.getName();\n        added.textContent = format(key.getCreationDate(), AppformerSSHConstants.SSHKeyEditorViewImplAddedOn);\n        lastUsed.textContent = format(key.getLastTimeUsed(), AppformerSSHConstants.SSHKeyEditorViewImplLastUsed);\n    }\n\n    private String format(Date date, String key) {\n        if (date == null) {\n            return \"\";\n        }\n\n        return translationService.format(key, format.format(date));\n    }\n\n    @Override\n    public void init(Presenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @EventHandler(\"delete\")\n    public void onDelete(ClickEvent event) {\n        YesNoCancelPopup popupup = YesNoCancelPopup.newYesNoCancelPopup(translationService.getTranslation(AppformerSSHConstants.SSHKeyEditorViewImplDelete),\n                                                                        translationService.getTranslation(AppformerSSHConstants.SSHKeyEditorViewImplDeleteMessage),\n                                                                        null, null, null,\n                                                                        () -> {\n                                                                        },\n                                                                        translationService.getTranslation(AppformerSSHConstants.SSHKeyEditorViewImplCancel),\n                                                                        ButtonType.DEFAULT,\n                                                                        () -> presenter.notifyDelete(),\n                                                                        translationService.getTranslation(AppformerSSHConstants.SSHKeyEditorViewImplDelete),\n                                                                        ButtonType.DANGER);\n\n        popupup.setSize(ModalSize.SMALL);\n        popupup.clearScrollHeight();\n\n        popupup.show();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/java/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic interface AppformerSSHConstants {\n\n    @TranslationKey(defaultValue = \"\")\n    String SSHKeysEditorScreenTitle = \"SSHKeysDisplayerViewImpl.title\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SSHKeysDisplayerViewImplAdd = \"SSHKeysDisplayerViewImpl.add\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SSHKeyEditorViewImplDelete = \"SSHKeyEditorViewImpl.sshKeysDelete\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SSHKeyEditorViewImplDeleteMessage = \"SSHKeyEditorViewImpl.sshKeysDeleteMessage\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SSHKeyEditorViewImplCancel = \"SSHKeyEditorViewImpl.sshKeysCancel\";\n\n    String SSHKeyEditorViewImplAddedOn = \"SSHKeyEditorViewImpl.addedOn\";\n\n    String SSHKeyEditorViewImplLastUsed = \"SSHKeyEditorViewImpl.lastUsed\";\n\n    @TranslationKey(defaultValue = \"\")\n    String NewSSHKeyModalViewImplNamePlaceHolder = \"NewSSHKeyModalViewImpl.namePlaceHolder\";\n\n    @TranslationKey(defaultValue = \"\")\n    String NewSSHKeyModalViewImplKeyPlaceHolder = \"NewSSHKeyModalViewImpl.keyPlaceHolder\";\n\n    @TranslationKey(defaultValue = \"\")\n    String NewSSHKeyModalViewImplName = \"NewSSHKeyModalViewImpl.name\";\n\n    @TranslationKey(defaultValue = \"\")\n    String NewSSHKeyModalViewImplKey = \"NewSSHKeyModalViewImpl.key\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ValidationCannotBeEmpty = \"Validation.cannotBeEmpty\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ValidationKeyFormatError = \"Validation.keyFormatError\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ValidationKeyNameAlreadyExists = \"Validation.keyNameAlreadyExists\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ValidationKeyAlreadyExists = \"Validation.keyAlreadyExists\";\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2018 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/META-INF/beans.xml",
    "content": "<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"all\">\n  <scan>\n    <exclude name=\"org.uberfire.ssh.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/UberfireSSHClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.common.ErraiCommon\"/>\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.jboss.errai.ui.UI\"/>\n\n  <inherits name=\"org.kie.soup.commons.KIESoupCommons\"/>\n\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n  <inherits name=\"org.uberfire.UberfireClientAPI\"/>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n\n  <inherits name=\"org.uberfire.ssh.UberfireSSHAPI\"/>\n\n  <source path=\"client\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants.properties",
    "content": "SSHKeysDisplayerViewImpl.title=SSH Keys\nSSHKeysDisplayerViewImpl.add=Add SSH Key\n\nSSHKeyEditorViewImpl.sshKeysDelete=Delete SSH Key\nSSHKeyEditorViewImpl.sshKeysDeleteMessage=This action cannot be undone. Your key will be permanently deleted.\nSSHKeyEditorViewImpl.sshKeysCancel=Cancel\nSSHKeyEditorViewImpl.addedOn=Added on {0}\nSSHKeyEditorViewImpl.lastUsed=Last used on {0}\n\nNewSSHKeyModalViewImpl.validationError=The form has errors, fix them before submitting form again.\nNewSSHKeyModalViewImpl.name=Name\nNewSSHKeyModalViewImpl.namePlaceHolder=SSH Key Name\nNewSSHKeyModalViewImpl.key=Key\nNewSSHKeyModalViewImpl.keyPlaceHolder=Begins with 'ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384' or 'ecdsa-sha2-nistp521'.\n\nSSHKeysEditorEmptyStateDisplayerViewImpl.title=There are no SSH Keys!\nSSHKeysEditorEmptyStateDisplayerViewImpl.description=Looks like you don't have any SSH Key defined. Please press the 'Add SSH Key' button to create a new one.\nSSHKeysEditorEmptyStateDisplayerViewImpl.add=Add SSH Key\n\nValidation.cannotBeEmpty={0} field cannot be empty.\nValidation.keyFormatError=Wrong Key format. Supported formats are 'ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384' or 'ecdsa-sha2-nistp521'.\nValidation.keyNameAlreadyExists=Already exists a key named '{0}'.\nValidation.keyAlreadyExists=Key already exists."
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants_es.properties",
    "content": "SSHKeysDisplayerViewImpl.title=Claves SSH\nSSHKeysDisplayerViewImpl.add=Agregar clave SSH\n\nSSHKeyEditorViewImpl.sshKeysDelete=Eliminar clave SSH\nSSHKeyEditorViewImpl.sshKeysDeleteMessage=Esta acción no puede deshacerse. Su clave se eliminará permanentemente.\nSSHKeyEditorViewImpl.sshKeysCancel=Cancelar\nSSHKeyEditorViewImpl.addedOn=Agregado el {0}\nSSHKeyEditorViewImpl.lastUsed=Usado por última vez el {0}\n\nNewSSHKeyModalViewImpl.validationError=El formulario tiene errores; corríjalos antes de volver a enviarlo.\nNewSSHKeyModalViewImpl.name=Nombre\nNewSSHKeyModalViewImpl.namePlaceHolder=Nombre de clave SSH\nNewSSHKeyModalViewImpl.key=Clave\nNewSSHKeyModalViewImpl.keyPlaceHolder=Comienza con “ssh-rsa”, “ssh-dss”, “ecdsa-sha2-nistp256”, “ecdsa-sha2-nistp384” o “ecdsa-sha2-nistp521”.\n\nSSHKeysEditorEmptyStateDisplayerViewImpl.title=¡No hay claves SSH!\nSSHKeysEditorEmptyStateDisplayerViewImpl.description=Parece que no tiene ninguna clave SSH definida. Presione el botón “Agregar clave SSH” para crear una nueva.\nSSHKeysEditorEmptyStateDisplayerViewImpl.add=Agregar clave SSH\n\nValidation.cannotBeEmpty=El campo {0} no puede estar vacío.\nValidation.keyFormatError=Formato de clave incorrecto. Los formatos admitidos son “ssh-rsa'', “ssh-dss”, “ecdsa-sha2-nistp256”, “ecdsa-sha2-nistp384” o “ecdsa-sha2-nistp521”.\nValidation.keyNameAlreadyExists=Ya existe una clave llamada ''{0}''.\nValidation.keyAlreadyExists=La clave ya existe."
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants_fr.properties",
    "content": "SSHKeysDisplayerViewImpl.title=Clés SSH\nSSHKeysDisplayerViewImpl.add=Ajouter une clé SSH\n\nSSHKeyEditorViewImpl.sshKeysDelete=Supprimer la clé SSH\nSSHKeyEditorViewImpl.sshKeysDeleteMessage=Cette action ne peut pas être annulée. Votre clé sera définitivement supprimée.\nSSHKeyEditorViewImpl.sshKeysCancel=Annuler\nSSHKeyEditorViewImpl.addedOn=Ajouté le {0}\nSSHKeyEditorViewImpl.lastUsed=Dernière utilisation le {0}\n\nNewSSHKeyModalViewImpl.validationError=Le formulaire comporte des erreurs. Corrigez-les avant d''envoyer à nouveau le formulaire.\nNewSSHKeyModalViewImpl.name=Nom\nNewSSHKeyModalViewImpl.namePlaceHolder=Nom de la clé SSH\nNewSSHKeyModalViewImpl.key=Clé\nNewSSHKeyModalViewImpl.keyPlaceHolder=Commence par \"ssh-rsa\", \"ssh-dss\", \"ecdsa-sha2-nistp256\", \"ecdsa-sha2-nistp384\" ou \"ecdsa-sha2-nistp521\".\n\nSSHKeysEditorEmptyStateDisplayerViewImpl.title=Il n''y a aucune clé SSH !\nSSHKeysEditorEmptyStateDisplayerViewImpl.description=Il semble qu''aucune clé SSH ne soit définie. Veuillez cliquer sur le bouton ''Ajouter une clé SSH'' pour en créer une.\nSSHKeysEditorEmptyStateDisplayerViewImpl.add=Ajouter une clé SSH\n\nValidation.cannotBeEmpty=Le champ {0} ne peut pas être vide.\nValidation.keyFormatError=Format de clé incorrect. Les formats pris en charge sont \"ssh-rsa\", \"ssh-dss\", \"ecdsa-sha2-nistp256\", \"ecdsa-sha2-nistp384\" et \"ecdsa-sha2-nistp521\".\nValidation.keyNameAlreadyExists=Il existe déjà une clé nommée \"{0}\".\nValidation.keyAlreadyExists=La clé existe déjà."
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants_it.properties",
    "content": "SSHKeysDisplayerViewImpl.title=Chiavi SSH\nSSHKeysDisplayerViewImpl.add=Aggiungi chiave SSH\n\nSSHKeyEditorViewImpl.sshKeysDelete=Elimina chiave SSH\nSSHKeyEditorViewImpl.sshKeysDeleteMessage=Questa azione non può essere annullata. La tua chiave verrà eliminata definitivamente.\nSSHKeyEditorViewImpl.sshKeysCancel=Annulla\nSSHKeyEditorViewImpl.addedOn=Aggiunto il {0}\nSSHKeyEditorViewImpl.lastUsed=Ultimo utilizzo il {0}\n\nNewSSHKeyModalViewImpl.validationError=Il modulo contiene degli errori, correggili prima di inviare nuovamente il modulo.\nNewSSHKeyModalViewImpl.name=Nome\nNewSSHKeyModalViewImpl.namePlaceHolder=Nome chiave SSH\nNewSSHKeyModalViewImpl.key=Chiave\nNewSSHKeyModalViewImpl.keyPlaceHolder=Inizia con ''ssh-rsa'', ''ssh-dss'', ''ecdsa-sha2-nistp256'', ''ecdsa-sha2-nistp384'' o ''ecdsa-sha2-nistp521''.\n\nSSHKeysEditorEmptyStateDisplayerViewImpl.title=Non ci sono chiavi SSH!\nSSHKeysEditorEmptyStateDisplayerViewImpl.description>Sembra che tu non abbia nessuna chiave SSH definita. Premi il pulsante ''Aggiungi chiave SSH'' per crearne una nuova.\nSSHKeysEditorEmptyStateDisplayerViewImpl.add=Aggiungi chiave SSH\n\nValidation.cannotBeEmpty=Il campo {0} non può essere vuoto.\nValidation.keyFormatError=Formato chiave errato. I formati supportati sono ''ssh-rsa'', ''ssh-dss'', ''ecdsa-sha2-nistp256'', ''ecdsa-sha2-nistp384'' o ''ecdsa-sha2-nistp521''.\nValidation.keyNameAlreadyExists=Esiste già una chiave nominata '{0}'.\nValidation.keyAlreadyExists=La chiave esiste già.\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/main/resources/org/uberfire/ssh/client/resources/i18n/AppformerSSHConstants_ja.properties",
    "content": "SSHKeysDisplayerViewImpl.title=SSH キー\nSSHKeysDisplayerViewImpl.add=SSH キーの追加\n\nSSHKeyEditorViewImpl.sshKeysDelete=SSH キーの削除\nSSHKeyEditorViewImpl.sshKeysDeleteMessage=このアクションは取り消せません。キーは完全に削除されます。\nSSHKeyEditorViewImpl.sshKeysCancel=キャンセル\nSSHKeyEditorViewImpl.addedOn={0} に追加しました\nSSHKeyEditorViewImpl.lastUsed={0} で最後に使用\n\nNewSSHKeyModalViewImpl.validationError=フォームにエラーがあります。再提出する前に修正してください。\nNewSSHKeyModalViewImpl.name=名前\nNewSSHKeyModalViewImpl.namePlaceHolder=SSH キーの名前\nNewSSHKeyModalViewImpl.key=キー\nNewSSHKeyModalViewImpl.keyPlaceHolder=以下のいずれかで始めます: ''ssh-rsa''、''ssh-dss''、''ecdsa-sha2-nistp256''、''ecdsa-sha2-nistp384'' または ''ecdsa-sha2-nistp521''\n\nSSHKeysEditorEmptyStateDisplayerViewImpl.title=SSH キーがありません!\nSSHKeysEditorEmptyStateDisplayerViewImpl.description=SSH キーが定義されていないようです。「SSHキーの追加」ボタンを押して新しいキーを作成してください。\nSSHKeysEditorEmptyStateDisplayerViewImpl.add=SSH キーの追加\n\nValidation.cannotBeEmpty={0} フィールドは空にできません。\nValidation.keyFormatError=キーフォーマットが正しくありません。以下のフォーマットがサポートされています: ''ssh-rsa''、''ssh-dss''、''ecdsa-sha2-nistp256''、''ecdsa-sha2-nistp384'' または ''ecdsa-sha2-nistp521''\nValidation.keyNameAlreadyExists=''{0}'' という名前のキーは既に存在します。\nValidation.keyAlreadyExists=キーが既に存在します。"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/SSHKeysEditorScreenTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.ssh.client.editor.component.SSHKeysEditor;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\n\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeysEditorScreenTest {\n\n    @Mock\n    private SSHKeysEditor editor;\n\n    @Mock\n    private TranslationService translationService;\n\n    private SSHKeysEditorScreen screen;\n\n    @Before\n    public void init() {\n        screen = new SSHKeysEditorScreen(editor, translationService);\n    }\n\n    @Test\n    public void testOnOpen() {\n        screen.onOpen();\n\n        verify(editor).load();\n    }\n\n    @Test\n    public void testGetView() {\n        assertSame(editor, screen.getView());\n    }\n\n    @Test\n    public void testGetTitle() {\n        screen.getTitle();\n\n        verify(translationService).getTranslation(AppformerSSHConstants.SSHKeysEditorScreenTitle);\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/component/SSHKeysEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.ssh.client.editor.component.creation.NewSSHKeyModal;\nimport org.uberfire.ssh.client.editor.component.empty.SSHKeysEditorEmptyStateDisplayer;\nimport org.uberfire.ssh.client.editor.component.keys.SSHKeysDisplayer;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\nimport org.uberfire.ssh.service.shared.editor.SSHKeyEditorService;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeysEditorTest {\n\n    @Mock\n    private SSHKeysEditorView view;\n\n    @Mock\n    private SSHKeysDisplayer keysDisplayer;\n\n    @Mock\n    private SSHKeysEditorEmptyStateDisplayer emptyStateDisplayer;\n\n    @Mock\n    private NewSSHKeyModal newSSHKeyModal;\n\n    @Mock\n    private SSHKeyEditorService service;\n\n    private CallerMock<SSHKeyEditorService> serviceCaller;\n\n    private SSHKeysEditor editor;\n\n    @Before\n    public void init() {\n\n        serviceCaller = new CallerMock<>(service);\n\n        editor = spy(new SSHKeysEditor(view, keysDisplayer, emptyStateDisplayer, newSSHKeyModal, serviceCaller));\n    }\n\n    @Test\n    public void testBasicFunctionality() {\n        editor.init();\n\n        verify(view).init(editor);\n        verify(keysDisplayer).init(any(), any());\n        verify(emptyStateDisplayer).init(any());\n        verify(newSSHKeyModal).init(any());\n\n        editor.getElement();\n\n        verify(view).getElement();\n\n        editor.clear();\n\n        verify(view).clear();\n\n        editor.showNewKeyModal();\n        verify(newSSHKeyModal).show();\n\n        editor.onAddKey();\n        verify(newSSHKeyModal).hide();\n        verify(editor).load();\n    }\n\n    @Test\n    public void testLoadUserKeys() {\n        final List<PortableSSHPublicKey> keys = new ArrayList<>();\n\n        keys.add(mock(PortableSSHPublicKey.class));\n        keys.add(mock(PortableSSHPublicKey.class));\n        keys.add(mock(PortableSSHPublicKey.class));\n        keys.add(mock(PortableSSHPublicKey.class));\n\n        loadUserKeys(keys);\n    }\n\n    @Test\n    public void testLoadUsersEmptyList() {\n\n        loadUserKeys(new ArrayList<>());\n    }\n\n    private void loadUserKeys(final List<PortableSSHPublicKey> keys) {\n\n        when(service.getUserKeys()).thenReturn(keys);\n\n        editor.load();\n\n        verify(view).clear();\n        verify(view).show(any());\n\n        if (keys.isEmpty()) {\n            verify(emptyStateDisplayer).getElement();\n        } else {\n            verify(keysDisplayer).render(keys);\n            verify(keysDisplayer).getElement();\n        }\n    }\n\n    @Test\n    public void testDeleteKey() {\n        editor.delete(mock(PortableSSHPublicKey.class));\n\n        verify(service).deleteKey(any());\n        verify(editor).load();\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/component/creation/NewSSHKeyModalTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.creation;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.ssh.client.resources.i18n.AppformerSSHConstants;\nimport org.uberfire.ssh.service.backend.keystore.util.PublicKeyConverter;\nimport org.uberfire.ssh.service.shared.editor.SSHKeyEditorService;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\nimport static org.mockito.internal.verification.VerificationModeFactory.times;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class NewSSHKeyModalTest {\n\n    private static final String NAME = \"name\";\n    private static final String EXISTING_KEY_NAME = \"existing name\";\n\n    private static final String WRONG_KEY = \"wrong key\";\n    private static final String WRONG_KEY_FORMAT = \"ssh-rsa wrong key\";\n    private static final String VALID_KEY = \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDNsKIMkhaI8iX69IKsux/LdgG3zP1wW5RNJz\" +\n            \"bopy7BLqZEmqTZMIfaWEisuH5WZquG3tZ//yNrVNd0Jw5RYQ/fwkyVmmJi9Ir2bo5rex4jbkNwcWb8U57UpIt38JCjjKLCkiYSKNXzrJOm\" +\n            \"tFsMOuHukoGJbSRLDV3VSmQVIbtrysz8CRCCg2bv2KZkTmKa50O4S0UpjEVeyuy/+sDqbKl9Jrhj0i7PFrB1hJhN4+7SnNDAr6OpdZd0EU\" +\n            \"Ua1TNdDISsdetq9vWMnuYBQPlxHxXnJsJhvdIlLXW6ZfZpsjqxe8jfHsJtmFvD032w/B4kBfGZxQXbPoUUBdrGyrKb2FyAypdDxAotA1Rl\" +\n            \"sq3S6PWBlp7RjpMYWZb02XqNrN6g6AJCh0uuWCK/jxO6S96MYFyJj7rqUgaRg7SEKwR2lhwWTzUxb5bxbNxsA4eUXnvSr0lqCwcjw3M5WQ\" +\n            \"HocGn4VPjKZl7Jhqxu9evwF5siuZEDL4oK8NgPwAZxMYcFuefdPgpxA/wmqWAh6JPbXLstQlG24bTrxCIzsx7qEfhU65KQJaLi3kso4LA/\" +\n            \"IDmPRHIFGNUbY3YOwfDpmH/fHFQNY/5uy5/0oICAv9M3QBEMvB2rWpWJT8j2CkISCSjzPNnB490uUv9cxNnLs8tDrOHlAnm+k0iXyJ4hjq\" +\n            \"tXqSbLCLz2Jw== katy\";\n\n    private static final String EXISTING_KEY = \"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDmak4Wu23RZ6XmN94bOsqecZxuTa4RRhh\" +\n            \"QmHmTZjMB7HM57/90u/B/gB/GhsPEu1nAXL0npY56tT/MPQ8vRm2C2W9A7CzN5+z5yyL3W01YZy3kzslk77CjULjfhrcfQSL3b2sPG5jv5\" +\n            \"E5/nyC/swSytucwT/PE7aXTS9H6cHIKUdYPzIt94SHoBxWRIK7PJi9d+eLB+hmDzvbVa1ezu5a8yu2kcHi6NxxfI5iRj2rsceDTp0imC1j\" +\n            \"MoC6ZDfBvZSxL9FXTMwFdNnmTlJveBtv9nAbnAvIWlilS0VOkdj1s3GxBxeZYAcKbcsK9sJzusptk5dxGsG2Z8vInaglN6OaOQ7b7tcomz\" +\n            \"CYYwviGQ9gRX8sGsVrw39gsDIGYP2tA4bRr7ecHnlNg1b0HCchA5+QCDk4Hbz1UrnHmPA2Lg9c3WGm2qedvQdVJXuS3mlwYOqL40aXPs68\" +\n            \"90PvFJUlpiVSznF50djPnwsMxJZEf1HdTXgZD1Bh54ogZf7czyUNfkNkE69yJDbTHjpQd0cKUQnu9tVxqmBzhX31yF4VcsMeADcf2Z8wlA\" +\n            \"3n4LZnC/GwonYlq5+G93zJpFOkPhme8c2XuPuCXF795lsxyJ8SB/AlwPJAhEtm0y0s0l1l4eWqxsDxkBOgN+ivU0czrVMssHJEJb4o0FLf\" +\n            \"7iHhOW56/iMdD9w== katy\";\n\n    @Mock\n    private NewSSHKeyModalView view;\n\n    @Mock\n    private SSHKeyEditorService sshKeyEditorService;\n\n    private CallerMock<SSHKeyEditorService> serviceCaller;\n\n    @Mock\n    private TranslationService translationService;\n\n    @Mock\n    private NewSSHKeyModalHandler handler;\n\n    private NewSSHKeyModal modal;\n\n    @Before\n    public void init() {\n        when(handler.existsKeyName(eq(EXISTING_KEY_NAME))).thenReturn(true);\n        when(handler.existsKey(eq(EXISTING_KEY))).thenReturn(true);\n\n        when(translationService.format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any())).thenReturn(\"Field cannot be empty\");\n\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            String keyContent = (String) invocationOnMock.getArguments()[1];\n\n            PublicKeyConverter.fromString(keyContent);\n            return null;\n        }).when(sshKeyEditorService).addKey(anyString(), anyString());\n\n        serviceCaller = new CallerMock<>(sshKeyEditorService);\n\n        modal = new NewSSHKeyModal(view, serviceCaller, translationService);\n\n        verify(view).init(modal);\n    }\n\n    @Test\n    public void testBasicFunctions() {\n\n        modal.init(handler);\n\n        modal.show();\n\n        verify(view).show();\n\n        modal.hide();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testNotifyCancel() {\n\n        modal.notifyCancel();\n\n        verify(view).hide();\n    }\n\n    @Test\n    public void testAddKeyNullValidationFailure() {\n        testBasicFunctions();\n\n        modal.notifyAdd(null, null);\n\n        verify(view).resetValidation();\n\n        verify(translationService).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, times(2)).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view).setNameValidationError(any());\n        verify(view).setKeyValidationError(any());\n\n        verify(sshKeyEditorService, never()).addKey(anyString(), anyString());\n        verify(handler, never()).onAddKey();\n    }\n\n    @Test\n    public void testAddKeyWrongKeyValidationFailure() {\n        testBasicFunctions();\n\n        modal.notifyAdd(NAME, WRONG_KEY);\n\n        verify(view).resetValidation();\n\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view, never()).setNameValidationError(any());\n        verify(view).setKeyValidationError(any());\n\n        verify(sshKeyEditorService, never()).addKey(anyString(), anyString());\n        verify(handler, never()).onAddKey();\n    }\n\n    @Test\n    public void testAddKeyWrongKeyFormatValidationFailure() {\n        testBasicFunctions();\n\n        modal.notifyAdd(NAME, WRONG_KEY_FORMAT);\n\n        verify(view).resetValidation();\n\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view, never()).setNameValidationError(any());\n\n        verify(sshKeyEditorService).addKey(anyString(), anyString());\n        verify(translationService).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(view).setKeyValidationError(any());\n        verify(handler, never()).onAddKey();\n    }\n\n    @Test\n    public void testAddKeyExistingKeyNameValidationFailure() {\n        testBasicFunctions();\n\n        modal.notifyAdd(EXISTING_KEY_NAME, VALID_KEY);\n\n        verify(view).resetValidation();\n\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view).setNameValidationError(any());\n\n        verify(sshKeyEditorService, never()).addKey(anyString(), anyString());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(view, never()).setKeyValidationError(any());\n        verify(handler, never()).onAddKey();\n    }\n\n    @Test\n    public void testAddKeyExistingKeyValidationFailure() {\n        testBasicFunctions();\n\n        modal.notifyAdd(NAME, EXISTING_KEY);\n\n        verify(view).resetValidation();\n\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view, never()).setNameValidationError(any());\n\n        verify(sshKeyEditorService, never()).addKey(anyString(), anyString());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(view).setKeyValidationError(any());\n        verify(handler, never()).onAddKey();\n    }\n\n    @Test\n    public void testAddKey() {\n        testBasicFunctions();\n\n        modal.notifyAdd(NAME, VALID_KEY);\n\n        verify(view).resetValidation();\n\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplName));\n        verify(translationService, never()).getTranslation(eq(AppformerSSHConstants.NewSSHKeyModalViewImplKey));\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationCannotBeEmpty), any());\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyFormatError);\n        verify(translationService, never()).getTranslation(AppformerSSHConstants.ValidationKeyAlreadyExists);\n        verify(translationService, never()).format(eq(AppformerSSHConstants.ValidationKeyNameAlreadyExists), any());\n\n        verify(view, never()).setNameValidationError(any());\n        verify(view, never()).setKeyValidationError(any());\n\n        verify(sshKeyEditorService).addKey(anyString(), anyString());\n        verify(handler).onAddKey();\n    }\n\n    @Test\n    public void testInitNull() {\n        Assertions.assertThatThrownBy(() -> modal.init(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'handler' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/component/empty/SSHKeysEditorEmptyStateDisplayerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.empty;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeysEditorEmptyStateDisplayerTest {\n\n    @Mock\n    private SSHKeysEditorEmptyStateDisplayerView view;\n\n    @Mock\n    private Command addCommand;\n\n    private SSHKeysEditorEmptyStateDisplayer displayer;\n\n    @Before\n    public void init() {\n        displayer = new SSHKeysEditorEmptyStateDisplayer(view);\n    }\n\n    @Test\n    public void testFunctionality() {\n\n        verify(view).init(displayer);\n\n        displayer.getElement();\n        verify(view).getElement();\n\n        displayer.init(addCommand);\n\n        displayer.notifyAdd();\n        verify(addCommand).execute();\n    }\n\n    @Test\n    public void testInitNull() {\n        Assertions.assertThatThrownBy(() -> displayer.init(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'addCommand' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/component/keys/SSHKeysDisplayerTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.ssh.client.editor.component.keys.key.SSHKeyEditor;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeysDisplayerTest {\n\n    @Mock\n    private SSHKeysDisplayerView view;\n\n    @Mock\n    private ManagedInstance<SSHKeyEditor> editors;\n\n    @Mock\n    private Command addCommand;\n\n    @Mock\n    private ParameterizedCommand<PortableSSHPublicKey> deleteCommand;\n\n    @Mock\n    private PortableSSHPublicKey key;\n\n    private List<SSHKeyEditor> createdEditors = new ArrayList<>();\n\n    private SSHKeysDisplayer displayer;\n\n    @Before\n    public void init() {\n        when(editors.get()).thenAnswer((Answer<SSHKeyEditor>) invocationOnMock -> {\n            SSHKeyEditor editor = mock(SSHKeyEditor.class);\n\n            createdEditors.add(editor);\n\n            return editor;\n        });\n\n        displayer = new SSHKeysDisplayer(view, editors);\n    }\n\n    @Test\n    public void testFunctionality() {\n        verify(view).init(displayer);\n\n        displayer.init(addCommand, deleteCommand);\n\n        displayer.getElement();\n        verify(view).getElement();\n\n        displayer.clear();\n        verify(view).clear();\n        verify(editors).destroyAll();\n\n        displayer.notifyAdd();\n        verify(addCommand).execute();\n\n        displayer.onDelete(key);\n        verify(deleteCommand).execute(key);\n    }\n\n    @Test\n    public void testRenderKeys() {\n        List<PortableSSHPublicKey> keys = new ArrayList<>();\n        keys.add(key);\n        keys.add(mock(PortableSSHPublicKey.class));\n        keys.add(mock(PortableSSHPublicKey.class));\n\n        displayer.render(keys);\n\n        assertEquals(keys.size(), createdEditors.size());\n\n        verify(editors, times(keys.size())).get();\n\n        createdEditors.forEach(editor -> verify(editor).render(any(), any()));\n    }\n}\n"
  },
  {
    "path": "uberfire-ssh/uberfire-ssh-client/src/test/java/org/uberfire/ssh/client/editor/component/keys/key/SSHKeyEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.ssh.client.editor.component.keys.key;\n\nimport org.assertj.core.api.Assertions;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.ssh.service.shared.editor.PortableSSHPublicKey;\n\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SSHKeyEditorTest {\n\n    @Mock\n    private SSHKeyEditorView view;\n\n    @Mock\n    private PortableSSHPublicKey key;\n\n    @Mock\n    private Command onDelete;\n\n    private SSHKeyEditor editor;\n\n    @Before\n    public void init() {\n        editor = new SSHKeyEditor(view);\n    }\n\n    @Test\n    public void testFunctionality() {\n        verify(view).init(editor);\n\n        editor.getElement();\n        verify(view).getElement();\n\n        editor.render(key, onDelete);\n\n        verify(view).clear();\n        verify(view).render(key);\n\n        editor.notifyDelete();\n        verify(onDelete).execute();\n\n        editor.clear();\n        verify(view, times(2)).clear();\n    }\n\n    @Test\n    public void testInitFailures() {\n        Assertions.assertThatThrownBy(() -> editor.render(null, onDelete))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'key' should be not null!\");\n\n        Assertions.assertThatThrownBy(() -> editor.render(key, null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'onDelete' should be not null!\");\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-structure/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-structure</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Structure</name>\n\n  <modules>\n    <module>uberfire-structure-api</module>\n    <module>uberfire-structure-client</module>\n    <module>uberfire-structure-backend</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-structure</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-structure-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Structure API</name>\n  <description>UberFire - Structure API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-shared</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/config/SystemRepositoryChangedEvent.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.config;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class SystemRepositoryChangedEvent {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/contributors/SpaceContributorsUpdatedEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.contributors;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class SpaceContributorsUpdatedEvent {\n\n    private OrganizationalUnit organizationalUnit;\n\n    public SpaceContributorsUpdatedEvent() {\n    }\n\n    public SpaceContributorsUpdatedEvent(@MapsTo(\"organizationalUnit\") final OrganizationalUnit organizationalUnit) {\n        this.organizationalUnit = organizationalUnit;\n    }\n\n    public OrganizationalUnit getOrganizationalUnit() {\n        return organizationalUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/deployment/DeploymentConfig.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.deployment;\n\npublic interface DeploymentConfig {\n\n    String getIdentifier();\n\n    Object getDeploymentUnit();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/deployment/DeploymentConfigService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.deployment;\n\nimport java.util.Collection;\n\npublic interface DeploymentConfigService {\n\n    void addDeployment(String identifier,\n                       Object deploymentUnit);\n\n    void removeDeployment(String identifier);\n\n    DeploymentConfig getDeployment(String identifier);\n\n    Collection<DeploymentConfig> getDeployments();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/events/AfterCreateOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.events;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * An event signalling an Organizational Unit has been created\n */\npublic class AfterCreateOrganizationalUnitEvent {\n\n    private final OrganizationalUnit organizationalUnit;\n\n    public AfterCreateOrganizationalUnitEvent(final OrganizationalUnit organizationalUnit) {\n        this.organizationalUnit = PortablePreconditions.checkNotNull(\"organizationalUnit\",\n                                                                     organizationalUnit);\n    }\n\n    public OrganizationalUnit getOrganizationalUnit() {\n        return organizationalUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/events/AfterEditOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.events;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.kie.soup.commons.validation.PortablePreconditions;\n\n/**\n * An event signalling an Organizational Unit has been edited\n */\npublic class AfterEditOrganizationalUnitEvent {\n\n    private final OrganizationalUnit previousOrganizationalUnit;\n\n    private final OrganizationalUnit editedOrganizationalUnit;\n\n    public AfterEditOrganizationalUnitEvent(final OrganizationalUnit previousOrganizationalUnit,\n                                            final OrganizationalUnit editedOrganizationalUnit) {\n        this.previousOrganizationalUnit = PortablePreconditions.checkNotNull(\"previousOrganizationalUnit\",\n                                                                             previousOrganizationalUnit);\n        this.editedOrganizationalUnit = PortablePreconditions.checkNotNull(\"editedOrganizationalUnit\",\n                                                                           editedOrganizationalUnit);\n    }\n\n    public OrganizationalUnit getPreviousOrganizationalUnit() {\n        return previousOrganizationalUnit;\n    }\n\n    public OrganizationalUnit getEditedOrganizationalUnit() {\n        return editedOrganizationalUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/navigator/DataContent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.navigator;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class DataContent {\n\n    private boolean isDirectory;\n    private String lastMessage;\n    private String lastCommiter;\n    private String lastCommiterEmail;\n    private String age;\n    private Path path;\n\n    public DataContent() {\n    }\n\n    public DataContent(boolean isDirectory,\n                       String lastMessage,\n                       String lastCommiter,\n                       String lastCommiterEmail,\n                       String age,\n                       Path path) {\n        this.isDirectory = isDirectory;\n        this.lastMessage = lastMessage;\n        this.lastCommiter = lastCommiter;\n        this.lastCommiterEmail = lastCommiterEmail;\n        this.age = age;\n        this.path = path;\n    }\n\n    public String getLastCommiterEmail() {\n        return lastCommiterEmail;\n    }\n\n    public String getAge() {\n        return age;\n    }\n\n    public boolean isDirectory() {\n        return isDirectory;\n    }\n\n    public String getLastMessage() {\n        return lastMessage;\n    }\n\n    public String getLastCommiter() {\n        return lastCommiter;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/navigator/FileNavigatorService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.navigator;\n\nimport java.util.List;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.spaces.Space;\n\n@Remote\npublic interface FileNavigatorService {\n\n    NavigatorContent listContent(final Path path);\n\n    List<Repository> listRepositories(final Space space);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/navigator/NavigatorContent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.navigator;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n@Portable\npublic class NavigatorContent {\n\n    private String repoName;\n    private Path root;\n    private List<Path> breadcrumbs = new ArrayList<Path>();\n    private List<DataContent> content = new ArrayList<DataContent>();\n\n    public NavigatorContent() {\n    }\n\n    public NavigatorContent(final String repoName,\n                            final Path root,\n                            final List<Path> breadcrumbs,\n                            final List<DataContent> content) {\n        this.repoName = repoName;\n        this.root = root;\n        this.breadcrumbs = breadcrumbs;\n        this.content = content;\n    }\n\n    public List<Path> getBreadcrumbs() {\n        return breadcrumbs;\n    }\n\n    public List<DataContent> getContent() {\n        return content;\n    }\n\n    public Path getRoot() {\n        return root;\n    }\n\n    public String getRepoName() {\n        return repoName;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/NewOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class NewOrganizationalUnitEvent extends OrganizationalUnitEventBase {\n\n    public NewOrganizationalUnitEvent() {\n    }\n\n    public NewOrganizationalUnitEvent(final OrganizationalUnit organizationalUnit,\n                                      final String userName) {\n        super(organizationalUnit,\n              userName);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/OrganizationalUnit.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit;\n\nimport java.util.Collection;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.security.OrgUnitResourceType;\nimport org.uberfire.commons.data.Cacheable;\nimport org.uberfire.security.ContributorResource;\nimport org.uberfire.security.authz.RuntimeContentResource;\nimport org.uberfire.spaces.Space;\n\npublic interface OrganizationalUnit extends ContributorResource ,RuntimeContentResource,\n                                            Cacheable{\n\n    OrgUnitResourceType RESOURCE_TYPE = new OrgUnitResourceType();\n\n    String getName();\n\n    String getDescription();\n\n    Space getSpace();\n\n    String getOwner();\n\n    String getDefaultGroupId();\n\n    Collection<Repository> getRepositories();\n\n    Collection<String> getGroups();\n\n    boolean isDeleted();\n\n    void setDescription(String description);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/OrganizationalUnitEventBase.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Common attributes for OU events, sub classes should be fired instead of this.\n */\n@Portable\npublic class OrganizationalUnitEventBase {\n\n    protected OrganizationalUnit organizationalUnit;\n    protected String userName;\n\n    public OrganizationalUnitEventBase() {\n    }\n\n    public OrganizationalUnitEventBase(final OrganizationalUnit organizationalUnit,\n                                       final String userName) {\n        this.organizationalUnit = organizationalUnit;\n        this.userName = userName;\n    }\n\n    public OrganizationalUnit getOrganizationalUnit() {\n        return organizationalUnit;\n    }\n\n    public void setOrganizationalUnit(OrganizationalUnit organizationalUnit) {\n        this.organizationalUnit = organizationalUnit;\n    }\n\n    public String getUserName() {\n        return userName;\n    }\n\n    public void setUserName(String userName) {\n        this.userName = userName;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/OrganizationalUnitSearchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * {@link OrganizationalUnit} remote search interface\n */\n@Remote\npublic interface OrganizationalUnitSearchService {\n\n    /**\n     * Retrieve a max number of {@link OrganizationalUnit} instances given a name pattern.\n     * <p>\n     * <p>Examples:</p>\n     * <ul>\n     * <li>{@code searchByName(\"\", 20, true);} => get 20 instances, no matter their name</li>\n     * <li>{@code searchByName(\"A\", 10, true);} => get the first 10 instances that match the letter A</li>\n     * <li>{@code searchByName(\"alfa\", -1, false);} => get all the instances which name contains the word \"alfa\" (case unsensitive)</li>\n     * </ul>\n     * @param pattern An string fragment which must be present in any of the instances retrieved.\n     * @param maxItems Max number of instances to retrieve. This setting is ruled out if zero or negative.\n     * @param caseSensitive Case sensitiveness flag\n     * @return A collection of {@link OrganizationalUnit} instances\n     */\n    Collection<OrganizationalUnit> searchByName(String pattern,\n                                                int maxItems,\n                                                boolean caseSensitive);\n\n    /**\n     * Retrieve a collection of {@link OrganizationalUnit} instances given their identifier.\n     * <p>\n     * <p>Example:</p>\n     * <ul>\n     * <li>{@code searchById(Arrays.asList(\"orgunit1\"));} => get the \"orgunit1\" instance</li>\n     * </ul>\n     * @param ids A collection of identifiers\n     * @return A collection of {@link OrganizationalUnit} instances\n     */\n    Collection<OrganizationalUnit> searchById(Collection<String> ids);\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/OrganizationalUnitService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.Predicate;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.spaces.Space;\n\n@Remote\npublic interface OrganizationalUnitService {\n\n    /**\n     * Get the OU with the specified name. Security checks are omitted. Returns null if the OU with that name is deleted.\n     */\n    OrganizationalUnit getOrganizationalUnit(final String name);\n\n    OrganizationalUnit getOrganizationalUnit(final String name,\n                                             final boolean includeDeleted);\n\n    /**\n     * Get all the OUs. Security checks are omitted. Deleted OUs waiting for removal are NOT included.\n     */\n    Collection<OrganizationalUnit> getAllOrganizationalUnits();\n\n    Collection<OrganizationalUnit> getAllOrganizationalUnits(final boolean includeDeleted);\n\n    Collection<OrganizationalUnit> getAllOrganizationalUnits(boolean includeDeleted, Predicate<OrganizationalUnit> filter);\n\n    Collection<OrganizationalUnit> getAllDeletedOrganizationalUnit();\n\n    Collection<Space> getAllUserSpaces();\n\n    /**\n     * Get only those OUs available within the current security context. Deleted OUs waiting for removal are NOT included.\n     */\n    Collection<OrganizationalUnit> getOrganizationalUnits();\n\n    Collection<OrganizationalUnit> getOrganizationalUnits(final boolean includeDeleted);\n\n    OrganizationalUnit createOrganizationalUnit(final String name,\n                                                final String defaultGroupId);\n\n    OrganizationalUnit createOrganizationalUnit(final String name,\n                                                final String defaultGroupId,\n                                                final Collection<Repository> repositories);\n\n    OrganizationalUnit createOrganizationalUnit(final String name,\n                                                final String defaultGroupId,\n                                                final Collection<Repository> repositories,\n                                                final Collection<Contributor> contributors);\n\n    OrganizationalUnit createOrganizationalUnit(final String name,\n                                                final String defaultGroupId,\n                                                final Collection<Repository> repositories,\n                                                final Collection<Contributor> contributors,\n                                                final String description);\n\n    OrganizationalUnit updateOrganizationalUnit(final String name,\n                                                final String defaultGroupId);\n\n\n    OrganizationalUnit updateOrganizationalUnit(final String name,\n                                                final String defaultGroupId,\n                                                final Collection<Contributor> contributors);\n\n    OrganizationalUnit updateOrganizationalUnit(final String name,\n                                                final String defaultGroupId,\n                                                final Collection<Contributor> contributors,\n                                                final String description );\n\n    void addRepository(final OrganizationalUnit organizationalUnit,\n                       final Repository repository);\n\n    void removeRepository(final OrganizationalUnit organizationalUnit,\n                          final Repository repository);\n\n    void addGroup(final OrganizationalUnit organizationalUnit,\n                  final String group);\n\n    void removeGroup(final OrganizationalUnit organizationalUnit,\n                     final String group);\n\n    void removeOrganizationalUnit(final String name);\n\n    OrganizationalUnit getParentOrganizationalUnit(final Repository repository);\n\n    List<OrganizationalUnit> getOrganizationalUnits(final Repository repository);\n\n    String getSanitizedDefaultGroupId(final String proposedGroupId);\n\n    Boolean isValidGroupId(final String proposedGroupId);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/RemoveOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class RemoveOrganizationalUnitEvent extends OrganizationalUnitEventBase {\n\n    public RemoveOrganizationalUnitEvent() {\n    }\n\n    public RemoveOrganizationalUnitEvent(final OrganizationalUnit organizationalUnit,\n                                         final String userName) {\n        super(organizationalUnit,\n              userName);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/RepoAddedToOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepoAddedToOrganizationalUnitEvent extends OrganizationalUnitEventBase {\n\n    private Repository repository;\n\n    public RepoAddedToOrganizationalUnitEvent() {\n    }\n\n    public RepoAddedToOrganizationalUnitEvent(final OrganizationalUnit organizationalUnit,\n                                              final Repository repository,\n                                              final String userName) {\n        super(organizationalUnit,\n              userName);\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n\n    public void setRepository(Repository repository) {\n        this.repository = repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/RepoRemovedFromOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepoRemovedFromOrganizationalUnitEvent extends OrganizationalUnitEventBase {\n\n    private Repository repository;\n\n    public RepoRemovedFromOrganizationalUnitEvent() {\n    }\n\n    public RepoRemovedFromOrganizationalUnitEvent(final OrganizationalUnit organizationalUnit,\n                                                  final Repository repository,\n                                                  final String userName) {\n        super(organizationalUnit,\n              userName);\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n\n    public void setRepository(Repository repository) {\n        this.repository = repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/UpdatedOrganizationalUnitEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class UpdatedOrganizationalUnitEvent extends OrganizationalUnitEventBase {\n\n    public UpdatedOrganizationalUnitEvent() {\n    }\n\n    public UpdatedOrganizationalUnitEvent(OrganizationalUnit organizationalUnit,\n                                          String userName) {\n        super(organizationalUnit,\n              userName);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/BranchPermissions.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class BranchPermissions {\n\n    private String branchName;\n\n    private Map<String, RolePermissions> permissionsByRole;\n\n    public BranchPermissions() {\n    }\n\n    public BranchPermissions(@MapsTo(\"branchName\") final String branchName,\n                             @MapsTo(\"permissionsByRole\") final Map<String, RolePermissions> permissionsByRole) {\n        this.branchName = branchName;\n        this.permissionsByRole = permissionsByRole;\n    }\n\n    public String getBranchName() {\n        return branchName;\n    }\n\n    public Map<String, RolePermissions> getPermissionsByRole() {\n        return permissionsByRole;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = branchName != null ? branchName.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + ( permissionsByRole != null ? permissionsByRole.hashCode() : 0 );\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/RepositoryConfiguration.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepositoryConfiguration {\n\n    private Map<String, Object> environment;\n\n    public RepositoryConfiguration() {\n        this.environment = new HashMap<>();\n    }\n\n    public RepositoryConfiguration(@MapsTo(\"environment\") Map<String, Object> environment) {\n        this.environment = environment;\n    }\n\n    public void add(String key,\n                    Object value) {\n        this.environment.put(key,\n                             value);\n    }\n\n    public <T> T get(Class<T> clazz,\n                     String key) {\n        return (T) this.environment.get(key);\n    }\n\n    public <T> T get(Class<T> clazz,\n                     String key,\n                     T defaultValue) {\n        return (T) this.environment.getOrDefault(key,\n                                                 defaultValue);\n    }\n\n    public Map<String, Object> getEnvironment() {\n        return this.environment;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/RepositoryInfo.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.EnvironmentParameters;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepositoryInfo {\n\n    private static final String CONTRIBUTORS = \"contributors\";\n    private static final String SECURITY_GROUPS = \"security:groups\";\n    private String name;\n    private boolean deleted;\n    private RepositoryConfiguration configuration;\n\n    public RepositoryInfo(@MapsTo(\"name\") String name,\n                          @MapsTo(\"deleted\") boolean deleted,\n                          @MapsTo(\"configuration\") RepositoryConfiguration configuration) {\n\n        this.name = name;\n        this.deleted = deleted;\n        this.configuration = configuration;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public boolean isDeleted() {\n        return deleted;\n    }\n\n    public void setDeleted(boolean deleted) {\n        this.deleted = deleted;\n    }\n\n    public List<Contributor> getContributors() {\n        return this.configuration.get(List.class,\n                                      CONTRIBUTORS,\n                                      new ArrayList<Contributor>());\n    }\n\n    public String getScheme() {\n        return this.configuration.get(String.class,\n                                      EnvironmentParameters.SCHEME,\n                                      \"\");\n    }\n\n    public List<String> getSecurityGroups() {\n        return this.configuration.get(List.class,\n                                      SECURITY_GROUPS,\n                                      new ArrayList());\n    }\n\n    public boolean isAvoidIndex() {\n        return this.configuration.get(Boolean.class,\n                                      EnvironmentParameters.AVOID_INDEX,\n                                      false);\n    }\n\n    public String getSpace() {\n        return this.configuration.get(String.class,\n                                      EnvironmentParameters.SPACE,\n                                      \"\");\n    }\n\n    public RepositoryConfiguration getConfiguration() {\n        return configuration;\n    }\n\n    public void setConfiguration(RepositoryConfiguration configuration) {\n        this.configuration = configuration;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/RolePermissions.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RolePermissions {\n\n    private String roleName;\n\n    private boolean canRead;\n\n    private boolean canWrite;\n\n    private boolean canDelete;\n\n    private boolean canDeploy;\n\n    public RolePermissions() {\n    }\n\n    public RolePermissions(@MapsTo(\"roleName\") final String roleName,\n                           @MapsTo(\"canRead\") final boolean canRead,\n                           @MapsTo(\"canWrite\") final boolean canWrite,\n                           @MapsTo(\"canDelete\") final boolean canDelete,\n                           @MapsTo(\"canDeploy\") final boolean canDeploy) {\n        this.roleName = roleName;\n        this.canRead = canRead;\n        this.canWrite = canWrite;\n        this.canDelete = canDelete;\n        this.canDeploy = canDeploy;\n    }\n\n    public String getRoleName() {\n        return roleName;\n    }\n\n    public void setRoleName(final String roleName) {\n        this.roleName = roleName;\n    }\n\n    public boolean canRead() {\n        return canRead;\n    }\n\n    public void setCanRead(final boolean canRead) {\n        this.canRead = canRead;\n    }\n\n    public boolean canWrite() {\n        return canWrite;\n    }\n\n    public void setCanWrite(final boolean canWrite) {\n        this.canWrite = canWrite;\n    }\n\n    public boolean canDelete() {\n        return canDelete;\n    }\n\n    public void setCanDelete(final boolean canDelete) {\n        this.canDelete = canDelete;\n    }\n\n    public boolean canDeploy() {\n        return canDeploy;\n    }\n\n    public void setCanDeploy(boolean canDeploy) {\n        this.canDeploy = canDeploy;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = roleName != null ? roleName.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + Boolean.valueOf(canRead).hashCode();\n        result = ~~result;\n        result = 31 * result + Boolean.valueOf(canWrite).hashCode();\n        result = ~~result;\n        result = 31 * result + Boolean.valueOf(canDelete).hashCode();\n        result = ~~result;\n        result = 31 * result + Boolean.valueOf(canDeploy).hashCode();\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/SpaceConfigStorage.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.List;\n\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestComment;\n\npublic interface SpaceConfigStorage {\n\n    void setup(final String spaceName);\n\n    SpaceInfo loadSpaceInfo();\n\n    void saveSpaceInfo(final SpaceInfo spaceInfo);\n\n    BranchPermissions loadBranchPermissions(final String branchName,\n                                            final String projectIdentifier);\n\n    void saveBranchPermissions(final String branchName,\n                               final String projectIdentifier,\n                               final BranchPermissions branchPermissions);\n\n    void deleteBranchPermissions(final String branchName,\n                                 final String projectIdentifier);\n\n    boolean isInitialized();\n\n    void startBatch();\n\n    void endBatch();\n\n    void close();\n\n    void deleteRepository(final String repositoryAlias);\n\n    List<ChangeRequest> loadChangeRequests(final String repositoryAlias);\n\n    ChangeRequest loadChangeRequest(final String repositoryAlias,\n                                    final Long changeRequestId);\n\n    void saveChangeRequest(final String repositoryAlias,\n                           final ChangeRequest changeRequest);\n\n    void deleteAllChangeRequests(final String repositoryAlias);\n\n    void deleteChangeRequest(final String repositoryAlias,\n                             final Long changeRequestId);\n\n    List<Long> getChangeRequestIds(final String repositoryAlias);\n\n    List<ChangeRequestComment> loadChangeRequestComments(final String repositoryAlias,\n                                                         final Long changeRequestId);\n\n    ChangeRequestComment loadChangeRequestComment(final String repositoryAlias,\n                                                  final Long changeRequestId,\n                                                  final Long changeRequestCommentId);\n\n    void saveChangeRequestComment(final String repositoryAlias,\n                                  final Long changeRequestId,\n                                  final ChangeRequestComment changeRequestComment);\n\n    void deleteAllChangeRequestComments(final String repositoryAlias,\n                                        final Long changeRequestId);\n\n    void deleteChangeRequestComment(final String repositoryAlias,\n                                    final Long changeRequestId,\n                                    final Long changeRequestCommentId);\n\n    List<Long> getChangeRequestCommentIds(final String repositoryAlias,\n                                          final Long changeRequestId);\n\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/SpaceConfigStorageBatch.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.function.Function;\n\npublic interface SpaceConfigStorageBatch {\n\n    <T> T run(Function<SpaceConfigStorageBatchContext, T> consumer);\n\n    interface SpaceConfigStorageBatchContext {\n\n        SpaceInfo getSpaceInfo();\n\n        void saveSpaceInfo();\n\n        Object getOwner();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/SpaceConfigStorageRegistry.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\npublic interface SpaceConfigStorageRegistry {\n\n    SpaceConfigStorage get(final String spaceName);\n\n    SpaceConfigStorageBatch getBatch(final String spaceName);\n\n    void remove(final String spaceName);\n\n    boolean exist(String name);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/SpaceInfo.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.security.Contributor;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class SpaceInfo {\n\n    private String name;\n\n    private String description;\n\n    private String defaultGroupId;\n\n    private Collection<Contributor> contributors;\n\n    private List<RepositoryInfo> repositories;\n\n    private List<String> securityGroups;\n\n    public SpaceInfo(@MapsTo(\"name\") final String name,\n                     @MapsTo(\"description\") final String description,\n                     @MapsTo(\"defaultGroupId\") final String defaultGroupId,\n                     @MapsTo(\"contributors\") final Collection<Contributor> contributors,\n                     @MapsTo(\"repositories\") final List<RepositoryInfo> repositories,\n                     @MapsTo(\"securityGroups\") final List<String> securityGroups) {\n        this.name = name;\n        this.description = description;\n        this.defaultGroupId = defaultGroupId;\n        this.contributors = contributors;\n        this.repositories = repositories;\n        this.securityGroups = securityGroups;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(String description) {\n        this.description = description;\n    }\n\n    public String getDefaultGroupId() {\n        return defaultGroupId;\n    }\n\n    public void setDefaultGroupId(String defaultGroupId) {\n        this.defaultGroupId = defaultGroupId;\n    }\n\n    public Collection<Contributor> getContributors() {\n        return contributors;\n    }\n\n    public void setContributors(Collection<Contributor> contributors) {\n        this.contributors = contributors;\n    }\n\n    public List<RepositoryInfo> getRepositories() {\n        return repositories;\n    }\n\n    public List<RepositoryInfo> getRepositories(Predicate<RepositoryInfo> query) {\n        return repositories.stream().filter(query).collect(Collectors.toList());\n    }\n\n    public void setRepositories(List<RepositoryInfo> repositories) {\n        this.repositories = repositories;\n    }\n\n    public List<String> getSecurityGroups() {\n        return securityGroups;\n    }\n\n    public void setSecurityGroups(List<String> securityGroups) {\n        this.securityGroups = securityGroups;\n    }\n\n    public void removeRepository(String name) {\n        this.getRepositories().removeIf(repo -> repo.getName().equals(name));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/config/SpaceState.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit.config;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class SpaceState {\n\n    private boolean locked;\n\n    public SpaceState(@MapsTo(\"locked\") final boolean locked) {\n        this.locked = locked;\n    }\n\n    public boolean isLocked() {\n        return locked;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/organizationalunit/impl/OrganizationalUnitImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.organizationalunit.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Optional;\n\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.spaces.Space;\n\n@Portable\npublic class OrganizationalUnitImpl implements OrganizationalUnit {\n\n    private String name;\n    private String description;\n    private String defaultGroupId;\n    private boolean deleted;\n\n    private Collection<Repository> repositories = new ArrayList<>();\n    private Collection<String> groups = new ArrayList<>();\n    private Collection<Contributor> contributors = new ArrayList<>();\n    private boolean requiresRefresh = true;\n\n    public OrganizationalUnitImpl() {\n    }\n\n    public OrganizationalUnitImpl(final String name,\n                                  final String defaultGroupId) {\n        this(name, defaultGroupId, false);\n    }\n\n    public OrganizationalUnitImpl(final String name,\n                                  final String defaultGroupId,\n                                  final boolean deleted) {\n        this.name = name;\n        this.defaultGroupId = defaultGroupId;\n        this.deleted = deleted;\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public String getDescription() {\n        return description;\n    }\n\n    @Override\n    public Space getSpace() {\n        return new Space(name);\n    }\n\n    @Override\n    public String getOwner() {\n        final Optional<Contributor> owner = contributors.stream().filter(c -> c.getType().equals(ContributorType.OWNER)).findFirst();\n        return owner.map(Contributor::getUsername).orElse(null);\n    }\n\n    @Override\n    public String getDefaultGroupId() {\n        return defaultGroupId;\n    }\n\n    @Override\n    public Collection<Repository> getRepositories() {\n        return repositories;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return getName();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return RESOURCE_TYPE;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof OrganizationalUnitImpl)) {\n            return false;\n        }\n\n        OrganizationalUnitImpl ou = (OrganizationalUnitImpl) o;\n\n        if (name != null ? !name.equals(ou.name) : ou.name != null) {\n            return false;\n        }\n        if (defaultGroupId != null ? !defaultGroupId.equals(ou.defaultGroupId) : ou.defaultGroupId != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? name.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (defaultGroupId != null ? defaultGroupId.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"OrganizationalUnitImpl [name=\" + name + \", repositories=\" + repositories\n                + \", groups=\" + groups + \", contributors=\" + contributors + \", defaultGroupId=\" + defaultGroupId\n                + \", deleted=\" + deleted + \"]\";\n    }\n\n    @Override\n    public void markAsCached() {\n        this.requiresRefresh = false;\n    }\n\n    @Override\n    public boolean requiresRefresh() {\n        return requiresRefresh;\n    }\n\n    @Override\n    public Collection<String> getGroups() {\n        return groups;\n    }\n\n    @Override\n    public Collection<Contributor> getContributors() {\n        return contributors;\n    }\n    @Override\n    public boolean isDeleted() {\n        return deleted;\n    }\n\n    @Override\n    public void setDescription(String description) {\n       this.description = description;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/pom/AddPomDependencyEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.pom;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/***\n * Event to add dependency type to a pom in a project\n */\n@Portable\npublic class AddPomDependencyEvent {\n\n    private Path projectPath;\n    private DependencyType type;\n\n    public AddPomDependencyEvent(@MapsTo(\"dependencyType\") final DependencyType type,\n                                 @MapsTo(\"projectPath\") final Path projectPath) {\n        this.type = checkNotNull(\"dependencyType\",\n                                 type);\n        this.projectPath = checkNotNull(\"projectPath\",\n                                        projectPath);\n    }\n\n    public Path getProjectPath() {\n        return projectPath;\n    }\n\n    public DependencyType getDependencyType() {\n        return type;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/pom/DependencyType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.pom;\n\n/***\n * Types managed by the Pom's event\n */\npublic enum DependencyType {\n    JPA\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/pom/DynamicPomDependency.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.pom;\n\n/***\n * Dependency used to add Maven dependencies on the pom\n */\npublic class DynamicPomDependency {\n\n    private String groupID, artifactID, version, scope;\n\n    public DynamicPomDependency(String groupID,\n                                String artifactID,\n                                String version,\n                                String scope) {\n        this.groupID = groupID;\n        this.artifactID = artifactID;\n        this.version = version;\n        this.scope = scope;\n    }\n\n    public String getGroupID() {\n        return groupID;\n    }\n\n    public String getArtifactID() {\n        return artifactID;\n    }\n\n    public String getVersion() {\n        return version;\n    }\n\n    public String getScope() {\n        return scope;\n    }\n\n    @Override\n    public String toString() {\n        final StringBuilder sb = new StringBuilder(\"DynamicPomDependency{\");\n        sb.append(\"groupID='\").append(groupID).append('\\'');\n        sb.append(\", artifactID='\").append(artifactID).append('\\'');\n        sb.append(\", version='\").append(version).append('\\'');\n        sb.append(\", scope='\").append(scope).append('\\'');\n        sb.append('}');\n        return sb.toString();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/Branch.java",
    "content": "package org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class Branch {\n\n    private String name;\n    private Path path;\n\n    public Branch() {\n    }\n\n    public Branch(final String name,\n                  final Path path) {\n        this.name = checkNotNull(\"name\",\n                                 name);\n        this.path = checkNotNull(\"path\",\n                                 path);\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        Branch branch = (Branch) o;\n\n        if (name != null ? !name.equals(branch.name) : branch.name != null) {\n            return false;\n        }\n        return path != null ? path.equals(branch.path) : branch.path == null;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = name != null ? ~~name.hashCode() : 0;\n        result = 31 * result + (path != null ? ~~path.hashCode() : 0);\n        return ~~result;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/EnvironmentParameters.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\n/**\n * Magic Strings for common environment parameter names\n */\npublic class EnvironmentParameters {\n\n    public static final String SCHEME = \"scheme\";\n\n    public static final String SPACE = \"space\";\n\n    public static final String MANAGED = \"managed\";\n\n    public static final String ORIGIN = \"origin\";\n\n    public static final String BRANCHES = \"branches\";\n\n    public static final String SUBDIRECTORY = \"subdirectory\";\n\n    public static final String USER_NAME = \"username\";\n\n    public static final String PASSWORD = \"password\";\n\n    public static final String SECURE_PREFIX = \"secure:\";\n\n    public static final String CRYPT_PREFIX = \"crypt:\";\n\n    public static final String CRYPT_PASSWORD = CRYPT_PREFIX + PASSWORD;\n\n    public static final String INIT = \"init\";\n\n    public static final String AVOID_INDEX = \"avoid_index\";\n\n    public static final String MIRROR = \"mirror\";\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/GitMetadata.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.List;\n\n/**\n * Represents information about a repository. It contains the origin name\n * the forks it has, and the repository name.\n */\npublic interface GitMetadata {\n\n    /**\n     * Returns repository name\n     * @return the repository name\n     */\n    String getName();\n\n    /**\n     * Returns the list of forks names it has\n     * @return the list of forks names\n     */\n    List<String> getForks();\n\n    /**\n     * The name of the its origin repository\n     * @return\n     */\n    String getOrigin();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/GitMetadataStore.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Optional;\n\npublic interface GitMetadataStore {\n\n    /**\n     * Writes the meta information about a repository without an origin.\n     * @param name The name of the repository.\n     */\n    void write(String name);\n\n    /**\n     * Writes the meta information about a repository and its origin.\n     * The origin must be in organizationalUnit/repositoryName format\n     * @param name The name of the repository\n     * @param origin The name of the origin in organizationalUnit/repositoryName format\n     */\n    void write(String name,\n               String origin);\n\n    /**\n     * Writes the meta information about a repository and its origin.\n     * The origin must be in organizationalUnit/repositoryName format\n     * @param name The name of the repository\n     * @param origin The name of the origin in organizationalUnit/repositoryName format\n     * @param lock Determines if the FileSystem should be locked or not\n     */\n    void write(String name,\n               String origin,\n               boolean lock);\n\n    /**\n     * Writes the meta information about a repository.\n     * @param name The name of the repository\n     * @param metadata The metadata object that stores information about repository\n     */\n    void write(String name,\n               GitMetadata metadata);\n\n    /**\n     * Writes the meta information about a repository.\n     * @param name The name of the repository\n     * @param metadata The metadata object that stores information about repository\n     * @param lock Determines if the FileSystem should be locked or not\n     */\n    void write(String name,\n               GitMetadata metadata,\n               boolean lock);\n\n    /**\n     * Reads the git metadata from repository.\n     * @param name the repository name\n     * @return\n     */\n    Optional<GitMetadata> read(String name);\n\n    /**\n     * Deletes that repository meta information and removes its reference from the origin and forks.\n     * @param name The repository name\n     */\n    void delete(String name);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/NewBranchEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\n@Clustered\npublic class NewBranchEvent {\n\n    private final Repository repository;\n    private final String newBranchName;\n    private final String fromBranchName;\n    private final String userIdentifier;\n\n    public NewBranchEvent(@MapsTo(\"repository\") final Repository repository,\n                          @MapsTo(\"newBranchName\") final String newBranchName,\n                          @MapsTo(\"fromBranchName\") final String fromBranchName,\n                          @MapsTo(\"userIdentifier\") final String userIdentifier) {\n\n        this.repository = checkNotNull(\"repository\", repository);\n        this.newBranchName = checkNotNull(\"newBranchName\", newBranchName);\n        this.fromBranchName = checkNotNull(\"fromBranchName\", fromBranchName);\n        this.userIdentifier = checkNotNull(\"userIdentifier\", userIdentifier);\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n\n    public String getNewBranchName() {\n        return newBranchName;\n    }\n\n    public String getFromBranchName() {\n        return fromBranchName;\n    }\n\n    public String getUserIdentifier() {\n        return userIdentifier;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/NewRepositoryEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NewRepositoryEvent {\n\n    private final Repository newRepository;\n\n    public NewRepositoryEvent(@MapsTo(\"newRepository\") final Repository newRepository) {\n        this.newRepository = newRepository;\n    }\n\n    public Repository getNewRepository() {\n        return newRepository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/PublicURI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\npublic interface PublicURI {\n\n    String getProtocol();\n\n    String getURI();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/Repository.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.security.RepositoryResourceType;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.commons.data.Cacheable;\nimport org.uberfire.security.ContributorResource;\nimport org.uberfire.security.authz.RuntimeContentResource;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\npublic interface Repository\n        extends ContributorResource, RuntimeContentResource,\n                Cacheable {\n\n    RepositoryResourceType RESOURCE_TYPE = new RepositoryResourceType();\n\n    /**\n     * Most of the time, this can not be used as an unique ID.\n     * If the Repository has branches each branch has the same alias.\n     * @return short name for the repository\n     */\n    String getAlias();\n\n    SpacesAPI.Scheme getScheme();\n\n    Space getSpace();\n\n    Map<String, Object> getEnvironment();\n\n    void addEnvironmentParameter(final String key,\n                                 final Object value);\n\n    boolean isValid();\n\n    String getUri();\n\n    List<PublicURI> getPublicURIs();\n\n    Optional<Branch> getBranch(final String branch);\n\n    Optional<Branch> getBranch(final Path branchRoot);\n\n    Collection<String> getGroups();\n\n    /**\n     * Returns \"read-only\" view of all branches available in this repository.\n     * @return\n     */\n    Collection<Branch> getBranches();\n\n    /**\n     * In the case of Git repository this would be master.\n     * @return empty if there are no branches.\n     */\n    Optional<Branch> getDefaultBranch();\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryAlreadyExistsException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepositoryAlreadyExistsException extends RuntimeException {\n\n    public RepositoryAlreadyExistsException() {\n        super();\n    }\n\n    public RepositoryAlreadyExistsException(final String alias) {\n        super(alias);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryCopier.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.repositories;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.spaces.Space;\n\npublic interface RepositoryCopier {\n\n    /**\n     * Notice that this does not clone the content from the origin,\n     * this doeas a copy that does not include the history or the old commits IDs.\n     * @param targetOU The OU for the new Repository\n     * @param newRepositoryName Name for the new Repository\n     * @param originRoot Root where the Repository is cloned from\n     * @return The new Repository\n     */\n    Repository copy(final OrganizationalUnit targetOU,\n                    final String newRepositoryName,\n                    final Path originRoot);\n\n    /**\n     * Like {@link #copy(Path, Path)} but assumes current active space.\n     */\n    void copy(Path originRoot,\n              Path targetRoot);\n\n    void copy(Space space,\n              Path originRoot,\n              Path targetRoot);\n\n    String makeSafeRepositoryName(String oldName);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryEnvironmentConfiguration.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.guvnor.structure.repositories.EnvironmentParameters.CRYPT_PREFIX;\n\n@Portable\npublic class RepositoryEnvironmentConfiguration {\n\n    private String name;\n    private Object value;\n\n    /**\n     * Please use the constructor with parameters.\n     * This constructor is here to keep the class Portable.\n     */\n    @Deprecated\n    public RepositoryEnvironmentConfiguration() {\n    }\n\n    public RepositoryEnvironmentConfiguration(final String name,\n                                              final Object value) {\n        this.name = name;\n        this.value = value;\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public Object getValue() {\n        return value;\n    }\n\n    public boolean isSecuredConfigurationItem() {\n        return name.startsWith(CRYPT_PREFIX);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryEnvironmentConfigurations.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.guvnor.structure.repositories.EnvironmentParameters.BRANCHES;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.INIT;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.MANAGED;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.MIRROR;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.ORIGIN;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.CRYPT_PASSWORD;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.SPACE;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.SUBDIRECTORY;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.USER_NAME;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.AVOID_INDEX;\n\n@Portable\npublic class RepositoryEnvironmentConfigurations {\n\n    private Map<String, Object> configurationMap = new HashMap<>();\n\n    public Map<String, Object> getConfigurationMap() {\n        return configurationMap;\n    }\n\n    public List<RepositoryEnvironmentConfiguration> getConfigurationList() {\n\n        List<RepositoryEnvironmentConfiguration> list = new ArrayList<>();\n\n        for (Map.Entry<String, Object> entry : configurationMap.entrySet()) {\n            list.add(new RepositoryEnvironmentConfiguration(entry.getKey(),\n                                                            entry.getValue()));\n        }\n\n        return list;\n    }\n\n    public boolean containsConfiguration(final String configurationName) {\n        return configurationMap.containsKey(configurationName);\n    }\n\n    public void setSpace(final String space) {\n        configurationMap.put(SPACE,\n                             space);\n    }\n\n    public void setManaged(final boolean managed) {\n        configurationMap.put(MANAGED,\n                             managed);\n    }\n\n    public void setOrigin(final String origin) {\n        configurationMap.put(ORIGIN,\n                             origin);\n    }\n\n    public void setUserName(final String user) {\n        configurationMap.put(USER_NAME,\n                             user);\n    }\n\n    public void setPassword(final String password) {\n        configurationMap.put(CRYPT_PASSWORD,\n                             password);\n    }\n\n    public void setInit(final boolean init) {\n        configurationMap.put(INIT,\n                             init);\n    }\n\n    public void setAvoidIndex(final boolean avoidIndex) {\n        configurationMap.put(AVOID_INDEX,\n                             avoidIndex);\n    }\n\n    public Object getInit() {\n        return configurationMap.get(INIT);\n    }\n\n    public Object getUserName() {\n        return configurationMap.get(USER_NAME);\n    }\n\n    public Object getPassword() {\n        return configurationMap.get(CRYPT_PASSWORD);\n    }\n\n    public Object getOrigin() {\n        return configurationMap.get(ORIGIN);\n    }\n\n    public void setSubdirectory(String rootWithoutSpace) {\n        configurationMap.put(SUBDIRECTORY, rootWithoutSpace);\n    }\n\n    public Object getSubdirectory() {\n        return configurationMap.get(SUBDIRECTORY);\n    }\n\n    public void setBranches(List<String> branches) {\n        configurationMap.put(BRANCHES, branches);\n    }\n\n    public Object getBranches() {\n        return configurationMap.get(BRANCHES);\n    }\n\n    public void setMirror(boolean mirror) {\n        configurationMap.put(MIRROR, mirror);\n    }\n\n    public Object getMirror() {\n        return configurationMap.get(MIRROR);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryEnvironmentUpdatedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Fired if the Environment settings for a Repository change.\n */\n@Portable\npublic class RepositoryEnvironmentUpdatedEvent {\n\n    private Repository updatedRepository;\n\n    public RepositoryEnvironmentUpdatedEvent() {\n    }\n\n    public RepositoryEnvironmentUpdatedEvent(final Repository updatedRepository) {\n        this.updatedRepository = updatedRepository;\n    }\n\n    public Repository getUpdatedRepository() {\n        return updatedRepository;\n    }\n\n    public void setUpdatedRepository(final Repository updatedRepository) {\n        this.updatedRepository = updatedRepository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryExternalUpdateEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\nimport org.uberfire.spaces.Space;\n\n@Portable\n@Clustered\npublic class RepositoryExternalUpdateEvent {\n\n    private Repository repository;\n\n    public RepositoryExternalUpdateEvent() {\n    }\n\n    public RepositoryExternalUpdateEvent(final Repository repository) {\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\n@Portable\npublic class RepositoryInfo {\n\n    private String id;\n    private String alias;\n    private String owner;\n    private Path root;\n    private List<PublicURI> publicURIs = new ArrayList<PublicURI>();\n    private List<VersionRecord> versionList = new ArrayList<VersionRecord>();\n\n    public RepositoryInfo() {\n    }\n\n    public RepositoryInfo(final String id,\n                          final String alias,\n                          final String owner,\n                          final Path root,\n                          final List<PublicURI> publicURIs,\n                          final List<VersionRecord> versionList) {\n        this.id = id;\n        this.alias = alias;\n        this.owner = owner;\n        this.root = root;\n        this.publicURIs = publicURIs;\n        this.versionList = versionList;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public List<PublicURI> getPublicURIs() {\n        return publicURIs;\n    }\n\n    public String getAlias() {\n        return alias;\n    }\n\n    public List<VersionRecord> getInitialVersionList() {\n        return versionList;\n    }\n\n    public String getOwner() {\n        return owner;\n    }\n\n    public Path getRoot() {\n        return root;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof RepositoryInfo)) {\n            return false;\n        }\n\n        RepositoryInfo that = (RepositoryInfo) o;\n\n        if (alias != null ? !alias.equals(that.alias) : that.alias != null) {\n            return false;\n        }\n        if (owner != null ? !owner.equals(that.owner) : that.owner != null) {\n            return false;\n        }\n        if (publicURIs != null ? !publicURIs.equals(that.publicURIs) : that.publicURIs != null) {\n            return false;\n        }\n        if (root != null ? !root.equals(that.root) : that.root != null) {\n            return false;\n        }\n        if (versionList != null ? !versionList.equals(that.versionList) : that.versionList != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = alias != null ? alias.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (owner != null ? owner.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (root != null ? root.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (publicURIs != null ? publicURIs.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (versionList != null ? versionList.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"RepositoryInfo{\" +\n                \"alias='\" + alias + '\\'' +\n                \", owner='\" + owner + '\\'' +\n                \", root=\" + root +\n                \", publicURIs=\" + publicURIs +\n                \", versionList=\" + versionList +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryNotFoundException.java",
    "content": "/*\n * 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class RepositoryNotFoundException extends RuntimeException {\n\n    public RepositoryNotFoundException() {\n        super();\n    }\n\n    public RepositoryNotFoundException(String message) {\n        super(message);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryRemovedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class RepositoryRemovedEvent {\n\n    private Repository repository;\n\n    /**\n     * You should always use the constructor with parameters.\n     * This constructor is here just keep this Portable.\n     */\n    @Deprecated()\n    public RepositoryRemovedEvent() {\n    }\n\n    public RepositoryRemovedEvent(final Repository repository) {\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositorySearchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Collection;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\n\n/**\n * {@link Repository} remote search interface\n */\n@Remote\npublic interface RepositorySearchService {\n\n    /**\n     * Retrieve a max number of {@link Repository} instances given a name pattern.\n     * <p>\n     * <p>Examples:</p>\n     * <ul>\n     * <li>{@code searchByAlias(\"\", 20, true);} => get 20 instances, no matter their name</li>\n     * <li>{@code searchByAlias(\"A\", 10, true);} => get the first 10 instances that match the letter A</li>\n     * <li>{@code searchByAlias(\"alfa\", -1, false);} => get all the instances which name contains the word \"alfa\" (case unsensitive)</li>\n     * </ul>\n     * @param namePattern An string fragment which must be present in any of the instances retrieved.\n     * @param maxItems Max number of instances to retrieve. This setting is ruled out if zero or negative.\n     * @param caseSensitive Case sensitiveness flag\n     * @return A collection of {@link Repository} instances\n     */\n    Collection<Repository> searchByAlias(String namePattern,\n                                         int maxItems,\n                                         boolean caseSensitive);\n\n    /**\n     * Retrieve a collection of {@link Repository} instances given their identifier.\n     * <p>\n     * <p>Example:</p>\n     * <ul>\n     * <li>{@code searchById(Arrays.asList(\"repo1\"));} => get the \"repo1\" instance</li>\n     * </ul>\n     * @param ids A collection of identifiers\n     * @return A collection of {@link Repository} instances\n     */\n    Collection<Repository> searchById(Collection<String> ids);\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.spaces.Space;\n\n@Remote\n/**\n * This RepositoryService is dependent on the WorkspaceProjectContext.\n * It uses WorkspaceProjectContext in order to lookup for the current space.\n *\n * The only exception is getRepositoryFromSpace(space, alias) and\n * getAllRepositoriesFromAllSpaces methods.\n *\n */\npublic interface RepositoryService {\n\n    RepositoryInfo getRepositoryInfo(final Space space,\n                                     final String alias);\n\n    List<VersionRecord> getRepositoryHistory(final Space space,\n                                             final String alias,\n                                             final int startIndex);\n\n    List<VersionRecord> getRepositoryHistory(final Space space,\n                                             final String alias,\n                                             final int startIndex,\n                                             final int endIndex);\n\n    List<VersionRecord> getRepositoryHistoryAll(final Space space,\n                                                final String alias);\n\n    Repository getRepositoryFromSpace(final Space currentSpace,\n                                      final String alias);\n\n    Repository getRepository(final Path root);\n\n    Repository getRepository(final Space space,\n                             final Path root);\n\n    /**\n     * Get all the repositories. Security checks are omitted.\n     */\n    Collection<Repository> getAllRepositories(final Space space);\n\n    /**\n     * Get all the repositories. Security checks are omitted.\n     */\n    Collection<Repository> getAllRepositories(final Space space,\n                                              final boolean includeDeleted);\n\n    /**\n     * Get all the repositories. Security checks are omitted.\n     */\n    Collection<Repository> getAllDeletedRepositories(final Space space);\n\n    /**\n     * Get all the repositories from all user spaces. Security checks are omitted.\n     */\n    Collection<Repository> getAllRepositoriesFromAllUserSpaces();\n\n    /**\n     * Get only those repositories available within the current security context.\n     */\n    Collection<Repository> getRepositories(final Space space);\n\n    Repository createRepository(final OrganizationalUnit organizationalUnit,\n                                final String scheme,\n                                final String alias,\n                                final RepositoryEnvironmentConfigurations configurations) throws RepositoryAlreadyExistsException;\n\n    Repository createRepository(final OrganizationalUnit organizationalUnit,\n                                final String scheme,\n                                final String alias,\n                                final RepositoryEnvironmentConfigurations configurations,\n                                final Collection<Contributor> contributors) throws RepositoryAlreadyExistsException;\n\n    String normalizeRepositoryName(final String name);\n\n    boolean validateRepositoryName(final String name);\n\n    void addGroup(final Repository repository,\n                  final String group);\n\n    void removeGroup(final Repository repository,\n                     final String group);\n\n    void updateContributors(Repository repository,\n                            List<Contributor> contributors);\n\n    void removeRepository(final Space space,\n                          final String alias);\n\n    /**\n     * Unlike {@link #removeRepository(Space, String)}, this method does not fire CDI events, since it is meant to be invoked\n     * by other services while removing other constructs (such as an entire space).\n     */\n    void removeRepositories(final Space space,\n                            final Set<String> aliases);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryServiceEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.List;\n\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\n\n@Remote\npublic interface RepositoryServiceEditor {\n\n    List<VersionRecord> revertHistory(final String alias,\n                                      final Path path,\n                                      final String comment,\n                                      final VersionRecord record);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryUpdatedEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class RepositoryUpdatedEvent {\n\n    private Repository repository;\n\n    public RepositoryUpdatedEvent() {\n    }\n\n    public RepositoryUpdatedEvent(final Repository repository) {\n        this.repository = repository;\n    }\n\n    public Repository getRepository() {\n        return repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/RepositoryUtils.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\npublic class RepositoryUtils {\n\n    private static final List<String> KEYS_TO_SEARCH = Arrays.asList(EnvironmentParameters.USER_NAME,\n                                                                     EnvironmentParameters.PASSWORD,\n                                                                     EnvironmentParameters.SECURE_PREFIX +\n                                                                             EnvironmentParameters.PASSWORD);\n\n    private RepositoryUtils() {\n    }\n\n    public static List<String> cleanUpCredentialsFromEnvMap(final Map<String, Object> envMap) {\n        return KEYS_TO_SEARCH\n                .stream()\n                .filter(key -> envMap.remove(key) != null)\n                .collect(Collectors.toList());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/ChangeRequestPredicates.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest;\n\nimport java.util.List;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\n\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatus;\n\npublic class ChangeRequestPredicates {\n\n    private ChangeRequestPredicates() {\n\n    }\n\n    public static Predicate<ChangeRequest> matchAll() {\n        return elem -> true;\n    }\n\n    public static Predicate<ChangeRequest> matchId(final Long id) {\n        return elem -> elem.getId() == id;\n    }\n\n    public static Predicate<ChangeRequest> matchSearchFilter(final String searchFilter,\n                                                             final Function<ChangeRequest, String> searchableElementFunction) {\n        return elem -> searchableElementFunction.apply(elem).contains(searchFilter.toLowerCase());\n    }\n\n    public static Predicate<ChangeRequest> matchStatus(final ChangeRequestStatus status) {\n        return elem -> elem.getStatus() == status;\n    }\n\n    public static Predicate<ChangeRequest> matchInStatusList(final List<ChangeRequestStatus> statusList) {\n        return elem -> statusList.contains(elem.getStatus());\n    }\n\n    public static Predicate<ChangeRequest> matchInTargetBranchList(final List<String> targetBranches) {\n        return elem -> targetBranches.contains(elem.getTargetBranch());\n    }\n\n    public static Predicate<ChangeRequest> matchSourceBranch(final String branch) {\n        return elem -> elem.getSourceBranch().equals(branch);\n    }\n\n    public static Predicate<ChangeRequest> matchTargetBranch(final String branch) {\n        return elem -> elem.getTargetBranch().equals(branch);\n    }\n\n    public static Predicate<ChangeRequest> matchSearchFilterAndStatusList(final String searchFilter,\n                                                                          final Function<ChangeRequest, String> searchableElementFunction,\n                                                                          final List<ChangeRequestStatus> statusList) {\n        return matchSearchFilter(searchFilter,\n                                 searchableElementFunction)\n                .and(matchInStatusList(statusList));\n    }\n\n    public static Predicate<ChangeRequest> matchSourceOrTargetBranch(final String branchName) {\n        return matchSourceBranch(branchName)\n                .or(matchTargetBranch(branchName));\n    }\n\n    public static Predicate<ChangeRequest> matchSourceAndTargetAndStatus(final String sourceBranchName,\n                                                                         final String targetBranchName,\n                                                                         final ChangeRequestStatus status) {\n        return matchSourceBranch(sourceBranchName)\n                .and(matchTargetBranch(targetBranchName)\n                             .and(matchStatus(status)));\n    }\n\n    public static Predicate<ChangeRequest> matchTargetBranchListAndOtherPredicate(final List<String> targetBranches,\n                                                                                  final Predicate<ChangeRequest> predicate) {\n        return matchInTargetBranchList(targetBranches).and(predicate);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/ChangeRequestService.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest;\n\nimport java.util.List;\n\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestCommit;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestCountSummary;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestDiff;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatus;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestCommentList;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestList;\nimport org.jboss.errai.bus.server.annotations.Remote;\nimport org.uberfire.rpc.SessionInfo;\nimport org.jboss.errai.security.shared.api.identity.User;\n\n/**\n * Service that contains the basic mechanism to administrate change requests.\n * Every change request depends on its repository.\n * The change request id is unique in every repository, but it can be repeated\n * across them.\n */\n@Remote\npublic interface ChangeRequestService {\n\n    /**\n     * Creates a change request and stores it into the tracking system.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param sourceBranch    the branch where you want to get pulled\n     * @param targetBranch    the branch where you want impact your changes\n     * @param summary         the short summary of the change request\n     * @param description     the description of the change request\n     * @return The object that represents the change request.\n     */\n    ChangeRequest createChangeRequest(final String spaceName,\n                                      final String repositoryAlias,\n                                      final String sourceBranch,\n                                      final String targetBranch,\n                                      final String summary,\n                                      final String description);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @return The list of change requests.\n     */\n    List<ChangeRequest> getChangeRequests(final String spaceName,\n                                          final String repositoryAlias);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param filter          a string to filter the results\n     * @return The list of change requests.\n     */\n    List<ChangeRequest> getChangeRequests(final String spaceName,\n                                          final String repositoryAlias,\n                                          final String filter);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param statusList      change request status to filter the results\n     * @return The list of change requests.\n     */\n    List<ChangeRequest> getChangeRequests(final String spaceName,\n                                          final String repositoryAlias,\n                                          final List<ChangeRequestStatus> statusList);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param statusList      change request status to filter the results\n     * @param filter          a string to filter the results\n     * @return The list of change requests.\n     */\n    List<ChangeRequest> getChangeRequests(final String spaceName,\n                                          final String repositoryAlias,\n                                          final List<ChangeRequestStatus> statusList,\n                                          final String filter);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param page            the desired page\n     * @param pageSize        the size of the page\n     * @param filter          a string to filter the results\n     * @return The list of change requests.\n     */\n    PaginatedChangeRequestList getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias,\n                                                 final Integer page,\n                                                 final Integer pageSize,\n                                                 final String filter);\n\n    /**\n     * Retrieves the list of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @param page            the desired page\n     * @param pageSize        the size of the page\n     * @param statusList      change request status to filter the results\n     * @param filter          a string to filter the results\n     * @return The list of change requests.\n     */\n    PaginatedChangeRequestList getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias,\n                                                 final Integer page,\n                                                 final Integer pageSize,\n                                                 final List<ChangeRequestStatus> statusList,\n                                                 final String filter);\n\n    /**\n     * Retrieves the change request with the given id.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @return The change request.\n     */\n    ChangeRequest getChangeRequest(final String spaceName,\n                                   final String repositoryAlias,\n                                   final Long changeRequestId);\n\n    /**\n     * Retrieves the number of change requests that the user is able to visualize.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository alias\n     * @return The number of change requests.\n     */\n    ChangeRequestCountSummary countChangeRequests(final String spaceName,\n                                                  final String repositoryAlias);\n\n    /**\n     * Obtains differences between branches.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the origin repository\n     * @param sourceBranch    the source branch\n     * @param targetBranch    the target branch\n     * @return The list of differences between files.\n     */\n    List<ChangeRequestDiff> getDiff(final String spaceName,\n                                    final String repositoryAlias,\n                                    final String sourceBranch,\n                                    final String targetBranch);\n\n    /**\n     * Obtains differences between branches involved in the given change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the origin repository\n     * @param changeRequestId the id of the change request\n     * @return The list of differences between files.\n     */\n    List<ChangeRequestDiff> getDiff(final String spaceName,\n                                    final String repositoryAlias,\n                                    final Long changeRequestId);\n\n    /**\n     * Deletes all change requests associated with the given branch.\n     *\n     * @param spaceName            the space containing the origin repository\n     * @param repositoryAlias      the origin repository\n     * @param associatedBranchName branch name\n     */\n    void deleteChangeRequests(final String spaceName,\n                              final String repositoryAlias,\n                              final String associatedBranchName);\n\n    /**\n     * Deletes all change requests associated with the given branch.\n     *\n     * @param spaceName            the space containing the origin repository\n     * @param repositoryAlias      the origin repository\n     * @param associatedBranchName branch name\n     * @param userIdentififer      user identifier\n     */\n    void deleteChangeRequests(final String spaceName,\n                              final String repositoryAlias,\n                              final String associatedBranchName,\n                              final String userIdentifier);\n\n    /**\n     * Rejects the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     */\n    void rejectChangeRequest(final String spaceName,\n                             final String repositoryAlias,\n                             final Long changeRequestId);\n\n    /**\n     * Merges the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @return True if the merge operation succeeded, otherwise false.\n     */\n    Boolean mergeChangeRequest(final String spaceName,\n                               final String repositoryAlias,\n                               final Long changeRequestId);\n\n    /**\n     * Reverts the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @return True if the revert operation succeeded, otherwise false.\n     */\n    Boolean revertChangeRequest(final String spaceName,\n                                final String repositoryAlias,\n                                final Long changeRequestId);\n\n    /**\n     * Closes the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     */\n    void closeChangeRequest(final String spaceName,\n                            final String repositoryAlias,\n                            final Long changeRequestId);\n\n    /**\n     * Reopens the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     */\n    void reopenChangeRequest(final String spaceName,\n                             final String repositoryAlias,\n                             final Long changeRequestId);\n\n    /**\n     * Updates the change request summary.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @param updatedSummary  updated summary of the change request\n     */\n    void updateChangeRequestSummary(final String spaceName,\n                                    final String repositoryAlias,\n                                    final Long changeRequestId,\n                                    final String updatedSummary);\n\n    /**\n     * Updates the change request description.\n     *\n     * @param spaceName          the space containing the origin repository\n     * @param repositoryAlias    the repository used as a filter\n     * @param changeRequestId    the id of the change request\n     * @param updatedDescription updated description of the change request\n     */\n    void updateChangeRequestDescription(final String spaceName,\n                                        final String repositoryAlias,\n                                        final Long changeRequestId,\n                                        final String updatedDescription);\n\n    /**\n     * Obtains all the comments associated with a change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @param page            the desired page\n     * @param pageSize        the size of the page\n     * @return The list of comments\n     */\n    PaginatedChangeRequestCommentList getComments(final String spaceName,\n                                                  final String repositoryAlias,\n                                                  final Long changeRequestId,\n                                                  final Integer page,\n                                                  final Integer pageSize);\n\n    /**\n     * Adds a comment to the change request comment list.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @param text            the comment text\n     */\n    void addComment(final String spaceName,\n                    final String repositoryAlias,\n                    final Long changeRequestId,\n                    final String text);\n\n    /**\n     * Deletes a comment from the change request comment list.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @param commentId       the id of the comment\n     */\n    void deleteComment(final String spaceName,\n                       final String repositoryAlias,\n                       final Long changeRequestId,\n                       final Long commentId);\n\n    /**\n     * Get commits from the change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @return The list of commits\n     */\n    List<ChangeRequestCommit> getCommits(final String spaceName,\n                                         final String repositoryAlias,\n                                         final Long changeRequestId);\n\n    /**\n     * Squash change request.\n     *\n     * @param spaceName       the space containing the origin repository\n     * @param repositoryAlias the repository used as a filter\n     * @param changeRequestId the id of the change request\n     * @param commitMessage   the comment of squash commit\n     * @return True if the squash operation succeeded, otherwise false.\n     */\n    Boolean squashChangeRequest(final String spaceName,\n                                final String repositoryAlias,\n                                final Long changeRequestId,\n                                final String commitMessage);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Date;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class ChangeRequest {\n\n    private Long id;\n    private String spaceName;\n    private String repositoryAlias;\n    private String sourceBranch;\n    private String targetBranch;\n    private ChangeRequestStatus status;\n    private String authorId;\n    private String summary;\n    private String description;\n    private Date createdDate;\n    private Integer changedFilesCount;\n    private Integer commentsCount;\n    private String startCommitId;\n    private String endCommitId;\n    private String mergeCommitId;\n    private Boolean conflict;\n\n    public ChangeRequest(final long id,\n                         final String spaceName,\n                         final String repositoryAlias,\n                         final String sourceBranch,\n                         final String targetBranch,\n                         final String authorId,\n                         final String summary,\n                         final String description,\n                         final String startCommitId) {\n        this(id,\n             spaceName,\n             repositoryAlias,\n             sourceBranch,\n             targetBranch,\n             ChangeRequestStatus.OPEN,\n             authorId,\n             summary,\n             description,\n             new Date(),\n             startCommitId);\n    }\n\n    public ChangeRequest(final long id,\n                         final String spaceName,\n                         final String repositoryAlias,\n                         final String sourceBranch,\n                         final String targetBranch,\n                         final ChangeRequestStatus status,\n                         final String authorId,\n                         final String summary,\n                         final String description,\n                         final Date createdDate,\n                         final String startCommitId) {\n        this(id,\n             spaceName,\n             repositoryAlias,\n             sourceBranch,\n             targetBranch,\n             status,\n             authorId,\n             summary,\n             description,\n             createdDate,\n             startCommitId,\n             null,\n             null);\n    }\n\n    public ChangeRequest(final long id,\n                         final String spaceName,\n                         final String repositoryAlias,\n                         final String sourceBranch,\n                         final String targetBranch,\n                         final ChangeRequestStatus status,\n                         final String authorId,\n                         final String summary,\n                         final String description,\n                         final Date createdDate,\n                         final String startCommitId,\n                         final String endCommitId,\n                         final String mergeCommitId) {\n        this(id,\n             spaceName,\n             repositoryAlias,\n             sourceBranch,\n             targetBranch,\n             status,\n             authorId,\n             summary,\n             description,\n             createdDate,\n             0,\n             0,\n             startCommitId,\n             endCommitId,\n             mergeCommitId,\n             false);\n    }\n\n    public ChangeRequest(@MapsTo(\"id\") final Long id,\n                         @MapsTo(\"spaceName\") final String spaceName,\n                         @MapsTo(\"repositoryAlias\") final String repositoryAlias,\n                         @MapsTo(\"sourceBranch\") final String sourceBranch,\n                         @MapsTo(\"targetBranch\") final String targetBranch,\n                         @MapsTo(\"status\") final ChangeRequestStatus status,\n                         @MapsTo(\"authorId\") final String authorId,\n                         @MapsTo(\"summary\") final String summary,\n                         @MapsTo(\"description\") final String description,\n                         @MapsTo(\"createdDate\") final Date createdDate,\n                         @MapsTo(\"changedFilesCount\") final Integer changedFilesCount,\n                         @MapsTo(\"commentsCount\") final Integer commentsCount,\n                         @MapsTo(\"startCommitId\") final String startCommitId,\n                         @MapsTo(\"endCommitId\") final String endCommitId,\n                         @MapsTo(\"mergeCommitId\") final String mergeCommitId,\n                         @MapsTo(\"conflict\") final Boolean conflict) {\n\n        this.id = checkNotNull(\"id\",\n                               id);\n        this.spaceName = checkNotEmpty(\"spaceName\",\n                                       spaceName);\n        this.repositoryAlias = checkNotEmpty(\"repositoryAlias\",\n                                             repositoryAlias);\n        this.sourceBranch = checkNotEmpty(\"sourceBranch\",\n                                          sourceBranch);\n        this.targetBranch = checkNotEmpty(\"targetBranch\",\n                                          targetBranch);\n        this.status = checkNotNull(\"status\",\n                                   status);\n        this.authorId = checkNotEmpty(\"authorId\",\n                                      authorId);\n        this.summary = checkNotEmpty(\"summary\",\n                                     summary);\n        this.description = checkNotEmpty(\"description\",\n                                         description);\n        this.createdDate = checkNotNull(\"createdDate\",\n                                        createdDate);\n        this.changedFilesCount = checkNotNull(\"changedFilesCount\",\n                                              changedFilesCount);\n        this.commentsCount = checkNotNull(\"commentsCount\",\n                                          commentsCount);\n        this.startCommitId = checkNotEmpty(\"startCommitId\",\n                                           startCommitId);\n        this.endCommitId = endCommitId; // can be null\n        this.mergeCommitId = mergeCommitId; // can be null\n        this.conflict = checkNotNull(\"conflict\",\n                                     conflict);\n    }\n\n    public long getId() {\n        return this.id;\n    }\n\n    public String getSpaceName() {\n        return this.spaceName;\n    }\n\n    public String getRepositoryAlias() {\n        return this.repositoryAlias;\n    }\n\n    public String getSourceBranch() {\n        return this.sourceBranch;\n    }\n\n    public String getTargetBranch() {\n        return this.targetBranch;\n    }\n\n    public ChangeRequestStatus getStatus() {\n        return this.status;\n    }\n\n    public String getAuthorId() {\n        return this.authorId;\n    }\n\n    public String getSummary() {\n        return this.summary;\n    }\n\n    public String getDescription() {\n        return this.description;\n    }\n\n    public Date getCreatedDate() {\n        return this.createdDate;\n    }\n\n    public Integer getChangedFilesCount() {\n        return this.changedFilesCount;\n    }\n\n    public Integer getCommentsCount() {\n        return this.commentsCount;\n    }\n\n    public String getStartCommitId() {\n        return startCommitId;\n    }\n\n    public String getEndCommitId() {\n        return endCommitId;\n    }\n\n    public String getMergeCommitId() {\n        return mergeCommitId;\n    }\n\n    public Boolean isConflict() {\n        return conflict;\n    }\n\n    @Override\n    public String toString() {\n        return \"(#\" + this.id + \") \" + this.summary;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequest that = (ChangeRequest) o;\n        return id.equals(that.id) &&\n                spaceName.equals(that.spaceName) &&\n                repositoryAlias.equals(that.repositoryAlias) &&\n                sourceBranch.equals(that.sourceBranch) &&\n                targetBranch.equals(that.targetBranch) &&\n                status == that.status &&\n                authorId.equals(that.authorId) &&\n                summary.equals(that.summary) &&\n                description.equals(that.description) &&\n                createdDate.equals(that.createdDate) &&\n                changedFilesCount.equals(that.changedFilesCount) &&\n                commentsCount.equals(that.commentsCount) &&\n                startCommitId.equals(that.startCommitId) &&\n                endCommitId.equals(that.endCommitId) &&\n                mergeCommitId.equals(that.getMergeCommitId()) &&\n                conflict.equals(that.conflict);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(id,\n                            spaceName,\n                            repositoryAlias,\n                            sourceBranch,\n                            targetBranch,\n                            status,\n                            authorId,\n                            summary,\n                            description,\n                            createdDate,\n                            changedFilesCount,\n                            commentsCount,\n                            startCommitId,\n                            endCommitId,\n                            mergeCommitId,\n                            conflict);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestAlreadyOpenException.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ChangeRequestAlreadyOpenException extends RuntimeException {\n\n    private final Long changeRequestId;\n\n    public ChangeRequestAlreadyOpenException(@MapsTo(\"changeRequestId\") final Long changeRequestId) {\n        super(\"Change request already open with id #\" + changeRequestId);\n        this.changeRequestId = changeRequestId;\n    }\n\n    public Long getChangeRequestId() {\n        return changeRequestId;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestAlreadyOpenException that = (ChangeRequestAlreadyOpenException) o;\n        return changeRequestId.equals(that.changeRequestId);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(changeRequestId);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestComment.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Date;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class ChangeRequestComment {\n\n    private Long id;\n    private String authorId;\n    private Date createdDate;\n    private String text;\n\n    public ChangeRequestComment(@MapsTo(\"id\") final Long id,\n                                @MapsTo(\"authorId\") final String authorId,\n                                @MapsTo(\"createdDate\") final Date createdDate,\n                                @MapsTo(\"text\") final String text) {\n        this.id = checkNotNull(\"id\", id);\n        this.authorId = checkNotEmpty(\"authorId\", authorId);\n        this.createdDate = checkNotNull(\"createdDate\", createdDate);\n        this.text = checkNotEmpty(\"text\", text);\n    }\n\n    public Long getId() {\n        return id;\n    }\n\n    public String getAuthorId() {\n        return authorId;\n    }\n\n    public Date getCreatedDate() {\n        return createdDate;\n    }\n\n    public String getText() {\n        return text;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestComment that = (ChangeRequestComment) o;\n        return id.equals(that.id) &&\n                authorId.equals(that.authorId) &&\n                createdDate.equals(that.createdDate) &&\n                text.equals(that.text);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(id,\n                            authorId,\n                            createdDate,\n                            text);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestCommit.java",
    "content": "package org.guvnor.structure.repositories.changerequest.portable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\n\n@Portable\npublic class ChangeRequestCommit {\n\n    private String id;\n    private String message;\n\n    public ChangeRequestCommit(@MapsTo(\"id\") final String id,\n                               @MapsTo(\"message\") final String message) {\n        this.id = id;\n        this.message = message;\n    }\n\n    public String getId() {\n        return id;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestCountSummary.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class ChangeRequestCountSummary {\n\n    private Integer total;\n    private Integer open;\n\n    public ChangeRequestCountSummary(@MapsTo(\"total\") final Integer total,\n                                     @MapsTo(\"open\") final Integer open) {\n        this.total = total;\n        this.open = open;\n    }\n\n    public Integer getTotal() {\n        return total;\n    }\n\n    public Integer getOpen() {\n        return open;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestCountSummary that = (ChangeRequestCountSummary) o;\n        return total.equals(that.total) &&\n                open.equals(that.open);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(total, open);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestDiff.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class ChangeRequestDiff {\n\n    private Path oldFilePath;\n    private Path newFilePath;\n    private ChangeType changeType;\n    private Integer addedLinesCount;\n    private Integer deletedLinesCount;\n    private String diffText;\n    private Boolean conflict;\n\n    public ChangeRequestDiff(@MapsTo(\"oldFilePath\") final Path oldFilePath,\n                             @MapsTo(\"newFilePath\") final Path newFilePath,\n                             @MapsTo(\"changeType\") final ChangeType changeType,\n                             @MapsTo(\"addedLinesCount\") final Integer addedLinesCount,\n                             @MapsTo(\"deletedLinesCount\") final Integer deletedLinesCount,\n                             @MapsTo(\"diffText\") final String diffText,\n                             @MapsTo(\"conflict\") final Boolean conflict) {\n        this.oldFilePath = checkNotNull(\"oldFilePath\", oldFilePath);\n        this.newFilePath = checkNotNull(\"newFilePath\", newFilePath);\n        this.changeType = checkNotNull(\"changeType\", changeType);\n        this.addedLinesCount = checkNotNull(\"addedLinesCount\", addedLinesCount);\n        this.deletedLinesCount = checkNotNull(\"deletedLinesCount\", deletedLinesCount);\n        this.diffText = checkNotEmpty(\"diffText\", diffText);\n        this.conflict = checkNotNull(\"conflict\", conflict);\n    }\n\n    public Path getOldFilePath() {\n        return oldFilePath;\n    }\n\n    public Path getNewFilePath() {\n        return newFilePath;\n    }\n\n    public ChangeType getChangeType() {\n        return changeType;\n    }\n\n    public Integer getAddedLinesCount() {\n        return addedLinesCount;\n    }\n\n    public Integer getDeletedLinesCount() {\n        return deletedLinesCount;\n    }\n\n    public String getDiffText() {\n        return diffText;\n    }\n\n    public Boolean isConflict() {\n        return conflict;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestDiff that = (ChangeRequestDiff) o;\n        return oldFilePath.equals(that.oldFilePath) &&\n                newFilePath.equals(that.newFilePath) &&\n                changeType == that.changeType &&\n                addedLinesCount.equals(that.addedLinesCount) &&\n                deletedLinesCount.equals(that.deletedLinesCount) &&\n                diffText.equals(that.diffText) &&\n                conflict == that.conflict;\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(oldFilePath,\n                            newFilePath,\n                            changeType,\n                            addedLinesCount,\n                            deletedLinesCount,\n                            diffText,\n                            conflict);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestListUpdatedEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class ChangeRequestListUpdatedEvent {\n\n    private final String repositoryId;\n\n    public ChangeRequestListUpdatedEvent(final @MapsTo(\"repositoryId\") String repositoryId) {\n        this.repositoryId = repositoryId;\n    }\n\n    public String getRepositoryId() {\n        return repositoryId;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestListUpdatedEvent that = (ChangeRequestListUpdatedEvent) o;\n        return repositoryId.equals(that.repositoryId);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(repositoryId);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestStatus.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Represents change request status.\n * OPEN: when the CR is created.\n * ACCEPTED: when the changes are accepted and merged.\n * REJECTED: when reviewers have rejected the changes.\n * REVERTED: when the CR was accepted and then reverted.\n * REVERT_FAILED: when an attempt to revert the CR has failed.\n * CLOSED: when an open CR is closed.\n */\n@Portable\npublic enum ChangeRequestStatus {\n    ACCEPTED,\n    REJECTED,\n    OPEN,\n    REVERTED,\n    REVERT_FAILED,\n    CLOSED\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestStatusUpdatedEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class ChangeRequestStatusUpdatedEvent {\n\n    private final String repositoryId;\n    private final Long changeRequestId;\n    private final ChangeRequestStatus oldStatus;\n    private final ChangeRequestStatus newStatus;\n    private final String userId;\n\n    public ChangeRequestStatusUpdatedEvent(@MapsTo(\"repositoryId\") final String repositoryId,\n                                           @MapsTo(\"changeRequestId\") final Long changeRequestId,\n                                           @MapsTo(\"oldStatus\") final ChangeRequestStatus oldStatus,\n                                           @MapsTo(\"newStatus\") final ChangeRequestStatus newStatus,\n                                           @MapsTo(\"userId\") final String userId) {\n        this.repositoryId = repositoryId;\n        this.changeRequestId = changeRequestId;\n        this.oldStatus = oldStatus;\n        this.newStatus = newStatus;\n        this.userId = userId;\n    }\n\n    public String getRepositoryId() {\n        return repositoryId;\n    }\n\n    public Long getChangeRequestId() {\n        return changeRequestId;\n    }\n\n    public ChangeRequestStatus getOldStatus() {\n        return oldStatus;\n    }\n\n    public ChangeRequestStatus getNewStatus() {\n        return newStatus;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestStatusUpdatedEvent that = (ChangeRequestStatusUpdatedEvent) o;\n        return repositoryId.equals(that.repositoryId) &&\n                changeRequestId.equals(that.changeRequestId) &&\n                oldStatus == that.oldStatus &&\n                newStatus == that.newStatus &&\n                userId.equals(that.userId);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(repositoryId,\n                            changeRequestId,\n                            oldStatus,\n                            newStatus,\n                            userId);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeRequestUpdatedEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.commons.clusterapi.Clustered;\n\n@Portable\n@Clustered\npublic class ChangeRequestUpdatedEvent {\n\n    private final String repositoryId;\n    private final Long changeRequestId;\n    private final String userId;\n\n    public ChangeRequestUpdatedEvent(final @MapsTo(\"repositoryId\") String repositoryId,\n                                     final @MapsTo(\"changeRequestId\") Long changeRequestId,\n                                     final @MapsTo(\"userId\") String userId) {\n        this.repositoryId = repositoryId;\n        this.changeRequestId = changeRequestId;\n        this.userId = userId;\n    }\n\n    public String getRepositoryId() {\n        return repositoryId;\n    }\n\n    public Long getChangeRequestId() {\n        return changeRequestId;\n    }\n\n    public String getUserId() {\n        return userId;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        ChangeRequestUpdatedEvent that = (ChangeRequestUpdatedEvent) o;\n        return repositoryId.equals(that.repositoryId) &&\n                changeRequestId.equals(that.changeRequestId) &&\n                userId.equals(that.userId);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(repositoryId,\n                            changeRequestId,\n                            userId);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/ChangeType.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n/**\n * Represents the type of the change.\n * ADD: when the file is added.\n * MODIFY: when the file is modified.\n * DELETE: when the file is deleted.\n * RENAME: when the file is renamed.\n * COPY: when the file is copied.\n */\n@Portable\npublic enum ChangeType {\n    ADD,\n    MODIFY,\n    DELETE,\n    RENAME,\n    COPY\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/NothingToMergeException.java",
    "content": "package org.guvnor.structure.repositories.changerequest.portable;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class NothingToMergeException extends RuntimeException {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/PaginatedChangeRequestCommentList.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.List;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class PaginatedChangeRequestCommentList {\n\n    private List<ChangeRequestComment> changeRequestComments;\n\n    private Integer pageNumber;\n\n    private Integer pageSize;\n\n    private Integer total;\n\n    public PaginatedChangeRequestCommentList(@MapsTo(\"changeRequestComments\") final List<ChangeRequestComment> changeRequestComments,\n                                             @MapsTo(\"pageNumber\") final Integer pageNumber,\n                                             @MapsTo(\"pageSize\") final Integer pageSize,\n                                             @MapsTo(\"total\") final Integer total) {\n        this.changeRequestComments = checkNotNull(\"changeRequestComments\",\n                                                  changeRequestComments);\n        this.pageNumber = checkNotNull(\"pageNumber\",\n                                       pageNumber);\n        this.pageSize = checkNotNull(\"pageSize\",\n                                     pageSize);\n        this.total = checkNotNull(\"total\",\n                                  total);\n    }\n\n    public List<ChangeRequestComment> getChangeRequestComments() {\n        return changeRequestComments;\n    }\n\n    public Integer getPageNumber() {\n        return pageNumber;\n    }\n\n    public Integer getPageSize() {\n        return pageSize;\n    }\n\n    public Integer getTotal() {\n        return total;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        PaginatedChangeRequestCommentList that = (PaginatedChangeRequestCommentList) o;\n        return changeRequestComments.equals(that.changeRequestComments) &&\n                pageNumber.equals(that.pageNumber) &&\n                pageSize.equals(that.pageSize) &&\n                total.equals(that.total);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(changeRequestComments,\n                            pageNumber,\n                            pageSize,\n                            total);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/changerequest/portable/PaginatedChangeRequestList.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.changerequest.portable;\n\nimport java.util.List;\nimport java.util.Objects;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Portable\npublic class PaginatedChangeRequestList {\n\n    private List<ChangeRequest> changeRequests;\n\n    private Integer pageNumber;\n\n    private Integer pageSize;\n\n    private Integer total;\n\n    public PaginatedChangeRequestList(@MapsTo(\"changeRequests\") final List<ChangeRequest> changeRequests,\n                                      @MapsTo(\"pageNumber\") final Integer pageNumber,\n                                      @MapsTo(\"pageSize\") final Integer pageSize,\n                                      @MapsTo(\"total\") final Integer total) {\n        this.changeRequests = checkNotNull(\"changeRequests\",\n                                           changeRequests);\n        this.pageNumber = checkNotNull(\"pageNumber\",\n                                       pageNumber);\n        this.pageSize = checkNotNull(\"pageSize\",\n                                     pageSize);\n        this.total = checkNotNull(\"total\",\n                                  total);\n    }\n\n    public List<ChangeRequest> getChangeRequests() {\n        return changeRequests;\n    }\n\n    public Integer getPageNumber() {\n        return pageNumber;\n    }\n\n    public Integer getPageSize() {\n        return pageSize;\n    }\n\n    public Integer getTotal() {\n        return total;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n        PaginatedChangeRequestList that = (PaginatedChangeRequestList) o;\n        return changeRequests.equals(that.changeRequests) &&\n                pageNumber.equals(that.pageNumber) &&\n                pageSize.equals(that.pageSize) &&\n                total.equals(that.total);\n    }\n\n    @Override\n    public int hashCode() {\n        return Objects.hash(changeRequests,\n                            pageNumber,\n                            pageSize,\n                            total);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/DefaultPublicURI.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.repositories.impl;\n\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class DefaultPublicURI implements PublicURI {\n\n    private String protocol;\n    private String uri;\n\n    public DefaultPublicURI() {\n    }\n\n    public DefaultPublicURI(final String uri) {\n        this(\"\",\n             uri);\n    }\n\n    public DefaultPublicURI(final String protocol,\n                            final String uri) {\n        this.protocol = protocol;\n        this.uri = uri;\n    }\n\n    @Override\n    public String getProtocol() {\n        return protocol;\n    }\n\n    public void setProtocol(String protocol) {\n        this.protocol = protocol;\n    }\n\n    @Override\n    public String getURI() {\n        return uri;\n    }\n\n    public void setURI(final String uri) {\n        this.uri = uri;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof DefaultPublicURI)) {\n            return false;\n        }\n\n        DefaultPublicURI publicURI = (DefaultPublicURI) o;\n\n        if (uri != null ? !uri.equals(publicURI.uri) : publicURI.uri != null) {\n            return false;\n        }\n        if (protocol != null ? !protocol.equals(publicURI.protocol) : publicURI.protocol != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = protocol != null ? protocol.hashCode() : 0;\n        result = ~~result;\n        result = 31 * result + (uri != null ? uri.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"DefaultPublicURI{\" +\n                \"protocol='\" + protocol + '\\'' +\n                \", uri='\" + uri + '\\'' +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/GitMetadataImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.guvnor.structure.repositories.GitMetadata;\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Represents information about a repository. It contains the origin name\n * the forks it has, the repository name.\n */\n@Portable\npublic class GitMetadataImpl implements GitMetadata {\n\n    private String origin;\n    private List<String> forks;\n    private String name;\n\n    public GitMetadataImpl(String name) {\n        this(name,\n             \"\",\n             new ArrayList<>());\n    }\n\n    public GitMetadataImpl(String name,\n                           String origin) {\n        this(name,\n             origin,\n             new ArrayList<>());\n    }\n\n    public GitMetadataImpl(String name,\n                           List<String> forks) {\n        this(name,\n             \"\",\n             forks);\n    }\n\n    public GitMetadataImpl(@MapsTo(\"name\") String name,\n                           @MapsTo(\"origin\") String origin,\n                           @MapsTo(\"forks\") List<String> forks) {\n        this.name = checkNotEmpty(\"name\",\n                                  name);\n        this.origin = checkNotNull(\"origin\",\n                                   origin);\n        this.forks = checkNotNull(\"forks\",\n                                  forks);\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public List<String> getForks() {\n        return new ArrayList<>(forks);\n    }\n\n    @Override\n    public String getOrigin() {\n        return origin;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/git/GitRepository.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.impl.git;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.uberfire.spaces.SpacesAPI.Scheme.GIT;\n\n@Portable\npublic class GitRepository\n        implements Repository {\n\n    public static final SpacesAPI.Scheme SCHEME = GIT;\n\n    private final Map<String, Object> environment = new HashMap<>();\n    private final List<PublicURI> publicURIs = new ArrayList<>();\n    private final Map<String, Branch> branches = new HashMap<>();\n    private String alias = null;\n    private Space space;\n\n    private Collection<String> groups = new ArrayList<>();\n    private Collection<Contributor> contributors = new ArrayList<>();\n    private boolean requiresRefresh = true;\n    private boolean deleted;\n\n    public GitRepository() {\n    }\n\n    public GitRepository(final String alias,\n                         Space space) {\n        this.alias = alias;\n        this.space = space;\n    }\n\n    public GitRepository(final String alias,\n                         final Space space,\n                         final List<PublicURI> publicURIs) {\n        this(alias,\n             space);\n\n        if (publicURIs != null && !publicURIs.isEmpty()) {\n            this.publicURIs.addAll(publicURIs);\n        }\n    }\n\n    @Override\n    public String getAlias() {\n        return alias;\n    }\n\n    @Override\n    public Space getSpace() {\n        return space;\n    }\n\n    @Override\n    public SpacesAPI.Scheme getScheme() {\n        return SCHEME;\n    }\n\n    @Override\n    public Map<String, Object> getEnvironment() {\n        return environment;\n    }\n\n    @Override\n    public void addEnvironmentParameter(String key,\n                                        Object value) {\n        environment.put(key,\n                        value);\n    }\n\n    public void setBranches(final Map<String, Branch> branches) {\n        this.branches.clear();\n        this.branches.putAll(branches);\n    }\n\n    @Override\n    public Collection<Branch> getBranches() {\n        return Collections.unmodifiableCollection(branches.values());\n    }\n\n    @Override\n    public Optional<Branch> getBranch(final String branchName) {\n        return Optional.ofNullable(branches.get(branchName));\n    }\n\n    @Override\n    public Optional<Branch> getBranch(Path branchRoot) {\n\n        for (final Branch branch : getBranches()) {\n            if (branch.getPath().equals(branchRoot)) {\n                return Optional.of(branch);\n            }\n        }\n\n        return Optional.empty();\n    }\n\n    @Override\n    public boolean isValid() {\n        return alias != null;\n    }\n\n    @Override\n    public String getUri() {\n\n        String fsName = SpacesAPI.sanitizeFileSystemName(getAlias());\n        return SpacesAPI.resolveFileSystemPath(getScheme(),\n                                               getSpace(),\n                                               fsName).toString();\n    }\n\n    @Override\n    public List<PublicURI> getPublicURIs() {\n        return publicURIs;\n    }\n\n    public void setPublicURIs(final List<PublicURI> publicURIs) {\n        if (publicURIs != null && !publicURIs.isEmpty()) {\n            this.publicURIs.clear();\n            this.publicURIs.addAll(publicURIs);\n        }\n    }\n\n    @Override\n    public String getIdentifier() {\n        return getUri();\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return RESOURCE_TYPE;\n    }\n\n    @Override\n    public Collection<String> getGroups() {\n        return groups;\n    }\n\n    public void setGroups(Collection<String> groups) {\n        this.groups = new ArrayList<>(groups);\n    }\n\n    @Override\n    public Collection<Contributor> getContributors() {\n        return contributors;\n    }\n\n    @Override\n    public Optional<Branch> getDefaultBranch() {\n        if (branches.containsKey(\"master\")) {\n            return getBranch(\"master\");\n        } else if (!branches.isEmpty()) {\n            return Optional.of(branches.values().iterator().next());\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (!(o instanceof GitRepository)) {\n            return false;\n        }\n\n        final GitRepository that = (GitRepository) o;\n\n        if (alias != null ? !alias.equals(that.alias) : that.alias != null) {\n            return false;\n        }\n        if (!environment.equals(that.environment)) {\n            return false;\n        }\n        if (!publicURIs.equals(that.publicURIs)) {\n            return false;\n        }\n        if (groups != null ? !groups.equals(that.groups) : that.groups != null) {\n            return false;\n        }\n        if (branches != null ? !branches.equals(that.branches) : that.branches != null) {\n            return false;\n        }\n\n        return true;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = environment.hashCode();\n        result = ~~result;\n        result = 31 * result + (publicURIs.hashCode());\n        result = ~~result;\n        result = 31 * result + (alias != null ? alias.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (groups != null ? groups.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (branches != null ? branches.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    @Override\n    public String toString() {\n        return \"GitRepository [alias=\" + alias + \", environment=\" + environment + \", groups=\" + groups\n                + \", publicURI=\" + publicURIs + \", branches=\" + branches + \"]\";\n    }\n\n    @Override\n    public void markAsCached() {\n        this.requiresRefresh = false;\n    }\n\n    @Override\n    public boolean requiresRefresh() {\n        return requiresRefresh;\n    }\n\n    public void addBranch(final Branch branch) {\n        branches.put(branch.getName(),\n                     branch);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/git/event/FileSystemHookNotificationEvent.java",
    "content": "package org.guvnor.structure.repositories.impl.git.event;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic abstract class FileSystemHookNotificationEvent implements UberFireEvent {\n\n    private NotificationType type;\n    private String text;\n\n    public FileSystemHookNotificationEvent(NotificationType type, String text) {\n        this.type = type;\n        this.text = text;\n    }\n\n    public NotificationType getType() {\n        return type;\n    }\n\n    public String getText() {\n        return text;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/git/event/NotificationType.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.impl.git.event;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\nimport java.util.stream.Stream;\n\n/**\n * Notification type for a give FileSystemHook exitCode\n */\n@Portable\npublic enum NotificationType {\n\n    SUCCESS(0, 0), WARNING(1, 30), ERROR(31, Integer.MAX_VALUE);\n\n    private int minValue;\n    private int maxValue;\n\n    NotificationType(int minValue, int maxValue) {\n        this.minValue = minValue;\n        this.maxValue = maxValue;\n    }\n\n    /**\n     * Determines if the given exitCode is in the range of the {@link NotificationType}\n     * @param exitCode The exit code to check\n     * @return True if the exit code is in the {@link NotificationType} false if not\n     */\n    boolean inRange(int exitCode) {\n        return minValue <= exitCode && exitCode <= maxValue;\n    }\n\n    /**\n     * Returns the {@link NotificationType} that matches a given exitCode\n     * @param exitCode The exit code to get it's notification type\n     * @return The {@link NotificationType} that has the exitCode in range, if not found it will return ERROR.\n     */\n    public static NotificationType fromExitCode(final int exitCode) {\n        return Stream.of(NotificationType.values())\n                .filter(type -> type.inRange(exitCode))\n                .findAny()\n                .orElse(ERROR);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/repositories/impl/git/event/PostCommitNotificationEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.impl.git.event;\n\nimport org.jboss.errai.common.client.api.annotations.MapsTo;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.jboss.errai.enterprise.client.cdi.api.Conversational;\n\n@Portable\n@Conversational\npublic class PostCommitNotificationEvent extends FileSystemHookNotificationEvent {\n\n    public PostCommitNotificationEvent(@MapsTo(\"type\") NotificationType type, @MapsTo(\"text\") String text) {\n        super(type, text);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/security/OrgUnitResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.security;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.ResourceType;\n\n/**\n * The {@link OrganizationalUnit} resource type definition.\n */\n@Portable\npublic class OrgUnitResourceType implements ResourceType {\n\n    @Override\n    public String getName() {\n        return \"orgunit\";\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/security/OrganizationalUnitAction.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.security;\n\nimport org.uberfire.security.ResourceAction;\n\npublic interface OrganizationalUnitAction extends ResourceAction {\n\n    OrganizationalUnitAction CREATE = () -> \"create\";\n    OrganizationalUnitAction UPDATE = () -> \"update\";\n    OrganizationalUnitAction DELETE = () -> \"delete\";\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/security/RepositoryAction.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.security;\n\nimport org.uberfire.security.ResourceAction;\n\npublic interface RepositoryAction extends ResourceAction {\n\n    RepositoryAction CREATE = () -> \"create\";\n    RepositoryAction UPDATE = () -> \"update\";\n    RepositoryAction DELETE = () -> \"delete\";\n    RepositoryAction BUILD = () -> \"build\";\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/security/RepositoryResourceType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.security;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.security.ResourceType;\n\n/**\n * The {@link Repository} resource type definition.\n */\n@Portable\npublic class RepositoryResourceType implements ResourceType {\n\n    @Override\n    public String getName() {\n        return \"repository\";\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/ConfigGroup.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\npublic class ConfigGroup {\n\n    private String name;\n    private String description;\n    private ConfigType type;\n    private String namespace;\n    private boolean enabled;\n\n    private Map<String, ConfigItem> items = new ConcurrentHashMap<String, ConfigItem>();\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(final String name) {\n        this.name = name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public void setDescription(final String description) {\n        this.description = description;\n    }\n\n    public ConfigType getType() {\n        return type;\n    }\n\n    public void setType(final ConfigType type) {\n        this.type = type;\n    }\n\n    public String getNamespace() {\n        return namespace;\n    }\n\n    public void setNamespace(String namespace) {\n        this.namespace = namespace;\n    }\n\n    public Collection<ConfigItem> getItems() {\n        return items.values();\n    }\n\n    public void addConfigItem(final ConfigItem configItem) {\n        if (!this.items.containsKey(configItem.getName())) {\n            setConfigItem(configItem);\n        }\n    }\n\n    public void setConfigItem(final ConfigItem configItem) {\n        this.items.put(configItem.getName(),\n                       configItem);\n    }\n\n    public ConfigItem getConfigItem(final String name) {\n        return this.items.get(name);\n    }\n\n    public void removeConfigItem(final String name) {\n        this.items.remove(name);\n    }\n\n    public String getConfigItemValue(final String name) {\n        ConfigItem<String> configItem = this.items.get(name);\n        if (configItem == null) {\n            return null;\n        } else {\n            return configItem.getValue();\n        }\n    }\n\n    public boolean isEnabled() {\n        return enabled;\n    }\n\n    public void setEnabled(final boolean enabled) {\n        this.enabled = enabled;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/ConfigItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\npublic class ConfigItem<T> {\n\n    private String name;\n    private T value;\n\n    public String getName() {\n        return name;\n    }\n\n    public void setName(String name) {\n        this.name = name;\n    }\n\n    public T getValue() {\n        return value;\n    }\n\n    public void setValue(T value) {\n        this.value = value;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/ConfigType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\npublic enum ConfigType {\n\n    GLOBAL(\".global\", \"global\", false),\n    @Deprecated ORGANIZATIONAL_UNIT(\".organizationalunit\", \"organizationalunits\", false), // Required for migration purposes.\n    SPACE(\".space\", \"spaces\", false),\n    REPOSITORY(\".repository\", \"repositories\", true),\n    PROJECT(\".project\", \"projects\", false),\n    EDITOR(\".editor\", \"editors\", false),\n    DEPLOYMENT(\".deployment\", \"deployments\", false);\n\n    private String ext;\n\n    private String dir;\n\n    private boolean hasNamespace;\n\n    ConfigType(final String ext,\n               final String dir,\n               final boolean hasNamespace) {\n        this.ext = ext;\n        this.dir = dir;\n        this.hasNamespace = hasNamespace;\n    }\n\n    public String getExt() {\n        return this.ext;\n    }\n\n    public String getDir() {\n        return dir;\n    }\n\n    public boolean hasNamespace() {\n        return hasNamespace;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/ConfigurationFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\nimport java.util.List;\n\npublic interface ConfigurationFactory {\n\n    ConfigGroup newConfigGroup(ConfigType type,\n                               String name,\n                               String description);\n\n    ConfigGroup newConfigGroup(ConfigType type,\n                               String namespace,\n                               String name,\n                               String description);\n\n    ConfigItem<String> newConfigItem(String name,\n                                     String valueType);\n\n    ConfigItem<Boolean> newConfigItem(String name,\n                                      boolean valueType);\n\n    SecureConfigItem newSecuredConfigItem(String name,\n                                          String valueType);\n\n    ConfigItem<List> newConfigItem(String name,\n                                   List valueType);\n\n    ConfigItem<Object> newConfigItem(String name,\n                                     Object valueType);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/ConfigurationService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\nimport java.util.List;\nimport java.util.Map;\n\npublic interface ConfigurationService {\n\n    public static final String LAST_MODIFIED_MARKER_FILE = \".lastmodified\";\n\n    void startBatch();\n\n    void endBatch();\n\n    List<ConfigGroup> getConfiguration(final ConfigType type);\n\n    List<ConfigGroup> getConfiguration(final ConfigType type,\n                                       final String namespace);\n\n    Map<String, List<ConfigGroup>> getConfigurationByNamespace(final ConfigType type);\n\n    boolean addConfiguration(final ConfigGroup configGroup);\n\n    boolean updateConfiguration(final ConfigGroup configGroup);\n\n    boolean removeConfiguration(final ConfigGroup configGroup);\n\n    boolean cleanUpSystemRepository();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/PasswordService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\npublic interface PasswordService {\n\n    String encrypt(String plainText);\n\n    String decrypt(String encryptedText);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/config/SecureConfigItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.config;\n\npublic class SecureConfigItem extends ConfigItem<String> {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/deployment/DeploymentConfigFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.deployment;\n\nimport org.guvnor.structure.deployment.DeploymentConfig;\nimport org.guvnor.structure.server.config.ConfigGroup;\n\npublic interface DeploymentConfigFactory {\n\n    DeploymentConfig newDeployment(ConfigGroup groupConfig);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/organizationalunit/OrganizationalUnitFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.server.organizationalunit;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.server.config.ConfigGroup;\n\npublic interface OrganizationalUnitFactory {\n\n    OrganizationalUnit newOrganizationalUnit(SpaceInfo spaceInfo);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/repositories/RepositoryFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.server.repositories;\n\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.Repository;\n\npublic interface RepositoryFactory {\n\n    Repository newRepository(final RepositoryInfo repositoryInfo);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/java/org/guvnor/structure/server/repositories/RepositoryFactoryHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.server.repositories;\n\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.Repository;\n\npublic interface RepositoryFactoryHelper {\n\n    boolean accept(RepositoryInfo repositoryInfo);\n\n    Repository newRepository(RepositoryInfo repositoryInfo);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/main/resources/org/guvnor/structure/GuvnorStructureAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.jboss.errai.bus.ErraiBus\"/>\n  <inherits name=\"org.uberfire.java.nio.UberfireNIO2Model\"/>\n  <inherits name=\"org.uberfire.UberfireAPI\"/>\n\n  <source path=\"config\"/>\n  <source path=\"contributors\"/>\n  <source path=\"deployment\"/>\n  <source path=\"events\"/>\n  <source path=\"navigator\"/>\n  <source path=\"organizationalunit\"/>\n  <source path=\"repositories\"/>\n  <source path=\"security\" />\n\n</module>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/test/java/org/guvnor/structure/repositories/RepositoryUtilsTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.assertj.core.api.Assertions.assertThat;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RepositoryUtilsTest {\n\n    @Test\n    public void cleanUpCredentialsFromEnvMapWhenNotNeededTest() {\n        final Map<String, Object> envMap = createEnvMap(false);\n\n        final List<String> result = RepositoryUtils.cleanUpCredentialsFromEnvMap(envMap);\n\n        assertThat(result).isEmpty();\n    }\n\n    @Test\n    public void cleanUpCredentialsFromEnvMapWhenNeededTest() {\n        final Map<String, Object> envMap = createEnvMap(true);\n\n        final List<String> result = RepositoryUtils.cleanUpCredentialsFromEnvMap(envMap);\n\n        assertThat(result).isNotEmpty();\n        assertThat(result).contains(EnvironmentParameters.USER_NAME,\n                                    EnvironmentParameters.PASSWORD,\n                                    EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD);\n        assertThat(envMap).doesNotContainKeys(EnvironmentParameters.USER_NAME,\n                                              EnvironmentParameters.PASSWORD,\n                                              EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD);\n    }\n\n    private Map<String, Object> createEnvMap(final boolean includeCredentials) {\n        final Map<String, Object> envMap = new HashMap<>();\n        envMap.put(\"foo\", true);\n        envMap.put(\"bar\", 1);\n\n        if (includeCredentials) {\n            envMap.put(EnvironmentParameters.USER_NAME, \"user\");\n            envMap.put(EnvironmentParameters.PASSWORD, \"pw\");\n            envMap.put(EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD, \"spw\");\n        }\n\n        return envMap;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/test/java/org/guvnor/structure/repositories/changerequest/ChangeRequestPredicatesTest.java",
    "content": "package org.guvnor.structure.repositories.changerequest;\n\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatus;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ChangeRequestPredicatesTest {\n\n    @Test\n    public void matchAllTest() {\n        List<ChangeRequest> changeRequests = Collections.nCopies(10, mock(ChangeRequest.class));\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchAll())\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(10);\n    }\n\n    @Test\n    public void matchIdTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(1L).when(crOne).getId();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(2L).when(crTwo).getId();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchId(2L))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(1);\n    }\n\n    @Test\n    public void matchSearchFilterTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"CR 1\").when(crOne).toString();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"CR 2\").when(crTwo).toString();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(\"3\").when(crThree).toString();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchSearchFilter(\"CR\",\n                                                                  elem -> elem.toString().toLowerCase()))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n\n    @Test\n    public void matchStatusTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.OPEN).when(crOne).getStatus();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.ACCEPTED).when(crTwo).getStatus();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchStatus(ChangeRequestStatus.OPEN))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(1);\n    }\n\n    @Test\n    public void matchInStatusListTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.OPEN).when(crOne).getStatus();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.ACCEPTED).when(crTwo).getStatus();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.REJECTED).when(crThree).getStatus();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<ChangeRequestStatus> statusList = Stream.of(ChangeRequestStatus.OPEN,\n                                                         ChangeRequestStatus.ACCEPTED).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchInStatusList(statusList))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n\n    @Test\n    public void matchInTargetBranchListTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"branch1\").when(crOne).getTargetBranch();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"branch2\").when(crTwo).getTargetBranch();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(\"branch3\").when(crThree).getTargetBranch();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<String> branchList = Stream.of(\"branch1\",\n                                            \"branch2\").collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchInTargetBranchList(branchList))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n\n    @Test\n    public void matchSourceBranchTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"branch1\").when(crOne).getSourceBranch();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"branch2\").when(crTwo).getSourceBranch();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchSourceBranch(\"branch1\"))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(1);\n    }\n\n    @Test\n    public void matchTargetBranchTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"branch1\").when(crOne).getTargetBranch();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"branch2\").when(crTwo).getTargetBranch();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchTargetBranch(\"branch1\"))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(1);\n    }\n\n    @Test\n    public void matchSearchFilterAndStatusListTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.OPEN).when(crOne).getStatus();\n        doReturn(\"CR 1\").when(crOne).toString();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.ACCEPTED).when(crTwo).getStatus();\n        doReturn(\"CR 2\").when(crTwo).toString();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(ChangeRequestStatus.REJECTED).when(crThree).getStatus();\n        doReturn(\"CR 3\").when(crThree).toString();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<ChangeRequestStatus> statusList = Stream.of(ChangeRequestStatus.OPEN,\n                                                         ChangeRequestStatus.ACCEPTED).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchSearchFilterAndStatusList(\"CR\",\n                                                                               elem -> elem.toString().toLowerCase(),\n                                                                               statusList))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n\n    @Test\n    public void matchSourceOrTargetBranchTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"branch\").when(crOne).getSourceBranch();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"sourceBranch2\").when(crTwo).getSourceBranch();\n        doReturn(\"targetBranch2\").when(crTwo).getTargetBranch();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(\"sourceBranch3\").when(crThree).getSourceBranch();\n        doReturn(\"branch\").when(crThree).getTargetBranch();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchSourceOrTargetBranch(\"branch\"))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n\n    @Test\n    public void matchSourceAndTargetAndStatusTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"sourceBranch\").when(crOne).getSourceBranch();\n        doReturn(\"targetBranch\").when(crOne).getTargetBranch();\n        doReturn(ChangeRequestStatus.OPEN).when(crOne).getStatus();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"sourceBranch\").when(crTwo).getSourceBranch();\n        doReturn(\"targetBranch\").when(crTwo).getTargetBranch();\n        doReturn(ChangeRequestStatus.REJECTED).when(crTwo).getStatus();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(\"sourceBranch3\").when(crThree).getSourceBranch();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList = changeRequests.stream()\n                .filter(ChangeRequestPredicates.matchSourceAndTargetAndStatus(\"sourceBranch\",\n                                                                              \"targetBranch\",\n                                                                              ChangeRequestStatus.OPEN))\n                .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(1);\n    }\n\n    @Test\n    public void matchTargetBranchListAndOtherPredicateTest() {\n        ChangeRequest crOne = mock(ChangeRequest.class);\n        doReturn(\"targetBranch1\").when(crOne).getTargetBranch();\n        doReturn(ChangeRequestStatus.OPEN).when(crOne).getStatus();\n\n        ChangeRequest crTwo = mock(ChangeRequest.class);\n        doReturn(\"targetBranch2\").when(crTwo).getTargetBranch();\n        doReturn(ChangeRequestStatus.OPEN).when(crTwo).getStatus();\n\n        ChangeRequest crThree = mock(ChangeRequest.class);\n        doReturn(\"targetBranch3\").when(crThree).getTargetBranch();\n        doReturn(ChangeRequestStatus.REJECTED).when(crThree).getStatus();\n\n        List<ChangeRequest> changeRequests = Stream.of(crOne,\n                                                       crTwo,\n                                                       crThree).collect(Collectors.toList());\n\n        List<String> targetBranches = Stream.of(\"targetBranch1\",\n                                                \"targetBranch2\",\n                                                \"targetBranch3\").collect(Collectors.toList());\n\n        List<ChangeRequest> filteredList =\n                changeRequests.stream().filter(ChangeRequestPredicates\n                                                       .matchTargetBranchListAndOtherPredicate(targetBranches,\n                                                                                               ChangeRequestPredicates.matchStatus(ChangeRequestStatus.OPEN)))\n                        .collect(Collectors.toList());\n\n        assertThat(filteredList).hasSize(2);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-api/src/test/java/org/guvnor/structure/repositories/impl/git/event/NotificationTypeTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories.impl.git.event;\n\nimport org.junit.Test;\n\nimport java.util.stream.IntStream;\n\nimport static org.junit.Assert.assertSame;\nimport static org.junit.Assert.assertTrue;\n\npublic class NotificationTypeTest {\n\n    @Test\n    public void testSuccess() {\n        doTest(0, 0, NotificationType.SUCCESS);\n    }\n\n    @Test\n    public void testWarning() {\n        doTest(1, 30, NotificationType.WARNING);\n    }\n\n    @Test\n    public void testError() {\n        doTest(31, 255, NotificationType.ERROR);\n    }\n\n    private void doTest(int minValue, int maxValue, NotificationType expectedType) {\n        IntStream.rangeClosed(minValue, maxValue)\n                .forEach(exitCode -> {\n                    assertTrue(expectedType.inRange(exitCode));\n                    assertSame(expectedType, NotificationType.fromExitCode(exitCode));\n                });\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-structure</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-structure-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Structure Backend</name>\n  <description>UberFire - Structure Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>jakarta.json</groupId>\n      <artifactId>jakarta.json-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>jakarta.ejb</groupId>\n      <artifactId>jakarta.ejb-api</artifactId>\n    </dependency>\n    <!-- dependencies added because of illegal transitive dependency check -->\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jasypt</groupId>\n      <artifactId>jasypt</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.ocpsoft.prettytime</groupId>\n      <artifactId>prettytime</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons-editor-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-core</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.eclipse.aether</groupId>\n          <artifactId>aether-util</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>com.google.inject</groupId>\n          <artifactId>guice</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n    <dependency>\n      <groupId>org.apache.maven</groupId>\n      <artifactId>maven-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.codehaus.plexus</groupId>\n      <artifactId>plexus-utils</artifactId>\n    </dependency>\n\n    <!-- The version of commons-io in droolsjbpm-build-bootstrap pom is way too old-->\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>commons-fileupload</groupId>\n      <artifactId>commons-fileupload</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.apache.commons</groupId>\n      <artifactId>commons-text</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-management-backend</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.thoughtworks.xstream</groupId>\n      <artifactId>xstream</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-test-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <!-- Weld Modules. For tests only -->\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-commons-io</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.eclipse.jgit</groupId>\n      <artifactId>org.eclipse.jgit</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>commons-logging</groupId>\n          <artifactId>commons-logging</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <!-- arquillian tests -->\n    <dependency>\n      <groupId>org.jboss.arquillian.junit</groupId>\n      <artifactId>arquillian-junit-container</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.arquillian.container</groupId>\n      <artifactId>arquillian-weld-se-embedded-1.1</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/FileNavigatorServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend;\n\nimport java.util.ArrayList;\nimport java.util.Comparator;\nimport java.util.Date;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.navigator.DataContent;\nimport org.guvnor.structure.navigator.FileNavigatorService;\nimport org.guvnor.structure.navigator.NavigatorContent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.ocpsoft.prettytime.PrettyTime;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.spaces.Space;\n\nimport static java.util.Collections.reverse;\nimport static java.util.Collections.sort;\n\n@Service\n@ApplicationScoped\npublic class FileNavigatorServiceImpl implements FileNavigatorService {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    private RepositoryService repositoryService;\n\n    private final PrettyTime p = new PrettyTime();\n\n    @Override\n    public NavigatorContent listContent(final org.uberfire.backend.vfs.Path _path) {\n        final ArrayList<DataContent> result = new ArrayList<>();\n        final ArrayList<org.uberfire.backend.vfs.Path> breadcrumbs = new ArrayList<>();\n\n        Path path = Paths.convert(_path);\n        final DirectoryStream<Path> stream = ioService.newDirectoryStream(path);\n\n        for (final Path activePath : stream) {\n            final VersionAttributeView versionAttributeView = ioService.getFileAttributeView(activePath,\n                                                                                             VersionAttributeView.class);\n            int index = versionAttributeView.readAttributes().history().records().size() - 1;\n\n            final String authorEmail = versionAttributeView.readAttributes().history().records().get(index).email();\n            final String author = versionAttributeView.readAttributes().history().records().get(index).author();\n            final String comment = versionAttributeView.readAttributes().history().records().get(index).comment();\n\n            final String time = p.format(new Date(Files.getLastModifiedTime(activePath).toMillis()));\n            result.add(new DataContent(Files.isDirectory(activePath),\n                                       comment,\n                                       author,\n                                       authorEmail,\n                                       time,\n                                       Paths.convert(activePath)));\n        }\n\n        sort(result,\n             new Comparator<DataContent>() {\n                 @Override\n                 public int compare(final DataContent dataContent,\n                                    final DataContent dataContent2) {\n\n                     int fileCompare = dataContent.getPath().getFileName().toLowerCase().compareTo(dataContent2.getPath().getFileName().toLowerCase());\n                     if (dataContent.isDirectory() && dataContent2.isDirectory()) {\n                         return fileCompare;\n                     }\n\n                     if (dataContent.isDirectory()) {\n                         return -1;\n                     }\n\n                     if (dataContent2.isDirectory()) {\n                         return 1;\n                     }\n\n                     return fileCompare;\n                 }\n             });\n\n        if (!path.equals(path.getRoot())) {\n            while (!path.getParent().equals(path.getRoot())) {\n                path = path.getParent();\n                breadcrumbs.add(Paths.convert(path));\n            }\n\n            reverse(breadcrumbs);\n        }\n        final org.uberfire.backend.vfs.Path root = Paths.convert(path.getRoot());\n\n        return new NavigatorContent(repositoryService.getRepository(root).getAlias(),\n                                    root,\n                                    breadcrumbs,\n                                    result);\n    }\n\n    @Override\n    public List<Repository> listRepositories(final Space space) {\n        return new ArrayList<>(repositoryService.getRepositories(space));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/FileSystemDeleteWorker.java",
    "content": "package org.guvnor.structure.backend;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.concurrent.TimeUnit;\n\nimport javax.ejb.Schedule;\nimport javax.ejb.Singleton;\nimport javax.ejb.Startup;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.eclipse.jgit.util.FileUtils;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageImpl;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLockManager;\nimport org.uberfire.spaces.Space;\n\nimport static java.util.stream.Collectors.toList;\nimport static org.uberfire.backend.server.util.Paths.convert;\n\n@Singleton\n@Startup\npublic class FileSystemDeleteWorker {\n\n    private static final int LAST_ACCESS_THRESHOLD = 10;\n    private static final TimeUnit LAST_ACCESS_TIME_UNIT = TimeUnit.SECONDS;\n    private static final String LOCK_NAME = \"delete.lock\";\n    public static final String CRON_MINUTES = \"*/1\";\n\n    private Logger logger = LoggerFactory.getLogger(FileSystemDeleteWorker.class);\n\n    private IOService ioService;\n    private OrganizationalUnitService organizationalUnitService;\n    private RepositoryService repositoryService;\n    private FileSystem systemFS;\n    private SpaceConfigStorageRegistry registry;\n    private Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent;\n    private ConfigurationService configurationService;\n    private boolean busy = false;\n\n    public FileSystemDeleteWorker() {\n\n    }\n\n    @Inject\n    public FileSystemDeleteWorker(@Named(\"ioStrategy\") final IOService ioService,\n                                  final OrganizationalUnitService organizationalUnitService,\n                                  final RepositoryService repositoryService,\n                                  final @Named(\"systemFS\") FileSystem systemFS,\n                                  final SpaceConfigStorageRegistry registry,\n                                  final Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent,\n                                  final ConfigurationService configurationService) {\n        this.ioService = ioService;\n        this.organizationalUnitService = organizationalUnitService;\n        this.repositoryService = repositoryService;\n        this.systemFS = systemFS;\n        this.registry = registry;\n        this.removeOrganizationalUnitEvent = removeOrganizationalUnitEvent;\n        this.configurationService = configurationService;\n    }\n\n    @Schedule(hour = \"*\", minute = CRON_MINUTES, persistent = false)\n    public void doRemove() {\n\n        if (this.busy || !this.isDeleteWorkerEnabled()) {\n            return;\n        }\n        this.busy = true;\n        ifDebugEnabled(logger,\n                       () -> logger.debug(\"Trying to acquire lock\"));\n        this.lockedOperation(() -> {\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Lock acquired, executing Delete Operation\"));\n            this.removeAllDeletedSpaces();\n            this.removeAllDeletedRepositories();\n        });\n        ifDebugEnabled(logger,\n                       () -> logger.debug(\"Delete Operation finished.\"));\n        this.busy = false;\n    }\n\n    protected boolean isDeleteWorkerEnabled() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n\n    protected void removeAllDeletedRepositories() {\n        try {\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Removing all deleted repositories\"));\n            Collection<OrganizationalUnit> spaces = this.organizationalUnitService.getAllOrganizationalUnits(false, (X) -> true);\n            List<Repository> deletedRepositories = spaces.stream()\n                    .filter(organizationalUnit -> organizationalUnit != null)\n                    .map(organizationalUnit ->\n                                 this.repositoryService.getAllDeletedRepositories(organizationalUnit.getSpace()))\n                    .flatMap(x -> x.stream()).collect(toList());\n\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Found {} spaces with deleted repositories\",\n                                              deletedRepositories.size()));\n\n            deletedRepositories\n                    .forEach(organizationalUnit ->\n                                     this.removeRepository(organizationalUnit));\n\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Deleted repositories had been removed\"));\n        } catch (Exception e) {\n            ifDebugEnabled(logger,\n                           () -> logger.error(\"Error when trying to remove all deleted repositories\",\n                                              e));\n        }\n    }\n\n    protected void removeAllDeletedSpaces() {\n        try {\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Removing all deleted spaces\"));\n            Collection<OrganizationalUnit> deletedSpaces = this.organizationalUnitService.getAllDeletedOrganizationalUnit();\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Found {} spaces to be deleted\",\n                                              deletedSpaces.size()));\n            deletedSpaces.forEach(ou -> this.removeSpaceDirectory(ou.getSpace()));\n            if (deletedSpaces.size() > 0) {\n                this.removeOrganizationalUnitEvent.fire(new RemoveOrganizationalUnitEvent());\n            }\n            ifDebugEnabled(logger,\n                           () -> logger.debug(\"Deleted spaces had been removed\"));\n        } catch (Exception e) {\n            ifDebugEnabled(logger,\n                           () -> logger.error(\"Error when trying to remove all deleted Spaces\",\n                                              e));\n        }\n    }\n\n    protected void removeSpaceDirectory(final Space space) {\n        try {\n\n            Collection<Repository> repositories = this.repositoryService.getAllRepositories(space,\n                                                                                            true);\n\n            repositories.forEach(repository -> this.removeRepository(repository));\n\n            SpaceConfigStorageImpl configStorage = (SpaceConfigStorageImpl) this.registry.get(space.getName());\n            final Path configPath = configStorage.getPath();\n\n            final File spacePath = getSpacePath(configPath.getFileSystem().getPath(\"/\"));\n            final Path configFSPath = configPath.getFileSystem().getPath(\"/\");\n            this.ioService.deleteIfExists(configFSPath);\n            this.registry.remove(space.getName());\n            this.delete(spacePath);\n            this.removeSpaceFromConfigurationService(space);\n        } catch (Exception e) {\n            ifDebugEnabled(logger,\n                           () -> logger.error(\"A problem occurred when trying to delete \" + space.getName() + \" space\",\n                                              e));\n        }\n    }\n\n    private void removeSpaceFromConfigurationService(Space space) {\n        String spaceName = space.getName();\n        this.configurationService.startBatch();\n        Optional<ConfigGroup> configGroup = findConfigGroupBySpaceName(spaceName);\n        configGroup.ifPresent(cg -> this.configurationService.removeConfiguration(cg));\n        this.configurationService.endBatch();\n    }\n\n    private Optional<ConfigGroup> findConfigGroupBySpaceName(String spaceName) {\n        List<ConfigGroup> configurations = this.configurationService.getConfiguration(ConfigType.SPACE);\n        return configurations.stream().filter(cg -> cg.getName().equalsIgnoreCase(spaceName)).findFirst();\n    }\n\n    protected void delete(File path) throws IOException {\n        FileUtils.delete(path,\n                         FileUtils.RECURSIVE | FileUtils.SKIP_MISSING | FileUtils.RETRY);\n    }\n\n    protected File getSpacePath(Path configPath) {\n        return configPath.toFile()// system.git\n                .getParentFile()    // system\n                .getParentFile();   //.niogit\n    }\n\n    protected void removeRepository(final Repository repo) {\n        try {\n            Path path = getPath(repo);\n            ioService.deleteIfExists(path);\n\n            SpaceConfigStorageImpl configStorage = (SpaceConfigStorageImpl) this.registry.get(repo.getSpace().getName());\n            configStorage.deleteRepository(repo.getAlias());\n\n            if (!ioService.exists(path)) {\n                this.removeRepositoryFromSpaceInfo(repo);\n            }\n        } catch (Exception e) {\n            ifDebugEnabled(logger,\n                           () -> logger.error(\"A problem occurred when trying to delete \" + repo.getAlias() + \" repository\",\n                                              e));\n        }\n    }\n\n    private Path getPath(Repository repo) {\n        return this.getFS(repo).getPath(\"\");\n    }\n\n    private FileSystem getFS(Repository repo) {\n        Branch defaultBranch = repo.getDefaultBranch().orElseThrow(() -> new IllegalStateException(\"Repository should have at least one branch.\"));\n        return convert(defaultBranch.getPath()).getFileSystem();\n    }\n\n    private void removeRepositoryFromSpaceInfo(Repository repo) {\n        registry.getBatch(repo.getSpace().getName())\n                .run(context -> {\n                    context.getSpaceInfo().removeRepository(repo.getAlias());\n                    context.saveSpaceInfo();\n                    return null;\n                });\n    }\n\n    private File getSystemRepository() {\n\n        return systemFS.getPath(\"/\").toFile();\n    }\n\n    private void lockedOperation(Runnable runnable) {\n        FileSystemLock physicalLock = createLock(this.getSystemRepository().getParentFile().getParentFile());\n        try {\n            physicalLock.lock();\n            runnable.run();\n        } finally {\n            physicalLock.unlock();\n        }\n    }\n\n    protected FileSystemLock createLock(File file) {\n        ifDebugEnabled(logger,\n                       () -> logger.debug(\"Acquiring lock: \" + file.getAbsolutePath() + \" - \" + LOCK_NAME));\n        return FileSystemLockManager\n                .getInstance()\n                .getFileSystemLock(file,\n                                   LOCK_NAME,\n                                   LAST_ACCESS_TIME_UNIT,\n                                   LAST_ACCESS_THRESHOLD);\n    }\n\n    private void ifDebugEnabled(Logger logger,\n                                Runnable message) {\n        if (logger.isDebugEnabled()) {\n            message.run();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/InputEscapeUtils.java",
    "content": "/*\n * Copyright 2023 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport org.apache.commons.text.StringEscapeUtils;\nimport org.uberfire.security.Contributor;\n\n/**\n * Utility class to provide input escaping or other\n * functionality needed by backend services to sanitize inputs.\n */\npublic class InputEscapeUtils {\n\n    private InputEscapeUtils() {\n        // non-instantiable class\n    }\n\n    public static Collection<Contributor> escapeContributorsNames(Collection<Contributor> contributors) {\n        Collection<Contributor> escapedContributors = new ArrayList<>();\n        contributors.forEach((contributor -> {\n            String escapedName = escapeHtmlInput(contributor.getUsername());\n            escapedContributors.add(new Contributor(escapedName, contributor.getType()));\n        }));\n        return escapedContributors;\n    }\n\n    public static String escapeHtmlInput(String input) {\n        if (input != null) {\n            String escapedInput = StringEscapeUtils.escapeHtml4(input);\n            escapedInput = escapedInput.replace(\"'\", \"\");\n            return escapedInput;\n        } else {\n            return null;\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/LocaleContext.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend;\n\nimport java.util.Locale;\nimport java.util.Optional;\n\npublic class LocaleContext {\n    \n    private static final ThreadLocal<Locale> threadLocal = new ThreadLocal<>();\n    \n    private LocaleContext() {}\n    \n    public static Locale get() {\n        return Optional.ofNullable(threadLocal.get())\n                .orElse(Locale.getDefault());\n    }\n    \n    public static void set(final Locale locale) {\n        threadLocal.set(locale);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/backcompat/BackwardCompatibleUtil.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.backcompat;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\n\n@Deprecated\n@ApplicationScoped\npublic class BackwardCompatibleUtil {\n\n    private ConfigurationFactory configurationFactory;\n\n    public BackwardCompatibleUtil() {\n    }\n\n    @Inject\n    public BackwardCompatibleUtil(ConfigurationFactory configurationFactory) {\n        this.configurationFactory = configurationFactory;\n    }\n\n    @Deprecated\n    public ConfigGroup compat(final ConfigGroup configGroup) {\n        if (configGroup != null) {\n            final ConfigItem<List<String>> roles = configGroup.getConfigItem(\"security:roles\");\n            if (roles != null) {\n                configGroup.addConfigItem(configurationFactory.newConfigItem(\"security:groups\",\n                                                                             new ArrayList<String>(roles.getValue())));\n                configGroup.removeConfigItem(\"security:roles\");\n            }\n            final ConfigItem<List<String>> groups = configGroup.getConfigItem(\"security:groups\");\n            if (groups == null) {\n                configGroup.addConfigItem(configurationFactory.newConfigItem(\"security:groups\",\n                                                                             new ArrayList<String>()));\n            }\n        }\n        return configGroup;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/Added.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.config;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Target({PARAMETER, FIELD})\n@Retention(RUNTIME)\npublic @interface Added {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/ConfigGroupMarshaller.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport com.thoughtworks.xstream.XStream;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.SecureConfigItem;\nimport org.kie.soup.xstream.XStreamUtils;\n\n/**\n * Marshall a ConfigGroup to and from XML\n */\npublic class ConfigGroupMarshaller {\n\n    private final XStream backwardCompatibleXstream = XStreamUtils.createTrustingXStream();\n    private final XStream xstream = XStreamUtils.createTrustingXStream();\n\n    public ConfigGroupMarshaller() {\n\n        String[] voidDeny = {\"void.class\", \"Void.class\"};\n\n        backwardCompatibleXstream.alias(\"group\",\n                                     ConfigGroup.class );\n        backwardCompatibleXstream.alias(\"item\",\n                                        ConfigItem.class );\n        backwardCompatibleXstream.alias(\"type\",\n                                        ConfigType.class );\n        backwardCompatibleXstream.alias(\"secureitem\",\n                                        SecureConfigItem.class);\n        // for backward compatibility only\n        backwardCompatibleXstream.alias(\"org.uberfire.backend.server.config.SecureConfigItem\",\n                                        SecureConfigItem.class);\n        backwardCompatibleXstream.denyTypes(voidDeny);\n\n        xstream.alias(\"group\",\n                      ConfigGroup.class);\n        xstream.alias(\"item\",\n                      ConfigItem.class);\n        xstream.alias(\"type\",\n                      ConfigType.class);\n        xstream.alias(\"secureitem\",\n                      SecureConfigItem.class);\n        xstream.denyTypes(voidDeny);\n\n\n    }\n\n    public String marshall(final ConfigGroup configGroup) {\n        return xstream.toXML(configGroup);\n    }\n\n    public ConfigGroup unmarshall(final String xml) {\n        return (ConfigGroup) backwardCompatibleXstream.fromXML(xml);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/ConfigurationFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport java.util.List;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.guvnor.structure.server.config.SecureConfigItem;\n\nimport static org.guvnor.structure.repositories.EnvironmentParameters.CRYPT_PREFIX;\n\npublic class ConfigurationFactoryImpl implements ConfigurationFactory {\n\n    protected PasswordService secureService;\n\n    public ConfigurationFactoryImpl() {\n    }\n\n    @Inject\n    public ConfigurationFactoryImpl(final PasswordService secureService) {\n        this.secureService = secureService;\n    }\n\n    @Override\n    public ConfigGroup newConfigGroup(final ConfigType type,\n                                      final String name,\n                                      final String description) {\n        if (type.hasNamespace()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" requires a namespace.\");\n        }\n\n        final ConfigGroup configGroup = new ConfigGroup();\n        configGroup.setDescription(description);\n        configGroup.setName(name);\n        configGroup.setType(type);\n        configGroup.setEnabled(true);\n        return configGroup;\n    }\n\n    @Override\n    public ConfigGroup newConfigGroup(final ConfigType type,\n                                      final String namespace,\n                                      final String name,\n                                      final String description) {\n        if (!type.hasNamespace() && namespace != null && !namespace.isEmpty()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" does not support namespaces.\");\n        }\n\n        final ConfigGroup configGroup = new ConfigGroup();\n        configGroup.setDescription(description);\n        configGroup.setName(name);\n        configGroup.setType(type);\n        configGroup.setNamespace(namespace);\n        configGroup.setEnabled(true);\n        return configGroup;\n    }\n\n    @Override\n    public ConfigItem<String> newConfigItem(final String name,\n                                            final String valueType) {\n        final ConfigItem<String> stringConfigItem = new ConfigItem<String>();\n        stringConfigItem.setName(name);\n        stringConfigItem.setValue(valueType);\n        return stringConfigItem;\n    }\n\n    @Override\n    public ConfigItem<Boolean> newConfigItem(final String name,\n                                             final boolean valueType) {\n        final ConfigItem<Boolean> booleanConfigItem = new ConfigItem<Boolean>();\n        booleanConfigItem.setName(name);\n        booleanConfigItem.setValue(valueType);\n        return booleanConfigItem;\n    }\n\n    @Override\n    public SecureConfigItem newSecuredConfigItem(final String name,\n                                                 final String valueType) {\n        final SecureConfigItem stringConfigItem = new SecureConfigItem();\n        if (name.startsWith(CRYPT_PREFIX)) {\n            stringConfigItem.setName(name.substring(CRYPT_PREFIX.length()));\n        } else {\n            stringConfigItem.setName(name);\n        }\n        stringConfigItem.setValue(secureService.encrypt(valueType));\n        return stringConfigItem;\n    }\n\n    @Override\n    public ConfigItem<List> newConfigItem(String name,\n                                          List valueType) {\n        final ConfigItem<List> listConfigItem = new ConfigItem<List>();\n        listConfigItem.setName(name);\n        listConfigItem.setValue(valueType);\n        return listConfigItem;\n    }\n\n    @Override\n    public ConfigItem<Object> newConfigItem(String name,\n                                            Object valueType) {\n        final ConfigItem<Object> listConfigItem = new ConfigItem<Object>();\n        listConfigItem.setName(name);\n        listConfigItem.setValue(valueType);\n        return listConfigItem;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/ConfigurationServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.CopyOnWriteArraySet;\nimport java.util.concurrent.ExecutorService;\nimport java.util.concurrent.Executors;\nimport java.util.concurrent.Future;\nimport java.util.concurrent.TimeUnit;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\nimport javax.naming.InitialContext;\n\nimport org.guvnor.structure.backend.config.watch.AsyncConfigWatchService;\nimport org.guvnor.structure.backend.config.watch.AsyncWatchServiceCallback;\nimport org.guvnor.structure.backend.config.watch.ConfigServiceWatchServiceExecutor;\nimport org.guvnor.structure.backend.config.watch.ConfigServiceWatchServiceExecutorImpl;\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.commons.async.DescriptiveRunnable;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.WatchContext;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.StandardWatchEventKind;\nimport org.uberfire.java.nio.file.WatchEvent;\nimport org.uberfire.java.nio.file.WatchKey;\nimport org.uberfire.java.nio.file.WatchService;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\n\n@ApplicationScoped\npublic class ConfigurationServiceImpl implements ConfigurationService,\n                                                 AsyncWatchServiceCallback {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationServiceImpl.class);\n\n    protected static final String MONITOR_DISABLED = \"org.uberfire.sys.repo.monitor.disabled\";\n\n    // mainly for windows as *NIX is based on POSIX but escape always to keep it consistent\n    protected static final String INVALID_FILENAME_CHARS = \"[\\\\,/,:,*,?,\\\",<,>,|]\";\n\n    protected org.guvnor.structure.repositories.Repository systemRepository;\n\n    protected ConfigGroupMarshaller marshaller;\n\n    protected User identity;\n\n    //Cache of ConfigGroups to avoid reloading them from file\n    protected final Map<ConfigType, List<ConfigGroup>> configGroupsByTypeWithoutNamespace = new ConcurrentHashMap<>();\n    protected final Map<ConfigType, Map<String, List<ConfigGroup>>> configGroupsByTypeWithNamespace = new ConcurrentHashMap<>();\n\n    protected AtomicLong localLastModifiedValue = new AtomicLong(-1);\n\n    protected IOService ioService;\n\n    // monitor capabilities\n    protected Event<SystemRepositoryChangedEvent> repoChangedEvent;\n    protected Event<SystemRepositoryChangedEvent> spaceChangedEvent;\n    protected Event<SystemRepositoryChangedEvent> changedEvent;\n\n    protected final ExecutorService executorService = Executors.newSingleThreadExecutor();\n\n    protected final Set<Future<?>> jobs = new CopyOnWriteArraySet<>();\n\n    protected ConfigServiceWatchServiceExecutor executor = null;\n\n    protected CheckConfigurationUpdates configUpdates = null;\n\n    protected WatchService watchService = null;\n\n    protected FileSystem fs;\n\n    public ConfigurationServiceImpl() {\n    }\n\n    @Inject\n    public ConfigurationServiceImpl(final @Named(\"system\") org.guvnor.structure.repositories.Repository systemRepository,\n                                    final ConfigGroupMarshaller marshaller,\n                                    final User identity,\n                                    final @Named(\"configIO\") IOService ioService,\n                                    final @Repository Event<SystemRepositoryChangedEvent> repoChangedEvent,\n                                    final @OrgUnit Event<SystemRepositoryChangedEvent> spaceChangedEvent,\n                                    final Event<SystemRepositoryChangedEvent> changedEvent,\n                                    final @Named(\"systemFS\") FileSystem fs) {\n        this.systemRepository = systemRepository;\n        this.marshaller = marshaller;\n        this.identity = identity;\n        this.ioService = ioService;\n        this.repoChangedEvent = repoChangedEvent;\n        this.spaceChangedEvent = spaceChangedEvent;\n        this.changedEvent = changedEvent;\n        this.fs = fs;\n    }\n\n    @PostConstruct\n    public void setup() {\n        Path defaultRoot = null;\n        for (final Path path : fs.getRootDirectories()) {\n            if (path.toUri().toString().contains(\"/master@\")) {\n                defaultRoot = path;\n                break;\n            }\n        }\n\n        if (defaultRoot == null) {\n            throw new RuntimeException(\"Could not resolve 'systemFS' master root directory.\");\n        }\n\n        // enable monitor by default\n        if (System.getProperty(MONITOR_DISABLED) == null) {\n            watchService = fs.newWatchService();\n            configUpdates = new CheckConfigurationUpdates(watchService);\n            final ConfigServiceWatchServiceExecutor configServiceWatchServiceExecutor = getWatchServiceExecutor();\n            jobs.add(executorService.submit(new DescriptiveRunnable() {\n                @Override\n                public String getDescription() {\n                    return configUpdates.getDescription();\n                }\n\n                @Override\n                public void run() {\n                    configUpdates.execute(configServiceWatchServiceExecutor);\n                }\n            }));\n        }\n    }\n\n    @PreDestroy\n    public void shutdown() {\n        if (configUpdates != null) {\n            configUpdates.deactivate();\n        }\n        if (watchService != null) {\n            watchService.close();\n        }\n        for (Future<?> job : jobs) {\n            if (!job.isCancelled() && !job.isDone()) {\n                job.cancel(true);\n            }\n        }\n        executorService.shutdown(); // Disable new tasks from being submitted\n        try {\n            // Wait a while for existing tasks to terminate\n            if (!executorService.awaitTermination(60,\n                                                  TimeUnit.SECONDS)) {\n                executorService.shutdownNow(); // Cancel currently executing tasks\n                // Wait a while for tasks to respond to being cancelled\n                if (!executorService.awaitTermination(60,\n                                                      TimeUnit.SECONDS)) {\n                    System.err.println(\"Pool did not terminate\");\n                }\n            }\n        } catch (InterruptedException ie) {\n            // (Re-)Cancel if current thread also interrupted\n            executorService.shutdownNow();\n            // Preserve interrupt status\n            Thread.currentThread().interrupt();\n        }\n    }\n\n    @Override\n    public void startBatch() {\n        ioService.startBatch(ioService.get(systemRepository.getUri()).getFileSystem());\n    }\n\n    @Override\n    public void endBatch() {\n        ioService.endBatch();\n    }\n\n    @Override\n    public List<ConfigGroup> getConfiguration(final ConfigType type) {\n        if (type.hasNamespace()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" requires a namespace.\");\n        }\n\n        if (configGroupsByTypeWithoutNamespace.containsKey(type)) {\n            return configGroupsByTypeWithoutNamespace.get(type);\n        }\n\n        final Path typeDir = ioService.get(systemRepository.getUri()).resolve(type.getDir());\n\n        final List<ConfigGroup> configGroups = getConfiguration(typeDir,\n                                                                type);\n        if (configGroups != null) {\n            configGroupsByTypeWithoutNamespace.put(type,\n                                                   configGroups);\n        } else {\n            return Collections.emptyList();\n        }\n\n        return configGroups;\n    }\n\n    @Override\n    public List<ConfigGroup> getConfiguration(final ConfigType type,\n                                              final String namespace) {\n        if (!type.hasNamespace() && namespace != null && !namespace.isEmpty()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" does not support namespaces.\");\n        }\n\n        if (configGroupsByTypeWithNamespace.containsKey(type)) {\n            final Map<String, List<ConfigGroup>> configGroupsByNamespace = configGroupsByTypeWithNamespace.get(type);\n            if (configGroupsByNamespace.containsKey(namespace)) {\n                return configGroupsByNamespace.get(namespace);\n            }\n        }\n\n        final Path typeDir = ioService.get(systemRepository.getUri()).resolve(type.getDir());\n        final Path namespaceDir = typeDir.resolve(namespace);\n\n        final List<ConfigGroup> configGroups = getConfiguration(namespaceDir, type, namespace);\n        if (configGroups != null) {\n            if (!configGroupsByTypeWithNamespace.containsKey(type)) {\n                configGroupsByTypeWithNamespace.put(type,\n                                                    new ConcurrentHashMap<>());\n            }\n\n            final Map<String, List<ConfigGroup>> configGroupsByNamespace = configGroupsByTypeWithNamespace.get(type);\n            configGroupsByNamespace.put(namespace,\n                                        configGroups);\n        } else {\n            return Collections.emptyList();\n        }\n\n        return configGroups;\n    }\n\n    @Override\n    public Map<String, List<ConfigGroup>> getConfigurationByNamespace(final ConfigType type) {\n        if (!type.hasNamespace()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" does not support namespaces.\");\n        }\n\n        final Path typeDir = ioService.get(systemRepository.getUri()).resolve(type.getDir());\n        if (!ioService.exists(typeDir)) {\n            return Collections.emptyMap();\n        }\n\n        final DirectoryStream<Path> foundNamespaces = getDirectoryStreamForDirectories(typeDir);\n\n        // Force cache update for all namespaces in that type\n        final Iterator<Path> it = foundNamespaces.iterator();\n        while (it.hasNext()) {\n            final String namespace = Paths.convert(it.next()).getFileName();\n            getConfiguration(type,\n                             namespace);\n        }\n\n        // Return the updated cache\n        return configGroupsByTypeWithNamespace.get(type);\n    }\n    private List<ConfigGroup> getConfiguration(final Path dir,\n                                               final ConfigType type,\n                                               final String namespace) {\n        final List<ConfigGroup> configGroups = new ArrayList<>();\n\n        if (!ioService.exists(dir)) {\n            return configGroups;\n        }\n\n        final DirectoryStream<Path> foundConfigs = getDirectoryStreamForFilesWithParticularExtension(dir,\n                type.getExt());\n\n        //Only load and cache if a file was found!\n        final Iterator<Path> it = foundConfigs.iterator();\n        if (it.hasNext()) {\n            while (it.hasNext()) {\n                final String content = ioService.readAllString(it.next());\n                final ConfigGroup configGroup = marshaller.unmarshall(content);\n                if (namespace != null) {\n                    configGroup.setNamespace(namespace);\n                }\n                configGroups.add(configGroup);\n            }\n\n            return configGroups;\n        }\n\n        return null;\n    }\n\n\n    private List<ConfigGroup> getConfiguration(final Path dir,\n                                               final ConfigType type) {\n        return getConfiguration(dir, type, null);\n    }\n\n    private DirectoryStream<Path> getDirectoryStreamForFilesWithParticularExtension(final Path dir,\n                                                                                    final String extension) {\n        return ioService.newDirectoryStream(dir,\n                                            entry -> {\n                                                if (!Files.isDirectory(entry) &&\n                                                        !entry.getFileName().toString().startsWith(\".\") &&\n                                                        entry.getFileName().toString().endsWith(extension)) {\n                                                    return true;\n                                                }\n                                                return false;\n                                            });\n    }\n\n    private DirectoryStream<Path> getDirectoryStreamForDirectories(final Path dir) {\n        return ioService.newDirectoryStream(dir,\n                                            entry -> Files.isDirectory(entry));\n    }\n\n    @Override\n    public boolean addConfiguration(final ConfigGroup configGroup) {\n        final Path filePath = resolveConfigGroupPath(configGroup);\n        final String commitMessage = \"Created config \" + filePath.getFileName();\n\n        return saveConfiguration(configGroup,\n                                 filePath,\n                                 commitMessage,\n                                 true);\n    }\n\n    @Override\n    public boolean updateConfiguration(ConfigGroup configGroup) {\n        final Path filePath = resolveConfigGroupPath(configGroup);\n        final String commitMessage = \"Updated config \" + filePath.getFileName();\n\n        return saveConfiguration(configGroup,\n                                 filePath,\n                                 commitMessage,\n                                 false);\n    }\n\n    private Path resolveConfigGroupPath(final ConfigGroup configGroup) {\n        final ConfigType type = configGroup.getType();\n        final String namespace = configGroup.getNamespace();\n\n        if (type.hasNamespace() && (namespace == null || namespace.isEmpty())) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" requires a namespace.\");\n        } else if (!type.hasNamespace() && namespace != null && !namespace.isEmpty()) {\n            throw new RuntimeException(\"The ConfigType \" + type.toString() + \" does not support namespaces.\");\n        }\n\n        final String filename = configGroup.getName().replaceAll(INVALID_FILENAME_CHARS,\n                                                                 \"_\");\n\n        Path path = ioService.get(systemRepository.getUri()).resolve(type.getDir());\n        if (type.hasNamespace()) {\n            path = path.resolve(namespace);\n        }\n\n        return path.resolve(filename + type.getExt());\n    }\n\n    private void invalidateCacheAfterUpdatingConfigGroup(final ConfigGroup configGroup) {\n        final ConfigType type = configGroup.getType();\n\n        if (!type.hasNamespace()) {\n            configGroupsByTypeWithoutNamespace.remove(type);\n        } else {\n            if (configGroupsByTypeWithNamespace.containsKey(type)) {\n                configGroupsByTypeWithNamespace.get(type).remove(configGroup.getNamespace());\n            }\n        }\n    }\n\n    private boolean saveConfiguration(final ConfigGroup configGroup,\n                                      final Path path,\n                                      final String commitMessage,\n                                      final boolean isNew) {\n        // avoid duplicated writes to not cause cyclic cluster sync\n        if (isNew && ioService.exists(path)) {\n            return true;\n        }\n\n        final CommentedOption commentedOption = new CommentedOption(getIdentityName(),\n                                                                    commitMessage);\n        try {\n            ioService.startBatch(path.getFileSystem());\n            ioService.write(path,\n                            marshaller.marshall(configGroup),\n                            commentedOption);\n\n            updateLastModified();\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        } finally {\n            ioService.endBatch();\n        }\n\n        invalidateCacheAfterUpdatingConfigGroup(configGroup);\n\n        return true;\n    }\n\n    @Override\n    public boolean removeConfiguration(final ConfigGroup configGroup) {\n        final Path filePath = resolveConfigGroupPath(configGroup);\n\n        if (!ioService.exists(filePath)) {\n            return true;\n        }\n\n        boolean result;\n        try {\n            ioService.startBatch(filePath.getFileSystem());\n            result = ioService.deleteIfExists(filePath);\n            if (result) {\n                updateLastModified();\n            }\n        } catch (Exception ex) {\n            throw new RuntimeException(ex);\n        } finally {\n            ioService.endBatch();\n        }\n\n        invalidateCacheAfterUpdatingConfigGroup(configGroup);\n\n        return result;\n    }\n\n    protected String getIdentityName() {\n        try {\n            return identity.getIdentifier();\n        } catch (Exception e) {\n            return \"unknown\";\n        }\n    }\n\n    protected long getLastModified() {\n        final Path lastModifiedPath = ioService.get(systemRepository.getUri()).resolve(LAST_MODIFIED_MARKER_FILE);\n\n        return ioService.getLastModifiedTime(lastModifiedPath).toMillis();\n    }\n\n    protected void updateLastModified() {\n        final Path lastModifiedPath = ioService.get(systemRepository.getUri()).resolve(LAST_MODIFIED_MARKER_FILE);\n        final CommentedOption commentedOption = new CommentedOption(\"system\",\n                                                                    \"system repo updated\");\n\n        ioService.write(lastModifiedPath,\n                        new Date().toString().getBytes(),\n                        commentedOption);\n\n        // update the last value to avoid to be re-triggered by the monitor\n        localLastModifiedValue.set(getLastModified());\n    }\n\n    @Override\n    public void callback(long value) {\n        localLastModifiedValue.set(value);\n\n        // invalidate cached values as system repo has changed\n        configGroupsByTypeWithoutNamespace.clear();\n        configGroupsByTypeWithNamespace.clear();\n    }\n\n    @Override\n    public boolean cleanUpSystemRepository() {\n        try {\n            final FileSystem fileSystem = ioService.get(systemRepository.getUri()).getFileSystem();\n            if (fileSystem instanceof JGitFileSystem) {\n                return ((JGitFileSystem) fileSystem)\n                        .getGit()\n                        .resetWithSquash(\"Repository clean up.\");\n            }\n        } catch (IOException e) {\n            LOGGER.error(\"Unable to reset git repository.\", e);\n        }\n        return false;\n    }\n\n    private class CheckConfigurationUpdates implements AsyncConfigWatchService {\n\n        private final WatchService ws;\n        private boolean active = true;\n\n        public CheckConfigurationUpdates(final WatchService watchService) {\n            this.ws = watchService;\n        }\n\n        public void deactivate() {\n            this.active = false;\n        }\n\n        @Override\n        public void execute(final ConfigServiceWatchServiceExecutor wsExecutor) {\n            while (active) {\n                try {\n\n                    final WatchKey wk;\n                    try {\n                        wk = ws.take();\n                    } catch (final Exception ex) {\n                        break;\n                    }\n\n                    final List<WatchEvent<?>> events = wk.pollEvents();\n\n                    boolean markerFileModified = false;\n                    for (final WatchEvent<?> event : events) {\n                        final WatchContext context = (WatchContext) event.context();\n                        if (event.kind().equals(StandardWatchEventKind.ENTRY_MODIFY)) {\n                            if (context.getOldPath().getFileName().toString().equals(LAST_MODIFIED_MARKER_FILE)) {\n                                markerFileModified = true;\n                                break;\n                            }\n                        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_CREATE)) {\n                            if (context.getPath().getFileName().toString().equals(LAST_MODIFIED_MARKER_FILE)) {\n                                markerFileModified = true;\n                                break;\n                            }\n                        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_RENAME)) {\n                            if (context.getOldPath().getFileName().toString().equals(LAST_MODIFIED_MARKER_FILE)) {\n                                markerFileModified = true;\n                                break;\n                            }\n                        } else if (event.kind().equals(StandardWatchEventKind.ENTRY_DELETE)) {\n                            if (context.getOldPath().getFileName().toString().equals(LAST_MODIFIED_MARKER_FILE)) {\n                                markerFileModified = true;\n                                break;\n                            }\n                        }\n                    }\n\n                    if (markerFileModified) {\n                        wsExecutor.execute(wk,\n                                           localLastModifiedValue.get(),\n                                           ConfigurationServiceImpl.this);\n                    }\n\n                    boolean valid = wk.reset();\n                    if (!valid) {\n                        break;\n                    }\n                } catch (final Exception ignored) {\n                }\n            }\n        }\n\n        @Override\n        public String getDescription() {\n            return \"Config File Watch Service\";\n        }\n    }\n\n    protected ConfigServiceWatchServiceExecutor getWatchServiceExecutor() {\n        if (executor == null) {\n            ConfigServiceWatchServiceExecutor _executor = null;\n            try {\n                _executor = InitialContext.doLookup(\"java:module/ConfigServiceWatchServiceExecutorImpl\");\n            } catch (final Exception ignored) {\n            }\n\n            if (_executor == null) {\n                _executor = new ConfigServiceWatchServiceExecutorImpl();\n                ((ConfigServiceWatchServiceExecutorImpl) _executor).setConfig(systemRepository,\n                                                                              ioService,\n                                                                              repoChangedEvent,\n                                                                              spaceChangedEvent,\n                                                                              changedEvent);\n            }\n            executor = _executor;\n        }\n\n        return executor;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/DefaultPasswordServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.jasypt.encryption.pbe.StandardPBEStringEncryptor;\nimport org.jasypt.exceptions.EncryptionOperationNotPossibleException;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class DefaultPasswordServiceImpl implements PasswordService {\n\n    private static final Logger log = LoggerFactory.getLogger(DefaultPasswordServiceImpl.class);\n\n    private static final String SECURE_STRING = System.getProperty(\"org.uberfire.secure.key\",\n                                                                   \"org.uberfire.admin\");\n    private static final String SECURE_ALGORITHM = System.getProperty(\"org.uberfire.secure.alg\",\n                                                                      \"PBEWithMD5AndDES\");\n\n    @Override\n    public String encrypt(final String plainText) {\n        final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();\n        encryptor.setPassword(SECURE_STRING);\n        encryptor.setAlgorithm(SECURE_ALGORITHM);\n\n        String result = plainText;\n        try {\n            result = encryptor.encrypt(plainText);\n        } catch (EncryptionOperationNotPossibleException e) {\n            log.error(\"Unable to encrypt\",\n                      e);\n        }\n        return result;\n    }\n\n    @Override\n    public String decrypt(final String encryptedText) {\n        final StandardPBEStringEncryptor encryptor = new StandardPBEStringEncryptor();\n        encryptor.setPassword(SECURE_STRING);\n        encryptor.setAlgorithm(SECURE_ALGORITHM);\n\n        String result = encryptedText;\n        try {\n            result = encryptor.decrypt(encryptedText);\n        } catch (EncryptionOperationNotPossibleException e) {\n            log.error(\"Unable to decrypt\",\n                      e);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/OrgUnit.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Target({ElementType.FIELD, ElementType.PARAMETER})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface OrgUnit {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/Removed.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.config;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.PARAMETER;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Target({PARAMETER, FIELD})\n@Retention(RUNTIME)\npublic @interface Removed {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/Repository.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Target({ElementType.FIELD, ElementType.PARAMETER})\n@Retention(RetentionPolicy.RUNTIME)\npublic @interface Repository {\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/watch/AsyncConfigWatchService.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config.watch;\n\npublic interface AsyncConfigWatchService {\n\n    void execute(final ConfigServiceWatchServiceExecutor wsExecutor);\n\n    String getDescription();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/watch/AsyncWatchServiceCallback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config.watch;\n\npublic interface AsyncWatchServiceCallback {\n\n    public void callback(long value);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/watch/ConfigServiceWatchServiceExecutor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config.watch;\n\nimport org.uberfire.java.nio.file.WatchKey;\n\npublic interface ConfigServiceWatchServiceExecutor {\n\n    void execute(final WatchKey watchKey,\n                 final long localLastModifiedValue,\n                 final AsyncWatchServiceCallback callback);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/config/watch/ConfigServiceWatchServiceExecutorImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.config.watch;\n\nimport javax.ejb.Singleton;\nimport javax.ejb.Startup;\nimport javax.ejb.TransactionAttribute;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.backend.config.ConfigurationServiceImpl;\nimport org.guvnor.structure.backend.config.OrgUnit;\nimport org.guvnor.structure.backend.config.Repository;\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.WatchKey;\n\nimport static javax.ejb.TransactionAttributeType.NOT_SUPPORTED;\n\n@Singleton\n@Startup\n@TransactionAttribute(NOT_SUPPORTED)\npublic class ConfigServiceWatchServiceExecutorImpl implements ConfigServiceWatchServiceExecutor {\n\n    @Inject\n    @Named(\"system\")\n    private org.guvnor.structure.repositories.Repository systemRepository;\n\n    @Inject\n    @Named(\"configIO\")\n    private IOService ioService;\n\n    // monitor capabilities\n    @Inject\n    @Repository\n    private Event<SystemRepositoryChangedEvent> repoChangedEvent;\n    @Inject\n    @OrgUnit\n    private Event<SystemRepositoryChangedEvent> orgUnitChangedEvent;\n    @Inject\n    private Event<SystemRepositoryChangedEvent> changedEvent;\n\n    public void setConfig(final org.guvnor.structure.repositories.Repository systemRepository,\n                          final IOService ioService,\n                          final Event<SystemRepositoryChangedEvent> repoChangedEvent,\n                          final Event<SystemRepositoryChangedEvent> orgUnitChangedEvent,\n                          final Event<SystemRepositoryChangedEvent> changedEvent) {\n        this.systemRepository = systemRepository;\n        this.ioService = ioService;\n        this.repoChangedEvent = repoChangedEvent;\n        this.orgUnitChangedEvent = orgUnitChangedEvent;\n        this.changedEvent = changedEvent;\n    }\n\n    @Override\n    public void execute(final WatchKey watchKey,\n                        final long localLastModifiedValue,\n                        final AsyncWatchServiceCallback callback) {\n        final long currentValue = getLastModified();\n        if (currentValue > localLastModifiedValue) {\n            callback.callback(currentValue);\n            // notify first repository\n            repoChangedEvent.fire(new SystemRepositoryChangedEvent());\n            // then org unit\n            orgUnitChangedEvent.fire(new SystemRepositoryChangedEvent());\n            // lastly all others\n            changedEvent.fire(new SystemRepositoryChangedEvent());\n        }\n    }\n\n    private long getLastModified() {\n        final Path lastModifiedPath = ioService.get(systemRepository.getUri()).resolve(ConfigurationServiceImpl.LAST_MODIFIED_MARKER_FILE);\n\n        return ioService.getLastModifiedTime(lastModifiedPath).toMillis();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/deployment/DeploymentConfigChangedEvent.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.deployment;\n\npublic class DeploymentConfigChangedEvent {\n\n    public Object getDeploymentUnit() {\n        return deploymentUnit;\n    }\n\n    public void setDeploymentUnit(Object deploymentUnit) {\n        this.deploymentUnit = deploymentUnit;\n    }\n\n    private Object deploymentUnit;\n\n    public DeploymentConfigChangedEvent() {\n\n    }\n\n    public DeploymentConfigChangedEvent(Object deploymentUnit) {\n        this.deploymentUnit = deploymentUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/deployment/DeploymentConfigFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.deployment;\n\nimport org.guvnor.structure.deployment.DeploymentConfig;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.deployment.DeploymentConfigFactory;\n\npublic class DeploymentConfigFactoryImpl implements DeploymentConfigFactory {\n\n    @Override\n    public DeploymentConfig newDeployment(ConfigGroup groupConfig) {\n        return new DeploymentConfigImpl(groupConfig.getName(),\n                                        groupConfig.getConfigItem(\"unit\").getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/deployment/DeploymentConfigImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.deployment;\n\nimport org.guvnor.structure.deployment.DeploymentConfig;\n\npublic class DeploymentConfigImpl implements DeploymentConfig {\n\n    private String identifier;\n    private Object deploymentUnit;\n\n    public DeploymentConfigImpl(String identifier,\n                                Object deploymentUnit) {\n        this.identifier = identifier;\n        this.deploymentUnit = deploymentUnit;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    @Override\n    public Object getDeploymentUnit() {\n        return deploymentUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/deployment/DeploymentConfigServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.deployment;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.concurrent.ConcurrentHashMap;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.backend.config.Added;\nimport org.guvnor.structure.backend.config.Removed;\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.guvnor.structure.deployment.DeploymentConfig;\nimport org.guvnor.structure.deployment.DeploymentConfigService;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.guvnor.structure.server.deployment.DeploymentConfigFactory;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n@ApplicationScoped\npublic class DeploymentConfigServiceImpl implements DeploymentConfigService {\n\n    private static final Logger logger = LoggerFactory.getLogger(DeploymentConfigServiceImpl.class);\n\n    @Inject\n    private ConfigurationService configurationService;\n\n    @Inject\n    private ConfigurationFactory configurationFactory;\n\n    @Inject\n    private DeploymentConfigFactory deploymentFactory;\n    @Inject\n    @Added\n    private Event<DeploymentConfigChangedEvent> addedDeploymentEvent;\n    @Inject\n    @Removed\n    private Event<DeploymentConfigChangedEvent> removedDeploymentEvent;\n\n    private Map<String, DeploymentConfig> registeredDeployments = new ConcurrentHashMap<String, DeploymentConfig>();\n\n    @PostConstruct\n    public void loadGroups() {\n        Collection<ConfigGroup> deployments = configurationService.getConfiguration(ConfigType.DEPLOYMENT);\n        if (deployments != null) {\n            for (ConfigGroup deploymentConfig : deployments) {\n                DeploymentConfig deployment = deploymentFactory.newDeployment(deploymentConfig);\n                registeredDeployments.put(deployment.getIdentifier(),\n                                          deployment);\n            }\n        }\n    }\n\n    @Override\n    public void addDeployment(String identifier,\n                              Object deploymentUnit) {\n        ConfigGroup deploymentConfig = configurationFactory.newConfigGroup(ConfigType.DEPLOYMENT,\n                                                                           identifier,\n                                                                           \"\");\n        deploymentConfig.addConfigItem(configurationFactory.newConfigItem(\"unit\",\n                                                                          deploymentUnit));\n\n        configurationService.addConfiguration(deploymentConfig);\n\n        DeploymentConfig deployment = deploymentFactory.newDeployment(deploymentConfig);\n        registeredDeployments.put(deployment.getIdentifier(),\n                                  deployment);\n    }\n\n    @Override\n    public void removeDeployment(String identifier) {\n        ConfigGroup deploymentConfig = configurationFactory.newConfigGroup(ConfigType.DEPLOYMENT,\n                                                                           identifier,\n                                                                           \"\");\n        configurationService.removeConfiguration(deploymentConfig);\n\n        registeredDeployments.remove(identifier);\n    }\n\n    @Override\n    public DeploymentConfig getDeployment(String identifier) {\n        return registeredDeployments.get(identifier);\n    }\n\n    @Override\n    public Collection<DeploymentConfig> getDeployments() {\n        return Collections.unmodifiableCollection(registeredDeployments.values());\n    }\n\n    public void updateRegisteredDeployments(@Observes SystemRepositoryChangedEvent changedEvent) {\n        logger.debug(\"Received deployment changed event, processing...\");\n        Collection<ConfigGroup> deployments = configurationService.getConfiguration(ConfigType.DEPLOYMENT);\n        if (deployments != null) {\n            List<String> processedDeployments = new ArrayList<String>();\n            for (ConfigGroup deploymentConfig : deployments) {\n                String name = deploymentConfig.getName();\n\n                if (!this.registeredDeployments.containsKey(name)) {\n                    try {\n                        logger.debug(\"New deployment {} has been discovered and will be deployed\",\n                                     name);\n                        // add it to registered deployments\n                        DeploymentConfig deployment = deploymentFactory.newDeployment(deploymentConfig);\n                        // trigger deployment of new element\n                        addedDeploymentEvent.fire(new DeploymentConfigChangedEvent(deployment.getDeploymentUnit()));\n                        registeredDeployments.put(deployment.getIdentifier(),\n                                                  deployment);\n                        logger.debug(\"Deployment {} deployed successfully\",\n                                     name);\n                    } catch (RuntimeException e) {\n                        logger.warn(\"Deployment {} failed to deploy due to {}\",\n                                    name,\n                                    e.getMessage(),\n                                    e);\n                    }\n                }\n\n                processedDeployments.add(name);\n            }\n\n            Set<String> registeredDeploymedIds = registeredDeployments.keySet();\n            // process undeploy\n            for (String identifier : registeredDeploymedIds) {\n                if (!processedDeployments.contains(identifier)) {\n                    try {\n                        logger.debug(\"New deployment {} has been discovered and will be deployed\",\n                                     identifier);\n                        DeploymentConfig deployment = registeredDeployments.remove(identifier);\n\n                        // trigger undeloyment as it was removed\n                        removedDeploymentEvent.fire(new DeploymentConfigChangedEvent(deployment.getDeploymentUnit()));\n                        logger.debug(\"Deployment {} undeployed successfully\",\n                                     identifier);\n                    } catch (RuntimeException e) {\n                        logger.warn(\"Undeployment {} failed to deploy due to {}\",\n                                    identifier,\n                                    e.getMessage(),\n                                    e);\n                    }\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.util.Collection;\nimport java.util.List;\nimport javax.inject.Inject;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.organizationalunit.OrganizationalUnitFactory;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\npublic class OrganizationalUnitFactoryImpl implements OrganizationalUnitFactory {\n\n    private RepositoryService repositoryService;\n\n    private SpacesAPI spacesAPI;\n\n    @Inject\n    public OrganizationalUnitFactoryImpl(final RepositoryService repositoryService,\n                                         final SpacesAPI spacesAPI) {\n        this.repositoryService = repositoryService;\n        this.spacesAPI = spacesAPI;\n    }\n\n    @Override\n    public OrganizationalUnit newOrganizationalUnit(final SpaceInfo spaceInfo) {\n\n        OrganizationalUnitImpl organizationalUnit = new OrganizationalUnitImpl(spaceInfo.getName(),\n                                                                               spaceInfo.getDefaultGroupId());\n        organizationalUnit.setDescription(spaceInfo.getDescription());\n\n        final List<RepositoryInfo> repositories = spaceInfo.getRepositories();\n        if (repositories != null) {\n            for (RepositoryInfo alias : repositories) {\n                Space space = spacesAPI.getSpace(organizationalUnit.getName());\n                final Repository repo = repositoryService.getRepositoryFromSpace(space,\n                                                                                 alias.getName());\n                if (repo != null) {\n                    organizationalUnit.getRepositories().add(repo);\n                }\n            }\n        }\n\n        final List<String> securityGroups = spaceInfo.getSecurityGroups();\n        if (securityGroups != null) {\n            organizationalUnit.getGroups().addAll(securityGroups);\n        }\n\n        final Collection<Contributor> contributors = spaceInfo.getContributors();\n        if (contributors != null) {\n            organizationalUnit.getContributors().addAll(contributors);\n        }\n\n        return organizationalUnit;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitSearchServiceImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitSearchService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.jboss.errai.bus.server.annotations.Service;\n\n@Service\n@ApplicationScoped\npublic class OrganizationalUnitSearchServiceImpl implements OrganizationalUnitSearchService {\n\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Inject\n    public OrganizationalUnitSearchServiceImpl(OrganizationalUnitService organizationalUnitService) {\n        this.organizationalUnitService = organizationalUnitService;\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> searchByName(String pattern,\n                                                       int maxItems,\n                                                       boolean caseSensitive) {\n        List<OrganizationalUnit> results = new ArrayList<>();\n        for (OrganizationalUnit unit : organizationalUnitService.getAllOrganizationalUnits()) {\n            String name = unit.getName();\n            if (caseSensitive ? name.contains(pattern) : name.toLowerCase().contains(pattern.toLowerCase())) {\n                results.add(unit);\n                if (maxItems > 0 && results.size() >= maxItems) {\n                    return results;\n                }\n            }\n        }\n        return results;\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> searchById(Collection<String> ids) {\n        List<OrganizationalUnit> results = new ArrayList<>();\n        for (OrganizationalUnit unit : organizationalUnitService.getAllOrganizationalUnits()) {\n            if (ids.contains(unit.getIdentifier())) {\n                results.add(unit);\n            }\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.nio.file.DirectoryStream;\nimport java.nio.file.Files;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.contributors.SpaceContributorsUpdatedEvent;\nimport org.guvnor.structure.organizationalunit.NewOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.RepoAddedToOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.RepoRemovedFromOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.UpdatedOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.guvnor.structure.server.organizationalunit.OrganizationalUnitFactory;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.ext.security.management.api.event.UserDeletedEvent;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.backend.InputEscapeUtils.escapeContributorsNames;\n\n@Service\n@ApplicationScoped\npublic class OrganizationalUnitServiceImpl implements OrganizationalUnitService {\n\n    public static final String DEFAULT_GROUP_ID = \"defaultGroupId\";\n    public static final String DELETED = \"deleted\";\n    private OrganizationalUnitFactory organizationalUnitFactory;\n\n    private Event<NewOrganizationalUnitEvent> newOrganizationalUnitEvent;\n\n    private Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent;\n\n    private Event<RepoAddedToOrganizationalUnitEvent> repoAddedToOrgUnitEvent;\n\n    private Event<RepoRemovedFromOrganizationalUnitEvent> repoRemovedFromOrgUnitEvent;\n\n    private Event<UpdatedOrganizationalUnitEvent> updatedOrganizationalUnitEvent;\n\n    private AuthorizationManager authorizationManager;\n\n    private SessionInfo sessionInfo;\n\n    private SpacesAPI spaces;\n\n    private RepositoryService repositoryService;\n\n    private IOService ioService;\n\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    private FileSystem systemFS;\n\n    private Event<SpaceContributorsUpdatedEvent> spaceContributorsUpdatedEvent;\n    private ConfigurationService configurationService;\n\n    public OrganizationalUnitServiceImpl() {\n    }\n\n    @Inject\n    public OrganizationalUnitServiceImpl(final OrganizationalUnitFactory organizationalUnitFactory,\n                                         final RepositoryService repositoryService,\n                                         final Event<NewOrganizationalUnitEvent> newOrganizationalUnitEvent,\n                                         final Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent,\n                                         final Event<RepoAddedToOrganizationalUnitEvent> repoAddedToOrgUnitEvent,\n                                         final Event<RepoRemovedFromOrganizationalUnitEvent> repoRemovedFromOrgUnitEvent,\n                                         final Event<UpdatedOrganizationalUnitEvent> updatedOrganizationalUnitEvent,\n                                         final AuthorizationManager authorizationManager,\n                                         final SpacesAPI spaces,\n                                         final SessionInfo sessionInfo,\n                                         @Named(\"ioStrategy\") final IOService ioService,\n                                         final SpaceConfigStorageRegistry spaceConfigStorageRegistry,\n                                         final @Named(\"systemFS\") FileSystem systemFS,\n                                         final Event<SpaceContributorsUpdatedEvent> spaceContributorsUpdatedEvent,\n                                         final ConfigurationService configurationService) {\n        this.organizationalUnitFactory = organizationalUnitFactory;\n        this.repositoryService = repositoryService;\n        this.newOrganizationalUnitEvent = newOrganizationalUnitEvent;\n        this.removeOrganizationalUnitEvent = removeOrganizationalUnitEvent;\n        this.repoAddedToOrgUnitEvent = repoAddedToOrgUnitEvent;\n        this.repoRemovedFromOrgUnitEvent = repoRemovedFromOrgUnitEvent;\n        this.updatedOrganizationalUnitEvent = updatedOrganizationalUnitEvent;\n        this.authorizationManager = authorizationManager;\n        this.spaces = spaces;\n        this.sessionInfo = sessionInfo;\n        this.ioService = ioService;\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n        this.systemFS = systemFS;\n        this.spaceContributorsUpdatedEvent = spaceContributorsUpdatedEvent;\n        this.configurationService = configurationService;\n    }\n\n    public void userRemoved(final @Observes UserDeletedEvent event) {\n        final String removedUserIdentifier = event.getIdentifier();\n        for (OrganizationalUnit organizationalUnit : getAllOrganizationalUnits()) {\n            final boolean userRemoved = organizationalUnit.getContributors().removeIf(c -> c.getUsername().equals(removedUserIdentifier));\n            if (userRemoved) {\n                updateOrganizationalUnit(organizationalUnit.getName(),\n                                         organizationalUnit.getDefaultGroupId(),\n                                         organizationalUnit.getContributors());\n            }\n\n            for (Repository repository : organizationalUnit.getRepositories()) {\n                final List<Contributor> updatedRepositoryContributors = new ArrayList<>(repository.getContributors());\n                final boolean repositoryContributorRemoved = updatedRepositoryContributors.removeIf(c -> c.getUsername().equals(removedUserIdentifier));\n                if (repositoryContributorRemoved) {\n                    repositoryService.updateContributors(repository,\n                                                         updatedRepositoryContributors);\n                }\n            }\n        }\n    }\n\n    @Override\n    public OrganizationalUnit getOrganizationalUnit(final String name) {\n        return getOrganizationalUnit(name,\n                                     false);\n    }\n\n    @Override\n    public OrganizationalUnit getOrganizationalUnit(final String name,\n                                                    final boolean includeDeleted) {\n        if (spaceConfigStorageRegistry.exist(name) && !isDeleted(name)) {\n            SpaceInfo spaceInfo = this.spaceConfigStorageRegistry.get(name).loadSpaceInfo();\n            if (spaceInfo != null) {\n                return organizationalUnitFactory.newOrganizationalUnit(spaceInfo);\n            }\n        } else {\n            if (includeDeleted) {\n                return this.getAllDeletedOrganizationalUnit()\n                        .stream()\n                        .filter(organizationalUnit -> organizationalUnit.getName().equalsIgnoreCase(name)).findFirst().orElse(null);\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getAllOrganizationalUnits() {\n        return getAllOrganizationalUnits(false);\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getAllOrganizationalUnits(final boolean includeDeleted) {\n        return this.getAllOrganizationalUnits(includeDeleted, (ou) -> !ou.getName().startsWith(\".\"));\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getAllOrganizationalUnits(final boolean includeDeleted, final Predicate<OrganizationalUnit> filter) {\n        final List<OrganizationalUnit> spaces = new ArrayList<>();\n\n        try (DirectoryStream<java.nio.file.Path> stream = Files.newDirectoryStream(getNiogitPath())) {\n            for (java.nio.file.Path spacePath : stream) {\n                final File spaceDirectory = spacePath.toFile();\n\n                if (spaceDirectory.isDirectory() && !spaceDirectory.getName().equals(\"system\") && !isDeleted(spaceDirectory.getName())) {\n                    SpaceConfigStorage configStorage = this.spaceConfigStorageRegistry.get(spaceDirectory.getName());\n                    if (configStorage.isInitialized()) {\n                        OrganizationalUnit ou = getOrganizationalUnit(spaceDirectory.getName(),\n                                                                      false);\n                        if (ou != null) {\n                            spaces.add(ou);\n                        }\n                    }\n                }\n            }\n\n            if (includeDeleted) {\n                spaces.addAll(this.getAllDeletedOrganizationalUnit());\n            }\n\n            return spaces.stream().filter(filter).collect(Collectors.toList());\n        } catch (IOException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getAllDeletedOrganizationalUnit() {\n        List<ConfigGroup> spaceConfiguration = this.configurationService.getConfiguration(ConfigType.SPACE);\n        return spaceConfiguration.stream()\n                .filter(configGroup -> Optional.ofNullable(configGroup.getConfigItem(DELETED)).isPresent())\n                .map(configGroup -> this.createDeletedOrganizationalUnit(configGroup))\n                .collect(Collectors.toList());\n    }\n\n    protected boolean isDeleted(String spaceName) {\n        List<ConfigGroup> spaceConfigurations = this.configurationService.getConfiguration(ConfigType.SPACE);\n        return spaceConfigurations.stream()\n                .filter(spaceConfiguration -> spaceConfiguration.getName().equalsIgnoreCase(spaceName) &&\n                        spaceConfiguration.getConfigItem(DELETED) != null)\n                .findFirst()\n                .isPresent();\n    }\n\n    public void onRemoveOrganizationalUnit(@Observes RemoveOrganizationalUnitEvent event) {\n        if (event.getOrganizationalUnit() != null && event.getOrganizationalUnit().getSpace() != null) {\n            this.spaceConfigStorageRegistry.remove(event.getOrganizationalUnit().getSpace().getName());\n        }\n    }\n\n    @Override\n    public Collection<Space> getAllUserSpaces() {\n        return getAllOrganizationalUnits()\n                .stream()\n                .map(ou -> spaces.getSpace(ou.getName()))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getOrganizationalUnits() {\n        return getOrganizationalUnits(false);\n    }\n\n    @Override\n    public Collection<OrganizationalUnit> getOrganizationalUnits(final boolean includeDeleted) {\n        final List<OrganizationalUnit> result = new ArrayList<>();\n        for (OrganizationalUnit ou : getAllOrganizationalUnits(includeDeleted)) {\n            if (authorizationManager.authorize(ou,\n                                               sessionInfo.getIdentity())\n                    || ou.getContributors().stream().anyMatch(c -> c.getUsername().equals(sessionInfo.getIdentity().getIdentifier()))) {\n                result.add(ou);\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public OrganizationalUnit createOrganizationalUnit(final String name,\n                                                       final String defaultGroupId) {\n\n        return createOrganizationalUnit(name,\n                                        defaultGroupId,\n                                        new ArrayList<>());\n    }\n\n    @Override\n    public OrganizationalUnit createOrganizationalUnit(final String name,\n                                                       final String defaultGroupId,\n                                                       final Collection<Repository> repositories) {\n\n        return createOrganizationalUnit(name,\n                                        defaultGroupId,\n                                        repositories,\n                                        new ArrayList<>());\n    }\n\n    @Override\n    public OrganizationalUnit createOrganizationalUnit(final String name,\n                                                       final String defaultGroupId,\n                                                       final Collection<Repository> repositories,\n                                                       final Collection<Contributor> contributors) {\n        return createOrganizationalUnit(name,\n                                        defaultGroupId,\n                                        repositories,\n                                        contributors,\n                                        null);\n    }\n\n    @Override\n    public OrganizationalUnit createOrganizationalUnit(final String name,\n                                                       final String defaultGroupId,\n                                                       final Collection<Repository> repositories,\n                                                       final Collection<Contributor> contributors,\n                                                       final String description) {\n        if (spaceDirectoryExists(name)) {\n            return null;\n        }\n\n        OrganizationalUnit newOrganizationalUnit = null;\n\n        try {\n            String _defaultGroupId = defaultGroupId == null || defaultGroupId.trim().isEmpty() ? getSanitizedDefaultGroupId(name) : defaultGroupId;\n            final SpaceInfo spaceInfo = new SpaceInfo(name,\n                                                      description,\n                                                      _defaultGroupId,\n                                                      escapeContributorsNames(contributors),\n                                                      getRepositoryAliases(repositories),\n                                                      Collections.emptyList());\n            spaceConfigStorageRegistry.get(name).saveSpaceInfo(spaceInfo);\n            newOrganizationalUnit = organizationalUnitFactory.newOrganizationalUnit(spaceInfo);\n\n            return newOrganizationalUnit;\n        } finally {\n            if (newOrganizationalUnit != null) {\n                newOrganizationalUnitEvent.fire(new NewOrganizationalUnitEvent(newOrganizationalUnit,\n                                                                               getUserInfo(sessionInfo)));\n            }\n        }\n    }\n\n    private List<RepositoryInfo> getRepositoryAliases(final Collection<Repository> repositories) {\n        return repositories.stream()\n                .map(repository -> new RepositoryInfo(repository.getAlias(),\n                                                      false,\n                                                      new RepositoryConfiguration(repository.getEnvironment())))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public OrganizationalUnit updateOrganizationalUnit(final String name,\n                                                       final String defaultGroupId) {\n        return updateOrganizationalUnit(name,\n                                        defaultGroupId,\n                                        null);\n    }\n\n    @Override\n    public OrganizationalUnit updateOrganizationalUnit(String name,\n                                                       String defaultGroupId,\n                                                       Collection<Contributor> contributors) {\n        return updateOrganizationalUnit(name,\n                                        defaultGroupId,\n                                        contributors,\n                                        null);\n    }\n\n    @Override\n    public OrganizationalUnit updateOrganizationalUnit(String name,\n                                                       String defaultGroupId,\n                                                       Collection<Contributor> contributors,\n                                                       String description) {\n        return spaceConfigStorageRegistry.getBatch(name)\n                .run(context -> {\n                    OrganizationalUnit updatedOrganizationalUnit = null;\n                    try {\n                        SpaceInfo spaceInfo = context.getSpaceInfo();\n\n                        // As per loadOrganizationalUnits(), all Organizational Units should have the default group id value set\n                        String _defaultGroupId = defaultGroupId == null || defaultGroupId.trim().isEmpty() ?\n                                spaceInfo.getDefaultGroupId() : defaultGroupId;\n                        spaceInfo.setDefaultGroupId(_defaultGroupId);\n\n                        if (contributors != null) {\n                            spaceInfo.setContributors(escapeContributorsNames(contributors));\n                        }\n\n                        if (description != null) {\n                            spaceInfo.setDescription(description);\n                        }\n\n                        context.saveSpaceInfo();\n\n                        updatedOrganizationalUnit = getOrganizationalUnit(name);\n\n                        checkChildrenRepositoryContributors(updatedOrganizationalUnit);\n\n                        return updatedOrganizationalUnit;\n                    } finally {\n                        if (updatedOrganizationalUnit != null) {\n                            updatedOrganizationalUnitEvent.fire(new UpdatedOrganizationalUnitEvent(updatedOrganizationalUnit,\n                                                                                                   getUserInfo(sessionInfo)));\n                            if (contributors != null) {\n                                spaceContributorsUpdatedEvent.fire(new SpaceContributorsUpdatedEvent(updatedOrganizationalUnit));\n                            }\n                        }\n                    }\n                });\n    }\n\n    void checkChildrenRepositoryContributors(final OrganizationalUnit updatedOrganizationalUnit) {\n        repositoryService.getAllRepositories(updatedOrganizationalUnit.getSpace()).forEach(repository -> {\n            final List<Contributor> updatedRepositoryContributors = repository.getContributors().stream()\n                    .filter(contributor -> updatedOrganizationalUnit.getContributors().stream()\n                            .anyMatch(spaceContributor -> spaceContributor.getUsername().equals(contributor.getUsername())))\n                    .collect(Collectors.toList());\n\n            if (updatedRepositoryContributors.size() != repository.getContributors().size()) {\n                repositoryService.updateContributors(repository,\n                                                     updatedRepositoryContributors);\n            }\n        });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void addRepository(final OrganizationalUnit organizationalUnit,\n                              final Repository repository) {\n\n        spaceConfigStorageRegistry.getBatch(organizationalUnit.getName())\n                .run(context -> {\n                    try {\n                        context.getSpaceInfo().getRepositories().add(new RepositoryInfo(repository.getAlias(),\n                                                                                        false,\n                                                                                        new RepositoryConfiguration(repository.getEnvironment())));\n\n                        context.saveSpaceInfo();\n                    } finally {\n                        repoAddedToOrgUnitEvent.fire(new RepoAddedToOrganizationalUnitEvent(organizationalUnit,\n                                                                                            repository,\n                                                                                            getUserInfo(sessionInfo)));\n                    }\n\n                    return null;\n                });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void removeRepository(final OrganizationalUnit organizationalUnit,\n                                 final Repository repository) {\n\n        spaceConfigStorageRegistry.getBatch(organizationalUnit.getName())\n                .run(context -> {\n                    try {\n                        context.getSpaceInfo().getRepositories()\n                                .stream()\n                                .filter(repositoryInfo -> repositoryInfo.getName().equals(repository.getAlias()) && !repositoryInfo.isDeleted())\n                                .findFirst()\n                                .orElseThrow(() -> new RuntimeException(\"Repository not found\"))\n                                .setDeleted(true);\n\n                        context.saveSpaceInfo();\n\n                        return null;\n                    } finally {\n                        repoRemovedFromOrgUnitEvent.fire(new RepoRemovedFromOrganizationalUnitEvent(organizationalUnit,\n                                                                                                    repository,\n                                                                                                    getUserInfo(sessionInfo)));\n                    }\n                });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void addGroup(final OrganizationalUnit organizationalUnit,\n                         final String group) {\n\n        spaceConfigStorageRegistry.getBatch(organizationalUnit.getName())\n                .run(context -> {\n                    OrganizationalUnit updatedOrganizationalUnit = null;\n                    try {\n                        context.getSpaceInfo().getSecurityGroups().add(group);\n                        context.saveSpaceInfo();\n\n                        updatedOrganizationalUnit = getOrganizationalUnit(organizationalUnit.getName());\n\n                        return null;\n                    } finally {\n                        if (updatedOrganizationalUnit != null) {\n                            updatedOrganizationalUnitEvent.fire(new UpdatedOrganizationalUnitEvent(updatedOrganizationalUnit,\n                                                                                                   getUserInfo(sessionInfo)));\n                        }\n                    }\n                });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void removeGroup(final OrganizationalUnit organizationalUnit,\n                            final String group) {\n\n        spaceConfigStorageRegistry.getBatch(organizationalUnit.getName())\n                .run(context -> {\n                    OrganizationalUnit updatedOrganizationalUnit = null;\n                    try {\n                        context.getSpaceInfo().getSecurityGroups().remove(group);\n                        context.saveSpaceInfo();\n\n                        updatedOrganizationalUnit = getOrganizationalUnit(organizationalUnit.getName());\n                    } finally {\n                        if (updatedOrganizationalUnit != null) {\n                            updatedOrganizationalUnitEvent.fire(new UpdatedOrganizationalUnitEvent(updatedOrganizationalUnit,\n                                                                                                   getUserInfo(sessionInfo)));\n                        }\n                    }\n\n                    return null;\n                });\n    }\n\n    @Override\n    public void removeOrganizationalUnit(String groupName) {\n        final OrganizationalUnit organizationalUnit = getOrganizationalUnit(groupName);\n\n        if (organizationalUnit != null) {\n            repositoryService.removeRepositories(organizationalUnit.getSpace(),\n                                                 organizationalUnit.getRepositories().stream().map(repo -> repo.getAlias()).collect(Collectors.toSet()));\n            removeSpaceDirectory(organizationalUnit);\n            removeOrganizationalUnitEvent.fire(new RemoveOrganizationalUnitEvent(organizationalUnit,\n                                                                                 getUserInfo(sessionInfo)));\n        }\n    }\n\n    private void removeSpaceDirectory(final OrganizationalUnit organizationalUnit) {\n\n        this.configurationService.startBatch();\n        ConfigGroup configGroup = new ConfigGroup();\n        configGroup.setType(ConfigType.SPACE);\n        configGroup.setName(organizationalUnit.getSpace().getName());\n        ConfigItem<Boolean> deletedConfigItem = new ConfigItem<>();\n        deletedConfigItem.setName(DELETED);\n        deletedConfigItem.setValue(true);\n        configGroup.addConfigItem(deletedConfigItem);\n        ConfigItem<String> defaultGroupIdConfigItem = new ConfigItem<>();\n        defaultGroupIdConfigItem.setName(DEFAULT_GROUP_ID);\n        defaultGroupIdConfigItem.setValue(organizationalUnit.getDefaultGroupId());\n        configGroup.addConfigItem(defaultGroupIdConfigItem);\n        this.configurationService.addConfiguration(configGroup);\n        this.configurationService.endBatch();\n    }\n\n    @Override\n    public OrganizationalUnit getParentOrganizationalUnit(final Repository repository) {\n        for (final OrganizationalUnit organizationalUnit : getAllOrganizationalUnits()) {\n            if (organizationalUnit.getRepositories() != null) {\n                for (final Repository ouRepository : organizationalUnit.getRepositories()) {\n                    if (ouRepository.getAlias().equals(repository.getAlias())) {\n                        return organizationalUnit;\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public List<OrganizationalUnit> getOrganizationalUnits(Repository repository) {\n        final ArrayList<OrganizationalUnit> result = new ArrayList<>();\n\n        for (final OrganizationalUnit organizationalUnit : getAllOrganizationalUnits()) {\n            if (organizationalUnit.getRepositories() != null) {\n                for (final Repository ouRepository : organizationalUnit.getRepositories()) {\n                    if (ouRepository.getAlias().equals(repository.getAlias())) {\n                        result.add(organizationalUnit);\n                    }\n                }\n            }\n        }\n\n        return Collections.unmodifiableList(result);\n    }\n\n    @Override\n    public String getSanitizedDefaultGroupId(final String proposedGroupId) {\n        //Only [A-Za-z0-9_\\-.] are valid so strip everything else out\n        return proposedGroupId != null ? proposedGroupId.replaceAll(\"[^A-Za-z0-9_\\\\-.]\",\n                                                                    \"\") : proposedGroupId;\n    }\n\n    @Override\n    public Boolean isValidGroupId(final String proposedGroupId) {\n        if (proposedGroupId != null && !proposedGroupId.trim().isEmpty()) {\n            if (proposedGroupId.length() == getSanitizedDefaultGroupId(proposedGroupId).length()) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    protected String getUserInfo(SessionInfo sessionInfo) {\n        try {\n            return sessionInfo.getIdentity().getIdentifier();\n        } catch (final Exception e) {\n            return \"system\";\n        }\n    }\n\n    java.nio.file.Path getNiogitPath() {\n        return systemFS.getPath(\"/\").toFile().getParentFile().getParentFile().toPath();\n    }\n\n    boolean spaceDirectoryExists(String spaceName) {\n        SpaceConfigStorage configStorage = this.spaceConfigStorageRegistry.get(spaceName);\n        return getNiogitPath().resolve(spaceName).toFile().exists() &&\n                configStorage.isInitialized();\n    }\n\n    private OrganizationalUnit createDeletedOrganizationalUnit(ConfigGroup configGroup) {\n        String spaceName = configGroup.getName();\n        String defaultGroupId = configGroup.getConfigItemValue(DEFAULT_GROUP_ID);\n        return new OrganizationalUnitImpl(spaceName,\n                                          defaultGroupId,\n                                          true);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/config/ActiveSpaceConfigStorageBatchContextRegistry.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.util.Map;\nimport java.util.concurrent.ConcurrentHashMap;\n\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageBatch;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\n\npublic class ActiveSpaceConfigStorageBatchContextRegistry {\n\n    private static Map<Long, SpaceConfigStorageBatchContextImpl> activeContexts = new ConcurrentHashMap<>();\n\n    public static SpaceConfigStorageBatch.SpaceConfigStorageBatchContext getCurrentBatch(final SpaceConfigStorage spaceConfigStorage,\n                                                                                         final SpaceConfigStorageBatch ownerBatch) {\n\n        return activeContexts.computeIfAbsent(getContextId(), contextId -> new SpaceConfigStorageBatchContextImpl(spaceConfigStorage, ownerBatch));\n    }\n\n    public static void clearCurrentBatch() {\n        activeContexts.remove(getContextId());\n    }\n\n    private static Long getContextId() {\n        return Thread.currentThread().getId();\n    }\n\n    private static class SpaceConfigStorageBatchContextImpl implements SpaceConfigStorageBatch.SpaceConfigStorageBatchContext {\n\n        private final SpaceConfigStorage spaceConfigStorage;\n        private final Object owner;\n        private SpaceInfo info;\n\n        public SpaceConfigStorageBatchContextImpl(SpaceConfigStorage spaceConfigStorage, Object owner) {\n            this.spaceConfigStorage = spaceConfigStorage;\n            this.owner = owner;\n        }\n\n        @Override\n        public SpaceInfo getSpaceInfo() {\n            if (info == null) {\n                info = spaceConfigStorage.loadSpaceInfo();\n            }\n\n            return info;\n        }\n\n        @Override\n        public Object getOwner() {\n            return owner;\n        }\n\n        @Override\n        public void saveSpaceInfo() {\n            spaceConfigStorage.saveSpaceInfo(info);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigCleanUp.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.concurrent.TimeUnit;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.RepositoryUtils;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLockManager;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\n\n@Startup\n@ApplicationScoped\npublic class SpaceConfigCleanUp {\n\n    private static final Logger LOGGER = LoggerFactory.getLogger(SpaceConfigCleanUp.class);\n    private static final String LOCK_NAME = \".config.lock\";\n    private static final String MARKER_NAME = \".config-cleanup.done\";\n    private static final String CLEAN_UP_MESSAGE = \"Space config clean up.\";\n    private static final int LAST_ACCESS_THRESHOLD = 1;\n\n    private OrganizationalUnitService orgUnitService;\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    public SpaceConfigCleanUp() {\n        //Empty constructor for Weld proxying\n    }\n\n    @Inject\n    public SpaceConfigCleanUp(final OrganizationalUnitService orgUnitService,\n                              final SpaceConfigStorageRegistry spaceConfigStorageRegistry) {\n        this.orgUnitService = orgUnitService;\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n    }\n\n    @PostConstruct\n    public void postConstruct() {\n        executeCleanUp();\n    }\n\n    private void executeCleanUp() {\n        try {\n            if (this.isGitDefaultFileSystem()) {\n                orgUnitService.getAllOrganizationalUnits()\n                        .stream()\n                        .map(OrganizationalUnit::getName)\n                        .forEach(this::cleanUpSpaceConfigStorage);\n            }\n        } catch (Exception e) {\n            LOGGER.error(\"Error when executing clean up.\", e);\n        }\n    }\n\n    protected boolean isGitDefaultFileSystem() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n\n    private void cleanUpSpaceConfigStorage(final String spaceName) {\n        final SpaceConfigStorageImpl configStorage = (SpaceConfigStorageImpl) spaceConfigStorageRegistry.get(spaceName);\n\n        final JGitFileSystem fs = (JGitFileSystem) configStorage.getPath().getFileSystem();\n        final File configDirectory = fs.getGit()\n                .getRepository()\n                .getDirectory()\n                .getParentFile();\n\n        final File marker = createMarker(configDirectory);\n\n        if (marker.exists()) {\n            return;\n        }\n\n        final FileSystemLock physicalLock = createLock(configDirectory);\n\n        try {\n            physicalLock.lock();\n\n            final SpaceInfo spaceInfo = configStorage.loadSpaceInfo();\n\n            final boolean updateNeeded = spaceInfo.getRepositories()\n                    .stream()\n                    .map(repositoryInfo -> repositoryInfo.getConfiguration().getEnvironment())\n                    .filter(envMap -> !RepositoryUtils.cleanUpCredentialsFromEnvMap(envMap).isEmpty())\n                    .count() != 0;\n\n            if (updateNeeded) {\n                configStorage.saveSpaceInfo(spaceInfo);\n                fs.getGit().resetWithSquash(CLEAN_UP_MESSAGE);\n            }\n\n            if (!marker.createNewFile()) {\n                LOGGER.warn(\"Cannot create marker file {}.\", MARKER_NAME);\n            }\n        } catch (IOException e) {\n            LOGGER.error(\"Error when cleaning up space config storage.\", e);\n        } finally {\n            physicalLock.unlock();\n        }\n    }\n\n    FileSystemLock createLock(final File directory) {\n        return FileSystemLockManager.getInstance().getFileSystemLock(directory,\n                                                                     LOCK_NAME,\n                                                                     TimeUnit.SECONDS,\n                                                                     LAST_ACCESS_THRESHOLD);\n    }\n\n    File createMarker(final File directory) {\n        return new File(directory, MARKER_NAME);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigStorageImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.LinkedHashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.stream.Collectors;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.apache.commons.io.FilenameUtils;\nimport org.jboss.errai.marshalling.client.Marshalling;\nimport org.jboss.errai.marshalling.client.api.exceptions.MarshallingException;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.RolePermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestComment;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.DirectoryStream;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.spaces.SpacesAPI;\nimport org.uberfire.util.URIUtil;\n\npublic class SpaceConfigStorageImpl implements SpaceConfigStorage {\n\n    public static final String FILE_FORMAT = \".json\";\n\n    public static final String BRANCH_PERMISSIONS = \"BranchPermissions\";\n    public static final String SPACE_INFO = \"SpaceInfo\";\n\n    private static final String CHANGE_REQUESTS_FOLDER = \"change_requests\";\n    private static final String CHANGE_REQUESTS_FILE = \"information.cr\";\n    private static final String CHANGE_REQUEST_COMMENTS_FOLDER = \"comments\";\n    private static final String CHANGE_REQUEST_COMMENT_FILE_EXT = \"comment\";\n\n\n    private static final Logger logger = LoggerFactory.getLogger(SpaceConfigStorageImpl.class);\n\n    private ObjectStorage objectStorage;\n    private IOService ioService;\n    private String spaceName;\n\n    public SpaceConfigStorageImpl() {\n    }\n\n    @Inject\n    public SpaceConfigStorageImpl(final ObjectStorage objectStorage,\n                                  final @Named(\"configIO\") IOService ioService) {\n        this.objectStorage = objectStorage;\n        this.ioService = ioService;\n    }\n\n    public void setup(final String spaceName) {\n        this.spaceName = spaceName;\n        objectStorage.init(getRootURI(spaceName));\n    }\n\n    @Override\n    public BranchPermissions loadBranchPermissions(final String branchName,\n                                                   final String projectIdentifier) {\n        final BranchPermissions branchPermissions = objectStorage.read(buildBranchConfigFilePath(branchName,\n                                                                                                 projectIdentifier,\n                                                                                                 BRANCH_PERMISSIONS));\n\n        if (branchPermissions == null) {\n            return getDefaultBranchPermissions(branchName);\n        }\n\n        return branchPermissions;\n    }\n\n    private URI getRootURI(String spaceName) {\n        return URI.create(SpacesAPI.resolveConfigFileSystemPath(SpacesAPI.Scheme.DEFAULT,\n                                                                spaceName));\n    }\n\n    @Override\n    public void saveBranchPermissions(final String branchName,\n                                      final String projectIdentifier,\n                                      final BranchPermissions branchPermissions) {\n        objectStorage.write(buildBranchConfigFilePath(branchName,\n                                                      projectIdentifier,\n                                                      BRANCH_PERMISSIONS),\n                            branchPermissions);\n    }\n\n    @Override\n    public void deleteBranchPermissions(final String branchName,\n                                        final String projectIdentifier) {\n        objectStorage.delete(buildBranchConfigFilePath(branchName,\n                                                       projectIdentifier,\n                                                       BRANCH_PERMISSIONS));\n    }\n\n    @Override\n    public void deleteRepository(final String repositoryAlias) {\n        deleteAllChangeRequests(repositoryAlias);\n        objectStorage.delete(buildRepositoryFolderPath(repositoryAlias));\n    }\n\n    @Override\n    public List<ChangeRequest> loadChangeRequests(final String repositoryAlias) {\n        return getChangeRequestIds(repositoryAlias).stream()\n                .map(changeRequestId -> loadChangeRequest(repositoryAlias, changeRequestId))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public ChangeRequest loadChangeRequest(final String repositoryAlias,\n                                           final Long changeRequestId) {\n        return objectStorage.read(buildChangeRequestFilePath(repositoryAlias,\n                                                             changeRequestId));\n    }\n\n    @Override\n    public void saveChangeRequest(final String repositoryAlias,\n                                  final ChangeRequest changeRequest) {\n        objectStorage.write(buildChangeRequestFilePath(repositoryAlias,\n                                                       changeRequest.getId()),\n                            changeRequest);\n    }\n\n    @Override\n    public void deleteAllChangeRequests(final String repositoryAlias) {\n        getChangeRequestIds(repositoryAlias).forEach(changeRequestId -> deleteChangeRequest(repositoryAlias,\n                                                                                            changeRequestId));\n    }\n\n    @Override\n    public void deleteChangeRequest(final String repositoryAlias,\n                                    final Long changeRequestId) {\n        deleteAllChangeRequestComments(repositoryAlias,\n                                       changeRequestId);\n        objectStorage.delete(buildChangeRequestFilePath(repositoryAlias,\n                                                        changeRequestId));\n    }\n\n    @Override\n    public List<Long> getChangeRequestIds(String repositoryAlias) {\n        List<Long> changeRequestIds = new ArrayList<>();\n\n        final String changeRequestsFolderPath = buildChangeRequestsFolderPath(repositoryAlias);\n\n        if (objectStorage.exists(changeRequestsFolderPath)) {\n            final Path changeRequestsFolder = objectStorage.getPath(changeRequestsFolderPath);\n\n            try (DirectoryStream<Path> directoryStream =\n                         ioService.newDirectoryStream(changeRequestsFolder,\n                                                      Files::isDirectory)) {\n                directoryStream.forEach(crDir -> {\n                    try {\n                        Long id = Long.valueOf(crDir.getFileName().toString());\n                        changeRequestIds.add(id);\n                    } catch (NumberFormatException e) {\n                        logger.error(\"Cannot convert folder name to long: \", e);\n                    } catch (Exception e) {\n                        logger.error(\"An unexpected exception was thrown: \", e);\n                    }\n                });\n            }\n        }\n\n        return changeRequestIds;\n    }\n\n    @Override\n    public List<ChangeRequestComment> loadChangeRequestComments(final String repositoryAlias,\n                                                                final Long changeRequestId) {\n        return getChangeRequestCommentIds(repositoryAlias,\n                                          changeRequestId)\n                .stream()\n                .map(changeRequestCommentId -> loadChangeRequestComment(repositoryAlias,\n                                                                        changeRequestId,\n                                                                        changeRequestCommentId))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public ChangeRequestComment loadChangeRequestComment(final String repositoryAlias,\n                                                         final Long changeRequestId,\n                                                         final Long changeRequestCommentId) {\n        return objectStorage.read(buildChangeRequestCommentFilePath(repositoryAlias,\n                                                                    changeRequestId,\n                                                                    changeRequestCommentId));\n    }\n\n    @Override\n    public void saveChangeRequestComment(final String repositoryAlias,\n                                         final Long changeRequestId,\n                                         final ChangeRequestComment changeRequestComment) {\n        objectStorage.write(buildChangeRequestCommentFilePath(repositoryAlias,\n                                                              changeRequestId,\n                                                              changeRequestComment.getId()),\n                            changeRequestComment);\n    }\n\n    @Override\n    public void deleteAllChangeRequestComments(final String repositoryAlias,\n                                               final Long changeRequestId) {\n        getChangeRequestCommentIds(repositoryAlias,\n                                   changeRequestId)\n                .forEach(changeRequestCommentId -> deleteChangeRequestComment(repositoryAlias,\n                                                                              changeRequestId,\n                                                                              changeRequestCommentId));\n    }\n\n    @Override\n    public void deleteChangeRequestComment(final String repositoryAlias,\n                                           final Long changeRequestId,\n                                           final Long changeRequestCommentId) {\n        objectStorage.delete(buildChangeRequestCommentFilePath(repositoryAlias,\n                                                               changeRequestId,\n                                                               changeRequestCommentId));\n    }\n\n    @Override\n    public List<Long> getChangeRequestCommentIds(final String repositoryAlias,\n                                                 final Long changeRequestId) {\n        List<Long> changeRequestCommentIds = new ArrayList<>();\n\n        final String changeRequestCommentsPathStr = buildChangeRequestCommentFolderPath(repositoryAlias,\n                                                                                        changeRequestId);\n\n        if (objectStorage.exists(changeRequestCommentsPathStr)) {\n            final Path changeRequestCommentsFolder = objectStorage.getPath(changeRequestCommentsPathStr);\n\n            try (DirectoryStream<Path> directoryStream =\n                         ioService.newDirectoryStream(changeRequestCommentsFolder,\n                                                      Files::isRegularFile)) {\n                directoryStream.forEach(commentFile -> {\n                    try {\n                        Long id = Long.valueOf(FilenameUtils.getBaseName(commentFile.getFileName().toString()));\n                        changeRequestCommentIds.add(id);\n                    } catch (NumberFormatException e) {\n                        logger.error(\"Cannot convert folder name to long: \", e);\n                    } catch (Exception e) {\n                        logger.error(\"An unexpected exception was thrown: \", e);\n                    }\n                });\n            }\n        }\n\n        return changeRequestCommentIds;\n    }\n\n    BranchPermissions getDefaultBranchPermissions(String branchName) {\n        final Map<String, RolePermissions> defaultPermissions = new LinkedHashMap<>();\n        defaultPermissions.put(ContributorType.OWNER.name(),\n                               new RolePermissions(ContributorType.OWNER.name(),\n                                                   true,\n                                                   true,\n                                                   true,\n                                                   true));\n        defaultPermissions.put(ContributorType.ADMIN.name(),\n                               new RolePermissions(ContributorType.ADMIN.name(),\n                                                   true,\n                                                   true,\n                                                   false,\n                                                   true));\n        defaultPermissions.put(ContributorType.CONTRIBUTOR.name(),\n                               new RolePermissions(ContributorType.CONTRIBUTOR.name(),\n                                                   true,\n                                                   true,\n                                                   false,\n                                                   false));\n\n        return new BranchPermissions(branchName,\n                                     defaultPermissions);\n    }\n\n    public SpaceInfo loadSpaceInfo() {\n        try {\n            return objectStorage.read(buildSpaceConfigFilePath(SPACE_INFO));\n        } catch (RuntimeException e) {\n            logger.error(e.getMessage());\n            if (e.getCause() instanceof MarshallingException) {\n                return fixContributorClassInSpaceInfo();\n            }\n            throw new RuntimeException(e.getMessage());\n        }\n    }\n\n    private SpaceInfo fixContributorClassInSpaceInfo() {\n        final String OLD_CONTRIBUTOR_CLASS = \"org.guvnor.structure.contributors.Contributor\";\n        final String NEW_CONTRIBUTOR_CLASS = \"org.uberfire.security.Contributor\";\n        final String path = buildSpaceConfigFilePath(SPACE_INFO);\n        try {\n            if (objectStorage.exists(path)) {\n                String content = new String(Files.readAllBytes(objectStorage.getPath(path)));\n                if (content.contains(OLD_CONTRIBUTOR_CLASS)) {\n                    objectStorage.write(path,\n                                        Marshalling.fromJSON(content.replaceAll(OLD_CONTRIBUTOR_CLASS,\n                                                                                NEW_CONTRIBUTOR_CLASS),\n                                                             SpaceInfo.class));\n                }\n            }\n        } catch (Exception e) {\n            logger.error(e.getMessage());\n            throw new RuntimeException(e.getMessage());\n        }\n        return objectStorage.read(path);\n    }\n\n    @Override\n    public void saveSpaceInfo(final SpaceInfo spaceInfo) {\n        objectStorage.write(buildSpaceConfigFilePath(SPACE_INFO),\n                            spaceInfo,\n                            false);\n    }\n\n    @Override\n    public void startBatch() {\n        ioService.startBatch(ioService.get(this.getRootURI(spaceName)).getFileSystem());\n    }\n\n    @Override\n    public void endBatch() {\n        ioService.endBatch();\n    }\n\n    @Override\n    public void close() {\n        this.objectStorage.close();\n    }\n\n    @Override\n    public boolean isInitialized() {\n        return this.loadSpaceInfo() != null;\n    }\n\n    String buildSpaceConfigFilePath(final String configName) {\n        return \"/config/\" + configName + FILE_FORMAT;\n    }\n\n    String buildProjectConfigFilePath(final String projectIdentifier,\n                                      final String configName) {\n        return \"/config/\" + encode(projectIdentifier) + \"/\" + configName + FILE_FORMAT;\n    }\n\n    String buildBranchConfigFilePath(final String branchName,\n                                     final String projectIdentifier,\n                                     final String configName) {\n        return \"/config/\" + encode(projectIdentifier) + \"/\" + encode(branchName) + \"/\" + configName + FILE_FORMAT;\n    }\n\n    private String buildRepositoryFolderPath(final String repositoryAlias) {\n        return String.format(\"/%s\", encode(repositoryAlias));\n    }\n\n    private String buildChangeRequestsFolderPath(final String repositoryAlias) {\n        return String.format(\"%s/%s\",\n                             buildRepositoryFolderPath(repositoryAlias),\n                             CHANGE_REQUESTS_FOLDER);\n    }\n\n    private String buildChangeRequestFilePath(final String repositoryAlias,\n                                              final Long changeRequestId) {\n        return String.format(\"%s/%s/%s\",\n                             buildChangeRequestsFolderPath(repositoryAlias),\n                             changeRequestId,\n                             CHANGE_REQUESTS_FILE);\n    }\n\n    private String buildChangeRequestCommentFolderPath(final String repositoryAlias,\n                                                       final Long changeRequestId) {\n        return String.format(\"%s/%s/%s\",\n                             buildChangeRequestsFolderPath(repositoryAlias),\n                             changeRequestId,\n                             CHANGE_REQUEST_COMMENTS_FOLDER);\n    }\n\n    private String buildChangeRequestCommentFilePath(final String repositoryAlias,\n                                                     final Long changeRequestId,\n                                                     final Long changeRequestCommentId) {\n        return String.format(\"%s/%s.%s\",\n                             buildChangeRequestCommentFolderPath(repositoryAlias,\n                                                                 changeRequestId),\n                             changeRequestCommentId,\n                             CHANGE_REQUEST_COMMENT_FILE_EXT);\n    }\n\n    private String encode(final String text) {\n        return URIUtil.encodeQueryString(text);\n    }\n\n    public Path getPath() {\n        final URI configPathURI = getConfigPathUri();\n        return ioService.get(configPathURI);\n    }\n\n    private URI getConfigPathUri() {\n        return URI.create(SpacesAPI.resolveConfigFileSystemPath(SpacesAPI.Scheme.DEFAULT,\n                                                                this.spaceName));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigStorageRegistryImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.function.Function;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageBatch;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@ApplicationScoped\npublic class SpaceConfigStorageRegistryImpl implements SpaceConfigStorageRegistry {\n\n    private Instance<SpaceConfigStorage> spaceConfigStorages;\n\n    private Map<String, SpaceConfigStorage> storageBySpaceName = new ConcurrentHashMap<>();\n\n    public SpaceConfigStorageRegistryImpl() {\n    }\n\n    @Inject\n    public SpaceConfigStorageRegistryImpl(final Instance<SpaceConfigStorage> spaceConfigStorages) {\n        this.spaceConfigStorages = spaceConfigStorages;\n    }\n\n    @Override\n    public SpaceConfigStorage get(final String spaceName) {\n\n        return storageBySpaceName.computeIfAbsent(spaceName,\n                                                  name -> {\n                                                      final SpaceConfigStorage spaceConfigStorage = spaceConfigStorages.get();\n                                                      spaceConfigStorage.setup(spaceName);\n                                                      return spaceConfigStorage;\n                                                  });\n    }\n\n    @Override\n    public SpaceConfigStorageBatch getBatch(String spaceName) {\n\n        Optional<SpaceConfigStorage> optional = Optional.ofNullable(get(spaceName));\n\n        if (optional.isPresent()) {\n            return new SpaceStorageBatchImpl(optional.get());\n        }\n\n        throw new IllegalArgumentException(\"Cannot find Space '\" + spaceName + \"'\");\n    }\n\n    @Override\n    public void remove(String spaceName) {\n        if (this.exist(spaceName)) {\n            this.storageBySpaceName.get(spaceName).close();\n            this.storageBySpaceName.remove(spaceName);\n        }\n    }\n\n    @Override\n    public boolean exist(String spaceName) {\n        return this.storageBySpaceName.containsKey(spaceName);\n    }\n\n    public static class SpaceStorageBatchImpl implements SpaceConfigStorageBatch {\n\n        private SpaceConfigStorage spaceConfigStorage;\n\n        public SpaceStorageBatchImpl(SpaceConfigStorage spaceConfigStorage) {\n            this.spaceConfigStorage = spaceConfigStorage;\n        }\n\n        @Override\n        public <T> T run(final Function<SpaceConfigStorageBatchContext, T> function) {\n            checkNotNull(\"function\", function);\n\n            final SpaceConfigStorageBatchContext context = ActiveSpaceConfigStorageBatchContextRegistry.getCurrentBatch(spaceConfigStorage, this);\n\n            try {\n                if (isMine(context)) {\n                    spaceConfigStorage.startBatch();\n                }\n\n                return function.apply(context);\n            } finally {\n                if (isMine(context)) {\n                    spaceConfigStorage.endBatch();\n                    ActiveSpaceConfigStorageBatchContextRegistry.clearCurrentBatch();\n                }\n            }\n        }\n\n        private boolean isMine(SpaceConfigStorageBatchContext context) {\n            return context.getOwner().equals(this);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/DependencyTypesMapper.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\n\n/***\n * Mapper of the dependencies associated to each DependencyType\n */\npublic class DependencyTypesMapper {\n\n    private final static String JSON_POM_DEPS = \"DependencyTypesMapper.json\";\n    private Map<DependencyType, List<DynamicPomDependency>> mapping;\n\n    public DependencyTypesMapper() {\n        PomJsonReaderDefault jsonDepsReader = new PomJsonReaderDefault(getClass().getClassLoader().getResourceAsStream(JSON_POM_DEPS));\n        mapping = jsonDepsReader.readDeps();\n    }\n\n    public Map<DependencyType, List<DynamicPomDependency>> getMapping() {\n        return mapping;\n    }\n\n    public List<DynamicPomDependency> getDependencies(DependencyType key) {\n        return mapping.get(key);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/PomEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.util.List;\n\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Behaviours of the PomEditor to add a single or a list of dependencies on a specified pom\n */\npublic interface PomEditor {\n\n    boolean addDependency(DynamicPomDependency dep,\n                          Path pomPath);\n\n    boolean addDependencies(List<DynamicPomDependency> deps,\n                            Path pomPath);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/PomEditorDefault.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.ByteArrayOutputStream;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.maven.model.Dependency;\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Reader;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Writer;\nimport org.codehaus.plexus.util.xml.pull.XmlPullParserException;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.java.nio.file.StandardOpenOption;\n\npublic class PomEditorDefault implements PomEditor {\n\n    private static final String DELIMITER = \":\";\n    private final Logger logger = LoggerFactory.getLogger(PomEditorDefault.class);\n\n    private MavenXpp3Reader reader;\n    private MavenXpp3Writer writer;\n\n    public PomEditorDefault() {\n        reader = new MavenXpp3Reader();\n        writer = new MavenXpp3Writer();\n    }\n\n    public boolean addDependency(DynamicPomDependency dep,\n                                 Path pomPath) {\n        if (dep == null || !isGroupIDValid(dep) || !isArtifactIDValid(dep)) {\n            return false;\n        }\n\n        try {\n            Dependency pomDep = getMavenDependency(dep);\n            org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI());\n            Model model = getPOMModel(filePath);\n            Map<String, String> keys = getKeysFromDeps(model.getDependencies());\n            String keyDep = getKeyFromDep(dep);\n            if (!keys.containsKey(keyDep)) {\n                model.getDependencies().add(pomDep);\n            } else {\n                //override dep version with the version contained in the json\n                String versionKey = keys.get(keyDep);\n                List<Dependency> modelDeps = model.getDependencies();\n                for (Dependency modelDep : modelDeps) {\n                    if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID())) {\n                        modelDep.setVersion(versionKey);\n                    }\n                }\n                return false;\n            }\n            writePOMModelOnFS(filePath,\n                              model);\n        } catch (Exception ex) {\n            logger.error(ex.getMessage(),\n                         ex);\n            return false;\n        }\n        return true;\n    }\n\n    public boolean addDependencies(List<DynamicPomDependency> deps,\n                                   Path pomPath) {\n        if (deps.isEmpty()) {\n            return false;\n        }\n        boolean result = false;\n        try {\n            org.uberfire.java.nio.file.Path filePath = Paths.get(pomPath.toURI());\n            Model model = getPOMModel(filePath);\n            Map<String, String> keys = getKeysFromDeps(model.getDependencies());\n\n            for (DynamicPomDependency dep : deps) {\n                String keyDep = getKeyFromDep(dep);\n                if (!keys.containsKey(keyDep)) {\n                    Dependency pomDep = getMavenDependency(dep);\n                    model.getDependencies().add(pomDep);\n                    result = true;\n                } else {\n                    //override dep version with the version contained in the json\n                    List<Dependency> modelDeps = model.getDependencies();\n                    for (Dependency modelDep : modelDeps) {\n                        if (modelDep.getGroupId().equals(dep.getGroupID()) && modelDep.getArtifactId().equals(dep.getArtifactID()) && !modelDep.getVersion().equals(dep.getVersion())) {\n                            modelDep.setVersion(dep.getVersion());\n                            result = true;\n                        }\n                    }\n                }\n            }\n            if (result) {\n                writePOMModelOnFS(filePath,\n                                  model);\n            }\n        } catch (Exception ex) {\n            logger.error(ex.getMessage(),\n                         ex);\n            result = false;\n        }\n        return result;\n    }\n\n    private String getKeyFromDep(DynamicPomDependency dep) {\n        StringBuilder sb = new StringBuilder();\n        sb.append(dep.getGroupID()).append(DELIMITER).append(dep.getArtifactID());\n        return sb.toString();\n    }\n\n    private Map<String, String> getKeysFromDeps(List<Dependency> deps) {\n        Map<String, String> depsMap = new HashMap(deps.size());\n        for (Dependency dep : deps) {\n            StringBuilder sb = new StringBuilder();\n            sb.append(dep.getGroupId()).append(DELIMITER).append(dep.getArtifactId());\n            depsMap.put(sb.toString(),\n                        dep.getVersion());\n        }\n        return depsMap;\n    }\n\n    private void writePOMModelOnFS(org.uberfire.java.nio.file.Path filePath,\n                                   Model model) throws IOException {\n        ByteArrayOutputStream baos = new ByteArrayOutputStream();\n        writer.write(baos,\n                     model);\n        Files.write(filePath,\n                    baos.toByteArray(),\n                    StandardOpenOption.WRITE,\n                    StandardOpenOption.TRUNCATE_EXISTING);\n    }\n\n    private Model getPOMModel(org.uberfire.java.nio.file.Path filePath) throws IOException, XmlPullParserException {\n        return reader.read(new ByteArrayInputStream(Files.readAllBytes(filePath)));\n    }\n\n    private Dependency getMavenDependency(DynamicPomDependency dep) {\n        Dependency pomDep = new Dependency();\n        pomDep.setGroupId(dep.getGroupID());\n        pomDep.setArtifactId(dep.getArtifactID());\n        if (!dep.getVersion().isEmpty()) {\n            pomDep.setVersion(dep.getVersion());\n        }\n        return pomDep;\n    }\n\n    private boolean isGroupIDValid(DynamicPomDependency dep) {\n        return dep.getGroupID() != null && !dep.getGroupID().isEmpty();\n    }\n\n    private boolean isArtifactIDValid(DynamicPomDependency dep) {\n        return dep.getArtifactID() != null && !dep.getArtifactID().isEmpty();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/PomJsonReader.java",
    "content": "package org.guvnor.structure.backend.pom;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\n\n/**\n * Behaviour to read deps from a jsonfile\n */\npublic interface PomJsonReader {\n\n    Map<DependencyType, List<DynamicPomDependency>> readDeps();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/PomJsonReaderDefault.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.io.FileInputStream;\nimport java.io.InputStream;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.json.Json;\nimport javax.json.JsonArray;\nimport javax.json.JsonObject;\nimport javax.json.JsonReader;\n\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Paths;\n\npublic class PomJsonReaderDefault implements PomJsonReader {\n\n    private final Logger logger = LoggerFactory.getLogger(PomJsonReaderDefault.class);\n    private JsonObject pomObject;\n\n    public PomJsonReaderDefault(InputStream in) {\n        try (JsonReader reader = Json.createReader(in)) {\n            pomObject = reader.readObject();\n        } catch (Exception e) {\n            logger.error(e.getMessage(),\n                         e);\n            throw new RuntimeException(e.getMessage());\n        }\n    }\n\n    public PomJsonReaderDefault(String path,\n                                String jsonName) {\n        String jsonPath = path + jsonName;\n        if (!Files.exists(Paths.get(jsonPath))) {\n            throw new RuntimeException(\"no \" + jsonName + \" in the provided path :\" + path);\n        }\n\n        try (FileInputStream fis = new FileInputStream(jsonPath);\n             JsonReader reader = Json.createReader(fis)) {\n            pomObject = reader.readObject();\n        } catch (Exception e) {\n            logger.error(e.getMessage());\n            throw new RuntimeException(e.getMessage());\n        }\n    }\n\n    public Map<DependencyType, List<DynamicPomDependency>> readDeps() {\n        JsonArray dependencies = pomObject.getJsonArray(\"dependencies\");\n        Map<DependencyType, List<DynamicPomDependency>> mapping = new HashMap<>(dependencies.size());\n        for (int i = 0; i < dependencies.size(); i++) {\n            JsonObject depType = dependencies.getJsonObject(i);\n            String type = depType.getString(\"type\");\n            JsonArray deps = depType.getJsonArray(\"deps\");\n            ArrayList<DynamicPomDependency> dynamic = new ArrayList<>(deps.size());\n            for (int k = 0; k < deps.size(); k++) {\n                JsonObject dep = deps.getJsonObject(i);\n                DynamicPomDependency dynamicDep = new DynamicPomDependency(\n                        dep.getString(\"groupId\"),\n                        dep.getString(\"artifactId\"),\n                        dep.getString(\"version\"),\n                        dep.getString(\"scope\")\n                );\n                dynamic.add(dynamicDep);\n            }\n\n            mapping.put(DependencyType.valueOf(type),\n                        dynamic);\n        }\n        return mapping;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/pom/PomStructureEditor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\n\nimport org.guvnor.structure.pom.AddPomDependencyEvent;\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n * Editor to receive PomDependency Event\n */\n@ApplicationScoped\npublic class PomStructureEditor {\n\n    private final Logger logger = LoggerFactory.getLogger(PomStructureEditor.class);\n    private PomEditor pomEditor;\n    private DependencyTypesMapper mapper;\n\n    public PomStructureEditor() {\n        pomEditor = new PomEditorDefault();\n        mapper = new DependencyTypesMapper();\n    }\n\n    public void onNewDynamicDependency(final @Observes AddPomDependencyEvent event) {\n        final Path projectPath = event.getProjectPath();\n        final DependencyType dependencyType = event.getDependencyType();\n        addDependenciesToPom(projectPath,\n                             mapper.getDependencies(dependencyType));\n    }\n\n    private void addDependenciesToPom(Path projectPath,\n                                      List<DynamicPomDependency> deps) {\n        if (!pomEditor.addDependencies(deps,\n                                       projectPath)) {\n            logger.warn(\"Failed to add dependencies {} to pom.xml located in {}\",\n                        deps,\n                        projectPath);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/BranchAccessAuthorizer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.Optional;\nimport javax.inject.Inject;\n\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.RolePermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Repository;\n\npublic class BranchAccessAuthorizer {\n\n    public enum AccessType {\n        READ, WRITE, DELETE;\n\n        public static AccessType valueOf(final ReceiveCommand.Type commandType) {\n            if (commandType == null) {\n                return null;\n            } else if (commandType.equals(ReceiveCommand.Type.DELETE)) {\n                return DELETE;\n            } else {\n                return WRITE;\n            }\n        }\n    }\n\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    private ConfiguredRepositories configuredRepositories;\n\n    private OrganizationalUnitService organizationalUnitService;\n\n    public BranchAccessAuthorizer() {\n    }\n\n    @Inject\n    public BranchAccessAuthorizer(final SpaceConfigStorageRegistry spaceConfigStorageRegistry,\n                                  final ConfiguredRepositories configuredRepositories,\n                                  final OrganizationalUnitService organizationalUnitService) {\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n        this.configuredRepositories = configuredRepositories;\n        this.organizationalUnitService = organizationalUnitService;\n    }\n\n    public boolean authorize(final String user,\n                             final String spaceName,\n                             final String repositoryIdentifier,\n                             final String repositoryAlias,\n                             final String branchName,\n                             final AccessType accessType) {\n        final BranchPermissions branchPermissions = spaceConfigStorageRegistry.get(spaceName).loadBranchPermissions(branchName,\n                                                                                                                    repositoryIdentifier);\n        final OrganizationalUnit organizationalUnit = organizationalUnitService.getOrganizationalUnit(spaceName);\n        final Repository repository = configuredRepositories.getRepositoryByRepositoryAlias(organizationalUnit.getSpace(),\n                                                                                            repositoryAlias);\n        final Optional<Contributor> userContributor = repository.getContributors().stream().filter(c -> c.getUsername().equals(user)).findFirst();\n\n        if (userContributor.isPresent()) {\n            final String userRole = userContributor.get().getType().name();\n            final RolePermissions rolePermissions = branchPermissions.getPermissionsByRole().get(userRole);\n\n            if (AccessType.READ.equals(accessType)) {\n                return rolePermissions.canRead();\n            } else if (AccessType.WRITE.equals(accessType)) {\n                return rolePermissions.canWrite();\n            } else if (AccessType.DELETE.equals(accessType)) {\n                return rolePermissions.canDelete();\n            }\n        }\n\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/ChangeRequestServiceImpl.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.NoSuchElementException;\nimport java.util.Optional;\nimport java.util.function.Function;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport java.util.stream.IntStream;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestPredicates;\nimport org.guvnor.structure.repositories.changerequest.ChangeRequestService;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestAlreadyOpenException;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestComment;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestCommit;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestCountSummary;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestDiff;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestListUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatus;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatusUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeType;\nimport org.guvnor.structure.repositories.changerequest.portable.NothingToMergeException;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestCommentList;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestList;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.GitHookSupport;\nimport org.uberfire.java.nio.fs.jgit.util.exceptions.GitException;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.MessageCommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.ws.JGitWatchEvent;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static java.lang.Integer.min;\nimport static java.util.stream.Collectors.toMap;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Service\n@ApplicationScoped\npublic class ChangeRequestServiceImpl implements ChangeRequestService {\n\n    private static final String SPACE_NAME_PARAM = \"spaceName\";\n    private static final String REPOSITORY_ALIAS_PARAM = \"repositoryAlias\";\n    private static final String STATUS_LIST_PARAM = \"statusList\";\n    private static final String CHANGE_REQUEST_ID_PARAM = \"changeRequestId\";\n    private static final String COMMIT_MESSAGE_PARAM = \"commitMessage\";\n    private static final String PAGE_PARAM = \"page\";\n    private static final String PAGE_SIZE_PARAM = \"pageSize\";\n    private static final String SOURCE_BRANCH_PARAM = \"sourceBranch\";\n    private static final String TARGET_BRANCH_PARAM = \"targetBranch\";\n    private static final String SUMMARY_PARAM = \"summary\";\n    private static final String DESCRIPTION_PARAM = \"description\";\n    private static final String ASSOCIATED_BRANCH_NAME_PARAM = \"associatedBranchName\";\n    private static final String TEXT_PARAM = \"text\";\n    private static final String COMMENT_ID_PARAM = \"commentId\";\n    private static final String UPDATED_SUMMARY_PARAM = \"updatedSummary\";\n    private static final String UPDATED_DESCRIPTION_PARAM = \"updatedDescription\";\n\n    private final SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n    private final RepositoryService repositoryService;\n    private final SpacesAPI spaces;\n    private final Event<ChangeRequestListUpdatedEvent> changeRequestListUpdatedEvent;\n    private final Event<ChangeRequestUpdatedEvent> changeRequestUpdatedEvent;\n    private final Event<ChangeRequestStatusUpdatedEvent> changeRequestStatusUpdatedEventEvent;\n    private final BranchAccessAuthorizer branchAccessAuthorizer;\n    private final SessionInfo sessionInfo;\n\n    private Logger logger = LoggerFactory.getLogger(ChangeRequestServiceImpl.class);\n\n    @Inject\n    public ChangeRequestServiceImpl(final SpaceConfigStorageRegistry spaceConfigStorageRegistry,\n                                    final RepositoryService repositoryService,\n                                    final SpacesAPI spaces,\n                                    final Event<ChangeRequestListUpdatedEvent> changeRequestListUpdatedEvent,\n                                    final Event<ChangeRequestUpdatedEvent> changeRequestUpdatedEvent,\n                                    final Event<ChangeRequestStatusUpdatedEvent> changeRequestStatusUpdatedEventEvent,\n                                    final BranchAccessAuthorizer branchAccessAuthorizer,\n                                    final SessionInfo sessionInfo) {\n        this.spaceConfigStorageRegistry = spaceConfigStorageRegistry;\n        this.repositoryService = repositoryService;\n        this.spaces = spaces;\n        this.changeRequestListUpdatedEvent = changeRequestListUpdatedEvent;\n        this.changeRequestUpdatedEvent = changeRequestUpdatedEvent;\n        this.changeRequestStatusUpdatedEventEvent = changeRequestStatusUpdatedEventEvent;\n        this.branchAccessAuthorizer = branchAccessAuthorizer;\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public ChangeRequest createChangeRequest(final String spaceName,\n                                             final String repositoryAlias,\n                                             final String sourceBranch,\n                                             final String targetBranch,\n                                             final String summary,\n                                             final String description) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotEmpty(SOURCE_BRANCH_PARAM, sourceBranch);\n        checkNotEmpty(TARGET_BRANCH_PARAM, targetBranch);\n        checkNotEmpty(SUMMARY_PARAM, summary);\n        checkNotEmpty(DESCRIPTION_PARAM, description);\n\n        checkChangeRequestAlreadyOpen(spaceName,\n                                      repositoryAlias,\n                                      sourceBranch,\n                                      targetBranch);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        long changeRequestId = this.generateChangeRequestId(spaceName,\n                                                            repositoryAlias);\n\n        final String startCommitId = getCommonCommitId(repository,\n                                                       sourceBranch,\n                                                       targetBranch);\n\n        final ChangeRequest newChangeRequest = new ChangeRequest(changeRequestId,\n                                                                 spaceName,\n                                                                 repositoryAlias,\n                                                                 sourceBranch,\n                                                                 targetBranch,\n                                                                 sessionInfo.getIdentity().getIdentifier(),\n                                                                 summary,\n                                                                 description,\n                                                                 startCommitId);\n\n        spaceConfigStorageRegistry.get(spaceName).saveChangeRequest(repositoryAlias,\n                                                                    newChangeRequest);\n\n        changeRequestListUpdatedEvent.fire(new ChangeRequestListUpdatedEvent(repository.getIdentifier()));\n\n        return newChangeRequest;\n    }\n\n    @Override\n    public List<ChangeRequest> getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     true,\n                                                     ChangeRequestPredicates.matchAll());\n\n        return computeFullContent(spaceName,\n                                  repositoryAlias,\n                                  changeRequests);\n    }\n\n    @Override\n    public List<ChangeRequest> getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias,\n                                                 final String filter) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     true,\n                                                     ChangeRequestPredicates\n                                                             .matchSearchFilter(filter,\n                                                                                ChangeRequestServiceImpl\n                                                                                ::composeSearchableElement));\n\n        return computeFullContent(spaceName,\n                                  repositoryAlias,\n                                  changeRequests);\n    }\n\n    @Override\n    public List<ChangeRequest> getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias,\n                                                 final List<ChangeRequestStatus> statusList) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotEmpty(STATUS_LIST_PARAM, statusList);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     true,\n                                                     ChangeRequestPredicates.matchInStatusList(statusList));\n\n        return computeFullContent(spaceName,\n                                  repositoryAlias,\n                                  changeRequests);\n    }\n\n    @Override\n    public List<ChangeRequest> getChangeRequests(final String spaceName,\n                                                 final String repositoryAlias,\n                                                 final List<ChangeRequestStatus> statusList,\n                                                 final String filter) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotEmpty(STATUS_LIST_PARAM, statusList);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(\n                        spaceName,\n                        repositoryAlias,\n                        true,\n                        ChangeRequestPredicates.matchSearchFilterAndStatusList(filter,\n                                                                               ChangeRequestServiceImpl::\n                                                                                       composeSearchableElement,\n                                                                               statusList));\n\n        return computeFullContent(spaceName,\n                                  repositoryAlias,\n                                  changeRequests);\n    }\n\n    @Override\n    public PaginatedChangeRequestList getChangeRequests(final String spaceName,\n                                                        final String repositoryAlias,\n                                                        final Integer page,\n                                                        final Integer pageSize,\n                                                        final String filter) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(PAGE_PARAM, page);\n        checkNotNull(PAGE_SIZE_PARAM, pageSize);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     true,\n                                                     ChangeRequestPredicates\n                                                             .matchSearchFilter(filter,\n                                                                                ChangeRequestServiceImpl::\n                                                                                        composeSearchableElement));\n\n        final List<ChangeRequest> paginatedChangeRequests = paginateChangeRequests(changeRequests,\n                                                                                   page,\n                                                                                   pageSize);\n\n        return new PaginatedChangeRequestList(computeFullContent(spaceName,\n                                                                 repositoryAlias,\n                                                                 paginatedChangeRequests),\n                                              page,\n                                              pageSize,\n                                              changeRequests.size());\n    }\n\n    @Override\n    public PaginatedChangeRequestList getChangeRequests(final String spaceName,\n                                                        final String repositoryAlias,\n                                                        final Integer page,\n                                                        final Integer pageSize,\n                                                        final List<ChangeRequestStatus> statusList,\n                                                        final String filter) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(PAGE_PARAM, page);\n        checkNotNull(PAGE_SIZE_PARAM, pageSize);\n        checkNotEmpty(STATUS_LIST_PARAM, statusList);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     true,\n                                                     ChangeRequestPredicates\n                                                             .matchSearchFilterAndStatusList(filter,\n                                                                                             ChangeRequestServiceImpl::\n                                                                                                     composeSearchableElement,\n                                                                                             statusList));\n\n        final List<ChangeRequest> paginatedChangeRequests = paginateChangeRequests(changeRequests,\n                                                                                   page,\n                                                                                   pageSize);\n\n        return new PaginatedChangeRequestList(computeFullContent(spaceName,\n                                                                 repositoryAlias,\n                                                                 paginatedChangeRequests),\n                                              page,\n                                              pageSize,\n                                              changeRequests.size());\n    }\n\n    @Override\n    public ChangeRequest getChangeRequest(final String spaceName,\n                                          final String repositoryAlias,\n                                          final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        return getChangeRequestById(spaceName,\n                                    repositoryAlias,\n                                    true,\n                                    changeRequestId);\n    }\n\n    @Override\n    public ChangeRequestCountSummary countChangeRequests(final String spaceName,\n                                                         final String repositoryAlias) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     false,\n                                                     ChangeRequestPredicates.matchAll());\n\n        final Integer total = changeRequests.size();\n        final long open = changeRequests.stream()\n                .filter(elem -> elem.getStatus() == ChangeRequestStatus.OPEN)\n                .count();\n\n        return new ChangeRequestCountSummary(total,\n                                             (int) open);\n    }\n\n    @Override\n    public List<ChangeRequestDiff> getDiff(final String spaceName,\n                                           final String repositoryAlias,\n                                           final String sourceBranch,\n                                           final String targetBranch) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(SOURCE_BRANCH_PARAM, sourceBranch);\n        checkNotNull(TARGET_BRANCH_PARAM, targetBranch);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        return getDiff(repository,\n                       sourceBranch,\n                       targetBranch,\n                       null,\n                       null);\n    }\n\n    @Override\n    public List<ChangeRequestDiff> getDiff(final String spaceName,\n                                           final String repositoryAlias,\n                                           final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        return getDiff(repository,\n                       changeRequest.getSourceBranch(),\n                       changeRequest.getTargetBranch(),\n                       changeRequest.getStartCommitId(),\n                       changeRequest.getEndCommitId());\n    }\n\n    @Override\n    public void deleteChangeRequests(final String spaceName,\n                                     final String repositoryAlias,\n                                     final String associatedBranchName) {\n        deleteChangeRequests(spaceName,\n                             repositoryAlias,\n                             associatedBranchName,\n                             sessionInfo.getIdentity().getIdentifier());\n    }\n\n    @Override\n    public void deleteChangeRequests(final String spaceName,\n                                     final String repositoryAlias,\n                                     final String associatedBranchName,\n                                     final String userIdentifier) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotEmpty(ASSOCIATED_BRANCH_NAME_PARAM, associatedBranchName);\n\n        final List<ChangeRequest> changeRequestsToDelete =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     false,\n                                                     ChangeRequestPredicates\n                                                             .matchSourceOrTargetBranch(associatedBranchName),\n                                                     userIdentifier);\n\n        if (!changeRequestsToDelete.isEmpty()) {\n            changeRequestsToDelete.forEach(elem -> spaceConfigStorageRegistry.get(spaceName)\n                    .deleteChangeRequest(repositoryAlias,\n                                         elem.getId()));\n\n            final Repository repository = resolveRepository(spaceName,\n                                                            repositoryAlias);\n\n            changeRequestListUpdatedEvent.fire(new ChangeRequestListUpdatedEvent(repository.getIdentifier()));\n        }\n    }\n\n    @Override\n    public void rejectChangeRequest(final String spaceName,\n                                    final String repositoryAlias,\n                                    final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.OPEN) {\n            throw new IllegalStateException(\"Cannot reject a change request that is not open\");\n        }\n\n        this.updateNotMergedChangeRequestStatus(spaceName,\n                                                repositoryAlias,\n                                                changeRequest,\n                                                ChangeRequestStatus.REJECTED);\n    }\n\n    @Override\n    public Boolean mergeChangeRequest(final String spaceName,\n                                      final String repositoryAlias,\n                                      final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.OPEN) {\n            throw new IllegalStateException(\"Cannot accept a change request that is not open\");\n        }\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final CommitInfo commitInfo = buildCommitInfo(String.format(MessageCommitInfo.MERGE_MESSAGE,\n                                                                    changeRequest.getSourceBranch()));\n\n        return tryMergeChangeRequest(repository,\n                                     changeRequest,\n                                     commitInfo,\n                                     false);\n    }\n\n    @Override\n    public Boolean revertChangeRequest(final String spaceName,\n                                       final String repositoryAlias,\n                                       final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.ACCEPTED) {\n            throw new IllegalStateException(\"Cannot revert a change request that is not accepted\");\n        }\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        return tryRevertChangeRequest(repository,\n                                      changeRequest);\n    }\n\n    @Override\n    public void closeChangeRequest(final String spaceName,\n                                   final String repositoryAlias,\n                                   final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.OPEN) {\n            throw new IllegalStateException(\"Cannot close a change request that is not open\");\n        }\n\n        this.updateNotMergedChangeRequestStatus(spaceName,\n                                                repositoryAlias,\n                                                changeRequest,\n                                                ChangeRequestStatus.CLOSED);\n    }\n\n    @Override\n    public void reopenChangeRequest(final String spaceName,\n                                    final String repositoryAlias,\n                                    final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.CLOSED &&\n                changeRequest.getStatus() != ChangeRequestStatus.REJECTED) {\n            throw new IllegalStateException(\"Cannot reopen a change request that is not closed/rejected\");\n        }\n\n        checkChangeRequestAlreadyOpen(spaceName,\n                                      repositoryAlias,\n                                      changeRequest.getSourceBranch(),\n                                      changeRequest.getTargetBranch());\n\n        this.updateNotMergedChangeRequestStatus(spaceName,\n                                                repositoryAlias,\n                                                changeRequest,\n                                                ChangeRequestStatus.OPEN);\n    }\n\n    @Override\n    public void updateChangeRequestSummary(final String spaceName,\n                                           final String repositoryAlias,\n                                           final Long changeRequestId,\n                                           final String updatedSummary) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n        checkNotEmpty(UPDATED_SUMMARY_PARAM, updatedSummary);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final ChangeRequest oldChangeRequest = getChangeRequestById(spaceName,\n                                                                    repositoryAlias,\n                                                                    false,\n                                                                    changeRequestId);\n\n        final ChangeRequest updatedChangeRequest = new ChangeRequest(oldChangeRequest.getId(),\n                                                                     oldChangeRequest.getSpaceName(),\n                                                                     oldChangeRequest.getRepositoryAlias(),\n                                                                     oldChangeRequest.getSourceBranch(),\n                                                                     oldChangeRequest.getTargetBranch(),\n                                                                     oldChangeRequest.getStatus(),\n                                                                     oldChangeRequest.getAuthorId(),\n                                                                     updatedSummary,\n                                                                     oldChangeRequest.getDescription(),\n                                                                     oldChangeRequest.getCreatedDate(),\n                                                                     oldChangeRequest.getStartCommitId(),\n                                                                     oldChangeRequest.getEndCommitId(),\n                                                                     oldChangeRequest.getMergeCommitId());\n\n        spaceConfigStorageRegistry.get(spaceName).saveChangeRequest(repositoryAlias,\n                                                                    updatedChangeRequest);\n\n        changeRequestUpdatedEvent.fire(new ChangeRequestUpdatedEvent(repository.getIdentifier(),\n                                                                     updatedChangeRequest.getId(),\n                                                                     sessionInfo.getIdentity().getIdentifier()));\n    }\n\n    @Override\n    public void updateChangeRequestDescription(final String spaceName,\n                                               final String repositoryAlias,\n                                               final Long changeRequestId,\n                                               final String updatedDescription) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n        checkNotEmpty(UPDATED_DESCRIPTION_PARAM, updatedDescription);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final ChangeRequest oldChangeRequest = getChangeRequestById(spaceName,\n                                                                    repositoryAlias,\n                                                                    false,\n                                                                    changeRequestId);\n\n        final ChangeRequest updatedChangeRequest = new ChangeRequest(oldChangeRequest.getId(),\n                                                                     oldChangeRequest.getSpaceName(),\n                                                                     oldChangeRequest.getRepositoryAlias(),\n                                                                     oldChangeRequest.getSourceBranch(),\n                                                                     oldChangeRequest.getTargetBranch(),\n                                                                     oldChangeRequest.getStatus(),\n                                                                     oldChangeRequest.getAuthorId(),\n                                                                     oldChangeRequest.getSummary(),\n                                                                     updatedDescription,\n                                                                     oldChangeRequest.getCreatedDate(),\n                                                                     oldChangeRequest.getStartCommitId(),\n                                                                     oldChangeRequest.getEndCommitId(),\n                                                                     oldChangeRequest.getMergeCommitId());\n\n        spaceConfigStorageRegistry.get(spaceName).saveChangeRequest(repositoryAlias,\n                                                                    updatedChangeRequest);\n\n        changeRequestUpdatedEvent.fire(new ChangeRequestUpdatedEvent(repository.getIdentifier(),\n                                                                     updatedChangeRequest.getId(),\n                                                                     sessionInfo.getIdentity().getIdentifier()));\n    }\n\n    @Override\n    public PaginatedChangeRequestCommentList getComments(final String spaceName,\n                                                         final String repositoryAlias,\n                                                         final Long changeRequestId,\n                                                         final Integer page,\n                                                         final Integer pageSize) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final List<ChangeRequestComment> comments =\n                spaceConfigStorageRegistry.get(spaceName).loadChangeRequestComments(repositoryAlias,\n                                                                                    changeRequestId)\n                        .stream()\n                        .sorted(Comparator.comparing(ChangeRequestComment::getCreatedDate).reversed())\n                        .collect(Collectors.toList());\n\n        final List<ChangeRequestComment> paginatedList = paginateComments(comments,\n                                                                          page,\n                                                                          pageSize);\n\n        return new PaginatedChangeRequestCommentList(paginatedList,\n                                                     page,\n                                                     pageSize,\n                                                     comments.size());\n    }\n\n    @Override\n    public void addComment(final String spaceName,\n                           final String repositoryAlias,\n                           final Long changeRequestId,\n                           final String text) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n        checkNotEmpty(TEXT_PARAM, text);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final Long commentId = generateCommentId(spaceName,\n                                                 repositoryAlias,\n                                                 changeRequestId);\n\n        final ChangeRequestComment newComment = new ChangeRequestComment(commentId,\n                                                                         sessionInfo.getIdentity().getIdentifier(),\n                                                                         new Date(),\n                                                                         text);\n\n        spaceConfigStorageRegistry.get(spaceName).saveChangeRequestComment(repositoryAlias,\n                                                                           changeRequestId,\n                                                                           newComment);\n\n        changeRequestUpdatedEvent.fire(new ChangeRequestUpdatedEvent(repository.getIdentifier(),\n                                                                     changeRequestId,\n                                                                     sessionInfo.getIdentity().getIdentifier()));\n    }\n\n    @Override\n    public void deleteComment(final String spaceName,\n                              final String repositoryAlias,\n                              final Long changeRequestId,\n                              final Long commentId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n        checkNotNull(COMMENT_ID_PARAM, commentId);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        spaceConfigStorageRegistry.get(spaceName).deleteChangeRequestComment(repositoryAlias,\n                                                                             changeRequestId,\n                                                                             commentId);\n\n        changeRequestUpdatedEvent.fire(new ChangeRequestUpdatedEvent(repository.getIdentifier(),\n                                                                     changeRequestId,\n                                                                     sessionInfo.getIdentity().getIdentifier()));\n    }\n\n    @Override\n    public List<ChangeRequestCommit> getCommits(final String spaceName,\n                                                final String repositoryAlias,\n                                                final Long changeRequestId) {\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        final Git git = getGitFromBranch(repository,\n                                         changeRequest.getSourceBranch());\n\n        final String startCommitId = changeRequest.getStartCommitId();\n        final String endCommitId = git.getLastCommit(changeRequest.getSourceBranch()).getName();\n\n        return git.listCommits(startCommitId, endCommitId)\n                .stream()\n                .map(c -> new ChangeRequestCommit(c.getName(),\n                                                  c.getFullMessage()))\n                .collect(Collectors.toList());\n    }\n\n    @Override\n    public Boolean squashChangeRequest(final String spaceName,\n                                       final String repositoryAlias,\n                                       final Long changeRequestId,\n                                       final String commitMessage) {\n\n        checkNotEmpty(SPACE_NAME_PARAM, spaceName);\n        checkNotEmpty(REPOSITORY_ALIAS_PARAM, repositoryAlias);\n        checkNotNull(CHANGE_REQUEST_ID_PARAM, changeRequestId);\n        checkNotNull(COMMIT_MESSAGE_PARAM, commitMessage);\n\n        final ChangeRequest changeRequest = getChangeRequestById(spaceName,\n                                                                 repositoryAlias,\n                                                                 false,\n                                                                 changeRequestId);\n\n        if (changeRequest.getStatus() != ChangeRequestStatus.OPEN) {\n            throw new IllegalStateException(\"Cannot squash a change request that is not open\");\n        }\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final CommitInfo commitInfo = buildCommitInfo(commitMessage);\n\n        return tryMergeChangeRequest(repository,\n                                     changeRequest,\n                                     commitInfo,\n                                     true);\n    }\n\n    private ChangeRequest getChangeRequestById(final String spaceName,\n                                               final String repositoryAlias,\n                                               final boolean withFullContent,\n                                               final Long changeRequestId) {\n        final List<ChangeRequest> changeRequests =\n                this.getFilteredChangeRequestsFromStorage(spaceName,\n                                                          repositoryAlias,\n                                                          false,\n                                                          ChangeRequestPredicates.matchId(changeRequestId));\n\n        if (changeRequests.isEmpty()) {\n            throw new NoSuchElementException(\"Unable to find the change request with id #\" + changeRequestId);\n        }\n\n        return withFullContent ? computeFullContent(spaceName,\n                                                    repositoryAlias,\n                                                    changeRequests).get(0) : changeRequests.get(0);\n    }\n\n    private org.uberfire.backend.vfs.Path createPath(final String branchPath,\n                                                     final String filePath) {\n        return PathFactory.newPath(filePath,\n                                   branchPath + filePath);\n    }\n\n    private Repository resolveRepository(final String spaceName,\n                                         final String repositoryAlias) {\n        Repository repository = repositoryService.getRepositoryFromSpace(spaces.getSpace(spaceName), repositoryAlias);\n\n        if (repository == null) {\n            final String msg = String.format(\"The repository %s was not found in the space %s\",\n                                             repositoryAlias,\n                                             spaceName);\n\n            throw new NoSuchElementException(msg);\n        }\n\n        return repository;\n    }\n\n    private List<ChangeRequest> getFilteredChangeRequestsFromStorage(final String spaceName,\n                                                                     final String repositoryAlias,\n                                                                     final boolean sorted,\n                                                                     final Predicate<ChangeRequest> predicate) {\n        return getFilteredChangeRequestsFromStorage(spaceName,\n                                             repositoryAlias,\n                                             sorted,\n                                             predicate,\n                                             sessionInfo.getIdentity().getIdentifier());\n    }\n\n    private List<ChangeRequest> getFilteredChangeRequestsFromStorage(final String spaceName,\n                                                                     final String repositoryAlias,\n                                                                     final boolean sorted,\n                                                                     final Predicate<ChangeRequest> predicate,\n                                                                     final String userIdentifier) {\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final List<String> branchesUserCanRead = repository.getBranches()\n                .stream()\n                .map(Branch::getName)\n                .filter(branchName -> branchAccessAuthorizer.authorize(userIdentifier,\n                                                                       repository.getSpace().getName(),\n                                                                       repository.getIdentifier(),\n                                                                       repository.getAlias(),\n                                                                       branchName,\n                                                                       BranchAccessAuthorizer.AccessType.READ))\n                .collect(Collectors.toList());\n\n        final Stream<ChangeRequest> changeRequestStream =\n                spaceConfigStorageRegistry.get(spaceName).loadChangeRequests(repositoryAlias)\n                        .stream()\n                        .filter(ChangeRequestPredicates.matchTargetBranchListAndOtherPredicate(branchesUserCanRead,\n                                                                                               predicate));\n        if (sorted) {\n            return changeRequestStream\n                    .sorted(Comparator.comparing(ChangeRequest::getCreatedDate).reversed())\n                    .collect(Collectors.toList());\n        } else {\n            return changeRequestStream.collect(Collectors.toList());\n        }\n    }\n\n    private List<ChangeRequest> computeFullContent(final String spaceName,\n                                                   final String repositoryAlias,\n                                                   final List<ChangeRequest> changeRequests) {\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        return changeRequests\n                .stream()\n                .map(elem -> {\n                    final int changedFilesCount = countChangeRequestDiffs(repository,\n                                                                          elem);\n\n                    final int commentsCount = countChangeRequestComments(spaceName,\n                                                                         repositoryAlias,\n                                                                         elem.getId());\n\n                    final boolean hasConflicts = !isChangeRequestConflictFree(repository,\n                                                                              elem);\n\n                    return new ChangeRequest(elem.getId(),\n                                             elem.getSpaceName(),\n                                             elem.getRepositoryAlias(),\n                                             elem.getSourceBranch(),\n                                             elem.getTargetBranch(),\n                                             elem.getStatus(),\n                                             elem.getAuthorId(),\n                                             elem.getSummary(),\n                                             elem.getDescription(),\n                                             elem.getCreatedDate(),\n                                             changedFilesCount,\n                                             commentsCount,\n                                             elem.getStartCommitId(),\n                                             elem.getEndCommitId(),\n                                             elem.getMergeCommitId(),\n                                             hasConflicts);\n                })\n                .collect(Collectors.toList());\n    }\n\n    private static String composeSearchableElement(final ChangeRequest element) {\n        return element.toString().toLowerCase();\n    }\n\n    private List<ChangeRequest> paginateChangeRequests(final List<ChangeRequest> changeRequests,\n                                                       final Integer page,\n                                                       final Integer pageSize) {\n        if (page == 0 && pageSize == 0) {\n            return changeRequests;\n        }\n\n        final Map<Integer, List<ChangeRequest>> map = IntStream.iterate(0,\n                                                                        i -> i + pageSize)\n                .limit((changeRequests.size() + pageSize - 1) / pageSize)\n                .boxed()\n                .collect(toMap(i -> i / pageSize,\n                               i -> changeRequests.subList(i,\n                                                           min(i + pageSize,\n                                                               changeRequests.size()))));\n\n        List<ChangeRequest> paginatedChangeRequests = new ArrayList<>();\n\n        if (map.containsKey(page)) {\n            paginatedChangeRequests.addAll(map.get(page));\n        }\n\n        return paginatedChangeRequests;\n    }\n\n    private Integer countChangeRequestComments(final String spaceName,\n                                               final String repositoryAlias,\n                                               final Long changeRequestId) {\n        return spaceConfigStorageRegistry.get(spaceName).getChangeRequestCommentIds(repositoryAlias,\n                                                                                    changeRequestId).size();\n    }\n\n    private List<ChangeRequestComment> paginateComments(final List<ChangeRequestComment> comments,\n                                                        final Integer page,\n                                                        final Integer pageSize) {\n        if (page == 0 && pageSize == 0) {\n            return comments;\n        }\n\n        final Map<Integer, List<ChangeRequestComment>> map = IntStream.iterate(0,\n                                                                               i -> i + pageSize)\n                .limit((comments.size() + pageSize - 1) / pageSize)\n                .boxed()\n                .collect(toMap(i -> i / pageSize,\n                               i -> comments.subList(i,\n                                                     min(i + pageSize,\n                                                         comments.size()))));\n\n        List<ChangeRequestComment> paginatedComments = new ArrayList<>();\n\n        if (map.containsKey(page)) {\n            paginatedComments.addAll(map.get(page));\n        }\n\n        return paginatedComments;\n    }\n\n    private long generateChangeRequestId(final String spaceName,\n                                         final String repositoryAlias) {\n        Optional<Long> maxId = spaceConfigStorageRegistry.get(spaceName)\n                .getChangeRequestIds(repositoryAlias)\n                .stream()\n                .max(Long::compare);\n\n        return maxId.orElse(0L) + 1;\n    }\n\n    private long generateCommentId(final String spaceName,\n                                   final String repositoryAlias,\n                                   final Long changeRequestId) {\n        Optional<Long> maxId = spaceConfigStorageRegistry.get(spaceName)\n                .getChangeRequestCommentIds(repositoryAlias,\n                                            changeRequestId)\n                .stream()\n                .max(Long::compare);\n\n        return maxId.orElse(0L) + 1;\n    }\n\n    private void updateNotMergedChangeRequestStatus(final String spaceName,\n                                                    final String repositoryAlias,\n                                                    final ChangeRequest oldChangeRequest,\n                                                    final ChangeRequestStatus status) {\n        this.updateChangeRequestStatus(spaceName,\n                                       repositoryAlias,\n                                       oldChangeRequest,\n                                       status,\n                                       null);\n    }\n\n    private void updateChangeRequestStatus(final String spaceName,\n                                           final String repositoryAlias,\n                                           final ChangeRequest oldChangeRequest,\n                                           final ChangeRequestStatus status,\n                                           final String mergeCommitId) {\n        if (mergeCommitId == null && status == ChangeRequestStatus.ACCEPTED) {\n            throw new IllegalStateException(\"Must have a merge commit id to update change request to ACCEPTED.\");\n        }\n\n        final Repository repository = resolveRepository(spaceName,\n                                                        repositoryAlias);\n\n        final String startCommitId = resolveStartCommitIdOnStatusUpdated(repository,\n                                                                         oldChangeRequest,\n                                                                         status);\n\n        final String endCommitId = resolveEndCommitIdOnStatusUpdated(repository,\n                                                                     oldChangeRequest,\n                                                                     status);\n\n        final ChangeRequest updatedChangeRequest = new ChangeRequest(oldChangeRequest.getId(),\n                                                                     oldChangeRequest.getSpaceName(),\n                                                                     oldChangeRequest.getRepositoryAlias(),\n                                                                     oldChangeRequest.getSourceBranch(),\n                                                                     oldChangeRequest.getTargetBranch(),\n                                                                     status,\n                                                                     oldChangeRequest.getAuthorId(),\n                                                                     oldChangeRequest.getSummary(),\n                                                                     oldChangeRequest.getDescription(),\n                                                                     oldChangeRequest.getCreatedDate(),\n                                                                     startCommitId,\n                                                                     endCommitId,\n                                                                     mergeCommitId);\n\n        spaceConfigStorageRegistry.get(spaceName).saveChangeRequest(repositoryAlias,\n                                                                    updatedChangeRequest);\n\n        changeRequestStatusUpdatedEventEvent.fire(\n                new ChangeRequestStatusUpdatedEvent(repository.getIdentifier(),\n                                                    updatedChangeRequest.getId(),\n                                                    oldChangeRequest.getStatus(),\n                                                    status,\n                                                    sessionInfo.getIdentity().getIdentifier()));\n    }\n\n    private String resolveStartCommitIdOnStatusUpdated(final Repository repository,\n                                                       final ChangeRequest changeRequest,\n                                                       final ChangeRequestStatus newStatus) {\n        if (newStatus == ChangeRequestStatus.OPEN) {\n            return getCommonCommitId(repository,\n                                     changeRequest.getSourceBranch(),\n                                     changeRequest.getTargetBranch());\n        }\n\n        return changeRequest.getStartCommitId();\n    }\n\n    private String resolveEndCommitIdOnStatusUpdated(final Repository repository,\n                                                     final ChangeRequest changeRequest,\n                                                     final ChangeRequestStatus newStatus) {\n        if (newStatus == ChangeRequestStatus.OPEN) {\n            return null;\n        }\n\n        if (changeRequest.getStatus() == ChangeRequestStatus.OPEN) {\n            return getLastCommitId(repository, changeRequest.getSourceBranch());\n        }\n\n        return changeRequest.getEndCommitId();\n    }\n\n    private List<ChangeRequestDiff> getDiff(final Repository repository,\n                                            final String sourceBranchName,\n                                            final String targetBranchName,\n                                            final String startCommitId,\n                                            final String lastCommitId) {\n        final Branch sourceBranch = resolveBranch(repository,\n                                                  sourceBranchName);\n\n        final Branch targetBranch = resolveBranch(repository,\n                                                  targetBranchName);\n\n        final List<String> conflicts = getConflicts(repository,\n                                                    sourceBranchName,\n                                                    targetBranchName);\n\n        return getTextualDiff(repository,\n                              sourceBranchName,\n                              targetBranchName,\n                              startCommitId,\n                              lastCommitId)\n                .stream()\n                .sorted(Comparator.comparing(TextualDiff::getChangeType))\n                .map(textualDiff -> new ChangeRequestDiff(\n                        createPath(sourceBranch.getPath().toURI(), textualDiff.getOldFilePath()),\n                        createPath(targetBranch.getPath().toURI(), textualDiff.getNewFilePath()),\n                        ChangeType.valueOf(textualDiff.getChangeType()),\n                        textualDiff.getLinesAdded(),\n                        textualDiff.getLinesDeleted(),\n                        textualDiff.getDiffText(),\n                        conflicts.contains(textualDiff.getOldFilePath()) ||\n                                conflicts.contains(textualDiff.getNewFilePath())\n                )).collect(Collectors.toList());\n    }\n\n    private Branch resolveBranch(final Repository repository,\n                                 final String branchName) {\n        return repository.getBranch(branchName)\n                .orElseThrow(() -> new IllegalStateException(\"The branch \" + branchName + \" does not exist\"));\n    }\n\n    private int countChangeRequestDiffs(final Repository repository,\n                                        final ChangeRequest changeRequest) {\n        return getDiffEntries(repository,\n                              changeRequest.getSourceBranch(),\n                              changeRequest.getTargetBranch(),\n                              changeRequest.getStartCommitId(),\n                              changeRequest.getEndCommitId()).size();\n    }\n\n    private boolean isChangeRequestConflictFree(final Repository repository,\n                                                final ChangeRequest changeRequest) {\n        return getConflicts(repository,\n                            changeRequest.getSourceBranch(),\n                            changeRequest.getTargetBranch()).isEmpty();\n    }\n\n    private boolean tryMergeChangeRequest(final Repository repository,\n                                          final ChangeRequest changeRequest,\n                                          final CommitInfo commitInfo,\n                                          final boolean squash) {\n        final String sourceBranchName = changeRequest.getSourceBranch();\n        final String targetBranchName = changeRequest.getTargetBranch();\n\n        final JGitFileSystem fs = getFileSystemFromBranch(repository,\n                                                          targetBranchName);\n\n        boolean isDone = false;\n\n        try {\n            fs.lock();\n\n            final List<String> mergeCommitIds = new ArrayList<>(fs.getGit().merge(sourceBranchName,\n                                                                                  targetBranchName,\n                                                                                  true,\n                                                                                  squash,\n                                                                                  commitInfo));\n\n            if (mergeCommitIds.isEmpty()) {\n                throw new NothingToMergeException();\n            }\n\n            ((GitHookSupport) fs.provider()).executePostCommitHook(fs);\n\n            final RevCommit mergeCommit = getLastCommit(repository,\n                                                        targetBranchName);\n            final String mergeCommitId = mergeCommit.getName();\n\n            final List<DiffEntry> changesToNotify = getDiffEntries(repository,\n                                                                   changeRequest.getSourceBranch(),\n                                                                   changeRequest.getTargetBranch(),\n                                                                   changeRequest.getStartCommitId(),\n                                                                   changeRequest.getEndCommitId());\n\n            this.notifyFileChanges(fs,\n                                   targetBranchName,\n                                   changesToNotify,\n                                   getFullCommitMessage(mergeCommit));\n\n            this.updateChangeRequestStatus(repository.getSpace().getName(),\n                                           repository.getAlias(),\n                                           changeRequest,\n                                           ChangeRequestStatus.ACCEPTED,\n                                           mergeCommitId);\n\n            isDone = true;\n        } catch (GitException e) {\n            logger.debug(String.format(\"Cannot merge change request %s: %s\", changeRequest.getId(), e));\n        } finally {\n            fs.unlock();\n        }\n\n        return isDone;\n    }\n\n    private boolean tryRevertChangeRequest(final Repository repository,\n                                           final ChangeRequest changeRequest) {\n        boolean isDone = false;\n\n        final String sourceBranchName = changeRequest.getSourceBranch();\n        final String targetBranchName = changeRequest.getTargetBranch();\n\n        final JGitFileSystem fs = getFileSystemFromBranch(repository,\n                                                          targetBranchName);\n\n        try {\n            fs.lock();\n\n            final String beforeRevertCommitId = getLastCommitId(repository,\n                                                                targetBranchName);\n\n            isDone = fs.getGit().revertMerge(sourceBranchName,\n                                             targetBranchName,\n                                             changeRequest.getStartCommitId(),\n                                             changeRequest.getMergeCommitId());\n\n            if (isDone) {\n                ((GitHookSupport) fs.provider()).executePostCommitHook(fs);\n\n                final RevCommit revertCommit = getLastCommit(repository,\n                                                             targetBranchName);\n\n                final List<DiffEntry> changesToNotify = getDiffEntries(repository,\n                                                                       targetBranchName,\n                                                                       targetBranchName,\n                                                                       beforeRevertCommitId,\n                                                                       revertCommit.getName());\n\n                notifyFileChanges(fs,\n                                  targetBranchName,\n                                  changesToNotify,\n                                  getFullCommitMessage(revertCommit));\n            }\n        } catch (GitException e) {\n            logger.debug(String.format(\"Failed to revert change request #%s: %s.\",\n                                       changeRequest.getId(),\n                                       e));\n        } finally {\n            fs.unlock();\n        }\n\n        this.updateNotMergedChangeRequestStatus(repository.getSpace().getName(),\n                                                repository.getAlias(),\n                                                changeRequest,\n                                                isDone ? ChangeRequestStatus.REVERTED :\n                                                        ChangeRequestStatus.REVERT_FAILED);\n\n        return isDone;\n    }\n\n    private void checkChangeRequestAlreadyOpen(final String spaceName,\n                                               final String repositoryAlias,\n                                               final String sourceBranchName,\n                                               final String targetBranchName) {\n        final List<ChangeRequest> changeRequests =\n                getFilteredChangeRequestsFromStorage(spaceName,\n                                                     repositoryAlias,\n                                                     false,\n                                                     ChangeRequestPredicates\n                                                             .matchSourceAndTargetAndStatus(sourceBranchName,\n                                                                                            targetBranchName,\n                                                                                            ChangeRequestStatus.OPEN));\n\n        if (!changeRequests.isEmpty()) {\n            throw new ChangeRequestAlreadyOpenException(changeRequests.get(0).getId());\n        }\n    }\n\n    private void notifyFileChanges(final JGitFileSystem fs,\n                                   final String targetBranchName,\n                                   final List<DiffEntry> changesToNotify,\n                                   final String message) {\n        final String rootPath = \"/\";\n        final String host = targetBranchName + \"@\" + fs.getName();\n\n        final Function<String, Path> createPathFn = pathStr -> {\n            final PathInfo pathInfo = fs.getGit().getPathInfo(targetBranchName,\n                                                              pathStr);\n\n            return !pathStr.equals(DiffEntry.DEV_NULL) ? createJGitPathImpl(fs,\n                                                                            rootPath + pathInfo.getPath(),\n                                                                            host,\n                                                                            pathInfo.getObjectId(),\n                                                                            false) : null;\n        };\n\n        final List watchEvents = changesToNotify\n                .stream()\n                .map(entry -> new JGitWatchEvent(sessionInfo.getId(),\n                                                 sessionInfo.getIdentity().getIdentifier(),\n                                                 message,\n                                                 entry.getChangeType().toString(),\n                                                 createPathFn.apply(entry.getOldPath()),\n                                                 createPathFn.apply(entry.getNewPath())))\n                .collect(Collectors.toList());\n\n        if (!watchEvents.isEmpty()) {\n            final Path root = JGitPathImpl.createRoot(fs,\n                                                      rootPath,\n                                                      host,\n                                                      false);\n\n            fs.publishEvents(root,\n                             watchEvents);\n        }\n    }\n\n    private RevCommit getLastCommit(final Repository repository,\n                                    final String branchName) {\n        final Git git = getGitFromBranch(repository,\n                                         branchName);\n\n        final RevCommit lastCommit = git.getLastCommit(branchName);\n\n        if (lastCommit != null) {\n            return lastCommit;\n        }\n\n        throw new IllegalStateException(\"The branch \" + branchName + \" does not have a last commit\");\n    }\n\n    private String getLastCommitId(final Repository repository,\n                                   final String branchName) {\n        return getLastCommit(repository,\n                             branchName).getName();\n    }\n\n    private String getCommonCommitId(final Repository repository,\n                                     final String sourceBranchName,\n                                     final String targetBranchName) {\n        final Git git = getGitFromBranch(repository,\n                                         sourceBranchName);\n\n        try {\n            return git.getCommonAncestorCommit(sourceBranchName,\n                                               targetBranchName).getName();\n        } catch (GitException e) {\n            logger.error(String.format(\"Failed to get common commit for branches %s and %s: %s\",\n                                       sourceBranchName,\n                                       targetBranchName,\n                                       e));\n        }\n\n        throw new IllegalStateException(String.format(\"Branches %s and %s do not have a common ancestor commit\",\n                                                      sourceBranchName,\n                                                      targetBranchName));\n    }\n\n    private List<TextualDiff> getTextualDiff(final Repository repository,\n                                             final String sourceBranchName,\n                                             final String targetBranchName,\n                                             final String startCommitId,\n                                             final String endCommitId) {\n        final Optional<Branch> sourceBranch = repository.getBranch(sourceBranchName);\n        final Optional<Branch> targetBranch = repository.getBranch(targetBranchName);\n\n        if (sourceBranch.isPresent() && targetBranch.isPresent()) {\n            final Git git = getGitFromBranch(repository,\n                                             sourceBranchName);\n\n            return git.textualDiffRefs(targetBranchName,\n                                       sourceBranchName,\n                                       startCommitId,\n                                       endCommitId);\n        }\n\n        return Collections.emptyList();\n    }\n\n    private List<DiffEntry> getDiffEntries(final Repository repository,\n                                           final String sourceBranchName,\n                                           final String targetBranchName,\n                                           final String startCommitId,\n                                           final String endCommitId) {\n        final Optional<Branch> sourceBranch = repository.getBranch(sourceBranchName);\n        final Optional<Branch> targetBranch = repository.getBranch(targetBranchName);\n\n        if (sourceBranch.isPresent() && targetBranch.isPresent()) {\n            final Git git = getGitFromBranch(repository,\n                                             sourceBranchName);\n\n            return git.listDiffs(startCommitId,\n                                 endCommitId != null ? endCommitId :\n                                         getLastCommitId(repository,\n                                                         sourceBranchName));\n        }\n\n        return Collections.emptyList();\n    }\n\n    private List<String> getConflicts(final Repository repository,\n                                      final String sourceBranchName,\n                                      final String targetBranchName) {\n        final Optional<Branch> sourceBranch = repository.getBranch(sourceBranchName);\n        final Optional<Branch> targetBranch = repository.getBranch(targetBranchName);\n\n        if (sourceBranch.isPresent() && targetBranch.isPresent()) {\n            final Git git = getGitFromBranch(repository,\n                                             sourceBranchName);\n\n            return git.conflictBranchesChecker(targetBranchName,\n                                               sourceBranchName);\n        }\n\n        return Collections.emptyList();\n    }\n\n    private Git getGitFromBranch(final Repository repository,\n                                 final String branchName) {\n        return getFileSystemFromBranch(repository,\n                                       branchName).getGit();\n    }\n\n    private CommitInfo buildCommitInfo(final String message) {\n        return new CommitInfo(sessionInfo.getId(),\n                              sessionInfo.getIdentity().getIdentifier(),\n                              null,\n                              message,\n                              null,\n                              null);\n    }\n\n    String getFullCommitMessage(final RevCommit commit) {\n        return commit.getFullMessage();\n    }\n\n    JGitFileSystem getFileSystemFromBranch(final Repository repository,\n                                           final String branchName) {\n        final Branch branch = resolveBranch(repository,\n                                            branchName);\n\n        return ((JGitPathImpl) Paths.convert(branch.getPath())).getFileSystem();\n    }\n\n    JGitPathImpl createJGitPathImpl(final JGitFileSystem fs,\n                                    final String path,\n                                    final String host,\n                                    final ObjectId objectId,\n                                    final boolean isRealPath) {\n        return JGitPathImpl.create(fs,\n                                   path,\n                                   host,\n                                   objectId,\n                                   isRealPath);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/ConfiguredRepositories.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.List;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.spaces.Space;\n\npublic interface ConfiguredRepositories {\n\n    Repository getRepositoryByRepositoryAlias(Space space,\n                                              String alias);\n\n    Repository getRepositoryByRepositoryAlias(Space space,\n                                              String alias,\n                                              boolean includeDeleted);\n\n    Repository getRepositoryByRootPath(Space space,\n                                       Path root);\n\n    List<Repository> getAllConfiguredRepositories(Space space);\n\n    boolean containsAlias(Space space,\n                          String alias);\n\n    List<Repository> getAllConfiguredRepositories(Space space,\n                                                  boolean includeDeleted);\n\n    List<Repository> getAllDeletedConfiguredRepositories(Space space);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/ConfiguredRepositoriesBySpace.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\n\npublic class ConfiguredRepositoriesBySpace {\n\n    private Map<String, Repository> repositoriesByAlias = Collections.synchronizedMap(new HashMap<>());\n    private Map<Path, Repository> repositoriesByBranchRoot = Collections.synchronizedMap(new HashMap<>());\n\n    public void clear() {\n\n        repositoriesByAlias.clear();\n        repositoriesByBranchRoot.clear();\n    }\n\n    public void add(Repository repository) {\n        repositoriesByAlias.put(repository.getAlias(),\n                                repository);\n\n        if (repository.getBranches() != null) {\n            for (final Branch branch : repository.getBranches()) {\n                repositoriesByBranchRoot.put(Paths.normalizePath(branch.getPath()),\n                                             repository);\n            }\n        }\n    }\n\n    public Repository get(String alias) {\n        return repositoriesByAlias.get(alias);\n    }\n\n    public Map<String, Repository> getRepositoriesByAlias() {\n        return repositoriesByAlias;\n    }\n\n    public Repository get(Path root) {\n        return repositoriesByBranchRoot.get(Paths.normalizePath(root));\n    }\n\n    public boolean containsRepository(String alias) {\n        return repositoriesByAlias.containsKey(alias);\n    }\n\n    Repository remove(final String alias) {\n\n        final Repository removed = repositoriesByAlias.remove(alias);\n\n        removeFromRootByAlias(alias);\n\n        return removed;\n    }\n\n    void removeFromRootByAlias(final String alias) {\n        for (Path path : findFromRootMapByAlias(alias)) {\n            repositoriesByBranchRoot.remove(path);\n        }\n    }\n\n    private List<Path> findFromRootMapByAlias(final String alias) {\n        List<Path> result = new ArrayList<>();\n        for (Path path : repositoriesByBranchRoot.keySet()) {\n            if (repositoriesByBranchRoot.get(path).getAlias().equals(alias)) {\n                result.add(path);\n            }\n        }\n        return result;\n    }\n\n    public Collection<Repository> getAllConfiguredRepositories() {\n        return repositoriesByAlias.values();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/ConfiguredRepositoriesImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Predicate;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.server.repositories.RepositoryFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.spaces.Space;\n\n/**\n * Cache for configured repositories.\n * <p>\n * If you plan to use this outside of ProjectService make sure you know what you are doing.\n * <p>\n * It is safe to get data from this class, but any editing should be done through ProjectService.\n * Still if possible use ProjectService for accessing the repositories. It is part of a public API\n * and this is hidden in the -backend on purpose.\n */\n@ApplicationScoped\npublic class ConfiguredRepositoriesImpl implements ConfiguredRepositories {\n\n    private RepositoryFactory repositoryFactory;\n    private SpaceConfigStorageRegistry spaceConfigStorage;\n\n    public ConfiguredRepositoriesImpl() {\n    }\n\n    @Inject\n    public ConfiguredRepositoriesImpl(final RepositoryFactory repositoryFactory,\n                                      final SpaceConfigStorageRegistry spaceConfigStorage) {\n        this.repositoryFactory = repositoryFactory;\n        this.spaceConfigStorage = spaceConfigStorage;\n    }\n\n    /**\n     * @param space Space of the repository.\n     * @param alias Name of the repository.\n     * @return Repository that has a random branch as a root, usually main if main exists.\n     */\n    public Repository getRepositoryByRepositoryAlias(final Space space,\n                                                     final String alias) {\n\n        return this.getRepositoryByRepositoryAlias(space,\n                                                   alias,\n                                                   false);\n    }\n\n    /**\n     * @param alias Name of the repository.\n     * @param space Space of the repository.\n     * @return Repository that has a random branch as a root, usually main if main exists.\n     */\n    public Repository getRepositoryByRepositoryAlias(final Space space,\n                                                     final String alias,\n                                                     final boolean includeDeleted) {\n\n        List<RepositoryInfo> repositories = getAllRepositoryInfo(space);\n\n        return repositories.stream()\n                .filter(this.getRepository(alias,\n                                           includeDeleted))\n                .findAny()\n                .map(repo -> repositoryFactory.newRepository(repo))\n                .orElse(null);\n    }\n\n    private List<RepositoryInfo> getAllRepositoryInfo(Space space) {\n        try {\n            return this.spaceConfigStorage.get(space.getName())\n                    .loadSpaceInfo()\n                    .getRepositories();\n        } catch (Exception e) {\n            return new ArrayList<>();\n        }\n    }\n\n    private Predicate<RepositoryInfo> getRepository(String alias,\n                                                    boolean includeDeleted) {\n        return (RepositoryInfo repositoryInfo) -> repositoryInfo.getName().equals(alias) && (!repositoryInfo.isDeleted() || includeDeleted);\n    }\n\n    /**\n     * @param space Space of the repository.\n     * @param root Path to the repository root in any branch.\n     * @return Repository root branch is still the default, usually main.\n     */\n    public Repository getRepositoryByRootPath(final Space space,\n                                              final Path root) {\n\n        return this.getAllConfiguredRepositories(space).stream().filter(r -> {\n            if (r.getBranches() != null) {\n                for (final Branch branch : r.getBranches()) {\n                    Path rootPath = Paths.normalizePath(branch.getPath());\n                    if (root.equals(rootPath)) {\n                        return true;\n                    }\n                }\n                return false;\n            } else {\n                return false;\n            }\n        }).findFirst()\n                .orElse(null);\n    }\n\n    /**\n     * @return Does not include system repository.\n     */\n    public List<Repository> getAllConfiguredRepositories(final Space space) {\n        return this.getConfiguredRepositories(space,\n                                              repositoryInfo -> !repositoryInfo.isDeleted());\n    }\n\n    @Override\n    public List<Repository> getAllConfiguredRepositories(Space space,\n                                                         boolean includeDeleted) {\n\n        return this.getConfiguredRepositories(space,\n                                              r -> includeDeleted || !r.isDeleted());\n    }\n\n    @Override\n    public List<Repository> getAllDeletedConfiguredRepositories(Space space) {\n        return this.getConfiguredRepositories(space,\n                                              repositoryInfo -> repositoryInfo.isDeleted());\n    }\n\n    private List<Repository> getConfiguredRepositories(Space space,\n                                                       Predicate<RepositoryInfo> predicate) {\n        List<RepositoryInfo> repositories = getAllRepositoryInfo(space);\n\n        return repositories.stream()\n                .filter(predicate)\n                .map(repo -> repositoryFactory.newRepository(repo))\n                .collect(Collectors.toList());\n    }\n\n    public boolean containsAlias(final Space space,\n                                 final String alias) {\n        List<RepositoryInfo> repositories = this.getAllRepositoryInfo(space);\n        return repositories.stream()\n                .anyMatch(r -> !r.isDeleted() && r.getName().equals(alias)) &&\n                SystemRepository.SYSTEM_REPO.getAlias().equals(alias);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/LoadReposOnAppInit.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.java.nio.file.api.FileSystemUtils;\n\n/**\n * This will boot internal FS infra for all repos making them available to ssh, http and git protocol\n */\n@ApplicationScoped\n@Startup\npublic class LoadReposOnAppInit {\n\n    private ConfiguredRepositories configuredRepositories;\n    private OrganizationalUnitService organizationalUnitService;\n\n    public LoadReposOnAppInit() {\n    }\n\n    @Inject\n    public LoadReposOnAppInit(final ConfiguredRepositories configuredRepositories,\n                              final OrganizationalUnitService organizationalUnitService) {\n\n        this.configuredRepositories = configuredRepositories;\n        this.organizationalUnitService = organizationalUnitService;\n    }\n\n    @PostConstruct\n    public void execute() {\n        if (this.isGitDefaultFileSystem()) {\n            organizationalUnitService\n                    .getAllOrganizationalUnits()\n                    .forEach(ou -> configuredRepositories.getAllConfiguredRepositories(ou.getSpace()));\n        }\n    }\n\n    protected boolean isGitDefaultFileSystem() {\n        return FileSystemUtils.isGitDefaultFileSystem();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/RepositoryCopierImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.Optional;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryCopier;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.IOException;\nimport org.uberfire.java.nio.file.FileAlreadyExistsException;\nimport org.uberfire.java.nio.file.FileVisitResult;\nimport org.uberfire.java.nio.file.FileVisitor;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.StandardCopyOption;\nimport org.uberfire.java.nio.file.attribute.BasicFileAttributes;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\n\npublic class RepositoryCopierImpl\n        implements RepositoryCopier {\n\n    private IOService ioService;\n    private Event<NewBranchEvent> newBranchEventEvent;\n    private ConfiguredRepositories configuredRepositories;\n    private RepositoryService repositoryService;\n    private SessionInfo sessionInfo;\n\n    public RepositoryCopierImpl() {\n    }\n\n    @Inject\n    public RepositoryCopierImpl(final @Named(\"ioStrategy\") IOService ioService,\n                                final Event<NewBranchEvent> newBranchEventEvent,\n                                final ConfiguredRepositories configuredRepositories,\n                                final RepositoryService repositoryService,\n                                final SessionInfo sessionInfo) {\n        this.ioService = ioService;\n        this.newBranchEventEvent = newBranchEventEvent;\n        this.configuredRepositories = configuredRepositories;\n        this.repositoryService = repositoryService;\n        this.sessionInfo = sessionInfo;\n    }\n\n    @Override\n    public Repository copy(final OrganizationalUnit targetOU,\n                           final String newRepositoryName,\n                           final Path originRoot) {\n\n        final Repository targetRepository = getRepository(targetOU,\n                                                          newRepositoryName);\n\n        if (targetRepository.getDefaultBranch().isPresent()) {\n            copy(originRoot,\n                 targetRepository.getDefaultBranch().get().getPath());\n        }\n\n        return targetRepository;\n    }\n\n    private Repository getRepository(final OrganizationalUnit targetOU,\n                                     final String newRepositoryName) {\n        return repositoryService.createRepository(targetOU,\n                                                  GitRepository.SCHEME.toString(),\n                                                  makeSafeRepositoryName(newRepositoryName),\n                                                  new RepositoryEnvironmentConfigurations());\n    }\n\n    @Override\n    public void copy(final Path originRoot,\n                     final Path targetRoot) {\n\n        final boolean branchExisted = (repositoryService.getRepository(targetRoot) != null);\n\n        final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot = Paths.convert(targetRoot);\n        final org.uberfire.java.nio.file.Path originRepositoryRoot = Paths.convert(originRoot);\n\n        ioService.startBatch(nioTargetRepositoryRoot.getFileSystem());\n        try {\n            copyFolders(nioTargetRepositoryRoot,\n                        originRepositoryRoot);\n            copyRootFiles(targetRoot,\n                          originRepositoryRoot);\n        } finally {\n            ioService.endBatch();\n        }\n\n        if (!branchExisted) {\n            fireNewBranchEvent(targetRoot,\n                               nioTargetRepositoryRoot,\n                               originRepositoryRoot);\n        }\n    }\n\n    @Override\n    public void copy(Space space,\n                     Path originRoot,\n                     Path targetRoot) {\n\n        final boolean branchExisted = (repositoryService.getRepository(space,\n                                                                       targetRoot) != null);\n\n        final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot = Paths.convert(targetRoot);\n        final org.uberfire.java.nio.file.Path originRepositoryRoot = Paths.convert(originRoot);\n\n        ioService.startBatch(nioTargetRepositoryRoot.getFileSystem());\n        try {\n            copyFolders(nioTargetRepositoryRoot,\n                        originRepositoryRoot);\n            copyRootFiles(targetRoot,\n                          originRepositoryRoot);\n        } finally {\n            ioService.endBatch();\n        }\n\n        if (!branchExisted) {\n            fireNewBranchEvent(space,\n                               targetRoot,\n                               nioTargetRepositoryRoot,\n                               originRepositoryRoot);\n        }\n    }\n\n    public void fireNewBranchEvent(final Path targetRoot,\n                                   final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot,\n                                   final org.uberfire.java.nio.file.Path originRepositoryRoot) {\n\n        final Repository repository = repositoryService.getRepository(targetRoot);\n\n        final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));\n\n        final Optional<Branch> origBranch = repository.getBranch(Paths.convert(originRepositoryRoot.getRoot()));\n\n        if (branch.isPresent()) {\n            newBranchEventEvent.fire(new NewBranchEvent(repository,\n                                                        branch.get().getName(),\n                                                        origBranch.get().getName(),\n                                                        sessionInfo.getIdentity().getIdentifier()));\n        } else {\n            throw new IllegalStateException(\"Could not find a branch that was just created. The Path used was \" + nioTargetRepositoryRoot.getRoot());\n        }\n    }\n\n    public void fireNewBranchEvent(final Space space,\n                                   final Path targetRoot,\n                                   final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot,\n                                   final org.uberfire.java.nio.file.Path originRepositoryRoot) {\n\n        final Repository repository = repositoryService.getRepository(space,\n                                                                      targetRoot);\n\n        final Optional<Branch> branch = repository.getBranch(Paths.convert(nioTargetRepositoryRoot.getRoot()));\n\n        final Optional<Branch> origBranch = repository.getBranch(Paths.convert(originRepositoryRoot.getRoot()));\n\n        if (branch.isPresent()) {\n            newBranchEventEvent.fire(new NewBranchEvent(repository,\n                                                        branch.get().getName(),\n                                                        origBranch.get().getName(),\n                                                        sessionInfo.getIdentity().getIdentifier()));\n        } else {\n            throw new IllegalStateException(\"Could not find a branch that was just created. The Path used was \" + nioTargetRepositoryRoot.getRoot());\n        }\n    }\n\n    private void copyFolders(final org.uberfire.java.nio.file.Path nioTargetRepositoryRoot,\n                             final org.uberfire.java.nio.file.Path originRepositoryRoot) {\n        final RecursiveCopier copier = new RecursiveCopier(originRepositoryRoot,\n                                                           nioTargetRepositoryRoot);\n        Files.walkFileTree(originRepositoryRoot,\n                           copier);\n    }\n\n    private void copyRootFiles(final Path targetRoot,\n                               final org.uberfire.java.nio.file.Path originRepositoryRoot) {\n        for (org.uberfire.java.nio.file.Path path : Files.newDirectoryStream(originRepositoryRoot)) {\n\n            if (!Files.isDirectory(path)) {\n                try {\n                    org.uberfire.java.nio.file.Path fileName = path.getFileName();\n                    org.uberfire.java.nio.file.Path resolve = Paths.convert(targetRoot).resolve(fileName);\n                    Files.copy(path,\n                               resolve,\n                               StandardCopyOption.REPLACE_EXISTING);\n                } catch (FileAlreadyExistsException x) {\n                    //Swallow\n                    x.printStackTrace();\n                }\n            }\n        }\n    }\n\n    @Override\n    public String makeSafeRepositoryName(final String oldName) {\n        return oldName.replace(' ',\n                               '-');\n    }\n\n    static class RecursiveCopier implements FileVisitor<org.uberfire.java.nio.file.Path> {\n\n        private final org.uberfire.java.nio.file.Path source;\n        private final org.uberfire.java.nio.file.Path target;\n\n        RecursiveCopier(final org.uberfire.java.nio.file.Path source,\n                        final org.uberfire.java.nio.file.Path target) {\n            this.source = source;\n            this.target = target;\n        }\n\n        @Override\n        public FileVisitResult preVisitDirectory(final org.uberfire.java.nio.file.Path src,\n                                                 final BasicFileAttributes attrs) {\n            final org.uberfire.java.nio.file.Path tgt = target.resolve(source.relativize(src));\n            try {\n                Files.copy(src,\n                           tgt,\n                           StandardCopyOption.REPLACE_EXISTING);\n//            } catch (FileAlreadyExistsException x) {\n            } catch (Exception x) {\n                x.printStackTrace();\n                //Swallow\n            }\n            return FileVisitResult.CONTINUE;\n        }\n\n        @Override\n        public FileVisitResult visitFile(final org.uberfire.java.nio.file.Path file,\n                                         final BasicFileAttributes attrs) {\n            return FileVisitResult.CONTINUE;\n        }\n\n        @Override\n        public FileVisitResult postVisitDirectory(final org.uberfire.java.nio.file.Path dir,\n                                                  final IOException exc) {\n            return FileVisitResult.CONTINUE;\n        }\n\n        @Override\n        public FileVisitResult visitFileFailed(final org.uberfire.java.nio.file.Path file,\n                                               final IOException exc) {\n            return FileVisitResult.CONTINUE;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/RepositoryFactoryImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Any;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.backend.backcompat.BackwardCompatibleUtil;\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.server.repositories.RepositoryFactory;\nimport org.guvnor.structure.server.repositories.RepositoryFactoryHelper;\n\nimport static org.guvnor.structure.backend.repositories.SystemRepository.SYSTEM_REPO;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@ApplicationScoped\npublic class RepositoryFactoryImpl implements RepositoryFactory {\n\n    @Inject\n    @Any\n    private Instance<RepositoryFactoryHelper> helpers;\n\n    @Inject\n    private BackwardCompatibleUtil backward;\n\n    @Override\n    public Repository newRepository(RepositoryInfo repositoryInfo) {\n        checkNotNull(\"repositoryInfo\",\n                     repositoryInfo);\n        final String schemeConfigItem = repositoryInfo.getScheme();\n        checkNotNull(\"schemeConfigItem\",\n                     schemeConfigItem);\n\n        //Find a Helper that can create a repository\n        Repository repository = null;\n        for (RepositoryFactoryHelper helper : helpers) {\n            if (helper.accept(repositoryInfo)) {\n                repository = helper.newRepository(repositoryInfo);\n                break;\n            }\n        }\n\n        //Check one was created\n        if (repository == null) {\n            throw new IllegalArgumentException(\"Unrecognized scheme '\" + schemeConfigItem + \"'.\");\n        }\n\n        //Copy in Security Roles required to access this resource\n        List<String> groups = repositoryInfo.getSecurityGroups();\n        if (groups != null) {\n            for (String group : groups) {\n                repository.getGroups().add(group);\n            }\n        }\n\n        List<Contributor> contributors = repositoryInfo.getContributors();\n        if (contributors != null) {\n            for (Contributor contributor : contributors) {\n                repository.getContributors().add(contributor);\n            }\n        }\n\n        return repository;\n    }\n\n    @Produces\n    @Named(\"system\")\n    public Repository systemRepository() {\n        return SYSTEM_REPO;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/RepositorySearchServiceImpl.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositorySearchService;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.spaces.Space;\n\n@Service\n@ApplicationScoped\npublic class RepositorySearchServiceImpl implements RepositorySearchService {\n\n    private RepositoryService repositoryService;\n    private OrganizationalUnitService orgUnitService;\n\n    @Inject\n    public RepositorySearchServiceImpl(RepositoryService repositoryService, OrganizationalUnitService orgUnitService) {\n        this.repositoryService = repositoryService;\n        this.orgUnitService = orgUnitService;\n    }\n\n    @Override\n    public Collection<Repository> searchByAlias(String pattern,\n                                                int maxItems,\n                                                boolean caseSensitive) {\n        List<Repository> results = new ArrayList<>();\n        for (Space space : orgUnitService.getAllUserSpaces()) {\n            for (Repository repo : repositoryService.getAllRepositories(space)) {\n                String alias = repo.getAlias();\n                if (caseSensitive ? alias.contains(pattern) : alias.toLowerCase().contains(pattern.toLowerCase())) {\n                    results.add(repo);\n                    if (maxItems > 0 && results.size() >= maxItems) {\n                        return results;\n                    }\n                }\n            }\n        }\n        return results;\n    }\n\n    @Override\n    public Collection<Repository> searchById(Collection<String> ids) {\n        List<Repository> results = new ArrayList<>();\n        for (Space space : orgUnitService.getAllUserSpaces()) {\n            for (Repository repo : repositoryService.getAllRepositories(space)) {\n                if (ids.contains(repo.getIdentifier())) {\n                    results.add(repo);\n                }\n            }\n        }\n        return results;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/RepositoryServiceEditorImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.RepositoryServiceEditor;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.options.CommentedOption;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.uberfire.backend.server.util.Paths.convert;\nimport static org.uberfire.java.nio.file.StandardCopyOption.REPLACE_EXISTING;\n\n@Service\n@ApplicationScoped\npublic class RepositoryServiceEditorImpl implements RepositoryServiceEditor {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    private IOService ioService;\n\n    @Inject\n    private RepositoryService repositoryService;\n\n    @Inject\n    private SessionInfo sessionInfo;\n\n    @Inject\n    private SpacesAPI spaces;\n\n    @Override\n    public List<VersionRecord> revertHistory(final String alias,\n                                             final Path path,\n                                             final String _comment,\n                                             final VersionRecord record) {\n        final org.uberfire.java.nio.file.Path history = ioService.get(URI.create(record.uri()));\n        Space space = spaces.resolveSpace(path.toURI()).orElseThrow(() -> new IllegalArgumentException(\"Cannot resolve space from path: \" + path));\n\n        final String comment;\n        if (_comment == null || _comment.trim().isEmpty()) {\n            comment = \"revert history from commit {\" + record.comment() + \"}\";\n        } else {\n            comment = _comment;\n        }\n\n        ioService.move(history,\n                       convert(path),\n                       REPLACE_EXISTING,\n                       new CommentedOption(sessionInfo.getId(),\n                                           sessionInfo.getIdentity().getIdentifier(),\n                                           null,\n                                           comment));\n\n\n        return new ArrayList<>(repositoryService.getRepositoryInfo(space, alias).getInitialVersionList());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/RepositoryServiceImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.common.services.backend.exceptions.ExceptionUtilities;\nimport org.guvnor.common.services.project.events.RepositoryContributorsUpdatedEvent;\nimport org.guvnor.structure.backend.backcompat.BackwardCompatibleUtil;\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.GitMetadataStore;\nimport org.guvnor.structure.repositories.NewRepositoryEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryAlreadyExistsException;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfiguration;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryInfo;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.guvnor.structure.server.repositories.RepositoryFactory;\nimport org.jboss.errai.bus.server.annotations.Service;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.TextUtil;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.editor.commons.version.impl.PortableVersionRecord;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.base.version.VersionAttributeView;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.backend.InputEscapeUtils.escapeContributorsNames;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.CRYPT_PREFIX;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.SECURE_PREFIX;\nimport static org.guvnor.structure.repositories.EnvironmentParameters.SCHEME;\nimport static org.uberfire.backend.server.util.Paths.convert;\n\n@Service\n@ApplicationScoped\npublic class RepositoryServiceImpl implements RepositoryService {\n\n    private static final Logger logger = LoggerFactory.getLogger(RepositoryServiceImpl.class);\n\n    private static final int HISTORY_PAGE_SIZE = 10;\n\n    private IOService ioService;\n\n    private GitMetadataStore metadataStore;\n\n    private ConfigurationService configurationService;\n\n    private OrganizationalUnitService organizationalUnitService;\n\n    private ConfigurationFactory configurationFactory;\n\n    private RepositoryFactory repositoryFactory;\n\n    private Event<NewRepositoryEvent> event;\n\n    private Event<RepositoryRemovedEvent> repositoryRemovedEvent;\n\n    private BackwardCompatibleUtil backward;\n\n    private ConfiguredRepositories configuredRepositories;\n\n    private AuthorizationManager authorizationManager;\n\n    private User user;\n\n    private SpacesAPI spacesAPI;\n\n    private SpaceConfigStorageRegistry spaceConfigStorage;\n\n    private Event<RepositoryContributorsUpdatedEvent> repositoryContributorsUpdatedEvent;\n\n    private PasswordService secureService;\n\n    public RepositoryServiceImpl() {\n    }\n\n    @Inject\n    public RepositoryServiceImpl(@Named(\"ioStrategy\") final IOService ioService,\n                                 final GitMetadataStore metadataStore,\n                                 final ConfigurationService configurationService,\n                                 final OrganizationalUnitService organizationalUnitService,\n                                 final ConfigurationFactory configurationFactory,\n                                 final RepositoryFactory repositoryFactory,\n                                 final Event<NewRepositoryEvent> event,\n                                 final Event<RepositoryRemovedEvent> repositoryRemovedEvent,\n                                 final BackwardCompatibleUtil backward,\n                                 final ConfiguredRepositories configuredRepositories,\n                                 final AuthorizationManager authorizationManager,\n                                 final User user,\n                                 final SpacesAPI spacesAPI,\n                                 final SpaceConfigStorageRegistry spaceConfigStorage,\n                                 final Event<RepositoryContributorsUpdatedEvent> repositoryContributorsUpdatedEvent,\n                                 final PasswordService secureService) {\n        this.ioService = ioService;\n        this.metadataStore = metadataStore;\n        this.configurationService = configurationService;\n        this.organizationalUnitService = organizationalUnitService;\n        this.configurationFactory = configurationFactory;\n        this.repositoryFactory = repositoryFactory;\n        this.event = event;\n        this.repositoryRemovedEvent = repositoryRemovedEvent;\n        this.backward = backward;\n        this.configuredRepositories = configuredRepositories;\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n        this.spacesAPI = spacesAPI;\n        this.spaceConfigStorage = spaceConfigStorage;\n        this.repositoryContributorsUpdatedEvent = repositoryContributorsUpdatedEvent;\n        this.secureService = secureService;\n    }\n\n    @Override\n    public RepositoryInfo getRepositoryInfo(final Space space,\n                                            final String alias) {\n        Repository repo = getRepositoryFromSpace(space,\n                                                 alias);\n\n        return new RepositoryInfo(repo.getIdentifier(),\n                                  alias,\n                                  repo.getSpace().getName(),\n                                  getRepositoryRootPath(repo),\n                                  repo.getPublicURIs(),\n                                  getRepositoryHistory(repo.getSpace(),\n                                                       alias,\n                                                       0,\n                                                       HISTORY_PAGE_SIZE));\n    }\n\n    private Path getRepositoryRootPath(final Repository repo) {\n        if (repo.getDefaultBranch().isPresent()) {\n            return repo.getDefaultBranch().get().getPath();\n        } else {\n            return null;\n        }\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistory(final Space space,\n                                                    final String alias,\n                                                    final int startIndex) {\n        return getRepositoryHistory(space,\n                                    alias,\n                                    startIndex,\n                                    startIndex + HISTORY_PAGE_SIZE);\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistory(final Space space,\n                                                    final String alias,\n                                                    int startIndex,\n                                                    int endIndex) {\n        final Repository repo = getRepositoryFromSpace(space,\n                                                       alias);\n\n        //This is a work-around for https://bugzilla.redhat.com/show_bug.cgi?id=1199215\n        //org.kie.workbench.common.screens.contributors.backend.dataset.ContributorsManager is trying to\n        //load a Repository's history for a Repository associated with an Organizational Unit before the\n        //Repository has been setup.\n        if (repo == null) {\n            return Collections.EMPTY_LIST;\n        }\n\n        if (repo.getDefaultBranch().isPresent()) {\n            throw new IllegalStateException(\"Repository should have at least one branch.\");\n        }\n\n        final VersionAttributeView versionAttributeView = ioService.getFileAttributeView(convert(repo.getDefaultBranch().get().getPath()),\n                                                                                         VersionAttributeView.class);\n        final List<VersionRecord> records = versionAttributeView.readAttributes().history().records();\n\n        if (startIndex < 0) {\n            startIndex = 0;\n        }\n        if (endIndex < 0 || endIndex > records.size()) {\n            endIndex = records.size();\n        }\n        if (startIndex >= records.size() || startIndex >= endIndex) {\n            return Collections.emptyList();\n        }\n\n        Collections.reverse(records);\n\n        final List<VersionRecord> result = new ArrayList<>(endIndex - startIndex);\n        for (VersionRecord record : records.subList(startIndex,\n                                                    endIndex)) {\n            result.add(new PortableVersionRecord(record.id(),\n                                                 record.author(),\n                                                 record.email(),\n                                                 record.comment(),\n                                                 record.date(),\n                                                 record.uri()));\n        }\n\n        return result;\n    }\n\n    @Override\n    public Repository getRepositoryFromSpace(final Space space,\n                                             final String alias) {\n        return configuredRepositories.getRepositoryByRepositoryAlias(space,\n                                                                     alias);\n    }\n\n    @Override\n    public Repository getRepository(final Path root) {\n        Space space = spacesAPI.resolveSpace(root.toURI()).orElseThrow(() -> new IllegalArgumentException(\"Cannot resolve space from given path: \" + root));\n        return configuredRepositories.getRepositoryByRootPath(space,\n                                                              root);\n    }\n\n    @Override\n    public Repository getRepository(final Space space,\n                                    final Path root) {\n        return configuredRepositories.getRepositoryByRootPath(space,\n                                                              root);\n    }\n\n    @Override\n    public String normalizeRepositoryName(String name) {\n        return TextUtil.normalizeRepositoryName(name);\n    }\n\n    @Override\n    public boolean validateRepositoryName(String name) {\n        return name != null && !\"\".equals(name) && name.equals(normalizeRepositoryName(name));\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositories(final Space space) {\n        return this.getAllRepositories(space,\n                                       false);\n    }\n\n    @Override\n    public Collection<Repository> getAllDeletedRepositories(final Space space) {\n        return this.configuredRepositories.getAllDeletedConfiguredRepositories(space);\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositories(Space space,\n                                                     boolean includeDeleted) {\n        return configuredRepositories.getAllConfiguredRepositories(space,\n                                                                   includeDeleted);\n    }\n\n    @Override\n    public Collection<Repository> getAllRepositoriesFromAllUserSpaces() {\n        List<Repository> allRepos = new ArrayList<>();\n\n        for (Space space : organizationalUnitService.getAllUserSpaces()) {\n            allRepos.addAll(configuredRepositories.getAllConfiguredRepositories(space));\n        }\n\n        return allRepos;\n    }\n\n    @Override\n    public Collection<Repository> getRepositories(final Space space) {\n        Collection<Repository> result = new ArrayList<>();\n        for (Repository repository : configuredRepositories.getAllConfiguredRepositories(space)) {\n            if (authorizationManager.authorize(repository,\n                                               user)) {\n                result.add(repository);\n            }\n        }\n        return result;\n    }\n\n    @Override\n    public Repository createRepository(final OrganizationalUnit organizationalUnit,\n                                       final String scheme,\n                                       final String alias,\n                                       final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations) throws RepositoryAlreadyExistsException {\n\n        return createRepository(organizationalUnit,\n                                scheme,\n                                alias,\n                                repositoryEnvironmentConfigurations,\n                                organizationalUnit.getContributors());\n    }\n\n    @Override\n    public Repository createRepository(final OrganizationalUnit organizationalUnit,\n                                       final String scheme,\n                                       final String alias,\n                                       final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations,\n                                       final Collection<Contributor> contributors) throws RepositoryAlreadyExistsException {\n\n        try {\n            repositoryEnvironmentConfigurations.setSpace(organizationalUnit.getName());\n\n            Space space = spacesAPI.getSpace(organizationalUnit.getName());\n            String newAlias = createFreshRepositoryAlias(alias,\n                                                         space);\n\n            final Repository repository = createRepository(scheme,\n                                                           newAlias,\n                                                           new Space(organizationalUnit.getName()),\n                                                           repositoryEnvironmentConfigurations,\n                                                           contributors);\n            if (organizationalUnit != null && repository != null) {\n                organizationalUnitService.addRepository(organizationalUnit,\n                                                        repository);\n            }\n            metadataStore.write(newAlias,\n                                (String) repositoryEnvironmentConfigurations.getOrigin(),\n                                false);\n            return repository;\n        } catch (final Exception e) {\n            logger.error(\"Error during create repository\",\n                         e);\n            throw ExceptionUtilities.handleException(e);\n        }\n    }\n\n    protected String createFreshRepositoryAlias(final String alias,\n                                                final Space space) {\n        int index = 0;\n        String suffix = \"\";\n        while (configuredRepositories.getRepositoryByRepositoryAlias(space,\n                                                                     alias + suffix,\n                                                                     true) != null) {\n            suffix = \"-\" + ++index;\n        }\n\n        return alias + suffix;\n    }\n\n    protected Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> findRepositoryConfig(final String spaceName,\n                                                                                                           final String alias) {\n\n        List<org.guvnor.structure.organizationalunit.config.RepositoryInfo> found = this.spaceConfigStorage.get(spaceName).loadSpaceInfo()\n                .getRepositories(repo -> repo.getName().equals(alias));\n\n        if (!found.isEmpty()) {\n            return Optional.of(found.get(0));\n        } else {\n            return Optional.ofNullable(null);\n        }\n    }\n\n    @Override\n    public void removeRepository(final Space space,\n                                 final String alias) {\n\n        spaceConfigStorage.getBatch(space.getName())\n                .run(context -> {\n\n                    final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> config = findRepositoryConfig(space.getName(), alias);\n\n                    try {\n                        OrganizationalUnit orgUnit = Optional\n                                .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName()))\n                                .orElseThrow(() -> new IllegalArgumentException(String\n                                                                                        .format(\"The given space [%s] does not exist.\",\n                                                                                                space.getName())));\n                        doRemoveRepository(orgUnit,\n                                           alias,\n                                           config,\n                                           repo -> repositoryRemovedEvent.fire(new RepositoryRemovedEvent(repo)),\n                                           true);\n                    } catch (final Exception e) {\n                        logger.error(\"Error during remove repository\", e);\n                        throw new RuntimeException(e);\n                    }\n\n                    return null;\n                });\n    }\n\n    @Override\n    public void removeRepositories(final Space space,\n                                   final Set<String> aliases) {\n        spaceConfigStorage.getBatch(space.getName())\n                .run(context -> {\n                    try {\n                        OrganizationalUnit orgUnit = Optional\n                                .ofNullable(organizationalUnitService.getOrganizationalUnit(space.getName()))\n                                .orElseThrow(() -> new IllegalArgumentException(String.format(\"The given space [%s] does not exist.\",\n                                                                                              space.getName())));\n\n                        for (final String alias : aliases) {\n                            doRemoveRepository(orgUnit,\n                                               alias,\n                                               findRepositoryConfig(space.getName(),\n                                                                    alias),\n                                               repo -> {\n                                               }, false);\n                        }\n                    } catch (final Exception e) {\n                        logger.error(\"Error while removing repositories\", e);\n                        throw new RuntimeException(e);\n                    }\n\n                    return null;\n                });\n    }\n\n    protected void doRemoveRepository(final OrganizationalUnit orgUnit,\n                                      final String alias,\n                                      final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig,\n                                      final Consumer<Repository> notification,\n                                      final boolean lock) {\n\n        SpaceConfigStorage configStorage = this.spaceConfigStorage.get(orgUnit.getName());\n\n        try {\n            if (lock) {\n                configStorage.startBatch();\n            }\n\n            Optional<Repository> repo = Optional.ofNullable(this.configuredRepositories.getRepositoryByRepositoryAlias(orgUnit.getSpace(),\n                                                                                                                       alias));\n            repo.ifPresent(r -> this.close(r.getDefaultBranch()));\n\n            //Remove reference to Repository from Organizational Units\n            for (Repository repository : orgUnit.getRepositories()) {\n                if (repository.getAlias().equals(alias)) {\n                    organizationalUnitService.removeRepository(orgUnit,\n                                                               repository);\n                    metadataStore.delete(alias);\n                }\n            }\n            repo.ifPresent(r -> notification.accept(r));\n        } finally {\n            if (lock) {\n                configStorage.endBatch();\n            }\n        }\n    }\n\n    protected void close(Optional<Branch> defaultBranch) {\n        defaultBranch.ifPresent(branch -> {\n            FileSystem fs = convert(branch.getPath()).getFileSystem();\n            fs.close();\n            fs.dispose();\n        });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void addGroup(final Repository repository,\n                         final String group) {\n        final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig = findRepositoryConfig(repository.getSpace().getName(),\n                                                                                                                                  repository.getAlias());\n\n        if (!thisRepositoryConfig.isPresent()) {\n            throw new IllegalArgumentException(\"Repository \" + repository.getAlias() + \" not found\");\n        }\n\n        thisRepositoryConfig.ifPresent(config -> {\n            config.getSecurityGroups().add(group);\n            this.saveRepositoryConfig(repository.getSpace().getName(),\n                                      config);\n        });\n    }\n\n    @SuppressWarnings({\"unchecked\", \"rawtypes\"})\n    @Override\n    public void removeGroup(Repository repository,\n                            String group) {\n        final Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig = findRepositoryConfig(repository.getSpace().getName(),\n                                                                                                                                  repository.getAlias());\n\n        if (!thisRepositoryConfig.isPresent()) {\n            throw new IllegalArgumentException(\"Repository \" + repository.getAlias() + \" not found\");\n        }\n\n        thisRepositoryConfig.ifPresent(config -> {\n            config.getSecurityGroups().remove(group);\n            this.saveRepositoryConfig(repository.getSpace().getName(),\n                                      config);\n        });\n    }\n\n    protected void saveRepositoryConfig(final String space,\n                                        final org.guvnor.structure.organizationalunit.config.RepositoryInfo config) {\n\n        spaceConfigStorage.getBatch(space)\n                .run(context -> {\n                    SpaceInfo spaceInfo = context.getSpaceInfo();\n                    spaceInfo.removeRepository(config.getName());\n                    spaceInfo.getRepositories().add(config);\n                    context.saveSpaceInfo();\n                    return null;\n                });\n    }\n\n    @Override\n    public void updateContributors(final Repository repository,\n                                   final List<Contributor> contributors) {\n        Optional<org.guvnor.structure.organizationalunit.config.RepositoryInfo> thisRepositoryConfig = findRepositoryConfig(repository.getSpace().getName(),\n                                                                                                                            repository.getAlias());\n\n        if (!thisRepositoryConfig.isPresent()) {\n            throw new IllegalArgumentException(\"Repository \" + repository.getAlias() + \" not found\");\n        }\n\n        thisRepositoryConfig.ifPresent(config -> {\n            config.getConfiguration().add(\"contributors\",\n                                          escapeContributorsNames(contributors));\n            this.saveRepositoryConfig(repository.getSpace().getName(),\n                                      config);\n            repositoryContributorsUpdatedEvent.fire(new RepositoryContributorsUpdatedEvent(getRepositoryFromSpace(repository.getSpace(),\n                                                                                                                  repository.getAlias())));\n        });\n    }\n\n    @Override\n    public List<VersionRecord> getRepositoryHistoryAll(final Space space,\n                                                       final String alias) {\n        return getRepositoryHistory(space,\n                                    alias,\n                                    0,\n                                    -1);\n    }\n\n    private Repository createRepository(final String scheme,\n                                        final String alias,\n                                        final Space space,\n                                        final RepositoryEnvironmentConfigurations repositoryEnvironmentConfigurations,\n                                        final Collection<Contributor> contributors) {\n        return this.spaceConfigStorage.getBatch(space.getName())\n                .run(context -> {\n                    if (configuredRepositories.containsAlias(space,\n                                                             alias)) {\n                        throw new RepositoryAlreadyExistsException(alias);\n                    }\n\n                    Repository repo = null;\n                    try {\n                        RepositoryConfiguration configuration = new RepositoryConfiguration();\n\n                        configuration.add(\"security:groups\", new ArrayList<String>());\n                        configuration.add(\"contributors\", contributors);\n\n                        if (!repositoryEnvironmentConfigurations.containsConfiguration(SCHEME)) {\n                            configuration.add(SCHEME, scheme);\n                        }\n\n                        for (final RepositoryEnvironmentConfiguration configEntry : repositoryEnvironmentConfigurations.getConfigurationList()) {\n                            addConfiguration(configuration, configEntry);\n                        }\n\n                        org.guvnor.structure.organizationalunit.config.RepositoryInfo repositoryInfo = new org.guvnor.structure.organizationalunit.config.RepositoryInfo(alias,\n                                                                                                                                                                         false,\n                                                                                                                                                                         configuration);\n                        repo = createRepository(repositoryInfo);\n                        return repo;\n                    } catch (final Exception e) {\n                        logger.error(\"Error during create repository\", e);\n                        throw ExceptionUtilities.handleException(e);\n                    } finally {\n                        if (repo != null) {\n                            event.fire(new NewRepositoryEvent(repo));\n                        }\n                    }\n                });\n    }\n\n    private Repository createRepository(org.guvnor.structure.organizationalunit.config.RepositoryInfo\n                                                repositoryConfiguration) {\n        final Repository repository = repositoryFactory.newRepository(repositoryConfiguration);\n        return repository;\n    }\n\n    private void addConfiguration(final RepositoryConfiguration repositoryConfiguration,\n                                  final RepositoryEnvironmentConfiguration configuration) {\n\n        String key = configuration.getName();\n        if (configuration.isSecuredConfigurationItem()) {\n            String subKey = key.substring(CRYPT_PREFIX.length());\n            String encrypted = secureService.encrypt(configuration.getValue().toString());\n            String newKey = SECURE_PREFIX + subKey;\n            repositoryConfiguration.add(newKey, encrypted);\n        } else {\n            repositoryConfiguration.add(key, configuration.getValue());\n        }\n    }\n\n    public class NoActiveSpaceInTheContext extends RuntimeException {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/SystemRepository.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static java.util.Collections.unmodifiableCollection;\n\n/**\n * Definition of the bootstrap repository\n */\npublic class SystemRepository extends GitRepository {\n\n    private static final String ALIAS = \"system\";\n\n    private static final Collection<String> groups = new ArrayList<String>(1) {{\n        add(\"admin\");\n    }};\n\n    public static final SystemRepository SYSTEM_REPO = new SystemRepository(ALIAS,\n                                                                            SpacesAPI.DEFAULT_SPACE);\n\n    private final Map<String, Object> environment = new HashMap<String, Object>();\n\n    private SystemRepository(final String alias,\n                             Space space) {\n        super(alias,\n              space);\n        environment.put(\"init\",\n                        Boolean.TRUE);\n    }\n\n    @Override\n    public Map<String, Object> getEnvironment() {\n        return environment;\n    }\n\n    @Override\n    public void addEnvironmentParameter(final String key,\n                                        final Object value) {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public String getUri() {\n        String alias = SpacesAPI.sanitizeFileSystemName(getAlias());\n        return SpacesAPI.resolveFileSystemPath(SpacesAPI.Scheme.DEFAULT,\n                                               getSpace(),\n                                               alias).toString();\n    }\n\n    @Override\n    public boolean isValid() {\n        return true;\n    }\n\n    @Override\n    public Collection<String> getGroups() {\n        return unmodifiableCollection(groups);\n    }\n\n    @Override\n    public Collection<Contributor> getContributors() {\n        throw new UnsupportedOperationException();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/GitMetadataStoreImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.net.URI;\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.repositories.GitMetadata;\nimport org.guvnor.structure.repositories.GitMetadataStore;\nimport org.guvnor.structure.repositories.impl.GitMetadataImpl;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.spaces.SpacesAPI;\n\npublic class GitMetadataStoreImpl implements GitMetadataStore {\n\n    private Logger logger = LoggerFactory.getLogger(GitMetadataStoreImpl.class);\n    public static final String SEPARATOR = \"/\";\n\n    private URI metadataFS;\n    private ObjectStorage storage;\n    private SpacesAPI spaces;\n\n    @Inject\n    public GitMetadataStoreImpl(ObjectStorage storage,\n                                SpacesAPI spaces) {\n        this.storage = storage;\n        this.spaces = spaces;\n    }\n\n    @PostConstruct\n    public void init() {\n\n        metadataFS = spaces.resolveFileSystemURI(SpacesAPI.Scheme.DEFAULT,\n                                                 SpacesAPI.DEFAULT_SPACE,\n                                                    \"metadata\");\n        if (logger.isDebugEnabled()) {\n            logger.debug(\"Initializing GitMetadataStoreImpl {}\",\n                         metadataFS);\n        }\n        this.storage.init(metadataFS);\n    }\n\n    @Override\n    public void write(String name) {\n        this.write(name,\n                   \"\");\n    }\n\n    @Override\n    public void write(String name,\n                      String origin) {\n\n        write(name, origin, true);\n    }\n\n    @Override\n    public void write(String name, String origin, boolean lock) {\n        GitMetadataImpl repositoryMetadata = (GitMetadataImpl) this.read(name).orElse(new GitMetadataImpl(name));\n        this.removeForkFromOrigin(repositoryMetadata);\n        GitMetadataImpl newRepositoryMetadata = new GitMetadataImpl(name,\n                                                                    repositoryMetadata.getForks());\n\n        if (isStorableOrigin(origin)) {\n            newRepositoryMetadata = new GitMetadataImpl(name,\n                                                        origin,\n                                                        repositoryMetadata.getForks());\n\n            GitMetadataImpl originMetadata = (GitMetadataImpl) this.read(origin).orElse(new GitMetadataImpl(origin));\n            List<String> forks = originMetadata.getForks();\n            forks.add(name);\n            this.write(origin,\n                       new GitMetadataImpl(origin,\n                                           originMetadata.getOrigin(),\n                                           forks),\n                       lock);\n        }\n\n        this.write(name,\n                   newRepositoryMetadata,\n                   lock);\n    }\n\n    @Override\n    public void write(String name,\n                      GitMetadata metadata) {\n        write(name, metadata, true);\n    }\n\n    @Override\n    public void write(String name, GitMetadata metadata, boolean lock) {\n        this.storage.write(buildPath(name),\n                           metadata,\n                           lock);\n    }\n\n    @Override\n    public Optional<GitMetadata> read(String name) {\n        try {\n            final GitMetadataImpl metadata = this.storage.read(buildPath(name));\n            return Optional.ofNullable(metadata);\n        } catch (RuntimeException e) {\n            return Optional.empty();\n        }\n    }\n\n    @Override\n    public void delete(String name) {\n        String path = buildPath(name);\n        Optional<GitMetadata> optionalMetadata = this.read(name);\n\n        optionalMetadata.ifPresent(metadata -> {\n            this.removeForkFromOrigin(metadata);\n            this.removeOriginFromForks(metadata);\n            this.storage.delete(path);\n        });\n    }\n\n    private void removeOriginFromForks(final GitMetadata metadata) {\n        List<GitMetadata> forks = this.getForks(metadata);\n        forks.forEach(fork -> {\n            GitMetadata newForkImpl = new GitMetadataImpl(fork.getName(),\n                                                          fork.getForks());\n            this.storage.write(buildPath(fork.getName()),\n                               newForkImpl);\n        });\n    }\n\n    private void removeForkFromOrigin(final GitMetadata metadata) {\n        this.getOrigin(metadata).ifPresent(origin -> {\n            if (origin.getForks().contains(metadata.getName())) {\n                List<String> forks = origin.getForks();\n                forks.remove(metadata.getName());\n                GitMetadataImpl newOrigin = new GitMetadataImpl(origin.getName(),\n                                                                origin.getOrigin(),\n                                                                forks);\n                this.storage.write(buildPath(origin.getName()),\n                                   newOrigin);\n            }\n        });\n    }\n\n    private Optional<GitMetadata> getOrigin(final GitMetadata metadata) {\n        return this.read(metadata.getOrigin());\n    }\n\n    private List<GitMetadata> getForks(final GitMetadata metadata) {\n        return metadata.getForks().stream().map(path -> this.read(path).get()).collect(Collectors.toList());\n    }\n\n    private boolean isStorableOrigin(final String origin) {\n        return origin != null && origin.matches(\"(^\\\\w+\\\\/\\\\w+$)\");\n    }\n\n    private String buildPath(String name) {\n        String path = SEPARATOR + name;\n        if (name.indexOf(SEPARATOR) == 0) {\n            path = name;\n        }\n        if (path.lastIndexOf(SEPARATOR) == path.length() - 1) {\n            path = path.substring(0,\n                                  path.length());\n        }\n        return path + \".metadata\";\n    }\n\n    URI getMetadataFS() {\n        return metadataFS;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/GitPathUtil.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.util.Optional;\nimport java.util.regex.Matcher;\nimport java.util.regex.Pattern;\n\npublic class GitPathUtil {\n\n    private static final Pattern branchNameExtractorFromPath = Pattern.compile(\"^[A-Za-z]+://([^@]+)@.*\");\n    private static final Pattern branchNameExtractorFromRef = Pattern.compile(\"^refs/(?:heads|remotes/[^/]+)/(.*)\");\n\n    public static Optional<String> extractBranch(final String uri) {\n        final Matcher matcher = branchNameExtractorFromPath.matcher(uri);\n        if (matcher.matches()) {\n            return Optional.of(matcher.group(1));\n        } else {\n            return Optional.empty();\n        }\n    }\n\n    public static Optional<String> extractBranchFromRef(final String refName) {\n        final Matcher matcher = branchNameExtractorFromRef.matcher(refName);\n        if (matcher.matches()) {\n            return Optional.of(matcher.group(1));\n        } else {\n            return Optional.empty();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/GitRepositoryBuilder.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\n\nimport javax.enterprise.event.Event;\n\nimport org.eclipse.jgit.transport.ReceiveCommand;\nimport org.eclipse.jgit.transport.UploadPack;\nimport org.guvnor.structure.backend.repositories.BranchAccessAuthorizer;\nimport org.guvnor.structure.backend.repositories.git.hooks.PostCommitNotificationService;\nimport org.guvnor.structure.backend.repositories.git.hooks.exception.BranchOperationNotAllowedException;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryExternalUpdateEvent;\nimport org.guvnor.structure.repositories.RepositoryUtils;\nimport org.guvnor.structure.repositories.impl.DefaultPublicURI;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooksConstants;\nimport org.uberfire.java.nio.fs.jgit.daemon.filters.HiddenBranchRefFilter;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.repositories.EnvironmentParameters.SECURE_PREFIX;\nimport static org.uberfire.backend.server.util.Paths.convert;\n\npublic class GitRepositoryBuilder {\n\n    public static final String PROTOCOL_SEPARATOR = \"://\";\n    private final IOService ioService;\n    private final PasswordService secureService;\n    private SpacesAPI spacesAPI;\n    private Event<RepositoryExternalUpdateEvent> repositoryExternalUpdate;\n    private PostCommitNotificationService postCommitNotificationService;\n    private GitRepository repo;\n    private BranchAccessAuthorizer branchAccessAuthorizer;\n\n    public GitRepositoryBuilder(final IOService ioService,\n                                final PasswordService secureService,\n                                final SpacesAPI spacesAPI,\n                                final Event<RepositoryExternalUpdateEvent> repositoryExternalUpdate,\n                                final PostCommitNotificationService postCommitNotificationService,\n                                final BranchAccessAuthorizer branchAccessAuthorizer) {\n        this.ioService = ioService;\n        this.secureService = secureService;\n        this.spacesAPI = spacesAPI;\n        this.repositoryExternalUpdate = repositoryExternalUpdate;\n        this.postCommitNotificationService = postCommitNotificationService;\n        this.branchAccessAuthorizer = branchAccessAuthorizer;\n    }\n\n    public Repository build(final RepositoryInfo repositoryInfo) {\n\n        String space = repositoryInfo.getSpace();\n        if (space == null || space.isEmpty()) {\n            throw new IllegalStateException(\"Repository \" + repositoryInfo.getName() + \" space is not valid\");\n        }\n        repo = new GitRepository(repositoryInfo.getName(),\n                                 spacesAPI.getSpace(space));\n\n        if (!repo.isValid()) {\n            throw new IllegalStateException(\"Repository \" + repositoryInfo.getName() + \" not valid\");\n        } else {\n\n            addEnvironmentParameters(repositoryInfo.getConfiguration().getEnvironment());\n\n            FileSystem fileSystem = createFileSystem(repo);\n\n            setBranches(fileSystem);\n\n            setPublicURIs(fileSystem);\n\n            RepositoryUtils.cleanUpCredentialsFromEnvMap(repo.getEnvironment());\n\n            return repo;\n        }\n    }\n\n    private void setPublicURIs(final FileSystem fileSystem) {\n        final String[] uris = fileSystem.toString().split(\"\\\\r?\\\\n\");\n        final List<PublicURI> publicURIs = new ArrayList<>(uris.length);\n\n        for (final String s : uris) {\n            final int protocolStart = s.indexOf(PROTOCOL_SEPARATOR);\n            publicURIs.add(getPublicURI(s,\n                                        protocolStart));\n        }\n        repo.setPublicURIs(publicURIs);\n    }\n\n    private PublicURI getPublicURI(final String s,\n                                   final int protocolStart) {\n        if (protocolStart > 0) {\n            return new DefaultPublicURI(s.substring(0,\n                                                    protocolStart),\n                                        s);\n        } else {\n            return new DefaultPublicURI(s);\n        }\n    }\n\n    private void setBranches(final FileSystem fileSystem) {\n        final Map<String, Branch> branches = getBranches(fileSystem);\n\n        repo.setBranches(branches);\n    }\n\n    private void addEnvironmentParameters(final Map<String, Object> items) {\n        for (final Map.Entry<String, Object> item : items.entrySet()) {\n            String key = item.getKey();\n            if (key.startsWith(SECURE_PREFIX)) {\n                repo.addEnvironmentParameter(key.substring(SECURE_PREFIX.length()),\n                                             secureService.decrypt(item.getValue().toString()));\n            } else {\n                repo.addEnvironmentParameter(key,\n                                             item.getValue());\n            }\n        }\n    }\n\n    private FileSystem createFileSystem(final GitRepository repo) {\n        FileSystem fs;\n        URI uri = null;\n        try {\n            uri = URI.create(repo.getUri());\n            fs = newFileSystem(uri);\n        } catch (final FileSystemAlreadyExistsException e) {\n            fs = ioService.getFileSystem(uri);\n            Object replaceIfExists = repo.getEnvironment().get(\"replaceIfExists\");\n            if (replaceIfExists != null && Boolean.valueOf(replaceIfExists.toString())) {\n                org.uberfire.java.nio.file.Path root = fs.getPath(null);\n                ioService.delete(root);\n                fs = newFileSystem(uri);\n            }\n        } catch (final Throwable ex) {\n            throw new RuntimeException(ex);\n        }\n        return fs;\n    }\n\n    private FileSystem newFileSystem(URI uri) {\n        return ioService.newFileSystem(uri,\n                                       new HashMap<String, Object>(repo.getEnvironment()) {{\n                                           if (!repo.getEnvironment().containsKey(\"origin\")) {\n                                               put(\"init\",\n                                                   true);\n                                           }\n                                           put(FileSystemHooks.ExternalUpdate.name(),\n                                               externalUpdatedCallBack());\n                                           put(FileSystemHooks.PostCommit.name(),\n                                               postCommitCallback());\n                                           put(FileSystemHooks.BranchAccessCheck.name(),\n                                               checkBranchAccessCallback());\n                                           put(FileSystemHooks.BranchAccessFilter.name(),\n                                               filterBranchAccessCallback());\n                                       }});\n    }\n\n    private FileSystemHooks.FileSystemHook externalUpdatedCallBack() {\n        return ctx -> repositoryExternalUpdate.fire(new RepositoryExternalUpdateEvent(repo));\n    }\n\n    private FileSystemHooks.FileSystemHook postCommitCallback() {\n        return ctx -> postCommitNotificationService.notifyUser(repo,\n                                                               (Integer) ctx.getParamValue(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE));\n    }\n\n    private FileSystemHooks.FileSystemHook checkBranchAccessCallback() {\n        return ctx -> {\n            final ReceiveCommand command = (ReceiveCommand) ctx.getParamValue(FileSystemHooksConstants.RECEIVE_COMMAND);\n            final User user = (User) ctx.getParamValue(FileSystemHooksConstants.USER);\n            final Optional<String> branchName = GitPathUtil.extractBranchFromRef(command.getRefName());\n\n            branchName.ifPresent(branch -> {\n                if (!branchAccessAuthorizer.authorize(user.getIdentifier(),\n                                                      repo.getSpace().getName(),\n                                                      repo.getIdentifier(),\n                                                      repo.getAlias(),\n                                                      branch,\n                                                      BranchAccessAuthorizer.AccessType.valueOf(command.getType()))) {\n                    throw new BranchOperationNotAllowedException();\n                }\n            });\n        };\n    }\n\n    private FileSystemHooks.FileSystemHook filterBranchAccessCallback() {\n        return ctx -> {\n            final UploadPack uploadPack = (UploadPack) ctx.getParamValue(FileSystemHooksConstants.UPLOAD_PACK);\n            final User user = (User) ctx.getParamValue(FileSystemHooksConstants.USER);\n            uploadPack.setRefFilter(refs -> refs.entrySet()\n                    .stream()\n                    .filter(ref -> !HiddenBranchRefFilter.isHidden(ref.getKey()))\n                    .filter(ref -> {\n                        final Optional<String> branchName = GitPathUtil.extractBranchFromRef(ref.getValue().getName());\n                        if (branchName.isPresent()) {\n                            return branchAccessAuthorizer.authorize(user.getIdentifier(),\n                                                                    repo.getSpace().getName(),\n                                                                    repo.getIdentifier(),\n                                                                    repo.getAlias(),\n                                                                    branchName.get(),\n                                                                    BranchAccessAuthorizer.AccessType.READ);\n                        }\n\n                        return true;\n                    })\n                    .collect(Collectors.toMap(Map.Entry::getKey,\n                                              Map.Entry::getValue)));\n        };\n    }\n\n    /**\n     * collect all branches\n     * @param fs\n     * @return\n     */\n    private Map<String, Branch> getBranches(final FileSystem fs) {\n        final Map<String, Branch> branches = new HashMap<>();\n        for (final org.uberfire.java.nio.file.Path path : fs.getRootDirectories()) {\n            final String branchName = getBranchName(path);\n            branches.put(branchName,\n                         new Branch(branchName,\n                                    convert(path)));\n        }\n        return branches;\n    }\n\n    protected String getBranchName(final org.uberfire.java.nio.file.Path path) {\n        URI uri = path.toUri();\n        return GitPathUtil.extractBranch(uri.toString()).get();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/GitRepositoryFactoryHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.guvnor.structure.backend.repositories.BranchAccessAuthorizer;\nimport org.guvnor.structure.backend.repositories.git.hooks.PostCommitNotificationService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryExternalUpdateEvent;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.guvnor.structure.server.repositories.RepositoryFactoryHelper;\nimport org.uberfire.io.IOService;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.repositories.impl.git.GitRepository.SCHEME;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotEmpty;\nimport static org.kie.soup.commons.validation.Preconditions.checkNotNull;\n\n@ApplicationScoped\npublic class GitRepositoryFactoryHelper implements RepositoryFactoryHelper {\n\n    private IOService indexedIOService;\n\n    private IOService notIndexedIOService;\n\n    private SpacesAPI spacesAPI;\n\n    private Event<RepositoryExternalUpdateEvent> repositoryExternalUpdate;\n\n    private PostCommitNotificationService postCommitNotificationService;\n\n    private BranchAccessAuthorizer branchAccessAuthorizer;\n\n    private PasswordService secureService;\n\n    public GitRepositoryFactoryHelper() {\n    }\n\n    @Inject\n    public GitRepositoryFactoryHelper(@Named(\"ioStrategy\") IOService indexedIOService,\n                                      @Named(\"configIO\") IOService notIndexedIOService,\n                                      SpacesAPI spacesAPI,\n                                      Event<RepositoryExternalUpdateEvent> repositoryExternalUpdate,\n                                      PostCommitNotificationService postCommitNotificationService,\n                                      BranchAccessAuthorizer branchAccessAuthorizer,\n                                      PasswordService secureService) {\n        this.indexedIOService = indexedIOService;\n        this.notIndexedIOService = notIndexedIOService;\n        this.spacesAPI = spacesAPI;\n        this.repositoryExternalUpdate = repositoryExternalUpdate;\n        this.postCommitNotificationService = postCommitNotificationService;\n        this.branchAccessAuthorizer = branchAccessAuthorizer;\n        this.secureService = secureService;\n    }\n\n    @Override\n    public boolean accept(RepositoryInfo repositoryInfo) {\n        checkNotNull(\"repositoryInfo\",\n                     repositoryInfo);\n        final String schemeConfigItem = repositoryInfo.getScheme();\n        checkNotEmpty(\"schemeConfigItem\",\n                      schemeConfigItem);\n        return SCHEME.toString().equals(schemeConfigItem);\n    }\n\n    @Override\n    public Repository newRepository(RepositoryInfo repositoryInfo) {\n        validate(repositoryInfo);\n\n        boolean avoidIndex = repositoryInfo.isAvoidIndex();\n\n        if (avoidIndex) {\n            return new GitRepositoryBuilder(notIndexedIOService,\n                                            secureService,\n                                            spacesAPI,\n                                            repositoryExternalUpdate,\n                                            postCommitNotificationService,\n                                            branchAccessAuthorizer).build(repositoryInfo);\n        }\n\n        return new GitRepositoryBuilder(indexedIOService,\n                                        secureService,\n                                        spacesAPI,\n                                        repositoryExternalUpdate,\n                                        postCommitNotificationService,\n                                        branchAccessAuthorizer).build(repositoryInfo);\n    }\n\n    private void validate(RepositoryInfo repositoryInfo) {\n        checkNotNull(\"repositoryInfo\",\n                     repositoryInfo);\n        final String schemeConfigItem = repositoryInfo.getScheme();\n        checkNotEmpty(\"schemeConfigItem\",\n                      schemeConfigItem);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/hooks/PostCommitNotificationService.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git.hooks;\n\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\n\n/**\n * Triggers the notification for the post-commit git hook\n */\npublic interface PostCommitNotificationService {\n\n    String BUNDLE_PARAM = \"appformer.git.hooks.bundle\";\n\n    /**\n     * Triggers the notification for a given repo & exitCode\n     * @param repo The {@link GitRepository} that triggered the post-commit git hook\n     * @param exitCode The exit code of the post-commit script\n     */\n    void notifyUser(GitRepository repo, Integer exitCode);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/hooks/exception/BranchOperationNotAllowedException.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git.hooks.exception;\n\npublic class BranchOperationNotAllowedException extends RuntimeException {\n\n    public BranchOperationNotAllowedException() {\n        super(\"User does not have permission to modify this branch.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/hooks/impl/MessageReader.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git.hooks.impl;\n\nimport org.apache.commons.io.FilenameUtils;\nimport org.guvnor.structure.backend.LocaleContext;\nimport org.jboss.errai.bus.server.api.RpcContext;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\nimport javax.enterprise.context.Dependent;\nimport java.io.File;\nimport java.net.MalformedURLException;\nimport java.net.URL;\nimport java.net.URLClassLoader;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.util.Locale;\nimport java.util.MissingResourceException;\nimport java.util.Optional;\nimport java.util.ResourceBundle;\nimport java.util.function.Supplier;\n\n@Dependent\npublic class MessageReader {\n\n    private static final Logger LOG = LoggerFactory.getLogger(MessageReader.class);\n\n    private Path bundlePath;\n\n    private String bundleName;\n\n    private Supplier<Locale> localeSupplier;\n\n    public MessageReader() {\n        this(() -> RpcContext.getServletRequest().getLocale());\n    }\n\n    MessageReader(Supplier<Locale> localeSupplier) {\n        this.localeSupplier = localeSupplier;\n    }\n\n    public void init(String bundleParam) {\n\n        if (bundleParam != null) {\n\n            Path fullPath = Paths.get(bundleParam);\n\n            File bundleFile = fullPath.toFile();\n\n            if (bundleFile.exists()) {\n                bundlePath = bundleFile.toPath().getParent();\n\n                bundleName = FilenameUtils.getBaseName(bundleFile.getName());\n            } else {\n                LOG.error(\"Invalid bundle '\" + bundleParam + \"': file doesn't exist\");\n            }\n        }\n    }\n\n    public Optional<String> resolveMessage(int exitCode) {\n        String result = null;\n\n        if (bundlePath != null && bundleName != null) {\n            try {\n\n                // Setting up the bundle classloader based on the path specified on the param\n                URL[] urls = new URL[]{bundlePath.toUri().toURL()};\n\n                ClassLoader bundleClassLoader = new URLClassLoader(urls);\n\n                // Getting the bundle from the current generated classloader\n                ResourceBundle bundle = ResourceBundle.getBundle(bundleName,\n                                                                 getLocale(),\n                                                                 bundleClassLoader);\n\n                result = bundle.getString(String.valueOf(exitCode));\n            } catch (MissingResourceException e) {\n                LOG.info(\"Cannot find key for code '\" + exitCode + \"' bundle '\" + bundlePath.resolve(bundleName).toString() + \"'\");\n            } catch (MalformedURLException e) {\n                LOG.warn(\"Cannot load bundle '\" + bundlePath.resolve(bundleName).toString() + \"': \", e);\n            }\n        }\n\n        return Optional.ofNullable(result);\n    }\n    \n    private Locale getLocale() {\n        try {\n            return localeSupplier.get();\n        } catch (Exception e) {\n            LOG.warn(\"Locale info not available in RpcContext.\");\n            return LocaleContext.get();\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/java/org/guvnor/structure/backend/repositories/git/hooks/impl/PostCommitNotificationServiceImpl.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git.hooks.impl;\n\nimport org.guvnor.structure.backend.repositories.git.hooks.PostCommitNotificationService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.guvnor.structure.repositories.impl.git.event.NotificationType;\nimport org.guvnor.structure.repositories.impl.git.event.PostCommitNotificationEvent;\nimport org.uberfire.commons.services.cdi.Startup;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport java.util.Optional;\n\n@ApplicationScoped\n@Startup\npublic class PostCommitNotificationServiceImpl implements PostCommitNotificationService {\n\n    private SessionInfo sessionInfo;\n\n    private Event<PostCommitNotificationEvent> notificationEvent;\n\n    private MessageReader reader;\n\n    PostCommitNotificationServiceImpl() {\n        // CDI Proxy\n    }\n\n    @Inject\n    public PostCommitNotificationServiceImpl(SessionInfo sessionInfo, Event<PostCommitNotificationEvent> notificationEvent, MessageReader reader) {\n        this.sessionInfo = sessionInfo;\n        this.notificationEvent = notificationEvent;\n        this.reader = reader;\n    }\n\n    @PostConstruct\n    public void init() {\n        reader.init(System.getProperty(BUNDLE_PARAM));\n    }\n\n    @Override\n    public void notifyUser(GitRepository repo, Integer exitCode) {\n        if (sessionInfo != null && !SpacesAPI.DEFAULT_SPACE.equals(repo.getSpace())) {\n            Optional<String> optional = reader.resolveMessage(exitCode);\n\n            if (optional.isPresent()) {\n                notificationEvent.fire(new PostCommitNotificationEvent(NotificationType.fromExitCode(exitCode), optional.get()));\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/resources/DependencyTypesMapper.json",
    "content": "{\n  \"dependencies\":[\n    {\n      \"type\":\"JPA\",\n      \"deps\":[\n            {\"groupId\":\"javax.persistence\", \"artifactId\":\"javax.persistence-api\", \"version\":\"2.2\", \"scope\":\"\"}\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/main/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/FileSystemDeleteWorkerTest.java",
    "content": "package org.guvnor.structure.backend;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageImpl;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.spaces.Space;\n\nimport static org.mockito.Mockito.RETURNS_DEEP_STUBS;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FileSystemDeleteWorkerTest {\n\n    private FileSystemDeleteWorker worker;\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private OrganizationalUnitService ouService;\n\n    @Mock\n    private RepositoryService repoService;\n\n    @Mock\n    private FileSystem systemFs;\n\n    @Mock\n    private SpaceConfigStorageRegistry registry;\n\n    @Mock\n    private Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent;\n\n    @Mock\n    private ConfigurationService configurationService;\n\n    @Before\n    public void setUp() throws IOException {\n\n        this.worker = spy(new FileSystemDeleteWorker(this.ioService,\n                                                     this.ouService,\n                                                     this.repoService,\n                                                     this.systemFs,\n                                                     this.registry,\n                                                     this.removeOrganizationalUnitEvent,\n                                                     this.configurationService));\n\n        doAnswer(invocation -> null).when(worker).removeRepository(any());\n        doAnswer(invocation -> null).when(worker).delete(any());\n        doAnswer(invocation -> null).when(removeOrganizationalUnitEvent).fire(any());\n    }\n\n    @Test\n    public void testRemoveSpaceDirectory() throws IOException {\n\n        JGitPathImpl configPath = mock(JGitPathImpl.class,\n                                       RETURNS_DEEP_STUBS);\n\n        Space space = mock(Space.class);\n\n        Path deletePath = mock(Path.class,\n                               RETURNS_DEEP_STUBS);\n\n        when(configPath.getFileSystem().getPath(anyString())).thenReturn(deletePath);\n\n        SpaceConfigStorageImpl configStorage = mock(SpaceConfigStorageImpl.class);\n        when(configStorage.getPath()).thenReturn(configPath);\n\n        when(registry.get(any())).thenReturn(configStorage);\n\n        doReturn(Collections.singletonList(mock(Repository.class)))\n                .when(this.repoService)\n                .getAllRepositories(eq(space),\n                                    eq(true));\n\n        File spacePathFile = mock(File.class);\n        doReturn(spacePathFile).when(worker).getSpacePath(any());\n\n        this.worker.removeSpaceDirectory(space);\n\n        verify(this.worker,\n               times(1)).removeRepository(any());\n\n        verify(ioService).deleteIfExists(deletePath);\n        verify(this.worker).delete(spacePathFile);\n    }\n\n    @Test\n    public void testRemoveAllDeletedSpaces() {\n\n        doAnswer(invocation -> null).when(worker).removeSpaceDirectory(any());\n\n        OrganizationalUnit ou1 = mock(OrganizationalUnit.class);\n        doReturn(mock(Space.class)).when(ou1).getSpace();\n        OrganizationalUnit ou2 = mock(OrganizationalUnit.class);\n        doReturn(mock(Space.class)).when(ou2).getSpace();\n\n        List<OrganizationalUnit> orgUnits = Arrays.asList(ou1,\n                                                          ou2);\n        doReturn(orgUnits).when(this.ouService).getAllDeletedOrganizationalUnit();\n\n        this.worker.removeAllDeletedSpaces();\n\n        verify(this.worker,\n               times(1)).removeSpaceDirectory(ou1.getSpace());\n        verify(this.worker,\n               times(1)).removeSpaceDirectory(ou2.getSpace());\n        verify(this.removeOrganizationalUnitEvent,\n               times(1)).fire(any());\n    }\n\n    @Test\n    public void testRemoveZeroDeletedSpaces() {\n\n        doReturn(new ArrayList<>()).when(this.ouService).getAllDeletedOrganizationalUnit();\n        this.worker.removeAllDeletedSpaces();\n        verify(this.worker,\n               never()).removeSpaceDirectory(any());\n        verify(this.removeOrganizationalUnitEvent,\n               never()).fire(any());\n    }\n\n    @Test\n    public void testRemoveAllDeletedRepository() {\n\n        Repository repo1 = mock(Repository.class);\n        Repository repo2 = mock(Repository.class);\n        Repository repo3 = mock(Repository.class);\n        Repository repo4 = mock(Repository.class);\n\n        Space space1 = mock(Space.class);\n        Space space2 = mock(Space.class);\n        OrganizationalUnit ou1 = mock(OrganizationalUnit.class);\n        OrganizationalUnit ou2 = mock(OrganizationalUnit.class);\n\n        doReturn(space1).when(ou1).getSpace();\n        doReturn(space2).when(ou2).getSpace();\n\n        doReturn(Arrays.asList(ou1,\n                               ou2)).when(this.ouService).getAllOrganizationalUnits(eq(false), any());\n\n        doReturn(Arrays.asList(repo1,\n                               repo2)).when(this.repoService).getAllDeletedRepositories(eq(space1));\n\n        doReturn(Arrays.asList(repo3,\n                               repo4)).when(this.repoService).getAllDeletedRepositories(eq(space2));\n\n        Branch branch = mock(Branch.class);\n        Repository repo = mock(Repository.class);\n\n        this.worker.removeAllDeletedRepositories();\n\n        verify(worker,\n               times(1)).removeRepository(repo1);\n        verify(worker,\n               times(1)).removeRepository(repo2);\n        verify(worker,\n               times(1)).removeRepository(repo3);\n        verify(worker,\n               times(1)).removeRepository(repo4);\n    }\n\n    @Test\n    public void testMonitoringEnabled(){\n       when(worker.isDeleteWorkerEnabled()).thenReturn(false);\n        worker.doRemove();\n        verify(worker, never()).removeAllDeletedSpaces();\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/InputEscapeUtilsTest.java",
    "content": "package org.guvnor.structure.backend;\n\nimport org.apache.commons.text.StringEscapeUtils;\nimport org.assertj.core.api.Assertions;\nimport org.junit.Test;\n\nimport static org.guvnor.structure.backend.InputEscapeUtils.escapeHtmlInput;\n\npublic class InputEscapeUtilsTest {\n\n    @Test\n    public void testEscapeHtmlInput() {\n        final String xssString = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        final String expectedResult = StringEscapeUtils.escapeHtml4(xssString).replace(\"'\", \"\");\n        final String result = escapeHtmlInput(xssString);\n        Assertions.assertThat(result).isEqualTo(expectedResult);\n    }\n\n    @Test\n    public void testEscapeHtmlInputWithSingleQoutes() {\n        final String xssString = \"<img/src/onerror=alert('XSS')>\";\n        final String expectedResult = StringEscapeUtils.escapeHtml4(xssString).replace(\"'\", \"\");\n        final String result = escapeHtmlInput(xssString);\n        Assertions.assertThat(result).isEqualTo(expectedResult);\n    }\n\n    @Test\n    public void testEscapeHtmlInputNull() {\n        final String xssString = null;\n        final String result = escapeHtmlInput(xssString);\n        Assertions.assertThat(result).isNull();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/backcompat/BackwardCompatibleUtilTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.backend.backcompat;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.guvnor.structure.backend.config.ConfigurationFactoryImpl;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class BackwardCompatibleUtilTest {\n\n    @Test\n    public void backwardCompatibilityNullTest() {\n        final ConfigurationFactory factory = new ConfigurationFactoryImpl();\n        final BackwardCompatibleUtil backwardUtil = new BackwardCompatibleUtil(factory);\n\n        assertNull(backwardUtil.compat(null));\n    }\n\n    @Test\n    public void backwardCompatibilityNullSecurityRolesTest() {\n        final ConfigurationFactory factory = new ConfigurationFactoryImpl();\n        final BackwardCompatibleUtil backwardUtil = new BackwardCompatibleUtil(factory);\n\n        final ConfigGroup group = factory.newConfigGroup(ConfigType.PROJECT,\n                                                         \"cool\",\n                                                         \"test\");\n        assertNotNull(backwardUtil.compat(group));\n        assertNotNull(backwardUtil.compat(group).getConfigItem(\"security:groups\"));\n    }\n\n    @Test\n    public void backwardCompatibilityExistingSecurityRolesTest() {\n        final ConfigurationFactory factory = new ConfigurationFactoryImpl();\n        final BackwardCompatibleUtil backwardUtil = new BackwardCompatibleUtil(factory);\n\n        final ConfigGroup group = factory.newConfigGroup(ConfigType.PROJECT,\n                                                         \"cool2\",\n                                                         \"test2\");\n\n        group.addConfigItem(factory.newConfigItem(\"security:roles\",\n                                                  new ArrayList() {{\n                                                      add(\"group1\");\n                                                  }}));\n        assertNotNull(backwardUtil.compat(group).getConfigItem(\"security:groups\"));\n        assertEquals(1,\n                     ((List<String>) (backwardUtil.compat(group).getConfigItem(\"security:groups\")).getValue()).size());\n        assertNull(backwardUtil.compat(group).getConfigItem(\"security:roles\"));\n    }\n\n    @Test\n    public void backwardCompatibilityEmptySecurityRolesTest() {\n        final ConfigurationFactory factory = new ConfigurationFactoryImpl();\n        final BackwardCompatibleUtil backwardUtil = new BackwardCompatibleUtil(factory);\n\n        final ConfigGroup group = factory.newConfigGroup(ConfigType.PROJECT,\n                                                         \"cool3\",\n                                                         \"test3\");\n\n        group.addConfigItem(factory.newConfigItem(\"security:roles\",\n                                                  new ArrayList()));\n        assertNotNull(backwardUtil.compat(group).getConfigItem(\"security:groups\"));\n        assertEquals(0,\n                     ((List<String>) (backwardUtil.compat(group).getConfigItem(\"security:groups\")).getValue()).size());\n        assertNull(backwardUtil.compat(group).getConfigItem(\"security:roles\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/config/ConfigurationFactoryImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.config;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigItem;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.guvnor.structure.server.config.SecureConfigItem;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConfigurationFactoryImplTest {\n\n    private PasswordService passwordService;\n\n    private ConfigurationFactory configurationFactory;\n\n    @Before\n    public void setup() {\n        passwordService = new DefaultPasswordServiceImpl();\n        configurationFactory = new ConfigurationFactoryImpl(passwordService);\n    }\n\n    @Test\n    public void newConfigGroupWithoutNamespaceTest() {\n        final ConfigGroup configGroup = configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                            \"my-config\",\n                                                                            \"my-description\");\n\n        assertEquals(ConfigType.GLOBAL,\n                     configGroup.getType());\n        assertEquals(\"my-config\",\n                     configGroup.getName());\n        assertEquals(\"my-description\",\n                     configGroup.getDescription());\n        assertTrue(configGroup.isEnabled());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void newConfigGroupWithoutNamespaceButTypeRequiresNamespaceTest() {\n        configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                            \"my-config\",\n                                            \"my-description\");\n    }\n\n    @Test\n    public void newConfigGroupWithNamespaceTest() {\n        final ConfigGroup configGroup = configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                            \"my-namespace\",\n                                                                            \"my-config\",\n                                                                            \"my-description\");\n\n        assertEquals(ConfigType.REPOSITORY,\n                     configGroup.getType());\n        assertEquals(\"my-namespace\",\n                     configGroup.getNamespace());\n        assertEquals(\"my-config\",\n                     configGroup.getName());\n        assertEquals(\"my-description\",\n                     configGroup.getDescription());\n        assertTrue(configGroup.isEnabled());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void newConfigGroupWithNamespaceButTypeDoesNotSupportNamespacesTest() {\n        configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                            \"my-namespace\",\n                                            \"my-config\",\n                                            \"my-description\");\n    }\n\n    @Test\n    public void newStringConfigItemTest() {\n        final ConfigItem<String> stringConfigItem = configurationFactory.newConfigItem(\"my-item\",\n                                                                                       \"my-value\");\n\n        assertEquals(\"my-item\",\n                     stringConfigItem.getName());\n        assertEquals(\"my-value\",\n                     stringConfigItem.getValue());\n    }\n\n    @Test\n    public void newBooleanConfigItemTest() {\n        final ConfigItem<Boolean> booleanConfigItem = configurationFactory.newConfigItem(\"my-item\",\n                                                                                         true);\n\n        assertEquals(\"my-item\",\n                     booleanConfigItem.getName());\n        assertTrue(booleanConfigItem.getValue());\n    }\n\n    @Test\n    public void newSecuredConfigItemTest() {\n        final SecureConfigItem securedConfigItem = configurationFactory.newSecuredConfigItem(\"my-item\",\n                                                                                             \"my-password\");\n\n        assertEquals(\"my-item\",\n                     securedConfigItem.getName());\n        assertEquals(\"my-password\",\n                     passwordService.decrypt(securedConfigItem.getValue()));\n    }\n\n    @Test\n    public void newListConfigItemTest() {\n        final List<String> values = new ArrayList<>();\n        values.add(\"value1\");\n        values.add(\"value2\");\n\n        final ConfigItem<List> listConfigItem = configurationFactory.newConfigItem(\"my-item\",\n                                                                                   values);\n\n        assertEquals(\"my-item\",\n                     listConfigItem.getName());\n        assertEquals(2,\n                     listConfigItem.getValue().size());\n        assertEquals(\"value1\",\n                     listConfigItem.getValue().get(0));\n        assertEquals(\"value2\",\n                     listConfigItem.getValue().get(1));\n    }\n\n    @Test\n    public void newLongConfigItemTest() {\n        final ConfigItem<Object> longConfigItem = configurationFactory.newConfigItem(\"my-item\",\n                                                                                     2L);\n\n        assertEquals(\"my-item\",\n                     longConfigItem.getName());\n        assertEquals(2L,\n                     longConfigItem.getValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/config/ConfigurationServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.config;\n\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.List;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigType;\nimport org.guvnor.structure.server.config.ConfigurationFactory;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.mocks.FileSystemTestingUtils;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConfigurationServiceImplTest {\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    @Mock\n    private org.guvnor.structure.repositories.Repository systemRepository;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private Event<SystemRepositoryChangedEvent> repoChangedEvent;\n\n    @Mock\n    private Event<SystemRepositoryChangedEvent> spaceChangedEvent;\n\n    @Mock\n    private Event<SystemRepositoryChangedEvent> changedEvent;\n\n    private ConfigGroupMarshaller marshaller;\n\n    private IOService ioService;\n\n    private ConfigurationFactory configurationFactory;\n\n    private ConfigurationService configurationService;\n\n    @Before\n    public void setup() throws IOException {\n        fileSystemTestingUtils.setup();\n        when(systemRepository.getUri()).thenReturn(\"git://amend-repo-test\");\n\n        marshaller = new ConfigGroupMarshaller();\n        configurationFactory = new ConfigurationFactoryImpl(new DefaultPasswordServiceImpl());\n        ioService = mockIoService();\n        configurationService = new ConfigurationServiceImpl(systemRepository,\n                                                            marshaller,\n                                                            identity,\n                                                            ioService,\n                                                            repoChangedEvent,\n                                                            spaceChangedEvent,\n                                                            changedEvent,\n                                                            fileSystemTestingUtils.getFileSystem());\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void addAndGetConfigurationWithoutNamespaceTest() {\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                                  \"global1\",\n                                                                                  \"global1-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.SPACE,\n                                                                                  \"space1\",\n                                                                                  \"space1-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                                  \"global2\",\n                                                                                  \"global2-description\"));\n\n        final List<ConfigGroup> globalConfigGroups = configurationService.getConfiguration(ConfigType.GLOBAL);\n        assertEquals(2,\n                     globalConfigGroups.size());\n        assertEquals(\"global1\",\n                     globalConfigGroups.get(0).getName());\n        assertEquals(\"global2\",\n                     globalConfigGroups.get(1).getName());\n\n        final List<ConfigGroup> spaceConfigGroups = configurationService.getConfiguration(ConfigType.SPACE);\n        assertEquals(1,\n                     spaceConfigGroups.size());\n        assertEquals(\"space1\",\n                     spaceConfigGroups.get(0).getName());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void addAndGetConfigurationWithoutNamespaceButTypeRequiresNamespaceTest() {\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace1\",\n                                                                                  \"global1\",\n                                                                                  \"global1-description\"));\n\n        configurationService.getConfiguration(ConfigType.REPOSITORY);\n    }\n\n    @Test\n    public void addAndGetConfigurationWithNamespaceTest() {\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace1\",\n                                                                                  \"repo1\",\n                                                                                  \"repo1-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace1\",\n                                                                                  \"repo2\",\n                                                                                  \"repo2-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                                  \"global1\",\n                                                                                  \"global1-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace2\",\n                                                                                  \"repo3\",\n                                                                                  \"repo3-description\"));\n\n        final List<ConfigGroup> repositoryNamespace1ConfigGroups = configurationService.getConfiguration(ConfigType.REPOSITORY,\n                                                                                                         \"namespace1\");\n        assertEquals(2,\n                     repositoryNamespace1ConfigGroups.size());\n        assertEquals(\"repo1\",\n                     repositoryNamespace1ConfigGroups.get(0).getName());\n        assertEquals(\"repo2\",\n                     repositoryNamespace1ConfigGroups.get(1).getName());\n\n        final List<ConfigGroup> repositoryNamespace2ConfigGroups = configurationService.getConfiguration(ConfigType.REPOSITORY,\n                                                                                                         \"namespace2\");\n        assertEquals(1,\n                     repositoryNamespace2ConfigGroups.size());\n        assertEquals(\"repo3\",\n                     repositoryNamespace2ConfigGroups.get(0).getName());\n\n        final List<ConfigGroup> globalConfigGroups = configurationService.getConfiguration(ConfigType.GLOBAL);\n        assertEquals(1,\n                     globalConfigGroups.size());\n        assertEquals(\"global1\",\n                     globalConfigGroups.get(0).getName());\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void addAndGetConfigurationWithNamespaceButTypeDoesNotSupportNamespacesTest() {\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                                  \"global1\",\n                                                                                  \"global1-description\"));\n\n        configurationService.getConfiguration(ConfigType.GLOBAL,\n                                              \"namespace1\");\n    }\n\n    @Test\n    public void addAndGetConfigurationByNamespaceTest() {\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace1\",\n                                                                                  \"repo1\",\n                                                                                  \"repo1-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace1\",\n                                                                                  \"repo2\",\n                                                                                  \"repo2-description\"));\n        configurationService.addConfiguration(configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                                  \"namespace2\",\n                                                                                  \"repo3\",\n                                                                                  \"repo3-description\"));\n\n        final Map<String, List<ConfigGroup>> configGroupsByNamespace = configurationService.getConfigurationByNamespace(ConfigType.REPOSITORY);\n        assertEquals(2,\n                     configGroupsByNamespace.size());\n\n        final List<ConfigGroup> repositoryNamespace1ConfigGroups = configGroupsByNamespace.get(\"namespace1\");\n        assertEquals(2,\n                     repositoryNamespace1ConfigGroups.size());\n        assertEquals(\"repo1\",\n                     repositoryNamespace1ConfigGroups.get(0).getName());\n        assertEquals(\"repo2\",\n                     repositoryNamespace1ConfigGroups.get(1).getName());\n\n        final List<ConfigGroup> repositoryNamespace2ConfigGroups =  configGroupsByNamespace.get(\"namespace2\");\n        assertEquals(1,\n                     repositoryNamespace2ConfigGroups.size());\n        assertEquals(\"repo3\",\n                     repositoryNamespace2ConfigGroups.get(0).getName());\n    }\n\n    @Test\n    public void updateConfigurationWithoutNamespaceTest() {\n        final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                       \"config\",\n                                                                       \"description\");\n        configurationService.addConfiguration(config);\n        config.setDescription(\"new-description\");\n\n        configurationService.updateConfiguration(config);\n\n        final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.GLOBAL);\n        assertEquals(1,\n                     configGroups.size());\n        assertEquals(\"config\",\n                     configGroups.get(0).getName());\n        assertEquals(\"new-description\",\n                     configGroups.get(0).getDescription());\n    }\n\n    @Test\n    public void updateConfigurationWithNamespaceTest() {\n        final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                       \"namespace\",\n                                                                       \"config\",\n                                                                       \"description\");\n        configurationService.addConfiguration(config);\n        config.setDescription(\"new-description\");\n\n        configurationService.updateConfiguration(config);\n\n        final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.REPOSITORY,\n                                                                                     \"namespace\");\n        assertEquals(1,\n                     configGroups.size());\n        assertEquals(\"config\",\n                     configGroups.get(0).getName());\n        assertEquals(\"namespace\",\n                     configGroups.get(0).getNamespace());\n        assertEquals(\"new-description\",\n                     configGroups.get(0).getDescription());\n    }\n\n    @Test\n    public void removeConfigurationWithoutNamespaceTest() {\n        final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.GLOBAL,\n                                                                       \"config\",\n                                                                       \"description\");\n\n        configurationService.removeConfiguration(config);\n\n        final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.GLOBAL);\n        assertEquals(0,\n                     configGroups.size());\n    }\n\n    @Test\n    public void removeConfigurationWithNamespaceTest() {\n        final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                       \"namespace\",\n                                                                       \"config\",\n                                                                       \"description\");\n        configurationService.addConfiguration(config);\n\n        configurationService.removeConfiguration(config);\n\n        final List<ConfigGroup> configGroups = configurationService.getConfiguration(ConfigType.REPOSITORY,\n                                                                                     \"namespace\");\n        assertEquals(0,\n                     configGroups.size());\n    }\n\n    @Test\n    public void cleanUpSystemRepositoryTest() {\n        final ConfigGroup config = configurationFactory.newConfigGroup(ConfigType.REPOSITORY,\n                                                                       \"namespace\",\n                                                                       \"config\",\n                                                                       \"description\");\n        configurationService.addConfiguration(config);\n\n        final boolean result = configurationService.cleanUpSystemRepository();\n\n        assertTrue(result);\n    }\n\n    private IOService mockIoService() {\n        final IOService ioService = spy(fileSystemTestingUtils.getIoService());\n\n        doNothing().when(ioService).startBatch(any(FileSystem.class));\n        doNothing().when(ioService).endBatch();\n\n        return ioService;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitFactoryImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class OrganizationalUnitFactoryImplTest {\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private SpacesAPI spacesAPI;\n\n    @Mock\n    private PasswordService secureService;\n\n    private OrganizationalUnitFactoryImpl factory;\n\n    @Before\n    public void setup() {\n        doAnswer(invocationOnMock -> {\n            final Repository repository = mock(Repository.class);\n            doReturn(invocationOnMock.getArgument(1, String.class)).when(repository).getAlias();\n            return repository;\n        }).when(repositoryService).getRepositoryFromSpace(any(), any());\n\n        factory = spy(new OrganizationalUnitFactoryImpl(repositoryService,\n                                                        spacesAPI));\n    }\n\n    @Test\n    public void newOrganizationalUnitTest() {\n        final List<Contributor> contributors = Arrays.asList(new Contributor(\"c1\", ContributorType.OWNER),\n                                                             new Contributor(\"c2\", ContributorType.ADMIN));\n        final SpaceInfo spaceInfo = new SpaceInfo(\"ou\",\n                                                  \"test space\",\n                                                  \"groupId\",\n                                                  contributors,\n                                                  Collections.singletonList(new RepositoryInfo(\"repo1\",false,new RepositoryConfiguration())),\n                                                  Collections.singletonList(\"group1\"));\n\n        final OrganizationalUnit organizationalUnit = factory.newOrganizationalUnit(spaceInfo);\n\n        assertEquals(\"ou\", organizationalUnit.getName());\n        assertEquals(\"groupId\", organizationalUnit.getDefaultGroupId());\n        assertEquals(\"test space\", organizationalUnit.getDescription());\n\n        assertEquals(1, organizationalUnit.getRepositories().size());\n        assertEquals(\"repo1\", ((List<Repository>) organizationalUnit.getRepositories()).get(0).getAlias());\n\n        assertEquals(1, organizationalUnit.getGroups().size());\n        assertEquals(\"group1\", ((List<String>) organizationalUnit.getGroups()).get(0));\n\n        assertEquals(2, organizationalUnit.getContributors().size());\n        assertEquals(\"c1\", ((List<Contributor>) organizationalUnit.getContributors()).get(0).getUsername());\n        assertEquals(ContributorType.OWNER, ((List<Contributor>) organizationalUnit.getContributors()).get(0).getType());\n        assertEquals(\"c2\", ((List<Contributor>) organizationalUnit.getContributors()).get(1).getUsername());\n        assertEquals(ContributorType.ADMIN, ((List<Contributor>) organizationalUnit.getContributors()).get(1).getType());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitSearchServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class OrganizationalUnitSearchServiceTest {\n\n    @Mock\n    OrganizationalUnitService resourceService;\n\n    @Mock\n    OrganizationalUnit itemA;\n\n    @Mock\n    OrganizationalUnit itemB;\n\n    private OrganizationalUnitSearchServiceImpl searchService;\n\n    @Before\n    public void setUp() throws Exception {\n        when(itemA.getIdentifier()).thenReturn(\"itemA\");\n        when(itemB.getIdentifier()).thenReturn(\"itemB\");\n        when(itemA.getName()).thenReturn(\"Item A\");\n        when(itemB.getName()).thenReturn(\"Item B\");\n        when(resourceService.getAllOrganizationalUnits()).thenReturn(Arrays.asList(itemA,\n                                                                                   itemB));\n        searchService = new OrganizationalUnitSearchServiceImpl(resourceService);\n    }\n\n    @Test\n    public void testSearchById() throws Exception {\n        Collection<OrganizationalUnit> result = searchService.searchById(Arrays.asList(\"itemA\"));\n        assertEquals(result.size(),\n                     1);\n        assertEquals(result.iterator().next().getName(),\n                     \"Item A\");\n    }\n\n    @Test\n    public void testSearchByAlias() throws Exception {\n        Collection<OrganizationalUnit> result = searchService.searchByName(\"Item\",\n                                                                           10,\n                                                                           true);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchCaseSensitiveEmpty() throws Exception {\n        Collection<OrganizationalUnit> result = searchService.searchByName(\"item\",\n                                                                           10,\n                                                                           true);\n        assertEquals(result.size(),\n                     0);\n    }\n\n    @Test\n    public void testSearchCaseUnsensitive() throws Exception {\n        Collection<OrganizationalUnit> result = searchService.searchByName(\"item\",\n                                                                           10,\n                                                                           false);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchMaxItems() throws Exception {\n        Collection<OrganizationalUnit> result = searchService.searchByName(\"item\",\n                                                                           1,\n                                                                           false);\n        assertEquals(result.size(),\n                     1);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/OrganizationalUnitServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\n\nimport org.assertj.core.api.Assertions;\nimport org.assertj.core.api.Condition;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.contributors.SpaceContributorsUpdatedEvent;\nimport org.guvnor.structure.organizationalunit.NewOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.RepoAddedToOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.RepoRemovedFromOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.UpdatedOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.server.config.ConfigGroup;\nimport org.guvnor.structure.server.config.ConfigurationService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.mocks.SessionInfoMock;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.backend.InputEscapeUtils.escapeHtmlInput;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.same;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class OrganizationalUnitServiceTest {\n\n    private static final String SPACE_NAME = \"space\";\n    private static final String SPACE_DESCRIPTION = \"This is test space\";\n    private static final String DEFAULT_GROUP_ID = \"default.group.id\";\n\n    private static final String REPO_A = \"repoA\";\n    private static final String REPO_B = \"repoB\";\n\n    private static final String ROLES = \"security:roles\";\n    private static final String ADMIN = \"admin\";\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private SpacesAPI spacesAPI;\n\n    @Mock\n    private ConfigurationService configurationService;\n\n    private OrganizationalUnitFactoryImpl organizationalUnitFactory;\n\n    @Mock\n    private Event<NewOrganizationalUnitEvent> newOrganizationalUnitEvent;\n\n    @Mock\n    private Event<RemoveOrganizationalUnitEvent> removeOrganizationalUnitEvent;\n\n    @Mock\n    private Event<RepoAddedToOrganizationalUnitEvent> repoAddedToOrgUnitEvent;\n\n    @Mock\n    private Event<RepoRemovedFromOrganizationalUnitEvent> repoRemovedFromOrgUnitEvent;\n\n    @Mock\n    private Event<UpdatedOrganizationalUnitEvent> updatedOrganizationalUnitEvent;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private RepositoryService repoService;\n\n    @Mock\n    private OrganizationalUnit orgUnit;\n\n    @Mock\n    private IOService ioService;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    private SpaceConfigStorage spaceConfigStorage;\n\n    private SpaceInfo spaceInfo;\n\n    @Mock\n    private FileSystem systemFS;\n\n    @Mock\n    private Event<SpaceContributorsUpdatedEvent> spaceContributorsUpdatedEvent;\n\n    @Captor\n    private ArgumentCaptor<List<Contributor>> contributorsCapture;\n\n    private OrganizationalUnitServiceImpl organizationalUnitService;\n\n    @Before\n    public void setUp() throws Exception {\n\n        spaceInfo = new SpaceInfo(SPACE_NAME,\n                                  SPACE_DESCRIPTION,\n                                  DEFAULT_GROUP_ID,\n                                  new ArrayList<>(),\n                                  new ArrayList<>(),\n                                  new ArrayList<>());\n\n        when(spaceConfigStorage.loadSpaceInfo()).thenReturn(spaceInfo);\n        when(spaceConfigStorage.isInitialized()).thenReturn(true);\n\n        when(spaceConfigStorageRegistry.get(anyString())).thenReturn(spaceConfigStorage);\n        when(spaceConfigStorageRegistry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n        when(spaceConfigStorageRegistry.exist(anyString())).thenReturn(true);\n\n        sessionInfo = new SessionInfoMock();\n\n        organizationalUnitFactory = spy(new OrganizationalUnitFactoryImpl(repositoryService,\n                                                                          spacesAPI));\n        organizationalUnitService = spy(new OrganizationalUnitServiceImpl(organizationalUnitFactory,\n                                                                          repoService,\n                                                                          newOrganizationalUnitEvent,\n                                                                          removeOrganizationalUnitEvent,\n                                                                          repoAddedToOrgUnitEvent,\n                                                                          repoRemovedFromOrgUnitEvent,\n                                                                          updatedOrganizationalUnitEvent,\n                                                                          authorizationManager,\n                                                                          spacesAPI,\n                                                                          sessionInfo,\n                                                                          ioService,\n                                                                          spaceConfigStorageRegistry,\n                                                                          systemFS,\n                                                                          spaceContributorsUpdatedEvent,\n                                                                          configurationService));\n\n        when(authorizationManager.authorize(any(Resource.class),\n                                            any(User.class))).thenReturn(false);\n\n        doAnswer(invocation -> false).when(organizationalUnitService).isDeleted(any());\n\n        doReturn(Paths.get(\"src/test/resources/niogit\").toFile().toPath()).when(organizationalUnitService).getNiogitPath();\n    }\n\n    @Test\n    public void testAllOrgUnits() {\n        Collection<OrganizationalUnit> orgUnits = organizationalUnitService.getAllOrganizationalUnits();\n        assertEquals(2,\n                     orgUnits.size());\n    }\n\n    @Test\n    public void testSecuredOrgUnits() {\n        Collection<OrganizationalUnit> orgUnits = organizationalUnitService.getOrganizationalUnits();\n        assertEquals(0,\n                     orgUnits.size());\n    }\n\n    @Test\n    public void testSecuredOrgUnitsWithPermission() {\n        when(authorizationManager.authorize(any(Resource.class),\n                                            any(User.class))).thenReturn(true);\n        Collection<OrganizationalUnit> orgUnits = organizationalUnitService.getOrganizationalUnits();\n        assertEquals(2,\n                     orgUnits.size());\n    }\n\n    @Test\n    public void testSecuredOrgUnitsToCollaborators() {\n        when(orgUnit.getContributors()).thenReturn(Collections.singletonList(new Contributor(ADMIN, ContributorType.OWNER)));\n        doReturn(Collections.singletonList(orgUnit)).when(organizationalUnitService).getAllOrganizationalUnits(anyBoolean());\n\n        Collection<OrganizationalUnit> orgUnits = organizationalUnitService.getOrganizationalUnits();\n        assertEquals(1,\n                     orgUnits.size());\n    }\n\n    @Test\n    public void createOrganizationalUnitWithDuplicatedNameTest() {\n        setOUCreationPermission(true);\n\n        doReturn(true)\n                .when(organizationalUnitService)\n                .spaceDirectoryExists(anyString());\n\n        final OrganizationalUnit ou = organizationalUnitService.createOrganizationalUnit(SPACE_NAME,\n                                                                                         DEFAULT_GROUP_ID);\n\n        assertNull(ou);\n\n        verify(organizationalUnitFactory,\n               never()).newOrganizationalUnit(any());\n    }\n\n    @Test\n    public void createValidOrganizationalUnitTest() {\n        List<Contributor> contributors = new ArrayList<>();\n        contributors.add(new Contributor(ADMIN,\n                                         ContributorType.ADMIN));\n\n        setOUCreationPermission(true);\n\n        final OrganizationalUnit ou = organizationalUnitService.createOrganizationalUnit(SPACE_NAME,\n                                                                                         DEFAULT_GROUP_ID,\n                                                                                         new ArrayList<>(),\n                                                                                         contributors,\n                                                                                         SPACE_DESCRIPTION);\n\n        assertNotNull(ou);\n        verify(organizationalUnitFactory).newOrganizationalUnit(any());\n        assertEquals(SPACE_NAME, ou.getName());\n        assertEquals(SPACE_DESCRIPTION, ou.getDescription());\n        assertEquals(DEFAULT_GROUP_ID, ou.getDefaultGroupId());\n        assertEquals(contributors, ou.getContributors());\n        Assertions.assertThat(ou.getContributors()).hasSize(1);\n        Assertions.assertThat(ou.getContributors()).hasOnlyOneElementSatisfying((contributor) -> {\n            contributor.getUsername().equals(escapeHtmlInput(ADMIN));\n        });\n    }\n\n    @Test\n    public void createOrganizationalUnitWithPersistentXssInContributorTest() {\n        final String persistentXssContributor = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        final String escapedPersistentXssContributor = escapeHtmlInput(persistentXssContributor);\n\n        List<Contributor> contributors = new ArrayList<>();\n        contributors.add(new Contributor(persistentXssContributor,\n                                         ContributorType.ADMIN));\n\n        setOUCreationPermission(true);\n\n        final OrganizationalUnit ou = organizationalUnitService.createOrganizationalUnit(SPACE_NAME,\n                                                                                         DEFAULT_GROUP_ID,\n                                                                                         new ArrayList<>(),\n                                                                                         contributors,\n                                                                                         SPACE_DESCRIPTION);\n\n        assertNotNull(ou);\n        verify(organizationalUnitFactory).newOrganizationalUnit(any());\n        assertEquals(SPACE_NAME, ou.getName());\n        assertEquals(SPACE_DESCRIPTION, ou.getDescription());\n        assertEquals(DEFAULT_GROUP_ID, ou.getDefaultGroupId());\n\n        Assertions.assertThat(ou.getContributors()).hasSize(1);\n        Assertions.assertThat(ou.getContributors()).hasOnlyOneElementSatisfying((contributor) -> {\n            contributor.getUsername().equals(escapedPersistentXssContributor);\n        });\n    }\n\n    @Test\n    public void createOrganizationalUnitWithPersistentXssAndValidContributorTest() {\n        final String persistentXssContributor = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        final String escapedPersistentXssContributor = escapeHtmlInput(persistentXssContributor);\n        final String escapedAdminContributor = escapeHtmlInput(ADMIN);\n        final String regularContributor = \"head_technician_junior-intern\";\n        final String escapedRegularContributor = escapeHtmlInput(regularContributor);\n\n        List<Contributor> contributors = new ArrayList<>();\n        contributors.add(new Contributor(persistentXssContributor,\n                                         ContributorType.CONTRIBUTOR));\n        contributors.add(new Contributor(ADMIN,\n                                         ContributorType.ADMIN));\n        contributors.add(new Contributor(regularContributor,\n                                         ContributorType.OWNER));\n\n        setOUCreationPermission(true);\n\n        final OrganizationalUnit ou = organizationalUnitService.createOrganizationalUnit(SPACE_NAME,\n                                                                                         DEFAULT_GROUP_ID,\n                                                                                         new ArrayList<>(),\n                                                                                         contributors,\n                                                                                         SPACE_DESCRIPTION);\n\n        assertNotNull(ou);\n        verify(organizationalUnitFactory).newOrganizationalUnit(any());\n        assertEquals(SPACE_NAME, ou.getName());\n        assertEquals(SPACE_DESCRIPTION, ou.getDescription());\n        assertEquals(DEFAULT_GROUP_ID, ou.getDefaultGroupId());\n\n        Assertions.assertThat(ou.getContributors()).hasSize(3);\n        Assertions.assertThat(ou.getContributors()).containsExactly(new Contributor(escapedPersistentXssContributor,\n                                                                                    ContributorType.CONTRIBUTOR),\n                                                                    new Contributor(escapedAdminContributor,\n                                                                                    ContributorType.ADMIN),\n                                                                    new Contributor(escapedRegularContributor,\n                                                                                    ContributorType.OWNER));\n    }\n\n    @Test\n    public void removeOrganizationalUnitRemovesRepositories() throws Exception {\n        Repository repoA = mock(Repository.class);\n        Repository repoB = mock(Repository.class);\n        List<Repository> repos = Arrays.asList(repoA, repoB);\n        when(repoA.getAlias()).thenReturn(REPO_A);\n        when(repoB.getAlias()).thenReturn(REPO_B);\n\n        Space space = new Space(SPACE_NAME);\n        when(orgUnit.getRepositories()).thenReturn(repos);\n        when(orgUnit.getSpace()).thenReturn(space);\n\n        ConfigGroup configGroup = new ConfigGroup();\n        configGroup.setName(SPACE_NAME);\n\n        doReturn(orgUnit).when(organizationalUnitService).getOrganizationalUnit(SPACE_NAME);\n\n        organizationalUnitService.removeOrganizationalUnit(SPACE_NAME);\n\n        verify(repoService).removeRepositories(eq(space), eq(new HashSet<>(Arrays.asList(REPO_A, REPO_B))));\n\n        ArgumentCaptor<RemoveOrganizationalUnitEvent> eventCaptor = ArgumentCaptor.forClass(RemoveOrganizationalUnitEvent.class);\n        verify(removeOrganizationalUnitEvent).fire(eventCaptor.capture());\n\n        RemoveOrganizationalUnitEvent event = eventCaptor.getValue();\n        assertEquals(repos, event.getOrganizationalUnit().getRepositories());\n    }\n\n    @Test\n    public void testOnRemoveOrgUnit() {\n\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n        RemoveOrganizationalUnitEvent event = new RemoveOrganizationalUnitEvent(organizationalUnit, ADMIN);\n        this.organizationalUnitService.onRemoveOrganizationalUnit(event);\n        verify(this.spaceConfigStorageRegistry).remove(SPACE_NAME);\n    }\n\n    @Test\n    public void testUpdateOrganizationalUnit() {\n        final String newGroupId = \"newGroupId\";\n\n        OrganizationalUnit organizationalUnit = organizationalUnitService.updateOrganizationalUnit(SPACE_NAME, newGroupId, Collections.emptyList());\n\n        Assertions.assertThat(organizationalUnit)\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", newGroupId);\n\n        Assertions.assertThat(spaceInfo)\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", newGroupId);\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void testContributorsPersistentXssOnUpdateOrganizationalUnit() {\n        final String persistentXssContributor = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        final String escapedPersistentXssContributor = escapeHtmlInput(persistentXssContributor);\n\n        OrganizationalUnit organizationalUnit =\n                organizationalUnitService.updateOrganizationalUnit(SPACE_NAME,\n                                                                   DEFAULT_GROUP_ID,\n                                                                   Collections.singletonList(\n                                                                           new Contributor(\n                                                                                   persistentXssContributor,\n                                                                                   ContributorType.ADMIN\n                                                                           )\n                                                                   )\n                );\n\n        Assertions.assertThat(organizationalUnit)\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", DEFAULT_GROUP_ID);\n\n        Assertions.assertThat(organizationalUnit.getContributors()).hasSize(1);\n        Assertions.assertThat(organizationalUnit.getContributors()).hasOnlyOneElementSatisfying((contributor) -> {\n            contributor.getUsername().equals(escapedPersistentXssContributor);\n        });\n\n        Assertions.assertThat(spaceInfo)\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", DEFAULT_GROUP_ID);\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void testCheckChildrenRepositoryContributors() {\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n        organizationalUnit.getContributors().add(new Contributor(\"contributor1\", ContributorType.OWNER));\n        organizationalUnit.getContributors().add(new Contributor(\"contributor2\", ContributorType.ADMIN));\n        organizationalUnit.getContributors().add(new Contributor(\"contributor3\", ContributorType.CONTRIBUTOR));\n\n        Repository repository = mock(Repository.class);\n        final List<Contributor> repositoryContributors = new ArrayList<>();\n        repositoryContributors.add(new Contributor(\"contributor1\", ContributorType.OWNER));\n        repositoryContributors.add(new Contributor(\"contributor2\", ContributorType.CONTRIBUTOR));\n        repositoryContributors.add(new Contributor(\"contributor4\", ContributorType.ADMIN));\n        doReturn(repositoryContributors).when(repository).getContributors();\n\n        doReturn(Collections.singletonList(repository)).when(repoService).getAllRepositories(any());\n\n        organizationalUnitService.checkChildrenRepositoryContributors(organizationalUnit);\n\n        verify(repoService).updateContributors(same(repository), contributorsCapture.capture());\n        final List<Contributor> updateRepositoryContributors = contributorsCapture.getValue();\n        assertEquals(2, updateRepositoryContributors.size());\n        assertEquals(\"contributor1\", updateRepositoryContributors.get(0).getUsername());\n        assertEquals(ContributorType.OWNER, updateRepositoryContributors.get(0).getType());\n        assertEquals(\"contributor2\", updateRepositoryContributors.get(1).getUsername());\n        assertEquals(ContributorType.CONTRIBUTOR, updateRepositoryContributors.get(1).getType());\n    }\n\n    @Test\n    public void testAddGroup() {\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n\n        organizationalUnitService.addGroup(organizationalUnit, ROLES);\n\n        ArgumentCaptor<UpdatedOrganizationalUnitEvent> captor = ArgumentCaptor.forClass(UpdatedOrganizationalUnitEvent.class);\n        verify(updatedOrganizationalUnitEvent).fire(captor.capture());\n        assertSame(ADMIN, captor.getValue().getUserName());\n\n        Assertions.assertThat(captor.getValue().getOrganizationalUnit())\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", DEFAULT_GROUP_ID);\n\n        Assertions.assertThat(captor.getValue().getOrganizationalUnit().getGroups())\n                .hasSize(1)\n                .containsExactly(ROLES);\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage).endBatch();\n\n        Assertions.assertThat(spaceInfo.getSecurityGroups())\n                .hasSize(1)\n                .contains(ROLES);\n    }\n\n    @Test\n    public void testRemoveGroup() {\n        testAddGroup();\n\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n\n        organizationalUnitService.removeGroup(organizationalUnit, ROLES);\n\n        ArgumentCaptor<UpdatedOrganizationalUnitEvent> captor = ArgumentCaptor.forClass(UpdatedOrganizationalUnitEvent.class);\n        verify(updatedOrganizationalUnitEvent, times(2)).fire(captor.capture());\n        assertSame(ADMIN, captor.getValue().getUserName());\n\n        Assertions.assertThat(captor.getValue().getOrganizationalUnit())\n                .hasFieldOrPropertyWithValue(\"name\", SPACE_NAME)\n                .hasFieldOrPropertyWithValue(\"defaultGroupId\", DEFAULT_GROUP_ID);\n\n        Assertions.assertThat(captor.getValue().getOrganizationalUnit().getGroups())\n                .isEmpty();\n\n        verify(spaceConfigStorage, times(2)).startBatch();\n        verify(spaceConfigStorage, times(2)).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage, times(2)).endBatch();\n    }\n\n    @Test\n    public void testAddRepository() {\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n\n        Repository repoA = mock(Repository.class);\n        when(repoA.getAlias()).thenReturn(REPO_A);\n\n        organizationalUnitService.addRepository(organizationalUnit, repoA);\n\n        checkRepos(1, REPO_A, false);\n\n        ArgumentCaptor<RepoAddedToOrganizationalUnitEvent> captor = ArgumentCaptor.forClass(RepoAddedToOrganizationalUnitEvent.class);\n        verify(repoAddedToOrgUnitEvent).fire(captor.capture());\n        assertSame(repoA, captor.getValue().getRepository());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage).endBatch();\n\n        Repository repoB = mock(Repository.class);\n        when(repoB.getAlias()).thenReturn(REPO_B);\n\n        organizationalUnitService.addRepository(organizationalUnit, repoB);\n\n        checkRepos(2, REPO_B, false);\n\n        captor = ArgumentCaptor.forClass(RepoAddedToOrganizationalUnitEvent.class);\n        verify(repoAddedToOrgUnitEvent, times(2)).fire(captor.capture());\n        assertSame(repoB, captor.getValue().getRepository());\n\n        verify(spaceConfigStorage, times(2)).startBatch();\n        verify(spaceConfigStorage, times(2)).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage, times(2)).endBatch();\n    }\n\n    @Test\n    public void testRemoveRepository() {\n        testAddRepository(); // Adding repos\n\n        OrganizationalUnit organizationalUnit = new OrganizationalUnitImpl(SPACE_NAME, DEFAULT_GROUP_ID);\n\n        Repository repoA = mock(Repository.class);\n        when(repoA.getAlias()).thenReturn(REPO_A);\n\n        organizationalUnitService.removeRepository(organizationalUnit, repoA);\n\n        checkRepos(2, REPO_A, true);\n\n        ArgumentCaptor<RepoRemovedFromOrganizationalUnitEvent> captor = ArgumentCaptor.forClass(RepoRemovedFromOrganizationalUnitEvent.class);\n        verify(repoRemovedFromOrgUnitEvent).fire(captor.capture());\n        assertSame(repoA, captor.getValue().getRepository());\n\n        verify(spaceConfigStorage, times(3)).startBatch();\n        verify(spaceConfigStorage, times(3)).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage, times(3)).endBatch();\n\n        Repository repoB = mock(Repository.class);\n        when(repoB.getAlias()).thenReturn(REPO_B);\n\n        organizationalUnitService.removeRepository(organizationalUnit, repoB);\n\n        checkRepos(2, REPO_B, true);\n\n        captor = ArgumentCaptor.forClass(RepoRemovedFromOrganizationalUnitEvent.class);\n        verify(repoRemovedFromOrgUnitEvent, times(2)).fire(captor.capture());\n        assertSame(repoB, captor.getValue().getRepository());\n\n        verify(spaceConfigStorage, times(4)).startBatch();\n        verify(spaceConfigStorage, times(4)).saveSpaceInfo(eq(spaceInfo));\n        verify(spaceConfigStorage, times(4)).endBatch();\n    }\n\n    private void checkRepos(final int expectedRepos, final String repoName, final boolean deleted) {\n        Assertions.assertThat(spaceInfo.getRepositories())\n                .hasSize(expectedRepos)\n                .areAtLeastOne(new Condition<>(repositoryInfo -> repositoryInfo.getName().equals(repoName) && repositoryInfo.isDeleted() == deleted, \"RepositoryInfo {name: '\" + repoName + \"', deleted: \" + deleted + \"}\"));\n\n    }\n\n    private void setOUCreationPermission(final boolean hasPermission) {\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigCleanUpTest.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.eclipse.jgit.lib.Repository;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.EnvironmentParameters;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.fs.jgit.FileSystemLock;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SpaceConfigCleanUpTest {\n\n    private SpaceConfigCleanUp spaceConfigCleanUp;\n\n    @Mock\n    private OrganizationalUnitService orgUnitService;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    private Git git;\n\n    @Before\n    public void setup() throws IOException {\n        spaceConfigCleanUp = spy(new SpaceConfigCleanUp(orgUnitService,\n                                                        spaceConfigStorageRegistry));\n\n        doReturn(true).when(spaceConfigCleanUp).isGitDefaultFileSystem();\n\n        doReturn(mock(FileSystemLock.class)).when(spaceConfigCleanUp).createLock(any(File.class));\n    }\n\n    @Test\n    public void cleanUpSpaceConfigStorageWhenAlreadyDoneTest() throws IOException {\n        final SpaceConfigStorageImpl spaceConfigStorage = setupConfigStorage();\n\n        setupMarker(true);\n\n        spaceConfigCleanUp.postConstruct();\n\n        verify(spaceConfigStorage, never()).loadSpaceInfo();\n        verify(spaceConfigStorage, never()).saveSpaceInfo(any());\n        verify(git, never()).resetWithSquash(anyString());\n    }\n\n    @Test\n    public void cleanUpSpaceConfigStorageWhenUpdateNotNeededTest() throws IOException {\n        final SpaceConfigStorageImpl spaceConfigStorage = setupConfigStorage();\n\n        setupMarker(false);\n\n        final SpaceInfo spaceInfo = mock(SpaceInfo.class);\n        doReturn(spaceInfo).when(spaceConfigStorage).loadSpaceInfo();\n\n        final RepositoryInfo repositoryInfo = setupRepositoryInfo(createEnvMap(false));\n        doReturn(Collections.nCopies(5, repositoryInfo)).when(spaceInfo).getRepositories();\n\n        spaceConfigCleanUp.postConstruct();\n\n        verify(spaceConfigStorage, never()).saveSpaceInfo(any());\n        verify(git, never()).resetWithSquash(anyString());\n    }\n\n    @Test\n    public void cleanUpSpaceConfigStorageWhenUpdateNeededTest() throws IOException {\n        final SpaceConfigStorageImpl spaceConfigStorage = setupConfigStorage();\n\n        setupMarker(false);\n\n        final SpaceInfo spaceInfo = mock(SpaceInfo.class);\n        doReturn(spaceInfo).when(spaceConfigStorage).loadSpaceInfo();\n\n        final RepositoryInfo repositoryInfo = setupRepositoryInfo(createEnvMap(true));\n        doReturn(Collections.nCopies(5, repositoryInfo)).when(spaceInfo).getRepositories();\n\n        spaceConfigCleanUp.postConstruct();\n\n        verify(spaceConfigStorage).saveSpaceInfo(any());\n        verify(git).resetWithSquash(anyString());\n    }\n\n    @Test\n    public void cleanUpSpaceConfigStorageWhenUpdatePartiallyNeededTest() throws IOException {\n        final SpaceConfigStorageImpl spaceConfigStorage = setupConfigStorage();\n\n        setupMarker(false);\n\n        final SpaceInfo spaceInfo = mock(SpaceInfo.class);\n        doReturn(spaceInfo).when(spaceConfigStorage).loadSpaceInfo();\n\n        final List<RepositoryInfo> repositoryInfos = new ArrayList<>();\n        repositoryInfos.addAll(Collections.nCopies(3, setupRepositoryInfo(createEnvMap(true))));\n        repositoryInfos.addAll(Collections.nCopies(3, setupRepositoryInfo(createEnvMap(false))));\n\n        doReturn(repositoryInfos).when(spaceInfo).getRepositories();\n\n        spaceConfigCleanUp.postConstruct();\n\n        verify(spaceConfigStorage).saveSpaceInfo(any());\n        verify(git).resetWithSquash(anyString());\n    }\n\n    private SpaceConfigStorageImpl setupConfigStorage() {\n        final String spaceName = \"MySpace\";\n\n        final OrganizationalUnit orgUnit = mock(OrganizationalUnit.class);\n        doReturn(spaceName).when(orgUnit).getName();\n        doReturn(Collections.singletonList(orgUnit)).when(orgUnitService).getAllOrganizationalUnits();\n\n        final SpaceConfigStorageImpl spaceConfigStorage = mock(SpaceConfigStorageImpl.class);\n        final Path path = mock(Path.class);\n        final JGitFileSystem fs = mock(JGitFileSystem.class);\n        final Repository repository = mock(Repository.class);\n        final File directory = mock(File.class);\n\n        doReturn(directory).when(directory).getParentFile();\n        doReturn(directory).when(repository).getDirectory();\n        doReturn(repository).when(git).getRepository();\n        doReturn(git).when(fs).getGit();\n        doReturn(fs).when(path).getFileSystem();\n        doReturn(path).when(spaceConfigStorage).getPath();\n        doReturn(spaceConfigStorage).when(spaceConfigStorageRegistry).get(spaceName);\n\n        return spaceConfigStorage;\n    }\n\n    private RepositoryInfo setupRepositoryInfo(final Map<String, Object> envMap) {\n        final RepositoryInfo repositoryInfo = mock(RepositoryInfo.class);\n        final RepositoryConfiguration configuration = mock(RepositoryConfiguration.class);\n\n        doReturn(envMap).when(configuration).getEnvironment();\n        doReturn(configuration).when(repositoryInfo).getConfiguration();\n\n        return repositoryInfo;\n    }\n\n    private void setupMarker(final boolean exists) {\n        final File marker = mock(File.class);\n        doReturn(exists).when(marker).exists();\n        doReturn(marker).when(spaceConfigCleanUp).createMarker(any(File.class));\n    }\n\n    private Map<String, Object> createEnvMap(final boolean includeCredentials) {\n        final Map<String, Object> envMap = new HashMap<>();\n        envMap.put(\"foo\", true);\n        envMap.put(\"bar\", 1);\n\n        if (includeCredentials) {\n            envMap.put(EnvironmentParameters.USER_NAME, \"user\");\n            envMap.put(EnvironmentParameters.PASSWORD, \"pw\");\n            envMap.put(EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD, \"spw\");\n        }\n\n        return envMap;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigStorageImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestComment;\nimport org.jboss.errai.marshalling.client.api.exceptions.MarshallingException;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Paths;\nimport org.uberfire.mocks.FileSystemTestingUtils;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.doThrow;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.same;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SpaceConfigStorageImplTest {\n\n    private static final String PATH_PREFIX = \"git://amend-repo-test/\";\n\n    @Mock\n    private ObjectStorage objectStorage;\n\n    private IOService ioService;\n\n    private SpaceConfigStorageImpl spaceConfigStorage;\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    @Before\n    public void setup() throws Exception {\n        fileSystemTestingUtils.setup();\n\n        ioService = spy(fileSystemTestingUtils.getIoService());\n\n        spaceConfigStorage = spy(new SpaceConfigStorageImpl(objectStorage,\n                                                            ioService));\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void loadCustomBranchPermissionsTest() {\n        final BranchPermissions customBranchPermissions = mock(BranchPermissions.class);\n        doReturn(customBranchPermissions).when(objectStorage).read(\"/config/myProject/myBranch/BranchPermissions.json\");\n\n        final BranchPermissions branchPermissions = spaceConfigStorage.loadBranchPermissions(\"myBranch\",\n                                                                                             \"myProject\");\n\n        assertSame(customBranchPermissions,\n                   branchPermissions);\n    }\n\n    @Test\n    public void loadDefaultBranchPermissionsTest() {\n        final BranchPermissions defaultBranchPermissions = mock(BranchPermissions.class);\n        doReturn(defaultBranchPermissions).when(spaceConfigStorage).getDefaultBranchPermissions(\"myBranch\");\n\n        final BranchPermissions branchPermissions = spaceConfigStorage.loadBranchPermissions(\"myBranch\",\n                                                                                             \"myProject\");\n\n        assertSame(defaultBranchPermissions,\n                   branchPermissions);\n    }\n\n    @Test\n    public void saveBranchPermissionsTest() {\n        final BranchPermissions customBranchPermissions = mock(BranchPermissions.class);\n\n        spaceConfigStorage.saveBranchPermissions(\"myBranch\",\n                                                 \"myProject\",\n                                                 customBranchPermissions);\n\n        verify(objectStorage).write(eq(\"/config/myProject/myBranch/BranchPermissions.json\"),\n                                    same(customBranchPermissions));\n    }\n\n    @Test\n    public void deleteBranchPermissionsTest() {\n        spaceConfigStorage.deleteBranchPermissions(\"myBranch\",\n                                                   \"myProject\");\n\n        verify(objectStorage).delete(eq(\"/config/myProject/myBranch/BranchPermissions.json\"));\n    }\n\n    @Test\n    public void loadChangeRequestsTest() {\n        final List<Long> ids = new ArrayList<Long>() {{\n            add(1L);\n            add(2L);\n        }};\n\n        final ChangeRequest expectedChangeRequest0 = mock(ChangeRequest.class);\n        final ChangeRequest expectedChangeRequest1 = mock(ChangeRequest.class);\n\n        doReturn(ids).when(spaceConfigStorage).getChangeRequestIds(\"MyProject\");\n\n        doReturn(expectedChangeRequest0).when(objectStorage).read(\"/MyProject/change_requests/1/information.cr\");\n        doReturn(expectedChangeRequest1).when(objectStorage).read(\"/MyProject/change_requests/2/information.cr\");\n\n        final List<ChangeRequest> changeRequests = spaceConfigStorage.loadChangeRequests(\"MyProject\");\n\n        assertSame(expectedChangeRequest0,\n                   changeRequests.get(0));\n\n        assertSame(expectedChangeRequest1,\n                   changeRequests.get(1));\n    }\n\n    @Test\n    public void loadChangeRequestTest() {\n        final ChangeRequest expectedChangeRequest = mock(ChangeRequest.class);\n\n        doReturn(expectedChangeRequest).when(objectStorage).read(\"/MyProject/change_requests/1/information.cr\");\n\n        final ChangeRequest changeRequest = spaceConfigStorage.loadChangeRequest(\"MyProject\", 1L);\n\n        assertSame(expectedChangeRequest,\n                   changeRequest);\n    }\n\n    @Test\n    public void saveChangeRequestTest() {\n        final ChangeRequest changeRequest = mock(ChangeRequest.class);\n\n        doReturn(1L).when(changeRequest).getId();\n\n        spaceConfigStorage.saveChangeRequest(\"MyProject\", changeRequest);\n\n        verify(objectStorage).write(eq(\"/MyProject/change_requests/1/information.cr\"),\n                                    same(changeRequest));\n    }\n\n    @Test\n    public void deleteAllChangeRequestsTest() {\n        final org.uberfire.java.nio.file.Path crsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests\"));\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments/2.comment\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests\");\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests/2/comments\");\n        doReturn(crsPath).when(objectStorage).getPath(\"/MyProject/change_requests\");\n        doReturn(commentsPath).when(objectStorage).getPath(\"/MyProject/change_requests/2/comments\");\n\n        spaceConfigStorage.deleteAllChangeRequests(\"MyProject\");\n\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/comments/1.comment\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/comments/2.comment\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/information.cr\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/information.cr\"));\n    }\n\n    @Test\n    public void deleteChangeRequestTest() {\n        spaceConfigStorage.deleteChangeRequest(\"MyProject\",\n                                               1L);\n\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/information.cr\"));\n    }\n\n    @Test\n    public void deleteRepositoryTest() {\n        final org.uberfire.java.nio.file.Path crsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests\"));\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/comments/2.comment\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests\");\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests/2/comments\");\n        doReturn(crsPath).when(objectStorage).getPath(\"/MyProject/change_requests\");\n        doReturn(commentsPath).when(objectStorage).getPath(\"/MyProject/change_requests/2/comments\");\n\n        spaceConfigStorage.deleteRepository(\"MyProject\");\n\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/comments/1.comment\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/comments/2.comment\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/information.cr\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/2/information.cr\"));\n        verify(objectStorage).delete(eq(\"/MyProject\"));\n    }\n\n    @Test\n    public void getChangeRequestIdsTest() {\n        final org.uberfire.java.nio.file.Path crsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests\"));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/information.cr\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests\");\n        doReturn(crsPath).when(objectStorage).getPath(\"/MyProject/change_requests\");\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestIds(\"MyProject\");\n\n        assertSame(1L, ids.get(0));\n        assertSame(2L, ids.get(1));\n    }\n\n    @Test\n    public void getChangeRequestIdsSkipInvalidIdsTest() {\n        final org.uberfire.java.nio.file.Path crsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests\"));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/invalid-id/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/information.cr\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests\");\n        doReturn(crsPath).when(objectStorage).getPath(\"/MyProject/change_requests\");\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestIds(\"MyProject\");\n\n        assertSame(1, ids.size());\n        assertSame(1L, ids.get(0));\n    }\n\n    @Test\n    public void getChangeRequestIdsNoResultsTest() {\n        final org.uberfire.java.nio.file.Path crsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests\"));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/information.cr\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/2/information.cr\")));\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestIds(\"MyOtherProject\");\n\n        assertSame(0, ids.size());\n    }\n\n    @Test\n    public void loadChangeRequestCommentsTest() {\n        final List<Long> ids = new ArrayList<Long>() {{\n            add(1L);\n            add(2L);\n        }};\n\n        final ChangeRequestComment expectedChangeRequestComment0 = mock(ChangeRequestComment.class);\n        final ChangeRequestComment expectedChangeRequestComment1 = mock(ChangeRequestComment.class);\n\n        doReturn(ids).when(spaceConfigStorage).getChangeRequestCommentIds(\"MyProject\", 1L);\n\n        doReturn(expectedChangeRequestComment0).when(objectStorage).read(\"/MyProject/change_requests/1/comments/1.comment\");\n        doReturn(expectedChangeRequestComment1).when(objectStorage).read(\"/MyProject/change_requests/1/comments/2.comment\");\n\n        final List<ChangeRequestComment> comments = spaceConfigStorage.loadChangeRequestComments(\"MyProject\", 1L);\n\n        assertSame(expectedChangeRequestComment0,\n                   comments.get(0));\n\n        assertSame(expectedChangeRequestComment1,\n                   comments.get(1));\n    }\n\n    @Test\n    public void loadChangeRequestCommentTest() {\n        final ChangeRequestComment expectedChangeRequestComment = mock(ChangeRequestComment.class);\n\n        doReturn(expectedChangeRequestComment).when(objectStorage).read(\"/MyProject/change_requests/1/comments/1.comment\");\n\n        final ChangeRequestComment changeRequestComment = spaceConfigStorage.loadChangeRequestComment(\"MyProject\", 1L, 1L);\n\n        assertSame(expectedChangeRequestComment,\n                   changeRequestComment);\n    }\n\n    @Test\n    public void saveChangeRequestCommentTest() {\n        final ChangeRequestComment changeRequestComment = mock(ChangeRequestComment.class);\n\n        doReturn(1L).when(changeRequestComment).getId();\n\n        spaceConfigStorage.saveChangeRequestComment(\"MyProject\", 1L, changeRequestComment);\n\n        verify(objectStorage).write(eq(\"/MyProject/change_requests/1/comments/1.comment\"),\n                                    same(changeRequestComment));\n    }\n\n    @Test\n    public void deleteAllChangeRequestCommentsTest() {\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/2.comment\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests/1/comments\");\n        doReturn(commentsPath).when(objectStorage).getPath(\"/MyProject/change_requests/1/comments\");\n\n        spaceConfigStorage.deleteAllChangeRequestComments(\"MyProject\", 1L);\n\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/comments/1.comment\"));\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/comments/2.comment\"));\n    }\n\n    @Test\n    public void deleteChangeRequestCommentTest() {\n        spaceConfigStorage.deleteChangeRequestComment(\"MyProject\", 1L, 1L);\n\n        verify(objectStorage).delete(eq(\"/MyProject/change_requests/1/comments/1.comment\"));\n    }\n\n    @Test\n    public void getChangeRequestCommentIdsTest() {\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/20.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/30.comment\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests/1/comments\");\n        doReturn(commentsPath).when(objectStorage).getPath(\"/MyProject/change_requests/1/comments\");\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestCommentIds(\"MyProject\", 1L);\n\n        assertSame(1L, ids.get(0));\n        assertSame(20L, ids.get(1));\n        assertSame(30L, ids.get(2));\n    }\n\n    @Test\n    public void getChangeRequestCommentIdsSkipInvalidIdsTest() {\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/20.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/invalid-id.comment\")));\n\n        doReturn(true).when(objectStorage).exists(\"/MyProject/change_requests/1/comments\");\n        doReturn(commentsPath).when(objectStorage).getPath(\"/MyProject/change_requests/1/comments\");\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestCommentIds(\"MyProject\", 1L);\n\n        assertSame(2, ids.size());\n        assertSame(1L, ids.get(0));\n        assertSame(20L, ids.get(1));\n    }\n\n    @Test\n    public void getChangeRequestCommentIdsNoResultsOtherChangeRequestTest() {\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/20.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/30.comment\")));\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestCommentIds(\"MyProject\", 2L);\n\n        assertSame(0, ids.size());\n    }\n\n    @Test\n    public void getChangeRequestCommentIdsNoResultsOtherProjectTest() {\n        final org.uberfire.java.nio.file.Path commentsPath = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments\"));\n\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/1.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/20.comment\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"MyProject/change_requests/1/comments/30.comment\")));\n\n        final List<Long> ids = spaceConfigStorage.getChangeRequestCommentIds(\"MyOtherProject\", 1L);\n\n        assertSame(0, ids.size());\n    }\n\n    @Test\n    public void testLoadSpaceInfo() {\n        SpaceInfo spaceInfo = mock(SpaceInfo.class);\n        String path = \"src/test/resources/dummyOverride/FixedSpaceInfo.json\";\n        doThrow(new RuntimeException(new MarshallingException())).doReturn(spaceInfo).when(objectStorage).read(anyString());\n        when(objectStorage.exists(anyString())).thenReturn(true);\n        when(objectStorage.getPath(any())).thenReturn(Paths.get(path));\n        when(spaceConfigStorage.buildSpaceConfigFilePath(anyString())).thenReturn(path);\n\n        SpaceInfo si = spaceConfigStorage.loadSpaceInfo();\n\n        verify(objectStorage).exists(eq(path));\n        assertEquals(si, spaceInfo);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/organizationalunit/config/SpaceConfigStorageRegistryImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.organizationalunit.config;\n\nimport java.util.function.Function;\n\nimport javax.enterprise.inject.Instance;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageBatch;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SpaceConfigStorageRegistryImplTest {\n\n    private static final String SPACE_NAME = \"mySpace\";\n\n    @Mock\n    private Instance<SpaceConfigStorage> spaceConfigStorages;\n\n    private SpaceConfigStorageRegistryImpl spaceConfigStorageRegistry;\n\n    @Mock\n    private SpaceConfigStorage mySpaceConfigStorage;\n\n    @Mock\n    private SpaceConfigStorage otherSpaceConfigStorage;\n\n    @Before\n    public void setup() {\n        spaceConfigStorageRegistry = new SpaceConfigStorageRegistryImpl(spaceConfigStorages);\n    }\n\n    @Test\n    public void getTest() {\n        doReturn(mySpaceConfigStorage).when(spaceConfigStorages).get();\n        final SpaceConfigStorage spaceConfigStorage1 = spaceConfigStorageRegistry.get(SPACE_NAME);\n        assertSame(mySpaceConfigStorage, spaceConfigStorage1);\n\n        final SpaceConfigStorage spaceConfigStorage2 = spaceConfigStorageRegistry.get(SPACE_NAME);\n        assertSame(mySpaceConfigStorage, spaceConfigStorage2);\n    }\n\n    @Test\n    public void getBatchTest() {\n        doReturn(mySpaceConfigStorage).when(spaceConfigStorages).get();\n\n        final SpaceInfo spaceInfo = mock(SpaceInfo.class);\n\n        SpaceConfigStorageBatch batch = spy(spaceConfigStorageRegistry.getBatch(SPACE_NAME));\n\n        Assertions.assertThatThrownBy(() -> batch.run(null))\n                .isInstanceOf(IllegalArgumentException.class)\n                .hasMessage(\"Parameter named 'function' should be not null!\");\n\n        Function<SpaceConfigStorageBatch.SpaceConfigStorageBatchContext, Void> function = (context) -> {\n            context.saveSpaceInfo();\n            return null;\n        };\n\n        batch.run(function);\n\n        verify(mySpaceConfigStorage).saveSpaceInfo(any());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/pom/DependencyTypesMapperTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class DependencyTypesMapperTest {\n\n    private DependencyTypesMapper mapper;\n\n    @Before\n    public void setUp() {\n        mapper = new DependencyTypesMapper();\n    }\n\n    @Test\n    public void mappingTest() {\n        Map<DependencyType, List<DynamicPomDependency>> mapping = mapper.getMapping();\n        assertThat(mapping).isNotEmpty();\n        TestUtil.testJPADep(mapping);\n    }\n\n    @Test\n    public void mappingDependencyTest() {\n        List<DynamicPomDependency> deps = mapper.getDependencies(DependencyType.JPA);\n        assertThat(deps).isNotEmpty();\n        assertThat(deps).hasSize(1);\n        Map<DependencyType, List<DynamicPomDependency>> map = new HashMap<>();\n        map.put(DependencyType.JPA,\n                deps);\n        TestUtil.testJPADep(map);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/pom/PomEditorDefaultTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport org.apache.maven.model.Dependency;\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Reader;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class PomEditorDefaultTest {\n\n    private final String POM = \"pom.xml\";\n    private PomEditor editor;\n    private Path tmpRoot, tmp;\n    private static String fileSeparator = \"/\";\n\n    @Before\n    public void setUp() throws Exception {\n        editor = new PomEditorDefault();\n        tmpRoot = Files.createTempDirectory(\"repo\");\n        tmp = TestUtil.createAndCopyToDirectory(tmpRoot,\n                                                \"dummy\",\n                                                \"target/test-classes/dummy\");\n    }\n\n    @After\n    public void tearDown() {\n        if (tmpRoot != null) {\n            TestUtil.rm(tmpRoot.toFile());\n        }\n    }\n\n    @Test\n    public void addEmptyDepTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(\"\",\n                                                            \"\",\n                                                            \"\",\n                                                            \"\");\n        boolean result = editor.addDependency(dep,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addNullDepTest() {\n        boolean result = editor.addDependency(null,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addNullGroupIDTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(null,\n                                                            \"junit\",\n                                                            \"4.12\",\n                                                            \"\");\n        boolean result = editor.addDependency(dep,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addNullArtifactIDTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(\"junit\",\n                                                            null,\n                                                            \"4.12\",\n                                                            \"\");\n        boolean result = editor.addDependency(dep,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addDepTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(\"junit\",\n                                                            \"junit\",\n                                                            \"4.12\",\n                                                            \"\");\n        boolean result = editor.addDependency(dep,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isTrue();\n    }\n\n    @Test\n    public void addDepsTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(\"junit\",\n                                                            \"junit\",\n                                                            \"4.12\",\n                                                            \"\");\n        List<DynamicPomDependency> deps = Arrays.asList(dep);\n        boolean result = editor.addDependencies(deps,\n                                                PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                    tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isTrue();\n    }\n\n    @Test\n    public void addDuplicatedDepTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(TestUtil.GROUP_ID_TEST,\n                                                            TestUtil.ARTIFACT_ID_TEST,\n                                                            TestUtil.VERSION_ID_TEST,\n                                                            \"\");\n        boolean result = editor.addDependency(dep,\n                                              PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                  tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addAndOverrideVersionDepTest() throws Exception {\n        //During the scan of the pom if a dep is founded present will be override the version with the version in the json file\n        tmp = TestUtil.createAndCopyToDirectory(tmpRoot,\n                                                \"dummyOverride\",\n                                                \"target/test-classes/dummy\");\n        DynamicPomDependency dep = new DynamicPomDependency(\"javax.persistence\",\n                                                            \"javax.persistence-api\",\n                                                            \"1.0.3.Final\",\n                                                            \"\");\n        List<DynamicPomDependency> deps = Arrays.asList(dep);\n        boolean result = editor.addDependencies(deps,\n                                                PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                    tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isTrue();\n\n        MavenXpp3Reader reader = new MavenXpp3Reader();\n        Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString() + fileSeparator + POM))));\n        Dependency changedDep = getDependency(model.getDependencies(),\n                                              \"javax.persistence\",\n                                              \"javax.persistence-api\");\n        assertThat(changedDep.getVersion()).isEqualTo(\"1.0.3.Final\");\n    }\n\n    private Dependency getDependency(List<Dependency> deps,\n                                     String groupId,\n                                     String artifactId) {\n        Dependency dependency = new Dependency();\n        for (Dependency dep : deps) {\n            if (dep.getGroupId().equals(groupId) && dep.getArtifactId().equals(artifactId)) {\n                dependency.setGroupId(dep.getGroupId());\n                dependency.setArtifactId(dep.getArtifactId());\n                dependency.setVersion(dep.getVersion());\n                dependency.setScope(dep.getScope());\n                break;\n            }\n        }\n        return dependency;\n    }\n\n    @Test\n    public void addDuplicatedDepsTest() {\n        DynamicPomDependency dep = new DynamicPomDependency(TestUtil.GROUP_ID_TEST,\n                                                            TestUtil.ARTIFACT_ID_TEST,\n                                                            TestUtil.VERSION_ID_TEST,\n                                                            \"\");\n        List<DynamicPomDependency> deps = Arrays.asList(dep);\n        boolean result = editor.addDependencies(deps,\n                                                PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                    tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isFalse();\n    }\n\n    @Test\n    public void addAndOverrideVersionDepsTest() throws Exception {\n        //During the scan of the pom if a dep is founded present will be override the version with the version in the json file\n        tmp = TestUtil.createAndCopyToDirectory(tmpRoot,\n                                                \"dummyOverride\",\n                                                \"target/test-classes/dummyOverride\");\n        DynamicPomDependency dep = new DynamicPomDependency(\"junit\",\n                                                            \"junit\",\n                                                            \"4.13\",\n                                                            \"\");\n        DynamicPomDependency depTwo = new DynamicPomDependency(\"javax.persistence\",\n                                                               \"javax.persistence-api\",\n                                                               \"1.0.3.Final\",\n                                                               \"\");\n        List<DynamicPomDependency> deps = Arrays.asList(dep,\n                                                        depTwo);\n        boolean result = editor.addDependencies(deps,\n                                                PathFactory.newPath(tmp.toAbsolutePath().toString() + fileSeparator + POM,\n                                                                    tmp.toUri().toString() + fileSeparator + POM));\n        assertThat(result).isTrue();\n\n        MavenXpp3Reader reader = new MavenXpp3Reader();\n        Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString() + fileSeparator + POM))));\n        Dependency changedDep = getDependency(model.getDependencies(),\n                                              \"javax.persistence\",\n                                              \"javax.persistence-api\");\n        assertThat(changedDep.getVersion()).isEqualTo(\"1.0.3.Final\");\n        changedDep = getDependency(model.getDependencies(),\n                                   \"junit\",\n                                   \"junit\");\n        assertThat(changedDep.getVersion()).isEqualTo(\"4.13\");\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/pom/PomJsonReaderTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class PomJsonReaderTest {\n\n    private PomJsonReaderDefault reader;\n    private final static String JSON_POM_DEPS = \"DependencyTypesMapper.json\";\n\n    @Before\n    public void setUp() {\n        reader = new PomJsonReaderDefault(\"target/test-classes/\",\n                                          JSON_POM_DEPS);\n    }\n\n    @Test\n    public void readDepsTest() {\n        Map<DependencyType, List<DynamicPomDependency>> mapping = reader.readDeps();\n        assertThat(mapping).isNotEmpty();\n        TestUtil.testJPADep(mapping);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/pom/PomStructureEditorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.io.ByteArrayInputStream;\nimport java.io.File;\n\nimport org.apache.maven.model.Dependency;\nimport org.apache.maven.model.Model;\nimport org.apache.maven.model.io.xpp3.MavenXpp3Reader;\nimport org.guvnor.structure.pom.AddPomDependencyEvent;\nimport org.guvnor.structure.pom.DependencyType;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\n\nimport static org.assertj.core.api.Assertions.*;\n\npublic class PomStructureEditorTest {\n\n    private PomStructureEditor editor;\n    private Path tmpRoot, tmp;\n    private final String POM = \"pom.xml\";\n    private static String fileSeparator = \"/\";\n\n    @Before\n    public void setUp() throws Exception {\n        tmpRoot = Files.createTempDirectory(\"repo\");\n        tmp = TestUtil.createAndCopyToDirectory(tmpRoot,\n                                                \"dummy\",\n                                                \"target/test-classes/dummy_empty_deps\");\n    }\n\n    @Test\n    public void onNEwDynamicDependencyEventTest() throws Exception {\n        MavenXpp3Reader reader = new MavenXpp3Reader();\n        Model model = reader.read(new ByteArrayInputStream(Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString() + fileSeparator + POM))));\n        assertThat(model.getDependencies()).hasSize(0);\n\n        editor = new PomStructureEditor();\n        AddPomDependencyEvent event = new AddPomDependencyEvent(DependencyType.JPA,\n                                                                PathFactory.newPath(tmp.getFileName().toString(),\n                                                                                    tmp.toUri().toString() + fileSeparator + POM));\n        editor.onNewDynamicDependency(event);\n\n        model = reader.read(new ByteArrayInputStream(Files.readAllBytes(Paths.get(tmp.toAbsolutePath().toString() + fileSeparator + POM))));\n        assertThat(model.getDependencies()).hasSize(1);\n        Dependency dep = model.getDependencies().get(0);\n        assertThat(dep.getGroupId()).containsOnlyOnce(\"javax.persistence\");\n        assertThat(dep.getArtifactId()).containsOnlyOnce(\"javax.persistence-api\");\n        assertThat(dep.getVersion()).containsOnlyOnce(\"2.2\");\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/pom/TestUtil.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.pom;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.apache.commons.io.FileUtils;\nimport org.guvnor.structure.pom.DependencyType;\nimport org.guvnor.structure.pom.DynamicPomDependency;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.java.nio.file.Files;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.Paths;\n\nimport static org.assertj.core.api.Assertions.*;\n\nclass TestUtil {\n\n    public final static String GROUP_ID_TEST = \"javax.persistence\";\n    public final static String ARTIFACT_ID_TEST = \"javax.persistence-api\";\n    public final static String VERSION_ID_TEST = \"2.2\";\n    private static Logger logger = LoggerFactory.getLogger(TestUtil.class);\n\n    public static void testJPADep(Map<DependencyType, List<DynamicPomDependency>> mapping) {\n        List<DynamicPomDependency> deps = mapping.get(DependencyType.JPA);\n        assertThat(deps).hasSize(1);\n        DynamicPomDependency dep = deps.get(0);\n        assertThat(dep.getGroupID()).isEqualToIgnoringCase(GROUP_ID_TEST);\n        assertThat(dep.getArtifactID()).isEqualToIgnoringCase(ARTIFACT_ID_TEST);\n        assertThat(dep.getVersion()).isEqualToIgnoringCase(VERSION_ID_TEST);\n        assertThat(dep.getScope()).isEmpty();\n    }\n\n    public static Path createAndCopyToDirectory(Path root,\n                                                String dirName,\n                                                String copyTree) throws IOException {\n        Path dir = Files.createDirectories(Paths.get(root.toString(),\n                                                     dirName));\n        copyTree(Paths.get(copyTree),\n                 dir);\n        return dir;\n    }\n\n    public static void copyTree(Path source,\n                                Path target) throws IOException {\n        FileUtils.copyDirectory(source.toFile(),\n                                target.toFile());\n    }\n\n    public static void rm(File f) {\n        try {\n            FileUtils.deleteDirectory(f);\n        } catch (Exception e) {\n            logger.error(\"Couldn't delete file {}\",\n                         f);\n            logger.error(e.getMessage(),\n                         e);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/BranchAccessAuthorizerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.BranchPermissions;\nimport org.guvnor.structure.organizationalunit.config.RolePermissions;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.spaces.Space;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class BranchAccessAuthorizerTest {\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    private ConfiguredRepositories configuredRepositories;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    private BranchAccessAuthorizer branchAccessAuthorizer;\n\n    @Before\n    public void setup() {\n        branchAccessAuthorizer = new BranchAccessAuthorizer(spaceConfigStorageRegistry,\n                                                            configuredRepositories,\n                                                            organizationalUnitService);\n\n        final Repository repository = mock(Repository.class);\n        final List<Contributor> contributors = Arrays.asList(new Contributor(\"owner\",\n                                                                             ContributorType.OWNER),\n                                                             new Contributor(\"admin\",\n                                                                             ContributorType.ADMIN),\n                                                             new Contributor(\"contributor\",\n                                                                             ContributorType.CONTRIBUTOR));\n        doReturn(contributors).when(repository).getContributors();\n        doReturn(repository).when(configuredRepositories).getRepositoryByRepositoryAlias(new Space(\"space\"),\n                                                                                         \"repositoryAlias\");\n\n        final OrganizationalUnit organizationalUnit = mock(OrganizationalUnit.class);\n        doReturn(new Space(\"space\")).when(organizationalUnit).getSpace();\n        doReturn(organizationalUnit).when(organizationalUnitService).getOrganizationalUnit(\"space\");\n\n        final Map<String, RolePermissions> permissionsByRole = new HashMap<>();\n        permissionsByRole.put(\"OWNER\",\n                              new RolePermissions(\"OWNER\",\n                                                  true,\n                                                  true,\n                                                  true,\n                                                  true));\n        permissionsByRole.put(\"ADMIN\",\n                              new RolePermissions(\"ADMIN\",\n                                                  true,\n                                                  true,\n                                                  false,\n                                                  true));\n        permissionsByRole.put(\"CONTRIBUTOR\",\n                              new RolePermissions(\"CONTRIBUTOR\",\n                                                  true,\n                                                  true,\n                                                  false,\n                                                  false));\n        final BranchPermissions branchPermissions = new BranchPermissions(\"branch\",\n                                                                          permissionsByRole);\n\n        final SpaceConfigStorage spaceConfigStorage = mock(SpaceConfigStorage.class);\n        doReturn(branchPermissions).when(spaceConfigStorage).loadBranchPermissions(\"branch\",\n                                                                                   \"repositoryIdentifier\");\n        doReturn(spaceConfigStorage).when(spaceConfigStorageRegistry).get(\"space\");\n    }\n\n    @Test\n    public void authorizeOwnerTest() {\n        assertTrue(branchAccessAuthorizer.authorize(\"owner\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.READ));\n        assertTrue(branchAccessAuthorizer.authorize(\"owner\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.WRITE));\n        assertTrue(branchAccessAuthorizer.authorize(\"owner\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.DELETE));\n    }\n\n    @Test\n    public void authorizeAdminTest() {\n        assertTrue(branchAccessAuthorizer.authorize(\"admin\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.READ));\n        assertTrue(branchAccessAuthorizer.authorize(\"admin\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.WRITE));\n        assertFalse(branchAccessAuthorizer.authorize(\"admin\",\n                                                     \"space\",\n                                                     \"repositoryIdentifier\",\n                                                     \"repositoryAlias\",\n                                                     \"branch\",\n                                                     BranchAccessAuthorizer.AccessType.DELETE));\n    }\n\n    @Test\n    public void authorizeContributorTest() {\n        assertTrue(branchAccessAuthorizer.authorize(\"contributor\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.READ));\n        assertTrue(branchAccessAuthorizer.authorize(\"contributor\",\n                                                    \"space\",\n                                                    \"repositoryIdentifier\",\n                                                    \"repositoryAlias\",\n                                                    \"branch\",\n                                                    BranchAccessAuthorizer.AccessType.WRITE));\n        assertFalse(branchAccessAuthorizer.authorize(\"contributor\",\n                                                     \"space\",\n                                                     \"repositoryIdentifier\",\n                                                     \"repositoryAlias\",\n                                                     \"branch\",\n                                                     BranchAccessAuthorizer.AccessType.DELETE));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/ChangeRequestServiceTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.NoSuchElementException;\nimport java.util.Optional;\nimport java.util.stream.Collectors;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.event.Event;\n\nimport org.eclipse.jgit.diff.DiffEntry;\nimport org.eclipse.jgit.lib.ObjectId;\nimport org.eclipse.jgit.revwalk.RevCommit;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequest;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestAlreadyOpenException;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestComment;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestCountSummary;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestDiff;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestListUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatus;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestStatusUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.ChangeRequestUpdatedEvent;\nimport org.guvnor.structure.repositories.changerequest.portable.NothingToMergeException;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestCommentList;\nimport org.guvnor.structure.repositories.changerequest.portable.PaginatedChangeRequestList;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.TextualDiff;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystem;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.JGitPathImpl;\nimport org.uberfire.java.nio.fs.jgit.util.Git;\nimport org.uberfire.java.nio.fs.jgit.util.model.CommitInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.PathInfo;\nimport org.uberfire.java.nio.fs.jgit.util.model.RevertCommitContent;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.assertj.core.api.Assertions.assertThat;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.ArgumentMatchers.anyList;\nimport static org.mockito.ArgumentMatchers.anyLong;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class ChangeRequestServiceTest {\n\n    private ChangeRequestServiceImpl service;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private SpacesAPI spaces;\n\n    @Mock\n    private Event<ChangeRequestListUpdatedEvent> changeRequestListUpdatedEvent;\n\n    @Mock\n    private Event<ChangeRequestUpdatedEvent> changeRequestUpdatedEvent;\n\n    @Mock\n    private Event<ChangeRequestStatusUpdatedEvent> changeRequestStatusUpdatedEventEvent;\n\n    @Mock\n    private BranchAccessAuthorizer branchAccessAuthorizer;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private SpaceConfigStorage spaceConfigStorage;\n\n    @Mock\n    private Repository repository;\n\n    @Mock\n    private Branch sourceBranch;\n\n    @Mock\n    private Branch targetBranch;\n\n    @Mock\n    private Branch hiddenBranch;\n\n    @Mock\n    private Git git;\n\n    @Mock\n    private JGitFileSystem fs;\n\n    @Mock\n    private JGitFileSystemProvider provider;\n\n    @Mock\n    private RevCommit commonCommit;\n\n    @Mock\n    private RevCommit lastCommit;\n\n    @Before\n    public void setUp() {\n        Space mySpace = mock(Space.class);\n\n        User user = mock(User.class);\n\n        doReturn(user).when(sessionInfo).getIdentity();\n        doReturn(\"authorId\").when(user).getIdentifier();\n\n        doReturn(spaceConfigStorage).when(spaceConfigStorageRegistry).get(\"mySpace\");\n        doReturn(mySpace).when(spaces).getSpace(\"mySpace\");\n        doReturn(repository).when(repositoryService).getRepositoryFromSpace(mySpace,\n                                                                            \"myRepository\");\n\n        doReturn(\"sourceBranch\").when(sourceBranch).getName();\n        doReturn(\"targetBranch\").when(targetBranch).getName();\n        doReturn(\"hiddenBranch\").when(hiddenBranch).getName();\n\n        Branch branch = mock(Branch.class);\n        doReturn(\"branch\").when(branch).getName();\n\n        List<Branch> branches = Stream.of(sourceBranch, targetBranch, hiddenBranch, branch)\n                .collect(Collectors.toList());\n        doReturn(branches).when(repository).getBranches();\n\n        doReturn(\"myRepository\").when(repository).getAlias();\n        doReturn(mySpace).when(repository).getSpace();\n        doReturn(\"mySpace\").when(mySpace).getName();\n\n        doReturn(Optional.of(sourceBranch)).when(repository).getBranch(\"sourceBranch\");\n        doReturn(Optional.of(targetBranch)).when(repository).getBranch(\"targetBranch\");\n        doReturn(Optional.of(hiddenBranch)).when(repository).getBranch(\"hiddenBranch\");\n\n        doReturn(commonCommit).when(git).getCommonAncestorCommit(\"sourceBranch\",\n                                                                 \"targetBranch\");\n\n        doReturn(lastCommit).when(git).getLastCommit(anyString());\n\n        doReturn(true).when(branchAccessAuthorizer).authorize(any(),\n                                                              any(),\n                                                              any(),\n                                                              any(),\n                                                              any(),\n                                                              any());\n\n        this.service = spy(new ChangeRequestServiceImpl(spaceConfigStorageRegistry,\n                                                        repositoryService,\n                                                        spaces,\n                                                        changeRequestListUpdatedEvent,\n                                                        changeRequestUpdatedEvent,\n                                                        changeRequestStatusUpdatedEventEvent,\n                                                        branchAccessAuthorizer,\n                                                        sessionInfo));\n\n        doReturn(fs).when(service).getFileSystemFromBranch(repository, \"sourceBranch\");\n        doReturn(fs).when(service).getFileSystemFromBranch(repository, \"targetBranch\");\n        doReturn(git).when(fs).getGit();\n\n        doNothing().when(provider).executePostCommitHook(any());\n        doReturn(provider).when(fs).provider();\n\n        doReturn(mock(PathInfo.class)).when(git).getPathInfo(any(),\n                                                             any());\n\n        doReturn(mock(JGitPathImpl.class)).when(service).createJGitPathImpl(eq(fs),\n                                                                            any(),\n                                                                            any(),\n                                                                            any(),\n                                                                            anyBoolean());\n\n        doReturn(\"commit message\").when(service).getFullCommitMessage(any());\n    }\n\n    @Test\n    public void createFirstChangeRequestTest() {\n        doReturn(Collections.emptyList()).when(spaceConfigStorage).getChangeRequestIds(\"myRepository\");\n\n        ChangeRequest newChangeRequest = service.createChangeRequest(\"mySpace\",\n                                                                     \"myRepository\",\n                                                                     \"sourceBranch\",\n                                                                     \"targetBranch\",\n                                                                     \"summary\",\n                                                                     \"description\");\n\n        assertThat(newChangeRequest.getId()).isEqualTo(1L);\n        verify(spaceConfigStorageRegistry.get(\"mySpace\")).saveChangeRequest(\"myRepository\",\n                                                                            newChangeRequest);\n        verify(changeRequestListUpdatedEvent).fire(any(ChangeRequestListUpdatedEvent.class));\n    }\n\n    @Test\n    public void createChangeRequestTest() {\n        List<Long> ids = Arrays.asList(1L, 10L, 2L, 3L, 4L);\n        doReturn(ids).when(spaceConfigStorage).getChangeRequestIds(\"myRepository\");\n\n        ChangeRequest newChangeRequest = service.createChangeRequest(\"mySpace\",\n                                                                     \"myRepository\",\n                                                                     \"sourceBranch\",\n                                                                     \"targetBranch\",\n                                                                     \"summary\",\n                                                                     \"description\");\n\n        assertThat(newChangeRequest.getId()).isEqualTo(11L);\n        assertThat(newChangeRequest.getStatus()).isEqualTo(ChangeRequestStatus.OPEN);\n        verify(spaceConfigStorageRegistry.get(\"mySpace\")).saveChangeRequest(\"myRepository\",\n                                                                            newChangeRequest);\n        verify(changeRequestListUpdatedEvent).fire(any(ChangeRequestListUpdatedEvent.class));\n    }\n\n    @Test(expected = ChangeRequestAlreadyOpenException.class)\n    public void createChangeRequestFailWhenAlreadyOpenTest() {\n        List<ChangeRequest> crList = Collections.singletonList(createCommonChangeRequest());\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.createChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    \"sourceBranch\",\n                                    \"targetBranch\",\n                                    \"summary\",\n                                    \"description\");\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void createChangeRequestInvalidRepositoryTest() {\n        service.createChangeRequest(\"mySpace\",\n                                    \"myOtherRepository\",\n                                    \"sourceBranch\",\n                                    \"targetBranch\",\n                                    \"summary\",\n                                    \"description\");\n    }\n\n    @Test\n    public void getChangeRequestsTest() {\n        List<ChangeRequest> crList = Collections.nCopies(5, createCommonChangeRequest());\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\");\n\n        assertThat(actualList).isNotEmpty();\n        assertThat(actualList).hasSize(5);\n    }\n\n    @Test\n    public void getChangeRequestUserCannotAccessBranchesTest() {\n        doReturn(false).when(branchAccessAuthorizer).authorize(anyString(),\n                                                               anyString(),\n                                                               anyString(),\n                                                               anyString(),\n                                                               anyString(),\n                                                               any());\n\n        List<ChangeRequest> crList = Collections.nCopies(5, mock(ChangeRequest.class));\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\");\n\n        assertThat(actualList).isEmpty();\n    }\n\n    @Test\n    public void getChangeRequestUserCanAccessSomeBranchesTest() {\n        doReturn(false).when(branchAccessAuthorizer).authorize(any(),\n                                                               any(),\n                                                               any(),\n                                                               any(),\n                                                               eq(\"hiddenBranch\"),\n                                                               any());\n\n        doReturn(true).when(branchAccessAuthorizer).authorize(any(),\n                                                              any(),\n                                                              any(),\n                                                              any(),\n                                                              eq(\"branch\"),\n                                                              any());\n\n        ChangeRequest cr1 = createCommonChangeRequestWithTargetBranch(\"hiddenBranch\");\n        ChangeRequest cr2 = createCommonChangeRequestWithTargetBranch(\"hiddenBranch\");\n        ChangeRequest cr3 = createCommonChangeRequestWithTargetBranch(\"targetBranch\");\n        ChangeRequest cr4 = createCommonChangeRequestWithTargetBranch(\"targetBranch\");\n\n        List<ChangeRequest> crList = Arrays.asList(cr1, cr2, cr3, cr4);\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\");\n\n        assertThat(actualList).isNotEmpty();\n        assertThat(actualList).hasSize(2);\n    }\n\n    @Test\n    public void getChangeRequestsWithFilterTest() {\n        ChangeRequest cr1 = createCommonChangeRequestWithSummary(\"findme\");\n        ChangeRequest cr2 = createCommonChangeRequestWithSummary(\"findme\");\n        ChangeRequest cr3 = createCommonChangeRequestWithSummary(\"hidden\");\n        ChangeRequest cr4 = createCommonChangeRequestWithSummary(\"hidden\");\n\n        List<ChangeRequest> crList = Arrays.asList(cr1, cr2, cr3, cr4);\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\",\n                                                                   \"find\");\n\n        assertThat(actualList).isNotEmpty();\n        assertThat(actualList).hasSize(2);\n    }\n\n    @Test\n    public void getChangeRequestsWithStatusTest() {\n        ChangeRequest cr1 = createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN);\n        ChangeRequest cr2 = createCommonChangeRequestWithStatus(ChangeRequestStatus.REJECTED);\n        ChangeRequest cr3 = createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED);\n        ChangeRequest cr4 = createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN);\n\n        List<ChangeRequest> crList = Arrays.asList(cr1, cr2, cr3, cr4);\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n        List<ChangeRequestStatus> statusList = new ArrayList<ChangeRequestStatus>() {{\n            add(ChangeRequestStatus.OPEN);\n        }};\n\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\",\n                                                                   statusList);\n\n        assertThat(actualList).isNotEmpty();\n        assertThat(actualList).hasSize(2);\n    }\n\n    @Test\n    public void getChangeRequestsWithStatusAndFilterTest() {\n        ChangeRequest cr1 = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.OPEN,\n                                                                       \"findme\");\n        ChangeRequest cr2 = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.REJECTED,\n                                                                       \"findme\");\n        ChangeRequest cr3 = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.ACCEPTED,\n                                                                       \"findme\");\n        ChangeRequest cr4 = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.OPEN,\n                                                                       \"findme\");\n\n        List<ChangeRequest> crList = Arrays.asList(cr1, cr2, cr3, cr4);\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n        List<ChangeRequestStatus> statusList = new ArrayList<ChangeRequestStatus>() {{\n            add(ChangeRequestStatus.OPEN);\n        }};\n\n        List<ChangeRequest> actualList = service.getChangeRequests(\"mySpace\",\n                                                                   \"myRepository\",\n                                                                   statusList,\n                                                                   \"find\");\n\n        assertThat(actualList).isNotEmpty();\n        assertThat(actualList).hasSize(2);\n    }\n\n    @Test\n    public void getChangeRequestsPaginatedWithFilterTest() {\n        ChangeRequest crsWithFilter = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.OPEN,\n                                                                                 \"findme\");\n\n        ChangeRequest crsHidden = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.OPEN,\n                                                                             \"hidden\");\n\n        List<ChangeRequest> crList = new ArrayList<ChangeRequest>() {{\n            addAll(Collections.nCopies(26, crsWithFilter));\n            addAll(Collections.nCopies(30, crsHidden));\n        }};\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        PaginatedChangeRequestList actualList = service.getChangeRequests(\"mySpace\",\n                                                                          \"myRepository\",\n                                                                          0,\n                                                                          10,\n                                                                          \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(10, (int) actualList.getChangeRequests().size());\n\n        actualList = service.getChangeRequests(\"mySpace\",\n                                               \"myRepository\",\n                                               1,\n                                               10,\n                                               \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(10, (int) actualList.getChangeRequests().size());\n\n        actualList = service.getChangeRequests(\"mySpace\",\n                                               \"myRepository\",\n                                               2,\n                                               10,\n                                               \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(6, (int) actualList.getChangeRequests().size());\n    }\n\n    @Test\n    public void getChangeRequestsPaginatedWithStatusAndFilterTest() {\n        ChangeRequest crsWithStatusAndFilter = createCommonChangeRequestWithStatusSummary(ChangeRequestStatus.ACCEPTED,\n                                                                                          \"findme\");\n\n        ChangeRequest crsOnlyFilter = createCommonChangeRequestWithSummary(\"findme\");\n\n        ChangeRequest crsOnlyStatus = createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED);\n\n        ChangeRequest crsHidden = createCommonChangeRequestWithSummary(\"hidden\");\n\n        List<ChangeRequest> crList = new ArrayList<ChangeRequest>() {{\n            addAll(Collections.nCopies(20, crsOnlyStatus));\n            addAll(Collections.nCopies(26, crsWithStatusAndFilter));\n            addAll(Collections.nCopies(20, crsOnlyFilter));\n            addAll(Collections.nCopies(30, crsHidden));\n        }};\n        List<ChangeRequestStatus> statusList = new ArrayList<ChangeRequestStatus>() {{\n            add(ChangeRequestStatus.ACCEPTED);\n        }};\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        PaginatedChangeRequestList actualList = service.getChangeRequests(\"mySpace\",\n                                                                          \"myRepository\",\n                                                                          0,\n                                                                          10,\n                                                                          statusList,\n                                                                          \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(10, (int) actualList.getChangeRequests().size());\n\n        actualList = service.getChangeRequests(\"mySpace\",\n                                               \"myRepository\",\n                                               1,\n                                               10,\n                                               statusList,\n                                               \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(10, (int) actualList.getChangeRequests().size());\n\n        actualList = service.getChangeRequests(\"mySpace\",\n                                               \"myRepository\",\n                                               2,\n                                               10,\n                                               statusList,\n                                               \"find\");\n\n        assertThat(actualList.getChangeRequests()).isNotEmpty();\n        assertEquals(6, (int) actualList.getChangeRequests().size());\n    }\n\n    @Test\n    public void getChangeRequestTest() {\n        ChangeRequest cr1 = createCommonChangeRequestWithId(1L);\n        ChangeRequest cr2 = createCommonChangeRequestWithId(2L);\n        ChangeRequest cr3 = createCommonChangeRequestWithId(3L);\n        ChangeRequest cr4 = createCommonChangeRequestWithId(4L);\n\n        List<ChangeRequest> crList = Arrays.asList(cr1, cr2, cr3, cr4);\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        ChangeRequest actual = service.getChangeRequest(\"mySpace\",\n                                                        \"myRepository\",\n                                                        3L);\n\n        assertThat(actual.getId()).isEqualTo(3L);\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void getChangeRequestNotFoundTest() {\n        service.getChangeRequest(\"mySpace\",\n                                 \"myRepository\",\n                                 10L);\n    }\n\n    @Test\n    public void countChangeRequestsTest() {\n        List<ChangeRequest> crList = new ArrayList<>();\n        crList.addAll(Collections.nCopies(15, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN)));\n        crList.addAll(Collections.nCopies(5, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED)));\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        ChangeRequestCountSummary countSummary = service.countChangeRequests(\"mySpace\",\n                                                                             \"myRepository\");\n\n        assertEquals(15, (int) countSummary.getOpen());\n        assertEquals(20, (int) countSummary.getTotal());\n    }\n\n    @Test\n    public void getDiffTestNoResultsTest() {\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(Collections.emptyList()).when(git).textualDiffRefs(anyString(),\n                                                                    anyString());\n\n        List<ChangeRequestDiff> diffs = service.getDiff(\"mySpace\",\n                                                        \"myRepository\",\n                                                        \"sourceBranch\",\n                                                        \"targetBranch\");\n\n        assertThat(diffs).isEmpty();\n    }\n\n    @Test\n    public void getDiffTestNoResultsForChangeRequestTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequest());\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(Collections.emptyList()).when(git).textualDiffRefs(anyString(),\n                                                                    anyString());\n\n        List<ChangeRequestDiff> diffs = service.getDiff(\"mySpace\",\n                                                        \"myRepository\",\n                                                        1L);\n\n        assertThat(diffs).isEmpty();\n    }\n\n    @Test\n    public void getDiffTestWithResultsTest() {\n        doReturn(mock(Path.class)).when(sourceBranch).getPath();\n\n        doReturn(mock(Path.class)).when(targetBranch).getPath();\n\n        TextualDiff textualDiff = new TextualDiff(\"old/file/path\",\n                                                  \"new/file/path\",\n                                                  \"ADD\",\n                                                  10,\n                                                  10,\n                                                  \"diff text\");\n\n        List<TextualDiff> diffList = Collections.nCopies(10, textualDiff);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(any(),\n                                                                            any());\n        doReturn(diffList).when(git).textualDiffRefs(any(),\n                                                     any(),\n                                                     any(),\n                                                     any());\n        List<ChangeRequestDiff> diffs = service.getDiff(\"mySpace\",\n                                                        \"myRepository\",\n                                                        \"sourceBranch\",\n                                                        \"targetBranch\");\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(10);\n    }\n\n    @Test\n    public void getDiffTestWithResultsForChangeRequestTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequest());\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        doReturn(mock(Path.class)).when(sourceBranch).getPath();\n\n        doReturn(mock(Path.class)).when(targetBranch).getPath();\n\n        TextualDiff textualDiff = new TextualDiff(\"old/file/path\",\n                                                  \"new/file/path\",\n                                                  \"ADD\",\n                                                  10,\n                                                  10,\n                                                  \"diff text\");\n\n        List<TextualDiff> diffList = Collections.nCopies(10, textualDiff);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(any(),\n                                                                            any());\n        doReturn(diffList).when(git).textualDiffRefs(any(),\n                                                     any(),\n                                                     any(),\n                                                     any());\n        List<ChangeRequestDiff> diffs = service.getDiff(\"mySpace\",\n                                                        \"myRepository\",\n                                                        1L);\n\n        assertThat(diffs).isNotEmpty();\n        assertThat(diffs).hasSize(10);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void getDiffTestInvalidBranchTest() {\n        doReturn(Optional.ofNullable(null)).when(repository).getBranch(\"branchA\");\n\n        service.getDiff(\"mySpace\",\n                        \"myRepository\",\n                        \"branchA\",\n                        \"branchB\");\n    }\n\n    @Test(expected = NoSuchElementException.class)\n    public void getDiffTestInvalidChangeRequestTest() {\n        service.getDiff(\"mySpace\",\n                        \"myRepository\",\n                        10L);\n    }\n\n    @Test\n    public void deleteChangeRequestsTest() {\n        ChangeRequest crs = createCommonChangeRequestWithTargetBranch(\"hiddenBranch\");\n        List<ChangeRequest> crList = Collections.nCopies(10, crs);\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.deleteChangeRequests(\"mySpace\",\n                                     \"myRepository\",\n                                     \"sourceBranch\");\n\n        verify(spaceConfigStorage, times(10)).deleteChangeRequest(anyString(),\n                                                                  anyLong());\n\n        verify(changeRequestListUpdatedEvent).fire(any(ChangeRequestListUpdatedEvent.class));\n    }\n\n    @Test\n    public void deleteChangeRequestsSomeTest() {\n        ChangeRequest crsSourceBranch = createCommonChangeRequestWithSourceTargetBranch(\"branch\",\n                                                                                        \"hiddenBranch\");\n\n        ChangeRequest crsTargetBranch = createCommonChangeRequestWithSourceTargetBranch(\"hiddenBranch\",\n                                                                                        \"branch\");\n\n        ChangeRequest crsHidden = createCommonChangeRequestWithSourceTargetBranch(\"hiddenBranch\",\n                                                                                  \"hiddenBranch\");\n\n        doReturn(Optional.of(mock(Branch.class))).when(repository).getBranch(\"branch\");\n\n        List<ChangeRequest> crList = new ArrayList<ChangeRequest>() {{\n            addAll(Collections.nCopies(10, crsSourceBranch));\n            addAll(Collections.nCopies(20, crsTargetBranch));\n            addAll(Collections.nCopies(15, crsHidden));\n        }};\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.deleteChangeRequests(\"mySpace\",\n                                     \"myRepository\",\n                                     \"branch\");\n\n        verify(spaceConfigStorage, times(30)).deleteChangeRequest(anyString(),\n                                                                  anyLong());\n\n        verify(changeRequestListUpdatedEvent).fire(any(ChangeRequestListUpdatedEvent.class));\n    }\n\n    @Test\n    public void deleteChangeRequestsNoneTest() {\n        ChangeRequest crs = createCommonChangeRequestWithSourceTargetBranch(\"hiddenBranch\",\n                                                                            \"hiddenBranch\");\n\n        List<ChangeRequest> crList = Collections.nCopies(10, crs);\n\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.deleteChangeRequests(\"mySpace\",\n                                     \"myRepository\",\n                                     \"branch\");\n\n        verify(spaceConfigStorage, never()).deleteChangeRequest(anyString(),\n                                                                anyLong());\n\n        verify(changeRequestListUpdatedEvent, never()).fire(any(ChangeRequestListUpdatedEvent.class));\n    }\n\n    @Test\n    public void rejectChangeRequestSuccessTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.rejectChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void rejectChangeRequestFailWhenChangeRequestNotOpenTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.rejectChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n    }\n\n    @Test\n    public void closeChangeRequestSuccessTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.closeChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L);\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void closeChangeRequestFailWhenChangeRequestNotOpenTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.closeChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L);\n    }\n\n    @Test\n    public void reopenChangeRequestSuccessTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.CLOSED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.reopenChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void reopenChangeRequestFailWhenChangeRequestNotClosedTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.reopenChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n    }\n\n    @Test(expected = ChangeRequestAlreadyOpenException.class)\n    public void reopenChangeRequestFailWhenOtherIsOpenSameBranchesTest() {\n        ChangeRequest crToReopen = createCommonChangeRequestWithIdStatus(1L, ChangeRequestStatus.REJECTED);\n        ChangeRequest otherOpen = createCommonChangeRequestWithIdStatus(2L, ChangeRequestStatus.OPEN);\n\n        List<ChangeRequest> crList = Stream.of(crToReopen, otherOpen).collect(Collectors.toList());\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.reopenChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n    }\n\n    @Test\n    public void mergeChangeRequestSuccessTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        DiffEntry diffEntry = mock(DiffEntry.class);\n        doReturn(\"old/file/path\").when(diffEntry).getOldPath();\n        doReturn(\"new/file/path\").when(diffEntry).getNewPath();\n        doReturn(DiffEntry.ChangeType.MODIFY).when(diffEntry).getChangeType();\n        List<DiffEntry> diffList = Collections.nCopies(10, diffEntry);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(diffList).when(git).listDiffs(anyString(),\n                                               anyString());\n\n        List<String> commitList = Stream.of(\"commit-id\").collect(Collectors.toList());\n        doReturn(commitList).when(git).merge(anyString(),\n                                             anyString(),\n                                             eq(true),\n                                             eq(false),\n                                             any());\n\n        boolean result = service.mergeChangeRequest(\"mySpace\",\n                                                    \"myRepository\",\n                                                    1L);\n\n        verify(git).merge(anyString(),\n                          anyString(),\n                          eq(true),\n                          eq(false),\n                          any());\n\n        verify(fs).publishEvents(any(org.uberfire.java.nio.file.Path.class),\n                                 anyList());\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n\n        verify(provider).executePostCommitHook(fs);\n\n        assertTrue(result);\n    }\n\n    @Test(expected = NothingToMergeException.class)\n    public void mergeChangeRequestFailWhenThereIsNoChangesTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        DiffEntry diffEntry = mock(DiffEntry.class);\n        doReturn(\"old/file/path\").when(diffEntry).getOldPath();\n        doReturn(\"new/file/path\").when(diffEntry).getNewPath();\n        doReturn(DiffEntry.ChangeType.MODIFY).when(diffEntry).getChangeType();\n        List<DiffEntry> diffList = Collections.nCopies(10, diffEntry);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(diffList).when(git).listDiffs(anyString(),\n                                               anyString());\n\n        doReturn(Collections.emptyList()).when(git).merge(anyString(),\n                                                          anyString(),\n                                                          eq(true),\n                                                          eq(false),\n                                                          any());\n\n        service.mergeChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void mergeChangeRequestFailWhenChangeRequestNotOpenTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.mergeChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L);\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void revertChangeRequestFailWhenChangeRequestNotAcceptedTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.REJECTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.revertChangeRequest(\"mySpace\",\n                                    \"myRepository\",\n                                    1L);\n    }\n\n    @Test\n    public void revertChangeRequestFailTest() {\n        final String lastCommitId = \"abcde12\";\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatusLastCommitId(ChangeRequestStatus.ACCEPTED,\n                                                                                                            lastCommitId));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        doReturn(false).when(git).revertMerge(anyString(),\n                                              anyString(),\n                                              anyString(),\n                                              anyString());\n\n        boolean result = service.revertChangeRequest(\"mySpace\",\n                                                     \"myRepository\",\n                                                     1L);\n\n        verify(fs, never()).publishEvents(any(org.uberfire.java.nio.file.Path.class),\n                                          anyList());\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n\n        assertFalse(result);\n    }\n\n    @Test\n    public void revertChangeRequestSuccessTest() {\n        final String lastCommitId = \"0000000000000000000000000000000000000000\";\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatusLastCommitId(ChangeRequestStatus.ACCEPTED,\n                                                                                                            lastCommitId));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        RevCommit commit = mock(RevCommit.class);\n        doReturn(commit).when(git).getLastCommit(\"targetBranch\");\n\n        doReturn(true).when(git).commit(eq(\"targetBranch\"),\n                                        any(),\n                                        eq(false),\n                                        any(),\n                                        any());\n\n        DiffEntry diffEntry = mock(DiffEntry.class);\n        doReturn(\"old/file/path\").when(diffEntry).getOldPath();\n        doReturn(\"new/file/path\").when(diffEntry).getNewPath();\n        doReturn(DiffEntry.ChangeType.MODIFY).when(diffEntry).getChangeType();\n        List<DiffEntry> diffList = Collections.nCopies(10, diffEntry);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(any(),\n                                                                            any());\n        doReturn(diffList).when(git).listDiffs(Mockito.<String>any(),\n                                               any());\n\n        doReturn(true).when(git).revertMerge(any(),\n                                             any(),\n                                             any(),\n                                             any());\n\n        boolean result = service.revertChangeRequest(\"mySpace\",\n                                                     \"myRepository\",\n                                                     1L);\n\n        verify(fs).publishEvents(any(org.uberfire.java.nio.file.Path.class),\n                                 anyList());\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n\n        verify(provider).executePostCommitHook(fs);\n\n        assertTrue(result);\n    }\n\n    @Test\n    public void updateChangeRequestSummaryTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.updateChangeRequestSummary(\"mySpace\",\n                                           \"myRepository\",\n                                           1L,\n                                           \"newSummary\");\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n        verify(changeRequestUpdatedEvent).fire(any(ChangeRequestUpdatedEvent.class));\n    }\n\n    @Test\n    public void updateChangeRequestDescriptionTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.updateChangeRequestDescription(\"mySpace\",\n                                               \"myRepository\",\n                                               1L,\n                                               \"newDescription\");\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n        verify(changeRequestUpdatedEvent).fire(any(ChangeRequestUpdatedEvent.class));\n    }\n\n    @Test\n    public void getCommentsAllTest() {\n        ChangeRequestComment comment = new ChangeRequestComment(1L, \"author\", new Date(), \"text\");\n        List<ChangeRequestComment> commentList = Collections.nCopies(3, comment);\n        doReturn(commentList).when(spaceConfigStorage).loadChangeRequestComments(\"myRepository\", 1L);\n\n        PaginatedChangeRequestCommentList paginatedList = service.getComments(\"mySpace\",\n                                                                              \"myRepository\",\n                                                                              1L,\n                                                                              0,\n                                                                              0);\n\n        assertEquals(3, (int) paginatedList.getChangeRequestComments().size());\n    }\n\n    @Test\n    public void getCommentsPaginatedTest() {\n        ChangeRequestComment comment = new ChangeRequestComment(1L, \"author\", new Date(), \"text\");\n        List<ChangeRequestComment> commentList = Collections.nCopies(25, comment);\n        doReturn(commentList).when(spaceConfigStorage).loadChangeRequestComments(\"myRepository\", 1L);\n\n        int page0Size = service.getComments(\"mySpace\",\n                                            \"myRepository\",\n                                            1L,\n                                            0,\n                                            10).getChangeRequestComments().size();\n\n        int page1Size = service.getComments(\"mySpace\",\n                                            \"myRepository\",\n                                            1L,\n                                            1,\n                                            10).getChangeRequestComments().size();\n\n        int page2Size = service.getComments(\"mySpace\",\n                                            \"myRepository\",\n                                            1L,\n                                            2,\n                                            10).getChangeRequestComments().size();\n\n        int page3Size = service.getComments(\"mySpace\",\n                                            \"myRepository\",\n                                            1L,\n                                            3,\n                                            10).getChangeRequestComments().size();\n\n        assertEquals(10, page0Size);\n        assertEquals(10, page1Size);\n        assertEquals(5, page2Size);\n        assertEquals(0, page3Size);\n    }\n\n    @Test\n    public void addCommentTest() {\n        doReturn(Collections.emptyList()).when(spaceConfigStorage).getChangeRequestCommentIds(\"myRepository\", 1L);\n\n        service.addComment(\"mySpace\",\n                           \"myRepository\",\n                           1L,\n                           \"myComment\");\n\n        verify(spaceConfigStorageRegistry.get(\"mySpace\")).saveChangeRequestComment(eq(\"myRepository\"),\n                                                                                   eq(1L),\n                                                                                   any(ChangeRequestComment.class));\n        verify(changeRequestUpdatedEvent).fire(any(ChangeRequestUpdatedEvent.class));\n    }\n\n    @Test\n    public void deleteCommentTest() {\n        service.deleteComment(\"mySpace\",\n                              \"myRepository\",\n                              1L,\n                              1L);\n\n        verify(spaceConfigStorageRegistry.get(\"mySpace\")).deleteChangeRequestComment(eq(\"myRepository\"),\n                                                                                     eq(1L),\n                                                                                     eq(1L));\n        verify(changeRequestUpdatedEvent).fire(any(ChangeRequestUpdatedEvent.class));\n    }\n\n    @Test\n    public void squashChangeRequestSuccessTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        DiffEntry diffEntry = mock(DiffEntry.class);\n        doReturn(\"old/file/path\").when(diffEntry).getOldPath();\n        doReturn(\"new/file/path\").when(diffEntry).getNewPath();\n        doReturn(DiffEntry.ChangeType.MODIFY).when(diffEntry).getChangeType();\n        List<DiffEntry> diffList = Collections.nCopies(10, diffEntry);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(diffList).when(git).listDiffs(anyString(),\n                                               anyString());\n\n        List<String> commitList = Stream.of(\"commit-id\").collect(Collectors.toList());\n        doReturn(commitList).when(git).merge(anyString(),\n                                             anyString(),\n                                             eq(true),\n                                             eq(true),\n                                             any(CommitInfo.class));\n\n        boolean result = service.squashChangeRequest(\"mySpace\",\n                                                     \"myRepository\",\n                                                     1L,\n                                                     \"myComment\");\n\n        verify(git).merge(anyString(),\n                          anyString(),\n                          eq(true),\n                          eq(true),\n                          any(CommitInfo.class));\n\n        verify(fs).publishEvents(any(org.uberfire.java.nio.file.Path.class),\n                                 anyList());\n\n        verify(spaceConfigStorage).saveChangeRequest(eq(\"myRepository\"),\n                                                     any(ChangeRequest.class));\n\n        verify(changeRequestStatusUpdatedEventEvent).fire(any(ChangeRequestStatusUpdatedEvent.class));\n\n        verify(provider).executePostCommitHook(fs);\n\n        assertTrue(result);\n    }\n\n    @Test(expected = NothingToMergeException.class)\n    public void squashChangeRequestFailWhenThereIsNoChangesTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        DiffEntry diffEntry = mock(DiffEntry.class);\n        doReturn(\"old/file/path\").when(diffEntry).getOldPath();\n        doReturn(\"new/file/path\").when(diffEntry).getNewPath();\n        doReturn(DiffEntry.ChangeType.MODIFY).when(diffEntry).getChangeType();\n        List<DiffEntry> diffList = Collections.nCopies(10, diffEntry);\n\n        doReturn(Collections.emptyList()).when(git).conflictBranchesChecker(anyString(),\n                                                                            anyString());\n        doReturn(diffList).when(git).listDiffs(anyString(),\n                                               anyString());\n\n        doReturn(Collections.emptyList()).when(git).merge(anyString(),\n                                                          anyString(),\n                                                          eq(true),\n                                                          eq(true),\n                                                          any(CommitInfo.class));\n\n        service.squashChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L,\n                                   \"myComment\");\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void squashChangeRequestFailWhenChangeRequestNotOpenTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.ACCEPTED));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.squashChangeRequest(\"mySpace\",\n                                   \"myRepository\",\n                                   1L,\n                                   \"myComment\");\n    }\n\n    @Test\n    public void getCommitsTest() {\n        List<ChangeRequest> crList = Collections.nCopies(3, createCommonChangeRequestWithStatus(ChangeRequestStatus.OPEN));\n        doReturn(crList).when(spaceConfigStorage).loadChangeRequests(\"myRepository\");\n\n        service.getCommits(\"mySpace\",\n                           \"myRepository\",\n                           1L);\n\n        verify(git).listCommits(\"commonCommitId\",\n                                lastCommit.getName());\n    }\n\n    private ChangeRequest createCommonChangeRequestWithFields(final Long id,\n                                                              final String sourceBranch,\n                                                              final String targetBranch,\n                                                              final ChangeRequestStatus status,\n                                                              final String summary,\n                                                              final String lastCommitId) {\n        return new ChangeRequest(id,\n                                 \"mySpace\",\n                                 \"myRepository\",\n                                 sourceBranch,\n                                 targetBranch,\n                                 status,\n                                 \"author\",\n                                 summary,\n                                 \"description\",\n                                 new Date(),\n                                 \"commonCommitId\",\n                                 lastCommitId,\n                                 null);\n    }\n\n    private ChangeRequest createCommonChangeRequest() {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   ChangeRequestStatus.OPEN,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithId(final Long id) {\n        return createCommonChangeRequestWithFields(id,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   ChangeRequestStatus.OPEN,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithStatus(final ChangeRequestStatus status) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   status,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithSummary(final String summary) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   ChangeRequestStatus.OPEN,\n                                                   summary,\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithSourceBranch(final String sourceBranch) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   sourceBranch,\n                                                   \"targetBranch\",\n                                                   ChangeRequestStatus.OPEN,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithTargetBranch(final String targetBranch) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   targetBranch,\n                                                   ChangeRequestStatus.OPEN,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithStatusLastCommitId(final ChangeRequestStatus status,\n                                                                          final String lastCommitId) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   status,\n                                                   \"summary\",\n                                                   lastCommitId);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithSourceTargetBranch(final String sourceBranch,\n                                                                          final String targetBranch) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   sourceBranch,\n                                                   targetBranch,\n                                                   ChangeRequestStatus.OPEN,\n                                                   \"summary\",\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithStatusSummary(final ChangeRequestStatus status,\n                                                                     final String summary) {\n        return createCommonChangeRequestWithFields(1L,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   status,\n                                                   summary,\n                                                   null);\n    }\n\n    private ChangeRequest createCommonChangeRequestWithIdStatus(final Long id,\n                                                                final ChangeRequestStatus status) {\n        return createCommonChangeRequestWithFields(id,\n                                                   \"sourceBranch\",\n                                                   \"targetBranch\",\n                                                   status,\n                                                   \"summary\",\n                                                   null);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/ConfiguredRepositoriesTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.guvnor.structure.server.repositories.RepositoryFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.spaces.Space;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConfiguredRepositoriesTest {\n\n    public static final Space SPACE1 = new Space(\"space1\");\n    public static final String REPO1S1 = \"single\";\n    public static final String REPO2S1 = \"multibranch\";\n\n    public static final Space SPACE2 = new Space(\"space2\");\n    public static final String REPO1S2 = \"singles2\";\n    public static final String REPO2S2 = \"multibranchs2\";\n    public static final String REPO3S2 = \"multibranchs3\";\n\n    @Mock\n    private RepositoryFactory repositoryFactory;\n\n    private ConfiguredRepositories configuredRepositories;\n\n    @Mock\n    private SpaceConfigStorageRegistry spaceConfigStorageRegistry;\n\n    @Before\n    public void setUp() throws Exception {\n\n        ArrayList<RepositoryInfo> repositoriesSpace1 = new ArrayList<>();\n        repositoriesSpace1.add(addRepository(SPACE1,\n                                             REPO1S1,\n                                             createAdminContributors(\"admin1\"),\n                                             \"main\"));\n        repositoriesSpace1.add(addRepository(SPACE1,\n                                             REPO2S1,\n                                             createAdminContributors(\"admin1\"),\n                                             \"main\",\n                                             \"dev\",\n                                             \"release\"));\n\n        SpaceInfo space1 = new SpaceInfo(SPACE1.getName(),\n                                         \"Test Space\",\n                                         \"com.space1\",\n                                         createAdminContributors(\"admin1\"),\n                                         repositoriesSpace1,\n                                         Collections.emptyList());\n\n        ArrayList<RepositoryInfo> repositoriesSpace2 = new ArrayList<>();\n        repositoriesSpace2.add(addRepository(SPACE2,\n                                             REPO1S2,\n                                             Collections.emptyList(),\n                                             \"main\"));\n        repositoriesSpace2.add(addRepository(SPACE2,\n                                             REPO2S2,\n                                             Collections.emptyList(),\n                                             \"main\",\n                                             \"dev\",\n                                             \"release\"));\n        repositoriesSpace2.add(addRepository(SPACE2,\n                                             REPO3S2,\n                                             Collections.emptyList(),\n                                             \"main\",\n                                             \"dev\",\n                                             \"release\"));\n\n        SpaceInfo space2 = new SpaceInfo(SPACE2.getName(),\n                                         \"Test space\",\n                                         \"com.space2\",\n                                         createAdminContributors(\"admin2\"),\n                                         repositoriesSpace2,\n                                         Collections.emptyList());\n\n        Map<String, SpaceInfo> spaces = new HashMap<>();\n        spaces.put(SPACE1.getName(),\n                   space1);\n        spaces.put(SPACE2.getName(),\n                   space2);\n\n        doAnswer(invocationOnMock -> {\n            final SpaceConfigStorage spaceConfigStorage = mock(SpaceConfigStorage.class);\n            String spaceName = (String) invocationOnMock.getArguments()[0];\n            doReturn(spaces.get(spaceName)).when(spaceConfigStorage).loadSpaceInfo();\n            return spaceConfigStorage;\n        }).when(spaceConfigStorageRegistry).get(any());\n\n        configuredRepositories = new ConfiguredRepositoriesImpl(repositoryFactory,\n                                                                spaceConfigStorageRegistry);\n    }\n\n    private List<Contributor> createAdminContributors(String... username) {\n        List<Contributor> contributors = new ArrayList<>();\n        for (int i = 0; i < username.length; i++) {\n            contributors.add(new Contributor(username[i],\n                                             ContributorType.OWNER));\n        }\n        return contributors;\n    }\n\n    private RepositoryInfo addRepository(final Space space,\n                                         final String alias,\n                                         final List<Contributor> contributors,\n                                         final String... branches) {\n\n        RepositoryConfiguration config = new RepositoryConfiguration();\n        RepositoryInfo repositoryInfo = new RepositoryInfo(alias,\n                                                           false,\n                                                           config);\n        config.add(\"contributors\",\n                   contributors);\n        final GitRepository repository = new GitRepository(alias,\n                                                           space);\n\n        final HashMap<String, Branch> branchMap = new HashMap<>();\n\n        for (String branch : branches) {\n\n            Path path = PathFactory.newPath(alias + \".txt\",\n                                            \"default://main@myteam/mortgages/\" + alias + \".txt\");\n            branchMap.put(branch,\n                          new Branch(branch,\n                                     path));\n        }\n        repository.setBranches(branchMap);\n        when(repositoryFactory.newRepository(repositoryInfo)).thenReturn(repository);\n        return repositoryInfo;\n    }\n\n    @Test\n    public void testLoadRepositories() {\n        assertEquals(2,\n                     configuredRepositories.getAllConfiguredRepositories(SPACE1).size());\n        assertEquals(3,\n                     configuredRepositories.getAllConfiguredRepositories(SPACE2).size());\n    }\n\n    @Test\n    public void testLoadSingle() {\n        final Repository single = configuredRepositories.getRepositoryByRepositoryAlias(SPACE1,\n                                                                                        REPO1S1);\n        assertEquals(1,\n                     single.getBranches().size());\n        assertNotNull(single.getBranch(\"main\"));\n    }\n\n    @Test\n    public void testLoadMultiBranch() {\n        final Repository single = configuredRepositories.getRepositoryByRepositoryAlias(SPACE1,\n                                                                                        REPO2S1);\n        assertEquals(3,\n                     single.getBranches().size());\n        assertNotNull(single.getBranch(\"main\"));\n        assertNotNull(single.getBranch(\"dev\"));\n        assertNotNull(single.getBranch(\"release\"));\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/LoadReposOnAppInitTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class LoadReposOnAppInitTest {\n\n    @Mock\n    private ConfiguredRepositories configuredRepositories;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Before\n    public void setUp() throws Exception {\n        when(organizationalUnitService.getAllOrganizationalUnits())\n                .thenReturn(new ArrayList<OrganizationalUnit>() {{\n                    add(new OrganizationalUnitImpl(\"test\", \"test\"));\n                }});\n    }\n\n    @Test\n    public void testLoadRepositories() {\n\n        final LoadReposOnAppInit loadReposOnAppInit = spy(new LoadReposOnAppInit(configuredRepositories,\n                                                                                 organizationalUnitService));\n\n        doReturn(true).when(loadReposOnAppInit).isGitDefaultFileSystem();\n        loadReposOnAppInit.execute();\n        verify(configuredRepositories, times(1)).getAllConfiguredRepositories(any());\n    }\n\n    @Test\n    public void testOnlyRunInBCServerType() {\n        {\n            LoadReposOnAppInit loadReposOnInit = spy(new LoadReposOnAppInit(configuredRepositories,\n                                                                            organizationalUnitService));\n            doReturn(false).when(loadReposOnInit).isGitDefaultFileSystem();\n            loadReposOnInit.execute();\n            verify(organizationalUnitService, never()).getAllOrganizationalUnits();\n        }\n        {\n            LoadReposOnAppInit loadReposOnInit = spy(new LoadReposOnAppInit(configuredRepositories,\n                                                                            organizationalUnitService));\n            doReturn(true).when(loadReposOnInit).isGitDefaultFileSystem();\n            loadReposOnInit.execute();\n            verify(organizationalUnitService, times(1)).getAllOrganizationalUnits();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/RepositoryCopierImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.backend.repositories;\n\nimport java.net.URI;\nimport java.util.Optional;\n\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mocks.FileSystemTestingUtils;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RepositoryCopierImplTest {\n\n    private static final String PATH_PREFIX = \"git://amend-repo-test/\";\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    @Mock\n    private EventSourceMock<NewBranchEvent> newBranchEventEvent;\n\n    @Mock\n    private ConfiguredRepositories configuredRepositories;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private Repository repository;\n\n    @Mock\n    private Branch branch;\n\n    @Mock\n    private User user;\n\n    private RepositoryCopierImpl copier;\n\n    private IOService ioService;\n\n    @Before\n    public void setUp() throws Exception {\n        doReturn(\"user\").when(user).getIdentifier();\n\n        fileSystemTestingUtils.setup();\n        ioService = spy(fileSystemTestingUtils.getIoService());\n\n        copier = new RepositoryCopierImpl(ioService,\n                                          newBranchEventEvent,\n                                          configuredRepositories,\n                                          repositoryService,\n                                          sessionInfo);\n    }\n\n    @After\n    public void cleanupFileSystem() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void makeSafeName() throws Exception {\n        assertEquals(\"hello\", copier.makeSafeRepositoryName(\"hello\"));\n        assertEquals(\"test-this\", copier.makeSafeRepositoryName(\"test this\"));\n    }\n\n    @Test\n    public void withExistingBranch() throws Exception {\n        final org.uberfire.java.nio.file.Path nioFrom = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from\"));\n        final Path from = Paths.convert(nioFrom);\n\n        fileSystemTestingUtils.getIoService().createDirectory(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from/sub1\")));\n        fileSystemTestingUtils.getIoService().createDirectory(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from/sub2\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from/sub1/file1.txt\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from/sub1/file2.txt\")));\n        fileSystemTestingUtils.getIoService().createFile(fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from/sub2/file3.txt\")));\n\n        final org.uberfire.java.nio.file.Path nioTo = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"to\"));\n        final Path to = Paths.convert(nioTo);\n\n        fileSystemTestingUtils.getIoService().createDirectory(nioTo);\n\n        doReturn(repository).when(repositoryService).getRepository(to);\n\n        copier.copy(from,\n                    to);\n\n        verify(ioService).startBatch(fileSystemTestingUtils.getFileSystem());\n        verify(ioService).endBatch();\n        verify(newBranchEventEvent,\n               never()).fire(any(NewBranchEvent.class));\n    }\n\n    @Test\n    public void testFireNewBranchEvent() throws Exception {\n        final org.uberfire.java.nio.file.Path nioFrom = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"from\"));\n\n        final org.uberfire.java.nio.file.Path nioTo = fileSystemTestingUtils.getIoService().get(URI.create(PATH_PREFIX + \"to\"));\n        final Path to = Paths.convert(nioTo);\n\n        doReturn(repository).when(repositoryService).getRepository(any(Path.class));\n        when(repository.getBranch(any(Path.class))).thenReturn(Optional.of(branch));\n        when(branch.getName()).thenReturn(\"testBranch\");\n\n        when(sessionInfo.getIdentity()).thenReturn(user);\n\n        copier.fireNewBranchEvent(to, nioTo, nioFrom);\n\n        verify(newBranchEventEvent,\n               times(1)).fire(any(NewBranchEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/RepositorySearchServiceTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.when;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.spaces.Space;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RepositorySearchServiceTest {\n\n    @Mock\n    RepositoryService resourceService;\n\n    @Mock\n    Repository itemA;\n\n    @Mock\n    Repository itemB;\n\n    @Mock\n    OrganizationalUnitService orgUnitService;\n\n    Space space;\n\n    private RepositorySearchServiceImpl searchService;\n\n    @Before\n    public void setUp() throws Exception {\n        space = new Space(\"test-realm\");\n        when(orgUnitService.getAllUserSpaces()).thenReturn(Collections.singletonList(space));\n        when(itemA.getIdentifier()).thenReturn(\"itemA\");\n        when(itemB.getIdentifier()).thenReturn(\"itemB\");\n        when(itemA.getAlias()).thenReturn(\"Item A\");\n        when(itemB.getAlias()).thenReturn(\"Item B\");\n        when(resourceService.getAllRepositories(space)).thenReturn(Arrays.asList(itemA,\n                                                                            itemB));\n        searchService = new RepositorySearchServiceImpl(resourceService, orgUnitService);\n    }\n\n    @Test\n    public void testSearchById() throws Exception {\n        Collection<Repository> result = searchService.searchById(Arrays.asList(\"itemA\"));\n        assertEquals(result.size(),\n                     1);\n        assertEquals(result.iterator().next().getAlias(),\n                     \"Item A\");\n    }\n\n    @Test\n    public void testSearchByAlias() throws Exception {\n        Collection<Repository> result = searchService.searchByAlias(\"Item\",\n                                                                    10,\n                                                                    true);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchCaseSensitiveEmpty() throws Exception {\n        Collection<Repository> result = searchService.searchByAlias(\"item\",\n                                                                    10,\n                                                                    true);\n        assertEquals(result.size(),\n                     0);\n    }\n\n    @Test\n    public void testSearchCaseUnsensitive() throws Exception {\n        Collection<Repository> result = searchService.searchByAlias(\"item\",\n                                                                    10,\n                                                                    false);\n        assertEquals(result.size(),\n                     2);\n    }\n\n    @Test\n    public void testSearchMaxItems() throws Exception {\n        Collection<Repository> result = searchService.searchByAlias(\"item\",\n                                                                    1,\n                                                                    false);\n        assertEquals(result.size(),\n                     1);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/RepositoryServiceImplTest.java",
    "content": "package org.guvnor.structure.backend.repositories;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.Optional;\nimport java.util.function.Consumer;\n\nimport javax.enterprise.event.Event;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.common.services.project.events.RepositoryContributorsUpdatedEvent;\nimport org.guvnor.structure.backend.organizationalunit.config.SpaceConfigStorageRegistryImpl;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorage;\nimport org.guvnor.structure.organizationalunit.config.SpaceConfigStorageRegistry;\nimport org.guvnor.structure.organizationalunit.config.SpaceInfo;\nimport org.guvnor.structure.repositories.GitMetadataStore;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.guvnor.structure.server.repositories.RepositoryFactory;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.InOrder;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.guvnor.structure.backend.InputEscapeUtils.escapeHtmlInput;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class RepositoryServiceImplTest {\n\n    @Mock\n    private Repository repository;\n\n    @Mock\n    private ConfiguredRepositories configuredRepositories;\n\n    @Mock\n    private SpaceConfigStorageRegistry registry;\n\n    @Mock\n    private Event<RepositoryContributorsUpdatedEvent> updatedEvent;\n\n    @Mock\n    private GitMetadataStore gitMetadataStore;\n\n    @Mock\n    private OrganizationalUnitService organizationalUnitService;\n\n    @Mock\n    private SpacesAPI spacesAPI;\n\n    @Mock\n    private PasswordService passwordService;\n\n    @Mock\n    private RepositoryFactory repositoryFactory;\n\n    @InjectMocks\n    @Spy\n    private RepositoryServiceImpl repositoryService;\n\n    @Captor\n    private ArgumentCaptor<RepositoryContributorsUpdatedEvent> captor;\n\n    @Captor\n    private ArgumentCaptor<RepositoryInfo> configCaptor;\n\n    @Before\n    public void setUp() {\n        doAnswer(invocationOnMock -> null).when(gitMetadataStore).delete(anyString());\n    }\n\n    @Test\n    public void testNotCreateNewAliasIfNecessary() {\n        String newAlias = repositoryService.createFreshRepositoryAlias(\"alias\",\n                                                                       new Space(\"alias\"));\n\n        assertEquals(\"alias\",\n                     newAlias);\n    }\n\n    @Test\n    public void testCreateNewAliasIfNecessary() {\n        when(configuredRepositories.getRepositoryByRepositoryAlias(any(),\n                                                                   eq(\"alias\"),\n                                                                   eq(true))).thenReturn(repository);\n        String newAlias = repositoryService.createFreshRepositoryAlias(\"alias\",\n                                                                       new Space(\"alias\"));\n\n        assertEquals(\"alias-1\",\n                     newAlias);\n    }\n\n    @Test\n    public void testCreateSecondNewAliasIfNecessary() {\n        when(configuredRepositories.getRepositoryByRepositoryAlias(any(),\n                                                                   eq(\"alias\"),\n                                                                   eq(true))).thenReturn(repository);\n        when(configuredRepositories.getRepositoryByRepositoryAlias(any(),\n                                                                   eq(\"alias-1\"),\n                                                                   eq(true))).thenReturn(repository);\n        String newAlias = repositoryService.createFreshRepositoryAlias(\"alias\",\n                                                                       new Space(\"alias\"));\n\n        assertEquals(\"alias-2\",\n                     newAlias);\n    }\n\n    @Test\n    public void updateContributorsTest() {\n\n        final Space space = new Space(\"space\");\n        doReturn(space).when(repository).getSpace();\n        doReturn(\"alias\").when(repository).getAlias();\n\n        doReturn(repository).when(configuredRepositories).getRepositoryByRepositoryAlias(any(),\n                                                                                         any());\n\n        final SpaceConfigStorage spaceConfigStorage = mock(SpaceConfigStorage.class);\n        doReturn(new SpaceInfo(\"space\",\n                               \"Test space\",\n                               \"defaultGroupId\",\n                               Collections.emptyList(),\n                               new ArrayList<>(Arrays.asList(new RepositoryInfo(\"alias\",\n                                                                                false,\n                                                                                new RepositoryConfiguration()))),\n                               Collections.emptyList())).when(spaceConfigStorage).loadSpaceInfo();\n\n        when(registry.get(anyString())).thenReturn(spaceConfigStorage);\n        when(registry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n\n        String username = \"admin1\";\n        repositoryService.updateContributors(repository,\n                                             Collections.singletonList(new Contributor(username,\n                                                                                       ContributorType.OWNER)));\n\n        verify(updatedEvent).fire(captor.capture());\n        assertEquals(\"alias\",\n                     captor.getValue().getRepository().getAlias());\n        assertEquals(\"space\",\n                     captor.getValue().getRepository().getSpace().getName());\n        verify(repositoryService).saveRepositoryConfig(eq(\"space\"),\n                                                       configCaptor.capture());\n\n        assertEquals(username,\n                     configCaptor.getValue().getContributors().get(0).getUsername());\n        assertEquals(ContributorType.OWNER,\n                     configCaptor.getValue().getContributors().get(0).getType());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void updateContributorsWithXSSNameTest() {\n\n        final Space space = new Space(\"space\");\n        doReturn(space).when(repository).getSpace();\n        doReturn(\"alias\").when(repository).getAlias();\n\n        doReturn(repository).when(configuredRepositories).getRepositoryByRepositoryAlias(any(),\n                                                                                         any());\n\n        final SpaceConfigStorage spaceConfigStorage = mock(SpaceConfigStorage.class);\n        doReturn(new SpaceInfo(\"space\",\n                               \"Test space\",\n                               \"defaultGroupId\",\n                               Collections.emptyList(),\n                               new ArrayList<>(Arrays.asList(new RepositoryInfo(\"alias\",\n                                                                                false,\n                                                                                new RepositoryConfiguration()))),\n                               Collections.emptyList())).when(spaceConfigStorage).loadSpaceInfo();\n\n        when(registry.get(anyString())).thenReturn(spaceConfigStorage);\n        when(registry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n\n        final String xssName = \"<img/src/onerror=alert(\\\"XSS\\\")>\";\n        final String escapedXssName = escapeHtmlInput(xssName);\n        repositoryService.updateContributors(repository,\n                                             Collections.singletonList(new Contributor(xssName,\n                                                                                       ContributorType.OWNER)));\n\n        verify(updatedEvent).fire(captor.capture());\n        assertEquals(\"alias\",\n                     captor.getValue().getRepository().getAlias());\n        assertEquals(\"space\",\n                     captor.getValue().getRepository().getSpace().getName());\n        verify(repositoryService).saveRepositoryConfig(eq(\"space\"),\n                                                       configCaptor.capture());\n\n        assertEquals(escapedXssName,\n                     configCaptor.getValue().getContributors().get(0).getUsername());\n        assertEquals(ContributorType.OWNER,\n                     configCaptor.getValue().getContributors().get(0).getType());\n\n        verify(spaceConfigStorage).startBatch();\n        verify(spaceConfigStorage).saveSpaceInfo(any());\n        verify(spaceConfigStorage).endBatch();\n    }\n\n    @Test\n    public void testDoRemoveInOrder() {\n\n        Consumer<Repository> notification = mock(Consumer.class);\n        OrganizationalUnit orgUnit = mock(OrganizationalUnit.class);\n        String alias = \"alias\";\n        Optional<RepositoryInfo> repositoryConfig = Optional.of(mock(RepositoryInfo.class));\n\n        doAnswer(invocationOnMock -> null).when(repositoryService).close(any());\n        when(configuredRepositories.getRepositoryByRepositoryAlias(any(), anyString())).thenReturn(repository);\n        when(repository.getAlias()).thenReturn(alias);\n        when(orgUnit.getRepositories()).thenReturn(Collections.singletonList(repository));\n\n        InOrder inOrder = inOrder(this.organizationalUnitService, notification);\n\n        this.repositoryService.doRemoveRepository(orgUnit, alias, repositoryConfig, notification, false);\n\n        inOrder.verify(this.organizationalUnitService).removeRepository(any(), any());\n        inOrder.verify(notification).accept(repository);\n    }\n\n    @Test\n    public void testCreateRepositoryConfiguration() {\n\n        final String space = \"space\";\n        final String scheme = \"git\";\n        final String repoName = \"test\";\n        final String userName = \"user\";\n        final String password = \"pass\";\n\n        OrganizationalUnit orgUnit = mock(OrganizationalUnit.class);\n        when(orgUnit.getName()).thenReturn(space);\n\n        final SpaceConfigStorage spaceConfigStorage = mock(SpaceConfigStorage.class);\n        when(registry.getBatch(anyString())).thenReturn(new SpaceConfigStorageRegistryImpl.SpaceStorageBatchImpl(spaceConfigStorage));\n\n        when(spacesAPI.getSpace(anyString())).thenAnswer((Answer<Space>) invocationOnMock -> new Space(invocationOnMock.getArguments()[0].toString()));\n        when(passwordService.encrypt(anyString())).thenAnswer(invocationOnMock -> invocationOnMock.getArguments()[0].toString());\n\n        RepositoryEnvironmentConfigurations configurations = new RepositoryEnvironmentConfigurations();\n        configurations.setUserName(userName);\n        configurations.setPassword(password);\n        configurations.setOrigin(\"https://github.com/kiegroup/appformer.git\");\n\n        repositoryService.createRepository(orgUnit, scheme, repoName, configurations, Collections.emptyList());\n\n        verify(passwordService, times(1)).encrypt(eq(password));\n\n        ArgumentCaptor<RepositoryInfo> captor = ArgumentCaptor.forClass(RepositoryInfo.class);\n        verify(repositoryFactory).newRepository(captor.capture());\n\n        RepositoryInfo info = captor.getValue();\n\n        Assertions.assertThat(info)\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"name\", repoName)\n                .hasFieldOrPropertyWithValue(\"deleted\", false);\n\n        assertEquals(scheme, info.getScheme());\n        assertEquals(space, info.getSpace());\n        assertEquals(userName, info.getConfiguration().get(String.class, \"username\"));\n        assertEquals(password, info.getConfiguration().get(String.class, \"secure:password\"));\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/GitMetadataImplStoreTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.guvnor.structure.repositories.impl.GitMetadataImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.server.io.object.ObjectStorage;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.jgroups.util.Util.assertFalse;\nimport static org.mockito.ArgumentMatchers.anyObject;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GitMetadataImplStoreTest {\n\n    private GitMetadataStoreImpl metadataStore;\n\n    @Mock\n    private ObjectStorage storage;\n    private Map<String, GitMetadataImpl> metadatas;\n    private SpacesAPIImpl spaces = new SpacesAPIImpl();\n\n    @Before\n    public void setUp() throws Exception {\n        metadataStore = new GitMetadataStoreImpl(storage,\n                                                 spaces);\n\n        metadatas = new HashMap<>();\n\n        doAnswer(invocationOnMock -> {\n            String key = invocationOnMock.getArgument(0,\n                                                        String.class);\n            GitMetadataImpl metadata = invocationOnMock.getArgument(1,\n                                                                      GitMetadataImpl.class);\n            storage.write(key, metadata, true);\n\n            return null;\n        }).when(storage).write(anyString(), any());\n\n        doAnswer(invocationOnMock -> {\n            String key = invocationOnMock.getArgument(0,\n                                                        String.class);\n            GitMetadataImpl metadata = invocationOnMock.getArgument(1,\n                                                                      GitMetadataImpl.class);\n            metadatas.put(key,\n                          metadata);\n            return null;\n        }).when(storage).write(anyString(),\n                               any(),\n                               anyBoolean());\n\n        doAnswer(invocationOnMock -> {\n            String key = invocationOnMock.getArgument(0,\n                                                        String.class);\n            return metadatas.get(key);\n        }).when(storage).read(anyString());\n\n        doAnswer(invocationOnMock -> {\n            String key = invocationOnMock.getArgument(0,\n                                                        String.class);\n            return metadatas.remove(key);\n        }).when(storage).delete(anyString());\n    }\n\n    @Test\n    public void testStorageInitialization() {\n        metadataStore.init();\n        verify(storage).init(eq(metadataStore.getMetadataFS()));\n    }\n\n    @Test\n    public void testCreatesRightPathToSave() {\n        metadataStore.write(\"test/repo\",\n                            \"\");\n        verify(storage).write(eq(\"/test/repo.metadata\"),\n                              anyObject(),\n                              anyBoolean());\n    }\n\n    @Test\n    public void testFixRightPathToSave() {\n        metadataStore.write(\"/test/repo\",\n                            \"\");\n        verify(storage).write(eq(\"/test/repo.metadata\"),\n                              anyObject(),\n                              anyBoolean());\n    }\n\n    @Test\n    public void testWriteNewMetadataWithoutOrigin() {\n\n        metadataStore.write(\"test/repo\");\n        assertEquals(\"test/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getName());\n    }\n\n    @Test\n    public void testWriteNewMetadataWithOrigin() {\n\n        metadataStore.write(\"test/repo\",\n                            \"other/repo\");\n\n        assertEquals(\"test/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getName());\n        assertEquals(\"other/repo\",\n                     metadatas.get(\"/other/repo.metadata\").getName());\n    }\n\n    @Test\n    public void testChangeOriginFromMetedata() {\n\n        metadataStore.write(\"test/repo\",\n                            \"other/repo\");\n        assertEquals(\"test/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getName());\n        assertEquals(\"other/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getOrigin());\n        assertEquals(\"other/repo\",\n                     metadatas.get(\"/other/repo.metadata\").getName());\n\n        metadataStore.write(\"test/repo\",\n                            \"other/otherOrigin\");\n        assertEquals(\"other/otherOrigin\",\n                     metadatas.get(\"/test/repo.metadata\").getOrigin());\n        assertEquals(0,\n                     metadatas.get(\"/other/repo.metadata\").getForks().size());\n    }\n\n    @Test\n    public void testWriteWithNullOrigin() {\n\n        String origin = null;\n        metadataStore.write(\"test/repo\",\n                            origin);\n        assertEquals(\"test/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getName());\n    }\n\n    @Test\n    public void testWriteTwoForks() {\n\n        metadataStore.write(\"test/repo\",\n                            \"origin/repo\");\n        metadataStore.write(\"fork/repo\",\n                            \"origin/repo\");\n\n        assertEquals(3,\n                     metadatas.size());\n        assertEquals(\"test/repo\",\n                     metadatas.get(\"/test/repo.metadata\").getName());\n        assertEquals(\"fork/repo\",\n                     metadatas.get(\"/fork/repo.metadata\").getName());\n        assertEquals(\"origin/repo\",\n                     metadatas.get(\"/origin/repo.metadata\").getName());\n\n        assertEquals(2,\n                     metadatas.get(\"/origin/repo.metadata\").getForks().size());\n    }\n\n    @Test\n    public void testComplexForkTracking() {\n\n        metadataStore.write(\"b/repo\",\n                            \"a/repo\");\n        metadataStore.write(\"c/repo\",\n                            \"b/repo\");\n        metadataStore.write(\"d/repo\",\n                            \"c/repo\");\n\n        assertEquals(\"c/repo\",\n                     metadataStore.read(\"d/repo\").get().getOrigin());\n        assertEquals(\"b/repo\",\n                     metadataStore.read(\"c/repo\").get().getOrigin());\n        assertEquals(\"a/repo\",\n                     metadataStore.read(\"b/repo\").get().getOrigin());\n\n        assertEquals(\"b/repo\",\n                     metadataStore.read(\"a/repo\").get().getForks().get(0));\n        assertEquals(\"c/repo\",\n                     metadataStore.read(\"b/repo\").get().getForks().get(0));\n        assertEquals(\"d/repo\",\n                     metadataStore.read(\"c/repo\").get().getForks().get(0));\n    }\n\n    @Test\n    public void testSimpleDelete() {\n\n        metadataStore.write(\"a/repo\",\n                            \"\");\n        assertEquals(\"\",\n                     metadataStore.read(\"a/repo\").get().getOrigin());\n\n        metadataStore.delete(\"a/repo\");\n        assertFalse(metadataStore.read(\"a/repo\").isPresent());\n    }\n\n    @Test\n    public void testComplexDelete() {\n\n        metadataStore.write(\"b/repo\",\n                            \"a/repo\");\n        metadataStore.write(\"c/repo\",\n                            \"b/repo\");\n        metadataStore.write(\"d/repo\",\n                            \"c/repo\");\n\n        metadataStore.delete(\"c/repo\");\n\n        assertEquals(\"\",\n                     metadataStore.read(\"d/repo\").get().getOrigin());\n        assertEquals(\"a/repo\",\n                     metadataStore.read(\"b/repo\").get().getOrigin());\n\n        assertEquals(\"b/repo\",\n                     metadataStore.read(\"a/repo\").get().getForks().get(0));\n        assertEquals(0,\n                     metadataStore.read(\"b/repo\").get().getForks().size());\n        assertFalse(metadataStore.read(\"c/repo\").isPresent());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/GitPathUtilTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.util.Optional;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class GitPathUtilTest {\n\n    @Test\n    public void extractPresentBranchName() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranch(\"git://main@space/repo/some/path\");\n        assertEquals(Optional.of(\"main\"), result);\n    }\n\n    @Test\n    public void extractBranchNameWithSlashes() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranch(\"git://my/main/branch@space/repo/some/path\");\n        assertEquals(Optional.of(\"my/main/branch\"), result);\n    }\n\n    @Test\n    public void extractMissingBranchName() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranch(\"git://space/repo/some/path\");\n        assertEquals(Optional.empty(), result);\n    }\n\n    @Test\n    public void extractLocalBranchNameFromRef() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranchFromRef(\"refs/heads/main\");\n        assertEquals(\"main\", result.get());\n    }\n\n    @Test\n    public void extractLocalBranchNameWithSlashFromRef() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranchFromRef(\"refs/heads/my/branch\");\n        assertEquals(\"my/branch\", result.get());\n    }\n\n    @Test\n    public void extractRemoteBranchNameFromRef() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranchFromRef(\"refs/remotes/upstream/main\");\n        assertEquals(\"main\", result.get());\n    }\n\n    @Test\n    public void extractRemoteBranchNameWithSlashFromRef() throws Exception {\n        final Optional<String> result = GitPathUtil.extractBranchFromRef(\"refs/remotes/upstream/my/branch\");\n        assertEquals(\"my/branch\", result.get());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/GitRepositoryFactoryHelperBaseTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport java.net.URI;\nimport java.util.ArrayList;\nimport java.util.Map;\nimport javax.enterprise.event.Event;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.structure.backend.repositories.BranchAccessAuthorizer;\nimport org.guvnor.structure.backend.repositories.git.hooks.PostCommitNotificationService;\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.organizationalunit.config.RepositoryInfo;\nimport org.guvnor.structure.repositories.EnvironmentParameters;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryExternalUpdateEvent;\nimport org.guvnor.structure.server.config.PasswordService;\nimport org.junit.Test;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.uberfire.backend.server.spaces.SpacesAPIImpl;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.extensions.FileSystemHookExecutionContext;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooks;\nimport org.uberfire.java.nio.file.extensions.FileSystemHooksConstants;\nimport org.uberfire.spaces.SpacesAPI;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyMap;\nimport static org.mockito.Mockito.*;\n\npublic abstract class GitRepositoryFactoryHelperBaseTest {\n\n    enum Mode {\n        INDEXED,\n        NOT_INDEXED\n    }\n\n    protected Mode mode;\n\n    @Mock\n    protected IOService indexed;\n\n    @Mock\n    protected IOService notIndexed;\n\n    @Mock\n    protected FileSystem fileSystem;\n\n    @Mock\n    protected Event<RepositoryExternalUpdateEvent> repositoryExternalUpdate;\n\n    @Mock\n    protected PostCommitNotificationService postCommitNotificationService;\n\n    @Mock\n    protected BranchAccessAuthorizer branchAccessAuthorizer;\n\n    @Mock\n    private PasswordService passwordService;\n\n    protected GitRepositoryFactoryHelper helper;\n\n    protected ArrayList<Path> rootDirectories;\n    protected SpacesAPI spacesAPI;\n\n    public void init() {\n\n        when(passwordService.decrypt(anyString())).thenAnswer(invocationOnMock -> invocationOnMock.getArguments()[0].toString());\n\n        spacesAPI = new SpacesAPIImpl();\n\n        helper = new GitRepositoryFactoryHelper(indexed,\n                                                notIndexed,\n                                                spacesAPI,\n                                                repositoryExternalUpdate,\n                                                postCommitNotificationService,\n                                                branchAccessAuthorizer,\n                                                passwordService);\n\n        if (Mode.INDEXED.equals(mode)) {\n            initServices(indexed,\n                         notIndexed);\n        } else {\n            initServices(notIndexed,\n                         indexed);\n        }\n\n        rootDirectories = new ArrayList<>();\n        when(fileSystem.getRootDirectories()).thenReturn(rootDirectories);\n    }\n\n    private void initServices(IOService normal,\n                              IOService withException) {\n        when(normal.newFileSystem(any(URI.class),\n                                  anyMap())\n        ).thenReturn(fileSystem);\n    }\n\n    @Test(expected = IllegalArgumentException.class)\n    public void testNoSchemeConfigItem() {\n        helper.newRepository(new RepositoryInfo(\"test\",\n                                                false,\n                                                new RepositoryConfiguration()));\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void testNotValid() {\n        helper.newRepository(new RepositoryInfo(null,\n                                                false,\n                                                this.getConfig()));\n    }\n\n    @Test\n    public void testNewRepositoryReplaceIfExists() {\n\n        rootDirectories.add(createPath(\"default://main@uf-playground\"));\n\n        RepositoryConfiguration config = this.getConfig();\n        config.add(\"replaceIfExists\",\n                   true);\n\n        RepositoryInfo repositoryInfo = new RepositoryInfo(\"test\",\n                                                           false,\n                                                           config);\n\n        final IOService service = getServiceToTest();\n\n        when(service.newFileSystem(any(URI.class),\n                                   anyMap()))\n                .thenThrow(FileSystemAlreadyExistsException.class)\n                .thenReturn(fileSystem);\n        when(service.getFileSystem(any(URI.class))).thenReturn(fileSystem);\n\n        helper.newRepository(repositoryInfo);\n\n        verify(passwordService).decrypt(anyString());\n\n        verify(service,\n               times(1)).delete(any());\n        verify(service,\n               times(2)).newFileSystem(any(URI.class),\n                                       anyMap());\n    }\n\n    @Test\n    public void testFileSystemHooks() {\n        rootDirectories.add(createPath(\"default://main@uf-playground\"));\n\n        RepositoryInfo repositoryInfo = new RepositoryInfo(\"test\",\n                                                           false,\n                                                           this.getConfig());\n\n        final IOService service = getServiceToTest();\n\n        helper.newRepository(repositoryInfo);\n\n        ArgumentCaptor<Map> captor = ArgumentCaptor.forClass(Map.class);\n\n        verify(service).newFileSystem(any(URI.class),\n                                      captor.capture());\n\n        Map params = captor.getValue();\n\n        Assertions.assertThat(params)\n                .isNotNull();\n\n        Assertions.assertThat(params.get(FileSystemHooks.ExternalUpdate.name()))\n                .isNotNull()\n                .isInstanceOf(FileSystemHooks.FileSystemHook.class);\n\n        FileSystemHookExecutionContext ctx = new FileSystemHookExecutionContext(\"test\");\n\n        FileSystemHooks.FileSystemHook hook = (FileSystemHooks.FileSystemHook) params.get(FileSystemHooks.ExternalUpdate.name());\n        hook.execute(ctx);\n        verify(repositoryExternalUpdate).fire(any());\n\n        Assertions.assertThat(params.get(FileSystemHooks.PostCommit.name()))\n                .isNotNull()\n                .isInstanceOf(FileSystemHooks.FileSystemHook.class);\n\n        ctx.addParam(FileSystemHooksConstants.POST_COMMIT_EXIT_CODE,\n                     0);\n\n        hook = (FileSystemHooks.FileSystemHook) params.get(FileSystemHooks.PostCommit.name());\n        hook.execute(ctx);\n        verify(postCommitNotificationService).notifyUser(any(),\n                                                         eq(0));\n    }\n\n    private IOService getServiceToTest() {\n        if (Mode.INDEXED.equals(mode)) {\n            return indexed;\n        } else {\n            return notIndexed;\n        }\n    }\n\n    @Test\n    public void testBranches() {\n\n        rootDirectories.add(createPath(\"default://origin@uf-playground\"));\n        rootDirectories.add(createPath(\"default://main@uf-playground\"));\n        rootDirectories.add(createPath(\"default://branch1@uf-playground\"));\n\n        RepositoryInfo repositoryInfo = new RepositoryInfo(\"test\",\n                                                           false,\n                                                           this.getConfig());\n\n        Repository repository = helper.newRepository(repositoryInfo);\n\n        assertEquals(3,\n                     repository.getBranches().size());\n        assertTrue(repository.getDefaultBranch().get().getPath().toURI().contains(\"main\"));\n    }\n\n    @Test\n    public void testCredentialsAreNotStoredAfterRepositoryCreation() {\n        final RepositoryInfo repositoryInfo = new RepositoryInfo(\"myRepository\",\n                                                                 false,\n                                                                 this.getConfig());\n\n        final Repository repository = helper.newRepository(repositoryInfo);\n\n        assertFalse(repository.getEnvironment().containsKey(EnvironmentParameters.USER_NAME));\n        assertFalse(repository.getEnvironment().containsKey(EnvironmentParameters.PASSWORD));\n        assertFalse(repository.getEnvironment()\n                            .containsKey(EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD));\n    }\n\n    protected Path createPath(String uri) {\n        Path path = mock(Path.class);\n        when(path.toUri()).thenReturn(URI.create(uri));\n        when(path.getFileSystem()).thenReturn(fileSystem);\n        return path;\n    }\n\n    protected RepositoryConfiguration getConfig() {\n        RepositoryConfiguration repositoryConfiguration = new RepositoryConfiguration();\n        repositoryConfiguration.add(EnvironmentParameters.USER_NAME, \"user\");\n        repositoryConfiguration.add(EnvironmentParameters.PASSWORD, \"pw\");\n        repositoryConfiguration.add(EnvironmentParameters.SECURE_PREFIX + EnvironmentParameters.PASSWORD, \"pass\");\n        repositoryConfiguration.add(EnvironmentParameters.SCHEME, \"git\");\n        repositoryConfiguration.add(EnvironmentParameters.SPACE, \"space\");\n\n        return repositoryConfiguration;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/GitRepositoryFactoryHelperNoIndexTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport org.guvnor.structure.organizationalunit.config.RepositoryConfiguration;\nimport org.guvnor.structure.repositories.EnvironmentParameters;\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GitRepositoryFactoryHelperNoIndexTest extends GitRepositoryFactoryHelperBaseTest {\n\n    @Before\n    public void setUp() throws Exception {\n        mode = Mode.NOT_INDEXED;\n\n        super.init();\n    }\n\n    protected RepositoryConfiguration getConfig() {\n        RepositoryConfiguration repositoryConfiguration = super.getConfig();\n        repositoryConfiguration.add(EnvironmentParameters.AVOID_INDEX, true);\n\n        return repositoryConfiguration;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/GitRepositoryFactoryHelperTest.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git;\n\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GitRepositoryFactoryHelperTest extends GitRepositoryFactoryHelperBaseTest {\n\n    @Before\n    public void setUp() {\n        mode = Mode.INDEXED;\n\n        super.init();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/java/org/guvnor/structure/backend/repositories/git/hooks/impl/PostCommitNotificationServiceImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.backend.repositories.git.hooks.impl;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.structure.backend.repositories.git.hooks.PostCommitNotificationService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.guvnor.structure.repositories.impl.git.event.NotificationType;\nimport org.guvnor.structure.repositories.impl.git.event.PostCommitNotificationEvent;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.spaces.Space;\n\nimport javax.enterprise.event.Event;\nimport java.util.Locale;\n\nimport static org.guvnor.structure.repositories.impl.git.event.NotificationType.ERROR;\nimport static org.guvnor.structure.repositories.impl.git.event.NotificationType.SUCCESS;\nimport static org.guvnor.structure.repositories.impl.git.event.NotificationType.WARNING;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PostCommitNotificationServiceImplTest {\n\n    private static final String BUNDLE_PATH = \"src/test/resources/bundles/Messages.properties\";\n\n    private static final String REPO = \"repository.git\";\n    private static final String VALID_SPACE = \"mySpace\";\n    private static final String SYSTEM_SPACE = \"system\";\n\n    private static final String EN_SUCCESS = \"Success: nothing wrong happens\";\n    private static final String EN_WARNING = \"Warning: check the logs\";\n    private static final String EN_WARNING_2 = \"Warning: check the logs again\";\n    private static final String EN_ERROR = \"Error: run in circles and scream\";\n\n    private static final String CA_SUCCESS = \"Exit: no passa res\";\n    private static final String CA_WARNING = \"Alerta: mira els logs del servidor\";\n    private static final String CA_WARNING_2 = \"Alerta: mira els logs del servidor un altre cop\";\n    private static final String CA_ERROR = \"Error: corre en cercles i crida\";\n\n    private Locale defaultLocale;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private Event<PostCommitNotificationEvent> notificationEvent;\n\n    private Locale locale = Locale.ENGLISH;\n\n    private MessageReader reader;\n\n    private PostCommitNotificationServiceImpl service;\n\n    @Before\n    public void init() {\n        defaultLocale = Locale.getDefault();\n\n        Locale.setDefault(Locale.ENGLISH);\n\n        reader = new MessageReader(() -> locale);\n    }\n\n    private void init(String path) {\n        System.setProperty(PostCommitNotificationService.BUNDLE_PARAM, path);\n\n        service = new PostCommitNotificationServiceImpl(sessionInfo, notificationEvent, reader);\n\n        service.init();\n    }\n\n    @Test\n    public void testLoadWrongBundle() {\n        init(\"wrong bundle\");\n\n        service.notifyUser(new GitRepository(REPO, new Space(VALID_SPACE)), 0);\n\n        verify(notificationEvent, never()).fire(any());\n    }\n\n    @Test\n    public void testNoNotification() {\n        init(BUNDLE_PATH);\n\n        service.notifyUser(new GitRepository(REPO, new Space(SYSTEM_SPACE)), 0);\n\n        verify(notificationEvent, never()).fire(any());\n\n        service.notifyUser(new GitRepository(REPO, new Space(VALID_SPACE)), 3);\n\n        verify(notificationEvent, never()).fire(any());\n    }\n\n    @Test\n    public void testNotifyEn() {\n        testNotify(Locale.ENGLISH, EN_SUCCESS, EN_WARNING, EN_WARNING_2, EN_ERROR);\n    }\n\n    @Test\n    public void testNotifyCa() {\n        testNotify(new Locale(\"ca\"), CA_SUCCESS, CA_WARNING, CA_WARNING_2, CA_ERROR);\n    }\n\n    @Test\n    public void testNotifyNonExistingLanguage() {\n        testNotify(Locale.FRENCH, EN_SUCCESS, EN_WARNING, EN_WARNING_2, EN_ERROR);\n    }\n\n    private void testNotify(Locale locale, String successMsg, String warningMsg, String warning2Msg, String errorMsg) {\n        init(BUNDLE_PATH);\n\n        this.locale = locale;\n\n        testNotify(0, successMsg, SUCCESS,1);\n        testNotify(1, warningMsg, WARNING, 2);\n        testNotify(30, warning2Msg, WARNING, 3);\n        testNotify(31, errorMsg, ERROR, 4);\n    }\n\n    private void testNotify(int code, String message, NotificationType notificationType, int times) {\n        service.notifyUser(new GitRepository(REPO, new Space(VALID_SPACE)), code);\n\n        ArgumentCaptor<PostCommitNotificationEvent> eventCaptor = ArgumentCaptor.forClass(PostCommitNotificationEvent.class);\n\n        verify(notificationEvent, times(times)).fire(eventCaptor.capture());\n\n        Assertions.assertThat(eventCaptor.getValue())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"text\", message)\n                .hasFieldOrPropertyWithValue(\"type\", notificationType);\n    }\n\n    @After\n    public void finish(){\n        Locale.setDefault(defaultLocale);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/DependencyTypesMapper.json",
    "content": "{\n  \"dependencies\":[\n    {\n      \"type\":\"JPA\",\n      \"deps\":[\n            {\"groupId\":\"javax.persistence\", \"artifactId\":\"javax.persistence-api\", \"version\":\"2.2\", \"scope\":\"\"}\n      ]\n    }\n  ]\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2017 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/bundles/Messages.properties",
    "content": "0=Success: nothing wrong happens\n1=Warning: check the logs\n30=Warning: check the logs again\n31=Error: run in circles and scream"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/bundles/Messages_ca.properties",
    "content": "0=Exit: no passa res\n1=Alerta: mira els logs del servidor\n30=Alerta: mira els logs del servidor un altre cop\n31=Error: corre en cercles i crida"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/bundles/Messages_en.properties",
    "content": "0=Success: nothing wrong happens\n1=Warning: check the logs\n30=Warning: check the logs again\n31=Error: run in circles and scream"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/dummy/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.kie</groupId>\n  <artifactId>dummy-test</artifactId>\n  <version>1.0.0.Final</version>\n  <dependencies>\n    <dependency>\n      <groupId>org.springframework</groupId>\n      <artifactId>spring-aop</artifactId>\n      <version>4.3.8.RELEASE</version>\n    </dependency>\n    <dependency>\n      <groupId>javax.persistence</groupId>\n      <artifactId>javax.persistence-api</artifactId>\n      <version>2.2</version>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/dummyOverride/FixedSpaceInfo.json",
    "content": "{\"^EncodedType\":\"org.guvnor.structure.organizationalunit.config.SpaceInfo\",\"^ObjectID\":\"1\",\"name\":\"MySpace\",\"description\":null,\"defaultGroupId\":\"com.myspace\",\"contributors\":{\"^EncodedType\":\"java.util.ArrayList\",\"^ObjectID\":\"2\",\"^Value\":[{\"^EncodedType\":\"org.uberfire.security.Contributor\",\"^ObjectID\":\"3\",\"username\":\"admin\",\"type\":{\"^EncodedType\":\"org.uberfire.security.ContributorType\",\"^EnumStringValue\":\"OWNER\"}},{\"^EncodedType\":\"org.uberfire.security.Contributor\",\"^ObjectID\":\"4\",\"username\":\"rhpamAdmin\",\"type\":{\"^EncodedType\":\"org.uberfire.security.ContributorType\",\"^EnumStringValue\":\"CONTRIBUTOR\"}}]},\"repositories\":{\"^EncodedType\":\"java.util.ArrayList\",\"^ObjectID\":\"5\",\"^Value\":[{\"^EncodedType\":\"org.guvnor.structure.organizationalunit.config.RepositoryInfo\",\"^ObjectID\":\"6\",\"name\":\"test\",\"deleted\":false,\"configuration\":{\"^EncodedType\":\"org.guvnor.structure.organizationalunit.config.RepositoryConfiguration\",\"^ObjectID\":\"7\",\"environment\":{\"^EncodedType\":\"java.util.HashMap\",\"^ObjectID\":\"8\",\"^Value\":{\"init\":{\"^EncodedType\":\"java.lang.Boolean\", \"^ObjectID\": \"-1\",\"^NumVal\":false},\"security:groups\":{\"^EncodedType\":\"java.util.ArrayList\",\"^ObjectID\":\"9\",\"^Value\":[]},\"mirror\":{\"^EncodedType\":\"java.lang.Boolean\", \"^ObjectID\": \"-1\",\"^NumVal\":false},\"scheme\":\"git\",\"origin\":\"file:\\/home2\\/rh\\/rhpam7.11.1\\/jboss-eap-7.3\\/bin\\/.niogit\\/.archetypes\\/org-kie-templates-base-kie-project-1-0-0-TEMPLATE.git\\/\",\"contributors\":{\"^EncodedType\":\"java.util.ArrayList\",\"^ObjectID\":\"10\",\"^Value\":[{\"^EncodedType\":\"org.uberfire.security.Contributor\",\"^ObjectID\":\"11\",\"username\":\"admin\",\"type\":{\"^EncodedType\":\"org.uberfire.security.ContributorType\",\"^EnumStringValue\":\"OWNER\"}},{\"^EncodedType\":\"org.uberfire.security.Contributor\",\"^ObjectID\":\"12\",\"username\":\"rhpamAdmin\",\"type\":{\"^EncodedType\":\"org.uberfire.security.ContributorType\",\"^EnumStringValue\":\"OWNER\"}}]},\"space\":\"MySpace\"}}}}]},\"securityGroups\":{\"^EncodedType\":\"java.util.ArrayList\",\"^ObjectID\":\"13\",\"^Value\":[]}}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/dummyOverride/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.kie</groupId>\n  <artifactId>dummy-test</artifactId>\n  <version>1.0.0.Final</version>\n  <dependencies>\n    <dependency>\n      <groupId>junit</groupId>\n      <artifactId>junit</artifactId>\n      <version>4.10</version>\n    </dependency>\n    <dependency>\n      <groupId>javax.persistence</groupId>\n      <artifactId>javax.persistence-api</artifactId>\n      <version>2.2</version>\n    </dependency>\n  </dependencies>\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/dummy_empty_deps/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2018 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <groupId>org.kie</groupId>\n  <artifactId>dummy-test</artifactId>\n  <version>1.0.0.Final</version>\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/logback.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n\n  <root level=\"info\">\n    <appender-ref ref=\"consoleAppender\"/>\n  </root>\n\n</configuration>\n\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/niogit/space1/.gitignore",
    "content": ""
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/niogit/space2/.gitignore",
    "content": ""
  },
  {
    "path": "uberfire-structure/uberfire-structure-backend/src/test/resources/niogit/system/.gitignore",
    "content": ""
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-structure</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-structure-client</artifactId>\n  <name>UberFire - Structure Client</name>\n  <description>UberFire - Structure Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-structure-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-services-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-core-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-widgets-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-all</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n\n    <!-- GWT and GWT Extensions -->\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3-extras</artifactId>\n    </dependency>\n\n    <!-- Test dependencies -->\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/StructureEntryPoint.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n * use this file except in compliance with the License. You may obtain a copy of\n * the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.guvnor.structure.client;\n\nimport javax.annotation.PostConstruct;\n\nimport org.guvnor.structure.client.resources.NavigatorResources;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\n\n/**\n * Bootstrap widgets-core\n */\n@EntryPoint\npublic class StructureEntryPoint {\n\n    @PostConstruct\n    public void startApp() {\n        //Ensure CSS has been loaded\n        NavigatorResources.INSTANCE.css().ensureInjected();\n        PatternFlyBootstrapper.ensureBootstrapSelectIsAvailable();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/advnavigator/Navigator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.advnavigator;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\n\npublic interface Navigator extends IsWidget {\n\n    void loadContent(final Path path);\n\n    boolean isAttached();\n\n    public static interface NavigatorItem {\n\n        public void addDirectory(final Path child);\n\n        public void addFile(final Path child);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/advnavigator/NavigatorOptions.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.advnavigator;\n\npublic interface NavigatorOptions {\n\n    public static final NavigatorOptions DEFAULT = new NavigatorOptions() {\n        @Override\n        public boolean showFiles() {\n            return true;\n        }\n\n        @Override\n        public boolean showHiddenFiles() {\n            return false;\n        }\n\n        @Override\n        public boolean showDirectories() {\n            return true;\n        }\n\n        @Override\n        public boolean allowUpLink() {\n            return true;\n        }\n\n        @Override\n        public boolean showItemAge() {\n            return true;\n        }\n\n        @Override\n        public boolean showItemLastUpdater() {\n            return true;\n        }\n\n        @Override\n        public boolean showItemMessage() {\n            return true;\n        }\n    };\n\n    boolean showFiles();\n\n    boolean showHiddenFiles();\n\n    boolean showDirectories();\n\n    boolean allowUpLink();\n\n    boolean showItemAge();\n\n    boolean showItemMessage();\n\n    boolean showItemLastUpdater();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/advnavigator/TreeNavigator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.advnavigator;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.guvnor.structure.client.resources.NavigatorResources;\nimport org.guvnor.structure.navigator.DataContent;\nimport org.guvnor.structure.navigator.FileNavigatorService;\nimport org.guvnor.structure.navigator.NavigatorContent;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.core.client.tree.FSTreeItem;\nimport org.uberfire.ext.widgets.core.client.tree.Tree;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.type.DotResourceTypeDefinition;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\n@Named(\"TreeNav\")\npublic class TreeNavigator extends Composite implements Navigator {\n\n    private static final String LAZY_LOAD = \"Loading...\";\n\n    @Inject\n    private DotResourceTypeDefinition hiddenTypeDef;\n\n    @Inject\n    private Caller<FileNavigatorService> navigatorService;\n\n    private NavigatorOptions options = NavigatorOptions.DEFAULT;\n\n    private final Tree tree = new Tree();\n    private ParameterizedCommand<Path> fileActionCommand = null;\n\n    @PostConstruct\n    public void init() {\n        tree.addStyleName(NavigatorResources.INSTANCE.css().treeNav());\n        initWidget(tree);\n\n        tree.addOpenHandler(new OpenHandler<FSTreeItem>() {\n            @Override\n            public void onOpen(final OpenEvent<FSTreeItem> event) {\n                if (needsLoading(event.getTarget()) && event.getTarget().getUserObject() instanceof Path) {\n                    loadContent(new TreeNavigatorItemImpl(event.getTarget()),\n                                (Path) event.getTarget().getUserObject());\n                }\n            }\n        });\n\n        tree.addSelectionHandler(new SelectionHandler<FSTreeItem>() {\n            @Override\n            public void onSelection(SelectionEvent<FSTreeItem> event) {\n                if (fileActionCommand != null) {\n                    final Object userObject = event.getSelectedItem().getUserObject();\n                    if (userObject != null && userObject instanceof Path) {\n                        fileActionCommand.execute((Path) userObject);\n                    }\n                }\n            }\n        });\n    }\n\n    private void loadContent(final NavigatorItem parent,\n                             final Path path) {\n        if (path != null) {\n            navigatorService.call(new RemoteCallback<NavigatorContent>() {\n                @Override\n                public void callback(final NavigatorContent response) {\n                    for (final DataContent dataContent : response.getContent()) {\n                        if (dataContent.isDirectory()) {\n                            if (options.showDirectories()) {\n                                parent.addDirectory(dataContent.getPath());\n                            }\n                        } else {\n                            if (options.showFiles()) {\n                                if (!options.showHiddenFiles() && !hiddenTypeDef.accept(dataContent.getPath())) {\n                                    parent.addFile(dataContent.getPath());\n                                } else if (options.showHiddenFiles()) {\n                                    parent.addFile(dataContent.getPath());\n                                }\n                            }\n                        }\n                    }\n                }\n            }).listContent(path);\n        }\n    }\n\n    @Override\n    public void loadContent(final Path path) {\n        final NavigatorItem parent = new TreeNavigatorItemImpl(new FSTreeItem(FSTreeItem.FSType.FOLDER,\n                                                                              path.getFileName()));\n        tree.addItem(((TreeNavigatorItemImpl) parent).parent);\n\n        loadContent(parent,\n                    path);\n    }\n\n    private boolean needsLoading(final FSTreeItem item) {\n        return item.getChildCount() == 1 && LAZY_LOAD.equals(item.getChild(0).getText());\n    }\n\n    private class TreeNavigatorItemImpl implements NavigatorItem {\n\n        private final FSTreeItem parent;\n\n        TreeNavigatorItemImpl(final FSTreeItem treeItem) {\n            this.parent = checkNotNull(\"parent\",\n                                       treeItem);\n        }\n\n        public void addDirectory(final Path child) {\n            checkCleanupLoading();\n            final FSTreeItem newDirectory = parent.addItem(FSTreeItem.FSType.FOLDER,\n                                                           child.getFileName());\n            newDirectory.addItem(FSTreeItem.FSType.LOADING,\n                                 LAZY_LOAD);\n            newDirectory.setUserObject(child);\n        }\n\n        public void addFile(final Path child) {\n            checkCleanupLoading();\n            final FSTreeItem newFile = parent.addItem(FSTreeItem.FSType.ITEM,\n                                                      child.getFileName());\n            newFile.setUserObject(child);\n        }\n\n        private void checkCleanupLoading() {\n            if (parent.getChild(0) != null && parent.getChild(0).getUserObject() == null) {\n                parent.getChild(0).remove();\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/context/GuvnorStructureContext.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.context;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Optional;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.NewRepositoryEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.spaces.Space;\n\n/**\n * Context that keeps track of repositories and branches. Used in Guvnor Administration perspective,\n * more specifically by the Guvnor Structure module.\n */\n@ApplicationScoped\npublic class GuvnorStructureContext {\n\n    private final HashMap<GuvnorStructureContextChangeHandler.HandlerRegistration, GuvnorStructureContextChangeHandler> handlers = new HashMap<>();\n    private final HashMap<GuvnorStructureContextBranchChangeHandler.HandlerRegistration, GuvnorStructureContextBranchChangeHandler> branchChangeHandlers = new HashMap<>();\n    private final HashMap<String, String> aliasBranch = new HashMap<>();\n\n    private Caller<RepositoryService> repositoryService;\n    private WorkspaceProjectContext context;\n\n    public GuvnorStructureContext() {\n    }\n\n    @Inject\n    public GuvnorStructureContext(final Caller<RepositoryService> repositoryService, final WorkspaceProjectContext context) {\n        this.repositoryService = repositoryService;\n        this.context = context;\n    }\n\n    public void getRepositories(final Callback<Collection<Repository>> callback) {\n        String ouName = context.getActiveOrganizationalUnit()\n                               .map(ou -> ou.getName())\n                               .orElseThrow(() -> new IllegalStateException(\"Cannot lookup repositories without active organizational unit.\"));\n        repositoryService.call(new RemoteCallback<Collection<Repository>>() {\n            @Override\n            public void callback(final Collection<Repository> response) {\n\n                final Collection<String> foundAliases = updateRepositories(response);\n\n                removeMissingAliases(foundAliases);\n\n                callback.callback(response);\n            }\n        }).getRepositories(new Space(ouName));\n    }\n\n    private Collection<String> updateRepositories(final Collection<Repository> response) {\n        final Collection<String> foundAliases = new ArrayList<>();\n\n        for (final Repository repository : response) {\n\n            foundAliases.add(repository.getAlias());\n\n            updateRepository(repository);\n        }\n\n        return foundAliases;\n    }\n\n    private void updateRepository(final Repository repository) {\n        if (!repository.getDefaultBranch().isPresent()) {\n            return;\n        }\n\n        if (isNewRepository(repository)) {\n            aliasBranch.put(repository.getAlias(),\n                            repository.getDefaultBranch().get().getName());\n        } else {\n            updateBranch(repository);\n        }\n    }\n\n    private void updateBranch(final Repository repository) {\n        if (!repository.getDefaultBranch().isPresent()) {\n            return;\n        }\n        final String branchName = aliasBranch.get(repository.getAlias());\n\n        if (branchName == null || hasBranchBeenRemoved(repository,\n                                                       branchName)) {\n            aliasBranch.put(repository.getAlias(),\n                            repository.getDefaultBranch().get().getName());\n        }\n    }\n\n    private boolean isNewRepository(final Repository repository) {\n        return !aliasBranch.containsKey(repository.getAlias());\n    }\n\n    private boolean hasBranchBeenRemoved(final Repository repository,\n                                         final String branchName) {\n        return !repository\n                .getBranches()\n                .stream()\n                .anyMatch(branch -> branch.getName().equals(branchName));\n    }\n\n    private void removeMissingAliases(final Collection<String> foundAliases) {\n        for (final String missingAlias : getMissingAliases(foundAliases)) {\n            aliasBranch.remove(missingAlias);\n        }\n    }\n\n    private Collection<String> getMissingAliases(final Collection<String> foundAliases) {\n        final Collection<String> missingAliases = new ArrayList<>();\n\n        for (final String alias : aliasBranch.keySet()) {\n            if (!foundAliases.contains(alias)) {\n                missingAliases.add(alias);\n            }\n        }\n\n        return missingAliases;\n    }\n\n    public GuvnorStructureContextChangeHandler.HandlerRegistration addGuvnorStructureContextChangeHandler(final GuvnorStructureContextChangeHandler handler) {\n        final GuvnorStructureContextChangeHandler.HandlerRegistration handlerRegistration = new GuvnorStructureContextChangeHandler.HandlerRegistration();\n\n        handlers.put(handlerRegistration,\n                     handler);\n\n        return handlerRegistration;\n    }\n\n    public GuvnorStructureContextBranchChangeHandler.HandlerRegistration addGuvnorStructureContextBranchChangeHandler(final GuvnorStructureContextBranchChangeHandler handler) {\n        final GuvnorStructureContextBranchChangeHandler.HandlerRegistration handlerRegistration = new GuvnorStructureContextBranchChangeHandler.HandlerRegistration();\n\n        branchChangeHandlers.put(handlerRegistration,\n                                 handler);\n\n        return handlerRegistration;\n    }\n\n    public void changeBranch(final String alias,\n                             final String branch) {\n\n        aliasBranch.put(alias,\n                        branch);\n\n        for (final GuvnorStructureContextBranchChangeHandler handler : branchChangeHandlers.values()) {\n            handler.onBranchChange(alias,\n                                   branch);\n        }\n    }\n\n    public void onNewRepository(final @Observes NewRepositoryEvent event) {\n\n        final Repository newRepository = event.getNewRepository();\n        if (newRepository.getDefaultBranch().isPresent()) {\n            aliasBranch.put(newRepository.getAlias(),\n                            newRepository.getDefaultBranch().get().getName());\n        }\n\n        for (final GuvnorStructureContextChangeHandler handler : handlers.values()) {\n            handler.onNewRepositoryAdded(newRepository);\n        }\n    }\n\n    public void onNewBranch(final @Observes NewBranchEvent event) {\n        for (final GuvnorStructureContextChangeHandler handler : handlers.values()) {\n            final Optional<Branch> branchOptional = event.getRepository().getBranch(event.getNewBranchName());\n            if (branchOptional.isPresent()) {\n                handler.onNewBranchAdded(event.getRepository().getAlias(),\n                                         event.getNewBranchName(),\n                                         branchOptional.get().getPath());\n            }\n        }\n    }\n\n    public void onRepositoryRemoved(final @Observes RepositoryRemovedEvent event) {\n\n        aliasBranch.remove(event.getRepository().getAlias());\n\n        for (final GuvnorStructureContextChangeHandler handler : handlers.values()) {\n            handler.onRepositoryDeleted(event.getRepository());\n        }\n    }\n\n    public void removeHandler(final GuvnorStructureContextChangeHandler.HandlerRegistration handlerRegistration) {\n        handlers.remove(handlerRegistration);\n    }\n\n    public void removeHandler(final GuvnorStructureContextBranchChangeHandler.HandlerRegistration handlerRegistration) {\n        branchChangeHandlers.remove(handlerRegistration);\n    }\n\n    public String getCurrentBranch(final String alias) {\n        return aliasBranch.get(alias);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/context/GuvnorStructureContextBranchChangeHandler.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.context;\n\npublic interface GuvnorStructureContextBranchChangeHandler {\n\n    void onBranchChange(final String alias,\n                        final String branch);\n\n    class HandlerRegistration {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/context/GuvnorStructureContextChangeHandler.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.context;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.backend.vfs.Path;\n\npublic interface GuvnorStructureContextChangeHandler {\n\n    void onNewRepositoryAdded(final Repository repository);\n\n    void onRepositoryDeleted(final Repository repository);\n\n    void onNewBranchAdded(final String repositoryAlias,\n                          String branchName,\n                          Path branchPath);\n\n    class HandlerRegistration {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerItem.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.core.client.tree.FSTreeItem;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\nclass FileExplorerItem {\n\n    private CommonConstants constants = CommonConstants.INSTANCE;\n\n    private final FSTreeItem parent;\n\n    FileExplorerItem(final FSTreeItem treeItem) {\n        this.parent = checkNotNull(\"parent\",\n                                   treeItem);\n    }\n\n    public void addDirectory(final Path child) {\n        checkCleanupLoading();\n\n        final FSTreeItem newDirectory = parent.addItem(FSTreeItem.FSType.FOLDER,\n                                                       child.getFileName());\n        newDirectory.addItem(FSTreeItem.FSType.LOADING,\n                             constants.Loading());\n        newDirectory.setUserObject(child);\n    }\n\n    public void addFile(final Path child) {\n        checkCleanupLoading();\n\n        final FSTreeItem newFile = parent.addItem(FSTreeItem.FSType.ITEM,\n                                                  child.getFileName());\n        newFile.setUserObject(child);\n    }\n\n    private void checkCleanupLoading() {\n        if (parent.getChild(0) != null && parent.getChild(0).getUserObject() == null) {\n            parent.getChild(0).remove();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerPresenter.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextBranchChangeHandler;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextChangeHandler;\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.DirectoryStream;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.annotations.DefaultPosition;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.lifecycle.OnShutdown;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceBatchChangesEvent;\nimport org.uberfire.workbench.events.ResourceCopiedEvent;\nimport org.uberfire.workbench.events.ResourceDeletedEvent;\nimport org.uberfire.workbench.events.ResourceRenamedEvent;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\n\n@Dependent\n@WorkbenchScreen(identifier = \"FileExplorer\")\npublic class FileExplorerPresenter\n        implements GuvnorStructureContextChangeHandler,\n                   GuvnorStructureContextBranchChangeHandler {\n\n    private FileExplorerView view;\n\n    @Inject\n    private Caller<VFSService> vfsService;\n\n    @Inject\n    private Event<PathSelectedEvent> pathSelectedEvent;\n\n    @Inject\n    private PlaceManager placeManager;\n\n    private GuvnorStructureContext guvnorStructureContext;\n\n    private Map<String, Repository> repositories = new HashMap<String, Repository>();\n    private GuvnorStructureContextChangeHandler.HandlerRegistration changeHandlerRegistration;\n    private GuvnorStructureContextBranchChangeHandler.HandlerRegistration branchChangeHandlerRegistration;\n\n    public FileExplorerPresenter() {\n    }\n\n    @Inject\n    public FileExplorerPresenter(final FileExplorerView view,\n                                 final GuvnorStructureContext guvnorStructureContext) {\n        this.view = view;\n        this.guvnorStructureContext = guvnorStructureContext;\n        this.changeHandlerRegistration = this.guvnorStructureContext.addGuvnorStructureContextChangeHandler(this);\n        this.branchChangeHandlerRegistration = this.guvnorStructureContext.addGuvnorStructureContextBranchChangeHandler(this);\n\n        view.init(this);\n    }\n\n    private boolean isDirectory(final Map response) {\n        return response != null && response.containsKey(\"isDirectory\") && (Boolean) response.get(\"isDirectory\");\n    }\n\n    @OnStartup\n    public void reset() {\n\n        view.reset();\n\n        guvnorStructureContext.getRepositories(new Callback<Collection<Repository>>() {\n            @Override\n            public void callback(final Collection<Repository> response) {\n                for (final Repository root : response) {\n                    if (repositories.containsKey(root.getAlias())) {\n                        view.removeRepository(root);\n                    }\n                    view.addNewRepository(root,\n                                          guvnorStructureContext.getCurrentBranch(root.getAlias()));\n                    repositories.put(root.getAlias(),\n                                     root);\n                }\n            }\n        });\n    }\n\n    @OnShutdown\n    public void onShutdown() {\n        guvnorStructureContext.removeHandler(changeHandlerRegistration);\n        guvnorStructureContext.removeHandler(branchChangeHandlerRegistration);\n    }\n\n    public void loadDirectoryContent(final FileExplorerItem item,\n                                     final Path path) {\n        vfsService.call(new RemoteCallback<DirectoryStream<Path>>() {\n            @Override\n            public void callback(DirectoryStream<Path> response) {\n                for (final Path child : response) {\n                    vfsService.call(new RemoteCallback<Map>() {\n                        @Override\n                        public void callback(final Map response) {\n                            if (isDirectory(response)) {\n                                item.addDirectory(child);\n                            } else {\n                                item.addFile(child);\n                            }\n                        }\n                    }).readAttributes(child);\n                }\n            }\n        }).newDirectoryStream(path);\n    }\n\n    @WorkbenchPartView\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    private boolean isRegularFile(final Map response) {\n        return response != null && response.containsKey(\"isRegularFile\") && (Boolean) response.get(\"isRegularFile\");\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CoreConstants.INSTANCE.FileExplorer();\n    }\n\n    @DefaultPosition\n    public Position getDefaultPosition() {\n        return CompassPosition.WEST;\n    }\n\n    public void redirect(final Path path) {\n\n        pathSelectedEvent.fire(new PathSelectedEvent(path));\n\n        vfsService.call(new RemoteCallback<Map>() {\n            @Override\n            public void callback(final Map response) {\n                if (isRegularFile(response)) {\n                    placeManager.goTo(path);\n                }\n            }\n        }).readAttributes(path);\n    }\n\n    public void redirectRepositoryList() {\n        placeManager.goTo(new DefaultPlaceRequest(\"RepositoriesEditor\"));\n    }\n\n    public void redirect(final Repository repo) {\n        placeManager.goTo(new DefaultPlaceRequest(\"RepositoryEditor\").addParameter(\"alias\",\n                                                                                   repo.getAlias()));\n    }\n\n    @Override\n    public void onNewRepositoryAdded(final Repository repository) {\n        if (repository == null) {\n            return;\n        }\n        if (repositories.containsKey(repository.getAlias())) {\n            view.removeRepository(repository);\n        }\n        view.addNewRepository(repository,\n                              repository.getDefaultBranch().get().getName());\n        repositories.put(repository.getAlias(),\n                         repository);\n    }\n\n    @Override\n    public void onRepositoryDeleted(final Repository repository) {\n        if (repository == null) {\n            return;\n        }\n        if (repositories.containsKey(repository.getAlias())) {\n            view.removeRepository(repository);\n            repositories.remove(repository.getAlias());\n        }\n    }\n\n    @Override\n    public void onBranchChange(final String alias,\n                               final String branch) {\n        if (alias == null) {\n            return;\n        }\n\n        if (repositories.containsKey(alias)) {\n            final Repository repository = repositories.get(alias);\n            view.removeRepository(repository);\n\n            // refresh repository\n            view.addNewRepository(repository,\n                                  branch);\n        }\n    }\n\n    @Override\n    public void onNewBranchAdded(String repositoryAlias,\n                                 String branchName,\n                                 Path branchPath) {\n        //currently no actions needed\n    }\n\n    // Refresh when a Resource has been added\n    public void onResourceAdded(@Observes final ResourceAddedEvent event) {\n        refreshView(event.getPath());\n    }\n\n    // Refresh when a Resource has been deleted\n    public void onResourceDeleted(@Observes final ResourceDeletedEvent event) {\n        refreshView(event.getPath());\n    }\n\n    // Refresh when a Resource has been copied\n    public void onResourceCopied(@Observes final ResourceCopiedEvent event) {\n        refreshView(event.getDestinationPath());\n    }\n\n    // Refresh when a Resource has been renamed\n    public void onResourceRenamed(@Observes final ResourceRenamedEvent event) {\n        refreshView(event.getDestinationPath());\n    }\n\n    // Refresh when a batch Resource change has occurred\n    public void onBatchResourceChange(@Observes final ResourceBatchChangesEvent event) {\n        reset();\n    }\n\n    public void onSystemRepositoryChanged(@Observes SystemRepositoryChangedEvent event) {\n        reset();\n    }\n\n    private void refreshView(final Path path) {\n        final String pathUri = path.toURI();\n        for (final Repository repository : repositories.values()) {\n            if (repository.getDefaultBranch().isPresent()) {\n                final String repositoryUri = repository.getDefaultBranch().get().getPath().toURI();\n                if (pathUri.startsWith(repositoryUri)) {\n                    reset();\n                    break;\n                }\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.structure.repositories.Repository;\n\npublic interface FileExplorerView\n        extends IsWidget {\n\n    void reset();\n\n    void removeRepository(final Repository repo);\n\n    void addNewRepository(final Repository repo,\n                          final String branch);\n\n    void init(final FileExplorerPresenter fileExplorerPresenter);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.OpenEvent;\nimport com.google.gwt.event.logical.shared.OpenHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.core.client.tree.FSTreeItem;\nimport org.uberfire.ext.widgets.core.client.tree.Tree;\n\npublic class FileExplorerViewImpl\n        extends Composite\n        implements FileExplorerView {\n\n    private static final String REPOSITORY_ID = \"repositories\";\n    private final Map<Repository, FSTreeItem> repositoryToTreeItemMap = new HashMap<Repository, FSTreeItem>();\n    private final FlowPanel panel = GWT.create(FlowPanel.class);\n    private final Tree<FSTreeItem> tree;\n    FSTreeItem rootTreeItem = null;\n    private CommonConstants constants = CommonConstants.INSTANCE;\n    private FileExplorerPresenter presenter = null;\n\n    public FileExplorerViewImpl() {\n        this.tree = GWT.create(Tree.class);\n    }\n\n    FileExplorerViewImpl(final Tree<FSTreeItem> tree) {\n        this.tree = tree;\n    }\n\n    public void init(final FileExplorerPresenter presenter) {\n        this.presenter = presenter;\n        FSTreeItem item = new FSTreeItem(FSTreeItem.FSType.FOLDER,\n                                         constants.Repositories());\n        rootTreeItem = tree.addItem(item);\n        rootTreeItem.setState(FSTreeItem.State.OPEN);\n\n        panel.getElement().getStyle().setFloat(Style.Float.LEFT);\n        panel.getElement().getStyle().setWidth(100,\n                                               Style.Unit.PCT);\n        panel.add(tree);\n        initWidget(panel);\n\n        tree.addOpenHandler(new OpenHandler<FSTreeItem>() {\n            @Override\n            public void onOpen(final OpenEvent<FSTreeItem> event) {\n                if (needsLoading(event.getTarget())) {\n                    presenter.loadDirectoryContent(new FileExplorerItem(event.getTarget()),\n                                                   (Path) event.getTarget().getUserObject());\n                }\n            }\n        });\n\n        tree.addSelectionHandler(new SelectionHandler<FSTreeItem>() {\n            @Override\n            public void onSelection(SelectionEvent<FSTreeItem> event) {\n                final Object userObject = event.getSelectedItem().getUserObject();\n                if (userObject != null && userObject instanceof Path) {\n                    final Path path = (Path) userObject;\n                    presenter.redirect(path);\n                } else if (userObject != null && userObject instanceof Repository) {\n                    final Repository root = (Repository) userObject;\n                    presenter.redirect(root);\n                } else if (event.getSelectedItem().getUserObject() instanceof String &&\n                        (event.getSelectedItem().getUserObject()).equals(REPOSITORY_ID)) {\n                    presenter.redirectRepositoryList();\n                }\n            }\n        });\n    }\n\n    @Override\n    public void reset() {\n        rootTreeItem.setUserObject(REPOSITORY_ID);\n        rootTreeItem.addItem(FSTreeItem.FSType.LOADING,\n                             constants.Loading());\n        rootTreeItem.removeItems();\n        repositoryToTreeItemMap.clear();\n    }\n\n    @Override\n    public void removeRepository(final Repository repo) {\n        if (!repositoryToTreeItemMap.containsKey(repo)) {\n            return;\n        }\n        final FSTreeItem repositoryRootItem = repositoryToTreeItemMap.remove(repo);\n        repositoryRootItem.remove();\n    }\n\n    @Override\n    public void addNewRepository(final Repository repository,\n                                 final String branchName) {\n        final FSTreeItem repositoryRootItem = rootTreeItem.addItem(FSTreeItem.FSType.FOLDER,\n                                                                   repository.getAlias());\n        repositoryRootItem.setUserObject(repository);\n        repositoryRootItem.setState(FSTreeItem.State.OPEN,\n                                    false,\n                                    false);\n\n        repositoryToTreeItemMap.put(repository,\n                                    repositoryRootItem);\n\n        repository.getBranch(branchName).ifPresent(branch -> presenter.loadDirectoryContent(new FileExplorerItem(repositoryRootItem),\n                                                                                            branch.getPath()));\n    }\n\n    boolean needsLoading(final FSTreeItem item) {\n        return item.getUserObject() instanceof Path\n                && item.getFSType() == FSTreeItem.FSType.FOLDER\n                && item.getChildCount() == 1\n                && constants.Loading().equals(item.getChild(0).getText());\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/fileexplorer/PathSelectedEvent.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic class PathSelectedEvent {\n\n    private Path path;\n\n    public PathSelectedEvent() {\n    }\n\n    public PathSelectedEvent(Path path) {\n        this.path = path;\n    }\n\n    public Path getPath() {\n        return path;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/RepositoryPreferences.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.editors.repository;\n\npublic class RepositoryPreferences {\n\n    private boolean ouMandatory;\n\n    public RepositoryPreferences(boolean ouMandatory) {\n        this.ouMandatory = ouMandatory;\n    }\n\n    public boolean isOUMandatory() {\n        return ouMandatory;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/clone/CloneRepositoryPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.client.editors.repository.RepositoryPreferences;\nimport org.guvnor.structure.events.AfterCreateOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryAlreadyExistsException;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.util.URIUtil;\n\n@Dependent\npublic class CloneRepositoryPresenter implements CloneRepositoryView.Presenter {\n\n    private RepositoryPreferences repositoryPreferences;\n\n    private CloneRepositoryView view;\n\n    private Caller<RepositoryService> repositoryService;\n\n    private Caller<OrganizationalUnitService> organizationalUnitService;\n\n    private PlaceManager placeManager;\n\n    private Map<String, OrganizationalUnit> availableOrganizationalUnits = new HashMap<String, OrganizationalUnit>();\n\n    @Inject\n    public CloneRepositoryPresenter(final RepositoryPreferences repositoryPreferences,\n                                    final CloneRepositoryView view,\n                                    final Caller<RepositoryService> repositoryService,\n                                    final Caller<OrganizationalUnitService> organizationalUnitService,\n                                    final PlaceManager placeManager) {\n        this.repositoryPreferences = repositoryPreferences;\n        this.view = view;\n        this.repositoryService = repositoryService;\n        this.organizationalUnitService = organizationalUnitService;\n        this.placeManager = placeManager;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this,\n                  isOuMandatory());\n        populateOrganizationalUnits();\n    }\n\n    @Override\n    public void handleCancelClick() {\n        view.hide();\n    }\n\n    @Override\n    public void handleCloneClick() {\n        boolean urlConditionsMet = setUrl();\n        boolean ouConditionsMet = setOrganizationalUnitGroupType();\n        boolean nameConditionsMet = setNameGroupType();\n\n        if (urlConditionsMet && ouConditionsMet && nameConditionsMet) {\n            repositoryService.call(getNormalizeRepositoryNameCallback()).normalizeRepositoryName(view.getName());\n        }\n    }\n\n    public void onCreateOrganizationalUnit(@Observes final AfterCreateOrganizationalUnitEvent event) {\n        final OrganizationalUnit organizationalUnit = event.getOrganizationalUnit();\n        if (organizationalUnit == null) {\n            return;\n        }\n        view.addOrganizationalUnit(organizationalUnit);\n        availableOrganizationalUnits.put(organizationalUnit.getName(),\n                                         organizationalUnit);\n    }\n\n    public void onDeleteOrganizationalUnit(@Observes final RemoveOrganizationalUnitEvent event) {\n        final OrganizationalUnit organizationalUnit = event.getOrganizationalUnit();\n        if (organizationalUnit == null) {\n            return;\n        }\n        view.deleteOrganizationalUnit(organizationalUnit);\n        availableOrganizationalUnits.remove(organizationalUnit.getName());\n    }\n\n    private RemoteCallback<String> getNormalizeRepositoryNameCallback() {\n        return new RemoteCallback<String>() {\n            @Override\n            public void callback(final String normalizedName) {\n                if (!view.getName().equals(normalizedName)) {\n                    if (!view.showAgreeNormalizeNameWindow(normalizedName)) {\n                        return;\n                    }\n                    view.setName(normalizedName);\n                }\n\n                lockScreen();\n\n                final String scheme = \"git\";\n                final String alias = view.getName().trim();\n                repositoryService.call(getCreateRepositoryCallback(),\n                                       getErrorCallback()).createRepository(availableOrganizationalUnits.get(view.getSelectedOrganizationalUnit()),\n                                                                            scheme,\n                                                                            alias,\n                                                                            getRepositoryConfiguration(view.getSelectedOrganizationalUnit()));\n            }\n        };\n    }\n\n    private RepositoryEnvironmentConfigurations getRepositoryConfiguration(String selectedOrganizationalUnit) {\n        final RepositoryEnvironmentConfigurations configuration = new RepositoryEnvironmentConfigurations();\n\n        configuration.setUserName(view.getUsername().trim());\n        configuration.setPassword(view.getPassword().trim());\n        configuration.setOrigin(view.getGitUrl());\n        configuration.setSpace(selectedOrganizationalUnit);\n        return configuration;\n    }\n\n    private RemoteCallback<Repository> getCreateRepositoryCallback() {\n        return new RemoteCallback<Repository>() {\n            @Override\n            public void callback(final Repository o) {\n                view.alertRepositoryCloned();\n                unlockScreen();\n                view.hide();\n                placeManager.goTo(new DefaultPlaceRequest(\"RepositoryEditor\").addParameter(\"alias\",\n                                                                                           o.getAlias()));\n            }\n        };\n    }\n\n    private ErrorCallback<Message> getErrorCallback() {\n        return new ErrorCallback<Message>() {\n            @Override\n            public boolean error(final Message message,\n                                 final Throwable throwable) {\n                try {\n                    throw throwable;\n                } catch (RepositoryAlreadyExistsException ex) {\n                    view.errorRepositoryAlreadyExist();\n                } catch (Throwable ex) {\n                    view.errorCloneRepositoryFail(ex);\n                }\n                unlockScreen();\n                return true;\n            }\n        };\n    }\n\n    private boolean setNameGroupType() {\n        if (view.isNameEmpty()) {\n            view.setNameGroupType(ValidationState.ERROR);\n            view.showNameHelpMandatoryMessage();\n            return false;\n        } else {\n            view.setNameGroupType(ValidationState.NONE);\n            return true;\n        }\n    }\n\n    private boolean setOrganizationalUnitGroupType() {\n        if (isOuMandatory() && !availableOrganizationalUnits.containsKey(view.getSelectedOrganizationalUnit())) {\n            view.setOrganizationalUnitGroupType(ValidationState.ERROR);\n            view.showOrganizationalUnitHelpMandatoryMessage();\n            return false;\n        } else {\n            view.setOrganizationalUnitGroupType(ValidationState.NONE);\n            return true;\n        }\n    }\n\n    private boolean setUrl() {\n        if (view.isGitUrlEmpty()) {\n            view.setUrlGroupType(ValidationState.ERROR);\n            view.showUrlHelpMandatoryMessage();\n            return false;\n        } else if (!URIUtil.isValid(view.getGitUrl())) {\n            view.setUrlGroupType(ValidationState.ERROR);\n            view.showUrlHelpInvalidFormatMessage();\n            return false;\n        } else {\n            view.setUrlGroupType(ValidationState.NONE);\n            return true;\n        }\n    }\n\n    public void showForm() {\n        view.reset();\n        view.show();\n    }\n\n    private void populateOrganizationalUnits() {\n        //populate Organizational Units list box\n        organizationalUnitService.call(new RemoteCallback<Collection<OrganizationalUnit>>() {\n                                           @Override\n                                           public void callback(final Collection<OrganizationalUnit> organizationalUnits) {\n                                               view.addOrganizationalUnitSelectEntry();\n                                               if (organizationalUnits != null && !organizationalUnits.isEmpty()) {\n                                                   for (OrganizationalUnit organizationalUnit : organizationalUnits) {\n                                                       view.addOrganizationalUnit(organizationalUnit);\n                                                       availableOrganizationalUnits.put(organizationalUnit.getName(),\n                                                                                        organizationalUnit);\n                                                   }\n                                               }\n                                           }\n                                       },\n                                       new ErrorCallback<Message>() {\n                                           @Override\n                                           public boolean error(final Message message,\n                                                                final Throwable throwable) {\n                                               view.errorLoadOrganizationalUnitsFail(throwable);\n                                               return false;\n                                           }\n                                       }).getOrganizationalUnits();\n    }\n\n    private void lockScreen() {\n        view.showBusyPopupMessage();\n        view.setPopupCloseVisible(false);\n        view.setCloneEnabled(false);\n        view.setCancelEnabled(false);\n        view.setPasswordEnabled(false);\n        view.setUsernameEnabled(false);\n        view.setGitUrlEnabled(false);\n        view.setOrganizationalUnitEnabled(false);\n        view.setNameEnabled(false);\n    }\n\n    private void unlockScreen() {\n        view.closeBusyPopup();\n        view.setPopupCloseVisible(true);\n        view.setCloneEnabled(true);\n        view.setCancelEnabled(true);\n        view.setPasswordEnabled(true);\n        view.setUsernameEnabled(true);\n        view.setGitUrlEnabled(true);\n        view.setOrganizationalUnitEnabled(true);\n        view.setNameEnabled(true);\n    }\n\n    private boolean isOuMandatory() {\n        return repositoryPreferences == null || repositoryPreferences.isOUMandatory();\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/clone/CloneRepositoryView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\n\npublic interface CloneRepositoryView {\n\n    interface Presenter {\n\n        void handleCancelClick();\n\n        void handleCloneClick();\n    }\n\n    void init(Presenter presenter,\n              boolean isOuMandatory);\n\n    void hide();\n\n    void show();\n\n    void addOrganizationalUnitSelectEntry();\n\n    void addOrganizationalUnit(OrganizationalUnit ou);\n\n    void deleteOrganizationalUnit(OrganizationalUnit ou);\n\n    String getSelectedOrganizationalUnit();\n\n    boolean isGitUrlEmpty();\n\n    boolean isNameEmpty();\n\n    String getGitUrl();\n\n    String getUsername();\n\n    String getPassword();\n\n    String getName();\n\n    void setName(String name);\n\n    void showUrlHelpMandatoryMessage();\n\n    void showUrlHelpInvalidFormatMessage();\n\n    void setUrlGroupType(ValidationState state);\n\n    void showNameHelpMandatoryMessage();\n\n    void setNameGroupType(ValidationState state);\n\n    void showOrganizationalUnitHelpMandatoryMessage();\n\n    void setOrganizationalUnitGroupType(ValidationState state);\n\n    void setNameEnabled(boolean enabled);\n\n    void setOrganizationalUnitEnabled(boolean enabled);\n\n    void setGitUrlEnabled(boolean enabled);\n\n    void setUsernameEnabled(boolean enabled);\n\n    void setPasswordEnabled(boolean enabled);\n\n    void setCloneEnabled(boolean enabled);\n\n    void setCancelEnabled(boolean enabled);\n\n    void setPopupCloseVisible(boolean closeVisible);\n\n    void showBusyPopupMessage();\n\n    void closeBusyPopup();\n\n    boolean showAgreeNormalizeNameWindow(String normalizedName);\n\n    void alertRepositoryCloned();\n\n    void errorRepositoryAlreadyExist();\n\n    void errorCloneRepositoryFail(Throwable cause);\n\n    void errorLoadOrganizationalUnitsFail(Throwable cause);\n\n    void reset();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/clone/CloneRepositoryViewImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.KeyPressEvent;\nimport com.google.gwt.event.dom.client.KeyPressHandler;\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.FormGroup;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.gwtbootstrap3.client.ui.HelpBlock;\nimport org.gwtbootstrap3.client.ui.Input;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.gwtbootstrap3.extras.select.client.ui.Option;\nimport org.gwtbootstrap3.extras.select.client.ui.Select;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.ext.widgets.common.client.common.popups.BaseModal;\nimport org.uberfire.ext.widgets.common.client.common.popups.errors.ErrorPopup;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\n\n@Dependent\npublic class CloneRepositoryViewImpl extends BaseModal implements CloneRepositoryView,\n                                                                  HasCloseHandlers<CloneRepositoryViewImpl> {\n\n    interface CloneRepositoryFormBinder\n            extends\n            UiBinder<Widget, CloneRepositoryViewImpl> {\n\n    }\n\n    private CloneRepositoryView.Presenter presenter;\n\n    private static CloneRepositoryFormBinder uiBinder = GWT.create(CloneRepositoryFormBinder.class);\n\n    @UiField\n    Button clone;\n\n    @UiField\n    Button cancel;\n\n    @UiField\n    FormGroup organizationalUnitGroup;\n\n    @UiField\n    Select organizationalUnitDropdown;\n\n    @UiField\n    HelpBlock organizationalUnitHelpInline;\n\n    @UiField\n    FormGroup nameGroup;\n\n    @UiField\n    TextBox nameTextBox;\n\n    @UiField\n    HelpBlock nameHelpInline;\n\n    @UiField\n    FormGroup urlGroup;\n\n    @UiField\n    TextBox gitURLTextBox;\n\n    @UiField\n    HelpBlock urlHelpInline;\n\n    @UiField\n    TextBox usernameTextBox;\n\n    @UiField\n    Input passwordTextBox;\n\n    @UiField\n    FormLabel ouLabel;\n\n    @UiField\n    BaseModal popup;\n\n    @UiHandler(\"clone\")\n    public void onCloneClick(final ClickEvent e) {\n        presenter.handleCloneClick();\n    }\n\n    @UiHandler(\"cancel\")\n    public void onCancelClick(final ClickEvent e) {\n        presenter.handleCancelClick();\n    }\n\n    @Override\n    public void init(final CloneRepositoryView.Presenter presenter,\n                     final boolean isOuMandatory) {\n        this.presenter = presenter;\n\n        setBody(uiBinder.createAndBindUi(this));\n        setTitle(CoreConstants.INSTANCE.CloneRepository());\n\n        ouLabel.setShowRequiredIndicator(isOuMandatory);\n\n        nameTextBox.addKeyPressHandler(new KeyPressHandler() {\n            @Override\n            public void onKeyPress(final KeyPressEvent event) {\n                nameGroup.setValidationState(ValidationState.NONE);\n                nameHelpInline.setText(\"\");\n            }\n        });\n\n        organizationalUnitDropdown.addValueChangeHandler(e -> {\n            organizationalUnitGroup.setValidationState(ValidationState.NONE);\n            organizationalUnitHelpInline.setText(\"\");\n        });\n\n        gitURLTextBox.addKeyPressHandler(new KeyPressHandler() {\n            @Override\n            public void onKeyPress(final KeyPressEvent event) {\n                urlGroup.setValidationState(ValidationState.NONE);\n                urlHelpInline.setText(\"\");\n            }\n        });\n    }\n\n    @Override\n    public void addOrganizationalUnitSelectEntry() {\n        final Option option = new Option();\n        option.setText(CoreConstants.INSTANCE.SelectEntry());\n        organizationalUnitDropdown.add(option);\n        organizationalUnitDropdown.refresh();\n    }\n\n    @Override\n    public void addOrganizationalUnit(final OrganizationalUnit ou) {\n        final String text = ou.getName();\n        final String value = ou.getName();\n        final Option option = new Option();\n        option.setText(text);\n        option.setValue(value);\n        organizationalUnitDropdown.add(option);\n        organizationalUnitDropdown.refresh();\n    }\n\n    @Override\n    public void deleteOrganizationalUnit(final OrganizationalUnit ou) {\n        Option optToDelete = null;\n        for (int i = 0; i < organizationalUnitDropdown.getWidgetCount(); i++) {\n            final Widget w = organizationalUnitDropdown.getWidget(i);\n            if (w instanceof Option) {\n                final Option o = (Option) w;\n                if (o.getText().equals(ou.getName())) {\n                    optToDelete = o;\n                    break;\n                }\n            }\n        }\n        if (optToDelete != null) {\n            organizationalUnitDropdown.remove(optToDelete);\n            organizationalUnitDropdown.refresh();\n        }\n    }\n\n    @Override\n    public String getSelectedOrganizationalUnit() {\n        return organizationalUnitDropdown.getValue();\n    }\n\n    @Override\n    public boolean isGitUrlEmpty() {\n        return gitURLTextBox.getText() == null || gitURLTextBox.getText().trim().isEmpty();\n    }\n\n    @Override\n    public boolean isNameEmpty() {\n        return nameTextBox.getText() == null || nameTextBox.getText().trim().isEmpty();\n    }\n\n    @Override\n    public String getGitUrl() {\n        return gitURLTextBox.getText().trim();\n    }\n\n    @Override\n    public String getUsername() {\n        return usernameTextBox.getText();\n    }\n\n    @Override\n    public String getPassword() {\n        return passwordTextBox.getText();\n    }\n\n    @Override\n    public String getName() {\n        return nameTextBox.getText();\n    }\n\n    @Override\n    public void setName(final String name) {\n        nameTextBox.setText(name);\n    }\n\n    @Override\n    public void showUrlHelpMandatoryMessage() {\n        urlHelpInline.setText(CoreConstants.INSTANCE.URLMandatory());\n    }\n\n    @Override\n    public void showUrlHelpInvalidFormatMessage() {\n        urlHelpInline.setText(CoreConstants.INSTANCE.InvalidUrlFormat());\n    }\n\n    @Override\n    public void setUrlGroupType(final ValidationState state) {\n        urlGroup.setValidationState(state);\n    }\n\n    @Override\n    public void showNameHelpMandatoryMessage() {\n        nameHelpInline.setText(CoreConstants.INSTANCE.RepositoryNaneMandatory());\n    }\n\n    @Override\n    public void setNameGroupType(final ValidationState state) {\n        nameGroup.setValidationState(state);\n    }\n\n    @Override\n    public void showOrganizationalUnitHelpMandatoryMessage() {\n        organizationalUnitHelpInline.setText(CoreConstants.INSTANCE.OrganizationalUnitMandatory());\n    }\n\n    @Override\n    public void setOrganizationalUnitGroupType(final ValidationState state) {\n        organizationalUnitGroup.setValidationState(state);\n    }\n\n    @Override\n    public void setNameEnabled(final boolean enabled) {\n        nameTextBox.setEnabled(enabled);\n    }\n\n    @Override\n    public void setOrganizationalUnitEnabled(final boolean enabled) {\n        organizationalUnitDropdown.setEnabled(enabled);\n        organizationalUnitDropdown.refresh();\n    }\n\n    @Override\n    public void setGitUrlEnabled(final boolean enabled) {\n        gitURLTextBox.setEnabled(enabled);\n    }\n\n    @Override\n    public void setUsernameEnabled(final boolean enabled) {\n        usernameTextBox.setEnabled(enabled);\n    }\n\n    @Override\n    public void setPasswordEnabled(final boolean enabled) {\n        passwordTextBox.setEnabled(enabled);\n    }\n\n    @Override\n    public void setCloneEnabled(final boolean enabled) {\n        clone.setEnabled(enabled);\n    }\n\n    @Override\n    public void setCancelEnabled(final boolean enabled) {\n        cancel.setEnabled(enabled);\n    }\n\n    @Override\n    public void setPopupCloseVisible(final boolean closeVisible) {\n        setClosable(closeVisible);\n    }\n\n    @Override\n    public void showBusyPopupMessage() {\n        BusyPopup.showMessage(CoreConstants.INSTANCE.Cloning());\n    }\n\n    @Override\n    public void closeBusyPopup() {\n        BusyPopup.close();\n    }\n\n    @Override\n    public boolean showAgreeNormalizeNameWindow(final String normalizedName) {\n        return Window.confirm(CoreConstants.INSTANCE.RepositoryNameInvalid() + \" \\\"\" + normalizedName + \"\\\". \" + CoreConstants.INSTANCE.DoYouAgree());\n    }\n\n    @Override\n    public void alertRepositoryCloned() {\n        Window.alert(CoreConstants.INSTANCE.RepoCloneSuccess() + \"\\n\\n\" + CommonConstants.INSTANCE.IndexClonedRepositoryWarning());\n    }\n\n    @Override\n    public void errorRepositoryAlreadyExist() {\n        ErrorPopup.showMessage(CoreConstants.INSTANCE.RepoAlreadyExists());\n    }\n\n    @Override\n    public void errorCloneRepositoryFail(final Throwable cause) {\n        ErrorPopup.showMessage(CommonConstants.INSTANCE.RepoCloneFail() + \" \\n\" + cause.getMessage());\n    }\n\n    @Override\n    public void errorLoadOrganizationalUnitsFail(final Throwable cause) {\n        ErrorPopup.showMessage(CoreConstants.INSTANCE.CantLoadOrganizationalUnits() + \" \\n\" + cause.getMessage());\n    }\n\n    @Override\n    public HandlerRegistration addCloseHandler(final CloseHandler<CloneRepositoryViewImpl> handler) {\n        return addHandler(handler,\n                          CloseEvent.getType());\n    }\n\n    @Override\n    public void reset() {\n        nameTextBox.setText(\"\");\n        nameGroup.setValidationState(ValidationState.NONE);\n        nameHelpInline.setText(\"\");\n\n        organizationalUnitDropdown.setValue(\"\");\n        organizationalUnitDropdown.refresh();\n        organizationalUnitGroup.setValidationState(ValidationState.NONE);\n        organizationalUnitHelpInline.setText(\"\");\n\n        gitURLTextBox.setText(\"\");\n        urlGroup.setValidationState(ValidationState.NONE);\n        urlHelpInline.setText(\"\");\n\n        usernameTextBox.setText(\"\");\n        passwordTextBox.setText(\"\");\n    }\n\n    @Override\n    public void show() {\n        popup.show();\n    }\n\n    @Override\n    public void hide() {\n        popup.hide();\n        CloseEvent.fire(this,\n                        this);\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/clone/CloneRepositoryViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:kie=\"urn:import:org.uberfire.ext.widgets.common.client.common.popups\"\n             xmlns:select=\"urn:import:org.gwtbootstrap3.extras.select.client.ui\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n  <ui:with field=\"commoni18n\" type=\"org.guvnor.structure.client.resources.i18n.CommonConstants\"/>\n\n  <g:HTMLPanel>\n    <kie:BaseModal ui:field=\"popup\" title=\"{i18n.CloneRepository}\" dataBackdrop=\"STATIC\" dataKeyboard=\"true\" fade=\"true\">\n      <b:ModalBody>\n        <b:Form type=\"HORIZONTAL\">\n          <b:FieldSet>\n            <b:Legend>\n              <ui:text from=\"{i18n.RepoInformation}\"/>\n            </b:Legend>\n            <b:FormGroup ui:field=\"nameGroup\">\n              <b:FormLabel for=\"name\" showRequiredIndicator=\"true\" addStyleNames=\"col-md-4\">\n                <ui:text from=\"{i18n.RepoName}\"/>\n              </b:FormLabel>\n              <b:Column size=\"MD_8\">\n                <b:TextBox b:id=\"name\" ui:field=\"nameTextBox\" placeholder=\"{i18n.RepoNameHolder}\"/>\n                <b:HelpBlock ui:field=\"nameHelpInline\"/>\n              </b:Column>\n            </b:FormGroup>\n            <b:FormGroup ui:field=\"organizationalUnitGroup\">\n              <b:FormLabel ui:field=\"ouLabel\" for=\"ou\" showRequiredIndicator=\"true\" addStyleNames=\"col-md-4\">\n                <ui:text from=\"{i18n.OrganizationalUnit}\"/>\n              </b:FormLabel>\n              <b:Column size=\"MD_8\">\n                <select:Select b:id=\"ou\" ui:field=\"organizationalUnitDropdown\"/>\n                <b:HelpBlock ui:field=\"organizationalUnitHelpInline\"/>\n              </b:Column>\n            </b:FormGroup>\n            <b:FormGroup ui:field=\"urlGroup\">\n              <b:FormLabel for=\"url\" showRequiredIndicator=\"true\" addStyleNames=\"col-md-4\">\n                <ui:text from=\"{i18n.GitUrl}\"/>\n              </b:FormLabel>\n              <b:Column size=\"MD_8\">\n                <b:TextBox b:id=\"url\" ui:field=\"gitURLTextBox\" placeholder=\"{i18n.GitUrlHolder}\"/>\n                <b:HelpBlock ui:field=\"urlHelpInline\"/>\n              </b:Column>\n            </b:FormGroup>\n            <b:FormGroup>\n              <b:FormLabel for=\"username\" addStyleNames=\"col-md-4\">\n                <ui:text from=\"{i18n.UserName}\"/>\n              </b:FormLabel>\n              <b:Column size=\"MD_8\">\n                <b:TextBox b:id=\"username\" ui:field=\"usernameTextBox\" placeholder=\"{i18n.UserNameHolder}\"/>\n              </b:Column>\n            </b:FormGroup>\n            <b:FormGroup>\n              <b:FormLabel for=\"password\" addStyleNames=\"col-md-4\">\n                <ui:text from=\"{i18n.Password}\"/>\n              </b:FormLabel>\n              <b:Column size=\"MD_8\">\n                <b:Input b:id=\"password\" ui:field=\"passwordTextBox\" type=\"PASSWORD\" placeholder=\"{i18n.PasswordHolder}\"/>\n              </b:Column>\n            </b:FormGroup>\n          </b:FieldSet>\n        </b:Form>\n      </b:ModalBody>\n      <b:ModalFooter>\n        <b:Button type=\"DEFAULT\" ui:field=\"cancel\">\n          <ui:text from=\"{i18n.Cancel}\"/>\n        </b:Button>\n        <b:Button icon=\"CLOUD_DOWNLOAD\" type=\"PRIMARY\" ui:field=\"clone\">\n          <ui:text from=\"{i18n.Clone}\"/>\n        </b:Button>\n      </b:ModalFooter>\n    </kie:BaseModal>\n  </g:HTMLPanel>\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/common/CopyRepositoryUrlBtn.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.common;\n\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.gwtbootstrap3.client.ui.InputGroupAddon;\n\npublic class CopyRepositoryUrlBtn extends InputGroupAddon {\n\n    public void init(boolean isViewButton,\n                     String uri,\n                     String text) {\n        setDataClipboardTargetAttribute(uri);\n        setDataClipboardTextAttribute(text);\n        setButtonAttribute(isViewButton,\n                           uri);\n        setCopyRepositoryUrlTitle();\n    }\n\n    protected void setDataClipboardTargetAttribute(String value) {\n        getElement().setAttribute(\"data-clipboard-target\",\n                                  value);\n    }\n\n    protected void setDataClipboardTextAttribute(String value) {\n        getElement().setAttribute(\"data-clipboard-text\",\n                                  value);\n    }\n\n    protected void setButtonAttribute(boolean isViewButton,\n                                      String value) {\n        String idBase = isViewButton ? \"view-button-\" : \"button-\";\n        getElement().setId(idBase + value);\n    }\n\n    protected void setCopyRepositoryUrlTitle() {\n        getElement().setTitle(CommonConstants.INSTANCE.copyRepositoryUrl());\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/edit/RepositoryEditorPresenter.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.edit;\n\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.common.services.project.client.security.ProjectController;\nimport org.guvnor.common.services.project.model.WorkspaceProject;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.RepositoryInfo;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.RepositoryServiceEditor;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.promise.Promises;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n@Dependent\n@WorkbenchScreen(identifier = \"RepositoryEditor\")\npublic class RepositoryEditorPresenter {\n\n    private View view;\n    private Caller<RepositoryService> repositoryService;\n    private Caller<WorkspaceProjectService> projectService;\n    private Caller<RepositoryServiceEditor> repositoryServiceEditor;\n    private Event<NotificationEvent> notification;\n    private PlaceManager placeManager;\n    private ProjectController projectController;\n\n    private String alias = null;\n    private Path root = null;\n    private PlaceRequest place;\n    private WorkspaceProjectContext context;\n    private Promises promises;\n\n    public interface View\n            extends UberView<RepositoryEditorPresenter> {\n\n        void setRepositoryInfo(final String repositoryName,\n                               final String owner,\n                               final boolean readOnly,\n                               final List<PublicURI> publicURIs,\n                               final String description,\n                               final List<VersionRecord> initialVersionList);\n\n        void reloadHistory(final List<VersionRecord> versionList);\n\n        void addHistory(final List<VersionRecord> versionList);\n    }\n\n    public RepositoryEditorPresenter() {\n    }\n\n    @Inject\n    public RepositoryEditorPresenter(final View view,\n                                     final Caller<RepositoryService> repositoryService,\n                                     final Caller<WorkspaceProjectService> projectService,\n                                     final Caller<RepositoryServiceEditor> repositoryServiceEditor,\n                                     final Event<NotificationEvent> notification,\n                                     final PlaceManager placeManager,\n                                     final ProjectController projectController,\n                                     final WorkspaceProjectContext context,\n                                     final Promises promises) {\n        this.view = view;\n        this.repositoryService = repositoryService;\n        this.projectService = projectService;\n        this.repositoryServiceEditor = repositoryServiceEditor;\n        this.notification = notification;\n        this.placeManager = placeManager;\n        this.projectController = projectController;\n        this.context = context;\n        this.promises = promises;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n        this.place = place;\n        this.alias = place.getParameters().get(\"alias\");\n        String ouName = context.getActiveOrganizationalUnit()\n                               .map(ou -> ou.getName())\n                               .orElseThrow(() -> new IllegalStateException(\"Cannot lookup repository [\" + alias + \"] without active organizational unit.\"));\n\n        repositoryService.call((RemoteCallback<RepositoryInfo>) repo -> projectService.call(\n                (RemoteCallback<WorkspaceProject>) workspaceProject -> {\n                    root = repo.getRoot();\n                    projectController.canUpdateProject(workspaceProject).then(canUpdateProject -> {\n                        view.setRepositoryInfo(repo.getAlias(),\n                                               repo.getOwner(),\n                                               !canUpdateProject,\n                                               repo.getPublicURIs(),\n                                               CoreConstants.INSTANCE.Empty(),\n                                               repo.getInitialVersionList());\n\n                        return promises.resolve();\n                    });\n                }\n\n        ).resolveProjectByRepositoryAlias(new Space(repo.getOwner()), repo.getAlias())).getRepositoryInfo(new Space(ouName), alias);\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CoreConstants.INSTANCE.RepositoryEditor() + \" [\" + alias + \"]\";\n    }\n\n    @WorkbenchPartView\n    public UberView<RepositoryEditorPresenter> getView() {\n        return view;\n    }\n\n    void onLoadMoreHistory(final int lastIndex) {\n        String ouName = context.getActiveOrganizationalUnit()\n                                .map(ou -> ou.getName())\n                                .orElseThrow(() -> new IllegalStateException(\"Cannot lookup repository [\" + alias + \"] without active organizational unit.\"));\n        repositoryService.call(new RemoteCallback<List<VersionRecord>>() {\n            @Override\n            public void callback(final List<VersionRecord> versionList) {\n                view.addHistory(versionList);\n            }\n        }).getRepositoryHistory(new Space(ouName),\n                                alias,\n                                lastIndex);\n    }\n\n    void onRevert(final VersionRecord record) {\n        onRevert(record,\n                 null);\n    }\n\n    void onRevert(final VersionRecord record,\n                  final String comment) {\n        repositoryServiceEditor.call(new RemoteCallback<List<VersionRecord>>() {\n            @Override\n            public void callback(final List<VersionRecord> content) {\n                view.reloadHistory(content);\n            }\n        }).revertHistory(alias,\n                         root,\n                         comment,\n                         record);\n    }\n\n    void onGitUrlCopied(final String uri) {\n        notification.fire(new NotificationEvent(CommonConstants.INSTANCE.GitUriCopied(uri)));\n    }\n\n    public void onRepositoryRemovedEvent(@Observes RepositoryRemovedEvent event) {\n        if (alias.equals(event.getRepository().getAlias())) {\n            placeManager.closePlace(place);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/edit/RepositoryEditorView.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.edit;\n\nimport java.util.List;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.structure.client.editors.repository.common.CopyRepositoryUrlBtn;\nimport org.guvnor.structure.client.navigator.CommitNavigatorEntry;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.uberfire.ext.widgets.common.client.common.BusyPopup;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class RepositoryEditorView extends Composite\n        implements\n        RepositoryEditorPresenter.View {\n\n    interface RepositoryEditorViewBinder\n            extends\n            UiBinder<Widget, RepositoryEditorView> {\n\n    }\n\n    private static RepositoryEditorViewBinder uiBinder = GWT.create(RepositoryEditorViewBinder.class);\n\n    @UiField\n    public Heading repoName;\n\n    @UiField\n    public Paragraph repoDesc;\n\n    @UiField\n    public TextBox gitDaemonURI;\n\n    @UiField\n    public CopyRepositoryUrlBtn myGitCopyButton;\n\n    @UiField\n    public Paragraph linksPanel;\n\n    @UiField\n    public FlowPanel history;\n\n    @UiField\n    public Button loadMore;\n\n    private RepositoryEditorPresenter presenter;\n    private boolean readOnly;\n\n    public RepositoryEditorView() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        myGitCopyButton.addDomHandler((e) -> presenter.onGitUrlCopied(gitDaemonURI.getText()),\n                                      ClickEvent.getType());\n    }\n\n    @Override\n    public void init(final RepositoryEditorPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setRepositoryInfo(final String repositoryName,\n                                  final String owner,\n                                  final boolean readOnly,\n                                  final List<PublicURI> publicURIs,\n                                  final String description,\n                                  final List<VersionRecord> initialVersionList) {\n        this.readOnly = readOnly;\n        if (owner != null && !owner.isEmpty()) {\n            repoName.setText(owner + \" / \" + repositoryName);\n        } else {\n            repoName.setText(repositoryName);\n        }\n        repoDesc.setText(description);\n        int count = 0;\n        if (publicURIs.size() > 0) {\n            linksPanel.setText(CoreConstants.INSTANCE.AvailableProtocols());\n        }\n        for (final PublicURI publicURI : publicURIs) {\n            if (count == 0) {\n                gitDaemonURI.setText(publicURI.getURI());\n            }\n            final String protocol = publicURI.getProtocol() == null ? \"default\" : publicURI.getProtocol();\n            final Button anchor = new Button(protocol);\n            anchor.getElement().getStyle().setMarginLeft(5,\n                                                         Style.Unit.PX);\n            anchor.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    gitDaemonURI.setText(publicURI.getURI());\n                }\n            });\n            if (count != 0) {\n                anchor.getElement().getStyle().setPaddingLeft(5,\n                                                              Style.Unit.PX);\n            }\n            linksPanel.add(anchor);\n            count++;\n        }\n\n        if (initialVersionList != null && !initialVersionList.isEmpty()) {\n            loadContent(initialVersionList);\n        } else {\n            history.setVisible(false);\n        }\n\n        loadMore.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                presenter.onLoadMoreHistory(history.getWidgetCount());\n            }\n        });\n\n        final String uriId = \"uri-for-\" + repositoryName;\n        gitDaemonURI.getElement().setId(uriId);\n\n        myGitCopyButton.init(false,\n                             uriId,\n                             gitDaemonURI.getText());\n\n        glueCopy(myGitCopyButton.getElement());\n    }\n\n    @Override\n    public void reloadHistory(final List<VersionRecord> versionList) {\n        loadContent(versionList);\n        BusyPopup.close();\n    }\n\n    @Override\n    public void addHistory(List<VersionRecord> versionList) {\n        if (!versionList.isEmpty()) {\n            loadContent(versionList);\n        } else {\n            loadMore.setEnabled(false);\n        }\n    }\n\n    private void loadContent(final List<VersionRecord> versionRecordList) {\n        for (VersionRecord vr : versionRecordList) {\n            history.add(new CommitNavigatorEntry(readOnly,\n                                                 vr,\n                                                 new ParameterizedCommand<VersionRecord>() {\n                                                     @Override\n                                                     public void execute(final VersionRecord record) {\n                                                         BusyPopup.showMessage(CoreConstants.INSTANCE.Reverting());\n                                                         presenter.onRevert(record);\n                                                     }\n                                                 }));\n        }\n    }\n\n    public static native void glueCopy(final Element element) /*-{\n        var clip = new $wnd.ZeroClipboard(element);\n    }-*/;\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/edit/RepositoryEditorView.ui.xml",
    "content": "<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:html=\"urn:import:org.gwtbootstrap3.client.ui.html\"\n             xmlns:common=\"urn:import:org.guvnor.structure.client.editors.repository.common\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n  <ui:with field=\"resources\" type=\"org.guvnor.structure.client.resources.NavigatorResources\"/>\n\n  <ui:style>\n\n    .panel-body {\n      padding: 15px !important;\n    }\n\n    .panel {\n      padding: 15px;\n    }\n\n  </ui:style>\n\n  <g:HTMLPanel addStyleNames=\"{style.panel}\">\n    <b:Heading size=\"H4\" ui:field=\"repoName\">\n      <b:Icon type=\"BOOK\" size=\"LARGE\" pull=\"LEFT\"/>\n    </b:Heading>\n\n    <b:Panel>\n      <b:PanelHeader>\n        <b:Heading size=\"H3\" text=\"{i18n.GeneralInformation}\"/>\n      </b:PanelHeader>\n      <b:PanelBody addStyleNames=\"{style.panel-body}\">\n        <html:Div addStyleNames=\"row\">\n          <g:FlowPanel addStyleNames=\"col-md-12\">\n            <html:Paragraph ui:field=\"repoDesc\"/>\n            <html:Hr/>\n          </g:FlowPanel>\n        </html:Div>\n        <html:Div addStyleNames=\"row\">\n          <g:FlowPanel addStyleNames=\"col-md-6\">\n            <b:InputGroup>\n              <b:TextBox ui:field=\"gitDaemonURI\" enabled=\"false\"/>\n              <common:CopyRepositoryUrlBtn ui:field=\"myGitCopyButton\" icon=\"COPY\"/>\n            </b:InputGroup>\n          </g:FlowPanel>\n          <html:Paragraph ui:field=\"linksPanel\" addStyleNames=\"col-md-6\"/>\n        </html:Div>\n      </b:PanelBody>\n    </b:Panel>\n\n    <b:Panel>\n      <b:PanelHeader>\n        <b:Heading size=\"H3\" text=\"{i18n.CommitHistory}\"/>\n\n      </b:PanelHeader>\n      <b:PanelBody addStyleNames=\"{style.panel-body}\">\n        <g:FlowPanel ui:field=\"history\" addStyleNames=\"{resources.css.navigator}\"/>\n        <b:Button ui:field=\"loadMore\" block=\"true\">\n          <ui:text from=\"{i18n.LoadMore}\"/>\n        </b:Button>\n      </b:PanelBody>\n    </b:Panel>\n\n  </g:HTMLPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/ProtocolButton.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.Button;\n\npublic class ProtocolButton\n        extends Button {\n\n    public ProtocolButton(final String protocol,\n                          final ClickHandler clickHandler,\n                          final boolean isNotFirst) {\n        super(protocol);\n\n        getElement().getStyle().setMarginLeft(5,\n                                              Style.Unit.PX);\n\n        addClickHandler(clickHandler);\n\n        if (isNotFirst) {\n            getElement().getStyle().setPaddingLeft(5,\n                                                   Style.Unit.PX);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/PublicURIButton.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport com.google.gwt.dom.client.Style;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.gwtbootstrap3.client.ui.Button;\n\npublic class PublicURIButton\n        extends Button {\n\n    public PublicURIButton(final PublicURI protocol,\n                           final boolean isNotFirst) {\n        super(getProtocol(protocol));\n        getElement().getStyle().setMarginLeft(5,\n                                              Style.Unit.PX);\n\n        if (isNotFirst) {\n            getElement().getStyle().setPaddingLeft(5,\n                                                   Style.Unit.PX);\n        }\n    }\n\n    private static String getProtocol(final PublicURI publicURI) {\n        return publicURI.getProtocol() == null ? \"default\" : publicURI.getProtocol();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoriesPresenter.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextChangeHandler;\nimport org.guvnor.structure.config.SystemRepositoryChangedEvent;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.lifecycle.OnShutdown;\nimport org.uberfire.lifecycle.OnStartup;\n\n@Dependent\n@WorkbenchScreen(identifier = \"RepositoriesEditor\")\npublic class RepositoriesPresenter\n        implements GuvnorStructureContextChangeHandler {\n\n    private GuvnorStructureContext guvnorStructureContext;\n\n    private Map<Repository, RepositoryItemPresenter> repositoryToWidgetMap = new HashMap<Repository, RepositoryItemPresenter>();\n    private RepositoriesView view;\n    private HandlerRegistration changeHandlerRegistration;\n\n    public RepositoriesPresenter() {\n    }\n\n    @Inject\n    public RepositoriesPresenter(final RepositoriesView view,\n                                 final GuvnorStructureContext guvnorStructureContext) {\n        this.view = view;\n        this.guvnorStructureContext = guvnorStructureContext;\n\n        changeHandlerRegistration = guvnorStructureContext.addGuvnorStructureContextChangeHandler(this);\n\n        view.setPresenter(this);\n    }\n\n    @OnStartup\n    public void onStartup() {\n        loadContent();\n    }\n\n    @OnShutdown\n    public void shutdown() {\n        guvnorStructureContext.removeHandler(changeHandlerRegistration);\n    }\n\n    private void loadContent() {\n        repositoryToWidgetMap.clear();\n        view.clear();\n\n        guvnorStructureContext.getRepositories(new Callback<Collection<Repository>>() {\n            @Override\n            public void callback(final Collection<Repository> response) {\n                for (final Repository repo : response) {\n                    repositoryToWidgetMap.put(repo,\n                                              addRepositoryItem(repo,\n                                                                guvnorStructureContext.getCurrentBranch(repo.getAlias())));\n                }\n            }\n        });\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return CoreConstants.INSTANCE.RepositoryEditor();\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return view.asWidget();\n    }\n\n    @Override\n    public void onNewRepositoryAdded(final Repository repository) {\n        addRepositoryItem(repository,\n                          repository.getDefaultBranch().get().getName());\n    }\n\n    @Override\n    public void onNewBranchAdded(String repositoryAlias,\n                                 String branchName,\n                                 Path branchPath) {\n        Repository repository = getRepositoryByAlias(repositoryAlias);\n        if (repository != null && (repository instanceof GitRepository)) {\n            //only git repositories exists\n            RepositoryItemPresenter itemPresenter = repositoryToWidgetMap.remove(repository);\n            if (itemPresenter != null) {\n                ((GitRepository) repository).addBranch(new Branch(branchName,\n                                                                  branchPath));\n                repositoryToWidgetMap.put(repository,\n                                          itemPresenter);\n                itemPresenter.refreshBranches();\n            }\n        }\n    }\n\n    @Override\n    public void onRepositoryDeleted(final Repository repository) {\n        final RepositoryItemPresenter repositoryItem = repositoryToWidgetMap.remove(repository);\n        view.removeIfExists(repositoryItem);\n    }\n\n    private RepositoryItemPresenter addRepositoryItem(final Repository newRepository,\n                                                      final String branch) {\n        final RepositoryItemPresenter repositoryItemPresenter = view.addRepository(newRepository,\n                                                                                   branch);\n        repositoryToWidgetMap.put(newRepository,\n                                  repositoryItemPresenter);\n\n        return repositoryItemPresenter;\n    }\n\n    public void onSystemRepositoryChanged(@Observes final SystemRepositoryChangedEvent event) {\n        loadContent();\n    }\n\n    private Repository getRepositoryByAlias(final String alias) {\n        for (Repository repository : repositoryToWidgetMap.keySet()) {\n            if (repository.getAlias().equals(alias)) {\n                return repository;\n            }\n        }\n        return null;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoriesView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.guvnor.structure.repositories.Repository;\n\npublic interface RepositoriesView\n        extends IsWidget {\n\n    RepositoryItemPresenter addRepository(final Repository repository,\n                                          final String branch);\n\n    void removeIfExists(final RepositoryItemPresenter repositoryItem);\n\n    void clear();\n\n    void setPresenter(final RepositoriesPresenter presenter);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoriesViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.ioc.client.container.IOC;\n\n@Dependent\npublic class RepositoriesViewImpl\n        extends Composite\n        implements RepositoriesView,\n                   RequiresResize {\n\n    private static RepositoriesEditorViewBinder uiBinder = GWT.create(RepositoriesEditorViewBinder.class);\n\n    @UiField\n    public FlowPanel panel;\n\n    private RepositoriesPresenter presenter;\n\n    public RepositoriesViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    @Override\n    public RepositoryItemPresenter addRepository(final Repository repository,\n                                                 final String branch) {\n        final RepositoryItemPresenter item = IOC.getBeanManager().lookupBean(RepositoryItemPresenter.class).newInstance();\n\n        item.setRepository(repository,\n                           branch);\n        panel.add(item);\n\n        return item;\n    }\n\n    @Override\n    public void removeIfExists(final RepositoryItemPresenter repositoryItem) {\n        panel.remove(repositoryItem);\n    }\n\n    @Override\n    public void clear() {\n        panel.clear();\n    }\n\n    @Override\n    public void setPresenter(final RepositoriesPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void onResize() {\n        int height = getParent().getOffsetHeight();\n        int width = getParent().getOffsetWidth();\n        panel.setPixelSize(width,\n                           height);\n    }\n\n    interface RepositoriesEditorViewBinder\n            extends\n            UiBinder<Widget, RepositoriesViewImpl> {\n\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoriesViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:gwt=\"urn:import:com.google.gwt.user.client.ui\">\n\n  <ui:style>\n\n    .panel {\n        padding: 15px;\n    }\n\n  </ui:style>\n  <gwt:FlowPanel ui:field=\"panel\" addStyleNames=\"{style.panel}\" />\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoryItemPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.workbench.events.NotificationEvent;\n\npublic class RepositoryItemPresenter\n        implements IsWidget {\n\n    private Repository repository;\n\n    private RepositoryItemView view;\n    private GuvnorStructureContext guvnorStructureContext;\n    private Event<NotificationEvent> notification;\n\n    public RepositoryItemPresenter() {\n    }\n\n    @Inject\n    public RepositoryItemPresenter(final RepositoryItemView repositoryItemView,\n                                   final GuvnorStructureContext guvnorStructureContext,\n                                   final Event<NotificationEvent> notification) {\n        this.view = repositoryItemView;\n        this.guvnorStructureContext = guvnorStructureContext;\n        this.notification = notification;\n    }\n\n    public void setRepository(final Repository repository,\n                              final String branch) {\n        this.repository = repository;\n\n        view.setPresenter(this);\n\n        view.setRepositoryName(repository.getAlias());\n\n        view.setRepositoryDescription(CoreConstants.INSTANCE.Empty());\n\n        if (repository.getPublicURIs().size() > 0) {\n            view.showAvailableProtocols();\n        }\n\n        setPublicURIs();\n\n        view.setUriId(\"view-uri-for-\" + repository.getAlias());\n\n        populateBranches(branch);\n\n        view.refresh();\n    }\n\n    public void refreshBranches() {\n        populateBranches(view.getSelectedBranch());\n        view.refresh();\n    }\n\n    private void setPublicURIs() {\n        int count = 0;\n        for (final PublicURI publicURI : repository.getPublicURIs()) {\n            if (count == 0) {\n                view.setDaemonURI(publicURI.getURI());\n            }\n            final String protocol = getProtocol(publicURI);\n\n            view.addProtocol(protocol);\n            count++;\n        }\n    }\n\n    private void populateBranches(final String currentBranch) {\n        final ArrayList<Branch> branches = new ArrayList<>(repository.getBranches());\n\n        Collections.reverse(branches);\n\n        view.clearBranches();\n        for (Branch branch : branches) {\n            view.addBranch(branch.getName());\n        }\n        view.setSelectedBranch(currentBranch);\n    }\n\n    public void onAnchorSelected(final String protocol) {\n        for (PublicURI publicURI : repository.getPublicURIs()) {\n            if (protocol.equals(getProtocol(publicURI))) {\n                view.setDaemonURI(publicURI.getURI());\n                break;\n            }\n        }\n    }\n\n    private String getProtocol(final PublicURI publicURI) {\n        return publicURI.getProtocol() == null ? \"default\" : publicURI.getProtocol();\n    }\n\n    public void onUpdateRepository(final String branch) {\n        guvnorStructureContext.changeBranch(repository.getAlias(),\n                                            branch);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    void onGitUrlCopied(final String uri) {\n        notification.fire(new NotificationEvent(CommonConstants.INSTANCE.GitUriCopied(uri)));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoryItemView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface RepositoryItemView\n        extends IsWidget {\n\n    void setRepositoryName(final String repositoryName);\n\n    void setRepositoryDescription(final String description);\n\n    void showAvailableProtocols();\n\n    void setDaemonURI(final String uri);\n\n    void addProtocol(final String protocol);\n\n    void setPresenter(final RepositoryItemPresenter presenter);\n\n    void setUriId(final String uriID);\n\n    void addBranch(final String branch);\n\n    void clearBranches();\n\n    void refresh();\n\n    void setSelectedBranch(final String currentBranch);\n\n    String getSelectedBranch();\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoryItemViewImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.guvnor.structure.client.editors.repository.common.CopyRepositoryUrlBtn;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Heading;\nimport org.gwtbootstrap3.client.ui.TextBox;\nimport org.gwtbootstrap3.client.ui.html.Paragraph;\nimport org.gwtbootstrap3.extras.select.client.ui.Option;\nimport org.gwtbootstrap3.extras.select.client.ui.Select;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\n\npublic class RepositoryItemViewImpl\n        extends Composite\n        implements RepositoryItemView {\n\n    private static RepositoriesViewItemBinder uiBinder = GWT.create(RepositoriesViewItemBinder.class);\n\n    @UiField\n    public Heading repoName;\n\n    @UiField\n    public Paragraph repoDesc;\n\n    @UiField\n    public TextBox gitDaemonURI;\n\n    @UiField\n    public CopyRepositoryUrlBtn myGitCopyButton;\n\n    @UiField\n    public Paragraph linksPanel;\n\n    @UiField\n    public Select branchesDropdown;\n\n    @UiField\n    public Button btnChangeBranch;\n\n    private RepositoryItemPresenter presenter;\n\n    @Inject\n    public RepositoryItemViewImpl() {\n        initWidget(uiBinder.createAndBindUi(this));\n\n        myGitCopyButton.addDomHandler((e) -> presenter.onGitUrlCopied(gitDaemonURI.getText()),\n                                      ClickEvent.getType());\n\n        glueCopy(myGitCopyButton.getElement());\n    }\n\n    public static native void glueCopy(final com.google.gwt.user.client.Element element) /*-{\n        var clip = new $wnd.ZeroClipboard(element);\n    }-*/;\n\n    @Override\n    public void setRepositoryName(final String repositoryName) {\n        repoName.setText(repositoryName);\n    }\n\n    @Override\n    public void setRepositoryDescription(final String description) {\n        repoDesc.setText(description);\n    }\n\n    @Override\n    public void showAvailableProtocols() {\n        linksPanel.setText(CoreConstants.INSTANCE.AvailableProtocols());\n    }\n\n    @Override\n    public void setDaemonURI(final String uri) {\n        gitDaemonURI.setText(uri);\n    }\n\n    @Override\n    public void addProtocol(final String protocol) {\n        linksPanel.add(new ProtocolButton(protocol,\n                                          new ClickHandler() {\n                                              @Override\n                                              public void onClick(ClickEvent event) {\n                                                  presenter.onAnchorSelected(protocol);\n                                              }\n                                          },\n                                          linksPanel.getWidgetCount() != 0));\n    }\n\n    @Override\n    public void setPresenter(final RepositoryItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setUriId(final String uriId) {\n        gitDaemonURI.getElement().setId(uriId);\n\n        myGitCopyButton.init(true,\n                             uriId,\n                             gitDaemonURI.getText());\n    }\n\n    @Override\n    public void clearBranches() {\n        branchesDropdown.clear();\n    }\n\n    @Override\n    public void addBranch(final String branch) {\n        final Option option = new Option();\n        option.setText(branch);\n        option.setValue(branch);\n        branchesDropdown.add(option);\n    }\n\n    @Override\n    public void setSelectedBranch(final String currentBranch) {\n        branchesDropdown.setValue(currentBranch);\n        branchesDropdown.refresh();\n    }\n\n    @Override\n    public String getSelectedBranch() {\n        return branchesDropdown.getValue();\n    }\n\n    @Override\n    public void refresh() {\n        branchesDropdown.refresh();\n    }\n\n    @UiHandler(\"btnChangeBranch\")\n    public void onUpdateRepository(final ClickEvent event) {\n        presenter.onUpdateRepository(branchesDropdown.getValue());\n    }\n\n    interface RepositoriesViewItemBinder\n            extends\n            UiBinder<Widget, RepositoryItemViewImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/editors/repository/list/RepositoryItemViewImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2013 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:html=\"urn:import:org.gwtbootstrap3.client.ui.html\"\n             xmlns:select=\"urn:import:org.gwtbootstrap3.extras.select.client.ui\"\n             xmlns:common=\"urn:import:org.guvnor.structure.client.editors.repository.common\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n\n  <ui:style>\n    .panel-body {\n      padding: 15px !important;\n    }\n\n    .row-spacing {\n      padding-top: 15px;\n    }\n\n    .btn-spacing {\n      margin-left: 5px;\n    }\n  </ui:style>\n\n  <b:Panel>\n    <b:PanelHeader>\n      <b:Heading size=\"H4\" ui:field=\"repoName\">\n        <b:Icon type=\"BOOK\" size=\"LARGE\" pull=\"LEFT\"/>\n      </b:Heading>\n    </b:PanelHeader>\n    <b:PanelBody addStyleNames=\"{style.panel-body}\">\n      <html:Div addStyleNames=\"row\">\n        <g:FlowPanel addStyleNames=\"col-md-12\">\n          <html:Paragraph ui:field=\"repoDesc\"/>\n          <html:Hr/>\n        </g:FlowPanel>\n      </html:Div>\n      <html:Div addStyleNames=\"row\">\n        <g:FlowPanel addStyleNames=\"col-md-6\">\n          <b:InputGroup>\n            <b:TextBox ui:field=\"gitDaemonURI\" enabled=\"false\"/>\n            <common:CopyRepositoryUrlBtn ui:field=\"myGitCopyButton\" icon=\"COPY\"/>\n          </b:InputGroup>\n        </g:FlowPanel>\n        <html:Paragraph ui:field=\"linksPanel\" addStyleNames=\"col-md-6\"/>\n      </html:Div>\n      <html:Div addStyleNames=\"row {style.row-spacing}\">\n        <html:Div addStyleNames=\"col-md-6\">\n          <select:Select b:id=\"branches\" ui:field=\"branchesDropdown\"/>\n        </html:Div>\n        <html:Div addStyleNames=\"col-md-6\">\n          <b:Button ui:field=\"btnChangeBranch\" icon=\"REFRESH\" type=\"PRIMARY\" text=\"{i18n.Update}\"/>\n        </html:Div>\n      </html:Div>\n    </b:PanelBody>\n  </b:Panel>\n\n</ui:UiBinder>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/navigator/CommitNavigatorEntry.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * \n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.navigator;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.i18n.client.DateTimeFormat;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.InlineLabel;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.uberfire.ext.widgets.common.client.common.popups.YesNoCancelPopup;\nimport org.uberfire.ext.widgets.common.client.resources.i18n.CommonConstants;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class CommitNavigatorEntry extends Composite {\n\n    interface CommitNavigatorEntryViewBinder\n            extends\n            UiBinder<Widget, CommitNavigatorEntry> {\n\n    }\n\n    private static final DateTimeFormat fmt = DateTimeFormat.getFormat(\"yyyy-MM-dd h:mm a\");\n\n    private static CommitNavigatorEntryViewBinder uiBinder = GWT.create(CommitNavigatorEntryViewBinder.class);\n\n    @UiField\n    Label message;\n\n    @UiField\n    InlineLabel author;\n\n    @UiField\n    InlineLabel date;\n\n    @UiField\n    SimplePanel revertButtonContainer;\n\n    public CommitNavigatorEntry(final boolean readOnly,\n                                final VersionRecord versionRecord,\n                                final ParameterizedCommand<VersionRecord> onRevertCommand) {\n        initWidget(uiBinder.createAndBindUi(this));\n        initWidget(readOnly,\n                   versionRecord,\n                   onRevertCommand);\n    }\n\n    private void initWidget(final boolean readOnly,\n                            final VersionRecord versionRecord,\n                            final ParameterizedCommand<VersionRecord> onRevertCommand) {\n        message.setText(versionRecord.comment());\n        author.setText(versionRecord.author() + \" - \");\n        date.setText(fmt.format(versionRecord.date()));\n\n        if (onRevertCommand != null) {\n            revertButtonContainer.setWidget(new Button(CoreConstants.INSTANCE.RevertToThis()) {{\n                setEnabled(!readOnly);\n                setBlock(true);\n                setType(ButtonType.DANGER);\n                addClickHandler(new ClickHandler() {\n                    @Override\n                    public void onClick(final ClickEvent event) {\n                        final YesNoCancelPopup yesNoCancelPopup = YesNoCancelPopup.newYesNoCancelPopup(CommonConstants.INSTANCE.Warning(),\n                                                                                                       CoreConstants.INSTANCE.ConfirmStateRevert(),\n                                                                                                       new Command() {\n                                                                                                           @Override\n                                                                                                           public void execute() {\n                                                                                                               onRevertCommand.execute(versionRecord);\n                                                                                                           }\n                                                                                                       },\n                                                                                                       new Command() {\n                                                                                                           @Override\n                                                                                                           public void execute() {\n                                                                                                           }\n                                                                                                       },\n                                                                                                       null\n                        );\n                        yesNoCancelPopup.setClosable(false);\n                        yesNoCancelPopup.show();\n                    }\n                });\n            }});\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/navigator/CommitNavigatorEntry.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:html=\"urn:import:org.gwtbootstrap3.client.ui.html\">\n\n  <ui:with field=\"i18n\" type=\"org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants\"/>\n  <ui:with field=\"resources\" type=\"org.guvnor.structure.client.resources.NavigatorResources\"/>\n\n  <html:Div addStyleNames=\"{resources.css.navigatorMessage}\">\n    <html:Div addStyleNames=\"{resources.css.messageRightContainer}\">\n      <g:SimplePanel ui:field=\"revertButtonContainer\"/>\n    </html:Div>\n    <html:Div addStyleNames=\"{resources.css.messageLeftContainer}\">\n      <g:Label ui:field=\"message\" addStyleNames=\"{resources.css.message}\"/>\n      <html:Div addStyleNames=\"{resources.css.authorDateContainer}\">\n        <g:InlineLabel ui:field=\"author\" addStyleNames=\"{resources.css.author}\"/>\n        <g:InlineLabel ui:field=\"date\" addStyleNames=\"{resources.css.date}\"/>\n      </html:Div>\n    </html:Div>\n  </html:Div>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/repositories/git/FileSystemHookNotifier.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.repositories.git;\n\nimport org.guvnor.structure.repositories.impl.git.event.FileSystemHookNotificationEvent;\nimport org.guvnor.structure.repositories.impl.git.event.PostCommitNotificationEvent;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\n@ApplicationScoped\npublic class FileSystemHookNotifier {\n\n    private Event<NotificationEvent> notificationEvent;\n\n    @Inject\n    public FileSystemHookNotifier(Event<NotificationEvent> notificationEvent) {\n        this.notificationEvent = notificationEvent;\n    }\n\n    public void notify(@Observes PostCommitNotificationEvent event) {\n        notificationEvent.fire(new NotificationEvent(event.getText(), getNotificationType(event)));\n    }\n\n    private NotificationEvent.NotificationType getNotificationType(FileSystemHookNotificationEvent event) {\n        switch (event.getType()) {\n            case SUCCESS: return NotificationEvent.NotificationType.SUCCESS;\n            case WARNING: return NotificationEvent.NotificationType.WARNING;\n            default: return NotificationEvent.NotificationType.ERROR;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/resources/NavigatorResources.java",
    "content": "/*\n * Copyright 2011 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.CssResource;\n\n/**\n * Wizard resources\n */\npublic interface NavigatorResources\n        extends\n        ClientBundle {\n\n    NavigatorResources INSTANCE = GWT.create(NavigatorResources.class);\n\n    @Source(\"css/Navigator.css\")\n    NavigatorStyle css();\n\n    interface NavigatorStyle extends CssResource {\n\n        String navigator();\n\n        String message();\n\n        @ClassName(\"message-left\")\n        String messageLeftContainer();\n\n        @ClassName(\"message-right\")\n        String messageRightContainer();\n\n        @ClassName(\"author-date-container\")\n        String authorDateContainer();\n\n        String author();\n\n        String date();\n\n        @ClassName(\"navigator-message\")\n        String navigatorMessage();\n\n        @ClassName(\"tree-nav\")\n        String treeNav();\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/resources/i18n/CommonConstants.java",
    "content": "/*\n * Copyright 2014 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface CommonConstants\n        extends\n        Messages {\n\n    CommonConstants INSTANCE = GWT.create(CommonConstants.class);\n\n    String IndexClonedRepositoryWarning();\n\n    String copyRepositoryUrl();\n\n    String ManagedRepository();\n\n    String RepoCloneFail();\n\n    String RepositoriesNode();\n\n    String RepositoriesHelp();\n\n    String RepositoryResource();\n\n    String RepositoryActionRead();\n\n    String RepositoryActionUpdate();\n\n    String RepositoryActionDelete();\n\n    String RepositoryActionCreate();\n\n    String SpacesNode();\n\n    String SpacesHelp();\n\n    String SpaceResource();\n\n    String SpaceActionRead();\n\n    String SpaceActionUpdate();\n\n    String SpaceActionDelete();\n\n    String SpaceActionCreate();\n\n    String Loading();\n\n    String Repositories();\n\n    String GitUriCopied(final String uri);\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/security/OrganizationalUnitController.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.security;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.security.OrganizationalUnitAction;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.Contributor;\nimport org.uberfire.security.ContributorType;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport java.util.Collection;\nimport java.util.Optional;\n\n@ApplicationScoped\npublic class OrganizationalUnitController {\n\n    public static final String ORG_UNIT_TYPE = \"orgunit\";\n    public static final String ORG_UNIT_CREATE = \"create\";\n    public static final String ORG_UNIT_READ = \"read\";\n    public static final String ORG_UNIT_UPDATE = \"update\";\n    public static final String ORG_UNIT_DELETE = \"delete\";\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n\n    @Inject\n    public OrganizationalUnitController(AuthorizationManager authorizationManager,\n                                        User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    public boolean canCreateOrgUnits() {\n        return authorizationManager.authorize(OrganizationalUnit.RESOURCE_TYPE,\n                                              OrganizationalUnitAction.CREATE,\n                                              user);\n    }\n\n    public boolean canReadOrgUnits() {\n        return authorizationManager.authorize(OrganizationalUnit.RESOURCE_TYPE,\n                                              OrganizationalUnitAction.READ,\n                                              user);\n    }\n\n    public boolean canReadOrgUnit(final OrganizationalUnit organizationalUnit) {\n        final boolean securityPermission = authorizationManager.authorize(organizationalUnit,\n                                              OrganizationalUnitAction.READ,\n                                              user);\n        return securityPermission\n                || userIsAtLeast(ContributorType.CONTRIBUTOR, organizationalUnit.getContributors());\n    }\n\n    public boolean canUpdateOrgUnit(OrganizationalUnit organizationalUnit) {\n        final boolean securityPermission = authorizationManager.authorize(organizationalUnit,\n                                              OrganizationalUnitAction.UPDATE,\n                                              user);\n        return securityPermission\n                || userIsAtLeast(ContributorType.ADMIN, organizationalUnit.getContributors());\n    }\n\n    public boolean canDeleteOrgUnit(OrganizationalUnit organizationalUnit) {\n        final boolean securityPermission = authorizationManager.authorize(organizationalUnit,\n                                              OrganizationalUnitAction.DELETE,\n                                              user);\n\n        return securityPermission\n                || userIsAtLeast(ContributorType.OWNER, organizationalUnit.getContributors());\n    }\n\n    boolean userIsAtLeast(final ContributorType type,\n                          final Collection<Contributor> contributors) {\n        return contributors.stream().anyMatch(c -> c.getUsername().equals(user.getIdentifier())\n                && ContributorType.PRIORITY_ORDER.indexOf(c.getType()) <= ContributorType.PRIORITY_ORDER.indexOf(type));\n    }\n\n    Optional<Contributor> getUserContributor(final Collection<Contributor> contributors) {\n        return contributors.stream().filter(c -> c.getUsername().equals(user.getIdentifier())).findFirst();\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/security/OrganizationalUnitTreeProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.security;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitSearchService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\n\nimport static org.guvnor.structure.security.OrganizationalUnitAction.CREATE;\nimport static org.guvnor.structure.security.OrganizationalUnitAction.DELETE;\nimport static org.guvnor.structure.security.OrganizationalUnitAction.READ;\nimport static org.guvnor.structure.security.OrganizationalUnitAction.UPDATE;\n\n/**\n * The {@link PermissionTreeProvider} plugin that brings {@link OrganizationalUnit} permissions into the ACL editor\n */\n@ApplicationScoped\npublic class OrganizationalUnitTreeProvider implements PermissionTreeProvider {\n\n    private CommonConstants i18n = CommonConstants.INSTANCE;\n    private PermissionManager permissionManager;\n    private int rootNodePosition = 0;\n    private Caller<OrganizationalUnitSearchService> searchService;\n\n    public OrganizationalUnitTreeProvider() {\n    }\n\n    @Inject\n    public OrganizationalUnitTreeProvider(PermissionManager permissionManager,\n                                          Caller<OrganizationalUnitSearchService> searchService) {\n        this.permissionManager = permissionManager;\n        this.searchService = searchService;\n    }\n\n    public int getRootNodePosition() {\n        return rootNodePosition;\n    }\n\n    public void setRootNodePosition(int rootNodePosition) {\n        this.rootNodePosition = rootNodePosition;\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        PermissionResourceNode rootNode = new PermissionResourceNode(i18n.SpaceResource(),\n                                                                     this);\n        rootNode.setNodeName(i18n.SpacesNode());\n        rootNode.setNodeFullName(i18n.SpacesHelp());\n        rootNode.setPositionInTree(rootNodePosition);\n\n        Permission readPermission = newPermission(READ);\n        Permission updatePermission = newPermission(UPDATE);\n        Permission deletePermission = newPermission(DELETE);\n        Permission createPermission = newPermission(CREATE);\n\n        rootNode.addPermission(readPermission,\n                               i18n.SpaceActionRead());\n        rootNode.addPermission(updatePermission,\n                               i18n.SpaceActionUpdate());\n        rootNode.addPermission(deletePermission,\n                               i18n.SpaceActionDelete());\n        rootNode.addPermission(createPermission,\n                               i18n.SpaceActionCreate());\n\n        rootNode.addDependencies(readPermission,\n                                 updatePermission,\n                                 deletePermission);\n        return rootNode;\n    }\n\n    private Permission newPermission(ResourceAction action) {\n        return permissionManager.createPermission(OrganizationalUnit.RESOURCE_TYPE,\n                                                  action,\n                                                  true);\n    }\n\n    private Permission newPermission(Resource resource,\n                                     ResourceAction action) {\n        return permissionManager.createPermission(resource,\n                                                  action,\n                                                  true);\n    }\n\n    @Override\n    public void loadChildren(PermissionNode parent,\n                             LoadOptions options,\n                             LoadCallback callback) {\n        Collection<String> resourceIds = options.getResourceIds();\n        int maxNodes = options.getMaxNodes();\n\n        if (searchService != null) {\n            if (resourceIds != null) {\n                searchService.call((Collection<OrganizationalUnit> orgUnits) -> {\n                    List<PermissionNode> children = buildPermissionNodes(orgUnits);\n                    callback.afterLoad(children);\n                }).searchById(resourceIds);\n            } else {\n                String namePattern = options.getNodeNamePattern();\n                searchService.call((Collection<OrganizationalUnit> orgUnits) -> {\n                    List<PermissionNode> children = buildPermissionNodes(orgUnits);\n                    callback.afterLoad(children);\n                }).searchByName(namePattern,\n                                maxNodes,\n                                false);\n            }\n        } else {\n            callback.afterLoad(Collections.emptyList());\n        }\n    }\n\n    private List<PermissionNode> buildPermissionNodes(Collection<OrganizationalUnit> orgUnits) {\n        List<PermissionNode> nodes = new ArrayList<>();\n        for (OrganizationalUnit ou : orgUnits) {\n            nodes.add(toPermissionNode(ou));\n        }\n        return nodes;\n    }\n\n    private PermissionNode toPermissionNode(OrganizationalUnit ou) {\n        PermissionLeafNode node = new PermissionLeafNode();\n        node.setNodeName(ou.getName());\n\n        Permission readPermission = newPermission(ou,\n                                                  READ);\n        Permission updatePermission = newPermission(ou,\n                                                    UPDATE);\n        Permission deletePermission = newPermission(ou,\n                                                    DELETE);\n\n        node.addPermission(readPermission,\n                           i18n.SpaceActionRead());\n        node.addPermission(updatePermission,\n                           i18n.SpaceActionUpdate());\n        node.addPermission(deletePermission,\n                           i18n.SpaceActionDelete());\n\n        node.addDependencies(readPermission,\n                             updatePermission,\n                             deletePermission);\n        return node;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/security/RepositoryController.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.security;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.security.RepositoryAction;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n@ApplicationScoped\npublic class RepositoryController {\n\n    public static final String REPOSITORY_TYPE = \"repository\";\n    public static final String REPOSITORY_CREATE = \"create\";\n    public static final String REPOSITORY_READ = \"read\";\n    public static final String REPOSITORY_UPDATE = \"update\";\n    public static final String REPOSITORY_DELETE = \"delete\";\n\n    private AuthorizationManager authorizationManager;\n    private User user;\n\n    @Inject\n    public RepositoryController(AuthorizationManager authorizationManager,\n                                User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    public boolean canCreateRepositories() {\n        return authorizationManager.authorize(Repository.RESOURCE_TYPE,\n                                              RepositoryAction.CREATE,\n                                              user);\n    }\n\n    public boolean canReadRepositories() {\n        return authorizationManager.authorize(Repository.RESOURCE_TYPE,\n                                              RepositoryAction.READ,\n                                              user);\n    }\n\n    public boolean canReadRepository(Repository repository) {\n        return authorizationManager.authorize(repository,\n                                              RepositoryAction.READ,\n                                              user);\n    }\n\n    public boolean canUpdateRepository(String repoId) {\n        return authorizationManager.authorize(new ResourceRef(repoId,\n                                                              Repository.RESOURCE_TYPE),\n                                              RepositoryAction.UPDATE,\n                                              user);\n    }\n\n    public boolean canUpdateRepository(Repository repository) {\n        return authorizationManager.authorize(repository,\n                                              RepositoryAction.UPDATE,\n                                              user);\n    }\n\n    public boolean canDeleteRepository(Repository repository) {\n        return authorizationManager.authorize(repository,\n                                              RepositoryAction.DELETE,\n                                              user);\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/java/org/guvnor/structure/client/security/RepositoryTreeProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.security;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.client.resources.ProjectResources;\nimport org.guvnor.common.services.project.client.resources.i18n.ProjectConstants;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositorySearchService;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\n\nimport static org.guvnor.structure.security.RepositoryAction.BUILD;\nimport static org.guvnor.structure.security.RepositoryAction.CREATE;\nimport static org.guvnor.structure.security.RepositoryAction.DELETE;\nimport static org.guvnor.structure.security.RepositoryAction.READ;\nimport static org.guvnor.structure.security.RepositoryAction.UPDATE;\n\n/**\n * The {@link PermissionTreeProvider} plugin that brings {@link Repository} permissions into the ACL editor\n */\n@ApplicationScoped\npublic class RepositoryTreeProvider implements PermissionTreeProvider {\n\n    private PermissionManager permissionManager;\n    private Caller<RepositorySearchService> searchService;\n    private int rootNodePosition = 0;\n    private ProjectConstants i18n = ProjectResources.CONSTANTS;\n\n    public RepositoryTreeProvider() {\n    }\n\n    @Inject\n    public RepositoryTreeProvider(PermissionManager permissionManager,\n                                  Caller<RepositorySearchService> searchService) {\n        this.permissionManager = permissionManager;\n        this.searchService = searchService;\n    }\n\n    public int getRootNodePosition() {\n        return rootNodePosition;\n    }\n\n    public void setRootNodePosition(int rootNodePosition) {\n        this.rootNodePosition = rootNodePosition;\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        PermissionResourceNode rootNode = new PermissionResourceNode(i18n.ProjectResource(),\n                                                                     this);\n        rootNode.setNodeName(i18n.ProjectsNode());\n        rootNode.setNodeFullName(i18n.ProjectsHelp());\n        rootNode.setPositionInTree(rootNodePosition);\n\n        Permission readPermission = newPermission(READ);\n        Permission updatePermission = newPermission(UPDATE);\n        Permission deletePermission = newPermission(DELETE);\n        Permission createPermission = newPermission(CREATE);\n        Permission buildPermission = newPermission(BUILD);\n\n        rootNode.addPermission(readPermission,\n                               i18n.ProjectActionRead());\n        rootNode.addPermission(updatePermission,\n                               i18n.ProjectActionUpdate());\n        rootNode.addPermission(deletePermission,\n                               i18n.ProjectActionDelete());\n        rootNode.addPermission(createPermission,\n                               i18n.ProjectActionCreate());\n        rootNode.addPermission(buildPermission,\n                               i18n.ProjectActionBuild());\n\n        rootNode.addDependencies(readPermission,\n                                 updatePermission,\n                                 deletePermission,\n                                 buildPermission);\n        return rootNode;\n    }\n\n    private Permission newPermission(ResourceAction action) {\n        return permissionManager.createPermission(Repository.RESOURCE_TYPE,\n                                                  action,\n                                                  true);\n    }\n\n    private Permission newPermission(Resource resource,\n                                     ResourceAction action) {\n        return permissionManager.createPermission(resource,\n                                                  action,\n                                                  true);\n    }\n\n    @Override\n    public void loadChildren(PermissionNode parent,\n                             LoadOptions options,\n                             LoadCallback callback) {\n        Collection<String> resourceIds = options.getResourceIds();\n        int maxNodes = options.getMaxNodes();\n\n        if (searchService != null) {\n            if (resourceIds != null) {\n                searchService.call((Collection<Repository> repositories) -> {\n                    List<PermissionNode> children = buildPermissionNodes(repositories);\n                    callback.afterLoad(children);\n                }).searchById(resourceIds);\n            } else {\n                String pattern = options.getNodeNamePattern();\n                searchService.call((Collection<Repository> repositories) -> {\n                    List<PermissionNode> children = buildPermissionNodes(repositories);\n                    callback.afterLoad(children);\n                }).searchByAlias(pattern,\n                                 maxNodes,\n                                 false);\n            }\n        } else {\n            callback.afterLoad(Collections.emptyList());\n        }\n    }\n\n    private List<PermissionNode> buildPermissionNodes(Collection<Repository> repositories) {\n        List<PermissionNode> nodes = new ArrayList<>();\n        for (Repository p : repositories) {\n            nodes.add(toPermissionNode(p));\n        }\n        return nodes;\n    }\n\n    private PermissionNode toPermissionNode(Repository r) {\n        PermissionLeafNode node = new PermissionLeafNode();\n        node.setNodeName(r.getAlias());\n\n        Permission readPermission = newPermission(r,\n                                                  READ);\n        Permission updatePermission = newPermission(r,\n                                                    UPDATE);\n        Permission deletePermission = newPermission(r,\n                                                    DELETE);\n        Permission buildPermission = newPermission(r,\n                                                   BUILD);\n\n        node.addPermission(readPermission,\n                           i18n.ProjectActionRead());\n        node.addPermission(updatePermission,\n                           i18n.ProjectActionUpdate());\n        node.addPermission(deletePermission,\n                           i18n.ProjectActionDelete());\n        node.addPermission(buildPermission,\n                           i18n.ProjectActionBuild());\n\n        node.addDependencies(readPermission,\n                             updatePermission,\n                             deletePermission,\n                             buildPermission);\n        return node;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.guvnor.structure.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/GuvnorStructureClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <!-- Inherit the core Web Toolkit stuff. -->\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n\n  <inherits name='org.jboss.errai.bus.ErraiBus'/>\n\n  <inherits name='org.gwtbootstrap3.GwtBootstrap3NoTheme'/>\n  <inherits name=\"org.gwtbootstrap3.extras.select.SelectNoResources\"/>\n\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.ext.widgets.common.UberfireWidgetsCommons\"/>\n\n  <inherits name=\"org.guvnor.structure.GuvnorStructureAPI\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/css/Navigator.css",
    "content": ".navigator {\n    width: 100%;\n    margin: 0;\n    margin-bottom: 15px;\n    border-left: none;\n    border-right: none;\n}\n\n.navigator td {\n    color: #484848;\n    border-bottom: 1px solid #eee;\n    padding: 7px 3px;\n    vertical-align: middle;\n    white-space: nowrap;\n}\n\n.navigator td:first-child {\n    border-left: 0;\n}\n\n.navigator-message {\n    color: #484848;\n    border-bottom: 1px solid #eee;\n    padding: 7px 3px;\n    vertical-align: middle;\n    white-space: nowrap;\n}\n\n.message {\n    color: rgb(51, 51, 51);\n    font-family: Helvetica, arial, freesans, clean, sans-serif;\n    font-size: 14px;\n    font-weight: bold;\n    height: auto;\n    line-height: 19px;\n    text-overflow: ellipsis;\n    overflow: hidden;\n}\n\n.message-left {\n    float: none;\n    width: auto;\n}\n\n.message-right {\n    float: right;\n}\n\n.author-date-container {\n    text-overflow: ellipsis;\n    overflow: hidden;\n}\n\n.date {\n    color: rgb(136, 136, 136);\n}\n\n.author {\n    color: rgb(68, 68, 68);\n}\n\n.tree-nav {\n    padding: 10px 15px 15px 15px;\n    border: 1px solid #eee;\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants.properties",
    "content": "IndexClonedRepositoryWarning=The Repository will be indexed. Some workbench features may be unavailable until indexing has completed.\ncopyRepositoryUrl=Copy Repository URL\nManagedRepository=Is managed repository\nRepoCloneFail=Can''t clone repository. Check if the repository URL and credentials are correct. More details:\nRepositoriesNode=Repositories\nRepositoriesHelp=Sets who can Create, Update or Delete repositories from the Repositories section at the Administration perspective. Set also what repositories are visible in the Project Explorer at the Project Authoring perspective.\nRepositoryResource=Repository\nRepositoryActionRead=Read\nRepositoryActionUpdate=Update\nRepositoryActionDelete=Delete\nRepositoryActionCreate=Create\nSpacesNode=Spaces\nSpacesHelp=Sets who can Create, Update or Delete spaces from the Spaces section at the Administration perspective. Set also what spaces are visible in the Project Explorer at the Project Authoring perspective.\nSpaceResource=Space\nSpaceActionRead=Read\nSpaceActionUpdate=Update\nSpaceActionDelete=Delete\nSpaceActionCreate=Create\nLoading=Loading\nRepositories=Repositories\nGitUriCopied=Uri {0} has been successfully copied to the clipboard."
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_de.properties",
    "content": "IndexClonedRepositoryWarning=Das Repository wird indexiert. Einige Workbench-Features sind möglicherweise nicht verfügbar, bis die Indexierung abgeschlossen ist.\ncopyRepositoryUrl=Repository URL kopieren\nManagedRepository=Ist ein verwaltetes Repository\nLoading=Wird geladen\nRepositories=Repositorys\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_es.properties",
    "content": "IndexClonedRepositoryWarning=El repositorio se indexará. Algunas de las funcionalidades de la mesa de trabajo podrían no estar disponibles hasta que se haya completado la indexación.\ncopyRepositoryUrl=Copiar URL del repositorio\nManagedRepository=Es un repositorio administrado\nRepoCloneFail=No se puede clonar el depósito. Comprobar si la URL del repositorio y las credenciales son correctas. Más detalles:\nRepositoriesNode=Repositorios\nRepositoriesHelp=Establece quién puede Crear, Actualizar o Eliminar repositorios desde la sección Repositorios de la perspectiva de administración. También establece qué repositorios están visibles en el explorador del proyecto en la perspectiva de la autoría del proyecto.\nRepositoryResource=Repositorio\nRepositoryActionRead=Leer\nRepositoryActionUpdate=Actualizar\nRepositoryActionDelete=Eliminar\nRepositoryActionCreate=Crear\nSpacesNode=Espacios\nSpacesHelp=Establece quién puede Crear, Actualizar o Eliminar espacios desde la sección Espacios de la perspectiva de administración. También establece qué espacios están visibles en el explorador del proyecto en la perspectiva de la autoría del proyecto.\nSpaceResource=Espacio\nSpaceActionRead=Leer\nSpaceActionUpdate=Actualizar\nSpaceActionDelete=Eliminar\nSpaceActionCreate=Crear\nLoading=Cargando\nRepositories=Repositorios\nGitUriCopied=El Uri {0} se copió correctamente al portapapeles."
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_fr.properties",
    "content": "IndexClonedRepositoryWarning=Le référentiel sera indexé. Il se peut que certaines fonctionnalités du tableau de référence soient indisponibles tant que l''indexation n''est pas terminée.\ncopyRepositoryUrl=Copier l''URL du référentiel\nManagedRepository=Est un référentiel géré\nRepoCloneFail=Impossible de cloner le référentiel. Vérifiez si l''URL du référentiel et les informations d''identification sont correctes. Plus de détails :\nRepositoriesNode=Référentiels\nRepositoriesHelp=Définit qui peut créer, mettre à jour ou supprimer des référentiels dans la section Référentiels de la perspective Administration. Définissez également les référentiels qui sont visibles dans l''explorateur de projets au niveau de la perspective Création de projets.\nRepositoryResource=Référentiel\nRepositoryActionRead=Lire\nRepositoryActionUpdate=Mettre à jour\nRepositoryActionDelete=Supprimer\nRepositoryActionCreate=Créer\nSpacesNode=Espaces\nSpacesHelp=Définit qui peut créer, mettre à jour ou supprimer des espaces dans la section Espaces de la perspective Administration. Définissez également les espaces qui sont visibles dans l''explorateur de projets au niveau de la perspective Création de projets.\nSpaceResource=Espace\nSpaceActionRead=Lire\nSpaceActionUpdate=Mettre à jour\nSpaceActionDelete=Supprimer\nSpaceActionCreate=Créer\nLoading=Chargement\nRepositories=Référentiels\nGitUriCopied=L''URI {0} a été copié dans le presse-papiers."
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_it.properties",
    "content": "IndexClonedRepositoryWarning=Il repository verrà indicizzato. Alcune funzionalità del workbench potrebbero non essere disponibili fino al completamento dell''indicizzazione.\ncopyRepositoryUrl=Copia URL del repository\nManagedRepository=Repository gestito\nRepoCloneFail=Impossibile clonare il repository. Verifica che l''URL del repository e le credenziali siano corrette. Ulteriori dettagli:\nRepositoriesNode=Repository\nRepositoriesHelp=Imposta chi può creare, aggiornare o eliminare repository dalla sezione Repository nella prospettiva Amministrazione. Imposta anche quali repository sono visibili nell''Esplora progetti nella prospettiva Creazione progetto.\nRepositoryResource=Risorsa repository\nRepositoryActionRead=Lettura\nRepositoryActionUpdate=Aggiornamento\nRepositoryActionDelete=Eliminazione\nRepositoryActionCreate=Creazione\nSpacesNode=Spazi\nSpacesHelp=Imposta chi può creare, aggiornare o eliminare spazi dalla sezione Spazi nella prospettiva Amministrazione. Imposta anche quali spazi sono visibili nell''Esplora progetti nella prospettiva Creazione progetto.\nSpaceResource=Risorsa spazio\nSpaceActionRead=Lettura\nSpaceActionUpdate=Aggiornamento\nSpaceActionDelete=Eliminazione\nSpaceActionCreate=Creazione\nLoading=Caricamento\nRepositories=Repository\nGitUriCopied=L''URI {0} è stato copiato correttamente negli appunti.\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_ja.properties",
    "content": "IndexClonedRepositoryWarning=リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。リポジトリーがインデックス化されます。ワークベンチ機能の一部はインデックス化が完了するまで使用できません。\ncopyRepositoryUrl=リポジトリー URL のコピー\nManagedRepository=管理リポジトリー\nRepoCloneFail=リポジトリをクローンできません。リポジトリーの URL および認証情報が正しいかどうかを確認します。詳細:\nRepositoriesNode=リポジトリー\nRepositoriesHelp=管理者パースペクティブのリポジトリーセクションから、リポジトリーの作成、更新または削除ができるユーザーを設定します。プロジェクトオーサリングパースペクティブのプロジェクトエクスプローラーで表示可能なリポジトリーも設定します。\nRepositoryResource=リポジトリー\nRepositoryActionRead=読み込み\nRepositoryActionUpdate=更新\nRepositoryActionDelete=削除\nRepositoryActionCreate=作成\nSpacesNode=スペース\nSpacesHelp=管理者パースペクティブのスペースーセクションから、スペースの作成、更新または削除ができるユーザーを設定します。プロジェクトオーサリングパースペクティブのプロジェクトエクスプローラーで表示可能なスペースも設定します。\nSpaceResource=スペース\nSpaceActionRead=読み込み\nSpaceActionUpdate=更新\nSpaceActionDelete=削除\nSpaceActionCreate=作成\nLoading=ロード中\nRepositories=リポジトリー\nGitUriCopied=URI {0} をクリップボードにコピーしました。"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_pt_BR.properties",
    "content": "IndexClonedRepositoryWarning=O Repositório será indexado. Alguns recursos de bancada podem estar indisponíveis até que a indexação seja concluída.\ncopyRepositoryUrl=Copiar o URL do Repositório. \nManagedRepository=É repositório gerenciado\nLoading=Carregando\nRepositories=Repositórios\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/client/resources/i18n/CommonConstants_zh_CN.properties",
    "content": "IndexClonedRepositoryWarning=资料库将编制索引。在索引完成至前，某些工作区的功能可能不可用。\ncopyRepositoryUrl=复制存储库 URL\nManagedRepository=是托管的存储库\nLoading=正在加载\nRepositories=资料库\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/main/resources/org/guvnor/structure/public/zeroclipboard/ZeroClipboardLoader.js",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nZeroClipboard.config( {\n    trustedDomains: ['*'],\n    allowScriptAccess: \"always\"});\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/TestUtil.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.Repository;\nimport org.uberfire.backend.vfs.Path;\n\nimport static org.mockito.Mockito.*;\n\npublic class TestUtil {\n\n    public static Repository makeRepository(final String alias,\n                                            final String... branches) {\n        final Repository repository = mock(Repository.class);\n\n        when(repository.getAlias()).thenReturn(alias);\n\n        final List<Branch> branchList = new ArrayList<>();\n        for (final String branchName : branches) {\n            branchList.add(new Branch(branchName,\n                                      mock(Path.class)));\n        }\n\n        when(repository.getBranches()).thenReturn(branchList);\n\n        when(repository.getDefaultBranch()).thenReturn(Optional.of(new Branch(\"main\",\n                                                                              mock(Path.class))));\n\n        return repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/context/GuvnorStructureContextHandlersTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.context;\n\nimport java.util.HashMap;\n\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewRepositoryEvent;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mocks.CallerMock;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GuvnorStructureContextHandlersTest {\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private WorkspaceProjectContext projContext;\n\n    private GuvnorStructureContext context;\n\n    @Before\n    public void setUp() throws Exception {\n        context = new GuvnorStructureContext(new CallerMock<>(repositoryService), projContext);\n    }\n\n    @Test\n    public void testHandler() throws Exception {\n        final GuvnorStructureContextChangeHandler handler1 = mock(GuvnorStructureContextChangeHandler.class);\n        final GuvnorStructureContextChangeHandler handler2 = mock(GuvnorStructureContextChangeHandler.class);\n\n        final GuvnorStructureContextChangeHandler.HandlerRegistration handlerRegistration1 = context.addGuvnorStructureContextChangeHandler(handler1);\n        final GuvnorStructureContextChangeHandler.HandlerRegistration handlerRegistration2 = context.addGuvnorStructureContextChangeHandler(handler2);\n\n        assertNotNull(handlerRegistration1);\n        assertNotNull(handlerRegistration2);\n\n        context.removeHandler(handlerRegistration2);\n\n        final GitRepository newRepository = new GitRepository();\n\n        context.onRepositoryRemoved(new RepositoryRemovedEvent(newRepository));\n\n        verify(handler1).onRepositoryDeleted(newRepository);\n        verify(handler2,\n               never()).onRepositoryDeleted(newRepository);\n    }\n\n    @Test\n    public void testNewRepository() throws Exception {\n        final GuvnorStructureContextChangeHandler handler = mock(GuvnorStructureContextChangeHandler.class);\n\n        context.addGuvnorStructureContextChangeHandler(handler);\n\n        final GitRepository newRepository = new GitRepository();\n        final HashMap<String, Branch> branches = new HashMap<>();\n        branches.put(\"main\",\n                     new Branch(\"main\",\n                                mock(Path.class)));\n        newRepository.setBranches(branches);\n\n        context.onNewRepository(new NewRepositoryEvent(newRepository));\n\n        verify(handler).onNewRepositoryAdded(newRepository);\n    }\n\n    @Test\n    public void testBranchChange() throws Exception {\n        final GuvnorStructureContextBranchChangeHandler handler = mock(GuvnorStructureContextBranchChangeHandler.class);\n\n        context.addGuvnorStructureContextBranchChangeHandler(handler);\n\n        context.changeBranch(\"your-repo\",\n                             \"hello\");\n\n        verify(handler).onBranchChange(\"your-repo\",\n                                       \"hello\");\n    }\n\n    @Test\n    public void testRemoveBranchChangeHandler() throws Exception {\n        final GuvnorStructureContextBranchChangeHandler handler1 = mock(GuvnorStructureContextBranchChangeHandler.class);\n        final GuvnorStructureContextBranchChangeHandler handler2 = mock(GuvnorStructureContextBranchChangeHandler.class);\n\n        final GuvnorStructureContextBranchChangeHandler.HandlerRegistration handlerRegistration1 = context.addGuvnorStructureContextBranchChangeHandler(handler1);\n        final GuvnorStructureContextBranchChangeHandler.HandlerRegistration handlerRegistration2 = context.addGuvnorStructureContextBranchChangeHandler(handler2);\n\n        assertNotNull(handlerRegistration1);\n        assertNotNull(handlerRegistration2);\n\n        context.removeHandler(handlerRegistration1);\n\n        context.changeBranch(\"my-repo\",\n                             \"main\");\n\n        verify(handler1,\n               never()).onBranchChange(\"my-repo\",\n                                       \"main\");\n        verify(handler2).onBranchChange(\"my-repo\",\n                                        \"main\");\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/context/GuvnorStructureContextTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.context;\n\nimport static org.guvnor.structure.client.editors.TestUtil.makeRepository;\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.anyCollection;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Optional;\n\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewRepositoryEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.callbacks.Callback;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.spaces.Space;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GuvnorStructureContextTest {\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private WorkspaceProjectContext projContext;\n\n    private GuvnorStructureContext context;\n    private ArrayList<Repository> repositories;\n    private Collection<Repository> result;\n    private Callback<Collection<Repository>> callback;\n\n    @Before\n    public void setUp() throws Exception {\n        callback = spy(new Callback<Collection<Repository>>() {\n            @Override\n            public void callback(final Collection<Repository> result) {\n                GuvnorStructureContextTest.this.result = result;\n            }\n        });\n\n        repositories = new ArrayList<>();\n\n        repositories.add(makeRepository(\"my-repo\",\n                                        \"main\",\n                                        \"dev\"));\n        repositories.add(makeRepository(\"your-repo\",\n                                        \"main\",\n                                        \"release\"));\n\n        OrganizationalUnit ou = mock(OrganizationalUnit.class);\n        when(ou.getName()).thenReturn(\"space\");\n        when(projContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(ou));\n\n        when(repositoryService.getRepositories(eq(new Space(\"space\")))).thenReturn(repositories);\n\n        context = new GuvnorStructureContext(new CallerMock<>(repositoryService), projContext);\n\n        getRepositories();\n    }\n\n    @Test\n    public void testLoad() throws Exception {\n        assertEquals(2,\n                     result.size());\n\n        Collection<String> repositoryAliases = getRepositoryAliases();\n\n        assertTrue(repositoryAliases.contains(\"my-repo\"));\n        assertTrue(repositoryAliases.contains(\"your-repo\"));\n    }\n\n    @Test\n    public void testReLoadRemembersBranches() throws Exception {\n\n        context.changeBranch(\"your-repo\",\n                             \"release\");\n\n        context.getRepositories(callback);\n\n        assertEquals(2,\n                     result.size());\n\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"my-repo\"));\n        assertEquals(\"release\",\n                     context.getCurrentBranch(\"your-repo\"));\n\n        verify(callback,\n               times(2)).callback(anyCollection());\n    }\n\n    @Test\n    public void testReLoadPicksUpNewRepositories() throws Exception {\n\n        repositories.add(makeRepository(\"my-new-repo\",\n                                        \"main\"));\n\n        context.getRepositories(callback);\n\n        assertEquals(3,\n                     result.size());\n\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"my-repo\"));\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"your-repo\"));\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"my-new-repo\"));\n\n        verify(callback,\n               times(2)).callback(anyCollection());\n    }\n\n    @Test\n    public void testReLoadPicksUpRemovedRepositories() throws Exception {\n\n        repositories.remove(1);\n\n        context.getRepositories(callback);\n\n        assertEquals(1,\n                     result.size());\n\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"my-repo\"));\n        assertNull(context.getCurrentBranch(\"your-repo\"));\n    }\n\n    @Test\n    public void testReLoadPicksUpRemovedBranch() throws Exception {\n\n        // This deletes main branch\n        final List<Branch> branchList = new ArrayList<>();\n        final Branch devBranch = new Branch(\"dev\",\n                                            mock(Path.class));\n        branchList.add(devBranch);\n        when(repositories.get(0).getBranches()).thenReturn(branchList);\n        when(repositories.get(0).getDefaultBranch()).thenReturn(Optional.of(devBranch));\n\n        context.getRepositories(callback);\n\n        assertEquals(\"dev\",\n                     context.getCurrentBranch(\"my-repo\"));\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"your-repo\"));\n    }\n\n    @Test\n    public void testNewRepository() throws Exception {\n        context.onNewRepository(new NewRepositoryEvent(makeRepository(\"new-repo\",\n                                                                      \"main\")));\n\n        assertEquals(\"main\",\n                     context.getCurrentBranch(\"new-repo\"));\n    }\n\n    @Test\n    public void testRemoveRepository() throws Exception {\n        context.onRepositoryRemoved(new RepositoryRemovedEvent(makeRepository(\"your-repo\")));\n\n        assertNull(context.getCurrentBranch(\"your-repo\"));\n    }\n\n    private Collection<String> getRepositoryAliases() {\n        Collection<String> repositoryAliases = new ArrayList<>();\n        for (Repository repository : result) {\n            repositoryAliases.add(repository.getAlias());\n        }\n        return repositoryAliases;\n    }\n\n    @Test\n    public void testLoadDefaultBranches() throws Exception {\n        for (Repository repository : result) {\n            assertEquals(\"main\",\n                         context.getCurrentBranch(repository.getAlias()));\n        }\n    }\n\n    @Test\n    public void testChangeBranch() throws Exception {\n\n        context.changeBranch(\"my-repo\",\n                             \"dev\");\n\n        for (final Repository repository : result) {\n            if (repository.getAlias().equals(\"my-repo\")) {\n                assertEquals(\"dev\",\n                             context.getCurrentBranch(repository.getAlias()));\n            } else {\n                assertEquals(\"main\",\n                             context.getCurrentBranch(repository.getAlias()));\n            }\n        }\n    }\n\n    private void getRepositories() {\n        context.getRepositories(callback);\n\n        verify(callback).callback(anyCollection());\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextBranchChangeHandler;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextChangeHandler;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.callbacks.Callback;\n\nimport static org.guvnor.structure.client.editors.TestUtil.makeRepository;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FileExplorerPresenterTest {\n\n    @Mock\n    private FileExplorerView view;\n\n    private GuvnorStructureContext context;\n\n    private FileExplorerPresenter presenter;\n    private Collection<Repository> repositories;\n    private Repository myRepo;\n    private String myRepoBranch = \"main\";\n    private Repository yourRepo;\n    private String yourRepoBranch = \"main\";\n\n    private GuvnorStructureContextChangeHandler.HandlerRegistration changeHandlerRegistration;\n    private GuvnorStructureContextBranchChangeHandler.HandlerRegistration branchChangeHandlerRegistration;\n\n    @Before\n    public void setUp() throws Exception {\n        repositories = new ArrayList<>();\n\n        myRepo = makeRepository(\"my-repo\",\n                                \"main\",\n                                \"dev\");\n        repositories.add(myRepo);\n        yourRepo = makeRepository(\"your-repo\",\n                                  \"main\",\n                                  \"release\");\n        repositories.add(yourRepo);\n\n        context = spy(new GuvnorStructureContext() {\n            @Override\n            public void getRepositories(final Callback<Collection<Repository>> callback) {\n                callback.callback(repositories);\n            }\n\n            @Override\n            public GuvnorStructureContextChangeHandler.HandlerRegistration addGuvnorStructureContextChangeHandler(final GuvnorStructureContextChangeHandler handler) {\n                return changeHandlerRegistration;\n            }\n\n            @Override\n            public GuvnorStructureContextBranchChangeHandler.HandlerRegistration addGuvnorStructureContextBranchChangeHandler(final GuvnorStructureContextBranchChangeHandler handler) {\n                return branchChangeHandlerRegistration;\n            }\n\n            @Override\n            public String getCurrentBranch(final String alias) {\n                if (alias.equals(\"my-repo\")) {\n                    return myRepoBranch;\n                } else if (alias.equals(\"your-repo\")) {\n                    return yourRepoBranch;\n                } else {\n                    return null;\n                }\n            }\n        });\n\n        presenter = new FileExplorerPresenter(view,\n                                              context);\n    }\n\n    @Test\n    public void testSetPresenter() throws Exception {\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void testAddHandlers() throws Exception {\n        verify(context).addGuvnorStructureContextChangeHandler(presenter);\n        verify(context).addGuvnorStructureContextBranchChangeHandler(presenter);\n    }\n\n    @Test\n    public void testRemoveHandlers() throws Exception {\n\n        verify(context,\n               never()).removeHandler(any(GuvnorStructureContextBranchChangeHandler.HandlerRegistration.class));\n        verify(context,\n               never()).removeHandler(any(GuvnorStructureContextChangeHandler.HandlerRegistration.class));\n\n        presenter.onShutdown();\n\n        verify(context).removeHandler(branchChangeHandlerRegistration);\n        verify(context).removeHandler(changeHandlerRegistration);\n    }\n\n    @Test\n    public void testOnStartUp() throws Exception {\n\n        // my repo is not in the default main branch\n        myRepoBranch = \"dev\";\n\n        presenter.reset();\n\n        verify(view,\n               times(2)).addNewRepository(any(Repository.class),\n                                          anyString());\n        verify(view).addNewRepository(myRepo,\n                                      \"dev\");\n        verify(view).addNewRepository(yourRepo,\n                                      \"main\");\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/fileexplorer/FileExplorerViewImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.fileexplorer;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.structure.client.resources.i18n.CommonConstants;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.ext.widgets.core.client.tree.FSTreeItem;\nimport org.uberfire.ext.widgets.core.client.tree.Tree;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FileExplorerViewImplTest {\n\n    @Mock\n    private FileExplorerPresenter presenter;\n\n    @Mock\n    private Tree<FSTreeItem> tree;\n\n    private FSTreeItem item;\n    private FileExplorerViewImpl view;\n\n    @Before\n    public void setUp() {\n        view = new FileExplorerViewImpl(tree);\n        doAnswer(invocationOnMock -> {\n            FSTreeItem item1 = (FSTreeItem) invocationOnMock.getArguments()[0];\n            return item1;\n        }).when(tree).addItem(any(FSTreeItem.class));\n        view.init(presenter);\n    }\n\n    @Test\n    public void checkItemsAreNotLazyLoaded() {\n        item = newTreeItem(new TreeItemData(FSTreeItem.FSType.ITEM,\n                                            \"file\",\n                                            mock(Path.class)));\n        assertFalse(view.needsLoading(item));\n    }\n\n    @Test\n    public void checkFoldersWithNoChildrenAreNotLazyLoaded() {\n        item = newTreeItem(new TreeItemData(FSTreeItem.FSType.FOLDER,\n                                            \"folder\",\n                                            mock(Path.class)));\n        assertFalse(view.needsLoading(item));\n    }\n\n    @Test\n    public void checkFoldersWithExistingChildrenAreNotLazyLoaded() {\n        item = newTreeItem(new TreeItemData(FSTreeItem.FSType.FOLDER,\n                                            \"folder\",\n                                            mock(Path.class)),\n                           new TreeItemData(FSTreeItem.FSType.ITEM,\n                                            \"file1\",\n                                            mock(Path.class)),\n                           new TreeItemData(FSTreeItem.FSType.ITEM,\n                                            \"file2\",\n                                            mock(Path.class)));\n        assertFalse(view.needsLoading(item));\n    }\n\n    @Test\n    public void checkFoldersWithLazyFlagAreLazyLoaded() {\n        item = spy(newTreeItem(new TreeItemData(FSTreeItem.FSType.FOLDER,\n                                                \"folder\",\n                                                mock(Path.class)),\n                               new TreeItemData(FSTreeItem.FSType.ITEM,\n                                                CommonConstants.INSTANCE.Loading(),\n                                                mock(Path.class))));\n        final FSTreeItem child = mock(FSTreeItem.class);\n        when(item.getChild(eq(0))).thenReturn(child);\n        when(child.getText()).thenReturn(CommonConstants.INSTANCE.Loading());\n        assertTrue(view.needsLoading(item));\n    }\n\n    private FSTreeItem newTreeItem(TreeItemData parent,\n                                   TreeItemData... children) {\n        final List<FSTreeItem> cti = new ArrayList<>();\n\n        final FSTreeItem item = new FSTreeItem(parent.type,\n                                               parent.value) {\n\n            @Override\n            public int getChildCount() {\n                return cti.size();\n            }\n\n            @Override\n            public FSTreeItem getChild(int i) {\n                return cti.get(i);\n            }\n\n            protected FSTreeItem makeChild(final FSType type,\n                                           final String value) {\n                return new FSTreeItem(type,\n                                      value) {\n                    @Override\n                    public String getText() {\n                        return value;\n                    }\n                };\n            }\n        };\n        item.setUserObject(parent.path);\n\n        Arrays.asList(children).stream().forEach((c) -> {\n            final FSTreeItem ti = item.addItem(c.type,\n                                               c.value);\n            ti.setUserObject(c.path);\n            cti.add(ti);\n        });\n\n        return item;\n    }\n\n    private class TreeItemData {\n\n        FSTreeItem.FSType type;\n        String value;\n        Path path;\n\n        TreeItemData(final FSTreeItem.FSType type,\n                     final String value,\n                     final Path path) {\n            this.type = type;\n            this.value = value;\n            this.path = path;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/clone/CloneMavenRepositoryPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.guvnor.structure.client.editors.repository.RepositoryPreferences;\nimport org.guvnor.structure.client.editors.repository.clone.answer.OuServiceAnswer;\nimport org.guvnor.structure.client.editors.repository.clone.answer.RsCreateRepositoryAnswer;\nimport org.guvnor.structure.client.editors.repository.clone.answer.RsCreateRepositoryFailAnswer;\nimport org.guvnor.structure.client.editors.repository.clone.answer.RsNormalizedNameAnswer;\nimport org.guvnor.structure.events.AfterCreateOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.guvnor.structure.organizationalunit.RemoveOrganizationalUnitEvent;\nimport org.guvnor.structure.organizationalunit.impl.OrganizationalUnitImpl;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryAlreadyExistsException;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.gwtbootstrap3.client.ui.constants.ValidationState;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.junit.Before;\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyBoolean;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CloneMavenRepositoryPresenterTest {\n\n    private static final String ORG_UNIT_ONE = \"OrganizationalUnitOne\";\n    private static final String ORG_UNIT_TWO = \"OrganizationalUnitTwo\";\n    private static final String REPO_NAME = \"GitRepositoryName\";\n    private static final String REPO_URL = \"/home/user/git/url\";\n    private static final String USERNAME = \"username\";\n    private static final String PASSWORD = \"password\";\n\n    @Mock\n    private Message message;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private RepositoryPreferences repositoryPreferences;\n\n    @Mock\n    private CloneRepositoryView view;\n\n    @Mock\n    private Caller<RepositoryService> repoServiceCaller;\n\n    @Mock\n    private Caller<RepositoryService> repoFailServiceCaller;\n\n    @Mock\n    private Caller<OrganizationalUnitService> ouServiceCaller;\n\n    @Mock\n    private OrganizationalUnitService ouService;\n\n    @Mock\n    private RepositoryService repoService;\n\n    @Mock\n    private OrganizationalUnit ouUnit1;\n\n    @Mock\n    private OrganizationalUnit ouUnit2;\n\n    @Mock\n    private Repository repository;\n\n    @Captor\n    private ArgumentCaptor<Boolean> boolArgument;\n\n    @Captor\n    private ArgumentCaptor<Throwable> throwableArgument;\n\n    @Captor\n    private ArgumentCaptor<RepositoryEnvironmentConfigurations> repositoryEnvironmentConfigurationsArgumentCaptor;\n\n    private CloneRepositoryPresenter presenter;\n\n    @Before\n    public void initPresenter() {\n\n        //mock user roles\n        Set<Role> userRoles = new HashSet<Role>();\n        userRoles.add(new RoleImpl(\"mock-role\"));\n\n        List<OrganizationalUnit> units = new ArrayList<OrganizationalUnit>();\n        units.add(ouUnit1);\n        units.add(ouUnit2);\n\n        when(ouUnit1.getName()).thenReturn(ORG_UNIT_ONE);\n        when(ouUnit2.getName()).thenReturn(ORG_UNIT_TWO);\n\n        when(view.isNameEmpty()).thenReturn(false);\n        when(view.getName()).thenReturn(REPO_NAME);\n        when(view.getSelectedOrganizationalUnit()).thenReturn(ORG_UNIT_ONE);\n        when(view.getUsername()).thenReturn(USERNAME);\n        when(view.getPassword()).thenReturn(PASSWORD);\n\n        when(ouServiceCaller.call(any(RemoteCallback.class),\n                                  any(ErrorCallback.class))).thenAnswer(new OuServiceAnswer(units,\n                                                                                            ouService));\n        when(repoServiceCaller.call(any(RemoteCallback.class))).thenAnswer(new RsNormalizedNameAnswer(REPO_NAME,\n                                                                                                      repoService));\n        when(repoServiceCaller.call(any(RemoteCallback.class),\n                                    any(ErrorCallback.class))).thenAnswer(new RsCreateRepositoryAnswer(repository,\n                                                                                                       repoService));\n        when(repoFailServiceCaller.call(any(RemoteCallback.class))).thenAnswer(new RsNormalizedNameAnswer(REPO_NAME,\n                                                                                                          repoService));\n\n        when(repositoryPreferences.isOUMandatory()).thenReturn(false);\n\n        presenter = new CloneRepositoryPresenter(repositoryPreferences,\n                                                 view,\n                                                 repoServiceCaller,\n                                                 ouServiceCaller,\n                                                 placeManager);\n        presenter.init();\n    }\n\n    /**\n     * BZ 1003005 - Clone repository dialogue stays operational.\n     * Test if clone repo form doesn't stay operational on valid data in form\n     */\n    @Test\n    public void testComponentsStaysOperational() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n\n        presenter.handleCloneClick();\n\n        componentsLocked();\n        verifyRepoCloned(true);\n    }\n\n    /**\n     * Tests if clone repo form is non locked after invalid data filled in form\n     */\n    @Test\n    public void testComponentsNonLockEmptyUrl() {\n        when(view.isGitUrlEmpty()).thenReturn(true);\n\n        presenter.handleCloneClick();\n\n        verify(view).showUrlHelpMandatoryMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testComponentsNonLockInvalidUrl() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(\"git repo\");\n\n        presenter.handleCloneClick();\n\n        verify(view).showUrlHelpInvalidFormatMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testComponentsNonLockOuMandatory() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n        when(view.getSelectedOrganizationalUnit()).thenReturn(\"non_existing\");\n        when(repositoryPreferences.isOUMandatory()).thenReturn(true);\n\n        presenter.handleCloneClick();\n\n        verify(view).showOrganizationalUnitHelpMandatoryMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testComponentsNonLockEmptyName() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n        when(view.isNameEmpty()).thenReturn(true);\n\n        presenter.handleCloneClick();\n\n        verify(view).showNameHelpMandatoryMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testAlreadyExistClone() {\n        when(repoFailServiceCaller.call(any(RemoteCallback.class),\n                                        any(ErrorCallback.class))).thenAnswer(\n                new RsCreateRepositoryFailAnswer(message,\n                                                 new RepositoryAlreadyExistsException(),\n                                                 repository,\n                                                 repoService));\n\n        presenter = new CloneRepositoryPresenter(repositoryPreferences,\n                                                 view,\n                                                 repoFailServiceCaller,\n                                                 ouServiceCaller,\n                                                 placeManager);\n        presenter.init();\n\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n\n        presenter.handleCloneClick();\n        verify(view).errorRepositoryAlreadyExist();\n\n        componentsLocked();\n        componentsUnlocked();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testFailClone() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n\n        RuntimeException exc = new RuntimeException();\n        when(repoFailServiceCaller.call(any(RemoteCallback.class),\n                                        any(ErrorCallback.class))).thenAnswer(\n                new RsCreateRepositoryFailAnswer(message,\n                                                 exc,\n                                                 repository,\n                                                 repoService));\n\n        presenter = new CloneRepositoryPresenter(repositoryPreferences,\n                                                 view,\n                                                 repoFailServiceCaller,\n                                                 ouServiceCaller,\n                                                 placeManager);\n        presenter.init();\n\n        presenter.handleCloneClick();\n        verify(view).errorCloneRepositoryFail(throwableArgument.capture());\n        assertEquals(exc,\n                     throwableArgument.getValue());\n\n        componentsLocked();\n        componentsUnlocked();\n        verifyRepoCloned(false);\n    }\n\n    /**\n     * BZ 1006906 - Repository clone doesn't validate URL\n     */\n    @Test\n    public void testGitUrlValidation() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n\n        when(view.getGitUrl()).thenReturn(\"a b c\");\n        presenter.handleCloneClick();\n\n        when(view.getGitUrl()).thenReturn(\":\");\n        presenter.handleCloneClick();\n\n        when(view.getGitUrl()).thenReturn(\"|\");\n        presenter.handleCloneClick();\n\n        verify(view,\n               times(3)).showUrlHelpInvalidFormatMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    /**\n     * BZ 1006906 - Repository clone doesn't validate URL\n     * <p/>\n     * There are two variants of URIUtils class\n     * At runtime is used javascript version, which consider correctly \"abc\" as invalid uri\n     * In tests is used java version, which consider wrongly \"abc\" as valid uri\n     */\n    @Test\n    @Ignore(\"See comments above\")\n    public void testGitUrlValidationSpecial() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n\n        when(view.getGitUrl()).thenReturn(\"abc\");\n        presenter.handleCloneClick();\n\n        verify(view).showUrlHelpInvalidFormatMessage();\n\n        componentsNotAffected();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testCloneNoGroup() {\n        when(repositoryPreferences.isOUMandatory()).thenReturn(true);\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n        when(view.getSelectedOrganizationalUnit()).thenReturn(\"\");\n\n        presenter = new CloneRepositoryPresenter(repositoryPreferences,\n                                                 view,\n                                                 repoServiceCaller,\n                                                 ouServiceCaller,\n                                                 placeManager);\n        presenter.handleCloneClick();\n\n        verify(view).setOrganizationalUnitGroupType(ValidationState.ERROR);\n        verify(view).showOrganizationalUnitHelpMandatoryMessage();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testCloneNoUrl() {\n        when(repositoryPreferences.isOUMandatory()).thenReturn(true);\n        when(view.isGitUrlEmpty()).thenReturn(true);\n        when(view.getSelectedOrganizationalUnit()).thenReturn(ORG_UNIT_ONE);\n\n        presenter = new CloneRepositoryPresenter(repositoryPreferences,\n                                                 view,\n                                                 repoServiceCaller,\n                                                 ouServiceCaller,\n                                                 placeManager);\n        presenter.handleCloneClick();\n\n        verify(view).setUrlGroupType(ValidationState.ERROR);\n        verify(view).showUrlHelpMandatoryMessage();\n        verifyRepoCloned(false);\n    }\n\n    @Test\n    public void testCancelButton() {\n        presenter.handleCancelClick();\n        verify(view).hide();\n    }\n\n    @Test\n    public void testCreateOUEvent() {\n        final OrganizationalUnit ou = new OrganizationalUnitImpl(\"ou1\",\n                                                                 \"ou\");\n        presenter.onCreateOrganizationalUnit(new AfterCreateOrganizationalUnitEvent(ou));\n\n        verify(view,\n               times(1)).addOrganizationalUnit(ou);\n    }\n\n    @Test\n    public void testDeleteOUEvent() {\n        final OrganizationalUnit ou = new OrganizationalUnitImpl(\"ou1\",\n                                                                 \"ou\");\n        presenter.onDeleteOrganizationalUnit(new RemoveOrganizationalUnitEvent(ou, \"admin\"));\n\n        verify(view,\n               times(1)).deleteOrganizationalUnit(ou);\n    }\n\n    @Test\n    public void testResetWhenShown() {\n        presenter.showForm();\n\n        verify(view,\n               times(1)).reset();\n    }\n\n    @Test\n    public void testCloneManagedRepository() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(repositoryPreferences.isOUMandatory()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n        when(view.getName()).thenReturn(REPO_NAME);\n\n        presenter.handleCloneClick();\n\n        verifyRepoCloned(true);\n\n        verify(repoService,\n               times(1)).createRepository(any(OrganizationalUnit.class),\n                                          anyString(),\n                                          anyString(),\n                                          repositoryEnvironmentConfigurationsArgumentCaptor.capture());\n\n        final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue();\n\n        assertEquals(USERNAME,\n                     configurations.getUserName());\n        assertEquals(PASSWORD,\n                     configurations.getPassword());\n        assertEquals(REPO_URL,\n                     configurations.getOrigin());\n    }\n\n    @Test\n    public void testCloneNotManagedRepository() {\n        when(view.isGitUrlEmpty()).thenReturn(false);\n        when(repositoryPreferences.isOUMandatory()).thenReturn(false);\n        when(view.getGitUrl()).thenReturn(REPO_URL);\n        when(view.getName()).thenReturn(REPO_NAME);\n\n        presenter.handleCloneClick();\n\n        verifyRepoCloned(true);\n\n        verify(repoService,\n               times(1)).createRepository(any(OrganizationalUnit.class),\n                                          anyString(),\n                                          anyString(),\n                                          repositoryEnvironmentConfigurationsArgumentCaptor.capture());\n        final RepositoryEnvironmentConfigurations configurations = repositoryEnvironmentConfigurationsArgumentCaptor.getValue();\n\n        assertEquals(USERNAME,\n                     configurations.getUserName());\n        assertEquals(PASSWORD,\n                     configurations.getPassword());\n        assertEquals(REPO_URL,\n                     configurations.getOrigin());\n    }\n\n    private void componentsNotAffected() {\n        verify(view,\n               never()).setCloneEnabled(anyBoolean());\n\n        verify(view,\n               never()).setGitUrlEnabled(anyBoolean());\n\n        verify(view,\n               never()).setNameEnabled(anyBoolean());\n\n        verify(view,\n               never()).setOrganizationalUnitEnabled(anyBoolean());\n\n        verify(view,\n               never()).setUsernameEnabled(anyBoolean());\n\n        verify(view,\n               never()).setPasswordEnabled(anyBoolean());\n\n        verify(view,\n               never()).showBusyPopupMessage();\n\n        verify(view,\n               never()).closeBusyPopup();\n    }\n\n    private void componentsLocked() {\n        verify(view).showBusyPopupMessage();\n\n        verify(view).setCloneEnabled(false);\n\n        verify(view).setGitUrlEnabled(false);\n\n        verify(view).setNameEnabled(false);\n\n        verify(view).setOrganizationalUnitEnabled(false);\n\n        verify(view).setUsernameEnabled(false);\n\n        verify(view).setPasswordEnabled(false);\n    }\n\n    private void componentsUnlocked() {\n        verify(view).closeBusyPopup();\n\n        verify(view).setCloneEnabled(true);\n\n        verify(view).setGitUrlEnabled(true);\n\n        verify(view).setNameEnabled(true);\n\n        verify(view).setOrganizationalUnitEnabled(true);\n\n        verify(view).setUsernameEnabled(true);\n\n        verify(view).setPasswordEnabled(true);\n    }\n\n    private void verifyRepoCloned(boolean cloned) {\n        if (cloned) {\n            verify(view).alertRepositoryCloned();\n            verify(view).hide();\n        } else {\n            verify(view,\n                   never()).alertRepositoryCloned();\n            verify(view,\n                   never()).hide();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/clone/answer/OuServiceAnswer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone.answer;\n\nimport java.util.Collection;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnitService;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.Mockito.*;\n\npublic class OuServiceAnswer implements Answer<OrganizationalUnitService> {\n\n    private Collection<OrganizationalUnit> units;\n    private OrganizationalUnitService ouService;\n\n    public OuServiceAnswer(Collection<OrganizationalUnit> units,\n                           OrganizationalUnitService ouService) {\n        this.units = units;\n        this.ouService = ouService;\n    }\n\n    @Override\n    public OrganizationalUnitService answer(InvocationOnMock invocation) throws Throwable {\n\n        when(ouService.getOrganizationalUnits()).then(new Answer<Collection<OrganizationalUnit>>() {\n\n            @Override\n            public Collection<OrganizationalUnit> answer(InvocationOnMock invocation) throws Throwable {\n                return units;\n            }\n        });\n\n        @SuppressWarnings(\"unchecked\")\n        final RemoteCallback<Collection<OrganizationalUnit>> callback = (RemoteCallback<Collection<OrganizationalUnit>>) invocation.getArguments()[0];\n        callback.callback(units);\n\n        return ouService;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/clone/answer/RsCreateRepositoryAnswer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone.answer;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\npublic class RsCreateRepositoryAnswer implements Answer<RepositoryService> {\n\n    private Repository repository;\n    private RepositoryService repoService;\n\n    public RsCreateRepositoryAnswer(Repository repository,\n                                    RepositoryService repoService) {\n        this.repository = repository;\n        this.repoService = repoService;\n    }\n\n    @Override\n    public RepositoryService answer(InvocationOnMock invocation) throws Throwable {\n\n        when(repoService.createRepository(any(OrganizationalUnit.class),\n                                          any(String.class),\n                                          any(String.class),\n                                          any(RepositoryEnvironmentConfigurations.class))).then(new Answer<Repository>() {\n\n            @Override\n            public Repository answer(InvocationOnMock invocation) throws Throwable {\n                return repository;\n            }\n        });\n\n        @SuppressWarnings(\"unchecked\")\n        final RemoteCallback<Repository> callback = (RemoteCallback<Repository>) invocation.getArguments()[0];\n        callback.callback(repository);\n\n        return repoService;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/clone/answer/RsCreateRepositoryFailAnswer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone.answer;\n\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryEnvironmentConfigurations;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\npublic class RsCreateRepositoryFailAnswer implements Answer<RepositoryService> {\n\n    private Message message;\n    private Throwable cause;\n    private Repository repository;\n    private RepositoryService repoService;\n\n    public RsCreateRepositoryFailAnswer(Message message,\n                                        Throwable cause,\n                                        Repository repository,\n                                        RepositoryService repoService) {\n        this.message = message;\n        this.cause = cause;\n        this.repository = repository;\n        this.repoService = repoService;\n    }\n\n    @Override\n    public RepositoryService answer(InvocationOnMock invocation) throws Throwable {\n\n        when(repoService.createRepository(any(OrganizationalUnit.class),\n                                          any(String.class),\n                                          any(String.class),\n                                          any(RepositoryEnvironmentConfigurations.class))).then(new Answer<Repository>() {\n\n            @Override\n            public Repository answer(InvocationOnMock invocation) throws Throwable {\n                return repository;\n            }\n        });\n\n        @SuppressWarnings(\"unchecked\")\n        final ErrorCallback<Message> callback = (ErrorCallback<Message>) invocation.getArguments()[1];\n        callback.error(message,\n                       cause);\n\n        return repoService;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/clone/answer/RsNormalizedNameAnswer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.clone.answer;\n\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\npublic class RsNormalizedNameAnswer implements Answer<RepositoryService> {\n\n    private String normalizedName;\n    private RepositoryService repoService;\n\n    public RsNormalizedNameAnswer(String normalizedName,\n                                  RepositoryService repoService) {\n        this.normalizedName = normalizedName;\n        this.repoService = repoService;\n    }\n\n    @Override\n    public RepositoryService answer(InvocationOnMock invocation) throws Throwable {\n\n        when(repoService.normalizeRepositoryName(any(String.class))).then(new Answer<String>() {\n\n            @Override\n            public String answer(InvocationOnMock invocation) throws Throwable {\n                return normalizedName;\n            }\n        });\n\n        @SuppressWarnings(\"unchecked\")\n        final RemoteCallback<String> callback = (RemoteCallback<String>) invocation.getArguments()[0];\n        callback.callback(normalizedName);\n\n        return repoService;\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/common/CopyMavenRepositoryUrlBtnTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.structure.client.editors.repository.common;\n\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwtmockito.GwtMockito;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Parameterized;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(Parameterized.class)\npublic class CopyMavenRepositoryUrlBtnTest {\n\n    private boolean isViewButton;\n\n    private CopyRepositoryUrlBtn btn;\n\n    @Parameterized.Parameters\n    public static Collection<Boolean[]> caseSensitivity() {\n        return Arrays.asList(new Boolean[][]{{true}, {false}});\n    }\n\n    public CopyMavenRepositoryUrlBtnTest(boolean isViewButton) {\n        this.isViewButton = isViewButton;\n    }\n\n    @Before\n    public void init() {\n        GwtMockito.initMocks(this);\n        btn = GWT.create(CopyRepositoryUrlBtn.class);\n\n        doCallRealMethod().when(btn).init(anyBoolean(),\n                                          anyString(),\n                                          anyString());\n    }\n\n    @Test\n    public void testButtonInit() {\n        btn.init(isViewButton,\n                 \"abc\",\n                 \"xyz\");\n\n        verify(btn,\n               times(1)).setDataClipboardTargetAttribute(\"abc\");\n        verify(btn,\n               times(1)).setDataClipboardTextAttribute(\"xyz\");\n        verify(btn,\n               times(1)).setButtonAttribute(isViewButton,\n                                            \"abc\");\n        verify(btn,\n               times(1)).setCopyRepositoryUrlTitle();\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/edit/MavenRepositoryEditorPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.client.editors.repository.edit;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\nimport java.util.Optional;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.common.services.project.client.security.ProjectController;\nimport org.guvnor.common.services.project.service.WorkspaceProjectService;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryInfo;\nimport org.guvnor.structure.repositories.RepositoryRemovedEvent;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.RepositoryServiceEditor;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.ext.widgets.core.client.resources.i18n.CoreConstants;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.promise.SyncPromises;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MavenRepositoryEditorPresenterTest {\n\n    private RepositoryEditorPresenter presenter;\n\n    @Mock\n    private RepositoryEditorPresenter.View view;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private RepositoryServiceEditor repositoryServiceEditor;\n\n    @Mock\n    private EventSourceMock<NotificationEvent> notification;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private ProjectController projectController;\n\n    @Mock\n    private Path root;\n\n    @Mock\n    private WorkspaceProjectContext context;\n\n    private SyncPromises promises;\n\n    private RepositoryInfo repositoryInfo;\n    private List<VersionRecord> repositoryHistory;\n    private PlaceRequest place = new DefaultPlaceRequest();\n\n    @Before\n    public void before() {\n        promises = new SyncPromises();\n        presenter = new RepositoryEditorPresenter(view,\n                                                  new CallerMock<>(repositoryService),\n                                                  new CallerMock<>(mock(WorkspaceProjectService.class)),\n                                                  new CallerMock<>(repositoryServiceEditor),\n                                                  notification,\n                                                  placeManager,\n                                                  projectController,\n                                                  context,\n                                                  promises);\n\n        repositoryInfo = new RepositoryInfo(\"repository\",\n                                            \"repository\",\n                                            \"owner\",\n                                            root,\n                                            new ArrayList<PublicURI>(),\n                                            new ArrayList<VersionRecord>());\n        repositoryHistory = Collections.EMPTY_LIST;\n\n        when(repositoryService.getRepositoryInfo(any(Space.class), any(String.class))).thenReturn(repositoryInfo);\n        when(repositoryService.getRepositoryHistory(any(Space.class),\n                                                    any(String.class),\n                                                    any(Integer.class))).thenReturn(repositoryHistory);\n        when(repositoryServiceEditor.revertHistory(any(String.class),\n                                                   eq(root),\n                                                   any(String.class),\n                                                   any(VersionRecord.class))).thenReturn(repositoryHistory);\n        OrganizationalUnit ou = mock(OrganizationalUnit.class);\n        when(ou.getName()).thenReturn(\"owner\");\n        when(context.getActiveOrganizationalUnit()).thenReturn(Optional.of(ou));\n        doReturn(promises.resolve(true)).when(projectController).canUpdateProject(any());\n\n        //Each test needs the Presenter to be initialised\n        place.addParameter(\"alias\",\n                           \"repository\");\n        presenter.onStartup(place);\n    }\n\n    @Test\n    public void testOnStartup() {\n        verify(repositoryService,\n               times(1)).getRepositoryInfo(eq(new Space(repositoryInfo.getOwner())), eq(\"repository\"));\n\n        verify(view,\n               times(1)).setRepositoryInfo(eq(repositoryInfo.getAlias()),\n                                           eq(repositoryInfo.getOwner()),\n                                           eq(false),\n                                           eq(repositoryInfo.getPublicURIs()),\n                                           eq(CoreConstants.INSTANCE.Empty()),\n                                           eq(repositoryInfo.getInitialVersionList()));\n    }\n\n    @Test\n    public void testLoadMoreHistory() {\n        presenter.onLoadMoreHistory(0);\n\n        verify(repositoryService,\n               times(1)).getRepositoryHistory(eq(new Space(repositoryInfo.getOwner())),\n                                              eq(\"repository\"),\n                                              eq(0));\n\n        verify(view,\n               times(1)).addHistory(eq(repositoryHistory));\n    }\n\n    @Test\n    public void testRevertNoCommitMessage() {\n        final VersionRecord vr = mock(VersionRecord.class);\n        presenter.onRevert(vr);\n\n        verify(repositoryServiceEditor,\n               times(1)).revertHistory(eq(\"repository\"),\n                                       eq(root),\n                                       isNull(String.class),\n                                       eq(vr));\n\n        verify(view,\n               times(1)).reloadHistory(eq(repositoryHistory));\n    }\n\n    @Test\n    public void testRevertWithCommitMessage() {\n        final VersionRecord vr = mock(VersionRecord.class);\n        presenter.onRevert(vr,\n                           \"comment\");\n\n        verify(repositoryServiceEditor,\n               times(1)).revertHistory(eq(\"repository\"),\n                                       eq(root),\n                                       eq(\"comment\"),\n                                       eq(vr));\n\n        verify(view,\n               times(1)).reloadHistory(eq(repositoryHistory));\n    }\n\n    @Test\n    public void testRepositoryRemovedEvent() {\n        final RepositoryRemovedEvent event = mock(RepositoryRemovedEvent.class);\n        final Repository repository = mock(Repository.class);\n        when(repository.getAlias()).thenReturn(\"repository\");\n        when(event.getRepository()).thenReturn(repository);\n\n        presenter.onRepositoryRemovedEvent(event);\n\n        verify(placeManager,\n               times(1)).closePlace(eq(place));\n    }\n\n    @Test\n    public void testNotificationFiredWhenGitUriCopied() {\n        presenter.onGitUrlCopied(\"uri\");\n\n        verify(notification,\n               times(1)).fire(any(NotificationEvent.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/list/MavenRepositoryItemPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.PublicURI;\nimport org.guvnor.structure.repositories.Repository;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MavenRepositoryItemPresenterTest {\n\n    List<PublicURI> publicURIs = new ArrayList<PublicURI>();\n    List<Branch> branches = new ArrayList<>();\n\n    @Mock\n    PublicURI uri1;\n    @Mock\n    PublicURI uri2;\n    @Mock\n    private GuvnorStructureContext guvnorStructureContext;\n    @Mock\n    private EventSourceMock<NotificationEvent> notification;\n    @Mock\n    private RepositoryItemView view;\n    private RepositoryItemPresenter presenter;\n    @Mock\n    private Repository repository;\n\n    @Before\n    public void init() {\n\n        //main branch always present.\n        branches.add(new Branch(\"main\",\n                                mock(Path.class)));\n\n        when(uri1.getProtocol()).thenReturn(\"test-protocol1\");\n        when(uri1.getURI()).thenReturn(\"uri1\");\n\n        when(uri2.getProtocol()).thenReturn(\"test-protocol2\");\n        when(uri2.getURI()).thenReturn(\"uri2\");\n\n        presenter = new RepositoryItemPresenter(view,\n                                                guvnorStructureContext,\n                                                notification);\n        when(repository.getAlias()).thenReturn(\"TestRepo\");\n    }\n\n    @Test\n    public void repositoryWithPublicUrisAndBranchesLoadTest() {\n        publicURIs.add(uri1);\n        publicURIs.add(uri2);\n        branches.add(new Branch(\"development\",\n                                mock(Path.class)));\n        branches.add(new Branch(\"release\",\n                                mock(Path.class)));\n        repositoryLoadTest(publicURIs,\n                           branches);\n    }\n\n    @Test\n    public void repositoryWithPublicUrisAndNoBranchesLoadTest() {\n        publicURIs.add(uri1);\n        publicURIs.add(uri2);\n        repositoryLoadTest(publicURIs,\n                           branches);\n    }\n\n    @Test\n    public void repositoryWithNoPublicUrisAndBranchesLoadTest() {\n        branches.add(new Branch(\"development\",\n                                mock(Path.class)));\n        branches.add(new Branch(\"release\",\n                                mock(Path.class)));\n        repositoryLoadTest(publicURIs,\n                           branches);\n    }\n\n    @Test\n    public void repositoryWithNoPublicUrisAndNoBranchesLoadTest() {\n        repositoryLoadTest(publicURIs,\n                           branches);\n    }\n\n    private void repositoryLoadTest(final List<PublicURI> uris,\n                                    final List<Branch> branches) {\n\n        when(repository.getAlias()).thenReturn(\"TestRepo\");\n        when(repository.getPublicURIs()).thenReturn(publicURIs);\n        when(repository.getBranches()).thenReturn(branches);\n\n        presenter.setRepository(repository,\n                                \"main\");\n\n        verify(view).setPresenter(presenter);\n        verify(view).setRepositoryName(\"TestRepo\");\n\n        //protocols configuration\n        if (uris.size() > 0) {\n            verify(view).showAvailableProtocols();\n\n            verify(view).setDaemonURI(uris.get(0).getURI());\n            for (PublicURI publicURI : uris) {\n                verify(view).addProtocol(publicURI.getProtocol());\n            }\n        }\n\n        verify(view).setUriId(\"view-uri-for-\" + \"TestRepo\");\n\n        //branches configuration\n        verify(view).clearBranches();\n        Collections.reverse(branches);\n        for (final Branch branch : branches) {\n            verify(view).addBranch(branch.getName());\n        }\n        verify(view).setSelectedBranch(\"main\");\n        verify(view).refresh();\n    }\n\n    @Test\n    public void refreshBranchesTest() {\n\n        branches.add(new Branch(\"development\",\n                                mock(Path.class)));\n        branches.add(new Branch(\"release\",\n                                mock(Path.class)));\n\n        //emulates development branch was selected at the moment of the refresh\n        when(view.getSelectedBranch()).thenReturn(\"development\");\n\n        //check that the repository was loaded properly\n        repositoryLoadTest(publicURIs,\n                           branches);\n\n        //now e.g. an additional branch was added to the repository.\n        branches.add(new Branch(\"NewBranch\",\n                                mock(Path.class)));\n\n        presenter.refreshBranches();\n\n        //at this point the view should have been refreshed a second time.\n        verify(view,\n               times(2)).clearBranches();\n        //existing branches should have been added for a second time as part of the refresh.\n        verify(view,\n               times(2)).addBranch(\"main\");\n        verify(view,\n               times(2)).addBranch(\"development\");\n        verify(view,\n               times(2)).addBranch(\"release\");\n        //the new branch should have been loaded for the first time.\n        verify(view,\n               times(1)).addBranch(\"NewBranch\");\n        //the previously selected branch should have been set again.\n        verify(view,\n               times(1)).setSelectedBranch(\"development\");\n    }\n\n    @Test\n    public void testNotificationFiredWhenGitUriCopied() {\n        presenter.onGitUrlCopied(\"uri\");\n\n        verify(notification,\n               times(1)).fire(any(NotificationEvent.class));\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/editors/repository/list/RepositoriesPresenterTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.editors.repository.list;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Optional;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.common.services.project.client.context.WorkspaceProjectContext;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContext;\nimport org.guvnor.structure.client.editors.context.GuvnorStructureContextChangeHandler;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.guvnor.structure.repositories.Branch;\nimport org.guvnor.structure.repositories.NewBranchEvent;\nimport org.guvnor.structure.repositories.Repository;\nimport org.guvnor.structure.repositories.RepositoryService;\nimport org.guvnor.structure.repositories.impl.git.GitRepository;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.spaces.Space;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RepositoriesPresenterTest {\n\n    private RepositoriesPresenter presenter;\n\n    @Mock\n    private RepositoriesView view;\n\n    @Mock\n    private RepositoryService repositoryService;\n\n    @Mock\n    private WorkspaceProjectContext projContext;\n\n    @Mock\n    private EventSourceMock<NotificationEvent> notification;\n\n    private GuvnorStructureContext guvnorStructureContext;\n\n    private Collection<Repository> repositories;\n\n    @Mock\n    private Path branchPath;\n\n    private Repository r1;\n    private Repository r2;\n    private Repository r3;\n    private Repository r4;\n\n    @Mock\n    private RepositoryItemView itemView1;\n    @Mock\n    private RepositoryItemView itemView2;\n    @Mock\n    private RepositoryItemView itemView3;\n    @Mock\n    private RepositoryItemView itemView4;\n\n    private RepositoryItemPresenter itemPresenter1;\n    private RepositoryItemPresenter itemPresenter2;\n    private RepositoryItemPresenter itemPresenter3;\n    private RepositoryItemPresenter itemPresenter4;\n\n    private GuvnorStructureContextChangeHandler changeHandler;\n\n    private GuvnorStructureContextChangeHandler.HandlerRegistration changeHandlerRegistration;\n\n    private GuvnorStructureContextChangeHandler.HandlerRegistration removedChangeHandlerRegistration;\n\n    @Before\n    public void init() {\n\n        r1 = createRepository(\"r1\",\n                              \"space\");\n        r2 = createRepository(\"r2\",\n                              \"space\");\n        r3 = createRepository(\"r3\",\n                              \"space\");\n        r4 = createRepository(\"r4\",\n                              \"space\");\n\n        OrganizationalUnit ou = mock(OrganizationalUnit.class);\n        when(ou.getName()).thenReturn(\"space\");\n        when(projContext.getActiveOrganizationalUnit()).thenReturn(Optional.of(ou));\n\n        repositories = new ArrayList<>();\n\n        repositories.add(r1);\n        repositories.add(r2);\n        repositories.add(r3);\n\n        this.guvnorStructureContext = new GuvnorStructureContext(new CallerMock<>(\n                repositoryService), projContext) {\n            @Override\n            public GuvnorStructureContextChangeHandler.HandlerRegistration addGuvnorStructureContextChangeHandler(\n                    GuvnorStructureContextChangeHandler handler) {\n                //remember the handler that was added to the context.\n                changeHandler = handler;\n                //remember the registration.\n                changeHandlerRegistration = super.addGuvnorStructureContextChangeHandler(handler);\n                return changeHandlerRegistration;\n            }\n\n            @Override\n            public void removeHandler(GuvnorStructureContextChangeHandler.HandlerRegistration handlerRegistration) {\n                //remember the removed registration.\n                removedChangeHandlerRegistration = handlerRegistration;\n                super.removeHandler(handlerRegistration);\n            }\n        };\n\n        itemPresenter1 = createItemPresenter(itemView1,\n                                             guvnorStructureContext,\n                                             r1,\n                                             \"main\");\n        itemPresenter2 = createItemPresenter(itemView2,\n                                             guvnorStructureContext,\n                                             r2,\n                                             \"main\");\n        itemPresenter3 = createItemPresenter(itemView3,\n                                             guvnorStructureContext,\n                                             r3,\n                                             \"main\");\n        itemPresenter4 = createItemPresenter(itemView4,\n                                             guvnorStructureContext,\n                                             r4,\n                                             \"main\");\n\n        presenter = new RepositoriesPresenter(view,\n                                              guvnorStructureContext);\n\n        when(repositoryService.getRepositories(eq(new Space(\"space\")))).thenReturn(repositories);\n\n        when(view.addRepository(r1,\n                                \"main\")).thenReturn(itemPresenter1);\n        when(view.addRepository(r2,\n                                \"main\")).thenReturn(itemPresenter2);\n        when(view.addRepository(r3,\n                                \"main\")).thenReturn(itemPresenter3);\n        when(view.addRepository(r4,\n                                \"main\")).thenReturn(itemPresenter4);\n\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(final InvocationOnMock invocationOnMock) throws Throwable {\n                throw new RuntimeException(\"Should remove a valid repository item.\");\n            }\n        }).when(view).removeIfExists(eq((RepositoryItemPresenter) null));\n    }\n\n    @Test\n    public void testSetHandlers() throws Exception {\n        //the presenter should have been added as a change handler.\n        assertTrue(changeHandler == presenter);\n    }\n\n    @Test\n    public void testRemoveHandlers() throws Exception {\n        assertTrue(removedChangeHandlerRegistration == null);\n        presenter.shutdown();\n        //after the shutdown the change handler registration should have been removed.\n        assertTrue(changeHandlerRegistration == removedChangeHandlerRegistration);\n    }\n\n    @Test\n    public void testNewBranchTest() {\n\n        final GuvnorStructureContextChangeHandler handler = mock(GuvnorStructureContextChangeHandler.class);\n\n        guvnorStructureContext.addGuvnorStructureContextChangeHandler(handler);\n\n        presenter.onStartup();\n\n        //Emulates the main branch was selected for the given repository prior the new branch was created.\n        when(itemView1.getSelectedBranch()).thenReturn(\"main\");\n\n        final Branch theNewBranch = new Branch(\"theNewBranch\",\n                                               branchPath);\n\n        ((GitRepository) r1).addBranch(theNewBranch);\n\n        //Emulates the context receiving the new branch event for a branch created in r1.\n        guvnorStructureContext.onNewBranch(new NewBranchEvent(r1,\n                                                              \"theNewBranch\",\n                                                              \"main\",\n                                                              \"user\"));\n\n        verify(handler).onNewBranchAdded(\"r1\",\n                                         \"theNewBranch\",\n                                         branchPath);\n    }\n\n    private RepositoryItemPresenter createItemPresenter(RepositoryItemView itemView,\n                                                        GuvnorStructureContext guvnorStructureContext,\n                                                        Repository repository,\n                                                        String branch) {\n        //reproduces the initialization of the RepositoryItems performed by the view.\n        RepositoryItemPresenter itemPresenter = new RepositoryItemPresenter(itemView,\n                                                                            guvnorStructureContext,\n                                                                            notification);\n        itemPresenter.setRepository(repository,\n                                    branch);\n        return itemPresenter;\n    }\n\n    private Repository createRepository(String alias,\n                                        String space) {\n        GitRepository repository = new GitRepository(alias,\n                                                     new Space(space));\n        repository.addBranch(new Branch(\"main\",\n                                        branchPath));\n        return repository;\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/client/security/OrganizationalUnitControllerTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.client.security;\n\nimport org.uberfire.security.ContributorType;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class OrganizationalUnitControllerTest {\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private User user;\n\n    private OrganizationalUnitController organizationalUnitController;\n\n    @Before\n    public void setup() {\n        organizationalUnitController = spy(new OrganizationalUnitController(authorizationManager,\n                                                                            user));\n    }\n\n\n    @Test\n    public void userCanReadOrganizationalUnitsTest() {\n        doReturn(true).when(organizationalUnitController).canReadOrgUnits();\n        assertTrue(organizationalUnitController.canReadOrgUnits());\n    }\n\n    @Test\n    public void userCanNotReadOrganizationalUnitsTest() {\n        doReturn(false).when(organizationalUnitController).canReadOrgUnits();\n        assertFalse(organizationalUnitController.canReadOrgUnits());\n    }\n\n    @Test\n    public void userCanReadOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).canReadOrgUnit(any());\n        assertTrue(organizationalUnitController.canReadOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanNotReadOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).canReadOrgUnit(any());\n        assertFalse(organizationalUnitController.canReadOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanReadOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR), any());\n        assertTrue(organizationalUnitController.canReadOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanNotReadOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.CONTRIBUTOR), any());\n        assertFalse(organizationalUnitController.canReadOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanDeleteOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).canDeleteOrgUnit(any());\n        assertTrue(organizationalUnitController.canDeleteOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanNotDeleteOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).canDeleteOrgUnit(any());\n        assertFalse(organizationalUnitController.canDeleteOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanDeleteOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.OWNER), any());\n        assertTrue(organizationalUnitController.canDeleteOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanNotDeleteOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.OWNER), any());\n        assertFalse(organizationalUnitController.canDeleteOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanUpdateOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).canUpdateOrgUnit(any());\n        assertTrue(organizationalUnitController.canUpdateOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanNotUpdateOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).canUpdateOrgUnit(any());\n        assertFalse(organizationalUnitController.canUpdateOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanUpdateOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.ADMIN), any());\n        assertTrue(organizationalUnitController.canUpdateOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void contributorCanNotUpdateOrganizationalUnitTest() {\n        doReturn(false).when(organizationalUnitController).userIsAtLeast(eq(ContributorType.ADMIN), any());\n        assertFalse(organizationalUnitController.canUpdateOrgUnit(mock(OrganizationalUnit.class)));\n    }\n\n    @Test\n    public void userCanCreateOrganizationalUnitTest() {\n        doReturn(true).when(organizationalUnitController).canCreateOrgUnits();\n        assertTrue(organizationalUnitController.canCreateOrgUnits());\n    }\n\n    @Test\n    public void userCanNotCreateOrganizationalUnitsTest() {\n        doReturn(false).when(organizationalUnitController).canCreateOrgUnits();\n        assertFalse(organizationalUnitController.canCreateOrgUnits());\n    }\n\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/organizationalunit/OrganizationalUnitServiceCallerMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.organizationalunit;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.function.Predicate;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.repositories.Repository;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.spaces.Space;\n\n/**\n * Utility class for client side testing.\n * <p>\n * Example usage:\n * <p>\n * OrganizationalUnitService serviceMock = mock( OrganizationalUnitService.class );\n * OrganizationalUnitServiceCallerMock serviceCallerMock = new OrganizationalUnitServiceCallerMock( serviceMock );\n * when( serviceMock.someMethod() ).thenReturn( someValue );\n * <p>\n * finally pass the serviceCallerMock to the given presenter.\n */\npublic class OrganizationalUnitServiceCallerMock\n        implements Caller<OrganizationalUnitService> {\n\n    protected OrganizationalUnitServiceWrapper organizationalUnitServiceWrapper;\n\n    protected RemoteCallback remoteCallback;\n\n    public OrganizationalUnitServiceCallerMock(OrganizationalUnitService organizationalUnitService) {\n        this.organizationalUnitServiceWrapper = new OrganizationalUnitServiceWrapper(organizationalUnitService);\n    }\n\n    @Override\n    public OrganizationalUnitService call() {\n        return organizationalUnitServiceWrapper;\n    }\n\n    @Override\n    public OrganizationalUnitService call(RemoteCallback<?> remoteCallback) {\n        return call(remoteCallback,\n                    null);\n    }\n\n    @Override\n    public OrganizationalUnitService call(RemoteCallback<?> remoteCallback,\n                                          ErrorCallback<?> errorCallback) {\n        this.remoteCallback = remoteCallback;\n        return organizationalUnitServiceWrapper;\n    }\n\n    private class OrganizationalUnitServiceWrapper\n            implements OrganizationalUnitService {\n\n        OrganizationalUnitService organizationalUnitService;\n\n        public OrganizationalUnitServiceWrapper(OrganizationalUnitService organizationalUnitService) {\n            this.organizationalUnitService = organizationalUnitService;\n        }\n\n        @Override\n        public OrganizationalUnit getOrganizationalUnit(String name) {\n            OrganizationalUnit result = organizationalUnitService.getOrganizationalUnit(name);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit getOrganizationalUnit(String name,\n                                                        final boolean includeDeleted) {\n            OrganizationalUnit result = organizationalUnitService.getOrganizationalUnit(name, includeDeleted);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getAllOrganizationalUnits() {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getAllOrganizationalUnits();\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getAllOrganizationalUnits(final boolean includeDeleted) {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getAllOrganizationalUnits(includeDeleted);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getAllOrganizationalUnits(boolean includeDeleted, Predicate<OrganizationalUnit> filter) {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getAllOrganizationalUnits(includeDeleted, filter);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getAllDeletedOrganizationalUnit() {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getAllDeletedOrganizationalUnit();\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Space> getAllUserSpaces() {\n            Collection<Space> result = organizationalUnitService.getAllUserSpaces();\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getOrganizationalUnits() {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getOrganizationalUnits();\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<OrganizationalUnit> getOrganizationalUnits(final boolean includeDeleted) {\n            Collection<OrganizationalUnit> result = organizationalUnitService.getOrganizationalUnits(includeDeleted);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit createOrganizationalUnit(String name,\n                                                           String defaultGroupId) {\n            OrganizationalUnit result = organizationalUnitService.createOrganizationalUnit(name,\n                                                                                           defaultGroupId);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit createOrganizationalUnit(String name,\n                                                           String defaultGroupId,\n                                                           Collection<Repository> repositories) {\n            OrganizationalUnit result = organizationalUnitService.createOrganizationalUnit(name,\n                                                                                           defaultGroupId,\n                                                                                           repositories);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit createOrganizationalUnit(String name,\n                                                           String defaultGroupId,\n                                                           Collection<Repository> repositories,\n                                                           Collection<Contributor> contributors) {\n            OrganizationalUnit result = organizationalUnitService.createOrganizationalUnit(name,\n                                                                                           defaultGroupId,\n                                                                                           repositories,\n                                                                                           contributors);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit createOrganizationalUnit(String name,\n                                                           String defaultGroupId,\n                                                           Collection<Repository> repositories,\n                                                           Collection<Contributor> contributors,\n                                                           String description) {\n            OrganizationalUnit result = organizationalUnitService.createOrganizationalUnit(name,\n                                                                                           defaultGroupId,\n                                                                                           repositories,\n                                                                                           contributors,\n                                                                                           description);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit updateOrganizationalUnit(String name,\n                                                           String defaultGroupId) {\n            OrganizationalUnit result = organizationalUnitService.updateOrganizationalUnit(name,\n                                                                                           defaultGroupId);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit updateOrganizationalUnit(String name,\n                                                           String defaultGroupId,\n                                                           Collection<Contributor> contributors) {\n            OrganizationalUnit result = organizationalUnitService.updateOrganizationalUnit(name,\n                                                                                           defaultGroupId,\n                                                                                           contributors);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public OrganizationalUnit updateOrganizationalUnit(String name,\n                                                           String defaultGroupId,\n                                                           Collection<Contributor> contributors,\n                                                           String description) {\n            OrganizationalUnit result = organizationalUnitService.updateOrganizationalUnit(name,\n                                                                                           defaultGroupId,\n                                                                                           contributors,\n                                                                                           description);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public void addRepository(OrganizationalUnit organizationalUnit,\n                                  Repository repository) {\n            organizationalUnitService.addRepository(organizationalUnit,\n                                                    repository);\n        }\n\n        @Override\n        public void removeRepository(OrganizationalUnit organizationalUnit,\n                                     Repository repository) {\n            organizationalUnitService.removeRepository(organizationalUnit,\n                                                       repository);\n        }\n\n        @Override\n        public void addGroup(OrganizationalUnit organizationalUnit,\n                             String group) {\n            organizationalUnitService.addGroup(organizationalUnit,\n                                               group);\n        }\n\n        @Override\n        public void removeGroup(OrganizationalUnit organizationalUnit,\n                                String group) {\n            organizationalUnitService.removeGroup(organizationalUnit,\n                                                  group);\n        }\n\n        @Override\n        public void removeOrganizationalUnit(String name) {\n            organizationalUnitService.removeOrganizationalUnit(name);\n        }\n\n        @Override\n        public OrganizationalUnit getParentOrganizationalUnit(Repository repository) {\n            OrganizationalUnit result = organizationalUnitService.getParentOrganizationalUnit(repository);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public List<OrganizationalUnit> getOrganizationalUnits(Repository repository) {\n            List<OrganizationalUnit> result = organizationalUnitService.getOrganizationalUnits(repository);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public String getSanitizedDefaultGroupId(String proposedGroupId) {\n            String result = organizationalUnitService.getSanitizedDefaultGroupId(proposedGroupId);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Boolean isValidGroupId(String proposedGroupId) {\n            Boolean result = organizationalUnitService.isValidGroupId(proposedGroupId);\n            remoteCallback.callback(result);\n            return result;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/organizationalunit/OrganizationalUnitTreeProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.organizationalunit;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.structure.client.security.OrganizationalUnitTreeProvider;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class OrganizationalUnitTreeProviderTest {\n\n    @Mock\n    OrganizationalUnitSearchService searchService;\n\n    @Mock\n    PermissionTree permissionTree;\n\n    @Mock\n    OrganizationalUnit orgUnit1;\n\n    @Mock\n    OrganizationalUnit orgUnit2;\n\n    PermissionManager permissionManager;\n    OrganizationalUnitTreeProvider treeProvider;\n    PermissionNode rootNode;\n\n    @Before\n    public void setup() {\n        permissionManager = new DefaultPermissionManager();\n        treeProvider = new OrganizationalUnitTreeProvider(permissionManager,\n                                                          new CallerMock<>(searchService));\n        rootNode = treeProvider.buildRootNode();\n        rootNode.setPermissionTree(permissionTree);\n\n        when(orgUnit1.getIdentifier()).thenReturn(\"ou1\");\n        when(orgUnit2.getIdentifier()).thenReturn(\"ou2\");\n        when(orgUnit1.getName()).thenReturn(\"ou1\");\n        when(orgUnit2.getName()).thenReturn(\"ou2\");\n        when(orgUnit1.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE);\n        when(orgUnit2.getResourceType()).thenReturn(OrganizationalUnit.RESOURCE_TYPE);\n        when(permissionTree.getChildrenResourceIds(any())).thenReturn(null);\n        when(searchService.searchByName(anyString(),\n                                        anyInt(),\n                                        anyBoolean())).thenReturn(Arrays.asList(orgUnit1,\n                                                                                orgUnit2));\n    }\n\n    @Test\n    public void testRootNode() {\n        assertEquals(rootNode.getPermissionList().size(),\n                     4);\n        checkDependencies(rootNode, 2);\n    }\n\n    @Test\n    public void testChildrenNodes() {\n        rootNode.expand(children -> {\n            verify(searchService).searchByName(any(),\n                                               anyInt(),\n                                               anyBoolean());\n            for (PermissionNode child : children) {\n                List<Permission> permissionList = child.getPermissionList();\n                assertEquals(permissionList.size(),\n                             3);\n                checkDependencies(child, 2);\n\n                List<String> permissionNames = permissionList.stream()\n                        .map(Permission::getName)\n                        .collect(Collectors.toList());\n\n                assertTrue(permissionNames.contains(\"orgunit.read.\" + child.getNodeName()));\n                assertTrue(permissionNames.contains(\"orgunit.update.\" + child.getNodeName()));\n                assertTrue(permissionNames.contains(\"orgunit.delete.\" + child.getNodeName()));\n            }\n        });\n    }\n\n    protected void checkDependencies(PermissionNode permissionNode, int numberOfDependencies) {\n        for (Permission permission : permissionNode.getPermissionList()) {\n            Collection<Permission> dependencies = permissionNode.getDependencies(permission);\n\n            if (permission.getName().startsWith(\"orgunit.read\")) {\n                assertEquals(dependencies.size(),\n                             numberOfDependencies);\n            } else {\n                assertNull(dependencies);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/repositories/RepositoryServiceCallerMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.structure.repositories;\n\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.uberfire.security.Contributor;\nimport org.guvnor.structure.organizationalunit.OrganizationalUnit;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.java.nio.base.version.VersionRecord;\nimport org.uberfire.spaces.Space;\n\n/**\n * Utility class for client side testing.\n * (analogous usage as OrganizationalUnitServiceCallerMock)\n */\npublic class RepositoryServiceCallerMock\n        implements Caller<RepositoryService> {\n\n    protected RepositoryServiceWrapper repositoryServiceWrapper;\n\n    protected RemoteCallback remoteCallback;\n\n    public RepositoryServiceCallerMock(RepositoryService repositoryService) {\n        repositoryServiceWrapper = new RepositoryServiceWrapper(repositoryService);\n    }\n\n    @Override\n    public RepositoryService call() {\n        return repositoryServiceWrapper;\n    }\n\n    @Override\n    public RepositoryService call(RemoteCallback<?> remoteCallback) {\n        return call(remoteCallback,\n                    null);\n    }\n\n    @Override\n    public RepositoryService call(RemoteCallback<?> remoteCallback,\n                                  ErrorCallback<?> errorCallback) {\n        this.remoteCallback = remoteCallback;\n        return repositoryServiceWrapper;\n    }\n\n    private class RepositoryServiceWrapper\n            implements RepositoryService {\n\n        RepositoryService repositoryService;\n\n        public RepositoryServiceWrapper(RepositoryService repositoryService) {\n            this.repositoryService = repositoryService;\n        }\n\n        @Override\n        public RepositoryInfo getRepositoryInfo(Space space,\n                                                String alias) {\n            RepositoryInfo result = repositoryService.getRepositoryInfo(space,\n                                                                        alias);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public List<VersionRecord> getRepositoryHistory(Space space,\n                                                        String alias,\n                                                        int startIndex) {\n            List<VersionRecord> result = repositoryService.getRepositoryHistory(space,\n                                                                                alias,\n                                                                                startIndex);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public List<VersionRecord> getRepositoryHistory(Space space,\n                                                        String alias,\n                                                        int startIndex,\n                                                        int endIndex) {\n            List<VersionRecord> result = repositoryService.getRepositoryHistory(space,\n                                                                                alias,\n                                                                                startIndex,\n                                                                                endIndex);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public List<VersionRecord> getRepositoryHistoryAll(Space space,\n                                                           String alias) {\n            List<VersionRecord> result = repositoryService.getRepositoryHistoryAll(space,\n                                                                                   alias);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Repository getRepositoryFromSpace(Space currentSpace,\n                                                 String alias) {\n            Repository result = repositoryService.getRepositoryFromSpace(currentSpace,\n                                                                         alias);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Repository getRepository(Path root) {\n            Repository result = repositoryService.getRepository(root);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Repository getRepository(Space space,\n                                        Path root) {\n            Repository result = repositoryService.getRepository(space,\n                                                                root);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Repository> getAllRepositories(Space space) {\n            Collection<Repository> result = repositoryService.getAllRepositories(space);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Repository> getAllRepositories(Space space,\n                                                         boolean includeDeleted) {\n            Collection<Repository> result = repositoryService.getAllRepositories(space,\n                                                                                 includeDeleted);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Repository> getAllDeletedRepositories(Space space) {\n            Collection<Repository> result = repositoryService.getAllDeletedRepositories(space);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Repository> getAllRepositoriesFromAllUserSpaces() {\n            Collection<Repository> result = repositoryService.getAllRepositoriesFromAllUserSpaces();\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Collection<Repository> getRepositories(Space space) {\n            Collection<Repository> result = repositoryService.getRepositories(space);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Repository createRepository(final OrganizationalUnit organizationalUnit,\n                                           final String scheme,\n                                           final String alias,\n                                           final RepositoryEnvironmentConfigurations configurations) throws RepositoryAlreadyExistsException {\n            Repository result = repositoryService.createRepository(organizationalUnit,\n                                                                   scheme,\n                                                                   alias,\n                                                                   configurations);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public Repository createRepository(OrganizationalUnit organizationalUnit,\n                                           String scheme,\n                                           String alias,\n                                           RepositoryEnvironmentConfigurations configurations,\n                                           Collection<Contributor> contributors) throws RepositoryAlreadyExistsException {\n\n            Repository result = repositoryService.createRepository(organizationalUnit,\n                                                                   scheme,\n                                                                   alias,\n                                                                   configurations,\n                                                                   contributors);\n            remoteCallback.callback(result);\n            return null;\n        }\n\n        @Override\n        public String normalizeRepositoryName(String name) {\n            String result = repositoryService.normalizeRepositoryName(name);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public boolean validateRepositoryName(String name) {\n            boolean result = repositoryService.validateRepositoryName(name);\n            remoteCallback.callback(result);\n            return result;\n        }\n\n        @Override\n        public void addGroup(Repository repository,\n                             String group) {\n            repositoryService.addGroup(repository,\n                                       group);\n        }\n\n        @Override\n        public void removeGroup(Repository repository,\n                                String group) {\n            repositoryService.removeGroup(repository,\n                                          group);\n        }\n\n        @Override\n        public void updateContributors(Repository repository,\n                                       List<Contributor> contributors) {\n            repositoryService.updateContributors(repository,\n                                                 contributors);\n        }\n\n        @Override\n        public void removeRepository(Space space,\n                                     String alias) {\n            repositoryService.removeRepository(space,\n                                               alias);\n        }\n\n        @Override\n        public void removeRepositories(Space space,\n                                       Set<String> aliases) {\n            repositoryService.removeRepositories(space,\n                                                 aliases);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/repositories/RepositoryTreeProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.guvnor.structure.repositories;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.guvnor.structure.client.security.RepositoryTreeProvider;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mocks.CallerMock;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyBoolean;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class RepositoryTreeProviderTest {\n\n    @Mock\n    RepositorySearchService searchService;\n\n    @Mock\n    PermissionTree permissionTree;\n\n    @Mock\n    Repository repo1;\n\n    @Mock\n    Repository repo2;\n\n    PermissionManager permissionManager;\n    RepositoryTreeProvider treeProvider;\n    PermissionNode rootNode;\n\n    @Before\n    public void setup() {\n        permissionManager = new DefaultPermissionManager();\n        treeProvider = new RepositoryTreeProvider(permissionManager,\n                                                  new CallerMock<>(searchService));\n        rootNode = treeProvider.buildRootNode();\n        rootNode.setPermissionTree(permissionTree);\n\n        when(repo1.getIdentifier()).thenReturn(\"r1\");\n        when(repo2.getIdentifier()).thenReturn(\"r2\");\n        when(repo1.getAlias()).thenReturn(\"r1\");\n        when(repo2.getAlias()).thenReturn(\"r2\");\n        when(repo1.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);\n        when(repo2.getResourceType()).thenReturn(Repository.RESOURCE_TYPE);\n        when(permissionTree.getChildrenResourceIds(any())).thenReturn(null);\n        when(searchService.searchByAlias(anyString(),\n                                         anyInt(),\n                                         anyBoolean())).thenReturn(Arrays.asList(repo1,\n                                                                                 repo2));\n    }\n\n    @Test\n    public void testRootNode() {\n        assertEquals(rootNode.getPermissionList().size(),\n                     5);\n        checkDependencies(rootNode, 3);\n    }\n\n    @Test\n    public void testChildrenNodes() {\n        rootNode.expand(children -> {\n            verify(searchService).searchByAlias(any(),\n                                                anyInt(),\n                                                anyBoolean());\n            for (PermissionNode child : children) {\n                List<Permission> permissionList = child.getPermissionList();\n                assertEquals(permissionList.size(),\n                             4);\n                checkDependencies(child, 3);\n\n                List<String> permissionNames = permissionList.stream()\n                        .map(Permission::getName)\n                        .collect(Collectors.toList());\n\n                assertTrue(permissionNames.contains(\"repository.read.\" + child.getNodeName()));\n                assertTrue(permissionNames.contains(\"repository.update.\" + child.getNodeName()));\n                assertTrue(permissionNames.contains(\"repository.delete.\" + child.getNodeName()));\n                assertTrue(permissionNames.contains(\"repository.build.\" + child.getNodeName()));\n\n                assertEquals(child.getPermissionList().size(),\n                             4);\n                checkDependencies(child, 3);\n            }\n        });\n    }\n\n    protected void checkDependencies(PermissionNode permissionNode, int numberOfDependencies) {\n        for (Permission permission : permissionNode.getPermissionList()) {\n            Collection<Permission> dependencies = permissionNode.getDependencies(permission);\n\n            if (permission.getName().startsWith(\"repository.read\")) {\n                assertEquals(dependencies.size(),\n                             numberOfDependencies);\n            } else {\n                assertNull(dependencies);\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-structure/uberfire-structure-client/src/test/java/org/guvnor/structure/repositories/git/FileSystemHookNotifierTest.java",
    "content": "package org.guvnor.structure.repositories.git;\n\nimport org.assertj.core.api.Assertions;\nimport org.guvnor.structure.client.repositories.git.FileSystemHookNotifier;\nimport org.guvnor.structure.repositories.impl.git.event.NotificationType;\nimport org.guvnor.structure.repositories.impl.git.event.PostCommitNotificationEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.workbench.events.NotificationEvent;\n\nimport javax.enterprise.event.Event;\n\nimport static org.mockito.Mockito.verify;\n\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FileSystemHookNotifierTest {\n\n    private static final String MESSAGE = \"notification message\";\n\n    @Mock\n    private Event<NotificationEvent> notificationEvent;\n\n    private FileSystemHookNotifier notifier;\n\n    @Before\n    public void init() {\n        notifier = new FileSystemHookNotifier(notificationEvent);\n    }\n\n    @Test\n    public void testNotificationSuccess() {\n        testNotification(new PostCommitNotificationEvent(NotificationType.SUCCESS, MESSAGE), MESSAGE, NotificationEvent.NotificationType.SUCCESS);\n    }\n\n    @Test\n    public void testNotificationWarning() {\n        testNotification(new PostCommitNotificationEvent(NotificationType.WARNING, MESSAGE), MESSAGE, NotificationEvent.NotificationType.WARNING);\n    }\n\n    @Test\n    public void testNotificationError() {\n        testNotification(new PostCommitNotificationEvent(NotificationType.ERROR, MESSAGE), MESSAGE, NotificationEvent.NotificationType.ERROR);\n    }\n\n    private void testNotification(PostCommitNotificationEvent event, String expectedMessage, NotificationEvent.NotificationType expectedType) {\n        notifier.notify(event);\n\n        ArgumentCaptor<NotificationEvent> eventCaptor = ArgumentCaptor.forClass(NotificationEvent.class);\n\n        verify(notificationEvent).fire(eventCaptor.capture());\n\n        Assertions.assertThat(eventCaptor.getValue())\n                .isNotNull()\n                .hasFieldOrPropertyWithValue(\"notification\", expectedMessage)\n                .hasFieldOrPropertyWithValue(\"type\", expectedType);\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-test-utils/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-test-utils</artifactId>\n\n  <name>UberFire - Test Utils</name>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.weld.se</groupId>\n      <artifactId>weld-se-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>junit</groupId>\n      <artifactId>junit</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.mockito</groupId>\n      <artifactId>mockito-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-metadata-backend-lucene</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.annotation</groupId>\n      <artifactId>jakarta.annotation-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>ch.qos.logback</groupId>\n      <artifactId>logback-classic</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/CDITestSetup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.test;\n\nimport javax.enterprise.context.spi.CreationalContext;\nimport javax.enterprise.inject.spi.Bean;\nimport javax.enterprise.inject.spi.BeanManager;\n\nimport org.jboss.weld.environment.se.Weld;\nimport org.jboss.weld.environment.se.WeldContainer;\nimport org.slf4j.LoggerFactory;\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.java.nio.fs.file.SimpleFileSystemProvider;\n\npublic class CDITestSetup {\n\n    public final SimpleFileSystemProvider fileSystemProvider = new SimpleFileSystemProvider();\n    public BeanManager beanManager;\n    public Paths paths;\n    private Weld weld;\n\n    public void setUp() throws Exception {\n        // Bootstrap WELD container\n        weld = new Weld();\n        WeldContainer weldContainer = weld.initialize();\n        beanManager = weldContainer.getBeanManager();\n\n        // Instantiate Paths used in tests for Path conversion\n        paths = getReference(Paths.class);\n\n        // Ensure URLs use the default:// scheme\n//        fileSystemProvider.forceAsDefault();\n    }\n\n    public void cleanup() {\n        if (weld != null) {\n            try {\n                weld.shutdown();\n            } catch (NullPointerException npeException) {\n                LoggerFactory.getLogger(CDITestSetup.class)\n                        .warn(\"Problem occured during weld clean up: \" + npeException.getMessage());\n            }\n        }\n    }\n\n    public <T> T getReference(Class<T> clazz) {\n        Bean bean = (Bean) beanManager.getBeans(clazz).iterator().next();\n        CreationalContext cc = beanManager.createCreationalContext(bean);\n        return (T) beanManager.getReference(bean,\n                                            clazz,\n                                            cc);\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/GuvnorTestAppSetup.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.test;\n\nimport javax.annotation.Priority;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Named;\n\nimport org.uberfire.ext.metadata.backend.lucene.LuceneConfig;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.rpc.SessionInfo;\n\nimport static org.mockito.Mockito.*;\n\n@ApplicationScoped\n@Priority(1) // needed in order to inject the @Alternatives outside of this bean bundle (aka maven module)\npublic class GuvnorTestAppSetup {\n\n    public static final IOService DEFAULT_IO_SERVICE = new IOServiceDotFileImpl();\n\n    public static IOService ioService = DEFAULT_IO_SERVICE;\n\n    @Produces\n    @Named(\"ioStrategy\")\n    public IOService ioService() {\n        return ioService;\n    }\n\n    @Produces\n    @Alternative\n    public SessionInfo sessionInfo() {\n        return mock(SessionInfo.class);\n    }\n\n    @Produces\n    @Named(\"luceneConfig\")\n    public LuceneConfig luceneConfig() {\n        return mock(LuceneConfig.class);\n    }\n\n    public static void reset() {\n        ioService = DEFAULT_IO_SERVICE;\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/TempFiles.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.test;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Iterator;\n\nimport org.apache.commons.io.FileUtils;\n\npublic class TempFiles {\n\n    private ArrayList<File> files = new ArrayList<File>();\n\n    public File createTempFile(final String fullName) throws IOException {\n        Iterator<String> iterator = Arrays.asList(fullName.split(\"/\")).iterator();\n\n        File previousFolder = null;\n        while (iterator.hasNext()) {\n\n            String next = iterator.next();\n            if (iterator.hasNext()) {\n                previousFolder = createFolder(previousFolder,\n                                              next);\n            } else {\n                return createFile(previousFolder,\n                                  next);\n            }\n        }\n\n        return null;\n    }\n\n    private File createFolder(final File previousFolder,\n                              final String next) throws IOException {\n        if (previousFolder == null) {\n            return createTempDirectory(next);\n        } else {\n            return createTempDirectory(next,\n                                       previousFolder);\n        }\n    }\n\n    private File createFile(final File previousFolder,\n                            final String next) throws IOException {\n\n        String suffix = getSuffix(next);\n        String prefix = getPrefix(next);\n\n        if (previousFolder == null) {\n            File tempFile = File.createTempFile(prefix,\n                                                suffix);\n            files.add(tempFile);\n            return tempFile;\n        } else {\n            File tempFile = File.createTempFile(prefix,\n                                                suffix,\n                                                previousFolder);\n            files.add(tempFile);\n            return tempFile;\n        }\n    }\n\n    public File createTempDirectory(final String name) throws IOException {\n        final File temp = File.createTempFile(name,\n                                              Long.toString(System.nanoTime()));\n\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        files.add(temp);\n\n        return temp;\n    }\n\n    private File createTempDirectory(final String name,\n                                     final File file) throws IOException {\n        final File temp = File.createTempFile(name,\n                                              Long.toString(System.nanoTime()),\n                                              file);\n\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        files.add(temp);\n\n        return temp;\n    }\n\n    private String getSuffix(final String next) {\n        final int index = next.lastIndexOf('.');\n        if (index >= 0) {\n            return next.substring(0,\n                                  index);\n        } else {\n            return next;\n        }\n    }\n\n    private String getPrefix(final String next) {\n        final int index = next.lastIndexOf('.');\n        if (index >= 0) {\n            return next.substring(index);\n        } else {\n            return next;\n        }\n    }\n\n    public void deleteFiles() {\n        for (final File tempFile : files) {\n            FileUtils.deleteQuietly(tempFile);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/TestFileSystem.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.test;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\n\nimport org.uberfire.backend.vfs.Path;\n\npublic class TestFileSystem\n        extends CDITestSetup {\n\n    private final TempFiles tempFiles;\n    private final HashMap<Path, File> pathToFile = new HashMap<Path, File>();\n\n    public TestFileSystem() throws Exception {\n\n        tempFiles = new TempFiles();\n\n        setUp();\n    }\n\n    public Path createTempFile(final String fullFileName) throws IOException {\n        final File file = tempFiles.createTempFile(fullFileName);\n        final Path path = paths.convert(fileSystemProvider.getPath(file.toURI()));\n\n        pathToFile.put(path,\n                       file);\n\n        return path;\n    }\n\n    public Path createTempDirectory(final String fullDirectoryName) throws IOException {\n        final File file = tempFiles.createTempDirectory(fullDirectoryName);\n        final Path path = paths.convert(fileSystemProvider.getPath(file.toURI()));\n\n        pathToFile.put(path,\n                       file);\n\n        return path;\n    }\n\n    public void deleteFile(final Path path) {\n        getFile(path).delete();\n    }\n\n    public File getFile(final Path path) {\n        return pathToFile.get(path);\n    }\n\n    public void tearDown() {\n        tempFiles.deleteFiles();\n        super.cleanup();\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/TestIdentityFactory.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.test;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.Priority;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Alternative;\nimport javax.enterprise.inject.Produces;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.jboss.errai.security.shared.service.AuthenticationService;\n\n@ApplicationScoped\n@Priority(1) // needed in order to inject the @Alternatives outside of this bean bundle (aka maven module)\npublic class TestIdentityFactory {\n\n    private User identity;\n\n    @PostConstruct\n    public void onStartup() {\n        identity = new UserImpl(\"testUser\");\n    }\n\n    @Produces\n    @Alternative\n    public User getIdentity() {\n        return identity;\n    }\n\n    @Produces\n    @Alternative\n    public AuthenticationService authenticationService() {\n        return new AuthenticationService() {\n            boolean isLoggedIn = false;\n            User user;\n\n            @Override\n            public User login(String username,\n                              String password) {\n                isLoggedIn = true;\n                user = new UserImpl(username);\n                return user;\n            }\n\n            @Override\n            public boolean isLoggedIn() {\n                return false;\n            }\n\n            @Override\n            public void logout() {\n                user = null;\n                isLoggedIn = false;\n            }\n\n            @Override\n            public User getUser() {\n                return user;\n            }\n        };\n    }\n}"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/TestTempFileSystem.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.test;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.util.HashMap;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.backend.server.util.Paths;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.io.IOService;\n\npublic class TestTempFileSystem {\n\n    @Inject\n    @Named(\"ioStrategy\")\n    IOService ioService;\n\n    @Inject\n    Paths paths;\n\n    private final TempFiles tempFiles;\n    private final HashMap<Path, File> pathToFile = new HashMap<>();\n\n    public TestTempFileSystem() throws Exception {\n\n        tempFiles = new TempFiles();\n    }\n\n    public Path createTempFile(final String fullFileName) throws IOException {\n        final File file = tempFiles.createTempFile(fullFileName);\n        final Path path = paths.convert(ioService.get(file.toURI()));\n\n        pathToFile.put(path,\n                       file);\n\n        return path;\n    }\n\n    public Path createTempDirectory(final String fullDirectoryName) throws IOException {\n        final File file = tempFiles.createTempDirectory(fullDirectoryName);\n        final Path path = paths.convert(ioService.get(file.toURI()));\n\n        pathToFile.put(path,\n                       file);\n\n        return path;\n    }\n\n    public void deleteFile(final Path path) {\n        getFile(path).delete();\n    }\n\n    public File getFile(final Path path) {\n        return pathToFile.get(path);\n    }\n\n    public void tearDown() {\n        tempFiles.deleteFiles();\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/java/org/guvnor/test/WeldJUnitRunner.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.test;\n\nimport org.jboss.weld.environment.se.Weld;\nimport org.jboss.weld.environment.se.WeldContainer;\nimport org.junit.runner.notification.RunNotifier;\nimport org.junit.runners.BlockJUnit4ClassRunner;\nimport org.junit.runners.model.FrameworkMethod;\nimport org.junit.runners.model.InitializationError;\nimport org.slf4j.Logger;\nimport org.slf4j.LoggerFactory;\n\n/**\n * Simple JUnit test runner which automatically takes care of starting Weld container before the test runs and stopping\n * the Weld after the test finishes.\n * <p>\n * The test class can also use all CDI constructs (like @Inject). For example the test can inject BeanManager:\n * ...\n * @Inject private BeanManager beanManager;\n * ...\n * <p>\n * Use @RunWith annotation to specify the runner for the test class: {@code @RunWith(WeldJUnitRunner.class)\n */\npublic class WeldJUnitRunner extends BlockJUnit4ClassRunner {\n\n    private static final Logger logger = LoggerFactory.getLogger(WeldJUnitRunner.class);\n\n    private final Class<?> testClass;\n    private Weld weld;\n    private WeldContainer weldContainer;\n\n    /**\n     * Creates a WeldJUnitRunner to run {@code testClass}\n     * @param testClass\n     * @throws InitializationError if the test class is malformed.\n     */\n    public WeldJUnitRunner(Class<?> testClass) throws InitializationError {\n        super(testClass);\n        this.testClass = testClass;\n    }\n\n    @Override\n    protected Object createTest() throws Exception {\n        return weldContainer.instance().select(testClass).get();\n    }\n\n    @Override\n    public void runChild(final FrameworkMethod method,\n                         RunNotifier notifier) {\n        startWeld();\n        try {\n            super.runChild(method,\n                           notifier);\n        } finally {\n            stopWeld();\n        }\n    }\n\n    private void startWeld() {\n        logger.debug(\"Starting Weld for test class \" + testClass.getCanonicalName());\n        weld = new Weld(testClass.getCanonicalName());\n        weldContainer = weld.initialize();\n    }\n\n    private void stopWeld() {\n        logger.debug(\"Stopping Weld for test class \" + testClass.getCanonicalName());\n        if (weld != null) {\n            weld.shutdown();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/main/resources/META-INF/beans.xml",
    "content": "<!--\n  ~ Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<beans/>\n"
  },
  {
    "path": "uberfire-test-utils/src/main/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-test-utils/src/test/java/org/guvnor/test/TempFilesTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\npackage org.guvnor.test;\n\nimport java.io.File;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class TempFilesTest {\n\n    private TempFiles tempFiles;\n\n    @Before\n    public void setUp() throws Exception {\n        tempFiles = new TempFiles();\n    }\n\n    @Test\n    public void testDirectory() throws Exception {\n        final File tempDirectory = tempFiles.createTempDirectory(\"mydir\");\n\n        assertTrue(tempDirectory.exists());\n\n        tempFiles.deleteFiles();\n\n        assertFalse(tempDirectory.exists());\n    }\n\n    @Test\n    public void testFiles() throws Exception {\n        final File pomFile = tempFiles.createTempFile(\"mydir/pom.xml\");\n        final File javaClass = tempFiles.createTempFile(\"mydir/org/test/Person.java\");\n\n        assertTrue(pomFile.exists());\n        assertTrue(javaClass.exists());\n\n        tempFiles.deleteFiles();\n\n        assertFalse(pomFile.exists());\n        assertFalse(javaClass.exists());\n    }\n}"
  },
  {
    "path": "uberfire-test-utils/src/test/java/org/guvnor/test/WeldJUnitRunnerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n*/\n\npackage org.guvnor.test;\n\npublic class WeldJUnitRunnerTest {\n\n}\n"
  },
  {
    "path": "uberfire-test-utils/src/test/resources/META-INF/beans.xml",
    "content": ""
  },
  {
    "path": "uberfire-test-utils/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.guvnor\" level=\"INFO\"/>\n\n  <root level=\"WARN\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>"
  },
  {
    "path": "uberfire-testing-utils/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-testing-utils/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-testing-utils</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Testing Utils</name>\n  <description>UberFire Testing Utils</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-marshalling</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-jgit</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-fs</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.mockito</groupId>\n      <artifactId>mockito-core</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>commons-io</groupId>\n      <artifactId>commons-io</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/CallerMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.lang.reflect.Proxy;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\n\npublic class CallerMock<T> implements Caller<T> {\n\n    private T callerProxy;\n    private RemoteCallback successCallBack;\n    private ErrorCallback errorCallBack;\n\n    public CallerMock(T t) {\n        callerProxy = (T) CallerProxy.newInstance(t);\n    }\n\n    @Override\n    public T call() {\n        final CallerProxy localProxy = ((CallerProxy) Proxy.getInvocationHandler(callerProxy));\n        localProxy.setSuccessCallBack(null);\n        localProxy.setErrorCallBack(null);\n        return callerProxy;\n    }\n\n    @Override\n    public T call(RemoteCallback<?> remoteCallback) {\n        final CallerProxy localProxy = ((CallerProxy) Proxy.getInvocationHandler(callerProxy));\n        localProxy.setSuccessCallBack((RemoteCallback<Object>) remoteCallback);\n        localProxy.setErrorCallBack(null);\n        return callerProxy;\n    }\n\n    @Override\n    public T call(RemoteCallback<?> remoteCallback,\n                  ErrorCallback<?> errorCallback) {\n        final CallerProxy localProxy = ((CallerProxy) Proxy.getInvocationHandler(callerProxy));\n        localProxy.setSuccessCallBack((RemoteCallback<Object>) remoteCallback);\n        localProxy.setErrorCallBack((ErrorCallback<Object>) errorCallback);\n\n        return callerProxy;\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/CallerProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.lang.reflect.InvocationTargetException;\nimport java.lang.reflect.Method;\n\nimport com.google.common.base.Defaults;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\n\npublic class CallerProxy implements java.lang.reflect.InvocationHandler {\n\n    private Object target;\n    private RemoteCallback<Object> successCallBack;\n    private ErrorCallback<Object> errorCallBack;\n\n    private CallerProxy(final Object target) {\n        this.target = target;\n    }\n\n    static Object newInstance(final Object target) {\n        return java.lang.reflect.Proxy.newProxyInstance(target.getClass().getClassLoader(),\n                                                        target\n                                                                .getClass().getInterfaces(),\n                                                        new CallerProxy(target));\n    }\n\n    public void setSuccessCallBack(final RemoteCallback<Object> successCallBack) {\n        this.successCallBack = successCallBack;\n    }\n\n    public void setErrorCallBack(final ErrorCallback<Object> errorCallBack) {\n        this.errorCallBack = errorCallBack;\n    }\n\n    public Object invoke(final Object proxy,\n                         final Method m,\n                         final Object[] args) throws Throwable {\n        Object result = null;\n        try {\n            result = m.invoke(target,\n                              args);\n        } catch (Exception e) {\n            if (errorCallBack != null) {\n                if (e instanceof InvocationTargetException) {\n                    errorCallBack.error(result,\n                                        ((InvocationTargetException) e).getTargetException());\n                } else {\n                    errorCallBack.error(result,\n                                        e);\n                }\n            }\n            if (m.getReturnType().isPrimitive()) {\n                return Defaults.defaultValue(m.getReturnType());\n            } else {\n                return result;\n            }\n        }\n        if (successCallBack != null) {\n            successCallBack.callback(result);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/ConstantsAnswerMock.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\n\nimport static org.mockito.Mockito.*;\n\npublic class ConstantsAnswerMock implements Answer {\n\n    /**\n     * Mockito Answer to be used when mocking GWT constants classes.\n     * @param invocation\n     * @return The method name as a String\n     * @throws Throwable\n     */\n    @Override\n    public Object answer(final InvocationOnMock invocation) throws Throwable {\n        if (String.class.equals(invocation.getMethod().getReturnType())) {\n            return invocation.getMethod().getName();\n        } else {\n            return RETURNS_DEFAULTS.answer(invocation);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/EventSourceMock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.lang.annotation.Annotation;\nimport java.util.concurrent.CompletionStage;\n\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.NotificationOptions;\nimport javax.enterprise.util.TypeLiteral;\n\npublic class EventSourceMock<T> implements Event<T> {\n\n    @Override\n    public void fire(T event) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n\n    @Override\n    public Event<T> select(Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n\n    @Override\n    public <U extends T> Event<U> select(Class<U> subtype,\n                                         Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n\n    @Override\n    public <U extends T> CompletionStage<U> fireAsync(U event) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n\n    @Override\n    public <U extends T> CompletionStage<U> fireAsync(U event, NotificationOptions options) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n\n    @Override\n    public <U extends T> Event<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {\n        throw new UnsupportedOperationException(\"mocking testing class\");\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/FileSystemTestingUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.io.File;\nimport java.io.IOException;\nimport java.net.URI;\nimport java.util.HashMap;\n\nimport org.apache.commons.io.FileUtils;\nimport org.uberfire.io.IOService;\nimport org.uberfire.io.impl.IOServiceDotFileImpl;\nimport org.uberfire.java.nio.file.FileSystem;\nimport org.uberfire.java.nio.file.FileSystemAlreadyExistsException;\nimport org.uberfire.java.nio.file.Path;\nimport org.uberfire.java.nio.file.api.FileSystemProviders;\nimport org.uberfire.java.nio.fs.jgit.JGitFileSystemProvider;\nimport org.uberfire.java.nio.fs.jgit.manager.JGitFileSystemsCache;\n\npublic class FileSystemTestingUtils {\n\n    private File path;\n    private FileSystem fileSystem;\n    private IOService ioService;\n\n    public void setup() throws IOException {\n        setup(true);\n    }\n\n    public void setup(boolean initRepo) throws IOException {\n        setup(initRepo, \"git://amend-repo-test\");\n    }\n\n    public void setup(String repoPath) throws IOException {\n        setup(true, repoPath);\n    }\n\n    public void setup(boolean initRepo, String repoPath) throws IOException {\n        ioService = new IOServiceDotFileImpl();\n\n        createTempDirectory();\n        setupJGitRepository(repoPath, initRepo);\n    }\n\n    private void createTempDirectory()\n            throws IOException {\n        final File temp = File.createTempFile(\"temp\",\n                                              Long.toString(System.nanoTime()));\n        if (!(temp.delete())) {\n            throw new IOException(\"Could not delete temp file: \" + temp.getAbsolutePath());\n        }\n\n        if (!(temp.mkdir())) {\n            throw new IOException(\"Could not create temp directory: \" + temp.getAbsolutePath());\n        }\n\n        this.path = temp;\n    }\n\n    public FileSystem setupJGitRepository(String repoPath,\n                                          boolean initRepo) {\n        System.setProperty(\"org.uberfire.nio.git.dir\",\n                           path.getAbsolutePath());\n        final URI newRepo = URI.create(repoPath);\n\n        try {\n\n            fileSystem = ioService.newFileSystem(newRepo,\n                                                 new HashMap<String, Object>());\n        } catch (FileSystemAlreadyExistsException e) {\n            fileSystem = ioService.getFileSystem(newRepo);\n        }\n        if (initRepo) {\n\n            Path init = ioService.get(URI.create(repoPath + \"/init.file\"));\n            ioService.write(init,\n                            \"setupFS!\");\n        }\n        return fileSystem;\n    }\n\n    public void setProviderAsDefault() {\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.forceAsDefault();\n    }\n\n    public void cleanup() {\n        FileUtils.deleteQuietly(path);\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.shutdown();\n        FileUtils.deleteQuietly(gitFsProvider.getGitRepoContainerDir());\n    }\n\n    public void shutDownProvider() {\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        gitFsProvider.shutdown();\n    }\n\n    public FileSystem getFileSystem() {\n        return fileSystem;\n    }\n\n    public IOService getIoService() {\n        return ioService;\n    }\n\n    public JGitFileSystemProvider getProvider() {\n        return (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n    }\n\n    public JGitFileSystemsCache.JGitFileSystemsCacheInfo getFSCacheInfo() {\n        JGitFileSystemProvider gitFsProvider = (JGitFileSystemProvider) FileSystemProviders.resolveProvider(URI.create(\"git://whatever\"));\n        return gitFsProvider.getFsManager().getFsCache().getCacheInfo();\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/IocTestingUtils.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n/**\n * Utility class to SyncBeanManager mocking.\n */\npublic class IocTestingUtils {\n\n    /**\n     * Mocks a SyncBeanManager to return a mocked bean when lookupBean is called.\n     * @param iocManager\n     */\n    public static void mockIocManager(SyncBeanManager iocManager) {\n        doAnswer(invocationOnMock -> createSyncBeanDef((Class<?>) invocationOnMock.getArguments()[0]))\n                .when(iocManager).lookupBean(any(Class.class));\n    }\n\n    private static <T> SyncBeanDef<T> createSyncBeanDef(Class<T> clazz) {\n        final SyncBeanDef syncBeanDef = mock(SyncBeanDef.class);\n        doReturn(mock(clazz)).when(syncBeanDef).getInstance();\n        doReturn(mock(clazz)).when(syncBeanDef).newInstance();\n\n        return syncBeanDef;\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/MockInstanceImpl.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.mocks;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Iterator;\nimport javax.enterprise.inject.Instance;\nimport javax.enterprise.util.TypeLiteral;\n\nimport com.google.common.collect.Iterators;\n\npublic class MockInstanceImpl<T> implements Instance<T> {\n\n    private final T[] instances;\n\n    public MockInstanceImpl(T... instance) {\n        this.instances = instance;\n    }\n\n    @Override\n    public Instance<T> select(Annotation... annotations) {\n        return null;\n    }\n\n    @Override\n    public boolean isUnsatisfied() {\n        return false;\n    }\n\n    @Override\n    public boolean isAmbiguous() {\n        return false;\n    }\n\n    @Override\n    public void destroy(T instance) {\n\n    }\n\n    @Override\n    public <U extends T> Instance<U> select(Class<U> aClass,\n                                            Annotation... annotations) {\n        return null;\n    }\n\n    @Override\n    public Iterator<T> iterator() {\n        return Iterators.forArray(this.instances);\n    }\n\n    @Override\n    public T get() {\n        return instances[0];\n    }\n\n    @Override\n    public <U extends T> Instance<U> select(TypeLiteral<U> subtype, Annotation... qualifiers) {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/ParametrizedCommandMock.java",
    "content": "package org.uberfire.mocks;\n\nimport static org.mockito.Mockito.doAnswer;\n\nimport org.mockito.stubbing.Stubber;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic class ParametrizedCommandMock {\n\n    \n    public static <T> Stubber executeParametrizedCommandWith(int paramIndex, T value) {\n        return doAnswer(ans -> {\n            ParameterizedCommand<T> callback = (ParameterizedCommand<T>) ans.getArguments()[paramIndex];\n            callback.execute(value);\n            return null;\n        });   \n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/mocks/SessionInfoMock.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.security.shared.api.Group;\nimport org.jboss.errai.security.shared.api.Role;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.rpc.SessionInfo;\n\npublic class SessionInfoMock implements SessionInfo {\n\n    private String id;\n\n    private String identity;\n\n    public SessionInfoMock() {\n        this(\"admin\");\n    }\n\n    public SessionInfoMock(final String identity) {\n        this.identity = identity;\n    }\n\n    public SessionInfoMock(final String id,\n                           final String identity) {\n        this.id = id;\n        this.identity = identity;\n    }\n\n    @Override\n    public String getId() {\n        return id != null ? id : \"session_id\";\n    }\n\n    @Override\n    public User getIdentity() {\n        return new User() {\n            @Override\n            public String getIdentifier() {\n                return identity;\n            }\n\n            @Override\n            public Set<Role> getRoles() {\n                return null;\n            }\n\n            @Override\n            public Set<Group> getGroups() {\n                return null;\n            }\n\n            @Override\n            public Map<String, String> getProperties() {\n                return null;\n            }\n\n            @Override\n            public void setProperty(final String s,\n                                    final String s1) {\n\n            }\n\n            @Override\n            public void removeProperty(final String s) {\n\n            }\n\n            @Override\n            public String getProperty(final String s) {\n                return null;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/main/java/org/uberfire/promise/SyncPromises.java",
    "content": "/*\n * Copyright (C) 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.promise;\n\nimport elemental2.promise.IThenable;\nimport elemental2.promise.Promise;\nimport org.uberfire.client.promise.Promises;\n\nimport static org.uberfire.promise.SyncPromises.Status.PENDING;\nimport static org.uberfire.promise.SyncPromises.Status.REJECTED;\nimport static org.uberfire.promise.SyncPromises.Status.RESOLVED;\n\npublic class SyncPromises extends Promises {\n\n    @Override\n    public <T> Promise<T> create(final Promise.PromiseExecutorCallbackFn<T> executor) {\n        return new SyncPromise<>(executor);\n    }\n\n    public static class SyncPromise<T> extends Promise<T> {\n\n        public Status status;\n        public T value;\n\n        private SyncPromise(final PromiseExecutorCallbackFn<T> executor) {\n            super(executor);\n            status = PENDING;\n            executor.onInvoke(new Resolver(), new Rejecter());\n        }\n\n        @Override\n        @SuppressWarnings(\"unchecked\")\n        public <V> Promise<V> then(final ThenOnFulfilledCallbackFn<? super T, ? extends V> onFulfilled) {\n            try {\n                if (status == RESOLVED) {\n                    return (SyncPromise<V>) onFulfilled.onInvoke(value);\n                } else {\n                    return new SyncPromise<>((res, rej) -> rej.onInvoke(value));\n                }\n            } catch (final Exception e) {\n                return new SyncPromise<>((res, rej) -> rej.onInvoke(e));\n            }\n        }\n\n        @Override\n        @SuppressWarnings(\"unchecked\")\n        public <V> Promise<V> catch_(final CatchOnRejectedCallbackFn<? extends V> onRejected) {\n            try {\n                if (status == REJECTED) {\n                    return (SyncPromise<V>) onRejected.onInvoke(this.value);\n                } else {\n                    return new SyncPromise<>((res, rej) -> res.onInvoke((V) value));\n                }\n            } catch (final Exception e) {\n                return new SyncPromise<>((res, rej) -> rej.onInvoke(e));\n            }\n        }\n\n        private class Resolver implements PromiseExecutorCallbackFn.ResolveCallbackFn<T> {\n\n            @Override\n            public void onInvoke(final T value) {\n                resolve(value);\n            }\n\n            @Override\n            public void onInvoke(final IThenable<T> thenable) {\n                if (thenable == null) {\n                    value = null;\n                } else {\n                    thenable.then(v -> {\n                        value = v;\n                        return SyncPromise.resolve(v);\n                    });\n                }\n                status = RESOLVED;\n            }\n\n            @Override\n            public void onInvoke(final ResolveUnionType<T> value) {\n                throw new RuntimeException(\"Not supported\");\n            }\n\n            private void resolve(final T v) {\n                value = v;\n                status = RESOLVED;\n            }\n        }\n\n        private class Rejecter implements PromiseExecutorCallbackFn.RejectCallbackFn {\n\n            @Override\n            @SuppressWarnings(\"unchecked\")\n            public void onInvoke(final Object error) {\n                value = (T) error;\n                status = REJECTED;\n            }\n        }\n    }\n\n    public enum Status {\n        PENDING,\n        RESOLVED,\n        REJECTED;\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/CallerMockTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.ErrorCallback;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CallerMockTest {\n\n    SampleTarget sampleTarget;\n    RemoteCallback<String> successCallBack;\n    ErrorCallback<String> errorCallBack;\n    private CallerMock<SampleTarget> callerMock;\n    private CallerSampleClient callerSample;\n\n    @Before\n    public void setup() {\n\n        sampleTarget = mock(SampleTarget.class);\n        successCallBack = mock(RemoteCallback.class);\n        errorCallBack = mock(ErrorCallback.class);\n    }\n\n    @Test\n    public void callerSampleTest() {\n\n        callerMock = new CallerMock<SampleTarget>(sampleTarget);\n        callerSample = new CallerSampleClient(callerMock);\n\n        callerSample.targetCall();\n        verify(sampleTarget).targetCall();\n\n        verify(successCallBack,\n               never()).callback(anyString());\n        verify(errorCallBack,\n               never()).error(anyString(),\n                              any(SampleException.class));\n    }\n\n    @Test\n    public void callerSampleCallBackSuccessTest() {\n        when(sampleTarget.targetCall()).thenReturn(\"callback\");\n\n        callerMock = new CallerMock<SampleTarget>(sampleTarget);\n        callerSample = new CallerSampleClient(callerMock,\n                                              successCallBack,\n                                              errorCallBack);\n\n        callerSample.targetCallWithSuccessCallBack();\n\n        verify(sampleTarget).targetCall();\n        verify(successCallBack).callback(\"callback\");\n        verify(errorCallBack,\n               never()).error(anyString(),\n                              any(SampleException.class));\n    }\n\n    @Test\n    public void callerSampleCallBackErrorTest() throws SampleException {\n        when(sampleTarget.targetCallWithCheckedException()).thenThrow(SampleException.class);\n\n        callerMock = new CallerMock<SampleTarget>(sampleTarget);\n        callerSample = new CallerSampleClient(callerMock,\n                                              successCallBack,\n                                              errorCallBack);\n\n        callerSample.targetCallWithSuccessAndErrorCallBackCheckedException();\n\n        verify(sampleTarget).targetCallWithCheckedException();\n        verify(errorCallBack).error(any(),\n                                    any(SampleException.class));\n        verify(successCallBack,\n               never()).callback(anyString());\n    }\n\n    @Test\n    public void callerSampleCallBackPrimitiveTypeTest() throws SampleException {\n        when(sampleTarget.targetPrimitiveType()).thenThrow(SampleException.class);\n\n        callerMock = new CallerMock<SampleTarget>(sampleTarget);\n        callerSample = new CallerSampleClient(callerMock,\n                                              successCallBack,\n                                              errorCallBack);\n\n        callerSample.targetPrimitiveType();\n\n        verify(sampleTarget).targetPrimitiveType();\n        verify(errorCallBack).error(any(),\n                                    any(SampleException.class));\n        verify(successCallBack,\n               never()).callback(anyString());\n    }\n\n    @Test\n    public void callerSampleCallBackErrorbyRunTimeExceptionTest() {\n        SampleTarget target = new SampleTarget() {\n            @Override\n            public String targetCall() {\n                throw new RuntimeException();\n            }\n\n            @Override\n            public String targetCallWithCheckedException() throws SampleException {\n                return null;\n            }\n\n            @Override\n            public long targetPrimitiveType() {\n                return 0;\n            }\n        };\n\n        callerMock = new CallerMock<SampleTarget>(target);\n        callerSample = new CallerSampleClient(callerMock,\n                                              successCallBack,\n                                              errorCallBack);\n\n        callerSample.targetCallWithSuccessAndErrorCallBack();\n\n        verify(successCallBack,\n               never()).callback(anyString());\n        verify(errorCallBack).error(any(),\n                                    any(RuntimeException.class));\n    }\n\n    @Test\n    public void callerMockitoCallBackErrorbyRunTimeExceptionTest() {\n\n        SampleTarget target = mock(SampleTarget.class);\n        when(target.targetCall()).thenThrow(new RuntimeException());\n\n        callerMock = new CallerMock<>(target);\n        callerSample = new CallerSampleClient(callerMock,\n                                              successCallBack,\n                                              errorCallBack);\n\n        callerSample.targetCallWithSuccessAndErrorCallBack();\n\n        verify(successCallBack,\n               never()).callback(anyString());\n        verify(errorCallBack).error(any(),\n                                    any(RuntimeException.class));\n    }\n\n    private interface SampleTarget {\n\n        String targetCall();\n\n        String targetCallWithCheckedException() throws SampleException;\n\n        long targetPrimitiveType();\n    }\n\n    private class CallerSampleClient {\n\n        private RemoteCallback successCallBack;\n        private ErrorCallback errorCallBack;\n        private Caller<SampleTarget> caller;\n\n        @Inject\n        public CallerSampleClient(Caller<SampleTarget> caller) {\n            this.caller = caller;\n        }\n\n        public CallerSampleClient(CallerMock<SampleTarget> callerMock,\n                                  RemoteCallback successCallBack,\n                                  ErrorCallback errorCallBack) {\n\n            this.caller = callerMock;\n            this.successCallBack = successCallBack;\n            this.errorCallBack = errorCallBack;\n        }\n\n        public void targetCall() {\n            caller.call().targetCall();\n        }\n\n        public void targetCallWithSuccessCallBack() {\n            caller.call(successCallBack).targetCall();\n        }\n\n        public void targetCallWithSuccessAndErrorCallBack() {\n            caller.call(successCallBack,\n                        errorCallBack).targetCall();\n        }\n\n        public void targetCallWithSuccessAndErrorCallBackCheckedException() throws SampleException {\n            caller.call(successCallBack,\n                        errorCallBack).targetCallWithCheckedException();\n        }\n\n        public long targetPrimitiveType() {\n            return caller.call(successCallBack,\n                               errorCallBack).targetPrimitiveType();\n        }\n    }\n\n    private class SampleException extends RuntimeException {\n\n    }\n}"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/ConstantsAnswerMockTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ConstantsAnswerMockTest {\n\n    @Test\n    public void callMethodWithStringReturnTypeTest() {\n        MockInterface mockedInterface = mock(MockInterface.class,\n                                             new ConstantsAnswerMock());\n\n        assertEquals(\"stringMethod\",\n                     mockedInterface.stringMethod());\n    }\n\n    @Test\n    public void callMethodWithOtherReturnTypesTest() {\n        MockInterface mockedInterface = mock(MockInterface.class,\n                                             new ConstantsAnswerMock());\n\n        assertEquals(0,\n                     mockedInterface.intMethod());\n        assertEquals(false,\n                     mockedInterface.booleanMethod());\n        assertNull(mockedInterface.objectMethod());\n    }\n\n    interface MockInterface {\n\n        String stringMethod();\n\n        int intMethod();\n\n        boolean booleanMethod();\n\n        MockInterface objectMethod();\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/EventSourceMockTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class EventSourceMockTest {\n\n    @Mock\n    EventSampleMock eventSampleMock;\n\n    @Test\n    public void eventFireTest() {\n        EventSourceSample t = new EventSourceSample(eventSampleMock);\n        t.fireEvent();\n        verify(eventSampleMock,\n               times(1)).fire(any(EventSourceSample.EventSample.class));\n    }\n\n    @Test\n    public void eventTestWithoutFire() {\n        EventSourceSample t = new EventSourceSample(eventSampleMock);\n        verify(eventSampleMock,\n               times(0)).fire(any(EventSourceSample.EventSample.class));\n    }\n\n    static class EventSampleMock extends EventSourceMock<EventSourceSample.EventSample> {\n\n    }\n\n    private class EventSourceSample {\n\n        @Inject\n        private Event<EventSample> event;\n\n        public EventSourceSample(Event<EventSample> event) {\n            this.event = event;\n        }\n\n        public void fireEvent() {\n            event.fire(new EventSample());\n        }\n\n        private class EventSample {\n\n        }\n    }\n}"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/FileSystemTestingUtilsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport java.io.IOException;\nimport java.net.URI;\n\nimport org.junit.AfterClass;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.uberfire.io.IOService;\nimport org.uberfire.java.nio.file.Path;\n\nimport static org.junit.Assert.*;\n\npublic class FileSystemTestingUtilsTest {\n\n    private static FileSystemTestingUtils fileSystemTestingUtils = new FileSystemTestingUtils();\n\n    @BeforeClass\n    public static void setup() throws IOException {\n        fileSystemTestingUtils.setup();\n    }\n\n    @AfterClass\n    public static void cleanup() {\n        fileSystemTestingUtils.cleanup();\n    }\n\n    @Test\n    public void fsUtilsSanityCheck() throws IOException, InterruptedException {\n        IOService ioService = fileSystemTestingUtils.getIoService();\n        Path init = ioService.get(URI.create(\"git://amend-repo-test/init.file\"));\n        String expected = \"setupFS!\";\n        ioService.write(init,\n                        expected);\n        assertEquals(expected,\n                     ioService.readAllString(init));\n    }\n}"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/IocTestingUtilsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.mocks;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class IocTestingUtilsTest {\n\n    private SyncBeanManager iocManager;\n\n    @Test\n    public void mockIocManagerTest() {\n        iocManager = mock(SyncBeanManager.class);\n        IocTestingUtils.mockIocManager(iocManager);\n\n        assertNotNull(iocManager.lookupBean(Object.class).getInstance());\n        assertNotNull(iocManager.lookupBean(Object.class).newInstance());\n    }\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/mocks/ParametrizedCommandMockTest.java",
    "content": "package org.uberfire.mocks;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.uberfire.mocks.ParametrizedCommandMock.executeParametrizedCommandWith;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ParametrizedCommandMockTest {\n    \n    \n    private static final String TEST_STR = \"TEST\";\n    private static final String NOT_A_TEST_STR = \"NOT A TEST STR\";\n    \n    @Mock\n    UsesParametrizedCommand usesParametrizedCommand;\n    \n    @Before\n    public void setup() {\n        executeParametrizedCommandWith(0, new Foo(TEST_STR))\n            .when(usesParametrizedCommand)\n            .theKindOfMethodYouWantToMock(any(ParameterizedCommand.class));\n    }\n    \n    @Test\n    public void testParametrizedCommandMockTest() {\n        usesParametrizedCommand\n                .theKindOfMethodYouWantToMock(foo -> assertEquals(TEST_STR, foo.getStr()));\n    }\n    \n    public static class Foo {\n        private String str;\n\n        public Foo(String str) {\n            super();\n            this.str = str;\n        }\n        \n        public String getStr() {\n            return str;\n        }\n    }\n    \n    public static class UsesParametrizedCommand {\n\n        public void theKindOfMethodYouWantToMock(ParameterizedCommand<Foo> cmd) {\n            cmd.execute(new Foo(NOT_A_TEST_STR));\n        }\n    }\n\n}\n"
  },
  {
    "path": "uberfire-testing-utils/src/test/java/org/uberfire/promise/SyncPromisesTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.promise;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicInteger;\nimport java.util.function.Supplier;\n\nimport elemental2.promise.Promise;\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\nimport static org.uberfire.promise.SyncPromises.Status.REJECTED;\nimport static org.uberfire.promise.SyncPromises.Status.RESOLVED;\n\npublic class SyncPromisesTest {\n\n    private final SyncPromises promises = new SyncPromises();\n\n    @Test\n    public void testBasicChaining() {\n        final Promise<Integer> p = promises.resolve(\"a\").then(a -> {\n            assertTrue(\"a\".equals(a));\n            return promises.resolve(\"b\");\n        }).then(b -> {\n            assertTrue(\"b\".equals(b));\n            return promises.resolve(2);\n        }).catch_(err -> {\n            fail(\"Catch should've not been called\");\n            return promises.resolve(5);\n        }).then(two -> {\n            assertTrue(two == 2);\n            return promises.resolve(3);\n        });\n\n        final SyncPromises.SyncPromise<Integer> sp = (SyncPromises.SyncPromise<Integer>) p;\n        assertTrue(sp.value == 3);\n        assertTrue(sp.status == RESOLVED);\n    }\n\n    @Test\n    public void testErrorHandling() {\n        final Promise<Long> p = promises.resolve(\"a\").then(a -> {\n            assertTrue(\"a\".equals(a));\n            return promises.reject(\"b\");\n        }).then(b -> {\n            fail(\"This 'then' should've been jumped over\");\n            return promises.resolve(2);\n        }).catch_(err -> {\n            assertTrue(\"b\" == err);\n            return promises.resolve(5);\n        }).then(five -> {\n            assertTrue(five == 5);\n            return promises.reject(8L);\n        });\n\n        final SyncPromises.SyncPromise<Long> sp = (SyncPromises.SyncPromise<Long>) p;\n        assertTrue(sp.value == 8L);\n        assertTrue(sp.status == REJECTED);\n    }\n\n    @Test\n    public void testErrorHandlingDoubleRejection() {\n        final Promise<Integer> p = promises.resolve(\"a\").then(a -> {\n            assertTrue(\"a\".equals(a));\n            return promises.reject(\"b\");\n        }).catch_(err -> {\n            assertTrue(\"b\" == err);\n            return promises.reject('4');\n        }).catch_(four -> {\n            assertTrue(four.equals('4'));\n            return promises.resolve(12);\n        });\n\n        final SyncPromises.SyncPromise<Integer> sp = (SyncPromises.SyncPromise<Integer>) p;\n        assertTrue(sp.value == 12);\n        assertTrue(sp.status == RESOLVED);\n    }\n\n    @Test\n    public void testErrorHandlingWhenExceptionOccurs() {\n        final RuntimeException te = new RuntimeException(\"Test exception\");\n\n        final Promise<Integer> p = promises.resolve(\"a\").then(a -> {\n            throw te;\n        }).then(i -> {\n            fail(\"This 'then' should've been jumped over\");\n            return promises.resolve();\n        }).catch_(err -> {\n            assertEquals(err, te);\n            return promises.resolve(17);\n        });\n\n        final SyncPromises.SyncPromise<Integer> sp = (SyncPromises.SyncPromise<Integer>) p;\n        assertTrue(sp.value == 17);\n        assertTrue(sp.status == RESOLVED);\n    }\n\n    @Test\n    public void testAllWithOneRejection() {\n        final Promise<Integer> resolved1 = promises.resolve(1);\n        final Promise<Integer> resolved2 = promises.resolve(2);\n        final Promise<Integer> rejected = promises.reject(0);\n\n        Arrays.asList(\n                this.promises.all(rejected, resolved1, resolved2),\n                this.promises.all(resolved2, rejected, resolved1),\n                this.promises.all(resolved1, resolved2, rejected)).forEach(p -> {\n            p.then(i -> {\n                fail(\"Promise should've not been resolved!\");\n                return this.promises.resolve();\n            }).catch_(zero -> {\n                assertEquals(0, zero);\n                return this.promises.resolve();\n            });\n        });\n    }\n\n    @Test\n    public void testAllWithNoRejections() {\n        final Promise<Integer> resolved1 = promises.resolve(1);\n        final Promise<Integer> resolved2 = promises.resolve(2);\n        final Promise<Integer> resolved3 = promises.resolve(3);\n\n        promises.all(resolved1, resolved2, resolved3).then(i -> {\n            assertEquals((Integer) 3, i);\n            return promises.resolve();\n        }).catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void testAllMappingWithNoRejections() {\n        promises.all(Arrays.asList(1, 2, 3, 4), promises::resolve).then(i -> {\n            assertEquals((Integer) 4, i);\n            return promises.resolve();\n        }).catch_(e -> {\n            fail(\"Promise should've not been resolved!\");\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void testAllMappingWithOneRejection() {\n        promises.all(Arrays.asList(1, 2, 3, 4), i -> i == 3 ? promises.reject(i) : promises.resolve(i)).then(i -> {\n            fail(\"Promise should've not been resolved!\");\n            return promises.resolve();\n        }).catch_(e -> {\n            assertEquals(3, e);\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void testReduceLazilyWithNoRejections() {\n\n        final AtomicInteger sum = new AtomicInteger(0);\n\n        promises.reduceLazily(Arrays.asList(1, 2, 4, 8), i -> promises.resolve().then(e -> {\n            assertTrue(sum.get() < i);\n            sum.addAndGet(i);\n            return promises.resolve(i);\n        })).then(i -> {\n            assertEquals((Integer) 8, i);\n            return promises.resolve();\n        }).catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        }).then(ignore -> {\n            assertEquals((Integer) 15, (Integer) sum.get());\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void testReduceLazilyWithOneRejection() {\n\n        final AtomicInteger sum = new AtomicInteger(0);\n\n        promises.reduceLazily(Arrays.asList(1, 2, 4, 8), i -> i == 4 ? promises.reject(4) : promises.resolve().then(e -> {\n            assertTrue(sum.get() < i);\n            sum.addAndGet(i);\n            return promises.resolve(i);\n        })).then(i -> {\n            fail(\"Promise should've not been resolved!\");\n            return promises.resolve();\n        }).catch_(e -> {\n            assertEquals((Integer) 4, e);\n            return promises.resolve();\n        }).then(ignore -> {\n            assertEquals((Integer) 3, (Integer) sum.get());\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void testReduceLazilyChainingWithNoInterruptions() {\n\n        final AtomicInteger sum = new AtomicInteger(0);\n\n        promises.reduceLazilyChaining(Arrays.asList(1, 2, 4, 8, 16), (chain, i) -> {\n            assertTrue(sum.get() < i);\n            sum.addAndGet(i);\n            return promises.resolve(i);\n        }).catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        }).then(chainResult -> {\n            assertEquals((Integer) 16, chainResult);\n            assertEquals((Integer) 31, (Integer) sum.get());\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void testReduceLazilyChainingWithInterruption() {\n\n        final AtomicInteger sum = new AtomicInteger(0);\n\n        promises.reduceLazilyChaining(Arrays.asList(1, 2, 4, 8, 16), (chain, i) -> {\n            if (i == 4) {\n                // Skips the '4' step\n                return promises.reject(chain);\n            } else {\n                assertTrue(sum.get() < i);\n                sum.addAndGet(i);\n                return promises.resolve(i);\n            }\n        }).then(invalid -> {\n            fail(\"Promise should've not been resolved!\");\n            return promises.resolve();\n        }).catch_(chain -> {\n            assertEquals((Integer) 3, (Integer) sum.get());\n            return ((Supplier<Promise<Integer>>) chain).get();\n        }).then(chainResult -> {\n            assertNull(chainResult);\n            assertEquals((Integer) 27, (Integer) sum.get());\n            return promises.resolve();\n        }).catch_(e -> {\n            fail(\"Promise should've been resolved!\");\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void reduceWithOrIsTrueOperatorTest() {\n        final List<Promise<Boolean>> promisesToReduce = Arrays.asList(promises.resolve(true),\n                                                                      promises.resolve(false));\n        promises.reduce(promises.resolve(false), promisesToReduce, (p1, p2) -> p1.then(resultP1 -> p2.then(resultP2 -> this.promises.resolve(resultP1 || resultP2)))).then(resultIsTrue -> {\n            assertTrue(resultIsTrue);\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void reduceWithOrIsFalseOperatorTest() {\n        final List<Promise<Boolean>> promisesToReduce = Arrays.asList(promises.resolve(false),\n                                                                      promises.resolve(false));\n        promises.reduce(promises.resolve(false), promisesToReduce, (p1, p2) -> p1.then(resultP1 -> p2.then(resultP2 -> this.promises.resolve(resultP1 || resultP2)))).then(resultIsTrue -> {\n            assertFalse(resultIsTrue);\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void reduceWithAndIsTrueOperatorTest() {\n        final List<Promise<Boolean>> promisesToReduce = Arrays.asList(promises.resolve(true),\n                                                                      promises.resolve(true));\n        promises.reduce(promises.resolve(true), promisesToReduce, (p1, p2) -> p1.then(resultP1 -> p2.then(resultP2 -> this.promises.resolve(resultP1 && resultP2)))).then(resultIsTrue -> {\n            assertTrue(resultIsTrue);\n            return promises.resolve();\n        });\n    }\n\n    @Test\n    public void reduceWithAndIsFalseOperatorTest() {\n        final List<Promise<Boolean>> promisesToReduce = Arrays.asList(promises.resolve(false),\n                                                                      promises.resolve(true));\n        promises.reduce(promises.resolve(true), promisesToReduce, (p1, p2) -> p1.then(resultP1 -> p2.then(resultP2 -> this.promises.resolve(resultP1 && resultP2)))).then(resultIsTrue -> {\n            assertFalse(resultIsTrue);\n            return promises.resolve();\n        });\n    }\n}"
  },
  {
    "path": "uberfire-testing-utils/src/test/resources/META-INF/services/org.uberfire.java.nio.file.spi.FileSystemProvider",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.java.nio.fs.file.SimpleFileSystemProvider  # file system provider, also default (1st)\norg.uberfire.java.nio.fs.jgit.JGitFileSystemProvider\n"
  },
  {
    "path": "uberfire-workbench/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-workbench/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n    <relativePath>../pom.xml</relativePath>\n  </parent>\n\n  <artifactId>uberfire-workbench</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire Workbench</name>\n\n  <modules>\n    <module>uberfire-workbench-client</module>\n    <module>uberfire-workbench-client-backend</module>\n    <module>uberfire-workbench-client-views-patternfly</module>\n    <module>uberfire-workbench-processors</module>\n    <module>uberfire-workbench-processors-tests</module>\n  </modules>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workbench</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workbench-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Workbench Client</name>\n  <description>UberFire Workbench Client</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-promise</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.allen-sauer.gwt.dnd</groupId>\n      <artifactId>gwt-dnd</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/ActivityAction.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.uberfire.security.ResourceAction;\n\n/**\n * Base class for actions involving any workbench activity\n */\npublic interface ActivityAction extends ResourceAction {\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/ActivityCheck.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.impl.authz.ResourceCheckImpl;\n\n/**\n * A check executed over an {@link Activity} instance.\n */\npublic class ActivityCheck<C extends ActivityCheck> extends ResourceCheckImpl<C> {\n\n    public ActivityCheck(AuthorizationManager authorizationManager,\n                         Resource resource,\n                         User user) {\n        super(authorizationManager,\n              resource,\n              user);\n    }\n\n    public ActivityCheck(AuthorizationManager authorizationManager,\n                         ResourceType resourceType,\n                         User user) {\n        super(authorizationManager,\n              resourceType,\n              user);\n    }\n\n    public ActivityCheck read() {\n        return super.action(ActivityAction.READ);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/DefaultWorkbenchController.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PopupActivity;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.mvp.WorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n@ApplicationScoped\npublic class DefaultWorkbenchController implements WorkbenchController {\n\n    AuthorizationManager authorizationManager;\n    User user;\n    @Inject\n    public DefaultWorkbenchController(AuthorizationManager authorizationManager,\n                                      User user) {\n        this.authorizationManager = authorizationManager;\n        this.user = user;\n    }\n\n    public static DefaultWorkbenchController get() {\n        return IOC.getBeanManager().lookupBean(DefaultWorkbenchController.class).getInstance();\n    }\n\n    @Override\n    public PerspectiveCheck perspectives() {\n        return new PerspectiveCheck(authorizationManager,\n                                    ActivityResourceType.PERSPECTIVE,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck screens() {\n        return new ActivityCheck(authorizationManager,\n                                 ActivityResourceType.SCREEN,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck popupScreens() {\n        return new ActivityCheck(authorizationManager,\n                                 ActivityResourceType.POPUP,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck splashScreens() {\n        return new ActivityCheck(authorizationManager,\n                                 ActivityResourceType.SPLASH,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck editors() {\n        return new ActivityCheck(authorizationManager,\n                                 ActivityResourceType.EDITOR,\n                                 user);\n    }\n\n    @Override\n    public PerspectiveCheck perspective(PerspectiveActivity perspective) {\n        return new PerspectiveCheck(authorizationManager,\n                                    perspective,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck screen(WorkbenchScreenActivity screen) {\n        return new ActivityCheck(authorizationManager,\n                                 screen,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck popupScreen(PopupActivity popup) {\n        return new ActivityCheck(authorizationManager,\n                                 popup,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck editor(WorkbenchEditorActivity editor) {\n        return new ActivityCheck(authorizationManager,\n                                 editor,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck editor(WorkbenchClientEditorActivity editor) {\n        return new ActivityCheck(authorizationManager,\n                                 editor,\n                                 user);\n    }\n\n    @Override\n    public ActivityCheck splashScreen(SplashScreenActivity splash) {\n        return new ActivityCheck(authorizationManager,\n                                 splash,\n                                 user);\n    }\n\n    @Override\n    public PerspectiveCheck perspective(String perspectiveId) {\n        ResourceRef ref = new ResourceRef(perspectiveId,\n                                          ActivityResourceType.PERSPECTIVE);\n        return new PerspectiveCheck(authorizationManager,\n                                    ref,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck screen(String screenId) {\n        ResourceRef ref = new ResourceRef(screenId,\n                                          ActivityResourceType.SCREEN);\n        return new PerspectiveCheck(authorizationManager,\n                                    ref,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck popupScreen(String popupId) {\n        ResourceRef ref = new ResourceRef(popupId,\n                                          ActivityResourceType.POPUP);\n        return new PerspectiveCheck(authorizationManager,\n                                    ref,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck editor(String editorId) {\n        ResourceRef ref = new ResourceRef(editorId,\n                                          ActivityResourceType.EDITOR);\n        return new PerspectiveCheck(authorizationManager,\n                                    ref,\n                                    user);\n    }\n\n    @Override\n    public ActivityCheck splashScreen(String splashId) {\n        ResourceRef ref = new ResourceRef(splashId,\n                                          ActivityResourceType.SPLASH);\n        return new PerspectiveCheck(authorizationManager,\n                                    ref,\n                                    user);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/EditorTreeProvider.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.authz;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.resources.i18n.PermissionTreeI18n;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.uberfire.client.authz.PerspectiveAction.READ;\n\n@ApplicationScoped\npublic class EditorTreeProvider implements PermissionTreeProvider {\n\n    private ActivityBeansCache activityBeansCache;\n    private SyncBeanManager iocManager;\n    private PermissionManager permissionManager;\n    private PermissionTreeI18n i18n;\n    private String resourceName = null;\n    private String rootNodeName = null;\n    private int rootNodePosition = 0;\n    private Set<RegisteredEditor> registeredEditors = new HashSet<>();\n\n    public EditorTreeProvider() {\n        //CDI proxy\n    }\n\n    @Inject\n    public EditorTreeProvider(final ActivityBeansCache activityBeansCache,\n                              final SyncBeanManager iocManager,\n                              final PermissionManager permissionManager,\n                              final PermissionTreeI18n i18n) {\n        this.activityBeansCache = activityBeansCache;\n        this.iocManager = iocManager;\n        this.permissionManager = permissionManager;\n        this.i18n = i18n;\n        this.resourceName = i18n.editorResourceName();\n        this.rootNodeName = i18n.editorsNodeName();\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        final PermissionResourceNode rootNode = new PermissionResourceNode(resourceName,\n                                                                           this);\n        rootNode.setNodeName(rootNodeName);\n        rootNode.setPositionInTree(rootNodePosition);\n        rootNode.setNodeFullName(i18n.editorsNodeHelp());\n        rootNode.addPermission(newPermission(READ),\n                               i18n.editorRead());\n\n        return rootNode;\n    }\n\n    @Override\n    public void loadChildren(final PermissionNode parent,\n                             final LoadOptions options,\n                             final LoadCallback callback) {\n        if (parent.getNodeName().equals(rootNodeName)) {\n            callback.afterLoad(buildEditorNodes(options));\n        }\n    }\n\n    public int getRootNodePosition() {\n        return rootNodePosition;\n    }\n\n    public void setRootNodePosition(int rootNodePosition) {\n        this.rootNodePosition = rootNodePosition;\n    }\n\n    public void registerEditor(final String editorId,\n                               final String editorName) {\n        final SyncBeanDef<Activity> editorBeanDef = activityBeansCache.getActivity(editorId);\n        WorkbenchEditorActivity editor = null;\n        if (editorBeanDef != null) {\n            try {\n                editor = (WorkbenchEditorActivity) editorBeanDef.getInstance();\n\n                // We only need the Editor's Resource definition and not an Editor instance itself as\n                // this can interfere with Event handling across multiple instances at runtime. Therefore\n                // extract the required information before disposing of the Editor instance.\n                final String identifier = editor.getIdentifier();\n                final ResourceType resourceType = editor.getResourceType();\n                final Resource resource = new Resource() {\n                    @Override\n                    public String getIdentifier() {\n                        return identifier;\n                    }\n\n                    @Override\n                    public ResourceType getResourceType() {\n                        return resourceType;\n                    }\n                };\n                registeredEditors.add(new RegisteredEditor(editorId,\n                                                           editorName,\n                                                           resource));\n            } finally {\n                if (editor != null) {\n                    iocManager.destroyBean(editor);\n                }\n            }\n        }\n    }\n\n    private Permission newPermission(final ResourceAction action) {\n        return permissionManager.createPermission(ActivityResourceType.EDITOR,\n                                                  action,\n                                                  true);\n    }\n\n    private Permission newPermission(final Resource resource,\n                                     final ResourceAction action) {\n        return permissionManager.createPermission(resource,\n                                                  action,\n                                                  true);\n    }\n\n    private List<PermissionNode> buildEditorNodes(final LoadOptions options) {\n        final List<PermissionNode> nodes = new ArrayList<>();\n        registeredEditors.stream()\n                .filter(e -> match(e, options))\n                .forEach(e -> nodes.add(toEditorNode(e)));\n\n        final int max = options.getMaxNodes();\n        return max > 0 && max < nodes.size() ? nodes.subList(0,\n                                                             max) : nodes;\n    }\n\n    private PermissionNode toEditorNode(final RegisteredEditor editor) {\n        final PermissionLeafNode node = new PermissionLeafNode();\n        node.setNodeName(editor.editorName);\n\n        final Permission readPermission = newPermission(editor.resource,\n                                                        READ);\n        node.addPermission(readPermission,\n                           i18n.editorRead());\n\n        return node;\n    }\n\n    private boolean match(final RegisteredEditor editor,\n                          final LoadOptions options) {\n        final String identifier = editor.editorId;\n        final String namePattern = options.getNodeNamePattern();\n        final Collection<String> includedIds = options.getResourceIds();\n\n        if (includedIds != null && !includedIds.isEmpty()) {\n            if (includedIds.contains(identifier)) {\n                return true;\n            }\n        }\n        if (namePattern != null) {\n            final String editorName = editor.editorName;\n            if (editorName.toLowerCase().contains(namePattern.toLowerCase())) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private class RegisteredEditor {\n\n        private String editorId;\n        private String editorName;\n        private Resource resource;\n\n        public RegisteredEditor(final String editorId,\n                                final String editorName,\n                                final Resource resource) {\n            this.editorId = editorId;\n            this.editorName = editorName;\n            this.resource = resource;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/PerspectiveAction.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\n/**\n * Perspective related actions\n */\npublic interface PerspectiveAction extends ActivityAction {\n\n    PerspectiveAction CREATE = () -> \"create\";\n    PerspectiveAction UPDATE = () -> \"update\";\n    PerspectiveAction DELETE = () -> \"delete\";\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/PerspectiveCheck.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n/**\n * A check executed over an {@link PerspectiveActivity} instance.\n */\npublic class PerspectiveCheck extends ActivityCheck<PerspectiveCheck> {\n\n    public PerspectiveCheck(AuthorizationManager authorizationManager,\n                            Resource resource,\n                            User user) {\n        super(authorizationManager,\n              resource,\n              user);\n    }\n\n    public PerspectiveCheck(AuthorizationManager authorizationManager,\n                            ResourceType resourceType,\n                            User user) {\n        super(authorizationManager,\n              resourceType,\n              user);\n    }\n\n    public PerspectiveCheck update() {\n        return super.action(PerspectiveAction.UPDATE);\n    }\n\n    public PerspectiveCheck delete() {\n        return super.action(PerspectiveAction.DELETE);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/PerspectiveTreeProvider.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.resources.i18n.PermissionTreeI18n;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.LoadCallback;\nimport org.uberfire.security.client.authz.tree.LoadOptions;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTreeProvider;\nimport org.uberfire.security.client.authz.tree.impl.PermissionLeafNode;\nimport org.uberfire.security.client.authz.tree.impl.PermissionResourceNode;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.uberfire.client.authz.PerspectiveAction.CREATE;\nimport static org.uberfire.client.authz.PerspectiveAction.DELETE;\nimport static org.uberfire.client.authz.PerspectiveAction.READ;\nimport static org.uberfire.client.authz.PerspectiveAction.UPDATE;\n\n@ApplicationScoped\npublic class PerspectiveTreeProvider implements PermissionTreeProvider {\n\n    private ActivityBeansCache activityBeansCache;\n    private PermissionManager permissionManager;\n    private PermissionTreeI18n i18n;\n    private boolean active = true;\n    private String resourceName = null;\n    private String rootNodeName = null;\n    private int rootNodePosition = 0;\n    private Map<String, String> perspectiveNameMap = new HashMap<>();\n    private Set<String> perspectiveIdsExcluded = new HashSet<>();\n\n    public PerspectiveTreeProvider() {\n    }\n\n    @Inject\n    public PerspectiveTreeProvider(ActivityBeansCache activityBeansCache,\n                                   PermissionManager permissionManager,\n                                   PermissionTreeI18n i18n) {\n        this.activityBeansCache = activityBeansCache;\n        this.permissionManager = permissionManager;\n        this.i18n = i18n;\n        this.resourceName = i18n.perspectiveResourceName();\n        this.rootNodeName = i18n.perspectivesNodeName();\n    }\n\n    public boolean isActive() {\n        return active;\n    }\n\n    public void setActive(boolean active) {\n        this.active = active;\n    }\n\n    public String getResourceName() {\n        return resourceName;\n    }\n\n    public void setResourceName(String resourceName) {\n        this.resourceName = resourceName;\n    }\n\n    public String getRootNodeName() {\n        return rootNodeName;\n    }\n\n    public void setRootNodeName(String rootNodeName) {\n        this.rootNodeName = rootNodeName;\n    }\n\n    public int getRootNodePosition() {\n        return rootNodePosition;\n    }\n\n    public void setRootNodePosition(int rootNodePosition) {\n        this.rootNodePosition = rootNodePosition;\n    }\n\n    public void excludePerspectiveId(String perspectiveId) {\n        perspectiveIdsExcluded.add(perspectiveId);\n    }\n\n    public Set<String> getPerspectiveIdsExcluded() {\n        return perspectiveIdsExcluded;\n    }\n\n    @Override\n    public PermissionNode buildRootNode() {\n        PermissionResourceNode rootNode = new PermissionResourceNode(resourceName,\n                                                                     this);\n        rootNode.setNodeName(rootNodeName);\n        rootNode.setNodeFullName(i18n.perspectivesNodeHelp());\n        rootNode.setPositionInTree(rootNodePosition);\n\n        Permission readPermission = newPermission(READ);\n        Permission updatePermission = newPermission(UPDATE);\n        Permission deletePermission = newPermission(DELETE);\n        Permission createPermission = newPermission(CREATE);\n\n        rootNode.addPermission(readPermission,\n                               i18n.perspectiveRead());\n        rootNode.addPermission(updatePermission,\n                               i18n.perspectiveUpdate());\n        rootNode.addPermission(deletePermission,\n                               i18n.perspectiveDelete());\n        rootNode.addPermission(createPermission,\n                               i18n.perspectiveCreate());\n\n        rootNode.addDependencies(readPermission,\n                                 updatePermission,\n                                 deletePermission,\n                                 createPermission);\n\n        return rootNode;\n    }\n\n    @Override\n    public void loadChildren(PermissionNode parent,\n                             LoadOptions options,\n                             LoadCallback callback) {\n        if (parent.getNodeName().equals(rootNodeName)) {\n            callback.afterLoad(buildPerspectiveNodes(options));\n        }\n    }\n\n    private Permission newPermission(ResourceAction action) {\n        return permissionManager.createPermission(ActivityResourceType.PERSPECTIVE,\n                                                  action,\n                                                  true);\n    }\n\n    private Permission newPermission(Resource resource,\n                                     ResourceAction action) {\n        return permissionManager.createPermission(resource,\n                                                  action,\n                                                  true);\n    }\n\n    private List<PermissionNode> buildPerspectiveNodes(LoadOptions options) {\n\n        List<PermissionNode> nodes = new ArrayList<>();\n        for (SyncBeanDef<Activity> beanDef : activityBeansCache.getPerspectiveActivities()) {\n            PerspectiveActivity p = (PerspectiveActivity) beanDef.getInstance();\n            if (match(p, options)) {\n                nodes.add(toPerspectiveNode(p));\n            }\n        }\n\n        int max = options.getMaxNodes();\n        return max > 0 && max < nodes.size() ? nodes.subList(0,\n                                                             max) : nodes;\n    }\n\n    private PermissionNode toPerspectiveNode(PerspectiveActivity p) {\n        String id = p.getIdentifier();\n        String name = getPerspectiveName(id);\n\n        PermissionLeafNode node = new PermissionLeafNode();\n        node.setNodeName(name);\n\n        Permission readPermission = newPermission(p,\n                                                  READ);\n        node.addPermission(readPermission,\n                           i18n.perspectiveRead());\n\n        // Only runtime created perspectives can be modified\n        if (!(p instanceof AbstractWorkbenchPerspectiveActivity)) {\n            Permission updatePermission = newPermission(p,\n                                                        UPDATE);\n            Permission deletePermission = newPermission(p,\n                                                        DELETE);\n            node.addPermission(updatePermission,\n                               i18n.perspectiveUpdate());\n            node.addPermission(deletePermission,\n                               i18n.perspectiveDelete());\n            node.addDependencies(readPermission,\n                                 updatePermission,\n                                 deletePermission);\n        }\n        return node;\n    }\n\n    public String getPerspectiveName(String perspectiveId) {\n        // Look for preset names first\n        if (perspectiveNameMap.containsKey(perspectiveId)) {\n            return perspectiveNameMap.get(perspectiveId);\n        }\n        // For user created perspectives, the perspective id. is always the name set by its author\n        SyncBeanDef<Activity> beanDef = activityBeansCache.getActivity(perspectiveId);\n        if (beanDef != null) {\n            Activity activity = beanDef.getInstance();\n            if (activity != null && !(activity instanceof AbstractWorkbenchPerspectiveActivity)) {\n                return perspectiveId;\n            }\n        }\n        // By default, to avoid displaying FQCN, the name is the string after the last dot\n        int lastDot = perspectiveId.lastIndexOf(\".\");\n        return lastDot != -1 ? perspectiveId.substring(lastDot + 1) : perspectiveId;\n    }\n\n    public void setPerspectiveName(String perspectiveId,\n                                   String name) {\n        perspectiveNameMap.put(perspectiveId,\n                               name);\n    }\n\n    private boolean match(Resource r,\n                          LoadOptions options) {\n        String namePattern = options.getNodeNamePattern();\n        Collection<String> includedIds = options.getResourceIds();\n\n        if (perspectiveIdsExcluded.contains(r.getIdentifier())) {\n            return false;\n        }\n        if (includedIds != null && !includedIds.isEmpty()) {\n            if (includedIds.contains(r.getIdentifier())) {\n                return true;\n            }\n        }\n        if (namePattern != null) {\n            String perspectiveName = getPerspectiveName(r.getIdentifier());\n            if (perspectiveName.toLowerCase().contains(namePattern.toLowerCase())) {\n                return true;\n            }\n        }\n        return false;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/WorkbenchController.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PopupActivity;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.mvp.WorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\n\n/**\n * An interface for checking access to workbench resources (perspectives, screens, editors, ...)\n * using a fluent styled API.\n * <p>\n * <p>Example usage:</p>\n * <pre>\n * {@code Button deleteButton;\n *   WorkbenchController workbenchController;\n *   PerspectiveActivity perspective1;\n *\n *   workbenchController.perspective(perspective1).delete()\n *     .granted(() -> deleteButton.setEnabled(true))\n *     .denied(() -> deleteButton.setEnabled(false))\n * }</pre>\n */\npublic interface WorkbenchController {\n\n    /**\n     * Creates a brand new instance for checking global perspective actions.\n     */\n    PerspectiveCheck perspectives();\n\n    /**\n     * Creates a brand new instance for checking global screen actions.\n     */\n    ActivityCheck screens();\n\n    /**\n     * Creates a brand new instance for checking global popup screen actions.\n     * @return A handler for dealing with the perspective check API.\n     */\n    ActivityCheck popupScreens();\n\n    /**\n     * Creates a brand new instance for checking global splash screen actions.\n     * @return A handler for dealing with the perspective check API.\n     */\n    ActivityCheck splashScreens();\n\n    /**\n     * Creates a brand new instance for checking global perspective actions actions.\n     * @return A handler for dealing with the perspective check API.\n     */\n    ActivityCheck editors();\n\n    /**\n     * Creates a brand new instance for checking actions over {@link PerspectiveActivity} instances.\n     */\n    PerspectiveCheck perspective(PerspectiveActivity perspective);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link WorkbenchScreenActivity} instances.\n     */\n    ActivityCheck screen(WorkbenchScreenActivity screen);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link PopupActivity} instances.\n     */\n    ActivityCheck popupScreen(PopupActivity popup);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link WorkbenchEditorActivity} instances.\n     */\n    ActivityCheck editor(WorkbenchEditorActivity editor);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link WorkbenchClientEditorActivity} instances.\n     */\n    ActivityCheck editor(WorkbenchClientEditorActivity editor);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link SplashScreenActivity} instances.\n     */\n    ActivityCheck splashScreen(SplashScreenActivity splash);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link PerspectiveActivity} instances.\n     */\n    PerspectiveCheck perspective(String perspectiveId);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link WorkbenchScreenActivity} instances.\n     */\n    ActivityCheck screen(String screenId);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link PopupActivity} instances.\n     */\n    ActivityCheck popupScreen(String popupId);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link WorkbenchEditorActivity} instances.\n     */\n    ActivityCheck editor(String editorId);\n\n    /**\n     * Creates a brand new instance for checking actions over {@link SplashScreenActivity} instances.\n     */\n    ActivityCheck splashScreen(String splashId);\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/authz/WorkbenchControllerHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PopupActivity;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.mvp.WorkbenchScreenActivity;\n\n/**\n * A helper class providing static methods on top of the {@link WorkbenchController} functionality.\n * <p>\n * <p>Example usage:</p>\n * <pre>\n * {@code import static org.uberfire.client.authz.WorkbenchControllerHelper.*;\n *\n *   Button deleteButton;\n *   PerspectiveActivity perspective1;\n *\n *   perspective(perspective1).delete()\n *     .denied(() -> deleteButton.setVisible(false))\n * }</pre>\n */\npublic class WorkbenchControllerHelper {\n\n    /**\n     * See {@link WorkbenchController#perspective(PerspectiveActivity)}\n     */\n    public static PerspectiveCheck perspectives() {\n        return DefaultWorkbenchController.get().perspectives();\n    }\n\n    /**\n     * See {@link WorkbenchController#perspective(PerspectiveActivity)}\n     */\n    public static PerspectiveCheck perspective(PerspectiveActivity perspective) {\n        return DefaultWorkbenchController.get().perspective(perspective);\n    }\n\n    /**\n     * See {@link WorkbenchController#screens()}\n     */\n    public static ActivityCheck screens() {\n        return DefaultWorkbenchController.get().screens();\n    }\n\n    /**\n     * See {@link WorkbenchController#popupScreens()}\n     */\n    public static ActivityCheck popupScreens() {\n        return DefaultWorkbenchController.get().popupScreens();\n    }\n\n    /**\n     * See {@link WorkbenchController#splashScreens()}\n     */\n    public static ActivityCheck splashScreens() {\n        return DefaultWorkbenchController.get().splashScreens();\n    }\n\n    /**\n     * See {@link WorkbenchController#editors()}\n     */\n    public static ActivityCheck editors() {\n        return DefaultWorkbenchController.get().editors();\n    }\n\n    /**\n     * See {@link WorkbenchController#screen(WorkbenchScreenActivity)}\n     */\n    public static ActivityCheck screen(WorkbenchScreenActivity screen) {\n        return DefaultWorkbenchController.get().screen(screen);\n    }\n\n    /**\n     * See {@link WorkbenchController#popupScreen(PopupActivity)}\n     */\n    public static ActivityCheck popupScreen(PopupActivity popup) {\n        return DefaultWorkbenchController.get().popupScreen(popup);\n    }\n\n    /**\n     * See {@link WorkbenchController#editor(WorkbenchEditorActivity)}\n     */\n    public static ActivityCheck editor(WorkbenchEditorActivity editor) {\n        return DefaultWorkbenchController.get().editor(editor);\n    }\n\n    /**\n     * See {@link WorkbenchController#splashScreen(SplashScreenActivity)}\n     */\n    public static ActivityCheck splashScreen(SplashScreenActivity splash) {\n        return DefaultWorkbenchController.get().splashScreen(splash);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/menu/AuthFilterMenuVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.menu;\n\nimport java.util.List;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.ResourceActionRef;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n/**\n * Wraps a menu visitor, filtering out menu items that a given user is not allowed to access. The wrapped visitor only\n * sees the items that the user is allowed to see.\n */\npublic class AuthFilterMenuVisitor implements MenuVisitor {\n\n    private final AuthorizationManager authzManager;\n    private final User user;\n    private final MenuVisitor chainedVisitor;\n\n    /**\n     * Wraps the given menu visitor, only forwarding calls that represent menu items the given user is allowed to see.\n     *\n     * @param authzManager   The authorization manager that decides what is visible. Not null.\n     * @param user           The user who will see the menus being visited. Not null.\n     * @param chainedVisitor The menu visitor that receives calls for all authorized parts of the menu tree. Not null.\n     */\n    public AuthFilterMenuVisitor(AuthorizationManager authzManager,\n                                 User user,\n                                 MenuVisitor chainedVisitor) {\n        this.authzManager = checkNotNull(\"authzManager\",\n                                         authzManager);\n        this.user = checkNotNull(\"user\",\n                                 user);\n        this.chainedVisitor = checkNotNull(\"chainedVisitor\",\n                                           chainedVisitor);\n    }\n\n    @Override\n    public boolean visitEnter(Menus menus) {\n        return chainedVisitor.visitEnter(menus);\n    }\n\n    @Override\n    public void visitLeave(Menus menus) {\n        chainedVisitor.visitLeave(menus);\n    }\n\n    @Override\n    public boolean visitEnter(MenuGroup menuGroup) {\n        if (!authorize(menuGroup)) {\n            return false;\n        }\n        return chainedVisitor.visitEnter(menuGroup);\n    }\n\n    @Override\n    public void visitLeave(MenuGroup menuGroup) {\n        chainedVisitor.visitLeave(menuGroup);\n    }\n\n    @Override\n    public void visit(MenuItemPlain menuItemPlain) {\n        if (authorize(menuItemPlain)) {\n            chainedVisitor.visit(menuItemPlain);\n        }\n    }\n\n    @Override\n    public void visit(MenuItemCommand menuItemCommand) {\n        if (authorize(menuItemCommand)) {\n            chainedVisitor.visit(menuItemCommand);\n        }\n    }\n\n    @Override\n    public void visit(MenuCustom<?> menuCustom) {\n        if (authorize(menuCustom)) {\n            chainedVisitor.visit(menuCustom);\n        }\n    }\n\n    @Override\n    public void visit(MenuItemPerspective menuItemPerspective) {\n        if (authorize(menuItemPerspective)) {\n            chainedVisitor.visit(menuItemPerspective);\n        }\n    }\n\n    /**\n     * Check the user is allowed to access the given menu item.\n     * <p>\n     * <p>If the item has any references to resource actions {@link ResourceActionRef} or custom permissions\n     * then the access is granted provided all those references are also granted.</p>\n     */\n    public boolean authorize(MenuItem item) {\n        List<ResourceActionRef> actions = item.getResourceActions();\n        if (actions != null && !actions.isEmpty()) {\n            for (ResourceActionRef ref : ensureIterable(actions)) {\n                if (!authzManager.authorize(ref.getResource(),\n                                            ref.getAction(),\n                                            user)) {\n                    return false;\n                }\n            }\n        }\n        List<String> permissions = ensureIterable(item.getPermissions());\n        if (permissions != null && !permissions.isEmpty()) {\n            for (String p : permissions) {\n                if (!authzManager.authorize(p,\n                                            user)) {\n                    return false;\n                }\n            }\n        }\n        // Check the item\n        boolean itemResult = authzManager.authorize(item,\n                                                    user);\n        boolean denied = false;\n\n        // For menu groups ensure at least one child item can be accessed\n        if (item instanceof MenuGroup) {\n            MenuGroup group = (MenuGroup) item;\n            for (MenuItem child : ensureIterable(group.getItems())) {\n                if (authorize(child)) {\n                    return itemResult;\n                } else {\n                    denied = true;\n                }\n            }\n        }\n        return itemResult && !denied;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/menu/CustomSplashHelp.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.menu;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@ApplicationScoped\npublic class CustomSplashHelp implements MenuFactory.CustomMenuBuilder {\n\n    @Override\n    public void push(MenuFactory.CustomMenuBuilder element) {\n\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n\n            @Override\n            public IsWidget build() {\n                return IOC.getBeanManager().lookupBean(SplashScreenMenuPresenter.class).getInstance();\n            }\n\n            @Override\n            public MenuPosition getPosition() {\n                return MenuPosition.LEFT;\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/menu/SplashScreenMenuPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.menu;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.events.NewSplashScreenActiveEvent;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A drop-down style widget that contains an up-to-date list of the available splash screens. Each currently-displayed\n * part, plus the current perspective itself, may have a splash screen associated with it. Splash screens show up in\n * this widget's drop-down list even if they are not currently visible. The only requirement is that the part they are\n * associated with is currently in the workbench.\n * <p>\n * When the user clicks on one of the items in the drop down list, the corresponding splash screen will be displayed via\n * its {@link SplashScreenActivity#forceShow()} method.\n */\n@ApplicationScoped\npublic class SplashScreenMenuPresenter implements IsWidget {\n\n    private final PlaceManager placeManager;\n    private final View view;\n\n    // For proxying\n    protected SplashScreenMenuPresenter() {\n        this.placeManager = null;\n        this.view = null;\n    }\n\n    @Inject\n    public SplashScreenMenuPresenter(PlaceManager placeManager,\n                                     View view) {\n        this.placeManager = checkNotNull(\"placeManager\",\n                                         placeManager);\n        this.view = checkNotNull(\"view\",\n                                 view);\n        view.init(this);\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onNewSplashScreen(@Observes NewSplashScreenActiveEvent event) {\n        List<SplashScreenListEntry> splashScreens = new ArrayList<SplashScreenListEntry>();\n        for (final SplashScreenActivity activity : placeManager.getActiveSplashScreens()) {\n            splashScreens.add(new SplashScreenListEntry(activity.getTitle(),\n                                                        new Command() {\n                                                            @Override\n                                                            public void execute() {\n                                                                activity.forceShow();\n                                                            }\n                                                        }));\n        }\n        view.setSplashScreenList(splashScreens);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public interface View extends UberView<SplashScreenMenuPresenter> {\n\n        /**\n         * Replaces the current list of splash screens with the given list.\n         */\n        void setSplashScreenList(List<SplashScreenListEntry> splashScreens);\n    }\n\n    public static class SplashScreenListEntry {\n\n        private final String screenName;\n        private final Command showCommand;\n\n        public SplashScreenListEntry(String screenName,\n                                     Command showCommand) {\n            this.screenName = checkNotNull(\"screenName\",\n                                           screenName);\n            this.showCommand = checkNotNull(\"showCommand\",\n                                            showCommand);\n        }\n\n        public String getScreenName() {\n            return screenName;\n        }\n\n        public Command getShowCommand() {\n            return showCommand;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/menu/WorkbenchViewModeSwitcherMenuBuilder.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.menu;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n@Dependent\npublic class WorkbenchViewModeSwitcherMenuBuilder implements MenuFactory.CustomMenuBuilder {\n\n    @Override\n    public void push(MenuFactory.CustomMenuBuilder element) {\n\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n\n            @Override\n            public IsWidget build() {\n                return IOC.getBeanManager().lookupBean(WorkbenchViewModeSwitcherPresenter.class).getInstance();\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/menu/WorkbenchViewModeSwitcherPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.menu;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n@Dependent\npublic class WorkbenchViewModeSwitcherPresenter implements IsWidget {\n\n    private final WorkbenchMenuBar menubar;\n    private final View view;\n    private WorkbenchConstants constants = WorkbenchConstants.INSTANCE;\n    private Command collapseCommand;\n    private Command expandCommand;\n\n    @Inject\n    public WorkbenchViewModeSwitcherPresenter(final View view,\n                                              final WorkbenchMenuBar menubar) {\n        this.view = checkNotNull(\"view\",\n                                 view);\n        this.menubar = checkNotNull(\"menubar\",\n                                    menubar);\n        view.init(this);\n        view.setText(constants.switchToCompactView());\n        view.addClickHandler(new Command() {\n            @Override\n            public void execute() {\n                if (menubar.isExpanded()) {\n                    menubar.collapse();\n                    if (collapseCommand != null) {\n                        collapseCommand.execute();\n                    }\n                } else {\n                    menubar.expand();\n                    if (expandCommand != null) {\n                        expandCommand.execute();\n                    }\n                }\n            }\n        });\n        menubar.addCollapseHandler(new Command() {\n            @Override\n            public void execute() {\n                view.setText(constants.switchToDefaultView());\n            }\n        });\n        menubar.addExpandHandler(new Command() {\n            @Override\n            public void execute() {\n                view.setText(constants.switchToCompactView());\n            }\n        });\n    }\n\n    public void setCollapseHandler(final Command command) {\n        this.collapseCommand = command;\n    }\n\n    public void setExpandHandler(final Command command) {\n        this.expandCommand = command;\n    }\n\n    protected void onPerspectiveChange(@Observes final PerspectiveChange perspectiveChange) {\n        view.enable();\n    }\n\n    protected void onPlaceMinimized(@Observes final PlaceMinimizedEvent event) {\n        view.enable();\n    }\n\n    protected void onPlaceMaximized(@Observes final PlaceMaximizedEvent event) {\n        view.disable();\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view.asWidget();\n    }\n\n    public interface View extends UberView<WorkbenchViewModeSwitcherPresenter> {\n\n        void setText(String text);\n\n        void enable();\n\n        void disable();\n\n        void addClickHandler(Command command);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Implementation of behaviour common to all activity types.\n * <p>\n * AbstractActivity is not typically subclassed directly, even by generated code. See the more purpose-based subclasses.\n */\npublic abstract class AbstractActivity implements Activity {\n\n    protected PlaceManager placeManager;\n\n    protected PlaceRequest place;\n\n    protected boolean open = false;\n\n    public AbstractActivity(final PlaceManager placeManager) {\n        this.placeManager = placeManager;\n    }\n\n    /**\n     * Tracks start/shutdown lifecycle. Subclasses should always call <tt>super.onStartup()</tt> in methods that\n     * override this one.\n     */\n    @Override\n    public void onStartup(PlaceRequest place) {\n        this.place = checkNotNull(\"place\",\n                                  place);\n    }\n\n    /**\n     * Tracks open/closed lifecycle. Subclasses should always call <tt>super.onOpen()</tt> in methods that override this\n     * one.\n     */\n    @Override\n    public void onOpen() {\n        if (this.place == null) {\n            throw new IllegalStateException(\"Activity \" + this + \" has not been started\");\n        }\n        if (open) {\n            throw new IllegalStateException(\"Activity \" + this + \" already open\");\n        }\n        open = true;\n        placeManager.executeOnOpenCallbacks(this.place);\n    }\n\n    /**\n     * Tracks open/closed lifecycle. Subclasses should always call <tt>super.onClose()</tt> in methods that override\n     * this one.\n     */\n    @Override\n    public void onClose() {\n        if (this.place == null) {\n            throw new IllegalStateException(\"Activity \" + this + \" has not been started\");\n        }\n        if (!open) {\n            throw new IllegalStateException(\"Activity \" + this + \" not open\");\n        }\n        open = false;\n        placeManager.executeOnCloseCallbacks(this.place);\n    }\n\n    /**\n     * Tracks start/shutdown lifecycle. Subclasses should always call <tt>super.onShutdown()</tt> in methods that\n     * override this one.\n     */\n    @Override\n    public void onShutdown() {\n        if (this.place == null) {\n            throw new IllegalStateException(\"Activity \" + this + \" has not been started\");\n        }\n        if (open) {\n            throw new IllegalStateException(\"Activity \" + this + \" is open\");\n        }\n        this.place = null;\n    }\n\n    @Override\n    public PlaceRequest getPlace() {\n        return place;\n    }\n\n    @Override\n    public String toString() {\n        return getClass().getName() + (place == null ? \" (not started)\" : \" for \" + place);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractPopupActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * Implementation of behaviour common to all popup activities. Concrete implementations are typically not written by\n * hand; rather, they are generated from classes annotated with {@link WorkbenchPopup}.\n */\npublic abstract class AbstractPopupActivity extends AbstractActivity implements PopupActivity {\n\n    private final PopupView popup;\n\n    /**\n     * Interlock to prevent a call back into PlaceManager.closePlace() when this activity is already in the process of\n     * closing.\n     */\n    private boolean placeManagerIsClosingUs = false;\n\n    /**\n     * Interlock to prevent a call back into PopupView.hide() when the view is already in the process of hiding.\n     */\n    private boolean popupAlreadyHiding = false;\n\n    /**\n     * MVP constructor that allows caller to provide the PopupView instance.\n     */\n    protected AbstractPopupActivity(final PlaceManager placeManager,\n                                    final PopupView popupView) {\n        super(placeManager);\n        popup = popupView;\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.POPUP;\n    }\n\n    @Override\n    public abstract String getTitle();\n\n    @Override\n    public WorkbenchPopupSize getSize() {\n        return WorkbenchPopupSize.MEDIUM;\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public abstract IsWidget getWidget();\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n\n        popup.addCloseHandler(new CloseHandler<PopupView>() {\n            @Override\n            public void onClose(CloseEvent<PopupView> event) {\n                if (!placeManagerIsClosingUs) {\n                    try {\n                        popupAlreadyHiding = true;\n                        placeManager.closePlace(place);\n                    } finally {\n                        popupAlreadyHiding = false;\n                    }\n                }\n            }\n        });\n\n        final IsWidget widget = getWidget();\n\n        popup.setContent(widget);\n        popup.setSize(getSize());\n        popup.setTitle(getTitle());\n        popup.show();\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        if (!popupAlreadyHiding) {\n            try {\n                placeManagerIsClosingUs = true;\n                popup.hide();\n            } finally {\n                placeManagerIsClosingUs = false;\n            }\n        }\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractSplashScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n/**\n * Implementation of behaviour common to all splash screen activities. Concrete implementations are typically not written by\n * hand; rather, they are generated from classes annotated with {@link WorkbenchSplashScreen}.\n */\npublic abstract class AbstractSplashScreenActivity extends AbstractActivity implements SplashScreenActivity {\n\n    private final SplashView splash;\n    @Inject\n    private WorkbenchServicesProxy wbServices;\n    private Boolean showAgain;\n    private SplashScreenFilter splashFilter;\n\n    @Inject\n    public AbstractSplashScreenActivity(final PlaceManager placeManager,\n                                        final SplashView splash) {\n        super(placeManager);\n        this.splash = splash;\n    }\n\n    @PostConstruct\n    private void initialize() {\n        this.splashFilter = getFilter();\n        splash.addCloseHandler(new CloseHandler<SplashView>() {\n            @Override\n            public void onClose(final CloseEvent<SplashView> event) {\n                AbstractSplashScreenActivity.this.onClose();\n            }\n        });\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n    }\n\n    @Override\n    public void onStartup(PlaceRequest place) {\n        super.onStartup(place);\n        wbServices.loadSplashScreenFilter(getFilter().getName(),\n                                          new ParameterizedCommand<SplashScreenFilter>() {\n                                              @Override\n                                              public void execute(final SplashScreenFilter response) {\n                                                  if (response != null) {\n                                                      splashFilter = response;\n                                                  }\n                                                  if (splashFilter.displayNextTime()) {\n                                                      forceShow();\n                                                  }\n                                              }\n                                          });\n    }\n\n    @Override\n    public abstract String getTitle();\n\n    @Override\n    public abstract IsWidget getWidget();\n\n    @Override\n    public Integer getBodyHeight() {\n        return null;\n    }\n\n    @Override\n    public abstract SplashScreenFilter getFilter();\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public void closeIfOpen() {\n        if (splash.isAttached()) {\n            splash.hide();\n            onClose();\n        }\n    }\n\n    @Override\n    public void forceShow() {\n        final IsWidget widget = getWidget();\n\n        splash.setContent(widget,\n                          getBodyHeight());\n        splash.setTitle(getTitle());\n        splash.show();\n    }\n\n    @Override\n    public void onClose() {\n        saveState();\n        super.onClose();\n    }\n\n    @Override\n    public Boolean intercept(final PlaceRequest intercepted) {\n        if (splashFilter == null) {\n            return false;\n        }\n        for (final String interceptPoint : splashFilter.getInterceptionPoints()) {\n            if (intercepted.getIdentifier().equals(interceptPoint)) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    private void saveState() {\n        showAgain = splash.showAgain();\n        if (showAgain != null) {\n            splashFilter.setDisplayNextTime(showAgain);\n            wbServices.save(splashFilter);\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n/**\n * Implementation of behaviour common to all workbench editors and screens.\n * <p>\n * AbstractWorkbenchActivity is not typically subclassed directly, even by generated code. See the more purpose-based\n * subclasses.\n */\npublic abstract class AbstractWorkbenchActivity extends AbstractActivity implements WorkbenchActivity {\n\n    public AbstractWorkbenchActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public Position getDefaultPosition() {\n        return CompassPosition.ROOT;\n    }\n\n    /**\n     * This default implementation returns null, meaning this activity can be displayed in any perspective.\n     */\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return null;\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return true;\n    }\n\n    @Override\n    public abstract String getTitle();\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n\n    @Override\n    public abstract IsWidget getWidget();\n\n    @Override\n    public void onLostFocus() {\n        //Do nothing.\n    }\n\n    @Override\n    public void onFocus() {\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n    @Override\n    public String contextId() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchClientEditorActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\n\n/**\n * Implementation of behaviour common to all workbench editor activities. Concrete implementations are typically not\n * written by hand; rather, they are generated from classes annotated with {@link WorkbenchClientEditor}.\n */\npublic abstract class AbstractWorkbenchClientEditorActivity extends AbstractWorkbenchActivity implements WorkbenchClientEditorActivity {\n\n    public AbstractWorkbenchClientEditorActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchContextActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchContext;\nimport org.uberfire.workbench.model.PanelDefinition;\n\n/**\n * Implementation of behaviour common to all context activities. Concrete implementations are typically not written by\n * hand; rather, they are generated from classes annotated with {@link WorkbenchContext}.\n */\npublic abstract class AbstractWorkbenchContextActivity extends AbstractActivity implements ContextActivity {\n\n    protected PanelDefinition panel;\n\n    public AbstractWorkbenchContextActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public void onAttach(final PanelDefinition panel) {\n        this.panel = panel;\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchEditorActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport org.uberfire.client.mvp.LockTarget.TitleProvider;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.FRAMEWORK_PESSIMISTIC;\n\n/**\n * Implementation of behaviour common to all workbench editor activities. Concrete implementations are typically not\n * written by hand; rather, they are generated from classes annotated with {@link WorkbenchEditor}.\n */\npublic abstract class AbstractWorkbenchEditorActivity extends AbstractWorkbenchActivity implements WorkbenchEditorActivity {\n\n    @Inject\n    protected Instance<LockManager> lockManagerProvider;\n    protected LockManager lockManager;\n\n    protected ObservablePath path;\n\n    public AbstractWorkbenchEditorActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    /**\n     * Overrides the default implementation by redirecting calls that are {@link PathPlaceRequest} instances to\n     * {@link #onStartup(ObservablePath, PlaceRequest)}. Non-path place requests are handed up to the super impl.\n     */\n    @Override\n    public final void onStartup(final PlaceRequest place) {\n        final Path path = place.getPath();\n        if (path != null) {\n            if (path instanceof ObservablePath) {\n                onStartup((ObservablePath) path,\n                          place);\n            } else if (this.isDynamic()) {\n                onStartup(path,\n                          place);\n            }\n        } else {\n            super.onStartup(place);\n        }\n    }\n\n    void onStartup(final Path path,\n                   final PlaceRequest place) {\n\n        onStartup(new PathPlaceRequest(path).getPath(),\n                  place);\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place) {\n        super.onStartup(place);\n        this.path = path;\n\n        if (getLockingStrategy() == FRAMEWORK_PESSIMISTIC) {\n            setupDefaultPessimisticLockManager();\n        }\n    }\n\n    protected void setupDefaultPessimisticLockManager() {\n        if (lockManager == null) {\n\n            lockManager = lockManagerProvider.get();\n\n            final Runnable reloadRunnable = new Runnable() {\n                @Override\n                public void run() {\n                    onStartup(path,\n                              getPlace());\n                }\n            };\n            final TitleProvider titleProvider = new TitleProvider() {\n                @Override\n                public String getTitle() {\n                    AbstractWorkbenchEditorActivity activity = AbstractWorkbenchEditorActivity.this;\n                    return (activity.open) ? activity.getTitle() : \"\";\n                }\n            };\n\n            lockManager.init(new LockTarget(path,\n                                            getWidget(),\n                                            getPlace(),\n                                            titleProvider,\n                                            reloadRunnable));\n        }\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        if (assertFrameworkLockingStrategy()) {\n            lockManager.acquireLockOnDemand();\n        }\n    }\n\n    @Override\n    public void onSave() {\n        //Do nothing.\n    }\n\n    @Override\n    public boolean isDirty() {\n        return false;\n    }\n\n    @Override\n    public void onClose() {\n        if (assertFrameworkLockingStrategy()) {\n            lockManager.releaseLock();\n            lockManagerProvider.destroy(lockManager);\n        }\n        super.onClose();\n    }\n\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        if (path != null) {\n            if (assertFrameworkLockingStrategy()) {\n                lockManager.onFocus();\n            }\n        }\n    }\n\n    private boolean assertFrameworkLockingStrategy() {\n        return getLockingStrategy() == FRAMEWORK_PESSIMISTIC && lockManager != null;\n    }\n\n    /**\n     * Returns the locking strategy for this editor activity, defaulting to\n     * pessimistic. This method is overridden for generated activities returning\n     * the strategy configured at {@link WorkbenchEditor}.\n     */\n    protected LockingStrategy getLockingStrategy() {\n        return LockingStrategy.FRAMEWORK_PESSIMISTIC;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchPerspectiveActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.function.Consumer;\n\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n/**\n * Implementation of behaviour common to all perspective activities. Concrete implementations are typically not written by\n * hand; rather, they are generated from classes annotated with {@link WorkbenchPerspective}.\n */\npublic abstract class AbstractWorkbenchPerspectiveActivity extends AbstractActivity implements PerspectiveActivity {\n\n    public AbstractWorkbenchPerspectiveActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n\n    @Override\n    public abstract PerspectiveDefinition getDefaultPerspectiveLayout();\n\n    @Override\n    public boolean isDefault() {\n        return false;\n    }\n\n    @Override\n    public boolean isTransient() {\n        return true;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(null);\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AbstractWorkbenchScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * Implementation of behaviour common to all workbench screen activities. Concrete implementations are typically\n * generated from classes annotated with {@link WorkbenchScreen}, but it is permissible for applications to extend this\n * class directly instead of using the {@code @WorkbenchScreen} annotation.\n * <p>\n * When implementing a Screen by extending this class, you must follow three rules:\n * <ol>\n * <li>mark it as a {@code @Dependent} bean;\n * <li>specify its place ID via the {@code @Named} annotation;\n * <li>include an {@code @Inject} constructor that passes the {@code PlaceManager} up to\n * the super constructor.\n * </ol>\n */\npublic abstract class AbstractWorkbenchScreenActivity extends AbstractWorkbenchActivity implements WorkbenchScreenActivity {\n\n    /**\n     * Passes the given PlaceManager up to the superclass.\n     * <p>\n     * In order to make the {@code super()} call to this constructor, subclasses should declare their own constructor\n     * that takes a {@code PlaceManager} plus any other dependencies required by the screen, and annotate that\n     * constructor with {@code @Inject}.\n     * @param placeManager The PlaceManager in force for the current application. Must not be null.\n     */\n    public AbstractWorkbenchScreenActivity(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public ResourceType getResourceType() {\n        return ActivityResourceType.SCREEN;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/AcceptItem.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\npublic interface AcceptItem {\n\n    void add(final UIPart uiPart);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/Activity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.authz.RuntimeFeatureResource;\n\n/**\n * Common top-level interface for all Workbench Activity classes. No concrete class implements this interface directly;\n * see the subinterfaces for specific activity types that do get implemented.\n * <p>\n * Also, implementations of this interface and its subinterfaces are typically not written by hand; instead, they are\n * generated from classes annotated with {@link WorkbenchScreen}, {@link WorkbenchEditor}, {@link WorkbenchPopup}, and\n * others by an UberFire annotation processor.\n * <p>\n * Developers of UberFire applications will not typically come into direct contact with things that implement Activity\n * or its subinterfaces; instead, they will work with a {@link PlaceManager} to manipulate activities at arm's length.\n * <p>\n * If you do need to get your hands on a particular {@code Activity} instance, do so using an {@link ActivityManager}.\n * <p>\n * <h3>Activity Lifecycle</h3>\n * Activities have the following lifecycle, which is normally driven by an {@link ActivityManager}:\n * <ol>\n * <li>The activity starts off in the <i>uninitialized</i> state.\n * <li>{@link #onStartup(PlaceRequest)} is called with the the PlaceRequest that caused it to be created.\n * The activity is \"associated\" with this PlaceRequest until the onShutdown method is invoked. This puts the activity\n * in the <i>started</i> state.\n * <li>{@link #onOpen()} is called to notify the Activity that its view has been added to the UI, and its associated\n * place is considered \"open.\" This puts the activity in the <i>open</i> state.\n * <li>{@link #onClose()} is called to notify the Activity that its view has been removed from the UI, and its associated\n * place is considered \"closed.\" This puts the activity back in the <i>started</i> state.\n * <li>{@link #onShutdown()} is called to notify the Activity that it is no longer associated with the PlaceRequest.\n * This puts the activity back in the <i>uninitialized</i> state.\n * </ol>\n * <p>\n * An activity will never receive a call to {@link #onStartup(PlaceRequest)} when it is started or open, but it may be\n * restarted (perhaps with a different PlaceRequest) after a call to {@link #onShutdown()}.\n * <p>\n * An activity will never receive a call to {@link #onOpen()} when it is uninitialized or open, but it may be reopened after a call\n * to {@link #onClose()}.\n * @see PlaceManager\n * @see ActivityManager\n */\n@JsType\npublic interface Activity extends RuntimeFeatureResource {\n\n    /**\n     * Called by the framework to notify this activity that it is now associated with the given PlaceRequest.\n     * When this lifecycle method is invoked, the activity's widget has not yet been added to the GUI.\n     * @param place The place that resolved to this activity\n     */\n    @JsMethod(name = \"onStartupPlace\")\n    void onStartup(final PlaceRequest place);\n\n    /**\n     * Called by the framework to notify this activity that its Widget has been added to the live GUI.\n     */\n    void onOpen();\n\n    /**\n     * Called by the framework to notify this activity that its Widget has been removed from the live GUI.\n     */\n    void onClose();\n\n    /**\n     * Called by the framework to notify this activity that it is no longer associated with the PlaceRequest that was\n     * passed to {@link #onStartup(PlaceRequest)}.\n     */\n    void onShutdown();\n\n    /**\n     * Returns the PlaceRequest that this Activity is currently tied to.\n     * @return the PlaceRequest that this activity was started for, or null if this activity is not in the started\n     * state.\n     */\n    PlaceRequest getPlace();\n\n    /**\n     * Returns whether or not this activity should be executed by default (on startup).\n     * @return true, if this activity should be executed by default, otherwise false.\n     */\n    default boolean isDefault() {\n        return false;\n    }\n\n    /**\n     * Returns whether or not this activity is marked as dynamic (provided by external scripts).\n     * @return true if this activity is dynamic, otherwise false.\n     */\n    default boolean isDynamic() {\n        return false;\n    }\n\n    /**\n     * Returns the name of this activity, defaulting to {@link #getIdentifier()}.\n     * @return the activity's name\n     */\n    default String getName() {\n        return getIdentifier();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityAndMetaInfo.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.workbench.type.ClientResourceType;\n\npublic class ActivityAndMetaInfo {\n\n    private SyncBeanManager iocManager;\n    private final SyncBeanDef<Activity> activityBean;\n\n    private final int priority;\n    final List<String> resourceTypesNames;\n    ClientResourceType[] resourceTypes;\n\n    @SuppressWarnings(\"rawtypes\")\n    ActivityAndMetaInfo(final SyncBeanManager iocManager,\n                        final SyncBeanDef<Activity> activityBean,\n                        final int priority,\n                        final List<String> resourceTypesNames) {\n        this.iocManager = iocManager;\n        this.activityBean = activityBean;\n        this.priority = priority;\n        this.resourceTypesNames = resourceTypesNames;\n    }\n\n    public SyncBeanDef<Activity> getActivityBean() {\n        return activityBean;\n    }\n\n    public int getPriority() {\n        return priority;\n    }\n\n    public ClientResourceType[] getResourceTypes() {\n        if (resourceTypes == null) {\n            dynamicLookupResourceTypes();\n        }\n        return resourceTypes;\n    }\n\n    private void dynamicLookupResourceTypes() {\n        this.resourceTypes = new ClientResourceType[resourceTypesNames.size()];\n        for (int i = 0; i < resourceTypesNames.size(); i++) {\n            final String resourceTypeIdentifier = resourceTypesNames.get(i);\n            final Collection<SyncBeanDef> resourceTypeBeans = iocManager.lookupBeans(resourceTypeIdentifier);\n            if (resourceTypeBeans.isEmpty()) {\n                throw new RuntimeException(\"ClientResourceType \" + resourceTypeIdentifier + \" not found\");\n            }\n\n            this.resourceTypes[i] = (ClientResourceType) resourceTypeBeans.iterator().next().getInstance();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityBeansCache.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.stream.Stream;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.util.GWTEditorNativeRegister;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.events.NewPerspectiveEvent;\nimport org.uberfire.client.workbench.events.NewWorkbenchScreenEvent;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\n\n/**\n *\n */\n@ApplicationScoped\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class ActivityBeansCache {\n\n    /**\n     * All active activity beans mapped by their CDI bean name (names are mandatory for activity beans).\n     */\n    private final Map<String, SyncBeanDef<Activity>> activitiesById = new HashMap<String, SyncBeanDef<Activity>>();\n    /**\n     * All active Activities that have an {@link AssociatedResources} annotation and are not splash screens.\n     */\n\n    /**\n     * All active activities that are splash screens.\n     */\n    private final List<SplashScreenActivity> splashActivities = new ArrayList<SplashScreenActivity>();\n    private SyncBeanManager iocManager;\n    private Event<NewPerspectiveEvent> newPerspectiveEventEvent;\n    private Event<NewWorkbenchScreenEvent> newWorkbenchScreenEventEvent;\n    protected ResourceTypeManagerCache resourceTypeManagerCache;\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n    private GWTEditorNativeRegister gwtEditorNativeRegister;\n\n    public ActivityBeansCache() {\n    }\n\n    @Inject\n    public ActivityBeansCache(SyncBeanManager iocManager,\n                              Event<NewPerspectiveEvent> newPerspectiveEventEvent,\n                              Event<NewWorkbenchScreenEvent> newWorkbenchScreenEventEvent,\n                              ResourceTypeManagerCache resourceTypeManagerCache,\n                              ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager,\n                              GWTEditorNativeRegister gwtEditorNativeRegister) {\n        this.iocManager = iocManager;\n        this.newPerspectiveEventEvent = newPerspectiveEventEvent;\n        this.newWorkbenchScreenEventEvent = newWorkbenchScreenEventEvent;\n        this.resourceTypeManagerCache = resourceTypeManagerCache;\n        this.experimentalActivitiesAuthorizationManager = experimentalActivitiesAuthorizationManager;\n        this.gwtEditorNativeRegister = gwtEditorNativeRegister;\n    }\n\n    @PostConstruct\n    void init() {\n        registerGwtEditorProvider();\n\n        final Collection<SyncBeanDef<Activity>> availableActivities = getAvailableActivities();\n\n        for (final SyncBeanDef<Activity> activityBean : availableActivities) {\n\n            final String id = activityBean.getName();\n\n            validateUniqueness(id);\n\n            activitiesById.put(id, activityBean);\n\n            if (isSplashScreen(activityBean.getQualifiers())) {\n                splashActivities.add((SplashScreenActivity) activityBean.getInstance());\n            } else {\n                if (isClientEditor(activityBean.getQualifiers())) {\n                    registerGwtClientBean(id, activityBean);\n                }\n                final Pair<Integer, List<String>> metaInfo = generateActivityMetaInfo(activityBean);\n                if (metaInfo != null) {\n                    addResourceActivity(activityBean,\n                                        metaInfo);\n                }\n            }\n        }\n\n        this.resourceTypeManagerCache.sortResourceActivitiesByPriority();\n    }\n\n    private void put(final SyncBeanDef<Activity> activityBean,\n                     final String id) {\n\n        activitiesById.put(id,\n                           activityBean);\n    }\n\n    void registerGwtEditorProvider() {\n        gwtEditorNativeRegister.nativeRegisterGwtEditorProvider();\n    }\n\n    void registerGwtClientBean(final String id, final SyncBeanDef<Activity> activityBean) {\n        gwtEditorNativeRegister.nativeRegisterGwtClientBean(id, activityBean);\n    }\n\n    private void addResourceActivity(SyncBeanDef<Activity> activityBean,\n                                     Pair<Integer, List<String>> metaInfo) {\n        ActivityAndMetaInfo activityAndMetaInfo = new ActivityAndMetaInfo(iocManager,\n                                                                          activityBean,\n                                                                          metaInfo.getK1(),\n                                                                          metaInfo.getK2());\n        this.resourceTypeManagerCache.addResourceActivity(activityAndMetaInfo);\n    }\n\n    Collection<SyncBeanDef<Activity>> getAvailableActivities() {\n        Collection<SyncBeanDef<Activity>> activeBeans = new ArrayList<SyncBeanDef<Activity>>();\n        for (SyncBeanDef<Activity> bean : iocManager.lookupBeans(Activity.class)) {\n            if (bean.isActivated()) {\n                activeBeans.add(bean);\n            }\n        }\n        return activeBeans;\n    }\n\n    private boolean isSplashScreen(final Set<Annotation> qualifiers) {\n        for (final Annotation qualifier : qualifiers) {\n            if (qualifier instanceof IsSplashScreen) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private boolean isClientEditor(final Set<Annotation> qualifiers) {\n        for (final Annotation qualifier : qualifiers) {\n            if (qualifier instanceof IsClientEditor) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public void removeActivity(String id) {\n        activitiesById.remove(id);\n    }\n\n    /**\n     * Used for runtime plugins.\n     */\n    public void addNewScreenActivity(final SyncBeanDef<Activity> activityBean) {\n        final String id = activityBean.getName();\n\n        validateUniqueness(id);\n\n        activitiesById.put(id,\n                           activityBean);\n        newWorkbenchScreenEventEvent.fire(new NewWorkbenchScreenEvent(id));\n    }\n\n    private void validateUniqueness(final String id) {\n        if (activitiesById.keySet().contains(id)) {\n            throw new RuntimeException(\"Conflict detected: Activity already exists with id \" + id);\n        }\n    }\n\n    /**\n     * Used for runtime plugins.\n     */\n    public void addNewPerspectiveActivity(final SyncBeanDef<Activity> activityBean) {\n        final String id = activityBean.getName();\n\n        validateUniqueness(id);\n\n        activitiesById.put(id,\n                           activityBean);\n        newPerspectiveEventEvent.fire(new NewPerspectiveEvent(id));\n    }\n\n    /**\n     * Used for runtime plugins.\n     */\n    public void addNewEditorActivity(final SyncBeanDef<Activity> activityBean,\n                                     String priority,\n                                     String resourceTypeName) {\n        final String id = activityBean.getName();\n\n        validateUniqueness(id);\n\n        activitiesById.put(id,\n                           activityBean);\n\n        this.resourceTypeManagerCache.addResourceActivity(new ActivityAndMetaInfo(iocManager,\n                                                                                  activityBean,\n                                                                                  Integer.valueOf(priority),\n                                                                                  Arrays.asList(resourceTypeName)));\n        this.resourceTypeManagerCache.sortResourceActivitiesByPriority();\n    }\n\n    public void addNewEditorActivity(final SyncBeanDef<Activity> syncBeanDef,\n                                     final int priority,\n                                     final List<String> resourceTypes) {\n\n        validateUniqueness(syncBeanDef.getName());\n        put(syncBeanDef, syncBeanDef.getName());\n\n        ActivityAndMetaInfo metaInfo = new ActivityAndMetaInfo(iocManager, syncBeanDef, priority, resourceTypes);\n        this.resourceTypeManagerCache.addResourceActivity(metaInfo);\n        this.resourceTypeManagerCache.sortResourceActivitiesByPriority();\n    }\n\n    public void addNewSplashScreenActivity(final SyncBeanDef<Activity> activityBean) {\n        final String id = activityBean.getName();\n\n        validateUniqueness(id);\n\n        activitiesById.put(id,\n                           activityBean);\n        splashActivities.add((SplashScreenActivity) activityBean.getInstance());\n    }\n\n    public boolean hasActivity(String id) {\n        return activitiesById.containsKey(id);\n    }\n\n    /**\n     * Returns all active splash screen activities in this cache.\n     */\n    public List<SplashScreenActivity> getSplashScreens() {\n        return splashActivities;\n    }\n\n    /**\n     * Returns the activity with the given CDI bean name from this cache, or null if there is no such activity or the\n     * activity with the given name is not an activated bean.\n     * @param id the CDI name of the bean (see {@link Named}), or in the case of runtime plugins, the name the activity\n     * was registered under.\n     */\n    public SyncBeanDef<Activity> getActivity(final String id) {\n        if (id == null) {\n            return null;\n        }\n        return activitiesById.get(id);\n    }\n\n    /**\n     * Returns the activated activity with the highest priority that can handle the given file. Returns null if no\n     * activated activity can handle the path.\n     * @param path the file to find a path-based activity for (probably a {@link WorkbenchEditorActivity}, but this cache\n     * makes no guarantees).\n     */\n    public SyncBeanDef<Activity> getActivity(final Path path) {\n\n        Optional<ActivityAndMetaInfo> optional = resourceTypeManagerCache.getResourceActivities().stream()\n                .filter(activityAndMetaInfo -> activitySupportsPath(activityAndMetaInfo, path))\n                .findAny();\n\n        if (optional.isPresent()) {\n            return optional.get().getActivityBean();\n        }\n\n        throw new EditorResourceTypeNotFound();\n    }\n\n    private boolean activitySupportsPath(ActivityAndMetaInfo activity, Path path) {\n\n        // Check if the editor activity is experimental && enabled\n        if (experimentalActivitiesAuthorizationManager.authorizeActivityClass(activity.getActivityBean().getBeanClass())) {\n\n            // Check if the editor resources types support the given path\n            return Stream.of(activity.getResourceTypes())\n                    .anyMatch(clientResourceType -> clientResourceType.accept(path));\n        }\n\n        return false;\n    }\n\n    public List<SyncBeanDef<Activity>> getPerspectiveActivities() {\n        List<SyncBeanDef<Activity>> results = new ArrayList<>();\n        for (SyncBeanDef<Activity> beanDef : activitiesById.values()) {\n            if (beanDef.isAssignableTo(PerspectiveActivity.class)) {\n                results.add(beanDef);\n            }\n        }\n        return results;\n    }\n\n    Pair<Integer, List<String>> generateActivityMetaInfo(SyncBeanDef<Activity> activityBean) {\n        return ActivityMetaInfo.generate(activityBean);\n    }\n\n    public List<String> getActivitiesById() {\n        return new ArrayList<String>(activitiesById.keySet());\n    }\n\n    public void noOp() {\n        // intentionally left empty, can be called to activate this bean in a CDI context\n    }\n\n    public class EditorResourceTypeNotFound extends RuntimeException {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityBeansInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n@ApplicationScoped\npublic class ActivityBeansInfo {\n\n    private static Comparator<String> ALPHABETICAL_ORDER = (str1, str2) -> {\n        int res = String.CASE_INSENSITIVE_ORDER.compare(str1, str2);\n        return res == 0 ? str1.compareTo(str2) : res;\n    };\n\n    private SyncBeanManager beanManager;\n    private ActivityBeansCache activityBeansCache;\n\n    @Inject\n    public ActivityBeansInfo(SyncBeanManager beanManager, ActivityBeansCache activityBeansCache) {\n        this.beanManager = beanManager;\n        this.activityBeansCache = activityBeansCache;\n    }\n\n    public List<String> getAvailableWorkbenchScreensIds() {\n        return lookupBeansId(WorkbenchScreenActivity.class);\n    }\n\n    public List<String> getAvailablePerspectivesIds() {\n        return activityBeansCache.getPerspectiveActivities().stream()\n                .map(this::getId)\n                .sorted(ALPHABETICAL_ORDER)\n                .collect(Collectors.toList());\n    }\n\n    public List<String> getAvailableSplashScreensIds() {\n        return lookupBeansId(SplashScreenActivity.class);\n    }\n\n    public List<String> getAvailableWorkbenchEditorsIds() {\n        return lookupBeansId(WorkbenchEditorActivity.class);\n    }\n\n    public void addActivityBean(List<String> activityBeans,\n                                String newBean) {\n        activityBeans.add(newBean);\n        Collections.sort(activityBeans,\n                         ALPHABETICAL_ORDER);\n    }\n\n    private List<String> lookupBeansId(Class<?> activityClass) {\n        return lookupBeans(activityClass).stream()\n                .map(this::getId)\n                .sorted(ALPHABETICAL_ORDER)\n                .collect(Collectors.toList());\n    }\n\n    public Collection<? extends IOCBeanDef<?>> lookupBeans(final Class<?> activityClass) {\n        return getBeanManager().lookupBeans(activityClass);\n    }\n\n    public String getId(final IOCBeanDef<?> beanDef) {\n        for (final Annotation annotation : beanDef.getQualifiers()) {\n            if (isNamed(annotation)) {\n                return ((Named) annotation).value();\n            }\n        }\n        if (hasBeanName(beanDef)) {\n            return beanDef.getName();\n        }\n        return \"\";\n    }\n\n    boolean isNamed(Annotation annotation) {\n        return annotation instanceof Named;\n    }\n\n    public SyncBeanManager getBeanManager() {\n        return beanManager;\n    }\n\n    private boolean hasBeanName(IOCBeanDef<?> beanDef) {\n        return beanDef.getName() != null && !beanDef.getName().isEmpty();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleError.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * CDI event fired by the framework each time an Activity lifecycle method throws an exception. Observers of the event\n * can use its methods to get information about the lifecycle call that failed, and can also ask the framework to\n * suppress the default error message.\n */\npublic class ActivityLifecycleError implements UberFireEvent {\n\n    private final Activity failedActivity;\n    private final LifecyclePhase failedCall;\n    private final Throwable exception;\n    private boolean errorMessageSuppressed = false;\n\n    ActivityLifecycleError(Activity failedActivity,\n                           LifecyclePhase failedCall,\n                           Throwable exception) {\n        this.failedActivity = checkNotNull(\"failedActivity\",\n                                           failedActivity);\n        this.failedCall = checkNotNull(\"failedCall\",\n                                       failedCall);\n        this.exception = exception;\n    }\n\n    /**\n     * Returns the Activity instance that threw the exception.\n     *\n     * @return the Activity that failed a lifecycle call. Never null.\n     */\n    public Activity getFailedActivity() {\n        return failedActivity;\n    }\n\n    /**\n     * Tells which lifecycle phase failed.\n     *\n     * @return the lifecycle phase that failed to happen. Never null.\n     */\n    public LifecyclePhase getFailedCall() {\n        return failedCall;\n    }\n\n    /**\n     * Returns the exception thrown by the failed lifecycle method, if the failure was due to a thrown exception.\n     *\n     * @return the exception thrown by the failed lifecycle method. May be null.\n     */\n    public Throwable getException() {\n        return exception;\n    }\n\n    /**\n     * Tells the framework that it should not mention this failure in the workbench GUI. Once this method has been\n     * invoked, there is no way to flip it back. Any such mechanism would not be reliable, because observers are not\n     * called in a predictable order.\n     */\n    public void suppressErrorMessage() {\n        errorMessageSuppressed = true;\n    }\n\n    /**\n     * Tells whether a previous observer has requested that the standard error message in the GUI be suppressed. This is\n     * only truly useful to the originator of the event, who can examine the value after all observers have been\n     * notified. Application code should not rely on the return value of this method, because there is no guarantee what\n     * order observers are called in.\n     *\n     * @return true if any observer has invoked the {@link #suppressErrorMessage()} method on this event .\n     */\n    public boolean isErrorMessageSuppressed() {\n        return errorMessageSuppressed;\n    }\n\n    /**\n     * The different activity lifecycle calls that can fail.\n     */\n    public enum LifecyclePhase {\n        STARTUP,\n        OPEN,\n        CLOSE,\n        SHUTDOWN;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityLifecycleErrorHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.slf4j.Logger;\nimport org.uberfire.client.mvp.ActivityLifecycleError.LifecyclePhase;\nimport org.uberfire.client.workbench.widgets.notifications.NotificationManager;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.events.NotificationEvent.NotificationType;\n\nimport static org.uberfire.debug.Debug.shortName;\n\n@ApplicationScoped\npublic class ActivityLifecycleErrorHandler {\n\n    @Inject\n    private Logger logger;\n\n    @Inject\n    private Event<ActivityLifecycleError> lifecycleErrorEvent;\n\n    @Inject\n    private NotificationManager notificationManager;\n\n    /**\n     * Becomes true when the error handling procedure is happening; reverts back to false when error handling is\n     * complete. This is used to prevent multiple cascading failures when shutting down a broken activity.\n     */\n    private boolean errorHandlingInProgress;\n\n    /**\n     * Handles the failure of an activity's lifecycle method. This should only normally be called by the\n     * {@link ActivityManager} or {@link PlaceManager} implementation.\n     * @param failedActivity the activity instance that was in error. Not null.\n     * @param failedCall The lifecycle call that was in error. Not null.\n     * @param exception The exception thrown by the lifecycle method, if the error was caused by an exception. Can be null.\n     */\n    public void handle(Activity failedActivity,\n                       LifecyclePhase failedCall,\n                       Throwable exception) {\n\n        if (errorHandlingInProgress) {\n            return;\n        }\n\n        try {\n            errorHandlingInProgress = true;\n            ActivityLifecycleError event = new ActivityLifecycleError(failedActivity,\n                                                                      failedCall,\n                                                                      exception);\n\n            try {\n                lifecycleErrorEvent.fire(event);\n            } catch (Exception ex) {\n                logger.warn(\"A lifecycle error observer threw an exception\",\n                            ex);\n            }\n\n            if (!event.isErrorMessageSuppressed()) {\n                StringBuilder message = new StringBuilder();\n                message.append(shortName(failedActivity.getClass()) + \" failed in \").append(failedCall);\n                if (exception != null) {\n                    message.append(\": \").append(exception.toString());\n                }\n                notificationManager.addNotification(new NotificationEvent(message.toString(),\n                                                                          NotificationType.ERROR));\n            }\n        } finally {\n            errorHandlingInProgress = false;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n/**\n * A facility for obtaining references to specific {@link Activity} instances and for enumerating or discovering all\n * available activities of a certain type (screens, editors, popup dialogs, and so on). Also responsible for shutting\n * down and releasing Activity instances when they are no longer needed.\n * <p>\n * Note that you may never need to use an ActivityManager. While used extensively within the framework, UberFire\n * application code rarely comes into direct contact with activities, which are essentially autogenerated wrappers\n * around classes annotated with {@link WorkbenchScreen}, {@link WorkbenchEditor}, {@link WorkbenchPopup}, and friends.\n * Most Activity-related tasks can be accomplished at arm's length through a {@link PlaceManager}.\n * <p>\n * If you do need an instance of ActivityManager in your application, obtain it using {@code @Inject}.\n * @see PlaceManager\n * @see Activity\n */\npublic interface ActivityManager {\n\n    /**\n     * Obtains the set of activity instances which implement the given type, are {@link ActivatedBy active}, and that\n     * the current user {@link AuthorizationManager has permission to access}.\n     * @param abstractScreenActivityClass the type of activities to enumerate. Must not be null. Passing in {@code Activity.class} will yield\n     * all possible activity types.\n     * @return the set of available activities. Never null. Each object in the returned set must be freed by the caller\n     * via a call to {@link SyncBeanManager#destroyBean(Object)}.\n     * @deprecated this method returns Activity instances that have not had their onStartup() methods invoked, so they\n     * can not be displayed according to the normal Activity lifecycle. It is also up to the caller to free\n     * each of the returned Activity instances by calling {@link SyncBeanManager#destroyBean(Object)} on\n     * them. Consider using the Errai bean manager and UberFire AuthorizationManager directly instead of\n     * using this method. See UF-105 for details.\n     */\n    @Deprecated\n    <T extends Activity> Set<T> getActivities(final Class<T> abstractScreenActivityClass);\n\n    /**\n     * Returns the splash screen activity that should appear upon navigation to the given place, if such a splash screen\n     * exists. In case multiple splash screens would intercept the given place request, one of them is chosen at random.\n     * TODO (UF-93) : make this deterministic.\n     * @param placeRequest the place request to look up a splash screen for.\n     * @return a splash screen which should be displayed upon navigation to the given place, or null if no such\n     * activity exists.\n     */\n    SplashScreenActivity getSplashScreenInterceptor(PlaceRequest placeRequest);\n\n    /**\n     * Calls to {@link #getActivities(PlaceRequest)} with security checks enabled.\n     */\n    Set<Activity> getActivities(final PlaceRequest placeRequest);\n\n    /**\n     * Returns the set of activities that can handle the given PlaceRequest. The activities will be in the\n     * <i>started</i> state (see {@link Activity} for details on the activity lifecycle). If the PlaceRequest is for a\n     * certain place ID, this method will return a set with at most one activity in it. If the PlaceRequest is for a\n     * certain path, the returned set can contain any number of activities.\n     * @param placeRequest the PlaceRequest to resolve activities for. Although null is permitted for convenience, it always\n     * resolves to the empty set.\n     * @param secure flag indicating if calls to the {@link AuthorizationManager} service are required in order to\n     * determine which activities are available.\n     * @return an unmodifiable set of activities that can handle the given PlaceRequest. Never null, but can be empty.\n     * To prevent memory leaks, pass Activity in the returned set to {@link #destroyActivity(Activity)} when you\n     * are done with it.\n     */\n    Set<Activity> getActivities(final PlaceRequest placeRequest,\n                                final boolean secure);\n\n    /**\n     * Returns an active, accessible activity that can handle the given PlaceRequest. In case there are multiple\n     * activities that can handle the given place request, one of them is chosen at random. TODO (UF-92) : make this\n     * deterministic.\n     * @param placeRequest\n     * @return an activity that handles the given PlaceRequest, or null if no available activity can handle. <b>No\n     * actual type checking is performed! If you guess the type wrong, you will have an instance of the\n     * wrong type. The only truly \"safe\" type to guess is {@link Activity}.</b>.\n     */\n    boolean containsActivity(final PlaceRequest placeRequest);\n\n    /**\n     * Calls to as {@link #getActivity(PlaceRequest)} with security checks enabled.\n     */\n    Activity getActivity(final PlaceRequest placeRequest);\n\n    /**\n     * Finds an activity that can handle the given PlaceRequest, creating and starting a new one if necessary.\n     * @param placeRequest the place the resolved activity should handle\n     * @param secure flag indicating if calls to the {@link AuthorizationManager} service are required in order to\n     * determine if the resulting activity is available.\n     * @return an activity that can handle the request, or null if no known activity can handle it. If the return value\n     * is non-null, it will be an activity in the <i>started</i> or <i>open</i> state.\n     */\n    Activity getActivity(final PlaceRequest placeRequest,\n                         boolean secure);\n\n    /**\n     * Calls to as {@link #getActivity(Class, PlaceRequest)} with security checks enabled.\n     */\n    <T extends Activity> T getActivity(final Class<T> clazz,\n                                       final PlaceRequest placeRequest);\n\n    /**\n     * Works like {@link #getActivities(PlaceRequest, boolean)} but performs an unsafe cast to treat the return value as an\n     * instance of the given class. Only use this method if you are absolutely sure which activity type matches the\n     * request. If you are wrong, there will not be a ClassCastException as a result of this call. The safer approach is\n     * to use {@link #getActivities(PlaceRequest, boolean)} and cast its return value explicitly.\n     * @param clazz the type of activity that you expect to find.\n     * @param placeRequest the place the resolved activity should handle\n     * @param secure flag indicating if calls to the {@link AuthorizationManager} service are required in order to\n     * determine if the resulting activity is available.\n     * @return an activity that can handle the request, or null if no known activity can handle it. If the return value\n     * is non-null, it will be an activity in the <i>started</i> or <i>open</i> state.\n     */\n    <T extends Activity> T getActivity(final Class<T> clazz,\n                                       final PlaceRequest placeRequest,\n                                       final boolean secure);\n\n    /**\n     * Destroys the given Activity bean instance, making it eligible for garbage collection.\n     * @param activity the activity instance to destroy. <b>Warning: do not use with instances of SplashScreenActivity. These\n     * are ApplicationScoped and cannot be destroyed.</b>\n     * @throws IllegalArgumentException if {@code activity} is a SplashScreenActivity. TODO (UF-91) : fix this.\n     */\n    void destroyActivity(final Activity activity);\n\n    /**\n     * Returns true if the given Activity instance is currently in the <i>started</i> or <i>open</i> state and managed\n     * by this ActivityManager.\n     * @param activity the activity to check\n     * @return true if the activity is started; false if it is uninitialized.\n     */\n    boolean isStarted(final Activity activity);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.IdentityHashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.ActivityLifecycleError.LifecyclePhase;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ExternalPathPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static java.util.Collections.emptyList;\nimport static java.util.Collections.emptySet;\nimport static java.util.Collections.singleton;\nimport static java.util.Collections.singletonList;\n\n@ApplicationScoped\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class ActivityManagerImpl implements ActivityManager {\n\n    /**\n     * Activities in this set have had their {@link Activity#onStartup(PlaceRequest)} method called and have not been\n     * shut down yet. This set tracks objects by identity, so it is possible that it could have multiple activities of\n     * the same type within it (for example, multiple editors of the same type for different files.)\n     */\n    private final Map<Activity, PlaceRequest> startedActivities = new IdentityHashMap<Activity, PlaceRequest>();\n    private final Map<Object, Boolean> containsCache = new HashMap<Object, Boolean>();\n    @Inject\n    private SyncBeanManager iocManager;\n    @Inject\n    private AuthorizationManager authzManager;\n    @Inject\n    private ActivityBeansCache activityBeansCache;\n    @Inject\n    private User identity;\n    @Inject\n    private ActivityLifecycleErrorHandler lifecycleErrorHandler;\n    @Inject\n    private ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n\n    @Override\n    public <T extends Activity> Set<T> getActivities(final Class<T> clazz) {\n        // not calling onStartup. See UF-105.\n        return secure(iocManager.lookupBeans(clazz),\n                      true);\n    }\n\n    @Override\n    public SplashScreenActivity getSplashScreenInterceptor(final PlaceRequest placeRequest) {\n\n        SplashScreenActivity resultBean = null;\n        for (SplashScreenActivity splashScreen : activityBeansCache.getSplashScreens()) {\n            if (splashScreen.intercept(placeRequest)) {\n                if (splashScreen.isEnabled()) {\n                    resultBean = splashScreen;\n                    break;\n                }\n            }\n        }\n\n        return startIfNecessary(secure(resultBean),\n                                placeRequest);\n    }\n\n    @Override\n    public Set<Activity> getActivities(final PlaceRequest placeRequest) {\n        return getActivities(placeRequest,\n                             true);\n    }\n\n    @Override\n    public Set<Activity> getActivities(final PlaceRequest placeRequest,\n                                       boolean secure) {\n\n        final Collection<SyncBeanDef<Activity>> beans;\n        if (placeRequest instanceof PathPlaceRequest) {\n            beans = resolveByPath((PathPlaceRequest) placeRequest);\n        } else {\n            beans = resolveById(placeRequest.getIdentifier());\n        }\n\n        final Set<Activity> activities = startIfNecessary(secure(beans,\n                                                                 secure),\n                                                          placeRequest);\n\n        if (placeRequest instanceof PathPlaceRequest) {\n            resolvePathPlaceRequestIdentifier(placeRequest,\n                                              activities);\n        }\n\n        return activities;\n    }\n\n    private void resolvePathPlaceRequestIdentifier(PlaceRequest placeRequest,\n                                                   Set<Activity> activities) {\n        if (activities != null && !activities.isEmpty()) {\n            final Activity activity = activities.iterator().next();\n            placeRequest.setIdentifier(activity.getIdentifier());\n        }\n    }\n\n    @Override\n    public boolean containsActivity(final PlaceRequest placeRequest) {\n        if (containsCache.containsKey(placeRequest.getIdentifier())) {\n            return containsCache.get(placeRequest.getIdentifier());\n        }\n\n        Path path = null;\n        if (placeRequest instanceof PathPlaceRequest) {\n            path = ((PathPlaceRequest) placeRequest).getPath();\n            if (containsCache.containsKey(path)) {\n                return containsCache.get(path);\n            }\n        }\n\n        final Activity result = getActivity(placeRequest);\n        containsCache.put(placeRequest.getIdentifier(),\n                          result != null);\n        if (path != null) {\n            containsCache.put(path,\n                              result != null);\n        }\n\n        return result != null;\n    }\n\n    @Override\n    public Activity getActivity(final PlaceRequest placeRequest) {\n        return getActivity(Activity.class,\n                           placeRequest);\n    }\n\n    @Override\n    public Activity getActivity(PlaceRequest placeRequest,\n                                boolean secure) {\n        return getActivity(Activity.class,\n                           placeRequest,\n                           secure);\n    }\n\n    @Override\n    public <T extends Activity> T getActivity(final Class<T> clazz,\n                                              final PlaceRequest placeRequest) {\n        return getActivity(clazz,\n                           placeRequest,\n                           true);\n    }\n\n    @Override\n    public <T extends Activity> T getActivity(final Class<T> clazz,\n                                              final PlaceRequest placeRequest,\n                                              final boolean secure) {\n        final Set<Activity> activities = getActivities(placeRequest,\n                                                       secure);\n        if (activities.size() == 0) {\n            return null;\n        }\n\n        final Activity activity = activities.iterator().next();\n\n        return (T) activity;\n    }\n\n    @Override\n    public void destroyActivity(final Activity activity) {\n        if (startedActivities.remove(activity) != null) {\n            boolean isDependentScope = getBeanScope(activity) == Dependent.class;\n            try {\n                activity.onShutdown();\n            } catch (Exception ex) {\n                lifecycleErrorHandler.handle(activity,\n                                             LifecyclePhase.SHUTDOWN,\n                                             ex);\n            }\n            if (isDependentScope) {\n                iocManager.destroyBean(activity);\n            }\n        } else {\n            throw new IllegalStateException(\"Activity \" + activity + \" is not currently in the started state\");\n        }\n    }\n\n    @Override\n    public boolean isStarted(final Activity activity) {\n        return startedActivities.containsKey(activity);\n    }\n\n    /**\n     * Returns the scope of the given activity bean, first in the Errai bean manager and then falling back on checking\n     * with the activity cache (the only way to look up the BeanDef for a runtime plugin activity). Beans that are not\n     * started (or were started but have been shut down) will cause an NPE if the fallback to the activity beans cache\n     * happens.\n     * @param startedActivity an activity that is in the <i>started</i> or <i>open</i> state.\n     */\n    private Class<?> getBeanScope(Activity startedActivity) {\n\n        // splash screens are tracked separately from other activities\n        if (startedActivity instanceof SplashScreenActivity) {\n            // FIXME this is an assumption based on convention. should modify bean cache to keep bean defs for splash screens too.\n            return ApplicationScoped.class;\n        }\n\n        final IOCBeanDef<?> beanDef = activityBeansCache.getActivity(startedActivity.getPlace().getIdentifier());\n        if (beanDef == null) {\n            return Dependent.class;\n        }\n        return beanDef.getScope();\n    }\n\n    private <T extends Activity> Set<T> secure(final Collection<SyncBeanDef<T>> activityBeans,\n                                               final boolean protectedAccess) {\n        final Set<T> activities = new HashSet<T>(activityBeans.size());\n\n        for (final SyncBeanDef<T> activityBean : activityBeans) {\n            if (!activityBean.isActivated()) {\n                continue;\n            }\n            final T instance = activityBean.getInstance();\n            if (!protectedAccess || authzManager.authorize(instance, identity) && activitiesAuthorizationManager.authorizeActivity(instance)) {\n                activities.add(instance);\n            } else {\n                // Since user does not have permission, destroy bean to avoid memory leak\n                if (activityBean.getScope().equals(Dependent.class)) {\n                    iocManager.destroyBean(instance);\n                }\n            }\n        }\n\n        return activities;\n    }\n\n    private SplashScreenActivity secure(final SplashScreenActivity bean) {\n        if (bean == null) {\n            return null;\n        }\n\n        if (authzManager.authorize(bean,\n                                   identity)) {\n            return bean;\n        }\n\n        return null;\n    }\n\n    private <T extends Activity> T startIfNecessary(T activity,\n                                                    PlaceRequest place) {\n        if (activity == null) {\n            return null;\n        }\n        try {\n            if (!startedActivities.containsKey(activity)) {\n                startedActivities.put(activity,\n                                      place);\n                if (activity.isDynamic() && place instanceof PathPlaceRequest) {\n                    activity.onStartup(ExternalPathPlaceRequest.create((PathPlaceRequest) place));\n                } else {\n                    activity.onStartup(place);\n                }\n            }\n            return activity;\n        } catch (Exception ex) {\n            lifecycleErrorHandler.handle(activity,\n                                         LifecyclePhase.STARTUP,\n                                         ex);\n            destroyActivity(activity);\n            return null;\n        }\n    }\n\n    /**\n     * Starts the activities in the given set. If any are null or throw an exception from their <code>onStartup()</code>\n     * method, they will not appear in the returned set.\n     * @param activities\n     * @param place\n     * @return\n     */\n    private Set<Activity> startIfNecessary(Set<Activity> activities,\n                                           PlaceRequest place) {\n        Set<Activity> validatedActivities = new HashSet<Activity>();\n        for (Activity activity : activities) {\n            Activity validated = startIfNecessary(activity,\n                                                  place);\n            if (validated != null) {\n                validatedActivities.add(validated);\n            }\n        }\n        return validatedActivities;\n    }\n\n    /**\n     * Gets the bean definition of the activity associated with the given place IDENTIFIER, if one exists.\n     * @param identifier the place IDENTIFIER. Null is permitted, but always resolves to an empty collection.\n     * @return an unmodifiable collection with zero or one item, depending on if the resolution was successful.\n     */\n    private Collection<SyncBeanDef<Activity>> resolveById(final String identifier) {\n        if (identifier == null) {\n            return emptyList();\n        }\n\n        SyncBeanDef<Activity> beanDefActivity = activityBeansCache.getActivity(identifier);\n        if (beanDefActivity == null) {\n            return emptyList();\n        }\n        return singletonList(beanDefActivity);\n    }\n\n    private Set<SyncBeanDef<Activity>> resolveByPath(final PathPlaceRequest place) {\n        if (place == null) {\n            return emptySet();\n        }\n        final SyncBeanDef<Activity> result = activityBeansCache.getActivity(place.getIdentifier());\n\n        if (result != null) {\n            return singleton(result);\n        }\n\n        return asSet(activityBeansCache.getActivity(place.getPath()));\n    }\n\n    private Set<SyncBeanDef<Activity>> asSet(final SyncBeanDef<Activity> activity) {\n        if (activity == null) {\n            return emptySet();\n        }\n\n        return singleton(activity);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ActivityMetaInfo.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.container.DynamicAnnotation;\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.commons.data.Pair;\n\npublic class ActivityMetaInfo {\n\n    static Pair<Integer, List<String>> generate(final IOCBeanDef<?> beanDefinition) {\n\n        AssociatedResources associatedResources = null;\n        DynamicAnnotation dynAssociatedResources = null;\n\n        Priority priority = null;\n        DynamicAnnotation dynPriority = null;\n\n        final Set<Annotation> annotations = beanDefinition.getQualifiers();\n        final boolean dynamic = beanDefinition.isDynamic();\n\n        for (Annotation a : annotations) {\n            final DynamicAnnotation da = (dynamic) ? (DynamicAnnotation) a : null;\n            if (a instanceof AssociatedResources) {\n                associatedResources = (AssociatedResources) a;\n            } else if (da != null && AssociatedResources.class.getName().equals(da.getName())) {\n                dynAssociatedResources = da;\n            } else if (a instanceof Priority) {\n                priority = (Priority) a;\n            } else if (da != null && Priority.class.getName().equals(da.getName())) {\n                dynPriority = da;\n            }\n        }\n\n        if (associatedResources == null && dynAssociatedResources == null) {\n            return null;\n        }\n\n        final int priorityValue;\n        if (priority == null && dynPriority == null) {\n            priorityValue = 0;\n        } else {\n            if (dynamic) {\n                priorityValue = Integer.valueOf(dynPriority.getMember(\"value\"));\n            } else {\n                priorityValue = priority.value();\n            }\n        }\n\n        final List<String> types = new ArrayList<String>();\n        if (dynamic) {\n            String resourceTypes = dynAssociatedResources.getMember(\"value\");\n            resourceTypes = resourceTypes.substring(1,\n                                                    resourceTypes.length() - 1);\n            types.addAll(Arrays.asList(resourceTypes.split(\",\")));\n        } else {\n            for (Class<? extends ClientResourceType> type : associatedResources.value()) {\n                types.add(type.getName());\n            }\n        }\n\n        return Pair.newPair(priorityValue,\n                            types);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/BookmarkableUrlHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Map;\nimport java.util.Optional;\nimport java.util.Set;\nimport java.util.stream.Collectors;\n\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n/**\n * A bookmarkable URL has the following form:\n * <p>\n * http://url/index.html#FWidgets|$PagedTableScreen[WSimpleDockScreen,],~WiresPropertiesScreen$PagedTableScreen\n * <p>\n * between the '#' and '|' there is the perspective name\n * between the '|' and '$' there is the CSV list of the screens opened when loading the perspective\n * between the '[' and ']'there is the CSV list of the docked Screens\n * after the '$' there is the CSV list of the screens not belonging to the current perspective\n * <p>\n * '~' denotes a closed screen\n * <p>\n * In this unit we have the basic methods used to compose such URLs\n */\npublic class BookmarkableUrlHelper {\n\n    public final static String PERSPECTIVE_SEP = \"|\";\n    public final static String DOCK_BEGIN_SEP = \"[\";\n    public final static String DOCK_CLOSE_SEP = \"]\";\n    public final static String SEPARATOR = \",\";\n    public final static String OTHER_SCREEN_SEP = \"$\";\n    public final static String CLOSED_PREFIX = \"~\";\n    public final static String CLOSED_DOCK_PREFIX = \"!\";\n    public final static int MAX_NAV_URL_SIZE = 1900;\n\n    private static boolean isNotBlank(final String str) {\n        return (str != null\n                && str.trim().length() > 0);\n    }\n\n    private static boolean isNotBlank(final PlaceRequest place) {\n        return (null != place && isNotBlank(place.getFullIdentifier()));\n    }\n\n    /**\n     * Add a screen to the bookmarkable URL. If the screen belongs to the currently opened\n     * perspective we add it to the list between the '|' and '$', otherwise we add it\n     * after the '$'.\n     * <p>\n     * We add the '|' or the '$' when needed\n     * @param bookmarkableUrl\n     * @param placeRequest\n     * @return\n     */\n    public static String registerOpenedScreen(String bookmarkableUrl,\n                                              final PlaceRequest placeRequest) {\n        final String screenName = placeRequest.getFullIdentifier();\n        final String closedScreen = CLOSED_PREFIX.concat(screenName);\n        final String currentBookmarkableUrl = bookmarkableUrl;\n\n        if (screenWasClosed(bookmarkableUrl,\n                            closedScreen)) {\n            bookmarkableUrl = bookmarkableUrl.replace(closedScreen,\n                                                      screenName);\n        } else if (!isPerspectiveInUrl(bookmarkableUrl)) {\n            // must add the screen in the group of the current perspective (which is not yet loaded)\n            if (isNotBlank(bookmarkableUrl)) {\n                bookmarkableUrl = bookmarkableUrl.concat(SEPARATOR).concat(screenName);\n            } else {\n                bookmarkableUrl = screenName;\n            }\n        } else {\n            // this is a screen outside the current perspective\n            if (!urlContainsExtraPerspectiveScreen(bookmarkableUrl)) {\n                bookmarkableUrl = bookmarkableUrl.concat(OTHER_SCREEN_SEP).concat(screenName);\n            } else {\n                bookmarkableUrl = bookmarkableUrl.concat(SEPARATOR).concat(screenName);\n            }\n        }\n        if (isBiggerThenMaxURLSize(bookmarkableUrl)) {\n            return currentBookmarkableUrl;\n        }\n        return bookmarkableUrl;\n    }\n\n    private static boolean screenWasClosed(String bookmarkableUrl,\n                                           String closedScreen) {\n        return bookmarkableUrl.indexOf(closedScreen) != -1;\n    }\n\n    private static boolean isBiggerThenMaxURLSize(String bookmarkableUrl) {\n        return isNotBlank(bookmarkableUrl) &&\n                bookmarkableUrl.length() >= MAX_NAV_URL_SIZE;\n    }\n\n    /**\n     * Update the bookmarkable URL, marking a screen or editor closed. Basically if the screen belongs\n     * to the currently opened perspective the we prefix the screen with a '~'; if the\n     * screen doesn't belong to the current perspective, that is, after the '$', the it\n     * is simply removed.\n     * <p>\n     * We remove the '$' when needed\n     * @param screenName\n     */\n    public static String registerClose(String bookmarkableUrl,\n                                       final String screenName) {\n        final boolean isPerspective = isPerspectiveScreen(bookmarkableUrl,\n                                                          screenName);\n        final String separator = isPerspective ? PERSPECTIVE_SEP : OTHER_SCREEN_SEP;\n        final String closedScreen = CLOSED_PREFIX.concat(screenName);\n        final String uniqueScreenAfterDelimiter =\n                separator.concat(screenName); // |screen or $screen\n        final String firstScreenAfterDelimiter =\n                uniqueScreenAfterDelimiter.concat(SEPARATOR); // |screen, or $screen,\n        final String commaSeparatedScreen =\n                screenName.concat(SEPARATOR); // screen,\n\n        if (isScreenClosed(bookmarkableUrl,\n                           closedScreen)) {\n            return bookmarkableUrl;\n        }\n        if (isPerspective) {\n            bookmarkableUrl = bookmarkableUrl.replace(screenName,\n                                                      closedScreen);\n        } else {\n            if (bookmarkableUrl.contains(firstScreenAfterDelimiter)) {\n                bookmarkableUrl = bookmarkableUrl.replace(firstScreenAfterDelimiter,\n                                                          separator);\n            } else if (bookmarkableUrl.contains(uniqueScreenAfterDelimiter)) {\n                bookmarkableUrl = bookmarkableUrl.replace(uniqueScreenAfterDelimiter,\n                                                          \"\");\n            } else if (bookmarkableUrl.contains(commaSeparatedScreen)) {\n                bookmarkableUrl = bookmarkableUrl.replace(commaSeparatedScreen,\n                                                          \"\");\n            }\n        }\n        return bookmarkableUrl;\n    }\n\n    /**\n     * Given a bookmarkable URL this methods returns a PlaceRequest\n     * with the perspective\n     * @param place\\\n     * @return\n     */\n    public static PlaceRequest getPerspectiveFromPlace(PlaceRequest place) {\n        String url = place.getFullIdentifier();\n\n        if (isPerspectiveInUrl(url)) {\n            String perspectiveName = url.substring(0,\n                                                   url.indexOf(PERSPECTIVE_SEP));\n            PlaceRequest copy = place.clone();\n            copy.setIdentifier(perspectiveName);\n            if (!place.getParameters().isEmpty()) {\n                for (Map.Entry<String, String> elem : place.getParameters().entrySet()) {\n                    copy.addParameter(elem.getKey(),\n                                      elem.getValue());\n                }\n            }\n            return copy;\n        }\n        return place;\n    }\n\n    /**\n     * Check whether the screen belongs to the currently opened perspective\n     * @param screen\n     * @return\n     */\n    public static boolean isPerspectiveScreen(final String bookmarkableUrl,\n                                              final String screen) {\n        return (isNotBlank(screen)\n                && isNotBlank(bookmarkableUrl)\n                && (!urlContainsExtraPerspectiveScreen(bookmarkableUrl)\n                || (bookmarkableUrl.indexOf(OTHER_SCREEN_SEP) > bookmarkableUrl.indexOf(screen))));\n    }\n\n    /**\n     * Returns true if the perspective is present in the URL\n     * @return\n     */\n    public static boolean isPerspectiveInUrl(final String url) {\n        return (isNotBlank(url) && (url.indexOf(PERSPECTIVE_SEP) > 0));\n    }\n\n    /**\n     * Check if the URL contains screens not belonging to the current perspective\n     * @return\n     */\n    public static boolean urlContainsExtraPerspectiveScreen(final String bookmarkableUrl) {\n        return (bookmarkableUrl.indexOf(OTHER_SCREEN_SEP) != -1);\n    }\n\n    /**\n     * Given a screen name, this method extracts the corresponding token in the\n     * URL, that is the screen name with optional parameters and markers\n     * @param screen\n     * @return\n     */\n    public static String getUrlToken(final String bookmarkableUrl,\n                                     final String screen) {\n        int st = isPerspectiveInUrl(bookmarkableUrl) ? (bookmarkableUrl.indexOf(PERSPECTIVE_SEP) + 1) : 0;\n        String screensList = bookmarkableUrl.replace(OTHER_SCREEN_SEP,\n                                                     SEPARATOR)\n                .substring(st,\n                           bookmarkableUrl.length());\n\n        String tokens[] = screensList.split(SEPARATOR);\n        Optional<String> token = Arrays.asList(tokens).stream()\n                .filter(s -> s.contains(screen))\n                .findFirst();\n\n        return token.orElse(screen);\n    }\n\n    /**\n     * Return the docked screens in the URL\n     * @param url\n     * @return\n     */\n    public static Set<String> getDockedScreensFromUrl(final String url) {\n        int start;\n        int end;\n        String docks;\n\n        if (!isNotBlank(url)) {\n            return new HashSet<>();\n        }\n        start = url.indexOf(DOCK_BEGIN_SEP) + 1;\n        end = url.indexOf(DOCK_CLOSE_SEP) - 1;\n\n        if (start > 0) {\n            docks = url.substring(start,\n                                  end);\n            String[] token = docks.split(SEPARATOR);\n            return new HashSet<>(Arrays.asList(token));\n        }\n        return new HashSet<>();\n    }\n\n    /**\n     * Return all the docked screens\n     * @param place\n     * @return\n     * @note non-docked screens are not taken into consideration\n     */\n    public static Set<String> getDockedScreensFromPlace(final PlaceRequest place) {\n        if (null != place) {\n            return getDockedScreensFromUrl(place.getFullIdentifier());\n        }\n        return new HashSet<>();\n    }\n\n    /**\n     * Return all the screens (opened or closed) that is, everything\n     * after the perspective declaration\n     * @param place\n     * @return\n     * @note docked screens are not taken into consideration\n     */\n    public static Set<String> getScreensFromPlace(final PlaceRequest place) {\n        String url;\n        int start;\n        int end;\n        String docks;\n\n        if (!isNotBlank(place)) {\n            return new HashSet<>();\n        }\n        // get everything after the perspective\n        if (isPerspectiveInUrl(place.getFullIdentifier())) {\n            String request = place.getFullIdentifier();\n\n            url = request.substring(request.indexOf(PERSPECTIVE_SEP) + 1);\n        } else {\n            url = place.getFullIdentifier();\n        }\n\n        start = url.indexOf(DOCK_BEGIN_SEP);\n        end = url.indexOf(DOCK_CLOSE_SEP) + 1;\n        if (start > 0) {\n            docks = url.substring(start,\n                                  end);\n            url = url.replace(docks,\n                              \"\");\n        }\n        // replace the '$' with a comma ','\n        url = url.replace(OTHER_SCREEN_SEP,\n                          SEPARATOR);\n        String[] token = url.split(SEPARATOR);\n        return new HashSet<>(Arrays.asList(token));\n    }\n\n    /**\n     * Get the opened screens in the given place request\n     * @param place\n     * @return\n     */\n    public static Set<String> getClosedScreenFromPlace(final PlaceRequest place) {\n        Set<String> screens = getScreensFromPlace(place);\n        Set<String> result = screens.stream()\n                .filter(s -> s.startsWith(CLOSED_PREFIX))\n                .collect(Collectors.toSet());\n        return result;\n    }\n\n    /**\n     * Get the opened screens in the given place request\n     * @param place\n     * @return\n     */\n    public static Set<String> getOpenedScreenFromPlace(final PlaceRequest place) {\n        Set<String> screens = getScreensFromPlace(place);\n        Set<String> result = screens.stream()\n                .filter(s -> !s.startsWith(CLOSED_PREFIX))\n                .collect(Collectors.toSet());\n        return result;\n    }\n\n    /**\n     * Return true if the given screen is already closed.\n     * @param screen\n     * @return\n     * @note docked screens are ignored\n     */\n    public static boolean isScreenClosed(final String bookmarkableUrl,\n                                         String screen) {\n        if (!screen.startsWith(CLOSED_PREFIX)) {\n            screen = CLOSED_PREFIX.concat(screen);\n        }\n        return (bookmarkableUrl.indexOf(screen) != -1);\n    }\n\n    public static String registerOpenedPerspective(String currentBookmarkableURLStatus,\n                                                   PlaceRequest place) {\n        return place.getFullIdentifier().concat(PERSPECTIVE_SEP).concat(currentBookmarkableURLStatus);\n    }\n\n    private static String getDockId(UberfireDock targetDock) {\n        return targetDock.getDockPosition().getShortName()\n                + targetDock.getPlaceRequest().getFullIdentifier() + SEPARATOR;\n    }\n\n    public static String registerOpenedDock(String currentBookmarkableURLStatus,\n                                            UberfireDock targetDock) {\n        if (targetDock == null) {\n            return currentBookmarkableURLStatus;\n        }\n        final String id = getDockId(targetDock);\n        final String closed = CLOSED_DOCK_PREFIX.concat(id);\n\n        if (currentBookmarkableURLStatus.contains(DOCK_CLOSE_SEP)) {\n            String result = null;\n\n            if (!currentBookmarkableURLStatus.contains(id)) {\n                // the screen is not in the URL, insert in last position\n                result = currentBookmarkableURLStatus.replace(DOCK_CLOSE_SEP,\n                                                              (id + DOCK_CLOSE_SEP));\n            } else if (currentBookmarkableURLStatus.contains(closed)) {\n                // the screen is closed\n                result = currentBookmarkableURLStatus.replace(closed,\n                                                              id);\n            } else {\n                // screen already in URL\n                result = currentBookmarkableURLStatus;\n            }\n            return result;\n        } else {\n            return currentBookmarkableURLStatus + DOCK_BEGIN_SEP + (getDockId(targetDock) + DOCK_CLOSE_SEP);\n        }\n    }\n\n    public static String registerClosedDock(String currentBookmarkableURLStatus,\n                                            UberfireDock targetDock) {\n        if (!isNotBlank(currentBookmarkableURLStatus)\n                || null == targetDock) {\n            return currentBookmarkableURLStatus;\n        }\n        final String id = getDockId(targetDock);\n        final String closed = CLOSED_DOCK_PREFIX.concat(id);\n        if (!currentBookmarkableURLStatus.contains(closed)) {\n            return currentBookmarkableURLStatus.replace(id,\n                                                        CLOSED_DOCK_PREFIX.concat(id));\n        }\n        return currentBookmarkableURLStatus;\n    }\n\n    /**\n     * Remove the editor reference from the URL\n     * @param currentBookmarkableURLStatus\n     * @param place\n     * @return\n     */\n    public static String registerCloseEditor(final String currentBookmarkableURLStatus,\n                                             final PlaceRequest place) {\n        if (place != null\n                && place instanceof PathPlaceRequest) {\n            final String path = place.getFullIdentifier();\n            final String pathWithSep = path.concat(SEPARATOR);\n\n            if (currentBookmarkableURLStatus.contains(pathWithSep)) {\n                return currentBookmarkableURLStatus.replace(pathWithSep,\n                                                            \"\");\n            }\n            return currentBookmarkableURLStatus.replace(path,\n                                                        \"\");\n        }\n        return currentBookmarkableURLStatus;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/CategoriesManagerCache.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Undefined;\n\n@ApplicationScoped\npublic class CategoriesManagerCache {\n\n    private Set<Category> categories = new HashSet<>();\n\n    private Undefined undefinedCategory;\n\n    @Inject\n    public CategoriesManagerCache(Undefined undefinedCategory) {\n        this.undefinedCategory = undefinedCategory;\n    }\n\n    public Set<Category> getCategories() {\n        return new HashSet<>(categories);\n    }\n\n    public void add(Category category) {\n        this.categories.add(category);\n    }\n\n    public void addAll(Collection<Category> category) {\n        this.categories.addAll(category);\n    }\n\n    public void addAllFromResourceTypes(List<ClientResourceType> clientResourceType) {\n        this.addAll(this.getCategories(clientResourceType));\n    }\n\n    private List<Category> getCategories(List<ClientResourceType> resourceTypes) {\n        return resourceTypes.stream()\n                .filter(clientResourceType -> clientResourceType.getCategory() != null)\n                .map(ClientResourceType::getCategory).collect(Collectors.toList());\n    }\n\n    public Category getCategory(String filterType) {\n        if (filterType == null) {\n            return undefinedCategory;\n        } else {\n            return this.getCategories()\n                    .stream()\n                    .filter(category -> category.getName().equals(filterType.toUpperCase()))\n                    .findFirst()\n                    .orElse(undefinedCategory);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ContextActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.workbench.model.PanelDefinition;\n\npublic interface ContextActivity extends Activity {\n\n    void onAttach(final PanelDefinition definition);\n\n    String getTitle();\n\n    IsWidget getTitleDecoration();\n\n    IsWidget getWidget();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ContextSensitiveActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\npublic interface ContextSensitiveActivity extends Activity {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ForceUnlockEventObserver.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.uberfire.backend.vfs.impl.ForceUnlockEvent;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.client.workbench.VFSLockServiceProxy;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * Observes {@link ForceUnlockEvent}s and tries to release the corresponding\n * locks.\n */\n@ApplicationScoped\npublic class ForceUnlockEventObserver {\n\n    @Inject\n    private VFSLockServiceProxy lockService;\n\n    @Inject\n    private ErrorPopupPresenter errorPopupPresenter;\n\n    @SuppressWarnings(\"unused\")\n    private void onForceUnlock(@Observes final ForceUnlockEvent e) {\n        final ParameterizedCommand<LockResult> cmd = new ParameterizedCommand<LockResult>() {\n\n            @Override\n            public void execute(LockResult result) {\n                if (!result.isSuccess() && result.getLockInfo().isLocked()) {\n                    errorPopupPresenter.showMessage(\"Failed to release lock for \" + e.getPath()\n                            .getFileName());\n                }\n            }\n        };\n        lockService.forceReleaseLock(e.getPath(),\n                                     cmd);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/IsClientEditor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport javax.inject.Qualifier;\n\n/**\n * Identifies client editors\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface IsClientEditor {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/IsSplashScreen.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface IsSplashScreen {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/IsTemplatePerspective.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\nimport javax.inject.Qualifier;\n\n/**\n *  Identifies a template perspective\n */\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface IsTemplatePerspective {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/LockDemandDetector.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Arrays;\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.Event;\n\n@Dependent\npublic class LockDemandDetector {\n\n    private static final List<String> TAG_CLICK_LOCK_EXCLUSIONS = Arrays.asList(\"a\",\n                                                                                \"select\",\n                                                                                \"input\",\n                                                                                \"textarea\",\n                                                                                \"table\",\n                                                                                \"tbody\",\n                                                                                \"tfoot\",\n                                                                                \"td\",\n                                                                                \"tr\");\n\n    /**\n     * Determines whether or not the provided event indicates a change and\n     * therefore demands a lock. The decision is based on:\n     * <p>\n     * <ul>\n     * <li>An optional custom DOM attribute which can be placed on the target\n     * element or any of its parent elements (data-uf-lock=\"[true|false]\")\n     * <p>\n     * <li>A global default list of tag exclusions for click events (i.e.\n     * clicking on select element shouldn't cause a lock since the selection\n     * will later cause a change event) and a DOM attribute to override this\n     * default behavior for click events (data-uf-lock-on-click=\"[true|false]\")\n     * <ul>\n     * @param event the DOM event\n     * @return true, if a lock is required, otherwise false.\n     */\n    public boolean isLockRequired(final Event event) {\n        final Element target = Element.as(event.getEventTarget());\n        final String lockAttribute = findLockAttribute(\"data-uf-lock\",\n                                                       target);\n        if (lockAttribute != null && !lockAttribute.isEmpty()) {\n            return Boolean.parseBoolean(lockAttribute);\n        }\n\n        final boolean click = (event.getTypeInt() == Event.ONCLICK);\n\n        if (click) {\n            final String lockOnClickAttribute = findLockAttribute(\"data-uf-lock-on-click\",\n                                                                  target);\n            if (lockOnClickAttribute != null && !lockOnClickAttribute.isEmpty()) {\n                return Boolean.parseBoolean(lockOnClickAttribute);\n            } else {\n                return !TAG_CLICK_LOCK_EXCLUSIONS.contains(target.getTagName().toLowerCase());\n            }\n        }\n\n        return true;\n    }\n\n    /**\n     * Returns the bitmask of all events that can potentially indicate a lock\n     * demand. The actually event should be passed to\n     * {@link #isLockRequired(Event)} to account for fine-tuning (i.e. via\n     * custom configuration).\n     */\n    public int getLockDemandEventTypes() {\n        return Event.KEYEVENTS | Event.ONCHANGE | Event.ONCLICK | Event.ONPASTE;\n    }\n\n    private String findLockAttribute(final String attributeName,\n                                     final Element element) {\n        if (element == null) {\n            return null;\n        }\n\n        final String lockAttribute = element.getAttribute(attributeName);\n        if (lockAttribute != null && !lockAttribute.isEmpty()) {\n            return lockAttribute;\n        }\n\n        return findLockAttribute(attributeName,\n                                 element.getParentElement());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/LockManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\n\n/**\n * Provides functionality to lock a file or directory, associated with a widget\n * (i.e a workbench screen or editor).\n */\n@JsType\npublic interface LockManager {\n\n    /**\n     * Retrieves the latest lock information for the provided target and fires\n     * events to update the corresponding UI.\n     * @param lockTarget the {@link LockTarget} providing information about what to\n     * lock.\n     */\n    void init(LockTarget lockTarget);\n\n    /**\n     * Notifies this lock manager that the lock target's widget got focus to\n     * initialize widget-specific state i.e. to publish JavaScript methods for\n     * lock management which can be used by non-native editors (i.e editors that\n     * are rendered on the server). The lock manager must be initialized before\n     * calling this method (see {@link #init(LockTarget)}).\n     */\n    void onFocus();\n\n    /**\n     * Attempts to acquire a lock where the consuming code knows a lock needs to\n     * be acquired. If the target is already locked by another user and the lock\n     * cannot be acquired, the user will be notified and the lock target's reload\n     * runnable will be executed. Attempts to acquire a lock will always cause\n     * an {@link ChangeTitleWidgetEvent} to be fired. Errors in the execution of\n     * this method are propagated to the global RPC/MessageBus error handler.\n     * The lock manager must be initialized before calling this method (see\n     * {@link #init(LockTarget)}).\n     */\n    void acquireLock();\n\n    /**\n     * Registers DOM handlers to detect changes on\n     * {@link LockTarget#getWidget()} and, if required (see\n     * {@link LockDemandDetector}), automatically tries to acquire a lock. If\n     * the target is already locked by another user and the lock can't be\n     * acquired, the user will be notified and the lock target's reload runnable\n     * will be executed. Errors in the execution of this method are propagated\n     * to the global RPC/MessageBus error handler. The lock manager must be\n     * initialized before calling this method (see {@link #init(LockTarget)}).\n     */\n    void acquireLockOnDemand();\n\n    /**\n     * Releases the previously acquired lock. Errors in the execution of this\n     * method are propagated to the global RPC/MessageBus error handler.\n     */\n    void releaseLock();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/LockManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.logical.shared.AttachEvent;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.EventListener;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.UIObject;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.util.UserAgent;\nimport org.uberfire.client.workbench.VFSLockServiceProxy;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.events.ResourceAddedEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\n/**\n * Default implementation of {@link LockManager} using the\n * {@link VFSLockServiceProxy} for lock management.\n */\n@Dependent\npublic class LockManagerImpl implements LockManager {\n\n    @Inject\n    private VFSLockServiceProxy lockService;\n\n    @Inject\n    private javax.enterprise.event.Event<ChangeTitleWidgetEvent> changeTitleEvent;\n\n    @Inject\n    private javax.enterprise.event.Event<UpdatedLockStatusEvent> updatedLockStatusEvent;\n\n    @Inject\n    private javax.enterprise.event.Event<NotificationEvent> lockNotification;\n\n    @Inject\n    private LockDemandDetector lockDemandDetector;\n\n    @Inject\n    private User user;\n\n    private LockTarget lockTarget;\n\n    private LockInfo lockInfo = LockInfo.unlocked();\n    private HandlerRegistration closeHandler;\n\n    private boolean lockRequestPending;\n    private boolean unlockRequestPending;\n\n    private boolean lockSyncComplete;\n    private List<Runnable> syncCompleteRunnables = new ArrayList<Runnable>();\n\n    private Timer reloadTimer;\n\n    @Override\n    public void init(final LockTarget lockTarget) {\n        this.lockTarget = lockTarget;\n\n        final ParameterizedCommand<LockInfo> command = new ParameterizedCommand<LockInfo>() {\n\n            @Override\n            public void execute(final LockInfo lockInfo) {\n                if (!lockRequestPending && !unlockRequestPending) {\n                    updateLockInfo(lockInfo);\n                }\n            }\n        };\n        lockService.retrieveLockInfo(lockTarget.getPath(),\n                                     command);\n    }\n\n    @Override\n    public void onFocus() {\n        publishJsApi();\n        fireChangeTitleEvent();\n        fireUpdatedLockStatusEvent();\n    }\n\n    @Override\n    public void acquireLockOnDemand() {\n        if (lockTarget == null) {\n            return;\n        }\n\n        final Widget widget = getLockTargetWidget();\n        final Element element = widget.getElement();\n        acquireLockOnDemand(element);\n\n        widget.addAttachHandler(new AttachEvent.Handler() {\n\n            @Override\n            public void onAttachOrDetach(AttachEvent event) {\n                // Handle widget reattachment/reparenting\n                if (event.isAttached()) {\n                    acquireLockOnDemand(element);\n                }\n            }\n        });\n    }\n\n    public EventListener acquireLockOnDemand(final Element element) {\n        Event.sinkEvents(element,\n                         lockDemandDetector.getLockDemandEventTypes());\n\n        EventListener lockDemandListener = new EventListener() {\n\n            @Override\n            public void onBrowserEvent(Event event) {\n                if (isLockedByCurrentUser()) {\n                    return;\n                }\n\n                if (lockDemandDetector.isLockRequired(event)) {\n                    acquireLock();\n                }\n            }\n        };\n\n        Event.setEventListener(element,\n                               lockDemandListener);\n\n        return lockDemandListener;\n    }\n\n    @Override\n    public void acquireLock() {\n        if (lockTarget == null) {\n            return;\n        }\n        if (isLockedByCurrentUser()) {\n            fireChangeTitleEvent();\n            return;\n        }\n\n        if (lockInfo.isLocked()) {\n            handleLockFailure(lockInfo);\n        } else if (!lockRequestPending) {\n            lockRequestPending = true;\n            final ParameterizedCommand<LockResult> command = new ParameterizedCommand<LockResult>() {\n\n                @Override\n                public void execute(final LockResult result) {\n                    if (result.isSuccess()) {\n                        updateLockInfo(result.getLockInfo());\n                        releaseLockOnClose();\n                    } else {\n                        handleLockFailure(result.getLockInfo());\n                    }\n                    lockRequestPending = false;\n                }\n            };\n            lockService.acquireLock(lockTarget.getPath(),\n                                    command);\n        }\n    }\n\n    @Override\n    public void releaseLock() {\n        final Runnable releaseLock = new Runnable() {\n\n            @Override\n            public void run() {\n                releaseLockInternal();\n            }\n        };\n        if (lockSyncComplete) {\n            releaseLock.run();\n        } else {\n            syncCompleteRunnables.add(releaseLock);\n        }\n    }\n\n    private void releaseLockInternal() {\n        if (isLockedByCurrentUser() && !unlockRequestPending) {\n            unlockRequestPending = true;\n\n            ParameterizedCommand<LockResult> command = new ParameterizedCommand<LockResult>() {\n\n                @Override\n                public void execute(final LockResult result) {\n                    updateLockInfo(result.getLockInfo());\n\n                    if (result.isSuccess()) {\n                        if (closeHandler != null) {\n                            closeHandler.removeHandler();\n                        }\n                    }\n\n                    unlockRequestPending = false;\n                }\n            };\n            lockService.releaseLock(lockTarget.getPath(),\n                                    command);\n        }\n    }\n\n    private void releaseLockOnClose() {\n        if (UserAgent.isChrome()) {\n            closeHandler = Window.addCloseHandler(event -> requestReleaseLock());\n        } else {\n            closeHandler = Window.addWindowClosingHandler(event -> releaseLock());\n        }\n    }\n\n    private native void requestReleaseLock()/*-{\n        var pathArray = window.location.pathname.split('/').filter(Boolean);\n\n        var url = \"\";\n        for (var i = 0; i < pathArray.length - 1; i++) {\n            url += \"/\" + pathArray[i];\n        }\n\n        url += \"/releaseUserLocksServlet\";\n\n        var request = new XMLHttpRequest();\n        request.open('GET', url, false);\n        request.send();\n    }-*/;\n\n    private void handleLockFailure(final LockInfo lockInfo) {\n\n        if (lockInfo != null) {\n            updateLockInfo(lockInfo);\n            lockNotification.fire(new NotificationEvent(WorkbenchConstants.INSTANCE.lockedMessage(lockInfo.lockedBy()),\n                                                        NotificationEvent.NotificationType.INFO,\n                                                        true,\n                                                        lockTarget.getPlace(),\n                                                        20));\n        } else {\n            lockNotification.fire(new NotificationEvent(WorkbenchConstants.INSTANCE.lockError(),\n                                                        NotificationEvent.NotificationType.ERROR,\n                                                        true,\n                                                        lockTarget.getPlace(),\n                                                        20));\n        }\n        // Delay reloading slightly in case we're dealing with a flood of events\n        if (reloadTimer == null) {\n            reloadTimer = new Timer() {\n\n                public void run() {\n                    reload();\n                }\n            };\n        }\n\n        if (!reloadTimer.isRunning()) {\n            reloadTimer.schedule(250);\n        }\n    }\n\n    private void reload() {\n        lockTarget.getReloadRunnable().run();\n    }\n\n    private boolean isLockedByCurrentUser() {\n        return lockInfo.isLocked() && lockInfo.lockedBy().equals(user.getIdentifier());\n    }\n\n    void updateLockInfo(final @Observes LockInfo lockInfo) {\n        /* Comparing URIs since lockInfo.getFile() can be an ObservablePath or a PathImpl. */\n        if (getLockTarget() != null && lockInfo.getFile().toURI().equals(lockTarget.getPath().toURI())) {\n            this.lockInfo = lockInfo;\n            this.lockSyncComplete = true;\n\n            fireChangeTitleEvent();\n            fireUpdatedLockStatusEvent();\n\n            for (Runnable runnable : getSyncCompleteRunnables()) {\n                runnable.run();\n            }\n            getSyncCompleteRunnables().clear();\n        }\n    }\n\n    public LockTarget getLockTarget() {\n        return lockTarget;\n    }\n\n    boolean isLockSyncComplete() {\n        return lockSyncComplete;\n    }\n\n    List<Runnable> getSyncCompleteRunnables() {\n        return syncCompleteRunnables;\n    }\n\n    void onResourceAdded(@Observes ResourceAddedEvent res) {\n        if (lockTarget != null && res.getPath().equals(lockTarget.getPath())) {\n            releaseLock();\n        }\n    }\n\n    void onResourceUpdated(@Observes ResourceUpdatedEvent res) {\n        if (lockTarget != null && res.getPath().equals(lockTarget.getPath())) {\n            releaseLock();\n        }\n    }\n\n    void onSaveInProgress(@Observes SaveInProgressEvent evt) {\n        if (lockTarget != null && evt.getPath().equals(lockTarget.getPath())) {\n            releaseLock();\n        }\n    }\n\n    void onRenameInProgress(@Observes RenameInProgressEvent event) {\n        if (getLockTarget() != null && event.getPath().equals(lockTarget.getPath())) {\n            releaseLock();\n        }\n    }\n\n    void onLockRequired(@Observes LockRequiredEvent event) {\n        if (lockTarget != null && isVisible() && !isLockedByCurrentUser()) {\n            acquireLock();\n        }\n    }\n\n    private native void publishJsApi()/*-{\n        var lockManager = this;\n        $wnd.isLocked = function () {\n            return lockManager.@org.uberfire.client.mvp.LockManagerImpl::isLocked()();\n        }\n        $wnd.isLockedByCurrentUser = function () {\n            return lockManager.@org.uberfire.client.mvp.LockManagerImpl::isLockedByCurrentUser()();\n        }\n        $wnd.acquireLock = function () {\n            lockManager.@org.uberfire.client.mvp.LockManagerImpl::acquireLock()();\n        }\n        $wnd.releaseLock = function () {\n            lockManager.@org.uberfire.client.mvp.LockManagerImpl::releaseLock()();\n        }\n        $wnd.reload = function () {\n            return lockManager.@org.uberfire.client.mvp.LockManagerImpl::reload()();\n        }\n    }-*/;\n\n    private Widget getLockTargetWidget() {\n        final IsWidget isWidget = lockTarget.getWidget();\n        if (isWidget instanceof Widget) {\n            return ((Widget) isWidget);\n        }\n        return isWidget.asWidget();\n    }\n\n    private boolean isLocked() {\n        return lockInfo.isLocked();\n    }\n\n    protected LockInfo getLockInfo() {\n        return lockInfo;\n    }\n\n    protected void fireChangeTitleEvent() {\n        changeTitleEvent.fire(LockTitleWidgetEvent.create(lockTarget,\n                                                          lockInfo,\n                                                          user));\n    }\n\n    protected void fireUpdatedLockStatusEvent() {\n        if (isVisible()) {\n            updatedLockStatusEvent.fire(new UpdatedLockStatusEvent(lockInfo.getFile(),\n                                                                   lockInfo.isLocked(),\n                                                                   isLockedByCurrentUser()));\n        }\n    }\n\n    private boolean isVisible() {\n        final Widget widget = getLockTargetWidget();\n        final Element element = widget.getElement();\n        boolean visible = UIObject.isVisible(element) &&\n                (element.getAbsoluteLeft() != 0) && (element.getAbsoluteTop() != 0);\n\n        return visible;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/LockTitleWidgetEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.Image;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\n\n/**\n * Utility to create {@link ChangeTitleWidgetEvent}s in response to lock status\n * changes.\n */\npublic class LockTitleWidgetEvent {\n\n    private static final Image lockImage = new Image(WorkbenchResources.INSTANCE.images().lock());\n\n    private LockTitleWidgetEvent() {\n    }\n\n    ;\n\n    public static ChangeTitleWidgetEvent create(final LockTarget lockTarget,\n                                                final LockInfo lockInfo,\n                                                final User user) {\n\n        final String lockedBy = lockInfo.lockedBy();\n        if (user.getIdentifier().equals(lockedBy)) {\n            lockImage.setTitle(WorkbenchConstants.INSTANCE.lockOwnedHint());\n        } else {\n            lockImage.setTitle(WorkbenchConstants.INSTANCE.lockHint() + \" \" + lockedBy);\n        }\n\n        return new ChangeTitleWidgetEvent(lockTarget.getPlace(),\n                                          lockTarget.getTitle(),\n                                          (lockInfo.isLocked()) ? lockImage : null);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.function.Consumer;\n\nimport jsinterop.annotations.JsType;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@JsType\npublic interface PerspectiveActivity extends ContextSensitiveActivity {\n\n    /**\n     * Returns a new copy of the layout (panels and their parts) that should be used if no persisted state is available.\n     * Each time this method is called, it must produce a new PerspectiveDefinition. This rule applies whether or not\n     * the perspective is transient.\n     * @return the perspective layout to use when a previously saved one is not available.\n     * @see #isTransient()\n     * @see WorkbenchServicesProxy#loadPerspective(String, org.uberfire.mvp.ParameterizedCommand)\n     */\n    PerspectiveDefinition getDefaultPerspectiveLayout();\n\n    @Override\n    default String getName() {\n        return getDefaultPerspectiveLayout().getName();\n    }\n\n    /**\n     * Returns true if this perspective should be displayed automatically when the application starts. Each application\n     * needs exactly one default perspective.\n     * @return true if this is the default perspective; false if it is not.\n     */\n    boolean isDefault();\n\n    /**\n     * Returns a new copy of the menus that should be used with this perspective. Each time this method is called, it\n     * must produce a new set of menus.\n     * @return the menus to use while this perspective is active.\n     */\n    void getMenus(final Consumer<Menus> menusConsumer);\n\n    ToolBar getToolBar();\n\n    /**\n     * Tells whether this perspective's state (layout and size of panels, parts contained in each panel) should be saved\n     * per user or not.\n     * @return false if this perspective's state should be saved and retrieved from the server; true if this perspective\n     * should always start up in its default layout.\n     * @see WorkbenchServicesProxy#loadPerspective(String, org.uberfire.mvp.ParameterizedCommand)\n     */\n    boolean isTransient();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Set;\n\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.Commands;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n/**\n * The PerspectiveManager is responsible for the process of starting up a perspective, shutting down the current\n * perspective, and switching between perspectives. This includes a sequence of asynchronous operations such as fetching\n * any stored definition the current user has for the new perspective, and saving the definition when the user has\n * modified it (for example, by dragging and dropping components, launching new activities, and so on).\n * <p/>\n * Structurally, the PerspectiveManager performs actions at the request of the {@link PlaceManager}, and it accomplishes\n * these actions by delegating to the {@link PanelManager} and {@link WorkbenchServicesProxy}.\n */\npublic interface PerspectiveManager {\n\n    /**\n     * Returns the current perspective's {@link PerspectiveActivity}. When the app first starts, this will be null. Once\n     * the workbench has bootstrapped, the return value will not be null again.\n     */\n    PerspectiveActivity getCurrentPerspective();\n\n    /**\n     * Returns a description of the current perspective which reflects the current visible state of the user interface.\n     */\n    PerspectiveDefinition getLivePerspectiveDefinition();\n\n    /**\n     * Saves the current live perspective definition to the server. Saved perspective definitions override the default\n     * definition produced by the {@link PerspectiveActivity#getDefaultPerspectiveLayout()} when switching to a new\n     * perspective. This method has no effect if the current perspective is transient.\n     * @param doWhenFinished action to execute after the save is complete (or immediately in the case of a transient perspective).\n     * Must not be null. To do nothing, use {@link Commands#DO_NOTHING}.\n     * @see WorkbenchPerspective#isTransient()\n     * @see PerspectiveActivity#isTransient()\n     */\n    void savePerspectiveState(final Command doWhenFinished);\n\n    /**\n     * This method should only be invoked by PlaceManager. To launch a perspective within an UberFire app, pass a\n     * PlaceRequest for that perspective to {@link PlaceManager#goTo(org.uberfire.mvp.PlaceRequest)}.\n     * <p/>\n     * Closes all current panels in the PanelManager (they must have already had their parts removed), then builds up\n     * the new panel arrangement based on the {@link PerspectiveDefinition} associated with the given perspective\n     * activity. If the given perspective is transient, its default perspective definition will always be used.\n     * Otherwise, the PerspectiveManager will first attempt to retrieve the current user's saved PerspectiveDefinition\n     * from the server, falling back on the default if none is found.\n     * @param placeRequest the placeRequest that originated the perspective to switch to. Must not be null.\n     * @param perspective the perspective to switch to. Must not be null.\n     * @param doWhenFinished The command to execute once the new perspective's panels have been created. Must not be null.\n     * <p/>\n     * When the callback is invoked, the panels will be set up in their correct positions, but no parts will\n     * have been added.\n     */\n    void switchToPerspective(final PlaceRequest placeRequest,\n                             final PerspectiveActivity perspective,\n                             final ParameterizedCommand<PerspectiveDefinition> doWhenFinished);\n\n    /**\n     * Retrieves the definitions of all the persisted perspectives.\n     * @param doWhenFinished The command to execute once the perspective definitions are retrieved.\n     */\n    void loadPerspectiveStates(final ParameterizedCommand<Set<PerspectiveDefinition>> doWhenFinished);\n\n    /**\n     * This method removes any persisted definition for the given perspective. Subsequent requests for a previously\n     * persisted perspective should load the Perspective definition from the applicable object.\n     * @param doWhenFinished The command to execute once the perspective state have been removed. Must not be null.\n     */\n    void removePerspectiveState(final String perspectiveId,\n                                final Command doWhenFinished);\n\n    /**\n     * This method removes all persisted Perspective definitions. Subsequent requests for previously persisted\n     * perspectives should load the Perspective definition from the applicable object.\n     * @param doWhenFinished The command to execute once the perspective states have been removed. Must not be null.\n     */\n    void removePerspectiveStates(final Command doWhenFinished);\n\n    /**\n     * Fetches the current default perspective identifier.\n     * @return The default perspective identifier of the workbench, if one exists.\n     */\n    String getDefaultPerspectiveIdentifier();\n\n    PlaceRequest getCurrentPerspectivePlaceRequest();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PerspectiveManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.Iterator;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n@ApplicationScoped\npublic class PerspectiveManagerImpl implements PerspectiveManager {\n\n    @Inject\n    private PanelManager panelManager;\n\n    @Inject\n    private WorkbenchServicesProxy wbServices;\n\n    @Inject\n    private Event<PerspectiveChange> perspectiveChangeEvent;\n\n    @Inject\n    private ActivityBeansCache activityBeansCache;\n\n    @Inject\n    private SyncBeanManager iocManager;\n\n    private PerspectiveActivity currentPerspective;\n\n    private PerspectiveDefinition livePerspectiveDef;\n\n    private PlaceRequest currentPerspectivePlaceRequest;\n\n    @Override\n    public void switchToPerspective(final PlaceRequest placeRequest,\n                                    final PerspectiveActivity activity,\n                                    final ParameterizedCommand<PerspectiveDefinition> doWhenFinished) {\n\n        // switching perspectives is a chain of async operations. they're declared here\n        // in reverse order (last to first):\n\n        NotifyOthersOfPerspectiveChangeCommand fourthOperation = new NotifyOthersOfPerspectiveChangeCommand(placeRequest,\n                                                                                                            doWhenFinished);\n\n        BuildPerspectiveFromDefinitionCommand thirdOperation = new BuildPerspectiveFromDefinitionCommand(activity,\n                                                                                                         fourthOperation);\n\n        FetchPerspectiveCommand secondOperation = new FetchPerspectiveCommand(placeRequest,\n                                                                              activity,\n                                                                              thirdOperation);\n\n        secondOperation.execute();\n    }\n\n    @Override\n    public PerspectiveActivity getCurrentPerspective() {\n        return currentPerspective;\n    }\n\n    @Override\n    public PerspectiveDefinition getLivePerspectiveDefinition() {\n        return livePerspectiveDef;\n    }\n\n    @Override\n    public void savePerspectiveState(Command doWhenFinished) {\n        if (currentPerspective != null && !currentPerspective.isTransient()) {\n            wbServices.save(currentPerspective.getIdentifier(),\n                            livePerspectiveDef,\n                            doWhenFinished);\n        } else {\n            doWhenFinished.execute();\n        }\n    }\n\n    @Override\n    public void loadPerspectiveStates(final ParameterizedCommand<Set<PerspectiveDefinition>> doWhenFinished) {\n        wbServices.loadPerspectives(doWhenFinished);\n    }\n\n    @Override\n    public void removePerspectiveState(final String perspectiveId,\n                                       final Command doWhenFinished) {\n        wbServices.removePerspectiveState(perspectiveId,\n                                          doWhenFinished);\n    }\n\n    @Override\n    public void removePerspectiveStates(final Command doWhenFinished) {\n        wbServices.removePerspectiveStates(doWhenFinished);\n    }\n\n    @Override\n    public String getDefaultPerspectiveIdentifier() {\n        AbstractWorkbenchPerspectiveActivity defaultPerspective = null;\n        final Iterator<SyncBeanDef<AbstractWorkbenchPerspectiveActivity>> perspectivesIterator = getPerspectivesIterator();\n\n        while (perspectivesIterator.hasNext()) {\n            final SyncBeanDef<AbstractWorkbenchPerspectiveActivity> perspective = perspectivesIterator.next();\n            final AbstractWorkbenchPerspectiveActivity instance = perspective.getInstance();\n            if (instance.isDefault()) {\n                defaultPerspective = instance;\n                break;\n            } else {\n                iocManager.destroyBean(instance);\n            }\n        }\n\n        if (defaultPerspective != null) {\n            return defaultPerspective.getIdentifier();\n        }\n\n        return null;\n    }\n\n    @Override\n    public PlaceRequest getCurrentPerspectivePlaceRequest() {\n        return currentPerspectivePlaceRequest;\n    }\n\n    Iterator<SyncBeanDef<AbstractWorkbenchPerspectiveActivity>> getPerspectivesIterator() {\n        final Collection<SyncBeanDef<AbstractWorkbenchPerspectiveActivity>> perspectives = iocManager.lookupBeans(AbstractWorkbenchPerspectiveActivity.class);\n        return perspectives.iterator();\n    }\n\n    /**\n     * Fetches the given perspective's definition either from the server (if non-transient) or from the activity itself\n     * (if transient or if the fetch call fails).\n     */\n    class FetchPerspectiveCommand implements Command {\n\n        private final PlaceRequest placeRequest;\n        private final PerspectiveActivity perspective;\n        private final ParameterizedCommand<PerspectiveDefinition> doAfterFetch;\n\n        public FetchPerspectiveCommand(PlaceRequest placeRequest,\n                                       PerspectiveActivity perspective,\n                                       ParameterizedCommand<PerspectiveDefinition> doAfterFetch) {\n            this.placeRequest = checkNotNull(\"placeRequest\",\n                                             placeRequest);\n            this.perspective = checkNotNull(\"perspective\",\n                                            perspective);\n            this.doAfterFetch = checkNotNull(\"doAfterFetch\",\n                                             doAfterFetch);\n        }\n\n        @Override\n        public void execute() {\n            currentPerspectivePlaceRequest = placeRequest;\n            currentPerspective = perspective;\n            if (perspective.isTransient()) {\n                //Transient Perspectives are not saved and hence cannot be loaded\n                doAfterFetch.execute(perspective.getDefaultPerspectiveLayout());\n            } else {\n\n                wbServices.loadPerspective(perspective.getIdentifier(),\n                                           new ParameterizedCommand<PerspectiveDefinition>() {\n                                               @Override\n                                               public void execute(final PerspectiveDefinition response) {\n\n                                                   if (isAValidDefinition(response)) {\n                                                       doAfterFetch.execute(response);\n                                                   } else {\n                                                       doAfterFetch.execute(perspective.getDefaultPerspectiveLayout());\n                                                   }\n                                               }\n                                           });\n            }\n        }\n\n        boolean isAValidDefinition(PerspectiveDefinition response) {\n            return response != null && allThePartsAreValid(response.getRoot());\n        }\n\n        private boolean allThePartsAreValid(PanelDefinition panel) {\n            if (!checkIfAllPlacesAreValidActivities(panel)) {\n                return false;\n            } else {\n                for (PanelDefinition child : ensureIterable(panel.getChildren())) {\n                    if (!allThePartsAreValid(child)) {\n                        return false;\n                    }\n                }\n            }\n            return true;\n        }\n\n        private boolean checkIfAllPlacesAreValidActivities(PanelDefinition child) {\n            for (PartDefinition partDefinition : ensureIterable(child.getParts())) {\n                PlaceRequest place = partDefinition.getPlace();\n                if (!activityBeansCache.hasActivity(place.getIdentifier())) {\n                    return false;\n                }\n            }\n            return true;\n        }\n    }\n\n    /**\n     * Builds up the panels of a perspective based on the structure described in a given {@link PerspectiveDefinition}.\n     */\n    class BuildPerspectiveFromDefinitionCommand implements ParameterizedCommand<PerspectiveDefinition> {\n\n        private final ParameterizedCommand<PerspectiveDefinition> doWhenFinished;\n        private final PerspectiveActivity activity;\n\n        public BuildPerspectiveFromDefinitionCommand(PerspectiveActivity activity,\n                                                     ParameterizedCommand<PerspectiveDefinition> doWhenFinished) {\n            this.activity = checkNotNull(\"activity\",\n                                         activity);\n            this.doWhenFinished = checkNotNull(\"doWhenFinished\",\n                                               doWhenFinished);\n        }\n\n        @Override\n        public void execute(PerspectiveDefinition perspectiveDef) {\n            if (livePerspectiveDef != null) {\n                tearDownChildPanelsRecursively(livePerspectiveDef.getRoot());\n            }\n            livePerspectiveDef = perspectiveDef;\n            panelManager.setRoot(activity,\n                                 perspectiveDef.getRoot());\n            setupPanelRecursively(perspectiveDef.getRoot());\n            doWhenFinished.execute(perspectiveDef);\n        }\n\n        private void tearDownChildPanelsRecursively(final PanelDefinition panel) {\n            for (PanelDefinition child : ensureIterable(panel.getChildren())) {\n                tearDownChildPanelsRecursively(child);\n                panelManager.removeWorkbenchPanel(child);\n            }\n        }\n\n        private void setupPanelRecursively(final PanelDefinition panel) {\n            for (PanelDefinition child : ensureIterable(panel.getChildren())) {\n                final PanelDefinition target = panelManager.addWorkbenchPanel(panel,\n                                                                              child,\n                                                                              child.getPosition());\n                setupPanelRecursively(target);\n            }\n        }\n    }\n\n    class NotifyOthersOfPerspectiveChangeCommand implements ParameterizedCommand<PerspectiveDefinition> {\n\n        private final PlaceRequest placeRequest;\n        private final ParameterizedCommand<PerspectiveDefinition> doWhenFinished;\n\n        public NotifyOthersOfPerspectiveChangeCommand(final PlaceRequest placeRequest,\n                                                      final ParameterizedCommand<PerspectiveDefinition> doWhenFinished) {\n            this.placeRequest = checkNotNull(\"placeRequest\",\n                                             placeRequest);\n            this.doWhenFinished = checkNotNull(\"doWhenFinished\",\n                                               doWhenFinished);\n        }\n\n        @Override\n        public void execute(PerspectiveDefinition perspectiveDef) {\n            currentPerspective.getMenus(menus -> {\n                perspectiveChangeEvent.fire(new PerspectiveChange(placeRequest,\n                                                                  perspectiveDef,\n                                                                  menus,\n                                                                  currentPerspective.getIdentifier()));\n                doWhenFinished.execute(perspectiveDef);\n            });\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceHistoryHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.logging.Logger;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.logical.shared.ValueChangeHandler;\nimport com.google.gwt.user.client.History;\nimport com.google.web.bindery.event.shared.EventBus;\nimport com.google.web.bindery.event.shared.HandlerRegistration;\nimport org.jboss.errai.bus.client.util.BusToolsCli;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n@ApplicationScoped\npublic class PlaceHistoryHandler {\n\n    private static final Logger log = Logger.getLogger(PlaceHistoryHandler.class.getName());\n    private final Historian historian;\n    @Inject\n    private PlaceRequestHistoryMapper mapper;\n    private PlaceManager placeManager;\n    private PlaceRequest defaultPlaceRequest = PlaceRequest.NOWHERE;\n    private String currentBookmarkableURLStatus = \"\";\n\n    /**\n     * Create a new PlaceHistoryHandler.\n     */\n    public PlaceHistoryHandler() {\n        this.historian = GWT.create(DefaultHistorian.class);\n    }\n\n    /**\n     * Handle the current history token. Typically called at application start,\n     * to ensure bookmark launches work.\n     */\n    public void handleCurrentHistory() {\n        handleHistoryToken(historian.getToken());\n    }\n\n    /**\n     * Initialize this place history handler.\n     * @return a registration object to de-register the handler\n     */\n    public HandlerRegistration initialize(final PlaceManager placeManager,\n                                          final EventBus eventBus,\n                                          final PlaceRequest defaultPlaceRequest) {\n        this.placeManager = placeManager;\n        this.defaultPlaceRequest = defaultPlaceRequest;\n\n        final HandlerRegistration historyReg =\n                historian.addValueChangeHandler(event -> {\n                    //Temporarily disabled until https://issues.jboss.org/browse/AF-523 is ready\n//                    handleHistoryToken(event.getValue());\n                });\n\n        return () -> {\n            PlaceHistoryHandler.this.defaultPlaceRequest = DefaultPlaceRequest.NOWHERE;\n            PlaceHistoryHandler.this.placeManager = null;\n            historyReg.removeHandler();\n        };\n    }\n\n    private void updateHistoryBar() {\n        if (currentBookmarkableURLStatus.endsWith(BookmarkableUrlHelper.OTHER_SCREEN_SEP)) {\n\n            currentBookmarkableURLStatus =\n                    currentBookmarkableURLStatus.substring(0,\n                                                           currentBookmarkableURLStatus.length() - 1);\n        }\n        if (BusToolsCli.isRemoteCommunicationEnabled()) {\n            historian.newItem(currentBookmarkableURLStatus,\n                    false);\n        }\n\n    }\n\n    Logger log() {\n        return log;\n    }\n\n    public String getCurrentBookmarkableURLStatus() {\n        return currentBookmarkableURLStatus;\n    }\n\n    private void handleHistoryToken(String token) {\n\n        PlaceRequest newPlaceRequest = null;\n\n        if (\"\".equals(token)) {\n            newPlaceRequest = defaultPlaceRequest;\n        }\n\n        if (newPlaceRequest == null) {\n            newPlaceRequest = mapper.getPlaceRequest(token);\n        }\n\n        if (newPlaceRequest == null) {\n            log().warning(\"Unrecognized history token: \" + token);\n            newPlaceRequest = defaultPlaceRequest;\n        }\n\n        placeManager.goTo(newPlaceRequest);\n    }\n\n    /**\n     * currentBookmarkableURLStatus schema   perspective#screen-1,screen-2#editor-path1,editor-path2\n     * @param newPlaceRequest\n     * @return\n     */\n    private String tokenForPlace(final PlaceRequest newPlaceRequest) {\n        if (defaultPlaceRequest.equals(newPlaceRequest)) {\n            return \"\";\n        }\n        return currentBookmarkableURLStatus;\n    }\n\n    /**\n     * Return true if the given screen is already closed.\n     * @param screen\n     * @return\n     */\n    private boolean isScreenClosed(String screen) {\n        return BookmarkableUrlHelper.isScreenClosed(screen,\n                                                    currentBookmarkableURLStatus);\n    }\n\n    /**\n     * Extract a perspective from a place\n     * @param place\n     * @return\n     */\n    public PlaceRequest getPerspectiveFromPlace(final PlaceRequest place) {\n        return BookmarkableUrlHelper.getPerspectiveFromPlace(place);\n    }\n\n    /**\n     * register opened screen of perspective\n     * @param activity\n     * @param place\n     */\n    public void registerOpen(Activity activity,\n                             PlaceRequest place) {\n        if (place.isUpdateLocationBarAllowed()) {\n            if (activity.isType(ActivityResourceType.PERSPECTIVE.name())) {\n                currentBookmarkableURLStatus = BookmarkableUrlHelper.registerOpenedPerspective(currentBookmarkableURLStatus,\n                                                                                               place);\n            } else if (activity.isType(ActivityResourceType.SCREEN.name())) {\n                currentBookmarkableURLStatus =\n                        BookmarkableUrlHelper.registerOpenedScreen(currentBookmarkableURLStatus,\n                                                                   place);\n            } else if (activity.isType(ActivityResourceType.EDITOR.name())) {\n                currentBookmarkableURLStatus =\n                        BookmarkableUrlHelper.registerOpenedScreen(currentBookmarkableURLStatus,\n                                                                   place);\n            }\n            updateHistoryBar();\n        }\n    }\n\n    public void registerClose(Activity activity,\n                              PlaceRequest place) {\n        if (place.isUpdateLocationBarAllowed()) {\n            if (place instanceof PathPlaceRequest) {\n                // handle editors\n                currentBookmarkableURLStatus =\n                        BookmarkableUrlHelper.registerCloseEditor(currentBookmarkableURLStatus,\n                                                                  place);\n            } else {\n                final String id = place.getIdentifier();\n                if (activity.isType(ActivityResourceType.SCREEN.name())) {\n                    final String token = BookmarkableUrlHelper.getUrlToken(currentBookmarkableURLStatus,\n                                                                           id);\n\n                    currentBookmarkableURLStatus =\n                            BookmarkableUrlHelper.registerClose(currentBookmarkableURLStatus,\n                                                                token);\n                }\n            }\n            updateHistoryBar();\n        }\n    }\n\n    public void flush() {\n        currentBookmarkableURLStatus = \"\";\n    }\n\n    public String getToken() {\n        return (historian.getToken());\n    }\n\n    public void registerOpenDock(@Observes UberfireDocksInteractionEvent event) {\n        if (event.getType() == UberfireDocksInteractionEvent.InteractionType.OPENED) {\n            currentBookmarkableURLStatus =\n                    BookmarkableUrlHelper.registerOpenedDock(currentBookmarkableURLStatus,\n                                                             event.getTargetDock());\n            updateHistoryBar();\n        }\n    }\n\n    public void registerCloseDock(@Observes UberfireDocksInteractionEvent event) {\n        if (event.getType() == UberfireDocksInteractionEvent.InteractionType.CLOSED) {\n\n            currentBookmarkableURLStatus =\n                    BookmarkableUrlHelper.registerClosedDock(currentBookmarkableURLStatus,\n                                                             event.getTargetDock());\n            updateHistoryBar();\n        }\n    }\n\n    /**\n     * Optional delegate in charge of History related events. Provides nice\n     * isolation for unit testing, and allows pre- or post-processing of tokens.\n     * Methods correspond to the like named methods on {@link History}.\n     */\n    public interface Historian {\n\n        /**\n         * Adds a {@link com.google.gwt.event.logical.shared.ValueChangeEvent}\n         * handler to be informed of changes to the browser's history stack.\n         * @param valueChangeHandler the handler\n         * @return the registration used to remove this value change handler\n         */\n        com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> valueChangeHandler);\n\n        /**\n         * @return the current history token.\n         */\n        String getToken();\n\n        /**\n         * Adds a new browser history entry. Calling this method will cause\n         * {@link ValueChangeHandler#onValueChange(com.google.gwt.event.logical.shared.ValueChangeEvent)}\n         * to be called as well.\n         */\n        void newItem(final String token,\n                     final boolean issueEvent);\n    }\n\n    /**\n     * Default implementation of {@link Historian}, based on {@link History}.\n     */\n    public static class DefaultHistorian\n            implements\n            Historian {\n\n        @Override\n        public com.google.gwt.event.shared.HandlerRegistration addValueChangeHandler(final ValueChangeHandler<String> valueChangeHandler) {\n            return History.addValueChangeHandler(valueChangeHandler);\n        }\n\n        @Override\n        public String getToken() {\n            return History.getToken();\n        }\n\n        @Override\n        public void newItem(String token,\n                            boolean issueEvent) {\n            History.newItem(token,\n                            issueEvent);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.mvp.BiParameterizedCommand;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A Workbench-centric abstraction over the browser's history mechanism. Allows the application to initiate navigation\n * to any displayable thing: a {@link WorkbenchPerspective}, a {@link WorkbenchScreen}, a {@link WorkbenchPopup}, a\n * {@link WorkbenchEditor}, a {@link WorkbenchPart} within a screen or editor, or the editor associated with a VFS file\n * located at a particular {@link Path}.\n */\n@JsType\npublic interface PlaceManager {\n\n    @JsMethod(name = \"goToId\")\n    void goTo(final String identifier);\n\n    @JsMethod(name = \"goToPlace\")\n    void goTo(final PlaceRequest place);\n\n    @JsMethod(name = \"goToPath\")\n    void goTo(final Path path);\n\n    @JsMethod(name = \"goToPathAndPlace\")\n    void goTo(final Path path,\n              final PlaceRequest place);\n\n    @JsMethod(name = \"goToPartWithPanel\")\n    void goTo(final PartDefinition part,\n              final PanelDefinition panel);\n\n    @JsMethod(name = \"goToIdWithPanel\")\n    void goTo(final String identifier,\n              final PanelDefinition panel);\n\n    @JsMethod(name = \"goToPlaceWithPanel\")\n    void goTo(final PlaceRequest place,\n              final PanelDefinition panel);\n\n    @JsMethod(name = \"goToPathWithPanel\")\n    void goTo(final Path path,\n              final PanelDefinition panel);\n\n    @JsMethod(name = \"goToPathAndPlaceWithPanel\")\n    void goTo(final Path path,\n              final PlaceRequest place,\n              final PanelDefinition panel);\n\n    /**\n     * Locates the Activity associated with the given place, and if that activity is not already part of the workbench,\n     * starts it and adds its view to the given widget container. If the activity is already part of the current\n     * workbench, it will be selected, and it will not be moved from its current location.\n     * <p>\n     * The activity will be properly shut down in any of the following scenarios:\n     * <ol>\n     * <li>by a call to one of the PlaceManager methods for closing a place: {@link #closePlace(PlaceRequest)},\n     * {@link #closePlace(String)}, or {@link #closeAllPlaces()}\n     * <li>by switching to another perspective, which has the side effect of closing all places\n     * <li>by removing the activity's view from the DOM, either using the GWT Widget API, or by direct DOM manipulation.\n     * <li>by opening another place on the same container.\n     * </ol>\n     *\n     * @param place\n     * @param addTo The container to add the widget's view to. Its corresponding DOM element must have a CSS\n     *              <tt>position</tt> setting of <tt>relative</tt> or <tt>absolute</tt> and an explicit size set. This can\n     *              be accomplished through direct use of CSS, or through the\n     *              {@link Layouts#setToFillParent(com.google.gwt.user.client.ui.Widget)} call.\n     */\n    @JsIgnore\n    void goTo(final PlaceRequest place,\n              final HasWidgets addTo);\n\n    @JsIgnore\n    void goTo(final String id,\n              final HTMLElement addTo);\n\n    @JsIgnore\n    void goTo(final PlaceRequest place,\n              final HTMLElement addTo);\n\n    @JsIgnore\n    void goTo(final PlaceRequest place,\n              final elemental2.dom.HTMLElement addTo);\n\n    /**\n     * Finds the <i>currently open</i> activity that handles the given PlaceRequest by ID. No attempt is made to match\n     * by path, but see {@link ActivityManagerImpl#resolveExistingParts(PlaceRequest)} for a variant that does.\n     * (TODO: should this method care about paths? if not, should the other method be added to the interface?)\n     *\n     * @param place the PlaceRequest whose activity to search for\n     * @return the activity that currently exists in service of the given PlaceRequest's ID. Null if no current activity\n     * handles the given PlaceRequest.\n     */\n    Activity getActivity(final PlaceRequest place);\n\n    @JsMethod(name = \"getStatusById\")\n    PlaceStatus getStatus(final String id);\n\n    @JsMethod(name = \"getStatusByPlaceRequest\")\n    PlaceStatus getStatus(final PlaceRequest place);\n\n    default void executeOnOpenCallbacks(final PlaceRequest place) {\n        checkNotNull(\"place\",\n                     place);\n\n        final List<Command> callbacks = getOnOpenCallbacks(place);\n        if (callbacks != null) {\n            callbacks.forEach(Command::execute);\n        }\n    }\n\n    default void executeOnCloseCallbacks(final PlaceRequest place) {\n        checkNotNull(\"place\",\n                     place);\n\n        final List<Command> callbacks = getOnCloseCallbacks(place);\n        if (callbacks != null) {\n            callbacks.forEach(Command::execute);\n        }\n    }\n\n    List<Command> getOnOpenCallbacks(PlaceRequest place);\n\n    List<Command> getOnCloseCallbacks(PlaceRequest place);\n\n    @JsMethod(name = \"closePlaceById\")\n    void closePlace(final String id);\n\n    void closePlace(final PlaceRequest placeToClose);\n\n    @JsMethod(name = \"closePlaceWithCallback\")\n    void closePlace(final PlaceRequest placeToClose,\n                    final Command doAfterClose);\n\n    void tryClosePlace(final PlaceRequest placeToClose,\n                       final Command onAfterClose);\n\n    @JsMethod(name = \"forceCloseById\")\n    void forceClosePlace(final String id);\n\n    @JsMethod(name = \"forceCloseByPlaceRequest\")\n    void forceClosePlace(final PlaceRequest place);\n\n    void closeAllPlaces();\n\n    void forceCloseAllPlaces();\n\n    boolean closeAllPlacesOrNothing();\n\n    boolean canClosePlace(PlaceRequest place);\n\n    boolean canCloseAllPlaces();\n\n    /**\n     * @return All opened PlaceRequests that cannot be closed (@onMayClose method returns false).\n     */\n    List<PlaceRequest> getUncloseablePlaces();\n\n    void registerOnOpenCallback(PlaceRequest place,\n                                Command callback);\n\n    void unregisterOnOpenCallbacks(PlaceRequest place);\n\n    void registerOnCloseCallback(PlaceRequest place,\n                                 Command callback);\n\n    void unregisterOnCloseCallbacks(PlaceRequest place);\n\n    /**\n     * Registers a callback interceptor that uses a chain approach to execute code before a PlaceRequest is closed,\n     * if the perspective passed as a parameter is currently opened. It will not be executed in the case of a forced close.\n     * @param perspectiveIdentifier Perspective identifier for which the close chain must be called when it is being closed.\n     * @param closeChain Callback to be called when a PlaceRequest is being closed. The callback command must invoke the chain\n     * to proceed with the closing operation.\n     */\n    void registerPerspectiveCloseChain(String perspectiveIdentifier,\n                                       BiParameterizedCommand<Command, PlaceRequest> closeChain);\n\n    @JsIgnore\n    Collection<SplashScreenActivity> getActiveSplashScreens();\n\n    /**\n     * Finds the <i>currently open</i> PlaceRequests for Activities that handle the given ResourceTypeDefinition.\n     *\n     * @param type the ResourceTypeDefinition whose activity to search for\n     * @return an unmodifiable collection of PlaceRequests for the <i>currently open</i> WorkbenchEditorActivities that\n     * can handle the ResourceTypeDefinition. Returns an empty collection if no match was found.\n     */\n    @JsIgnore\n    Collection<PathPlaceRequest> getActivitiesForResourceType(final ResourceTypeDefinition type);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport java.util.function.Predicate;\nimport java.util.function.Supplier;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.web.bindery.event.shared.EventBus;\nimport com.google.web.bindery.event.shared.SimpleEventBus;\nimport jsinterop.annotations.JsMethod;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.SharedSingleton;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.menu.SplashScreenMenuPresenter;\nimport org.uberfire.client.mvp.ActivityLifecycleError.LifecyclePhase;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.events.BeforeClosePlaceEvent;\nimport org.uberfire.client.workbench.events.ClosePlaceEvent;\nimport org.uberfire.client.workbench.events.NewSplashScreenActiveEvent;\nimport org.uberfire.client.workbench.events.PlaceGainFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceLostFocusEvent;\nimport org.uberfire.client.workbench.events.SelectPlaceEvent;\nimport org.uberfire.client.workbench.panels.impl.UnanchoredStaticWorkbenchPanelPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.BiParameterizedCommand;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.Commands;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ConditionalPlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.ForcedPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.CustomPanelDefinition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport static java.util.Collections.unmodifiableCollection;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\nimport static org.uberfire.plugin.PluginUtil.toInteger;\n\n@SharedSingleton\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class PlaceManagerImpl implements PlaceManager {\n\n    /**\n     * Activities that have been created by us but not destroyed (TODO: move this state tracking to ActivityManager!).\n     */\n    private final Map<PlaceRequest, Activity> existingWorkbenchActivities = new HashMap<PlaceRequest, Activity>();\n\n    /**\n     * Places that are currently open in the current perspective.\n     */\n    private final Map<PlaceRequest, PartDefinition> visibleWorkbenchParts = new HashMap<PlaceRequest, PartDefinition>();\n\n    /**\n     * Custom panels we have opened but not yet closed.\n     */\n    private final Map<PlaceRequest, CustomPanelDefinition> customPanels = new HashMap<>();\n\n    private final Map<PlaceRequest, List<Command>> onOpenCallbacks = new HashMap<>();\n    private final Map<PlaceRequest, List<Command>> onCloseCallbacks = new HashMap<>();\n    private final Map<String, BiParameterizedCommand<Command, PlaceRequest>> perspectiveCloseChain = new HashMap<>();\n    /**\n     * Splash screens that have intercepted some other activity which is currently part of the workbench. Each of these\n     * splash screens may or may not be visible (they manage their own \"show next time\" preferences).\n     */\n    private final Map<String, SplashScreenActivity> availableSplashScreens = new HashMap<String, SplashScreenActivity>();\n    private final Map<String, PopupActivity> activePopups = new HashMap<String, PopupActivity>();\n    private final Map<PlaceRequest, Activity> onMayCloseList = new HashMap<PlaceRequest, Activity>();\n    private EventBus tempBus = null;\n    @Inject\n    private Event<BeforeClosePlaceEvent> workbenchPartBeforeCloseEvent;\n    @Inject\n    private Event<ClosePlaceEvent> workbenchPartCloseEvent;\n    @Inject\n    private Event<NewSplashScreenActiveEvent> newSplashScreenActiveEvent;\n    @Inject\n    private ActivityManager activityManager;\n    @Inject\n    private PlaceHistoryHandler placeHistoryHandler;\n    @Inject\n    private Event<SelectPlaceEvent> selectWorkbenchPartEvent;\n    @Inject\n    private PanelManager panelManager;\n    @Inject\n    private PerspectiveManager perspectiveManager;\n    @Inject\n    private ActivityLifecycleErrorHandler lifecycleErrorHandler;\n    private WorkbenchLayout workbenchLayout;\n    @Inject\n    private LayoutSelection layoutSelection;\n    @Inject\n    private ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n    @Inject\n    private AppFormerActivityLoader appFormerActivityLoader;\n\n    public interface AppFormerActivityLoader {\n        boolean triggerLoadOfMatchingEditors(final Path path, final Runnable callback);\n    }\n\n    @PostConstruct\n    public void initPlaceHistoryHandler() {\n        getPlaceHistoryHandler().initialize(this,\n                                            produceEventBus(),\n                                            DefaultPlaceRequest.NOWHERE);\n        workbenchLayout = layoutSelection.get();\n    }\n\n    private PlaceHistoryHandler getPlaceHistoryHandler() {\n        return placeHistoryHandler;\n    }\n\n    @Override\n    public void goTo(final String identifier,\n                     final PanelDefinition panel) {\n        final DefaultPlaceRequest place = new DefaultPlaceRequest(identifier);\n        goTo(place,\n             panel);\n    }\n\n    @Override\n    public void goTo(final String identifier) {\n        final DefaultPlaceRequest place = new DefaultPlaceRequest(identifier);\n        goTo(place,\n             (PanelDefinition) null);\n    }\n\n    @Override\n    public void goTo(PlaceRequest place) {\n        goTo(place,\n             (PanelDefinition) null);\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PanelDefinition panel) {\n        goTo(new PathPlaceRequest(path),\n             panel);\n    }\n\n    @Override\n    public void goTo(final Path path) {\n        goTo(new PathPlaceRequest(path),\n             (PanelDefinition) null);\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PlaceRequest placeRequest,\n                     final PanelDefinition panel) {\n        goTo(getPlace(path,\n                      placeRequest),\n             panel);\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PlaceRequest placeRequest) {\n        goTo(getPlace(path,\n                      placeRequest),\n             (PanelDefinition) null);\n    }\n\n    @Override\n    public void goTo(final PlaceRequest place,\n                     final PanelDefinition panel) {\n        goTo(place,\n             panel,\n             Commands.DO_NOTHING);\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HasWidgets addTo) {\n\n        closeOpenPlacesAt(panelsOfThisHasWidgets(addTo));\n        goToTargetPanel(place,\n                        panelManager.addCustomPanel(addTo,\n                                                    UnanchoredStaticWorkbenchPanelPresenter.class.getName()));\n    }\n\n    @Override\n    public void goTo(final String id,\n                     final HTMLElement addTo) {\n        final DefaultPlaceRequest place = new DefaultPlaceRequest(id);\n        goTo(place, addTo);\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HTMLElement addTo) {\n\n        closeOpenPlacesAt(panelsOfThisHTMLElement(addTo));\n\n        goToTargetPanel(place,\n                        panelManager.addCustomPanel(addTo,\n                                                    UnanchoredStaticWorkbenchPanelPresenter.class.getName()));\n    }\n\n    @Override\n    public void goTo(final PlaceRequest place,\n                     final elemental2.dom.HTMLElement addTo) {\n        closeOpenPlacesAt(panelsOfThisHTMLElement(addTo));\n\n        goToTargetPanel(place,\n                        panelManager.addCustomPanel(addTo,\n                                                    UnanchoredStaticWorkbenchPanelPresenter.class.getName()));\n    }\n\n    private void closeOpenPlacesAt(Predicate<CustomPanelDefinition> filterPanels) {\n        new HashSet<>(customPanels.values()).stream()\n                .filter(filterPanels)\n                .flatMap(p -> p.getParts().stream())\n                .forEach(part -> closePlace(part.getPlace()));\n    }\n\n    private Predicate<CustomPanelDefinition> panelsOfThisHTMLElement(HTMLElement addTo) {\n        return p -> p.getHtmlElementContainer().isPresent() && p.getHtmlElementContainer().get().equals(addTo);\n    }\n\n    private Predicate<CustomPanelDefinition> panelsOfThisHasWidgets(HasWidgets addTo) {\n        return p -> p.getHasWidgetsContainer().isPresent() && p.getHasWidgetsContainer().get().equals(addTo);\n    }\n\n    private Predicate<CustomPanelDefinition> panelsOfThisHTMLElement(elemental2.dom.HTMLElement addTo) {\n        return p -> p.getElemental2HtmlElementContainer().isPresent() && p.getElemental2HtmlElementContainer().get().equals(addTo);\n    }\n\n    private void goToTargetPanel(final PlaceRequest place,\n                                 final CustomPanelDefinition adoptedPanel) {\n        if (existingWorkbenchActivities.containsKey(place)) {\n            // if already open, behaviour is to select the place where it already lives\n            goTo(place,\n                 null,\n                 Commands.DO_NOTHING);\n        } else {\n            customPanels.put(place,\n                             adoptedPanel);\n            goTo(place,\n                 adoptedPanel,\n                 Commands.DO_NOTHING);\n        }\n    }\n\n    private void goTo(final PlaceRequest place,\n                      final PanelDefinition panel,\n                      final Command doWhenFinished) {\n        if (place == null || place.equals(DefaultPlaceRequest.NOWHERE)) {\n            return;\n        }\n\n        final ResolvedRequest resolved = resolveActivity(place);\n\n        if (resolved.getActivity() != null) {\n            final Activity activity = resolved.getActivity();\n            if (activity.isType(ActivityResourceType.SCREEN.name()) || activity.isType(ActivityResourceType.EDITOR.name())) {\n                final WorkbenchActivity workbenchActivity = (WorkbenchActivity) activity;\n\n                // check if we need to open the owning perspective before launching this screen/editor\n                if (workbenchActivity.getOwningPlace() != null && getStatus(workbenchActivity.getOwningPlace()) == PlaceStatus.CLOSE) {\n                    goTo(workbenchActivity.getOwningPlace(),\n                         null,\n                         new Command() {\n                             @Override\n                             public void execute() {\n                                 goTo(place,\n                                      panel,\n                                      doWhenFinished);\n                             }\n                         });\n                    return;\n                }\n                launchWorkbenchActivityAtPosition(resolved.getPlaceRequest(),\n                                                  workbenchActivity,\n                                                  workbenchActivity.getDefaultPosition(),\n                                                  panel);\n                doWhenFinished.execute();\n            } else if (activity.isType(ActivityResourceType.POPUP.name())) {\n                launchPopupActivity(resolved.getPlaceRequest(),\n                                    (PopupActivity) activity);\n                doWhenFinished.execute();\n            } else if (activity.isType(ActivityResourceType.PERSPECTIVE.name())) {\n                launchPerspectiveActivity(place,\n                                          doWhenFinished,\n                                          (PerspectiveActivity) activity);\n            }\n        } else {\n            goTo(resolved.getPlaceRequest(),\n                 panel,\n                 doWhenFinished);\n        }\n    }\n\n    private void launchPerspectiveActivity(final PlaceRequest place,\n                                           final Command doWhenFinished,\n                                           final PerspectiveActivity activity) {\n        final Command launchPerspectiveCommand = () -> {\n            placeHistoryHandler.flush();\n            launchPerspectiveActivity(place,\n                                      activity,\n                                      doWhenFinished);\n        };\n\n        final PerspectiveActivity currentPerspective = perspectiveManager.getCurrentPerspective();\n        final boolean thereIsAnOpenedPerspective = currentPerspective != null;\n        final boolean isDifferentPerspective = thereIsAnOpenedPerspective && !place.equals(currentPerspective.getPlace());\n        final boolean isForcedPlaceRequest = place instanceof ForcedPlaceRequest;\n\n        // Before launching the perspective, checks if there is some close chain to be executed for the current perspective\n        if (thereIsAnOpenedPerspective && (isDifferentPerspective || isForcedPlaceRequest)) {\n            final BiParameterizedCommand<Command, PlaceRequest> closeChain = this.perspectiveCloseChain.get(currentPerspective.getIdentifier());\n            if (closeChain != null) {\n                closeChain.execute(launchPerspectiveCommand,\n                                   currentPerspective.getPlace());\n            } else {\n                launchPerspectiveCommand.execute();\n            }\n        } else {\n            launchPerspectiveCommand.execute();\n        }\n    }\n\n    private boolean closePlaces(final Collection<PlaceRequest> placeRequests) {\n        boolean result = true;\n        for (final PlaceRequest placeRequest : placeRequests) {\n            final Activity activity = existingWorkbenchActivities.get(placeRequest);\n            if (activity != null && (activity.isType(ActivityResourceType.SCREEN.name()) || activity.isType(ActivityResourceType.EDITOR.name()))) {\n                if (((WorkbenchActivity) activity).onMayClose()) {\n                    onMayCloseList.put(placeRequest,\n                                       activity);\n                } else {\n                    result = false;\n                    break;\n                }\n            }\n        }\n\n        if (!result) {\n            onMayCloseList.clear();\n        } else {\n            for (final PlaceRequest placeRequest : placeRequests) {\n                closePlace(placeRequest);\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * Resolves the given place request into an Activity instance, if one can be found. If not, this method substitutes\n     * special \"not found\" or \"too many\" place requests when the resolution doesn't work.\n     * <p/>\n     * The behaviour of this method is affected by the boolean-valued\n     * {@code org.uberfire.client.mvp.PlaceManagerImpl.ignoreUnkownPlaces} property in {@link UberfirePreferences}.\n     * @param place A non-null place request that could have originated from within application code, from within the\n     * framework, or by parsing a hash fragment from a browser history event.\n     * @param lazyLoadingSuccessCallback\n     * @return a non-null ResolvedRequest, where:\n     * <ul>\n     * <li>the Activity value is either the unambiguous resolved Activity instance, or null if the activity was\n     * not resolvable; in this case, the Activity has been added to the {@link #existingWorkbenchActivities} map.\n     * <li>if there is an Activity value, the PlaceRequest represents that Activity; otherwise\n     * it is a substitute PlaceRequest that should be navigated to recursively (ultimately by another call to\n     * this method). The PlaceRequest is never null.\n     * </ul>\n     * TODO (UF-94) : make this simpler. with enough tests in place, we should experiment with doing the recursive\n     * lookup automatically.\n     */\n    private ResolvedRequest resolveActivity(final PlaceRequest place) {\n\n        final PlaceRequest resolvedPlaceRequest = resolvePlaceRequest(place);\n\n        final ResolvedRequest existingDestination = resolveExistingParts(resolvedPlaceRequest);\n\n        if (existingDestination != null) {\n            return existingDestination;\n        }\n\n        if (appFormerActivityLoader.triggerLoadOfMatchingEditors(place.getPath(), () -> closeLazyLoadingScreenAndGoToPlace(place))) {\n            return new ResolvedRequest(null, new DefaultPlaceRequest(\"LazyLoadingScreen\"));\n        }\n\n        final Set<Activity> activities = activityManager.getActivities(resolvedPlaceRequest);\n\n        if (activities == null || activities.size() == 0) {\n            final PlaceRequest notFoundPopup = new DefaultPlaceRequest(\"workbench.activity.notfound\");\n            notFoundPopup.addParameter(\"requestedPlaceIdentifier\",\n                                       resolvedPlaceRequest.getIdentifier());\n\n            if (activityManager.containsActivity(notFoundPopup)) {\n                return new ResolvedRequest(null,\n                                           notFoundPopup);\n            } else {\n                final PlaceRequest ufNotFoundPopup = new DefaultPlaceRequest(\"uf.workbench.activity.notfound\");\n                ufNotFoundPopup.addParameter(\"requestedPlaceIdentifier\",\n                                             place.getIdentifier());\n                return new ResolvedRequest(null,\n                                           ufNotFoundPopup);\n            }\n        } else if (activities.size() > 1) {\n            final PlaceRequest multiplePlaces = new DefaultPlaceRequest(\"workbench.activities.multiple\").addParameter(\"requestedPlaceIdentifier\",\n                                                                                                                      null);\n\n            return new ResolvedRequest(null,\n                                       multiplePlaces);\n        }\n\n        Activity unambigousActivity = activities.iterator().next();\n        existingWorkbenchActivities.put(resolvedPlaceRequest,\n                                        unambigousActivity);\n        return new ResolvedRequest(unambigousActivity,\n                                   resolvedPlaceRequest);\n    }\n\n    private void closeLazyLoadingScreenAndGoToPlace(final PlaceRequest place) {\n        this.closePlace(new DefaultPlaceRequest(\"LazyLoadingScreen\"), () -> this.goTo(place));\n    }\n\n    private PlaceRequest resolvePlaceRequest(PlaceRequest place) {\n        if (isaConditionalPlaceRequest(place)) {\n            return resolveConditionalPlaceRequest((ConditionalPlaceRequest) place);\n        }\n        return place;\n    }\n\n    private PlaceRequest resolveConditionalPlaceRequest(ConditionalPlaceRequest conditionalPlaceRequest) {\n        return conditionalPlaceRequest.resolveConditionalPlaceRequest();\n    }\n\n    private boolean isaConditionalPlaceRequest(PlaceRequest place) {\n        return place instanceof ConditionalPlaceRequest;\n    }\n\n    private ResolvedRequest resolveExistingParts(final PlaceRequest place) {\n        final Activity activity = getActivity(place);\n\n        if (activity != null) {\n            return new ResolvedRequest(activity,\n                                       place);\n        }\n\n        if (place instanceof PathPlaceRequest) {\n            final ObservablePath path = ((PathPlaceRequest) place).getPath();\n\n            for (final Map.Entry<PlaceRequest, PartDefinition> entry : visibleWorkbenchParts.entrySet()) {\n                final PlaceRequest pr = entry.getKey();\n                if (pr instanceof PathPlaceRequest) {\n                    final Path visiblePath = ((PathPlaceRequest) pr).getPath();\n                    final String visiblePathURI = visiblePath.toURI();\n                    if ((visiblePathURI != null && visiblePathURI.compareTo(path.toURI()) == 0) || visiblePath.compareTo(path) == 0) {\n                        return new ResolvedRequest(getActivity(pr),\n                                                   pr);\n                    }\n                }\n            }\n        }\n\n        return null;\n    }\n\n    @Override\n    public void goTo(final PartDefinition part,\n                     final PanelDefinition panel) {\n        final PlaceRequest place = part.getPlace();\n        if (place == null) {\n            return;\n        }\n\n        final ResolvedRequest resolved = resolveActivity(place);\n\n        if (resolved.getActivity() != null) {\n            final Activity activity = resolved.getActivity();\n\n            if (activity.isType(ActivityResourceType.EDITOR.name()) ||\n                    activity.isType(ActivityResourceType.CLIENT_EDITOR.name()) ||\n                    activity.isType(ActivityResourceType.SCREEN.name())) {\n                final WorkbenchActivity workbenchActivity = (WorkbenchActivity) activity;\n                launchWorkbenchActivityInPanel(place,\n                                               workbenchActivity,\n                                               part,\n                                               panel);\n            } else {\n                throw new IllegalArgumentException(\"placeRequest does not represent a WorkbenchActivity. Only WorkbenchActivities can be launched in a specific targetPanel.\");\n            }\n        } else {\n            goTo(resolved.getPlaceRequest());\n        }\n    }\n\n    private PlaceRequest getPlace(final Path path,\n                                  final PlaceRequest placeRequest) {\n        final PlaceRequest request = new PathPlaceRequest(path);\n\n        for (final String name : ensureIterable(placeRequest.getParameterNames())) {\n            request.addParameter(name,\n                                 placeRequest.getParameters().get(name));\n        }\n\n        return request;\n    }\n\n    @Override\n    public Activity getActivity(final PlaceRequest place) {\n        if (place == null) {\n            return null;\n        }\n        final Activity activity = existingWorkbenchActivities.get(place);\n        return activity;\n    }\n\n    @Override\n    public PlaceStatus getStatus(String id) {\n        return getStatus(new DefaultPlaceRequest(id));\n    }\n\n    @Override\n    public PlaceStatus getStatus(final PlaceRequest place) {\n        PerspectiveActivity currentPerspective = perspectiveManager.getCurrentPerspective();\n        if (currentPerspective != null && currentPerspective.getPlace().equals(place)) {\n            return PlaceStatus.OPEN;\n        }\n        return resolveExistingParts(place) != null ? PlaceStatus.OPEN : PlaceStatus.CLOSE;\n    }\n\n    @JsMethod\n    @Override\n    public void closePlace(final String id) {\n        closePlace(new DefaultPlaceRequest(id));\n    }\n\n    @JsMethod\n    @Override\n    public void closePlace(final PlaceRequest placeToClose) {\n        if (placeToClose == null) {\n            return;\n        }\n        closePlace(placeToClose,\n                   false);\n    }\n\n    @Override\n    public void closePlace(final PlaceRequest placeToClose,\n                           final Command doAfterClose) {\n        if (placeToClose == null) {\n            return;\n        }\n        closePlace(placeToClose,\n                   false,\n                   doAfterClose);\n    }\n\n    @Override\n    public void tryClosePlace(final PlaceRequest placeToClose,\n                              final Command onAfterClose) {\n        boolean execute = false;\n        if (placeToClose == null) {\n            execute = true;\n        } else {\n            execute = closePlaces(Arrays.asList(placeToClose));\n        }\n\n        if (execute) {\n            onAfterClose.execute();\n        }\n    }\n\n    @Override\n    public void forceClosePlace(final String id) {\n        forceClosePlace(new DefaultPlaceRequest(id));\n    }\n\n    @Override\n    public void forceClosePlace(final PlaceRequest placeToClose) {\n        if (placeToClose == null) {\n            return;\n        }\n        closePlace(placeToClose,\n                   true);\n    }\n\n    @Override\n    public void closeAllPlaces() {\n        closeAllPlaces(false);\n    }\n\n    @Override\n    public void forceCloseAllPlaces() {\n        closeAllPlaces(true);\n    }\n\n    private void closeAllPlaces(final boolean force) {\n        final List<PlaceRequest> placesToClose = new ArrayList<PlaceRequest>(visibleWorkbenchParts.keySet());\n        for (PlaceRequest placeToClose : placesToClose) {\n            closePlace(placeToClose,\n                       force);\n        }\n    }\n\n    @Override\n    public boolean closeAllPlacesOrNothing() {\n        final List<PlaceRequest> placesToClose = new ArrayList<>(visibleWorkbenchParts.keySet());\n        for (PlaceRequest placeToClose : placesToClose) {\n            if (!canClosePlace(placeToClose)) {\n                return false;\n            }\n        }\n\n        forceCloseAllPlaces();\n        return true;\n    }\n\n    @Override\n    public List<PlaceRequest> getUncloseablePlaces() {\n        final Set<PlaceRequest> placesToClose = visibleWorkbenchParts.keySet();\n        final List<PlaceRequest> uncloseablePlaces = new ArrayList<>();\n\n        for (PlaceRequest place : placesToClose) {\n            if (!canClosePlace(place)) {\n                uncloseablePlaces.add(place);\n            }\n        }\n\n        return uncloseablePlaces;\n    }\n\n    private boolean closeAllCurrentPanels() {\n        return closePlaces(new ArrayList<PlaceRequest>(visibleWorkbenchParts.keySet()));\n    }\n\n    @Override\n    public void registerOnOpenCallback(final PlaceRequest place,\n                                       final Command callback) {\n        checkNotNull(\"place\",\n                     place);\n        checkNotNull(\"callback\",\n                     callback);\n\n        List<Command> callbacks = getOnOpenCallbacks(place);\n        if (callbacks == null) {\n            callbacks = new ArrayList<>();\n            this.onOpenCallbacks.put(place,\n                                     callbacks);\n        }\n\n        callbacks.add(callback);\n    }\n\n    @Override\n    public void unregisterOnOpenCallbacks(final PlaceRequest place) {\n        checkNotNull(\"place\",\n                     place);\n        this.onOpenCallbacks.remove(place);\n    }\n\n    @Override\n    public void registerOnCloseCallback(final PlaceRequest place,\n                                        final Command callback) {\n        checkNotNull(\"place\",\n                     place);\n        checkNotNull(\"callback\",\n                     callback);\n\n        List<Command> callbacks = getOnCloseCallbacks(place);\n        if (callbacks == null) {\n            callbacks = new ArrayList<>();\n            this.onCloseCallbacks.put(place,\n                                      callbacks);\n        }\n\n        callbacks.add(callback);\n    }\n\n    @Override\n    public void unregisterOnCloseCallbacks(final PlaceRequest place) {\n        checkNotNull(\"place\",\n                     place);\n        this.onCloseCallbacks.remove(place);\n    }\n\n    @Override\n    public void registerPerspectiveCloseChain(final String perspectiveIdentifier,\n                                              final BiParameterizedCommand<Command, PlaceRequest> closeChain) {\n        checkNotNull(\"perspectiveIdentifier\",\n                     perspectiveIdentifier);\n        checkNotNull(\"closeChain\",\n                     closeChain);\n\n        perspectiveCloseChain.put(perspectiveIdentifier,\n                                  closeChain);\n    }\n\n    /**\n     * Finds and opens the splash screen for the given place, if such a splash screen exists. The splash screen might\n     * not actually display; each splash screen keeps track of its own preference setting for whether or not the user\n     * wants to see it.\n     * <p/>\n     * Whether or not it chooses to display itself, the splash screen will be recorded in\n     * {@link #availableSplashScreens} for lookup (for example, see {@link SplashScreenMenuPresenter}) and later disposal.\n     * Internally, this method should be called every time any part or perspective is added to the workbench, and called\n     * again when that part or perspective is removed.\n     * @param place the place that has just been added to the workbench. Must not be null.\n     */\n    private void addSplashScreenFor(final PlaceRequest place) {\n        final SplashScreenActivity splashScreen = activityManager.getSplashScreenInterceptor(place);\n        if (splashScreen != null) {\n            availableSplashScreens.put(place.getIdentifier(),\n                                       splashScreen);\n            try {\n                splashScreen.onOpen();\n            } catch (Exception ex) {\n                availableSplashScreens.remove(place.getIdentifier());\n                lifecycleErrorHandler.handle(splashScreen,\n                                             LifecyclePhase.OPEN,\n                                             ex);\n                activityManager.destroyActivity(splashScreen);\n                return;\n            }\n        }\n        newSplashScreenActiveEvent.fire(new NewSplashScreenActiveEvent());\n    }\n\n    /**\n     * Closes the splash screen associated with the given place request, if any. Internally, this method should be\n     * invoked every time a part or perspective is removed from the workbench (cleaning up after the corresponding\n     * earlier call to {@link #addSplashScreenFor(PlaceRequest)}.\n     * @param place the place whose opening may have triggered a splash screen to launch. Must not be null.\n     */\n    private void closeSplashScreen(final PlaceRequest place) {\n        SplashScreenActivity splashScreenActivity = availableSplashScreens.remove(place.getIdentifier());\n        if (splashScreenActivity != null) {\n            try {\n                splashScreenActivity.closeIfOpen();\n            } catch (Exception ex) {\n                lifecycleErrorHandler.handle(splashScreenActivity,\n                                             LifecyclePhase.CLOSE,\n                                             ex);\n            }\n            activityManager.destroyActivity(splashScreenActivity);\n            newSplashScreenActiveEvent.fire(new NewSplashScreenActiveEvent());\n        }\n    }\n\n    /**\n     * Closes all splash screens that are currently known to be open.\n     */\n    private void closeAllSplashScreens() {\n        for (String placeId : new ArrayList<String>(availableSplashScreens.keySet())) {\n            closeSplashScreen(new DefaultPlaceRequest(placeId));\n        }\n    }\n\n    @Override\n    public Collection<SplashScreenActivity> getActiveSplashScreens() {\n        return unmodifiableCollection(availableSplashScreens.values());\n    }\n\n    @Override\n    public Collection<PathPlaceRequest> getActivitiesForResourceType(final ResourceTypeDefinition type) {\n        final ArrayList<PathPlaceRequest> activities = new ArrayList<>();\n        for (final PlaceRequest placeRequest : existingWorkbenchActivities.keySet()) {\n            if (placeRequest instanceof PathPlaceRequest) {\n                final PathPlaceRequest ppr = (PathPlaceRequest) placeRequest;\n                if (type.accept(ppr.getPath())) {\n                    activities.add(ppr);\n                }\n            }\n        }\n        return unmodifiableCollection(activities);\n    }\n\n    /**\n     * Returns all the PlaceRequests that map to activies that are currently in the open state and accessible\n     * somewhere in the current perspective.\n     * @return an unmodifiable view of the current active place requests. This view may or may not update after\n     * further calls into PlaceManager that modify the workbench state. It's best not to hold on to the returned\n     * set; instead, call this method again for current information.\n     */\n    public Collection<PlaceRequest> getActivePlaceRequests() {\n        return unmodifiableCollection(existingWorkbenchActivities.keySet());\n    }\n\n    /**\n     * Returns all the PathPlaceRequests that map to activies that are currently in the open state and accessible\n     * somewhere in the current perspective.\n     * @return an unmodifiable view of the current active place requests. This view may or may not update after\n     * further calls into PlaceManager that modify the workbench state. It's best not to hold on to the returned\n     * set; instead, call this method again for current information.\n     */\n    public Collection<PathPlaceRequest> getActivePlaceRequestsWithPath() {\n        ArrayList<PathPlaceRequest> pprs = new ArrayList<PathPlaceRequest>();\n        for (final PlaceRequest placeRequest : existingWorkbenchActivities.keySet()) {\n            if (placeRequest instanceof PathPlaceRequest) {\n                pprs.add((PathPlaceRequest) placeRequest);\n            }\n        }\n        return pprs;\n    }\n\n    private void launchWorkbenchActivityAtPosition(final PlaceRequest place,\n                                                   final WorkbenchActivity activity,\n                                                   final Position position,\n                                                   final PanelDefinition _panel) {\n\n        if (visibleWorkbenchParts.containsKey(place)) {\n            selectWorkbenchPartEvent.fire(new SelectPlaceEvent(place));\n            return;\n        }\n\n        final PartDefinition part = new PartDefinitionImpl(place);\n        final PanelDefinition panel;\n        if (_panel != null) {\n            panel = _panel;\n        } else {\n            panel = panelManager.addWorkbenchPanel(panelManager.getRoot(),\n                                                   position,\n                                                   activity.preferredHeight(),\n                                                   activity.preferredWidth(),\n                                                   null,\n                                                   null);\n        }\n\n        launchWorkbenchActivityInPanel(place,\n                                       activity,\n                                       part,\n                                       panel);\n    }\n\n    private void launchWorkbenchActivityInPanel(final PlaceRequest place,\n                                                final WorkbenchActivity activity,\n                                                final PartDefinition part,\n                                                final PanelDefinition panel) {\n        if (visibleWorkbenchParts.containsKey(place)) {\n            selectWorkbenchPartEvent.fire(new SelectPlaceEvent(place));\n            return;\n        }\n\n        visibleWorkbenchParts.put(place,\n                                  part);\n\n        final IsWidget titleDecoration = maybeWrapExternalWidget(activity,\n                                                                 () -> activity.getTitleDecorationElement(),\n                                                                 () -> activity.getTitleDecoration());\n\n        final IsWidget widget = maybeWrapExternalWidget(activity,\n                                                        () -> activity.getWidgetElement(),\n                                                        () -> activity.getWidget());\n\n        final UIPart uiPart = new UIPart(activity.getTitle(),\n                                         titleDecoration,\n                                         widget);\n\n        activity.getMenus(menus -> {\n            panelManager.addWorkbenchPart(place,\n                                          part,\n                                          panel,\n                                          menus,\n                                          uiPart,\n                                          activity.contextId(),\n                                          toInteger(panel.getWidthAsInt()),\n                                          toInteger(panel.getHeightAsInt()));\n            addSplashScreenFor(place);\n\n            try {\n                activity.onOpen();\n                getPlaceHistoryHandler().registerOpen(activity,\n                                                      place);\n            } catch (Exception ex) {\n                lifecycleErrorHandler.handle(activity,\n                                             LifecyclePhase.OPEN,\n                                             ex);\n                closePlace(place);\n            }\n        });\n    }\n\n    private IsWidget maybeWrapExternalWidget(WorkbenchActivity activity,\n                                             Supplier<Element> element,\n                                             Supplier<IsWidget> widget) {\n\n        if (activity.isDynamic()) {\n            final Element e = element.get();\n            return (e == null) ? null : ElementWrapperWidget.getWidget(e);\n        }\n\n        return widget.get();\n    }\n\n    private void launchPopupActivity(final PlaceRequest place,\n                                     final PopupActivity activity) {\n\n        if (activePopups.get(place.getIdentifier()) != null) {\n            return;\n        }\n\n        activePopups.put(place.getIdentifier(),\n                         activity);\n\n        try {\n            activity.onOpen();\n            getPlaceHistoryHandler().registerOpen(activity,\n                                                  place);\n        } catch (Exception ex) {\n            activePopups.remove(place.getIdentifier());\n            lifecycleErrorHandler.handle(activity,\n                                         LifecyclePhase.OPEN,\n                                         ex);\n        }\n    }\n\n    /**\n     * Before launching the perspective we check that it isn't already open by asking the\n     * placeHistory service to extract the perspective encoded in the URL\n     * @param place\n     * @param activity\n     * @param doWhenFinished\n     */\n    private void launchPerspectiveActivity(final PlaceRequest place,\n                                           final PerspectiveActivity activity,\n                                           final Command doWhenFinished) {\n\n        checkNotNull(\"doWhenFinished\",\n                     doWhenFinished);\n\n        if (place instanceof ForcedPlaceRequest) {\n            switchToPerspective(place,\n                                activity,\n                                new ParameterizedCommand<PerspectiveDefinition>() {\n                                    @Override\n                                    public void execute(PerspectiveDefinition perspectiveDef) {\n                                        openPartsRecursively(perspectiveDef.getRoot());\n                                        doWhenFinished.execute();\n                                        workbenchLayout.onResize();\n                                    }\n                                });\n        } else {\n            final PerspectiveActivity oldPerspectiveActivity = perspectiveManager.getCurrentPerspective();\n            if (oldPerspectiveActivity != null && place.equals(oldPerspectiveActivity.getPlace())) {\n                return;\n            }\n\n            perspectiveManager.savePerspectiveState(new Command() {\n                @Override\n                public void execute() {\n                    // first try to open the new perspective, so we can avoid leaving the user on a blank screen if the onOpen() method fails\n                    try {\n                        activity.onOpen();\n                    } catch (Exception ex) {\n                        lifecycleErrorHandler.handle(activity,\n                                                     LifecyclePhase.OPEN,\n                                                     ex);\n                        try {\n                            activity.onClose();\n                        } catch (Exception ex2) {\n                            // not unexpected; probably happened because onOpen failed to complete\n                        }\n                        existingWorkbenchActivities.remove(place);\n                        activityManager.destroyActivity(activity);\n                        return;\n                    }\n\n                    switchToPerspective(place,\n                                        activity,\n                                        new ParameterizedCommand<PerspectiveDefinition>() {\n                                            @Override\n                                            public void execute(PerspectiveDefinition perspectiveDef) {\n                                                if (oldPerspectiveActivity != null) {\n                                                    try {\n                                                        oldPerspectiveActivity.onClose();\n                                                    } catch (Exception ex) {\n                                                        lifecycleErrorHandler.handle(oldPerspectiveActivity,\n                                                                                     LifecyclePhase.CLOSE,\n                                                                                     ex);\n                                                    }\n                                                    existingWorkbenchActivities.remove(oldPerspectiveActivity.getPlace());\n                                                    activityManager.destroyActivity(oldPerspectiveActivity);\n                                                }\n                                                openPartsRecursively(perspectiveDef.getRoot());\n                                                doWhenFinished.execute();\n                                                workbenchLayout.onResize();\n                                                placeHistoryHandler.registerOpen(activity,\n                                                                                 place);\n                                            }\n                                        });\n                }\n            });\n        }\n    }\n\n    private void switchToPerspective(final PlaceRequest place,\n                                     final PerspectiveActivity newPerspectiveActivity,\n                                     final ParameterizedCommand<PerspectiveDefinition> closeOldPerspectiveOpenPartsAndExecuteChainedCallback) {\n        if (closeAllCurrentPanels()) {\n            closeAllSplashScreens();\n            addSplashScreenFor(place);\n            perspectiveManager.switchToPerspective(place,\n                                                   newPerspectiveActivity,\n                                                   closeOldPerspectiveOpenPartsAndExecuteChainedCallback);\n        } else {\n\n            // some panels didn't want to close, so not going to launch new perspective. clean up its activity.\n            try {\n                newPerspectiveActivity.onClose();\n            } catch (Exception ex) {\n                lifecycleErrorHandler.handle(newPerspectiveActivity,\n                                             LifecyclePhase.OPEN,\n                                             ex);\n            }\n            existingWorkbenchActivities.remove(newPerspectiveActivity.getPlace());\n            activityManager.destroyActivity(newPerspectiveActivity);\n        }\n    }\n\n    /**\n     * Opens all the parts of the given panel and its subpanels. This is a subroutine of the perspective switching\n     * process.\n     */\n    private void openPartsRecursively(PanelDefinition panel) {\n\n        for (PartDefinition part : ensureIterable(panel.getParts())) {\n            activitiesAuthorizationManager.securePart(part, panel);\n            final PlaceRequest place = part.getPlace().clone();\n            part.setPlace(place);\n            goTo(part, panel);\n        }\n        for (PanelDefinition child : ensureIterable(panel.getChildren())) {\n            openPartsRecursively(child);\n        }\n    }\n\n    private void closePlace(final PlaceRequest place,\n                            final boolean force) {\n        closePlace(place,\n                   force,\n                   null);\n    }\n\n    private void closePlace(final PlaceRequest place,\n                            final boolean force,\n                            final Command onAfterClose) {\n\n        final Activity existingActivity = existingWorkbenchActivities.get(place);\n        if (existingActivity == null) {\n            return;\n        }\n\n        final Command closeCommand = getCloseCommand(place,\n                                                     force,\n                                                     onAfterClose);\n\n        if (force) {\n            closeCommand.execute();\n        } else {\n            final PerspectiveActivity currentPerspective = perspectiveManager.getCurrentPerspective();\n            final BiParameterizedCommand<Command, PlaceRequest> closeChain = this.perspectiveCloseChain.getOrDefault(currentPerspective.getIdentifier(),\n                                                                                                                     (chain, placeRequest) -> chain.execute());\n            closeChain.execute(closeCommand,\n                               place);\n        }\n    }\n\n    private Command getCloseCommand(final PlaceRequest place,\n                                    final boolean force,\n                                    final Command onAfterClose) {\n        return () -> {\n\n            final Activity activity = existingWorkbenchActivities.get(place);\n            if (activity == null) {\n                return;\n            }\n\n            workbenchPartBeforeCloseEvent.fire(new BeforeClosePlaceEvent(place,\n                                                                         force,\n                                                                         true));\n\n            closeSplashScreen(place);\n            activePopups.remove(place.getIdentifier());\n\n            if (activity.isType(ActivityResourceType.SCREEN.name()) || activity.isType(ActivityResourceType.EDITOR.name())) {\n                WorkbenchActivity activity1 = (WorkbenchActivity) activity;\n                if (force || onMayCloseList.containsKey(place) || activity1.onMayClose()) {\n                    onMayCloseList.remove(place);\n                    try {\n                        activity1.onClose();\n                    } catch (Exception ex) {\n                        lifecycleErrorHandler.handle(activity1,\n                                                     LifecyclePhase.CLOSE,\n                                                     ex);\n                    }\n                } else {\n                    return;\n                }\n            } else if (activity.isType(ActivityResourceType.POPUP.name())) {\n                PopupActivity activity1 = (PopupActivity) activity;\n                if (force || activity1.onMayClose()) {\n                    try {\n                        activity1.onClose();\n                    } catch (Exception ex) {\n                        lifecycleErrorHandler.handle(activity1,\n                                                     LifecyclePhase.CLOSE,\n                                                     ex);\n                    }\n                } else {\n                    return;\n                }\n            } else {\n                activity.onClose();\n            }\n\n            getPlaceHistoryHandler().registerClose(activity,\n                                                   place);\n            workbenchPartCloseEvent.fire(new ClosePlaceEvent(place));\n\n            panelManager.removePartForPlace(place);\n            existingWorkbenchActivities.remove(place);\n            visibleWorkbenchParts.remove(place);\n            activityManager.destroyActivity(activity);\n\n            // currently, we force all custom panels as Static panels, so they can only ever contain the one part we put in them.\n            // we are responsible for cleaning them up when their place closes.\n            PanelDefinition customPanelDef = customPanels.remove(place);\n            if (customPanelDef != null) {\n                panelManager.removeWorkbenchPanel(customPanelDef);\n            }\n\n            if (place instanceof PathPlaceRequest) {\n                ((PathPlaceRequest) place).getPath().dispose();\n            }\n\n            if (onAfterClose != null) {\n                onAfterClose.execute();\n            }\n        };\n    }\n\n    @Override\n    public boolean canClosePlace(final PlaceRequest place) {\n\n        final Activity activity = existingWorkbenchActivities.get(place);\n        if (activity == null) {\n            return false;\n        }\n\n        if (activity.isType(ActivityResourceType.SCREEN.name()) || activity.isType(ActivityResourceType.EDITOR.name())) {\n            WorkbenchActivity activity1 = (WorkbenchActivity) activity;\n            if (onMayCloseList.containsKey(place) || activity1.onMayClose()) {\n                return true;\n            }\n        } else if (activity.isType(ActivityResourceType.POPUP.name())) {\n            PopupActivity activity1 = (PopupActivity) activity;\n            if (activity1.onMayClose()) {\n                return true;\n            }\n        }\n\n        return false;\n    }\n\n    @Override\n    public boolean canCloseAllPlaces() {\n        return getUncloseablePlaces().isEmpty();\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onWorkbenchPartOnFocus(@Observes PlaceGainFocusEvent event) {\n        final PlaceRequest place = event.getPlace();\n        final Activity activity = getActivity(place);\n        if (activity == null) {\n            return;\n        }\n        if (activity instanceof WorkbenchActivity) {\n            ((WorkbenchActivity) activity).onFocus();\n        }\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onWorkbenchPartLostFocus(@Observes PlaceLostFocusEvent event) {\n        final Activity activity = getActivity(event.getPlace());\n        if (activity == null) {\n            return;\n        }\n        if (activity instanceof WorkbenchActivity) {\n            ((WorkbenchActivity) activity).onLostFocus();\n        }\n    }\n\n    @Produces\n    @ApplicationScoped\n    private EventBus produceEventBus() {\n        if (tempBus == null) {\n            tempBus = new SimpleEventBus();\n        }\n        return tempBus;\n    }\n\n    @Override\n    public List<Command> getOnOpenCallbacks(final PlaceRequest place) {\n        return this.onOpenCallbacks.get(place);\n    }\n\n    @Override\n    public List<Command> getOnCloseCallbacks(final PlaceRequest place) {\n        return this.onCloseCallbacks.get(place);\n    }\n\n    /**\n     * The result of an attempt to resolve a PlaceRequest to an Activity.\n     */\n    private static class ResolvedRequest {\n\n        private final Activity activity;\n        private final PlaceRequest placeRequest;\n\n        public ResolvedRequest(final Activity resolvedActivity,\n                               final PlaceRequest substitutePlace) {\n            this.activity = resolvedActivity;\n            this.placeRequest = substitutePlace;\n        }\n\n        public Activity getActivity() {\n            return activity;\n        }\n\n        public PlaceRequest getPlaceRequest() {\n            return placeRequest;\n        }\n\n        @Override\n        public boolean equals(final Object o) {\n            if (this == o) {\n                return true;\n            }\n            if (o == null || getClass() != o.getClass()) {\n                return false;\n            }\n\n            final ResolvedRequest resolvedRequest = (ResolvedRequest) o;\n\n            if (activity != null ? !activity.equals(resolvedRequest.activity) : resolvedRequest.activity != null) {\n                return false;\n            }\n            if (placeRequest != null ? !placeRequest.equals(resolvedRequest.placeRequest) : resolvedRequest.placeRequest != null) {\n                return false;\n            }\n\n            return true;\n        }\n\n        @Override\n        public int hashCode() {\n            int result = 0;\n            result = activity != null ? activity.hashCode() : 0;\n            result = 31 * result + (placeRequest != null ? placeRequest.hashCode() : 0);\n            return result;\n        }\n\n        @Override\n        public String toString() {\n            return \"{activity=\" + activity + \", placeRequest=\" + placeRequest + \"}\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceRequestHistoryMapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.mvp.PlaceRequest;\n\npublic interface PlaceRequestHistoryMapper {\n\n    /**\n     * Returns the {@link PlaceRequest} associated with the given token.\n     * @param token a String token\n     * @return a {@link PlaceRequest} instance\n     */\n    PlaceRequest getPlaceRequest(final String token);\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceRequestHistoryMapperImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.google.gwt.http.client.URL;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\npublic class PlaceRequestHistoryMapperImpl\n        implements\n        PlaceRequestHistoryMapper {\n\n    @Override\n    public PlaceRequest getPlaceRequest(String fullIdentifier) {\n        final String encodedIdentifier = fullIdentifier.contains(\"?\") ? fullIdentifier.substring(0,\n                                                                                                 fullIdentifier.indexOf(\"?\")) : fullIdentifier;\n        final String identifier = urlDecode(encodedIdentifier);\n        final String query = fullIdentifier.contains(\"?\") ? fullIdentifier.substring(fullIdentifier.indexOf(\"?\") + 1) : \"\";\n        final Map<String, String> parameters = getParameters(query);\n\n        final PlaceRequest placeRequest;\n        if (parameters.containsKey(\"path_uri\")) {\n            if (parameters.containsKey(\"has_version_support\")) {\n                placeRequest = new PathPlaceRequest(PathFactory.newPath(parameters.remove(\"file_name\"),\n                                                                        parameters.remove(\"path_uri\"),\n                                                                        new HashMap<String, Object>() {{\n                                                                            put(PathFactory.VERSION_PROPERTY,\n                                                                                Boolean.valueOf(parameters.remove(\"has_version_support\")));\n                                                                        }}),\n                                                    identifier);\n            } else {\n                placeRequest = new PathPlaceRequest(PathFactory.newPath(parameters.remove(\"file_name\"),\n                                                                        parameters.remove(\"path_uri\")),\n                                                    identifier);\n            }\n        } else {\n            placeRequest = new DefaultPlaceRequest(identifier);\n        }\n\n        for (String parameterName : parameters.keySet()) {\n            placeRequest.addParameter(parameterName,\n                                      parameters.get(parameterName));\n        }\n\n        return placeRequest;\n    }\n\n    private Map<String, String> getParameters(String query) {\n        final Map<String, String> parameters = new HashMap<String, String>();\n\n        if (query != null && !\"\".equalsIgnoreCase(query)) {\n            final List<String> parts = Arrays.asList(query.split(\"&\"));\n            for (String part : parts) {\n                int index = part.indexOf('=');\n                String name = null;\n                String value = null;\n                if (index == -1) {\n                    name = part;\n                    value = \"\";\n                } else {\n                    name = part.substring(0,\n                                          index);\n                    value = index < part.length() ? part.substring(index + 1) : \"\";\n                    value = urlDecode(value);\n                }\n                parameters.put(urlDecode(name),\n                               value);\n            }\n        }\n\n        return parameters;\n    }\n\n    String urlDecode(String value) {\n        return URL.decode(value);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PlaceStatus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport jsinterop.annotations.JsType;\n\n@JsType\npublic enum PlaceStatus {\n    OPEN,\n    CLOSE\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PluginActivityManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * This {@link ActivityManager} implementation is active for plugins only, to\n * satisfy compile-time dependencies (of other components on the plugin's\n * classpath that require an activity manager). Plugins don't get access to the\n * main application's {@link ActivityManager} as it would allow them to control\n * all activities of the application, not just their own.\n */\n@ApplicationScoped\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\")\npublic class PluginActivityManagerImpl implements ActivityManager {\n\n    private void fail() {\n        // Plugins should not be able to interact with the activity manager.\n        throw new RuntimeException(\"Invalid use of ActivityManager in plugin.\");\n    }\n\n    @Override\n    public <T extends Activity> Set<T> getActivities(final Class<T> clazz) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public SplashScreenActivity getSplashScreenInterceptor(final PlaceRequest placeRequest) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public Set<Activity> getActivities(final PlaceRequest placeRequest) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public boolean containsActivity(final PlaceRequest placeRequest) {\n        fail();\n        return false;\n    }\n\n    @Override\n    public Activity getActivity(final PlaceRequest placeRequest) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public <T extends Activity> T getActivity(final Class<T> clazz,\n                                              final PlaceRequest placeRequest) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public void destroyActivity(final Activity activity) {\n        fail();\n    }\n\n    @Override\n    public boolean isStarted(final Activity activity) {\n        fail();\n        return false;\n    }\n\n    @Override\n    public Set<Activity> getActivities(PlaceRequest placeRequest,\n                                       boolean secure) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public Activity getActivity(PlaceRequest placeRequest,\n                                boolean secure) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public <T extends Activity> T getActivity(Class<T> clazz,\n                                              PlaceRequest placeRequest,\n                                              boolean secure) {\n        fail();\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PluginPlaceManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.Collection;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.Shared;\nimport org.jboss.errai.ioc.client.api.SharedSingleton;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBar;\nimport org.uberfire.mvp.BiParameterizedCommand;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n/**\n * This {@link PlaceManager} implementation is active for plugins only, to\n * satisfy compile-time dependencies (of other components on the plugin's\n * classpath that require a place manager). It is not used at runtime as plugins\n * use the {@link SharedSingleton} {@link PlaceManager} provided by the main\n * application. Plugins get access to a fully functional {@link PlaceManager}\n * using @{@link Inject} @{@link Shared} {@link ShareablePlaceManager}.\n */\n@ApplicationScoped\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\")\npublic class PluginPlaceManagerImpl implements PlaceManager {\n\n    // Avoid pruning by aggressive reachability analysis in Errai\n    @SuppressWarnings(\"unused\")\n    @Inject\n    private WorkbenchLayout workbenchLayout;\n\n    // Avoid pruning by aggressive reachability analysis in Errai\n    @SuppressWarnings(\"unused\")\n    @Inject\n    private WorkbenchMenuBar menubar;\n\n    // Avoid pruning by aggressive reachability analysis in Errai\n    @SuppressWarnings(\"unused\")\n    @Inject\n    private ObservablePath path;\n\n    // Avoid pruning by aggressive reachability analysis in Errai\n    @SuppressWarnings(\"unused\")\n    @Inject\n    private LockManager lockManager;\n\n    private void fail() {\n        throw new RuntimeException(\"Invalid use of standard PlaceManager in plugin. \" +\n                                           \"Use @Inject @\" + Shared.class.getName() + \" \" +\n                                           PlaceManager.class.getName() + \" instead!\");\n    }\n\n    @Override\n    public void goTo(final String identifier,\n                     final PanelDefinition panel) {\n\n        fail();\n    }\n\n    @Override\n    public void goTo(final String identifier) {\n\n        fail();\n    }\n\n    @Override\n    public void goTo(PlaceRequest place) {\n\n        fail();\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PanelDefinition panel) {\n\n        fail();\n    }\n\n    @Override\n    public void goTo(final Path path) {\n        fail();\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PlaceRequest placeRequest,\n                     final PanelDefinition panel) {\n        fail();\n    }\n\n    @Override\n    public void goTo(final Path path,\n                     final PlaceRequest placeRequest) {\n        fail();\n    }\n\n    @Override\n    public void goTo(final PlaceRequest place,\n                     final PanelDefinition panel) {\n        fail();\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HasWidgets addTo) {\n        fail();\n    }\n\n    @Override\n    public void goTo(String id,\n                     HTMLElement addTo) {\n        fail();\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HTMLElement addTo) {\n        fail();\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     elemental2.dom.HTMLElement addTo) {\n        fail();\n    }\n\n    @Override\n    public void goTo(final PartDefinition part,\n                     final PanelDefinition panel) {\n        fail();\n    }\n\n    @Override\n    public Activity getActivity(final PlaceRequest place) {\n        fail();\n\n        return null;\n    }\n\n    @Override\n    public PlaceStatus getStatus(String id) {\n        fail();\n\n        return null;\n    }\n\n    @Override\n    public PlaceStatus getStatus(final PlaceRequest place) {\n        fail();\n\n        return null;\n    }\n\n    @Override\n    public void closePlace(final String id) {\n        fail();\n    }\n\n    @Override\n    public void closePlace(final PlaceRequest placeToClose) {\n        fail();\n    }\n\n    @Override\n    public void closePlace(final PlaceRequest placeToClose,\n                           final Command doAfterClose) {\n        fail();\n    }\n\n    @Override\n    public void tryClosePlace(final PlaceRequest placeToClose,\n                              final Command onAfterClose) {\n        fail();\n    }\n\n    @Override\n    public void forceClosePlace(final String id) {\n        fail();\n    }\n\n    @Override\n    public void forceClosePlace(final PlaceRequest placeToClose) {\n        fail();\n    }\n\n    @Override\n    public void closeAllPlaces() {\n        fail();\n    }\n\n    @Override\n    public void forceCloseAllPlaces() {\n        fail();\n    }\n\n    @Override\n    public boolean closeAllPlacesOrNothing() {\n        fail();\n        return false;\n    }\n\n    @Override\n    public boolean canClosePlace(final PlaceRequest place) {\n        fail();\n        return false;\n    }\n\n    @Override\n    public boolean canCloseAllPlaces() {\n        fail();\n        return false;\n    }\n\n    @Override\n    public List<PlaceRequest> getUncloseablePlaces() {\n        fail();\n        return null;\n    }\n\n    @Override\n    public void registerOnOpenCallback(final PlaceRequest place,\n                                       final Command callback) {\n        fail();\n    }\n\n    @Override\n    public void unregisterOnOpenCallbacks(final PlaceRequest place) {\n        fail();\n    }\n\n    @Override\n    public void registerOnCloseCallback(final PlaceRequest place,\n                                        final Command callback) {\n        fail();\n    }\n\n    @Override\n    public void unregisterOnCloseCallbacks(final PlaceRequest place) {\n        fail();\n    }\n\n    @Override\n    public void registerPerspectiveCloseChain(final String perspectiveIdentifier,\n                                              final BiParameterizedCommand<Command, PlaceRequest> closeChain) {\n        fail();\n    }\n\n    @Override\n    public Collection<SplashScreenActivity> getActiveSplashScreens() {\n        fail();\n        return null;\n    }\n\n    @Override\n    public List<Command> getOnOpenCallbacks(final PlaceRequest place) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public List<Command> getOnCloseCallbacks(final PlaceRequest place) {\n        fail();\n        return null;\n    }\n\n    @Override\n    public Collection<PathPlaceRequest> getActivitiesForResourceType(ResourceTypeDefinition type) {\n        fail();\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/PopupActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\n\npublic interface PopupActivity extends Activity {\n\n    String getTitle();\n\n    IsWidget getTitleDecoration();\n\n    IsWidget getWidget();\n\n    boolean onMayClose();\n\n    WorkbenchPopupSize getSize();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/ResourceTypeManagerCache.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\nimport java.util.Set;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport static java.util.Collections.sort;\n\n@ApplicationScoped\npublic class ResourceTypeManagerCache {\n\n    private List<ActivityAndMetaInfo> resourceActivities = new ArrayList<>();\n    private CategoriesManagerCache categoriesManagerCache;\n\n    @Inject\n    public ResourceTypeManagerCache(CategoriesManagerCache categoriesManagerCache) {\n        this.categoriesManagerCache = categoriesManagerCache;\n    }\n\n    public void addAll(List<ClientResourceType> resourceTypeDefinitions) {\n        this.categoriesManagerCache.addAllFromResourceTypes(resourceTypeDefinitions);\n    }\n\n    public Set<ResourceTypeDefinition> getResourceTypeDefinitions() {\n        return this.resourceActivities.stream()\n                .map(activityAndMetaInfo -> this.getResourceTypes(activityAndMetaInfo))\n                .flatMap(Collection::stream)\n                .collect(Collectors.toSet());\n    }\n\n    public List<ActivityAndMetaInfo> getResourceActivities() {\n        return resourceActivities;\n    }\n\n    public void addResourceActivity(ActivityAndMetaInfo activityAndMetaInfo) {\n        getResourceActivities().add(activityAndMetaInfo);\n        List<ClientResourceType> resourceTypes = getResourceTypes(activityAndMetaInfo);\n        this.addAll(resourceTypes);\n    }\n\n    private List<ClientResourceType> getResourceTypes(ActivityAndMetaInfo activityAndMetaInfo) {\n        return Arrays.stream(activityAndMetaInfo.getResourceTypes()).collect(Collectors.toList());\n    }\n\n    public List<ResourceTypeDefinition> getResourceTypeDefinitionsByCategory(Category category) {\n        return this.getResourceTypeDefinitions()\n                .stream()\n                .filter(resourceTypeDefinition -> {\n                    if (category != null) {\n                        return category.equals(resourceTypeDefinition.getCategory());\n                    } else {\n                        return true;\n                    }\n                })\n                .collect(Collectors.toList());\n    }\n\n    public void sortResourceActivitiesByPriority() {\n        sort(resourceActivities,\n             (o1, o2) -> {\n                 if (o1.getPriority() < o2.getPriority()) {\n                     return 1;\n                 } else if (o1.getPriority() > o2.getPriority()) {\n                     return -1;\n                 } else {\n                     return 0;\n                 }\n             });\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/SplashScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\npublic interface SplashScreenActivity extends Activity {\n\n    void closeIfOpen();\n\n    void forceShow();\n\n    String getTitle();\n\n    IsWidget getTitleDecoration();\n\n    IsWidget getWidget();\n\n    Integer getBodyHeight();\n\n    SplashScreenFilter getFilter();\n\n    Boolean intercept(final PlaceRequest intercepted);\n\n    boolean isEnabled();\n\n    @Override\n    default ResourceType getResourceType() {\n        return ActivityResourceType.SPLASH;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/TemplatedActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.workbench.model.NamedPosition;\n\npublic interface TemplatedActivity {\n\n    /**\n     * Returns the HTMLElement that contains the child WorkbenchPanelView at the given position.\n     * @return the HTMLElement that contains the child at the given position, or null if the given position does not exist\n     * within this activity's view.\n     */\n    HTMLElement resolvePosition(NamedPosition p);\n\n    /**\n     * Returns the HTMLElement that is the root panel of this activity.\n     */\n    HTMLElement getRootElement();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/UIPart.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic class UIPart {\n\n    private final String title;\n    private final IsWidget titleDecoration;\n    private final IsWidget widget;\n\n    public UIPart(final String title,\n                  final IsWidget titleDecoration,\n                  final IsWidget widget) {\n        this.title = title;\n        this.titleDecoration = titleDecoration;\n        this.widget = widget;\n    }\n\n    public String getTitle() {\n        return this.title;\n    }\n\n    public IsWidget getTitleDecoration() {\n        return this.titleDecoration;\n    }\n\n    public IsWidget getWidget() {\n        return this.widget;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/WorkbenchActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n/**\n * WorkbenchActivity and its subinterfaces define the interface between UberFire framework behaviour and\n * application-defined behaviour.\n * <p>\n * In the model-view-presenter (MVP) sense, an Activity is essentially an application-provided Presenter: it has a view\n * (its widget) and it defines a set of operations that can affect that view.\n * <p>\n * Applications can implement an Activity interface directly, they can subclass one of the abstract Activity\n * implementations that come with the framework, or they may rely on UberFire's annotation processors to generate\n * Activity implementations from annotated Java objects.\n * <p>\n * For example, to define a new Screen in an application, you can implement {@link WorkbenchScreenActivity}, extend\n * {@link AbstractWorkbenchScreenActivity}, or annotate a class with {@link WorkbenchScreen} and follow the rules\n * associated with that annotation.\n * <p>\n * Similarly for {@link WorkbenchEditorActivity}, {@link AbstractWorkbenchEditorActivity} and {@link WorkbenchEditor};\n * {@link PerspectiveActivity}, {@link AbstractWorkbenchPerspectiveActivity}, and {@link WorkbenchPerspective}; and so\n * on.\n */\n@JsType\npublic interface WorkbenchActivity extends ContextSensitiveActivity {\n\n    /**\n     * Invoked by the framework before this activity is closed, unless the framework has been told to \"force close\" the\n     * activity.\n     * <p>\n     * The activity can cancel the close operation by returning {@code false} from this method. This is most often used\n     * for implementing a \"save before closing\" workflow.\n     * @return true if the activity is ready to be closed; false if it should remain open.\n     * @see PlaceManager#closeAllPlaces()\n     * @see PlaceManager#closePlace(PlaceRequest)\n     * @see PlaceManager#closePlace(String)\n     */\n    boolean onMayClose();\n\n    /**\n     * Specifies custom positioning for this activity's view when the request to launch it comes without specific\n     * positioning information of its own. For a newly launching activity, when this method returns a non-null value,\n     * UberFire will attempt to create a new panel for this activity and add that new panel as a child of the current\n     * perspective's root panel. The activity's view will then be added to the new panel.\n     * <p>\n     * If this method returns null, UberFire will attempt to add this activity's view directly to the root panel.\n     * <p>\n     * <b>Developers of cross-application reusable components should use caution with this feature.</b> If the component\n     * declares a default position that is not supported by the root panel the application uses, the application's root\n     * panel could throw a ClassCastException when the framework attempts to create the child panel at the given\n     * position.\n     * @return the Position to add a new child panel to the root that accommodates this activity's view, or null if this\n     * activity's view should be added directly to the root panel.\n     */\n    Position getDefaultPosition();\n\n    /**\n     * Returns the PlaceRequest for the perspective that this activity should always be displayed in. When the\n     * PlaceManager is asked to go to this activity, it will switching to the owning perspective first, and then show\n     * this activity in it.\n     * @return the owning perspective's place request, or null if this activity can appear in any perspective.\n     */\n    PlaceRequest getOwningPlace();\n\n    /**\n     * Invoked by the UberFire framework when this activity is the current activity in the current panel. Activities may\n     * choose to make their UI more prominent, or begin refreshing their data more aggressively when they are focused.\n     * @see #onLostFocus()\n     * @see PanelManager#onPartFocus(org.uberfire.workbench.model.PartDefinition)\n     */\n    void onFocus();\n\n    /**\n     * Invoked by the UberFire framework when this activity is no longer the current activity in the current panel.\n     * Typically undoes changes made in the corresponding {@link #onFocus()} call.\n     * @see #onLostFocus()\n     * @see PanelManager#onPartFocus(org.uberfire.workbench.model.PartDefinition)\n     */\n    void onLostFocus();\n\n    String getTitle();\n\n    @JsIgnore\n    IsWidget getTitleDecoration();\n\n    default Element getTitleDecorationElement() {\n        IsWidget titleDecoration = getTitleDecoration();\n        return (titleDecoration == null) ? null : titleDecoration.asWidget().getElement();\n    }\n\n    @JsIgnore\n    IsWidget getWidget();\n\n    default Element getWidgetElement() {\n        IsWidget widget = getWidget();\n        return (widget == null) ? null : widget.asWidget().getElement();\n    }\n\n    void getMenus(Consumer<Menus> menusConsumer);\n\n    ToolBar getToolBar();\n\n    String contextId();\n\n    /**\n     * Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when\n     * first displaying it. Has no effect when the activity is added to a pre-existing panel, including the case where\n     * the activity is added to a panel as part of a default perspective layout.\n     * @return the height, in pixels, that should be allocated for a new panel created to house this activity. -1 (default)\n     * means no particular height is preferred, and the framework can choose a default height.\n     */\n    default int preferredHeight() {\n        return -1;\n    }\n\n    /**\n     * Returns the amount of space that should be allocated to this activity if a new Workbench Panel is created when\n     * first displaying it. Has no effect when the activity is added to a pre-existing panel, including the case where\n     * the activity is added to a panel as part of a default perspective layout.\n     * @return the width, in pixels, that should be allocated for a new panel created to house this activity. -1 (default)\n     * means no particular width is preferred, and the framework can choose a default width.\n     */\n    default int preferredWidth() {\n        return -1;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/WorkbenchClientEditorActivity.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.List;\n\nimport elemental2.promise.Promise;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.bridge.Notification;\n\n/**\n * An Editor is an activity that is associated with a VFS path. It is expected that the editor will provide the end user\n * some means of editing and saving the resource represented by the VFS path.\n */\npublic interface WorkbenchClientEditorActivity extends WorkbenchActivity {\n\n    /**\n     * Set the editor content\n     *\n     * @param path  Content Relative Path\n     * @param value The editor content\n     */\n    Promise<Void> setContent(String path, String value);\n\n    /**\n     * Get the editor content\n     *\n     * @return\n     */\n    Promise<String> getContent();\n\n    /**\n     * Get the editor content preview in SVG format\n     *\n     * @return\n     */\n    Promise<String> getPreview();\n\n    Promise<List<Notification>> validate();\n\n    boolean isDirty();\n\n    @Override\n    default ResourceType getResourceType() {\n        return ActivityResourceType.CLIENT_EDITOR;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/WorkbenchEditorActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.ResourceType;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/**\n * An Editor is an activity that is associated with a VFS path. It is expected that the editor will provide the end user\n * some means of editing and saving the resource represented by the VFS path.\n */\npublic interface WorkbenchEditorActivity extends WorkbenchActivity {\n\n    public void onStartup(final ObservablePath path,\n                          final PlaceRequest place);\n\n    public void onSave();\n\n    public boolean isDirty();\n\n    @Override\n    default ResourceType getResourceType() {\n        return ActivityResourceType.EDITOR;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/WorkbenchScreenActivity.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\n/**\n * Provides the application-defined behaviour and application-defined view associated with a particular PlaceRequest.\n * <p>\n * See also {@link WorkbenchEditorActivity}, which is like a WorkbenchScreenActivity specifically for editing a file.\n */\npublic interface WorkbenchScreenActivity extends WorkbenchActivity {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/jsbridge/JsWorkbenchLazyActivity.java",
    "content": "package org.uberfire.client.mvp.jsbridge;\n\nimport com.google.gwt.core.client.JavaScriptObject;\n\npublic interface JsWorkbenchLazyActivity {\n\n    void updateRealContent(final JavaScriptObject object);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/mvp/jsbridge/JsWorkbenchLazyPerspective.java",
    "content": "package org.uberfire.client.mvp.jsbridge;\n\nimport org.uberfire.client.mvp.PerspectiveActivity;\n\npublic interface JsWorkbenchLazyPerspective extends JsWorkbenchLazyActivity {\n\n    PerspectiveActivity get();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/WorkbenchCss.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.resources.client.CssResource;\n\n/**\n * GWT managed CSS for Workbench\n */\npublic interface WorkbenchCss\n        extends\n        CssResource {\n\n    @ClassName(\"uf-drop-target-highlight\")\n    String dropTargetHighlight();\n\n    @ClassName(\"uf-drop-target-compass\")\n    String dropTargetCompass();\n\n    String notification();\n\n    String toolbar();\n\n    String statusBar();\n\n    @ClassName(\"uf-activeNavTabs\")\n    String activeNavTabs();\n\n    String tabCloseButton();\n\n    @ClassName(\"uf-listbar\")\n    String listbar();\n\n    @ClassName(\"show-context\")\n    String showContext();\n\n    @ClassName(\"uf-split-layout-panel\")\n    String splitLayoutPanel();\n\n    @ClassName(\"uf-split-layout-panel-hdragger\")\n    String splitLayoutPanelHDragger();\n\n    @ClassName(\"uf-split-layout-panel-vdragger\")\n    String splitLayoutPanelVDragger();\n\n    @ClassName(\"uf-modal\")\n    String modal();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/WorkbenchImages.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.ImageResource;\n\n/**\n * GWT managed images for Workbench\n */\npublic interface WorkbenchImages\n        extends\n        ClientBundle {\n\n    //DnD drag proxy\n    @Source(\"images/dragProxy.png\")\n    ImageResource workbenchPanelDragProxy();\n\n    //CompassDropController North arrow\n    @Source(\"images/compass-north.png\")\n    ImageResource compassNorth();\n\n    //CompassDropController South arrow\n    @Source(\"images/compass-south.png\")\n    ImageResource compassSouth();\n\n    //CompassDropController East arrow\n    @Source(\"images/compass-east.png\")\n    ImageResource compassEast();\n\n    //CompassDropController West arrow\n    @Source(\"images/compass-west.png\")\n    ImageResource compassWest();\n\n    //CompassDropController Centre\n    @Source(\"images/compass-centre.png\")\n    ImageResource compassCentre();\n\n    //Lock indicator\n    @Source(\"images/lock.png\")\n    ImageResource lock();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/WorkbenchResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.resources;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\n\n/**\n * All GWT managed resources for Workbench\n */\npublic interface WorkbenchResources\n        extends\n        ClientBundle {\n\n    WorkbenchResources INSTANCE = GWT.create(WorkbenchResources.class);\n\n    @Source(\"css/workbench.css\")\n    WorkbenchCss CSS();\n\n    WorkbenchImages images();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/i18n/PermissionTreeConstants.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\npublic interface PermissionTreeConstants extends Messages,\n                                                 PermissionTreeI18n {\n\n    PermissionTreeConstants INSTANCE = GWT.create(PermissionTreeConstants.class);\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/i18n/PermissionTreeI18NImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport javax.enterprise.context.ApplicationScoped;\n\n@ApplicationScoped\npublic class PermissionTreeI18NImpl implements PermissionTreeI18n {\n\n    @Override\n    public String perspectivesNodeName() {\n        return PermissionTreeConstants.INSTANCE.perspectivesNodeName();\n    }\n\n    @Override\n    public String perspectivesNodeHelp() {\n        return PermissionTreeConstants.INSTANCE.perspectivesNodeHelp();\n    }\n\n    @Override\n    public String perspectiveResourceName() {\n        return PermissionTreeConstants.INSTANCE.perspectiveResourceName();\n    }\n\n    @Override\n    public String perspectiveCreate() {\n        return PermissionTreeConstants.INSTANCE.perspectiveCreate();\n    }\n\n    @Override\n    public String perspectiveRead() {\n        return PermissionTreeConstants.INSTANCE.perspectiveRead();\n    }\n\n    @Override\n    public String perspectiveUpdate() {\n        return PermissionTreeConstants.INSTANCE.perspectiveUpdate();\n    }\n\n    @Override\n    public String perspectiveDelete() {\n        return PermissionTreeConstants.INSTANCE.perspectiveDelete();\n    }\n\n    @Override\n    public String editorsNodeName() {\n        return PermissionTreeConstants.INSTANCE.editorsNodeName();\n    }\n\n    @Override\n    public String editorsNodeHelp() {\n        return PermissionTreeConstants.INSTANCE.editorsNodeHelp();\n    }\n\n    @Override\n    public String editorResourceName() {\n        return PermissionTreeConstants.INSTANCE.editorResourceName();\n    }\n\n    @Override\n    public String editorRead() {\n        return PermissionTreeConstants.INSTANCE.editorRead();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/i18n/PermissionTreeI18n.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\npublic interface PermissionTreeI18n {\n\n    String perspectivesNodeName();\n\n    String perspectivesNodeHelp();\n\n    String perspectiveResourceName();\n\n    String perspectiveCreate();\n\n    String perspectiveRead();\n\n    String perspectiveUpdate();\n\n    String perspectiveDelete();\n\n    String editorsNodeName();\n\n    String editorsNodeHelp();\n\n    String editorResourceName();\n\n    String editorRead();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/resources/i18n/WorkbenchConstants.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.resources.i18n;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.i18n.client.Messages;\n\n/**\n * Workbench I18N constants\n */\npublic interface WorkbenchConstants\n        extends\n        Messages {\n\n    WorkbenchConstants INSTANCE = GWT.create(WorkbenchConstants.class);\n\n    String maximizePanel();\n\n    String minimizePanel();\n\n    String closePanel();\n\n    String selectView();\n\n    String expandToolbar();\n\n    String collapseToolbar();\n\n    String showSplashHelp();\n\n    String lockHint();\n\n    String lockOwnedHint();\n\n    String lockError();\n\n    String lockedMessage(String lockedBy);\n\n    String splashScreenNoneAvailable();\n\n    String switchToDefaultView();\n\n    String switchToCompactView();\n\n    String closingWindowMessage();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/util/CSSLocatorsUtils.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.util;\n\npublic class CSSLocatorsUtils {\n\n    public static String buildLocator(String... values) {\n        String cssClass = \"\";\n        for (String value : values) {\n            if (isValid(value)) {\n                if (!cssClass.isEmpty()) {\n                    cssClass = cssClass + \"-\";\n                }\n                cssClass = cssClass + format(value);\n            }\n        }\n        return cssClass;\n    }\n\n    private static boolean isValid(String value) {\n        return value != null && !value.trim().isEmpty();\n    }\n\n    private static String format(String value) {\n        return value.replaceAll(\" \",\n                                \"-\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/util/GWTEditorNativeRegister.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.mvp.Activity;\n\n/**\n *  Call native Javascript to register GWT Editors\n */\n@ApplicationScoped\npublic class GWTEditorNativeRegister {\n    \n    public native void nativeRegisterGwtEditorProvider() /*-{\n\n        console.log(\"registerGWTEditorProvider\");\n\n        $wnd.gwtEditorBeans = new Map();\n        $wnd.resolveEditor = function (id) {\n            return $wnd.gwtEditorBeans.get(id);\n        };\n\n        $wnd.GWTEditor = function (instance) {\n            this.instance = instance;\n        };\n\n        $wnd.GWTEditor.prototype.isDirty = function () {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::isDirty();\n        };\n\n        $wnd.GWTEditor.prototype.onOpen = function () {\n            this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::onOpen()();\n        };\n\n        $wnd.GWTEditor.prototype.setContent = function (path, value) {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::setContent(Ljava/lang/String;Ljava/lang/String;)(path, value);\n        };\n\n        $wnd.GWTEditor.prototype.getContent = function () {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::getContent()();\n        };\n        \n        $wnd.GWTEditor.prototype.getPreview = function () {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::getPreview()();\n        };        \n\n        $wnd.GWTEditor.prototype.getView = function () {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::getWidgetElement()();\n        };\n\n         $wnd.GWTEditor.prototype.validate = function () {\n            return this.instance.@org.uberfire.client.mvp.WorkbenchClientEditorActivity::validate()();\n        };\n\n        $wnd.GWTEditorSuplier = function (bean) {\n            this.bean = bean;\n        };\n\n        $wnd.GWTEditorSuplier.prototype.get = function () {\n            return new $wnd.GWTEditor(this.bean.@org.jboss.errai.ioc.client.container.SyncBeanDef::newInstance()());\n        }\n\n    }-*/;\n    \n    public native void nativeRegisterGwtClientBean(final String id, final SyncBeanDef<Activity> activityBean) /*-{\n        $wnd.gwtEditorBeans.set(id, new $wnd.GWTEditorSuplier(activityBean));\n    }-*/;\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/util/Layouts.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.panels.SplitPanel;\nimport org.uberfire.debug.Debug;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\n\nimport static org.uberfire.plugin.PluginUtil.toInteger;\n\npublic class Layouts {\n\n    public static final int DEFAULT_CHILD_SIZE = 100;\n\n    /**\n     * Sets the CSS on the given widget so it automatically fills the available space, rather than being sized based on\n     * the amount of space required by its contents. This tends to be useful when building a UI that always fills the\n     * available space on the screen, as most desktop application windows do.\n     * <p>\n     * To achieve this, the element is given relative positioning with top and left set to 0px and width and height set\n     * to 100%. This makes the widget fill its nearest ancestor which has relative or absolute positioning. This\n     * technique is compatible with GWT's LayoutPanel system. Note that, like LayoutPanels, this only works if the host\n     * page is in standards mode (has a {@code <!DOCTYPE html>} header).\n     * @param w the widget that should always fill its available space, rather than being sized to fit its contents.\n     */\n    public static void setToFillParent(Widget w) {\n        Element e = w.getElement();\n        Style s = e.getStyle();\n        s.setPosition(Position.RELATIVE);\n        s.setTop(0.0,\n                 Unit.PX);\n        s.setLeft(0.0,\n                  Unit.PX);\n        s.setWidth(100.0,\n                   Unit.PCT);\n        s.setHeight(100.0,\n                    Unit.PCT);\n        s.setOutlineStyle(Style.OutlineStyle.NONE);\n    }\n\n    /**\n     * Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the\n     * widget tree.\n     * @param w the widget to start at. Null is permitted, and results in this method returning an empty string.\n     * @return information about w and its ancestors, one widget per line.\n     */\n    public static String getContainmentHierarchy(Widget w) {\n        return getContainmentHierarchy(w,\n                                       false);\n    }\n\n    /**\n     * Returns a multi-line string detailing layout information about the given widget and each of its ancestors in the\n     * widget tree, optionally setting debug IDs on each widget to assist in locating them in browser DOM explorer\n     * tools.\n     * @param w the widget to start at. Null is permitted, and results in this method returning an empty string.\n     * @param setDebugIds if true, the element and each of its ancestors will have its ID set to\n     * <code>\"containment-parent-<i>depth</i>\"</code>, where depth is 0 for the given widget, 1 for\n     * its parent, 2 for its grandparent, and so on. This ID will replace any ID that was previously set on\n     * the element, so it may break some CSS and even javascript functionality. Use with caution.\n     * @return information about w and its ancestors, one widget per line.\n     */\n    public static String getContainmentHierarchy(Widget w,\n                                                 boolean setDebugIds) {\n        StringBuilder sb = new StringBuilder();\n        int depth = 0;\n        while (w != null) {\n            if (setDebugIds) {\n                w.getElement().setId(\"containment-parent-\" + depth);\n            }\n            sb.append(\"  \" + depth + \" - \" + widgetInfo(w));\n            w = w.getParent();\n            depth++;\n        }\n        return sb.toString();\n    }\n\n    private static String widgetInfo(Widget w) {\n        String widgetInfo;\n        try {\n            String id = w.getElement().getId();\n            widgetInfo = w.getOffsetWidth() + \"x\" + w.getOffsetHeight() + \" - \" +\n                    Debug.objectId(w) +\n                    (id != null && id.length() > 0 ? \" id=\" + id : \"\") +\n                    (w instanceof SplitPanel ? \" divider at \" + ((SplitPanel) w).getFixedWidgetSize() : \"\") +\n                    (w instanceof RequiresResize ? \" RequiresResize\" : \"\") +\n                    (w instanceof ProvidesResize ? \" ProvidesResize\" : \"\") +\n                    \" position: \" + w.getElement().getStyle().getPosition() + \"\\n\";\n        } catch (Throwable t) {\n            widgetInfo = \"?x? - \" +\n                    Debug.objectId(w) +\n                    \": \" + t.toString() + \"\\n\";\n        }\n        return widgetInfo;\n    }\n\n    /**\n     * Returns a multi-line string detailing layout information about the given widget and each of its descendants in\n     * the widget tree.\n     * @param startAt the widget to start at. Null is permitted.\n     * @return information about w and its descendants, one widget per line. Each line is indented with leading spaces\n     * to illustrate the containment hierarchy.\n     */\n    public static String getContainedHierarchy(final Widget startAt) {\n        IndentedLineAccumulator result = new IndentedLineAccumulator();\n        getContainedHierarchyRecursively(startAt,\n                                         0,\n                                         result);\n        return result.toString();\n    }\n\n    private static void getContainedHierarchyRecursively(final Widget startAt,\n                                                         int depth,\n                                                         IndentedLineAccumulator result) {\n        if (startAt == null) {\n            result.append(depth,\n                          \"(null)\");\n            return;\n        }\n        result.append(depth,\n                      widgetInfo(startAt));\n        if (startAt instanceof HasWidgets) {\n            for (Widget child : ((HasWidgets) startAt)) {\n                getContainedHierarchyRecursively(child,\n                                                 depth + 1,\n                                                 result);\n            }\n        } else if (startAt instanceof Composite) {\n            getContainedHierarchyRecursively(extractWidget(((Composite) startAt)),\n                                             depth + 1,\n                                             result);\n        }\n    }\n\n    private static native Widget extractWidget(Composite composite) /*-{\n        return composite.@com.google.gwt.user.client.ui.Composite::widget;\n    }-*/;\n\n    /**\n     * Returns the current width or height of the given panel definition.\n     * @param position determines which dimension (width or height) to return.\n     * @param definition the definition to get the size information from.\n     * @return the with if position is EAST or WEST; the height if position is NORTH or SOUTH. If no size is provided by the PanelDefinition the DEFAULT_CHILD_SIZE is used.\n     */\n    public static int widthOrHeight(CompassPosition position,\n                                    PanelDefinition definition) {\n        switch (position) {\n            case NORTH:\n            case SOUTH:\n                return heightOrDefault(definition);\n            case EAST:\n            case WEST:\n                return widthOrDefault(definition);\n            default:\n                throw new IllegalArgumentException(\"Position \" + position + \" has no horizontal or vertial aspect.\");\n        }\n    }\n\n    public static int heightOrDefault(PanelDefinition def) {\n        Integer height = toInteger(def.getHeightAsInt());\n        return height == null ? DEFAULT_CHILD_SIZE : height;\n    }\n\n    public static int widthOrDefault(PanelDefinition def) {\n        Integer width = toInteger(def.getWidthAsInt());\n        return width == null ? DEFAULT_CHILD_SIZE : width;\n    }\n\n    /**\n     * Disables the scrolling behaviour of the nearest scrollpanel found in the given widget's containment hierarchy.\n     * <p>\n     * FIXME this is a really horrible workaround! should instead modify UF API to allow PanelDefinition to opt out of having a scroll panel.\n     * The better fix would require changes to:\n     * <ul>\n     * <li>WorkbenchPartPresenter.View\n     * <li>WorkbenchPartView and its mock\n     * <li>The @WorkbenchPanel annotation\n     * <li>The annotation processor code generators and their tests\n     * </ul>\n     * @return true if a scroll panel was found and disabled; false if no scroll panel was found.\n     */\n    public static boolean disableNearestScrollPanel(Widget w) {\n        while (w != null) {\n            if (w instanceof ScrollPanel) {\n                w.getElement().getStyle().clearOverflow();\n                w.getElement().getParentElement().getStyle().clearOverflow();\n                return true;\n            }\n            w = w.getParent();\n        }\n        return false;\n    }\n\n    private static class IndentedLineAccumulator {\n\n        final StringBuilder sb = new StringBuilder();\n\n        private void append(int depth,\n                            String s) {\n            for (int i = 0; i < depth; i++) {\n                sb.append(\" \");\n            }\n            sb.append(s);\n        }\n\n        @Override\n        public String toString() {\n            return sb.toString();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/util/UserAgent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport com.google.gwt.user.client.Window;\n\npublic class UserAgent {\n\n    private UserAgent() {\n\n    }\n\n    public static boolean isChrome() {\n        final String userAgent = Window.Navigator.getUserAgent().toLowerCase();\n        return userAgent.contains(\"chrome\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/AlternativeLayout.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.ElementType.FIELD;\nimport static java.lang.annotation.ElementType.METHOD;\nimport static java.lang.annotation.ElementType.TYPE;\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n/**\n * Part of the worbench layout SPI. Used to declare {@link org.uberfire.client.workbench.WorkbenchLayout}\n * implementations, that should be used as an alternative to the default {@link org.uberfire.client.workbench.WorkbenchLayoutImpl}.<p/>\n * The actual discovery mechenism resides with {@link org.uberfire.client.workbench.LayoutSelection}\n */\n@Qualifier\n@Retention(RUNTIME)\n@Target({FIELD, TYPE, METHOD})\npublic @interface AlternativeLayout {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/BeanFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.CompassDropController;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * A Factory definition to create new instances of managed beans.\n */\npublic interface BeanFactory {\n\n    /**\n     * Creates a new part presenter/view pair with the given properties.\n     * @param menus The menus to associate with the new part. Null means no menus.\n     * @param title The title to associate with the new part that the containing panel may display (for example, as the\n     * tab label in a {@link MultiTabWorkbenchPanelPresenter}.\n     * @param titleDecoration The title decoration that a panel may choose to display beside the part's title. Null is permitted,\n     * and means no title decoration.\n     * <p>\n     * NOTE: presently, none of the built-in panel types display a part's title decoration.\n     * @param definition Defines all other aspects of the part to create. Must not be null.\n     * @param partType The new part type.\n     * @return\n     */\n    public WorkbenchPartPresenter newWorkbenchPart(final Menus menus,\n                                                   final String title,\n                                                   final IsWidget titleDecoration,\n                                                   final PartDefinition definition,\n                                                   final Class<? extends WorkbenchPartPresenter> partType);\n\n    /**\n     * Creates a new perspective root panel for the given Perspective Activity and Root Panel Definition. The returned\n     * object must be destroyed by a call to {@link #destroy(Object)} when it is no longer needed.\n     * @param activity the perspective that the root panel is being created for. Must not be null.\n     * @param root description of the panel to create. Must not be null.\n     * @return a new WorkbenchPanelPresenter configured as specified in the given panel definition. This bean must be\n     * passed to {@link #destroy(Object)} when no longer in use by the application.\n     */\n    public WorkbenchPanelPresenter newRootPanel(PerspectiveActivity activity,\n                                                PanelDefinition root);\n\n    /**\n     * Creates a new panel with the properties specified in the given definition.\n     * @param definition specification of the panel that should be created. Must not be null.\n     * @return a new panel presenter/view pair that is ready for use in the workbench. This bean must be passed to\n     * {@link #destroy(Object)} when no longer in use by the application.\n     */\n    public WorkbenchPanelPresenter newWorkbenchPanel(final PanelDefinition definition);\n\n    public CompassDropController newDropController(final WorkbenchPanelView<?> view);\n\n    /**\n     * Destroys the entire graph of beans that were created and returned via a call to any of the <tt>newXXX()</tt>\n     * methods in this class. For example, passing a {@link WorkbenchPartPresenter} instance in will result in the\n     * destruction of that presenter, its view, and all other dependent beans injected into that graph of objects.\n     * @param o a bean which was returned from one of the <tt>newXXX()</tt> methods in this class and which has not\n     * been destroyed yet.\n     */\n    public void destroy(final Object o);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/DefaultBeanFactory.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport java.util.Collection;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.mvp.jsbridge.JsWorkbenchLazyPerspective;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.CompassDropController;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * BeanFactory using Errai IOCBeanManager to instantiate (CDI) beans\n */\n@ApplicationScoped\npublic class DefaultBeanFactory\n        implements BeanFactory {\n\n    @Inject\n    protected SyncBeanManager iocManager;\n\n    @Override\n    public WorkbenchPartPresenter newWorkbenchPart(final Menus menus,\n                                                   final String title,\n                                                   final IsWidget titleDecoration,\n                                                   final PartDefinition definition,\n                                                   final Class<? extends WorkbenchPartPresenter> partType) {\n        final WorkbenchPartPresenter part = iocManager.lookupBean(partType).getInstance();\n\n        part.setTitle(title);\n        part.setMenus(menus);\n        part.setTitleDecoration(titleDecoration);\n        part.setDefinition(definition);\n\n        return part;\n    }\n\n    @Override\n    public WorkbenchPanelPresenter newRootPanel(PerspectiveActivity activity,\n                                                PanelDefinition root) {\n        WorkbenchPanelPresenter panel = newWorkbenchPanel(root);\n        if (panel instanceof TemplatedWorkbenchPanelPresenter) {\n\n            final TemplatedActivity templatedActivity;\n            if (activity instanceof JsWorkbenchLazyPerspective) {\n                templatedActivity = (TemplatedActivity) ((JsWorkbenchLazyPerspective) activity).get();\n            } else {\n                templatedActivity = (TemplatedActivity) activity;\n            }\n\n            ((TemplatedWorkbenchPanelPresenter) panel).setActivity(templatedActivity);\n        }\n        return panel;\n    }\n\n    @Override\n    public WorkbenchPanelPresenter newWorkbenchPanel(final PanelDefinition definition) {\n        Collection<SyncBeanDef<WorkbenchPanelPresenter>> beans = iocManager.lookupBeans(WorkbenchPanelPresenter.class);\n        for (SyncBeanDef<WorkbenchPanelPresenter> bean : beans) {\n            if (bean.getBeanClass().getName().equals(definition.getPanelType())) {\n                final WorkbenchPanelPresenter panel = bean.getInstance();\n                panel.setDefinition(definition);\n                return panel;\n            }\n        }\n        throw new IllegalArgumentException(\"Unknown panel type: \" + definition.getPanelType());\n    }\n\n    @Override\n    public CompassDropController newDropController(final WorkbenchPanelView<?> view) {\n        final CompassDropController dropController = iocManager.lookupBean(CompassDropController.class).getInstance();\n        dropController.setup(view);\n        return dropController;\n    }\n\n    @Override\n    public void destroy(final Object o) {\n        iocManager.destroyBean(o);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/Footer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.jboss.errai.ioc.client.container.BeanActivator;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.uberfire.client.workbench.events.ApplicationReadyEvent;\n\n/**\n * CDI beans that implement Footer are automatically created and added to the bottom of the Workbench screen. They stick\n * to the bottom of the viewport even when the browser window is resized.\n * <p>\n * To disable a particular footer, you can use a {@link BeanActivator}. The bean activator would have to report that the\n * bean is disabled very early in the workbench startup process, before {@link ApplicationReadyEvent} is fired. If you\n * need to do an asynchronous check in your activator, use {@link Workbench#addStartupBlocker(Class)} to block startup\n * until your activator obtains the data it needs. (The blocker could be registered in your entry point's\n * {@code @PostConstruct} method).\n */\npublic interface Footer extends IsElement,\n                                Orderable {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/Header.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.jboss.errai.ioc.client.container.BeanActivator;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.uberfire.client.workbench.events.ApplicationReadyEvent;\n\n/**\n * CDI beans that implement Header are automatically discovered and added to the top of the Workbench screen. They stick\n * to the top of the viewport even when the main content area is scrolled up and down.\n * <p>\n * To disable a particular header, you can use a {@link BeanActivator}. The bean activator would have to report that the\n * bean is disabled very early in the workbench startup process, before {@link ApplicationReadyEvent} is fired. If you\n * need to do an asynchronous check in your activator, use {@link Workbench#addStartupBlocker(Class)} to block startup\n * until your activator obtains the data it needs. (The blocker could be registered in your entry point's\n * {@code @PostConstruct} method).\n */\npublic interface Header extends IsElement,\n                                Orderable {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/LayoutSelection.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Collection;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\n\n/**\n * Used to discover alternative {@link org.uberfire.client.workbench.WorkbenchLayout}'s.\n * If no alternatives can be found, the default {@link org.uberfire.client.workbench.WorkbenchLayoutImpl} is used.\n * If several implementations are found the first one will be chosen.\n */\n@ApplicationScoped\npublic class LayoutSelection {\n\n    static final AlternativeLayout altLayout = new AlternativeLayout() {\n        @Override\n        public Class<? extends Annotation> annotationType() {\n            return AlternativeLayout.class;\n        }\n    };\n    @Inject\n    private SyncBeanManager iocManager;\n\n    public WorkbenchLayout get() {\n        //FIXME: this alternatives process doesn't work\n        WorkbenchLayout layout = null;\n\n        Collection<SyncBeanDef<WorkbenchLayout>> beanDefs = iocManager.lookupBeans(WorkbenchLayout.class,\n                                                                                   altLayout);\n        if (beanDefs.size() > 0) {\n            SyncBeanDef<WorkbenchLayout> alt = beanDefs.iterator().next();\n            layout = alt.getInstance();\n        } else {\n            layout = iocManager.lookupBean(WorkbenchLayout.class).getInstance();\n        }\n        return layout;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/Orderable.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\npublic interface Orderable {\n\n    /**\n     * Returns the unique identifier of this widget. This ID is used when specifying which headers and footers to retain\n     * when running the workbench in standalone (embedded) mode.\n     * @return a unique identifier for this widget\n     */\n    String getId();\n\n    /**\n     * Returns the stacking order of this header or footer.\n     * @return the order this header should be stacked in (higher numbers closer to the top of the screen).\n     */\n    int getOrder();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.workbench.events.SelectPlaceEvent;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CustomPanelDefinition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * Internal framework component that handles the creation, destruction, layout, and composition (parent-child nesting)\n * of all panels that make up a perspective. Also orchestrates adding and removing parts to/from panels. The outer most\n * workbench panels (header, footer, perspective container) are managed by the\n * {@link org.uberfire.client.workbench.WorkbenchLayout}.\n * <p>\n * <b>Application code should not invoke any of the methods of this class directly.</b> Doing so will corrupt the state\n * of the PlaceManager, ActivityManager, and potentially other stateful framework components. Applications should always\n * initiate Workbench actions through the public methods on {@link PlaceManager}.\n */\npublic interface PanelManager {\n\n    /**\n     * Returns the description of the entire panel + part tree that makes up the UI in its current state.\n     */\n    PanelDefinition getRoot();\n\n    /**\n     * Adds the given part to the given panel, which must already be part of the visible workbench layout. Fires a\n     * {@link SelectPlaceEvent} with the given {@link PlaceRequest} once the part has been added.\n     * @param place The PlaceRequest that the part was resolved from. Not null.\n     * @param part The description of the part to add. Not null.\n     * @param panel definition of the panel to add the part to (must describe a panel that is already present in the\n     * layout). Not null.\n     * @param menus The menus to display for the given part. Null means no menus.\n     * @param uiPart The part's title and physical view. Not null.\n     * @param contextId part of a removed framework feature (TODO: remove this?)\n     * @param minInitialWidth minimum pixel width of the part's activity, or null if there is no known minimum width. The target\n     * panel will expand to the this width if the panel is not already at least as wide, and only if it\n     * supports resizing on the horizontal axis.\n     * @param minInitialHeight minimum pixel height of the part's activity, or null if there is no known minimum height. The target\n     * panel will expand to this height if the panel is not already at least as tall, and only if it supports\n     * resizing on the vertical axis.\n     */\n    void addWorkbenchPart(final PlaceRequest place,\n                          final PartDefinition part,\n                          final PanelDefinition panel,\n                          final Menus menus,\n                          final UIPart uiPart,\n                          final String contextId,\n                          final Integer minInitialWidth,\n                          final Integer minInitialHeight);\n\n    /**\n     * Adds an empty child panel of the target panel's default child type at the given position within the target panel.\n     * The new child panel will have the given dimensions and minimum sizes set on it.\n     * <p>\n     * TODO: the usefulness of this method to callers is questionable (versus creating a new child panel definition and\n     * calling {@link #addWorkbenchPanel(PanelDefinition, PanelDefinition, Position)}). candidate for deletion.\n     */\n    PanelDefinition addWorkbenchPanel(final PanelDefinition targetPanel,\n                                      final Position position,\n                                      final Integer height,\n                                      final Integer width,\n                                      final Integer minHeight,\n                                      final Integer minWidth);\n\n    /**\n     * Adds the given child panel to the given target panel at the given position within the target. Upon successful\n     * completion of this method, the child panel will have a new parent panel. Its {@link PanelDefinition},\n     * {@link WorkbenchPanelPresenter}, and {@link WorkbenchPanelView} and those of its new parent will be updated to\n     * reflect the new relationship. Note that the given target panel will not necessarily be the new parent: panel\n     * implementations may choose to avoid collisions (more than one child panel in the same position) by redirecting\n     * requests to add children.\n     * @throws IllegalStateException if {@code targetPanel} already has a child at {@code position} and it doesn't have any special\n     * collision avoidance logic\n     * @throws UnsupportedOperationException if {@code targetPanel} doesn't support child panels.\n     * @throws IllegalArgumentException if {@code targetPanel} doesn't understand the given {@code position} value.\n     */\n    PanelDefinition addWorkbenchPanel(final PanelDefinition targetPanel,\n                                      final PanelDefinition childPanel,\n                                      final Position position);\n\n    /**\n     * Creates an UberFire panel and installs its view in the given widget container.\n     * <p>\n     * <h3>Custom Panel Lifecycle</h3>\n     * <p>\n     * Custom panels can be disposed like any other panel: by calling {@link #removeWorkbenchPanel(PanelDefinition)}.\n     * Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM\n     * (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then\n     * the associated panel is disposed.\n     * @param container the widget container to install the new panel in. The new panel will fill the container.\n     * @return the definition for the newly constructed panel. Never null. The panel's type will be {@code panelType};\n     * its parent will be null; {@code isRoot()} will return false.\n     */\n    CustomPanelDefinition addCustomPanel(HasWidgets container,\n                                         String panelType);\n\n    /**\n     * Creates an UberFire panel and installs its view in the given html element container.\n     * <p>\n     * <h3>Custom Panel Lifecycle</h3>\n     * <p>\n     * Custom panels can be disposed like any other panel: by calling {@link #removeWorkbenchPanel(PanelDefinition)}.\n     * Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM\n     * (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then\n     * the associated panel is disposed.\n     * @param container the html element container to install the new panel in. The new panel will fill the container.\n     * @return the definition for the newly constructed panel. Never null. The panel's type will be {@code panelType};\n     * its parent will be null; {@code isRoot()} will return false.\n     */\n    CustomPanelDefinition addCustomPanel(HTMLElement container,\n                                         String panelType);\n\n    /**\n     * Creates an UberFire panel and installs its view in the given html element container.\n     * <p>\n     * <h3>Custom Panel Lifecycle</h3>\n     * <p>\n     * Custom panels can be disposed like any other panel: by calling {@link #removeWorkbenchPanel(PanelDefinition)}.\n     * Additionally, custom panels are monitored for DOM detachment. When a custom panel's view is removed from the DOM\n     * (whether directly removed from its parent or some ancestor is removed,) all the panel's parts are closed and then\n     * the associated panel is disposed.\n     * @param container the html element container to install the new panel in. The new panel will fill the container.\n     * @return the definition for the newly constructed panel. Never null. The panel's type will be {@code panelType};\n     * its parent will be null; {@code isRoot()} will return false.\n     */\n    CustomPanelDefinition addCustomPanel(elemental2.dom.HTMLElement container,\n                                         String panelType);\n\n    /**\n     * Removes the panel associated with the given definition, removing the panel's presenter and view from the\n     * workbench, and freeing any resources associated with them. The panel must have no parts and no child panels.\n     * @param toRemove the panel to remove from the workbench layout. Must not be null.\n     * @throws IllegalStateException if the panel contains parts or child panels\n     * @throws IllegalArgumentException if no panel presenter is currently associated with the given definition\n     */\n    void removeWorkbenchPanel(final PanelDefinition toRemove) throws IllegalStateException;\n\n    /**\n     * Removes the part associated with the given PlaceRequest from the panel that contains it. If this operation\n     * removes the last part from the panel, and the panel is not the root panel, it will be removed from the workbench\n     * layout. Child panels are preserved by reparenting them to the removed panel's parent. Application code should not\n     * call this method directly; it is called by PlaceManager as part of the overall procedure in closing a place.\n     * @param toRemove the place that is closing. Must not be null.\n     * @return true if the associated part was found and removed; false if no matching part could be found.\n     */\n    boolean removePartForPlace(final PlaceRequest toRemove);\n\n    void onPartFocus(final PartDefinition part);\n\n    void onPartLostFocus();\n\n    /**\n     * Gives focus to the given panel, if it is known to this PanelManager. Also removes focus from all other panels\n     * associated with this PanelManager.\n     * @param panel the panel to give focus to. May be null, in which case all panels will lose focus.\n     */\n    void onPanelFocus(final PanelDefinition panel);\n\n    /**\n     * Closes the given part. This is a convenience method for <tt>placeManager.closePlace(part.getPlace())</tt>.\n     * @param part the part to close (remove from the GUI). Must not be null.\n     */\n    void closePart(final PartDefinition part);\n\n    /**\n     * Clears all existing panel structure from the user interface, then installs a new root panel according to the\n     * specifications in the given {@link PanelDefinition}. Only installs the root panel; does not build the child\n     * panel/part structure recursively.\n     * @param root description of the new root panel to install. Must not be null.\n     */\n    void setRoot(PerspectiveActivity activity,\n                 PanelDefinition root);\n\n    /**\n     * Returns the first PanelDefinition whose place matches the given one.\n     * @return the definition for the panel servicing the given place, or null if no such part can be found.\n     */\n    PanelDefinition getPanelForPlace(PlaceRequest place);\n\n    /**\n     * @param part that has been hidden\n     */\n    void onPartHidden(PartDefinition part);\n\n    /**\n     * @param part the part that has been maximized\n     */\n    void onPartMaximized(PartDefinition part);\n\n    /**\n     * @param part the part that has been minimized\n     */\n    void onPartMinimized(PartDefinition part);\n\n    /**\n     * @return the focused {@link PartDefinition}\n     */\n    PartDefinition getFocusedPart();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PanelManagerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.core.client.Scheduler.ScheduledCommand;\nimport com.google.gwt.event.logical.shared.AttachEvent;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.Event.NativePreviewEvent;\nimport com.google.gwt.user.client.Event.NativePreviewHandler;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.client.workbench.events.DropPlaceEvent;\nimport org.uberfire.client.workbench.events.PanelFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceGainFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceHiddenEvent;\nimport org.uberfire.client.workbench.events.PlaceLostFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.events.SelectPlaceEvent;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.debug.Debug;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.CustomPanelDefinition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.CustomPanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n/**\n * Standard implementation of {@link PanelManager}.\n */\n@ApplicationScoped\npublic class PanelManagerImpl implements PanelManager {\n\n    protected final Map<PartDefinition, WorkbenchPartPresenter> mapPartDefinitionToPresenter = new HashMap<PartDefinition, WorkbenchPartPresenter>();\n    protected final Map<PanelDefinition, WorkbenchPanelPresenter> mapPanelDefinitionToPresenter = new HashMap<PanelDefinition, WorkbenchPanelPresenter>();\n    /**\n     * Remembers which HasWidgets contains each existing custom panel. Items are removed from this map when the panels\n     * are closed/removed.\n     */\n    protected final Map<PanelDefinition, HasWidgets> customPanels = new HashMap<PanelDefinition, HasWidgets>();\n    /**\n     * Remembers which HTMLElements contain each existing custom panel. Items are removed from this map when the panels\n     * are closed/removed.\n     */\n    protected final Map<PanelDefinition, HTMLElement> customPanelsInsideHTMLElements = new HashMap<>();\n    /**\n     * Remembers which Elemental2 HTMLElements contain each existing custom panel. Items are removed from this map when the panels\n     * are closed/removed.\n     */\n    protected final Map<PanelDefinition, elemental2.dom.HTMLElement> customPanelsInsideElemental2HTMLElements = new HashMap<>();\n\n    protected Event<PlaceGainFocusEvent> placeGainFocusEvent;\n    protected Event<PlaceLostFocusEvent> placeLostFocusEvent;\n    protected Event<PanelFocusEvent> panelFocusEvent;\n    protected Event<SelectPlaceEvent> selectPlaceEvent;\n    protected Event<PlaceMaximizedEvent> placeMaximizedEvent;\n    protected Event<PlaceMinimizedEvent> placeMinimizedEvent;\n    protected Event<PlaceHiddenEvent> placeHiddenEvent;\n    protected SyncBeanManager iocManager;\n    protected Instance<PlaceManager> placeManager;\n    /**\n     * Description that the current root panel was created from. Presently, this is a mutable data structure and the\n     * whole UF framework tries to keep this in sync with the reality (syncing each change from DOM -> Widget ->\n     * UberView -> Presenter -> Definition). This may change in the future. See UF-117.\n     */\n    protected PanelDefinition rootPanelDef = null;\n    protected PartDefinition activePart = null;\n    LayoutSelection layoutSelection;\n    private BeanFactory beanFactory;\n    private Elemental2DomUtil elemental2DomUtil;\n    /**\n     * Registration for the native preview handler that watches for ^M events and maximizes/restores the current panel.\n     */\n    private HandlerRegistration globalHandlerRegistration;\n\n    /**\n     * The currently maximized panel. Set to null when a panel is not maximized.\n     */\n    private WorkbenchPanelPresenter maximizedPanel = null;\n\n    @Inject\n    public PanelManagerImpl(\n            Event<PlaceGainFocusEvent> placeGainFocusEvent,\n            Event<PlaceLostFocusEvent> placeLostFocusEvent,\n            Event<PanelFocusEvent> panelFocusEvent,\n            Event<SelectPlaceEvent> selectPlaceEvent,\n            Event<PlaceMaximizedEvent> placeMaximizedEvent,\n            Event<PlaceMinimizedEvent> placeMinimizedEventEvent,\n            Event<PlaceHiddenEvent> placeHiddenEvent,\n            SyncBeanManager iocManager,\n            Instance<PlaceManager> placeManager,\n            LayoutSelection layoutSelection,\n            BeanFactory beanFactory,\n            Elemental2DomUtil elemental2DomUtil) {\n        this.placeGainFocusEvent = placeGainFocusEvent;\n        this.placeLostFocusEvent = placeLostFocusEvent;\n        this.panelFocusEvent = panelFocusEvent;\n        this.selectPlaceEvent = selectPlaceEvent;\n        this.placeMaximizedEvent = placeMaximizedEvent;\n        this.placeMinimizedEvent = placeMinimizedEventEvent;\n        this.placeHiddenEvent = placeHiddenEvent;\n        this.iocManager = iocManager;\n        this.placeManager = placeManager;\n        this.layoutSelection = layoutSelection;\n        this.beanFactory = beanFactory;\n        this.elemental2DomUtil = elemental2DomUtil;\n    }\n\n    @PostConstruct\n    private void setup() {\n        globalHandlerRegistration = com.google.gwt.user.client.Event.addNativePreviewHandler(new NativePreviewHandler() {\n\n            @Override\n            public void onPreviewNativeEvent(NativePreviewEvent event) {\n                if (event.getTypeInt() == com.google.gwt.user.client.Event.ONKEYPRESS &&\n                        event.getNativeEvent().getCharCode() == 'm' &&\n                        event.getNativeEvent().getCtrlKey()) {\n                    if (maximizedPanel != null) {\n                        maximizedPanel.unmaximize();\n                        maximizedPanel = null;\n                    } else if (activePart != null) {\n                        WorkbenchPanelPresenter activePanelPresenter = mapPanelDefinitionToPresenter.get(activePart.getParentPanel());\n                        activePanelPresenter.maximize();\n                        maximizedPanel = activePanelPresenter;\n                    }\n                }\n            }\n        });\n    }\n\n    @PreDestroy\n    private void teardown() {\n        globalHandlerRegistration.removeHandler();\n    }\n\n    protected BeanFactory getBeanFactory() {\n        return beanFactory;\n    }\n\n    @Override\n    public PanelDefinition getRoot() {\n        return this.rootPanelDef;\n    }\n\n    @Override\n    public void setRoot(PerspectiveActivity activity,\n                        PanelDefinition root) {\n        checkNotNull(\"root\",\n                     root);\n\n        final WorkbenchPanelPresenter oldRootPanelPresenter = mapPanelDefinitionToPresenter.remove(rootPanelDef);\n\n        if (!mapPanelDefinitionToPresenter.isEmpty()) {\n            String message = \"Can't replace current root panel because it is not empty. The following panels remain: \" + mapPanelDefinitionToPresenter;\n            mapPanelDefinitionToPresenter.put(rootPanelDef,\n                                              oldRootPanelPresenter);\n            throw new IllegalStateException(message);\n        }\n\n        HasWidgets perspectiveContainer = layoutSelection.get().getPerspectiveContainer();\n        perspectiveContainer.clear();\n\n        getBeanFactory().destroy(oldRootPanelPresenter);\n\n        this.rootPanelDef = root;\n        WorkbenchPanelPresenter newPresenter = mapPanelDefinitionToPresenter.get(root);\n        if (newPresenter == null) {\n            newPresenter = getBeanFactory().newRootPanel(activity,\n                                                         root);\n            mapPanelDefinitionToPresenter.put(root,\n                                              newPresenter);\n        }\n        perspectiveContainer.add(newPresenter.getPanelView().asWidget());\n    }\n\n    @Override\n    public void addWorkbenchPart(final PlaceRequest place,\n                                 final PartDefinition partDef,\n                                 final PanelDefinition panelDef,\n                                 final Menus menus,\n                                 final UIPart uiPart,\n                                 final String contextId,\n                                 final Integer preferredWidth,\n                                 final Integer preferredHeight) {\n        checkNotNull(\"panel\",\n                     panelDef);\n\n        final WorkbenchPanelPresenter panelPresenter = mapPanelDefinitionToPresenter.get(panelDef);\n        if (panelPresenter == null) {\n            throw new IllegalArgumentException(\"Target panel is not part of the layout\");\n        }\n\n        WorkbenchPartPresenter partPresenter = mapPartDefinitionToPresenter.get(partDef);\n        if (partPresenter == null) {\n            partPresenter = getBeanFactory().newWorkbenchPart(menus,\n                                                              uiPart.getTitle(),\n                                                              uiPart.getTitleDecoration(),\n                                                              partDef,\n                                                              panelPresenter.getPartType());\n            partPresenter.setWrappedWidget(uiPart.getWidget());\n            partPresenter.setContextId(contextId);\n            mapPartDefinitionToPresenter.put(partDef,\n                                             partPresenter);\n        }\n\n        panelPresenter.addPart(partPresenter,\n                               contextId);\n        if (panelPresenter.getParent() instanceof DockingWorkbenchPanelPresenter) {\n            DockingWorkbenchPanelPresenter parent = (DockingWorkbenchPanelPresenter) panelPresenter.getParent();\n            parent.setChildSize(panelPresenter,\n                                preferredWidth,\n                                preferredHeight);\n        }\n\n        //Select newly inserted part\n        selectPlaceEvent.fire(new SelectPlaceEvent(place));\n    }\n\n    @Override\n    public boolean removePartForPlace(PlaceRequest toRemove) {\n        final PartDefinition removedPart = getPartForPlace(toRemove);\n        if (removedPart != null) {\n            removePart(removedPart);\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public PanelDefinition addWorkbenchPanel(final PanelDefinition targetPanel,\n                                             final Position position,\n                                             final Integer height,\n                                             final Integer width,\n                                             final Integer minHeight,\n                                             final Integer minWidth) {\n        final PanelDefinitionImpl childPanel = new PanelDefinitionImpl(PanelDefinition.PARENT_CHOOSES_TYPE);\n\n        childPanel.setHeight(height);\n        childPanel.setWidth(width);\n        childPanel.setMinHeight(minHeight);\n        childPanel.setMinWidth(minWidth);\n        return addWorkbenchPanel(targetPanel,\n                                 childPanel,\n                                 position);\n    }\n\n    @Override\n    public void removeWorkbenchPanel(final PanelDefinition toRemove) throws IllegalStateException {\n        if (toRemove.isRoot()) {\n            throw new IllegalArgumentException(\"The root panel cannot be removed. To replace it, call setRoot()\");\n        }\n        if (!toRemove.getParts().isEmpty()) {\n            throw new IllegalStateException(\"Panel still contains parts: \" + toRemove.getParts());\n        }\n\n        final WorkbenchPanelPresenter presenterToRemove = mapPanelDefinitionToPresenter.remove(toRemove);\n        if (presenterToRemove == null) {\n            throw new IllegalArgumentException(\"Couldn't find panel to remove: \" + toRemove);\n        }\n\n        removeWorkbenchPanelFromParent(toRemove,\n                                       presenterToRemove);\n\n        // we do this check last because some panel types (eg. docking panels) can \"rescue\" orphaned child panels\n        // during the PanelPresenter.remove() call\n        if (!toRemove.getChildren().isEmpty()) {\n            throw new IllegalStateException(\"Panel still contains child panels: \" + toRemove.getChildren());\n        }\n\n        getBeanFactory().destroy(presenterToRemove);\n    }\n\n    private void removeWorkbenchPanelFromParent(final PanelDefinition toRemove,\n                                                final WorkbenchPanelPresenter presenterToRemove) {\n        HasWidgets customContainer = customPanels.remove(toRemove);\n        if (customContainer != null) {\n            customContainer.remove(presenterToRemove.getPanelView().asWidget());\n        } else {\n            HTMLElement customHTMLElementContainer = customPanelsInsideHTMLElements.remove(toRemove);\n            if (customHTMLElementContainer != null) {\n                DOMUtil.removeFromParent(presenterToRemove.getPanelView().asWidget());\n            } else {\n                elemental2.dom.HTMLElement customElemental2HtmlElement = customPanelsInsideElemental2HTMLElements.remove(toRemove);\n                if (customElemental2HtmlElement != null) {\n                    final elemental2.dom.HTMLElement element =\n                            elemental2DomUtil.asHTMLElement(presenterToRemove.getPanelView().asWidget().getElement());\n                    elemental2DomUtil.removeAllElementChildren(element);\n                } else {\n                    final PanelDefinition parentDef = toRemove.getParent();\n                    final WorkbenchPanelPresenter parentPresenter = mapPanelDefinitionToPresenter.get(parentDef);\n                    if (parentPresenter == null) {\n                        throw new IllegalArgumentException(\"The given panel's parent could not be found\");\n                    }\n\n                    parentPresenter.removePanel(presenterToRemove);\n                }\n            }\n        }\n    }\n\n    @Override\n    public void onPartFocus(final PartDefinition part) {\n        activePart = part;\n        panelFocusEvent.fire(new PanelFocusEvent(part.getParentPanel()));\n        placeGainFocusEvent.fire(new PlaceGainFocusEvent(part.getPlace()));\n    }\n\n    @Override\n    public void onPartMaximized(final PartDefinition part) {\n        placeMaximizedEvent.fire(new PlaceMaximizedEvent(part.getPlace()));\n    }\n\n    @Override\n    public void onPartMinimized(final PartDefinition part) {\n        placeMinimizedEvent.fire(new PlaceMinimizedEvent(part.getPlace()));\n    }\n\n    @Override\n    public PartDefinition getFocusedPart() {\n        return activePart;\n    }\n\n    @Override\n    public void onPartHidden(final PartDefinition part) {\n        placeHiddenEvent.fire(new PlaceHiddenEvent(part.getPlace()));\n    }\n\n    @Override\n    public void onPartLostFocus() {\n        if (activePart == null) {\n            return;\n        }\n        placeLostFocusEvent.fire(new PlaceLostFocusEvent(activePart.getPlace()));\n        activePart = null;\n    }\n\n    @Override\n    public void onPanelFocus(final PanelDefinition panel) {\n        for (Map.Entry<PanelDefinition, WorkbenchPanelPresenter> e : mapPanelDefinitionToPresenter.entrySet()) {\n            e.getValue().setFocus(e.getKey().asString().equals(panel.asString()));\n        }\n    }\n\n    @Override\n    public void closePart(final PartDefinition part) {\n        placeManager.get().closePlace(part.getPlace());\n    }\n\n    void onSelectPlaceEvent(@Observes SelectPlaceEvent event) {\n        final PlaceRequest place = event.getPlace();\n\n        // TODO (hbraun): PanelDefinition is not distinct (missing hashcode)\n        for (Map.Entry<PanelDefinition, WorkbenchPanelPresenter> e : new HashSet<>(mapPanelDefinitionToPresenter.entrySet())) {\n            WorkbenchPanelPresenter panelPresenter = e.getValue();\n            for (PartDefinition part : ensureIterable(panelPresenter.getDefinition().getParts())) {\n                if (part.getPlace().asString().equals(place.asString())) {\n                    panelPresenter.selectPart(part);\n                    onPanelFocus(e.getKey());\n                }\n            }\n        }\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onDropPlaceEvent(@Observes DropPlaceEvent event) {\n        final PartDefinition part = getPartForPlace(event.getPlace());\n        if (part != null) {\n            removePart(part);\n        }\n    }\n\n    @Override\n    public PanelDefinition getPanelForPlace(final PlaceRequest place) {\n        for (PartDefinition part : mapPartDefinitionToPresenter.keySet()) {\n            if (part.getPlace().equals(place)) {\n                return part.getParentPanel();\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Returns the first live (associated with an active presenter) PartDefinition whose place matches the given one.\n     *\n     * @return the definition for the live part servicing the given place, or null if no such part can be found.\n     */\n    protected PartDefinition getPartForPlace(final PlaceRequest place) {\n        for (PartDefinition part : mapPartDefinitionToPresenter.keySet()) {\n            if (part.getPlace().asString().equals(place.asString())) {\n                return part;\n            }\n        }\n        return null;\n    }\n\n    @SuppressWarnings(\"unused\")\n    private void onChangeTitleWidgetEvent(@Observes ChangeTitleWidgetEvent event) {\n        if (event.getPlaceRequest() == null) {\n            return;\n        }\n        final PlaceRequest place = event.getPlaceRequest();\n        final IsWidget titleDecoration = event.getTitleDecoration();\n        final String title = event.getTitle();\n        for (Map.Entry<PanelDefinition, WorkbenchPanelPresenter> e : mapPanelDefinitionToPresenter.entrySet()) {\n            final PanelDefinition panel = e.getKey();\n            final WorkbenchPanelPresenter presenter = e.getValue();\n            for (PartDefinition part : ensureIterable(panel.getParts())) {\n                if (place.equals(part.getPlace())) {\n                    mapPartDefinitionToPresenter.get(part).setTitle(title);\n                    presenter.changeTitle(part,\n                                          title,\n                                          titleDecoration);\n                    break;\n                }\n            }\n        }\n    }\n\n    /**\n     * Destroys the presenter bean associated with the given part and removes the part's presenter from the panel\n     * presenter that contains it (which in turn removes the part definition from the panel definition and the part view\n     * from the panel view).\n     *\n     * @param part the definition of the workbench part (screen or editor) to remove from the layout.\n     */\n    protected void removePart(final PartDefinition part) {\n        for (Map.Entry<PanelDefinition, WorkbenchPanelPresenter> e : mapPanelDefinitionToPresenter.entrySet()) {\n            final WorkbenchPanelPresenter panelPresenter = e.getValue();\n            if (panelPresenter.getDefinition().getParts().contains(part)) {\n                panelPresenter.removePart(part);\n                break;\n            }\n        }\n\n        WorkbenchPartPresenter deadPartPresenter = mapPartDefinitionToPresenter.remove(part);\n        getBeanFactory().destroy(deadPartPresenter);\n    }\n\n    @Override\n    public PanelDefinition addWorkbenchPanel(final PanelDefinition targetPanel,\n                                             final PanelDefinition childPanel,\n                                             final Position position) {\n\n        WorkbenchPanelPresenter targetPanelPresenter = mapPanelDefinitionToPresenter.get(targetPanel);\n\n        if (targetPanelPresenter == null) {\n            targetPanelPresenter = beanFactory.newWorkbenchPanel(targetPanel);\n            mapPanelDefinitionToPresenter.put(targetPanel,\n                                              targetPanelPresenter);\n        }\n\n        PanelDefinition newPanel;\n\n        // Position instance could come from a different script so we compare using position.getName\n        if (CompassPosition.ROOT.getName().equals(position.getName())) {\n            newPanel = rootPanelDef;\n        } else if (CompassPosition.SELF.getName().equals(position.getName())) {\n            newPanel = targetPanelPresenter.getDefinition();\n        } else {\n            String defaultChildType = targetPanelPresenter.getDefaultChildType();\n            if (defaultChildType == null) {\n                throw new IllegalArgumentException(\"Target panel (type \" + targetPanelPresenter.getClass().getName() + \")\"\n                                                           + \" does not allow child panels\");\n            }\n\n            if (childPanel.getPanelType().equals(PanelDefinition.PARENT_CHOOSES_TYPE)) {\n                childPanel.setPanelType(defaultChildType);\n            }\n\n            final WorkbenchPanelPresenter childPanelPresenter = beanFactory.newWorkbenchPanel(childPanel);\n            mapPanelDefinitionToPresenter.put(childPanel,\n                                              childPanelPresenter);\n\n            targetPanelPresenter.addPanel(childPanelPresenter,\n                                          position);\n            newPanel = childPanel;\n        }\n\n        onPanelFocus(newPanel);\n\n        return newPanel;\n    }\n\n    @Override\n    public CustomPanelDefinition addCustomPanel(final HasWidgets container,\n                                                final String panelType) {\n        return addCustomPanelOnContainer(container,\n                                         new CustomPanelDefinitionImpl(panelType,\n                                                                       container),\n                                         false);\n    }\n\n    @Override\n    public CustomPanelDefinition addCustomPanel(final HTMLElement container,\n                                                final String panelType) {\n        return addCustomPanelOnContainer(container,\n                                         new CustomPanelDefinitionImpl(panelType,\n                                                                       container),\n                                         false);\n    }\n\n    @Override\n    public CustomPanelDefinition addCustomPanel(final elemental2.dom.HTMLElement container,\n                                                final String panelType) {\n        return addCustomPanelOnContainer(container,\n                                         new CustomPanelDefinitionImpl(panelType,\n                                                                       container),\n                                         true);\n    }\n\n    private CustomPanelDefinition addCustomPanelOnContainer(final Object container,\n                                                            CustomPanelDefinitionImpl panelDef,\n                                                            final boolean isElemental2) {\n        final WorkbenchPanelPresenter panelPresenter = beanFactory.newWorkbenchPanel(panelDef);\n        Widget panelViewWidget = panelPresenter.getPanelView().asWidget();\n        panelViewWidget.addAttachHandler(new CustomPanelCleanupHandler(panelPresenter));\n\n        if (container instanceof HasWidgets) {\n            HasWidgets widgetContainer = (HasWidgets) container;\n            widgetContainer.add(panelViewWidget);\n            customPanels.put(panelDef,\n                             widgetContainer);\n        } else {\n            // Cannot do instanceof against native JsType interface\n            if (isElemental2) {\n                elemental2.dom.HTMLElement htmlContainer = (elemental2.dom.HTMLElement) container;\n                appendWidgetToElement(htmlContainer,\n                                      panelViewWidget);\n                customPanelsInsideElemental2HTMLElements.put(panelDef,\n                                                             htmlContainer);\n            } else {\n                HTMLElement htmlContainer = (HTMLElement) container;\n                appendWidgetToElement(htmlContainer,\n                                      panelViewWidget);\n                customPanelsInsideHTMLElements.put(panelDef,\n                                                   htmlContainer);\n            }\n        }\n\n        mapPanelDefinitionToPresenter.put(panelDef,\n                                          panelPresenter);\n        onPanelFocus(panelDef);\n        return panelDef;\n    }\n\n    void appendWidgetToElement(final HTMLElement container,\n                               final Widget panelViewWidget) {\n        DOMUtil.appendWidgetToElement(container,\n                                      panelViewWidget.asWidget());\n    }\n\n    void appendWidgetToElement(final elemental2.dom.HTMLElement container,\n                               final Widget panelViewWidget) {\n        elemental2DomUtil.appendWidgetToElement(container,\n                                                panelViewWidget.asWidget());\n    }\n\n    /**\n     * Cleanup handler for custom panels that are removed from the DOM before they are removed via PlaceManager.\n     *\n     * @see PanelManagerImpl#addCustomPanel(HasWidgets, String)\n     */\n    private final class CustomPanelCleanupHandler implements AttachEvent.Handler {\n\n        private final WorkbenchPanelPresenter panelPresenter;\n        private boolean detaching;\n\n        private CustomPanelCleanupHandler(WorkbenchPanelPresenter panelPresenter) {\n            this.panelPresenter = panelPresenter;\n        }\n\n        @Override\n        public void onAttachOrDetach(AttachEvent event) {\n            if (event.isAttached()) {\n                return;\n            }\n            if (!detaching && mapPanelDefinitionToPresenter.containsKey(panelPresenter.getDefinition())) {\n                System.out.println(\"Running cleanup for \" + Debug.objectId(this));\n                detaching = true;\n                Scheduler.get().scheduleFinally(new ScheduledCommand() {\n                    @Override\n                    public void execute() {\n                        try {\n                            for (PartDefinition part : ensureIterable(panelPresenter.getDefinition().getParts())) {\n                                placeManager.get().closePlace(part.getPlace());\n                            }\n\n                            // in many cases, the panel will have cleaned itself up when we closed its last part in the loop above.\n                            // for other custom panel use cases, the panel may still be open. we can do the cleanup here.\n                            if (mapPanelDefinitionToPresenter.containsKey(panelPresenter.getDefinition())) {\n                                removeWorkbenchPanel(panelPresenter.getDefinition());\n                            }\n                        } finally {\n                            detaching = false;\n                        }\n                    }\n                });\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/PluginEntryPoint.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\n\n@EntryPoint\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\")\npublic class PluginEntryPoint {\n\n    // Don't remove this injection point. It makes sure placeManager doesn't \n    // get pruned in case -Derrai.ioc.reachability=Aggressive\n    @SuppressWarnings(\"unused\")\n    @Inject\n    private PlaceManager placeManager;\n\n    @Produces\n    @ApplicationScoped\n    private SessionInfo currentSession(User identity) {\n        return new SessionInfoImpl(identity);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/StandaloneEditorPerspective.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.impl.AdaptiveWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\n@Dependent\n@Named(StandaloneEditorPerspective.IDENTIFIER)\npublic class StandaloneEditorPerspective extends AbstractWorkbenchPerspectiveActivity {\n\n    public static final String IDENTIFIER = \"StandaloneEditorPerspective\";\n\n    @Inject\n    public StandaloneEditorPerspective(final PlaceManager placeManager) {\n        super(placeManager);\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl(AdaptiveWorkbenchPanelPresenter.class.getName());\n        p.setName(\"Standalone Editor Perspective\");\n        return p;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return IDENTIFIER;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/VFSLockServiceProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface VFSLockServiceProxy {\n\n    void acquireLock(final Path path,\n                     final ParameterizedCommand<LockResult> parameterizedCommand);\n\n    void releaseLock(final Path path,\n                     final ParameterizedCommand<LockResult> parameterizedCommand);\n\n    void forceReleaseLock(final Path path,\n                          final ParameterizedCommand<LockResult> parameterizedCommand);\n\n    void retrieveLockInfo(final Path path,\n                          final ParameterizedCommand<LockInfo> parameterizedCommand);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/VFSLockServiceProxyClientImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class VFSLockServiceProxyClientImpl implements VFSLockServiceProxy {\n\n    @Override\n    public void acquireLock(Path path,\n                            ParameterizedCommand<LockResult> parameterizedCommand) {\n        parameterizedCommand.execute(new LockResult(true,\n                                                    new LockInfo(false,\n                                                                 \"\",\n                                                                 path)));\n    }\n\n    @Override\n    public void releaseLock(Path path,\n                            ParameterizedCommand<LockResult> parameterizedCommand) {\n        parameterizedCommand.execute(new LockResult(true,\n                                                    new LockInfo(false,\n                                                                 \"\",\n                                                                 path)));\n    }\n\n    @Override\n    public void forceReleaseLock(Path path,\n                                 ParameterizedCommand<LockResult> parameterizedCommand) {\n        parameterizedCommand.execute(new LockResult(true,\n                                                    new LockInfo(false,\n                                                                 \"\",\n                                                                 path)));\n    }\n\n    @Override\n    public void retrieveLockInfo(Path path,\n                                 ParameterizedCommand<LockInfo> parameterizedCommand) {\n        parameterizedCommand.execute(new LockInfo(false,\n                                                  \"\",\n                                                  path));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/VFSServiceProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.ParameterizedCommand;\n\npublic interface VFSServiceProxy {\n\n    void get(final String path,\n             final ParameterizedCommand<Path> parameterizedCommand);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/VFSServiceProxyClientImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class VFSServiceProxyClientImpl implements VFSServiceProxy {\n\n    @Override\n    public void get(final String path,\n                    final ParameterizedCommand<Path> parameterizedCommand) {\n        parameterizedCommand.execute(null);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/Workbench.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.RootLayoutPanel;\nimport org.jboss.errai.bus.client.api.ClientMessageBus;\nimport org.jboss.errai.ioc.client.api.AfterInitialization;\nimport org.jboss.errai.ioc.client.api.EnabledByProperty;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.slf4j.Logger;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.util.UserAgent;\nimport org.uberfire.client.workbench.events.ApplicationReadyEvent;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\n/**\n * Responsible for bootstrapping the client-side Workbench user interface by coordinating calls to the PanelManager and\n * PlaceManager. Normally this happens automatically with no need for assistance or interference from the application.\n * Thus, applications don't usually need to do anything with the Workbench class directly.\n * <p>\n * <h2>Delaying Workbench Startup</h2>\n * <p>\n * In special cases, applications may wish to delay the startup of the workbench. For example, an application that\n * relies on global variables (also known as singletons or Application Scoped beans) that are initialized based on\n * response data from the server doesn't want UberFire to start initializing its widgets until that server response has\n * come in.\n * <p>\n * To delay startup, add a <i>Startup Blocker</i> before Errai starts calling {@link AfterInitialization} methods. The\n * best place to do this is in the {@link PostConstruct} method of an {@link EntryPoint} bean. You would then remove the\n * startup blocker from within the callback from the server:\n * <p>\n * <pre>\n *   {@code @EntryPoint}\n *   public class MyMutableGlobal() {\n *     {@code @Inject private Workbench workbench;}\n *     {@code @Inject private Caller<MyRemoteService> remoteService;}\n *\n *     // set up by a server call. don't start the app until it's populated!\n *     {@code private MyParams params;}\n *\n *     {@code @PostConstruct}\n *     private void earlyInit() {\n *       workbench.addStartupBlocker(MyMutableGlobal.class);\n *     }\n *\n *     {@code @AfterInitialization}\n *     private void lateInit() {\n *       remoteService.call(new {@code RemoteCallback<MyParams>}{\n *         public void callback(MyParams params) {\n *           MyMutableGlobal.this.params = params;\n *           workbench.removeStartupBlocker(MyMutableGlobal.class);\n *         }\n *       }).fetchParameters();\n *     }\n *   }\n * </pre>\n */\n@EntryPoint\n@EnabledByProperty(value = \"uberfire.plugin.mode.active\", negated = true)\npublic class Workbench {\n\n    /**\n     * List of classes who want to do stuff (often server communication) before the workbench shows up.\n     */\n    private final Set<Class<?>> startupBlockers = new HashSet<>();\n    private final Set<String> headersToKeep = new HashSet<>();\n    /**\n     * This indirection exists so we can ignore spurious WindowCloseEvents in IE10.\n     * In all other cases, the {@link WorkbenchCloseHandler} simply executes whatever command we pass it.\n     */\n    private final WorkbenchCloseHandler workbenchCloseHandler = GWT.create(WorkbenchCloseHandler.class);\n    @Inject\n    LayoutSelection layoutSelection;\n    /**\n     * Fired when all startup blockers have cleared and just before the workbench starts to build its components.\n     */\n    @Inject\n    private Event<ApplicationReadyEvent> appReady;\n    private boolean isStandaloneMode = false;\n    @Inject\n    private ActivityBeansCache activityBeansCache;\n    @Inject\n    private SyncBeanManager iocManager;\n    @Inject\n    private PlaceManager placeManager;\n    @Inject\n    private PermissionManager permissionManager;\n    @Inject\n    private AuthorizationManager authorizationManager;\n    @Inject\n    private VFSServiceProxy vfsService;\n    private WorkbenchLayout layout;\n    @Inject\n    private User identity;\n    @Inject\n    private ClientMessageBus bus;\n    @Inject\n    private Logger logger;\n    private SessionInfo sessionInfo = null;\n    @Inject\n    private ManagedInstance<WorkbenchCustomStandalonePerspectiveDefinition> workbenchCustomStandalonePerspectiveDefinition;\n\n    final ParameterizedCommand<Window.ClosingEvent> workbenchClosingCommand = (Window.ClosingEvent event) -> {\n        if (!placeManager.canCloseAllPlaces()) {\n            // Setting a non-null message will make the browser to present a confirmation dialog that asks the user\n            // whether or not they wish to navigate away from the page. The message in the dialog, however,\n            // is not customizable anymore mainly due to scammers using such a message to trick people.\n            // Thus, each browser shows its own message. If the user has an outdated browser, then our custom\n            // message might be shown.\n            event.setMessage(WorkbenchConstants.INSTANCE.closingWindowMessage());\n        }\n    };\n\n    final Command workbenchCloseCommand = () -> placeManager.closeAllPlaces(); // would be preferable to close current perspective, which should be recursive\n\n    /**\n     * Requests that the workbench does not attempt to create any UI parts until the given responsible party has\n     * been removed as a startup blocker. Blockers are tracked as a set, so adding the same class more than once has no\n     * effect.\n     * @param responsibleParty any Class object; typically it will be the class making the call to this method.\n     * Must not be null.\n     */\n    public void addStartupBlocker(Class<?> responsibleParty) {\n        startupBlockers.add(responsibleParty);\n        logger.info(responsibleParty.getName() + \" is blocking workbench startup.\");\n    }\n\n    /**\n     * Causes the given responsible party to no longer block workbench initialization.\n     * If the given responsible party was not already in the blocking set (either because\n     * it was never added, or it has already been removed) then the method call has no effect.\n     * <p>\n     * After removing the blocker, if there are no more blockers left in the blocking set, the workbench UI is\n     * bootstrapped immediately. If there are still one or more blockers left in the blocking set, the workbench UI\n     * remains uninitialized.\n     * @param responsibleParty any Class object that was previously passed to {@link #addStartupBlocker(Class)}.\n     * Must not be null.\n     */\n    public void removeStartupBlocker(Class<?> responsibleParty) {\n        if (startupBlockers.remove(responsibleParty)) {\n            logger.info(responsibleParty.getName() + \" is no longer blocking startup.\");\n        } else {\n            logger.info(responsibleParty.getName() + \" tried to unblock startup, but it wasn't blocking to begin with!\");\n        }\n        startIfNotBlocked();\n    }\n\n    // package-private so tests can call in\n    void startIfNotBlocked() {\n        logger.info(startupBlockers.size() + \" workbench startup blockers remain.\");\n        if (startupBlockers.isEmpty()) {\n            bootstrap();\n        }\n    }\n\n    @AfterInitialization\n    private void afterInit() {\n        removeStartupBlocker(Workbench.class);\n    }\n\n    @PostConstruct\n    private void earlyInit() {\n        layout = layoutSelection.get();\n        WorkbenchResources.INSTANCE.CSS().ensureInjected();\n\n        Map<String, List<String>> windowParamMap = Window.Location.getParameterMap();\n        isStandaloneMode = windowParamMap.containsKey(\"standalone\");\n        List<String> headers = windowParamMap.getOrDefault(\"header\", Collections.emptyList());\n        headersToKeep.addAll(headers);\n        addStartupBlocker(Workbench.class);\n    }\n\n    private void bootstrap() {\n        logger.info(\"Starting workbench...\");\n        ((SessionInfoImpl) currentSession()).setId(bus.getSessionId());\n\n        //Lookup PerspectiveProviders and if present launch it to set-up the Workbench\n        if (!isStandaloneMode) {\n            final PerspectiveActivity homePerspective = getHomePerspectiveActivity();\n            appReady.fire(new ApplicationReadyEvent());\n            if (homePerspective != null) {\n                layout.setMarginWidgets(isStandaloneMode, headersToKeep);\n                layout.onBootstrap();\n                addLayoutToRootPanel(layout);\n                placeManager.goTo(new DefaultPlaceRequest(homePerspective.getIdentifier()));\n            } else {\n                activityBeansCache.noOp();\n                logger.warn(\"No home perspective available!\");\n            }\n        } else {\n            layout.setMarginWidgets(isStandaloneMode,\n                                    headersToKeep);\n            layout.onBootstrap();\n\n            addLayoutToRootPanel(layout);\n            handleStandaloneMode(Window.Location.getParameterMap());\n        }\n\n        addCloseHandler();\n\n        // Resizing the Window should resize everything\n        Window.addResizeHandler(event -> layout.resizeTo(event.getWidth(),\n                                                         event.getHeight()));\n\n        // Defer the initial resize call until widgets are rendered and sizes are available\n        Scheduler.get().scheduleDeferred(() -> layout.onResize());\n\n        notifyJSReady();\n    }\n\n    private void addCloseHandler() {\n        if (UserAgent.isChrome()) {\n            setupMessageForUnsavedChanges(); // only works on chrome\n            Window.addCloseHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand));\n        } else {\n            // The Window.addCloseHandler does not work as expected for other browsers, thus we need to register the\n            // workbenchCloseCommand in the Window.addWindowClosingHandler.\n            Window.addWindowClosingHandler(event -> workbenchCloseHandler.onWindowClose(workbenchCloseCommand));\n        }\n    }\n\n    private void setupMessageForUnsavedChanges() {\n        Window.addWindowClosingHandler(event -> workbenchCloseHandler.onWindowClosing(workbenchClosingCommand, event));\n    }\n\n    private native void notifyJSReady() /*-{\n        if ($wnd.appFormerGwtFinishedLoading) {\n            $wnd.appFormerGwtFinishedLoading();\n        }\n    }-*/;\n\n    // TODO add tests for standalone startup vs. full startup\n    void handleStandaloneMode(final Map<String, List<String>> parameters) {\n        if (parameters.containsKey(\"perspective\") && !parameters.get(\"perspective\").isEmpty()) {\n            placeManager.goTo(new DefaultPlaceRequest(parameters.get(\"perspective\").get(0)));\n        } else if (parameters.containsKey(\"path\") && !parameters.get(\"path\").isEmpty()) {\n            openStandaloneEditor(parameters);\n        }\n    }\n\n    private void openStandaloneEditor(final Map<String, List<String>> parameters) {\n        String standalonePerspective = \"StandaloneEditorPerspective\";\n        boolean openEditor = true;\n\n        if (!workbenchCustomStandalonePerspectiveDefinition.isUnsatisfied()) {\n            final WorkbenchCustomStandalonePerspectiveDefinition workbenchCustomStandalonePerspectiveDefinition = this.workbenchCustomStandalonePerspectiveDefinition.get();\n            standalonePerspective = workbenchCustomStandalonePerspectiveDefinition.getStandalonePerspectiveIdentifier();\n            openEditor = workbenchCustomStandalonePerspectiveDefinition.openPathAutomatically();\n        }\n\n        placeManager.goTo(new DefaultPlaceRequest(standalonePerspective));\n        if (openEditor) {\n            vfsService.get(parameters.get(\"path\").get(0),\n                           path -> {\n                               if (parameters.containsKey(\"editor\") && !parameters.get(\"editor\").isEmpty()) {\n                                   openEditor(path, parameters.get(\"editor\").get(0));\n                               } else {\n                                   openEditor(path);\n                               }\n                           });\n        }\n    }\n\n    void openEditor(final Path path) {\n        placeManager.goTo(new PathPlaceRequest(path));\n    }\n\n    void openEditor(final Path path,\n                    final String editor) {\n        placeManager.goTo(new PathPlaceRequest(path, editor));\n    }\n\n    /**\n     * Get the home perspective defined at the workbench authorization policy.\n     * <p>\n     * <p>If no home is defined then the perspective marked as \"{@code isDefault=true}\" is taken.</p>\n     * <p>\n     * <p>Notice that access permission over the selected perspective is always required.</p>\n     * @return A perspective instance or null if no perspective is found or access to it has been denied.\n     */\n    public PerspectiveActivity getHomePerspectiveActivity() {\n\n        // Get the user's home perspective\n        PerspectiveActivity homePerspective = null;\n        AuthorizationPolicy authPolicy = permissionManager.getAuthorizationPolicy();\n        String homePerspectiveId = authPolicy.getHomePerspective(identity);\n\n        // Get the workbench's default perspective\n        PerspectiveActivity defaultPerspective = null;\n        final Collection<SyncBeanDef<PerspectiveActivity>> perspectives = iocManager.lookupBeans(PerspectiveActivity.class);\n\n        for (final SyncBeanDef<PerspectiveActivity> perspective : perspectives) {\n            final PerspectiveActivity instance = perspective.getInstance();\n\n            if (homePerspectiveId != null && homePerspectiveId.equals(instance.getIdentifier())) {\n                homePerspective = instance;\n                if (defaultPerspective != null) {\n                    iocManager.destroyBean(defaultPerspective);\n                }\n            } else if (instance.isDefault()) {\n                defaultPerspective = instance;\n            } else {\n                iocManager.destroyBean(instance);\n            }\n        }\n        // The home perspective has always priority over the default\n        return homePerspective != null ? homePerspective : defaultPerspective;\n    }\n\n    @Produces\n    @ApplicationScoped\n    private SessionInfo currentSession() {\n        if (sessionInfo == null) {\n            sessionInfo = new SessionInfoImpl(identity);\n        }\n        return sessionInfo;\n    }\n\n    void addLayoutToRootPanel(final WorkbenchLayout layout) {\n        RootLayoutPanel.get().add(layout.getRoot());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchCloseHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * Generic WindowCloseHandler\n */\npublic interface WorkbenchCloseHandler {\n\n    void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command);\n\n    void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command,\n                         final Window.ClosingEvent event);\n\n    void onWindowClose(final Command command);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchCloseHandlerImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * Generic WindowCloseHandler\n */\npublic class WorkbenchCloseHandlerImpl implements WorkbenchCloseHandler {\n\n    @Override\n    public void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command) {\n        this.onWindowClosing(command, null);\n    }\n\n    @Override\n    public void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command,\n                                final Window.ClosingEvent event) {\n        if (command != null) {\n            command.execute(event);\n        }\n    }\n\n    @Override\n    public void onWindowClose(final Command command) {\n        if (command != null) {\n            command.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchCloseHandlerImplFallback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.Window;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * Generic WindowCloseHandler\n */\npublic class WorkbenchCloseHandlerImplFallback implements WorkbenchCloseHandler {\n\n    @Override\n    public void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command) {\n        //Do nothing, as WindowCloseEvents are raised when we don't need them by IE10 and Firefox\n    }\n\n    @Override\n    public void onWindowClosing(final ParameterizedCommand<Window.ClosingEvent> command,\n                                final Window.ClosingEvent event) {\n        //Do nothing, as WindowCloseEvents are raised when we don't need them by IE10 and Firefox\n    }\n\n    @Override\n    public void onWindowClose(final Command command) {\n        //Do nothing, as WindowCloseEvents are raised when we don't need them by IE10 and Firefox\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchCustomStandalonePerspectiveDefinition.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\npublic interface WorkbenchCustomStandalonePerspectiveDefinition {\n\n    String getStandalonePerspectiveIdentifier();\n\n    boolean openPathAutomatically();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchLayout.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.Set;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.mvp.Command;\n\n/**\n * Used by the workbench to construct the outer most DOM structure (header, footer and perspective container).\n * Uberfire provides a default {@link org.uberfire.client.workbench.WorkbenchLayoutImpl} that can be replaced\n * through the mechanism described in {@link org.uberfire.client.workbench.LayoutSelection}.\n */\npublic interface WorkbenchLayout {\n\n    /**\n     * Gives access to the root container element that will be attached to the {@link com.google.gwt.user.client.ui.RootLayoutPanel}.\n     * @return the outer most workbench widget\n     */\n    IsWidget getRoot();\n\n    /**\n     * Gives access to the element of the workbench that hosts perspective widgets.\n     * @return the perspective container element\n     */\n    HasWidgets getPerspectiveContainer();\n\n    /**\n     * Will be invoked by the {@link org.uberfire.client.workbench.Workbench}\n     * when the discovery of header and footer elements is completed.\n     * @see {@link #setHeaderContents(java.util.List)}\n     * @see {@link #setFooterContents(java.util.List)}\n     */\n    public void onBootstrap();\n\n    /**\n     * The {@link org.uberfire.client.workbench.Workbench} listens for resize events and hands them off\n     * to the layout. Not needed if your layout is based on {@link com.google.gwt.user.client.ui.LayoutPanel}'s.\n     * Kept for backwards compatibility.\n     */\n    void onResize();\n\n    /**\n     * See {@link #onResize()}\n     * @param width\n     * @param height\n     */\n    void resizeTo(int width,\n                  int height);\n\n    /**\n     * Makes the given widget fill the entire space normally dedicated to the perspective container. Has no effect if\n     * the given widget is already maximized.\n     * <p/>\n     * <b>Important:</b> this feature is used by panels to maximize themselves. You should not pass a WorkbenchPanelView\n     * to this method yourself; instead, you should use the panel's own API to maximize it. You are free to use this method\n     * to maximize your own widgets that are not workbench panels.\n     * @param w the Widget to maximize.\n     */\n    void maximize(Widget w);\n\n    /**\n     * Makes the given widget fill the entire space normally dedicated to the perspective container. Has no effect if\n     * the given widget is already maximized.\n     * <p/>\n     * <b>Important:</b> this feature is used by panels to maximize themselves. You should not pass a WorkbenchPanelView\n     * to this method yourself; instead, you should use the panel's own API to maximize it. You are free to use this method\n     * to maximize your own widgets that are not workbench panels.\n     * @param w the Widget to maximize.\n     * @param callback A command to be executed after the maximization is fully completed.\n     */\n    void maximize(Widget w,\n                  Command callback);\n\n    /**\n     * Restores a previously maximized widget to its original size and position. Has no effect if the given widget is\n     * not currently in a maximized state set up by {@link #maximize(Widget)}.\n     * <p/>\n     * <b>Important:</b> this feature is used by panels to unmaximize themselves. You should not pass a WorkbenchPanelView\n     * to this method yourself; instead, you should use the panel's own API to unmaximize it. You are free to use this method\n     * to unmaximize your own widgets that have previously been passed to {@link #maximize(Widget)}.\n     * @param w the Widget to restore to its original size and location.\n     */\n    void unmaximize(Widget w);\n\n    /**\n     * Restores a previously maximized widget to its original size and position. Has no effect if the given widget is\n     * not currently in a maximized state set up by {@link #maximize(Widget)}.\n     * <p/>\n     * <b>Important:</b> this feature is used by panels to unmaximize themselves. You should not pass a WorkbenchPanelView\n     * to this method yourself; instead, you should use the panel's own API to unmaximize it. You are free to use this method\n     * to unmaximize your own widgets that have previously been passed to {@link #maximize(Widget)}.\n     * @param w the Widget to restore to its original size and location.\n     * @param callback A command to be executed after the unmaximization is fully completed.\n     */\n    void unmaximize(Widget w,\n                    Command callback);\n\n    /**\n     * Will insert the implementations of Header and Footer in the Workbench\n     * @see {@link #setHeaderContents(java.util.List)}\n     * @see {@link #setFooterContents(java.util.List)}\n     */\n    void setMarginWidgets(boolean isStandaloneMode,\n                          Set<String> headersToKeep);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchLayoutImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.animation.client.Animation;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.HeaderPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.docks.UberfireDocksContainer;\nimport org.uberfire.client.workbench.events.WorkbenchProfileCssClass;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchPickupDragController;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\nimport static java.util.Collections.sort;\n\n/**\n * The default layout implementation.\n */\n@ApplicationScoped\npublic class WorkbenchLayoutImpl implements WorkbenchLayout {\n\n    public static final String UF_MAXIMIZED_PANEL = \"uf-maximized-panel\";\n\n    public static final String UF_ROOT_CSS_CLASS = \"uf-workbench-layout\";\n    /**\n     * Holder for style information that was modified in order to maximize a panel.\n     */\n\n    private static final int MAXIMIZED_PANEL_Z_INDEX = 100;\n\n    /**\n     * Dock Layout panel: in center root perspective and also (if available) with east west south docks\n     */\n    private final DockLayoutPanel rootContainer = new DockLayoutPanel(Unit.PX);\n    /**\n     * The panel within which the current perspective's root view resides. This panel lasts the lifetime of the app; it's\n     * cleared and repopulated with the new perspective's root view each time\n     * {@link org.uberfire.client.workbench.PanelManager#setPerspective(PerspectiveDefinition)} gets called.\n     */\n    private final SimpleLayoutPanel perspectiveRootContainer = new SimpleLayoutPanel();\n    private final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles = new HashMap<Widget, OriginalStyleInfo>();\n    private SyncBeanManager iocManager;\n    /**\n     * Top-level widget of the whole workbench layout. This panel contains the nested container panels for headers,\n     * footers, and the current perspective. During a normal startup of UberFire, this panel would be added directly to\n     * the RootLayoutPanel.\n     */\n    private HeaderPanel root;\n    /**\n     * The panel within which the current perspective's header widgets reside. This panel lasts the lifetime of the app;\n     * it's cleared and repopulated with the new perspective's root view each time\n     * {@link #setHeaderContents(java.util.List)} gets called.\n     */\n    private Div headerPanel;\n    /**\n     * The panel within which the current perspective's footer widgets reside. This panel lasts the lifetime of the app;\n     * it's cleared and repopulated with the new perspective's root view each time\n     * {@link #setFooterContents(java.util.List)} gets called. The actual panel that's used for this is specified by the\n     * concrete subclass's constructor.\n     */\n    private Div footerPanel;\n    private WorkbenchDragAndDropManager dndManager;\n    /**\n     * An abstraction for DockLayoutPanel used by Uberfire Docks.\n     */\n    private UberfireDocksContainer uberfireDocksContainer;\n    /**\n     * We read the drag boundary panel out of this, and sandwich it between the root panel and the perspective container panel.\n     */\n    private WorkbenchPickupDragController dragController;\n\n    public WorkbenchLayoutImpl() {\n\n    }\n\n    @Inject\n    public WorkbenchLayoutImpl(SyncBeanManager iocManager,\n                               HeaderPanel root,\n                               WorkbenchDragAndDropManager dndManager,\n                               UberfireDocksContainer uberfireDocksContainer,\n                               WorkbenchPickupDragController dragController,\n                               Div headerPanel,\n                               Div footerPanel) {\n\n        this.iocManager = iocManager;\n        this.root = root;\n        this.dndManager = dndManager;\n        this.uberfireDocksContainer = uberfireDocksContainer;\n        this.dragController = dragController;\n        this.headerPanel = headerPanel;\n        this.footerPanel = footerPanel;\n    }\n\n    @PostConstruct\n    private void init() {\n        perspectiveRootContainer.ensureDebugId(\"perspectiveRootContainer\");\n        headerPanel.setId(\"workbenchHeaderPanel\");\n        footerPanel.setId(\"workbenchFooterPanel\");\n        dragController.getBoundaryPanel().ensureDebugId(\"workbenchDragBoundary\");\n        root.addStyleName(UF_ROOT_CSS_CLASS);\n    }\n\n    @Override\n    public HeaderPanel getRoot() {\n        return root;\n    }\n\n    @Override\n    public HasWidgets getPerspectiveContainer() {\n        return perspectiveRootContainer;\n    }\n\n    void setHeaderContents(List<Header> headers) {\n        DOMUtil.removeAllChildren(headerPanel);\n        if (!headers.isEmpty()) {\n            for (Header h : headers) {\n                headerPanel.appendChild(h.getElement());\n            }\n            root.setHeaderWidget(createWidgetFrom(headerPanel));\n        }\n    }\n\n    void setFooterContents(List<Footer> footers) {\n        DOMUtil.removeAllChildren(footerPanel);\n        if (!footers.isEmpty()) {\n            for (Footer f : footers) {\n                footerPanel.appendChild(f.getElement());\n            }\n            root.setFooterWidget(createWidgetFrom(footerPanel));\n        }\n    }\n\n    ElementWrapperWidget<?> createWidgetFrom(HTMLElement h) {\n        return ElementWrapperWidget.getWidget(h);\n    }\n\n    @Override\n    public void onBootstrap() {\n        dndManager.unregisterDropControllers();\n\n        AbsolutePanel dragBoundary = dragController.getBoundaryPanel();\n        dragBoundary.add(perspectiveRootContainer);\n\n        setupDocksContainer();\n        rootContainer.add(dragBoundary);\n\n        Layouts.setToFillParent(perspectiveRootContainer);\n        Layouts.setToFillParent(dragBoundary);\n        Layouts.setToFillParent(rootContainer);\n\n        root.setContentWidget(rootContainer);\n    }\n\n    private void setupDocksContainer() {\n        uberfireDocksContainer.setup(rootContainer,\n                                     () -> Scheduler.get().scheduleDeferred(() -> onResize()));\n    }\n\n    @Override\n    public void onResize() {\n        resizeTo(Window.getClientWidth(),\n                 Window.getClientHeight());\n    }\n\n    @Override\n    public void resizeTo(int width,\n                         int height) {\n        root.setPixelSize(width,\n                          height);\n\n        // The dragBoundary can't be a LayoutPanel, so it doesn't support ProvidesResize/RequiresResize.\n        // We start the cascade of onResize() calls at its immediate child.\n        perspectiveRootContainer.onResize();\n\n        new Timer() {\n            @Override\n            public void run() {\n                updateMaximizedPanelSizes();\n            }\n        }.schedule(5);\n    }\n\n    private void updateMaximizedPanelSizes() {\n        for (Widget w : maximizedWidgetOriginalStyles.keySet()) {\n            Style style = w.getElement().getStyle();\n            style.setTop(perspectiveRootContainer.getAbsoluteTop(),\n                         Unit.PX);\n            style.setLeft(perspectiveRootContainer.getAbsoluteLeft(),\n                          Unit.PX);\n            style.setWidth(perspectiveRootContainer.getOffsetWidth(),\n                           Unit.PX);\n            style.setHeight(perspectiveRootContainer.getOffsetHeight(),\n                            Unit.PX);\n\n            if (w instanceof RequiresResize) {\n                ((RequiresResize) w).onResize();\n            }\n        }\n    }\n\n    @Override\n    public void maximize(final Widget w) {\n        maximize(w,\n                 null);\n    }\n\n    @Override\n    public void maximize(final Widget w,\n                         final Command callback) {\n        if (maximizedWidgetOriginalStyles.get(w) != null) {\n            return;\n        }\n\n        // this allows application-specified background colour, animation, borders, etc.\n        w.addStyleName(UF_MAXIMIZED_PANEL);\n\n        new ExpandAnimation(w,\n                            maximizedWidgetOriginalStyles,\n                            perspectiveRootContainer,\n                            callback).run();\n    }\n\n    @Override\n    public void unmaximize(final Widget w) {\n        unmaximize(w,\n                   null);\n    }\n\n    @Override\n    public void unmaximize(final Widget w,\n                           final Command callback) {\n        w.removeStyleName(UF_MAXIMIZED_PANEL);\n\n        new CollapseAnimation(w,\n                              maximizedWidgetOriginalStyles,\n                              callback).run();\n    }\n\n    @Override\n    public void setMarginWidgets(boolean isStandaloneMode,\n                                 Set<String> headersToKeep) {\n        setHeaderContents(discoverMarginWidgets(isStandaloneMode,\n                                                headersToKeep,\n                                                Header.class));\n        setFooterContents(discoverMarginWidgets(isStandaloneMode,\n                                                headersToKeep,\n                                                Footer.class));\n    }\n\n    private <T extends Orderable> List<T> discoverMarginWidgets(boolean isStandaloneMode,\n                                                                Set<String> headersToKeep,\n                                                                Class<T> marginType) {\n        final Collection<SyncBeanDef<T>> headerBeans = iocManager.lookupBeans(marginType);\n        final List<T> instances = new ArrayList<T>();\n        for (final SyncBeanDef<T> headerBean : headerBeans) {\n            if (!headerBean.isActivated()) {\n                continue;\n            }\n\n            T instance = headerBean.getInstance();\n\n            // for regular mode (not standalone) we add every header and footer widget;\n            // for standalone mode, we only add the ones requested in the URL\n            if ((!isStandaloneMode) || headersToKeep.contains(instance.getId())) {\n                instances.add(instance);\n            }\n        }\n        sort(instances,\n             new Comparator<Orderable>() {\n                 @Override\n                 public int compare(final Orderable o1,\n                                    final Orderable o2) {\n                     if (o1.getOrder() < o2.getOrder()) {\n                         return 1;\n                     } else if (o1.getOrder() > o2.getOrder()) {\n                         return -1;\n                     } else {\n                         return 0;\n                     }\n                 }\n             });\n\n        return instances;\n    }\n\n    public void addWorkbenchProfileCssClass(@Observes WorkbenchProfileCssClass workbenchProfileCssClass) {\n        root.removeStyleName(root.getStyleName());\n        root.addStyleName(UF_ROOT_CSS_CLASS);\n        root.addStyleName(workbenchProfileCssClass.getClassName());\n    }\n\n    protected Div getHeaderPanel() {\n        return headerPanel;\n    }\n\n    protected Div getFooterPanel() {\n        return footerPanel;\n    }\n\n    protected static abstract class AbstractResizeAnimation extends Animation {\n\n        protected final Style style;\n        protected final Widget w;\n        protected final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles;\n        protected final Command onCompleteCallback;\n\n        public AbstractResizeAnimation(final Widget w,\n                                       final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles,\n                                       final Command onCompleteCallback) {\n            this.w = w;\n            this.maximizedWidgetOriginalStyles = maximizedWidgetOriginalStyles;\n            this.onCompleteCallback = onCompleteCallback;\n            style = w.getElement().getStyle();\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            final double width = newTarget(w.getElement().getClientWidth(),\n                                           getTargetWidth(),\n                                           progress);\n            style.setWidth(width,\n                           Unit.PX);\n            final double height = newTarget(w.getElement().getClientHeight(),\n                                            getTargetHeight(),\n                                            progress);\n            style.setHeight(height,\n                            Unit.PX);\n            final double top = newTarget(w.getAbsoluteTop(),\n                                         getTargetTop(),\n                                         progress);\n            style.setTop(top,\n                         Unit.PX);\n            final double left = newTarget(w.getAbsoluteLeft(),\n                                          getTargetLeft(),\n                                          progress);\n            style.setLeft(left,\n                          Unit.PX);\n        }\n\n        public abstract int getTargetWidth();\n\n        public abstract int getTargetHeight();\n\n        public abstract int getTargetTop();\n\n        public abstract int getTargetLeft();\n\n        public void run() {\n            super.run(1000);\n        }\n\n        @Override\n        protected void onComplete() {\n            super.onComplete();\n            if (onCompleteCallback != null) {\n                onCompleteCallback.execute();\n            }\n        }\n\n        private double newTarget(int current,\n                                 int target,\n                                 double progress) {\n            return Math.round(current + ((target - current) * progress));\n        }\n\n        public void onResize() {\n            if (w instanceof RequiresResize) {\n                ((RequiresResize) w).onResize();\n            }\n        }\n    }\n\n    protected static class ExpandAnimation extends AbstractResizeAnimation {\n\n        protected final SimpleLayoutPanel perspectiveRootContainer;\n\n        public ExpandAnimation(\n                final Widget w,\n                final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles,\n                final SimpleLayoutPanel perspectiveRootContainer,\n                final Command onCompleteCallback) {\n            super(w,\n                  maximizedWidgetOriginalStyles,\n                  onCompleteCallback);\n            this.perspectiveRootContainer = perspectiveRootContainer;\n        }\n\n        @Override\n        protected void onStart() {\n            maximizedWidgetOriginalStyles.put(w,\n                                              new OriginalStyleInfo(w));\n            style.setZIndex(MAXIMIZED_PANEL_Z_INDEX);\n            style.setHeight(w.getElement().getClientHeight(),\n                            Unit.PX);\n            style.setWidth(w.getElement().getClientWidth(),\n                           Unit.PX);\n            style.setTop(w.getAbsoluteTop(),\n                         Unit.PX);\n            style.setLeft(w.getAbsoluteLeft(),\n                          Unit.PX);\n            style.setPosition(Position.FIXED);\n        }\n\n        @Override\n        public int getTargetWidth() {\n            return perspectiveRootContainer.getOffsetWidth();\n        }\n\n        @Override\n        public int getTargetHeight() {\n            return perspectiveRootContainer.getOffsetHeight();\n        }\n\n        @Override\n        public int getTargetTop() {\n            return perspectiveRootContainer.getAbsoluteTop();\n        }\n\n        @Override\n        public int getTargetLeft() {\n            return perspectiveRootContainer.getAbsoluteLeft();\n        }\n\n        @Override\n        protected void onComplete() {\n            super.onComplete();\n            onResize();\n        }\n    }\n\n    protected static class CollapseAnimation extends AbstractResizeAnimation {\n\n        private final OriginalStyleInfo originalStyleInfo;\n\n        public CollapseAnimation(final Widget w,\n                                 final Map<Widget, OriginalStyleInfo> maximizedWidgetOriginalStyles,\n                                 final Command onCompleteCallback) {\n            super(w,\n                  maximizedWidgetOriginalStyles,\n                  onCompleteCallback);\n            originalStyleInfo = maximizedWidgetOriginalStyles.remove(w);\n        }\n\n        @Override\n        public int getTargetWidth() {\n            return originalStyleInfo.getClientWidth();\n        }\n\n        @Override\n        public int getTargetHeight() {\n            return originalStyleInfo.getClientHeight();\n        }\n\n        @Override\n        public int getTargetTop() {\n            return originalStyleInfo.getAbsoluteTop();\n        }\n\n        @Override\n        public int getTargetLeft() {\n            return originalStyleInfo.getAbsoluteLeft();\n        }\n\n        @Override\n        protected void onComplete() {\n            originalStyleInfo.restore(w);\n            onResize();\n            if (onCompleteCallback != null) {\n                onCompleteCallback.execute();\n            }\n        }\n    }\n\n    /**\n     * Holder for style information that was modified in order to maximize a panel.\n     */\n    protected static class OriginalStyleInfo {\n\n        private String position;\n        private String top;\n        private String left;\n        private String width;\n        private String height;\n        private String zIndex;\n        private int absoluteTop;\n        private int absoluteLeft;\n        private int clientHeight;\n        private int clientWidth;\n\n        public OriginalStyleInfo(final Widget w) {\n            absoluteLeft = w.getAbsoluteLeft();\n            absoluteTop = w.getAbsoluteTop();\n            clientHeight = w.getElement().getClientHeight();\n            clientWidth = w.getElement().getClientWidth();\n\n            final Style style = w.getElement().getStyle();\n            position = style.getPosition();\n            top = style.getTop();\n            left = style.getLeft();\n            width = style.getWidth();\n            height = style.getHeight();\n            zIndex = style.getZIndex();\n        }\n\n        /**\n         * Restores to {@code w} all style values to those most recently set on this instance.\n         * @param w the widget to restore styles on.\n         */\n        public void restore(final Widget w) {\n            final Style style = w.getElement().getStyle();\n            style.setProperty(\"position\",\n                              position);\n            style.setProperty(\"top\",\n                              top);\n            style.setProperty(\"left\",\n                              left);\n            style.setProperty(\"width\",\n                              width);\n            style.setProperty(\"height\",\n                              height);\n            style.setProperty(\"zIndex\",\n                              zIndex);\n        }\n\n        public int getAbsoluteTop() {\n            return absoluteTop;\n        }\n\n        public int getAbsoluteLeft() {\n            return absoluteLeft;\n        }\n\n        public int getClientHeight() {\n            return clientHeight;\n        }\n\n        public int getClientWidth() {\n            return clientWidth;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchLayoutInfo.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\n/**\n * Used to retrieve some layout information from the workbench.\n */\npublic interface WorkbenchLayoutInfo {\n\n    /**\n     * Returns the header's height of the current perspective.\n     */\n    public int getHeaderHeight();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchLayoutInfoImpl.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\n@ApplicationScoped\npublic class WorkbenchLayoutInfoImpl implements WorkbenchLayoutInfo {\n\n    @Inject\n    private WorkbenchLayoutImpl workbenchLayout;\n\n    @Override\n    public int getHeaderHeight() {\n        try {\n            return workbenchLayout.getHeaderPanel().getBoundingClientRect().getHeight().intValue();\n        } catch (Exception e) {\n            return 0;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchServicesProxy.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.Set;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\npublic interface WorkbenchServicesProxy {\n\n    void save(final String perspectiveId,\n              final PerspectiveDefinition activePerspective,\n              final Command callback);\n\n    void loadPerspective(final String name,\n                         final ParameterizedCommand<PerspectiveDefinition> parameterizedCommand);\n\n    void loadPerspectives(final ParameterizedCommand<Set<PerspectiveDefinition>> parameterizedCommand);\n\n    void removePerspectiveState(final String perspectiveId,\n                                final Command callback);\n\n    void removePerspectiveStates(final Command doWhenFinished);\n\n    void save(final SplashScreenFilter splashFilter);\n\n    void loadSplashScreenFilter(final String name,\n                                final ParameterizedCommand<SplashScreenFilter> parameterizedCommand);\n\n    void isWorkbenchOnCluster(final ParameterizedCommand<Boolean> parameterizedCommand);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/WorkbenchServicesProxyClientImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\n\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n@Alternative\n@Dependent\npublic class WorkbenchServicesProxyClientImpl implements WorkbenchServicesProxy {\n\n    @Override\n    public void save(final String perspectiveId,\n                     final PerspectiveDefinition activePerspective,\n                     final Command callback) {\n        callback.execute();\n    }\n\n    @Override\n    public void loadPerspective(final String name,\n                                final ParameterizedCommand<PerspectiveDefinition> parameterizedCommand) {\n        parameterizedCommand.execute(null);\n    }\n\n    @Override\n    public void loadPerspectives(final ParameterizedCommand<Set<PerspectiveDefinition>> parameterizedCommand) {\n        parameterizedCommand.execute(null);\n    }\n\n    @Override\n    public void removePerspectiveState(final String perspectiveId,\n                                       final Command callback) {\n        callback.execute();\n    }\n\n    @Override\n    public void removePerspectiveStates(final Command doWhenFinished) {\n        doWhenFinished.execute();\n    }\n\n    @Override\n    public void save(final SplashScreenFilter splashFilter) {\n\n    }\n\n    @Override\n    public void loadSplashScreenFilter(final String name,\n                                       final ParameterizedCommand<SplashScreenFilter> parameterizedCommand) {\n        parameterizedCommand.execute(null);\n    }\n\n    @Override\n    public void isWorkbenchOnCluster(final ParameterizedCommand<Boolean> parameterizedCommand) {\n        parameterizedCommand.execute(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/annotations/AssociatedResources.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\nimport org.uberfire.client.workbench.type.ClientResourceType;\n\n/**\n * Definition of a supported resource types\n */\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface AssociatedResources {\n\n    Class<? extends ClientResourceType>[] value();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/annotations/Priority.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.annotations;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n/**\n * Defines a priority for an editor Place\n */\n@Qualifier\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE})\npublic @interface Priority {\n\n    int value();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDock.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport java.util.Objects;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport org.uberfire.mvp.PlaceRequest;\n\npublic class UberfireDock {\n\n    private PlaceRequest placeRequest;\n\n    private String iconType;\n\n    private UberfireDockPosition uberfireDockPosition;\n\n    private String associatedPerspective;\n\n    private Double size;\n\n    private String label;\n\n    private String tooltip;\n\n    private ImageResource imageIcon;\n\n    private ImageResource imageIconFocused;\n\n    public UberfireDock(UberfireDockPosition uberfireDockPosition,\n                        String iconType,\n                        PlaceRequest placeRequest,\n                        String associatedPerspective) {\n        this.uberfireDockPosition = uberfireDockPosition;\n        this.iconType = iconType;\n        this.placeRequest = placeRequest;\n        this.associatedPerspective = associatedPerspective;\n        this.label = placeRequest.getIdentifier();\n    }\n\n    public UberfireDock(UberfireDockPosition uberfireDockPosition,\n                        String iconType,\n                        PlaceRequest placeRequest) {\n        this(uberfireDockPosition,\n             iconType,\n             placeRequest,\n             null);\n    }\n\n    public UberfireDock(UberfireDockPosition uberfireDockPosition,\n                        ImageResource imageIcon,\n                        ImageResource imageIconFocused,\n                        PlaceRequest placeRequest,\n                        String associatedPerspective) {\n        this.uberfireDockPosition = uberfireDockPosition;\n        this.imageIcon = imageIcon;\n        this.imageIconFocused = imageIconFocused;\n        this.placeRequest = placeRequest;\n        this.associatedPerspective = associatedPerspective;\n        this.label = placeRequest.getIdentifier();\n    }\n\n    public UberfireDock(UberfireDockPosition uberfireDockPosition,\n                        ImageResource imageIcon,\n                        ImageResource imageIconFocused,\n                        PlaceRequest placeRequest) {\n        this(uberfireDockPosition,\n             imageIcon,\n             imageIconFocused,\n             placeRequest,\n             null);\n    }\n\n    public UberfireDock withLabel(String label) {\n        this.label = label;\n        return this;\n    }\n\n    public UberfireDock withTooltip(String tooltip) {\n        this.tooltip = tooltip;\n        return this;\n    }\n\n    public UberfireDock withSize(double size) {\n        this.size = size;\n        return this;\n    }\n\n    public void setUberfireDockPosition(UberfireDockPosition uberfireDockPosition) {\n        this.uberfireDockPosition = uberfireDockPosition;\n    }\n\n    public String getAssociatedPerspective() {\n        return associatedPerspective;\n    }\n\n    public String getIdentifier() {\n        return placeRequest.getIdentifier();\n    }\n\n    public PlaceRequest getPlaceRequest() {\n        return placeRequest;\n    }\n\n    public UberfireDockPosition getDockPosition() {\n        return uberfireDockPosition;\n    }\n\n    public Double getSize() {\n        return size;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public String getTooltip() {\n        return tooltip;\n    }\n\n    public String getIconType() {\n        return iconType;\n    }\n\n    public ImageResource getImageIcon() {\n        return imageIcon;\n    }\n\n    public ImageResource getImageIconFocused() {\n        return imageIconFocused;\n    }\n\n    @Override\n    public boolean equals(Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        UberfireDock that = (UberfireDock) o;\n\n        return Objects.equals(uberfireDockPosition, that.uberfireDockPosition) &&\n                Objects.equals(iconType, that.iconType) &&\n                Objects.equals(imageIcon, that.imageIcon) &&\n                Objects.equals(imageIconFocused, that.imageIconFocused) &&\n                Objects.equals(placeRequest, that.placeRequest) &&\n                Objects.equals(associatedPerspective, that.associatedPerspective) &&\n                Objects.equals(size, that.size) &&\n                Objects.equals(label, that.label) &&\n                Objects.equals(tooltip, that.tooltip);\n    }\n\n    @Override\n    public int hashCode() {\n        int result = placeRequest.hashCode();\n        result = 31 * result + (uberfireDockPosition != null ? uberfireDockPosition.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (iconType != null ? iconType.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (imageIcon != null ? imageIcon.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (imageIconFocused != null ? imageIconFocused.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (associatedPerspective != null ? associatedPerspective.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (size != null ? size.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (label != null ? label.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (tooltip != null ? tooltip.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDockContainerReadyEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class UberfireDockContainerReadyEvent implements UberFireEvent {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDockPosition.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\npublic enum UberfireDockPosition {\n\n    SOUTH {\n        @Override\n        public boolean allowSingleDockItem() {\n            return false;\n        }\n        @Override\n        public String getShortName() {\n            return \"S\";\n        }\n    },\n    WEST {\n        @Override\n        public boolean allowSingleDockItem() {\n            return true;\n        }\n\n        @Override\n        public String getShortName() {\n            return \"W\";\n        }\n    },\n    EAST {\n        @Override\n        public boolean allowSingleDockItem() {\n            return false;\n        }\n        @Override\n        public String getShortName() {\n            return \"E\";\n        }\n    };\n\n    public abstract boolean allowSingleDockItem();\n    public abstract String getShortName();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDockReadyEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class UberfireDockReadyEvent implements UberFireEvent {\n\n    private String currentPerspective;\n\n    public UberfireDockReadyEvent(final String currentPerspective) {\n        this.currentPerspective = currentPerspective;\n    }\n\n    public String getCurrentPerspective() {\n        return currentPerspective;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDocks.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Uberfire Dock Support\n */\npublic interface UberfireDocks {\n\n    /**\n     * Adds a {@link UberfireDock} to UberfireDocks.\n     * Each {@link UberfireDock} is displayed after the\n     * associated Perspective is loaded.\n     * @param docks one or more docks to be added.\n     */\n    void add(UberfireDock... docks);\n\n    /**\n     * Removes a {@link UberfireDock} from UberfireDocks.\n     * @param docks one or more docks to be added.\n     */\n    void remove(UberfireDock... docks);\n\n    /**\n     * Open a {@link UberfireDock} from a given perspective.\n     * This opens the {@link PlaceRequest} associated with the\n     * given dock on the docks panel.\n     * @param dock that will be selected.\n     */\n    void open(UberfireDock dock);\n\n    /**\n     * Close a {@link UberfireDock} from a given perspective.\n     * This closes the {@link PlaceRequest} associated with the\n     * given dock and the docks panel.\n     * @param dock that will be deselected.\n     */\n    void close(UberfireDock dock);\n\n    /**\n     * Toggle a {@link UberfireDock} from a given perspective.\n     * Switch from open/close a dock\n     * @param dock that will be deselected.\n     */\n    void toggle(UberfireDock dock);\n\n    /**\n     * Hides the docks bar associated with {@link UberfireDockPosition}\n     * for a given perspective.\n     * @param position the dock position that will be hidden.\n     * @param perspectiveName pespective that the dock will be hidden.\n     */\n    void hide(UberfireDockPosition position,\n              String perspectiveName);\n\n    /**\n     * Shows the docks bar associated with {@link UberfireDockPosition}\n     * for a given perspective.\n     * @param position the dock position that will be shown.\n     * @param perspectiveName perspective that the dock will be shown.\n     */\n    void show(UberfireDockPosition position,\n              String perspectiveName);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDocksContainer.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.uberfire.mvp.Command;\n\n/**\n * An abstraction for DockLayoutPanel used by Uberfire Docks.\n */\n@ApplicationScoped\npublic class UberfireDocksContainer {\n\n    @Inject\n    private Event<UberfireDockContainerReadyEvent> event;\n\n    private DockLayoutPanel rootContainer;\n\n    private Command resizeCommand;\n\n    public void setup(DockLayoutPanel rootContainer,\n                      Command resizeCommand) {\n        this.rootContainer = rootContainer;\n        this.resizeCommand = resizeCommand;\n        event.fire(new UberfireDockContainerReadyEvent());\n    }\n\n    public void add(UberfireDockPosition position,\n                    Widget widget,\n                    Double size) {\n        if (position == UberfireDockPosition.SOUTH) {\n            rootContainer.addSouth(widget,\n                                   size);\n        } else if (position == UberfireDockPosition.EAST) {\n            rootContainer.addEast(widget,\n                                  size);\n        } else if (position == UberfireDockPosition.WEST) {\n            rootContainer.addWest(widget,\n                                  size);\n        }\n    }\n\n    public void addBreadcrumbs(IsElement isElement,\n                               Double size) {\n        rootContainer.addNorth(ElementWrapperWidget.getWidget(isElement.getElement()),\n                               size);\n    }\n\n    /**\n     * @deprecated You should use Errai UI version of\n     * this method {@link #show(IsElement isElement)}\n     */\n    @Deprecated\n    public void show(Widget widget) {\n        rootContainer.setWidgetHidden(widget,\n                                      false);\n    }\n\n    public void show(IsElement isElement) {\n        rootContainer.setWidgetHidden(ElementWrapperWidget.getWidget(isElement.getElement()),\n                                      false);\n    }\n\n    /**\n     * @deprecated You should use Errai UI version of\n     * this method {@link #hide(IsElement isElement)}\n     */\n    @Deprecated\n    public void hide(Widget widget) {\n        rootContainer.setWidgetHidden(widget,\n                                      true);\n    }\n\n    public void hide(IsElement isElement) {\n        rootContainer.setWidgetHidden(ElementWrapperWidget.getWidget(isElement.getElement()),\n                                      true);\n    }\n\n    public void setWidgetSize(Widget widget,\n                              double size) {\n        rootContainer.setWidgetSize(widget,\n                                    size);\n    }\n\n    public void resize() {\n        resizeCommand.execute();\n    }\n\n    public int getOffsetHeight() {\n        return rootContainer.getOffsetHeight();\n    }\n\n    public int getOffsetWidth() {\n        return rootContainer.getOffsetWidth();\n    }\n\n    public int getClientWidth() {\n        return rootContainer.getElement().getClientWidth();\n    }\n\n    public boolean isReady() {\n        return rootContainer != null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/docks/UberfireDocksInteractionEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.docks;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class UberfireDocksInteractionEvent implements UberFireEvent {\n\n    private final UberfireDock targetDock;\n\n    private final UberfireDockPosition targetDockPosition;\n\n    private final InteractionType type;\n\n    public UberfireDocksInteractionEvent(UberfireDock targetDock,\n                                         InteractionType type) {\n        this.targetDock = targetDock;\n        this.targetDockPosition = targetDock.getDockPosition();\n        this.type = type;\n    }\n\n    public UberfireDocksInteractionEvent(final UberfireDockPosition position,\n                                         final InteractionType type) {\n        this.targetDock = null;\n        this.targetDockPosition = position;\n        this.type = type;\n    }\n\n    public UberfireDock getTargetDock() {\n        return targetDock;\n    }\n\n    public UberfireDockPosition getTargetDockPosition() {\n        return targetDockPosition;\n    }\n\n    public InteractionType getType() {\n        return type;\n    }\n\n    @Override\n    public boolean equals(final Object o) {\n        if (this == o) {\n            return true;\n        }\n        if (o == null || getClass() != o.getClass()) {\n            return false;\n        }\n\n        final UberfireDocksInteractionEvent that = (UberfireDocksInteractionEvent) o;\n\n        if (targetDock != null ? !targetDock.equals(that.targetDock) : that.targetDock != null) {\n            return false;\n        }\n        if (targetDockPosition != that.targetDockPosition) {\n            return false;\n        }\n        return type == that.type;\n    }\n\n    @Override\n    public int hashCode() {\n        int result = targetDock != null ? targetDock.hashCode() : 0;\n        result = 31 * result + (targetDockPosition != null ? targetDockPosition.hashCode() : 0);\n        result = ~~result;\n        result = 31 * result + (type != null ? type.hashCode() : 0);\n        result = ~~result;\n        return result;\n    }\n\n    public enum InteractionType {\n        OPENED,\n        CLOSED,\n        RESIZED\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/AbstractPlaceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.UberFireEvent;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Created by Cristiano Nicolai.\n */\npublic abstract class AbstractPlaceEvent implements UberFireEvent {\n\n    private final PlaceRequest place;\n\n    public AbstractPlaceEvent(final PlaceRequest place) {\n        checkNotNull(\"place\",\n                     place);\n        this.place = place;\n    }\n\n    public PlaceRequest getPlace() {\n        return place;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/ApplicationReadyEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\n/**\n * Fired by the framework when all Workbench startup blockers have cleared, and just before the workbench starts to\n * build its components. Observers receive this event at the last possible opportunity to make changes before the UI\n * shows up for the first time.\n */\npublic class ApplicationReadyEvent implements UberFireEvent {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/BeforeClosePlaceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the PlaceManager before the process of closing a place begins.\n */\npublic class BeforeClosePlaceEvent extends AbstractPlaceEvent {\n\n    private final boolean force;\n\n    /**\n     * Applications should not fire this event, so there is no reason to create instances of this class!\n     * <p>\n     * This constructor will be removed in UberFire 0.6.\n     * @deprecated Prior to UberFire 0.5, it was possible for an application to close a place by firing this event. This\n     * no longer works. Instead, use one of the PlaceManager.closeXXX methods.\n     */\n    @Deprecated\n    public BeforeClosePlaceEvent(final PlaceRequest place) {\n        super(place);\n        throw new UnsupportedOperationException(\"Don't fire this event from apps. Use one of the PlaceManager.closeXXX methods instead.\");\n    }\n\n    /**\n     * Applications should not fire this event, so there is no reason to create instances of this class!\n     * <p>\n     * This constructor will be removed in UberFire 0.6.\n     * @deprecated Prior to UberFire 0.5, it was possible for an application to close a place by firing this event. This\n     * no longer works. Instead, use one of the PlaceManager.closeXXX methods.\n     */\n    @Deprecated\n    public BeforeClosePlaceEvent(final PlaceRequest place,\n                                 final boolean force) {\n        super(place);\n        throw new UnsupportedOperationException(\"Don't fire this event from apps. Use one of the PlaceManager.closeXXX methods instead.\");\n    }\n\n    /**\n     * Internal workbench API. Don't use! If you want to close a place, use {@link PlaceManager#closePlace(PlaceRequest)}.\n     * @param place The place that's about to be closed. Not null.\n     * @param force Whether this will be a forced close operation.\n     * @param frameworkInternal flag to differentiate from the deprecated/disabled constructors.\n     */\n    public BeforeClosePlaceEvent(PlaceRequest place,\n                                 boolean force,\n                                 boolean frameworkInternal) {\n        super(place);\n        this.force = force;\n    }\n\n    /**\n     * Indicates whether or not the place is being closed forcibly. See\n     * {@link PlaceManager#forceClosePlace(PlaceRequest)} for details.\n     */\n    public boolean isForce() {\n        return force;\n    }\n\n    @Override\n    public String toString() {\n        return \"BeforeClosePlaceEvent [place=\" + getPlace() + \", force=\" + force + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/ClosePlaceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the PlaceManager when the activity, panel, presenter, and view associated with a place are about to be\n * removed from the workbench. Observers of this event should clean up any of their own state associated with the given\n * place being live. It is not possible for an observer of this event to cancel the close operation.\n */\npublic class ClosePlaceEvent extends AbstractPlaceEvent {\n\n    public ClosePlaceEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"ClosePlaceEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/DropPlaceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An event when a WorkbenchPart is dropped as part of a DnD operation\n */\npublic class DropPlaceEvent extends AbstractPlaceEvent {\n\n    public DropPlaceEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"DropPlaceEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/NewPerspectiveEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class NewPerspectiveEvent implements UberFireEvent {\n\n    private final String perspectiveName;\n\n    public NewPerspectiveEvent(final String perspectiveName) {\n        this.perspectiveName = perspectiveName;\n    }\n\n    public String getPerspectiveName() {\n        return perspectiveName;\n    }\n\n    @Override\n    public String toString() {\n        return \"NewPerspectiveEvent [perspectiveName=\" + perspectiveName + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/NewWorkbenchScreenEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class NewWorkbenchScreenEvent implements UberFireEvent {\n\n    private final String screenName;\n\n    public NewWorkbenchScreenEvent(final String screenName) {\n        this.screenName = screenName;\n    }\n\n    public String getScreenName() {\n        return screenName;\n    }\n\n    @Override\n    public String toString() {\n        return \"NewWorkbenchScreenEvent [screenName=\" + screenName + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PanelFocusEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\nimport org.uberfire.workbench.model.PanelDefinition;\n\npublic class PanelFocusEvent implements UberFireEvent {\n\n    private final PanelDefinition panel;\n\n    public PanelFocusEvent(PanelDefinition panel) {\n        this.panel = panel;\n    }\n\n    public PanelDefinition getPanel() {\n        return panel;\n    }\n\n    @Override\n    public String toString() {\n        return \"PanelFocusEvent [panel=\" + panel + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PerspectiveChange.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.events.UberFireEvent;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * CDI event fired by the framework just after the current perspective has changed.\n */\npublic class PerspectiveChange implements UberFireEvent {\n\n    private final PerspectiveDefinition perspectiveDefinition;\n    private final Menus menus;\n    private final String identifier;\n    private final PlaceRequest placeRequest;\n\n    public PerspectiveChange(final PlaceRequest placeRequest,\n                             final PerspectiveDefinition perspectiveDefinition,\n                             final Menus menus,\n                             final String identifier) {\n        this.placeRequest = placeRequest;\n        this.perspectiveDefinition = perspectiveDefinition;\n        this.menus = menus;\n        this.identifier = identifier;\n    }\n\n    public PerspectiveDefinition getPerspectiveDefinition() {\n        return perspectiveDefinition;\n    }\n\n    public Menus getMenus() {\n        return menus;\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n\n    public PlaceRequest getPlaceRequest() {\n        return placeRequest;\n    }\n\n    @Override\n    public String toString() {\n        return \"PerspectiveChange{\" +\n                \"perspectiveDefinition=\" + perspectiveDefinition +\n                \", menus=\" + menus +\n                \", identifier='\" + identifier + '\\'' +\n                \", placeRequest=\" + placeRequest +\n                '}';\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PlaceGainFocusEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * A CDI event fired by the framework each time a workbench screen or editor is selected within a panel. Application\n * code may observe and react to this event, but must not fire the event.\n */\npublic class PlaceGainFocusEvent extends AbstractPlaceEvent {\n\n    public PlaceGainFocusEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceGainFocusEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PlaceHiddenEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the framework each time a workbench editor or screen gets hidden.\n */\npublic class PlaceHiddenEvent extends AbstractPlaceEvent {\n\n    public PlaceHiddenEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceHiddenEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PlaceLostFocusEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the framework each time a workbench editor or screen which was previously the selected/active part within a\n * panel has been hidden due to a different part in the same panel being selected.\n */\npublic class PlaceLostFocusEvent extends AbstractPlaceEvent {\n\n    public PlaceLostFocusEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceLostFocusEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PlaceMaximizedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the framework each time a workbench editor or screen gets maximized.\n */\npublic class PlaceMaximizedEvent extends AbstractPlaceEvent {\n\n    public PlaceMaximizedEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceMaximizedEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/PlaceMinimizedEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * Fired by the framework each time a workbench editor or screen gets minimized.\n */\npublic class PlaceMinimizedEvent extends AbstractPlaceEvent {\n\n    public PlaceMinimizedEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"PlaceMinimizedEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/SelectPlaceEvent.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An event to programmatically select a WorkbenchPart\n */\npublic class SelectPlaceEvent extends AbstractPlaceEvent {\n\n    public SelectPlaceEvent(final PlaceRequest place) {\n        super(place);\n    }\n\n    @Override\n    public String toString() {\n        return \"SelectPlaceEvent [place=\" + getPlace() + \"]\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/events/WorkbenchProfileCssClass.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.events;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n/**\n * An event to programmatically add a css class to Workbench root div\n * This is used to differentiate business central profiles\n */\npublic class WorkbenchProfileCssClass  {\n\n    private String className;\n\n    public WorkbenchProfileCssClass(final String className) {\n        this.className = className;\n    }\n\n    public String getClassName() {\n        return className;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/DockingWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels;\n\npublic interface DockingWorkbenchPanelPresenter extends WorkbenchPanelPresenter {\n\n    /**\n     * Sets the width or height of the given child panel to the given dimension, leaving room for the existing space\n     * taken up by (recursively) nested panels in the NORTH, SOUTH, EAST, and WEST child positions. Width is applied\n     * to EAST or WEST children; height is applied to NORTH and SOUTH children. If the requested space isn't available\n     * (for instance because it is larger than the browser window, or it would make the central panel of this view\n     * smaller than its minimum size) then the largest possible amount will be given to the requested child.\n     * Similarly, if the requested size is less than the child's minimum width or height (as appropriate) then the\n     * child will be set to its minimum.\n     * @param child the child panel whose size to change\n     * @param pixelWidth the new width for the child panel, if it supports horizontal resizing. If null, the width will not be\n     * changed.\n     * @param pixelHeight the new height for the child panel, if it supports vertical resizing. If null, the height will not be\n     * changed.\n     * @return true if the given child was in fact part of this panel; false if the child was not found. The return\n     * value is not affected by whether or not the requested size was null.\n     */\n    boolean setChildSize(WorkbenchPanelPresenter child,\n                         Integer pixelWidth,\n                         Integer pixelHeight);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/DockingWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels;\n\n/**\n * Interface for workbench panel views that support \"docking\" nested panels along their edges.\n */\npublic interface DockingWorkbenchPanelView<P extends WorkbenchPanelPresenter> extends WorkbenchPanelView<P> {\n\n    /**\n     * Sets the size (width for EAST or WEST children; height for NORTH and SOUTH children) allocated to the specified\n     * child by moving its splitter bar on the screen. If the requested space isn't available (for instance because it\n     * is larger than the browser window, or it would make the central panel of this view smaller than its minimum size)\n     * then the largest possible amount will be given to the requested child. Similarly, if the requested size is less\n     * than the child's minimum width or height (as appropriate) then the child will be set to its minimum.\n     * @param childPanel the panel whose size to change\n     * @return true if the child was found and its size was adjusted (even if the requested amount was out of range);\n     * false if the given child was not found as a child of this panel.\n     */\n    boolean setChildSize(WorkbenchPanelView<?> childPanel,\n                         int size);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MaximizeToggleButtonPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.mvp.Command;\n\n/**\n * Logic for a widget that allows toggling between a \"maximized\" and normal (unmaximized) state. This class keeps track\n * of the current state on its own and changes its decoration depending on whether it's in the maximized or unmaximized\n * state. The actions taken on each transition are supplied by the caller.\n */\npublic class MaximizeToggleButtonPresenter {\n\n    private final View view;\n    private boolean maximized;\n    private Command maximizeCommand;\n    private Command unmaximizeCommand;\n\n    public MaximizeToggleButtonPresenter(View view) {\n        this.view = PortablePreconditions.checkNotNull(\"view\",\n                                                       view);\n        view.init(this);\n    }\n\n    /**\n     * Returns the currently registered maximize command. Can be used to check if there is currently a maximize command registered.\n     */\n    public Command getMaximizeCommand() {\n        return maximizeCommand;\n    }\n\n    /**\n     * Sets the command to invoke upon each transition from unmaximized to maximized.\n     */\n    public void setMaximizeCommand(Command maximizeCommand) {\n        this.maximizeCommand = maximizeCommand;\n    }\n\n    /**\n     * Returns the currently registered unmaximize command. Can be used to check if there is currently an unmaximize command registered.\n     */\n    public Command getUnmaximizeCommand() {\n        return unmaximizeCommand;\n    }\n\n    /**\n     * Sets the command to invoke upon each transition from maximized to unmaximized.\n     */\n    public void setUnmaximizeCommand(Command unmaximizeCommand) {\n        this.unmaximizeCommand = unmaximizeCommand;\n    }\n\n    /**\n     * Reports whether this button is currently in the maximized state. If true, the next click will return to the\n     * normal unmaximized state. If false, the next click will transition to the maximized state.\n     */\n    public boolean isMaximized() {\n        return maximized;\n    }\n\n    /**\n     * Changes the maximized state of this button <i>without</i> calling the commands. This can be used to notify the\n     * button that some external process has already maximized the thing in question. It is permissible but not necessary\n     * to call this method from the maximizeCommand and unmaximizeCommand.\n     *\n     * @param maximized the new maximized state to set.\n     */\n    public void setMaximized(boolean maximized) {\n        this.maximized = maximized;\n        view.setMaximized(maximized);\n    }\n\n    /**\n     * Handles a click event from the view.\n     */\n    public void handleClick() {\n        final boolean wasMaximized = maximized;\n        setMaximized(!wasMaximized);\n        if (wasMaximized) {\n            if (unmaximizeCommand != null) {\n                unmaximizeCommand.execute();\n            }\n        } else {\n            if (maximizeCommand != null) {\n                maximizeCommand.execute();\n            }\n        }\n    }\n\n    /**\n     * Returns the view for this presenter.\n     *\n     * @return\n     */\n    public View getView() {\n        return view;\n    }\n\n    public void setVisible(boolean b) {\n        view.setVisible(b);\n    }\n\n    public void enable() {\n        view.setEnabled(true);\n    }\n\n    public void disable() {\n        view.setEnabled(false);\n    }\n\n    public interface View extends UberView<MaximizeToggleButtonPresenter> {\n\n        /**\n         * Changes the maximized appearance of the button. When maximized is true, the button should show an\n         * \"unmaximize\" icon; when maximized is false, the button should show a \"maximize\" icon.\n         */\n        void setMaximized(boolean maximized);\n\n        /**\n         * Shows or hides this view's widget.\n         */\n        void setVisible(boolean b);\n\n        /**\n         * Enables or disables this view's widget.\n         */\n        void setEnabled(boolean enabled);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/MultiPartWidget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels;\n\nimport java.util.Collection;\n\nimport com.google.gwt.event.logical.shared.HasBeforeSelectionHandlers;\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\npublic interface MultiPartWidget extends IsWidget,\n                                         RequiresResize,\n                                         HasBeforeSelectionHandlers<PartDefinition>,\n                                         HasSelectionHandlers<PartDefinition> {\n\n    void setPresenter(final WorkbenchPanelPresenter presenter);\n\n    void setDndManager(final WorkbenchDragAndDropManager dndManager);\n\n    /**\n     * Removes all contained WorkbenchParts from this multi-part panel. Part Activities are not closed and part Presenters\n     * are not freed.\n     */\n    void clear();\n\n    void addPart(final WorkbenchPartPresenter.View view);\n\n    void changeTitle(final PartDefinition part,\n                     final String title,\n                     final IsWidget titleDecoration);\n\n    /**\n     * Makes the given part visible if it is a direct child of this widget.\n     * @param part the direct child part to select. Must not be null.\n     * @return true if the part was found as a direct child of this widget, and it was therefore selected. False if the\n     * part was not found, in which case this method had no effect.\n     */\n    boolean selectPart(final PartDefinition part);\n\n    /**\n     * Removes the given part from this widget. If the part was currently selected (visible) when removed, another part\n     * will be selected to take its place.\n     * @param part the part to remove. Must not be null.\n     * @return True if the given part was found as a direct child of this widget, in which case it has been removed.\n     * False if the given part was not found, in which case this method had no effect.\n     */\n    boolean remove(final PartDefinition part);\n\n    /**\n     * Informs this widget that its containing panel view has gained or lost panel focus. Views within focused panels\n     * may respond by updating their style to look more prominent than unfocused views.\n     * @param hasFocus if true, the containing panel now has focus. If false, the panel does not have focus.\n     */\n    void setFocus(final boolean hasFocus);\n\n    /**\n     * Registers the given Command to be called each time something happens (for example, a UI gesture or parhaps an API\n     * call) to make this widget believe its containing panel should be the focused panel.\n     * <p>\n     * Restated for clarity: the given command is called when this view thinks its panel should get focus. The command\n     * is <i>not</i> called as a side effect of calls to {@link #setFocus(boolean)}.\n     * @param doWhenFocused the command to call when this widget believes its panel should become focused. Typically, the given\n     * command will call into the PanelManager to give focus to the containing panel.\n     */\n    void addOnFocusHandler(final Command doWhenFocused);\n\n    /**\n     * Returns the number of parts currently held by this widget.\n     */\n    int getPartsSize();\n\n    /**\n     * Returns the parts currently held by this widget.\n     */\n    Collection<PartDefinition> getParts();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/SplitPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.workbench.model.CompassPosition;\n\n/**\n * Common operations for UberFire's horizontal and vertical splitter panels.\n */\npublic interface SplitPanel extends IsWidget,\n                                    RequiresResize,\n                                    ProvidesResize {\n\n    /**\n     * The default initial size for a fixed-size child.\n     */\n    public static final int DEFAULT_SIZE = 64;\n\n    /**\n     * The default minimum size for a fixed-size child.\n     */\n    public static final int DEFAULT_MIN_SIZE = 32;\n\n    public Widget getParent();\n\n    /**\n     * Sets up this split panel's contents and divider location.\n     * @param eastOrNorthWidget the widget to place in the east side a horizontal panel or north side of a vertical panel.\n     * @param westOsSouthWidget the widget to place in the west side a horizontal panel or south side of a vertical panel.\n     * @param fixedSizeComponent the component that should not change size when the whole split panel grows or shrinks (eg. because the\n     * browser window is being resized)\n     * @param preferredSize the width or height that the fixed-size component should be given initially. If null, a default of\n     * {@value #DEFAULT_SIZE} will be used.\n     * @param preferredMinSize the minimum width or height of the fixed-size component. If null, a default of\n     * {@value #DEFAULT_MIN_SIZE} will be used.\n     */\n    public void setup(final IsWidget eastOrNorthWidget,\n                      final IsWidget westOsSouthWidget,\n                      final CompassPosition fixedSizeComponent,\n                      final Integer preferredSize,\n                      final Integer preferredMinSize);\n\n    public void clear();\n\n    /**\n     * Returns the widget on the given side of this splitter.\n     * @param position which widget to get\n     * @return the widget on the given side of the splitter; null if that side is empty or the given position is not\n     * supported by this panel. (For example, NORTH is not a supported position of HorizontalSplitterPanel).\n     */\n    public Widget getWidget(CompassPosition position);\n\n    /**\n     * Gets the current pixel size of the component that doesn't expand/contract when the whole split pane's container\n     * is resized.\n     */\n    public int getFixedWidgetSize();\n\n    /**\n     * Sets the pixel size of the component that doesn't expand/contract when the whole split pane's container\n     * is resized.\n     */\n    void setFixedWidgetSize(int newSize);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/UFFlowPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels;\n\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.user.client.ui.FlowPanel;\n\npublic class UFFlowPanel extends FlowPanel {\n\n    /**\n     * Creates a panel with relative positioning that fills its nearest relative or absolute positioned parent.\n     */\n    public UFFlowPanel() {\n        getElement().getStyle().setPosition(Position.RELATIVE);\n        getElement().getStyle().setWidth(100,\n                                         Unit.PCT);\n        getElement().getStyle().setHeight(100,\n                                          Unit.PCT);\n    }\n\n    /**\n     * Creates a panel with relative positioning that has the given fixed height in pixels, and fills the width of its\n     * nearest relative or absolute positioned parent.\n     */\n    public UFFlowPanel(int height) {\n        getElement().getStyle().setPosition(Position.RELATIVE);\n        getElement().getStyle().setWidth(100,\n                                         Unit.PCT);\n        getElement().getStyle().setHeight(height,\n                                          Unit.PX);\n    }\n\n    /**\n     * Creates a panel with relative positioning that has the given fixed width and height in pixels.\n     */\n    public UFFlowPanel(int width,\n                       int height) {\n        getElement().getStyle().setPosition(Position.RELATIVE);\n        getElement().getStyle().setWidth(width,\n                                         Unit.PX);\n        getElement().getStyle().setHeight(height,\n                                          Unit.PX);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/WorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels;\n\nimport java.util.Map;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * Top-level interface for all panel presenters within the UberFire MVP framework.\n */\npublic interface WorkbenchPanelPresenter {\n\n    /**\n     * Returns the current parent of this panel presenter.\n     * @return the parent panel presenter. If this panel is the root, or it is not attached to a parent, the return\n     * value is null.\n     */\n    public WorkbenchPanelPresenter getParent();\n\n    /**\n     * Sets the current parent of this panel presenter. This method should only be called by another\n     * WorkbenchPanelPresenter when adding or removing this panel as a child.\n     * @param parent the new parent of this panel. If this panel is being removed, the parent should be set to null.\n     */\n    public void setParent(final WorkbenchPanelPresenter parent);\n\n    /**\n     * Returns a {@code @Portable} description of the current state of this panel.\n     */\n    public PanelDefinition getDefinition();\n\n    /**\n     * Called by the framework when the panel instance is first created. Application code should not call this method\n     * directly.\n     * @param definition description of the state this panel should put itself in. This panel is also responsible for keeping\n     * the definition up to date with the panel's current state.\n     */\n    public void setDefinition(final PanelDefinition definition);\n\n    /**\n     * Adds the given part to this panel's content area, updating this panel's definition and the part's definition to\n     * reflect the new part ownership.\n     * <p>\n     * Panels each implement their own policy and user interface for part management. Some panels do not support parts\n     * at all; others allow only a single part; still others can hold multiple parts at a time. Either way, panels that\n     * do display parts typically display them one at a time. Those that support multiple parts include UI widgets\n     * (eg. tabs or a dropdown list) that let the user select which one to display.\n     * <p>\n     * After the panel's border decorations, part switcher UI, title bar, and subpanel space has been accounted for, the\n     * part's view typically occupies all remaining space within its parent panel.\n     * @param part the part to add. Must not be null, and must not currently belong to any panel.\n     * @throws UnsupportedOperationException if this panel does not support parts\n     */\n    public void addPart(final WorkbenchPartPresenter part);\n\n    /**\n     * Adds the given part to this panel with the given context ID, updating this panel's definition and the part's\n     * definition to reflect the new part ownership.\n     * @param part the part to add. Must not be null, and must not currently belong to any panel.\n     * @throws UnsupportedOperationException if this panel does not support parts\n     * @see #addPart(WorkbenchPartPresenter)\n     */\n    public void addPart(final WorkbenchPartPresenter part,\n                        final String contextId);\n\n    /**\n     * Removes the given part from this panel, updating this panel's definition and the part's definition to reflect\n     * that the part no longer belongs to this panel.\n     * @return true if the given part was found and removed; false if this call had no effect\n     * @see #addPart(WorkbenchPartPresenter)\n     */\n    public boolean removePart(final PartDefinition part);\n\n    /**\n     * Adds the given panel as a subpanel of this one in the given position. Panels typically only allow one child panel\n     * in each position, and may throw an exception or make alternative arrangements (for example, forward the request\n     * to a child panel) when you try to add a child panel to an already-occupied slot.\n     * <p>\n     * Subpanels are typically always visible, and take up space within the bounds of their parent panel.\n     * @param child the panel to add. The presenter, its view, and its definition must not belong to any parent. As a side\n     * effect of this call (if the call is successful), the given presenter, its view, and its definition\n     * will get attached to their new parents.\n     * @param position the position to add the child at. Different panel implementations support different position types.\n     */\n    public void addPanel(final WorkbenchPanelPresenter child,\n                         final Position position);\n\n    /**\n     * Removes the given panel presenter and its view from this panel, freeing all resources associated with them.\n     * @param child The child panel to remove. Must be a direct child of this panel, and must be empty (contain no parts\n     * or child panels). Null is not permitted.\n     * @return true if the child was found and removed from this panel; false if the child panel could not be found.\n     */\n    public boolean removePanel(WorkbenchPanelPresenter child);\n\n    /**\n     * Returns the immediate child panels of this panel. Note that panels and parts are not the same thing; this method\n     * only returns the panels.\n     * @return an unmodifiable snapshot of the immediate child panels nested within this one. Never null, and will not\n     * update to reflect subsequent changes to this panel's children. Safe to iterate over when adding or\n     * removing child panels.\n     */\n    public Map<Position, WorkbenchPanelPresenter> getPanels();\n\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration);\n\n    public void setFocus(final boolean hasFocus);\n\n    public boolean selectPart(final PartDefinition part);\n\n    /**\n     * Makes this panel's view take up most of the space on the workbench. The exact meaning of \"maximize\" is left to\n     * the implementation of {@link WorkbenchLayout}.\n     */\n    public void maximize();\n\n    /**\n     * Restores this panel's view to its original unmaximized size and position.\n     */\n    public void unmaximize();\n\n    /**\n     * Returns the view that was given to this panel when it was first created.\n     */\n    public WorkbenchPanelView getPanelView();\n\n    public void onResize(final int width,\n                         final int height);\n\n    /**\n     * Returns the panel type that should be used when adding child panels of type\n     * {@link PanelDefinition#PARENT_CHOOSES_TYPE}.\n     * @return the fully-qualified class name of a WorkbenchPanelPresenter implementation. Returns null if\n     * this panel presenter does not allow child panels.\n     */\n    public String getDefaultChildType();\n\n    /**\n     * Returns the type of new parts.\n     */\n    Class<? extends WorkbenchPartPresenter> getPartType();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/WorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels;\n\nimport java.util.Collection;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * Manages the Widget and DOM interaction of a panel. Part of the UberFire MVC system for panels. For a full explanation\n * of what a panel is in UberFire, see the class-level documentation for {@link WorkbenchPanelPresenter}.\n * <p>\n * <h2>View Lifecycle</h2>\n * <p>\n * UberFire Panel Views are Dependent-scoped beans managed by the Errai IOC container. Views are always created by\n * injection into their presenter, which ties their bean lifecycle to that of the presenter: they are created when the\n * presenter is created, and they are destroyed when the presenter is destroyed.\n * <p>\n * This is the lifecycle of a WorkbenchPanelView:\n * <ol>\n * <li>The view's constructor is invoked by Errai IOC. At this point, it is not yet safe to access injected\n * members (they may be uninitialized proxies).\n * <li>The view's {@code @PostConstruct} method (if it has one) is invoked by Errai IOC. Safe to access injected members.\n * <li>The view's {@link #init(Object)} method is invoked by the presenter. The argument is a reference to the presenter itself.\n * <li>The view's widget (obtained from {@link #asWidget()}) is added to the parent panel's widget.\n * <li>The view is now in service, and any of its public methods can be called.\n * <li>When the panel is no longer needed, Errai IOC is told to destroy the presenter bean. This results in the view bean\n * being destroyed too. At this point, the view's {@code @PreDestroy} method is invoked by Errai IOC.\n * </ol>\n */\npublic interface WorkbenchPanelView<P extends WorkbenchPanelPresenter> extends UberView<P>,\n                                                                               RequiresResize {\n\n    /**\n     * Returns this view's presenter.\n     * @return the presenter that this view is bound to. Will return null if invoked before the presenter calls\n     * {@link #init(Object)}; afterward, the return value is never null.\n     */\n    P getPresenter();\n\n    /**\n     * Adds the given part view to this panel if this panel does not already contain a view that handles the same\n     * {@link PlaceRequest} as the given one. If this panel does already contain such a part, the existing one is\n     * {@link #selectPart(PartDefinition) selected} and the given one is not added.\n     * @param view the view to add as long as it is not a duplicate. Must not be null.\n     */\n    void addPart(final WorkbenchPartPresenter.View view);\n\n    /**\n     * Nests the given WorkbenchPanelView inside this one at the given position, which must be unoccupied. This is an\n     * optional feature of WorkbenchPanelView: not all implementations support nested child panels. Additionally,\n     * different panels support different {@link Position} types. Implementations should document whether or not they\n     * support child panels, and if so, what types of Positions they understand.\n     * @param panel specifies the size that should be imposed on the nested view. Must not be null. FIXME: is this\n     * sensible/correct?\n     * @param view the panel to nest inside this one. Must not be null.\n     * @param position specifies which edge of this panel will be shared with the nested panel. Must not be null.\n     * @throws IllegalStateException if the given position is already occupied by a child panel.\n     * @throws IllegalArgumentException if the given child position is not understood by this type of panel.\n     * @throws UnsupportedOperationException if this panel does not support child panels at all.\n     */\n    void addPanel(final PanelDefinition panel,\n                  final WorkbenchPanelView<?> view,\n                  final Position position);\n\n    /**\n     * Removes the view widget associated with the given child from this panel, freeing any resources that were\n     * allocated by this panel when the child was added.\n     */\n    boolean removePanel(WorkbenchPanelView<?> child);\n\n    /**\n     * Assigns the given title to the given part, if the part belongs to this panel.\n     * @param part the part whose title to change. Must not be null.\n     * @param title the new title. Must not be null.\n     * @param titleDecoration An optional widget to display beside the title. Note that some implementations do not support title\n     * decorations, and they will ignore this. Null is permitted, and means no decoration.\n     */\n    void changeTitle(final PartDefinition part,\n                     final String title,\n                     final IsWidget titleDecoration);\n\n    /**\n     * Makes the given part visible and focused, if it belongs to this view.\n     * @param part the part to reveal and give focus to.\n     * @return true if the part was found, made visible, and given focus. False if not.\n     */\n    boolean selectPart(final PartDefinition part);\n\n    /**\n     * Removes the given part from this view, if it belonged to this view.\n     * @param part the part to remove.\n     * @return true if the part was found and removed. False if not.\n     */\n    boolean removePart(final PartDefinition part);\n\n    /**\n     * Informs this view that it has gained or lost keyboard focus. Focused views may respond by updating their style to\n     * look more prominent than unfocused views.\n     * @param hasFocus if true, this panel now has focus. If false, this panel does not have focus.\n     */\n    void setFocus(boolean hasFocus);\n\n    /**\n     * Sets the ID of the physical root element of this view. For HTML-based views, this is the {@code id} attribute of\n     * the view's top-level DOM element. Implementations for other view technologies should map this to whatever the\n     * underlying widget/component system uses for unique identifiers.\n     * @param elementId the element ID to set. If null, the ID value will be cleared.\n     */\n    void setElementId(String elementId);\n\n    /**\n     * Returns the widget that defines the boundaries of this panel view for purposes of drag-and-drop.\n     * @return the widget whose boundaries define the region where workbench parts can be dropped into this panel. For\n     * simple panel types that do not support child panels, this will typically be the same widget returned by\n     * {@link #asWidget()}. For fancier panels, this will typically be some child panel within the view's\n     * internal structure.\n     * <p>\n     * If the return value is null, parts will not be droppable on this view.\n     */\n    Widget getPartDropRegion();\n\n    /**\n     * Maximizes this view using {@link WorkbenchLayout#maximize(Widget)}.\n     */\n    void maximize();\n\n    /**\n     * Restores this view to its original unmaximized size and position using {@link WorkbenchLayout#unmaximize(Widget)}.\n     */\n    void unmaximize();\n\n    /**\n     * Returns the parts currently held by the view.\n     */\n    Collection<PartDefinition> getParts();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Map;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.uberfire.client.util.Layouts.heightOrDefault;\nimport static org.uberfire.client.util.Layouts.widthOrDefault;\nimport static org.uberfire.client.util.Layouts.widthOrHeight;\n\n/**\n * Implements the behaviour for panel presenters that support adding child panels in {@link CompassPosition} positions.\n */\npublic abstract class AbstractDockingWorkbenchPanelPresenter<P extends AbstractWorkbenchPanelPresenter<P>>\n        extends AbstractWorkbenchPanelPresenter<P> implements DockingWorkbenchPanelPresenter {\n\n    @Inject\n    private PanelManager panelManager;\n\n    public AbstractDockingWorkbenchPanelPresenter(WorkbenchPanelView<P> view,\n                                                  PerspectiveManager perspectiveManager) {\n        super(view,\n              perspectiveManager);\n    }\n\n    /**\n     * Forwards requests to existing child panels in case there is already a child panel in the requested position.\n     * Otherwise behaves exactly like the superclass.\n     */\n    @Override\n    public void addPanel(WorkbenchPanelPresenter newChild,\n                         Position position) {\n        if (getParent() instanceof DockingWorkbenchPanelPresenter) {\n            DockingWorkbenchPanelPresenter dockingParent = (DockingWorkbenchPanelPresenter) getParent();\n            if (dockingParent.getPanels().get(position) == this) {\n                dockingParent.setChildSize(this,\n                                           widthOrDefault(newChild.getDefinition()) + widthOrDefault(getDefinition()),\n                                           heightOrDefault(newChild.getDefinition()) + heightOrDefault(getDefinition()));\n            }\n        }\n        WorkbenchPanelPresenter existingChild = getPanels().get(position);\n        if (existingChild != null && newChild instanceof AbstractDockingWorkbenchPanelPresenter) {\n            int existingChildSize = widthOrHeight((CompassPosition) position,\n                                                  existingChild.getDefinition());\n            int newChildSize = widthOrHeight((CompassPosition) position,\n                                             newChild.getDefinition());\n\n            removePanel(existingChild);\n            super.addPanel(newChild,\n                           position);\n            newChild.addPanel(existingChild,\n                              position);\n\n            getPanelView().setChildSize(newChild.getPanelView(),\n                                        newChildSize + existingChildSize);\n        } else {\n            super.addPanel(newChild,\n                           position);\n        }\n    }\n\n    /**\n     * Checks for existing child panels of the panel to be removed, and reparents them to this panel in the position of\n     * the child panel. Once the child panels are safely out of the way, the actual panel removal is done by a call to\n     * super.removePanel().\n     */\n    @Override\n    public boolean removePanel(WorkbenchPanelPresenter child) {\n        if (child instanceof AbstractDockingWorkbenchPanelPresenter) {\n\n            Position removedPosition = positionOf(child);\n            if (removedPosition == null) {\n                return false;\n            }\n\n            List<AbstractDockingWorkbenchPanelPresenter<?>> rescuedOrphans = new ArrayList<AbstractDockingWorkbenchPanelPresenter<?>>();\n            AbstractDockingWorkbenchPanelPresenter<?> dockingChild = (AbstractDockingWorkbenchPanelPresenter<?>) child;\n            for (Map.Entry<Position, WorkbenchPanelPresenter> entry : dockingChild.getPanels().entrySet()) {\n                dockingChild.removeWithoutOrphanRescue(entry.getValue());\n                rescuedOrphans.add((AbstractDockingWorkbenchPanelPresenter<?>) entry.getValue());\n                // TODO multiple off-axis orphans need special treatment\n                // for example: if the NORTH panel has EAST and WEST children, we need to take the EAST one as a direct child\n                // to the NORTH of us, and reparent the other to the WEST of that one (or vice-versa)\n                // on the other hand, if there was only one EAST or WEST child, we can just stick it in as our new NORTH child\n            }\n            super.removePanel(dockingChild);\n            for (AbstractDockingWorkbenchPanelPresenter<?> rescued : rescuedOrphans) {\n                addPanel(rescued,\n                         removedPosition);\n            }\n\n            return true;\n        } else {\n            return super.removePanel(child);\n        }\n    }\n\n    /**\n     * Removes the given child panel without modifying child attachments at all. This is used d\n     * @param child\n     */\n    private boolean removeWithoutOrphanRescue(WorkbenchPanelPresenter child) {\n        return super.removePanel(child);\n    }\n\n    @Override\n    public boolean setChildSize(WorkbenchPanelPresenter child,\n                                Integer pixelWidth,\n                                Integer pixelHeight) {\n        for (Map.Entry<Position, WorkbenchPanelPresenter> e : getPanels().entrySet()) {\n            if (e.getValue() == child) {\n                int size;\n                // Position instance could come from a different script so we convert\n                // it to the local type here first in order for == to work.\n                CompassPosition cp = CompassPosition.valueOf(\"\" + e.getKey());\n                if (cp == CompassPosition.NORTH || cp == CompassPosition.SOUTH) {\n                    if (pixelHeight == null) {\n                        return false;\n                    }\n                    size = pixelHeight + nestedPanelHeights(child);\n                } else if (cp == CompassPosition.EAST || cp == CompassPosition.WEST) {\n                    if (pixelWidth == null) {\n                        return false;\n                    }\n                    size = pixelWidth + nestedPanelWidths(child);\n                } else {\n                    throw new AssertionError(\"Unexpected child position: \" + e.getKey());\n                }\n\n                getPanelView().setChildSize(child.getPanelView(),\n                                            size);\n                return true;\n            }\n        }\n        return false;\n    }\n\n    private int nestedPanelHeights(WorkbenchPanelPresenter child) {\n        int totalHeight = 0;\n        WorkbenchPanelPresenter northChild = child.getPanels().get(CompassPosition.NORTH);\n        if (northChild != null) {\n            totalHeight += northChild.getDefinition().getHeight();\n            totalHeight += nestedPanelHeights(northChild);\n        }\n        WorkbenchPanelPresenter southChild = child.getPanels().get(CompassPosition.SOUTH);\n        if (southChild != null) {\n            totalHeight += southChild.getDefinition().getHeight();\n            totalHeight += nestedPanelHeights(southChild);\n        }\n        return totalHeight;\n    }\n\n    private int nestedPanelWidths(WorkbenchPanelPresenter child) {\n        int totalWidth = 0;\n        WorkbenchPanelPresenter westChild = child.getPanels().get(CompassPosition.WEST);\n        if (westChild != null) {\n            totalWidth += westChild.getDefinition().getWidth();\n            totalWidth += nestedPanelWidths(westChild);\n        }\n        WorkbenchPanelPresenter eastChild = child.getPanels().get(CompassPosition.EAST);\n        if (eastChild != null) {\n            totalWidth += eastChild.getDefinition().getWidth();\n            totalWidth += nestedPanelWidths(eastChild);\n        }\n        return totalWidth;\n    }\n\n    @Override\n    public boolean removePart(PartDefinition part) {\n        if (super.removePart(part)) {\n            final PanelDefinition panelDef = getDefinition();\n\n            // if we are not the root and we have become empty, we remove ourselves from the panel hierarchy,\n            // preserving all child panels\n            if (panelDef.getParts().isEmpty() && getParent() != null) {\n                panelManager.removeWorkbenchPanel(this.getDefinition());\n            }\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public DockingWorkbenchPanelView<P> getPanelView() {\n        return (DockingWorkbenchPanelView<P>) super.getPanelView();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.IdentityHashMap;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.PreDestroy;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.core.client.Scheduler.ScheduledCommand;\nimport com.google.gwt.user.client.ui.DockLayoutPanel.Direction;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.BeanFactory;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel;\nimport org.uberfire.client.workbench.widgets.split.WorkbenchSplitLayoutPanel;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.uberfire.client.util.Layouts.setToFillParent;\nimport static org.uberfire.client.util.Layouts.widthOrHeight;\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\nimport static org.uberfire.plugin.PluginUtil.toInteger;\n\n/**\n * Implements the view behaviour required by all docking panel views: adding and removing child panels in the NORTH,\n * SOUTH, EAST, and WEST compass positions.\n * <p>\n * <h2>Information for subclassers</h2>\n * The top-level widget of an {@link AbstractDockingWorkbenchPanelView} is always {@link #topLevelWidget}, a container\n * for child panels, even if this panel doesn't currently have any child panels. This is done so child panels can be\n * inserted and removed without making any assumptions about the parent panel this view is located in (if any!).\n * <p>\n * This means you must always put your part view UI into the widget returned from {@link #getPartViewContainer()}. The\n * <i>contents</i> of this container will never be inspected or modified, but the container itself will be reparented as\n * necessary to accommodate child panels being inserted and removed around it. Put another way, <b>do not insert your\n * part view UI directly into the top-level widget of this view! It will get wiped out!</b>\n * <p>\n * This also means you must not call {@link #initWidget(Widget)}. That will always be done by this superclass.\n *\n * @param <P> the presenter type this view binds to\n */\npublic abstract class AbstractDockingWorkbenchPanelView<P extends WorkbenchPanelPresenter>\n        extends AbstractWorkbenchPanelView<P> implements DockingWorkbenchPanelView<P> {\n\n    private final IdentityHashMap<WorkbenchPanelView<?>, WorkbenchSplitLayoutPanel> viewSplitters = new IdentityHashMap<WorkbenchPanelView<?>, WorkbenchSplitLayoutPanel>();\n\n    @Inject\n    protected WorkbenchDragAndDropManager dndManager;\n\n    @Inject\n    protected BeanFactory factory;\n\n    /**\n     * The topmost widget (closest to DOM root) that this panel view manages. Contains either partViewContainer itself\n     * (when there are no child panels) or a splitter (when there is at least one child panel).\n     */\n    private SimpleLayoutPanel topLevelWidget = new SimpleLayoutPanel();\n\n    @Inject\n    private ResizeFlowPanel partViewContainer;\n\n    private static CompassPosition toPosition(Direction d) {\n        if (d == null) {\n            return null;\n        }\n        switch (d) {\n            case NORTH:\n                return CompassPosition.NORTH;\n            case SOUTH:\n                return CompassPosition.SOUTH;\n            case EAST:\n            case LINE_START:\n                return CompassPosition.WEST;\n            case WEST:\n            case LINE_END:\n                return CompassPosition.EAST;\n            default:\n                throw new IllegalArgumentException(\"Unknown direction: \" + d);\n        }\n    }\n\n    /**\n     * Retrieves the application-requested initial size for a child panel, or calculates a good default based on the\n     * available space.\n     *\n     * @param position   the position the panel will be added within its parent.\n     * @param definition the new panel's definition.\n     * @param parent     the widget whose space will be used up by the insertion of the new panel.\n     */\n    static int initialWidthOrHeight(CompassPosition position,\n                                    PanelDefinition definition,\n                                    Widget parent) {\n        Integer requestedSize;\n        int availableSize;\n        switch (position) {\n            case NORTH:\n            case SOUTH:\n                requestedSize = definition.getHeight();\n                availableSize = parent.getOffsetHeight();\n                break;\n            case EAST:\n            case WEST:\n                requestedSize = definition.getWidth();\n                availableSize = parent.getOffsetWidth();\n                break;\n            default:\n                throw new IllegalArgumentException(\"Position \" + position + \" has no horizontal or vertial aspect.\");\n        }\n        if (requestedSize == null || requestedSize <= 0) {\n            return availableSize / 2;\n        } else {\n            return requestedSize;\n        }\n    }\n\n    static Integer minWidthOrHeight(CompassPosition position,\n                                    PanelDefinition definition) {\n        switch (position) {\n            case NORTH:\n            case SOUTH:\n                return toInteger(definition.getMinHeightAsInt());\n            case EAST:\n            case WEST:\n                return toInteger(definition.getMinWidthAsInt());\n            default:\n                throw new IllegalArgumentException(\"Position \" + position + \" has no horizontal or vertial aspect.\");\n        }\n    }\n\n    private static int getWidthOrHeight(CompassPosition position,\n                                        Widget w) {\n        switch (position) {\n            case NORTH:\n            case SOUTH:\n                return w.getOffsetHeight();\n            case EAST:\n            case WEST:\n                return w.getOffsetWidth();\n            default:\n                throw new IllegalArgumentException(\"Position \" + position + \" has no horizontal or vertial aspect.\");\n        }\n    }\n\n    private static void scheduleResize(final RequiresResize widget) {\n        Scheduler.get().scheduleDeferred(new ScheduledCommand() {\n            @Override\n            public void execute() {\n                widget.onResize();\n            }\n        });\n    }\n\n    @PostConstruct\n    void setupDockingPanel() {\n        initWidget(topLevelWidget);\n        topLevelWidget.add(partViewContainer);\n        setToFillParent(topLevelWidget);\n        setToFillParent(partViewContainer);\n        if (getPartDropRegion() != null) {\n            dndManager.registerDropController(this,\n                                              factory.newDropController(this));\n        }\n    }\n\n    @PreDestroy\n    private void tearDownDockingPanel() {\n        if (getPartDropRegion() != null) {\n            dndManager.unregisterDropController(this);\n        }\n    }\n\n    /**\n     * Overridden to ensure subclasses don't return the partViewContainer by mistake (this would interfere with nested\n     * docking panels).\n     */\n    // override also helps with unit tests: under GWTMockito, super.getWidget() returns a new mock every time\n    @Override\n    public final Widget getWidget() {\n        return topLevelWidget;\n    }\n\n    /**\n     * Returns the panel that subclasses should put the part view UI into.\n     */\n    protected ResizeFlowPanel getPartViewContainer() {\n        return partViewContainer;\n    }\n\n    /**\n     * Returns the partViewContainer, which appears to be the \"real\" on-screen boundary of this widget.\n     */\n    @Override\n    public Widget getPartDropRegion() {\n        return getPartViewContainer();\n    }\n\n    /**\n     * Overridden to attach the ID to the part container rather than the top-level widget, which may contain sub-panels\n     * and be larger and further up the DOM tree than desired.\n     */\n    @Override\n    public void setElementId(String elementId) {\n        if (elementId == null) {\n            getPartViewContainer().getElement().removeAttribute(\"id\");\n        } else {\n            getPartViewContainer().getElement().setAttribute(\"id\",\n                                                             elementId);\n        }\n    }\n\n    @Override\n    public void addPanel(final PanelDefinition childPanelDef,\n                         final WorkbenchPanelView<?> childPanelView,\n                         final Position childPosition) {\n\n        checkNotNull(\"childPanelView\",\n                     childPanelView);\n        CompassPosition position = (CompassPosition) checkNotNull(\"childPosition\",\n                                                                  childPosition);\n\n        if (viewSplitters.get(position) != null) {\n            throw new IllegalStateException(\"This panel already has a \" + position + \" child\");\n        }\n\n        final WorkbenchSplitLayoutPanel splitPanel = new WorkbenchSplitLayoutPanel();\n        splitPanel.add(childPanelView.asWidget(),\n                       position,\n                       widthOrHeight(position,\n                                     childPanelDef));\n\n        // now reparent our existing part container into the split panel's resizable area\n        Widget partContainerParent = partViewContainer.getParent();\n        splitPanel.add(partViewContainer);\n        ((HasWidgets) partContainerParent).add(splitPanel); // this is either a WorkbenchSplitLayoutPanel or topLevelWidget (a SimpleLayoutPanel)\n\n        Integer childMinSize = minWidthOrHeight(position,\n                                                childPanelDef);\n        if (childMinSize != null) {\n            splitPanel.setWidgetMinSize(childPanelView.asWidget(),\n                                        childMinSize);\n        }\n        Integer myMinSize = minWidthOrHeight(position,\n                                             getPresenter().getDefinition());\n        if (myMinSize != null) {\n            splitPanel.setWidgetMinSize(splitPanel,\n                                        myMinSize);\n        }\n\n        viewSplitters.put(childPanelView,\n                          splitPanel);\n\n        //Adding an additional embedded ScrollPanel can cause scroll-bars to disappear\n        //so ensure we set the sizes of the new Panel and it's children after the\n        //browser has added the new DIVs to the HTML tree. This does occasionally\n        //add slight flicker when adding a new Panel.\n        scheduleResize(splitPanel);\n    }\n\n    @Override\n    public boolean removePanel(WorkbenchPanelView<?> childView) {\n        CompassPosition removalPosition = positionOf(childView);\n        if (removalPosition == null) {\n            System.out.println(\"  remove failed - no such child view\");\n            return false;\n        }\n\n        WorkbenchSplitLayoutPanel splitter = viewSplitters.remove(childView);\n        splitter.remove(childView.asWidget());\n\n        // now search for 'splitter' in all remaining split panels in the map, plus topLevelWidget\n        // when found, transfer orphaned children to the same position as splitter was in in its old parent\n\n        Widget orphan = null;\n        for (Widget w : splitter) {\n            if (orphan != null) {\n                System.out.println(\"  splitter@\" + System.identityHashCode(splitter) + \" LOSING ORPHAN: \" + splitter.getWidgetDirection(w) + \" - \" + w);\n            }\n            orphan = w;\n        }\n\n        if (topLevelWidget.getWidget() == splitter) {\n            if (orphan != null) {\n                topLevelWidget.setWidget(orphan);\n            }\n        } else {\n            for (Map.Entry<WorkbenchPanelView<?>, WorkbenchSplitLayoutPanel> ent : viewSplitters.entrySet()) {\n                WorkbenchSplitLayoutPanel sp = ent.getValue();\n                if (sp.getWidgetIndex(splitter) >= 0) {\n                    Direction d = sp.getWidgetDirection(splitter);\n                    Double size = sp.getWidgetSize(splitter);\n                    sp.remove(splitter);\n                    if (orphan != null) {\n                        sp.insert(orphan,\n                                  d,\n                                  size,\n                                  null);\n                    }\n                }\n            }\n        }\n\n        scheduleResize(partViewContainer);\n\n        return true;\n    }\n\n    private CompassPosition positionOf(WorkbenchPanelView<?> childView) {\n        final WorkbenchSplitLayoutPanel splitter = viewSplitters.get(childView);\n        if (splitter == null) {\n            return null;\n        }\n        Direction widgetDirection = splitter.getWidgetDirection(childView.asWidget());\n        if (widgetDirection == null) {\n            throw new AssertionError(\"Found child in splitter map but not in the splitter itself\");\n        }\n        return toPosition(widgetDirection);\n    }\n\n    @Override\n    public boolean setChildSize(WorkbenchPanelView<?> childPanel,\n                                int size) {\n        WorkbenchSplitLayoutPanel splitPanel = viewSplitters.get(childPanel);\n        if (splitPanel != null) {\n            PanelDefinition definition = getPresenter().getDefinition();\n            CompassPosition childPosition = positionOf(childPanel);\n\n            Integer childMinSize = minWidthOrHeight(childPosition,\n                                                    definition);\n            Integer myMinSize = minWidthOrHeight(childPosition,\n                                                 getPresenter().getDefinition());\n            int mySize = getWidthOrHeight(childPosition,\n                                          asWidget());\n\n            if (childMinSize != null) {\n                size = Math.max(size,\n                                childMinSize);\n            }\n            if (myMinSize != null) {\n                size = Math.min(size,\n                                mySize - myMinSize);\n            }\n\n            splitPanel.setWidgetSize(childPanel.asWidget(),\n                                     size);\n\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Overridden to maximize the widget returned by {@link #getPartViewContainer()}.\n     */\n    @Override\n    public void maximize() {\n        layoutSelection.get().maximize(getPartViewContainer());\n    }\n\n    /**\n     * Overridden to match {@link #maximize()}.\n     */\n    @Override\n    public void unmaximize() {\n        layoutSelection.get().unmaximize(getPartViewContainer());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractMultiPartWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.ContextActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.ContextDisplayMode;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.uberfire.workbench.model.ContextDisplayMode.SHOW;\n\npublic abstract class AbstractMultiPartWorkbenchPanelPresenter<P extends AbstractMultiPartWorkbenchPanelPresenter<P>>\n        extends AbstractDockingWorkbenchPanelPresenter<P> {\n\n    private final Map<PartDefinition, ContextActivity> contextActivities = new HashMap<PartDefinition, ContextActivity>();\n    protected ActivityManager activityManager;\n    private ContextActivity perspectiveContext = null;\n    private ContextActivity panelContext = null;\n\n    protected AbstractMultiPartWorkbenchPanelPresenter(final WorkbenchPanelView<P> view,\n                                                       final ActivityManager activityManager,\n                                                       final PerspectiveManager perspectiveManager) {\n        super(view,\n              perspectiveManager);\n        this.activityManager = activityManager;\n    }\n\n    private void buildPerspectiveContext() {\n        final ContextDefinition contextDefinition = perspectiveManager.getLivePerspectiveDefinition().getContextDefinition();\n        final ContextDisplayMode contextDisplayMode = perspectiveManager.getLivePerspectiveDefinition().getContextDisplayMode();\n        if (contextDefinition != null && contextDisplayMode == SHOW) {\n            final ContextActivity activity = activityManager.getActivity(ContextActivity.class,\n                                                                         contextDefinition.getPlace());\n            if (activity != null) {\n                perspectiveContext = activity;\n            }\n        }\n    }\n\n    @Override\n    public void setDefinition(final PanelDefinition definition) {\n        super.setDefinition(definition);\n\n        final ContextDisplayMode perspectiveContextDisplayMode = perspectiveManager.getLivePerspectiveDefinition().getContextDisplayMode();\n\n        if (definition.getContextDefinition() != null\n                && perspectiveContextDisplayMode == SHOW\n                && definition.getContextDisplayMode() == SHOW) {\n            final ContextActivity activity = activityManager.getActivity(ContextActivity.class,\n                                                                         definition.getContextDefinition().getPlace());\n            if (activity != null) {\n                panelContext = activity;\n            }\n        }\n        buildPerspectiveContext();\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter part,\n                        final String contextId) {\n        super.addPart(part,\n                      contextId);\n        final ContextDisplayMode perspectiveContextDisplayMode = perspectiveManager.getLivePerspectiveDefinition().getContextDisplayMode();\n        if (perspectiveContextDisplayMode == SHOW\n                && getDefinition().getContextDisplayMode() == SHOW\n                && part.getDefinition().getContextDisplayMode() == SHOW) {\n            ContextActivity contextActivity = null;\n            if (contextId != null) {\n                contextActivity = activityManager.getActivity(ContextActivity.class,\n                                                              new DefaultPlaceRequest(contextId));\n            } else if (part.getDefinition().getContextDefinition() != null) {\n                contextActivity = activityManager.getActivity(ContextActivity.class,\n                                                              part.getDefinition().getContextDefinition().getPlace());\n            } else if (part.getContextId() != null) {\n                contextActivity = activityManager.getActivity(ContextActivity.class,\n                                                              new DefaultPlaceRequest(part.getContextId()));\n            }\n            if (contextActivity != null) {\n                contextActivities.put(part.getDefinition(),\n                                      contextActivity);\n            }\n        }\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        boolean removed = super.removePart(part);\n        contextActivities.remove(part);\n        return removed;\n    }\n\n    public ContextActivity resolveContext(final PartDefinition part) {\n        ContextActivity result = perspectiveContext;\n        if (panelContext != null) {\n            result = panelContext;\n        }\n        if (contextActivities.containsKey(part)) {\n            result = contextActivities.get(part);\n        }\n        return result;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractMultiPartWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.panel.ContextPanel;\nimport org.uberfire.workbench.model.PartDefinition;\n\npublic abstract class AbstractMultiPartWorkbenchPanelView<P extends AbstractMultiPartWorkbenchPanelPresenter>\n        extends AbstractDockingWorkbenchPanelView<P> {\n\n    protected ContextPanel contextWidget = new ContextPanel();\n    protected MultiPartWidget widget;\n\n    protected abstract MultiPartWidget setupWidget();\n\n    @PostConstruct\n    private void setupMultiPartPanel() {\n        widget = setupWidget();\n        widget.asWidget().getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);\n        Layouts.setToFillParent(widget.asWidget());\n        populatePartViewContainer();\n    }\n\n    /**\n     * Fills the partViewContainer with the contextWidget and the content widget obtained from {@link #setupWidget()}.\n     * Can be used as a hook for subclasses to add their own stuff either before or after the\n     * {@code super.populatePartViewContainer()} call.\n     */\n    protected void populatePartViewContainer() {\n        getPartViewContainer().add(contextWidget);\n        getPartViewContainer().add(widget);\n    }\n\n    @Override\n    public void init(final P presenter) {\n        this.presenter = presenter;\n        widget.setPresenter(presenter);\n        widget.setDndManager(dndManager);\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        widget.addPart(view);\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        widget.changeTitle(part,\n                           title,\n                           titleDecoration);\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        return widget.selectPart(part);\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        if (widget.remove(part)) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        widget.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onResize() {\n        presenter.onResize(getOffsetWidth(),\n                           getOffsetHeight());\n        super.onResize();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractSimpleWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.listbar.ListBarWidget;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * Supertype for both the DnD and non-DnD simple workbench panel views.\n */\npublic abstract class AbstractSimpleWorkbenchPanelView<P extends WorkbenchPanelPresenter>\n        extends AbstractDockingWorkbenchPanelView<P> {\n\n    @Inject\n    protected ListBarWidget listBar;\n\n    @PostConstruct\n    void setup() {\n        setupListBar();\n\n        getPartViewContainer().add(listBar);\n    }\n\n    protected void setupListBar() {\n        listBar.setDndManager(dndManager);\n        listBar.disableDnd();\n        dndManager.unregisterDropController(this);\n        addOnFocusHandler(listBar);\n        addSelectionHandler(listBar);\n        listBar.asWidget().getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);\n        Layouts.setToFillParent(listBar.asWidget());\n\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n        maximizeButton.setVisible(true);\n        maximizeButton.setMaximizeCommand(new Command() {\n            @Override\n            public void execute() {\n                maximize();\n            }\n        });\n        maximizeButton.setUnmaximizeCommand(new Command() {\n            @Override\n            public void execute() {\n                unmaximize();\n            }\n        });\n    }\n\n    public void enableDnd() {\n        listBar.enableDnd();\n    }\n\n    @Override\n    public void init(final P presenter) {\n        this.presenter = presenter;\n        listBar.setPresenter(presenter);\n    }\n\n    @Override\n    public P getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        if (listBar.getPartsSize() == 0) {\n            listBar.addPart(view);\n        } else {\n            throw new RuntimeException(\"Uberfire Panel Invalid State: This panel support only one part.\");\n        }\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        listBar.changeTitle(part,\n                            title,\n                            titleDecoration);\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        return listBar.selectPart(part);\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        return listBar.remove(part);\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        listBar.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onResize() {\n        if (isAttached()) {\n            presenter.onResize(getOffsetWidth(),\n                               getOffsetHeight());\n        }\n\n        // this will always be true in real life, but during GwtMockito tests it is not\n        if (getWidget() instanceof RequiresResize) {\n            super.onResize();\n        }\n    }\n\n    @Override\n    public void maximize() {\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n\n        maximizeButton.disable();\n        layoutSelection.get().maximize(getPartViewContainer(),\n                                       () -> maximizeButton.enable());\n        maximizeButton.setMaximized(true);\n    }\n\n    @Override\n    public void unmaximize() {\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n\n        maximizeButton.disable();\n        layoutSelection.get().unmaximize(getPartViewContainer(),\n                                         () -> maximizeButton.enable());\n        maximizeButton.setMaximized(false);\n    }\n\n    @Override\n    public void setElementId(String elementId) {\n        super.setElementId(elementId);\n        listBar.getMaximizeButton().getView().asWidget().ensureDebugId(elementId + \"-maximizeButton\");\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return listBar.getParts();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collections;\nimport java.util.LinkedHashMap;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport javax.annotation.PostConstruct;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.pmgr.nswe.part.WorkbenchPartPresenterDefault;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.uberfire.debug.Debug.objectId;\n\n/**\n * Basic implementation of common functionality in a panel presenter.\n * <p>\n * At the least, concrete subclasses have to implement {@link #asPresenterType()} to return {@code this}. Subclasses may\n * override other methods as necessary to customize behaviour for use with specialized layouts and view implementations.\n */\npublic abstract class AbstractWorkbenchPanelPresenter<P extends AbstractWorkbenchPanelPresenter<P>> implements WorkbenchPanelPresenter {\n\n    protected final PerspectiveManager perspectiveManager;\n    protected final Map<Position, WorkbenchPanelPresenter> childPanels = new LinkedHashMap<Position, WorkbenchPanelPresenter>();\n    private final WorkbenchPanelView<P> view;\n    private WorkbenchPanelPresenter parent;\n    private PanelDefinition definition;\n\n    public AbstractWorkbenchPanelPresenter(final WorkbenchPanelView<P> view,\n                                           final PerspectiveManager perspectiveManager) {\n        this.view = view;\n        this.perspectiveManager = perspectiveManager;\n    }\n\n    /**\n     * Returns a reference to {@code this}. Helps superclass code work around generic type checking problems.\n     */\n    protected abstract P asPresenterType();\n\n    @PostConstruct\n    void init() {\n        getPanelView().init(this.asPresenterType());\n    }\n\n    @Override\n    public WorkbenchPanelPresenter getParent() {\n        return parent;\n    }\n\n    @Override\n    public void setParent(WorkbenchPanelPresenter parent) {\n        this.parent = parent;\n    }\n\n    @Override\n    public PanelDefinition getDefinition() {\n        return definition;\n    }\n\n    @Override\n    public void setDefinition(final PanelDefinition definition) {\n        this.definition = definition;\n        view.setElementId(definition.getElementId());\n    }\n\n    /**\n     * Most panel types are their own default child type, so this implementation returns {@code getClass().getName()}.\n     * Subclasses can override if they prefer a different child type.\n     */\n    @Override\n    public String getDefaultChildType() {\n        return getClass().getName();\n    }\n\n    /**\n     * Calls {@link #addPart(org.uberfire.client.workbench.part.WorkbenchPartPresenter, String)}. Subclasses can\n     * take advantage of this by only overriding the 2-arg version.\n     */\n    @Override\n    public void addPart(final WorkbenchPartPresenter part) {\n        addPart(part,\n                null);\n    }\n\n    /**\n     * Adds the given part to the view returned by {@link #getPanelView()}, ignoring the given {@code contextId}.\n     * Subclasses that care about context id's will override this method.\n     */\n    @Override\n    public void addPart(final WorkbenchPartPresenter part,\n                        final String contextId) {\n\n        // special case: when new perspectives are being built up based on definitions,\n        // our definition will already say it contains the given part! We should not try to add it again.\n        Optional<PartDefinition> optional = definition.getParts().stream()\n                .filter(partDefinition -> partDefinition.equals(part.getDefinition()))\n                .findAny();\n        if (!optional.isPresent()) {\n            definition.addPart(part.getDefinition());\n        }\n        getPanelView().addPart(part.getPartView());\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        view.removePart(part);\n        return definition.removePart(part);\n    }\n\n    /**\n     * This base implementation should be sufficient for most panels. It modifies the panel definition and adds the\n     * child view to this panel's view. In case the requested position is already in use for this panel, this method\n     * will throw an {@link IllegalStateException}. Subclasses may override and implement some other collision avoidance\n     * strategy.\n     */\n    @Override\n    public void addPanel(final WorkbenchPanelPresenter child,\n                         final Position position) {\n        if (childPanels.containsKey(position)) {\n            throw new IllegalStateException(\"This panel already has a \" + position + \" child\");\n        }\n        definition.insertChild(position,\n                               child.getDefinition());\n        getPanelView().addPanel(child.getDefinition(),\n                                child.getPanelView(),\n                                position);\n        childPanels.put(position,\n                        child);\n        child.setParent(this);\n    }\n\n    @Override\n    public boolean removePanel(WorkbenchPanelPresenter child) {\n        Position position = positionOf(child);\n        if (position == null) {\n            return false;\n        }\n        getPanelView().removePanel(child.getPanelView());\n        definition.removeChild(position);\n        childPanels.remove(position);\n        child.setParent(null);\n        return true;\n    }\n\n    @Override\n    public Map<Position, WorkbenchPanelPresenter> getPanels() {\n        return Collections.unmodifiableMap(childPanels);\n    }\n\n    protected Position positionOf(WorkbenchPanelPresenter child) {\n        for (Map.Entry<Position, WorkbenchPanelPresenter> entry : childPanels.entrySet()) {\n            if (child == entry.getValue()) {\n                return entry.getKey();\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecorator) {\n        getPanelView().changeTitle(part,\n                                   title,\n                                   titleDecorator);\n    }\n\n    @Override\n    public void setFocus(final boolean hasFocus) {\n        view.setFocus(hasFocus);\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        if (!contains(part)) {\n            return false;\n        }\n        view.selectPart(part);\n        return true;\n    }\n\n    private boolean contains(final PartDefinition part) {\n        return definition.getParts().contains(part);\n    }\n\n    @Override\n    public void maximize() {\n        view.maximize();\n    }\n\n    @Override\n    public void unmaximize() {\n        view.unmaximize();\n    }\n\n    @Override\n    public WorkbenchPanelView<P> getPanelView() {\n        return view;\n    }\n\n    @Override\n    public void onResize(final int width,\n                         final int height) {\n        if (width != 0) {\n            getDefinition().setWidth(width);\n        }\n\n        if (height != 0) {\n            getDefinition().setHeight(height);\n        }\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder sb = new StringBuilder(getClass().getName());\n        sb.append(objectId(this));\n        if (getDefinition() == null) {\n            sb.append(\" (no definition)\");\n        } else {\n            sb.append(\" id=\").append(getDefinition().getElementId());\n        }\n\n        return sb.toString();\n    }\n\n    public Class<? extends WorkbenchPartPresenter> getPartType() {\n        return WorkbenchPartPresenterDefault.class;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AbstractWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.ResizeComposite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * Implements focus and selection handling.\n * @param <P> the type of presenter this view goes with\n */\npublic abstract class AbstractWorkbenchPanelView<P extends WorkbenchPanelPresenter>\n        extends ResizeComposite\n        implements WorkbenchPanelView<P> {\n\n    @Inject\n    protected PanelManager panelManager;\n\n    @Inject\n    protected LayoutSelection layoutSelection;\n\n    protected P presenter;\n\n    /**\n     * Throws {@code UnsupportedOperationException} when called. Subclasses that wish to support child panels should\n     * override this and {@link #removePanel(WorkbenchPanelView)}.\n     */\n    @Override\n    public void addPanel(PanelDefinition panel,\n                         WorkbenchPanelView<?> view,\n                         Position position) {\n        throw new UnsupportedOperationException(\"This panel does not support child panels\");\n    }\n\n    /**\n     * Throws {@code UnsupportedOperationException} when called. Subclasses that wish to support child panels should\n     * override this and {@link #addPanel(PanelDefinition, WorkbenchPanelView, Position)}.\n     */\n    @Override\n    public boolean removePanel(WorkbenchPanelView<?> child) {\n        throw new UnsupportedOperationException(\"This panel does not support child panels\");\n    }\n\n    @Override\n    public P getPresenter() {\n        return this.presenter;\n    }\n\n    protected void addOnFocusHandler(MultiPartWidget widget) {\n        widget.addOnFocusHandler(new Command() {\n            @Override\n            public void execute() {\n                panelManager.onPanelFocus(presenter.getDefinition());\n            }\n        });\n    }\n\n    protected void addSelectionHandler(HasSelectionHandlers<PartDefinition> widget) {\n        widget.addSelectionHandler(new SelectionHandler<PartDefinition>() {\n            @Override\n            public void onSelection(final SelectionEvent<PartDefinition> event) {\n                panelManager.onPartLostFocus();\n                panelManager.onPartFocus(event.getSelectedItem());\n            }\n        });\n    }\n\n    @Override\n    public void setElementId(String elementId) {\n        if (elementId == null) {\n            getElement().removeAttribute(\"id\");\n        } else {\n            getElement().setAttribute(\"id\",\n                                      elementId);\n        }\n    }\n\n    @Override\n    public String toString() {\n        StringBuilder sb = new StringBuilder(getClass().getName());\n        sb.append(\"@\").append(System.identityHashCode(this));\n        sb.append(\" id=\").append(getElement().getAttribute(\"id\"));\n        return sb.toString();\n    }\n\n    /**\n     * This implementation returns null, meaning this panel does not support parts being dropped on it. Subclasses that\n     * want to support Drag-and-Drop can override.\n     */\n    @Override\n    public Widget getPartDropRegion() {\n        return null;\n    }\n\n    @Override\n    public void maximize() {\n        layoutSelection.get().maximize(this);\n    }\n\n    @Override\n    public void unmaximize() {\n        layoutSelection.get().unmaximize(this);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AdaptiveWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\n@Dependent\npublic class AdaptiveWorkbenchPanelPresenter extends AbstractDockingWorkbenchPanelPresenter<AdaptiveWorkbenchPanelPresenter> {\n\n    @Inject\n    public AdaptiveWorkbenchPanelPresenter(@Named(\"AdaptiveWorkbenchPanelView\") final WorkbenchPanelView<AdaptiveWorkbenchPanelPresenter> view,\n                                           final PerspectiveManager perspectiveManager) {\n        super(view,\n              perspectiveManager);\n    }\n\n    @Override\n    protected AdaptiveWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    @Override\n    public String getDefaultChildType() {\n        if (getDefinition().isRoot() && !getDefinition().getParts().isEmpty()) {\n            return MultiListWorkbenchPanelPresenter.class.getName();\n        } else if (getPanels().size() > 0) {\n            return MultiListWorkbenchPanelPresenter.class.getName();\n        }\n        return SimpleWorkbenchPanelPresenter.class.getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/AdaptiveWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Named;\n\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n@Dependent\n@Named(\"AdaptiveWorkbenchPanelView\")\npublic class AdaptiveWorkbenchPanelView\n        extends AbstractSimpleWorkbenchPanelView<AdaptiveWorkbenchPanelPresenter> {\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        listBar.addPart(view);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/ClosableSimpleWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * A panel with a title bar. Can contain one part at a time. The part's view fills the entire space not used up by\n * the title bar. Adding a new part replaces the existing part. Does not support drag-and-drop rearrangement of\n * parts. Supports closing the current part.\n * @see ClosableSimpleWorkbenchPanelPresenter\n */\n@Dependent\npublic class ClosableSimpleWorkbenchPanelPresenter extends AbstractDockingWorkbenchPanelPresenter<ClosableSimpleWorkbenchPanelPresenter> {\n\n    private final PlaceManager placeManager;\n\n    @Inject\n    public ClosableSimpleWorkbenchPanelPresenter(\n            @Named(\"ClosableSimpleWorkbenchPanelView\") final WorkbenchPanelView<ClosableSimpleWorkbenchPanelPresenter> view,\n            final PerspectiveManager perspectiveManager,\n            PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    protected ClosableSimpleWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    @Override\n    public DockingWorkbenchPanelView<ClosableSimpleWorkbenchPanelPresenter> getPanelView() {\n        return super.getPanelView();\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/ClosableSimpleWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Named;\n\n/**\n * A Workbench panel that can contain WorkbenchParts.\n */\n@Dependent\n@Named(\"ClosableSimpleWorkbenchPanelView\")\npublic class ClosableSimpleWorkbenchPanelView extends AbstractSimpleWorkbenchPanelView<ClosableSimpleWorkbenchPanelPresenter> {\n\n    @Override\n    protected void setupListBar() {\n        super.setupListBar();\n        listBar.enableClosePart();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/ImmutableWorkbenchPanelPresenter.java",
    "content": "package org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * An undecorated panel that can contain one part at a time and does not support child panels. The part's view fills\n * the entire panel. Does not support changing the part after it is set. Does not support drag-and-drop rearrangement of\n * parts.\n */\n@Dependent\npublic class ImmutableWorkbenchPanelPresenter extends AbstractWorkbenchPanelPresenter<ImmutableWorkbenchPanelPresenter> {\n\n    private PlaceManager placeManager;\n\n    @Inject\n    public ImmutableWorkbenchPanelPresenter(@Named(\"ImmutableWorkbenchPanelView\") final ImmutableWorkbenchPanelView view,\n                                            final PerspectiveManager perspectiveManager,\n                                            final PlaceManager placeManager) {\n        super(view, perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    protected ImmutableWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    /**\n     * Returns null (static panels don't support child panels).\n     */\n    @Override\n    public String getDefaultChildType() {\n        return null;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter part) {\n        this.addPart(part, null);\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter part,\n                        final String contextId) {\n        if (createSinglePartPanelHelper().hasNoParts()) {\n            super.addPart(part, contextId);\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(), placeManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/ImmutableWorkbenchPanelView.java",
    "content": "package org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.client.workbench.widgets.panel.StaticFocusedResizePanel;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * The view component of {@link ImmutableWorkbenchPanelPresenter}.\n */\n@Dependent\n@Named(\"ImmutableWorkbenchPanelView\")\npublic class ImmutableWorkbenchPanelView\n        extends AbstractWorkbenchPanelView<ImmutableWorkbenchPanelPresenter> {\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    StaticFocusedResizePanel panel;\n\n    @PostConstruct\n    void postConstruct() {\n        Layouts.setToFillParent(panel);\n        initWidget(panel);\n    }\n\n    @Override\n    public Widget getWidget() {\n        return panel;\n    }\n\n    public StaticFocusedResizePanel getPanel() {\n        return panel;\n    }\n\n    @Override\n    public void init(final ImmutableWorkbenchPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public ImmutableWorkbenchPanelPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final View view) {\n        if (panel.getPartView() == null) {\n            panel.setPart(view);\n            onResize();\n        } else {\n            throw new RuntimeException(\"Uberfire Panel Invalid State: This panel support only one part.\");\n        }\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        final PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition != null && currentPartDefinition.equals(part)) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        return false;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        panel.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onResize() {\n        presenter.onResize(getOffsetWidth(),\n                           getOffsetHeight());\n        super.onResize();\n    }\n\n    PartDefinition getCurrentPartDefinition() {\n        View partView = panel.getPartView();\n        if (partView == null) {\n            return null;\n        }\n\n        WorkbenchPartPresenter presenter = partView.getPresenter();\n        if (presenter == null) {\n            return null;\n        }\n\n        return presenter.getDefinition();\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition == null) {\n            return new ArrayList<>();\n        }\n        return Arrays.asList(currentPartDefinition);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/LayoutPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\n\n// TODO (hbraun) needs javadoc\n@Dependent\npublic class LayoutPanelPresenter extends AbstractWorkbenchPanelPresenter<LayoutPanelPresenter> {\n\n    @Inject\n    public LayoutPanelPresenter(@Named(\"LayoutPanelView\") final LayoutPanelView view,\n                                final PerspectiveManager perspectiveManager) {\n        super(view,\n              perspectiveManager);\n    }\n\n    @Override\n    protected LayoutPanelPresenter asPresenterType() {\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/LayoutPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.LayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.support.PartManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * A simple {@link LayoutPanel} presenter. Can be used for both perspectives and panels. Does not support drag-and-drop.\n */\n@Dependent\n@Named(\"LayoutPanelView\")\npublic class LayoutPanelView implements WorkbenchPanelView<LayoutPanelPresenter> {\n\n    private final LayoutPanel layout;\n\n    private LayoutPanelPresenter presenter;\n\n    @Inject\n    private PartManager partManager;\n\n    @Inject\n    private LayoutSelection layoutSelection;\n\n    @Inject\n    public LayoutPanelView() {\n        layout = new LayoutPanel();\n        layout.setStyleName(\"fill-layout\");\n    }\n\n    @Override\n    public void addPanel(PanelDefinition panel,\n                         WorkbenchPanelView view,\n                         Position position) {\n        // invoked when this presenter manages a perspective itself (is root)\n        layout.add(view);\n    }\n\n    @Override\n    public boolean removePanel(WorkbenchPanelView<?> child) {\n        return layout.remove(child);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return layout;\n    }\n\n    @Override\n    public void init(final LayoutPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public LayoutPanelPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        // invoked when this presenter panels within perspectives (not root)\n        PartDefinition part = view.getPresenter().getDefinition();\n        if (!partManager.hasPart(part)) {\n            partManager.registerPart(part,\n                                     view.getWrappedWidget().asWidget());\n        }\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        partManager.removePart(part);\n        layout.clear(); // only supports a single part\n        return true;\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        layout.clear(); // TODO (hbraun): Is this necessary?\n        layout.add(partManager.selectPart(part));\n        return true;\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return partManager.getParts();\n    }\n\n    @Override\n    public Widget getPartDropRegion() {\n        return null;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n    }\n\n    @Override\n    public void onResize() {\n        // noop\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        // noop\n    }\n\n    @Override\n    public void setElementId(String elementId) {\n        if (elementId == null) {\n            asWidget().getElement().removeAttribute(\"id\");\n        } else {\n            asWidget().getElement().setAttribute(\"id\",\n                                                 elementId);\n        }\n    }\n\n    @Override\n    public void maximize() {\n        layoutSelection.get().maximize(asWidget());\n    }\n\n    @Override\n    public void unmaximize() {\n        layoutSelection.get().unmaximize(asWidget());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/MultiListWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\n/**\n * A panel with a title bar and drop-down list that allows selecting among the parts it contains, and drag-and-drop\n * for moving parts to and from other drag-and-drop enabled panels. Only one part at a time is visible, and it fills\n * the entire available space not used up by the title bar.\n */\n@Dependent\npublic class MultiListWorkbenchPanelPresenter extends AbstractMultiPartWorkbenchPanelPresenter<MultiListWorkbenchPanelPresenter> {\n\n    @Inject\n    public MultiListWorkbenchPanelPresenter(@Named(\"MultiListWorkbenchPanelView\") final WorkbenchPanelView<MultiListWorkbenchPanelPresenter> view,\n                                            final ActivityManager activityManager,\n                                            final PerspectiveManager perspectiveManager) {\n        super(view,\n              activityManager,\n              perspectiveManager);\n    }\n\n    @Override\n    protected MultiListWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/MultiListWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.widgets.listbar.ListBarWidget;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * A Workbench panel that can contain WorkbenchParts.\n */\n@Dependent\n@Named(\"MultiListWorkbenchPanelView\")\npublic class MultiListWorkbenchPanelView\n        extends AbstractMultiPartWorkbenchPanelView<MultiListWorkbenchPanelPresenter> {\n\n    @Inject\n    protected ListBarWidget listBar;\n\n    @Override\n    protected MultiPartWidget setupWidget() {\n        listBar.disableDnd();\n        addOnFocusHandler(listBar);\n        addSelectionHandler(listBar);\n\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n        maximizeButton.setVisible(true);\n        maximizeButton.setMaximizeCommand(new Command() {\n            @Override\n            public void execute() {\n                maximize();\n            }\n        });\n        maximizeButton.setUnmaximizeCommand(new Command() {\n            @Override\n            public void execute() {\n                unmaximize();\n            }\n        });\n\n        return listBar;\n    }\n\n    @Override\n    public void maximize() {\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n\n        maximizeButton.disable();\n        layoutSelection.get().maximize(getPartViewContainer(),\n                                       () -> maximizeButton.enable());\n        maximizeButton.setMaximized(true);\n    }\n\n    @Override\n    public void unmaximize() {\n        final MaximizeToggleButtonPresenter maximizeButton = listBar.getMaximizeButton();\n\n        maximizeButton.disable();\n        layoutSelection.get().unmaximize(getPartViewContainer(),\n                                         () -> maximizeButton.enable());\n        maximizeButton.setMaximized(false);\n    }\n\n    @Override\n    public void setElementId(String elementId) {\n        super.setElementId(elementId);\n        listBar.getMaximizeButton().getView().asWidget().ensureDebugId(elementId + \"-maximizeButton\");\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return listBar.getParts();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/MultiScreenWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\n/**\n * A panel that allows opening screens within the current perspective, without closing the previous one.\n */\n@Dependent\npublic class MultiScreenWorkbenchPanelPresenter extends AbstractMultiPartWorkbenchPanelPresenter<MultiScreenWorkbenchPanelPresenter> {\n\n    @Inject\n    public MultiScreenWorkbenchPanelPresenter(@Named(\"MultiScreenWorkbenchPanelView\") final WorkbenchPanelView<MultiScreenWorkbenchPanelPresenter> view,\n                                              final ActivityManager activityManager,\n                                              final PerspectiveManager perspectiveManager) {\n        super(view,\n              activityManager,\n              perspectiveManager);\n    }\n\n    @Override\n    protected MultiScreenWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/MultiScreenWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * A Workbench panel that can contain WorkbenchParts.\n */\n@Dependent\n@Named(\"MultiScreenWorkbenchPanelView\")\npublic class MultiScreenWorkbenchPanelView\n        extends AbstractMultiPartWorkbenchPanelView<MultiScreenWorkbenchPanelPresenter> {\n\n    @Inject\n    @Named(\"MultiScreenPartWidget\")\n    protected MultiPartWidget multiPartWidget;\n\n    @Override\n    protected MultiPartWidget setupWidget() {\n        addOnFocusHandler(multiPartWidget);\n        addSelectionHandler(multiPartWidget);\n        return multiPartWidget;\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return multiPartWidget.getParts();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/MultiTabWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\n/**\n * A panel with a tab bar that allows selecting among the parts it contains, with drag-and-drop for moving parts to\n * and from other drag-and-drop enabled panels. Only one part at a time is visible, and it fills the entire\n * available space not used up by the tab bar.\n */\n@Dependent\npublic class MultiTabWorkbenchPanelPresenter extends AbstractMultiPartWorkbenchPanelPresenter<MultiTabWorkbenchPanelPresenter> {\n\n    @Inject\n    public MultiTabWorkbenchPanelPresenter(@Named(\"MultiTabWorkbenchPanelView\") final WorkbenchPanelView<MultiTabWorkbenchPanelPresenter> view,\n                                           final ActivityManager activityManager,\n                                           final PerspectiveManager perspectiveManager) {\n        super(view,\n              activityManager,\n              perspectiveManager);\n    }\n\n    @Override\n    protected MultiTabWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleDnDWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * Exactly like {@link SimpleWorkbenchPanelPresenter} but has drag and drop enabled by default.\n */\n@Dependent\npublic class SimpleDnDWorkbenchPanelPresenter extends AbstractDockingWorkbenchPanelPresenter<SimpleDnDWorkbenchPanelPresenter> {\n\n    private PlaceManager placeManager;\n\n    @Inject\n    public SimpleDnDWorkbenchPanelPresenter(final SimpleDnDWorkbenchPanelView view,\n                                            final PerspectiveManager perspectiveManager,\n                                            final PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n        view.enableDnd();\n    }\n\n    @Override\n    protected SimpleDnDWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleDnDWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\n\n/**\n * View component of the drag-and-drop enabled {@link SimpleDnDWorkbenchPanelPresenter}.\n */\n@Dependent\npublic class SimpleDnDWorkbenchPanelView\n        extends AbstractSimpleWorkbenchPanelView<SimpleDnDWorkbenchPanelPresenter> {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleNoExpandWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * A panel with a title bar. Can contain one part at a time. The part's view fills the entire space not used up by\n * the title bar. Adding a new part replaces the existing part. Does not support drag-and-drop rearrangement of\n * parts.\n * @see SimpleDnDWorkbenchPanelPresenter\n */\n@Dependent\npublic class SimpleNoExpandWorkbenchPanelPresenter extends AbstractDockingWorkbenchPanelPresenter<SimpleNoExpandWorkbenchPanelPresenter> {\n\n    private final PlaceManager placeManager;\n\n    @Inject\n    public SimpleNoExpandWorkbenchPanelPresenter(@Named(\"SimpleNoExpandWorkbenchPanelView\") final WorkbenchPanelView<SimpleNoExpandWorkbenchPanelPresenter> view,\n                                                 final PerspectiveManager perspectiveManager,\n                                                 final PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n\n    @Override\n    protected SimpleNoExpandWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    @Override\n    public DockingWorkbenchPanelView<SimpleNoExpandWorkbenchPanelPresenter> getPanelView() {\n        return super.getPanelView();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleNoExpandWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Named;\n\n/**\n * A Workbench panel that can contain WorkbenchParts.\n */\n@Dependent\n@Named(\"SimpleNoExpandWorkbenchPanelView\")\npublic class SimpleNoExpandWorkbenchPanelView\n        extends AbstractSimpleWorkbenchPanelView<SimpleNoExpandWorkbenchPanelPresenter> {\n\n    @Override\n    protected void setupListBar() {\n        super.setupListBar();\n        listBar.disableClosePart();\n        listBar.disableExpandPart();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * A panel with a title bar. Can contain one part at a time. The part's view fills the entire space not used up by\n * the title bar. Adding a new part replaces the existing part. Does not support drag-and-drop rearrangement of\n * parts.\n * @see SimpleDnDWorkbenchPanelPresenter\n */\n@Dependent\npublic class SimpleWorkbenchPanelPresenter extends AbstractDockingWorkbenchPanelPresenter<SimpleWorkbenchPanelPresenter> {\n\n    private final PlaceManager placeManager;\n\n    @Inject\n    public SimpleWorkbenchPanelPresenter(@Named(\"SimpleWorkbenchPanelView\") final WorkbenchPanelView<SimpleWorkbenchPanelPresenter> view,\n                                         final PerspectiveManager perspectiveManager,\n                                         final PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n\n    @Override\n    protected SimpleWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    @Override\n    public DockingWorkbenchPanelView<SimpleWorkbenchPanelPresenter> getPanelView() {\n        return super.getPanelView();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Named;\n\n/**\n * A Workbench panel that can contain WorkbenchParts.\n */\n@Dependent\n@Named(\"SimpleWorkbenchPanelView\")\npublic class SimpleWorkbenchPanelView\n        extends AbstractSimpleWorkbenchPanelView<SimpleWorkbenchPanelPresenter> {\n\n    @Override\n    protected void setupListBar() {\n        super.setupListBar();\n        listBar.disableClosePart();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SinglePartPanelHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PartDefinition;\n\npublic class SinglePartPanelHelper {\n\n    private Collection<PartDefinition> parts;\n    private PlaceManager placeManager;\n\n    public SinglePartPanelHelper(Collection<PartDefinition> parts,\n                                 PlaceManager placeManager) {\n        this.parts = parts;\n        this.placeManager = placeManager;\n    }\n\n    public boolean hasNoParts() {\n        return parts.isEmpty();\n    }\n\n    public void closeFirstPartAndAddNewOne(Command command) {\n        placeManager.tryClosePlace(getPlaceFromFirstPart(),\n                                   command);\n    }\n\n    PlaceRequest getPlaceFromFirstPart() {\n        if (parts.iterator().hasNext()) {\n            PartDefinition part = this.parts.iterator().next();\n            if (part != null) {\n                return part.getPlace();\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SplitLayoutPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.SplitLayoutPanel;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.workbench.model.CompassPosition;\n\n/**\n * SplitLayoutPanelPresenter and {@link SplitLayoutPanelView} arrange panels using a GWT {@link SplitLayoutPanel}.\n * As such it only supports {@link CompassPosition#WEST} and {@link CompassPosition#CENTER}. Does not support\n * containing parts directly.\n */\n@Dependent\npublic class SplitLayoutPanelPresenter extends AbstractWorkbenchPanelPresenter<SplitLayoutPanelPresenter> {\n\n    @Inject\n    public SplitLayoutPanelPresenter(@Named(\"SplitLayoutPanelView\") final SplitLayoutPanelView view,\n                                     final PerspectiveManager perspectiveManager) {\n        super(view,\n              perspectiveManager);\n    }\n\n    @Override\n    protected SplitLayoutPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    /**\n     * Returns the {@link LayoutPanelPresenter} class name.\n     */\n    @Override\n    public String getDefaultChildType() {\n        return LayoutPanelPresenter.class.getName();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/SplitLayoutPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.LayoutPanel;\nimport com.google.gwt.user.client.ui.SplitLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n/**\n * Corresponding view to {@link SplitLayoutPanelPresenter}. Only supports panels, not parts.\n * Enforces lifecycle callbacks on center parts.\n * <p>\n * Since this panel cannot hold parts, it also does not support drag-and-drop of parts.\n */\n@Dependent\n@Named(\"SplitLayoutPanelView\")\npublic class SplitLayoutPanelView implements WorkbenchPanelView<SplitLayoutPanelPresenter> {\n\n    private final SplitLayoutPanel layout;\n    private final LayoutPanel centerPanel;\n    private final LayoutPanel westPanel;\n    @Inject\n    PlaceManager placeManager;\n    private SplitLayoutPanelPresenter presenter;\n    private Pair<PanelDefinition, Widget> activePanel;\n    @Inject\n    private LayoutSelection layoutSelection;\n\n    public SplitLayoutPanelView() {\n        layout = new SplitLayoutPanel(2);\n\n        centerPanel = new LayoutPanel();\n        westPanel = new LayoutPanel();\n\n        // TODO (hbraun): the actual width should become meta data. i.e. passed through the position object\n        layout.addWest(westPanel,\n                       217);\n        layout.add(centerPanel);\n    }\n\n    @Override\n    public void addPanel(PanelDefinition panel,\n                         WorkbenchPanelView view,\n                         Position position) {\n\n        if (CompassPosition.WEST.equals(position)) {\n            Widget widget = view.asWidget();\n            widget.addStyleName(\"split-west\"); // HAL specific\n            westPanel.add(widget);\n        } else if (CompassPosition.CENTER.equals(position)) {\n            if (activePanel != null) {\n                // close active parts of current panel\n                for (PartDefinition part : ensureIterable(activePanel.getK1().getParts())) {\n                    placeManager.closePlace(part.getPlace());\n                }\n            }\n\n            Widget widget = view.asWidget();\n            widget.addStyleName(\"split-center\"); // HAL specific\n            centerPanel.clear();\n            centerPanel.add(widget);\n            activePanel = new Pair<PanelDefinition, Widget>(panel,\n                                                            widget);\n        } else {\n            throw new IllegalArgumentException(\"Unsupported position directive: \" + position);\n        }\n    }\n\n    @Override\n    public boolean removePanel(WorkbenchPanelView<?> child) {\n        return westPanel.remove(child) || centerPanel.remove(child);\n    }\n\n    @Override\n    public Widget asWidget() {\n        return layout;\n    }\n\n    @Override\n    public void init(final SplitLayoutPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public SplitLayoutPanelPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        throw new IllegalArgumentException(\"Presenter doesn't manage parts!\");\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        throw new IllegalArgumentException(\"Presenter doesn't manage parts!\");\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        throw new IllegalArgumentException(\"Presenter doesn't manage parts!\");\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        throw new IllegalArgumentException(\"Presenter doesn't manage parts!\");\n    }\n\n    @Override\n    public Widget getPartDropRegion() {\n        return null;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n\n    }\n\n    @Override\n    public void onResize() {\n        // noop\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        // noop\n    }\n\n    @Override\n    public void setElementId(String elementId) {\n        if (elementId == null) {\n            asWidget().getElement().removeAttribute(\"id\");\n        } else {\n            asWidget().getElement().setAttribute(\"id\",\n                                                 elementId);\n        }\n    }\n\n    @Override\n    public void maximize() {\n        layoutSelection.get().maximize(asWidget());\n    }\n\n    @Override\n    public void unmaximize() {\n        layoutSelection.get().unmaximize(asWidget());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/StaticWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * An undecorated panel that can contain one part at a time and does not support child panels. The part's view fills\n * the entire panel. Adding a new part replaces the existing part. Does not support drag-and-drop rearrangement of\n * parts.\n */\n@Dependent\npublic class StaticWorkbenchPanelPresenter extends AbstractWorkbenchPanelPresenter<StaticWorkbenchPanelPresenter> {\n\n    private PlaceManager placeManager;\n\n    @Inject\n    public StaticWorkbenchPanelPresenter(@Named(\"StaticWorkbenchPanelView\") final StaticWorkbenchPanelView view,\n                                         final PerspectiveManager perspectiveManager,\n                                         final PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    protected StaticWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    /**\n     * Returns null (static panels don't support child panels).\n     */\n    @Override\n    public String getDefaultChildType() {\n        return null;\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/StaticWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Objects;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.FocusEvent;\nimport com.google.gwt.event.dom.client.FocusHandler;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.client.workbench.widgets.panel.StaticFocusedResizePanel;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * The view component of {@link StaticWorkbenchPanelPresenter}.\n */\n@Dependent\n@Named(\"StaticWorkbenchPanelView\")\npublic class StaticWorkbenchPanelView\n        extends AbstractWorkbenchPanelView<StaticWorkbenchPanelPresenter> {\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    StaticFocusedResizePanel panel;\n\n    @PostConstruct\n    void postConstruct() {\n\n        panel.addFocusHandler(new FocusHandler() {\n            @Override\n            public void onFocus(final FocusEvent event) {\n                panelManager.onPanelFocus(presenter.getDefinition());\n            }\n        });\n\n        //When a tab is selected ensure content is resized and set focus\n        panel.addSelectionHandler(getPanelSelectionHandler());\n\n        Layouts.setToFillParent(panel);\n\n        initWidget(panel);\n    }\n\n    SelectionHandler<PartDefinition> getPanelSelectionHandler() {\n        return event -> {\n            final PartDefinition selectedItem = event.getSelectedItem();\n            if (!Objects.equals(selectedItem, panelManager.getFocusedPart())) {\n                panelManager.onPartLostFocus();\n                panelManager.onPartFocus(selectedItem);\n            }\n        };\n    }\n\n    // override is for unit test: super.getWidget() returns a new mock every time\n    @Override\n    public Widget getWidget() {\n        return panel;\n    }\n\n    public StaticFocusedResizePanel getPanel() {\n        return panel;\n    }\n\n    @Override\n    public void init(final StaticWorkbenchPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public StaticWorkbenchPanelPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        if (panel.getPartView() == null) {\n            panel.setPart(view);\n            onResize();\n        } else {\n            throw new RuntimeException(\"Uberfire Panel Invalid State: This panel support only one part.\");\n        }\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition != null && currentPartDefinition.equals(part)) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition != null && currentPartDefinition.equals(part)) {\n            panel.clear();\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        panel.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onResize() {\n        presenter.onResize(getOffsetWidth(),\n                           getOffsetHeight());\n        super.onResize();\n    }\n\n    PartDefinition getCurrentPartDefinition() {\n        View partView = panel.getPartView();\n        if (partView == null) {\n            return null;\n        }\n\n        WorkbenchPartPresenter presenter = partView.getPresenter();\n        if (presenter == null) {\n            return null;\n        }\n\n        return presenter.getDefinition();\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition == null) {\n            return new ArrayList<>();\n        }\n        return Arrays.asList(currentPartDefinition);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/TemplatedWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n@Dependent\npublic class TemplatedWorkbenchPanelPresenter extends AbstractWorkbenchPanelPresenter<TemplatedWorkbenchPanelPresenter> {\n\n    @Inject\n    public TemplatedWorkbenchPanelPresenter(@Named(\"TemplatedWorkbenchPanelView\") TemplatedWorkbenchPanelView view,\n                                            PerspectiveManager panelManager) {\n        super(view,\n              panelManager);\n    }\n\n    @Override\n    public TemplatedWorkbenchPanelView getPanelView() {\n        return (TemplatedWorkbenchPanelView) super.getPanelView();\n    }\n\n    @Override\n    protected TemplatedWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    /**\n     * Returns the fully-qualified class name for {@link StaticWorkbenchPanelPresenter}.\n     */\n    @Override\n    public String getDefaultChildType() {\n        return StaticWorkbenchPanelPresenter.class.getName();\n    }\n\n    // could generalize this to a HasActivity interface some day. for now, it's a special case for templated perspectives.\n    public void setActivity(TemplatedActivity activity) {\n        getPanelView().setActivity(activity);\n    }\n\n    /**\n     * Forwards the request to the first child panel (the one marked as {@link WorkbenchPanel#isDefault}).\n     */\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        if (getPanels().isEmpty()) {\n            throw new IllegalStateException(\"This panel type does not support parts directly; it forwards add part requests\"\n                                                    + \" to its first child panel. However, this panel currently has no child panels.\");\n        }\n        getPanels().values().iterator().next().addPart(part,\n                                                       contextId);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/TemplatedWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.Collection;\nimport java.util.IdentityHashMap;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeAllChildren;\n\n/**\n * The view component of the templated panel system. This view supports an arbitrary number of child panel views, each\n * identified by a {@link NamedPosition}.\n * <p>\n * This view does not support having parts added to it directly, so it also does not support drag-and-drop of parts.\n *\n * @see TemplatedWorkbenchPanelPresenter\n * @see WorkbenchPanel\n */\n@Dependent\n@Named(\"TemplatedWorkbenchPanelView\")\npublic class TemplatedWorkbenchPanelView implements WorkbenchPanelView<TemplatedWorkbenchPanelPresenter> {\n\n    private final IdentityHashMap<WorkbenchPanelView<?>, NamedPosition> childPanelPositions = new IdentityHashMap<WorkbenchPanelView<?>, NamedPosition>();\n    private TemplatedWorkbenchPanelPresenter presenter;\n    private TemplatedActivity activity;\n    private String elementId;\n    @Inject\n    private LayoutSelection layoutSelection;\n\n    @Override\n    public void init(TemplatedWorkbenchPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    public void setActivity(TemplatedActivity activity) {\n        this.activity = PortablePreconditions.checkNotNull(\"activity\",\n                                                           activity);\n\n        // ensure the new activity's widget gets its ID set\n        setElementId(elementId);\n    }\n\n    @Override\n    public Widget asWidget() {\n        if (activity == null) {\n            return null;\n        }\n        return ElementWrapperWidget.getWidget(activity.getRootElement());\n    }\n\n    @Override\n    public void onResize() {\n        Widget root = asWidget();\n        if (root instanceof RequiresResize) {\n            ((RequiresResize) root).onResize();\n        }\n    }\n\n    @Override\n    public TemplatedWorkbenchPanelPresenter getPresenter() {\n        return presenter;\n    }\n\n    @Override\n    public void addPanel(PanelDefinition panel,\n                         WorkbenchPanelView<?> view,\n                         Position p) {\n        NamedPosition position = (NamedPosition) p;\n        HTMLElement panelContainer = activity.resolvePosition(position);\n\n        if (panelContainer.hasChildNodes()) {\n            throw new IllegalStateException(\"Child position \" + position + \" is already occupied\");\n        }\n\n        DOMUtil.appendWidgetToElement(panelContainer,\n                                      view.asWidget());\n        childPanelPositions.put(view,\n                                position);\n    }\n\n    @Override\n    public boolean removePanel(WorkbenchPanelView<?> child) {\n        NamedPosition removedFromPosition = childPanelPositions.remove(child);\n        if (removedFromPosition == null) {\n            return false;\n        }\n\n        HTMLElement panelContainer = activity.resolvePosition(removedFromPosition);\n        removeAllChildren(panelContainer);\n        return true;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        // not important since this panel can't hold parts\n    }\n\n    @Override\n    public void addPart(View view) {\n        throw new UnsupportedOperationException(\"This view doesn't support parts\");\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        throw new UnsupportedOperationException(\"This view doesn't support parts\");\n    }\n\n    @Override\n    public void changeTitle(PartDefinition part,\n                            String title,\n                            IsWidget titleDecoration) {\n        throw new UnsupportedOperationException(\"This view doesn't support parts\");\n    }\n\n    @Override\n    public boolean selectPart(PartDefinition part) {\n        throw new UnsupportedOperationException(\"This view doesn't support parts\");\n    }\n\n    @Override\n    public boolean removePart(PartDefinition part) {\n        throw new UnsupportedOperationException(\"This view doesn't support parts\");\n    }\n\n    @Override\n    public Widget getPartDropRegion() {\n        return null;\n    }\n\n    /**\n     * Will set, but not clear, the ID of the activity's root element. Clearing is disabled because the templating\n     * system may be relying on the element's ID to find it. Of course, setting a different ID will also interfere with\n     * templating, but the expectation is that this feature would only be used with templated panels for debugging\n     * purposes.\n     */\n    @Override\n    public void setElementId(String elementId) {\n        this.elementId = elementId;\n\n        // this call may come in before the activity has been set; if so, the stored ID will be applied to the\n        // element when the activity is set.\n        if (asWidget() != null) {\n            if (elementId != null) {\n                asWidget().getElement().setAttribute(\"id\",\n                                                     elementId);\n            }\n        }\n    }\n\n    @Override\n    public void maximize() {\n        layoutSelection.get().maximize(asWidget());\n    }\n\n    @Override\n    public void unmaximize() {\n        layoutSelection.get().unmaximize(asWidget());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/UnanchoredStaticWorkbenchPanelPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.pmgr.unanchored.part.UnanchoredWorkbenchPartPresenter;\n\n/**\n * An undecorated panel that can contain one part at a time and does not support child panels. The part's view does not\n * fill the entire panel. Adding a new part replaces the existing part. Does not support drag-and-drop rearrangement of\n * parts.\n */\n@Dependent\npublic class UnanchoredStaticWorkbenchPanelPresenter extends AbstractWorkbenchPanelPresenter<UnanchoredStaticWorkbenchPanelPresenter> {\n\n    private PlaceManager placeManager;\n\n    @Inject\n    public UnanchoredStaticWorkbenchPanelPresenter(@Named(\"UnanchoredStaticWorkbenchPanelView\") final UnanchoredStaticWorkbenchPanelView view,\n                                                   final PerspectiveManager perspectiveManager,\n                                                   final PlaceManager placeManager) {\n        super(view,\n              perspectiveManager);\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    protected UnanchoredStaticWorkbenchPanelPresenter asPresenterType() {\n        return this;\n    }\n\n    /**\n     * Returns null (static panels don't support child panels).\n     */\n    @Override\n    public String getDefaultChildType() {\n        return null;\n    }\n\n    public Class<? extends WorkbenchPartPresenter> getPartType() {\n        return UnanchoredWorkbenchPartPresenter.class;\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part));\n        }\n    }\n\n    @Override\n    public void addPart(WorkbenchPartPresenter part,\n                        String contextId) {\n        SinglePartPanelHelper h = createSinglePartPanelHelper();\n        if (h.hasNoParts()) {\n            super.addPart(part,\n                          contextId);\n        } else {\n            h.closeFirstPartAndAddNewOne(() -> super.addPart(part,\n                                                             contextId));\n        }\n    }\n\n    SinglePartPanelHelper createSinglePartPanelHelper() {\n        return new SinglePartPanelHelper(getPanelView().getParts(),\n                                         placeManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/impl/UnanchoredStaticWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.dom.client.FocusEvent;\nimport com.google.gwt.event.dom.client.FocusHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.client.workbench.widgets.panel.StaticFocusedResizePanel;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * The view component of {@link UnanchoredStaticWorkbenchPanelPresenter}.\n */\n@Dependent\n@Named(\"UnanchoredStaticWorkbenchPanelView\")\npublic class UnanchoredStaticWorkbenchPanelView\n        extends AbstractWorkbenchPanelView<UnanchoredStaticWorkbenchPanelPresenter> {\n\n    @Inject\n    PlaceManager placeManager;\n\n    @Inject\n    StaticFocusedResizePanel panel;\n\n    @PostConstruct\n    void postConstruct() {\n\n        panel.addFocusHandler(new FocusHandler() {\n            @Override\n            public void onFocus(final FocusEvent event) {\n                panelManager.onPanelFocus(presenter.getDefinition());\n            }\n        });\n\n        //When a tab is selected ensure content is resized and set focus\n        panel.addSelectionHandler(new SelectionHandler<PartDefinition>() {\n            @Override\n            public void onSelection(final SelectionEvent<PartDefinition> event) {\n                panelManager.onPartLostFocus();\n                panelManager.onPartFocus(event.getSelectedItem());\n            }\n        });\n\n        Layouts.setToFillParent(panel);\n\n        initWidget(panel);\n    }\n\n    // override is for unit test: super.getWidget() returns a new mock every time\n    @Override\n    public Widget getWidget() {\n        return panel;\n    }\n\n    public StaticFocusedResizePanel getPanel() {\n        return panel;\n    }\n\n    @Override\n    public void init(final UnanchoredStaticWorkbenchPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public UnanchoredStaticWorkbenchPanelPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        if (panel.getPartView() == null) {\n            panel.setPart(view);\n            onResize();\n        } else {\n            throw new RuntimeException(\"Uberfire Panel Invalid State: This panel support only one part.\");\n        }\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition != null && currentPartDefinition.equals(part)) {\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public boolean removePart(final PartDefinition part) {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition != null && currentPartDefinition.equals(part)) {\n            panel.clear();\n            return true;\n        }\n        return false;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        panel.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onResize() {\n        presenter.onResize(getOffsetWidth(),\n                           getOffsetHeight());\n        super.onResize();\n    }\n\n    PartDefinition getCurrentPartDefinition() {\n        View partView = panel.getPartView();\n        if (partView == null) {\n            return null;\n        }\n\n        WorkbenchPartPresenter presenter = partView.getPresenter();\n        if (presenter == null) {\n            return null;\n        }\n\n        return presenter.getDefinition();\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        PartDefinition currentPartDefinition = getCurrentPartDefinition();\n        if (currentPartDefinition == null) {\n            return new ArrayList<>();\n        }\n        return Arrays.asList(currentPartDefinition);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/panels/support/PartManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.support;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.panels.impl.LayoutPanelView;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.workbench.model.PartDefinition;\n\n/**\n * Manages part instances on behalf of {@link LayoutPanelView}.\n * It's needed to retain each parts state across perspective changes.\n */\n@ApplicationScoped\npublic class PartManager {\n\n    private final Map<PartDefinition, Widget> widgets = new HashMap<PartDefinition, Widget>();\n    private Pair<PartDefinition, Widget> activePart;\n\n    public Pair<PartDefinition, Widget> getActivePart() {\n        return activePart;\n    }\n\n    public boolean hasActivePart() {\n        return activePart != null;\n    }\n\n    public void registerPart(PartDefinition partDef,\n                             Widget w) {\n        if (widgets.containsKey(partDef)) {\n            throw new IllegalArgumentException(\"Part already registered: \" + partDef.getPlace().getIdentifier());\n        }\n\n        widgets.put(partDef,\n                    w);\n    }\n\n    public void removePart(PartDefinition partDef) {\n        /*\n        TODO (hbraun): revisit panel managers with single parts\n        if(partDef.equals(activePart.getK1()))\n            throw new IllegalArgumentException(\"Cannot remove active part: \"+ partDef.getPlace().getIdentifier());\n            */\n        if (partDef.equals(activePart.getK1())) {\n            activePart = null;\n        }\n\n        widgets.remove(partDef);\n    }\n\n    public void clearParts() {\n        widgets.clear();\n        activePart = null;\n    }\n\n    public Collection<PartDefinition> getParts() {\n        return Collections.unmodifiableSet(widgets.keySet());\n    }\n\n    public boolean hasPart(PartDefinition partDef) {\n        return widgets.containsKey(partDef);\n    }\n\n    public Widget selectPart(PartDefinition partDef) {\n        if (!hasPart(partDef)) {\n            throw new IllegalArgumentException(\"Unknown part: \" + partDef.getPlace().getIdentifier());\n        }\n\n        final Widget w = widgets.get(partDef);\n        activePart = new Pair<PartDefinition, Widget>(partDef,\n                                                      w);\n\n        return activePart.getK2();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/part/AbstractWorkbenchPartPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.part;\n\nimport java.util.function.Consumer;\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * A Workbench panel part.\n */\npublic abstract class AbstractWorkbenchPartPresenter implements WorkbenchPartPresenter {\n\n    private final View view;\n\n    private String title;\n\n    private String contextId;\n\n    private Menus menus;\n\n    private IsWidget titleDecoration;\n\n    private PartDefinition definition;\n\n    @Inject\n    public AbstractWorkbenchPartPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    void init() {\n        view.init(this);\n    }\n\n    @Override\n    public PartDefinition getDefinition() {\n        return definition;\n    }\n\n    @Override\n    public void setDefinition(final PartDefinition definition) {\n        this.definition = definition;\n    }\n\n    @Override\n    public View getPartView() {\n        return view;\n    }\n\n    @Override\n    public void setWrappedWidget(final IsWidget widget) {\n        this.view.setWrappedWidget(widget);\n    }\n\n    @Override\n    public String getTitle() {\n        return title;\n    }\n\n    @Override\n    public void setTitle(final String title) {\n        this.title = title;\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        menusConsumer.accept(menus);\n    }\n\n    @Override\n    public void setMenus(Menus menus) {\n        this.menus = menus;\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return titleDecoration;\n    }\n\n    @Override\n    public void setTitleDecoration(final IsWidget titleDecoration) {\n        this.titleDecoration = titleDecoration;\n    }\n\n    @Override\n    public String getContextId() {\n        return contextId;\n    }\n\n    @Override\n    public void setContextId(String contextId) {\n        this.contextId = contextId;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/part/WorkbenchPartPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.part;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic interface WorkbenchPartPresenter {\n\n    PartDefinition getDefinition();\n\n    void setDefinition(PartDefinition definition);\n\n    View getPartView();\n\n    void setWrappedWidget(IsWidget widget);\n\n    /**\n     * Returns the text that a panel may choose to display beside this part's title. For example,\n     * {@link MultiTabWorkbenchPanelPresenter} uses this text for the tab's label.\n     * @return The title of this part; never null.\n     */\n    String getTitle();\n\n    /**\n     * Sets the text that a panel may choose to display beside this part's title. For example,\n     * {@link MultiTabWorkbenchPanelPresenter} uses this text for the tab's label.\n     * @param title The title of this part. Null is not permitted.\n     */\n    void setTitle(String title);\n\n    /**\n     * Returns the menus associated with this part.\n     * @return the menus associated with this part. Null if this part does not have menus.\n     */\n    void getMenus(final Consumer<Menus> menusConsumer);\n\n    /**\n     * Sets the menus associated with this part.\n     * @param menus the menus associated with this part. Can be null, which means this part does not have menus.\n     */\n    void setMenus(Menus menus);\n\n    /**\n     * Returns the widget that a panel may choose to display beside this part's title.\n     * @return The title decoration widget to use. Null means no title decoration.\n     */\n    IsWidget getTitleDecoration();\n\n    /**\n     * Sets the widget that a panel may choose to display beside this part's title.\n     * <p>\n     * NOTE: presently, none of the built-in panel types display a part's title decoration.\n     * @param titleDecoration The title decoration widget to use. Null is permitted, and means no title decoration.\n     */\n    void setTitleDecoration(IsWidget titleDecoration);\n\n    String getContextId();\n\n    void setContextId(String contextId);\n\n    public interface View\n            extends\n            UberView<WorkbenchPartPresenter>,\n            RequiresResize {\n\n        WorkbenchPartPresenter getPresenter();\n\n        IsWidget getWrappedWidget();\n\n        void setWrappedWidget(IsWidget widget);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/pmgr/nswe/part/WorkbenchPartPresenterDefault.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.pmgr.nswe.part;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.workbench.part.AbstractWorkbenchPartPresenter;\n\n/**\n * A Workbench panel part.\n */\n@Dependent\npublic class WorkbenchPartPresenterDefault extends AbstractWorkbenchPartPresenter {\n\n    @Inject\n    public WorkbenchPartPresenterDefault(final WorkbenchPartView view) {\n        super(view);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/pmgr/nswe/part/WorkbenchPartView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.pmgr.nswe.part;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * A Workbench panel part.\n */\n@Dependent\npublic class WorkbenchPartView\n        extends SimpleLayoutPanel\n        implements WorkbenchPartPresenter.View {\n\n    private final ScrollPanel sp = new ScrollPanel();\n    private WorkbenchPartPresenter presenter;\n\n    public WorkbenchPartView() {\n        setWidget(sp);\n\n        // ScrollPanel creates an additional internal div that we need to style\n        sp.getElement().getFirstChildElement().setClassName(\"uf-scroll-panel\");\n    }\n\n    @Override\n    public void init(WorkbenchPartPresenter presenter) {\n        this.presenter = presenter;\n        Layouts.setToFillParent(this);\n    }\n\n    @Override\n    public WorkbenchPartPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public IsWidget getWrappedWidget() {\n        return sp.getWidget();\n    }\n\n    @Override\n    public void setWrappedWidget(final IsWidget widget) {\n        sp.setWidget(widget);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/pmgr/unanchored/part/UnanchoredWorkbenchPartPresenter.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.pmgr.unanchored.part;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.workbench.part.AbstractWorkbenchPartPresenter;\n\n/**\n * A Workbench panel part.\n */\n@Dependent\npublic class UnanchoredWorkbenchPartPresenter extends AbstractWorkbenchPartPresenter {\n\n    @Inject\n    public UnanchoredWorkbenchPartPresenter(final UnanchoredWorkbenchPartView view) {\n        super(view);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/pmgr/unanchored/part/UnanchoredWorkbenchPartView.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.pmgr.unanchored.part;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\n/**\n * A Workbench panel part.\n */\n@Dependent\npublic class UnanchoredWorkbenchPartView\n        extends SimplePanel\n        implements WorkbenchPartPresenter.View {\n\n    private final ScrollPanel sp = new ScrollPanel();\n    private WorkbenchPartPresenter presenter;\n\n    public UnanchoredWorkbenchPartView() {\n        setWidget(sp);\n\n        // ScrollPanel creates an additional internal div that we need to style\n        sp.getElement().getFirstChildElement().setClassName(\"uf-scroll-panel\");\n    }\n\n    @Override\n    public void init(WorkbenchPartPresenter presenter) {\n        this.presenter = presenter;\n        Layouts.setToFillParent(this);\n        sp.getElement().addClassName(\"uf-perspective-component\");\n    }\n\n    @Override\n    public WorkbenchPartPresenter getPresenter() {\n        return this.presenter;\n    }\n\n    @Override\n    public IsWidget getWrappedWidget() {\n        return sp.getWidget();\n    }\n\n    @Override\n    public void setWrappedWidget(final IsWidget widget) {\n        sp.setWidget(widget);\n    }\n\n    @Override\n    public void onResize() {\n        if (getWidget() instanceof RequiresResize) {\n            ((RequiresResize) getWidget()).onResize();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/animations/LinearFadeInAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.animations;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * A linear animation to fade a Widget from 0.0 to 1.0 opacity\n */\npublic class LinearFadeInAnimation extends SequencedAnimation {\n\n    private Widget widget;\n\n    public LinearFadeInAnimation(final Widget widget) {\n        this.widget = widget;\n    }\n\n    @Override\n    public void onUpdate(double progress) {\n        this.widget.getElement().getStyle().setOpacity(progress);\n    }\n\n    @Override\n    public double interpolate(double progress) {\n        return progress;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/animations/LinearFadeOutAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.animations;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * A linear animation to fade a Widget from 1.0 to 0.0 opacity\n */\npublic class LinearFadeOutAnimation extends SequencedAnimation {\n\n    private Widget widget;\n\n    public LinearFadeOutAnimation(final Widget widget) {\n        this.widget = widget;\n    }\n\n    @Override\n    public void onUpdate(double progress) {\n        this.widget.getElement().getStyle().setOpacity(1.0 - progress);\n    }\n\n    @Override\n    public double interpolate(double progress) {\n        return progress;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/animations/Pause.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.animations;\n\n/**\n * A pause (in between animations). Does nothing.\n */\npublic class Pause extends SequencedAnimation {\n\n    @Override\n    public void onUpdate(double progress) {\n        //Do nothing. This animation simply acts as a delay\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/animations/SequencedAnimation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.animations;\n\nimport com.google.gwt.animation.client.Animation;\n\n/**\n * An animation that can be sequenced to run in a list of animations. In reality\n * we only GWT's Animation's protected methods to be public so we can chain the\n * completion of one Animation to another.\n */\npublic abstract class SequencedAnimation extends Animation {\n\n    @Override\n    public double interpolate(double progress) {\n        return super.interpolate(progress);\n    }\n\n    @Override\n    public void onCancel() {\n        super.onCancel();\n    }\n\n    @Override\n    public void onStart() {\n        super.onStart();\n    }\n\n    @Override\n    public void onComplete() {\n        super.onComplete();\n    }\n\n    @Override\n    public abstract void onUpdate(double progress);\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/animations/Sequencer.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.animations;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport com.google.gwt.animation.client.Animation;\n\n/**\n * Run a list of animations in order.\n */\npublic class Sequencer {\n\n    private int currentAnimationIndex = 0;\n    //The list of animations\n    private List<AnimationConfiguration> animations = new ArrayList<AnimationConfiguration>();\n\n    /**\n     * Add an animation to the list of animations to be sequenced.\n     * @param animation\n     * @param duration\n     */\n    public void add(final SequencedAnimation animation,\n                    final int duration) {\n        animations.add(new AnimationConfiguration(new WrappedAnimation(animation),\n                                                  duration));\n    }\n\n    /**\n     * Run all animations.\n     */\n    public void run() {\n        runNextAnimation();\n    }\n\n    /**\n     * Reset the sequence to the begining.\n     */\n    public void reset() {\n        currentAnimationIndex = 0;\n    }\n\n    private void runNextAnimation() {\n        if (currentAnimationIndex < animations.size()) {\n            final AnimationConfiguration config = animations.get(currentAnimationIndex++);\n            final WrappedAnimation animation = config.animation;\n            final int duration = config.duration;\n            animation.run(duration);\n        } else {\n            reset();\n        }\n    }\n\n    //Simple holder for sequenced animation details\n    private class AnimationConfiguration {\n\n        final WrappedAnimation animation;\n\n        final int duration;\n\n        AnimationConfiguration(final WrappedAnimation animation,\n                               final int duration) {\n            this.animation = animation;\n            this.duration = duration;\n        }\n    }\n\n    //A wrapper for sequenced animations allowing us to hook into the onComplete method to launch the next animation\n    private class WrappedAnimation extends Animation {\n\n        private final SequencedAnimation animation;\n\n        WrappedAnimation(final SequencedAnimation animation) {\n            this.animation = animation;\n        }\n\n        @Override\n        public void onComplete() {\n            //Pass through to the wrapped animation\n            animation.onComplete();\n            runNextAnimation();\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            //Pass through to the wrapped animation\n            animation.onUpdate(progress);\n        }\n\n        @Override\n        public void cancel() {\n            //Pass through to the wrapped animation\n            animation.cancel();\n        }\n\n        @Override\n        protected double interpolate(double progress) {\n            //Pass through to the wrapped animation\n            return animation.interpolate(progress);\n        }\n\n        @Override\n        protected void onCancel() {\n            //Pass through to the wrapped animation\n            animation.onCancel();\n        }\n\n        @Override\n        protected void onStart() {\n            //Pass through to the wrapped animation\n            animation.onStart();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/common/ErrorPopupPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.common;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.Commands;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * Shows simple text-only error messages in a modal popup dialog that sits above the workbench.\n * This is designed to be used only for reporting error conditions; to make a full-featured popup UI, see {@link WorkbenchPopup}.\n */\n@ApplicationScoped\npublic class ErrorPopupPresenter {\n\n    private final View view;\n\n    @Inject\n    public ErrorPopupPresenter(View view) {\n        this.view = view;\n    }\n\n    /**\n     * Shows the given message in a modal popup that appears above all other workbench contents.\n     *\n     * @param msg        The message to display as plain text. HTML tags are not interpreted, and newlines are rendered as newlines.\n     * @param afterShow  The command to invoke once the dialog has been displayed. Must not be null.\n     * @param afterClose The command to invoke once the dialog has been closed. Must not be null.\n     */\n    public void showMessage(final String msg,\n                            final Command afterShow,\n                            final Command afterClose) {\n        view.showMessage(msg,\n                         checkNotNull(\"afterShow\",\n                                      afterShow),\n                         checkNotNull(\"afterClose\",\n                                      afterClose));\n    }\n\n    /**\n     * Shows the given message in a modal popup that appears above all other workbench contents.\n     *\n     * @param msg The message to display as plain text. HTML tags are not interpreted, and newlines are rendered as newlines.\n     */\n    public void showMessage(final String msg) {\n        view.showMessage(msg,\n                         Commands.DO_NOTHING,\n                         Commands.DO_NOTHING);\n    }\n\n    /**\n     * The interface that popup views implement. There should be exactly one implementation of this interface on the\n     * classpath at compile time, and it will usually come from a module that provides all such views.\n     */\n    public interface View {\n\n        /**\n         * Displays the given message in a modal dialog that sits above all other workbench components. The dialog\n         * should include some sort of user interface controls for dismissing itself.\n         *\n         * @param msg        The message to display as plain text. Not HTML; newlines should be rendered as newlines.\n         * @param afterShow  The command to invoke once the dialog has been displayed. Never null.\n         * @param afterClose The command to invoke once the dialog has been closed. Never null.\n         */\n        void showMessage(final String msg,\n                         final Command afterShow,\n                         final Command afterClose);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/CompassDropController.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.allen_sauer.gwt.dnd.client.DragContext;\nimport com.allen_sauer.gwt.dnd.client.VetoDragException;\nimport com.allen_sauer.gwt.dnd.client.drop.DropController;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.events.DropPlaceEvent;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * A Drop Controller covering the entire DecoratedWorkbenchPanel that renders a Compass\n * with which to select the target position of the drag operation.\n */\n@Dependent\npublic class CompassDropController implements DropController {\n\n    @Inject\n    CompassWidget compass;\n\n    WorkbenchPanelView<?> dropTarget;\n\n    @Inject\n    PanelManager panelManager;\n\n    @Inject\n    WorkbenchDragAndDropManager dndManager;\n\n    @Inject\n    private Event<DropPlaceEvent> workbenchPartDroppedEvent;\n\n    public void setup(final WorkbenchPanelView<?> view) {\n        dropTarget = view;\n    }\n\n    @Override\n    //When entering a DecoratedWorkbenchPanel show the Compass\n    public void onEnter(DragContext context) {\n        compass.onEnter(context);\n    }\n\n    @Override\n    //Hide the DecoratedWorkbenchPanel's Compass\n    public void onLeave(DragContext context) {\n        compass.onLeave(context);\n    }\n\n    @Override\n    public void onMove(DragContext context) {\n        compass.onMove(context);\n    }\n\n    @Override\n    public void onDrop(DragContext context) {\n\n        //If not dropTarget has been identified do nothing\n        Position p = compass.getDropPosition();\n        if (p == CompassPosition.NONE) {\n            return;\n        }\n\n        compass.onDrop(context);\n\n        //Move Part from source to target\n        final WorkbenchDragContext workbenchContext = dndManager.getWorkbenchContext();\n        final Menus menus = workbenchContext.getMenus();\n\n        final PanelDefinition sourcePanel = workbenchContext.getSourcePanel();\n        final PanelDefinition dropPanel = dropTarget.getPresenter().getDefinition();\n\n        //If the Target Panel is the same as the Source we're trying to reposition the\n        //Source's tab within itself. If the Source Panel has only one Tab there is no\n        //net effect. If we're trying to drop as a new tab there is no net effect.\n        if (sourcePanel.equals(dropPanel)) {\n            if (sourcePanel.getParts() != null && sourcePanel.getParts().size() == 1) {\n                return;\n            }\n            if (p == CompassPosition.SELF) {\n                return;\n            }\n        }\n\n        final PlaceRequest place = workbenchContext.getPlace();\n\n        firePartDroppedEvent(place);\n\n        final Integer height = null;\n        final Integer width = null;\n        final Integer minHeight = workbenchContext.getMinHeight();\n        final Integer minWidth = workbenchContext.getMinWidth();\n\n        final PanelDefinition targetPanel = panelManager.addWorkbenchPanel(dropPanel,\n                                                                           p,\n                                                                           height,\n                                                                           width,\n                                                                           minHeight,\n                                                                           minWidth);\n        final UIPart uiPart = workbenchContext.getUiPart();\n        final PartDefinition sourcePart = workbenchContext.getSourcePart();\n\n        panelManager.addWorkbenchPart(place,\n                                      sourcePart,\n                                      targetPanel,\n                                      menus,\n                                      uiPart,\n                                      workbenchContext.getContextId(),\n                                      null,\n                                      null);\n    }\n\n    void firePartDroppedEvent(PlaceRequest place) {\n        workbenchPartDroppedEvent.fire(new DropPlaceEvent(place));\n    }\n\n    @Override\n    public Widget getDropTarget() {\n        return this.dropTarget.getPartDropRegion();\n    }\n\n    @Override\n    public void onPreviewDrop(DragContext context) throws VetoDragException {\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/CompassWidget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport com.allen_sauer.gwt.dnd.client.drop.DropController;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * A pop-up widget with arrows in the four cardinal directions, each of which is a separate drop target. The center of\n * the widget is a fifth drop target representing the parent widget itself. The compass centers itself over its parent's\n * Drop Target when displayed.\n */\npublic interface CompassWidget extends DropController {\n\n    Position getDropPosition();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/DragArea.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.HasClickHandlers;\nimport com.google.gwt.event.dom.client.HasMouseDownHandlers;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class DragArea extends SimplePanel implements HasClickHandlers,\n                                                     HasMouseDownHandlers {\n\n    public DragArea() {\n        super();\n    }\n\n    public DragArea(final Widget child) {\n        super(child);\n    }\n\n    public void add(final Element element) {\n        getElement().appendChild(element);\n    }\n\n    @Override\n    public HandlerRegistration addClickHandler(ClickHandler handler) {\n        return addDomHandler(handler,\n                             ClickEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {\n        return addDomHandler(handler,\n                             MouseDownEvent.getType());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/WorkbenchDragAndDropManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.allen_sauer.gwt.dnd.client.drop.DropController;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.workbench.BeanFactory;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\n/**\n * A Manager of drag and drop operations within the Workbench.\n */\n@ApplicationScoped\npublic class WorkbenchDragAndDropManager {\n\n    /**\n     * Maps panels to the drop controllers we have registered them with (so we can unregister them later).\n     */\n    Map<WorkbenchPanelView, DropController> dropControllerMap = new HashMap<WorkbenchPanelView, DropController>();\n    @Inject\n    WorkbenchPickupDragController dragController;\n    @Inject\n    BeanFactory factory;\n    //The context of the drag operation\n    private WorkbenchDragContext workbenchContext = null;\n\n    public void makeDraggable(IsWidget draggable,\n                              IsWidget dragHandle) {\n        this.dragController.makeDraggable(draggable.asWidget(),\n                                          dragHandle.asWidget());\n    }\n\n    public void registerDropController(final WorkbenchPanelView owner,\n                                       final DropController dropController) {\n        dropControllerMap.put(owner,\n                              dropController);\n        dragController.registerDropController(dropController);\n    }\n\n    public void unregisterDropController(final WorkbenchPanelView view) {\n        final DropController dropController = dropControllerMap.remove(view);\n        dragController.unregisterDropController(dropController);\n        factory.destroy(dropController);\n    }\n\n    public void unregisterDropControllers() {\n        for (Map.Entry<WorkbenchPanelView, DropController> e : this.dropControllerMap.entrySet()) {\n            final DropController dropController = dropControllerMap.get(e.getKey());\n            dragController.unregisterDropController(dropController);\n            factory.destroy(dropController);\n        }\n        this.dropControllerMap.clear();\n    }\n\n    public WorkbenchDragContext getWorkbenchContext() {\n        return this.workbenchContext;\n    }\n\n    public void setWorkbenchContext(final WorkbenchDragContext workbenchContext) {\n        this.workbenchContext = workbenchContext;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/WorkbenchDragContext.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * The context of a drag and drop operation within the Workbench.\n */\npublic class WorkbenchDragContext {\n\n    private final PlaceRequest place;\n    private final PartDefinition sourcePart;\n    private final PanelDefinition sourcePanel;\n    private final Menus menus;\n    private final UIPart uiPart;\n    private final String contextId;\n\n    private Integer height;\n    private Integer width;\n    private Integer minHeight;\n    private Integer minWidth;\n\n    public WorkbenchDragContext(final PlaceRequest place,\n                                final PartDefinition sourcePart,\n                                final PanelDefinition sourcePanel,\n                                final Menus menus,\n                                final String title,\n                                final IsWidget titleDecoration,\n                                final IsWidget widget,\n                                final String contextId,\n                                final Integer height,\n                                final Integer width,\n                                final Integer minHeight,\n                                final Integer minWidth) {\n        this.place = place;\n        this.sourcePart = sourcePart;\n        this.sourcePanel = sourcePanel;\n        this.menus = menus;\n        this.uiPart = new UIPart(title,\n                                 titleDecoration,\n                                 widget);\n        this.contextId = contextId;\n        this.height = height;\n        this.width = width;\n        this.minHeight = minHeight;\n        this.minWidth = minWidth;\n    }\n\n    /**\n     * @return the place\n     */\n    public PlaceRequest getPlace() {\n        return this.place;\n    }\n\n    /**\n     * @return the sourcePart\n     */\n    public PartDefinition getSourcePart() {\n        return sourcePart;\n    }\n\n    /**\n     * @return the sourcePanel\n     */\n    public PanelDefinition getSourcePanel() {\n        return sourcePanel;\n    }\n\n    public UIPart getUiPart() {\n        return uiPart;\n    }\n\n    public final Integer getHeight() {\n        return height;\n    }\n\n    public final Integer getWidth() {\n        return width;\n    }\n\n    public final Integer getMinHeight() {\n        return minHeight;\n    }\n\n    public final Integer getMinWidth() {\n        return minWidth;\n    }\n\n    public Menus getMenus() {\n        return menus;\n    }\n\n    public String getContextId() {\n        return contextId;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/dnd/WorkbenchPickupDragController.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.allen_sauer.gwt.dnd.client.DragContext;\nimport com.allen_sauer.gwt.dnd.client.PickupDragController;\nimport com.allen_sauer.gwt.dnd.client.util.DOMUtil;\nimport com.allen_sauer.gwt.dnd.client.util.DragClientBundle;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.uberfire.plugin.PluginUtil.toInteger;\n\n/**\n * A Drag Controller for the Workbench.\n */\n@ApplicationScoped\npublic class WorkbenchPickupDragController extends PickupDragController {\n\n    private final Image dragProxy = new Image(WorkbenchResources.INSTANCE.images().workbenchPanelDragProxy());\n\n    @Inject\n    private WorkbenchDragAndDropManager dndManager;\n\n    public WorkbenchPickupDragController() {\n        super(new AbsolutePanel(),\n              false);\n        setBehaviorDragProxy(true);\n        setBehaviorDragStartSensitivity(1);\n    }\n\n    @Override\n    public void dragStart() {\n        final WorkbenchPartPresenter.View sourceView = (WorkbenchPartPresenter.View) super.context.selectedWidgets.get(0);\n        final PartDefinition sourcePart = sourceView.getPresenter().getDefinition();\n        final PanelDefinition sourcePanel = sourceView.getPresenter().getDefinition().getParentPanel();\n        final PlaceRequest place = sourcePart.getPlace();\n        final String title = sourceView.getPresenter().getTitle();\n        final IsWidget titleDecoration = sourceView.getPresenter().getTitleDecoration();\n        final String contextId = sourceView.getPresenter().getContextId();\n        final IsWidget widget = sourceView.getPresenter().getPartView().getWrappedWidget();\n        final Integer height = toInteger(sourcePanel.getHeightAsInt());\n        final Integer width = toInteger(sourcePanel.getWidthAsInt());\n        final Integer minHeight = toInteger(sourcePanel.getMinHeightAsInt());\n        final Integer minWidth = toInteger(sourcePanel.getMinWidthAsInt());\n        sourceView.getPresenter().getMenus(menus -> {\n            final WorkbenchDragContext context = new WorkbenchDragContext(place,\n                                                                          sourcePart,\n                                                                          sourcePanel,\n                                                                          menus,\n                                                                          title,\n                                                                          titleDecoration,\n                                                                          widget,\n                                                                          contextId,\n                                                                          height,\n                                                                          width,\n                                                                          minHeight,\n                                                                          minWidth);\n            dndManager.setWorkbenchContext(context);\n            super.dragStart();\n            final Widget movablePanel = getMoveablePanel();\n            if (movablePanel != null) {\n                DOMUtil.fastSetElementPosition(movablePanel.getElement(),\n                                               super.context.mouseX,\n                                               super.context.mouseY);\n            }\n        });\n    }\n\n    @Override\n    public void dragMove() {\n        super.dragMove();\n        final Widget movablePanel = getMoveablePanel();\n        if (movablePanel != null) {\n            DOMUtil.fastSetElementPosition(movablePanel.getElement(),\n                                           super.context.mouseX,\n                                           super.context.mouseY);\n        }\n    }\n\n    @Override\n    protected Widget newDragProxy(DragContext context) {\n        final AbsolutePanel container = new AbsolutePanel();\n        container.getElement().getStyle().setProperty(\"overflow\",\n                                                      \"visible\");\n        container.getElement().getStyle().setOpacity(0.5);\n        container.getElement().getStyle().setZIndex(Integer.MAX_VALUE);\n\n        //Offset to centre of dragProxy\n        int offsetX = 0 - ((int) (dragProxy.getWidth() * 0.5));\n        int offsetY = 0 - ((int) (dragProxy.getHeight() * 2));\n        container.add(dragProxy,\n                      offsetX,\n                      offsetY);\n        return container;\n    }\n\n    private Widget getMoveablePanel() {\n        for (int index = 0; index < context.boundaryPanel.getWidgetCount(); index++) {\n            final Widget w = context.boundaryPanel.getWidget(index);\n            if (w.getStyleName().equals(DragClientBundle.INSTANCE.css().movablePanel())) {\n                return w;\n            }\n        }\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/listbar/ListBarWidget.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.listbar;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.panels.impl.AbstractSimpleWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelView;\nimport org.uberfire.mvp.Command;\n\n/**\n * API contract for the header widget of panel views that extend {@link AbstractSimpleWorkbenchPanelView} and\n * {@link MultiListWorkbenchPanelView}. Each application needs exactly one implementation of this class at compile time\n * (usually this will come from the view module). The implementing type must be a Dependent-scoped CDI bean.\n */\npublic interface ListBarWidget extends MultiPartWidget {\n\n    /**\n     * When a part is added to the list bar, a special title widget is created for it. This title widget is draggable.\n     * To promote testability, implementations of this interface must set the draggable title widget's debug ID using\n     * the {@code Widget.ensureDebugId()} call. The debug ID must have the form\n     * {@code DEBUG_ID_PREFIX + DEBUG_TITLE_PREFIX + partName}.\n     * <p>\n     * Note that debug IDs are only assigned when the app inherits the GWT Debug module. See\n     * {@link Widget#ensureDebugId(com.google.gwt.dom.client.Element, String)} for details.\n     */\n    public static final String DEBUG_TITLE_PREFIX = \"ListBar-title-\";\n\n    /**\n     * Enable this list bar's to support drag and drop.\n     */\n    public void enableDnd();\n\n    /**\n     * Disable this list bar's to support drag and drop.\n     */\n    public void disableDnd();\n\n    /**\n     * Returns the toggle button, which is initially hidden, that can be used to trigger maximizing and unmaximizing\n     * of the panel containing this list bar. Make the button visible by calling {@link Widget#setVisible(boolean)}\n     * and set its maximize and unmaximize actions with {@link MaximizeToggleButtonPresenter#setMaximizeCommand(Command)} and\n     * {@link MaximizeToggleButtonPresenter#setUnmaximizeCommand(Command)}.\n     */\n    public MaximizeToggleButtonPresenter getMaximizeButton();\n\n    public boolean isDndEnabled();\n\n    /**\n     * Enable support to close parts.\n     */\n    void enableClosePart();\n\n    /**\n     * Disable support to close parts.\n     */\n    void disableClosePart();\n\n    /**\n     * Disable part expansion (maximize)\n     */\n    void disableExpandPart();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/listbar/ListbarPreferences.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.listbar;\n\npublic class ListbarPreferences {\n\n    private boolean contextEnabled;\n\n    private boolean hideTitleDropDownOnSingleElement = true;\n\n    public ListbarPreferences() {\n\n    }\n\n    public ListbarPreferences(boolean contextEnabled) {\n        this.contextEnabled = contextEnabled;\n    }\n\n    public boolean isContextEnabled() {\n        return contextEnabled;\n    }\n\n    public boolean isHideTitleDropDownOnSingleElement() {\n        return hideTitleDropDownOnSingleElement;\n    }\n\n    public void setHideTitleDropDownOnSingleElement(boolean hideTitleDropDownOnSingleElement) {\n        this.hideTitleDropDownOnSingleElement = hideTitleDropDownOnSingleElement;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/listbar/ResizeFlowPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.listbar;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.LayoutPanel;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\n\n/**\n * A FlowPanel that can exist in a hierarchy of {@link LayoutPanel}s. Behaves exactly like FlowPanel, but also\n * propagates <tt>onResize</tt> events to the child widgets.\n */\npublic class ResizeFlowPanel extends FlowPanel implements RequiresResize,\n                                                          ProvidesResize {\n\n    @Override\n    public void onResize() {\n        for (Widget child : this) {\n            if (child instanceof RequiresResize) {\n                ((RequiresResize) child).onResize();\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/listbar/ResizeFocusPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.listbar;\n\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.LayoutPanel;\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.util.Layouts;\n\n/**\n * A FocusPanel that can exist in a hierarchy of {@link LayoutPanel}s. Behaves exactly like FocusPanel, but also\n * propagates <tt>onResize</tt> events to the child widget.\n */\npublic class ResizeFocusPanel extends FocusPanel implements RequiresResize,\n                                                            ProvidesResize {\n\n    public ResizeFocusPanel() {\n    }\n\n    public ResizeFocusPanel(Widget child) {\n        super(child);\n        Layouts.setToFillParent(this);\n    }\n\n    @Override\n    public void onResize() {\n        if (getWidget() instanceof RequiresResize) {\n            ((RequiresResize) getWidget()).onResize();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/AbstractWorkbenchMenuProducer.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport javax.enterprise.event.Observes;\n\nimport com.google.gwt.user.client.Window;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuPresenter;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuView;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationManager;\n\npublic abstract class AbstractWorkbenchMenuProducer<PRESENTER extends WorkbenchBaseMenuPresenter, VIEW extends WorkbenchBaseMenuView> {\n\n    protected AuthorizationManager authzManager;\n    protected PerspectiveManager perspectiveManager;\n    protected PlaceManager placeManager;\n    protected ActivityManager activityManager;\n    protected User identity;\n    protected ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    protected VIEW view;\n    protected PRESENTER instance = null;\n\n    public AbstractWorkbenchMenuProducer() {\n    }\n\n    public AbstractWorkbenchMenuProducer(final AuthorizationManager authzManager, final PerspectiveManager perspectiveManager, final PlaceManager placeManager, final ActivityManager activityManager, final User identity, final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager, VIEW view) {\n        this.authzManager = authzManager;\n        this.perspectiveManager = perspectiveManager;\n        this.placeManager = placeManager;\n        this.activityManager = activityManager;\n        this.identity = identity;\n        this.experimentalActivitiesAuthorizationManager = experimentalActivitiesAuthorizationManager;\n        this.view = view;\n    }\n\n    protected abstract PRESENTER makeDefaultPresenter();\n\n    protected abstract PRESENTER makeStandalonePresenter();\n\n    public PRESENTER getWorbenchMenu() {\n        if (instance == null) {\n            if (!isStandalone()) {\n                instance = makeDefaultPresenter();\n            } else {\n                instance = makeStandalonePresenter();\n            }\n        }\n        return instance;\n    }\n\n    protected void onPerspectiveChange(final @Observes PerspectiveChange perspectiveChange) {\n        if (instance != null) {\n            instance.onPerspectiveChange(perspectiveChange);\n        }\n    }\n\n    protected void onPerspectiveHide(final @Observes PerspectiveVisibiltiyChangeEvent setPerspectiveVisibleEvent) {\n        if (instance != null) {\n            instance.onPerspectiveVisibilityChange(setPerspectiveVisibleEvent);\n        }\n    }\n\n    protected boolean isStandalone() {\n        return Window.Location.getParameterMap().containsKey(\"standalone\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/HasMenus.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic interface HasMenus {\n\n    void addMenus(final Menus menus);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/MenuItemVisibilityHandler.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport java.util.function.BiConsumer;\n\npublic class MenuItemVisibilityHandler {\n\n    private String identifier;\n    private BiConsumer<String, Boolean> visibilityChangeCallback;\n\n    public MenuItemVisibilityHandler(String identifier, BiConsumer<String, Boolean> visibilityChangeCallback) {\n        this.identifier = identifier;\n        this.visibilityChangeCallback = visibilityChangeCallback;\n    }\n\n    public void run(Boolean visibile) {\n        visibilityChangeCallback.accept(identifier, visibile);\n    }\n\n    public String getIdentifier() {\n        return identifier;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/PartContextMenusPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchActivity;\nimport org.uberfire.client.workbench.events.PlaceGainFocusEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@ApplicationScoped\npublic class PartContextMenusPresenter {\n\n    @Inject\n    private PlaceManager placeManager;\n    @Inject\n    private View view;\n    private PlaceRequest activePlace = null;\n\n    @SuppressWarnings(\"unused\")\n    private void onWorkbenchPartOnFocus(@Observes PlaceGainFocusEvent event) {\n        final Activity activity = placeManager.getActivity(event.getPlace());\n        if (activity == null) {\n            return;\n        }\n        if (!(activity instanceof WorkbenchActivity)) {\n            return;\n        }\n        final WorkbenchActivity wbActivity = (WorkbenchActivity) activity;\n\n        if (!event.getPlace().equals(activePlace)) {\n\n            //Add items for current WorkbenchPart\n            activePlace = event.getPlace();\n\n            wbActivity.getMenus(this::buildMenu);\n        }\n    }\n\n    private void buildMenu(final Menus menus) {\n        if (menus == null || menus.getItems() == null || menus.getItems().isEmpty()) {\n            view.clear();\n            return;\n        }\n        view.buildMenu(menus);\n    }\n\n    public View getView() {\n        return view;\n    }\n\n    public interface View\n            extends\n            IsWidget {\n\n        void buildMenu(final Menus menus);\n\n        void clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/UtilityMenuBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\npublic interface UtilityMenuBar extends HasMenus {\n\n    void clear();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/UtilityMenuBarPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@ApplicationScoped\npublic class UtilityMenuBarPresenter implements UtilityMenuBar {\n\n    @Inject\n    private View view;\n\n    public IsWidget getView() {\n        return this.view;\n    }\n\n    @Override\n    public void addMenus(final Menus menus) {\n        if (menus != null && !menus.getItems().isEmpty()) {\n            view.addMenus(menus);\n        }\n    }\n\n    @Override\n    public void clear() {\n        view.clear();\n    }\n\n    public interface View\n            extends\n            IsWidget,\n            HasMenus {\n\n        void clear();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBar.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport org.uberfire.mvp.Command;\n\n/**\n *\n */\npublic interface WorkbenchMenuBar extends HasMenus {\n\n    void clear();\n\n    void expand();\n\n    void collapse();\n\n    void addCollapseHandler(Command command);\n\n    void addExpandHandler(Command command);\n\n    boolean isUseExpandedMode();\n\n    boolean isExpanded();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport java.util.function.BiConsumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuPresenter;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuView;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\n/**\n * Presenter for WorkbenchMenuBar that mediates changes to the Workbench MenuBar\n * in response to changes to the selected WorkbenchPart. The menu structure is\n * cloned and items that lack permission are removed. This implementation is\n * specific to GWT. An alternative implementation should be considered for use\n * within Eclipse.\n */\npublic class WorkbenchMenuBarPresenter extends WorkbenchBaseMenuPresenter implements WorkbenchMenuBar {\n\n    protected AuthorizationManager authzManager;\n    protected User identity;\n    private boolean useExpandedMode = true;\n    private boolean expanded = true;\n    private PerspectiveManager perspectiveManager;\n    private PlaceManager placeManager;\n    private ActivityManager activityManager;\n    private View view;\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    WorkbenchMenuBarPresenter(final AuthorizationManager authzManager,\n                              final PerspectiveManager perspectiveManager,\n                              final PlaceManager placeManager,\n                              final ActivityManager activityManager,\n                              final User identity,\n                              final View view,\n                              final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager) {\n        this.authzManager = authzManager;\n        this.perspectiveManager = perspectiveManager;\n        this.placeManager = placeManager;\n        this.activityManager = activityManager;\n        this.identity = identity;\n        this.view = view;\n        this.experimentalActivitiesAuthorizationManager = experimentalActivitiesAuthorizationManager;\n\n        setup();\n    }\n\n    protected void setup() {\n        view.addExpandHandler(new Command() {\n            @Override\n            public void execute() {\n                expanded = true;\n            }\n        });\n        view.addCollapseHandler(new Command() {\n            @Override\n            public void execute() {\n                expanded = false;\n            }\n        });\n    }\n\n    public IsWidget getView() {\n        return this.view;\n    }\n\n    @Override\n    protected WorkbenchBaseMenuView getBaseView() {\n        return view;\n    }\n\n    @Override\n    protected void visitMenus(final Menus addedMenu) {\n        addedMenu.accept(new AuthFilterMenuVisitor(authzManager,\n                                                   identity,\n                                                   new BaseMenuVisitor() {\n\n                                                       private String parentId = null;\n\n                                                       @Override\n                                                       public boolean visitEnter(final MenuGroup menuGroup) {\n                                                           parentId = getMenuItemId(menuGroup);\n                                                           view.addGroupMenuItem(parentId,\n                                                                                 menuGroup.getCaption(),\n                                                                                 menuGroup.getPosition());\n                                                           return true;\n                                                       }\n\n                                                       @Override\n                                                       public void visitLeave(MenuGroup menuGroup) {\n                                                           parentId = null;\n                                                       }\n\n                                                       @Override\n                                                       public void visit(final MenuItemPlain menuItemPlain) {\n                                                           view.addMenuItem(getMenuItemId(menuItemPlain),\n                                                                            menuItemPlain.getCaption(),\n                                                                            parentId,\n                                                                            null,\n                                                                            menuItemPlain.getPosition());\n                                                           setupEnableDisableMenuItem(menuItemPlain);\n                                                       }\n\n                                                       @Override\n                                                       public void visit(final MenuCustom<?> menuCustom) {\n                                                           final Object build = menuCustom.build();\n                                                           if (build instanceof IsWidget) {\n                                                               view.addCustomMenuItem(((IsWidget) build).asWidget(),\n                                                                                      menuCustom.getPosition());\n                                                           } else {\n                                                               view.addMenuItem(getMenuItemId(menuCustom),\n                                                                                menuCustom.getCaption(),\n                                                                                parentId,\n                                                                                null,\n                                                                                menuCustom.getPosition());\n                                                           }\n                                                           setupEnableDisableMenuItem(menuCustom);\n                                                       }\n\n                                                       @Override\n                                                       public void visit(final MenuItemCommand menuItemCommand) {\n                                                           view.addMenuItem(getMenuItemId(menuItemCommand),\n                                                                            menuItemCommand.getCaption(),\n                                                                            parentId,\n                                                                            menuItemCommand.getCommand(),\n                                                                            menuItemCommand.getPosition());\n                                                           setupEnableDisableMenuItem(menuItemCommand);\n                                                       }\n\n                                                       @Override\n                                                       public void visit(final MenuItemPerspective menuItemPerspective) {\n                                                           final String id = menuItemPerspective.getPlaceRequest().getIdentifier();\n                                                           view.addMenuItem(id,\n                                                                            menuItemPerspective.getCaption(),\n                                                                            parentId,\n                                                                            new Command() {\n                                                                                @Override\n                                                                                public void execute() {\n                                                                                    placeManager.goTo(menuItemPerspective.getPlaceRequest());\n                                                                                }\n                                                                            },\n                                                                            menuItemPerspective.getPosition());\n                                                           setupEnableDisableMenuItem(menuItemPerspective);\n                                                           setupSetVisibleMenuItem(menuItemPerspective);\n                                                           final PlaceRequest placeRequest = menuItemPerspective.getPlaceRequest();\n                                                           if (perspectiveManager.getCurrentPerspective() != null && placeRequest.equals(perspectiveManager.getCurrentPerspective().getPlace())) {\n                                                               view.selectMenuItem(id);\n                                                           }\n                                                       }\n\n                                                       private void setupEnableDisableMenuItem(final MenuItem menuItem) {\n                                                           menuItem.addEnabledStateChangeListener(new EnabledStateChangeListener() {\n                                                               @Override\n                                                               public void enabledStateChanged(final boolean enabled) {\n                                                                   view.enableMenuItem(getMenuItemId(menuItem),\n                                                                                       enabled);\n                                                               }\n                                                           });\n                                                       }\n                                                   }));\n\n        synchronizeUIWithMenus(addedMenu.getItems());\n    }\n\n    private String getMenuItemId(final MenuItem menuItem) {\n        return menuItem.getIdentifier() == null ? menuItem.getCaption() : menuItem.getIdentifier();\n    }\n\n    protected void addPerspectiveMenus(final PerspectiveActivity perspective) {\n        final String perspectiveId = perspective.getIdentifier();\n        perspective.getMenus(menus -> {\n            view.clearContextMenu();\n            if (menus != null) {\n                menus.accept(new AuthFilterMenuVisitor(authzManager,\n                                                       identity,\n                                                       new BaseMenuVisitor() {\n\n                                                           private String parentId = null;\n\n                                                           @Override\n                                                           public boolean visitEnter(final MenuGroup menuGroup) {\n                                                               parentId = getMenuItemId(menuGroup);\n                                                               view.addContextGroupMenuItem(perspectiveId,\n                                                                                            parentId,\n                                                                                            menuGroup.getCaption(),\n                                                                                            menuGroup.getPosition());\n                                                               return true;\n                                                           }\n\n                                                           @Override\n                                                           public void visitLeave(MenuGroup menuGroup) {\n                                                               parentId = null;\n                                                           }\n\n                                                           @Override\n                                                           public void visit(final MenuItemPlain menuItemPlain) {\n                                                               view.addContextMenuItem(perspectiveId,\n                                                                                       getMenuItemId(menuItemPlain),\n                                                                                       menuItemPlain.getCaption(),\n                                                                                       parentId,\n                                                                                       null,\n                                                                                       menuItemPlain.getPosition());\n                                                               setupEnableDisableContextMenuItem(menuItemPlain);\n                                                           }\n\n                                                           @Override\n                                                           public void visit(final MenuCustom<?> menuCustom) {\n                                                               view.addContextMenuItem(perspectiveId,\n                                                                                       getMenuItemId(menuCustom),\n                                                                                       menuCustom.getCaption(),\n                                                                                       parentId,\n                                                                                       null,\n                                                                                       menuCustom.getPosition());\n                                                               setupEnableDisableContextMenuItem(menuCustom);\n                                                           }\n\n                                                           @Override\n                                                           public void visit(final MenuItemCommand menuItemCommand) {\n                                                               view.addContextMenuItem(perspectiveId,\n                                                                                       getMenuItemId(menuItemCommand),\n                                                                                       menuItemCommand.getCaption(),\n                                                                                       parentId,\n                                                                                       menuItemCommand.getCommand(),\n                                                                                       menuItemCommand.getPosition());\n                                                               setupEnableDisableContextMenuItem(menuItemCommand);\n                                                           }\n\n                                                           @Override\n                                                           public void visit(final MenuItemPerspective menuItemPerspective) {\n                                                               view.addContextMenuItem(perspectiveId,\n                                                                                       menuItemPerspective.getPlaceRequest().getIdentifier(),\n                                                                                       menuItemPerspective.getCaption(),\n                                                                                       parentId,\n                                                                                       new Command() {\n                                                                                           @Override\n                                                                                           public void execute() {\n                                                                                               placeManager.goTo(menuItemPerspective.getPlaceRequest());\n                                                                                           }\n                                                                                       },\n                                                                                       menuItemPerspective.getPosition());\n                                                               setupEnableDisableContextMenuItem(menuItemPerspective);\n                                                               setupSetVisibleContextMenuItem(menuItemPerspective);\n                                                           }\n\n                                                           private void setupEnableDisableContextMenuItem(final MenuItem menuItem) {\n                                                               menuItem.addEnabledStateChangeListener(new EnabledStateChangeListener() {\n                                                                   @Override\n                                                                   public void enabledStateChanged(final boolean enabled) {\n                                                                       view.enableContextMenuItem(getMenuItemId(menuItem),\n                                                                                                  enabled);\n                                                                   }\n                                                               });\n                                                           }\n                                                       }));\n\n                synchronizeUIWithMenus(menus.getItems());\n            }\n        });\n    }\n\n    public void onPerspectiveChange(final PerspectiveChange perspectiveChange) {\n        final Activity activity = activityManager.getActivity(perspectiveChange.getPlaceRequest());\n        if (activity != null && activity.isType(ActivityResourceType.PERSPECTIVE.name())) {\n            addPerspectiveMenus((PerspectiveActivity) activity);\n        }\n        view.selectMenuItem(perspectiveChange.getPlaceRequest().getIdentifier());\n    }\n\n    protected void onPlaceMinimized(final PlaceMinimizedEvent event) {\n        if (isUseExpandedMode()) {\n            view.expand();\n        }\n    }\n\n    protected void onPlaceMaximized(final PlaceMaximizedEvent event) {\n        view.collapse();\n    }\n\n    private void setupSetVisibleMenuItem(MenuItemPerspective menuItemPerspective) {\n        doSetMenuItemVisible(menuItemPerspective, view::setMenuItemVisible);\n    }\n\n    private void setupSetVisibleContextMenuItem(MenuItemPerspective menuItemPerspective) {\n        doSetMenuItemVisible(menuItemPerspective, view::setContextMenuItemVisible);\n    }\n\n    protected void doSetMenuItemVisible(MenuItemPerspective menuItemPerspective, BiConsumer<String, Boolean> callback) {\n        String perspectiveId = menuItemPerspective.getPlaceRequest().getIdentifier();\n        boolean visible = experimentalActivitiesAuthorizationManager.authorizeActivityId(perspectiveId);\n\n        callback.accept(perspectiveId, visible);\n\n        registerVisibilityChangeHandler(new MenuItemVisibilityHandler(perspectiveId, callback));\n    }\n\n    @Override\n    public void clear() {\n        view.clear();\n    }\n\n    @Override\n    public void expand() {\n        useExpandedMode = true;\n        view.expand();\n    }\n\n    @Override\n    public boolean isUseExpandedMode() {\n        return useExpandedMode;\n    }\n\n    @Override\n    public boolean isExpanded() {\n        return expanded;\n    }\n\n    @Override\n    public void collapse() {\n        useExpandedMode = false;\n        view.collapse();\n    }\n\n    @Override\n    public void addCollapseHandler(final Command command) {\n        view.addCollapseHandler(command);\n    }\n\n    @Override\n    public void addExpandHandler(final Command command) {\n        view.addExpandHandler(command);\n    }\n\n    public interface View extends WorkbenchBaseMenuView,\n                                  IsWidget {\n\n        void clear();\n\n        void addMenuItem(String id,\n                         String label,\n                         String parentId,\n                         Command command,\n                         MenuPosition position);\n\n        void addCustomMenuItem(Widget menu,\n                               MenuPosition position);\n\n        void addGroupMenuItem(String id,\n                              String label,\n                              MenuPosition position);\n\n        void selectMenuItem(String id);\n\n        void addContextMenuItem(String menuItemId,\n                                String id,\n                                String label,\n                                String parentId,\n                                Command command,\n                                MenuPosition position);\n\n        void addContextGroupMenuItem(String menuItemId,\n                                     String id,\n                                     String label,\n                                     MenuPosition position);\n\n        void clearContextMenu();\n\n        void expand();\n\n        void collapse();\n\n        void addCollapseHandler(Command command);\n\n        void addExpandHandler(Command command);\n\n        void enableMenuItem(String menuItemId,\n                            boolean enabled);\n\n        void enableContextMenuItem(String menuItemId,\n                                   boolean enabled);\n\n        void setAllMenuItemsVisible(String perspectiveId, boolean visible);\n\n        void setMenuItemVisible(String perspectiveId, boolean visible);\n\n        void setContextMenuItemVisible(String perspectiveId, boolean visible);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n@ApplicationScoped\npublic class WorkbenchMenuBarProducer extends AbstractWorkbenchMenuProducer<WorkbenchMenuBarPresenter, WorkbenchMenuBarPresenter.View> {\n\n    public WorkbenchMenuBarProducer() {\n        //CDI proxy\n    }\n\n    @Inject\n    public WorkbenchMenuBarProducer(final AuthorizationManager authzManager,\n                                    final PerspectiveManager perspectiveManager,\n                                    final PlaceManager placeManager,\n                                    final ActivityManager activityManager,\n                                    final User identity,\n                                    final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager, final WorkbenchMenuBarPresenter.View view) {\n        super(authzManager, perspectiveManager, placeManager, activityManager, identity, experimentalActivitiesAuthorizationManager, view);\n    }\n\n    @Produces\n    public WorkbenchMenuBarPresenter getInstance() {\n        return getWorbenchMenu();\n    }\n\n    @Override\n    protected WorkbenchMenuBarPresenter makeDefaultPresenter() {\n        return new WorkbenchMenuBarPresenter(authzManager,\n                                             perspectiveManager,\n                                             placeManager,\n                                             activityManager,\n                                             identity,\n                                             view,\n                                             experimentalActivitiesAuthorizationManager);\n    }\n\n    protected WorkbenchMenuBarPresenter makeStandalonePresenter() {\n        return new WorkbenchMenuBarStandalonePresenter(authzManager,\n                                                       perspectiveManager,\n                                                       placeManager,\n                                                       activityManager,\n                                                       identity,\n                                                       view,\n                                                       experimentalActivitiesAuthorizationManager);\n    }\n\n    protected void onPlaceMinimized(final @Observes PlaceMinimizedEvent event) {\n        if (instance != null) {\n            instance.onPlaceMinimized(event);\n        }\n    }\n\n    protected void onPlaceMaximized(final @Observes PlaceMaximizedEvent event) {\n        if (instance != null) {\n            instance.onPlaceMaximized(event);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarStandalonePresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic class WorkbenchMenuBarStandalonePresenter extends WorkbenchMenuBarPresenter {\n\n    WorkbenchMenuBarStandalonePresenter(final AuthorizationManager authzManager,\n                                        final PerspectiveManager perspectiveManager,\n                                        final PlaceManager placeManager,\n                                        final ActivityManager activityManager,\n                                        final User identity,\n                                        final View view,\n                                        final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager) {\n        super(authzManager,\n              perspectiveManager,\n              placeManager,\n              activityManager,\n              identity,\n              view,\n              experimentalActivitiesAuthorizationManager);\n    }\n\n    @Override\n    public void addMenus(final Menus menus) {\n        //Do nothing. Standalone mode does not use top-level menu items\n    }\n\n    @Override\n    protected void addPerspectiveMenus(final PerspectiveActivity perspective) {\n        perspective.getMenus(super::addMenus);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/base/WorkbenchBaseMenuPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.base;\n\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.widgets.menu.HasMenus;\nimport org.uberfire.client.workbench.widgets.menu.MenuItemVisibilityHandler;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\npublic abstract class WorkbenchBaseMenuPresenter implements HasMenus {\n\n    private List<MenuItemVisibilityHandler> visibilityHandlers;\n    private List<Menus> addedMenus;\n\n    protected abstract WorkbenchBaseMenuView getBaseView();\n\n    protected abstract void visitMenus(final Menus menus);\n\n    public abstract void onPerspectiveChange(final PerspectiveChange perspectiveChange);\n\n    @Override\n    public void addMenus(final Menus menus) {\n        if (menus != null && !menus.getItems().isEmpty()) {\n\n            if (addedMenus == null) {\n                addedMenus = new ArrayList<>();\n            }\n\n            if (visibilityHandlers == null) {\n                visibilityHandlers = new ArrayList<>();\n            }\n\n            addedMenus.add(menus);\n\n            if (menusMustBeReordered(menus)) {\n                reorderMenus();\n                getBaseView().clear();\n\n                for (Menus currentMenus : addedMenus) {\n                    visitMenus(currentMenus);\n                }\n            } else {\n                visitMenus(menus);\n            }\n        }\n    }\n\n    private boolean menusMustBeReordered(final Menus menus) {\n        if (addedMenus.size() < 2) {\n            return false;\n        }\n\n        final Menus previousMenus = addedMenus.get(addedMenus.size() - 2);\n        return previousMenus.getOrder() > menus.getOrder();\n    }\n\n    private void reorderMenus() {\n        Collections.sort(addedMenus,\n                         (o1, o2) -> o1.getOrder() - o2.getOrder());\n    }\n\n    public List<Menus> getAddedMenus() {\n        return this.addedMenus;\n    }\n\n    //Force UI to update to state of MenuItems. Should be called after MenuItems are configured with EnabledStateChangeListener's.\n    protected void synchronizeUIWithMenus(final List<MenuItem> menuItems) {\n        for (MenuItem menuItem : ensureIterable(menuItems)) {\n            if (menuItem instanceof MenuGroup) {\n                synchronizeUIWithMenus(((MenuGroup) menuItem).getItems());\n            } else {\n                menuItem.setEnabled(menuItem.isEnabled());\n            }\n        }\n    }\n\n    protected void registerVisibilityChangeHandler(MenuItemVisibilityHandler handler) {\n        visibilityHandlers.add(handler);\n    }\n\n    public void onPerspectiveVisibilityChange(PerspectiveVisibiltiyChangeEvent event) {\n        if (visibilityHandlers != null) {\n            visibilityHandlers.stream()\n                    .filter(handler -> handler.getIdentifier().equals(event.getPerspectiveId()))\n                    .forEach(handler -> handler.run(event.isVisible()));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/base/WorkbenchBaseMenuUtils.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.base;\n\nimport org.uberfire.workbench.model.menu.MenuItem;\n\npublic class WorkbenchBaseMenuUtils {\n\n    public static String getMenuItemId(final MenuItem menuItem) {\n        return menuItem.getIdentifier() == null ? menuItem.getCaption() : menuItem.getIdentifier();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/base/WorkbenchBaseMenuView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.base;\n\npublic interface WorkbenchBaseMenuView {\n\n    void clear();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/events/PerspectiveVisibiltiyChangeEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.events;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class PerspectiveVisibiltiyChangeEvent implements UberFireEvent {\n\n    private String perspectiveId;\n    private boolean visible;\n\n    public PerspectiveVisibiltiyChangeEvent(String perspectiveId, boolean visible) {\n        this.perspectiveId = perspectiveId;\n        this.visible = visible;\n    }\n\n    public String getPerspectiveId() {\n        return perspectiveId;\n    }\n\n    public boolean isVisible() {\n        return visible;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.widgets.menu.MenuItemVisibilityHandler;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuPresenter;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuUtils;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuView;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanHide;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.HasChildren;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.Selectable;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.visitor.WorkbenchMegaMenuContextMenuVisitor;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.visitor.WorkbenchMegaMenuVisitor;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic class WorkbenchMegaMenuPresenter extends WorkbenchBaseMenuPresenter {\n\n    public interface View extends WorkbenchBaseMenuView,\n                                  UberElement<WorkbenchMegaMenuPresenter>,\n                                  IsElement {\n\n        void clear();\n\n        void clearContextMenu();\n\n        void setHomeLinkAction(Command command);\n\n        void setBrandImageAction(Command command);\n\n        String getDefaultMenuText();\n\n        void setBrandImage(String brandImageUrl);\n\n        void setBrandImageTitle(String brandImageLabel);\n\n        void hideBrand();\n\n        void setMenuAccessorText(String menuAccessorLabel);\n\n        void addMenuItemOnRight(ChildMenuItemPresenter itemPresenter);\n\n        void addMenuItemOnLeft(ChildMenuItemPresenter itemPresenter);\n\n        void addMenuItemOnParent(ChildMenuItemPresenter itemPresenter,\n                                 HasChildren parentPresenter);\n\n        void addCustomMenuItem(IsElement menu);\n\n        void addCustomMenuItem(IsWidget menu);\n\n        void addGroupMenuItem(GroupMenuItemPresenter itemPresenter);\n\n        void addContextMenuItem(GroupContextMenuItemPresenter itemPresenter);\n\n        void addContextMenuItem(ChildContextMenuItemPresenter itemPresenter);\n\n        void addContextMenuItemOnParent(ChildContextMenuItemPresenter itemPresenter,\n                                        HasChildren parentPresenter);\n\n        void setContextMenuActive(boolean active);\n    }\n\n    private AuthorizationManager authzManager;\n    private PerspectiveManager perspectiveManager;\n    private ActivityManager activityManager;\n    private User identity;\n    private View view;\n    private ManagedInstance<MegaMenuBrand> megaMenuBrands;\n    private PlaceManager placeManager;\n    private AuthorizationManager authorizationManager;\n    private SessionInfo sessionInfo;\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n    private Workbench workbench;\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    Map<String, Selectable> selectableMenuItemByIdentifier = new HashMap<>();\n    Map<String, HasChildren> hasChildrenMenuItemByIdentifier = new HashMap<>();\n    Map<String, CanBeDisabled> canBeDisabledMenuItemByIdentifier = new HashMap<>();\n    Map<String, CanHide> canHideMenuItemByIdentifier = new HashMap<>();\n\n    public WorkbenchMegaMenuPresenter(final AuthorizationManager authzManager,\n                                      final PerspectiveManager perspectiveManager,\n                                      final ActivityManager activityManager,\n                                      final User identity,\n                                      final View view,\n                                      final ManagedInstance<MegaMenuBrand> megaMenuBrands,\n                                      final PlaceManager placeManager,\n                                      final AuthorizationManager authorizationManager,\n                                      final SessionInfo sessionInfo,\n                                      final ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters,\n                                      final ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters,\n                                      final ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters,\n                                      final ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters,\n                                      final Workbench workbench,\n                                      final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager) {\n        this.authzManager = authzManager;\n        this.perspectiveManager = perspectiveManager;\n        this.activityManager = activityManager;\n        this.identity = identity;\n        this.view = view;\n        this.megaMenuBrands = megaMenuBrands;\n        this.placeManager = placeManager;\n        this.authorizationManager = authorizationManager;\n        this.sessionInfo = sessionInfo;\n        this.childMenuItemPresenters = childMenuItemPresenters;\n        this.groupMenuItemPresenters = groupMenuItemPresenters;\n        this.childContextMenuItemPresenters = childContextMenuItemPresenters;\n        this.groupContextMenuItemPresenters = groupContextMenuItemPresenters;\n        this.workbench = workbench;\n        this.experimentalActivitiesAuthorizationManager = experimentalActivitiesAuthorizationManager;\n\n        setup();\n    }\n\n    void setup() {\n        view.init(this);\n        setupBrand();\n        setupHomeLink();\n    }\n\n    public IsElement getView() {\n        return this.view;\n    }\n\n    @Override\n    protected WorkbenchBaseMenuView getBaseView() {\n        return view;\n    }\n\n    @Override\n    protected void visitMenus(final Menus addedMenu) {\n        addedMenu.accept(new AuthFilterMenuVisitor(authzManager,\n                                                   identity,\n                                                   new WorkbenchMegaMenuVisitor(this,\n                                                                                perspectiveManager,\n                                                                                placeManager) {\n\n                                                       @Override\n                                                       public void visit(final MenuCustom<?> menuCustom) {\n                                                           final Object build = menuCustom.build();\n                                                           if (build instanceof IsElement) {\n                                                               addCustomMenuItem((IsElement) build,\n                                                                                 menuCustom.getPosition());\n                                                           } else if (build instanceof IsWidget) {\n                                                               addCustomMenuItem(((IsWidget) build).asWidget(),\n                                                                                 menuCustom.getPosition());\n                                                           } else {\n                                                               addMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuCustom),\n                                                                           menuCustom.getCaption(),\n                                                                           getParentId(),\n                                                                           null,\n                                                                           menuCustom.getPosition());\n                                                           }\n                                                           setupEnableDisableMenuItem(menuCustom);\n                                                       }\n                                                   }));\n\n        synchronizeUIWithMenus(addedMenu.getItems());\n    }\n\n    public void clear() {\n        view.clear();\n    }\n\n    public void addMenuItem(final String id,\n                            final String label,\n                            final String parentId,\n                            final Command command,\n                            final MenuPosition position) {\n        final ChildMenuItemPresenter childMenuItemPresenter = childMenuItemPresenters.get();\n        childMenuItemPresenter.setup(label,\n                                     command);\n        selectableMenuItemByIdentifier.put(id, childMenuItemPresenter);\n        canBeDisabledMenuItemByIdentifier.put(id, childMenuItemPresenter);\n        canHideMenuItemByIdentifier.put(id, childMenuItemPresenter);\n\n        if (parentId == null || parentId.isEmpty()) {\n            if (MenuPosition.RIGHT.equals(position)) {\n                view.addMenuItemOnRight(childMenuItemPresenter);\n            } else {\n                view.addMenuItemOnLeft(childMenuItemPresenter);\n            }\n        } else {\n            view.addMenuItemOnParent(childMenuItemPresenter,\n                                     hasChildrenMenuItemByIdentifier.get(parentId));\n        }\n    }\n\n    public void addCustomMenuItem(final IsElement menu,\n                                  final MenuPosition position) {\n        view.addCustomMenuItem(menu);\n    }\n\n    public void addCustomMenuItem(IsWidget menu,\n                                  MenuPosition position) {\n        view.addCustomMenuItem(menu);\n    }\n\n    public void addGroupMenuItem(final String id,\n                                 final String label,\n                                 final MenuPosition position) {\n        final GroupMenuItemPresenter groupMenuItemPresenter = groupMenuItemPresenters.get();\n        groupMenuItemPresenter.setup(label);\n\n        hasChildrenMenuItemByIdentifier.put(id,\n                                            groupMenuItemPresenter);\n\n        view.addGroupMenuItem(groupMenuItemPresenter);\n    }\n\n    public void selectMenuItem(final String id) {\n        final Selectable itemPresenter = selectableMenuItemByIdentifier.get(id);\n        if (itemPresenter != null) {\n            itemPresenter.select();\n        }\n    }\n\n    public void addContextMenuItem(final String menuItemId,\n                                   final String id,\n                                   final String label,\n                                   final String parentId,\n                                   final Command command,\n                                   final MenuPosition position) {\n        final ChildContextMenuItemPresenter childContextMenuItemPresenter = childContextMenuItemPresenters.get();\n        childContextMenuItemPresenter.setup(label,\n                                            command);\n        selectableMenuItemByIdentifier.put(id,\n                                           childContextMenuItemPresenter);\n        canBeDisabledMenuItemByIdentifier.put(id,\n                                              childContextMenuItemPresenter);\n        if (parentId == null || parentId.isEmpty()) {\n            if (MenuPosition.RIGHT.equals(position)) {\n                childContextMenuItemPresenter.pullRight();\n            }\n            view.addContextMenuItem(childContextMenuItemPresenter);\n        } else {\n            view.addContextMenuItemOnParent(childContextMenuItemPresenter,\n                                            hasChildrenMenuItemByIdentifier.get(parentId));\n        }\n        view.setContextMenuActive(true);\n    }\n\n    public void addContextGroupMenuItem(final String menuItemId,\n                                        final String id,\n                                        final String label,\n                                        final MenuPosition position) {\n        final GroupContextMenuItemPresenter groupContextMenuItemPresenter = groupContextMenuItemPresenters.get();\n        groupContextMenuItemPresenter.setup(label);\n\n        hasChildrenMenuItemByIdentifier.put(id,\n                                            groupContextMenuItemPresenter);\n        canBeDisabledMenuItemByIdentifier.put(id,\n                                              groupContextMenuItemPresenter);\n\n        if (MenuPosition.RIGHT.equals(position)) {\n            groupContextMenuItemPresenter.pullRight();\n        }\n\n        view.addContextMenuItem(groupContextMenuItemPresenter);\n        view.setContextMenuActive(true);\n    }\n\n    public void clearContextMenu() {\n        view.clearContextMenu();\n    }\n\n    public void enableMenuItem(final String menuItemId,\n                               final boolean enabled) {\n        final CanBeDisabled menuItem = canBeDisabledMenuItemByIdentifier.get(menuItemId);\n        if (menuItem != null) {\n            if (enabled) {\n                menuItem.enable();\n            } else {\n                menuItem.disable();\n            }\n        }\n    }\n\n    public void enableContextMenuItem(final String menuItemId,\n                                      final boolean enabled) {\n        enableMenuItem(menuItemId,\n                       enabled);\n    }\n\n    protected void addPerspectiveMenus(final PerspectiveActivity perspective) {\n        perspective.getMenus(menus -> {\n            final String perspectiveId = perspective.getIdentifier();\n            view.clearContextMenu();\n            if (menus != null) {\n                menus.accept(new AuthFilterMenuVisitor(authzManager,\n                                                       identity,\n                                                       new WorkbenchMegaMenuContextMenuVisitor(this,\n                                                                                               placeManager,\n                                                                                               perspectiveId)));\n\n                synchronizeUIWithMenus(menus.getItems());\n            }\n        });\n    }\n\n    public void onPerspectiveChange(final PerspectiveChange perspectiveChange) {\n        final Activity activity = activityManager.getActivity(perspectiveChange.getPlaceRequest());\n        if (activity != null && activity.isType(ActivityResourceType.PERSPECTIVE.name())) {\n            addPerspectiveMenus((PerspectiveActivity) activity);\n        }\n        selectMenuItem(perspectiveChange.getPlaceRequest().getIdentifier());\n    }\n\n    private void setupBrand() {\n        final String defaultMenuText = view.getDefaultMenuText();\n\n        if (megaMenuBrands.isAmbiguous()) {\n            throw new RuntimeException(\"Multiple implementations of MegaMenuBrand were provided.\");\n        }\n\n        if (!megaMenuBrands.isUnsatisfied()) {\n            final MegaMenuBrand megaMenuBrand = megaMenuBrands.get();\n\n            final String brandImageUrl = megaMenuBrand.brandImageUrl();\n            if (brandImageUrl != null && !brandImageUrl.isEmpty()) {\n                view.setBrandImage(brandImageUrl);\n\n                final String brandImageLabel = megaMenuBrand.brandImageLabel();\n                if (brandImageLabel != null && !brandImageLabel.isEmpty()) {\n                    view.setBrandImageTitle(brandImageLabel);\n                }\n            } else {\n                view.hideBrand();\n            }\n\n            final String menuAccessorLabel = megaMenuBrand.menuAccessorLabel();\n            if (menuAccessorLabel != null && !menuAccessorLabel.isEmpty()) {\n                view.setMenuAccessorText(menuAccessorLabel);\n            } else {\n                view.setMenuAccessorText(defaultMenuText);\n            }\n        } else {\n            view.hideBrand();\n            view.setMenuAccessorText(defaultMenuText);\n        }\n    }\n\n    void setupHomeLink() {\n        view.setHomeLinkAction(() -> {\n            goToHomePerspective();\n        });\n        view.setBrandImageAction(() -> {\n            goToHomePerspective();\n        });\n    }\n\n    private void goToHomePerspective() {\n        final PerspectiveActivity homePerspectiveActivity = workbench.getHomePerspectiveActivity();\n        if (homePerspectiveActivity != null) {\n            final String homePerspectiveIdentifier = homePerspectiveActivity.getIdentifier();\n            if (hasAccessToPerspective(homePerspectiveIdentifier)) {\n                placeManager.goTo(homePerspectiveIdentifier);\n            }\n        }\n    }\n\n    boolean hasAccessToPerspective(final String perspectiveId) {\n        ResourceRef resourceRef = new ResourceRef(perspectiveId,\n                                                  ActivityResourceType.PERSPECTIVE);\n        return authorizationManager.authorize(resourceRef,\n                                              sessionInfo.getIdentity());\n    }\n\n    public void setupSetVisibleMenuItem(MenuItemPerspective menuItemPerspective) {\n        String perspectiveId = menuItemPerspective.getPlaceRequest().getIdentifier();\n        boolean visible = experimentalActivitiesAuthorizationManager.authorizeActivityId(perspectiveId);\n\n        changeMenuItemVisibility(perspectiveId, visible);\n\n        registerVisibilityChangeHandler(new MenuItemVisibilityHandler(perspectiveId, this::changeMenuItemVisibility));\n    }\n\n    private void changeMenuItemVisibility(String id, boolean visible) {\n        CanHide canHide = canHideMenuItemByIdentifier.get(id);\n        if (canHide != null) {\n            if (visible) {\n                canHide.show();\n            } else {\n                canHide.hide();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.widgets.menu.AbstractWorkbenchMenuProducer;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\n\n@ApplicationScoped\npublic class WorkbenchMegaMenuProducer extends AbstractWorkbenchMenuProducer<WorkbenchMegaMenuPresenter, WorkbenchMegaMenuPresenter.View> {\n\n    private ManagedInstance<MegaMenuBrand> megaMenuBrands;\n    private AuthorizationManager authorizationManager;\n    private SessionInfo sessionInfo;\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n    private Workbench workbench;\n\n    public WorkbenchMegaMenuProducer() {\n        //CDI proxy\n    }\n\n    @Inject\n    public WorkbenchMegaMenuProducer(final AuthorizationManager authzManager,\n                                     final PerspectiveManager perspectiveManager,\n                                     final ActivityManager activityManager,\n                                     final User identity,\n                                     final WorkbenchMegaMenuPresenter.View view,\n                                     final ManagedInstance<MegaMenuBrand> megaMenuBrands,\n                                     final PlaceManager placeManager,\n                                     final AuthorizationManager authorizationManager,\n                                     final SessionInfo sessionInfo,\n                                     final ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters,\n                                     final ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters,\n                                     final ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters,\n                                     final ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters,\n                                     final Workbench workbench,\n                                     final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager) {\n        super(authzManager, perspectiveManager, placeManager, activityManager, identity, experimentalActivitiesAuthorizationManager, view);\n        this.authorizationManager = authorizationManager;\n        this.megaMenuBrands = megaMenuBrands;\n        this.placeManager = placeManager;\n        this.sessionInfo = sessionInfo;\n        this.childMenuItemPresenters = childMenuItemPresenters;\n        this.groupMenuItemPresenters = groupMenuItemPresenters;\n        this.childContextMenuItemPresenters = childContextMenuItemPresenters;\n        this.groupContextMenuItemPresenters = groupContextMenuItemPresenters;\n        this.workbench = workbench;\n        this.experimentalActivitiesAuthorizationManager = experimentalActivitiesAuthorizationManager;\n    }\n\n\n    @Produces\n    public WorkbenchMegaMenuPresenter getInstance() {\n        return getWorbenchMenu();\n    }\n\n    @Override\n    protected WorkbenchMegaMenuPresenter makeDefaultPresenter() {\n        return new WorkbenchMegaMenuPresenter(authzManager,\n                                              perspectiveManager,\n                                              activityManager,\n                                              identity,\n                                              view,\n                                              megaMenuBrands,\n                                              placeManager,\n                                              authorizationManager,\n                                              sessionInfo,\n                                              childMenuItemPresenters,\n                                              groupMenuItemPresenters,\n                                              childContextMenuItemPresenters,\n                                              groupContextMenuItemPresenters,\n                                              workbench,\n                                              experimentalActivitiesAuthorizationManager);\n    }\n\n    @Override\n    protected WorkbenchMegaMenuStandalonePresenter makeStandalonePresenter() {\n        return new WorkbenchMegaMenuStandalonePresenter(authzManager,\n                                                        perspectiveManager,\n                                                        activityManager,\n                                                        identity,\n                                                        view,\n                                                        megaMenuBrands,\n                                                        placeManager,\n                                                        authorizationManager,\n                                                        sessionInfo,\n                                                        childMenuItemPresenters,\n                                                        groupMenuItemPresenters,\n                                                        childContextMenuItemPresenters,\n                                                        groupContextMenuItemPresenters,\n                                                        workbench,\n                                                        experimentalActivitiesAuthorizationManager);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuStandalonePresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.Menus;\n\npublic class WorkbenchMegaMenuStandalonePresenter extends WorkbenchMegaMenuPresenter {\n\n    @Inject\n    WorkbenchMegaMenuStandalonePresenter(final AuthorizationManager authzManager,\n                                         final PerspectiveManager perspectiveManager,\n                                         final ActivityManager activityManager,\n                                         final User identity,\n                                         final View view,\n                                         final ManagedInstance<MegaMenuBrand> megaMenuBrands,\n                                         final PlaceManager placeManager,\n                                         final AuthorizationManager authorizationManager,\n                                         final SessionInfo sessionInfo,\n                                         final ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters,\n                                         final ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters,\n                                         final ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters,\n                                         final ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters,\n                                         final Workbench workbench,\n                                         final ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager) {\n        super(authzManager,\n              perspectiveManager,\n              activityManager,\n              identity,\n              view,\n              megaMenuBrands,\n              placeManager,\n              authorizationManager,\n              sessionInfo,\n              childMenuItemPresenters,\n              groupMenuItemPresenters,\n              childContextMenuItemPresenters,\n              groupContextMenuItemPresenters,\n              workbench,\n              experimentalActivitiesAuthorizationManager);\n    }\n\n    @Override\n    public void addMenus(final Menus menus) {\n        //Do nothing. Standalone mode does not use top-level menu items.\n    }\n\n    @Override\n    protected void addPerspectiveMenus(final PerspectiveActivity perspective) {\n        perspective.getMenus(super::addMenus);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/base/BaseMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.base;\n\nimport org.jboss.errai.common.client.api.IsElement;\n\npublic interface BaseMenuItemPresenter {\n\n    IsElement getView();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/base/CanBeDisabled.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.base;\n\npublic interface CanBeDisabled extends BaseMenuItemPresenter {\n\n    void enable();\n\n    void disable();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/base/CanHide.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.base;\n\npublic interface CanHide {\n\n    void show();\n\n    void hide();\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/base/HasChildren.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.base;\n\nimport org.jboss.errai.common.client.api.IsElement;\n\npublic interface HasChildren extends BaseMenuItemPresenter {\n\n    void addChild(IsElement element);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/base/Selectable.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.base;\n\npublic interface Selectable extends BaseMenuItemPresenter {\n\n    void select();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/brand/MegaMenuBrand.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.brand;\n\n/**\n * Implement this to define some customizations on the Mega Menu header.\n */\npublic interface MegaMenuBrand {\n\n    /**\n     * Defines the image to be shown on the left side of the mega menu header.\n     * If not provided, none will be used.\n     * @return URL to the logo image. Null or empty value if none should be used.\n     */\n    String brandImageUrl();\n\n    /**\n     * Defines the text shown when the mouse goes over the logo image.\n     * @return Text to be shown. Null or empty value if none should be used.\n     */\n    String brandImageLabel();\n\n    /**\n     * Defines the label of the dropdown button that shows the mega menu.\n     * If not provided, \"Menu\" will be used.\n     * @return Label of the dropdown button. Null or empty value if the default value\n     * should be used.\n     */\n    String menuAccessorLabel();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/contextmenuitem/ChildContextMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.Selectable;\nimport org.uberfire.mvp.Command;\n\npublic class ChildContextMenuItemPresenter implements BaseMenuItemPresenter,\n                                                      Selectable,\n                                                      CanBeDisabled {\n\n    public interface View extends UberElement<ChildContextMenuItemPresenter> {\n\n        void setLabel(String label);\n\n        void setCommand(Command command);\n\n        void enable();\n\n        void disable();\n\n        void pullRight();\n\n        void select();\n    }\n\n    private View view;\n\n    private Command command;\n\n    @Inject\n    public ChildContextMenuItemPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String label,\n                      final Command command) {\n        this.command = command;\n\n        view.setLabel(label);\n        view.setCommand(command);\n    }\n\n    @Override\n    public void select() {\n        view.select();\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void enable() {\n        view.enable();\n    }\n\n    @Override\n    public void disable() {\n        view.disable();\n    }\n\n    public void pullRight() {\n        view.pullRight();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/contextmenuitem/GroupContextMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.HasChildren;\n\npublic class GroupContextMenuItemPresenter implements BaseMenuItemPresenter,\n                                                      HasChildren,\n                                                      CanBeDisabled {\n\n    public interface View extends UberElement<GroupContextMenuItemPresenter> {\n\n        void setLabel(String label);\n\n        void addItem(IsElement item);\n\n        void enable();\n\n        void disable();\n\n        void pullRight();\n    }\n\n    private View view;\n\n    @Inject\n    public GroupContextMenuItemPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String label) {\n        view.setLabel(label);\n    }\n\n    @Override\n    public void addChild(final IsElement item) {\n        view.addItem(item);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void enable() {\n        view.enable();\n    }\n\n    @Override\n    public void disable() {\n        view.disable();\n    }\n\n    public void pullRight() {\n        view.pullRight();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/ChildMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanHide;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.Selectable;\nimport org.uberfire.mvp.Command;\n\npublic class ChildMenuItemPresenter implements BaseMenuItemPresenter,\n                                               Selectable,\n                                               CanBeDisabled,\n                                               CanHide {\n\n    public interface View extends UberElement<ChildMenuItemPresenter> {\n\n        void setLabel(String label);\n\n        void setCommand(Command command);\n\n        void enable();\n\n        void disable();\n\n        void select();\n\n        void setVisible(boolean visible);\n    }\n\n    private View view;\n\n    private Command command;\n\n    @Inject\n    public ChildMenuItemPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String label,\n                      final Command command) {\n        this.command = command;\n\n        view.setLabel(label);\n        view.setCommand(command);\n    }\n\n    @Override\n    public void select() {\n        view.select();\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void enable() {\n        view.enable();\n    }\n\n    @Override\n    public void disable() {\n        view.disable();\n    }\n\n    @Override\n    public void show() {\n        view.setVisible(true);\n    }\n\n    @Override\n    public void hide() {\n        view.setVisible(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/GroupMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.HasChildren;\n\npublic class GroupMenuItemPresenter implements BaseMenuItemPresenter,\n                                               HasChildren {\n\n    public interface View extends UberElement<GroupMenuItemPresenter> {\n\n        void setLabel(String label);\n\n        void addItem(IsElement item);\n    }\n\n    private View view;\n\n    @Inject\n    public GroupMenuItemPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String label) {\n        view.setLabel(label);\n    }\n\n    @Override\n    public void addChild(final IsElement item) {\n        view.addItem(item);\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/IconMenuItemPresenter.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.uberfire.client.mvp.UberElement;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.Selectable;\nimport org.uberfire.mvp.Command;\n\npublic class IconMenuItemPresenter implements BaseMenuItemPresenter,\n                                              Selectable,\n                                              CanBeDisabled {\n\n    public interface View extends UberElement<IconMenuItemPresenter> {\n\n        void setIconClass(String iconClass);\n\n        void setLabel(String label);\n\n        void setCommand(Command command);\n\n        void enable();\n\n        void disable();\n\n        void select();\n    }\n\n    private View view;\n\n    private Command command;\n\n    @Inject\n    public IconMenuItemPresenter(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void setup(final String iconClass,\n                      final String label,\n                      final Command command) {\n        this.command = command;\n\n        view.setIconClass(iconClass);\n        view.setLabel(label);\n        view.setCommand(command);\n    }\n\n    @Override\n    public void select() {\n        view.select();\n    }\n\n    @Override\n    public View getView() {\n        return view;\n    }\n\n    @Override\n    public void enable() {\n        view.enable();\n    }\n\n    @Override\n    public void disable() {\n        view.disable();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/visitor/WorkbenchMegaMenuContextMenuVisitor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.visitor;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuUtils;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.WorkbenchMegaMenuPresenter;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\npublic class WorkbenchMegaMenuContextMenuVisitor extends BaseMenuVisitor {\n\n    private WorkbenchMegaMenuPresenter presenter;\n\n    private PlaceManager placeManager;\n\n    private String perspectiveId;\n\n    private String parentId = null;\n\n    public WorkbenchMegaMenuContextMenuVisitor(final WorkbenchMegaMenuPresenter presenter,\n                                               final PlaceManager placeManager,\n                                               final String perspectiveId) {\n        this.presenter = presenter;\n        this.placeManager = placeManager;\n        this.perspectiveId = perspectiveId;\n    }\n\n    @Override\n    public boolean visitEnter(final MenuGroup menuGroup) {\n        parentId = WorkbenchBaseMenuUtils.getMenuItemId(menuGroup);\n        presenter.addContextGroupMenuItem(perspectiveId,\n                                          parentId,\n                                          menuGroup.getCaption(),\n                                          menuGroup.getPosition());\n        return true;\n    }\n\n    @Override\n    public void visitLeave(MenuGroup menuGroup) {\n        parentId = null;\n    }\n\n    @Override\n    public void visit(final MenuItemPlain menuItemPlain) {\n        presenter.addContextMenuItem(perspectiveId,\n                                     WorkbenchBaseMenuUtils.getMenuItemId(menuItemPlain),\n                                     menuItemPlain.getCaption(),\n                                     parentId,\n                                     null,\n                                     menuItemPlain.getPosition());\n        setupEnableDisableContextMenuItem(menuItemPlain);\n    }\n\n    @Override\n    public void visit(final MenuCustom<?> menuCustom) {\n        presenter.addContextMenuItem(perspectiveId,\n                                     WorkbenchBaseMenuUtils.getMenuItemId(menuCustom),\n                                     menuCustom.getCaption(),\n                                     parentId,\n                                     null,\n                                     menuCustom.getPosition());\n        setupEnableDisableContextMenuItem(menuCustom);\n    }\n\n    @Override\n    public void visit(final MenuItemCommand menuItemCommand) {\n        presenter.addContextMenuItem(perspectiveId,\n                                     WorkbenchBaseMenuUtils.getMenuItemId(menuItemCommand),\n                                     menuItemCommand.getCaption(),\n                                     parentId,\n                                     menuItemCommand.getCommand(),\n                                     menuItemCommand.getPosition());\n        setupEnableDisableContextMenuItem(menuItemCommand);\n    }\n\n    @Override\n    public void visit(final MenuItemPerspective menuItemPerspective) {\n        presenter.addContextMenuItem(perspectiveId,\n                                     menuItemPerspective.getPlaceRequest().getIdentifier(),\n                                     menuItemPerspective.getCaption(),\n                                     parentId,\n                                     () -> placeManager.goTo(menuItemPerspective.getPlaceRequest()),\n                                     menuItemPerspective.getPosition());\n        setupEnableDisableContextMenuItem(menuItemPerspective);\n        presenter.setupSetVisibleMenuItem(menuItemPerspective);\n    }\n\n    private void setupEnableDisableContextMenuItem(final MenuItem menuItem) {\n        menuItem.addEnabledStateChangeListener(enabled -> presenter.enableContextMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuItem),\n                                                                                          enabled));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/menu/megamenu/visitor/WorkbenchMegaMenuVisitor.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.visitor;\n\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.menu.base.WorkbenchBaseMenuUtils;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.WorkbenchMegaMenuPresenter;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\npublic class WorkbenchMegaMenuVisitor extends BaseMenuVisitor {\n\n    private WorkbenchMegaMenuPresenter presenter;\n\n    private PerspectiveManager perspectiveManager;\n\n    private PlaceManager placeManager;\n\n    private String parentId = null;\n\n    public WorkbenchMegaMenuVisitor(final WorkbenchMegaMenuPresenter presenter,\n                                    final PerspectiveManager perspectiveManager,\n                                    final PlaceManager placeManager) {\n        this.presenter = presenter;\n        this.perspectiveManager = perspectiveManager;\n        this.placeManager = placeManager;\n    }\n\n    @Override\n    public boolean visitEnter(final MenuGroup menuGroup) {\n        parentId = WorkbenchBaseMenuUtils.getMenuItemId(menuGroup);\n        presenter.addGroupMenuItem(parentId,\n                                   menuGroup.getCaption(),\n                                   menuGroup.getPosition());\n        return true;\n    }\n\n    @Override\n    public void visitLeave(MenuGroup menuGroup) {\n        parentId = null;\n    }\n\n    @Override\n    public void visit(final MenuItemPlain menuItemPlain) {\n        presenter.addMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuItemPlain),\n                              menuItemPlain.getCaption(),\n                              parentId,\n                              null,\n                              menuItemPlain.getPosition());\n        setupEnableDisableMenuItem(menuItemPlain);\n    }\n\n    @Override\n    public void visit(final MenuCustom<?> menuCustom) {\n        presenter.addMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuCustom),\n                              menuCustom.getCaption(),\n                              parentId,\n                              null,\n                              menuCustom.getPosition());\n\n        setupEnableDisableMenuItem(menuCustom);\n    }\n\n    @Override\n    public void visit(final MenuItemCommand menuItemCommand) {\n        presenter.addMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuItemCommand),\n                              menuItemCommand.getCaption(),\n                              parentId,\n                              menuItemCommand.getCommand(),\n                              menuItemCommand.getPosition());\n        setupEnableDisableMenuItem(menuItemCommand);\n    }\n\n    @Override\n    public void visit(final MenuItemPerspective menuItemPerspective) {\n        final String id = menuItemPerspective.getPlaceRequest().getIdentifier();\n        presenter.addMenuItem(id,\n                              menuItemPerspective.getCaption(),\n                              parentId,\n                              () -> placeManager.goTo(menuItemPerspective.getPlaceRequest()),\n                              menuItemPerspective.getPosition());\n        setupEnableDisableMenuItem(menuItemPerspective);\n        presenter.setupSetVisibleMenuItem(menuItemPerspective);\n        final PlaceRequest placeRequest = menuItemPerspective.getPlaceRequest();\n        if (perspectiveManager.getCurrentPerspective() != null && placeRequest.equals(perspectiveManager.getCurrentPerspective().getPlace())) {\n            presenter.selectMenuItem(id);\n        }\n    }\n\n    protected String getParentId() {\n        return parentId;\n    }\n\n    protected void setParentId(String parentId) {\n        this.parentId = parentId;\n    }\n\n    protected void setupEnableDisableMenuItem(final MenuItem menuItem) {\n        menuItem.addEnabledStateChangeListener(enabled -> presenter.enableMenuItem(WorkbenchBaseMenuUtils.getMenuItemId(menuItem),\n                                                                                   enabled));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/multipage/MultiPageEditor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.multipage;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface MultiPageEditor extends IsWidget {\n\n    void addPage(final Page page);\n\n    void addPage(int index, final Page page);\n\n    void disablePage(int index);\n\n    void enablePage(int index);\n\n    void selectPage(final int index);\n\n    int selectedPage();\n\n    MultiPageEditorView getView();\n\n    void addWidget(final IsWidget widget,\n                   final String label);\n\n    void clear();\n\n    void addTabBarWidget(final IsWidget customWidget);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/multipage/MultiPageEditorView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.multipage;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface MultiPageEditorView extends IsWidget {\n\n    void clear();\n\n    void addPage(final int index, final Page page);\n\n    void disablePage(final int index);\n\n    void enablePage(final int index);\n\n    /**\n     * Returns index of the editor page with 'title'\n     * @param title of the page (Model, Overview ...)\n     * @return index, starting from 0\n     * @throws IllegalArgumentException if the 'title' is not found\n     */\n    int getPageIndex(final String title);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/multipage/Multiple.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.multipage;\n\nimport java.lang.annotation.Retention;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\npublic @interface Multiple {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/multipage/Page.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.multipage;\n\npublic interface Page {\n\n    String getLabel();\n\n    void onFocus();\n\n    void onLostFocus();\n\n    PageView getView();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/multipage/PageView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.multipage;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\npublic interface PageView extends IsWidget {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notfound/ActivityNotFoundPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.notfound;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\n\n@ApplicationScoped\n@Named(\"uf.workbench.activity.notfound\")\npublic class ActivityNotFoundPresenter extends AbstractPopupActivity {\n\n    @Inject\n    private View view;\n    @Inject\n    private PlaceManager placeManager;\n\n    @Inject\n    //Constructor injection for testing\n    public ActivityNotFoundPresenter(final PlaceManager placeManager,\n                                     PopupView popupView) {\n        super(placeManager,\n              popupView);\n    }\n\n    @Override\n    public String getTitle() {\n        return \"Activity not found\";\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        final String identifier = place.getParameter(\"requestedPlaceIdentifier\",\n                                                     null);\n        view.setRequestedPlaceIdentifier(identifier);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"uf.workbench.activity.notfound\";\n    }\n\n    @Override\n    public WorkbenchPopupSize getSize() {\n        return WorkbenchPopupSize.MEDIUM;\n    }\n\n    public void close() {\n        placeManager.closePlace(this.place);\n    }\n\n    public interface View extends UberView<ActivityNotFoundPresenter> {\n\n        void setRequestedPlaceIdentifier(final String requestedPlaceIdentifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/notifications/NotificationManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.notifications;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchActivity;\nimport org.uberfire.client.workbench.WorkbenchLayoutInfo;\nimport org.uberfire.client.workbench.events.ClosePlaceEvent;\nimport org.uberfire.client.workbench.events.PlaceLostFocusEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n/**\n * Observes all notification events, and coordinates their display and removal.\n */\n@ApplicationScoped\npublic class NotificationManager {\n\n    private final Map<PlaceRequest, View> notificationsContainerViewMap = new HashMap<PlaceRequest, View>();\n    private final PlaceRequest rootPlaceRequest = new DefaultPlaceRequest(\"org.uberfire.client.workbench.widgets.notifications.root\");\n    private SyncBeanManager iocManager;\n    private PlaceManager placeManager;\n    private WorkbenchLayoutInfo workbenchLayoutInfo;\n\n    public NotificationManager() {\n    }\n\n    @Inject\n    public NotificationManager(final SyncBeanManager iocManager,\n                               final PlaceManager placeManager,\n                               final WorkbenchLayoutInfo workbenchLayoutInfo) {\n        this.iocManager = iocManager;\n        this.placeManager = placeManager;\n        this.workbenchLayoutInfo = workbenchLayoutInfo;\n    }\n\n    /**\n     * Adds a new notification message to the system, asking the notification presenter to display it, and storing it in\n     * the list of existing notifications. This method can be invoked directly, or it can be invoked indirectly by\n     * firing a CDI {@link NotificationEvent}.\n     *\n     * @param event The notification to display and store in the notification system.\n     */\n    public void addNotification(@Observes final NotificationEvent event) {\n        //If an explicit container has not been specified use the RootPanel\n        PlaceRequest placeRequest = event.getPlaceRequest();\n        IsWidget notificationsContainer = RootPanel.get();\n        if (placeRequest == null) {\n            placeRequest = rootPlaceRequest;\n        } else {\n            final Activity activity = placeManager.getActivity(placeRequest);\n            if (activity instanceof WorkbenchActivity) {\n                notificationsContainer = ((WorkbenchActivity) activity).getWidget();\n            }\n        }\n\n        //Lookup, or create, a View specific to the container\n        View notificationsContainerView = notificationsContainerViewMap.get(placeRequest);\n        if (notificationsContainerView == null) {\n            final SyncBeanDef<View> containerViewBeanDef = iocManager.lookupBean(View.class);\n            if (containerViewBeanDef != null) {\n                notificationsContainerView = containerViewBeanDef.getInstance();\n                notificationsContainerView.setContainer(notificationsContainer);\n\n                if (event.getInitialTopOffset() != null) {\n                    notificationsContainerView.setInitialSpacing(event.getInitialTopOffset());\n                } else {\n                    notificationsContainerView.setInitialSpacing(workbenchLayoutInfo.getHeaderHeight());\n                }\n\n                notificationsContainerViewMap.put(placeRequest,\n                                                  notificationsContainerView);\n            }\n        }\n        if (notificationsContainerView == null) {\n            return;\n        }\n\n        //Show notification in the container\n        if (!event.isSingleton() || !notificationsContainerView.isShowing(event)) {\n            HideNotificationCommand hideCommand = new HideNotificationCommand(notificationsContainerView);\n            NotificationPopupHandle handle = notificationsContainerView.show(event,\n                                                                             hideCommand);\n            hideCommand.setHandle(handle);\n        }\n    }\n\n    //Clean-up container map when an Activity closes; in the absence of a WeakHashMap in JavaScript\n    public void onClosePlaceEvent(@Observes final ClosePlaceEvent event) {\n        final PlaceRequest placeRequest = event.getPlace();\n        if (placeRequest == null) {\n            return;\n        }\n\n        final View view = notificationsContainerViewMap.remove(placeRequest);\n        if (view != null) {\n            view.hideAll();\n        }\n    }\n\n    public void onPlaceLostFocus(@Observes final PlaceLostFocusEvent event) {\n        final View view = notificationsContainerViewMap.get(event.getPlace());\n        if (view != null) {\n            view.hideAll();\n        }\n    }\n\n    public interface NotificationPopupHandle {\n\n    }\n\n    /**\n     * The view contract for the UI that shows and hides active notifications.\n     */\n    public interface View {\n\n        /**\n         * Set the container relative to which Notifications are to be shown. This should be called before\n         * either {@link #show(NotificationEvent, Command)} or {@link #hide(NotificationPopupHandle)}\n         * and must be passed a non-null value.\n         *\n         * @param container The container relative to which Notifications will be shown. Must not be null.\n         */\n        void setContainer(final IsWidget container);\n\n        /**\n         * Configures the initial vertical spacing for the first notifications\n         * (see {@link NotificationEvent#getInitialTopOffset()}). A default value is\n         * used if this method is never invoked.\n         *\n         * @param spacing the vertical spacing in number of pixels\n         */\n        void setInitialSpacing(int spacing);\n\n        /**\n         * Displays a notification with the given severity and contents.\n         *\n         * @param event       The notification event. Must not be null.\n         * @param hideCommand The command that must be called when the notification is to be closed. When this command is\n         *                    invoked, the notification manager will change the notification status from active to acknowledged,\n         *                    and it will invoke the {@link #hide(NotificationPopupHandle)} method with the notification handle\n         *                    that this method call returned.\n         * @return The object to pass to {@link #hide(NotificationPopupHandle)} that will hide this notification. Must\n         * not return null.\n         */\n        NotificationPopupHandle show(final NotificationEvent event,\n                                     final Command hideCommand);\n\n        /**\n         * Hides the active notification identified by the given popup handle. This call is made when a notification\n         * changes state from \"new\" to \"acknowledged.\" Once this call is made, the notification is still in the system,\n         * but it should not be displayed as a new notification anymore. As an analogy, if the notification was an\n         * email, this call would mark it as read.\n         *\n         * @param popup The handle for the active notification that should be hidden.\n         */\n        void hide(final NotificationPopupHandle popup);\n\n        /**\n         * Hides all active notifications.\n         */\n        void hideAll();\n\n        /**\n         * Checks whether the given event is currently being shown.\n         *\n         * @param event The notification event. Must not be null.\n         * @return true if shown\n         */\n        boolean isShowing(final NotificationEvent event);\n    }\n\n    private class HideNotificationCommand implements Command {\n\n        private final View notificationContainerView;\n        private NotificationPopupHandle handle;\n\n        HideNotificationCommand(final View notificationContainerView) {\n            this.notificationContainerView = PortablePreconditions.checkNotNull(\"notificationContainerView\",\n                                                                                notificationContainerView);\n        }\n\n        @Override\n        public void execute() {\n            if (handle == null) {\n                throw new IllegalStateException(\"The show() method hasn't returned a handle yet!\");\n            }\n            notificationContainerView.hide(handle);\n        }\n\n        void setHandle(NotificationPopupHandle handle) {\n            this.handle = handle;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/panel/ContextPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.panel;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.resources.WorkbenchResources;\n\npublic class ContextPanel extends Composite {\n\n    private final FlowPanel container = new FlowPanel();\n    boolean isVisible = false;\n    private Widget widget;\n    private String style;\n    private UIPart uiPart;\n\n    public ContextPanel() {\n        initWidget(container);\n    }\n\n    public void toogleDisplay() {\n        if (widget == null) {\n            return;\n        }\n        if (isVisible) {\n            widget.getElement().addClassName(style);\n            widget.getElement().removeClassName(WorkbenchResources.INSTANCE.CSS().showContext());\n            isVisible = false;\n        } else {\n            widget.getElement().removeClassName(style);\n            widget.getElement().addClassName(WorkbenchResources.INSTANCE.CSS().showContext());\n            isVisible = true;\n        }\n    }\n\n    public UIPart getUiPart() {\n        return uiPart;\n    }\n\n    public void setUiPart(final UIPart uiPart) {\n        if (uiPart != null) {\n            this.uiPart = uiPart;\n            this.widget = uiPart.getWidget().asWidget();\n            this.widget.getElement().getStyle().setFloat(Style.Float.LEFT);\n            this.widget.getElement().getStyle().setOverflow(Style.Overflow.HIDDEN);\n            this.style = this.widget.getElement().getClassName();\n\n            container.clear();\n            container.add(widget);\n        } else {\n            this.uiPart = null;\n            this.widget = null;\n            this.style = null;\n            container.clear();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/panel/RequiresResizeFlowPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.panel;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\n\npublic class RequiresResizeFlowPanel\n        extends FlowPanel\n        implements RequiresResize {\n\n    @Override\n    public void onResize() {\n        for (int i = 0; i < getWidgetCount(); i++) {\n            final Widget activeWidget = getWidget(i);\n            if (activeWidget instanceof RequiresResize) {\n                ((RequiresResize) activeWidget).onResize();\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/panel/RequiresResizeFocusPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.panel;\n\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\n\npublic class RequiresResizeFocusPanel\n        extends FocusPanel\n        implements RequiresResize {\n\n    @Override\n    public void onResize() {\n        if (getWidget() instanceof RequiresResize) {\n            ((RequiresResize) getWidget()).onResize();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/panel/StaticFocusedResizePanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.panel;\n\nimport com.google.gwt.event.dom.client.FocusHandler;\nimport com.google.gwt.event.dom.client.HasFocusHandlers;\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.ResizeComposite;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.workbench.model.PartDefinition;\n\npublic class StaticFocusedResizePanel\n        extends ResizeComposite\n        implements HasSelectionHandlers<PartDefinition>,\n                   HasFocusHandlers {\n\n    private final RequiresResizeFocusPanel container = new RequiresResizeFocusPanel();\n\n    private PartDefinition partDefinition;\n\n    public StaticFocusedResizePanel() {\n        initWidget(container);\n        container.addClickHandler(event -> {\n            if (partDefinition != null) {\n                SelectionEvent.fire(StaticFocusedResizePanel.this,\n                                    partDefinition);\n            }\n        });\n        container.getElement().addClassName(CSSLocatorsUtils.buildLocator(\"qe\", \"static-workbench-panel-view\"));\n    }\n\n    public void setPart(final WorkbenchPartPresenter.View part) {\n        this.partDefinition = part.getPresenter().getDefinition();\n        container.setWidget(part);\n    }\n\n    public void clear() {\n        partDefinition = null;\n        container.clear();\n    }\n\n    public void setFocus(boolean hasFocus) {\n        if (hasFocus) {\n            //style\n        } else {\n            //style\n        }\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addFocusHandler(FocusHandler handler) {\n        return container.addFocusHandler(handler);\n    }\n\n    public WorkbenchPartPresenter.View getPartView() {\n        return (WorkbenchPartPresenter.View) container.getWidget();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/popup/PopupView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.popup;\n\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport org.uberfire.client.mvp.PopupActivity;\n\n/**\n * API contract for the view container of {@link PopupActivity} activities. Implementations of this class must be\n * Dependent-scoped CDI beans.\n * <p>\n * Each application must have exactly one implementation of this interface in the classpath at compile time. Normally\n * this implementation will be part of a view module.\n */\npublic interface PopupView extends HasCloseHandlers<PopupView> {\n\n    /**\n     * Sets the main content of this popup dialog, replacing any content that was previously set.\n     * @param widget the content to add. Must not be null.\n     */\n    void setContent(final IsWidget widget);\n\n    /**\n     * Sets the title text for this popup's dialog. Usually, the view will put this in a large font above the\n     * main content.\n     * @param title The title text for the popup container.\n     */\n    void setTitle(final String title);\n\n    /**\n     * Sets the size for the popup.\n     * @param size The popup size\n     */\n    void setSize(final WorkbenchPopupSize size);\n\n    /**\n     * Makes this popup container (and the main content along with it) visible on the workbench. Has no effect if this\n     * popup is already visible.\n     */\n    void show();\n\n    /**\n     * Makes this popup container(and the main content along with it) invisible. Has no effect if the popup is not\n     * already showing.\n     */\n    void hide();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/splash/SplashView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.splash;\n\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.SplashScreenActivity;\n\n/**\n * API Contract for the view container of {@link SplashScreenActivity} activities.\n */\npublic interface SplashView extends HasCloseHandlers<SplashView> {\n\n    /**\n     * Sets the contents for this splash screen view, replacing any contents that were there already.\n     * @param widget The widget to display in the body area of the splash screen dialog.\n     * @param height The height to give the content area in the splash screen dialog.\n     */\n    public void setContent(final IsWidget widget,\n                           final Integer height);\n\n    /**\n     * Sets the title text for this splash screen's popup. Usually, the view will put this in a large font above the\n     * main content.\n     * @param title The title text for the splash screen's popup container.\n     */\n    public void setTitle(final String title);\n\n    /**\n     * Returns true if the user has indicated that they want to see this splash screen next time its interceptor says it\n     * should be displayed.\n     * @return true if the user has indicated that they want to see this splash screen next time it could be displayed;\n     * false if the user has indicated they do not want to see this splash screen next time; null if the user\n     * has not yet made a decision either way. The framework will keep the existing \"show again\" preference if\n     * this method returns null.\n     */\n    public Boolean showAgain();\n\n    /**\n     * Makes this splash screen container (and the main content along with it) visible on the workbench. Has no effect\n     * if this splash screen is already visible.\n     */\n    public void show();\n\n    /**\n     * Makes this splash screen container(and the main content along with it) invisible. Has no effect if the splash\n     * screen is not already showing.\n     */\n    public void hide();\n\n    public boolean isAttached();\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/split/WorkbenchSplitLayoutPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.split;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.core.client.Scheduler.ScheduledCommand;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Position;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.SplitLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel;\nimport org.uberfire.workbench.model.CompassPosition;\n\n/**\n * A panel that adds user-positioned splitters between each of its child\n * widgets.\n * <p>\n * This is a fork of the standard SplitLayoutPanel with the following changes:-\n * <ol>\n * <li>http://code.google.com/p/google-web-toolkit/issues/detail?id=7135</li>\n * </ol>\n * </p>\n * <p>\n * This panel is used in the same way as {@link DockLayoutPanel}, except that\n * its children's sizes are always specified in {@link Unit#PX} units, and each\n * pair of child widgets has a splitter between them that the user can drag.\n * </p>\n * <p>\n * This widget will <em>only</em> work in standards mode, which requires that\n * the HTML page in which it is run have an explicit &lt;!DOCTYPE&gt;\n * declaration.\n * </p>\n * <h3>CSS Style Rules</h3>\n * <ul class='css'>\n * <li>.gwt-SplitLayoutPanel { the panel itself }</li>\n * <li>.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-HDragger { horizontal dragger\n * }</li>\n * <li>.gwt-SplitLayoutPanel .gwt-SplitLayoutPanel-VDragger { vertical dragger }\n * </li>\n * </ul>\n * <p>\n * <h3>Example</h3> {@example com.google.gwt.examples.SplitLayoutPanelExample}\n * </p>\n */\npublic class WorkbenchSplitLayoutPanel extends DockLayoutPanel {\n\n    private static final int DEFAULT_SPLITTER_SIZE = 1;\n    private static final int DEFAULT_SPLITTER_HOVER_SIZE = 10;\n    /**\n     * The element that masks the screen so we can catch mouse events over\n     * iframes.\n     */\n    private static Element glassElem = null;\n    private final int splitterSize;\n    private int minCenterSize = 0;\n\n    /**\n     * Construct a new {@link SplitLayoutPanel} with the default splitter size\n     * of 8px.\n     */\n    public WorkbenchSplitLayoutPanel() {\n        this(DEFAULT_SPLITTER_SIZE);\n    }\n\n    /**\n     * Construct a new {@link SplitLayoutPanel} with the specified splitter size\n     * in pixels.\n     * @param splitterSize the size of the splitter in pixels\n     */\n    public WorkbenchSplitLayoutPanel(int splitterSize) {\n        super(Unit.PX);\n        this.splitterSize = splitterSize;\n        setStyleName(WorkbenchResources.INSTANCE.CSS().splitLayoutPanel());\n\n        if (glassElem == null) {\n            glassElem = Document.get().createDivElement();\n            glassElem.getStyle().setPosition(Position.ABSOLUTE);\n            glassElem.getStyle().setTop(0,\n                                        Unit.PX);\n            glassElem.getStyle().setLeft(0,\n                                         Unit.PX);\n            glassElem.getStyle().setMargin(0,\n                                           Unit.PX);\n            glassElem.getStyle().setPadding(0,\n                                            Unit.PX);\n            glassElem.getStyle().setBorderWidth(0,\n                                                Unit.PX);\n\n            // We need to set the background color or mouse events will go right\n            // through the glassElem. If the SplitPanel contains an iframe, the\n            // iframe will capture the event and the slider will stop moving.\n            glassElem.getStyle().setProperty(\"background\",\n                                             \"white\");\n            glassElem.getStyle().setOpacity(0.0);\n        }\n    }\n\n    /**\n     * Return the size of the splitter in pixels.\n     * @return the splitter size\n     */\n    public int getSplitterSize() {\n        return splitterSize;\n    }\n\n    @Override\n    public void insert(Widget child,\n                       Direction direction,\n                       double size,\n                       Widget before) {\n        super.insert(child,\n                     direction,\n                     size,\n                     before);\n        if (direction != Direction.CENTER) {\n            insertSplitter(child,\n                           before);\n        }\n    }\n\n    @Override\n    public boolean remove(Widget child) {\n        assert !(child instanceof Splitter) : \"Splitters may not be directly removed\";\n\n        int idx = getWidgetIndex(child);\n        if (super.remove(child)) {\n            // Remove the associated splitter, if any.\n            // Now that the widget is removed, idx is the index of the splitter.\n            if (idx < getWidgetCount()) {\n                // Call super.remove(), or we'll end up recursing.\n                super.remove(getWidget(idx));\n            }\n            return true;\n        }\n        return false;\n    }\n\n    /**\n     * Sets the minimum allowable size for the given widget.\n     * <p>\n     * Its associated splitter cannot be dragged to a position that would make\n     * it smaller than this size. This method has no effect for the\n     * {@link DockLayoutPanel.Direction#CENTER} widget.\n     * </p>\n     * @param child the child whose minimum size will be set\n     * @param minSize the minimum size for this widget\n     */\n    public void setWidgetMinSize(Widget child,\n                                 int minSize) {\n        assertIsAChild(child);\n        Splitter splitter = getAssociatedSplitter(child);\n        // The splitter is null for the center element.\n        if (splitter != null) {\n            splitter.setMinSize(minSize);\n        } else {\n            minCenterSize = minSize;\n        }\n    }\n\n    private void assertIsAChild(Widget widget) {\n        assert (widget == null) || (widget.getParent() == this) : \"The specified widget is not a child of this panel\";\n    }\n\n    private Splitter getAssociatedSplitter(Widget child) {\n        // If a widget has a next sibling, it must be a splitter, because the only\n        // widget that *isn't* followed by a splitter must be the CENTER, which has\n        // no associated splitter.\n        int idx = getWidgetIndex(child);\n        if (idx > -1 && idx < getWidgetCount() - 1) {\n            Widget splitter = getWidget(idx + 1);\n            assert splitter instanceof Splitter : \"Expected child widget to be splitter\";\n            return (Splitter) splitter;\n        }\n        return null;\n    }\n\n    private void insertSplitter(Widget widget,\n                                Widget before) {\n        assert getChildren().size() > 0 : \"Can't add a splitter before any children\";\n\n        LayoutData layout = (LayoutData) widget.getLayoutData();\n        Splitter splitter = null;\n        switch (getResolvedDirection(layout.direction)) {\n            case WEST:\n                splitter = new HSplitter(widget,\n                                         false);\n                break;\n            case EAST:\n                splitter = new HSplitter(widget,\n                                         true);\n                break;\n            case NORTH:\n                splitter = new VSplitter(widget,\n                                         false);\n                break;\n            case SOUTH:\n                splitter = new VSplitter(widget,\n                                         true);\n                break;\n            default:\n                assert false : \"Unexpected direction\";\n        }\n\n        super.insert(splitter,\n                     layout.direction,\n                     splitterSize,\n                     before);\n    }\n\n    /**\n     * Adds the given widget as a child of this splitter.\n     * @param child the widget to add\n     * @param position the position to dock the widget at (must be an actual compass position NORTH, SOUTH, EAST, or WEST)\n     * @param size the width or height to give the added child.\n     */\n    public void add(Widget child,\n                    CompassPosition position,\n                    double size) {\n        switch (position) {\n            case NORTH:\n                addNorth(child,\n                         size);\n                break;\n            case SOUTH:\n                addSouth(child,\n                         size);\n                break;\n            case EAST:\n                addEast(child,\n                        size);\n                break;\n            case WEST:\n                addWest(child,\n                        size);\n                break;\n            default:\n                throw new IllegalArgumentException(\"Bad child position: \" + position);\n        }\n    }\n\n    /**\n     * Adds the given widget as a child of this splitter.\n     * @param child the widget to add\n     * @param position the position to dock the widget at (must be an actual compass position NORTH, SOUTH, EAST, or WEST)\n     * @param size the width or height to give the added child\n     */\n    public void add(Widget child,\n                    CompassPosition position,\n                    int size) {\n        double doubleSize = (double) size;\n        add(child,\n            position,\n            doubleSize);\n    }\n\n    class HSplitter extends Splitter {\n\n        public HSplitter(Widget target,\n                         boolean reverse) {\n            super(target,\n                  reverse);\n            setStyleName(WorkbenchResources.INSTANCE.CSS().splitLayoutPanelHDragger());\n        }\n\n        @Override\n        protected void setUpHoverStyle(final Style style,\n                                       int size) {\n            style.setWidth(size,\n                           Unit.PX);\n            style.setMarginLeft(-(size / 2),\n                                Unit.PX);\n        }\n\n        @Override\n        public void onResize() {\n            hover.getElement().getStyle().setHeight(target.getOffsetHeight(),\n                                                    Unit.PX);\n        }\n\n        @Override\n        protected Style.Cursor getHoverCursorStyle() {\n            return Style.Cursor.COL_RESIZE;\n        }\n\n        @Override\n        protected int getAbsolutePosition() {\n            return getAbsoluteLeft();\n        }\n\n        @Override\n        protected double getCenterSize() {\n            return getCenterWidth();\n        }\n\n        @Override\n        protected int getEventPosition(Event event) {\n            return event.getClientX();\n        }\n\n        @Override\n        protected int getTargetPosition() {\n            return target.getAbsoluteLeft();\n        }\n\n        @Override\n        protected int getTargetSize() {\n            return target.getOffsetWidth();\n        }\n    }\n\n    abstract class Splitter extends Composite implements RequiresResize {\n\n        protected final Widget target;\n        protected final Widget hover;\n        protected final Element mouseTracker;\n        private final boolean reverse;\n        private int offset;\n        private boolean mouseDown;\n        private ScheduledCommand layoutCommand;\n        private int minSize;\n\n        private double centerSize, syncedCenterSize;\n\n        public Splitter(Widget target,\n                        boolean reverse) {\n            this.target = target;\n            this.reverse = reverse;\n\n            final ResizeFlowPanel widget = new ResizeFlowPanel();\n\n            sinkEvents(Event.ONMOUSEDOWN | Event.ONMOUSEUP | Event.ONMOUSEMOVE | Event.ONDBLCLICK);\n\n            this.hover = new FlowPanel();\n            final Style style = hover.getElement().getStyle();\n            style.setOpacity(0);\n            style.setZIndex(2);\n            style.setPosition(Position.FIXED);\n            setUpHoverStyle(style,\n                            DEFAULT_SPLITTER_HOVER_SIZE);\n            widget.add(hover);\n            initWidget(widget);\n\n            mouseTracker = Document.get().createDivElement();\n            mouseTracker.getStyle().setCursor(getHoverCursorStyle());\n            mouseTracker.getStyle().setZIndex(Integer.MAX_VALUE);\n            mouseTracker.getStyle().setPosition(Position.ABSOLUTE);\n            mouseTracker.getStyle().setHeight(50,\n                                              Unit.PX);\n            mouseTracker.getStyle().setWidth(50,\n                                             Unit.PX);\n        }\n\n        @Override\n        public void onBrowserEvent(final Event event) {\n            switch (event.getTypeInt()) {\n                case Event.ONMOUSEDOWN:\n                    mouseDown = true;\n                    /*\n                     * Resize glassElem to take up the entire scrollable window\n                     * area, which is the greater of the scroll size and the\n                     * client size.\n                     */\n                    int width = Math.max(Window.getClientWidth(),\n                                         Document.get().getScrollWidth());\n                    int height = Math.max(Window.getClientHeight(),\n                                          Document.get().getScrollHeight());\n                    glassElem.getStyle().setHeight(height,\n                                                   Unit.PX);\n                    glassElem.getStyle().setWidth(width,\n                                                  Unit.PX);\n                    Document.get().getBody().appendChild(glassElem);\n\n                    offset = getEventPosition(event) - getAbsolutePosition();\n                    Event.setCapture(getElement());\n                    event.preventDefault();\n\n                    Document.get().getBody().appendChild(mouseTracker);\n                    break;\n\n                case Event.ONMOUSEUP:\n                    mouseDown = false;\n\n                    glassElem.removeFromParent();\n\n                    Event.releaseCapture(getElement());\n                    event.preventDefault();\n\n                    mouseTracker.removeFromParent();\n                    break;\n\n                case Event.ONMOUSEMOVE:\n                    if (mouseDown) {\n                        int size;\n                        if (reverse) {\n                            size = getTargetPosition() + getTargetSize()\n                                    - getEventPosition(event) - offset;\n                        } else {\n                            size = getEventPosition(event) - getTargetPosition() - offset;\n                        }\n                        setAssociatedWidgetSize(size);\n                        event.preventDefault();\n\n                        mouseTracker.getStyle().setLeft(event.getClientX() - mouseTracker.getOffsetWidth() / 2,\n                                                        Unit.PX);\n                        mouseTracker.getStyle().setTop(event.getClientY() - mouseTracker.getOffsetHeight() / 2,\n                                                       Unit.PX);\n                    }\n                    break;\n            }\n        }\n\n        public void setMinSize(int minSize) {\n            this.minSize = minSize;\n            LayoutData layout = (LayoutData) target.getLayoutData();\n\n            // Try resetting the associated widget's size, which will enforce the new\n            // minSize value.\n            setAssociatedWidgetSize((int) layout.size);\n        }\n\n        protected abstract void setUpHoverStyle(Style style,\n                                                int size);\n\n        protected abstract Style.Cursor getHoverCursorStyle();\n\n        protected abstract int getAbsolutePosition();\n\n        protected abstract double getCenterSize();\n\n        protected abstract int getEventPosition(Event event);\n\n        protected abstract int getTargetPosition();\n\n        protected abstract int getTargetSize();\n\n        private double getMaxSize() {\n            // To avoid seeing stale center size values due to deferred layout\n            // updates, maintain our own copy up to date and resync when the\n            // DockLayoutPanel value changes.\n            double newCenterSize = getCenterSize();\n            if (syncedCenterSize != newCenterSize) {\n                syncedCenterSize = newCenterSize;\n                centerSize = newCenterSize;\n            }\n\n            return Math.max(((LayoutData) target.getLayoutData()).size + centerSize,\n                            0);\n        }\n\n        private void setAssociatedWidgetSize(double size) {\n            double maxSize = getMaxSize();\n            if (size > maxSize) {\n                size = maxSize;\n            }\n\n            if (size < minSize) {\n                size = minSize;\n            }\n\n            LayoutData layout = (LayoutData) target.getLayoutData();\n            if (size == layout.size) {\n                return;\n            }\n\n            double newCenterSize = centerSize + (layout.size - size);\n            if (newCenterSize < minCenterSize) {\n                return;\n            }\n\n            // Adjust our view until the deferred layout gets scheduled.\n            centerSize += layout.size - size;\n            centerSize = newCenterSize;\n            layout.size = size;\n\n            // Defer actually updating the layout, so that if we receive many\n            // mouse events before layout/paint occurs, we'll only update once.\n            if (layoutCommand == null) {\n                layoutCommand = new Command() {\n                    @Override\n                    public void execute() {\n                        layoutCommand = null;\n                        forceLayout();\n                    }\n                };\n                Scheduler.get().scheduleDeferred(layoutCommand);\n            }\n        }\n    }\n\n    class VSplitter extends Splitter {\n\n        public VSplitter(Widget target,\n                         boolean reverse) {\n            super(target,\n                  reverse);\n            setStyleName(WorkbenchResources.INSTANCE.CSS().splitLayoutPanelVDragger());\n        }\n\n        @Override\n        protected void setUpHoverStyle(final Style style,\n                                       int size) {\n            style.setHeight(size,\n                            Unit.PX);\n            style.setMarginTop(-(size / 2),\n                               Unit.PX);\n        }\n\n        @Override\n        public void onResize() {\n            hover.getElement().getStyle().setWidth(target.getOffsetWidth(),\n                                                   Unit.PX);\n        }\n\n        @Override\n        protected Style.Cursor getHoverCursorStyle() {\n            return Style.Cursor.ROW_RESIZE;\n        }\n\n        @Override\n        protected int getAbsolutePosition() {\n            return getAbsoluteTop();\n        }\n\n        @Override\n        protected double getCenterSize() {\n            return getCenterHeight();\n        }\n\n        @Override\n        protected int getEventPosition(Event event) {\n            return event.getClientY();\n        }\n\n        @Override\n        protected int getTargetPosition() {\n            return target.getAbsoluteTop();\n        }\n\n        @Override\n        protected int getTargetSize() {\n            return target.getOffsetHeight();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/java/org/uberfire/client/workbench/widgets/toolbar/WorkbenchToolBarPresenter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.widgets.toolbar;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.List;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport com.google.common.collect.ArrayListMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.WorkbenchActivity;\nimport org.uberfire.client.workbench.events.ClosePlaceEvent;\nimport org.uberfire.client.workbench.events.PlaceGainFocusEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n/**\n * Presenter for WorkbenchToolBar that mediates changes to the Workbench ToolBar\n * in response to changes to the selected WorkbenchPart. This implementation is\n * specific to GWT. An alternative implementation should be considered for use\n * within Eclipse.\n */\n@ApplicationScoped\npublic class WorkbenchToolBarPresenter {\n\n    //Items relating to the Workbench as a whole\n    private final List<ToolBar> workbenchItems = new ArrayList<ToolBar>();\n    //Transient items relating to the current Workbench Perspective\n    private final List<ToolBar> workbenchPerspectiveItems = new ArrayList<ToolBar>();\n    //Transient items relating to the current WorkbenchPart context\n    private final Multimap<PlaceRequest, ToolBar> workbenchContextItems = ArrayListMultimap.create();\n    @Inject\n    private View view;\n    @Inject\n    private PlaceManager placeManager;\n\n    public IsWidget getView() {\n        return this.view;\n    }\n\n    public int getHeight() {\n        return this.view.getHeight();\n    }\n\n    public void hide() {\n        this.view.hide();\n    }\n\n    public void show() {\n        this.view.show();\n    }\n\n    /**\n     * Removes all the ToolBar items that were previously added for the given place, if any.\n     */\n    private void removeItemsFor(final PlaceRequest place) {\n        Collection<ToolBar> removed = workbenchContextItems.removeAll(place);\n        for (final ToolBar toolBar : removed) {\n            view.removeToolBar(toolBar);\n        }\n    }\n\n    /**\n     * Adds all the ToolBar items associated with the given place to this\n     * toolbar. The exact list of items added is remembered, and can be removed\n     * later by a call to {@link #removeItemsFor(PlaceRequest)}.\n     * <p>\n     * The toolbar items are filtered for the current user subject to their\n     * security requirements.\n     * <p>\n     * This method becomes a no-op when any of the following is true:\n     * <ul>\n     * <li>The place doesn't have an associated {@link Activity}\n     * <li>The place's Activity is not a {@link WorkbenchActivity}\n     * <li>The place's WorkbenchActivity doesn't have a {@link ToolBar}\n     * </ul>\n     */\n    public void addItemsFor(final PlaceRequest place) {\n        final Activity activity = placeManager.getActivity(place);\n        if (activity == null) {\n            return;\n        }\n        if (!(activity instanceof WorkbenchActivity)) {\n            return;\n        }\n        final WorkbenchActivity wbActivity = (WorkbenchActivity) activity;\n\n        final ToolBar toolBar = wbActivity.getToolBar();\n        if (toolBar == null) {\n            return;\n        }\n\n        final ToolBar filteredToolBar = filterToolBarItemsByPermission(toolBar);\n\n        if (!filteredToolBar.getItems().isEmpty()) {\n            workbenchContextItems.put(place,\n                                      filteredToolBar);\n            view.addToolBar(filteredToolBar);\n        }\n    }\n\n    /**\n     * Removes the toolbar items of a WorkbenchPart when that part is closed.\n     */\n    @SuppressWarnings(\"unused\")\n    private void onWorkbenchPartClose(@Observes ClosePlaceEvent event) {\n        removeItemsFor(event.getPlace());\n    }\n\n    /**\n     * Adds the toolbar items of a WorkbenchPart when that part is created.\n     * <p>\n     * TODO(UF-6): change this to observe PlaceOpenedEvent when such an event exists.\n     */\n    @SuppressWarnings(\"unused\")\n    private void onWorkbenchPartOnFocus(@Observes PlaceGainFocusEvent event) {\n        if (!workbenchContextItems.containsKey(event.getPlace())) {\n            addItemsFor(event.getPlace());\n        }\n    }\n\n    public void addWorkbenchItem(final ToolBar toolBar) {\n\n        final ToolBar filteredToolBar = filterToolBarItemsByPermission(toolBar);\n\n        if (!filteredToolBar.getItems().isEmpty()) {\n            workbenchItems.add(filteredToolBar);\n            view.addToolBar(filteredToolBar);\n        }\n    }\n\n    public void addWorkbenchPerspective(final ToolBar toolBar) {\n        final ToolBar filteredToolBar = filterToolBarItemsByPermission(toolBar);\n\n        if (!filteredToolBar.getItems().isEmpty()) {\n            workbenchPerspectiveItems.add(filteredToolBar);\n            view.addToolBar(filteredToolBar);\n        }\n    }\n\n    private ToolBar filterToolBarItemsByPermission(ToolBar toolBar) {\n        return toolBar; // TODO (UF-2)\n    }\n\n    public void clearWorkbenchItems() {\n        if (workbenchItems.isEmpty()) {\n            return;\n        }\n        for (ToolBar item : workbenchItems) {\n            view.removeToolBar(item);\n        }\n        workbenchItems.clear();\n    }\n\n    public void clearWorkbenchPerspectiveItems() {\n        if (workbenchPerspectiveItems.isEmpty()) {\n            return;\n        }\n        for (ToolBar item : workbenchPerspectiveItems) {\n            view.removeToolBar(item);\n        }\n        workbenchPerspectiveItems.clear();\n    }\n\n    /**\n     * View contract for an UberFire toolbar view.\n     */\n    public interface View\n            extends\n            IsWidget {\n\n        /**\n         * Adds a set of Tool Bar items to the view. The Presenter has already verified that the user has permission to\n         * see the items in the given toolbar.\n         */\n        void addToolBar(final ToolBar toolBar);\n\n        /**\n         * Removes a set of Tool Bar items from the view. Has no effect if the items were not already in this view.\n         */\n        void removeToolBar(final ToolBar toolBar);\n\n        /**\n         * Returns the pixel height of this toolbar.\n         */\n        int getHeight();\n\n        /**\n         * Makes this toolbar invisible.\n         */\n        void hide();\n\n        /**\n         * Makes this toolbar visible.\n         */\n        void show();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.security.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/UberfireWorkbench.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <!-- Inherit the core Web Toolkit stuff. -->\n\n  <inherits name=\"com.google.gwt.i18n.I18N\"/>\n  <inherits name=\"com.google.gwt.http.HTTP\"/>\n  <inherits name=\"com.google.gwt.user.User\"/>\n  <inherits name=\"com.google.gwt.resources.Resources\"/>\n  <inherits name=\"com.google.gwt.activity.Activity\"/>\n\n  <!-- Errai modules -->\n  <inherits name=\"org.jboss.errai.enterprise.CDI\"/>\n\n  <inherits name=\"org.uberfire.commons.UberfireCommons\"/>\n  <inherits name=\"org.uberfire.security.UberfireSecurityClient\"/>\n\n  <!-- Prevent compilation warning -->\n  <set-configuration-property name=\"UiBinder.useSafeHtmlTemplates\" value=\"true\"/>\n\n  <!-- GWT-DnD module inherits -->\n  <inherits name='com.allen_sauer.gwt.dnd.gwt-dnd'/>\n\n  <!-- GuvnorNG API common interfaces -->\n  <inherits name=\"org.uberfire.UberfireClientAPI\"/>\n\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalAPI\"/>\n\n  <!-- Google Guava -->\n  <inherits name=\"com.google.common.collect.Collect\"/>\n\n  <!-- Specify the paths for translatable code -->\n  <source path='client'/>\n  <source path='shared'/>\n\n  <replace-with class=\"org.uberfire.client.workbench.WorkbenchCloseHandlerImpl\">\n    <when-type-is class=\"org.uberfire.client.workbench.WorkbenchCloseHandler\"/>\n  </replace-with>\n  <replace-with class=\"org.uberfire.client.workbench.WorkbenchCloseHandlerImplFallback\">\n    <when-type-is class=\"org.uberfire.client.workbench.WorkbenchCloseHandler\"/>\n    <when-property-is name=\"user.agent\" value=\"ie9\"/>\n  </replace-with>\n  <replace-with class=\"org.uberfire.client.workbench.WorkbenchCloseHandlerImplFallback\">\n    <when-type-is class=\"org.uberfire.client.workbench.WorkbenchCloseHandler\"/>\n    <when-property-is name=\"user.agent\" value=\"gecko1_8\"/>\n  </replace-with>\n\n</module>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/css/workbench.css",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.notification {\n    border: 0;\n    margin: 0;\n    padding: 0;\n    z-index: 100000;\n}\n\n.toolbar {\n    min-height: 30px;\n    margin-top: 0;\n    margin-bottom: 5px;\n    padding-bottom: 5px;\n    padding-top: 5px;\n    background-color: #f5f5f5;\n    border: 1px solid #e3e3e3;\n    -webkit-border-radius: 4px;\n    -moz-border-radius: 4px;\n    border-radius: 4px;\n    -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n    -moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);\n}\n\n.uf-drop-target-highlight {\n\n}\n\n.uf-drop-target-compass {\n\n}\n\n.statusBar {\n    cursor: default;\n    height: 36px;\n    width: 100%;\n    border-spacing: 0px;\n    background: #c0c0c0;\n    padding-top: 0px;\n    padding-bottom: 0px;\n    padding-left: 2px;\n    padding-right: 2px;\n}\n\n.uf-activeNavTabs {\n\n}\n\n.tabCloseButton {\n    float: none;\n    margin: -2px 0 0 10px;\n}\n\n.uf-listbar {\n    -moz-box-shadow: rgba(255, 255, 255, 0.2) 0px 1px 0px 0px inset, rgba(0, 0, 0, 0.0470588) 0px 1px 2px 0px;\n    -webkit-box-shadow: rgba(255, 255, 255, 0.2) 0px 1px 0px 0px inset, rgba(0, 0, 0, 0.0470588) 0px 1px 2px 0px;\n    background: rgb(245, 245, 245) linear-gradient(rgb(255, 255, 255), rgb(230, 230, 230)) repeat-x;\n    border-image-outset: 0px;\n    border-image-repeat: stretch;\n    border-image-slice: 100%;\n    border-image-source: none;\n    border-image-width: 1;\n    border: 1px solid rgba(0, 0, 0, 0.0980392);\n    border-top-width: 0px;\n    border-bottom-color: rgb(179, 179, 179);\n    box-shadow: rgba(255, 255, 255, 0.2) 0px 1px 0px 0px inset, rgba(0, 0, 0, 0.0470588) 0px 1px 2px 0px;\n    box-sizing: border-box;\n    color: rgb(51, 51, 51);\n    padding-left: 6px;\n    padding-top: 5px;\n    text-shadow: rgba(255, 255, 255, 0.74902) 0px 1px 1px;\n    height: 32px;\n}\n\n.uf-lock-hint {\n    width: 180px;\n    height: 90px;\n    background-color: #FFFFFF;\n    color: #848484;\n    border: 1px solid;\n    border-color: #848484;\n    text-align: center;\n    font-size: 13px;\n    -webkit-transition: top 0.5s ease-in;\n    -moz-transition: top 0.5s ease-in;\n    -ms-transition: top 0.5s ease-in;\n    -o-transition: top 0.5s ease-in;\n    transition: top 0.5s ease-in;\n}\n\n.uf-scroll-panel {\n    height: 100%;\n    width: 100%;\n}\n\n.show-context {\n    margin-left: 0;\n    -webkit-transition: all 0.7s ease-out;\n    -moz-transition: all 0.7s ease-out;\n    -ms-transition: all 0.7s ease-out;\n    -o-transition: all 0.7s ease-out;\n    transition: all 0.7s ease-out;\n}\n\n@external .navbar-fixed-top, .navbar-fixed-bottom;\n\n.navbar-fixed-top, .navbar-fixed-bottom {\n    position: static !important;\n}\n\n/* Styles prefixed with uf- are not obfuscated and can be overridden in application stylesheets. */\n@external .uf-*, .js-*;\n\n/* Maximized panels must have an opaque background. The application can override the default (white) in its own stylesheet.\n   Size and position are handled programmatically in the WorkbenchLayout implementation. */\n.uf-maximized-panel {\n    background-color: #fff;\n}\n\n.uf-split-layout-panel {\n\n}\n\n.uf-split-layout-panel-hdragger {\n    background-color: #ddd;\n}\n\n.uf-split-layout-panel-hdragger:hover {\n    cursor: col-resize;\n}\n\n.uf-split-layout-panel-vdragger {\n    background-color: #ddd;\n}\n\n.uf-split-layout-panel-vdragger:hover {\n    cursor: row-resize;\n}\n\n.uf-modal {\n\n}\n\n.uf-no-select {\n    -webkit-user-select: none;\n    -moz-user-select: none;\n    -ms-user-select: none;\n    user-select: none;\n}\n\n.uf-perspective-container {\n    height: 100%;\n}\n\n.uf-perspective-row-12 {\n    height: 100%;\n}\n\n.uf-perspective-row-11 {\n    height: 91.66666667%;\n}\n\n.uf-perspective-row-10 {\n    height: 83.33333333%;\n}\n\n.uf-perspective-row-9 {\n    height: 75%;\n}\n\n.uf-perspective-row-8 {\n    height: 66.66666667%;\n}\n\n.uf-perspective-row-7 {\n    height: 58.33333333%;\n}\n\n.uf-perspective-row-6 {\n    height: 50%;\n}\n\n.uf-perspective-row-5 {\n    height: 41.66666667%;\n}\n\n.uf-perspective-row-4 {\n    height: 33.33333333%;\n}\n\n.uf-perspective-row-3 {\n    height: 25%;\n}\n\n.uf-perspective-row-2 {\n    height: 16.66666667%;\n}\n\n.uf-perspective-row-1 {\n    height: 8.33333333%;\n}\n\n.uf-perspective-col {\n    height: 100%;\n}\n\n.uf-perspective-component {\n    height: 100%;\n}\n\n.uf-perspective-rendered-col {\n    padding-left: 0;\n    padding-right: 0;\n}\n\n.uf-perspective-rendered-row {\n    margin-left: 0;\n    margin-right: 0;\n}\n\n.uf-perspective-rendered-container {\n    width: 100%;\n    max-width: none;\n    padding: 0;\n}\n.uf-le-overflow{\n    overflow: auto;\n}\n\n.js-screen-container {\n    display: inline;\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/PermissionTreeConstants.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nperspectivesNodeName=Pages\nperspectivesNodeHelp=If access to a page is denied then it will not be shown in any of application menus. Update, Delete and Create permissions change the behaviour of the page editor.\nperspectiveResourceName=Page\nperspectiveCreate=Create\nperspectiveRead=Read\nperspectiveUpdate=Update\nperspectiveDelete=Delete\neditorsNodeName=Editors\neditorsNodeHelp=If access to an editor is denied then it will not be shown in any of application menus.\neditorResourceName=Editor\neditorRead=Read\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/PermissionTreeConstants_es.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nperspectivesNodeName=Páginas\nperspectivesNodeHelp=Si se deniega el acceso a una página, esta no se mostrará en ninguno de los menús de la aplicación. Los permisos de Actualizar, Eliminar y Crear cambian el comportamiento del editor de páginas.\nperspectiveResourceName=Página\nperspectiveCreate=Crear\nperspectiveRead=Leer\nperspectiveUpdate=Actualizar\nperspectiveDelete=Eliminar\neditorsNodeName=Editores\neditorsNodeHelp=Si se deniega el acceso a un editor, este no se mostrará en ninguno de los menús de la aplicación.\neditorResourceName=Editor\neditorRead=Leer\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/PermissionTreeConstants_fr.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nperspectivesNodeName=Pages\nperspectivesNodeHelp=Si l''accès à une page est refusé, elle n''apparaîtra dans aucun des menus de l''application. Les autorisations Mettre à jour, Supprimer et Créer modifient le comportement de l''éditeur de page.\nperspectiveResourceName=Page\nperspectiveCreate=Créer\nperspectiveRead=Lire\nperspectiveUpdate=Mettre à jour\nperspectiveDelete=Supprimer\neditorsNodeName=Éditeurs\neditorsNodeHelp=Si l''accès à un éditeur est refusé, il n''apparaîtra dans aucun des menus de l''application.\neditorResourceName=Éditeur\neditorRead=Lire\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/PermissionTreeConstants_it.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nperspectivesNodeName=Pagine\nperspectivesNodeHelp=Se l''accesso a una pagina è negato, non verrà mostrata in nessun menu dell''applicazione. Le autorizzazioni di Aggiornamento, Eliminazione e Creazione modificano il comportamento dell''editor di pagine.\nperspectiveResourceName=Pagina\nperspectiveCreate=Crea\nperspectiveRead=Leggi\nperspectiveUpdate=Aggiorna\nperspectiveDelete=Elimina\neditorsNodeName=Editor\neditorsNodeHelp=Se l''accesso a un editor è negato, non verrà mostrato in nessun menu dell''applicazione.\neditorResourceName=Editor\neditorRead=Leggi\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/PermissionTreeConstants_ja.properties",
    "content": "#\n# Copyright 2016 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nperspectivesNodeName=ページ\nperspectivesNodeHelp=ページへのアクセスが拒否されると、アプリケーションメニューに表示されません。更新、削除、および作成のパーミッションを使用すると、ページエディターの動作が変更します。\nperspectiveResourceName=ページ\nperspectiveCreate=作成\nperspectiveRead=読み込み\nperspectiveUpdate=更新\nperspectiveDelete=削除\neditorsNodeName=エディター\neditorsNodeHelp=エディターへのアクセスが拒否されると、アプリケーションメニューに表示されません。\neditorResourceName=エディター\neditorRead=読み込み\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmaximizePanel=Maximize panel to fit full screen\nminimizePanel=Minimize panel to its previous size\nclosePanel=Close this panel\nselectView=Select view\nexpandToolbar=Expand Toolbar\ncollapseToolbar=Collapse Toolbar\nshowSplashHelp=Show help\nlockHint=Locked by\nlockOwnedHint=Locked by you\nlockError=An error has occurred while trying to lock this asset.\nlockedMessage=This asset is currently being edited by {0}. Once they commit their changes, you will be able to edit the asset.\nsplashScreenNoneAvailable=-- None --\nswitchToDefaultView=Switch to Default View\nswitchToCompactView=Switch to Compact View\nclosingWindowMessage=You have unsaved changes in the Workbench, and they will be lost if you proceed. This action cannot be undone. Do you want to proceed anyway?"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_de.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nmaximizePanel=Panel auf Vollbildmodus maximieren\nminimizePanel=Panel auf vorherige Größe minimieren\nclosePanel=Dieses Panel schließen\nselectView=Ansicht auswählen\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nexpandToolbar=Toolbar erweitern\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\ncollapseToolbar=Toolbar minimieren\nshowSplashHelp=Hilfe anzeigen\nlockHint=Gesperrt von\nlockOwnedHint=Gesperrt von Ihnen\nlockError=Beim Sperren dieses Assets ist ein Fehler aufgetreten\nlockedMessage=Dieses Asset wird derzeit von {0} bearbeitet. Wenn die Änderungen abgeschlossen sind, können Sie das Asset bearbeiten.\nsplashScreenNoneAvailable=--- Keine ---\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_es.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmaximizePanel=Maximizar el panel para que quepa en pantalla completa\nminimizePanel=Minimizar el panel a su tamaño anterior\nclosePanel=Cerrar este panel\nselectView=Seleccionar vista\nexpandToolbar=Ampliar la barra de herramientas\ncollapseToolbar=Contraer la barra de herramientas\nshowSplashHelp=Mostrar ayuda\nlockHint=Bloqueado por\nlockOwnedHint=Bloqueado por usted\nlockError=Se ha producido un error al intentar bloquear este activo.\nlockedMessage=Este activo está siendo editado actualmente por {0}. Una vez que confirmen sus cambios, podrá editar el activo.\nsplashScreenNoneAvailable=-- Ninguno --\nswitchToDefaultView=Cambiar a la vista predeterminada\nswitchToCompactView=Cambiar a la vista compacta\nclosingWindowMessage=Tiene cambios sin guardar en la Mesa de trabajo, y se perderán si continúa. Esta acción no puede deshacerse. ¿Quiere continuar de todos modos?"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_fr.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmaximizePanel=Agrandir le panneau pour qu''il occupe tout l''écran\nminimizePanel=Réduire le panneau à sa taille précédente\nclosePanel=Fermer ce panneau\nselectView=Sélectionnez une vue\nexpandToolbar=Développer la barre d''outils\ncollapseToolbar=Réduire la barre d''outils\nshowSplashHelp=Afficher l''aide\nlockHint=Verrouillé par\nlockOwnedHint=Verrouillé par vous\nlockError=Une erreur s''est produite lors de la tentative de verrouillage de cet actif.\nlockedMessage=Cet actif est actuellement modifié par {0}. Une fois que les modifications auront été validées, vous pourrez modifier l''actif.\nsplashScreenNoneAvailable=-- Aucun --\nswitchToDefaultView=Basculer vers la vue par défaut\nswitchToCompactView=Basculer vers la vue compacte\nclosingWindowMessage=Le Tableau de référence contient des modifications qui n''ont pas été enregistrées. Si vous continuez, elles seront perdues. Cette action ne peut pas être annulée. Voulez-vous quand même continuer ?"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_it.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmaximizePanel=Massimizza il pannello per adattarlo allo schermo intero\nminimizePanel=Minimizza il pannello alle sue dimensioni precedenti\nclosePanel=Chiudi questo pannello\nselectView=Seleziona vista\nexpandToolbar=Espandi barra degli strumenti\ncollapseToolbar=Comprimi barra degli strumenti\nshowSplashHelp=Mostra aiuto\nlockHint=Bloccato da\nlockOwnedHint=Bloccato da te\nlockError=Si è verificato un errore durante il tentativo di bloccare questa risorsa.\nlockedMessage=Questa risorsa è attualmente in fase di modifica da parte di {0}. Una volta che avranno salvato le loro modifiche, potrai modificare la risorsa.\nsplashScreenNoneAvailable=-- Nessuno --\nswitchToDefaultView=Passa alla vista predefinita\nswitchToCompactView=Passa alla vista compatta\nclosingWindowMessage=Hai delle modifiche non salvate nel Workbench e andranno perse se procedi. Questa azione non può essere annullata. Vuoi procedere comunque?\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_ja.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nmaximizePanel=フルスクリーンへパネルを最大化\nminimizePanel=前のサイズへパネルを最小化\nclosePanel=このパネルを閉じる\nselectView=ビューを選択\nexpandToolbar=ツールバーを展開\ncollapseToolbar=ツールバーを折りたたむ\nshowSplashHelp=ヘルプを表示\nlockHint=ロックしたユーザー:\nlockOwnedHint=あなたがロックしています\nlockError=このアセットのロックの試行中にエラーが発生しました。\nlockedMessage=このアセットは現在{0}が編集中です。{0} が変更をコミットした後、アセットを編集できます。\nsplashScreenNoneAvailable=-- なし --\nswitchToDefaultView=デフォルト表示に切り替える\nswitchToCompactView=縮小表示に切り替える\nclosingWindowMessage=ワークベンチに保存されていない変更があり、続行すると変更は失われます。このアクションは取り消せません。それでも続行しますか?"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_pt_BR.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nmaximizePanel=Aumentar o painel para a tela cheia\nminimizePanel=Reduzir o painel ao tamanho anterior\nclosePanel=Fechar este painel\nselectView=Selecionar Modo de Exibição\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nexpandToolbar=Expandir a Barra de Ferramentas\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\ncollapseToolbar=Recolher a Barra de Ferramentas\nshowSplashHelp=Mostrar ajuda\nlockHint=Bloqueado por\nlockOwnedHint=Bloqueado por você\nlockError=Ocorreu um erro ao tentar bloquear este ativo.\nlockedMessage=Este ativo está sendo editado atualmente por {0}. Depois que as alterações forem confirmadas, você poderá editar o ativo. \nsplashScreenNoneAvailable=-- Nenhum(a) --\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/main/resources/org/uberfire/client/resources/i18n/WorkbenchConstants_zh_CN.properties",
    "content": "# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nmaximizePanel=最大化面板为全屏\nminimizePanel=最小化面板为之前的尺寸\nclosePanel=关闭这个面板\nselectView=选择视图\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\nexpandToolbar=展开工具栏\n# translation auto-copied from project UberFire, version 0.3.0, document org.uberfire/uberfire-workbench-client/org/uberfire/client/resources/i18n/WorkbenchConstants, author nmirasch\ncollapseToolbar=收缩工具栏\nshowSplashHelp=显示帮助\nlockHint=锁住\nlockOwnedHint=被您锁住\nlockError=当试图锁住这个资产时出现错误。\nlockedMessage={0} 正在编辑这个资产。提交修改后，您就可以编辑它了。\nsplashScreenNoneAvailable=--- 无 ---\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/authz/EditorTreeProviderTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.authz;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.WorkbenchEditorActivity;\nimport org.uberfire.client.resources.i18n.PermissionTreeI18n;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.impl.DefaultLoadOptions;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class EditorTreeProviderTest {\n\n    private static final String EDITOR1_ID = \"Editor1\";\n    private static final String EDITOR2_ID = \"Editor2\";\n    private static final String EDITOR1_NAME = \"Editor 1 name\";\n    private static final String EDITOR2_NAME = \"Editor 2 name\";\n\n    @Mock\n    private ActivityBeansCache activityBeansCache;\n\n    @Mock\n    private PermissionTreeI18n i18n;\n\n    @Mock\n    private PermissionTree permissionTree;\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Captor\n    private ArgumentCaptor<WorkbenchEditorActivity> editorActivityCaptor;\n\n    private PermissionManager permissionManager;\n    private EditorTreeProvider provider;\n    private PermissionNode root;\n\n    @Before\n    public void setUp() {\n        final SyncBeanDef<Activity> editor1 = makeWorkbenchEditorActivity(EDITOR1_ID);\n        final SyncBeanDef<Activity> editor2 = makeWorkbenchEditorActivity(EDITOR2_ID);\n        when(activityBeansCache.getActivity(EDITOR1_ID)).thenReturn(editor1);\n        when(activityBeansCache.getActivity(EDITOR2_ID)).thenReturn(editor2);\n\n        when(i18n.editorResourceName()).thenReturn(\"Editor Resource name\");\n        when(i18n.editorsNodeName()).thenReturn(\"Editor Node name\");\n\n        permissionManager = new DefaultPermissionManager();\n        provider = new EditorTreeProvider(activityBeansCache,\n                                          iocManager,\n                                          permissionManager,\n                                          i18n);\n\n        root = provider.buildRootNode();\n        root.setPermissionTree(permissionTree);\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private SyncBeanDef<Activity> makeWorkbenchEditorActivity(final String editorId) {\n        final SyncBeanDef<Activity> beanDef = mock(SyncBeanDef.class);\n        final WorkbenchEditorActivity bean = mock(WorkbenchEditorActivity.class);\n        when(beanDef.getInstance()).thenReturn(bean);\n        when(bean.getIdentifier()).thenReturn(editorId);\n        when(bean.getResourceType()).thenReturn(ActivityResourceType.EDITOR);\n        return beanDef;\n    }\n\n    @Test\n    public void testEmpty() {\n        final DefaultLoadOptions options = new DefaultLoadOptions();\n        provider.loadChildren(root,\n                              options,\n                              children -> assertEquals(children.size(),\n                                                       0));\n    }\n\n    @Test\n    public void testRegisterEditorDiscardsEditorInstance() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        verify(iocManager).destroyBean(editorActivityCaptor.capture());\n\n        final WorkbenchEditorActivity editorActivity = editorActivityCaptor.getValue();\n        assertEquals(EDITOR1_ID,\n                     editorActivity.getIdentifier());\n    }\n\n    @Test\n    public void testIncludedResourceIds() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        final DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setResourceIds(Collections.singletonList(EDITOR1_ID));\n        provider.loadChildren(root,\n                              options,\n                              children -> assertEquals(children.size(),\n                                                       1));\n    }\n\n    @Test\n    public void testRegisterEditor() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        final DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"\");\n        provider.loadChildren(root,\n                              options,\n                              children -> assertEquals(children.size(),\n                                                       1));\n    }\n\n    @Test\n    public void testNameSearch1() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        provider.registerEditor(EDITOR2_ID,\n                                EDITOR2_NAME);\n        final DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"name\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               2);\n                                  assertContains(EDITOR1_NAME,\n                                                 children);\n                                  assertContains(EDITOR2_NAME,\n                                                 children);\n                              });\n    }\n\n    private void assertContains(final String editorName,\n                                final List<PermissionNode> children) {\n        assertTrue(children.stream()\n                           .filter(p -> p.getNodeName().equals(editorName))\n                           .findFirst()\n                           .isPresent());\n    }\n\n    @Test\n    public void testNameSearch2() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        provider.registerEditor(EDITOR2_ID,\n                                EDITOR2_NAME);\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"1\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                                  assertEquals(EDITOR1_NAME,\n                                               children.get(0).getNodeName());\n                              });\n    }\n\n    @Test\n    public void testNameSearch3() {\n        provider.registerEditor(EDITOR1_ID,\n                                EDITOR1_NAME);\n        provider.registerEditor(EDITOR2_ID,\n                                EDITOR2_NAME);\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"2\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                                  assertEquals(EDITOR2_NAME,\n                                               children.get(0).getNodeName());\n                              });\n    }\n\n    @Test\n    public void testRootNode() {\n        assertEquals(root.getPermissionList().size(),\n                     1);\n        checkDependencies(root);\n    }\n\n    @Test\n    public void testChildrenNodes() {\n        root.expand(children -> {\n            for (PermissionNode child : children) {\n                assertEquals(child.getPermissionList().size(),\n                             3);\n                checkDependencies(child);\n            }\n        });\n    }\n\n    protected void checkDependencies(PermissionNode permissionNode) {\n        for (Permission permission : permissionNode.getPermissionList()) {\n            Collection<Permission> dependencies = permissionNode.getDependencies(permission);\n\n            if (permission.getName().startsWith(\"perspective.read\")) {\n                assertEquals(dependencies.size(),\n                             2);\n            } else {\n                assertNull(dependencies);\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/authz/MenuBuilderAuthzTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport java.util.Arrays;\nimport java.util.Collections;\n\nimport org.jboss.errai.security.shared.api.RoleImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultAuthorizationManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.MenuVisitor;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.workbench.model.menu.MenuFactory.newSimpleItem;\nimport static org.uberfire.workbench.model.menu.MenuFactory.newTopLevelMenu;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MenuBuilderAuthzTest {\n\n    @Mock\n    User user;\n    @Spy\n    MenuVisitor menuVisitor = new CustomVisitor();\n    Menus menus;\n    AuthFilterMenuVisitor authzVisitor;\n    AuthorizationManager authorizationManager;\n    PermissionManager permissionManager;\n\n    @Before\n    public void setUp() {\n        when(user.getRoles()).thenReturn(Collections.singleton(new RoleImpl(\"admin\")));\n\n        menus = newTopLevelMenu(\"Group1\")\n                .withPermission(\"group1\")\n                .withItems(Arrays.asList(\n                        newSimpleItem(\"Perspective 1\").perspective(\"perspective1\").endMenu().build().getItems().get(0),\n                        newSimpleItem(\"Perspective 2\").perspective(\"perspective2\").endMenu().build().getItems().get(0)\n                ))\n                .endMenu().build();\n\n        permissionManager = new DefaultPermissionManager();\n        authorizationManager = new DefaultAuthorizationManager(permissionManager);\n        authzVisitor = spy(new AuthFilterMenuVisitor(authorizationManager,\n                                                     user,\n                                                     menuVisitor));\n    }\n\n    @Test\n    public void testVisit() {\n        menus.accept(authzVisitor);\n\n        verify(menuVisitor).visitEnter(any(MenuGroup.class));\n        verify(menuVisitor,\n               times(2)).visit(any(MenuItemPerspective.class));\n    }\n\n    @Test\n    public void testVisit2() {\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\")\n                        .permission(\"perspective.read.perspective1\",\n                                    false)\n                        .build());\n\n        menus.accept(authzVisitor);\n\n        verify(menuVisitor).visitEnter(any(MenuGroup.class));\n        verify(menuVisitor,\n               times(1)).visit(any(MenuItemPerspective.class));\n    }\n\n    @Test\n    public void testVisit3() {\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\")\n                        .permission(\"perspective.read.perspective1\",\n                                    false)\n                        .permission(\"perspective.read.perspective2\",\n                                    false)\n                        .build());\n\n        menus.accept(authzVisitor);\n\n        verify(menuVisitor,\n               never()).visitEnter(any(MenuGroup.class));\n        verify(menuVisitor,\n               never()).visit(any(MenuItemPerspective.class));\n    }\n\n    @Test\n    public void testVisit4() {\n        Menus menus = newTopLevelMenu(\"Group\")\n                .withItems(Arrays.asList(\n                        newSimpleItem(\"Perspective 1\").withPermission(\"perspective.read.perspective1\").endMenu().build().getItems().get(0),\n                        newSimpleItem(\"Perspective 2\").withPermission(\"perspective.read.perspective2\").endMenu().build().getItems().get(0)\n                ))\n                .endMenu().build();\n\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\")\n                        .permission(\"perspective.read.perspective1\",\n                                    false)\n                        .permission(\"perspective.read.perspective2\",\n                                    false)\n                        .build());\n\n        menus.accept(authzVisitor);\n\n        verify(menuVisitor,\n               never()).visitEnter(any(MenuGroup.class));\n        verify(menuVisitor,\n               never()).visit(any(MenuItemPerspective.class));\n    }\n\n    @Test\n    public void testVisit5() {\n        permissionManager.setAuthorizationPolicy(\n                permissionManager.newAuthorizationPolicy()\n                        .role(\"admin\")\n                        .permission(\"group1\",\n                                    false)\n                        .build());\n\n        menus.accept(authzVisitor);\n\n        verify(menuVisitor,\n               never()).visitEnter(any(MenuGroup.class));\n        verify(menuVisitor,\n               never()).visit(any(MenuItemPerspective.class));\n    }\n\n    private class CustomVisitor implements MenuVisitor {\n\n        @Override\n        public boolean visitEnter(Menus menus) {\n            return true;\n        }\n\n        @Override\n        public void visitLeave(Menus menus) {\n\n        }\n\n        @Override\n        public boolean visitEnter(MenuGroup menuGroup) {\n            return true;\n        }\n\n        @Override\n        public void visitLeave(MenuGroup menuGroup) {\n\n        }\n\n        @Override\n        public void visit(MenuItemPlain menuItemPlain) {\n\n        }\n\n        @Override\n        public void visit(MenuItemCommand menuItemCommand) {\n\n        }\n\n        @Override\n        public void visit(MenuItemPerspective menuItemPerspective) {\n\n        }\n\n        @Override\n        public void visit(MenuCustom<?> menuCustom) {\n\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/authz/PerspectivePermissionTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.junit.Assert.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectivePermissionTest {\n\n    PermissionManager permissionManager;\n\n    @Before\n    public void setUp() {\n        permissionManager = new DefaultPermissionManager();\n    }\n\n    @Test\n    public void testPermissionCreation() {\n        Permission readPermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE,\n                                                                       PerspectiveAction.READ,\n                                                                       true);\n        Permission updatePermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE,\n                                                                         PerspectiveAction.UPDATE,\n                                                                         true);\n        Permission deletePermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE,\n                                                                         PerspectiveAction.DELETE,\n                                                                         true);\n        Permission createPermission = permissionManager.createPermission(ActivityResourceType.PERSPECTIVE,\n                                                                         PerspectiveAction.CREATE,\n                                                                         true);\n\n        assertEquals(readPermission.getName(),\n                     \"perspective.read\");\n        assertEquals(updatePermission.getName(),\n                     \"perspective.update\");\n        assertEquals(deletePermission.getName(),\n                     \"perspective.delete\");\n        assertEquals(createPermission.getName(),\n                     \"perspective.create\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/authz/PerspectiveTreeProviderTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.resources.i18n.PermissionTreeI18n;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.security.authz.PermissionManager;\nimport org.uberfire.security.client.authz.tree.PermissionNode;\nimport org.uberfire.security.client.authz.tree.PermissionTree;\nimport org.uberfire.security.client.authz.tree.impl.DefaultLoadOptions;\nimport org.uberfire.security.impl.authz.DefaultPermissionManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNull;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectiveTreeProviderTest {\n\n    @Mock\n    ActivityBeansCache activityBeansCache;\n\n    @Mock\n    PermissionTreeI18n i18n;\n\n    @Mock\n    PermissionTree permissionTree;\n\n    PermissionManager permissionManager;\n    PerspectiveTreeProvider provider;\n    PermissionNode root;\n\n    @Before\n    public void setUp() {\n        List<SyncBeanDef<Activity>> beanDefs = new ArrayList<>();\n        SyncBeanDef<Activity> bean1 = mock(SyncBeanDef.class);\n        SyncBeanDef<Activity> bean2 = mock(SyncBeanDef.class);\n        SyncBeanDef<Activity> bean3 = mock(SyncBeanDef.class);\n        SyncBeanDef<Activity> bean4 = mock(SyncBeanDef.class);\n        PerspectiveActivity perspective1 = mock(AbstractWorkbenchPerspectiveActivity.class);\n        PerspectiveActivity perspective2 = mock(PerspectiveActivity.class);\n        PerspectiveActivity perspective3 = mock(PerspectiveActivity.class);\n        PerspectiveActivity perspective4 = mock(AbstractWorkbenchPerspectiveActivity.class);\n        when(bean1.getInstance()).thenReturn(perspective1);\n        when(bean2.getInstance()).thenReturn(perspective2);\n        when(bean3.getInstance()).thenReturn(perspective3);\n        when(bean4.getInstance()).thenReturn(perspective4);\n        when(perspective1.getIdentifier()).thenReturn(\"Perspective1\");\n        when(perspective2.getIdentifier()).thenReturn(\"Perspective2\");\n        when(perspective3.getIdentifier()).thenReturn(\"org.Perspective3\");\n        when(perspective4.getIdentifier()).thenReturn(\"org.Perspective4\");\n        beanDefs.add(bean1);\n        beanDefs.add(bean2);\n        beanDefs.add(bean3);\n        beanDefs.add(bean4);\n        when(activityBeansCache.getActivity(\"org.Perspective3\")).thenReturn(bean3);\n        when(activityBeansCache.getActivity(\"org.Perspective4\")).thenReturn(bean4);\n        when(activityBeansCache.getPerspectiveActivities()).thenReturn(beanDefs);\n\n        permissionManager = new DefaultPermissionManager();\n        provider = new PerspectiveTreeProvider(activityBeansCache,\n                                               permissionManager,\n                                               i18n);\n        provider.setRootNodeName(\"root\");\n        provider.setPerspectiveName(\"Perspective1\",\n                                    \"A nice perspective\");\n        provider.setPerspectiveName(\"Perspective2\",\n                                    \"Another nice perspective\");\n        root = provider.buildRootNode();\n        root.setPermissionTree(permissionTree);\n    }\n\n    @Test\n    public void testEmpty() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               0);\n                              });\n    }\n\n    @Test\n    public void testIncludedResourceIds() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setResourceIds(Arrays.asList(\"Perspective1\"));\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                              });\n    }\n\n    @Test\n    public void testExcludedResourceIds() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setResourceIds(Arrays.asList(\"Perspective1\"));\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                              });\n    }\n\n    @Test\n    public void testExcludedPerspectiveIds() {\n        provider.excludePerspectiveId(\"Perspective1\");\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               3);\n                              });\n    }\n\n    @Test\n    public void testNameSearch1() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"nice\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               2);\n                              });\n    }\n\n    @Test\n    public void testNameSearch2() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"another\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                              });\n    }\n\n    @Test\n    public void testNameSearch3() {\n        DefaultLoadOptions options = new DefaultLoadOptions();\n        options.setNodeNamePattern(\"another\");\n        provider.loadChildren(root,\n                              options,\n                              children -> {\n                                  assertEquals(children.size(),\n                                               1);\n                              });\n    }\n\n    @Test\n    public void testRootNode() {\n        assertEquals(root.getPermissionList().size(),\n                     4);\n        checkDependencies(root, 3);\n    }\n\n    @Test\n    public void testChildrenNodes() {\n        root.expand(children -> {\n            for (PermissionNode child : children) {\n                assertEquals(child.getPermissionList().size(),\n                             3);\n                checkDependencies(child, 2);\n            }\n        });\n    }\n\n    @Test\n    public void testPerspectiveName() {\n        String name = provider.getPerspectiveName(\"Perspective1\");\n        assertEquals(name, \"A nice perspective\");\n        name = provider.getPerspectiveName(\"Perspective2\");\n        assertEquals(name, \"Another nice perspective\");\n        name = provider.getPerspectiveName(\"org.Perspective3\");\n        assertEquals(name, \"org.Perspective3\");\n        name = provider.getPerspectiveName(\"org.Perspective4\");\n        assertEquals(name, \"Perspective4\");\n    }\n\n    protected void checkDependencies(PermissionNode permissionNode, int numberOfDependencies) {\n        for (Permission permission : permissionNode.getPermissionList()) {\n            Collection<Permission> dependencies = permissionNode.getDependencies(permission);\n\n            if (permission.getName().startsWith(\"perspective.read\")) {\n                assertEquals(dependencies.size(),\n                             numberOfDependencies);\n            } else {\n                assertNull(dependencies);\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/authz/WorkbenchControllerTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.authz;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchControllerTest {\n\n    @Mock\n    User user;\n\n    @Mock\n    Command onGranted;\n\n    @Mock\n    Command onDenied;\n\n    @Mock\n    AuthorizationManager authorizationManager;\n\n    @Mock\n    PerspectiveActivity perspectiveActivity;\n\n    @InjectMocks\n    DefaultWorkbenchController workbenchController;\n\n    @Before\n    public void setUp() {\n    }\n\n    @Test\n    public void testPerspectiveUpdateAction() {\n        workbenchController.perspective(perspectiveActivity).update()\n                .granted(onGranted)\n                .denied(onDenied);\n\n        verify(authorizationManager).authorize(perspectiveActivity,\n                                               PerspectiveAction.UPDATE,\n                                               user);\n    }\n\n    @Test\n    public void testPerspectiveDeleteAction() {\n        workbenchController.perspective(perspectiveActivity).delete()\n                .granted(onGranted)\n                .denied(onDenied);\n\n        verify(authorizationManager).authorize(perspectiveActivity,\n                                               PerspectiveAction.DELETE,\n                                               user);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/AbstractActivityTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport org.junit.Test;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.Mockito.verify;\n\n/**\n * Base class for testing Activity implementations. All Activity unit tests should extend this one; it tests the Activity contract.\n */\npublic abstract class AbstractActivityTest {\n\n    /**\n     * Subclasses should implement this method to return the object they are unit testing.\n     */\n    public abstract Activity getActivityUnderTest();\n\n    /**\n     * Subclasses should implement this method to return the PlaceManager they are using for checking purposes.\n     */\n    public abstract PlaceManager getPlaceManager();\n\n    @Test(expected = IllegalStateException.class)\n    public void onOpenShouldFailWhenActivityNotStarted() {\n        getActivityUnderTest().onOpen();\n    }\n\n    @Test\n    public void onOpenShouldSucceedWhenActivityStarted() throws Exception {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        verify(getPlaceManager()).executeOnOpenCallbacks(a.getPlace());\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onOpenShouldFailWhenActivityAlreadyOpen() {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        a.onOpen();\n    }\n\n    @Test\n    public void onShutdownShouldSucceedWhenActivityNeverOpened() throws Exception {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onShutdown();\n    }\n\n    @Test\n    public void onCloseShouldSucceedWhenActivityOpened() throws Exception {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        a.onClose();\n        verify(getPlaceManager()).executeOnCloseCallbacks(a.getPlace());\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onCloseShouldFailWhenActivityNotStarted() {\n        getActivityUnderTest().onClose();\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onCloseShouldFailWhenActivityNotOpen() {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onClose();\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onCloseShouldFailWhenActivityAlreadyClosed() {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        a.onClose();\n        a.onClose();\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onShutdownShouldFailWhenActivityNotStarted() {\n        getActivityUnderTest().onShutdown();\n    }\n\n    @Test(expected = IllegalStateException.class)\n    public void onShutdownShouldFailWhenActivityOpen() {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        a.onShutdown();\n    }\n\n    @Test\n    public void fullLifecycleShouldSucceed() throws Exception {\n        Activity a = getActivityUnderTest();\n        a.onStartup(new DefaultPlaceRequest(\"testplace\"));\n        a.onOpen();\n        a.onClose();\n        a.onShutdown();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/AbstractPerspectiveActivityTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class AbstractPerspectiveActivityTest extends AbstractActivityTest {\n\n    PerspectiveDefinition perspectiveDef;\n\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    PanelManager panelManager;\n    @Mock\n    WorkbenchServicesProxy wbServices;\n\n    @InjectMocks\n    AbstractWorkbenchPerspectiveActivity activity = new AbstractWorkbenchPerspectiveActivity(placeManager) {\n\n        @Override\n        public PerspectiveDefinition getDefaultPerspectiveLayout() {\n            return perspectiveDef;\n        }\n\n        @Override\n        public String getIdentifier() {\n            throw new UnsupportedOperationException(\"Not implemented.\");\n        }\n    };\n\n    @SuppressWarnings(\"unchecked\")\n    @Before\n    public void setup() {\n        perspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(panelManager.getRoot()).thenReturn(mock(PanelDefinition.class));\n\n        doAnswer(new Answer<Object>() {\n            @SuppressWarnings(\"rawtypes\")\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                ((ParameterizedCommand) invocation.getArguments()[1]).execute(perspectiveDef);\n                return null;\n            }\n        }).when(wbServices).loadPerspective(any(String.class),\n                                            any(ParameterizedCommand.class));\n    }\n\n    @Override\n    public Activity getActivityUnderTest() {\n        return activity;\n    }\n\n    @Override\n    public PlaceManager getPlaceManager() {\n        return placeManager;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/AbstractPopupActivityTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class AbstractPopupActivityTest extends AbstractActivityTest {\n\n    @Mock\n    IsWidget popupWidget;\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    PopupView popupView;\n\n    TestingPopupActivity popupActivity;\n\n    /**\n     * When popupActivity.open() is called, the CloseHandler that it registers on the mock PopupView will be captured\n     * here.\n     */\n    CloseHandler<PopupView> registeredCloseHandler;\n\n    /**\n     * The HandlerRegistration that the mock PopupView returned to the Activity.\n     */\n    HandlerRegistration closeHandlerRegistration;\n\n    /**\n     * The place given to popupActivity when it was started by the setup method.\n     */\n    private PlaceRequest popupPlace;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n        when(popupView.addCloseHandler(any(CloseHandler.class))).thenAnswer(new Answer<HandlerRegistration>() {\n            @Override\n            public HandlerRegistration answer(InvocationOnMock invocation) throws Throwable {\n                registeredCloseHandler = (CloseHandler<PopupView>) invocation.getArguments()[0];\n                closeHandlerRegistration = mock(HandlerRegistration.class);\n                return closeHandlerRegistration;\n            }\n        });\n        popupActivity = new TestingPopupActivity(placeManager,\n                                                 popupView);\n        popupPlace = new DefaultPlaceRequest(\"PopupPlace\");\n    }\n\n    @Override\n    public Activity getActivityUnderTest() {\n        return popupActivity;\n    }\n\n    @Override\n    public PlaceManager getPlaceManager() {\n        return placeManager;\n    }\n\n    @Test\n    public void shouldShowViewInOnOpen() throws Exception {\n        popupActivity.onStartup(popupPlace);\n        popupActivity.onOpen();\n        verify(popupView,\n               times(1)).show();\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void shouldUsePlaceManagerToCloseSelfOnViewClosedCallback() throws Exception {\n        popupActivity.onStartup(popupPlace);\n        popupActivity.onOpen();\n        registeredCloseHandler.onClose(mock(CloseEvent.class));\n        verify(placeManager,\n               times(1)).closePlace(popupPlace);\n    }\n\n    @Test\n    public void shouldCloseViewInOnClose() throws Exception {\n        popupActivity.onStartup(popupPlace);\n        popupActivity.onOpen();\n        popupActivity.onClose();\n        verify(popupView,\n               times(1)).hide();\n    }\n\n    /**\n     * Test to ensure we don't start an infinite loop when someone clicks the \"X\" in the popup header.\n     * See also the complementary test, {@link #shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager()}.\n     */\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void shouldNotCallHideOnViewWhenCloseOperationTriggeredByView() throws Exception {\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                // simulate is what PlaceManager will do in response to the close hook\n                popupActivity.onClose();\n                return null;\n            }\n        }).when(placeManager).closePlace(popupPlace);\n\n        popupActivity.onStartup(popupPlace);\n        popupActivity.onOpen();\n        registeredCloseHandler.onClose(mock(CloseEvent.class));\n\n        verify(placeManager,\n               times(1)).closePlace(popupPlace);\n\n        // we shouldn't call hide() on the popup, because this sequence of events\n        // was triggered by the fact that it was already hiding itself\n        verify(popupView,\n               never()).hide();\n    }\n\n    /**\n     * Test to ensure we don't start an infinite loop when the PlaceManager closes the activity.\n     * See also the complementary case, {@link #shouldNotCallHideOnViewWhenCloseOperationTriggeredByView()}.\n     */\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void shouldNotCallCloseOnPlaceManagerWhenCloseOperationTriggeredByPlaceManager() throws Exception {\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                // simulate is what PopupView will do in response to hide()\n                registeredCloseHandler.onClose(mock(CloseEvent.class));\n                return null;\n            }\n        }).when(popupView).hide();\n\n        popupActivity.onStartup(popupPlace);\n        popupActivity.onOpen();\n        popupActivity.onClose();\n\n        verify(popupView).hide();\n\n        // PlaceManager initiated this operation, so we mustn't call back into it\n        verify(placeManager,\n               never()).closePlace(popupPlace);\n    }\n\n    private final class TestingPopupActivity extends AbstractPopupActivity {\n\n        public TestingPopupActivity(PlaceManager placeManager,\n                                    PopupView popupView) {\n            super(placeManager,\n                  popupView);\n        }\n\n        @Override\n        public IsWidget getWidget() {\n            return popupWidget;\n        }\n\n        @Override\n        public String getTitle() {\n            return \"Testing Popup Activity\";\n        }\n\n        @Override\n        public String getIdentifier() {\n            return \"fake.popup.Activity\";\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityBeansCacheActivatedByTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.List;\nimport javax.enterprise.event.Event;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.util.GWTEditorNativeRegister;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.events.NewPerspectiveEvent;\nimport org.uberfire.client.workbench.events.NewWorkbenchScreenEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.client.workbench.type.DotResourceType;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.workbench.category.Others;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n/**\n * Tests that {@link ActivityBeansCache} respects the active flag controlled by the {@code @ActivatedBy} annotation.\n */\n@RunWith(GwtMockitoTestRunner.class)\n@SuppressWarnings(\"rawtypes\")\npublic class ActivityBeansCacheActivatedByTest {\n\n    private static final IsSplashScreen IS_SPLASH_SCREEN = new IsSplashScreen() {\n        @Override\n        public Class<? extends Annotation> annotationType() {\n            return IsSplashScreen.class;\n        }\n    };\n    private static final AssociatedResources ASSOCIATED_RESOURCES = new AssociatedResources() {\n\n        @Override\n        public Class<? extends Annotation> annotationType() {\n            return AssociatedResources.class;\n        }\n\n        @SuppressWarnings(\"unchecked\")\n        @Override\n        public Class<? extends ClientResourceType>[] value() {\n            return (Class<? extends ClientResourceType>[]) new Class<?>[]{DotResourceType.class};\n        }\n    };\n\n    private ActivityBeansCache activityBeansCache;\n    @Mock\n    private SyncBeanManager iocManager;\n\n    private Event<NewPerspectiveEvent> newPerspectiveEventEvent;\n    private Event<NewWorkbenchScreenEvent> newWorkbenchScreenEventEvent;\n\n    @Mock\n    private CategoriesManagerCache categoriesManagerCache;\n\n    private ResourceTypeManagerCache resourceTypeManagerCache;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @Mock\n    private GWTEditorNativeRegister gwtEditorNativeRegister;\n\n    private ActiveSplashScreenActivity activeSplashScreenActivity;\n    private SyncBeanDef activeSplashScreenActivityBean;\n    private SyncBeanDef nonActiveSplashScreenActivityBean;\n    private ActiveRegularActivity activeRegularActivity;\n    private SyncBeanDef activeRegularActivityBean;\n    private SyncBeanDef nonActiveRegularActivityBean;\n    private ActiveResourceActivity activeResourceActivity;\n    private SyncBeanDef activeResourceActivityBean;\n    private SyncBeanDef nonActiveResourceActivityBean;\n\n    @Before\n    @SuppressWarnings(\"unchecked\")\n    public void setup() {\n\n        this.resourceTypeManagerCache = new ResourceTypeManagerCache(categoriesManagerCache);\n\n        newPerspectiveEventEvent = new EventSourceMock<>();\n        newWorkbenchScreenEventEvent = new EventSourceMock<>();\n        activityBeansCache = new ActivityBeansCache(iocManager,\n                                                    newPerspectiveEventEvent,\n                                                    newWorkbenchScreenEventEvent,\n                                                    resourceTypeManagerCache,\n                                                    experimentalActivitiesAuthorizationManager,\n                                                    gwtEditorNativeRegister);\n\n        activeSplashScreenActivity = mock(ActiveSplashScreenActivity.class);\n        activeSplashScreenActivityBean = mockSplashScreenActivityBean(ActiveSplashScreenActivity.class,\n                                                                      activeSplashScreenActivity);\n\n        nonActiveSplashScreenActivityBean = mockSplashScreenActivityBean(NonActiveSplashScreenActivity.class,\n                                                                         null);\n\n        activeRegularActivity = mock(ActiveRegularActivity.class);\n        activeRegularActivityBean = mockRegularBean(ActiveRegularActivity.class,\n                                                    activeRegularActivity);\n\n        nonActiveRegularActivityBean = mockRegularBean(NonActiveRegularActivity.class,\n                                                       null);\n\n        activeResourceActivity = mock(ActiveResourceActivity.class);\n        activeResourceActivityBean = mockResourceActivityBean(ActiveResourceActivity.class,\n                                                              activeResourceActivity);\n        mockRegularBean(DotResourceType.class,\n                        new DotResourceType(new Others()));\n\n        nonActiveResourceActivityBean = mockResourceActivityBean(NonActiveResourceActivity.class,\n                                                                 null);\n\n        Collection<SyncBeanDef<SplashScreenActivity>> splashScreenBeans = new ArrayList<SyncBeanDef<SplashScreenActivity>>();\n        splashScreenBeans.add(activeSplashScreenActivityBean);\n        splashScreenBeans.add(nonActiveSplashScreenActivityBean);\n\n        // all activity beans, including splash screens\n        Collection<SyncBeanDef<Activity>> allActivityBeans = new ArrayList<SyncBeanDef<Activity>>();\n        allActivityBeans.add(activeSplashScreenActivityBean);\n        allActivityBeans.add(nonActiveSplashScreenActivityBean);\n        allActivityBeans.add(activeRegularActivityBean);\n        allActivityBeans.add(nonActiveRegularActivityBean);\n        allActivityBeans.add(activeResourceActivityBean);\n        allActivityBeans.add(nonActiveResourceActivityBean);\n\n        when(iocManager.lookupBeans(SplashScreenActivity.class)).thenReturn(splashScreenBeans);\n        when(iocManager.lookupBeans(Activity.class)).thenReturn(allActivityBeans);\n    }\n\n    @Test\n    public void shouldNotReturnInactiveBeansFromGetSplashScreens() throws Exception {\n        activityBeansCache.init();\n        List<SplashScreenActivity> splashScreens = activityBeansCache.getSplashScreens();\n\n        assertEquals(1,\n                     splashScreens.size());\n        assertSame(activeSplashScreenActivity,\n                   splashScreens.iterator().next());\n    }\n\n    @Test\n    public void cacheShouldNotReturnInactiveBeansFromGetResourceActivities() throws Exception {\n        activityBeansCache.init();\n        List<ActivityAndMetaInfo> activityBeans = this.resourceTypeManagerCache.getResourceActivities();\n\n        assertEquals(1,\n                     activityBeans.size());\n        assertSame(activeResourceActivityBean,\n                   activityBeans.get(0).getActivityBean());\n    }\n\n    @Test\n    public void cacheShouldNotReturnInactiveBeansByName() throws Exception {\n        activityBeansCache.init();\n\n        assertSame(activeSplashScreenActivityBean,\n                   activityBeansCache.getActivity(\"ActiveSplashScreenActivity\"));\n        assertSame(activeResourceActivityBean,\n                   activityBeansCache.getActivity(\"ActiveResourceActivity\"));\n        assertSame(activeRegularActivityBean,\n                   activityBeansCache.getActivity(\"ActiveRegularActivity\"));\n        assertNull(activityBeansCache.getActivity(\"NonActiveSplashScreenActivity\"));\n        assertNull(activityBeansCache.getActivity(\"NonActiveResourceActivity\"));\n        assertNull(activityBeansCache.getActivity(\"NonActiveRegularActivity\"));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> SyncBeanDef mockRegularBean(Class<T> type,\n                                            T instance) {\n        SyncBeanDef<T> beanDef = mock(SyncBeanDef.class);\n        when(iocManager.lookupBeans(type.getName())).thenReturn(Collections.singleton(beanDef));\n        when(beanDef.getInstance()).thenReturn(instance);\n        when(beanDef.getBeanClass()).thenReturn((Class) type);\n        when(beanDef.isActivated()).thenReturn(instance != null);\n        when(beanDef.getName()).thenReturn(type.getSimpleName());\n        return beanDef;\n    }\n\n    private <T extends SplashScreenActivity> SyncBeanDef mockSplashScreenActivityBean(Class<T> type,\n                                                                                      T instance) {\n        SyncBeanDef beanDef = mockRegularBean(type,\n                                              instance);\n        when(beanDef.getQualifiers()).thenReturn(Collections.singleton(IS_SPLASH_SCREEN));\n        return beanDef;\n    }\n\n    private <T extends Activity> SyncBeanDef mockResourceActivityBean(Class<T> type,\n                                                                      T instance) {\n        SyncBeanDef beanDef = mockRegularBean(type,\n                                              instance);\n        when(beanDef.getQualifiers()).thenReturn(Collections.singleton(ASSOCIATED_RESOURCES));\n        return beanDef;\n    }\n\n    interface ActiveSplashScreenActivity extends SplashScreenActivity {\n\n    }\n\n    interface NonActiveSplashScreenActivity extends SplashScreenActivity {\n\n    }\n\n    interface ActiveRegularActivity extends Activity {\n\n    }\n\n    interface NonActiveRegularActivity extends Activity {\n\n    }\n\n    interface ActiveResourceActivity extends Activity {\n\n    }\n\n    interface NonActiveResourceActivity extends Activity {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityBeansCacheTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.util.GWTEditorNativeRegister;\nimport org.uberfire.client.workbench.events.NewPerspectiveEvent;\nimport org.uberfire.client.workbench.events.NewWorkbenchScreenEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.workbench.category.Category;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ActivityBeansCacheTest {\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private Event<NewPerspectiveEvent> newPerspectiveEventEvent;\n\n    @Mock\n    private Event<NewWorkbenchScreenEvent> newWorkbenchScreenEvent;\n\n    @Mock\n    private CategoriesManagerCache categoriesManagerCache;\n\n    private ResourceTypeManagerCache resourceTypeManagerCache;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @Mock\n    private GWTEditorNativeRegister gwtEditorNativeRegister;\n\n    @InjectMocks\n    ActivityBeansCache cache;\n\n    @Before\n    public void setUp() {\n        resourceTypeManagerCache = new ResourceTypeManagerCache(categoriesManagerCache);\n\n        cache = spy(new ActivityBeansCache(iocManager,\n                                       newPerspectiveEventEvent,\n                                       newWorkbenchScreenEvent,\n                                       resourceTypeManagerCache,\n                                       experimentalActivitiesAuthorizationManager,\n                                       gwtEditorNativeRegister));\n    }\n\n    @Test\n    public void initShouldCacheSplashScreen() throws Exception {\n        ActivityBeansCacheUnitTestWrapper cache = new ActivityBeansCacheUnitTestWrapper();\n        cache.mockSplashScreenBehaviour();\n\n        cache.init();\n\n        assertEquals(cache.getMockDef(),\n                     cache.getActivity(cache.getIdMock()));\n        assertTrue(cache.getSplashScreens().contains(cache.getActivity()));\n    }\n\n    @Test\n    public void initShouldCacheClientEditors() throws Exception {\n        ActivityBeansCacheUnitTestWrapper cache = spy(new ActivityBeansCacheUnitTestWrapper());\n        cache.mockClientEditorBehaviour();\n\n        cache.init();\n\n        verify(cache).registerGwtClientBean(eq(\"mockDef1\"), any());\n\n        assertEquals(cache.getMockDef(),\n                     cache.getActivity(cache.getIdMock()));\n        assertTrue(cache.getActivitiesById().contains(cache.getActivity().getIdentifier()));\n    }\n\n    @Test\n    public void initShouldCacheActivityById() throws Exception {\n        ActivityBeansCacheUnitTestWrapper cache = new ActivityBeansCacheUnitTestWrapper();\n        cache.mockSplashScreenBehaviour();\n\n        cache.init();\n\n        assertEquals(cache.getMockDef(),\n                     cache.getActivity(cache.getIdMock()));\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void initShouldNotAllowTwoIdenticalsActivities() throws Exception {\n        ActivityBeansCacheUnitTestWrapper cache = new ActivityBeansCacheUnitTestWrapper();\n        cache.mockSplashScreenBehaviour();\n        cache.duplicateActivity();\n\n        cache.init();\n    }\n\n    @Test\n    public void initShouldCacheOtherActivities() throws Exception {\n        ActivityBeansCacheUnitTestWrapper cache = new ActivityBeansCacheUnitTestWrapper();\n        cache.mockActivityBehaviour();\n        cache.init();\n\n        assertFalse(cache.getResourceTypeManagerCache().getResourceActivities().isEmpty());\n    }\n\n    @Test\n    public void initShouldOrderActivityByPriority() throws Exception {\n\n        ActivityBeansCacheUnitTestWrapper cache = new ActivityBeansCacheUnitTestWrapper();\n\n        int priorityActivityOne = Integer.MIN_VALUE;\n        int priorityActivityTwo = Integer.MAX_VALUE;\n\n        cache.createActivitiesAndMetaInfo(priorityActivityOne,\n                                          priorityActivityTwo);\n\n        ActivityAndMetaInfo firstActivityOnList = cache.getResourceTypeManagerCache().getResourceActivities().get(0);\n        ActivityAndMetaInfo secondActivityOnList = cache.getResourceTypeManagerCache().getResourceActivities().get(1);\n\n        assertEquals(priorityActivityOne,\n                     firstActivityOnList.getPriority());\n        assertEquals(priorityActivityTwo,\n                     secondActivityOnList.getPriority());\n\n        cache.getResourceTypeManagerCache().sortResourceActivitiesByPriority();\n\n        firstActivityOnList = cache.getResourceTypeManagerCache().getResourceActivities().get(0);\n        secondActivityOnList = cache.getResourceTypeManagerCache().getResourceActivities().get(1);\n\n        assertEquals(priorityActivityTwo,\n                     firstActivityOnList.getPriority());\n        assertEquals(priorityActivityOne,\n                     secondActivityOnList.getPriority());\n    }\n\n    @Test\n    public void activityAndMetaInfoShouldLookupResourceTypesOnRuntime() {\n        ClientResourceType clientResourceType = mock(ClientResourceType.class);\n        SyncBeanDef<ClientResourceType> syncBeanDef = mock(SyncBeanDef.class);\n        when(syncBeanDef.getInstance()).thenReturn(clientResourceType);\n        Collection<SyncBeanDef> resourceTypeBeans = Arrays.asList(syncBeanDef);\n        when(iocManager.lookupBeans(\"resource1\")).thenReturn(resourceTypeBeans);\n\n        ActivityAndMetaInfo activatedActivityAndMetaInfo =\n                new ActivityAndMetaInfo(iocManager,\n                                        mock(SyncBeanDef.class),\n                                        0,\n                                        Arrays.asList(\"resource1\"));\n        assertNull(activatedActivityAndMetaInfo.resourceTypes);\n        assertTrue(!activatedActivityAndMetaInfo.resourceTypesNames.isEmpty());\n\n        activatedActivityAndMetaInfo.getResourceTypes();\n\n        assertTrue(activatedActivityAndMetaInfo.resourceTypes.length > 0);\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void dynamicLookupOfResourceTypeShouldFailWhenThereIsNoResource() {\n        Collection<SyncBeanDef> resourceTypeBeans = new ArrayList<>();\n        when(iocManager.lookupBeans(\"resource1\")).thenReturn(resourceTypeBeans);\n\n        ActivityAndMetaInfo activatedActivityAndMetaInfo =\n                new ActivityAndMetaInfo(iocManager,\n                                        mock(SyncBeanDef.class),\n                                        0,\n                                        Arrays.asList(\"resource1\"));\n\n        activatedActivityAndMetaInfo.getResourceTypes();\n    }\n\n    @Test\n    public void addEditorActivityShouldSortResourcesByPriority() {\n        String higherPriority = \"20000\";\n        String lowerPriority = \"1\";\n\n        Collection<SyncBeanDef> resourceTypeBeans = createResourceType(\"MODEL\");\n        when(iocManager.lookupBeans(eq(\"resource\"))).thenReturn(resourceTypeBeans);\n\n        Collection<SyncBeanDef> resourceTypeBeans1 = createResourceType(\"MODEL\");\n        when(iocManager.lookupBeans(eq(\"resource1\"))).thenReturn(resourceTypeBeans1);\n\n        SyncBeanDef mock = mock(SyncBeanDef.class);\n        when(mock.getName()).thenReturn(\"resource1\");\n        cache.addNewEditorActivity(mock,\n                                   lowerPriority,\n                                   \"resource\");\n        SyncBeanDef mock1 = mock(SyncBeanDef.class);\n        when(mock1.getName()).thenReturn(\"resource2\");\n        cache.addNewEditorActivity(mock1,\n                                   higherPriority,\n                                   \"resource1\");\n        List<ActivityAndMetaInfo> resourceActivities = this.resourceTypeManagerCache.getResourceActivities();\n\n        assertEquals(resourceActivities.get(0).getPriority(),\n                     Integer.valueOf(higherPriority).intValue());\n    }\n\n    private Collection<SyncBeanDef> createResourceType(String type) {\n        Category model = mock(Category.class);\n        ClientResourceType clientResourceType = mock(ClientResourceType.class);\n        SyncBeanDef<ClientResourceType> syncBeanDef = mock(SyncBeanDef.class);\n        when(syncBeanDef.getInstance()).thenReturn(clientResourceType);\n        return Arrays.asList(syncBeanDef);\n    }\n\n    @Test\n    public void addEditorActivityShouldAddToActivitiesByID() {\n        String resource = \"resource\";\n\n        Collection<SyncBeanDef> resourceTypeBeans = createResourceType(\"MODEL\");\n        when(iocManager.lookupBeans(eq(resource))).thenReturn(resourceTypeBeans);\n\n        SyncBeanDef mock = mock(SyncBeanDef.class);\n        when(mock.getName()).thenReturn(resource);\n        cache.addNewEditorActivity(mock,\n                                   \"1\",\n                                   resource);\n\n        assertTrue(cache.hasActivity(resource));\n    }\n\n    @Test\n    public void getPerspectiveActivities() {\n        SyncBeanDef mock1 = mock(SyncBeanDef.class);\n        when(mock1.getName()).thenReturn(\"perspective2\");\n        when(mock1.isAssignableTo(PerspectiveActivity.class)).thenReturn(true);\n\n        SyncBeanDef mock2 = mock(SyncBeanDef.class);\n        when(mock2.getName()).thenReturn(\"screen\");\n        when(mock2.isAssignableTo(PerspectiveActivity.class)).thenReturn(false);\n\n        cache.addNewPerspectiveActivity(mock1);\n        cache.addNewPerspectiveActivity(mock2);\n\n        List<SyncBeanDef<Activity>> perspectiveActivities = cache.getPerspectiveActivities();\n        assertEquals(perspectiveActivities.size(),\n                     1);\n    }\n\n    @Test\n    public void getActivitiesNull() {\n        assertNull(cache.getActivity((String) null));\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityBeansCacheUnitTestWrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.workbench.category.Undefined;\n\nimport static org.mockito.Mockito.*;\n\n\npublic class ActivityBeansCacheUnitTestWrapper extends ActivityBeansCache {\n\n\n    @IsSplashScreen\n    @ApplicationScoped\n    private static class SplashScreenForTesting {\n\n    }\n\n    @IsClientEditor\n    private static class ClientEditor {\n\n    }\n\n    private String idMock;\n    private SyncBeanDef mockDef;\n    private Activity activity;\n    private Collection<SyncBeanDef<Activity>> availableActivities = new HashSet<SyncBeanDef<Activity>>();\n    private Pair<Integer, List<String>> metaInfo;\n\n    public ActivityBeansCacheUnitTestWrapper() {\n        this.resourceTypeManagerCache = new ResourceTypeManagerCache(new CategoriesManagerCache(new Undefined()));\n        mockDef = mock(SyncBeanDef.class);\n        idMock = \"mockDef1\";\n        when(mockDef.getName()).thenReturn(idMock);\n        availableActivities.add(mockDef);\n    }\n\n    @Override\n    void registerGwtEditorProvider() {\n        //do nothing\n    }\n\n    @Override\n    void registerGwtClientBean(String id, SyncBeanDef<Activity> activityBean) {\n        //do nothing\n    }\n\n    public void mockSplashScreenBehaviour() {\n        Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(SplashScreenForTesting.class.getAnnotations()));\n        when(mockDef.getQualifiers()).thenReturn(annotations);\n\n        activity = mock(AbstractSplashScreenActivity.class);\n        when(mockDef.getInstance()).thenReturn(activity);\n    }\n\n    public void mockClientEditorBehaviour() {\n        Set<Annotation> annotations = new HashSet<Annotation>(Arrays.asList(ClientEditor.class.getAnnotations()));\n        when(mockDef.getQualifiers()).thenReturn(annotations);\n\n        activity = mock(WorkbenchClientEditorActivity.class);\n        when(activity.getIdentifier()).thenReturn(idMock);\n    }\n\n    public void createActivitiesAndMetaInfo(int priority1,\n                                            int priority2) {\n        resourceTypeManagerCache.addResourceActivity(new ActivityAndMetaInfo(null,\n                                                                             null,\n                                                                             priority1,\n                                                                             new ArrayList()));\n        resourceTypeManagerCache.addResourceActivity(new ActivityAndMetaInfo(null,\n                                                                             null,\n                                                                             priority2,\n                                                                             new ArrayList()));\n    }\n\n    public ResourceTypeManagerCache getResourceTypeManagerCache() {\n        return this.resourceTypeManagerCache;\n    }\n\n    @Override\n    Collection<SyncBeanDef<Activity>> getAvailableActivities() {\n        return availableActivities;\n    }\n\n    public SyncBeanDef getMockDef() {\n        return mockDef;\n    }\n\n    public Activity getActivity() {\n        return activity;\n    }\n\n    public String getIdMock() {\n        return idMock;\n    }\n\n    public void duplicateActivity() {\n        SyncBeanDef duplicateMockDef = mock(SyncBeanDef.class);\n        when(duplicateMockDef.getName()).thenReturn(idMock);\n        availableActivities.add(duplicateMockDef);\n    }\n\n    @Override\n    Pair<Integer, List<String>> generateActivityMetaInfo(SyncBeanDef<Activity> activityBean) {\n        return metaInfo;\n    }\n\n    public void mockActivityBehaviour() {\n        metaInfo = mock(Pair.class);\n        when(metaInfo.getK1()).thenReturn(new Integer(1));\n        when(metaInfo.getK2()).thenReturn(new ArrayList<String>());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityBeansInfoTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashSet;\nimport java.util.Set;\nimport javax.inject.Named;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ActivityBeansInfoTest {\n\n    @Mock\n    private SyncBeanManager syncBeanManager;\n\n    @Mock\n    private ActivityBeansCache activityBeansCache;\n\n    private ActivityBeansInfo activityBeansInfo;\n\n    @Before\n    public void setup() {\n        activityBeansInfo = new ActivityBeansInfo(syncBeanManager, activityBeansCache);\n    }\n\n    @Test\n    public void getAvaliableWorkbenchScreensIdsTest() {\n        when(syncBeanManager.lookupBeans(WorkbenchScreenActivity.class))\n                .thenReturn(generateBeansList());\n\n        assertEquals(4,\n                     activityBeansInfo.getAvailableWorkbenchScreensIds().size());\n        //assert bean order\n        assertEquals(\"A\",\n                     activityBeansInfo.getAvailableWorkbenchScreensIds().get(0));\n        assertEquals(\"a\",\n                     activityBeansInfo.getAvailableWorkbenchScreensIds().get(1));\n        assertEquals(\"Z\",\n                     activityBeansInfo.getAvailableWorkbenchScreensIds().get(2));\n        assertEquals(\"z\",\n                     activityBeansInfo.getAvailableWorkbenchScreensIds().get(3));\n    }\n\n    private Collection<SyncBeanDef<WorkbenchScreenActivity>> generateBeansList() {\n        Collection<SyncBeanDef<WorkbenchScreenActivity>> beans = new ArrayList<SyncBeanDef<WorkbenchScreenActivity>>();\n\n        beans.add(generateBeanDef(\"Z\",\n                                  true));\n        beans.add(generateBeanDef(\"A\",\n                                  false));\n        beans.add(generateBeanDef(\"a\",\n                                  false));\n        beans.add(generateBeanDef(\"z\",\n                                  false));\n\n        return beans;\n    }\n\n    private SyncBeanDef<WorkbenchScreenActivity> generateBeanDef(final String beanName,\n                                                                 final boolean hasAnnotations) {\n        return new SyncBeanDef<WorkbenchScreenActivity>() {\n            @Override\n            public Class<WorkbenchScreenActivity> getType() {\n                return null;\n            }\n\n            @Override\n            public Class<?> getBeanClass() {\n                return null;\n            }\n\n            @Override\n            public Class<? extends Annotation> getScope() {\n                return null;\n            }\n\n            @Override\n            public WorkbenchScreenActivity getInstance() {\n                return null;\n            }\n\n            @Override\n            public WorkbenchScreenActivity newInstance() {\n                return null;\n            }\n\n            @Override\n            public Set<Annotation> getQualifiers() {\n                final HashSet<Annotation> annotations = new HashSet<Annotation>();\n                if (hasAnnotations) {\n                    annotations.add(new Named() {\n\n                        @Override\n                        public Class<? extends Annotation> annotationType() {\n                            return null;\n                        }\n\n                        @Override\n                        public String value() {\n                            return \"Z\";\n                        }\n                    });\n                }\n                return annotations;\n            }\n\n            @Override\n            public boolean matches(Set<Annotation> annotations) {\n                return false;\n            }\n\n            @Override\n            public String getName() {\n                return beanName;\n            }\n\n            @Override\n            public boolean isActivated() {\n                return false;\n            }\n\n            @Override\n            public boolean isAssignableTo(Class<?> type) {\n                return WorkbenchScreenActivity.class.equals(type);\n            }\n        };\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityManagerActivatedByTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static java.util.Collections.singletonList;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n/**\n * Mock-based tests for how ActivityManager handles beans affected by Errai IOC's {@code @ActivatedBy} feature.\n */\n@RunWith(GwtMockitoTestRunner.class)\npublic class ActivityManagerActivatedByTest {\n\n    @SuppressWarnings(\"unchecked\")\n    private final SyncBeanDef<Activity> activatedActivityBean = mock(SyncBeanDef.class);\n    @SuppressWarnings(\"unchecked\")\n    private final SyncBeanDef<Activity> nonActivatedActivityBean = mock(SyncBeanDef.class);\n    /**\n     * The thing we're unit testing\n     */\n    @InjectMocks\n    private ActivityManagerImpl activityManager;\n    @Mock\n    private ActivityBeansCache activityBeansCache;\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private ResourceTypeManagerCache resourceTypeManagerCache;\n\n    @Mock\n    private AuthorizationManager authzManager;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n\n    private Activity activatedActivity;\n\n    @Before\n    public void setup() {\n        when(authzManager.authorize(Mockito.<Resource>any(),\n                                    any())).thenReturn(true);\n\n        when(activitiesAuthorizationManager.authorizeActivity(any())).thenReturn(true);\n\n        activatedActivity = mock(Activity.class);\n        when(activatedActivity.getIdentifier()).thenReturn(\"activated activity\");\n\n        when(activatedActivityBean.getInstance()).thenReturn(activatedActivity);\n        when(activatedActivityBean.isActivated()).thenReturn(true);\n\n        when(nonActivatedActivityBean.isActivated()).thenReturn(false);\n\n        Collection<SyncBeanDef<Activity>> activityList = new ArrayList<SyncBeanDef<Activity>>();\n        activityList.add(activatedActivityBean);\n        activityList.add(nonActivatedActivityBean);\n\n        // This covers the case where the activity manager goes directly to the Errai bean manager.\n        // The list includes all beans, active or otherwise, and the activity manager has to filter them.\n        when(iocManager.lookupBeans(Activity.class)).thenReturn(activityList);\n\n        // And this covers the case where the activity manager does the lookup via the ActivityBeansCache.\n        // We set this up assuming ActivityBeansCache is well-behaved, and hides the existence of inactive beans.\n        // (of course this assumption is verified in a separate test)\n        ActivityAndMetaInfo activatedActivityAndMetaInfo =\n                new ActivityAndMetaInfo(iocManager,\n                                        activatedActivityBean,\n                                        0,\n                                        Collections.<String>emptyList());\n        when(resourceTypeManagerCache.getResourceActivities()).thenReturn(singletonList(activatedActivityAndMetaInfo));\n        when(activityBeansCache.getActivity(\"activated activity\")).thenReturn(activatedActivityBean);\n    }\n\n    @After\n    public void runBlanketVerifications() {\n\n        // no matter what else we're testing, the non-activated bean should never be instantiated\n        verify(nonActivatedActivityBean,\n               never()).getInstance();\n        verify(nonActivatedActivityBean,\n               never()).newInstance();\n    }\n\n    @Test\n    public void getActivitiesByTypeShouldRespectBeanActivationStatus() throws Exception {\n        Set<Activity> activities = activityManager.getActivities(Activity.class);\n\n        assertEquals(1,\n                     activities.size());\n        assertSame(activatedActivity,\n                   activities.iterator().next());\n    }\n\n    @Test\n    public void getActivitiesForActivePlaceRequestShouldReturnActivity() throws Exception {\n        Set<Activity> activities = activityManager.getActivities(new DefaultPlaceRequest(\"activated activity\"));\n\n        assertEquals(1,\n                     activities.size());\n        assertSame(activatedActivity,\n                   activities.iterator().next());\n    }\n\n    @Test\n    public void getActivitiesForInactivePlaceRequestShouldReturnEmptySet() throws Exception {\n        Set<Activity> activities = activityManager.getActivities(new DefaultPlaceRequest(\"non-activated activity\"));\n\n        assertEquals(0,\n                     activities.size());\n    }\n\n    @Test\n    public void getActivityForActivePlaceRequestShouldReturnActivity() throws Exception {\n        Activity activity = activityManager.getActivity(Activity.class,\n                                                        new DefaultPlaceRequest(\"activated activity\"));\n\n        assertSame(activatedActivity,\n                   activity);\n    }\n\n    @Test\n    public void getActivityForInactivePlaceRequestShouldReturnNull() throws Exception {\n        Activity activity = activityManager.getActivity(Activity.class,\n                                                        new DefaultPlaceRequest(\"non-activated activity\"));\n\n        assertNull(activity);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityManagerLifecycleTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.context.Dependent;\n\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.util.MockIOCBeanDef;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ActivityManagerLifecycleTest {\n\n    public static final String PATH_PLACE_ID = \"id\";\n    // things to inject into the activity manager\n    @Mock\n    SyncBeanManagerImpl iocManager;\n    @Mock\n    ActivityBeansCache activityBeansCache;\n    @Mock\n    AuthorizationManager authzManager;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n\n    @Spy\n    User dorothy = new UserImpl(\"dorothy\");\n    // the activity manager we're unit testing\n    @InjectMocks\n    ActivityManagerImpl activityManager = new ActivityManagerImpl();\n\n    // things that are useful to individual tests\n    PlaceRequest kansas;\n    Activity kansasActivity = mock(Activity.class);\n\n    Path path = mock(Path.class);\n    PlaceRequest pathPlace;\n    Activity pathPlaceActivity = mock(Activity.class);\n\n    private SyncBeanDef<Activity> pathIocBeanSpy;\n\n    @Before\n    public void setup() {\n        kansas = new DefaultPlaceRequest(\"kansas\");\n        when(kansasActivity.getPlace()).thenReturn(kansas);\n\n        SyncBeanDef<Activity> kansasIocBean = makeDependentBean(Activity.class,\n                                                                kansasActivity);\n        when(activityBeansCache.getActivity(\"kansas\")).thenReturn(kansasIocBean);\n\n        pathPlace = new PathPlaceRequest(path) {\n            @Override\n            protected ObservablePath createObservablePath(Path path) {\n                return mock(ObservablePath.class);\n            }\n        };\n\n        when(pathPlaceActivity.getPlace()).thenReturn(pathPlace);\n        when(pathPlaceActivity.getIdentifier()).thenReturn(PATH_PLACE_ID);\n        SyncBeanDef<Activity> pathIocBean = makeDependentBean(Activity.class,\n                                                              pathPlaceActivity);\n        pathIocBeanSpy = spy(pathIocBean);\n        when(activityBeansCache.getActivity(pathPlace.getIdentifier())).thenReturn(pathIocBeanSpy);\n\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(dorothy))).thenReturn(true);\n\n        when(activitiesAuthorizationManager.authorizeActivity(anyObject())).thenReturn(true);\n    }\n\n    @Test\n    public void shouldCallOnStartupBeforeReturningNewActivity() throws Exception {\n        Set<Activity> activities = activityManager.getActivities(kansas);\n\n        assertEquals(1,\n                     activities.size());\n        assertEquals(kansasActivity,\n                     activities.iterator().next());\n\n        verify(kansasActivity,\n               times(1)).onStartup(kansas);\n    }\n\n    @Test\n    public void shouldResolvePlaceIdentifierForPathPlaceRequestOnGetActivity() throws Exception {\n\n        assertEquals(PathPlaceRequest.NULL,\n                     pathPlace.getIdentifier());\n        Activity activity = activityManager.getActivity(pathPlace);\n        assertNotNull(activity);\n        assertEquals(PATH_PLACE_ID,\n                     pathPlace.getIdentifier());\n        assertEquals(pathPlaceActivity,\n                     activity);\n    }\n\n    @Test\n    public void shouldResolvePlaceIdentifierForPathPlaceRequestsOnGetActivities() throws Exception {\n\n        assertEquals(PathPlaceRequest.NULL,\n                     pathPlace.getIdentifier());\n\n        Set<Activity> activities = activityManager.getActivities(pathPlace);\n        assertEquals(1,\n                     activities.size());\n        assertEquals(PATH_PLACE_ID,\n                     activities.iterator().next().getPlace().getIdentifier());\n    }\n\n    @Test\n    public void activityBeanShouldBeCreatedOnlyOnceOnGetActivities() throws Exception {\n        activityManager.getActivities(pathPlace);\n        verify(pathIocBeanSpy,\n               times(1)).getInstance();\n    }\n\n    @Test\n    public void activityBeanShouldBeCreatedOnlyOnceOnGetActivity() throws Exception {\n        activityManager.getActivity(pathPlace);\n        activityManager.getActivity(pathPlace);\n        verify(pathIocBeanSpy,\n               times(1)).getInstance();\n    }\n\n    @Test\n    public void shouldResolveIdentifier() throws Exception {\n        Set<Activity> activities = activityManager.getActivities(kansas);\n\n        assertEquals(1,\n                     activities.size());\n        assertEquals(kansasActivity,\n                     activities.iterator().next());\n\n        verify(kansasActivity,\n               times(1)).onStartup(kansas);\n    }\n\n    @Test\n    public void shouldCallOnShutdownWhenDestroyingActivity() throws Exception {\n        activityManager.getActivities(kansas);\n        activityManager.destroyActivity(kansasActivity);\n\n        verify(kansasActivity,\n               times(1)).onShutdown();\n        verify(iocManager,\n               times(1)).destroyBean(kansasActivity);\n    }\n\n    @Test\n    public void shouldThrowExceptionWhenDestroyingDestroyedActivity() throws Exception {\n        activityManager.getActivities(kansas);\n        activityManager.destroyActivity(kansasActivity);\n\n        try {\n            activityManager.destroyActivity(kansasActivity);\n            fail(\"second destroy should have thrown an exception\");\n        } catch (IllegalStateException e) {\n            // expected\n        }\n\n        verify(kansasActivity,\n               times(1)).onShutdown();\n        verify(iocManager,\n               times(1)).destroyBean(kansasActivity);\n    }\n\n    @Test\n    public void shouldNotSeeUnauthorizedActivities() throws Exception {\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(dorothy))).thenReturn(false);\n        Set<Activity> activities = activityManager.getActivities(kansas);\n        assertEquals(0,\n                     activities.size());\n    }\n\n    @Test\n    public void shouldNotLeakUnauthorizedActivityInstances() throws Exception {\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(dorothy))).thenReturn(false);\n        activityManager.getActivities(kansas);\n\n        // this overspecified; all we care is that any activity that was created has also been destroyed.\n        // it would be equally okay if the bean was never instantiated in the first place.\n        verify(activityBeansCache).getActivity(\"kansas\");\n        verify(iocManager).destroyBean(kansasActivity);\n    }\n\n    @Test\n    public void shouldNotStartUnauthorizedActivities() throws Exception {\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(dorothy))).thenReturn(false);\n        activityManager.getActivities(kansas);\n        verify(kansasActivity,\n               never()).onStartup(kansas);\n    }\n\n    @Test\n    public void lookupShouldReturnNullWhenPlaceHasNoSplashScreen() throws Exception {\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n        assertNull(splashScreenActivity);\n    }\n\n    /**\n     * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent.\n     */\n    @Test\n    public void shouldStartSplashScreens() throws Exception {\n        PlaceRequest oz = new DefaultPlaceRequest(\"oz\");\n\n        List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>();\n        SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas);\n        SplashScreenActivity nonExpectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(oz);\n        splashScreenList.add(expectedSplashScreenActivity);\n\n        when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList);\n\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n        assertSame(expectedSplashScreenActivity,\n                   splashScreenActivity);\n        verify(splashScreenActivity,\n               times(1)).onStartup(kansas);\n\n        verify(nonExpectedSplashScreenActivity,\n               never()).onStartup(any(PlaceRequest.class));\n    }\n\n    /**\n     * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent.\n     */\n    @Test\n    public void shouldNotStartDisabledSplashScreens() throws Exception {\n        List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>();\n        SplashScreenActivity expectedSplashScreenActivity = makeSplashScreenThatIntercepts(kansas,\n                                                                                           false);\n        splashScreenList.add(expectedSplashScreenActivity);\n\n        when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList);\n\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n        assertNull(splashScreenActivity);\n    }\n\n    /**\n     * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent.\n     */\n    @Test\n    public void shouldStopSplashScreensWhenDestroyed() throws Exception {\n\n        List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>();\n        SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas);\n        splashScreenList.add(expectedSplashScreenActivity);\n\n        when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList);\n\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n        activityManager.destroyActivity(splashScreenActivity);\n        verify(expectedSplashScreenActivity,\n               times(1)).onShutdown();\n        assertFalse(activityManager.isStarted(expectedSplashScreenActivity));\n\n        // never try to destroy singleton beans!\n        verify(iocManager,\n               never()).destroyBean(expectedSplashScreenActivity);\n    }\n\n    @Test\n    public void shouldNotGetConfusedAboutSplashScreensWithSamePlaceAsTheirScreen() throws Exception {\n\n        List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>();\n        SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas);\n        splashScreenList.add(expectedSplashScreenActivity);\n\n        when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList);\n\n        // this loads the regular kansas activity (not the splash screen) into the activityBeansCache\n        activityManager.getActivity(kansas);\n\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n\n        // this must not get confused even though expectedSplashScreenActivity and kansasActivity both have the same PlaceRequest\n        activityManager.destroyActivity(splashScreenActivity);\n\n        verify(expectedSplashScreenActivity,\n               times(1)).onShutdown();\n        assertFalse(activityManager.isStarted(expectedSplashScreenActivity));\n\n        // never try to destroy singleton beans!\n        verify(iocManager,\n               never()).destroyBean(expectedSplashScreenActivity);\n    }\n\n    /**\n     * At the time this test was made, splash screens were handled as special cases because they're ApplicationScoped rather than Dependent.\n     */\n    @Test\n    public void shouldThrowExceptionWhenDoubleDestroyingSplashScreen() throws Exception {\n\n        List<SplashScreenActivity> splashScreenList = new ArrayList<SplashScreenActivity>();\n        SplashScreenActivity expectedSplashScreenActivity = makeEnabledSplashScreenThatIntercepts(kansas);\n        splashScreenList.add(expectedSplashScreenActivity);\n\n        when(activityBeansCache.getSplashScreens()).thenReturn(splashScreenList);\n\n        SplashScreenActivity splashScreenActivity = activityManager.getSplashScreenInterceptor(kansas);\n        activityManager.destroyActivity(splashScreenActivity);\n        try {\n            activityManager.destroyActivity(splashScreenActivity);\n            fail(\"should have thrown exception on double destroy\");\n        } catch (IllegalStateException e) {\n            // expected\n        }\n\n        verify(expectedSplashScreenActivity,\n               times(1)).onShutdown();\n        // never try to destroy singleton beans!\n        verify(iocManager,\n               never()).destroyBean(expectedSplashScreenActivity);\n    }\n\n    @Test\n    public void shouldNotAttemptToDestroyRuntimeRegisteredSingletonActivities() throws Exception {\n        abstract class MyPerspectiveActivity implements PerspectiveActivity {\n\n        }\n        ;\n        final String myPerspectiveId = \"myPerspectiveId\";\n        final MyPerspectiveActivity activity = mock(MyPerspectiveActivity.class);\n        when(activity.getPlace()).thenReturn(new DefaultPlaceRequest(myPerspectiveId));\n\n        // note that we're telling the bean manager this bean is of concrete type PerspectiveActivity.\n        // this mirrors what the JavaScript runtime plugin API does.\n        SyncBeanDef<PerspectiveActivity> perspectiveActivityBean = makeSingletonBean(PerspectiveActivity.class,\n                                                                                     activity,\n                                                                                     myPerspectiveId);\n\n        when(activityBeansCache.getActivity(myPerspectiveId)).thenReturn((SyncBeanDef) perspectiveActivityBean);\n\n        Activity retrievedActivity = activityManager.getActivity(Activity.class,\n                                                                 new DefaultPlaceRequest(myPerspectiveId));\n        activityManager.destroyActivity(retrievedActivity);\n\n        // it's a singleton, so we should not try to destroy it.\n        verify(iocManager,\n               never()).destroyBean(activity);\n    }\n\n    private SplashScreenActivity makeEnabledSplashScreenThatIntercepts(final PlaceRequest place) {\n        return makeSplashScreenThatIntercepts(place,\n                                              true);\n    }\n\n    private SplashScreenActivity makeSplashScreenThatIntercepts(final PlaceRequest place,\n                                                                final boolean enabled) {\n        String splashActivityName = place.getIdentifier() + \"!Splash\";\n        SplashScreenActivity splashScreenActivity = mock(SplashScreenActivity.class);\n        when(splashScreenActivity.isEnabled()).thenReturn(enabled);\n        when(splashScreenActivity.intercept(place)).thenReturn(true);\n        makeSingletonBean(SplashScreenActivity.class,\n                          splashScreenActivity);\n        return splashScreenActivity;\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private <T> SyncBeanDef<T> makeDependentBean(final Class<T> type,\n                                                 final T beanInstance) {\n        final SyncBeanDef<T> beanDef = new MockIOCBeanDef<T, T>(beanInstance,\n                                                                type,\n                                                                Dependent.class,\n                                                                null,\n                                                                beanInstance.getClass().getSimpleName(),\n                                                                true);\n        when((IOCBeanDef<T>) iocManager.lookupBean(beanInstance.getClass())).thenReturn(beanDef);\n        return beanDef;\n    }\n\n    /**\n     * Makes a singleton bean whose name is type.getSimpleName().\n     */\n    private <T> IOCBeanDef<T> makeSingletonBean(final Class<T> type,\n                                                final T beanInstance) {\n        return makeSingletonBean(type,\n                                 beanInstance,\n                                 type.getSimpleName());\n    }\n\n    /**\n     * Makes a singleton bean with the given name.\n     */\n    @SuppressWarnings(\"unchecked\")\n    private <T> SyncBeanDef<T> makeSingletonBean(final Class<T> type,\n                                                 final T beanInstance,\n                                                 final String name) {\n        SyncBeanDef<T> beanDef = new MockIOCBeanDef<T, T>(beanInstance,\n                                                          type,\n                                                          ApplicationScoped.class,\n                                                          null,\n                                                          name,\n                                                          true);\n\n        when((IOCBeanDef<T>) iocManager.lookupBean(beanInstance.getClass())).thenReturn(beanDef);\n        return beanDef;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ActivityMetaInfoTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.container.DynamicAnnotation;\nimport org.jboss.errai.ioc.client.container.IOCBeanDef;\nimport org.junit.Test;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.commons.data.Pair;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic class ActivityMetaInfoTest {\n\n    @Test\n    public void generateNotGenerateActivityMetaInfo() {\n        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);\n        when(beanDefinition.getQualifiers()).thenReturn(Collections.<Annotation>emptySet());\n\n        Pair<Integer, List<String>> nullGenerated = ActivityMetaInfo.generate(beanDefinition);\n\n        assertNull(nullGenerated);\n    }\n\n    @Test\n    @SuppressWarnings(\"unchecked\")\n    public void generateActivityMetaInfo() {\n        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);\n        Priority priority = mock(Priority.class);\n        Integer priorityValue = 1;\n        when(priority.value()).thenReturn(priorityValue);\n\n        Set<Annotation> qualifiers = new HashSet<Annotation>();\n        AssociatedResources associatedResources = mock(AssociatedResources.class);\n\n        final List<Class<? extends ClientResourceType>> typesList = new ArrayList<Class<? extends ClientResourceType>>();\n        typesList.add(ClientResourceType.class);\n\n        Class<? extends ClientResourceType>[] array = typesList.toArray(new Class[typesList.size()]);\n        when(associatedResources.value()).thenReturn(array);\n\n        qualifiers.add(associatedResources);\n        qualifiers.add(priority);\n\n        when(beanDefinition.getQualifiers()).thenReturn(qualifiers);\n\n        Pair<Integer, List<String>> generated = ActivityMetaInfo.generate(beanDefinition);\n\n        assertEquals(priorityValue,\n                     generated.getK1());\n        assertTrue(generated.getK2().contains(ClientResourceType.class.getName()));\n    }\n\n    @Test\n    public void generateActivityMetaInfoForDynamicActivity() {\n        final String otherResourceType = \"org.uberfire.OtherResourceType\";\n        IOCBeanDef<?> beanDefinition = mock(IOCBeanDef.class);\n\n        DynamicAnnotation priority = mock(DynamicAnnotation.class);\n        when(priority.getName()).thenReturn(Priority.class.getName());\n        when(priority.getMember(\"value\")).thenReturn(\"1\");\n\n        Set<Annotation> qualifiers = new HashSet<Annotation>();\n        DynamicAnnotation associatedResources = mock(DynamicAnnotation.class);\n        when(associatedResources.getName()).thenReturn(AssociatedResources.class.getName());\n        when(associatedResources.getMember(\"value\")).thenReturn(\"[\" + ClientResourceType.class.getName() + \",\" + otherResourceType + \"]\");\n\n        qualifiers.add(associatedResources);\n        qualifiers.add(priority);\n\n        when(beanDefinition.isDynamic()).thenReturn(true);\n        when(beanDefinition.getQualifiers()).thenReturn(qualifiers);\n\n        Pair<Integer, List<String>> generated = ActivityMetaInfo.generate(beanDefinition);\n\n        assertEquals(Integer.valueOf(1),\n                     generated.getK1());\n        assertTrue(generated.getK2().contains(ClientResourceType.class.getName()));\n        assertTrue(generated.getK2().contains(\"org.uberfire.OtherResourceType\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/BookmarkableUrlHelperTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport junit.framework.TestCase;\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.ObservablePathImpl;\nimport org.uberfire.client.util.MockIOCBeanDef;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class BookmarkableUrlHelperTest extends TestCase {\n\n    @BeforeClass\n    public static void setupBeans() {\n        ((SyncBeanManagerImpl) IOC.getBeanManager()).reset();\n\n        IOC.getBeanManager().registerBean(new MockIOCBeanDef<ObservablePath, ObservablePathImpl>(new ObservablePathImpl(),\n                                                                                                 ObservablePath.class,\n                                                                                                 Dependent.class,\n                                                                                                 new HashSet<Annotation>(Arrays.asList(QualifierUtil.DEFAULT_QUALIFIERS)),\n                                                                                                 null,\n                                                                                                 true));\n    }\n\n    @Test\n    public void testRegisterOpen() {\n        PlaceRequest req1 = new DefaultPlaceRequest(\"screen1\");\n        PlaceRequest req2 = new DefaultPlaceRequest(\"screen2\");\n        PlaceRequest req3 = new DefaultPlaceRequest(\"screen3\");\n        PlaceRequest req4 = new DefaultPlaceRequest(\"screen4\");\n        final String perspective = \"perspective\";\n        String url = \"\";\n\n        url = BookmarkableUrlHelper.registerOpenedScreen(url,\n                                                         req1);\n        assertEquals(req1.getFullIdentifier(),\n                     url);\n        url = BookmarkableUrlHelper.registerOpenedScreen(url,\n                                                         req2);\n        assertEquals(\"screen1,screen2\",\n                     url);\n\n        // add the perspective, want to test screen not belonging to the current perspective\n        url = perspective.concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                .concat(url);\n        url = BookmarkableUrlHelper.registerOpenedScreen(url,\n                                                         req3);\n\n        assertEquals(\"perspective|screen1,screen2$screen3\",\n                     url);\n\n        url = BookmarkableUrlHelper.registerOpenedScreen(url,\n                                                         req4);\n        assertEquals(\"perspective|screen1,screen2$screen3,screen4\",\n                     url);\n\n        // test with screen closed (we compose the URL)\n        final String closedScreen = \"closedScreen\";\n        final PlaceRequest closed = new DefaultPlaceRequest(closedScreen);\n        url = \"perspective|\"\n                .concat(BookmarkableUrlHelper.CLOSED_PREFIX)\n                .concat(closedScreen).concat(\",openScreen$externalScreen\");\n        url = BookmarkableUrlHelper.registerOpenedScreen(url,\n                                                         closed);\n        String expected = \"perspective|\"\n                .concat(closedScreen).concat(\",openScreen$externalScreen\");\n        assertEquals(expected,\n                     url);\n        // compose a big URL\n        StringBuilder bigUrl = new StringBuilder(perspective);\n        while (bigUrl.length() < BookmarkableUrlHelper.MAX_NAV_URL_SIZE) {\n            bigUrl.append(\",screen\");\n        }\n        url = BookmarkableUrlHelper.registerOpenedScreen(bigUrl.toString(),\n                                                         req1);\n        assertNotNull(url);\n        assertEquals(bigUrl.toString(),\n                     url);\n    }\n\n    @Test\n    public void testRegisterClose() {\n        String url = \"perspective|screen1,screen2$screen3,screen4\";\n\n        // close screens not belonging to the current perspective\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen3\");\n        assertEquals(\"perspective|screen1,screen2$screen4\",\n                     url);\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen4\");\n        assertEquals(\"perspective|screen1,screen2\",\n                     url);\n\n        // close screens belonging to the current perspective\n\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen1\");\n        assertEquals(\"perspective|~screen1,screen2\",\n                     url);\n\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen2\");\n        assertEquals(\"perspective|~screen1,~screen2\",\n                     url);\n\n        // screen already closed\n        url = \"perspective|screen1,~screen2$screen3\";\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen2\");\n        assertEquals(\"perspective|screen1,~screen2$screen3\",\n                     url);\n\n        url = \"perspective|screen1$screen2\";\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen2\");\n        assertEquals(\"perspective|screen1\",\n                     url);\n\n        url = \"perspective|screen1$screen2,screen3\";\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen2\");\n        assertEquals(\"perspective|screen1$screen3\",\n                     url);\n\n        url = \"perspective|screen1$screen2,screen3,screen4\";\n        url = BookmarkableUrlHelper.registerClose(url,\n                                                  \"screen3\");\n        assertEquals(\"perspective|screen1$screen2,screen4\",\n                     url);\n    }\n\n    @Test\n    public void testGetPerspectiveFromPlace() {\n        final String perspectiveName = \"eccePerspective\";\n        final String bookmarkableUrl = perspectiveName\n                .concat(\"|~screen1,~screen2\");\n        final PlaceRequest req = new DefaultPlaceRequest(bookmarkableUrl);\n\n        PlaceRequest place = BookmarkableUrlHelper.getPerspectiveFromPlace(req);\n\n        assertNotNull(place);\n        assertNotSame(req,\n                      place);\n        assertEquals(perspectiveName,\n                     place.getFullIdentifier());\n\n        // return the same object if no perspective in URL\n        final PlaceRequest empty = new DefaultPlaceRequest(\"screenOpened,~screenClosed\");\n        empty.addParameter(\"param\",\n                           \"value\");\n        place = BookmarkableUrlHelper.getPerspectiveFromPlace(empty);\n        assertNotNull(place);\n        assertEquals(empty.getFullIdentifier(),\n                     place.getFullIdentifier());\n    }\n\n    @Test\n    public void testGetPerspectiveFromPlaceWithParams() {\n        final String perspectiveName = \"eccePerspective\";\n        final String bookmarkableUrl = perspectiveName\n                .concat(\"|~screen1,~screen2\");\n        final PlaceRequest req = new DefaultPlaceRequest(bookmarkableUrl);\n\n        req.addParameter(\"param\",\n                         \"value\");\n        PlaceRequest place = BookmarkableUrlHelper.getPerspectiveFromPlace(req);\n\n        assertNotNull(place);\n        assertNotSame(req,\n                      place);\n        StringBuilder expected = new StringBuilder(perspectiveName);\n        expected.append(\"?param=value\");\n        assertEquals(expected.toString(),\n                     place.getFullIdentifier());\n    }\n\n    @Test\n    public void testIsPerspectiveScreen() {\n        final String url = \"perspective|screen1,screen2$screen3,screen4\";\n\n        assertTrue(BookmarkableUrlHelper.isPerspectiveScreen(url,\n                                                             \"screen1\"));\n        assertTrue(BookmarkableUrlHelper.isPerspectiveScreen(url,\n                                                             \"screen2\"));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveScreen(url,\n                                                              \"screen3\"));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveScreen(url,\n                                                              \"screen4\"));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveScreen(null,\n                                                              \"screen2\"));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveScreen(\"\",\n                                                              \"screen2\"));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveScreen(url,\n                                                              null));\n    }\n\n    @Test\n    public void testIsPerspectiveInUrl() {\n        final String url1 = \"perspective|screen1,screen2$screen3,screen4\";\n        final String url2 = \"screen1,screen2\";\n        final String url3 = \"perspective|screen1,screen2$screen3,screen4\";\n\n        assertTrue(BookmarkableUrlHelper.isPerspectiveInUrl(url1));\n        assertFalse(BookmarkableUrlHelper.isPerspectiveInUrl(url2));\n        assertTrue(BookmarkableUrlHelper.isPerspectiveInUrl(url3));\n    }\n\n    @Test\n    public void testUrlContainsExtraPerspectiveScreen() {\n        final String url1 = \"perspective|screen1,screen2$screen3,screen4\";\n        final String url2 = \"screen1,screen2\";\n        final String url3 = \"perspective|screen1,screen2$screen3,screen4\";\n\n        assertTrue(BookmarkableUrlHelper.urlContainsExtraPerspectiveScreen(url1));\n        assertFalse(BookmarkableUrlHelper.urlContainsExtraPerspectiveScreen(url2));\n        assertTrue(BookmarkableUrlHelper.urlContainsExtraPerspectiveScreen(url3));\n    }\n\n    @Test\n    public void testGetUrlInToken() {\n        final String url1 = \"perspective|#screen1,§screen2$#screen3,!screen4\";\n        final String url2 = \"!screen1,#screen2\";\n\n        assertEquals(\"!screen1\",\n                     BookmarkableUrlHelper.getUrlToken(url2,\n                                                       \"screen1\"));\n        assertEquals(\"#screen2\",\n                     BookmarkableUrlHelper.getUrlToken(url2,\n                                                       \"screen2\"));\n\n        assertEquals(\"§screen2\",\n                     BookmarkableUrlHelper.getUrlToken(url1,\n                                                       \"screen2\"));\n        assertEquals(\"#screen1\",\n                     BookmarkableUrlHelper.getUrlToken(url1,\n                                                       \"screen1\"));\n        assertEquals(\"#screen3\",\n                     BookmarkableUrlHelper.getUrlToken(url1,\n                                                       \"screen3\"));\n        assertEquals(\"!screen4\",\n                     BookmarkableUrlHelper.getUrlToken(url1,\n                                                       \"screen4\"));\n    }\n\n    @Test\n    public void testGetScreensFromPlace() {\n        final String url = \"perspective|~screen1,screen2$!screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n        final String url3 = \"PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n        final PlaceRequest place = new DefaultPlaceRequest(url);\n        final PlaceRequest place2 = new DefaultPlaceRequest(url2);\n        final PlaceRequest placeNoPerspective = new DefaultPlaceRequest(url3);\n        final PlaceRequest placeNull = null;\n\n        Set<String> set = BookmarkableUrlHelper.getScreensFromPlace(place);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n\n        assertEquals(4,\n                     set.size());\n        assertTrue(set.contains(\"~screen1\"));\n        assertTrue(set.contains(\"screen2\"));\n        assertTrue(set.contains(\"!screen3\"));\n        assertTrue(set.contains(\"screen4\"));\n\n        set = BookmarkableUrlHelper.getScreensFromPlace(place2);\n        assertNotNull(set);\n\n        assertFalse(set.isEmpty());\n        assertEquals(1,\n                     set.size());\n        assertTrue(set.contains(\"PagedTableScreen\"));\n\n        set = BookmarkableUrlHelper.getScreensFromPlace(placeNull);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n\n        // test with bookmarkable URL with no perspective\n        set = BookmarkableUrlHelper.getScreensFromPlace(placeNoPerspective);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertTrue(set.contains(\"PagedTableScreen\"));\n    }\n\n    @Test\n    public void testGetClosedScreenFromPlace() {\n        final String url = \"perspective|~screen1,screen2$~screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n        final PlaceRequest place = new DefaultPlaceRequest(url);\n        final PlaceRequest place2 = new DefaultPlaceRequest(url2);\n\n        Set<String> set = BookmarkableUrlHelper.getClosedScreenFromPlace(place);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertEquals(2,\n                     set.size());\n        assertTrue(set.contains(\"~screen1\"));\n        assertTrue(set.contains(\"~screen3\"));\n\n        set = BookmarkableUrlHelper.getClosedScreenFromPlace(place2);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n    }\n\n    @Test\n    public void testGetOpenedScreenFromPlace() {\n        final String url = \"perspective|~screen1,screen2$~screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n        final PlaceRequest place = new DefaultPlaceRequest(url);\n        final PlaceRequest place2 = new DefaultPlaceRequest(url2);\n\n        Set<String> set = BookmarkableUrlHelper.getOpenedScreenFromPlace(place);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertTrue(set.contains(\"screen2\"));\n        assertTrue(set.contains(\"screen4\"));\n\n        set = BookmarkableUrlHelper.getOpenedScreenFromPlace(place2);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertTrue(set.contains(\"PagedTableScreen\"));\n    }\n\n    @Test\n    public void testGDockedScreensFromPlace() {\n        final String url = \"perspective|~screen1,screen2$~screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n        final PlaceRequest place = new DefaultPlaceRequest(url);\n        final PlaceRequest place2 = new DefaultPlaceRequest(url2);\n\n        Set<String> set = BookmarkableUrlHelper.getDockedScreensFromPlace(place);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n\n        set = BookmarkableUrlHelper.getDockedScreensFromPlace(place2);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertEquals(2,\n                     set.size());\n        assertTrue(set.contains(\"ESimpleDockScreen\"));\n        assertTrue(set.contains(\"!WSimpleDockScreen\"));\n\n        // test with invalid URL\n        set = BookmarkableUrlHelper.getDockedScreensFromPlace(null);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n    }\n\n    @Test\n    public void testGDockedScreensFromPlaceString() {\n        final String url = \"perspective|~screen1,screen2$~screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,EAnotherDockScreen,]\";\n\n        Set<String> set = BookmarkableUrlHelper.getDockedScreensFromUrl(url);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n\n        set = BookmarkableUrlHelper.getDockedScreensFromUrl(url2);\n        assertNotNull(set);\n        assertFalse(set.isEmpty());\n        assertEquals(3,\n                     set.size());\n        assertTrue(set.contains(\"ESimpleDockScreen\"));\n        assertTrue(set.contains(\"!WSimpleDockScreen\"));\n        assertTrue(set.contains(\"EAnotherDockScreen\"));\n\n        // test with invalid URL\n        set = BookmarkableUrlHelper.getDockedScreensFromUrl(null);\n        assertNotNull(set);\n        assertTrue(set.isEmpty());\n    }\n\n    @Test\n    public void testIsScreenClosed() {\n        final String url = \"perspective|~screen1,screen2$~screen3,screen4\";\n        final String url2 = \"UFWidgets|PagedTableScreen[ESimpleDockScreen,!WSimpleDockScreen,ESimpleDockScreen,]\";\n\n        assertTrue(BookmarkableUrlHelper.isScreenClosed(\n                url,\n                \"screen1\"));\n        assertTrue(BookmarkableUrlHelper.isScreenClosed(\n                url,\n                \"screen3\"));\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url,\n                \"screen2\"));\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url,\n                \"screen4\"));\n\n        // docked screens are ignored\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url2,\n                \"PagedTableScreen\"));\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url2,\n                \"ESimpleDockScreen\"));\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url2,\n                \"ESimpleDockScreen\"));\n        assertFalse(BookmarkableUrlHelper.isScreenClosed(\n                url2,\n                \"!WSimpleDockScreen\"));\n    }\n\n    @Test\n    public void testRegisterOpenedPerspective() {\n        final String screens = \"screen1,~screen2\";\n        final String perspective = \"perspective\";\n        final PlaceRequest place = new DefaultPlaceRequest(perspective);\n        String url = screens;\n\n        url = BookmarkableUrlHelper.registerOpenedPerspective(url,\n                                                              place);\n\n        assertEquals(perspective.concat(BookmarkableUrlHelper.PERSPECTIVE_SEP).concat(screens),\n                     url);\n    }\n\n    @Test\n    public void testRegisterOpenDock() {\n        final String screens = \"screen1\";\n        final String dockName = \"dockedScreen\";\n        final String perspectiveName = \"perspectiveName\";\n        String url = perspectiveName\n                .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                .concat(screens);\n        final UberfireDock dock1 = createUberfireDockForTest(dockName,\n                                                             perspectiveName);\n        final UberfireDock dock2 = createUberfireDockForTest(dockName.concat(\"New\"),\n                                                             perspectiveName);\n\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock1);\n        assertEquals(perspectiveName\n                             .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                             .concat(\"screen1[WdockedScreen,]\"),\n                     url);\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock2);\n        assertEquals(perspectiveName\n                             .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                             .concat(\"screen1[WdockedScreen,WdockedScreenNew,]\"),\n                     url);\n\n        // test with a closed dock\n        url = perspectiveName\n                .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                .concat(\"screen1[!WdockedScreen,]\");\n        String expected = perspectiveName\n                .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                .concat(\"screen1[WdockedScreen,]\");\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock1);\n        assertEquals(expected,\n                     url);\n\n        // test with invalid dock and URL\n        expected = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                            null);\n        assertNotNull(expected);\n        assertEquals(expected,\n                     url);\n\n        url = \"  \";\n        expected = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                            null);\n        assertNotNull(expected);\n        assertEquals(expected,\n                     url);\n    }\n\n    @Test\n    public void testDoubleRegisterOpenDock() {\n        final String screens = \"screen1\";\n        final String dockName = \"dockedScreen\";\n        final String perspectiveName = \"perspectiveName\";\n        String url = perspectiveName\n                .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                .concat(screens);\n        final UberfireDock dock1 = createUberfireDockForTest(dockName,\n                                                             perspectiveName);\n        final UberfireDock dock2 = createUberfireDockForTest(dockName.concat(\"New\"),\n                                                             perspectiveName);\n\n        // open the same docked screen twice\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock1);\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock1);\n        assertEquals(perspectiveName\n                             .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                             .concat(\"screen1[WdockedScreen,]\"),\n                     url);\n        // open the another docked screen twice\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock2);\n        url = BookmarkableUrlHelper.registerOpenedDock(url,\n                                                       dock2);\n        assertEquals(perspectiveName\n                             .concat(BookmarkableUrlHelper.PERSPECTIVE_SEP)\n                             .concat(\"screen1[WdockedScreen,WdockedScreenNew,]\"),\n                     url);\n    }\n\n    @Test\n    public void testRegisterClosedDock() {\n        final String dockName1 = \"dockedScreen1\";\n        final String dockName2 = \"dockedScreen2\";\n        String perspectiveName = \"perspective\";\n        String url = \"perspectiveName|screen[W\" + dockName1 + \",W\" + dockName2 + \",]\";\n        UberfireDock dock1 = createUberfireDockForTest(dockName1,\n                                                       perspectiveName);\n        UberfireDock dock2 = createUberfireDockForTest(dockName2,\n                                                       perspectiveName);\n\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock1);\n        assertNotNull(url);\n        assertTrue(url.contains(\"!W\" + dockName1));\n\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock2);\n        assertNotNull(url);\n        assertTrue(url.contains(\"!W\" + dockName2));\n    }\n\n    @Test\n    public void testDoubleRegisterClosedDock() {\n        final String dockName1 = \"dockedScreen1\";\n        final String dockName2 = \"dockedScreen2\";\n        String perspectiveName = \"perspective\";\n        String url = \"perspectiveName|screen[W\" + dockName1 + \",W\" + dockName2 + \",]\";\n        UberfireDock dock1 = createUberfireDockForTest(dockName1,\n                                                       perspectiveName);\n        UberfireDock dock2 = createUberfireDockForTest(dockName2,\n                                                       perspectiveName);\n\n        // close the same dock twice\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock1);\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock1);\n        assertNotNull(url);\n        assertTrue(url.contains(\"!W\" + dockName1));\n        // close another dock twice\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock2);\n        url = BookmarkableUrlHelper.registerClosedDock(url,\n                                                       dock2);\n        assertNotNull(url);\n        assertTrue(url.contains(\"!W\" + dockName2));\n\n        // test with invalid dock and URl\n        String expected = \"anyBookmarkableUrl\";\n        url = BookmarkableUrlHelper.registerClosedDock(expected,\n                                                       null);\n        assertNotNull(url);\n        assertEquals(expected,\n                     url);\n\n        expected = \"    \"; // empty string for URL\n        url = BookmarkableUrlHelper.registerClosedDock(expected,\n                                                       dock2);\n        assertNotNull(url);\n        assertEquals(expected,\n                     url);\n    }\n\n    @Test\n    public void testOpenADockWithEmptyBookmark() {\n        UberfireDock dock1 = createUberfireDockForTest(\"dock\",\n                                                       \"perspective\");\n        String url = BookmarkableUrlHelper.registerOpenedDock(\"\",\n                                                              dock1);\n        assertEquals(\"[Wdock,]\",\n                     url);\n    }\n\n    @Test\n    public void testRegisterCloseEditor() {\n        final Path path = PathFactory.newPath(\"file\",\n                                              \"default://main@repo/path/to/file\");\n        final PlaceRequest ppr = new PathPlaceRequest(path);\n\n        ppr.setIdentifier(\"Perspective Editor\");\n        final String perspectiveClosedUrl = \"PlugInAuthoringPerspective|[WPlugins Explorer,]$\";\n        final String perspectiveOpenUrl = perspectiveClosedUrl.concat(ppr.getFullIdentifier());\n\n        String url = BookmarkableUrlHelper\n                .registerCloseEditor(perspectiveOpenUrl,\n                                     ppr);\n\n        assertEquals(perspectiveClosedUrl,\n                     url);\n\n        // invoke with invalid field type\n        final PlaceRequest dpr = new DefaultPlaceRequest(\"default://main@repo/path/to/file\");\n\n        url = BookmarkableUrlHelper\n                .registerCloseEditor(perspectiveOpenUrl,\n                                     dpr);\n        assertEquals(perspectiveOpenUrl,\n                     url);\n    }\n\n    @Test\n    public void testRegisterCloseEditorWithScreens() {\n        final Path path = PathFactory.newPath(\"file\",\n                                              \"default://main@repo/path/to/file\");\n        final PlaceRequest ppr = new PathPlaceRequest(path);\n\n        ppr.setIdentifier(\"Perspective Editor\");\n        final String perspectiveClosedUrl = \"PlugInAuthoringPerspective|[WPlugins Explorer,]$\";\n        final String perspectiveOpenUrl = perspectiveClosedUrl.concat(ppr.getFullIdentifier()).concat(\",screen1\");\n\n        String url = BookmarkableUrlHelper\n                .registerCloseEditor(perspectiveOpenUrl,\n                                     ppr);\n        final String expectedUrl = \"PlugInAuthoringPerspective|[WPlugins Explorer,]$screen1\";\n        assertEquals(expectedUrl,\n                     url);\n\n        // invoke with NULL\n        url = BookmarkableUrlHelper\n                .registerCloseEditor(expectedUrl,\n                                     null);\n        assertEquals(expectedUrl,\n                     url);\n    }\n\n    /**\n     * Get a dock for the test\n     * @param dockName\n     * @param perspectiveName\n     * @return\n     */\n    private UberfireDock createUberfireDockForTest(String dockName,\n                                                   String perspectiveName) {\n        final PlaceRequest req = new DefaultPlaceRequest(dockName);\n        UberfireDock dock = new UberfireDock(\n                UberfireDockPosition.WEST,\n                \"iconType\",\n                req,\n                perspectiveName);\n\n        return dock;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/CategoriesManagerCacheTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Set;\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.util.GWTEditorNativeRegister;\nimport org.uberfire.client.workbench.events.NewPerspectiveEvent;\nimport org.uberfire.client.workbench.events.NewWorkbenchScreenEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Undefined;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class CategoriesManagerCacheTest {\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private Event<NewPerspectiveEvent> newPerspectiveEventEvent;\n\n    @Mock\n    private Event<NewWorkbenchScreenEvent> newWorkbenchScreenEvent;\n\n    private CategoriesManagerCache categoriesManagerCache;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @Mock\n    private GWTEditorNativeRegister gwtEditorNativeRegister;\n\n    private ResourceTypeManagerCache resourceTypeManagerCache;\n\n    private ActivityBeansCache activityBeansCache;\n\n    private Undefined undefinedCategory;\n\n\n    @Before\n    public void setUp() {\n        categoriesManagerCache = new CategoriesManagerCache(undefinedCategory);\n        resourceTypeManagerCache = new ResourceTypeManagerCache(categoriesManagerCache);\n        activityBeansCache = new ActivityBeansCache(iocManager,\n                                                    newPerspectiveEventEvent,\n                                                    newWorkbenchScreenEvent,\n                                                    resourceTypeManagerCache,\n                                                    experimentalActivitiesAuthorizationManager,\n                                                    gwtEditorNativeRegister);\n    }\n\n    @Test\n    public void testAvailableCategories() {\n\n        Category process = mock(Category.class);\n        Category model = mock(Category.class);\n\n        ClientResourceType clientResourceType = mock(ClientResourceType.class);\n        when(clientResourceType.getCategory()).thenReturn(model);\n        SyncBeanDef<ClientResourceType> syncBeanDef = mock(SyncBeanDef.class);\n        when(syncBeanDef.getInstance()).thenReturn(clientResourceType);\n        Collection<SyncBeanDef> resourceTypeBeans = Arrays.asList(syncBeanDef);\n        when(iocManager.lookupBeans(eq(\"java\"))).thenReturn(resourceTypeBeans);\n\n        SyncBeanDef mock = mock(SyncBeanDef.class);\n        when(mock.getName()).thenReturn(\"java\");\n\n        activityBeansCache.addNewEditorActivity(mock,\n                                                \"1\",\n                                                \"java\");\n\n        Set<Category> categories = this.categoriesManagerCache.getCategories();\n\n        assertTrue(categories.stream().anyMatch(category -> category.equals(model)));\n        assertTrue(categories.stream().noneMatch(category -> category.equals(process)));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/LockManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.reflect.Field;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\n\nimport com.google.gwt.event.logical.shared.AttachEvent;\nimport com.google.gwt.user.client.Event;\nimport com.google.gwt.user.client.EventListener;\nimport com.google.gwt.user.client.Timer;\nimport com.google.gwt.user.client.ui.TextArea;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.fakes.FakeProvider;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.UserImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.client.mvp.LockTarget.TitleProvider;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.workbench.VFSLockServiceProxy;\nimport org.uberfire.client.workbench.events.ChangeTitleWidgetEvent;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.rpc.impl.SessionInfoImpl;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.events.ResourceUpdatedEvent;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertNotEquals;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\n@SuppressWarnings(\"unchecked\")\npublic class LockManagerTest {\n\n    @Spy\n    @InjectMocks\n    private LockManagerImpl lockManager;\n\n    @Mock\n    private LockDemandDetector lockDemandDetector;\n\n    @Mock\n    private User user;\n\n    @Mock\n    private VFSLockServiceProxy lockService;\n\n    @Mock\n    private Path path;\n\n    @Mock\n    private EventSourceMock<NotificationEvent> lockNotification;\n\n    @Mock\n    private EventSourceMock<ChangeTitleWidgetEvent> changeTitleEvent;\n\n    @Mock\n    private EventSourceMock<UpdatedLockStatusEvent> updatedLockStatusEvent;\n\n    @GwtMock\n    private TextArea widget;\n\n    @GwtMock\n    private Event event;\n\n    private LockTarget target;\n\n    private int reloads = 0;\n\n    @Before\n    public void setup() throws Exception {\n        mockTimer();\n\n        GwtMockito.useProviderForType(WorkbenchResources.class,\n                                      new FakeProvider<WorkbenchResources>() {\n\n                                          @Override\n                                          public WorkbenchResources getFake(Class<?> type) {\n                                              return null;\n                                          }\n                                      });\n\n        final Runnable reloadRunnable = new Runnable() {\n\n            @Override\n            public void run() {\n                reloads++;\n            }\n        };\n\n        final TitleProvider titleProvider = new TitleProvider() {\n\n            @Override\n            public String getTitle() {\n                return \"\";\n            }\n        };\n\n        target = new LockTarget(path,\n                                widget,\n                                new DefaultPlaceRequest(\"mockPlace\"),\n                                titleProvider,\n                                reloadRunnable);\n\n        lockManager.init(target);\n\n        when(path.toURI()).thenReturn(\"directory/file.drl\");\n        when(user.getIdentifier()).thenReturn(\"mockedUser\");\n        when(lockDemandDetector.isLockRequired(any(Event.class))).thenReturn(true);\n    }\n\n    @Test\n    public void updateLockInfoOnInit() {\n        verify(lockService,\n               times(1)).retrieveLockInfo(any(Path.class),\n                                          any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void acquireLockOnDemand() {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockDemand();\n\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void acquireLockDoesNotHitServerIfLocked() {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockFailure();\n        simulateLockDemand();\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n\n        simulateLockDemand();\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void notifyLockFailure() throws Exception {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockFailure();\n        simulateLockDemand();\n\n        verify(lockNotification,\n               times(1)).fire(any(NotificationEvent.class));\n    }\n\n    @Test\n    public void notifyLockError() throws Exception {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockError();\n        simulateLockDemand();\n\n        verify(lockNotification,\n               times(1)).fire(any(NotificationEvent.class));\n    }\n\n    @Test\n    public void reloadOnLockFailure() throws Exception {\n        lockManager.acquireLockOnDemand();\n\n        assertEquals(0,\n                     reloads);\n\n        simulateLockFailure();\n        simulateLockDemand();\n\n        assertEquals(1,\n                     reloads);\n    }\n\n    @Test\n    public void updateTitleOnFocus() {\n        verify(changeTitleEvent,\n               never()).fire(any(ChangeTitleWidgetEvent.class));\n        lockManager.onFocus();\n        verify(changeTitleEvent,\n               times(1)).fire(any(ChangeTitleWidgetEvent.class));\n    }\n\n    @Test\n    public void handleWindowReparenting() {\n        lockManager.acquireLockOnDemand();\n        verify(lockDemandDetector,\n               times(1)).getLockDemandEventTypes();\n\n        final ArgumentCaptor<AttachEvent.Handler> handlerCaptor = ArgumentCaptor.forClass(AttachEvent.Handler.class);\n        verify(widget,\n               times(1)).addAttachHandler(handlerCaptor.capture());\n\n        handlerCaptor.getValue().onAttachOrDetach(new AttachEvent(true) {\n        });\n        verify(lockDemandDetector,\n               times(2)).getLockDemandEventTypes();\n    }\n\n    @Test\n    public void releaseLockOnSave() {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockSuccess();\n        simulateLockDemand();\n\n        lockManager.onSaveInProgress(new SaveInProgressEvent(path));\n\n        verify(lockService,\n               times(1)).releaseLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void releaseLockOnUpdate() {\n        lockManager.acquireLockOnDemand();\n        simulateLockSuccess();\n        simulateLockDemand();\n\n        lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,\n                                                               \"\",\n                                                               new SessionInfoImpl(user)));\n\n        verify(lockService,\n               times(1)).releaseLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void reloadEditorOnUpdateFromDifferentUser() {\n        lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,\n                                                               \"\",\n                                                               new SessionInfoImpl(user)));\n\n        assertEquals(0,\n                     reloads);\n\n        lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,\n                                                               \"\",\n                                                               new SessionInfoImpl(new UserImpl(\"differentUser\"))));\n\n        assertEquals(0,\n                     reloads);\n    }\n\n    @Test\n    public void releaseOwnedLockOnly() {\n        lockManager.acquireLockOnDemand();\n        simulateLockFailure();\n        simulateLockDemand();\n\n        lockManager.onResourceUpdated(new ResourceUpdatedEvent(path,\n                                                               \"\",\n                                                               new SessionInfoImpl(user)));\n\n        verify(lockService,\n               never()).releaseLock(any(Path.class),\n                                    any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void requestAcquireLockOnDemandNoMoreThanOnce() {\n        lockManager.acquireLockOnDemand();\n\n        simulateLockNoResponse();\n        simulateLockDemand();\n        simulateLockDemand();\n\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void acquireLock() {\n        lockManager.acquireLock();\n\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void requestAcquireLockNoMoreThanOnce() {\n        simulateLockNoResponse();\n\n        lockManager.acquireLock();\n        lockManager.acquireLock();\n\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void requestAcquireLockNoMoreThanOnceForSameUser() {\n        simulateLockSuccess();\n\n        lockManager.acquireLock();\n        lockManager.acquireLock();\n\n        verify(lockService,\n               times(1)).acquireLock(any(Path.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void acquireLockFiresChangeTitleEvent() {\n        simulateLockSuccess();\n\n        lockManager.acquireLock();\n\n        verify(changeTitleEvent,\n               times(1)).fire(any(ChangeTitleWidgetEvent.class));\n\n        lockManager.acquireLock();\n\n        verify(changeTitleEvent,\n               times(2)).fire(any(ChangeTitleWidgetEvent.class));\n    }\n\n    @Test\n    public void testUpdateLockInfoWhenLockInfoURIIsEqualToLockTargetURI() {\n\n        final LockInfo lockInfo = mock(LockInfo.class);\n        final Path path = mock(Path.class);\n        final Runnable runnable1 = mock(Runnable.class);\n        final Runnable runnable2 = mock(Runnable.class);\n        final List<Runnable> runnables = spy(new ArrayList<>(Arrays.asList(runnable1, runnable2)));\n\n        doReturn(runnables).when(lockManager).getSyncCompleteRunnables();\n        when(lockInfo.getFile()).thenReturn(path);\n        when(path.toURI()).thenReturn(\"directory/file.drl\");\n        when(this.path.toURI()).thenReturn(\"directory/file.drl\");\n\n        lockManager.updateLockInfo(lockInfo);\n\n        assertEquals(lockInfo, lockManager.getLockInfo());\n        assertTrue(lockManager.isLockSyncComplete());\n        verify(lockManager).fireChangeTitleEvent();\n        verify(lockManager).fireUpdatedLockStatusEvent();\n        verify(runnable1).run();\n        verify(runnable2).run();\n        verify(runnables).clear();\n    }\n\n    @Test\n    public void testUpdateLockInfoWhenLockInfoURIIsNotEqualToLockTargetURI() {\n\n        final LockInfo lockInfo = mock(LockInfo.class);\n        final Path path = mock(Path.class);\n        final Runnable runnable1 = mock(Runnable.class);\n        final Runnable runnable2 = mock(Runnable.class);\n        final List<Runnable> runnables = spy(new ArrayList<>(Arrays.asList(runnable1, runnable2)));\n\n        doReturn(runnables).when(lockManager).getSyncCompleteRunnables();\n        when(lockInfo.getFile()).thenReturn(path);\n        when(path.toURI()).thenReturn(\"directory/file1.drl\");\n        when(this.path.toURI()).thenReturn(\"directory/file2.drl\");\n\n        lockManager.updateLockInfo(lockInfo);\n\n        assertNotEquals(lockInfo, lockManager.getLockInfo());\n        assertFalse(lockManager.isLockSyncComplete());\n        verify(lockManager, never()).fireChangeTitleEvent();\n        verify(lockManager, never()).fireUpdatedLockStatusEvent();\n        verify(runnable1, never()).run();\n        verify(runnable2, never()).run();\n        verify(runnables, never()).clear();\n    }\n\n    @Test\n    public void testUpdateLockInfoWhenLockTargetIsNull() {\n\n        final LockInfo lockInfo = mock(LockInfo.class);\n        final Runnable runnable1 = mock(Runnable.class);\n        final Runnable runnable2 = mock(Runnable.class);\n        final List<Runnable> runnables = spy(new ArrayList<>(Arrays.asList(runnable1, runnable2)));\n\n        doReturn(runnables).when(lockManager).getSyncCompleteRunnables();\n        doReturn(null).when(lockManager).getLockTarget();\n\n        lockManager.updateLockInfo(lockInfo);\n\n        assertNotEquals(lockInfo, lockManager.getLockInfo());\n        assertFalse(lockManager.isLockSyncComplete());\n        verify(lockManager, never()).fireChangeTitleEvent();\n        verify(lockManager, never()).fireUpdatedLockStatusEvent();\n        verify(runnable1, never()).run();\n        verify(runnable2, never()).run();\n        verify(runnables, never()).clear();\n    }\n\n    @Test\n    public void testOnRenameInProgressWhenLockInfoPathIsEqualToLockTargetPath() {\n\n        final RenameInProgressEvent renameInProgressEvent = mock(RenameInProgressEvent.class);\n\n        when(renameInProgressEvent.getPath()).thenReturn(path);\n\n        lockManager.onRenameInProgress(renameInProgressEvent);\n\n        verify(lockManager).releaseLock();\n    }\n\n    @Test\n    public void testOnRenameInProgressWhenLockInfoPathIsNotEqualToLockTargetPath() {\n\n        final RenameInProgressEvent renameInProgressEvent = mock(RenameInProgressEvent.class);\n        final Path path = mock(Path.class);\n\n        when(renameInProgressEvent.getPath()).thenReturn(path);\n\n        lockManager.onRenameInProgress(renameInProgressEvent);\n\n        verify(lockManager, never()).releaseLock();\n    }\n\n    @Test\n    public void testOnRenameInProgressWhenLockTargetIsNull() {\n\n        final RenameInProgressEvent renameInProgressEvent = mock(RenameInProgressEvent.class);\n\n        doReturn(null).when(lockManager).getLockTarget();\n\n        lockManager.onRenameInProgress(renameInProgressEvent);\n\n        verify(lockManager, never()).releaseLock();\n    }\n\n    private void simulateLockDemand() {\n        EventListener listener = lockManager.acquireLockOnDemand(widget.getElement());\n        listener.onBrowserEvent(event);\n    }\n\n    private void simulateLockFailure() {\n        doAnswer(new Answer<Object>() {\n\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                final Object[] args = invocation.getArguments();\n                LockInfo lockInfo = new LockInfo(true,\n                                                 \"somebody\",\n                                                 path);\n                final LockResult failed = LockResult.failed(lockInfo);\n                ((ParameterizedCommand<LockResult>) args[1]).execute(failed);\n                return null;\n            }\n        }).when(lockService).acquireLock(any(Path.class),\n                                         any(ParameterizedCommand.class));\n    }\n\n    private void simulateLockSuccess() {\n        doAnswer(new Answer<Object>() {\n\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                final Object[] args = invocation.getArguments();\n                final LockResult acquired = LockResult.acquired(path,\n                                                                user.getIdentifier());\n                ((ParameterizedCommand<LockResult>) args[1]).execute(acquired);\n                return null;\n            }\n        }).when(lockService).acquireLock(any(Path.class),\n                                         any(ParameterizedCommand.class));\n    }\n\n    private void simulateLockError() {\n        doAnswer(new Answer<Object>() {\n\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                final Object[] args = invocation.getArguments();\n                final LockResult acquired = LockResult.error();\n                ((ParameterizedCommand<LockResult>) args[1]).execute(acquired);\n                return null;\n            }\n        }).when(lockService).acquireLock(any(Path.class),\n                                         any(ParameterizedCommand.class));\n    }\n\n    private void simulateLockNoResponse() {\n        doAnswer(new Answer<Object>() {\n\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                return null;\n            }\n        }).when(lockService).acquireLock(any(Path.class),\n                                         any(ParameterizedCommand.class));\n    }\n\n    private void mockTimer() throws Exception {\n        final Timer mockTimer = new Timer() {\n\n            @Override\n            public void run() {\n                target.getReloadRunnable().run();\n            }\n\n            @Override\n            public void schedule(int delayMillis) {\n                run();\n            }\n        };\n        final Field reloadTimer = LockManagerImpl.class.getDeclaredField(\"reloadTimer\");\n        reloadTimer.setAccessible(true);\n        reloadTimer.set(lockManager,\n                        mockTimer);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/PerspectiveManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.function.Consumer;\nimport javax.enterprise.event.Event;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.refEq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class PerspectiveManagerTest {\n\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    PanelManager panelManager;\n    @Mock\n    ActivityManager activityManager;\n    @Mock\n    WorkbenchServicesProxy wbServices;\n    @Mock\n    Event<PerspectiveChange> perspectiveChangeEvent;\n\n    @Mock\n    ActivityBeansCache activityBeansCache;\n\n    @Mock\n    SyncBeanManager iocManager;\n\n    @Spy\n    @InjectMocks\n    PerspectiveManagerImpl perspectiveManager;\n\n    // useful mocks provided by setup method\n    private PerspectiveDefinition ozDefinition;\n    private PerspectiveActivity oz;\n    private PlaceRequest pr;\n    private ParameterizedCommand<PerspectiveDefinition> doWhenFinished;\n    private ParameterizedCommand<PerspectiveDefinition> doAfterFetch;\n    private Command doWhenFinishedSave;\n    private PerspectiveManagerImpl.FetchPerspectiveCommand fetchCommand;\n    private List<PartDefinitionImpl> partDefinitionsRoot;\n    private List<PartDefinitionImpl> partDefinitionRootChild1;\n    private List<PartDefinitionImpl> partDefinitionRootChild2;\n    private List<PartDefinitionImpl> partDefinitionRootChild2Child;\n\n    @SuppressWarnings(\"unchecked\")\n    @Before\n    public void setup() {\n        ozDefinition = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n\n        oz = mock(PerspectiveActivity.class);\n        pr = mock(PlaceRequest.class);\n        when(oz.getDefaultPerspectiveLayout()).thenReturn(ozDefinition);\n        when(oz.getIdentifier()).thenReturn(\"oz_perspective\");\n        when(oz.isTransient()).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(oz).getMenus(any());\n\n        doWhenFinished = mock(ParameterizedCommand.class);\n        doAfterFetch = spy(new ParameterizedCommand<PerspectiveDefinition>() {\n            @Override\n            public void execute(final PerspectiveDefinition parameter) {\n            }\n        });\n        doWhenFinishedSave = mock(Command.class);\n\n        fetchCommand = spy(perspectiveManager.new FetchPerspectiveCommand(pr,\n                                                                          oz,\n                                                                          doAfterFetch));\n\n        // simulate \"finished saving\" callback on wbServices.save()\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                Command callback = (Command) invocation.getArguments()[2];\n                callback.execute();\n                return null;\n            }\n        }).when(wbServices).save(any(),\n                                 any(),\n                                 any());\n\n        // simulate \"no saved state found\" result on wbServices.loadPerspective()\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                ParameterizedCommand<?> callback = (ParameterizedCommand<?>) invocation.getArguments()[1];\n                callback.execute(null);\n                return null;\n            }\n        }).when(wbServices).loadPerspective(any(),\n                                            any());\n\n        // XXX should look at why PanelManager needs to return an alternative panel sometimes.\n        // would be better if addWorkbenchPanel returned void.\n        when(panelManager.addWorkbenchPanel(any(),\n                                            any(),\n                                            any())).thenAnswer(new Answer<PanelDefinition>() {\n            @Override\n            public PanelDefinition answer(InvocationOnMock invocation) {\n                return (PanelDefinition) invocation.getArguments()[1];\n            }\n        });\n    }\n\n    @Test\n    public void shouldReportNullPerspectiveInitially() throws Exception {\n        assertNull(perspectiveManager.getCurrentPerspective());\n    }\n\n    @Test\n    public void shouldReportNewPerspectiveAsCurrentAfterSwitching() throws Exception {\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        assertSame(oz,\n                   perspectiveManager.getCurrentPerspective());\n    }\n\n    @Test\n    public void shouldSaveNonTransientPerspectives() throws Exception {\n        PerspectiveDefinition kansasDefinition = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n\n        PerspectiveActivity kansas = mock(PerspectiveActivity.class);\n        when(kansas.getDefaultPerspectiveLayout()).thenReturn(kansasDefinition);\n        when(kansas.getIdentifier()).thenReturn(\"kansas_perspective\");\n        when(kansas.isTransient()).thenReturn(false);\n\n        perspectiveManager.switchToPerspective(pr,\n                                               kansas,\n                                               doWhenFinished);\n        perspectiveManager.savePerspectiveState(doWhenFinishedSave);\n\n        verify(wbServices).save(eq(\"kansas_perspective\"),\n                                eq(kansasDefinition),\n                                eq(doWhenFinishedSave));\n    }\n\n    @Test\n    public void shouldNotSaveTransientPerspectives() throws Exception {\n        PerspectiveDefinition kansasDefinition = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n\n        PerspectiveActivity kansas = mock(PerspectiveActivity.class);\n        when(kansas.getDefaultPerspectiveLayout()).thenReturn(kansasDefinition);\n        when(kansas.isTransient()).thenReturn(true);\n\n        perspectiveManager.switchToPerspective(pr,\n                                               kansas,\n                                               doWhenFinished);\n        perspectiveManager.savePerspectiveState(doWhenFinishedSave);\n\n        verify(wbServices,\n               never()).save(any(String.class),\n                             eq(kansasDefinition),\n                             any(Command.class));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void shouldLoadNewNonTransientPerspectiveState() throws Exception {\n        when(oz.isTransient()).thenReturn(false);\n\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(wbServices).loadPerspective(eq(\"oz_perspective\"),\n                                           any(ParameterizedCommand.class));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void shouldNotLoadNewTransientPerspectiveState() throws Exception {\n        when(oz.isTransient()).thenReturn(true);\n\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(wbServices,\n               never()).loadPerspective(eq(\"oz_perspective\"),\n                                        any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void shouldExecuteCallbackWhenDoneLaunchingPerspective() throws Exception {\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(doWhenFinished).execute(ozDefinition);\n    }\n\n    @Test\n    public void shouldFireEventWhenLaunchingNewPerspective() throws Exception {\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(perspectiveChangeEvent).fire(refEq(new PerspectiveChange(pr,\n                                                                        ozDefinition,\n                                                                        null,\n                                                                        \"oz_perspective\")));\n    }\n\n    @Test\n    public void shouldAddAllPanelsToPanelManager() throws Exception {\n        PanelDefinition westPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        PanelDefinition eastPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        PanelDefinition northPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        PanelDefinition southPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        PanelDefinition southWestPanel = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n\n        ozDefinition.getRoot().appendChild(CompassPosition.WEST,\n                                           westPanel);\n        ozDefinition.getRoot().appendChild(CompassPosition.EAST,\n                                           eastPanel);\n        ozDefinition.getRoot().appendChild(CompassPosition.NORTH,\n                                           northPanel);\n        ozDefinition.getRoot().appendChild(CompassPosition.SOUTH,\n                                           southPanel);\n        southPanel.appendChild(CompassPosition.WEST,\n                               southWestPanel);\n\n        // we assume this will be set correctly (verified elsewhere)\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(panelManager).addWorkbenchPanel(ozDefinition.getRoot(),\n                                               westPanel,\n                                               CompassPosition.WEST);\n        verify(panelManager).addWorkbenchPanel(ozDefinition.getRoot(),\n                                               eastPanel,\n                                               CompassPosition.EAST);\n        verify(panelManager).addWorkbenchPanel(ozDefinition.getRoot(),\n                                               northPanel,\n                                               CompassPosition.NORTH);\n        verify(panelManager).addWorkbenchPanel(ozDefinition.getRoot(),\n                                               southPanel,\n                                               CompassPosition.SOUTH);\n        verify(panelManager).addWorkbenchPanel(southPanel,\n                                               southWestPanel,\n                                               CompassPosition.WEST);\n    }\n\n    @Test\n    public void shouldDestroyAllOldPanelsWhenSwitchingRoot() throws Exception {\n        PerspectiveDefinition fooPerspectiveDef = new PerspectiveDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        PanelDefinition rootPanel = fooPerspectiveDef.getRoot();\n        PanelDefinition fooPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PanelDefinition fooChildPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PanelDefinition barPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PanelDefinition bazPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n\n        rootPanel.appendChild(fooPanel);\n        rootPanel.appendChild(barPanel);\n        rootPanel.appendChild(bazPanel);\n\n        fooPanel.appendChild(fooChildPanel);\n\n        PerspectiveActivity fooPerspective = mock(PerspectiveActivity.class);\n        when(fooPerspective.getDefaultPerspectiveLayout()).thenReturn(fooPerspectiveDef);\n        when(fooPerspective.isTransient()).thenReturn(true);\n\n        perspectiveManager.switchToPerspective(pr,\n                                               fooPerspective,\n                                               doWhenFinished);\n        perspectiveManager.switchToPerspective(pr,\n                                               oz,\n                                               doWhenFinished);\n\n        verify(panelManager).removeWorkbenchPanel(fooPanel);\n        verify(panelManager).removeWorkbenchPanel(fooChildPanel);\n        verify(panelManager).removeWorkbenchPanel(barPanel);\n        verify(panelManager).removeWorkbenchPanel(bazPanel);\n        verify(panelManager,\n               never()).removeWorkbenchPanel(rootPanel);\n    }\n\n    @Test\n    public void fetchPerspectiveCommandForAnInvalidDefinitionShouldLoadedPerspectiveDefinitionTest() throws Exception {\n\n        when(oz.isTransient()).thenReturn(false);\n\n        when(fetchCommand.isAValidDefinition(any())).thenReturn(false);\n        fetchCommand.execute();\n\n        assertEquals(oz,\n                     perspectiveManager.getCurrentPerspective());\n        verify(doAfterFetch).execute(eq(ozDefinition));\n    }\n\n    @Test\n    public void fetchPerspectivesForTransientPerspectivesShouldAlwaysLoadDefaultLayoutTest() throws Exception {\n\n        fetchCommand.execute();\n\n        assertEquals(oz,\n                     perspectiveManager.getCurrentPerspective());\n        verify(doAfterFetch).execute(eq(ozDefinition));\n    }\n\n    @Test\n    public void isAValidPerspectiveDefinitionTest() throws Exception {\n        createPartDefinitions();\n\n        when(activityBeansCache.hasActivity(any())).thenReturn(true);\n\n        assertTrue(fetchCommand.isAValidDefinition(createPerspectiveDefinition()));\n        verify(activityBeansCache,\n               times(getTotalOfPartDefinitions())).hasActivity(any());\n    }\n\n    @Test\n    public void isAnInvalidPerspectiveDefinitionTest() throws Exception {\n        assertFalse(fetchCommand.isAValidDefinition(null));\n    }\n\n    @Test\n    public void isAnInvalidPerspectiveDefinition2Test() throws Exception {\n        createPartDefinitions();\n        when(activityBeansCache.hasActivity(any())).thenReturn(true);\n        when(activityBeansCache.hasActivity(\"part3-rootChild2\")).thenReturn(false);\n\n        assertFalse(fetchCommand.isAValidDefinition(createPerspectiveDefinition()));\n    }\n\n    @Test\n    public void getDefaultPerspectiveIdentifierTest() {\n        List<SyncBeanDef<AbstractWorkbenchPerspectiveActivity>> perspectives = new ArrayList<>();\n        final SyncBeanDef<AbstractWorkbenchPerspectiveActivity> otherPerspectiveBeanDef = getPerspectiveBeanDef(\"otherPerspectiveBeanDef\",\n                                                                          false);\n        final SyncBeanDef<AbstractWorkbenchPerspectiveActivity> homePerspectiveBeanDef = getPerspectiveBeanDef(\"homePerspectiveBeanDef\",\n                                                                         true);\n        perspectives.add(otherPerspectiveBeanDef);\n        perspectives.add(homePerspectiveBeanDef);\n        doReturn(perspectives.iterator()).when(perspectiveManager).getPerspectivesIterator();\n\n        final String defaultPerspectiveIdentifier = perspectiveManager.getDefaultPerspectiveIdentifier();\n\n        assertEquals(homePerspectiveBeanDef.getInstance().getIdentifier(),\n                     defaultPerspectiveIdentifier);\n        verify(iocManager).destroyBean(otherPerspectiveBeanDef.getInstance());\n        verify(iocManager,\n               never()).destroyBean(homePerspectiveBeanDef.getInstance());\n    }\n\n    private SyncBeanDef<AbstractWorkbenchPerspectiveActivity> getPerspectiveBeanDef(final String identifier,\n                                                                                    final boolean isDefault) {\n        final AbstractWorkbenchPerspectiveActivity perspectiveActivity = mock(AbstractWorkbenchPerspectiveActivity.class);\n        doReturn(identifier).when(perspectiveActivity).getIdentifier();\n        doReturn(isDefault).when(perspectiveActivity).isDefault();\n\n        final SyncBeanDef<AbstractWorkbenchPerspectiveActivity> perspectiveBeanDef = mock(SyncBeanDef.class);\n        doReturn(perspectiveActivity).when(perspectiveBeanDef).getInstance();\n\n        return perspectiveBeanDef;\n    }\n\n    private PerspectiveDefinition createPerspectiveDefinition() {\n        PerspectiveDefinitionImpl perspectiveDefinition = new PerspectiveDefinitionImpl();\n        PanelDefinition root = perspectiveDefinition.getRoot();\n        partDefinitionsRoot.forEach(p -> root.addPart(p));\n\n        PanelDefinitionImpl rootChild1 = new PanelDefinitionImpl(\"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\");\n        partDefinitionRootChild1.forEach(p -> rootChild1.addPart(p));\n\n        PanelDefinitionImpl rootChild2 = new PanelDefinitionImpl(\"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\");\n        partDefinitionRootChild2.forEach(p -> rootChild2.addPart(p));\n\n        PanelDefinitionImpl rootChild2Child = new PanelDefinitionImpl(\"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\");\n\n        partDefinitionRootChild2Child.forEach(p -> rootChild2Child.addPart(p));\n\n        root.insertChild(mock(Position.class),\n                         rootChild1);\n        rootChild2.insertChild(mock(Position.class),\n                               rootChild2Child);\n        root.insertChild(mock(Position.class),\n                         rootChild2);\n\n        return perspectiveDefinition;\n    }\n\n    private void createPartDefinitions() {\n        partDefinitionsRoot = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest(\"part1\")),\n                                            new PartDefinitionImpl(new DefaultPlaceRequest(\"part2\")));\n\n        partDefinitionRootChild1 = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest(\"part1-rootChild1\")),\n                                                 new PartDefinitionImpl(new DefaultPlaceRequest(\"part2-rootChild1\")),\n                                                 new PartDefinitionImpl(new DefaultPlaceRequest(\"part3-rootChild1\")));\n\n        partDefinitionRootChild2 = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest(\"part1-rootChild2\")),\n                                                 new PartDefinitionImpl(new DefaultPlaceRequest(\"part2-rootChild2\")),\n                                                 new PartDefinitionImpl(new DefaultPlaceRequest(\"part3-rootChild2\")));\n\n        partDefinitionRootChild2Child = Arrays.asList(new PartDefinitionImpl(new DefaultPlaceRequest(\"part1-rootChild2Child\")),\n                                                      new PartDefinitionImpl(new DefaultPlaceRequest(\"part2-rootChild2Child\")),\n                                                      new PartDefinitionImpl(new DefaultPlaceRequest(\"part3-rootChild2Child\")),\n                                                      new PartDefinitionImpl(new DefaultPlaceRequest(\"part4-rootChild2Child\")));\n    }\n\n    private int getTotalOfPartDefinitions() {\n        int total = partDefinitionsRoot.size() +\n                partDefinitionRootChild1.size() +\n                partDefinitionRootChild2.size() +\n                partDefinitionRootChild2Child.size();\n        return total;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/PlaceHistoryHandlerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.mvp;\n\nimport java.util.Set;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.client.workbench.docks.UberfireDock;\nimport org.uberfire.client.workbench.docks.UberfireDockPosition;\nimport org.uberfire.client.workbench.docks.UberfireDocksInteractionEvent;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PlaceHistoryHandlerTest {\n\n    private final WorkbenchScreenActivity screenActivity = mock(WorkbenchScreenActivity.class);\n    private final WorkbenchScreenActivity perspectiveActivity = mock(WorkbenchScreenActivity.class);\n\n    @Mock\n    private PlaceRequestHistoryMapper mapper;\n\n    @Spy\n    PlaceHistoryHandler placeHistoryHandler;\n\n    @Before\n    public void setup() {\n\n        when(screenActivity.isDynamic()).thenReturn(false);\n        when(screenActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        when(screenActivity.onMayClose()).thenReturn(true);\n        when(screenActivity.preferredWidth()).thenReturn(26);\n        when(screenActivity.preferredHeight()).thenReturn(77);\n\n        when(perspectiveActivity.isDynamic()).thenReturn(false);\n        when(perspectiveActivity.isDefault()).thenReturn(true);\n        when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(perspectiveActivity.onMayClose()).thenReturn(true);\n        when(perspectiveActivity.preferredWidth()).thenReturn(26);\n        when(perspectiveActivity.preferredHeight()).thenReturn(77);\n    }\n\n    @Test\n    public void testPerspectiveFromUrlSimple() {\n        PlaceRequest req = new DefaultPlaceRequest(\"perspective\");\n\n        PlaceRequest place = BookmarkableUrlHelper.getPerspectiveFromPlace(req);\n        assertNotNull(place);\n        assertEquals(\"perspective\",\n                     place.getIdentifier());\n        assertSame(place,\n                   req);\n    }\n\n    @Test\n    public void testPerspectiveFromUrlWithHistory() {\n        final String REQUEST = \"perspective|secreenOne,~screenTwo$screenThree\";\n\n        PlaceRequest req = new DefaultPlaceRequest(REQUEST);\n\n        PlaceRequest place = BookmarkableUrlHelper.getPerspectiveFromPlace(req);\n        assertNotNull(place);\n        assertEquals(\"perspective\",\n                     place.getIdentifier());\n        assertNotSame(place,\n                      req);\n    }\n\n    @Test\n    public void testRegisterExistingURL() {\n        final String REQUEST = \"perspective|secreenOne,~screenTwo$screenThree\";\n        final PlaceRequest req = new DefaultPlaceRequest(REQUEST);\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         req);\n        assertEquals(REQUEST,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void testRegisterBuild() {\n        final String SCREEN1_ID = \"screen1\";\n        final String SCREEN2_ID = \"screen2\";\n        final String PERSPECTIVE_ID = \"perspective\";\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final PlaceRequest perspective = new DefaultPlaceRequest(PERSPECTIVE_ID);\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        assertEquals(SCREEN1_ID,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        final String SCREENS_OPEN_LIST = SCREEN1_ID.concat(\",\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        assertEquals(SCREENS_OPEN_LIST,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        final String PERSPECTIVE_STRING = PERSPECTIVE_ID.concat(\"|\").concat(SCREENS_OPEN_LIST);\n        placeHistoryHandler.registerOpen(perspectiveActivity,\n                                         perspective);\n        assertEquals(PERSPECTIVE_STRING,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void TestScreenCloseSimple() {\n        final String SCREEN1_ID = \"screen1\";\n        final String SCREEN2_ID = \"screen2\";\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        assertEquals(SCREEN1_ID,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        final String CLOSED_SCREENS = \"~\".concat(SCREEN1_ID);\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen1);\n        assertEquals(CLOSED_SCREENS,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        String URL = \"~\".concat(SCREEN1_ID).concat(\",\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        assertEquals(URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        URL = \"~\".concat(SCREEN1_ID).concat(\",~\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen2);\n        assertEquals(URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    @SuppressWarnings(value = \"all\")\n    public void TestScreenCloseSimpleWithArgs() {\n        final String SCREEN1_ID = \"screen1\";\n        final String SCREEN2_ID = \"screen2\";\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final String PAR1_KEY = \"y\";\n        final String PAR1_VALUE = \"x\";\n        final String PAR2_KEY = \"a\";\n        final String PAR2_VALUE = \"b\";\n        final String PARAM_TAIL =\n                getParamListForTest(PAR2_KEY,\n                                    PAR2_VALUE,\n                                    PAR1_KEY,\n                                    PAR1_VALUE);\n\n        screen1.addParameter(PAR1_KEY,\n                             PAR1_VALUE);\n        screen1.addParameter(PAR2_KEY,\n                             PAR2_VALUE);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        assertEquals(SCREEN1_ID.concat(PARAM_TAIL),\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        final String CLOSED_SCREENS = \"~\".concat(SCREEN1_ID)\n                .concat(PARAM_TAIL);\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen1);\n        assertEquals(CLOSED_SCREENS,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        String URL = \"~\".concat(SCREEN1_ID)\n                .concat(PARAM_TAIL)\n                .concat(\",\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        assertEquals(URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        URL = \"~\".concat(SCREEN1_ID)\n                .concat(PARAM_TAIL)\n                .concat(\",~\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen2);\n        assertEquals(URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void testOtherScreen() {\n        final String SCREEN1_ID = \"screen1\";\n        final String SCREEN2_ID = \"screen2\";\n        final String SCREEN3_ID = \"screen3\";\n        final String PERSPECTIVE_ID = \"perspective\";\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final PlaceRequest screen3 = new DefaultPlaceRequest(SCREEN3_ID);\n        final PlaceRequest perspective = new DefaultPlaceRequest(PERSPECTIVE_ID);\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        assertEquals(SCREEN1_ID,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        final String PERSPECTIVE_STRING = PERSPECTIVE_ID.concat(\"|\").concat(SCREEN1_ID);\n        placeHistoryHandler.registerOpen(perspectiveActivity,\n                                         perspective);\n        assertEquals(PERSPECTIVE_STRING,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        String EXPECTED_URL = PERSPECTIVE_STRING.concat(\"$\").concat(SCREEN2_ID);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        EXPECTED_URL = EXPECTED_URL.concat(\",\").concat(SCREEN3_ID);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen3);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n//    @SuppressWarnings(value = \"all\")\n    public void testCloseAllScreens() {\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final PlaceRequest screen3 = new DefaultPlaceRequest(SCREEN3_ID);\n        final PlaceRequest screen4 = new DefaultPlaceRequest(SCREEN4_ID);\n\n        prepareCompleteUrlWithParamsForTests();\n\n        String EXPECTED_URL = \"perspective|screen1,~screen2$screen3?y=x,screen4?y=x\";\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen2);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        EXPECTED_URL = \"perspective|screen1,~screen2$screen4?y=x\";\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen3);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        EXPECTED_URL = \"perspective|screen1,~screen2\";\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen4);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n\n        EXPECTED_URL = \"perspective|~screen1,~screen2\";\n        placeHistoryHandler.registerClose(screenActivity,\n                                          screen1);\n        assertEquals(EXPECTED_URL,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void TestFlush() {\n        prepareCompleteUrlForTests();\n        placeHistoryHandler.flush();\n        assertNotNull(placeHistoryHandler.getCurrentBookmarkableURLStatus());\n        assertEquals(\"\",\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    /**\n     * Open a dock and then close it\n     */\n    @Test\n    public void testRegisterOpenDock() {\n        final String dockName = \"testDock\";\n        final String placeRequestName = \"testPlacerequest\";\n\n        // simulate an opened screen first\n        PlaceRequest place = new DefaultPlaceRequest(placeRequestName);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         place);\n        // mock a dock\n        PlaceRequest dockPlace = new DefaultPlaceRequest(dockName);\n        UberfireDocksInteractionEvent openEvent = mock(UberfireDocksInteractionEvent.class);\n\n        UberfireDock dock = mock(UberfireDock.class);\n        // simulate a docked screen in west position\n        when(dock.getDockPosition()).thenReturn(UberfireDockPosition.WEST);\n        when(dock.getIdentifier()).thenReturn(dockName);\n        when(dock.getIconType()).thenReturn(\"iconType\");\n        when(dock.getPlaceRequest()).thenReturn(dockPlace);\n\n        when(openEvent.getType()).thenReturn(UberfireDocksInteractionEvent.InteractionType.OPENED);\n        when(openEvent.getTargetDock()).thenReturn(dock);\n        placeHistoryHandler.registerOpenDock(openEvent);\n\n        // compose the expected URL\n        StringBuilder expected = new StringBuilder(placeRequestName);\n        expected.append(BookmarkableUrlHelper.DOCK_BEGIN_SEP);\n        expected.append(\"W\"); // dock was mocked in WEST position\n        expected.append(dockName);\n        expected.append(BookmarkableUrlHelper.SEPARATOR);\n        expected.append(BookmarkableUrlHelper.DOCK_CLOSE_SEP);\n        assertEquals(expected.toString(),\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void testRegisterCloseDock() {\n        final String dockName = \"testDock\";\n        final String placeRequestName = \"testPlacerequest\";\n\n        // simulate an opened screen first\n        PlaceRequest place = new DefaultPlaceRequest(placeRequestName);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         place);\n        // mock a dock\n        PlaceRequest dockPlace = new DefaultPlaceRequest(dockName);\n        UberfireDocksInteractionEvent openEvent = mock(UberfireDocksInteractionEvent.class);\n        UberfireDocksInteractionEvent closeEvent = mock(UberfireDocksInteractionEvent.class);\n\n        UberfireDock dock = mock(UberfireDock.class);\n        // simulate a docked screen in west position\n        when(dock.getDockPosition()).thenReturn(UberfireDockPosition.WEST);\n        when(dock.getIdentifier()).thenReturn(dockName);\n        when(dock.getIconType()).thenReturn(\"iconType\");\n        when(dock.getPlaceRequest()).thenReturn(dockPlace);\n\n        when(openEvent.getType()).thenReturn(UberfireDocksInteractionEvent.InteractionType.OPENED);\n        when(openEvent.getTargetDock()).thenReturn(dock);\n        when(closeEvent.getType()).thenReturn(UberfireDocksInteractionEvent.InteractionType.CLOSED);\n        when(closeEvent.getTargetDock()).thenReturn(dock);\n        // open...\n        placeHistoryHandler.registerOpenDock(openEvent);\n        // ...close dock\n        placeHistoryHandler.registerCloseDock(closeEvent);\n\n        // compose the expected URL\n        StringBuilder expected = new StringBuilder(placeRequestName);\n        expected.append(BookmarkableUrlHelper.DOCK_BEGIN_SEP);\n        expected.append(BookmarkableUrlHelper.CLOSED_DOCK_PREFIX);\n        expected.append(\"W\"); // dock was mocked in WEST position\n        expected.append(dockName);\n        expected.append(BookmarkableUrlHelper.SEPARATOR);\n        expected.append(BookmarkableUrlHelper.DOCK_CLOSE_SEP);\n        assertEquals(expected.toString(),\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    @Test\n    public void testUrlLimit() {\n        int cnt = 0;\n        int length = 0;\n\n        do {\n            final PlaceRequest screen = new DefaultPlaceRequest(\"screen\".concat(String.valueOf(cnt++)));\n\n            placeHistoryHandler.registerOpen(screenActivity,\n                                             screen);\n\n            if (length == placeHistoryHandler.getCurrentBookmarkableURLStatus().length()) {\n                break;\n            }\n            length = placeHistoryHandler.getCurrentBookmarkableURLStatus().length();\n        } while ((placeHistoryHandler.getCurrentBookmarkableURLStatus().length()\n                < BookmarkableUrlHelper.MAX_NAV_URL_SIZE + 100));\n        assertNotNull(placeHistoryHandler.getCurrentBookmarkableURLStatus());\n        assertFalse(placeHistoryHandler.getCurrentBookmarkableURLStatus().length()\n                            > BookmarkableUrlHelper.MAX_NAV_URL_SIZE);\n    }\n\n    @Test\n    public void testGetOpenScreens() {\n        final String url = \"perspective|screen1,!screen2,~screen3$!screen4\";\n        final PlaceRequest req = new DefaultPlaceRequest(url);\n\n        Set<String> opened = BookmarkableUrlHelper.getOpenedScreenFromPlace(req);\n        assertNotNull(opened);\n        assertEquals(3L,\n                     opened.size());\n        assertTrue(opened.contains(SCREEN1_ID));\n        assertTrue(opened.contains(\"!\" + SCREEN2_ID));\n        assertTrue(opened.contains(\"!\" + SCREEN4_ID));\n    }\n\n    @Test\n    public void testGetClosedScreens() {\n        final String url = \"perspective|screen1,~!screen2,~screen3$~!screen4\";\n        final PlaceRequest req = new DefaultPlaceRequest(url);\n\n        Set<String> closed = BookmarkableUrlHelper.getClosedScreenFromPlace(req);\n        assertNotNull(closed);\n        assertEquals(3L,\n                     closed.size());\n        assertTrue(closed.contains(\"~\" + SCREEN3_ID));\n        assertTrue(closed.contains(\"~!\" + SCREEN2_ID));\n        assertTrue(closed.contains(\"~!\" + SCREEN4_ID));\n    }\n\n    /**\n     * Prepare an URL -> perspective|screen1,screen2$screen3,screen4\n     */\n    private void prepareCompleteUrlForTests() {\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final PlaceRequest screen3 = new DefaultPlaceRequest(SCREEN3_ID);\n        final PlaceRequest screen4 = new DefaultPlaceRequest(SCREEN4_ID);\n        final PlaceRequest perspective = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final String expectedUrl = \"perspective|screen1,screen2$screen3,screen4\";\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        placeHistoryHandler.registerOpen(perspectiveActivity,\n                                         perspective);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen3);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen4);\n        assertEquals(expectedUrl,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    /**\n     * Prepare an URL -> perspective|screen1,screen2$screen3?y=x,screen4?y=x\n     */\n//    @SuppressWarnings(value = \"all\")\n    private void prepareCompleteUrlWithParamsForTests() {\n        final PlaceRequest screen1 = new DefaultPlaceRequest(SCREEN1_ID);\n        final PlaceRequest screen2 = new DefaultPlaceRequest(SCREEN2_ID);\n        final PlaceRequest screen3 = new DefaultPlaceRequest(SCREEN3_ID);\n        final PlaceRequest screen4 = new DefaultPlaceRequest(SCREEN4_ID);\n        final PlaceRequest perspective = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final String PAR_KEY = \"y\";\n        final String PAR_VALUE = \"x\";\n        final String PARAM_TAIL =\n                getParamListForTest(PAR_KEY,\n                                    PAR_VALUE);\n        final String expectedUrl = \"perspective|screen1,screen2$screen3\"\n                + PARAM_TAIL + \",screen4\" + PARAM_TAIL;\n\n        screen3.addParameter(PAR_KEY,\n                             PAR_VALUE);\n        screen4.addParameter(PAR_KEY,\n                             PAR_VALUE);\n\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen1);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen2);\n        placeHistoryHandler.registerOpen(perspectiveActivity,\n                                         perspective);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen3);\n        placeHistoryHandler.registerOpen(screenActivity,\n                                         screen4);\n        assertEquals(expectedUrl,\n                     placeHistoryHandler.getCurrentBookmarkableURLStatus());\n    }\n\n    /**\n     * Return the list of parameters needed for test\n     * @param txt\n     * @return\n     */\n    private String getParamListForTest(String... txt) {\n        boolean isQM = true;\n        StringBuilder param = new StringBuilder();\n\n        for (int i = 0; i < txt.length; i++) {\n            if ((i == 0)\n                    || (i % 2 == 0)) {\n                if (isQM) {\n                    param.append(\"?\");\n                    isQM = false;\n                } else {\n                    param.append(\"&\");\n                }\n                param.append(txt[i]);\n            } else {\n                param.append(\"=\");\n                param.append(txt[i]);\n            }\n        }\n        return param.toString();\n    }\n\n    final static String SCREEN1_ID = \"screen1\";\n    final static String SCREEN2_ID = \"screen2\";\n    final static String SCREEN3_ID = \"screen3\";\n    final static String SCREEN4_ID = \"screen4\";\n    final static String PERSPECTIVE_ID = \"perspective\";\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/PlaceRequestHistoryMapperImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.io.UnsupportedEncodingException;\nimport java.lang.annotation.Annotation;\nimport java.net.URLDecoder;\nimport java.util.Arrays;\nimport java.util.HashSet;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.junit.Before;\nimport org.junit.BeforeClass;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.PathFactory;\nimport org.uberfire.backend.vfs.impl.ObservablePathImpl;\nimport org.uberfire.client.util.MockIOCBeanDef;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.junit.Assert.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PlaceRequestHistoryMapperImplTest {\n\n    private PlaceRequestHistoryMapperImpl placeRequestHistoryMapper;\n\n    @BeforeClass\n    public static void setupBeans() {\n        ((SyncBeanManagerImpl) IOC.getBeanManager()).reset();\n\n        IOC.getBeanManager().registerBean(new MockIOCBeanDef<ObservablePath, ObservablePathImpl>(new ObservablePathImpl(),\n                                                                                                 ObservablePath.class,\n                                                                                                 Dependent.class,\n                                                                                                 new HashSet<Annotation>(Arrays.asList(QualifierUtil.DEFAULT_QUALIFIERS)),\n                                                                                                 null,\n                                                                                                 true));\n    }\n\n    @Before\n    public void setup() {\n        placeRequestHistoryMapper = new PlaceRequestHistoryMapperImpl() {\n            @Override\n            String urlDecode(String value) {\n                try {\n                    return URLDecoder.decode(value,\n                                             \"UTF-8\");\n                } catch (UnsupportedEncodingException e) {\n                    throw new RuntimeException(e);\n                }\n            }\n        };\n    }\n\n    @Test\n    public void createPlaceRequest() throws Exception {\n        String url = \" http://127.0.0.1:8888/org.uberfire.UberfireShowcase/out.16590-4829.erraiBus?z=12&clientId=16590-4829\";\n        PlaceRequest placeRequest = placeRequestHistoryMapper.getPlaceRequest(url);\n        assertEquals(url.substring(0,\n                                   url.indexOf(\"?\")),\n                     placeRequest.getIdentifier());\n\n        Map<String, String> parameters = placeRequest.getParameters();\n\n        assertFalse(parameters.isEmpty());\n        assertTrue(parameters.containsKey(\"z\"));\n        assertTrue(parameters.containsKey(\"clientId\"));\n        assertEquals(\"12\",\n                     parameters.get(\"z\"));\n        assertEquals(\"16590-4829\",\n                     parameters.get(\"clientId\"));\n    }\n\n    @Test\n    public void createPathPlaceRequest() throws Exception {\n        final Path path = PathFactory.newPath(\"file\",\n                                              \"default://main@repo/path/to/file\");\n        final PlaceRequest placeRequestOriginal = new PathPlaceRequest(path);\n\n        PlaceRequest placeRequest = placeRequestHistoryMapper.getPlaceRequest(placeRequestOriginal.getFullIdentifier());\n        assertEquals(placeRequestOriginal.getFullIdentifier(),\n                     placeRequest.getFullIdentifier());\n\n        assertTrue(placeRequest.getParameters().isEmpty());\n    }\n\n    @Test\n    public void createPathPlaceRequestWithSpaces() throws Exception {\n        final Path path = PathFactory.newPath(\"Dummy rule.drl\",\n                                              \"default://main@uf-playground/mortgages/src/main/resources/org/mortgages/Dummy%20rule.drl\");\n        final PlaceRequest placeRequestOriginal = new PathPlaceRequest(path);\n\n        PlaceRequest placeRequest = placeRequestHistoryMapper.getPlaceRequest(placeRequestOriginal.getFullIdentifier());\n        assertEquals(placeRequestOriginal.getFullIdentifier(),\n                     placeRequest.getFullIdentifier());\n\n        assertTrue(placeRequest.getParameters().isEmpty());\n    }\n\n    @Test\n    public void identifierAndParametersShouldBeUrlDecoded() throws Exception {\n        PlaceRequest placeRequest = placeRequestHistoryMapper.getPlaceRequest(\"place%20id?par%26am%201=value%201\");\n        assertEquals(\"place id\",\n                     placeRequest.getIdentifier());\n        assertEquals(placeRequest.getParameters().get(\"par&am 1\"),\n                     \"value 1\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/ResourceTypeManagerCacheTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.List;\n\nimport javax.enterprise.event.Event;\n\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.util.GWTEditorNativeRegister;\nimport org.uberfire.client.workbench.events.NewPerspectiveEvent;\nimport org.uberfire.client.workbench.events.NewWorkbenchScreenEvent;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.workbench.category.Category;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ResourceTypeManagerCacheTest {\n\n    public static final String MODEL_CATEGORY = \"MODEL\";\n    public static final String MODEL_TYPE = \"java\";\n\n    public static final String FORM_CATEGORY = \"FORM\";\n    public static final String FORM_TYPE = \"frm\";\n\n    public static final String ANY_RESOURCE = \"any.resource\";\n\n    @Mock\n    private SyncBeanManager iocManager;\n\n    @Mock\n    private Event<NewPerspectiveEvent> newPerspectiveEventEvent;\n\n    @Mock\n    private Event<NewWorkbenchScreenEvent> newWorkbenchScreenEvent;\n\n    @Mock\n    private CategoriesManagerCache categoriesManagerCache;\n\n    private ResourceTypeManagerCache resourceTypeManagerCache;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @Mock\n    private GWTEditorNativeRegister gwtEditorNativeRegister;\n\n    private ActivityBeansCache activityBeansCache;\n\n    private EditorDef defaultEditorDef;\n    \n    private EditorDef modelEditorDef;\n\n    private EditorDef formEditorDef;\n\n    private List<Class> experimentalTestActivities = new ArrayList<>();\n\n    @Before\n    public void setUp() {\n        experimentalTestActivities.add(ModelEditorActivity.class);\n        experimentalTestActivities.add(FormEditorActivity.class);\n        experimentalTestActivities.add(DefaultEditorActivity.class);\n\n        when(experimentalActivitiesAuthorizationManager.authorizeActivityClass(any())).thenAnswer(new Answer<Boolean>() {\n            @Override\n            public Boolean answer(InvocationOnMock invocationOnMock) throws Throwable {\n                Class type = (Class) invocationOnMock.getArguments()[0];\n                return experimentalTestActivities.contains(type);\n            }\n        });\n\n        resourceTypeManagerCache = new ResourceTypeManagerCache(categoriesManagerCache);\n\n        activityBeansCache = new ActivityBeansCache(iocManager,\n                                                    newPerspectiveEventEvent,\n                                                    newWorkbenchScreenEvent,\n                                                    resourceTypeManagerCache,\n                                                    experimentalActivitiesAuthorizationManager,\n                                                    gwtEditorNativeRegister);\n\n        modelEditorDef = registerResourceType(MODEL_CATEGORY, ModelEditorActivity.class, MODEL_TYPE, \"1\");\n        formEditorDef = registerResourceType(FORM_CATEGORY, FormEditorActivity.class, FORM_TYPE, \"2\");\n    }\n\n    private void registerDefaultResourceType() {\n        ClientResourceType anyResourceType = mock(ClientResourceType.class);\n        when(anyResourceType.accept(any())).thenReturn(true);\n\n        defaultEditorDef = registerResourceType(anyResourceType, DefaultEditorActivity.class, \"\", \"-1\", null);\n    }\n    \n    private EditorDef registerResourceType(ClientResourceType resourceType, Class<?> editorActivityClass, String type, String priority, Category category) {\n        SyncBeanDef<ClientResourceType> typeBeanDef = mock(SyncBeanDef.class);\n        when(typeBeanDef.getInstance()).thenReturn(resourceType);\n        Collection<SyncBeanDef> resourceTypeBeans = Arrays.asList(typeBeanDef);\n\n        when(iocManager.lookupBeans(eq(type))).thenReturn(resourceTypeBeans);\n\n        SyncBeanDef editorActivityDef = mock(SyncBeanDef.class);\n        when(editorActivityDef.getBeanClass()).thenReturn(editorActivityClass);\n        when(editorActivityDef.getName()).thenReturn(type);\n\n        activityBeansCache.addNewEditorActivity(editorActivityDef, priority, type);\n\n        return new EditorDef(editorActivityDef, resourceType, category);\n    }\n\n    private EditorDef registerResourceType(String categoryName, Class<?> editorActivityClass, String type, String priority) {\n        Category category = mock(Category.class);\n\n        ClientResourceType resourceType = mock(ClientResourceType.class);\n        when(resourceType.getCategory()).thenReturn(category);\n        when(resourceType.accept(any(Path.class))).thenAnswer((Answer<Boolean>) invocationOnMock -> {\n            Path path = (Path) invocationOnMock.getArguments()[0];\n\n            return path.getFileName().endsWith(type);\n        });\n\n        return registerResourceType(resourceType, editorActivityClass, type, priority, category);\n    }\n\n    @Test\n    public void testGetResourceTypeDefinitions() {\n        Category process = mock(Category.class);\n\n        Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(process))\n                .isEmpty();\n\n        Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(modelEditorDef.getCategory()))\n                .hasSize(1)\n                .containsExactly(modelEditorDef.getResourceType());\n\n        Assertions.assertThat(resourceTypeManagerCache.getResourceTypeDefinitionsByCategory(formEditorDef.getCategory()))\n                .hasSize(1)\n                .containsExactly(formEditorDef.getResourceType());\n    }\n\n    @Test\n    public void testGetUnknownEditorByPathWithoutDefaultEditor() {\n        Path path = mock(Path.class);\n        when(path.getFileName()).thenReturn(ANY_RESOURCE);\n\n        Assertions.assertThatThrownBy(() -> {\n            activityBeansCache.getActivity(path);\n        }).isInstanceOf(ActivityBeansCache.EditorResourceTypeNotFound.class);\n    }\n\n    @Test\n    public void testGetUnknownEditorByPathWithDefaultEditor() {\n        registerDefaultResourceType();\n\n        Path path = mock(Path.class);\n        when(path.getFileName()).thenReturn(ANY_RESOURCE);\n\n        Assertions.assertThat(activityBeansCache.getActivity(path))\n                .isNotNull()\n                .isEqualTo(defaultEditorDef.getEditorActivityBeanDef());\n\n    }\n\n    @Test\n    public void testGetEditorByPath() {\n        Path path = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(\"any.\" + MODEL_TYPE);\n\n        Assertions.assertThat(activityBeansCache.getActivity(path))\n                .isNotNull()\n                .isEqualTo(modelEditorDef.getEditorActivityBeanDef());\n\n        when(path.getFileName()).thenReturn(\"any.\" + FORM_TYPE);\n\n        Assertions.assertThat(activityBeansCache.getActivity(path))\n                .isNotNull()\n                .isEqualTo(formEditorDef.getEditorActivityBeanDef());\n\n    }\n\n    @Test\n    public void testGetDefaultEditoFromDisabledExperimentalEditorByPath() {\n        Path path = mock(Path.class);\n\n        when(path.getFileName()).thenReturn(\"any.\" + FORM_TYPE);\n\n        registerDefaultResourceType();\n\n        // Removing this will make Experimental FormEditorActivity disabled\n        experimentalTestActivities.remove(FormEditorActivity.class);\n\n        Assertions.assertThat(activityBeansCache.getActivity(path))\n                .isNotNull()\n                .isEqualTo(defaultEditorDef.getEditorActivityBeanDef());\n    }\n    \n        \n    public class EditorDef {\n        private SyncBeanDef editorActivity;\n        private ClientResourceType resourceType;\n        private Category category;\n\n        public EditorDef(SyncBeanDef editorActivity, ClientResourceType resourceType, Category category) {\n            this.editorActivity = editorActivity;\n            this.resourceType = resourceType;\n            this.category = category;\n        }\n\n        public SyncBeanDef getEditorActivityBeanDef() {\n            return editorActivity;\n        }\n\n        public ClientResourceType getResourceType() {\n            return resourceType;\n        }\n\n        public Category getCategory() {\n            return category;\n        }\n    }\n\n    private class ModelEditorActivity {}\n\n    private class FormEditorActivity {}\n\n    private class DefaultEditorActivity {}\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/mvp/WorkbenchEditorActivityTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport javax.enterprise.inject.Instance;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ExternalPathPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.EDITOR_PROVIDED;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.FRAMEWORK_PESSIMISTIC;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchEditorActivityTest {\n\n    @Mock\n    private Instance<LockManager> lockManagerProvider;\n\n    @Mock\n    private LockManager lockManager;\n\n    @Mock\n    private PathPlaceRequest place;\n\n    @Mock\n    private ObservablePath path;\n\n    @Mock\n    private ExternalPathPlaceRequest extPlace;\n\n    @Mock\n    private Path plainPath;\n\n    @Mock\n    private IsWidget isWidget;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setup() {\n        when(lockManagerProvider.get()).thenReturn(lockManager);\n        when(place.getPath()).thenReturn(path);\n    }\n\n    @Test\n    public void editorProvidedLockingDoesNotAcquireLocks() {\n        EditorTestActivity activity = new EditorTestActivity(lockManagerProvider,\n                                                             placeManager,\n                                                             EDITOR_PROVIDED);\n\n        activity.onStartup(place);\n        activity.onOpen();\n\n        verify(lockManagerProvider,\n               never()).get();\n        verify(lockManager,\n               never()).acquireLockOnDemand();\n    }\n\n    @Test\n    public void editorProvidedLockingDoesNotReleasesLocks() {\n        EditorTestActivity activity = new EditorTestActivity(lockManagerProvider,\n                                                             placeManager,\n                                                             EDITOR_PROVIDED);\n\n        activity.onStartup(place);\n        activity.onOpen();\n        activity.onClose();\n\n        verify(lockManagerProvider,\n               never()).destroy(eq(lockManager));\n        verify(lockManager,\n               never()).releaseLock();\n    }\n\n    @Test\n    public void frameworkProvidedLockingAcquiresLocks() {\n        EditorTestActivity activity = new EditorTestActivity(lockManagerProvider,\n                                                             placeManager,\n                                                             FRAMEWORK_PESSIMISTIC);\n\n        activity.onStartup(place);\n        activity.onOpen();\n\n        verify(lockManagerProvider,\n               times(1)).get();\n        verify(lockManager,\n               times(1)).acquireLockOnDemand();\n    }\n\n    @Test\n    public void frameworkProvidedLockingReleasesLocks() {\n        EditorTestActivity activity = new EditorTestActivity(lockManagerProvider,\n                                                             placeManager,\n                                                             FRAMEWORK_PESSIMISTIC);\n\n        activity.onStartup(place);\n        activity.onOpen();\n        activity.onClose();\n\n        verify(lockManagerProvider,\n               times(1)).destroy(eq(lockManager));\n        verify(lockManager,\n               times(1)).releaseLock();\n    }\n\n    @Test\n    public void editorCreatesObservablePathForExternalPlaceRequest() {\n        EditorTestActivity activity = Mockito.spy(new EditorTestActivity(lockManagerProvider,\n                                                                         placeManager,\n                                                                         EDITOR_PROVIDED));\n\n        doAnswer(new Answer<Void>() {\n            public Void answer(InvocationOnMock invocation) {\n                return null;\n            }\n        }).when(activity).onStartup(any(Path.class),\n                                    any(PlaceRequest.class));\n\n        when(extPlace.getPath()).thenReturn(plainPath);\n        activity.onStartup(extPlace);\n\n        verify(activity).onStartup(any(Path.class),\n                                   any(PlaceRequest.class));\n    }\n\n    private class EditorTestActivity extends AbstractWorkbenchEditorActivity {\n\n        private LockingStrategy strategy;\n\n        public EditorTestActivity(Instance<LockManager> lockManagerProvider,\n                                  PlaceManager placeManager,\n                                  LockingStrategy strategy) {\n            super(placeManager);\n            this.lockManagerProvider = lockManagerProvider;\n            this.strategy = strategy;\n        }\n\n        @Override\n        public String getIdentifier() {\n            return null;\n        }\n\n        @Override\n        public String getTitle() {\n            return null;\n        }\n\n        @Override\n        public IsWidget getWidget() {\n            return isWidget;\n        }\n\n        @Override\n        protected LockingStrategy getLockingStrategy() {\n            return strategy;\n        }\n\n        @Override\n        public boolean isDynamic() {\n            return true;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/util/CSSLocatorsUtilsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.util;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class CSSLocatorsUtilsTest {\n\n    @Test\n    public void testBuildLocator() throws Exception {\n        assertEquals(\"\", CSSLocatorsUtils.buildLocator(\" \"));\n        assertEquals(\"abc\", CSSLocatorsUtils.buildLocator(\"abc\"));\n        assertEquals(\"a-b-c\", CSSLocatorsUtils.buildLocator(\"a\", \"b\", \"c\"));\n        assertEquals(\"a-bc\", CSSLocatorsUtils.buildLocator(\"a\", \"bc\"));\n        assertEquals(\"a-bc\", CSSLocatorsUtils.buildLocator(\"a\", \"bc\", null));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/util/LayoutsTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.util;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.workbench.model.PanelDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class LayoutsTest {\n\n    @Mock\n    PanelDefinition panelDef;\n\n    @Test\n    public void widthOrDefault() {\n        when(panelDef.getWidthAsInt()).thenReturn(42);\n        Integer width = Layouts.widthOrDefault(panelDef);\n\n        assertEquals(42,\n                     width.intValue());\n\n        when(panelDef.getWidthAsInt()).thenReturn(-1);\n        width = Layouts.widthOrDefault(panelDef);\n\n        assertEquals(Layouts.DEFAULT_CHILD_SIZE,\n                     width.intValue());\n    }\n\n    @Test\n    public void heightOrDefault() {\n        when(panelDef.getHeightAsInt()).thenReturn(42);\n        Integer height = Layouts.heightOrDefault(panelDef);\n\n        assertEquals(42,\n                     height.intValue());\n\n        when(panelDef.getHeightAsInt()).thenReturn(-1);\n        height = Layouts.heightOrDefault(panelDef);\n\n        assertEquals(Layouts.DEFAULT_CHILD_SIZE,\n                     height.intValue());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/util/MockIOCBeanDef.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.util;\n\nimport java.lang.annotation.Annotation;\nimport java.util.Arrays;\nimport java.util.Collections;\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\n\npublic class MockIOCBeanDef<T, B extends T>\n        implements\n        SyncBeanDef<T> {\n\n    private final B beanInstance;\n    private final Class<T> type;\n    private final Class<? extends Annotation> scope;\n    private final Set<Annotation> qualifiers;\n    private final String name;\n    private final boolean activated;\n    private final Set<Class<?>> assignableTypes = new HashSet<>();\n\n    public MockIOCBeanDef(final B beanInstance,\n                          final Class<T> type,\n                          final Class<? extends Annotation> scope,\n                          final Set<Annotation> qualifiers,\n                          final String name,\n                          final boolean activated,\n                          final Class<?>... otherTypes) {\n        this.beanInstance = beanInstance;\n        this.type = type;\n        this.scope = scope;\n        this.qualifiers = qualifiers;\n        this.name = name;\n        this.activated = activated;\n        assignableTypes.add(type);\n        assignableTypes.addAll(Arrays.asList(otherTypes));\n    }\n\n    @Override\n    public Class<T> getType() {\n        return type;\n    }\n\n    @Override\n    public Class<?> getBeanClass() {\n        return beanInstance.getClass();\n    }\n\n    @Override\n    public Class<? extends Annotation> getScope() {\n        return scope;\n    }\n\n    @Override\n    public T getInstance() {\n        return beanInstance;\n    }\n\n    @Override\n    public T newInstance() {\n        return beanInstance;\n    }\n\n    @Override\n    public Set<Annotation> getQualifiers() {\n        if (qualifiers == null) {\n            return Collections.emptySet();\n        } else {\n            return qualifiers;\n        }\n    }\n\n    @Override\n    public boolean matches(final Set<Annotation> annotations) {\n        return QualifierUtil.matches(annotations,\n                                     getQualifiers());\n    }\n\n    @Override\n    public String getName() {\n        return name;\n    }\n\n    @Override\n    public boolean isActivated() {\n        return activated;\n    }\n\n    @Override\n    public boolean isAssignableTo(final Class<?> type) {\n        return assignableTypes.contains(type);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/DefaultBeanFactoryTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Answers;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.workbench.pmgr.nswe.part.WorkbenchPartPresenterDefault;\nimport org.uberfire.client.workbench.pmgr.unanchored.part.UnanchoredWorkbenchPartPresenter;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class DefaultBeanFactoryTest {\n\n    @Mock\n    private UnanchoredWorkbenchPartPresenter unanchoredWorkbenchPartPresenter;\n\n    @Mock\n    private WorkbenchPartPresenterDefault workbenchPartPresenterDefault;\n\n    @Mock(answer = Answers.RETURNS_DEEP_STUBS)\n    private SyncBeanManager iocManager;\n\n    @InjectMocks\n    private DefaultBeanFactory beanFactory;\n\n    @Before\n    public void setup() {\n        when(iocManager.lookupBean(UnanchoredWorkbenchPartPresenter.class).getInstance()).thenReturn(unanchoredWorkbenchPartPresenter);\n        when(iocManager.lookupBean(WorkbenchPartPresenterDefault.class).getInstance()).thenReturn(workbenchPartPresenterDefault);\n    }\n\n    @Test\n    public void testNewTemplateWorkbenchPartPresenter() {\n        beanFactory.newWorkbenchPart(null,\n                                     null,\n                                     null,\n                                     null,\n                                     UnanchoredWorkbenchPartPresenter.class);\n        verify(iocManager.lookupBean(UnanchoredWorkbenchPartPresenter.class)).getInstance();\n        verify(iocManager.lookupBean(WorkbenchPartPresenterDefault.class),\n               never()).getInstance();\n    }\n\n    @Test\n    public void testNewWorkbenchPartPresenterDefault() {\n        beanFactory.newWorkbenchPart(null,\n                                     null,\n                                     null,\n                                     null,\n                                     WorkbenchPartPresenterDefault.class);\n        verify(iocManager.lookupBean(WorkbenchPartPresenterDefault.class)).getInstance();\n        verify(iocManager.lookupBean(UnanchoredWorkbenchPartPresenter.class),\n               never()).getInstance();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/PanelManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.elemental2.Elemental2DomUtil;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Answers;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.workbench.events.PanelFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceGainFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceHiddenEvent;\nimport org.uberfire.client.workbench.events.PlaceLostFocusEvent;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.events.SelectPlaceEvent;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.impl.SimpleWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.impl.StaticWorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertSame;\nimport static org.junit.Assert.assertTrue;\nimport static org.junit.Assert.fail;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.refEq;\nimport static org.mockito.Mockito.RETURNS_DEEP_STUBS;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PanelManagerTest {\n\n    @Mock\n    BeanFactory beanFactory;\n    @Mock\n    StubPlaceGainFocusEvent placeGainFocusEvent;\n    @Mock\n    StubPlaceLostFocusEvent placeLostFocusEvent;\n    @Mock\n    StubSelectPlaceEvent selectPlaceEvent;\n    @Mock\n    StubPanelFocusEvent panelFocusEvent;\n    @Mock\n    StubPlaceMaximizedEvent placeMaximizedEvent;\n    @Mock\n    StubPlaceMinimizedEvent placeMinimizedEvent;\n    @Mock\n    StubPlaceHiddenEvent placeHidEvent;\n    @Mock\n    SimpleWorkbenchPanelPresenter workbenchPanelPresenter;\n    @Mock(answer = Answers.RETURNS_DEEP_STUBS)\n    LayoutSelection layoutSelection;\n    @Mock\n    Elemental2DomUtil elemental2DomUtil;\n\n    private PanelManagerImpl panelManager;\n\n    /**\n     * This is the part presenter that will be returned by the mock BeanFactory in response to any newWorkbenchPart()\n     * call. Tests that work with more than one part will have to create their own more specific when/then rules.\n     */\n    private WorkbenchPartPresenter partPresenter;\n\n    /**\n     * This perspective is set as the current perspective on the PanelManager before each test is run.\n     */\n    private PerspectiveDefinition testPerspectiveDef;\n\n    /**\n     * This is the Panel Presenter returned by the mock BeanFactory when asked for <tt>newWorkbenchPanel( testPerspectiveDef.getRoot() ) )</tt>.\n     */\n    private WorkbenchPanelPresenter testPerspectiveRootPanelPresenter;\n\n    @Before\n    public void setup() {\n        when(layoutSelection.get().getPerspectiveContainer()).thenReturn(mock(HasWidgets.class));\n\n        testPerspectiveDef = new PerspectiveDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        testPerspectiveRootPanelPresenter = mock(WorkbenchPanelPresenter.class);\n\n        when(beanFactory.newRootPanel(any(),\n                                      eq(testPerspectiveDef.getRoot()))).thenReturn(testPerspectiveRootPanelPresenter);\n        when(testPerspectiveRootPanelPresenter.getDefinition()).thenReturn(testPerspectiveDef.getRoot());\n        when(testPerspectiveRootPanelPresenter.getPanelView()).thenReturn(mock(WorkbenchPanelView.class));\n        when(testPerspectiveRootPanelPresenter.getDefaultChildType()).thenReturn(SimpleWorkbenchPanelPresenter.class.getName());\n\n        partPresenter = mock(WorkbenchPartPresenter.class);\n        when(beanFactory.newWorkbenchPart(any(),\n                                          any(),\n                                          any(),\n                                          any(),\n                                          any())).thenReturn(partPresenter);\n\n        when(beanFactory.newWorkbenchPanel(any())).thenAnswer(new Answer<WorkbenchPanelPresenter>() {\n            @Override\n            public WorkbenchPanelPresenter answer(InvocationOnMock invocation) throws Throwable {\n                WorkbenchPanelPresenter newPanelPresenter = mock(WorkbenchPanelPresenter.class,\n                                                                 RETURNS_DEEP_STUBS);\n                when(newPanelPresenter.getDefinition()).thenReturn((PanelDefinition) invocation.getArguments()[0]);\n                return newPanelPresenter;\n            }\n        });\n\n        PerspectiveActivity testPerspectiveActivity = mock(PerspectiveActivity.class);\n\n        panelManager = spy(new PanelManagerImpl(placeGainFocusEvent,\n                                                placeLostFocusEvent,\n                                                panelFocusEvent,\n                                                selectPlaceEvent,\n                                                placeMaximizedEvent,\n                                                placeMinimizedEvent,\n                                                placeHidEvent,\n                                                null,\n                                                null,\n                                                layoutSelection,\n                                                beanFactory,\n                                                elemental2DomUtil));\n        panelManager.setRoot(testPerspectiveActivity,\n                             testPerspectiveDef.getRoot());\n\n        doNothing().when(panelManager).appendWidgetToElement(any(HTMLElement.class),\n                                                             any(Widget.class));\n    }\n\n    @Test\n    public void addPartToRootPanelShouldWork() throws Exception {\n        PlaceRequest rootPartPlace = new DefaultPlaceRequest(\"rootPartPlace\");\n        PartDefinition rootPart = new PartDefinitionImpl(rootPartPlace);\n        Menus rootPartMenus = MenuFactory.newContributedMenu(\"RootPartMenu\").endMenu().build();\n        UIPart rootUiPart = new UIPart(\"RootUiPart\",\n                                       null,\n                                       mock(IsWidget.class));\n        panelManager.addWorkbenchPart(rootPartPlace,\n                                      rootPart,\n                                      panelManager.getRoot(),\n                                      rootPartMenus,\n                                      rootUiPart,\n                                      \"rootContextId\",\n                                      100,\n                                      200);\n\n        // the presenter should have been created and configured for the rootPart\n        verify(partPresenter).setWrappedWidget(rootUiPart.getWidget());\n        verify(partPresenter).setContextId(\"rootContextId\");\n\n        // the panel manager should be aware of the place/part mapping for the added part\n        assertEquals(rootPart,\n                     panelManager.getPartForPlace(rootPartPlace));\n\n        // the panel manager should select the place, firing a general notification\n        verify(selectPlaceEvent).fire(refEq(new SelectPlaceEvent(rootPartPlace)));\n\n        // the panel manager should have modified the panel or part definitions (this is the responsibility of the parent panel)\n        assertEquals(null,\n                     rootPart.getParentPanel());\n        assertFalse(panelManager.getRoot().getParts().contains(rootPart));\n    }\n\n    @Test\n    public void addPartToUnknownPanelShouldFail() throws Exception {\n        PlaceRequest partPlace = new DefaultPlaceRequest(\"partPlace\");\n        PartDefinition part = new PartDefinitionImpl(partPlace);\n        Menus partMenus = MenuFactory.newContributedMenu(\"PartMenu\").endMenu().build();\n        UIPart uiPart = new UIPart(\"uiPart\",\n                                   null,\n                                   mock(IsWidget.class));\n        PanelDefinition randomUnattachedPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n\n        try {\n            panelManager.addWorkbenchPart(partPlace,\n                                          part,\n                                          randomUnattachedPanel,\n                                          partMenus,\n                                          uiPart,\n                                          \"contextId\",\n                                          null,\n                                          null);\n            fail();\n        } catch (IllegalArgumentException e) {\n            assertEquals(\"Target panel is not part of the layout\",\n                         e.getMessage());\n        }\n\n        // the presenter should not have been created and configured for the rootPart\n        verify(partPresenter,\n               never()).setWrappedWidget(uiPart.getWidget());\n        verify(partPresenter,\n               never()).setContextId(\"rootContextId\");\n\n        // the panel manager should not be aware of the place/part mapping for the failed add\n        assertEquals(null,\n                     panelManager.getPartForPlace(partPlace));\n\n        // the failed part/place should not be selected\n        verify(selectPlaceEvent,\n               never()).fire(refEq(new SelectPlaceEvent(partPlace)));\n    }\n\n    @Test\n    public void removingLastPartFromRootPanelShouldLeaveRootPanel() throws Exception {\n        // add\n        PlaceRequest rootPartPlace = new DefaultPlaceRequest(\"rootPartPlace\");\n        PartDefinition rootPart = new PartDefinitionImpl(rootPartPlace);\n        Menus rootPartMenus = MenuFactory.newContributedMenu(\"RootPartMenu\").endMenu().build();\n        UIPart rootUiPart = new UIPart(\"RootUiPart\",\n                                       null,\n                                       mock(IsWidget.class));\n        panelManager.addWorkbenchPart(rootPartPlace,\n                                      rootPart,\n                                      panelManager.getRoot(),\n                                      rootPartMenus,\n                                      rootUiPart,\n                                      \"rootContextId\",\n                                      null,\n                                      null);\n\n        panelManager.removePartForPlace(rootPartPlace);\n\n        // the panel manager should not know about the part/place mapping anymore\n        assertEquals(null,\n                     panelManager.getPartForPlace(rootPartPlace));\n\n        // the part's presenter bean should be destroyed\n        verify(beanFactory).destroy(partPresenter);\n\n        // the root panel itself, although empty, should remain (because it is the root panel)\n        verify(beanFactory,\n               never()).destroy(testPerspectiveRootPanelPresenter);\n    }\n\n    @Test\n    public void addPanelAtRootPositionShouldReturnRootPanel() throws Exception {\n        when(beanFactory.newRootPanel(any(PerspectiveActivity.class),\n                                      eq(testPerspectiveDef.getRoot()))).thenReturn(testPerspectiveRootPanelPresenter);\n        when(testPerspectiveRootPanelPresenter.getDefaultChildType()).thenReturn(null);\n        PerspectiveActivity testPerspectiveActivity = mock(PerspectiveActivity.class);\n        panelManager.setRoot(testPerspectiveActivity,\n                             testPerspectiveDef.getRoot());\n\n        PanelDefinition notActuallyAdded = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PanelDefinition result = panelManager.addWorkbenchPanel(testPerspectiveDef.getRoot(),\n                                                                notActuallyAdded,\n                                                                CompassPosition.ROOT);\n        assertSame(result,\n                   testPerspectiveDef.getRoot());\n    }\n\n    @Test\n    public void addedPanelsShouldBeRemembered() throws Exception {\n        PanelDefinition subPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        testPerspectiveDef.getRoot().appendChild(CompassPosition.WEST,\n                                                 subPanel);\n\n        panelManager.addWorkbenchPanel(panelManager.getRoot(),\n                                       subPanel,\n                                       CompassPosition.WEST);\n\n        assertTrue(panelManager.mapPanelDefinitionToPresenter.containsKey(subPanel));\n    }\n\n    @Test\n    public void addedCustomPanelsShouldBeRemembered() throws Exception {\n        HasWidgets container = mock(HasWidgets.class);\n        PanelDefinition customPanel = panelManager.addCustomPanel(container,\n                                                                  StaticWorkbenchPanelPresenter.class.getName());\n\n        assertTrue(panelManager.mapPanelDefinitionToPresenter.containsKey(customPanel));\n    }\n\n    @Test\n    public void addedCustomPanelsInsideHTMLElementsShouldBeRemembered() throws Exception {\n        HTMLElement container = mock(HTMLElement.class);\n        PanelDefinition customPanel = panelManager.addCustomPanel(container,\n                                                                  StaticWorkbenchPanelPresenter.class.getName());\n\n        assertTrue(panelManager.mapPanelDefinitionToPresenter.containsKey(customPanel));\n    }\n\n    @Test\n    public void explicitlyRemovedPanelsShouldBeForgotten() throws Exception {\n        PanelDefinition subPanel = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        testPerspectiveDef.getRoot().appendChild(CompassPosition.WEST,\n                                                 subPanel);\n\n        panelManager.addWorkbenchPanel(panelManager.getRoot(),\n                                       subPanel,\n                                       CompassPosition.WEST);\n        panelManager.removeWorkbenchPanel(subPanel);\n\n        assertFalse(panelManager.mapPanelDefinitionToPresenter.containsKey(subPanel));\n    }\n\n    @Test\n    public void explicitlyRemovedCustomPanelsShouldBeForgotten() throws Exception {\n        HasWidgets container = mock(HasWidgets.class);\n        PanelDefinition customPanel = panelManager.addCustomPanel(container,\n                                                                  StaticWorkbenchPanelPresenter.class.getName());\n        panelManager.removeWorkbenchPanel(customPanel);\n\n        assertFalse(panelManager.mapPanelDefinitionToPresenter.containsKey(customPanel));\n    }\n\n    @Test\n    public void explicitlyRemovedCustomPanelsInsideHTMLElementsShouldBeForgotten() throws Exception {\n        HTMLElement container = mock(HTMLElement.class);\n        PanelDefinition customPanel = panelManager.addCustomPanel(container,\n                                                                  StaticWorkbenchPanelPresenter.class.getName());\n        panelManager.removeWorkbenchPanel(customPanel);\n\n        assertFalse(panelManager.mapPanelDefinitionToPresenter.containsKey(customPanel));\n    }\n\n    @Test\n    public void explicitlyRemovedCustomPanelsInsideElemental2HTMLElementsShouldBeForgotten() {\n        elemental2.dom.HTMLElement container = mock(elemental2.dom.HTMLElement.class);\n        PanelDefinition customPanel = panelManager.addCustomPanel(container,\n                                                                  StaticWorkbenchPanelPresenter.class.getName());\n        panelManager.removeWorkbenchPanel(customPanel);\n\n        assertFalse(panelManager.mapPanelDefinitionToPresenter.containsKey(customPanel));\n    }\n\n    @Test\n    public void explicitlyRemovingRootPanelShouldFail() throws Exception {\n        try {\n            panelManager.removeWorkbenchPanel(testPerspectiveDef.getRoot());\n            fail(\"Should have thrown exception\");\n        } catch (IllegalArgumentException e) {\n            assertTrue(e.getMessage().contains(\"root\"));\n        }\n    }\n\n    @Test\n    public void onSelectPlaceEventFocusesCorrectPresenter() throws Exception {\n        PanelDefinition p1 = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PartDefinition pd1 = new PartDefinitionImpl(new DefaultPlaceRequest());\n        p1.addPart(pd1);\n        testPerspectiveDef.getRoot().appendChild(CompassPosition.WEST,\n                                                 p1);\n        panelManager.addWorkbenchPanel(panelManager.getRoot(),\n                                       p1,\n                                       CompassPosition.WEST);\n\n        PanelDefinition p2 = new PanelDefinitionImpl(SimpleWorkbenchPanelPresenter.class.getName());\n        PartDefinition pd2 = new PartDefinitionImpl(new PathPlaceRequest());\n        p2.addPart(pd2);\n        testPerspectiveDef.getRoot().appendChild(CompassPosition.EAST,\n                                                 p2);\n        panelManager.addWorkbenchPanel(panelManager.getRoot(),\n                                       p2,\n                                       CompassPosition.EAST);\n\n        SelectPlaceEvent event = new SelectPlaceEvent(new PathPlaceRequest());\n        panelManager.onSelectPlaceEvent(event);\n\n        final WorkbenchPanelPresenter partPresenter = panelManager.mapPanelDefinitionToPresenter.get(p2);\n        verify(partPresenter,\n               times(2)).setFocus(true);\n    }\n\n    // After UF-117:\n    // TODO test part disposal (not NORTH/SOUTH/EAST/WEST) side effect of AbstractPanelManagerImpl.removePart()\n    // TODO test part reattachment (NORTH/SOUTH/EAST/WEST) side effect of AbstractPanelManagerImpl.removePart()\n\n\n    static class StubPlaceGainFocusEvent extends EventSourceMock<PlaceGainFocusEvent> {\n\n    }\n\n    static class StubPlaceLostFocusEvent extends EventSourceMock<PlaceLostFocusEvent> {\n\n    }\n\n    static class StubSelectPlaceEvent extends EventSourceMock<SelectPlaceEvent> {\n\n    }\n\n    static class StubPanelFocusEvent extends EventSourceMock<PanelFocusEvent> {\n\n    }\n\n    static class StubPlaceMaximizedEvent extends EventSourceMock<PlaceMaximizedEvent> {\n\n    }\n\n    static class StubPlaceMinimizedEvent extends EventSourceMock<PlaceMinimizedEvent> {\n\n    }\n\n    static class StubPlaceHiddenEvent extends EventSourceMock<PlaceHiddenEvent> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/WorkbenchCloseHandlerImplTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport com.google.gwt.user.client.Window;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchCloseHandlerImplTest {\n\n    private WorkbenchCloseHandlerImpl workbenchCloseHandler;\n\n    @Before\n    public void setup() {\n        workbenchCloseHandler = new WorkbenchCloseHandlerImpl();\n    }\n\n    @Test\n    public void onWindowClosingWithoutEventTest() {\n        final ParameterizedCommand<Window.ClosingEvent> command = mock(ParameterizedCommand.class);\n\n        workbenchCloseHandler.onWindowClosing(command);\n\n        verify(command).execute(null);\n    }\n\n    @Test\n    public void onWindowClosingWithEventTest() {\n        final ParameterizedCommand<Window.ClosingEvent> command = mock(ParameterizedCommand.class);\n        final Window.ClosingEvent event = mock(Window.ClosingEvent.class);\n\n        workbenchCloseHandler.onWindowClosing(command,\n                                              event);\n\n        verify(command).execute(event);\n    }\n\n    @Test\n    public void onWindowCloseEventTest() {\n        final Command command = mock(Command.class);\n\n        workbenchCloseHandler.onWindowClose(command);\n\n        verify(command).execute();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/WorkbenchLayoutImplTest.java",
    "content": "/*\n *\n *  * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.HashMap;\nimport java.util.List;\n\nimport com.google.common.collect.Maps;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwt.user.client.ui.HeaderPanel;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.docks.UberfireDocksContainer;\nimport org.uberfire.client.workbench.events.WorkbenchProfileCssClass;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchPickupDragController;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(DockLayoutPanel.class)\npublic class WorkbenchLayoutImplTest {\n\n    @Mock\n    UberfireDocksContainer uberfireDocksContainer;\n    @Mock\n    WorkbenchPickupDragController dragController;\n    private WorkbenchLayoutImpl workbenchLayout;\n    private Widget widget;\n    @Mock\n    private SyncBeanManager iocManager;\n    @Mock\n    private HeaderPanel root;\n    @Mock\n    private Div headerPanel;\n    @Mock\n    private Div footerPanel;\n    @Mock\n    private WorkbenchDragAndDropManager dndManager;\n    private Header header1;\n\n    private Header header2;\n\n    private Footer footer1;\n\n    private Footer footer2;\n\n    @Before\n    public void setup() {\n        workbenchLayout = new WorkbenchLayoutImpl(iocManager,\n                                                  root,\n                                                  dndManager,\n                                                  uberfireDocksContainer,\n                                                  dragController,\n                                                  headerPanel,\n                                                  footerPanel) {\n            @Override\n            ElementWrapperWidget<?> createWidgetFrom(HTMLElement h) {\n                return mock(ElementWrapperWidget.class);\n            }\n        };\n        widget = mock(Widget.class,\n                      withSettings().extraInterfaces(RequiresResize.class));\n        final Element element = mock(Element.class);\n        when(element.getStyle()).thenReturn(mock(Style.class));\n        when(widget.getElement()).thenReturn(element);\n\n        header1 = mock(Header.class);\n        header2 = mock(Header.class);\n\n        footer1 = mock(Footer.class);\n        footer2 = mock(Footer.class);\n    }\n\n    @Test\n    public void testMaximize() {\n        workbenchLayout.maximize(widget);\n\n        verify(widget).addStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);\n\n        verify(((RequiresResize) widget),\n               never()).onResize();\n    }\n\n    @Test\n    public void testExpandAnimation() {\n        final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget,\n                                                                                                            Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(),\n                                                                                                            mock(SimpleLayoutPanel.class),\n                                                                                                            null);\n\n        expandAnimation.onComplete();\n\n        verify(((RequiresResize) widget)).onResize();\n    }\n\n    @Test\n    public void testExpandAnimationWithCallback() {\n        final Command callback = mock(Command.class);\n        final WorkbenchLayoutImpl.ExpandAnimation expandAnimation = new WorkbenchLayoutImpl.ExpandAnimation(widget,\n                                                                                                            Maps.<Widget, WorkbenchLayoutImpl.OriginalStyleInfo>newHashMap(),\n                                                                                                            mock(SimpleLayoutPanel.class),\n                                                                                                            callback);\n\n        expandAnimation.onComplete();\n\n        verify(((RequiresResize) widget)).onResize();\n        verify(callback).execute();\n    }\n\n    @Test\n    public void testUnMaximize() {\n        workbenchLayout.maximize(widget);\n        workbenchLayout.unmaximize(widget);\n\n        verify(widget).addStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);\n        verify(widget).removeStyleName(WorkbenchLayoutImpl.UF_MAXIMIZED_PANEL);\n\n        verify(((RequiresResize) widget),\n               never()).onResize();\n    }\n\n    @Test\n    public void testCollapseAnimation() {\n        final HashMap<Widget, WorkbenchLayoutImpl.OriginalStyleInfo> maximizedWidgetOriginalStyles = Maps.newHashMap();\n        maximizedWidgetOriginalStyles.put(widget,\n                                          new WorkbenchLayoutImpl.OriginalStyleInfo(widget));\n        final WorkbenchLayoutImpl.CollapseAnimation collapseAnimation = new WorkbenchLayoutImpl.CollapseAnimation(\n                widget,\n                maximizedWidgetOriginalStyles,\n                null);\n\n        collapseAnimation.onComplete();\n\n        verify(((RequiresResize) widget)).onResize();\n    }\n\n    @Test\n    public void testCollapseAnimationWithCallback() {\n        final HashMap<Widget, WorkbenchLayoutImpl.OriginalStyleInfo> maximizedWidgetOriginalStyles = Maps.newHashMap();\n        maximizedWidgetOriginalStyles.put(widget,\n                                          new WorkbenchLayoutImpl.OriginalStyleInfo(widget));\n        final Command callback = mock(Command.class);\n        final WorkbenchLayoutImpl.CollapseAnimation collapseAnimation = new WorkbenchLayoutImpl.CollapseAnimation(\n                widget,\n                maximizedWidgetOriginalStyles,\n                callback);\n\n        collapseAnimation.onComplete();\n\n        verify(((RequiresResize) widget)).onResize();\n        verify(callback).execute();\n    }\n\n    @Test\n    public void setEmptyHeaderContentsTest() {\n\n        Div headerPanel = workbenchLayout.getHeaderPanel();\n\n        workbenchLayout.setHeaderContents(new ArrayList<>());\n\n        verify(headerPanel,\n               never()).appendChild(any());\n        verify(root,\n               never()).setHeaderWidget(any());\n    }\n\n    @Test\n    public void setHeaderContentsTest() {\n\n        Div headerPanel = workbenchLayout.getHeaderPanel();\n\n        List<Header> headers = Arrays.asList(header1,\n                                             header2);\n\n        workbenchLayout.setHeaderContents(headers);\n\n        verify(headerPanel,\n               times(2)).appendChild(any());\n        verify(root).setHeaderWidget(any());\n    }\n\n    @Test\n    public void setEmptyFooterContentsTest() {\n\n        Div footerPanel = workbenchLayout.getFooterPanel();\n\n        workbenchLayout.setFooterContents(new ArrayList<>());\n\n        verify(footerPanel,\n               never()).appendChild(any());\n        verify(root,\n               never()).setFooterWidget(any());\n    }\n\n    @Test\n    public void setFooterContentsTest() {\n\n        Div footerPanel = workbenchLayout.getFooterPanel();\n\n        List<Footer> footers = Arrays.asList(footer1,\n                                             footer2);\n\n        workbenchLayout.setFooterContents(footers);\n\n        verify(footerPanel,\n               times(2)).appendChild(any());\n        verify(root).setFooterWidget(any());\n    }\n\n    @Test\n    public void addWorkbenchProfileCssClass() {\n\n        when(root.getStyleName()).thenReturn(\"current stylename\");\n\n        workbenchLayout.addWorkbenchProfileCssClass(new WorkbenchProfileCssClass(\"dora\"));\n\n        verify(root).removeStyleName(\"current stylename\");\n        verify(root).addStyleName(WorkbenchLayoutImpl.UF_ROOT_CSS_CLASS);\n        verify(root).addStyleName(\"dora\");\n\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/WorkbenchLayoutInfoImplTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport org.jboss.errai.common.client.dom.DOMClientRect;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchLayoutInfoImplTest {\n\n    @Mock\n    WorkbenchLayoutImpl workbenchLayout;\n\n    @InjectMocks\n    WorkbenchLayoutInfoImpl workbenchLayoutInfo;\n\n    @Test\n    public void defaultToZeroWhenSomethingGoesWrong() throws Exception {\n        assertEquals(0, workbenchLayoutInfo.getHeaderHeight());\n    }\n\n    @Test\n    public void digTheHeightTheNormalWay() throws Exception {\n\n        final Div div = mock(Div.class);\n        final DOMClientRect domClientRect = mock(DOMClientRect.class);\n\n        doReturn(div).when(workbenchLayout).getHeaderPanel();\n        doReturn(domClientRect).when(div).getBoundingClientRect();\n        doReturn(new Double(12)).when(domClientRect).getHeight();\n\n        assertEquals(12, workbenchLayoutInfo.getHeaderHeight());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/WorkbenchStandaloneModeTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchStandaloneModeTest {\n\n    @Mock\n    private VFSServiceProxy vfsService;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private ManagedInstance<WorkbenchCustomStandalonePerspectiveDefinition> workbenchCustomStandalonePerspectiveDefinitions;\n\n    @Spy\n    @InjectMocks\n    private Workbench workbench;\n\n    @Test\n    public void handleStandaloneModeWithPerspectiveParameterTest() {\n        final Map<String, List<String>> parameters = new HashMap<>();\n        parameters.put(\"perspective\", Collections.singletonList(\"MyPerspective\"));\n\n        workbench.handleStandaloneMode(parameters);\n\n        verify(placeManager).goTo(new DefaultPlaceRequest(parameters.get(\"perspective\").get(0)));\n    }\n\n    @Test\n    public void handleStandaloneModeWithPathParameterAndNoCustomStandaloneEditorPerspectiveDefinitionTest() {\n        doReturn(true).when(workbenchCustomStandalonePerspectiveDefinitions).isUnsatisfied();\n\n        final Map<String, List<String>> parameters = new HashMap<>();\n        parameters.put(\"path\", Collections.singletonList(\"git://main@MySpace/MyProject/src/main/java/com/myspace/myproject/myasset.java\"));\n\n        workbench.handleStandaloneMode(parameters);\n\n        verify(placeManager).goTo(new DefaultPlaceRequest(\"StandaloneEditorPerspective\"));\n    }\n\n    @Test\n    public void handleStandaloneModeWithPathParameterAndCustomStandaloneEditorPerspectiveDefinitionNotOpeningEditorByDefaultTest() {\n        doReturn(false).when(workbenchCustomStandalonePerspectiveDefinitions).isUnsatisfied();\n        final WorkbenchCustomStandalonePerspectiveDefinition workbenchCustomStandalonePerspectiveDefinition = mock(WorkbenchCustomStandalonePerspectiveDefinition.class);\n        doReturn(\"MyCustomStandalonePerspective\").when(workbenchCustomStandalonePerspectiveDefinition).getStandalonePerspectiveIdentifier();\n        doReturn(false).when(workbenchCustomStandalonePerspectiveDefinition).openPathAutomatically();\n        doReturn(workbenchCustomStandalonePerspectiveDefinition).when(workbenchCustomStandalonePerspectiveDefinitions).get();\n\n        final Map<String, List<String>> parameters = new HashMap<>();\n        parameters.put(\"path\", Collections.singletonList(\"git://main@MySpace/MyProject/src/main/java/com/myspace/myproject/myasset.java\"));\n\n        workbench.handleStandaloneMode(parameters);\n\n        verify(placeManager, times(1)).goTo(any(PlaceRequest.class));\n        verify(placeManager).goTo(new DefaultPlaceRequest(\"MyCustomStandalonePerspective\"));\n        verify(vfsService, never()).get(any(), any());\n    }\n\n    @Test\n    public void handleStandaloneModeWithPathParameterAndCustomStandaloneEditorPerspectiveDefinitionOpeningEditorByDefaultTest() {\n        doNothing().when(workbench).openEditor(any());\n\n        final Map<String, List<String>> parameters = new HashMap<>();\n        parameters.put(\"path\", Collections.singletonList(\"git://main@MySpace/MyProject/src/main/java/com/myspace/myproject/myasset.java\"));\n\n        final Path path = mock(Path.class);\n        doReturn(false).when(workbenchCustomStandalonePerspectiveDefinitions).isUnsatisfied();\n        final WorkbenchCustomStandalonePerspectiveDefinition workbenchCustomStandalonePerspectiveDefinition = mock(WorkbenchCustomStandalonePerspectiveDefinition.class);\n        doReturn(\"MyCustomStandalonePerspective\").when(workbenchCustomStandalonePerspectiveDefinition).getStandalonePerspectiveIdentifier();\n        doReturn(true).when(workbenchCustomStandalonePerspectiveDefinition).openPathAutomatically();\n        doReturn(workbenchCustomStandalonePerspectiveDefinition).when(workbenchCustomStandalonePerspectiveDefinitions).get();\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(1, ParameterizedCommand.class).execute(path);\n            return null;\n        }).when(vfsService).get(same(parameters.get(\"path\").get(0)), any(ParameterizedCommand.class));\n\n        workbench.handleStandaloneMode(parameters);\n\n        verify(placeManager, times(1)).goTo(any(PlaceRequest.class));\n        verify(placeManager).goTo(new DefaultPlaceRequest(\"MyCustomStandalonePerspective\"));\n        verify(vfsService).get(same(parameters.get(\"path\").get(0)), any(ParameterizedCommand.class));\n        verify(workbench).openEditor(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/WorkbenchStartupTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench;\n\nimport java.util.Arrays;\nimport java.util.Collections;\n\nimport com.google.gwt.user.client.Window;\nimport com.google.gwt.user.client.ui.AbsolutePanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.bus.client.api.ClientMessageBus;\nimport org.jboss.errai.bus.client.framework.ClientMessageBusImpl;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.slf4j.Logger;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.ApplicationReadyEvent;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchPickupDragController;\nimport org.uberfire.mocks.EventSourceMock;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationPolicy;\nimport org.uberfire.security.authz.PermissionManager;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.anyString;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchStartupTest {\n\n    /**\n     * The thing we are unit testing\n     */\n    @InjectMocks\n    @Spy\n    Workbench workbench;\n\n    @Mock\n    SyncBeanManager bm;\n    @Mock\n    WorkbenchPickupDragController dragController;\n    @Mock\n    WorkbenchDragAndDropManager dndManager;\n    @Mock\n    PanelManager panelManager;\n    @Mock\n    StubAppReadyEventSource appReadyEvent;\n    @Mock\n    User identity;\n    @Mock(extraInterfaces = ClientMessageBus.class)\n    ClientMessageBusImpl bus;\n    @Mock\n    WorkbenchLayout layout;\n    @Mock\n    LayoutSelection layoutSelection;\n    @Mock\n    PermissionManager permissionManager;\n    @Mock\n    PlaceManager placeManager;\n    @Mock\n    AuthorizationManager authorizationManager;\n    @Mock\n    AuthorizationPolicy authorizationPolicy;\n    @Mock\n    SyncBeanDef<PerspectiveActivity> perspectiveBean1;\n    @Mock\n    SyncBeanDef<PerspectiveActivity> perspectiveBean2;\n    @Mock\n    PerspectiveActivity perspectiveActivity1;\n    @Mock\n    PerspectiveActivity perspectiveActivity2;\n    @Mock\n    Logger logger;\n    @Mock\n    ActivityBeansCache activityBeansCache;\n\n    @Before\n    public void setup() {\n        when(bm.lookupBeans(any(Class.class))).thenReturn(Collections.emptyList());\n        when(dragController.getBoundaryPanel()).thenReturn(new AbsolutePanel());\n        doNothing().when(workbench).addLayoutToRootPanel(any(WorkbenchLayout.class));\n        when(permissionManager.getAuthorizationPolicy()).thenReturn(authorizationPolicy);\n        when(authorizationManager.authorize(any(Resource.class),\n                                            any(User.class))).thenReturn(true);\n        when(bm.lookupBeans(PerspectiveActivity.class)).thenReturn(Arrays.asList(perspectiveBean1,\n                                                                                 perspectiveBean2));\n        when(perspectiveBean1.getInstance()).thenReturn(perspectiveActivity1);\n        when(perspectiveBean2.getInstance()).thenReturn(perspectiveActivity2);\n        when(perspectiveActivity1.getIdentifier()).thenReturn(\"perspective1\");\n        when(perspectiveActivity2.getIdentifier()).thenReturn(\"perspective2\");\n        when(perspectiveActivity2.isDefault()).thenReturn(true);\n    }\n\n    @Test\n    public void shouldNotStartWhenBlocked() throws Exception {\n        verify(appReadyEvent,\n               never()).fire(any(ApplicationReadyEvent.class));\n        workbench.addStartupBlocker(WorkbenchStartupTest.class);\n        workbench.startIfNotBlocked();\n        verify(appReadyEvent,\n               never()).fire(any(ApplicationReadyEvent.class));\n    }\n\n    @Test\n    public void shouldStartWhenUnblocked() throws Exception {\n        workbench.addStartupBlocker(WorkbenchStartupTest.class);\n        workbench.removeStartupBlocker(WorkbenchStartupTest.class);\n        verify(appReadyEvent,\n               times(1)).fire(any(ApplicationReadyEvent.class));\n    }\n\n    @Test\n    public void shouldStartOnAfterInitIfNeverBlocked() throws Exception {\n        workbench.startIfNotBlocked();\n        verify(appReadyEvent,\n               times(1)).fire(any(ApplicationReadyEvent.class));\n    }\n\n    @Test\n    public void goToHomePerspective() throws Exception {\n        when(authorizationPolicy.getHomePerspective(identity)).thenReturn(\"perspective1\");\n        workbench.startIfNotBlocked();\n        verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier()));\n    }\n\n    @Test\n    public void goToDefaultPerspective() throws Exception {\n        when(perspectiveActivity1.isDefault()).thenReturn(true);\n        when(perspectiveActivity2.isDefault()).thenReturn(false);\n        workbench.startIfNotBlocked();\n        verify(placeManager).goTo(new DefaultPlaceRequest(perspectiveActivity1.getIdentifier()));\n    }\n\n    @Test\n    public void goToNoWhere() throws Exception {\n        when(perspectiveActivity2.isDefault()).thenReturn(false);\n        workbench.startIfNotBlocked();\n        verify(placeManager,\n               never()).goTo(any(PlaceRequest.class));\n    }\n\n    @Test\n    public void workbenchCloseCommandTest() {\n        workbench.workbenchCloseCommand.execute();\n        verify(placeManager).closeAllPlaces();\n    }\n\n    @Test\n    public void workbenchClosingCommandWithUnsavedChangesTest() {\n        doReturn(false).when(placeManager).canCloseAllPlaces();\n        final Window.ClosingEvent event = mock(Window.ClosingEvent.class);\n\n        workbench.workbenchClosingCommand.execute(event);\n\n        verify(event).setMessage(anyString());\n    }\n\n    @Test\n    public void workbenchClosingCommandWithoutUnsavedChangesTest() {\n        doReturn(true).when(placeManager).canCloseAllPlaces();\n        final Window.ClosingEvent event = mock(Window.ClosingEvent.class);\n\n        workbench.workbenchClosingCommand.execute(event);\n\n        verify(event, never()).setMessage(anyString());\n    }\n\n    /**\n     * Mockito failed to produce a valid mock for a raw {@code Event<ApplicationReadyEvent>} due to classloader issues.\n     * This class provides it something that it can mock properly.\n     */\n    public static class StubAppReadyEventSource extends EventSourceMock<ApplicationReadyEvent> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/docks/UberfireDockTest.java",
    "content": "package org.uberfire.client.workbench.docks;\n\nimport com.google.gwt.resources.client.ImageResource;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport junit.framework.TestCase;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport static org.junit.Assert.assertNotEquals;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberfireDockTest extends TestCase {\n\n    private static final UberfireDockPosition DOCK_POSITION = UberfireDockPosition.EAST;\n    private static String ICON_TYPE = \"ICON_TYPE\";\n    private static final String SCREEN_ID = \"SCREEN_ID\";\n    private static final String PERSPECTIVE_ID = \"PERSPECTIVE_ID\";\n\n    private static final int SIZE = 450;\n    private static final String LABEL = \"DOCK TITLE\";\n    private static final String TOOLTIP = \"DOCK TOOLTIP\";\n\n    @Mock\n    private ImageResource imageIcon1;\n    @Mock\n    private ImageResource imageIcon2;\n\n    @Mock\n    private ImageResource imageIconFocused1;\n    @Mock\n    private ImageResource imageIconFocused2;\n\n    private UberfireDock tested;\n    private UberfireDock testedWithImages;\n\n    @Before\n    public void setUp() {\n        tested = new UberfireDock(DOCK_POSITION,\n                                  ICON_TYPE,\n                                  new DefaultPlaceRequest(SCREEN_ID),\n                                  PERSPECTIVE_ID)\n                .withLabel(LABEL)\n                .withTooltip(TOOLTIP)\n                .withSize(SIZE);\n\n        testedWithImages = new UberfireDock(DOCK_POSITION,\n                                            imageIcon1,\n                                            imageIconFocused1,\n                                            new DefaultPlaceRequest(SCREEN_ID),\n                                            PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testWithLabel() {\n        assertEquals(0, tested.getLabel().compareTo(LABEL));\n    }\n\n    @Test\n    public void testWithTooltip() {\n        assertEquals(0, tested.getTooltip().compareTo(TOOLTIP));\n\n        final UberfireDock tested2 = new UberfireDock(UberfireDockPosition.EAST,\n                                                      ICON_TYPE,\n                                                      new DefaultPlaceRequest(SCREEN_ID),\n                                                      PERSPECTIVE_ID);\n        assertNull(tested2.getTooltip());\n    }\n\n    @Test\n    public void testWithSize() {\n        assertEquals(SIZE, tested.getSize(), 0);\n    }\n\n    @Test\n    public void testSetUberfireDockPosition() {\n\n        UberfireDock uberfireDock = tested = new UberfireDock(UberfireDockPosition.EAST,\n                                                              ICON_TYPE,\n                                                              new DefaultPlaceRequest(SCREEN_ID),\n                                                              PERSPECTIVE_ID);\n        uberfireDock.setUberfireDockPosition(UberfireDockPosition.WEST);\n        assertEquals(UberfireDockPosition.WEST, tested.getDockPosition());\n    }\n\n    @Test\n    public void testGetAssociatedPerspective() {\n        assertEquals(PERSPECTIVE_ID, tested.getAssociatedPerspective());\n    }\n\n    @Test\n    public void testGetIdentifier() {\n        assertEquals(SCREEN_ID, tested.getIdentifier());\n    }\n\n    @Test\n    public void testGetPlaceRequest() {\n        assertEquals(SCREEN_ID, tested.getPlaceRequest().getIdentifier());\n    }\n\n    @Test\n    public void testGetDockPosition() {\n        assertEquals(DOCK_POSITION, tested.getDockPosition());\n    }\n\n    @Test\n    public void testGetSize() {\n        assertEquals(SIZE, tested.getSize(), 0);\n    }\n\n    @Test\n    public void testGetLabel() {\n        assertEquals(LABEL, tested.getLabel());\n    }\n\n    @Test\n    public void testGetTooltip() {\n        assertEquals(TOOLTIP, tested.getTooltip());\n    }\n\n    @Test\n    public void testGetIconType() {\n        assertEquals(ICON_TYPE, tested.getIconType());\n    }\n\n    @Test\n    public void testGetImageIcon() {\n        assertEquals(imageIcon1, testedWithImages.getImageIcon());\n    }\n\n    @Test\n    public void testGetImageIconFocused() {\n        assertEquals(imageIconFocused1, testedWithImages.getImageIconFocused());\n    }\n\n    @Test\n    public void testEquals() {\n        UberfireDock compareDock1 = new UberfireDock(DOCK_POSITION,\n                                                     ICON_TYPE,\n                                                     new DefaultPlaceRequest(SCREEN_ID),\n                                                     PERSPECTIVE_ID)\n                .withSize(SIZE)\n                .withLabel(LABEL)\n                .withTooltip(TOOLTIP);\n\n        UberfireDock compareDock2 = new UberfireDock(DOCK_POSITION,\n                                                     imageIcon1,\n                                                     imageIconFocused1,\n                                                     new DefaultPlaceRequest(SCREEN_ID),\n                                                     PERSPECTIVE_ID)\n                .withSize(SIZE)\n                .withLabel(LABEL)\n                .withTooltip(TOOLTIP);\n\n        UberfireDock compareDock3 = new UberfireDock(null,\n                                                     null,\n                                                     new DefaultPlaceRequest(SCREEN_ID));\n\n        UberfireDock compareDock4 = new UberfireDock(null,\n                                                     null,\n                                                     null,\n                                                     new DefaultPlaceRequest(SCREEN_ID));\n\n        UberfireDock compareDock5 = new UberfireDock(UberfireDockPosition.WEST,\n                                                     ICON_TYPE + \"EXTRA\",\n                                                     new DefaultPlaceRequest(SCREEN_ID + \"EXTRA\"),\n                                                     PERSPECTIVE_ID + \"EXTRA\")\n                .withSize(SIZE + 20)\n                .withLabel(LABEL + \"EXTRA\")\n                .withTooltip(TOOLTIP + \"EXTRA\");\n\n        UberfireDock compareDock6 = new UberfireDock(UberfireDockPosition.WEST,\n                                                     imageIcon2,\n                                                     imageIconFocused2,\n                                                     new DefaultPlaceRequest(SCREEN_ID + \"EXTRA\"),\n                                                     PERSPECTIVE_ID + \"EXTRA\")\n                .withSize(SIZE + 20)\n                .withLabel(LABEL + \"EXTRA\")\n                .withTooltip(TOOLTIP + \"EXTRA\");\n\n        assertEquals(tested, tested);\n        assertEquals(tested, compareDock1);\n        assertNotEquals(null, tested);\n        assertNotEquals(tested, new Object());\n        assertNotEquals(tested, compareDock2);\n        assertNotEquals(tested, compareDock3);\n        assertNotEquals(tested, compareDock4);\n        assertNotEquals(tested, compareDock5);\n        assertNotEquals(tested, compareDock6);\n        assertNotEquals(compareDock1, compareDock2);\n        assertNotEquals(compareDock1, compareDock3);\n        assertNotEquals(compareDock1, compareDock4);\n        assertNotEquals(compareDock1, compareDock5);\n        assertNotEquals(compareDock1, compareDock6);\n        assertNotEquals(compareDock2, compareDock3);\n        assertNotEquals(compareDock2, compareDock4);\n        assertNotEquals(compareDock2, compareDock5);\n        assertNotEquals(compareDock2, compareDock6);\n        assertEquals(compareDock3, compareDock4);\n        assertNotEquals(compareDock3, compareDock5);\n        assertNotEquals(compareDock3, compareDock6);\n        assertNotEquals(compareDock4, compareDock5);\n        assertNotEquals(compareDock4, compareDock6);\n        assertNotEquals(compareDock5, compareDock6);\n    }\n\n    @Test\n    public void testTestHashCode() {\n        UberfireDock compareDock1 = new UberfireDock(DOCK_POSITION,\n                                                     ICON_TYPE,\n                                                     new DefaultPlaceRequest(SCREEN_ID),\n                                                     PERSPECTIVE_ID)\n                .withSize(SIZE)\n                .withLabel(LABEL)\n                .withTooltip(TOOLTIP);\n\n        UberfireDock compareDock2 = new UberfireDock(DOCK_POSITION,\n                                                     imageIcon1,\n                                                     imageIconFocused1,\n                                                     new DefaultPlaceRequest(SCREEN_ID),\n                                                     PERSPECTIVE_ID)\n                .withSize(SIZE)\n                .withLabel(LABEL)\n                .withTooltip(TOOLTIP);\n\n        UberfireDock compareDock3 = new UberfireDock(null,\n                                                     null,\n                                                     new DefaultPlaceRequest(SCREEN_ID));\n\n        UberfireDock compareDock4 = new UberfireDock(null,\n                                                     null,\n                                                     null,\n                                                     new DefaultPlaceRequest(SCREEN_ID));\n\n        UberfireDock compareDock5 = new UberfireDock(DOCK_POSITION,\n                                                     ICON_TYPE,\n                                                     new DefaultPlaceRequest(SCREEN_ID),\n                                                     PERSPECTIVE_ID)\n                .withLabel(null);\n\n        assertEquals(tested.hashCode(), compareDock1.hashCode());\n        assertNotSame(tested.hashCode(), compareDock2.hashCode());\n        assertNotSame(tested.hashCode(), compareDock3.hashCode());\n        assertNotSame(tested.hashCode(), compareDock4.hashCode());\n        assertNotSame(tested.hashCode(), compareDock5.hashCode());\n        assertNotSame(compareDock1.hashCode(), compareDock2.hashCode());\n        assertNotSame(compareDock1.hashCode(), compareDock3.hashCode());\n        assertNotSame(compareDock1.hashCode(), compareDock4.hashCode());\n        assertNotSame(compareDock1.hashCode(), compareDock5.hashCode());\n        assertNotSame(compareDock2.hashCode(), compareDock3.hashCode());\n        assertNotSame(compareDock2.hashCode(), compareDock4.hashCode());\n        assertNotSame(compareDock2.hashCode(), compareDock5.hashCode());\n        assertNotSame(compareDock3.hashCode(), compareDock4.hashCode());\n        assertNotSame(compareDock3.hashCode(), compareDock5.hashCode());\n        assertNotSame(compareDock4.hashCode(), compareDock5.hashCode());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.common.collect.ImmutableMap;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n/**\n * Tests behaviours required by all subclasses of AbstractDockingWorkbenchPanelPresenter.\n */\npublic abstract class AbstractDockingWorkbenchPanelPresenterTest extends AbstractWorkbenchPanelPresenterTest {\n\n    @Mock\n    protected PanelManager panelManager;\n\n    /**\n     * The individual test classes that extend this base class implement this method by returning the implementation of\n     * AbstractDockingWorkbenchPanelPresenter that they want to test. The protected mock objects set up by this base class\n     * should be given to the presenter's constructor.\n     */\n    @Override\n    abstract AbstractDockingWorkbenchPanelPresenter<?> getPresenterToTest();\n\n    @Test\n    public void removingLastPartFromPanelShouldRemovePanelToo() throws Exception {\n        WorkbenchPanelPresenter westChildPanelPresenter = mock(SimpleWorkbenchPanelPresenter.class);\n        WorkbenchPanelPresenter parentPanelPresenter = mock(SimpleWorkbenchPanelPresenter.class);\n\n        AbstractDockingWorkbenchPanelPresenter<?> panelPresenter = getPresenterToTest();\n        panelPresenter.setDefinition(panelPresenterPanelDefinition);\n\n        panelPresenter.setParent(parentPanelPresenter);\n        panelPresenter.addPanel(westChildPanelPresenter,\n                                CompassPosition.WEST);\n        panelPresenter.addPart(mockPartPresenter);\n\n        panelPresenter.removePart(mockPartPresenter.getDefinition());\n\n        // the now-empty panel should have removed itself\n        verify(panelManager).removeWorkbenchPanel(panelPresenterPanelDefinition);\n    }\n\n    @Test\n    public void childrenOfRemovedPanelsShouldBeRescued() throws Exception {\n        WorkbenchPanelPresenter westChildPanelPresenter = mock(SimpleWorkbenchPanelPresenter.class);\n        WorkbenchPanelPresenter westChildChild = mock(SimpleWorkbenchPanelPresenter.class);\n\n        when(westChildPanelPresenter.getPanels()).thenReturn(ImmutableMap.of((Position) CompassPosition.WEST,\n                                                                             westChildChild));\n\n        AbstractDockingWorkbenchPanelPresenter<?> panelPresenter = getPresenterToTest();\n        panelPresenter.addPanel(westChildPanelPresenter,\n                                CompassPosition.WEST);\n        panelPresenter.removePanel(westChildPanelPresenter);\n\n        // the child of the removed child should have been placed into our WEST child slot\n        assertEquals(CompassPosition.WEST,\n                     panelPresenter.positionOf(westChildChild));\n    }\n\n    @Test\n    public void addingMultiplePanelsInTheSamePosition() throws Exception {\n        AbstractDockingWorkbenchPanelPresenter<?> panelPresenter = getPresenterToTest();\n        panelPresenter.setDefinition(panelPresenterPanelDefinition);\n\n        WorkbenchPanelPresenter southRootChild1 = mock(SimpleWorkbenchPanelPresenter.class);\n        WorkbenchPanelPresenter southRootChild2 = mock(SimpleWorkbenchPanelPresenter.class);\n\n        final PanelDefinition southRootChild1PanelDefinition = new PanelDefinitionImpl();\n        final PanelDefinition southRootChild2PanelDefinition = new PanelDefinitionImpl();\n        when(southRootChild1.getDefinition()).thenReturn(southRootChild1PanelDefinition);\n        when(southRootChild2.getDefinition()).thenReturn(southRootChild2PanelDefinition);\n\n        panelPresenter.addPanel(southRootChild1,\n                                CompassPosition.SOUTH);\n        panelPresenter.addPanel(southRootChild2,\n                                CompassPosition.SOUTH);\n\n        verify(panelPresenter.getPanelView()).addPanel(southRootChild1PanelDefinition,\n                                                       southRootChild1.getPanelView(),\n                                                       CompassPosition.SOUTH);\n        verify(panelPresenter.getPanelView()).addPanel(southRootChild2PanelDefinition,\n                                                       southRootChild2.getPanelView(),\n                                                       CompassPosition.SOUTH);\n\n        //Root contains 1 child, which is the last Panel to be added to Root\n        assertTrue(panelPresenter.getDefinition().getChildren().contains(southRootChild2.getDefinition()));\n\n        //Root's View contains 2 Panels in the SOUTH position therefore the SOUTH position should be DEFAULT_CHILD_SIZE * 2 in size\n        verify(panelPresenter.getPanelView()).setChildSize(southRootChild1.getPanelView(),\n                                                           Layouts.DEFAULT_CHILD_SIZE * 2);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AbstractDockingWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwt.user.client.ui.SimpleLayoutPanel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Answers;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.BeanFactory;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel;\n\nimport static org.mockito.Mockito.*;\n\n/**\n * Contains the setup necessary for testing subclasses of {@link AbstractDockingWorkbenchPanelView} with GWTMockito.\n */\npublic abstract class AbstractDockingWorkbenchPanelViewTest {\n\n    @Mock(answer = Answers.RETURNS_MOCKS)\n    ResizeFlowPanel partViewContainer;\n\n    @Mock(answer = Answers.RETURNS_MOCKS)\n    SimpleLayoutPanel topLevelWidget;\n\n    @Mock\n    WorkbenchDragAndDropManager dndManager;\n\n    @Mock\n    BeanFactory factory;\n\n    @Mock\n    LayoutSelection layoutSelection;\n\n    @Mock\n    WorkbenchLayout workbenchLayout;\n\n    @Mock\n    MaximizeToggleButtonPresenter maximizeButton;\n\n    @Before\n    public void setupAbstractDockingSuperclass() {\n        getViewToTest().setupDockingPanel(); // PostConstruct method\n        doReturn(workbenchLayout).when(layoutSelection).get();\n    }\n\n    /**\n     * Subclasses should return the object being unit tested. It must return a valid result even before the\n     * {@code @Setup} method of the subclass has been invoked.\n     */\n    protected abstract AbstractDockingWorkbenchPanelView<?> getViewToTest();\n\n    @Test\n    public void maximizeTest() {\n        getViewToTest().maximize();\n\n        verify(maximizeButton).disable();\n        verify(workbenchLayout).maximize(any(),\n                                         any());\n        verify(maximizeButton).setMaximized(true);\n    }\n\n    @Test\n    public void unmaximizeTest() {\n        getViewToTest().unmaximize();\n\n        verify(maximizeButton).disable();\n        verify(workbenchLayout).unmaximize(any(),\n                                           any());\n        verify(maximizeButton).setMaximized(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AbstractMultiPartWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.ContextActivity;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n/**\n * Tests for the general contract that any implementation of {@link AbstractMultiPartWorkbenchPanelPresenter} must\n * follow. Tests for each concrete implementation of AbstractMultiPartWorkbenchPanelPresenter should extend this one to\n * verify they follow the contract.\n */\npublic abstract class AbstractMultiPartWorkbenchPanelPresenterTest extends AbstractDockingWorkbenchPanelPresenterTest {\n\n    @Mock(name = \"view\")\n    protected DockingWorkbenchPanelView<MultiListWorkbenchPanelPresenter> view;\n\n    /**\n     * Narrowing return type to multi-part presenters.\n     */\n    @Override\n    abstract AbstractMultiPartWorkbenchPanelPresenter<?> getPresenterToTest();\n\n    @Test\n    public void knownContextualPartsShouldResolveToTheirOwnContext() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        final ContextActivity myContextActivity = mock(ContextActivity.class);\n        when(mockActivityManager.getActivity(ContextActivity.class,\n                                             new DefaultPlaceRequest(\"myContextId\"))).thenReturn(myContextActivity);\n\n        presenter.addPart(mockPartPresenter,\n                          \"myContextId\");\n\n        final ContextActivity resolvedContextActivity = presenter.resolveContext(partPresenterPartDefinition);\n        assertSame(myContextActivity,\n                   resolvedContextActivity);\n    }\n\n    /**\n     * This requirement holds when there is no panel context.\n     */\n    @Test\n    public void unknownPartsShouldResolveToPerspectiveContext() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        final ContextActivity resolvedPerspectiveContextActivity = presenter.resolveContext(new PartDefinitionImpl(new DefaultPlaceRequest(\"randomUnknownPlace\")));\n        assertSame(perspectiveContextActivity,\n                   resolvedPerspectiveContextActivity);\n    }\n\n    /**\n     * If there is a panel context, it overrides the perspective context.\n     */\n    @Test\n    public void unknownPartsShouldResolveToPanelContextWhenThereIsOne() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        ContextDefinition panelContextDefinition = new ContextDefinitionImpl(new DefaultPlaceRequest(\"panelDefinition\"));\n        ContextActivity panelContextActivity = mock(ContextActivity.class);\n\n        when(mockActivityManager.getActivity(ContextActivity.class,\n                                             new DefaultPlaceRequest(\"panelDefinition\"))).thenReturn(panelContextActivity);\n\n        panelPresenterPanelDefinition.setContextDefinition(panelContextDefinition);\n        presenter.setDefinition(panelPresenterPanelDefinition);\n\n        final ContextActivity resolvedContextActivity = presenter.resolveContext(new PartDefinitionImpl(new DefaultPlaceRequest(\"randomUnknownPlace\")));\n        assertSame(panelContextActivity,\n                   resolvedContextActivity);\n    }\n\n    @Test\n    public void presenterShouldFreeRemovedParts() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        ContextActivity fakeContextActivity = mock(ContextActivity.class);\n        when(mockActivityManager.getActivity(eq(ContextActivity.class),\n                                             any(PlaceRequest.class))).thenReturn(fakeContextActivity);\n        presenter.addPart(mockPartPresenter,\n                          \"randomContextId\");\n\n        presenter.removePart(mockPartPresenter.getDefinition());\n\n        // if the part we added and removed is now unknown, we should get the perspective's context\n        assertSame(perspectiveContextActivity,\n                   presenter.resolveContext(mockPartView.getPresenter().getDefinition()));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void addedChildPanelsShouldBeRemembered() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        PanelDefinitionImpl childPanelDef = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n        when(childPanelPresenter.getDefinition()).thenReturn(childPanelDef);\n        WorkbenchPanelView<WorkbenchPanelPresenter> childPanelView = mock(WorkbenchPanelView.class);\n        when(childPanelView.getPresenter()).thenReturn(childPanelPresenter);\n\n        presenter.addPanel(childPanelPresenter,\n                           CompassPosition.NORTH);\n\n        assertSame(childPanelPresenter,\n                   presenter.getPanels().get(CompassPosition.NORTH));\n        assertEquals(childPanelDef,\n                     presenter.getDefinition().getChild(CompassPosition.NORTH));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void removedChildPanelsShouldBeForgotten() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        PanelDefinitionImpl childPanelDef = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n        when(childPanelPresenter.getDefinition()).thenReturn(childPanelDef);\n        WorkbenchPanelView<WorkbenchPanelPresenter> childPanelView = mock(WorkbenchPanelView.class);\n        when(childPanelView.getPresenter()).thenReturn(childPanelPresenter);\n\n        presenter.addPanel(childPanelPresenter,\n                           CompassPosition.NORTH);\n        boolean removed = presenter.removePanel(childPanelPresenter);\n\n        assertTrue(removed);\n        assertNull(presenter.getPanels().get(CompassPosition.NORTH));\n        assertNull(presenter.getDefinition().getChild(CompassPosition.NORTH));\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void addingChildPanelShouldUpdateParentPointers() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        PanelDefinitionImpl childPanelDef = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n        when(childPanelPresenter.getDefinition()).thenReturn(childPanelDef);\n        WorkbenchPanelView<WorkbenchPanelPresenter> childPanelView = mock(WorkbenchPanelView.class);\n        when(childPanelView.getPresenter()).thenReturn(childPanelPresenter);\n\n        presenter.addPanel(childPanelPresenter,\n                           CompassPosition.NORTH);\n\n        verify(childPanelPresenter).setParent(presenter);\n        assertSame(presenter.getDefinition(),\n                   childPanelDef.getParent());\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    @Test\n    public void removingChildPanelShouldClearParentPointers() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        PanelDefinitionImpl childPanelDef = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n        WorkbenchPanelView<WorkbenchPanelPresenter> childPanelView = mock(WorkbenchPanelView.class);\n        when(childPanelView.getPresenter()).thenReturn(childPanelPresenter);\n\n        presenter.addPanel(childPanelPresenter,\n                           CompassPosition.NORTH);\n        presenter.removePanel(childPanelPresenter);\n\n        verify(childPanelPresenter).setParent(null);\n        assertNull(childPanelDef.getParent());\n    }\n\n    @Test\n    public void removingUnknownPanelShouldReturnFalse() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n\n        boolean removed = presenter.removePanel(childPanelPresenter);\n\n        assertFalse(removed);\n    }\n\n    @Test\n    public void removingUnknownPanelShouldNotAffectExistingOnes() throws Exception {\n        AbstractMultiPartWorkbenchPanelPresenter<?> presenter = getPresenterToTest();\n\n        PanelDefinitionImpl childPanelDef = new PanelDefinitionImpl(MultiListWorkbenchPanelPresenter.class.getName());\n        WorkbenchPanelPresenter childPanelPresenter = mock(WorkbenchPanelPresenter.class);\n        when(childPanelPresenter.getDefinition()).thenReturn(childPanelDef);\n        WorkbenchPanelView<WorkbenchPanelPresenter> childPanelView = mock(WorkbenchPanelView.class);\n        when(childPanelView.getPresenter()).thenReturn(childPanelPresenter);\n\n        WorkbenchPanelPresenter unknownPanelPresenter = mock(WorkbenchPanelPresenter.class);\n\n        presenter.addPanel(childPanelPresenter,\n                           CompassPosition.NORTH);\n        boolean removed = presenter.removePanel(unknownPanelPresenter);\n\n        assertFalse(removed);\n        assertSame(childPanelPresenter,\n                   presenter.getPanels().get(CompassPosition.NORTH));\n        assertEquals(childPanelDef,\n                     presenter.getDefinition().getChild(CompassPosition.NORTH));\n        verify(childPanelPresenter,\n               never()).setParent(null);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AbstractSimpleWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.listbar.ListBarWidget;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\npublic abstract class AbstractSimpleWorkbenchPanelViewTest extends AbstractDockingWorkbenchPanelViewTest {\n\n    @Mock\n    ListBarWidget listBar;\n\n    @Mock\n    Element listBarElement;\n\n    @Mock\n    Style listBarElementStyle;\n\n    @Before\n    public void setup() {\n        Widget listBarWidget = mock(Widget.class);\n        when(listBar.asWidget()).thenReturn(listBarWidget);\n        when(listBarWidget.getElement()).thenReturn(listBarElement);\n        when(listBarElement.getStyle()).thenReturn(listBarElementStyle);\n        when(listBar.getMaximizeButton()).thenReturn(maximizeButton);\n\n        final AtomicLong parts = new AtomicLong();\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                parts.incrementAndGet();\n                return null;\n            }\n        }).when(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n\n        doAnswer(new Answer() {\n            @Override\n            public Boolean answer(InvocationOnMock invocation) throws Throwable {\n                parts.decrementAndGet();\n                return true;\n            }\n        }).when(listBar).remove(any(PartDefinition.class));\n\n        when(listBar.getPartsSize()).thenAnswer(new Answer<Integer>() {\n            @Override\n            public Integer answer(InvocationOnMock invocation) throws Throwable {\n                return parts.intValue();\n            }\n        });\n        when(listBar.getParts()).thenAnswer(new Answer<Collection<PartDefinition>>() {\n            @Override\n            public Collection<PartDefinition> answer(InvocationOnMock invocation) throws Throwable {\n\n                return new ArrayList<PartDefinition>(parts.intValue());\n            }\n        });\n    }\n\n    @Test\n    public void addAndGetPartsTest() {\n        assertEquals(0,\n                     listBar.getPartsSize());\n\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n\n        assertEquals(1,\n                     listBar.getPartsSize());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AbstractWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.ContextActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.ContextDefinition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.ContextDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n/**\n * Tests for behaviours that are required of all implementations of WorkbenchPanelPresenter.\n * <p>\n * Tests for concrete and abstract WorkbenchPanelPresenter implementations should extend this one.\n */\npublic abstract class AbstractWorkbenchPanelPresenterTest {\n\n    protected final PerspectiveDefinition panelManagerPerspectiveDefinition = new PerspectiveDefinitionImpl();\n    protected final PartDefinition partPresenterPartDefinition = new PartDefinitionImpl(new DefaultPlaceRequest(\"belongs_to_mockPartPresenter\"));\n    protected final PanelDefinition panelPresenterPanelDefinition = new PanelDefinitionImpl();\n    protected final ContextDefinition perspectiveContextDefinition = new ContextDefinitionImpl(new DefaultPlaceRequest(\"Perspective Context\"));\n    @Mock\n    protected PerspectiveManager mockPerspectiveManager;\n    @Mock\n    protected ActivityManager mockActivityManager;\n    @Mock\n    protected View mockPartView;\n    @Mock\n    protected WorkbenchPartPresenter mockPartPresenter;\n    @Mock\n    protected ContextActivity perspectiveContextActivity;\n\n    /**\n     * The individual test classes that extend this base class implement this method by returning the implementation of\n     * AbstractDockingWorkbenchPanelPresenter that they want to test.\n     * <p>\n     * The presenter should usually be created using {@code @InjectMocks}, which will give the protected mock objects\n     * set up by this base class to the presenter's constructor. Additionally, subclasses should be sure to set\n     * {@link #panelPresenterPanelDefinition} as the panel's definition object (the inherited tests assume this).\n     */\n    abstract WorkbenchPanelPresenter getPresenterToTest();\n\n    @Before\n    public void setUp() {\n        when(mockPerspectiveManager.getLivePerspectiveDefinition()).thenReturn(panelManagerPerspectiveDefinition);\n        panelManagerPerspectiveDefinition.setContextDefinition(perspectiveContextDefinition);\n        when(mockActivityManager.getActivity(ContextActivity.class,\n                                             perspectiveContextDefinition.getPlace())).thenReturn(perspectiveContextActivity);\n        when(mockPartView.getPresenter()).thenReturn(mockPartPresenter);\n        when(mockPartPresenter.getDefinition()).thenReturn(partPresenterPartDefinition);\n    }\n\n    @Test\n    public void addingPartShouldUpdateDefinition() throws Exception {\n        WorkbenchPanelPresenter panelPresenter = getPresenterToTest();\n\n        try {\n            panelPresenter.addPart(mockPartPresenter);\n        } catch (UnsupportedOperationException e) {\n            // it's okay if the panel doesn't support parts\n            return;\n        }\n\n        assertSame(panelPresenter.getDefinition(),\n                   mockPartPresenter.getDefinition().getParentPanel());\n        assertTrue(panelPresenter.getDefinition().getParts().contains(mockPartPresenter.getDefinition()));\n    }\n\n    @Test\n    public void removingPartShouldUpdateDefinition() throws Exception {\n        WorkbenchPanelPresenter panelPresenter = getPresenterToTest();\n\n        try {\n            panelPresenter.addPart(mockPartPresenter);\n        } catch (UnsupportedOperationException e) {\n            // it's okay if the panel doesn't support parts\n            return;\n        }\n\n        panelPresenter.removePart(mockPartPresenter.getDefinition());\n\n        assertNull(mockPartPresenter.getDefinition().getParentPanel());\n        assertFalse(panelPresenter.getDefinition().getParts().contains(mockPartPresenter.getDefinition()));\n    }\n\n    /**\n     * Tests that PanelManager avoids duplicating PartDefinitions inside already-populated PanelDefinitions when\n     * building up a perspective.\n     */\n    @Test\n    public void addingPartThatIsAlreadyInPanelDefShouldNotChangePanelDef() throws Exception {\n        WorkbenchPanelPresenter panelPresenter = getPresenterToTest();\n\n        panelPresenter.getDefinition().addPart(partPresenterPartDefinition);\n        assertEquals(1,\n                     panelPresenter.getDefinition().getParts().size());\n\n        try {\n            panelPresenter.addPart(mockPartPresenter);\n        } catch (UnsupportedOperationException e) {\n            // it's okay if the panel doesn't support parts\n            return;\n        }\n\n        // the rest of the add operation should have happened\n        assertSame(panelPresenter.getDefinition(),\n                   mockPartPresenter.getDefinition().getParentPanel());\n        assertTrue(panelPresenter.getDefinition().getParts().contains(mockPartPresenter.getDefinition()));\n\n        // there should still only be 1 part\n        assertEquals(1,\n                     panelPresenter.getDefinition().getParts().size());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/AdaptiveWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class AdaptiveWorkbenchPanelViewTest extends AbstractSimpleWorkbenchPanelViewTest {\n\n    @InjectMocks\n    private AdaptiveWorkbenchPanelView view;\n\n    // Not a @Mock or @GwtMock because we want to test the view.init() method\n    private AdaptiveWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        presenter = mock(AdaptiveWorkbenchPanelPresenter.class);\n\n        view.setup(); // PostConstruct\n        view.init(presenter);\n    }\n\n    @Override\n    protected AbstractDockingWorkbenchPanelView<?> getViewToTest() {\n        return view;\n    }\n\n    @Test\n    public void couldHaveMoreThanOnePart() {\n        assertEquals(0,\n                     listBar.getPartsSize());\n\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        assertEquals(1,\n                     listBar.getPartsSize());\n\n        //Second part\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        assertEquals(2,\n                     listBar.getPartsSize());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/ClosableSimpleWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class ClosableSimpleWorkbenchPanelPresenterTest extends AbstractDockingWorkbenchPanelPresenterTest {\n\n    @Mock(name = \"view\")\n    protected DockingWorkbenchPanelView<ClosableSimpleWorkbenchPanelPresenter> view;\n    @InjectMocks\n    ClosableSimpleWorkbenchPanelPresenter presenter;\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setUp2() {\n        presenter.init();\n        presenter.setDefinition(panelPresenterPanelDefinition);\n    }\n\n    @Override\n    AbstractDockingWorkbenchPanelPresenter<?> getPresenterToTest() {\n        return presenter;\n    }\n\n    @Test\n    public void initShouldBindPresenterToView() {\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void addPartTest() {\n\n        WorkbenchPartPresenter part = mock(WorkbenchPartPresenter.class);\n        when(part.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part);\n\n        verify(view).addPart(any());\n    }\n\n    @Test\n    public void addPartTwiceShouldCloseOtherPartTest() {\n\n        SinglePartPanelHelper singlePartPanelHelper = mock(SinglePartPanelHelper.class);\n\n        ClosableSimpleWorkbenchPanelPresenter presenter = new ClosableSimpleWorkbenchPanelPresenter(view,\n                                                                                                    mock(PerspectiveManager.class),\n                                                                                                    placeManager) {\n            SinglePartPanelHelper createSinglePartPanelHelper() {\n                return singlePartPanelHelper;\n            }\n        };\n\n        presenter.init();\n        presenter.setDefinition(panelPresenterPanelDefinition);\n\n        //there is already a part\n        when(singlePartPanelHelper.hasNoParts()).thenReturn(false);\n\n        WorkbenchPartPresenter part2 = mock(WorkbenchPartPresenter.class);\n        when(part2.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part2);\n\n        verify(singlePartPanelHelper).closeFirstPartAndAddNewOne(any(Command.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/ClosableSimpleWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ClosableSimpleWorkbenchPanelViewTest extends AbstractSimpleWorkbenchPanelViewTest {\n\n    @InjectMocks\n    private ClosableSimpleWorkbenchPanelView view;\n\n    // Not a @Mock or @GwtMock because we want to test the view.init() method\n    private ClosableSimpleWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        presenter = mock(ClosableSimpleWorkbenchPanelPresenter.class);\n\n        view.setup(); // PostConstruct\n        view.init(presenter);\n    }\n\n    @Override\n    protected AbstractDockingWorkbenchPanelView<?> getViewToTest() {\n        return view;\n    }\n\n    @Test\n    public void shouldAddPresenterOnInit() {\n        assertEquals(presenter,\n                     view.getPresenter());\n    }\n\n    @Test\n    public void shouldEnableCloseParts() {\n        verify(listBar,\n               never()).disableClosePart();\n        verify(listBar).enableClosePart();\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void shouldOnlyHaveOnePart() {\n        assertEquals(0,\n                     listBar.getPartsSize());\n\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n        assertEquals(1,\n                     listBar.getPartsSize());\n\n        //Second part add is a leak should throw exception\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n        assertEquals(1,\n                     listBar.getPartsSize());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/MultiListWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class MultiListWorkbenchPanelPresenterTest extends AbstractMultiPartWorkbenchPanelPresenterTest {\n\n    @InjectMocks\n    private MultiListWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void setUp2() {\n        presenter.setDefinition(panelPresenterPanelDefinition);\n    }\n\n    @Override\n    AbstractMultiPartWorkbenchPanelPresenter<?> getPresenterToTest() {\n        return presenter;\n    }\n\n    // tests are inherited from superclass\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/MultiListWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.concurrent.atomic.AtomicLong;\n\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.listbar.ListBarWidget;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiListWorkbenchPanelViewTest extends AbstractDockingWorkbenchPanelViewTest {\n\n    @Mock\n    ListBarWidget listBar;\n    @Mock\n    MultiListWorkbenchPanelPresenter presenter;\n\n    @InjectMocks\n    MultiListWorkbenchPanelView view;\n\n    @Override\n    protected AbstractDockingWorkbenchPanelView<?> getViewToTest() {\n        return view;\n    }\n\n    @Before\n    public void setup() {\n        when(listBar.getMaximizeButton()).thenReturn(maximizeButton);\n\n        final AtomicLong parts = new AtomicLong();\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                parts.incrementAndGet();\n                return null;\n            }\n        }).when(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n\n        when(listBar.getPartsSize()).thenAnswer(new Answer<Integer>() {\n            @Override\n            public Integer answer(InvocationOnMock invocation) throws Throwable {\n                return parts.intValue();\n            }\n        });\n    }\n\n    @Test\n    public void setupWidget() {\n        view.setupWidget();\n\n        verify(listBar).addSelectionHandler(any(SelectionHandler.class));\n        verify(listBar).addOnFocusHandler(any(Command.class));\n        verify(listBar).disableDnd();\n\n        verify(maximizeButton).setVisible(true);\n        verify(maximizeButton).setMaximizeCommand(any(Command.class));\n        verify(maximizeButton).setUnmaximizeCommand(any(Command.class));\n    }\n\n    @Test\n    public void shouldPropagateOnResize() {\n        view.onResize();\n        RequiresResize viewChild = (RequiresResize) view.getWidget();\n        verify(viewChild,\n               times(1)).onResize();\n    }\n\n    @Test\n    public void shouldAddMultipleParts() {\n        assertEquals(0,\n                     listBar.getPartsSize());\n        verify(listBar,\n               never()).disableClosePart();\n\n        //Add multiple parts\n        view.addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n\n        view.addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar,\n               times(2)).addPart(any(WorkbenchPartPresenter.View.class));\n\n        assertEquals(2,\n                     listBar.getPartsSize());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/MultiTabWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Before;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class MultiTabWorkbenchPanelPresenterTest extends AbstractMultiPartWorkbenchPanelPresenterTest {\n\n    @InjectMocks\n    private MultiTabWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void setUp2() {\n        presenter.setDefinition(panelPresenterPanelDefinition);\n    }\n\n    @Override\n    AbstractMultiPartWorkbenchPanelPresenter<?> getPresenterToTest() {\n        return presenter;\n    }\n\n    // tests are inherited from superclass\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/PlaceManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.web.bindery.event.shared.EventBus;\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport org.assertj.core.api.Assertions;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.QualifierUtil;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanManager;\nimport org.jboss.errai.ioc.client.container.SyncBeanManagerImpl;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.*;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.mvp.*;\nimport org.uberfire.client.util.MockIOCBeanDef;\nimport org.uberfire.client.workbench.LayoutSelection;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.WorkbenchLayout;\nimport org.uberfire.client.workbench.docks.UberfireDocks;\nimport org.uberfire.client.workbench.events.*;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.BiParameterizedCommand;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.ConditionalPlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.*;\nimport org.uberfire.workbench.model.impl.CustomPanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport java.lang.annotation.Annotation;\nimport java.util.*;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.function.Consumer;\nimport java.util.function.Function;\n\nimport static java.util.Collections.singleton;\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.ArgumentMatchers.refEq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class PlaceManagerTest {\n\n    /**\n     * Returned by the mock activityManager for the special \"workbench.activity.notfound\" place.\n     */\n    private final Activity notFoundActivity = mock(Activity.class);\n    /**\n     * The setup method makes this the current place.\n     */\n    private final PlaceRequest kansas = new DefaultPlaceRequest(\"kansas\");\n    /**\n     * The setup method links this activity with the kansas PlaceRequest.\n     */\n    private final WorkbenchScreenActivity kansasActivity = mock(WorkbenchScreenActivity.class);\n    /**\n     * This panel will always be returned from panelManager.getRoot().\n     */\n    private final PanelDefinition rootPanel = new PanelDefinitionImpl(\n            MultiListWorkbenchPanelPresenter.class.getName());\n    @Mock\n    PerspectiveActivity defaultPerspective;\n    @Mock\n    SyncBeanManager iocManager;\n    @Mock\n    UberfireDocks uberfireDock;\n    @Mock\n    Event<BeforeClosePlaceEvent> workbenchPartBeforeCloseEvent;\n    @Mock\n    Event<ClosePlaceEvent> workbenchPartCloseEvent;\n    @Mock\n    Event<PlaceLostFocusEvent> workbenchPartLostFocusEvent;\n    @Mock\n    Event<NewSplashScreenActiveEvent> newSplashScreenActiveEvent;\n    @Mock\n    ActivityManager activityManager;\n    @Mock\n    PlaceHistoryHandler placeHistoryHandler;\n    @Mock\n    Event<SelectPlaceEvent> selectWorkbenchPartEvent;\n    @Mock\n    PanelManager panelManager;\n    @Mock\n    PerspectiveManager perspectiveManager;\n    @Mock\n    WorkbenchLayout workbenchLayout;\n    @Mock\n    LayoutSelection layoutSelection;\n    @Mock\n    ExperimentalActivitiesAuthorizationManager activitiesAuthorizationManager;\n    @Mock\n    PlaceManagerImpl.AppFormerActivityLoader appFormerActivityLoader;\n    /**\n     * This is the thing we're testing. Weeee!\n     */\n    @InjectMocks\n    PlaceManagerImpl placeManager;\n\n    @Before\n    public void setup() {\n        ((SyncBeanManagerImpl) IOC.getBeanManager()).reset();\n\n        when(placeHistoryHandler.getPerspectiveFromPlace(any())).then(AdditionalAnswers.returnsFirstArg());\n\n        when(defaultPerspective.getIdentifier())\n                .thenReturn(\"DefaultPerspective\");\n        when(defaultPerspective.isType(any()))\n                .thenReturn(true);\n        when(perspectiveManager.getCurrentPerspective())\n                .thenReturn(defaultPerspective);\n\n        when(activityManager.getActivities(Mockito.<PlaceRequest>any())).thenReturn(singleton(notFoundActivity));\n\n        doReturn(false).when(appFormerActivityLoader).triggerLoadOfMatchingEditors(any(), any());\n\n        // for now (and this will have to change for UF-61), PathPlaceRequest performs an IOC lookup for ObservablePath in its constructor\n        // as part of UF-61, we'll need to refactor ObservablePath and PathFactory so they ask for any beans they need as constructor params.\n        final ObservablePath mockObservablePath = mock(ObservablePath.class);\n        when(mockObservablePath.wrap(any())).thenReturn(mockObservablePath);\n        IOC.getBeanManager().registerBean(new MockIOCBeanDef<ObservablePath, ObservablePath>(mockObservablePath,\n                                                                                             ObservablePath.class,\n                                                                                             Dependent.class,\n                                                                                             new HashSet<Annotation>(\n                                                                                                     Arrays.asList(\n                                                                                                             QualifierUtil.DEFAULT_QUALIFIERS)),\n                                                                                             \"ObservablePath\",\n                                                                                             true));\n\n        // every test starts in Kansas, with no side effect interactions recorded\n        when(activityManager.getActivities(kansas)).thenReturn(singleton((Activity) kansasActivity));\n        setupPanelManagerMock();\n\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        when(kansasActivity.isDynamic()).thenReturn(false);\n\n        placeManager.goTo(kansas,\n                          (PanelDefinition) null);\n        resetInjectedMocks();\n        reset(kansasActivity);\n\n        when(kansasActivity.onMayClose()).thenReturn(true);\n        when(kansasActivity.preferredWidth()).thenReturn(123);\n        when(kansasActivity.preferredHeight()).thenReturn(456);\n\n        when(placeHistoryHandler.getPerspectiveFromPlace(any()))\n                .thenAnswer(i -> i.getArgument(0,\n                                                 PlaceRequest.class));\n        // arrange for the mock PerspectiveManager to invoke the doWhenFinished callbacks\n        doAnswer(new Answer<Void>() {\n            @SuppressWarnings({\"rawtypes\", \"unchecked\"})\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                ParameterizedCommand callback = (ParameterizedCommand) invocation.getArguments()[2];\n                PerspectiveActivity perspectiveActivity = (PerspectiveActivity) invocation.getArguments()[1];\n                callback.execute(perspectiveActivity.getDefaultPerspectiveLayout());\n                return null;\n            }\n        }).when(perspectiveManager).switchToPerspective(any(),\n                                                        any(),\n                                                        any());\n        doAnswer(new Answer<Void>() {\n            @Override\n            public Void answer(InvocationOnMock invocation) throws Throwable {\n                Command callback = (Command) invocation.getArguments()[0];\n                callback.execute();\n                return null;\n            }\n        }).when(perspectiveManager).savePerspectiveState(any());\n        doReturn(new DefaultPlaceRequest(\"lastPlaceRequest\"))\n                .when(defaultPerspective).getPlace();\n        doReturn(defaultPerspective).when(perspectiveManager)\n                .getCurrentPerspective();\n    }\n\n    /**\n     * Resets all the mocks that were injected into the PlaceManager under test. This should probably only be used in\n     * the setup method.\n     */\n    @SuppressWarnings(\"unchecked\")\n    private void resetInjectedMocks() {\n        reset(workbenchPartBeforeCloseEvent);\n        reset(workbenchPartCloseEvent);\n        reset(workbenchPartLostFocusEvent);\n        reset(newSplashScreenActiveEvent);\n        reset(activityManager);\n        reset(placeHistoryHandler);\n        reset(selectWorkbenchPartEvent);\n        reset(panelManager);\n        reset(perspectiveManager);\n        reset(workbenchLayout);\n\n        setupPanelManagerMock();\n    }\n\n    private void setupPanelManagerMock() {\n        when(panelManager.getRoot()).thenReturn(rootPanel);\n        when(panelManager.addWorkbenchPanel(any(),\n                                            any(),\n                                            any(),\n                                            any(),\n                                            any(),\n                                            any()))\n                .thenAnswer(new Answer<PanelDefinition>() {\n                    @Override\n                    public PanelDefinition answer(InvocationOnMock invocation) throws Throwable {\n                        return (PanelDefinition) invocation.getArguments()[0];\n                    }\n                });\n    }\n\n    @Test\n    public void testPlaceManagerGetsInitializedToADefaultPlace() throws Exception {\n        placeManager.initPlaceHistoryHandler();\n\n        verify(placeHistoryHandler).initialize(any(PlaceManager.class),\n                                             any(EventBus.class),\n                                             any(PlaceRequest.class));\n    }\n\n    @Test\n    public void testGoToConditionalPlaceById() throws Exception {\n\n        PlaceRequest dora = new ConditionalPlaceRequest(\"dora\").when(p -> true)\n                .orElse(new DefaultPlaceRequest(\"other\"));\n\n        WorkbenchScreenActivity doraActivity = mock(WorkbenchScreenActivity.class);\n        when(doraActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(doraActivity).getMenus(any());\n        when(activityManager.getActivities(dora)).thenReturn(singleton((Activity) doraActivity));\n\n        placeManager.goTo(dora);\n\n        verifyActivityLaunchSideEffects(dora,\n                                        doraActivity,\n                                        null);\n    }\n\n    @Test\n    public void testGoToConditionalPlaceByIdOrElse() throws Exception {\n\n        DefaultPlaceRequest other = new DefaultPlaceRequest(\"other\");\n        PlaceRequest dora = new ConditionalPlaceRequest(\"dora\").when(p -> false)\n                .orElse(other);\n\n        WorkbenchScreenActivity doraActivity = mock(WorkbenchScreenActivity.class);\n        WorkbenchScreenActivity otherActivity = mock(WorkbenchScreenActivity.class);\n        when(doraActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        when(otherActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(doraActivity).getMenus(any());\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(otherActivity).getMenus(any());\n        when(activityManager.getActivities(dora)).thenReturn(singleton((Activity) doraActivity));\n        when(activityManager.getActivities(other)).thenReturn(singleton((Activity) otherActivity));\n\n        placeManager.goTo(dora);\n\n        verify(doraActivity,\n               never()).onOpen();\n        verify(otherActivity).onOpen();\n\n        verifyActivityLaunchSideEffects(other,\n                                        otherActivity,\n                                        null);\n    }\n\n    @Test\n    public void testGoToNewPlaceById() throws Exception {\n        PlaceRequest oz = new DefaultPlaceRequest(\"oz\");\n        WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        when(ozActivity.isDynamic()).thenReturn(false);\n        when(ozActivity.preferredWidth()).thenReturn(-1);\n        when(ozActivity.preferredHeight()).thenReturn(-1);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n        when(activityManager.getActivities(oz)).thenReturn(singleton((Activity) ozActivity));\n\n        placeManager.goTo(oz,\n                          (PanelDefinition) null);\n\n        verifyActivityLaunchSideEffects(oz,\n                                        ozActivity,\n                                        null);\n    }\n\n    @Test\n    public void testGoToPlaceWeAreAlreadyAt() throws Exception {\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        placeManager.goTo(kansas,\n                          (PanelDefinition) null);\n\n        // note \"refEq\" tests equality field by field using reflection. don't read it as \"reference equals!\" :)\n        verify(selectWorkbenchPartEvent).fire(refEq(new SelectPlaceEvent(kansas)));\n\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n    }\n\n    @Test\n    public void testGoToPartWeAreAlreadyAt() throws Exception {\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        placeManager.goTo(new PartDefinitionImpl(kansas),\n                          null);\n\n        // note \"refEq\" tests equality field by field using reflection. don't read it as \"reference equals!\" :)\n        verify(selectWorkbenchPartEvent).fire(refEq(new SelectPlaceEvent(kansas)));\n\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n    }\n\n    @Test\n    public void testGoToNowhereDoesNothing() throws Exception {\n        placeManager.goTo(PlaceRequest.NOWHERE,\n                          (PanelDefinition) null);\n\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n    }\n\n    // XXX would like to remove this behaviour (should throw NPE) but too many things are up in the air right now\n    @Test\n    public void testGoToNullDoesNothing() throws Exception {\n\n        placeManager.goTo((PlaceRequest) null,\n                          (PanelDefinition) null);\n\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n    }\n\n    @Test\n    public void testGoToPlaceByPath() throws Exception {\n\n        PathPlaceRequest yellowBrickRoad = new FakePathPlaceRequest(mock(ObservablePath.class));\n        WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n        when(activityManager.getActivities(yellowBrickRoad)).thenReturn(singleton((Activity) ozActivity));\n\n        placeManager.goTo(yellowBrickRoad,\n                          (PanelDefinition) null);\n\n        verifyActivityLaunchSideEffects(yellowBrickRoad,\n                                        ozActivity,\n                                        null);\n\n        // special contract just for path-type place requests (subject to preference)\n        verify(yellowBrickRoad.getPath(),\n               never()).onDelete(any(Command.class));\n    }\n\n    @Test\n    public void testNormalCloseExistingScreenActivity() throws Exception {\n        when(kansasActivity.onMayClose()).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManager.closePlace(kansas);\n\n        verify(workbenchPartBeforeCloseEvent).fire(refEq(new BeforeClosePlaceEvent(kansas,\n                                                                                   false,\n                                                                                   true)));\n        verify(workbenchPartCloseEvent).fire(refEq(new ClosePlaceEvent(kansas)));\n        verify(kansasActivity).onMayClose();\n        verify(kansasActivity).onClose();\n        verify(kansasActivity,\n               never()).onShutdown();\n        verify(activityManager).destroyActivity(kansasActivity);\n        verify(panelManager).removePartForPlace(kansas);\n\n        assertEquals(PlaceStatus.CLOSE,\n                     placeManager.getStatus(kansas));\n        assertNull(placeManager.getActivity(kansas));\n        assertFalse(placeManager.getActivePlaceRequests().contains(kansas));\n    }\n\n    @Test\n    public void testClosePlaceAlwaysCloseActivityBeforeDestroy() {\n        when(kansasActivity.isType(any())).thenReturn(false);\n\n        placeManager.closePlace(kansas);\n\n        InOrder inOrder = inOrder(activityManager, kansasActivity);\n        inOrder.verify(kansasActivity).onClose();\n        inOrder.verify(activityManager).destroyActivity(kansasActivity);\n    }\n\n    @Test\n    public void testCanceledCloseExistingScreenActivity() throws Exception {\n        when(kansasActivity.onMayClose()).thenReturn(false);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManager.closePlace(kansas);\n\n        verify(workbenchPartBeforeCloseEvent).fire(refEq(new BeforeClosePlaceEvent(kansas,\n                                                                                   false,\n                                                                                   true)));\n        verify(workbenchPartCloseEvent,\n               never()).fire(refEq(new ClosePlaceEvent(kansas)));\n        verify(kansasActivity).onMayClose();\n        verify(kansasActivity,\n               never()).onClose();\n        verify(kansasActivity,\n               never()).onShutdown();\n        verify(activityManager,\n               never()).destroyActivity(kansasActivity);\n        verify(panelManager,\n               never()).removePartForPlace(kansas);\n\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(kansas));\n        assertSame(kansasActivity,\n                   placeManager.getActivity(kansas));\n        assertTrue(placeManager.getActivePlaceRequests().contains(kansas));\n    }\n\n    @Test\n    public void testForceCloseExistingScreenActivity() throws Exception {\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManager.forceClosePlace(kansas);\n\n        verify(workbenchPartBeforeCloseEvent).fire(refEq(new BeforeClosePlaceEvent(kansas,\n                                                                                   true,\n                                                                                   true)));\n        verify(workbenchPartCloseEvent).fire(refEq(new ClosePlaceEvent(kansas)));\n        verify(kansasActivity,\n               never()).onMayClose();\n        verify(kansasActivity).onClose();\n        verify(kansasActivity,\n               never()).onShutdown();\n        verify(activityManager).destroyActivity(kansasActivity);\n        verify(panelManager).removePartForPlace(kansas);\n\n        assertEquals(PlaceStatus.CLOSE,\n                     placeManager.getStatus(kansas));\n        assertNull(placeManager.getActivity(kansas));\n        assertFalse(placeManager.getActivePlaceRequests().contains(kansas));\n    }\n\n    /**\n     * Tests the basics of launching a perspective. We call it \"empty\" because this perspective doesn't have any panels\n     * or parts in its definition.\n     */\n    @Test\n    public void testLaunchingEmptyPerspective() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        placeManager.goTo(ozPerspectivePlace);\n\n        // verify perspective changed to oz\n        verify(perspectiveManager).savePerspectiveState(any(Command.class));\n        verify(perspectiveManager).switchToPerspective(any(PlaceRequest.class),\n                                                       eq(ozPerspectiveActivity),\n                                                       any(ParameterizedCommand.class));\n        verify(ozPerspectiveActivity).onOpen();\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(ozPerspectivePlace));\n        assertTrue(placeManager.getActivePlaceRequests().contains(ozPerspectivePlace));\n        assertEquals(ozPerspectiveActivity,\n                     placeManager.getActivity(ozPerspectivePlace));\n        verify(workbenchLayout).onResize();\n    }\n\n    @Test\n    public void testSwitchingPerspectives() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        // we'll pretend we started in kansas\n        PerspectiveActivity kansasPerspectiveActivity = mock(PerspectiveActivity.class);\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(kansasPerspectiveActivity);\n\n        placeManager.goTo(ozPerspectivePlace);\n\n        // verify proper shutdown of kansasPerspective and its contents\n        InOrder inOrder = inOrder(activityManager,\n                                  kansasPerspectiveActivity,\n                                  kansasActivity,\n                                  workbenchLayout);\n\n        // shut down the screens first\n        inOrder.verify(kansasActivity).onClose();\n        inOrder.verify(activityManager).destroyActivity(kansasActivity);\n\n        // then the perspective\n        inOrder.verify(kansasPerspectiveActivity).onClose();\n        inOrder.verify(activityManager).destroyActivity(kansasPerspectiveActivity);\n        inOrder.verify(workbenchLayout).onResize();\n    }\n\n    @Test\n    public void testSwitchingPerspectivesWithProperChain() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        // we'll pretend we started in kansas\n        PerspectiveActivity kansasPerspectiveActivity = mock(PerspectiveActivity.class);\n        when(kansasPerspectiveActivity.getIdentifier()).thenReturn(\"kansas\");\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(kansasPerspectiveActivity);\n\n        final AtomicBoolean chainExecuted = new AtomicBoolean(false);\n        placeManager.registerPerspectiveCloseChain(\"kansas\",\n                                                   (chain, place) -> {\n                                                       chainExecuted.set(true);\n                                                       chain.execute();\n                                                   });\n\n        placeManager.goTo(ozPerspectivePlace);\n\n        // verify close chain was ran\n        assertTrue(chainExecuted.get());\n\n        // verify proper shutdown of kansasPerspective and its contents\n        InOrder inOrder = inOrder(activityManager,\n                                  kansasPerspectiveActivity,\n                                  kansasActivity,\n                                  workbenchLayout);\n\n        // shut down the screens first\n        inOrder.verify(kansasActivity).onClose();\n        inOrder.verify(activityManager).destroyActivity(kansasActivity);\n\n        // then the perspective\n        inOrder.verify(kansasPerspectiveActivity).onClose();\n        inOrder.verify(activityManager).destroyActivity(kansasPerspectiveActivity);\n        inOrder.verify(workbenchLayout).onResize();\n    }\n\n    @Test\n    public void testSwitchingPerspectivesWithChainCancelingTheOperation() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        // we'll pretend we started in kansas\n        PerspectiveActivity kansasPerspectiveActivity = mock(PerspectiveActivity.class);\n        when(kansasPerspectiveActivity.getIdentifier()).thenReturn(\"kansas\");\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(kansasPerspectiveActivity);\n\n        final AtomicBoolean chainExecuted = new AtomicBoolean(false);\n        placeManager.registerPerspectiveCloseChain(\"kansas\",\n                                                   (chain, place) -> {\n                                                       chainExecuted.set(true);\n                                                       // chain was not executed.\n                                                   });\n\n        placeManager.goTo(ozPerspectivePlace);\n\n        // verify close chain was ran\n        assertTrue(chainExecuted.get());\n\n        // verify kansasPerspective and its contents were not closed\n        InOrder inOrder = inOrder(activityManager,\n                                  kansasPerspectiveActivity,\n                                  kansasActivity,\n                                  workbenchLayout);\n\n        // does not shut down the screens\n        inOrder.verify(kansasActivity, never()).onClose();\n        inOrder.verify(activityManager, never()).destroyActivity(kansasActivity);\n\n        // the perspective was not closed\n        inOrder.verify(kansasPerspectiveActivity, never()).onClose();\n        inOrder.verify(activityManager, never()).destroyActivity(kansasPerspectiveActivity);\n        inOrder.verify(workbenchLayout, never()).onResize();\n    }\n\n    @Test\n    public void testSwitchingFromPerspectiveToSelf() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(ozPerspectiveActivity.getIdentifier()).thenReturn(\"oz_perspective\");\n\n        // we'll pretend we started in oz\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(ozPerspectiveActivity);\n\n        final BiParameterizedCommand<Command, PlaceRequest> closeChain = mock(BiParameterizedCommand.class);\n        placeManager.registerPerspectiveCloseChain(\"oz_perspective\",\n                                                   closeChain);\n\n        placeManager.goTo(ozPerspectivePlace);\n\n        verify(closeChain,\n               never()).execute(any(), any());\n\n        // verify no side effects (should stay put)\n        verify(ozPerspectiveActivity,\n               never()).onOpen();\n        verify(perspectiveManager,\n               never()).savePerspectiveState(any(Command.class));\n        verify(perspectiveManager,\n               never())\n                .switchToPerspective(any(PlaceRequest.class),\n                                     any(PerspectiveActivity.class),\n                                     any(ParameterizedCommand.class));\n    }\n\n    @Test\n    public void testOpenPerspectiveWithPanels() throws Exception {\n        final String perspectiveId = \"perspective\";\n        final String panelId = \"panel\";\n\n        final String param1 = \"param1\";\n        final String param2 = \"param2\";\n        final String param3 = \"param3\";\n\n        PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        WorkbenchScreenActivity screenActivity = mock(WorkbenchScreenActivity.class);\n\n        PlaceRequest panelPlaceRequest = spy(new DefaultPlaceRequest(panelId) {\n            {\n                addParameter(param1, param1);\n                addParameter(param2, param2);\n                addParameter(param3, param3);\n            }\n        });\n        when(panelPlaceRequest.getIdentifier()).thenReturn(panelId);\n\n        PlaceRequest mainPlaceRequest = new DefaultPlaceRequest(perspectiveId);\n\n        final PerspectiveDefinition perspectiveDefinition = new PerspectiveDefinitionImpl();\n        perspectiveDefinition.setName(\"name\");\n\n        final PartDefinition panelPart = spy(new PartDefinitionImpl(panelPlaceRequest));\n        perspectiveDefinition.getRoot().addPart(panelPart);\n\n        when(perspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(perspectiveDefinition);\n        when(perspectiveActivity.getPlace()).thenReturn(mainPlaceRequest);\n        when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(perspectiveActivity.getIdentifier()).thenReturn(perspectiveId);\n\n        when(screenActivity.getIdentifier()).thenReturn(panelId);\n        when(screenActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        when(activityManager.getActivities(any(PlaceRequest.class))).then((Answer<Set<Activity>>) invocationOnMock -> {\n            PlaceRequest request = (PlaceRequest) invocationOnMock.getArguments()[0];\n\n            if (request.equals(panelPlaceRequest)) {\n                return singleton(screenActivity);\n            } else if(request.equals(mainPlaceRequest)) {\n                return singleton(perspectiveActivity);\n            }\n\n            return null;\n        });\n\n        placeManager.goTo(mainPlaceRequest);\n\n        verify(activitiesAuthorizationManager).securePart(eq(panelPart), eq(perspectiveDefinition.getRoot()));\n\n        verify(panelPlaceRequest).clone();\n\n        ArgumentCaptor<PlaceRequest> requestArgumentCaptor = ArgumentCaptor.forClass(PlaceRequest.class);\n\n        verify(panelPart).setPlace(requestArgumentCaptor.capture());\n\n        PlaceRequest captured = requestArgumentCaptor.getValue();\n\n        Assertions.assertThat(captured)\n                .isNotNull()\n                .isNotSameAs(panelPlaceRequest)\n                .returns(panelId, (Function<PlaceRequest, String>) placeRequest -> placeRequest.getIdentifier());\n\n        Assertions.assertThat(captured.getParameters())\n                .containsOnly(Assertions.entry(param1, param1), Assertions.entry(param2, param2), Assertions.entry(param3, param3));\n\n        verify(perspectiveActivity).onOpen();\n        verify(perspectiveManager).savePerspectiveState(any(Command.class));\n        verify(perspectiveManager)\n                .switchToPerspective(any(PlaceRequest.class),\n                        any(PerspectiveActivity.class),\n                        any(ParameterizedCommand.class));\n    }\n\n    /**\n     * This test verifies that when launching a screen which is \"owned by\" a perspective other than the current one, the\n     * PlaceManager first switches to the owning perspective and then launches the requested screen.\n     */\n    @Test\n    public void testLaunchingActivityTiedToDifferentPerspective() throws Exception {\n        PerspectiveActivity ozPerspectiveActivity = mock(PerspectiveActivity.class);\n        PlaceRequest ozPerspectivePlace = new DefaultPlaceRequest(\"oz_perspective\");\n        PerspectiveDefinition ozPerspectiveDef = new PerspectiveDefinitionImpl();\n\n        when(activityManager.getActivities(ozPerspectivePlace))\n                .thenReturn(singleton((Activity) ozPerspectiveActivity));\n        when(ozPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(ozPerspectiveDef);\n        when(ozPerspectiveActivity.getPlace()).thenReturn(ozPerspectivePlace);\n        when(ozPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozPerspectiveActivity).getMenus(any());\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        when(emeraldCityActivity.getOwningPlace()).thenReturn(ozPerspectivePlace);\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity).getMenus(any());\n\n        placeManager.goTo(emeraldCityPlace,\n                          (PanelDefinition) null);\n\n        // verify perspective changed to oz\n        verify(perspectiveManager).savePerspectiveState(any(Command.class));\n        verify(perspectiveManager).switchToPerspective(any(PlaceRequest.class),\n                                                       eq(ozPerspectiveActivity),\n                                                       any(ParameterizedCommand.class));\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(ozPerspectivePlace));\n\n        // verify perspective opened before the activity that launches inside it\n        InOrder inOrder = inOrder(ozPerspectiveActivity,\n                                  emeraldCityActivity);\n        inOrder.verify(ozPerspectiveActivity).onOpen();\n        inOrder.verify(emeraldCityActivity).onOpen();\n\n        // and the workbench activity should have launched (after the perspective change)\n        verifyActivityLaunchSideEffects(emeraldCityPlace,\n                                        emeraldCityActivity,\n                                        null);\n    }\n\n    @Test\n    public void testPerspectiveLaunchWithSplashScreen() throws Exception {\n        final PlaceRequest perspectivePlace = new DefaultPlaceRequest(\"Somewhere\");\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        final PerspectiveDefinition perspectiveDef = new PerspectiveDefinitionImpl(\n                SimpleWorkbenchPanelPresenter.class.getName());\n        when(perspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(perspectiveDef);\n        when(activityManager.getActivities(perspectivePlace))\n                .thenReturn(singleton((Activity) perspectiveActivity));\n\n        final SplashScreenActivity splashScreenActivity = mock(SplashScreenActivity.class);\n        when(activityManager.getSplashScreenInterceptor(perspectivePlace)).thenReturn(splashScreenActivity);\n        when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(splashScreenActivity.isType(ActivityResourceType.SPLASH.name())).thenReturn(true);\n\n        placeManager.goTo(perspectivePlace);\n\n        // splash screen should be open and registered as an active splash screen\n        verify(splashScreenActivity,\n               never()).onStartup(any(PlaceRequest.class));\n\n        InOrder inOrder = inOrder(splashScreenActivity,\n                                  newSplashScreenActiveEvent);\n        inOrder.verify(splashScreenActivity).onOpen();\n        inOrder.verify(newSplashScreenActiveEvent).fire(any(NewSplashScreenActiveEvent.class));\n\n        assertTrue(placeManager.getActiveSplashScreens().contains(splashScreenActivity));\n\n        // perspective should be open, and should be the activity registered for its own place\n        verify(perspectiveActivity,\n               never()).onStartup(any(PlaceRequest.class));\n        verify(perspectiveActivity).onOpen();\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(perspectivePlace));\n        assertSame(perspectiveActivity,\n                   placeManager.getActivity(perspectivePlace));\n    }\n\n    @Test\n    public void testProperSplashScreenShutdownOnPerspectiveSwitch() throws Exception {\n        final PlaceRequest perspectivePlace = new DefaultPlaceRequest(\"Somewhere\");\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        final PerspectiveDefinition perspectiveDef = new PerspectiveDefinitionImpl(\n                SimpleWorkbenchPanelPresenter.class.getName());\n        when(perspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(perspectiveDef);\n        when(perspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(perspectiveActivity).getMenus(any());\n        when(activityManager.getActivities(perspectivePlace))\n                .thenReturn(singleton((Activity) perspectiveActivity));\n\n        // first splash screen: linked to the perspective itself\n        final SplashScreenActivity splashScreenActivity1 = mock(SplashScreenActivity.class);\n        when(activityManager.getSplashScreenInterceptor(perspectivePlace)).thenReturn(splashScreenActivity1);\n        when(splashScreenActivity1.isType(ActivityResourceType.SPLASH.name())).thenReturn(true);\n\n        // second splash screen: linked to a screen that we will display in the perspective\n        final SplashScreenActivity splashScreenActivity2 = mock(SplashScreenActivity.class);\n        when(activityManager.getSplashScreenInterceptor(kansas)).thenReturn(splashScreenActivity2);\n        when(activityManager.getActivities(kansas)).thenReturn(singleton((Activity) kansasActivity));\n        when(splashScreenActivity2.isType(ActivityResourceType.SPLASH.name())).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(kansasActivity).getMenus(any());\n\n        placeManager.goTo(perspectivePlace);\n        placeManager.goTo(kansas);\n\n        assertTrue(placeManager.getActiveSplashScreens().contains(splashScreenActivity1));\n        assertTrue(placeManager.getActiveSplashScreens().contains(splashScreenActivity2));\n\n        // now switch to another perspective and ensure both kinds of splash screens got closed\n        final PlaceRequest otherPerspectivePlace = new DefaultPlaceRequest(\"Elsewhere\");\n        final PerspectiveActivity otherPerspectiveActivity = mock(PerspectiveActivity.class);\n        final PerspectiveDefinition otherPerspectiveDef = new PerspectiveDefinitionImpl(\n                SimpleWorkbenchPanelPresenter.class.getName());\n        when(otherPerspectiveActivity.getDefaultPerspectiveLayout()).thenReturn(otherPerspectiveDef);\n        when(otherPerspectiveActivity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(activityManager.getActivities(otherPerspectivePlace))\n                .thenReturn(singleton((Activity) otherPerspectiveActivity));\n\n        placeManager.goTo(otherPerspectivePlace);\n\n        assertTrue(placeManager.getActiveSplashScreens().isEmpty());\n        verify(splashScreenActivity1).closeIfOpen();\n        verify(splashScreenActivity2).closeIfOpen();\n\n        // splash screens are Application Scoped, but we still \"destroy\" them (activity manager will call their onShutdown)\n        verify(activityManager).destroyActivity(splashScreenActivity1);\n        verify(activityManager).destroyActivity(splashScreenActivity2);\n    }\n\n    @Test\n    public void testPartLaunchWithSplashScreen() throws Exception {\n        PlaceRequest oz = new DefaultPlaceRequest(\"oz\");\n        WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n        when(activityManager.getActivities(oz)).thenReturn(singleton((Activity) ozActivity));\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n\n        final SplashScreenActivity lollipopGuildActivity = mock(SplashScreenActivity.class);\n        when(activityManager.getSplashScreenInterceptor(oz)).thenReturn(lollipopGuildActivity);\n        when(lollipopGuildActivity.isType(ActivityResourceType.SPLASH.name())).thenReturn(true);\n\n        placeManager.goTo(oz,\n                          (PanelDefinition) null);\n\n        assertTrue(placeManager.getActiveSplashScreens().contains(lollipopGuildActivity));\n        verify(lollipopGuildActivity,\n               never()).onStartup(any(PlaceRequest.class));\n\n        InOrder inOrder = inOrder(lollipopGuildActivity,\n                                  newSplashScreenActiveEvent);\n        inOrder.verify(lollipopGuildActivity).onOpen();\n        inOrder.verify(newSplashScreenActiveEvent).fire(any(NewSplashScreenActiveEvent.class));\n    }\n\n    @Test\n    public void testProperSplashScreenShutdownOnPartClose() throws Exception {\n        PlaceRequest oz = new DefaultPlaceRequest(\"oz\");\n        WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n        when(activityManager.getActivities(oz)).thenReturn(singleton((Activity) ozActivity));\n\n        final SplashScreenActivity lollipopGuildActivity = mock(SplashScreenActivity.class);\n        when(lollipopGuildActivity.isType(ActivityResourceType.SPLASH.name())).thenReturn(true);\n        when(activityManager.getSplashScreenInterceptor(oz)).thenReturn(lollipopGuildActivity);\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n\n        placeManager.goTo(oz,\n                          (PanelDefinition) null);\n        placeManager.closePlace(oz);\n\n        assertTrue(placeManager.getActiveSplashScreens().isEmpty());\n        verify(lollipopGuildActivity).closeIfOpen();\n\n        // splash screens are Application Scoped, but we still \"destroy\" them (activity manager will call their onShutdown)\n        verify(activityManager).destroyActivity(lollipopGuildActivity);\n    }\n\n    /**\n     * Ensures that splash screens can't be launched on their own (they should only launch as a side effect of launching\n     * a place that they intercept). This test came from the original test suite, and may not be all that relevant\n     * anymore: it assumes that the ActivityManager might resolve a PlaceRequest to a SplashScreenActivity, and this is\n     * currently not in the ActivityManager contract.\n     */\n    @Test\n    public void testSplashScreenActivityShouldNotLaunchOnItsOwn() throws Exception {\n        final PlaceRequest somewhere = new DefaultPlaceRequest(\"Somewhere\");\n\n        final SplashScreenActivity splashScreenActivity = mock(SplashScreenActivity.class);\n        when(activityManager.getActivities(somewhere)).thenReturn(singleton((Activity) splashScreenActivity));\n\n        placeManager.goTo(somewhere);\n\n        verify(splashScreenActivity,\n               never()).onStartup(eq(somewhere));\n        verify(splashScreenActivity,\n               never()).onOpen();\n        verify(newSplashScreenActiveEvent,\n               never()).fire(any(NewSplashScreenActiveEvent.class));\n        assertFalse(placeManager.getActiveSplashScreens().contains(splashScreenActivity));\n    }\n\n    /**\n     * Ensures that context activities can't be launched on their own (they should only launch as a side effect of launching\n     * a place that they relate to). This test was moved here from the original test suite.\n     */\n    @Test\n    public void testContextActivityShouldNotLaunchOnItsOwn() throws Exception {\n        final PlaceRequest somewhere = new DefaultPlaceRequest(\"Somewhere\");\n\n        final ContextActivity activity = mock(ContextActivity.class);\n        when(activityManager.getActivities(somewhere)).thenReturn(singleton((Activity) activity));\n\n        placeManager.goTo(somewhere);\n\n        verify(activity,\n               never()).onStartup(eq(somewhere));\n        verify(activity,\n               never()).onOpen();\n    }\n\n    @Test\n    public void testLaunchingPopup() throws Exception {\n\n        final PlaceRequest popupPlace = new DefaultPlaceRequest(\"Somewhere\");\n        final AbstractPopupActivity popupActivity = mock(AbstractPopupActivity.class);\n\n        when(activityManager.getActivities(popupPlace)).thenReturn(singleton((Activity) popupActivity));\n        when(popupActivity.isType(ActivityResourceType.POPUP.name())).thenReturn(true);\n\n        placeManager.goTo(popupPlace);\n\n        verify(popupActivity,\n               never()).onStartup(any(PlaceRequest.class));\n        verify(popupActivity,\n               times(1)).onOpen();\n\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(popupPlace));\n\n        // TODO this test was moved here from the old test suite. it may not verify all required side effects of launching a popup.\n    }\n\n    @Test\n    public void testLaunchingPopupThatIsAlreadyOpen() throws Exception {\n\n        final PlaceRequest popupPlace = new DefaultPlaceRequest(\"Somewhere\");\n        final AbstractPopupActivity popupActivity = mock(AbstractPopupActivity.class);\n\n        when(activityManager.getActivities(popupPlace)).thenReturn(singleton((Activity) popupActivity));\n        when(popupActivity.isType(ActivityResourceType.POPUP.name())).thenReturn(true);\n\n        placeManager.goTo(popupPlace);\n        placeManager.goTo(popupPlace);\n\n        verify(popupActivity,\n               never()).onStartup(any(PlaceRequest.class));\n        verify(popupActivity,\n               times(1)).onOpen();\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(popupPlace));\n    }\n\n    @Test\n    public void testReLaunchingClosedPopup() throws Exception {\n\n        final PlaceRequest popupPlace = new DefaultPlaceRequest(\"Somewhere\");\n        final AbstractPopupActivity popupActivity = mock(AbstractPopupActivity.class);\n        when(popupActivity.onMayClose()).thenReturn(true);\n        when(popupActivity.isType(ActivityResourceType.POPUP.name())).thenReturn(true);\n        when(activityManager.getActivities(popupPlace)).thenReturn(singleton((Activity) popupActivity));\n\n        placeManager.goTo(popupPlace);\n        placeManager.closePlace(popupPlace);\n        placeManager.goTo(popupPlace);\n\n        verify(popupActivity,\n               times(2)).onOpen();\n        verify(popupActivity,\n               times(1)).onClose();\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(popupPlace));\n    }\n\n    @Test\n    public void testPopupCancelsClose() throws Exception {\n\n        final PlaceRequest popupPlace = new DefaultPlaceRequest(\"Somewhere\");\n        final AbstractPopupActivity popupActivity = mock(AbstractPopupActivity.class);\n        when(popupActivity.onMayClose()).thenReturn(false);\n        when(popupActivity.isType(ActivityResourceType.POPUP.name())).thenReturn(true);\n        when(activityManager.getActivities(popupPlace)).thenReturn(singleton((Activity) popupActivity));\n\n        placeManager.goTo(popupPlace);\n        placeManager.closePlace(popupPlace);\n\n        verify(popupActivity,\n               never()).onClose();\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(popupPlace));\n    }\n\n    @Test\n    public void testLaunchActivityInCustomPanel() throws Exception {\n        HasWidgets any = any(HasWidgets.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity.preferredHeight()).thenReturn(-1);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity).getMenus(any());\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        HasWidgets customContainer = mock(HasWidgets.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace,\n                                        emeraldCityActivity,\n                                        customPanelDef);\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n        assertNull(customPanelDef.getParent());\n    }\n\n    @Test\n    public void testLaunchActivityInCustomHasWidgetsPanelShouldCloseExistingOnes() throws Exception {\n        PlaceManagerImpl placeManagerSpy = spy(this.placeManager);\n        HasWidgets panel = mock(HasWidgets.class);\n        CustomPanelDefinitionImpl customPanelDef = spy(new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                panel));\n        when(panelManager.addCustomPanel(eq(panel),\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity.preferredHeight()).thenReturn(-1);\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity).getMenus(any());\n\n        PlaceRequest emeraldCityPlace2 = new DefaultPlaceRequest(\"emerald_city2\");\n        WorkbenchScreenActivity emeraldCityActivity2 = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity2.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity2.preferredHeight()).thenReturn(-1);\n        when(activityManager.getActivities(emeraldCityPlace2))\n                .thenReturn(singleton((Activity) emeraldCityActivity2));\n        when(emeraldCityActivity2.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity2).getMenus(any());\n\n        placeManagerSpy.goTo(emeraldCityPlace,\n                               panel);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace,\n                                        emeraldCityActivity,\n                                        customPanelDef);\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n        assertNull(customPanelDef.getParent());\n\n        Set<PartDefinition> parts = new HashSet<>();\n        PartDefinition part = mock(PartDefinition.class);\n        parts.add(part);\n        when(part.getPlace()).thenReturn(emeraldCityPlace);\n        when(customPanelDef.getParts()).thenReturn(parts);\n\n        placeManagerSpy.goTo(emeraldCityPlace2,\n                               panel);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace2,\n                                        emeraldCityActivity2,\n                                        customPanelDef);\n\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace2),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace2)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n\n        verify(placeManagerSpy).closePlace(emeraldCityPlace);\n\n        assertNull(customPanelDef.getParent());\n    }\n\n    @Test\n    public void testLaunchActivityInCustomHTMLElementPanelShouldCloseExistingOnes() throws Exception {\n        PlaceManagerImpl placeManagerSpy = spy(this.placeManager);\n        HTMLElement panel = mock(HTMLElement.class);\n        CustomPanelDefinitionImpl customPanelDef = spy(new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                panel));\n        when(panelManager.addCustomPanel(eq(panel),\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity.preferredHeight()).thenReturn(-1);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity).getMenus(any());\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        PlaceRequest emeraldCityPlace2 = new DefaultPlaceRequest(\"emerald_city2\");\n        WorkbenchScreenActivity emeraldCityActivity2 = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity2.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity2.preferredHeight()).thenReturn(-1);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity2).getMenus(any());\n        when(activityManager.getActivities(emeraldCityPlace2))\n                .thenReturn(singleton((Activity) emeraldCityActivity2));\n        when(emeraldCityActivity2.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManagerSpy.goTo(emeraldCityPlace,\n                             panel);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace,\n                                        emeraldCityActivity,\n                                        customPanelDef);\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n        assertNull(customPanelDef.getParent());\n\n        Set<PartDefinition> parts = new HashSet<>();\n        PartDefinition part = mock(PartDefinition.class);\n        parts.add(part);\n        when(part.getPlace()).thenReturn(emeraldCityPlace);\n        when(customPanelDef.getParts()).thenReturn(parts);\n\n        placeManagerSpy.goTo(emeraldCityPlace2,\n                             panel);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace2,\n                                        emeraldCityActivity2,\n                                        customPanelDef);\n\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace2),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace2)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n\n        verify(placeManagerSpy).closePlace(emeraldCityPlace);\n\n        assertNull(customPanelDef.getParent());\n    }\n\n    @Test\n    public void testLaunchExistingActivityInCustomPanel() throws Exception {\n        HasWidgets customContainer = mock(HasWidgets.class);\n\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        placeManager.goTo(kansas,\n                          customContainer);\n\n        verify(panelManager,\n               never())\n                .addCustomPanel(customContainer,\n                                StaticWorkbenchPanelPresenter.class.getName());\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n        verify(selectWorkbenchPartEvent).fire(refEq(new SelectPlaceEvent(kansas)));\n    }\n\n    @Test\n    public void testClosingActivityInCustomPanel() throws Exception {\n        HasWidgets any = any(HasWidgets.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        createWorkbenchScreenActivity(emeraldCityPlace);\n\n        HasWidgets customContainer = mock(HasWidgets.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n        placeManager.closePlace(emeraldCityPlace);\n\n        assertTrue(customPanelDef.getParts().isEmpty());\n        verify(panelManager).removeWorkbenchPanel(customPanelDef);\n    }\n\n    @Test\n    public void testClosingAllPlacesIncludesCustomPanels() throws Exception {\n        HasWidgets any = any(HasWidgets.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        createWorkbenchScreenActivity(emeraldCityPlace);\n\n        HasWidgets customContainer = mock(HasWidgets.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n        placeManager.closeAllPlaces();\n\n        assertTrue(customPanelDef.getParts().isEmpty());\n        verify(panelManager).removeWorkbenchPanel(customPanelDef);\n    }\n\n    @Test\n    public void testLaunchActivityInCustomPanelInsideHTMLElement() throws Exception {\n        HTMLElement any = any(HTMLElement.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity.preferredHeight()).thenReturn(-1);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(emeraldCityActivity).getMenus(any());\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        HTMLElement customContainer = mock(HTMLElement.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n\n        verifyActivityLaunchSideEffects(emeraldCityPlace,\n                                        emeraldCityActivity,\n                                        customPanelDef);\n        verify(panelManager).addWorkbenchPart(eq(emeraldCityPlace),\n                                              eq(new PartDefinitionImpl(emeraldCityPlace)),\n                                              eq(customPanelDef),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              isNull(Integer.class),\n                                              isNull(Integer.class));\n        assertNull(customPanelDef.getParent());\n    }\n\n    @Test\n    public void testLaunchExistingActivityInCustomPanelInsideHTMLElement() throws Exception {\n        HTMLElement customContainer = mock(HTMLElement.class);\n\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        placeManager.goTo(kansas,\n                          customContainer);\n\n        verify(panelManager,\n               never())\n                .addCustomPanel(customContainer,\n                                StaticWorkbenchPanelPresenter.class.getName());\n        verifyNoActivityLaunchSideEffects(kansas,\n                                          kansasActivity);\n        verify(selectWorkbenchPartEvent).fire(refEq(new SelectPlaceEvent(kansas)));\n    }\n\n    @Test\n    public void testClosingActivityInCustomPanelInsideHTMLElement() throws Exception {\n        HTMLElement any = any(HTMLElement.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        createWorkbenchScreenActivity(emeraldCityPlace);\n\n        HTMLElement customContainer = mock(HTMLElement.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n        placeManager.closePlace(emeraldCityPlace);\n\n        assertTrue(customPanelDef.getParts().isEmpty());\n        verify(panelManager).removeWorkbenchPanel(customPanelDef);\n    }\n\n    @Test\n    public void testClosingAllPlacesIncludesCustomPanelsInsideHTMLElements() throws Exception {\n        HTMLElement any = any(HTMLElement.class);\n        CustomPanelDefinitionImpl customPanelDef = new CustomPanelDefinitionImpl(\n                UnanchoredStaticWorkbenchPanelPresenter.class.getName(),\n                any);\n        when(panelManager.addCustomPanel(any,\n                                         eq(UnanchoredStaticWorkbenchPanelPresenter.class.getName())))\n                .thenReturn(customPanelDef);\n\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        createWorkbenchScreenActivity(emeraldCityPlace);\n\n        HTMLElement customContainer = mock(HTMLElement.class);\n\n        placeManager.goTo(emeraldCityPlace,\n                          customContainer);\n        placeManager.closeAllPlaces();\n\n        assertTrue(customPanelDef.getParts().isEmpty());\n        verify(panelManager).removeWorkbenchPanel(customPanelDef);\n    }\n\n    @Test\n    public void testGetActivitiesForResourceType_NoMatches() throws Exception {\n        final ObservablePath path = mock(ObservablePath.class);\n        final PathPlaceRequest yellowBrickRoad = new FakePathPlaceRequest(path);\n        final WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n\n        when(activityManager.getActivities(yellowBrickRoad)).thenReturn(singleton((Activity) ozActivity));\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n\n        placeManager.goTo(yellowBrickRoad);\n\n        verifyActivityLaunchSideEffects(yellowBrickRoad,\n                                        ozActivity,\n                                        null);\n\n        final ResourceTypeDefinition resourceType = mock(ResourceTypeDefinition.class);\n        when(resourceType.accept(path)).thenReturn(false);\n\n        final Collection<PathPlaceRequest> resolvedActivities = placeManager\n                .getActivitiesForResourceType(resourceType);\n        assertNotNull(resolvedActivities);\n        assertEquals(0,\n                     resolvedActivities.size());\n    }\n\n    @Test\n    public void testGetActivitiesForResourceType_Matches() throws Exception {\n        final ObservablePath path = mock(ObservablePath.class);\n        final PathPlaceRequest yellowBrickRoad = new FakePathPlaceRequest(path);\n        final WorkbenchScreenActivity ozActivity = mock(WorkbenchScreenActivity.class);\n\n        when(activityManager.getActivities(yellowBrickRoad)).thenReturn(singleton((Activity) ozActivity));\n        when(ozActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        doAnswer((Answer<Void>) invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(ozActivity).getMenus(any());\n\n        placeManager.goTo(yellowBrickRoad);\n\n        verifyActivityLaunchSideEffects(yellowBrickRoad,\n                                        ozActivity,\n                                        null);\n\n        final ResourceTypeDefinition resourceType = mock(ResourceTypeDefinition.class);\n        when(resourceType.accept(path)).thenReturn(true);\n\n        final Collection<PathPlaceRequest> resolvedActivities = placeManager\n                .getActivitiesForResourceType(resourceType);\n        assertNotNull(resolvedActivities);\n        assertEquals(1,\n                     resolvedActivities.size());\n\n        try {\n            resolvedActivities.clear();\n\n            fail(\"PlaceManager.getActivitiesForResourceType() should return an unmodifiable collection.\");\n        } catch (UnsupportedOperationException uoe) {\n            //This is correct. The result should be an unmodifiable collection\n        }\n    }\n\n    @Test\n    public void testCloseAllPlacesOrNothingSucceeds() throws Exception {\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = createWorkbenchScreenActivity(emeraldCityPlace);\n        placeManager.goTo(emeraldCityPlace);\n\n        when(kansasActivity.onMayClose()).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManager.closeAllPlacesOrNothing();\n\n        verifyPlaceClosed(kansas,\n                          kansasActivity);\n        verifyPlaceClosed(emeraldCityPlace,\n                          emeraldCityActivity);\n    }\n\n    @Test\n    public void testCloseAllPlacesOrNothingFails() throws Exception {\n        PlaceRequest emeraldCityPlace = new DefaultPlaceRequest(\"emerald_city\");\n        WorkbenchScreenActivity emeraldCityActivity = createWorkbenchScreenActivity(emeraldCityPlace);\n        doReturn(false).when(emeraldCityActivity).onMayClose();\n        placeManager.goTo(emeraldCityPlace);\n\n        when(kansasActivity.onMayClose()).thenReturn(true);\n        when(kansasActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n\n        placeManager.closeAllPlacesOrNothing();\n\n        verifyPlaceNotClosed(kansas,\n                             kansasActivity);\n        verifyPlaceNotClosed(emeraldCityPlace,\n                             emeraldCityActivity);\n    }\n\n    @Test\n    public void testAddOnOpenCallbacks() {\n        final Command onOpenCallback1 = mock(Command.class);\n        final Command onOpenCallback2 = mock(Command.class);\n\n        final DefaultPlaceRequest myPlace = new DefaultPlaceRequest(\"my-place\");\n        placeManager.registerOnOpenCallback(myPlace,\n                                            onOpenCallback1);\n        final List<Command> onOpenCallbacks1 = placeManager.getOnOpenCallbacks(myPlace);\n        assertEquals(1,\n                     onOpenCallbacks1.size());\n        assertSame(onOpenCallback1,\n                   onOpenCallbacks1.get(0));\n\n        placeManager.registerOnOpenCallback(myPlace,\n                                            onOpenCallback2);\n        final List<Command> onOpenCallbacks2 = placeManager.getOnOpenCallbacks(myPlace);\n        assertEquals(2,\n                     onOpenCallbacks2.size());\n        assertSame(onOpenCallback1,\n                   onOpenCallbacks2.get(0));\n        assertSame(onOpenCallback2,\n                   onOpenCallbacks2.get(1));\n\n        final DefaultPlaceRequest myOtherPlace = new DefaultPlaceRequest(\"my-other-place\");\n        final List<Command> onOpenCallbacks3 = placeManager.getOnOpenCallbacks(myOtherPlace);\n        assertNull(onOpenCallbacks3);\n    }\n\n    @Test\n    public void testAddOnCloseCallbacks() {\n        final Command onCloseCallback1 = mock(Command.class);\n        final Command onCloseCallback2 = mock(Command.class);\n\n        final DefaultPlaceRequest myPlace = new DefaultPlaceRequest(\"my-place\");\n        placeManager.registerOnCloseCallback(myPlace,\n                                            onCloseCallback1);\n        final List<Command> onCloseCallbacks1 = placeManager.getOnCloseCallbacks(myPlace);\n        assertEquals(1,\n                     onCloseCallbacks1.size());\n        assertSame(onCloseCallback1,\n                   onCloseCallbacks1.get(0));\n\n        placeManager.registerOnCloseCallback(myPlace,\n                                            onCloseCallback2);\n        final List<Command> onCloseCallbacks2 = placeManager.getOnCloseCallbacks(myPlace);\n        assertEquals(2,\n                     onCloseCallbacks2.size());\n        assertSame(onCloseCallback1,\n                   onCloseCallbacks2.get(0));\n        assertSame(onCloseCallback2,\n                   onCloseCallbacks2.get(1));\n\n        final DefaultPlaceRequest myOtherPlace = new DefaultPlaceRequest(\"my-other-place\");\n        final List<Command> onCloseCallbacks3 = placeManager.getOnCloseCallbacks(myOtherPlace);\n        assertNull(onCloseCallbacks3);\n    }\n\n    private WorkbenchScreenActivity createWorkbenchScreenActivity(final PlaceRequest emeraldCityPlace) {\n        WorkbenchScreenActivity emeraldCityActivity = mock(WorkbenchScreenActivity.class);\n        when(emeraldCityActivity.onMayClose()).thenReturn(true);\n        when(emeraldCityActivity.preferredWidth()).thenReturn(555);\n        when(emeraldCityActivity.preferredHeight()).thenReturn(-1);\n        when(emeraldCityActivity.isType(ActivityResourceType.SCREEN.name())).thenReturn(true);\n        when(activityManager.getActivities(emeraldCityPlace))\n                .thenReturn(singleton((Activity) emeraldCityActivity));\n        return emeraldCityActivity;\n    }\n\n    private void verifyPlaceClosed(final PlaceRequest place,\n                                   final WorkbenchScreenActivity screenActivity) {\n        verify(workbenchPartBeforeCloseEvent).fire(refEq(new BeforeClosePlaceEvent(place,\n                                                                                   true,\n                                                                                   true)));\n        verify(workbenchPartCloseEvent).fire(refEq(new ClosePlaceEvent(place)));\n        verify(screenActivity).onMayClose();\n        verify(screenActivity).onClose();\n        verify(screenActivity,\n               never()).onShutdown();\n        verify(activityManager).destroyActivity(screenActivity);\n        verify(panelManager).removePartForPlace(place);\n\n        assertEquals(PlaceStatus.CLOSE,\n                     placeManager.getStatus(place));\n        assertNull(placeManager.getActivity(place));\n        assertFalse(placeManager.getActivePlaceRequests().contains(place));\n    }\n\n    private void verifyPlaceNotClosed(final PlaceRequest place,\n                                      final WorkbenchScreenActivity screenActivity) {\n        verify(workbenchPartBeforeCloseEvent,\n               never()).fire(refEq(new BeforeClosePlaceEvent(place,\n                                                             true,\n                                                             true)));\n        verify(workbenchPartCloseEvent,\n               never()).fire(refEq(new ClosePlaceEvent(place)));\n        verify(screenActivity,\n               never()).onClose();\n        verify(screenActivity,\n               never()).onShutdown();\n        verify(activityManager,\n               never()).destroyActivity(screenActivity);\n        verify(panelManager,\n               never()).removePartForPlace(place);\n\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(place));\n        assertNotNull(placeManager.getActivity(place));\n        assertTrue(placeManager.getActivePlaceRequests().contains(place));\n    }\n\n    /**\n     * Verifies that all the expected side effects of a screen or editor activity launch have happened.\n     * @param placeRequest The place request that was passed to some variant of PlaceManager.goTo().\n     * @param activity <b>A Mockito mock<b> of the activity that was resolved for <tt>placeRequest</tt>.\n     */\n    private void verifyActivityLaunchSideEffects(PlaceRequest placeRequest,\n                                                 WorkbenchActivity activity,\n                                                 PanelDefinition expectedPanel) {\n\n        // as of UberFire 0.4. this event only happens if the place is already visible.\n        // it might be be better if the event was fired unconditionally. needs investigation.\n        verify(selectWorkbenchPartEvent,\n               never()).fire(any(SelectPlaceEvent.class));\n\n        // we know the activity was created (or we wouldn't be here), but should verify that only happened one time\n        verify(activityManager,\n               times(1)).getActivities(placeRequest);\n\n        // contract between PlaceManager and PanelManager\n        Integer preferredWidth = activity.preferredWidth();\n        Integer preferredHeight = activity.preferredHeight();\n        Integer expectedPartWidth;\n        Integer expectedPartHeight;\n        if (expectedPanel == null) {\n            PanelDefinition rootPanel = panelManager.getRoot();\n            verify(panelManager).addWorkbenchPanel(rootPanel,\n                                                   null,\n                                                   preferredHeight,\n                                                   preferredWidth,\n                                                   null,\n                                                   null);\n            expectedPartWidth = null;\n            expectedPartHeight = null;\n        } else {\n            expectedPartWidth = expectedPanel.getWidth();\n            expectedPartHeight = expectedPanel.getHeight();\n        }\n        verify(panelManager).addWorkbenchPart(eq(placeRequest),\n                                              eq(new PartDefinitionImpl(placeRequest)),\n                                              expectedPanel == null ? any(PanelDefinition.class) : eq(\n                                                      expectedPanel),\n                                              isNull(Menus.class),\n                                              any(UIPart.class),\n                                              isNull(String.class),\n                                              eq(expectedPartWidth),\n                                              eq(expectedPartHeight));\n\n        // contract between PlaceManager and PlaceHistoryHandler\n\n        // state changes in PlaceManager itself (contract between PlaceManager and everyone)\n        assertTrue(\"Actual place requests: \" + placeManager.getActivePlaceRequests(),\n                   placeManager.getActivePlaceRequests().contains(placeRequest));\n        assertSame(activity,\n                   placeManager.getActivity(placeRequest));\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(placeRequest));\n\n        // contract between PlaceManager and Activity\n        verify(activity,\n               never()).onStartup(any(PlaceRequest.class)); // this is ActivityManager's job\n        verify(activity,\n               times(1)).onOpen();\n    }\n\n    // TODO test going to an unresolvable/unknown place\n\n    // TODO test going to a place with a specific target panel (part of the PerspectiveManager/PlaceManager contract)\n\n    // TODO test closing all panels when there are a variety of different types of panels open\n\n    // TODO compare/contrast closeAllPlaces with closeAllCurrentPanels (former is public API; latter is called before launching a new perspective)\n\n    /**\n     * Verifies that the \"place change\" side effects have not happened, and that the given activity is still current.\n     * @param expectedCurrentPlace The place request that placeManager should still consider \"current.\"\n     * @param activity <b>A Mockito mock<b> of the activity tied to <tt>expectedCurrentPlace</tt>.\n     */\n    private void verifyNoActivityLaunchSideEffects(PlaceRequest expectedCurrentPlace,\n                                                   WorkbenchScreenActivity activity) {\n\n        // contract between PlaceManager and PanelManager\n        verify(panelManager,\n               never()).addWorkbenchPanel(eq(panelManager.getRoot()),\n                                          any(Position.class),\n                                          any(Integer.class),\n                                          any(Integer.class),\n                                          any(Integer.class),\n                                          any(Integer.class));\n\n        verify(panelManager,\n               never()).addWorkbenchPanel(eq(panelManager.getRoot()),\n                                          any(PanelDefinition.class),\n                                          any(Position.class));\n\n        // state changes in PlaceManager itself (contract between PlaceManager and everyone)\n        assertTrue(\n                \"Actual place requests: \" + placeManager.getActivePlaceRequests(),\n                placeManager.getActivePlaceRequests().contains(expectedCurrentPlace));\n        assertSame(activity,\n                   placeManager.getActivity(expectedCurrentPlace));\n        assertEquals(PlaceStatus.OPEN,\n                     placeManager.getStatus(expectedCurrentPlace));\n\n        // contract between PlaceManager and Activity\n        verify(activity,\n               never()).onStartup(any(PlaceRequest.class));\n        verify(activity,\n               never()).onOpen();\n    }\n\n    class FakePathPlaceRequest extends PathPlaceRequest {\n\n        final ObservablePath path;\n\n        FakePathPlaceRequest(ObservablePath path) {\n            this.path = path;\n        }\n\n        @Override\n        public ObservablePath getPath() {\n            return path;\n        }\n\n        @Override\n        public int hashCode() {\n            return 42;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleDnDWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SimpleDnDWorkbenchPanelPresenterTest {\n\n    @Mock\n    SimpleDnDWorkbenchPanelView view;\n    SimpleDnDWorkbenchPanelPresenter presenter;\n    @Mock\n    private PlaceManager placeManager;\n\n    @Test\n    public void addPartTest() {\n        presenter = new SimpleDnDWorkbenchPanelPresenter(view,\n                                                         mock(PerspectiveManager.class),\n                                                         placeManager);\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n\n        WorkbenchPartPresenter part = mock(WorkbenchPartPresenter.class);\n        when(part.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part);\n\n        verify(view).addPart(any());\n    }\n\n    @Test\n    public void addPartTwiceShouldCloseOtherPartTest() {\n\n        SinglePartPanelHelper singlePartPanelHelper = mock(SinglePartPanelHelper.class);\n\n        presenter = new SimpleDnDWorkbenchPanelPresenter(view,\n                                                         mock(PerspectiveManager.class),\n                                                         placeManager) {\n            SinglePartPanelHelper createSinglePartPanelHelper() {\n                return singlePartPanelHelper;\n            }\n        };\n\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n\n        //there is already a part\n        when(singlePartPanelHelper.hasNoParts()).thenReturn(false);\n\n        WorkbenchPartPresenter part2 = mock(WorkbenchPartPresenter.class);\n        when(part2.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part2);\n\n        verify(singlePartPanelHelper).closeFirstPartAndAddNewOne(any(Command.class));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleNoExpandWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\nimport java.util.Arrays;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.workbench.model.PartDefinition;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SimpleNoExpandWorkbenchPanelPresenterTest extends AbstractDockingWorkbenchPanelPresenterTest {\n\n    \n    @Mock(name = \"view\")\n    protected DockingWorkbenchPanelView<SimpleNoExpandWorkbenchPanelPresenter> view;\n    @Mock\n    private PlaceManager placeManager;\n    @InjectMocks\n    SimpleNoExpandWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void init() {\n        presenter.init();\n        presenter.setDefinition(panelPresenterPanelDefinition);\n    }\n    \n    @Override\n    AbstractDockingWorkbenchPanelPresenter<?> getPresenterToTest() {\n        return presenter;\n    }\n    \n    @Test\n    public void viewInitCalledTest() {\n        verify(view).init(presenter);\n    }\n    \n    @Test\n    public void addPartTest() {\n        WorkbenchPartPresenter workbenchPartPresenter = Mockito.mock(WorkbenchPartPresenter.class);\n        PartDefinition partDefinition = mock(PartDefinition.class);\n        Mockito.when(workbenchPartPresenter.getDefinition()).thenReturn(partDefinition);\n        presenter.addPart(workbenchPartPresenter);\n        boolean hasPart = panelPresenterPanelDefinition.getParts().stream()\n                                                       .filter(part -> part.equals(partDefinition))\n                                                       .findFirst().isPresent();\n        assertTrue(hasPart);\n        verify(placeManager, times(0)).tryClosePlace(any(), any());\n        Mockito.when(view.getParts()).thenReturn(Arrays.asList(partDefinition));\n        presenter.addPart(workbenchPartPresenter);\n        verify(placeManager).tryClosePlace(any(), any());\n    }\n    \n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.panels.DockingWorkbenchPanelView;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.Silent.class)\npublic class SimpleWorkbenchPanelPresenterTest extends AbstractDockingWorkbenchPanelPresenterTest {\n\n    @Mock(name = \"view\")\n    protected DockingWorkbenchPanelView<SimpleWorkbenchPanelPresenter> view;\n    @InjectMocks\n    SimpleWorkbenchPanelPresenter presenter;\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setUp2() {\n        presenter.init();\n        presenter.setDefinition(panelPresenterPanelDefinition);\n    }\n\n    @Override\n    AbstractDockingWorkbenchPanelPresenter<?> getPresenterToTest() {\n        return presenter;\n    }\n\n    @Test\n    public void initShouldBindPresenterToView() {\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void addPartTest() {\n\n        WorkbenchPartPresenter part = mock(WorkbenchPartPresenter.class);\n        when(part.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part);\n\n        verify(view).addPart(any());\n    }\n\n    @Test\n    public void addPartTwiceShouldCloseOtherPartTest() {\n\n        SinglePartPanelHelper singlePartPanelHelper = mock(SinglePartPanelHelper.class);\n\n        SimpleWorkbenchPanelPresenter presenter = new SimpleWorkbenchPanelPresenter(view,\n                                                                                    mock(PerspectiveManager.class),\n                                                                                    placeManager) {\n            SinglePartPanelHelper createSinglePartPanelHelper() {\n                return singlePartPanelHelper;\n            }\n        };\n\n        presenter.init();\n        presenter.setDefinition(panelPresenterPanelDefinition);\n\n        //there is already a part\n        when(singlePartPanelHelper.hasNoParts()).thenReturn(false);\n\n        WorkbenchPartPresenter part2 = mock(WorkbenchPartPresenter.class);\n        when(part2.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part2);\n\n        verify(singlePartPanelHelper).closeFirstPartAndAddNewOne(any(Command.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class SimpleWorkbenchPanelViewTest extends AbstractSimpleWorkbenchPanelViewTest {\n\n    @InjectMocks\n    private SimpleWorkbenchPanelViewUnitTestWrapper view;\n\n    // Not a @Mock or @GwtMock because we want to test the view.init() method\n    private SimpleWorkbenchPanelPresenter presenter;\n\n    @Before\n    public void setup() {\n        super.setup();\n\n        presenter = mock(SimpleWorkbenchPanelPresenter.class);\n\n        view.setup(); // PostConstruct\n        view.init(presenter);\n    }\n\n    @Override\n    protected AbstractDockingWorkbenchPanelView<?> getViewToTest() {\n        return view;\n    }\n\n    @Test\n    public void shouldAddPresenterOnInit() {\n        assertEquals(presenter,\n                     view.getPresenter());\n    }\n\n    @Test\n    public void shouldSetupDragAndDropOnListBar() {\n        verify(listBar).setDndManager(eq(dndManager));\n        verify(listBar).disableDnd();\n        verify(listBar).addSelectionHandler(any(SelectionHandler.class));\n        verify(listBar).addSelectionHandler(any(SelectionHandler.class));\n        verify(listBar).addOnFocusHandler(any(Command.class));\n    }\n\n    @Test\n    public void shouldPropagateResizeWhenAttached() {\n\n        view.forceAttachedState(true);\n        view.setPixelSize(10,\n                          10);\n        view.onResize();\n\n        // unfortunately, setPixelSize() doesn't have any side effects during unit tests so we can't verify the arguments\n        verify(presenter).onResize(any(Integer.class),\n                                   any(Integer.class));\n\n        verify(topLevelWidget).onResize();\n    }\n\n    @Test\n    public void shouldNotPropagateResizeWhenNotAttached() {\n\n        view.forceAttachedState(false);\n        view.setPixelSize(10,\n                          10);\n        view.onResize();\n\n        // unfortunately, setPixelSize() doesn't have any side effects during unit tests so we can't verify the arguments\n        verify(presenter,\n               never()).onResize(any(Integer.class),\n                                 any(Integer.class));\n\n        verify(topLevelWidget).onResize();\n    }\n\n    @Test\n    public void shouldDisableCloseParts() {\n        verify(listBar).disableClosePart();\n        verify(listBar,\n               never()).enableClosePart();\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void shouldOnlyHaveOnePart() {\n        assertEquals(0,\n                     listBar.getPartsSize());\n\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n        assertEquals(1,\n                     listBar.getPartsSize());\n\n        //Second part add is a leak should throw exception\n        getViewToTest().addPart(mock(WorkbenchPartPresenter.View.class));\n        verify(listBar).addPart(any(WorkbenchPartPresenter.View.class));\n        assertEquals(1,\n                     listBar.getPartsSize());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SimpleWorkbenchPanelViewUnitTestWrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\n/**\n * Minor behavioural alterations to\n */\npublic class SimpleWorkbenchPanelViewUnitTestWrapper extends SimpleWorkbenchPanelView {\n\n    private boolean forcedAttachState;\n\n    @Override\n    public boolean isAttached() {\n        return forcedAttachState;\n    }\n\n    public void forceAttachedState(boolean attached) {\n        forcedAttachState = attached;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/SinglePartPanelHelperTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.jgroups.util.Util.assertTrue;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SinglePartPanelHelperTest {\n\n    private SinglePartPanelHelper singlePartHelper;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Test\n    public void thereIsNoPartsTest() {\n\n        singlePartHelper = new SinglePartPanelHelper(new ArrayList<>(),\n                                                     placeManager);\n        assertTrue(singlePartHelper.hasNoParts());\n    }\n\n    @Test\n    public void getPlaceFromFirstPartTest() {\n\n        PlaceRequest place = mock(PlaceRequest.class);\n        PartDefinition part = mock(PartDefinition.class);\n        when(part.getPlace()).thenReturn(place);\n\n        Collection<PartDefinition> parts = Arrays.asList(part);\n        singlePartHelper = new SinglePartPanelHelper(parts,\n                                                     placeManager);\n\n        assertTrue(!singlePartHelper.hasNoParts());\n        assertEquals(place,\n                     singlePartHelper.getPlaceFromFirstPart());\n    }\n\n    @Test\n    public void closeFirstPartAndAddNewOneTest() {\n\n        PlaceRequest place = mock(PlaceRequest.class);\n        PartDefinition part = mock(PartDefinition.class);\n        Command cmd = mock(Command.class);\n\n        when(part.getPlace()).thenReturn(place);\n\n        Collection<PartDefinition> parts = Arrays.asList(part);\n        singlePartHelper = new SinglePartPanelHelper(parts,\n                                                     placeManager);\n\n        singlePartHelper.closeFirstPartAndAddNewOne(cmd);\n        verify(placeManager).tryClosePlace(place,\n                                           cmd);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/StaticWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class StaticWorkbenchPanelPresenterTest {\n\n    @Mock\n    StaticWorkbenchPanelView view;\n    StaticWorkbenchPanelPresenter presenter;\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setup() {\n        presenter = new StaticWorkbenchPanelPresenter(view,\n                                                      mock(PerspectiveManager.class),\n                                                      placeManager);\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n    }\n\n    @Test\n    public void getDefaultChildTypeTest() {\n\n        assertNull(presenter.getDefaultChildType());\n    }\n\n    @Test\n    public void addPartTest() {\n\n        WorkbenchPartPresenter part = mock(WorkbenchPartPresenter.class);\n        when(part.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part);\n\n        verify(view).addPart(any());\n    }\n\n    @Test\n    public void addPartTwiceShouldCloseOtherPartTest() {\n\n        SinglePartPanelHelper singlePartPanelHelper = mock(SinglePartPanelHelper.class);\n\n        StaticWorkbenchPanelPresenter presenter = new StaticWorkbenchPanelPresenter(view,\n                                                                                    mock(PerspectiveManager.class),\n                                                                                    placeManager) {\n            SinglePartPanelHelper createSinglePartPanelHelper() {\n                return singlePartPanelHelper;\n            }\n        };\n\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n\n        //there is already a part\n        when(singlePartPanelHelper.hasNoParts()).thenReturn(false);\n\n        WorkbenchPartPresenter part2 = mock(WorkbenchPartPresenter.class);\n        when(part2.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part2);\n\n        verify(singlePartPanelHelper).closeFirstPartAndAddNewOne(any(Command.class));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/StaticWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Answers;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.panel.StaticFocusedResizePanel;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class StaticWorkbenchPanelViewTest {\n\n    // Not a @Mock or @GwtMock because we want to test the view.init() method\n    private final StaticWorkbenchPanelPresenter presenter = mock(StaticWorkbenchPanelPresenter.class);\n    @InjectMocks\n    private StaticWorkbenchPanelView view;\n    @Mock\n    private PanelManager panelManager;\n\n    @Mock\n    private SelectionEvent<PartDefinition> selectionEvent;\n\n    @Mock(answer = Answers.RETURNS_MOCKS)\n    private StaticFocusedResizePanel panel;\n\n    @Before\n    public void setup() {\n        view.postConstruct();\n        view.init(presenter);\n    }\n\n    @Test\n    public void addPresenterOnInit() {\n        assertEquals(presenter,\n                     view.getPresenter());\n    }\n\n    @Test\n    public void addPartToPanelWhenPartViewIsNull() {\n        WorkbenchPartPresenter.View viewWbPartPresenter = mock(WorkbenchPartPresenter.View.class);\n        when(panel.getPartView()).thenReturn(null);\n\n        view.addPart(viewWbPartPresenter);\n\n        verify(panel).setPart(viewWbPartPresenter);\n    }\n\n    @Test\n    public void removeContainedPart() {\n        WorkbenchPartPresenter mockPresenter = mock(WorkbenchPartPresenter.class);\n        WorkbenchPartPresenter.View mockPartView = mock(WorkbenchPartPresenter.View.class);\n        PartDefinition mockPartDefinition = new PartDefinitionImpl(new DefaultPlaceRequest(\"mockPlace\"));\n\n        when(mockPartView.getPresenter()).thenReturn(mockPresenter);\n        when(mockPresenter.getDefinition()).thenReturn(mockPartDefinition);\n\n        when(view.panel.getPartView()).thenReturn(null);\n        view.addPart(mockPartView);\n        when(view.panel.getPartView()).thenReturn(mockPartView);\n\n        boolean removed = view.removePart(mockPartDefinition);\n\n        assertTrue(removed);\n        verify(panel).clear();\n    }\n\n    @Test\n    public void removeNonContainedPart() {\n        WorkbenchPartPresenter mockPresenter = mock(WorkbenchPartPresenter.class);\n        WorkbenchPartPresenter.View mockPartView = mock(WorkbenchPartPresenter.View.class);\n        PartDefinition mockPartDefinition = new PartDefinitionImpl(new DefaultPlaceRequest(\"mock1\"));\n\n        when(mockPartView.getPresenter()).thenReturn(mockPresenter);\n        when(mockPresenter.getDefinition()).thenReturn(mockPartDefinition);\n\n        WorkbenchPartPresenter mockPresenter2 = mock(WorkbenchPartPresenter.class);\n        WorkbenchPartPresenter.View mockPartView2 = mock(WorkbenchPartPresenter.View.class);\n        PartDefinition mockPartDefinition2 = new PartDefinitionImpl(new DefaultPlaceRequest(\"mock2\"));\n\n        when(mockPartView2.getPresenter()).thenReturn(mockPresenter2);\n        when(mockPresenter2.getDefinition()).thenReturn(mockPartDefinition2);\n\n        when(view.panel.getPartView()).thenReturn(null);\n        view.addPart(mockPartView);\n        when(view.panel.getPartView()).thenReturn(mockPartView);\n\n        boolean removed = view.removePart(mockPartDefinition2);\n\n        assertFalse(removed);\n        verify(panel,\n               never()).clear();\n    }\n\n    @Test\n    public void onResize() {\n        final int width = 42;\n        final int height = 10;\n\n        view.setPixelSize(width,\n                          height);\n\n        view.onResize();\n\n        verify(panel).onResize();\n    }\n\n    @Test\n    public void testOnPartFocus() {\n\n        final PartDefinition selectedItem = mock(PartDefinition.class);\n        final SelectionHandler<PartDefinition> handler = view.getPanelSelectionHandler();\n\n        when(selectionEvent.getSelectedItem()).thenReturn(selectedItem);\n        when(panelManager.getFocusedPart()).thenReturn(null, selectedItem);\n\n        handler.onSelection(selectionEvent);\n        handler.onSelection(selectionEvent); // Calling it twice.\n\n        verify(panelManager).onPartLostFocus();\n        verify(panelManager).onPartFocus(selectedItem);\n    }\n\n    @Test\n    public void getPartsShouldReturnCurrentPart() {\n        assertFalse(view.getParts().isEmpty());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/UnanchoredStaticWorkbenchPanelPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UnanchoredStaticWorkbenchPanelPresenterTest {\n\n    @Mock\n    UnanchoredStaticWorkbenchPanelView view;\n    UnanchoredStaticWorkbenchPanelPresenter presenter;\n    @Mock\n    private PlaceManager placeManager;\n\n    @Before\n    public void setup() {\n        presenter = new UnanchoredStaticWorkbenchPanelPresenter(view,\n                                                                mock(PerspectiveManager.class),\n                                                                placeManager);\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n    }\n\n    @Test\n    public void getDefaultChildTypeTest() {\n\n        assertNull(presenter.getDefaultChildType());\n    }\n\n    @Test\n    public void addPartTest() {\n\n        WorkbenchPartPresenter part = mock(WorkbenchPartPresenter.class);\n        when(part.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part);\n\n        verify(view).addPart(any());\n    }\n\n    @Test\n    public void addPartTwiceShouldCloseOtherPartTest() {\n\n        SinglePartPanelHelper singlePartPanelHelper = mock(SinglePartPanelHelper.class);\n\n        UnanchoredStaticWorkbenchPanelPresenter presenter = new UnanchoredStaticWorkbenchPanelPresenter(view,\n                                                                                                        mock(PerspectiveManager.class),\n                                                                                                        placeManager) {\n            SinglePartPanelHelper createSinglePartPanelHelper() {\n                return singlePartPanelHelper;\n            }\n        };\n\n        presenter.init();\n        presenter.setDefinition(new PanelDefinitionImpl());\n\n        //there is already a part\n        when(singlePartPanelHelper.hasNoParts()).thenReturn(false);\n\n        WorkbenchPartPresenter part2 = mock(WorkbenchPartPresenter.class);\n        when(part2.getDefinition()).thenReturn(mock(PartDefinition.class));\n\n        presenter.addPart(part2);\n\n        verify(singlePartPanelHelper).closeFirstPartAndAddNewOne(any(Command.class));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/impl/UnanchoredStaticWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.impl;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UnanchoredStaticWorkbenchPanelViewTest {\n\n    private UnanchoredStaticWorkbenchPanelView view;\n\n    @Test\n    public void getPartsShouldReturnCurrentPartDefinition() {\n        view = new UnanchoredStaticWorkbenchPanelView() {\n            @Override\n            PartDefinition getCurrentPartDefinition() {\n                return mock(PartDefinition.class);\n            }\n        };\n\n        assertFalse(view.getParts().isEmpty());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/panels/support/PartManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.workbench.panels.support;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.jgroups.util.Util.assertEquals;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PartManagerTest {\n\n    private PartManager partManager;\n\n    @Test\n    public void getPartsShouldReturnCurrentWidgets() {\n        partManager = new PartManager();\n\n        partManager.registerPart(mock(PartDefinition.class),\n                                 mock(Widget.class));\n        partManager.registerPart(mock(PartDefinition.class),\n                                 mock(Widget.class));\n\n        assertEquals(2,\n                     partManager.getParts().size());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/dnd/CompassDropControllerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport com.allen_sauer.gwt.dnd.client.DragContext;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.client.mvp.UIPart;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class CompassDropControllerTest {\n\n    private CompassDropControllerUnitTestWrapper compassDropController;\n\n    @GwtMock\n    private WorkbenchPanelView view;\n\n    @GwtMock\n    private WorkbenchDragAndDropManager dndManager;\n    @GwtMock\n    private PanelManager panelManager;\n\n    @Before\n    public void setup() {\n        compassDropController = new CompassDropControllerUnitTestWrapper();\n        compassDropController.setupMocks(dndManager,\n                                         panelManager);\n    }\n\n    @Test\n    public void setupTest() {\n        compassDropController.setup(view);\n        assertEquals(view,\n                     compassDropController.dropTarget);\n    }\n\n    @Test\n    public void compassDelegationTest() {\n        CompassWidget compass = compassDropController.compass;\n\n        DragContext dragContext = mock(DragContext.class);\n\n        compassDropController.onEnter(dragContext);\n        verify(compass).onEnter(dragContext);\n\n        compassDropController.onLeave(dragContext);\n        verify(compass).onLeave(dragContext);\n\n        compassDropController.onMove(dragContext);\n        verify(compass).onMove(dragContext);\n    }\n\n    @Test\n    public void onDropDoesNothing() {\n        //Mock If not dropTarget has been identified do nothing\n        compassDropController.mockDropTargetPositionNone();\n\n        DragContext dragContext = mock(DragContext.class);\n        compassDropController.onDrop(dragContext);\n\n        verify(compassDropController.compass,\n               never()).onDrop(dragContext);\n    }\n\n    @Test\n    public void onDropNoEffect() {\n        compassDropController.mockDropTargetPosition(CompassPosition.SELF);\n\n        compassDropController.mockSamePositionDrag(view);\n\n        DragContext dragContext = mock(DragContext.class);\n\n        compassDropController.onDrop(dragContext);\n\n        verify(panelManager,\n               never()).addWorkbenchPanel(any(),\n                                          any(),\n                                          any(),\n                                          any(),\n                                          any(),\n                                          any());\n    }\n\n    @Test\n    public void onDropHappens() {\n        compassDropController.mockDropTargetPosition(CompassPosition.WEST);\n\n        compassDropController.mockSamePositionDrag(view);\n\n        DragContext dragContext = mock(DragContext.class);\n\n        compassDropController.onDrop(dragContext);\n\n        verify(panelManager).addWorkbenchPanel(any(),\n                                               any(),\n                                               any(),\n                                               any(),\n                                               any(),\n                                               any());\n\n        verify(panelManager).addWorkbenchPart(any(),\n                                              any(),\n                                              any(),\n                                              any(),\n                                              any(),\n                                              any(),\n                                              isNull(),\n                                              isNull());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/dnd/CompassDropControllerUnitTestWrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\n\nimport static org.mockito.Mockito.*;\n\npublic class CompassDropControllerUnitTestWrapper extends CompassDropController {\n\n    WorkbenchDragContext workDragContextMock;\n    PanelDefinition positionMock;\n\n    public void setupMocks(WorkbenchDragAndDropManager dndManager,\n                           PanelManager panelManager) {\n        this.dndManager = dndManager;\n        this.panelManager = panelManager;\n        workDragContextMock = mock(WorkbenchDragContext.class);\n\n        when(dndManager.getWorkbenchContext()).thenReturn(workDragContextMock);\n        this.compass = mock(CompassWidget.class);\n    }\n\n    @Override\n    void firePartDroppedEvent(PlaceRequest place) {\n\n    }\n\n    public void mockDropTargetPositionNone() {\n        when(this.compass.getDropPosition()).thenReturn(CompassPosition.NONE);\n    }\n\n    public void mockDropTargetPosition(Position position) {\n        when(this.compass.getDropPosition()).thenReturn(position);\n    }\n\n    public void mockSamePositionDrag(WorkbenchPanelView dropTarget) {\n        this.dropTarget = dropTarget;\n        positionMock = mock(PanelDefinition.class);\n\n        when(workDragContextMock.getSourcePanel()).thenReturn(positionMock);\n        when(dropTarget.getPresenter()).thenReturn(mock(WorkbenchPanelPresenter.class));\n        WorkbenchPanelPresenter presenter = dropTarget.getPresenter();\n        when(presenter.getDefinition()).thenReturn(positionMock);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/dnd/WorkbenchDragAndDropManagerTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport com.allen_sauer.gwt.dnd.client.drop.DropController;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mockito;\nimport org.uberfire.client.workbench.BeanFactory;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelView;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchDragAndDropManagerTest {\n\n    private WorkbenchDragAndDropManagerUnitTestWrapper wrapper;\n\n    @GwtMock\n    private WorkbenchPanelView workbenchPanelView;\n\n    @GwtMock\n    private WorkbenchPickupDragController dragController;\n\n    @GwtMock\n    private DropController dropController;\n\n    @GwtMock\n    private BeanFactory factory;\n\n    @Before\n    public void setup() {\n        wrapper = new WorkbenchDragAndDropManagerUnitTestWrapper();\n        wrapper.setupMocks(dragController,\n                           factory);\n    }\n\n    @Test\n    public void assertMakeDraggableDelegation() {\n        wrapper.makeDraggable(mock(IsWidget.class),\n                              mock(IsWidget.class));\n        verify(dragController).makeDraggable(any(),\n                                             any());\n    }\n\n    @Test\n    public void registerAndUnregisterDropController() {\n        wrapper.registerDropController(workbenchPanelView,\n                                       dropController);\n        assertEquals(wrapper.dropControllerMap.get(workbenchPanelView),\n                     dropController);\n        verify(dragController).registerDropController(dropController);\n\n        wrapper.unregisterDropController(workbenchPanelView);\n        verify(dragController).unregisterDropController(dropController);\n        verify(factory).destroy(dropController);\n    }\n\n    @Test\n    public void registerAndUnregisterDropControllers() {\n        wrapper.registerDropController(workbenchPanelView,\n                                       dropController);\n        assertEquals(wrapper.dropControllerMap.get(workbenchPanelView),\n                     dropController);\n\n        WorkbenchPanelView workbenchPanelView2 = GWT.create(WorkbenchPanelView.class);\n        DropController dropController2 = GWT.create(DropController.class);\n\n        wrapper.registerDropController(workbenchPanelView2,\n                                       dropController2);\n        assertEquals(wrapper.dropControllerMap.get(workbenchPanelView2),\n                     dropController2);\n\n        wrapper.unregisterDropControllers();\n        verify(factory,\n               Mockito.times(1)).destroy(dropController);\n        verify(factory,\n               Mockito.times(1)).destroy(dropController2);\n        verify(dragController).unregisterDropController(dropController);\n        verify(dragController).unregisterDropController(dropController2);\n        assertTrue(wrapper.dropControllerMap.isEmpty());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/dnd/WorkbenchDragAndDropManagerUnitTestWrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.dnd;\n\nimport org.uberfire.client.workbench.BeanFactory;\n\npublic class WorkbenchDragAndDropManagerUnitTestWrapper extends WorkbenchDragAndDropManager {\n\n    public void setupMocks(WorkbenchPickupDragController dragController,\n                           BeanFactory factory) {\n        this.dragController = dragController;\n        this.factory = factory;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarPresenterTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertFalse;\nimport static org.junit.Assert.assertSame;\nimport static org.junit.Assert.assertTrue;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMenuBarPresenterTest {\n\n    private static final String NAME = \"testName\";\n    private static final String PERSPECTIVE_ID = \"perspectiveId\";\n    private static final String SECOND_PERSPECTIVE_ID = \"secondPerspectiveId\";\n    private static final String THIRD_PERSPECTIVE_ID = \"thirdPerspectiveId\";\n\n    @Mock\n    protected AuthorizationManager authzManager;\n    @Mock\n    protected User identity;\n    @Mock\n    private PerspectiveManager perspectiveManager;\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private WorkbenchMenuBarPresenter.View view;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @InjectMocks\n    private WorkbenchMenuBarPresenter presenter;\n\n    @Test\n    public void testAddCurrentPerspective() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n\n        when(perspectiveActivity.getPlace()).thenReturn(placeRequest);\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(view).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testAddPerspective() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(\"anyId\");\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n\n        when(perspectiveActivity.getPlace()).thenReturn(placeRequest);\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n\n        verify(view,\n               never()).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testPerspectiveChangeEvent() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        final PerspectiveChange perspectiveChange = new PerspectiveChange(placeRequest,\n                                                                          null,\n                                                                          null,\n                                                                          PERSPECTIVE_ID);\n\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n        presenter.onPerspectiveChange(perspectiveChange);\n\n        verify(view).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testAddMenuWithPermission() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n\n        verify(authzManager).authorize(menus.getItems().get(0),\n                                       identity);\n        verify(view).addMenuItem(eq(PERSPECTIVE_ID),\n                                 eq(NAME),\n                                 isNull(String.class),\n                                 any(Command.class),\n                                 any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddMenuWithoutPermission() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(false);\n\n        presenter.addMenus(menus);\n\n        verify(authzManager).authorize(menus.getItems().get(0),\n                                       identity);\n        verify(view,\n               never()).addMenuItem(eq(PERSPECTIVE_ID),\n                                    eq(NAME),\n                                    isNull(String.class),\n                                    any(Command.class),\n                                    any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddContextMenuWithPermission() {\n        final MenuPosition position = MenuPosition.LEFT;\n        final Menus contextMenus = MenuFactory.newSimpleItem(NAME).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(PERSPECTIVE_ID);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            PERSPECTIVE_ID));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(view).clearContextMenu();\n        verify(view).addContextMenuItem(eq(PERSPECTIVE_ID),\n                                        anyString(),\n                                        eq(NAME),\n                                        isNull(),\n                                        any(),\n                                        eq(position));\n    }\n\n    @Test\n    public void testAddContextMenuWithoutPermission() {\n        final Menus contextMenus = MenuFactory.newSimpleItem(NAME).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(PERSPECTIVE_ID);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(false);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            PERSPECTIVE_ID));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(view).clearContextMenu();\n        verify(view,\n               never()).addContextMenuItem(anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           any(Command.class),\n                                           any(MenuPosition.class));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemCommand() {\n        final Command command = mock(Command.class);\n        final Menus menus = MenuFactory.newSimpleItem(NAME).respondsWith(command).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(view).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(view, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(view).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemPlace() {\n        final PlaceRequest place = mock(PlaceRequest.class);\n        final Menus menus = MenuFactory.newSimpleItem(NAME).place(place).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(view).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(view, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(view).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemPerspective() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(view).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(view, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(view).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableContextMenuItem() {\n        final Menus contextMenus = MenuFactory.newSimpleItem(NAME).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(PERSPECTIVE_ID);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            PERSPECTIVE_ID));\n        verify(view).enableContextMenuItem(anyString(), eq(true));\n\n        contextMenus.getItems().get(0).setEnabled(true);\n        verify(view, times(2)).enableContextMenuItem(anyString(), eq(true));\n\n        contextMenus.getItems().get(0).setEnabled(false);\n        verify(view).enableContextMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testMenuInsertionOrder() {\n        final Menus firstMenus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final Menus secondMenus = MenuFactory.newSimpleItem(NAME).orderAll(1).perspective(SECOND_PERSPECTIVE_ID).endMenu().build();\n        final Menus thirdMenus = MenuFactory.newSimpleItem(NAME).orderAll(2).perspective(THIRD_PERSPECTIVE_ID).endMenu().build();\n\n        when(authzManager.authorize(firstMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(authzManager.authorize(secondMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(authzManager.authorize(thirdMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(thirdMenus);\n        presenter.addMenus(firstMenus);\n        presenter.addMenus(secondMenus);\n\n        assertEquals(3,\n                     presenter.getAddedMenus().size());\n        assertSame(firstMenus,\n                   presenter.getAddedMenus().get(0));\n        assertSame(secondMenus,\n                   presenter.getAddedMenus().get(1));\n        assertSame(thirdMenus,\n                   presenter.getAddedMenus().get(2));\n    }\n\n    @Test\n    public void testAddMenusWithExperimentalPerspective() {\n\n        when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true);\n\n        List<MenuItem> items = new ArrayList<>();\n\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n\n        final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build();\n\n        when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString()))\n                .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0]));\n\n        presenter.addMenus(menus);\n\n        verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString());\n        verify(view, times(2)).setMenuItemVisible(anyString(), eq(true));\n        verify(view).setMenuItemVisible(anyString(), eq(false));\n    }\n\n    @Test\n    public void testShowHideExperimentalPerspectiveMenus() {\n        testAddMenusWithExperimentalPerspective();\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false));\n        verify(view).setMenuItemVisible(PERSPECTIVE_ID, false);\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true));\n        verify(view).setMenuItemVisible(SECOND_PERSPECTIVE_ID, true);\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false));\n        verify(view).setMenuItemVisible(THIRD_PERSPECTIVE_ID, false);\n    }\n\n    @Test\n    public void testView() {\n        assertEquals(view,\n                     presenter.getView());\n    }\n\n    @Test\n    public void testCollapse() {\n        presenter.collapse();\n\n        assertFalse(presenter.isUseExpandedMode());\n        verify(view).collapse();\n    }\n\n    @Test\n    public void testExpand() {\n        presenter.expand();\n\n        assertTrue(presenter.isUseExpandedMode());\n        verify(view).expand();\n    }\n\n    @Test\n    public void testAddCollapseHandler() {\n        final Command command = mock(Command.class);\n\n        presenter.addCollapseHandler(command);\n\n        verify(view).addCollapseHandler(command);\n    }\n\n    @Test\n    public void testExpandHandler() {\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                ((Command) invocation.getArguments()[0]).execute();\n                return null;\n            }\n        }).when(view).addExpandHandler(any(Command.class));\n\n        presenter.setup();\n\n        assertTrue(presenter.isExpanded());\n    }\n\n    @Test\n    public void testCollapseHandler() {\n        doAnswer(new Answer() {\n            @Override\n            public Object answer(InvocationOnMock invocation) throws Throwable {\n                ((Command) invocation.getArguments()[0]).execute();\n                return null;\n            }\n        }).when(view).addCollapseHandler(any(Command.class));\n\n        presenter.setup();\n\n        assertFalse(presenter.isExpanded());\n    }\n\n    @Test\n    public void testAddExpandHandler() {\n        final Command command = mock(Command.class);\n\n        presenter.addExpandHandler(command);\n\n        verify(view).addExpandHandler(command);\n    }\n\n    @Test\n    public void testClear() {\n        presenter.clear();\n\n        verify(view).clear();\n    }\n\n    @Test\n    public void testOnPlaceMaximized() {\n        presenter.onPlaceMaximized(mock(PlaceMaximizedEvent.class));\n\n        verify(view).collapse();\n    }\n\n    @Test\n    public void testOnPlaceMinimized() {\n        presenter.onPlaceMinimized(mock(PlaceMinimizedEvent.class));\n\n        verify(view).expand();\n    }\n\n    @Test\n    public void testOnPlaceMinimizedExpandMode() {\n        presenter.collapse();\n        presenter.onPlaceMinimized(mock(PlaceMinimizedEvent.class));\n\n        verify(view,\n               never()).expand();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarProducerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMenuBarProducerTest {\n\n    @Mock\n    private AuthorizationManager authzManager;\n\n    @Mock\n    private PerspectiveManager perspectiveManager;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private WorkbenchMenuBarPresenter.View view;\n\n    @Mock\n    private WorkbenchMenuBarPresenter defaultPresenter;\n\n    @Mock\n    private WorkbenchMenuBarStandalonePresenter standalonePresenter;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    @Mock\n    private PerspectiveChange perspectiveChangeEvent;\n\n    @Mock\n    private PlaceMaximizedEvent placeMaximizedEvent;\n\n    @Mock\n    private PlaceMinimizedEvent placeMinimizedEvent;\n\n    private WorkbenchMenuBarProducer producer;\n    private boolean isStandalone = false;\n\n    @Before\n    public void setup() {\n        producer = new WorkbenchMenuBarProducer(authzManager,\n                                                perspectiveManager,\n                                                placeManager,\n                                                activityManager,\n                                                identity,\n                                                experimentalActivitiesAuthorizationManager, view\n        ) {\n            @Override\n            protected boolean isStandalone() {\n                return isStandalone;\n            }\n\n            @Override\n            protected WorkbenchMenuBarPresenter makeDefaultPresenter() {\n                return defaultPresenter;\n            }\n\n            @Override\n            protected WorkbenchMenuBarPresenter makeStandalonePresenter() {\n                return standalonePresenter;\n            }\n        };\n    }\n\n    @Test\n    public void menuBarPresenterInstantiationDefaultMode() {\n        assertMenuBarPresenter(false,\n                               WorkbenchMenuBarPresenter.class);\n    }\n\n    @Test\n    public void menuBarPresenterInstantiationStandaloneMode() {\n        assertMenuBarPresenter(true,\n                               WorkbenchMenuBarStandalonePresenter.class);\n    }\n\n    @Test\n    public void checkObservedEventsCallsPresenterDefaultMode() {\n        final WorkbenchMenuBarPresenter presenter = getMenuBarPresenter(false);\n        assertMenuBarEvents(presenter);\n    }\n\n    @Test\n    public void checkObservedEventsCallsPresenterStandaloneMode() {\n        final WorkbenchMenuBarPresenter presenter = getMenuBarPresenter(true);\n        assertMenuBarEvents(presenter);\n    }\n\n    @Test\n    public void testNotifyVisibilityChange() {\n        testNotifyVisibilityChange(false);\n    }\n\n    @Test\n    public void testNotifyVisibilityChangeStandaloneMode() {\n        testNotifyVisibilityChange(true);\n    }\n\n    private void testNotifyVisibilityChange(boolean isStandalone) {\n        final WorkbenchMenuBarPresenter presenter = getMenuBarPresenter(isStandalone);\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(\"perspectiveId\", false));\n\n        verify(presenter).onPerspectiveVisibilityChange(any());\n    }\n\n    private void assertMenuBarPresenter(final boolean isStandalone,\n                                        final Class expectedPresenterType) {\n        final WorkbenchMenuBarPresenter presenter = getMenuBarPresenter(isStandalone);\n        assertEquals(extractContainingClassName(expectedPresenterType.getName()),\n                     extractContainingClassName(presenter.getClass().getName()));\n    }\n\n    private void assertMenuBarEvents(final WorkbenchMenuBarPresenter presenter) {\n        presenter.onPerspectiveChange(perspectiveChangeEvent);\n        verify(presenter).onPerspectiveChange(eq(perspectiveChangeEvent));\n\n        presenter.onPlaceMaximized(placeMaximizedEvent);\n        verify(presenter).onPlaceMaximized(eq(placeMaximizedEvent));\n\n        presenter.onPlaceMinimized(placeMinimizedEvent);\n        verify(presenter).onPlaceMinimized(eq(placeMinimizedEvent));\n    }\n\n    private WorkbenchMenuBarPresenter getMenuBarPresenter(final boolean isStandalone) {\n        this.isStandalone = isStandalone;\n        return producer.getWorbenchMenu();\n    }\n\n    private String extractContainingClassName(final String className) {\n        if (className.contains(\"$\")) {\n            return className.substring(0,\n                                       className.indexOf(\"$\"));\n        }\n        return className;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/WorkbenchMenuBarStandalonePresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu;\n\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMenuBarStandalonePresenterTest {\n\n    @Mock\n    protected AuthorizationManager authzManager;\n    @Mock\n    protected User identity;\n    @Mock\n    private PerspectiveManager perspectiveManager;\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private WorkbenchMenuBarPresenter.View view;\n\n    @InjectMocks\n    private WorkbenchMenuBarStandalonePresenter presenter;\n\n    @Test\n    public void testAddMenus() {\n        final String perspectiveId = \"perspectiveId\";\n        final String label = \"perspectiveLabel\";\n        final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();\n\n        presenter.addMenus(menus);\n\n        verify(authzManager,\n               never()).authorize(any(MenuItem.class),\n                                  any(User.class));\n        verify(view,\n               never()).addMenuItem(anyString(),\n                                    anyString(),\n                                    anyString(),\n                                    any(Command.class),\n                                    any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddContextMenus() {\n        final String perspectiveId = \"perspectiveId\";\n        final String contextLabel = \"contextLabel\";\n        final Menus contextMenus = MenuFactory.newSimpleItem(contextLabel).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            perspectiveId));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(view).addMenuItem(anyString(),\n                                 eq(contextLabel),\n                                 isNull(String.class),\n                                 isNull(Command.class),\n                                 eq(MenuPosition.LEFT));\n\n        verify(view,\n               never()).clearContextMenu();\n        verify(view,\n               never()).addContextMenuItem(anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           any(Command.class),\n                                           any(MenuPosition.class));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.CanBeDisabled;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.HasChildren;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertSame;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.reset;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMegaMenuPresenterTest {\n\n    private static final String NAME = \"testName\";\n    private static final String PERSPECTIVE_ID = \"perspectiveId\";\n    private static final String SECOND_PERSPECTIVE_ID = \"secondPerspectiveId\";\n    private static final String THIRD_PERSPECTIVE_ID = \"thirdPerspectiveId\";\n\n    @Mock\n    protected AuthorizationManager authzManager;\n\n    @Mock\n    private PerspectiveManager perspectiveManager;\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    protected User identity;\n\n    @Mock\n    private ManagedInstance<MegaMenuBrand> megaMenuBrands;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n\n    @Mock\n    private Workbench workbench;\n\n    @Mock\n    private WorkbenchMegaMenuPresenter.View view;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    private WorkbenchMegaMenuPresenter presenter;\n\n    @Before\n    public void setup() {\n        doReturn(true).when(megaMenuBrands).isUnsatisfied();\n        presenter = spy(new WorkbenchMegaMenuPresenter(authzManager,\n                                                       perspectiveManager,\n                                                       activityManager,\n                                                       identity,\n                                                       view,\n                                                       megaMenuBrands,\n                                                       placeManager,\n                                                       authorizationManager,\n                                                       sessionInfo,\n                                                       childMenuItemPresenters,\n                                                       groupMenuItemPresenters,\n                                                       childContextMenuItemPresenters,\n                                                       groupContextMenuItemPresenters,\n                                                       workbench,\n                                                       experimentalActivitiesAuthorizationManager));\n        reset(view);\n        presenter.selectableMenuItemByIdentifier = spy(new HashMap<>());\n        presenter.hasChildrenMenuItemByIdentifier = spy(new HashMap<>());\n        presenter.canBeDisabledMenuItemByIdentifier = spy(new HashMap<>());\n        presenter.canHideMenuItemByIdentifier = spy(new HashMap<>());\n\n        doReturn(mock(ChildMenuItemPresenter.class)).when(childMenuItemPresenters).get();\n        doReturn(mock(GroupMenuItemPresenter.class)).when(groupMenuItemPresenters).get();\n        doReturn(mock(ChildContextMenuItemPresenter.class)).when(childContextMenuItemPresenters).get();\n    }\n\n    @Test\n    public void testAddCurrentPerspective() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n\n        when(perspectiveActivity.getPlace()).thenReturn(placeRequest);\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(presenter).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testAddPerspective() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(\"anyId\");\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n\n        when(perspectiveActivity.getPlace()).thenReturn(placeRequest);\n        when(perspectiveManager.getCurrentPerspective()).thenReturn(perspectiveActivity);\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n\n        verify(presenter,\n               never()).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testPerspectiveChangeEvent() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        final PlaceRequest placeRequest = new DefaultPlaceRequest(PERSPECTIVE_ID);\n        final PerspectiveActivity perspectiveActivity = mock(PerspectiveActivity.class);\n        final PerspectiveChange perspectiveChange = new PerspectiveChange(placeRequest,\n                                                                          null,\n                                                                          null,\n                                                                          PERSPECTIVE_ID);\n\n        when(authzManager.authorize(any(Resource.class),\n                                    eq(identity))).thenReturn(true);\n\n        presenter.addMenus(menus);\n        presenter.onPerspectiveChange(perspectiveChange);\n\n        verify(presenter).selectMenuItem(PERSPECTIVE_ID);\n    }\n\n    @Test\n    public void testAddMenuWithPermission() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n\n        verify(authzManager).authorize(menus.getItems().get(0),\n                                       identity);\n        verify(presenter).addMenuItem(eq(PERSPECTIVE_ID),\n                                      eq(NAME),\n                                      isNull(String.class),\n                                      any(Command.class),\n                                      any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddMenuWithoutPermission() {\n        final Menus menus = MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build();\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(false);\n\n        presenter.addMenus(menus);\n\n        verify(authzManager).authorize(menus.getItems().get(0),\n                                       identity);\n        verify(presenter,\n               never()).addMenuItem(eq(PERSPECTIVE_ID),\n                                    eq(NAME),\n                                    isNull(String.class),\n                                    any(Command.class),\n                                    any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddContextMenuWithPermission() {\n        final MenuPosition position = MenuPosition.LEFT;\n        final Menus contextMenus = MenuFactory.newSimpleItem(NAME).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(PERSPECTIVE_ID);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            PERSPECTIVE_ID));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(view).clearContextMenu();\n        verify(presenter).addContextMenuItem(eq(PERSPECTIVE_ID),\n                                             anyString(),\n                                             eq(NAME),\n                                             isNull(),\n                                             any(),\n                                             eq(position));\n    }\n\n    @Test\n    public void testAddContextMenuWithoutPermission() {\n        final Menus contextMenus = MenuFactory.newSimpleItem(NAME).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(PERSPECTIVE_ID);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(false);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            PERSPECTIVE_ID));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(view).clearContextMenu();\n        verify(presenter,\n               never()).addContextMenuItem(anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           any(Command.class),\n                                           any(MenuPosition.class));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemCommand() {\n        final String label = \"command\";\n        final Command command = mock(Command.class);\n        final Menus menus = MenuFactory.newSimpleItem(label).respondsWith(command).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n\n        verify(presenter).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(presenter, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(presenter).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemPlace() {\n        final String label = \"placeLabel\";\n        final PlaceRequest place = mock(PlaceRequest.class);\n        final Menus menus = MenuFactory.newSimpleItem(label).place(place).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(presenter).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(presenter, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(presenter).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableMenuItemPerspective() {\n        final String label = \"perspectiveLabel\";\n        final String perspectiveId = \"perspectiveId\";\n        final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();\n\n        when(authzManager.authorize(menus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(menus);\n        verify(presenter).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(true);\n        verify(presenter, times(2)).enableMenuItem(anyString(), eq(true));\n\n        menus.getItems().get(0).setEnabled(false);\n        verify(presenter).enableMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testSetupEnableDisableContextMenuItem() {\n        final String contextLabel = \"contextLabel\";\n        final String perspectiveId = \"perspectiveId\";\n        final Menus contextMenus = MenuFactory.newSimpleItem(contextLabel).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        when(activity.getIdentifier()).thenReturn(perspectiveId);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            perspectiveId));\n        verify(presenter).enableContextMenuItem(anyString(), eq(true));\n\n        contextMenus.getItems().get(0).setEnabled(true);\n        verify(presenter, times(2)).enableContextMenuItem(anyString(), eq(true));\n\n        contextMenus.getItems().get(0).setEnabled(false);\n        verify(presenter).enableContextMenuItem(anyString(), eq(false));\n    }\n\n    @Test\n    public void testMenuInsertionOrder() {\n        final String perspectiveId = \"perspectiveId\";\n        final String label = \"perspectiveLabel\";\n        final Menus firstMenus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();\n        final Menus secondMenus = MenuFactory.newSimpleItem(label).orderAll(1).perspective(perspectiveId).endMenu().build();\n        final Menus thirdMenus = MenuFactory.newSimpleItem(label).orderAll(2).perspective(perspectiveId).endMenu().build();\n\n        when(authzManager.authorize(firstMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(authzManager.authorize(secondMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(authzManager.authorize(thirdMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n\n        presenter.addMenus(thirdMenus);\n        presenter.addMenus(firstMenus);\n        presenter.addMenus(secondMenus);\n\n        assertEquals(3,\n                     presenter.getAddedMenus().size());\n        assertSame(firstMenus,\n                   presenter.getAddedMenus().get(0));\n        assertSame(secondMenus,\n                   presenter.getAddedMenus().get(1));\n        assertSame(thirdMenus,\n                   presenter.getAddedMenus().get(2));\n    }\n\n    @Test\n    public void testView() {\n        assertEquals(view,\n                     presenter.getView());\n    }\n\n    @Test\n    public void testClear() {\n        presenter.clear();\n\n        verify(view).clear();\n    }\n\n    @Test(expected = RuntimeException.class)\n    public void setupWithMoreThanOneMegaMenuBrandImplementationTest() {\n        doReturn(true).when(megaMenuBrands).isAmbiguous();\n\n        presenter.setup();\n    }\n\n    @Test\n    public void setupWithNoMegaMenuBrandImplementationTest() {\n        doReturn(true).when(megaMenuBrands).isUnsatisfied();\n\n        presenter.setup();\n\n        verify(view).hideBrand();\n    }\n\n    @Test\n    public void setupWithOneEmptyMegaMenuBrandImplementationTest() {\n        doReturn(false).when(megaMenuBrands).isAmbiguous();\n        doReturn(false).when(megaMenuBrands).isUnsatisfied();\n\n        final MegaMenuBrandMock megaMenuBrand = new MegaMenuBrandMock(\"\",\n                                                                      \"\",\n                                                                      \"\");\n        doReturn(megaMenuBrand).when(megaMenuBrands).get();\n        doReturn(\"defaultMenuText\").when(view).getDefaultMenuText();\n\n        presenter.setup();\n\n        verify(view,\n               never()).setBrandImage(anyString());\n        verify(view,\n               never()).setBrandImageTitle(anyString());\n        verify(view).hideBrand();\n        verify(view).setMenuAccessorText(view.getDefaultMenuText());\n    }\n\n    @Test\n    public void setupWithOneMegaMenuBrandImplementationTest() {\n        doReturn(false).when(megaMenuBrands).isAmbiguous();\n        doReturn(false).when(megaMenuBrands).isUnsatisfied();\n\n        final MegaMenuBrandMock megaMenuBrand = new MegaMenuBrandMock(\"brandImageUrl\",\n                                                                      \"brandImageLabel\",\n                                                                      \"menuAccessorLabel\");\n        doReturn(megaMenuBrand).when(megaMenuBrands).get();\n        doReturn(\"defaultMenuText\").when(view).getDefaultMenuText();\n\n        presenter.setup();\n\n        verify(view).setBrandImage(megaMenuBrand.brandImageUrl());\n        verify(view).setBrandImageTitle(megaMenuBrand.brandImageLabel());\n        verify(view,\n               never()).hideBrand();\n        verify(view).setMenuAccessorText(megaMenuBrand.menuAccessorLabel());\n    }\n\n    @Test\n    public void addMenuItemWithParentTest() {\n        final ChildMenuItemPresenter childMenuItemPresenter = mock(ChildMenuItemPresenter.class);\n        doReturn(childMenuItemPresenter).when(childMenuItemPresenters).get();\n        final HasChildren parent = mock(HasChildren.class);\n        presenter.hasChildrenMenuItemByIdentifier.put(\"parentId\",\n                                                      parent);\n\n        presenter.addMenuItem(\"id\",\n                              \"label\",\n                              \"parentId\",\n                              mock(Command.class),\n                              MenuPosition.LEFT);\n\n        verify(childMenuItemPresenter).setup(eq(\"label\"),\n                                             any());\n        verify(presenter.selectableMenuItemByIdentifier).put(\"id\",\n                                                             childMenuItemPresenter);\n        verify(presenter.canBeDisabledMenuItemByIdentifier).put(\"id\",\n                                                                childMenuItemPresenter);\n        verify(view).addMenuItemOnParent(childMenuItemPresenter,\n                                         parent);\n    }\n\n    @Test\n    public void addMenuItemOnTheRightWithoutParentTest() {\n        final ChildMenuItemPresenter childMenuItemPresenter = mock(ChildMenuItemPresenter.class);\n        doReturn(childMenuItemPresenter).when(childMenuItemPresenters).get();\n\n        presenter.addMenuItem(\"id\",\n                              \"label\",\n                              null,\n                              mock(Command.class),\n                              MenuPosition.RIGHT);\n\n        verify(childMenuItemPresenter).setup(eq(\"label\"),\n                                             any());\n        verify(presenter.selectableMenuItemByIdentifier).put(\"id\",\n                                                             childMenuItemPresenter);\n        verify(presenter.canBeDisabledMenuItemByIdentifier).put(\"id\",\n                                                                childMenuItemPresenter);\n        verify(view).addMenuItemOnRight(childMenuItemPresenter);\n    }\n\n    @Test\n    public void addMenuItemOnTheLeftWithoutParentTest() {\n        final ChildMenuItemPresenter childMenuItemPresenter = mock(ChildMenuItemPresenter.class);\n        doReturn(childMenuItemPresenter).when(childMenuItemPresenters).get();\n\n        presenter.addMenuItem(\"id\",\n                              \"label\",\n                              null,\n                              mock(Command.class),\n                              MenuPosition.LEFT);\n\n        verify(childMenuItemPresenter).setup(eq(\"label\"),\n                                             any());\n        verify(presenter.selectableMenuItemByIdentifier).put(\"id\",\n                                                             childMenuItemPresenter);\n        verify(presenter.canBeDisabledMenuItemByIdentifier).put(\"id\",\n                                                                childMenuItemPresenter);\n        verify(view).addMenuItemOnLeft(childMenuItemPresenter);\n    }\n\n    @Test\n    public void addCustomIsElementMenuItemTest() {\n        final IsElement menu = mock(IsElement.class);\n        presenter.addCustomMenuItem(menu,\n                                    MenuPosition.RIGHT);\n\n        verify(view).addCustomMenuItem(menu);\n    }\n\n    @Test\n    public void addCustomIsWidgetMenuItemTest() {\n        final IsWidget menu = mock(IsWidget.class);\n        presenter.addCustomMenuItem(menu,\n                                    MenuPosition.RIGHT);\n\n        verify(view).addCustomMenuItem(menu);\n    }\n\n    @Test\n    public void addGroupMenuItemTest() {\n        final GroupMenuItemPresenter groupMenuItemPresenter = mock(GroupMenuItemPresenter.class);\n        doReturn(groupMenuItemPresenter).when(groupMenuItemPresenters).get();\n\n        presenter.addGroupMenuItem(\"id\",\n                                   \"label\",\n                                   MenuPosition.LEFT);\n\n        verify(groupMenuItemPresenter).setup(eq(\"label\"));\n        verify(presenter.hasChildrenMenuItemByIdentifier).put(\"id\",\n                                                              groupMenuItemPresenter);\n        verify(view).addGroupMenuItem(groupMenuItemPresenter);\n    }\n\n    @Test\n    public void addContextMenuItemTest() {\n        final ChildContextMenuItemPresenter childContextMenuItemPresenter = mock(ChildContextMenuItemPresenter.class);\n        doReturn(childContextMenuItemPresenter).when(childContextMenuItemPresenters).get();\n        final HasChildren parent = mock(HasChildren.class);\n        presenter.hasChildrenMenuItemByIdentifier.put(\"parentId\",\n                                                      parent);\n\n        presenter.addContextMenuItem(\"menuItemId\",\n                                     \"id\",\n                                     \"label\",\n                                     \"parentId\",\n                                     mock(Command.class),\n                                     MenuPosition.LEFT);\n\n        verify(childContextMenuItemPresenter).setup(eq(\"label\"),\n                                                    any());\n        verify(presenter.selectableMenuItemByIdentifier).put(\"id\",\n                                                             childContextMenuItemPresenter);\n        verify(presenter.canBeDisabledMenuItemByIdentifier).put(\"id\",\n                                                                childContextMenuItemPresenter);\n        verify(view).addContextMenuItemOnParent(childContextMenuItemPresenter,\n                                                parent);\n        verify(view).setContextMenuActive(true);\n    }\n\n    @Test\n    public void addContextGroupMenuItemTest() {\n        final GroupContextMenuItemPresenter groupContextMenuItemPresenter = mock(GroupContextMenuItemPresenter.class);\n        doReturn(groupContextMenuItemPresenter).when(groupContextMenuItemPresenters).get();\n\n        presenter.addContextGroupMenuItem(\"menuItemId\",\n                                          \"id\",\n                                          \"label\",\n                                          MenuPosition.LEFT);\n\n        verify(groupContextMenuItemPresenter).setup(\"label\");\n        verify(presenter.hasChildrenMenuItemByIdentifier).put(\"id\",\n                                                              groupContextMenuItemPresenter);\n        verify(presenter.canBeDisabledMenuItemByIdentifier).put(\"id\",\n                                                                groupContextMenuItemPresenter);\n        verify(view).addContextMenuItem(groupContextMenuItemPresenter);\n        verify(view).setContextMenuActive(true);\n    }\n\n    @Test\n    public void clearContextMenuTest() {\n        view.clearContextMenu();\n\n        verify(view).clearContextMenu();\n    }\n\n    @Test\n    public void enableMenuItemTest() {\n        final CanBeDisabled menuItem = mock(CanBeDisabled.class);\n        presenter.canBeDisabledMenuItemByIdentifier.put(\"id\",\n                                                        menuItem);\n\n        presenter.enableMenuItem(\"id\",\n                                 true);\n\n        verify(menuItem).enable();\n    }\n\n    @Test\n    public void disableMenuItemTest() {\n        final CanBeDisabled menuItem = mock(CanBeDisabled.class);\n        presenter.canBeDisabledMenuItemByIdentifier.put(\"id\",\n                                                        menuItem);\n\n        presenter.enableMenuItem(\"id\",\n                                 false);\n\n        verify(menuItem).disable();\n    }\n\n    @Test\n    public void enableContextMenuItemTest() {\n        final CanBeDisabled menuItem = mock(CanBeDisabled.class);\n        presenter.canBeDisabledMenuItemByIdentifier.put(\"id\",\n                                                        menuItem);\n\n        presenter.enableContextMenuItem(\"id\",\n                                        true);\n\n        verify(presenter).enableMenuItem(\"id\",\n                                         true);\n    }\n\n    @Test\n    public void setupHomeLinkWithNoDefaultPerspective() {\n        doReturn(null).when(workbench).getHomePerspectiveActivity();\n\n        presenter.setupHomeLink();\n\n        ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);\n        verify(view).setHomeLinkAction(commandCaptor.capture());\n        verify(view).setBrandImageAction(commandCaptor.capture());\n        commandCaptor.getValue().execute();\n\n        verify(placeManager,\n               never()).goTo(anyString());\n    }\n\n    @Test\n    public void setupHomeLinkWithNoPermissionToAccessDefaultPerspective() {\n        final PerspectiveActivity homePerspective = mock(PerspectiveActivity.class);\n        doReturn(\"identifier\").when(homePerspective).getIdentifier();\n        doReturn(homePerspective).when(workbench).getHomePerspectiveActivity();\n        doReturn(false).when(presenter).hasAccessToPerspective(any());\n\n        presenter.setupHomeLink();\n\n        ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);\n        verify(view).setHomeLinkAction(commandCaptor.capture());\n        verify(view).setBrandImageAction(commandCaptor.capture());\n        commandCaptor.getValue().execute();\n\n        verify(placeManager,\n               never()).goTo(anyString());\n    }\n\n    @Test\n    public void setupHomeLinkWithPermissionToAccessDefaultPerspective() {\n        final PerspectiveActivity homePerspective = mock(PerspectiveActivity.class);\n        doReturn(\"identifier\").when(homePerspective).getIdentifier();\n        doReturn(homePerspective).when(workbench).getHomePerspectiveActivity();\n        doReturn(true).when(presenter).hasAccessToPerspective(any());\n\n        presenter.setupHomeLink();\n\n        ArgumentCaptor<Command> commandCaptor = ArgumentCaptor.forClass(Command.class);\n        verify(view).setHomeLinkAction(commandCaptor.capture());\n        verify(view).setBrandImageAction(commandCaptor.capture());\n        commandCaptor.getValue().execute();\n\n        verify(placeManager).goTo(\"identifier\");\n    }\n\n    @Test\n    public void testAddMenusWithExperimentalPerspective() {\n\n        when(authzManager.authorize(any(MenuItem.class), any())).thenReturn(true);\n\n        List<MenuItem> items = new ArrayList<>();\n\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(SECOND_PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n        items.add(MenuFactory.newSimpleItem(NAME).perspective(THIRD_PERSPECTIVE_ID).endMenu().build().getItems().get(0));\n\n        final Menus menus = MenuFactory.newSimpleItem(NAME).withItems(items).endMenu().build();\n\n        when(experimentalActivitiesAuthorizationManager.authorizeActivityId(anyString()))\n                .thenAnswer((Answer<Boolean>) invocationOnMock -> !SECOND_PERSPECTIVE_ID.equals(invocationOnMock.getArguments()[0]));\n\n        presenter.addMenus(menus);\n\n        verify(experimentalActivitiesAuthorizationManager, times(3)).authorizeActivityId(anyString());\n        verify(presenter.canHideMenuItemByIdentifier, times(3)).put(any(), any());\n        verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).show();\n        verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID)).hide();\n        verify(presenter.canHideMenuItemByIdentifier.get(THIRD_PERSPECTIVE_ID), times(2)).show();\n    }\n\n    @Test\n    public void testShowHideExperimentalPerspectiveMenus() {\n        testAddMenusWithExperimentalPerspective();\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(PERSPECTIVE_ID, false));\n        verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(2)).hide();\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(SECOND_PERSPECTIVE_ID, true));\n        verify(presenter.canHideMenuItemByIdentifier.get(SECOND_PERSPECTIVE_ID), times(3)).show();\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(THIRD_PERSPECTIVE_ID, false));\n        verify(presenter.canHideMenuItemByIdentifier.get(PERSPECTIVE_ID), times(3)).hide();\n    }\n\n    class MegaMenuBrandMock implements MegaMenuBrand {\n\n        private String brandImageUrl;\n\n        private String brandImageLabel;\n\n        private String menuAccessorLabel;\n\n        public MegaMenuBrandMock(String brandImageUrl,\n                                 String brandImageLabel,\n                                 String menuAccessorLabel) {\n            this.brandImageUrl = brandImageUrl;\n            this.brandImageLabel = brandImageLabel;\n            this.menuAccessorLabel = menuAccessorLabel;\n        }\n\n        @Override\n        public String brandImageUrl() {\n            return brandImageUrl;\n        }\n\n        @Override\n        public String brandImageLabel() {\n            return brandImageLabel;\n        }\n\n        @Override\n        public String menuAccessorLabel() {\n            return menuAccessorLabel;\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuProducerTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.events.PlaceMaximizedEvent;\nimport org.uberfire.client.workbench.events.PlaceMinimizedEvent;\nimport org.uberfire.client.workbench.widgets.menu.events.PerspectiveVisibiltiyChangeEvent;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMegaMenuProducerTest {\n\n    @Mock\n    private AuthorizationManager authzManager;\n\n    @Mock\n    private PerspectiveManager perspectiveManager;\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    private User identity;\n\n    @Mock\n    private WorkbenchMegaMenuPresenter.View view;\n\n    @Mock\n    private WorkbenchMegaMenuPresenter defaultPresenter;\n\n    @Mock\n    private WorkbenchMegaMenuStandalonePresenter standalonePresenter;\n\n    @Mock\n    private PerspectiveChange perspectiveChangeEvent;\n\n    @Mock\n    private PlaceMaximizedEvent placeMaximizedEvent;\n\n    @Mock\n    private PlaceMinimizedEvent placeMinimizedEvent;\n\n    @Mock\n    private ManagedInstance<MegaMenuBrand> megaMenuBrands;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n\n    @Mock\n    private Workbench workbench;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    private WorkbenchMegaMenuProducer producer;\n    private boolean isStandalone = false;\n\n    @Before\n    public void setup() {\n        producer = new WorkbenchMegaMenuProducer(authzManager,\n                                                 perspectiveManager,\n                                                 activityManager,\n                                                 identity,\n                                                 view,\n                                                 megaMenuBrands,\n                                                 placeManager,\n                                                 authorizationManager,\n                                                 sessionInfo,\n                                                 childMenuItemPresenters,\n                                                 groupMenuItemPresenters,\n                                                 childContextMenuItemPresenters,\n                                                 groupContextMenuItemPresenters,\n                                                 workbench,\n                                                 experimentalActivitiesAuthorizationManager) {\n            @Override\n            protected boolean isStandalone() {\n                return isStandalone;\n            }\n\n            @Override\n            protected WorkbenchMegaMenuPresenter makeDefaultPresenter() {\n                return defaultPresenter;\n            }\n\n            @Override\n            protected WorkbenchMegaMenuStandalonePresenter makeStandalonePresenter() {\n                return standalonePresenter;\n            }\n        };\n    }\n\n    @Test\n    public void megaMenuPresenterInstantiationDefaultMode() {\n        assertMegaMenuPresenter(false,\n                                WorkbenchMegaMenuPresenter.class);\n    }\n\n    @Test\n    public void megaMenuPresenterInstantiationStandaloneMode() {\n        assertMegaMenuPresenter(true,\n                                WorkbenchMegaMenuStandalonePresenter.class);\n    }\n\n    @Test\n    public void checkObservedEventsCallsPresenterDefaultMode() {\n        final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(false);\n        assertMegaMenuEvents(presenter);\n    }\n\n    @Test\n    public void checkObservedEventsCallsPresenterStandaloneMode() {\n        final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(true);\n        assertMegaMenuEvents(presenter);\n    }\n\n    @Test\n    public void testNotifyVisibilityChange() {\n        testNotifyVisibilityChange(false);\n    }\n\n    @Test\n    public void testNotifyVisibilityChangeStandaloneMode() {\n        testNotifyVisibilityChange(true);\n    }\n\n    private void testNotifyVisibilityChange(boolean isStandalone) {\n        final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone);\n\n        presenter.onPerspectiveVisibilityChange(new PerspectiveVisibiltiyChangeEvent(\"perspectiveId\", false));\n\n        verify(presenter).onPerspectiveVisibilityChange(any());\n    }\n\n    private void assertMegaMenuPresenter(final boolean isStandalone,\n                                         final Class expectedPresenterType) {\n        final WorkbenchMegaMenuPresenter presenter = getMegaMenuPresenter(isStandalone);\n        assertEquals(extractContainingClassName(expectedPresenterType.getName()),\n                     extractContainingClassName(presenter.getClass().getName()));\n    }\n\n    private void assertMegaMenuEvents(final WorkbenchMegaMenuPresenter presenter) {\n        presenter.onPerspectiveChange(perspectiveChangeEvent);\n        verify(presenter).onPerspectiveChange(eq(perspectiveChangeEvent));\n    }\n\n    private WorkbenchMegaMenuPresenter getMegaMenuPresenter(final boolean isStandalone) {\n        this.isStandalone = isStandalone;\n        return producer.getWorbenchMenu();\n    }\n\n    private String extractContainingClassName(final String className) {\n        if (className.contains(\"$\")) {\n            return className.substring(0,\n                                       className.indexOf(\"$\"));\n        }\n        return className;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/WorkbenchMegaMenuStandalonePresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu;\n\nimport java.util.function.Consumer;\n\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.mvp.ActivityManager;\nimport org.uberfire.client.mvp.PerspectiveActivity;\nimport org.uberfire.client.mvp.PerspectiveManager;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.Workbench;\nimport org.uberfire.client.workbench.events.PerspectiveChange;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.experimental.service.auth.ExperimentalActivitiesAuthorizationManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.rpc.SessionInfo;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.ArgumentMatchers.isNull;\nimport static org.mockito.Mockito.doAnswer;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchMegaMenuStandalonePresenterTest {\n\n    @Mock\n    protected AuthorizationManager authzManager;\n\n    @Mock\n    private PerspectiveManager perspectiveManager;\n\n    @Mock\n    private ActivityManager activityManager;\n\n    @Mock\n    protected User identity;\n\n    @Mock\n    private WorkbenchMegaMenuPresenter.View view;\n\n    @Mock\n    private ManagedInstance<MegaMenuBrand> megaMenuBrands;\n\n    @Mock\n    private PlaceManager placeManager;\n\n    @Mock\n    private AuthorizationManager authorizationManager;\n\n    @Mock\n    private SessionInfo sessionInfo;\n\n    @Mock\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n\n    @Mock\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n\n    @Mock\n    private Workbench workbench;\n\n    @Mock\n    private ExperimentalActivitiesAuthorizationManager experimentalActivitiesAuthorizationManager;\n\n    private WorkbenchMegaMenuStandalonePresenter presenter;\n\n    @Before\n    public void setup() {\n        doReturn(true).when(megaMenuBrands).isUnsatisfied();\n        presenter = spy(new WorkbenchMegaMenuStandalonePresenter(authzManager,\n                                                                 perspectiveManager,\n                                                                 activityManager,\n                                                                 identity,\n                                                                 view,\n                                                                 megaMenuBrands,\n                                                                 placeManager,\n                                                                 authorizationManager,\n                                                                 sessionInfo,\n                                                                 childMenuItemPresenters,\n                                                                 groupMenuItemPresenters,\n                                                                 childContextMenuItemPresenters,\n                                                                 groupContextMenuItemPresenters,\n                                                                 workbench,\n                                                                 experimentalActivitiesAuthorizationManager));\n        doReturn(mock(ChildMenuItemPresenter.class)).when(childMenuItemPresenters).get();\n    }\n\n    @Test\n    public void testAddMenus() {\n        final String perspectiveId = \"perspectiveId\";\n        final String label = \"perspectiveLabel\";\n        final Menus menus = MenuFactory.newSimpleItem(label).perspective(perspectiveId).endMenu().build();\n\n        presenter.addMenus(menus);\n\n        verify(authzManager,\n               never()).authorize(any(MenuItem.class),\n                                  any(User.class));\n        verify(presenter,\n               never()).addMenuItem(anyString(),\n                                    anyString(),\n                                    anyString(),\n                                    any(Command.class),\n                                    any(MenuPosition.class));\n    }\n\n    @Test\n    public void testAddContextMenus() {\n        final String perspectiveId = \"perspectiveId\";\n        final String contextLabel = \"contextLabel\";\n        final Menus contextMenus = MenuFactory.newSimpleItem(contextLabel).endMenu().build();\n        final PerspectiveActivity activity = mock(PerspectiveActivity.class);\n        final PlaceRequest placeRequest = mock(PlaceRequest.class);\n\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(contextMenus);\n            return null;\n        }).when(activity).getMenus(any());\n        when(activity.isType(ActivityResourceType.PERSPECTIVE.name())).thenReturn(true);\n        when(authzManager.authorize(contextMenus.getItems().get(0),\n                                    identity)).thenReturn(true);\n        when(activityManager.getActivity(placeRequest)).thenReturn(activity);\n\n        presenter.onPerspectiveChange(new PerspectiveChange(placeRequest,\n                                                            null,\n                                                            contextMenus,\n                                                            perspectiveId));\n\n        verify(authzManager).authorize(contextMenus.getItems().get(0),\n                                       identity);\n        verify(presenter).addMenuItem(anyString(),\n                                      eq(contextLabel),\n                                      isNull(String.class),\n                                      isNull(Command.class),\n                                      eq(MenuPosition.LEFT));\n\n        verify(presenter,\n               never()).clearContextMenu();\n        verify(presenter,\n               never()).addContextMenuItem(anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           anyString(),\n                                           any(Command.class),\n                                           any(MenuPosition.class));\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/contextmenuitem/ChildContextMenuItemPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ChildContextMenuItemPresenterTest {\n\n    @Mock\n    private ChildContextMenuItemPresenter.View view;\n\n    @InjectMocks\n    private ChildContextMenuItemPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void setupAndSelectTest() {\n        final String label = \"label\";\n        final Command command = mock(Command.class);\n        presenter.setup(label,\n                        command);\n\n        verify(view).setLabel(label);\n        verify(view).setCommand(command);\n\n        presenter.select();\n\n        verify(view).select();\n    }\n\n    @Test\n    public void enableTest() {\n        presenter.enable();\n\n        verify(view).enable();\n    }\n\n    @Test\n    public void disableTest() {\n        presenter.disable();\n\n        verify(view).disable();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/contextmenuitem/GroupContextMenuItemPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GroupContextMenuItemPresenterTest {\n\n    @Mock\n    private GroupContextMenuItemPresenter.View view;\n\n    @InjectMocks\n    private GroupContextMenuItemPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void setupTest() {\n        final String label = \"label\";\n        presenter.setup(label);\n\n        verify(view).setLabel(label);\n    }\n\n    @Test\n    public void addChildTest() {\n        final IsElement item = mock(IsElement.class);\n\n        presenter.addChild(item);\n\n        verify(view).addItem(item);\n    }\n\n    @Test\n    public void enableTest() {\n        presenter.enable();\n\n        verify(view).enable();\n    }\n\n    @Test\n    public void disableTest() {\n        presenter.disable();\n\n        verify(view).disable();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/ChildMenuItemPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ChildMenuItemPresenterTest {\n\n    @Mock\n    private ChildMenuItemPresenter.View view;\n\n    @InjectMocks\n    private ChildMenuItemPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void setupAndSelectTest() {\n        final String label = \"label\";\n        final Command command = mock(Command.class);\n        presenter.setup(label,\n                        command);\n\n        verify(view).setLabel(label);\n        verify(view).setCommand(command);\n\n        presenter.select();\n\n        verify(view).select();\n    }\n\n    @Test\n    public void enableTest() {\n        presenter.enable();\n\n        verify(view).enable();\n    }\n\n    @Test\n    public void disableTest() {\n        presenter.disable();\n\n        verify(view).disable();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/GroupMenuItemPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class GroupMenuItemPresenterTest {\n\n    @Mock\n    private GroupMenuItemPresenter.View view;\n\n    @InjectMocks\n    private GroupMenuItemPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void setupTest() {\n        final String label = \"label\";\n        presenter.setup(label);\n\n        verify(view).setLabel(label);\n    }\n\n    @Test\n    public void addChildTest() {\n        final IsElement item = mock(IsElement.class);\n\n        presenter.addChild(item);\n\n        verify(view).addItem(item);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/java/org/uberfire/client/workbench/widgets/menu/megamenu/menuitem/IconMenuItemPresenterTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.workbench.widgets.menu.megamenu.menuitem;\n\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class IconMenuItemPresenterTest {\n\n    @Mock\n    private IconMenuItemPresenter.View view;\n\n    @InjectMocks\n    private IconMenuItemPresenter presenter;\n\n    @Test\n    public void initTest() {\n        presenter.init();\n\n        verify(view).init(presenter);\n    }\n\n    @Test\n    public void setupAndSelectTest() {\n        final String iconClass = \"iconClass\";\n        final String label = \"label\";\n        final Command command = mock(Command.class);\n        presenter.setup(iconClass,\n                        label,\n                        command);\n\n        verify(view).setIconClass(iconClass);\n        verify(view).setLabel(label);\n        verify(view).setCommand(command);\n\n        presenter.select();\n\n        verify(view).select();\n    }\n\n    @Test\n    public void enableTest() {\n        presenter.enable();\n\n        verify(view).enable();\n    }\n\n    @Test\n    public void disableTest() {\n        presenter.disable();\n\n        verify(view).disable();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire\" level=\"info\"/>\n\n  <root level=\"warn\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workbench</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workbench-client-backend</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Workbench Client using Backend</name>\n  <description>UberFire Workbench Client using Backend</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-js</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-backend-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-bus</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-client-backend</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/java/org/uberfire/client/RuntimePluginsServiceProxyBackendImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.plugin.RuntimePluginService;\nimport org.uberfire.client.plugin.RuntimePluginsServiceProxy;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\n@Alternative\npublic class RuntimePluginsServiceProxyBackendImpl implements RuntimePluginsServiceProxy {\n\n    @Inject\n    private Caller<RuntimePluginService> runtimePluginsService;\n\n    @Override\n    public void getTemplateContent(final String contentUrl,\n                                   final ParameterizedCommand<String> command) {\n        runtimePluginsService.call(new RemoteCallback<String>() {\n            @Override\n            public void callback(String o) {\n                command.execute(o);\n            }\n        }).getTemplateContent(contentUrl);\n    }\n\n    @Override\n    public void listFrameworksContent(final ParameterizedCommand<Collection<String>> command) {\n        runtimePluginsService.call(new RemoteCallback<Collection<String>>() {\n            @Override\n            public void callback(Collection<String> o) {\n                command.execute(o);\n            }\n        }).listFrameworksContent();\n    }\n\n    @Override\n    public void listPluginsContent(final ParameterizedCommand<Collection<String>> command) {\n        runtimePluginsService.call(new RemoteCallback<Collection<String>>() {\n            @Override\n            public void callback(Collection<String> o) {\n                command.execute(o);\n            }\n        }).listPluginsContent();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/java/org/uberfire/client/VFSLockServiceProxyBackendImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.BusErrorCallback;\nimport org.jboss.errai.bus.client.api.messaging.Message;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.slf4j.Logger;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSLockService;\nimport org.uberfire.backend.vfs.impl.LockInfo;\nimport org.uberfire.backend.vfs.impl.LockResult;\nimport org.uberfire.client.workbench.VFSLockServiceProxy;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Alternative\npublic class VFSLockServiceProxyBackendImpl implements VFSLockServiceProxy {\n\n    @Inject\n    private Caller<VFSLockService> vfsLockService;\n\n    @Inject\n    private Logger logger;\n\n    @Override\n    public void acquireLock(final Path path,\n                            final ParameterizedCommand<LockResult> parameterizedCommand) {\n\n        vfsLockService.call(new RemoteCallback<LockResult>() {\n\n                                @Override\n                                public void callback(final LockResult result) {\n                                    parameterizedCommand.execute(result);\n                                }\n                            },\n                            new BusErrorCallback() {\n\n                                @Override\n                                public boolean error(Message message,\n                                                     Throwable throwable) {\n\n                                    logger.error(\"Error when trying to acquire lock for \" + path.toURI(),\n                                                 throwable);\n                                    parameterizedCommand.execute(LockResult.error());\n                                    return false;\n                                }\n                            }).acquireLock(path);\n    }\n\n    @Override\n    public void releaseLock(final Path path,\n                            final ParameterizedCommand<LockResult> parameterizedCommand) {\n\n        vfsLockService.call(new RemoteCallback<LockResult>() {\n\n            @Override\n            public void callback(final LockResult result) {\n                parameterizedCommand.execute(result);\n            }\n        }).releaseLock(path);\n    }\n\n    @Override\n    public void forceReleaseLock(final Path path,\n                                 final ParameterizedCommand<LockResult> parameterizedCommand) {\n\n        vfsLockService.call(new RemoteCallback<LockResult>() {\n\n            @Override\n            public void callback(final LockResult result) {\n                parameterizedCommand.execute(result);\n            }\n        }).forceReleaseLock(path);\n    }\n\n    @Override\n    public void retrieveLockInfo(final Path path,\n                                 final ParameterizedCommand<LockInfo> parameterizedCommand) {\n\n        vfsLockService.call(new RemoteCallback<LockInfo>() {\n\n            @Override\n            public void callback(final LockInfo lockInfo) {\n                parameterizedCommand.execute(lockInfo);\n            }\n        }).retrieveLockInfo(path);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/java/org/uberfire/client/VFSServiceProxyBackendImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.backend.vfs.VFSService;\nimport org.uberfire.client.workbench.VFSServiceProxy;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Alternative\npublic class VFSServiceProxyBackendImpl implements VFSServiceProxy {\n\n    @Inject\n    private Caller<VFSService> vfsService;\n\n    @Override\n    public void get(final String path,\n                    final ParameterizedCommand<Path> parameterizedCommand) {\n        vfsService.call(new RemoteCallback<Path>() {\n            @Override\n            public void callback(final Path o) {\n                parameterizedCommand.execute(o);\n            }\n        }).get(path);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/java/org/uberfire/client/WorkbenchBackendEntryPoint.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.bus.client.api.BusLifecycleAdapter;\nimport org.jboss.errai.bus.client.api.BusLifecycleEvent;\nimport org.jboss.errai.bus.client.api.ClientMessageBus;\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.slf4j.Logger;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\n\n@EntryPoint\npublic class WorkbenchBackendEntryPoint {\n\n    private static final int MAX_RETRIES = 5;\n\n    private Logger logger;\n\n    private ClientMessageBus bus;\n\n    private WorkbenchServicesProxy workbenchServices;\n\n    private ErrorPopupPresenter errorPopupPresenter;\n\n    private boolean isWorkbenchOnCluster = false;\n    private boolean showedError = false;\n    private boolean isOpen = false;\n\n    private int retries = MAX_RETRIES;\n\n    public WorkbenchBackendEntryPoint() {\n\n    }\n\n    @Inject\n    public WorkbenchBackendEntryPoint(final Logger logger,\n                                      final ClientMessageBus bus,\n                                      final WorkbenchServicesProxy workbenchServices,\n                                      final ErrorPopupPresenter errorPopupPresenter) {\n        this.logger = logger;\n        this.bus = bus;\n        this.workbenchServices = workbenchServices;\n        this.errorPopupPresenter = errorPopupPresenter;\n    }\n\n    @PostConstruct\n    public void init() {\n        bus.addLifecycleListener(new BusLifecycleAdapter() {\n\n            @Override\n            public void busOnline(final BusLifecycleEvent e) {\n                logger.info(\"Bus is back online.\");\n                setShowedError(false);\n                resetRetries();\n            }\n\n            @Override\n            public void busOffline(final BusLifecycleEvent e) {\n                if (isShowedError()) {\n                    return;\n                }\n                logger.error(\"Bus is offline. [\" + e.getReason().getErrorMessage() + \"]\");\n                if (!isWorkbenchOnCluster && !hasMoreRetries() && !isOpen()) {\n\n                    errorPopupPresenter.showMessage(\"You've been disconnected.\",\n                                                    () -> isOpen = true,\n                                                    () -> isOpen = false);\n                    setShowedError(true);\n                }\n                decrementRetries();\n            }\n        });\n        workbenchServices.isWorkbenchOnCluster(parameter -> isWorkbenchOnCluster = !(parameter == null || parameter.equals(Boolean.FALSE)));\n    }\n\n    protected boolean isOpen() {\n        return isOpen;\n    }\n\n    protected void setShowedError(boolean value) {\n        showedError = value;\n    }\n\n    protected boolean isShowedError() {\n        return this.showedError;\n    }\n\n    protected boolean hasMoreRetries() {\n        return this.retries > 0;\n    }\n\n    protected void decrementRetries() {\n        if (retries > 0) {\n            this.retries--;\n        }\n    }\n\n    protected void resetRetries() {\n        this.retries = MAX_RETRIES;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/java/org/uberfire/client/WorkbenchServicesProxyBackendImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport java.util.Set;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Alternative;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.Caller;\nimport org.jboss.errai.common.client.api.RemoteCallback;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.workbench.services.WorkbenchServices;\n\n@Alternative\n@Dependent\npublic class WorkbenchServicesProxyBackendImpl implements WorkbenchServicesProxy {\n\n    @Inject\n    private Caller<WorkbenchServices> workbenchServices;\n\n    @Override\n    public void save(final String perspectiveId,\n                     final PerspectiveDefinition activePerspective,\n                     final Command callback) {\n        workbenchServices.call(new RemoteCallback<Void>() {\n            @Override\n            public void callback(Void o) {\n                callback.execute();\n            }\n        }).save(perspectiveId,\n                activePerspective);\n    }\n\n    @Override\n    public void loadPerspective(final String name,\n                                final ParameterizedCommand<PerspectiveDefinition> parameterizedCommand) {\n        workbenchServices.call(new RemoteCallback<PerspectiveDefinition>() {\n            @Override\n            public void callback(final PerspectiveDefinition result) {\n                parameterizedCommand.execute(result);\n            }\n        }).loadPerspective(name);\n    }\n\n    @Override\n    public void loadPerspectives(final ParameterizedCommand<Set<PerspectiveDefinition>> parameterizedCommand) {\n        workbenchServices.call(new RemoteCallback<Set<PerspectiveDefinition>>() {\n            @Override\n            public void callback(final Set<PerspectiveDefinition> result) {\n                parameterizedCommand.execute(result);\n            }\n        }).loadPerspectives();\n    }\n\n    @Override\n    public void removePerspectiveState(final String perspectiveId,\n                                       final Command callback) {\n        workbenchServices.call(new RemoteCallback<Void>() {\n            @Override\n            public void callback(Void o) {\n                callback.execute();\n            }\n        }).removePerspectiveState(perspectiveId);\n    }\n\n    @Override\n    public void removePerspectiveStates(final Command doWhenFinished) {\n        workbenchServices.call(new RemoteCallback<Void>() {\n            @Override\n            public void callback(Void o) {\n                doWhenFinished.execute();\n            }\n        }).removePerspectiveStates();\n    }\n\n    @Override\n    public void save(final SplashScreenFilter splashFilter) {\n        workbenchServices.call().save(splashFilter);\n    }\n\n    @Override\n    public void loadSplashScreenFilter(final String name,\n                                       final ParameterizedCommand<SplashScreenFilter> parameterizedCommand) {\n        workbenchServices.call(new RemoteCallback<SplashScreenFilter>() {\n            @Override\n            public void callback(final SplashScreenFilter result) {\n                parameterizedCommand.execute(result);\n            }\n        }).loadSplashScreenFilter(name);\n    }\n\n    @Override\n    public void isWorkbenchOnCluster(final ParameterizedCommand<Boolean> parameterizedCommand) {\n        workbenchServices.call(new RemoteCallback<Boolean>() {\n            @Override\n            public void callback(final Boolean result) {\n                parameterizedCommand.execute(result);\n            }\n        }).isWorkbenchOnCluster();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\nerrai.ioc.enabled.alternatives=org.uberfire.client.WorkbenchServicesProxyBackendImpl \\\n                               org.uberfire.client.VFSServiceProxyBackendImpl \\\n                               org.uberfire.client.VFSLockServiceProxyBackendImpl \\\n                               org.uberfire.client.RuntimePluginsServiceProxyBackendImpl\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/main/resources/org/uberfire/UberfireWorkbenchBackend.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <!-- GuvnorNG API common interfaces -->\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.uberfire.UberfireBackend\"/>\n  <inherits name=\"org.uberfire.security.UberfireSecurityClientBackend\"/>\n\n</module>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/test/java/org/uberfire/client/WorkbenchBackendEntryPointTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport java.util.stream.IntStream;\n\nimport org.jboss.errai.bus.client.api.BusLifecycleEvent;\nimport org.jboss.errai.bus.client.api.BusLifecycleListener;\nimport org.jboss.errai.bus.client.api.ClientMessageBus;\nimport org.jboss.errai.bus.client.api.TransportError;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.mockito.stubbing.Answer;\nimport org.slf4j.Logger;\nimport org.uberfire.client.workbench.WorkbenchServicesProxy;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.ParameterizedCommand;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class WorkbenchBackendEntryPointTest {\n\n    @Mock\n    private Logger logger;\n\n    @Mock\n    private ClientMessageBus bus;\n\n    @Mock\n    private WorkbenchServicesProxy workbenchServices;\n\n    @Mock\n    private ErrorPopupPresenter errorPopupPresenter;\n\n    @Test\n    public void testErrorDisplay() {\n        final WorkbenchBackendEntryPoint workbenchBackendEntryPoint = spy(new WorkbenchBackendEntryPoint(logger,\n                                                                                                         bus,\n                                                                                                         workbenchServices,\n                                                                                                         errorPopupPresenter));\n\n        doAnswer(invocation -> {\n            final Object[] args = invocation.getArguments();\n            final Command afterShow = (Command) args[1];\n            afterShow.execute();\n            return null;\n        }).when(errorPopupPresenter).showMessage(anyString(),\n                                                 any(),\n                                                 any());\n\n        doAnswer((Answer<Void>) invocation -> {\n            final Object[] args = invocation.getArguments();\n            final ParameterizedCommand<Boolean> obj = (ParameterizedCommand<Boolean>) args[0];\n            obj.execute(false);\n            return null;\n        }).when(workbenchServices).isWorkbenchOnCluster(any(ParameterizedCommand.class));\n\n        workbenchBackendEntryPoint.init();\n\n        final ArgumentCaptor<BusLifecycleListener> captor = ArgumentCaptor.forClass(BusLifecycleListener.class);\n        verify(bus).addLifecycleListener(captor.capture());\n\n        final BusLifecycleListener listener = captor.getValue();\n        final TransportError error = mock(TransportError.class);\n        final BusLifecycleEvent event = new BusLifecycleEvent(bus,\n                                                              error);\n\n        assertTrue(workbenchBackendEntryPoint.hasMoreRetries());\n\n        IntStream.range(0,\n                        5).forEach(i -> listener.busOffline(event));\n\n        verify(logger,\n               times(5)).error((anyString()));\n        verify(errorPopupPresenter,\n               never()).showMessage(anyString());\n        assertFalse(workbenchBackendEntryPoint.hasMoreRetries());\n\n        assertFalse(workbenchBackendEntryPoint.isOpen());\n\n        listener.busOffline(event);\n\n        verify(logger,\n               times(6)).error((anyString()));\n        assertFalse(workbenchBackendEntryPoint.hasMoreRetries());\n        verify(errorPopupPresenter,\n               times(1)).showMessage(anyString(),\n                                     any(),\n                                     any());\n\n        assertTrue(workbenchBackendEntryPoint.isOpen());\n\n        listener.busOnline(event);\n\n        verify(logger,\n               times(1)).info((anyString()));\n        verify(errorPopupPresenter,\n               times(1)).showMessage(anyString(),\n                                     any(),\n                                     any());\n\n        listener.busOffline(event);\n        listener.busOffline(event);\n\n        verify(logger,\n               times(8)).error((anyString()));\n        verify(errorPopupPresenter,\n               times(1)).showMessage(anyString(),\n                                     any(),\n                                     any());\n\n        IntStream.range(0,\n                        5).forEach(i -> listener.busOffline(event));\n\n        verify(errorPopupPresenter,\n               times(1)).showMessage(anyString(),\n                                     any(),\n                                     any());\n    }\n\n    @Test\n    public void testNoErrorDisplay() {\n        final WorkbenchBackendEntryPoint workbenchBackendEntryPoint = new WorkbenchBackendEntryPoint(logger,\n                                                                                                     bus,\n                                                                                                     workbenchServices,\n                                                                                                     errorPopupPresenter);\n\n        doAnswer((Answer<Void>) invocation -> {\n            final Object[] args = invocation.getArguments();\n            final ParameterizedCommand<Boolean> obj = (ParameterizedCommand<Boolean>) args[0];\n            obj.execute(true);\n            return null;\n        }).when(workbenchServices).isWorkbenchOnCluster(any(ParameterizedCommand.class));\n\n        workbenchBackendEntryPoint.init();\n\n        final ArgumentCaptor<BusLifecycleListener> captor = ArgumentCaptor.forClass(BusLifecycleListener.class);\n        verify(bus).addLifecycleListener(captor.capture());\n\n        final BusLifecycleListener listener = captor.getValue();\n        final TransportError error = mock(TransportError.class);\n        final BusLifecycleEvent event = new BusLifecycleEvent(bus,\n                                                              error);\n        listener.busOffline(event);\n\n        verify(logger,\n               times(1)).error((anyString()));\n        verify(errorPopupPresenter,\n               times(0)).showMessage(anyString());\n\n        listener.busOffline(event);\n\n        verify(logger,\n               times(2)).error((anyString()));\n        verify(errorPopupPresenter,\n               times(0)).showMessage(anyString());\n\n        listener.busOnline(event);\n\n        verify(logger,\n               times(1)).info((anyString()));\n        verify(errorPopupPresenter,\n               times(0)).showMessage(anyString());\n\n        listener.busOffline(event);\n        listener.busOffline(event);\n\n        verify(logger,\n               times(4)).error((anyString()));\n        verify(errorPopupPresenter,\n               times(0)).showMessage(anyString());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-backend/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire\" level=\"info\"/>\n\n  <root level=\"warn\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/.gitignore",
    "content": "/bin\ngwt-unitCache/\nwar/\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workbench</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workbench-client-views-patternfly</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Workbench Client Views: PatternFly</name>\n  <description>UberFire Workbench Client Views: PatternFly</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.gwtbootstrap3</groupId>\n      <artifactId>gwtbootstrap3</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ui</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-ioc</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-security-server</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.allen-sauer.gwt.dnd</groupId>\n      <artifactId>gwt-dnd</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.guava</groupId>\n      <artifactId>guava</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.elemental2</groupId>\n      <artifactId>elemental2-dom</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>jsinterop-annotations</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>com.google.jsinterop</groupId>\n      <artifactId>base</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-cdi-client</artifactId>\n      <type>test-jar</type>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.slf4j</groupId>\n      <artifactId>slf4j-simple</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt.gwtmockito</groupId>\n      <artifactId>gwtmockito</artifactId>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-commons</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>appformer-js-monaco</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.kie.soup</groupId>\n      <artifactId>kie-soup-commons</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-nio2-model</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-client-api</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-client</artifactId>\n      <classifier>sources</classifier>\n      <scope>test</scope>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-testing-utils</artifactId>\n      <scope>test</scope>\n    </dependency>\n  </dependencies>\n\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-dependency-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>unpack-patternfly</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>patternfly</artifactId>\n                  <version>${version.org.webjars.bower.org.patternfly}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/patternfly</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-prettify</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>google-code-prettify</artifactId>\n                  <version>${version.org.webjars.bower.google-code-prettify}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/prettify</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-bootstrap-select</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>bootstrap-select</artifactId>\n                  <version>${version.org.webjars.bower.bootstrap-select}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/bootstrap-select</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-moment</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>moment</artifactId>\n                  <version>${version.org.webjars.bower.moment}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/moment</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-moment-timezone</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>moment-timezone</artifactId>\n                  <version>${version.org.webjars.bower.moment-timezone}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/moment-timezone</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-bootstrap-daterangepicker</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>bootstrap-daterangepicker</artifactId>\n                  <version>${version.org.webjars.bower.bootstrap-daterangepicker}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/bootstrap-daterangepicker</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-d3</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.webjars.bower</groupId>\n                  <artifactId>d3</artifactId>\n                  <version>${version.org.webjars.bower.d3js}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/d3</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n          <execution>\n            <id>unpack-appformer-js-monaco</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>unpack</goal>\n            </goals>\n            <configuration>\n              <artifactItems>\n                <artifactItem>\n                  <groupId>org.uberfire</groupId>\n                  <artifactId>appformer-js-monaco</artifactId>\n                  <version>${uberfire.version}</version>\n                  <type>jar</type>\n                  <overWrite>true</overWrite>\n                  <outputDirectory>${project.build.directory}/appformer-js-monaco</outputDirectory>\n                </artifactItem>\n              </artifactItems>\n              <overWriteReleases>false</overWriteReleases>\n              <overWriteSnapshots>true</overWriteSnapshots>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-resources-plugin</artifactId>\n        <executions>\n          <execution>\n            <id>copy-patternfly-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/patternfly/META-INF/resources/webjars/patternfly/${version.org.webjars.bower.org.patternfly}/dist</directory>\n                  <includes>\n                    <include>**</include>\n                  </includes>\n                  <excludes>\n                    <exclude>tests/**</exclude>\n                  </excludes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-prettify-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/prettify</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/prettify/META-INF/resources/webjars/google-code-prettify/${version.org.webjars.bower.google-code-prettify}</directory>\n                  <includes>\n                    <include>bin/**</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-bootstrap-select-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/bootstrap-select</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/bootstrap-select/META-INF/resources/webjars/bootstrap-select/${version.org.webjars.bower.bootstrap-select}/dist</directory>\n                  <includes>\n                    <include>**</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-moment-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/moment</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/moment/META-INF/resources/webjars/moment/${version.org.webjars.bower.moment}/min/</directory>\n                  <includes>\n                    <include>moment-with-locales.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-moment-timezone-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/moment-timezone</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/moment-timezone/META-INF/resources/webjars/moment-timezone/${version.org.webjars.bower.moment-timezone}/builds/</directory>\n                  <includes>\n                    <include>moment-timezone-with-data-2012-2022.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-bootstrap-daterangepicker-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/bootstrap-daterangepicker</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/bootstrap-daterangepicker/META-INF/resources/webjars/bootstrap-daterangepicker/${version.org.webjars.bower.bootstrap-daterangepicker}/</directory>\n                  <includes>\n                    <include>daterangepicker.css</include>\n                    <include>daterangepicker.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-d3-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/d3</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/d3/META-INF/resources/webjars/d3/${version.org.webjars.bower.d3js}/</directory>\n                  <includes>\n                    <include>d3.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n          <execution>\n            <id>copy-monaco-resources</id>\n            <phase>process-resources</phase>\n            <goals>\n              <goal>copy-resources</goal>\n            </goals>\n            <configuration>\n              <outputDirectory>${project.build.outputDirectory}/org/uberfire/client/views/static/appformer-js-monaco/</outputDirectory>\n              <resources>\n                <resource>\n                  <directory>${project.build.directory}/appformer-js-monaco/META-INF/resources/webjars/appformer-js-monaco/${uberfire.version}/monaco-editor</directory>\n                  <includes>\n                    <include>monaco.min.js</include>\n                  </includes>\n                </resource>\n              </resources>\n            </configuration>\n          </execution>\n        </executions>\n      </plugin>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-surefire-plugin</artifactId>\n        <configuration>\n          <additionalClasspathElements>\n            <additionalClasspathElement>${basedir}/${profile.testOutputDirectory}/</additionalClasspathElement>\n            <additionalClasspathElement>${basedir}/src/main/java/</additionalClasspathElement>\n            <additionalClasspathElement>${basedir}/src/main/resources/</additionalClasspathElement>\n            <additionalClasspathElement>${basedir}/src/test/java/</additionalClasspathElement>\n          </additionalClasspathElements>\n          <useManifestOnlyJar>false</useManifestOnlyJar>\n          <forkMode>pertest</forkMode>\n          <!-- DO NOT REMOVE THE errai.ioc.experimental.infer_dependent_by_reachability\n            flag or the testsuite WILL fail. -->\n          <argLine>-Xmx1500m -Derrai.devel.nocache=true -Derrai.hosted_mode_testing=true -Derrai.ioc.experimental.infer_dependent_by_reachability=true -Dorg.jboss.errai.bus.do_long_poll=false</argLine>\n\n          <systemProperties>\n            <!-- Must disable long polling for automated tests to succeed -->\n            <property>\n              <name>errai.hosted_mode_testing</name>\n              <value>true</value>\n            </property>\n          </systemProperties>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/HTML5DndSeleniumSupport.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\n\n/**\n * This class is developed to provide an temporary HTML5 DnD API for Selenium.\n * Unfortunately, Selenium lack of support for HTML5 DnD.\n * https://code.google.com/p/selenium/issues/detail?id=3604\n *\n * Usage: $('#origin').simulateDragDrop({ dropTarget: '#target'});\n *\n */\n@EntryPoint\npublic class HTML5DndSeleniumSupport {\n\n    /*\n     * Ensures that JQuery is loaded before this runs.\n     */\n    @Inject\n    private PatternFlyEntryPoint entryPoint;\n\n    @PostConstruct\n    public void init() {\n        prepareDnd(this);\n    }\n\n    private native void prepareDnd(HTML5DndSeleniumSupport js)/*-{\n        (function ($) {\n            $.fn.simulateDragDrop = function (options) {\n                return this.each(function () {\n                    new $.simulateDragDrop(this, options);\n                });\n            };\n            $.simulateDragDrop = function (elem, options) {\n                this.options = options;\n                this.simulateEvent(elem, options);\n            };\n            $.extend($.simulateDragDrop.prototype, {\n                simulateEvent: function (elem, options) {\n                    var type = 'dragstart';\n                    var event = this.createEvent(type);\n                    this.dispatchEvent(elem, type, event);\n                    type = 'drop';\n                    var dropEvent = this.createEvent(type, {});\n                    dropEvent.dataTransfer = event.dataTransfer;\n                    this.dispatchEvent($(options.dropTarget)[0], type, dropEvent);\n                    type = 'dragend';\n                    var dragEndEvent = this.createEvent(type, {});\n                    dragEndEvent.dataTransfer = event.dataTransfer;\n                    this.dispatchEvent(elem, type, dragEndEvent);\n                },\n                createEvent: function (type) {\n                    var event = document.createEvent(\"CustomEvent\");\n                    event.initCustomEvent(type, true, true, null);\n                    event.dataTransfer = {\n                        data: {},\n                        setData: function (type, val) {\n                            this.data[type] = val;\n                        },\n                        getData: function (type) {\n                            return this.data[type];\n                        }\n                    };\n                    return event;\n                },\n                dispatchEvent: function (elem, type, event) {\n                    if (elem.dispatchEvent) {\n                        elem.dispatchEvent(event);\n                    } else if (elem.fireEvent) {\n                        elem.fireEvent(\"on\" + type, event);\n                    }\n                }\n            });\n        })($wnd.jQuery);\n    }-*/;\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/PatternFlyEntryPoint.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly;\n\nimport javax.annotation.PostConstruct;\n\nimport org.jboss.errai.ioc.client.api.EntryPoint;\nimport org.jboss.errai.ui.shared.api.annotations.Bundle;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\n\n@EntryPoint\n@Bundle(\"resources/i18n/Constants.properties\")\npublic class PatternFlyEntryPoint {\n\n    @PostConstruct\n    public void init() {\n        PatternFlyBootstrapper.ensurePatternFlyIsAvailable();\n    }\n\n    public native String getPatternFlyVersion()/*-{\n        return $wnd.patternfly.version;\n    }-*/;\n\n    public native String getMomentLocale()/*-{\n        return $wnd.moment.locale();\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/dnd/CompassWidgetImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.dnd;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.allen_sauer.gwt.dnd.client.DragContext;\nimport com.allen_sauer.gwt.dnd.client.VetoDragException;\nimport com.allen_sauer.gwt.dnd.client.util.CoordinateArea;\nimport com.allen_sauer.gwt.dnd.client.util.CoordinateLocation;\nimport com.allen_sauer.gwt.dnd.client.util.Location;\nimport com.allen_sauer.gwt.dnd.client.util.WidgetArea;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.Element;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.dom.client.Style.Display;\nimport com.google.gwt.dom.client.Style.Unit;\nimport com.google.gwt.dom.client.Style.Visibility;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.DockLayoutPanel;\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.workbench.widgets.dnd.CompassWidget;\nimport org.uberfire.workbench.model.CompassPosition;\nimport org.uberfire.workbench.model.Position;\n\n/**\n * A pop-up widget with arrows in the four cardinal directions, each of which is a separate drop target. The center of\n * the widget is a fifth drop target representing the parent widget itself. The compass centers itself over its parent's\n * Drop Target when displayed.\n */\n@ApplicationScoped\npublic class CompassWidgetImpl implements CompassWidget {\n\n    public static final String FA_ACTIVE = \"fa-active\";\n    private static CompassWidgetBinder uiBinder = GWT.create(CompassWidgetBinder.class);\n    @UiField\n    DockLayoutPanel container;\n    @UiField\n    PopupPanel popup;\n    @UiField\n    Widget south;\n    @UiField\n    Widget north;\n    @UiField\n    Widget west;\n    @UiField\n    Widget east;\n    @UiField\n    Widget centre;\n    private Element dropTargetHighlight;\n    private CompassPosition dropTargetPosition = CompassPosition.NONE;\n\n    @PostConstruct\n    private void init() {\n        popup = uiBinder.createAndBindUi(this);\n\n        //Setup drop indicator\n        if (dropTargetHighlight == null) {\n            dropTargetHighlight = Document.get().createDivElement();\n            dropTargetHighlight.getStyle().setPosition(Style.Position.ABSOLUTE);\n            dropTargetHighlight.getStyle().setVisibility(Visibility.HIDDEN);\n            dropTargetHighlight.setClassName(WorkbenchResources.INSTANCE.CSS().dropTargetHighlight());\n            Document.get().getBody().appendChild(dropTargetHighlight);\n        }\n\n        north.ensureDebugId(\"CompassWidget-north\");\n        south.ensureDebugId(\"CompassWidget-south\");\n        east.ensureDebugId(\"CompassWidget-east\");\n        west.ensureDebugId(\"CompassWidget-west\");\n        centre.ensureDebugId(\"CompassWidget-centre\");\n    }\n\n    @Override\n    public void onEnter(DragContext context) {\n        show(context);\n    }\n\n    @Override\n    public void onLeave(DragContext context) {\n        popup.hide();\n    }\n\n    @Override\n    public void onMove(DragContext context) {\n        final Location l = new CoordinateLocation(context.mouseX,\n                                                  context.mouseY);\n        final WidgetArea northWidgetArea = new WidgetArea(north,\n                                                          null);\n        final WidgetArea southWidgetArea = new WidgetArea(south,\n                                                          null);\n        final WidgetArea eastWidgetArea = new WidgetArea(east,\n                                                         null);\n        final WidgetArea westWidgetArea = new WidgetArea(west,\n                                                         null);\n        final WidgetArea centreWidgetArea = new WidgetArea(centre,\n                                                           null);\n        CompassPosition p = CompassPosition.NONE;\n        if (northWidgetArea.intersects(l)) {\n            p = CompassPosition.NORTH;\n        } else if (southWidgetArea.intersects(l)) {\n            p = CompassPosition.SOUTH;\n        } else if (eastWidgetArea.intersects(l)) {\n            p = CompassPosition.EAST;\n        } else if (westWidgetArea.intersects(l)) {\n            p = CompassPosition.WEST;\n        } else if (centreWidgetArea.intersects(l)) {\n            p = CompassPosition.SELF;\n        }\n        if (p != dropTargetPosition) {\n            dropTargetPosition = p;\n            showDropTarget(context,\n                           p);\n        }\n    }\n\n    @Override\n    public Position getDropPosition() {\n        return this.dropTargetPosition;\n    }\n\n    @Override\n    public Widget getDropTarget() {\n        throw new UnsupportedOperationException();\n    }\n\n    @Override\n    public void onDrop(DragContext context) {\n        this.dropTargetPosition = CompassPosition.NONE;\n        highlightActiveDropTarget(null);\n        hideDropTarget();\n    }\n\n    @Override\n    public void onPreviewDrop(DragContext context) throws VetoDragException {\n        throw new UnsupportedOperationException();\n    }\n\n    private void show(final DragContext context) {\n\n        //Get centre of DropTarget\n        final Widget dropTargetParent = context.dropController.getDropTarget();\n        int cxmin = dropTargetParent.getElement().getAbsoluteLeft();\n        int cymin = dropTargetParent.getElement().getAbsoluteTop();\n        int cxmax = dropTargetParent.getElement().getAbsoluteRight();\n        int cymax = dropTargetParent.getElement().getAbsoluteBottom();\n\n        final CoordinateArea ca = new CoordinateArea(cxmin,\n                                                     cymin,\n                                                     cxmax,\n                                                     cymax);\n\n        //Display Compass if not already visible\n        if (!popup.isAttached()) {\n            popup.setPopupPositionAndShow(new PopupPanel.PositionCallback() {\n\n                @Override\n                public void setPosition(int offsetWidth,\n                                        int offsetHeight) {\n                    popup.setPopupPosition(ca.getCenter().getLeft() - (offsetWidth / 2),\n                                           ca.getCenter().getTop() - (offsetHeight / 2));\n                }\n            });\n        } else {\n            popup.setPopupPosition(ca.getCenter().getLeft() - (popup.getOffsetWidth() / 2),\n                                   ca.getCenter().getTop() - (popup.getOffsetHeight() / 2));\n        }\n    }\n\n    private void showDropTarget(final DragContext context,\n                                final CompassPosition p) {\n        int x = 0;\n        int y = 0;\n        int width = 0;\n        int height = 0;\n        final Widget dropTargetParent = context.dropController.getDropTarget();\n        switch (p) {\n            case SELF:\n                x = dropTargetParent.getAbsoluteLeft();\n                y = dropTargetParent.getAbsoluteTop();\n                width = dropTargetParent.getOffsetWidth();\n                height = dropTargetParent.getOffsetHeight();\n                highlightActiveDropTarget(centre);\n                showDropTarget(x,\n                               y,\n                               width,\n                               height);\n                break;\n            case NORTH:\n                x = dropTargetParent.getAbsoluteLeft();\n                y = dropTargetParent.getAbsoluteTop();\n                width = dropTargetParent.getOffsetWidth();\n                height = (int) (dropTargetParent.getOffsetHeight() * 0.50);\n                highlightActiveDropTarget(north);\n                showDropTarget(x,\n                               y,\n                               width,\n                               height);\n                break;\n            case SOUTH:\n                x = dropTargetParent.getAbsoluteLeft();\n                height = (int) (dropTargetParent.getOffsetHeight() * 0.50);\n                y = dropTargetParent.getOffsetHeight() + dropTargetParent.getAbsoluteTop() - height;\n                width = dropTargetParent.getOffsetWidth();\n                highlightActiveDropTarget(south);\n                showDropTarget(x,\n                               y,\n                               width,\n                               height);\n                break;\n            case EAST:\n                width = (int) (dropTargetParent.getOffsetWidth() * 0.50);\n                x = dropTargetParent.getOffsetWidth() + dropTargetParent.getAbsoluteLeft() - width;\n                y = dropTargetParent.getAbsoluteTop();\n                height = dropTargetParent.getOffsetHeight();\n                highlightActiveDropTarget(east);\n                showDropTarget(x,\n                               y,\n                               width,\n                               height);\n                break;\n            case WEST:\n                x = dropTargetParent.getAbsoluteLeft();\n                y = dropTargetParent.getAbsoluteTop();\n                width = (int) (dropTargetParent.getOffsetWidth() * 0.50);\n                height = dropTargetParent.getOffsetHeight();\n                highlightActiveDropTarget(west);\n                showDropTarget(x,\n                               y,\n                               width,\n                               height);\n                break;\n            default:\n                highlightActiveDropTarget(null);\n                hideDropTarget();\n        }\n    }\n\n    private void highlightActiveDropTarget(final Widget target) {\n        south.removeStyleName(FA_ACTIVE);\n        north.removeStyleName(FA_ACTIVE);\n        west.removeStyleName(FA_ACTIVE);\n        east.removeStyleName(FA_ACTIVE);\n        centre.removeStyleName(FA_ACTIVE);\n        if (target != null) {\n            target.addStyleName(FA_ACTIVE);\n        }\n    }\n\n    private void showDropTarget(int x,\n                                int y,\n                                int width,\n                                int height) {\n        dropTargetHighlight.getStyle().setLeft(x,\n                                               Unit.PX);\n        dropTargetHighlight.getStyle().setWidth(width,\n                                                Unit.PX);\n        dropTargetHighlight.getStyle().setTop(y,\n                                              Unit.PX);\n        dropTargetHighlight.getStyle().setHeight(height,\n                                                 Unit.PX);\n        dropTargetHighlight.getStyle().setVisibility(Visibility.VISIBLE);\n        dropTargetHighlight.getStyle().setDisplay(Display.BLOCK);\n    }\n\n    private void hideDropTarget() {\n        dropTargetHighlight.getStyle().setVisibility(Visibility.HIDDEN);\n        dropTargetHighlight.getStyle().setDisplay(Display.NONE);\n        dropTargetPosition = CompassPosition.NONE;\n    }\n\n    interface CompassWidgetBinder extends UiBinder<PopupPanel, CompassWidgetImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/dnd/CompassWidgetImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:h=\"urn:import:org.gwtbootstrap3.client.ui.html\">\n\n    <g:PopupPanel ui:field=\"popup\" addStyleNames=\"uf-drop-target-compass\" width=\"100px\" height=\"100px\">\n        <g:DockLayoutPanel ui:field=\"container\" unit=\"PCT\">\n            <g:south size=\"25\">\n                <h:Div ui:field=\"south\" addStyleNames=\"uf-drop-target-compass-south\">\n                    <b:Icon type=\"CHEVRON_DOWN\"/>\n                </h:Div>\n            </g:south>\n            <g:north size=\"25\">\n                <h:Div ui:field=\"north\" addStyleNames=\"uf-drop-target-compass-north\">\n                    <b:Icon type=\"CHEVRON_UP\"/>\n                </h:Div>\n            </g:north>\n            <g:west size=\"30\">\n                <h:Div ui:field=\"west\" addStyleNames=\"uf-drop-target-compass-west\">\n                    <b:Icon type=\"CHEVRON_LEFT\"/>\n                </h:Div>\n            </g:west>\n            <g:east size=\"30\">\n                <h:Div ui:field=\"east\" addStyleNames=\"uf-drop-target-compass-east\">\n                    <b:Icon type=\"CHEVRON_RIGHT\"/>\n                </h:Div>\n            </g:east>\n            <g:center>\n                <h:Div ui:field=\"centre\" addStyleNames=\"uf-drop-target-compass-centre\">\n                    <b:Icon type=\"SQUARE\" size=\"LARGE\"/>\n                </h:Div>\n            </g:center>\n        </g:DockLayoutPanel>\n    </g:PopupPanel>\n\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/dropdown/ListDropdown.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.dropdown;\n\nimport java.util.Iterator;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.DropDown;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.ListItem;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\n\n/**\n * Utility component for creating dropdown menus.\n * It also allows to determine if dropdown should shown when there is a single element in the list.\n */\npublic class ListDropdown extends DropDown {\n\n    protected Button button = GWT.create(Button.class);\n    protected DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n    protected boolean hideOnSingleElement = true;\n\n    public ListDropdown() {\n        super.add(button);\n        super.add(dropDownMenu);\n        button.setType(ButtonType.LINK);\n        this.addStyleName(\"uf-list-dropdown\");\n    }\n\n    @Override\n    public void add(final Widget child) {\n        if (child instanceof ListItem) {\n            dropDownMenu.add(child);\n            addCaretToText();\n        }\n    }\n\n    public void setText(final Widget text) {\n        removeChildWidgets(button);\n        button.add(text);\n        addCaretToText();\n    }\n\n    @Override\n    public boolean remove(final Widget w) {\n        final boolean remove = dropDownMenu.remove(w);\n        addCaretToText();\n        return remove;\n    }\n\n    public void setHideOnSingleElement(boolean hide) {\n        this.hideOnSingleElement = hide;\n    }\n\n    @Override\n    public void clear() {\n        removeChildWidgets(button);\n        removeChildWidgets(dropDownMenu);\n    }\n\n    private void removeChildWidgets(final ComplexPanel panel) {\n        final Iterator<Widget> iterator = panel.iterator();\n        while (iterator.hasNext()) {\n            iterator.next();\n            iterator.remove();\n        }\n    }\n\n    /**\n     * Checks whether or not caret should be added/removed\n     */\n    protected void addCaretToText() {\n        if (hideOnSingleElement && dropDownMenu.getWidgetCount() == 1) {\n            button.setToggleCaret(false);\n            button.setDataToggle(null);\n            this.removeStyleName(\"open\");\n            toggleStyles(true);\n        } else if ((dropDownMenu.getWidgetCount() > 1 || hideOnSingleElement == false && dropDownMenu.getWidgetCount() == 1)) {\n            button.setToggleCaret(true);\n            button.setDataToggle(Toggle.DROPDOWN);\n            button.setDataTargetWidget(this);\n            toggleStyles(false);\n        }\n    }\n\n    private void toggleStyles(boolean single) {\n        this.removeStyleName(\"uf-list-dropdown-single\");\n        this.removeStyleName(\"uf-list-dropdown-multi\");\n        this.addStyleName(single ? \"uf-list-dropdown-single\" : \"uf-list-dropdown-multi\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/icon/PatternFlyIconType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.icon;\n\nimport com.google.gwt.dom.client.Style;\nimport org.gwtbootstrap3.client.ui.base.helper.EnumHelper;\nimport org.gwtbootstrap3.client.ui.constants.Type;\n\n/**\n * You can use the patternfly icons\n */\npublic enum PatternFlyIconType implements Type,\n                                          Style.HasCssName {\n    ADD_CIRCLE_O(\"pficon-add-circle-o\"),\n    CLOSE(\"pficon-close\"),\n    CLUSTER(\"pficon-cluster\"),\n    CONTAINER_NODE(\"pficon-container-node\"),\n    DELETE(\"pficon-delete\"),\n    EDIT(\"pficon-edit\"),\n    ERROR_CIRCLE_O(\"pficon-error-circle-o\"),\n    EXPORT(\"pficon-export\"),\n    FLAG(\"pficon-flag\"),\n    FOLDER_CLOSE(\"pficon-folder-close\"),\n    FOLDER_OPEN(\"pficon-folder-open\"),\n    HELP(\"pficon-help\"),\n    HOME(\"pficon-home\"),\n    HISTORY(\"pficon-history\"),\n    IMAGE(\"pficon-image\"),\n    IMPORT(\"pficon-import\"),\n    INFO(\"pficon-info\"),\n    KUBERNETES(\"pficon-kubernetes\"),\n    OK(\"pficon-ok\"),\n    OPENSHIFT(\"pficon-openshift\"),\n    PRINT(\"pficon-print\"),\n    PROJECT(\"pficon-project\"),\n    REGISTRY(\"pficon-registry\"),\n    REPLICATOR(\"pficon-replicator\"),\n    RESTART(\"pficon-restart\"),\n    ROUTE(\"pficon-route\"),\n    RUNNING(\"pficon-running\"),\n    SAVE(\"pficon-save\"),\n    SCREEN(\"pficon-screen\"),\n    SERVICE(\"pficon-service\"),\n    SETTINGS(\"pficon-settings\"),\n    USER(\"pficon-user\"),\n    USERS(\"pficon-users\"),\n    WARNING_TRIANGLE_O(\"pficon-warning-triangle-o\");\n\n    private final String cssClass;\n\n    PatternFlyIconType(final String cssClass) {\n        this.cssClass = cssClass;\n    }\n\n    public static PatternFlyIconType fromStyleName(final String styleName) {\n        return EnumHelper.fromStyleName(styleName,\n                                        PatternFlyIconType.class,\n                                        null);\n    }\n\n    @Override\n    public String getCssName() {\n        return cssClass;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/listbar/ListBarWidgetImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.listbar;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.event.logical.shared.BeforeSelectionEvent;\nimport com.google.gwt.event.logical.shared.BeforeSelectionHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.FocusPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeComposite;\nimport com.google.gwt.user.client.ui.Widget;\nimport elemental2.dom.HTMLElement;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.Panel;\nimport org.gwtbootstrap3.client.ui.PanelBody;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport org.jboss.errai.ioc.client.container.IOCResolutionException;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.views.pfly.maximize.MaximizeToggleButton;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.client.workbench.widgets.listbar.ListBarWidget;\nimport org.uberfire.client.workbench.widgets.listbar.ListbarPreferences;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFocusPanel;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\nimport static com.google.gwt.dom.client.Style.Display.BLOCK;\nimport static com.google.gwt.dom.client.Style.Display.NONE;\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n/**\n * Implementation of ListBarWidget based on PatternFly components.\n */\n@Dependent\npublic class ListBarWidgetImpl\n        extends ResizeComposite implements ListBarWidget {\n\n    private static ListBarWidgetBinder uiBinder = GWT.create(ListBarWidgetBinder.class);\n    final Map<PartDefinition, FlowPanel> partContentView = new HashMap<PartDefinition, FlowPanel>();\n    /**\n     * Preferences bean that applications can optionally provide. If this injection is unsatisfied, default settings are used.\n     */\n    @Inject\n    Instance<ListbarPreferences> optionalListBarPrefs;\n\n    @Inject\n    PanelManager panelManager;\n    @UiField\n    FocusPanel container;\n    @UiField\n    PartListDropdown titleDropDown;\n    @UiField\n    PanelHeader header;\n    @UiField\n    Panel panel;\n    @UiField\n    ButtonGroup contextMenu;\n    @UiField\n    Button closeButton;\n    @UiField\n    ButtonGroup toolBar;\n    @UiField\n    MaximizeToggleButton maximizeButton;\n    /**\n     * Wraps maximizeButton, which is the view.\n     */\n    MaximizeToggleButtonPresenter maximizeButtonPresenter;\n    @UiField\n    PanelBody content;\n    WorkbenchPanelPresenter presenter;\n    LinkedList<PartDefinition> parts = new LinkedList<>();\n    Pair<PartDefinition, FlowPanel> currentPart;\n    @Inject\n    private AuthorizationManager authzManager;\n    @Inject\n    private User identity;\n\n    @PostConstruct\n    void postConstruct() {\n        initWidget(uiBinder.createAndBindUi(this));\n        maximizeButtonPresenter = new MaximizeToggleButtonPresenter(maximizeButton);\n        titleDropDown.setHideOnSingleElement(getListbarPreferences().isHideTitleDropDownOnSingleElement());\n        setupEventHandlers();\n\n        Layouts.setToFillParent(this);\n        scheduleResize();\n    }\n\n    void setupEventHandlers() {\n        this.container.addMouseOutHandler(event -> titleDropDown.removeStyleName(\"open\"));\n\n        this.container.addFocusHandler(event -> {\n            if (currentPart != null && currentPart.getK1() != null) {\n                selectPart(currentPart.getK1());\n            }\n        });\n\n        this.maximizeButton.addClickHandler(event -> {\n            if (maximizeButton.isMaximized()) {\n                panelManager.onPartMaximized(currentPart.getK1());\n            } else {\n                panelManager.onPartMinimized(currentPart.getK1());\n            }\n        });\n\n        closeButton.addClickHandler(event -> {\n            if (currentPart != null) {\n                if (maximizeButton.isMaximized()) {\n                    panelManager.onPartMinimized(currentPart.getK1());\n                }\n                panelManager.closePart(currentPart.getK1());\n            }\n        });\n\n        titleDropDown.addSelectionHandler(event -> selectPart(event.getSelectedItem()));\n\n        titleDropDown.addCloseHandler(event -> panelManager.closePart(event.getTarget()));\n    }\n\n    ListbarPreferences getListbarPreferences() {\n        try {\n            return optionalListBarPrefs.isUnsatisfied() ? new ListbarPreferences() : optionalListBarPrefs.get();\n        } catch (IOCResolutionException e) {\n            return new ListbarPreferences();\n        }\n    }\n\n    @Override\n    public void enableDnd() {\n        titleDropDown.enableDragAndDrop();\n    }\n\n    @Override\n    public void disableDnd() {\n        titleDropDown.disableDragAndDrop();\n    }\n\n    @Override\n    public void setPresenter(final WorkbenchPanelPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setDndManager(final WorkbenchDragAndDropManager dndManager) {\n        this.titleDropDown.setDndManager(dndManager);\n    }\n\n    @Override\n    public void clear() {\n        contextMenu.clear();\n        header.setVisible(false);\n        content.clear();\n\n        parts.clear();\n        partContentView.clear();\n        titleDropDown.clear();\n        currentPart = null;\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        final PartDefinition partDefinition = view.getPresenter().getDefinition();\n        if (parts.contains(partDefinition)) {\n            selectPart(partDefinition);\n            return;\n        }\n\n        parts.addFirst(partDefinition);\n\n        final FlowPanel panel = new FlowPanel();\n        setupCSSLocators(view,\n                         panel);\n        Layouts.setToFillParent(panel);\n        panel.add(view);\n        content.add(panel);\n\n        // IMPORTANT! if you change what goes in this map, update the remove(PartDefinition) method\n        partContentView.put(partDefinition,\n                            panel);\n\n        if (partDefinition.isSelectable()) {\n            titleDropDown.addPart(view);\n        }\n\n        header.setVisible(true);\n\n        resizePanelBody();\n        scheduleResize();\n    }\n\n    void setupCSSLocators(WorkbenchPartPresenter.View view,\n                                  FlowPanel panel) {\n        if (view.getPresenter() != null || view.getPresenter().getTitle() != null) {\n            panel.getElement().addClassName(CSSLocatorsUtils.buildLocator(\"qe-list-bar-content\",\n                                                                          view.getPresenter().getTitle()));\n        }\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        if (part.isSelectable()) {\n            titleDropDown.changeTitle(part,\n                                      title,\n                                      titleDecoration);\n        }\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        if (!parts.contains(part)) {\n            //not necessary to check if current is part\n            return false;\n        }\n\n        if (currentPart != null) {\n            if (currentPart.getK1().equals(part)) {\n                return true;\n            }\n            parts.addFirst(currentPart.getK1());\n            panelManager.onPartHidden(currentPart.getK1());\n            currentPart.getK2().getElement().getStyle().setDisplay(NONE);\n        }\n\n        currentPart = Pair.newPair(part,\n                                   partContentView.get(part));\n        currentPart.getK2().getElement().getStyle().setDisplay(BLOCK);\n        parts.remove(currentPart.getK1());\n\n        if (part.isSelectable()) {\n            titleDropDown.selectPart(part);\n            setupContextMenu();\n            header.setVisible(true);\n        } else {\n            header.setVisible(false);\n        }\n\n        scheduleResize();\n        resizePanelBody();\n\n        SelectionEvent.fire(ListBarWidgetImpl.this,\n                            part);\n\n        return true;\n    }\n\n    void setupContextMenu() {\n        contextMenu.clear();\n        final WorkbenchPartPresenter.View part = (WorkbenchPartPresenter.View) currentPart.getK2().getWidget(0);\n        part.getPresenter().getMenus(menus -> {\n            if (menus != null && menus.getItems().size() > 0) {\n                for (final MenuItem menuItem : menus.getItems()) {\n                    final Widget result = makeItem(menuItem,\n                                                   true);\n                    if (result != null) {\n                        contextMenu.add(result);\n                    }\n                }\n            }\n            contextMenu.setVisible(contextMenu.getWidgetCount() > 0);\n        });\n    }\n\n    @Override\n    public boolean remove(final PartDefinition part) {\n        if (part.isSelectable()) {\n            titleDropDown.removePart(part);\n        }\n\n        if (currentPart != null && currentPart.getK1().asString().equals(part.asString())) {\n            PartDefinition nextPart = getNextPart(part);\n\n            if (nextPart != null) {\n                presenter.selectPart(nextPart);\n            } else {\n                panelManager.onPartHidden(currentPart.getK1());\n                clear();\n            }\n        }\n\n        boolean removed = parts.remove(part);\n        FlowPanel view = partContentView.remove(part);\n        if (view != null) {\n            // FIXME null check should not be necessary, but sometimes the entry in partContentView is missing!\n            content.remove(view);\n        }\n\n        if (currentPart == null) {\n            header.setVisible(false);\n        }\n\n        resizePanelBody();\n        scheduleResize();\n\n        return removed;\n    }\n\n    PartDefinition getNextPart(PartDefinition currentSelectedPart) {\n        PartDefinition nextPart = null;\n        for (PartDefinition p : getUnselectedParts()) {\n            if (!currentSelectedPart.asString().equals(p.asString())) {\n                if (nextPart == null || p.isSelectable()) {\n                    nextPart = p;\n                }\n\n                if (p.isSelectable()) {\n                    break;\n                }\n            }\n        }\n        return nextPart;\n    }\n\n    @Override\n    public void setFocus(final boolean hasFocus) {\n    }\n\n    @Override\n    public void addOnFocusHandler(final Command command) {\n    }\n\n    @Override\n    public int getPartsSize() {\n        if (currentPart == null) {\n            return 0;\n        }\n        return parts.size() + 1;\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        if (currentPart == null) {\n            return parts;\n        }\n\n        LinkedList<PartDefinition> allParts = new LinkedList<>();\n        allParts.addAll(parts);\n        allParts.addFirst(currentPart.getK1());\n\n        return Collections.unmodifiableList(allParts);\n    }\n\n    @Override\n    public HandlerRegistration addBeforeSelectionHandler(final BeforeSelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          BeforeSelectionEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    @Override\n    public void onResize() {\n        if (!isAttached()) {\n            return;\n        }\n\n        super.onResize();\n\n        // FIXME only need to do this for the one visible part .. need to call onResize() when switching parts anyway\n        for (int i = 0; i < content.getWidgetCount(); i++) {\n            final FlowPanel container = (FlowPanel) content.getWidget(i);\n            final Widget containedWidget = container.getWidget(0);\n            if (containedWidget instanceof RequiresResize) {\n                ((RequiresResize) containedWidget).onResize();\n            }\n        }\n    }\n\n    protected Widget makeItem(final MenuItem item,\n                              boolean isRoot) {\n\n        Widget[] menuWidget = new Widget[]{null};\n        item.accept(new AuthFilterMenuVisitor(authzManager,\n                                              identity,\n                                              new BaseMenuVisitor() {\n\n                                                  @Override\n                                                  public boolean visitEnter(MenuGroup menuGroup) {\n                                                      menuWidget[0] = makeMenuGroup(menuGroup,\n                                                                                    isRoot);\n                                                      return false;\n                                                  }\n\n                                                  @Override\n                                                  public void visit(MenuItemCommand menuItemCommand) {\n                                                      menuWidget[0] = makeMenuItemCommand(menuItemCommand,\n                                                                                          isRoot);\n                                                  }\n\n                                                  @Override\n                                                  public void visit(MenuCustom<?> menuCustom) {\n                                                      menuWidget[0] = makeMenuCustom(menuCustom);\n                                                  }\n                                              }));\n        return menuWidget[0];\n    }\n\n    private Widget makeMenuItemCommand(final MenuItemCommand cmdItem,\n                                       final boolean isRoot) {\n        if (isRoot) {\n            final Button button = GWT.create(Button.class);\n            button.setText(cmdItem.getCaption());\n            button.setSize(ButtonSize.SMALL);\n            button.setEnabled(cmdItem.isEnabled());\n            button.addClickHandler(event -> cmdItem.getCommand().execute());\n            cmdItem.addEnabledStateChangeListener(button::setEnabled);\n            return button;\n        } else {\n            final AnchorListItem navbarLink = GWT.create(AnchorListItem.class);\n            navbarLink.setText(cmdItem.getCaption());\n            if (!cmdItem.isEnabled()) {\n                navbarLink.addStyleName(\"disabled\");\n            }\n            navbarLink.addClickHandler(event -> cmdItem.getCommand().execute());\n            cmdItem.addEnabledStateChangeListener(enabled -> {\n                if (enabled) {\n                    navbarLink.removeStyleName(\"disabled\");\n                } else {\n                    navbarLink.addStyleName(\"disabled\");\n                }\n            });\n            return navbarLink;\n        }\n    }\n\n    private Widget makeMenuGroup(final MenuGroup groups,\n                                 final boolean isRoot) {\n        if (isRoot) {\n            final List<Widget> widgetList = new ArrayList<>();\n            for (final MenuItem _item : ensureIterable(groups.getItems())) {\n                final Widget widget = makeItem(_item,\n                                               false);\n                if (widget != null) {\n                    widgetList.add(widget);\n                }\n            }\n            if (widgetList.isEmpty()) {\n                return null;\n            }\n            return makeDropDownMenuButton(groups.getCaption(),\n                                          widgetList);\n        } else {\n            final List<Widget> widgetList = new ArrayList<>();\n            for (final MenuItem _item : groups.getItems()) {\n                final Widget result = makeItem(_item,\n                                               false);\n                if (result != null) {\n                    widgetList.add(result);\n                }\n            }\n            if (widgetList.isEmpty()) {\n                return null;\n            }\n            return makeDropDownMenuButton(groups.getCaption(),\n                                          widgetList);\n        }\n    }\n\n    private Widget makeMenuCustom(final MenuCustom item) {\n        final Object result = item.build();\n        if (result instanceof Widget) {\n            return (Widget) result;\n        }\n        if (result instanceof HTMLElement) {\n            return ElementWrapperWidget.getWidget((HTMLElement) result);\n        }\n        return null;\n    }\n\n    private Widget makeDropDownMenuButton(final String caption,\n                                          final List<Widget> widgetList) {\n        final ButtonGroup buttonGroup = GWT.create(ButtonGroup.class);\n        final Button dropdownButton = GWT.create(Button.class);\n        dropdownButton.setText(caption);\n        dropdownButton.setDataToggle(Toggle.DROPDOWN);\n        dropdownButton.setSize(ButtonSize.SMALL);\n        final DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n        dropDownMenu.setPull(Pull.RIGHT);\n        for (final Widget _item : widgetList) {\n            dropDownMenu.add(_item);\n        }\n        buttonGroup.add(dropdownButton);\n        buttonGroup.add(dropDownMenu);\n        return buttonGroup;\n    }\n\n    private void scheduleResize() {\n        Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n            @Override\n            public void execute() {\n                onResize();\n            }\n        });\n    }\n\n    void resizePanelBody() {\n        //When an Item is added to the PanelHeader recalculate the PanelBody size.\n        //This cannot be performed in either the @PostConstruct or onAttach() methods as at\n        //these times the PanelHeader may not have any content and hence have no size.\n        if (currentPart != null && !currentPart.getK1().isSelectable()) {\n            content.getElement().getStyle().setProperty(\"height\",\n                                                        \"100%\");\n        } else {\n            content.getElement().getStyle().setProperty(\"height\",\n                                                        \"calc(100% - \" + header.getOffsetHeight() + \"px)\");\n        }\n    }\n\n    /**\n     * Returns the toggle button, that can be used to trigger maximizing and unmaximizing\n     * of the panel containing this list bar. Make the button visible by calling {@link Widget#setVisible(boolean)}\n     * and set its maximize and unmaximize actions with {@link MaximizeToggleButton#setMaximizeCommand(Command)} and\n     * {@link MaximizeToggleButton#setUnmaximizeCommand(Command)}.\n     */\n    @Override\n    public MaximizeToggleButtonPresenter getMaximizeButton() {\n        return maximizeButtonPresenter;\n    }\n\n    @Override\n    public boolean isDndEnabled() {\n        return this.titleDropDown.isDndEnabled();\n    }\n\n    @Override\n    public void enableClosePart() {\n        closeButton.setVisible(true);\n    }\n\n    @Override\n    public void disableClosePart() {\n        closeButton.setVisible(false);\n    }\n\n    @Override\n    public void disableExpandPart() {\n        maximizeButton.setVisible(false);\n    }\n\n    Collection<PartDefinition> getUnselectedParts() {\n        return parts;\n    }\n\n    interface ListBarWidgetBinder\n            extends\n            UiBinder<ResizeFocusPanel, ListBarWidgetImpl> {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/listbar/ListBarWidgetImpl.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:uf=\"urn:import:org.uberfire.client.workbench.widgets.listbar\"\n             xmlns:ufm=\"urn:import:org.uberfire.client.views.pfly.maximize\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:ufc=\"urn:import:org.uberfire.client.views.pfly.listbar\" xmlns:g=\"urn:import:com.google.gwt.user.client.ui\">\n\n    <ui:with field=\"res\" type=\"org.uberfire.client.resources.WorkbenchResources\"/>\n\n    <uf:ResizeFocusPanel ui:field=\"container\">\n        <b:Panel ui:field=\"panel\" addStyleNames=\"uf-listbar-panel\">\n            <b:PanelHeader ui:field=\"header\" addStyleNames=\"uf-listbar-panel-header\" visible=\"false\">\n                <ufc:PartListDropdown ui:field=\"titleDropDown\" addStyleNames=\"uf-listbar-panel-header-title\"/>\n                <g:FlowPanel ui:field=\"toolbarHeader\" addStyleNames=\"uf-listbar-panel-header-toolbar\">\n                    <b:ButtonToolBar>\n                        <b:ButtonGroup ui:field=\"contextMenu\"/>\n                        <b:ButtonGroup ui:field=\"toolBar\">\n                            <ufm:MaximizeToggleButton ui:field=\"maximizeButton\"/>\n                            <b:Button ui:field=\"closeButton\" icon=\"TIMES\" size=\"SMALL\"/>\n                        </b:ButtonGroup>\n                    </b:ButtonToolBar>\n                </g:FlowPanel>\n            </b:PanelHeader>\n            <b:PanelBody ui:field=\"content\"/>\n        </b:Panel>\n    </uf:ResizeFocusPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/listbar/PartListDropdown.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.listbar;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.dom.client.Document;\nimport com.google.gwt.dom.client.SpanElement;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.DragStartEvent;\nimport com.google.gwt.event.dom.client.DragStartHandler;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.logical.shared.HasCloseHandlers;\nimport com.google.gwt.event.logical.shared.HasSelectionHandlers;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Image;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.ListItem;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.client.util.CSSLocatorsUtils;\nimport org.uberfire.client.views.pfly.dropdown.ListDropdown;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.DragArea;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.workbench.model.PartDefinition;\n\npublic class PartListDropdown extends ListDropdown implements HasSelectionHandlers<PartDefinition>,\n                                                              HasCloseHandlers<PartDefinition> {\n\n    public static final String DEBUG_TITLE_PREFIX = \"PartList-title-\";\n\n    private Map<PartDefinition, ListItem> partOptions = new HashMap<PartDefinition, ListItem>();\n    private Map<PartDefinition, DragArea> partTitles = new HashMap<PartDefinition, DragArea>();\n    private Map<PartDefinition, WorkbenchPartPresenter.View> partView = new HashMap<PartDefinition, WorkbenchPartPresenter.View>();\n    private HandlerRegistration noDragHandler;\n    private WorkbenchDragAndDropManager dndManager;\n    private boolean dndEnabled = true;\n\n    public PartListDropdown() {\n        super();\n        this.addDomHandler(new NoMouseDownHandler(),\n                           MouseDownEvent.getType());\n    }\n\n    public void setDndManager(final WorkbenchDragAndDropManager dndManager) {\n        this.dndManager = dndManager;\n    }\n\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        final PartDefinition part = view.getPresenter().getDefinition();\n        partView.put(part,\n                     view);\n        buildWidgets(part,\n                     view.getPresenter().getTitle(),\n                     view.getPresenter().getTitleDecoration());\n\n        if (partTitles.size() == 1) {\n            selectPart(part);\n        }\n    }\n\n    private void buildWidgets(final PartDefinition part,\n                              final String partTitle,\n                              final IsWidget titleDecoration) {\n        if (partTitles.containsKey(part)) {\n            final DragArea title = partTitles.get(part);\n            title.getElement().getFirstChildElement().removeFromParent();\n            title.add(buildTitleTextWidget(partTitle,\n                                           titleDecoration));\n        } else {\n            final DragArea title = buildTitleWidget(partTitle,\n                                                    titleDecoration);\n            partTitles.put(part,\n                           title);\n        }\n\n        if (partOptions.containsKey(part)) {\n            final ListItem option = partOptions.get(part);\n            option.setText(partTitle);\n        } else {\n            final ListItem option = buildTitleDropdownMenuItem(partTitle,\n                                                               part);\n            partOptions.put(part,\n                            option);\n            this.add(option);\n        }\n    }\n\n    public void removePart(final PartDefinition part) {\n        partTitles.remove(part);\n        partView.remove(part);\n        final Widget option = partOptions.remove(part);\n        this.remove(option);\n    }\n\n    public void selectPart(final PartDefinition part) {\n        final Widget title = partTitles.get(part);\n        this.setText(title);\n        for (final Map.Entry<PartDefinition, ListItem> entry : partOptions.entrySet()) {\n            if (entry.getKey().asString().equals(part.asString())) {\n                entry.getValue().addStyleName(\"uf-part-list-dropdown-selected\");\n            } else {\n                entry.getValue().removeStyleName(\"uf-part-list-dropdown-selected\");\n            }\n        }\n        if (dndEnabled) {\n            makeDraggable(title,\n                          partView.get(part));\n        }\n    }\n\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        buildWidgets(part,\n                     title,\n                     titleDecoration);\n    }\n\n    private DragArea buildTitleWidget(final String title,\n                                      final IsWidget titleDecoration) {\n        final SpanElement spanElement = buildTitleTextWidget(title,\n                                                             titleDecoration);\n        final DragArea dragArea = new DragArea();\n        dragArea.add(spanElement);\n        dragArea.ensureDebugId(DEBUG_TITLE_PREFIX + title);\n        dragArea.addMouseDownHandler(new NoMouseDownHandler());\n        return dragArea;\n    }\n\n    private SpanElement buildTitleTextWidget(final String title,\n                                             final IsWidget titleDecoration) {\n        final SpanElement spanElement = Document.get().createSpanElement();\n        spanElement.addClassName(\"uf-listbar-panel-header-title-text\");\n        spanElement.addClassName(CSSLocatorsUtils.buildLocator(\"qe-list-bar-header\",\n                                                               title));\n        final String titleWidget = (titleDecoration instanceof Image) ? titleDecoration.toString() : \"\";\n        spanElement.setInnerHTML(titleWidget + \" \" + title.replaceAll(\" \",\n                                                                      \"\\u00a0\"));\n        spanElement.setTitle(title);\n        return spanElement;\n    }\n\n    private ListItem buildTitleDropdownMenuItem(final String title,\n                                                final PartDefinition part) {\n        final Span span = new Span();\n        span.add(new Text(title));\n        final ListItem li = new ListItem() {\n            @Override\n            public void setText(String text) {\n                span.clear();\n                span.add(new Text(text));\n            }\n        };\n        li.addDomHandler(new ClickHandler() {\n                             @Override\n                             public void onClick(ClickEvent event) {\n                                 SelectionEvent.fire(PartListDropdown.this,\n                                                     part);\n                             }\n                         },\n                         ClickEvent.getType());\n\n        final Icon icon = new Icon(IconType.TIMES);\n        icon.addDomHandler(new ClickHandler() {\n                               @Override\n                               public void onClick(ClickEvent event) {\n                                   CloseEvent.fire(PartListDropdown.this,\n                                                   part);\n                                   //Keep dropdown menu open when removing parts\n                                   boolean openMenu = PartListDropdown.this.getElement().hasClassName(\"open\");\n                                   if (openMenu) {\n                                       Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {\n                                           @Override\n                                           public void execute() {\n                                               PartListDropdown.this.getElement().addClassName(\"open\");\n                                           }\n                                       });\n                                   }\n                               }\n                           },\n                           ClickEvent.getType());\n        icon.addStyleName(Styles.PULL_RIGHT);\n        final Anchor anchor = new Anchor();\n        anchor.add(icon);\n        anchor.add(span);\n        li.add(anchor);\n        return li;\n    }\n\n    public void enableDragAndDrop() {\n        this.dndEnabled = true;\n        if (noDragHandler != null) {\n            noDragHandler.removeHandler();\n            noDragHandler = null;\n        }\n\n        for (final Map.Entry<PartDefinition, DragArea> entry : partTitles.entrySet()) {\n            final Widget title = entry.getValue();\n            final WorkbenchPartPresenter.View view = partView.get(entry.getKey());\n            makeDraggable(title,\n                          view);\n        }\n    }\n\n    void makeDraggable(final Widget title,\n                       final WorkbenchPartPresenter.View view) {\n        if (this.dndManager == null || this.dndEnabled == false) {\n            return;\n        }\n        dndManager.makeDraggable(view,\n                                 title);\n    }\n\n    public void disableDragAndDrop() {\n        this.dndEnabled = false;\n        // Prevent from dragging title element around\n        if (noDragHandler == null) {\n            noDragHandler = this.addDomHandler(new DragStartHandler() {\n                                                   @Override\n                                                   public void onDragStart(DragStartEvent event) {\n                                                       event.preventDefault();\n                                                   }\n                                               },\n                                               DragStartEvent.getType());\n        }\n    }\n\n    public boolean isDndEnabled() {\n        return dndEnabled;\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        partOptions.clear();\n        partTitles.clear();\n        partView.clear();\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler) {\n        return super.addHandler(handler,\n                                SelectionEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addCloseHandler(final CloseHandler<PartDefinition> handler) {\n        return super.addHandler(handler,\n                                CloseEvent.getType());\n    }\n\n    private class NoMouseDownHandler implements MouseDownHandler {\n\n        @Override\n        public void onMouseDown(MouseDownEvent event) {\n//              Prevents drag from propagating to text elements\n            event.preventDefault();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/maximize/MaximizeToggleButton.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.maximize;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.constants.ButtonSize;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter;\nimport org.uberfire.client.workbench.panels.MaximizeToggleButtonPresenter.View;\nimport org.uberfire.mvp.Command;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\npublic class MaximizeToggleButton extends Button implements View {\n\n    private MaximizeToggleButtonPresenter presenter;\n    private boolean maximized;\n    private Command maximizeCommand;\n    private Command unmaximizeCommand;\n\n    public MaximizeToggleButton() {\n        setMaximized(maximized);\n        addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                presenter.handleClick();\n            }\n        });\n        setSize(ButtonSize.SMALL);\n    }\n\n    @Override\n    public HandlerRegistration addClickHandler(ClickHandler handler) {\n        return this.addDomHandler(handler,\n                                  ClickEvent.getType());\n    }\n\n    @Override\n    public void init(MaximizeToggleButtonPresenter presenter) {\n        this.presenter = checkNotNull(\"presenter\",\n                                      presenter);\n    }\n\n    /**\n     * Normally invoked automatically when this button gets clicked. Exposed for testing purposes.\n     */\n    public void click() {\n        final boolean wasMaximized = maximized;\n        setMaximized(!wasMaximized);\n        if (wasMaximized) {\n            if (unmaximizeCommand != null) {\n                unmaximizeCommand.execute();\n            }\n        } else {\n            if (maximizeCommand != null) {\n                maximizeCommand.execute();\n            }\n        }\n    }\n\n    /**\n     * Returns the currently registered maximize command. Can be used to check if there is currently a maximize command registered.\n     */\n    public Command getMaximizeCommand() {\n        return maximizeCommand;\n    }\n\n    /**\n     * Sets the command to invoke upon each transition from unmaximized to maximized.\n     */\n    public void setMaximizeCommand(Command maximizeCommand) {\n        this.maximizeCommand = maximizeCommand;\n    }\n\n    /**\n     * Returns the currently registered unmaximize command. Can be used to check if there is currently an unmaximize command registered.\n     */\n    public Command getUnmaximizeCommand() {\n        return unmaximizeCommand;\n    }\n\n    /**\n     * Sets the command to invoke upon each transition from maximized to unmaximized.\n     */\n    public void setUnmaximizeCommand(Command unmaximizeCommand) {\n        this.unmaximizeCommand = unmaximizeCommand;\n    }\n\n    /**\n     * Reports whether this button is currently in the maximized state. If true, the next click will return to the\n     * normal unmaximized state. If false, the next click will transition to the maximized state.\n     */\n    public boolean isMaximized() {\n        return maximized;\n    }\n\n    /**\n     * Changes the maximized state of this button <i>without</i> calling the commands. This can be used to notify the\n     * button that some external process has already maximized the thing in question. It is permissible but not necessary\n     * to call this method from the maximizeCommadn and unmaximizeCommand.\n     *\n     * @param maximized the new maximized state to set.\n     */\n    public void setMaximized(boolean maximized) {\n        this.maximized = maximized;\n        if (maximized) {\n            setIcon(IconType.COMPRESS);\n            setTitle(WorkbenchConstants.INSTANCE.minimizePanel());\n        } else {\n            setIcon(IconType.EXPAND);\n            setTitle(WorkbenchConstants.INSTANCE.maximizePanel());\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/DropdownMenuVisitor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownHeader;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.workbench.model.menu.EnabledStateChangeListener;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\nimport org.uberfire.workbench.model.menu.MenuItemPerspective;\nimport org.uberfire.workbench.model.menu.MenuItemPlain;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuVisitor;\n\npublic class DropdownMenuVisitor extends BaseMenuVisitor {\n\n    protected final HasMenuItems hasMenuItems;\n\n    public DropdownMenuVisitor(final HasMenuItems hasMenuItems) {\n        this.hasMenuItems = hasMenuItems;\n    }\n\n    @Override\n    public boolean visitEnter(final MenuGroup menuGroup) {\n        buildMenuGroup(menuGroup,\n                       this.hasMenuItems);\n        return true;\n    }\n\n    protected Widget buildMenuGroup(final MenuGroup menuGroup,\n                                    final HasMenuItems hasMenuItems) {\n        final DropDownHeader group = new DropDownHeader();\n        group.setText(menuGroup.getCaption());\n        hasMenuItems.addMenuItem(menuGroup.getPosition(),\n                                 group);\n        return group;\n    }\n\n    @Override\n    public void visit(final MenuCustom<?> menuCustom) {\n        final IsWidget customMenuItem = ((IsWidget) menuCustom.build()).asWidget();\n        if (customMenuItem instanceof AnchorListItem) {\n            final AnchorListItem view = (AnchorListItem) customMenuItem;\n            setupEnableDisable(menuCustom,\n                               view);\n            this.hasMenuItems.addMenuItem(menuCustom.getPosition(),\n                                          view);\n        } else {\n            buildMenuCustom(menuCustom,\n                            this.hasMenuItems);\n        }\n    }\n\n    protected Widget buildMenuCustom(final MenuCustom<?> menuCustom,\n                                     final HasMenuItems hasMenuItems) {\n        return createListItem(menuCustom,\n                              hasMenuItems);\n    }\n\n    @Override\n    public void visit(final MenuItemCommand menuItemCommand) {\n        buildMenuCommand(menuItemCommand,\n                         this.hasMenuItems);\n    }\n\n    protected Widget buildMenuCommand(final MenuItemCommand menuItemCommand,\n                                      final HasMenuItems hasMenuItems) {\n        final AnchorListItem item = createListItem(menuItemCommand,\n                                                   hasMenuItems);\n        item.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                menuItemCommand.getCommand().execute();\n            }\n        });\n        return item;\n    }\n\n    @Override\n    public void visit(final MenuItemPerspective menuItemPerspective) {\n        buildMenuPerspective(menuItemPerspective,\n                             this.hasMenuItems);\n    }\n\n    protected Widget buildMenuPerspective(final MenuItemPerspective menuItemPerspective,\n                                          final HasMenuItems hasMenuItems) {\n        final AnchorListItem item = createListItem(menuItemPerspective,\n                                                   hasMenuItems);\n        item.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                IOC.getBeanManager().lookupBean(PlaceManager.class).getInstance().goTo(menuItemPerspective.getPlaceRequest());\n            }\n        });\n        return item;\n    }\n\n    @Override\n    public void visit(final MenuItemPlain menuItemPlain) {\n        buildMenuPlain(menuItemPlain,\n                       this.hasMenuItems);\n    }\n\n    protected Widget buildMenuPlain(final MenuItemPlain menuItemPlain,\n                                    final HasMenuItems hasMenuItems) {\n        return createListItem(menuItemPlain,\n                              hasMenuItems);\n    }\n\n    protected AnchorListItem createListItem(final MenuItem menuItem,\n                                            final HasMenuItems hasMenuItems) {\n        final AnchorListItem option = GWT.create(AnchorListItem.class);\n        option.setText(menuItem.getCaption());\n        setupEnableDisable(menuItem,\n                           option);\n        hasMenuItems.addMenuItem(menuItem.getPosition(),\n                                 option);\n        return option;\n    }\n\n    /**\n     * Sets up the enabled/disabled state of the view widget, and installs a listener on the model to keep the\n     * widget's enabled state in sync with it.\n     * @param model the description of the menu item to get the current enabled state from, and to subscibe to for\n     * future changes.\n     * @param view the widget that provides a view of the given model.\n     */\n    protected void setupEnableDisable(final MenuItem model,\n                                      final AnchorListItem view) {\n        view.setEnabled(model.isEnabled());\n        model.addEnabledStateChangeListener(new EnabledStateChangeListener() {\n            @Override\n            public void enabledStateChanged(final boolean enabled) {\n                view.setEnabled(enabled);\n            }\n        });\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/HasMenuItems.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\n/**\n * Widgets that can contain menu items implement this interface.\n */\npublic interface HasMenuItems extends IsWidget {\n\n    /**\n     * Adds a new menu item to the end of the current list of menu items at the given position.\n     * @param position the position to append the menu item at. Not all menu containers support positioning; those that don't\n     * will ignore this parameter. Null is always allowed and should be treated the same as CENTER by\n     * position-aware containers.\n     * @param menuContent the content that should appear in the given menu item. Should have an Anchor element as its only\n     * direct child, or should be an {@link AnchorListItem} which is a convenient shorthand for an Anchor\n     * inside a ListItem.\n     */\n    void addMenuItem(MenuPosition position,\n                     Widget menuContent);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/MainBrand.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.ui.NavbarBrand;\n\n/**\n * Denotes that the target class or producer of type {@link NavbarBrand} provides the main branding link that appears above\n * the application's menu bar. Each application that uses PatternFly should have one such type or producer.\n * <p>\n * To fit with the overall layout, <b>the NavbarBrand widget that bears this qualifier must have a height of 25px.</b>\n */\npublic interface MainBrand extends IsWidget {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/PartContextMenusView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.workbench.widgets.menu.PartContextMenusPresenter;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\npublic class PartContextMenusView\n        extends Composite\n        implements PartContextMenusPresenter.View {\n\n    @Inject\n    private AuthorizationManager authzManager;\n\n    @Inject\n    private User identity;\n\n    @Override\n    public void buildMenu(final Menus menus) {\n    }\n\n    @Override\n    public void clear() {\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/SplashScreenMenuView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.List;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownHeader;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.uberfire.client.menu.SplashScreenMenuPresenter;\nimport org.uberfire.client.menu.SplashScreenMenuPresenter.SplashScreenListEntry;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.views.pfly.style.PatternFlyStyles;\n\n@Dependent\npublic class SplashScreenMenuView extends AnchorListItem implements SplashScreenMenuPresenter.View {\n\n    final DropDownMenu dropdown = new DropDownMenu();\n\n    public SplashScreenMenuView() {\n        addStyleName(Styles.DROPDOWN_TOGGLE);\n        ensureDebugId(\"MenuSplashList-dropdown\");\n\n        anchor.addStyleName(Styles.DROPDOWN_TOGGLE);\n        anchor.addStyleName(PatternFlyStyles.NAV_ITEM_ICONIC);\n        anchor.setDataToggle(Toggle.DROPDOWN);\n        anchor.setIcon(IconType.QUESTION);\n\n        add(dropdown);\n    }\n\n    @Override\n    public void init(SplashScreenMenuPresenter presenter) {\n        // don't need presenter ref\n    }\n\n    @Override\n    public void setSplashScreenList(final List<SplashScreenListEntry> splashScreens) {\n        dropdown.clear();\n        for (final SplashScreenListEntry entry : splashScreens) {\n            final AnchorListItem item = new AnchorListItem(entry.getScreenName());\n            item.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    entry.getShowCommand().execute();\n                }\n            });\n            dropdown.add(item);\n        }\n        if (dropdown.getWidgetCount() == 0) {\n            dropdown.add(new DropDownHeader(WorkbenchConstants.INSTANCE.splashScreenNoneAvailable()));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/UserMenu.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.jboss.errai.security.shared.api.identity.User.StandardUserProperties;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.workbench.widgets.menu.HasMenus;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\nimport org.uberfire.workbench.model.menu.impl.BaseMenuCustom;\n\n/**\n * Provides the menu that appears in the top right corner of the screen. Shows the current user's name.\n */\n@Dependent\npublic class UserMenu implements MenuFactory.CustomMenuBuilder,\n                                 HasMenus {\n\n    @Inject\n    private UserMenuView userMenuView;\n    @Inject\n    private User user;\n    @Inject\n    private AuthorizationManager authzManager;\n\n    @PostConstruct\n    protected void setup() {\n        userMenuView.setUserName(formattedUsername());\n    }\n\n    @Override\n    public void addMenus(final Menus menus) {\n        menus.accept(new AuthFilterMenuVisitor(authzManager,\n                                               user,\n                                               new DropdownMenuVisitor(userMenuView)));\n    }\n\n    /**\n     * Tries to return the user's first and/or last names. If neither is available, returns the user's ID instead.\n     */\n    private String formattedUsername() {\n        final StringBuilder sb = new StringBuilder();\n        if (user.getProperty(StandardUserProperties.FIRST_NAME) != null) {\n            sb.append(user.getProperty(StandardUserProperties.FIRST_NAME));\n        }\n        if (user.getProperty(StandardUserProperties.LAST_NAME) != null) {\n            if (sb.length() > 0) {\n                sb.append(\" \");\n            }\n            sb.append(user.getProperty(StandardUserProperties.LAST_NAME));\n        }\n        if (sb.length() == 0) {\n            sb.append(user.getIdentifier());\n        }\n        return sb.toString();\n    }\n\n    public IsWidget getView() {\n        return userMenuView;\n    }\n\n    @Override\n    public void push(MenuFactory.CustomMenuBuilder element) {\n\n    }\n\n    @Override\n    public MenuItem build() {\n        return new BaseMenuCustom<IsWidget>() {\n\n            @Override\n            public IsWidget build() {\n                return getView();\n            }\n\n            @Override\n            public MenuPosition getPosition() {\n                return MenuPosition.RIGHT;\n            }\n        };\n    }\n\n    public void clear() {\n        userMenuView.clearMenuItems();\n    }\n\n    public interface UserMenuView extends HasMenuItems {\n\n        void setUserName(String userName);\n\n        void clearMenuItems();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/UserMenuViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.client.views.pfly.style.PatternFlyStyles;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\n@Dependent\npublic class UserMenuViewImpl extends AnchorListItem implements UserMenu.UserMenuView {\n\n    private final DropDownMenu menu = new DropDownMenu();\n    private final Text userNameWidget = new Text();\n\n    @PostConstruct\n    public void setup() {\n        anchor.addStyleName(Styles.DROPDOWN_TOGGLE);\n        anchor.addStyleName(PatternFlyStyles.NAV_ITEM_ICONIC);\n        anchor.setDataToggle(Toggle.DROPDOWN);\n\n        final Span userIcon = new Span();\n        userIcon.addStyleName(\"pficon\");\n        userIcon.addStyleName(\"pficon-user\");\n\n        anchor.add(userIcon);\n        anchor.add(userNameWidget);\n        final Span caret = new Span();\n        caret.addStyleName(Styles.CARET);\n        anchor.add(caret);\n\n        addStyleName(Styles.DROPDOWN);\n        add(anchor);\n        add(menu);\n    }\n\n    @Override\n    public void setUserName(final String userName) {\n        userNameWidget.setText(userName);\n    }\n\n    @Override\n    public void clearMenuItems() {\n        menu.clear();\n    }\n\n    @Override\n    public void addMenuItem(final MenuPosition position,\n                            final Widget menuContent) {\n        //Always add new option on top\n        menu.insert(menuContent,\n                    0);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/UtilityMenuBarView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.UnorderedList;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.menu.AuthFilterMenuVisitor;\nimport org.uberfire.client.workbench.widgets.menu.UtilityMenuBarPresenter;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.MenuPosition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n/**\n * Goes inside the collapsible navbar container, and can contain a status menu (not implemented yet) and the {@link UserMenu}.\n */\n@ApplicationScoped\npublic class UtilityMenuBarView extends UnorderedList implements UtilityMenuBarPresenter.View,\n                                                                 HasMenuItems {\n\n    @Inject\n    private AuthorizationManager authzManager;\n\n    @Inject\n    private User identity;\n\n    @PostConstruct\n    public void setup() {\n        addStyleName(Styles.NAV);\n        addStyleName(Styles.NAVBAR_NAV);\n        addStyleName(\"navbar-utility\");\n    }\n\n    @Override\n    public void addMenus(final Menus menus) {\n        menus.accept(new AuthFilterMenuVisitor(authzManager,\n                                               identity,\n                                               new DropdownMenuVisitor(this)));\n    }\n\n    @Override\n    public void addMenuItem(final MenuPosition position,\n                            final Widget menuContent) {\n        switch (position) {\n            case LEFT:\n                this.insert(menuContent,\n                            0);\n                break;\n            case RIGHT:\n                this.add(menuContent);\n                break;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuBarView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.HiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.HiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.HideEvent;\nimport org.gwtbootstrap3.client.shared.event.HideHandler;\nimport org.gwtbootstrap3.client.shared.event.ShowEvent;\nimport org.gwtbootstrap3.client.shared.event.ShowHandler;\nimport org.gwtbootstrap3.client.shared.event.ShownEvent;\nimport org.gwtbootstrap3.client.shared.event.ShownHandler;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Collapse;\nimport org.gwtbootstrap3.client.ui.Navbar;\nimport org.gwtbootstrap3.client.ui.NavbarBrand;\nimport org.gwtbootstrap3.client.ui.NavbarCollapse;\nimport org.gwtbootstrap3.client.ui.NavbarHeader;\nimport org.gwtbootstrap3.client.ui.constants.NavbarType;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.jboss.errai.ioc.client.container.IOCResolutionException;\nimport org.uberfire.client.workbench.widgets.menu.WorkbenchMenuBarPresenter;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\n/**\n * The Menu Bar widget\n */\n@ApplicationScoped\npublic class WorkbenchMenuBarView extends Composite implements WorkbenchMenuBarPresenter.View {\n\n    private final Navbar navBar = GWT.create(Navbar.class);\n    private final NavbarHeader navbarHeader = GWT.create(NavbarHeader.class);\n    private final NavbarCollapse navbarCollapse = GWT.create(NavbarCollapse.class);\n    @Inject\n    WorkbenchMenuCompactNavBarView workbenchMenuCompactNavBarView;\n    @Inject\n    WorkbenchMenuStandardNavBarView workbenchMenuStandardNavBarView;\n    @Inject\n    private Instance<MainBrand> menuBarBrand;\n    private Collapse navBarCollapse = GWT.create(Collapse.class);\n    @Inject\n    private UtilityMenuBarView utilityMenuBarView;\n\n    @PostConstruct\n    protected void setup() {\n        navBar.setType(NavbarType.INVERSE);\n        navBar.addStyleName(\"navbar-pf\");\n\n        try {\n            final NavbarBrand brand = GWT.create(NavbarBrand.class);\n            brand.add(menuBarBrand.get());\n            navbarHeader.add(brand);\n        } catch (IOCResolutionException e) {\n            // app didn't provide a branded header bean\n        }\n        navBar.add(navbarHeader);\n\n        setupNavBarCollapse();\n\n        navbarCollapse.add(workbenchMenuCompactNavBarView);\n        navbarCollapse.add(navBarCollapse);\n        navbarCollapse.add(utilityMenuBarView);\n\n        navBar.add(navbarCollapse);\n\n        setupToggle();\n\n        initWidget(navBar);\n\n        expand();\n    }\n\n    protected void setupToggle() {\n        final Button btnToggle = GWT.create(Button.class);\n        btnToggle.removeStyleName(\"btn-default\");\n        btnToggle.addStyleName(Styles.NAVBAR_TOGGLE);\n        btnToggle.setDataToggle(Toggle.COLLAPSE);\n        btnToggle.setDataTargetWidget(navbarCollapse);\n        btnToggle.add(createToggleBar());\n        btnToggle.add(createToggleBar());\n        btnToggle.add(createToggleBar());\n        navbarHeader.add(btnToggle);\n    }\n\n    private Span createToggleBar() {\n        final Span span = GWT.create(Span.class);\n        span.addStyleName(\"icon-bar\");\n        return span;\n    }\n\n    protected void setupNavBarCollapse() {\n        workbenchMenuCompactNavBarView.addStyleName(\"hidden\");\n        navBarCollapse.addShowHandler(new ShowHandler() {\n            @Override\n            public void onShow(ShowEvent showEvent) {\n                workbenchMenuCompactNavBarView.removeStyleName(\"show\");\n                workbenchMenuCompactNavBarView.addStyleName(\"hidden\");\n                navbarHeader.removeStyleName(Styles.PULL_LEFT);\n                workbenchMenuStandardNavBarView.removeStyleName(\"hidden\");\n                workbenchMenuStandardNavBarView.addStyleName(\"show\");\n            }\n        });\n        navBarCollapse.addShownHandler(new ShownHandler() {\n            @Override\n            public void onShown(ShownEvent event) {\n                navBar.removeStyleName(\"uf-navbar-compact\");\n            }\n        });\n\n        navBarCollapse.addHiddenHandler(new HiddenHandler() {\n            @Override\n            public void onHidden(HiddenEvent event) {\n                workbenchMenuStandardNavBarView.removeStyleName(\"show\");\n                workbenchMenuStandardNavBarView.addStyleName(\"hidden\");\n\n                navbarHeader.addStyleName(Styles.PULL_LEFT);\n                workbenchMenuCompactNavBarView.removeStyleName(\"hidden\");\n                workbenchMenuCompactNavBarView.addStyleName(\"show\");\n                navBar.addStyleName(\"uf-navbar-compact\");\n                navBarCollapse.removeStyleName(Styles.IN);\n            }\n        });\n        navBarCollapse.addStyleName(Styles.IN);\n        navBarCollapse.add(workbenchMenuStandardNavBarView);\n    }\n\n    @Override\n    public void addMenuItem(final String id,\n                            final String label,\n                            final String parentId,\n                            final Command command,\n                            final MenuPosition position) {\n        workbenchMenuStandardNavBarView.addMenuItem(id,\n                                                    label,\n                                                    parentId,\n                                                    command,\n                                                    position);\n        workbenchMenuCompactNavBarView.addMenuItem(id,\n                                                   label,\n                                                   parentId,\n                                                   command,\n                                                   position);\n    }\n\n    @Override\n    public void addCustomMenuItem(final Widget menu,\n                                  final MenuPosition position) {\n        workbenchMenuStandardNavBarView.addCustomMenuItem(menu,\n                                                          position);\n        workbenchMenuCompactNavBarView.addCustomMenuItem(menu,\n                                                         position);\n    }\n\n    @Override\n    public void addGroupMenuItem(final String id,\n                                 final String label,\n                                 final MenuPosition position) {\n        workbenchMenuStandardNavBarView.addGroupMenuItem(id,\n                                                         label,\n                                                         position);\n        workbenchMenuCompactNavBarView.addGroupMenuItem(id,\n                                                        label,\n                                                        position);\n    }\n\n    @Override\n    public void addContextMenuItem(\n            final String menuItemId,\n            final String id,\n            final String label,\n            final String parentId,\n            final Command command,\n            final MenuPosition position) {\n        workbenchMenuStandardNavBarView.addContextMenuItem(menuItemId,\n                                                           id,\n                                                           label,\n                                                           parentId,\n                                                           command,\n                                                           position);\n        workbenchMenuCompactNavBarView.addContextMenuItem(menuItemId,\n                                                          id,\n                                                          label,\n                                                          parentId,\n                                                          command,\n                                                          position);\n    }\n\n    @Override\n    public void addContextGroupMenuItem(final String menuItemId,\n                                        final String id,\n                                        final String label,\n                                        final MenuPosition position) {\n        workbenchMenuStandardNavBarView.addContextGroupMenuItem(menuItemId,\n                                                                id,\n                                                                label,\n                                                                position);\n        workbenchMenuCompactNavBarView.addContextGroupMenuItem(menuItemId,\n                                                               id,\n                                                               label,\n                                                               position);\n    }\n\n    @Override\n    public void clearContextMenu() {\n        workbenchMenuStandardNavBarView.clearContextMenu();\n        workbenchMenuCompactNavBarView.clearContextMenu();\n    }\n\n    @Override\n    public void clear() {\n        workbenchMenuStandardNavBarView.clear();\n        workbenchMenuCompactNavBarView.clear();\n        utilityMenuBarView.clear();\n    }\n\n    @Override\n    public void expand() {\n        if (navBarCollapse.isHidden()) {\n            navBarCollapse.show();\n        }\n    }\n\n    @Override\n    public void collapse() {\n        if (navBarCollapse.isShown()) {\n            navBarCollapse.hide();\n        }\n    }\n\n    @Override\n    public void selectMenuItem(final String id) {\n        workbenchMenuCompactNavBarView.selectMenuItem(id);\n        workbenchMenuStandardNavBarView.selectMenuItem(id);\n    }\n\n    @Override\n    public void addCollapseHandler(final Command command) {\n        navBarCollapse.addHideHandler(new HideHandler() {\n            @Override\n            public void onHide(final HideEvent hideEvent) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void addExpandHandler(final Command command) {\n        navBarCollapse.addShowHandler(new ShowHandler() {\n            @Override\n            public void onShow(final ShowEvent showEvent) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public void enableMenuItem(final String menuItemId,\n                               final boolean enabled) {\n        workbenchMenuStandardNavBarView.enableMenuItem(menuItemId,\n                                                       enabled);\n        workbenchMenuCompactNavBarView.enableMenuItem(menuItemId,\n                                                      enabled);\n    }\n\n    @Override\n    public void enableContextMenuItem(final String menuItemId,\n                                      final boolean enabled) {\n        workbenchMenuStandardNavBarView.enableContextMenuItem(menuItemId,\n                                                              enabled);\n        workbenchMenuCompactNavBarView.enableContextMenuItem(menuItemId,\n                                                             enabled);\n    }\n\n    @Override\n    public void setAllMenuItemsVisible(String perspectiveId, boolean visible) {\n        setMenuItemVisible(perspectiveId, visible);\n        setContextMenuItemVisible(perspectiveId, visible);\n    }\n\n    @Override\n    public void setMenuItemVisible(String perspectiveId, boolean visible) {\n        workbenchMenuStandardNavBarView.setMenuItemVisible(perspectiveId, visible);\n        workbenchMenuCompactNavBarView.setMenuItemVisible(perspectiveId, visible);\n    }\n\n    @Override\n    public void setContextMenuItemVisible(String perspectiveId, boolean visible) {\n        workbenchMenuStandardNavBarView.setContextMenuItemVisible(perspectiveId, visible);\n        workbenchMenuCompactNavBarView.setContextMenuItemVisible(perspectiveId, visible);\n    }\n\n    public interface WorkbenchMenuNavBarView {\n\n        void clear();\n\n        void addMenuItem(String id,\n                         String label,\n                         String parentId,\n                         Command command,\n                         MenuPosition position);\n\n        void addCustomMenuItem(Widget menu,\n                               MenuPosition position);\n\n        void addGroupMenuItem(String id,\n                              String label,\n                              MenuPosition position);\n\n        void selectMenuItem(String id);\n\n        void addContextMenuItem(String menuItemId,\n                                String id,\n                                String label,\n                                String parentId,\n                                Command command,\n                                MenuPosition position);\n\n        void addContextGroupMenuItem(String menuItemId,\n                                     String id,\n                                     String label,\n                                     MenuPosition position);\n\n        void clearContextMenu();\n\n        void enableMenuItem(String menuItemId,\n                            boolean enabled);\n\n        void enableContextMenuItem(String menuItemId,\n                                   boolean enabled);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuCompactNavBarView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.common.collect.HashMultimap;\nimport com.google.common.collect.Maps;\nimport com.google.common.collect.Multimap;\nimport com.google.common.collect.SetMultimap;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorButton;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownHeader;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.ListDropDown;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\n@ApplicationScoped\npublic class WorkbenchMenuCompactNavBarView extends WorkbenchMenuNavBarView {\n\n    private final Map<String, String> menuLabelMap = Maps.newHashMap();\n    private final SetMultimap<String, ComplexPanel> menuItemContextMenus = HashMultimap.create();\n    private final AnchorButton anchor = GWT.create(AnchorButton.class);\n    private final Text text = GWT.create(Text.class);\n    private final DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n    private final ListDropDown listDropDown = GWT.create(ListDropDown.class);\n\n    @PostConstruct\n    protected void setup() {\n        super.setup();\n        this.addStyleName(\"uf-navbar-nav-compact\");\n        anchor.setDataToggle(Toggle.DROPDOWN);\n        anchor.add(text);\n        listDropDown.add(anchor);\n        listDropDown.add(dropDownMenu);\n        this.navbarNav.add(listDropDown);\n    }\n\n    @Override\n    public void addMenuItem(final String id,\n                            final String label,\n                            final String parentId,\n                            final Command command,\n                            final MenuPosition position) {\n        final AnchorListItem menuItem = GWT.create(AnchorListItem.class);\n        menuItem.setText(label);\n        if (command != null) {\n            menuItem.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    command.execute();\n                }\n            });\n        }\n        getMenuItemWidgetMap().put(id,\n                                   menuItem);\n        menuLabelMap.put(id,\n                         label);\n        dropDownMenu.add(menuItem);\n    }\n\n    @Override\n    public void addCustomMenuItem(final Widget menu,\n                                  final MenuPosition position) {\n        //No support for adding custom menus when using compact mode.\n    }\n\n    @Override\n    public void addGroupMenuItem(final String id,\n                                 final String label,\n                                 final MenuPosition position) {\n        final DropDownHeader group = GWT.create(DropDownHeader.class);\n        group.setText(label);\n        dropDownMenu.add(group);\n    }\n\n    @Override\n    public void addContextMenuItem(\n            final String menuItemId,\n            final String id,\n            final String label,\n            final String parentId,\n            final Command command,\n            final MenuPosition position) {\n        final AnchorListItem menuItem = GWT.create(AnchorListItem.class);\n        menuItem.setText(label);\n        if (parentId == null) {\n            menuItem.addStyleName(UF_PERSPECTIVE_CONTEXT_MENU);\n        }\n        if (command != null) {\n            menuItem.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    command.execute();\n                }\n            });\n        }\n\n        final ComplexPanel contextContainer = getMenuItemContextWidgetMap().get(parentId);\n        if (contextContainer != null) {\n            contextContainer.add(menuItem);\n        } else {\n            menuItemContextMenus.get(menuItemId).add(menuItem);\n        }\n        getMenuItemContextWidgetMap().put(id,\n                                          menuItem);\n    }\n\n    @Override\n    public void addContextGroupMenuItem(final String menuItemId,\n                                        final String id,\n                                        final String label,\n                                        final MenuPosition position) {\n        final ListDropDown listDropDown = GWT.create(ListDropDown.class);\n        listDropDown.addStyleName(UF_PERSPECTIVE_CONTEXT_MENU);\n        final AnchorButton anchor = GWT.create(AnchorButton.class);\n        anchor.setDataToggle(Toggle.DROPDOWN);\n        anchor.setText(label);\n        final DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n        listDropDown.add(anchor);\n        listDropDown.add(dropDownMenu);\n        menuItemContextMenus.get(menuItemId).add(listDropDown);\n        getMenuItemContextWidgetMap().put(id,\n                                          dropDownMenu);\n    }\n\n    @Override\n    public void clearContextMenu() {\n        super.clearContextMenu();\n\n        for (final ComplexPanel contextContainer : menuItemContextMenus.values()) {\n            contextContainer.clear();\n            contextContainer.removeFromParent();\n        }\n\n        menuItemContextMenus.clear();\n    }\n\n    @Override\n    public void selectMenuItem(final String id) {\n        super.selectMenuItem(id);\n        final String menuLabel = menuLabelMap.get(id);\n        text.setText(menuLabel == null ? \"\" : menuLabel);\n        for (ComplexPanel context : menuItemContextMenus.get(id)) {\n            navbarNav.add(context);\n        }\n    }\n\n    @Override\n    public void clear() {\n        super.clear();\n        menuLabelMap.clear();\n        menuItemContextMenus.clear();\n        this.navbarNav.add(listDropDown);\n    }\n\n    @Override\n    protected void selectElement(final ComplexPanel item) {\n        for (Widget widget : dropDownMenu) {\n            widget.removeStyleName(Styles.ACTIVE);\n        }\n        if (item != null) {\n            item.addStyleName(Styles.ACTIVE);\n        }\n    }\n\n    protected Multimap<String, ComplexPanel> getMenuItemContextMenus() {\n        return menuItemContextMenus;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuNavBarView.java",
    "content": "/*\n *\n *  * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.Map;\n\nimport com.google.common.collect.Maps;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.NavbarNav;\n\npublic abstract class WorkbenchMenuNavBarView extends Composite implements WorkbenchMenuBarView.WorkbenchMenuNavBarView {\n\n    public static final String UF_PERSPECTIVE_CONTEXT_MENU = \"uf-perspective-context-menu\";\n    public static final String UF_PERSPECTIVE_CONTEXT_MENU_EMPTY = \"uf-perspective-context-menu-empty\";\n    public static final String UF_PERSPECTIVE_CONTEXT_MENU_CONTAINER = \"uf-perspective-context-menu-container\";\n\n    private final Map<String, ComplexPanel> menuItemWidgetMap = Maps.newHashMap();\n    private final Map<String, ComplexPanel> menuItemContextWidgetMap = Maps.newHashMap();\n    private final Map<String, ComplexPanel> contextContainerWidgetMap = Maps.newHashMap();\n\n    protected NavbarNav navbarNav = GWT.create(NavbarNav.class);\n\n    protected void setup() {\n        initWidget(navbarNav);\n    }\n\n    @Override\n    public void selectMenuItem(final String id) {\n        final ComplexPanel menuItemWidget = getMenuItemWidgetMap().get(id);\n        if (menuItemWidget != null) {\n            selectElement(menuItemWidget);\n        }\n    }\n\n    @Override\n    public void enableMenuItem(final String menuItemId,\n                               final boolean enabled) {\n        doSetMenuItemEnabled(getMenuItemWidgetMap().get(menuItemId), enabled);\n    }\n\n    @Override\n    public void enableContextMenuItem(final String menuItemId,\n                                      final boolean enabled) {\n        doSetMenuItemEnabled(getMenuItemContextWidgetMap().get(menuItemId), enabled);\n\n    }\n\n    private void doSetMenuItemEnabled(final ComplexPanel cp, final boolean enabled) {\n        if (cp == null) {\n            return;\n        }\n        if (cp instanceof AnchorListItem) {\n            ((AnchorListItem) cp).setEnabled(enabled);\n        }\n    }\n\n\n    public void setMenuItemVisible(String menuItemId, boolean visible) {\n        doSetMenuItemVisible(getMenuItemWidgetMap().get(menuItemId), visible);\n    }\n\n    public void setContextMenuItemVisible(String menuItemId, boolean visible) {\n        doSetMenuItemVisible(getMenuItemContextWidgetMap().get(menuItemId), visible);\n    }\n\n    private void doSetMenuItemVisible(final ComplexPanel cp, final boolean visible) {\n        if (cp == null) {\n            return;\n        }\n        cp.setVisible(visible);\n    }\n\n    @Override\n    public void clearContextMenu() {\n        for (final ComplexPanel contextContainer : getMenuItemContextWidgetMap().values()) {\n            contextContainer.clear();\n            contextContainer.removeFromParent();\n        }\n\n        getMenuItemContextWidgetMap().clear();\n    }\n\n    protected abstract void selectElement(ComplexPanel menuItemWidget);\n\n    public void clear() {\n        navbarNav.clear();\n        menuItemWidgetMap.clear();\n        menuItemContextWidgetMap.clear();\n        contextContainerWidgetMap.clear();\n    }\n\n    protected Map<String, ComplexPanel> getMenuItemWidgetMap() {\n        return menuItemWidgetMap;\n    }\n\n    protected Map<String, ComplexPanel> getMenuItemContextWidgetMap() {\n        return menuItemContextWidgetMap;\n    }\n\n    protected Map<String, ComplexPanel> getContextContainerWidgetMap() {\n        return contextContainerWidgetMap;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuStandardNavBarView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.Map;\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.AnchorButton;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.ListDropDown;\nimport org.gwtbootstrap3.client.ui.ListItem;\nimport org.gwtbootstrap3.client.ui.base.AbstractListItem;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\nimport org.gwtbootstrap3.client.ui.html.UnorderedList;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\n@ApplicationScoped\npublic class WorkbenchMenuStandardNavBarView extends WorkbenchMenuNavBarView {\n\n    @PostConstruct\n    protected void setup() {\n        super.setup();\n        this.addStyleName(\"navbar-primary persistent-secondary\");\n    }\n\n    @Override\n    public void addMenuItem(final String id,\n                            final String label,\n                            final String parentId,\n                            final Command command,\n                            final MenuPosition position) {\n        final AnchorListItem menuItem = GWT.create(AnchorListItem.class);\n        menuItem.setText(label);\n        if (command != null) {\n            menuItem.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    command.execute();\n                }\n            });\n        }\n        getMenuItemWidgetMap().put(id,\n                                   menuItem);\n        if (parentId == null) {\n            positionMenuItem(menuItem,\n                             position);\n            navbarNav.add(menuItem);\n        } else {\n            final ComplexPanel parent = getMenuItemWidgetMap().get(parentId);\n            if (parent != null) {\n                parent.add(menuItem);\n            }\n        }\n    }\n\n    @Override\n    public void addCustomMenuItem(final Widget menu,\n                                  final MenuPosition position) {\n        positionMenuItem(menu,\n                         position);\n        navbarNav.add(menu);\n    }\n\n    @Override\n    public void addGroupMenuItem(final String id,\n                                 final String label,\n                                 final MenuPosition position) {\n        final ListDropDown listDropDown = GWT.create(ListDropDown.class);\n        final AnchorButton anchor = GWT.create(AnchorButton.class);\n        anchor.setDataToggle(Toggle.DROPDOWN);\n        anchor.setText(label);\n        final DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n        listDropDown.add(anchor);\n        listDropDown.add(dropDownMenu);\n        positionMenuItem(listDropDown,\n                         position);\n        navbarNav.add(listDropDown);\n        getMenuItemWidgetMap().put(id,\n                                   dropDownMenu);\n    }\n\n    @Override\n    public void addContextMenuItem(\n            final String menuItemId,\n            final String id,\n            final String label,\n            final String parentId,\n            final Command command,\n            final MenuPosition position) {\n\n        final AnchorListItem menuItem = GWT.create(AnchorListItem.class);\n        menuItem.setText(label);\n        if (command != null) {\n            menuItem.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(ClickEvent event) {\n                    command.execute();\n                }\n            });\n        }\n\n        positionMenuItem(menuItem,\n                         position);\n\n        ComplexPanel contextContainer = getMenuItemContextWidgetMap().get(parentId);\n        if (contextContainer == null) {\n            contextContainer = getContextContainer(menuItemId);\n        }\n        contextContainer.add(menuItem);\n\n        getMenuItemContextWidgetMap().put(id,\n                                          menuItem);\n    }\n\n    @Override\n    public void addContextGroupMenuItem(final String menuItemId,\n                                        final String id,\n                                        final String label,\n                                        final MenuPosition position) {\n        final ListDropDown listDropDown = GWT.create(ListDropDown.class);\n        listDropDown.setStyleName(\"dropdown-submenu\");\n        final Anchor anchor = GWT.create(Anchor.class);\n        anchor.addStyleName(Styles.DROPDOWN_TOGGLE);\n        anchor.setDataToggle(Toggle.DROPDOWN);\n        anchor.setText(label);\n        final DropDownMenu dropDownMenu = GWT.create(DropDownMenu.class);\n        listDropDown.add(anchor);\n        listDropDown.add(dropDownMenu);\n        positionMenuItem(listDropDown,\n                         position);\n\n        ComplexPanel contextContainer = getMenuItemContextWidgetMap().get(menuItemId);\n        if (contextContainer == null) {\n            contextContainer = getContextContainer(menuItemId);\n        }\n        contextContainer.add(listDropDown);\n\n        getMenuItemContextWidgetMap().put(id,\n                                          dropDownMenu);\n    }\n\n    @Override\n    public void clearContextMenu() {\n        super.clearContextMenu();\n\n        for (final ComplexPanel contextContainer : getContextContainerWidgetMap().values()) {\n            contextContainer.clear();\n            contextContainer.removeFromParent();\n        }\n\n        getContextContainerWidgetMap().clear();\n    }\n\n    void positionMenuItem(final AbstractListItem menuItem,\n                          final MenuPosition position) {\n        if (MenuPosition.RIGHT.equals(position)) {\n            menuItem.setPull(Pull.RIGHT);\n        }\n    }\n\n    void positionMenuItem(final Widget menu,\n                          final MenuPosition position) {\n        if (MenuPosition.RIGHT.equals(position)) {\n            menu.getElement().getStyle().setFloat(Style.Float.RIGHT);\n        }\n    }\n\n    private ComplexPanel getContextContainer(final String menuItemId) {\n        ComplexPanel contextContainer = getContextContainerWidgetMap().get(menuItemId);\n        if (contextContainer == null) {\n            contextContainer = GWT.create(UnorderedList.class);\n            contextContainer.addStyleName(\"nav navbar-nav navbar-persistent\");\n            contextContainer.addStyleName(UF_PERSPECTIVE_CONTEXT_MENU);\n            contextContainer.setVisible(false);\n            getContextContainerWidgetMap().put(menuItemId,\n                                               contextContainer);\n        }\n        return contextContainer;\n    }\n\n    private void addContextMenusToContainer(final String menuItemId,\n                                            final ComplexPanel menuItemWidget) {\n        final ComplexPanel contextContainer = getContextContainerWidgetMap().get(menuItemId);\n        final ComplexPanel container = menuItemWidget.getParent().getParent() instanceof ListDropDown ? (ListDropDown) menuItemWidget.getParent().getParent() : menuItemWidget;\n        if (contextContainer != null && container.getWidgetIndex(contextContainer) == -1) {\n            container.add(contextContainer);\n        }\n    }\n\n    @Override\n    public void selectMenuItem(final String id) {\n        ComplexPanel menuItemWidget = getMenuItemWidgetMap().get(id);\n        if (menuItemWidget == null) {\n            menuItemWidget = GWT.create(ListItem.class);\n            menuItemWidget.addStyleName(UF_PERSPECTIVE_CONTEXT_MENU_EMPTY);\n            getMenuItemWidgetMap().put(id,\n                                       menuItemWidget);\n            navbarNav.add(menuItemWidget);\n        }\n\n        super.selectMenuItem(id);\n\n        addContextMenusToContainer(id,\n                                   menuItemWidget);\n\n        for (Map.Entry<String, ComplexPanel> context : getContextContainerWidgetMap().entrySet()) {\n            if (context.getKey().equals(id)) {\n                context.getValue().setVisible(true);\n                context.getValue().getParent().addStyleName(UF_PERSPECTIVE_CONTEXT_MENU_CONTAINER);\n            } else {\n                context.getValue().setVisible(false);\n            }\n        }\n    }\n\n    @Override\n    protected void selectElement(final ComplexPanel item) {\n        iterateWidgets(navbarNav);\n\n        if (item == null) {\n            return;\n        }\n\n        item.addStyleName(Styles.ACTIVE);\n\n        if (item.getParent() != null && item.getParent().getParent() instanceof ListDropDown) {\n            item.getParent().getParent().addStyleName(Styles.ACTIVE);\n        }\n    }\n\n    private void iterateWidgets(final ComplexPanel widget) {\n        widget.removeStyleName(Styles.ACTIVE);\n        widget.removeStyleName(UF_PERSPECTIVE_CONTEXT_MENU_CONTAINER);\n        for (Widget next : widget) {\n            if (next instanceof ComplexPanel) {\n                iterateWidgets((ComplexPanel) next);\n            }\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/WorkbenchViewModeSwitcherView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.uberfire.client.menu.WorkbenchViewModeSwitcherPresenter;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class WorkbenchViewModeSwitcherView implements WorkbenchViewModeSwitcherPresenter.View {\n\n    private final AnchorListItem menu = new AnchorListItem();\n    private WorkbenchViewModeSwitcherPresenter presenter;\n\n    @Override\n    public void setText(final String text) {\n        menu.setText(text);\n    }\n\n    @Override\n    public void init(final WorkbenchViewModeSwitcherPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void addClickHandler(final Command command) {\n        menu.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(ClickEvent event) {\n                command.execute();\n            }\n        });\n    }\n\n    @Override\n    public Widget asWidget() {\n        return menu;\n    }\n\n    @Override\n    public void enable() {\n        menu.setEnabled(true);\n    }\n\n    @Override\n    public void disable() {\n        menu.setEnabled(false);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/WorkbenchMegaMenuView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!-- Masthead -->\n<div id=\"mega-menu\">\n    <nav class=\"uf-page__masthead navbar navbar-default navbar-pf\" role=\"navigation\">\n        <div data-field=\"brand\" class=\"navbar-header\">\n            <button type=\"button\" class=\"navbar-toggle\" data-toggle=\"collapse\" data-target=\".navbar-collapse-1\">\n                <span class=\"sr-only\">Toggle navigation</span>\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n                <span class=\"icon-bar\"></span>\n            </button>\n            <a class=\"navbar-brand\">\n                <img data-field=\"brand-image\" class=\"uf-brand-icon\">\n            </a>\n        </div>\n        <div class=\"collapse navbar-collapse navbar-collapse-1\">\n\n            <ul class=\"nav navbar-nav uf-yamm\">\n                <li>\n                    <a data-field=\"home-link\" class=\"nav-item-iconic\"><i class=\"pficon pficon-home\"></i></a>\n                </li>\n                <li class=\"dropdown uf-yamm--fw\">\n                    <a class=\"dropdown-toggle nav-item-iconic\" id=\"mega-menu-dropdown\" data-toggle=\"dropdown\"\n                       aria-haspopup=\"true\" aria-expanded=\"false\" tabindex=\"0\">\n                        <span data-field=\"menu-accessor-text\"></span>\n                        <span class=\"caret\"></span>\n                    </a>\n                    <ul data-field=\"left-menu-items\" class=\"dropdown-menu uf-yamm__dropdown-menu\" aria-labelledby=\"mega-menu-dropdown\">\n                        <li data-field=\"single-menu-items-container\" class=\"uf-yamm__section uf-yamm__section--top col-xs-12 empty\">\n                            <ul data-field=\"single-menu-items\" class=\"uf-yamm__subsection\"></ul>\n                        </li>\n                    </ul>\n                </li>\n            </ul>\n\n            <ul data-field=\"right-menu-items\" class=\"nav navbar-nav navbar-right navbar-iconic\"></ul>\n\n        </div>\n    </nav>\n\n    <div class=\"navbar-pf navbar-context-menu\">\n        <ul class=\"navbar-primary persistent-secondary\">\n            <li data-field=\"context-menu-items-container\">\n                <ul data-field=\"context-menu-items\" class=\"nav navbar-nav navbar-persistent uf-perspective-context-menu\"></ul>\n            </li>\n        </ul>\n    </div>\n</div>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/WorkbenchMegaMenuView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Image;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.resources.i18n.Constants;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.WorkbenchMegaMenuPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.BaseMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.base.HasChildren;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class WorkbenchMegaMenuView implements WorkbenchMegaMenuPresenter.View,\n                                              org.jboss.errai.ui.client.local.api.IsElement {\n\n    private WorkbenchMegaMenuPresenter presenter;\n\n    @DataField(\"brand\")\n    private Div brand;\n\n    @DataField(\"brand-image\")\n    private Image brandImage;\n\n    @DataField(\"home-link\")\n    private Anchor homeLink;\n\n    @DataField(\"menu-accessor-text\")\n    private Span menuAccessorText;\n\n    @DataField(\"single-menu-items-container\")\n    private ListItem singleMenuItemsContainer;\n\n    @DataField(\"single-menu-items\")\n    private UnorderedList singleMenuItems;\n\n    @DataField(\"left-menu-items\")\n    private UnorderedList leftMenuItems;\n\n    @DataField(\"right-menu-items\")\n    private UnorderedList rightMenuItems;\n\n    @DataField(\"context-menu-items-container\")\n    private ListItem contextMenuItemsContainer;\n\n    @DataField(\"context-menu-items\")\n    private UnorderedList contextMenuItems;\n\n    private TranslationService translationService;\n\n    private ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters;\n\n    private ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters;\n\n    private ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters;\n\n    private ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters;\n\n    Map<String, BaseMenuItemPresenter> menuItemByIdentifier = new HashMap<>();\n\n    @Inject\n    public WorkbenchMegaMenuView(final Div brand,\n                                 final Image brandImage,\n                                 final Anchor homeLink,\n                                 final Span menuAccessorText,\n                                 final ListItem singleMenuItemsContainer,\n                                 final UnorderedList singleMenuItems,\n                                 final UnorderedList leftMenuItems,\n                                 final UnorderedList rightMenuItems,\n                                 final ListItem contextMenuItemsContainer,\n                                 final UnorderedList contextMenuItems,\n                                 final TranslationService translationService,\n                                 final ManagedInstance<ChildMenuItemPresenter> childMenuItemPresenters,\n                                 final ManagedInstance<GroupMenuItemPresenter> groupMenuItemPresenters,\n                                 final ManagedInstance<ChildContextMenuItemPresenter> childContextMenuItemPresenters,\n                                 final ManagedInstance<GroupContextMenuItemPresenter> groupContextMenuItemPresenters) {\n        this.brand = brand;\n        this.brandImage = brandImage;\n        this.homeLink = homeLink;\n        this.menuAccessorText = menuAccessorText;\n        this.singleMenuItemsContainer = singleMenuItemsContainer;\n        this.singleMenuItems = singleMenuItems;\n        this.leftMenuItems = leftMenuItems;\n        this.rightMenuItems = rightMenuItems;\n        this.contextMenuItemsContainer = contextMenuItemsContainer;\n        this.contextMenuItems = contextMenuItems;\n        this.translationService = translationService;\n        this.childMenuItemPresenters = childMenuItemPresenters;\n        this.groupMenuItemPresenters = groupMenuItemPresenters;\n        this.childContextMenuItemPresenters = childContextMenuItemPresenters;\n        this.groupContextMenuItemPresenters = groupContextMenuItemPresenters;\n    }\n\n    @Override\n    public void init(final WorkbenchMegaMenuPresenter presenter) {\n        this.presenter = presenter;\n        this.homeLink.setTitle(translationService.format(Constants.Home));\n    }\n\n    @Override\n    public void clear() {\n        singleMenuItems.setTextContent(\"\");\n        rightMenuItems.setTextContent(\"\");\n\n        for (int index = leftMenuItems.getChildNodes().getLength() - 1; index >= 0; index--) {\n            final Node child = leftMenuItems.getChildNodes().item(index);\n            if (child.getChildNodes().getLength() > 0 && !child.equals(singleMenuItemsContainer)) {\n                leftMenuItems.removeChild(child);\n            }\n        }\n\n        if (!singleMenuItemsContainer.getClassList().contains(\"empty\")) {\n            singleMenuItemsContainer.getClassList().add(\"empty\");\n        }\n\n        menuItemByIdentifier = new HashMap<>();\n    }\n\n    @Override\n    public void clearContextMenu() {\n        setContextMenuActive(false);\n        contextMenuItems.setTextContent(\"\");\n    }\n\n    @Override\n    public void setHomeLinkAction(final Command command) {\n        homeLink.setOnclick(event -> command.execute());\n    }\n\n    @Override\n    public void setBrandImageAction(final Command command) {\n        brandImage.setOnclick(event -> command.execute());\n    }\n\n    @Override\n    public String getDefaultMenuText() {\n        return translationService.format(Constants.Menu);\n    }\n\n    @Override\n    public void setBrandImage(final String brandImageUrl) {\n        brandImage.setSrc(brandImageUrl);\n    }\n\n    @Override\n    public void setBrandImageTitle(final String brandImageLabel) {\n        brandImage.setTitle(brandImageLabel);\n    }\n\n    @Override\n    public void hideBrand() {\n        brand.setHidden(true);\n    }\n\n    @Override\n    public void setMenuAccessorText(final String menuAccessorText) {\n        this.menuAccessorText.setTextContent(menuAccessorText);\n    }\n\n    @Override\n    public void addMenuItemOnRight(ChildMenuItemPresenter itemPresenter) {\n        rightMenuItems.appendChild(itemPresenter.getView().getElement());\n    }\n\n    @Override\n    public void addMenuItemOnLeft(ChildMenuItemPresenter itemPresenter) {\n        singleMenuItems.appendChild(itemPresenter.getView().getElement());\n\n        if (singleMenuItemsContainer.getClassList().contains(\"empty\")) {\n            singleMenuItemsContainer.getClassList().remove(\"empty\");\n        }\n    }\n\n    @Override\n    public void addMenuItemOnParent(ChildMenuItemPresenter itemPresenter,\n                                    HasChildren parentPresenter) {\n        parentPresenter.addChild(itemPresenter.getView());\n    }\n\n    @Override\n    public void addCustomMenuItem(IsElement menu) {\n        rightMenuItems.appendChild(menu.getElement());\n    }\n\n    @Override\n    public void addCustomMenuItem(IsWidget menu) {\n        appendWidgetToElement(rightMenuItems,\n                              menu.asWidget());\n    }\n\n    @Override\n    public void addGroupMenuItem(GroupMenuItemPresenter itemPresenter) {\n        leftMenuItems.appendChild(itemPresenter.getView().getElement());\n    }\n\n    @Override\n    public void addContextMenuItem(GroupContextMenuItemPresenter itemPresenter) {\n        contextMenuItems.appendChild(itemPresenter.getView().getElement());\n    }\n\n    @Override\n    public void addContextMenuItem(ChildContextMenuItemPresenter itemPresenter) {\n        contextMenuItems.appendChild(itemPresenter.getView().getElement());\n    }\n\n    @Override\n    public void addContextMenuItemOnParent(ChildContextMenuItemPresenter itemPresenter,\n                                           HasChildren parentPresenter) {\n        parentPresenter.addChild(itemPresenter.getView());\n    }\n\n    void appendWidgetToElement(final HTMLElement parent,\n                               final Widget child) {\n        DOMUtil.appendWidgetToElement(parent,\n                                      child);\n    }\n\n    @Override\n    public void setContextMenuActive(final boolean active) {\n        if (active) {\n            if (!contextMenuItemsContainer.getClassList().contains(\"active\")) {\n                contextMenuItemsContainer.getClassList().add(\"active\");\n            }\n        } else {\n            if (contextMenuItemsContainer.getClassList().contains(\"active\")) {\n                contextMenuItemsContainer.getClassList().remove(\"active\");\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/WorkbenchMegaMenuView.less",
    "content": "@import \"/org/uberfire/client/views/static/uberfire-variables.less\";\n\n#mega-menu {\n  a {\n    cursor: pointer;\n  }\n\n  // Masthead overrides\n  @media (min-width: @grid-float-breakpoint) {\n    .navbar-pf {\n      display: flex;\n      align-items: center;\n      flex: 1 0 100%;\n    }\n  }\n  // remove the line under the logo\n  .navbar-pf .navbar-header {\n    flex-shrink: 0;\n    height: 58px;\t\n    border-bottom: none;\n    flex-grow: 1;\n    min-height: 58px;\n    display: flex;\n    align-items: center;\n    @media (min-width: @grid-float-breakpoint) {\n      flex-grow: 0;\n    }\n  }\n  .navbar-pf .navbar-brand {\n    padding: 0 @pf-spacer-md 0 0;\n  }\n\n  .navbar-pf .navbar-collapse {\n    flex: 0 1 100%;\n  }\n  .navbar-right > li > a,\n  .nav-item-iconic {\n    @media (min-width: @grid-float-breakpoint) {\n      min-height: 58px;\n    }\n    font-size: 14px;\n    display: flex;\n    align-items: center;\n    border-left: none;\n    padding-left: 12px;\n  }\n  .nav li a.nav-item-iconic {\n    display: flex;\n  }\n  .navbar-pf .navbar-nav > li > a {\n    padding-left: 12px;\n    padding-right: 12px;\n  }\n  .uf-brand-icon {\n    width: auto;\n    max-width: 200px;\n  }\n  .navbar-context-menu {\n    line-height: 0;\n  }\n  .navbar-context-menu > ul {\n    margin: 0;\n  }\n  .navbar-context-menu .navbar-primary.persistent-secondary {\n    padding: 0;\n  }\n  .navbar-context-menu .navbar-primary.persistent-secondary li.right {\n    float: right;\n  }\n\n  .uf-yamm {\n    // reset positions\n    .nav, .collapse, .dropup, .dropdown {\n      position: static;\n    }\n\n    // Fullwidth menu\n    .dropdown.uf-yamm--fw .dropdown-menu {\n      left: 0;\n      right: 0;\n    }\n  }\n\n  .uf-yamm__dropdown-menu {\n    left: auto;\n    border: none;\n    padding-top: 0;\n    @media (min-width: @grid-float-breakpoint) {\n      background-color: @navbar-pf-navbar-nav-active-active-bg-color;\n      color: @color-pf-black-300;\n    }\n  }\n  .uf-yamm__section {\n    background-color: @navbar-pf-navbar-nav-active-active-bg-color;\n    color: @navbar-pf-active-color;\n    border-top: 1px solid @navbar-pf-navbar-utility-hover-border-color;\n    display: inline-block;\n    vertical-align: top;\n    float: none;\n    @media (min-width: @grid-float-breakpoint) {\n      color: @color-pf-black-300;\n      border-top: none;\n    }\n  }\n  //styles the section to connect visually to the dropdown toggle\n  .uf-yamm__section--top {\n    @media (min-width: @grid-float-breakpoint) {\n      background-color: @navbar-pf-navbar-nav-active-bg-color;\n      padding-bottom: @pf-spacer-xs;\n      padding-top: @pf-spacer-xs;\n    }\n  }\n  .uf-yamm__section--top.empty {\n    padding: 0;\n    min-height: 0;\n  }\n  .uf-yamm__title {\n    @media (min-width: @grid-float-breakpoint) {\n      border-bottom: 1px solid @navbar-pf-navbar-utility-hover-border-color;\n      padding-bottom: @pf-spacer-sm;\n    }\n\n  }\n  .uf-yamm__subsection {\n    list-style: none;\n    padding-left: 0;\n    a {\n      color: @navbar-pf-color;\n    }\n    li {\n      padding-top: @pf-spacer-xs;\n      padding-bottom: @pf-spacer-xs;\n    }\n    li + li {\n      padding-top: 0;\n    }\n    li:last-child {\n      padding-bottom: @pf-spacer-sm;\n    }\n    a:hover, a:focus, a:active, a.active {\n      color: @navbar-pf-active-color;\n      text-decoration: none;\n    }\n  }\n\n  // ridiculously specific fix to override an assumption about the dropdown menu\n  .navbar-pf .navbar-iconic li.dropdown > .dropdown-toggle .pficon-user {\n    padding-right: @pf-spacer-xxs;\n  }\n  .navbar-pf .navbar-utility li.dropdown > .dropdown-toggle {\n    padding-left: 20px;\n  }\n  @media (min-width: @grid-float-breakpoint) {\n    .navbar-pf .navbar-utility li.dropdown > .dropdown-toggle {\n      padding-left: 10px;\n    }\n  }\n\n  .navbar {\n    border-top-width: 3px;\n  }\n  .navbar-pf {\n    background-color: @color-pf-black;\n  }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/contextmenuitem/ChildContextMenuItemView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li data-field=\"container\">\n    <a data-field=\"item\"></a>\n</li>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/contextmenuitem/ChildContextMenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu.contextmenuitem;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.ChildContextMenuItemPresenter;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class ChildContextMenuItemView implements IsElement,\n                                                 ChildContextMenuItemPresenter.View {\n\n    private ChildContextMenuItemPresenter presenter;\n\n    @Inject\n    @DataField(\"container\")\n    ListItem container;\n\n    @Inject\n    @DataField(\"item\")\n    Anchor item;\n\n    @Override\n    public void init(final ChildContextMenuItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setLabel(final String label) {\n        item.setTextContent(label);\n    }\n\n    @Override\n    public void setCommand(final Command command) {\n        item.setOnclick(event -> command.execute());\n    }\n\n    @Override\n    public void enable() {\n        item.removeAttribute(\"disabled\");\n    }\n\n    @Override\n    public void disable() {\n        item.setAttribute(\"disabled\",\n                          \"disabled\");\n    }\n\n    @Override\n    public void pullRight() {\n        container.getClassList().add(\"right\");\n    }\n\n    @Override\n    public void select() {\n        item.getClassList().add(\"active\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/contextmenuitem/GroupContextMenuItemView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li data-field=\"container\" class=\"dropdown-submenu\">\n    <a data-field=\"dropdown\" class=\"dropdown-toggle\" data-toggle=\"dropdown\" aria-expanded=\"false\"></a>\n    <ul data-field=\"items\" class=\"dropdown-menu\" role=\"menu\"></ul>\n</li>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/contextmenuitem/GroupContextMenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu.contextmenuitem;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.ListItem;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.contextmenuitem.GroupContextMenuItemPresenter;\n\n@Templated\npublic class GroupContextMenuItemView implements org.jboss.errai.ui.client.local.api.IsElement,\n                                                 GroupContextMenuItemPresenter.View {\n\n    private GroupContextMenuItemPresenter presenter;\n\n    @Inject\n    @DataField(\"container\")\n    ListItem container;\n\n    @Inject\n    @DataField(\"dropdown\")\n    Anchor dropdown;\n\n    @Inject\n    @DataField(\"items\")\n    UnorderedList items;\n\n    @Override\n    public void init(final GroupContextMenuItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setLabel(final String label) {\n        this.dropdown.setTextContent(label);\n    }\n\n    @Override\n    public void addItem(final IsElement item) {\n        this.items.appendChild(item.getElement());\n    }\n\n    @Override\n    public void enable() {\n        dropdown.removeAttribute(\"disabled\");\n    }\n\n    @Override\n    public void disable() {\n        dropdown.setAttribute(\"disabled\",\n                              \"disabled\");\n    }\n\n    @Override\n    public void pullRight() {\n        container.getClassList().add(\"right\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/ChildMenuItemView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li>\n    <a data-field=\"item\"></a>\n</li>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/ChildMenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu.menuitem;\n\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.ChildMenuItemPresenter;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class ChildMenuItemView implements IsElement,\n                                          ChildMenuItemPresenter.View {\n\n    private ChildMenuItemPresenter presenter;\n\n    @Inject\n    @DataField(\"item\")\n    Anchor item;\n\n    @Override\n    public void init(final ChildMenuItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setLabel(final String label) {\n        item.setTextContent(label);\n    }\n\n    @Override\n    public void setCommand(final Command command) {\n        item.setOnclick(event -> command.execute());\n    }\n\n    @Override\n    public void enable() {\n        item.removeAttribute(\"disabled\");\n    }\n\n    @Override\n    public void disable() {\n        item.setAttribute(\"disabled\",\n                          \"disabled\");\n    }\n\n    @Override\n    public void select() {\n        item.getClassList().add(\"active\");\n    }\n\n    @Override\n    public void setVisible(boolean visible) {\n        getElement().setHidden(!visible);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/GroupMenuItemView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li class=\"uf-yamm__section col-xs-12 col-md-3\">\n    <h3 data-field=\"title\" class=\"uf-yamm__title\"></h3>\n    <ul data-field=\"items\" class=\"uf-yamm__subsection\"></ul>\n</li>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/GroupMenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu.menuitem;\n\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Heading;\nimport org.jboss.errai.common.client.dom.UnorderedList;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.GroupMenuItemPresenter;\n\n@Templated\npublic class GroupMenuItemView implements org.jboss.errai.ui.client.local.api.IsElement,\n                                          GroupMenuItemPresenter.View {\n\n    private GroupMenuItemPresenter presenter;\n\n    @Inject\n    @Named(\"h3\")\n    @DataField(\"title\")\n    Heading title;\n\n    @Inject\n    @DataField(\"items\")\n    UnorderedList items;\n\n    @Override\n    public void init(final GroupMenuItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setLabel(final String label) {\n        title.setTextContent(label);\n    }\n\n    @Override\n    public void addItem(final IsElement item) {\n        items.appendChild(item.getElement());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/IconMenuItemView.html",
    "content": "<!--\n  ~ Copyright 2017 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<li>\n    <a data-field=\"item\" class=\"nav-item-iconic\" data-toggle=\"modal\">\n        <span data-field=\"icon\"></span>\n    </a>\n</li>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/menu/megamenu/menuitem/IconMenuItemView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu.megamenu.menuitem;\n\nimport java.util.stream.Stream;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.menuitem.IconMenuItemPresenter;\nimport org.uberfire.mvp.Command;\n\n@Templated\npublic class IconMenuItemView implements IsElement,\n                                         IconMenuItemPresenter.View {\n\n    private IconMenuItemPresenter presenter;\n\n    @Inject\n    @DataField(\"item\")\n    Anchor item;\n\n    @Inject\n    @DataField(\"icon\")\n    Span icon;\n\n    @Override\n    public void init(final IconMenuItemPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setIconClass(final String iconClass) {\n        if (iconClass != null && !iconClass.isEmpty()) {\n            Stream.of(iconClass.split(\" \")).forEach(clazz -> icon.getClassList().add(clazz));\n        }\n    }\n\n    @Override\n    public void setLabel(final String label) {\n        item.setTitle(label);\n    }\n\n    @Override\n    public void setCommand(final Command command) {\n        item.setOnclick(event -> command.execute());\n    }\n\n    @Override\n    public void enable() {\n        item.removeAttribute(\"disabled\");\n    }\n\n    @Override\n    public void disable() {\n        item.setAttribute(\"disabled\",\n                          \"disabled\");\n    }\n\n    @Override\n    public void select() {\n        item.getClassList().add(\"active\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/Bs3Modal.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.modal;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.client.DOM;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.ModalShownEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalShownHandler;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.Modal;\nimport org.gwtbootstrap3.client.ui.ModalBody;\nimport org.gwtbootstrap3.client.ui.ModalFooter;\nimport org.gwtbootstrap3.client.ui.constants.Attributes;\nimport org.gwtbootstrap3.client.ui.constants.ButtonDismiss;\nimport org.gwtbootstrap3.client.ui.constants.ButtonType;\nimport org.gwtbootstrap3.client.ui.constants.ModalBackdrop;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.Commands;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A modal dialog that floats above the workbench. Each instance can only be shown once.\n */\n@Dependent\npublic class Bs3Modal extends Modal {\n\n    private final ModalBody body = GWT.create(ModalBody.class);\n\n    /**\n     * Used for enforcing the \"only show one time\" rule.\n     */\n    boolean hasBeenShown;\n\n    public Bs3Modal() {\n        setup();\n    }\n\n    protected void setup() {\n        this.add(body);\n        this.setDataBackdrop(ModalBackdrop.STATIC);\n        this.setFade(true);\n        this.setRemoveOnHide(true);\n        this.getElement().setAttribute(Attributes.ROLE,\n                                       \"dialog\");\n        this.getElement().setAttribute(Attributes.TABINDEX,\n                                       \"-1\");\n        this.addStyleName(WorkbenchResources.INSTANCE.CSS().modal());\n        this.setId(DOM.createUniqueId());\n    }\n\n    @Override\n    protected void onAttach() {\n        super.onAttach();\n        initFooter(this.getId());\n    }\n\n    private native void initFooter(final String id) /*-{\n        var footer = $wnd.jQuery('#' + id + ' .modal-footer');\n        if (footer.length == 0) {\n            this.@org.uberfire.client.views.pfly.modal.Bs3Modal::addDefaultFooter()();\n        }\n    }-*/;\n\n    /**\n     * Shows this modal dialog above the current workbench.\n     *\n     * @param afterShown  the action to perform once the dialog has been shown. Not null. Use {@link Commands#DO_NOTHING} if you don't have an \"after show\" action.\n     * @param afterClosed the action to perform once the dialog has been dismissed. Not null. Use {@link Commands#DO_NOTHING} if you don't have an \"after close\" action.\n     */\n    public void show(final Command afterShown,\n                     final Command afterClosed) {\n\n        checkNotNull(\"afterShown\",\n                     afterShown);\n        checkNotNull(\"afterClosed\",\n                     afterClosed);\n        this.addShownHandler(new ModalShownHandler() {\n            @Override\n            public void onShown(final ModalShownEvent showEvent) {\n                if (afterShown != null) {\n                    afterShown.execute();\n                }\n            }\n        });\n        this.addHiddenHandler(new ModalHiddenHandler() {\n            @Override\n            public void onHidden(final ModalHiddenEvent hiddenEvent) {\n                if (afterClosed != null) {\n                    afterClosed.execute();\n                }\n            }\n        });\n        this.show();\n    }\n\n    @Override\n    public void show() {\n        if (hasBeenShown) {\n            throw new IllegalStateException(\"This modal has already been shown. Create a new instance if you want to show another modal.\");\n        }\n        super.show();\n    }\n\n    /**\n     * Replaces the contents within the main body area of the modal. By default, the main body area is empty.\n     *\n     * @param content the new content for the main body area.\n     */\n    public void setContent(IsWidget content) {\n        body.clear();\n        body.add(content);\n    }\n\n    protected void addDefaultFooter() {\n        final Button close = GWT.create(Button.class);\n        close.setText(\"OK\");\n        close.setDataDismiss(ButtonDismiss.MODAL);\n        close.setType(ButtonType.PRIMARY);\n        setFooterContent(close);\n    }\n\n    public void setModalTitle(final String title) {\n        this.setTitle(SafeHtmlUtils.htmlEscape(title));\n    }\n\n    /**\n     * Replaces the current contents of the footer area with the given widget. By default (if you do not call this\n     * method), the footer contains an OK button that dismisses the dialog when clicked.\n     *\n     * @param content the new content for the footer area.\n     */\n    public void setFooterContent(IsWidget content) {\n        final ModalFooter footer = GWT.create(ModalFooter.class);\n        this.add(footer);\n        footer.add(content);\n    }\n\n    /**\n     * Sets the pixel height of the main content container.\n     */\n    public void setBodyHeight(int height) {\n        body.setHeight(height + \"px\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/modal/ErrorPopupView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.modal;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.inject.Instance;\nimport javax.inject.Inject;\n\nimport com.google.gwt.safehtml.shared.SafeHtmlUtils;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HTML;\nimport org.uberfire.client.workbench.widgets.common.ErrorPopupPresenter;\nimport org.uberfire.mvp.Command;\n\n/**\n * A popup that shows an error message\n */\n@Dependent\npublic class ErrorPopupView extends Composite implements ErrorPopupPresenter.View {\n\n    @Inject\n    private Instance<Bs3Modal> modalFactory;\n\n    @Override\n    public void showMessage(final String msg,\n                            final Command afterShow,\n                            final Command afterClose) {\n\n        final Bs3Modal modal = modalFactory.get();\n        modal.setModalTitle(\"Error\");\n        modal.setContent(new HTML(SafeHtmlUtils.fromString(msg)));\n        modal.show(afterShow,\n                   afterClose);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/ITextModel.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic class ITextModel {\n\n    public native String getValue();\n\n    public native int getLineLength(final int lineNumber);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/MonacoEditor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.dom.Element;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = \"window\", name = \"monaco\")\npublic class MonacoEditor {\n\n    public native void defineTheme(final String themeId,\n                                   final JavaScriptObject themeData);\n\n    public native MonacoStandaloneCodeEditor create(final Element themeId,\n                                                    final JavaScriptObject options);\n\n    public native void setTheme(final String feelThemeId);\n\n    @JsProperty(name = \"editor\")\n    public static native MonacoEditor get();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/MonacoLanguages.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = \"window\", name = \"monaco\")\npublic class MonacoLanguages {\n\n    public native void register(final JavaScriptObject language);\n\n    public native void setMonarchTokensProvider(final String languageId,\n                                                final JavaScriptObject languageDefinition);\n\n    public native void registerCompletionItemProvider(final String languageId,\n                                                      final JavaScriptObject completionItemProvider);\n\n    @JsProperty(name = \"languages\")\n    public static native MonacoLanguages get();\n\n    @JsFunction\n    public interface ProvideCompletionItemsFunction {\n\n        JavaScriptObject call(final ITextModel model,\n                              final Position position);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/MonacoStandaloneCodeEditor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport com.google.gwt.dom.client.NativeEvent;\nimport elemental2.core.JsObject;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic class MonacoStandaloneCodeEditor {\n\n    public JsObject _contentWidgets;\n\n    public native void focus();\n\n    public native void layout(JavaScriptObject dimensions);\n\n    public native void dispose();\n\n    public native String getValue();\n\n    public native void trigger(final String source,\n                               final String handlerId);\n\n    public native void setValue(final String value);\n\n    public native void onKeyDown(final CallbackFunction callback);\n\n    public native void onDidBlurEditorWidget(final CallbackFunction callback);\n\n    @JsOverlay\n    public final boolean isSuggestWidgetVisible() {\n        return MonacoStandaloneCodeEditorHelper.isSuggestWidgetVisible(this);\n    }\n\n    @JsFunction\n    public interface CallbackFunction {\n\n        void call(final NativeEvent event);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/MonacoStandaloneCodeEditorHelper.java",
    "content": "/*\n * Copyright 2020 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\n/**\n * This is class is a helper for {@link MonacoStandaloneCodeEditor}.\n * {@link MonacoStandaloneCodeEditor} is a native class, thus it cannot contain JSNI code.\n */\npublic class MonacoStandaloneCodeEditorHelper {\n\n    public static native boolean isSuggestWidgetVisible(final MonacoStandaloneCodeEditor codeEditor) /*-{\n        return codeEditor._contentWidgets['editor.widget.suggestWidget'] && codeEditor._contentWidgets['editor.widget.suggestWidget'].widget.state === 3;\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/monaco/jsinterop/Position.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.monaco.jsinterop;\n\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic class Position {\n\n    @JsProperty\n    public native int getColumn();\n\n    @JsProperty\n    public native int getLineNumber();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multipage/MultiPageEditorImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.widgets.multipage.MultiPageEditor;\nimport org.uberfire.client.workbench.widgets.multipage.MultiPageEditorView;\nimport org.uberfire.client.workbench.widgets.multipage.Multiple;\nimport org.uberfire.client.workbench.widgets.multipage.Page;\n\n@Dependent\npublic class MultiPageEditorImpl implements MultiPageEditor {\n\n    @Inject\n    @Multiple\n    private MultiPageEditorViewImpl view;\n\n    @Inject\n    private Event<MultiPageEditorSelectedPageEvent> selectedPageEvent;\n\n    @PostConstruct\n    public void init() {\n        view.enableSelectedPageEvent(selectedPageEvent);\n    }\n\n    public void addPage(final Page page) {\n        view.addPage(page);\n    }\n\n    public void addPage(int index, final Page page) {\n        getView().addPage(index, page);\n    }\n\n    public void disablePage(int index) {\n        getView().disablePage(index);\n    }\n\n    public void enablePage(int index) {\n        getView().enablePage(index);\n    }\n\n    public void selectPage(final int index) {\n        view.selectPage(index);\n    }\n\n    public int selectedPage() {\n        return view.selectedPage();\n    }\n\n    public void addTabBarWidget(final IsWidget customWidget) {\n        view.addTabBarWidget(customWidget);\n    }\n\n    @Override\n    public void clear() {\n        view.clear();\n    }\n\n    @Override\n    public MultiPageEditorView getView() {\n        return view;\n    }\n\n    @Override\n    public void addWidget(final IsWidget widget,\n                          final String label) {\n        view.addPage(new PageImpl(widget,\n                                  label));\n    }\n\n    @Override\n    public Widget asWidget() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multipage/MultiPageEditorSelectedPageEvent.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport org.uberfire.workbench.events.UberFireEvent;\n\npublic class MultiPageEditorSelectedPageEvent implements UberFireEvent {\n\n    private final int selectedPage;\n\n    public MultiPageEditorSelectedPageEvent(final int selectedPage) {\n        this.selectedPage = selectedPage;\n    }\n\n    public int getSelectedPage() {\n        return selectedPage;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multipage/MultiPageEditorViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport java.util.Objects;\nimport java.util.Optional;\n\nimport javax.enterprise.context.Dependent;\nimport javax.enterprise.event.Event;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.TabShowEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\nimport org.gwtbootstrap3.client.shared.event.TabShownHandler;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.uberfire.client.views.pfly.tab.ResizeTabPanel;\nimport org.uberfire.client.views.pfly.tab.TabPanelEntry;\nimport org.uberfire.client.workbench.widgets.multipage.MultiPageEditorView;\nimport org.uberfire.client.workbench.widgets.multipage.Multiple;\nimport org.uberfire.client.workbench.widgets.multipage.Page;\n\n@Dependent\n@Multiple\npublic class MultiPageEditorViewImpl extends ResizeTabPanel implements MultiPageEditorView {\n\n    private Event<MultiPageEditorSelectedPageEvent> selectedPageEvent;\n\n    @Override\n    public void init() {\n        super.init();\n\n        this.addShowHandler(new TabShowHandler() {\n\n            @Override\n            public void onShow(TabShowEvent e) {\n                onResize();\n                final TabPanelEntry tabPanelEntry = MultiPageEditorViewImpl.this.findEntryForTabWidget(e.getTab());\n                final PageViewImpl page = (PageViewImpl) tabPanelEntry.getContentPane().getWidget(0);\n                page.onFocus();\n            }\n        });\n\n        this.addShownHandler(getTabShownHandler());\n\n        this.tabBar.addStyleName(\"nav-tabs-pf\");\n        this.addStyleName(\"uf-multi-page-editor\");\n    }\n\n    public void enableSelectedPageEvent(final Event<MultiPageEditorSelectedPageEvent> selectedPageEvent) {\n        this.selectedPageEvent = selectedPageEvent;\n    }\n\n    public void addPage(final Page page) {\n\n        final TabPanelEntry tab = makeTabPanelEntry(page);\n\n        addItem(tab);\n        setAsActive(tab);\n    }\n\n    @Override\n    public void addPage(int index, final Page page) {\n\n        final TabPanelEntry tab = makeTabPanelEntry(page);\n\n        insertItem(tab, index);\n        setAsActive(tab);\n    }\n\n    TabPanelEntry makeTabPanelEntry(final Page page) {\n\n        final String title = page.getLabel();\n        final Widget contents = page.getView().asWidget();\n\n        return new TabPanelEntry(title, contents);\n    }\n\n    void setAsActive(final TabPanelEntry tab) {\n        if (this.getActiveTab() == null) {\n            tab.showTab();\n            tab.setActive(true);\n        }\n    }\n\n    public void selectPage(int index) {\n        this.selectTabIndex(index);\n    }\n\n    public int selectedPage() {\n        return this.getSelectedTabIndex();\n    }\n\n    @Override\n    public void disablePage(int index) {\n\n        if (!isValid(index)) {\n            return;\n        }\n\n        final Widget tab = getTabBar().getWidget(index);\n\n        tab.addStyleName(\"disabled\");\n        disableWidget(tab);\n    }\n\n    @Override\n    public void enablePage(int index) {\n\n        if (!isValid(index)) {\n            return;\n        }\n\n        final Widget tab = getTabBar().getWidget(index);\n\n        tab.removeStyleName(\"disabled\");\n        enableWidget(tab);\n    }\n\n    @Override\n    public int getPageIndex(final String title) {\n        final int tabsCount = getTabBar().getWidgetCount();\n        for (int tabIndex = 0; tabIndex < tabsCount; tabIndex++) {\n            if (getTabBar().getWidget(tabIndex) instanceof TabListItem) {\n                final TabListItem tab = (TabListItem) getTabBar().getWidget(tabIndex);\n                if (Objects.equals(tab.getText(), title)) {\n                    return tabIndex;\n                }\n            }\n        }\n        throw new IllegalArgumentException(\"Page with title: '\" + title + \"' doesn't exist.\");\n    }\n\n    boolean isValid(final int index) {\n        return getTabBar().getWidgetCount() > index;\n    }\n\n    private void enableWidget(final Widget tab) {\n        style(tab).clearProperty(\"pointerEvents\");\n    }\n\n    private void disableWidget(final Widget tab) {\n        style(tab).setProperty(\"pointerEvents\", \"none\");\n    }\n\n    private Style style(final Widget tab) {\n        return tab.getElement().getStyle();\n    }\n\n    TabShownHandler getTabShownHandler() {\n        return event -> {\n            onResize();\n\n            final TabListItem tab = event.getTab();\n            final TabPanelEntry tabPanelEntry = findEntryForTabWidget(tab);\n            final PageViewImpl page = (PageViewImpl) tabPanelEntry.getContentPane().getWidget(0);\n\n            getSelectedPageEvent().ifPresent(selectedPageEvent -> {\n                selectedPageEvent.fire(new MultiPageEditorSelectedPageEvent(tab.getTabIndex()));\n            });\n\n            page.onLostFocus();\n        };\n    }\n\n    private Optional<Event<MultiPageEditorSelectedPageEvent>> getSelectedPageEvent() {\n        return Optional.ofNullable(selectedPageEvent);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multipage/PageImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.workbench.widgets.multipage.Page;\nimport org.uberfire.client.workbench.widgets.multipage.PageView;\n\n/**\n *\n */\npublic class PageImpl implements Page {\n\n    private final String label;\n    private final PageView view;\n\n    public PageImpl(final IsWidget widget) {\n        this(widget,\n             \"\");\n    }\n\n    public PageImpl(final IsWidget widget,\n                    final String label) {\n        this.view = new PageViewImpl(this,\n                                     widget);\n        this.label = label;\n    }\n\n    public String getLabel() {\n        return label;\n    }\n\n    public void onFocus() {\n    }\n\n    public void onLostFocus() {\n    }\n\n    public PageView getView() {\n        return view;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multipage/PageViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ScrollPanel;\nimport org.uberfire.client.workbench.widgets.multipage.PageView;\n\npublic class PageViewImpl extends Composite implements PageView,\n                                                       RequiresResize {\n\n    private final PageImpl presenter;\n    private final ScrollPanel sp = new ScrollPanel();\n\n    public PageViewImpl(PageImpl presenter,\n                        IsWidget widget) {\n        this.presenter = presenter;\n        sp.setWidget(widget);\n        initWidget(sp);\n    }\n\n    public void onFocus() {\n        presenter.onFocus();\n    }\n\n    public void onLostFocus() {\n        presenter.onLostFocus();\n    }\n\n    public ScrollPanel getSp() {\n        return sp;\n    }\n\n    @Override\n    public void onResize() {\n        sp.onResize();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenMenuBuilder.java",
    "content": "/*\n * Copyright 2015 JBoss, by Red Hat, Inc\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multiscreen;\n\nimport java.util.List;\nimport java.util.Optional;\nimport java.util.function.BiFunction;\nimport java.util.function.Function;\nimport java.util.stream.Collectors;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.uberfire.client.views.pfly.widgets.Button;\nimport org.uberfire.client.views.pfly.widgets.KebabMenu;\nimport org.uberfire.client.views.pfly.widgets.KebabMenuItem;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\n\n@Dependent\npublic class MultiScreenMenuBuilder implements Function<MenuItem, Optional<HTMLElement>> {\n\n    @Inject\n    private AuthorizationManager authManager;\n\n    @Inject\n    private User identity;\n\n    @Inject\n    private ManagedInstance<KebabMenu> kebabMenus;\n\n    @Inject\n    private ManagedInstance<Button> buttons;\n\n    @Inject\n    private ManagedInstance<KebabMenuItem> kebabMenuItems;\n\n    @Inject\n    private HTMLDocument document;\n\n    @Override\n    public Optional<HTMLElement> apply(final MenuItem menuItem) {\n        return Optional.ofNullable(makeItem(menuItem,\n                                            true));\n    }\n\n    protected HTMLElement makeItem(final MenuItem item,\n                                   boolean isRoot) {\n        if (authManager.authorize(item,\n                                  identity) == false) {\n            return null;\n        }\n\n        if (item instanceof MenuItemCommand) {\n            final MenuItemCommand cmdItem = (MenuItemCommand) item;\n            return isRoot ? new RootMenuItemCommandMapper().apply(cmdItem) : new MenuItemCommandMapper().apply(cmdItem);\n        }\n\n        if (item instanceof MenuGroup) {\n            final MenuGroup groups = (MenuGroup) item;\n            final List<HTMLElement> subMenus = groups.getItems().stream().map(i -> makeItem(i,\n                                                                                            false)).collect(Collectors.toList());\n            return isRoot ? new RootMenuGroupMapper().apply(groups,\n                                                            subMenus) : new MenuGroupMapper().apply(groups,\n                                                                                                    subMenus);\n        }\n\n        if (item instanceof MenuCustom) {\n            return new MenuCustomMapper().apply((MenuCustom) item);\n        }\n\n        return null;\n    }\n\n    private class MenuCustomMapper implements Function<MenuCustom, HTMLElement> {\n\n        @Override\n        public HTMLElement apply(final MenuCustom menuCustom) {\n            final Object result = menuCustom.build();\n            if (result instanceof HTMLElement) {\n                return (HTMLElement) result;\n            }\n\n            if (result instanceof IsElement) {\n                return ((IsElement) result).getElement();\n            }\n\n            throw new RuntimeException(\"Unsupported custom menu type\");\n        }\n    }\n\n    private class RootMenuItemCommandMapper implements Function<MenuItemCommand, HTMLElement> {\n\n        @Override\n        public HTMLElement apply(final MenuItemCommand menuItem) {\n            final Button button = buttons.get();\n            button.setType(Button.ButtonType.BUTTON);\n            button.setButtonStyleType(Button.ButtonStyleType.DEFAULT);\n            button.setText(menuItem.getCaption());\n            button.setEnabled(menuItem.isEnabled());\n            button.setClickHandler(menuItem.getCommand());\n            menuItem.addEnabledStateChangeListener(button::setEnabled);\n            return button.getElement();\n        }\n    }\n\n    private class MenuItemCommandMapper implements Function<MenuItemCommand, HTMLElement> {\n\n        @Override\n        public HTMLElement apply(final MenuItemCommand menuItem) {\n            final KebabMenuItem item = kebabMenuItems.get();\n            item.setText(menuItem.getCaption());\n            item.setClickHandler(menuItem.getCommand());\n            return item.getElement();\n        }\n    }\n\n    private class RootMenuGroupMapper implements BiFunction<MenuGroup, List<HTMLElement>, HTMLElement> {\n\n        @Override\n        public HTMLElement apply(final MenuGroup menuItem,\n                                 final List<HTMLElement> subMenus) {\n            final KebabMenu menu = kebabMenus.get();\n            menu.setItemsAlignment(KebabMenu.ItemsAlignment.RIGHT);\n            subMenus.forEach(m -> {\n                if (m instanceof HTMLLIElement) {\n                    menu.addKebabItem((HTMLLIElement) m);\n                }\n            });\n            return menu.getElement();\n        }\n    }\n\n    private class MenuGroupMapper implements BiFunction<MenuGroup, List<HTMLElement>, HTMLElement> {\n\n        @Override\n        public HTMLElement apply(final MenuGroup menuItem,\n                                 final List<HTMLElement> subMenus) {\n            HTMLDivElement div = (HTMLDivElement) document.createElement(\"div\");\n            div.classList.add(\"form-group\");\n            subMenus.forEach(e -> div.appendChild(e));\n            return div;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenPartWidget.html",
    "content": "<div data-field=\"parts\"></div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenPartWidget.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multiscreen;\n\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedHashMap;\nimport java.util.Optional;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport com.google.gwt.event.logical.shared.BeforeSelectionEvent;\nimport com.google.gwt.event.logical.shared.BeforeSelectionHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport elemental2.dom.HTMLDivElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\n@Dependent\n@Named(\"MultiScreenPartWidget\")\n@Templated\npublic class MultiScreenPartWidget extends Composite implements MultiPartWidget {\n\n    @Inject\n    @DataField(\"parts\")\n    HTMLDivElement content;\n\n    @Inject\n    ManagedInstance<MultiScreenView> multiScreenViews;\n\n    @Inject\n    PanelManager panelManager;\n\n    @Inject\n    MultiScreenMenuBuilder menuBuilder;\n\n    private HashMap<PartDefinition, MultiScreenView> parts = new LinkedHashMap<>();\n\n    @Override\n    public void setPresenter(final WorkbenchPanelPresenter presenter) {\n        //no-op\n    }\n\n    @Override\n    public void setDndManager(WorkbenchDragAndDropManager dndManager) {\n        //no-op\n    }\n\n    @Override\n    public void clear() {\n        multiScreenViews.destroyAll();\n        parts.values().forEach(s -> content.removeChild(s.getElement()));\n        parts.clear();\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        view.getPresenter().getMenus(menus -> {\n            final PartDefinition partDefinition = view.getPresenter().getDefinition();\n            if (parts.containsKey(partDefinition) == false) {\n                final MultiScreenView screen = multiScreenViews.get();\n                screen.setContent(view);\n                screen.setTitle(view.getPresenter().getTitle());\n                if (view.getPresenter().getTitleDecoration() != null) {\n                    screen.setTitleWidget(view.getPresenter().getTitleDecoration());\n                }\n                if (parts.isEmpty() && partDefinition.getParentPanel().getPosition() == null) {\n                    screen.disableClose();\n                }\n                screen.setCloseHandler(() -> panelManager.closePart(partDefinition));\n\n                Optional.ofNullable(menus)\n                        .ifPresent(m -> m.getItems().stream().map(menuBuilder)\n                                .forEachOrdered(e -> e.ifPresent(element -> screen.addMenus(element)))\n                        );\n\n                content.appendChild(screen.getElement());\n                parts.put(partDefinition,\n                          screen);\n            }\n\n            selectPart(partDefinition);\n        });\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition part,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        final MultiScreenView screen = parts.get(part);\n        if (screen != null) {\n            screen.setTitle(title);\n            if (titleDecoration != null) {\n                screen.setTitleWidget(titleDecoration);\n            }\n        }\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition part) {\n        if (parts.containsKey(part) == false) {\n            return false;\n        }\n\n        parts.entrySet().forEach(e -> {\n            if (e.getKey().equals(part)) {\n                e.getValue().show();\n            } else {\n                e.getValue().hide();\n            }\n        });\n        return true;\n    }\n\n    @Override\n    public boolean remove(final PartDefinition part) {\n        final MultiScreenView screen = parts.remove(part);\n        if (screen == null) {\n            return false;\n        }\n\n        multiScreenViews.destroy(screen);\n        content.removeChild(screen.getElement());\n\n        parts.values().stream().reduce((f, s) -> s).ifPresent(s -> s.show());\n\n        return true;\n    }\n\n    @Override\n    public void setFocus(boolean hasFocus) {\n        //no-op\n    }\n\n    @Override\n    public void addOnFocusHandler(final Command doWhenFocused) {\n        //no-op\n    }\n\n    @Override\n    public int getPartsSize() {\n        return parts.size();\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return Collections.unmodifiableSet(parts.keySet());\n    }\n\n    @Override\n    public HandlerRegistration addBeforeSelectionHandler(final BeforeSelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          BeforeSelectionEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    @Override\n    public Widget asWidget() {\n        return this;\n    }\n\n    @Override\n    public void onResize() {\n        parts.values().stream().filter(s -> s.isVisible()).forEach(s -> s.onResize());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenView.html",
    "content": "<div class=\"multi-screen\" data-field=\"screen\">\n    <div class=\"page-content-kie gwt-container\">\n        <div class=\"multi-screen-toolbar-pf toolbar-pf\">\n            <div class=\"toolbar-pf-actions\">\n                <div class=\"toolbar-data-title-kie\" data-field=\"title\"></div>\n                <div class=\"toolbar-pf-action-right\" data-field=\"actions\">\n                    <div class=\"form-group\" data-field=\"close-group\">\n                        <button class=\"btn btn-link\" data-field=\"close\"><span class=\"pficon pficon-close\"></span></button>\n                    </div>\n                </div>\n            </div>\n        </div>\n        <div data-field=\"content\" class=\"main-container col-md-12 col-lg-12 gwt-container\"></div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenView.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multiscreen;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport elemental2.dom.HTMLElement;\nimport jsinterop.base.Js;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.widgets.Button;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class MultiScreenView implements IsElement,\n                                        RequiresResize {\n\n    @Inject\n    @DataField(\"screen\")\n    HTMLDivElement screen;\n\n    @Inject\n    @DataField(\"content\")\n    ResizeFlowPanel content;\n\n    @Inject\n    @DataField(\"title\")\n    HTMLDivElement title;\n\n    @Inject\n    @DataField(\"actions\")\n    HTMLDivElement actions;\n\n    HTMLDivElement actionsMenu;\n\n    @Inject\n    @DataField(\"close\")\n    Button close;\n\n    @Inject\n    @DataField(\"close-group\")\n    HTMLDivElement closeGroup;\n\n    @Inject\n    HTMLDocument document;\n\n    @Override\n    public HTMLElement getElement() {\n        return screen;\n    }\n\n    public void setContent(final IsWidget widget) {\n        content.add(widget);\n    }\n\n    public void setCloseHandler(final Command closeHandler) {\n        this.close.setClickHandler(closeHandler);\n    }\n\n    public void setTitle(final String title) {\n        this.title.textContent = title;\n    }\n\n    public void setTitleWidget(final IsWidget widget) {\n        final HTMLElement element = Js.cast(widget.asWidget().getElement());\n        HTMLDivElement div = (HTMLDivElement) document.createElement(\"div\");\n        div.style.setProperty(\"display\",\n                              \"inline-block\");\n        div.style.setProperty(\"padding-left\",\n                              \"10px\");\n        div.style.setProperty(\"vertical-align\",\n                              \"middle\");\n        div.appendChild(element);\n        this.title.appendChild(div);\n    }\n\n    public void show() {\n        screen.classList.remove(\"hidden\");\n    }\n\n    public boolean isVisible(){\n        return screen.classList.contains(\"hidden\") == false;\n    }\n\n    public void hide() {\n        screen.classList.add(\"hidden\");\n    }\n\n    public void addMenus(final HTMLElement element) {\n        if (actionsMenu == null) {\n            actionsMenu = (HTMLDivElement) document.createElement(\"div\");\n            actionsMenu.classList.add(\"form-group\");\n            if (actions.hasChildNodes()) {\n                actions.insertBefore(actionsMenu,\n                                     actions.childNodes.item(0));\n            } else {\n                actions.appendChild(actionsMenu);\n            }\n        }\n        actionsMenu.appendChild(element);\n    }\n\n    public void disableClose() {\n        actions.removeChild(closeGroup);\n    }\n\n    @Override\n    public void onResize() {\n        content.onResize();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenView.less",
    "content": "@import \"/org/uberfire/client/views/static/uberfire-variables.less\";\n\n.multi-screen {\n\n    background-color: @color-pf-white;\n    height: 100%;\n\n    // Page Content\n    .page-content-kie {\n        background-color: @color-pf-white;\n        padding-bottom: 1em;\n    }\n\n    .fixed-header + .page-content-kie {\n        padding-top: 4em;\n    }\n\n    .page-content-kie:after {\n        content: \" \";\n        display: table;\n        clear: both;\n    }\n\n    .main-container .multi-screen-toolbar-pf {\n        background-color: @color-pf-white;\n        padding: .8em 0;\n        border: 0;\n    }\n\n    .multi-screen-toolbar-pf {\n        padding: .8em 1.5em;\n    }\n\n    .multi-screen-toolbar-pf .form-group,\n    .multi-screen-toolbar-pf .btn-group {\n        margin-bottom: 0;\n        display: flex;\n    }\n\n    .multi-screen-toolbar-pf .form-group {\n        padding-right: 10px;\n    }\n\n    .multi-screen-toolbar-pf .form-group:last-of-type {\n        border-right: none;\n    }\n\n    .multi-screen-toolbar-pf .toolbar-pf-actions {\n        margin-bottom: 0;\n        display: flex;\n        justify-content: space-between;\n        align-items: center;\n    }\n\n    .multi-screen-toolbar-pf .toolbar-pf-action-right .form-group .btn+.btn {\n        margin-left: 10px;\n    }\n\n    .multi-screen-toolbar-pf .form-group .btn-link {\n        color: @color-pf-blue;\n        font-size: 1.0em;\n    }\n\n    .multi-screen-toolbar-pf .form-group .btn-link .pficon,\n    .multi-screen-toolbar-pf .form-group .btn-link .fa {\n        font-size: 1.3em;\n        margin-left: 5px;\n    }\n\n    .multi-screen-toolbar-pf .form-group .btn-link .pficon-close:not(:hover) {\n        color: @color-pf-black;\n    }\n\n    // Title for toolbar inside content section\n    .toolbar-data-title-kie {\n        display:table-cell;\n        float:left;\n        font-size: 1.5em;\n        margin-right: 1em;\n    }\n\n    .btn-group button {\n        margin: 0px 4px;\n    }\n\n    .btn-group .separator-left {\n        margin-left: 4px !important;\n        padding-left: 8px;\n        border-left: 1px solid #d1d1d1;\n    }\n\n    .gwt-container {\n        position: relative;\n        top: 0px;\n        left: 0px;\n        width: 100%;\n        height: 100%;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notfound/ActivityNotFoundView.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div>\n    <p><strong>Activity Not Found: </strong><span data-field=\"identifier\"></span></p>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notfound/ActivityNotFoundView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.notfound;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.html.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.workbench.widgets.notfound.ActivityNotFoundPresenter;\n\n/**\n * Gets shown inside a popup activity when the PlaceManager can't find a particular place.\n */\n@Dependent\n@Templated\npublic class ActivityNotFoundView extends Composite implements ActivityNotFoundPresenter.View {\n\n    private ActivityNotFoundPresenter presenter;\n\n    @Inject\n    @DataField\n    private Span identifier = new Span();\n\n    @Override\n    public void init(final ActivityNotFoundPresenter presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public void setRequestedPlaceIdentifier(final String identifier) {\n        this.identifier.setHTML(identifier);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.notifications;\n\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.DecoratedPopupPanel;\nimport org.gwtbootstrap3.client.ui.Alert;\n\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.constants.AlertType;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.workbench.widgets.animations.LinearFadeInAnimation;\nimport org.uberfire.client.workbench.widgets.animations.Pause;\nimport org.uberfire.client.workbench.widgets.animations.Sequencer;\nimport org.uberfire.workbench.events.NotificationEvent;\n\n/**\n * The view for an individual newly created notification message.\n */\npublic class NotificationPopupView extends DecoratedPopupPanel {\n\n    private final Alert notification = new Alert();\n\n    public NotificationPopupView() {\n        setStyleName(WorkbenchResources.INSTANCE.CSS().notification());\n        setWidget(notification);\n        notification.setDismissable(true);\n    }\n\n    /**\n     * Set the text to display\n     * @param text\n     */\n    public void setNotification(final String text) {\n        notification.setText(text);\n    }\n\n    public void setType(final NotificationEvent.NotificationType type) {\n        AlertType bs3Type;\n        switch (type) {\n            case ERROR:\n                bs3Type = AlertType.DANGER;\n                break;\n            case DEFAULT:\n                bs3Type = AlertType.INFO;\n                break;\n            default:\n                bs3Type = AlertType.valueOf(type.toString());\n                break;\n        }\n        notification.setType(bs3Type);\n    }\n\n    /**\n     * Set the width of the Notification pop-up\n     * @param width\n     */\n    public void setNotificationWidth(final String width) {\n        //Setting the width of the DecoratedPopupPanel causes it to be rendered incorrectly.\n        //We therefore set the size of an internal element that holds the actual content.\n        notification.setWidth(width);\n    }\n\n    public void show(final Command onCompleteCommand) {\n        show(onCompleteCommand,\n             true);\n    }\n\n    /**\n     * Show the Notification pop-up. This consists of fading the pop-up into\n     * view and pausing. Once complete the onCompleteCommand will be executed.\n     * @param onCompleteCommand\n     */\n    public void show(final Command onCompleteCommand,\n                     final boolean autoHide) {\n\n        final LinearFadeInAnimation fadeInAnimation = new LinearFadeInAnimation(this) {\n            @Override\n            public void onStart() {\n                super.onStart();\n                NotificationPopupView.this.show();\n            }\n        };\n\n        final Pause pauseAnimation = new Pause() {\n            @Override\n            public void onComplete() {\n                super.onComplete();\n                onCompleteCommand.execute();\n            }\n        };\n\n        final Sequencer s = new Sequencer();\n        s.add(fadeInAnimation, 250);\n\n        if (autoHide) {\n            s.add(pauseAnimation, 2000);\n        } else {\n            notification.addCloseHandler(evt -> onCompleteCommand.execute());\n        }\n\n        s.run();\n    }\n\n    public void addNavigation(String text, Command command) {\n        Anchor nav = new Anchor();\n        nav.setText(text);\n        nav.addClickHandler(evt -> command.execute());\n        nav.setMarginLeft(15);\n        notification.add(nav);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/notifications/NotificationPopupsManagerView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.notifications;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.Command;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\n\nimport org.kie.soup.commons.validation.PortablePreconditions;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.ActivityBeansCache;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.workbench.widgets.animations.LinearFadeOutAnimation;\nimport org.uberfire.client.workbench.widgets.notifications.NotificationManager.NotificationPopupHandle;\nimport org.uberfire.security.ResourceRef;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.client.workbench.widgets.notifications.NotificationManager;\nimport org.uberfire.workbench.events.NotificationEvent;\nimport org.uberfire.workbench.model.ActivityResourceType;\nimport org.jboss.errai.ioc.client.container.IOC;\nimport org.jboss.errai.ioc.client.container.SyncBeanDef;\nimport org.jboss.errai.security.shared.api.identity.User;\n\n@Dependent\npublic class NotificationPopupsManagerView implements NotificationManager.View {\n\n    private final int SPACING = 48;\n    private final List<PopupHandle> activeNotifications = new ArrayList<PopupHandle>();\n    private final List<PopupHandle> pendingRemovals = new ArrayList<PopupHandle>();\n    //When true we are in the process of removing a notification message\n    private boolean removing = false;\n    private int initialSpacing = SPACING;\n    private IsWidget container;\n    @Inject private PlaceManager placeManager;\n    @Inject private AuthorizationManager authorizationManager;\n    @Inject private User user;\n    @Inject private ActivityBeansCache activityBeansCache;\n\n    @Override\n    public void setContainer(final IsWidget container) {\n        this.container = PortablePreconditions.checkNotNull(\"container\",\n                                                            container);\n    }\n\n    @Override\n    public void setInitialSpacing(int spacing) {\n        this.initialSpacing = spacing;\n    }\n\n    @Override\n    public NotificationPopupHandle show(NotificationEvent event,\n                                        Command hideCommand) {\n        if (container == null) {\n            throw new IllegalStateException(\"The setContainer() method hasn't been called!\");\n        }\n\n        final NotificationPopupView view = new NotificationPopupView();\n        final PopupHandle popupHandle = new PopupHandle(view,\n                                                        event);\n\n        activeNotifications.add(popupHandle);\n        int size = activeNotifications.size();\n        int topMargin = (size == 1) ? initialSpacing : (size * SPACING) - (SPACING - initialSpacing);\n        view.setPopupPosition(getLeftPosition(container.asWidget()) + getMargin(),\n                              getTopPosition(container.asWidget()) + topMargin);\n        view.setNotification(event.getNotification());\n        view.setType(event.getType());\n        view.setNotificationWidth(getWidth() + \"px\");\n\n        if (event.hasNavigation()) {\n            final String identifier = event.getNavigationPlace().getIdentifier();\n            final SyncBeanDef<Activity> syncBeanDefActivity = activityBeansCache.getActivity(identifier);\n            final ResourceRef resourceRef = new ResourceRef(identifier, syncBeanDefActivity.getInstance().getResourceType());\n            final Boolean isAuthorized = authorizationManager.authorize(resourceRef, user);\n            if (isAuthorized) {\n                view.addNavigation(\n                        event.getNavigationText(),\n                        () -> {\n                            hideCommand.execute();\n                            placeManager.goTo(event.getNavigationPlace());\n                        });\n            }\n        }\n\n        view.show(hideCommand,\n                  event.autoHide());\n\n        return popupHandle;\n    }\n\n    private int getTopPosition(final Widget widget) {\n        int top = widget.getAbsoluteTop();\n        // if top is negative (due to scrolling) we try to align with the parent\n        // to make sure the notifications are always visible\n        if (top < 0 && widget.getParent() != null) {\n            top = getTopPosition(widget.getParent());\n        }\n        return Math.max(top,\n                        0);\n    }\n\n    private int getLeftPosition(final Widget widget) {\n        int left = widget.getAbsoluteLeft();\n        // if left is negative (due to scrolling) we try to align with the parent\n        // to make sure the notifications are always visible\n        if (left < 0 && widget.getParent() != null) {\n            left = getLeftPosition(widget.getParent());\n        }\n        return Math.max(left,\n                        0);\n    }\n\n    @Override\n    public void hide(final NotificationPopupHandle handle) {\n        if (container == null) {\n            throw new IllegalStateException(\"The setContainer() method hasn't been called!\");\n        }\n\n        final int removingIndex = activeNotifications.indexOf(handle);\n        if (removingIndex == -1) {\n            return;\n        }\n        if (removing) {\n            pendingRemovals.add((PopupHandle) handle);\n            return;\n        }\n        removing = true;\n        final NotificationPopupView view = ((PopupHandle) handle).view;\n        final LinearFadeOutAnimation fadeOutAnimation = new LinearFadeOutAnimation(view) {\n            @Override\n            public void onUpdate(double progress) {\n                super.onUpdate(progress);\n                for (int i = removingIndex; i < activeNotifications.size(); i++) {\n                    NotificationPopupView v = activeNotifications.get(i).view;\n                    final int left = v.getPopupLeft();\n                    final int top = (int) (((i + 1) * SPACING) - (progress * SPACING))\n                            - (SPACING - initialSpacing) + getTopPosition(container.asWidget());\n                    v.setPopupPosition(left,\n                                       top);\n                }\n            }\n\n            @Override\n            public void onComplete() {\n                super.onComplete();\n                view.hide();\n                activeNotifications.remove(handle);\n                removing = false;\n                if (pendingRemovals.size() > 0) {\n                    PopupHandle popupHandle = pendingRemovals.remove(0);\n                    hide(popupHandle);\n                }\n            }\n        };\n        fadeOutAnimation.run(500);\n    }\n\n    @Override\n    public void hideAll() {\n        for (NotificationPopupHandle handle : activeNotifications) {\n            hide(handle);\n        }\n    }\n\n    @Override\n    public boolean isShowing(NotificationEvent event) {\n        for (PopupHandle handle : activeNotifications) {\n            if (handle.event.equals(event)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    //80% of container width\n    private int getWidth() {\n        return (int) (container.asWidget().getElement().getClientWidth() * 0.8);\n    }\n\n    //10% of container width\n    private int getMargin() {\n        return (container.asWidget().getElement().getClientWidth() - getWidth()) / 2;\n    }\n\n    private static class PopupHandle implements NotificationPopupHandle {\n\n        final NotificationPopupView view;\n        final NotificationEvent event;\n\n        PopupHandle(NotificationPopupView view,\n                    NotificationEvent event) {\n            this.view = PortablePreconditions.checkNotNull(\"view\",\n                                                           view);\n            this.event = PortablePreconditions.checkNotNull(\"event\",\n                                                            event);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/popup/PopupViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.popup;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHiddenHandler;\nimport org.gwtbootstrap3.client.shared.event.ModalHideEvent;\nimport org.gwtbootstrap3.client.shared.event.ModalHideHandler;\nimport org.gwtbootstrap3.client.ui.ModalSize;\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport org.uberfire.client.views.pfly.modal.Bs3Modal;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\n\n@Dependent\npublic class PopupViewImpl extends Composite implements PopupView {\n\n    @Inject\n    private Bs3Modal modal;\n\n    @PostConstruct\n    public void init() {\n        final SimplePanel panel = new SimplePanel(modal);\n        initWidget(panel);\n    }\n\n    @Override\n    public void setContent(final IsWidget widget) {\n        modal.setContent(widget);\n    }\n\n    @Override\n    public void setSize(final WorkbenchPopupSize size) {\n        ModalSize modalSize = ModalSize.MEDIUM;\n        switch (size) {\n            case LARGE:\n                modalSize = ModalSize.LARGE;\n                break;\n            case MEDIUM:\n                modalSize = ModalSize.MEDIUM;\n                break;\n            case SMALL:\n                modalSize = ModalSize.SMALL;\n                break;\n        }\n        modal.setSize(modalSize);\n    }\n\n    @Override\n    public void setTitle(final String title) {\n        modal.setTitle(title);\n    }\n\n    @Override\n    public void show() {\n        modal.show();\n\n        modal.addHiddenHandler(new ModalHiddenHandler() {\n            @Override\n            public void onHidden(final ModalHiddenEvent hiddenEvent) {\n                CloseEvent.fire(PopupViewImpl.this,\n                                PopupViewImpl.this,\n                                false);\n            }\n        });\n\n        modal.addHideHandler(new ModalHideHandler() {\n            @Override\n            public void onHide(ModalHideEvent evt) {\n                CloseEvent.fire(PopupViewImpl.this,\n                                PopupViewImpl.this,\n                                false);\n            }\n        });\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public HandlerRegistration addCloseHandler(final CloseHandler<PopupView> handler) {\n        return addHandler(handler,\n                          CloseEvent.getType());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/resources/i18n/Constants.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.resources.i18n;\n\nimport org.jboss.errai.ui.shared.api.annotations.TranslationKey;\n\npublic interface Constants {\n\n    @TranslationKey(defaultValue = \"\")\n    String Actions = \"Actions\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ApplyLabel = \"ApplyLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String CancelLabel = \"CancelLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String FromLabel = \"FromLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ToLabel = \"ToLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String CustomRangeLabel = \"CustomRangeLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String WeekLabel = \"WeekLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SundayShort = \"SundayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String MondayShort = \"MondayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String TuesdayShort = \"TuesdayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String WednesdayShort = \"WednesdayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ThursdayShort = \"ThursdayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String FridayShort = \"FridayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String SaturdayShort = \"SaturdayShort\";\n\n    @TranslationKey(defaultValue = \"\")\n    String January = \"January\";\n\n    @TranslationKey(defaultValue = \"\")\n    String February = \"February\";\n\n    @TranslationKey(defaultValue = \"\")\n    String March = \"March\";\n\n    @TranslationKey(defaultValue = \"\")\n    String April = \"April\";\n\n    @TranslationKey(defaultValue = \"\")\n    String May = \"May\";\n\n    @TranslationKey(defaultValue = \"\")\n    String June = \"June\";\n\n    @TranslationKey(defaultValue = \"\")\n    String July = \"July\";\n\n    @TranslationKey(defaultValue = \"\")\n    String August = \"August\";\n\n    @TranslationKey(defaultValue = \"\")\n    String September = \"September\";\n\n    @TranslationKey(defaultValue = \"\")\n    String October = \"October\";\n\n    @TranslationKey(defaultValue = \"\")\n    String November = \"November\";\n\n    @TranslationKey(defaultValue = \"\")\n    String December = \"December\";\n\n    @TranslationKey(defaultValue = \"\")\n    String Menu = \"Menu\";\n\n    @TranslationKey(defaultValue = \"\")\n    String Home = \"Home\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ErrorPopupView_ShowDetailLabel = \"ErrorPopupView.ShowDetailLabel\";\n\n    @TranslationKey(defaultValue = \"\")\n    String ErrorPopupView_CloseDetailLabel = \"ErrorPopupView.CloseDetailLabel\";\n\n    @TranslationKey(defaultValue = \"Cancel\")\n    String ConfirmPopup_Cancel = \"ConfirmPopup.Cancel\";\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/ElementHelper.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport elemental2.dom.Node;\n\npublic class ElementHelper {\n\n    public static void insertAfter(final Node newNode,\n                                   final Node referenceNode) {\n        referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);\n    }\n\n    public static void insertBefore(final Node newNode,\n                                    final Node referenceNode) {\n        referenceNode.parentNode.insertBefore(newNode, referenceNode);\n    }\n\n    public static void remove(final Node element) {\n        element.parentNode.removeChild(element);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQuery.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport elemental2.dom.Element;\nimport elemental2.dom.Node;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\nimport static jsinterop.annotations.JsPackage.GLOBAL;\n\n@JsType(isNative = true)\npublic abstract class JQuery {\n\n    @JsProperty(namespace = GLOBAL, name = \"jQuery\")\n    public static JQuery $;\n\n    @JsMethod(namespace = GLOBAL, name = \"jQuery\")\n    public native static JQuery $(final Node selector);\n\n    @JsMethod(namespace = GLOBAL, name = \"jQuery\")\n    public native static JQuery $(final String selector);\n\n    public native JQuery animate(final JavaScriptObject properties,\n                                 final int duration);\n\n    public native JQuery on(final String event,\n                            final CallbackFunction callbackFunction);\n\n    public native JQuery append(final JQuery jQueryElement);\n\n    public native JQuery css(final JavaScriptObject properties);\n\n    public native JQuery detach();\n\n    public native JQueryList<Element> filter(final String selector);\n\n    public native JQueryElementOffset offset();\n\n    public native boolean contains(final Element container,\n                                   final Element contained);\n\n    @JsFunction\n    public interface CallbackFunction {\n\n        void call(final JQueryEvent event);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQueryElementOffset.java",
    "content": "package org.uberfire.client.views.pfly.selectpicker;\n\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQueryElementOffset {\n\n    public double top;\n\n    public double left;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQueryEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport elemental2.dom.Element;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQueryEvent {\n\n    public Element target;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQueryList.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQueryList<T> {\n\n    public int length;\n\n    public abstract T get(final int index);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQuerySelectPicker.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport elemental2.dom.Element;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsType;\n\nimport static jsinterop.annotations.JsPackage.GLOBAL;\n\n@JsType(isNative = true)\npublic abstract class JQuerySelectPicker {\n\n    @JsMethod(namespace = GLOBAL, name = \"jQuery\")\n    public native static JQuerySelectPicker $(final Element selector);\n\n    @JsMethod(namespace = GLOBAL, name = \"jQuery\")\n    public native static JQuerySelectPicker $(final String selector);\n\n    public native JQuerySelectPicker selectpicker(final String method);\n\n    public native JQuerySelectPicker selectpicker(final String method,\n                                                  final String value);\n\n    public native JQuerySelectPicker on(final String event,\n                                        final CallbackFunction callbackFunction);\n\n    public native JQuerySelectPicker off(final String event);\n\n    public native String val();\n\n    @JsFunction\n    public interface CallbackFunction {\n\n        void call(final JQuerySelectPickerEvent event);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQuerySelectPickerEvent.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQuerySelectPickerEvent {\n\n    public JQuerySelectPickerTarget target;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/selectpicker/JQuerySelectPickerTarget.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQuerySelectPickerTarget {\n\n    public String value;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/splash/SplashModalFooter.html",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<div>\n    <form class=\"form-inline\" role=\"form\">\n        <label class=\"pull-left\">\n            <div id=\"show\"></div> Don't show again\n        </label>\n        <button class=\"btn btn-default pull-right\" data-field=\"closeButton\">Close</button>\n    </form>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/splash/SplashModalFooter.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.splash;\n\nimport javax.annotation.PostConstruct;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.user.client.ui.Composite;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.CheckBox;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n/**\n * The footer component for the splash screen popup. Has a \"don't show again\" toggle and a close button.\n */\n@Templated\npublic class SplashModalFooter extends Composite {\n\n    private ParameterizedCommand<Boolean> closeCommand;\n\n    @Inject\n    @DataField\n    private CheckBox show;\n\n    @Inject\n    @DataField\n    private Button closeButton;\n\n    @PostConstruct\n    private void setup() {\n        closeButton.ensureDebugId(\"SplashModalFooter-close\");\n        show.ensureDebugId(\"SplashModalFooter-dontShowAgain\");\n    }\n\n    @EventHandler(\"closeButton\")\n    public void onOKButtonClick(final ClickEvent e) {\n        if (closeCommand != null) {\n            closeCommand.execute(!show.getValue());\n        }\n    }\n\n    public boolean getShowAgain() {\n        return !show.getValue();\n    }\n\n    /**\n     * Sets the command to be executed when the close button has been clicked. The argument passed to the command is the\n     * state of the \"don't show again\" checkbox.\n     */\n    public void setCloseCommand(ParameterizedCommand<Boolean> closeCommand) {\n        this.closeCommand = closeCommand;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/splash/SplashViewImpl.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.splash;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.logical.shared.CloseEvent;\nimport com.google.gwt.event.logical.shared.CloseHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.views.pfly.modal.Bs3Modal;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.Commands;\nimport org.uberfire.mvp.ParameterizedCommand;\n\n@Dependent\npublic class SplashViewImpl extends Composite implements SplashView {\n\n    private Boolean showAgain = null;\n\n    @Inject\n    private Bs3Modal modal;\n\n    @Inject\n    private SplashModalFooter footer;\n\n    @PostConstruct\n    public void setup() {\n        footer.setCloseCommand(new ParameterizedCommand<Boolean>() {\n            @Override\n            public void execute(final Boolean parameter) {\n                showAgain = parameter;\n                hide();\n            }\n        });\n\n        modal.setFooterContent(footer);\n\n        final SimplePanel panel = new SimplePanel(modal);\n        initWidget(panel);\n    }\n\n    @Override\n    public void setContent(final IsWidget widget,\n                           final Integer height) {\n        showAgain = null;\n        modal.setContent(widget);\n        if (height != null) {\n            modal.setBodyHeight(height);\n        }\n    }\n\n    @Override\n    public void setTitle(final String title) {\n        modal.setModalTitle(title);\n    }\n\n    @Override\n    public Boolean showAgain() {\n        return showAgain;\n    }\n\n    @Override\n    public void show() {\n        modal.show(Commands.DO_NOTHING,\n                   new Command() {\n                       @Override\n                       public void execute() {\n                           showAgain = footer.getShowAgain();\n                           CloseEvent.fire(SplashViewImpl.this,\n                                           SplashViewImpl.this,\n                                           false);\n                       }\n                   });\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @Override\n    public HandlerRegistration addCloseHandler(final CloseHandler<SplashView> handler) {\n        return addHandler(handler,\n                          CloseEvent.getType());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/style/PatternFlyStyles.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.style;\n\npublic class PatternFlyStyles {\n\n    public static final String NAV_ITEM_ICONIC = \"nav-item-iconic\";\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/sys/MomentUtils.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.sys;\n\nimport java.util.Optional;\n\nimport com.google.gwt.i18n.client.LocaleInfo;\n\npublic class MomentUtils {\n\n    protected static void setMomentLocale(){\n        setMomentLocale(getLocaleName(LocaleInfo.getCurrentLocale().getLocaleName()));\n    }\n\n    /**\n     * Transform GWT locale to moment.js locale\n     * See <a href=\"http://momentjs.com/docs/#/displaying/format/\">moment.js</a>\n     * @return\n     */\n    protected static String getLocaleName(final String gwtLocale) {\n        final String locale = Optional.of(gwtLocale).get().toLowerCase().replace(\"_\",\n                                                                                 \"-\");\n\n        if (locale.isEmpty() || \"default\".equals(locale)) {\n            return \"en\";\n        } else {\n            return locale;\n        }\n    }\n\n    public static native void setMomentLocale(final String locale) /*-{\n        $wnd.moment.locale(locale);\n    }-*/;\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/sys/PatternFlyBootstrapper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.sys;\n\nimport com.google.gwt.core.client.ScriptInjector;\nimport org.gwtbootstrap3.client.GwtBootstrap3ClientBundle;\n\nimport static org.uberfire.client.views.pfly.sys.MomentUtils.setMomentLocale;\n\n/**\n * Utilities for ensuring the PatternFly/BS3 system is working early enough that the app can start correctly.\n */\npublic class PatternFlyBootstrapper {\n\n    private static boolean isPrettifyLoaded = false;\n\n    private static boolean isBootstrapSelectLoaded = false;\n\n    private static boolean isBootstrapDateRangePickerLoaded = false;\n\n    private static boolean isMomentLoaded = false;\n\n    private static boolean isMomentTimeZoneLoaded = false;\n\n    private static boolean isPatternFlyLoaded = false;\n\n    private static boolean isD3Loaded = false;\n\n    private static boolean isJQueryUILoaded = false;\n\n    private static boolean isMonacoEditorLoaded = false;\n\n    /**\n     * Uses GWT's ScriptInjector to put jQuery in the page if it isn't already. All Errai IOC beans that rely on\n     * GWTBootstrap 3 widgets should call this before creating their first such widget.\n     */\n    public static void ensurejQueryIsAvailable() {\n        if (!isjQueryLoaded()) {\n            ScriptInjector.fromString(GwtBootstrap3ClientBundle.INSTANCE.jQuery().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n        }\n    }\n\n    public static void ensurePrettifyIsAvailable() {\n        if (!isPrettifyLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.prettify().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isPrettifyLoaded = true;\n        }\n    }\n\n    public static void ensureBootstrapSelectIsAvailable() {\n        if (!isBootstrapSelectLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.bootstrapSelect().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isBootstrapSelectLoaded = true;\n        }\n    }\n\n    public static void ensurePatternFlyIsAvailable() {\n        ensurejQueryIsAvailable();\n        ensureBootstrapSelectIsAvailable();\n        if (!isPatternFlyLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.patternFly().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isPatternFlyLoaded = true;\n        }\n    }\n\n    public static void ensureMomentIsAvailable() {\n        if (!isMomentLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.moment().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isMomentLoaded = true;\n        }\n        setMomentLocale();\n    }\n\n    public static void ensureMomentTimeZoneIsAvailable() {\n        if (!isMomentTimeZoneLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.momentTimeZone().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isMomentTimeZoneLoaded = true;\n        }\n    }\n\n    public static void ensureBootstrapDateRangePickerIsAvailable() {\n        ensureMomentIsAvailable();\n        if (!isBootstrapDateRangePickerLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.bootstrapDateRangePicker().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isBootstrapDateRangePickerLoaded = true;\n        }\n    }\n\n    public static void ensureD3IsAvailable() {\n        if (!isD3Loaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.d3().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isD3Loaded = true;\n        }\n    }\n\n    public static void ensureJQueryUIIsAvailable() {\n        if (!isJQueryUILoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.jQueryUI().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isJQueryUILoaded = true;\n        }\n    }\n\n    public static void ensureMonacoEditorLoaderIsAvailable() {\n        if (!isMonacoEditorLoaded) {\n            ScriptInjector.fromString(PatternFlyClientBundle.INSTANCE.monacoEditor().getText())\n                    .setWindow(ScriptInjector.TOP_WINDOW)\n                    .inject();\n            isMonacoEditorLoaded = true;\n        }\n    }\n\n    /**\n     * Checks to see if jQuery is already present.\n     *\n     * @return true is jQuery is loaded, false otherwise.\n     */\n    private static native boolean isjQueryLoaded() /*-{\n        return (typeof $wnd['jQuery'] !== 'undefined');\n    }-*/;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/sys/PatternFlyClientBundle.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.sys;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.resources.client.ClientBundle;\nimport com.google.gwt.resources.client.TextResource;\n\npublic interface PatternFlyClientBundle extends ClientBundle {\n\n    PatternFlyClientBundle INSTANCE = GWT.create(PatternFlyClientBundle.class);\n\n    @Source(\"org/uberfire/client/views/static/prettify/bin/prettify.min.js\")\n    TextResource prettify();\n\n    @Source(\"org/uberfire/client/views/static/bootstrap-select/js/bootstrap-select.min.js\")\n    TextResource bootstrapSelect();\n\n    @Source(\"org/uberfire/client/views/static/js/patternfly.min.js\")\n    TextResource patternFly();\n\n    @Source(\"org/uberfire/client/views/static/moment/moment-with-locales.min.js\")\n    TextResource moment();\n\n    @Source(\"org/uberfire/client/views/static/moment-timezone/moment-timezone-with-data-2012-2022.min.js\")\n    TextResource momentTimeZone();\n\n    @Source(\"org/uberfire/client/views/static/bootstrap-daterangepicker/daterangepicker.js\")\n    TextResource bootstrapDateRangePicker();\n\n    @Source(\"org/uberfire/client/views/static/d3/d3.min.js\")\n    TextResource d3();\n\n    @Source(\"org/uberfire/client/views/static/jquery-ui/jquery-ui.min.js\")\n    TextResource jQueryUI();\n\n    @Source(\"org/uberfire/client/views/static/appformer-js-monaco/monaco.min.js\")\n    TextResource monacoEditor();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/MultiTabWorkbenchPanelView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.Collection;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport org.uberfire.client.util.Layouts;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.panels.impl.AbstractMultiPartWorkbenchPanelView;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.PartDefinition;\n\n@Dependent\n@Named(\"MultiTabWorkbenchPanelView\")\npublic class MultiTabWorkbenchPanelView\n        extends AbstractMultiPartWorkbenchPanelView<MultiTabWorkbenchPanelPresenter> {\n\n    private UberTabPanel uberTabPanel;\n\n    @Inject\n    public MultiTabWorkbenchPanelView(final UberTabPanel uberTabPanel) {\n        this.uberTabPanel = uberTabPanel;\n    }\n\n    @Override\n    protected MultiPartWidget setupWidget() {\n        uberTabPanel.addStyleName(\"uf-multitab-panel\");\n        Layouts.setToFillParent(uberTabPanel);\n        addOnFocusHandler(uberTabPanel);\n        addSelectionHandler(uberTabPanel);\n\n        return uberTabPanel;\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return uberTabPanel.getParts();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/Resize.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.lang.annotation.Retention;\nimport javax.inject.Qualifier;\n\nimport static java.lang.annotation.RetentionPolicy.RUNTIME;\n\n@Qualifier\n@Retention(RUNTIME)\npublic @interface Resize {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/ResizeTabPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.user.client.ui.ProvidesResize;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.util.Layouts;\n\n@Dependent\n@Resize\npublic class ResizeTabPanel extends TabPanelWithDropdowns implements RequiresResize,\n                                                                     ProvidesResize {\n\n    @Override\n    public void onResize() {\n        final Widget parent = this.getParent();\n\n        int width = parent.getOffsetWidth();\n        int height = parent.getOffsetHeight();\n\n        if (width == 0 && height == 0) {\n            //it's `invisible` = makes no sense try to resize\n            return;\n        }\n\n        height = height - getTabBarHeight();\n        Layouts.setToFillParent(this);\n\n        // TabContent is just a container for all the TabPane divs, one of which is made visible at a time.\n        // For compatibility with GWT LayoutPanel, we have to set both layers of children to fill their parents.\n        // We do it in onResize() to get to the TabPanes no matter how they were added.\n        for (Widget child : tabContent) {\n            child.setPixelSize(width,\n                               height);\n            Layouts.setToFillParent(child);\n            if (child instanceof TabPane) {\n                final TabPane tabPane = (TabPane) child;\n                if (tabPane.isActive()) {\n                    for (int i = 0; i < tabPane.getWidgetCount(); i++) {\n                        final Widget tabChild = tabPane.getWidget(i);\n                        tabChild.setPixelSize(width,\n                                              height);\n                        Layouts.setToFillParent(tabChild);\n                        if (tabChild instanceof RequiresResize) {\n                            ((RequiresResize) tabChild).onResize();\n                        }\n                    }\n                }\n            }\n        }\n    }\n\n    /**\n     * Returns the height (in pixels) taken up by the tab bar.\n     */\n    public int getTabBarHeight() {\n        return tabBar.getOffsetHeight();\n    }\n\n    /**\n     * Makes the tab panel look more or less prominent.\n     * @param hasFocus if true, the tab panel will look more prominent. If false, the tab panel will look normal.\n     */\n    public void setFocus(boolean hasFocus) {\n        if (hasFocus) {\n            tabBar.addStyleName(WorkbenchResources.INSTANCE.CSS().activeNavTabs());\n        } else {\n            tabBar.removeStyleName(WorkbenchResources.INSTANCE.CSS().activeNavTabs());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/TabPanelEntry.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.dom.client.HasClickHandlers;\nimport com.google.gwt.event.dom.client.HasMouseDownHandlers;\nimport com.google.gwt.event.dom.client.MouseDownEvent;\nimport com.google.gwt.event.dom.client.MouseDownHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.base.HasActive;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponent;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\n/**\n * Represents an entry in a {@link TabPanelWithDropdowns}. Keeps track of the current title, the tab widget (which could\n * be one of two different types depending on whether the entry is at top-level tab or nested in a dropdown tab), and\n * the associated content widget.\n */\npublic class TabPanelEntry implements HasActive {\n\n    private final DropDownTabListItem tab;\n    /**\n     * Container for {@link #contents}.\n     */\n    private final TabPane contentPane;\n    /**\n     * The application-provided content widget that should show up when the tab is clicked.\n     */\n    private final Widget contents;\n    private String title;\n\n    public TabPanelEntry(String title,\n                         Widget contents) {\n        this.title = title;\n        this.tab = GWT.create(DropDownTabListItem.class);\n        this.tab.setText(title);\n        this.tab.initOuiaComponentAttributes();\n        this.contents = contents;\n\n        contentPane = GWT.create(TabPane.class);\n        contentPane.add(contents);\n\n        tab.setDataTargetWidget(contentPane);\n    }\n\n    public DropDownTabListItem getTabWidget() {\n        return tab;\n    }\n\n    public Widget getContents() {\n        return contents;\n    }\n\n    /**\n     * Returns the intermediate container that holds the real contents.\n     */\n    public TabPane getContentPane() {\n        return contentPane;\n    }\n\n    public String getTitle() {\n        return title;\n    }\n\n    public void setTitle(String title) {\n        this.title = title;\n        tab.setText(title);\n    }\n\n    public void setInDropdown(boolean inDropdown) {\n        tab.setInDropdown(inDropdown);\n    }\n\n    /**\n     * Returns true if this tab panel entry believes it's currently the active (displayed) tab in its tab panel.\n     */\n    @Override\n    public boolean isActive() {\n        return contentPane.isActive();\n    }\n\n    /**\n     * Sets or clears the active state on this tab. Does not actually cause the tab to hide or show.\n     */\n    @Override\n    public void setActive(boolean b) {\n        tab.setActive(b);\n        contentPane.setActive(b);\n    }\n\n    /**\n     * Makes this tab show itself and become the active tab, replacing whatever tab was previously active.\n     */\n    public void showTab() {\n        tab.showTab(false);\n    }\n\n    @Override\n    public String toString() {\n        return \"TabPanelEntry \\\"\" + title + \"\\\"\";\n    }\n\n    /**\n     * Represents the tab widget that lives in the tab bar or under a dropdown tab.\n     */\n    public static class DropDownTabListItem extends TabListItem implements HasClickHandlers,\n                                                                           HasMouseDownHandlers,\n                                                                           OuiaComponent {\n\n        public DropDownTabListItem() {\n            this(null);\n        }\n\n        public DropDownTabListItem(String label) {\n            super(label);\n            addStyleName(\"uf-dropdown-tab-list-item\");\n        }\n\n        /**\n         * Sets this tab for use in the top-level tab bar (isDropdown false) or inside a dropdown tab (isDropdown true).\n         */\n        public void setInDropdown(boolean inDropdown) {\n            anchor.setTabIndex(inDropdown ? -1 : 0);\n        }\n\n        /**\n         * Adds the given widget as a child of the anchor within the tab.\n         */\n        public void addToAnchor(Widget w) {\n            anchor.add(w);\n        }\n\n        @Override\n        public HandlerRegistration addClickHandler(ClickHandler handler) {\n            return addDomHandler(handler,\n                                 ClickEvent.getType());\n        }\n\n        @Override\n        public HandlerRegistration addMouseDownHandler(MouseDownHandler handler) {\n            return addDomHandler(handler,\n                                 MouseDownEvent.getType());\n        }\n\n        @Override\n        public OuiaComponentTypeAttribute ouiaComponentType() {\n            return new OuiaComponentTypeAttribute(\"editor-nav-tab\");\n        }\n\n        @Override\n        public OuiaComponentIdAttribute ouiaComponentId() {\n            return new OuiaComponentIdAttribute(getText());\n        }\n\n        @Override\n        public Consumer<OuiaAttribute> ouiaAttributeRenderer() {\n            return ouiaAttribute -> getElement().setAttribute(ouiaAttribute.getName(),\n                                                              ouiaAttribute.getValue());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/TabPanelWithDropdowns.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.ArrayList;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.common.collect.HashMultimap;\nimport com.google.common.collect.Multimap;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.TabShowEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\nimport org.gwtbootstrap3.client.shared.event.TabShownEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShownHandler;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabContent;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.gwtbootstrap3.client.ui.TabPanel;\nimport org.gwtbootstrap3.client.ui.constants.IconPosition;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.constants.Toggle;\n\nimport static com.google.gwt.i18n.client.HasDirection.Direction.LTR;\nimport static com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant.endOf;\n\n/**\n * A Bootstrap3 TabPanel which supports a mix of normal tabs and tabs that are dropdown menus. Selecting an item from a\n * dropdown menu tab causes that item's associated content to display in the tab panel's content area.\n */\n@Dependent\npublic class TabPanelWithDropdowns extends Composite {\n\n    private static TabPanelWithDropdownsBinder uiBinder = GWT.create(TabPanelWithDropdownsBinder.class);\n    /**\n     * Widgets we have created that can have the CSS style name \"active\" added to them. When a new tab is selected, all\n     * of these widgets get the \"active\" style removed from them.\n     */\n    private final Set<Widget> activatableWidgets = new HashSet<Widget>();\n    /**\n     * Removes the \"active\" style class from all widgets in {@link #activatableWidgets}, then propagates the event to\n     * the panel-level listeners.\n     */\n    private final TabShowHandler individualTabShowHandler = new TabShowHandler() {\n\n        @Override\n        public void onShow(TabShowEvent showEvent) {\n            for (Widget w : activatableWidgets) {\n                if (showEvent.getTab().asWidget() != w) {\n                    w.removeStyleName(Styles.ACTIVE);\n                }\n            }\n            TabPanelWithDropdowns.this.fireEvent(showEvent);\n        }\n    };\n    /**\n     * Propagates the event to the panel-level listeners.\n     */\n    private final TabShownHandler individualTabShownHandler = new TabShownHandler() {\n        @Override\n        public void onShown(TabShownEvent shownEvent) {\n            TabPanelWithDropdowns.this.fireEvent(shownEvent);\n        }\n    };\n    /**\n     * These are our own registrations on the events from the individual tabs, which must be removed when the associated\n     * tab is removed. This is <i>not</i> a record of registrations we've handed out at the panel level: those are\n     * managed by this widget's HandlerManager.\n     */\n    private final Multimap<TabPanelEntry, HandlerRegistration> tabHandlerRegistrations = HashMultimap.create();\n    /**\n     * All tabs (both top-level and nested) that have content associated with them. In other words, everything except\n     * the dropdown tabs themselves.\n     */\n    private final Set<TabPanelEntry> allContentTabs = new HashSet<TabPanelEntry>();\n    /**\n     * The area that contains the tab bar and any additional custom widgets\n     */\n    @UiField\n    protected HorizontalPanel tabBarPanel;\n    /**\n     * The bar at the top where the tabs sit.\n     */\n    @UiField\n    protected NavTabs tabBar;\n    /**\n     * The area where custom widgets can be added to the right end of the tab bar\n     */\n    @UiField\n    protected HorizontalPanel widgetsPanel;\n    /**\n     * The content area that shows the content for the currently selected tab.\n     */\n    @UiField\n    protected TabContent tabContent;\n\n    /**\n     * Registers a handler that is notified just before any tab in this panel (nested under a dropdown or not) is shown.\n     * @param tabShowHandler the handler that will receive the notifications.\n     */\n    public HandlerRegistration addShowHandler(TabShowHandler tabShowHandler) {\n        return addHandler(tabShowHandler,\n                          TabShowEvent.getType());\n    }\n\n    /**\n     * Registers a handler that is notified just after any tab in this panel (nested under a dropdown or not) is shown.\n     * @param tabShownHandler the handler that will receive the notifications.\n     */\n    public HandlerRegistration addShownHandler(TabShownHandler tabShownHandler) {\n        return addHandler(tabShownHandler,\n                          TabShownEvent.getType());\n    }\n\n    /**\n     * Creates an empty tab panel.\n     */\n    @PostConstruct\n    public void init() {\n        initWidget(uiBinder.createAndBindUi(this));\n    }\n\n    /**\n     * Adds a normal tab (not a dropdown) with the given label and contents.\n     * @param label the label for the tab itself.\n     * @param content the contents that should appear in the content area when the tab is selected.\n     * @return the newly created entry object that ties together the tab widget and its contents.\n     */\n    public TabPanelEntry addItem(String label,\n                                 Widget content) {\n        TabPanelEntry tab = new TabPanelEntry(label,\n                                              content);\n        addItem(tab);\n        return tab;\n    }\n\n    /**\n     * Adds a normal tab (not a dropdown) with the given label and contents (at the end of the tab bar).\n     * @param tab the label and contents associated with the new tab.\n     */\n    public void addItem(final TabPanelEntry tab) {\n\n        final int index = getAllContentTabs().size();\n\n        insertItem(tab, index);\n    }\n\n    /**\n     * Adds a normal tab (not a dropdown) with the given label and contents (in a specific index).\n     * @param tab the label and contents associated with the new tab.\n     */\n    public void insertItem(final TabPanelEntry tab,\n                           final int index) {\n\n        registerTabHandlers(tab);\n        insertTabAndContent(tab, index);\n        resizeTabContent();\n    }\n\n    void insertTabAndContent(final TabPanelEntry tab,\n                             final int index) {\n\n        final TabPanelEntry.DropDownTabListItem tabWidget = tab.getTabWidget();\n        final TabPane tabContentPane = tab.getContentPane();\n\n        getTabBar().insert(tab.getTabWidget(), index);\n\n        getAllContentTabs().add(tab);\n        getTabContent().add(tabContentPane);\n        getActivatableWidgets().add(tabWidget);\n    }\n\n    void registerTabHandlers(final TabPanelEntry tab) {\n\n        final Multimap<TabPanelEntry, HandlerRegistration> registrations = getTabHandlerRegistrations();\n        final TabPanelEntry.DropDownTabListItem tabWidget = tab.getTabWidget();\n\n        registrations.put(tab, tabWidget.addShowHandler(getIndividualTabShowHandler()));\n        registrations.put(tab, tabWidget.addShownHandler(getIndividualTabShownHandler()));\n    }\n\n    TabShowHandler getIndividualTabShowHandler() {\n        return individualTabShowHandler;\n    }\n\n    TabShownHandler getIndividualTabShownHandler() {\n        return individualTabShownHandler;\n    }\n\n    Multimap<TabPanelEntry, HandlerRegistration> getTabHandlerRegistrations() {\n        return tabHandlerRegistrations;\n    }\n\n    Set<TabPanelEntry> getAllContentTabs() {\n        return allContentTabs;\n    }\n\n    Set<Widget> getActivatableWidgets() {\n        return activatableWidgets;\n    }\n\n    public NavTabs getTabBar() {\n        return tabBar;\n    }\n\n    TabContent getTabContent() {\n        return tabContent;\n    }\n\n    HorizontalPanel getWidgetsPanel() {\n        return widgetsPanel;\n    }\n\n    /**\n     * Removes the given tab and its associated contents that were previously added with\n     * {@link #addItem(String, Widget)}. Has no effect if the item is not currently in this tab panel.\n     * @param tab the item to remove.\n     */\n    public boolean remove(TabPanelEntry tab) {\n        for (HandlerRegistration registration : tabHandlerRegistrations.removeAll(tab)) {\n            registration.removeHandler();\n        }\n        boolean removed = tabBar.remove(tab.getTabWidget());\n        tabContent.remove(tab.getContentPane());\n        activatableWidgets.remove(tab.getTabWidget());\n        allContentTabs.remove(tab);\n        resizeTabContent();\n        return removed;\n    }\n\n    void resizeTabContent() {\n        //When an Item is added to the TabBar recalculate the TabContent size.\n        //This cannot be performed in either the @PostConstruct or onAttach() methods as at\n        //these times the TabBar may not have any content and hence have no size.\n        tabContent.getElement().getStyle().setProperty(\"height\",\n                                                       \"calc(100% - \" + tabBar.getOffsetHeight() + \"px)\");\n    }\n\n    /**\n     * Adds a new tab to this panel that doesn't have any contents itself, but can contain multiple items that appear in\n     * a dropdown menu when the tab is clicked. This dropdown menu is initially empty. Items can be added and removed\n     * using the {@link DropDownTab#addItem(String, Widget)} and\n     * {@link DropDownTab#removeItem(String, Widget)} methods.\n     * @param label The text that should appear on the dropdown tab.\n     * @return the container for the items that appear when the tab is clicked.\n     */\n    public DropDownTab addDropdownTab(String label) {\n\n        AnchorListItem tab = new AnchorListItem(label);\n\n        // FIXME should actually subclass AnchorListItem and add a <b class=caret/> to the anchor elem\n        tab.setIcon(IconType.ANGLE_DOWN);\n        tab.setIconPosition(IconPosition.RIGHT);\n\n        tab.addStyleName(Styles.DROPDOWN_TOGGLE);\n        tab.setDataToggle(Toggle.DROPDOWN);\n\n        DropDownTab dropDownTab = new DropDownTab(tab);\n        tab.add(dropDownTab);\n        addDropdownTab(dropDownTab);\n\n        return dropDownTab;\n    }\n\n    /**\n     * Adds a pre-made dropdown tab to this tab panel. This can be used for re-attaching a dropdown tab that was\n     * previously added with {@link #addDropdownTab(String)} and then removed.\n     * @param tab the tab to add back\n     */\n    public void addDropdownTab(DropDownTab contents) {\n        AnchorListItem tab = contents.owningTab;\n\n        // TODO for each contained tab, reattach handlers and add to allContentTabs list\n\n        // gets set to active when one of the menu items is selected\n        activatableWidgets.add(tab);\n        tabBar.add(tab);\n    }\n\n    /**\n     * Removes all tabs and content from this tab panel.\n     */\n    public void clear() {\n        for (HandlerRegistration registration : tabHandlerRegistrations.values()) {\n            registration.removeHandler();\n        }\n        tabHandlerRegistrations.clear();\n        tabBar.clear();\n        activatableWidgets.clear();\n        tabContent.clear();\n        allContentTabs.clear();\n    }\n\n    /**\n     * Returns the tab whose contents are currently being displayed. The tab widget itself may be a top-level tab, or\n     * nested under a dropdown tab.\n     * @return the currently selected (active) tab. If no tab has been displayed yet, returns null.\n     */\n    public TabPanelEntry getActiveTab() {\n        for (TabPanelEntry entry : allContentTabs) {\n            if (entry.isActive()) {\n                return entry;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Returns the tab index associated with the current selected tab.\n     * @return the currently selected (active) tab index. -1 If there is no active tab\n     */\n    public int getSelectedTabIndex() {\n        final TabPanelEntry activeTab = getActiveTab();\n        if (activeTab == null) {\n            return -1;\n        } else {\n            return tabBar.getWidgetIndex(activeTab.getTabWidget());\n        }\n    }\n\n    public void selectTabIndex(int index) {\n        final TabListItem item = (TabListItem) tabBar.getWidget(index);\n        if (item != null) {\n            item.showTab();\n        }\n    }\n\n    /**\n     * Finds the TabPanelEntry associated with the given tab widget, even if it's nested in a DropdownTab.\n     */\n    public TabPanelEntry findEntryForTabWidget(final TabListItem tabWidget) {\n        for (TabPanelEntry entry : allContentTabs) {\n            if (entry.getTabWidget() == tabWidget) {\n                return entry;\n            }\n        }\n        return null;\n    }\n\n    public void addTabBarWidget(final IsWidget customWidget) {\n        this.getWidgetsPanel().add(customWidget);\n        this.getWidgetsPanel().setCellHorizontalAlignment(customWidget, endOf(LTR));\n    }\n\n    interface TabPanelWithDropdownsBinder\n            extends\n            UiBinder<TabPanel, TabPanelWithDropdowns> {\n\n    }\n\n    /**\n     * Container for the menu items that appear when the dropdown tab is clicked. Normally, should only be created by\n     * {@link TabPanelWithDropdowns#addDropdownTab(String)}.\n     */\n    public class DropDownTab extends DropDownMenu {\n\n        private final AnchorListItem owningTab;\n        private final List<TabPanelEntry> contents = new ArrayList<TabPanelEntry>();\n        private final Multimap<TabPanelEntry, HandlerRegistration> tabHandlerRegistrations = HashMultimap.create();\n\n        public DropDownTab(AnchorListItem owningTab) {\n            this.owningTab = owningTab;\n            addStyleName(\"uf-dropdown-tab-menu-container\");\n        }\n\n        public TabPanelEntry addItem(String label,\n                                     Widget content) {\n            TabPanelEntry tab = new TabPanelEntry(label,\n                                                  content);\n            addItem(tab);\n            return tab;\n        }\n\n        public void addItem(TabPanelEntry tab) {\n            tab.setInDropdown(true);\n            contents.add(tab);\n            allContentTabs.add(tab);\n\n            TabListItem tabWidget = tab.getTabWidget();\n            activatableWidgets.add(tabWidget);\n            tabHandlerRegistrations.put(tab,\n                                        tabWidget.addShowHandler(individualTabShowHandler));\n            tabHandlerRegistrations.put(tab,\n                                        tabWidget.addShownHandler(individualTabShownHandler));\n            tabHandlerRegistrations.put(tab,\n                                        tabWidget.addShownHandler(new TabShownHandler() {\n\n                                            @Override\n                                            public void onShown(TabShownEvent event) {\n                                                DropDownTab.this.getParent().addStyleName(Styles.ACTIVE);\n                                            }\n                                        }));\n\n            add(tabWidget);\n            tabContent.add(tab.getContentPane());\n        }\n\n        /**\n         * Sets the text that appears on this dropdown's main tab.\n         * @param text the new label for the dropdown tab.\n         */\n        public void setText(String text) {\n            owningTab.setText(text);\n        }\n\n        @Override\n        public void clear() {\n            for (TabPanelEntry tab : contents) {\n                tab.getContentPane().removeFromParent();\n                tab.getTabWidget().removeFromParent();\n\n                for (HandlerRegistration handlerRegistration : tabHandlerRegistrations.removeAll(tab)) {\n                    handlerRegistration.removeHandler();\n                }\n\n                activatableWidgets.remove(tab.getTabWidget());\n                allContentTabs.remove(tab);\n            }\n            contents.clear();\n        }\n\n        /**\n         * Returns the offset width of the dropdown tab widget itself ({@link #getOffsetWidth()} returns the width of the popup window).\n         */\n        public int getTabWidth() {\n            return owningTab.getOffsetWidth();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/TabPanelWithDropdowns.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\"\n             xmlns:c=\"urn:import:com.google.gwt.user.client.ui\">\n\n    <b:TabPanel addStyleNames=\"uf-tabbar-panel\">\n        <c:HorizontalPanel ui:field=\"tabBarPanel\" width=\"100%\">\n            <c:cell horizontalAlignment='ALIGN_LEFT'>\n                <b:NavTabs ui:field=\"tabBar\" addStyleNames=\"uf-tabbar-panel-nav-tabs\" />\n            </c:cell>\n            <c:cell horizontalAlignment='ALIGN_RIGHT'>\n                <c:HorizontalPanel ui:field=\"widgetsPanel\" addStyleNames=\"uf-tabbar-panel-widgets\" width=\"0px\" horizontalAlignment=\"ALIGN_RIGHT\" />\n            </c:cell>\n        </c:HorizontalPanel>\n\n        <b:TabContent ui:field=\"tabContent\" />\n    </b:TabPanel>\n\n</ui:UiBinder> "
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/tab/UberTabPanel.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.event.logical.shared.BeforeSelectionEvent;\nimport com.google.gwt.event.logical.shared.BeforeSelectionHandler;\nimport com.google.gwt.event.logical.shared.SelectionEvent;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.Button;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.RequiresResize;\nimport com.google.gwt.user.client.ui.ResizeComposite;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.gwtbootstrap3.client.shared.event.TabShowEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\nimport org.gwtbootstrap3.client.shared.event.TabShownEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShownHandler;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.resources.WorkbenchResources;\nimport org.uberfire.client.views.pfly.tab.TabPanelWithDropdowns.DropDownTab;\nimport org.uberfire.client.workbench.panels.MultiPartWidget;\nimport org.uberfire.client.workbench.panels.WorkbenchPanelPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\nimport org.uberfire.client.workbench.widgets.dnd.WorkbenchDragAndDropManager;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.kie.soup.commons.validation.PortablePreconditions.checkNotNull;\n\n/**\n * A wrapper around {@link TabPanelWithDropdowns} that adds the following capabilities:\n * <ul>\n * <li>Tabs that don't fit in the tab bar are automatically collapsed into a dropdown\n * <li>Each tab gets a close button\n * <li>Obeys the RequiresResize/ProvidesResize contract (onResize() calls are propagated\n * to the visible tab content widgets)\n * <li>Participates in UberFire's panel focus system\n * </ul>\n */\n@Dependent\npublic class UberTabPanel extends ResizeComposite implements MultiPartWidget,\n                                                             ClickHandler {\n\n    private static final int MARGIN = 20;\n    final List<WorkbenchPartPresenter> parts = new ArrayList<WorkbenchPartPresenter>();\n    final Map<WorkbenchPartPresenter.View, TabPanelEntry> tabIndex = new HashMap<WorkbenchPartPresenter.View, TabPanelEntry>();\n    final Map<TabPanelEntry, WorkbenchPartPresenter.View> tabInvertedIndex = new HashMap<TabPanelEntry, WorkbenchPartPresenter.View>();\n    final Map<PartDefinition, TabPanelEntry> partTabIndex = new HashMap<PartDefinition, TabPanelEntry>();\n    private final List<Command> focusGainedHandlers = new ArrayList<Command>();\n    WorkbenchDragAndDropManager dndManager;\n    private ResizeTabPanel tabPanel;\n    private DropDownTab dropdownTab;\n    /**\n     * Flag protecting {@link #updateDisplayedTabs()} from recursively invoking itself through events that it causes.\n     */\n    private boolean updating;\n    private boolean hasFocus = false;\n    private PlaceManager panelManager;\n\n    @Inject\n    public UberTabPanel(final PlaceManager panelManager,\n                        final @Resize ResizeTabPanel tabPanel) {\n        this.panelManager = checkNotNull(\"panelManager\",\n                                         panelManager);\n        this.tabPanel = checkNotNull(\"tabPanel\",\n                                     tabPanel);\n    }\n\n    @PostConstruct\n    public void init() {\n        this.dropdownTab = tabPanel.addDropdownTab(\"More...\");\n\n        tabPanel.addShowHandler(new TabShowHandler() {\n\n            @Override\n            public void onShow(TabShowEvent e) {\n                if (e.getTab() != null) {\n                    final TabPanelEntry selected = tabPanel.findEntryForTabWidget(e.getTab());\n                    BeforeSelectionEvent\n                            .fire(UberTabPanel.this,\n                                  tabInvertedIndex.get(selected).getPresenter().getDefinition());\n                }\n            }\n        });\n        tabPanel.addShownHandler(new TabShownHandler() {\n\n            @Override\n\n            public void onShown(TabShownEvent e) {\n                onResize();\n                if (e.getTab() != null) {\n                    final TabPanelEntry selected = tabPanel.findEntryForTabWidget(e.getTab());\n                    SelectionEvent\n                            .fire(UberTabPanel.this,\n                                  tabInvertedIndex.get(selected).getPresenter().getDefinition());\n                }\n            }\n        });\n\n        tabPanel.addDomHandler(UberTabPanel.this,\n                               ClickEvent.getType());\n\n        initWidget(tabPanel);\n    }\n\n    @Override\n    public void clear() {\n        parts.clear();\n        tabPanel.clear();\n        dropdownTab.clear();\n        partTabIndex.clear();\n        tabIndex.clear();\n        tabInvertedIndex.clear();\n    }\n\n    /**\n     * Updates the {@link #tabPanel} to contain a tab for each part in {@link #parts} in the order the parts\n     */\n    private void updateDisplayedTabs() {\n        if (updating) {\n            return;\n        }\n        try {\n            updating = true;\n            tabPanel.clear();\n            dropdownTab.clear();\n\n            if (parts.size() == 0) {\n                return;\n            }\n\n            int availableSpace = tabPanel.getOffsetWidth();\n            TabPanelEntry selectedTab = null;\n\n            // the number of regular (not dropdown) tabs in the tab bar\n            int regularTabCount = 0;\n\n            // add and measure all tabs\n            for (int i = 0; i < parts.size(); i++) {\n                WorkbenchPartPresenter part = parts.get(i);\n                TabPanelEntry tabPanelEntry = partTabIndex.get(part.getDefinition());\n                if (tabPanelEntry.isActive()) {\n                    selectedTab = tabPanelEntry;\n                }\n                tabPanelEntry.setActive(false);\n                tabPanel.addItem(tabPanelEntry);\n                regularTabCount++;\n                availableSpace -= tabPanelEntry.getTabWidget().getOffsetWidth();\n            }\n\n            // if we didn't find any selected tab, let's select the first one\n            if (selectedTab == null) {\n                TabPanelEntry firstTab = getTab(0);\n                selectedTab = firstTab;\n            }\n\n            // now work from right to left to find out how many tabs we have to collapse into the dropdown\n            if (availableSpace < 0) {\n                LinkedList<TabPanelEntry> newDropdownContents = new LinkedList<TabPanelEntry>();\n                dropdownTab.setText(\"More...\");\n                tabPanel.addDropdownTab(dropdownTab);\n                while (availableSpace - dropdownTab.getTabWidth() < 0 && regularTabCount > 1) {\n                    // get the last tab that isn't the dropdown tab\n                    TabPanelEntry tab = getTab(--regularTabCount);\n                    availableSpace += tab.getTabWidget().getOffsetWidth();\n                    tabPanel.remove(tab);\n                    newDropdownContents.addFirst(tab);\n                    if (tab == selectedTab) {\n                        dropdownTab.setText(selectedTab.getTitle());\n                    }\n                }\n\n                for (TabPanelEntry l : newDropdownContents) {\n                    dropdownTab.addItem(l);\n                }\n            }\n\n            selectedTab.showTab();\n        } finally {\n            updating = false;\n        }\n    }\n\n    private TabPanelEntry getTab(int i) {\n        return checkNotNull(\"part entry in map\",\n                            partTabIndex.get(parts.get(i).getDefinition()));\n    }\n\n    @Override\n    public boolean selectPart(final PartDefinition id) {\n        final TabPanelEntry tab = partTabIndex.get(id);\n        if (tab != null) {\n            tab.showTab();\n        }\n        return false;\n    }\n\n    @Override\n    public boolean remove(final PartDefinition id) {\n        final TabPanelEntry tab = partTabIndex.get(id);\n        if (tab == null) {\n            return false;\n        }\n        final boolean wasActive = tab.isActive();\n\n        View partView = tabInvertedIndex.remove(tab);\n        int removedTabIndex = parts.indexOf(partView.getPresenter());\n        parts.remove(removedTabIndex);\n        tabIndex.remove(partView);\n        partTabIndex.remove(id);\n\n        updateDisplayedTabs();\n\n        if (removedTabIndex >= 0 && wasActive && parts.size() > 0) {\n            selectPart(parts.get(removedTabIndex <= 0 ? 0 : removedTabIndex - 1).getDefinition());\n        }\n\n        return true;\n    }\n\n    @Override\n    public void changeTitle(final PartDefinition id,\n                            final String title,\n                            final IsWidget titleDecoration) {\n        final TabPanelEntry tab = partTabIndex.get(id);\n        if (tab != null) {\n            tab.setTitle(title);\n        }\n    }\n\n    @Override\n    public HandlerRegistration addBeforeSelectionHandler(final BeforeSelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          BeforeSelectionEvent.getType());\n    }\n\n    @Override\n    public HandlerRegistration addSelectionHandler(final SelectionHandler<PartDefinition> handler) {\n        return addHandler(handler,\n                          SelectionEvent.getType());\n    }\n\n    @Override\n    public void setPresenter(final WorkbenchPanelPresenter presenter) {\n        // not needed\n    }\n\n    @Override\n    public void addPart(final WorkbenchPartPresenter.View view) {\n        if (!tabIndex.containsKey(view)) {\n            final TabPanelEntry tab = tabPanel.addItem(view.getPresenter().getTitle(),\n                                                       view.asWidget());\n\n            resizeIfNeeded(view.asWidget());\n\n            tabIndex.put(view,\n                         tab);\n            tabInvertedIndex.put(tab,\n                                 view);\n            partTabIndex.put(view.getPresenter().getDefinition(),\n                             tab);\n\n            dndManager.makeDraggable(view,\n                                     tab.getTabWidget());\n            addCloseToTab(tab);\n\n            parts.add(view.getPresenter());\n            tabIndex.put(view,\n                         tab);\n            updateDisplayedTabs();\n        }\n    }\n\n    /**\n     * The GwtBootstrap3 TabPanel doesn't support the RequiresResize/ProvidesResize contract, and UberTabPanel fills in\n     * the gap. This helper method allows us to call onResize() on the widgets that need it.\n     *\n     * @param widget the widget that has just been resized\n     */\n    private void resizeIfNeeded(final Widget widget) {\n        if (isAttached() && widget instanceof RequiresResize) {\n            ((RequiresResize) widget).onResize();\n        }\n    }\n\n    @Override\n    public void onResize() {\n        updateDisplayedTabs();\n        tabPanel.onResize();\n    }\n\n    private void addCloseToTab(final TabPanelEntry tab) {\n        final Button close = new Button(\"&times;\");\n        close.setStyleName(\"close\");\n        close.addStyleName(WorkbenchResources.INSTANCE.CSS().tabCloseButton());\n        close.addClickHandler(new ClickHandler() {\n            @Override\n            public void onClick(final ClickEvent event) {\n                final WorkbenchPartPresenter.View partToDeselect = tabInvertedIndex.get(tab);\n                panelManager.closePlace(partToDeselect.getPresenter().getDefinition().getPlace());\n            }\n        });\n\n        tab.getTabWidget().addToAnchor(close);\n    }\n\n    @Override\n    public void setDndManager(final WorkbenchDragAndDropManager dndManager) {\n        this.dndManager = dndManager;\n    }\n\n    @Override\n    public void setFocus(final boolean hasFocus) {\n        this.hasFocus = hasFocus;\n        tabPanel.setFocus(hasFocus);\n    }\n\n    @Override\n    public void onClick(final ClickEvent event) {\n        if (!hasFocus) {\n            fireFocusGained();\n            View view = getSelectedPart();\n            if (view != null) {\n                SelectionEvent.fire(UberTabPanel.this,\n                                    view.getPresenter().getDefinition());\n            }\n        }\n    }\n\n    private View getSelectedPart() {\n        return tabInvertedIndex.get(tabPanel.getActiveTab());\n    }\n\n    private void fireFocusGained() {\n        for (int i = focusGainedHandlers.size() - 1; i >= 0; i--) {\n            focusGainedHandlers.get(i).execute();\n        }\n    }\n\n    @Override\n    public void addOnFocusHandler(final Command doWhenFocused) {\n        focusGainedHandlers.add(checkNotNull(\"doWhenFocused\",\n                                             doWhenFocused));\n    }\n\n    @Override\n    public int getPartsSize() {\n        return partTabIndex.size();\n    }\n\n    @Override\n    public Collection<PartDefinition> getParts() {\n        return Collections.unmodifiableSet(partTabIndex.keySet());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/toolbar/WorkbenchToolBarView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.toolbar;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.enterprise.context.Dependent;\n\nimport com.google.gwt.animation.client.Animation;\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.dom.client.ClickEvent;\nimport com.google.gwt.event.dom.client.ClickHandler;\nimport com.google.gwt.uibinder.client.UiBinder;\nimport com.google.gwt.uibinder.client.UiField;\nimport com.google.gwt.uibinder.client.UiHandler;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.Panel;\nimport com.google.gwt.user.client.ui.RootPanel;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.ButtonToolBar;\nimport org.gwtbootstrap3.client.ui.Tooltip;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\nimport org.uberfire.client.resources.i18n.WorkbenchConstants;\nimport org.uberfire.client.views.pfly.sys.PatternFlyBootstrapper;\nimport org.uberfire.client.workbench.widgets.toolbar.WorkbenchToolBarPresenter;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\nimport org.uberfire.workbench.model.toolbar.ToolBarItem;\nimport org.uberfire.workbench.model.toolbar.ToolBarTypeIcon;\n\nimport static org.uberfire.plugin.PluginUtil.ensureIterable;\n\n/**\n * The Tool Bar widget\n */\n@Dependent\npublic class WorkbenchToolBarView extends Composite\n        implements\n        WorkbenchToolBarPresenter.View {\n\n    private static WorkbenchToolBarViewBinder uiBinder = GWT.create(WorkbenchToolBarViewBinder.class);\n    //Map of ToolBar to GWT Widgets used to represent them\n    private final Map<String, ButtonGroup> toolBarItemsMap = new HashMap<String, ButtonGroup>();\n    @UiField\n    public FlowPanel mainContainer;\n\n    @UiField\n    public FlowPanel container;\n\n    @UiField\n    public ButtonToolBar toolBar;\n\n    @UiField\n    public SimplePanel simpleMargin;\n\n    @UiField\n    public com.google.gwt.user.client.ui.Button viewControl;\n\n    @UiField\n    public Tooltip tip;\n\n    private State state = State.EXPANDED;\n\n    public WorkbenchToolBarView() {\n        PatternFlyBootstrapper.ensurejQueryIsAvailable();\n        initWidget(uiBinder.createAndBindUi(this));\n        tip.setTitle(WorkbenchConstants.INSTANCE.collapseToolbar());\n        tip.setPlacement(Placement.LEFT);\n        tip.setWidget(viewControl);\n        simpleMargin.setVisible(false);\n    }\n\n    @Override\n    public void addToolBar(final ToolBar _toolBar) {\n\n        final ButtonGroup bgroup = new ButtonGroup();\n\n        if (toolBarItemsMap.size() == 0) {\n            bgroup.getElement().getStyle().setPaddingLeft(19,\n                                                          Style.Unit.PX);\n        }\n\n        for (final ToolBarItem item : ensureIterable(_toolBar.getItems())) {\n            Button button = new Button();\n            button.setIcon(IconType.valueOf(((ToolBarTypeIcon) item.getIcon()).getType().toString()));\n            button.setEnabled(item.isEnabled());\n            button.addClickHandler(new ClickHandler() {\n                @Override\n                public void onClick(final ClickEvent event) {\n                    item.getCommand().execute();\n                }\n            });\n\n            Tooltip tooltip = new Tooltip(button);\n            tooltip.setPlacement(Placement.BOTTOM);\n            bgroup.add(tooltip);\n        }\n\n        toolBarItemsMap.put(_toolBar.getIdentifier(),\n                            bgroup);\n\n        toolBar.add(bgroup);\n    }\n\n    /**\n     * Remove a Tool Bar item from the view.\n     */\n    @Override\n    public void removeToolBar(final ToolBar _toolBar) {\n        toolBar.remove(toolBarItemsMap.remove(_toolBar.getIdentifier()));\n    }\n\n    @Override\n    public int getHeight() {\n        if (isExpanded()) {\n            return getOffsetHeight();\n        }\n        return 0;\n    }\n\n    private boolean isExpanded() {\n        return state == State.EXPANDED;\n    }\n\n    @Override\n    public void hide() {\n        container.setVisible(false);\n        simpleMargin.setVisible(true);\n    }\n\n    @Override\n    public void show() {\n        container.setVisible(true);\n        simpleMargin.setVisible(false);\n    }\n\n    @UiHandler(\"viewControl\")\n    void handleClick(final ClickEvent e) {\n        if (isExpanded()) {\n            collapse();\n        } else {\n            expand();\n        }\n    }\n\n    private void expand() {\n        container.removeFromParent();\n        container.getElement().getStyle().clearTop();\n        container.getElement().getStyle().clearPosition();\n        container.getElement().getStyle().clearZIndex();\n        mainContainer.add(container);\n\n        tip.setTitle(WorkbenchConstants.INSTANCE.collapseToolbar());\n        tip.setPlacement(Placement.LEFT);\n        tip.setWidget(viewControl);\n        tip.reconfigure();\n\n        new ExpandAnimation().animate(8,\n                                      getOffsetWidth() - 1,\n                                      500);\n        state = State.EXPANDED;\n    }\n\n    private void collapse() {\n        new CollapseAnimation().animate(getOffsetWidth(),\n                                        8,\n                                        500);\n\n        container.removeFromParent();\n        container.getElement().getStyle().setTop(getAbsoluteTop(),\n                                                 Style.Unit.PX);\n        container.getElement().getStyle().setPosition(Style.Position.FIXED);\n        container.getElement().getStyle().setZIndex(Integer.MAX_VALUE);\n        RootPanel.get().add(container);\n\n        tip.setTitle(WorkbenchConstants.INSTANCE.expandToolbar());\n        tip.setPlacement(Placement.RIGHT);\n        tip.setWidget(viewControl);\n        tip.reconfigure();\n\n        state = State.COLLAPSED;\n    }\n\n    enum State {\n        EXPANDED,\n        COLLAPSED;\n    }\n\n    interface WorkbenchToolBarViewBinder\n            extends\n            UiBinder<Panel, WorkbenchToolBarView> {\n\n    }\n\n    private class ExpandAnimation extends Animation {\n\n        private int endSize;\n        private int startSize;\n        private int startTabLeft;\n        private int endTabLeft;\n\n        @Override\n        protected void onComplete() {\n            toolBar.getElement().getStyle().clearLeft();\n            container.getElement().getStyle().clearWidth();\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            double delta = (endSize - startSize) * progress;\n            double newSize = startSize + delta;\n\n            double deltaLeft = (endTabLeft - startTabLeft) * progress;\n            double newLeft = startTabLeft + deltaLeft;\n\n            toolBar.getElement().getStyle().setLeft(newLeft,\n                                                    Style.Unit.PX);\n            container.setWidth(newSize + \"px\");\n        }\n\n        void animate(int startSize,\n                     int endSize,\n                     int duration) {\n            this.startSize = startSize;\n            this.endSize = endSize;\n            this.startTabLeft = toolBar.getAbsoluteLeft();\n            this.endTabLeft = 0;\n            run(duration);\n        }\n    }\n\n    private class CollapseAnimation extends Animation {\n\n        private int endSize;\n        private int startSize;\n\n        @Override\n        protected void onComplete() {\n            container.setWidth(null);\n        }\n\n        @Override\n        protected void onUpdate(double progress) {\n            double delta = (endSize - startSize) * progress;\n            double newSize = startSize + delta;\n            toolBar.getElement().getStyle().setLeft(delta,\n                                                    Style.Unit.PX);\n            container.setWidth(newSize + \"px\");\n        }\n\n        void animate(int startSize,\n                     int endSize,\n                     int duration) {\n            this.startSize = startSize;\n            this.endSize = endSize;\n            run(duration);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/toolbar/WorkbenchToolBarView.ui.xml",
    "content": "<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE ui:UiBinder SYSTEM \"http://dl.google.com/gwt/DTD/xhtml.ent\">\n<ui:UiBinder xmlns:ui=\"urn:ui:com.google.gwt.uibinder\"\n             xmlns:g=\"urn:import:com.google.gwt.user.client.ui\"\n             xmlns:b=\"urn:import:org.gwtbootstrap3.client.ui\">\n\n  <ui:with field='res' type='org.uberfire.client.resources.WorkbenchResources'/>\n\n  <ui:style>\n    .margin {\n      height: 5px;\n    }\n\n    .container {\n      border-right-width: 1px !important;\n      border-bottom-width: 1px !important;\n      padding-right: 0 !important;\n    }\n\n    .reset_toolbar_margin {\n      float: left !important;\n      margin-top: 0 !important;\n      margin-bottom: 0 !important;\n      position: absolute !important;\n    }\n\n    .expand {\n      float: right;\n      border-right-width: 1px;\n      padding-right: 1px;\n      padding-left: 1px;\n    }\n  </ui:style>\n\n  <g:FlowPanel ui:field=\"mainContainer\">\n    <g:FlowPanel ui:field=\"container\" addStyleNames=\"{style.container} {res.CSS.toolbar}\">\n      <b:ButtonToolBar ui:field=\"toolBar\" addStyleNames=\"{style.reset_toolbar_margin}\"/>\n      <b:Tooltip ui:field=\"tip\">\n        <g:Button ui:field=\"viewControl\" addStyleNames=\"{style.expand}\">&#8942;</g:Button>\n      </b:Tooltip>\n    </g:FlowPanel>\n\n    <g:SimplePanel ui:field=\"simpleMargin\" addStyleNames=\"{style.margin}\"/>\n  </g:FlowPanel>\n</ui:UiBinder> \n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Button.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.stream.Stream;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.Document;\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.Text;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.uberfire.mvp.Command;\n\n@Dependent\npublic class Button implements IsElement {\n\n    @Inject\n    private HTMLButtonElement button;\n\n    @Inject\n    private Document document;\n\n    private Text textNode;\n\n    public void setText(final String text) {\n        if (textNode == null) {\n            textNode = document.createTextNode(text);\n            getElement().appendChild(textNode);\n        } else {\n            textNode.textContent = text;\n        }\n    }\n\n    public void setClickHandler(final Command clickHandler) {\n        button.addEventListener(\"click\",\n                                (e) -> clickHandler.execute());\n    }\n\n    public void setType(final ButtonType type) {\n        button.type = type.name().toLowerCase();\n    }\n\n    public void setButtonStyleType(final ButtonStyleType type) {\n        removeClass(\"btn\");\n        Stream.of(ButtonStyleType.values()).forEach(buttonStyleType -> removeClass(buttonStyleType.getCssClass()));\n        addClass(button,\n                 \"btn\",\n                 type.getCssClass());\n    }\n\n    public void setEnabled(final boolean enabled) {\n        button.disabled = !enabled;\n        if (enabled) {\n            button.classList.remove(\"disabled\");\n        } else {\n            button.classList.add(\"disabled\");\n        }\n    }\n\n    public void hide() {\n        button.classList.add(\"hidden\");\n    }\n\n    public void show() {\n        button.classList.remove(\"hidden\");\n    }\n\n    public void addIcon(final String... classes) {\n        final HTMLElement span = (HTMLElement) document.createElement(\"span\");\n        addClass(span,\n                 classes);\n        button.appendChild(span);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return button;\n    }\n\n    private void addClass(final HTMLElement element,\n                          final String... classes) {\n        for (String cssClass : classes) {\n            if (element.classList.contains(cssClass) == false) {\n                element.classList.add(cssClass);\n            }\n        }\n    }\n\n    private void removeClass(final String cssClass) {\n        if (getElement().classList.contains(cssClass)) {\n            getElement().classList.remove(cssClass);\n        }\n    }\n\n    public enum ButtonType {\n        BUTTON,\n        SUBMIT,\n        RESET\n    }\n\n    public enum ButtonStyleType {\n\n        DEFAULT(\"btn-default\"),\n        PRIMARY(\"btn-primary\"),\n        SUCCESS(\"btn-success\"),\n        INFO(\"btn-info\"),\n        WARNING(\"btn-warning\"),\n        DANGER(\"btn-danger\"),\n        LINK(\"btn-link\");\n\n        private final String cssClass;\n\n        ButtonStyleType(final String cssClass) {\n            this.cssClass = cssClass;\n        }\n\n        public String getCssClass() {\n            return cssClass;\n        }\n\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ConfirmPopup.html",
    "content": "<div class=\"modal fade\" data-field=\"modal\" tabindex=\"-1\" role=\"dialog\" aria-hidden=\"true\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <button type=\"button\" class=\"close\" data-field=\"confirm-close\" data-dismiss=\"modal\" aria-hidden=\"true\">\n                    <span class=\"pficon pficon-close\"></span>\n                </button>\n                <h4 class=\"modal-title\"><span data-field=\"confirm-title\"></span></h4>\n            </div>\n            <div class=\"modal-body\">\n                <form class=\"form-horizontal\">\n                    <fieldset>\n                        <div data-field=\"confirm-inline-notification\" style=\"display: none\"></div>\n                        <span data-field=\"confirm-message\"></span>\n                    </fieldset>\n                </form>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-default\" data-field=\"confirm-cancel\" data-dismiss=\"modal\"></button>\n                <button type=\"button\" class=\"btn btn-danger\" data-field=\"confirm-ok\"></button>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ConfirmPopup.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.MouseEvent;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.ForEvent;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.resources.i18n.Constants;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class ConfirmPopup {\n\n    @Inject\n    @DataField(\"confirm-title\")\n    Span modalTitle;\n\n    @Inject\n    @DataField(\"confirm-inline-notification\")\n    InlineNotification confirmInlineNotification;\n\n    @Inject\n    @DataField(\"confirm-message\")\n    Span modalConfirmationMessageLabel;\n\n    @Inject\n    @DataField(\"confirm-cancel\")\n    Button cancelButton;\n\n    @Inject\n    @DataField(\"confirm-ok\")\n    Button okButton;\n\n    @Inject\n    @DataField(\"modal\")\n    private Modal modal;\n\n    @Inject\n    private TranslationService translationService;\n\n    private Command okCommand;\n\n    @PostConstruct\n    public void init() {\n        cancelButton.setText(translationService.getTranslation(Constants.ConfirmPopup_Cancel));\n    }\n\n    public void show(final String title,\n                     final String okButtonText,\n                     final String confirmMessage,\n                     final Command okCommand) {\n        show(title,\n             null,\n             null,\n             okButtonText,\n             Button.ButtonStyleType.DANGER,\n             confirmMessage,\n             okCommand);\n    }\n\n    public void show(final String title,\n                     final String inlineNotificationMessage,\n                     final InlineNotification.InlineNotificationType inlineNotificationType,\n                     final String okButtonText,\n                     final Button.ButtonStyleType okButtonType,\n                     final String confirmMessage,\n                     final Command okCommand) {\n        this.okCommand = okCommand;\n        modalTitle.setTextContent(title);\n        if (inlineNotificationMessage != null && inlineNotificationType != null) {\n            confirmInlineNotification.setMessage(inlineNotificationMessage);\n            confirmInlineNotification.setType(inlineNotificationType);\n            confirmInlineNotification.getElement().getStyle().removeProperty(\"display\");\n        } else {\n            confirmInlineNotification.getElement().getStyle().setProperty(\"display\",\n                                                                          \"none\");\n        }\n        okButton.setText(okButtonText);\n        if (okButtonType != null) {\n            okButton.setButtonStyleType(okButtonType);\n        }\n        modalConfirmationMessageLabel.setTextContent(confirmMessage);\n        modal.show();\n    }\n\n    public void hide() {\n        modal.hide();\n    }\n\n    public HTMLElement getElement() {\n        return modal.getElement();\n    }\n\n    @EventHandler(\"confirm-ok\")\n    public void onOkClick(final @ForEvent(\"click\") MouseEvent event) {\n        if (okCommand != null) {\n            okCommand.execute();\n        }\n        hide();\n    }\n\n    @EventHandler(\"confirm-cancel\")\n    public void onCancelClick(final @ForEvent(\"click\") MouseEvent event) {\n        hide();\n    }\n\n    @EventHandler(\"confirm-close\")\n    public void onCloseClick(final @ForEvent(\"click\") MouseEvent event) {\n        hide();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/D3.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.dom.client.Element;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic interface D3 {\n\n    Selection selection();\n\n    Selection select(String path);\n\n    Selection select(Object object);\n\n    Selection selectAll(String path);\n\n    Zoom zoom();\n\n    CallbackFunction on(String event, CallbackFunction callbackFn);\n    \n    D3 on(String event, CallbackFunctionWithData callbackFn);\n\n    D3 call(CallbackFunction function, Object... args);\n\n    D3 attr(String name, Object value);\n    \n    D3 attr(String name, CallbackFunctionWithData callbackFn);\n\n    Object attr(String name);\n\n    Object style(String name);\n\n    D3 style(String name, Object value);\n    \n    D3 style(String name, CallbackFunctionWithData callbackFn);\n\n    D3 append(String content);\n\n    D3 html(String content);\n\n    D3 text(String content);\n    \n    D3 text(CallbackFunctionWithData callbackFn);\n    \n    D3 enter();\n    \n    D3 join(String obj);\n    \n    D3 data(Object[] data);\n    \n    D3 data(Object data);\n    \n    boolean geoContains(Object object, Double[] point);\n    \n    Node node();\n\n    @JsProperty\n    Transform getZoomIdentity();\n\n    @JsProperty\n    <T extends Event> T getEvent();\n\n    Transition transition();\n    \n    Scale scaleQuantize();\n    \n    Scale scaleLinear();\n    \n    Scale scaleSqrt();\n    \n    @JsProperty\n    String[][] getSchemeBlues();\n    \n    @JsProperty\n    String[][] getSchemeReds();\n    \n    @JsProperty\n    String[][] getSchemeGreens();\n\n    @JsFunction\n    @FunctionalInterface\n    interface CallbackFunction {\n\n        void execute();\n    }\n    \n    @JsFunction\n    @FunctionalInterface\n    interface CallbackFunctionWithData {\n\n        Object execute(Object data, int index, Element[] elements);\n    }\n\n    @JsType(isNative = true)\n    interface Selection extends D3 {\n\n        boolean empty();\n\n        int size();\n\n        Selection filter(String path);\n\n    }\n\n    @JsType(isNative = true)\n    interface Zoom extends D3 {\n\n        void scaleBy(D3 element, double scale);\n\n        void scaleTo(D3 element, double scale);\n\n        void scaleExtent(double[] scaleExtent);\n\n        void translateExtent(double[][] translateExtent);\n\n        void transform(D3 selection, Transform transform);\n    }\n\n    @JsType(isNative = true)\n    interface Transform extends D3 {\n\n        @JsProperty\n        double getX();\n\n        @JsProperty\n        double getY();\n\n        @JsProperty\n        double getK();\n\n        @JsProperty\n        void setX(double x);\n\n        @JsProperty\n        void setY(double y);\n    }\n\n    @JsType(isNative = true)\n    interface Transition extends D3 {\n\n        D3 duration(double milis);\n    }\n\n    @JsType(isNative = true)\n    interface Event {\n\n        @JsProperty\n        Object getCurrentTarget();\n        \n        @JsProperty\n        int getPageX();\n        \n        @JsProperty\n        int getPageY();\n    }\n\n    @JsType(isNative = true)\n    interface ZoomEvent {\n\n        @JsProperty\n        Transform getTransform();\n    }\n\n    @JsType(isNative = true)\n    interface Node {\n\n        DOMRect getBoundingClientRect();\n\n    }\n\n    @JsType(isNative = true)\n    interface DOMRect {\n\n        @JsProperty\n        double getX();\n\n        @JsProperty\n        double getY();\n\n        @JsProperty\n        double getWidth();\n\n        @JsProperty\n        double getHeight();\n    }\n    \n    @JsType(isNative = true)\n    interface Scale {\n\n        Scale domain(Object[] domain);\n        \n        Object[] domain();\n        \n        Scale range(Object[] colors);\n        \n        Scale rangeRound(Object[] colors);\n        \n        Object[] range();\n        \n        String call(Scale self, Object... args);\n        \n        Object[] invertExtent(Object value);\n    }    \n\n    class Builder {\n\n        @JsProperty(name = \"d3\", namespace = JsPackage.GLOBAL)\n        public static native D3 get();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DateRangePicker.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Event;\nimport org.jboss.errai.common.client.dom.TextInput;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\n\nimport static org.uberfire.client.views.pfly.resources.i18n.Constants.*;\n\n/**\n * Wrapper component for <a href=\"http://www.daterangepicker.com\">Date Range Picker</a>\n */\n@Dependent\npublic class DateRangePicker implements IsElement {\n\n    @Inject\n    private TextInput input;\n\n    @Inject\n    private JQueryProducer.JQuery<DateRangePicker.JQueryDateRangePickerElement> jQuery;\n\n    @Inject\n    private TranslationService translationService;\n\n    public void setup(final DateRangePickerOptions options,\n                      final DateRangePickerCallback callback) {\n        setupI18n(options);\n        jQuery.wrap(getElement()).daterangepicker(options,\n                                                  callback);\n    }\n\n    protected void setupI18n(final DateRangePickerOptions options) {\n        options.setApplyLabel(translationService.format(ApplyLabel));\n        options.setCancelLabel(translationService.format(CancelLabel));\n        options.setCustomRangeLabel(translationService.format(CustomRangeLabel));\n        options.setFromLabel(translationService.format(FromLabel));\n        options.setToLabel(translationService.format(ToLabel));\n        options.setWeekLabel(translationService.format(WeekLabel));\n        options.setDaysOfWeek(new String[]{\n                translationService.format(SundayShort),\n                translationService.format(MondayShort),\n                translationService.format(TuesdayShort),\n                translationService.format(WednesdayShort),\n                translationService.format(ThursdayShort),\n                translationService.format(FridayShort),\n                translationService.format(SaturdayShort)\n        });\n\n        options.setMonthNames(new String[]{\n                translationService.format(January),\n                translationService.format(February),\n                translationService.format(March),\n                translationService.format(April),\n                translationService.format(May),\n                translationService.format(June),\n                translationService.format(July),\n                translationService.format(August),\n                translationService.format(September),\n                translationService.format(October),\n                translationService.format(November),\n                translationService.format(December),\n        });\n    }\n\n    public void addApplyListener(final DateTimePickerEventCallback callback) {\n        jQuery.wrap(getElement()).on(\"apply.daterangepicker\",\n                                     callback);\n    }\n\n    @Override\n    public TextInput getElement() {\n        return input;\n    }\n\n    @JsType(isNative = true)\n    public interface JQueryDateRangePickerElement extends JQueryProducer.JQueryElement {\n\n        DateRangePickerElement daterangepicker(DateRangePickerOptions options,\n                                               DateRangePickerCallback callback);\n\n        void on(String event,\n                DateTimePickerEventCallback callback);\n    }\n\n    @JsFunction\n    @FunctionalInterface\n    public interface DateRangePickerCallback {\n\n        void update(Moment start,\n                    Moment end,\n                    String label);\n    }\n\n    @JsFunction\n    @FunctionalInterface\n    public interface DateTimePickerEventCallback {\n\n        void onEvent(Event event,\n                     DateRangePickerElement picker);\n    }\n\n    @JsType(isNative = true)\n    public interface DateRangePickerElement {\n\n        @JsProperty\n        Moment getStartDate();\n\n        void setStartDate(Moment startDate);\n\n        @JsProperty\n        Moment getEndDate();\n\n        void setEndDate(Moment endDate);\n\n        @JsProperty\n        String getChosenLabel();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DateRangePickerOptions.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\npublic class DateRangePickerOptions {\n\n    private DateRangePickerOptions() {\n    }\n\n    @JsOverlay\n    public static final DateRangePickerOptions create() {\n        final DateRangePickerOptions options = new DateRangePickerOptions();\n\n        options.setApplyClass(\"btn-primary\");\n        options.setLocale(new Object());\n        options.setFormat(\"lll\");\n\n        options.setRanges(new DateRangePickerOptions.Range());\n\n        return options;\n    }\n\n    @JsProperty\n    public native void setApplyClass(String applyClass);\n\n    @JsProperty\n    public native void setStartDate(Moment startDate);\n\n    @JsProperty\n    public native void setEndDate(Moment endDate);\n\n    @JsProperty\n    public native void setMinDate(Moment minDate);\n\n    @JsProperty\n    public native void setMaxDate(Moment maxDate);\n\n    @JsProperty\n    public native void setAutoApply(Boolean autoApply);\n\n    @JsProperty\n    public native void setAutoUpdateInput(Boolean autoUpdateInput);\n\n    @JsProperty\n    public native void setShowCustomRangeLabel(Boolean showCustomRangeLabel);\n\n    @JsProperty\n    public native void setTimePicker(Boolean timePicker);\n\n    @JsProperty\n    public native void setTimePickerIncrement(int timePickerIncrement);\n\n    @JsProperty\n    public native void setTimePicker24Hour(Boolean timePicker24Hour);\n\n    @JsProperty\n    public native void setSingleDatePicker(Boolean singleDatePicker);\n\n    @JsProperty\n    public native void setDrops(String drops);\n\n    @JsProperty\n    public native void setParentEl(String parentEl);\n\n    @JsProperty\n    protected native void setLocale(Object locale);\n\n    @JsProperty(name = \"locale.format\")\n    public native void setFormat(String format);\n\n    @JsProperty(name = \"locale.customRangeLabel\")\n    public native void setCustomRangeLabel(String customRangeLabel);\n\n    @JsProperty(name = \"locale.applyLabel\")\n    public native void setApplyLabel(String applyLabel);\n\n    @JsProperty(name = \"locale.cancelLabel\")\n    public native void setCancelLabel(String cancelLabel);\n\n    @JsProperty(name = \"locale.fromLabel\")\n    public native void setFromLabel(String fromLabel);\n\n    @JsProperty(name = \"locale.toLabel\")\n    public native void setToLabel(String toLabel);\n\n    @JsProperty(name = \"locale.weekLabel\")\n    public native void setWeekLabel(String weekLabel);\n\n    @JsProperty(name = \"locale.daysOfWeek\")\n    public native void setDaysOfWeek(String[] daysOfWeek);\n\n    @JsProperty(name = \"locale.monthNames\")\n    public native void setMonthNames(String[] monthNames);\n\n    @JsProperty\n    protected native Range getRanges();\n\n    @JsProperty\n    protected native void setRanges(Range range);\n\n    @JsOverlay\n    public final void addRange(final String key,\n                               final Moment startRange,\n                               final Moment endRange) {\n        getRanges().addRange(key,\n                             startRange,\n                             endRange);\n    }\n\n    @JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\n    private static class Range {\n\n        public static native void defineProperty(Range range,\n                                                 String property,\n                                                 PropertyDescriptor descriptor);\n\n        @JsOverlay\n        public final void addRange(final String key,\n                                   final Moment startRange,\n                                   final Moment endRange) {\n            final PropertyDescriptor descriptor = new PropertyDescriptor();\n            final Moment[] value = new Moment[]{startRange, endRange};\n            descriptor.setValue(value);\n            descriptor.setEnumerable(true);\n            defineProperty(this,\n                           key,\n                           descriptor);\n        }\n    }\n\n    @JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\n    private static class PropertyDescriptor {\n\n        @JsProperty\n        public native void setValue(Object value);\n\n        @JsProperty\n        public native void setEnumerable(boolean enumerable);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DropdownMenu.html",
    "content": "<div data-field=\"dropdown\" class=\"dropdown\">\n    <button data-field=\"button\" class=\"btn btn-default dropdown-toggle\" type=\"button\" data-toggle=\"dropdown\">\n        <span data-field=\"text\"></span>\n        <span class=\"caret\"></span>\n    </button>\n    <ul data-field=\"dropdown-menu\" class=\"dropdown-menu\" role=\"menu\">\n    </ul>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DropdownMenu.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport javax.inject.Named;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Dependent\n@Templated\npublic class DropdownMenu implements IsElement {\n\n    @Inject\n    @DataField(\"dropdown\")\n    HTMLDivElement dropdown;\n\n    @Inject\n    @DataField(\"text\")\n    @Named(\"span\")\n    HTMLElement text;\n\n    @Inject\n    @DataField(\"dropdown-menu\")\n    HTMLUListElement dropdownMenu;\n\n    public void setText(final String text) {\n        this.text.textContent = text;\n    }\n\n    public void addDropdownItem(final HTMLLIElement item) {\n        dropdownMenu.appendChild(item);\n    }\n\n    public void setItemsAlignment(final ItemsAlignment alighment) {\n        if (alighment == ItemsAlignment.RIGHT) {\n            dropdownMenu.classList.add(\"dropdown-menu-right\");\n        }\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return dropdown;\n    }\n\n    public enum ItemsAlignment {\n        LEFT,\n        RIGHT\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DropdownMenuItem.html",
    "content": "<li data-field=\"dropdown-item\" role=\"presentation\"><a role=\"menuitem\" tabindex=\"-1\" href=\"#\" data-field=\"anchor\"></a></li>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/DropdownMenuItem.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.Event;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.ForEvent;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class DropdownMenuItem implements IsElement {\n\n    @Inject\n    @DataField(\"dropdown-item\")\n    HTMLLIElement item;\n\n    @Inject\n    @DataField(\"anchor\")\n    HTMLAnchorElement anchor;\n\n    Command clickHandler;\n\n    @Override\n    public HTMLElement getElement() {\n        return item;\n    }\n\n    public void setText(final String text) {\n        anchor.textContent = text;\n    }\n\n    public void setClickHandler(final Command clickHandler) {\n        this.clickHandler = clickHandler;\n    }\n\n    @EventHandler(\"anchor\")\n    public void onClick(@ForEvent(\"click\") Event event) {\n        if (clickHandler != null) {\n            clickHandler.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Duration.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n/**\n * Wrapper class for <a href=\"http://momentjs.com\">Moment.js</a> library\n */\n@JsType(isNative = true)\npublic interface Duration {\n\n    String humanize();\n\n    String humanize(boolean suffix);\n\n    class Builder {\n\n        @JsMethod(name = \"moment.duration\", namespace = JsPackage.GLOBAL)\n        public static native Duration duration();\n\n        @JsMethod(name = \"moment.duration\", namespace = JsPackage.GLOBAL)\n        public static native Duration duration(int milliseconds);\n\n        @JsMethod(name = \"moment.duration\", namespace = JsPackage.GLOBAL)\n        public static native Duration duration(int time,\n                                               String measurement);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Elemental2Producer.java",
    "content": "package org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.inject.Produces;\n\nimport elemental2.dom.DomGlobal;\nimport elemental2.dom.HTMLDocument;\n\n@ApplicationScoped\npublic class Elemental2Producer {\n\n    @Produces\n    public HTMLDocument produceDocument() {\n        return DomGlobal.document;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ErrorPopup.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.client.mvp.UberElement;\n\n@Dependent\npublic class ErrorPopup {\n\n    public interface View\n            extends UberElement<ErrorPopup> {\n\n        HTMLElement getInlineNotification();\n\n        HTMLElement getStandardNotification();\n\n        void setInlineNotificationValue(final String message);\n\n        void setStandardNotificationValue(final String message);\n\n        void setNotification(final HTMLElement notification);\n\n        void showDetailPanel(final boolean show);\n\n        void setDetailValue(final String message);\n\n        boolean isDetailCollapsed();\n\n        void setCollapseDetailIcon(final boolean collapsed);\n\n        void setCollapseDetailPanel(final boolean collapsed);\n\n        void setDetailLabel(final String label);\n\n        String getShowDetailLabel();\n\n        String getCloseDetailLabel();\n\n        void show();\n\n        void hide();\n    }\n\n    public enum DisplayMode {\n        STANDARD,\n        PATTERN_FLY\n    }\n\n    private final View view;\n\n    @Inject\n    public ErrorPopup(final View view) {\n        this.view = view;\n    }\n\n    @PostConstruct\n    public void init() {\n        view.init(this);\n    }\n\n    public void showError(final String message) {\n        showError(message,\n                  DisplayMode.PATTERN_FLY);\n    }\n\n    public void showError(final String message,\n                          final DisplayMode displayMode) {\n        setMessage(message,\n                   displayMode);\n        view.setDetailValue(\"\");\n        showDetailPanel(false);\n        view.show();\n    }\n\n    public void showError(final String message,\n                          final String detail) {\n        showError(message,\n                  detail,\n                  DisplayMode.PATTERN_FLY);\n    }\n\n    public void showError(final String message,\n                          final String detail,\n                          final DisplayMode displayMode) {\n        setMessage(message,\n                   displayMode);\n        view.setDetailValue(detail);\n        showDetailPanel(true);\n        view.show();\n    }\n\n    private void setMessage(final String message,\n                            final DisplayMode displayMode) {\n        if (displayMode == DisplayMode.STANDARD) {\n            view.setNotification(view.getStandardNotification());\n            view.setStandardNotificationValue(message);\n        } else {\n            view.setNotification(view.getInlineNotification());\n            view.setInlineNotificationValue(message);\n        }\n    }\n\n    private void showDetailPanel(boolean show) {\n        view.setCollapseDetailIcon(true);\n        view.setCollapseDetailPanel(true);\n        view.setDetailLabel(view.getShowDetailLabel());\n        view.showDetailPanel(show);\n    }\n\n    protected void onOk() {\n        view.hide();\n    }\n\n    protected void onClose() {\n        view.hide();\n    }\n\n    protected void onDetail() {\n        boolean detailCollapsed = view.isDetailCollapsed();\n        view.setCollapseDetailIcon(!detailCollapsed);\n        if (detailCollapsed) {\n            view.setDetailLabel(view.getCloseDetailLabel());\n        } else {\n            view.setDetailLabel(view.getShowDetailLabel());\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ErrorPopupView.html",
    "content": "<div class=\"modal fade\" data-field=\"modal\" tabindex=\"-1\" role=\"dialog\" aria-hidden=\"true\" data-backdrop=\"static\">\n    <div class=\"modal-dialog\">\n        <div class=\"modal-content\">\n            <div class=\"modal-header\">\n                <button type=\"button\" class=\"close\" data-field=\"close-button\" data-dismiss=\"modal\" aria-hidden=\"true\">\n                    <span class=\"pficon pficon-close\"></span>\n                </button>\n                <h4 class=\"modal-title\" data-i18n-key=\"PopupTitle\">Error</h4>\n            </div>\n            <div class=\"modal-body\">\n                <div data-field=\"message-container\">\n                    <div data-field=\"inline-notification\"></div>\n                    <span style=\"word-wrap:break-word; padding-bottom: 10px; display:block;\" data-field=\"standard-notification\"></span>\n                </div>\n\n                <div data-field=\"detail-container\" style=\"display: none;\">\n                    <p>\n                        <span data-field=\"detail-anchor-icon\" class=\"fa fa-angle-right\">&nbsp;</span>\n                        <a data-field=\"detail-anchor\" data-toggle=\"collapse\" class=\"collapsed\" href=\"#detail-area-container\" aria-expanded=\"false\" aria-controls=\"detail-area\">Show Details</a>\n                    </p>\n                    <div class=\"collapse\" id=\"detail-area-container\" aria-expanded=\"false\">\n                        <textarea data-field=\"detail-area\" style=\"width:100%; height: 200px;\" readonly=\"readonly\"></textarea>\n                    </div>\n                </div>\n            </div>\n            <div class=\"modal-footer\">\n                <button type=\"button\" class=\"btn btn-primary\" data-field=\"ok-button\" data-i18n-key=\"Close\">Close</button>\n            </div>\n        </div>\n    </div>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ErrorPopupView.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *      http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.dom.Anchor;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.MouseEvent;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.common.client.dom.TextArea;\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.ForEvent;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.client.views.pfly.resources.i18n.Constants;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.hasCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeAllChildren;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\n\n@Dependent\n@Templated\npublic class ErrorPopupView\n        implements org.jboss.errai.ui.client.local.api.IsElement,\n                   ErrorPopup.View {\n\n    private static final String DETAIL_COLLAPSED_ICON = \"fa-angle-right\";\n\n    private static final String DETAIL_EXPANDED_ICON = \"fa-angle-down\";\n\n    private static final String IN = \"in\";\n\n    @Inject\n    @DataField(\"message-container\")\n    private Div messageContainer;\n\n    @Inject\n    @DataField(\"inline-notification\")\n    private InlineNotification inlineNotification;\n\n    @Inject\n    @DataField(\"standard-notification\")\n    private Span standardNotification;\n\n    @Inject\n    @DataField(\"detail-container\")\n    private Div detailContainer;\n\n    @Inject\n    @DataField(\"detail-area\")\n    private TextArea detailArea;\n\n    @Inject\n    @DataField(\"detail-area-container\")\n    private Div detailAreaContainer;\n\n    @Inject\n    @DataField(\"detail-anchor-icon\")\n    private Span detailAnchorIcon;\n\n    @Inject\n    @DataField(\"detail-anchor\")\n    private Anchor detailAnchor;\n\n    @Inject\n    @DataField(\"modal\")\n    private Modal modal;\n\n    @Inject\n    private TranslationService translationService;\n\n    private ErrorPopup presenter;\n\n    @PostConstruct\n    public void init() {\n        inlineNotification.setType(InlineNotification.InlineNotificationType.DANGER);\n    }\n\n    @Override\n    public void init(final ErrorPopup presenter) {\n        this.presenter = presenter;\n    }\n\n    @Override\n    public HTMLElement getInlineNotification() {\n        return inlineNotification.getElement();\n    }\n\n    @Override\n    public HTMLElement getStandardNotification() {\n        return standardNotification;\n    }\n\n    @Override\n    public void setInlineNotificationValue(final String message) {\n        inlineNotification.setMessage(message);\n    }\n\n    @Override\n    public void setStandardNotificationValue(final String message) {\n        standardNotification.setTextContent(message);\n    }\n\n    @Override\n    public void setNotification(HTMLElement notification) {\n        removeAllChildren(messageContainer);\n        messageContainer.appendChild(notification);\n    }\n\n    @Override\n    public void showDetailPanel(boolean show) {\n        if (!show) {\n            detailContainer.getStyle().setProperty(\"display\",\n                                                   \"none\");\n        } else {\n            detailContainer.getStyle().removeProperty(\"display\");\n        }\n    }\n\n    @Override\n    public void setDetailValue(final String detail) {\n        detailArea.setValue(detail);\n    }\n\n    @Override\n    public boolean isDetailCollapsed() {\n        return hasCSSClass(detailAnchorIcon,\n                           DETAIL_COLLAPSED_ICON);\n    }\n\n    @Override\n    public void setCollapseDetailIcon(boolean collapsed) {\n        removeCSSClass(detailAnchorIcon,\n                       DETAIL_COLLAPSED_ICON);\n        removeCSSClass(detailAnchorIcon,\n                       DETAIL_EXPANDED_ICON);\n        if (collapsed) {\n            addCSSClass(detailAnchorIcon,\n                        DETAIL_COLLAPSED_ICON);\n        } else {\n            addCSSClass(detailAnchorIcon,\n                        DETAIL_EXPANDED_ICON);\n        }\n    }\n\n    @Override\n    public void setCollapseDetailPanel(boolean collapsed) {\n        removeCSSClass(detailAreaContainer,\n                       IN);\n        if (!collapsed) {\n            addCSSClass(detailAreaContainer,\n                        IN);\n        }\n    }\n\n    @Override\n    public void setDetailLabel(final String label) {\n        detailAnchor.setTextContent(label);\n    }\n\n    @Override\n    public String getShowDetailLabel() {\n        return translationService.getTranslation(Constants.ErrorPopupView_ShowDetailLabel);\n    }\n\n    @Override\n    public String getCloseDetailLabel() {\n        return translationService.getTranslation(Constants.ErrorPopupView_CloseDetailLabel);\n    }\n\n    @Override\n    public void show() {\n        modal.show();\n    }\n\n    @Override\n    public void hide() {\n        modal.hide();\n    }\n\n    @EventHandler(\"ok-button\")\n    private void onOkClick(final @ForEvent(\"click\") MouseEvent event) {\n        presenter.onOk();\n    }\n\n    @EventHandler(\"close-button\")\n    private void onCloseClick(final @ForEvent(\"click\") MouseEvent event) {\n        presenter.onClose();\n    }\n\n    @EventHandler(\"detail-anchor\")\n    private void onDetailClick(final @ForEvent(\"click\") MouseEvent event) {\n        presenter.onDetail();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/FormGroup.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.Arrays;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.HTMLElement;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\nimport static org.jboss.errai.common.client.dom.DOMUtil.removeCSSClass;\n\n@Dependent\npublic class FormGroup implements IsElement {\n\n    @Inject\n    private Div div;\n\n    public void clearValidationState() {\n        Arrays.stream(ValidationState.values()).forEach(v -> removeCSSClass(div,\n                                                                            v.getCssName()));\n    }\n\n    public void setValidationState(final ValidationState state) {\n        clearValidationState();\n        addCSSClass(div,\n                    state.getCssName());\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return div;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/FormLabel.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.*;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.addCSSClass;\n\n@Dependent\npublic class FormLabel implements IsElement {\n\n    @Inject\n    private Document document;\n\n    @Inject\n    private Label label;\n\n    @Override\n    public HTMLElement getElement() {\n        return label;\n    }\n\n    public void addRequiredIndicator() {\n        final HTMLElement e = document.createElement(\"i\");\n        addCSSClass(e,\n                    \"fa\");\n        addCSSClass(e,\n                    \"fa-star\");\n        final CSSStyleDeclaration css = e.getStyle();\n        css.setProperty(\"font-size\",\n                        \"6px\");\n        css.setProperty(\"padding-right\",\n                        \"5px\");\n        css.setProperty(\"padding-left\",\n                        \"2px\");\n        css.setProperty(\"color\",\n                        \"#b94a48\");\n        final HTMLElement sup = document.createElement(\"sup\");\n        sup.appendChild(e);\n        label.appendChild(sup);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/FormLabelHelp.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.HasText;\nimport org.gwtbootstrap3.client.ui.FormLabel;\n\npublic class FormLabelHelp extends Composite implements HasText {\n\n    private final FormLabel formLabel;\n    private final FlowPanel panel;\n\n    private HelpIcon helpIcon;\n\n    public FormLabelHelp() {\n        this(new FormLabel(),\n             new FlowPanel());\n    }\n\n    // Defined for testing purposes\n    FormLabelHelp(FormLabel formLabel,\n                  FlowPanel panel) {\n        this.formLabel = formLabel;\n        this.panel = panel;\n\n        init();\n    }\n\n    private void init() {\n        initWidget(panel);\n        addStyleName(\"uf-form-label\");\n        panel.add(formLabel);\n    }\n\n    public void setHelpTitle(final String title) {\n        if (title != null) {\n            getHelpIcon().setHelpTitle(title);\n        }\n    }\n\n    public void setHelpContent(final String content) {\n        if (content != null) {\n            getHelpIcon().setHelpContent(content);\n        }\n    }\n\n    private HelpIcon getHelpIcon() {\n        if (helpIcon == null) {\n            helpIcon = GWT.create(HelpIcon.class);\n            panel.add(helpIcon);\n        }\n        return helpIcon;\n    }\n\n    @Override\n    public String getText() {\n        return formLabel.getText();\n    }\n\n    @Override\n    public void setText(final String text) {\n        formLabel.setText(text);\n    }\n\n    public void setFor(final String forValue) {\n        formLabel.setFor(forValue);\n    }\n\n    public void setShowRequiredIndicator(final boolean required) {\n        formLabel.setShowRequiredIndicator(required);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/HelpIcon.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.user.client.ui.Composite;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Popover;\nimport org.gwtbootstrap3.client.ui.constants.IconType;\nimport org.gwtbootstrap3.client.ui.constants.Placement;\n\npublic class HelpIcon extends Composite {\n\n    private Icon icon;\n    private SimplePanel panel;\n    private Popover popover;\n\n    public HelpIcon() {\n        this(new Icon(),\n             new SimplePanel(),\n             new Popover());\n    }\n\n    // Defined for testing purposes\n    HelpIcon(Icon icon,\n             SimplePanel panel,\n             Popover popover) {\n        this.icon = icon;\n        this.popover = popover;\n        this.panel = panel;\n\n        init();\n    }\n\n    private void init() {\n        initWidget(panel);\n        addStyleName(\"uf-help-icon\");\n\n        icon.setType(IconType.INFO_CIRCLE);\n\n        popover.setWidget(icon);\n        popover.setContainer(\"body\");\n        popover.setIsHtml(true);\n        popover.setPlacement(Placement.AUTO);\n\n        panel.setWidget(popover);\n    }\n\n    public void setHelpTitle(final String title) {\n        popover.setTitle(title);\n        popover.reconfigure();\n    }\n\n    public void setHelpContent(final String content) {\n        popover.setContent(content);\n        popover.reconfigure();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InlineNotification.css",
    "content": ".list-unstyled {\n    margin-bottom: 0px;\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InlineNotification.html",
    "content": "<div class=\"alert\">\n    <button data-field=\"dismiss\" type=\"button\" class=\"close hidden\" data-dismiss=\"alert\" aria-hidden=\"true\">\n        <span class=\"pficon pficon-close\"></span>\n    </button>\n    <span data-field=\"icon\" class=\"pficon\"></span>\n    <span data-field=\"message\" style=\"word-wrap:break-word;\"></span>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InlineNotification.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.List;\nimport java.util.stream.Stream;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Button;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\nimport static org.jboss.errai.common.client.dom.DOMUtil.*;\n\n@Templated(stylesheet = \"InlineNotification.css\")\n@Dependent\npublic class InlineNotification implements IsElement {\n\n    @Inject\n    @DataField(\"alert\")\n    private Div alert;\n\n    @Inject\n    @DataField(\"message\")\n    private Span message;\n\n    @Inject\n    @DataField(\"icon\")\n    private Span icon;\n\n    @Inject\n    @DataField(\"dismiss\")\n    private Button dismiss;\n\n    @Inject\n    private Document document;\n\n    @Override\n    public HTMLElement getElement() {\n        return alert;\n    }\n\n    public void setMessage(final String message) {\n        this.message.setTextContent(message);\n    }\n\n    public void setMessage(final List<String> messages) {\n        removeAllElementChildren(this.message);\n        final HTMLElement ul = document.createElement(\"ul\");\n        addCSSClass(ul,\n                    \"list-unstyled\");\n        for (String message : messages) {\n            final HTMLElement li = document.createElement(\"li\");\n            li.setTextContent(message);\n            ul.appendChild(li);\n        }\n        this.message.appendChild(ul);\n    }\n\n    public void setDismissable() {\n        addCSSClass(alert,\n                    \"alert-dismissable\");\n        removeCSSClass(dismiss,\n                       \"hidden\");\n    }\n\n    public void setType(final InlineNotificationType type) {\n        Stream.of(InlineNotificationType.values()).forEach(availableType -> {\n            removeCSSClass(alert, availableType.getCssClass());\n            removeCSSClass(icon, availableType.getIcon());\n        });\n        addCSSClass(alert,\n                    type.getCssClass());\n        addCSSClass(icon,\n                    type.getIcon());\n    }\n\n    public enum InlineNotificationType {\n\n        SUCCESS(\"alert-success\",\n                \"pficon-ok\"),\n        INFO(\"alert-info\",\n             \"pficon-info\"),\n        WARNING(\"alert-warning\",\n                \"pficon-warning-triangle-o\"),\n        DANGER(\"alert-danger\",\n               \"pficon-error-circle-o\");\n\n        private String cssClass;\n\n        private String icon;\n\n        InlineNotificationType(final String cssClass,\n                               final String icon) {\n            this.cssClass = cssClass;\n            this.icon = icon;\n        }\n\n        public String getCssClass() {\n            return cssClass;\n        }\n\n        public String getIcon() {\n            return icon;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InputAutocomplete.html",
    "content": "<!--\n  ~ Copyright 2019 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<input type=\"text\" data-field=\"input\" />"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InputAutocomplete.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.List;\nimport java.util.function.Supplier;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLInputElement;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\npublic class InputAutocomplete implements IsElement {\n\n    @Inject\n    @DataField(\"input\")\n    HTMLInputElement input;\n\n    @Inject\n    private JQueryElementalProducer.JQuery<InputAutocompleteElement> jQuery;\n\n    public void setup(final Supplier<List<String>> optionsSupplier) {\n        final InputAutocompleteOptions inputAutocompleteOptions = new InputAutocompleteOptions();\n        List<String> options = optionsSupplier.get();\n        if (options != null) {\n            String[] optionsArray = options.stream()\n                    .toArray(String[]::new);\n            inputAutocompleteOptions.setSource(optionsArray);\n        }\n\n        jQuery.wrap(getElement()).autocomplete(inputAutocompleteOptions);\n    }\n\n    public void setValue(final String value) {\n        this.input.value = value;\n    }\n\n    public String getValue() {\n        return this.input.value;\n    }\n\n    @JsType(isNative = true)\n    public interface InputAutocompleteElement extends JQueryElementalProducer.JQueryElement {\n\n        void autocomplete(InputAutocompleteOptions options);\n    }\n\n    @Override\n    public HTMLElement getElement() {\n        return input;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/InputAutocompleteOptions.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\npublic class InputAutocompleteOptions {\n\n    @JsProperty\n    public native void setSource(String[] source);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/JQueryElementalProducer.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.inject.Produces;\n\nimport elemental2.dom.HTMLElement;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true)\npublic abstract class JQueryElementalProducer {\n\n    /**\n     * <p>\n     * Declares a producer for the JQuery function, allowing it to be injected via Errai IoC.\n     * <p>\n     * <p>\n     * {@link JsProperty} is used so that GWT translates method calls to property access of the globally-scoped {@code $} symbol.\n     */\n    @Produces\n    @JsProperty(name = \"$\", namespace = JsPackage.GLOBAL)\n    public static native JQuery get();\n\n    /**\n     * <p>\n     * The JQuery function, used to enhance regular elements.\n     */\n    @JsFunction\n    @FunctionalInterface\n    public interface JQuery<T extends JQueryElement> {\n\n        T wrap(HTMLElement element);\n    }\n\n    /**\n     * <p>\n     * Interface for enhanced JQuery elements.\n     * <p>\n     * <p>\n     */\n    @JsType(isNative = true)\n    public interface JQueryElement {\n\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/JQueryProducer.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.inject.Produces;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.common.client.dom.HTMLElement;\n\n@JsType(isNative = true)\npublic abstract class JQueryProducer {\n\n    /**\n     * <p>\n     * Declares a producer for the JQuery function, allowing it to be injected via Errai IoC.\n     * <p>\n     * <p>\n     * {@link JsProperty} is used so that GWT translates method calls to property access of the globally-scoped {@code $} symbol.\n     */\n    @Produces\n    @JsProperty(name = \"$\", namespace = JsPackage.GLOBAL)\n    public static native JQuery get();\n\n    /**\n     * <p>\n     * The JQuery function, used to enhance regular elements.\n     */\n    @JsFunction\n    @FunctionalInterface\n    public interface JQuery<T extends JQueryElement> {\n\n        T wrap(Element element);\n    }\n\n    /**\n     * <p>\n     * Interface for enhanced JQuery elements, exposing API for some convenient methods for getting children or inserting\n     * sibling elements.\n     * <p>\n     * <p>\n     */\n    @JsType(isNative = true)\n    public interface JQueryElement extends HTMLElement {\n\n        void after(HTMLElement element);\n\n        void before(HTMLElement element);\n\n        JQueryArray children();\n\n        JQueryArray children(String selector);\n    }\n\n    /**\n     * <p>\n     * Interface for an element array returned by some {@link JQueryElement} methods.\n     */\n    @JsType(isNative = true)\n    public interface JQueryArray {\n\n        JQueryElement first();\n\n        JQueryElement get(int index);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/KebabMenu.html",
    "content": "<div data-field=\"kebab\" class=\"dropdown dropdown-kebab-pf\">\n    <button class=\"btn btn-link dropdown-toggle\" type=\"button\" id=\"dropdownKebab\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"true\">\n        <span class=\"fa fa-ellipsis-v\"></span>\n    </button>\n    <ul data-field=\"dropdown-menu\" class=\"dropdown-menu\" aria-labelledby=\"dropdownKebab\"></ul>\n</div>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/KebabMenu.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\n\n@Templated\n@Dependent\npublic class KebabMenu implements IsElement {\n\n    @Inject\n    @DataField(\"kebab\")\n    HTMLDivElement kebab;\n\n    @Inject\n    @DataField(\"dropdown-menu\")\n    HTMLUListElement dropdownMenu;\n\n    @Inject\n    HTMLDocument document;\n\n    @Override\n    public HTMLElement getElement() {\n        return kebab;\n    }\n\n    public void addKebabItem(final HTMLLIElement item) {\n        dropdownMenu.appendChild(item);\n    }\n\n    public void addSeparator() {\n        final HTMLLIElement separator = (HTMLLIElement) document.createElement(\"li\");\n        separator.classList.add(\"divider\");\n        addKebabItem(separator);\n    }\n\n    public void setItemsAlignment(final ItemsAlignment alignment) {\n        if (alignment == ItemsAlignment.RIGHT) {\n            dropdownMenu.classList.add(\"dropdown-menu-right\");\n        }\n    }\n\n    public void setDropPosition(final DropPosition position) {\n        if (position == DropPosition.UP) {\n            kebab.classList.remove(\"dropdown\");\n            kebab.classList.add(\"dropup\");\n        } else {\n            kebab.classList.remove(\"dropup\");\n            kebab.classList.add(\"dropdown\");\n        }\n    }\n\n    public enum ItemsAlignment {\n        LEFT,\n        RIGHT\n    }\n\n    public enum DropPosition {\n        UP,\n        DOWN\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/KebabMenuItem.html",
    "content": "<li data-field=\"kebab-item\" ><a href=\"#\" data-field=\"anchor\"></a></li>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/KebabMenuItem.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport elemental2.dom.Event;\nimport elemental2.dom.HTMLAnchorElement;\nimport elemental2.dom.HTMLElement;\nimport elemental2.dom.HTMLLIElement;\nimport org.jboss.errai.common.client.api.elemental2.IsElement;\nimport org.jboss.errai.ui.shared.api.annotations.DataField;\nimport org.jboss.errai.ui.shared.api.annotations.EventHandler;\nimport org.jboss.errai.ui.shared.api.annotations.ForEvent;\nimport org.jboss.errai.ui.shared.api.annotations.Templated;\nimport org.uberfire.mvp.Command;\n\n@Dependent\n@Templated\npublic class KebabMenuItem implements IsElement {\n\n    @Inject\n    @DataField(\"kebab-item\")\n    HTMLLIElement item;\n\n    @Inject\n    @DataField(\"anchor\")\n    HTMLAnchorElement anchor;\n\n    Command clickHandler;\n\n    @Override\n    public HTMLElement getElement() {\n        return item;\n    }\n\n    public void setText(final String text) {\n        anchor.textContent = text;\n    }\n\n    public void setClickHandler(final Command clickHandler) {\n        this.clickHandler = clickHandler;\n    }\n\n    @EventHandler(\"anchor\")\n    public void onClick(@ForEvent(\"click\") Event event) {\n        if (clickHandler != null) {\n            clickHandler.execute();\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Modal.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.jboss.errai.common.client.dom.HTMLElement;\n\n@Dependent\npublic class Modal implements IsElement {\n\n    @Inject\n    private Document document;\n\n    @Inject\n    private Div div;\n\n    @Override\n    public HTMLElement getElement() {\n        return div;\n    }\n\n    public void show() {\n        document.getBody().appendChild(div);\n        show(div);\n    }\n\n    public void hide() {\n        hide(div);\n        document.getBody().removeChild(div);\n    }\n\n    protected native void show(final Element e) /*-{\n        $wnd.jQuery(e).modal('show')\n    }-*/;\n\n    protected native void hide(final Element e) /*-{\n        $wnd.jQuery(e).modal('hide')\n    }-*/;\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Moment.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.Date;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n/**\n * Wrapper class for <a href=\"http://momentjs.com\">Moment.js</a> library\n */\n@JsType(isNative = true)\npublic interface Moment {\n\n    Moment hours(int hours);\n\n    Moment minutes(int minutes);\n\n    Moment seconds(int seconds);\n\n    Moment milliseconds(int milliseconds);\n\n    Moment subtract(int number,\n                    String period);\n\n    Moment startOf(String type);\n\n    Moment endOf(String type);\n\n    Moment add(int number,\n               String period);\n\n    String format(String format);\n\n    String fromNow();\n\n    String format();\n\n    String toString();\n\n    Double valueOf();\n\n    int hours();\n\n    int minutes();\n\n    int seconds();\n\n    boolean isValid();\n\n    @JsOverlay\n    default Long asLong(){\n        return valueOf().longValue();\n    }\n\n    @JsOverlay\n    default Date asDate(){\n        return new Date(asLong());\n    }\n\n    boolean isSame(Moment moment);\n\n    boolean isSame(Moment moment, String period);\n\n    class Builder {\n\n        @JsMethod(namespace = JsPackage.GLOBAL)\n        public static native Moment moment();\n\n        public static Moment moment(Long time) {\n            return moment(new Double(time));\n        }\n\n        @JsMethod(namespace = JsPackage.GLOBAL)\n        public static native Moment moment(String time, String format);\n\n        @JsMethod(namespace = JsPackage.GLOBAL)\n        protected static native Moment moment(Double time);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/MomentDuration.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.core.client.JavaScriptObject;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\nimport static jsinterop.annotations.JsPackage.GLOBAL;\n\n/**\n * Wrapper class for the <a href=\"https://momentjs.com/docs/#/durations/\">moment.duration</a> function.\n */\n@JsType(isNative = true)\npublic abstract class MomentDuration {\n\n    @JsProperty(namespace = GLOBAL, name = \"moment\")\n    public static MomentDuration moment;\n\n    public native MomentDurationObject duration(final String pattern);\n\n    public native MomentDuration duration(final JavaScriptObject properties);\n\n    public native String toISOString();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/MomentDurationObject.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic class MomentDurationObject {\n\n    public native int days();\n\n    public native int hours();\n\n    public native int minutes();\n\n    public native int seconds();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/MomentTimeZone.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsMethod;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n/**\n * Wrapper class for <a href=\"https://momentjs.com/timezone\">moment-timezone.min.js</a> library\n */\n@JsType(isNative = true, namespace = JsPackage.GLOBAL)\npublic interface MomentTimeZone {\n\n    String[] names();\n\n    double utcOffset();\n\n    String format(final String format);\n\n    class Builder {\n\n        @JsProperty(name = \"moment.tz\", namespace = JsPackage.GLOBAL)\n        public static native MomentTimeZone tz();\n\n        @JsMethod(name = \"moment.tz\", namespace = JsPackage.GLOBAL)\n        public static native MomentTimeZone tz(final String timeZone);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Popover.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsOverlay;\nimport jsinterop.annotations.JsType;\nimport org.uberfire.client.views.pfly.widgets.JQueryProducer.JQueryElement;\n\n/**\n * Wrapper component for PatternFly's <a href=\"http://www.patternfly.org/pattern-library/widgets/#popover\">Popover</a>\n */\n@JsType(isNative = true)\npublic interface Popover extends JQueryElement {\n\n    void popover();\n\n    void popover(String method);\n\n    void popover(PopoverOptions options);\n\n    @JsOverlay\n    default void destroy() {\n        popover(\"destroy\");\n    }\n\n    @JsOverlay\n    default void show() {\n        popover(\"show\");\n    }\n\n    @JsOverlay\n    default void hide() {\n        popover(\"hide\");\n    }\n\n    @JsOverlay\n    default void toggle() {\n        popover(\"toggle\");\n    }\n\n    void on(String event,\n            PopoverEventCallback callback);\n\n    @JsOverlay\n    default void addShowListener(final PopoverEventCallback callback) {\n        on(\"show.bs.popover\",\n           callback);\n    }\n\n    @JsOverlay\n    default void addShownListener(final PopoverEventCallback callback) {\n        on(\"shown.bs.popover\",\n           callback);\n    }\n\n    @JsOverlay\n    default void addHiddenListener(final PopoverEventCallback callback) {\n        on(\"hidden.bs.popover\",\n           callback);\n    }\n\n    @JsOverlay\n    default void addHideListener(final PopoverEventCallback callback) {\n        on(\"hide.bs.popover\",\n           callback);\n    }\n\n    @JsOverlay\n    default void addInsertedListener(final PopoverEventCallback callback) {\n        on(\"inserted.bs.popover\",\n           callback);\n    }\n\n    @JsFunction\n    @FunctionalInterface\n    interface PopoverEventCallback {\n\n        void onEvent();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/PopoverOptions.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport elemental2.dom.HTMLElement;\nimport jsinterop.annotations.JsFunction;\nimport jsinterop.annotations.JsPackage;\nimport jsinterop.annotations.JsProperty;\nimport jsinterop.annotations.JsType;\n\n@JsType(isNative = true, name = \"Object\", namespace = JsPackage.GLOBAL)\npublic class PopoverOptions {\n\n    @JsProperty\n    public native void setAnimation(Boolean animation);\n\n    @JsProperty\n    public native void setContainer(String container);\n\n    @JsProperty\n    public native void setContent(String content);\n\n    @JsProperty\n    public native void setContent(PopoverCallback callback);\n\n    @JsProperty\n    public native void setDelay(int delay);\n\n    @JsProperty\n    public native void setHtml(Boolean html);\n\n    @JsProperty\n    public native void setPlacement(String placement);\n\n    @JsProperty\n    public native void setSelector(String selector);\n\n    @JsProperty\n    public native void setTemplate(String template);\n\n    @JsProperty\n    public native void setTemplate(PopoverCallback callback);\n\n    @JsProperty\n    public native void setTitle(String title);\n\n    @JsProperty\n    public native void setTitle(PopoverCallback callback);\n\n    @JsProperty\n    public native void setTrigger(String trigger);\n\n    @JsProperty\n    public native void setViewport(String viewport);\n\n    @JsProperty\n    public native void setViewport(PopoverCallback callback);\n\n    @JsFunction\n    @FunctionalInterface\n    public interface PopoverCallback {\n\n        Object getValue(HTMLElement element);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/SanitizedNumberInput.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.EventListener;\nimport org.jboss.errai.common.client.dom.KeyboardEvent;\nimport org.jboss.errai.common.client.dom.NumberInput;\n\n@Dependent\npublic class SanitizedNumberInput implements IsElement {\n\n    @Inject\n    NumberInput input;\n\n    private boolean allowNegative = false;\n    private boolean allowDecimal = false;\n\n    public void init() {\n        init(\"0\", null, false, false);\n    }\n\n    public void init(final String min, final String step) {\n        init(min, step, false, false);\n    }\n\n    public void init(final String min, final String step, final boolean allowNegative, final boolean allowDecimal) {\n        if (min != null) {\n            input.setAttribute(\"min\", min);\n        }\n        if (step != null) {\n            input.setAttribute(\"step\", step);\n        }\n        this.allowDecimal = allowDecimal || (step != null && step.contains(\".\"));\n        this.allowNegative = allowNegative || (min != null && min.startsWith(\"-\"));\n\n        input.addEventListener(\"keypress\", getEventListener(this.allowNegative, this.allowDecimal), false);\n    }\n\n    protected EventListener<KeyboardEvent> getEventListener(boolean allowNegative, boolean allowDecimal) {\n        return e -> {\n            String key = e.getKey();\n            if (key.length() == 1) {\n                char k = key.charAt(0);\n                if ((k != '-' || !allowNegative)\n                        && (k != '.' || !allowDecimal)\n                        && (k < '0' || k > '9')) {\n                    e.preventDefault();\n                }\n            }\n        };\n    }\n\n    @Override\n    public NumberInput getElement() {\n        return input;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/Select.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.function.Consumer;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport com.google.gwt.core.client.Scheduler;\nimport com.google.gwt.user.client.TakesValue;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Option;\nimport org.jboss.errai.common.client.dom.OptionsCollection;\n\nimport static com.google.common.base.Strings.isNullOrEmpty;\n\n@Dependent\npublic class Select implements IsElement,\n                               TakesValue<String> {\n\n    @Inject\n    private Document document;\n\n    @Inject\n    private org.jboss.errai.common.client.dom.Select select;\n\n    @Override\n    public HTMLElement getElement() {\n        return select;\n    }\n\n    public void addOption(final String text) {\n        addOption(text,\n                  text);\n    }\n\n    public void addOption(final String text,\n                          final String value) {\n        addOption(text,\n                  value,\n                  false);\n    }\n\n    public void addOption(final String text,\n                          final String value,\n                          final Boolean selected) {\n        addOption(text,\n                  null,\n                  value,\n                  selected);\n    }\n\n    public void addOption(final String text,\n                          final String subText,\n                          final String value,\n                          final Boolean selected) {\n        final Option option = (Option) document.createElement(\"option\");\n        option.setText(text);\n        option.setValue(value);\n        option.setSelected(selected);\n        if (isNullOrEmpty(subText) == false) {\n            option.setAttribute(\"data-subtext\",\n                                subText);\n        }\n        select.add(option);\n    }\n\n    public OptionsCollection getOptions() {\n        return select.getOptions();\n    }\n\n    public void removeAllOptions() {\n        removeAllOptions(select);\n    }\n\n    public void refresh() {\n        refresh(null);\n    }\n\n    public void refresh(final Consumer<Select> consumer) {\n        Scheduler.get().scheduleDeferred(() -> {\n            if (consumer != null) {\n                consumer.accept(this);\n            }\n            refreshElement(select);\n        });\n    }\n\n    @Override\n    public String getValue() {\n        return select.getValue();\n    }\n\n    @Override\n    public void setValue(final String value) {\n        setValue(select,\n                 value);\n    }\n\n    public void enable() {\n        enable(select);\n        refresh();\n    }\n\n    public void disable() {\n        disable(select);\n        refresh();\n    }\n\n    public void hide() {\n        selectpicker(select, \"hide\");\n    }\n\n    public void show() {\n        selectpicker(select, \"show\");\n    }\n\n    public void toggle() {\n        selectpicker(select, \"toggle\");\n    }\n\n    public void setTitle(final String title) {\n        select.setTitle(title);\n    }\n\n    public void setLiveSearch(final Boolean liveSearch){\n        select.setAttribute(\"data-live-search\", String.valueOf(liveSearch));\n    }\n\n    public void setWidth(final String width){\n        select.setAttribute(\"data-width\", width);\n    }\n\n    public void init(){\n        selectpicker(select);\n    }\n\n    private native void refreshElement(final HTMLElement e) /*-{\n        $wnd.jQuery(e).selectpicker('refresh');\n    }-*/;\n\n    private native void setValue(final HTMLElement e,\n                                 final String value) /*-{\n        $wnd.jQuery(e).selectpicker('val', value);\n    }-*/;\n\n    private native void disable(final HTMLElement e) /*-{\n        $wnd.jQuery(e).prop('disabled', true);\n    }-*/;\n\n    private native void enable(final HTMLElement e) /*-{\n        $wnd.jQuery(e).prop('disabled', false);\n    }-*/;\n\n    private native void removeAllOptions(final HTMLElement e) /*-{\n        $wnd.jQuery(e).find('option').remove();\n    }-*/;\n\n    private native void selectpicker(final HTMLElement e) /*-{\n        $wnd.jQuery(e).selectpicker();\n    }-*/;\n\n    private native void selectpicker(final HTMLElement e, final String method) /*-{\n        $wnd.jQuery(e).selectpicker(method);\n    }-*/;\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/java/org/uberfire/client/views/pfly/widgets/ValidationState.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\npublic enum ValidationState {\n\n    WARNING(\"has-warning\"),\n    ERROR(\"has-error\"),\n    SUCCESS(\"has-success\");\n\n    private final String cssClass;\n\n    ValidationState(final String cssClass) {\n        this.cssClass = cssClass;\n    }\n\n    public String getCssName() {\n        return cssClass;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.uberfire.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/PatternFly.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.uberfire.UberfireWorkbench\"/>\n  <inherits name=\"org.gwtbootstrap3.GwtBootstrap3NoTheme\"/>\n\n  <source path=\"pfly\"/>\n\n  <public path=\"static\"/>\n\n  <stylesheet src=\"jquery-ui/jquery-ui.min.css\"/>\n  <stylesheet src=\"bootstrap-daterangepicker/daterangepicker.css\"/>\n  <stylesheet src=\"bootstrap-select/css/bootstrap-select.min.css\"/>\n  <stylesheet src=\"prettify/bin/prettify.min.css\"/>\n  <stylesheet src=\"uberfire-patternfly.css\" />\n</module>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/PatternFlyTheme.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ /*\n  ~  * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n  ~  *\n  ~  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n  ~  * use this file except in compliance with the License. You may obtain a copy of\n  ~  * the License at\n  ~  *\n  ~  * http://www.apache.org/licenses/LICENSE-2.0\n  ~  *\n  ~  * Unless required by applicable law or agreed to in writing, software\n  ~  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n  ~  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n  ~  * License for the specific language governing permissions and limitations under\n  ~  * the License.\n  ~  */\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n\n  <stylesheet src=\"css/patternfly.min.css\"/>\n  <stylesheet src=\"css/patternfly-additions.min.css\"/>\n</module>"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants.properties",
    "content": "Actions=Actions\nApplyLabel=Apply\nCancelLabel=Cancel\nFromLabel=From\nToLabel=To\nCustomRangeLabel=Custom\nWeekLabel=W\nSundayShort=Su\nMondayShort=Mo\nTuesdayShort=Tu\nWednesdayShort=We\nThursdayShort=Th\nFridayShort=Fr\nSaturdayShort=Sa\nJanuary=January\nFebruary=February\nMarch=March\nApril=April\nMay=May\nJune=June\nJuly=July\nAugust=August\nSeptember=September\nOctober=October\nNovember=November\nDecember=December\nMenu=Menu\nHome=Home\n\nErrorPopupView.PopupTitle=Error\nErrorPopupView.ShowDetailLabel=Show Details\nErrorPopupView.CloseDetailLabel=Close Details\nErrorPopupView.Close=Close\n\nConfirmPopup.Cancel=Cancel"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_de.properties",
    "content": "Actions=Aktionen\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJanuary=Januar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nFebruary=Februar\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMarch=März\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nApril=April\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nMay=Mai\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJune=Juni\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nJuly=Juli\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nAugust=August\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nSeptember=September\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nOctober=Oktober\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nNovember=November\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author jdimanos\nDecember=Dezember\n# translation auto-copied from project KIE webapp distributions, version 6.0.0, document org.kie/kie-wb-webapp/org/kie/workbench/client/resources/i18n/AppConstants, author jdimanos\nHome=Home\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_es.properties",
    "content": "Actions=Acciones\nApplyLabel=Aplicar\nCancelLabel=Cancelar\nFromLabel=Desde\nToLabel=Hasta\nCustomRangeLabel=Personalizado\nWeekLabel=Sem.\nSundayShort=Do\nMondayShort=Lu\nTuesdayShort=Ma\nWednesdayShort=Mi\nThursdayShort=Ju\nFridayShort=Vi\nSaturdayShort=Sá\nJanuary=Enero\nFebruary=Febrero\nMarch=Marzo\nApril=Abril\nMay=Mayo\nJune=Junio\nJuly=Julio\nAugust=Agosto\nSeptember=Septiembre\nOctober=Octubre\nNovember=Noviembre\nDecember=Diciembre\nMenu=Menú\nHome=Inicio\n\nErrorPopupView.PopupTitle=Error\nErrorPopupView.ShowDetailLabel=Mostrar detalles\nErrorPopupView.CloseDetailLabel=Cerrar detalles\nErrorPopupView.Close=Cerrar\n\nConfirmPopup.Cancel=Cancelar"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_fr.properties",
    "content": "Actions=Actions\nApplyLabel=Appliquer\nCancelLabel=Annuler\nFromLabel=De\nToLabel=À\nCustomRangeLabel=Personnalisé\nWeekLabel=S\nSundayShort=Di\nMondayShort=Lu\nTuesdayShort=Ma\nWednesdayShort=Me\nThursdayShort=Je\nFridayShort=Ve\nSaturdayShort=Sa\nJanuary=Janvier\nFebruary=Février\nMarch=Mars\nApril=Avril\nMay=Mai\nJune=Juin\nJuly=Juillet\nAugust=Août\nSeptember=Septembre\nOctober=Octobre\nNovember=Novembre\nDecember=Décembre\nMenu=Menu\nHome=Accueil\n\nErrorPopupView.PopupTitle=Erreur\nErrorPopupView.ShowDetailLabel=Afficher les détails\nErrorPopupView.CloseDetailLabel=Fermer les détails\nErrorPopupView.Close=Fermer\n\nConfirmPopup.Cancel=Annuler"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_it.properties",
    "content": "Actions=Azioni\nApplyLabel=Applica\nCancelLabel=Annulla\nFromLabel=Da\nToLabel=A\nCustomRangeLabel=Personalizzato\nWeekLabel=S\nSundayShort=Do\nMondayShort=Lu\nTuesdayShort=Ma\nWednesdayShort=Me\nThursdayShort=Gi\nFridayShort=Ve\nSaturdayShort=Sa\nJanuary=Gennaio\nFebruary=Febbraio\nMarch=Marzo\nApril=Aprile\nMay=Maggio\nJune=Giugno\nJuly=Luglio\nAugust=Agosto\nSeptember=Settembre\nOctober=Ottobre\nNovember=Novembre\nDecember=Dicembre\nMenu=Menu\nHome=Home\n\nErrorPopupView.PopupTitle=Errore\nErrorPopupView.ShowDetailLabel=Mostra Dettagli\nErrorPopupView.CloseDetailLabel=Chiudi Dettagli\nErrorPopupView.Close=Chiudi\n\nConfirmPopup.Cancel=Annulla"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_ja.properties",
    "content": "Actions=アクション\nApplyLabel=適用\nCancelLabel=キャンセル\nFromLabel=から\nToLabel=終了\nCustomRangeLabel=カスタム\nWeekLabel=週\nSundayShort=日\nMondayShort=月\nTuesdayShort=火\nWednesdayShort=水\nThursdayShort=木\nFridayShort=金\nSaturdayShort=土\nJanuary=1月\nFebruary=2月\nMarch=3月\nApril=4月\nMay=5月\nJune=6月\nJuly=7月\nAugust=8月\nSeptember=9月\nOctober=10月\nNovember=11月\nDecember=12月\nMenu=メニュー\nHome=ホーム\n\nErrorPopupView.PopupTitle=エラー\nErrorPopupView.ShowDetailLabel=詳細表示\nErrorPopupView.CloseDetailLabel=詳細を閉じる\nErrorPopupView.Close=閉じる\n\nConfirmPopup.Cancel=キャンセル"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_pt_BR.properties",
    "content": "Actions=Ações\nJanuary=Janeiro\nFebruary=Fevereiro\nMarch=Março\nApril=Abril\nMay=Maio\nJune=Junho\nJuly=Julho\nAugust=Agosto\nSeptember=Setembro\nOctober=Outubro\nNovember=Novembro\nDecember=Dezembro\n# translation auto-copied from project KIE webapp distributions, version 6.0.0, document org.kie/kie-wb-webapp/org/kie/workbench/client/resources/i18n/AppConstants, author tkobayashi\nHome=Página Principal\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/pfly/resources/i18n/Constants_zh_CN.properties",
    "content": "Actions=动作\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJanuary=一月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nFebruary=二月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMarch=三月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nApril=四月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nMay=五月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJune=六月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nJuly=七月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nAugust=八月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nSeptember=九月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nOctober=十月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nNovember=十一月\n# translation auto-copied from project KIE Workbench - Common, version 6.0.0, document org.kie.workbench.widgets/kie-wb-common-ui/org/kie/workbench/common/widgets/client/resources/i18n/CommonConstants, author xi.huang\nDecember=十二月\n# translation auto-copied from project KIE webapp distributions, version 6.0.0, document org.kie/kie-wb-webapp/org/kie/workbench/client/resources/i18n/AppConstants, author xi.huang\nHome=主页\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/static/uberfire-patternfly.css",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n.fa-muted {\n    color: #999999;\n}\n\n.fa-active {\n    color: #0076b7;\n}\n\n.panel.uf-listbar-panel {\n    border: none;\n    height: 100%;\n}\n\n.panel.uf-listbar-panel .panel-body {\n    padding: 0px;\n    height: 100%;\n}\n\n.panel.uf-listbar-panel .uf-listbar-panel-header {\n    background-color: #FFFFFF;\n}\n\n.uf-listbar-panel .uf-listbar-panel-header {\n    display: flex;\n    padding-top: 6px;\n    padding-bottom: 6px;\n}\n\n.uf-listbar-panel .uf-listbar-panel-header .dropdown-menu {\n    margin-top: 6px;\n}\n\n.uf-listbar-panel .uf-listbar-panel-header .dropdown-menu i {\n    margin-top: 4px;\n}\n\n.uf-listbar-panel .uf-listbar-panel-header .dropdown-menu span {\n    margin-right: 15px;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-toolbar {\n    white-space: nowrap;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-toolbar .btn-group,\n.uf-listbar-panel-header .uf-listbar-panel-header-toolbar .btn-group button {\n    float: none;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title {\n    flex-grow: 1;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title button:hover,\n.uf-listbar-panel-header .uf-listbar-panel-header-title button:focus {\n    color: inherit;\n    text-decoration: none;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title .caret {\n    margin-left: 3px;\n    display: inline-block;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title:hover .caret {\n    color: #0076b7;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title button {\n    color: inherit;\n    padding: 0 18px 0 0;\n    width: 100%;\n    text-align: left;\n    border: none;\n    font-size: 16px;\n    font-weight: 500;\n    line-height: normal;\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title .dropdown {\n    position: static;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title .dropdown-menu {\n    left: auto;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title .dropdown-menu > li > a {\n    white-space: normal;\n}\n\n.uf-listbar-panel-header .uf-listbar-panel-header-title-text {\n    white-space: nowrap;\n    overflow: hidden;\n    text-overflow: ellipsis;\n    display: inline-block;\n    float: left;\n    max-width: 100%;\n    width: auto;\n}\n\n.uf-tabbar-panel {\n\n}\n\n.uf-tabbar-panel .tab-content {\n    height: 100%;\n}\n\n.uf-tabbar-panel-nav-tabs {\n    padding-top: 1px;\n}\n\n.uf-tabbar-panel-widgets {\n    padding-top: 1px;\n}\n\n.uf-tabbar-panel-nav-tabs .uf-activeNavTabs {\n\n}\n\n.uf-multitab-panel .uf-tabbar-panel-nav-tabs .uf-tabbar-panel-widgets .active:hover a {\n    cursor: move;\n}\n\n.uf-modal .modal-footer {\n    margin-top: 0px;\n}\n\n.uf-drop-target-highlight {\n    z-index: 100000;\n    border: 2px #0076b7 solid;\n    background-color: #199dde;\n    opacity: 0.50;\n    filter: alpha(opacity=50);\n}\n\n.uf-drop-target-compass {\n    z-index: 100001;\n    background-color: #fff;\n    border: 1px #ddd solid;\n}\n\n.uf-drop-target-compass-centre {\n    border: 1px #ddd solid;\n}\n\n.uf-drop-target-compass-west,\n.uf-drop-target-compass-east {\n    border-top: 1px #ddd solid;\n    border-bottom: 1px #ddd solid;\n}\n\n.uf-drop-target-compass-centre > i,\n.uf-drop-target-compass-west > i,\n.uf-drop-target-compass-east > i {\n    position: absolute;\n    top: 40%;\n    left: 35%;\n}\n\n.uf-drop-target-compass-north,\n.uf-drop-target-compass-south {\n    text-align: center;\n}\n\n.uf-list-dropdown {\n\n}\n\n.uf-list-dropdown-single {\n\n}\n\n.uf-list-dropdown-single a:hover {\n    cursor: default;\n}\n\n.uf-list-dropdown-multi {\n\n}\n\n.uf-part-list-dropdown-selected span {\n    font-weight: bold;\n}\n\n.uf-multi-page-editor .nav-tabs-pf > li:first-child > a {\n    padding-left: 15px;\n}\n\n.uf-multi-page-editor .nav-tabs-pf > li:first-child > a:before {\n    left: 15px !important;\n}\n\n.uf-multi-page-editor .uf-tabbar-panel-nav-tabs .uf-tabbar-panel-widgets {\n    padding-top: 0px;\n}\n\n.navbar-pf.uf-navbar-compact .uf-navbar-nav-compact > li:first-child {\n    border-left: 1px solid #2b2b2b;\n}\n\n.navbar-pf.uf-navbar-compact .uf-navbar-nav-compact > li > a {\n    padding: 7px 10px 8px 10px;\n}\n\n.navbar-pf.uf-navbar-compact .uf-navbar-nav-compact > li > a:hover {\n    background-color: #1d1d1d;\n    border-top-color: #5c5c5c;\n    color: #cfcfcf;\n    background-image: -webkit-linear-gradient(top, #363636 0%, #1d1d1d 100%);\n    background-image: -o-linear-gradient(top, #363636 0%, #1d1d1d 100%);\n    background-image: linear-gradient(to bottom, #363636 0%, #1d1d1d 100%);\n    background-repeat: repeat-x;\n    filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff363636', endColorstr='#ff1d1d1d', GradientType=0);\n}\n\n.navbar-pf .navbar-header .navbar-brand {\n    margin-right: 10px;\n}\n\n.navbar-pf .dropdown-menu {\n    z-index: 100010;\n}\n\n@media (min-width: 768px) {\n    .navbar-pf .navbar-nav.navbar-utility > li > a {\n        height: 26px;\n    }\n\n    /* Fix mega menu items center alignment in IE11 */\n    #mega-menu .nav-item-iconic {\n        height: 58px;\n    }\n}\n\n@media (max-width: 767px) {\n    .navbar-pf .navbar-header,\n    .uf-perspective-context-menu,\n    .uf-perspective-context-menu li,\n    .nav.navbar-nav.navbar-primary.persistent-secondary li {\n        float: none !important;\n    }\n\n    li.uf-perspective-context-menu-empty {\n        padding-top: 0;\n    }\n\n    .navbar-pf .navbar-primary.persistent-secondary > li.uf-perspective-context-menu-empty.active {\n        margin-bottom: 0px;\n    }\n\n    .navbar-pf .navbar-nav.uf-navbar-nav-compact {\n        font-size: 12px;\n    }\n\n    .navbar-pf .navbar-nav.uf-navbar-nav-compact > li > a {\n        padding: 10px 20px;\n    }\n}\n\n/* Fix for modal behind backdrop. Potentially fixed by the next BS release.\n   Broken in 3.3.4\n   See https://github.com/twbs/bootstrap/issues/16148\n */\n.modal-dialog {\n    z-index: 1050;\n}\n\n.uf-navbar-nav-compact {\n    font-size: 11px;\n}\n\n.uf-navbar-nav-compact > li:first-child > a,\n.uf-navbar-nav-compact > li:first-child.open > a,\n.uf-navbar-nav-compact > li:first-child > a:hover,\n.uf-navbar-nav-compact > li:first-child > a:focus {\n    background-color: #303030;\n    background-image: linear-gradient(to bottom, #434343 0px, #303030 100%);\n    background-repeat: repeat-x;\n    border-bottom-color: #303030;\n    border-top-color: #696969;\n    box-shadow: none;\n    color: #f1f1f1;\n}\n\n.navbar-pf .navbar-nav.uf-navbar-nav-compact .uf-perspective-context-menu.open > a,\n.navbar-pf .navbar-nav.uf-navbar-nav-compact .uf-perspective-context-menu > a:hover,\n.navbar-pf .navbar-nav.uf-navbar-nav-compact .uf-perspective-context-menu > a:focus {\n    color: #f1f1f1;\n}\n\n.navbar-pf .navbar-nav.persistent-secondary .dropdown-menu {\n    top: auto;\n    left: auto;\n}\n\n.navbar-pf .navbar-nav.navbar-primary.persistent-secondary > li.active {\n    margin-bottom: 33px;\n}\n\n.navbar-pf .navbar-nav.navbar-primary.persistent-secondary > li.active:not(.uf-perspective-context-menu-container) {\n    margin-bottom: 0px;\n}\n\n.navbar-pf .navbar-nav.navbar-primary.persistent-secondary > li > .navbar-persistent > li a.disabled {\n    color: #999;\n}\n\n.uf-help-icon {\n    color: #0099d3;\n    display: inline;\n}\n\n.uf-form-label .uf-help-icon {\n    margin-left: 5px;\n}\n\n.form-horizontal .uf-form-label {\n    text-align: right;\n}\n\n.uf-workbench-layout > div:first-child > div:first-child,\n.uf-workbench-layout > div:first-child > div:nth-child(2) {\n    overflow: hidden !important;\n}\n\n.uf-perspective-context-menu-empty {\n    padding-top: 43px;\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/main/resources/org/uberfire/client/views/static/uberfire-variables.less",
    "content": "@import \"less/variables.less\";\n@import \"less/dependencies/bootstrap/variables.less\";\n@import \"less/dependencies/font-awesome/variables.less\";\n\n@spacer: 1rem;\n@pf-spacer-xxxs: (@spacer * .25); // ~3px\n@pf-spacer-xxs: (@spacer * .5); // 7px\n@pf-spacer-xs: (@spacer * .75); // ~10px\n@pf-spacer-sm: @spacer; // 14px\n@pf-spacer-md: (@spacer * 1.25); // ~17px\n@pf-spacer-lg: (@spacer * 1.5); // 21px\n@pf-spacer-xl: (@spacer * 1.75); // ~24px\n@pf-spacer-xxl: (@spacer * 2); // 28 px\n@pf-spacer-xxxl: (@spacer * 2.5); // 35 px\n@pf-spacer-xxxxl: (@spacer * 3); // 42 px"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/PatternFlyTabTests.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.4.0//EN\"\n    \"http://google-web-toolkit.googlecode.com/svn/tags/2.5.0/distro-source/core/src/gwt-module.dtd\">\n<module>\n\n  <inherits name=\"org.uberfire.client.views.PatternFly\"/>\n  <inherits name=\"org.uberfire.java.nio.UberfireNIO2Model\"/>\n  <inherits name=\"org.uberfire.experimental.UberfireExperimentalClient\"/>\n\n  <source path='tab'/>\n  <source path='mock'/>\n  <source path='listbar'/>\n  <public path='js'/>\n  \n  <script src='jquery-1.12.4.min.js'></script>\n  <script src='bootstrap-3.4.1.min.js'></script>\n  \n  <add-linker name='xs'/>\n  \n  <collapse-all-properties/>\n</module>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/listbar/ListBarWidgetImplTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.listbar;\n\nimport java.util.Collection;\nimport java.util.LinkedHashSet;\nimport java.util.LinkedList;\nimport java.util.List;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.Button;\nimport org.gwtbootstrap3.client.ui.ButtonGroup;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.PanelBody;\nimport org.gwtbootstrap3.client.ui.PanelHeader;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.uberfire.client.views.pfly.maximize.MaximizeToggleButton;\nimport org.uberfire.client.workbench.PanelManager;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.commons.data.Pair;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.ResourceAction;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.security.authz.Permission;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\nimport org.uberfire.workbench.model.menu.MenuFactory;\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class ListBarWidgetImplTest {\n\n    @Mock\n    AuthorizationManager authzManager;\n\n    @Mock\n    User identity;\n\n    @Mock\n    PanelManager panelManager;\n\n    @Spy\n    @InjectMocks\n    ListBarWidgetImpl listBar;\n\n    @Before\n    public void setUp() throws Exception {\n        when(authzManager.authorize(any(Permission.class),\n                                    any(User.class))).thenReturn(true);\n        when(authzManager.authorize(any(Resource.class),\n                                    any(User.class))).thenReturn(true);\n        when(authzManager.authorize(any(Resource.class),\n                                    any(ResourceAction.class),\n                                    any(User.class))).thenReturn(true);\n\n        doNothing().when(listBar).setupContextMenu();\n\n        listBar.contextMenu = mock(ButtonGroup.class);\n        listBar.titleDropDown = mock(PartListDropdown.class);\n        listBar.content = mock(PanelBody.class);\n        listBar.header = mock(PanelHeader.class);\n        listBar.maximizeButton = mock(MaximizeToggleButton.class);\n\n        final Element element = mock(Element.class);\n        final Style style = mock(Style.class);\n        doReturn(style).when(element).getStyle();\n        doReturn(element).when(listBar.content).getElement();\n    }\n\n    @Test\n    public void onSelectPartOnPartHiddenEventIsFiredTest() {\n        final PartDefinition selectedPart = mock(PartDefinition.class);\n        final PartDefinition currentPart = mock(PartDefinition.class);\n\n        listBar.partContentView.put(selectedPart,\n                                    new FlowPanel());\n        listBar.parts.add(selectedPart);\n        listBar.currentPart = Pair.newPair(currentPart,\n                                           new FlowPanel());\n        listBar.partContentView.put(currentPart,\n                                    new FlowPanel());\n\n        listBar.selectPart(selectedPart);\n\n        verify(panelManager).onPartHidden(currentPart);\n        verify(listBar).resizePanelBody();\n    }\n\n    @Test\n    public void partsIsAddedToListBarTest() {\n        final PartDefinition firstPart = mock(PartDefinition.class);\n        final PartDefinition secondPart = mock(PartDefinition.class);\n\n        listBar.parts.add(firstPart);\n        listBar.parts.add(secondPart);\n\n        assertEquals(2,\n                     listBar.getParts().size());\n    }\n\n    @Test\n    public void changeTitleForSelectablePart() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      false);\n        final IsWidget widget = mock(IsWidget.class);\n\n        listBar.changeTitle(part,\n                            \"title\",\n                            widget);\n\n        verify(listBar.titleDropDown).changeTitle(part,\n                                                  \"title\",\n                                                  widget);\n    }\n\n    @Test\n    public void changeTitleForUnselectablePart() {\n        final PartDefinition part = getPartDefinition(false,\n                                                      false);\n        final IsWidget widget = mock(IsWidget.class);\n\n        listBar.changeTitle(part,\n                            \"title\",\n                            widget);\n\n        verify(listBar.titleDropDown,\n               never()).changeTitle(part,\n                                    \"title\",\n                                    widget);\n    }\n\n    @Test\n    public void addNewSelectablePartTest() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      false);\n        final WorkbenchPartPresenter presenter = getWorkbenchPartPresenter(part);\n        final WorkbenchPartPresenter.View view = getWorkbenchPartView(presenter);\n\n        listBar.parts.add(getPartDefinition(false,\n                                            true));\n\n        listBar.addPart(view);\n\n        verify(listBar,\n               never()).selectPart(part);\n        verify(listBar.titleDropDown).addPart(view);\n        verify(listBar).setupCSSLocators(any(),\n                                         any());\n\n        assertSame(part,\n                   listBar.parts.getFirst());\n    }\n\n    @Test\n    public void addNewUnselectablePartTest() {\n        final PartDefinition part = getPartDefinition(false,\n                                                      false);\n        final WorkbenchPartPresenter presenter = getWorkbenchPartPresenter(part);\n        final WorkbenchPartPresenter.View view = getWorkbenchPartView(presenter);\n\n        listBar.addPart(view);\n\n        verify(listBar,\n               never()).selectPart(part);\n        verify(listBar.titleDropDown,\n               never()).addPart(view);\n        verify(listBar).resizePanelBody();\n    }\n\n    @Test\n    public void addExistentPartTest() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      true);\n        final WorkbenchPartPresenter presenter = getWorkbenchPartPresenter(part);\n        final WorkbenchPartPresenter.View view = getWorkbenchPartView(presenter);\n\n        listBar.addPart(view);\n\n        verify(listBar).selectPart(part);\n        verify(listBar.titleDropDown,\n               never()).addPart(view);\n        verify(listBar).resizePanelBody();\n    }\n\n    @Test\n    public void selectNewPartTest() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      false);\n\n        final boolean selected = listBar.selectPart(part);\n\n        assertFalse(selected);\n        verify(listBar.titleDropDown,\n               never()).selectPart(part);\n        verify(listBar,\n               never()).setupContextMenu();\n        verify(listBar.header,\n               never()).setVisible(anyBoolean());\n        verify(listBar,\n               never()).resizePanelBody();\n    }\n\n    @Test\n    public void selectExistentUnselectablePartTest() {\n        final PartDefinition part = getPartDefinition(false,\n                                                      true);\n\n        final boolean selected = listBar.selectPart(part);\n\n        assertTrue(selected);\n        verify(listBar.titleDropDown,\n               never()).selectPart(part);\n        verify(listBar,\n               never()).setupContextMenu();\n        verify(listBar.header).setVisible(false);\n        verify(listBar).resizePanelBody();\n    }\n\n    @Test\n    public void selectExistentSelectablePartTest() {\n        final PartDefinition currentPart = getPartDefinition(false,\n                                                             false);\n        listBar.currentPart = Pair.newPair(currentPart,\n                                           new FlowPanel());\n\n        final PartDefinition selectedPart = getPartDefinition(true,\n                                                              true);\n\n        final boolean selected = listBar.selectPart(selectedPart);\n\n        assertTrue(selected);\n        verify(listBar.titleDropDown).selectPart(selectedPart);\n        verify(listBar).setupContextMenu();\n        verify(listBar.header).setVisible(true);\n        verify(listBar).resizePanelBody();\n\n        assertEquals(1, listBar.parts.size());\n        assertSame(currentPart, listBar.parts.getFirst());\n        assertSame(selectedPart, listBar.currentPart.getK1());\n    }\n\n    @Test\n    public void removeUnselectablePartTest() {\n        final PartDefinition part = getPartDefinition(false,\n                                                      true);\n\n        listBar.remove(part);\n\n        verify(listBar.titleDropDown,\n               never()).removePart(part);\n        verify(listBar).resizePanelBody();\n    }\n\n    @Test\n    public void notifyPartHiddenOnRemoveTest() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      true);\n        listBar.selectPart(part);\n        listBar.remove(part);\n\n        verify(listBar.titleDropDown).removePart(part);\n        verify(panelManager).onPartHidden(part);\n    }\n\n    @Test\n    public void removeSelectablePartTest() {\n        final PartDefinition part = getPartDefinition(true,\n                                                      true);\n\n        listBar.remove(part);\n\n        verify(listBar.titleDropDown).removePart(part);\n        verify(listBar).resizePanelBody();\n    }\n\n    private PartDefinition getPartDefinition(final boolean selectable,\n                                             final boolean existent) {\n        final PartDefinition part = mock(PartDefinition.class);\n        doReturn(selectable).when(part).isSelectable();\n        doReturn(\"\").when(part).asString();\n\n        if (existent) {\n            listBar.partContentView.put(part,\n                                        new FlowPanel());\n            listBar.parts.add(part);\n            listBar.partContentView.put(part,\n                                        new FlowPanel());\n        }\n\n        return part;\n    }\n\n    private WorkbenchPartPresenter getWorkbenchPartPresenter(final PartDefinition part) {\n        final WorkbenchPartPresenter presenter = mock(WorkbenchPartPresenter.class);\n        doReturn(part).when(presenter).getDefinition();\n        return presenter;\n    }\n\n    private WorkbenchPartPresenter.View getWorkbenchPartView(final WorkbenchPartPresenter presenter) {\n        final WorkbenchPartPresenter.View view = mock(WorkbenchPartPresenter.View.class);\n        doReturn(presenter).when(view).getPresenter();\n        return view;\n    }\n\n    @Test\n    public void testSingleMenu() {\n        final String caption = \"test\";\n        final Menus menus = MenuFactory.newTopLevelMenu(caption).respondsWith(() -> {\n        }).endMenu().build();\n\n        final Widget widget = listBar.makeItem(menus.getItems().get(0),\n                                               true);\n\n        assertTrue(widget instanceof Button);\n        verify((Button) widget).setText(caption);\n    }\n\n    @Test\n    public void testSubMenus() {\n        final String caption = \"test\";\n        final String submenu1 = \"submenu1\";\n        final String submenu2 = \"submenu2\";\n        final Menus menus = MenuFactory.newTopLevelMenu(caption)\n                .menus()\n                .menu(submenu1).respondsWith(() -> {\n                }).endMenu()\n                .menu(submenu2).respondsWith(() -> {\n                }).endMenu()\n                .endMenus()\n                .endMenu()\n                .build();\n\n        final Widget widget = listBar.makeItem(menus.getItems().get(0),\n                                               true);\n\n        assertTrue(widget instanceof ButtonGroup);\n\n        ArgumentCaptor<Widget> buttonCaptor = ArgumentCaptor.forClass(Widget.class);\n        verify(((ButtonGroup) widget),\n               times(2)).add(buttonCaptor.capture());\n\n        final List<Widget> widgetList = buttonCaptor.getAllValues();\n        assertEquals(2,\n                     widgetList.size());\n        verify((Button) widgetList.get(0)).setText(caption);\n\n        ArgumentCaptor<Widget> dropCaptor = ArgumentCaptor.forClass(Widget.class);\n\n        verify((DropDownMenu) widgetList.get(1),\n               times(2)).add(dropCaptor.capture());\n\n        final List<Widget> subMenusWidgetList = dropCaptor.getAllValues();\n        assertEquals(2,\n                     subMenusWidgetList.size());\n        verify((AnchorListItem) subMenusWidgetList.get(0)).setText(submenu1);\n        verify((AnchorListItem) subMenusWidgetList.get(1)).setText(submenu2);\n    }\n\n    @Test\n    public void getNextSelectablePartTest() {\n        PartDefinition part1 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part1.setSelectable(false);\n        PartDefinition part2 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part2.setSelectable(true);\n        PartDefinition part3 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part3.setSelectable(false);\n        PartDefinition part4 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part4.setSelectable(true);\n        PartDefinition part5 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part5.setSelectable(false);\n\n        LinkedHashSet<PartDefinition> parts = new LinkedHashSet<>();\n        parts.add(part1);\n        parts.add(part2);\n        parts.add(part3);\n        parts.add(part4);\n        parts.add(part5);\n        doReturn(parts).when(listBar).getUnselectedParts();\n\n        assertSame(part2, listBar.getNextPart(part1));\n        assertSame(part4, listBar.getNextPart(part2));\n        assertSame(part2, listBar.getNextPart(part3));\n        assertSame(part2, listBar.getNextPart(part4));\n        assertSame(part2, listBar.getNextPart(part5));\n    }\n\n    @Test\n    public void getFirstUnselectablePartTest() {\n        PartDefinition part1 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part1.setSelectable(false);\n        PartDefinition part2 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part2.setSelectable(true);\n        PartDefinition part3 = new PartDefinitionImpl(mock(PlaceRequest.class));\n        part3.setSelectable(false);\n\n        LinkedHashSet<PartDefinition> parts = new LinkedHashSet<>();\n        parts.add(part1);\n        parts.add(part2);\n        parts.add(part3);\n        doReturn(parts).when(listBar).getUnselectedParts();\n\n        assertSame(part2, listBar.getNextPart(part1));\n        assertSame(part1, listBar.getNextPart(part2));\n        assertSame(part2, listBar.getNextPart(part3));\n    }\n\n    @Test\n    public void resizePanelBodyForUnselectablePart() {\n        final PartDefinitionImpl partDefinition = new PartDefinitionImpl(mock(PlaceRequest.class));\n        partDefinition.setSelectable(false);\n        listBar.currentPart = new Pair<>(partDefinition,\n                                         mock(FlowPanel.class));\n\n        listBar.resizePanelBody();\n\n        verify(listBar.content.getElement().getStyle()).setProperty(\"height\",\n                                                                    \"100%\");\n    }\n\n    @Test\n    public void resizePanelBodyForSelectablePart() {\n        final PartDefinitionImpl partDefinition = new PartDefinitionImpl(mock(PlaceRequest.class));\n        partDefinition.setSelectable(true);\n        listBar.currentPart = new Pair<>(partDefinition,\n                                         mock(FlowPanel.class));\n        doReturn(10).when(listBar.header).getOffsetHeight();\n\n        listBar.resizePanelBody();\n\n        verify(listBar.content.getElement().getStyle()).setProperty(\"height\",\n                                                                    \"calc(100% - 10px)\");\n    }\n\n    @Test\n    public void getPartsTest() {\n        listBar.currentPart = Pair.newPair(getPartDefinition(false,\n                                                             false),\n                                           null);\n        listBar.parts = new LinkedList<>();\n        listBar.parts.add(getPartDefinition(false,\n                                            false));\n\n        final List<PartDefinition> parts = (List<PartDefinition>) listBar.getParts();\n\n        assertSame(listBar.currentPart.getK1(),\n                   parts.get(0));\n        assertSame(listBar.parts.get(0),\n                   parts.get(1));\n    }\n\n    @Test\n    public void disableExpandPart() {\n        listBar.disableExpandPart();\n        verify(listBar.maximizeButton).setVisible(false);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/listbar/PartListDropdownTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.client.views.pfly.listbar;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Spy;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class PartListDropdownTest {\n\n    @Spy\n    @InjectMocks\n    PartListDropdown dropdown;\n\n    @Test\n    public void selectPartShouldMakeItDraggableOnlyIfDnDIsEnable(){\n        assertTrue(dropdown.isDndEnabled());\n        dropdown.selectPart(mock(PartDefinition.class));\n        verify(dropdown).makeDraggable(any(),any());\n    }\n\n    @Test\n    public void selectPartShouldNeverMakeItDraggableIfDnDIsDisable(){\n        dropdown.disableDragAndDrop();\n        assertTrue(!dropdown.isDndEnabled());\n        dropdown.selectPart(mock(PartDefinition.class));\n        verify(dropdown, never()).makeDraggable(any(),any());\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/menu/UserMenuTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.security.authz.AuthorizationManager;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UserMenuTest {\n\n    @Mock\n    private UserMenu.UserMenuView userMenuView;\n\n    @Mock\n    private User user;\n\n    @Mock\n    private AuthorizationManager authzManager;\n\n    @InjectMocks\n    private UserMenu userMenu;\n\n    @Test\n    public void testUserNameWithId() {\n        final String userName = \"mock\";\n        when(user.getIdentifier()).thenReturn(userName);\n        userMenu.setup();\n        verify(userMenuView).setUserName(userName);\n    }\n\n    @Test\n    public void testUserNameUsingFirstAndLastName() {\n        final String firstName = \"Mock\";\n        final String lastName = \"Test\";\n        when(user.getProperty(User.StandardUserProperties.FIRST_NAME)).thenReturn(firstName);\n        when(user.getProperty(User.StandardUserProperties.LAST_NAME)).thenReturn(lastName);\n        userMenu.setup();\n        verify(userMenuView).setUserName(firstName + \" \" + lastName);\n    }\n\n    @Test\n    public void testUserNameUsingFirstName() {\n        final String firstName = \"Mock\";\n        when(user.getProperty(User.StandardUserProperties.FIRST_NAME)).thenReturn(firstName);\n        userMenu.setup();\n        verify(userMenuView).setUserName(firstName);\n    }\n\n    @Test\n    public void testUserNameUsingLastName() {\n        final String lastName = \"Test\";\n        when(user.getProperty(User.StandardUserProperties.LAST_NAME)).thenReturn(lastName);\n        userMenu.setup();\n        verify(userMenuView).setUserName(lastName);\n    }\n\n    @Test\n    public void testClear() {\n        userMenu.clear();\n        verify(userMenuView).clearMenuItems();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuBarViewTest.java",
    "content": "/*\n *\n *  * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.gwtbootstrap3.client.ui.Collapse;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchMenuBarViewTest {\n\n    @Mock\n    private WorkbenchMenuCompactNavBarView workbenchMenuCompactNavBarView;\n\n    @Mock\n    private WorkbenchMenuStandardNavBarView workbenchMenuStandardNavBarView;\n\n    @Mock\n    private UtilityMenuBarView utilityMenuBarView;\n\n    @GwtMock\n    private Collapse navBarCollapse;\n\n    @InjectMocks\n    private WorkbenchMenuBarView workbenchMenuBarView;\n\n    @Test\n    public void testAddMenuItem() {\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.LEFT;\n        final Command command = new Command() {\n            @Override\n            public void execute() {\n\n            }\n        };\n        workbenchMenuBarView.addMenuItem(menuId,\n                                         label,\n                                         menuParentId,\n                                         command,\n                                         position);\n\n        verify(workbenchMenuCompactNavBarView).addMenuItem(menuId,\n                                                           label,\n                                                           menuParentId,\n                                                           command,\n                                                           position);\n        verify(workbenchMenuStandardNavBarView).addMenuItem(menuId,\n                                                            label,\n                                                            menuParentId,\n                                                            command,\n                                                            position);\n    }\n\n    @Test\n    public void testAddCustomMenuItem() {\n        final Widget menu = GWT.create(Widget.class);\n        final MenuPosition position = MenuPosition.LEFT;\n        workbenchMenuBarView.addCustomMenuItem(menu,\n                                               position);\n\n        verify(workbenchMenuCompactNavBarView).addCustomMenuItem(menu,\n                                                                 position);\n        verify(workbenchMenuStandardNavBarView).addCustomMenuItem(menu,\n                                                                  position);\n    }\n\n    @Test\n    public void testAddGroupMenuItem() {\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.LEFT;\n\n        workbenchMenuBarView.addGroupMenuItem(menuId,\n                                              label,\n                                              position);\n\n        verify(workbenchMenuCompactNavBarView).addGroupMenuItem(menuId,\n                                                                label,\n                                                                position);\n        verify(workbenchMenuStandardNavBarView).addGroupMenuItem(menuId,\n                                                                 label,\n                                                                 position);\n    }\n\n    @Test\n    public void testAddContextMenuItem() {\n        final String menuItemId = RandomStringUtils.random(10);\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = new Command() {\n            @Override\n            public void execute() {\n\n            }\n        };\n\n        workbenchMenuBarView\n                .addContextMenuItem(menuItemId,\n                                    menuId,\n                                    label,\n                                    menuParentId,\n                                    command,\n                                    position);\n\n        verify(workbenchMenuCompactNavBarView)\n                .addContextMenuItem(menuItemId,\n                                    menuId,\n                                    label,\n                                    menuParentId,\n                                    command,\n                                    position);\n        verify(workbenchMenuStandardNavBarView)\n                .addContextMenuItem(menuItemId,\n                                    menuId,\n                                    label,\n                                    menuParentId,\n                                    command,\n                                    position);\n    }\n\n    @Test\n    public void testAddContextGroupMenuItem() {\n        final String menuItemId = RandomStringUtils.random(10);\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.LEFT;\n\n        workbenchMenuBarView.addContextGroupMenuItem(menuItemId,\n                                                     menuId,\n                                                     label,\n                                                     position);\n\n        verify(workbenchMenuCompactNavBarView).addContextGroupMenuItem(menuItemId,\n                                                                       menuId,\n                                                                       label,\n                                                                       position);\n        verify(workbenchMenuStandardNavBarView).addContextGroupMenuItem(menuItemId,\n                                                                        menuId,\n                                                                        label,\n                                                                        position);\n    }\n\n    @Test\n    public void testSelectMenu() {\n        final String menuId = RandomStringUtils.random(10);\n        workbenchMenuBarView.selectMenuItem(menuId);\n\n        verify(workbenchMenuCompactNavBarView).selectMenuItem(menuId);\n        verify(workbenchMenuStandardNavBarView).selectMenuItem(menuId);\n    }\n\n    @Test\n    public void testClear() {\n        workbenchMenuBarView.clear();\n\n        verify(workbenchMenuCompactNavBarView).clear();\n        verify(workbenchMenuStandardNavBarView).clear();\n        verify(utilityMenuBarView).clear();\n    }\n\n    @Test\n    public void testEnableMenu() {\n        final String menuId = RandomStringUtils.random(10);\n        workbenchMenuBarView.enableMenuItem(menuId,\n                                            true);\n\n        verify(workbenchMenuCompactNavBarView).enableMenuItem(menuId,\n                                                              true);\n        verify(workbenchMenuStandardNavBarView).enableMenuItem(menuId,\n                                                               true);\n    }\n\n    @Test\n    public void testDisableMenu() {\n        final String menuId = RandomStringUtils.random(10);\n        workbenchMenuBarView.enableMenuItem(menuId,\n                                            false);\n\n        verify(workbenchMenuCompactNavBarView).enableMenuItem(menuId,\n                                                              false);\n        verify(workbenchMenuStandardNavBarView).enableMenuItem(menuId,\n                                                               false);\n    }\n\n    @Test\n    public void testEnableContextMenu() {\n        final String menuId = RandomStringUtils.random(10);\n        workbenchMenuBarView.enableContextMenuItem(menuId,\n                                                   true);\n\n        verify(workbenchMenuCompactNavBarView).enableContextMenuItem(menuId,\n                                                                     true);\n        verify(workbenchMenuStandardNavBarView).enableContextMenuItem(menuId,\n                                                                      true);\n    }\n\n    @Test\n    public void testDisableContextMenu() {\n        final String menuId = RandomStringUtils.random(10);\n        workbenchMenuBarView.enableContextMenuItem(menuId,\n                                                   false);\n\n        verify(workbenchMenuCompactNavBarView).enableContextMenuItem(menuId,\n                                                                     false);\n        verify(workbenchMenuStandardNavBarView).enableContextMenuItem(menuId,\n                                                                      false);\n    }\n\n    @Test\n    public void testClearContextMenu() {\n        workbenchMenuBarView.clearContextMenu();\n\n        verify(workbenchMenuCompactNavBarView).clearContextMenu();\n        verify(workbenchMenuStandardNavBarView).clearContextMenu();\n    }\n\n    @Test\n    public void testExpand() {\n        when(navBarCollapse.isHidden()).thenReturn(true,\n                                                   false);\n\n        workbenchMenuBarView.expand();\n        workbenchMenuBarView.expand();\n\n        verify(navBarCollapse).show();\n        verify(navBarCollapse,\n               never()).hide();\n    }\n\n    @Test\n    public void testCollapse() {\n        when(navBarCollapse.isShown()).thenReturn(true,\n                                                  false);\n\n        workbenchMenuBarView.collapse();\n        workbenchMenuBarView.collapse();\n\n        verify(navBarCollapse).hide();\n        verify(navBarCollapse,\n               never()).show();\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuCompactNavBarViewTest.java",
    "content": "/*\n *\n *  * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.Collections;\n\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.gwtbootstrap3.client.ui.AnchorButton;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownHeader;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.ListDropDown;\nimport org.gwtbootstrap3.client.ui.NavbarNav;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchMenuCompactNavBarViewTest {\n\n    @InjectMocks\n    WorkbenchMenuCompactNavBarView workbenchMenuCompactNavBarView;\n\n    @GwtMock\n    NavbarNav navbarNav;\n\n    @GwtMock\n    AnchorListItem anchorListItem;\n\n    @GwtMock\n    ListDropDown listDropDown;\n\n    @GwtMock\n    AnchorButton anchorButton;\n\n    @GwtMock\n    DropDownMenu dropDownMenu;\n\n    @GwtMock\n    DropDownHeader dropDownHeader;\n\n    @GwtMock\n    Text text;\n\n    @Test\n    public void testAddMenuItem() {\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = null;\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = mock(Command.class);\n\n        workbenchMenuCompactNavBarView.addMenuItem(menuId,\n                                                   label,\n                                                   menuParentId,\n                                                   command,\n                                                   position);\n\n        verify(dropDownMenu).add(anchorListItem);\n        verify(anchorListItem).setText(label);\n        assertEquals(anchorListItem,\n                     workbenchMenuCompactNavBarView.getMenuItemWidgetMap().get(menuId));\n    }\n\n    @Test\n    public void testAddGroupMenuItem() {\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuCompactNavBarView.addGroupMenuItem(menuId,\n                                                        label,\n                                                        position);\n\n        verify(dropDownMenu).add(dropDownHeader);\n        verify(dropDownHeader).setText(label);\n    }\n\n    @Test\n    public void testAddContextMenuItem() {\n        final String menuItemId = \"menuItemId\";\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = mock(Command.class);\n\n        workbenchMenuCompactNavBarView.addContextMenuItem(menuItemId,\n                                                          menuId,\n                                                          label,\n                                                          menuParentId,\n                                                          command,\n                                                          position);\n\n        verify(anchorListItem).setText(label);\n        assertEquals(anchorListItem,\n                     workbenchMenuCompactNavBarView.getMenuItemContextWidgetMap().get(menuId));\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextMenus().containsValue(anchorListItem));\n    }\n\n    @Test\n    public void testAddContextGroupMenuItem() {\n        final String menuItemId = \"menuItemId\";\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuCompactNavBarView.addContextGroupMenuItem(menuItemId,\n                                                               menuId,\n                                                               label,\n                                                               position);\n\n        verify(anchorButton).setText(label);\n        verify(listDropDown).add(anchorButton);\n        assertEquals(dropDownMenu,\n                     workbenchMenuCompactNavBarView.getMenuItemContextWidgetMap().get(menuId));\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextMenus().containsValue(listDropDown));\n    }\n\n    @Test\n    public void testSelectElement() {\n        final ComplexPanel panel = mock(ComplexPanel.class);\n        final ComplexPanel panelActive = mock(ComplexPanel.class);\n\n        when(dropDownMenu.iterator()).thenReturn(Collections.<Widget>singletonList(panel).iterator());\n\n        workbenchMenuCompactNavBarView.selectElement(panelActive);\n\n        verify(panelActive).addStyleName(Styles.ACTIVE);\n        verify(panel).removeStyleName(Styles.ACTIVE);\n    }\n\n    @Test\n    public void testSelectMenuItemNoMenu() {\n        final String menuId = \"menuId\";\n\n        workbenchMenuCompactNavBarView.addContextMenuItem(menuId,\n                                                          \"contextMenuId\",\n                                                          \"labelContext\",\n                                                          null,\n                                                          null,\n                                                          null);\n        workbenchMenuCompactNavBarView.selectMenuItem(menuId);\n\n        verify(navbarNav).add(anchorListItem);\n        verify(text).setText(\"\");\n    }\n\n    @Test\n    public void testSelectMenuItem() {\n        final String menuId = \"menuId\";\n        final String label = \"label\";\n        final String labelContext = \"labelContext\";\n        when(dropDownMenu.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());\n\n        workbenchMenuCompactNavBarView.addContextMenuItem(menuId,\n                                                          \"contextMenuId\",\n                                                          labelContext,\n                                                          null,\n                                                          null,\n                                                          null);\n        workbenchMenuCompactNavBarView.addMenuItem(menuId,\n                                                   label,\n                                                   null,\n                                                   null,\n                                                   null);\n        workbenchMenuCompactNavBarView.selectMenuItem(menuId);\n\n        verify(navbarNav).add(anchorListItem);\n        verify(text).setText(label);\n        verify(anchorListItem).setText(labelContext);\n        verify(anchorListItem).setText(label);\n        verify(dropDownMenu).add(anchorListItem);\n    }\n\n    @Test\n    public void testClearContextMenu() {\n        final String menuId = \"menuId\";\n\n        workbenchMenuCompactNavBarView.addContextMenuItem(menuId,\n                                                          \"contextMenuItemId\",\n                                                          \"labelContextMenu\",\n                                                          null,\n                                                          null,\n                                                          null);\n        workbenchMenuCompactNavBarView.addContextGroupMenuItem(menuId,\n                                                               \"contextGroupMenuId\",\n                                                               \"labelContextGroup\",\n                                                               null);\n        workbenchMenuCompactNavBarView.clearContextMenu();\n\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextMenus().isEmpty());\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextWidgetMap().isEmpty());\n        verify(anchorListItem,\n               times(2)).clear();\n        verify(anchorListItem,\n               times(2)).removeFromParent();\n        verify(listDropDown).clear();\n        verify(listDropDown).removeFromParent();\n    }\n\n    @Test\n    public void testClear() {\n        workbenchMenuCompactNavBarView.getMenuItemContextMenus().put(\"key\",\n                                                                     mock(ComplexPanel.class));\n        workbenchMenuCompactNavBarView.getMenuItemContextWidgetMap().put(\"key\",\n                                                                         mock(ComplexPanel.class));\n\n        workbenchMenuCompactNavBarView.clear();\n\n        verify(navbarNav).clear();\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextMenus().isEmpty());\n        assertTrue(workbenchMenuCompactNavBarView.getMenuItemContextWidgetMap().isEmpty());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/menu/WorkbenchMenuStandardNavBarViewTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.menu;\n\nimport java.util.Collections;\n\nimport com.google.gwt.core.client.GWT;\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.ComplexPanel;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.apache.commons.lang3.RandomStringUtils;\nimport org.gwtbootstrap3.client.ui.Anchor;\nimport org.gwtbootstrap3.client.ui.AnchorListItem;\nimport org.gwtbootstrap3.client.ui.DropDownMenu;\nimport org.gwtbootstrap3.client.ui.ListDropDown;\nimport org.gwtbootstrap3.client.ui.ListItem;\nimport org.gwtbootstrap3.client.ui.NavbarNav;\nimport org.gwtbootstrap3.client.ui.base.AbstractListItem;\nimport org.gwtbootstrap3.client.ui.constants.Pull;\nimport org.gwtbootstrap3.client.ui.constants.Styles;\nimport org.gwtbootstrap3.client.ui.html.UnorderedList;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.workbench.model.menu.MenuPosition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class WorkbenchMenuStandardNavBarViewTest {\n\n    @GwtMock\n    NavbarNav navbarNav;\n    @GwtMock\n    ListItem listItem;\n    @GwtMock\n    AnchorListItem anchorListItem;\n    @GwtMock\n    ListDropDown listDropDown;\n    @GwtMock\n    Anchor anchor;\n    @GwtMock\n    DropDownMenu dropDownMenu;\n    @GwtMock\n    UnorderedList unorderedList;\n    private WorkbenchMenuStandardNavBarView workbenchMenuStandardNavBarView;\n\n    @Before\n    public void setup() {\n        workbenchMenuStandardNavBarView = spy(WorkbenchMenuStandardNavBarView.class);\n\n        workbenchMenuStandardNavBarView.getMenuItemWidgetMap().put(\"menuItemId\",\n                                                                   spy(ComplexPanel.class));\n    }\n\n    @Test\n    public void testAddMenuItemWithoutParent() {\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = null;\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = mock(Command.class);\n\n        workbenchMenuStandardNavBarView.addMenuItem(menuId,\n                                                    label,\n                                                    menuParentId,\n                                                    command,\n                                                    position);\n\n        verify(workbenchMenuStandardNavBarView).positionMenuItem(any(AbstractListItem.class),\n                                                                 eq(position));\n    }\n\n    @Test\n    public void testAddMenuItemWithParent() {\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = mock(Command.class);\n\n        workbenchMenuStandardNavBarView.addMenuItem(menuId,\n                                                    label,\n                                                    menuParentId,\n                                                    command,\n                                                    position);\n\n        verify(workbenchMenuStandardNavBarView,\n               never()).positionMenuItem(any(AbstractListItem.class),\n                                         eq(position));\n    }\n\n    @Test\n    public void testAddCustomMenuItem() {\n        final Widget menu = GWT.create(Widget.class);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuStandardNavBarView.addCustomMenuItem(menu,\n                                                          position);\n\n        verify(workbenchMenuStandardNavBarView).positionMenuItem(any(Widget.class),\n                                                                 eq(position));\n    }\n\n    @Test\n    public void testAddGroupMenuItem() {\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuStandardNavBarView.addGroupMenuItem(menuId,\n                                                         label,\n                                                         position);\n\n        verify(workbenchMenuStandardNavBarView).positionMenuItem(any(AbstractListItem.class),\n                                                                 eq(position));\n    }\n\n    @Test\n    public void testAddContextMenuItem() {\n        final String menuItemId = \"menuItemId\";\n        final String menuId = RandomStringUtils.random(10);\n        final String menuParentId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n        final Command command = mock(Command.class);\n\n        workbenchMenuStandardNavBarView.addContextMenuItem(menuItemId,\n                                                           menuId,\n                                                           label,\n                                                           menuParentId,\n                                                           command,\n                                                           position);\n\n        verify(workbenchMenuStandardNavBarView).positionMenuItem(any(AbstractListItem.class),\n                                                                 eq(position));\n        verify(anchorListItem).setText(label);\n        assertEquals(anchorListItem,\n                     workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().get(menuId));\n    }\n\n    @Test\n    public void testAddContextGroupMenuItem() {\n        final String menuItemId = \"menuItemId\";\n        final String menuId = RandomStringUtils.random(10);\n        final String label = RandomStringUtils.random(10);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuStandardNavBarView.addContextGroupMenuItem(menuItemId,\n                                                                menuId,\n                                                                label,\n                                                                position);\n\n        verify(workbenchMenuStandardNavBarView).positionMenuItem(any(AbstractListItem.class),\n                                                                 eq(position));\n        verify(anchor).setText(label);\n        verify(listDropDown).add(anchor);\n        assertEquals(dropDownMenu,\n                     workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().get(menuId));\n    }\n\n    @Test\n    public void testPositionAbstractListItemOnLeft() {\n        final AbstractListItem menuItem = mock(AbstractListItem.class);\n        final MenuPosition position = MenuPosition.LEFT;\n\n        workbenchMenuStandardNavBarView.positionMenuItem(menuItem,\n                                                         position);\n\n        verify(menuItem,\n               never()).setPull(Pull.RIGHT);\n    }\n\n    @Test\n    public void testPositionAbstractListItemOnRight() {\n        final AbstractListItem menuItem = mock(AbstractListItem.class);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        workbenchMenuStandardNavBarView.positionMenuItem(menuItem,\n                                                         position);\n\n        verify(menuItem).setPull(Pull.RIGHT);\n    }\n\n    @Test\n    public void testPositionWidgetOnLeft() {\n        final Widget menuItem = spy(Widget.class);\n        final MenuPosition position = MenuPosition.LEFT;\n\n        workbenchMenuStandardNavBarView.positionMenuItem(menuItem,\n                                                         position);\n\n        verify(menuItem.getElement().getStyle(),\n               never()).setFloat(Style.Float.RIGHT);\n    }\n\n    @Test\n    public void testPositionWidgetOnRight() {\n        final Widget menuItem = spy(Widget.class);\n        final MenuPosition position = MenuPosition.RIGHT;\n\n        when(menuItem.getElement()).thenReturn(spy(Element.class));\n        when(menuItem.getElement().getStyle()).thenReturn(spy(Style.class));\n\n        workbenchMenuStandardNavBarView.positionMenuItem(menuItem,\n                                                         position);\n\n        verify(menuItem.getElement().getStyle()).setFloat(Style.Float.RIGHT);\n    }\n\n    @Test\n    public void testSelectElement() {\n        final ListDropDown parent1 = mock(ListDropDown.class);\n        final Widget parent2 = mock(Widget.class);\n        final ComplexPanel panel = mock(ComplexPanel.class);\n\n        when(navbarNav.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());\n        when(panel.getParent()).thenReturn(parent2);\n        when(parent2.getParent()).thenReturn(parent1);\n\n        workbenchMenuStandardNavBarView.selectElement(panel);\n\n        verify(panel).addStyleName(Styles.ACTIVE);\n        verify(parent1).addStyleName(Styles.ACTIVE);\n    }\n\n    @Test\n    public void testSelectMenuItemNoMenu() {\n        final String menuId = \"menuId\";\n        when(navbarNav.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());\n        when(listItem.getParent()).thenReturn(mock(Widget.class));\n\n        workbenchMenuStandardNavBarView.selectMenuItem(menuId);\n\n        verify(navbarNav).add(listItem);\n    }\n\n    @Test\n    public void testSelectMenuItem() {\n        final String menuId = \"menuId\";\n        final String label = \"label\";\n        when(navbarNav.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());\n        when(anchorListItem.getParent()).thenReturn(mock(Widget.class));\n        final Widget ulParent = mock(Widget.class);\n        when(unorderedList.getParent()).thenReturn(ulParent);\n\n        workbenchMenuStandardNavBarView.addContextMenuItem(menuId,\n                                                           \"contextMenuId\",\n                                                           \"labelContext\",\n                                                           null,\n                                                           null,\n                                                           null);\n        workbenchMenuStandardNavBarView.addMenuItem(menuId,\n                                                    label,\n                                                    null,\n                                                    null,\n                                                    null);\n        workbenchMenuStandardNavBarView.selectMenuItem(menuId);\n\n        verify(navbarNav).add(anchorListItem);\n        verify(anchorListItem).setText(label);\n        verify(unorderedList).setVisible(true);\n        verify(ulParent).addStyleName(WorkbenchMenuNavBarView.UF_PERSPECTIVE_CONTEXT_MENU_CONTAINER);\n    }\n\n    @Test\n    public void testClearContextMenu() {\n        final String menuId = \"menuId\";\n        when(navbarNav.iterator()).thenReturn(Collections.<Widget>emptyList().iterator());\n        when(listItem.getParent()).thenReturn(mock(Widget.class));\n\n        workbenchMenuStandardNavBarView.addContextMenuItem(menuId,\n                                                           \"contextMenuItemId\",\n                                                           \"labelContextMenu\",\n                                                           null,\n                                                           null,\n                                                           null);\n        workbenchMenuStandardNavBarView.addContextGroupMenuItem(menuId,\n                                                                \"contextGroupMenuId\",\n                                                                \"labelContextGroup\",\n                                                                null);\n        workbenchMenuStandardNavBarView.clearContextMenu();\n\n        assertTrue(workbenchMenuStandardNavBarView.getContextContainerWidgetMap().isEmpty());\n        assertTrue(workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().isEmpty());\n        verify(anchorListItem).clear();\n        verify(anchorListItem).removeFromParent();\n        verify(dropDownMenu).clear();\n        verify(dropDownMenu).removeFromParent();\n    }\n\n    @Test\n    public void testClear() {\n        workbenchMenuStandardNavBarView.getContextContainerWidgetMap().put(\"key\",\n                                                                           mock(ComplexPanel.class));\n        workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().put(\"key\",\n                                                                          mock(ComplexPanel.class));\n\n        workbenchMenuStandardNavBarView.clear();\n\n        verify(navbarNav).clear();\n        assertTrue(workbenchMenuStandardNavBarView.getContextContainerWidgetMap().isEmpty());\n        assertTrue(workbenchMenuStandardNavBarView.getMenuItemContextWidgetMap().isEmpty());\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/mock/CountingTabShowHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.mock;\n\nimport org.gwtbootstrap3.client.shared.event.TabShowEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\n\npublic class CountingTabShowHandler implements TabShowHandler {\n\n    private int eventCount;\n\n    @Override\n    public void onShow(TabShowEvent event) {\n        this.eventCount++;\n    }\n\n    public int getEventCount() {\n        return eventCount;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/mock/CountingTabShownHandler.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.mock;\n\nimport org.gwtbootstrap3.client.shared.event.TabShownEvent;\nimport org.gwtbootstrap3.client.shared.event.TabShownHandler;\n\npublic class CountingTabShownHandler implements TabShownHandler {\n\n    private int eventCount;\n\n    @Override\n    public void onShown(TabShownEvent event) {\n        this.eventCount++;\n    }\n\n    public int getEventCount() {\n        return eventCount;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/mock/MockPartView.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.mock;\n\nimport javax.enterprise.inject.Alternative;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter.View;\n\n@Alternative\npublic class MockPartView implements View {\n\n    @Override\n    public void init(WorkbenchPartPresenter presenter) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public Widget asWidget() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void onResize() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public WorkbenchPartPresenter getPresenter() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public IsWidget getWrappedWidget() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void setWrappedWidget(IsWidget widget) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/mock/MockPlaceManager.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.mock;\n\nimport java.util.Collection;\nimport java.util.List;\nimport javax.enterprise.inject.Alternative;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.mvp.Activity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.PlaceStatus;\nimport org.uberfire.client.mvp.SplashScreenActivity;\nimport org.uberfire.mvp.BiParameterizedCommand;\nimport org.uberfire.mvp.Command;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.PathPlaceRequest;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\nimport org.uberfire.workbench.type.ResourceTypeDefinition;\n\n@Alternative\npublic class MockPlaceManager implements PlaceManager {\n\n    @Override\n    public void goTo(String identifier) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(Path path) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(Path path,\n                     PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PartDefinition part,\n                     PanelDefinition panel) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(String identifier,\n                     PanelDefinition panel) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     PanelDefinition panel) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(Path path,\n                     PanelDefinition panel) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(Path path,\n                     PlaceRequest place,\n                     PanelDefinition panel) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HasWidgets addTo) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(String id,\n                     HTMLElement addTo) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     HTMLElement addTo) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void goTo(PlaceRequest place,\n                     elemental2.dom.HTMLElement addTo) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public Activity getActivity(PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public PlaceStatus getStatus(String id) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public PlaceStatus getStatus(PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void closePlace(String id) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void closePlace(PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void closePlace(PlaceRequest placeToClose,\n                           Command doAfterClose) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void tryClosePlace(PlaceRequest placeToClose,\n                              Command onAfterClose) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void forceClosePlace(String id) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void forceClosePlace(PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void closeAllPlaces() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void forceCloseAllPlaces() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public boolean closeAllPlacesOrNothing() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public boolean canClosePlace(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public boolean canCloseAllPlaces() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public List<PlaceRequest> getUncloseablePlaces() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void registerOnOpenCallback(final PlaceRequest place,\n                                       final Command callback) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void unregisterOnOpenCallbacks(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void registerOnCloseCallback(final PlaceRequest place,\n                                        final Command callback) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void unregisterOnCloseCallbacks(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void registerPerspectiveCloseChain(final String perspectiveIdentifier,\n                                              final BiParameterizedCommand<Command, PlaceRequest> closeChain) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public void executeOnOpenCallbacks(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public Collection<SplashScreenActivity> getActiveSplashScreens() {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public Collection<PathPlaceRequest> getActivitiesForResourceType(final ResourceTypeDefinition type) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public List<Command> getOnOpenCallbacks(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n\n    @Override\n    public List<Command> getOnCloseCallbacks(final PlaceRequest place) {\n        throw new UnsupportedOperationException(\"Not implemented.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/modal/Bs3ModalTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.modal;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport com.google.gwtmockito.WithClassesToStub;\nimport org.gwtbootstrap3.client.ui.constants.ModalBackdrop;\nimport org.gwtbootstrap3.client.ui.html.Text;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Spy;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\n@WithClassesToStub(Text.class)\npublic class Bs3ModalTest {\n\n    @Spy\n    Bs3Modal modal;\n\n    @Test\n    public void testDefaultSettings() {\n        modal.setup();\n\n        verify(modal).setDataBackdrop(ModalBackdrop.STATIC);\n        verify(modal).setFade(true);\n        verify(modal).setId(anyString());\n        verify(modal).setRemoveOnHide(true);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/multipage/MultiPageEditorImplTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.widgets.multipage.Page;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiPageEditorImplTest {\n\n    @Mock\n    private MultiPageEditorViewImpl view;\n\n    @Mock\n    private EventSourceMock<MultiPageEditorSelectedPageEvent> selectedPageEvent;\n\n    @InjectMocks\n    private MultiPageEditorImpl editor = spy(new MultiPageEditorImpl());\n\n    @Test\n    public void testInit() {\n        editor.init();\n        verify(view).enableSelectedPageEvent(selectedPageEvent);\n    }\n\n    @Test\n    public void testAddPageWithIndex() {\n\n        final Page page = mock(Page.class);\n        final int index = 1;\n\n        editor.addPage(index, page);\n\n        verify(view).addPage(index, page);\n    }\n\n    @Test\n    public void testDisablePage() {\n\n        final int index = 1;\n\n        editor.disablePage(index);\n\n        verify(view).disablePage(index);\n    }\n\n    @Test\n    public void testEnablePage() {\n\n        final int index = 1;\n\n        editor.enablePage(index);\n\n        verify(view).enablePage(index);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/multipage/MultiPageEditorViewImplTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multipage;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.assertj.core.api.Assertions;\nimport org.gwtbootstrap3.client.shared.event.TabShownEvent;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabListItem;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.ArgumentCaptor;\nimport org.mockito.Captor;\nimport org.mockito.Mock;\nimport org.uberfire.client.views.pfly.tab.TabPanelEntry;\nimport org.uberfire.client.workbench.widgets.multipage.Page;\nimport org.uberfire.client.workbench.widgets.multipage.PageView;\nimport org.uberfire.mocks.EventSourceMock;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.any;\nimport static org.mockito.Mockito.anyInt;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.never;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiPageEditorViewImplTest {\n\n    @Mock\n    private Page page;\n\n    @Mock\n    private TabPanelEntry tab;\n\n    @Mock\n    private EventSourceMock<MultiPageEditorSelectedPageEvent> selectedPageEvent;\n\n    @Captor\n    private ArgumentCaptor<MultiPageEditorSelectedPageEvent> pageEvent;\n\n    private MultiPageEditorViewImpl view;\n\n    @Before\n    public void setup() {\n        view = spy(new MultiPageEditorViewImpl());\n        view.init();\n    }\n\n    @Test\n    public void testAddPage() {\n\n        doReturn(tab).when(view).makeTabPanelEntry(page);\n        doNothing().when(view).addItem(any());\n        doNothing().when(view).setAsActive(any());\n\n        view.addPage(page);\n\n        verify(view).addItem(tab);\n        verify(view).setAsActive(tab);\n    }\n\n    @Test\n    public void testAddPageWithIndex() {\n\n        final int index = 1;\n\n        doReturn(tab).when(view).makeTabPanelEntry(page);\n        doNothing().when(view).insertItem(any(), anyInt());\n        doNothing().when(view).setAsActive(any());\n\n        view.addPage(index, page);\n\n        verify(view).insertItem(tab, index);\n        verify(view).setAsActive(tab);\n    }\n\n    @Test\n    public void testMakeTabPanelEntry() {\n\n        final String title = \"\";\n        final PageView pageView = mock(PageView.class);\n        final Widget widget = mock(Widget.class);\n\n        doReturn(title).when(page).getLabel();\n        doReturn(pageView).when(page).getView();\n        doReturn(widget).when(pageView).asWidget();\n\n        final TabPanelEntry tabPanelEntry = view.makeTabPanelEntry(page);\n\n        assertEquals(title, tabPanelEntry.getTitle());\n        assertEquals(widget, tabPanelEntry.getContents());\n    }\n\n    @Test\n    public void testSetAsActiveWhenActiveTabIsNull() {\n\n        doReturn(null).when(view).getActiveTab();\n\n        view.setAsActive(tab);\n\n        verify(tab).showTab();\n        verify(tab).setActive(true);\n    }\n\n    @Test\n    public void testSetAsActiveWhenActiveTabIsNotNull() {\n\n        doReturn(mock(TabPanelEntry.class)).when(view).getActiveTab();\n\n        view.setAsActive(tab);\n\n        verify(tab, never()).showTab();\n        verify(tab, never()).setActive(true);\n    }\n\n    @Test\n    public void testDisablePage() {\n\n        final int index = 1;\n        final Widget widget = mock(Widget.class);\n        final NavTabs navTabs = mock(NavTabs.class);\n        final Element element = mock(Element.class);\n        final Style style = mock(Style.class);\n\n        doReturn(navTabs).when(view).getTabBar();\n        doReturn(widget).when(navTabs).getWidget(index);\n        doReturn(element).when(widget).getElement();\n        doReturn(style).when(element).getStyle();\n        doReturn(true).when(view).isValid(anyInt());\n\n        view.disablePage(index);\n\n        verify(widget).addStyleName(\"disabled\");\n        verify(style).setProperty(\"pointerEvents\", \"none\");\n    }\n\n    @Test\n    public void testEnablePage() {\n\n        final int index = 1;\n        final Widget widget = mock(Widget.class);\n        final NavTabs navTabs = mock(NavTabs.class);\n        final Element element = mock(Element.class);\n        final Style style = mock(Style.class);\n\n        doReturn(navTabs).when(view).getTabBar();\n        doReturn(widget).when(navTabs).getWidget(index);\n        doReturn(element).when(widget).getElement();\n        doReturn(style).when(element).getStyle();\n        doReturn(true).when(view).isValid(anyInt());\n\n        view.enablePage(index);\n\n        verify(widget).removeStyleName(\"disabled\");\n        verify(style).clearProperty(\"pointerEvents\");\n    }\n\n    @Test\n    public void testGetTabShownHandler() {\n\n        final TabListItem tab = mock(TabListItem.class);\n        final TabShownEvent event = mock(TabShownEvent.class);\n        final TabPanelEntry tabPanelEntry = mock(TabPanelEntry.class);\n        final TabPane tabPane = mock(TabPane.class);\n        final PageViewImpl page = mock(PageViewImpl.class);\n        final int pageIndex = 42;\n\n        when(event.getTab()).thenReturn(tab);\n        when(tabPanelEntry.getContentPane()).thenReturn(tabPane);\n        when(tabPane.getWidget(0)).thenReturn(page);\n        when(tab.getTabIndex()).thenReturn(pageIndex);\n        doReturn(tabPanelEntry).when(view).findEntryForTabWidget(tab);\n\n        view.enableSelectedPageEvent(selectedPageEvent);\n\n        view.getTabShownHandler().onShown(event);\n\n        verify(view).onResize();\n        verify(selectedPageEvent).fire(pageEvent.capture());\n        verify(page).onLostFocus();\n        assertEquals(pageIndex, pageEvent.getValue().getSelectedPage());\n    }\n\n    @Test\n    public void testGetPageIndex() {\n        final NavTabs navTabs = mock(NavTabs.class);\n        doReturn(navTabs).when(view).getTabBar();\n\n        final TabListItem pageOne = mock(TabListItem.class);\n        final TabListItem pageTwo = mock(TabListItem.class);\n        final TabListItem pageThree = mock(TabListItem.class);\n\n        doReturn(3).when(navTabs).getWidgetCount();\n        doReturn(pageOne).when(navTabs).getWidget(0);\n        doReturn(pageTwo).when(navTabs).getWidget(1);\n        doReturn(pageThree).when(navTabs).getWidget(2);\n\n        doReturn(\"page 1\").when(pageOne).getText();\n        doReturn(\"page 2\").when(pageTwo).getText();\n        doReturn(\"page 3\").when(pageThree).getText();\n\n        Assertions.assertThat(view.getPageIndex(\"page 3\")).isEqualTo(2);\n        Assertions.assertThat(view.getPageIndex(\"page 2\")).isEqualTo(1);\n        Assertions.assertThat(view.getPageIndex(\"page 1\")).isEqualTo(0);\n\n        Assertions.assertThatThrownBy(() -> view.getPageIndex(\"xyz\"))\n                .hasMessage(\"Page with title: 'xyz' doesn't exist.\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenMenuBuilderTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multiscreen;\n\nimport java.util.Optional;\n\nimport elemental2.dom.HTMLButtonElement;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport elemental2.dom.HTMLElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.jboss.errai.security.shared.api.identity.User;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.client.views.pfly.widgets.Button;\nimport org.uberfire.client.views.pfly.widgets.KebabMenu;\nimport org.uberfire.client.views.pfly.widgets.KebabMenuItem;\nimport org.uberfire.security.Resource;\nimport org.uberfire.security.authz.AuthorizationManager;\nimport org.uberfire.workbench.model.menu.MenuCustom;\nimport org.uberfire.workbench.model.menu.MenuGroup;\nimport org.uberfire.workbench.model.menu.MenuItem;\nimport org.uberfire.workbench.model.menu.MenuItemCommand;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class MultiScreenMenuBuilderTest {\n\n    @Mock\n    AuthorizationManager authManager;\n\n    @Mock\n    User identity;\n\n    @Mock\n    HTMLDocument document;\n\n    @Mock\n    ManagedInstance<KebabMenu> kebabMenus;\n\n    @Mock\n    ManagedInstance<KebabMenuItem> kebabMenuItems;\n\n    @Mock\n    ManagedInstance<Button> buttons;\n\n    @InjectMocks\n    MultiScreenMenuBuilder menuBuilder;\n\n    @Before\n    public void setup() {\n        when(authManager.authorize(any(Resource.class),\n                                   eq(identity))).thenReturn(true);\n        final Button button = mock(Button.class);\n        when(button.getElement()).thenReturn(mock(HTMLButtonElement.class));\n        when(buttons.get()).thenReturn(button);\n        when(kebabMenus.get()).thenReturn(mock(KebabMenu.class));\n    }\n\n    @Test\n    public void testDeniedPermission() {\n        final MenuItem menuItem = mock(MenuItem.class);\n\n        when(authManager.authorize(any(Resource.class),\n                                   eq(identity))).thenReturn(false);\n\n        final Optional<HTMLElement> optional = menuBuilder.apply(menuItem);\n\n        assertFalse(optional.isPresent());\n        verify(authManager).authorize(menuItem,\n                                      identity);\n        verifyZeroInteractions(kebabMenus,\n                               document);\n    }\n\n    @Test\n    public void testAllowedPermission() {\n        final MenuItem menuItem = mock(MenuItem.class);\n\n        when(authManager.authorize(any(Resource.class),\n                                   eq(identity))).thenReturn(false);\n        when(authManager.authorize(menuItem,\n                                   identity)).thenReturn(true);\n\n        final Optional<HTMLElement> optional = menuBuilder.apply(menuItem);\n\n        assertFalse(optional.isPresent());\n        verify(authManager).authorize(menuItem,\n                                      identity);\n        verifyZeroInteractions(kebabMenus,\n                               document);\n    }\n\n    @Test\n    public void testMenuItemCommand() {\n        final MenuItemCommand menuItem = mock(MenuItemCommand.class);\n\n        final Optional<HTMLElement> optional = menuBuilder.apply(menuItem);\n\n        assertTrue(optional.isPresent());\n        verify(buttons).get();\n        verifyZeroInteractions(kebabMenus);\n    }\n\n    @Test\n    public void testMenuGroup() {\n        final KebabMenu kebabMenu = mock(KebabMenu.class);\n        when(kebabMenu.getElement()).thenReturn(mock(HTMLDivElement.class));\n        when(kebabMenus.get()).thenReturn(kebabMenu);\n\n        final MenuGroup menuItem = mock(MenuGroup.class);\n\n        final Optional<HTMLElement> optional = menuBuilder.apply(menuItem);\n\n        assertTrue(optional.isPresent());\n        verify(kebabMenus).get();\n        verifyZeroInteractions(document);\n    }\n\n    @Test\n    public void testMenuCustom() {\n        final MenuCustom menuItem = mock(MenuCustom.class);\n        when(menuItem.build()).thenReturn(mock(HTMLElement.class));\n\n        final Optional<HTMLElement> optional = menuBuilder.apply(menuItem);\n\n        assertTrue(optional.isPresent());\n        verify(menuItem).build();\n        verifyZeroInteractions(kebabMenus,\n                               document);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenPartWidgetTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.multiscreen;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport elemental2.dom.HTMLDivElement;\nimport org.jboss.errai.ioc.client.api.ManagedInstance;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.invocation.InvocationOnMock;\nimport org.mockito.stubbing.Answer;\nimport org.uberfire.client.workbench.part.WorkbenchPartPresenter;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.PartDefinition;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiScreenPartWidgetTest {\n\n    @Mock\n    HTMLDivElement content;\n\n    @Mock\n    MultiScreenView multiScreenView;\n\n    @Mock\n    ManagedInstance<MultiScreenView> multiScreenViews;\n\n    @Mock\n    WorkbenchPartPresenter.View view;\n\n    @Mock\n    PartDefinition partDefinition;\n\n    @InjectMocks\n    MultiScreenPartWidget widget;\n\n    @Before\n    public void setup() {\n        when(multiScreenViews.get()).thenReturn(multiScreenView);\n        final WorkbenchPartPresenter presenter = mock(WorkbenchPartPresenter.class);\n        doAnswer(invocationOnMock -> {\n            invocationOnMock.getArgument(0, Consumer.class).accept(null);\n            return null;\n        }).when(presenter).getMenus(any());\n        when(view.getPresenter()).thenReturn(presenter);\n        when(partDefinition.getParentPanel()).thenReturn(mock(PanelDefinition.class));\n        when(presenter.getDefinition()).thenReturn(partDefinition);\n    }\n\n    @Test\n    public void testInvalidRemovePart() {\n        boolean removed = widget.remove(partDefinition);\n        assertFalse(removed);\n    }\n\n    @Test\n    public void testInvalidChangeTitle() {\n        widget.changeTitle(partDefinition,\n                           null,\n                           null);\n    }\n\n    @Test\n    public void testInvalidSelectPart() {\n        boolean selected = widget.selectPart(partDefinition);\n        assertFalse(selected);\n    }\n\n    @Test\n    public void testChangeTitle() {\n        String title = \"newTitle\";\n        IsWidget titleWidget = mock(IsWidget.class);\n\n        widget.addPart(view);\n\n        widget.changeTitle(partDefinition,\n                           title,\n                           titleWidget);\n\n        verify(multiScreenView).setTitle(title);\n        verify(multiScreenView).setTitleWidget(titleWidget);\n    }\n\n    @Test\n    public void testSelectPart() {\n        widget.addPart(view);\n\n        boolean selected = widget.selectPart(partDefinition);\n\n        verify(multiScreenView, times(2)).show();\n        assertTrue(selected);\n    }\n\n    @Test\n    public void testAddRemovePart() {\n        widget.addPart(view);\n\n        verify(multiScreenView).setTitle(any());\n        verify(multiScreenView,\n               never()).setTitleWidget(any());\n        verify(multiScreenView).setCloseHandler(any());\n        verify(multiScreenView).disableClose();\n        verify(multiScreenView).show();\n        verify(content).appendChild(any());\n\n        boolean removed = widget.remove(partDefinition);\n\n        assertTrue(removed);\n    }\n\n    @Test\n    public void testOnResize(){\n        when(multiScreenView.isVisible()).thenReturn(true, false);\n\n        widget.addPart(view);\n\n        widget.onResize();\n        widget.onResize();\n\n        verify(multiScreenView, times(2)).isVisible();\n        verify(multiScreenView).onResize();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/multiscreen/MultiScreenViewTest.java",
    "content": "package org.uberfire.client.views.pfly.multiscreen;\n\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.widgets.listbar.ResizeFlowPanel;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiScreenViewTest {\n\n    @Mock\n    ResizeFlowPanel content;\n\n    @InjectMocks\n    MultiScreenView view;\n\n    @Test\n    public void testResize() {\n        view.onResize();\n\n        verify(content).onResize();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/selectpicker/ElementHelperTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.selectpicker;\n\nimport elemental2.dom.Node;\nimport org.junit.Test;\n\nimport static org.mockito.Mockito.*;\n\npublic class ElementHelperTest {\n\n    @Test\n    public void testInsertAfter() {\n\n        final Node newNode = mock(Node.class);\n        final Node referenceNode = mock(Node.class);\n        final Node parentNode = mock(Node.class);\n        final Node nextSibling = mock(Node.class);\n\n        referenceNode.parentNode = parentNode;\n        referenceNode.nextSibling = nextSibling;\n\n        ElementHelper.insertAfter(newNode, referenceNode);\n\n        verify(parentNode).insertBefore(newNode, nextSibling);\n    }\n\n    @Test\n    public void testInsertBefore() {\n\n        final Node newNode = mock(Node.class);\n        final Node referenceNode = mock(Node.class);\n        final Node parentNode = mock(Node.class);\n\n        referenceNode.parentNode = parentNode;\n\n        ElementHelper.insertBefore(newNode, referenceNode);\n\n        verify(parentNode).insertBefore(newNode, referenceNode);\n    }\n\n    @Test\n    public void testRemove() {\n\n        final Node node = mock(Node.class);\n        final Node parentNode = mock(Node.class);\n\n        node.parentNode = parentNode;\n\n        ElementHelper.remove(node);\n\n        verify(parentNode).removeChild(node);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/sys/MomentUtilsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.sys;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class MomentUtilsTest {\n\n    @Test\n    public void testLocale() {\n        assertEquals(\"en\",\n                     MomentUtils.getLocaleName(\"default\"));\n        assertEquals(\"en\",\n                     MomentUtils.getLocaleName(\"\"));\n        assertEquals(\"es\",\n                     MomentUtils.getLocaleName(\"es\"));\n        assertEquals(\"fr\",\n                     MomentUtils.getLocaleName(\"fr\"));\n        assertEquals(\"ja\",\n                     MomentUtils.getLocaleName(\"ja\"));\n        assertEquals(\"pt-br\",\n                     MomentUtils.getLocaleName(\"pt_BR\"));\n        assertEquals(\"zh-cn\",\n                     MomentUtils.getLocaleName(\"zh_CN\"));\n        assertEquals(\"de\",\n                     MomentUtils.getLocaleName(\"de\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/tab/MultiTabWorkbenchPanelViewTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport com.google.gwt.dom.client.Style;\nimport com.google.gwt.event.logical.shared.SelectionHandler;\nimport com.google.gwt.user.client.Element;\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class MultiTabWorkbenchPanelViewTest {\n\n    private MultiTabWorkbenchPanelView view;\n\n    @GwtMock\n    private UberTabPanel uberTabPanel;\n\n    @Before\n    public void setup() {\n        view = new MultiTabWorkbenchPanelView(uberTabPanel);\n\n        Element uberTabPanelElement = mock(Element.class);\n        Style uberTabPanelElementStyle = mock(Style.class);\n        when(uberTabPanel.getElement()).thenReturn(uberTabPanelElement);\n        when(uberTabPanelElement.getStyle()).thenReturn(uberTabPanelElementStyle);\n    }\n\n    @Test\n    public void setupWidget() {\n        view.setupWidget();\n        //assert event handlers\n        verify(uberTabPanel).addSelectionHandler(any(SelectionHandler.class));\n        verify(uberTabPanel).addOnFocusHandler(any(Command.class));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/tab/TabPanelEntryTest.java",
    "content": "/*\n * Copyright 2021 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.function.Consumer;\n\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockito;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.uberfire.client.workbench.ouia.OuiaAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentIdAttribute;\nimport org.uberfire.client.workbench.ouia.OuiaComponentTypeAttribute;\n\nimport static org.mockito.ArgumentMatchers.eq;\nimport static org.mockito.Mockito.doCallRealMethod;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class TabPanelEntryTest {\n\n    @Mock\n    private TabPanelEntry.DropDownTabListItem tabEntryMock;\n\n    @Mock\n    private Consumer<OuiaAttribute> ouiaRendererMock;\n\n    @Mock\n    private Widget tabContentMock;\n\n    @Before\n    public void setUp() throws Exception {\n        GwtMockito.useProviderForType(TabPanelEntry.DropDownTabListItem.class, clazz -> tabEntryMock);\n\n        when(tabEntryMock.ouiaAttributeRenderer()).thenReturn(ouiaRendererMock);\n    }\n\n    @Test\n    public void testInitialization() {\n        final String title = \"tab title\";\n        doCallRealMethod().when(tabEntryMock).initOuiaComponentAttributes();\n        doCallRealMethod().when(tabEntryMock).ouiaComponentId();\n        doCallRealMethod().when(tabEntryMock).ouiaComponentType();\n        when(tabEntryMock.getText()).thenReturn(title);\n        when(tabEntryMock.ouiaAttributeRenderer()).thenReturn(ouiaRendererMock);\n\n        new TabPanelEntry(title, tabContentMock);\n\n        verify(tabEntryMock).setText(title);\n        verify(tabEntryMock).initOuiaComponentAttributes();\n        verify(ouiaRendererMock).accept(eq(new OuiaComponentTypeAttribute(\"editor-nav-tab\")));\n        verify(ouiaRendererMock).accept(eq(new OuiaComponentIdAttribute(title)));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/tab/TabPanelWithDropdownsTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\nimport com.google.common.collect.Multimap;\nimport com.google.gwt.event.shared.HandlerRegistration;\nimport com.google.gwt.user.client.ui.HorizontalPanel;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Widget;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.shared.event.TabShowHandler;\nimport org.gwtbootstrap3.client.shared.event.TabShownHandler;\nimport org.gwtbootstrap3.client.ui.NavTabs;\nimport org.gwtbootstrap3.client.ui.TabContent;\nimport org.gwtbootstrap3.client.ui.TabPane;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static com.google.gwt.i18n.client.HasDirection.Direction.LTR;\nimport static com.google.gwt.user.client.ui.HasHorizontalAlignment.HorizontalAlignmentConstant.endOf;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyInt;\nimport static org.mockito.Mockito.doNothing;\nimport static org.mockito.Mockito.doReturn;\nimport static org.mockito.Mockito.eq;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.spy;\nimport static org.mockito.Mockito.verify;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class TabPanelWithDropdownsTest {\n\n    @Mock\n    private TabPanelEntry tab;\n\n    @Mock\n    private Multimap<TabPanelEntry, HandlerRegistration> registrations;\n\n    @Mock\n    private TabPanelEntry.DropDownTabListItem tabWidget;\n\n    @Mock\n    private TabShowHandler tabShowHandler;\n\n    @Mock\n    private TabShownHandler tabShownHandler;\n\n    @Mock\n    private HandlerRegistration showHandlerRegistration;\n\n    @Mock\n    private HandlerRegistration shownHandlerRegistration;\n\n    @Mock\n    private TabPanelEntry tabPanelEntry;\n\n    @Mock\n    private HorizontalPanel tabBarWidgetsPanel;\n\n    private Set<TabPanelEntry> tabPanelEntries;\n\n    private TabPanelWithDropdowns tabPanel;\n\n    @Before\n    public void setUp() {\n        tabPanel = spy(new TabPanelWithDropdowns());\n\n        tabPanelEntries = new HashSet<TabPanelEntry>() {{\n            add(tabPanelEntry);\n        }};\n    }\n\n    @Test\n    public void testAddItem() {\n\n        final int index = 1;\n\n        doNothing().when(tabPanel).insertItem(any(), anyInt());\n        doReturn(tabPanelEntries).when(tabPanel).getAllContentTabs();\n\n        tabPanel.addItem(tab);\n\n        verify(tabPanel).insertItem(tab, index);\n    }\n\n    @Test\n    public void testInsertItem() {\n\n        final int index = 1;\n\n        doNothing().when(tabPanel).registerTabHandlers(any());\n        doNothing().when(tabPanel).insertTabAndContent(any(), anyInt());\n        doNothing().when(tabPanel).resizeTabContent();\n\n        tabPanel.insertItem(tabPanelEntry, index);\n\n        verify(tabPanel).registerTabHandlers(tabPanelEntry);\n        verify(tabPanel).insertTabAndContent(tabPanelEntry, index);\n        verify(tabPanel).resizeTabContent();\n    }\n\n    @Test\n    public void testInsertTabAndContent() {\n\n        final int index = 1;\n        final TabPane tabContentPane = mock(TabPane.class);\n        final NavTabs tabBar = mock(NavTabs.class);\n        final TabContent tabContent = mock(TabContent.class);\n        final Set<TabPanelEntry> allContentTabs = spy(new HashSet<>());\n        final Set<Widget> activatableWidgets = spy(new HashSet<>());\n\n        doReturn(tabWidget).when(tab).getTabWidget();\n        doReturn(tabContentPane).when(tab).getContentPane();\n        doReturn(tabBar).when(tabPanel).getTabBar();\n        doReturn(tabContent).when(tabPanel).getTabContent();\n        doReturn(allContentTabs).when(tabPanel).getAllContentTabs();\n        doReturn(activatableWidgets).when(tabPanel).getActivatableWidgets();\n\n        tabPanel.insertTabAndContent(tab, index);\n\n        verify(tabBar).insert(tab.getTabWidget(), index);\n        verify(allContentTabs).add(tab);\n        verify(tabContent).add(tabContentPane);\n        verify(activatableWidgets).add(tabWidget);\n    }\n\n    @Test\n    public void testRegisterTabHandlers() {\n\n        doReturn(registrations).when(tabPanel).getTabHandlerRegistrations();\n        doReturn(tabWidget).when(tab).getTabWidget();\n        doReturn(tabShowHandler).when(tabPanel).getIndividualTabShowHandler();\n        doReturn(tabShownHandler).when(tabPanel).getIndividualTabShownHandler();\n        doReturn(showHandlerRegistration).when(tabWidget).addShowHandler(tabShowHandler);\n        doReturn(shownHandlerRegistration).when(tabWidget).addShownHandler(tabShownHandler);\n\n        tabPanel.registerTabHandlers(tab);\n\n        verify(registrations).put(tab, shownHandlerRegistration);\n        verify(registrations).put(tab, showHandlerRegistration);\n    }\n\n    @Test\n    public void testAddTabBarWidget() throws Exception {\n        doReturn(tabBarWidgetsPanel).when(tabPanel).getWidgetsPanel();\n\n        final IsWidget widget = mock(IsWidget.class);\n\n        tabPanel.addTabBarWidget(widget);\n\n        verify(tabBarWidgetsPanel).add(eq(widget));\n        verify(tabBarWidgetsPanel).setCellHorizontalAlignment(eq(widget), eq(endOf(LTR)));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/tab/UberTabPanelTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.tab;\n\nimport com.google.gwtmockito.GwtMock;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.uberfire.client.views.pfly.mock.MockPlaceManager;\nimport org.uberfire.mvp.Command;\n\nimport static org.junit.Assert.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class UberTabPanelTest {\n\n    private final MockPlaceManager mockPlaceManager = new MockPlaceManager();\n    private UberTabPanel uberTabPanel;\n    @GwtMock\n    private ResizeTabPanel resizeTabPanel;\n\n    @Before\n    public void gwtSetUp() throws Exception {\n        uberTabPanel = new UberTabPanel(mockPlaceManager,\n                                        resizeTabPanel);\n    }\n\n    @Test\n    public void testFireFocusEventWhenClickedWhenUnfocused() throws Exception {\n        uberTabPanel.setFocus(false);\n\n        final int[] focusEventCount = new int[1];\n        uberTabPanel.addOnFocusHandler(new Command() {\n            @Override\n            public void execute() {\n                focusEventCount[0]++;\n            }\n        });\n\n        uberTabPanel.onClick(null);\n        assertEquals(1,\n                     focusEventCount[0]);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/ConfirmPopupTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport org.jboss.errai.common.client.dom.CSSStyleDeclaration;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\nimport org.uberfire.mvp.Command;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ConfirmPopupTest {\n\n    private static final String TITLE = \"TITLE\";\n    private static final String INLINE_NOTIFICATION_MESSAGE = \"INLINE_NOTIFICATION_MESSAGE\";\n    private static final String CONFIRM_MESSAGE = \"CONFIRM_MESSAGE\";\n    private static final String OK_BUTTON_TEXT = \"OK_BUTTON_TEXT\";\n\n    @Mock\n    Modal modal;\n\n    @Mock\n    Span modalTitle;\n\n    @Mock\n    InlineNotification confirmInlineNotification;\n\n    @Mock\n    HTMLElement confirmInlineNotificationElement;\n\n    @Mock\n    CSSStyleDeclaration confirmInlineNotificationStyle;\n\n    @Mock\n    Span modalConfirmationMessageLabel;\n\n    @Mock\n    Button okButton;\n\n    @Mock\n    Button cancelButton;\n\n    @InjectMocks\n    ConfirmPopup popup;\n\n    @Before\n    public void setUp() {\n        when(confirmInlineNotification.getElement()).thenReturn(confirmInlineNotificationElement);\n        when(confirmInlineNotificationElement.getStyle()).thenReturn(confirmInlineNotificationStyle);\n    }\n\n    @Test\n    public void testHide() {\n        popup.hide();\n\n        verify(modal).hide();\n    }\n\n    @Test\n    public void testCancel() {\n        popup.onCancelClick(null);\n\n        verify(modal).hide();\n    }\n\n    @Test\n    public void testClose() {\n        popup.onCloseClick(null);\n\n        verify(modal).hide();\n    }\n\n    @Test\n    public void testOk() {\n        final Command command = mock(Command.class);\n        popup.show(null,\n                   null,\n                   null,\n                   command);\n\n        popup.onOkClick(null);\n\n        verify(command).execute();\n        verify(modal).hide();\n    }\n\n    @Test\n    public void testShow() {\n        final Command command = mock(Command.class);\n        popup.show(TITLE,\n                   OK_BUTTON_TEXT,\n                   CONFIRM_MESSAGE,\n                   command);\n        verify(modalTitle,\n               times(1)).setTextContent(TITLE);\n        verify(confirmInlineNotificationStyle,\n               times(1)).setProperty(\"display\",\n                                     \"none\");\n        verify(okButton,\n               times(1)).setText(OK_BUTTON_TEXT);\n        verify(okButton,\n               times(1)).setButtonStyleType(Button.ButtonStyleType.DANGER);\n        verify(modalConfirmationMessageLabel,\n               times(1)).setTextContent(CONFIRM_MESSAGE);\n    }\n\n    @Test\n    public void testShowWithInlineNotification() {\n        final Command command = mock(Command.class);\n        InlineNotification.InlineNotificationType arbitraryNotificationType = InlineNotification.InlineNotificationType.WARNING;\n        Button.ButtonStyleType arbitraryButtonType = Button.ButtonStyleType.PRIMARY;\n        popup.show(TITLE,\n                   INLINE_NOTIFICATION_MESSAGE,\n                   arbitraryNotificationType,\n                   OK_BUTTON_TEXT,\n                   arbitraryButtonType,\n                   CONFIRM_MESSAGE,\n                   command);\n        verify(modalTitle,\n               times(1)).setTextContent(TITLE);\n        verify(confirmInlineNotificationStyle,\n               times(1)).removeProperty(\"display\");\n        verify(confirmInlineNotification,\n               times(1)).setMessage(INLINE_NOTIFICATION_MESSAGE);\n        verify(confirmInlineNotification,\n               times(1)).setType(arbitraryNotificationType);\n        verify(okButton,\n               times(1)).setText(OK_BUTTON_TEXT);\n        verify(okButton,\n               times(1)).setButtonStyleType(arbitraryButtonType);\n        verify(modalConfirmationMessageLabel,\n               times(1)).setTextContent(CONFIRM_MESSAGE);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/ErrorPopupTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ErrorPopupTest {\n\n    private static final String MESSAGE = \"MESSAGE\";\n\n    private static final String DETAIL = \"DETAIL\";\n\n    private static final String SHOW_DETAIL_LABEL = \"SHOW_DETAIL_LABEL\";\n\n    private static final String CLOSE_DETAIL_LABEL = \"CLOSE_DETAIL_LABEL\";\n\n    @Mock\n    private HTMLElement inlineNotification;\n\n    @Mock\n    private HTMLElement standardNotification;\n\n    @Mock\n    private ErrorPopup.View view;\n\n    private ErrorPopup popup;\n\n    @Before\n    public void setUp() {\n        when(view.getInlineNotification()).thenReturn(inlineNotification);\n        when(view.getStandardNotification()).thenReturn(standardNotification);\n        when(view.getShowDetailLabel()).thenReturn(SHOW_DETAIL_LABEL);\n        when(view.getCloseDetailLabel()).thenReturn(CLOSE_DETAIL_LABEL);\n\n        popup = spy(new ErrorPopup(view));\n        popup.init();\n        verify(view,\n               times(1)).init(popup);\n    }\n\n    @Test\n    public void testShowError() {\n        popup.showError(MESSAGE);\n        verify(popup,\n               times(1)).showError(MESSAGE,\n                                   ErrorPopup.DisplayMode.PATTERN_FLY);\n    }\n\n    @Test\n    public void testShowErrorStandard() {\n        popup.showError(MESSAGE,\n                        ErrorPopup.DisplayMode.STANDARD);\n        verifyStandardNotificationWasSet(MESSAGE);\n        verify(view,\n               times(1)).setDetailValue(\"\");\n        verify(view,\n               times(1)).showDetailPanel(false);\n        verify(view,\n               times(1)).show();\n    }\n\n    @Test\n    public void testShowErrorPatternFly() {\n        popup.showError(MESSAGE,\n                        ErrorPopup.DisplayMode.PATTERN_FLY);\n        verifyInlineNotificationWasSet(MESSAGE);\n        verify(view,\n               times(1)).setDetailValue(\"\");\n        verify(view,\n               times(1)).showDetailPanel(false);\n        verify(view,\n               times(1)).show();\n    }\n\n    @Test\n    public void testShowErrorWithDetail() {\n        popup.showError(MESSAGE,\n                        DETAIL);\n        verify(popup,\n               times(1)).showError(MESSAGE,\n                                   DETAIL,\n                                   ErrorPopup.DisplayMode.PATTERN_FLY);\n    }\n\n    @Test\n    public void testShowErrorStandardWithDetail() {\n        popup.showError(MESSAGE,\n                        DETAIL,\n                        ErrorPopup.DisplayMode.STANDARD);\n        verifyStandardNotificationWasSet(MESSAGE);\n        verify(view,\n               times(1)).setDetailValue(DETAIL);\n        verify(view,\n               times(1)).showDetailPanel(true);\n        verify(view,\n               times(1)).show();\n    }\n\n    @Test\n    public void testShowErrorPatternFlyWithDetail() {\n        popup.showError(MESSAGE,\n                        DETAIL,\n                        ErrorPopup.DisplayMode.PATTERN_FLY);\n        verifyInlineNotificationWasSet(MESSAGE);\n        verify(view,\n               times(1)).setDetailValue(DETAIL);\n        verify(view,\n               times(1)).showDetailPanel(true);\n        verify(view,\n               times(1)).show();\n    }\n\n    private void verifyStandardNotificationWasSet(String message) {\n        verify(view,\n               times(1)).setNotification(standardNotification);\n        verify(view,\n               times(1)).setStandardNotificationValue(message);\n        verify(view,\n               never()).setNotification(inlineNotification);\n        verify(view,\n               never()).setInlineNotificationValue(any());\n    }\n\n    private void verifyInlineNotificationWasSet(String message) {\n        verify(view,\n               times(1)).setNotification(inlineNotification);\n        verify(view,\n               times(1)).setInlineNotificationValue(message);\n        verify(view,\n               never()).setNotification(standardNotification);\n        verify(view,\n               never()).setStandardNotificationValue(any());\n    }\n\n    @Test\n    public void testOnOK() {\n        popup.onOk();\n        verify(view,\n               times(1)).hide();\n    }\n\n    @Test\n    public void testOnClose() {\n        popup.onClose();\n        verify(view,\n               times(1)).hide();\n    }\n\n    @Test\n    public void testOnDetailWhenDetailCollapsed() {\n        when(view.isDetailCollapsed()).thenReturn(true);\n        popup.onDetail();\n        verify(view,\n               times(1)).setCollapseDetailIcon(false);\n        verify(view,\n               times(1)).setDetailLabel(CLOSE_DETAIL_LABEL);\n    }\n\n    @Test\n    public void testOnDetailWhenDetailNotCollapsed() {\n        when(view.isDetailCollapsed()).thenReturn(false);\n        popup.onDetail();\n        verify(view,\n               times(1)).setCollapseDetailIcon(true);\n        verify(view,\n               times(1)).setDetailLabel(SHOW_DETAIL_LABEL);\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/FormGroupTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport org.jboss.errai.common.client.dom.DOMTokenList;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class FormGroupTest {\n\n    @Mock\n    Div div;\n\n    @Mock\n    DOMTokenList domTokenList;\n\n    @InjectMocks\n    FormGroup formGroup;\n\n    @Before\n    public void setup() {\n        when(div.getClassList()).thenReturn(domTokenList);\n    }\n\n    @Test\n    public void testClearValidationState() {\n        when(domTokenList.contains(anyString())).thenReturn(true);\n\n        formGroup.clearValidationState();\n\n        for (ValidationState v : ValidationState.values()) {\n            verify(domTokenList).remove(v.getCssName());\n        }\n    }\n\n    @Test\n    public void testSetValidationState() {\n        formGroup.setValidationState(ValidationState.SUCCESS);\n\n        verify(domTokenList).add(ValidationState.SUCCESS.getCssName());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/FormLabelHelpTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.FormLabel;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\nimport org.mockito.Mockito;\n\nimport static org.junit.Assert.*;\nimport static org.mockito.ArgumentMatchers.isA;\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class FormLabelHelpTest {\n\n    @Mock\n    private FormLabel formLabel;\n\n    @Mock\n    private FlowPanel panel;\n\n    private FormLabelHelp formLabelHelp;\n\n    @Before\n    public void setUp() {\n        this.formLabelHelp = new FormLabelHelp(formLabel,\n                                               panel);\n    }\n\n    @Test\n    public void setHelpTitleNull() {\n        Mockito.reset(panel);\n\n        formLabelHelp.setHelpTitle(null);\n\n        verify(panel,\n               times(0)).add(isA(HelpIcon.class));\n    }\n\n    @Test\n    public void setHelpTitleNotNull() {\n        Mockito.reset(panel);\n\n        formLabelHelp.setHelpTitle(\"testTitle\");\n\n        verify(panel).add(isA(HelpIcon.class));\n    }\n\n    @Test\n    public void setHelpContentNull() {\n        Mockito.reset(panel);\n\n        formLabelHelp.setHelpContent(null);\n\n        verify(panel,\n               times(0)).add(isA(HelpIcon.class));\n    }\n\n    @Test\n    public void setHelpContentNotNull() {\n        Mockito.reset(panel);\n\n        formLabelHelp.setHelpContent(\"testContent\");\n\n        verify(panel).add(isA(HelpIcon.class));\n    }\n\n    @Test\n    public void setText() {\n        formLabelHelp.setText(\"testText\");\n\n        verify(formLabel).setText(\"testText\");\n    }\n\n    @Test\n    public void getText() {\n        Mockito.when(formLabel.getText()).thenReturn(\"testText\");\n\n        assertEquals(\"testText\",\n                     formLabelHelp.getText());\n    }\n\n    @Test\n    public void setFor() {\n        formLabelHelp.setFor(\"testFor\");\n\n        verify(formLabel).setFor(\"testFor\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/HelpIconTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport com.google.gwtmockito.GwtMockitoTestRunner;\nimport org.gwtbootstrap3.client.ui.Icon;\nimport org.gwtbootstrap3.client.ui.Popover;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.Mock;\n\nimport static org.mockito.Mockito.*;\n\n@RunWith(GwtMockitoTestRunner.class)\npublic class HelpIconTest {\n\n    @Mock\n    private Icon icon;\n\n    @Mock\n    private SimplePanel panel;\n\n    @Mock\n    private Popover popover;\n\n    private HelpIcon helpIcon;\n\n    @Before\n    public void setUp() {\n        this.helpIcon = new HelpIcon(icon,\n                                     panel,\n                                     popover);\n    }\n\n    @Test\n    public void setHelpContent() {\n        helpIcon.setHelpContent(\"testContent\");\n\n        verify(popover).setContent(\"testContent\");\n    }\n\n    @Test\n    public void setHelpTitle() {\n        helpIcon.setHelpTitle(\"testTitle\");\n\n        verify(popover).setTitle(\"testTitle\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/InlineNotificationTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport java.util.Arrays;\nimport java.util.stream.Stream;\n\nimport org.jboss.errai.common.client.dom.DOMTokenList;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.Node;\nimport org.jboss.errai.common.client.dom.NodeList;\nimport org.jboss.errai.common.client.dom.Span;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.ArgumentMatchers.anyString;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class InlineNotificationTest {\n\n    @Mock\n    Div alert;\n\n    @Mock\n    Span message;\n\n    @Mock\n    Span icon;\n\n    @Mock\n    Document document;\n\n    @InjectMocks\n    InlineNotification notification;\n\n    @Test\n    public void testType() {\n        final DOMTokenList alertDomTokenList = mock(DOMTokenList.class);\n        when(alert.getClassList()).thenReturn(alertDomTokenList);\n        final DOMTokenList iconDomTokenList = mock(DOMTokenList.class);\n        when(icon.getClassList()).thenReturn(iconDomTokenList);\n\n        notification.setType(InlineNotification.InlineNotificationType.SUCCESS);\n\n        verify(alertDomTokenList).add(InlineNotification.InlineNotificationType.SUCCESS.getCssClass());\n        verify(iconDomTokenList).add(InlineNotification.InlineNotificationType.SUCCESS.getIcon());\n    }\n\n    @Test\n    public void testPreviousTypeIsCleared() {\n        final DOMTokenList alertDomTokenList = mock(DOMTokenList.class);\n        when(alert.getClassList()).thenReturn(alertDomTokenList);\n        final DOMTokenList iconDomTokenList = mock(DOMTokenList.class);\n        when(icon.getClassList()).thenReturn(iconDomTokenList);\n        when(alertDomTokenList.contains(anyString())).thenReturn(true);\n        when(iconDomTokenList.contains(anyString())).thenReturn(true);\n\n        notification.setType(InlineNotification.InlineNotificationType.SUCCESS);\n\n        Stream.of(InlineNotification.InlineNotificationType.values()).forEach(availableType -> {\n            verify(alertDomTokenList).remove(availableType.getCssClass());\n            verify(iconDomTokenList).remove(availableType.getIcon());\n        });\n    }\n\n    @Test\n    public void testMessage() {\n        final String msg = \"message\";\n\n        notification.setMessage(msg);\n\n        verify(message).setTextContent(msg);\n    }\n\n    @Test\n    public void testMessages() {\n        final HTMLElement htmlElement = mock(HTMLElement.class);\n        when(htmlElement.getClassList()).thenReturn(mock(DOMTokenList.class));\n        when(document.createElement(anyString())).thenReturn(htmlElement);\n        when(message.getChildNodes()).thenReturn(mock(NodeList.class));\n\n        notification.setMessage(Arrays.asList(\"message\"));\n\n        verify(message).appendChild(any(Node.class));\n        verify(document).createElement(\"li\");\n        verify(document).createElement(\"ul\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/KebabMenuTest.java",
    "content": "package org.uberfire.client.views.pfly.widgets;\n\nimport elemental2.dom.DOMTokenList;\nimport elemental2.dom.HTMLDivElement;\nimport elemental2.dom.HTMLDocument;\nimport elemental2.dom.HTMLLIElement;\nimport elemental2.dom.HTMLUListElement;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class KebabMenuTest {\n\n    @Mock\n    HTMLUListElement dropdownMenu;\n\n    @Mock\n    HTMLDocument document;\n\n    @Mock\n    HTMLDivElement kebab;\n\n    @InjectMocks\n    KebabMenu kebabMenu;\n\n    @Before\n    public void setup() {\n        final HTMLLIElement element = mock(HTMLLIElement.class);\n        element.classList = mock(DOMTokenList.class);\n        when(document.createElement(\"li\")).thenReturn(element);\n        kebab.classList = mock(DOMTokenList.class);\n    }\n\n    @Test\n    public void testAddSeparator() {\n        kebabMenu.addSeparator();\n\n        verify(dropdownMenu).appendChild(any(HTMLLIElement.class));\n    }\n\n    @Test\n    public void testDropPositionUp() {\n        kebabMenu.setDropPosition(KebabMenu.DropPosition.UP);\n\n        verify(kebab.classList).add(\"dropup\");\n        verify(kebab.classList).remove(\"dropdown\");\n        verifyNoMoreInteractions(kebab.classList);\n    }\n\n    @Test\n    public void testDropPositionDown() {\n        kebabMenu.setDropPosition(KebabMenu.DropPosition.DOWN);\n\n        verify(kebab.classList).remove(\"dropup\");\n        verify(kebab.classList).add(\"dropdown\");\n        verifyNoMoreInteractions(kebab.classList);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/ModalTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport org.jboss.errai.common.client.dom.Body;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.Element;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.Spy;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class ModalTest {\n\n    @Mock\n    Document document;\n\n    @Mock\n    Body body;\n\n    @Mock\n    Div div;\n\n    @InjectMocks\n    @Spy\n    Modal modal;\n\n    @Before\n    public void setup() {\n        doNothing().when(modal).hide(any(Element.class));\n        doNothing().when(modal).show(any(Element.class));\n        when(document.getBody()).thenReturn(body);\n    }\n\n    @Test\n    public void testShow() {\n        modal.show();\n\n        verify(body).appendChild(div);\n    }\n\n    @Test\n    public void testHide() {\n        modal.hide();\n\n        verify(body).removeChild(div);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/SanitizedNumberInputTest.java",
    "content": "package org.uberfire.client.views.pfly.widgets;\n\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.times;\nimport static org.mockito.Mockito.verify;\nimport static org.mockito.Mockito.when;\n\nimport org.jboss.errai.common.client.dom.KeyboardEvent;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.junit.MockitoJUnitRunner;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SanitizedNumberInputTest {\n\n    @InjectMocks\n    SanitizedNumberInput input;\n\n    @Before\n    public void setup() {\n    }\n\n    private boolean allowNegative = false;\n    private boolean allowDecimal = false;\n\n    @Test\n    public void testNumericInput() {\n        testValidKeyCode(\"9\");\n        testValidKeyCode(\"8\");\n        testValidKeyCode(\"0\");\n        testValidKeyCode(\"Backspace\");\n\n        testInvalidKeyCode(\"-\");\n        testInvalidKeyCode(\"+\");\n        testInvalidKeyCode(\" \");\n        testInvalidKeyCode(\".\");\n    }\n\n    @Test\n    public void testNumericInputNegative() {\n        allowNegative = true;\n        allowDecimal = false;\n        testValidKeyCode(\"-\");\n        testInvalidKeyCode(\".\");\n    }\n\n    @Test\n    public void testNumericInputDecimal() {\n        allowNegative = false;\n        allowDecimal = true;\n        testInvalidKeyCode(\"-\");\n        testValidKeyCode(\".\");\n    }\n\n    @Test\n    public void testNumericInputNegativeDecimal() {\n        allowNegative = true;\n        allowDecimal = true;\n        testValidKeyCode(\"-\");\n        testValidKeyCode(\".\");\n    }\n\n    protected void testValidKeyCode(String key) {\n        testKeyCode(key,\n                    0);\n    }\n\n    protected void testInvalidKeyCode(String key) {\n        testKeyCode(key,\n                    1);\n    }\n\n    protected void testKeyCode(String key,\n                               int wantedNumberOfInvocations) {\n        final KeyboardEvent event = mock(KeyboardEvent.class);\n        when(event.getKey()).thenReturn(key);\n        input.getEventListener(allowNegative, allowDecimal).call(event);\n        verify(event,\n               times(wantedNumberOfInvocations)).preventDefault();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/java/org/uberfire/client/views/pfly/widgets/SelectTest.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.views.pfly.widgets;\n\nimport org.jboss.errai.common.client.dom.Document;\nimport org.jboss.errai.common.client.dom.Option;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.InjectMocks;\nimport org.mockito.Mock;\nimport org.mockito.junit.MockitoJUnitRunner;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.mockito.Mockito.*;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class SelectTest {\n\n    @Mock\n    Document document;\n\n    @Mock\n    org.jboss.errai.common.client.dom.Select selectMock;\n\n    @InjectMocks\n    Select select;\n\n    @Test\n    public void testAddOption() {\n        final Option option = mock(Option.class);\n        when(document.createElement(\"option\")).thenReturn(option);\n\n        select.addOption(\"text\",\n                         \"subText\",\n                         \"value\",\n                         true);\n\n        verify(option).setText(\"text\");\n        verify(option).setValue(\"value\");\n        verify(option).setSelected(true);\n        option.setAttribute(\"data-subtext\",\n                            \"subText\");\n        verify(selectMock).add(option);\n    }\n\n    @Test\n    public void testTitle() {\n        final String title = \"title\";\n\n        select.setTitle(title);\n\n        verify(selectMock).setTitle(title);\n    }\n\n    @Test\n    public void testLiveSearch() {\n        select.setLiveSearch(true);\n\n        verify(selectMock).setAttribute(\"data-live-search\", \"true\");\n    }\n\n    @Test\n    public void testWidth() {\n        select.setWidth(\"auto\");\n\n        verify(selectMock).setAttribute(\"data-width\", \"auto\");\n    }\n\n    @Test\n    public void testValue() {\n        final String value = \"somevalue\";\n        when(selectMock.getValue()).thenReturn(value);\n\n        assertEquals(value, select.getValue());\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/resources/META-INF/ErraiApp.properties",
    "content": "errai.ioc.enabled.alternatives=org.uberfire.client.views.pfly.mock.MockPartView \\\n                               org.uberfire.client.views.pfly.mock.MockPlaceManager \\\n                               org.uberfire.security.impl.authz.RuntimeAuthorizationManager \\\n                               org.uberfire.client.workbench.WorkbenchServicesProxyClientImpl"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-client-views-patternfly/src/test/resources/log4j.properties",
    "content": "\n#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\nlog4j.rootLogger=INFO, mainlogger\nlog4j.appender.mainlogger=org.apache.log4j.ConsoleAppender\nlog4j.appender.mainlogger.target=System.err\nlog4j.appender.mainlogger.layout=org.apache.log4j.PatternLayout\nlog4j.appender.mainlogger.layout.ConversionPattern=%p [%c{1}] %m%n\n\n#log4j.logger.org.jboss.errai.ioc.IOCBootstrapGenerator=DEBUG\n\nlog4j.logger.com.gargoylesoftware.htmlunit.DefaultCssErrorHandler=ERROR\n#log4j.logger.com.gargoylesoftware.htmlunit=DEBUG\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/.gitignore",
    "content": "/target\n/**/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\ndependency-reduced-pom.xml\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workbench</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workbench-processors</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Workbench Processors</name>\n  <description>UberFire Workbench Processors</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>jakarta.enterprise</groupId>\n      <artifactId>jakarta.enterprise.cdi-api</artifactId>\n      <scope>provided</scope>\n    </dependency>\n\n    <dependency>\n      <groupId>org.freemarker</groupId>\n      <artifactId>freemarker</artifactId>\n    </dependency>\n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-compiler-plugin</artifactId>\n        <configuration>\n          <proc>none</proc>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/AbstractErrorAbsorbingProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.io.StringWriter;\nimport java.io.Writer;\nimport java.util.Set;\nimport javax.annotation.processing.AbstractProcessor;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.Name;\nimport javax.lang.model.element.TypeElement;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\n/**\n * Contains a series of adaptations and workarounds to make annotation processors work well under Eclipse JDT APT. Does\n * not limit compatibility with other annotation processing environments (such as javac).\n */\npublic abstract class AbstractErrorAbsorbingProcessor extends AbstractProcessor {\n\n    private Throwable rememberedInitError;\n\n    protected AbstractErrorAbsorbingProcessor() {\n        try {\n            freemarker.log.Logger.selectLoggerLibrary(freemarker.log.Logger.LIBRARY_NONE);\n        } catch (ClassNotFoundException e) {\n            rememberedInitError = e;\n        }\n    }\n\n    private static AnnotationMirror findAnnotationMirror(Element target,\n                                                         TypeElement annotationType) {\n        final Name annotationTypeName = annotationType.getQualifiedName();\n        for (AnnotationMirror am : target.getAnnotationMirrors()) {\n            if (GeneratorUtils.getQualifiedName(am).contentEquals(annotationTypeName)) {\n                return am;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Wraps the given processing environment with one that protects against known bugs in the Eclipse annotation\n     * processing implementation.\n     */\n    @Override\n    public synchronized void init(ProcessingEnvironment env) {\n        super.init(new EclipseWorkaroundProcessingEnvironment(env));\n    }\n\n    @Override\n    public final boolean process(Set<? extends TypeElement> annotations,\n                                 RoundEnvironment roundEnv) {\n        try {\n            if (rememberedInitError != null) {\n                throw rememberedInitError;\n            }\n            return processWithExceptions(annotations,\n                                         roundEnv);\n        } catch (Throwable e) {\n            // eclipse JDT goes into an infinite loop when the annotation processor throws any exception\n            // so we have to catch EVERYTHING, even Errors.\n\n            StringWriter stringWriter = new StringWriter();\n            e.printStackTrace(new PrintWriter(stringWriter));\n            final String errorMessage = \"Internal error in \" + getClass().getName() + stringWriter.toString();\n\n            boolean emittedSpecificError = false;\n            for (TypeElement annotation : annotations) {\n                for (Element annotationTarget : roundEnv.getElementsAnnotatedWith(annotation)) {\n                    processingEnv.getMessager().printMessage(\n                            Kind.ERROR,\n                            errorMessage,\n                            annotationTarget,\n                            findAnnotationMirror(annotationTarget,\n                                                 annotation));\n                    emittedSpecificError = true;\n                }\n            }\n\n            // if the above loop caught nothing, the type we were called for didn't contain an annotation\n            // we handle (maybe it was inherited). In this case, we'll just emit a non-location-specific error\n            // so there is at least some sort of diagnostic message for the user to go on!\n            if (!emittedSpecificError) {\n                processingEnv.getMessager().printMessage(\n                        Kind.ERROR,\n                        errorMessage);\n            }\n\n            return false;\n        }\n    }\n\n    /**\n     * Subclasses must call this from their constructors if something throws an\n     * exception during initialization of the instance. Once this method has\n     * been called with a non-null throwable, the\n     * {@link #processWithExceptions(Set, RoundEnvironment)} method will not be\n     * called on this instance.\n     * @param t the exception that occurred (and was caught) during instance\n     * creation of this annotation processor instance.\n     */\n    protected void rememberInitializationError(Throwable t) {\n        rememberedInitError = t;\n    }\n\n    /**\n     * Same contract as {@link #process(Set, RoundEnvironment)}, except that any\n     * exceptions thrown are caught and printed as messages of type\n     * {@link Kind#ERROR}. This is done to keep Eclipse JDT from going into an\n     * infinite processing loop.\n     */\n    protected abstract boolean processWithExceptions(\n            Set<? extends TypeElement> annotations,\n            RoundEnvironment roundEnv) throws Exception;\n\n    /**\n     * Writes the given code to javac's Filer.\n     */\n    protected final void writeCode(final String packageName,\n                                   final String className,\n                                   final StringBuffer code) throws IOException {\n        JavaFileObject jfo = processingEnv.getFiler().createSourceFile(packageName + \".\" + className);\n        try (Writer w = jfo.openWriter();\n             BufferedWriter bw = new BufferedWriter(w)) {\n            bw.append(code);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/AbstractGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.PackageElement;\n\nimport freemarker.cache.ClassTemplateLoader;\nimport freemarker.template.Configuration;\nimport freemarker.template.DefaultObjectWrapperBuilder;\nimport freemarker.template.Version;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\n\n/**\n * A class capable of generating source code using FreeMarker templates\n */\npublic abstract class AbstractGenerator {\n\n    private static Version FREE_MARKER_VERSION = new Version(Version.intValueFor(2,\n                                                                                 3,\n                                                                                 25));\n\n    static boolean FAIL_FOR_TESTING = false;\n\n    private static ExceptionInInitializerError INITIALIZER_EXCEPTION = null;\n\n    private static MultiTemplateLoader templateLoader = new MultiTemplateLoader();\n\n    protected static Configuration config;\n\n    //per-instance static initializer block\n    {\n        if (FAIL_FOR_TESTING) {\n            throw new NoClassDefFoundError(\"Failing for testing purposes\");\n        }\n        try {\n            synchronized (AbstractGenerator.class) {\n                final ClassTemplateLoader loader = new ClassTemplateLoader(getClass(),\n                                                                           \"templates\");\n                templateLoader.addTemplateLoader(loader);\n            }\n        } catch (NoClassDefFoundError ex) {\n            if (ex.getCause() == null) {\n                ex.initCause(INITIALIZER_EXCEPTION);\n            }\n            throw ex;\n        } catch (ExceptionInInitializerError ex) {\n            INITIALIZER_EXCEPTION = ex;\n            throw ex;\n        }\n    }\n\n    //Class's static initializer block\n    static {\n        config = new Configuration(FREE_MARKER_VERSION);\n        config.setTemplateLoader(templateLoader);\n        config.setObjectWrapper(new DefaultObjectWrapperBuilder(FREE_MARKER_VERSION).build());\n    }\n\n    public abstract StringBuffer generate(final String packageName,\n                                          final PackageElement packageElement,\n                                          final String className,\n                                          final Element element,\n                                          final ProcessingEnvironment processingEnvironment) throws GenerationException;\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ClientEditorActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class ClientEditorActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n\n        final String annotationName = ClientAPIModule.getWorkbenchClientEditorClass();\n        final boolean isDynamic = ClientAPIModule.getWbEditorIsDynamicValueOnClass(classElement);\n\n        String identifier = null;\n\n        for (final AnnotationMirror am : classElement.getAnnotationMirrors()) {\n            if (annotationName.equals(am.getAnnotationType().toString())) {\n                for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) {\n                    AnnotationValue aval = entry.getValue();\n                    if (\"identifier\".equals(entry.getKey().getSimpleName().toString())) {\n                        identifier = aval.getValue().toString();\n                    }\n                }\n                break;\n            }\n        }\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForNonEditors(classElement,\n                                                                                                 processingEnvironment);\n\n        final String onStartup0ParameterMethodName;\n        final String onStartup1ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().isEmpty()) {\n            onStartup0ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup1ParameterMethodName = null;\n        } else {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onMayCloseMethodName = GeneratorUtils.getOnMayCloseMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String onLostFocusMethodName = GeneratorUtils.getOnLostFocusMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String onFocusMethodName = GeneratorUtils.getOnFocusMethodName(classElement,\n                                                                             processingEnvironment);\n        final String getDefaultPositionMethodName = GeneratorUtils.getDefaultPositionMethodName(classElement,\n                                                                                                processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final String getContextIdMethodName = GeneratorUtils.getContextIdMethodName(classElement,\n                                                                                    processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n\n        final boolean isWidgetMethodReturnTypeElement = getWidgetMethod != null && GeneratorUtils.getIsElement(getWidgetMethod.getReturnType(),\n                                                                                                               processingEnvironment);\n\n        final boolean hasUberView = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n\n        final String isDirtyMethodName = GeneratorUtils.getIsDirtyMethodName(classElement,\n                                                                             processingEnvironment);\n\n        final ExecutableElement setContentMethod = GeneratorUtils.getSetContentMethodName(classElement,\n                                                                                          processingEnvironment);\n\n        final String setContentMethodName = setContentMethod == null ? null : setContentMethod.getSimpleName().toString();\n\n        final ExecutableElement getContentMethod = GeneratorUtils.getGetContentMethodName(classElement,\n                                                                                          processingEnvironment);\n\n        final String getContentMethodName = getContentMethod == null ? null : getContentMethod.getSimpleName().toString();\n\n        final ExecutableElement getPreviewMethod = GeneratorUtils.getGetPreviewMethodName(classElement,\n                                                                                          processingEnvironment);\n        final String getPreviewMethodName = getPreviewMethod == null ? null : getPreviewMethod.getSimpleName().toString();\n\n        final ExecutableElement validateMethod = GeneratorUtils.getValidateMethodName(classElement,\n                                                                                       processingEnvironment);\n\n        final String validateMethodName = validateMethod == null ? null : validateMethod.getSimpleName().toString();\n\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"getContextIdMethodName: \" + getContextIdMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup0ParameterMethodName: \" + onStartup0ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onMayCloseMethodName: \" + onMayCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onLostFocusMethodName: \" + onLostFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onFocusMethodName: \" + onFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getDefaultPositionMethodName: \" + getDefaultPositionMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidgetMethodReturnTypeElement: \" + isWidgetMethodReturnTypeElement);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasUberView: \" + Boolean.toString(hasUberView));\n            messager.printMessage(Kind.NOTE,\n                                  \"setContentMethodName: \" + setContentMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getContentMethodName: \" + getContentMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getPreviewMethodName: \" + getPreviewMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isDirtyMethodName: \" + isDirtyMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"validateMethodName: \" + validateMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        //Validate getWidgetMethodName and isWidget\n        if (!isWidget && getWidgetMethodName == null) {\n            throw new GenerationException(\"The WorkbenchClientEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\",\n                                          packageName + \".\" + className);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchClientEditor both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n\n        //Validate getTitleMethodName\n        if (getTitleMethodName == null) {\n            throw new GenerationException(\"The WorkbenchClientEditor must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\",\n                                          packageName + \".\" + className);\n        }\n        //Validate setContentMethodName\n        if (setContentMethodName == null) {\n            throw new GenerationException(\"org.uberfire.annotations.processors.WorkbenchClientEditorTest4Activity: The WorkbenchClientEditor must provide a @SetContent annotated method that has two java.lang.String (path and content) as parameters.\",\n                                          packageName + \".\" + className);\n        }\n        //Validate getContentMethodName\n        if (getContentMethodName == null) {\n            throw new GenerationException(\"The WorkbenchClientEditor must provide a @GetContent annotated method to return a elemental2.promise.Promise.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"getContextIdMethodName\",\n                 getContextIdMethodName);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup0ParameterMethodName\",\n                 onStartup0ParameterMethodName);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onMayCloseMethodName\",\n                 onMayCloseMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"onLostFocusMethodName\",\n                 onLostFocusMethodName);\n        root.put(\"onFocusMethodName\",\n                 onFocusMethodName);\n        root.put(\"getDefaultPositionMethodName\",\n                 getDefaultPositionMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidgetMethodReturnTypeElement\",\n                 isWidgetMethodReturnTypeElement);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasUberView\",\n                 hasUberView);\n        root.put(\"isDirtyMethodName\",\n                 isDirtyMethodName);\n\n        root.put(\"setContentMethodName\",\n                 setContentMethodName);\n        root.put(\"getContentMethodName\",\n                 getContentMethodName);\n        root.put(\"getPreviewMethodName\",\n                 getPreviewMethodName);\n        root.put(\"isDynamic\",\n                 isDynamic);\n        root.put(\"validateMethodName\",\n                 validateMethodName);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"activityClientEditor.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ContextActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class ContextActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        Messager messager = processingEnvironment.getMessager();\n\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n\n        String identifier = ClientAPIModule.getWbContextIdentifierValueOnClass(classElement);\n\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String getOnContextAttachPanelDefinitionMethodName = GeneratorUtils.getOnContextAttachPanelDefinitionMethodName(classElement,\n                                                                                                                              processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n        final boolean hasUberView = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getOnContextAttachPanelDefinitionMethodName: \" + getOnContextAttachPanelDefinitionMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasUberView: \" + Boolean.toString(hasUberView));\n        }\n\n        if (!isWidget && getWidgetMethodName == null) {\n            final String msg = \"The WorkbenchContext must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\";\n            messager.printMessage(Kind.ERROR,\n                                  msg,\n                                  classElement);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchContext both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n        if (getTitleMethodName == null) {\n            final String msg = \"The WorkbenchContext must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\";\n            messager.printMessage(Kind.ERROR,\n                                  msg,\n                                  classElement);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"getOnContextAttachPanelDefinitionMethodName\",\n                 getOnContextAttachPanelDefinitionMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasUberView\",\n                 hasUberView);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"activityContext.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/EclipseWorkaroundProcessingEnvironment.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Locale;\nimport java.util.Map;\nimport javax.annotation.processing.Filer;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.util.Elements;\nimport javax.lang.model.util.Types;\n\n/**\n * A wrapper for ProcessingEnvironment that returns a wrapped Types instance which works around bug 434378 in Eclipse.\n */\npublic class EclipseWorkaroundProcessingEnvironment implements ProcessingEnvironment {\n\n    private final ProcessingEnvironment realImpl;\n    private final Types wrappedTypeUtils;\n\n    public EclipseWorkaroundProcessingEnvironment(ProcessingEnvironment realImpl) {\n        this.realImpl = realImpl;\n        this.wrappedTypeUtils = new EclipseWorkaroundTypeUtils(realImpl.getTypeUtils());\n    }\n\n    @Override\n    public Elements getElementUtils() {\n        return realImpl.getElementUtils();\n    }\n\n    @Override\n    public Filer getFiler() {\n        return realImpl.getFiler();\n    }\n\n    @Override\n    public Locale getLocale() {\n        return realImpl.getLocale();\n    }\n\n    @Override\n    public Messager getMessager() {\n        return realImpl.getMessager();\n    }\n\n    @Override\n    public Map<String, String> getOptions() {\n        return realImpl.getOptions();\n    }\n\n    @Override\n    public SourceVersion getSourceVersion() {\n        return realImpl.getSourceVersion();\n    }\n\n    @Override\n    public Types getTypeUtils() {\n        return wrappedTypeUtils;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/EclipseWorkaroundTypeUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.List;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.type.ArrayType;\nimport javax.lang.model.type.DeclaredType;\nimport javax.lang.model.type.ExecutableType;\nimport javax.lang.model.type.NoType;\nimport javax.lang.model.type.NullType;\nimport javax.lang.model.type.PrimitiveType;\nimport javax.lang.model.type.TypeKind;\nimport javax.lang.model.type.TypeMirror;\nimport javax.lang.model.type.WildcardType;\nimport javax.lang.model.util.Types;\n\n/**\n * A wrapper for Types that works around bug 434378 in Eclipse.\n */\npublic class EclipseWorkaroundTypeUtils implements Types {\n\n    private final Types realImpl;\n\n    public EclipseWorkaroundTypeUtils(Types realImpl) {\n        this.realImpl = realImpl;\n    }\n\n    @Override\n    public Element asElement(TypeMirror arg0) {\n        return realImpl.asElement(arg0);\n    }\n\n    @Override\n    public TypeMirror asMemberOf(DeclaredType arg0,\n                                 Element arg1) {\n        return realImpl.asMemberOf(arg0,\n                                   arg1);\n    }\n\n    @Override\n    public TypeElement boxedClass(PrimitiveType arg0) {\n        return realImpl.boxedClass(arg0);\n    }\n\n    @Override\n    public TypeMirror capture(TypeMirror arg0) {\n        return realImpl.capture(arg0);\n    }\n\n    @Override\n    public boolean contains(TypeMirror arg0,\n                            TypeMirror arg1) {\n        return realImpl.contains(arg0,\n                                 arg1);\n    }\n\n    @Override\n    public List<? extends TypeMirror> directSupertypes(TypeMirror arg0) {\n        return realImpl.directSupertypes(arg0);\n    }\n\n    @Override\n    public TypeMirror erasure(TypeMirror arg0) {\n        return realImpl.erasure(arg0);\n    }\n\n    @Override\n    public ArrayType getArrayType(TypeMirror arg0) {\n        return realImpl.getArrayType(arg0);\n    }\n\n    @Override\n    public DeclaredType getDeclaredType(DeclaredType arg0,\n                                        TypeElement arg1,\n                                        TypeMirror... arg2) {\n        return realImpl.getDeclaredType(arg0,\n                                        arg1,\n                                        arg2);\n    }\n\n    @Override\n    public DeclaredType getDeclaredType(TypeElement arg0,\n                                        TypeMirror... arg1) {\n        return realImpl.getDeclaredType(arg0,\n                                        arg1);\n    }\n\n    @Override\n    public NoType getNoType(TypeKind arg0) {\n        return realImpl.getNoType(arg0);\n    }\n\n    @Override\n    public NullType getNullType() {\n        return realImpl.getNullType();\n    }\n\n    @Override\n    public PrimitiveType getPrimitiveType(TypeKind arg0) {\n        return realImpl.getPrimitiveType(arg0);\n    }\n\n    @Override\n    public WildcardType getWildcardType(TypeMirror arg0,\n                                        TypeMirror arg1) {\n        return realImpl.getWildcardType(arg0,\n                                        arg1);\n    }\n\n    @Override\n    public boolean isAssignable(TypeMirror arg0,\n                                TypeMirror arg1) {\n        return (arg0.getKind() == TypeKind.VOID && arg1.getKind() == TypeKind.VOID) || realImpl.isAssignable(arg0,\n                                                                                                             arg1);\n    }\n\n    @Override\n    public boolean isSameType(TypeMirror arg0,\n                              TypeMirror arg1) {\n        return realImpl.isSameType(arg0,\n                                   arg1);\n    }\n\n    @Override\n    public boolean isSubsignature(ExecutableType arg0,\n                                  ExecutableType arg1) {\n        return realImpl.isSubsignature(arg0,\n                                       arg1);\n    }\n\n    @Override\n    public boolean isSubtype(TypeMirror arg0,\n                             TypeMirror arg1) {\n        return realImpl.isSubtype(arg0,\n                                  arg1);\n    }\n\n    @Override\n    public PrimitiveType unboxedType(TypeMirror arg0) {\n        return realImpl.unboxedType(arg0);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/EditorActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class EditorActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n\n        final String annotationName = ClientAPIModule.getWorkbenchEditorClass();\n        final boolean isDynamic = ClientAPIModule.getWbEditorIsDynamicValueOnClass(classElement);\n        final String owningPlace = GeneratorUtils.getOwningPerspectivePlaceRequest(classElement,\n                                                                                   processingEnvironment);\n\n        Integer priority = 0;\n        Collection<String> associatedResources = null;\n        String identifier = null;\n        String lockingStrategy = null;\n        Integer preferredHeight = null;\n        Integer preferredWidth = null;\n\n        for (final AnnotationMirror am : classElement.getAnnotationMirrors()) {\n            if (annotationName.equals(am.getAnnotationType().toString())) {\n                for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) {\n                    AnnotationValue aval = entry.getValue();\n                    if (\"identifier\".equals(entry.getKey().getSimpleName().toString())) {\n                        identifier = aval.getValue().toString();\n                    } else if (\"priority\".equals(entry.getKey().getSimpleName().toString())) {\n                        priority = (Integer) aval.getValue();\n                    } else if (\"supportedTypes\".equals(entry.getKey().getSimpleName().toString())) {\n                        associatedResources = GeneratorUtils.extractValue(aval);\n                    } else if (\"preferredHeight\".equals(entry.getKey().getSimpleName().toString())) {\n                        final int _preferredHeight = (Integer) aval.getValue();\n                        if (_preferredHeight > 0) {\n                            preferredHeight = _preferredHeight;\n                        }\n                    } else if (\"preferredWidth\".equals(entry.getKey().getSimpleName().toString())) {\n                        final int _preferredWidth = (Integer) aval.getValue();\n                        if (_preferredWidth > 0) {\n                            preferredWidth = _preferredWidth;\n                        }\n                    } else if (\"lockingStrategy\".equals(entry.getKey().getSimpleName().toString())) {\n                        lockingStrategy = aval.getValue().toString();\n                    }\n                }\n                break;\n            }\n        }\n\n        if (associatedResources != null && associatedResources.size() > 0) {\n            for (final String resourceTypeName : associatedResources) {\n                final TypeElement resourceType = processingEnvironment.getElementUtils().getTypeElement(resourceTypeName);\n                if (resourceType.getAnnotation(ApplicationScoped.class) == null) {\n                    messager.printMessage(\n                            Kind.ERROR,\n                            \"This type is referenced as a resource from \" + className + \", so it must be @ApplicationScoped.\",\n                            resourceType);\n                }\n            }\n        }\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForEditors(classElement,\n                                                                                              processingEnvironment);\n\n        final String onStartup1ParameterMethodName;\n        final String onStartup2ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup1ParameterMethodName = null;\n            onStartup2ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().size() == 1) {\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup2ParameterMethodName = null;\n        } else {\n            onStartup1ParameterMethodName = null;\n            onStartup2ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onMayCloseMethodName = GeneratorUtils.getOnMayCloseMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String onLostFocusMethodName = GeneratorUtils.getOnLostFocusMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String onFocusMethodName = GeneratorUtils.getOnFocusMethodName(classElement,\n                                                                             processingEnvironment);\n        final String getDefaultPositionMethodName = GeneratorUtils.getDefaultPositionMethodName(classElement,\n                                                                                                processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final String getContextIdMethodName = GeneratorUtils.getContextIdMethodName(classElement,\n                                                                                    processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n        final boolean hasUberView = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n        final String isDirtyMethodName = GeneratorUtils.getIsDirtyMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onSaveMethodName = GeneratorUtils.getOnSaveMethodName(classElement,\n                                                                           processingEnvironment);\n        final String getMenuBarMethodName = GeneratorUtils.getMenuBarMethodName(classElement,\n                                                                                processingEnvironment);\n        final String getToolBarMethodName = GeneratorUtils.getToolBarMethodName(classElement,\n                                                                                processingEnvironment);\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"Locking strategy: \" + lockingStrategy);\n            messager.printMessage(Kind.NOTE,\n                                  \"Owning Perspective Identifier: \" + owningPlace);\n            messager.printMessage(Kind.NOTE,\n                                  \"getContextIdMethodName: \" + getContextIdMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Priority: \" + priority);\n            messager.printMessage(Kind.NOTE,\n                                  \"Resource types: \" + associatedResources);\n            messager.printMessage(Kind.NOTE,\n                                  \"Preferred Height: \" + preferredHeight);\n            messager.printMessage(Kind.NOTE,\n                                  \"Preferred Width: \" + preferredWidth);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup2ParameterMethodName: \" + onStartup2ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onMayCloseMethodName: \" + onMayCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onLostFocusMethodName: \" + onLostFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onFocusMethodName: \" + onFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getDefaultPositionMethodName: \" + getDefaultPositionMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasUberView: \" + Boolean.toString(hasUberView));\n            messager.printMessage(Kind.NOTE,\n                                  \"isDirtyMethodName: \" + isDirtyMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onSaveMethodName: \" + onSaveMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getMenuBarMethodName: \" + getMenuBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getToolBarMethodName: \" + getToolBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        //Validate getWidgetMethodName and isWidget\n        if (!isWidget && getWidgetMethodName == null) {\n            throw new GenerationException(\"The WorkbenchEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\",\n                                          packageName + \".\" + className);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchEditor both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n\n        //Validate getTitleMethodName\n        if (getTitleMethodName == null) {\n            throw new GenerationException(\"The WorkbenchEditor must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"lockingStrategy\",\n                 lockingStrategy);\n        root.put(\"owningPlace\",\n                 owningPlace);\n        root.put(\"getContextIdMethodName\",\n                 getContextIdMethodName);\n        root.put(\"priority\",\n                 priority.toString().replace(\",\",\n                                             \"\"));\n        root.put(\"associatedResources\",\n                 GeneratorUtils.formatAssociatedResources(associatedResources));\n        root.put(\"preferredHeight\",\n                 preferredHeight);\n        root.put(\"preferredWidth\",\n                 preferredWidth);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onStartup2ParameterMethodName\",\n                 onStartup2ParameterMethodName);\n        root.put(\"onMayCloseMethodName\",\n                 onMayCloseMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"onLostFocusMethodName\",\n                 onLostFocusMethodName);\n        root.put(\"onFocusMethodName\",\n                 onFocusMethodName);\n        root.put(\"getDefaultPositionMethodName\",\n                 getDefaultPositionMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasUberView\",\n                 hasUberView);\n        root.put(\"isDirtyMethodName\",\n                 isDirtyMethodName);\n        root.put(\"onSaveMethodName\",\n                 onSaveMethodName);\n        root.put(\"getMenuBarMethodName\",\n                 getMenuBarMethodName);\n        root.put(\"getToolBarMethodName\",\n                 getToolBarMethodName);\n        root.put(\"isDynamic\",\n                 isDynamic);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"activityEditor.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ExperimentalActivityGenerator.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Optional;\n\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\npublic class ExperimentalActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(String packageName, PackageElement packageElement, String className, Element element, ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE, \"Starting code generation for [\" + className + \"]\");\n\n        Map<String, Object> root = new HashMap<String, Object>();\n\n        //Extract required information\n        final TypeElement typeElement = (TypeElement) element;\n\n        String featureId = typeElement.getQualifiedName().toString();\n        String activityClass = typeElement.getQualifiedName().toString() + \"Activity\";\n        String activityId = extractActivityId(typeElement);\n        String activityType = ExperimentalFeatureProcessor.getActivityType((TypeElement) element).get();\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE, \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE, \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE, \"Feature Id: \" + featureId);\n            messager.printMessage(Kind.NOTE, \"Activity class: \" + activityClass);\n            messager.printMessage(Kind.NOTE, \"Activity Id: \" + activityId);\n            messager.printMessage(Kind.NOTE, \"Activity Type: \" + activityType);\n        }\n\n        root.put(\"packageName\", packageName);\n        root.put(\"className\", className);\n        root.put(\"featureId\", featureId);\n        root.put(\"activityClass\", activityClass);\n        root.put(\"activityId\", activityId);\n        root.put(\"activityType\", activityType);\n\n        //Generate code\n        try (StringWriter sw = new StringWriter();\n             BufferedWriter bw = new BufferedWriter(sw)) {\n            final Template template = config.getTemplate(\"experimentalFeatureActivity.ftl\");\n            template.process(root, bw);\n            messager.printMessage(Kind.NOTE, \"Successfully generated code for [\" + className + \"]\");\n\n            return sw.getBuffer();\n        } catch (Exception te) {\n            throw new GenerationException(te);\n        }\n    }\n\n    private String extractActivityId(TypeElement element) {\n        Optional<String> optional = getOptional(ClientAPIModule.getWbPerspectiveScreenIdentifierValueOnClass(element));\n\n        if (optional.isPresent()) {\n            return optional.get();\n        }\n\n        return getOptional(ClientAPIModule.getWbScreenIdentifierValueOnClass(element)).orElse(ClientAPIModule.getWbEditorIdentifierValueOnClass(element));\n    }\n\n    private Optional<String> getOptional(String identifier) {\n        return Optional.ofNullable(identifier).map(id -> id.isEmpty() ? null : id);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ExperimentalFeatureDefinitionProviderGenerator.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\npublic class ExperimentalFeatureDefinitionProviderGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(String packageName, PackageElement packageElement, String className, Element element, ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE, \"Starting code generation for [\" + className + \"]\");\n\n        Map<String, Object> root = new HashMap<String, Object>();\n\n        //Extract required information\n        final TypeElement typeElement = (TypeElement) element;\n\n        String featureId = typeElement.getQualifiedName().toString();\n        String group = ClientAPIModule.getExperimentalFeatureGroup(typeElement);\n        Boolean global = ClientAPIModule.isExperimentalFeatureGlobal(typeElement);\n        String nameKey = getNameKey(typeElement);\n        String descriptionKey = getDescriptionKey(typeElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Feature Id: \" + featureId);\n            messager.printMessage(Kind.NOTE,\n                                  \"Scope: \" + (global ? \"global\" : \"user\"));\n            messager.printMessage(Kind.NOTE,\n                                  \"Group: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Name key: \" + nameKey);\n            messager.printMessage(Kind.NOTE,\n                                  \"Description key: \" + descriptionKey);\n        }\n\n        root.put(\"packageName\", packageName);\n        root.put(\"className\", className);\n        root.put(\"featureId\", featureId);\n        root.put(\"global\", String.valueOf(global));\n        root.put(\"group\", group);\n        root.put(\"nameKey\", nameKey);\n        root.put(\"descriptionKey\", descriptionKey);\n\n        //Generate code\n        try (StringWriter sw = new StringWriter();\n             BufferedWriter bw = new BufferedWriter(sw)) {\n            final Template template = config.getTemplate(\"experimentalFeatureDefinitionProvider.ftl\");\n            template.process(root, bw);\n            messager.printMessage(Kind.NOTE,\n                                  \"Successfully generated code for [\" + className + \"]\");\n\n            return sw.getBuffer();\n        } catch (Exception te) {\n            throw new GenerationException(te);\n        }\n    }\n\n    private String getNameKey(TypeElement typeElement) {\n        String nameKey = ClientAPIModule.getExperimentalFeatureNameKey(typeElement);\n\n        if (nameKey.isEmpty()) {\n            nameKey = typeElement.getQualifiedName().toString();\n        }\n\n        return nameKey;\n    }\n\n    private String getDescriptionKey(TypeElement typeElement) {\n        return ClientAPIModule.getExperimentalFeatureDescriptionKey(typeElement);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ExperimentalFeatureProcessor.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Objects;\nimport java.util.Optional;\nimport java.util.Set;\n\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n@SupportedAnnotationTypes(ClientAPIModule.experimentalFeature)\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class ExperimentalFeatureProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private static final String PROVIDER_SUFFIX = \"ExperimentalFeatureDefinitionProvider\";\n    private static final String EXPERIMENTAL_ACTIVITY_SUFFIX = \"ExperimentalFeatureActivityReference\";\n\n    private static final String PERSPECTIVE = \"PERSPECTIVE\";\n    private static final String SCREEN = \"SCREEN\";\n    private static final String EDITOR = \"EDITOR\";\n\n    public static final Map<String, String> ACTIVITY_TYPES_MAPPING;\n\n    static {\n        ACTIVITY_TYPES_MAPPING = new HashMap<>();\n\n        ACTIVITY_TYPES_MAPPING.put(ClientAPIModule.getWorkbenchPerspectiveClass(), \"PERSPECTIVE\");\n        ACTIVITY_TYPES_MAPPING.put(ClientAPIModule.getWorkbenchScreenClass(), \"SCREEN\");\n        ACTIVITY_TYPES_MAPPING.put(ClientAPIModule.getWorkbenchEditorClass(), \"EDITOR\");\n    }\n\n    private ExperimentalFeatureDefinitionProviderGenerator providerGenerator;\n\n    private ExperimentalActivityGenerator experimentalActivityGenerator;\n\n    private GenerationCompleteCallback callback = null;\n\n    public ExperimentalFeatureProcessor() {\n        ExperimentalFeatureDefinitionProviderGenerator providerGen = null;\n        ExperimentalActivityGenerator activityGen = null;\n        try {\n            providerGen = new ExperimentalFeatureDefinitionProviderGenerator();\n            activityGen = new ExperimentalActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        providerGenerator = providerGen;\n        experimentalActivityGenerator = activityGen;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    ExperimentalFeatureProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    protected boolean processWithExceptions(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws Exception {\n\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.experimentalFeature))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Diagnostic.Kind.NOTE,\n                                      \"Discovered experimental feature [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String className = classElement.getSimpleName() + PROVIDER_SUFFIX;\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Diagnostic.Kind.NOTE, \"Generating code for [\" + className + \"]\");\n\n                    final StringBuffer code = providerGenerator.generate(packageName,\n                                                                         packageElement,\n                                                                         className,\n                                                                         classElement,\n                                                                         processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    write(packageName, className, code);\n\n                    if (getActivityType(classElement).isPresent()) {\n                        final String activityClassName = classElement.getSimpleName() + EXPERIMENTAL_ACTIVITY_SUFFIX;\n                        final StringBuffer activityCode = experimentalActivityGenerator.generate(packageName, packageElement, activityClassName, classElement, processingEnv);\n\n                        write(packageName, activityClassName, activityCode);\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n\n    public static Optional<String> getActivityType(TypeElement classElement) {\n        return classElement.getAnnotationMirrors().stream()\n                .map(mirror -> ACTIVITY_TYPES_MAPPING.get(mirror.getAnnotationType().toString()))\n                .filter(Objects::nonNull)\n                .findAny();\n    }\n\n    private void write(final String packageName, final String className, final StringBuffer code) throws IOException {\n        if (callback == null) {\n            writeCode(packageName, className, code);\n        } else {\n            callback.generationComplete(code.toString());\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/GenerationCompleteCallback.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\n/**\n * A call-back used for testing. When javac invokes the Annotation Processor the\n * generated source code is returned to the miscfeatures via this call-back rather than\n * having javac write the generated source code to a file and compiled.\n */\npublic interface GenerationCompleteCallback {\n\n    /**\n     * The source code has been generated.\n     * @param code The generated source code.\n     */\n    void generationComplete(final String code);\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/GeneratorUtils.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\n\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.inject.Qualifier;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.Modifier;\nimport javax.lang.model.element.Name;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.type.DeclaredType;\nimport javax.lang.model.type.TypeKind;\nimport javax.lang.model.type.TypeMirror;\nimport javax.lang.model.util.ElementFilter;\nimport javax.lang.model.util.Elements;\nimport javax.lang.model.util.SimpleAnnotationValueVisitor6;\nimport javax.lang.model.util.Types;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.APIModule;\nimport org.uberfire.annotations.processors.facades.BackendModule;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\nimport static java.util.Collections.singletonList;\nimport static org.uberfire.annotations.processors.facades.ClientAPIModule.OWNING_PERSPECTIVE;\nimport static org.uberfire.annotations.processors.facades.ClientAPIModule.workbenchEditor;\nimport static org.uberfire.annotations.processors.facades.ClientAPIModule.workbenchScreen;\n\n/**\n * Utilities for code generation\n */\npublic class GeneratorUtils {\n\n    /**\n     * Handy constant for an emtpy array of argument types.\n     */\n    private static final String[] NO_PARAMS = new String[0];\n\n    /**\n     * Passing a reference to exactly this array causes\n     * {@link #getAnnotatedMethods(TypeElement, ProcessingEnvironment, String, TypeMirror, String[])},\n     * {@link #getAnnotatedMethods(TypeElement, ProcessingEnvironment, String, TypeMirror[], String[])} and\n     * friends not to care about parameter types.\n     */\n    private static final String[] ANY_PARAMS = new String[0];\n\n    /**\n     * Finds the {@code @OnStartup} method suitable for workbench classes that are not {@code @WorkbenchEditor}.\n     * The method must be public, non-static, have a return-type of void and either take zero parameters or one\n     * parameter of type {@code PlaceRequest}.\n     * <p/>\n     * If no such method is found, returns null. If methods annotated with {@code @OnStartup} are found but they do not\n     * satisfy all the requirements, they are marked with errors explaining the problem.\n     */\n    public static ExecutableElement getOnStartupMethodForNonEditors(final TypeElement classElement,\n                                                                    final ProcessingEnvironment processingEnvironment) {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final TypeMirror requiredReturnType = typeUtils.getNoType(TypeKind.VOID);\n\n        List<ExecutableElement> onStartupMethods = getAnnotatedMethods(\n                classElement,\n                processingEnvironment,\n                APIModule.getOnStartupClass(),\n                requiredReturnType,\n                ANY_PARAMS);\n        Elements elementUtils = processingEnvironment.getElementUtils();\n\n        ExecutableElement zeroArgMethod = null;\n        ExecutableElement oneArgMethod = null;\n        for (ExecutableElement m : onStartupMethods) {\n            if (doParametersMatch(typeUtils,\n                                  elementUtils,\n                                  m,\n                                  NO_PARAMS)) {\n                zeroArgMethod = m;\n            } else if (doParametersMatch(typeUtils,\n                                         elementUtils,\n                                         m,\n                                         new String[]{APIModule.getPlaceRequestClass()})) {\n                oneArgMethod = m;\n            } else {\n                processingEnvironment.getMessager().printMessage(\n                        Kind.ERROR,\n                        formatProblemsList(APIModule.getOnStartupClass(),\n                                           singletonList(\"take no arguments or one argument of type \" + APIModule.getPlaceRequestClass())));\n            }\n        }\n\n        if (zeroArgMethod != null && oneArgMethod != null) {\n            // TODO multiple methods should be allowed, but only if inherited. See UF-42.\n            processingEnvironment.getMessager().printMessage(\n                    Kind.ERROR,\n                    \"Found multiple @OnStartup methods. Each class can declare at most one.\",\n                    zeroArgMethod);\n        }\n\n        if (oneArgMethod != null) {\n            return oneArgMethod;\n        }\n\n        return zeroArgMethod;\n    }\n\n    public static ExecutableElement getSetContentMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) {\n        return getUniqueAnnotatedMethod(\n                classElement,\n                processingEnvironment,\n                APIModule.getSetContentClass(),\n                new TypeMirror[]{\n                        processingEnvironment.getElementUtils().getTypeElement(\"elemental2.promise.Promise\").asType()\n                },\n                new String[]{\"java.lang.String\", \"java.lang.String\"});\n    }\n\n    public static ExecutableElement getGetContentMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) {\n        return getUniqueAnnotatedMethod(classElement,\n                                        processingEnvironment,\n                                        APIModule.getGetContentClass(),\n                                        new TypeMirror[]{\n                                                processingEnvironment.getElementUtils().getTypeElement(\"elemental2.promise.Promise\").asType()\n                                        },\n                                        NO_PARAMS);\n    }\n\n\n    public static ExecutableElement getGetPreviewMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) {\n        return getUniqueAnnotatedMethod(classElement,\n                                        processingEnvironment,\n                                        APIModule.getGetPreviewClass(),\n                                        new TypeMirror[]{\n                                                processingEnvironment.getElementUtils().getTypeElement(\"elemental2.promise.Promise\").asType()\n                                        },\n                                        NO_PARAMS);\n    }\n\n    /**\n     * Finds the {@code @OnStartup} method suitable for {@code @WorkbenchEditor} classes.\n     * The method must be public, non-static, have a return-type of void and either take one parameter\n     * of type {@code Path} or two parameters of type {@code (Path, PlaceRequest)}.\n     * <p/>\n     * If no such method is found, returns null. If methods annotated with {@code @OnStartup} are found but they do not\n     * satisfy all the requirements, they are marked with errors explaining the problem.\n     */\n    public static ExecutableElement getOnStartupMethodForEditors(final TypeElement classElement,\n                                                                 final ProcessingEnvironment processingEnvironment) {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final TypeMirror requiredReturnType = typeUtils.getNoType(TypeKind.VOID);\n\n        List<ExecutableElement> onStartupMethods = getAnnotatedMethods(\n                classElement,\n                processingEnvironment,\n                APIModule.getOnStartupClass(),\n                requiredReturnType,\n                ANY_PARAMS);\n        Elements elementUtils = processingEnvironment.getElementUtils();\n\n        ExecutableElement oneArgMethod = null;\n        ExecutableElement twoArgMethod = null;\n        for (ExecutableElement m : onStartupMethods) {\n            if (doParametersMatch(typeUtils,\n                                  elementUtils,\n                                  m,\n                                  new String[]{BackendModule.getPathClass()})) {\n                oneArgMethod = m;\n            } else if (doParametersMatch(typeUtils,\n                                         elementUtils,\n                                         m,\n                                         new String[]{BackendModule.getPathClass(), APIModule.getPlaceRequestClass()})) {\n                twoArgMethod = m;\n            } else {\n                processingEnvironment.getMessager().printMessage(\n                        Kind.ERROR,\n                        formatProblemsList(APIModule.getOnStartupClass(),\n                                           singletonList(\"take one argument of type \" + BackendModule.getPathClass() + \" and an optional second argument of type \" + APIModule.getPlaceRequestClass())));\n            }\n        }\n\n        if (oneArgMethod != null && twoArgMethod != null) {\n            // TODO make this an error (need to take inherited methods into account). See UF-76.\n            processingEnvironment.getMessager().printMessage(\n                    Kind.WARNING,\n                    \"There is also an @OnStartup(Path, PlaceRequest) method in this class. That method takes precedence over this one.\",\n                    oneArgMethod);\n        }\n\n        if (twoArgMethod != null) {\n            return twoArgMethod;\n        }\n\n        return oneArgMethod;\n    }\n\n    public static String getOnContextAttachPanelDefinitionMethodName(final TypeElement classElement,\n                                                                     final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 new String[]{APIModule.getPanelDefinitionClass()},\n                                 APIModule.getOnContextAttachClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnMayClose}. The method must\n     * be public, non-static, have a return-type of void and take zero\n     * parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnMayCloseMethodName(final TypeElement classElement,\n                                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getBooleanMethodName(classElement,\n                                    processingEnvironment,\n                                    APIModule.getOnMayCloseClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnClose}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnCloseMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnCloseClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnShutdown}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnShutdownMethodName(final TypeElement classElement,\n                                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnShutdownlass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnOpen}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnOpenMethodName(final TypeElement classElement,\n                                             final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnOpenClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnLostFocus}. The method must\n     * be public, non-static, have a return-type of void and take zero\n     * parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnLostFocusMethodName(final TypeElement classElement,\n                                                  final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnLostFocusClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnFocus}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnFocusMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnFocusClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @DefaultPosition}. The method\n     * must be public, non-static, have a return-type of void and take zero\n     * parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getDefaultPositionMethodName(final TypeElement classElement,\n                                                      final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getDefaultPositionMethodName(classElement,\n                                            processingEnvironment,\n                                            ClientAPIModule.getDefaultPositionClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchPartTitle}. The\n     * method must be public, non-static, have a return-type of java.lang.String\n     * and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getTitleMethodName(final TypeElement classElement,\n                                            final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getStringMethodName(classElement,\n                                   processingEnvironment,\n                                   ClientAPIModule.getWorkbenchPartTitleClass());\n    }\n\n    public static String getContextIdMethodName(final TypeElement classElement,\n                                                final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getStringMethodName(classElement,\n                                   processingEnvironment,\n                                   ClientAPIModule.getWorkbenchContextIdClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchPartTitleDecoration}. The\n     * method must be public, non-static, have a return-type of\n     * com.google.gwt.user.client.ui.IsWidget and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static ExecutableElement getTitleWidgetMethodName(final TypeElement classElement,\n                                                             final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getWidgetMethodName(classElement,\n                                   processingEnvironment,\n                                   ClientAPIModule.getWorkbenchPartTitleDecorationsClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchPartView}. The method\n     * must be public, non-static, have a return-type of IsWidget and take zero\n     * parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static ExecutableElement getWidgetMethodName(final TypeElement classElement,\n                                                        final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getWidgetMethodName(classElement,\n                                   processingEnvironment,\n                                   ClientAPIModule.getWorkbenchPartViewClass());\n    }\n\n    /**\n     * Check whether the provided type extends IsWidget.\n     * @param classElement\n     * @param processingEnvironment\n     * @return\n     */\n    public static boolean getIsWidget(final TypeElement classElement,\n                                      final ProcessingEnvironment processingEnvironment) {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(\"com.google.gwt.user.client.ui.IsWidget\").asType();\n        return typeUtils.isAssignable(classElement.asType(),\n                                      requiredReturnType);\n    }\n\n    /**\n     * Check whether the provided type extends IsElement.\n     * @param type\n     * @param processingEnvironment\n     * @return\n     */\n    public static boolean getIsElement(final TypeMirror type,\n                                       final ProcessingEnvironment processingEnvironment) {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror deprecatedIsElement = elementUtils.getTypeElement(\"org.jboss.errai.common.client.api.IsElement\").asType();\n        final TypeMirror elemental2IsElement = elementUtils.getTypeElement(\"org.jboss.errai.common.client.api.elemental2.IsElement\").asType();\n        return typeUtils.isAssignable(type,\n                                      deprecatedIsElement) || typeUtils.isAssignable(type,\n                                                                                     elemental2IsElement);\n    }\n\n    public static boolean hasPresenterInitMethod(final TypeElement classElement,\n                                                 final ProcessingEnvironment processingEnvironment,\n                                                 final ExecutableElement getWidgetMethod) {\n        if (getWidgetMethod == null) {\n            return false;\n        }\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(\"org.uberfire.client.mvp.HasPresenter\").asType();\n\n        return typeUtils.isAssignable(typeUtils.erasure(getWidgetMethod.getReturnType()),\n                                      requiredReturnType);\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchPartView}. The method\n     * must be public, non-static, have a return-type of PopupPanel and take\n     * zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getPopupMethodName(final TypeElement classElement,\n                                            final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getPopupMethodName(classElement,\n                                  processingEnvironment,\n                                  ClientAPIModule.getWorkbenchPartViewClass());\n    }\n\n    /**\n     * Check whether the provided type extends PopupPanel.\n     * @param classElement\n     * @param processingEnvironment\n     * @return\n     */\n    public static boolean getIsPopup(final TypeElement classElement,\n                                     final ProcessingEnvironment processingEnvironment) {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(\"com.google.gwt.user.client.ui.PopupPanel\").asType();\n        return typeUtils.isAssignable(classElement.asType(),\n                                      requiredReturnType);\n    }\n\n    /**\n     * Get the method name annotated with {@code @IsDirty}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getIsDirtyMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getBooleanMethodName(classElement,\n                                    processingEnvironment,\n                                    APIModule.getIsDirtyClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @OnSave}. The method must be\n     * public, non-static, have a return-type of void and take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getOnSaveMethodName(final TypeElement classElement,\n                                             final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getVoidMethodName(classElement,\n                                 processingEnvironment,\n                                 APIModule.getOnSaveClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchMenu}. The method\n     * must be public, non-static, have a return-type of WorkbenchMenuBar and\n     * take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getMenuBarMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getMenuBarMethodName(classElement,\n                                    processingEnvironment,\n                                    ClientAPIModule.getWorkbenchMenuClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @WorkbenchToolBar}. The method\n     * must be public, non-static, have a return-type of WorkbenchToolBar and\n     * take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getToolBarMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getToolBarMethodName(classElement,\n                                    processingEnvironment,\n                                    ClientAPIModule.getWorkbenchToolBarClass());\n    }\n\n    /**\n     * Get the method name annotated with {@code @Perspective}. The method must\n     * be public, non-static, have a return-type of PerspectiveDefinition and\n     * take zero parameters.\n     * @param classElement\n     * @param processingEnvironment\n     * @return null if none found\n     * @throws GenerationException\n     */\n    public static String getPerspectiveMethodName(final TypeElement classElement,\n                                                  final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getMethodName(classElement,\n                             processingEnvironment,\n                             \"org.uberfire.workbench.model.PerspectiveDefinition\",\n                             ClientAPIModule.getPerspectiveClass());\n    }\n\n    public static String getSplashFilterMethodName(final TypeElement classElement,\n                                                   final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getMethodName(classElement,\n                             processingEnvironment,\n                             \"org.uberfire.workbench.model.SplashScreenFilter\",\n                             ClientAPIModule.getSplashFilterClass());\n    }\n\n    public static String getBodyHeightMethodName(TypeElement classElement,\n                                                 ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getMethodName(classElement,\n                             processingEnvironment,\n                             \"java.lang.Integer\",\n                             ClientAPIModule.getSplashBodyHeightClass());\n    }\n\n    public static String getInterceptMethodName(final TypeElement classElement,\n                                                final ProcessingEnvironment processingEnvironment) throws GenerationException {\n        return getMethodName(classElement,\n                             processingEnvironment,\n                             \"java.lang.Boolean\",\n                             ClientAPIModule.getInterceptClass());\n    }\n\n    public static String getBeanActivatorClassName(final TypeElement classElement,\n                                                   final ProcessingEnvironment processingEnvironment) {\n        AnnotationMirror activatedByAnnotation = getAnnotation(processingEnvironment.getElementUtils(),\n                                                               classElement,\n                                                               APIModule.activatedBy);\n        if (activatedByAnnotation != null) {\n            return extractAnnotationStringValue(processingEnvironment.getElementUtils(),\n                                                activatedByAnnotation,\n                                                \"value\");\n        }\n        return null;\n    }\n\n    /**\n     * Returns the identifier (PlaceRequest ID) of the perspective that owns the given part.\n     * @param screenOrEditorClass a type annotated with either {@code @WorkbenchScreen} or {@code @WorkbenchEditor}. Not null.\n     * @param processingEnvironment the current annotation processing environment.\n     * @return\n     * @throws GenerationException if the owningPerspective parameter is present, but points to something other than a\n     * {@code @WorkbenchPerspective} class.\n     */\n    public static String getOwningPerspectivePlaceRequest(TypeElement screenOrEditorClass,\n                                                          ProcessingEnvironment processingEnvironment) throws GenerationException {\n        Elements elementUtils = processingEnvironment.getElementUtils();\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n\n        AnnotationMirror screenOrEditorAnnotation = getAnnotation(elementUtils,\n                                                                  screenOrEditorClass,\n                                                                  workbenchScreen);\n        if (screenOrEditorAnnotation == null) {\n            screenOrEditorAnnotation = getAnnotation(elementUtils,\n                                                     screenOrEditorClass,\n                                                     workbenchEditor);\n        }\n\n        AnnotationValue owningPerspectiveParam = extractAnnotationPropertyValue(elementUtils,\n                                                                                screenOrEditorAnnotation,\n                                                                                OWNING_PERSPECTIVE);\n        final TypeElement owningPerspectiveType = (TypeElement) typeUtils.asElement((TypeMirror) owningPerspectiveParam.getValue());\n        if (owningPerspectiveType == null) {\n            return null;\n        }\n\n        final String owningPerspectivePlace = ClientAPIModule.getWbPerspectiveScreenIdentifierValueOnClass(owningPerspectiveType);\n        if (owningPerspectivePlace.equals(\"\")) {\n            processingEnvironment.getMessager()\n                    .printMessage(Kind.ERROR,\n                                  \"owningPerspective must be a class annotated with @WorkbenchPerspective.\",\n                                  screenOrEditorClass,\n                                  screenOrEditorAnnotation,\n                                  owningPerspectiveParam);\n            return null;\n        }\n        return owningPerspectivePlace;\n    }\n\n    /**\n     * Searches for an accessible method annotated with the given annotation. The method must be non-private,\n     * non-static, take no arguments, and return void.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem.\n     * @param classElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for\n     * @return the name of the method that satisfies all the requirements and bears the given annotation, or null if\n     * there is no such method.\n     */\n    private static String getVoidMethodName(final TypeElement classElement,\n                                            final ProcessingEnvironment processingEnvironment,\n                                            final String annotationName) throws GenerationException {\n\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final TypeMirror requiredReturnType = typeUtils.getNoType(TypeKind.VOID);\n\n        ExecutableElement match = getUniqueAnnotatedMethod(\n                classElement,\n                processingEnvironment,\n                annotationName,\n                requiredReturnType,\n                NO_PARAMS);\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    // Lookup a public method name with the given annotation. The method must be\n    // public, non-static, have a return-type of void and take parameters matching\n    // those provided.\n    private static String getVoidMethodName(final TypeElement classElement,\n                                            final ProcessingEnvironment processingEnvironment,\n                                            final String[] parameterTypes,\n                                            final String annotationName) throws GenerationException {\n\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = typeUtils.getNoType(TypeKind.VOID);\n        final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n        ExecutableElement match = null;\n        for (ExecutableElement e : methods) {\n\n            final TypeMirror actualReturnType = e.getReturnType();\n\n            //Check method\n            if (getAnnotation(elementUtils,\n                              e,\n                              annotationName) == null) {\n                continue;\n            }\n            if (!typeUtils.isSameType(actualReturnType,\n                                      requiredReturnType)) {\n                continue;\n            }\n            if (!doParametersMatch(typeUtils,\n                                   elementUtils,\n                                   e,\n                                   parameterTypes)) {\n                continue;\n            }\n            if (e.getModifiers().contains(Modifier.STATIC)) {\n                continue;\n            }\n            if (!e.getModifiers().contains(Modifier.PUBLIC)) {\n                continue;\n            }\n            if (match != null) {\n                throw new GenerationException(\"Multiple methods with @\" + fqcnToSimpleName(annotationName) + \" detected.\");\n            }\n            match = e;\n        }\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Checks whether the ExecutableElement's parameter list matches the requiredParameterTypes (order matters).\n     * @param typeUtils type utils from current processing environment.\n     * @param elementUtils element utils from current processing environment.\n     * @param e the method whose parameter list to check.\n     * @param requiredParameterTypes the required parameter types. Must not be null.\n     * If a reference to {@link #ANY_PARAMS}, this method returns true without any further checks.\n     * @return true if the target method's parameter list matches the given required parameter types, or if the special\n     * {@link #ANY_PARAMS} value is passed as {@code requiredParameterTypes}. False otherwise.\n     */\n    private static boolean doParametersMatch(final Types typeUtils,\n                                             final Elements elementUtils,\n                                             final ExecutableElement e,\n                                             final String[] requiredParameterTypes) {\n        if (requiredParameterTypes == ANY_PARAMS) {\n            return true;\n        }\n        if (e.getParameters().size() != requiredParameterTypes.length) {\n            return false;\n        }\n        List<TypeMirror> requiredTypes = new ArrayList<TypeMirror>();\n        for (String parameterType : requiredParameterTypes) {\n            requiredTypes.add(elementUtils.getTypeElement(parameterType).asType());\n        }\n        for (int i = 0; i < requiredTypes.size(); i++) {\n            final TypeMirror actualType = e.getParameters().get(i).asType();\n            final TypeMirror requiredType = requiredTypes.get(i);\n            if (!typeUtils.isAssignable(actualType,\n                                        requiredType)) {\n                return false;\n            }\n        }\n        return true;\n    }\n\n    /**\n     * Finds a public, non-static, no-args method annotated with the given annotation which returns boolean.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param classElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for\n     * @return null if no such method exists; otherwise, the method's name.\n     */\n    private static String getBooleanMethodName(final TypeElement classElement,\n                                               final ProcessingEnvironment processingEnvironment,\n                                               final String annotationName) throws GenerationException {\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(Boolean.class.getName()).asType();\n        ExecutableElement match = getUniqueAnnotatedMethod(\n                classElement,\n                processingEnvironment,\n                annotationName,\n                requiredReturnType,\n                NO_PARAMS);\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Finds a public, non-static, no-args method annotated with the given annotation which returns String.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @return null if no such method exists; otherwise, the method's name.\n     */\n    private static String getStringMethodName(final TypeElement classElement,\n                                              final ProcessingEnvironment processingEnvironment,\n                                              final String annotationName) throws GenerationException {\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        ExecutableElement match = getUniqueAnnotatedMethod(classElement,\n                                                           processingEnvironment,\n                                                           annotationName,\n                                                           elementUtils.getTypeElement(String.class.getName()).asType(),\n                                                           NO_PARAMS);\n\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Finds a public, non-static, no-args method annotated with the given annotation which returns boolean.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @return null if no such method exists; otherwise, the method's name.\n     */\n    private static ExecutableElement getWidgetMethodName(final TypeElement originalClassElement,\n                                                         final ProcessingEnvironment processingEnvironment,\n                                                         final String annotationName) throws GenerationException {\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        return getUniqueAnnotatedMethod(originalClassElement,\n                                        processingEnvironment,\n                                        annotationName,\n                                        new TypeMirror[]{\n                                                elementUtils.getTypeElement(\"com.google.gwt.user.client.ui.IsWidget\").asType(),\n                                                elementUtils.getTypeElement(\"org.jboss.errai.common.client.api.IsElement\").asType(),\n                                                elementUtils.getTypeElement(\"org.jboss.errai.common.client.api.elemental2.IsElement\").asType()\n                                        },\n                                        NO_PARAMS);\n    }\n\n    /**\n     * Finds a public, non-static, method annotated with the given annotation which returns the given type and accepts\n     * the given arguments.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem. This will trigger a compilation failure.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param originalClassElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for.\n     * @param requiredReturnType the fully qualified name of the type the method must return.\n     * @param requiredParameterTypes the parameter types the method must take. If the method must take no parameters, use\n     * {@link #NO_PARAMS}. If the method can take any parameters, use {@link #ANY_PARAMS}.\n     * @return null if no such method exists; null if multiple methods satisfying the criteria are found; otherwise, a\n     * reference to the method.\n     */\n    private static ExecutableElement getUniqueAnnotatedMethod(final TypeElement originalClassElement,\n                                                              final ProcessingEnvironment processingEnvironment,\n                                                              final String annotationName,\n                                                              final TypeMirror requiredReturnType,\n                                                              final String[] requiredParameterTypes) {\n\n        return getUniqueAnnotatedMethod(originalClassElement,\n                                        processingEnvironment,\n                                        annotationName,\n                                        new TypeMirror[]{requiredReturnType},\n                                        requiredParameterTypes);\n    }\n\n    /**\n     * Finds a public, non-static, method annotated with the given annotation which returns the given type and accepts\n     * the given arguments.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem. This will trigger a compilation failure.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param originalClassElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for.\n     * @param requiredReturnType the fully qualified name of the type the method must return.\n     * @param requiredParameterTypes the parameter types the method must take. If the method must take no parameters, use\n     * {@link #NO_PARAMS}. If the method can take any parameters, use {@link #ANY_PARAMS}.\n     * @return null if no such method exists; null if multiple methods satisfying the criteria are found; otherwise, a\n     * reference to the method.\n     */\n    private static ExecutableElement getUniqueAnnotatedMethod(final TypeElement originalClassElement,\n                                                              final ProcessingEnvironment processingEnvironment,\n                                                              final String annotationName,\n                                                              final TypeMirror[] requiredReturnType,\n                                                              final String[] requiredParameterTypes) {\n\n        List<ExecutableElement> matches = getAnnotatedMethods(\n                originalClassElement,\n                processingEnvironment,\n                annotationName,\n                requiredReturnType,\n                requiredParameterTypes);\n\n        if (matches.size() == 1) {\n            return matches.get(0);\n        } else if (matches.size() > 1) {\n            for (ExecutableElement match : matches) {\n                processingEnvironment.getMessager().printMessage(\n                        Kind.ERROR,\n                        \"Found multiple methods annotated with @\" + fqcnToSimpleName(annotationName) + \". There should only be one.\",\n                        match);\n            }\n        }\n\n        return null;\n    }\n\n    /**\n     * Finds all public, non-static, no-args method annotated with the given annotation which returns the given type.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem. This will trigger a compilation failure.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param originalClassElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for.\n     * @param requiredReturnType the fully qualified name of the type the method must return.\n     * @param requiredParameterTypes the parameter types the method must take. If the method must take no parameters, use\n     * {@link #NO_PARAMS}. If the method can take any parameters, use {@link #ANY_PARAMS}.\n     * @return a list of references to the methods that satisfy the criteria (empty list if no such method exists).\n     */\n    private static List<ExecutableElement> getAnnotatedMethods(final TypeElement originalClassElement,\n                                                               final ProcessingEnvironment processingEnvironment,\n                                                               final String annotationName,\n                                                               final TypeMirror requiredReturnType,\n                                                               final String[] requiredParameterTypes) {\n        return getAnnotatedMethods(originalClassElement,\n                                   processingEnvironment,\n                                   annotationName,\n                                   new TypeMirror[]{requiredReturnType},\n                                   requiredParameterTypes);\n    }\n\n    /**\n     * Finds all public, non-static, no-args method annotated with the given annotation which returns the given type.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem. This will trigger a compilation failure.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param originalClassElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param annotationName the fully-qualified name of the annotation to search for.\n     * @param requiredReturnTypes the fully qualified names of the valid types the method must return.\n     * @param requiredParameterTypes the parameter types the method must take. If the method must take no parameters, use\n     * {@link #NO_PARAMS}. If the method can take any parameters, use {@link #ANY_PARAMS}.\n     * @return a list of references to the methods that satisfy the criteria (empty list if no such method exists).\n     */\n    private static List<ExecutableElement> getAnnotatedMethods(final TypeElement originalClassElement,\n                                                               final ProcessingEnvironment processingEnvironment,\n                                                               final String annotationName,\n                                                               final TypeMirror[] requiredReturnTypes,\n                                                               final String[] requiredParameterTypes) {\n\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        TypeElement classElement = originalClassElement;\n        while (true) {\n            final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n            List<ExecutableElement> matches = new ArrayList<ExecutableElement>();\n            for (ExecutableElement e : methods) {\n\n                final TypeMirror actualReturnType = e.getReturnType();\n\n                if (getAnnotation(elementUtils,\n                                  e,\n                                  annotationName) == null) {\n                    continue;\n                }\n\n                List<String> problems = new ArrayList<String>();\n\n                boolean foundRequiredType = false;\n                for (TypeMirror requiredReturnType : requiredReturnTypes) {\n                    if (typeUtils.isAssignable(actualReturnType,\n                                               requiredReturnType)) {\n                        foundRequiredType = true;\n                        break;\n                    }\n                }\n\n                if (!foundRequiredType) {\n                    if (requiredReturnTypes.length == 1) {\n                        problems.add(\"return \" + requiredReturnTypes[0]);\n                    } else {\n                        final StringBuilder types = new StringBuilder(\"{\");\n                        for (final TypeMirror requiredReturnType : requiredReturnTypes) {\n                            types.append(requiredReturnType).append(\", \");\n                        }\n                        problems.add(\"return \" + types.substring(0,\n                                                                 types.length() - 2) + \"}\");\n                    }\n                }\n\n                if (!doParametersMatch(typeUtils,\n                                       elementUtils,\n                                       e,\n                                       requiredParameterTypes)) {\n                    if (requiredParameterTypes.length == 0) {\n                        problems.add(\"take no parameters\");\n                    } else {\n                        StringBuilder sb = new StringBuilder();\n                        sb.append(\"take \").append(requiredParameterTypes).append(\" parameters of type (\");\n                        boolean first = true;\n                        for (String p : requiredParameterTypes) {\n                            if (!first) {\n                                sb.append(\", \");\n                            }\n                            sb.append(p);\n                            first = false;\n                        }\n                        sb.append(\")\");\n                        problems.add(sb.toString());\n                    }\n                }\n                if (e.getModifiers().contains(Modifier.STATIC)) {\n                    problems.add(\"be non-static\");\n                }\n                if (e.getModifiers().contains(Modifier.PRIVATE)) {\n                    problems.add(\"be non-private\");\n                }\n\n                if (problems.isEmpty()) {\n                    matches.add(e);\n                } else {\n                    processingEnvironment.getMessager().printMessage(\n                            Kind.ERROR,\n                            formatProblemsList(annotationName,\n                                               problems),\n                            e);\n                }\n            }\n\n            if (!matches.isEmpty()) {\n                return matches;\n            }\n\n            TypeMirror superclass = classElement.getSuperclass();\n            if (superclass instanceof DeclaredType) {\n                classElement = (TypeElement) ((DeclaredType) superclass).asElement();\n            } else {\n                break;\n            }\n        }\n\n        return Collections.emptyList();\n    }\n\n    /**\n     * Renders the given list of problems with an annotated method as an English sentence.\n     * The sentence takes the form \"Methods annotated with <i>annotationSimpleName</i> must <i>list of problems</i>\".\n     * Commas and \"and\" are inserted as appropriate.\n     * @param annotationFqcn the fully-qualified name of the annotation the problems pertain to.\n     * @param problems the list of problems, as verb phrases. Must not be null, and should contain at least one item.\n     * @return a nice English sentence summarizing the problems.\n     */\n    static String formatProblemsList(final String annotationFqcn,\n                                     List<String> problems) {\n        StringBuilder msg = new StringBuilder();\n        msg.append(\"Methods annotated with @\")\n                .append(fqcnToSimpleName(annotationFqcn))\n                .append(\" must \");\n        for (int i = 0; i < problems.size(); i++) {\n            if (problems.size() > 2 && i > 0) {\n                msg.append(\", \");\n            }\n            if (problems.size() == 2 && i == 1) {\n                msg.append(\" and \");\n            }\n            if (problems.size() > 2 && i == problems.size() - 1) {\n                msg.append(\"and \");\n            }\n            msg.append(problems.get(i));\n        }\n        return msg.toString();\n    }\n\n    /**\n     * Lookup a public method name with the given annotation. The method must be\n     * public, non-static, have a return-type of PopupPanel and take zero\n     * parameters.\n     */\n    private static String getPopupMethodName(final TypeElement classElement,\n                                             final ProcessingEnvironment processingEnvironment,\n                                             final String annotationName) throws GenerationException {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(\"com.google.gwt.user.client.ui.PopupPanel\").asType();\n        final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n        ExecutableElement match = null;\n        for (ExecutableElement e : methods) {\n\n            final TypeMirror actualReturnType = e.getReturnType();\n\n            //Check method\n            if (getAnnotation(elementUtils,\n                              e,\n                              annotationName) == null) {\n                continue;\n            }\n            if (!typeUtils.isAssignable(actualReturnType,\n                                        requiredReturnType)) {\n                continue;\n            }\n            if (e.getParameters().size() != 0) {\n                continue;\n            }\n            if (e.getModifiers().contains(Modifier.STATIC)) {\n                continue;\n            }\n            if (!e.getModifiers().contains(Modifier.PUBLIC)) {\n                continue;\n            }\n            if (match != null) {\n                throw new GenerationException(\"Multiple methods with @\" + fqcnToSimpleName(annotationName) + \" detected.\");\n            }\n            match = e;\n        }\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Looks up a public method name with the given annotation. The method must be\n     * public, non-static, have a return-type of Position and take zero\n     * parameters.\n     */\n    private static String getDefaultPositionMethodName(final TypeElement classElement,\n                                                       final ProcessingEnvironment processingEnvironment,\n                                                       final String annotationName) throws GenerationException {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(APIModule.getPositionClass()).asType();\n        final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n        ExecutableElement match = null;\n        for (ExecutableElement e : methods) {\n\n            final TypeMirror actualReturnType = e.getReturnType();\n\n            //Check method\n            if (getAnnotation(elementUtils,\n                              e,\n                              annotationName) == null) {\n                continue;\n            }\n            if (!typeUtils.isAssignable(actualReturnType,\n                                        requiredReturnType)) {\n                continue;\n            }\n            if (e.getParameters().size() != 0) {\n                continue;\n            }\n            if (e.getModifiers().contains(Modifier.STATIC)) {\n                continue;\n            }\n            if (!e.getModifiers().contains(Modifier.PUBLIC)) {\n                continue;\n            }\n            if (match != null) {\n                throw new GenerationException(\"Multiple methods with @\" + fqcnToSimpleName(annotationName) + \" detected.\");\n            }\n            match = e;\n        }\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    public static AnnotationMirror getAnnotation(Elements elementUtils,\n                                                 Element annotationTarget,\n                                                 String annotationName) {\n        for (AnnotationMirror annotation : elementUtils.getAllAnnotationMirrors(annotationTarget)) {\n            if (annotationName.contentEquals(getQualifiedName(annotation))) {\n                return annotation;\n            }\n        }\n        return null;\n    }\n\n    public static Name getQualifiedName(AnnotationMirror annotation) {\n        return ((TypeElement) annotation.getAnnotationType().asElement()).getQualifiedName();\n    }\n\n    // Lookup a public method name with the given annotation. The method must be\n    // public, non-static, void and take one parameter.\n    private static String getMenuBarMethodName(final TypeElement classElement,\n                                               final ProcessingEnvironment processingEnvironment,\n                                               final String annotationName) throws GenerationException {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n        ExecutableElement match = null;\n        for (ExecutableElement e : methods) {\n\n            final TypeMirror actualReturnType = e.getReturnType();\n\n            //Check method\n            if (getAnnotation(elementUtils,\n                              e,\n                              annotationName) == null) {\n                continue;\n            }\n            if (TypeKind.VOID != actualReturnType.getKind()) {\n                continue;\n            }\n            if (e.getParameters().size() != 1) {\n                continue;\n            }\n            if (e.getModifiers().contains(Modifier.STATIC)) {\n                continue;\n            }\n            if (!e.getModifiers().contains(Modifier.PUBLIC)) {\n                continue;\n            }\n            if (match != null) {\n                throw new GenerationException(\"Multiple methods with @\" + fqcnToSimpleName(annotationName) + \" detected.\");\n            }\n            match = e;\n        }\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    // Lookup a public method name with the given annotation. The method must be\n    // public, non-static, have a return-type of WorkbenchToolBar and take zero\n    // parameters.\n    private static String getToolBarMethodName(final TypeElement classElement,\n                                               final ProcessingEnvironment processingEnvironment,\n                                               final String annotationName) throws GenerationException {\n        final Types typeUtils = processingEnvironment.getTypeUtils();\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(\"org.uberfire.workbench.model.toolbar.ToolBar\").asType();\n        final List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());\n\n        ExecutableElement match = null;\n        for (ExecutableElement e : methods) {\n\n            final TypeMirror actualReturnType = e.getReturnType();\n\n            //Check method\n            if (getAnnotation(elementUtils,\n                              e,\n                              annotationName) == null) {\n                continue;\n            }\n            if (!typeUtils.isAssignable(actualReturnType,\n                                        requiredReturnType)) {\n                continue;\n            }\n            if (e.getParameters().size() != 0) {\n                continue;\n            }\n            if (e.getModifiers().contains(Modifier.STATIC)) {\n                continue;\n            }\n            if (!e.getModifiers().contains(Modifier.PUBLIC)) {\n                continue;\n            }\n            if (match != null) {\n                throw new GenerationException(\"Multiple methods with @\" + fqcnToSimpleName(annotationName) + \" detected.\");\n            }\n            match = e;\n        }\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Finds a public, non-static, no-args method annotated with the given annotation which returns the given type.\n     * <p/>\n     * If a method with the given annotation is found but the method does not satisfy the requirements listed above, the\n     * method will be marked with an error explaining the problem.\n     * <p/>\n     * If more than one method satisfies all the criteria, all such methods are marked with an error explaining the\n     * problem.\n     * @param classElement the class to search for the annotated method.\n     * @param processingEnvironment the current annotation processing environment.\n     * @param expectedReturnType the fully-qualified name of the type the method must return.\n     * @param annotationName the fully-qualified name of the annotation to search for.\n     * @return null if no such method exists; otherwise, the method's name.\n     */\n    private static String getMethodName(final TypeElement classElement,\n                                        final ProcessingEnvironment processingEnvironment,\n                                        final String expectedReturnType,\n                                        final String annotationName) throws GenerationException {\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n        final TypeMirror requiredReturnType = elementUtils.getTypeElement(expectedReturnType).asType();\n        ExecutableElement match = getUniqueAnnotatedMethod(\n                classElement,\n                processingEnvironment,\n                annotationName,\n                requiredReturnType,\n                NO_PARAMS);\n        if (match == null) {\n            return null;\n        }\n        return match.getSimpleName().toString();\n    }\n\n    /**\n     * Provides a uniform way of working with single- and multi-valued AnnotationValue objects.\n     * @return the annotation values as strings. For multi-valued annotation params, the collection's iteration order matches the\n     * order the values appeared in the source code. Single-valued params are wrapped in a single-element collection.\n     * In either case, don't attempt to modify the returned collection.\n     */\n    public static Collection<String> extractValue(final AnnotationValue value) {\n        if (value.getValue() instanceof Collection) {\n            final Collection<?> varray = (List<?>) value.getValue();\n            final ArrayList<String> result = new ArrayList<String>(varray.size());\n            for (final Object active : varray) {\n                result.addAll(extractValue((AnnotationValue) active));\n            }\n            return result;\n        }\n        return Collections.singleton(value.getValue().toString());\n    }\n\n    /**\n     * Pulls nested annotations out of the annotation that contains them.\n     * @param elementUtils the current Elements object from this round of annotation processing.\n     * @param element The element targeted by the containing annotation.\n     * @param annotationName The containing annotation's fully-qualified name.\n     * @param paramName The name of the parameter on the containing annotation. The parameter's type must be an array of annotations.\n     */\n    public static List<AnnotationMirror> extractAnnotationsFromAnnotation(Elements elementUtils,\n                                                                          Element element,\n                                                                          String annotationName,\n                                                                          String paramName) {\n        final AnnotationMirror am = getAnnotation(elementUtils,\n                                                  element,\n                                                  annotationName);\n        AnnotationValue nestedAnnotations = GeneratorUtils.extractAnnotationPropertyValue(elementUtils,\n                                                                                          am,\n                                                                                          paramName);\n        if (nestedAnnotations == null) {\n            return Collections.emptyList();\n        }\n        final List<AnnotationMirror> result = new ArrayList<AnnotationMirror>();\n        nestedAnnotations.accept(new SimpleAnnotationValueVisitor6<Void, Void>() {\n                                     @Override\n                                     public Void visitArray(List<? extends AnnotationValue> vals,\n                                                            Void x) {\n                                         for (AnnotationValue av : vals) {\n                                             av.accept(new SimpleAnnotationValueVisitor6<Void, Void>() {\n                                                           @Override\n                                                           public Void visitAnnotation(AnnotationMirror am,\n                                                                                       Void x) {\n                                                               result.add(am);\n                                                               return null;\n                                                           }\n                                                       },\n                                                       null);\n                                         }\n                                         return null;\n                                     }\n                                 },\n                                 null);\n        return result;\n    }\n\n    private static String collectionAsString(final Collection<String> collection) {\n        final StringBuilder sb = new StringBuilder();\n\n        Iterator<String> iterator = collection.iterator();\n        int i = 0;\n        while (iterator.hasNext()) {\n            final String next = iterator.next();\n            sb.append('\"').append(next).append('\"');\n            if (i + 1 < collection.size()) {\n                sb.append(\", \");\n            }\n            i++;\n        }\n\n        return sb.toString();\n    }\n\n    public static String formatAssociatedResources(final Collection<String> resourceTypes) {\n        final String newLine = System.getProperty(\"line.separator\");\n\n        if (resourceTypes == null || resourceTypes.size() == 0) {\n            return null;\n        }\n\n        final StringBuilder sb = new StringBuilder();\n\n        sb.append(\"@AssociatedResources\").append(\"({\" + newLine);\n        for (final String resourceType : resourceTypes) {\n            sb.append(\"    \").append(resourceType).append(\".class\").append(\",\" + newLine);\n        }\n        sb.delete(sb.length() - (newLine.length() + 1),\n                  sb.length());\n        sb.append(newLine + \"})\" + newLine);\n\n        return sb.toString();\n    }\n\n    private static String fqcnToSimpleName(String fqcn) {\n        int lastIndexOfDot = fqcn.lastIndexOf('.');\n        if (lastIndexOfDot != -1) {\n            return fqcn.substring(lastIndexOfDot + 1);\n        }\n        return fqcn;\n    }\n\n    public static boolean debugLoggingEnabled() {\n        return Boolean.parseBoolean(System.getProperty(\"org.uberfire.processors.debug\",\n                                                       \"false\"));\n    }\n\n    public static String extractAnnotationStringValue(Elements elementUtils,\n                                                      AnnotationMirror annotation,\n                                                      CharSequence paramName) {\n        final AnnotationValue av = extractAnnotationPropertyValue(elementUtils,\n                                                                  annotation,\n                                                                  paramName);\n        if (av != null && av.getValue() != null) {\n            return av.getValue().toString();\n        }\n        return null;\n    }\n\n    public static AnnotationValue extractAnnotationPropertyValue(Elements elementUtils,\n                                                                 AnnotationMirror annotation,\n                                                                 CharSequence annotationProperty) {\n\n        Map<? extends ExecutableElement, ? extends AnnotationValue> annotationParams =\n                elementUtils.getElementValuesWithDefaults(annotation);\n\n        for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> param : annotationParams.entrySet()) {\n            if (param.getKey().getSimpleName().contentEquals(annotationProperty)) {\n                return param.getValue();\n            }\n        }\n        return null;\n    }\n\n    /**\n     * This method builds a list of all qualifier annotations source-code declaration that annotates the passed element.\n     * @param element {@link TypeElement} which will be scanned for qualifier annotations.\n     * @return A list of the annotations source-code declarations.\n     */\n    public static List<String> getAllQualifiersDeclarationFromType(TypeElement element) {\n        List<String> qualifiers = new ArrayList<>();\n        for (final AnnotationMirror am : element.getAnnotationMirrors()) {\n            final TypeElement annotationElement = (TypeElement) am.getAnnotationType().asElement();\n            if (annotationElement.getAnnotation(Qualifier.class) != null) {\n                qualifiers.add(am.toString());\n            }\n        }\n\n        return qualifiers;\n    }\n\n    public static ExecutableElement getValidateMethodName(TypeElement classElement, ProcessingEnvironment processingEnvironment) {\n        return getUniqueAnnotatedMethod(classElement,\n                                        processingEnvironment,\n                                        APIModule.getValidateClass(),\n                                        new TypeMirror[]{\n                                                processingEnvironment.getElementUtils().getTypeElement(\"elemental2.promise.Promise\").asType()\n                                        },\n                                        NO_PARAMS);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/MultiTemplateLoader.java",
    "content": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.io.Reader;\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport freemarker.cache.StatefulTemplateLoader;\nimport freemarker.cache.TemplateLoader;\n\n/**\n * This is a fork of {@link freemarker.cache.MultiTemplateLoader} that supports adding additional\n * {@link TemplateLoader} on demand. Uberfire has numerous code generators in different packages\n * each of which has their own template files and hence requires a different loader.\n */\npublic class MultiTemplateLoader implements StatefulTemplateLoader {\n\n    private final List<TemplateLoader> loaders = new ArrayList<>();\n\n    public void addTemplateLoader(final TemplateLoader loader) {\n        loaders.add(loader);\n    }\n\n    @Override\n    public Object findTemplateSource(String name)\n            throws IOException {\n        for (TemplateLoader loader : loaders) {\n            Object source = loader.findTemplateSource(name);\n            if (source != null) {\n                return new MultiSource(source,\n                                       loader);\n            }\n        }\n        return null;\n    }\n\n    @Override\n    public long getLastModified(Object templateSource) {\n        return ((MultiSource) templateSource).getLastModified();\n    }\n\n    @Override\n    public Reader getReader(Object templateSource,\n                            String encoding)\n            throws IOException {\n        return ((MultiSource) templateSource).getReader(encoding);\n    }\n\n    @Override\n    public void closeTemplateSource(Object templateSource)\n            throws IOException {\n        ((MultiSource) templateSource).close();\n    }\n\n    @Override\n    public void resetState() {\n        loaders.stream().filter(l -> l instanceof StatefulTemplateLoader).forEach(l -> ((StatefulTemplateLoader) l).resetState());\n    }\n\n    /**\n     * Represents a template source bound to a specific template loader. It serves as the complete template source\n     * descriptor used by the MultiTemplateLoader class.\n     */\n    static final class MultiSource {\n\n        private final Object source;\n        private final TemplateLoader loader;\n\n        MultiSource(Object source,\n                    TemplateLoader loader) {\n            this.source = source;\n            this.loader = loader;\n        }\n\n        long getLastModified() {\n            return loader.getLastModified(source);\n        }\n\n        Reader getReader(String encoding)\n                throws IOException {\n            return loader.getReader(source,\n                                    encoding);\n        }\n\n        void close()\n                throws IOException {\n            loader.closeTemplateSource(source);\n        }\n\n        @Override\n        public boolean equals(Object o) {\n            if (o instanceof MultiSource) {\n                MultiSource m = (MultiSource) o;\n                return m.loader.equals(loader) && m.source.equals(source);\n            }\n            return false;\n        }\n\n        @Override\n        public int hashCode() {\n            return loader.hashCode() + 31 * source.hashCode();\n        }\n\n        @Override\n        public String toString() {\n            return source.toString();\n        }\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/PartInformation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.LinkedHashMap;\nimport java.util.Map;\n\npublic class PartInformation {\n\n    private final String partName;\n    private final Map<String, String> parameters;\n\n    public PartInformation(CharSequence partNameAndParams) {\n        parameters = new LinkedHashMap<String, String>();\n\n        StringBuilder nextToken = new StringBuilder(50);\n        String foundPartName = null;\n        String key = null;\n        for (int i = 0; i < partNameAndParams.length(); i++) {\n            char ch = partNameAndParams.charAt(i);\n            switch (ch) {\n                case '%':\n                    StringBuilder hexVal = new StringBuilder(2);\n                    hexVal.append(partNameAndParams.charAt(i + 1));\n                    hexVal.append(partNameAndParams.charAt(i + 2));\n                    nextToken.append((char) Integer.parseInt(hexVal.toString(),\n                                                             16));\n                    i += 2;\n                    break;\n\n                case '?':\n                    if (foundPartName == null) {\n                        foundPartName = nextToken.toString();\n                        nextToken = new StringBuilder(50);\n                    } else {\n                        nextToken.append('?');\n                    }\n                    break;\n\n                case '=':\n                    if (foundPartName == null) {\n                        nextToken.append('=');\n                    } else {\n                        key = nextToken.toString();\n                        nextToken = new StringBuilder(50);\n                    }\n                    break;\n\n                case '&':\n                    parameters.put(key,\n                                   nextToken.toString());\n                    nextToken = new StringBuilder(50);\n                    key = null;\n                    break;\n\n                default:\n                    nextToken.append(ch);\n            }\n        }\n\n        if (foundPartName == null) {\n            foundPartName = nextToken.toString();\n        } else if (key != null) {\n            parameters.put(key,\n                           nextToken.toString());\n        } else if (nextToken.length() > 0) {\n            parameters.put(nextToken.toString(),\n                           \"\");\n        }\n\n        this.partName = foundPartName;\n    }\n\n    public String getPartName() {\n        return partName;\n    }\n\n    public Map<String, String> getParameters() {\n        return parameters;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/PerspectiveActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\nimport static org.uberfire.annotations.processors.TemplateInformationHelper.extractWbTemplatePerspectiveInformation;\n\n/**\n * Generates a Java source file enerator for Activities\n */\npublic class PerspectiveActivityGenerator extends AbstractGenerator {\n\n    private final Map<String, String> context = new HashMap<String, String>();\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n        String identifier = ClientAPIModule.getWbPerspectiveScreenIdentifierValueOnClass(classElement);\n        boolean isDefault = ClientAPIModule.getWbPerspectiveScreenIsDefaultValueOnClass(classElement);\n        boolean isTransient = ClientAPIModule.getWbPerspectiveScreenIsTransientValueOnClass(classElement);\n        boolean isDynamic = ClientAPIModule.getWbPerspectiveScreenIsDynamicValueOnClass(classElement);\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForNonEditors(classElement,\n                                                                                                 processingEnvironment);\n\n        final String onStartup0ParameterMethodName;\n        final String onStartup1ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().isEmpty()) {\n            onStartup0ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup1ParameterMethodName = null;\n        } else {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String getPerspectiveMethodName = GeneratorUtils.getPerspectiveMethodName(classElement,\n                                                                                        processingEnvironment);\n        final String getMenuBarMethodName = GeneratorUtils.getMenuBarMethodName(classElement,\n                                                                                processingEnvironment);\n        final String getToolBarMethodName = GeneratorUtils.getToolBarMethodName(classElement,\n                                                                                processingEnvironment);\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"isDefault: \" + isDefault);\n            messager.printMessage(Kind.NOTE,\n                                  \"isTransient: \" + isTransient);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup0ParameterMethodName: \" + onStartup0ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getPerspectiveMethodName: \" + getPerspectiveMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getMenuBarMethodName: \" + getMenuBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getToolBarMethodName: \" + getToolBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        Map<String, Object> root = new HashMap<String, Object>();\n\n        TemplateInformation helper = extractWbTemplatePerspectiveInformation(elementUtils,\n                                                                             classElement);\n\n        if (helper.getDefaultPanel() != null) {\n            root.put(\"defaultPanel\",\n                     helper.getDefaultPanel());\n        }\n        root.put(\"wbPanels\",\n                 helper.getTemplateFields());\n\n        if (getPerspectiveMethodName == null && !helper.thereIsTemplateFields()) {\n            throw new GenerationException(\"A WorkbenchPerspective class must have either a valid @Perspective method or at least one @WorkbenchPanel field.\",\n                                          packageName + \".\" + className);\n        }\n\n        if (getPerspectiveMethodName != null && helper.thereIsTemplateFields()) {\n            throw new GenerationException(\"This WorkbenchPerspective has both a @Perspective method and a @WorkbenchPanel field. Only one or the other is allowed.\");\n        }\n\n        if (isDefault) {\n            warningIfMoreThanOneDefaultPerspective(processingEnvironment,\n                                                   identifier);\n        }\n\n        //Setup data for FreeMarker\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"isTemplate\",\n                 helper.thereIsTemplateFields());\n        root.put(\"isDefault\",\n                 isDefault);\n        root.put(\"isTransient\",\n                 isTransient);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup0ParameterMethodName\",\n                 onStartup0ParameterMethodName);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"getPerspectiveMethodName\",\n                 getPerspectiveMethodName);\n        root.put(\"getMenuBarMethodName\",\n                 getMenuBarMethodName);\n        root.put(\"getToolBarMethodName\",\n                 getToolBarMethodName);\n        root.put(\"isDynamic\",\n                 isDynamic);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"perspective.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n\n    private void warningIfMoreThanOneDefaultPerspective(ProcessingEnvironment processingEnvironment,\n                                                        String perspectiveName) {\n        String defaultPerspectivesName = \"defaultPerspectivesName\";\n        String defaultPerspectives = context.get(defaultPerspectivesName);\n        if (defaultPerspectives != null) {\n            defaultPerspectives = defaultPerspectives + \", \" + perspectiveName;\n            generateMoreThanOneDefaultPerspectiveWarning(processingEnvironment,\n                                                         defaultPerspectives);\n            context.put(defaultPerspectivesName,\n                        defaultPerspectives);\n        } else {\n            context.put(defaultPerspectivesName,\n                        perspectiveName);\n        }\n    }\n\n    private void generateMoreThanOneDefaultPerspectiveWarning(ProcessingEnvironment processingEnvironment,\n                                                              String defaultPerspectives) {\n        final String msg = \"Found too many default WorkbenchPerspectives (expected 1). Found: (\" + defaultPerspectives + \").\";\n        processingEnvironment.getMessager().printMessage(Kind.ERROR,\n                                                         msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/PerspectiveProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchPerspective} annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchPerspective\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class PerspectiveProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final PerspectiveActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback;\n\n    public PerspectiveProcessor() {\n        PerspectiveActivityGenerator ag = null;\n        try {\n            ag = new PerspectiveActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    PerspectiveProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        //Scan for all classes with the WorkbenchPerspective annotation\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchPerspectiveClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/PopupActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class PopupActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        final TypeElement classElement = (TypeElement) element;\n\n        String identifier = ClientAPIModule.getWbPopupScreenIdentifierValueOnClass(classElement);\n\n        final String size = ClientAPIModule.getWbPopupScreenSizeValueOnClass(classElement);\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForNonEditors(classElement,\n                                                                                                 processingEnvironment);\n\n        final String onStartup0ParameterMethodName;\n        final String onStartup1ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().isEmpty()) {\n            onStartup0ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup1ParameterMethodName = null;\n        } else {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onMayCloseMethodName = GeneratorUtils.getOnMayCloseMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n        final boolean hasUberView = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"Size: \" + size);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup0ParameterMethodName: \" + onStartup0ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onMayCloseMethodName: \" + onMayCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasUberView: \" + Boolean.toString(hasUberView));\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        //Validate getWidgetMethodName and isWidget\n        if (!isWidget && getWidgetMethodName == null) {\n            throw new GenerationException(\"The WorkbenchPopup must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\",\n                                          packageName + \".\" + className);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchPopup both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n\n        //Validate getTitleMethodName and getTitleWidgetMethodName\n        if (getTitleMethodName == null) {\n            throw new GenerationException(\"The WorkbenchPopup must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"size\",\n                 size);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup0ParameterMethodName\",\n                 onStartup0ParameterMethodName);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onMayCloseMethodName\",\n                 onMayCloseMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasUberView\",\n                 hasUberView);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"popupScreen.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/ScreenActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class ScreenActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n        final String annotationName = ClientAPIModule.getWorkbenchScreenClass();\n        final boolean isDynamic = ClientAPIModule.getWbScreenIsDynamicValueOnClass(classElement);\n\n        String identifier = null;\n        Integer preferredHeight = null;\n        Integer preferredWidth = null;\n\n        for (final AnnotationMirror am : classElement.getAnnotationMirrors()) {\n            if (annotationName.equals(am.getAnnotationType().toString())) {\n                for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) {\n                    AnnotationValue aval = entry.getValue();\n                    if (\"identifier\".equals(entry.getKey().getSimpleName().toString())) {\n                        identifier = aval.getValue().toString();\n                    } else if (\"preferredHeight\".equals(entry.getKey().getSimpleName().toString())) {\n                        final int _preferredHeight = (Integer) aval.getValue();\n                        if (_preferredHeight > 0) {\n                            preferredHeight = _preferredHeight;\n                        }\n                    } else if (\"preferredWidth\".equals(entry.getKey().getSimpleName().toString())) {\n                        final int _preferredWidth = (Integer) aval.getValue();\n                        if (_preferredWidth > 0) {\n                            preferredWidth = _preferredWidth;\n                        }\n                    }\n                }\n                break;\n            }\n        }\n\n        final String owningPlace = GeneratorUtils.getOwningPerspectivePlaceRequest(classElement,\n                                                                                   processingEnvironment);\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForNonEditors(classElement,\n                                                                                                 processingEnvironment);\n\n        final String onStartup0ParameterMethodName;\n        final String onStartup1ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().isEmpty()) {\n            onStartup0ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup1ParameterMethodName = null;\n        } else {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onMayCloseMethodName = GeneratorUtils.getOnMayCloseMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String onLostFocusMethodName = GeneratorUtils.getOnLostFocusMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String onFocusMethodName = GeneratorUtils.getOnFocusMethodName(classElement,\n                                                                             processingEnvironment);\n        final String getDefaultPositionMethodName = GeneratorUtils.getDefaultPositionMethodName(classElement,\n                                                                                                processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final String getContextIdMethodName = GeneratorUtils.getContextIdMethodName(classElement,\n                                                                                    processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n        final boolean isTitleWidgetMethodReturnTypeElement = getTitleWidgetMethod != null && GeneratorUtils.getIsElement(getTitleWidgetMethod.getReturnType(),\n                                                                                                                         processingEnvironment);\n\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n\n        final boolean isWidgetMethodReturnTypeElement = getWidgetMethod != null && GeneratorUtils.getIsElement(getWidgetMethod.getReturnType(),\n                                                                                                               processingEnvironment);\n\n        final boolean hasPresenterInitMethod = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n        final String getMenuBarMethodName = GeneratorUtils.getMenuBarMethodName(classElement,\n                                                                                processingEnvironment);\n        final String getToolBarMethodName = GeneratorUtils.getToolBarMethodName(classElement,\n                                                                                processingEnvironment);\n\n        final boolean needsElementWrapper = isWidgetMethodReturnTypeElement || isTitleWidgetMethodReturnTypeElement;\n\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"Owning Perspective Identifier: \" + owningPlace);\n            messager.printMessage(Kind.NOTE,\n                                  \"Preferred Height: \" + preferredHeight);\n            messager.printMessage(Kind.NOTE,\n                                  \"Preferred Width: \" + preferredWidth);\n            messager.printMessage(Kind.NOTE,\n                                  \"getContextIdMethodName: \" + getContextIdMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup0ParameterMethodName: \" + onStartup0ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onMayCloseMethodName: \" + onMayCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onLostFocusMethodName: \" + onLostFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onFocusMethodName: \" + onFocusMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getDefaultPositionMethodName: \" + getDefaultPositionMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isTitleWidgetMethodReturnTypeElement: \" + isTitleWidgetMethodReturnTypeElement);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidgetMethodReturnTypeElement: \" + isWidgetMethodReturnTypeElement);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasPresenterInitMethod: \" + Boolean.toString(hasPresenterInitMethod));\n            messager.printMessage(Kind.NOTE,\n                                  \"needsElementWrapper: \" + Boolean.toString(needsElementWrapper));\n            messager.printMessage(Kind.NOTE,\n                                  \"getMenuBarMethodName: \" + getMenuBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getToolBarMethodName: \" + getToolBarMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        //Validate getWidgetMethodName and isWidget\n        if (!isWidget && getWidgetMethodName == null) {\n            throw new GenerationException(\"The WorkbenchScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget or preferably org.jboss.errai.common.client.api.IsElement.\",\n                                          packageName + \".\" + className);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchScreen both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n\n        //Validate getTitleMethodName and getTitleWidgetMethodName\n        if (getTitleMethodName == null) {\n            throw new GenerationException(\"The WorkbenchScreen must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"owningPlace\",\n                 owningPlace);\n        root.put(\"preferredHeight\",\n                 preferredHeight);\n        root.put(\"preferredWidth\",\n                 preferredWidth);\n        root.put(\"getContextIdMethodName\",\n                 getContextIdMethodName);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup0ParameterMethodName\",\n                 onStartup0ParameterMethodName);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onMayCloseMethodName\",\n                 onMayCloseMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"onLostFocusMethodName\",\n                 onLostFocusMethodName);\n        root.put(\"onFocusMethodName\",\n                 onFocusMethodName);\n        root.put(\"getDefaultPositionMethodName\",\n                 getDefaultPositionMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"isTitleWidgetMethodReturnTypeElement\",\n                 isTitleWidgetMethodReturnTypeElement);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidgetMethodReturnTypeElement\",\n                 isWidgetMethodReturnTypeElement);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasPresenterInitMethod\",\n                 hasPresenterInitMethod);\n        root.put(\"needsElementWrapper\",\n                 needsElementWrapper);\n        root.put(\"getMenuBarMethodName\",\n                 getMenuBarMethodName);\n        root.put(\"getToolBarMethodName\",\n                 getToolBarMethodName);\n        root.put(\"isDynamic\",\n                 isDynamic);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"activityScreen.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/SplashScreenActivityGenerator.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedWriter;\nimport java.io.IOException;\nimport java.io.StringWriter;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.ProcessingEnvironment;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport freemarker.template.Template;\nimport freemarker.template.TemplateException;\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * A source code generator for Activities\n */\npublic class SplashScreenActivityGenerator extends AbstractGenerator {\n\n    @Override\n    public StringBuffer generate(final String packageName,\n                                 final PackageElement packageElement,\n                                 final String className,\n                                 final Element element,\n                                 final ProcessingEnvironment processingEnvironment) throws GenerationException {\n\n        final Messager messager = processingEnvironment.getMessager();\n        messager.printMessage(Kind.NOTE,\n                              \"Starting code generation for [\" + className + \"]\");\n\n        final Elements elementUtils = processingEnvironment.getElementUtils();\n\n        //Extract required information\n        final TypeElement classElement = (TypeElement) element;\n\n        String identifier = ClientAPIModule.getWbSplashScreenIdentifierValueOnClass(classElement);\n\n        boolean isEnabled = ClientAPIModule.getWbSplashScreenIsEnabledValueOnClass(classElement);\n\n        final String beanActivatorClass = GeneratorUtils.getBeanActivatorClassName(classElement,\n                                                                                   processingEnvironment);\n\n        final ExecutableElement onStartupMethod = GeneratorUtils.getOnStartupMethodForNonEditors(classElement,\n                                                                                                 processingEnvironment);\n\n        final String onStartup0ParameterMethodName;\n        final String onStartup1ParameterMethodName;\n        if (onStartupMethod == null) {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = null;\n        } else if (onStartupMethod.getParameters().isEmpty()) {\n            onStartup0ParameterMethodName = onStartupMethod.getSimpleName().toString();\n            onStartup1ParameterMethodName = null;\n        } else {\n            onStartup0ParameterMethodName = null;\n            onStartup1ParameterMethodName = onStartupMethod.getSimpleName().toString();\n        }\n\n        final String onCloseMethodName = GeneratorUtils.getOnCloseMethodName(classElement,\n                                                                             processingEnvironment);\n        final String onShutdownMethodName = GeneratorUtils.getOnShutdownMethodName(classElement,\n                                                                                   processingEnvironment);\n        final String onOpenMethodName = GeneratorUtils.getOnOpenMethodName(classElement,\n                                                                           processingEnvironment);\n        final String getTitleMethodName = GeneratorUtils.getTitleMethodName(classElement,\n                                                                            processingEnvironment);\n        final ExecutableElement getTitleWidgetMethod = GeneratorUtils.getTitleWidgetMethodName(classElement,\n                                                                                               processingEnvironment);\n        final String getTitleWidgetMethodName = getTitleWidgetMethod == null ? null : getTitleWidgetMethod.getSimpleName().toString();\n        final ExecutableElement getWidgetMethod = GeneratorUtils.getWidgetMethodName(classElement,\n                                                                                     processingEnvironment);\n        final String getWidgetMethodName = getWidgetMethod == null ? null : getWidgetMethod.getSimpleName().toString();\n        final boolean hasUberView = GeneratorUtils.hasPresenterInitMethod(classElement, processingEnvironment, getWidgetMethod);\n\n        final boolean isWidget = GeneratorUtils.getIsWidget(classElement,\n                                                            processingEnvironment);\n\n        final String getSplashFilterMethodName = GeneratorUtils.getSplashFilterMethodName(classElement,\n                                                                                          processingEnvironment);\n        final String getBodyHeightMethodName = GeneratorUtils.getBodyHeightMethodName(classElement,\n                                                                                      processingEnvironment);\n        final String getInterceptMethodName = GeneratorUtils.getInterceptMethodName(classElement,\n                                                                                    processingEnvironment);\n        final List<String> qualifiers = GeneratorUtils.getAllQualifiersDeclarationFromType(classElement);\n\n        if (GeneratorUtils.debugLoggingEnabled()) {\n            messager.printMessage(Kind.NOTE,\n                                  \"Package name: \" + packageName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Class name: \" + className);\n            messager.printMessage(Kind.NOTE,\n                                  \"Identifier: \" + identifier);\n            messager.printMessage(Kind.NOTE,\n                                  \"isEnabled: \" + isEnabled);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup0ParameterMethodName: \" + onStartup0ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onStartup1ParameterMethodName: \" + onStartup1ParameterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onCloseMethodName: \" + onCloseMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onShutdownMethodName: \" + onShutdownMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"onOpenMethodName: \" + onOpenMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleMethodName: \" + getTitleMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getTitleWidgetMethodName: \" + getTitleWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getWidgetMethodName: \" + getWidgetMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"isWidget: \" + Boolean.toString(isWidget));\n            messager.printMessage(Kind.NOTE,\n                                  \"hasUberView: \" + Boolean.toString(hasUberView));\n            messager.printMessage(Kind.NOTE,\n                                  \"getSplashFilterMethodName: \" + getSplashFilterMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getInterceptMethodName: \" + getInterceptMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"getBodyHeightMethodName: \" + getBodyHeightMethodName);\n            messager.printMessage(Kind.NOTE,\n                                  \"Qualifiers: \" + String.join(\", \",\n                                                               qualifiers));\n        }\n\n        //Validate getWidgetMethodName and isWidget\n        if (!isWidget && getWidgetMethodName == null) {\n            throw new GenerationException(\"The WorkbenchSplashScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\",\n                                          packageName + \".\" + className);\n        }\n        if (isWidget && getWidgetMethodName != null) {\n            final String msg = \"The WorkbenchSplashScreen both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\";\n            messager.printMessage(Kind.WARNING,\n                                  msg,\n                                  classElement);\n        }\n\n        //Validate getTitleMethodName and getTitleWidgetMethodName\n        if (getTitleMethodName == null) {\n            throw new GenerationException(\"The WorkbenchSplashScreen must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Validate getPerspectiveMethodName\n        if (getSplashFilterMethodName == null) {\n            throw new GenerationException(\"The WorkbenchSplashScreen must provide a @SplashFilter annotated method to return a org.uberfire.workbench.model.SplashScreenFilter.\",\n                                          packageName + \".\" + className);\n        }\n\n        //Setup data for template sub-system\n        Map<String, Object> root = new HashMap<String, Object>();\n        root.put(\"packageName\",\n                 packageName);\n        root.put(\"className\",\n                 className);\n        root.put(\"identifier\",\n                 identifier);\n        root.put(\"isEnabled\",\n                 isEnabled);\n        root.put(\"realClassName\",\n                 classElement.getSimpleName().toString());\n        root.put(\"beanActivatorClass\",\n                 beanActivatorClass);\n        root.put(\"onStartup0ParameterMethodName\",\n                 onStartup0ParameterMethodName);\n        root.put(\"onStartup1ParameterMethodName\",\n                 onStartup1ParameterMethodName);\n        root.put(\"onCloseMethodName\",\n                 onCloseMethodName);\n        root.put(\"onShutdownMethodName\",\n                 onShutdownMethodName);\n        root.put(\"onOpenMethodName\",\n                 onOpenMethodName);\n        root.put(\"getTitleMethodName\",\n                 getTitleMethodName);\n        root.put(\"getTitleWidgetMethodName\",\n                 getTitleWidgetMethodName);\n        root.put(\"getWidgetMethodName\",\n                 getWidgetMethodName);\n        root.put(\"isWidget\",\n                 isWidget);\n        root.put(\"hasUberView\",\n                 hasUberView);\n        root.put(\"getSplashFilterMethodName\",\n                 getSplashFilterMethodName);\n        root.put(\"getInterceptMethodName\",\n                 getInterceptMethodName);\n        root.put(\"getBodyHeightMethodName\",\n                 getBodyHeightMethodName);\n        root.put(\"qualifiers\",\n                 qualifiers);\n\n        //Generate code\n        final StringWriter sw = new StringWriter();\n        final BufferedWriter bw = new BufferedWriter(sw);\n        try {\n            final Template template = config.getTemplate(\"splashScreen.ftl\");\n            template.process(root,\n                             bw);\n        } catch (IOException ioe) {\n            throw new GenerationException(ioe);\n        } catch (TemplateException te) {\n            throw new GenerationException(te);\n        } finally {\n            try {\n                bw.close();\n                sw.close();\n            } catch (IOException ioe) {\n                throw new GenerationException(ioe);\n            }\n        }\n        messager.printMessage(Kind.NOTE,\n                              \"Successfully generated code for [\" + className + \"]\");\n\n        return sw.getBuffer();\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/TemplateInformation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\npublic class TemplateInformation {\n\n    private WorkbenchPanelInformation defaultPanel;\n    private List<WorkbenchPanelInformation> templateFields = new ArrayList<WorkbenchPanelInformation>();\n\n    public void addTemplateField(WorkbenchPanelInformation field) {\n        templateFields.add(field);\n    }\n\n    public List<WorkbenchPanelInformation> getTemplateFields() {\n        return templateFields;\n    }\n\n    public WorkbenchPanelInformation getDefaultPanel() {\n        return defaultPanel;\n    }\n\n    public void setDefaultPanel(WorkbenchPanelInformation defaultPanel) {\n        this.defaultPanel = defaultPanel;\n    }\n\n    public boolean thereIsTemplateFields() {\n        return ((!getTemplateFields().isEmpty()) || defaultPanel != null);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/TemplateInformationHelper.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\nimport static org.uberfire.annotations.processors.GeneratorUtils.getAnnotation;\n\npublic class TemplateInformationHelper {\n\n    public static final String VALUE = \"value\";\n    public static final String PANEL_TYPE = \"panelType\";\n    public static final String IS_DEFAULT = \"isDefault\";\n    public static final String PARENT_CHOOSES_PANEL_TYPE = \"PARENT_CHOOSES_TYPE\"; // must match PanelDefinition.PARENT_CHOOSES_TYPE\n    public static final String PARTS = \"parts\";\n\n    public static TemplateInformation extractWbTemplatePerspectiveInformation(Elements elementUtils,\n                                                                              TypeElement classElement) throws GenerationException {\n\n        TemplateInformation template = new TemplateInformation();\n\n        for (Element element : classElement.getEnclosedElements()) {\n            extractInformationFromWorkbenchPanel(elementUtils,\n                                                 template,\n                                                 element);\n        }\n        return template;\n    }\n\n    private static void extractInformationFromWorkbenchPanel(Elements elementUtils,\n                                                             TemplateInformation template,\n                                                             Element element) throws GenerationException {\n\n        if (GeneratorUtils.getAnnotation(elementUtils,\n                                         element,\n                                         ClientAPIModule.getWorkbenchPanel()) == null) {\n            // this element is not of interest\n            return;\n        }\n\n        WorkbenchPanelInformation wbPanel = new WorkbenchPanelInformation();\n        if (workbenchPanelIsDefault(elementUtils,\n                                    element)) {\n            wbPanel.setDefault(true);\n        }\n        wbPanel.setFieldName(element.getSimpleName().toString());\n        wbPanel.setWbParts(getWorkbenchPartsFrom(elementUtils,\n                                                 element));\n        wbPanel.setPanelType(extractPanelType(elementUtils,\n                                              element));\n        if (wbPanel.isDefault()) {\n            if (template.getDefaultPanel() != null) {\n                throw new GenerationException(\"Found more than one @WorkbenchPanel with isDefault=true.\");\n            }\n            template.setDefaultPanel(wbPanel);\n        } else {\n            template.addTemplateField(wbPanel);\n        }\n    }\n\n    private static String extractPanelType(Elements elementUtils,\n                                           Element element) throws GenerationException {\n        AnnotationMirror am = getAnnotation(elementUtils,\n                                            element,\n                                            ClientAPIModule.getWorkbenchPanel());\n        String panelPresenterClassName = GeneratorUtils.extractAnnotationStringValue(elementUtils,\n                                                                                     am,\n                                                                                     PANEL_TYPE);\n        if (panelPresenterClassName.equals(\"java.lang.Void\")) {\n            return PARENT_CHOOSES_PANEL_TYPE;\n        }\n        return panelPresenterClassName;\n    }\n\n    private static boolean workbenchPanelIsDefault(Elements elementUtils,\n                                                   Element element) throws GenerationException {\n        AnnotationMirror am = getAnnotation(elementUtils,\n                                            element,\n                                            ClientAPIModule.getWorkbenchPanel());\n        return Boolean.valueOf(GeneratorUtils.extractAnnotationStringValue(elementUtils,\n                                                                           am,\n                                                                           IS_DEFAULT));\n    }\n\n    private static List<PartInformation> getWorkbenchPartsFrom(Elements elementUtils,\n                                                               Element wbPanel) throws GenerationException {\n        AnnotationMirror wbPartAnnotation = getAnnotation(elementUtils,\n                                                          wbPanel,\n                                                          ClientAPIModule.getWorkbenchPanel());\n        AnnotationValue partsParam = GeneratorUtils.extractAnnotationPropertyValue(elementUtils,\n                                                                                   wbPartAnnotation,\n                                                                                   PARTS);\n\n        List<PartInformation> partInfos = new ArrayList<PartInformation>();\n        for (String partNameAndParams : GeneratorUtils.extractValue(partsParam)) {\n            partInfos.add(new PartInformation(partNameAndParams));\n        }\n        return partInfos;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchClientEditorProcessor.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\n\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchClientEditor} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchClientEditor\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchClientEditorProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final ClientEditorActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchClientEditorProcessor() {\n        ClientEditorActivityGenerator ag = null;\n        try {\n            ag = new ClientEditorActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchClientEditorProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchClientEditorClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchContextProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchContext} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchContext\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchContextProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final ContextActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchContextProcessor() {\n        ContextActivityGenerator ag = null;\n        try {\n            ag = new ContextActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchContextProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchContextClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchEditorProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchEditor} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchEditor\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchEditorProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final EditorActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchEditorProcessor() {\n        EditorActivityGenerator ag = null;\n        try {\n            ag = new EditorActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchEditorProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchEditorClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchPanelInformation.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.List;\n\npublic class WorkbenchPanelInformation {\n\n    private String fieldName;\n    private List<PartInformation> wbParts;\n    private boolean isDefault;\n    private String panelType;\n\n    public boolean isDefault() {\n        return isDefault;\n    }\n\n    public void setDefault(boolean isDefault) {\n        this.isDefault = isDefault;\n    }\n\n    public List<PartInformation> getWbParts() {\n        return wbParts;\n    }\n\n    public void setWbParts(List<PartInformation> uFParts) {\n        this.wbParts = uFParts;\n    }\n\n    public String getPanelType() {\n        return panelType;\n    }\n\n    public void setPanelType(String panelType) {\n        this.panelType = panelType;\n    }\n\n    public String getFieldName() {\n        return fieldName;\n    }\n\n    public void setFieldName(String fieldName) {\n        this.fieldName = fieldName;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchPopupProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchPopup} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchPopup\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchPopupProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final PopupActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchPopupProcessor() {\n        PopupActivityGenerator ag = null;\n        try {\n            ag = new PopupActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchPopupProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchPopupClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchScreenProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchScreen} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchScreen\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchScreenProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final ScreenActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchScreenProcessor() {\n        ScreenActivityGenerator ag = null;\n        try {\n            ag = new ScreenActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchScreenProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchScreenClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/WorkbenchSplashScreenProcessor.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.IOException;\nimport java.util.Set;\nimport javax.annotation.processing.Messager;\nimport javax.annotation.processing.RoundEnvironment;\nimport javax.annotation.processing.SupportedAnnotationTypes;\nimport javax.annotation.processing.SupportedSourceVersion;\nimport javax.lang.model.SourceVersion;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ElementKind;\nimport javax.lang.model.element.PackageElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\nimport javax.tools.Diagnostic.Kind;\n\nimport org.uberfire.annotations.processors.exceptions.GenerationException;\nimport org.uberfire.annotations.processors.facades.ClientAPIModule;\n\n/**\n * Processor for {@code WorkbenchPopup} and related annotations\n */\n@SupportedAnnotationTypes(\"org.uberfire.client.annotations.WorkbenchSplashScreen\")\n@SupportedSourceVersion(SourceVersion.RELEASE_8)\npublic class WorkbenchSplashScreenProcessor extends AbstractErrorAbsorbingProcessor {\n\n    private final SplashScreenActivityGenerator activityGenerator;\n    private GenerationCompleteCallback callback = null;\n\n    public WorkbenchSplashScreenProcessor() {\n        SplashScreenActivityGenerator ag = null;\n        try {\n            ag = new SplashScreenActivityGenerator();\n        } catch (Throwable t) {\n            rememberInitializationError(t);\n        }\n        activityGenerator = ag;\n    }\n\n    //Constructor for tests only, to prevent code being written to file. The generated code will be sent to the call-back\n    WorkbenchSplashScreenProcessor(final GenerationCompleteCallback callback) {\n        this();\n        this.callback = callback;\n        System.out.println(\"GenerationCompleteCallback has been provided. Generated source code will not be compiled and hence classes will not be available.\");\n    }\n\n    @Override\n    public boolean processWithExceptions(Set<? extends TypeElement> annotations,\n                                         RoundEnvironment roundEnv) throws IOException {\n        //We don't have any post-processing\n        if (roundEnv.processingOver()) {\n            return false;\n        }\n\n        //If prior processing threw an error exit\n        if (roundEnv.errorRaised()) {\n            return false;\n        }\n\n        final Messager messager = processingEnv.getMessager();\n        final Elements elementUtils = processingEnv.getElementUtils();\n\n        for (Element e : roundEnv.getElementsAnnotatedWith(elementUtils.getTypeElement(ClientAPIModule.getWorkbenchSplashScreenClass()))) {\n            if (e.getKind() == ElementKind.CLASS) {\n\n                TypeElement classElement = (TypeElement) e;\n                PackageElement packageElement = (PackageElement) classElement.getEnclosingElement();\n\n                messager.printMessage(Kind.NOTE,\n                                      \"Discovered class [\" + classElement.getSimpleName() + \"]\");\n\n                final String packageName = packageElement.getQualifiedName().toString();\n                final String classNameActivity = classElement.getSimpleName() + \"Activity\";\n\n                try {\n                    //Try generating code for each required class\n                    messager.printMessage(Kind.NOTE,\n                                          \"Generating code for [\" + classNameActivity + \"]\");\n                    final StringBuffer activityCode = activityGenerator.generate(packageName,\n                                                                                 packageElement,\n                                                                                 classNameActivity,\n                                                                                 classElement,\n                                                                                 processingEnv);\n\n                    //If code is successfully created write files, or send generated code to call-back.\n                    //The call-back function is used primarily for testing when we don't necessarily want\n                    //the generated code to be stored as a compilable file for javac to process.\n                    if (callback == null) {\n                        writeCode(packageName,\n                                  classNameActivity,\n                                  activityCode);\n                    } else {\n                        callback.generationComplete(activityCode.toString());\n                    }\n                } catch (GenerationException ge) {\n                    final String msg = ge.getMessage();\n                    processingEnv.getMessager().printMessage(Kind.ERROR,\n                                                             msg,\n                                                             classElement);\n                }\n            }\n        }\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/exceptions/GenerationException.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors.exceptions;\n\n/**\n * THINK TWICE BEFORE USING THIS EXCEPTION! In most cases, it is more appropriate to print an error message through the\n * compiler's Messager API. This allows you to pinpoint the exact class, annotation, field, method, or whatever element\n * the error message refers to. Just like throwing an exception, printing an error does cause the compile to fail.\n */\npublic class GenerationException extends Exception {\n\n    private static final long serialVersionUID = 1L;\n\n    public GenerationException() {\n        super();\n    }\n\n    public GenerationException(final String msg) {\n        super(msg);\n    }\n\n    public GenerationException(final String msg,\n                               final String origin) {\n        super(origin + \": \" + msg);\n    }\n\n    public GenerationException(Throwable t) {\n        super(t);\n    }\n\n    public GenerationException(String message,\n                               Throwable cause) {\n        super(message,\n              cause);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/facades/APIModule.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors.facades;\n\n/**\n * A collection of type names in the UberFire API module.\n * Due to a bug in Eclipse annotation processor dependencies, we refer to all UberFire type names using Strings,\n * Elements, and TypeMirrors. We cannot refer to the annotation types as types themselves.\n */\npublic class APIModule {\n\n    public static final String panelDefinition = \"org.uberfire.workbench.model.PanelDefinition\";\n    public static final String position = \"org.uberfire.workbench.model.Position\";\n    public static final String placeRequest = \"org.uberfire.mvp.PlaceRequest\";\n    public static final String setContent = \"org.uberfire.lifecycle.SetContent\";\n    public static final String getContent = \"org.uberfire.lifecycle.GetContent\";\n    public static final String getPreview = \"org.uberfire.lifecycle.GetPreview\";\n    public static final String isDirty = \"org.uberfire.lifecycle.IsDirty\";\n    public static final String onClose = \"org.uberfire.lifecycle.OnClose\";\n    public static final String onFocus = \"org.uberfire.lifecycle.OnFocus\";\n    public static final String onLostFocus = \"org.uberfire.lifecycle.OnLostFocus\";\n    public static final String onMayClose = \"org.uberfire.lifecycle.OnMayClose\";\n    public static final String onOpen = \"org.uberfire.lifecycle.OnOpen\";\n    public static final String onSave = \"org.uberfire.lifecycle.OnSave\";\n    public static final String onShutdown = \"org.uberfire.lifecycle.OnShutdown\";\n    public static final String onStartup = \"org.uberfire.lifecycle.OnStartup\";\n    public static final String onContextAttach = \"org.uberfire.lifecycle.OnContextAttach\";\n    public static final String activatedBy = \"org.jboss.errai.ioc.client.api.ActivatedBy\";\n    public static final String validate = \"org.uberfire.lifecycle.Validate\";\n\n    private APIModule() {\n    }\n\n    public static String getPanelDefinitionClass() {\n        return panelDefinition;\n    }\n\n    public static String getPositionClass() {\n        return position;\n    }\n\n    public static String getOnContextAttachClass() {\n        return onContextAttach;\n    }\n\n    public static String getPlaceRequestClass() {\n        return placeRequest;\n    }\n\n    public static String getIsDirtyClass() {\n        return isDirty;\n    }\n\n    public static String getSetContentClass() {\n        return setContent;\n    }\n\n    public static String getGetContentClass() {\n        return getContent;\n    }\n\n    public static String getGetPreviewClass() {\n        return getPreview;\n    }\n\n    public static String getOnCloseClass() {\n        return onClose;\n    }\n\n    public static String getOnShutdownlass() {\n        return onShutdown;\n    }\n\n    public static String getOnFocusClass() {\n        return onFocus;\n    }\n\n    public static String getOnLostFocusClass() {\n        return onLostFocus;\n    }\n\n    public static String getOnMayCloseClass() {\n        return onMayClose;\n    }\n\n    public static String getOnStartupClass() {\n        return onStartup;\n    }\n\n    public static String getOnOpenClass() {\n        return onOpen;\n    }\n\n    public static String getOnSaveClass() {\n        return onSave;\n    }\n\n    public static String getValidateClass() {\n        return validate;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/facades/BackendModule.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors.facades;\n\n/**\n * A collection of type names in the UberFire Backend API module.\n * Due to a bug in Eclipse annotation processor dependencies, we refer to all UberFire type names using Strings,\n * Elements, and TypeMirrors. We cannot refer to the annotation types as types themselves.\n */\npublic class BackendModule {\n\n    public static final String path = \"org.uberfire.backend.vfs.Path\";\n\n    ;\n\n    private BackendModule() {\n    }\n\n    public static String getPathClass() {\n        return path;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/java/org/uberfire/annotations/processors/facades/ClientAPIModule.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors.facades;\n\nimport java.util.Map;\nimport javax.lang.model.element.AnnotationMirror;\nimport javax.lang.model.element.AnnotationValue;\nimport javax.lang.model.element.Element;\nimport javax.lang.model.element.ExecutableElement;\nimport javax.lang.model.element.TypeElement;\nimport javax.lang.model.util.Elements;\n\nimport org.uberfire.annotations.processors.GeneratorUtils;\n\n/**\n * A collection of type names in the UberFire Client API module.\n * Due to a bug in Eclipse annotation processor dependencies, we refer to all UberFire type names using Strings,\n * Elements, and TypeMirrors. We cannot refer to the annotation types as types themselves.\n */\npublic class ClientAPIModule {\n\n    public static final String IDENTIFIER = \"identifier\";\n    public static final String SIZE = \"size\";\n    public static final String OWNING_PERSPECTIVE = \"owningPerspective\";\n    public static final String IS_DEFAULT = \"isDefault\";\n    public static final String IS_DYNAMIC = \"isDynamic\";\n    public static final String IS_TRANSIENT = \"isTransient\";\n    public static final String IS_TEMPLATE = \"isTemplate\";\n    public static final String IS_ENABLED = \"isEnabled\";\n    public static final String VALUE = \"value\";\n    public static final String workbenchSplashScreen = \"org.uberfire.client.annotations.WorkbenchSplashScreen\";\n    public static final String workbenchPerspective = \"org.uberfire.client.annotations.WorkbenchPerspective\";\n    public static final String workbenchPopup = \"org.uberfire.client.annotations.WorkbenchPopup\";\n    public static final String workbenchScreen = \"org.uberfire.client.annotations.WorkbenchScreen\";\n    public static final String workbenchContext = \"org.uberfire.client.annotations.WorkbenchContext\";\n    public static final String workbenchEditor = \"org.uberfire.client.annotations.WorkbenchEditor\";\n    public static final String workbenchClientEditor = \"org.uberfire.client.annotations.WorkbenchClientEditor\";\n    public static final String defaultPosition = \"org.uberfire.client.annotations.DefaultPosition\";\n    public static final String workbenchPartTitle = \"org.uberfire.client.annotations.WorkbenchPartTitle\";\n    public static final String workbenchContextId = \"org.uberfire.client.annotations.WorkbenchContextId\";\n    public static final String workbenchPartTitleDecoration = \"org.uberfire.client.annotations.WorkbenchPartTitleDecoration\";\n    public static final String workbenchPartView = \"org.uberfire.client.annotations.WorkbenchPartView\";\n    public static final String workbenchMenu = \"org.uberfire.client.annotations.WorkbenchMenu\";\n    public static final String workbenchToolBar = \"org.uberfire.client.annotations.WorkbenchToolBar\";\n    public static final String perspective = \"org.uberfire.client.annotations.Perspective\";\n    public static final String splashFilter = \"org.uberfire.client.annotations.SplashFilter\";\n    public static final String splashBodyHeight = \"org.uberfire.client.annotations.SplashBodyHeight\";\n    public static final String intercept = \"org.uberfire.client.annotations.Intercept\";\n    public static final String workbenchPanel = \"org.uberfire.client.annotations.WorkbenchPanel\";\n    public static final String jsType = \"jsinterop.annotations.JsType\";\n\n    // Experimental Features\n    public static final String experimentalFeature = \"org.uberfire.experimental.definition.annotations.ExperimentalFeature\";\n    private static final String scopeGlobal = \"GLOBAL\";\n    private static final String scope = \"scope\";\n    private static final String group = \"group\";\n    private static final String nameI18nKey = \"nameI18nKey\";\n    private static final String descriptionI18nKey = \"descriptionI18nKey\";\n\n    private ClientAPIModule() {\n    }\n\n    public static String getWorkbenchScreenClass() {\n        return workbenchScreen;\n    }\n\n    public static String getSplashFilterClass() {\n        return splashFilter;\n    }\n\n    public static String getSplashBodyHeightClass() {\n        return splashBodyHeight;\n    }\n\n    public static String getInterceptClass() {\n        return intercept;\n    }\n\n    public static String getPerspectiveClass() {\n        return perspective;\n    }\n\n    public static String getWorkbenchToolBarClass() {\n        return workbenchToolBar;\n    }\n\n    public static String getWorkbenchMenuClass() {\n        return workbenchMenu;\n    }\n\n    public static String getWorkbenchPartViewClass() {\n        return workbenchPartView;\n    }\n\n    public static String getWorkbenchPartTitleDecorationsClass() {\n        return workbenchPartTitleDecoration;\n    }\n\n    public static String getWorkbenchContextIdClass() {\n        return workbenchContextId;\n    }\n\n    public static String getWorkbenchPartTitleClass() {\n        return workbenchPartTitle;\n    }\n\n    public static String getDefaultPositionClass() {\n        return defaultPosition;\n    }\n\n    public static String getWorkbenchContextClass() {\n        return workbenchContext;\n    }\n\n    public static String getWorkbenchEditorClass() {\n        return workbenchEditor;\n    }\n\n    public static String getWorkbenchClientEditorClass() {\n        return workbenchClientEditor;\n    }\n\n    public static String getWorkbenchPopupClass() {\n        return workbenchPopup;\n    }\n\n    public static String getWorkbenchSplashScreenClass() {\n        return workbenchSplashScreen;\n    }\n\n    public static String getWorkbenchPerspectiveClass() {\n        return workbenchPerspective;\n    }\n\n    public static String getWorkbenchPanel() {\n        return workbenchPanel;\n    }\n\n    /**\n     * Returns the value of the String-valued Annotation parameter on the given type, ignoring any default value that\n     * exists on the annotation. Returns an empty string if the type lacks the given annotation, or if the annotation\n     * lacks the given parameter.\n     */\n    private static String getAnnotationStringParam(TypeElement target,\n                                                   String annotationClassName,\n                                                   String annotationParamName) {\n        AnnotationValue paramValue = getAnnotationParamValue(target,\n                                                             annotationClassName,\n                                                             annotationParamName);\n        if (paramValue == null) {\n            return \"\";\n        }\n        return paramValue.getValue().toString();\n    }\n\n    /**\n     * Returns the value of the Boolean-valued Annotation parameter on the given type, ignoring any default value that\n     * exists on the annotation. Returns false if the type lacks the given annotation, or if the annotation\n     * lacks the given parameter.\n     */\n    private static Boolean getAnnotationBooleanParam(TypeElement target,\n                                                     String annotationClassName,\n                                                     String annotationParamName) {\n        AnnotationValue paramValue = getAnnotationParamValue(target,\n                                                             annotationClassName,\n                                                             annotationParamName);\n        if (paramValue == null) {\n            return null;\n        }\n        return Boolean.parseBoolean(paramValue.getValue().toString());\n    }\n\n    /**\n     * Returns the value associated with the given parameter of the given annotation on the given class element,\n     * ignoring any default value that exists on the annotation. Returns null if the type lacks the given annotation, or\n     * if the annotation lacks the given parameter.\n     */\n    private static AnnotationValue getAnnotationParamValue(TypeElement target,\n                                                           String annotationClassName,\n                                                           String annotationName) {\n        for (final AnnotationMirror am : target.getAnnotationMirrors()) {\n            if (annotationClassName.equals(am.getAnnotationType().toString())) {\n                for (Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry : am.getElementValues().entrySet()) {\n                    if (annotationName.equals(entry.getKey().getSimpleName().toString())) {\n                        return entry.getValue();\n                    }\n                }\n            }\n        }\n        return null;\n    }\n\n    public static Boolean getWbPerspectiveScreenIsDefaultValueOnClass(TypeElement classElement) {\n        String bool = (getAnnotationStringParam(classElement,\n                                                workbenchPerspective,\n                                                IS_DEFAULT));\n        return Boolean.valueOf(bool);\n    }\n\n    public static Boolean getWbPerspectiveScreenIsDynamicValueOnClass(TypeElement classElement) {\n        String bool = (getAnnotationStringParam(classElement,\n                                                workbenchPerspective,\n                                                IS_DYNAMIC));\n        return Boolean.valueOf(bool);\n    }\n\n    public static Boolean getWbScreenIsDynamicValueOnClass(TypeElement classElement) {\n        String bool = (getAnnotationStringParam(classElement,\n                                                workbenchScreen,\n                                                IS_DYNAMIC));\n        return Boolean.valueOf(bool);\n    }\n\n    public static Boolean getWbEditorIsDynamicValueOnClass(TypeElement classElement) {\n        String bool = (getAnnotationStringParam(classElement,\n                                                workbenchEditor,\n                                                IS_DYNAMIC));\n        return Boolean.valueOf(bool);\n    }\n\n    public static Boolean getWbPerspectiveScreenIsTransientValueOnClass(TypeElement classElement) {\n        String bool = (getAnnotationStringParam(classElement,\n                                                workbenchPerspective,\n                                                IS_TRANSIENT));\n\n        // XXX this is non-ideal because it restates the default of the isTransient property\n        // we should use the getAnnotationValueWithDefaults method in this entire class so\n        // we aren't redundantly declaring defaults here\n        if (bool.isEmpty()) {\n            return true;\n        }\n\n        return Boolean.valueOf(bool);\n    }\n\n    public static String getWbPerspectiveScreenIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchPerspective,\n                                        IDENTIFIER);\n    }\n\n    public static String getWbPopupScreenIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchPopup,\n                                        IDENTIFIER);\n    }\n\n    public static String getWbPopupScreenSizeValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchPopup,\n                                        SIZE);\n    }\n\n    public static String getWbSplashScreenIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchSplashScreen,\n                                        IDENTIFIER);\n    }\n\n    public static boolean getWbSplashScreenIsEnabledValueOnClass(TypeElement classElement) {\n        final Boolean bool = getAnnotationBooleanParam(classElement,\n                                                       workbenchSplashScreen,\n                                                       IS_ENABLED);\n        return bool == null || bool;\n    }\n\n    public static String getWbScreenIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchScreen,\n                                        IDENTIFIER);\n    }\n\n    public static String getWbEditorIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchEditor,\n                                        IDENTIFIER);\n    }\n\n    public static Boolean isExperimentalFeatureGlobal(TypeElement classElement) {\n        String featureScope = getAnnotationStringParam(classElement, experimentalFeature, scope);\n\n        return scopeGlobal.equals(featureScope);\n    }\n\n    public static String getExperimentalFeatureGroup(TypeElement classElement) {\n        return getAnnotationStringParam(classElement, experimentalFeature, group);\n    }\n\n    public static final String getExperimentalFeatureNameKey(TypeElement classElement) {\n        return getAnnotationStringParam(classElement, experimentalFeature, nameI18nKey);\n    }\n\n    public static final String getExperimentalFeatureDescriptionKey(TypeElement classElement) {\n        return getAnnotationStringParam(classElement, experimentalFeature, descriptionI18nKey);\n    }\n\n    public static String getWbContextIdentifierValueOnClass(TypeElement classElement) {\n        return getAnnotationStringParam(classElement,\n                                        workbenchContext,\n                                        IDENTIFIER);\n    }\n\n    public static boolean isATemplate(Elements elementUtils,\n                                      Element element) {\n        return GeneratorUtils.getAnnotation(elementUtils,\n                                            element,\n                                            workbenchPanel) != null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/META-INF/services/javax.annotation.processing.Processor",
    "content": "#\n# Copyright 2015 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\norg.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\norg.uberfire.annotations.processors.WorkbenchContextProcessor\norg.uberfire.annotations.processors.WorkbenchScreenProcessor\norg.uberfire.annotations.processors.WorkbenchEditorProcessor\norg.uberfire.annotations.processors.WorkbenchClientEditorProcessor\norg.uberfire.annotations.processors.WorkbenchPopupProcessor\norg.uberfire.annotations.processors.PerspectiveProcessor\norg.uberfire.annotations.processors.ExperimentalFeatureProcessor\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/activityClientEditor.ftl",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n<#if hasUberView>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\n<#if isWidgetMethodReturnTypeElement>\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\n</#if>\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport elemental2.promise.Promise;\nimport org.uberfire.client.mvp.IsClientEditor;\n\n<#if getDefaultPositionMethodName??>\nimport org.uberfire.workbench.model.Position;\n\n</#if>\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n</#if>\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchClientEditorProcessor\")\n@Named(\"${identifier}\")\n@IsClientEditor\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#if isDynamic>\n@JsType\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractWorkbenchClientEditorActivity {\n\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}(<#if isDynamic>@Shared </#if>final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    <#if hasUberView>\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n\n    </#if>\n    <#if onStartup1ParameterMethodName??>\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup1ParameterMethodName}( place );\n    }\n    <#elseif onStartup0ParameterMethodName??>\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup0ParameterMethodName}();\n    }\n    </#if>\n    <#if onMayCloseMethodName??>\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.${onMayCloseMethodName}();\n    }\n\n    </#if>\n    <#if onCloseMethodName??>\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.${onCloseMethodName}();\n    }\n\n    </#if>\n    <#if onShutdownMethodName??>\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n\n    </#if>\n    <#if onOpenMethodName??>\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n\n    </#if>\n    <#if onLostFocusMethodName??>\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        realPresenter.${onLostFocusMethodName}();\n    }\n\n    </#if>\n    <#if onFocusMethodName??>\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        realPresenter.${onFocusMethodName}();\n    }\n\n    </#if>\n    <#if getTitleWidgetMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.${getTitleWidgetMethodName}();\n    }\n\n    </#if>\n    <#if getTitleMethodName??>\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n\n    </#if>\n    <#if getWidgetMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        <#if isWidgetMethodReturnTypeElement>\n        return ElementWrapperWidget.getWidget( realPresenter.${getWidgetMethodName}().getElement() );\n        <#else>\n        return realPresenter.${getWidgetMethodName}();\n        </#if>\n    }\n\n    <#elseif isWidget>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    </#if>\n    <#if getDefaultPositionMethodName??>\n    @Override\n    public Position getDefaultPosition() {\n        return realPresenter.${getDefaultPositionMethodName}();\n    }\n    </#if>\n    <#if isDirtyMethodName??>\n    @Override\n    public boolean isDirty() {\n        return realPresenter.${isDirtyMethodName}();\n    }\n    </#if>\n    <#if setContentMethodName??>\n    @Override\n    public Promise<Void> setContent(String path, String value) {\n        return realPresenter.${setContentMethodName}(path, value);\n    }\n    </#if>\n    <#if getContentMethodName??>\n    @Override\n    public Promise<String> getContent() {\n        return realPresenter.${getContentMethodName}();\n    }\n    </#if>    \n    @Override\n    public Promise<String> getPreview() {\n    \t<#if getPreviewMethodName??>    \n        return realPresenter.${getPreviewMethodName}();\n        <#else>\n        return Promise.resolve(\"\");\n        </#if>\n    }\n\n    @Override\n    public Promise validate() {\n        <#if validateMethodName??>\n        return realPresenter.${validateMethodName}();\n        <#else>\n        return Promise.resolve(Collections.emptyList());\n        </#if>\n    }\n\n    <#if getContextIdMethodName??>\n    @Override\n    public String contextId() {\n        return realPresenter.${getContextIdMethodName}();\n    }\n\n    </#if>\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n    <#if isDynamic>\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n\n    </#if>\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/activityContext.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\nimport org.uberfire.workbench.model.PanelDefinition;\n\n<#if hasUberView>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchContextActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.mvp.PlaceRequest;\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchContextProcessor\")\n@Named(\"${identifier}\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractWorkbenchContextActivity {\n\n    @Inject\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n    <#if hasUberView>\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n    </#if>\n    <#if onOpenMethodName??>\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n    </#if>\n    <#if getTitleWidgetMethodName??>\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.${getTitleWidgetMethodName}();\n    }\n    </#if>\n    <#if getTitleMethodName??>\n\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n    </#if>\n    <#if getWidgetMethodName??>\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.${getWidgetMethodName}();\n    }\n    <#elseif isWidget>\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n    </#if>\n    <#if getOnContextAttachPanelDefinitionMethodName??>\n\n    @Override\n    public void onAttach( final PanelDefinition panel) {\n        super.onAttach( panel );\n        realPresenter.${getOnContextAttachPanelDefinitionMethodName}( panel );\n    }\n    </#if>\n\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/activityEditor.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\n<#if hasUberView>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\nimport javax.inject.Named;\n<#if associatedResources??>\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\n</#if>\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\n<#if getDefaultPositionMethodName??>\nimport org.uberfire.workbench.model.Position;\n\n</#if>\nimport org.uberfire.mvp.PlaceRequest;\n<#if owningPlace??>\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n</#if>\n\n<#if getMenuBarMethodName??>\nimport org.uberfire.workbench.model.menu.Menus;\n\n</#if>\n<#if getToolBarMethodName??>\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n</#if>\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n</#if>\n<#if lockingStrategy??>\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.*;\n\n</#if>\n<#if isDynamic>\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n</#if>\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"${identifier}\")\n<#if associatedResources??>\n${associatedResources}\n</#if>\n@Priority(${priority})\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#if isDynamic>\n@JsType\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}(<#if isDynamic>@Shared </#if>final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    <#if hasUberView>\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n\n    </#if>\n    <#if preferredHeight??>\n    @Override\n    public int preferredHeight() {\n       return ${preferredHeight};\n    }\n\n    </#if>\n    <#if preferredWidth??>\n    @Override\n    public int preferredWidth() {\n       return ${preferredWidth};\n    }\n\n    </#if>\n    <#if onStartup2ParameterMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.${onStartup2ParameterMethodName}( path, place );\n    }\n\n    <#elseif onStartup1ParameterMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.${onStartup1ParameterMethodName}( path );\n    }\n\n    </#if>\n    <#if onMayCloseMethodName??>\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.${onMayCloseMethodName}();\n    }\n\n    </#if>\n    <#if onCloseMethodName??>\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.${onCloseMethodName}();\n    }\n\n    </#if>\n    <#if onShutdownMethodName??>\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n\n    </#if>\n    <#if onOpenMethodName??>\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n\n    </#if>\n    <#if onLostFocusMethodName??>\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        realPresenter.${onLostFocusMethodName}();\n    }\n\n    </#if>\n    <#if onFocusMethodName??>\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        realPresenter.${onFocusMethodName}();\n    }\n\n    </#if>\n    <#if owningPlace??>\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return new DefaultPlaceRequest(\"${owningPlace}\");\n    }\n\n    </#if>\n    <#if getTitleWidgetMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.${getTitleWidgetMethodName}();\n    }\n\n    </#if>\n    <#if getTitleMethodName??>\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n\n    </#if>\n    <#if getWidgetMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        return realPresenter.${getWidgetMethodName}();\n    }\n\n    <#elseif isWidget>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    </#if>\n    <#if getDefaultPositionMethodName??>\n    @Override\n    public Position getDefaultPosition() {\n        return realPresenter.${getDefaultPositionMethodName}();\n    }\n    </#if>\n    <#if isDirtyMethodName??>\n    @Override\n    public boolean isDirty() {\n        return realPresenter.${isDirtyMethodName}();\n    }\n    </#if>\n    <#if onSaveMethodName??>\n    @Override\n    public void onSave() {\n        super.onSave();\n        realPresenter.${onSaveMethodName}();\n    }\n    </#if>\n    <#if getMenuBarMethodName??>\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.${getMenuBarMethodName}(menusConsumer);\n    }\n\n    </#if>\n    <#if getToolBarMethodName??>\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.${getToolBarMethodName}();\n    }\n\n    </#if>\n    <#if getContextIdMethodName??>\n    @Override\n    public String contextId() {\n        return realPresenter.${getContextIdMethodName}();\n    }\n\n    </#if>\n    <#if lockingStrategy??>\n    @Override\n    public LockingStrategy getLockingStrategy() {\n        return ${lockingStrategy};\n    }\n\n    </#if>\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n    <#if isDynamic>\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n\n    </#if>\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/activityScreen.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\n<#if hasPresenterInitMethod>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\n<#if needsElementWrapper>\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\n</#if>\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\n<#if getDefaultPositionMethodName??>\nimport org.uberfire.workbench.model.Position;\n\n</#if>\nimport org.uberfire.mvp.PlaceRequest;\n<#if owningPlace??>\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n</#if>\n\n<#if getMenuBarMethodName??>\nimport org.uberfire.workbench.model.menu.Menus;\n\n</#if>\n<#if getToolBarMethodName??>\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n</#if>\nimport com.google.gwt.user.client.ui.IsWidget;\n\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n</#if>\n<#if isDynamic>\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n</#if>\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"${identifier}\")\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#if isDynamic>\n@JsType\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}(<#if isDynamic>@Shared </#if>final PlaceManager placeManager) {\n        super( placeManager );\n    }\n    <#if hasPresenterInitMethod>\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n    </#if>\n    <#if preferredHeight??>\n\n    @Override\n    public int preferredHeight() {\n       return ${preferredHeight};\n    }\n    </#if>\n    <#if preferredWidth??>\n\n    @Override\n    public int preferredWidth() {\n       return ${preferredWidth};\n    }\n    </#if>\n    <#if onStartup1ParameterMethodName??>\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup1ParameterMethodName}( place );\n    }\n    <#elseif onStartup0ParameterMethodName??>\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup0ParameterMethodName}();\n    }\n    </#if>\n    <#if onMayCloseMethodName??>\n\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.${onMayCloseMethodName}();\n    }\n    </#if>\n    <#if onCloseMethodName??>\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.${onCloseMethodName}();\n    }\n    </#if>\n    <#if onShutdownMethodName??>\n\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n    </#if>\n    <#if onOpenMethodName??>\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n    </#if>\n    <#if onLostFocusMethodName??>\n\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        realPresenter.${onLostFocusMethodName}();\n    }\n    </#if>\n    <#if onFocusMethodName??>\n\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        realPresenter.${onFocusMethodName}();\n    }\n    </#if>\n    <#if owningPlace??>\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return new DefaultPlaceRequest(\"${owningPlace}\");\n    }\n    </#if>\n    <#if getTitleWidgetMethodName??>\n\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getTitleDecoration() {\n        <#if isTitleWidgetMethodReturnTypeElement>\n        return ElementWrapperWidget.getWidget( realPresenter.${getTitleWidgetMethodName}().getElement() );\n        <#else>\n        return realPresenter.${getTitleWidgetMethodName}();\n        </#if>\n    }\n    </#if>\n    <#if getTitleMethodName??>\n\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n\n    </#if>\n    <#if getWidgetMethodName??>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        <#if isWidgetMethodReturnTypeElement>\n        return ElementWrapperWidget.getWidget( realPresenter.${getWidgetMethodName}().getElement() );\n        <#else>\n        return realPresenter.${getWidgetMethodName}();\n        </#if>\n    }\n\n    <#elseif isWidget>\n    <#if isDynamic>@JsIgnore </#if>@Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    </#if>\n    <#if getDefaultPositionMethodName??>\n\n    @Override\n    public Position getDefaultPosition() {\n        return realPresenter.${getDefaultPositionMethodName}();\n    }\n    </#if>\n    <#if getMenuBarMethodName??>\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.${getMenuBarMethodName}(menusConsumer);\n    }\n\n    </#if>\n    <#if getToolBarMethodName??>\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.${getToolBarMethodName}();\n    }\n\n    </#if>\n    <#if getContextIdMethodName??>\n\n    @Override\n    public String contextId() {\n        return realPresenter.${getContextIdMethodName}();\n    }\n    </#if>\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n    <#if isDynamic>\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n    </#if>\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/experimentalFeatureActivity.ftl",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.client.service.auth.ExperimentalActivityReference;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ${className} implements ExperimentalActivityReference {\n\n    @Override\n    public String getActivityTypeName() {\n        return \"${activityClass}\";\n    }\n\n    @Override\n    public String getActivityId() {\n        return \"${activityId}\";\n    }\n\n    @Override\n    public String getExperimentalFeatureId() {\n        return \"${featureId}\";\n    }\n\n    @Override\n    public ActivityResourceType getActivityType() {\n        return ActivityResourceType.${activityType};\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/experimentalFeatureDefinitionProvider.ftl",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ${className} implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"${featureId}\", ${global}, \"${group}\", \"${nameKey}\", \"${descriptionKey}\");\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/perspective.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n<#if isTemplate>\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\n</#if>\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n<#if getMenuBarMethodName??>\nimport org.uberfire.workbench.model.menu.Menus;\n\n</#if>\n<#if getToolBarMethodName??>\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n</#if>\n<#if isTemplate>\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n</#if>\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n</#if>\n<#if isDynamic>\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n</#if>\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"${identifier}\")\n<#if isTemplate>\n@IsTemplatePerspective\n</#if>\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#if isDynamic>\n@JsType\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractWorkbenchPerspectiveActivity<#if isTemplate> implements TemplatedActivity</#if> {\n\n<#if isTemplate>\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n</#if>\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}(<#if isDynamic>@Shared </#if>final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n\n<#if isDefault>\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n</#if>\n<#if !isTransient>\n    @Override\n    public boolean isTransient() {\n        return false;\n    }\n\n</#if>\n<#if onStartup1ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup1ParameterMethodName}( place );\n    }\n\n<#elseif onStartup0ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup0ParameterMethodName}();\n    }\n\n</#if>\n<#if onCloseMethodName??>\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.${onCloseMethodName}();\n    }\n\n</#if>\n<#if onShutdownMethodName??>\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n\n</#if>\n<#if onOpenMethodName??>\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n\n</#if>\n<#if getPerspectiveMethodName??>\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.${getPerspectiveMethodName}();\n    }\n\n</#if>\n<#if getMenuBarMethodName??>\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.${getMenuBarMethodName}(menusConsumer);\n    }\n\n</#if>\n<#if getToolBarMethodName??>\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.${getToolBarMethodName}();\n    }    \n</#if>\n<#if isTemplate>\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        <#if defaultPanel??>\n        if ( fieldName.equals( \"${defaultPanel.fieldName}\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.${defaultPanel.fieldName}, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.${defaultPanel.fieldName};\n        }\n        </#if>\n        <#list wbPanels as wbPanel>\n        if ( fieldName.equals( \"${wbPanel.fieldName}\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.${wbPanel.fieldName}, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.${wbPanel.fieldName};\n        }\n        </#list>\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        <#if defaultPanel??>\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"${defaultPanel.panelType}\" );\n            <#list defaultPanel.wbParts as wbPart>\n                <#if (wbPart.parameters?size > 0)>\n        Map properties = new HashMap<String,String>();\n                    <#list wbPart.parameters?keys as key>\n        properties.put(\"${key}\",\"${ wbPart.parameters[key]}\");\n                    </#list>\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"${wbPart.partName}\", properties  ) ) );\n                <#else>\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"${wbPart.partName}\" ) ) );\n                </#if>\n            </#list>\n        p.getRoot().appendChild( new NamedPosition( \"${defaultPanel.fieldName}\" ), panelDefinition );\n        </#if>\n\n        <#list wbPanels as wbPanel>\n        PanelDefinition panelDefinition${wbPanel_index} = new PanelDefinitionImpl( \"${wbPanel.panelType}\" );\n            <#list wbPanel.wbParts as wbPart>\n                <#if (wbPart.parameters?size > 0)>\n        Map properties${wbPanel_index} = new HashMap<String,String>();\n                    <#list wbPart.parameters?keys as key>\n        properties${wbPanel_index}.put( \"${key}\",\"${ wbPart.parameters[key]}\" );\n                    </#list>\n        panelDefinition${wbPanel_index}.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"${wbPart.partName}\", properties${wbPanel_index} ) ) );\n                <#else>\n        panelDefinition${wbPanel_index}.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"${wbPart.partName}\" ) ) );\n                </#if>\n            </#list>\n        p.getRoot().appendChild( new NamedPosition( \"${wbPanel.fieldName}\" ), panelDefinition${wbPanel_index} );\n        </#list>\n        return p;\n    }\n</#if>\n<#if isDynamic>\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n</#if>\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/popupScreen.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\n<#if hasUberView>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\n<#if size?has_content>\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport static org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize.*;\n</#if>\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n</#if>\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"${identifier}\")\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractPopupActivity {\n\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    <#if hasUberView>\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n\n    </#if>\n    <#if onStartup1ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup1ParameterMethodName}( place );\n    }\n\n    <#elseif onStartup0ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup0ParameterMethodName}();\n    }\n\n    </#if>\n    <#if onMayCloseMethodName??>\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.${onMayCloseMethodName}();\n    }\n\n    </#if>\n    <#if onCloseMethodName??>\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.${onCloseMethodName}();\n    }\n\n    </#if>\n    <#if onShutdownMethodName??>\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n\n    </#if>\n    <#if onOpenMethodName??>\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n\n    </#if>\n    <#if getTitleWidgetMethodName??>\n    @Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.${getTitleWidgetMethodName}();\n    }\n\n    </#if>\n    <#if getTitleMethodName??>\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n\n    </#if>\n    <#if getWidgetMethodName??>\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.${getWidgetMethodName}();\n    }\n\n    <#elseif isWidget>\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    </#if>\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n    <#if size?has_content>\n\n    @Override\n    public WorkbenchPopupSize getSize() {\n        return ${size};\n    }\n    </#if>\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors/src/main/resources/org/uberfire/annotations/processors/templates/splashScreen.ftl",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage ${packageName};\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\n<#if beanActivatorClass??>\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n</#if>\n<#if hasUberView>\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\n</#if>\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.IsSplashScreen;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@ApplicationScoped\n@Generated(\"org.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\")\n@Named(\"${identifier}\")\n@IsSplashScreen\n<#if beanActivatorClass??>\n@ActivatedBy(${beanActivatorClass}.class)\n</#if>\n<#list qualifiers as qualifier>\n${qualifier}\n</#list>\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class ${className} extends AbstractSplashScreenActivity {\n\n    @Inject\n<#list qualifiers as qualifier>\n    ${qualifier}\n</#list>\n    private ${realClassName} realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public ${className}( final PlaceManager placeManager, final SplashView view ) {\n        super( placeManager, view );\n    }\n\n    <#if hasUberView>\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.${getWidgetMethodName}()).init( realPresenter );\n    }\n\n    </#if>\n    <#if onStartup1ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup1ParameterMethodName}( place );\n    }\n\n    <#elseif onStartup0ParameterMethodName??>\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.${onStartup0ParameterMethodName}();\n    }\n\n    </#if>\n    <#if onCloseMethodName??>\n    @Override\n    public void onClose() {\n        realPresenter.${onCloseMethodName}();\n        super.onClose();\n    }\n\n    </#if>\n    <#if onShutdownMethodName??>\n    @Override\n    public void onShutdown() {\n        super.onShutdown();\n        realPresenter.${onShutdownMethodName}();\n    }\n\n    </#if>\n    <#if onOpenMethodName??>\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.${onOpenMethodName}();\n    }\n\n    </#if>\n    <#if getTitleWidgetMethodName??>\n    @Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.${getTitleWidgetMethodName}();\n    }\n\n    </#if>\n    <#if getTitleMethodName??>\n    @Override\n    public String getTitle() {\n        return realPresenter.${getTitleMethodName}();\n    }\n\n    </#if>\n    <#if getWidgetMethodName??>\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.${getWidgetMethodName}();\n    }\n\n    <#elseif isWidget>\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    </#if>\n    <#if getBodyHeightMethodName??>\n    @Override\n    public Integer getBodyHeight() {\n        return realPresenter.${getBodyHeightMethodName}();\n    }\n\n    </#if>\n    <#if getSplashFilterMethodName??>\n    @Override\n    public SplashScreenFilter getFilter() {\n        return realPresenter.${getSplashFilterMethodName}();\n    }\n\n    </#if>\n    <#if getInterceptMethodName??>\n    @Override\n    public Boolean intercept( final PlaceRequest intercepted ) {\n        return realPresenter.${getInterceptMethodName}( intercepted );\n    }\n\n    </#if>\n    @Override\n    public boolean isEnabled() {\n        <#if isEnabled>\n        return true;\n        <#else>\n        return false;\n        </#if>\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"${identifier}\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/.gitignore",
    "content": "*.class\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2015 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workbench</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workbench-processors-tests</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire Workbench Processors Tests</name>\n  <description>UberFire Workbench Processors Tests</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-processors</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workbench-client</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-security-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-experimental-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-user</artifactId>\n      <scope>provided</scope>\n    </dependency>\n    \n    <dependency>\n      <groupId>com.google.gwt</groupId>\n      <artifactId>gwt-dev</artifactId>\n      <scope>provided</scope>\n      <exclusions>\n        <exclusion>\n          <groupId>org.mortbay.jasper</groupId>\n          <artifactId>apache-el</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>    \n\n    <dependency>\n      <groupId>junit</groupId>\n      <artifactId>junit</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n      <scope>test</scope>\n    </dependency>\n    \n    <dependency>\n        <groupId>com.google.jsinterop</groupId>\n        <artifactId>base</artifactId>\n    </dependency>\n    \n  </dependencies>\n\n  <build>\n    <plugins>\n      <plugin>\n        <groupId>org.apache.maven.plugins</groupId>\n        <artifactId>maven-compiler-plugin</artifactId>\n        <configuration>\n          <proc>none</proc>\n        </configuration>\n      </plugin>\n    </plugins>\n  </build>\n\n</project>\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/main/java/org/uberfire/annotations/processors/AbstractProcessorTest.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.BufferedReader;\nimport java.io.FileNotFoundException;\nimport java.io.FileReader;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.List;\nimport java.util.stream.Collectors;\nimport javax.annotation.processing.Processor;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.DiagnosticCollector;\nimport javax.tools.JavaCompiler;\nimport javax.tools.JavaCompiler.CompilationTask;\nimport javax.tools.JavaFileObject;\nimport javax.tools.StandardJavaFileManager;\nimport javax.tools.ToolProvider;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Base miscfeatures to generate source code with an Annotation Processor\n */\npublic abstract class AbstractProcessorTest {\n\n    private static final String SOURCE_FILETYPE = \".java\";\n\n    /**\n     * Compile a unit of source code with the specified annotation processor\n     * @param annotationProcessor\n     * @param compilationUnits\n     * @return\n     */\n    public List<Diagnostic<? extends JavaFileObject>> compile(final Processor annotationProcessor,\n                                                              final String... compilationUnits) {\n\n        final DiagnosticCollector<JavaFileObject> diagnosticListener = new DiagnosticCollector<JavaFileObject>();\n\n        try {\n\n            final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();\n            final StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnosticListener,\n                                                                                        null,\n                                                                                        null);\n\n            String[] convertedCompilationUnits = convertCompilationUnitToFilePaths(compilationUnits);\n            final Iterable<? extends JavaFileObject> compilationUnitsJavaObjects =\n                    fileManager.getJavaFileObjects(convertedCompilationUnits);\n\n            //Compile with provide annotation processor\n            final CompilationTask task = compiler.getTask(null,\n                                                          fileManager,\n                                                          diagnosticListener,\n                                                          null,\n                                                          null,\n                                                          compilationUnitsJavaObjects);\n            task.setProcessors(Arrays.asList(annotationProcessor));\n            task.call();\n            fileManager.close();\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        }\n        return diagnosticListener.getDiagnostics().stream().filter(p -> p.getKind() != Kind.NOTE).collect(Collectors.toList());\n    }\n\n    private String[] convertCompilationUnitToFilePaths(String[] compilationUnits) {\n        List<String> convertedCompilationUnits = new ArrayList<String>();\n        for (String compilationUnit : compilationUnits) {\n            convertedCompilationUnits.add(this.getClass().getResource(\"/\" + compilationUnit + SOURCE_FILETYPE).getPath());\n        }\n        return convertedCompilationUnits.toArray(new String[convertedCompilationUnits.size()]);\n    }\n\n    /**\n     * Retrieve the expected source code for a compilation unit\n     * @param compilationUnit\n     * @return\n     * @throws FileNotFoundException\n     */\n    public String getExpectedSourceCode(final String compilationUnit) throws FileNotFoundException {\n        StringBuilder sb = new StringBuilder();\n        String expectedCode = null;\n        try {\n            final String path = this.getClass().getResource(\"/\" + compilationUnit).getPath();\n            final FileReader fr = new FileReader(path);\n            final BufferedReader input = new BufferedReader(fr);\n            try {\n                String line = null;\n                while ((line = input.readLine()) != null) {\n                    sb.append(line);\n                    sb.append(System.getProperty(\"line.separator\"));\n                }\n            } finally {\n                input.close();\n            }\n        } catch (FileNotFoundException fnfe) {\n            throw fnfe;\n        } catch (IOException ioe) {\n            fail(ioe.getMessage());\n        }\n        expectedCode = sb.toString();\n        //check to remove extra carriage return character \\r from expected code in windows environment\n        if (System.getProperty(\"os.name\").toLowerCase().contains(\"windows\")) {\n            expectedCode = expectedCode.replaceAll(\"\\\\r\", \"\");\n        }\n        return expectedCode;\n    }\n\n    /**\n     * Assert that compilation was successful\n     * @param diagnostics\n     */\n    public void assertSuccessfulCompilation(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        assertFalse(diagnostics.toString(),\n                    hasErrors(diagnostics));\n    }\n\n    /**\n     * Assert that compilation failed\n     * @param diagnostics\n     */\n    public void assertFailedCompilation(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        assertTrue(hasErrors(diagnostics));\n    }\n\n    private boolean hasErrors(final List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {\n            if (diagnostic.getKind().equals(Kind.ERROR)) {\n                return true;\n            }\n        }\n        return false;\n    }\n\n    /**\n     * Assert that the given error message is contained in the compilation\n     * diagnostics.\n     * @param diagnostics the list of diagnostic messages from the compiler. Must not be null.\n     * @param kind the kind of message to search for, or null to search messages of\n     * any kind.\n     * @param line the line number that must be attached to the message, or\n     * {@link Diagnostic#NOPOS} if line number is not important.\n     * @param col the column number that must be attached to the message, or\n     * {@link Diagnostic#NOPOS} if column number is not important.\n     * @param message the message to search for. If any otherwise matching message in\n     * the given list contains this string, the assertion passes. Must not be null.\n     */\n    public void assertCompilationMessage(List<Diagnostic<? extends JavaFileObject>> diagnostics,\n                                         Kind kind,\n                                         long line,\n                                         long col,\n                                         final String message) {\n        StringBuilder sb = new StringBuilder(100);\n        for (Diagnostic<? extends JavaFileObject> msg : diagnostics) {\n            sb.append(msg.getKind())\n                    .append(\" \")\n                    .append(msg.getLineNumber())\n                    .append(\":\")\n                    .append(msg.getColumnNumber())\n                    .append(\": \")\n                    .append(msg.getMessage(null))\n                    .append(\"\\n\");\n            if ((kind == null || msg.getKind().equals(kind))\n                    && (line == Diagnostic.NOPOS || msg.getLineNumber() == line)\n                    && (col == Diagnostic.NOPOS || msg.getColumnNumber() == col)\n                    && msg.getMessage(null).contains(message)) {\n                return;\n            }\n        }\n\n        fail(\"Compiler diagnostics did not contain \" + kind + \" message \" + line + \":\" + col + \": \" + message + \"\\n\" +\n                     \"Dump of all \" + diagnostics.size() + \" actual messages:\\n\" +\n                     sb);\n    }\n\n    /**\n     * Returns the annotation processor being tested by the current test. This processor should be\n     * created with a GenerationCompleteCallback that will capture the output of the processor so it can be examined\n     * by test assertions.\n     */\n    protected abstract AbstractErrorAbsorbingProcessor getProcessorUnderTest();\n\n    /**\n     * Regression test for UF-44: Annotation Processors can put eclipse into an infinite loop.\n     */\n    @Test\n    public void shouldNotAllowClassNotFoundExceptionThrough() throws Exception {\n        AbstractErrorAbsorbingProcessor processorUnderTest = null;\n        try {\n            AbstractGenerator.FAIL_FOR_TESTING = true;\n            processorUnderTest = getProcessorUnderTest();\n        } catch (Throwable t) {\n            t.printStackTrace();\n            fail(\"The annotation processor's constructor threw an exception. This is bad for Eclipse!\");\n        } finally {\n            AbstractGenerator.FAIL_FOR_TESTING = false;\n        }\n\n        // ensure the error message was preserved so the user has a hope of tracking down the problem!\n        List<Diagnostic<? extends JavaFileObject>> messages = compile(processorUnderTest,\n                                                                      \"org/uberfire/annotations/processors/AnnotatedWithEverything\");\n        assertCompilationMessage(messages,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"Failing for testing purposes\");\n    }\n\n    /**\n     * Container for miscfeatures results.\n     */\n    public class Result {\n\n        private String expectedCode;\n        private String actualCode;\n\n        public String getExpectedCode() {\n            return expectedCode;\n        }\n\n        public void setExpectedCode(final String expectedCode) {\n            this.expectedCode = expectedCode;\n        }\n\n        public String getActualCode() {\n            return actualCode;\n        }\n\n        public void setActualCode(final String actualCode) {\n            this.actualCode = actualCode;\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/ExperimentalFeatureProcessorTest.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\n\nimport javax.tools.Diagnostic;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertTrue;\n\npublic class ExperimentalFeatureProcessorTest extends AbstractProcessorTest {\n\n    private Result provider = new Result();\n    private Result reference = new Result();\n\n    private boolean providerGenerated = false;\n    private boolean referenceGenerated = false;\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new ExperimentalFeatureProcessor(code -> {\n            if (!providerGenerated) {\n                provider.setActualCode(code);\n                providerGenerated = true;\n            } else {\n                reference.setActualCode(code);\n                referenceGenerated = true;\n            }\n        });\n    }\n\n    @Test\n    public void testDefaultConfiguration() throws FileNotFoundException {\n        testCodeGeneration(\"org/uberfire/annotations/processors/ExperimentalFeatureTest1\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest1.expected\", null);\n    }\n\n    @Test\n    public void testExtraConfiguration() throws FileNotFoundException {\n        testCodeGeneration(\"org/uberfire/annotations/processors/ExperimentalFeatureTest2\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest2.expected\", null);\n    }\n\n    @Test\n    public void testExperimentalForWorkbenchScreen() throws FileNotFoundException {\n        testCodeGeneration(\"org/uberfire/annotations/processors/ExperimentalFeatureTest3\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest3Provider.expected\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest3Reference.expected\");\n    }\n\n    @Test\n    public void testExperimentalForWorkbenchPerspective() throws FileNotFoundException {\n        testCodeGeneration(\"org/uberfire/annotations/processors/ExperimentalFeatureTest4\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest4Provider.expected\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest4Reference.expected\");\n    }\n\n    @Test\n    public void testExperimentalForWorkbenchEditor() throws FileNotFoundException {\n        testCodeGeneration(\"org/uberfire/annotations/processors/ExperimentalFeatureTest5\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest5Provider.expected\", \"org/uberfire/annotations/processors/expected/ExperimentalFeatureTest5Reference.expected\");\n    }\n\n    private void testCodeGeneration(String sourceCodePath, String expectedProviderCodePath, String expectedReferenceCodePath) throws FileNotFoundException {\n        provider.setExpectedCode(getExpectedSourceCode(expectedProviderCodePath));\n\n        if (expectedReferenceCodePath != null) {\n            reference.setExpectedCode(getExpectedSourceCode(expectedReferenceCodePath));\n        }\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                sourceCodePath);\n\n        assertTrue(providerGenerated);\n\n        assertEquals(referenceGenerated, expectedReferenceCodePath != null);\n\n        assertSuccessfulCompilation(diagnostics);\n\n        checkCode(provider);\n\n        if (referenceGenerated) {\n            checkCode(reference);\n        }\n    }\n\n    private void checkCode(Result result) {\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(), result.getActualCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/GeneratorUtilsTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.junit.Test;\n\nimport static java.util.Arrays.asList;\nimport static java.util.Collections.singletonList;\nimport static org.junit.Assert.*;\n\npublic class GeneratorUtilsTest {\n\n    @Test\n    public void testFormatProblems1Item() {\n        String msg = GeneratorUtils.formatProblemsList(\"com.foo.MyAnnotation\",\n                                                       singletonList(\"be fun\"));\n        assertEquals(\"Methods annotated with @MyAnnotation must be fun\",\n                     msg);\n    }\n\n    @Test\n    public void testFormatProblems2Items() {\n        String msg = GeneratorUtils.formatProblemsList(\n                \"com.foo.MyAnnotation\",\n                asList(\"be wise\",\n                       \"be fair\"));\n        assertEquals(\"Methods annotated with @MyAnnotation must be wise and be fair\",\n                     msg);\n    }\n\n    @Test\n    public void testFormatProblems3Items() {\n        String msg = GeneratorUtils.formatProblemsList(\n                \"com.foo.MyAnnotation\",\n                asList(\"be wise\",\n                       \"be fair\",\n                       \"be kind\"));\n        assertEquals(\"Methods annotated with @MyAnnotation must be wise, be fair, and be kind\",\n                     msg);\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/PartInformationTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class PartInformationTest {\n\n    @Test\n    public void testJustPartName() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(0,\n                     pi.getParameters().size());\n    }\n\n    @Test\n    public void testPartNameWithTrailingQuestionMark() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(0,\n                     pi.getParameters().size());\n    }\n\n    @Test\n    public void testPartNameAndOneParam() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?oh=yeah\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"yeah\",\n                     pi.getParameters().get(\"oh\"));\n    }\n\n    @Test\n    public void testPartNameAndManyParams() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?oh=yeah&really=yup&areYou=sure\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(3,\n                     pi.getParameters().size());\n        assertEquals(\"yeah\",\n                     pi.getParameters().get(\"oh\"));\n        assertEquals(\"yup\",\n                     pi.getParameters().get(\"really\"));\n        assertEquals(\"sure\",\n                     pi.getParameters().get(\"areYou\"));\n    }\n\n    @Test\n    public void testEscapesInAllParts() throws Exception {\n        PartInformation pi = new PartInformation(\"the%3fPlace?o%3dh=ye%3dah&re%21ally=y%25up\");\n        assertEquals(\"the?Place\",\n                     pi.getPartName());\n        assertEquals(2,\n                     pi.getParameters().size());\n        assertEquals(\"ye=ah\",\n                     pi.getParameters().get(\"o=h\"));\n        assertEquals(\"y%up\",\n                     pi.getParameters().get(\"re!ally\"));\n    }\n\n    @Test\n    public void testEmptyParamKey() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?=emptyString\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"emptyString\",\n                     pi.getParameters().get(\"\"));\n    }\n\n    @Test\n    public void testEmptyParamValue() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?lonelyKey\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"\",\n                     pi.getParameters().get(\"lonelyKey\"));\n    }\n\n    @Test\n    public void testEmptyParamValueTrailingEquals() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?lonelyKey=\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"\",\n                     pi.getParameters().get(\"lonelyKey\"));\n    }\n\n    @Test\n    public void testRepeatedParamLastValueWins() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?repeat=peat&repeat=eat&repeat=at\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"at\",\n                     pi.getParameters().get(\"repeat\"));\n    }\n\n    @Test\n    public void testEqualsBeforeQuestionMarkIsALiteral() throws Exception {\n        PartInformation pi = new PartInformation(\"strange=place=name\");\n        assertEquals(\"strange=place=name\",\n                     pi.getPartName());\n        assertEquals(0,\n                     pi.getParameters().size());\n    }\n\n    @Test\n    public void testQuestionMarkAfterQuestionMarkIsALiteral() throws Exception {\n        PartInformation pi = new PartInformation(\"thePlace?strange?param?name=strange?param?value\");\n        assertEquals(\"thePlace\",\n                     pi.getPartName());\n        assertEquals(1,\n                     pi.getParameters().size());\n        assertEquals(\"strange?param?value\",\n                     pi.getParameters().get(\"strange?param?name\"));\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/PerspectiveProcessorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\npublic class PerspectiveProcessorTest extends AbstractProcessorTest {\n\n    final Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new PerspectiveProcessor(new GenerationCompleteCallback() {\n\n            @Override\n            public void generationComplete(String code) {\n                result.setActualCode(code);\n            }\n        });\n    }\n\n    @Test\n    public void testNoPerspectiveAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/PerspectiveTest1\");\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testIncorrectReturnTypeWithoutArguments() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/PerspectiveTest2\");\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 10,\n                                 17,\n                                 \"Methods annotated with @Perspective must return org.uberfire.workbench.model.PerspectiveDefinition\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testCorrectReturnTypeWithArguments() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/PerspectiveTest3\");\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"A WorkbenchPerspective class must have either a valid @Perspective method or at least one @WorkbenchPanel field.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testCorrectReturnTypeWithoutArguments() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest4\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest4.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testCorrectReturnTypeWithoutArgumentsIsDefault() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest5\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest5.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testCorrectReturnTypeWithAllAnnotationsOnStart() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest6\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest6.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testCorrectReturnTypeWithAllAnnotationsOnStartWithPath() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest7.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchMenuAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest8\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest8.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchMenuAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest9\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest9.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchToolBarAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest10\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest10.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchToolBarAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest11\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest11.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchTemplateAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest12\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest12.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        printDiagnostics(diagnostics);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchTemplateAnnotationWithOnlyWorkbenchParts() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest13\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest13.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        printDiagnostics(diagnostics);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchTemplateAnnotationMustHaveWorkbenchPanelsOrParts() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest14\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertFailedCompilation(diagnostics);\n    }\n\n    @Test\n    public void testWorkbenchTemplateAnnotationShouldNotAllowTwoDefaultWorkbenchPanels() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest15\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 15,\n                                 8,\n                                 \"Found more than one @WorkbenchPanel with isDefault=true.\");\n    }\n\n    @Test\n    public void testWorkbenchTemplateAnnotationWithNoDefaultWorkbenchPanel() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest16\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest16.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testAlonePartAnnotationShouldGenerateDefaultPanel() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest17\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest17.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        printDiagnostics(diagnostics);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testAlonePartsAnnotationShouldGenerateDefaultPanel() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest18\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest18.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        printDiagnostics(diagnostics);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testPartsAnnotationShouldReceiveParameters() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest19\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest19.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        printDiagnostics(diagnostics);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testPerspectiveWithActivator() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest20\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest20.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testNonTransientPerspective() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest21\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest21.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void twoDefaultPerspectivesShouldGenerateAnError() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest19\";\n        final String pathCompilationUnit2 = \"org/uberfire/annotations/processors/PerspectiveTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest19.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit,\n                                                                               pathCompilationUnit2);\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 -1,\n                                 -1,\n                                 \"Found too many default WorkbenchPerspectives (expected 1). Found: (HomePerspective, PerspectiveTest7).\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchPerspectivesOnStartMultipleMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest22\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 36,\n                                 17,\n                                 \"Found multiple @OnStartup methods. Each class can declare at most one.\");\n        assertFailedCompilation(diagnostics);\n    }\n\n    @Test\n    public void combiningPerspectiveMethodAndWorkbenchPanelFieldsShouldGenerateAnError() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest23\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 19,\n                                 8,\n                                 \"This WorkbenchPerspective has both a @Perspective method and a @WorkbenchPanel field. Only one or the other is allowed.\");\n    }\n\n    @Test\n    public void testDynamicPerspective() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest24\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest24.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testQualifiersInTheActivity() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/PerspectiveTest25\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/PerspectiveTest25.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    private void printDiagnostics(List<Diagnostic<? extends JavaFileObject>> diagnostics) {\n        for (Diagnostic<? extends JavaFileObject> diagnostic : diagnostics) {\n            System.out.println(diagnostic);\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/WorkbenchClientEditorProcessorTest.java",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport static org.junit.Assert.assertEquals;\nimport static org.junit.Assert.assertNotNull;\nimport static org.junit.Assert.assertNull;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\n\nimport javax.tools.Diagnostic;\nimport javax.tools.JavaFileObject;\nimport javax.tools.Diagnostic.Kind;\n\nimport elemental2.promise.Promise;\nimport org.junit.Test;\n\npublic class WorkbenchClientEditorProcessorTest extends AbstractProcessorTest {\n\n    Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchClientEditorProcessor(code -> result.setActualCode(code));\n    }\n\n    @Test\n    public void testNoWorkbenchClientEditorAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest1\");\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testDoNotExtendWidgetOrProvideElement() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest2\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchClientEditorTest2Activity: The WorkbenchClientEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testMissingWorkbenchPartTitle() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest3\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchClientEditorTest3Activity: The WorkbenchClientEditor must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testMissingSetContent() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest4\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchClientEditorTest4Activity: The WorkbenchClientEditor must provide a @SetContent annotated method that has two java.lang.String (path and content) as parameters.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testMissingGetContent() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest5\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchClientEditorTest5Activity: The WorkbenchClientEditor must provide a @GetContent annotated method to return a elemental2.promise.Promise\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testSuccessContent() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest6\");\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest6.expected\";\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testSuccessContentWithGetPreview() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest7\");\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest7.expected\";\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testSuccessContentWithValidate() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchClientEditorTest8\");\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest8.expected\";\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/WorkbenchEditorProcessorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for Editor related class generation\n */\npublic class WorkbenchEditorProcessorTest extends AbstractProcessorTest {\n\n    final Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchEditorProcessor(new GenerationCompleteCallback() {\n\n            @Override\n            public void generationComplete(final String code) {\n                //check to remove extra carriage return \\r character from string in windows environment\n                if (System.getProperty(\"os.name\").toLowerCase().contains(\"windows\")) {\n                    result.setActualCode(code.replaceAll(\"\\\\r\", \"\"));\n                } else {\n                    result.setActualCode(code);\n                }\n            }\n        });\n    }\n\n    @Test\n    public void testNoWorkbenchEditorAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchEditorTest1\");\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMissingViewAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchEditorTest2\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchEditorTest2Activity: The WorkbenchEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorHasViewAnnotationMissingTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchEditorTest3\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchEditorTest3Activity: The WorkbenchEditor must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMissingViewAnnotationHasTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchEditorTest4\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchEditorTest4Activity: The WorkbenchEditor must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorHasViewAnnotationAndHasTitleAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest5\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest5.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest6\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest6.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorHasViewAnnotationAndExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest7.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.WARNING,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"The WorkbenchEditor both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorAllAnnotations() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest8\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest8.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorWorkbenchMenuAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest9\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest9.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorWorkbenchMenuAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest10\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest10.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorOnStart1Parameter() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest11\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest11.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorOnStart2Parameters() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest12\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest12.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorOnStart2ParametersWrongOrder() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest13\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest13.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"Methods annotated with @OnStartup must take one argument of type org.uberfire.backend.vfs.Path and an optional second argument of type org.uberfire.mvp.PlaceRequest\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorOnStartMultipleMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest14\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest14.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.WARNING,\n                                 27,\n                                 17,\n                                 \"There is also an @OnStartup(Path, PlaceRequest) method in this class. That method takes precedence over this one.\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorWorkbenchToolBarAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest15\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest15.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorWorkbenchToolBarAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest16\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest16.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypes() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest17\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest17.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testEditorWithActivator() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest18\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest18.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testEditorWithOwningPerspective() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest19\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest19.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testEditorWithInvalidOwningPerspectiveRef() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest20\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 14,\n                                 Diagnostic.NOPOS,\n                                 \"owningPerspective must be a class annotated with @WorkbenchPerspective\");\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypesWithPreferredWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest24\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest24.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    public void testWorkbenchEditorMultipleSupportedTypesWithNegativePreferredWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest25\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest25.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypesWithPreferredHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest26\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest26.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypesWithNegativePreferredHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest21\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest21.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypesWithPreferredHeightAndWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest22\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest22.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchEditorMultipleSupportedTypesWithNegativePreferredHeightAndWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest23\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest23.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testEditorWithLockingStrategy() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest27\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest27.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testDynamicWorkbenchEditor() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest28\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest28.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testQualifiersInTheActivity() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchEditorTest29\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchEditorTest29.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/WorkbenchPopupProcessorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for Pop-up related class generation\n */\npublic class WorkbenchPopupProcessorTest extends AbstractProcessorTest {\n\n    final Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchPopupProcessor(new GenerationCompleteCallback() {\n\n            @Override\n            public void generationComplete(String code) {\n                result.setActualCode(code);\n            }\n        });\n    }\n\n    @Test\n    public void testNoWorkbenchPopupAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchPopupTest1\");\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupAnnotationMissingViewAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchPopupTest2\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchPopupTest2Activity: The WorkbenchPopup must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupHasViewAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest3\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest3.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest4\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest4.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupHasViewAnnotationAndExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest5\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest5.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.WARNING,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"The WorkbenchPopup both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupAllAnnotations() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest6\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest6.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupOnStart0Parameter() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest7.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupOnStart1Parameter() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest8\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest8.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupOnStartMultipleMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest9\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 24,\n                                 17,\n                                 \"Found multiple @OnStartup methods. Each class can declare at most one.\");\n    }\n\n    @Test\n    public void testWorkbenchPopupHasTitleWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest10\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchPopupTest10Activity: The WorkbenchPopup must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchPopupHasTitleAndTitleWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest11\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest11.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testPopupWithActivator() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest12\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest12.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testPopupSize() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest13\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest13.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testQualifiersInTheActivity() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchPopupTest14\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchPopupTest14.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/WorkbenchScreenProcessorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for Screen related class generation\n */\npublic class WorkbenchScreenProcessorTest extends AbstractProcessorTest {\n\n    Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchScreenProcessor(new GenerationCompleteCallback() {\n            @Override\n            public void generationComplete(final String code) {\n                result.setActualCode(code);\n            }\n        });\n    }\n\n    @Test\n    public void testNoWorkbenchScreenAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchScreenTest1\");\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenMissingViewAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchScreenTest2\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchScreenTest2Activity: The WorkbenchScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget or preferably org.jboss.errai.common.client.api.IsElement.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationMissingTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchScreenTest3\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchScreenTest3Activity: The WorkbenchScreen must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenMissingViewAnnotationHasTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchScreenTest4\");\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchScreenTest4Activity: The WorkbenchScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget or preferably org.jboss.errai.common.client.api.IsElement.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationAndHasTitleAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest5\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest5.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest6\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest6.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationAndExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest7.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.WARNING,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"The WorkbenchScreen both extends com.google.gwt.user.client.ui.IsWidget and provides a @WorkbenchPartView annotated method. The annotated method will take precedence.\");\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenAllAnnotations() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest8\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest8.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenAllAnnotationsPrivate() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest20\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 19,\n                                 22,\n                                 \"Methods annotated with @WorkbenchPartView must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 24,\n                                 20,\n                                 \"Methods annotated with @WorkbenchPartTitle must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 29,\n                                 18,\n                                 \"Methods annotated with @OnStartup must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 33,\n                                 21,\n                                 \"Methods annotated with @OnMayClose must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 38,\n                                 18,\n                                 \"Methods annotated with @OnClose must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 42,\n                                 18,\n                                 \"Methods annotated with @OnOpen must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 46,\n                                 18,\n                                 \"Methods annotated with @OnLostFocus must be non-private\");\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 50,\n                                 18,\n                                 \"Methods annotated with @OnFocus must be non-private\");\n\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenWorkbenchMenuAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest9\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest9.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenWorkbenchMenuAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest10\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest10.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenOnStart0Parameter() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest11\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest11.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenOnStart1Parameter() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest12\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest12.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenOnStartMultipleMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest13\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 24,\n                                 17,\n                                 \"Found multiple @OnStartup methods. Each class can declare at most one.\");\n    }\n\n    @Test\n    public void testWorkbenchScreenWorkbenchToolBarAnnotationCorrectReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest14\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest14.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenWorkbenchToolBarAnnotationWrongReturnType() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest15\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest15.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest16\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchScreenTest16Activity: The WorkbenchScreen must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest17\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest17.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenCanInheritAnnotatedMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest18\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest18.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testScreenWithActivator() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest19\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest19.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testScreenWithOwningPerspective() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest21\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest21.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testScreenWithInvalidOwningPerspectiveRef() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest22\";\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 12,\n                                 Diagnostic.NOPOS,\n                                 \"owningPerspective must be a class annotated with @WorkbenchPerspective\");\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithPreferredWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest24\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest24.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithNegativePreferredWidth() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest25\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest25.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithPreferredHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest26\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest26.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithNegativePreferredHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest27\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest27.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithPreferredWidthAndHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest28\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest28.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleWidgetWithNegativePreferredWidthAndHeight() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest23\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest23.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(getProcessorUnderTest(),\n                                                                               pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationIsElementAndHasTitleAnnotation() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest29\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest29.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenUberElement() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest30\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest30.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleElement() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest31\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest31.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasTitleAndTitleAndWidgetAsElement() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest32\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest32.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testDynamicWorkbenchScreen() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest33\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest33.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testQualifiersInTheActivity() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchScreenTest34\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchScreenTest34.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getActualCode(),\n                     result.getExpectedCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/annotations/processors/WorkbenchSplashScreenProcessorTest.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.uberfire.annotations.processors;\n\nimport java.io.FileNotFoundException;\nimport java.util.List;\nimport javax.tools.Diagnostic;\nimport javax.tools.Diagnostic.Kind;\nimport javax.tools.JavaFileObject;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.*;\n\n/**\n * Tests for Splash Screen related class generation\n */\npublic class WorkbenchSplashScreenProcessorTest extends AbstractProcessorTest {\n\n    Result result = new Result();\n\n    @Override\n    protected AbstractErrorAbsorbingProcessor getProcessorUnderTest() {\n        return new WorkbenchSplashScreenProcessor(new GenerationCompleteCallback() {\n            @Override\n            public void generationComplete(final String code) {\n                result.setActualCode(code);\n            }\n        });\n    }\n\n    @Test\n    public void testNoWorkbenchScreenAnnotation() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest1\");\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenMissingViewAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest2\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchSplashScreenTest2Activity: The WorkbenchSplashScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenHasViewAnnotationMissingTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest3\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchSplashScreenTest3Activity: The WorkbenchSplashScreen must provide a @WorkbenchPartTitle annotated method to return a java.lang.String.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenMissingViewAnnotationHasTitleAnnotation() {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest4\");\n\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchSplashScreenTest4Activity: The WorkbenchSplashScreen must either extend IsWidget or provide a @WorkbenchPartView annotated method to return a com.google.gwt.user.client.ui.IsWidget.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testIncorrectReturnTypeWithoutArguments() throws FileNotFoundException {\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest5\");\n\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 Diagnostic.NOPOS,\n                                 Diagnostic.NOPOS,\n                                 \"org.uberfire.annotations.processors.WorkbenchSplashScreenTest5Activity: The WorkbenchSplashScreen must provide a @SplashFilter annotated method to return a org.uberfire.workbench.model.SplashScreenFilter.\");\n        assertNull(result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchScreenExtendsIsWidget() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest6\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest6.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testSplashScreenWithActivator() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest7\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest7.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testWorkbenchSplashScreenOnStartMultipleMethods() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest8\";\n\n        final Result result = new Result();\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(new WorkbenchSplashScreenProcessor(new GenerationCompleteCallback() {\n\n                                                                                   @Override\n                                                                                   public void generationComplete(String code) {\n                                                                                       result.setActualCode(code);\n                                                                                   }\n                                                                               }),\n                                                                               pathCompilationUnit);\n        assertFailedCompilation(diagnostics);\n        assertCompilationMessage(diagnostics,\n                                 Kind.ERROR,\n                                 -1,\n                                 -1,\n                                 \"Found multiple @OnStartup methods. Each class can declare at most one.\");\n    }\n\n    @Test\n    public void testWorkbenchSplashScreenIsEnabled() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest9\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest9.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n\n    @Test\n    public void testQualifiersInTheActivity() throws FileNotFoundException {\n        final String pathCompilationUnit = \"org/uberfire/annotations/processors/WorkbenchSplashScreenTest10\";\n        final String pathExpectedResult = \"org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest10.expected\";\n\n        result.setExpectedCode(getExpectedSourceCode(pathExpectedResult));\n\n        final List<Diagnostic<? extends JavaFileObject>> diagnostics = compile(\n                getProcessorUnderTest(),\n                pathCompilationUnit);\n\n        assertSuccessfulCompilation(diagnostics);\n        assertNotNull(result.getActualCode());\n        assertNotNull(result.getExpectedCode());\n        assertEquals(result.getExpectedCode(),\n                     result.getActualCode());\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/client/mvp/MyTestType.java",
    "content": "/*\n * Copyright 2015 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.workbench.type.ClientResourceType;\nimport org.uberfire.workbench.category.Category;\nimport org.uberfire.workbench.category.Others;\n\n@ApplicationScoped\npublic class MyTestType implements ClientResourceType {\n\n    private Category category;\n\n    public MyTestType() {\n    }\n\n    @Inject\n    public MyTestType(final Others category) {\n        this.category = category;\n    }\n\n    @Override\n    public Category getCategory() {\n        return this.category;\n    }\n\n    @Override\n    public String getShortName() {\n        return \"test\";\n    }\n\n    @Override\n    public String getDescription() {\n        return \"my test desc\";\n    }\n\n    @Override\n    public IsWidget getIcon() {\n        return null;\n    }\n\n    @Override\n    public String getPrefix() {\n        return \"\";\n    }\n\n    @Override\n    public String getSuffix() {\n        return \"\";\n    }\n\n    @Override\n    public int getPriority() {\n        return 0;\n    }\n\n    @Override\n    public String getSimpleWildcardPattern() {\n        return \"anything*\";\n    }\n\n    @Override\n    public boolean accept(final Path path) {\n        return true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/client/mvp/QualifierAnnotation.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\nimport javax.inject.Qualifier;\n\n@Qualifier\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface QualifierAnnotation {\n\n    Class<?> classField();\n\n    String stringField();\n\n    boolean booleanField();\n\n    int intField();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/java/org/uberfire/client/mvp/RegularAnnotation.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client.mvp;\n\nimport java.lang.annotation.ElementType;\nimport java.lang.annotation.Inherited;\nimport java.lang.annotation.Retention;\nimport java.lang.annotation.RetentionPolicy;\nimport java.lang.annotation.Target;\n\n@Inherited\n@Retention(RetentionPolicy.RUNTIME)\n@Target({ElementType.TYPE, ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})\npublic @interface RegularAnnotation {\n\n    Class<?> classField();\n\n    String stringField();\n\n    boolean booleanField();\n\n    int intField();\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/logback-test.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\n<configuration>\n\n  <appender name=\"consoleAppender\" class=\"ch.qos.logback.core.ConsoleAppender\">\n    <encoder>\n      <!-- %l lowers performance -->\n      <!--<pattern>%d [%t] %-5p %l%n  %m%n</pattern>-->\n      <pattern>%d [%t] %-5p %m%n</pattern>\n    </encoder>\n  </appender>\n\n  <logger name=\"org.uberfire\" level=\"info\"/>\n\n  <root level=\"warn\">\n    <appender-ref ref=\"consoleAppender\" />\n  </root>\n\n</configuration>\n\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/AnnotatedWithEverything.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchContext;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n/**\n * A non-functional class that exists only to support the UF-44 regression test.\n */\n@WorkbenchPerspective(identifier = \"sample\")\n@WorkbenchEditor(identifier = \"sample\")\n@WorkbenchContext(identifier = \"sample\")\n@WorkbenchPopup(identifier = \"sample\")\n@WorkbenchScreen(identifier = \"sample\")\n@WorkbenchSplashScreen(identifier = \"sample\")\n@ExperimentalFeature\n@WorkbenchClientEditor(identifier = \"sample\")\npublic class AnnotatedWithEverything {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/ExperimentalFeatureTest1.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature\npublic class ExperimentalFeatureTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/ExperimentalFeatureTest2.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@ExperimentalFeature(group = \"group\", scope = ExperimentalFeature.Scope.GLOBAL, nameI18nKey = \"name\", descriptionI18nKey = \"description\")\npublic class ExperimentalFeatureTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/ExperimentalFeatureTest3.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@WorkbenchScreen(identifier = \"ExperimentalFeatureTest3\")\n@ExperimentalFeature\npublic class ExperimentalFeatureTest3 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/ExperimentalFeatureTest4.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@WorkbenchPerspective(identifier = \"ExperimentalFeatureTest4\")\n@ExperimentalFeature(group = \"group\", scope = ExperimentalFeature.Scope.GLOBAL, nameI18nKey = \"name\", descriptionI18nKey = \"description\")\npublic class ExperimentalFeatureTest4 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/ExperimentalFeatureTest5.java",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.experimental.definition.annotations.ExperimentalFeature;\n\n@WorkbenchEditor(identifier = \"ExperimentalFeatureTest5\")\n@ExperimentalFeature\npublic class ExperimentalFeatureTest5 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class PerspectiveTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest10.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest10\")\npublic class PerspectiveTest10 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @WorkbenchToolBar\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest11.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest11\")\npublic class PerspectiveTest11 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @WorkbenchToolBar\n    public String getToolBar() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest12.java",
    "content": "package org.uberfire.client;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest12 implements IsElement {\n\n    @Inject\n    @WorkbenchPanel(panelType = MultiTabWorkbenchPanelPresenter.class,\n                    isDefault = true,\n                    parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Div teste;\n\n    @Inject\n    @WorkbenchPanel( parts = \"HelloWorldScreen3\" )\n    Div teste2;\n\n    @Inject\n    @WorkbenchPanel( parts = \"HelloWorldScreen4\" )\n    Div teste3;\n\n    @Inject\n    @WorkbenchPanel( parts = \"HelloWorldScreen5\" )\n    Div teste4;\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest13.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest13 {\n\n    @WorkbenchPanel( panelType = MultiTabWorkbenchPanelPresenter.class,\n                     isDefault =  true,\n                     parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Object teste = new Object();\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest14.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.WorkbenchPerspective;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest14 {\n\n    Object teste = new Object();\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest15.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.workbench.model.PanelType;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest15 {\n\n    @WorkbenchPanel( panelType = MultiTabWorkbenchPanelPresenter.class,\n                     isDefault = true,\n                     parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Object teste = new Object();\n\n    @WorkbenchPanel( panelType = MultiTabWorkbenchPanelPresenter.class,\n                     isDefault = true,\n                     parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Object teste2 = new Object();\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest16.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest16 implements IsElement {\n\n    @Inject\n    @WorkbenchPanel( panelType = MultiTabWorkbenchPanelPresenter.class,\n                     parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Div teste;\n\n    @Inject\n    @WorkbenchPanel( panelType = MultiTabWorkbenchPanelPresenter.class,\n                     parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" } )\n    Div teste2;\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest17.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter;\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest17 implements IsElement {\n\n    @Inject\n    @WorkbenchPanel(panelType = MultiTabWorkbenchPanelPresenter.class, isDefault = true, parts = \"TesteScreen\")\n    Div teste1;\n\n    @Inject\n    @WorkbenchPanel(parts = \"TesteScreen1\")\n    Div teste2;\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest18.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\n\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport javax.inject.Inject;\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest18 implements IsElement {\n\n    @Inject\n    @WorkbenchPanel(panelType = MultiListWorkbenchPanelPresenter.class, isDefault = true, parts = \"TesteScreen\")\n    Div teste1;\n\n    @Inject\n    @WorkbenchPanel(parts = { \"HelloWorldScreen1\", \"HelloWorldScreen2\" })\n    Div teste2;\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest19.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.jboss.errai.common.client.dom.Div;\nimport org.jboss.errai.ui.client.local.api.IsElement;\nimport javax.inject.Inject;\n\n\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest19 implements IsElement {\n\n    @Inject\n    @WorkbenchPanel( parts = \"noParameterScreen\" )\n    Div nopParameter;\n\n    @Inject\n    @WorkbenchPanel( isDefault = true,\n                     parts = \"oneParameterScreen?uber=fire\" )\n    Div oneParameter;\n\n    @Inject\n    @WorkbenchPanel( parts = \"twoParametersScreen?uber=fire&uber1=fire1\" )\n    Div twoParameters;\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest2\")\npublic class PerspectiveTest2 {\n\n    @Perspective\n    public void getPerspective() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest20.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest20\")\n@ActivatedBy(TestBeanActivator.class)\npublic class PerspectiveTest20 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest21.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest21\", isTransient = false)\npublic class PerspectiveTest21 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest22.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest22 {\n\n\n\n    @WorkbenchPanel( parts = \"noParameterScreen\" )\n    Object nopParameter = new FlowPanel();\n\n    @WorkbenchPanel( isDefault = true,\n                     parts = \"oneParameterScreen?uber=fire\" )\n    Object oneParameter = new FlowPanel();\n\n    @WorkbenchPanel( parts = \"twoParametersScreen?uber=fire&uber1=fire1\" )\n    Object twoParameters = new FlowPanel();\n\n    @PostConstruct\n    public void setup() {\n\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest23.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport javax.annotation.PostConstruct;\nimport javax.enterprise.context.ApplicationScoped;\n\nimport com.google.gwt.user.client.ui.FlowPanel;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPanel;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n@ApplicationScoped\n@WorkbenchPerspective(\n        identifier = \"HomePerspective\",\n        isDefault = true)\npublic class PerspectiveTest23 {\n\n    @WorkbenchPanel( parts = \"whatevzz\" )\n    Object nopParameter = new FlowPanel();\n\n    @Perspective\n    PerspectiveDefinition getDefaultLayout() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest24.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest24\", isDynamic=true)\npublic class PerspectiveTest24 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest25.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.QualifierAnnotation;\nimport org.uberfire.client.mvp.RegularAnnotation;\n\n@QualifierAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@RegularAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@WorkbenchPerspective(identifier = \"PerspectiveTest25\")\npublic class PerspectiveTest25 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest3\")\npublic class PerspectiveTest3 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective( final String p0 ) {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest4\")\npublic class PerspectiveTest4 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest5\", isDefault = true)\npublic class PerspectiveTest5 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest6\", isDefault = true)\npublic class PerspectiveTest6 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnClose\n    public void onClose() {\n    }\n\n    @OnOpen\n    public void onOpen() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest7\", isDefault = true)\npublic class PerspectiveTest7 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n    }\n\n    @OnClose\n    public void onClose() {\n    }\n\n    @OnOpen\n    public void onOpen() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest8.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.function.Consumer;\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest8\")\npublic class PerspectiveTest8 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/PerspectiveTest9.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.Perspective;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\n\n@WorkbenchPerspective(identifier = \"PerspectiveTest9\")\npublic class PerspectiveTest9 {\n\n    @Perspective\n    public PerspectiveDefinition getPerspective() {\n        return null;\n    }\n\n    @WorkbenchMenu\n    public String getMenus() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/TestBeanActivator.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.jboss.errai.ioc.client.container.BeanActivator;\n\npublic class TestBeanActivator implements BeanActivator {\n\n    @Override\n    public boolean isActivated() {\n        return false;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class WorkbenchClientEditorTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest3 extends Widget {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest4 extends Widget {\n    \n    \n    @WorkbenchPartTitle\n    public String title() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport elemental2.promise.Promise;\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.lifecycle.SetContent;\n\nimport com.google.gwt.user.client.ui.Widget;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest5 extends Widget {\n    \n    \n    @WorkbenchPartTitle\n    public String title() {\n        return \"title\";\n    }\n    \n    @SetContent\n    public Promise setContent(String path, String content) {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.lifecycle.GetContent;\nimport org.uberfire.lifecycle.SetContent;\n\nimport com.google.gwt.user.client.ui.Widget;\n\nimport elemental2.promise.Promise;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest6 extends Widget {\n    \n    \n    @WorkbenchPartTitle\n    public String title() {\n        return \"title\";\n    }\n    \n    @SetContent\n    public Promise setContent(String path, String content) {\n        return null;\n    }\n    \n    @GetContent\n    public Promise getContent() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.lifecycle.GetContent;\nimport org.uberfire.lifecycle.SetContent;\nimport org.uberfire.lifecycle.GetPreview;\n\nimport com.google.gwt.user.client.ui.Widget;\n\nimport elemental2.promise.Promise;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest7 extends Widget {\n    \n    \n    @WorkbenchPartTitle\n    public String title() {\n        return \"title\";\n    }\n    \n    @SetContent\n    public Promise setContent(String path, String content) {\n        return null;\n    }\n    \n    @GetContent\n    public Promise getContent() {\n        return null;\n    }\n    \n    @GetPreview\n    public Promise getPreview() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchClientEditorTest8.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchClientEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.lifecycle.GetContent;\nimport org.uberfire.lifecycle.SetContent;\nimport org.uberfire.lifecycle.GetPreview;\n\nimport com.google.gwt.user.client.ui.Widget;\n\nimport elemental2.promise.Promise;\nimport org.uberfire.lifecycle.Validate;\n\n@WorkbenchClientEditor(identifier = \"editor\")\npublic class WorkbenchClientEditorTest8 extends Widget {\n\n    @WorkbenchPartTitle\n    public String title() {\n        return \"title\";\n    }\n\n    @SetContent\n    public Promise setContent(String path, String content) {\n        return null;\n    }\n\n    @GetContent\n    public Promise getContent() {\n        return null;\n    }\n\n    @Validate\n    public Promise validate() {\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class WorkbenchEditorTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest10.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.client.mvp.UberView;\n\n@WorkbenchEditor(identifier = \"test10\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest10 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchEditorTest10> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchMenu\n    public String getMenus() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest11.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchEditor(identifier = \"test11\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest11 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup(final Path path) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest12.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchEditor(identifier = \"test12\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest12 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup(final Path path,\n                        final PlaceRequest place) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest13.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchEditor(identifier = \"test13\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest13 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place,\n                        final Path path) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest14.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchEditor(identifier = \"test14\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest14 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup(final Path path) {\n    }\n\n    @OnStartup\n    public void onStartup(final Path path,\n                        final PlaceRequest place) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest15.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@WorkbenchEditor(identifier = \"test15\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest15 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchToolBar\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest16.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test16\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest16 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchToolBar\n    public String getToolBar() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest17.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.client.workbench.type.DotResourceType;\n\n@WorkbenchEditor(identifier = \"test17\", supportedTypes = { MyTestType.class, DotResourceType.class })\npublic class WorkbenchEditorTest17 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest18.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test18\", supportedTypes = { MyTestType.class })\n@ActivatedBy(TestBeanActivator.class)\npublic class WorkbenchEditorTest18 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest19.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test19\", owningPerspective = PerspectiveTest7.class)\npublic class WorkbenchEditorTest19 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test2\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest20.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport java.util.List;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test20\", owningPerspective = List.class)\npublic class WorkbenchEditorTest20 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest21.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test21\", supportedTypes = { MyTestType.class }, preferredHeight = -200)\npublic class WorkbenchEditorTest21 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest22.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test22\", supportedTypes = { MyTestType.class }, preferredHeight = 200, preferredWidth = 300)\npublic class WorkbenchEditorTest22 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest23.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test23\", supportedTypes = { MyTestType.class }, preferredHeight = -200, preferredWidth = -300)\npublic class WorkbenchEditorTest23 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest24.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test24\", supportedTypes = { MyTestType.class }, preferredWidth = 200)\npublic class WorkbenchEditorTest24 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest25.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test25\", supportedTypes = { MyTestType.class }, preferredWidth = -200)\npublic class WorkbenchEditorTest25 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest26.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test26\", supportedTypes = { MyTestType.class }, preferredHeight = 200)\npublic class WorkbenchEditorTest26 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest27.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.FRAMEWORK_PESSIMISTIC;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test27\", lockingStrategy = FRAMEWORK_PESSIMISTIC)\npublic class WorkbenchEditorTest27 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest28.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.Path;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchEditor(identifier = \"test28\", supportedTypes = {MyTestType.class}, isDynamic = true)\npublic class WorkbenchEditorTest28 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup( final Path path ) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest29.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.client.mvp.QualifierAnnotation;\nimport org.uberfire.client.mvp.RegularAnnotation;\n\n@QualifierAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@RegularAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@WorkbenchEditor(identifier = \"test29\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest29 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test3\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest3 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test4\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest4 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test5\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest5 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test6\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest6 extends SimplePanel {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\n\n@WorkbenchEditor(identifier = \"test7\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest7 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest8.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.backend.vfs.ObservablePath;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnFocus;\nimport org.uberfire.lifecycle.OnLostFocus;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchEditor(identifier = \"test8\", supportedTypes = { MyTestType.class }, lockingStrategy = LockingStrategy.EDITOR_PROVIDED)\npublic class WorkbenchEditorTest8 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup(final ObservablePath path) {\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return true;\n    }\n\n    @OnClose\n    public void onClose() {\n    }\n\n    @OnOpen\n    public void onOpen() {\n    }\n\n    @OnLostFocus\n    public void onLostFocus() {\n    }\n\n    @OnFocus\n    public void onFocus() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchEditorTest9.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport java.util.function.Consumer;\nimport org.uberfire.client.annotations.WorkbenchEditor;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.mvp.MyTestType;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@WorkbenchEditor(identifier = \"test9\", supportedTypes = { MyTestType.class })\npublic class WorkbenchEditorTest9 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class WorkbenchPopupTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest10.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test10\")\npublic class WorkbenchPopupTest10 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitleWidget() {\n        return new Label( \"title\" );\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest11.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.Label;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test11\")\npublic class WorkbenchPopupTest11 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitleWidget() {\n        return new Label( \"title\" );\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest12.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test12\")\n@ActivatedBy(TestBeanActivator.class)\npublic class WorkbenchPopupTest12 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest13.java",
    "content": "/*\n *\n *  * Copyright 2015 JBoss Inc\n *  *\n *  * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\n *  * use this file except in compliance with the License. You may obtain a copy of\n *  * the License at\n *  *\n *  * http://www.apache.org/licenses/LICENSE-2.0\n *  *\n *  * Unless required by applicable law or agreed to in writing, software\n *  * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n *  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n *  * License for the specific language governing permissions and limitations under\n *  * the License.\n *\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test13\", size = WorkbenchPopup.WorkbenchPopupSize.LARGE)\npublic class WorkbenchPopupTest13 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest14.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.client.mvp.QualifierAnnotation;\nimport org.uberfire.client.mvp.RegularAnnotation;\n\n@QualifierAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@RegularAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@WorkbenchPopup(identifier = \"test14\")\npublic class WorkbenchPopupTest14 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test2\")\npublic class WorkbenchPopupTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test3\")\npublic class WorkbenchPopupTest3 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test4\")\npublic class WorkbenchPopupTest4 extends SimplePanel {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\n\n@WorkbenchPopup(identifier = \"test5\")\npublic class WorkbenchPopupTest5 extends SimplePanel {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.lifecycle.OnOpen;\n\n@WorkbenchPopup(identifier = \"test6\")\npublic class WorkbenchPopupTest6 {\n\n    @OnOpen\n    public void onOpen() {\n        //Do nothing\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchPopup(identifier = \"test7\")\npublic class WorkbenchPopupTest7 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest8.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchPopup(identifier = \"test8\")\npublic class WorkbenchPopupTest8 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchPopupTest9.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.PopupPanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPopup;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchPopup(identifier = \"test9\")\npublic class WorkbenchPopupTest9 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchPartView\n    public PopupPanel getView() {\n        return new PopupPanel();\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class WorkbenchScreenTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest10.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\n\n@WorkbenchScreen(identifier = \"test10\")\npublic class WorkbenchScreenTest10 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchScreenTest10> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchMenu\n    public String getMenus() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest11.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchScreen(identifier = \"test11\")\npublic class WorkbenchScreenTest11 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchScreenTest11> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest12.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchScreen(identifier = \"test12\")\npublic class WorkbenchScreenTest12 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchScreenTest12> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup( final PlaceRequest place ) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest13.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchScreen(identifier = \"test13\")\npublic class WorkbenchScreenTest13 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchScreenTest13> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnStartup\n    public void onStartup(final PlaceRequest place) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest14.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@WorkbenchScreen(identifier = \"test14\")\npublic class WorkbenchScreenTest14 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchToolBar\n    public ToolBar getToolBar() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest15.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.annotations.WorkbenchToolBar;\n\n@WorkbenchScreen(identifier = \"test15\")\npublic class WorkbenchScreenTest15 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchToolBar\n    public String getToolBar() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest16.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test16\")\npublic class WorkbenchScreenTest16 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTabWidget() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest17.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test17\")\npublic class WorkbenchScreenTest17 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return null;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsWidget getTitleWidget() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest18.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test18\")\npublic class WorkbenchScreenTest18 extends WorkbenchScreenTest18Super {\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest18Super.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnOpen;\n\npublic abstract class WorkbenchScreenTest18Super {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String inheritedGetTitle() {\n        return null;\n    }\n\n    @OnOpen\n    public void onOpen() {\n        // hello\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest19.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test19\")\n@ActivatedBy(TestBeanActivator.class)\npublic class WorkbenchScreenTest19 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test2\")\npublic class WorkbenchScreenTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest20.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnFocus;\nimport org.uberfire.lifecycle.OnLostFocus;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchScreen(identifier = \"test20\")\npublic class WorkbenchScreenTest20 {\n\n    @WorkbenchPartView\n    private IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    private String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    private void onStartup() {\n    }\n\n    @OnMayClose\n    private boolean onMayClose() {\n        return true;\n    }\n\n    @OnClose\n    private void onClose() {\n    }\n\n    @OnOpen\n    private void onOpen() {\n    }\n\n    @OnLostFocus\n    private void onLostFocus() {\n    }\n\n    @OnFocus\n    private void onFocus() {\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest21.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test21\", owningPerspective = PerspectiveTest7.class)\npublic class WorkbenchScreenTest21 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest22.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchPerspective;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test22\", owningPerspective = String.class)\npublic class WorkbenchScreenTest22 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest23.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test23\", preferredWidth = -200, preferredHeight = -300)\npublic class WorkbenchScreenTest23 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest24.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test24\", preferredWidth = 200)\npublic class WorkbenchScreenTest24 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest25.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test25\", preferredWidth = -200)\npublic class WorkbenchScreenTest25 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest26.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test26\", preferredHeight = 200)\npublic class WorkbenchScreenTest26 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest27.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test27\", preferredHeight = -200)\npublic class WorkbenchScreenTest27 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest28.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test28\", preferredWidth = 200, preferredHeight = 300)\npublic class WorkbenchScreenTest28 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest29.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test29\")\npublic class WorkbenchScreenTest29 {\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return null;\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test3\")\npublic class WorkbenchScreenTest3 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest30.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberElement;\n\n@WorkbenchScreen(identifier = \"test30\")\npublic class WorkbenchScreenTest30 {\n\n    @WorkbenchPartView\n    public UberElement<WorkbenchScreenTest10> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchMenu\n    public String getMenus() {\n        return \"\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest31.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test31\")\npublic class WorkbenchScreenTest31 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return null;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsElement getTitleWidget() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest32.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport org.jboss.errai.common.client.api.IsElement;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartTitleDecoration;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test32\")\npublic class WorkbenchScreenTest32 {\n\n    @WorkbenchPartView\n    public IsElement getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return null;\n    }\n\n    @WorkbenchPartTitleDecoration\n    public IsElement getTitleWidget() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest33.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchScreen(identifier = \"test33\", isDynamic = true)\npublic class WorkbenchScreenTest33 {\n\n    @WorkbenchPartView\n    public UberView<WorkbenchScreenTest11> getView() {\n        return null;\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest34.java",
    "content": "/*\n * Copyright 2016 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.client.mvp.QualifierAnnotation;\nimport org.uberfire.client.mvp.RegularAnnotation;\n\n@QualifierAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@RegularAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@WorkbenchScreen(identifier = \"test34\")\npublic class WorkbenchScreenTest34 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test4\")\npublic class WorkbenchScreenTest4 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test5\")\npublic class WorkbenchScreenTest5 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test6\")\npublic class WorkbenchScreenTest6 extends SimplePanel {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\n\n@WorkbenchScreen(identifier = \"test7\")\npublic class WorkbenchScreenTest7 extends SimplePanel {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest8.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.lifecycle.OnClose;\nimport org.uberfire.lifecycle.OnFocus;\nimport org.uberfire.lifecycle.OnLostFocus;\nimport org.uberfire.lifecycle.OnMayClose;\nimport org.uberfire.lifecycle.OnOpen;\nimport org.uberfire.lifecycle.OnStartup;\n\n@WorkbenchScreen(identifier = \"test8\")\npublic class WorkbenchScreenTest8 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnMayClose\n    public boolean onMayClose() {\n        return true;\n    }\n\n    @OnClose\n    public void onClose() {\n    }\n\n    @OnOpen\n    public void onOpen() {\n    }\n\n    @OnLostFocus\n    public void onLostFocus() {\n    }\n\n    @OnFocus\n    public void onFocus() {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchScreenTest9.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport java.util.function.Consumer;\nimport org.uberfire.client.annotations.WorkbenchMenu;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchScreen;\nimport org.uberfire.workbench.model.menu.Menus;\n\n@WorkbenchScreen(identifier = \"test9\")\npublic class WorkbenchScreenTest9 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @WorkbenchMenu\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest1.java",
    "content": "package org.uberfire.annotations.processors;\n\npublic class WorkbenchSplashScreenTest1 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest10.java",
    "content": "/*\n * Copyright 20110 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.QualifierAnnotation;\nimport org.uberfire.client.mvp.RegularAnnotation;\n\n@QualifierAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@RegularAnnotation( classField = String.class, stringField = \"someText\", booleanField = true, intField = 13 )\n@WorkbenchSplashScreen(identifier = \"test10\")\npublic class WorkbenchSplashScreenTest10 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return null;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest2.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\n\n@WorkbenchSplashScreen(identifier = \"test2\")\npublic class WorkbenchSplashScreenTest2 {\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest3.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\n\n@WorkbenchSplashScreen(identifier = \"test3\")\npublic class WorkbenchSplashScreenTest3 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n    \n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest4.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\n\n@WorkbenchSplashScreen(identifier = \"test4\")\npublic class WorkbenchSplashScreenTest4 {\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest5.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\n\n@WorkbenchSplashScreen(identifier = \"test5\")\npublic class WorkbenchSplashScreenTest5 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest6.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n@WorkbenchSplashScreen(identifier = \"test6\")\npublic class WorkbenchSplashScreenTest6 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return null;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest7.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n@WorkbenchSplashScreen(identifier = \"test7\")\n@ActivatedBy(TestBeanActivator.class)\npublic class WorkbenchSplashScreenTest7 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return null;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest8.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.UberView;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\n\n@WorkbenchSplashScreen(identifier = \"test8\")\npublic class WorkbenchSplashScreenTest8 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return null;\n    }\n\n    @OnStartup\n    public void onStartup() {\n    }\n\n    @OnStartup\n    public void onStartup( final PlaceRequest place ) {\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/WorkbenchSplashScreenTest9.java",
    "content": "package org.uberfire.annotations.processors;\n\nimport com.google.gwt.user.client.ui.IsWidget;\nimport com.google.gwt.user.client.ui.SimplePanel;\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\nimport org.uberfire.client.annotations.SplashFilter;\nimport org.uberfire.client.annotations.WorkbenchPartTitle;\nimport org.uberfire.client.annotations.WorkbenchPartView;\nimport org.uberfire.client.annotations.WorkbenchSplashScreen;\nimport org.uberfire.lifecycle.OnStartup;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\n\n@WorkbenchSplashScreen(identifier = \"test9\", isEnabled = false)\n@ActivatedBy(TestBeanActivator.class)\npublic class WorkbenchSplashScreenTest9 {\n\n    @WorkbenchPartView\n    public IsWidget getView() {\n        return new SimplePanel();\n    }\n\n    @WorkbenchPartTitle\n    public String getTitle() {\n        return \"title\";\n    }\n\n    @SplashFilter\n    public SplashScreenFilter getFilter() {\n        return null;\n    }\n\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest1.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest1ExperimentalFeatureDefinitionProvider implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"org.uberfire.annotations.processors.ExperimentalFeatureTest1\", false, \"\", \"org.uberfire.annotations.processors.ExperimentalFeatureTest1\", \"\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest2.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest2ExperimentalFeatureDefinitionProvider implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"org.uberfire.annotations.processors.ExperimentalFeatureTest2\", true, \"group\", \"name\", \"description\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest3Provider.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest3ExperimentalFeatureDefinitionProvider implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"org.uberfire.annotations.processors.ExperimentalFeatureTest3\", false, \"\", \"org.uberfire.annotations.processors.ExperimentalFeatureTest3\", \"\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest3Reference.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.client.service.auth.ExperimentalActivityReference;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest3ExperimentalFeatureActivityReference implements ExperimentalActivityReference {\n\n    @Override\n    public String getActivityTypeName() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest3Activity\";\n    }\n\n    @Override\n    public String getActivityId() {\n        return \"ExperimentalFeatureTest3\";\n    }\n\n    @Override\n    public String getExperimentalFeatureId() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest3\";\n    }\n\n    @Override\n    public ActivityResourceType getActivityType() {\n        return ActivityResourceType.SCREEN;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest4Provider.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest4ExperimentalFeatureDefinitionProvider implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"org.uberfire.annotations.processors.ExperimentalFeatureTest4\", true, \"group\", \"name\", \"description\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest4Reference.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.client.service.auth.ExperimentalActivityReference;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest4ExperimentalFeatureActivityReference implements ExperimentalActivityReference {\n\n    @Override\n    public String getActivityTypeName() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest4Activity\";\n    }\n\n    @Override\n    public String getActivityId() {\n        return \"ExperimentalFeatureTest4\";\n    }\n\n    @Override\n    public String getExperimentalFeatureId() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest4\";\n    }\n\n    @Override\n    public ActivityResourceType getActivityType() {\n        return ActivityResourceType.PERSPECTIVE;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest5Provider.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinition;\nimport org.uberfire.experimental.service.definition.ExperimentalFeatureDefinitionProvider;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest5ExperimentalFeatureDefinitionProvider implements ExperimentalFeatureDefinitionProvider {\n\n    @Override\n    public ExperimentalFeatureDefinition getDefinition() {\n        return new ExperimentalFeatureDefinition(\"org.uberfire.annotations.processors.ExperimentalFeatureTest5\", false, \"\", \"org.uberfire.annotations.processors.ExperimentalFeatureTest5\", \"\");\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/ExperimentalFeatureTest5Reference.expected",
    "content": "/*\n * Copyright 2018 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *     http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\n\nimport org.uberfire.experimental.client.service.auth.ExperimentalActivityReference;\nimport org.uberfire.workbench.model.ActivityResourceType;\n\n/*\n * WARNING! This class is generated. Do not modify.\n */\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.ExperimentalFeatureProcessor\")\npublic class ExperimentalFeatureTest5ExperimentalFeatureActivityReference implements ExperimentalActivityReference {\n\n    @Override\n    public String getActivityTypeName() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest5Activity\";\n    }\n\n    @Override\n    public String getActivityId() {\n        return \"ExperimentalFeatureTest5\";\n    }\n\n    @Override\n    public String getExperimentalFeatureId() {\n        return \"org.uberfire.annotations.processors.ExperimentalFeatureTest5\";\n    }\n\n    @Override\n    public ActivityResourceType getActivityType() {\n        return ActivityResourceType.EDITOR;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest10.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest10\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest10Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest10 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest10Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest10\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.getToolBar();\n    }    \n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest11.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest11\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest11Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest11 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest11Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest11\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest12.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.client;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest12Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest12 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest12Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"teste\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste;\n        }\n        if ( fieldName.equals( \"teste2\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste2, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste2;\n        }\n        if ( fieldName.equals( \"teste3\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste3, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste3;\n        }\n        if ( fieldName.equals( \"teste4\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste4, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste4;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\" );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"HelloWorldScreen1\" ) ) );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"HelloWorldScreen2\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste\" ), panelDefinition );\n\n        PanelDefinition panelDefinition0 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen3\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste2\" ), panelDefinition0 );\n        PanelDefinition panelDefinition1 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition1.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen4\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste3\" ), panelDefinition1 );\n        PanelDefinition panelDefinition2 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition2.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen5\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste4\" ), panelDefinition2 );\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest13.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest13Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest13 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest13Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"teste\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\" );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"HelloWorldScreen1\" ) ) );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"HelloWorldScreen2\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste\" ), panelDefinition );\n\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest16.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest16Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest16 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest16Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"teste\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste;\n        }\n        if ( fieldName.equals( \"teste2\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste2, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste2;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n\n        PanelDefinition panelDefinition0 = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\" );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen1\" ) ) );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen2\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste\" ), panelDefinition0 );\n        PanelDefinition panelDefinition1 = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\" );\n        panelDefinition1.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen1\" ) ) );\n        panelDefinition1.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen2\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste2\" ), panelDefinition1 );\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest17.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest17Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest17 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest17Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"teste1\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste1, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste1;\n        }\n        if ( fieldName.equals( \"teste2\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste2, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste2;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiTabWorkbenchPanelPresenter\" );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"TesteScreen\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste1\" ), panelDefinition );\n\n        PanelDefinition panelDefinition0 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"TesteScreen1\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste2\" ), panelDefinition0 );\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest18.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest18Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest18 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest18Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"teste1\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste1, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste1;\n        }\n        if ( fieldName.equals( \"teste2\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.teste2, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.teste2;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"org.uberfire.client.workbench.panels.impl.MultiListWorkbenchPanelPresenter\" );\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"TesteScreen\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste1\" ), panelDefinition );\n\n        PanelDefinition panelDefinition0 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen1\" ) ) );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"HelloWorldScreen2\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"teste2\" ), panelDefinition0 );\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest19.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.workbench.model.impl.PerspectiveDefinitionImpl;\nimport java.util.HashMap;\nimport java.util.Map;\nimport org.uberfire.client.annotations.Perspective;\nimport org.jboss.errai.common.client.dom.HTMLElement;\nimport org.jboss.errai.common.client.dom.DOMUtil;\nimport org.uberfire.client.mvp.IsTemplatePerspective;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.HasWidgets;\nimport com.google.gwt.user.client.ui.IsWidget;\nimport org.uberfire.client.mvp.TemplatedActivity;\nimport org.uberfire.client.workbench.panels.impl.TemplatedWorkbenchPanelPresenter;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\nimport org.uberfire.workbench.model.NamedPosition;\nimport org.uberfire.workbench.model.PanelDefinition;\nimport org.uberfire.workbench.model.Position;\nimport org.uberfire.workbench.model.impl.PanelDefinitionImpl;\nimport org.uberfire.workbench.model.impl.PartDefinitionImpl;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"HomePerspective\")\n@IsTemplatePerspective\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest19Activity extends AbstractWorkbenchPerspectiveActivity implements TemplatedActivity {\n\n    private static final String UF_PERSPECTIVE_COMPONENT = \"uf-perspective-component\";\n\n    @Inject\n    private PerspectiveTest19 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest19Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"HomePerspective\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public HTMLElement getRootElement() {\n        return realPresenter.getElement();\n    }\n\n    @Override\n    public HTMLElement resolvePosition( NamedPosition position ) {\n        final String fieldName = position.getName();\n        if ( fieldName.equals( \"oneParameter\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.oneParameter, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.oneParameter;\n        }\n        if ( fieldName.equals( \"nopParameter\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.nopParameter, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.nopParameter;\n        }\n        if ( fieldName.equals( \"twoParameters\" ) ) {\n            DOMUtil.addCSSClass( realPresenter.twoParameters, UF_PERSPECTIVE_COMPONENT );\n            return realPresenter.twoParameters;\n        }\n        return null;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        final PerspectiveDefinition p = new PerspectiveDefinitionImpl( TemplatedWorkbenchPanelPresenter.class.getName() );\n        p.setName( realPresenter.getClass().getName() );\n\n        PanelDefinition panelDefinition = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        Map properties = new HashMap<String,String>();\n        properties.put(\"uber\",\"fire\");\n        panelDefinition.addPart(\n            new PartDefinitionImpl(new DefaultPlaceRequest( \"oneParameterScreen\", properties  ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"oneParameter\" ), panelDefinition );\n\n        PanelDefinition panelDefinition0 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        panelDefinition0.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"noParameterScreen\" ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"nopParameter\" ), panelDefinition0 );\n        PanelDefinition panelDefinition1 = new PanelDefinitionImpl( \"PARENT_CHOOSES_TYPE\" );\n        Map properties1 = new HashMap<String,String>();\n        properties1.put( \"uber\",\"fire\" );\n        properties1.put( \"uber1\",\"fire1\" );\n        panelDefinition1.addPart(\n                new PartDefinitionImpl( new DefaultPlaceRequest( \"twoParametersScreen\", properties1 ) ) );\n        p.getRoot().appendChild( new NamedPosition( \"twoParameters\" ), panelDefinition1 );\n        return p;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest20.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest20\")\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest20Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest20 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest20Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest20\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest21.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest21\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest21Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest21 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest21Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest21\";\n    }\n\n    @Override\n    public boolean isTransient() {\n        return false;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest24.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest24\")\n@JsType\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest24Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest24 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest24Activity(@Shared final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest24\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest25.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest25\")\n@org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest25Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    @org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n    private PerspectiveTest25 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest25Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest25\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest4.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest4\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest4Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest4 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest4Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest4\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest5.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest5\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest5Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest5 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest5Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest5\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest6.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest6\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest6Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest6Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest6\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup();\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.onClose();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest7.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest7\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest7Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest7Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest7\";\n    }\n\n    @Override\n    public boolean isDefault() {\n        return true;\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup( place );\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.onClose();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest8.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.menu.Menus;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest8\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest8Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest8 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest8Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest8\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.getMenus(menusConsumer);\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/PerspectiveTest9.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.workbench.model.PerspectiveDefinition;\nimport org.uberfire.client.mvp.AbstractWorkbenchPerspectiveActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPerspectiveProcessor\")\n@Named(\"PerspectiveTest9\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class PerspectiveTest9Activity extends AbstractWorkbenchPerspectiveActivity {\n\n    @Inject\n    private PerspectiveTest9 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public PerspectiveTest9Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"PerspectiveTest9\";\n    }\n\n    @Override\n    public PerspectiveDefinition getDefaultPerspectiveLayout() {\n        return realPresenter.getPerspective();\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest6.expected",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport elemental2.promise.Promise;\nimport org.uberfire.client.mvp.IsClientEditor;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchClientEditorProcessor\")\n@Named(\"editor\")\n@IsClientEditor\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchClientEditorTest6Activity extends AbstractWorkbenchClientEditorActivity {\n\n    @Inject\n    private WorkbenchClientEditorTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchClientEditorTest6Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.title();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public Promise<Void> setContent(String path, String value) {\n        return realPresenter.setContent(path, value);\n    }\n    @Override\n    public Promise<String> getContent() {\n        return realPresenter.getContent();\n    }\n    @Override\n    public Promise<String> getPreview() {\n        return Promise.resolve(\"\");\n    }\n\n    @Override\n    public Promise validate() {\n        return Promise.resolve(Collections.emptyList());\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"editor\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest7.expected",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport elemental2.promise.Promise;\nimport org.uberfire.client.mvp.IsClientEditor;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchClientEditorProcessor\")\n@Named(\"editor\")\n@IsClientEditor\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchClientEditorTest7Activity extends AbstractWorkbenchClientEditorActivity {\n\n    @Inject\n    private WorkbenchClientEditorTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchClientEditorTest7Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.title();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public Promise<Void> setContent(String path, String value) {\n        return realPresenter.setContent(path, value);\n    }\n    @Override\n    public Promise<String> getContent() {\n        return realPresenter.getContent();\n    }\n    @Override\n    public Promise<String> getPreview() {\n        return realPresenter.getPreview();\n    }\n\n    @Override\n    public Promise validate() {\n        return Promise.resolve(Collections.emptyList());\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"editor\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchClientEditorTest8.expected",
    "content": "/*\n * Copyright 2019 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchClientEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\nimport elemental2.promise.Promise;\nimport org.uberfire.client.mvp.IsClientEditor;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchClientEditorProcessor\")\n@Named(\"editor\")\n@IsClientEditor\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchClientEditorTest8Activity extends AbstractWorkbenchClientEditorActivity {\n\n    @Inject\n    private WorkbenchClientEditorTest8 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchClientEditorTest8Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.title();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public Promise<Void> setContent(String path, String value) {\n        return realPresenter.setContent(path, value);\n    }\n    @Override\n    public Promise<String> getContent() {\n        return realPresenter.getContent();\n    }\n    @Override\n    public Promise<String> getPreview() {\n        return Promise.resolve(\"\");\n    }\n\n    @Override\n    public Promise validate() {\n        return realPresenter.validate();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"editor\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest10.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test10\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest10Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest10 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest10Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test10\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest11.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test11\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest11Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest11 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest11Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.onStartup( path );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test11\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest12.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test12\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest12Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest12 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest12Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.onStartup( path, place );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test12\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest13.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test13\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest13Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest13 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest13Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test13\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest14.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test14\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest14Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest14 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest14Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.onStartup( path, place );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test14\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest15.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test15\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest15Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest15 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest15Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.getToolBar();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test15\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest16.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test16\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest16Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest16 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest16Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test16\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest17.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test17\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class,\n    org.uberfire.client.workbench.type.DotResourceType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest17Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest17 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest17Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test17\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest18.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test18\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest18Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest18 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest18Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test18\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest19.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test19\")\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest19Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest19 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest19Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return new DefaultPlaceRequest(\"PerspectiveTest7\");\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test19\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest21.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test21\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest21Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest21 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest21Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test21\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest22.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test22\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest22Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest22 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest22Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredHeight() {\n       return 200;\n    }\n\n    @Override\n    public int preferredWidth() {\n       return 300;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test22\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest23.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test23\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest23Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest23 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest23Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test23\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest24.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test24\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest24Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest24 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest24Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredWidth() {\n       return 200;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test24\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest25.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test25\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest25Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest25 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest25Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test25\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest26.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test26\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest26Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest26 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest26Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredHeight() {\n       return 200;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test26\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest27.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.*;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test27\")\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest27Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest27 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest27Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public LockingStrategy getLockingStrategy() {\n        return FRAMEWORK_PESSIMISTIC;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test27\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest28.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test28\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n@JsType\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest28Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest28 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest28Activity(@Shared final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @JsIgnore @Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.onStartup( path );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @JsIgnore @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test28\";\n    }\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest29.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test29\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n@org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest29Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    @org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n    private WorkbenchEditorTest29 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest29Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test29\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest5.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test5\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest5Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest5 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest5Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test5\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest6.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test6\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest6Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest6Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test6\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest7.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test7\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest7Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest7Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test7\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest8.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy;\nimport static org.uberfire.client.annotations.WorkbenchEditor.LockingStrategy.*;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test8\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest8Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest8 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest8Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onStartup(final ObservablePath path,\n                        final PlaceRequest place) {\n        super.onStartup( path, place );\n        realPresenter.onStartup( path );\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.onMayClose();\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.onClose();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        realPresenter.onLostFocus();\n    }\n\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        realPresenter.onFocus();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public LockingStrategy getLockingStrategy() {\n        return EDITOR_PROVIDED;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test8\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchEditorTest9.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\n\nimport javax.inject.Named;\nimport org.uberfire.client.workbench.annotations.AssociatedResources;\nimport org.uberfire.client.workbench.annotations.Priority;\nimport org.uberfire.client.mvp.AbstractWorkbenchEditorActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport org.uberfire.backend.vfs.ObservablePath;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchEditorProcessor\")\n@Named(\"test9\")\n@AssociatedResources({\n    org.uberfire.client.mvp.MyTestType.class\n})\n\n@Priority(0)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchEditorTest9Activity extends AbstractWorkbenchEditorActivity {\n\n    @Inject\n    private WorkbenchEditorTest9 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchEditorTest9Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.getMenus(menusConsumer);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test9\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest11.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test11\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest11Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest11 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest11Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.getTitleWidget();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test11\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest12.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test12\")\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest12Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest12 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest12Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test12\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest13.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize;\nimport static org.uberfire.client.annotations.WorkbenchPopup.WorkbenchPopupSize.*;\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test13\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest13Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest13 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest13Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test13\";\n    }\n\n    @Override\n    public WorkbenchPopupSize getSize() {\n        return LARGE;\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest14.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test14\")\n@org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest14Activity extends AbstractPopupActivity {\n\n    @Inject\n    @org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n    private WorkbenchPopupTest14 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest14Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test14\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest3.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test3\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest3Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest3 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest3Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test3\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest4.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test4\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest4Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest4 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest4Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test4\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest5.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test5\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest5Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest5 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest5Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test5\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest6.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test6\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest6Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest6Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test6\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest7.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test7\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest7Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest7Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test7\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchPopupTest8.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractPopupActivity;\nimport org.uberfire.client.workbench.widgets.popup.PopupView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchPopupProcessor\")\n@Named(\"test8\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchPopupTest8Activity extends AbstractPopupActivity {\n\n    @Inject\n    private WorkbenchPopupTest8 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchPopupTest8Activity( final PlaceManager placeManager, final PopupView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup( place );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test8\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest10.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test10\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest10Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest10 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest10Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test10\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest11.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test11\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest11Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest11 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest11Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test11\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest12.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test12\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest12Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest12 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest12Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup( place );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test12\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest14.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.toolbar.ToolBar;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test14\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest14Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest14 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest14Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public ToolBar getToolBar() {\n        return realPresenter.getToolBar();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test14\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest15.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test15\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest15Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest15 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest15Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test15\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest17.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test17\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest17Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest17 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest17Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return realPresenter.getTitleWidget();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test17\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest18.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test18\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest18Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest18 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest18Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.inheritedGetTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test18\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest19.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test19\")\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest19Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest19 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest19Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test19\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest21.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.mvp.impl.DefaultPlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test21\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest21Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest21 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest21Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public PlaceRequest getOwningPlace() {\n        return new DefaultPlaceRequest(\"PerspectiveTest7\");\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test21\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest23.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test23\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest23Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest23 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest23Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test23\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest24.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test24\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest24Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest24 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest24Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredWidth() {\n       return 200;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test24\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest25.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test25\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest25Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest25 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest25Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test25\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest26.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test26\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest26Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest26 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest26Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredHeight() {\n       return 200;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test26\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest27.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test27\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest27Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest27 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest27Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test27\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest28.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test28\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest28Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest28 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest28Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public int preferredHeight() {\n       return 300;\n    }\n\n    @Override\n    public int preferredWidth() {\n       return 200;\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test28\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest29.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test29\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest29Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest29 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest29Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget( realPresenter.getView().getElement() );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test29\";\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest30.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test30\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest30Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest30 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest30Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget( realPresenter.getView().getElement() );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test30\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest31.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test31\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest31Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest31 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest31Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return ElementWrapperWidget.getWidget( realPresenter.getTitleWidget().getElement() );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test31\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest32.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.jboss.errai.common.client.ui.ElementWrapperWidget;\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test32\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest32Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest32 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest32Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public IsWidget getTitleDecoration() {\n        return ElementWrapperWidget.getWidget( realPresenter.getTitleWidget().getElement() );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return ElementWrapperWidget.getWidget( realPresenter.getView().getElement() );\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test32\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest33.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.annotation.PostConstruct;\nimport org.uberfire.client.mvp.HasPresenter;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\nimport jsinterop.annotations.JsIgnore;\nimport jsinterop.annotations.JsType;\nimport org.jboss.errai.ioc.client.api.Shared;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test33\")\n@JsType\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest33Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest33 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest33Activity(@Shared final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @PostConstruct\n    public void init() {\n        ((HasPresenter) realPresenter.getView()).init( realPresenter );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @JsIgnore @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test33\";\n    }\n\n    @Override\n    public boolean isDynamic() {\n    \treturn true;\n    }\n}"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest34.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test34\")\n@org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest34Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    @org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n    private WorkbenchScreenTest34 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest34Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test34\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest5.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test5\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest5Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest5 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest5Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test5\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest6.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test6\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest6Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest6Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test6\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest7.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test7\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest7Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest7Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test7\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest8.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test8\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest8Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest8 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest8Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public void onStartup(final PlaceRequest place) {\n        super.onStartup( place );\n        realPresenter.onStartup();\n    }\n\n    @Override\n    public boolean onMayClose() {\n        return realPresenter.onMayClose();\n    }\n\n    @Override\n    public void onClose() {\n        super.onClose();\n        realPresenter.onClose();\n    }\n\n    @Override\n    public void onOpen() {\n        super.onOpen();\n        realPresenter.onOpen();\n    }\n\n    @Override\n    public void onLostFocus() {\n        super.onLostFocus();\n        realPresenter.onLostFocus();\n    }\n\n    @Override\n    public void onFocus() {\n        super.onFocus();\n        realPresenter.onFocus();\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test8\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchScreenTest9.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.function.Consumer;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.Dependent;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport javax.inject.Named;\nimport org.uberfire.client.mvp.AbstractWorkbenchScreenActivity;\nimport org.uberfire.client.mvp.PlaceManager;\n\nimport org.uberfire.mvp.PlaceRequest;\n\nimport org.uberfire.workbench.model.menu.Menus;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@Dependent\n@Generated(\"org.uberfire.annotations.processors.WorkbenchScreenProcessor\")\n@Named(\"test9\")\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchScreenTest9Activity extends AbstractWorkbenchScreenActivity {\n\n    @Inject\n    private WorkbenchScreenTest9 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchScreenTest9Activity(final PlaceManager placeManager) {\n        super( placeManager );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public void getMenus(final Consumer<Menus> menusConsumer) {\n        realPresenter.getMenus(menusConsumer);\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test9\";\n    }\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest10.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.IsSplashScreen;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@ApplicationScoped\n@Generated(\"org.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\")\n@Named(\"test10\")\n@IsSplashScreen\n@org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchSplashScreenTest10Activity extends AbstractSplashScreenActivity {\n\n    @Inject\n    @org.uberfire.client.mvp.QualifierAnnotation(classField=java.lang.String.class, stringField=\"someText\", booleanField=true, intField=13)\n    private WorkbenchSplashScreenTest10 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchSplashScreenTest10Activity( final PlaceManager placeManager, final SplashView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public SplashScreenFilter getFilter() {\n        return realPresenter.getFilter();\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return true;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test10\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest6.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.IsSplashScreen;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@ApplicationScoped\n@Generated(\"org.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\")\n@Named(\"test6\")\n@IsSplashScreen\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchSplashScreenTest6Activity extends AbstractSplashScreenActivity {\n\n    @Inject\n    private WorkbenchSplashScreenTest6 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchSplashScreenTest6Activity( final PlaceManager placeManager, final SplashView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public SplashScreenFilter getFilter() {\n        return realPresenter.getFilter();\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return true;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test6\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest7.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.IsSplashScreen;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@ApplicationScoped\n@Generated(\"org.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\")\n@Named(\"test7\")\n@IsSplashScreen\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchSplashScreenTest7Activity extends AbstractSplashScreenActivity {\n\n    @Inject\n    private WorkbenchSplashScreenTest7 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchSplashScreenTest7Activity( final PlaceManager placeManager, final SplashView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public SplashScreenFilter getFilter() {\n        return realPresenter.getFilter();\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return true;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test7\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workbench/uberfire-workbench-processors-tests/src/test/resources/org/uberfire/annotations/processors/expected/WorkbenchSplashScreenTest9.expected",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.uberfire.annotations.processors;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport javax.annotation.Generated;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\nimport com.google.gwt.user.client.ui.InlineLabel;\n\nimport org.jboss.errai.ioc.client.api.ActivatedBy;\n\nimport org.uberfire.client.mvp.PlaceManager;\nimport org.uberfire.client.mvp.AbstractSplashScreenActivity;\nimport org.uberfire.client.workbench.widgets.splash.SplashView;\nimport javax.inject.Named;\nimport org.uberfire.mvp.PlaceRequest;\nimport org.uberfire.workbench.model.SplashScreenFilter;\nimport org.uberfire.client.mvp.IsSplashScreen;\n\nimport com.google.gwt.user.client.ui.IsWidget;\n\n@ApplicationScoped\n@Generated(\"org.uberfire.annotations.processors.WorkbenchSplashScreenProcessor\")\n@Named(\"test9\")\n@IsSplashScreen\n@ActivatedBy(org.uberfire.annotations.processors.TestBeanActivator.class)\n/*\n * WARNING! This class is generated. Do not modify.\n */\npublic class WorkbenchSplashScreenTest9Activity extends AbstractSplashScreenActivity {\n\n    @Inject\n    private WorkbenchSplashScreenTest9 realPresenter;\n\n    @Inject\n    //Constructor injection for testing\n    public WorkbenchSplashScreenTest9Activity( final PlaceManager placeManager, final SplashView view ) {\n        super( placeManager, view );\n    }\n\n    @Override\n    public String getTitle() {\n        return realPresenter.getTitle();\n    }\n\n    @Override\n    public IsWidget getWidget() {\n        return realPresenter.getView();\n    }\n\n    @Override\n    public SplashScreenFilter getFilter() {\n        return realPresenter.getFilter();\n    }\n\n    @Override\n    public boolean isEnabled() {\n        return false;\n    }\n\n    @Override\n    public String getIdentifier() {\n        return \"test9\";\n    }\n\n}\n"
  },
  {
    "path": "uberfire-workingset/.gitignore",
    "content": "/target\n/local\n/repositories\n/derby.log\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n!.gitignore\n/nbproject\n/*.ipr\n/*.iws\n/*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n\n# Created by Zanata\n/org.guvnor\n\n"
  },
  {
    "path": "uberfire-workingset/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <modelVersion>4.0.0</modelVersion>\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-parent</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n\n  <artifactId>uberfire-workingset</artifactId>\n  <packaging>pom</packaging>\n\n  <name>UberFire - Workingset</name>\n  <description>UberFire - Workingset</description>\n\n  <modules>\n    <module>uberfire-workingset-api</module>\n    <module>uberfire-workingset-client</module>\n  </modules>\n</project>\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/.gitignore",
    "content": "/target\n/classes\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workingset</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-workingset-api</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Workingset API</name>\n  <description>UberFire - Workingset API</description>\n\n  <dependencies>\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/events/OnWorkingSetApplied.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.events;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n *\n */\n//TODO {porcelli} remember that this events should be used also to update SCE/DataModel\npublic class OnWorkingSetApplied {\n\n    private Path resource;\n    private Path workingSet;\n\n    public OnWorkingSetApplied() {\n    }\n\n    public OnWorkingSetApplied(final Path resource,\n                               final Path workingSet) {\n        this.resource = resource;\n        this.workingSet = workingSet;\n    }\n\n    public Path getResource() {\n        return resource;\n    }\n\n    public Path getWorkingSet() {\n        return workingSet;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/events/OnWorkingSetDisabled.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.events;\n\nimport org.uberfire.backend.vfs.Path;\n\n/**\n *\n */\npublic class OnWorkingSetDisabled {\n\n    private Path resource;\n    private Path workingSet;\n\n    public OnWorkingSetDisabled() {\n    }\n\n    public OnWorkingSetDisabled(final Path resource,\n                                final Path workingSet) {\n        this.resource = resource;\n        this.workingSet = workingSet;\n    }\n\n    public Path getResource() {\n        return resource;\n    }\n\n    public Path getWorkingSet() {\n        return workingSet;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/ArgumentNotSetException.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints;\n\npublic class ArgumentNotSetException extends Exception {\n\n    private static final long serialVersionUID = 501l;\n\n    public ArgumentNotSetException() {\n        super();\n    }\n\n    public ArgumentNotSetException(String message,\n                                   Throwable cause) {\n        super(message,\n              cause);\n    }\n\n    public ArgumentNotSetException(String message) {\n        super(message);\n    }\n\n    public ArgumentNotSetException(Throwable cause) {\n        super(cause);\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/ConstraintConfiguration.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints;\n\nimport java.util.Set;\n\npublic interface ConstraintConfiguration {\n\n    public String getFactType();\n\n    public void setFactType(String factType);\n\n    public String getFieldName();\n\n    public void setFieldName(String fieldName);\n\n    public Set<String> getArgumentKeys();\n\n    public Object getArgumentValue(String key);\n\n    public void setArgumentValue(String key,\n                                 String value);\n\n    public boolean containsArgument(String key);\n\n    public String getConstraintName();\n\n    public void setConstraintName(String name);\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/ValidationResult.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints;\n\npublic class ValidationResult {\n\n    private boolean success;\n    private String message;\n\n    public boolean isSuccess() {\n        return success;\n    }\n\n    public void setSuccess(boolean success) {\n        this.success = success;\n    }\n\n    public String getMessage() {\n        return message;\n    }\n\n    public void setMessage(String message) {\n        this.message = message;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/config/SimpleConstraintConfigurationImpl.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.config;\n\nimport java.util.HashMap;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.guvnor.common.services.workingset.client.factconstraints.ConstraintConfiguration;\n\npublic class SimpleConstraintConfigurationImpl\n        implements ConstraintConfiguration {\n\n    private static final long serialVersionUID = 501l;\n    private Map<String, String> args = new HashMap<String, String>();\n    private String constraintName = null;\n    private String factType;\n    private String fieldName;\n\n    public SimpleConstraintConfigurationImpl(ConstraintConfiguration constraintConfiguration) {\n        copyFrom(constraintConfiguration);\n    }\n\n    public SimpleConstraintConfigurationImpl() {\n    }\n\n    public Set<String> getArgumentKeys() {\n        return args.keySet();\n    }\n\n    public Object getArgumentValue(String key) {\n        return args.get(key);\n    }\n\n    public String getConstraintName() {\n        return constraintName;\n    }\n\n    public void setConstraintName(String constraintName) {\n        this.constraintName = constraintName;\n    }\n\n    public String getFactType() {\n        return factType;\n    }\n\n    public String getFieldName() {\n        return fieldName;\n    }\n\n    public void setArgumentValue(String key,\n                                 String value) {\n        args.put(key,\n                 value);\n    }\n\n    public void setFactType(String factType) {\n        this.factType = factType;\n    }\n\n    public void setFieldName(String fieldName) {\n        this.fieldName = fieldName;\n    }\n\n    public boolean containsArgument(String key) {\n        return args.containsKey(key);\n    }\n\n    @Override\n    public String toString() {\n        return \"SimpleConstraintConfigurationImpl [args=\" + args + \", constraintName=\" + constraintName + \", factType=\"\n                + factType + \", fieldName=\" + fieldName + \"]\";\n    }\n\n    private void copyFrom(ConstraintConfiguration other) {\n        if (constraintName != null) {\n            throw new RuntimeException(\"can't copy configuration on a configured instance\");\n        }\n        this.constraintName = other.getConstraintName();\n        this.factType = other.getFactType();\n        this.fieldName = other.getFieldName();\n        this.args = new HashMap<String, String>();\n        for (String argName : other.getArgumentKeys()) {\n            this.args.put(argName,\n                          (String) other.getArgumentValue(argName));\n        }\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/customform/CustomFormConfiguration.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.customform;\n\npublic interface CustomFormConfiguration {\n\n    String getFactType();\n\n    void setFactType(String factType);\n\n    String getFieldName();\n\n    void setFieldName(String fieldName);\n\n    String getCustomFormURL();\n\n    void setCustomFormURL(String url);\n\n    int getCustomFormHeight();\n\n    void setCustomFormHeight(int height);\n\n    int getCustomFormWidth();\n\n    void setCustomFormWidth(int width);\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/customform/predefined/DefaultCustomFormImplementation.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.customform.predefined;\n\nimport org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration;\n\npublic class DefaultCustomFormImplementation\n        implements CustomFormConfiguration {\n\n    private int width = 200;\n    private int height = 200;\n    private String factType;\n    private String fieldName;\n    private String url;\n\n    public String getFactType() {\n        return this.factType;\n    }\n\n    public void setFactType(String factType) {\n        this.factType = factType;\n    }\n\n    public String getFieldName() {\n        return this.fieldName;\n    }\n\n    public void setFieldName(String fieldName) {\n        this.fieldName = fieldName;\n    }\n\n    public String getCustomFormURL() {\n        return this.url;\n    }\n\n    public void setCustomFormURL(String url) {\n        this.url = url;\n    }\n\n    public int getCustomFormHeight() {\n        return height;\n    }\n\n    public void setCustomFormHeight(int height) {\n        this.height = height;\n    }\n\n    public int getCustomFormWidth() {\n        return width;\n    }\n\n    public void setCustomFormWidth(int width) {\n        this.width = width;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/dataprovider/FieldDataProvider.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.dataprovider;\n\nimport java.util.Map;\n\npublic interface FieldDataProvider {\n\n    public void setFactTYpe(String factType);\n\n    public void setFieldName(String fieldName);\n\n    public String[] getArgumentKeys();\n\n    public Object getArgumentValue(String key);\n\n    public void setArgumentValue(String key,\n                                 Object value);\n\n    public Map<Object, String> getData();\n\n    public Object getDefault();\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/helper/ConstraintsContainer.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.helper;\n\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.Collections;\nimport java.util.HashMap;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.workingset.client.factconstraints.ConstraintConfiguration;\nimport org.guvnor.common.services.workingset.client.factconstraints.config.SimpleConstraintConfigurationImpl;\n\npublic class ConstraintsContainer {\n\n    private static final Map<String, ConstraintConfiguration> constraintConfigs = new HashMap<String, ConstraintConfiguration>();\n\n    static {\n        ConstraintConfiguration config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"NotNull\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"IntegerConstraint\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"RangeConstraint\");\n        config.setArgumentValue(\"Min.value\",\n                                \"0\");\n        config.setArgumentValue(\"Max.value\",\n                                \"0\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"NotMatches\");\n        config.setArgumentValue(\"matches\",\n                                \"\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"Matches\");\n        config.setArgumentValue(\"matches\",\n                                \"\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"IvalidFieldConstraint\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n\n        config = new SimpleConstraintConfigurationImpl();\n        config.setConstraintName(\"MandatoryFieldConstraint\");\n        constraintConfigs.put(config.getConstraintName(),\n                              config);\n    }\n\n    private Map<String, List<ConstraintConfiguration>> constraints = new HashMap<String, List<ConstraintConfiguration>>();\n\n    public ConstraintsContainer(ConstraintConfiguration[] constraints) {\n        this(Arrays.asList(constraints));\n    }\n\n    public ConstraintsContainer(Collection<ConstraintConfiguration> constraints) {\n        if (constraints != null && !constraints.isEmpty()) {\n            for (ConstraintConfiguration c : constraints) {\n                addConstraint(c);\n            }\n        }\n    }\n\n    public ConstraintsContainer() {\n\n    }\n\n    public List<ConstraintConfiguration> removeConstraint(ConstraintConfiguration c) {\n        List<ConstraintConfiguration> list = constraints.get(c.getFactType());\n        if (list != null) {\n            list.remove(c);\n        }\n        return list;\n    }\n\n    public void addConstraint(ConstraintConfiguration c) {\n        List<ConstraintConfiguration> list = constraints.get(c.getFactType());\n        if (list == null) {\n            list = new LinkedList<ConstraintConfiguration>();\n            constraints.put(c.getFactType(),\n                            list);\n        }\n        list.add(c);\n    }\n\n    public List<ConstraintConfiguration> getConstraints(String factType) {\n        return Collections.unmodifiableList(constraints.get(factType));\n    }\n\n    public List<ConstraintConfiguration> getConstraints(String factType,\n                                                        String fieldName) {\n\n        List<ConstraintConfiguration> list = constraints.get(factType);\n        if (list == null || list.isEmpty()) {\n            return Collections.emptyList();\n        }\n        List<ConstraintConfiguration> res = new LinkedList<ConstraintConfiguration>();\n        for (ConstraintConfiguration c : list) {\n            if (fieldName.equals(c.getFieldName())) {\n                res.add(c);\n            }\n        }\n        return res;\n    }\n\n    public boolean hasConstraints(String FactType) {\n        return constraints.containsKey(FactType);\n    }\n\n    public static Map<String, ConstraintConfiguration> getAllConfigurations() {\n        return constraintConfigs;\n    }\n\n    public static ConstraintConfiguration getEmptyConfiguration(String constraintName) {\n        return copyConfig(getAllConfigurations().get(constraintName));\n    }\n\n    private static ConstraintConfiguration copyConfig(ConstraintConfiguration constraintConfiguration) {\n        return new SimpleConstraintConfigurationImpl(constraintConfiguration);\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/factconstraints/helper/CustomFormsContainer.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.factconstraints.helper;\n\nimport java.util.ArrayList;\nimport java.util.Arrays;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Map;\n\nimport org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration;\nimport org.guvnor.common.services.workingset.client.factconstraints.customform.predefined.DefaultCustomFormImplementation;\n\npublic class CustomFormsContainer {\n\n    //because a FactType.field can only have one customForm,\n    //this map is: <\"FactType.field\", CustomForm>\n    private Map<String, CustomFormConfiguration> customForms = new HashMap<String, CustomFormConfiguration>();\n\n    public CustomFormsContainer(CustomFormConfiguration[] customFormsConfigs) {\n        this(Arrays.asList(customFormsConfigs));\n    }\n\n    public CustomFormsContainer(Collection<CustomFormConfiguration> customFormsConfigs) {\n        if (customFormsConfigs != null && !customFormsConfigs.isEmpty()) {\n            for (CustomFormConfiguration c : customFormsConfigs) {\n                putCustomForm(c);\n            }\n        }\n    }\n\n    //    public CustomFormsContainer() {\n//\n//    }\n    public void removeCustomForm(CustomFormConfiguration cfc) {\n        this.customForms.remove(this.createMapKey(cfc));\n    }\n\n    /**\n     * If cfc.getCustomFormURL() is empty, the CustomFormConfiguration is removed.\n     * @param cfc\n     */\n    public final void putCustomForm(CustomFormConfiguration cfc) {\n        if (cfc.getCustomFormURL().trim().equals(\"\")) {\n            this.customForms.remove(this.createMapKey(cfc));\n        } else {\n            this.customForms.put(this.createMapKey(cfc),\n                                 cfc);\n        }\n    }\n\n    public CustomFormConfiguration getCustomForm(String factType,\n                                                 String fieldName) {\n        return this.customForms.get(this.createMapKey(factType,\n                                                      fieldName));\n    }\n\n    public List<CustomFormConfiguration> getCustomForms() {\n        return new ArrayList<CustomFormConfiguration>(this.customForms.values());\n    }\n\n    public boolean containsCustomFormFor(String factType,\n                                         String fieldName) {\n        return this.getCustomForm(factType,\n                                  fieldName) != null;\n    }\n\n    private String createMapKey(String factType,\n                                String fieldName) {\n        return factType + \".\" + fieldName;\n    }\n\n    private String createMapKey(CustomFormConfiguration cfc) {\n        return this.createMapKey(cfc.getFactType(),\n                                 cfc.getFieldName());\n    }\n\n    public static CustomFormConfiguration getEmptyCustomFormConfiguration() {\n        return new DefaultCustomFormImplementation();\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/model/WorkingSetConfigData.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.model;\n\nimport java.util.List;\n\nimport org.guvnor.common.services.workingset.client.factconstraints.ConstraintConfiguration;\nimport org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration;\nimport org.jboss.errai.common.client.api.annotations.Portable;\n\n@Portable\npublic class WorkingSetConfigData {\n\n    private String name;\n    private String description;\n    private List<ConstraintConfiguration> constraints;\n    private List<CustomFormConfiguration> customForms;\n    private String[] validFacts;\n    private WorkingSetConfigData[] workingSets;\n\n    public WorkingSetConfigData() {\n\n    }\n\n    public String getName() {\n        return name;\n    }\n\n    public String getDescription() {\n        return description;\n    }\n\n    public List<ConstraintConfiguration> getConstraints() {\n        return constraints;\n    }\n\n    public List<CustomFormConfiguration> getCustomForms() {\n        return customForms;\n    }\n\n    public String[] getValidFacts() {\n        return validFacts;\n    }\n\n    public WorkingSetConfigData[] getWorkingSets() {\n        return workingSets;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/java/org/guvnor/common/services/workingset/client/model/WorkingSetSettings.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client.model;\n\nimport java.util.Collection;\nimport java.util.Map;\nimport java.util.Set;\n\nimport org.jboss.errai.common.client.api.annotations.Portable;\nimport org.uberfire.backend.vfs.Path;\n\n/**\n *\n */\n@Portable\npublic class WorkingSetSettings {\n\n    private Map<Path, WorkingSetConfigData> configData;\n\n    public WorkingSetSettings() {\n    }\n\n    public WorkingSetSettings(Map<Path, WorkingSetConfigData> configData) {\n        this.configData = configData;\n    }\n\n    public Set<Path> getResources() {\n        return configData.keySet();\n    }\n\n    public Collection<WorkingSetConfigData> getConfigData() {\n        return configData.values();\n    }\n\n    public void removeWorkingSet(final Path workingSet) {\n        configData.remove(workingSet);\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-api/src/main/resources/org/guvnor/common/services/workingset/GuvnorWorkingsetAPI.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n\n</module>\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/.gitignore",
    "content": "/target\n/local\n\n# Eclipse, Netbeans and IntelliJ files\n/.*\n/**/.*\n!.gitignore\n/nbproject\n*.ipr\n*.iws\n*.iml\n\n# Repository wide ignore mac DS_Store files\n.DS_Store\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd\">\n  <parent>\n    <groupId>org.uberfire</groupId>\n    <artifactId>uberfire-workingset</artifactId>\n    <version>7.75.0-SNAPSHOT</version>\n  </parent>\n  <modelVersion>4.0.0</modelVersion>\n\n  <artifactId>uberfire-workingset-client</artifactId>\n  <packaging>jar</packaging>\n\n  <name>UberFire - Workingset Client</name>\n  <description>UberFire - Workingset Client</description>\n\n  <dependencies>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-workingset-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-project-api</artifactId>\n      <exclusions>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-services-api</artifactId>\n        </exclusion>\n        <exclusion>\n          <groupId>org.uberfire</groupId>\n          <artifactId>uberfire-structure-api</artifactId>\n        </exclusion>\n      </exclusions>\n    </dependency>\n\n    <dependency>\n      <groupId>org.jboss.errai</groupId>\n      <artifactId>errai-common</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>org.uberfire</groupId>\n      <artifactId>uberfire-api</artifactId>\n    </dependency>\n\n    <dependency>\n      <groupId>jakarta.inject</groupId>\n      <artifactId>jakarta.inject-api</artifactId>\n    </dependency>\n  </dependencies>\n\n</project>\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/src/main/java/org/guvnor/common/services/workingset/client/WorkingSetManager.java",
    "content": "/*\n * Copyright 2012 Red Hat, Inc. and/or its affiliates.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n *       http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.guvnor.common.services.workingset.client;\n\nimport java.util.ArrayList;\nimport java.util.Collection;\nimport java.util.HashMap;\nimport java.util.HashSet;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Set;\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.enterprise.event.Observes;\nimport javax.inject.Inject;\n\nimport org.guvnor.common.services.project.model.Module;\nimport org.guvnor.common.services.project.service.ModuleService;\nimport org.guvnor.common.services.workingset.client.events.OnWorkingSetApplied;\nimport org.guvnor.common.services.workingset.client.events.OnWorkingSetDisabled;\nimport org.guvnor.common.services.workingset.client.factconstraints.ConstraintConfiguration;\nimport org.guvnor.common.services.workingset.client.factconstraints.customform.CustomFormConfiguration;\nimport org.guvnor.common.services.workingset.client.factconstraints.helper.CustomFormsContainer;\nimport org.guvnor.common.services.workingset.client.model.WorkingSetConfigData;\nimport org.guvnor.common.services.workingset.client.model.WorkingSetSettings;\nimport org.jboss.errai.common.client.api.Caller;\nimport org.uberfire.backend.vfs.Path;\n\n//import org.uberfire.commons.data.Pair;\n\n@ApplicationScoped\npublic class WorkingSetManager {\n\n    private Map<Path, WorkingSetSettings> projectSettings = new HashMap<Path, WorkingSetSettings>();\n\n    @Inject\n    private Caller<ModuleService<? super Module>> moduleServiceCaller;\n\n    /**\n     * This attribute should be sever side. Maybe in some FactConstraintConfig\n     * object.\n     */\n    private boolean autoVerifierEnabled = false;\n\n    public void onWorkingSetApplied(@Observes final OnWorkingSetApplied event) {\n//        final Pair<Path, WorkingSetSettings> projectReference = getProjectConfig( event.getResource() );\n//        if ( projectReference != null && projectReference.getK2() == null ) {\n//            moduleService.call( new RemoteCallback<WorkingSetSettings>() {\n//                @Override\n//                public void callback( final WorkingSetSettings response ) {\n//                    projectSettings.put( projectReference.getK1(), response );\n//                }\n//            } ).loadWorkingSetConfig( projectReference.getK1() );\n//        }\n    }\n\n    public void onWorkingSetDisabled(@Observes final OnWorkingSetDisabled event) {\n        final WorkingSetSettings settings = getActiveSettings(event.getResource());\n        if (settings != null) {\n            settings.removeWorkingSet(event.getWorkingSet());\n        }\n    }\n\n    /**\n     * Returns the active WorkingSets for a package, or null if any.\n     * @param resource the resource - part of a project\n     * @return the active WorkingSets for a package, or null if any.\n     */\n    public Collection<WorkingSetConfigData> getActiveWorkingSets(final Path resource) {\n        final WorkingSetSettings result = getActiveSettings(resource);\n        if (result == null) {\n            return null;\n        }\n        return result.getConfigData();\n    }\n\n//    public Pair<Path, WorkingSetSettings> getProjectConfig( final Path resource ) {\n//        final Path project = projectResources.getProject( resource );\n//        if ( project == null ) {\n//            return null;\n//        }\n//        return new Pair<Path, WorkingSetSettings>( project, projectSettings.get( project ) );\n//    }\n\n    public WorkingSetSettings getActiveSettings(final Path resource) {\n//        final Path projectReference = projectResources.getProject( resource );\n//        if ( projectReference == null ) {\n//            return null;\n//        }\n//        return projectSettings.get( projectReference );\n        return null;\n    }\n\n    public void removeWorkingSets(final Path resource) {\n//        final Path projectReference = projectResources.getProject( resource );\n//        if ( projectReference != null ) {\n//            projectSettings.remove( projectReference );\n//        }\n    }\n\n    /**\n     * Returns whether the given (WorkingSet) RuleSet is active in a project or not.\n     * @param resource the resource.\n     * @param workingSet the (WorkingSet) RuleSet\n     * @return whether the given (WorkingSet) RuleSet is active in a project or not.\n     */\n    public boolean isWorkingSetActive(final Path resource,\n                                      final Path workingSet) {\n        final WorkingSetSettings result = getActiveSettings(resource);\n        if (result == null) {\n            return false;\n        }\n\n        return result.getResources().contains(workingSet);\n    }\n\n    /**\n     * Returns a Set of Constraints for a Fact Type's field. This method uses\n     * the active Working Sets of the project in order to get the Constraints.\n     * @param resource the resource.\n     * @param factType the Fact Type (Short class name)\n     * @param fieldName the field name\n     * @return a Set of Constraints for a Fact Type's field.\n     */\n    public Set<ConstraintConfiguration> getFieldContraints(final Path resource,\n                                                           final String factType,\n                                                           final String fieldName) {\n\n        final Set<ConstraintConfiguration> result = new HashSet<ConstraintConfiguration>();\n\n        //TODO: Change this with a centralized way of Constraint Administration.\n        final Collection<WorkingSetConfigData> activeConfig = this.getActiveWorkingSets(resource);\n        if (activeConfig != null) {\n            for (final WorkingSetConfigData configData : activeConfig) {\n                final List<ConstraintConfiguration> constraints = configData.getConstraints();\n                if (constraints != null) {\n                    for (final ConstraintConfiguration constraint : constraints) {\n                        if (constraint.getFactType().equals(factType) && constraint.getFieldName().equals(fieldName)) {\n                            result.add(constraint);\n                        }\n                    }\n                }\n            }\n        }\n\n        return result;\n    }\n\n    /**\n     * TODO: We need to store/retrieve this value from repository\n     * @return\n     */\n    public boolean isAutoVerifierEnabled() {\n        return autoVerifierEnabled;\n    }\n\n    /**\n     * TODO: We need to store/retrieve this value from repository\n     */\n    public void setAutoVerifierEnabled(boolean autoVerifierEnabled) {\n        this.autoVerifierEnabled = autoVerifierEnabled;\n    }\n\n    /**\n     * Returns the associated CustomFormConfiguration for a given FactType and FieldName.\n     * Because CustomFormConfiguration is stored inside a WorkingSet, the\n     * packageName attribute is used to retrieve all the active WorkingSets.\n     * If more than one active WorkingSet contain a CustomFormConfiguration for\n     * the given FactType and FieldName the first to be found (in any specific\n     * nor deterministic order) will be returned.\n     * @param resource the resource (part of of a project). Used to get the active\n     * working sets of the active resource project\n     * @param factType The short class name of the Fact Type\n     * @param fieldName The field name\n     * @return the associated CustomFormConfiguration for the given FactType and\n     * FieldName in the active working sets or null if any.\n     */\n    public CustomFormConfiguration getCustomFormConfiguration(final Path resource,\n                                                              final String factType,\n                                                              final String fieldName) {\n        final Collection<WorkingSetConfigData> packageWorkingSets = this.getActiveWorkingSets(resource);\n        if (packageWorkingSets != null) {\n            final List<CustomFormConfiguration> configs = new ArrayList<CustomFormConfiguration>();\n            for (final WorkingSetConfigData workingSetConfigData : packageWorkingSets) {\n                if (workingSetConfigData.getCustomForms() != null && !workingSetConfigData.getCustomForms().isEmpty()) {\n                    configs.addAll(workingSetConfigData.getCustomForms());\n                }\n            }\n            final CustomFormsContainer cfc = new CustomFormsContainer(configs);\n\n            if (cfc.containsCustomFormFor(factType,\n                                          fieldName)) {\n                return cfc.getCustomForm(factType,\n                                         fieldName);\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/src/main/resources/META-INF/ErraiApp.properties",
    "content": "#\n# Copyright 2012 Red Hat, Inc. and/or its affiliates.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#       http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n#\n\n# ErraiApp.properties\n#\n# Do not remove, even if empty!\n#\n\n# This is a marker file. When it is detected inside a JAR or at the\n# top of any classpath, the subdirectories are scanned for deployable\n# components. As such, all Errai application modules in a project\n# should contain an ErraiApp.properties at the root of all classpaths\n# that you wish to be scanned.\n#\n# There are also some configuration options that can be set in this\n# file, although it is rarely necessary. See the documentation at\n# https://docs.jboss.org/author/display/ERRAI/ErraiApp.properties\n# for details.\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/src/main/resources/META-INF/beans.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<beans xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\" bean-discovery-mode=\"none\">\n  <scan>\n    <exclude name=\"org.guvnor.common.services.workingset.client.**\"/>\n  </scan>\n</beans>\n"
  },
  {
    "path": "uberfire-workingset/uberfire-workingset-client/src/main/resources/org/guvnor/common/services/workingset/GuvnorWorkingsetClient.gwt.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!--\n  ~ Copyright 2012 Red Hat, Inc. and/or its affiliates.\n  ~\n  ~ Licensed under the Apache License, Version 2.0 (the \"License\");\n  ~ you may not use this file except in compliance with the License.\n  ~ You may obtain a copy of the License at\n  ~\n  ~       http://www.apache.org/licenses/LICENSE-2.0\n  ~\n  ~ Unless required by applicable law or agreed to in writing, software\n  ~ distributed under the License is distributed on an \"AS IS\" BASIS,\n  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n  ~ See the License for the specific language governing permissions and\n  ~ limitations under the License.\n  -->\n\n<!DOCTYPE module PUBLIC \"-//Google Inc.//DTD Google Web Toolkit 2.7.0//EN\"\n    \"http://www.gwtproject.org/doctype/2.7.0/gwt-module.dtd\">\n<module>\n\n  <inherits name='org.uberfire.UberfireAPI'/>\n  <inherits name='org.guvnor.common.services.project.GuvnorProjectAPI'/>\n  <inherits name='org.guvnor.common.services.workingset.GuvnorWorkingsetAPI'/>\n\n</module>\n"
  }
]